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
|
---|---|---|---|---|---|
nlp/topic_modeling.py | innaiivanova/chatbot | 0 | 131286 | <gh_stars>0
# Codecademy's topic modeling
# <NAME>
import nltk, re
from sherlock_holmes import bohemia_ch1, bohemia_ch2, bohemia_ch3, boscombe_ch1, boscombe_ch2, boscombe_ch3
from preprocessing import preprocess_text
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
from sklearn.decomposition import LatentDirichletAllocation
# preparing the text
corpus = [bohemia_ch1, bohemia_ch2, bohemia_ch3, boscombe_ch1, boscombe_ch2, boscombe_ch3]
preprocessed_corpus = [preprocess_text(chapter) for chapter in corpus]
# Update stop_list:
stop_list = ["stop", "list", "free", "has", "words", "home", "six", "town", "random", "say"]
# filtering topics for stop words
def filter_out_stop_words(corpus):
no_stops_corpus = []
for chapter in corpus:
no_stops_chapter = " ".join([word for word in chapter.split(" ") if word not in stop_list])
no_stops_corpus.append(no_stops_chapter)
return no_stops_corpus
filtered_for_stops = filter_out_stop_words(preprocessed_corpus)
# creating the bag of words model
bag_of_words_creator = CountVectorizer()
bag_of_words = bag_of_words_creator.fit_transform(filtered_for_stops)
# creating the tf-idf model
tfidf_creator = TfidfVectorizer(min_df = 0.2)
tfidf = tfidf_creator.fit_transform(preprocessed_corpus)
# creating the bag of words LDA model
lda_bag_of_words_creator = LatentDirichletAllocation(learning_method='online', n_components=10)
lda_bag_of_words = lda_bag_of_words_creator.fit_transform(bag_of_words)
# creating the tf-idf LDA model
lda_tfidf_creator = LatentDirichletAllocation(learning_method='online', n_components=10)
lda_tfidf = lda_tfidf_creator.fit_transform(tfidf)
print("~~~ Topics found by bag of words LDA ~~~")
for topic_id, topic in enumerate(lda_bag_of_words_creator.components_):
message = "Topic #{}: ".format(topic_id + 1)
message += " ".join([bag_of_words_creator.get_feature_names()[i] for i in topic.argsort()[:-5 :-1]])
print(message)
print("\n\n~~~ Topics found by tf-idf LDA ~~~")
for topic_id, topic in enumerate(lda_tfidf_creator.components_):
message = "Topic #{}: ".format(topic_id + 1)
message += " ".join([tfidf_creator.get_feature_names()[i] for i in topic.argsort()[:-5 :-1]])
print(message)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
5920,
9567,
29915,
29879,
11261,
1904,
292,
13,
29937,
529,
5813,
29958,
13,
13,
5215,
302,
1896,
29895,
29892,
337,
13,
3166,
528,
261,
908,
29918,
5391,
4467,
1053,
1045,
8008,
423,
29918,
305,
29896,
29892,
1045,
8008,
423,
29918,
305,
29906,
29892,
1045,
8008,
423,
29918,
305,
29941,
29892,
13601,
510,
915,
29918,
305,
29896,
29892,
13601,
510,
915,
29918,
305,
29906,
29892,
13601,
510,
915,
29918,
305,
29941,
13,
3166,
758,
19170,
1053,
758,
5014,
29918,
726,
13,
3166,
2071,
19668,
29889,
14394,
29918,
1062,
13857,
29889,
726,
1053,
3917,
12877,
3950,
29892,
323,
29888,
333,
29888,
12877,
3950,
13,
3166,
2071,
19668,
29889,
311,
510,
3283,
1053,
7053,
296,
9170,
436,
1026,
2499,
5479,
13,
13,
29937,
10223,
292,
278,
1426,
13,
2616,
13364,
353,
518,
833,
8008,
423,
29918,
305,
29896,
29892,
1045,
8008,
423,
29918,
305,
29906,
29892,
1045,
8008,
423,
29918,
305,
29941,
29892,
13601,
510,
915,
29918,
305,
29896,
29892,
13601,
510,
915,
29918,
305,
29906,
29892,
13601,
510,
915,
29918,
305,
29941,
29962,
13,
1457,
5014,
287,
29918,
2616,
13364,
353,
518,
1457,
5014,
29918,
726,
29898,
27349,
29897,
363,
16385,
297,
1034,
13364,
29962,
13,
13,
29937,
10318,
5040,
29918,
1761,
29901,
13,
9847,
29918,
1761,
353,
6796,
9847,
613,
376,
1761,
613,
376,
9021,
613,
376,
5349,
613,
376,
9303,
613,
376,
5184,
613,
376,
28319,
613,
376,
27734,
613,
376,
8172,
613,
376,
20834,
3108,
13,
29937,
21166,
23820,
363,
5040,
3838,
13,
1753,
4175,
29918,
449,
29918,
9847,
29918,
9303,
29898,
2616,
13364,
1125,
13,
29871,
694,
29918,
303,
3554,
29918,
2616,
13364,
353,
5159,
13,
29871,
363,
16385,
297,
1034,
13364,
29901,
13,
1678,
694,
29918,
303,
3554,
29918,
27349,
353,
376,
11393,
7122,
4197,
1742,
363,
1734,
297,
16385,
29889,
5451,
703,
16521,
565,
1734,
451,
297,
5040,
29918,
1761,
2314,
13,
1678,
694,
29918,
303,
3554,
29918,
2616,
13364,
29889,
4397,
29898,
1217,
29918,
303,
3554,
29918,
27349,
29897,
13,
29871,
736,
694,
29918,
303,
3554,
29918,
2616,
13364,
13,
4572,
287,
29918,
1454,
29918,
303,
3554,
353,
4175,
29918,
449,
29918,
9847,
29918,
9303,
29898,
1457,
5014,
287,
29918,
2616,
13364,
29897,
13,
13,
29937,
4969,
278,
19548,
310,
3838,
1904,
13,
23156,
29918,
974,
29918,
9303,
29918,
1037,
1061,
353,
3917,
12877,
3950,
580,
13,
23156,
29918,
974,
29918,
9303,
353,
19548,
29918,
974,
29918,
9303,
29918,
1037,
1061,
29889,
9202,
29918,
9067,
29898,
4572,
287,
29918,
1454,
29918,
303,
3554,
29897,
13,
13,
29937,
4969,
278,
15886,
29899,
333,
29888,
1904,
13,
13264,
333,
29888,
29918,
1037,
1061,
353,
323,
29888,
333,
29888,
12877,
3950,
29898,
1195,
29918,
2176,
353,
29871,
29900,
29889,
29906,
29897,
13,
13264,
333,
29888,
353,
15886,
333,
29888,
29918,
1037,
1061,
29889,
9202,
29918,
9067,
29898,
1457,
5014,
287,
29918,
2616,
13364,
29897,
13,
13,
29937,
4969,
278,
19548,
310,
3838,
365,
7698,
1904,
13,
430,
29874,
29918,
23156,
29918,
974,
29918,
9303,
29918,
1037,
1061,
353,
7053,
296,
9170,
436,
1026,
2499,
5479,
29898,
21891,
29918,
5696,
2433,
14627,
742,
302,
29918,
14036,
29922,
29896,
29900,
29897,
13,
430,
29874,
29918,
23156,
29918,
974,
29918,
9303,
353,
301,
1388,
29918,
23156,
29918,
974,
29918,
9303,
29918,
1037,
1061,
29889,
9202,
29918,
9067,
29898,
23156,
29918,
974,
29918,
9303,
29897,
13,
13,
29937,
4969,
278,
15886,
29899,
333,
29888,
365,
7698,
1904,
13,
430,
29874,
29918,
13264,
333,
29888,
29918,
1037,
1061,
353,
7053,
296,
9170,
436,
1026,
2499,
5479,
29898,
21891,
29918,
5696,
2433,
14627,
742,
302,
29918,
14036,
29922,
29896,
29900,
29897,
13,
430,
29874,
29918,
13264,
333,
29888,
353,
301,
1388,
29918,
13264,
333,
29888,
29918,
1037,
1061,
29889,
9202,
29918,
9067,
29898,
13264,
333,
29888,
29897,
13,
13,
2158,
703,
7377,
30022,
7488,
1199,
1476,
491,
19548,
310,
3838,
365,
7698,
3695,
7377,
1159,
13,
1454,
11261,
29918,
333,
29892,
11261,
297,
26985,
29898,
430,
29874,
29918,
23156,
29918,
974,
29918,
9303,
29918,
1037,
1061,
29889,
14036,
29918,
1125,
13,
29871,
2643,
353,
376,
7031,
293,
24037,
6177,
11393,
4830,
29898,
13010,
29918,
333,
718,
29871,
29896,
29897,
13,
29871,
2643,
4619,
376,
11393,
7122,
4197,
23156,
29918,
974,
29918,
9303,
29918,
1037,
1061,
29889,
657,
29918,
14394,
29918,
7039,
580,
29961,
29875,
29962,
363,
474,
297,
11261,
29889,
5085,
441,
580,
7503,
29899,
29945,
8956,
29896,
24960,
13,
29871,
1596,
29898,
4906,
29897,
13,
13,
2158,
14182,
29876,
29905,
29876,
7377,
30022,
7488,
1199,
1476,
491,
15886,
29899,
333,
29888,
365,
7698,
3695,
7377,
1159,
13,
1454,
11261,
29918,
333,
29892,
11261,
297,
26985,
29898,
430,
29874,
29918,
13264,
333,
29888,
29918,
1037,
1061,
29889,
14036,
29918,
1125,
13,
29871,
2643,
353,
376,
7031,
293,
24037,
6177,
11393,
4830,
29898,
13010,
29918,
333,
718,
29871,
29896,
29897,
13,
29871,
2643,
4619,
376,
11393,
7122,
4197,
13264,
333,
29888,
29918,
1037,
1061,
29889,
657,
29918,
14394,
29918,
7039,
580,
29961,
29875,
29962,
363,
474,
297,
11261,
29889,
5085,
441,
580,
7503,
29899,
29945,
8956,
29896,
24960,
13,
29871,
1596,
29898,
4906,
29897,
13,
259,
13,
2
] |
slash/utils/python.py | bheesham/slash | 70 | 1609339 | from collections import OrderedDict
from types import TracebackType
import functools
import warnings
import inspect
import sys
import ast
import pickle
import logbook
from sentinels import NOTHING
PYPY = hasattr(sys, 'pypy_version_info')
_logger = logbook.Logger(__name__)
def check_duplicate_functions(path):
code = None
with open(path, 'rb') as f:
code = f.read()
with warnings.catch_warnings():
warnings.simplefilter('ignore')
root = ast.parse(code, filename=path)
func_names = set()
duplicates = set()
for node in root.body:
if isinstance(node, ast.FunctionDef):
if node.name in func_names:
duplicates.add((path, node.name, node.lineno))
else:
func_names.add(node.name)
return duplicates
def wraps(func, preserve=()):
def decorator(new_func):
returned = functools.wraps(func)(new_func)
returned.__wraps__ = func
return returned
for p in preserve:
orig = getattr(func, p, NOTHING)
if orig is not NOTHING:
setattr(decorator, p, orig)
return decorator
def unpickle(thing):
if not thing:
return thing
return pickle.loads(thing.data)
def get_underlying_func(func):
while True:
underlying = getattr(func, "__wraps__", None)
if underlying is None:
return func
func = underlying
def get_argument_names(func):
return [arg.name for arg in get_arguments(func)]
def get_arguments_dict(func):
returned = OrderedDict()
for arg in get_arguments(func):
returned[arg.name] = arg
return returned
def get_arguments(func):
if PYPY:
func = get_underlying_func(func)
spec = inspect.getargspec(func) # pylint: disable=deprecated-method
returned = [FunctionArgument(name=name) for name in spec.args]
else:
if getattr(func, '__self__', None) is not None:
func = func.__func__ # signature() doesn't work on bound methods
returned = [FunctionArgument.from_parameter(p) for name, p in inspect.signature(func).parameters.items()] # pylint: disable=no-member
if returned and returned[0].name == 'self':
returned = returned[1:]
return returned
class FunctionArgument(object):
def __init__(self, name, annotation=NOTHING):
super(FunctionArgument, self).__init__()
self.name = name
self.annotation = annotation
@classmethod
def from_parameter(cls, parameter):
annotation = parameter.annotation
if annotation is parameter.empty:
annotation = NOTHING
return cls(name=parameter.name, annotation=parameter.annotation)
def call_all_raise_first(_funcs, *args, **kwargs):
exc_info = None
for func in _funcs:
try:
func(*args, **kwargs)
except Exception: # pylint: disable=broad-except
exc_info = sys.exc_info()
if exc_info is not None:
reraise(*exc_info)
def resolve_underlying_function(thing):
"""Gets the underlying (real) function for functions, wrapped functions, methods, etc.
Returns the same object for things that are not functions
"""
while True:
wrapped = getattr(thing, "__func__", None) or getattr(thing, "__wrapped__", None) or getattr(thing, "__wraps__", None)
if wrapped is None:
break
thing = wrapped
return thing
def reraise(tp, value, tb=None):
# A hacky way to check, whether we have a TracebackProxy here. Can't check directly, as
# it would lead to circular import.
if value.__traceback__ is not tb:
if not isinstance(tb, TracebackType):
tb = tb._tb # pylint: disable=protected-access
raise value.with_traceback(tb)
raise value
def get_underlying_classmethod_function(func):
return func.__func__
def safe_set_attribute(obj, name, value):
try:
setattr(obj, name, value)
except Exception: # pylint: disable=broad-except
try:
obj.__dict__[name] = value
except Exception: # pylint: disable=broad-except
_logger.debug("Failed to set attribute {!r} on {!r}", name, obj)
| [
1,
515,
16250,
1053,
8170,
287,
21533,
13,
3166,
4072,
1053,
29243,
1542,
13,
5215,
2090,
312,
8789,
13,
5215,
18116,
13,
5215,
16096,
13,
5215,
10876,
13,
5215,
8717,
13,
5215,
5839,
280,
13,
5215,
1480,
2909,
13,
13,
3166,
2665,
262,
1379,
1053,
6058,
29950,
4214,
13,
13,
13,
20055,
20055,
353,
756,
5552,
29898,
9675,
29892,
525,
29886,
1478,
29891,
29918,
3259,
29918,
3888,
1495,
13,
29918,
21707,
353,
1480,
2909,
29889,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
1423,
29918,
20908,
5926,
29918,
12171,
29898,
2084,
1125,
13,
1678,
775,
353,
6213,
13,
1678,
411,
1722,
29898,
2084,
29892,
525,
6050,
1495,
408,
285,
29901,
13,
4706,
775,
353,
285,
29889,
949,
580,
13,
1678,
411,
18116,
29889,
12510,
29918,
25442,
886,
7295,
13,
4706,
18116,
29889,
12857,
4572,
877,
17281,
1495,
13,
4706,
3876,
353,
8717,
29889,
5510,
29898,
401,
29892,
10422,
29922,
2084,
29897,
13,
1678,
3653,
29918,
7039,
353,
731,
580,
13,
1678,
20955,
353,
731,
580,
13,
1678,
363,
2943,
297,
3876,
29889,
2587,
29901,
13,
4706,
565,
338,
8758,
29898,
3177,
29892,
8717,
29889,
6678,
3206,
1125,
13,
9651,
565,
2943,
29889,
978,
297,
3653,
29918,
7039,
29901,
13,
18884,
20955,
29889,
1202,
3552,
2084,
29892,
2943,
29889,
978,
29892,
2943,
29889,
1915,
8154,
876,
13,
9651,
1683,
29901,
13,
18884,
3653,
29918,
7039,
29889,
1202,
29898,
3177,
29889,
978,
29897,
13,
1678,
736,
20955,
13,
13,
13,
1753,
11463,
567,
29898,
9891,
29892,
19905,
29922,
580,
1125,
13,
1678,
822,
10200,
1061,
29898,
1482,
29918,
9891,
1125,
13,
4706,
4133,
353,
2090,
312,
8789,
29889,
29893,
336,
567,
29898,
9891,
5033,
1482,
29918,
9891,
29897,
13,
4706,
4133,
17255,
29893,
336,
567,
1649,
353,
3653,
13,
4706,
736,
4133,
13,
1678,
363,
282,
297,
19905,
29901,
13,
4706,
1677,
353,
679,
5552,
29898,
9891,
29892,
282,
29892,
6058,
29950,
4214,
29897,
13,
4706,
565,
1677,
338,
451,
6058,
29950,
4214,
29901,
13,
9651,
731,
5552,
29898,
19557,
1061,
29892,
282,
29892,
1677,
29897,
13,
1678,
736,
10200,
1061,
13,
13,
1753,
443,
23945,
280,
29898,
1918,
1125,
13,
1678,
565,
451,
2655,
29901,
13,
4706,
736,
2655,
13,
1678,
736,
5839,
280,
29889,
18132,
29898,
1918,
29889,
1272,
29897,
13,
13,
1753,
679,
29918,
5062,
5890,
29918,
9891,
29898,
9891,
1125,
13,
1678,
1550,
5852,
29901,
13,
4706,
14407,
353,
679,
5552,
29898,
9891,
29892,
376,
1649,
29893,
336,
567,
1649,
613,
6213,
29897,
13,
4706,
565,
14407,
338,
6213,
29901,
13,
9651,
736,
3653,
13,
4706,
3653,
353,
14407,
13,
13,
13,
1753,
679,
29918,
23516,
29918,
7039,
29898,
9891,
1125,
13,
1678,
736,
518,
1191,
29889,
978,
363,
1852,
297,
679,
29918,
25699,
29898,
9891,
4638,
13,
13,
13,
1753,
679,
29918,
25699,
29918,
8977,
29898,
9891,
1125,
13,
1678,
4133,
353,
8170,
287,
21533,
580,
13,
1678,
363,
1852,
297,
679,
29918,
25699,
29898,
9891,
1125,
13,
4706,
4133,
29961,
1191,
29889,
978,
29962,
353,
1852,
13,
1678,
736,
4133,
13,
13,
13,
1753,
679,
29918,
25699,
29898,
9891,
1125,
13,
1678,
565,
349,
29979,
20055,
29901,
13,
4706,
3653,
353,
679,
29918,
5062,
5890,
29918,
9891,
29898,
9891,
29897,
13,
4706,
1580,
353,
16096,
29889,
657,
5085,
3135,
29898,
9891,
29897,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
311,
17990,
630,
29899,
5696,
13,
4706,
4133,
353,
518,
6678,
15730,
29898,
978,
29922,
978,
29897,
363,
1024,
297,
1580,
29889,
5085,
29962,
13,
1678,
1683,
29901,
13,
4706,
565,
679,
5552,
29898,
9891,
29892,
525,
1649,
1311,
1649,
742,
6213,
29897,
338,
451,
6213,
29901,
13,
9651,
3653,
353,
3653,
17255,
9891,
1649,
396,
12608,
580,
1838,
29915,
29873,
664,
373,
3216,
3519,
13,
4706,
4133,
353,
518,
6678,
15730,
29889,
3166,
29918,
15501,
29898,
29886,
29897,
363,
1024,
29892,
282,
297,
16096,
29889,
4530,
1535,
29898,
9891,
467,
16744,
29889,
7076,
580,
29962,
396,
282,
2904,
524,
29901,
11262,
29922,
1217,
29899,
14242,
13,
13,
1678,
565,
4133,
322,
4133,
29961,
29900,
1822,
978,
1275,
525,
1311,
2396,
13,
4706,
4133,
353,
4133,
29961,
29896,
17531,
13,
1678,
736,
4133,
13,
13,
13,
1990,
6680,
15730,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
17195,
29922,
12256,
29950,
4214,
1125,
13,
4706,
2428,
29898,
6678,
15730,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
18317,
353,
17195,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
15501,
29898,
25932,
29892,
3443,
1125,
13,
4706,
17195,
353,
3443,
29889,
18317,
13,
4706,
565,
17195,
338,
3443,
29889,
6310,
29901,
13,
9651,
17195,
353,
6058,
29950,
4214,
13,
4706,
736,
1067,
29879,
29898,
978,
29922,
15501,
29889,
978,
29892,
17195,
29922,
15501,
29889,
18317,
29897,
13,
13,
13,
1753,
1246,
29918,
497,
29918,
22692,
29918,
4102,
7373,
7692,
2395,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
1678,
5566,
29918,
3888,
353,
6213,
13,
1678,
363,
3653,
297,
903,
7692,
2395,
29901,
13,
4706,
1018,
29901,
13,
9651,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
5174,
8960,
29901,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
6729,
328,
29899,
19499,
13,
9651,
5566,
29918,
3888,
353,
10876,
29889,
735,
29883,
29918,
3888,
580,
13,
1678,
565,
5566,
29918,
3888,
338,
451,
6213,
29901,
13,
4706,
364,
1572,
895,
10456,
735,
29883,
29918,
3888,
29897,
13,
13,
13,
1753,
8814,
29918,
5062,
5890,
29918,
2220,
29898,
1918,
1125,
13,
1678,
9995,
29954,
1691,
278,
14407,
313,
6370,
29897,
740,
363,
3168,
29892,
21021,
3168,
29892,
3519,
29892,
2992,
29889,
13,
1678,
16969,
278,
1021,
1203,
363,
2712,
393,
526,
451,
3168,
13,
1678,
9995,
13,
1678,
1550,
5852,
29901,
13,
4706,
21021,
353,
679,
5552,
29898,
1918,
29892,
376,
1649,
9891,
1649,
613,
6213,
29897,
470,
679,
5552,
29898,
1918,
29892,
376,
1649,
29893,
336,
2986,
1649,
613,
6213,
29897,
470,
679,
5552,
29898,
1918,
29892,
376,
1649,
29893,
336,
567,
1649,
613,
6213,
29897,
13,
4706,
565,
21021,
338,
6213,
29901,
13,
9651,
2867,
13,
4706,
2655,
353,
21021,
13,
1678,
736,
2655,
13,
13,
13,
1753,
364,
1572,
895,
29898,
9392,
29892,
995,
29892,
260,
29890,
29922,
8516,
1125,
13,
1678,
396,
319,
15833,
29891,
982,
304,
1423,
29892,
3692,
591,
505,
263,
29243,
14048,
1244,
29889,
1815,
29915,
29873,
1423,
4153,
29892,
408,
13,
1678,
396,
372,
723,
3275,
304,
19308,
1053,
29889,
13,
1678,
565,
995,
17255,
15003,
1627,
1649,
338,
451,
260,
29890,
29901,
13,
4706,
565,
451,
338,
8758,
29898,
22625,
29892,
29243,
1542,
1125,
13,
9651,
260,
29890,
353,
260,
29890,
3032,
22625,
396,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
13,
4706,
12020,
995,
29889,
2541,
29918,
15003,
1627,
29898,
22625,
29897,
13,
1678,
12020,
995,
13,
13,
13,
1753,
679,
29918,
5062,
5890,
29918,
1990,
5696,
29918,
2220,
29898,
9891,
1125,
13,
1678,
736,
3653,
17255,
9891,
1649,
13,
13,
13,
1753,
9109,
29918,
842,
29918,
12715,
29898,
5415,
29892,
1024,
29892,
995,
1125,
13,
1678,
1018,
29901,
13,
4706,
731,
5552,
29898,
5415,
29892,
1024,
29892,
995,
29897,
13,
1678,
5174,
8960,
29901,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
6729,
328,
29899,
19499,
13,
4706,
1018,
29901,
13,
9651,
5446,
17255,
8977,
1649,
29961,
978,
29962,
353,
995,
13,
4706,
5174,
8960,
29901,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
6729,
328,
29899,
19499,
13,
9651,
903,
21707,
29889,
8382,
703,
17776,
304,
731,
5352,
426,
29991,
29878,
29913,
373,
426,
29991,
29878,
17671,
1024,
29892,
5446,
29897,
13,
2
] |
mean_fits.py | kafkaphoenix/data-driven-astro | 0 | 140804 | <filename>mean_fits.py
from astropy.io import fits
import numpy as np
# Write your mean_fits function here:
def mean_fits(files):
all_data = []
for k, file in enumerate(files):
if k == 0:
all_data = fits.getdata(file)
else:
data = fits.getdata(file)
all_data = all_data + data
all_data = all_data / len(files)
return all_data
if __name__ == '__main__':
# Test your function with examples from the question
data = mean_fits(['image0.fits', 'image1.fits', 'image2.fits'])
print(data[100, 100])
# You can also plot the result:
import matplotlib.pyplot as plt
plt.imshow(data.T, cmap=plt.cm.viridis)
plt.colorbar()
plt.show() | [
1,
529,
9507,
29958,
12676,
29918,
29888,
1169,
29889,
2272,
13,
3166,
8717,
14441,
29889,
601,
1053,
23994,
13,
5215,
12655,
408,
7442,
13,
29937,
14350,
596,
2099,
29918,
29888,
1169,
740,
1244,
29901,
13,
1753,
2099,
29918,
29888,
1169,
29898,
5325,
1125,
13,
29871,
599,
29918,
1272,
353,
5159,
13,
29871,
363,
413,
29892,
934,
297,
26985,
29898,
5325,
1125,
13,
1678,
565,
413,
1275,
29871,
29900,
29901,
13,
418,
599,
29918,
1272,
353,
23994,
29889,
657,
1272,
29898,
1445,
29897,
13,
1678,
1683,
29901,
13,
418,
848,
353,
23994,
29889,
657,
1272,
29898,
1445,
29897,
13,
418,
599,
29918,
1272,
353,
599,
29918,
1272,
718,
848,
13,
539,
13,
29871,
599,
29918,
1272,
353,
599,
29918,
1272,
847,
7431,
29898,
5325,
29897,
13,
259,
13,
29871,
736,
599,
29918,
1272,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
259,
13,
29871,
396,
4321,
596,
740,
411,
6455,
515,
278,
1139,
13,
29871,
848,
29871,
353,
2099,
29918,
29888,
1169,
18959,
3027,
29900,
29889,
29888,
1169,
742,
525,
3027,
29896,
29889,
29888,
1169,
742,
525,
3027,
29906,
29889,
29888,
1169,
11287,
13,
29871,
1596,
29898,
1272,
29961,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
2314,
13,
13,
29871,
396,
887,
508,
884,
6492,
278,
1121,
29901,
13,
29871,
1053,
22889,
29889,
2272,
5317,
408,
14770,
13,
29871,
14770,
29889,
326,
4294,
29898,
1272,
29889,
29911,
29892,
274,
1958,
29922,
572,
29873,
29889,
4912,
29889,
2405,
333,
275,
29897,
13,
29871,
14770,
29889,
2780,
1646,
580,
13,
29871,
14770,
29889,
4294,
580,
2
] |
src/models/rankae.py | RowitZou/RankAE | 23 | 117624 | <filename>src/models/rankae.py<gh_stars>10-100
import copy
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.init import xavier_uniform_
from torch.nn.utils.rnn import pad_sequence
from models.decoder import TransformerDecoder
from models.encoder import Bert, TransformerEncoder, PositionalEncoding
from models.generator import Generator
from others.utils import tile
class RankAE(nn.Module):
def __init__(self, args, device, vocab, checkpoint=None):
super(RankAE, self).__init__()
self.args = args
self.device = device
self.vocab = vocab
self.vocab_size = len(vocab)
self.beam_size = args.beam_size
self.max_length = args.max_length
self.min_length = args.min_length
self.start_token = vocab['[unused1]']
self.end_token = vocab['[unused2]']
self.pad_token = vocab['[PAD]']
self.mask_token = vocab['[MASK]']
self.seg_token = vocab['[unused3]']
self.cls_token = vocab['[CLS]']
self.hidden_size = args.enc_hidden_size
self.embeddings = nn.Embedding(self.vocab_size, self.hidden_size, padding_idx=0)
if args.encoder == 'bert':
self.encoder = Bert(args.bert_dir, args.finetune_bert)
if(args.max_pos > 512):
my_pos_embeddings = nn.Embedding(args.max_pos, self.encoder.model.config.hidden_size)
my_pos_embeddings.weight.data[:512] = self.encoder.model.embeddings.position_embeddings.weight.data
my_pos_embeddings.weight.data[512:] = self.encoder.model.embeddings.position_embeddings.weight.data[-1][None, :].repeat(args.max_pos-512, 1)
self.encoder.model.embeddings.position_embeddings = my_pos_embeddings
tgt_embeddings = nn.Embedding(self.vocab_size, self.encoder.model.config.hidden_size, padding_idx=0)
else:
self.encoder = TransformerEncoder(self.hidden_size, args.enc_ff_size, args.enc_heads,
args.enc_dropout, args.enc_layers)
tgt_embeddings = nn.Embedding(self.vocab_size, self.hidden_size, padding_idx=0)
self.hier_encoder = TransformerEncoder(self.hidden_size, args.hier_ff_size, args.hier_heads,
args.hier_dropout, args.hier_layers)
self.cup_bilinear = nn.Bilinear(self.hidden_size, self.hidden_size, 1)
self.pos_emb = PositionalEncoding(0., self.hidden_size)
self.decoder = TransformerDecoder(
self.args.dec_layers,
self.args.dec_hidden_size, heads=self.args.dec_heads,
d_ff=self.args.dec_ff_size, dropout=self.args.dec_dropout,
embeddings=tgt_embeddings)
self.generator = Generator(self.vocab_size, self.args.dec_hidden_size, self.pad_token)
self.generator.linear.weight = self.decoder.embeddings.weight
if checkpoint is not None:
self.load_state_dict(checkpoint['model'], strict=True)
else:
if args.encoder == "transformer":
for module in self.encoder.modules():
self._set_parameter_tf(module)
xavier_uniform_(self.embeddings.weight)
for module in self.decoder.modules():
self._set_parameter_tf(module)
for module in self.hier_encoder.modules():
self._set_parameter_tf(module)
for p in self.generator.parameters():
self._set_parameter_linear(p)
for p in self.cup_bilinear.parameters():
self._set_parameter_linear(p)
if args.share_emb:
if args.encoder == 'bert':
self.embeddings = self.encoder.model.embeddings.word_embeddings
tgt_embeddings = nn.Embedding(self.vocab_size, self.encoder.model.config.hidden_size, padding_idx=0)
tgt_embeddings.weight = copy.deepcopy(self.encoder.model.embeddings.word_embeddings.weight)
else:
tgt_embeddings = self.embeddings
self.decoder.embeddings = tgt_embeddings
self.generator.linear.weight = self.decoder.embeddings.weight
self.to(device)
def _set_parameter_tf(self, module):
if isinstance(module, (nn.Linear, nn.Embedding)):
module.weight.data.normal_(mean=0.0, std=0.02)
elif isinstance(module, nn.LayerNorm):
module.bias.data.zero_()
module.weight.data.fill_(1.0)
if isinstance(module, nn.Linear) and module.bias is not None:
module.bias.data.zero_()
def _set_parameter_linear(self, p):
if p.dim() > 1:
xavier_uniform_(p)
else:
p.data.zero_()
def _rebuild_tgt(self, origin, index, sep_token=None):
tgt_list = [torch.tensor([self.start_token], device=self.device)]
selected = origin.index_select(0, index)
for sent in selected:
filted_sent = sent[sent != self.pad_token][1:]
if sep_token is not None:
filted_sent[-1] = sep_token
else:
filted_sent = filted_sent[:-1]
tgt_list.append(filted_sent)
new_tgt = torch.cat(tgt_list, 0)
if sep_token is not None:
new_tgt[-1] = self.end_token
else:
new_tgt = torch.cat([new_tgt, torch.tensor([self.end_token], device=self.device)], 0)
return new_tgt
def _build_memory_window(self, ex_segs, keep_clss, replace_clss=None, mask=None, samples=None):
keep_cls_list = torch.split(keep_clss, ex_segs)
window_list = []
for ex in keep_cls_list:
ex_pad = F.pad(ex, (0, 0, self.args.win_size, self.args.win_size)).unsqueeze(1)
ex_context = torch.cat([ex_pad[:ex.size(0)], ex.unsqueeze(1),
ex_pad[self.args.win_size*2:]], 1)
window_list.append(ex_context)
memory = torch.cat(window_list, 0)
if replace_clss is not None:
replace_cls_list = torch.split(replace_clss, ex_segs)
window_list = []
for ex in replace_cls_list:
ex_pad = F.pad(ex, (0, 0, self.args.win_size, self.args.win_size)).unsqueeze(1)
ex_context = torch.cat([ex_pad[:ex.size(0)], ex.unsqueeze(1),
ex_pad[self.args.win_size*2:]], 1)
window_list.append(ex_context)
origin_memory = torch.cat(window_list, 0)
sample_list = torch.split(samples, ex_segs)
sample_tensor_list = []
for i in range(len(ex_segs)):
sample_index_ = torch.randint(0, samples.size(-1), [mask.size(-1)], device=self.device)
sample_index = torch.index_select(sample_list[i], 1, sample_index_)
sample_tensor = replace_cls_list[i][sample_index]
sample_tensor_list.append(sample_tensor)
sample_memory = torch.cat(sample_tensor_list, 0)
memory = memory * (mask == 2).unsqueeze(-1).float() + \
sample_memory * (mask == 0).unsqueeze(-1).float() + \
origin_memory * (mask == 1).unsqueeze(-1).float()
return memory
def _src_add_noise(self, sent, sampled_sent, expand_ratio=0.):
role_emb = sent[1:2]
filted_sent = sent[sent != self.pad_token][2:]
# filted_sent = sent[sent != self.pad_token][1:]
rand_size = sampled_sent.size(0)
length = max(int(filted_sent.size(0)*(1+expand_ratio)), filted_sent.size(0)+1)
while filted_sent.size(0) < length:
target_length = length - filted_sent.size(0)
rand_sent = sampled_sent[random.randint(0, rand_size-1)]
rand_sent = rand_sent[rand_sent != self.pad_token][2:] # remove cls and role embedding
# rand_sent = rand_sent[rand_sent != self.pad_token][1:] # no role embedding
start_point = random.randint(0, rand_sent.size(0)-1)
end_point = random.randint(start_point, rand_sent.size(0))
rand_segment = rand_sent[start_point:min(end_point, start_point+10, start_point+target_length)]
insert_point = random.randint(0, filted_sent.size(0)-1)
filted_sent = torch.cat([filted_sent[:insert_point],
rand_segment,
filted_sent[insert_point:]], 0)
# return filted_sent
return torch.cat([role_emb, filted_sent], 0)
def _build_noised_src(self, src, ex_segs, samples, expand_ratio=0.):
src_list = torch.split(src, ex_segs)
new_src_list = []
sample_list = torch.split(samples, ex_segs)
for i, ex in enumerate(src_list):
for j, sent in enumerate(ex):
sampled_sent = ex.index_select(0, sample_list[i][j])
expanded_sent = self._src_add_noise(sent, sampled_sent, expand_ratio)
new_src = torch.cat([torch.tensor([self.cls_token], device=self.device), expanded_sent], 0)
new_src_list.append(new_src)
new_src = pad_sequence(new_src_list, batch_first=True, padding_value=self.pad_token)
new_mask = new_src.data.ne(self.pad_token)
new_segs = torch.zeros_like(new_src)
return new_src, new_mask, new_segs
def _build_context_tgt(self, tgt, ex_segs, win_size=1, modify=False, mask=None):
tgt_list = torch.split(tgt, ex_segs)
new_tgt_list = []
if modify and mask is not None:
# 1 means keeping the sentence
mask_list = torch.split(mask, ex_segs)
for i in range(len(tgt_list)):
sent_num = tgt_list[i].size(0)
for j in range(sent_num):
if modify:
low = j-win_size
up = j+win_size+1
index = torch.arange(low, up, device=self.device)
index = index[mask_list[i][j] > 0]
else:
low = max(0, j-win_size)
up = min(sent_num, j+win_size+1)
index = torch.arange(low, up, device=self.device)
new_tgt_list.append(self._rebuild_tgt(tgt_list[i], index, self.seg_token))
new_tgt = pad_sequence(new_tgt_list, batch_first=True, padding_value=self.pad_token)
return new_tgt
def _build_doc_tgt(self, tgt, vec, ex_segs, win_size=1, max_k=6, sigma=1.0):
vec_list = torch.split(vec, ex_segs)
tgt_list = torch.split(tgt, ex_segs)
new_tgt_list = []
index_list = []
shift_list = []
accum_index = 0
for idx in range(len(ex_segs)):
ex_vec = vec_list[idx]
sent_num = ex_segs[idx]
ex_tgt = tgt_list[idx]
tgt_length = ex_tgt[:, 1:].ne(self.pad_token).sum(dim=1).float()
topk_ids = self._centrality_rank(ex_vec, sent_num, tgt_length, win_size, max_k, sigma)
new_tgt_list.append(self._rebuild_tgt(ex_tgt, topk_ids, self.seg_token))
shift_list.append(topk_ids)
index_list.append(topk_ids + accum_index)
accum_index += sent_num
new_tgt = pad_sequence(new_tgt_list, batch_first=True, padding_value=self.pad_token)
return new_tgt, index_list, shift_list
def _centrality_rank(self, vec, sent_num, tgt_length, win_size, max_k, sigma, eta=0.5, min_length=5):
assert vec.size(0) == sent_num
sim = torch.sigmoid(self.cup_bilinear(vec.unsqueeze(1).expand(sent_num, sent_num, -1).contiguous(),
vec.unsqueeze(0).expand(sent_num, sent_num, -1).contiguous())
).squeeze().detach()
# sim = torch.sigmoid(torch.mm(vec, vec.transpose(0, 1)))
# sim = torch.cosine_similarity(
# vec.unsqueeze(1).expand(sent_num, sent_num, -1).contiguous().view(sent_num * sent_num, -1),
# vec.unsqueeze(0).expand(sent_num, sent_num, -1).contiguous().view(sent_num * sent_num, -1)
# ).view(sent_num, sent_num).detach()
# calculate sim weight
k = min(max(sent_num // (win_size*2+1), 1), max_k)
var = sent_num / k * 1.
x = torch.arange(sent_num, device=self.device, dtype=torch.float).unsqueeze(0).expand_as(sim)
u = torch.arange(sent_num, device=self.device, dtype=torch.float).unsqueeze(1)
weight = torch.exp(-(x-u)**2 / (2. * var**2)) * (1. - torch.eye(sent_num, device=self.device))
# weight = 1. - torch.eye(sent_num, device=self.device)
sim[tgt_length < min_length, :] = -1e20
# Calculate centrality and select top k sentence.
topk_ids = torch.empty(0, dtype=torch.long, device=self.device)
mask = torch.zeros([sent_num, sent_num], dtype=torch.float, device=self.device)
for _ in range(k):
mean_score = torch.sum(sim * weight, dim=1) / max(sent_num-1, 1)
max_v, _ = torch.max(sim * weight * mask, dim=1)
centrality = eta*mean_score - (1-eta)*max_v
_, top_id = torch.topk(centrality, 1, dim=0, sorted=False)
topk_ids = torch.cat([topk_ids, top_id], 0)
sim[topk_ids, :] = -1e20
mask[:, topk_ids] = 1.
topk_ids, _ = torch.sort(topk_ids)
"""
centrality = torch.sum(sim * weight, dim=1)
_, topk_ids = torch.topk(centrality, k, dim=0, sorted=False)
topk_ids, _ = torch.sort(topk_ids)
"""
return topk_ids
def _add_mask(self, src, mask_src):
pm_index = torch.empty_like(mask_src).float().uniform_().le(self.args.mask_token_prob)
ps_index = torch.empty_like(mask_src[:, 0]).float().uniform_().gt(self.args.select_sent_prob)
pm_index[ps_index] = 0
# Avoid mask [PAD]
pm_index[(1-mask_src).byte()] = 0
# Avoid mask [CLS]
pm_index[:, 0] = 0
# Avoid mask [SEG]
pm_index[src == self.seg_token] = 0
src[pm_index] = self.mask_token
return src
def _build_cup(self, bsz, ex_segs, win_size=1, negative_num=2):
cup = torch.split(torch.arange(0, bsz, dtype=torch.long, device=self.device), ex_segs)
tgt = torch.split(torch.ones(bsz), ex_segs)
cup_list = []
cup_origin_list = []
tgt_list = []
negative_list = []
for i in range(len(ex_segs)):
sent_num = ex_segs[i]
cup_low = cup[i][0].item()
cup_up = cup[i][sent_num-1].item()
cup_index = cup[i].repeat(win_size*2*(negative_num+1))
tgt_index = tgt[i].repeat(win_size*2*(negative_num+1))
cup_origin_list.append(cup[i].repeat(win_size*2*(negative_num+1)))
tgt_index[sent_num*win_size*2:] = 0
for j in range(cup_index.size(0)):
if tgt_index[j] == 1:
cup_temp = cup_index[j]
window_list = [t for t in range(max(cup_index[j]-win_size, cup_low),
min(cup_index[j]+win_size, cup_up)+1)
if t != cup_index[j]]
cup_temp = window_list[(j // sent_num) % len(window_list)]
else:
cand_list = [t for t in range(cup_low, max(cup_index[j]-win_size, cup_low))] + \
[t for t in range(min(cup_index[j]+win_size, cup_up), cup_up)]
cup_temp = cand_list[random.randint(0, len(cand_list)-1)]
cup_index[j] = cup_temp
negative_list.append((cup_index[sent_num*win_size*2:]-cup_low).
view(negative_num*win_size*2, -1).transpose(0, 1))
cup_list.append(cup_index)
tgt_list.append(tgt_index)
tgt = torch.cat(tgt_list, dim=0).float().to(self.device)
cup_origin = torch.cat(cup_origin_list, dim=0)
cup = torch.cat(cup_list, dim=0)
negative_sample = torch.cat(negative_list, dim=0)
return cup, cup_origin, tgt[cup != -1], negative_sample
def _build_option_window(self, bsz, ex_segs, win_size=1, keep_ratio=0.1, replace_ratio=0.2):
assert keep_ratio + replace_ratio <= 1.
noise_ratio = 1 - keep_ratio - replace_ratio
window_size = 2*win_size+1
index = torch.split(torch.arange(1, bsz+1, dtype=torch.long, device=self.device), ex_segs)
# 2 means noise addition, 1 means keep the memory, 0 means replacement
tgt = torch.zeros([bsz, window_size], device=self.device, dtype=torch.int)
prob = torch.empty([bsz, window_size], device=self.device).uniform_()
tgt.masked_fill_(prob.lt(noise_ratio), 2)
tgt.masked_fill_(prob.ge(1-keep_ratio), 1)
tgt = torch.split(tgt, ex_segs)
for i in range(len(ex_segs)):
sent_num = ex_segs[i]
index_pad = F.pad(index[i], (self.args.win_size, self.args.win_size))
for j in range(sent_num):
window = index_pad[j:j+window_size]
# Avoiding that all elements are 0
if torch.sum(tgt[i][j].byte()*(window > 0)) == 0:
tgt[i][j][win_size] = 2
tgt[i][j][window == 0] = -1
tgt = torch.cat(tgt, 0)
return tgt
def _fast_translate_batch(self, batch, memory_bank, max_length, init_tokens=None, memory_mask=None,
min_length=2, beam_size=3, ignore_mem_attn=False):
batch_size = memory_bank.size(0)
dec_states = self.decoder.init_decoder_state(batch.src, memory_bank, with_cache=True)
# Tile states and memory beam_size times.
dec_states.map_batch_fn(
lambda state, dim: tile(state, beam_size, dim=dim))
memory_bank = tile(memory_bank, beam_size, dim=0)
init_tokens = tile(init_tokens, beam_size, dim=0)
memory_mask = tile(memory_mask, beam_size, dim=0)
batch_offset = torch.arange(
batch_size, dtype=torch.long, device=self.device)
beam_offset = torch.arange(
0,
batch_size * beam_size,
step=beam_size,
dtype=torch.long,
device=self.device)
alive_seq = torch.full(
[batch_size * beam_size, 1],
self.start_token,
dtype=torch.long,
device=self.device)
# Give full probability to the first beam on the first step.
topk_log_probs = (
torch.tensor([0.0] + [float("-inf")] * (beam_size - 1),
device=self.device).repeat(batch_size))
# Structure that holds finished hypotheses.
hypotheses = [[] for _ in range(batch_size)] # noqa: F812
results = [[] for _ in range(batch_size)] # noqa: F812
for step in range(max_length):
if step > 0:
init_tokens = None
# Decoder forward.
decoder_input = alive_seq[:, -1].view(1, -1)
decoder_input = decoder_input.transpose(0, 1)
dec_out, dec_states, _ = self.decoder(decoder_input, memory_bank, dec_states, init_tokens, step=step,
memory_masks=memory_mask, ignore_memory_attn=ignore_mem_attn)
# Generator forward.
log_probs = self.generator(dec_out.transpose(0, 1).squeeze(0))
vocab_size = log_probs.size(-1)
if step < min_length:
log_probs[:, self.end_token] = -1e20
if self.args.block_trigram:
cur_len = alive_seq.size(1)
if(cur_len > 3):
for i in range(alive_seq.size(0)):
fail = False
words = [int(w) for w in alive_seq[i]]
if(len(words) <= 3):
continue
trigrams = [(words[i-1], words[i], words[i+1]) for i in range(1, len(words)-1)]
trigram = tuple(trigrams[-1])
if trigram in trigrams[:-1]:
fail = True
if fail:
log_probs[i] = -1e20
# Multiply probs by the beam probability.
log_probs += topk_log_probs.view(-1).unsqueeze(1)
alpha = self.args.alpha
length_penalty = ((5.0 + (step + 1)) / 6.0) ** alpha
# Flatten probs into a list of possibilities.
curr_scores = log_probs / length_penalty
curr_scores = curr_scores.reshape(-1, beam_size * vocab_size)
topk_scores, topk_ids = curr_scores.topk(beam_size, dim=-1)
# Recover log probs.
topk_log_probs = topk_scores * length_penalty
# Resolve beam origin and true word ids.
topk_beam_index = topk_ids.div(vocab_size)
topk_ids = topk_ids.fmod(vocab_size)
# Map beam_index to batch_index in the flat representation.
batch_index = (
topk_beam_index
+ beam_offset[:topk_beam_index.size(0)].unsqueeze(1))
select_indices = batch_index.view(-1)
# Append last prediction.
alive_seq = torch.cat(
[alive_seq.index_select(0, select_indices),
topk_ids.view(-1, 1)], -1)
is_finished = topk_ids.eq(self.end_token)
if step + 1 == max_length:
is_finished.fill_(1)
# End condition is top beam is finished.
end_condition = is_finished[:, 0].eq(1)
# Save finished hypotheses.
if is_finished.any():
predictions = alive_seq.view(-1, beam_size, alive_seq.size(-1))
for i in range(is_finished.size(0)):
b = batch_offset[i]
if end_condition[i]:
is_finished[i].fill_(1)
finished_hyp = is_finished[i].nonzero().view(-1)
# Store finished hypotheses for this batch.
for j in finished_hyp:
hypotheses[b].append((
topk_scores[i, j],
predictions[i, j, 1:]))
# If the batch reached the end, save the n_best hypotheses.
if end_condition[i]:
best_hyp = sorted(
hypotheses[b], key=lambda x: x[0], reverse=True)
_, pred = best_hyp[0]
results[b].append(pred)
non_finished = end_condition.eq(0).nonzero().view(-1)
# If all sentences are translated, no need to go further.
if len(non_finished) == 0:
break
# Remove finished batches for the next step.
topk_log_probs = topk_log_probs.index_select(0, non_finished)
batch_index = batch_index.index_select(0, non_finished)
batch_offset = batch_offset.index_select(0, non_finished)
alive_seq = predictions.index_select(0, non_finished) \
.view(-1, alive_seq.size(-1))
# Reorder states.
select_indices = batch_index.view(-1)
if memory_bank is not None:
memory_bank = memory_bank.index_select(0, select_indices)
if memory_mask is not None:
memory_mask = memory_mask.index_select(0, select_indices)
if init_tokens is not None:
init_tokens = init_tokens.index_select(0, select_indices)
dec_states.map_batch_fn(
lambda state, dim: state.index_select(dim, select_indices))
results = [t[0] for t in results]
return results
def forward(self, batch):
src = batch.src
tgt = batch.tgt
segs = batch.segs
mask_src = batch.mask_src
ex_segs = batch.ex_segs
if self.training:
# Sample some dialogue utterances to do auto-encoder
ex_size = batch.src.size(0)
ex_index = [i for i in range(ex_size)]
random.shuffle(ex_index)
ex_indexs = torch.tensor(ex_index, dtype=torch.long, device=self.device)
ex_sample_indexs = ex_indexs[:max(int(ex_size * self.args.sample_ratio), 1)]
# Get Context utterance training samples and targets
cup_index, cup_original_index, cup_tgt, negative_samples = \
self._build_cup(src.size(0), ex_segs, self.args.win_size, self.args.negative_sample_num)
setattr(batch, 'cup_tgt', cup_tgt)
option_mask = self._build_option_window(src.size(0), ex_segs, win_size=self.args.win_size,
keep_ratio=self.args.ps if self.training else 1.,
replace_ratio=self.args.pr if self.training else 0.)
if self.training:
# Build noised src
noised_src, noised_src_mask, noised_src_segs = \
self._build_noised_src(src, ex_segs, samples=negative_samples,
expand_ratio=self.args.expand_ratio)
# build context tgt
context_tgt = self._build_context_tgt(tgt, ex_segs, self.args.win_size,
modify=self.training, mask=option_mask)
setattr(batch, 'context_tgt', context_tgt)
# DAE: Randomly mask tokens
if self.training:
src = self._add_mask(src.clone(), mask_src)
noised_src = self._add_mask(noised_src, noised_src_mask)
if self.args.encoder == "bert":
top_vec = self.encoder(src, segs, mask_src)
else:
src_emb = self.embeddings(src)
top_vec = self.encoder(src_emb, 1-mask_src)
clss = top_vec[:, 0, :]
# Hierarchical encoder
cls_list = torch.split(clss, ex_segs)
cls_input = nn.utils.rnn.pad_sequence(cls_list, batch_first=True, padding_value=0.)
cls_mask_list = [mask_src.new_zeros([length]) for length in ex_segs]
cls_mask = nn.utils.rnn.pad_sequence(cls_mask_list, batch_first=True, padding_value=1)
hier = self.hier_encoder(cls_input, cls_mask)
hier = hier.view(-1, hier.size(-1))[(1-cls_mask.view(-1)).byte()]
if self.training:
# calculate cup score
cup_tensor = torch.index_select(clss, 0, cup_index)
origin_tensor = torch.index_select(clss, 0, cup_original_index)
cup_score = torch.sigmoid(self.cup_bilinear(origin_tensor, cup_tensor)).squeeze()
# cup_score = torch.sigmoid(origin_tensor.unsqueeze(1).bmm(cup_tensor.unsqueeze(-1)).squeeze())
# noised src encode
if self.args.encoder == "bert":
noised_top_vec = self.encoder(noised_src, noised_src_segs, noised_src_mask)
else:
noised_src_emb = self.embeddings(noised_src)
noised_top_vec = self.encoder(noised_src_emb, 1-noised_src_mask)
noised_clss = noised_top_vec[:, 0, :]
noised_cls_mem = self._build_memory_window(ex_segs, noised_clss, clss, option_mask, negative_samples)
noised_cls_mem = self.pos_emb(noised_cls_mem)
# sample training examples
context_tgt_sample = torch.index_select(context_tgt, 0, ex_sample_indexs)
noised_cls_mem_sample = torch.index_select(noised_cls_mem, 0, ex_sample_indexs)
hier_sample = torch.index_select(hier, 0, ex_sample_indexs)
else:
cup_score = None
if self.training:
dec_state = self.decoder.init_decoder_state(noised_src, noised_cls_mem_sample)
decode_context, _, _ = self.decoder(context_tgt_sample[:, :-1], noised_cls_mem_sample, dec_state,
init_tokens=hier_sample)
doc_data = None
# For loss computation.
if ex_sample_indexs is not None:
batch.context_tgt = context_tgt_sample
else:
decode_context = None
# Build paragraph tgt based on centrality rank.
doc_tgt, doc_index, _ = self._build_doc_tgt(tgt, clss, ex_segs, self.args.win_size, self.args.ranking_max_k)
centrality_segs = [len(iex) for iex in doc_index]
centrality_index = [sum(centrality_segs[:i]) for i in range(len(centrality_segs)+1)]
doc_index = torch.cat(doc_index, 0)
setattr(batch, 'doc_tgt', doc_tgt)
doc_hier_sample = torch.index_select(hier, 0, doc_index)
# original cls mem
cls_mem = self._build_memory_window(ex_segs, clss)
cls_mem = self.pos_emb(cls_mem)
doc_cls_mem = torch.index_select(cls_mem, 0, doc_index)
# Context aware doc target
context_doc_tgt = torch.index_select(context_tgt, 0, doc_index)
setattr(batch, 'context_doc_tgt', context_doc_tgt)
setattr(batch, 'doc_segs', centrality_index)
doc_context_long = self._fast_translate_batch(batch, doc_cls_mem, self.max_length, init_tokens=doc_hier_sample,
min_length=2, beam_size=self.beam_size)
doc_context_long = [torch.cat(doc_context_long[centrality_index[i]:centrality_index[i+1]], 0) for i in range(len(centrality_segs))]
doc_data = doc_context_long
return cup_score, decode_context, doc_data
| [
1,
529,
9507,
29958,
4351,
29914,
9794,
29914,
661,
1335,
29872,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
3509,
13,
5215,
4036,
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,
13,
3166,
4842,
305,
29889,
15755,
29889,
2344,
1053,
921,
18852,
29918,
29590,
29918,
13,
3166,
4842,
305,
29889,
15755,
29889,
13239,
29889,
29878,
15755,
1053,
17132,
29918,
16506,
13,
13,
3166,
4733,
29889,
7099,
6119,
1053,
4103,
24784,
6185,
6119,
13,
3166,
4733,
29889,
3977,
6119,
1053,
16662,
29892,
4103,
24784,
8566,
6119,
29892,
10321,
3245,
14934,
13,
3166,
4733,
29889,
27959,
1053,
3251,
1061,
13,
3166,
4045,
29889,
13239,
1053,
25900,
13,
13,
13,
1990,
22125,
16036,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6389,
29892,
4742,
29892,
7931,
370,
29892,
1423,
3149,
29922,
8516,
1125,
13,
4706,
2428,
29898,
29934,
804,
16036,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
5085,
353,
6389,
13,
4706,
1583,
29889,
10141,
353,
4742,
13,
4706,
1583,
29889,
29894,
542,
370,
353,
7931,
370,
13,
4706,
1583,
29889,
29894,
542,
370,
29918,
2311,
353,
7431,
29898,
29894,
542,
370,
29897,
13,
4706,
1583,
29889,
915,
314,
29918,
2311,
353,
6389,
29889,
915,
314,
29918,
2311,
13,
4706,
1583,
29889,
3317,
29918,
2848,
353,
6389,
29889,
3317,
29918,
2848,
13,
4706,
1583,
29889,
1195,
29918,
2848,
353,
6389,
29889,
1195,
29918,
2848,
13,
13,
4706,
1583,
29889,
2962,
29918,
6979,
353,
7931,
370,
1839,
29961,
348,
3880,
29896,
29962,
2033,
13,
4706,
1583,
29889,
355,
29918,
6979,
353,
7931,
370,
1839,
29961,
348,
3880,
29906,
29962,
2033,
13,
4706,
1583,
29889,
8305,
29918,
6979,
353,
7931,
370,
1839,
29961,
29925,
3035,
29962,
2033,
13,
4706,
1583,
29889,
13168,
29918,
6979,
353,
7931,
370,
1839,
29961,
1529,
16033,
29962,
2033,
13,
4706,
1583,
29889,
10199,
29918,
6979,
353,
7931,
370,
1839,
29961,
348,
3880,
29941,
29962,
2033,
13,
4706,
1583,
29889,
25932,
29918,
6979,
353,
7931,
370,
1839,
29961,
6154,
29903,
29962,
2033,
13,
13,
4706,
1583,
29889,
10892,
29918,
2311,
353,
6389,
29889,
3977,
29918,
10892,
29918,
2311,
13,
4706,
1583,
29889,
17987,
29881,
886,
353,
302,
29876,
29889,
6026,
2580,
8497,
29898,
1311,
29889,
29894,
542,
370,
29918,
2311,
29892,
1583,
29889,
10892,
29918,
2311,
29892,
7164,
29918,
13140,
29922,
29900,
29897,
13,
13,
4706,
565,
6389,
29889,
3977,
6119,
1275,
525,
2151,
2396,
13,
9651,
1583,
29889,
3977,
6119,
353,
16662,
29898,
5085,
29889,
2151,
29918,
3972,
29892,
6389,
29889,
4951,
300,
1540,
29918,
2151,
29897,
13,
9651,
565,
29898,
5085,
29889,
3317,
29918,
1066,
1405,
29871,
29945,
29896,
29906,
1125,
13,
18884,
590,
29918,
1066,
29918,
17987,
29881,
886,
353,
302,
29876,
29889,
6026,
2580,
8497,
29898,
5085,
29889,
3317,
29918,
1066,
29892,
1583,
29889,
3977,
6119,
29889,
4299,
29889,
2917,
29889,
10892,
29918,
2311,
29897,
13,
18884,
590,
29918,
1066,
29918,
17987,
29881,
886,
29889,
7915,
29889,
1272,
7503,
29945,
29896,
29906,
29962,
353,
1583,
29889,
3977,
6119,
29889,
4299,
29889,
17987,
29881,
886,
29889,
3283,
29918,
17987,
29881,
886,
29889,
7915,
29889,
1272,
13,
18884,
590,
29918,
1066,
29918,
17987,
29881,
886,
29889,
7915,
29889,
1272,
29961,
29945,
29896,
29906,
17531,
353,
1583,
29889,
3977,
6119,
29889,
4299,
29889,
17987,
29881,
886,
29889,
3283,
29918,
17987,
29881,
886,
29889,
7915,
29889,
1272,
14352,
29896,
3816,
8516,
29892,
584,
1822,
14358,
29898,
5085,
29889,
3317,
29918,
1066,
29899,
29945,
29896,
29906,
29892,
29871,
29896,
29897,
13,
18884,
1583,
29889,
3977,
6119,
29889,
4299,
29889,
17987,
29881,
886,
29889,
3283,
29918,
17987,
29881,
886,
353,
590,
29918,
1066,
29918,
17987,
29881,
886,
13,
9651,
260,
4141,
29918,
17987,
29881,
886,
353,
302,
29876,
29889,
6026,
2580,
8497,
29898,
1311,
29889,
29894,
542,
370,
29918,
2311,
29892,
1583,
29889,
3977,
6119,
29889,
4299,
29889,
2917,
29889,
10892,
29918,
2311,
29892,
7164,
29918,
13140,
29922,
29900,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
3977,
6119,
353,
4103,
24784,
8566,
6119,
29898,
1311,
29889,
10892,
29918,
2311,
29892,
6389,
29889,
3977,
29918,
600,
29918,
2311,
29892,
6389,
29889,
3977,
29918,
2813,
29879,
29892,
13,
462,
462,
795,
6389,
29889,
3977,
29918,
8865,
449,
29892,
6389,
29889,
3977,
29918,
29277,
29897,
13,
9651,
260,
4141,
29918,
17987,
29881,
886,
353,
302,
29876,
29889,
6026,
2580,
8497,
29898,
1311,
29889,
29894,
542,
370,
29918,
2311,
29892,
1583,
29889,
10892,
29918,
2311,
29892,
7164,
29918,
13140,
29922,
29900,
29897,
13,
13,
4706,
1583,
29889,
29882,
631,
29918,
3977,
6119,
353,
4103,
24784,
8566,
6119,
29898,
1311,
29889,
10892,
29918,
2311,
29892,
6389,
29889,
29882,
631,
29918,
600,
29918,
2311,
29892,
6389,
29889,
29882,
631,
29918,
2813,
29879,
29892,
13,
462,
462,
1669,
6389,
29889,
29882,
631,
29918,
8865,
449,
29892,
6389,
29889,
29882,
631,
29918,
29277,
29897,
13,
4706,
1583,
29889,
5231,
29918,
18152,
457,
279,
353,
302,
29876,
29889,
29933,
309,
457,
279,
29898,
1311,
29889,
10892,
29918,
2311,
29892,
1583,
29889,
10892,
29918,
2311,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
1066,
29918,
1590,
353,
10321,
3245,
14934,
29898,
29900,
1696,
1583,
29889,
10892,
29918,
2311,
29897,
13,
13,
4706,
1583,
29889,
7099,
6119,
353,
4103,
24784,
6185,
6119,
29898,
13,
9651,
1583,
29889,
5085,
29889,
7099,
29918,
29277,
29892,
13,
9651,
1583,
29889,
5085,
29889,
7099,
29918,
10892,
29918,
2311,
29892,
15883,
29922,
1311,
29889,
5085,
29889,
7099,
29918,
2813,
29879,
29892,
13,
9651,
270,
29918,
600,
29922,
1311,
29889,
5085,
29889,
7099,
29918,
600,
29918,
2311,
29892,
5768,
449,
29922,
1311,
29889,
5085,
29889,
7099,
29918,
8865,
449,
29892,
13,
9651,
8297,
29881,
886,
29922,
29873,
4141,
29918,
17987,
29881,
886,
29897,
13,
13,
4706,
1583,
29889,
27959,
353,
3251,
1061,
29898,
1311,
29889,
29894,
542,
370,
29918,
2311,
29892,
1583,
29889,
5085,
29889,
7099,
29918,
10892,
29918,
2311,
29892,
1583,
29889,
8305,
29918,
6979,
29897,
13,
13,
4706,
1583,
29889,
27959,
29889,
10660,
29889,
7915,
353,
1583,
29889,
7099,
6119,
29889,
17987,
29881,
886,
29889,
7915,
13,
13,
4706,
565,
1423,
3149,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
1359,
29918,
3859,
29918,
8977,
29898,
3198,
3149,
1839,
4299,
7464,
9406,
29922,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
565,
6389,
29889,
3977,
6119,
1275,
376,
9067,
261,
1115,
13,
18884,
363,
3883,
297,
1583,
29889,
3977,
6119,
29889,
7576,
7295,
13,
462,
1678,
1583,
3032,
842,
29918,
15501,
29918,
13264,
29898,
5453,
29897,
13,
18884,
921,
18852,
29918,
29590,
23538,
1311,
29889,
17987,
29881,
886,
29889,
7915,
29897,
13,
9651,
363,
3883,
297,
1583,
29889,
7099,
6119,
29889,
7576,
7295,
13,
18884,
1583,
3032,
842,
29918,
15501,
29918,
13264,
29898,
5453,
29897,
13,
9651,
363,
3883,
297,
1583,
29889,
29882,
631,
29918,
3977,
6119,
29889,
7576,
7295,
13,
18884,
1583,
3032,
842,
29918,
15501,
29918,
13264,
29898,
5453,
29897,
13,
9651,
363,
282,
297,
1583,
29889,
27959,
29889,
16744,
7295,
13,
18884,
1583,
3032,
842,
29918,
15501,
29918,
10660,
29898,
29886,
29897,
13,
9651,
363,
282,
297,
1583,
29889,
5231,
29918,
18152,
457,
279,
29889,
16744,
7295,
13,
18884,
1583,
3032,
842,
29918,
15501,
29918,
10660,
29898,
29886,
29897,
13,
9651,
565,
6389,
29889,
13653,
29918,
1590,
29901,
13,
18884,
565,
6389,
29889,
3977,
6119,
1275,
525,
2151,
2396,
13,
462,
1678,
1583,
29889,
17987,
29881,
886,
353,
1583,
29889,
3977,
6119,
29889,
4299,
29889,
17987,
29881,
886,
29889,
1742,
29918,
17987,
29881,
886,
13,
462,
1678,
260,
4141,
29918,
17987,
29881,
886,
353,
302,
29876,
29889,
6026,
2580,
8497,
29898,
1311,
29889,
29894,
542,
370,
29918,
2311,
29892,
1583,
29889,
3977,
6119,
29889,
4299,
29889,
2917,
29889,
10892,
29918,
2311,
29892,
7164,
29918,
13140,
29922,
29900,
29897,
13,
462,
1678,
260,
4141,
29918,
17987,
29881,
886,
29889,
7915,
353,
3509,
29889,
24535,
8552,
29898,
1311,
29889,
3977,
6119,
29889,
4299,
29889,
17987,
29881,
886,
29889,
1742,
29918,
17987,
29881,
886,
29889,
7915,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
260,
4141,
29918,
17987,
29881,
886,
353,
1583,
29889,
17987,
29881,
886,
13,
18884,
1583,
29889,
7099,
6119,
29889,
17987,
29881,
886,
353,
260,
4141,
29918,
17987,
29881,
886,
13,
18884,
1583,
29889,
27959,
29889,
10660,
29889,
7915,
353,
1583,
29889,
7099,
6119,
29889,
17987,
29881,
886,
29889,
7915,
13,
13,
4706,
1583,
29889,
517,
29898,
10141,
29897,
13,
13,
1678,
822,
903,
842,
29918,
15501,
29918,
13264,
29898,
1311,
29892,
3883,
1125,
13,
4706,
565,
338,
8758,
29898,
5453,
29892,
313,
15755,
29889,
12697,
29892,
302,
29876,
29889,
6026,
2580,
8497,
22164,
13,
9651,
3883,
29889,
7915,
29889,
1272,
29889,
8945,
23538,
12676,
29922,
29900,
29889,
29900,
29892,
3659,
29922,
29900,
29889,
29900,
29906,
29897,
13,
4706,
25342,
338,
8758,
29898,
5453,
29892,
302,
29876,
29889,
14420,
29940,
555,
1125,
13,
9651,
3883,
29889,
29890,
3173,
29889,
1272,
29889,
9171,
29918,
580,
13,
9651,
3883,
29889,
7915,
29889,
1272,
29889,
5589,
23538,
29896,
29889,
29900,
29897,
13,
4706,
565,
338,
8758,
29898,
5453,
29892,
302,
29876,
29889,
12697,
29897,
322,
3883,
29889,
29890,
3173,
338,
451,
6213,
29901,
13,
9651,
3883,
29889,
29890,
3173,
29889,
1272,
29889,
9171,
29918,
580,
13,
13,
1678,
822,
903,
842,
29918,
15501,
29918,
10660,
29898,
1311,
29892,
282,
1125,
13,
4706,
565,
282,
29889,
6229,
580,
1405,
29871,
29896,
29901,
13,
9651,
921,
18852,
29918,
29590,
23538,
29886,
29897,
13,
4706,
1683,
29901,
13,
9651,
282,
29889,
1272,
29889,
9171,
29918,
580,
13,
13,
1678,
822,
903,
276,
4282,
29918,
29873,
4141,
29898,
1311,
29892,
3978,
29892,
2380,
29892,
16345,
29918,
6979,
29922,
8516,
1125,
13,
13,
4706,
260,
4141,
29918,
1761,
353,
518,
7345,
305,
29889,
20158,
4197,
1311,
29889,
2962,
29918,
6979,
1402,
4742,
29922,
1311,
29889,
10141,
4638,
13,
4706,
4629,
353,
3978,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
2380,
29897,
13,
4706,
363,
2665,
297,
4629,
29901,
13,
9651,
977,
9446,
29918,
18616,
353,
2665,
29961,
18616,
2804,
1583,
29889,
8305,
29918,
6979,
3816,
29896,
17531,
13,
9651,
565,
16345,
29918,
6979,
338,
451,
6213,
29901,
13,
18884,
977,
9446,
29918,
18616,
14352,
29896,
29962,
353,
16345,
29918,
6979,
13,
9651,
1683,
29901,
13,
18884,
977,
9446,
29918,
18616,
353,
977,
9446,
29918,
18616,
7503,
29899,
29896,
29962,
13,
9651,
260,
4141,
29918,
1761,
29889,
4397,
29898,
1777,
9446,
29918,
18616,
29897,
13,
4706,
716,
29918,
29873,
4141,
353,
4842,
305,
29889,
4117,
29898,
29873,
4141,
29918,
1761,
29892,
29871,
29900,
29897,
13,
4706,
565,
16345,
29918,
6979,
338,
451,
6213,
29901,
13,
9651,
716,
29918,
29873,
4141,
14352,
29896,
29962,
353,
1583,
29889,
355,
29918,
6979,
13,
4706,
1683,
29901,
13,
9651,
716,
29918,
29873,
4141,
353,
4842,
305,
29889,
4117,
4197,
1482,
29918,
29873,
4141,
29892,
4842,
305,
29889,
20158,
4197,
1311,
29889,
355,
29918,
6979,
1402,
4742,
29922,
1311,
29889,
10141,
29897,
1402,
29871,
29900,
29897,
13,
4706,
736,
716,
29918,
29873,
4141,
13,
13,
1678,
822,
903,
4282,
29918,
14834,
29918,
7165,
29898,
1311,
29892,
429,
29918,
344,
3174,
29892,
3013,
29918,
695,
893,
29892,
5191,
29918,
695,
893,
29922,
8516,
29892,
11105,
29922,
8516,
29892,
11916,
29922,
8516,
1125,
13,
4706,
3013,
29918,
25932,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
17462,
29918,
695,
893,
29892,
429,
29918,
344,
3174,
29897,
13,
4706,
3474,
29918,
1761,
353,
5159,
13,
4706,
363,
429,
297,
3013,
29918,
25932,
29918,
1761,
29901,
13,
9651,
429,
29918,
8305,
353,
383,
29889,
8305,
29898,
735,
29892,
313,
29900,
29892,
29871,
29900,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
8106,
6948,
802,
29872,
911,
29898,
29896,
29897,
13,
9651,
429,
29918,
4703,
353,
4842,
305,
29889,
4117,
4197,
735,
29918,
8305,
7503,
735,
29889,
2311,
29898,
29900,
29897,
1402,
429,
29889,
6948,
802,
29872,
911,
29898,
29896,
511,
13,
462,
462,
1678,
429,
29918,
8305,
29961,
1311,
29889,
5085,
29889,
5080,
29918,
2311,
29930,
29906,
17531,
1402,
29871,
29896,
29897,
13,
9651,
3474,
29918,
1761,
29889,
4397,
29898,
735,
29918,
4703,
29897,
13,
4706,
3370,
353,
4842,
305,
29889,
4117,
29898,
7165,
29918,
1761,
29892,
29871,
29900,
29897,
13,
4706,
565,
5191,
29918,
695,
893,
338,
451,
6213,
29901,
13,
9651,
5191,
29918,
25932,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
6506,
29918,
695,
893,
29892,
429,
29918,
344,
3174,
29897,
13,
9651,
3474,
29918,
1761,
353,
5159,
13,
9651,
363,
429,
297,
5191,
29918,
25932,
29918,
1761,
29901,
13,
18884,
429,
29918,
8305,
353,
383,
29889,
8305,
29898,
735,
29892,
313,
29900,
29892,
29871,
29900,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
8106,
6948,
802,
29872,
911,
29898,
29896,
29897,
13,
18884,
429,
29918,
4703,
353,
4842,
305,
29889,
4117,
4197,
735,
29918,
8305,
7503,
735,
29889,
2311,
29898,
29900,
29897,
1402,
429,
29889,
6948,
802,
29872,
911,
29898,
29896,
511,
13,
462,
462,
4706,
429,
29918,
8305,
29961,
1311,
29889,
5085,
29889,
5080,
29918,
2311,
29930,
29906,
17531,
1402,
29871,
29896,
29897,
13,
18884,
3474,
29918,
1761,
29889,
4397,
29898,
735,
29918,
4703,
29897,
13,
9651,
3978,
29918,
14834,
353,
4842,
305,
29889,
4117,
29898,
7165,
29918,
1761,
29892,
29871,
29900,
29897,
13,
9651,
4559,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
27736,
29892,
429,
29918,
344,
3174,
29897,
13,
9651,
4559,
29918,
20158,
29918,
1761,
353,
5159,
13,
9651,
363,
474,
297,
3464,
29898,
2435,
29898,
735,
29918,
344,
3174,
22164,
13,
18884,
4559,
29918,
2248,
29918,
353,
4842,
305,
29889,
9502,
524,
29898,
29900,
29892,
11916,
29889,
2311,
6278,
29896,
511,
518,
13168,
29889,
2311,
6278,
29896,
29897,
1402,
4742,
29922,
1311,
29889,
10141,
29897,
13,
18884,
4559,
29918,
2248,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
11249,
29918,
1761,
29961,
29875,
1402,
29871,
29896,
29892,
4559,
29918,
2248,
19925,
13,
18884,
4559,
29918,
20158,
353,
5191,
29918,
25932,
29918,
1761,
29961,
29875,
3816,
11249,
29918,
2248,
29962,
13,
18884,
4559,
29918,
20158,
29918,
1761,
29889,
4397,
29898,
11249,
29918,
20158,
29897,
13,
9651,
4559,
29918,
14834,
353,
4842,
305,
29889,
4117,
29898,
11249,
29918,
20158,
29918,
1761,
29892,
29871,
29900,
29897,
13,
9651,
3370,
353,
3370,
334,
313,
13168,
1275,
29871,
29906,
467,
6948,
802,
29872,
911,
6278,
29896,
467,
7411,
580,
718,
320,
13,
18884,
4559,
29918,
14834,
334,
313,
13168,
1275,
29871,
29900,
467,
6948,
802,
29872,
911,
6278,
29896,
467,
7411,
580,
718,
320,
13,
18884,
3978,
29918,
14834,
334,
313,
13168,
1275,
29871,
29896,
467,
6948,
802,
29872,
911,
6278,
29896,
467,
7411,
580,
13,
4706,
736,
3370,
13,
13,
1678,
822,
903,
4351,
29918,
1202,
29918,
1217,
895,
29898,
1311,
29892,
2665,
29892,
4559,
29881,
29918,
18616,
29892,
7985,
29918,
3605,
601,
29922,
29900,
9575,
13,
4706,
6297,
29918,
1590,
353,
2665,
29961,
29896,
29901,
29906,
29962,
13,
4706,
977,
9446,
29918,
18616,
353,
2665,
29961,
18616,
2804,
1583,
29889,
8305,
29918,
6979,
3816,
29906,
17531,
13,
4706,
396,
977,
9446,
29918,
18616,
353,
2665,
29961,
18616,
2804,
1583,
29889,
8305,
29918,
6979,
3816,
29896,
17531,
13,
4706,
20088,
29918,
2311,
353,
4559,
29881,
29918,
18616,
29889,
2311,
29898,
29900,
29897,
13,
4706,
3309,
353,
4236,
29898,
524,
29898,
1777,
9446,
29918,
18616,
29889,
2311,
29898,
29900,
11877,
29898,
29896,
29974,
18837,
29918,
3605,
601,
8243,
977,
9446,
29918,
18616,
29889,
2311,
29898,
29900,
7240,
29896,
29897,
13,
4706,
1550,
977,
9446,
29918,
18616,
29889,
2311,
29898,
29900,
29897,
529,
3309,
29901,
13,
9651,
3646,
29918,
2848,
353,
3309,
448,
977,
9446,
29918,
18616,
29889,
2311,
29898,
29900,
29897,
13,
9651,
20088,
29918,
18616,
353,
4559,
29881,
29918,
18616,
29961,
8172,
29889,
9502,
524,
29898,
29900,
29892,
20088,
29918,
2311,
29899,
29896,
4638,
13,
9651,
20088,
29918,
18616,
353,
20088,
29918,
18616,
29961,
9502,
29918,
18616,
2804,
1583,
29889,
8305,
29918,
6979,
3816,
29906,
17531,
29871,
396,
3349,
1067,
29879,
322,
6297,
23655,
13,
9651,
396,
20088,
29918,
18616,
353,
20088,
29918,
18616,
29961,
9502,
29918,
18616,
2804,
1583,
29889,
8305,
29918,
6979,
3816,
29896,
17531,
396,
694,
6297,
23655,
13,
9651,
1369,
29918,
3149,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
20088,
29918,
18616,
29889,
2311,
29898,
29900,
6817,
29896,
29897,
13,
9651,
1095,
29918,
3149,
353,
4036,
29889,
9502,
524,
29898,
2962,
29918,
3149,
29892,
20088,
29918,
18616,
29889,
2311,
29898,
29900,
876,
13,
9651,
20088,
29918,
28192,
353,
20088,
29918,
18616,
29961,
2962,
29918,
3149,
29901,
1195,
29898,
355,
29918,
3149,
29892,
1369,
29918,
3149,
29974,
29896,
29900,
29892,
1369,
29918,
3149,
29974,
5182,
29918,
2848,
4638,
13,
9651,
4635,
29918,
3149,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
977,
9446,
29918,
18616,
29889,
2311,
29898,
29900,
6817,
29896,
29897,
13,
9651,
977,
9446,
29918,
18616,
353,
4842,
305,
29889,
4117,
4197,
1777,
9446,
29918,
18616,
7503,
7851,
29918,
3149,
1402,
13,
462,
462,
1678,
20088,
29918,
28192,
29892,
13,
462,
462,
1678,
977,
9446,
29918,
18616,
29961,
7851,
29918,
3149,
17531,
1402,
29871,
29900,
29897,
13,
4706,
396,
736,
977,
9446,
29918,
18616,
13,
4706,
736,
4842,
305,
29889,
4117,
4197,
12154,
29918,
1590,
29892,
977,
9446,
29918,
18616,
1402,
29871,
29900,
29897,
13,
13,
1678,
822,
903,
4282,
29918,
1217,
3368,
29918,
4351,
29898,
1311,
29892,
4765,
29892,
429,
29918,
344,
3174,
29892,
11916,
29892,
7985,
29918,
3605,
601,
29922,
29900,
9575,
13,
4706,
4765,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
4351,
29892,
429,
29918,
344,
3174,
29897,
13,
4706,
716,
29918,
4351,
29918,
1761,
353,
5159,
13,
4706,
4559,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
27736,
29892,
429,
29918,
344,
3174,
29897,
13,
13,
4706,
363,
474,
29892,
429,
297,
26985,
29898,
4351,
29918,
1761,
1125,
13,
9651,
363,
432,
29892,
2665,
297,
26985,
29898,
735,
1125,
13,
18884,
4559,
29881,
29918,
18616,
353,
429,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
4559,
29918,
1761,
29961,
29875,
3816,
29926,
2314,
13,
18884,
17832,
29918,
18616,
353,
1583,
3032,
4351,
29918,
1202,
29918,
1217,
895,
29898,
18616,
29892,
4559,
29881,
29918,
18616,
29892,
7985,
29918,
3605,
601,
29897,
13,
18884,
716,
29918,
4351,
353,
4842,
305,
29889,
4117,
4197,
7345,
305,
29889,
20158,
4197,
1311,
29889,
25932,
29918,
6979,
1402,
4742,
29922,
1311,
29889,
10141,
511,
17832,
29918,
18616,
1402,
29871,
29900,
29897,
13,
18884,
716,
29918,
4351,
29918,
1761,
29889,
4397,
29898,
1482,
29918,
4351,
29897,
13,
13,
4706,
716,
29918,
4351,
353,
17132,
29918,
16506,
29898,
1482,
29918,
4351,
29918,
1761,
29892,
9853,
29918,
4102,
29922,
5574,
29892,
7164,
29918,
1767,
29922,
1311,
29889,
8305,
29918,
6979,
29897,
13,
4706,
716,
29918,
13168,
353,
716,
29918,
4351,
29889,
1272,
29889,
484,
29898,
1311,
29889,
8305,
29918,
6979,
29897,
13,
4706,
716,
29918,
344,
3174,
353,
4842,
305,
29889,
3298,
359,
29918,
4561,
29898,
1482,
29918,
4351,
29897,
13,
4706,
736,
716,
29918,
4351,
29892,
716,
29918,
13168,
29892,
716,
29918,
344,
3174,
13,
13,
1678,
822,
903,
4282,
29918,
4703,
29918,
29873,
4141,
29898,
1311,
29892,
260,
4141,
29892,
429,
29918,
344,
3174,
29892,
5401,
29918,
2311,
29922,
29896,
29892,
6623,
29922,
8824,
29892,
11105,
29922,
8516,
1125,
13,
13,
4706,
260,
4141,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
29873,
4141,
29892,
429,
29918,
344,
3174,
29897,
13,
4706,
716,
29918,
29873,
4141,
29918,
1761,
353,
5159,
13,
4706,
565,
6623,
322,
11105,
338,
451,
6213,
29901,
13,
9651,
396,
29871,
29896,
2794,
12515,
278,
10541,
13,
9651,
11105,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
13168,
29892,
429,
29918,
344,
3174,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
29873,
4141,
29918,
1761,
22164,
13,
9651,
2665,
29918,
1949,
353,
260,
4141,
29918,
1761,
29961,
29875,
1822,
2311,
29898,
29900,
29897,
13,
9651,
363,
432,
297,
3464,
29898,
18616,
29918,
1949,
1125,
13,
18884,
565,
6623,
29901,
13,
462,
1678,
4482,
353,
432,
29899,
5080,
29918,
2311,
13,
462,
1678,
701,
353,
432,
29974,
5080,
29918,
2311,
29974,
29896,
13,
462,
1678,
2380,
353,
4842,
305,
29889,
279,
927,
29898,
677,
29892,
701,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
462,
1678,
2380,
353,
2380,
29961,
13168,
29918,
1761,
29961,
29875,
3816,
29926,
29962,
1405,
29871,
29900,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
4482,
353,
4236,
29898,
29900,
29892,
432,
29899,
5080,
29918,
2311,
29897,
13,
462,
1678,
701,
353,
1375,
29898,
18616,
29918,
1949,
29892,
432,
29974,
5080,
29918,
2311,
29974,
29896,
29897,
13,
462,
1678,
2380,
353,
4842,
305,
29889,
279,
927,
29898,
677,
29892,
701,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
18884,
716,
29918,
29873,
4141,
29918,
1761,
29889,
4397,
29898,
1311,
3032,
276,
4282,
29918,
29873,
4141,
29898,
29873,
4141,
29918,
1761,
29961,
29875,
1402,
2380,
29892,
1583,
29889,
10199,
29918,
6979,
876,
13,
13,
4706,
716,
29918,
29873,
4141,
353,
17132,
29918,
16506,
29898,
1482,
29918,
29873,
4141,
29918,
1761,
29892,
9853,
29918,
4102,
29922,
5574,
29892,
7164,
29918,
1767,
29922,
1311,
29889,
8305,
29918,
6979,
29897,
13,
13,
4706,
736,
716,
29918,
29873,
4141,
13,
13,
1678,
822,
903,
4282,
29918,
1514,
29918,
29873,
4141,
29898,
1311,
29892,
260,
4141,
29892,
9649,
29892,
429,
29918,
344,
3174,
29892,
5401,
29918,
2311,
29922,
29896,
29892,
4236,
29918,
29895,
29922,
29953,
29892,
269,
2934,
29922,
29896,
29889,
29900,
1125,
13,
13,
4706,
9649,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
2003,
29892,
429,
29918,
344,
3174,
29897,
13,
4706,
260,
4141,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
29873,
4141,
29892,
429,
29918,
344,
3174,
29897,
13,
13,
4706,
716,
29918,
29873,
4141,
29918,
1761,
353,
5159,
13,
4706,
2380,
29918,
1761,
353,
5159,
13,
4706,
9500,
29918,
1761,
353,
5159,
13,
4706,
18414,
29918,
2248,
353,
29871,
29900,
13,
4706,
363,
22645,
297,
3464,
29898,
2435,
29898,
735,
29918,
344,
3174,
22164,
13,
9651,
429,
29918,
2003,
353,
9649,
29918,
1761,
29961,
13140,
29962,
13,
9651,
2665,
29918,
1949,
353,
429,
29918,
344,
3174,
29961,
13140,
29962,
13,
9651,
429,
29918,
29873,
4141,
353,
260,
4141,
29918,
1761,
29961,
13140,
29962,
13,
9651,
260,
4141,
29918,
2848,
353,
429,
29918,
29873,
4141,
7503,
29892,
29871,
29896,
29901,
1822,
484,
29898,
1311,
29889,
8305,
29918,
6979,
467,
2083,
29898,
6229,
29922,
29896,
467,
7411,
580,
13,
9651,
2246,
29895,
29918,
4841,
353,
1583,
3032,
25171,
537,
29918,
10003,
29898,
735,
29918,
2003,
29892,
2665,
29918,
1949,
29892,
260,
4141,
29918,
2848,
29892,
5401,
29918,
2311,
29892,
4236,
29918,
29895,
29892,
269,
2934,
29897,
13,
9651,
716,
29918,
29873,
4141,
29918,
1761,
29889,
4397,
29898,
1311,
3032,
276,
4282,
29918,
29873,
4141,
29898,
735,
29918,
29873,
4141,
29892,
2246,
29895,
29918,
4841,
29892,
1583,
29889,
10199,
29918,
6979,
876,
13,
9651,
9500,
29918,
1761,
29889,
4397,
29898,
3332,
29895,
29918,
4841,
29897,
13,
9651,
2380,
29918,
1761,
29889,
4397,
29898,
3332,
29895,
29918,
4841,
718,
18414,
29918,
2248,
29897,
13,
9651,
18414,
29918,
2248,
4619,
2665,
29918,
1949,
13,
4706,
716,
29918,
29873,
4141,
353,
17132,
29918,
16506,
29898,
1482,
29918,
29873,
4141,
29918,
1761,
29892,
9853,
29918,
4102,
29922,
5574,
29892,
7164,
29918,
1767,
29922,
1311,
29889,
8305,
29918,
6979,
29897,
13,
4706,
736,
716,
29918,
29873,
4141,
29892,
2380,
29918,
1761,
29892,
9500,
29918,
1761,
13,
13,
1678,
822,
903,
25171,
537,
29918,
10003,
29898,
1311,
29892,
9649,
29892,
2665,
29918,
1949,
29892,
260,
4141,
29918,
2848,
29892,
5401,
29918,
2311,
29892,
4236,
29918,
29895,
29892,
269,
2934,
29892,
634,
29874,
29922,
29900,
29889,
29945,
29892,
1375,
29918,
2848,
29922,
29945,
1125,
13,
13,
4706,
4974,
9649,
29889,
2311,
29898,
29900,
29897,
1275,
2665,
29918,
1949,
13,
4706,
1027,
353,
4842,
305,
29889,
18816,
29885,
3398,
29898,
1311,
29889,
5231,
29918,
18152,
457,
279,
29898,
2003,
29889,
6948,
802,
29872,
911,
29898,
29896,
467,
18837,
29898,
18616,
29918,
1949,
29892,
2665,
29918,
1949,
29892,
448,
29896,
467,
1285,
5526,
681,
3285,
13,
462,
462,
795,
9649,
29889,
6948,
802,
29872,
911,
29898,
29900,
467,
18837,
29898,
18616,
29918,
1949,
29892,
2665,
29918,
1949,
29892,
448,
29896,
467,
1285,
5526,
681,
3101,
13,
462,
9651,
13742,
29879,
802,
29872,
911,
2141,
4801,
496,
580,
13,
4706,
396,
1027,
353,
4842,
305,
29889,
18816,
29885,
3398,
29898,
7345,
305,
29889,
4317,
29898,
2003,
29892,
9649,
29889,
3286,
4220,
29898,
29900,
29892,
29871,
29896,
4961,
13,
4706,
396,
1027,
353,
4842,
305,
29889,
3944,
457,
29918,
29764,
537,
29898,
13,
4706,
396,
1678,
9649,
29889,
6948,
802,
29872,
911,
29898,
29896,
467,
18837,
29898,
18616,
29918,
1949,
29892,
2665,
29918,
1949,
29892,
448,
29896,
467,
1285,
5526,
681,
2141,
1493,
29898,
18616,
29918,
1949,
334,
2665,
29918,
1949,
29892,
448,
29896,
511,
13,
4706,
396,
1678,
9649,
29889,
6948,
802,
29872,
911,
29898,
29900,
467,
18837,
29898,
18616,
29918,
1949,
29892,
2665,
29918,
1949,
29892,
448,
29896,
467,
1285,
5526,
681,
2141,
1493,
29898,
18616,
29918,
1949,
334,
2665,
29918,
1949,
29892,
448,
29896,
29897,
13,
4706,
396,
13742,
1493,
29898,
18616,
29918,
1949,
29892,
2665,
29918,
1949,
467,
4801,
496,
580,
13,
13,
4706,
396,
8147,
1027,
7688,
13,
4706,
413,
353,
1375,
29898,
3317,
29898,
18616,
29918,
1949,
849,
313,
5080,
29918,
2311,
29930,
29906,
29974,
29896,
511,
29871,
29896,
511,
4236,
29918,
29895,
29897,
13,
4706,
722,
353,
2665,
29918,
1949,
847,
413,
334,
29871,
29896,
29889,
13,
4706,
921,
353,
4842,
305,
29889,
279,
927,
29898,
18616,
29918,
1949,
29892,
4742,
29922,
1311,
29889,
10141,
29892,
26688,
29922,
7345,
305,
29889,
7411,
467,
6948,
802,
29872,
911,
29898,
29900,
467,
18837,
29918,
294,
29898,
3601,
29897,
13,
4706,
318,
353,
4842,
305,
29889,
279,
927,
29898,
18616,
29918,
1949,
29892,
4742,
29922,
1311,
29889,
10141,
29892,
26688,
29922,
7345,
305,
29889,
7411,
467,
6948,
802,
29872,
911,
29898,
29896,
29897,
13,
4706,
7688,
353,
4842,
305,
29889,
4548,
6278,
29898,
29916,
29899,
29884,
29897,
1068,
29906,
847,
313,
29906,
29889,
334,
722,
1068,
29906,
876,
334,
313,
29896,
29889,
448,
4842,
305,
29889,
1032,
29872,
29898,
18616,
29918,
1949,
29892,
4742,
29922,
1311,
29889,
10141,
876,
13,
4706,
396,
7688,
353,
29871,
29896,
29889,
448,
4842,
305,
29889,
1032,
29872,
29898,
18616,
29918,
1949,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
4706,
1027,
29961,
29873,
4141,
29918,
2848,
529,
1375,
29918,
2848,
29892,
584,
29962,
353,
448,
29896,
29872,
29906,
29900,
13,
13,
4706,
396,
20535,
403,
6555,
537,
322,
1831,
2246,
413,
10541,
29889,
13,
4706,
2246,
29895,
29918,
4841,
353,
4842,
305,
29889,
6310,
29898,
29900,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
4706,
11105,
353,
4842,
305,
29889,
3298,
359,
4197,
18616,
29918,
1949,
29892,
2665,
29918,
1949,
1402,
26688,
29922,
7345,
305,
29889,
7411,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
4706,
363,
903,
297,
3464,
29898,
29895,
1125,
13,
9651,
2099,
29918,
13628,
353,
4842,
305,
29889,
2083,
29898,
3601,
334,
7688,
29892,
3964,
29922,
29896,
29897,
847,
4236,
29898,
18616,
29918,
1949,
29899,
29896,
29892,
29871,
29896,
29897,
13,
9651,
4236,
29918,
29894,
29892,
903,
353,
4842,
305,
29889,
3317,
29898,
3601,
334,
7688,
334,
11105,
29892,
3964,
29922,
29896,
29897,
13,
9651,
6555,
537,
353,
634,
29874,
29930,
12676,
29918,
13628,
448,
313,
29896,
29899,
1187,
11877,
3317,
29918,
29894,
13,
9651,
17117,
2246,
29918,
333,
353,
4842,
305,
29889,
3332,
29895,
29898,
25171,
537,
29892,
29871,
29896,
29892,
3964,
29922,
29900,
29892,
12705,
29922,
8824,
29897,
13,
9651,
2246,
29895,
29918,
4841,
353,
4842,
305,
29889,
4117,
4197,
3332,
29895,
29918,
4841,
29892,
2246,
29918,
333,
1402,
29871,
29900,
29897,
13,
9651,
1027,
29961,
3332,
29895,
29918,
4841,
29892,
584,
29962,
353,
448,
29896,
29872,
29906,
29900,
13,
9651,
11105,
7503,
29892,
2246,
29895,
29918,
4841,
29962,
353,
29871,
29896,
29889,
13,
4706,
2246,
29895,
29918,
4841,
29892,
903,
353,
4842,
305,
29889,
6605,
29898,
3332,
29895,
29918,
4841,
29897,
13,
4706,
9995,
13,
4706,
6555,
537,
353,
4842,
305,
29889,
2083,
29898,
3601,
334,
7688,
29892,
3964,
29922,
29896,
29897,
13,
4706,
17117,
2246,
29895,
29918,
4841,
353,
4842,
305,
29889,
3332,
29895,
29898,
25171,
537,
29892,
413,
29892,
3964,
29922,
29900,
29892,
12705,
29922,
8824,
29897,
13,
4706,
2246,
29895,
29918,
4841,
29892,
903,
353,
4842,
305,
29889,
6605,
29898,
3332,
29895,
29918,
4841,
29897,
13,
4706,
9995,
13,
4706,
736,
2246,
29895,
29918,
4841,
13,
13,
1678,
822,
903,
1202,
29918,
13168,
29898,
1311,
29892,
4765,
29892,
11105,
29918,
4351,
1125,
13,
4706,
26354,
29918,
2248,
353,
4842,
305,
29889,
6310,
29918,
4561,
29898,
13168,
29918,
4351,
467,
7411,
2141,
29590,
29918,
2141,
280,
29898,
1311,
29889,
5085,
29889,
13168,
29918,
6979,
29918,
22795,
29897,
13,
4706,
6529,
29918,
2248,
353,
4842,
305,
29889,
6310,
29918,
4561,
29898,
13168,
29918,
4351,
7503,
29892,
29871,
29900,
14664,
7411,
2141,
29590,
29918,
2141,
4141,
29898,
1311,
29889,
5085,
29889,
2622,
29918,
18616,
29918,
22795,
29897,
13,
4706,
26354,
29918,
2248,
29961,
567,
29918,
2248,
29962,
353,
29871,
29900,
13,
4706,
396,
319,
5405,
11105,
518,
29925,
3035,
29962,
13,
4706,
26354,
29918,
2248,
15625,
29896,
29899,
13168,
29918,
4351,
467,
10389,
580,
29962,
353,
29871,
29900,
13,
4706,
396,
319,
5405,
11105,
518,
6154,
29903,
29962,
13,
4706,
26354,
29918,
2248,
7503,
29892,
29871,
29900,
29962,
353,
29871,
29900,
13,
4706,
396,
319,
5405,
11105,
518,
1660,
29954,
29962,
13,
4706,
26354,
29918,
2248,
29961,
4351,
1275,
1583,
29889,
10199,
29918,
6979,
29962,
353,
29871,
29900,
13,
4706,
4765,
29961,
3358,
29918,
2248,
29962,
353,
1583,
29889,
13168,
29918,
6979,
13,
4706,
736,
4765,
13,
13,
1678,
822,
903,
4282,
29918,
5231,
29898,
1311,
29892,
289,
3616,
29892,
429,
29918,
344,
3174,
29892,
5401,
29918,
2311,
29922,
29896,
29892,
8178,
29918,
1949,
29922,
29906,
1125,
13,
13,
4706,
18002,
353,
4842,
305,
29889,
5451,
29898,
7345,
305,
29889,
279,
927,
29898,
29900,
29892,
289,
3616,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29892,
4742,
29922,
1311,
29889,
10141,
511,
429,
29918,
344,
3174,
29897,
13,
4706,
260,
4141,
353,
4842,
305,
29889,
5451,
29898,
7345,
305,
29889,
2873,
29898,
29890,
3616,
511,
429,
29918,
344,
3174,
29897,
13,
4706,
18002,
29918,
1761,
353,
5159,
13,
4706,
18002,
29918,
12574,
29918,
1761,
353,
5159,
13,
4706,
260,
4141,
29918,
1761,
353,
5159,
13,
4706,
8178,
29918,
1761,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
735,
29918,
344,
3174,
22164,
13,
9651,
2665,
29918,
1949,
353,
429,
29918,
344,
3174,
29961,
29875,
29962,
13,
9651,
18002,
29918,
677,
353,
18002,
29961,
29875,
3816,
29900,
1822,
667,
580,
13,
9651,
18002,
29918,
786,
353,
18002,
29961,
29875,
3816,
18616,
29918,
1949,
29899,
29896,
1822,
667,
580,
13,
9651,
18002,
29918,
2248,
353,
18002,
29961,
29875,
1822,
14358,
29898,
5080,
29918,
2311,
29930,
29906,
16395,
22198,
29918,
1949,
29974,
29896,
876,
13,
9651,
260,
4141,
29918,
2248,
353,
260,
4141,
29961,
29875,
1822,
14358,
29898,
5080,
29918,
2311,
29930,
29906,
16395,
22198,
29918,
1949,
29974,
29896,
876,
13,
9651,
18002,
29918,
12574,
29918,
1761,
29889,
4397,
29898,
5231,
29961,
29875,
1822,
14358,
29898,
5080,
29918,
2311,
29930,
29906,
16395,
22198,
29918,
1949,
29974,
29896,
4961,
13,
9651,
260,
4141,
29918,
2248,
29961,
18616,
29918,
1949,
29930,
5080,
29918,
2311,
29930,
29906,
17531,
353,
29871,
29900,
13,
9651,
363,
432,
297,
3464,
29898,
5231,
29918,
2248,
29889,
2311,
29898,
29900,
22164,
13,
18884,
565,
260,
4141,
29918,
2248,
29961,
29926,
29962,
1275,
29871,
29896,
29901,
13,
462,
1678,
18002,
29918,
7382,
353,
18002,
29918,
2248,
29961,
29926,
29962,
13,
462,
1678,
3474,
29918,
1761,
353,
518,
29873,
363,
260,
297,
3464,
29898,
3317,
29898,
5231,
29918,
2248,
29961,
29926,
29962,
29899,
5080,
29918,
2311,
29892,
18002,
29918,
677,
511,
13,
462,
462,
462,
1678,
1375,
29898,
5231,
29918,
2248,
29961,
29926,
10062,
5080,
29918,
2311,
29892,
18002,
29918,
786,
7240,
29896,
29897,
13,
462,
462,
259,
565,
260,
2804,
18002,
29918,
2248,
29961,
29926,
5262,
13,
462,
1678,
18002,
29918,
7382,
353,
3474,
29918,
1761,
15625,
29926,
849,
2665,
29918,
1949,
29897,
1273,
7431,
29898,
7165,
29918,
1761,
4638,
13,
18884,
1683,
29901,
13,
462,
1678,
23794,
29918,
1761,
353,
518,
29873,
363,
260,
297,
3464,
29898,
5231,
29918,
677,
29892,
4236,
29898,
5231,
29918,
2248,
29961,
29926,
29962,
29899,
5080,
29918,
2311,
29892,
18002,
29918,
677,
28166,
718,
320,
13,
462,
18884,
518,
29873,
363,
260,
297,
3464,
29898,
1195,
29898,
5231,
29918,
2248,
29961,
29926,
10062,
5080,
29918,
2311,
29892,
18002,
29918,
786,
511,
18002,
29918,
786,
4638,
13,
462,
1678,
18002,
29918,
7382,
353,
23794,
29918,
1761,
29961,
8172,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
29883,
392,
29918,
1761,
6817,
29896,
4638,
13,
18884,
18002,
29918,
2248,
29961,
29926,
29962,
353,
18002,
29918,
7382,
13,
9651,
8178,
29918,
1761,
29889,
4397,
3552,
5231,
29918,
2248,
29961,
18616,
29918,
1949,
29930,
5080,
29918,
2311,
29930,
29906,
17531,
29899,
5231,
29918,
677,
467,
13,
462,
462,
1776,
29898,
22198,
29918,
1949,
29930,
5080,
29918,
2311,
29930,
29906,
29892,
448,
29896,
467,
3286,
4220,
29898,
29900,
29892,
29871,
29896,
876,
13,
9651,
18002,
29918,
1761,
29889,
4397,
29898,
5231,
29918,
2248,
29897,
13,
9651,
260,
4141,
29918,
1761,
29889,
4397,
29898,
29873,
4141,
29918,
2248,
29897,
13,
13,
4706,
260,
4141,
353,
4842,
305,
29889,
4117,
29898,
29873,
4141,
29918,
1761,
29892,
3964,
29922,
29900,
467,
7411,
2141,
517,
29898,
1311,
29889,
10141,
29897,
13,
4706,
18002,
29918,
12574,
353,
4842,
305,
29889,
4117,
29898,
5231,
29918,
12574,
29918,
1761,
29892,
3964,
29922,
29900,
29897,
13,
4706,
18002,
353,
4842,
305,
29889,
4117,
29898,
5231,
29918,
1761,
29892,
3964,
29922,
29900,
29897,
13,
4706,
8178,
29918,
11249,
353,
4842,
305,
29889,
4117,
29898,
22198,
29918,
1761,
29892,
3964,
29922,
29900,
29897,
13,
13,
4706,
736,
18002,
29892,
18002,
29918,
12574,
29892,
260,
4141,
29961,
5231,
2804,
448,
29896,
1402,
8178,
29918,
11249,
13,
13,
1678,
822,
903,
4282,
29918,
3385,
29918,
7165,
29898,
1311,
29892,
289,
3616,
29892,
429,
29918,
344,
3174,
29892,
5401,
29918,
2311,
29922,
29896,
29892,
3013,
29918,
3605,
601,
29922,
29900,
29889,
29896,
29892,
5191,
29918,
3605,
601,
29922,
29900,
29889,
29906,
1125,
13,
13,
4706,
4974,
3013,
29918,
3605,
601,
718,
5191,
29918,
3605,
601,
5277,
29871,
29896,
29889,
13,
4706,
11462,
29918,
3605,
601,
353,
29871,
29896,
448,
3013,
29918,
3605,
601,
448,
5191,
29918,
3605,
601,
13,
13,
4706,
3474,
29918,
2311,
353,
29871,
29906,
29930,
5080,
29918,
2311,
29974,
29896,
13,
4706,
2380,
353,
4842,
305,
29889,
5451,
29898,
7345,
305,
29889,
279,
927,
29898,
29896,
29892,
289,
3616,
29974,
29896,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29892,
4742,
29922,
1311,
29889,
10141,
511,
429,
29918,
344,
3174,
29897,
13,
4706,
396,
29871,
29906,
2794,
11462,
6124,
29892,
29871,
29896,
2794,
3013,
278,
3370,
29892,
29871,
29900,
2794,
16920,
13,
4706,
260,
4141,
353,
4842,
305,
29889,
3298,
359,
4197,
29890,
3616,
29892,
3474,
29918,
2311,
1402,
4742,
29922,
1311,
29889,
10141,
29892,
26688,
29922,
7345,
305,
29889,
524,
29897,
13,
4706,
2070,
353,
4842,
305,
29889,
6310,
4197,
29890,
3616,
29892,
3474,
29918,
2311,
1402,
4742,
29922,
1311,
29889,
10141,
467,
29590,
29918,
580,
13,
4706,
260,
4141,
29889,
13168,
287,
29918,
5589,
23538,
22795,
29889,
1896,
29898,
1217,
895,
29918,
3605,
601,
511,
29871,
29906,
29897,
13,
4706,
260,
4141,
29889,
13168,
287,
29918,
5589,
23538,
22795,
29889,
479,
29898,
29896,
29899,
17462,
29918,
3605,
601,
511,
29871,
29896,
29897,
13,
4706,
260,
4141,
353,
4842,
305,
29889,
5451,
29898,
29873,
4141,
29892,
429,
29918,
344,
3174,
29897,
13,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
735,
29918,
344,
3174,
22164,
13,
9651,
2665,
29918,
1949,
353,
429,
29918,
344,
3174,
29961,
29875,
29962,
13,
9651,
2380,
29918,
8305,
353,
383,
29889,
8305,
29898,
2248,
29961,
29875,
1402,
313,
1311,
29889,
5085,
29889,
5080,
29918,
2311,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
876,
13,
9651,
363,
432,
297,
3464,
29898,
18616,
29918,
1949,
1125,
13,
18884,
3474,
353,
2380,
29918,
8305,
29961,
29926,
29901,
29926,
29974,
7165,
29918,
2311,
29962,
13,
18884,
396,
319,
1365,
4821,
393,
599,
3161,
526,
29871,
29900,
13,
18884,
565,
4842,
305,
29889,
2083,
29898,
29873,
4141,
29961,
29875,
3816,
29926,
1822,
10389,
580,
16395,
7165,
1405,
29871,
29900,
876,
1275,
29871,
29900,
29901,
13,
462,
1678,
260,
4141,
29961,
29875,
3816,
29926,
3816,
5080,
29918,
2311,
29962,
353,
29871,
29906,
13,
18884,
260,
4141,
29961,
29875,
3816,
29926,
3816,
7165,
1275,
29871,
29900,
29962,
353,
448,
29896,
13,
4706,
260,
4141,
353,
4842,
305,
29889,
4117,
29898,
29873,
4141,
29892,
29871,
29900,
29897,
13,
4706,
736,
260,
4141,
13,
13,
1678,
822,
903,
11255,
29918,
21652,
29918,
16175,
29898,
1311,
29892,
9853,
29892,
3370,
29918,
9157,
29892,
4236,
29918,
2848,
29892,
2069,
29918,
517,
12360,
29922,
8516,
29892,
3370,
29918,
13168,
29922,
8516,
29892,
13,
462,
795,
1375,
29918,
2848,
29922,
29906,
29892,
22913,
29918,
2311,
29922,
29941,
29892,
11455,
29918,
6954,
29918,
1131,
29876,
29922,
8824,
1125,
13,
13,
4706,
9853,
29918,
2311,
353,
3370,
29918,
9157,
29889,
2311,
29898,
29900,
29897,
13,
13,
4706,
1602,
29918,
28631,
353,
1583,
29889,
7099,
6119,
29889,
2344,
29918,
7099,
6119,
29918,
3859,
29898,
16175,
29889,
4351,
29892,
3370,
29918,
9157,
29892,
411,
29918,
8173,
29922,
5574,
29897,
13,
13,
4706,
396,
323,
488,
5922,
322,
3370,
22913,
29918,
2311,
3064,
29889,
13,
4706,
1602,
29918,
28631,
29889,
1958,
29918,
16175,
29918,
9144,
29898,
13,
9651,
14013,
2106,
29892,
3964,
29901,
25900,
29898,
3859,
29892,
22913,
29918,
2311,
29892,
3964,
29922,
6229,
876,
13,
4706,
3370,
29918,
9157,
353,
25900,
29898,
14834,
29918,
9157,
29892,
22913,
29918,
2311,
29892,
3964,
29922,
29900,
29897,
13,
4706,
2069,
29918,
517,
12360,
353,
25900,
29898,
2344,
29918,
517,
12360,
29892,
22913,
29918,
2311,
29892,
3964,
29922,
29900,
29897,
13,
4706,
3370,
29918,
13168,
353,
25900,
29898,
14834,
29918,
13168,
29892,
22913,
29918,
2311,
29892,
3964,
29922,
29900,
29897,
13,
13,
4706,
9853,
29918,
10289,
353,
4842,
305,
29889,
279,
927,
29898,
13,
9651,
9853,
29918,
2311,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
4706,
22913,
29918,
10289,
353,
4842,
305,
29889,
279,
927,
29898,
13,
632,
29900,
29892,
13,
9651,
9853,
29918,
2311,
334,
22913,
29918,
2311,
29892,
13,
9651,
4331,
29922,
915,
314,
29918,
2311,
29892,
13,
9651,
26688,
29922,
7345,
305,
29889,
5426,
29892,
13,
9651,
4742,
29922,
1311,
29889,
10141,
29897,
13,
13,
4706,
18758,
29918,
11762,
353,
4842,
305,
29889,
8159,
29898,
13,
9651,
518,
16175,
29918,
2311,
334,
22913,
29918,
2311,
29892,
29871,
29896,
1402,
13,
9651,
1583,
29889,
2962,
29918,
6979,
29892,
13,
9651,
26688,
29922,
7345,
305,
29889,
5426,
29892,
13,
9651,
4742,
29922,
1311,
29889,
10141,
29897,
13,
13,
4706,
396,
25538,
2989,
6976,
304,
278,
937,
22913,
373,
278,
937,
4331,
29889,
13,
4706,
2246,
29895,
29918,
1188,
29918,
771,
5824,
353,
313,
13,
9651,
4842,
305,
29889,
20158,
4197,
29900,
29889,
29900,
29962,
718,
518,
7411,
703,
29899,
7192,
13531,
334,
313,
915,
314,
29918,
2311,
448,
29871,
29896,
511,
13,
462,
308,
4742,
29922,
1311,
29889,
10141,
467,
14358,
29898,
16175,
29918,
2311,
876,
13,
13,
4706,
396,
3767,
12425,
393,
8640,
7743,
13752,
21523,
29889,
13,
4706,
13752,
21523,
353,
518,
2636,
363,
903,
297,
3464,
29898,
16175,
29918,
2311,
4638,
29871,
396,
694,
25621,
29901,
383,
29947,
29896,
29906,
13,
13,
4706,
2582,
353,
518,
2636,
363,
903,
297,
3464,
29898,
16175,
29918,
2311,
4638,
29871,
396,
694,
25621,
29901,
383,
29947,
29896,
29906,
13,
13,
4706,
363,
4331,
297,
3464,
29898,
3317,
29918,
2848,
1125,
13,
9651,
565,
4331,
1405,
29871,
29900,
29901,
13,
18884,
2069,
29918,
517,
12360,
353,
6213,
13,
9651,
396,
3826,
6119,
6375,
29889,
13,
9651,
1602,
6119,
29918,
2080,
353,
18758,
29918,
11762,
7503,
29892,
448,
29896,
1822,
1493,
29898,
29896,
29892,
448,
29896,
29897,
13,
9651,
1602,
6119,
29918,
2080,
353,
1602,
6119,
29918,
2080,
29889,
3286,
4220,
29898,
29900,
29892,
29871,
29896,
29897,
13,
13,
9651,
1602,
29918,
449,
29892,
1602,
29918,
28631,
29892,
903,
353,
1583,
29889,
7099,
6119,
29898,
7099,
6119,
29918,
2080,
29892,
3370,
29918,
9157,
29892,
1602,
29918,
28631,
29892,
2069,
29918,
517,
12360,
29892,
4331,
29922,
10568,
29892,
13,
462,
462,
462,
29871,
3370,
29918,
13168,
29879,
29922,
14834,
29918,
13168,
29892,
11455,
29918,
14834,
29918,
1131,
29876,
29922,
17281,
29918,
6954,
29918,
1131,
29876,
29897,
13,
13,
9651,
396,
3251,
1061,
6375,
29889,
13,
9651,
1480,
29918,
771,
5824,
353,
1583,
29889,
27959,
29898,
7099,
29918,
449,
29889,
3286,
4220,
29898,
29900,
29892,
29871,
29896,
467,
29879,
802,
29872,
911,
29898,
29900,
876,
13,
13,
9651,
7931,
370,
29918,
2311,
353,
1480,
29918,
771,
5824,
29889,
2311,
6278,
29896,
29897,
13,
13,
9651,
565,
4331,
529,
1375,
29918,
2848,
29901,
13,
18884,
1480,
29918,
771,
5824,
7503,
29892,
1583,
29889,
355,
29918,
6979,
29962,
353,
448,
29896,
29872,
29906,
29900,
13,
13,
9651,
565,
1583,
29889,
5085,
29889,
1271,
29918,
509,
335,
2572,
29901,
13,
18884,
3151,
29918,
2435,
353,
18758,
29918,
11762,
29889,
2311,
29898,
29896,
29897,
13,
18884,
565,
29898,
2764,
29918,
2435,
1405,
29871,
29941,
1125,
13,
462,
1678,
363,
474,
297,
3464,
29898,
284,
573,
29918,
11762,
29889,
2311,
29898,
29900,
22164,
13,
462,
4706,
4418,
353,
7700,
13,
462,
4706,
3838,
353,
518,
524,
29898,
29893,
29897,
363,
281,
297,
18758,
29918,
11762,
29961,
29875,
5262,
13,
462,
4706,
565,
29898,
2435,
29898,
9303,
29897,
5277,
29871,
29941,
1125,
13,
462,
9651,
6773,
13,
462,
4706,
534,
4481,
2232,
353,
17288,
9303,
29961,
29875,
29899,
29896,
1402,
3838,
29961,
29875,
1402,
3838,
29961,
29875,
29974,
29896,
2314,
363,
474,
297,
3464,
29898,
29896,
29892,
7431,
29898,
9303,
6817,
29896,
4638,
13,
462,
4706,
16222,
2572,
353,
18761,
29898,
509,
4481,
2232,
14352,
29896,
2314,
13,
462,
4706,
565,
16222,
2572,
297,
534,
4481,
2232,
7503,
29899,
29896,
5387,
13,
462,
9651,
4418,
353,
5852,
13,
462,
4706,
565,
4418,
29901,
13,
462,
9651,
1480,
29918,
771,
5824,
29961,
29875,
29962,
353,
448,
29896,
29872,
29906,
29900,
13,
13,
9651,
396,
9683,
666,
368,
2070,
29879,
491,
278,
22913,
6976,
29889,
13,
9651,
1480,
29918,
771,
5824,
4619,
2246,
29895,
29918,
1188,
29918,
771,
5824,
29889,
1493,
6278,
29896,
467,
6948,
802,
29872,
911,
29898,
29896,
29897,
13,
13,
9651,
15595,
353,
1583,
29889,
5085,
29889,
2312,
13,
9651,
3309,
29918,
2238,
18745,
353,
5135,
29945,
29889,
29900,
718,
313,
10568,
718,
29871,
29896,
876,
847,
29871,
29953,
29889,
29900,
29897,
3579,
15595,
13,
13,
9651,
396,
2379,
8606,
2070,
29879,
964,
263,
1051,
310,
24496,
29889,
13,
9651,
16256,
29918,
1557,
2361,
353,
1480,
29918,
771,
5824,
847,
3309,
29918,
2238,
18745,
13,
13,
9651,
16256,
29918,
1557,
2361,
353,
16256,
29918,
1557,
2361,
29889,
690,
14443,
6278,
29896,
29892,
22913,
29918,
2311,
334,
7931,
370,
29918,
2311,
29897,
13,
9651,
2246,
29895,
29918,
1557,
2361,
29892,
2246,
29895,
29918,
4841,
353,
16256,
29918,
1557,
2361,
29889,
3332,
29895,
29898,
915,
314,
29918,
2311,
29892,
3964,
10457,
29896,
29897,
13,
13,
9651,
396,
3599,
957,
1480,
2070,
29879,
29889,
13,
9651,
2246,
29895,
29918,
1188,
29918,
771,
5824,
353,
2246,
29895,
29918,
1557,
2361,
334,
3309,
29918,
2238,
18745,
13,
13,
9651,
396,
24062,
345,
22913,
3978,
322,
1565,
1734,
18999,
29889,
13,
9651,
2246,
29895,
29918,
915,
314,
29918,
2248,
353,
2246,
29895,
29918,
4841,
29889,
4563,
29898,
29894,
542,
370,
29918,
2311,
29897,
13,
9651,
2246,
29895,
29918,
4841,
353,
2246,
29895,
29918,
4841,
29889,
29888,
1545,
29898,
29894,
542,
370,
29918,
2311,
29897,
13,
13,
9651,
396,
7315,
22913,
29918,
2248,
304,
9853,
29918,
2248,
297,
278,
12151,
8954,
29889,
13,
9651,
9853,
29918,
2248,
353,
313,
13,
462,
1678,
2246,
29895,
29918,
915,
314,
29918,
2248,
13,
462,
1678,
718,
22913,
29918,
10289,
7503,
3332,
29895,
29918,
915,
314,
29918,
2248,
29889,
2311,
29898,
29900,
29897,
1822,
6948,
802,
29872,
911,
29898,
29896,
876,
13,
9651,
1831,
29918,
513,
1575,
353,
9853,
29918,
2248,
29889,
1493,
6278,
29896,
29897,
13,
13,
9651,
396,
22871,
1833,
18988,
29889,
13,
9651,
18758,
29918,
11762,
353,
4842,
305,
29889,
4117,
29898,
13,
18884,
518,
284,
573,
29918,
11762,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1831,
29918,
513,
1575,
511,
13,
462,
2246,
29895,
29918,
4841,
29889,
1493,
6278,
29896,
29892,
29871,
29896,
29897,
1402,
448,
29896,
29897,
13,
13,
9651,
338,
29918,
4951,
3276,
353,
2246,
29895,
29918,
4841,
29889,
1837,
29898,
1311,
29889,
355,
29918,
6979,
29897,
13,
9651,
565,
4331,
718,
29871,
29896,
1275,
4236,
29918,
2848,
29901,
13,
18884,
338,
29918,
4951,
3276,
29889,
5589,
23538,
29896,
29897,
13,
9651,
396,
2796,
4195,
338,
2246,
22913,
338,
7743,
29889,
13,
9651,
1095,
29918,
16122,
353,
338,
29918,
4951,
3276,
7503,
29892,
29871,
29900,
1822,
1837,
29898,
29896,
29897,
13,
9651,
396,
16913,
7743,
13752,
21523,
29889,
13,
9651,
565,
338,
29918,
4951,
3276,
29889,
1384,
7295,
13,
18884,
27303,
353,
18758,
29918,
11762,
29889,
1493,
6278,
29896,
29892,
22913,
29918,
2311,
29892,
18758,
29918,
11762,
29889,
2311,
6278,
29896,
876,
13,
18884,
363,
474,
297,
3464,
29898,
275,
29918,
4951,
3276,
29889,
2311,
29898,
29900,
22164,
13,
462,
1678,
289,
353,
9853,
29918,
10289,
29961,
29875,
29962,
13,
462,
1678,
565,
1095,
29918,
16122,
29961,
29875,
5387,
13,
462,
4706,
338,
29918,
4951,
3276,
29961,
29875,
1822,
5589,
23538,
29896,
29897,
13,
462,
1678,
7743,
29918,
29882,
1478,
353,
338,
29918,
4951,
3276,
29961,
29875,
1822,
5464,
9171,
2141,
1493,
6278,
29896,
29897,
13,
462,
1678,
396,
14491,
7743,
13752,
21523,
363,
445,
9853,
29889,
13,
462,
1678,
363,
432,
297,
7743,
29918,
29882,
1478,
29901,
13,
462,
4706,
13752,
21523,
29961,
29890,
1822,
4397,
3552,
13,
462,
9651,
2246,
29895,
29918,
1557,
2361,
29961,
29875,
29892,
432,
1402,
13,
462,
9651,
27303,
29961,
29875,
29892,
432,
29892,
29871,
29896,
29901,
12622,
13,
462,
1678,
396,
960,
278,
9853,
7450,
278,
1095,
29892,
4078,
278,
302,
29918,
13318,
13752,
21523,
29889,
13,
462,
1678,
565,
1095,
29918,
16122,
29961,
29875,
5387,
13,
462,
4706,
1900,
29918,
29882,
1478,
353,
12705,
29898,
13,
462,
9651,
13752,
21523,
29961,
29890,
1402,
1820,
29922,
2892,
921,
29901,
921,
29961,
29900,
1402,
11837,
29922,
5574,
29897,
13,
462,
4706,
17117,
4450,
353,
1900,
29918,
29882,
1478,
29961,
29900,
29962,
13,
462,
4706,
2582,
29961,
29890,
1822,
4397,
29898,
11965,
29897,
13,
18884,
1661,
29918,
4951,
3276,
353,
1095,
29918,
16122,
29889,
1837,
29898,
29900,
467,
5464,
9171,
2141,
1493,
6278,
29896,
29897,
13,
18884,
396,
960,
599,
25260,
526,
20512,
29892,
694,
817,
304,
748,
4340,
29889,
13,
18884,
565,
7431,
29898,
5464,
29918,
4951,
3276,
29897,
1275,
29871,
29900,
29901,
13,
462,
1678,
2867,
13,
18884,
396,
15154,
7743,
9853,
267,
363,
278,
2446,
4331,
29889,
13,
18884,
2246,
29895,
29918,
1188,
29918,
771,
5824,
353,
2246,
29895,
29918,
1188,
29918,
771,
5824,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1661,
29918,
4951,
3276,
29897,
13,
18884,
9853,
29918,
2248,
353,
9853,
29918,
2248,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1661,
29918,
4951,
3276,
29897,
13,
18884,
9853,
29918,
10289,
353,
9853,
29918,
10289,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1661,
29918,
4951,
3276,
29897,
13,
18884,
18758,
29918,
11762,
353,
27303,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1661,
29918,
4951,
3276,
29897,
320,
13,
462,
1678,
869,
1493,
6278,
29896,
29892,
18758,
29918,
11762,
29889,
2311,
6278,
29896,
876,
13,
9651,
396,
830,
2098,
5922,
29889,
13,
9651,
1831,
29918,
513,
1575,
353,
9853,
29918,
2248,
29889,
1493,
6278,
29896,
29897,
13,
9651,
565,
3370,
29918,
9157,
338,
451,
6213,
29901,
13,
18884,
3370,
29918,
9157,
353,
3370,
29918,
9157,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1831,
29918,
513,
1575,
29897,
13,
9651,
565,
3370,
29918,
13168,
338,
451,
6213,
29901,
13,
18884,
3370,
29918,
13168,
353,
3370,
29918,
13168,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1831,
29918,
513,
1575,
29897,
13,
9651,
565,
2069,
29918,
517,
12360,
338,
451,
6213,
29901,
13,
18884,
2069,
29918,
517,
12360,
353,
2069,
29918,
517,
12360,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
1831,
29918,
513,
1575,
29897,
13,
13,
9651,
1602,
29918,
28631,
29889,
1958,
29918,
16175,
29918,
9144,
29898,
13,
18884,
14013,
2106,
29892,
3964,
29901,
2106,
29889,
2248,
29918,
2622,
29898,
6229,
29892,
1831,
29918,
513,
1575,
876,
13,
13,
4706,
2582,
353,
518,
29873,
29961,
29900,
29962,
363,
260,
297,
2582,
29962,
13,
4706,
736,
2582,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
9853,
1125,
13,
13,
4706,
4765,
353,
9853,
29889,
4351,
13,
4706,
260,
4141,
353,
9853,
29889,
29873,
4141,
13,
4706,
2377,
29879,
353,
9853,
29889,
344,
3174,
13,
4706,
11105,
29918,
4351,
353,
9853,
29889,
13168,
29918,
4351,
13,
4706,
429,
29918,
344,
3174,
353,
9853,
29889,
735,
29918,
344,
3174,
13,
13,
4706,
565,
1583,
29889,
26495,
29901,
13,
9651,
396,
21029,
777,
7928,
434,
14401,
2925,
304,
437,
4469,
29899,
3977,
6119,
13,
9651,
429,
29918,
2311,
353,
9853,
29889,
4351,
29889,
2311,
29898,
29900,
29897,
13,
9651,
429,
29918,
2248,
353,
518,
29875,
363,
474,
297,
3464,
29898,
735,
29918,
2311,
4638,
13,
9651,
4036,
29889,
845,
21897,
29898,
735,
29918,
2248,
29897,
13,
9651,
429,
29918,
2248,
29879,
353,
4842,
305,
29889,
20158,
29898,
735,
29918,
2248,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
9651,
429,
29918,
11249,
29918,
2248,
29879,
353,
429,
29918,
2248,
29879,
7503,
3317,
29898,
524,
29898,
735,
29918,
2311,
334,
1583,
29889,
5085,
29889,
11249,
29918,
3605,
601,
511,
29871,
29896,
4638,
13,
13,
9651,
396,
3617,
15228,
14401,
749,
6694,
11916,
322,
22525,
13,
9651,
18002,
29918,
2248,
29892,
18002,
29918,
13492,
29918,
2248,
29892,
18002,
29918,
29873,
4141,
29892,
8178,
29918,
27736,
353,
320,
13,
18884,
1583,
3032,
4282,
29918,
5231,
29898,
4351,
29889,
2311,
29898,
29900,
511,
429,
29918,
344,
3174,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
29892,
1583,
29889,
5085,
29889,
22198,
29918,
11249,
29918,
1949,
29897,
13,
9651,
731,
5552,
29898,
16175,
29892,
525,
5231,
29918,
29873,
4141,
742,
18002,
29918,
29873,
4141,
29897,
13,
13,
4706,
2984,
29918,
13168,
353,
1583,
3032,
4282,
29918,
3385,
29918,
7165,
29898,
4351,
29889,
2311,
29898,
29900,
511,
429,
29918,
344,
3174,
29892,
5401,
29918,
2311,
29922,
1311,
29889,
5085,
29889,
5080,
29918,
2311,
29892,
13,
462,
462,
18884,
3013,
29918,
3605,
601,
29922,
1311,
29889,
5085,
29889,
567,
565,
1583,
29889,
26495,
1683,
29871,
29896,
1696,
13,
462,
462,
18884,
5191,
29918,
3605,
601,
29922,
1311,
29889,
5085,
29889,
558,
565,
1583,
29889,
26495,
1683,
29871,
29900,
1846,
13,
13,
4706,
565,
1583,
29889,
26495,
29901,
13,
9651,
396,
8878,
694,
3368,
4765,
13,
9651,
694,
3368,
29918,
4351,
29892,
694,
3368,
29918,
4351,
29918,
13168,
29892,
694,
3368,
29918,
4351,
29918,
344,
3174,
353,
320,
13,
18884,
1583,
3032,
4282,
29918,
1217,
3368,
29918,
4351,
29898,
4351,
29892,
429,
29918,
344,
3174,
29892,
11916,
29922,
22198,
29918,
27736,
29892,
13,
462,
462,
539,
7985,
29918,
3605,
601,
29922,
1311,
29889,
5085,
29889,
18837,
29918,
3605,
601,
29897,
13,
4706,
396,
2048,
3030,
260,
4141,
13,
4706,
3030,
29918,
29873,
4141,
353,
1583,
3032,
4282,
29918,
4703,
29918,
29873,
4141,
29898,
29873,
4141,
29892,
429,
29918,
344,
3174,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
29892,
13,
462,
462,
795,
6623,
29922,
1311,
29889,
26495,
29892,
11105,
29922,
3385,
29918,
13168,
29897,
13,
4706,
731,
5552,
29898,
16175,
29892,
525,
4703,
29918,
29873,
4141,
742,
3030,
29918,
29873,
4141,
29897,
13,
13,
4706,
396,
360,
16036,
29901,
16968,
368,
11105,
18897,
13,
4706,
565,
1583,
29889,
26495,
29901,
13,
9651,
4765,
353,
1583,
3032,
1202,
29918,
13168,
29898,
4351,
29889,
16513,
3285,
11105,
29918,
4351,
29897,
13,
9651,
694,
3368,
29918,
4351,
353,
1583,
3032,
1202,
29918,
13168,
29898,
1217,
3368,
29918,
4351,
29892,
694,
3368,
29918,
4351,
29918,
13168,
29897,
13,
13,
4706,
565,
1583,
29889,
5085,
29889,
3977,
6119,
1275,
376,
2151,
1115,
13,
9651,
2246,
29918,
2003,
353,
1583,
29889,
3977,
6119,
29898,
4351,
29892,
2377,
29879,
29892,
11105,
29918,
4351,
29897,
13,
4706,
1683,
29901,
13,
9651,
4765,
29918,
1590,
353,
1583,
29889,
17987,
29881,
886,
29898,
4351,
29897,
13,
9651,
2246,
29918,
2003,
353,
1583,
29889,
3977,
6119,
29898,
4351,
29918,
1590,
29892,
29871,
29896,
29899,
13168,
29918,
4351,
29897,
13,
4706,
1067,
893,
353,
2246,
29918,
2003,
7503,
29892,
29871,
29900,
29892,
584,
29962,
13,
13,
4706,
396,
12433,
1279,
936,
2094,
6119,
13,
4706,
1067,
29879,
29918,
1761,
353,
4842,
305,
29889,
5451,
29898,
695,
893,
29892,
429,
29918,
344,
3174,
29897,
13,
4706,
1067,
29879,
29918,
2080,
353,
302,
29876,
29889,
13239,
29889,
29878,
15755,
29889,
8305,
29918,
16506,
29898,
25932,
29918,
1761,
29892,
9853,
29918,
4102,
29922,
5574,
29892,
7164,
29918,
1767,
29922,
29900,
1846,
13,
4706,
1067,
29879,
29918,
13168,
29918,
1761,
353,
518,
13168,
29918,
4351,
29889,
1482,
29918,
3298,
359,
4197,
2848,
2314,
363,
3309,
297,
429,
29918,
344,
3174,
29962,
13,
4706,
1067,
29879,
29918,
13168,
353,
302,
29876,
29889,
13239,
29889,
29878,
15755,
29889,
8305,
29918,
16506,
29898,
25932,
29918,
13168,
29918,
1761,
29892,
9853,
29918,
4102,
29922,
5574,
29892,
7164,
29918,
1767,
29922,
29896,
29897,
13,
13,
4706,
6128,
353,
1583,
29889,
29882,
631,
29918,
3977,
6119,
29898,
25932,
29918,
2080,
29892,
1067,
29879,
29918,
13168,
29897,
13,
4706,
6128,
353,
6128,
29889,
1493,
6278,
29896,
29892,
6128,
29889,
2311,
6278,
29896,
876,
15625,
29896,
29899,
25932,
29918,
13168,
29889,
1493,
6278,
29896,
8106,
10389,
580,
29962,
13,
13,
4706,
565,
1583,
29889,
26495,
29901,
13,
13,
9651,
396,
8147,
18002,
8158,
13,
9651,
18002,
29918,
20158,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
695,
893,
29892,
29871,
29900,
29892,
18002,
29918,
2248,
29897,
13,
9651,
3978,
29918,
20158,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
695,
893,
29892,
29871,
29900,
29892,
18002,
29918,
13492,
29918,
2248,
29897,
13,
9651,
18002,
29918,
13628,
353,
4842,
305,
29889,
18816,
29885,
3398,
29898,
1311,
29889,
5231,
29918,
18152,
457,
279,
29898,
12574,
29918,
20158,
29892,
18002,
29918,
20158,
8106,
29879,
802,
29872,
911,
580,
13,
9651,
396,
18002,
29918,
13628,
353,
4842,
305,
29889,
18816,
29885,
3398,
29898,
12574,
29918,
20158,
29889,
6948,
802,
29872,
911,
29898,
29896,
467,
29890,
4317,
29898,
5231,
29918,
20158,
29889,
6948,
802,
29872,
911,
6278,
29896,
8106,
29879,
802,
29872,
911,
3101,
13,
13,
9651,
396,
694,
3368,
4765,
19750,
13,
9651,
565,
1583,
29889,
5085,
29889,
3977,
6119,
1275,
376,
2151,
1115,
13,
18884,
694,
3368,
29918,
3332,
29918,
2003,
353,
1583,
29889,
3977,
6119,
29898,
1217,
3368,
29918,
4351,
29892,
694,
3368,
29918,
4351,
29918,
344,
3174,
29892,
694,
3368,
29918,
4351,
29918,
13168,
29897,
13,
9651,
1683,
29901,
13,
18884,
694,
3368,
29918,
4351,
29918,
1590,
353,
1583,
29889,
17987,
29881,
886,
29898,
1217,
3368,
29918,
4351,
29897,
13,
18884,
694,
3368,
29918,
3332,
29918,
2003,
353,
1583,
29889,
3977,
6119,
29898,
1217,
3368,
29918,
4351,
29918,
1590,
29892,
29871,
29896,
29899,
1217,
3368,
29918,
4351,
29918,
13168,
29897,
13,
9651,
694,
3368,
29918,
695,
893,
353,
694,
3368,
29918,
3332,
29918,
2003,
7503,
29892,
29871,
29900,
29892,
584,
29962,
13,
9651,
694,
3368,
29918,
25932,
29918,
6954,
353,
1583,
3032,
4282,
29918,
14834,
29918,
7165,
29898,
735,
29918,
344,
3174,
29892,
694,
3368,
29918,
695,
893,
29892,
1067,
893,
29892,
2984,
29918,
13168,
29892,
8178,
29918,
27736,
29897,
13,
9651,
694,
3368,
29918,
25932,
29918,
6954,
353,
1583,
29889,
1066,
29918,
1590,
29898,
1217,
3368,
29918,
25932,
29918,
6954,
29897,
13,
13,
9651,
396,
4559,
6694,
6455,
13,
9651,
3030,
29918,
29873,
4141,
29918,
11249,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
4703,
29918,
29873,
4141,
29892,
29871,
29900,
29892,
429,
29918,
11249,
29918,
2248,
29879,
29897,
13,
9651,
694,
3368,
29918,
25932,
29918,
6954,
29918,
11249,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
1217,
3368,
29918,
25932,
29918,
6954,
29892,
29871,
29900,
29892,
429,
29918,
11249,
29918,
2248,
29879,
29897,
13,
9651,
6128,
29918,
11249,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
29882,
631,
29892,
29871,
29900,
29892,
429,
29918,
11249,
29918,
2248,
29879,
29897,
13,
4706,
1683,
29901,
13,
9651,
18002,
29918,
13628,
353,
6213,
13,
13,
4706,
565,
1583,
29889,
26495,
29901,
13,
13,
9651,
1602,
29918,
3859,
353,
1583,
29889,
7099,
6119,
29889,
2344,
29918,
7099,
6119,
29918,
3859,
29898,
1217,
3368,
29918,
4351,
29892,
694,
3368,
29918,
25932,
29918,
6954,
29918,
11249,
29897,
13,
13,
9651,
21822,
29918,
4703,
29892,
17117,
903,
353,
1583,
29889,
7099,
6119,
29898,
4703,
29918,
29873,
4141,
29918,
11249,
7503,
29892,
8956,
29896,
1402,
694,
3368,
29918,
25932,
29918,
6954,
29918,
11249,
29892,
1602,
29918,
3859,
29892,
13,
462,
462,
18884,
2069,
29918,
517,
12360,
29922,
29882,
631,
29918,
11249,
29897,
13,
9651,
1574,
29918,
1272,
353,
6213,
13,
13,
9651,
396,
1152,
6410,
16287,
29889,
13,
9651,
565,
429,
29918,
11249,
29918,
2248,
29879,
338,
451,
6213,
29901,
13,
18884,
9853,
29889,
4703,
29918,
29873,
4141,
353,
3030,
29918,
29873,
4141,
29918,
11249,
13,
13,
4706,
1683,
29901,
13,
9651,
21822,
29918,
4703,
353,
6213,
13,
9651,
396,
8878,
14880,
260,
4141,
2729,
373,
6555,
537,
7115,
29889,
13,
9651,
1574,
29918,
29873,
4141,
29892,
1574,
29918,
2248,
29892,
903,
353,
1583,
3032,
4282,
29918,
1514,
29918,
29873,
4141,
29898,
29873,
4141,
29892,
1067,
893,
29892,
429,
29918,
344,
3174,
29892,
1583,
29889,
5085,
29889,
5080,
29918,
2311,
29892,
1583,
29889,
5085,
29889,
661,
9292,
29918,
3317,
29918,
29895,
29897,
13,
9651,
6555,
537,
29918,
344,
3174,
353,
518,
2435,
29898,
347,
29916,
29897,
363,
19282,
29916,
297,
1574,
29918,
2248,
29962,
13,
9651,
6555,
537,
29918,
2248,
353,
518,
2083,
29898,
25171,
537,
29918,
344,
3174,
7503,
29875,
2314,
363,
474,
297,
3464,
29898,
2435,
29898,
25171,
537,
29918,
344,
3174,
7240,
29896,
4638,
13,
9651,
1574,
29918,
2248,
353,
4842,
305,
29889,
4117,
29898,
1514,
29918,
2248,
29892,
29871,
29900,
29897,
13,
9651,
731,
5552,
29898,
16175,
29892,
525,
1514,
29918,
29873,
4141,
742,
1574,
29918,
29873,
4141,
29897,
13,
13,
9651,
1574,
29918,
29882,
631,
29918,
11249,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
29882,
631,
29892,
29871,
29900,
29892,
1574,
29918,
2248,
29897,
13,
13,
9651,
396,
2441,
1067,
29879,
2626,
13,
9651,
1067,
29879,
29918,
6954,
353,
1583,
3032,
4282,
29918,
14834,
29918,
7165,
29898,
735,
29918,
344,
3174,
29892,
1067,
893,
29897,
13,
9651,
1067,
29879,
29918,
6954,
353,
1583,
29889,
1066,
29918,
1590,
29898,
25932,
29918,
6954,
29897,
13,
9651,
1574,
29918,
25932,
29918,
6954,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
25932,
29918,
6954,
29892,
29871,
29900,
29892,
1574,
29918,
2248,
29897,
13,
13,
9651,
396,
15228,
9543,
1574,
3646,
13,
9651,
3030,
29918,
1514,
29918,
29873,
4141,
353,
4842,
305,
29889,
2248,
29918,
2622,
29898,
4703,
29918,
29873,
4141,
29892,
29871,
29900,
29892,
1574,
29918,
2248,
29897,
13,
9651,
731,
5552,
29898,
16175,
29892,
525,
4703,
29918,
1514,
29918,
29873,
4141,
742,
3030,
29918,
1514,
29918,
29873,
4141,
29897,
13,
9651,
731,
5552,
29898,
16175,
29892,
525,
1514,
29918,
344,
3174,
742,
6555,
537,
29918,
2248,
29897,
13,
13,
9651,
1574,
29918,
4703,
29918,
5426,
353,
1583,
3032,
11255,
29918,
21652,
29918,
16175,
29898,
16175,
29892,
1574,
29918,
25932,
29918,
6954,
29892,
1583,
29889,
3317,
29918,
2848,
29892,
2069,
29918,
517,
12360,
29922,
1514,
29918,
29882,
631,
29918,
11249,
29892,
13,
462,
462,
462,
3986,
1375,
29918,
2848,
29922,
29906,
29892,
22913,
29918,
2311,
29922,
1311,
29889,
915,
314,
29918,
2311,
29897,
13,
9651,
1574,
29918,
4703,
29918,
5426,
353,
518,
7345,
305,
29889,
4117,
29898,
1514,
29918,
4703,
29918,
5426,
29961,
25171,
537,
29918,
2248,
29961,
29875,
5387,
25171,
537,
29918,
2248,
29961,
29875,
29974,
29896,
20526,
29871,
29900,
29897,
363,
474,
297,
3464,
29898,
2435,
29898,
25171,
537,
29918,
344,
3174,
28166,
13,
13,
9651,
1574,
29918,
1272,
353,
1574,
29918,
4703,
29918,
5426,
13,
13,
4706,
736,
18002,
29918,
13628,
29892,
21822,
29918,
4703,
29892,
1574,
29918,
1272,
13,
2
] |
src/decisions/fridgedecision.py | jussike/kuappi | 0 | 185937 | from abstract import AbstractDecision
from common import TEMP
class FridgeDecision(AbstractDecision):
soft_hi_limit = 4.8
soft_low_limit = 3.3
hard_hi_limit = 7
hard_low_limit = 0
def get_decision(self, data, output_state=None):
temp = data[TEMP]
if temp > self.hard_hi_limit:
return True
elif temp < self.hard_low_limit:
return False
elif output_state is None:
return None
elif temp >= self.soft_hi_limit and not output_state:
return True
elif temp <= self.soft_low_limit and output_state:
return False
return None
| [
1,
515,
9846,
1053,
25513,
6185,
2459,
13,
3166,
3619,
1053,
17067,
3580,
13,
13,
1990,
383,
8605,
6185,
2459,
29898,
9118,
6185,
2459,
1125,
13,
1678,
4964,
29918,
2918,
29918,
13400,
353,
29871,
29946,
29889,
29947,
13,
1678,
4964,
29918,
677,
29918,
13400,
353,
29871,
29941,
29889,
29941,
13,
1678,
2898,
29918,
2918,
29918,
13400,
353,
29871,
29955,
13,
1678,
2898,
29918,
677,
29918,
13400,
353,
29871,
29900,
13,
13,
1678,
822,
679,
29918,
7099,
2459,
29898,
1311,
29892,
848,
29892,
1962,
29918,
3859,
29922,
8516,
1125,
13,
4706,
5694,
353,
848,
29961,
4330,
3580,
29962,
13,
4706,
565,
5694,
1405,
1583,
29889,
6800,
29918,
2918,
29918,
13400,
29901,
13,
9651,
736,
5852,
13,
4706,
25342,
5694,
529,
1583,
29889,
6800,
29918,
677,
29918,
13400,
29901,
13,
9651,
736,
7700,
13,
4706,
25342,
1962,
29918,
3859,
338,
6213,
29901,
13,
9651,
736,
6213,
13,
4706,
25342,
5694,
6736,
1583,
29889,
2695,
29918,
2918,
29918,
13400,
322,
451,
1962,
29918,
3859,
29901,
13,
9651,
736,
5852,
13,
4706,
25342,
5694,
5277,
1583,
29889,
2695,
29918,
677,
29918,
13400,
322,
1962,
29918,
3859,
29901,
13,
9651,
736,
7700,
13,
4706,
736,
6213,
13,
2
] |
Prediction.py | khayam-hafezi/CRNN-keras-persian | 0 | 3506 | <reponame>khayam-hafezi/CRNN-keras-persian
import cv2
import itertools, os, time
import numpy as np
from Model import get_Model
from parameter import letters
import argparse
from keras import backend as K
K.set_learning_phase(0)
Region = {"A": "서울 ", "B": "경기 ", "C": "인천 ", "D": "강원 ", "E": "충남 ", "F": "대전 ",
"G": "충북 ", "H": "부산 ", "I": "울산 ", "J": "대구 ", "K": "경북 ", "L": "경남 ",
"M": "전남 ", "N": "광주 ", "O": "전북 ", "P": "제주 "}
Hangul = {"dk": "아", "dj": "어", "dh": "오", "dn": "우", "qk": "바", "qj": "버", "qh": "보", "qn": "부",
"ek": "다", "ej": "더", "eh": "도", "en": "두", "rk": "가", "rj": "거", "rh": "고", "rn": "구",
"wk": "자", "wj": "저", "wh": "조", "wn": "주", "ak": "마", "aj": "머", "ah": "모", "an": "무",
"sk": "나", "sj": "너", "sh": "노", "sn": "누", "fk": "라", "fj": "러", "fh": "로", "fn": "루",
"tk": "사", "tj": "서", "th": "소", "tn": "수", "gj": "허"}
def decode_label(out):
# out : (1, 32, 42)
out_best = list(np.argmax(out[0, 2:], axis=1)) # get max index -> len = 32
out_best = [k for k, g in itertools.groupby(out_best)] # remove overlap value
outstr = ''
for i in out_best:
if i < len(letters):
outstr += letters[i]
return outstr
def label_to_hangul(label): # eng -> hangul
region = label[0]
two_num = label[1:3]
hangul = label[3:5]
four_num = label[5:]
try:
region = Region[region] if region != 'Z' else ''
except:
pass
try:
hangul = Hangul[hangul]
except:
pass
return region + two_num + hangul + four_num
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--weight", help="weight file directory",
type=str, default="models/weights.best.hdf5")
parser.add_argument("-t", "--test_img", help="Test image directory",
type=str, default="./DB/test/")
args = parser.parse_args()
# Get CRNN model
model = get_Model(training=False)
try:
model.load_weights(args.weight)
print("...Previous weight data...")
except:
raise Exception("No weight file!")
test_dir =args.test_img
test_imgs = os.listdir(args.test_img)
total = 0
acc = 0
letter_total = 0
letter_acc = 0
start = time.time()
for test_img in test_imgs:
img = cv2.imread(test_dir + test_img, cv2.IMREAD_GRAYSCALE)
img_pred = img.astype(np.float32)
img_pred = cv2.resize(img_pred, (128, 64))
img_pred = (img_pred / 255.0) * 2.0 - 1.0
img_pred = img_pred.T
img_pred = np.expand_dims(img_pred, axis=-1)
img_pred = np.expand_dims(img_pred, axis=0)
net_out_value = model.predict(img_pred)
pred_texts = decode_label(net_out_value)
for i in range(min(len(pred_texts), len(test_img[0:-4]))):
if pred_texts[i] == test_img[i]:
letter_acc += 1
letter_total += max(len(pred_texts), len(test_img[0:-4]))
predOk = "True"
if pred_texts == test_img[0:-4]:
acc += 1
else:
predOk = "False"
total += 1
# print('Predicted: %s / True: %s / net_out_value: %s / ' % (label_to_hangul(pred_texts), label_to_hangul(test_img[0:-4])))
print('Predicted: %s / True: %s / predOk: %s ' % (pred_texts, test_img[0:-4], predOk ))
# cv2.rectangle(img, (0,0), (150, 30), (0,0,0), -1)
# cv2.putText(img, pred_texts, (5, 20), cv2.FONT_HERSHEY_SIMPLEX, 0.8, (255,255,255),2)
#cv2.imshow("q", img)
#if cv2.waitKey(0) == 27:
# break
#cv2.destroyAllWindows()
end = time.time()
total_time = (end - start)
print("Time : ",total_time / total)
print("ACC : ", acc / total)
print("letter ACC : ", letter_acc / letter_total)
| [
1,
529,
276,
1112,
420,
29958,
15339,
388,
314,
29899,
2350,
1725,
2526,
29914,
11341,
10262,
29899,
3946,
294,
29899,
6774,
713,
13,
5215,
13850,
29906,
13,
5215,
4256,
8504,
29892,
2897,
29892,
931,
13,
5215,
12655,
408,
7442,
13,
3166,
8125,
1053,
679,
29918,
3195,
13,
3166,
3443,
1053,
8721,
13,
5215,
1852,
5510,
13,
3166,
13023,
294,
1053,
14998,
408,
476,
13,
29968,
29889,
842,
29918,
21891,
29918,
21646,
29898,
29900,
29897,
13,
13,
18457,
353,
8853,
29909,
1115,
376,
31093,
239,
157,
187,
9162,
376,
29933,
1115,
376,
31378,
30827,
9162,
376,
29907,
1115,
376,
30918,
31563,
9162,
376,
29928,
1115,
376,
31774,
31198,
9162,
376,
29923,
1115,
376,
239,
185,
172,
31754,
9162,
376,
29943,
1115,
376,
30890,
31170,
9162,
13,
3986,
376,
29954,
1115,
376,
239,
185,
172,
238,
185,
132,
9162,
376,
29950,
1115,
376,
31279,
31458,
9162,
376,
29902,
1115,
376,
239,
157,
187,
31458,
9162,
376,
29967,
1115,
376,
30890,
31231,
9162,
376,
29968,
1115,
376,
31378,
238,
185,
132,
9162,
376,
29931,
1115,
376,
31378,
31754,
9162,
13,
3986,
376,
29924,
1115,
376,
31170,
31754,
9162,
376,
29940,
1115,
376,
237,
183,
148,
30981,
9162,
376,
29949,
1115,
376,
31170,
238,
185,
132,
9162,
376,
29925,
1115,
376,
31306,
30981,
376,
29913,
13,
29950,
574,
352,
353,
8853,
8181,
1115,
376,
30860,
613,
376,
19776,
1115,
376,
31129,
613,
376,
12744,
1115,
376,
31346,
613,
376,
5200,
1115,
376,
31327,
613,
376,
29939,
29895,
1115,
376,
31963,
613,
376,
29939,
29926,
1115,
376,
238,
181,
135,
613,
376,
29939,
29882,
1115,
376,
31199,
613,
376,
29939,
29876,
1115,
376,
31279,
613,
13,
3986,
376,
1416,
1115,
376,
30709,
613,
376,
10337,
1115,
376,
238,
144,
151,
613,
376,
14797,
1115,
376,
31136,
613,
376,
264,
1115,
376,
238,
148,
147,
613,
376,
29878,
29895,
1115,
376,
30903,
613,
376,
29878,
29926,
1115,
376,
237,
180,
179,
613,
376,
19046,
1115,
376,
31137,
613,
376,
27539,
1115,
376,
31231,
613,
13,
3986,
376,
29893,
29895,
1115,
376,
31013,
613,
376,
29893,
29926,
1115,
376,
239,
163,
131,
613,
376,
1332,
1115,
376,
31408,
613,
376,
1233,
1115,
376,
30981,
613,
376,
557,
1115,
376,
31417,
613,
376,
1175,
1115,
376,
238,
171,
187,
613,
376,
801,
1115,
376,
31962,
613,
376,
273,
1115,
376,
31716,
613,
13,
3986,
376,
808,
1115,
376,
31207,
613,
376,
29879,
29926,
1115,
376,
238,
135,
139,
613,
376,
845,
1115,
376,
238,
136,
187,
613,
376,
16586,
1115,
376,
238,
139,
135,
613,
376,
29888,
29895,
1115,
376,
31197,
613,
376,
29888,
29926,
1115,
376,
238,
162,
175,
613,
376,
29888,
29882,
1115,
376,
30906,
613,
376,
9144,
1115,
376,
238,
166,
171,
613,
13,
3986,
376,
11178,
1115,
376,
30791,
613,
376,
29873,
29926,
1115,
376,
31093,
613,
376,
386,
1115,
376,
31189,
613,
376,
6277,
1115,
376,
30970,
613,
376,
29887,
29926,
1115,
376,
240,
154,
139,
9092,
13,
13,
1753,
21822,
29918,
1643,
29898,
449,
1125,
13,
1678,
396,
714,
584,
313,
29896,
29892,
29871,
29941,
29906,
29892,
29871,
29946,
29906,
29897,
13,
1678,
714,
29918,
13318,
353,
1051,
29898,
9302,
29889,
1191,
3317,
29898,
449,
29961,
29900,
29892,
29871,
29906,
29901,
1402,
9685,
29922,
29896,
876,
29871,
396,
679,
4236,
2380,
1599,
7431,
353,
29871,
29941,
29906,
13,
1678,
714,
29918,
13318,
353,
518,
29895,
363,
413,
29892,
330,
297,
4256,
8504,
29889,
27789,
29898,
449,
29918,
13318,
4638,
29871,
396,
3349,
25457,
995,
13,
1678,
714,
710,
353,
6629,
13,
1678,
363,
474,
297,
714,
29918,
13318,
29901,
13,
4706,
565,
474,
529,
7431,
29898,
1026,
2153,
1125,
13,
9651,
714,
710,
4619,
8721,
29961,
29875,
29962,
13,
1678,
736,
714,
710,
13,
13,
13,
1753,
3858,
29918,
517,
29918,
11895,
352,
29898,
1643,
1125,
29871,
396,
3033,
1599,
13958,
352,
13,
1678,
5120,
353,
3858,
29961,
29900,
29962,
13,
1678,
1023,
29918,
1949,
353,
3858,
29961,
29896,
29901,
29941,
29962,
13,
1678,
13958,
352,
353,
3858,
29961,
29941,
29901,
29945,
29962,
13,
1678,
3023,
29918,
1949,
353,
3858,
29961,
29945,
17531,
13,
13,
1678,
1018,
29901,
13,
4706,
5120,
353,
11069,
29961,
12803,
29962,
565,
5120,
2804,
525,
29999,
29915,
1683,
6629,
13,
1678,
5174,
29901,
13,
4706,
1209,
13,
1678,
1018,
29901,
13,
4706,
13958,
352,
353,
379,
574,
352,
29961,
11895,
352,
29962,
13,
1678,
5174,
29901,
13,
4706,
1209,
13,
1678,
736,
5120,
718,
1023,
29918,
1949,
718,
13958,
352,
718,
3023,
29918,
1949,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29893,
613,
376,
489,
7915,
613,
1371,
543,
7915,
934,
3884,
613,
13,
462,
1678,
1134,
29922,
710,
29892,
2322,
543,
9794,
29914,
705,
5861,
29889,
13318,
29889,
29882,
2176,
29945,
1159,
13,
16680,
29889,
1202,
29918,
23516,
703,
29899,
29873,
613,
376,
489,
1688,
29918,
2492,
613,
1371,
543,
3057,
1967,
3884,
613,
13,
462,
1678,
1134,
29922,
710,
29892,
2322,
543,
6904,
4051,
29914,
1688,
29914,
1159,
13,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
29937,
3617,
15600,
10262,
1904,
13,
4299,
353,
679,
29918,
3195,
29898,
26495,
29922,
8824,
29897,
13,
13,
2202,
29901,
13,
1678,
1904,
29889,
1359,
29918,
705,
5861,
29898,
5085,
29889,
7915,
29897,
13,
1678,
1596,
703,
856,
6572,
2366,
7688,
848,
856,
1159,
13,
19499,
29901,
13,
1678,
12020,
8960,
703,
3782,
7688,
934,
29991,
1159,
13,
13,
13,
1688,
29918,
3972,
353,
5085,
29889,
1688,
29918,
2492,
13,
1688,
29918,
2492,
29879,
353,
2897,
29889,
1761,
3972,
29898,
5085,
29889,
1688,
29918,
2492,
29897,
13,
7827,
353,
29871,
29900,
13,
5753,
353,
29871,
29900,
13,
15670,
29918,
7827,
353,
29871,
29900,
13,
15670,
29918,
5753,
353,
29871,
29900,
13,
2962,
353,
931,
29889,
2230,
580,
13,
1454,
1243,
29918,
2492,
297,
1243,
29918,
2492,
29879,
29901,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
1688,
29918,
3972,
718,
1243,
29918,
2492,
29892,
13850,
29906,
29889,
7833,
16310,
29918,
29954,
4717,
21554,
5454,
1307,
29897,
13,
13,
1678,
10153,
29918,
11965,
353,
10153,
29889,
579,
668,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
1678,
10153,
29918,
11965,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29918,
11965,
29892,
313,
29896,
29906,
29947,
29892,
29871,
29953,
29946,
876,
13,
1678,
10153,
29918,
11965,
353,
313,
2492,
29918,
11965,
847,
29871,
29906,
29945,
29945,
29889,
29900,
29897,
334,
29871,
29906,
29889,
29900,
448,
29871,
29896,
29889,
29900,
13,
1678,
10153,
29918,
11965,
353,
10153,
29918,
11965,
29889,
29911,
13,
1678,
10153,
29918,
11965,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
2492,
29918,
11965,
29892,
9685,
10457,
29896,
29897,
13,
1678,
10153,
29918,
11965,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
2492,
29918,
11965,
29892,
9685,
29922,
29900,
29897,
13,
13,
1678,
7787,
29918,
449,
29918,
1767,
353,
1904,
29889,
27711,
29898,
2492,
29918,
11965,
29897,
13,
13,
1678,
4450,
29918,
726,
29879,
353,
21822,
29918,
1643,
29898,
1212,
29918,
449,
29918,
1767,
29897,
13,
13,
1678,
363,
474,
297,
3464,
29898,
1195,
29898,
2435,
29898,
11965,
29918,
726,
29879,
511,
7431,
29898,
1688,
29918,
2492,
29961,
29900,
13018,
29946,
12622,
1125,
13,
4706,
565,
4450,
29918,
726,
29879,
29961,
29875,
29962,
1275,
1243,
29918,
2492,
29961,
29875,
5387,
13,
9651,
5497,
29918,
5753,
4619,
29871,
29896,
13,
1678,
5497,
29918,
7827,
4619,
4236,
29898,
2435,
29898,
11965,
29918,
726,
29879,
511,
7431,
29898,
1688,
29918,
2492,
29961,
29900,
13018,
29946,
12622,
13,
1678,
4450,
20434,
353,
376,
5574,
29908,
13,
1678,
565,
4450,
29918,
726,
29879,
1275,
1243,
29918,
2492,
29961,
29900,
13018,
29946,
5387,
13,
4706,
1035,
4619,
29871,
29896,
13,
1678,
1683,
29901,
13,
4706,
4450,
20434,
353,
376,
8824,
29908,
13,
1678,
3001,
4619,
29871,
29896,
13,
1678,
396,
1596,
877,
23084,
18186,
29901,
1273,
29879,
29871,
847,
29871,
5852,
29901,
1273,
29879,
847,
7787,
29918,
449,
29918,
1767,
29901,
1273,
29879,
847,
525,
1273,
313,
1643,
29918,
517,
29918,
11895,
352,
29898,
11965,
29918,
726,
29879,
511,
3858,
29918,
517,
29918,
11895,
352,
29898,
1688,
29918,
2492,
29961,
29900,
13018,
29946,
29962,
4961,
13,
1678,
1596,
877,
23084,
18186,
29901,
1273,
29879,
29871,
847,
29871,
5852,
29901,
1273,
29879,
847,
4450,
20434,
29901,
1273,
29879,
525,
1273,
313,
11965,
29918,
726,
29879,
29892,
1243,
29918,
2492,
29961,
29900,
13018,
29946,
1402,
4450,
20434,
29871,
876,
13,
268,
13,
1678,
396,
13850,
29906,
29889,
1621,
2521,
29898,
2492,
29892,
313,
29900,
29892,
29900,
511,
313,
29896,
29945,
29900,
29892,
29871,
29941,
29900,
511,
313,
29900,
29892,
29900,
29892,
29900,
511,
448,
29896,
29897,
13,
1678,
396,
13850,
29906,
29889,
649,
1626,
29898,
2492,
29892,
4450,
29918,
726,
29879,
29892,
313,
29945,
29892,
29871,
29906,
29900,
511,
13850,
29906,
29889,
29943,
1164,
29911,
29918,
4448,
7068,
13282,
29918,
5425,
3580,
1307,
29990,
29892,
29871,
29900,
29889,
29947,
29892,
313,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
511,
29906,
29897,
13,
13,
1678,
396,
11023,
29906,
29889,
326,
4294,
703,
29939,
613,
10153,
29897,
13,
1678,
396,
361,
13850,
29906,
29889,
10685,
2558,
29898,
29900,
29897,
1275,
29871,
29906,
29955,
29901,
13,
1678,
396,
259,
2867,
13,
1678,
396,
11023,
29906,
29889,
20524,
3596,
7685,
580,
13,
13,
355,
353,
931,
29889,
2230,
580,
13,
7827,
29918,
2230,
353,
313,
355,
448,
1369,
29897,
13,
2158,
703,
2481,
584,
9162,
7827,
29918,
2230,
847,
3001,
29897,
13,
2158,
703,
2477,
29907,
584,
9162,
1035,
847,
3001,
29897,
13,
2158,
703,
15670,
319,
4174,
584,
9162,
5497,
29918,
5753,
847,
5497,
29918,
7827,
29897,
13,
2
] |
02_oop/01_classes_and_objects/08_access_modifiers_public.py | doanthanhnhan/learningPY | 1 | 99253 | <reponame>doanthanhnhan/learningPY
# Public Attributes
class Employee:
def __init__(self, ID, salary):
# all properties are public
self.ID = ID
self.salary = salary
def displayID(self):
print("ID:", self.ID)
Steve = Employee(3789, 2500)
Steve.displayID()
print(Steve.salary) | [
1,
529,
276,
1112,
420,
29958,
1867,
9716,
273,
3123,
5403,
29914,
21891,
20055,
13,
29937,
5236,
6212,
5026,
13,
1990,
24654,
29901,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
3553,
29892,
4497,
653,
1125,
13,
1678,
396,
599,
4426,
526,
970,
13,
1678,
1583,
29889,
1367,
353,
3553,
13,
1678,
1583,
29889,
19585,
653,
353,
4497,
653,
13,
13,
29871,
822,
2479,
1367,
29898,
1311,
1125,
13,
1678,
1596,
703,
1367,
29901,
613,
1583,
29889,
1367,
29897,
13,
13,
13,
7789,
345,
353,
24654,
29898,
29941,
29955,
29947,
29929,
29892,
29871,
29906,
29945,
29900,
29900,
29897,
13,
7789,
345,
29889,
4990,
1367,
580,
13,
2158,
29898,
7789,
345,
29889,
19585,
653,
29897,
2
] |
django-rgd-3d/rgd_3d/models/__init__.py | ResonantGeoData/ResonantGeoData | 40 | 170766 | from .point_cloud import PointCloud, PointCloudMeta, PointCloudSpatial # noqa
| [
1,
515,
869,
3149,
29918,
9274,
1053,
8984,
20442,
29892,
8984,
20442,
19346,
29892,
8984,
20442,
29903,
5031,
616,
29871,
396,
694,
25621,
13,
2
] |
tests/testguid.py | grodansparadis/pyvscpws1 | 1 | 101575 | import sys
from ctypes import *
sys.path.append('../')
from vscp import *
# GUID conversion
gg = vscp.guid()
print("After creation:", gg.getAsString())
gg.setFromString("00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF")
print("guid = ", gg.getAsString())
gg.reverse()
print("reverse guid = ", gg.getAsString())
print("guid[2] = ", gg.getAt(2), format("%02X" % gg.getAt(2)))
gg.setAt(2,33)
print("setat(2,33) guid[2] = ", gg.getAt(2), format("%02X" % gg.getAt(2)))
print("LSB = ", gg.getLSB(), format("%02X" % gg.getLSB()))
gg.setLSB(12)
print("setLSB(12) LSB = ", gg.getLSB(), format("%02X" % gg.getLSB()))
print("setLSB(12) LSB = ", gg.getNickname(), format("%02X" % gg.getNickname()))
print("Nickname = ", format("%02X" % gg.getNickname()), "Nickname ID", format("%04X" % gg.getNicknameID()))
gg.setNickname(99)
print("After setNickname (99) - Nickname = ", format("%02X" % gg.getNickname()), "Nickname ID", format("%04X" % gg.getNicknameID()))
gg.setNicknameID(0xaa55)
print("After setNicknameID (0xAA55) - Nickname = ", format("%02X" % gg.getNickname()), "Nickname ID", format("%04X" % gg.getNicknameID()))
gg.clear()
print("After clear() guid = ", gg.getAsString())
print("isNULL() = ", gg.isNULL())
gg.setNicknameID(0xaa55)
print("(False) isNULL() = ", gg.isNULL())
print("(False) isSame() = ", \
gg.isSame( gg.getArrayFromString("99:99:99:00:00:00:00:00:00:00:00:10:10:10:10:00")))
print("guid = ", gg.getAsString())
print("(True) isSame() = ", \
gg.isSame( gg.getArrayFromString("00:00:00:00:00:00:00:00:00:00:00:00:00:00:AA:55")))
a = vscp.guidarray(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0xAA,0x55)
b = vscp.guidarray(11,0,0,0,0,0,0,0,0,0,0,0,0,0,0xAA,0x55)
print("(True) isSame() = ", gg.isSame(a))
print("(False) isSame() = ", gg.isSame(b))
| [
1,
1053,
10876,
13,
3166,
274,
8768,
1053,
334,
13,
13,
9675,
29889,
2084,
29889,
4397,
877,
6995,
1495,
13,
3166,
325,
1557,
29886,
1053,
334,
13,
13,
29937,
402,
11150,
11301,
13,
1505,
353,
325,
1557,
29886,
29889,
2543,
333,
580,
13,
2158,
703,
13555,
11265,
29901,
613,
20775,
29889,
657,
2887,
1231,
3101,
13,
13,
1505,
29889,
842,
4591,
1231,
703,
29900,
29900,
29901,
29896,
29896,
29901,
29906,
29906,
29901,
29941,
29941,
29901,
29946,
29946,
29901,
29945,
29945,
29901,
29953,
29953,
29901,
29955,
29955,
29901,
29947,
29947,
29901,
29929,
29929,
29901,
6344,
29901,
14388,
29901,
4174,
29901,
7858,
29901,
17896,
29901,
4198,
1159,
13,
2158,
703,
2543,
333,
353,
9162,
20775,
29889,
657,
2887,
1231,
3101,
13,
13,
1505,
29889,
24244,
580,
13,
2158,
703,
24244,
16605,
353,
9162,
20775,
29889,
657,
2887,
1231,
3101,
13,
2158,
703,
2543,
333,
29961,
29906,
29962,
353,
9162,
20775,
29889,
657,
4178,
29898,
29906,
511,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
4178,
29898,
29906,
4961,
13,
1505,
29889,
842,
4178,
29898,
29906,
29892,
29941,
29941,
29897,
13,
2158,
703,
842,
271,
29898,
29906,
29892,
29941,
29941,
29897,
16605,
29961,
29906,
29962,
353,
9162,
20775,
29889,
657,
4178,
29898,
29906,
511,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
4178,
29898,
29906,
4961,
13,
13,
2158,
703,
29931,
1744,
353,
9162,
20775,
29889,
657,
29931,
1744,
3285,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
29931,
1744,
22130,
13,
1505,
29889,
842,
29931,
1744,
29898,
29896,
29906,
29897,
13,
2158,
703,
842,
29931,
1744,
29898,
29896,
29906,
29897,
365,
1744,
353,
9162,
20775,
29889,
657,
29931,
1744,
3285,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
29931,
1744,
22130,
13,
13,
2158,
703,
842,
29931,
1744,
29898,
29896,
29906,
29897,
365,
1744,
353,
9162,
20775,
29889,
657,
29940,
860,
978,
3285,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
29940,
860,
978,
22130,
13,
13,
2158,
703,
29940,
860,
978,
353,
9162,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
29940,
860,
978,
25739,
376,
29940,
860,
978,
3553,
613,
3402,
11702,
29900,
29946,
29990,
29908,
1273,
20775,
29889,
657,
29940,
860,
978,
1367,
22130,
13,
13,
1505,
29889,
842,
29940,
860,
978,
29898,
29929,
29929,
29897,
13,
2158,
703,
13555,
731,
29940,
860,
978,
313,
29929,
29929,
29897,
448,
13853,
978,
353,
9162,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
29940,
860,
978,
25739,
376,
29940,
860,
978,
3553,
613,
3402,
11702,
29900,
29946,
29990,
29908,
1273,
20775,
29889,
657,
29940,
860,
978,
1367,
22130,
13,
13,
1505,
29889,
842,
29940,
860,
978,
1367,
29898,
29900,
29916,
7340,
29945,
29945,
29897,
13,
2158,
703,
13555,
731,
29940,
860,
978,
1367,
313,
29900,
29916,
6344,
29945,
29945,
29897,
448,
13853,
978,
353,
9162,
3402,
11702,
29900,
29906,
29990,
29908,
1273,
20775,
29889,
657,
29940,
860,
978,
25739,
376,
29940,
860,
978,
3553,
613,
3402,
11702,
29900,
29946,
29990,
29908,
1273,
20775,
29889,
657,
29940,
860,
978,
1367,
22130,
13,
13,
1505,
29889,
8551,
580,
13,
2158,
703,
13555,
2821,
580,
16605,
353,
9162,
20775,
29889,
657,
2887,
1231,
3101,
13,
2158,
703,
275,
10074,
580,
353,
9162,
20775,
29889,
275,
10074,
3101,
13,
1505,
29889,
842,
29940,
860,
978,
1367,
29898,
29900,
29916,
7340,
29945,
29945,
29897,
13,
2158,
703,
29898,
8824,
29897,
338,
10074,
580,
353,
9162,
20775,
29889,
275,
10074,
3101,
13,
13,
2158,
703,
29898,
8824,
29897,
338,
29903,
420,
580,
353,
9162,
320,
13,
1678,
20775,
29889,
275,
29903,
420,
29898,
20775,
29889,
657,
2588,
4591,
1231,
703,
29929,
29929,
29901,
29929,
29929,
29901,
29929,
29929,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29896,
29900,
29901,
29896,
29900,
29901,
29896,
29900,
29901,
29896,
29900,
29901,
29900,
29900,
29908,
4961,
13,
13,
2158,
703,
2543,
333,
353,
9162,
20775,
29889,
657,
2887,
1231,
3101,
13,
2158,
703,
29898,
5574,
29897,
338,
29903,
420,
580,
353,
9162,
320,
13,
1678,
20775,
29889,
275,
29903,
420,
29898,
20775,
29889,
657,
2588,
4591,
1231,
703,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29901,
6344,
29901,
29945,
29945,
29908,
4961,
13,
13,
29874,
353,
325,
1557,
29886,
29889,
2543,
333,
2378,
29898,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29916,
6344,
29892,
29900,
29916,
29945,
29945,
29897,
13,
29890,
353,
325,
1557,
29886,
29889,
2543,
333,
2378,
29898,
29896,
29896,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29892,
29900,
29916,
6344,
29892,
29900,
29916,
29945,
29945,
29897,
13,
13,
2158,
703,
29898,
5574,
29897,
338,
29903,
420,
580,
353,
9162,
20775,
29889,
275,
29903,
420,
29898,
29874,
876,
13,
2158,
703,
29898,
8824,
29897,
338,
29903,
420,
580,
353,
9162,
20775,
29889,
275,
29903,
420,
29898,
29890,
876,
13,
13,
13,
2
] |
straxen/mongo_storage.py | ahiguera-mx/straxen | 0 | 133896 | <reponame>ahiguera-mx/straxen
import os
import tempfile
from datetime import datetime
from warnings import warn
import pytz
from strax import exporter, to_str_tuple
import gridfs
from tqdm import tqdm
from shutil import move
import hashlib
from pymongo.collection import Collection as pymongo_collection
import utilix
from straxen import uconfig
export, __all__ = exporter()
@export
class GridFsInterface:
"""
Base class to upload/download the files to a database using GridFS
for PyMongo:
https://pymongo.readthedocs.io/en/stable/api/gridfs/index.html#module-gridfs
This class does the basic shared initiation of the downloader and
uploader classes.
"""
def __init__(self,
readonly=True,
file_database='files',
config_identifier='config_name',
collection=None,
_test_on_init=False,
):
"""
GridFsInterface
:param readonly: bool, can one read or also write to the
database.
:param file_database: str, name of the database. Default should
not be changed.
:param config_identifier: str, header of the files that are
saved in Gridfs
:param collection: pymongo.collection.Collection, (Optional)
PyMongo DataName Collection to bypass normal initiation
using utilix. Should be an object of the form:
pymongo.MongoClient(..).DATABASE_NAME.COLLECTION_NAME
:param _test_on_init: Test if the collection is empty on init
(only deactivate if you are using a brand new database)!
"""
if collection is None:
if not readonly:
# We want admin access to start writing data!
mongo_url = uconfig.get('rundb_admin', 'mongo_rdb_url')
mongo_user = uconfig.get('rundb_admin', 'mongo_rdb_username')
mongo_password = uconfig.get('rundb_admin', 'mongo_rdb_password')
else:
# We can safely use the Utilix defaults
mongo_url = mongo_user = mongo_password = None
# If no collection arg is passed, it defaults to the 'files'
# collection, see for more details:
# https://github.com/XENONnT/utilix/blob/master/utilix/rundb.py
mongo_kwargs = {
'url': mongo_url,
'user': mongo_user,
'password': <PASSWORD>,
'database': file_database,
}
# We can safely hard-code the collection as that is always
# the same with GridFS.
collection = utilix.rundb.xent_collection(
**mongo_kwargs,
collection='fs.files')
else:
# Check the user input is fine for what we want to do.
if not isinstance(collection, pymongo_collection):
raise ValueError('Provide PyMongo collection (see docstring)!')
if file_database is not None:
raise ValueError("Already provided a collection!")
# Set collection and make sure it can at least do a 'find' operation
self.collection = collection
if _test_on_init:
self.test_find()
# This is the identifier under which we store the files.
self.config_identifier = config_identifier
# The GridFS used in this database
self.grid_fs = gridfs.GridFS(collection.database)
def get_query_config(self, config):
"""
Generate identifier to query against. This is just the configs
name.
:param config: str, name of the file of interest
:return: dict, that can be used in queries
"""
return {self.config_identifier: config}
def document_format(self, config):
"""
Format of the document to upload
:param config: str, name of the file of interest
:return: dict, that will be used to add the document
"""
doc = self.get_query_config(config)
doc.update({
'added': datetime.now(tz=pytz.utc),
})
return doc
def config_exists(self, config):
"""
Quick check if this config is already saved in the collection
:param config: str, name of the file of interest
:return: bool, is this config name stored in the database
"""
query = self.get_query_config(config)
return self.collection.count_documents(query) > 0
def md5_stored(self, abs_path):
"""
NB: RAM intensive operation!
Carefully compare if the MD5 identifier is the same as the file
as stored under abs_path.
:param abs_path: str, absolute path to the file name
:return: bool, returns if the exact same file is already stored
in the database
"""
if not os.path.exists(abs_path):
# A file that does not exist does not have the same MD5
return False
query = {'md5': self.compute_md5(abs_path)}
return self.collection.count_documents(query) > 0
def test_find(self):
"""
Test the connection to the self.collection to see if we can
perform a collection.find operation.
"""
if self.collection.find_one(projection="_id") is None:
raise ConnectionError('Could not find any data in this collection')
def list_files(self):
"""
Get a complete list of files that are stored in the database
:return: list, list of the names of the items stored in this
database
"""
return [doc[self.config_identifier]
for doc in
self.collection.find(
projection=
{self.config_identifier: 1})
if self.config_identifier in doc
]
@staticmethod
def compute_md5(abs_path):
"""
NB: RAM intensive operation!
Get the md5 hash of a file stored under abs_path
:param abs_path: str, absolute path to a file
:return: str, the md5-hash of the requested file
"""
# This function is copied from:
# stackoverflow.com/questions/3431825/generating-an-md5-checksum-of-a-file
if not os.path.exists(abs_path):
# if there is no file, there is nothing to compute
return ""
# Also, disable all the Use of insecure MD2, MD4, MD5, or SHA1
# hash function violations in this function.
# disable bandit
hash_md5 = hashlib.md5()
with open(abs_path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
@export
class MongoUploader(GridFsInterface):
"""
Class to upload files to GridFs
"""
def __init__(self, readonly=False, *args, **kwargs):
# Same as parent. Just check the readonly_argument
if readonly:
raise PermissionError(
"How can you upload if you want to operate in readonly?")
super().__init__(*args, readonly=readonly, **kwargs)
def upload_from_dict(self, file_path_dict):
"""
Upload all files in the dictionary to the database.
:param file_path_dict: dict, dictionary of paths to upload. The
dict should be of the format:
file_path_dict = {'config_name': '/the_config_path', ...}
:return: None
"""
if not isinstance(file_path_dict, dict):
raise ValueError(f'file_path_dict must be dict of form '
f'"dict(NAME=ABSOLUTE_PATH,...)". Got '
f'{type(file_path_dict)} instead')
for config, abs_path in tqdm(file_path_dict.items()):
# We need to do this expensive check here. It is not enough
# to just check that the file is stored under the
# 'config_identifier'. What if the file changed? Then we
# want to upload a new file! Otherwise we could have done
# the self.config_exists-query. If it turns out we have the
# exact same file, forget about uploading it.
if self.config_exists(config) and self.md5_stored(abs_path):
continue
else:
# This means we are going to upload the file because its
# not stored yet.
try:
self.upload_single(config, abs_path)
except (CouldNotLoadError, ConfigTooLargeError):
# Perhaps we should fail then?
warn(f'Cannot upload {config}')
def upload_single(self, config, abs_path):
"""
Upload a single file to gridfs
:param config: str, the name under which this file should be
stored
:param abs_path: str, the absolute path of the file
"""
doc = self.document_format(config)
doc['md5'] = self.compute_md5(abs_path)
if not os.path.exists(abs_path):
raise CouldNotLoadError(f'{abs_path} does not exits')
print(f'uploading {config}')
with open(abs_path, 'rb') as file:
self.grid_fs.put(file, **doc)
@export
class MongoDownloader(GridFsInterface):
"""
Class to download files from GridFs
"""
def __init__(self,
store_files_at=None,
*args, **kwargs):
super().__init__(*args, **kwargs)
# We are going to set a place where to store the files. It's
# either specified by the user or we use these defaults:
if store_files_at is None:
store_files_at = ('/tmp/straxen_resource_cache/',
'/dali/lgrandi/strax/resource_cache',
'./resource_cache',
)
elif not isinstance(store_files_at, (tuple, str, list)):
raise ValueError(f'{store_files_at} should be tuple of paths!')
elif isinstance(store_files_at, str):
store_files_at = to_str_tuple(store_files_at)
self.storage_options = store_files_at
def download_single(self,
config_name: str,
human_readable_file_name=False):
"""
Download the config_name if it exists
:param config_name: str, the name under which the file is stored
:param human_readable_file_name: bool, store the file also under
it's human readable name. It is better not to use this as
the user might not know if the version of the file is the
latest.
:return: str, the absolute path of the file requested
"""
if self.config_exists(config_name):
# Query by name
query = self.get_query_config(config_name)
try:
# This could return multiple since we upload files if
# they have changed again! Therefore just take the last.
fs_object = self.grid_fs.get_last_version(**query)
except gridfs.NoFile as e:
raise CouldNotLoadError(
f'{config_name} cannot be downloaded from GridFs') from e
# Ok, so we can open it. We will store the file under it's
# md5-hash as that allows to easily compare if we already
# have the correct file.
if human_readable_file_name:
target_file_name = config_name
else:
target_file_name = fs_object.md5
for cache_folder in self.storage_options:
possible_path = os.path.join(cache_folder, target_file_name)
if os.path.exists(possible_path):
# Great! This already exists. Let's just return
# where it is stored.
return possible_path
# Apparently the file does not exist, let's find a place to
# store the file and download it.
store_files_at = self._check_store_files_at(self.storage_options)
destination_path = os.path.join(store_files_at, target_file_name)
# Let's open a temporary directory, download the file, and
# try moving it to the destination_path. This prevents
# simultaneous writes of the same file.
with tempfile.TemporaryDirectory() as temp_directory_name:
temp_path = os.path.join(temp_directory_name, target_file_name)
with open(temp_path, 'wb') as stored_file:
# This is were we do the actual downloading!
warn(f'Downloading {config_name} to {destination_path}')
stored_file.write(fs_object.read())
if not os.path.exists(destination_path):
# Move the file to the place we want to store it.
move(temp_path, destination_path)
return destination_path
else:
raise ValueError(f'Config {config_name} cannot be downloaded '
f'since it is not stored')
def get_abs_path(self, config_name):
return self.download_single(config_name)
def download_all(self):
"""Download all the files that are stored in the mongo collection"""
raise NotImplementedError('This feature is disabled for now')
# Disable the inspection of `Unreachable code`
# pylint: disable=unreachable
for config in self.list_files():
self.download_single(config)
@staticmethod
def _check_store_files_at(cache_folder_alternatives):
"""
Iterate over the options in cache_options until we find a folder
where we can store data. Order does matter as we iterate
until we find one folder that is willing.
:param cache_folder_alternatives: tuple, this tuple must be a
list of paths one can try to store the downloaded data
:return: str, the folder that we can write to.
"""
if not isinstance(cache_folder_alternatives, (tuple, list)):
raise ValueError('cache_folder_alternatives must be tuple')
for folder in cache_folder_alternatives:
if not os.path.exists(folder):
try:
os.makedirs(folder)
except (PermissionError, OSError):
continue
if os.access(folder, os.W_OK):
return folder
raise PermissionError(
f'Cannot write to any of the cache_folder_alternatives: '
f'{cache_folder_alternatives}')
class CouldNotLoadError(Exception):
"""Raise if we cannot load this kind of data"""
# Disable the inspection of 'Unnecessary pass statement'
# pylint: disable=unnecessary-pass
pass
class ConfigTooLargeError(Exception):
"""Raise if the data is to large to be uploaded into mongo"""
# Disable the inspection of 'Unnecessary pass statement'
# pylint: disable=unnecessary-pass
pass
| [
1,
529,
276,
1112,
420,
29958,
801,
5526,
1572,
29899,
16838,
29914,
4151,
29916,
264,
13,
5215,
2897,
30004,
13,
5215,
5694,
1445,
30004,
13,
3166,
12865,
1053,
12865,
30004,
13,
3166,
18116,
1053,
29383,
30004,
13,
5215,
282,
3637,
29920,
30004,
13,
3166,
5312,
29916,
1053,
1518,
9555,
29892,
304,
29918,
710,
29918,
23583,
30004,
13,
5215,
6856,
5847,
30004,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
30004,
13,
3166,
528,
4422,
1053,
4337,
30004,
13,
5215,
6608,
1982,
30004,
13,
3166,
282,
962,
7443,
29889,
10855,
1053,
14348,
408,
282,
962,
7443,
29918,
10855,
30004,
13,
5215,
3667,
861,
30004,
13,
3166,
5312,
29916,
264,
1053,
318,
2917,
30004,
13,
30004,
13,
15843,
29892,
4770,
497,
1649,
353,
1518,
9555,
26471,
13,
30004,
13,
30004,
13,
29992,
15843,
30004,
13,
1990,
11657,
29943,
29879,
10448,
29901,
30004,
13,
1678,
9995,
30004,
13,
1678,
7399,
770,
304,
6441,
29914,
10382,
278,
2066,
304,
263,
2566,
773,
11657,
9998,
6756,
13,
1678,
363,
10772,
29924,
7443,
29901,
30004,
13,
1678,
2045,
597,
29886,
962,
7443,
29889,
949,
386,
287,
12332,
29889,
601,
29914,
264,
29914,
13844,
29914,
2754,
29914,
7720,
5847,
29914,
2248,
29889,
1420,
29937,
5453,
29899,
7720,
5847,
30004,
13,
1678,
6756,
13,
1678,
910,
770,
947,
278,
6996,
7258,
2069,
11685,
310,
278,
5142,
261,
322,
6756,
13,
1678,
6441,
261,
4413,
22993,
13,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
11167,
13,
462,
20623,
29922,
5574,
11167,
13,
462,
934,
29918,
9803,
2433,
5325,
23592,
13,
462,
2295,
29918,
25378,
2433,
2917,
29918,
978,
23592,
13,
462,
4333,
29922,
8516,
11167,
13,
462,
903,
1688,
29918,
265,
29918,
2344,
29922,
8824,
11167,
13,
462,
29871,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
11657,
29943,
29879,
10448,
30004,
13,
30004,
13,
4706,
584,
3207,
20623,
29901,
6120,
29892,
508,
697,
1303,
470,
884,
2436,
304,
278,
30004,
13,
9651,
2566,
22993,
13,
4706,
584,
3207,
934,
29918,
9803,
29901,
851,
29892,
1024,
310,
278,
2566,
29889,
13109,
881,
30004,
13,
9651,
451,
367,
3939,
22993,
13,
4706,
584,
3207,
2295,
29918,
25378,
29901,
851,
29892,
4839,
310,
278,
2066,
393,
526,
30004,
13,
9651,
7160,
297,
11657,
5847,
30004,
13,
4706,
584,
3207,
4333,
29901,
282,
962,
7443,
29889,
10855,
29889,
7196,
29892,
313,
27636,
8443,
13,
9651,
10772,
29924,
7443,
3630,
1170,
14348,
304,
491,
3364,
4226,
2069,
11685,
30004,
13,
9651,
773,
3667,
861,
29889,
10575,
367,
385,
1203,
310,
278,
883,
29901,
30004,
13,
18884,
282,
962,
7443,
29889,
29924,
7443,
4032,
29898,
636,
467,
25832,
27982,
29918,
5813,
29889,
15032,
3281,
2725,
29918,
5813,
30004,
13,
4706,
584,
3207,
903,
1688,
29918,
265,
29918,
2344,
29901,
4321,
565,
278,
4333,
338,
4069,
373,
2069,
30004,
13,
9651,
313,
6194,
316,
11236,
403,
565,
366,
526,
773,
263,
14982,
716,
2566,
20198,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
565,
4333,
338,
6213,
29901,
30004,
13,
9651,
565,
451,
20623,
29901,
30004,
13,
18884,
396,
1334,
864,
4113,
2130,
304,
1369,
5007,
848,
29991,
30004,
13,
18884,
19476,
29918,
2271,
353,
318,
2917,
29889,
657,
877,
29160,
29890,
29918,
6406,
742,
525,
29885,
7443,
29918,
29878,
2585,
29918,
2271,
1495,
30004,
13,
18884,
19476,
29918,
1792,
353,
318,
2917,
29889,
657,
877,
29160,
29890,
29918,
6406,
742,
525,
29885,
7443,
29918,
29878,
2585,
29918,
6786,
1495,
30004,
13,
18884,
19476,
29918,
5630,
353,
318,
2917,
29889,
657,
877,
29160,
29890,
29918,
6406,
742,
525,
29885,
7443,
29918,
29878,
2585,
29918,
5630,
1495,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
396,
1334,
508,
23511,
671,
278,
22310,
861,
21274,
30004,
13,
18884,
19476,
29918,
2271,
353,
19476,
29918,
1792,
353,
19476,
29918,
5630,
353,
6213,
30004,
13,
30004,
13,
9651,
396,
960,
694,
4333,
1852,
338,
4502,
29892,
372,
21274,
304,
278,
525,
5325,
29915,
30004,
13,
9651,
396,
4333,
29892,
1074,
363,
901,
4902,
29901,
30004,
13,
9651,
396,
2045,
597,
3292,
29889,
510,
29914,
29990,
1430,
1164,
29876,
29911,
29914,
4422,
861,
29914,
10054,
29914,
6207,
29914,
4422,
861,
29914,
29160,
29890,
29889,
2272,
30004,
13,
9651,
19476,
29918,
19290,
353,
3336,
13,
18884,
525,
2271,
2396,
19476,
29918,
2271,
11167,
13,
18884,
525,
1792,
2396,
19476,
29918,
1792,
11167,
13,
18884,
525,
5630,
2396,
529,
25711,
17013,
10202,
30004,
13,
18884,
525,
9803,
2396,
934,
29918,
9803,
11167,
13,
9651,
4970,
13,
9651,
396,
1334,
508,
23511,
2898,
29899,
401,
278,
4333,
408,
393,
338,
2337,
30004,
13,
9651,
396,
278,
1021,
411,
11657,
9998,
22993,
13,
9651,
4333,
353,
3667,
861,
29889,
29160,
29890,
29889,
29916,
296,
29918,
10855,
29898,
30004,
13,
18884,
3579,
29885,
7443,
29918,
19290,
11167,
13,
18884,
4333,
2433,
5847,
29889,
5325,
1495,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
396,
5399,
278,
1404,
1881,
338,
2691,
363,
825,
591,
864,
304,
437,
22993,
13,
9651,
565,
451,
338,
8758,
29898,
10855,
29892,
282,
962,
7443,
29918,
10855,
1125,
30004,
13,
18884,
12020,
7865,
2392,
877,
1184,
29894,
680,
10772,
29924,
7443,
4333,
313,
4149,
1574,
1807,
20198,
1495,
30004,
13,
9651,
565,
934,
29918,
9803,
338,
451,
6213,
29901,
30004,
13,
18884,
12020,
7865,
2392,
703,
2499,
2040,
4944,
263,
4333,
29991,
1159,
30004,
13,
30004,
13,
4706,
396,
3789,
4333,
322,
1207,
1854,
372,
508,
472,
3203,
437,
263,
525,
2886,
29915,
5858,
30004,
13,
4706,
1583,
29889,
10855,
353,
4333,
30004,
13,
4706,
565,
903,
1688,
29918,
265,
29918,
2344,
29901,
30004,
13,
9651,
1583,
29889,
1688,
29918,
2886,
26471,
13,
30004,
13,
4706,
396,
910,
338,
278,
15882,
1090,
607,
591,
3787,
278,
2066,
22993,
13,
4706,
1583,
29889,
2917,
29918,
25378,
353,
2295,
29918,
25378,
30004,
13,
30004,
13,
4706,
396,
450,
11657,
9998,
1304,
297,
445,
2566,
30004,
13,
4706,
1583,
29889,
7720,
29918,
5847,
353,
6856,
5847,
29889,
5756,
9998,
29898,
10855,
29889,
9803,
8443,
13,
30004,
13,
1678,
822,
679,
29918,
1972,
29918,
2917,
29898,
1311,
29892,
2295,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
3251,
403,
15882,
304,
2346,
2750,
29889,
910,
338,
925,
278,
2295,
29879,
6756,
13,
4706,
1024,
22993,
13,
30004,
13,
4706,
584,
3207,
2295,
29901,
851,
29892,
29871,
1024,
310,
278,
934,
310,
4066,
30004,
13,
4706,
584,
2457,
29901,
9657,
29892,
393,
508,
367,
1304,
297,
9365,
30004,
13,
4706,
9995,
30004,
13,
4706,
736,
426,
1311,
29889,
2917,
29918,
25378,
29901,
2295,
8117,
13,
30004,
13,
1678,
822,
1842,
29918,
4830,
29898,
1311,
29892,
2295,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
19191,
310,
278,
1842,
304,
6441,
30004,
13,
30004,
13,
4706,
584,
3207,
2295,
29901,
851,
29892,
29871,
1024,
310,
278,
934,
310,
4066,
30004,
13,
4706,
584,
2457,
29901,
9657,
29892,
393,
674,
367,
1304,
304,
788,
278,
1842,
30004,
13,
4706,
9995,
30004,
13,
4706,
1574,
353,
1583,
29889,
657,
29918,
1972,
29918,
2917,
29898,
2917,
8443,
13,
4706,
1574,
29889,
5504,
3319,
30004,
13,
9651,
525,
23959,
2396,
12865,
29889,
3707,
29898,
17559,
29922,
2272,
17559,
29889,
329,
29883,
511,
30004,
13,
4706,
5615,
30004,
13,
4706,
736,
1574,
30004,
13,
30004,
13,
1678,
822,
2295,
29918,
9933,
29898,
1311,
29892,
2295,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
26141,
1423,
565,
445,
2295,
338,
2307,
7160,
297,
278,
4333,
30004,
13,
30004,
13,
4706,
584,
3207,
2295,
29901,
851,
29892,
29871,
1024,
310,
278,
934,
310,
4066,
30004,
13,
4706,
584,
2457,
29901,
6120,
29892,
338,
445,
2295,
1024,
6087,
297,
278,
2566,
30004,
13,
4706,
9995,
30004,
13,
4706,
2346,
353,
1583,
29889,
657,
29918,
1972,
29918,
2917,
29898,
2917,
8443,
13,
4706,
736,
1583,
29889,
10855,
29889,
2798,
29918,
3225,
29879,
29898,
1972,
29897,
1405,
29871,
29900,
30004,
13,
30004,
13,
1678,
822,
22821,
29945,
29918,
303,
4395,
29898,
1311,
29892,
6425,
29918,
2084,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
405,
29933,
29901,
18113,
938,
6270,
5858,
29991,
30004,
13,
4706,
10057,
3730,
7252,
565,
278,
20672,
29945,
15882,
338,
278,
1021,
408,
278,
934,
6756,
13,
4706,
408,
6087,
1090,
6425,
29918,
2084,
22993,
13,
30004,
13,
4706,
584,
3207,
6425,
29918,
2084,
29901,
851,
29892,
8380,
2224,
304,
278,
934,
1024,
30004,
13,
4706,
584,
2457,
29901,
6120,
29892,
3639,
565,
278,
2684,
1021,
934,
338,
2307,
6087,
30004,
13,
9651,
297,
278,
2566,
30004,
13,
30004,
13,
4706,
9995,
30004,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
6897,
29918,
2084,
1125,
30004,
13,
9651,
396,
319,
934,
393,
947,
451,
1863,
947,
451,
505,
278,
1021,
20672,
29945,
30004,
13,
9651,
736,
7700,
30004,
13,
4706,
2346,
353,
11117,
3487,
29945,
2396,
1583,
29889,
26017,
29918,
3487,
29945,
29898,
6897,
29918,
2084,
2915,
30004,
13,
4706,
736,
1583,
29889,
10855,
29889,
2798,
29918,
3225,
29879,
29898,
1972,
29897,
1405,
29871,
29900,
30004,
13,
30004,
13,
1678,
822,
1243,
29918,
2886,
29898,
1311,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
4321,
278,
3957,
304,
278,
1583,
29889,
10855,
304,
1074,
565,
591,
508,
6756,
13,
4706,
2189,
263,
4333,
29889,
2886,
5858,
22993,
13,
4706,
9995,
30004,
13,
4706,
565,
1583,
29889,
10855,
29889,
2886,
29918,
650,
29898,
771,
6929,
543,
29918,
333,
1159,
338,
6213,
29901,
30004,
13,
9651,
12020,
15160,
2392,
877,
23323,
451,
1284,
738,
848,
297,
445,
4333,
1495,
30004,
13,
30004,
13,
1678,
822,
1051,
29918,
5325,
29898,
1311,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
3617,
263,
4866,
1051,
310,
2066,
393,
526,
6087,
297,
278,
2566,
30004,
13,
30004,
13,
4706,
584,
2457,
29901,
1051,
29892,
1051,
310,
278,
2983,
310,
278,
4452,
6087,
297,
445,
30004,
13,
9651,
2566,
30004,
13,
30004,
13,
4706,
9995,
30004,
13,
4706,
736,
518,
1514,
29961,
1311,
29889,
2917,
29918,
25378,
29962,
30004,
13,
18884,
363,
1574,
297,
30004,
13,
18884,
1583,
29889,
10855,
29889,
2886,
29898,
30004,
13,
462,
1678,
18246,
29922,
30004,
13,
462,
1678,
426,
1311,
29889,
2917,
29918,
25378,
29901,
29871,
29896,
1800,
30004,
13,
18884,
565,
1583,
29889,
2917,
29918,
25378,
297,
1574,
30004,
13,
18884,
4514,
30004,
13,
30004,
13,
1678,
732,
7959,
5696,
30004,
13,
1678,
822,
10272,
29918,
3487,
29945,
29898,
6897,
29918,
2084,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
405,
29933,
29901,
18113,
938,
6270,
5858,
29991,
30004,
13,
4706,
3617,
278,
22821,
29945,
6608,
310,
263,
934,
6087,
1090,
6425,
29918,
2084,
30004,
13,
30004,
13,
4706,
584,
3207,
6425,
29918,
2084,
29901,
851,
29892,
8380,
2224,
304,
263,
934,
30004,
13,
4706,
584,
2457,
29901,
851,
29892,
278,
22821,
29945,
29899,
8568,
310,
278,
13877,
934,
30004,
13,
4706,
9995,
30004,
13,
4706,
396,
910,
740,
338,
13746,
515,
29901,
30004,
13,
4706,
396,
29577,
29889,
510,
29914,
2619,
29914,
29941,
29946,
29941,
29896,
29947,
29906,
29945,
29914,
4738,
1218,
29899,
273,
29899,
3487,
29945,
29899,
3198,
2083,
29899,
974,
29899,
29874,
29899,
1445,
30004,
13,
30004,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
6897,
29918,
2084,
1125,
30004,
13,
9651,
396,
565,
727,
338,
694,
934,
29892,
727,
338,
3078,
304,
10272,
30004,
13,
9651,
736,
5124,
30004,
13,
4706,
396,
3115,
29892,
11262,
599,
278,
29871,
4803,
310,
297,
24216,
20672,
29906,
29892,
20672,
29946,
29892,
20672,
29945,
29892,
470,
317,
15715,
29896,
30004,
13,
4706,
396,
6608,
740,
5537,
800,
297,
445,
740,
22993,
13,
4706,
396,
11262,
3719,
277,
30004,
13,
4706,
6608,
29918,
3487,
29945,
353,
6608,
1982,
29889,
3487,
29945,
26471,
13,
4706,
411,
1722,
29898,
6897,
29918,
2084,
29892,
376,
6050,
1159,
408,
285,
29901,
30004,
13,
9651,
363,
19875,
297,
4256,
29898,
2892,
29901,
285,
29889,
949,
29898,
29946,
29900,
29929,
29953,
511,
289,
15945,
1125,
30004,
13,
18884,
6608,
29918,
3487,
29945,
29889,
5504,
29898,
29812,
8443,
13,
4706,
736,
6608,
29918,
3487,
29945,
29889,
20970,
7501,
342,
26471,
13,
30004,
13,
30004,
13,
29992,
15843,
30004,
13,
1990,
18294,
3373,
12657,
29898,
5756,
29943,
29879,
10448,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
4134,
304,
6441,
2066,
304,
11657,
29943,
29879,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
20623,
29922,
8824,
29892,
334,
5085,
29892,
3579,
19290,
1125,
30004,
13,
4706,
396,
19491,
408,
3847,
29889,
3387,
1423,
278,
20623,
29918,
23516,
30004,
13,
4706,
565,
20623,
29901,
30004,
13,
9651,
12020,
20894,
2333,
2392,
29898,
30004,
13,
18884,
376,
5328,
508,
366,
6441,
565,
366,
864,
304,
21994,
297,
20623,
29973,
1159,
30004,
13,
4706,
2428,
2141,
1649,
2344,
1649,
10456,
5085,
29892,
20623,
29922,
949,
6194,
29892,
3579,
19290,
8443,
13,
30004,
13,
1678,
822,
6441,
29918,
3166,
29918,
8977,
29898,
1311,
29892,
934,
29918,
2084,
29918,
8977,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
5020,
1359,
599,
2066,
297,
278,
8600,
304,
278,
2566,
22993,
13,
30004,
13,
4706,
584,
3207,
934,
29918,
2084,
29918,
8977,
29901,
9657,
29892,
8600,
310,
10898,
304,
6441,
29889,
450,
6756,
13,
9651,
9657,
881,
367,
310,
278,
3402,
29901,
30004,
13,
9651,
934,
29918,
2084,
29918,
8977,
353,
11117,
2917,
29918,
978,
2396,
29871,
8207,
1552,
29918,
2917,
29918,
2084,
742,
2023,
8117,
13,
30004,
13,
4706,
584,
2457,
29901,
6213,
30004,
13,
4706,
9995,
30004,
13,
4706,
565,
451,
338,
8758,
29898,
1445,
29918,
2084,
29918,
8977,
29892,
9657,
1125,
30004,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29915,
1445,
29918,
2084,
29918,
8977,
1818,
367,
9657,
310,
883,
525,
30004,
13,
462,
632,
285,
11838,
8977,
29898,
5813,
29922,
2882,
29903,
5607,
26027,
29918,
10145,
29892,
11410,
1642,
15992,
525,
30004,
13,
462,
632,
285,
29915,
29912,
1853,
29898,
1445,
29918,
2084,
29918,
8977,
2915,
2012,
1495,
30004,
13,
30004,
13,
4706,
363,
2295,
29892,
6425,
29918,
2084,
297,
260,
29939,
18933,
29898,
1445,
29918,
2084,
29918,
8977,
29889,
7076,
580,
1125,
30004,
13,
9651,
396,
1334,
817,
304,
437,
445,
19390,
1423,
1244,
29889,
739,
338,
451,
3307,
30004,
13,
9651,
396,
304,
925,
1423,
393,
278,
934,
338,
6087,
1090,
278,
6756,
13,
9651,
396,
525,
2917,
29918,
25378,
4286,
1724,
565,
278,
934,
3939,
29973,
1987,
591,
6756,
13,
9651,
396,
864,
304,
6441,
263,
716,
934,
29991,
13466,
591,
1033,
505,
2309,
6756,
13,
9651,
396,
278,
1583,
29889,
2917,
29918,
9933,
29899,
1972,
29889,
960,
372,
12169,
714,
591,
505,
278,
6756,
13,
9651,
396,
2684,
1021,
934,
29892,
9566,
1048,
6441,
292,
372,
22993,
13,
9651,
565,
1583,
29889,
2917,
29918,
9933,
29898,
2917,
29897,
322,
1583,
29889,
3487,
29945,
29918,
303,
4395,
29898,
6897,
29918,
2084,
1125,
30004,
13,
18884,
6773,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
396,
910,
2794,
591,
526,
2675,
304,
6441,
278,
934,
1363,
967,
30004,
13,
18884,
396,
451,
6087,
3447,
22993,
13,
18884,
1018,
29901,
30004,
13,
462,
1678,
1583,
29889,
9009,
29918,
14369,
29898,
2917,
29892,
6425,
29918,
2084,
8443,
13,
18884,
5174,
313,
23323,
3664,
5896,
2392,
29892,
12782,
1762,
29877,
24105,
479,
2392,
1125,
30004,
13,
462,
1678,
396,
11637,
591,
881,
4418,
769,
29973,
30004,
13,
462,
1678,
29383,
29898,
29888,
29915,
29089,
6441,
426,
2917,
29913,
1495,
30004,
13,
30004,
13,
1678,
822,
6441,
29918,
14369,
29898,
1311,
29892,
2295,
29892,
6425,
29918,
2084,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
5020,
1359,
263,
2323,
934,
304,
6856,
5847,
30004,
13,
30004,
13,
4706,
584,
3207,
2295,
29901,
851,
29892,
278,
1024,
1090,
607,
445,
934,
881,
367,
30004,
13,
9651,
6087,
30004,
13,
30004,
13,
4706,
584,
3207,
6425,
29918,
2084,
29901,
851,
29892,
278,
8380,
2224,
310,
278,
934,
6756,
13,
4706,
9995,
30004,
13,
4706,
1574,
353,
1583,
29889,
3225,
29918,
4830,
29898,
2917,
8443,
13,
4706,
1574,
1839,
3487,
29945,
2033,
353,
1583,
29889,
26017,
29918,
3487,
29945,
29898,
6897,
29918,
2084,
8443,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
6897,
29918,
2084,
1125,
30004,
13,
9651,
12020,
6527,
3664,
5896,
2392,
29898,
29888,
29915,
29912,
6897,
29918,
2084,
29913,
947,
451,
429,
1169,
1495,
30004,
13,
30004,
13,
4706,
1596,
29898,
29888,
29915,
9009,
292,
426,
2917,
29913,
1495,
30004,
13,
4706,
411,
1722,
29898,
6897,
29918,
2084,
29892,
525,
6050,
1495,
408,
934,
29901,
30004,
13,
9651,
1583,
29889,
7720,
29918,
5847,
29889,
649,
29898,
1445,
29892,
3579,
1514,
8443,
13,
30004,
13,
30004,
13,
29992,
15843,
30004,
13,
1990,
18294,
6767,
12657,
29898,
5756,
29943,
29879,
10448,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
4134,
304,
5142,
2066,
515,
11657,
29943,
29879,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
11167,
13,
462,
3787,
29918,
5325,
29918,
271,
29922,
8516,
11167,
13,
462,
334,
5085,
29892,
3579,
19290,
1125,
30004,
13,
4706,
2428,
2141,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
8443,
13,
30004,
13,
4706,
396,
1334,
526,
2675,
304,
731,
263,
2058,
988,
304,
3787,
278,
2066,
29889,
739,
29915,
29879,
6756,
13,
4706,
396,
2845,
6790,
491,
278,
1404,
470,
591,
671,
1438,
21274,
29901,
30004,
13,
4706,
565,
3787,
29918,
5325,
29918,
271,
338,
6213,
29901,
30004,
13,
9651,
3787,
29918,
5325,
29918,
271,
353,
6702,
29914,
7050,
29914,
4151,
29916,
264,
29918,
10314,
29918,
8173,
29914,
23592,
13,
462,
795,
8207,
29881,
2606,
29914,
29880,
27857,
29875,
29914,
4151,
29916,
29914,
10314,
29918,
8173,
23592,
13,
462,
795,
19283,
10314,
29918,
8173,
742,
29871,
6756,
13,
462,
795,
1723,
30004,
13,
4706,
25342,
451,
338,
8758,
29898,
8899,
29918,
5325,
29918,
271,
29892,
313,
23583,
29892,
851,
29892,
1051,
22164,
30004,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29915,
29912,
8899,
29918,
5325,
29918,
271,
29913,
881,
367,
18761,
310,
10898,
29991,
1495,
30004,
13,
4706,
25342,
338,
8758,
29898,
8899,
29918,
5325,
29918,
271,
29892,
851,
1125,
30004,
13,
9651,
3787,
29918,
5325,
29918,
271,
353,
304,
29918,
710,
29918,
23583,
29898,
8899,
29918,
5325,
29918,
271,
8443,
13,
30004,
13,
4706,
1583,
29889,
12925,
29918,
6768,
353,
3787,
29918,
5325,
29918,
271,
30004,
13,
30004,
13,
1678,
822,
5142,
29918,
14369,
29898,
1311,
11167,
13,
462,
4706,
2295,
29918,
978,
29901,
851,
11167,
13,
462,
4706,
5199,
29918,
949,
519,
29918,
1445,
29918,
978,
29922,
8824,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
25553,
278,
2295,
29918,
978,
565,
372,
4864,
30004,
13,
30004,
13,
4706,
584,
3207,
2295,
29918,
978,
29901,
851,
29892,
278,
1024,
1090,
607,
278,
934,
338,
6087,
30004,
13,
30004,
13,
4706,
584,
3207,
5199,
29918,
949,
519,
29918,
1445,
29918,
978,
29901,
6120,
29892,
3787,
278,
934,
884,
1090,
30004,
13,
9651,
372,
29915,
29879,
5199,
19909,
1024,
29889,
739,
338,
2253,
451,
304,
671,
445,
408,
30004,
13,
9651,
278,
1404,
1795,
451,
1073,
565,
278,
1873,
310,
278,
934,
338,
278,
30004,
13,
9651,
9281,
22993,
13,
30004,
13,
4706,
584,
2457,
29901,
851,
29892,
278,
8380,
2224,
310,
278,
934,
13877,
30004,
13,
4706,
9995,
30004,
13,
4706,
565,
1583,
29889,
2917,
29918,
9933,
29898,
2917,
29918,
978,
1125,
30004,
13,
9651,
396,
13641,
491,
1024,
30004,
13,
9651,
2346,
353,
1583,
29889,
657,
29918,
1972,
29918,
2917,
29898,
2917,
29918,
978,
8443,
13,
9651,
1018,
29901,
30004,
13,
18884,
396,
910,
1033,
736,
2999,
1951,
591,
6441,
2066,
565,
6756,
13,
18884,
396,
896,
505,
3939,
1449,
29991,
7857,
925,
2125,
278,
1833,
22993,
13,
18884,
18920,
29918,
3318,
353,
1583,
29889,
7720,
29918,
5847,
29889,
657,
29918,
4230,
29918,
3259,
29898,
1068,
1972,
8443,
13,
9651,
5174,
6856,
5847,
29889,
3782,
2283,
408,
321,
29901,
30004,
13,
18884,
12020,
6527,
3664,
5896,
2392,
29898,
30004,
13,
462,
1678,
285,
29915,
29912,
2917,
29918,
978,
29913,
2609,
367,
16532,
515,
11657,
29943,
29879,
1495,
515,
321,
30004,
13,
30004,
13,
9651,
396,
3674,
29892,
577,
591,
508,
1722,
372,
29889,
1334,
674,
3787,
278,
934,
1090,
372,
29915,
29879,
6756,
13,
9651,
396,
22821,
29945,
29899,
8568,
408,
393,
6511,
304,
5948,
7252,
565,
591,
2307,
6756,
13,
9651,
396,
505,
278,
1959,
934,
22993,
13,
9651,
565,
5199,
29918,
949,
519,
29918,
1445,
29918,
978,
29901,
30004,
13,
18884,
3646,
29918,
1445,
29918,
978,
353,
2295,
29918,
978,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
3646,
29918,
1445,
29918,
978,
353,
18920,
29918,
3318,
29889,
3487,
29945,
30004,
13,
30004,
13,
9651,
363,
7090,
29918,
12083,
297,
1583,
29889,
12925,
29918,
6768,
29901,
30004,
13,
18884,
1950,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
8173,
29918,
12083,
29892,
3646,
29918,
1445,
29918,
978,
8443,
13,
18884,
565,
2897,
29889,
2084,
29889,
9933,
29898,
27338,
29918,
2084,
1125,
30004,
13,
462,
1678,
396,
7027,
29991,
910,
2307,
4864,
29889,
2803,
29915,
29879,
925,
736,
30004,
13,
462,
1678,
396,
988,
372,
338,
6087,
22993,
13,
462,
1678,
736,
1950,
29918,
2084,
30004,
13,
30004,
13,
9651,
396,
27466,
2705,
278,
934,
947,
451,
1863,
29892,
1235,
29915,
29879,
1284,
263,
2058,
304,
30004,
13,
9651,
396,
3787,
278,
934,
322,
5142,
372,
22993,
13,
9651,
3787,
29918,
5325,
29918,
271,
353,
1583,
3032,
3198,
29918,
8899,
29918,
5325,
29918,
271,
29898,
1311,
29889,
12925,
29918,
6768,
8443,
13,
9651,
12551,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
8899,
29918,
5325,
29918,
271,
29892,
3646,
29918,
1445,
29918,
978,
8443,
13,
30004,
13,
9651,
396,
2803,
29915,
29879,
1722,
263,
13201,
3884,
29892,
5142,
278,
934,
29892,
322,
30004,
13,
9651,
396,
1018,
8401,
372,
304,
278,
12551,
29918,
2084,
29889,
910,
28057,
30004,
13,
9651,
396,
16991,
681,
15873,
310,
278,
1021,
934,
22993,
13,
9651,
411,
5694,
1445,
29889,
5776,
1971,
653,
9882,
580,
408,
5694,
29918,
12322,
29918,
978,
29901,
30004,
13,
18884,
5694,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
7382,
29918,
12322,
29918,
978,
29892,
3646,
29918,
1445,
29918,
978,
8443,
13,
30004,
13,
18884,
411,
1722,
29898,
7382,
29918,
2084,
29892,
525,
29893,
29890,
1495,
408,
6087,
29918,
1445,
29901,
30004,
13,
462,
1678,
396,
910,
338,
892,
591,
437,
278,
3935,
28536,
29991,
30004,
13,
462,
1678,
29383,
29898,
29888,
29915,
6767,
13234,
426,
2917,
29918,
978,
29913,
304,
426,
23848,
29918,
2084,
29913,
1495,
30004,
13,
462,
1678,
6087,
29918,
1445,
29889,
3539,
29898,
5847,
29918,
3318,
29889,
949,
3101,
30004,
13,
30004,
13,
18884,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
23848,
29918,
2084,
1125,
30004,
13,
462,
1678,
396,
25249,
278,
934,
304,
278,
2058,
591,
864,
304,
3787,
372,
22993,
13,
462,
1678,
4337,
29898,
7382,
29918,
2084,
29892,
12551,
29918,
2084,
8443,
13,
9651,
736,
12551,
29918,
2084,
30004,
13,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29915,
3991,
426,
2917,
29918,
978,
29913,
2609,
367,
16532,
525,
30004,
13,
462,
632,
285,
29915,
16076,
372,
338,
451,
6087,
1495,
30004,
13,
30004,
13,
1678,
822,
679,
29918,
6897,
29918,
2084,
29898,
1311,
29892,
2295,
29918,
978,
1125,
30004,
13,
4706,
736,
1583,
29889,
10382,
29918,
14369,
29898,
2917,
29918,
978,
8443,
13,
30004,
13,
1678,
822,
5142,
29918,
497,
29898,
1311,
1125,
30004,
13,
4706,
9995,
22954,
599,
278,
2066,
393,
526,
6087,
297,
278,
19476,
4333,
15945,
19451,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
877,
4013,
4682,
338,
12708,
363,
1286,
1495,
30004,
13,
4706,
396,
3295,
519,
278,
1663,
27988,
310,
421,
2525,
276,
496,
519,
775,
29952,
30004,
13,
4706,
396,
282,
2904,
524,
29901,
11262,
29922,
348,
276,
496,
519,
30004,
13,
4706,
363,
2295,
297,
1583,
29889,
1761,
29918,
5325,
7295,
30004,
13,
9651,
1583,
29889,
10382,
29918,
14369,
29898,
2917,
8443,
13,
30004,
13,
1678,
732,
7959,
5696,
30004,
13,
1678,
822,
903,
3198,
29918,
8899,
29918,
5325,
29918,
271,
29898,
8173,
29918,
12083,
29918,
26123,
5056,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
20504,
403,
975,
278,
3987,
297,
7090,
29918,
6768,
2745,
591,
1284,
263,
4138,
30004,
13,
9651,
988,
591,
508,
3787,
848,
29889,
8170,
947,
4383,
408,
591,
13649,
30004,
13,
9651,
2745,
591,
1284,
697,
4138,
393,
338,
17762,
22993,
13,
30004,
13,
4706,
584,
3207,
7090,
29918,
12083,
29918,
26123,
5056,
29901,
18761,
29892,
445,
18761,
1818,
367,
263,
30004,
13,
9651,
1051,
310,
10898,
697,
508,
1018,
304,
3787,
278,
16532,
848,
30004,
13,
30004,
13,
4706,
584,
2457,
29901,
851,
29892,
278,
4138,
393,
591,
508,
2436,
304,
22993,
13,
4706,
9995,
30004,
13,
4706,
565,
451,
338,
8758,
29898,
8173,
29918,
12083,
29918,
26123,
5056,
29892,
313,
23583,
29892,
1051,
22164,
30004,
13,
9651,
12020,
7865,
2392,
877,
8173,
29918,
12083,
29918,
26123,
5056,
1818,
367,
18761,
1495,
30004,
13,
4706,
363,
4138,
297,
7090,
29918,
12083,
29918,
26123,
5056,
29901,
30004,
13,
9651,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
12083,
1125,
30004,
13,
18884,
1018,
29901,
30004,
13,
462,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
12083,
8443,
13,
18884,
5174,
313,
27293,
2392,
29892,
438,
29173,
1125,
30004,
13,
462,
1678,
6773,
30004,
13,
9651,
565,
2897,
29889,
5943,
29898,
12083,
29892,
2897,
29889,
29956,
29918,
8949,
1125,
30004,
13,
18884,
736,
4138,
30004,
13,
4706,
12020,
20894,
2333,
2392,
29898,
30004,
13,
9651,
285,
29915,
29089,
2436,
304,
738,
310,
278,
7090,
29918,
12083,
29918,
26123,
5056,
29901,
525,
30004,
13,
9651,
285,
29915,
29912,
8173,
29918,
12083,
29918,
26123,
5056,
29913,
1495,
30004,
13,
30004,
13,
30004,
13,
1990,
6527,
3664,
5896,
2392,
29898,
2451,
1125,
30004,
13,
1678,
9995,
29934,
29874,
895,
565,
591,
2609,
2254,
445,
2924,
310,
848,
15945,
19451,
13,
1678,
396,
3295,
519,
278,
1663,
27988,
310,
525,
2525,
15107,
653,
1209,
3229,
29915,
30004,
13,
1678,
396,
282,
2904,
524,
29901,
11262,
29922,
348,
15107,
653,
29899,
3364,
30004,
13,
1678,
1209,
30004,
13,
30004,
13,
30004,
13,
1990,
12782,
1762,
29877,
24105,
479,
2392,
29898,
2451,
1125,
30004,
13,
1678,
9995,
29934,
29874,
895,
565,
278,
848,
338,
304,
2919,
304,
367,
20373,
964,
19476,
15945,
19451,
13,
1678,
396,
3295,
519,
278,
1663,
27988,
310,
525,
2525,
15107,
653,
1209,
3229,
29915,
30004,
13,
1678,
396,
282,
2904,
524,
29901,
11262,
29922,
348,
15107,
653,
29899,
3364,
30004,
13,
1678,
1209,
30004,
13,
2
] |
skyhook/skyhook/middlewares/retry.py | wfgydbu/skyhook | 2 | 59477 | <filename>skyhook/skyhook/middlewares/retry.py
from scrapy.downloadermiddlewares.retry import RetryMiddleware
from scrapy.utils.response import response_status_message
class FeedBackRetryMiddleware(RetryMiddleware):
def process_response(self, request, response, spider):
if request.meta.get('dont_retry', False):
return response
if response.status in self.retry_http_codes:
reason = response_status_message(response.status)
return self._retry(request, reason, spider) or response
return response
def process_exception(self, request, exception, spider):
if isinstance(exception, self.EXCEPTIONS_TO_RETRY) and not request.meta.get('dont_retry', False):
return self._retry(request, exception, spider)
| [
1,
529,
9507,
29958,
7912,
20849,
29914,
7912,
20849,
29914,
17662,
4495,
267,
29914,
276,
2202,
29889,
2272,
13,
3166,
24559,
2272,
29889,
10382,
837,
2632,
4495,
267,
29889,
276,
2202,
1053,
4649,
719,
25411,
2519,
13,
3166,
24559,
2272,
29889,
13239,
29889,
5327,
1053,
2933,
29918,
4882,
29918,
4906,
13,
13,
13,
1990,
5169,
287,
5841,
8015,
719,
25411,
2519,
29898,
8015,
719,
25411,
2519,
1125,
13,
1678,
822,
1889,
29918,
5327,
29898,
1311,
29892,
2009,
29892,
2933,
29892,
805,
1241,
1125,
13,
4706,
565,
2009,
29889,
7299,
29889,
657,
877,
29881,
609,
29918,
276,
2202,
742,
7700,
1125,
13,
9651,
736,
2933,
13,
13,
4706,
565,
2933,
29889,
4882,
297,
1583,
29889,
276,
2202,
29918,
1124,
29918,
18137,
29901,
13,
9651,
2769,
353,
2933,
29918,
4882,
29918,
4906,
29898,
5327,
29889,
4882,
29897,
13,
9651,
736,
1583,
3032,
276,
2202,
29898,
3827,
29892,
2769,
29892,
805,
1241,
29897,
470,
2933,
13,
13,
4706,
736,
2933,
13,
13,
1678,
822,
1889,
29918,
11739,
29898,
1311,
29892,
2009,
29892,
3682,
29892,
805,
1241,
1125,
13,
4706,
565,
338,
8758,
29898,
11739,
29892,
1583,
29889,
5746,
4741,
7982,
27946,
29918,
4986,
29918,
1525,
5659,
29979,
29897,
322,
451,
2009,
29889,
7299,
29889,
657,
877,
29881,
609,
29918,
276,
2202,
742,
7700,
1125,
13,
9651,
736,
1583,
3032,
276,
2202,
29898,
3827,
29892,
3682,
29892,
805,
1241,
29897,
13,
2
] |
river/migrations/0012_auto_20191113_1550.py | xuziheng1002/django-river | 0 | 17471 | <filename>river/migrations/0012_auto_20191113_1550.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.25 on 2019-11-13 21:50
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('river', '0011_auto_20191110_1411'),
]
operations = [
migrations.AlterField(
model_name='onapprovedhook',
name='transition_approval',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='on_approved_hooks', to='river.TransitionApproval',
verbose_name='Transition Approval'),
),
migrations.AlterField(
model_name='onapprovedhook',
name='transition_approval_meta',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='on_approved_hooks', to='river.TransitionApprovalMeta', verbose_name='Transition Approval Meta'),
),
migrations.AlterField(
model_name='ontransithook',
name='transition',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='on_transit_hooks', to='river.Transition', verbose_name='Transition'),
),
migrations.AlterField(
model_name='ontransithook',
name='transition_meta',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='on_transit_hooks', to='river.TransitionMeta', verbose_name='Transition Meta'),
),
migrations.AlterField(
model_name='workflow',
name='content_type',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='contenttypes.ContentType', verbose_name='Content Type'),
),
migrations.AlterField(
model_name='workflow',
name='initial_state',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='workflow_this_set_as_initial_state', to='river.State', verbose_name='Initial State'),
),
]
| [
1,
529,
9507,
29958,
3511,
29914,
26983,
800,
29914,
29900,
29900,
29896,
29906,
29918,
6921,
29918,
29906,
29900,
29896,
29929,
29896,
29896,
29896,
29941,
29918,
29896,
29945,
29945,
29900,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
3251,
630,
491,
15337,
29871,
29896,
29889,
29896,
29896,
29889,
29906,
29945,
373,
29871,
29906,
29900,
29896,
29929,
29899,
29896,
29896,
29899,
29896,
29941,
29871,
29906,
29896,
29901,
29945,
29900,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
3511,
742,
525,
29900,
29900,
29896,
29896,
29918,
6921,
29918,
29906,
29900,
29896,
29929,
29896,
29896,
29896,
29900,
29918,
29896,
29946,
29896,
29896,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
265,
9961,
1490,
20849,
742,
13,
9651,
1024,
2433,
20543,
29918,
9961,
791,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
29892,
373,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
4475,
29918,
978,
2433,
265,
29918,
9961,
1490,
29918,
1251,
12117,
742,
304,
2433,
3511,
29889,
4300,
654,
2052,
307,
791,
742,
13,
462,
462,
1678,
26952,
29918,
978,
2433,
4300,
654,
28268,
791,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
265,
9961,
1490,
20849,
742,
13,
9651,
1024,
2433,
20543,
29918,
9961,
791,
29918,
7299,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
4475,
29918,
978,
2433,
265,
29918,
9961,
1490,
29918,
1251,
12117,
742,
304,
2433,
3511,
29889,
4300,
654,
2052,
307,
791,
19346,
742,
26952,
29918,
978,
2433,
4300,
654,
28268,
791,
20553,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
265,
3286,
389,
2550,
742,
13,
9651,
1024,
2433,
20543,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
19465,
29922,
5574,
29892,
1870,
29922,
5574,
29892,
373,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
4475,
29918,
978,
2433,
265,
29918,
3286,
277,
29918,
1251,
12117,
742,
304,
2433,
3511,
29889,
4300,
654,
742,
26952,
29918,
978,
2433,
4300,
654,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
265,
3286,
389,
2550,
742,
13,
9651,
1024,
2433,
20543,
29918,
7299,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
4475,
29918,
978,
2433,
265,
29918,
3286,
277,
29918,
1251,
12117,
742,
304,
2433,
3511,
29889,
4300,
654,
19346,
742,
26952,
29918,
978,
2433,
4300,
654,
20553,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
1287,
1731,
742,
13,
9651,
1024,
2433,
3051,
29918,
1853,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
8618,
4330,
1783,
29892,
304,
2433,
3051,
8768,
29889,
3916,
1542,
742,
26952,
29918,
978,
2433,
3916,
5167,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
1287,
1731,
742,
13,
9651,
1024,
2433,
11228,
29918,
3859,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
8618,
4330,
1783,
29892,
4475,
29918,
978,
2433,
1287,
1731,
29918,
1366,
29918,
842,
29918,
294,
29918,
11228,
29918,
3859,
742,
304,
2433,
3511,
29889,
2792,
742,
26952,
29918,
978,
2433,
15514,
4306,
5477,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
attackMain.py | saurabhK99/substitution-cipher | 0 | 16593 | from tkinter import *
from attack import *
#calls letter frequency attack
def attack(on, cipherTxt):
plainTxt = str()
attack = LetterFrequencyAttack(cipherTxt, on)
for i in range(10):
plainTxt = plainTxt + attack.attack() + '\n\n'
answer.config(text = plainTxt)
#defining main window
root = Tk()
root.title('Letter Frequency Attack')
root.configure(
background='#221b1b',
)
root.option_add('*Font', 'helvatica 12')
root.option_add('*Foreground', 'whitesmoke')
root.option_add('*Background', '#221b1b')
root.option_add('*Entry.HighlightColor', 'whitesmoke')
#key value pairs for radio buttons
types = [
('MONOALPHABETIC_CIPHER', 'MONOALPHABETIC_CIPHER'),
('ADDITIVE_CIPHER', 'ADDITIVE_CIPHER')
]
#variable to store current selection of radio button
attackOn= StringVar()
attackOn.set('MONOALPHABETIC_CIPHER')
Label(root, text='ATTACK ON').grid(row=0, column=0, padx=20)
#radio buttons
for i in range(2):
Radiobutton(
root,
text=types[i][0],
value=types[i][1],
variable=attackOn,
highlightthickness=0,
activebackground='#221b1b',
activeforeground='whitesmoke'
).grid(
row=0,
column=i+1,
padx=20,
pady=20
)
#label to show the result
answer = Label(root, text='ANSWER HERE', wraplength=700, justify=CENTER)
answer.grid(row=1, column=0, columnspan=3, pady=20)
#entry widget to input cipher text to crack
Label(root, text='CIPHER TXT').grid(row=6, column=0)
cipherTxt = Entry(root)
cipherTxt.grid(row=6, column=1, columnspan=2, pady=20)
#button to call attack()
Button(
root,
text='DECRYPT',
justify=CENTER,
command=lambda: attack(
attackOn.get(),
cipherTxt.get()
)
).grid(
row=7,
column=0,
columnspan=3,
pady=20
)
#mainloop of tkinter window
root.mainloop()
| [
1,
515,
18883,
1639,
1053,
334,
13,
3166,
5337,
1053,
334,
13,
13,
29937,
29883,
4293,
5497,
10868,
5337,
29871,
13,
1753,
5337,
29898,
265,
29892,
4583,
8096,
29911,
486,
1125,
13,
1678,
8656,
29911,
486,
353,
851,
580,
13,
1678,
5337,
353,
2803,
357,
23923,
23860,
4165,
547,
29898,
455,
8096,
29911,
486,
29892,
373,
29897,
13,
418,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29900,
1125,
13,
4706,
8656,
29911,
486,
353,
8656,
29911,
486,
718,
5337,
29889,
1131,
547,
580,
718,
11297,
29876,
29905,
29876,
29915,
13,
4706,
1234,
29889,
2917,
29898,
726,
353,
8656,
29911,
486,
29897,
13,
268,
13,
29937,
1753,
2827,
1667,
3474,
13,
4632,
353,
323,
29895,
580,
13,
4632,
29889,
3257,
877,
12024,
357,
3878,
23860,
6212,
547,
1495,
13,
4632,
29889,
17591,
29898,
13,
1678,
3239,
2433,
29937,
29906,
29906,
29896,
29890,
29896,
29890,
742,
13,
29897,
13,
4632,
29889,
3385,
29918,
1202,
877,
29930,
9824,
742,
525,
3952,
9046,
983,
29871,
29896,
29906,
1495,
13,
4632,
29889,
3385,
29918,
1202,
877,
29930,
2831,
18128,
742,
525,
1332,
3246,
4346,
446,
1495,
13,
4632,
29889,
3385,
29918,
1202,
877,
29930,
10581,
742,
16321,
29906,
29906,
29896,
29890,
29896,
29890,
1495,
13,
4632,
29889,
3385,
29918,
1202,
877,
29930,
9634,
29889,
16382,
4366,
3306,
742,
525,
1332,
3246,
4346,
446,
1495,
13,
13,
29937,
1989,
995,
11000,
363,
7155,
9828,
13,
8768,
353,
518,
13,
1678,
6702,
22877,
29949,
1964,
19689,
2882,
2544,
2965,
29918,
29907,
5690,
4448,
742,
525,
22877,
29949,
1964,
19689,
2882,
2544,
2965,
29918,
29907,
5690,
4448,
5477,
13,
1678,
6702,
17744,
1806,
18474,
29918,
29907,
5690,
4448,
742,
525,
17744,
1806,
18474,
29918,
29907,
5690,
4448,
1495,
29871,
13,
29962,
13,
13,
29937,
11918,
304,
3787,
1857,
9262,
310,
7155,
2826,
13,
1131,
547,
2951,
29922,
1714,
9037,
580,
13,
1131,
547,
2951,
29889,
842,
877,
22877,
29949,
1964,
19689,
2882,
2544,
2965,
29918,
29907,
5690,
4448,
1495,
13,
13,
4775,
29898,
4632,
29892,
1426,
2433,
1299,
8687,
29968,
6732,
2824,
7720,
29898,
798,
29922,
29900,
29892,
1897,
29922,
29900,
29892,
17132,
29916,
29922,
29906,
29900,
29897,
13,
13,
29937,
13399,
9828,
13,
1454,
474,
297,
3464,
29898,
29906,
1125,
13,
1678,
9204,
3092,
29898,
13,
4706,
3876,
29892,
29871,
13,
4706,
1426,
29922,
8768,
29961,
29875,
3816,
29900,
1402,
13,
4706,
995,
29922,
8768,
29961,
29875,
3816,
29896,
1402,
29871,
13,
4706,
2286,
29922,
1131,
547,
2951,
29892,
13,
4706,
12141,
27996,
2264,
29922,
29900,
29892,
13,
4706,
6136,
7042,
2433,
29937,
29906,
29906,
29896,
29890,
29896,
29890,
742,
13,
4706,
6136,
1454,
18128,
2433,
1332,
3246,
4346,
446,
29915,
13,
1678,
13742,
7720,
29898,
13,
4706,
1948,
29922,
29900,
29892,
29871,
13,
4706,
1897,
29922,
29875,
29974,
29896,
29892,
29871,
13,
4706,
17132,
29916,
29922,
29906,
29900,
29892,
13,
4706,
282,
3714,
29922,
29906,
29900,
13,
1678,
1723,
13,
13,
29937,
1643,
304,
1510,
278,
1121,
13,
12011,
353,
15796,
29898,
4632,
29892,
1426,
2433,
2190,
23066,
1001,
379,
27267,
742,
11463,
572,
1477,
29922,
29955,
29900,
29900,
29892,
26922,
29922,
29907,
3919,
1001,
29897,
13,
12011,
29889,
7720,
29898,
798,
29922,
29896,
29892,
1897,
29922,
29900,
29892,
1897,
9653,
29922,
29941,
29892,
282,
3714,
29922,
29906,
29900,
29897,
13,
13,
29937,
8269,
11109,
304,
1881,
4583,
8096,
1426,
304,
26755,
13,
4775,
29898,
4632,
29892,
1426,
2433,
29907,
5690,
4448,
323,
12188,
2824,
7720,
29898,
798,
29922,
29953,
29892,
1897,
29922,
29900,
29897,
13,
455,
8096,
29911,
486,
353,
28236,
29898,
4632,
29897,
13,
455,
8096,
29911,
486,
29889,
7720,
29898,
798,
29922,
29953,
29892,
1897,
29922,
29896,
29892,
1897,
9653,
29922,
29906,
29892,
282,
3714,
29922,
29906,
29900,
29897,
13,
13,
29937,
3092,
304,
1246,
5337,
580,
13,
3125,
29898,
13,
1678,
3876,
29892,
13,
1678,
1426,
2433,
2287,
11341,
29979,
7982,
742,
29871,
13,
1678,
26922,
29922,
29907,
3919,
1001,
29892,
13,
1678,
1899,
29922,
2892,
29901,
5337,
29898,
13,
4706,
5337,
2951,
29889,
657,
3285,
13,
4706,
4583,
8096,
29911,
486,
29889,
657,
580,
13,
1678,
1723,
13,
467,
7720,
29898,
13,
1678,
1948,
29922,
29955,
29892,
29871,
13,
1678,
1897,
29922,
29900,
29892,
13,
1678,
1897,
9653,
29922,
29941,
29892,
29871,
13,
1678,
282,
3714,
29922,
29906,
29900,
13,
29897,
13,
13,
29937,
3396,
7888,
310,
18883,
1639,
3474,
13,
4632,
29889,
3396,
7888,
580,
13,
2
] |
src/waldur_auth_saml2/utils.py | geant-multicloud/MCMS-mastermind | 26 | 34735 | <filename>src/waldur_auth_saml2/utils.py<gh_stars>10-100
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from djangosaml2.conf import get_config
from djangosaml2.utils import available_idps
from saml2.attribute_converter import ac_factory
from saml2.mdstore import InMemoryMetaData, MetaDataFile
from saml2.mdstore import name as get_idp_name
from saml2.s_utils import UnknownSystemEntity
from . import models
def load_providers():
metadata = {}
for filename in settings.WALDUR_AUTH_SAML2['IDP_METADATA_LOCAL']:
mdf = MetaDataFile(ac_factory(), filename)
mdf.load()
metadata.update(mdf.items())
return metadata
def sync_providers():
providers = load_providers()
current_idps = list(models.IdentityProvider.objects.all().only('url', 'pk'))
backend_urls = set(providers.keys())
stale_idps = set(idp.pk for idp in current_idps if idp.url not in backend_urls)
models.IdentityProvider.objects.filter(pk__in=stale_idps).delete()
existing_urls = set(idp.url for idp in current_idps)
for url, metadata in providers.items():
name = get_idp_name(metadata)
if not name:
# It is expected that every provider has name. For corner cases check entity_id
name = metadata.get('entity_id')
if not name:
# Skip invalid identity provider
continue
if url in existing_urls:
# Skip identity provider if its url is already in the database
continue
models.IdentityProvider.objects.create(url=url, name=name, metadata=metadata)
for provider in models.IdentityProvider.objects.all().iterator():
backend_metadata = providers.get(provider.url)
if backend_metadata and provider.metadata != backend_metadata:
provider.metadata = backend_metadata
provider.save()
def is_valid_idp(value):
remote_providers = available_idps(get_config()).keys()
return (
value in remote_providers
or models.IdentityProvider.objects.filter(url=value).exists()
)
def get_idp_sso_supported_bindings(idp_entity_id, config):
try:
return config.metadata.service(
idp_entity_id, 'idpsso_descriptor', 'single_sign_on_service'
).keys()
except (UnknownSystemEntity, AttributeError):
return []
class DatabaseMetadataLoader(InMemoryMetaData):
def load(self, *args, **kwargs):
# Skip default parsing because data is not stored in file
pass
def __getitem__(self, item):
try:
return models.IdentityProvider.objects.get(url=item).metadata
except ObjectDoesNotExist:
raise KeyError
| [
1,
529,
9507,
29958,
4351,
29914,
18370,
332,
29918,
5150,
29918,
29879,
8807,
29906,
29914,
13239,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
3221,
29889,
11739,
29879,
1053,
4669,
25125,
3664,
1252,
391,
13,
3166,
270,
29926,
574,
359,
8807,
29906,
29889,
5527,
1053,
679,
29918,
2917,
13,
3166,
270,
29926,
574,
359,
8807,
29906,
29889,
13239,
1053,
3625,
29918,
333,
567,
13,
3166,
3514,
29880,
29906,
29889,
12715,
29918,
535,
13549,
1053,
1274,
29918,
14399,
13,
3166,
3514,
29880,
29906,
29889,
3487,
8899,
1053,
512,
16015,
19346,
1469,
29892,
20553,
1469,
2283,
13,
3166,
3514,
29880,
29906,
29889,
3487,
8899,
1053,
1024,
408,
679,
29918,
333,
29886,
29918,
978,
13,
3166,
3514,
29880,
29906,
29889,
29879,
29918,
13239,
1053,
853,
5203,
3924,
6691,
13,
13,
3166,
869,
1053,
4733,
13,
13,
13,
1753,
2254,
29918,
771,
29454,
7295,
13,
1678,
15562,
353,
6571,
13,
1678,
363,
10422,
297,
6055,
29889,
29956,
1964,
29928,
4574,
29918,
20656,
29950,
29918,
8132,
1988,
29906,
1839,
1367,
29925,
29918,
2303,
29911,
3035,
8254,
29918,
16652,
1964,
2033,
29901,
13,
4706,
286,
2176,
353,
20553,
1469,
2283,
29898,
562,
29918,
14399,
3285,
10422,
29897,
13,
4706,
286,
2176,
29889,
1359,
580,
13,
4706,
15562,
29889,
5504,
29898,
29885,
2176,
29889,
7076,
3101,
13,
1678,
736,
15562,
13,
13,
13,
1753,
16523,
29918,
771,
29454,
7295,
13,
1678,
1326,
11376,
353,
2254,
29918,
771,
29454,
580,
13,
13,
1678,
1857,
29918,
333,
567,
353,
1051,
29898,
9794,
29889,
18415,
6980,
29889,
12650,
29889,
497,
2141,
6194,
877,
2271,
742,
525,
20571,
8785,
13,
1678,
14998,
29918,
26045,
353,
731,
29898,
771,
29454,
29889,
8149,
3101,
13,
13,
1678,
380,
744,
29918,
333,
567,
353,
731,
29898,
333,
29886,
29889,
20571,
363,
1178,
29886,
297,
1857,
29918,
333,
567,
565,
1178,
29886,
29889,
2271,
451,
297,
14998,
29918,
26045,
29897,
13,
1678,
4733,
29889,
18415,
6980,
29889,
12650,
29889,
4572,
29898,
20571,
1649,
262,
29922,
303,
744,
29918,
333,
567,
467,
8143,
580,
13,
13,
1678,
5923,
29918,
26045,
353,
731,
29898,
333,
29886,
29889,
2271,
363,
1178,
29886,
297,
1857,
29918,
333,
567,
29897,
13,
13,
1678,
363,
3142,
29892,
15562,
297,
1326,
11376,
29889,
7076,
7295,
13,
4706,
1024,
353,
679,
29918,
333,
29886,
29918,
978,
29898,
19635,
29897,
13,
4706,
565,
451,
1024,
29901,
13,
9651,
396,
739,
338,
3806,
393,
1432,
13113,
756,
1024,
29889,
1152,
11155,
4251,
1423,
7855,
29918,
333,
13,
9651,
1024,
353,
15562,
29889,
657,
877,
10041,
29918,
333,
1495,
13,
9651,
565,
451,
1024,
29901,
13,
18884,
396,
4971,
666,
8340,
10110,
13113,
13,
18884,
6773,
13,
4706,
565,
3142,
297,
5923,
29918,
26045,
29901,
13,
9651,
396,
4971,
666,
10110,
13113,
565,
967,
3142,
338,
2307,
297,
278,
2566,
13,
9651,
6773,
13,
4706,
4733,
29889,
18415,
6980,
29889,
12650,
29889,
3258,
29898,
2271,
29922,
2271,
29892,
1024,
29922,
978,
29892,
15562,
29922,
19635,
29897,
13,
13,
1678,
363,
13113,
297,
4733,
29889,
18415,
6980,
29889,
12650,
29889,
497,
2141,
17609,
7295,
13,
4706,
14998,
29918,
19635,
353,
1326,
11376,
29889,
657,
29898,
18121,
29889,
2271,
29897,
13,
4706,
565,
14998,
29918,
19635,
322,
13113,
29889,
19635,
2804,
14998,
29918,
19635,
29901,
13,
9651,
13113,
29889,
19635,
353,
14998,
29918,
19635,
13,
9651,
13113,
29889,
7620,
580,
13,
13,
13,
1753,
338,
29918,
3084,
29918,
333,
29886,
29898,
1767,
1125,
13,
1678,
7592,
29918,
771,
29454,
353,
3625,
29918,
333,
567,
29898,
657,
29918,
2917,
16655,
8149,
580,
13,
1678,
736,
313,
13,
4706,
995,
297,
7592,
29918,
771,
29454,
13,
4706,
470,
4733,
29889,
18415,
6980,
29889,
12650,
29889,
4572,
29898,
2271,
29922,
1767,
467,
9933,
580,
13,
1678,
1723,
13,
13,
13,
1753,
679,
29918,
333,
29886,
29918,
29879,
578,
29918,
23765,
29918,
5355,
886,
29898,
333,
29886,
29918,
10041,
29918,
333,
29892,
2295,
1125,
13,
1678,
1018,
29901,
13,
4706,
736,
2295,
29889,
19635,
29889,
5509,
29898,
13,
9651,
1178,
29886,
29918,
10041,
29918,
333,
29892,
525,
333,
567,
578,
29918,
2783,
11709,
742,
525,
14369,
29918,
4530,
29918,
265,
29918,
5509,
29915,
13,
4706,
13742,
8149,
580,
13,
1678,
5174,
313,
14148,
3924,
6691,
29892,
23833,
2392,
1125,
13,
4706,
736,
5159,
13,
13,
13,
1990,
5470,
18417,
10036,
29898,
797,
16015,
19346,
1469,
1125,
13,
1678,
822,
2254,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
396,
4971,
666,
2322,
13755,
1363,
848,
338,
451,
6087,
297,
934,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2944,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
4733,
29889,
18415,
6980,
29889,
12650,
29889,
657,
29898,
2271,
29922,
667,
467,
19635,
13,
4706,
5174,
4669,
25125,
3664,
1252,
391,
29901,
13,
9651,
12020,
7670,
2392,
13,
2
] |
MusicTager/components/dialog/auto_meatadata_dialog.py | Mai-icy/MusicTagger | 3 | 1601322 | <reponame>Mai-icy/MusicTagger<filename>MusicTager/components/dialog/auto_meatadata_dialog.py
#!/usr/bin/python
# -*- coding:utf-8 -*-
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from ui.ui_source.AutoMetadataDialog import Ui_AutoMetadataDialog
from components.mask_widget import MaskWidget
class AutoMetadataDialog(QDialog, Ui_AutoMetadataDialog):
add_signal = pyqtSignal(str)
prepare_close_signal = pyqtSignal(str)
def __init__(self, parent=None):
super(AutoMetadataDialog, self).__init__(parent)
self.setupUi(self)
self.add_signal.connect(self.value_add)
self.prepare_close_signal.connect(self.prepare_reject)
def set_max(self, maximum):
self.progressBar.setMaximum(maximum)
def value_add(self):
now_value = self.progressBar.value()
if now_value + 1 == self.progressBar.maximum():
self.prepare_reject()
self.progressBar.setValue(now_value + 1)
def show(self) -> None:
self.progressBar.reset()
self.label.setText("正在为你自动补充元数据")
self._set_mask_visible(True)
super(AutoMetadataDialog, self).show()
def done(self, a0: int) -> None:
self._set_mask_visible(False)
super(AutoMetadataDialog, self).done(a0)
def reject(self) -> None:
self.parent().stop_auto = True
self.label.setText("正在中断操作...")
def prepare_reject(self):
super(AutoMetadataDialog, self).reject()
def _set_mask_visible(self, flag: bool):
if self.parent():
if not hasattr(self.parent(), "mask_widget"):
self.parent().mask_widget = MaskWidget(self.parent())
if flag:
self.parent().mask_widget.show()
else:
self.parent().mask_widget.hide()
| [
1,
529,
276,
1112,
420,
29958,
29924,
1794,
29899,
4245,
29914,
21238,
8176,
914,
29966,
9507,
29958,
21238,
29911,
1875,
29914,
14036,
29914,
15901,
29914,
6921,
29918,
1004,
271,
7221,
29918,
15901,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
13,
29937,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
13,
3166,
10772,
17303,
29945,
29889,
17303,
9203,
1053,
334,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
334,
13,
3166,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
334,
13,
13,
3166,
14313,
29889,
1481,
29918,
4993,
29889,
12300,
18417,
7647,
1053,
501,
29875,
29918,
12300,
18417,
7647,
13,
3166,
7117,
29889,
13168,
29918,
8030,
1053,
341,
1278,
8801,
13,
13,
13,
1990,
11133,
18417,
7647,
29898,
29984,
7647,
29892,
501,
29875,
29918,
12300,
18417,
7647,
1125,
13,
1678,
788,
29918,
25436,
353,
11451,
17915,
10140,
284,
29898,
710,
29897,
13,
1678,
19012,
29918,
5358,
29918,
25436,
353,
11451,
17915,
10140,
284,
29898,
710,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3847,
29922,
8516,
1125,
13,
4706,
2428,
29898,
12300,
18417,
7647,
29892,
1583,
467,
1649,
2344,
12035,
3560,
29897,
13,
4706,
1583,
29889,
14669,
29965,
29875,
29898,
1311,
29897,
13,
4706,
1583,
29889,
1202,
29918,
25436,
29889,
6915,
29898,
1311,
29889,
1767,
29918,
1202,
29897,
13,
4706,
1583,
29889,
19125,
29918,
5358,
29918,
25436,
29889,
6915,
29898,
1311,
29889,
19125,
29918,
276,
622,
29897,
13,
13,
1678,
822,
731,
29918,
3317,
29898,
1311,
29892,
7472,
1125,
13,
4706,
1583,
29889,
18035,
4297,
29889,
842,
7976,
12539,
29898,
27525,
398,
29897,
13,
13,
1678,
822,
995,
29918,
1202,
29898,
1311,
1125,
13,
4706,
1286,
29918,
1767,
353,
1583,
29889,
18035,
4297,
29889,
1767,
580,
13,
4706,
565,
1286,
29918,
1767,
718,
29871,
29896,
1275,
1583,
29889,
18035,
4297,
29889,
27525,
398,
7295,
13,
9651,
1583,
29889,
19125,
29918,
276,
622,
580,
13,
4706,
1583,
29889,
18035,
4297,
29889,
842,
1917,
29898,
3707,
29918,
1767,
718,
29871,
29896,
29897,
13,
13,
1678,
822,
1510,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1583,
29889,
18035,
4297,
29889,
12071,
580,
13,
4706,
1583,
29889,
1643,
29889,
12038,
703,
30724,
30505,
30573,
30919,
30688,
30846,
235,
164,
168,
232,
136,
136,
30824,
30354,
30763,
1159,
13,
4706,
1583,
3032,
842,
29918,
13168,
29918,
12872,
29898,
5574,
29897,
13,
4706,
2428,
29898,
12300,
18417,
7647,
29892,
1583,
467,
4294,
580,
13,
13,
1678,
822,
2309,
29898,
1311,
29892,
263,
29900,
29901,
938,
29897,
1599,
6213,
29901,
13,
4706,
1583,
3032,
842,
29918,
13168,
29918,
12872,
29898,
8824,
29897,
13,
4706,
2428,
29898,
12300,
18417,
7647,
29892,
1583,
467,
15091,
29898,
29874,
29900,
29897,
13,
268,
13,
1678,
822,
12560,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1583,
29889,
3560,
2141,
9847,
29918,
6921,
353,
5852,
13,
4706,
1583,
29889,
1643,
29889,
12038,
703,
30724,
30505,
30275,
31683,
31904,
30732,
856,
1159,
13,
13,
1678,
822,
19012,
29918,
276,
622,
29898,
1311,
1125,
13,
4706,
2428,
29898,
12300,
18417,
7647,
29892,
1583,
467,
276,
622,
580,
13,
268,
13,
1678,
822,
903,
842,
29918,
13168,
29918,
12872,
29898,
1311,
29892,
7353,
29901,
6120,
1125,
13,
4706,
565,
1583,
29889,
3560,
7295,
13,
9651,
565,
451,
756,
5552,
29898,
1311,
29889,
3560,
3285,
376,
13168,
29918,
8030,
29908,
1125,
13,
18884,
1583,
29889,
3560,
2141,
13168,
29918,
8030,
353,
341,
1278,
8801,
29898,
1311,
29889,
3560,
3101,
13,
9651,
565,
7353,
29901,
13,
18884,
1583,
29889,
3560,
2141,
13168,
29918,
8030,
29889,
4294,
580,
13,
9651,
1683,
29901,
13,
18884,
1583,
29889,
3560,
2141,
13168,
29918,
8030,
29889,
11458,
580,
13,
2
] |
package.py | OSS-Pipeline/rez-boost | 0 | 53097 | <reponame>OSS-Pipeline/rez-boost<filename>package.py
name = "boost"
version = "1.61.0"
authors = [
"<NAME>",
"<NAME>"
]
description = \
"""
Boost is a set of libraries for the C++ programming language that provide support for tasks and structures such
as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions,
and unit testing.
"""
requires = [
"cmake-3+",
"gcc-6+",
"python-2.7+"
]
variants = [
["platform-linux"]
]
tools = [
"boost"
]
build_system = "cmake"
with scope("config") as config:
config.build_thread_count = "logical_cores"
uuid = "boost-{version}".format(version=str(version))
def commands():
env.LD_LIBRARY_PATH.prepend("{root}/lib")
# Helper environment variables.
env.BOOST_INCLUDE_PATH.set("{root}/include")
env.BOOST_LIBRARY_PATH.set("{root}/lib")
| [
1,
529,
276,
1112,
420,
29958,
29949,
1799,
29899,
29925,
23828,
29914,
15749,
29899,
17079,
29966,
9507,
29958,
5113,
29889,
2272,
13,
978,
353,
376,
17079,
29908,
13,
13,
3259,
353,
376,
29896,
29889,
29953,
29896,
29889,
29900,
29908,
13,
13,
5150,
943,
353,
518,
13,
1678,
9872,
5813,
28341,
13,
1678,
9872,
5813,
11903,
13,
29962,
13,
13,
8216,
353,
320,
13,
1678,
9995,
13,
1678,
1952,
520,
338,
263,
731,
310,
9562,
363,
278,
315,
1817,
8720,
4086,
393,
3867,
2304,
363,
9595,
322,
12286,
1316,
13,
1678,
408,
5608,
9623,
29892,
19923,
272,
2685,
1353,
12623,
29892,
1773,
389,
19715,
29892,
1967,
9068,
29892,
4943,
12241,
29892,
13,
1678,
322,
5190,
6724,
29889,
13,
1678,
9995,
13,
13,
276,
339,
2658,
353,
518,
13,
1678,
376,
29883,
5675,
29899,
29941,
29974,
613,
13,
1678,
376,
19644,
29899,
29953,
29974,
613,
13,
1678,
376,
4691,
29899,
29906,
29889,
29955,
13578,
13,
29962,
13,
13,
5927,
1934,
353,
518,
13,
1678,
6796,
12120,
29899,
9389,
3108,
13,
29962,
13,
13,
8504,
353,
518,
13,
1678,
376,
17079,
29908,
13,
29962,
13,
13,
4282,
29918,
5205,
353,
376,
29883,
5675,
29908,
13,
13,
2541,
6874,
703,
2917,
1159,
408,
2295,
29901,
13,
1678,
2295,
29889,
4282,
29918,
7097,
29918,
2798,
353,
376,
1188,
936,
29918,
29883,
2361,
29908,
13,
13,
25118,
353,
376,
17079,
29899,
29912,
3259,
29913,
1642,
4830,
29898,
3259,
29922,
710,
29898,
3259,
876,
13,
13,
1753,
8260,
7295,
13,
1678,
8829,
29889,
10249,
29918,
5265,
15176,
19926,
29918,
10145,
29889,
1457,
14081,
703,
29912,
4632,
6822,
1982,
1159,
13,
13,
1678,
396,
6162,
546,
5177,
3651,
29889,
13,
1678,
8829,
29889,
8456,
3718,
29918,
1177,
6154,
29965,
2287,
29918,
10145,
29889,
842,
703,
29912,
4632,
6822,
2856,
1159,
13,
1678,
8829,
29889,
8456,
3718,
29918,
5265,
15176,
19926,
29918,
10145,
29889,
842,
703,
29912,
4632,
6822,
1982,
1159,
13,
2
] |
orbit_predictor/predictors/base.py | Juanlu001/orbit-predictor | 0 | 9794 | <gh_stars>0
# MIT License
#
# Copyright (c) 2017 <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.
import datetime as dt
import logging
import warnings
from collections import namedtuple
from math import pi, acos, degrees, radians
import numpy as np
try:
from scipy.optimize import brentq, minimize_scalar
except ImportError:
warnings.warn('scipy module was not found, some features may not work properly.',
ImportWarning)
from orbit_predictor.constants import MU_E
from orbit_predictor.exceptions import NotReachable, PropagationError
from orbit_predictor import coordinate_systems
from orbit_predictor.keplerian import rv2coe
from orbit_predictor.utils import (
angle_between,
cross_product,
dot_product,
reify,
vector_diff,
vector_norm,
gstime_from_datetime,
get_shadow,
get_sun,
eclipse_duration,
get_satellite_minus_penumbra_verticals,
)
logger = logging.getLogger(__name__)
ONE_SECOND = dt.timedelta(seconds=1)
def round_datetime(dt_):
return dt_
class Position(namedtuple(
"Position", ['when_utc', 'position_ecef', 'velocity_ecef', 'error_estimate'])):
@reify
def position_llh(self):
"""Latitude (deg), longitude (deg), altitude (km)."""
return coordinate_systems.ecef_to_llh(self.position_ecef)
@reify
def osculating_elements(self):
"""Osculating Keplerian orbital elements.
Semimajor axis (km), eccentricity, inclination (deg),
right ascension of the ascending node or RAAN (deg),
argument of perigee (deg), true anomaly (deg).
"""
gmst = gstime_from_datetime(self.when_utc)
position_eci = coordinate_systems.ecef_to_eci(self.position_ecef, gmst)
velocity_eci = coordinate_systems.ecef_to_eci(self.velocity_ecef, gmst)
# Convert position to Keplerian osculating elements
p, ecc, inc, raan, argp, ta = rv2coe(
MU_E, np.array(position_eci), np.array(velocity_eci)
)
# Transform to more familiar semimajor axis
sma = p / (1 - ecc ** 2)
return sma, ecc, degrees(inc), degrees(raan), degrees(argp), degrees(ta)
class PredictedPass:
def __init__(self, location, sate_id,
max_elevation_deg,
aos, los, duration_s,
max_elevation_position=None,
max_elevation_date=None):
self.location = location
self.sate_id = sate_id
self.max_elevation_position = max_elevation_position
self.max_elevation_date = max_elevation_date
self.max_elevation_deg = max_elevation_deg
self.aos = aos
self.los = los
self.duration_s = duration_s
@property
def midpoint(self):
"""Returns a datetime of the midpoint of the pass"""
return self.aos + (self.los - self.aos) / 2
def __repr__(self):
return "<PredictedPass {} over {} on {}>".format(self.sate_id, self.location, self.aos)
def __eq__(self, other):
return all([issubclass(other.__class__, PredictedPass),
self.location == other.location,
self.sate_id == other.sate_id,
self.max_elevation_position == other.max_elevation_position,
self.max_elevation_date == other.max_elevation_date,
self.max_elevation_deg == other.max_elevation_deg,
self.aos == other.aos,
self.los == other.los,
self.duration_s == other.duration_s])
def get_off_nadir_angle(self):
warnings.warn("This method is deprecated!", DeprecationWarning)
return self.off_nadir_deg
@reify
def off_nadir_deg(self):
"""Computes off-nadir angle calculation
Given satellite position ``sate_pos``, velocity ``sate_vel``, and
location ``target`` in a common frame, off-nadir angle ``off_nadir_angle``
is given by:
t2b = sate_pos - target
cos(off_nadir_angle) = (sate_pos · t2b) # Vectorial dot product
_______________________
|| sate_pos || || t2b||
Sign for the rotation is calculated this way
cross = target ⨯ sate_pos
sign = cross · sate_vel
____________________
| cross · sate_vel |
"""
sate_pos = self.max_elevation_position.position_ecef
sate_vel = self.max_elevation_position.velocity_ecef
target = self.location.position_ecef
t2b = vector_diff(sate_pos, target)
angle = acos(
dot_product(sate_pos, t2b) / (vector_norm(sate_pos) * vector_norm(t2b))
)
cross = cross_product(target, sate_pos)
dot = dot_product(cross, sate_vel)
try:
sign = dot / abs(dot)
except ZeroDivisionError:
sign = 1
return degrees(angle) * sign
class Predictor:
@property
def sate_id(self):
raise NotImplementedError
def propagate_eci(self, when_utc=None):
raise NotImplementedError
def get_position(self, when_utc=None):
raise NotImplementedError("You have to implement it!")
def get_shadow(self, when_utc=None):
"""Gives illumination at given time (2 for illuminated, 1 for penumbra, 0 for umbra)."""
if when_utc is None:
when_utc = dt.datetime.utcnow()
return get_shadow(
self.get_position(when_utc).position_ecef,
when_utc
)
def get_normal_vector(self, when_utc=None):
"""Gets unitary normal vector (orthogonal to orbital plane) at given time."""
if when_utc is None:
when_utc = dt.datetime.utcnow()
position, velocity = self.propagate_eci(when_utc)
orbital_plane_normal = np.cross(position, velocity)
return orbital_plane_normal / vector_norm(orbital_plane_normal)
def get_beta(self, when_utc=None):
"""Gets angle between orbital plane and Sun direction (beta) at given time, in degrees."""
if when_utc is None:
when_utc = dt.datetime.utcnow()
# Here we calculate the complementary angle of beta,
# because we use the normal vector of the orbital plane
beta_comp = angle_between(
get_sun(when_utc),
self.get_normal_vector(when_utc)
)
# We subtract from 90 degrees to return the real beta angle
return 90 - beta_comp
class CartesianPredictor(Predictor):
def _propagate_ecef(self, when_utc=None):
"""Return position and velocity in the given date using ECEF coordinate system."""
if when_utc is None:
when_utc = dt.datetime.utcnow()
position_eci, velocity_eci = self.propagate_eci(when_utc)
gmst = gstime_from_datetime(when_utc)
position_ecef = coordinate_systems.eci_to_ecef(position_eci, gmst)
velocity_ecef = coordinate_systems.eci_to_ecef(velocity_eci, gmst)
return position_ecef, velocity_ecef
@reify
def mean_motion(self):
"""Mean motion, in radians per minute"""
raise NotImplementedError
@reify
def period(self):
"""Orbital period, in minutes"""
return 2 * pi / self.mean_motion
def get_position(self, when_utc=None):
"""Return a Position namedtuple in ECEF coordinate system"""
if when_utc is None:
when_utc = dt.datetime.utcnow()
position_ecef, velocity_ecef = self._propagate_ecef(when_utc)
return Position(when_utc=when_utc, position_ecef=position_ecef,
velocity_ecef=velocity_ecef, error_estimate=None)
def get_only_position(self, when_utc=None):
"""Return a tuple in ECEF coordinate system"""
return self.get_position(when_utc).position_ecef
def get_eclipse_duration(self, when_utc=None, tolerance=1e-1):
"""Gets eclipse duration at given time, in minutes"""
ecc = self.get_position(when_utc).osculating_elements[1]
if ecc > tolerance:
raise NotImplementedError("Non circular orbits are not supported")
beta = self.get_beta(when_utc)
return eclipse_duration(beta, self.period)
def passes_over(self, location, when_utc, limit_date=None, max_elevation_gt=0, aos_at_dg=0):
return LocationPredictor(location, self, when_utc, limit_date,
max_elevation_gt, aos_at_dg)
def get_next_pass(self, location, when_utc=None, max_elevation_gt=5,
aos_at_dg=0, limit_date=None):
"""Return a PredictedPass instance with the data of the next pass over the given location
location_llh: point on Earth we want to see from the satellite.
when_utc: datetime UTC after which the pass is calculated, default to now.
max_elevation_gt: filter passes with max_elevation under it.
aos_at_dg: This is if we want to start the pass at a specific elevation.
The next pass with a LOS strictly after when_utc will be returned,
possibly the current pass.
"""
if when_utc is None:
when_utc = dt.datetime.utcnow()
for pass_ in self.passes_over(location, when_utc, limit_date,
max_elevation_gt=max_elevation_gt,
aos_at_dg=aos_at_dg):
return pass_
else:
raise NotReachable('Propagation limit date exceeded')
def eclipses_since(self, when_utc=None, limit_date=None):
"""
An iterator that yields all eclipses start and end times between
when_utc and limit_date.
The next eclipse with a end strictly after when_utc will be returned,
possibly the current eclipse.
The last eclipse returned starts before limit_date, but it can end
strictly after limit_date.
No circular orbits are not supported, and will raise NotImplementedError.
"""
def _get_illumination(t):
my_start = start + dt.timedelta(seconds=t)
result = get_satellite_minus_penumbra_verticals(
self.get_only_position(my_start),
my_start
)
return result
if when_utc is None:
when_utc = dt.datetime.utcnow()
orbital_period_s = self.period * 60
# A third of the orbit period is used as the base window of the search.
# This window ensures the function get_satellite_minus_penumbra_verticals
# will not have more than one local minimum (one in the illuminated phase and
# the other in penumbra).
base_search_window_s = orbital_period_s / 3
start = when_utc
while limit_date is None or start < limit_date:
# a minimum negative value is aproximatelly the middle point of the eclipse
minimum_illumination = minimize_scalar(
_get_illumination,
bounds=(0, base_search_window_s),
method="bounded",
options={"xatol": 1e-2},
)
eclipse_center_candidate_delta_s = minimum_illumination.x
# If found a minimum that is not illuminated, there is an eclipse here
if _get_illumination(eclipse_center_candidate_delta_s) < 0:
# The small time interval to search zeros around the center
# is estimated with the expected eclipse duration (which generally
# is smaller than expected, and that is the reason of the 1.5 coeficient).
# Also a minimum of 180 seconds was added because
# in some cases the estimation is 0 even though there is an eclipse.
eclipse_duration_estimation_s = self.get_eclipse_duration(start) * 60
zero_search_window_s = max(180, 1.5 * eclipse_duration_estimation_s)
# Search now both zeros to get the start and end of the eclipse
eclipse_start_delta_s = brentq(
_get_illumination,
eclipse_center_candidate_delta_s - zero_search_window_s,
eclipse_center_candidate_delta_s,
xtol=1e-2,
full_output=False,
)
eclipse_end_delta_s = brentq(
_get_illumination,
eclipse_center_candidate_delta_s,
eclipse_center_candidate_delta_s + zero_search_window_s,
xtol=1e-2,
full_output=False,
)
eclipse_start = start + dt.timedelta(seconds=eclipse_start_delta_s)
eclipse_end = start + dt.timedelta(seconds=eclipse_end_delta_s)
yield eclipse_start, eclipse_end
start = eclipse_end + dt.timedelta(seconds=base_search_window_s)
else:
start += dt.timedelta(seconds=base_search_window_s)
class GPSPredictor(Predictor):
pass
class LocationPredictor:
"""Predicts passes over a given location
Exposes an iterable interface
"""
def __init__(self, location, predictor, start_date, limit_date=None,
max_elevation_gt=0, aos_at_dg=0, *, propagator=None):
if propagator is not None:
warnings.warn(
"propagator parameter was renamed to predictor "
"and will be removed in a future release",
DeprecationWarning
)
predictor = propagator
self.location = location
self.predictor = predictor
self.start_date = start_date
self.limit_date = limit_date
self.max_elevation_gt = radians(max([max_elevation_gt, aos_at_dg]))
self.aos_at = radians(aos_at_dg)
@property
def propagator(self):
warnings.warn(
"propagator parameter was renamed to predictor "
"and will be removed in a future release",
DeprecationWarning
)
return self.predictor
def __iter__(self):
"""Returns one pass each time"""
current_date = self.start_date
while True:
if self.is_ascending(current_date):
# we need a descending point
ascending_date = current_date
descending_date = self._find_nearest_descending(ascending_date)
pass_ = self._refine_pass(ascending_date, descending_date)
if pass_.valid:
if self.limit_date is not None and pass_.aos > self.limit_date:
break
yield self._build_predicted_pass(pass_)
if self.limit_date is not None and current_date > self.limit_date:
break
current_date = pass_.tca + self._orbit_step(0.6)
else:
current_date = self._find_nearest_ascending(current_date)
def _build_predicted_pass(self, accuratepass):
"""Returns a classic predicted pass"""
tca_position = self.predictor.get_position(accuratepass.tca)
return PredictedPass(self.location, self.predictor.sate_id,
max_elevation_deg=accuratepass.max_elevation_deg,
aos=accuratepass.aos,
los=accuratepass.los,
duration_s=accuratepass.duration.total_seconds(),
max_elevation_position=tca_position,
max_elevation_date=accuratepass.tca,
)
def _find_nearest_descending(self, ascending_date):
for candidate in self._sample_points(ascending_date):
if not self.is_ascending(candidate):
return candidate
else:
logger.error('Could not find a descending pass over %s start date: %s - TLE: %s',
self.location, ascending_date, self.predictor.tle)
raise PropagationError("Can not find an descending phase")
def _find_nearest_ascending(self, descending_date):
for candidate in self._sample_points(descending_date):
if self.is_ascending(candidate):
return candidate
else:
logger.error('Could not find an ascending pass over %s start date: %s - TLE: %s',
self.location, descending_date, self.predictor.tle)
raise PropagationError('Can not find an ascending phase')
def _sample_points(self, date):
"""Helper method to found ascending or descending phases of elevation"""
start = date
end = date + self._orbit_step(0.99)
mid = self.midpoint(start, end)
mid_right = self.midpoint(mid, end)
mid_left = self.midpoint(start, mid)
return [end, mid, mid_right, mid_left]
def _refine_pass(self, ascending_date, descending_date):
tca = self._find_tca(ascending_date, descending_date)
elevation = self._elevation_at(tca)
if elevation > self.max_elevation_gt:
aos = self._find_aos(tca)
los = self._find_los(tca)
else:
aos = los = None
return AccuratePredictedPass(aos, tca, los, elevation)
def _find_tca(self, ascending_date, descending_date):
while not self._precision_reached(ascending_date, descending_date):
midpoint = self.midpoint(ascending_date, descending_date)
if self.is_ascending(midpoint):
ascending_date = midpoint
else:
descending_date = midpoint
return ascending_date
def _precision_reached(self, start, end):
# TODO: Allow the precision to change from the outside
return end - start <= ONE_SECOND
@staticmethod
def midpoint(start, end):
"""Returns the midpoint between two dates"""
return start + (end - start) / 2
def _elevation_at(self, when_utc):
position = self.predictor.get_only_position(when_utc)
return self.location.elevation_for(position)
def is_passing(self, when_utc):
"""Returns a boolean indicating if satellite is actually visible"""
return bool(self._elevation_at(when_utc))
def is_ascending(self, when_utc):
"""Check is elevation is ascending or descending on a given point"""
elevation = self._elevation_at(when_utc)
next_elevation = self._elevation_at(when_utc + ONE_SECOND)
return elevation <= next_elevation
def _orbit_step(self, size):
"""Returns a time step, that will make the satellite advance a given number of orbits"""
step_in_radians = size * 2 * pi
seconds = (step_in_radians / self.predictor.mean_motion) * 60
return dt.timedelta(seconds=seconds)
def _find_aos(self, tca):
end = tca
start = tca - self._orbit_step(0.34) # On third of the orbit
elevation = self._elevation_at(start)
assert elevation < 0
while not self._precision_reached(start, end):
midpoint = self.midpoint(start, end)
elevation = self._elevation_at(midpoint)
if elevation < self.aos_at:
start = midpoint
else:
end = midpoint
return end
def _find_los(self, tca):
start = tca
end = tca + self._orbit_step(0.34)
while not self._precision_reached(start, end):
midpoint = self.midpoint(start, end)
elevation = self._elevation_at(midpoint)
if elevation < self.aos_at:
end = midpoint
else:
start = midpoint
return start
class AccuratePredictedPass:
def __init__(self, aos, tca, los, max_elevation):
self.aos = round_datetime(aos) if aos is not None else None
self.tca = round_datetime(tca)
self.los = round_datetime(los) if los is not None else None
self.max_elevation = max_elevation
@property
def valid(self):
return self.max_elevation > 0 and self.aos is not None and self.los is not None
@reify
def max_elevation_deg(self):
return degrees(self.max_elevation)
@reify
def duration(self):
return self.los - self.aos
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
341,
1806,
19245,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29955,
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,
13,
5215,
12865,
408,
11636,
13,
5215,
12183,
13,
5215,
18116,
13,
3166,
16250,
1053,
4257,
23583,
13,
3166,
5844,
1053,
2930,
29892,
1274,
359,
29892,
14496,
29892,
2971,
5834,
13,
13,
5215,
12655,
408,
7442,
13,
2202,
29901,
13,
1678,
515,
4560,
2272,
29889,
20640,
675,
1053,
1506,
296,
29939,
29892,
6260,
675,
29918,
19529,
279,
13,
19499,
16032,
2392,
29901,
13,
1678,
18116,
29889,
25442,
877,
26167,
2272,
3883,
471,
451,
1476,
29892,
777,
5680,
1122,
451,
664,
6284,
29889,
742,
13,
462,
29871,
16032,
22709,
29897,
13,
13,
3166,
16980,
29918,
27711,
272,
29889,
3075,
1934,
1053,
341,
29965,
29918,
29923,
13,
3166,
16980,
29918,
27711,
272,
29889,
11739,
29879,
1053,
2216,
1123,
496,
519,
29892,
1019,
13573,
362,
2392,
13,
3166,
16980,
29918,
27711,
272,
1053,
14821,
29918,
5205,
29879,
13,
3166,
16980,
29918,
27711,
272,
29889,
446,
20069,
713,
1053,
364,
29894,
29906,
1111,
29872,
13,
3166,
16980,
29918,
27711,
272,
29889,
13239,
1053,
313,
13,
1678,
10696,
29918,
14811,
29892,
13,
1678,
4891,
29918,
4704,
29892,
13,
1678,
8329,
29918,
4704,
29892,
13,
1678,
337,
1598,
29892,
13,
1678,
4608,
29918,
12765,
29892,
13,
1678,
4608,
29918,
12324,
29892,
13,
1678,
330,
303,
603,
29918,
3166,
29918,
12673,
29892,
13,
1678,
679,
29918,
17505,
29892,
13,
1678,
679,
29918,
11445,
29892,
13,
1678,
16517,
29918,
19708,
29892,
13,
1678,
679,
29918,
29879,
271,
20911,
29918,
12254,
29918,
2238,
398,
2634,
29918,
18575,
29879,
29892,
13,
29897,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
12413,
29918,
1660,
6007,
29928,
353,
11636,
29889,
9346,
287,
2554,
29898,
23128,
29922,
29896,
29897,
13,
13,
13,
1753,
4513,
29918,
12673,
29898,
6008,
29918,
1125,
13,
1678,
736,
11636,
29918,
13,
13,
13,
1990,
20627,
29898,
17514,
23583,
29898,
13,
4706,
376,
8003,
613,
6024,
8256,
29918,
329,
29883,
742,
525,
3283,
29918,
29872,
346,
29888,
742,
525,
955,
25245,
29918,
29872,
346,
29888,
742,
525,
2704,
29918,
342,
6490,
2033,
22164,
13,
13,
1678,
732,
276,
1598,
13,
1678,
822,
2602,
29918,
645,
29882,
29898,
1311,
1125,
13,
4706,
9995,
13992,
4279,
313,
12163,
511,
28745,
313,
12163,
511,
5272,
4279,
313,
8848,
467,
15945,
29908,
13,
4706,
736,
14821,
29918,
5205,
29879,
29889,
29872,
346,
29888,
29918,
517,
29918,
645,
29882,
29898,
1311,
29889,
3283,
29918,
29872,
346,
29888,
29897,
13,
13,
1678,
732,
276,
1598,
13,
1678,
822,
15199,
18099,
29918,
17664,
29898,
1311,
1125,
13,
4706,
9995,
29949,
1557,
18099,
4813,
20069,
713,
19528,
2410,
3161,
29889,
13,
13,
4706,
9444,
326,
1175,
272,
9685,
313,
8848,
511,
16882,
296,
2200,
537,
29892,
1343,
3381,
313,
12163,
511,
13,
4706,
1492,
12066,
2673,
310,
278,
12066,
2548,
2943,
470,
18865,
2190,
313,
12163,
511,
13,
4706,
2980,
310,
639,
2231,
29872,
313,
12163,
511,
1565,
29342,
14997,
313,
12163,
467,
13,
13,
4706,
9995,
13,
4706,
330,
29885,
303,
353,
330,
303,
603,
29918,
3166,
29918,
12673,
29898,
1311,
29889,
8256,
29918,
329,
29883,
29897,
13,
4706,
2602,
29918,
29872,
455,
353,
14821,
29918,
5205,
29879,
29889,
29872,
346,
29888,
29918,
517,
29918,
29872,
455,
29898,
1311,
29889,
3283,
29918,
29872,
346,
29888,
29892,
330,
29885,
303,
29897,
13,
4706,
12885,
29918,
29872,
455,
353,
14821,
29918,
5205,
29879,
29889,
29872,
346,
29888,
29918,
517,
29918,
29872,
455,
29898,
1311,
29889,
955,
25245,
29918,
29872,
346,
29888,
29892,
330,
29885,
303,
29897,
13,
13,
4706,
396,
14806,
2602,
304,
4813,
20069,
713,
15199,
18099,
3161,
13,
4706,
282,
29892,
16882,
29892,
5528,
29892,
1153,
273,
29892,
1852,
29886,
29892,
11062,
353,
364,
29894,
29906,
1111,
29872,
29898,
13,
9651,
341,
29965,
29918,
29923,
29892,
7442,
29889,
2378,
29898,
3283,
29918,
29872,
455,
511,
7442,
29889,
2378,
29898,
955,
25245,
29918,
29872,
455,
29897,
13,
4706,
1723,
13,
4706,
396,
4103,
689,
304,
901,
9985,
3031,
326,
1175,
272,
9685,
13,
4706,
269,
655,
353,
282,
847,
313,
29896,
448,
16882,
3579,
29871,
29906,
29897,
13,
13,
4706,
736,
269,
655,
29892,
16882,
29892,
14496,
29898,
3742,
511,
14496,
29898,
336,
273,
511,
14496,
29898,
1191,
29886,
511,
14496,
29898,
941,
29897,
13,
13,
13,
1990,
21099,
18186,
7129,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
269,
403,
29918,
333,
29892,
13,
462,
4236,
29918,
29872,
2608,
362,
29918,
12163,
29892,
13,
462,
21405,
29892,
1232,
29892,
14385,
29918,
29879,
29892,
13,
462,
4236,
29918,
29872,
2608,
362,
29918,
3283,
29922,
8516,
29892,
13,
462,
4236,
29918,
29872,
2608,
362,
29918,
1256,
29922,
8516,
1125,
13,
4706,
1583,
29889,
5479,
353,
4423,
13,
4706,
1583,
29889,
29879,
403,
29918,
333,
353,
269,
403,
29918,
333,
13,
4706,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
3283,
353,
4236,
29918,
29872,
2608,
362,
29918,
3283,
13,
4706,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
1256,
353,
4236,
29918,
29872,
2608,
362,
29918,
1256,
13,
4706,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
12163,
353,
4236,
29918,
29872,
2608,
362,
29918,
12163,
13,
4706,
1583,
29889,
29874,
359,
353,
21405,
13,
4706,
1583,
29889,
5409,
353,
1232,
13,
4706,
1583,
29889,
19708,
29918,
29879,
353,
14385,
29918,
29879,
13,
13,
1678,
732,
6799,
13,
1678,
822,
7145,
3149,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
263,
12865,
310,
278,
7145,
3149,
310,
278,
1209,
15945,
29908,
13,
4706,
736,
1583,
29889,
29874,
359,
718,
313,
1311,
29889,
5409,
448,
1583,
29889,
29874,
359,
29897,
847,
29871,
29906,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
9872,
23084,
18186,
7129,
6571,
975,
6571,
373,
6571,
29958,
1642,
4830,
29898,
1311,
29889,
29879,
403,
29918,
333,
29892,
1583,
29889,
5479,
29892,
1583,
29889,
29874,
359,
29897,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
599,
4197,
790,
431,
1990,
29898,
1228,
17255,
1990,
1649,
29892,
21099,
18186,
7129,
511,
13,
462,
1678,
1583,
29889,
5479,
1275,
916,
29889,
5479,
29892,
13,
462,
1678,
1583,
29889,
29879,
403,
29918,
333,
1275,
916,
29889,
29879,
403,
29918,
333,
29892,
13,
462,
1678,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
3283,
1275,
916,
29889,
3317,
29918,
29872,
2608,
362,
29918,
3283,
29892,
13,
462,
1678,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
1256,
1275,
916,
29889,
3317,
29918,
29872,
2608,
362,
29918,
1256,
29892,
13,
462,
1678,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
12163,
1275,
916,
29889,
3317,
29918,
29872,
2608,
362,
29918,
12163,
29892,
13,
462,
1678,
1583,
29889,
29874,
359,
1275,
916,
29889,
29874,
359,
29892,
13,
462,
1678,
1583,
29889,
5409,
1275,
916,
29889,
5409,
29892,
13,
462,
1678,
1583,
29889,
19708,
29918,
29879,
1275,
916,
29889,
19708,
29918,
29879,
2314,
13,
13,
1678,
822,
679,
29918,
2696,
29918,
28486,
381,
29918,
2521,
29898,
1311,
1125,
13,
4706,
18116,
29889,
25442,
703,
4013,
1158,
338,
18164,
29991,
613,
897,
1457,
9252,
22709,
29897,
13,
4706,
736,
1583,
29889,
2696,
29918,
28486,
381,
29918,
12163,
13,
13,
1678,
732,
276,
1598,
13,
1678,
822,
1283,
29918,
28486,
381,
29918,
12163,
29898,
1311,
1125,
13,
4706,
9995,
20606,
267,
1283,
29899,
28486,
381,
10696,
13944,
13,
13,
4706,
11221,
28421,
2602,
4954,
29879,
403,
29918,
1066,
29952,
1673,
12885,
4954,
29879,
403,
29918,
955,
29952,
1673,
322,
13,
4706,
4423,
4954,
5182,
16159,
297,
263,
3619,
3515,
29892,
1283,
29899,
28486,
381,
10696,
4954,
2696,
29918,
28486,
381,
29918,
2521,
16159,
13,
4706,
338,
2183,
491,
29901,
13,
9651,
260,
29906,
29890,
353,
269,
403,
29918,
1066,
448,
3646,
13,
9651,
6776,
29898,
2696,
29918,
28486,
381,
29918,
2521,
29897,
353,
268,
313,
29879,
403,
29918,
1066,
29871,
2880,
260,
29906,
29890,
29897,
268,
396,
16510,
616,
8329,
3234,
13,
462,
462,
1678,
903,
27097,
7652,
1649,
13,
462,
462,
1678,
3830,
269,
403,
29918,
1066,
3830,
3830,
260,
29906,
29890,
8876,
13,
13,
4706,
9954,
363,
278,
13733,
338,
12833,
445,
982,
13,
13,
4706,
4891,
353,
3646,
29871,
229,
171,
178,
269,
403,
29918,
1066,
13,
4706,
1804,
353,
259,
4891,
2880,
269,
403,
29918,
955,
13,
1669,
903,
27097,
22359,
13,
1669,
891,
4891,
2880,
269,
403,
29918,
955,
891,
13,
4706,
9995,
13,
4706,
269,
403,
29918,
1066,
353,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
3283,
29889,
3283,
29918,
29872,
346,
29888,
13,
4706,
269,
403,
29918,
955,
353,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
3283,
29889,
955,
25245,
29918,
29872,
346,
29888,
13,
4706,
3646,
353,
1583,
29889,
5479,
29889,
3283,
29918,
29872,
346,
29888,
13,
4706,
260,
29906,
29890,
353,
4608,
29918,
12765,
29898,
29879,
403,
29918,
1066,
29892,
3646,
29897,
13,
4706,
10696,
353,
1274,
359,
29898,
13,
9651,
8329,
29918,
4704,
29898,
29879,
403,
29918,
1066,
29892,
260,
29906,
29890,
29897,
847,
313,
8111,
29918,
12324,
29898,
29879,
403,
29918,
1066,
29897,
334,
4608,
29918,
12324,
29898,
29873,
29906,
29890,
876,
13,
4706,
1723,
13,
13,
4706,
4891,
353,
4891,
29918,
4704,
29898,
5182,
29892,
269,
403,
29918,
1066,
29897,
13,
4706,
8329,
353,
8329,
29918,
4704,
29898,
19128,
29892,
269,
403,
29918,
955,
29897,
13,
4706,
1018,
29901,
13,
9651,
1804,
353,
8329,
847,
6425,
29898,
6333,
29897,
13,
4706,
5174,
28933,
12596,
2459,
2392,
29901,
13,
9651,
1804,
353,
29871,
29896,
13,
13,
4706,
736,
14496,
29898,
2521,
29897,
334,
1804,
13,
13,
13,
1990,
21099,
919,
272,
29901,
13,
13,
1678,
732,
6799,
13,
1678,
822,
269,
403,
29918,
333,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
13089,
403,
29918,
29872,
455,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
679,
29918,
3283,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
703,
3492,
505,
304,
2334,
372,
29991,
1159,
13,
13,
1678,
822,
679,
29918,
17505,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
9995,
29954,
3145,
4486,
398,
3381,
472,
2183,
931,
313,
29906,
363,
4486,
9735,
630,
29892,
29871,
29896,
363,
6584,
398,
2634,
29892,
29871,
29900,
363,
1922,
2634,
467,
15945,
29908,
13,
4706,
565,
746,
29918,
329,
29883,
338,
6213,
29901,
13,
9651,
746,
29918,
329,
29883,
353,
11636,
29889,
12673,
29889,
329,
29883,
3707,
580,
13,
13,
4706,
736,
679,
29918,
17505,
29898,
13,
9651,
1583,
29889,
657,
29918,
3283,
29898,
8256,
29918,
329,
29883,
467,
3283,
29918,
29872,
346,
29888,
29892,
13,
9651,
746,
29918,
329,
29883,
13,
4706,
1723,
13,
13,
1678,
822,
679,
29918,
8945,
29918,
8111,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
9995,
29954,
1691,
5190,
653,
4226,
4608,
313,
2072,
23419,
304,
19528,
2410,
10694,
29897,
472,
2183,
931,
1213,
15945,
13,
4706,
565,
746,
29918,
329,
29883,
338,
6213,
29901,
13,
9651,
746,
29918,
329,
29883,
353,
11636,
29889,
12673,
29889,
329,
29883,
3707,
580,
13,
13,
4706,
2602,
29892,
12885,
353,
1583,
29889,
7728,
351,
403,
29918,
29872,
455,
29898,
8256,
29918,
329,
29883,
29897,
13,
4706,
19528,
2410,
29918,
22116,
29918,
8945,
353,
7442,
29889,
19128,
29898,
3283,
29892,
12885,
29897,
13,
4706,
736,
19528,
2410,
29918,
22116,
29918,
8945,
847,
4608,
29918,
12324,
29898,
11831,
2410,
29918,
22116,
29918,
8945,
29897,
13,
13,
1678,
822,
679,
29918,
3571,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
9995,
29954,
1691,
10696,
1546,
19528,
2410,
10694,
322,
8991,
5305,
313,
3571,
29897,
472,
2183,
931,
29892,
297,
14496,
1213,
15945,
13,
4706,
565,
746,
29918,
329,
29883,
338,
6213,
29901,
13,
9651,
746,
29918,
329,
29883,
353,
11636,
29889,
12673,
29889,
329,
29883,
3707,
580,
13,
13,
4706,
396,
2266,
591,
8147,
278,
19595,
653,
10696,
310,
21762,
29892,
13,
4706,
396,
1363,
591,
671,
278,
4226,
4608,
310,
278,
19528,
2410,
10694,
13,
4706,
21762,
29918,
2388,
353,
10696,
29918,
14811,
29898,
13,
9651,
679,
29918,
11445,
29898,
8256,
29918,
329,
29883,
511,
13,
9651,
1583,
29889,
657,
29918,
8945,
29918,
8111,
29898,
8256,
29918,
329,
29883,
29897,
13,
4706,
1723,
13,
13,
4706,
396,
1334,
23197,
515,
29871,
29929,
29900,
14496,
304,
736,
278,
1855,
21762,
10696,
13,
4706,
736,
29871,
29929,
29900,
448,
21762,
29918,
2388,
13,
13,
13,
1990,
12370,
18970,
23084,
919,
272,
29898,
23084,
919,
272,
1125,
13,
13,
1678,
822,
903,
7728,
351,
403,
29918,
29872,
346,
29888,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
9995,
11609,
2602,
322,
12885,
297,
278,
2183,
2635,
773,
382,
4741,
29943,
14821,
1788,
1213,
15945,
13,
4706,
565,
746,
29918,
329,
29883,
338,
6213,
29901,
13,
9651,
746,
29918,
329,
29883,
353,
11636,
29889,
12673,
29889,
329,
29883,
3707,
580,
13,
13,
4706,
2602,
29918,
29872,
455,
29892,
12885,
29918,
29872,
455,
353,
1583,
29889,
7728,
351,
403,
29918,
29872,
455,
29898,
8256,
29918,
329,
29883,
29897,
13,
4706,
330,
29885,
303,
353,
330,
303,
603,
29918,
3166,
29918,
12673,
29898,
8256,
29918,
329,
29883,
29897,
13,
4706,
2602,
29918,
29872,
346,
29888,
353,
14821,
29918,
5205,
29879,
29889,
29872,
455,
29918,
517,
29918,
29872,
346,
29888,
29898,
3283,
29918,
29872,
455,
29892,
330,
29885,
303,
29897,
13,
4706,
12885,
29918,
29872,
346,
29888,
353,
14821,
29918,
5205,
29879,
29889,
29872,
455,
29918,
517,
29918,
29872,
346,
29888,
29898,
955,
25245,
29918,
29872,
455,
29892,
330,
29885,
303,
29897,
13,
4706,
736,
2602,
29918,
29872,
346,
29888,
29892,
12885,
29918,
29872,
346,
29888,
13,
13,
1678,
732,
276,
1598,
13,
1678,
822,
2099,
29918,
29885,
8194,
29898,
1311,
1125,
13,
4706,
9995,
6816,
273,
10884,
29892,
297,
2971,
5834,
639,
11015,
15945,
29908,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
732,
276,
1598,
13,
1678,
822,
3785,
29898,
1311,
1125,
13,
4706,
9995,
2816,
29890,
2410,
3785,
29892,
297,
6233,
15945,
29908,
13,
4706,
736,
29871,
29906,
334,
2930,
847,
1583,
29889,
12676,
29918,
29885,
8194,
13,
13,
1678,
822,
679,
29918,
3283,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
9995,
11609,
263,
20627,
4257,
23583,
297,
382,
4741,
29943,
14821,
1788,
15945,
29908,
13,
4706,
565,
746,
29918,
329,
29883,
338,
6213,
29901,
13,
9651,
746,
29918,
329,
29883,
353,
11636,
29889,
12673,
29889,
329,
29883,
3707,
580,
13,
13,
4706,
2602,
29918,
29872,
346,
29888,
29892,
12885,
29918,
29872,
346,
29888,
353,
1583,
3032,
7728,
351,
403,
29918,
29872,
346,
29888,
29898,
8256,
29918,
329,
29883,
29897,
13,
13,
4706,
736,
20627,
29898,
8256,
29918,
329,
29883,
29922,
8256,
29918,
329,
29883,
29892,
2602,
29918,
29872,
346,
29888,
29922,
3283,
29918,
29872,
346,
29888,
29892,
13,
462,
4706,
12885,
29918,
29872,
346,
29888,
29922,
955,
25245,
29918,
29872,
346,
29888,
29892,
1059,
29918,
342,
6490,
29922,
8516,
29897,
13,
13,
1678,
822,
679,
29918,
6194,
29918,
3283,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
1125,
13,
4706,
9995,
11609,
263,
18761,
297,
382,
4741,
29943,
14821,
1788,
15945,
29908,
13,
4706,
736,
1583,
29889,
657,
29918,
3283,
29898,
8256,
29918,
329,
29883,
467,
3283,
29918,
29872,
346,
29888,
13,
13,
1678,
822,
679,
29918,
13660,
29918,
19708,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
29892,
20341,
749,
29922,
29896,
29872,
29899,
29896,
1125,
13,
4706,
9995,
29954,
1691,
16517,
14385,
472,
2183,
931,
29892,
297,
6233,
15945,
29908,
13,
4706,
16882,
353,
1583,
29889,
657,
29918,
3283,
29898,
8256,
29918,
329,
29883,
467,
359,
1810,
1218,
29918,
17664,
29961,
29896,
29962,
13,
4706,
565,
16882,
1405,
20341,
749,
29901,
13,
9651,
12020,
2216,
1888,
2037,
287,
2392,
703,
12283,
19308,
470,
14836,
526,
451,
6969,
1159,
13,
13,
4706,
21762,
353,
1583,
29889,
657,
29918,
3571,
29898,
8256,
29918,
329,
29883,
29897,
13,
4706,
736,
16517,
29918,
19708,
29898,
3571,
29892,
1583,
29889,
19145,
29897,
13,
13,
1678,
822,
14517,
29918,
957,
29898,
1311,
29892,
4423,
29892,
746,
29918,
329,
29883,
29892,
4046,
29918,
1256,
29922,
8516,
29892,
4236,
29918,
29872,
2608,
362,
29918,
4141,
29922,
29900,
29892,
21405,
29918,
271,
29918,
20726,
29922,
29900,
1125,
13,
4706,
736,
17015,
23084,
919,
272,
29898,
5479,
29892,
1583,
29892,
746,
29918,
329,
29883,
29892,
4046,
29918,
1256,
29892,
13,
462,
462,
4236,
29918,
29872,
2608,
362,
29918,
4141,
29892,
21405,
29918,
271,
29918,
20726,
29897,
13,
13,
1678,
822,
679,
29918,
4622,
29918,
3364,
29898,
1311,
29892,
4423,
29892,
746,
29918,
329,
29883,
29922,
8516,
29892,
4236,
29918,
29872,
2608,
362,
29918,
4141,
29922,
29945,
29892,
13,
462,
418,
21405,
29918,
271,
29918,
20726,
29922,
29900,
29892,
4046,
29918,
1256,
29922,
8516,
1125,
13,
4706,
9995,
11609,
263,
21099,
18186,
7129,
2777,
411,
278,
848,
310,
278,
2446,
1209,
975,
278,
2183,
4423,
13,
13,
4706,
4423,
29918,
645,
29882,
29901,
1298,
373,
11563,
591,
864,
304,
1074,
515,
278,
28421,
29889,
13,
4706,
746,
29918,
329,
29883,
29901,
12865,
17998,
1156,
607,
278,
1209,
338,
12833,
29892,
2322,
304,
1286,
29889,
13,
4706,
4236,
29918,
29872,
2608,
362,
29918,
4141,
29901,
4175,
14517,
411,
4236,
29918,
29872,
2608,
362,
1090,
372,
29889,
13,
4706,
21405,
29918,
271,
29918,
20726,
29901,
910,
338,
565,
591,
864,
304,
1369,
278,
1209,
472,
263,
2702,
11858,
362,
29889,
13,
13,
4706,
450,
2446,
1209,
411,
263,
365,
3267,
18719,
1156,
746,
29918,
329,
29883,
674,
367,
4133,
29892,
13,
4706,
10075,
278,
1857,
1209,
29889,
13,
4706,
9995,
13,
4706,
565,
746,
29918,
329,
29883,
338,
6213,
29901,
13,
9651,
746,
29918,
329,
29883,
353,
11636,
29889,
12673,
29889,
329,
29883,
3707,
580,
13,
13,
4706,
363,
1209,
29918,
297,
1583,
29889,
3364,
267,
29918,
957,
29898,
5479,
29892,
746,
29918,
329,
29883,
29892,
4046,
29918,
1256,
29892,
13,
462,
462,
418,
4236,
29918,
29872,
2608,
362,
29918,
4141,
29922,
3317,
29918,
29872,
2608,
362,
29918,
4141,
29892,
13,
462,
462,
418,
21405,
29918,
271,
29918,
20726,
29922,
29874,
359,
29918,
271,
29918,
20726,
1125,
13,
9651,
736,
1209,
29918,
13,
4706,
1683,
29901,
13,
9651,
12020,
2216,
1123,
496,
519,
877,
1184,
13573,
362,
4046,
2635,
13461,
287,
1495,
13,
13,
1678,
822,
321,
11303,
567,
267,
29918,
16076,
29898,
1311,
29892,
746,
29918,
329,
29883,
29922,
8516,
29892,
4046,
29918,
1256,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
530,
20380,
393,
17498,
599,
321,
11303,
567,
267,
1369,
322,
1095,
3064,
1546,
13,
4706,
746,
29918,
329,
29883,
322,
4046,
29918,
1256,
29889,
13,
13,
4706,
450,
2446,
16517,
411,
263,
1095,
18719,
1156,
746,
29918,
329,
29883,
674,
367,
4133,
29892,
13,
4706,
10075,
278,
1857,
16517,
29889,
13,
4706,
450,
1833,
16517,
4133,
8665,
1434,
4046,
29918,
1256,
29892,
541,
372,
508,
1095,
13,
4706,
18719,
1156,
4046,
29918,
1256,
29889,
13,
4706,
1939,
19308,
470,
14836,
526,
451,
6969,
29892,
322,
674,
12020,
2216,
1888,
2037,
287,
2392,
29889,
13,
4706,
9995,
13,
4706,
822,
903,
657,
29918,
453,
398,
3381,
29898,
29873,
1125,
13,
9651,
590,
29918,
2962,
353,
1369,
718,
11636,
29889,
9346,
287,
2554,
29898,
23128,
29922,
29873,
29897,
13,
9651,
1121,
353,
679,
29918,
29879,
271,
20911,
29918,
12254,
29918,
2238,
398,
2634,
29918,
18575,
29879,
29898,
13,
18884,
1583,
29889,
657,
29918,
6194,
29918,
3283,
29898,
1357,
29918,
2962,
511,
13,
18884,
590,
29918,
2962,
13,
9651,
1723,
13,
9651,
736,
1121,
13,
13,
4706,
565,
746,
29918,
329,
29883,
338,
6213,
29901,
13,
9651,
746,
29918,
329,
29883,
353,
11636,
29889,
12673,
29889,
329,
29883,
3707,
580,
13,
13,
4706,
19528,
2410,
29918,
19145,
29918,
29879,
353,
1583,
29889,
19145,
334,
29871,
29953,
29900,
13,
4706,
396,
319,
4654,
310,
278,
16980,
3785,
338,
1304,
408,
278,
2967,
3474,
310,
278,
2740,
29889,
13,
4706,
396,
910,
3474,
5662,
1973,
278,
740,
679,
29918,
29879,
271,
20911,
29918,
12254,
29918,
2238,
398,
2634,
29918,
18575,
29879,
13,
4706,
396,
674,
451,
505,
901,
1135,
697,
1887,
9212,
313,
650,
297,
278,
4486,
9735,
630,
8576,
322,
13,
4706,
396,
278,
916,
297,
6584,
398,
2634,
467,
13,
4706,
2967,
29918,
4478,
29918,
7165,
29918,
29879,
353,
19528,
2410,
29918,
19145,
29918,
29879,
847,
29871,
29941,
13,
4706,
1369,
353,
746,
29918,
329,
29883,
13,
13,
4706,
1550,
4046,
29918,
1256,
338,
6213,
470,
1369,
529,
4046,
29918,
1256,
29901,
13,
13,
9651,
396,
263,
9212,
8178,
995,
338,
22422,
271,
14112,
278,
7256,
1298,
310,
278,
16517,
13,
9651,
9212,
29918,
453,
398,
3381,
353,
6260,
675,
29918,
19529,
279,
29898,
13,
18884,
903,
657,
29918,
453,
398,
3381,
29892,
13,
18884,
13451,
7607,
29900,
29892,
2967,
29918,
4478,
29918,
7165,
29918,
29879,
511,
13,
18884,
1158,
543,
29306,
613,
13,
18884,
3987,
3790,
29908,
29916,
14947,
1115,
29871,
29896,
29872,
29899,
29906,
1118,
13,
9651,
1723,
13,
9651,
16517,
29918,
5064,
29918,
29883,
5380,
403,
29918,
4181,
29918,
29879,
353,
9212,
29918,
453,
398,
3381,
29889,
29916,
13,
13,
9651,
396,
960,
1476,
263,
9212,
393,
338,
451,
4486,
9735,
630,
29892,
727,
338,
385,
16517,
1244,
13,
9651,
565,
903,
657,
29918,
453,
398,
3381,
29898,
13660,
29918,
5064,
29918,
29883,
5380,
403,
29918,
4181,
29918,
29879,
29897,
529,
29871,
29900,
29901,
13,
18884,
396,
450,
2319,
931,
7292,
304,
2740,
24786,
2820,
278,
4818,
13,
18884,
396,
338,
15899,
411,
278,
3806,
16517,
14385,
313,
4716,
6892,
13,
18884,
396,
338,
7968,
1135,
3806,
29892,
322,
393,
338,
278,
2769,
310,
278,
29871,
29896,
29889,
29945,
1302,
1389,
293,
993,
467,
13,
18884,
396,
3115,
263,
9212,
310,
29871,
29896,
29947,
29900,
6923,
471,
2715,
1363,
13,
18884,
396,
297,
777,
4251,
278,
23248,
338,
29871,
29900,
1584,
2466,
727,
338,
385,
16517,
29889,
13,
18884,
16517,
29918,
19708,
29918,
342,
7715,
29918,
29879,
353,
1583,
29889,
657,
29918,
13660,
29918,
19708,
29898,
2962,
29897,
334,
29871,
29953,
29900,
13,
18884,
5225,
29918,
4478,
29918,
7165,
29918,
29879,
353,
4236,
29898,
29896,
29947,
29900,
29892,
29871,
29896,
29889,
29945,
334,
16517,
29918,
19708,
29918,
342,
7715,
29918,
29879,
29897,
13,
13,
18884,
396,
11856,
1286,
1716,
24786,
304,
679,
278,
1369,
322,
1095,
310,
278,
16517,
13,
18884,
16517,
29918,
2962,
29918,
4181,
29918,
29879,
353,
1506,
296,
29939,
29898,
13,
462,
1678,
903,
657,
29918,
453,
398,
3381,
29892,
13,
462,
1678,
16517,
29918,
5064,
29918,
29883,
5380,
403,
29918,
4181,
29918,
29879,
448,
5225,
29918,
4478,
29918,
7165,
29918,
29879,
29892,
13,
462,
1678,
16517,
29918,
5064,
29918,
29883,
5380,
403,
29918,
4181,
29918,
29879,
29892,
13,
462,
268,
486,
324,
29922,
29896,
29872,
29899,
29906,
29892,
13,
462,
1678,
2989,
29918,
4905,
29922,
8824,
29892,
13,
18884,
1723,
13,
18884,
16517,
29918,
355,
29918,
4181,
29918,
29879,
353,
1506,
296,
29939,
29898,
13,
462,
1678,
903,
657,
29918,
453,
398,
3381,
29892,
13,
462,
1678,
16517,
29918,
5064,
29918,
29883,
5380,
403,
29918,
4181,
29918,
29879,
29892,
13,
462,
1678,
16517,
29918,
5064,
29918,
29883,
5380,
403,
29918,
4181,
29918,
29879,
718,
5225,
29918,
4478,
29918,
7165,
29918,
29879,
29892,
13,
462,
268,
486,
324,
29922,
29896,
29872,
29899,
29906,
29892,
13,
462,
1678,
2989,
29918,
4905,
29922,
8824,
29892,
13,
18884,
1723,
13,
18884,
16517,
29918,
2962,
353,
1369,
718,
11636,
29889,
9346,
287,
2554,
29898,
23128,
29922,
13660,
29918,
2962,
29918,
4181,
29918,
29879,
29897,
13,
18884,
16517,
29918,
355,
353,
1369,
718,
11636,
29889,
9346,
287,
2554,
29898,
23128,
29922,
13660,
29918,
355,
29918,
4181,
29918,
29879,
29897,
13,
18884,
7709,
16517,
29918,
2962,
29892,
16517,
29918,
355,
13,
18884,
1369,
353,
16517,
29918,
355,
718,
11636,
29889,
9346,
287,
2554,
29898,
23128,
29922,
3188,
29918,
4478,
29918,
7165,
29918,
29879,
29897,
13,
9651,
1683,
29901,
13,
18884,
1369,
4619,
11636,
29889,
9346,
287,
2554,
29898,
23128,
29922,
3188,
29918,
4478,
29918,
7165,
29918,
29879,
29897,
13,
13,
13,
1990,
28258,
5550,
1127,
919,
272,
29898,
23084,
919,
272,
1125,
13,
1678,
1209,
13,
13,
13,
1990,
17015,
23084,
919,
272,
29901,
13,
1678,
9995,
23084,
919,
29879,
14517,
975,
263,
2183,
4423,
13,
1678,
1222,
10590,
385,
4256,
519,
5067,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
8500,
272,
29892,
1369,
29918,
1256,
29892,
4046,
29918,
1256,
29922,
8516,
29892,
13,
462,
4236,
29918,
29872,
2608,
362,
29918,
4141,
29922,
29900,
29892,
21405,
29918,
271,
29918,
20726,
29922,
29900,
29892,
334,
29892,
13089,
1061,
29922,
8516,
1125,
13,
4706,
565,
13089,
1061,
338,
451,
6213,
29901,
13,
9651,
18116,
29889,
25442,
29898,
13,
18884,
376,
7728,
351,
1061,
3443,
471,
19533,
304,
8500,
272,
376,
13,
18884,
376,
392,
674,
367,
6206,
297,
263,
5434,
6507,
613,
13,
18884,
897,
1457,
9252,
22709,
13,
9651,
1723,
13,
9651,
8500,
272,
353,
13089,
1061,
13,
13,
4706,
1583,
29889,
5479,
353,
4423,
13,
4706,
1583,
29889,
27711,
272,
353,
8500,
272,
13,
4706,
1583,
29889,
2962,
29918,
1256,
353,
1369,
29918,
1256,
13,
4706,
1583,
29889,
13400,
29918,
1256,
353,
4046,
29918,
1256,
13,
13,
4706,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
4141,
353,
2971,
5834,
29898,
3317,
4197,
3317,
29918,
29872,
2608,
362,
29918,
4141,
29892,
21405,
29918,
271,
29918,
20726,
12622,
13,
4706,
1583,
29889,
29874,
359,
29918,
271,
353,
2971,
5834,
29898,
29874,
359,
29918,
271,
29918,
20726,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
13089,
1061,
29898,
1311,
1125,
13,
4706,
18116,
29889,
25442,
29898,
13,
9651,
376,
7728,
351,
1061,
3443,
471,
19533,
304,
8500,
272,
376,
13,
9651,
376,
392,
674,
367,
6206,
297,
263,
5434,
6507,
613,
13,
9651,
897,
1457,
9252,
22709,
13,
4706,
1723,
13,
4706,
736,
1583,
29889,
27711,
272,
13,
13,
1678,
822,
4770,
1524,
12035,
1311,
1125,
13,
4706,
9995,
11609,
29879,
697,
1209,
1269,
931,
15945,
29908,
13,
4706,
1857,
29918,
1256,
353,
1583,
29889,
2962,
29918,
1256,
13,
4706,
1550,
5852,
29901,
13,
9651,
565,
1583,
29889,
275,
29918,
6151,
2548,
29898,
3784,
29918,
1256,
1125,
13,
18884,
396,
591,
817,
263,
5153,
2548,
1298,
13,
18884,
12066,
2548,
29918,
1256,
353,
1857,
29918,
1256,
13,
18884,
5153,
2548,
29918,
1256,
353,
1583,
3032,
2886,
29918,
28502,
342,
29918,
14273,
2548,
29898,
6151,
2548,
29918,
1256,
29897,
13,
18884,
1209,
29918,
353,
1583,
3032,
999,
457,
29918,
3364,
29898,
6151,
2548,
29918,
1256,
29892,
5153,
2548,
29918,
1256,
29897,
13,
18884,
565,
1209,
5396,
3084,
29901,
13,
462,
1678,
565,
1583,
29889,
13400,
29918,
1256,
338,
451,
6213,
322,
1209,
5396,
29874,
359,
1405,
1583,
29889,
13400,
29918,
1256,
29901,
13,
462,
4706,
2867,
13,
462,
1678,
7709,
1583,
3032,
4282,
29918,
11965,
18186,
29918,
3364,
29898,
3364,
19925,
13,
13,
18884,
565,
1583,
29889,
13400,
29918,
1256,
338,
451,
6213,
322,
1857,
29918,
1256,
1405,
1583,
29889,
13400,
29918,
1256,
29901,
13,
462,
1678,
2867,
13,
13,
18884,
1857,
29918,
1256,
353,
1209,
5396,
29873,
1113,
718,
1583,
3032,
272,
2966,
29918,
10568,
29898,
29900,
29889,
29953,
29897,
13,
13,
9651,
1683,
29901,
13,
18884,
1857,
29918,
1256,
353,
1583,
3032,
2886,
29918,
28502,
342,
29918,
6151,
2548,
29898,
3784,
29918,
1256,
29897,
13,
13,
1678,
822,
903,
4282,
29918,
11965,
18186,
29918,
3364,
29898,
1311,
29892,
16232,
3364,
1125,
13,
4706,
9995,
11609,
29879,
263,
22037,
25383,
1209,
15945,
29908,
13,
4706,
260,
1113,
29918,
3283,
353,
1583,
29889,
27711,
272,
29889,
657,
29918,
3283,
29898,
562,
2764,
403,
3364,
29889,
29873,
1113,
29897,
13,
13,
4706,
736,
21099,
18186,
7129,
29898,
1311,
29889,
5479,
29892,
1583,
29889,
27711,
272,
29889,
29879,
403,
29918,
333,
29892,
13,
462,
632,
4236,
29918,
29872,
2608,
362,
29918,
12163,
29922,
562,
2764,
403,
3364,
29889,
3317,
29918,
29872,
2608,
362,
29918,
12163,
29892,
13,
462,
632,
21405,
29922,
562,
2764,
403,
3364,
29889,
29874,
359,
29892,
13,
462,
632,
1232,
29922,
562,
2764,
403,
3364,
29889,
5409,
29892,
13,
462,
632,
14385,
29918,
29879,
29922,
562,
2764,
403,
3364,
29889,
19708,
29889,
7827,
29918,
23128,
3285,
13,
462,
632,
4236,
29918,
29872,
2608,
362,
29918,
3283,
29922,
29873,
1113,
29918,
3283,
29892,
13,
462,
632,
4236,
29918,
29872,
2608,
362,
29918,
1256,
29922,
562,
2764,
403,
3364,
29889,
29873,
1113,
29892,
13,
462,
632,
1723,
13,
13,
1678,
822,
903,
2886,
29918,
28502,
342,
29918,
14273,
2548,
29898,
1311,
29892,
12066,
2548,
29918,
1256,
1125,
13,
4706,
363,
14020,
297,
1583,
3032,
11249,
29918,
9748,
29898,
6151,
2548,
29918,
1256,
1125,
13,
9651,
565,
451,
1583,
29889,
275,
29918,
6151,
2548,
29898,
29883,
5380,
403,
1125,
13,
18884,
736,
14020,
13,
4706,
1683,
29901,
13,
9651,
17927,
29889,
2704,
877,
23323,
451,
1284,
263,
5153,
2548,
1209,
975,
1273,
29879,
1369,
2635,
29901,
1273,
29879,
448,
323,
1307,
29901,
1273,
29879,
742,
13,
462,
308,
1583,
29889,
5479,
29892,
12066,
2548,
29918,
1256,
29892,
1583,
29889,
27711,
272,
29889,
29873,
280,
29897,
13,
9651,
12020,
1019,
13573,
362,
2392,
703,
6028,
451,
1284,
385,
5153,
2548,
8576,
1159,
13,
13,
1678,
822,
903,
2886,
29918,
28502,
342,
29918,
6151,
2548,
29898,
1311,
29892,
5153,
2548,
29918,
1256,
1125,
13,
4706,
363,
14020,
297,
1583,
3032,
11249,
29918,
9748,
29898,
14273,
2548,
29918,
1256,
1125,
13,
9651,
565,
1583,
29889,
275,
29918,
6151,
2548,
29898,
29883,
5380,
403,
1125,
13,
18884,
736,
14020,
13,
4706,
1683,
29901,
13,
9651,
17927,
29889,
2704,
877,
23323,
451,
1284,
385,
12066,
2548,
1209,
975,
1273,
29879,
1369,
2635,
29901,
1273,
29879,
448,
323,
1307,
29901,
1273,
29879,
742,
13,
462,
308,
1583,
29889,
5479,
29892,
5153,
2548,
29918,
1256,
29892,
1583,
29889,
27711,
272,
29889,
29873,
280,
29897,
13,
9651,
12020,
1019,
13573,
362,
2392,
877,
6028,
451,
1284,
385,
12066,
2548,
8576,
1495,
13,
13,
1678,
822,
903,
11249,
29918,
9748,
29898,
1311,
29892,
2635,
1125,
13,
4706,
9995,
10739,
1158,
304,
1476,
12066,
2548,
470,
5153,
2548,
29540,
310,
11858,
362,
15945,
29908,
13,
4706,
1369,
353,
2635,
13,
4706,
1095,
353,
2635,
718,
1583,
3032,
272,
2966,
29918,
10568,
29898,
29900,
29889,
29929,
29929,
29897,
13,
4706,
7145,
353,
1583,
29889,
6563,
3149,
29898,
2962,
29892,
1095,
29897,
13,
4706,
7145,
29918,
1266,
353,
1583,
29889,
6563,
3149,
29898,
6563,
29892,
1095,
29897,
13,
4706,
7145,
29918,
1563,
353,
1583,
29889,
6563,
3149,
29898,
2962,
29892,
7145,
29897,
13,
13,
4706,
736,
518,
355,
29892,
7145,
29892,
7145,
29918,
1266,
29892,
7145,
29918,
1563,
29962,
13,
13,
1678,
822,
903,
999,
457,
29918,
3364,
29898,
1311,
29892,
12066,
2548,
29918,
1256,
29892,
5153,
2548,
29918,
1256,
1125,
13,
4706,
260,
1113,
353,
1583,
3032,
2886,
29918,
29873,
1113,
29898,
6151,
2548,
29918,
1256,
29892,
5153,
2548,
29918,
1256,
29897,
13,
4706,
11858,
362,
353,
1583,
3032,
29872,
2608,
362,
29918,
271,
29898,
29873,
1113,
29897,
13,
13,
4706,
565,
11858,
362,
1405,
1583,
29889,
3317,
29918,
29872,
2608,
362,
29918,
4141,
29901,
13,
9651,
21405,
353,
1583,
3032,
2886,
29918,
29874,
359,
29898,
29873,
1113,
29897,
13,
9651,
1232,
353,
1583,
3032,
2886,
29918,
5409,
29898,
29873,
1113,
29897,
13,
4706,
1683,
29901,
13,
9651,
21405,
353,
1232,
353,
6213,
13,
13,
4706,
736,
4831,
332,
403,
23084,
18186,
7129,
29898,
29874,
359,
29892,
260,
1113,
29892,
1232,
29892,
11858,
362,
29897,
13,
13,
1678,
822,
903,
2886,
29918,
29873,
1113,
29898,
1311,
29892,
12066,
2548,
29918,
1256,
29892,
5153,
2548,
29918,
1256,
1125,
13,
4706,
1550,
451,
1583,
3032,
17990,
2459,
29918,
276,
3791,
29898,
6151,
2548,
29918,
1256,
29892,
5153,
2548,
29918,
1256,
1125,
13,
9651,
7145,
3149,
353,
1583,
29889,
6563,
3149,
29898,
6151,
2548,
29918,
1256,
29892,
5153,
2548,
29918,
1256,
29897,
13,
9651,
565,
1583,
29889,
275,
29918,
6151,
2548,
29898,
6563,
3149,
1125,
13,
18884,
12066,
2548,
29918,
1256,
353,
7145,
3149,
13,
9651,
1683,
29901,
13,
18884,
5153,
2548,
29918,
1256,
353,
7145,
3149,
13,
13,
4706,
736,
12066,
2548,
29918,
1256,
13,
13,
1678,
822,
903,
17990,
2459,
29918,
276,
3791,
29898,
1311,
29892,
1369,
29892,
1095,
1125,
13,
4706,
396,
14402,
29901,
29408,
278,
16716,
304,
1735,
515,
278,
5377,
13,
4706,
736,
1095,
448,
1369,
5277,
6732,
29923,
29918,
1660,
6007,
29928,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
7145,
3149,
29898,
2962,
29892,
1095,
1125,
13,
4706,
9995,
11609,
29879,
278,
7145,
3149,
1546,
1023,
10116,
15945,
29908,
13,
4706,
736,
1369,
718,
313,
355,
448,
1369,
29897,
847,
29871,
29906,
13,
13,
1678,
822,
903,
29872,
2608,
362,
29918,
271,
29898,
1311,
29892,
746,
29918,
329,
29883,
1125,
13,
4706,
2602,
353,
1583,
29889,
27711,
272,
29889,
657,
29918,
6194,
29918,
3283,
29898,
8256,
29918,
329,
29883,
29897,
13,
4706,
736,
1583,
29889,
5479,
29889,
29872,
2608,
362,
29918,
1454,
29898,
3283,
29897,
13,
13,
1678,
822,
338,
29918,
3364,
292,
29898,
1311,
29892,
746,
29918,
329,
29883,
1125,
13,
4706,
9995,
11609,
29879,
263,
7223,
23941,
565,
28421,
338,
2869,
7962,
15945,
29908,
13,
4706,
736,
6120,
29898,
1311,
3032,
29872,
2608,
362,
29918,
271,
29898,
8256,
29918,
329,
29883,
876,
13,
13,
1678,
822,
338,
29918,
6151,
2548,
29898,
1311,
29892,
746,
29918,
329,
29883,
1125,
13,
4706,
9995,
5596,
338,
11858,
362,
338,
12066,
2548,
470,
5153,
2548,
373,
263,
2183,
1298,
15945,
29908,
13,
4706,
11858,
362,
353,
1583,
3032,
29872,
2608,
362,
29918,
271,
29898,
8256,
29918,
329,
29883,
29897,
13,
4706,
2446,
29918,
29872,
2608,
362,
353,
1583,
3032,
29872,
2608,
362,
29918,
271,
29898,
8256,
29918,
329,
29883,
718,
6732,
29923,
29918,
1660,
6007,
29928,
29897,
13,
4706,
736,
11858,
362,
5277,
2446,
29918,
29872,
2608,
362,
13,
13,
1678,
822,
903,
272,
2966,
29918,
10568,
29898,
1311,
29892,
2159,
1125,
13,
4706,
9995,
11609,
29879,
263,
931,
4331,
29892,
393,
674,
1207,
278,
28421,
6564,
263,
2183,
1353,
310,
470,
14836,
15945,
29908,
13,
4706,
4331,
29918,
262,
29918,
3665,
5834,
353,
2159,
334,
29871,
29906,
334,
2930,
13,
4706,
6923,
353,
313,
10568,
29918,
262,
29918,
3665,
5834,
847,
1583,
29889,
27711,
272,
29889,
12676,
29918,
29885,
8194,
29897,
334,
29871,
29953,
29900,
13,
4706,
736,
11636,
29889,
9346,
287,
2554,
29898,
23128,
29922,
23128,
29897,
13,
13,
1678,
822,
903,
2886,
29918,
29874,
359,
29898,
1311,
29892,
260,
1113,
1125,
13,
4706,
1095,
353,
260,
1113,
13,
4706,
1369,
353,
260,
1113,
448,
1583,
3032,
272,
2966,
29918,
10568,
29898,
29900,
29889,
29941,
29946,
29897,
29871,
396,
1551,
4654,
310,
278,
16980,
13,
4706,
11858,
362,
353,
1583,
3032,
29872,
2608,
362,
29918,
271,
29898,
2962,
29897,
13,
4706,
4974,
11858,
362,
529,
29871,
29900,
13,
4706,
1550,
451,
1583,
3032,
17990,
2459,
29918,
276,
3791,
29898,
2962,
29892,
1095,
1125,
13,
9651,
7145,
3149,
353,
1583,
29889,
6563,
3149,
29898,
2962,
29892,
1095,
29897,
13,
9651,
11858,
362,
353,
1583,
3032,
29872,
2608,
362,
29918,
271,
29898,
6563,
3149,
29897,
13,
9651,
565,
11858,
362,
529,
1583,
29889,
29874,
359,
29918,
271,
29901,
13,
18884,
1369,
353,
7145,
3149,
13,
9651,
1683,
29901,
13,
18884,
1095,
353,
7145,
3149,
13,
4706,
736,
1095,
13,
13,
1678,
822,
903,
2886,
29918,
5409,
29898,
1311,
29892,
260,
1113,
1125,
13,
4706,
1369,
353,
260,
1113,
13,
4706,
1095,
353,
260,
1113,
718,
1583,
3032,
272,
2966,
29918,
10568,
29898,
29900,
29889,
29941,
29946,
29897,
13,
4706,
1550,
451,
1583,
3032,
17990,
2459,
29918,
276,
3791,
29898,
2962,
29892,
1095,
1125,
13,
9651,
7145,
3149,
353,
1583,
29889,
6563,
3149,
29898,
2962,
29892,
1095,
29897,
13,
9651,
11858,
362,
353,
1583,
3032,
29872,
2608,
362,
29918,
271,
29898,
6563,
3149,
29897,
13,
13,
9651,
565,
11858,
362,
529,
1583,
29889,
29874,
359,
29918,
271,
29901,
13,
18884,
1095,
353,
7145,
3149,
13,
9651,
1683,
29901,
13,
18884,
1369,
353,
7145,
3149,
13,
13,
4706,
736,
1369,
13,
13,
13,
1990,
4831,
332,
403,
23084,
18186,
7129,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
21405,
29892,
260,
1113,
29892,
1232,
29892,
4236,
29918,
29872,
2608,
362,
1125,
13,
4706,
1583,
29889,
29874,
359,
353,
4513,
29918,
12673,
29898,
29874,
359,
29897,
565,
21405,
338,
451,
6213,
1683,
6213,
13,
4706,
1583,
29889,
29873,
1113,
353,
4513,
29918,
12673,
29898,
29873,
1113,
29897,
13,
4706,
1583,
29889,
5409,
353,
4513,
29918,
12673,
29898,
5409,
29897,
565,
1232,
338,
451,
6213,
1683,
6213,
13,
4706,
1583,
29889,
3317,
29918,
29872,
2608,
362,
353,
4236,
29918,
29872,
2608,
362,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2854,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
3317,
29918,
29872,
2608,
362,
1405,
29871,
29900,
322,
1583,
29889,
29874,
359,
338,
451,
6213,
322,
1583,
29889,
5409,
338,
451,
6213,
13,
13,
1678,
732,
276,
1598,
13,
1678,
822,
4236,
29918,
29872,
2608,
362,
29918,
12163,
29898,
1311,
1125,
13,
4706,
736,
14496,
29898,
1311,
29889,
3317,
29918,
29872,
2608,
362,
29897,
13,
13,
1678,
732,
276,
1598,
13,
1678,
822,
14385,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5409,
448,
1583,
29889,
29874,
359,
13,
2
] |
pydov/util/hooks.py | TimFranken/pydov | 0 | 94603 | <gh_stars>0
# -*- coding: utf-8 -*-
"""Module implementing a simple hooks system to allow late-binding actions to
PyDOV events."""
import sys
import time
class AbstractHook(object):
"""Abstract base class for custom hook implementations.
Provides all available methods with a default implementation to do
nothing. This allows for hook subclasses to only implement the events
they need.
"""
def wfs_search_init(self, typename):
"""Called upon starting a WFS search.
Parameters
----------
typename : str
The typename (layername) of the WFS service used for searching.
"""
pass
def wfs_search_result(self, number_of_results):
"""Called after a WFS search finished.
Parameters
----------
number_of_results : int
The number of features returned by the WFS search.
"""
pass
def xml_requested(self, pkey_object):
"""Called upon requesting an XML document of an object.
This is either followed by ``xml_cache_hit`` or ``xml_downloaded``.
Parameters
----------
pkey_object : str
Permanent key of the requested object.
"""
pass
def xml_cache_hit(self, pkey_object):
"""Called when the XML document of an object is retrieved from the
cache.
Parameters
----------
pkey_object : str
Permanent key of the requested object.
"""
pass
def xml_downloaded(self, pkey_object):
"""Called when the XML document of an object is downloaded from the
DOV services.
Parameters
----------
pkey_object : str
Permanent key of the requested object.
"""
pass
class SimpleStatusHook(AbstractHook):
"""Simple hook implementation to print progress to stdout."""
def __init__(self):
"""Initialisation.
Initialise all variables to 0.
"""
self.result_count = 0
self.prog_counter = 0
self.init_time = None
self.previous_remaining = None
def _write_progress(self, char):
"""Write progress to standard output.
Progress is grouped on lines per 50 items, adding ``char`` for every
item processed.
Parameters
----------
char : str
Single character to print.
"""
if self.prog_counter == 0:
sys.stdout.write('[%03i/%03i] ' % (self.prog_counter,
self.result_count))
sys.stdout.flush()
elif self.prog_counter % 50 == 0:
time_elapsed = time.time() - self.init_time
time_per_item = time_elapsed/self.prog_counter
remaining_mins = int((time_per_item*(
self.result_count-self.prog_counter))/60)
if remaining_mins > 1 and remaining_mins != \
self.previous_remaining:
remaining = " (%i min. left)" % remaining_mins
self.previous_remaining = remaining_mins
else:
remaining = ""
sys.stdout.write('%s\n[%03i/%03i] ' % (
remaining, self.prog_counter, self.result_count))
sys.stdout.flush()
sys.stdout.write(char)
sys.stdout.flush()
self.prog_counter += 1
if self.prog_counter == self.result_count:
sys.stdout.write('\n')
sys.stdout.flush()
def wfs_search_init(self, typename):
"""When a new WFS search is started, reset all counters to 0.
Parameters
----------
typename : str
The typename (layername) of the WFS service used for searching.
"""
self.result_count = 0
self.prog_counter = 0
self.init_time = time.time()
self.previous_remaining = None
def wfs_search_result(self, number_of_results):
"""When the WFS search completes, set the total result count to
``number_of_results``.
Parameters
----------
number_of_results : int
The number of features returned by the WFS search.
"""
self.result_count = number_of_results
def xml_cache_hit(self, pkey_object):
"""When an XML document is retrieved from the cache, print 'c' to
the progress output.
Parameters
----------
pkey_object : str
Permanent key of the requested object.
"""
self._write_progress('c')
def xml_downloaded(self, pkey_object):
"""When an XML document is downloaded from the DOV services,
print '.' to the progress output.
Parameters
----------
pkey_object : str
Permanent key of the requested object.
"""
self._write_progress('.')
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
7355,
16049,
263,
2560,
12422,
29879,
1788,
304,
2758,
5683,
29899,
19672,
8820,
304,
13,
19737,
3970,
29963,
4959,
1213,
15945,
13,
13,
5215,
10876,
13,
5215,
931,
13,
13,
13,
1990,
25513,
29950,
2550,
29898,
3318,
1125,
13,
1678,
9995,
9118,
2967,
770,
363,
2888,
12422,
20240,
29889,
13,
13,
1678,
9133,
2247,
599,
3625,
3519,
411,
263,
2322,
5314,
304,
437,
13,
1678,
3078,
29889,
910,
6511,
363,
12422,
1014,
13203,
304,
871,
2334,
278,
4959,
13,
1678,
896,
817,
29889,
13,
13,
1678,
9995,
13,
1678,
822,
281,
5847,
29918,
4478,
29918,
2344,
29898,
1311,
29892,
2393,
3871,
1125,
13,
4706,
9995,
29907,
4212,
2501,
6257,
263,
399,
9998,
2740,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
2393,
3871,
584,
851,
13,
9651,
450,
2393,
3871,
313,
8387,
4510,
29897,
310,
278,
399,
9998,
2669,
1304,
363,
11975,
29889,
13,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
281,
5847,
29918,
4478,
29918,
2914,
29898,
1311,
29892,
1353,
29918,
974,
29918,
9902,
1125,
13,
4706,
9995,
29907,
4212,
1156,
263,
399,
9998,
2740,
7743,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
1353,
29918,
974,
29918,
9902,
584,
938,
13,
9651,
450,
1353,
310,
5680,
4133,
491,
278,
399,
9998,
2740,
29889,
13,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
4903,
29918,
3827,
287,
29898,
1311,
29892,
282,
1989,
29918,
3318,
1125,
13,
4706,
9995,
29907,
4212,
2501,
2009,
292,
385,
6560,
1842,
310,
385,
1203,
29889,
13,
13,
4706,
910,
338,
2845,
5643,
491,
4954,
3134,
29918,
8173,
29918,
27342,
16159,
470,
4954,
3134,
29918,
10382,
287,
29952,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
282,
1989,
29918,
3318,
584,
851,
13,
9651,
349,
3504,
296,
1820,
310,
278,
13877,
1203,
29889,
13,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
4903,
29918,
8173,
29918,
27342,
29898,
1311,
29892,
282,
1989,
29918,
3318,
1125,
13,
4706,
9995,
29907,
4212,
746,
278,
6560,
1842,
310,
385,
1203,
338,
27387,
515,
278,
13,
4706,
7090,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
282,
1989,
29918,
3318,
584,
851,
13,
9651,
349,
3504,
296,
1820,
310,
278,
13877,
1203,
29889,
13,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
1678,
822,
4903,
29918,
10382,
287,
29898,
1311,
29892,
282,
1989,
29918,
3318,
1125,
13,
4706,
9995,
29907,
4212,
746,
278,
6560,
1842,
310,
385,
1203,
338,
16532,
515,
278,
13,
4706,
11662,
29963,
5786,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
282,
1989,
29918,
3318,
584,
851,
13,
9651,
349,
3504,
296,
1820,
310,
278,
13877,
1203,
29889,
13,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
13,
1990,
12545,
5709,
29950,
2550,
29898,
9118,
29950,
2550,
1125,
13,
1678,
9995,
15427,
12422,
5314,
304,
1596,
6728,
304,
27591,
1213,
15945,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
9995,
15514,
4371,
29889,
13,
13,
4706,
17250,
895,
599,
3651,
304,
29871,
29900,
29889,
13,
13,
4706,
9995,
13,
4706,
1583,
29889,
2914,
29918,
2798,
353,
29871,
29900,
13,
4706,
1583,
29889,
29097,
29918,
11808,
353,
29871,
29900,
13,
4706,
1583,
29889,
2344,
29918,
2230,
353,
6213,
13,
4706,
1583,
29889,
24957,
29918,
1745,
17225,
353,
6213,
13,
13,
1678,
822,
903,
3539,
29918,
18035,
29898,
1311,
29892,
1373,
1125,
13,
4706,
9995,
6113,
6728,
304,
3918,
1962,
29889,
13,
13,
4706,
20018,
338,
27831,
373,
3454,
639,
29871,
29945,
29900,
4452,
29892,
4417,
4954,
3090,
16159,
363,
1432,
13,
4706,
2944,
19356,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
1373,
584,
851,
13,
9651,
16740,
2931,
304,
1596,
29889,
13,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
29097,
29918,
11808,
1275,
29871,
29900,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
877,
29961,
29995,
29900,
29941,
29875,
22584,
29900,
29941,
29875,
29962,
525,
1273,
313,
1311,
29889,
29097,
29918,
11808,
29892,
13,
462,
462,
1669,
1583,
29889,
2914,
29918,
2798,
876,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
4706,
25342,
1583,
29889,
29097,
29918,
11808,
1273,
29871,
29945,
29900,
1275,
29871,
29900,
29901,
13,
9651,
931,
29918,
295,
28170,
353,
931,
29889,
2230,
580,
448,
1583,
29889,
2344,
29918,
2230,
13,
9651,
931,
29918,
546,
29918,
667,
353,
931,
29918,
295,
28170,
29914,
1311,
29889,
29097,
29918,
11808,
13,
9651,
9886,
29918,
29885,
1144,
353,
938,
3552,
2230,
29918,
546,
29918,
667,
16395,
13,
18884,
1583,
29889,
2914,
29918,
2798,
29899,
1311,
29889,
29097,
29918,
11808,
876,
29914,
29953,
29900,
29897,
13,
9651,
565,
9886,
29918,
29885,
1144,
1405,
29871,
29896,
322,
9886,
29918,
29885,
1144,
2804,
320,
13,
462,
1678,
1583,
29889,
24957,
29918,
1745,
17225,
29901,
13,
18884,
9886,
353,
376,
313,
29995,
29875,
1375,
29889,
2175,
5513,
1273,
9886,
29918,
29885,
1144,
13,
18884,
1583,
29889,
24957,
29918,
1745,
17225,
353,
9886,
29918,
29885,
1144,
13,
9651,
1683,
29901,
13,
18884,
9886,
353,
5124,
13,
9651,
10876,
29889,
25393,
29889,
3539,
877,
29995,
29879,
29905,
29876,
29961,
29995,
29900,
29941,
29875,
22584,
29900,
29941,
29875,
29962,
525,
1273,
313,
13,
18884,
9886,
29892,
1583,
29889,
29097,
29918,
11808,
29892,
1583,
29889,
2914,
29918,
2798,
876,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
4706,
10876,
29889,
25393,
29889,
3539,
29898,
3090,
29897,
13,
4706,
10876,
29889,
25393,
29889,
23126,
580,
13,
4706,
1583,
29889,
29097,
29918,
11808,
4619,
29871,
29896,
13,
13,
4706,
565,
1583,
29889,
29097,
29918,
11808,
1275,
1583,
29889,
2914,
29918,
2798,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
28909,
29876,
1495,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
1678,
822,
281,
5847,
29918,
4478,
29918,
2344,
29898,
1311,
29892,
2393,
3871,
1125,
13,
4706,
9995,
10401,
263,
716,
399,
9998,
2740,
338,
4687,
29892,
10092,
599,
2613,
2153,
304,
29871,
29900,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
2393,
3871,
584,
851,
13,
9651,
450,
2393,
3871,
313,
8387,
4510,
29897,
310,
278,
399,
9998,
2669,
1304,
363,
11975,
29889,
13,
13,
4706,
9995,
13,
4706,
1583,
29889,
2914,
29918,
2798,
353,
29871,
29900,
13,
4706,
1583,
29889,
29097,
29918,
11808,
353,
29871,
29900,
13,
4706,
1583,
29889,
2344,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
4706,
1583,
29889,
24957,
29918,
1745,
17225,
353,
6213,
13,
13,
1678,
822,
281,
5847,
29918,
4478,
29918,
2914,
29898,
1311,
29892,
1353,
29918,
974,
29918,
9902,
1125,
13,
4706,
9995,
10401,
278,
399,
9998,
2740,
1614,
2167,
29892,
731,
278,
3001,
1121,
2302,
304,
13,
4706,
4954,
4537,
29918,
974,
29918,
9902,
29952,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
1353,
29918,
974,
29918,
9902,
584,
938,
13,
9651,
450,
1353,
310,
5680,
4133,
491,
278,
399,
9998,
2740,
29889,
13,
13,
4706,
9995,
13,
4706,
1583,
29889,
2914,
29918,
2798,
353,
1353,
29918,
974,
29918,
9902,
13,
13,
1678,
822,
4903,
29918,
8173,
29918,
27342,
29898,
1311,
29892,
282,
1989,
29918,
3318,
1125,
13,
4706,
9995,
10401,
385,
6560,
1842,
338,
27387,
515,
278,
7090,
29892,
1596,
525,
29883,
29915,
304,
13,
4706,
278,
6728,
1962,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
282,
1989,
29918,
3318,
584,
851,
13,
9651,
349,
3504,
296,
1820,
310,
278,
13877,
1203,
29889,
13,
13,
4706,
9995,
13,
4706,
1583,
3032,
3539,
29918,
18035,
877,
29883,
1495,
13,
13,
1678,
822,
4903,
29918,
10382,
287,
29898,
1311,
29892,
282,
1989,
29918,
3318,
1125,
13,
4706,
9995,
10401,
385,
6560,
1842,
338,
16532,
515,
278,
11662,
29963,
5786,
29892,
13,
4706,
1596,
525,
6169,
304,
278,
6728,
1962,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
282,
1989,
29918,
3318,
584,
851,
13,
9651,
349,
3504,
296,
1820,
310,
278,
13877,
1203,
29889,
13,
13,
4706,
9995,
13,
4706,
1583,
3032,
3539,
29918,
18035,
12839,
1495,
13,
2
] |
isobuilder/apptest.py | knight-ryu12/StarFoxAdventures | 22 | 132038 | <gh_stars>10-100
import os
import os.path
import sys
import inspect
import tempfile
from iso.gciso import GCISO
class AppTest:
"""Tests for this app."""
# TODO proper Python unit test framework
def __init__(self):
self.isoPath = None
self.filesPath = None
self.tempDir = None
self.iso = None
def runAllTests(self, isoPath:str, filesPath:str):
"""Run all tests."""
self.testExtractAndRebuild(isoPath, filesPath)
def testExtractAndRebuild(self, isoPath:str, filesPath:str):
"""Test that we can:
1) extract an ISO correctly
2) build an ISO correctly from extracted files
isoPath: path to a GameCube ISO.
filesPath: path to directory containing files extracted
from said ISO.
The files are not modified during the test.
"""
self.isoPath = isoPath
self.filesPath = filesPath
print("Self test: reading ISO...")
self.iso = GCISO().readFile(isoPath)
tempDirObj = tempfile.TemporaryDirectory()
self.tempDir = tempDirObj.name
#self.tempDir = './test'
#self.iso.bootBin.dump()
# extract ISO to temp dir and verify contents
# against known-good extracted directory.
#print("extract to temp dir", self.tempDir)
print("Extracting...")
self.iso.extract(self.tempDir)
self._verifyExtractedFiles()
self._verifyNoExtraFiles()
self._verifySystemFiles()
fst = self.iso.fstbin
# rebuild a new ISO from the extracted files
#testIsoPath = '/home/rena/projects/sfa/test.iso'
testIsoPath = os.path.join(self.tempDir, 'test.iso')
print("Rebuilding...")
self.iso = GCISO()
#self.iso.readDir(self.tempDir)
self.iso.addFilesFromFst(fst, self.tempDir)
self.iso.writeToFile(testIsoPath)
# extract the rebuilt ISO and verify again
# to ensure it was rebuilt correctly.
tempDirObj2 = tempfile.TemporaryDirectory()
self.tempDir = tempDirObj2.name
print("Reading rebuilt ISO...")
self.iso = GCISO().readFile(testIsoPath)
#print("extract to temp dir", self.tempDir)
print("Extracting rebuilt ISO...")
self.iso.extract(self.tempDir)
self._verifyExtractedFiles()
self._verifyNoExtraFiles()
self._verifySystemFiles()
print("Test completed")
def _verifyExtractedFiles(self):
print("Verify extracted files... ", end='', flush=True)
for file in self.iso.files:
target = os.path.join(self.tempDir, 'files', '.'+file.path)
if file.isDir:
if not os.path.isdir(target):
raise RuntimeError("Directory not extracted: %s" % str(file.path))
else:
if not os.path.isfile(target):
raise RuntimeError("File not extracted: %s" % str(file.path))
# verify data
self._verifyExtractedFileData(file)
print("OK")
def _verifyExtractedFileData(self, file):
origPath = os.path.join(self.filesPath, 'files', '.'+file.path)
newPath = os.path.join(self.tempDir, 'files', '.'+file.path)
self._verifyFileData(origPath, newPath)
#print("OK: %s" % str(file.path))
def _verifyFileData(self, origPath, newPath):
offs = 0
try: origFile = open(origPath, 'rb')
except FileNotFoundError:
raise RuntimeError("Extra file extracted: %s" % str(file.path))
try: newFile = open(newPath, 'rb')
except FileNotFoundError:
raise RuntimeError("File not extracted: %s" % str(file.path))
while True:
origData = origFile.read(4096)
newData = newFile .read(4096)
if len(origData) < len(newData):
raise RuntimeError("File extracted incorrectly: %s (extra data at 0x%X)" % (
newPath, offs + len(origData)
))
elif len(origData) > len(newData):
raise RuntimeError("File extracted incorrectly: %s (truncated at 0x%X)" % (
newPath, offs + len(newData)
))
if len(origData) == 0: break
if origData != newData:
dOffs = 0
for i in range(len(origData)):
if origData[i] != newData[i]:
dOffs = i
break
print("ERROR", origPath)
f = lambda d: ' '.join(map(lambda b: '%02X' % b, d))
s = max(dOffs-8, 0)
print("Got: ..." + f(newData[s:s+16]) + "...")
print("Expected: ..." + f(origData[s:s+16]) + "...")
raise RuntimeError("File extracted incorrectly: %s (at 0x%X: 0x%02X should be 0x%02X)" % (
newPath,
offs + dOffs, newData[dOffs], origData[dOffs]
))
offs += len(origData)
def _verifyNoExtraFiles(self):
print("Verify no extra files... ", end='', flush=True)
self._verifyNoExtraFilesInDir('/')
print("OK")
def _verifyNoExtraFilesInDir(self, path, _depth=0):
assert _depth < 10, "Maximum depth exceeded"
fullPath = os.path.join(self.tempDir, 'files', '.'+path)
for name in os.listdir(fullPath):
fullName = os.path.join(fullPath, name)
origName = os.path.join(self.filesPath, 'files', '.'+path, name)
relPath = os.path.join(path, name)
#print("check", fullName, "vs", origName)
if os.path.isdir(fullName):
if not os.path.isdir(origName):
raise RuntimeError("Extra directory: %s" % relPath)
self._verifyNoExtraFilesInDir(relPath)
else:
if not os.path.isfile(origName):
raise RuntimeError("Extra file: %s" % relPath)
def _verifySystemFiles(self):
print("Verify system files... ", end='', flush=True)
# skip fst.bin because the files can be in a different order.
files = ('apploader.img', 'bi2.bin', 'boot.bin', 'main.dol')
for name in files:
origPath = os.path.join(self.filesPath, 'sys', name)
newPath = os.path.join(self.tempDir, 'sys', name)
self._verifyFileData(origPath, newPath)
print("OK")
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
2897,
13,
5215,
2897,
29889,
2084,
13,
5215,
10876,
13,
5215,
16096,
13,
5215,
5694,
1445,
13,
3166,
338,
29877,
29889,
29887,
3476,
29877,
1053,
19983,
29096,
13,
13,
1990,
2401,
3057,
29901,
13,
1678,
9995,
24376,
363,
445,
623,
1213,
15945,
13,
1678,
396,
14402,
1571,
5132,
5190,
1243,
6890,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
10718,
2605,
259,
353,
6213,
13,
4706,
1583,
29889,
5325,
2605,
353,
6213,
13,
4706,
1583,
29889,
7382,
9170,
259,
353,
6213,
13,
4706,
1583,
29889,
10718,
539,
353,
6213,
13,
13,
13,
1678,
822,
1065,
3596,
24376,
29898,
1311,
29892,
338,
29877,
2605,
29901,
710,
29892,
2066,
2605,
29901,
710,
1125,
13,
4706,
9995,
6558,
599,
6987,
1213,
15945,
13,
4706,
1583,
29889,
1688,
5647,
1461,
2855,
29934,
774,
29884,
789,
29898,
10718,
2605,
29892,
2066,
2605,
29897,
13,
13,
13,
1678,
822,
1243,
5647,
1461,
2855,
29934,
774,
29884,
789,
29898,
1311,
29892,
338,
29877,
2605,
29901,
710,
29892,
2066,
2605,
29901,
710,
1125,
13,
4706,
9995,
3057,
393,
591,
508,
29901,
13,
308,
29896,
29897,
6597,
385,
17723,
5149,
13,
308,
29906,
29897,
2048,
385,
17723,
5149,
515,
23892,
2066,
13,
13,
4706,
338,
29877,
2605,
29901,
2224,
304,
263,
8448,
29907,
4003,
17723,
29889,
13,
4706,
2066,
2605,
29901,
2224,
304,
3884,
6943,
2066,
23892,
13,
9651,
515,
1497,
17723,
29889,
13,
13,
4706,
450,
2066,
526,
451,
9120,
2645,
278,
1243,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
10718,
2605,
259,
353,
338,
29877,
2605,
13,
4706,
1583,
29889,
5325,
2605,
353,
2066,
2605,
13,
13,
4706,
1596,
703,
24313,
1243,
29901,
5183,
17723,
856,
1159,
13,
4706,
1583,
29889,
10718,
353,
19983,
29096,
2141,
949,
2283,
29898,
10718,
2605,
29897,
13,
4706,
5694,
9170,
9930,
259,
353,
5694,
1445,
29889,
5776,
1971,
653,
9882,
580,
13,
4706,
1583,
29889,
7382,
9170,
353,
5694,
9170,
9930,
29889,
978,
13,
4706,
396,
1311,
29889,
7382,
9170,
353,
19283,
1688,
29915,
13,
4706,
396,
1311,
29889,
10718,
29889,
4777,
29933,
262,
29889,
15070,
580,
13,
13,
4706,
396,
6597,
17723,
304,
5694,
4516,
322,
11539,
8118,
13,
4706,
396,
2750,
2998,
29899,
16773,
23892,
3884,
29889,
13,
4706,
396,
2158,
703,
21111,
304,
5694,
4516,
613,
1583,
29889,
7382,
9170,
29897,
13,
4706,
1596,
703,
5647,
1461,
292,
856,
1159,
13,
4706,
1583,
29889,
10718,
29889,
21111,
29898,
1311,
29889,
7382,
9170,
29897,
13,
4706,
1583,
3032,
27902,
5647,
1461,
287,
10547,
580,
13,
4706,
1583,
3032,
27902,
3782,
18126,
10547,
580,
13,
4706,
1583,
3032,
27902,
3924,
10547,
580,
13,
4706,
285,
303,
353,
1583,
29889,
10718,
29889,
29888,
303,
2109,
13,
13,
4706,
396,
337,
4282,
263,
716,
17723,
515,
278,
23892,
2066,
13,
4706,
396,
1688,
29902,
578,
2605,
353,
8207,
5184,
29914,
1267,
29874,
29914,
16418,
29914,
4668,
29874,
29914,
1688,
29889,
10718,
29915,
13,
4706,
1243,
29902,
578,
2605,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
7382,
9170,
29892,
525,
1688,
29889,
10718,
1495,
13,
4706,
1596,
703,
29934,
774,
29884,
789,
292,
856,
1159,
13,
4706,
1583,
29889,
10718,
353,
19983,
29096,
580,
13,
4706,
396,
1311,
29889,
10718,
29889,
949,
9170,
29898,
1311,
29889,
7382,
9170,
29897,
13,
4706,
1583,
29889,
10718,
29889,
1202,
10547,
4591,
29943,
303,
29898,
29888,
303,
29892,
1583,
29889,
7382,
9170,
29897,
13,
4706,
1583,
29889,
10718,
29889,
3539,
1762,
2283,
29898,
1688,
29902,
578,
2605,
29897,
13,
13,
4706,
396,
6597,
278,
337,
16145,
17723,
322,
11539,
1449,
13,
4706,
396,
304,
9801,
372,
471,
337,
16145,
5149,
29889,
13,
4706,
5694,
9170,
9930,
29906,
29871,
353,
5694,
1445,
29889,
5776,
1971,
653,
9882,
580,
13,
4706,
1583,
29889,
7382,
9170,
353,
5694,
9170,
9930,
29906,
29889,
978,
13,
13,
4706,
1596,
703,
6359,
292,
337,
16145,
17723,
856,
1159,
13,
4706,
1583,
29889,
10718,
353,
19983,
29096,
2141,
949,
2283,
29898,
1688,
29902,
578,
2605,
29897,
13,
13,
4706,
396,
2158,
703,
21111,
304,
5694,
4516,
613,
1583,
29889,
7382,
9170,
29897,
13,
4706,
1596,
703,
5647,
1461,
292,
337,
16145,
17723,
856,
1159,
13,
4706,
1583,
29889,
10718,
29889,
21111,
29898,
1311,
29889,
7382,
9170,
29897,
13,
4706,
1583,
3032,
27902,
5647,
1461,
287,
10547,
580,
13,
4706,
1583,
3032,
27902,
3782,
18126,
10547,
580,
13,
4706,
1583,
3032,
27902,
3924,
10547,
580,
13,
13,
4706,
1596,
703,
3057,
8676,
1159,
13,
13,
13,
1678,
822,
903,
27902,
5647,
1461,
287,
10547,
29898,
1311,
1125,
13,
4706,
1596,
703,
6565,
1598,
23892,
2066,
856,
9162,
1095,
2433,
742,
28371,
29922,
5574,
29897,
13,
4706,
363,
934,
297,
1583,
29889,
10718,
29889,
5325,
29901,
13,
9651,
3646,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
7382,
9170,
29892,
525,
5325,
742,
525,
6169,
29974,
1445,
29889,
2084,
29897,
13,
9651,
565,
934,
29889,
275,
9170,
29901,
13,
18884,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
5182,
1125,
13,
462,
1678,
12020,
24875,
2392,
703,
9882,
451,
23892,
29901,
1273,
29879,
29908,
1273,
851,
29898,
1445,
29889,
2084,
876,
13,
9651,
1683,
29901,
13,
18884,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
5182,
1125,
13,
462,
1678,
12020,
24875,
2392,
703,
2283,
451,
23892,
29901,
1273,
29879,
29908,
1273,
851,
29898,
1445,
29889,
2084,
876,
13,
13,
18884,
396,
11539,
848,
13,
18884,
1583,
3032,
27902,
5647,
1461,
287,
2283,
1469,
29898,
1445,
29897,
13,
4706,
1596,
703,
8949,
1159,
13,
13,
13,
1678,
822,
903,
27902,
5647,
1461,
287,
2283,
1469,
29898,
1311,
29892,
934,
1125,
13,
4706,
1677,
2605,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
5325,
2605,
29892,
525,
5325,
742,
525,
6169,
29974,
1445,
29889,
2084,
29897,
13,
4706,
716,
2605,
29871,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
7382,
9170,
29892,
525,
5325,
742,
525,
6169,
29974,
1445,
29889,
2084,
29897,
13,
4706,
1583,
3032,
27902,
2283,
1469,
29898,
12683,
2605,
29892,
716,
2605,
29897,
13,
4706,
396,
2158,
703,
8949,
29901,
1273,
29879,
29908,
1273,
851,
29898,
1445,
29889,
2084,
876,
13,
13,
13,
1678,
822,
903,
27902,
2283,
1469,
29898,
1311,
29892,
1677,
2605,
29892,
716,
2605,
1125,
13,
4706,
1283,
29879,
353,
29871,
29900,
13,
4706,
1018,
29901,
1677,
2283,
353,
1722,
29898,
12683,
2605,
29892,
525,
6050,
1495,
13,
4706,
5174,
3497,
17413,
2392,
29901,
13,
9651,
12020,
24875,
2392,
703,
18126,
934,
23892,
29901,
1273,
29879,
29908,
1273,
851,
29898,
1445,
29889,
2084,
876,
13,
4706,
1018,
29901,
716,
2283,
353,
1722,
29898,
1482,
2605,
29892,
525,
6050,
1495,
13,
4706,
5174,
3497,
17413,
2392,
29901,
13,
9651,
12020,
24875,
2392,
703,
2283,
451,
23892,
29901,
1273,
29879,
29908,
1273,
851,
29898,
1445,
29889,
2084,
876,
13,
13,
4706,
1550,
5852,
29901,
13,
9651,
1677,
1469,
353,
1677,
2283,
29889,
949,
29898,
29946,
29900,
29929,
29953,
29897,
13,
9651,
716,
1469,
29871,
353,
716,
2283,
869,
949,
29898,
29946,
29900,
29929,
29953,
29897,
13,
9651,
565,
7431,
29898,
12683,
1469,
29897,
529,
7431,
29898,
1482,
1469,
1125,
13,
18884,
12020,
24875,
2392,
703,
2283,
23892,
29676,
29901,
1273,
29879,
313,
17833,
848,
472,
29871,
29900,
29916,
29995,
29990,
5513,
1273,
313,
13,
462,
1678,
716,
2605,
29892,
1283,
29879,
718,
7431,
29898,
12683,
1469,
29897,
13,
462,
876,
13,
9651,
25342,
7431,
29898,
12683,
1469,
29897,
1405,
7431,
29898,
1482,
1469,
1125,
13,
18884,
12020,
24875,
2392,
703,
2283,
23892,
29676,
29901,
1273,
29879,
313,
509,
4661,
630,
472,
29871,
29900,
29916,
29995,
29990,
5513,
1273,
313,
13,
462,
1678,
716,
2605,
29892,
1283,
29879,
718,
7431,
29898,
1482,
1469,
29897,
13,
462,
876,
13,
9651,
565,
7431,
29898,
12683,
1469,
29897,
1275,
29871,
29900,
29901,
2867,
13,
9651,
565,
1677,
1469,
2804,
716,
1469,
29901,
13,
18884,
270,
6880,
29879,
353,
29871,
29900,
13,
18884,
363,
474,
297,
3464,
29898,
2435,
29898,
12683,
1469,
22164,
13,
462,
1678,
565,
1677,
1469,
29961,
29875,
29962,
2804,
716,
1469,
29961,
29875,
5387,
13,
462,
4706,
270,
6880,
29879,
353,
474,
13,
462,
4706,
2867,
13,
18884,
1596,
703,
11432,
613,
1677,
2605,
29897,
13,
18884,
285,
353,
14013,
270,
29901,
525,
15300,
7122,
29898,
1958,
29898,
2892,
289,
29901,
14210,
29900,
29906,
29990,
29915,
1273,
289,
29892,
270,
876,
13,
18884,
269,
353,
4236,
29898,
29881,
6880,
29879,
29899,
29947,
29892,
29871,
29900,
29897,
13,
18884,
1596,
703,
29954,
327,
29901,
418,
2023,
29908,
718,
285,
29898,
1482,
1469,
29961,
29879,
29901,
29879,
29974,
29896,
29953,
2314,
718,
29804,
1159,
13,
18884,
1596,
703,
1252,
6021,
29901,
2023,
29908,
718,
285,
29898,
12683,
1469,
29961,
29879,
29901,
29879,
29974,
29896,
29953,
2314,
718,
29804,
1159,
13,
18884,
12020,
24875,
2392,
703,
2283,
23892,
29676,
29901,
1273,
29879,
313,
271,
29871,
29900,
29916,
29995,
29990,
29901,
29871,
29900,
29916,
29995,
29900,
29906,
29990,
881,
367,
29871,
29900,
29916,
29995,
29900,
29906,
29990,
5513,
1273,
313,
13,
462,
1678,
716,
2605,
29892,
13,
462,
1678,
1283,
29879,
718,
270,
6880,
29879,
29892,
716,
1469,
29961,
29881,
6880,
29879,
1402,
1677,
1469,
29961,
29881,
6880,
29879,
29962,
13,
462,
876,
13,
9651,
1283,
29879,
4619,
7431,
29898,
12683,
1469,
29897,
13,
13,
13,
1678,
822,
903,
27902,
3782,
18126,
10547,
29898,
1311,
1125,
13,
4706,
1596,
703,
6565,
1598,
694,
4805,
2066,
856,
9162,
1095,
2433,
742,
28371,
29922,
5574,
29897,
13,
4706,
1583,
3032,
27902,
3782,
18126,
10547,
797,
9170,
11219,
1495,
13,
4706,
1596,
703,
8949,
1159,
13,
13,
13,
1678,
822,
903,
27902,
3782,
18126,
10547,
797,
9170,
29898,
1311,
29892,
2224,
29892,
903,
19488,
29922,
29900,
1125,
13,
4706,
4974,
903,
19488,
529,
29871,
29896,
29900,
29892,
376,
7976,
12539,
10809,
13461,
287,
29908,
13,
4706,
2989,
2605,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
7382,
9170,
29892,
525,
5325,
742,
525,
6169,
29974,
2084,
29897,
13,
4706,
363,
1024,
297,
2897,
29889,
1761,
3972,
29898,
8159,
2605,
1125,
13,
9651,
2989,
1170,
353,
2897,
29889,
2084,
29889,
7122,
29898,
8159,
2605,
29892,
1024,
29897,
13,
9651,
1677,
1170,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
5325,
2605,
29892,
525,
5325,
742,
525,
6169,
29974,
2084,
29892,
1024,
29897,
13,
9651,
1104,
2605,
29871,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
1024,
29897,
13,
9651,
396,
2158,
703,
3198,
613,
2989,
1170,
29892,
376,
4270,
613,
1677,
1170,
29897,
13,
9651,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
8159,
1170,
1125,
13,
18884,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
12683,
1170,
1125,
13,
462,
1678,
12020,
24875,
2392,
703,
18126,
3884,
29901,
1273,
29879,
29908,
1273,
1104,
2605,
29897,
13,
18884,
1583,
3032,
27902,
3782,
18126,
10547,
797,
9170,
29898,
2674,
2605,
29897,
13,
9651,
1683,
29901,
13,
18884,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
12683,
1170,
1125,
13,
462,
1678,
12020,
24875,
2392,
703,
18126,
934,
29901,
1273,
29879,
29908,
1273,
1104,
2605,
29897,
13,
13,
13,
1678,
822,
903,
27902,
3924,
10547,
29898,
1311,
1125,
13,
4706,
1596,
703,
6565,
1598,
1788,
2066,
856,
9162,
1095,
2433,
742,
28371,
29922,
5574,
29897,
13,
4706,
396,
14383,
285,
303,
29889,
2109,
1363,
278,
2066,
508,
367,
297,
263,
1422,
1797,
29889,
13,
4706,
2066,
353,
6702,
932,
12657,
29889,
2492,
742,
525,
5365,
29906,
29889,
2109,
742,
525,
4777,
29889,
2109,
742,
525,
3396,
29889,
29881,
324,
1495,
13,
4706,
363,
1024,
297,
2066,
29901,
13,
9651,
1677,
2605,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
5325,
2605,
29892,
525,
9675,
742,
1024,
29897,
13,
9651,
716,
2605,
29871,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
7382,
9170,
29892,
525,
9675,
742,
1024,
29897,
13,
9651,
1583,
3032,
27902,
2283,
1469,
29898,
12683,
2605,
29892,
716,
2605,
29897,
13,
4706,
1596,
703,
8949,
1159,
13,
2
] |
mesh/scale_test.py | melonwan/sphereHand | 53 | 52642 | # to test the gradient back-propagation
from __future__ import absolute_import, division, print_function
import torch
import pickle
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
import numpy as np
import cv2
import torch.utils.data as data
from mesh.multiview_utility import MutualProjectionLoss, MultiviewConsistencyLoss
from dataset.nyu_dataset import create_nyu_dataset
from network.util_modules import PosePriorLoss
from dataset.joint_angle import JointAngleDataset
import matplotlib.pyplot as plt
from mesh.kinematicsTransformation import HandTransformationMat
from mesh.pointTransformation import LinearBlendSkinning, RandScale
from network.constants import Constant
from network.util_modules import HandSynthesizer
constant = Constant()
synt_key_points = [[0,1],
[0,2],
[33,34]]
real_key_points = [[30,31],
[30,32],
[0,1]]
def bone_length(joints, indices):
bone_length = []
for [idx_1, idx_2] in indices:
diff = joints[idx_1] - joints[idx_2]
bone_length.append(diff.view(-1).norm())
bone_length = [bone_length[0]/bone_length[1], bone_length[0]/bone_length[2]]
return bone_length
dataset_dir = 'D:\\data\\nyu_hand_dataset_v2\\npy-64\\test'
nyu_dataset = create_nyu_dataset(dataset_dir)
with open('mesh/model/preprocessed_hand.pkl', 'rb') as f:
mesh = pickle.load(f)
hand_synthsizer = HandSynthesizer(mesh, 64, 16, 1.0, 0.01).cuda()
joint_data = JointAngleDataset()
for _ in range(10):
real_data = nyu_dataset[0]
real_joints = real_data[1][0][constant.real_key_points]
real_joints = real_joints * 64 / 300 + 32
fig = plt.figure()
ax = fig.add_subplot(1, 2, 1)
ax.scatter(real_joints[:,0], real_joints[:,1])
for idx in range(len(real_joints)):
ax.annotate('%d'%idx, (real_joints[idx,0], real_joints[idx,1]))
ax.imshow(real_data[0][0].squeeze())
para = joint_data[0].unsqueeze(dim=0).cuda()
synt_result = hand_synthsizer(para)
dm = synt_result[0].squeeze().detach().cpu().numpy()
synt_joints = synt_result[3].squeeze().detach().cpu().numpy()[constant.synt_key_points]
synt_joints = synt_joints * 64 / 300 + 32
ax = fig.add_subplot(1, 2, 2)
ax.scatter(synt_joints[:,0], synt_joints[:,1])
for idx in range(len(synt_joints)):
ax.annotate('%d'%idx, (synt_joints[idx,0], synt_joints[idx,1]))
ax.imshow(dm)
plt.show() | [
1,
396,
304,
1243,
278,
16030,
1250,
29899,
7728,
351,
362,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
13,
5215,
4842,
305,
13,
5215,
5839,
280,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
12655,
408,
7442,
13,
5215,
13850,
29906,
13,
5215,
4842,
305,
29889,
13239,
29889,
1272,
408,
848,
13,
3166,
27716,
29889,
4713,
440,
646,
29918,
329,
1793,
1053,
20749,
950,
1184,
6929,
29931,
2209,
29892,
9683,
440,
646,
13696,
391,
3819,
29931,
2209,
13,
3166,
8783,
29889,
1460,
29884,
29918,
24713,
1053,
1653,
29918,
1460,
29884,
29918,
24713,
13,
3166,
3564,
29889,
4422,
29918,
7576,
1053,
349,
852,
29925,
13479,
29931,
2209,
13,
3166,
8783,
29889,
12090,
29918,
2521,
1053,
435,
2461,
19582,
16390,
24541,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
3166,
27716,
29889,
9089,
4579,
1199,
4300,
5404,
1053,
5166,
4300,
5404,
9782,
13,
3166,
27716,
29889,
3149,
4300,
5404,
1053,
22985,
10358,
355,
29903,
9089,
1076,
29892,
17468,
17185,
13,
3166,
3564,
29889,
3075,
1934,
1053,
28601,
13,
3166,
3564,
29889,
4422,
29918,
7576,
1053,
5166,
29216,
26041,
3950,
13,
23362,
353,
28601,
580,
13,
13,
29879,
3903,
29918,
1989,
29918,
9748,
353,
5519,
29900,
29892,
29896,
1402,
13,
462,
259,
518,
29900,
29892,
29906,
1402,
13,
462,
259,
518,
29941,
29941,
29892,
29941,
29946,
5262,
13,
13,
6370,
29918,
1989,
29918,
9748,
353,
5519,
29941,
29900,
29892,
29941,
29896,
1402,
13,
462,
259,
518,
29941,
29900,
29892,
29941,
29906,
1402,
13,
462,
259,
518,
29900,
29892,
29896,
5262,
13,
13,
1753,
289,
650,
29918,
2848,
29898,
2212,
9466,
29892,
16285,
1125,
13,
1678,
289,
650,
29918,
2848,
353,
5159,
13,
1678,
363,
518,
13140,
29918,
29896,
29892,
22645,
29918,
29906,
29962,
297,
16285,
29901,
13,
4706,
2923,
353,
14002,
29879,
29961,
13140,
29918,
29896,
29962,
448,
14002,
29879,
29961,
13140,
29918,
29906,
29962,
13,
4706,
289,
650,
29918,
2848,
29889,
4397,
29898,
12765,
29889,
1493,
6278,
29896,
467,
12324,
3101,
13,
1678,
289,
650,
29918,
2848,
353,
518,
15933,
29918,
2848,
29961,
29900,
16261,
15933,
29918,
2848,
29961,
29896,
1402,
289,
650,
29918,
2848,
29961,
29900,
16261,
15933,
29918,
2848,
29961,
29906,
5262,
13,
1678,
736,
289,
650,
29918,
2848,
13,
13,
13,
13,
24713,
29918,
3972,
353,
525,
29928,
22298,
1272,
1966,
1460,
29884,
29918,
3179,
29918,
24713,
29918,
29894,
29906,
1966,
29876,
2272,
29899,
29953,
29946,
1966,
1688,
29915,
13,
1460,
29884,
29918,
24713,
353,
1653,
29918,
1460,
29884,
29918,
24713,
29898,
24713,
29918,
3972,
29897,
13,
13,
2541,
1722,
877,
4467,
29882,
29914,
4299,
29914,
1457,
5014,
287,
29918,
3179,
29889,
29886,
6321,
742,
525,
6050,
1495,
408,
285,
29901,
13,
1678,
27716,
353,
5839,
280,
29889,
1359,
29898,
29888,
29897,
13,
3179,
29918,
19274,
386,
29879,
3950,
353,
5166,
29216,
26041,
3950,
29898,
4467,
29882,
29892,
29871,
29953,
29946,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29896,
467,
29883,
6191,
580,
13,
12090,
29918,
1272,
353,
435,
2461,
19582,
16390,
24541,
580,
13,
13,
13,
1454,
903,
297,
3464,
29898,
29896,
29900,
1125,
13,
1678,
1855,
29918,
1272,
353,
7098,
29884,
29918,
24713,
29961,
29900,
29962,
13,
1678,
1855,
29918,
2212,
9466,
353,
1855,
29918,
1272,
29961,
29896,
3816,
29900,
3816,
23362,
29889,
6370,
29918,
1989,
29918,
9748,
29962,
13,
1678,
1855,
29918,
2212,
9466,
353,
1855,
29918,
2212,
9466,
334,
29871,
29953,
29946,
847,
29871,
29941,
29900,
29900,
718,
29871,
29941,
29906,
13,
13,
13,
1678,
2537,
353,
14770,
29889,
4532,
580,
13,
1678,
4853,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29896,
29897,
13,
1678,
4853,
29889,
1557,
2620,
29898,
6370,
29918,
2212,
9466,
7503,
29892,
29900,
1402,
1855,
29918,
2212,
9466,
7503,
29892,
29896,
2314,
13,
1678,
363,
22645,
297,
3464,
29898,
2435,
29898,
6370,
29918,
2212,
9466,
22164,
13,
4706,
4853,
29889,
6735,
403,
877,
29995,
29881,
29915,
29995,
13140,
29892,
313,
6370,
29918,
2212,
9466,
29961,
13140,
29892,
29900,
1402,
1855,
29918,
2212,
9466,
29961,
13140,
29892,
29896,
12622,
13,
1678,
4853,
29889,
326,
4294,
29898,
6370,
29918,
1272,
29961,
29900,
3816,
29900,
1822,
29879,
802,
29872,
911,
3101,
13,
13,
13,
1678,
1702,
353,
14002,
29918,
1272,
29961,
29900,
1822,
6948,
802,
29872,
911,
29898,
6229,
29922,
29900,
467,
29883,
6191,
580,
13,
13,
1678,
269,
3903,
29918,
2914,
353,
1361,
29918,
19274,
386,
29879,
3950,
29898,
22752,
29897,
13,
1678,
270,
29885,
353,
269,
3903,
29918,
2914,
29961,
29900,
1822,
29879,
802,
29872,
911,
2141,
4801,
496,
2141,
21970,
2141,
23749,
580,
13,
1678,
269,
3903,
29918,
2212,
9466,
353,
269,
3903,
29918,
2914,
29961,
29941,
1822,
29879,
802,
29872,
911,
2141,
4801,
496,
2141,
21970,
2141,
23749,
580,
29961,
23362,
29889,
29879,
3903,
29918,
1989,
29918,
9748,
29962,
13,
1678,
269,
3903,
29918,
2212,
9466,
353,
269,
3903,
29918,
2212,
9466,
334,
29871,
29953,
29946,
847,
29871,
29941,
29900,
29900,
718,
29871,
29941,
29906,
13,
13,
1678,
4853,
353,
2537,
29889,
1202,
29918,
1491,
5317,
29898,
29896,
29892,
29871,
29906,
29892,
29871,
29906,
29897,
13,
1678,
4853,
29889,
1557,
2620,
29898,
29879,
3903,
29918,
2212,
9466,
7503,
29892,
29900,
1402,
269,
3903,
29918,
2212,
9466,
7503,
29892,
29896,
2314,
13,
1678,
363,
22645,
297,
3464,
29898,
2435,
29898,
29879,
3903,
29918,
2212,
9466,
22164,
13,
4706,
4853,
29889,
6735,
403,
877,
29995,
29881,
29915,
29995,
13140,
29892,
313,
29879,
3903,
29918,
2212,
9466,
29961,
13140,
29892,
29900,
1402,
269,
3903,
29918,
2212,
9466,
29961,
13140,
29892,
29896,
12622,
13,
1678,
4853,
29889,
326,
4294,
29898,
18933,
29897,
13,
1678,
14770,
29889,
4294,
580,
2
] |
4- Convolutional Neural Networks/Week 1/cnn_utils.py | ansuini/deeplearning.ai-pytorch | 0 | 159621 | import h5py
import numpy as np
import torch
import cv2
from torch.utils.data import DataLoader, TensorDataset
def get_data(batch_size=64):
train_dataset = h5py.File('datasets/train_signs.h5', "r")
x_train = np.array(train_dataset["train_set_x"][:]) # your train set features
x_train = np.transpose(x_train, (0, 3, 1, 2))
y_train = np.array(train_dataset["train_set_y"][:]) # your train set labels
y_train = y_train.reshape((1, y_train.shape[0])).T
test_dataset = h5py.File('datasets/test_signs.h5', "r")
x_test = np.array(test_dataset["test_set_x"][:]) # your test set features
x_test = np.transpose(x_test, (0, 3, 1, 2))
y_test = np.array(test_dataset["test_set_y"][:]) # your test set labels
y_test = y_test.reshape((1, y_test.shape[0])).T
classes = np.array(test_dataset["list_classes"][:]) # the list of classes
X_train_tensor = torch.tensor(x_train, dtype=torch.float)/255
Y_train_tensor = torch.tensor(y_train, dtype=torch.long)
X_test_tensor = torch.tensor(x_test, dtype=torch.float)/255
Y_test_tensor = torch.tensor(y_test, dtype=torch.long)
train_dataset = TensorDataset(X_train_tensor, Y_train_tensor)
test_dataset = TensorDataset(X_test_tensor, Y_test_tensor)
train_loader = DataLoader(train_dataset, batch_size=batch_size, shuffle=True)
test_loader = DataLoader(test_dataset, batch_size=batch_size, shuffle=True)
return train_dataset, test_dataset, train_loader, test_loader, classes
def path_to_input(image_path, input_size, device):
img = cv2.imread(image_path)
img = cv2.resize(img, (input_size, input_size)) #Resize
img = img[..., ::-1].transpose((2, 0, 1)) #BGR -> RGB and HxWxC -> CxHxW
img = img[np.newaxis, ...] / 255.0 #Add a channel at 0, thus making it a batch
img = torch.tensor(img, dtype=torch.float, device=device) #Convert to Tensor
return img
| [
1,
1053,
298,
29945,
2272,
13,
5215,
12655,
408,
7442,
13,
5215,
4842,
305,
13,
5215,
13850,
29906,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
3630,
10036,
29892,
323,
6073,
16390,
24541,
13,
13,
13,
1753,
679,
29918,
1272,
29898,
16175,
29918,
2311,
29922,
29953,
29946,
1125,
13,
1678,
7945,
29918,
24713,
353,
298,
29945,
2272,
29889,
2283,
877,
14538,
1691,
29914,
14968,
29918,
4530,
29879,
29889,
29882,
29945,
742,
376,
29878,
1159,
13,
1678,
921,
29918,
14968,
353,
7442,
29889,
2378,
29898,
14968,
29918,
24713,
3366,
14968,
29918,
842,
29918,
29916,
3108,
7503,
2314,
396,
596,
7945,
731,
5680,
13,
1678,
921,
29918,
14968,
353,
7442,
29889,
3286,
4220,
29898,
29916,
29918,
14968,
29892,
313,
29900,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29906,
876,
13,
1678,
343,
29918,
14968,
353,
7442,
29889,
2378,
29898,
14968,
29918,
24713,
3366,
14968,
29918,
842,
29918,
29891,
3108,
7503,
2314,
396,
596,
7945,
731,
11073,
13,
1678,
343,
29918,
14968,
353,
343,
29918,
14968,
29889,
690,
14443,
3552,
29896,
29892,
343,
29918,
14968,
29889,
12181,
29961,
29900,
2314,
467,
29911,
13,
13,
1678,
1243,
29918,
24713,
353,
298,
29945,
2272,
29889,
2283,
877,
14538,
1691,
29914,
1688,
29918,
4530,
29879,
29889,
29882,
29945,
742,
376,
29878,
1159,
13,
1678,
921,
29918,
1688,
353,
7442,
29889,
2378,
29898,
1688,
29918,
24713,
3366,
1688,
29918,
842,
29918,
29916,
3108,
7503,
2314,
396,
596,
1243,
731,
5680,
13,
1678,
921,
29918,
1688,
353,
7442,
29889,
3286,
4220,
29898,
29916,
29918,
1688,
29892,
313,
29900,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29906,
876,
13,
1678,
343,
29918,
1688,
353,
7442,
29889,
2378,
29898,
1688,
29918,
24713,
3366,
1688,
29918,
842,
29918,
29891,
3108,
7503,
2314,
396,
596,
1243,
731,
11073,
13,
1678,
343,
29918,
1688,
353,
343,
29918,
1688,
29889,
690,
14443,
3552,
29896,
29892,
343,
29918,
1688,
29889,
12181,
29961,
29900,
2314,
467,
29911,
13,
13,
1678,
4413,
353,
7442,
29889,
2378,
29898,
1688,
29918,
24713,
3366,
1761,
29918,
13203,
3108,
7503,
2314,
396,
278,
1051,
310,
4413,
13,
13,
1678,
1060,
29918,
14968,
29918,
20158,
353,
4842,
305,
29889,
20158,
29898,
29916,
29918,
14968,
29892,
26688,
29922,
7345,
305,
29889,
7411,
6802,
29906,
29945,
29945,
13,
1678,
612,
29918,
14968,
29918,
20158,
353,
4842,
305,
29889,
20158,
29898,
29891,
29918,
14968,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29897,
13,
13,
1678,
1060,
29918,
1688,
29918,
20158,
353,
4842,
305,
29889,
20158,
29898,
29916,
29918,
1688,
29892,
26688,
29922,
7345,
305,
29889,
7411,
6802,
29906,
29945,
29945,
13,
1678,
612,
29918,
1688,
29918,
20158,
353,
4842,
305,
29889,
20158,
29898,
29891,
29918,
1688,
29892,
26688,
29922,
7345,
305,
29889,
5426,
29897,
13,
13,
1678,
7945,
29918,
24713,
353,
323,
6073,
16390,
24541,
29898,
29990,
29918,
14968,
29918,
20158,
29892,
612,
29918,
14968,
29918,
20158,
29897,
13,
1678,
1243,
29918,
24713,
353,
323,
6073,
16390,
24541,
29898,
29990,
29918,
1688,
29918,
20158,
29892,
612,
29918,
1688,
29918,
20158,
29897,
13,
13,
1678,
7945,
29918,
12657,
353,
3630,
10036,
29898,
14968,
29918,
24713,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
528,
21897,
29922,
5574,
29897,
13,
1678,
1243,
29918,
12657,
353,
3630,
10036,
29898,
1688,
29918,
24713,
29892,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
528,
21897,
29922,
5574,
29897,
13,
13,
13,
1678,
736,
7945,
29918,
24713,
29892,
1243,
29918,
24713,
29892,
7945,
29918,
12657,
29892,
1243,
29918,
12657,
29892,
4413,
13,
13,
13,
1753,
2224,
29918,
517,
29918,
2080,
29898,
3027,
29918,
2084,
29892,
1881,
29918,
2311,
29892,
4742,
1125,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
3027,
29918,
2084,
29897,
13,
1678,
10153,
353,
13850,
29906,
29889,
21476,
29898,
2492,
29892,
313,
2080,
29918,
2311,
29892,
1881,
29918,
2311,
876,
462,
29871,
396,
1666,
675,
13,
1678,
10153,
353,
10153,
29961,
16361,
4761,
29899,
29896,
1822,
3286,
4220,
3552,
29906,
29892,
29871,
29900,
29892,
29871,
29896,
876,
462,
4706,
396,
29933,
14345,
1599,
390,
7210,
322,
379,
29916,
29956,
29916,
29907,
1599,
315,
29916,
29950,
29916,
29956,
13,
1678,
10153,
353,
10153,
29961,
9302,
29889,
1482,
8990,
29892,
2023,
29962,
847,
29871,
29906,
29945,
29945,
29889,
29900,
462,
1669,
396,
2528,
263,
8242,
472,
29871,
29900,
29892,
4550,
3907,
372,
263,
9853,
13,
1678,
10153,
353,
4842,
305,
29889,
20158,
29898,
2492,
29892,
26688,
29922,
7345,
305,
29889,
7411,
29892,
4742,
29922,
10141,
29897,
4706,
396,
18455,
304,
323,
6073,
13,
1678,
736,
10153,
13,
2
] |
problems/p009.py | davisschenk/project-euler-python | 0 | 7486 | <gh_stars>0
from math import ceil, sqrt
from problem import Problem
from utils.math import gcd
class PythagoreanTriplet(Problem, name="Special Pythagorean triplet", expected=31875000):
@Problem.solution()
def brute_force(self, ts=1000):
for a in range(3, round((ts - 3) / 2)):
for b in range(a + 1, round((ts - 1 - a) / 2)):
c = ts - a - b
if c * c == a * a + b * b:
return a * b * c
@Problem.solution()
def parametrisation(self, ts=1000):
s2 = ts / 2
mlimit = ceil(sqrt(s2)) - 1
for m in range(2, mlimit):
if s2 % m == 0:
sm = s2 / m
while sm % 2 == 0:
sm /= 2
if m % 2 == 1:
k = m + 2
else:
k = m + 1
while k < 2 * m and k <= sm:
if sm % k == 0 and gcd(k, m) == 1:
d = s2 / (k * m)
n = k - m
a = d * (m * m - n * n)
b = 2 * d * m * n
c = d * (m * m + n * n)
return a * b * c
k += 2
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
5844,
1053,
2257,
309,
29892,
18074,
2273,
13,
13,
3166,
1108,
1053,
11583,
13,
3166,
3667,
29879,
29889,
755,
1053,
330,
2252,
13,
13,
13,
1990,
349,
1541,
351,
487,
273,
29565,
552,
29873,
29898,
26604,
29892,
1024,
543,
24780,
349,
1541,
351,
487,
273,
21954,
29873,
613,
3806,
29922,
29941,
29896,
29947,
29955,
29945,
29900,
29900,
29900,
1125,
13,
1678,
732,
26604,
29889,
2929,
918,
580,
13,
1678,
822,
1506,
1082,
29918,
10118,
29898,
1311,
29892,
18696,
29922,
29896,
29900,
29900,
29900,
1125,
13,
4706,
363,
263,
297,
3464,
29898,
29941,
29892,
4513,
3552,
1372,
448,
29871,
29941,
29897,
847,
29871,
29906,
22164,
13,
9651,
363,
289,
297,
3464,
29898,
29874,
718,
29871,
29896,
29892,
4513,
3552,
1372,
448,
29871,
29896,
448,
263,
29897,
847,
29871,
29906,
22164,
13,
18884,
274,
353,
18696,
448,
263,
448,
289,
13,
13,
18884,
565,
274,
334,
274,
1275,
263,
334,
263,
718,
289,
334,
289,
29901,
13,
462,
1678,
736,
263,
334,
289,
334,
274,
13,
13,
1678,
732,
26604,
29889,
2929,
918,
580,
13,
1678,
822,
25011,
3780,
362,
29898,
1311,
29892,
18696,
29922,
29896,
29900,
29900,
29900,
1125,
13,
4706,
269,
29906,
353,
18696,
847,
29871,
29906,
13,
4706,
286,
13400,
353,
2257,
309,
29898,
3676,
29898,
29879,
29906,
876,
448,
29871,
29896,
13,
13,
4706,
363,
286,
297,
3464,
29898,
29906,
29892,
286,
13400,
1125,
13,
9651,
565,
269,
29906,
1273,
286,
1275,
29871,
29900,
29901,
13,
18884,
1560,
353,
269,
29906,
847,
286,
13,
18884,
1550,
1560,
1273,
29871,
29906,
1275,
29871,
29900,
29901,
13,
462,
1678,
1560,
847,
29922,
29871,
29906,
13,
13,
18884,
565,
286,
1273,
29871,
29906,
1275,
29871,
29896,
29901,
13,
462,
1678,
413,
353,
286,
718,
29871,
29906,
13,
18884,
1683,
29901,
13,
462,
1678,
413,
353,
286,
718,
29871,
29896,
13,
13,
18884,
1550,
413,
529,
29871,
29906,
334,
286,
322,
413,
5277,
1560,
29901,
13,
462,
1678,
565,
1560,
1273,
413,
1275,
29871,
29900,
322,
330,
2252,
29898,
29895,
29892,
286,
29897,
1275,
29871,
29896,
29901,
13,
462,
4706,
270,
353,
269,
29906,
847,
313,
29895,
334,
286,
29897,
13,
462,
4706,
302,
353,
413,
448,
286,
13,
462,
4706,
263,
353,
270,
334,
313,
29885,
334,
286,
448,
302,
334,
302,
29897,
13,
462,
4706,
289,
353,
29871,
29906,
334,
270,
334,
286,
334,
302,
13,
462,
4706,
274,
353,
270,
334,
313,
29885,
334,
286,
718,
302,
334,
302,
29897,
13,
462,
4706,
736,
263,
334,
289,
334,
274,
13,
462,
1678,
413,
4619,
29871,
29906,
13,
2
] |
hw/a2fomu_build.py | elecbrick/a2fomu | 1 | 186027 | <reponame>elecbrick/a2fomu<gh_stars>1-10
#!/usr/bin/env python3
#
# a2fomu_build.py - Part of a2fomu - Copyright (c) 2020-2021 <NAME>
#
# This file contains a significant contribution from foboot-bitstream.py
# which wass made available under the Apache License, Version 2.0:
# http://www.apache.org/licenses/LICENSE-2.0
# Import the litex build environment to integrate the deps/ directory
# external programs this lxbuildenv project relies on.
lx_dependencies = ["riscv", "icestorm", "yosys", "nextpnr-ice40"]
import lxbuildenv
# base hardware definitions: migen
from migen import Module, Signal, Instance, ClockDomain, If
from migen.fhdl.specials import TSTriple
from migen.fhdl.structure import ResetSignal
from migen.fhdl.decorators import ClockDomainsRenamer
# SoC modules and integrator: LiteX
from litex.build.lattice.platform import LatticePlatform
from litex.build.generic_platform import Pins, Subsignal
from litex.build.sim.platform import SimPlatform
from litex.soc.integration.doc import AutoDoc, ModuleDoc
from litex.soc.integration.soc_core import SoCCore
from litex.soc.cores.cpu import CPUNone
from litex.soc.integration.builder import Builder
from litex.soc.interconnect import wishbone
from litex.soc.cores import up5kspram, spi_flash
from litex_boards.targets.fomu import _CRG
import litex.soc.doc as lxsocdoc
# USB controller: ValentyUSB
from valentyusb.usbcore import io as usbio
from valentyusb.usbcore.cpu import epmem, unififo, epfifo, dummyusb, eptri
from valentyusb.usbcore.endpoint import EndpointType
# Fomu and ice40 modules:
from rtl.fomutouch import TouchPads
from rtl.romgen import RandomFirmwareROM, FirmwareROM
from rtl.sbwarmboot import SBWarmBoot
from rtl.apple2 import Apple2
from rtl.pdpspram import PDP_SPRAM
# Generic Python modules
import argparse
import os
# Simulations Interface: Create I/O pins that can interface with standard test
# suites.
sim_io = [
# define top level connection between FOMU and simulator
("clk", 0,
Subsignal("clk48", Pins(1)),
Subsignal("clk12", Pins(1)),
),
("reset", 0, Pins(1)),
("user_led_n", 0, Pins(1)),
("rgb_led", 0,
Subsignal("r", Pins(1)),
Subsignal("g", Pins(1)),
Subsignal("b", Pins(1)),
),
("touch_pins", 0,
Subsignal("user_touch_0", Pins(1)),
Subsignal("user_touch_1", Pins(1)),
Subsignal("user_touch_2", Pins(1)),
Subsignal("user_touch_3", Pins(1)),
),
("usb", 0,
Subsignal("d_p", Pins(1)),
Subsignal("d_n", Pins(1)),
Subsignal("pullup", Pins(1)),
Subsignal("tx_en", Pins(1)),
),
("spiflash", 0,
Subsignal("cs_n", Pins(1)),
Subsignal("clk", Pins(1)),
Subsignal("mosi", Pins(1)),
Subsignal("miso", Pins(1)),
Subsignal("wp", Pins(1)),
Subsignal("hold", Pins(1)),
),
("spiflash4x", 0,
Subsignal("cs_n", Pins(1)),
Subsignal("clk", Pins(1)),
Subsignal("dq", Pins(4)),
),
]
sim_connectors = [("touch_pins", "user_touch_0, user_touch_1, user_touch_2, user_touch_3")]
# Clock and reset signals that the simulator needs for proper emulation.
class sim_CRG(Module):
def __init__(self, platform):
clk = platform.request("clk")
rst = platform.request("reset")
clk12 = Signal()
self.clock_domains.cd_sys = ClockDomain()
self.clock_domains.cd_usb_12 = ClockDomain()
self.clock_domains.cd_usb_48 = ClockDomain()
self.clock_domains.cd_usb_48_to_12 = ClockDomain()
#clk12 = clk.clk12
clk48 = clk.clk48
#self.comb += clk.clk12.eq(clk12)
#self.comb += clk.clk48.eq(clk48)
self.comb += self.cd_usb_48.clk.eq(clk48)
self.comb += self.cd_usb_48_to_12.clk.eq(clk48)
# derive 12MHz clock by division of 48MHz clock
clk12_counter = Signal(2)
self.sync.usb_48_to_12 += clk12_counter.eq(clk12_counter + 1)
self.comb += clk12.eq(clk12_counter[1])
# Uncomment the following to enable 48MHz Risc-V for faster simulation
# Warning: it breaks USB communication as all data will be sent 4x
#self.comb += self.cd_sys.clk.eq(clk48)
# Use the following for FPGA timing
self.comb += self.cd_sys.clk.eq(clk12)
self.comb += self.cd_usb_12.clk.eq(clk12)
self.comb += [
ResetSignal("sys").eq(rst),
ResetSignal("usb_12").eq(rst),
ResetSignal("usb_48").eq(rst),
# Must not reset cd_usb_48_to_12 otherwise clock divider halts
# and sys_clk domain fails to reset
]
class sim_Platform(SimPlatform):
def __init__(self, revision=None, toolchain="verilator"):
default_clk_name = "clk12"
SimPlatform.__init__(self,
"sim",
sim_io,
connectors=sim_connectors,
toolchain=toolchain)
self.revision = revision
self.spi_size = 2 * 1024 * 1024
self.spi_dummy = 6
def create_programmer(self):
raise ValueError("programming is not supported")
def add_fsm_state_names():
"""Hack the FSM module to add state names to the output"""
from migen.fhdl.visit import NodeTransformer
from migen.genlib.fsm import NextState, NextValue, _target_eq
from migen.fhdl.bitcontainer import value_bits_sign
class My_LowerNext(NodeTransformer):
def __init__(self, next_state_signal, next_state_name_signal, encoding,
aliases):
self.next_state_signal = next_state_signal
self.next_state_name_signal = next_state_name_signal
self.encoding = encoding
self.aliases = aliases
# (target, next_value_ce, next_value)
self.registers = []
def _get_register_control(self, target):
for x in self.registers:
if _target_eq(target, x[0]):
return x[1], x[2]
raise KeyError
def visit_unknown(self, node):
if isinstance(node, NextState):
try:
actual_state = self.aliases[node.state]
except KeyError:
actual_state = node.state
return [
self.next_state_signal.eq(self.encoding[actual_state]),
self.next_state_name_signal.eq(
int.from_bytes(actual_state.encode(), byteorder="big"))
]
elif isinstance(node, NextValue):
try:
next_value_ce, next_value = self._get_register_control(
node.target)
except KeyError:
related = node.target if isinstance(node.target,
Signal) else None
next_value = Signal(bits_sign=value_bits_sign(node.target),
related=related)
next_value_ce = Signal(related=related)
self.registers.append(
(node.target, next_value_ce, next_value))
return next_value.eq(node.value), next_value_ce.eq(1)
else:
return node
import migen.genlib.fsm as fsm
def my_lower_controls(self):
self.state_name = Signal(len(max(self.encoding, key=len)) * 8,
reset=int.from_bytes(
self.reset_state.encode(),
byteorder="big"))
self.next_state_name = Signal(len(max(self.encoding, key=len)) * 8,
reset=int.from_bytes(
self.reset_state.encode(),
byteorder="big"))
self.comb += self.next_state_name.eq(self.state_name)
self.sync += self.state_name.eq(self.next_state_name)
return My_LowerNext(self.next_state, self.next_state_name,
self.encoding, self.state_aliases)
fsm.FSM._lower_controls = my_lower_controls
class Platform(LatticePlatform):
def __init__(self, revision=None, toolchain="icestorm"):
self.revision = revision
if revision == "evt":
from litex_boards.platforms.fomu_evt import _io, _connectors
LatticePlatform.__init__(self, "ice40-up5k-sg48", _io, _connectors, toolchain="icestorm")
self.spi_size = 16 * 1024 * 1024
self.spi_dummy = 6
elif revision == "dvt":
from litex_boards.platforms.fomu_pvt import _io, _connectors
LatticePlatform.__init__(self, "ice40-up5k-uwg30", _io, _connectors, toolchain="icestorm")
self.spi_size = 2 * 1024 * 1024
self.spi_dummy = 6
elif revision == "pvt":
from litex_boards.platforms.fomu_pvt import _io, _connectors
LatticePlatform.__init__(self, "ice40-up5k-uwg30", _io, _connectors, toolchain="icestorm")
self.spi_size = 2 * 1024 * 1024
self.spi_dummy = 6
elif revision == "hacker":
from litex_boards.platforms.fomu_hacker import _io, _connectors
LatticePlatform.__init__(self, "ice40-up5k-uwg30", _io, _connectors, toolchain="icestorm")
self.spi_size = 2 * 1024 * 1024
self.spi_dummy = 4
else:
raise ValueError("Unrecognized revision: {}. Known values: evt, dvt, pvt, hacker".format(revision))
def create_programmer(self):
raise ValueError("programming is not supported in this environment")
class BaseSoC(SoCCore, AutoDoc):
"""A2Fomu SoC and Bootloader
Fomu is an FPGA that fits entirely within a USB port.
A2Fomu is an Apple II clone inside of Fomu along with an operating
system for its control processor. The SoC contains a small ROM that
loads the OS from Flash memory into RAM.
"""
SoCCore.csr_map = {
#"ctrl": 0, # LiteX - many better uses for the space
"apple2": 0,
"crg": 1, # user - no registers in the default clock module
#"uart_phy": 2, # Fomu PVT has no pins for uart
#"uart": 3, # Fomu PVT has no pins for uart
#"identifier_mem": 4, # unnecessary
"timer0": 5, # provided by default (optional)
#"cpu_or_bridge": 8, # Nothing here
"usb": 9,
#"picorvspi": 10,
"touch": 11,
"reboot": 12,
"rgb": 13,
#"version": 14,
"lxspi": 15,
#"messible": 16,
}
SoCCore.mem_map = {
"rom": 0x00000000, # (default shadow @0x80000000)
"sram": 0x10000000, # (default shadow @0x90000000)
"spiflash": 0x20000000, # (default shadow @0xa0000000)
"a2ram": 0xC0000000, # (default shadow @0xc0000000)
"csr": 0xe0000000, # (default shadow @0xe0000000)
"vexriscv_debug": 0xf00f0000,
}
interrupt_map = {
"timer0": 2,
"usb": 3,
}
interrupt_map.update(SoCCore.interrupt_map)
def __init__(self, platform, boot_source="rand",
gdb_debug=None, usb_wishbone=False, bios_file=None,
use_dsp=False, placer="heap", output_dir="build",
pnr_seed=0,
warmboot_offsets=None,
**kwargs):
# Disable integrated RAM unless using simulator - we'll add it later
self.integrated_sram_size = 0
self.output_dir = output_dir
if kwargs["sim"]:
clk_freq = int(48e6)
self.submodules.crg = sim_CRG(platform)
self.integrated_sram_size = 0 # 0x8000,
else:
clk_freq = int(12e6)
self.submodules.crg = _CRG(platform, clk_freq)
SoCCore.__init__(self, platform, clk_freq,
integrated_sram_size=self.integrated_sram_size, with_uart=False,
with_ctrl=False, csr_data_width=32, **kwargs)
if gdb_debug is not None:
if gdb_debug == "uart":
from litex.soc.cores.uart import UARTWishboneBridge
self.submodules.uart_bridge = UARTWishboneBridge(platform.request("serial"), clk_freq, baudrate=115200)
self.add_wb_master(self.uart_bridge.wishbone)
elif gdb_debug == "usb":
usb_wishbone = True
elif gdb_debug == "spi":
import spibone
# Add SPI Wishbone bridge
debug_device = [
("spidebug", 0,
Subsignal("mosi", Pins("dbg:0")),
Subsignal("miso", Pins("dbg:1")),
Subsignal("clk", Pins("dbg:2")),
Subsignal("cs_n", Pins("dbg:3")),
)
]
platform.add_extension(debug_device)
spi_pads = platform.request("spidebug")
self.submodules.spibone = ClockDomainsRenamer("usb_12")(spibone.SpiWishboneBridge(spi_pads, wires=4))
self.add_wb_master(self.spibone.wishbone)
if hasattr(self, "cpu") and not isinstance(self.cpu, CPUNone):
self.cpu.use_external_variant("rtl/VexRiscv_Fomu_NoMMU_Debug.v")
os.path.join(output_dir, "gateware")
# This was needed for an earlier version of LiteX
#self.register_mem("vexriscv_debug", 0xf00f0000, self.cpu.debug_bus, 0x100)
else:
if hasattr(self, "cpu") and not isinstance(self.cpu, CPUNone):
#self.cpu.use_external_variant("rtl/VexRiscv_Fomu.v")
self.cpu.use_external_variant("rtl/VexRiscv_Fomu_NoMMU.v")
# SPRAM- UP5K has four blocks of Single Port RAM (SPRAM). This is split
# evenly between the Risc-V and the 6502 for main memory, 64kB each.
spram_size = 64*1024
if not kwargs["sim"]:
self.submodules.spram = up5kspram.Up5kSPRAM(size=spram_size)
else:
self.submodules.spram = wishbone.SRAM(spram_size, read_only=False, init=[])
self.register_mem("sram", self.mem_map["sram"], self.spram.bus, spram_size)
# Add a Messible for device->host communications
#Doug
#self.submodules.messible = Messible()
# Apple II specific modules here
a2mem_size = 64*1024
if not kwargs["sim"]:
a2mem = PDP_SPRAM(sim=kwargs["sim"])
else:
self.submodules.spram = wishbone.SRAM(spram_size, read_only=False, init=[])
self.submodules.a2mem = a2mem
self.register_mem("a2ram", self.mem_map["a2ram"], self.a2mem.bus, a2mem_size)
print("=====================\n", gdb_debug, gdb_debug!=None, "\n=====================\n")
self.submodules.apple2 = Apple2(platform, a2mem, minimal=(gdb_debug!=None))
if not kwargs["no_cpu"]:
bios_size = 0x2000 # Fomu standard 8 Kb ROM
if kwargs['sim']:
# 64kB ROM used in place of flash during simulation
bios_size = 0x10000
else:
# ROM consumes a large quantity of the limited EBR block RAM
# 1 KB ROM that just initializes flash and jumps to it
bios_size = 0x3000 # 12kB max size using all ebr
bios_size = 0x2400 # 9kB
bios_size = 0x2000 # 8kB foboot failsafe size
bios_size = 0x1000 # 4kB bootloader
bios_size = 0x0800 # 2kB bootloader
if boot_source == "bios" or bios_file is not None:
kwargs['cpu_reset_address'] = 0
if bios_file is None:
self.integrated_rom_size = bios_size
self.submodules.rom = wishbone.SRAM(bios_size, read_only=True, init=[])
self.register_rom(self.rom.bus, bios_size)
else:
self.firmware_rom_size = bios_size
self.submodules.firmware_rom = FirmwareROM(bios_size, bios_file)
self.add_constant("ROM_DISABLE", 1)
self.register_rom(self.firmware_rom.bus, bios_size)
elif boot_source == "rand":
kwargs['cpu_reset_address'] = 0
self.submodules.random_rom = RandomFirmwareROM(bios_size)
self.add_constant("ROM_DISABLE", 1)
self.register_rom(self.random_rom.bus, bios_size)
elif boot_source == "spi":
kwargs['cpu_reset_address'] = 0
self.integrated_rom_size = bios_size
gateware_size = 0x1a000
self.flash_boot_address = self.mem_map["spiflash"] + gateware_size
self.submodules.rom = wishbone.SRAM(bios_size, read_only=True, init=[])
self.register_rom(self.rom.bus, bios_size)
else:
raise ValueError("unrecognized boot_source: {}".format(boot_source))
# The litex SPI module supports memory-mapped reads, as well as a bit-banged mode
# for doing writes.
#if not kwargs['no_spi']:
spi_pads = platform.request("spiflash4x")
self.submodules.lxspi = spi_flash.SpiFlashDualQuad(spi_pads, dummy=platform.spi_dummy, endianness="little")
self.register_mem("spiflash", self.mem_map["spiflash"], self.lxspi.bus, size=platform.spi_size)
# Add USB pads, as well as the appropriate USB controller. If no CPU is
# present, use the DummyUsb controller.
usb_pads = platform.request("usb")
usb_iobuf = usbio.IoBuf(usb_pads.d_p, usb_pads.d_n, usb_pads.pullup)
if hasattr(self, "cpu") and not isinstance(self.cpu, CPUNone):
self.submodules.usb = eptri.TriEndpointInterface(usb_iobuf, debug=usb_wishbone)
else:
self.submodules.usb = dummyusb.DummyUsb(usb_iobuf, debug=usb_wishbone)
if kwargs['sim']:
self.comb += usb_pads.tx_en.eq(usb_iobuf.usb_tx_en)
if usb_wishbone:
self.add_wb_master(self.usb.debug_bridge.wishbone)
# For the EVT board, ensure the pulldown pin is tristated as an input
if hasattr(usb_pads, "pulldown"):
pulldown = TSTriple()
self.specials += pulldown.get_tristate(usb_pads.pulldown)
self.comb += pulldown.oe.eq(0)
if not kwargs['no_touch']:
# Add GPIO pads for the touch buttons
platform.add_extension(TouchPads.touch_device)
self.submodules.touch = TouchPads(platform.request("touch_pads"))
# Allow the user to reboot the ICE40.
self.submodules.reboot = SBWarmBoot(self, warmboot_offsets)
# If CPU has the debug option enabled, allow a register that changes the
# reset address that the CPU jumps to.
#if not kwargs['sim']:
if gdb_debug!=None and not isinstance(self.cpu, CPUNone):
try:
self.cpu.cpu_params.update(
i_externalResetVector=self.reboot.addr.storage,
)
except:
None
if not kwargs['no_rgb']:
from rtl.sbled import SBLED
rgb_pads = platform.request("rgb_led")
rgb = SBLED(platform.revision, rgb_pads)
self.submodules.rgb = rgb
if kwargs['sim']:
# The ice40 LED hardware is not emulated so route to testbench
self.comb += [
rgb_pads.r.eq(rgb.raw.storage[0]),
rgb_pads.g.eq(rgb.raw.storage[1]),
rgb_pads.b.eq(rgb.raw.storage[2]),
]
# Doug: We need space and this is not useful as it only specifies the
# model that the gateware was designed for and not the model that is
# actually in use. If the wrong gateware is loaded, the LED will not
# show the expected colors. This is the major difference.
#self.submodules.version = Version(platform.revision, self, pnr_seed, models=[
# ("0x45", "E", "Fomu EVT"),
# ("0x44", "D", "Fomu DVT"),
# ("0x50", "P", "Fomu PVT (production)"),
# ("0x48", "H", "Fomu Hacker"),
# ("0x3f", "?", "Unknown model"),
# ])
if not kwargs['sim']:
# Override default LiteX's yosys/build templates
assert hasattr(platform.toolchain, "yosys_template")
assert hasattr(platform.toolchain, "build_template")
platform.toolchain.yosys_template = [
"{read_files}",
"attrmap -tocase keep -imap keep=\"true\" keep=1 -imap keep=\"false\" keep=0 -remove keep=0",
"synth_ice40 -json {build_name}.json -top {build_name}",
]
platform.toolchain.build_template = [
#"set -x",
"set -x; yosys -q -w 'has an unprocessed .init. attribute.' -l {build_name}.rpt {build_name}.ys",
"nextpnr-ice40 --json {build_name}.json --pcf {build_name}.pcf --asc {build_name}.txt"
" --pre-pack {build_name}_pre_pack.py --{architecture} --package {package}",
"icepack {build_name}.txt {build_name}.bin"
]
# Add "-relut -dffe_min_ce_use 4" to the synth_ice40 command.
# The "-reult" adds an additional LUT pass to pack more stuff in,
# and the "-dffe_min_ce_use 4" flag prevents Yosys from generating a
# Clock Enable signal for a LUT that has fewer than 4 flip-flops.
# This increases density, and lets us use the FPGA more efficiently.
platform.toolchain.yosys_template[2] += " -relut -abc2 -dffe_min_ce_use 4 -relut"
# Disable final deep-sleep power down so firmware words are loaded
# onto softcore's address bus.
platform.toolchain.build_template[2] = "icepack -s {build_name}.txt {build_name}.bin"
# Allow us to set the nextpnr seed
platform.toolchain.build_template[1] += " --seed " + str(pnr_seed)
if placer is not None:
platform.toolchain.build_template[1] += " --placer {}".format(placer)
if use_dsp:
platform.toolchain.yosys_template[2] += " -dsp"
def copy_memory_file(self, src):
import os
from shutil import copyfile
if not os.path.exists(self.output_dir):
os.mkdir(self.output_dir)
if not os.path.exists(os.path.join(self.output_dir, "gateware")):
os.mkdir(os.path.join(self.output_dir, "gateware"))
copyfile(os.path.join("rtl", src), os.path.join(self.output_dir, "gateware", src))
def make_multiboot_header(filename, boot_offsets=[160]):
"""
ICE40 allows you to program the SB_WARMBOOT state machine by adding the following
values to the bitstream, before any given image:
[7e aa 99 7e] Sync Header
[92 00 k0] Boot mode (k = 1 for cold boot, 0 for warmboot)
[44 03 o1 o2 o3] Boot address
[82 00 00] Bank offset
[01 08] Reboot
[...] Padding (up to 32 bytes)
Note that in ICE40, the second nybble indicates the number of remaining bytes
(with the exception of the sync header).
The above construct is repeated five times:
INITIAL_BOOT The image loaded at first boot
BOOT_S00 The first image for SB_WARMBOOT
BOOT_S01 The second image for SB_WARMBOOT
BOOT_S10 The third image for SB_WARMBOOT
BOOT_S11 The fourth image for SB_WARMBOOT
"""
while len(boot_offsets) < 5:
boot_offsets.append(boot_offsets[0])
with open(filename, 'wb') as output:
for offset in boot_offsets:
# Sync Header
output.write(bytes([0x7e, 0xaa, 0x99, 0x7e]))
# Boot mode
output.write(bytes([0x92, 0x00, 0x00]))
# Boot address
output.write(bytes([0x44, 0x03,
(offset >> 16) & 0xff,
(offset >> 8) & 0xff,
(offset >> 0) & 0xff]))
# Bank offset
output.write(bytes([0x82, 0x00, 0x00]))
# Reboot command
output.write(bytes([0x01, 0x08]))
for x in range(17, 32):
output.write(bytes([0]))
def main():
parser = argparse.ArgumentParser(
description="Build A2Fomu Main Gateware")
parser.add_argument(
"--boot-source", choices=["spi", "rand", "bios"], default="rand",
help="where to have the CPU obtain its executable code from"
)
parser.add_argument(
"--document-only", default=False, action="store_true",
help="Don't build gateware or software, only build documentation"
)
parser.add_argument(
# The only difference between revisions is LED color so default to
# production version
"--revision", choices=["evt", "dvt", "pvt", "hacker"], default="pvt",
help="build a2fomu for a particular hardware model"
)
parser.add_argument(
"--name", help="set base name of output files", default="a2fomu"
)
parser.add_argument(
"--sim", help="build gateware suitable for simulation environment", action="store_true"
)
parser.add_argument(
"--bios", help="use specified file as a BIOS, rather than building one"
)
parser.add_argument(
"--gdb-debug", help="enable gdb debug support", choices=["usb", "uart", "spi", None], default=None
)
parser.add_argument(
"--wishbone-debug", help="enable debug support", action="store_true"
)
parser.add_argument(
"--with-dsp", help="use dsp inference in yosys (not all yosys builds have -dsp)", action="store_true"
)
parser.add_argument(
"--no-cpu", help="disable cpu generation for debugging purposes", action="store_true"
)
parser.add_argument(
"--no-spi", help="disable SPI flash", action="store_true"
)
parser.add_argument(
"--no-rgb", help="disable RGB LED", action="store_true"
)
parser.add_argument(
"--no-touch", help="disable touch pads", action="store_true"
)
parser.add_argument(
"--placer", choices=["sa", "heap"], default="heap", help="which placer to use in nextpnr"
)
parser.add_argument(
"--seed", default=0, help="seed to use in nextpnr"
)
parser.add_argument(
"--export-random-rom-file", help="Generate a random ROM file and save it to a file"
)
args = parser.parse_args()
output_dir = 'build'
if args.export_random_rom_file is not None:
size = 0x2000
def xorshift32(x):
x = x ^ (x << 13) & 0xffffffff
x = x ^ (x >> 17) & 0xffffffff
x = x ^ (x << 5) & 0xffffffff
return x & 0xffffffff
def get_rand(x):
out = 0
for i in range(32):
x = xorshift32(x)
if (x & 1) == 1:
out = out | (1 << i)
return out & 0xffffffff
seed = 1
with open(args.export_random_rom_file, "w", newline="\n") as output:
for d in range(int(size / 4)):
seed = get_rand(seed)
print("{:08x}".format(seed), file=output)
return 0
compile_software = False
if (args.boot_source == "bios" or args.boot_source == "spi") and args.bios is None:
compile_software = True
cpu_type = "vexriscv"
cpu_variant = "minimal"
if args.gdb_debug:
cpu_variant = cpu_variant + "+debug"
if args.no_cpu:
cpu_type = None
cpu_variant = None
compile_gateware = True
if args.document_only:
compile_gateware = False
compile_software = False
warmboot_offsets = [
160,
160,
157696,
262144,
262144 + 32768,
]
os.environ["LITEX"] = "1" # Give our Makefile something to look for
if args.sim:
platform = sim_Platform(revision=args.revision)
else:
platform = Platform(revision=args.revision)
soc = BaseSoC(platform, cpu_type=cpu_type, cpu_variant=cpu_variant,
gdb_debug=args.gdb_debug, usb_wishbone=args.wishbone_debug,
boot_source=args.boot_source,
bios_file=args.bios, sim=args.sim,
use_dsp=args.with_dsp, placer=args.placer,
pnr_seed=int(args.seed),
no_spi=args.no_spi,
no_rgb=args.no_rgb,
no_cpu=args.no_cpu,
no_touch=args.no_touch,
output_dir=output_dir,
warmboot_offsets=warmboot_offsets[1:])
builder = Builder(soc, output_dir=output_dir, csr_csv="build/csr.csv", csr_svd="build/soc.svd",
compile_software=compile_software, compile_gateware=compile_gateware)
if compile_software:
builder.software_packages = [
("all", os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "sw", "src")))
]
if args.sim:
vns = builder.build(run=False)
soc.do_exit(vns)
print("""Simulation build complete. Output files:
build/gateware/dut.v Run this Verilog file under Cocotb.
""")
return
vns = builder.build(build_name=args.name)
soc.do_exit(vns)
lxsocdoc.generate_docs(soc, "build/documentation/", project_name="A2Fomu", author="Elecbrick")
if not args.document_only:
make_multiboot_header(os.path.join(output_dir, "gateware", "multiboot-header.bin"),
warmboot_offsets)
with open(os.path.join(output_dir, 'gateware', 'multiboot-header.bin'), 'rb') as multiboot_header_file:
multiboot_header = multiboot_header_file.read()
with open(os.path.join(output_dir, 'gateware', args.name+'.bin'), 'rb') as top_file:
top = top_file.read()
with open(os.path.join(output_dir, 'gateware', args.name+'-multiboot.bin'), 'wb') as top_multiboot_file:
top_multiboot_file.write(multiboot_header)
top_multiboot_file.write(top)
print(
"""A2Fomu build complete. Output files:
build/gateware/top.bin Bitstream file. Use dfu-util to load.
build/gateware/top-multiboot.bin Multiboot-enabled bitstream file. May be
used with Booster to replace failsafe gateware. Caution: not reccommended
as it will likely brick device.
build/gateware/top.v Verilog representation of SoC.
build/software/include/generated/ Header files used by software.
""")
if __name__ == "__main__":
main()
| [
1,
529,
276,
1112,
420,
29958,
6146,
29883,
1182,
860,
29914,
29874,
29906,
29888,
290,
29884,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
13,
29937,
263,
29906,
29888,
290,
29884,
29918,
4282,
29889,
2272,
448,
3455,
310,
263,
29906,
29888,
290,
29884,
448,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29900,
29899,
29906,
29900,
29906,
29896,
529,
5813,
29958,
13,
29937,
13,
29937,
910,
934,
3743,
263,
7282,
11896,
515,
285,
711,
3155,
29899,
2966,
5461,
29889,
2272,
13,
29937,
607,
281,
465,
1754,
3625,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
29901,
13,
29937,
965,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
13,
29937,
16032,
278,
301,
568,
29916,
2048,
5177,
304,
22782,
278,
316,
567,
29914,
3884,
13,
29937,
7029,
11104,
445,
301,
29916,
4282,
6272,
2060,
337,
3687,
373,
29889,
13,
29880,
29916,
29918,
22594,
353,
6796,
3780,
11023,
613,
376,
293,
342,
555,
613,
376,
29891,
359,
952,
613,
376,
4622,
21257,
29878,
29899,
625,
29946,
29900,
3108,
13,
5215,
301,
29916,
4282,
6272,
13,
13,
29937,
2967,
12837,
15848,
29901,
286,
2101,
13,
3166,
286,
2101,
1053,
15591,
29892,
9954,
284,
29892,
2799,
749,
29892,
315,
908,
15951,
29892,
960,
13,
3166,
286,
2101,
29889,
29888,
29882,
11671,
29889,
5965,
455,
1338,
1053,
323,
1254,
374,
552,
13,
3166,
286,
2101,
29889,
29888,
29882,
11671,
29889,
23905,
1053,
2538,
300,
10140,
284,
13,
3166,
286,
2101,
29889,
29888,
29882,
11671,
29889,
19557,
4097,
1053,
315,
908,
11096,
2708,
29934,
264,
4183,
13,
29937,
1105,
29907,
10585,
322,
3990,
1061,
29901,
365,
568,
29990,
13,
3166,
301,
568,
29916,
29889,
4282,
29889,
29880,
19704,
29889,
12120,
1053,
365,
19704,
21889,
13,
3166,
301,
568,
29916,
29889,
4282,
29889,
19206,
29918,
12120,
1053,
349,
1144,
29892,
3323,
25436,
13,
3166,
301,
568,
29916,
29889,
4282,
29889,
3601,
29889,
12120,
1053,
3439,
21889,
13,
3166,
301,
568,
29916,
29889,
29879,
542,
29889,
27925,
29889,
1514,
1053,
11133,
14526,
29892,
15591,
14526,
13,
3166,
301,
568,
29916,
29889,
29879,
542,
29889,
27925,
29889,
29879,
542,
29918,
3221,
1053,
1105,
4174,
487,
13,
3166,
301,
568,
29916,
29889,
29879,
542,
29889,
29883,
2361,
29889,
21970,
1053,
28505,
3904,
650,
13,
3166,
301,
568,
29916,
29889,
29879,
542,
29889,
27925,
29889,
16409,
1053,
5373,
2700,
13,
3166,
301,
568,
29916,
29889,
29879,
542,
29889,
1639,
6915,
1053,
6398,
15933,
13,
3166,
301,
568,
29916,
29889,
29879,
542,
29889,
29883,
2361,
1053,
701,
29945,
2039,
558,
314,
29892,
805,
29875,
29918,
28041,
13,
3166,
301,
568,
29916,
29918,
24691,
29889,
5182,
29879,
29889,
29888,
290,
29884,
1053,
903,
11341,
29954,
13,
5215,
301,
568,
29916,
29889,
29879,
542,
29889,
1514,
408,
301,
10351,
542,
1514,
13,
29937,
12951,
4701,
29901,
2630,
6478,
29965,
1744,
13,
3166,
659,
6478,
28685,
29889,
28685,
3221,
1053,
12013,
408,
502,
24840,
13,
3166,
659,
6478,
28685,
29889,
28685,
3221,
29889,
21970,
1053,
321,
3358,
331,
29892,
443,
361,
361,
29877,
29892,
321,
7810,
361,
29877,
29892,
20254,
28685,
29892,
321,
415,
374,
13,
3166,
659,
6478,
28685,
29889,
28685,
3221,
29889,
29734,
1053,
2796,
3149,
1542,
13,
29937,
383,
290,
29884,
322,
14890,
29946,
29900,
10585,
29901,
13,
3166,
364,
15206,
29889,
29888,
290,
329,
3222,
1053,
28675,
29925,
7925,
13,
3166,
364,
15206,
29889,
456,
1885,
1053,
16968,
29943,
3568,
2519,
3491,
29892,
383,
3568,
2519,
3491,
13,
3166,
364,
15206,
29889,
20778,
29893,
2817,
4777,
1053,
317,
29933,
29956,
2817,
20967,
13,
13,
3166,
364,
15206,
29889,
11548,
29906,
1053,
12113,
29906,
13,
3166,
364,
15206,
29889,
15926,
567,
558,
314,
1053,
349,
11191,
29918,
5550,
25058,
13,
13,
29937,
3251,
293,
5132,
10585,
13,
5215,
1852,
5510,
13,
5215,
2897,
13,
13,
13,
29937,
3439,
8250,
25796,
29901,
6204,
306,
29914,
29949,
282,
1144,
393,
508,
5067,
411,
3918,
1243,
13,
29937,
480,
3246,
29889,
13,
3601,
29918,
601,
353,
518,
13,
1678,
396,
4529,
2246,
3233,
3957,
1546,
383,
6488,
29965,
322,
1027,
9183,
13,
1678,
4852,
20495,
613,
29871,
29900,
29892,
13,
4706,
3323,
25436,
703,
20495,
29946,
29947,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
20495,
29896,
29906,
613,
349,
1144,
29898,
29896,
8243,
13,
1678,
10353,
13,
1678,
4852,
12071,
613,
29871,
29900,
29892,
349,
1144,
29898,
29896,
8243,
13,
13,
1678,
4852,
1792,
29918,
839,
29918,
29876,
613,
29871,
29900,
29892,
349,
1144,
29898,
29896,
8243,
13,
1678,
4852,
23973,
29918,
839,
613,
29871,
29900,
29892,
13,
4706,
3323,
25436,
703,
29878,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
29887,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
29890,
613,
349,
1144,
29898,
29896,
8243,
13,
1678,
10353,
13,
13,
1678,
4852,
16747,
29918,
29886,
1144,
613,
29871,
29900,
29892,
13,
4706,
3323,
25436,
703,
1792,
29918,
16747,
29918,
29900,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
1792,
29918,
16747,
29918,
29896,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
1792,
29918,
16747,
29918,
29906,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
1792,
29918,
16747,
29918,
29941,
613,
349,
1144,
29898,
29896,
8243,
13,
1678,
10353,
13,
13,
1678,
4852,
28685,
613,
29871,
29900,
29892,
13,
4706,
3323,
25436,
703,
29881,
29918,
29886,
613,
1678,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
29881,
29918,
29876,
613,
1678,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
26746,
786,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
7508,
29918,
264,
613,
349,
1144,
29898,
29896,
8243,
13,
1678,
10353,
13,
13,
1678,
4852,
1028,
361,
29880,
1161,
613,
29871,
29900,
29892,
13,
4706,
3323,
25436,
703,
2395,
29918,
29876,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
20495,
613,
29871,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
7681,
29875,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
29885,
10718,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
11912,
613,
259,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
8948,
613,
349,
1144,
29898,
29896,
8243,
13,
1678,
10353,
13,
1678,
4852,
1028,
361,
29880,
1161,
29946,
29916,
613,
29871,
29900,
29892,
13,
4706,
3323,
25436,
703,
2395,
29918,
29876,
613,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
20495,
613,
29871,
349,
1144,
29898,
29896,
8243,
13,
4706,
3323,
25436,
703,
29881,
29939,
613,
259,
349,
1144,
29898,
29946,
8243,
13,
1678,
10353,
13,
29962,
13,
13,
3601,
29918,
6915,
943,
353,
518,
703,
16747,
29918,
29886,
1144,
613,
376,
1792,
29918,
16747,
29918,
29900,
29892,
1404,
29918,
16747,
29918,
29896,
29892,
1404,
29918,
16747,
29918,
29906,
29892,
1404,
29918,
16747,
29918,
29941,
13531,
13,
13,
13,
29937,
315,
908,
322,
10092,
18470,
393,
278,
1027,
9183,
4225,
363,
1571,
953,
2785,
29889,
13,
1990,
1027,
29918,
11341,
29954,
29898,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7481,
1125,
13,
4706,
1067,
29895,
353,
7481,
29889,
3827,
703,
20495,
1159,
13,
4706,
364,
303,
353,
7481,
29889,
3827,
703,
12071,
1159,
13,
4706,
1067,
29895,
29896,
29906,
353,
9954,
284,
580,
13,
13,
4706,
1583,
29889,
13058,
29918,
3129,
2708,
29889,
2252,
29918,
9675,
353,
315,
908,
15951,
580,
13,
4706,
1583,
29889,
13058,
29918,
3129,
2708,
29889,
2252,
29918,
28685,
29918,
29896,
29906,
353,
315,
908,
15951,
580,
13,
4706,
1583,
29889,
13058,
29918,
3129,
2708,
29889,
2252,
29918,
28685,
29918,
29946,
29947,
353,
315,
908,
15951,
580,
13,
4706,
1583,
29889,
13058,
29918,
3129,
2708,
29889,
2252,
29918,
28685,
29918,
29946,
29947,
29918,
517,
29918,
29896,
29906,
353,
315,
908,
15951,
580,
13,
13,
4706,
396,
20495,
29896,
29906,
353,
1067,
29895,
29889,
20495,
29896,
29906,
13,
4706,
1067,
29895,
29946,
29947,
353,
1067,
29895,
29889,
20495,
29946,
29947,
13,
4706,
396,
1311,
29889,
17743,
4619,
1067,
29895,
29889,
20495,
29896,
29906,
29889,
1837,
29898,
20495,
29896,
29906,
29897,
13,
4706,
396,
1311,
29889,
17743,
4619,
1067,
29895,
29889,
20495,
29946,
29947,
29889,
1837,
29898,
20495,
29946,
29947,
29897,
13,
4706,
1583,
29889,
17743,
4619,
1583,
29889,
2252,
29918,
28685,
29918,
29946,
29947,
29889,
20495,
29889,
1837,
29898,
20495,
29946,
29947,
29897,
13,
4706,
1583,
29889,
17743,
4619,
1583,
29889,
2252,
29918,
28685,
29918,
29946,
29947,
29918,
517,
29918,
29896,
29906,
29889,
20495,
29889,
1837,
29898,
20495,
29946,
29947,
29897,
13,
13,
4706,
396,
21340,
29871,
29896,
29906,
29924,
12661,
12006,
491,
8542,
310,
29871,
29946,
29947,
29924,
12661,
12006,
13,
4706,
1067,
29895,
29896,
29906,
29918,
11808,
353,
9954,
284,
29898,
29906,
29897,
13,
4706,
1583,
29889,
16593,
29889,
28685,
29918,
29946,
29947,
29918,
517,
29918,
29896,
29906,
4619,
1067,
29895,
29896,
29906,
29918,
11808,
29889,
1837,
29898,
20495,
29896,
29906,
29918,
11808,
718,
29871,
29896,
29897,
13,
4706,
1583,
29889,
17743,
4619,
1067,
29895,
29896,
29906,
29889,
1837,
29898,
20495,
29896,
29906,
29918,
11808,
29961,
29896,
2314,
13,
13,
4706,
396,
853,
9342,
278,
1494,
304,
9025,
29871,
29946,
29947,
29924,
12661,
390,
10669,
29899,
29963,
363,
8473,
17402,
13,
4706,
396,
24412,
29901,
372,
16706,
12951,
12084,
408,
599,
848,
674,
367,
2665,
29871,
29946,
29916,
13,
4706,
396,
1311,
29889,
17743,
4619,
1583,
29889,
2252,
29918,
9675,
29889,
20495,
29889,
1837,
29898,
20495,
29946,
29947,
29897,
13,
4706,
396,
4803,
278,
1494,
363,
383,
29925,
12739,
28750,
13,
4706,
1583,
29889,
17743,
4619,
1583,
29889,
2252,
29918,
9675,
29889,
20495,
29889,
1837,
29898,
20495,
29896,
29906,
29897,
13,
4706,
1583,
29889,
17743,
4619,
1583,
29889,
2252,
29918,
28685,
29918,
29896,
29906,
29889,
20495,
29889,
1837,
29898,
20495,
29896,
29906,
29897,
13,
13,
4706,
1583,
29889,
17743,
4619,
518,
13,
9651,
2538,
300,
10140,
284,
703,
9675,
2564,
1837,
29898,
29878,
303,
511,
13,
9651,
2538,
300,
10140,
284,
703,
28685,
29918,
29896,
29906,
2564,
1837,
29898,
29878,
303,
511,
13,
9651,
2538,
300,
10140,
284,
703,
28685,
29918,
29946,
29947,
2564,
1837,
29898,
29878,
303,
511,
13,
9651,
396,
19928,
451,
10092,
14965,
29918,
28685,
29918,
29946,
29947,
29918,
517,
29918,
29896,
29906,
6467,
12006,
1933,
1241,
8870,
1372,
13,
9651,
396,
322,
10876,
29918,
20495,
5354,
8465,
304,
10092,
13,
4706,
4514,
13,
13,
1990,
1027,
29918,
21889,
29898,
8942,
21889,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
26554,
29922,
8516,
29892,
5780,
14153,
543,
369,
309,
1061,
29908,
1125,
13,
4706,
2322,
29918,
20495,
29918,
978,
353,
376,
20495,
29896,
29906,
29908,
13,
4706,
3439,
21889,
17255,
2344,
12035,
1311,
29892,
13,
462,
632,
376,
3601,
613,
13,
462,
632,
1027,
29918,
601,
29892,
13,
462,
632,
4511,
943,
29922,
3601,
29918,
6915,
943,
29892,
13,
462,
632,
5780,
14153,
29922,
10154,
14153,
29897,
13,
4706,
1583,
29889,
276,
4924,
353,
26554,
13,
4706,
1583,
29889,
1028,
29875,
29918,
2311,
353,
29871,
29906,
334,
29871,
29896,
29900,
29906,
29946,
334,
29871,
29896,
29900,
29906,
29946,
13,
4706,
1583,
29889,
1028,
29875,
29918,
29881,
11770,
353,
29871,
29953,
13,
13,
1678,
822,
1653,
29918,
8860,
1050,
29898,
1311,
1125,
13,
4706,
12020,
7865,
2392,
703,
28426,
338,
451,
6969,
1159,
13,
13,
13,
1753,
788,
29918,
29888,
3844,
29918,
3859,
29918,
7039,
7295,
13,
1678,
9995,
29950,
547,
278,
383,
17061,
3883,
304,
788,
2106,
2983,
304,
278,
1962,
15945,
29908,
13,
1678,
515,
286,
2101,
29889,
29888,
29882,
11671,
29889,
1730,
277,
1053,
9071,
13372,
261,
13,
1678,
515,
286,
2101,
29889,
1885,
1982,
29889,
29888,
3844,
1053,
8084,
2792,
29892,
8084,
1917,
29892,
903,
5182,
29918,
1837,
13,
1678,
515,
286,
2101,
29889,
29888,
29882,
11671,
29889,
2966,
7611,
1053,
995,
29918,
14836,
29918,
4530,
13,
13,
1678,
770,
1619,
29918,
19357,
9190,
29898,
4247,
13372,
261,
1125,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
2446,
29918,
3859,
29918,
25436,
29892,
2446,
29918,
3859,
29918,
978,
29918,
25436,
29892,
8025,
29892,
13,
462,
268,
14430,
2129,
1125,
13,
9651,
1583,
29889,
4622,
29918,
3859,
29918,
25436,
353,
2446,
29918,
3859,
29918,
25436,
13,
9651,
1583,
29889,
4622,
29918,
3859,
29918,
978,
29918,
25436,
353,
2446,
29918,
3859,
29918,
978,
29918,
25436,
13,
9651,
1583,
29889,
22331,
353,
8025,
13,
9651,
1583,
29889,
2606,
2129,
353,
14430,
2129,
13,
9651,
396,
313,
5182,
29892,
2446,
29918,
1767,
29918,
346,
29892,
2446,
29918,
1767,
29897,
13,
9651,
1583,
29889,
9573,
29879,
353,
5159,
13,
13,
4706,
822,
903,
657,
29918,
9573,
29918,
6451,
29898,
1311,
29892,
3646,
1125,
13,
9651,
363,
921,
297,
1583,
29889,
9573,
29879,
29901,
13,
18884,
565,
903,
5182,
29918,
1837,
29898,
5182,
29892,
921,
29961,
29900,
29962,
1125,
13,
462,
1678,
736,
921,
29961,
29896,
1402,
921,
29961,
29906,
29962,
13,
9651,
12020,
7670,
2392,
13,
13,
4706,
822,
6493,
29918,
26690,
29898,
1311,
29892,
2943,
1125,
13,
9651,
565,
338,
8758,
29898,
3177,
29892,
8084,
2792,
1125,
13,
18884,
1018,
29901,
13,
462,
1678,
3935,
29918,
3859,
353,
1583,
29889,
2606,
2129,
29961,
3177,
29889,
3859,
29962,
13,
18884,
5174,
7670,
2392,
29901,
13,
462,
1678,
3935,
29918,
3859,
353,
2943,
29889,
3859,
13,
18884,
736,
518,
13,
462,
1678,
1583,
29889,
4622,
29918,
3859,
29918,
25436,
29889,
1837,
29898,
1311,
29889,
22331,
29961,
19304,
29918,
3859,
11724,
13,
462,
1678,
1583,
29889,
4622,
29918,
3859,
29918,
978,
29918,
25436,
29889,
1837,
29898,
13,
462,
4706,
938,
29889,
3166,
29918,
13193,
29898,
19304,
29918,
3859,
29889,
12508,
3285,
7023,
2098,
543,
3752,
5783,
13,
18884,
4514,
13,
9651,
25342,
338,
8758,
29898,
3177,
29892,
8084,
1917,
1125,
13,
18884,
1018,
29901,
13,
462,
1678,
2446,
29918,
1767,
29918,
346,
29892,
2446,
29918,
1767,
353,
1583,
3032,
657,
29918,
9573,
29918,
6451,
29898,
13,
462,
4706,
2943,
29889,
5182,
29897,
13,
18884,
5174,
7670,
2392,
29901,
13,
462,
1678,
4475,
353,
2943,
29889,
5182,
565,
338,
8758,
29898,
3177,
29889,
5182,
29892,
13,
462,
462,
462,
4706,
9954,
284,
29897,
1683,
6213,
13,
462,
1678,
2446,
29918,
1767,
353,
9954,
284,
29898,
14836,
29918,
4530,
29922,
1767,
29918,
14836,
29918,
4530,
29898,
3177,
29889,
5182,
511,
13,
462,
462,
4706,
4475,
29922,
12817,
29897,
13,
462,
1678,
2446,
29918,
1767,
29918,
346,
353,
9954,
284,
29898,
12817,
29922,
12817,
29897,
13,
462,
1678,
1583,
29889,
9573,
29879,
29889,
4397,
29898,
13,
462,
4706,
313,
3177,
29889,
5182,
29892,
2446,
29918,
1767,
29918,
346,
29892,
2446,
29918,
1767,
876,
13,
18884,
736,
2446,
29918,
1767,
29889,
1837,
29898,
3177,
29889,
1767,
511,
2446,
29918,
1767,
29918,
346,
29889,
1837,
29898,
29896,
29897,
13,
9651,
1683,
29901,
13,
18884,
736,
2943,
13,
13,
1678,
1053,
286,
2101,
29889,
1885,
1982,
29889,
29888,
3844,
408,
285,
3844,
13,
13,
1678,
822,
590,
29918,
13609,
29918,
26255,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3859,
29918,
978,
353,
9954,
284,
29898,
2435,
29898,
3317,
29898,
1311,
29889,
22331,
29892,
1820,
29922,
2435,
876,
334,
29871,
29947,
29892,
13,
462,
462,
10092,
29922,
524,
29889,
3166,
29918,
13193,
29898,
13,
462,
462,
268,
1583,
29889,
12071,
29918,
3859,
29889,
12508,
3285,
13,
462,
462,
268,
7023,
2098,
543,
3752,
5783,
13,
4706,
1583,
29889,
4622,
29918,
3859,
29918,
978,
353,
9954,
284,
29898,
2435,
29898,
3317,
29898,
1311,
29889,
22331,
29892,
1820,
29922,
2435,
876,
334,
29871,
29947,
29892,
13,
462,
462,
418,
10092,
29922,
524,
29889,
3166,
29918,
13193,
29898,
13,
462,
462,
3986,
1583,
29889,
12071,
29918,
3859,
29889,
12508,
3285,
13,
462,
462,
3986,
7023,
2098,
543,
3752,
5783,
13,
4706,
1583,
29889,
17743,
4619,
1583,
29889,
4622,
29918,
3859,
29918,
978,
29889,
1837,
29898,
1311,
29889,
3859,
29918,
978,
29897,
13,
4706,
1583,
29889,
16593,
4619,
1583,
29889,
3859,
29918,
978,
29889,
1837,
29898,
1311,
29889,
4622,
29918,
3859,
29918,
978,
29897,
13,
4706,
736,
1619,
29918,
19357,
9190,
29898,
1311,
29889,
4622,
29918,
3859,
29892,
1583,
29889,
4622,
29918,
3859,
29918,
978,
29892,
13,
462,
9651,
1583,
29889,
22331,
29892,
1583,
29889,
3859,
29918,
2606,
2129,
29897,
13,
13,
1678,
285,
3844,
29889,
9998,
29924,
3032,
13609,
29918,
26255,
353,
590,
29918,
13609,
29918,
26255,
13,
13,
13,
1990,
28096,
29898,
29931,
19704,
21889,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
26554,
29922,
8516,
29892,
5780,
14153,
543,
293,
342,
555,
29908,
1125,
13,
4706,
1583,
29889,
276,
4924,
353,
26554,
13,
4706,
565,
26554,
1275,
376,
5750,
29873,
1115,
13,
9651,
515,
301,
568,
29916,
29918,
24691,
29889,
12120,
29879,
29889,
29888,
290,
29884,
29918,
5750,
29873,
1053,
903,
601,
29892,
903,
6915,
943,
13,
9651,
365,
19704,
21889,
17255,
2344,
12035,
1311,
29892,
376,
625,
29946,
29900,
29899,
786,
29945,
29895,
29899,
5311,
29946,
29947,
613,
903,
601,
29892,
903,
6915,
943,
29892,
5780,
14153,
543,
293,
342,
555,
1159,
13,
9651,
1583,
29889,
1028,
29875,
29918,
2311,
353,
29871,
29896,
29953,
334,
29871,
29896,
29900,
29906,
29946,
334,
29871,
29896,
29900,
29906,
29946,
13,
9651,
1583,
29889,
1028,
29875,
29918,
29881,
11770,
353,
29871,
29953,
13,
4706,
25342,
26554,
1275,
376,
29881,
21908,
1115,
13,
9651,
515,
301,
568,
29916,
29918,
24691,
29889,
12120,
29879,
29889,
29888,
290,
29884,
29918,
29886,
21908,
1053,
903,
601,
29892,
903,
6915,
943,
13,
9651,
365,
19704,
21889,
17255,
2344,
12035,
1311,
29892,
376,
625,
29946,
29900,
29899,
786,
29945,
29895,
29899,
7262,
29887,
29941,
29900,
613,
903,
601,
29892,
903,
6915,
943,
29892,
5780,
14153,
543,
293,
342,
555,
1159,
13,
9651,
1583,
29889,
1028,
29875,
29918,
2311,
353,
29871,
29906,
334,
29871,
29896,
29900,
29906,
29946,
334,
29871,
29896,
29900,
29906,
29946,
13,
9651,
1583,
29889,
1028,
29875,
29918,
29881,
11770,
353,
29871,
29953,
13,
4706,
25342,
26554,
1275,
376,
29886,
21908,
1115,
13,
9651,
515,
301,
568,
29916,
29918,
24691,
29889,
12120,
29879,
29889,
29888,
290,
29884,
29918,
29886,
21908,
1053,
903,
601,
29892,
903,
6915,
943,
13,
9651,
365,
19704,
21889,
17255,
2344,
12035,
1311,
29892,
376,
625,
29946,
29900,
29899,
786,
29945,
29895,
29899,
7262,
29887,
29941,
29900,
613,
903,
601,
29892,
903,
6915,
943,
29892,
5780,
14153,
543,
293,
342,
555,
1159,
13,
9651,
1583,
29889,
1028,
29875,
29918,
2311,
353,
29871,
29906,
334,
29871,
29896,
29900,
29906,
29946,
334,
29871,
29896,
29900,
29906,
29946,
13,
9651,
1583,
29889,
1028,
29875,
29918,
29881,
11770,
353,
29871,
29953,
13,
4706,
25342,
26554,
1275,
376,
29882,
28940,
1115,
13,
9651,
515,
301,
568,
29916,
29918,
24691,
29889,
12120,
29879,
29889,
29888,
290,
29884,
29918,
29882,
28940,
1053,
903,
601,
29892,
903,
6915,
943,
13,
9651,
365,
19704,
21889,
17255,
2344,
12035,
1311,
29892,
376,
625,
29946,
29900,
29899,
786,
29945,
29895,
29899,
7262,
29887,
29941,
29900,
613,
903,
601,
29892,
903,
6915,
943,
29892,
5780,
14153,
543,
293,
342,
555,
1159,
13,
9651,
1583,
29889,
1028,
29875,
29918,
2311,
353,
29871,
29906,
334,
29871,
29896,
29900,
29906,
29946,
334,
29871,
29896,
29900,
29906,
29946,
13,
9651,
1583,
29889,
1028,
29875,
29918,
29881,
11770,
353,
29871,
29946,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
703,
2525,
29423,
1891,
26554,
29901,
426,
1836,
29871,
8360,
776,
1819,
29901,
3415,
29873,
29892,
14897,
29873,
29892,
282,
21908,
29892,
447,
4937,
1642,
4830,
29898,
276,
4924,
876,
13,
13,
1678,
822,
1653,
29918,
8860,
1050,
29898,
1311,
1125,
13,
4706,
12020,
7865,
2392,
703,
28426,
338,
451,
6969,
297,
445,
5177,
1159,
13,
13,
13,
1990,
7399,
6295,
29907,
29898,
6295,
4174,
487,
29892,
11133,
14526,
1125,
13,
1678,
9995,
29909,
29906,
29943,
290,
29884,
1105,
29907,
322,
13760,
12657,
13,
13,
1678,
383,
290,
29884,
338,
385,
383,
29925,
12739,
393,
23994,
9186,
2629,
263,
12951,
2011,
29889,
13,
1678,
319,
29906,
29943,
290,
29884,
338,
385,
12113,
1944,
17432,
2768,
310,
383,
290,
29884,
3412,
411,
385,
13598,
13,
1678,
1788,
363,
967,
2761,
21433,
29889,
450,
1105,
29907,
3743,
263,
2319,
390,
6488,
393,
13,
1678,
15376,
278,
6570,
515,
21967,
3370,
964,
18113,
29889,
13,
1678,
9995,
13,
13,
1678,
1105,
4174,
487,
29889,
2395,
29878,
29918,
1958,
353,
426,
13,
539,
396,
29908,
24220,
1115,
9651,
29900,
29892,
29871,
396,
365,
568,
29990,
448,
1784,
2253,
3913,
363,
278,
2913,
13,
4706,
376,
11548,
29906,
1115,
3986,
29900,
29892,
13,
4706,
376,
7283,
29887,
1115,
632,
29896,
29892,
29871,
396,
1404,
448,
694,
28975,
297,
278,
2322,
12006,
3883,
13,
539,
396,
29908,
29884,
442,
29918,
11461,
1115,
4706,
29906,
29892,
29871,
396,
383,
290,
29884,
349,
29963,
29911,
756,
694,
282,
1144,
363,
318,
442,
13,
539,
396,
29908,
29884,
442,
1115,
9651,
29941,
29892,
29871,
396,
383,
290,
29884,
349,
29963,
29911,
756,
694,
282,
1144,
363,
318,
442,
13,
539,
396,
29908,
25378,
29918,
6954,
1115,
29871,
29946,
29892,
29871,
396,
19039,
13,
4706,
376,
20404,
29900,
1115,
3986,
29945,
29892,
29871,
396,
4944,
491,
2322,
313,
25253,
29897,
13,
539,
396,
29908,
21970,
29918,
272,
29918,
18419,
1115,
259,
29947,
29892,
29871,
396,
9531,
1244,
13,
4706,
376,
28685,
1115,
632,
29929,
29892,
13,
539,
396,
29908,
16447,
272,
29894,
1028,
29875,
1115,
539,
29896,
29900,
29892,
13,
4706,
376,
16747,
1115,
965,
29896,
29896,
29892,
13,
4706,
376,
276,
4777,
1115,
3986,
29896,
29906,
29892,
13,
4706,
376,
23973,
1115,
632,
29896,
29941,
29892,
13,
539,
396,
29908,
3259,
1115,
308,
29896,
29946,
29892,
13,
4706,
376,
29880,
29916,
1028,
29875,
1115,
965,
29896,
29945,
29892,
13,
539,
396,
29908,
12062,
1821,
1115,
4706,
29896,
29953,
29892,
13,
1678,
500,
13,
13,
1678,
1105,
4174,
487,
29889,
6954,
29918,
1958,
353,
426,
13,
4706,
376,
456,
1115,
1669,
29900,
29916,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
396,
313,
4381,
15504,
732,
29900,
29916,
29947,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
4706,
376,
29879,
2572,
1115,
795,
29900,
29916,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
396,
313,
4381,
15504,
732,
29900,
29916,
29929,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
4706,
376,
1028,
361,
29880,
1161,
1115,
3986,
29900,
29916,
29906,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
396,
313,
4381,
15504,
732,
29900,
17367,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
4706,
376,
29874,
29906,
2572,
1115,
632,
29900,
29916,
29907,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
396,
313,
4381,
15504,
732,
29900,
21791,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
4706,
376,
2395,
29878,
1115,
1669,
29900,
17115,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
396,
313,
4381,
15504,
732,
29900,
17115,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
4706,
376,
13809,
3780,
11023,
29918,
8382,
1115,
1678,
29900,
24660,
29900,
29900,
29888,
29900,
29900,
29900,
29900,
29892,
13,
1678,
500,
13,
13,
1678,
23754,
29918,
1958,
353,
426,
13,
4706,
376,
20404,
29900,
1115,
29871,
29906,
29892,
13,
4706,
376,
28685,
1115,
29871,
29941,
29892,
13,
1678,
500,
13,
1678,
23754,
29918,
1958,
29889,
5504,
29898,
6295,
4174,
487,
29889,
1639,
6685,
29918,
1958,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7481,
29892,
6579,
29918,
4993,
543,
9502,
613,
13,
462,
330,
2585,
29918,
8382,
29922,
8516,
29892,
502,
29890,
29918,
29893,
728,
15933,
29922,
8824,
29892,
289,
2363,
29918,
1445,
29922,
8516,
29892,
13,
462,
671,
29918,
29881,
1028,
29922,
8824,
29892,
2174,
2265,
543,
354,
481,
613,
1962,
29918,
3972,
543,
4282,
613,
13,
462,
282,
22230,
29918,
26776,
29922,
29900,
29892,
13,
462,
14294,
4777,
29918,
2696,
7224,
29922,
8516,
29892,
13,
462,
3579,
19290,
1125,
13,
4706,
396,
3295,
519,
23387,
18113,
6521,
773,
1027,
9183,
448,
591,
29915,
645,
788,
372,
2678,
13,
4706,
1583,
29889,
14146,
630,
29918,
29879,
2572,
29918,
2311,
353,
29871,
29900,
13,
13,
4706,
1583,
29889,
4905,
29918,
3972,
353,
1962,
29918,
3972,
13,
13,
4706,
565,
9049,
5085,
3366,
3601,
3108,
29901,
13,
9651,
1067,
29895,
29918,
29888,
7971,
353,
938,
29898,
29946,
29947,
29872,
29953,
29897,
13,
9651,
1583,
29889,
1491,
7576,
29889,
7283,
29887,
353,
1027,
29918,
11341,
29954,
29898,
12120,
29897,
13,
9651,
1583,
29889,
14146,
630,
29918,
29879,
2572,
29918,
2311,
353,
29871,
29900,
396,
29871,
29900,
29916,
29947,
29900,
29900,
29900,
29892,
13,
4706,
1683,
29901,
13,
9651,
1067,
29895,
29918,
29888,
7971,
353,
938,
29898,
29896,
29906,
29872,
29953,
29897,
13,
9651,
1583,
29889,
1491,
7576,
29889,
7283,
29887,
353,
903,
11341,
29954,
29898,
12120,
29892,
1067,
29895,
29918,
29888,
7971,
29897,
13,
13,
4706,
1105,
4174,
487,
17255,
2344,
12035,
1311,
29892,
7481,
29892,
1067,
29895,
29918,
29888,
7971,
29892,
13,
18884,
23387,
29918,
29879,
2572,
29918,
2311,
29922,
1311,
29889,
14146,
630,
29918,
29879,
2572,
29918,
2311,
29892,
411,
29918,
29884,
442,
29922,
8824,
29892,
13,
18884,
411,
29918,
24220,
29922,
8824,
29892,
5939,
29878,
29918,
1272,
29918,
2103,
29922,
29941,
29906,
29892,
3579,
19290,
29897,
13,
308,
13,
4706,
565,
330,
2585,
29918,
8382,
338,
451,
6213,
29901,
13,
9651,
565,
330,
2585,
29918,
8382,
1275,
376,
29884,
442,
1115,
13,
18884,
515,
301,
568,
29916,
29889,
29879,
542,
29889,
29883,
2361,
29889,
29884,
442,
1053,
501,
8322,
29956,
728,
15933,
29933,
8605,
13,
18884,
1583,
29889,
1491,
7576,
29889,
29884,
442,
29918,
18419,
353,
501,
8322,
29956,
728,
15933,
29933,
8605,
29898,
12120,
29889,
3827,
703,
15550,
4968,
1067,
29895,
29918,
29888,
7971,
29892,
9922,
566,
10492,
29922,
29896,
29896,
29945,
29906,
29900,
29900,
29897,
13,
18884,
1583,
29889,
1202,
29918,
29893,
29890,
29918,
6207,
29898,
1311,
29889,
29884,
442,
29918,
18419,
29889,
29893,
728,
15933,
29897,
13,
9651,
25342,
330,
2585,
29918,
8382,
1275,
376,
28685,
1115,
13,
18884,
502,
29890,
29918,
29893,
728,
15933,
353,
5852,
13,
9651,
25342,
330,
2585,
29918,
8382,
1275,
376,
1028,
29875,
1115,
13,
18884,
1053,
805,
747,
650,
13,
18884,
396,
3462,
317,
2227,
399,
728,
15933,
12945,
13,
18884,
4744,
29918,
10141,
353,
518,
13,
462,
1678,
4852,
1028,
680,
6152,
613,
29871,
29900,
29892,
13,
462,
4706,
3323,
25436,
703,
7681,
29875,
613,
349,
1144,
703,
2585,
29887,
29901,
29900,
1159,
511,
13,
462,
4706,
3323,
25436,
703,
29885,
10718,
613,
349,
1144,
703,
2585,
29887,
29901,
29896,
1159,
511,
13,
462,
4706,
3323,
25436,
703,
20495,
613,
29871,
349,
1144,
703,
2585,
29887,
29901,
29906,
1159,
511,
13,
462,
4706,
3323,
25436,
703,
2395,
29918,
29876,
613,
349,
1144,
703,
2585,
29887,
29901,
29941,
1159,
511,
13,
462,
1678,
1723,
13,
18884,
4514,
13,
18884,
7481,
29889,
1202,
29918,
17588,
29898,
8382,
29918,
10141,
29897,
13,
18884,
805,
29875,
29918,
29886,
7925,
353,
7481,
29889,
3827,
703,
1028,
680,
6152,
1159,
13,
18884,
1583,
29889,
1491,
7576,
29889,
1028,
747,
650,
353,
315,
908,
11096,
2708,
29934,
264,
4183,
703,
28685,
29918,
29896,
29906,
1159,
29898,
1028,
747,
650,
29889,
29903,
1631,
29956,
728,
15933,
29933,
8605,
29898,
1028,
29875,
29918,
29886,
7925,
29892,
281,
2658,
29922,
29946,
876,
13,
18884,
1583,
29889,
1202,
29918,
29893,
29890,
29918,
6207,
29898,
1311,
29889,
1028,
747,
650,
29889,
29893,
728,
15933,
29897,
13,
9651,
565,
756,
5552,
29898,
1311,
29892,
376,
21970,
1159,
322,
451,
338,
8758,
29898,
1311,
29889,
21970,
29892,
28505,
3904,
650,
1125,
13,
18884,
1583,
29889,
21970,
29889,
1509,
29918,
23176,
29918,
19365,
703,
2273,
29880,
29914,
29963,
735,
29934,
10669,
29894,
29918,
29943,
290,
29884,
29918,
3782,
7428,
29965,
29918,
11862,
29889,
29894,
1159,
13,
18884,
2897,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
376,
17062,
2519,
1159,
13,
18884,
396,
910,
471,
4312,
363,
385,
8859,
1873,
310,
365,
568,
29990,
13,
18884,
396,
1311,
29889,
9573,
29918,
6954,
703,
13809,
3780,
11023,
29918,
8382,
613,
29871,
29900,
24660,
29900,
29900,
29888,
29900,
29900,
29900,
29900,
29892,
1583,
29889,
21970,
29889,
8382,
29918,
8262,
29892,
29871,
29900,
29916,
29896,
29900,
29900,
29897,
13,
4706,
1683,
29901,
13,
9651,
565,
756,
5552,
29898,
1311,
29892,
376,
21970,
1159,
322,
451,
338,
8758,
29898,
1311,
29889,
21970,
29892,
28505,
3904,
650,
1125,
13,
18884,
396,
1311,
29889,
21970,
29889,
1509,
29918,
23176,
29918,
19365,
703,
2273,
29880,
29914,
29963,
735,
29934,
10669,
29894,
29918,
29943,
290,
29884,
29889,
29894,
1159,
13,
18884,
1583,
29889,
21970,
29889,
1509,
29918,
23176,
29918,
19365,
703,
2273,
29880,
29914,
29963,
735,
29934,
10669,
29894,
29918,
29943,
290,
29884,
29918,
3782,
7428,
29965,
29889,
29894,
1159,
13,
13,
4706,
396,
10937,
25058,
29899,
11901,
29945,
29968,
756,
3023,
10930,
310,
16740,
3371,
18113,
313,
5550,
25058,
467,
910,
338,
6219,
13,
4706,
396,
1584,
368,
1546,
278,
390,
10669,
29899,
29963,
322,
278,
29871,
29953,
29945,
29900,
29906,
363,
1667,
3370,
29892,
29871,
29953,
29946,
29895,
29933,
1269,
29889,
13,
4706,
7689,
314,
29918,
2311,
353,
29871,
29953,
29946,
29930,
29896,
29900,
29906,
29946,
13,
4706,
565,
451,
9049,
5085,
3366,
3601,
3108,
29901,
13,
9651,
1583,
29889,
1491,
7576,
29889,
15099,
314,
353,
701,
29945,
2039,
558,
314,
29889,
3373,
29945,
29895,
5550,
25058,
29898,
2311,
29922,
15099,
314,
29918,
2311,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1491,
7576,
29889,
15099,
314,
353,
6398,
15933,
29889,
29903,
25058,
29898,
15099,
314,
29918,
2311,
29892,
1303,
29918,
6194,
29922,
8824,
29892,
2069,
11759,
2314,
13,
4706,
1583,
29889,
9573,
29918,
6954,
703,
29879,
2572,
613,
1583,
29889,
6954,
29918,
1958,
3366,
29879,
2572,
12436,
1583,
29889,
15099,
314,
29889,
8262,
29892,
7689,
314,
29918,
2311,
29897,
13,
13,
4706,
396,
3462,
263,
11946,
1821,
363,
4742,
976,
3069,
7212,
800,
13,
4706,
396,
29928,
692,
13,
4706,
396,
1311,
29889,
1491,
7576,
29889,
12062,
1821,
353,
11946,
1821,
580,
13,
13,
4706,
396,
12113,
1944,
2702,
10585,
1244,
13,
4706,
263,
29906,
6954,
29918,
2311,
353,
29871,
29953,
29946,
29930,
29896,
29900,
29906,
29946,
13,
4706,
565,
451,
9049,
5085,
3366,
3601,
3108,
29901,
13,
9651,
263,
29906,
6954,
353,
349,
11191,
29918,
5550,
25058,
29898,
3601,
29922,
19290,
3366,
3601,
20068,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1491,
7576,
29889,
15099,
314,
353,
6398,
15933,
29889,
29903,
25058,
29898,
15099,
314,
29918,
2311,
29892,
1303,
29918,
6194,
29922,
8824,
29892,
2069,
11759,
2314,
13,
4706,
1583,
29889,
1491,
7576,
29889,
29874,
29906,
6954,
353,
263,
29906,
6954,
13,
4706,
1583,
29889,
9573,
29918,
6954,
703,
29874,
29906,
2572,
613,
1583,
29889,
6954,
29918,
1958,
3366,
29874,
29906,
2572,
12436,
1583,
29889,
29874,
29906,
6954,
29889,
8262,
29892,
263,
29906,
6954,
29918,
2311,
29897,
13,
4706,
1596,
703,
9166,
2751,
2013,
29876,
613,
330,
2585,
29918,
8382,
29892,
330,
2585,
29918,
8382,
19216,
8516,
29892,
6634,
29876,
9166,
2751,
2013,
29876,
1159,
13,
4706,
1583,
29889,
1491,
7576,
29889,
11548,
29906,
353,
12113,
29906,
29898,
12120,
29892,
263,
29906,
6954,
29892,
13114,
7607,
29887,
2585,
29918,
8382,
19216,
8516,
876,
13,
13,
4706,
565,
451,
9049,
5085,
3366,
1217,
29918,
21970,
3108,
29901,
13,
9651,
289,
2363,
29918,
2311,
353,
29871,
29900,
29916,
29906,
29900,
29900,
29900,
259,
396,
383,
290,
29884,
3918,
29871,
29947,
476,
29890,
390,
6488,
13,
9651,
565,
9049,
5085,
1839,
3601,
2033,
29901,
13,
18884,
396,
29871,
29953,
29946,
29895,
29933,
390,
6488,
1304,
297,
2058,
310,
11013,
2645,
17402,
13,
18884,
289,
2363,
29918,
2311,
353,
29871,
29900,
29916,
29896,
29900,
29900,
29900,
29900,
13,
9651,
1683,
29901,
13,
18884,
396,
390,
6488,
1136,
9351,
263,
2919,
14728,
310,
278,
9078,
382,
15176,
2908,
18113,
13,
18884,
396,
29871,
29896,
476,
29933,
390,
6488,
393,
925,
2847,
7093,
11013,
322,
432,
17204,
304,
372,
13,
18884,
289,
2363,
29918,
2311,
353,
29871,
29900,
29916,
29941,
29900,
29900,
29900,
259,
396,
29871,
29896,
29906,
29895,
29933,
4236,
2159,
773,
599,
321,
1182,
13,
18884,
289,
2363,
29918,
2311,
353,
29871,
29900,
29916,
29906,
29946,
29900,
29900,
259,
396,
29871,
29929,
29895,
29933,
13,
18884,
289,
2363,
29918,
2311,
353,
29871,
29900,
29916,
29906,
29900,
29900,
29900,
259,
396,
29871,
29947,
29895,
29933,
285,
711,
3155,
8465,
29874,
1725,
2159,
13,
18884,
289,
2363,
29918,
2311,
353,
29871,
29900,
29916,
29896,
29900,
29900,
29900,
259,
396,
29871,
29946,
29895,
29933,
6579,
12657,
13,
18884,
289,
2363,
29918,
2311,
353,
29871,
29900,
29916,
29900,
29947,
29900,
29900,
259,
396,
29871,
29906,
29895,
29933,
6579,
12657,
13,
9651,
565,
6579,
29918,
4993,
1275,
376,
29890,
2363,
29908,
470,
289,
2363,
29918,
1445,
338,
451,
6213,
29901,
13,
18884,
9049,
5085,
1839,
21970,
29918,
12071,
29918,
7328,
2033,
353,
29871,
29900,
13,
18884,
565,
289,
2363,
29918,
1445,
338,
6213,
29901,
13,
462,
1678,
1583,
29889,
14146,
630,
29918,
456,
29918,
2311,
353,
289,
2363,
29918,
2311,
13,
462,
1678,
1583,
29889,
1491,
7576,
29889,
456,
353,
6398,
15933,
29889,
29903,
25058,
29898,
29890,
2363,
29918,
2311,
29892,
1303,
29918,
6194,
29922,
5574,
29892,
2069,
11759,
2314,
13,
462,
1678,
1583,
29889,
9573,
29918,
456,
29898,
1311,
29889,
456,
29889,
8262,
29892,
289,
2363,
29918,
2311,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
29888,
3568,
2519,
29918,
456,
29918,
2311,
353,
289,
2363,
29918,
2311,
13,
462,
1678,
1583,
29889,
1491,
7576,
29889,
29888,
3568,
2519,
29918,
456,
353,
383,
3568,
2519,
3491,
29898,
29890,
2363,
29918,
2311,
29892,
289,
2363,
29918,
1445,
29897,
13,
462,
1678,
1583,
29889,
1202,
29918,
23362,
703,
3491,
29918,
23711,
6181,
613,
29871,
29896,
29897,
13,
462,
1678,
1583,
29889,
9573,
29918,
456,
29898,
1311,
29889,
29888,
3568,
2519,
29918,
456,
29889,
8262,
29892,
289,
2363,
29918,
2311,
29897,
13,
9651,
25342,
6579,
29918,
4993,
1275,
376,
9502,
1115,
13,
18884,
9049,
5085,
1839,
21970,
29918,
12071,
29918,
7328,
2033,
353,
29871,
29900,
13,
18884,
1583,
29889,
1491,
7576,
29889,
8172,
29918,
456,
353,
16968,
29943,
3568,
2519,
3491,
29898,
29890,
2363,
29918,
2311,
29897,
13,
18884,
1583,
29889,
1202,
29918,
23362,
703,
3491,
29918,
23711,
6181,
613,
29871,
29896,
29897,
13,
18884,
1583,
29889,
9573,
29918,
456,
29898,
1311,
29889,
8172,
29918,
456,
29889,
8262,
29892,
289,
2363,
29918,
2311,
29897,
13,
9651,
25342,
6579,
29918,
4993,
1275,
376,
1028,
29875,
1115,
13,
18884,
9049,
5085,
1839,
21970,
29918,
12071,
29918,
7328,
2033,
353,
29871,
29900,
13,
18884,
1583,
29889,
14146,
630,
29918,
456,
29918,
2311,
353,
289,
2363,
29918,
2311,
13,
18884,
12417,
2519,
29918,
2311,
353,
29871,
29900,
29916,
29896,
29874,
29900,
29900,
29900,
13,
18884,
1583,
29889,
28041,
29918,
4777,
29918,
7328,
353,
1583,
29889,
6954,
29918,
1958,
3366,
1028,
361,
29880,
1161,
3108,
718,
12417,
2519,
29918,
2311,
13,
18884,
1583,
29889,
1491,
7576,
29889,
456,
353,
6398,
15933,
29889,
29903,
25058,
29898,
29890,
2363,
29918,
2311,
29892,
1303,
29918,
6194,
29922,
5574,
29892,
2069,
11759,
2314,
13,
18884,
1583,
29889,
9573,
29918,
456,
29898,
1311,
29889,
456,
29889,
8262,
29892,
289,
2363,
29918,
2311,
29897,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
703,
348,
29423,
1891,
6579,
29918,
4993,
29901,
6571,
1642,
4830,
29898,
4777,
29918,
4993,
876,
13,
13,
4706,
396,
450,
301,
568,
29916,
317,
2227,
3883,
11286,
3370,
29899,
655,
2986,
13623,
29892,
408,
1532,
408,
263,
2586,
29899,
29890,
4618,
4464,
13,
4706,
396,
363,
2599,
15873,
29889,
13,
4706,
396,
361,
451,
9049,
5085,
1839,
1217,
29918,
1028,
29875,
2033,
29901,
13,
4706,
805,
29875,
29918,
29886,
7925,
353,
7481,
29889,
3827,
703,
1028,
361,
29880,
1161,
29946,
29916,
1159,
13,
4706,
1583,
29889,
1491,
7576,
29889,
29880,
29916,
1028,
29875,
353,
805,
29875,
29918,
28041,
29889,
29903,
1631,
8754,
1161,
29928,
950,
2182,
328,
29898,
1028,
29875,
29918,
29886,
7925,
29892,
20254,
29922,
12120,
29889,
1028,
29875,
29918,
29881,
11770,
29892,
1095,
713,
2264,
543,
29880,
1992,
1159,
13,
4706,
1583,
29889,
9573,
29918,
6954,
703,
1028,
361,
29880,
1161,
613,
1583,
29889,
6954,
29918,
1958,
3366,
1028,
361,
29880,
1161,
12436,
1583,
29889,
29880,
29916,
1028,
29875,
29889,
8262,
29892,
2159,
29922,
12120,
29889,
1028,
29875,
29918,
2311,
29897,
13,
13,
4706,
396,
3462,
12951,
282,
7925,
29892,
408,
1532,
408,
278,
8210,
12951,
4701,
29889,
29871,
960,
694,
10808,
338,
13,
4706,
396,
2198,
29892,
671,
278,
360,
11770,
15922,
29890,
4701,
29889,
13,
4706,
502,
29890,
29918,
29886,
7925,
353,
7481,
29889,
3827,
703,
28685,
1159,
13,
4706,
502,
29890,
29918,
601,
9721,
353,
502,
24840,
29889,
29902,
29877,
29933,
1137,
29898,
28685,
29918,
29886,
7925,
29889,
29881,
29918,
29886,
29892,
502,
29890,
29918,
29886,
7925,
29889,
29881,
29918,
29876,
29892,
502,
29890,
29918,
29886,
7925,
29889,
26746,
786,
29897,
13,
4706,
565,
756,
5552,
29898,
1311,
29892,
376,
21970,
1159,
322,
451,
338,
8758,
29898,
1311,
29889,
21970,
29892,
28505,
3904,
650,
1125,
13,
9651,
1583,
29889,
1491,
7576,
29889,
28685,
353,
321,
415,
374,
29889,
29565,
25602,
10448,
29898,
28685,
29918,
601,
9721,
29892,
4744,
29922,
28685,
29918,
29893,
728,
15933,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1491,
7576,
29889,
28685,
353,
20254,
28685,
29889,
29928,
11770,
15922,
29890,
29898,
28685,
29918,
601,
9721,
29892,
4744,
29922,
28685,
29918,
29893,
728,
15933,
29897,
13,
4706,
565,
9049,
5085,
1839,
3601,
2033,
29901,
13,
9651,
1583,
29889,
17743,
4619,
502,
29890,
29918,
29886,
7925,
29889,
7508,
29918,
264,
29889,
1837,
29898,
28685,
29918,
601,
9721,
29889,
28685,
29918,
7508,
29918,
264,
29897,
13,
13,
4706,
565,
502,
29890,
29918,
29893,
728,
15933,
29901,
13,
9651,
1583,
29889,
1202,
29918,
29893,
29890,
29918,
6207,
29898,
1311,
29889,
28685,
29889,
8382,
29918,
18419,
29889,
29893,
728,
15933,
29897,
13,
13,
4706,
396,
1152,
278,
382,
29963,
29911,
7613,
29892,
9801,
278,
9505,
430,
776,
12534,
338,
534,
391,
630,
408,
385,
1881,
13,
4706,
565,
756,
5552,
29898,
28685,
29918,
29886,
7925,
29892,
376,
29886,
352,
430,
776,
29908,
1125,
13,
9651,
9505,
430,
776,
353,
323,
1254,
374,
552,
580,
13,
9651,
1583,
29889,
5965,
455,
1338,
4619,
9505,
430,
776,
29889,
657,
29918,
509,
391,
403,
29898,
28685,
29918,
29886,
7925,
29889,
29886,
352,
430,
776,
29897,
13,
9651,
1583,
29889,
17743,
4619,
9505,
430,
776,
29889,
7297,
29889,
1837,
29898,
29900,
29897,
13,
13,
4706,
565,
451,
9049,
5085,
1839,
1217,
29918,
16747,
2033,
29901,
13,
9651,
396,
3462,
402,
2227,
29949,
282,
7925,
363,
278,
6023,
9828,
13,
9651,
7481,
29889,
1202,
29918,
17588,
29898,
15852,
29925,
7925,
29889,
16747,
29918,
10141,
29897,
13,
9651,
1583,
29889,
1491,
7576,
29889,
16747,
353,
28675,
29925,
7925,
29898,
12120,
29889,
3827,
703,
16747,
29918,
29886,
7925,
5783,
13,
13,
4706,
396,
29408,
278,
1404,
304,
22538,
278,
306,
4741,
29946,
29900,
29889,
13,
4706,
1583,
29889,
1491,
7576,
29889,
276,
4777,
353,
317,
29933,
29956,
2817,
20967,
29898,
1311,
29892,
14294,
4777,
29918,
2696,
7224,
29897,
13,
4706,
396,
960,
10808,
756,
278,
4744,
2984,
9615,
29892,
2758,
263,
6036,
393,
3620,
278,
13,
4706,
396,
10092,
3211,
393,
278,
10808,
432,
17204,
304,
29889,
13,
4706,
396,
361,
451,
9049,
5085,
1839,
3601,
2033,
29901,
13,
4706,
565,
330,
2585,
29918,
8382,
19216,
8516,
322,
451,
338,
8758,
29898,
1311,
29889,
21970,
29892,
28505,
3904,
650,
1125,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
21970,
29889,
21970,
29918,
7529,
29889,
5504,
29898,
13,
462,
1678,
474,
29918,
23176,
27175,
12877,
29922,
1311,
29889,
276,
4777,
29889,
10030,
29889,
12925,
29892,
13,
18884,
1723,
13,
9651,
5174,
29901,
13,
18884,
6213,
13,
13,
4706,
565,
451,
9049,
5085,
1839,
1217,
29918,
23973,
2033,
29901,
13,
9651,
515,
364,
15206,
29889,
29879,
27225,
1053,
317,
29933,
20566,
13,
9651,
15552,
29890,
29918,
29886,
7925,
353,
7481,
29889,
3827,
703,
23973,
29918,
839,
1159,
13,
9651,
15552,
29890,
353,
317,
29933,
20566,
29898,
12120,
29889,
276,
4924,
29892,
15552,
29890,
29918,
29886,
7925,
29897,
13,
9651,
1583,
29889,
1491,
7576,
29889,
23973,
353,
15552,
29890,
13,
9651,
565,
9049,
5085,
1839,
3601,
2033,
29901,
13,
18884,
396,
450,
14890,
29946,
29900,
25023,
12837,
338,
451,
953,
7964,
577,
5782,
304,
1243,
1785,
305,
13,
18884,
1583,
29889,
17743,
4619,
518,
13,
462,
4706,
15552,
29890,
29918,
29886,
7925,
29889,
29878,
29889,
1837,
29898,
23973,
29889,
1610,
29889,
12925,
29961,
29900,
11724,
13,
462,
4706,
15552,
29890,
29918,
29886,
7925,
29889,
29887,
29889,
1837,
29898,
23973,
29889,
1610,
29889,
12925,
29961,
29896,
11724,
13,
462,
4706,
15552,
29890,
29918,
29886,
7925,
29889,
29890,
29889,
1837,
29898,
23973,
29889,
1610,
29889,
12925,
29961,
29906,
11724,
13,
18884,
4514,
13,
13,
4706,
396,
13215,
29901,
1334,
817,
2913,
322,
445,
338,
451,
5407,
408,
372,
871,
1580,
11057,
278,
13,
4706,
396,
1904,
393,
278,
12417,
2519,
471,
8688,
363,
322,
451,
278,
1904,
393,
338,
13,
4706,
396,
2869,
297,
671,
29889,
960,
278,
2743,
12417,
2519,
338,
7500,
29892,
278,
25023,
674,
451,
13,
4706,
396,
1510,
278,
3806,
11955,
29889,
910,
338,
278,
4655,
4328,
29889,
13,
4706,
396,
1311,
29889,
1491,
7576,
29889,
3259,
353,
10079,
29898,
12120,
29889,
276,
4924,
29892,
1583,
29892,
282,
22230,
29918,
26776,
29892,
4733,
11759,
13,
4706,
396,
4706,
4852,
29900,
29916,
29946,
29945,
613,
376,
29923,
613,
376,
29943,
290,
29884,
382,
29963,
29911,
4968,
13,
4706,
396,
4706,
4852,
29900,
29916,
29946,
29946,
613,
376,
29928,
613,
376,
29943,
290,
29884,
360,
29963,
29911,
4968,
13,
4706,
396,
4706,
4852,
29900,
29916,
29945,
29900,
613,
376,
29925,
613,
376,
29943,
290,
29884,
349,
29963,
29911,
313,
24601,
29897,
4968,
13,
4706,
396,
4706,
4852,
29900,
29916,
29946,
29947,
613,
376,
29950,
613,
376,
29943,
290,
29884,
379,
28940,
4968,
13,
4706,
396,
4706,
4852,
29900,
29916,
29941,
29888,
613,
376,
29973,
613,
376,
14148,
1904,
4968,
13,
4706,
396,
268,
2314,
13,
13,
4706,
565,
451,
9049,
5085,
1839,
3601,
2033,
29901,
13,
9651,
396,
6811,
2426,
2322,
365,
568,
29990,
29915,
29879,
343,
359,
952,
29914,
4282,
17475,
13,
9651,
4974,
756,
5552,
29898,
12120,
29889,
10154,
14153,
29892,
376,
29891,
359,
952,
29918,
6886,
1159,
13,
9651,
4974,
756,
5552,
29898,
12120,
29889,
10154,
14153,
29892,
376,
4282,
29918,
6886,
1159,
13,
9651,
7481,
29889,
10154,
14153,
29889,
29891,
359,
952,
29918,
6886,
353,
518,
13,
18884,
29850,
949,
29918,
5325,
17671,
13,
18884,
376,
5552,
1958,
448,
517,
4878,
3013,
448,
326,
481,
3013,
14672,
3009,
5931,
3013,
29922,
29896,
448,
326,
481,
3013,
14672,
4541,
5931,
3013,
29922,
29900,
448,
5992,
3013,
29922,
29900,
613,
13,
18884,
376,
19274,
386,
29918,
625,
29946,
29900,
448,
3126,
426,
4282,
29918,
978,
1836,
3126,
448,
3332,
426,
4282,
29918,
978,
17671,
13,
9651,
4514,
13,
9651,
7481,
29889,
10154,
14153,
29889,
4282,
29918,
6886,
353,
518,
13,
18884,
396,
29908,
842,
448,
29916,
613,
13,
18884,
376,
842,
448,
29916,
29936,
343,
359,
952,
448,
29939,
448,
29893,
525,
5349,
385,
443,
5014,
287,
869,
2344,
29889,
5352,
6169,
448,
29880,
426,
4282,
29918,
978,
1836,
29878,
415,
426,
4282,
29918,
978,
1836,
952,
613,
13,
18884,
376,
4622,
21257,
29878,
29899,
625,
29946,
29900,
1192,
3126,
426,
4282,
29918,
978,
1836,
3126,
1192,
6739,
29888,
426,
4282,
29918,
978,
1836,
6739,
29888,
1192,
6151,
426,
4282,
29918,
978,
1836,
3945,
29908,
13,
18884,
376,
1192,
1457,
29899,
4058,
426,
4282,
29918,
978,
2403,
1457,
29918,
4058,
29889,
2272,
1192,
29912,
25428,
29913,
1192,
5113,
426,
5113,
17671,
13,
18884,
376,
625,
4058,
426,
4282,
29918,
978,
1836,
3945,
426,
4282,
29918,
978,
1836,
2109,
29908,
13,
9651,
4514,
13,
13,
9651,
396,
3462,
11663,
2674,
329,
448,
29881,
17615,
29918,
1195,
29918,
346,
29918,
1509,
29871,
29946,
29908,
304,
278,
14710,
29918,
625,
29946,
29900,
1899,
29889,
13,
9651,
396,
450,
11663,
276,
499,
29908,
12778,
385,
5684,
365,
2692,
1209,
304,
4870,
901,
6433,
297,
29892,
13,
9651,
396,
322,
278,
11663,
29881,
17615,
29918,
1195,
29918,
346,
29918,
1509,
29871,
29946,
29908,
7353,
28057,
612,
359,
952,
515,
14655,
263,
13,
9651,
396,
315,
908,
1174,
519,
7182,
363,
263,
365,
2692,
393,
756,
28145,
1135,
29871,
29946,
285,
3466,
29899,
29888,
417,
567,
29889,
13,
9651,
396,
910,
16415,
9027,
29892,
322,
16869,
502,
671,
278,
383,
29925,
12739,
901,
29497,
29889,
13,
9651,
7481,
29889,
10154,
14153,
29889,
29891,
359,
952,
29918,
6886,
29961,
29906,
29962,
4619,
376,
448,
2674,
329,
448,
10736,
29906,
448,
29881,
17615,
29918,
1195,
29918,
346,
29918,
1509,
29871,
29946,
448,
2674,
329,
29908,
13,
13,
9651,
396,
3295,
519,
2186,
6483,
29899,
17059,
3081,
1623,
577,
9226,
2519,
3838,
526,
7500,
13,
9651,
396,
11480,
4964,
3221,
29915,
29879,
3211,
3593,
29889,
13,
9651,
7481,
29889,
10154,
14153,
29889,
4282,
29918,
6886,
29961,
29906,
29962,
353,
376,
625,
4058,
448,
29879,
426,
4282,
29918,
978,
1836,
3945,
426,
4282,
29918,
978,
1836,
2109,
29908,
13,
13,
9651,
396,
29408,
502,
304,
731,
278,
2446,
21257,
29878,
16717,
13,
9651,
7481,
29889,
10154,
14153,
29889,
4282,
29918,
6886,
29961,
29896,
29962,
4619,
376,
1192,
26776,
376,
718,
851,
29898,
21257,
29878,
29918,
26776,
29897,
13,
13,
9651,
565,
2174,
2265,
338,
451,
6213,
29901,
13,
18884,
7481,
29889,
10154,
14153,
29889,
4282,
29918,
6886,
29961,
29896,
29962,
4619,
376,
1192,
13974,
2265,
6571,
1642,
4830,
29898,
13974,
2265,
29897,
13,
13,
4706,
565,
671,
29918,
29881,
1028,
29901,
13,
9651,
7481,
29889,
10154,
14153,
29889,
29891,
359,
952,
29918,
6886,
29961,
29906,
29962,
4619,
376,
448,
29881,
1028,
29908,
13,
13,
1678,
822,
3509,
29918,
14834,
29918,
1445,
29898,
1311,
29892,
4765,
1125,
13,
4706,
1053,
2897,
13,
4706,
515,
528,
4422,
1053,
3509,
1445,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
1311,
29889,
4905,
29918,
3972,
1125,
13,
9651,
2897,
29889,
11256,
3972,
29898,
1311,
29889,
4905,
29918,
3972,
29897,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
4905,
29918,
3972,
29892,
376,
17062,
2519,
5783,
29901,
13,
9651,
2897,
29889,
11256,
3972,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
4905,
29918,
3972,
29892,
376,
17062,
2519,
5783,
13,
4706,
3509,
1445,
29898,
359,
29889,
2084,
29889,
7122,
703,
2273,
29880,
613,
4765,
511,
2897,
29889,
2084,
29889,
7122,
29898,
1311,
29889,
4905,
29918,
3972,
29892,
376,
17062,
2519,
613,
4765,
876,
13,
13,
1753,
1207,
29918,
4713,
747,
3155,
29918,
6672,
29898,
9507,
29892,
6579,
29918,
2696,
7224,
11759,
29896,
29953,
29900,
29962,
1125,
13,
1678,
9995,
13,
1678,
306,
4741,
29946,
29900,
6511,
366,
304,
1824,
278,
317,
29933,
29918,
29956,
1718,
29924,
8456,
2891,
2106,
4933,
491,
4417,
278,
1494,
13,
1678,
1819,
304,
278,
2586,
5461,
29892,
1434,
738,
2183,
1967,
29901,
13,
13,
1678,
518,
29955,
29872,
29099,
29871,
29929,
29929,
29871,
29955,
29872,
29962,
539,
317,
2720,
19345,
13,
1678,
518,
29929,
29906,
29871,
29900,
29900,
413,
29900,
29962,
3986,
13760,
4464,
313,
29895,
353,
29871,
29896,
363,
11220,
6579,
29892,
29871,
29900,
363,
14294,
4777,
29897,
13,
1678,
518,
29946,
29946,
29871,
29900,
29941,
288,
29896,
288,
29906,
288,
29941,
29962,
1678,
13760,
3211,
13,
1678,
518,
29947,
29906,
29871,
29900,
29900,
29871,
29900,
29900,
29962,
3986,
10253,
9210,
13,
1678,
518,
29900,
29896,
29871,
29900,
29947,
29962,
632,
12936,
3155,
13,
1678,
21945,
1669,
349,
4676,
313,
786,
304,
29871,
29941,
29906,
6262,
29897,
13,
13,
1678,
3940,
393,
297,
306,
4741,
29946,
29900,
29892,
278,
1473,
7098,
29890,
569,
14088,
278,
1353,
310,
9886,
6262,
13,
1678,
313,
2541,
278,
3682,
310,
278,
16523,
4839,
467,
13,
13,
1678,
450,
2038,
3386,
338,
10324,
5320,
3064,
29901,
13,
13,
1678,
2672,
1806,
25758,
29918,
8456,
2891,
4706,
450,
1967,
7500,
472,
937,
6579,
13,
1678,
16437,
2891,
29918,
29903,
29900,
29900,
9651,
450,
937,
1967,
363,
317,
29933,
29918,
29956,
1718,
29924,
8456,
2891,
13,
1678,
16437,
2891,
29918,
29903,
29900,
29896,
9651,
450,
1473,
1967,
363,
317,
29933,
29918,
29956,
1718,
29924,
8456,
2891,
13,
1678,
16437,
2891,
29918,
29903,
29896,
29900,
9651,
450,
4654,
1967,
363,
317,
29933,
29918,
29956,
1718,
29924,
8456,
2891,
13,
1678,
16437,
2891,
29918,
29903,
29896,
29896,
9651,
450,
11582,
1967,
363,
317,
29933,
29918,
29956,
1718,
29924,
8456,
2891,
13,
1678,
9995,
13,
1678,
1550,
7431,
29898,
4777,
29918,
2696,
7224,
29897,
529,
29871,
29945,
29901,
13,
4706,
6579,
29918,
2696,
7224,
29889,
4397,
29898,
4777,
29918,
2696,
7224,
29961,
29900,
2314,
13,
13,
1678,
411,
1722,
29898,
9507,
29892,
525,
29893,
29890,
1495,
408,
1962,
29901,
13,
4706,
363,
9210,
297,
6579,
29918,
2696,
7224,
29901,
13,
9651,
396,
317,
2720,
19345,
13,
9651,
1962,
29889,
3539,
29898,
13193,
4197,
29900,
29916,
29955,
29872,
29892,
29871,
29900,
29916,
7340,
29892,
29871,
29900,
29916,
29929,
29929,
29892,
29871,
29900,
29916,
29955,
29872,
12622,
13,
13,
9651,
396,
13760,
4464,
13,
9651,
1962,
29889,
3539,
29898,
13193,
4197,
29900,
29916,
29929,
29906,
29892,
29871,
29900,
29916,
29900,
29900,
29892,
29871,
29900,
29916,
29900,
29900,
12622,
13,
13,
9651,
396,
13760,
3211,
13,
9651,
1962,
29889,
3539,
29898,
13193,
4197,
29900,
29916,
29946,
29946,
29892,
29871,
29900,
29916,
29900,
29941,
29892,
13,
462,
1678,
313,
10289,
5099,
29871,
29896,
29953,
29897,
669,
29871,
29900,
29916,
600,
29892,
13,
462,
1678,
313,
10289,
5099,
29871,
29947,
29897,
29871,
669,
29871,
29900,
29916,
600,
29892,
13,
462,
1678,
313,
10289,
5099,
29871,
29900,
29897,
29871,
669,
29871,
29900,
29916,
600,
12622,
13,
13,
9651,
396,
10253,
9210,
13,
9651,
1962,
29889,
3539,
29898,
13193,
4197,
29900,
29916,
29947,
29906,
29892,
29871,
29900,
29916,
29900,
29900,
29892,
29871,
29900,
29916,
29900,
29900,
12622,
13,
13,
9651,
396,
12936,
3155,
1899,
13,
9651,
1962,
29889,
3539,
29898,
13193,
4197,
29900,
29916,
29900,
29896,
29892,
29871,
29900,
29916,
29900,
29947,
12622,
13,
13,
9651,
363,
921,
297,
3464,
29898,
29896,
29955,
29892,
29871,
29941,
29906,
1125,
13,
18884,
1962,
29889,
3539,
29898,
13193,
4197,
29900,
12622,
13,
13,
1753,
1667,
7295,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
543,
8893,
319,
29906,
29943,
290,
29884,
4241,
22510,
2519,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
4777,
29899,
4993,
613,
19995,
29922,
3366,
1028,
29875,
613,
376,
9502,
613,
376,
29890,
2363,
12436,
2322,
543,
9502,
613,
13,
4706,
1371,
543,
3062,
304,
505,
278,
10808,
4017,
967,
16813,
775,
515,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
3225,
29899,
6194,
613,
2322,
29922,
8824,
29892,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
1371,
543,
10310,
29915,
29873,
2048,
12417,
2519,
470,
7047,
29892,
871,
2048,
5106,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
396,
450,
871,
4328,
1546,
23484,
1080,
338,
25023,
2927,
577,
2322,
304,
13,
4706,
396,
5802,
1873,
13,
4706,
376,
489,
276,
4924,
613,
19995,
29922,
3366,
5750,
29873,
613,
376,
29881,
21908,
613,
376,
29886,
21908,
613,
376,
29882,
28940,
12436,
2322,
543,
29886,
21908,
613,
13,
4706,
1371,
543,
4282,
263,
29906,
29888,
290,
29884,
363,
263,
3153,
12837,
1904,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
978,
613,
1371,
543,
842,
2967,
1024,
310,
1962,
2066,
613,
2322,
543,
29874,
29906,
29888,
290,
29884,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
3601,
613,
1371,
543,
4282,
12417,
2519,
13907,
363,
17402,
5177,
613,
3158,
543,
8899,
29918,
3009,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
29890,
2363,
613,
1371,
543,
1509,
6790,
934,
408,
263,
350,
25925,
29892,
3265,
1135,
5214,
697,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
29887,
2585,
29899,
8382,
613,
1371,
543,
12007,
330,
2585,
4744,
2304,
613,
19995,
29922,
3366,
28685,
613,
376,
29884,
442,
613,
376,
1028,
29875,
613,
6213,
1402,
2322,
29922,
8516,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
29893,
728,
15933,
29899,
8382,
613,
1371,
543,
12007,
4744,
2304,
613,
3158,
543,
8899,
29918,
3009,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
2541,
29899,
29881,
1028,
613,
1371,
543,
1509,
270,
1028,
27262,
297,
343,
359,
952,
313,
1333,
599,
343,
359,
952,
23315,
505,
448,
29881,
1028,
19123,
3158,
543,
8899,
29918,
3009,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
21970,
613,
1371,
543,
20472,
26403,
12623,
363,
13490,
11976,
613,
3158,
543,
8899,
29918,
3009,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
1028,
29875,
613,
1371,
543,
20472,
317,
2227,
11013,
613,
3158,
543,
8899,
29918,
3009,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
23973,
613,
1371,
543,
20472,
390,
7210,
25023,
613,
3158,
543,
8899,
29918,
3009,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
16747,
613,
1371,
543,
20472,
6023,
282,
7925,
613,
3158,
543,
8899,
29918,
3009,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
13974,
2265,
613,
19995,
29922,
3366,
4977,
613,
376,
354,
481,
12436,
2322,
543,
354,
481,
613,
1371,
543,
4716,
2174,
2265,
304,
671,
297,
2446,
21257,
29878,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
26776,
613,
2322,
29922,
29900,
29892,
1371,
543,
26776,
304,
671,
297,
2446,
21257,
29878,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
15843,
29899,
8172,
29899,
456,
29899,
1445,
613,
1371,
543,
5631,
403,
263,
4036,
390,
6488,
934,
322,
4078,
372,
304,
263,
934,
29908,
13,
1678,
1723,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
1962,
29918,
3972,
353,
525,
4282,
29915,
13,
13,
1678,
565,
6389,
29889,
15843,
29918,
8172,
29918,
456,
29918,
1445,
338,
451,
6213,
29901,
13,
4706,
2159,
353,
29871,
29900,
29916,
29906,
29900,
29900,
29900,
13,
4706,
822,
921,
272,
10889,
29941,
29906,
29898,
29916,
1125,
13,
9651,
921,
353,
921,
6228,
313,
29916,
3532,
29871,
29896,
29941,
29897,
669,
29871,
29900,
29916,
17156,
17156,
13,
9651,
921,
353,
921,
6228,
313,
29916,
5099,
29871,
29896,
29955,
29897,
669,
29871,
29900,
29916,
17156,
17156,
13,
9651,
921,
353,
921,
6228,
313,
29916,
3532,
29871,
29945,
29897,
29871,
669,
29871,
29900,
29916,
17156,
17156,
13,
9651,
736,
921,
669,
29871,
29900,
29916,
17156,
17156,
13,
13,
4706,
822,
679,
29918,
9502,
29898,
29916,
1125,
13,
9651,
714,
353,
29871,
29900,
13,
9651,
363,
474,
297,
3464,
29898,
29941,
29906,
1125,
13,
18884,
921,
353,
921,
272,
10889,
29941,
29906,
29898,
29916,
29897,
13,
18884,
565,
313,
29916,
669,
29871,
29896,
29897,
1275,
29871,
29896,
29901,
13,
462,
1678,
714,
353,
714,
891,
313,
29896,
3532,
474,
29897,
13,
9651,
736,
714,
669,
29871,
29900,
29916,
17156,
17156,
13,
4706,
16717,
353,
29871,
29896,
13,
4706,
411,
1722,
29898,
5085,
29889,
15843,
29918,
8172,
29918,
456,
29918,
1445,
29892,
376,
29893,
613,
25899,
543,
29905,
29876,
1159,
408,
1962,
29901,
13,
9651,
363,
270,
297,
3464,
29898,
524,
29898,
2311,
847,
29871,
29946,
22164,
13,
18884,
16717,
353,
679,
29918,
9502,
29898,
26776,
29897,
13,
18884,
1596,
703,
25641,
29900,
29947,
29916,
29913,
1642,
4830,
29898,
26776,
511,
934,
29922,
4905,
29897,
13,
4706,
736,
29871,
29900,
13,
13,
1678,
6633,
29918,
20415,
353,
7700,
13,
1678,
565,
313,
5085,
29889,
4777,
29918,
4993,
1275,
376,
29890,
2363,
29908,
470,
6389,
29889,
4777,
29918,
4993,
1275,
376,
1028,
29875,
1159,
322,
6389,
29889,
29890,
2363,
338,
6213,
29901,
13,
4706,
6633,
29918,
20415,
353,
5852,
13,
13,
1678,
26403,
29918,
1853,
353,
376,
13809,
3780,
11023,
29908,
13,
1678,
26403,
29918,
19365,
353,
376,
1195,
3039,
29908,
13,
1678,
565,
6389,
29889,
29887,
2585,
29918,
8382,
29901,
13,
4706,
26403,
29918,
19365,
353,
26403,
29918,
19365,
718,
15691,
8382,
29908,
13,
13,
1678,
565,
6389,
29889,
1217,
29918,
21970,
29901,
13,
4706,
26403,
29918,
1853,
353,
6213,
13,
4706,
26403,
29918,
19365,
353,
6213,
13,
13,
1678,
6633,
29918,
17062,
2519,
353,
5852,
13,
1678,
565,
6389,
29889,
3225,
29918,
6194,
29901,
13,
4706,
6633,
29918,
17062,
2519,
353,
7700,
13,
4706,
6633,
29918,
20415,
353,
7700,
13,
13,
1678,
14294,
4777,
29918,
2696,
7224,
353,
518,
13,
308,
29896,
29953,
29900,
29892,
13,
308,
29896,
29953,
29900,
29892,
13,
308,
29896,
29945,
29955,
29953,
29929,
29953,
29892,
13,
308,
29906,
29953,
29906,
29896,
29946,
29946,
29892,
13,
308,
29906,
29953,
29906,
29896,
29946,
29946,
718,
29871,
29941,
29906,
29955,
29953,
29947,
29892,
13,
1678,
4514,
13,
13,
1678,
2897,
29889,
21813,
3366,
29931,
1806,
5746,
3108,
353,
376,
29896,
29908,
396,
25538,
1749,
8561,
1445,
1554,
304,
1106,
363,
13,
13,
1678,
565,
6389,
29889,
3601,
29901,
13,
4706,
7481,
353,
1027,
29918,
21889,
29898,
276,
4924,
29922,
5085,
29889,
276,
4924,
29897,
13,
1678,
1683,
29901,
13,
4706,
7481,
353,
28096,
29898,
276,
4924,
29922,
5085,
29889,
276,
4924,
29897,
13,
13,
1678,
17874,
353,
7399,
6295,
29907,
29898,
12120,
29892,
26403,
29918,
1853,
29922,
21970,
29918,
1853,
29892,
26403,
29918,
19365,
29922,
21970,
29918,
19365,
29892,
13,
462,
9651,
330,
2585,
29918,
8382,
29922,
5085,
29889,
29887,
2585,
29918,
8382,
29892,
502,
29890,
29918,
29893,
728,
15933,
29922,
5085,
29889,
29893,
728,
15933,
29918,
8382,
29892,
13,
462,
9651,
6579,
29918,
4993,
29922,
5085,
29889,
4777,
29918,
4993,
29892,
13,
462,
9651,
289,
2363,
29918,
1445,
29922,
5085,
29889,
29890,
2363,
29892,
1027,
29922,
5085,
29889,
3601,
29892,
13,
462,
9651,
671,
29918,
29881,
1028,
29922,
5085,
29889,
2541,
29918,
29881,
1028,
29892,
2174,
2265,
29922,
5085,
29889,
13974,
2265,
29892,
13,
462,
9651,
282,
22230,
29918,
26776,
29922,
524,
29898,
5085,
29889,
26776,
511,
13,
462,
9651,
694,
29918,
1028,
29875,
29922,
5085,
29889,
1217,
29918,
1028,
29875,
29892,
13,
462,
9651,
694,
29918,
23973,
29922,
5085,
29889,
1217,
29918,
23973,
29892,
13,
462,
9651,
694,
29918,
21970,
29922,
5085,
29889,
1217,
29918,
21970,
29892,
13,
462,
9651,
694,
29918,
16747,
29922,
5085,
29889,
1217,
29918,
16747,
29892,
13,
462,
9651,
1962,
29918,
3972,
29922,
4905,
29918,
3972,
29892,
13,
462,
9651,
14294,
4777,
29918,
2696,
7224,
29922,
29893,
2817,
4777,
29918,
2696,
7224,
29961,
29896,
29901,
2314,
13,
1678,
12856,
353,
5373,
2700,
29898,
29879,
542,
29892,
1962,
29918,
3972,
29922,
4905,
29918,
3972,
29892,
5939,
29878,
29918,
7638,
543,
4282,
29914,
2395,
29878,
29889,
7638,
613,
5939,
29878,
29918,
4501,
29881,
543,
4282,
29914,
29879,
542,
29889,
4501,
29881,
613,
13,
462,
418,
6633,
29918,
20415,
29922,
12198,
29918,
20415,
29892,
6633,
29918,
17062,
2519,
29922,
12198,
29918,
17062,
2519,
29897,
13,
1678,
565,
6633,
29918,
20415,
29901,
13,
4706,
12856,
29889,
20415,
29918,
8318,
353,
518,
13,
9651,
4852,
497,
613,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
376,
636,
613,
376,
2774,
613,
376,
4351,
29908,
4961,
13,
4706,
4514,
13,
13,
1678,
565,
6389,
29889,
3601,
29901,
13,
4706,
325,
1983,
353,
12856,
29889,
4282,
29898,
3389,
29922,
8824,
29897,
13,
4706,
17874,
29889,
1867,
29918,
13322,
29898,
29894,
1983,
29897,
13,
4706,
1596,
703,
15945,
8942,
2785,
2048,
4866,
29889,
29871,
10604,
2066,
29901,
13,
1678,
2048,
29914,
17062,
2519,
29914,
29881,
329,
29889,
29894,
1669,
7525,
445,
1798,
26140,
934,
1090,
315,
542,
327,
29890,
29889,
13,
15945,
1159,
13,
4706,
736,
13,
13,
1678,
325,
1983,
353,
12856,
29889,
4282,
29898,
4282,
29918,
978,
29922,
5085,
29889,
978,
29897,
13,
1678,
17874,
29889,
1867,
29918,
13322,
29898,
29894,
1983,
29897,
13,
1678,
301,
10351,
542,
1514,
29889,
17158,
29918,
2640,
29898,
29879,
542,
29892,
376,
4282,
29914,
12663,
29914,
613,
2060,
29918,
978,
543,
29909,
29906,
29943,
290,
29884,
613,
4148,
543,
29923,
280,
29883,
1182,
860,
1159,
13,
13,
1678,
565,
451,
6389,
29889,
3225,
29918,
6194,
29901,
13,
4706,
1207,
29918,
4713,
747,
3155,
29918,
6672,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
376,
17062,
2519,
613,
376,
4713,
747,
3155,
29899,
6672,
29889,
2109,
4968,
13,
462,
9651,
14294,
4777,
29918,
2696,
7224,
29897,
13,
13,
4706,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
525,
17062,
2519,
742,
525,
4713,
747,
3155,
29899,
6672,
29889,
2109,
5477,
525,
6050,
1495,
408,
1773,
747,
3155,
29918,
6672,
29918,
1445,
29901,
13,
9651,
1773,
747,
3155,
29918,
6672,
353,
1773,
747,
3155,
29918,
6672,
29918,
1445,
29889,
949,
580,
13,
9651,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
525,
17062,
2519,
742,
6389,
29889,
978,
29974,
4286,
2109,
5477,
525,
6050,
1495,
408,
2246,
29918,
1445,
29901,
13,
18884,
2246,
353,
2246,
29918,
1445,
29889,
949,
580,
13,
18884,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
525,
17062,
2519,
742,
6389,
29889,
978,
23097,
29899,
4713,
747,
3155,
29889,
2109,
5477,
525,
29893,
29890,
1495,
408,
2246,
29918,
4713,
747,
3155,
29918,
1445,
29901,
13,
462,
1678,
2246,
29918,
4713,
747,
3155,
29918,
1445,
29889,
3539,
29898,
4713,
747,
3155,
29918,
6672,
29897,
13,
462,
1678,
2246,
29918,
4713,
747,
3155,
29918,
1445,
29889,
3539,
29898,
3332,
29897,
13,
13,
4706,
1596,
29898,
13,
1678,
9995,
29909,
29906,
29943,
290,
29884,
2048,
4866,
29889,
29871,
10604,
2066,
29901,
13,
1678,
2048,
29914,
17062,
2519,
29914,
3332,
29889,
2109,
632,
18531,
5461,
934,
29889,
4803,
4489,
29884,
29899,
4422,
304,
2254,
29889,
13,
1678,
2048,
29914,
17062,
2519,
29914,
3332,
29899,
4713,
747,
3155,
29889,
2109,
259,
9683,
747,
3155,
29899,
17590,
2586,
5461,
934,
29889,
2610,
367,
13,
1678,
1304,
411,
1952,
15664,
304,
5191,
8465,
29874,
1725,
12417,
2519,
29889,
9243,
918,
29901,
451,
1162,
2055,
2760,
13,
1678,
408,
372,
674,
5517,
28645,
4742,
29889,
13,
1678,
2048,
29914,
17062,
2519,
29914,
3332,
29889,
29894,
1669,
1798,
26140,
8954,
310,
1105,
29907,
29889,
13,
1678,
2048,
29914,
20415,
29914,
2856,
29914,
13525,
29914,
29871,
19345,
2066,
1304,
491,
7047,
29889,
13,
15945,
1159,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
tests/test_pairwisevariationmphf.py | iqbal-lab-org/pangenome_variations | 0 | 163397 | from unittest import TestCase
from src.PairwiseVariationMPHF import PairwiseVariationMPHF
from src.PairwiseVariation import PairwiseVariation
class TestPairwiseVariationMPHF(TestCase):
def test___get_pairwise_variation_id_to_alleles_id(self):
mphf = PairwiseVariationMPHF()
pairwise_variation_1 = PairwiseVariation(0, 1)
pairwise_variation_2 = PairwiseVariation(1, 2)
pairwise_variation_3 = PairwiseVariation(2, 3)
mphf.add_object(pairwise_variation_1)
mphf.add_object(pairwise_variation_1)
mphf.add_object(pairwise_variation_3)
mphf.add_object(pairwise_variation_1)
mphf.add_object(pairwise_variation_2)
mphf.add_object(pairwise_variation_3)
mphf.add_object(pairwise_variation_1)
actual_pairwise_variation_id_to_alleles_id = mphf.get_pairwise_variation_id_to_alleles_id()
expected_pairwise_variation_id_to_alleles_id = [(0,1), (2,3), (1,2)]
self.assertListEqual(actual_pairwise_variation_id_to_alleles_id,
expected_pairwise_variation_id_to_alleles_id) | [
1,
515,
443,
27958,
1053,
4321,
8259,
13,
13,
3166,
4765,
29889,
20547,
3538,
10444,
362,
3580,
29950,
29943,
1053,
349,
1466,
3538,
10444,
362,
3580,
29950,
29943,
13,
3166,
4765,
29889,
20547,
3538,
10444,
362,
1053,
349,
1466,
3538,
10444,
362,
13,
13,
1990,
4321,
20547,
3538,
10444,
362,
3580,
29950,
29943,
29898,
3057,
8259,
1125,
13,
1678,
822,
1243,
22359,
657,
29918,
18784,
3538,
29918,
5927,
362,
29918,
333,
29918,
517,
29918,
3498,
793,
29918,
333,
29898,
1311,
1125,
13,
4706,
286,
561,
29888,
353,
349,
1466,
3538,
10444,
362,
3580,
29950,
29943,
580,
13,
4706,
5101,
3538,
29918,
5927,
362,
29918,
29896,
353,
349,
1466,
3538,
10444,
362,
29898,
29900,
29892,
29871,
29896,
29897,
13,
4706,
5101,
3538,
29918,
5927,
362,
29918,
29906,
353,
349,
1466,
3538,
10444,
362,
29898,
29896,
29892,
29871,
29906,
29897,
13,
4706,
5101,
3538,
29918,
5927,
362,
29918,
29941,
353,
349,
1466,
3538,
10444,
362,
29898,
29906,
29892,
29871,
29941,
29897,
13,
13,
4706,
286,
561,
29888,
29889,
1202,
29918,
3318,
29898,
18784,
3538,
29918,
5927,
362,
29918,
29896,
29897,
13,
4706,
286,
561,
29888,
29889,
1202,
29918,
3318,
29898,
18784,
3538,
29918,
5927,
362,
29918,
29896,
29897,
13,
4706,
286,
561,
29888,
29889,
1202,
29918,
3318,
29898,
18784,
3538,
29918,
5927,
362,
29918,
29941,
29897,
13,
4706,
286,
561,
29888,
29889,
1202,
29918,
3318,
29898,
18784,
3538,
29918,
5927,
362,
29918,
29896,
29897,
13,
4706,
286,
561,
29888,
29889,
1202,
29918,
3318,
29898,
18784,
3538,
29918,
5927,
362,
29918,
29906,
29897,
13,
4706,
286,
561,
29888,
29889,
1202,
29918,
3318,
29898,
18784,
3538,
29918,
5927,
362,
29918,
29941,
29897,
13,
4706,
286,
561,
29888,
29889,
1202,
29918,
3318,
29898,
18784,
3538,
29918,
5927,
362,
29918,
29896,
29897,
13,
13,
13,
4706,
3935,
29918,
18784,
3538,
29918,
5927,
362,
29918,
333,
29918,
517,
29918,
3498,
793,
29918,
333,
353,
286,
561,
29888,
29889,
657,
29918,
18784,
3538,
29918,
5927,
362,
29918,
333,
29918,
517,
29918,
3498,
793,
29918,
333,
580,
13,
4706,
3806,
29918,
18784,
3538,
29918,
5927,
362,
29918,
333,
29918,
517,
29918,
3498,
793,
29918,
333,
353,
17288,
29900,
29892,
29896,
511,
313,
29906,
29892,
29941,
511,
313,
29896,
29892,
29906,
4638,
13,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
19304,
29918,
18784,
3538,
29918,
5927,
362,
29918,
333,
29918,
517,
29918,
3498,
793,
29918,
333,
29892,
13,
462,
632,
3806,
29918,
18784,
3538,
29918,
5927,
362,
29918,
333,
29918,
517,
29918,
3498,
793,
29918,
333,
29897,
2
] |
users-backend/users/admin_api/schema.py | pythonitalia/pycon | 56 | 128189 | import strawberry
from pythonit_toolkit.api.extensions import SentryExtension
from users.admin_api.mutation import Mutation
from users.admin_api.query import Query
schema = strawberry.federation.Schema(
query=Query, mutation=Mutation, extensions=[SentryExtension]
)
| [
1,
1053,
380,
1610,
16344,
13,
3166,
3017,
277,
29918,
10154,
7354,
29889,
2754,
29889,
24299,
1053,
317,
8269,
17657,
13,
13,
3166,
4160,
29889,
6406,
29918,
2754,
29889,
6149,
362,
1053,
20749,
362,
13,
3166,
4160,
29889,
6406,
29918,
2754,
29889,
1972,
1053,
13641,
13,
13,
11010,
353,
380,
1610,
16344,
29889,
29888,
2447,
362,
29889,
12763,
29898,
13,
1678,
2346,
29922,
3010,
29892,
5478,
362,
29922,
29924,
329,
362,
29892,
17752,
11759,
29903,
8269,
17657,
29962,
13,
29897,
13,
2
] |
app/main/routes.py | EeOneDown/spbu4u | 30 | 193947 | <filename>app/main/routes.py
from flask import render_template, current_app
from app.main import bp
from app.models import User
@bp.route("/")
@bp.route("/index")
def index():
from requests import get
url = "https://api.rasp.yandex.net/v3.0/copyright/"
params = {"apikey": current_app.config['YANDEX_API_KEY'], "format": "json"}
data = get(url, params=params).json()["copyright"]
return render_template("index.html", bot_name="Spbu4UBot", url=data["url"],
text=data["text"])
@bp.route("/<tg_id>/<idate>/<n>")
def schedule(tg_id, idate, n):
from datetime import date
user = User.query.filter_by(tg_id=tg_id).first()
answers = user.create_answers_for_interval(
from_date=date(2018, 6, int(idate)),
to_date=date(2018, 6, int(idate) + int(n)))
return render_template("schedule.html", answers=answers)
| [
1,
529,
9507,
29958,
932,
29914,
3396,
29914,
27894,
29889,
2272,
13,
3166,
29784,
1053,
4050,
29918,
6886,
29892,
1857,
29918,
932,
13,
13,
3166,
623,
29889,
3396,
1053,
289,
29886,
13,
3166,
623,
29889,
9794,
1053,
4911,
13,
13,
13,
29992,
25288,
29889,
13134,
11974,
1159,
13,
29992,
25288,
29889,
13134,
11974,
2248,
1159,
13,
1753,
2380,
7295,
13,
1678,
515,
7274,
1053,
679,
13,
13,
1678,
3142,
353,
376,
991,
597,
2754,
29889,
3417,
29886,
29889,
10094,
1390,
29889,
1212,
29914,
29894,
29941,
29889,
29900,
29914,
8552,
1266,
12975,
13,
1678,
8636,
353,
8853,
2754,
1989,
1115,
1857,
29918,
932,
29889,
2917,
1839,
29979,
2190,
19577,
29918,
8787,
29918,
10818,
7464,
376,
4830,
1115,
376,
3126,
9092,
13,
13,
1678,
848,
353,
679,
29898,
2271,
29892,
8636,
29922,
7529,
467,
3126,
580,
3366,
8552,
1266,
3108,
13,
13,
1678,
736,
4050,
29918,
6886,
703,
2248,
29889,
1420,
613,
9225,
29918,
978,
543,
5592,
2423,
29946,
7466,
327,
613,
3142,
29922,
1272,
3366,
2271,
12436,
13,
462,
965,
1426,
29922,
1272,
3366,
726,
20068,
13,
13,
13,
29992,
25288,
29889,
13134,
11974,
29966,
29873,
29887,
29918,
333,
20690,
29966,
333,
403,
20690,
29966,
29876,
29958,
1159,
13,
1753,
20410,
29898,
29873,
29887,
29918,
333,
29892,
1178,
403,
29892,
302,
1125,
13,
1678,
515,
12865,
1053,
2635,
13,
1678,
1404,
353,
4911,
29889,
1972,
29889,
4572,
29918,
1609,
29898,
29873,
29887,
29918,
333,
29922,
29873,
29887,
29918,
333,
467,
4102,
580,
13,
1678,
6089,
353,
1404,
29889,
3258,
29918,
550,
17538,
29918,
1454,
29918,
19207,
29898,
13,
4706,
515,
29918,
1256,
29922,
1256,
29898,
29906,
29900,
29896,
29947,
29892,
29871,
29953,
29892,
938,
29898,
333,
403,
8243,
13,
4706,
304,
29918,
1256,
29922,
1256,
29898,
29906,
29900,
29896,
29947,
29892,
29871,
29953,
29892,
938,
29898,
333,
403,
29897,
718,
938,
29898,
29876,
4961,
13,
1678,
736,
4050,
29918,
6886,
703,
816,
11272,
29889,
1420,
613,
6089,
29922,
550,
17538,
29897,
13,
2
] |
openmaps_auth/urls.py | radiant-maxar/openmaps-auth | 0 | 63882 | from django.conf import settings
from django.urls import include, path
from . import views
urlpatterns = [
path(f"{settings.BASE_PATH}callback", views.callback, name="callback"),
path(f"{settings.BASE_PATH}index", views.index, name="index"),
path(f"{settings.BASE_PATH}v0/auth/login", views.login, name="openmaps_login"),
path(f"{settings.BASE_PATH}v0/auth/logout", views.logout, name="openmaps_logout"),
path(f"{settings.BASE_PATH}v0/auth/status", views.status, name="status"),
path(f"{settings.BASE_PATH}v0/auth/valid", views.valid, name="valid"),
path(
f"{settings.BASE_PATH}v0/social/",
include("social_django.urls", namespace="social"),
),
]
# Only care about using admin during development.
if settings.DEBUG:
from django.contrib import admin
urlpatterns += [
path(f"{settings.BASE_PATH}v0/admin/", admin.site.urls),
]
| [
1,
515,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
26045,
1053,
3160,
29892,
2224,
13,
13,
3166,
869,
1053,
8386,
13,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
2224,
29898,
29888,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
14035,
613,
8386,
29889,
14035,
29892,
1024,
543,
14035,
4968,
13,
1678,
2224,
29898,
29888,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
2248,
613,
8386,
29889,
2248,
29892,
1024,
543,
2248,
4968,
13,
1678,
2224,
29898,
29888,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
29894,
29900,
29914,
5150,
29914,
7507,
613,
8386,
29889,
7507,
29892,
1024,
543,
3150,
10339,
29918,
7507,
4968,
13,
1678,
2224,
29898,
29888,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
29894,
29900,
29914,
5150,
29914,
1188,
449,
613,
8386,
29889,
1188,
449,
29892,
1024,
543,
3150,
10339,
29918,
1188,
449,
4968,
13,
1678,
2224,
29898,
29888,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
29894,
29900,
29914,
5150,
29914,
4882,
613,
8386,
29889,
4882,
29892,
1024,
543,
4882,
4968,
13,
1678,
2224,
29898,
29888,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
29894,
29900,
29914,
5150,
29914,
3084,
613,
8386,
29889,
3084,
29892,
1024,
543,
3084,
4968,
13,
1678,
2224,
29898,
13,
4706,
285,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
29894,
29900,
29914,
24911,
29914,
613,
13,
4706,
3160,
703,
24911,
29918,
14095,
29889,
26045,
613,
7397,
543,
24911,
4968,
13,
1678,
10353,
13,
29962,
13,
13,
29937,
9333,
2562,
1048,
773,
4113,
2645,
5849,
29889,
13,
361,
6055,
29889,
18525,
29901,
13,
1678,
515,
9557,
29889,
21570,
1053,
4113,
13,
13,
1678,
3142,
11037,
29879,
4619,
518,
13,
4706,
2224,
29898,
29888,
29908,
29912,
11027,
29889,
25416,
29918,
10145,
29913,
29894,
29900,
29914,
6406,
29914,
613,
4113,
29889,
2746,
29889,
26045,
511,
13,
1678,
4514,
13,
2
] |
graphwalker/test/haltcond_test.py | spotify/python-graphwalker | 66 | 1612319 | <filename>graphwalker/test/haltcond_test.py
# -*- coding: utf-8 -*-
# Copyright (c) 2013 Spotify AB
import unittest
from graphwalker import halting
class TestSeconds(unittest.TestCase):
def test_ctor_smoke(self):
self.assertFalse(halting.Seconds().start(None))
self.assertFalse(halting.Seconds(20).start(None))
self.assertFalse(halting.Seconds(timeout=20).start(None))
def test_empty_done(self):
self.assertTrue(halting.Seconds(0).start(None))
def test_api(self):
ec = halting.Seconds(8).start(None)
ec.add(('cat', 'dog', ()))
self.assert_(type(ec.progress()) is str)
def test_step_through(self):
t, ec = 20, halting.Seconds(8)
ec.clock = lambda: t
self.assertFalse(ec.start(None))
for t, expect in ((23, False), (27, False), (28, True), (29, True)):
self.assertEqual(bool(ec), expect)
class TestSeenSteps(unittest.TestCase):
def test_ctor_smoke(self):
halting.SeenSteps()
halting.SeenSteps(*'abc')
def test_ctor_args(self):
self.assertEqual(halting.SeenSteps().targets, set([]))
self.assertEqual(halting.SeenSteps(*'abc').targets, set('abc'))
def test_empty_done(self):
self.assertTrue(halting.SeenSteps().start(None))
def test_api(self):
ec = halting.SeenSteps(*'abc').start(None)
ec.add(('cat', 'dog', ()))
self.assert_(type(ec.progress()) is str)
def test_step_through(self):
ec = halting.SeenSteps(*'abc').start(None)
self.assertFalse(ec)
ec.add('xa')
self.assertFalse(ec)
ec.add('xb')
self.assertFalse(ec)
ec.add('xc')
self.assertTrue(ec)
class TestCountSteps(unittest.TestCase):
def test_ctor_smoke(self):
self.assertFalse(halting.CountSteps().start(None))
self.assertFalse(halting.CountSteps(123).start(None))
self.assertFalse(halting.CountSteps(steps=123).start(None))
def test_zero_done(self):
self.assertTrue(halting.CountSteps(0).start(None))
def test_api(self):
ec = halting.CountSteps().start(None)
ec.add(('cat', 'dog', ()))
self.assert_(type(ec.progress()) is str)
def test_step_through(self):
ec = halting.CountSteps(3).start(None)
self.assertFalse(ec)
ec.add('xa')
self.assertFalse(ec)
ec.add('xb')
self.assertFalse(ec)
ec.add('xc')
self.assertTrue(ec)
class g:
V = {'a': ()}
E = {'e': ()}
class TestCoverage(unittest.TestCase):
def test_ctor_smoke(self):
self.assertFalse(halting.Coverage().start(g))
self.assertFalse(halting.Coverage(edges=10).start(g))
self.assertFalse(halting.Coverage(verts=20).start(g))
self.assertFalse(halting.Coverage(edges=10, verts=20).start(g))
self.assertFalse(halting.Coverage(edges=10, vertices=20).start(g))
def test_zero_done(self):
ec = halting.Coverage()
ec.edge_cov = 0.0
self.assertTrue(ec.start(g))
def test_api(self):
ec = halting.Coverage().start(g)
ec.add(('cat', 'dog', ()))
self.assert_(type(ec.progress()) is str)
def test_step_through(self):
ec = halting.Coverage(edges=1, verts=1).start(g)
self.assertFalse(ec)
ec.add('aaaa')
self.assertFalse(ec)
ec.add('eee')
self.assertTrue(ec)
| [
1,
529,
9507,
29958,
4262,
20919,
261,
29914,
1688,
29914,
10647,
1116,
29918,
1688,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29941,
1706,
327,
1598,
17571,
13,
5215,
443,
27958,
13,
13,
3166,
3983,
20919,
261,
1053,
8870,
1259,
13,
13,
13,
1990,
4321,
27535,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
2801,
29918,
3844,
6946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
27535,
2141,
2962,
29898,
8516,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
27535,
29898,
29906,
29900,
467,
2962,
29898,
8516,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
27535,
29898,
15619,
29922,
29906,
29900,
467,
2962,
29898,
8516,
876,
13,
13,
1678,
822,
1243,
29918,
6310,
29918,
15091,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4077,
1259,
29889,
27535,
29898,
29900,
467,
2962,
29898,
8516,
876,
13,
13,
1678,
822,
1243,
29918,
2754,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
27535,
29898,
29947,
467,
2962,
29898,
8516,
29897,
13,
4706,
21226,
29889,
1202,
29898,
877,
4117,
742,
525,
26169,
742,
313,
4961,
13,
4706,
1583,
29889,
9294,
23538,
1853,
29898,
687,
29889,
18035,
3101,
338,
851,
29897,
13,
13,
1678,
822,
1243,
29918,
10568,
29918,
20678,
29898,
1311,
1125,
13,
4706,
260,
29892,
21226,
353,
29871,
29906,
29900,
29892,
8870,
1259,
29889,
27535,
29898,
29947,
29897,
13,
4706,
21226,
29889,
13058,
353,
14013,
29901,
260,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29889,
2962,
29898,
8516,
876,
13,
13,
4706,
363,
260,
29892,
2149,
297,
5135,
29906,
29941,
29892,
7700,
511,
313,
29906,
29955,
29892,
7700,
511,
313,
29906,
29947,
29892,
5852,
511,
313,
29906,
29929,
29892,
5852,
22164,
13,
9651,
1583,
29889,
9294,
9843,
29898,
11227,
29898,
687,
511,
2149,
29897,
13,
13,
13,
1990,
4321,
2008,
264,
7789,
567,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
2801,
29918,
3844,
6946,
29898,
1311,
1125,
13,
4706,
8870,
1259,
29889,
2008,
264,
7789,
567,
580,
13,
4706,
8870,
1259,
29889,
2008,
264,
7789,
567,
10456,
29915,
10736,
1495,
13,
13,
1678,
822,
1243,
29918,
2801,
29918,
5085,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
4077,
1259,
29889,
2008,
264,
7789,
567,
2141,
5182,
29879,
29892,
731,
29898,
2636,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
4077,
1259,
29889,
2008,
264,
7789,
567,
10456,
29915,
10736,
2824,
5182,
29879,
29892,
731,
877,
10736,
8785,
13,
13,
1678,
822,
1243,
29918,
6310,
29918,
15091,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4077,
1259,
29889,
2008,
264,
7789,
567,
2141,
2962,
29898,
8516,
876,
13,
13,
1678,
822,
1243,
29918,
2754,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
2008,
264,
7789,
567,
10456,
29915,
10736,
2824,
2962,
29898,
8516,
29897,
13,
4706,
21226,
29889,
1202,
29898,
877,
4117,
742,
525,
26169,
742,
313,
4961,
13,
4706,
1583,
29889,
9294,
23538,
1853,
29898,
687,
29889,
18035,
3101,
338,
851,
29897,
13,
13,
1678,
822,
1243,
29918,
10568,
29918,
20678,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
2008,
264,
7789,
567,
10456,
29915,
10736,
2824,
2962,
29898,
8516,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
17367,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
29916,
29890,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
21791,
1495,
13,
4706,
1583,
29889,
9294,
5574,
29898,
687,
29897,
13,
13,
13,
1990,
4321,
3981,
7789,
567,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
2801,
29918,
3844,
6946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
3981,
7789,
567,
2141,
2962,
29898,
8516,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
3981,
7789,
567,
29898,
29896,
29906,
29941,
467,
2962,
29898,
8516,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
3981,
7789,
567,
29898,
24530,
29922,
29896,
29906,
29941,
467,
2962,
29898,
8516,
876,
13,
13,
1678,
822,
1243,
29918,
9171,
29918,
15091,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4077,
1259,
29889,
3981,
7789,
567,
29898,
29900,
467,
2962,
29898,
8516,
876,
13,
13,
1678,
822,
1243,
29918,
2754,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
3981,
7789,
567,
2141,
2962,
29898,
8516,
29897,
13,
4706,
21226,
29889,
1202,
29898,
877,
4117,
742,
525,
26169,
742,
313,
4961,
13,
4706,
1583,
29889,
9294,
23538,
1853,
29898,
687,
29889,
18035,
3101,
338,
851,
29897,
13,
13,
1678,
822,
1243,
29918,
10568,
29918,
20678,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
3981,
7789,
567,
29898,
29941,
467,
2962,
29898,
8516,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
17367,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
29916,
29890,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
21791,
1495,
13,
4706,
1583,
29889,
9294,
5574,
29898,
687,
29897,
13,
13,
13,
1990,
330,
29901,
13,
1678,
478,
353,
11117,
29874,
2396,
313,
2915,
13,
1678,
382,
353,
11117,
29872,
2396,
313,
2915,
13,
13,
13,
1990,
4321,
29907,
957,
482,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
2801,
29918,
3844,
6946,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
29907,
957,
482,
2141,
2962,
29898,
29887,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
29907,
957,
482,
29898,
287,
2710,
29922,
29896,
29900,
467,
2962,
29898,
29887,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
29907,
957,
482,
29898,
369,
1372,
29922,
29906,
29900,
467,
2962,
29898,
29887,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
29907,
957,
482,
29898,
287,
2710,
29922,
29896,
29900,
29892,
4837,
29879,
29922,
29906,
29900,
467,
2962,
29898,
29887,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
4077,
1259,
29889,
29907,
957,
482,
29898,
287,
2710,
29922,
29896,
29900,
29892,
13791,
29922,
29906,
29900,
467,
2962,
29898,
29887,
876,
13,
13,
1678,
822,
1243,
29918,
9171,
29918,
15091,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
29907,
957,
482,
580,
13,
4706,
21226,
29889,
12864,
29918,
24542,
353,
29871,
29900,
29889,
29900,
13,
4706,
1583,
29889,
9294,
5574,
29898,
687,
29889,
2962,
29898,
29887,
876,
13,
13,
1678,
822,
1243,
29918,
2754,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
29907,
957,
482,
2141,
2962,
29898,
29887,
29897,
13,
4706,
21226,
29889,
1202,
29898,
877,
4117,
742,
525,
26169,
742,
313,
4961,
13,
4706,
1583,
29889,
9294,
23538,
1853,
29898,
687,
29889,
18035,
3101,
338,
851,
29897,
13,
13,
1678,
822,
1243,
29918,
10568,
29918,
20678,
29898,
1311,
1125,
13,
4706,
21226,
353,
8870,
1259,
29889,
29907,
957,
482,
29898,
287,
2710,
29922,
29896,
29892,
4837,
29879,
29922,
29896,
467,
2962,
29898,
29887,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
27137,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
687,
29897,
13,
4706,
21226,
29889,
1202,
877,
3905,
29872,
1495,
13,
4706,
1583,
29889,
9294,
5574,
29898,
687,
29897,
13,
2
] |
tomef/tools/export_results.py | unlikelymaths/tomef | 0 | 88226 | <reponame>unlikelymaths/tomef
#!/usr/bin/env python
# coding: utf-8
# # Export Results
# <div style="position: absolute; right:0;top:0"><a href="./tools.ipynb" style="text-decoration: none"> <font size="5">←</font></a>
# <a href="../evaluation.ipynb" style="text-decoration: none"> <font size="5">↑</font></a></div>
#
# This script collects all HTML files and puts them into a `export.zip` archive in the results folder. Useful for sharing results outside of a jupyter lab.
#
# https://nbconvert.readthedocs.io/en/5.x/nbconvert_library.html
# In[ ]:
from init import setup
setup(vars())
import os
import zipfile
if _isMain:
try:
runvars = {'basepath': os.path.join(os.path.dirname(__file__),'../')}
except:
runvars = {'basepath': os.path.join(os.getcwd(),'../')}
def code_folders(runvars):
runvars['basepath'] = os.path.abspath(runvars['basepath'])
dir_list = ['./','./docs/','./tools/', './embedding/',
'./importer/', './tokenizer/', './vocab/',
'./vectorizer/', './models/', './distiller/',
'./metrics/']
file_list = []
file_types = ['.html', '.md', '.png']
for directory in dir_list:
directory_abs = os.path.abspath(os.path.join(runvars['basepath'],directory))
for filename in os.listdir(directory_abs):
if any([file_type for file_type in file_types if filename.endswith(file_type)]):
filename_full = os.path.join(directory,filename)
filename_abs= os.path.join(runvars['basepath'],filename_full)
file_list.append((filename_abs, filename_full))
zip_path = os.path.join(runvars['basepath'],'results/export.zip')
with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zip:
# writing each file one by one
for file in file_list:
zip.write(file[0], arcname = file[1])
def main(basepath):
runvars = {'basepath': basepath}
code_folders(runvars)
if _isMain:
code_folders(runvars)
| [
1,
529,
276,
1112,
420,
29958,
348,
21280,
755,
29879,
29914,
29873,
608,
29888,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
13,
29937,
396,
1222,
637,
17212,
13,
29937,
529,
4563,
3114,
543,
3283,
29901,
8380,
29936,
1492,
29901,
29900,
29936,
3332,
29901,
29900,
3254,
29874,
2822,
543,
6904,
8504,
29889,
666,
948,
29890,
29908,
3114,
543,
726,
29899,
19557,
362,
29901,
5642,
1013,
529,
5657,
2159,
543,
29945,
1013,
30245,
829,
5657,
2565,
29874,
29958,
13,
29937,
529,
29874,
2822,
543,
6995,
24219,
362,
29889,
666,
948,
29890,
29908,
3114,
543,
726,
29899,
19557,
362,
29901,
5642,
1013,
529,
5657,
2159,
543,
29945,
1013,
30213,
829,
5657,
2565,
29874,
2565,
4563,
29958,
13,
29937,
29871,
13,
29937,
910,
2471,
6314,
29879,
599,
4544,
2066,
322,
15223,
963,
964,
263,
421,
15843,
29889,
7554,
29952,
18871,
297,
278,
2582,
4138,
29889,
4803,
1319,
363,
19383,
2582,
5377,
310,
263,
432,
786,
25547,
9775,
29889,
13,
29937,
29871,
13,
29937,
2045,
597,
9877,
13441,
29889,
949,
386,
287,
12332,
29889,
601,
29914,
264,
29914,
29945,
29889,
29916,
29914,
9877,
13441,
29918,
5258,
29889,
1420,
13,
13,
29937,
512,
29961,
4514,
29901,
13,
13,
13,
3166,
2069,
1053,
6230,
13,
14669,
29898,
16908,
3101,
13,
13,
5215,
2897,
13,
5215,
14319,
1445,
29871,
13,
13,
361,
903,
275,
6330,
29901,
13,
1678,
1018,
29901,
13,
4706,
1065,
16908,
353,
11117,
3188,
2084,
2396,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
29915,
6995,
1495,
29913,
13,
1678,
5174,
29901,
13,
4706,
1065,
16908,
353,
11117,
3188,
2084,
2396,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
29915,
6995,
1495,
29913,
13,
13,
1753,
775,
29918,
8771,
414,
29898,
3389,
16908,
1125,
13,
1678,
1065,
16908,
1839,
3188,
2084,
2033,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
3389,
16908,
1839,
3188,
2084,
11287,
13,
1678,
4516,
29918,
1761,
353,
518,
4286,
29914,
3788,
6904,
2640,
29914,
3788,
6904,
8504,
29914,
742,
19283,
17987,
8497,
29914,
742,
13,
18884,
19283,
326,
18505,
29914,
742,
19283,
6979,
3950,
29914,
742,
19283,
29894,
542,
370,
29914,
742,
29871,
13,
18884,
19283,
8111,
3950,
29914,
742,
19283,
9794,
29914,
742,
19283,
5721,
5495,
29914,
742,
29871,
13,
18884,
19283,
2527,
10817,
29914,
2033,
13,
1678,
934,
29918,
1761,
353,
5159,
13,
268,
13,
1678,
934,
29918,
8768,
353,
518,
4286,
1420,
742,
15300,
3487,
742,
15300,
2732,
2033,
13,
268,
13,
1678,
363,
3884,
297,
4516,
29918,
1761,
29901,
13,
4706,
3884,
29918,
6897,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
3389,
16908,
1839,
3188,
2084,
7464,
12322,
876,
13,
4706,
363,
10422,
297,
2897,
29889,
1761,
3972,
29898,
12322,
29918,
6897,
1125,
13,
9651,
565,
738,
4197,
1445,
29918,
1853,
363,
934,
29918,
1853,
297,
934,
29918,
8768,
565,
10422,
29889,
1975,
2541,
29898,
1445,
29918,
1853,
4638,
1125,
13,
18884,
10422,
29918,
8159,
353,
2897,
29889,
2084,
29889,
7122,
29898,
12322,
29892,
9507,
29897,
13,
18884,
10422,
29918,
6897,
29922,
2897,
29889,
2084,
29889,
7122,
29898,
3389,
16908,
1839,
3188,
2084,
7464,
9507,
29918,
8159,
29897,
13,
18884,
934,
29918,
1761,
29889,
4397,
3552,
9507,
29918,
6897,
29892,
10422,
29918,
8159,
876,
13,
308,
13,
1678,
14319,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3389,
16908,
1839,
3188,
2084,
7464,
29915,
9902,
29914,
15843,
29889,
7554,
1495,
13,
1678,
411,
14319,
1445,
29889,
26264,
2283,
29898,
7554,
29918,
2084,
29892,
525,
29893,
742,
14319,
1445,
29889,
29999,
5690,
29918,
2287,
10536,
3040,
29928,
29897,
408,
14319,
29901,
29871,
13,
4706,
396,
5007,
1269,
934,
697,
491,
697,
29871,
13,
4706,
363,
934,
297,
934,
29918,
1761,
29901,
29871,
13,
9651,
14319,
29889,
3539,
29898,
1445,
29961,
29900,
1402,
15232,
978,
353,
934,
29961,
29896,
2314,
29871,
13,
632,
13,
1753,
1667,
29898,
3188,
2084,
1125,
13,
1678,
1065,
16908,
353,
11117,
3188,
2084,
2396,
2967,
2084,
29913,
13,
1678,
775,
29918,
8771,
414,
29898,
3389,
16908,
29897,
13,
268,
13,
361,
903,
275,
6330,
29901,
13,
1678,
775,
29918,
8771,
414,
29898,
3389,
16908,
29897,
13,
13,
2
] |
prosumerPolicy/inputSetter.py | 0-k/prosumerpolicy | 6 | 144953 | <filename>prosumerPolicy/inputSetter.py
from __future__ import print_function
import logging
import numpy as np
from paths import *
from input import *
from pv import PV
from battery import Battery
totalPrices = import_Prices(path_Prices)
totalPvGen = import_PV(path_PvGen)
totalLoad = import_Load(path_Load)
class _InputSetter:
def __init__(self, duration=24, day=1, loadRow=0):
self.PV = PV()
self.Battery = Battery()
self. totalPrices = totalPrices
self.totalPvGen = totalPvGen
self.totalLoad = totalLoad
self.totalAverageLoad = totalLoad.mean(axis=1)
self.__timeDuration = duration
self.__day = day
self.loadRow = loadRow
@property
def pvGenList(self):
return self.get_pvGen_list()
@property
def priceList(self):
return self.get_price_list()
@property
def loadList(self):
return self.get_load_list()
@property
def timeDuration(self):
return self.__timeDuration
@timeDuration.setter
def timeDuration(self, time):
self.__timeDuration = time
@property
def day(self):
return self.__day
@day.setter
def day(self, day):
self.__day = day
@property
def loadRow(self):
return self.__loadRow
@loadRow.setter
def loadRow(self, loadrow):
logging.info('Load Row Changed to {}'.format(loadrow))
self.__loadRow = loadrow
def get_price_list(self, day=None, duration=None):
''' returns price list as np.array for specified day and duration'''
if day is None:
day = self.day
''' returns price list as np.array for specified day and duration'''
if duration is None:
duration = self.timeDuration
if day is None or duration is None:
raise ValueError("Please Specify a day and time series duration")
try:
hours = (day - 1) * 24
price = np.array(self.totalPrices['Price'][hours:hours + duration])
if np.nan in price:
raise IOError
return price / 1000 # in kWh
except IOError:
logging.WARNING('Price list in day {} contains missing values '.format(day)) #FIXME Logger
def get_load_list(self, day=None, duration=None, loadRow=None):
if day is None:
day = self.day
if duration is None:
duration = self.timeDuration
if loadRow is None:
loadRow = self.loadRow
if day is None or duration is None or loadRow is None:
raise ValueError("Please set day, duration and load Row")
try:
if loadRow == -1: ## LOAD ROW -1 gives average load row
hours = (day - 1) * 24
load = np.array(self.totalAverageLoad[:][hours:hours + duration])
if np.nan in load:
raise IOError
return load / 1000 # kWh
else:
hours = (day - 1) * 24
load = np.array(self.totalLoad[loadRow][hours:hours + duration])
if np.nan in load:
raise IOError
return load / 1000 # kWh
except IOError:
logging.warning('Load list in day {} contains missing values'.format(day))
def get_pvGen_list(self, day=None, duration=None):
if day is None:
day = self.day
if duration is None:
duration = self.timeDuration
if day is None or duration is None:
raise ValueError("Please Specify a day and time series duration")
try:
hours = (day - 1) * 24
result = np.array(self.PV._calculatedPvGen[0][hours:hours + duration])
if np.nan in result:
raise IOError
return result / 1000 # kW
except IOError:
logging.warning('PV Generation list day {} contains missing values.'.format(day))
| [
1,
529,
9507,
29958,
771,
2083,
261,
15644,
29914,
2080,
22304,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
5215,
12183,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
10898,
1053,
334,
13,
3166,
1881,
1053,
334,
13,
3166,
282,
29894,
1053,
349,
29963,
13,
3166,
16988,
1053,
350,
2620,
29891,
13,
13,
7827,
4040,
1575,
353,
1053,
29918,
4040,
1575,
29898,
2084,
29918,
4040,
1575,
29897,
13,
7827,
29925,
29894,
15462,
353,
1053,
29918,
29925,
29963,
29898,
2084,
29918,
29925,
29894,
15462,
29897,
13,
7827,
5896,
353,
1053,
29918,
5896,
29898,
2084,
29918,
5896,
29897,
13,
13,
13,
1990,
903,
4290,
22304,
29901,
13,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
14385,
29922,
29906,
29946,
29892,
2462,
29922,
29896,
29892,
2254,
4301,
29922,
29900,
1125,
13,
4706,
1583,
29889,
29925,
29963,
353,
349,
29963,
580,
13,
4706,
1583,
29889,
29933,
2620,
29891,
353,
350,
2620,
29891,
580,
13,
4706,
1583,
29889,
3001,
4040,
1575,
353,
3001,
4040,
1575,
13,
4706,
1583,
29889,
7827,
29925,
29894,
15462,
353,
3001,
29925,
29894,
15462,
13,
4706,
1583,
29889,
7827,
5896,
353,
3001,
5896,
13,
4706,
1583,
29889,
7827,
29909,
19698,
5896,
353,
3001,
5896,
29889,
12676,
29898,
8990,
29922,
29896,
29897,
13,
4706,
1583,
17255,
2230,
18984,
353,
14385,
13,
4706,
1583,
17255,
3250,
353,
2462,
13,
4706,
1583,
29889,
1359,
4301,
353,
2254,
4301,
13,
13,
13,
1678,
732,
6799,
13,
1678,
822,
282,
29894,
15462,
1293,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
657,
29918,
29886,
29894,
15462,
29918,
1761,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
8666,
1293,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
657,
29918,
9175,
29918,
1761,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2254,
1293,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
657,
29918,
1359,
29918,
1761,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
931,
18984,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
2230,
18984,
13,
13,
1678,
732,
2230,
18984,
29889,
842,
357,
13,
1678,
822,
931,
18984,
29898,
1311,
29892,
931,
1125,
13,
4706,
1583,
17255,
2230,
18984,
353,
931,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2462,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
3250,
13,
13,
1678,
732,
3250,
29889,
842,
357,
13,
1678,
822,
2462,
29898,
1311,
29892,
2462,
1125,
13,
4706,
1583,
17255,
3250,
353,
2462,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2254,
4301,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
1359,
4301,
13,
13,
1678,
732,
1359,
4301,
29889,
842,
357,
13,
1678,
822,
2254,
4301,
29898,
1311,
29892,
2254,
798,
1125,
13,
4706,
12183,
29889,
3888,
877,
5896,
11438,
678,
4618,
304,
6571,
4286,
4830,
29898,
1359,
798,
876,
13,
4706,
1583,
17255,
1359,
4301,
353,
2254,
798,
13,
13,
1678,
822,
679,
29918,
9175,
29918,
1761,
29898,
1311,
29892,
2462,
29922,
8516,
29892,
14385,
29922,
8516,
1125,
13,
4706,
14550,
3639,
8666,
1051,
408,
7442,
29889,
2378,
363,
6790,
2462,
322,
14385,
12008,
13,
4706,
565,
2462,
338,
6213,
29901,
13,
9651,
2462,
353,
1583,
29889,
3250,
13,
4706,
14550,
3639,
8666,
1051,
408,
7442,
29889,
2378,
363,
6790,
2462,
322,
14385,
12008,
13,
4706,
565,
14385,
338,
6213,
29901,
13,
9651,
14385,
353,
1583,
29889,
2230,
18984,
13,
4706,
565,
2462,
338,
6213,
470,
14385,
338,
6213,
29901,
13,
9651,
12020,
7865,
2392,
703,
12148,
12048,
1598,
263,
2462,
322,
931,
3652,
14385,
1159,
13,
4706,
1018,
29901,
13,
9651,
6199,
353,
313,
3250,
448,
29871,
29896,
29897,
334,
29871,
29906,
29946,
13,
9651,
8666,
353,
7442,
29889,
2378,
29898,
1311,
29889,
7827,
4040,
1575,
1839,
13026,
2033,
29961,
29882,
2470,
29901,
29882,
2470,
718,
14385,
2314,
13,
9651,
565,
7442,
29889,
13707,
297,
8666,
29901,
13,
18884,
12020,
10663,
2392,
13,
9651,
736,
8666,
847,
29871,
29896,
29900,
29900,
29900,
29871,
396,
297,
413,
8809,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
12183,
29889,
29956,
25614,
877,
13026,
1051,
297,
2462,
6571,
3743,
4567,
1819,
15300,
4830,
29898,
3250,
876,
396,
25634,
2303,
28468,
13,
13,
1678,
822,
679,
29918,
1359,
29918,
1761,
29898,
1311,
29892,
2462,
29922,
8516,
29892,
14385,
29922,
8516,
29892,
2254,
4301,
29922,
8516,
1125,
13,
4706,
565,
2462,
338,
6213,
29901,
13,
9651,
2462,
353,
1583,
29889,
3250,
13,
4706,
565,
14385,
338,
6213,
29901,
13,
9651,
14385,
353,
1583,
29889,
2230,
18984,
13,
4706,
565,
2254,
4301,
338,
6213,
29901,
13,
9651,
2254,
4301,
353,
1583,
29889,
1359,
4301,
13,
4706,
565,
2462,
338,
6213,
470,
14385,
338,
6213,
470,
2254,
4301,
338,
6213,
29901,
13,
9651,
12020,
7865,
2392,
703,
12148,
731,
2462,
29892,
14385,
322,
2254,
11438,
1159,
13,
13,
4706,
1018,
29901,
13,
9651,
565,
2254,
4301,
1275,
448,
29896,
29901,
29871,
444,
11247,
3035,
390,
9806,
448,
29896,
4076,
6588,
2254,
1948,
13,
18884,
6199,
353,
313,
3250,
448,
29871,
29896,
29897,
334,
29871,
29906,
29946,
13,
18884,
2254,
353,
7442,
29889,
2378,
29898,
1311,
29889,
7827,
29909,
19698,
5896,
7503,
3816,
29882,
2470,
29901,
29882,
2470,
718,
14385,
2314,
13,
18884,
565,
7442,
29889,
13707,
297,
2254,
29901,
13,
462,
1678,
12020,
10663,
2392,
13,
18884,
736,
2254,
847,
29871,
29896,
29900,
29900,
29900,
29871,
396,
413,
8809,
13,
9651,
1683,
29901,
13,
18884,
6199,
353,
313,
3250,
448,
29871,
29896,
29897,
334,
29871,
29906,
29946,
13,
18884,
2254,
353,
7442,
29889,
2378,
29898,
1311,
29889,
7827,
5896,
29961,
1359,
4301,
3816,
29882,
2470,
29901,
29882,
2470,
718,
14385,
2314,
13,
18884,
565,
7442,
29889,
13707,
297,
2254,
29901,
13,
462,
1678,
12020,
10663,
2392,
13,
18884,
736,
2254,
847,
29871,
29896,
29900,
29900,
29900,
29871,
396,
413,
8809,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
12183,
29889,
27392,
877,
5896,
1051,
297,
2462,
6571,
3743,
4567,
1819,
4286,
4830,
29898,
3250,
876,
13,
13,
1678,
822,
679,
29918,
29886,
29894,
15462,
29918,
1761,
29898,
1311,
29892,
2462,
29922,
8516,
29892,
14385,
29922,
8516,
1125,
13,
4706,
565,
2462,
338,
6213,
29901,
13,
9651,
2462,
353,
1583,
29889,
3250,
13,
4706,
565,
14385,
338,
6213,
29901,
13,
9651,
14385,
353,
1583,
29889,
2230,
18984,
13,
4706,
565,
2462,
338,
6213,
470,
14385,
338,
6213,
29901,
13,
9651,
12020,
7865,
2392,
703,
12148,
12048,
1598,
263,
2462,
322,
931,
3652,
14385,
1159,
13,
4706,
1018,
29901,
13,
9651,
6199,
353,
313,
3250,
448,
29871,
29896,
29897,
334,
29871,
29906,
29946,
13,
9651,
1121,
353,
7442,
29889,
2378,
29898,
1311,
29889,
29925,
29963,
3032,
15807,
630,
29925,
29894,
15462,
29961,
29900,
3816,
29882,
2470,
29901,
29882,
2470,
718,
14385,
2314,
13,
9651,
565,
7442,
29889,
13707,
297,
1121,
29901,
13,
18884,
12020,
10663,
2392,
13,
9651,
736,
1121,
847,
29871,
29896,
29900,
29900,
29900,
29871,
396,
26226,
13,
4706,
5174,
10663,
2392,
29901,
13,
9651,
12183,
29889,
27392,
877,
29925,
29963,
28203,
1051,
2462,
6571,
3743,
4567,
1819,
29889,
4286,
4830,
29898,
3250,
876,
13,
13,
13,
2
] |
parte2/P3/testRLsol.py | manuelsousa7/ia-project | 0 | 144171 | <filename>parte2/P3/testRLsol.py
import numpy as np
from sklearn.externals import joblib
from RL import *
import RLsol
for test in [('fmdp1.pkl','traj1.pkl'), ('fmdp2.pkl','traj2.pkl')]:
print("Testing " + test[0])
# funcoes auxiliarres
fmdp = joblib.load(test[0])
# ficheiro com a trajectório de treino
traj = joblib.load(test[1])
qlearn = RLsol.myRL(7,2,0.9)
Q = qlearn.traces2Q(traj)
print("Valores Q aprendidos")
print(qlearn.Q)
if np.linalg.norm(Q-fmdp.Q)<.3:
print("Erro nos Q dentro dos limites de tolerância. OK\n")
else:
print("Erro nos Q acima dos limites de tolerância. FAILED\n")
# gerar trajectoria aprendida
J,trajlearn = fmdp.runPolicy(6,4,RLsol.Q2pol(Q))
print("Trajectoria gerada com a politica aprendida")
print(trajlearn)
if J>.7:
print("Recompensa obtida dentro do previsto. OK\n")
else:
print("Recompensa obtida abaixo do previsto. FAILED\n") | [
1,
529,
9507,
29958,
862,
371,
29906,
29914,
29925,
29941,
29914,
1688,
2241,
2929,
29889,
2272,
13,
5215,
12655,
408,
7442,
13,
3166,
2071,
19668,
29889,
735,
725,
1338,
1053,
4982,
1982,
13,
3166,
390,
29931,
1053,
334,
13,
5215,
390,
29931,
2929,
13,
13,
13,
1454,
1243,
297,
518,
877,
29888,
3487,
29886,
29896,
29889,
29886,
6321,
3788,
3018,
29926,
29896,
29889,
29886,
6321,
5477,
6702,
29888,
3487,
29886,
29906,
29889,
29886,
6321,
3788,
3018,
29926,
29906,
29889,
29886,
6321,
1495,
5387,
13,
268,
13,
1678,
1596,
703,
3057,
292,
376,
718,
1243,
29961,
29900,
2314,
268,
13,
1678,
396,
2090,
1111,
267,
29587,
279,
690,
13,
1678,
285,
3487,
29886,
353,
4982,
1982,
29889,
1359,
29898,
1688,
29961,
29900,
2314,
29871,
13,
1678,
396,
285,
4070,
3350,
419,
263,
23324,
29980,
5378,
316,
2578,
1789,
795,
13,
1678,
1020,
29926,
353,
4982,
1982,
29889,
1359,
29898,
1688,
29961,
29896,
2314,
29871,
13,
268,
13,
1678,
3855,
19668,
353,
390,
29931,
2929,
29889,
1357,
2241,
29898,
29955,
29892,
29906,
29892,
29900,
29889,
29929,
29897,
13,
1678,
660,
353,
3855,
19668,
29889,
3018,
778,
29906,
29984,
29898,
3018,
29926,
29897,
13,
268,
13,
1678,
1596,
703,
1440,
2361,
660,
21783,
355,
4396,
1159,
13,
1678,
1596,
29898,
29939,
19668,
29889,
29984,
29897,
13,
1678,
565,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29984,
29899,
29888,
3487,
29886,
29889,
29984,
29897,
29966,
29889,
29941,
29901,
13,
4706,
1596,
703,
2110,
307,
7814,
660,
16018,
3248,
2485,
3246,
316,
20341,
10031,
1512,
29889,
9280,
29905,
29876,
1159,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
2110,
307,
7814,
660,
1274,
2946,
3248,
2485,
3246,
316,
20341,
10031,
1512,
29889,
13515,
29902,
20566,
29905,
29876,
1159,
13,
268,
13,
1678,
396,
9814,
279,
23324,
4108,
21783,
355,
1458,
13,
1678,
435,
29892,
3018,
29926,
19668,
353,
285,
3487,
29886,
29889,
3389,
15644,
29898,
29953,
29892,
29946,
29892,
2241,
2929,
29889,
29984,
29906,
3733,
29898,
29984,
876,
13,
268,
13,
1678,
1596,
703,
5323,
622,
4108,
9814,
1114,
419,
263,
2832,
983,
21783,
355,
1458,
1159,
13,
1678,
1596,
29898,
3018,
29926,
19668,
29897,
13,
1678,
565,
435,
15513,
29955,
29901,
13,
4706,
1596,
703,
1123,
2388,
14535,
14403,
1458,
16018,
437,
12379,
5137,
29889,
9280,
29905,
29876,
1159,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
1123,
2388,
14535,
14403,
1458,
633,
29874,
861,
29877,
437,
12379,
5137,
29889,
13515,
29902,
20566,
29905,
29876,
1159,
2
] |
dataset/__init__.py | STomoya/animeface | 61 | 76330 |
from dataset.animeface import (
AnimeFace,
AnimeFaceCelebA,
AnimeFaceSR,
AnimeFaceXDoG,
AnimeFaceLabel,
AnimeFaceOneHot
)
from dataset.portrait import (
DanbooruPortrait,
DanbooruPortraitCelebA,
DanbooruPortraitSR,
DanbooruPortraitXDoG
)
from dataset.danbooru import (
Danbooru,
DanbooruSR,
DanbooruAutoPair
)
import os
import torch
from torch.utils.data import DataLoader, Dataset
from collections.abc import Iterable
def cycle(iterable: Iterable):
while True:
for i in iterable:
yield i
def to_loader(
dataset: Dataset,
batch_size: int,
shuffle: bool=True,
num_workers: int=os.cpu_count(),
pin_memory: bool=torch.cuda.is_available()
) -> DataLoader:
loader = DataLoader(
dataset, batch_size, shuffle=shuffle,
num_workers=num_workers, pin_memory=pin_memory
)
return loader
| [
1,
29871,
13,
3166,
8783,
29889,
273,
603,
2161,
1053,
313,
13,
1678,
530,
603,
23360,
29892,
13,
1678,
530,
603,
23360,
29907,
6146,
29890,
29909,
29892,
13,
1678,
530,
603,
23360,
14098,
29892,
13,
1678,
530,
603,
23360,
29990,
6132,
29954,
29892,
13,
1678,
530,
603,
23360,
4775,
29892,
13,
1678,
530,
603,
23360,
6716,
28917,
13,
29897,
13,
13,
3166,
8783,
29889,
637,
8356,
1053,
313,
13,
1678,
3951,
833,
22803,
2290,
8356,
29892,
13,
1678,
3951,
833,
22803,
2290,
8356,
29907,
6146,
29890,
29909,
29892,
13,
1678,
3951,
833,
22803,
2290,
8356,
14098,
29892,
13,
1678,
3951,
833,
22803,
2290,
8356,
29990,
6132,
29954,
13,
29897,
13,
13,
3166,
8783,
29889,
18386,
833,
22803,
1053,
313,
13,
1678,
3951,
833,
22803,
29892,
13,
1678,
3951,
833,
22803,
14098,
29892,
13,
1678,
3951,
833,
22803,
12300,
20547,
13,
29897,
13,
13,
5215,
2897,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
3630,
10036,
29892,
13373,
24541,
13,
3166,
16250,
29889,
10736,
1053,
20504,
519,
13,
13,
1753,
11412,
29898,
1524,
519,
29901,
20504,
519,
1125,
13,
1678,
1550,
5852,
29901,
13,
4706,
363,
474,
297,
4256,
519,
29901,
13,
9651,
7709,
474,
13,
13,
1753,
304,
29918,
12657,
29898,
13,
1678,
8783,
29901,
13373,
24541,
29892,
13,
1678,
9853,
29918,
2311,
29901,
938,
29892,
13,
1678,
528,
21897,
29901,
6120,
29922,
5574,
29892,
13,
1678,
954,
29918,
1287,
414,
29901,
938,
29922,
359,
29889,
21970,
29918,
2798,
3285,
13,
1678,
12534,
29918,
14834,
29901,
6120,
29922,
7345,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
13,
29897,
1599,
3630,
10036,
29901,
13,
1678,
23466,
353,
3630,
10036,
29898,
13,
4706,
8783,
29892,
9853,
29918,
2311,
29892,
528,
21897,
29922,
845,
21897,
29892,
13,
4706,
954,
29918,
1287,
414,
29922,
1949,
29918,
1287,
414,
29892,
12534,
29918,
14834,
29922,
12687,
29918,
14834,
13,
1678,
1723,
13,
1678,
736,
23466,
13,
2
] |
fasttask/models.py | huanjoyous/FasterRunner20190716 | 1 | 60960 | from django.db import models
# Create your models here.
from fastrunner.models import Project
from fastuser.models import BaseTable
class Schedule(BaseTable):
"""
定时任务信息表
"""
send_strategy = (
(1, "始终发送"),
(2, "仅失败发送"),
(3, "从不发送")
)
class Meta:
verbose_name = "定时任务"
db_table = "Schedule"
name = models.CharField("任务名称", unique=True, null=False, max_length=100)
identity = models.CharField("任务ID", null=False, unique=True, max_length=100)
send_type = models.IntegerField("发送策略", choices=send_strategy, default=3)
config = models.TextField("任务配置", null=False)
receiver = models.CharField("接收者", null=True, max_length=2048)
copy = models.CharField("抄送者", null=True, max_length=2048)
status = models.BooleanField("状态", default=True)
project = models.ForeignKey(Project, verbose_name='所属项目', null=False, on_delete=models.CASCADE)
| [
1,
515,
9557,
29889,
2585,
1053,
4733,
13,
13,
29937,
6204,
596,
4733,
1244,
29889,
13,
3166,
285,
7614,
348,
1089,
29889,
9794,
1053,
8010,
13,
3166,
5172,
1792,
29889,
9794,
1053,
7399,
3562,
13,
13,
13,
1990,
1102,
11272,
29898,
5160,
3562,
1125,
13,
1678,
9995,
13,
268,
30495,
30594,
31450,
31358,
30689,
31021,
30746,
13,
1678,
9995,
13,
13,
1678,
3638,
29918,
710,
8963,
353,
313,
13,
4706,
313,
29896,
29892,
376,
31020,
234,
190,
139,
30910,
31545,
4968,
13,
4706,
313,
29906,
29892,
376,
231,
190,
136,
31369,
31955,
30910,
31545,
4968,
13,
4706,
313,
29941,
29892,
376,
31594,
30413,
30910,
31545,
1159,
13,
1678,
1723,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
26952,
29918,
978,
353,
376,
30495,
30594,
31450,
31358,
29908,
13,
4706,
4833,
29918,
2371,
353,
376,
4504,
11272,
29908,
13,
13,
1678,
1024,
353,
4733,
29889,
27890,
703,
31450,
31358,
30548,
31685,
613,
5412,
29922,
5574,
29892,
1870,
29922,
8824,
29892,
4236,
29918,
2848,
29922,
29896,
29900,
29900,
29897,
13,
1678,
10110,
353,
4733,
29889,
27890,
703,
31450,
31358,
1367,
613,
1870,
29922,
8824,
29892,
5412,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29896,
29900,
29900,
29897,
13,
1678,
3638,
29918,
1853,
353,
4733,
29889,
7798,
3073,
703,
30910,
31545,
234,
176,
153,
234,
152,
168,
613,
19995,
29922,
6717,
29918,
710,
8963,
29892,
2322,
29922,
29941,
29897,
13,
1678,
2295,
353,
4733,
29889,
15778,
703,
31450,
31358,
31361,
30669,
613,
1870,
29922,
8824,
29897,
13,
1678,
19870,
353,
4733,
29889,
27890,
703,
31092,
31997,
30767,
613,
1870,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29906,
29900,
29946,
29947,
29897,
13,
1678,
3509,
353,
4733,
29889,
27890,
703,
233,
141,
135,
31545,
30767,
613,
1870,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29906,
29900,
29946,
29947,
29897,
13,
1678,
4660,
353,
4733,
29889,
18146,
3073,
703,
31531,
31613,
613,
2322,
29922,
5574,
29897,
13,
1678,
2060,
353,
4733,
29889,
27755,
2558,
29898,
7653,
29892,
26952,
29918,
978,
2433,
30744,
31360,
31888,
30895,
742,
1870,
29922,
8824,
29892,
373,
29918,
8143,
29922,
9794,
29889,
29907,
3289,
5454,
2287,
29897,
13,
13,
13,
13,
2
] |
nailgun/nailgun/test/unit/test_utils.py | Zipfer/fuel-web | 0 | 173305 | # -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from mock import mock_open
from mock import patch
import os
import tempfile
from nailgun.test.base import BaseIntegrationTest
from nailgun.utils import dict_merge
from nailgun.utils import extract_env_version
from nailgun.utils import get_fuel_release_versions
from nailgun.utils import migration
class TestUtils(BaseIntegrationTest):
def test_dict_merge(self):
custom = {"coord": [10, 10],
"pass": "<PASSWORD>",
"dict": {"body": "solid",
"color": "black",
"dict": {"stuff": "hz"}}}
common = {"parent": None,
"dict": {"transparency": 100,
"dict": {"another_stuff": "hz"}}}
result = dict_merge(custom, common)
self.assertEqual(result, {"coord": [10, 10],
"parent": None,
"pass": "<PASSWORD>",
"dict": {"body": "solid",
"color": "black",
"transparency": 100,
"dict": {"stuff": "hz",
"another_stuff": "hz"}}})
def test_upgrade_wizard_data(self):
fixture_path = os.path.join(os.path.dirname(__file__), '..', '..',
'fixtures', 'openstack.yaml')
wizard_meta = migration.upgrade_release_wizard_metadata_50_to_51(
fixture_path=fixture_path
)
network_settings = [
n['data'] for n in wizard_meta['Network']['manager']['values']
]
self.assertNotIn('neutron-nsx', network_settings)
def test_extract_env_version(self):
# format: input, output pairs
test_cases = [
('2014.1', '5.0'),
('2014.1-5.0', '5.0'),
('2014.1.1-5.0.1', '5.0.1'),
('2014.1.1-5.0.1-X', '5.0.1'),
('2014.1.1-5.1', '5.1'),
]
for input_, output in test_cases:
self.assertEqual(extract_env_version(input_), output)
@patch('nailgun.utils.glob.glob', return_value=['test.yaml'])
@patch('__builtin__.open', mock_open(read_data='test_data'))
def test_get_release_versions(self, _):
versions = get_fuel_release_versions(None)
self.assertDictEqual({'test': 'test_data'}, versions)
def test_get_release_versions_empty_file(self):
with tempfile.NamedTemporaryFile() as tf:
versions = get_fuel_release_versions(tf.name)
self.assertDictEqual({os.path.basename(tf.name): None}, versions)
def test_get_release_no_file(self):
with tempfile.NamedTemporaryFile() as tf:
file_path = tf.name
self.assertFalse(os.path.exists(file_path))
versions = get_fuel_release_versions(file_path)
self.assertDictEqual({}, versions)
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
1678,
14187,
1266,
29871,
29906,
29900,
29896,
29941,
11612,
424,
275,
29892,
9266,
29889,
13,
29937,
13,
29937,
1678,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
1678,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
1678,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
308,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
1678,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
1678,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
13,
29937,
1678,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
1678,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
1678,
1090,
278,
19245,
29889,
13,
13,
3166,
11187,
1053,
11187,
29918,
3150,
13,
3166,
11187,
1053,
13261,
13,
5215,
2897,
13,
5215,
5694,
1445,
13,
13,
3166,
302,
737,
28798,
29889,
1688,
29889,
3188,
1053,
7399,
23573,
362,
3057,
13,
3166,
302,
737,
28798,
29889,
13239,
1053,
9657,
29918,
14634,
13,
3166,
302,
737,
28798,
29889,
13239,
1053,
6597,
29918,
6272,
29918,
3259,
13,
3166,
302,
737,
28798,
29889,
13239,
1053,
679,
29918,
29888,
2491,
29918,
14096,
29918,
26100,
13,
3166,
302,
737,
28798,
29889,
13239,
1053,
20332,
13,
13,
13,
1990,
4321,
12177,
29898,
5160,
23573,
362,
3057,
1125,
13,
13,
1678,
822,
1243,
29918,
8977,
29918,
14634,
29898,
1311,
1125,
13,
4706,
2888,
353,
8853,
1111,
536,
1115,
518,
29896,
29900,
29892,
29871,
29896,
29900,
1402,
13,
462,
29871,
376,
3364,
1115,
9872,
25711,
17013,
28341,
13,
462,
29871,
376,
8977,
1115,
8853,
2587,
1115,
376,
2929,
333,
613,
13,
462,
965,
376,
2780,
1115,
376,
8517,
613,
13,
462,
965,
376,
8977,
1115,
8853,
303,
3096,
1115,
376,
29882,
29920,
29908,
12499,
13,
4706,
3619,
353,
8853,
3560,
1115,
6213,
29892,
13,
462,
29871,
376,
8977,
1115,
8853,
3286,
862,
3819,
1115,
29871,
29896,
29900,
29900,
29892,
13,
462,
965,
376,
8977,
1115,
8853,
23327,
29918,
303,
3096,
1115,
376,
29882,
29920,
29908,
12499,
13,
4706,
1121,
353,
9657,
29918,
14634,
29898,
6341,
29892,
3619,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29892,
8853,
1111,
536,
1115,
518,
29896,
29900,
29892,
29871,
29896,
29900,
1402,
13,
462,
462,
29871,
376,
3560,
1115,
6213,
29892,
13,
462,
462,
29871,
376,
3364,
1115,
9872,
25711,
17013,
28341,
13,
462,
462,
29871,
376,
8977,
1115,
8853,
2587,
1115,
376,
2929,
333,
613,
13,
462,
462,
965,
376,
2780,
1115,
376,
8517,
613,
13,
462,
462,
965,
376,
3286,
862,
3819,
1115,
29871,
29896,
29900,
29900,
29892,
13,
462,
462,
965,
376,
8977,
1115,
8853,
303,
3096,
1115,
376,
29882,
29920,
613,
13,
462,
462,
462,
1678,
376,
23327,
29918,
303,
3096,
1115,
376,
29882,
29920,
29908,
930,
1800,
13,
13,
1678,
822,
1243,
29918,
786,
8228,
29918,
29893,
17909,
29918,
1272,
29898,
1311,
1125,
13,
4706,
5713,
15546,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
525,
636,
742,
525,
636,
742,
13,
462,
462,
1678,
525,
7241,
486,
1973,
742,
525,
3150,
1429,
29889,
25162,
1495,
13,
13,
4706,
281,
17909,
29918,
7299,
353,
20332,
29889,
786,
8228,
29918,
14096,
29918,
29893,
17909,
29918,
19635,
29918,
29945,
29900,
29918,
517,
29918,
29945,
29896,
29898,
13,
9651,
5713,
15546,
29918,
2084,
29922,
7241,
15546,
29918,
2084,
13,
4706,
1723,
13,
4706,
3564,
29918,
11027,
353,
518,
13,
9651,
302,
1839,
1272,
2033,
363,
302,
297,
281,
17909,
29918,
7299,
1839,
13724,
16215,
12847,
16215,
5975,
2033,
13,
4706,
4514,
13,
4706,
1583,
29889,
9294,
3664,
797,
877,
17821,
1617,
29899,
1983,
29916,
742,
3564,
29918,
11027,
29897,
13,
13,
1678,
822,
1243,
29918,
21111,
29918,
6272,
29918,
3259,
29898,
1311,
1125,
13,
4706,
396,
3402,
29901,
1881,
29892,
1962,
11000,
13,
4706,
1243,
29918,
11436,
353,
518,
13,
9651,
6702,
29906,
29900,
29896,
29946,
29889,
29896,
742,
525,
29945,
29889,
29900,
5477,
13,
9651,
6702,
29906,
29900,
29896,
29946,
29889,
29896,
29899,
29945,
29889,
29900,
742,
525,
29945,
29889,
29900,
5477,
13,
9651,
6702,
29906,
29900,
29896,
29946,
29889,
29896,
29889,
29896,
29899,
29945,
29889,
29900,
29889,
29896,
742,
525,
29945,
29889,
29900,
29889,
29896,
5477,
13,
9651,
6702,
29906,
29900,
29896,
29946,
29889,
29896,
29889,
29896,
29899,
29945,
29889,
29900,
29889,
29896,
29899,
29990,
742,
525,
29945,
29889,
29900,
29889,
29896,
5477,
13,
9651,
6702,
29906,
29900,
29896,
29946,
29889,
29896,
29889,
29896,
29899,
29945,
29889,
29896,
742,
525,
29945,
29889,
29896,
5477,
13,
4706,
4514,
13,
13,
4706,
363,
1881,
3383,
1962,
297,
1243,
29918,
11436,
29901,
13,
9651,
1583,
29889,
9294,
9843,
29898,
21111,
29918,
6272,
29918,
3259,
29898,
2080,
29918,
511,
1962,
29897,
13,
13,
1678,
732,
5041,
877,
29876,
737,
28798,
29889,
13239,
29889,
23705,
29889,
23705,
742,
736,
29918,
1767,
29922,
1839,
1688,
29889,
25162,
11287,
13,
1678,
732,
5041,
877,
1649,
16145,
262,
26914,
3150,
742,
11187,
29918,
3150,
29898,
949,
29918,
1272,
2433,
1688,
29918,
1272,
8785,
13,
1678,
822,
1243,
29918,
657,
29918,
14096,
29918,
26100,
29898,
1311,
29892,
903,
1125,
13,
4706,
6910,
353,
679,
29918,
29888,
2491,
29918,
14096,
29918,
26100,
29898,
8516,
29897,
13,
4706,
1583,
29889,
9294,
21533,
9843,
3319,
29915,
1688,
2396,
525,
1688,
29918,
1272,
16675,
6910,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
14096,
29918,
26100,
29918,
6310,
29918,
1445,
29898,
1311,
1125,
13,
4706,
411,
5694,
1445,
29889,
22175,
5776,
1971,
653,
2283,
580,
408,
15886,
29901,
13,
9651,
6910,
353,
679,
29918,
29888,
2491,
29918,
14096,
29918,
26100,
29898,
13264,
29889,
978,
29897,
13,
9651,
1583,
29889,
9294,
21533,
9843,
3319,
359,
29889,
2084,
29889,
6500,
3871,
29898,
13264,
29889,
978,
1125,
6213,
1118,
6910,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
14096,
29918,
1217,
29918,
1445,
29898,
1311,
1125,
13,
4706,
411,
5694,
1445,
29889,
22175,
5776,
1971,
653,
2283,
580,
408,
15886,
29901,
13,
9651,
934,
29918,
2084,
353,
15886,
29889,
978,
13,
4706,
1583,
29889,
9294,
8824,
29898,
359,
29889,
2084,
29889,
9933,
29898,
1445,
29918,
2084,
876,
13,
4706,
6910,
353,
679,
29918,
29888,
2491,
29918,
14096,
29918,
26100,
29898,
1445,
29918,
2084,
29897,
13,
4706,
1583,
29889,
9294,
21533,
9843,
3319,
1118,
6910,
29897,
13,
2
] |
tests/conftest.py | glemaitre/hexrd | 27 | 95706 | import os
from pathlib import Path
import pytest
@pytest.fixture
def example_repo_path():
if 'HEXRD_EXAMPLE_REPO_PATH' not in os.environ:
pytest.fail('Environment varable HEXRD_EXAMPLE_REPO_PATH not set!')
repo_path = os.environ['HEXRD_EXAMPLE_REPO_PATH']
return Path(repo_path)
| [
1,
1053,
2897,
13,
3166,
2224,
1982,
1053,
10802,
13,
5215,
11451,
1688,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
13,
1753,
1342,
29918,
20095,
29918,
2084,
7295,
13,
1678,
565,
525,
29950,
5746,
29934,
29928,
29918,
5746,
19297,
1307,
29918,
1525,
13152,
29918,
10145,
29915,
451,
297,
2897,
29889,
21813,
29901,
13,
4706,
11451,
1688,
29889,
14057,
877,
18649,
722,
519,
379,
5746,
29934,
29928,
29918,
5746,
19297,
1307,
29918,
1525,
13152,
29918,
10145,
451,
731,
29991,
1495,
13,
13,
1678,
13761,
29918,
2084,
353,
2897,
29889,
21813,
1839,
29950,
5746,
29934,
29928,
29918,
5746,
19297,
1307,
29918,
1525,
13152,
29918,
10145,
2033,
13,
1678,
736,
10802,
29898,
20095,
29918,
2084,
29897,
13,
2
] |
vale/__init__.py | pyccel/vale | 3 | 55953 | __version__ = 0.9
from .parser import *
from .syntax import *
| [
1,
4770,
3259,
1649,
353,
29871,
29900,
29889,
29929,
13,
13,
3166,
869,
16680,
29871,
1053,
334,
13,
3166,
869,
29562,
29871,
1053,
334,
13,
2
] |
TuRBO-Penicillin/turbo/turbo_m.py | HarryQL/TuRBO-Penicillin | 0 | 58401 | ###############################################################################
# Copyright (c) 2019 Uber Technologies, Inc. #
# #
# Licensed under the Uber Non-Commercial License (the "License"); #
# you may not use this file except in compliance with the License. #
# You may obtain a copy of the License at the root directory of this project. #
# #
# See the License for the specific language governing permissions and #
# limitations under the License. #
###############################################################################
import math
import sys
from copy import deepcopy
import gpytorch
import numpy as np
import torch
from .gp import train_gp
from .turbo_1 import Turbo1
from .utils import from_unit_cube, latin_hypercube, to_unit_cube
class TurboM(Turbo1):
"""The TuRBO-m algorithm.
Parameters
----------
f : function handle
lb : Lower variable bounds, numpy.array, shape (d,).
ub : Upper variable bounds, numpy.array, shape (d,).
n_init : Number of initial points *FOR EACH TRUST REGION* (2*dim is recommended), int.
max_evals : Total evaluation budget, int.
n_trust_regions : Number of trust regions
batch_size : Number of points in each batch, int.
verbose : If you want to print information about the optimization progress, bool.
use_ard : If you want to use ARD for the GP kernel.
max_cholesky_size : Largest number of training points where we use Cholesky, int
n_training_steps : Number of training steps for learning the GP hypers, int
min_cuda : We use float64 on the CPU if we have this or fewer datapoints
device : Device to use for GP fitting ("cpu" or "cuda")
dtype : Dtype to use for GP fitting ("float32" or "float64")
Example usage:
turbo5 = TurboM(f=f, lb=lb, ub=ub, n_init=n_init, max_evals=max_evals, n_trust_regions=5)
turbo5.optimize() # Run optimization
X, fX = turbo5.X, turbo5.fX # Evaluated points
"""
def __init__(
self,
f,
lb,
ub,
n_init,
max_evals,
n_trust_regions,
batch_size=1,
verbose=True,
use_ard=True,
max_cholesky_size=2000,
n_training_steps=50,
min_cuda=1024,
device="cpu",
dtype="float64",
):
self.n_trust_regions = n_trust_regions
super().__init__(
f=f,
lb=lb,
ub=ub,
n_init=n_init,
max_evals=max_evals,
batch_size=batch_size,
verbose=verbose,
use_ard=use_ard,
max_cholesky_size=max_cholesky_size,
n_training_steps=n_training_steps,
min_cuda=min_cuda,
device=device,
dtype=dtype,
)
self.succtol = 3
self.failtol = max(5, self.dim)
# Very basic input checks
assert n_trust_regions > 1 and isinstance(max_evals, int)
assert max_evals > n_trust_regions * n_init, "Not enough trust regions to do initial evaluations"
assert max_evals > batch_size, "Not enough evaluations to do a single batch"
# Remember the hypers for trust regions we don't sample from
self.hypers = [{} for _ in range(self.n_trust_regions)]
# Initialize parameters
self._restart()
def _restart(self):
self._idx = np.zeros((0, 1), dtype=int) # Track what trust region proposed what using an index vector
self.failcount = np.zeros(self.n_trust_regions, dtype=int)
self.succcount = np.zeros(self.n_trust_regions, dtype=int)
self.length = self.length_init * np.ones(self.n_trust_regions)
def _adjust_length(self, fX_next, i):
assert i >= 0 and i <= self.n_trust_regions - 1
fX_min = self.fX[self._idx[:, 0] == i, 0].min() # Target value
if fX_next.min() < fX_min - 1e-3 * math.fabs(fX_min):
self.succcount[i] += 1
self.failcount[i] = 0
else:
self.succcount[i] = 0
self.failcount[i] += len(fX_next) # NOTE: Add size of the batch for this TR
if self.succcount[i] == self.succtol: # Expand trust region
self.length[i] = min([2.0 * self.length[i], self.length_max])
self.succcount[i] = 0
elif self.failcount[i] >= self.failtol: # Shrink trust region (we may have exceeded the failtol)
self.length[i] /= 2.0
self.failcount[i] = 0
def _select_candidates(self, X_cand, y_cand):
"""Select candidates from samples from all trust regions."""
assert X_cand.shape == (self.n_trust_regions, self.n_cand, self.dim)
assert y_cand.shape == (self.n_trust_regions, self.n_cand, self.batch_size)
assert X_cand.min() >= 0.0 and X_cand.max() <= 1.0 and np.all(np.isfinite(y_cand))
X_next = np.zeros((self.batch_size, self.dim))
idx_next = np.zeros((self.batch_size, 1), dtype=int)
for k in range(self.batch_size):
i, j = np.unravel_index(np.argmin(y_cand[:, :, k]), (self.n_trust_regions, self.n_cand))
assert y_cand[:, :, k].min() == y_cand[i, j, k]
X_next[k, :] = deepcopy(X_cand[i, j, :])
idx_next[k, 0] = i
assert np.isfinite(y_cand[i, j, k]) # Just to make sure we never select nan or inf
# Make sure we never pick this point again
y_cand[i, j, :] = np.inf
return X_next, idx_next
def optimize(self):
"""Run the full optimization process."""
# Create initial points for each TR
for i in range(self.n_trust_regions):
X_init = latin_hypercube(self.n_init, self.dim)
X_init = from_unit_cube(X_init, self.lb, self.ub)
fX_init = np.array([[self.f(x)] for x in X_init])
# Update budget and set as initial data for this TR
self.X = np.vstack((self.X, X_init))
self.fX = np.vstack((self.fX, fX_init))
self._idx = np.vstack((self._idx, i * np.ones((self.n_init, 1), dtype=int)))
self.n_evals += self.n_init
if self.verbose:
fbest = fX_init.min()
print(f"TR-{i} starting from: {fbest:.4}")
sys.stdout.flush()
# Thompson sample to get next suggestions
while self.n_evals < self.max_evals:
# Generate candidates from each TR
X_cand = np.zeros((self.n_trust_regions, self.n_cand, self.dim))
y_cand = np.inf * np.ones((self.n_trust_regions, self.n_cand, self.batch_size))
for i in range(self.n_trust_regions):
idx = np.where(self._idx == i)[0] # Extract all "active" indices
# Get the points, values the active values
X = deepcopy(self.X[idx, :])
X = to_unit_cube(X, self.lb, self.ub)
# Get the values from the standardized data
fX = deepcopy(self.fX[idx, 0].ravel())
# Don't retrain the model if the training data hasn't changed
n_training_steps = 0 if self.hypers[i] else self.n_training_steps
# Create new candidates
X_cand[i, :, :], y_cand[i, :, :], self.hypers[i] = self._create_candidates(
X, fX, length=self.length[i], n_training_steps=n_training_steps, hypers=self.hypers[i]
)
# Select the next candidates
X_next, idx_next = self._select_candidates(X_cand, y_cand)
assert X_next.min() >= 0.0 and X_next.max() <= 1.0
# Undo the warping
X_next = from_unit_cube(X_next, self.lb, self.ub)
# Evaluate batch
fX_next = np.array([[self.f(x)] for x in X_next])
# Update trust regions
for i in range(self.n_trust_regions):
idx_i = np.where(idx_next == i)[0]
if len(idx_i) > 0:
self.hypers[i] = {} # Remove model hypers
fX_i = fX_next[idx_i]
if self.verbose and fX_i.min() < self.fX.min() - 1e-3 * math.fabs(self.fX.min()):
n_evals, fbest = self.n_evals, fX_i.min()
print(f"{n_evals}) New best @ TR-{i}: {fbest:.4}")
sys.stdout.flush()
self._adjust_length(fX_i, i)
# Update budget and append data
self.n_evals += self.batch_size
self.X = np.vstack((self.X, deepcopy(X_next)))
self.fX = np.vstack((self.fX, deepcopy(fX_next)))
self._idx = np.vstack((self._idx, deepcopy(idx_next)))
# Check if any TR needs to be restarted
for i in range(self.n_trust_regions):
if self.length[i] < self.length_min: # Restart trust region if converged
idx_i = self._idx[:, 0] == i
if self.verbose:
n_evals, fbest = self.n_evals, self.fX[idx_i, 0].min()
print(f"{n_evals}) TR-{i} converged to: : {fbest:.4}")
sys.stdout.flush()
# Reset length and counters, remove old data from trust region
self.length[i] = self.length_init
self.succcount[i] = 0
self.failcount[i] = 0
self._idx[idx_i, 0] = -1 # Remove points from trust region
self.hypers[i] = {} # Remove model hypers
# Create a new initial design
X_init = latin_hypercube(self.n_init, self.dim)
X_init = from_unit_cube(X_init, self.lb, self.ub)
fX_init = np.array([[self.f(x)] for x in X_init])
# Print progress
if self.verbose:
n_evals, fbest = self.n_evals, fX_init.min()
print(f"{n_evals}) TR-{i} is restarting from: : {fbest:.4}")
sys.stdout.flush()
# Append data to local history
self.X = np.vstack((self.X, X_init))
self.fX = np.vstack((self.fX, fX_init))
self._idx = np.vstack((self._idx, i * np.ones((self.n_init, 1), dtype=int)))
self.n_evals += self.n_init
| [
1,
835,
13383,
13383,
13383,
13383,
7346,
4136,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29929,
501,
495,
8364,
11763,
29892,
9266,
29889,
462,
462,
29871,
396,
13,
29937,
462,
462,
462,
462,
632,
396,
13,
29937,
10413,
21144,
1090,
278,
501,
495,
10050,
29899,
1523,
1050,
1455,
19245,
313,
1552,
376,
29931,
293,
1947,
1496,
632,
396,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
9651,
396,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
278,
3876,
3884,
310,
445,
2060,
29889,
396,
13,
29937,
462,
462,
462,
462,
632,
396,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
308,
396,
13,
29937,
27028,
1090,
278,
19245,
29889,
462,
462,
795,
396,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
29937,
13,
13,
5215,
5844,
13,
5215,
10876,
13,
3166,
3509,
1053,
6483,
8552,
13,
13,
5215,
330,
2272,
7345,
305,
13,
5215,
12655,
408,
7442,
13,
5215,
4842,
305,
13,
13,
3166,
869,
29887,
29886,
1053,
7945,
29918,
29887,
29886,
13,
3166,
869,
29873,
332,
833,
29918,
29896,
1053,
5383,
833,
29896,
13,
3166,
869,
13239,
1053,
515,
29918,
5441,
29918,
29883,
4003,
29892,
25677,
29918,
24947,
29883,
4003,
29892,
304,
29918,
5441,
29918,
29883,
4003,
13,
13,
13,
1990,
5383,
833,
29924,
29898,
29911,
332,
833,
29896,
1125,
13,
1678,
9995,
1576,
12603,
29934,
8456,
29899,
29885,
5687,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
285,
584,
740,
4386,
13,
1678,
27981,
584,
27723,
2286,
13451,
29892,
12655,
29889,
2378,
29892,
8267,
313,
29881,
29892,
467,
13,
1678,
13069,
584,
24929,
2286,
13451,
29892,
12655,
29889,
2378,
29892,
8267,
313,
29881,
29892,
467,
13,
1678,
302,
29918,
2344,
584,
9681,
310,
2847,
3291,
334,
22051,
382,
2477,
29950,
10014,
17321,
5195,
29954,
2725,
29930,
313,
29906,
29930,
6229,
338,
13622,
511,
938,
29889,
13,
1678,
4236,
29918,
14513,
29879,
584,
14990,
17983,
23562,
29892,
938,
29889,
13,
1678,
302,
29918,
509,
504,
29918,
1727,
1080,
584,
9681,
310,
9311,
12786,
13,
1678,
9853,
29918,
2311,
584,
9681,
310,
3291,
297,
1269,
9853,
29892,
938,
29889,
13,
1678,
26952,
584,
960,
366,
864,
304,
1596,
2472,
1048,
278,
13883,
6728,
29892,
6120,
29889,
13,
1678,
671,
29918,
538,
584,
960,
366,
864,
304,
671,
9033,
29928,
363,
278,
28258,
8466,
29889,
13,
1678,
4236,
29918,
305,
6544,
3459,
29918,
2311,
584,
365,
1191,
342,
1353,
310,
6694,
3291,
988,
591,
671,
678,
6544,
3459,
29892,
938,
13,
1678,
302,
29918,
26495,
29918,
24530,
584,
9681,
310,
6694,
6576,
363,
6509,
278,
28258,
10163,
414,
29892,
938,
13,
1678,
1375,
29918,
29883,
6191,
584,
1334,
671,
5785,
29953,
29946,
373,
278,
10808,
565,
591,
505,
445,
470,
28145,
1418,
481,
2461,
29879,
13,
1678,
4742,
584,
21830,
304,
671,
363,
28258,
28221,
4852,
21970,
29908,
470,
376,
29883,
6191,
1159,
13,
1678,
26688,
584,
360,
1853,
304,
671,
363,
28258,
28221,
4852,
7411,
29941,
29906,
29908,
470,
376,
7411,
29953,
29946,
1159,
13,
13,
1678,
8741,
8744,
29901,
13,
4706,
7013,
833,
29945,
353,
5383,
833,
29924,
29898,
29888,
29922,
29888,
29892,
27981,
29922,
27728,
29892,
13069,
29922,
431,
29892,
302,
29918,
2344,
29922,
29876,
29918,
2344,
29892,
4236,
29918,
14513,
29879,
29922,
3317,
29918,
14513,
29879,
29892,
302,
29918,
509,
504,
29918,
1727,
1080,
29922,
29945,
29897,
13,
4706,
7013,
833,
29945,
29889,
20640,
675,
580,
29871,
396,
7525,
13883,
13,
4706,
1060,
29892,
285,
29990,
353,
7013,
833,
29945,
29889,
29990,
29892,
7013,
833,
29945,
29889,
29888,
29990,
29871,
396,
382,
4387,
630,
3291,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
285,
29892,
13,
4706,
27981,
29892,
13,
4706,
13069,
29892,
13,
4706,
302,
29918,
2344,
29892,
13,
4706,
4236,
29918,
14513,
29879,
29892,
13,
4706,
302,
29918,
509,
504,
29918,
1727,
1080,
29892,
13,
4706,
9853,
29918,
2311,
29922,
29896,
29892,
13,
4706,
26952,
29922,
5574,
29892,
13,
4706,
671,
29918,
538,
29922,
5574,
29892,
13,
4706,
4236,
29918,
305,
6544,
3459,
29918,
2311,
29922,
29906,
29900,
29900,
29900,
29892,
13,
4706,
302,
29918,
26495,
29918,
24530,
29922,
29945,
29900,
29892,
13,
4706,
1375,
29918,
29883,
6191,
29922,
29896,
29900,
29906,
29946,
29892,
13,
4706,
4742,
543,
21970,
613,
13,
4706,
26688,
543,
7411,
29953,
29946,
613,
13,
268,
1125,
13,
4706,
1583,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
353,
302,
29918,
509,
504,
29918,
1727,
1080,
13,
4706,
2428,
2141,
1649,
2344,
12035,
13,
9651,
285,
29922,
29888,
29892,
13,
9651,
27981,
29922,
27728,
29892,
13,
9651,
13069,
29922,
431,
29892,
13,
9651,
302,
29918,
2344,
29922,
29876,
29918,
2344,
29892,
13,
9651,
4236,
29918,
14513,
29879,
29922,
3317,
29918,
14513,
29879,
29892,
13,
9651,
9853,
29918,
2311,
29922,
16175,
29918,
2311,
29892,
13,
9651,
26952,
29922,
369,
15828,
29892,
13,
9651,
671,
29918,
538,
29922,
1509,
29918,
538,
29892,
13,
9651,
4236,
29918,
305,
6544,
3459,
29918,
2311,
29922,
3317,
29918,
305,
6544,
3459,
29918,
2311,
29892,
13,
9651,
302,
29918,
26495,
29918,
24530,
29922,
29876,
29918,
26495,
29918,
24530,
29892,
13,
9651,
1375,
29918,
29883,
6191,
29922,
1195,
29918,
29883,
6191,
29892,
13,
9651,
4742,
29922,
10141,
29892,
13,
9651,
26688,
29922,
29881,
1853,
29892,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
29879,
1682,
312,
324,
353,
29871,
29941,
13,
4706,
1583,
29889,
14057,
25027,
353,
4236,
29898,
29945,
29892,
1583,
29889,
6229,
29897,
13,
13,
4706,
396,
18064,
6996,
1881,
12747,
13,
4706,
4974,
302,
29918,
509,
504,
29918,
1727,
1080,
1405,
29871,
29896,
322,
338,
8758,
29898,
3317,
29918,
14513,
29879,
29892,
938,
29897,
13,
4706,
4974,
4236,
29918,
14513,
29879,
1405,
302,
29918,
509,
504,
29918,
1727,
1080,
334,
302,
29918,
2344,
29892,
376,
3664,
3307,
9311,
12786,
304,
437,
2847,
6161,
800,
29908,
13,
4706,
4974,
4236,
29918,
14513,
29879,
1405,
9853,
29918,
2311,
29892,
376,
3664,
3307,
6161,
800,
304,
437,
263,
2323,
9853,
29908,
13,
13,
4706,
396,
22738,
278,
10163,
414,
363,
9311,
12786,
591,
1016,
29915,
29873,
4559,
515,
13,
4706,
1583,
29889,
29882,
1478,
414,
353,
518,
8875,
363,
903,
297,
3464,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
4638,
13,
13,
4706,
396,
25455,
4128,
13,
4706,
1583,
3032,
5060,
442,
580,
13,
13,
1678,
822,
903,
5060,
442,
29898,
1311,
1125,
13,
4706,
1583,
3032,
13140,
353,
7442,
29889,
3298,
359,
3552,
29900,
29892,
29871,
29896,
511,
26688,
29922,
524,
29897,
29871,
396,
17026,
825,
9311,
5120,
7972,
825,
773,
385,
2380,
4608,
13,
4706,
1583,
29889,
14057,
2798,
353,
7442,
29889,
3298,
359,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29892,
26688,
29922,
524,
29897,
13,
4706,
1583,
29889,
2146,
617,
2798,
353,
7442,
29889,
3298,
359,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29892,
26688,
29922,
524,
29897,
13,
4706,
1583,
29889,
2848,
353,
1583,
29889,
2848,
29918,
2344,
334,
7442,
29889,
2873,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29897,
13,
13,
1678,
822,
903,
328,
5143,
29918,
2848,
29898,
1311,
29892,
285,
29990,
29918,
4622,
29892,
474,
1125,
13,
4706,
4974,
474,
6736,
29871,
29900,
322,
474,
5277,
1583,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
448,
29871,
29896,
13,
13,
4706,
285,
29990,
29918,
1195,
353,
1583,
29889,
29888,
29990,
29961,
1311,
3032,
13140,
7503,
29892,
29871,
29900,
29962,
1275,
474,
29892,
29871,
29900,
1822,
1195,
580,
29871,
396,
17157,
995,
13,
4706,
565,
285,
29990,
29918,
4622,
29889,
1195,
580,
529,
285,
29990,
29918,
1195,
448,
29871,
29896,
29872,
29899,
29941,
334,
5844,
29889,
29888,
6897,
29898,
29888,
29990,
29918,
1195,
1125,
13,
9651,
1583,
29889,
2146,
617,
2798,
29961,
29875,
29962,
4619,
29871,
29896,
13,
9651,
1583,
29889,
14057,
2798,
29961,
29875,
29962,
353,
29871,
29900,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
2146,
617,
2798,
29961,
29875,
29962,
353,
29871,
29900,
13,
9651,
1583,
29889,
14057,
2798,
29961,
29875,
29962,
4619,
7431,
29898,
29888,
29990,
29918,
4622,
29897,
29871,
396,
6058,
29923,
29901,
3462,
2159,
310,
278,
9853,
363,
445,
10014,
13,
13,
4706,
565,
1583,
29889,
2146,
617,
2798,
29961,
29875,
29962,
1275,
1583,
29889,
29879,
1682,
312,
324,
29901,
29871,
396,
12027,
392,
9311,
5120,
13,
9651,
1583,
29889,
2848,
29961,
29875,
29962,
353,
1375,
4197,
29906,
29889,
29900,
334,
1583,
29889,
2848,
29961,
29875,
1402,
1583,
29889,
2848,
29918,
3317,
2314,
13,
9651,
1583,
29889,
2146,
617,
2798,
29961,
29875,
29962,
353,
29871,
29900,
13,
4706,
25342,
1583,
29889,
14057,
2798,
29961,
29875,
29962,
6736,
1583,
29889,
14057,
25027,
29901,
29871,
396,
317,
1092,
682,
9311,
5120,
313,
705,
1122,
505,
13461,
287,
278,
4418,
25027,
29897,
13,
9651,
1583,
29889,
2848,
29961,
29875,
29962,
847,
29922,
29871,
29906,
29889,
29900,
13,
9651,
1583,
29889,
14057,
2798,
29961,
29875,
29962,
353,
29871,
29900,
13,
13,
1678,
822,
903,
2622,
29918,
29883,
5380,
1078,
29898,
1311,
29892,
1060,
29918,
29883,
392,
29892,
343,
29918,
29883,
392,
1125,
13,
4706,
9995,
3549,
21669,
515,
11916,
515,
599,
9311,
12786,
1213,
15945,
13,
4706,
4974,
1060,
29918,
29883,
392,
29889,
12181,
1275,
313,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29892,
1583,
29889,
29876,
29918,
29883,
392,
29892,
1583,
29889,
6229,
29897,
13,
4706,
4974,
343,
29918,
29883,
392,
29889,
12181,
1275,
313,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29892,
1583,
29889,
29876,
29918,
29883,
392,
29892,
1583,
29889,
16175,
29918,
2311,
29897,
13,
4706,
4974,
1060,
29918,
29883,
392,
29889,
1195,
580,
6736,
29871,
29900,
29889,
29900,
322,
1060,
29918,
29883,
392,
29889,
3317,
580,
5277,
29871,
29896,
29889,
29900,
322,
7442,
29889,
497,
29898,
9302,
29889,
4492,
262,
568,
29898,
29891,
29918,
29883,
392,
876,
13,
13,
4706,
1060,
29918,
4622,
353,
7442,
29889,
3298,
359,
3552,
1311,
29889,
16175,
29918,
2311,
29892,
1583,
29889,
6229,
876,
13,
4706,
22645,
29918,
4622,
353,
7442,
29889,
3298,
359,
3552,
1311,
29889,
16175,
29918,
2311,
29892,
29871,
29896,
511,
26688,
29922,
524,
29897,
13,
4706,
363,
413,
297,
3464,
29898,
1311,
29889,
16175,
29918,
2311,
1125,
13,
9651,
474,
29892,
432,
353,
7442,
29889,
348,
336,
955,
29918,
2248,
29898,
9302,
29889,
1191,
1195,
29898,
29891,
29918,
29883,
392,
7503,
29892,
584,
29892,
413,
11724,
313,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29892,
1583,
29889,
29876,
29918,
29883,
392,
876,
13,
9651,
4974,
343,
29918,
29883,
392,
7503,
29892,
584,
29892,
413,
1822,
1195,
580,
1275,
343,
29918,
29883,
392,
29961,
29875,
29892,
432,
29892,
413,
29962,
13,
9651,
1060,
29918,
4622,
29961,
29895,
29892,
584,
29962,
353,
6483,
8552,
29898,
29990,
29918,
29883,
392,
29961,
29875,
29892,
432,
29892,
584,
2314,
13,
9651,
22645,
29918,
4622,
29961,
29895,
29892,
29871,
29900,
29962,
353,
474,
13,
9651,
4974,
7442,
29889,
4492,
262,
568,
29898,
29891,
29918,
29883,
392,
29961,
29875,
29892,
432,
29892,
413,
2314,
29871,
396,
3387,
304,
1207,
1854,
591,
2360,
1831,
23432,
470,
3041,
13,
13,
9651,
396,
8561,
1854,
591,
2360,
5839,
445,
1298,
1449,
13,
9651,
343,
29918,
29883,
392,
29961,
29875,
29892,
432,
29892,
584,
29962,
353,
7442,
29889,
7192,
13,
13,
4706,
736,
1060,
29918,
4622,
29892,
22645,
29918,
4622,
13,
13,
1678,
822,
24656,
29898,
1311,
1125,
13,
4706,
9995,
6558,
278,
2989,
13883,
1889,
1213,
15945,
13,
4706,
396,
6204,
2847,
3291,
363,
1269,
10014,
13,
4706,
363,
474,
297,
3464,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
1125,
13,
9651,
1060,
29918,
2344,
353,
25677,
29918,
24947,
29883,
4003,
29898,
1311,
29889,
29876,
29918,
2344,
29892,
1583,
29889,
6229,
29897,
13,
9651,
1060,
29918,
2344,
353,
515,
29918,
5441,
29918,
29883,
4003,
29898,
29990,
29918,
2344,
29892,
1583,
29889,
27728,
29892,
1583,
29889,
431,
29897,
13,
9651,
285,
29990,
29918,
2344,
353,
7442,
29889,
2378,
4197,
29961,
1311,
29889,
29888,
29898,
29916,
4638,
363,
921,
297,
1060,
29918,
2344,
2314,
13,
13,
9651,
396,
10318,
23562,
322,
731,
408,
2847,
848,
363,
445,
10014,
13,
9651,
1583,
29889,
29990,
353,
7442,
29889,
29894,
1429,
3552,
1311,
29889,
29990,
29892,
1060,
29918,
2344,
876,
13,
9651,
1583,
29889,
29888,
29990,
353,
7442,
29889,
29894,
1429,
3552,
1311,
29889,
29888,
29990,
29892,
285,
29990,
29918,
2344,
876,
13,
9651,
1583,
3032,
13140,
353,
7442,
29889,
29894,
1429,
3552,
1311,
3032,
13140,
29892,
474,
334,
7442,
29889,
2873,
3552,
1311,
29889,
29876,
29918,
2344,
29892,
29871,
29896,
511,
26688,
29922,
524,
4961,
13,
9651,
1583,
29889,
29876,
29918,
14513,
29879,
4619,
1583,
29889,
29876,
29918,
2344,
13,
13,
9651,
565,
1583,
29889,
369,
15828,
29901,
13,
18884,
285,
13318,
353,
285,
29990,
29918,
2344,
29889,
1195,
580,
13,
18884,
1596,
29898,
29888,
29908,
5659,
29899,
29912,
29875,
29913,
6257,
515,
29901,
426,
29888,
13318,
29901,
29889,
29946,
27195,
13,
18884,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
4706,
396,
22348,
4559,
304,
679,
2446,
10529,
13,
4706,
1550,
1583,
29889,
29876,
29918,
14513,
29879,
529,
1583,
29889,
3317,
29918,
14513,
29879,
29901,
13,
13,
9651,
396,
3251,
403,
21669,
515,
1269,
10014,
13,
9651,
1060,
29918,
29883,
392,
353,
7442,
29889,
3298,
359,
3552,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29892,
1583,
29889,
29876,
29918,
29883,
392,
29892,
1583,
29889,
6229,
876,
13,
9651,
343,
29918,
29883,
392,
353,
7442,
29889,
7192,
334,
7442,
29889,
2873,
3552,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
29892,
1583,
29889,
29876,
29918,
29883,
392,
29892,
1583,
29889,
16175,
29918,
2311,
876,
13,
9651,
363,
474,
297,
3464,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
1125,
13,
18884,
22645,
353,
7442,
29889,
3062,
29898,
1311,
3032,
13140,
1275,
474,
9601,
29900,
29962,
29871,
396,
7338,
1461,
599,
376,
4925,
29908,
16285,
13,
13,
18884,
396,
3617,
278,
3291,
29892,
1819,
278,
6136,
1819,
13,
18884,
1060,
353,
6483,
8552,
29898,
1311,
29889,
29990,
29961,
13140,
29892,
584,
2314,
13,
18884,
1060,
353,
304,
29918,
5441,
29918,
29883,
4003,
29898,
29990,
29892,
1583,
29889,
27728,
29892,
1583,
29889,
431,
29897,
13,
13,
18884,
396,
3617,
278,
1819,
515,
278,
3918,
1891,
848,
13,
18884,
285,
29990,
353,
6483,
8552,
29898,
1311,
29889,
29888,
29990,
29961,
13140,
29892,
29871,
29900,
1822,
336,
955,
3101,
13,
13,
18884,
396,
3872,
29915,
29873,
337,
14968,
278,
1904,
565,
278,
6694,
848,
22602,
29915,
29873,
3939,
13,
18884,
302,
29918,
26495,
29918,
24530,
353,
29871,
29900,
565,
1583,
29889,
29882,
1478,
414,
29961,
29875,
29962,
1683,
1583,
29889,
29876,
29918,
26495,
29918,
24530,
13,
13,
18884,
396,
6204,
716,
21669,
13,
18884,
1060,
29918,
29883,
392,
29961,
29875,
29892,
584,
29892,
584,
1402,
343,
29918,
29883,
392,
29961,
29875,
29892,
584,
29892,
584,
1402,
1583,
29889,
29882,
1478,
414,
29961,
29875,
29962,
353,
1583,
3032,
3258,
29918,
29883,
5380,
1078,
29898,
13,
462,
1678,
1060,
29892,
285,
29990,
29892,
3309,
29922,
1311,
29889,
2848,
29961,
29875,
1402,
302,
29918,
26495,
29918,
24530,
29922,
29876,
29918,
26495,
29918,
24530,
29892,
10163,
414,
29922,
1311,
29889,
29882,
1478,
414,
29961,
29875,
29962,
13,
18884,
1723,
13,
13,
9651,
396,
7605,
278,
2446,
21669,
13,
9651,
1060,
29918,
4622,
29892,
22645,
29918,
4622,
353,
1583,
3032,
2622,
29918,
29883,
5380,
1078,
29898,
29990,
29918,
29883,
392,
29892,
343,
29918,
29883,
392,
29897,
13,
9651,
4974,
1060,
29918,
4622,
29889,
1195,
580,
6736,
29871,
29900,
29889,
29900,
322,
1060,
29918,
4622,
29889,
3317,
580,
5277,
29871,
29896,
29889,
29900,
13,
13,
9651,
396,
14211,
29877,
278,
1370,
15702,
13,
9651,
1060,
29918,
4622,
353,
515,
29918,
5441,
29918,
29883,
4003,
29898,
29990,
29918,
4622,
29892,
1583,
29889,
27728,
29892,
1583,
29889,
431,
29897,
13,
13,
9651,
396,
382,
4387,
403,
9853,
13,
9651,
285,
29990,
29918,
4622,
353,
7442,
29889,
2378,
4197,
29961,
1311,
29889,
29888,
29898,
29916,
4638,
363,
921,
297,
1060,
29918,
4622,
2314,
13,
13,
9651,
396,
10318,
9311,
12786,
13,
9651,
363,
474,
297,
3464,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
1125,
13,
18884,
22645,
29918,
29875,
353,
7442,
29889,
3062,
29898,
13140,
29918,
4622,
1275,
474,
9601,
29900,
29962,
13,
18884,
565,
7431,
29898,
13140,
29918,
29875,
29897,
1405,
29871,
29900,
29901,
13,
462,
1678,
1583,
29889,
29882,
1478,
414,
29961,
29875,
29962,
353,
6571,
29871,
396,
15154,
1904,
10163,
414,
13,
462,
1678,
285,
29990,
29918,
29875,
353,
285,
29990,
29918,
4622,
29961,
13140,
29918,
29875,
29962,
13,
13,
462,
1678,
565,
1583,
29889,
369,
15828,
322,
285,
29990,
29918,
29875,
29889,
1195,
580,
529,
1583,
29889,
29888,
29990,
29889,
1195,
580,
448,
29871,
29896,
29872,
29899,
29941,
334,
5844,
29889,
29888,
6897,
29898,
1311,
29889,
29888,
29990,
29889,
1195,
580,
1125,
13,
462,
4706,
302,
29918,
14513,
29879,
29892,
285,
13318,
353,
1583,
29889,
29876,
29918,
14513,
29879,
29892,
285,
29990,
29918,
29875,
29889,
1195,
580,
13,
462,
4706,
1596,
29898,
29888,
29908,
29912,
29876,
29918,
14513,
29879,
1800,
1570,
1900,
732,
10014,
29899,
29912,
29875,
6177,
426,
29888,
13318,
29901,
29889,
29946,
27195,
13,
462,
4706,
10876,
29889,
25393,
29889,
23126,
580,
13,
462,
1678,
1583,
3032,
328,
5143,
29918,
2848,
29898,
29888,
29990,
29918,
29875,
29892,
474,
29897,
13,
13,
9651,
396,
10318,
23562,
322,
9773,
848,
13,
9651,
1583,
29889,
29876,
29918,
14513,
29879,
4619,
1583,
29889,
16175,
29918,
2311,
13,
9651,
1583,
29889,
29990,
353,
7442,
29889,
29894,
1429,
3552,
1311,
29889,
29990,
29892,
6483,
8552,
29898,
29990,
29918,
4622,
4961,
13,
9651,
1583,
29889,
29888,
29990,
353,
7442,
29889,
29894,
1429,
3552,
1311,
29889,
29888,
29990,
29892,
6483,
8552,
29898,
29888,
29990,
29918,
4622,
4961,
13,
9651,
1583,
3032,
13140,
353,
7442,
29889,
29894,
1429,
3552,
1311,
3032,
13140,
29892,
6483,
8552,
29898,
13140,
29918,
4622,
4961,
13,
13,
9651,
396,
5399,
565,
738,
10014,
4225,
304,
367,
10715,
287,
13,
9651,
363,
474,
297,
3464,
29898,
1311,
29889,
29876,
29918,
509,
504,
29918,
1727,
1080,
1125,
13,
18884,
565,
1583,
29889,
2848,
29961,
29875,
29962,
529,
1583,
29889,
2848,
29918,
1195,
29901,
29871,
396,
11654,
442,
9311,
5120,
565,
5486,
3192,
13,
462,
1678,
22645,
29918,
29875,
353,
1583,
3032,
13140,
7503,
29892,
29871,
29900,
29962,
1275,
474,
13,
13,
462,
1678,
565,
1583,
29889,
369,
15828,
29901,
13,
462,
4706,
302,
29918,
14513,
29879,
29892,
285,
13318,
353,
1583,
29889,
29876,
29918,
14513,
29879,
29892,
1583,
29889,
29888,
29990,
29961,
13140,
29918,
29875,
29892,
29871,
29900,
1822,
1195,
580,
13,
462,
4706,
1596,
29898,
29888,
29908,
29912,
29876,
29918,
14513,
29879,
1800,
10014,
29899,
29912,
29875,
29913,
5486,
3192,
304,
29901,
584,
426,
29888,
13318,
29901,
29889,
29946,
27195,
13,
462,
4706,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
462,
1678,
396,
2538,
300,
3309,
322,
2613,
2153,
29892,
3349,
2030,
848,
515,
9311,
5120,
13,
462,
1678,
1583,
29889,
2848,
29961,
29875,
29962,
353,
1583,
29889,
2848,
29918,
2344,
13,
462,
1678,
1583,
29889,
2146,
617,
2798,
29961,
29875,
29962,
353,
29871,
29900,
13,
462,
1678,
1583,
29889,
14057,
2798,
29961,
29875,
29962,
353,
29871,
29900,
13,
462,
1678,
1583,
3032,
13140,
29961,
13140,
29918,
29875,
29892,
29871,
29900,
29962,
353,
448,
29896,
29871,
396,
15154,
3291,
515,
9311,
5120,
13,
462,
1678,
1583,
29889,
29882,
1478,
414,
29961,
29875,
29962,
353,
6571,
29871,
396,
15154,
1904,
10163,
414,
13,
13,
462,
1678,
396,
6204,
263,
716,
2847,
2874,
13,
462,
1678,
1060,
29918,
2344,
353,
25677,
29918,
24947,
29883,
4003,
29898,
1311,
29889,
29876,
29918,
2344,
29892,
1583,
29889,
6229,
29897,
13,
462,
1678,
1060,
29918,
2344,
353,
515,
29918,
5441,
29918,
29883,
4003,
29898,
29990,
29918,
2344,
29892,
1583,
29889,
27728,
29892,
1583,
29889,
431,
29897,
13,
462,
1678,
285,
29990,
29918,
2344,
353,
7442,
29889,
2378,
4197,
29961,
1311,
29889,
29888,
29898,
29916,
4638,
363,
921,
297,
1060,
29918,
2344,
2314,
13,
13,
462,
1678,
396,
13905,
6728,
13,
462,
1678,
565,
1583,
29889,
369,
15828,
29901,
13,
462,
4706,
302,
29918,
14513,
29879,
29892,
285,
13318,
353,
1583,
29889,
29876,
29918,
14513,
29879,
29892,
285,
29990,
29918,
2344,
29889,
1195,
580,
13,
462,
4706,
1596,
29898,
29888,
29908,
29912,
29876,
29918,
14513,
29879,
1800,
10014,
29899,
29912,
29875,
29913,
338,
10715,
292,
515,
29901,
584,
426,
29888,
13318,
29901,
29889,
29946,
27195,
13,
462,
4706,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
462,
1678,
396,
22871,
848,
304,
1887,
4955,
13,
462,
1678,
1583,
29889,
29990,
353,
7442,
29889,
29894,
1429,
3552,
1311,
29889,
29990,
29892,
1060,
29918,
2344,
876,
13,
462,
1678,
1583,
29889,
29888,
29990,
353,
7442,
29889,
29894,
1429,
3552,
1311,
29889,
29888,
29990,
29892,
285,
29990,
29918,
2344,
876,
13,
462,
1678,
1583,
3032,
13140,
353,
7442,
29889,
29894,
1429,
3552,
1311,
3032,
13140,
29892,
474,
334,
7442,
29889,
2873,
3552,
1311,
29889,
29876,
29918,
2344,
29892,
29871,
29896,
511,
26688,
29922,
524,
4961,
13,
462,
1678,
1583,
29889,
29876,
29918,
14513,
29879,
4619,
1583,
29889,
29876,
29918,
2344,
13,
2
] |
src/main.py | bhavanib/Music-Recommendation-System | 3 | 179551 | from SWIMMRS.src.TweetClassifier import Tokenizer, FeatureExtraction
from SWIMMRS.src.scraper.Datascraper import DataScraper
from SWIMMRS.src.scraper.OauthConnectionClient import OauthClient
userTweets_url = 'https://api.twitter.com/1.1/statuses/user_timeline.json?user_id=2597834149&count=20'
def main():
oauth_obj = OauthClient()
oauth_client = oauth_obj.getOauthClient()
data_scraper = DataScraper(oauth_client)
user_tweets = data_scraper.getUserTweets(userTweets_url)
for a in user_tweets:
print(a['text'])
tokenList = Tokenizer.preprocess(a['text'])
print(tokenList)
# for t in tokenList:
# print(t.encode('unicode-escape'))
featureList = FeatureExtraction.getfeatureVector(tokenList)
print(featureList)
if __name__ == '__main__':
main()
| [
1,
515,
317,
22119,
7428,
12445,
29889,
4351,
29889,
29911,
16668,
2385,
3709,
1053,
25159,
3950,
29892,
5169,
1535,
5647,
13857,
13,
3166,
317,
22119,
7428,
12445,
29889,
4351,
29889,
1557,
336,
546,
29889,
16390,
6151,
336,
546,
1053,
3630,
4421,
336,
546,
13,
3166,
317,
22119,
7428,
12445,
29889,
4351,
29889,
1557,
336,
546,
29889,
29949,
5150,
5350,
4032,
1053,
438,
5150,
4032,
13,
13,
1792,
29911,
705,
1691,
29918,
2271,
353,
525,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
29896,
29889,
29896,
29914,
4882,
267,
29914,
1792,
29918,
9346,
5570,
29889,
3126,
29973,
1792,
29918,
333,
29922,
29906,
29945,
29929,
29955,
29947,
29941,
29946,
29896,
29946,
29929,
29987,
2798,
29922,
29906,
29900,
29915,
13,
13,
1753,
1667,
7295,
13,
1678,
288,
5150,
29918,
5415,
353,
438,
5150,
4032,
580,
13,
1678,
288,
5150,
29918,
4645,
353,
288,
5150,
29918,
5415,
29889,
657,
29949,
5150,
4032,
580,
13,
13,
1678,
848,
29918,
1557,
336,
546,
353,
3630,
4421,
336,
546,
29898,
23106,
29918,
4645,
29897,
13,
1678,
1404,
29918,
29873,
705,
1691,
353,
848,
29918,
1557,
336,
546,
29889,
657,
2659,
29911,
705,
1691,
29898,
1792,
29911,
705,
1691,
29918,
2271,
29897,
13,
13,
1678,
363,
263,
297,
1404,
29918,
29873,
705,
1691,
29901,
13,
4706,
1596,
29898,
29874,
1839,
726,
11287,
13,
4706,
5993,
1293,
353,
25159,
3950,
29889,
1457,
5014,
29898,
29874,
1839,
726,
11287,
13,
4706,
1596,
29898,
6979,
1293,
29897,
13,
4706,
396,
363,
260,
297,
5993,
1293,
29901,
13,
4706,
396,
1596,
29898,
29873,
29889,
12508,
877,
2523,
356,
29899,
21587,
8785,
13,
4706,
4682,
1293,
353,
5169,
1535,
5647,
13857,
29889,
657,
14394,
12877,
29898,
6979,
1293,
29897,
13,
4706,
1596,
29898,
14394,
1293,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
13,
2
] |
mod_ci/cron.py | T1duS/sample-platform | 1 | 162413 | #!/usr/bin/python
import sys
from os import path
# Need to append server root path to ensure we can import the necessary files.
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
def cron():
from mod_ci.controllers import start_platform
from run import config, log
from database import create_session
from github import GitHub
log.info('Run the cron for kicking off CI platform(s).')
# Create session
db = create_session(config['DATABASE_URI'])
gh = GitHub(access_token=config['GITHUB_TOKEN'])
repository = gh.repos(config['GITHUB_OWNER'])(config['GITHUB_REPOSITORY'])
start_platform(db, repository)
cron()
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
13,
5215,
10876,
13,
3166,
2897,
1053,
2224,
13,
13,
29937,
20768,
304,
9773,
1923,
3876,
2224,
304,
9801,
591,
508,
1053,
278,
5181,
2066,
29889,
13,
9675,
29889,
2084,
29889,
4397,
29898,
2084,
29889,
25721,
29898,
2084,
29889,
25721,
29898,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
13697,
13,
13,
13,
1753,
18863,
7295,
13,
1678,
515,
878,
29918,
455,
29889,
1285,
11897,
1053,
1369,
29918,
12120,
13,
1678,
515,
1065,
1053,
2295,
29892,
1480,
13,
1678,
515,
2566,
1053,
1653,
29918,
7924,
13,
1678,
515,
18546,
1053,
25492,
13,
13,
1678,
1480,
29889,
3888,
877,
6558,
278,
18863,
363,
24817,
292,
1283,
25781,
7481,
29898,
29879,
467,
1495,
13,
1678,
396,
6204,
4867,
13,
1678,
4833,
353,
1653,
29918,
7924,
29898,
2917,
1839,
25832,
27982,
29918,
15551,
11287,
13,
1678,
24170,
353,
25492,
29898,
5943,
29918,
6979,
29922,
2917,
1839,
29954,
13054,
7466,
29918,
4986,
29968,
1430,
11287,
13,
1678,
9810,
353,
24170,
29889,
276,
1066,
29898,
2917,
1839,
29954,
13054,
7466,
29918,
9806,
13865,
2033,
5033,
2917,
1839,
29954,
13054,
7466,
29918,
1525,
24815,
1806,
18929,
11287,
13,
13,
1678,
1369,
29918,
12120,
29898,
2585,
29892,
9810,
29897,
13,
13,
13,
29883,
1617,
580,
13,
2
] |
chargebee/models/site_migration_detail.py | koordinates/chargebee-python | 28 | 172046 | <filename>chargebee/models/site_migration_detail.py
import json
from chargebee.model import Model
from chargebee import request
from chargebee import APIError
class SiteMigrationDetail(Model):
fields = ["entity_id", "other_site_name", "entity_id_at_other_site", "migrated_at", "entity_type", \
"status"]
@staticmethod
def list(params=None, env=None, headers=None):
return request.send_list_request('get', request.uri_path("site_migration_details"), params, env, headers)
| [
1,
529,
9507,
29958,
23367,
915,
29872,
29914,
9794,
29914,
2746,
29918,
29885,
16783,
29918,
16432,
29889,
2272,
13,
5215,
4390,
13,
3166,
8323,
915,
29872,
29889,
4299,
1053,
8125,
13,
3166,
8323,
915,
29872,
1053,
2009,
13,
3166,
8323,
915,
29872,
1053,
3450,
2392,
13,
13,
1990,
10781,
29924,
16783,
16570,
29898,
3195,
1125,
13,
13,
1678,
4235,
353,
6796,
10041,
29918,
333,
613,
376,
1228,
29918,
2746,
29918,
978,
613,
376,
10041,
29918,
333,
29918,
271,
29918,
1228,
29918,
2746,
613,
376,
26983,
630,
29918,
271,
613,
376,
10041,
29918,
1853,
613,
320,
13,
1678,
376,
4882,
3108,
13,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1051,
29898,
7529,
29922,
8516,
29892,
8829,
29922,
8516,
29892,
9066,
29922,
8516,
1125,
13,
4706,
736,
2009,
29889,
6717,
29918,
1761,
29918,
3827,
877,
657,
742,
2009,
29889,
5338,
29918,
2084,
703,
2746,
29918,
29885,
16783,
29918,
14144,
4968,
8636,
29892,
8829,
29892,
9066,
29897,
13,
2
] |
memegen/memegen/routes/latest.py | flavienbwk/memegen | 3 | 74749 | from flask import Blueprint, render_template, current_app, make_response
from webargs import fields, flaskparser
from ._utils import route
REFRESH_SECONDS = 60
blueprint = Blueprint('latest-page', __name__)
@blueprint.route("/latest")
@flaskparser.use_kwargs({'nsfw': fields.Bool(missing=False)})
def get(nsfw):
filtered = 'false' if nsfw else 'true'
html = render_template(
'latest.html',
srcs=[route('image.get_latest', index=i, filtered=filtered)
for i in range(24)],
refresh=REFRESH_SECONDS,
config=current_app.config,
)
response = make_response(html)
response.headers['Cache-Control'] = f'max-age={REFRESH_SECONDS-1}'
return response
| [
1,
515,
29784,
1053,
10924,
2158,
29892,
4050,
29918,
6886,
29892,
1857,
29918,
932,
29892,
1207,
29918,
5327,
13,
3166,
1856,
5085,
1053,
4235,
29892,
29784,
16680,
13,
13,
3166,
869,
29918,
13239,
1053,
5782,
13,
13,
25866,
1525,
7068,
29918,
1660,
6007,
8452,
353,
29871,
29953,
29900,
13,
13,
9539,
2158,
353,
10924,
2158,
877,
12333,
29899,
3488,
742,
4770,
978,
1649,
29897,
13,
13,
13,
29992,
9539,
2158,
29889,
13134,
11974,
12333,
1159,
13,
29992,
1579,
1278,
16680,
29889,
1509,
29918,
19290,
3319,
29915,
1983,
25051,
2396,
4235,
29889,
24693,
29898,
27259,
29922,
8824,
26972,
13,
1753,
679,
29898,
1983,
25051,
1125,
13,
1678,
22289,
353,
525,
4541,
29915,
565,
302,
4668,
29893,
1683,
525,
3009,
29915,
13,
1678,
3472,
353,
4050,
29918,
6886,
29898,
13,
4706,
525,
12333,
29889,
1420,
742,
13,
4706,
4765,
29879,
11759,
13134,
877,
3027,
29889,
657,
29918,
12333,
742,
2380,
29922,
29875,
29892,
22289,
29922,
4572,
287,
29897,
13,
795,
363,
474,
297,
3464,
29898,
29906,
29946,
29897,
1402,
13,
4706,
11086,
29922,
25866,
1525,
7068,
29918,
1660,
6007,
8452,
29892,
13,
4706,
2295,
29922,
3784,
29918,
932,
29889,
2917,
29892,
13,
1678,
1723,
13,
1678,
2933,
353,
1207,
29918,
5327,
29898,
1420,
29897,
13,
1678,
2933,
29889,
13662,
1839,
10408,
29899,
4809,
2033,
353,
285,
29915,
3317,
29899,
482,
3790,
25866,
1525,
7068,
29918,
1660,
6007,
8452,
29899,
29896,
10162,
13,
1678,
736,
2933,
13,
2
] |
dicomtrolley/core.py | michelkok/dicomtrolley | 0 | 43533 | <reponame>michelkok/dicomtrolley
"""Provides common base classes that allow different modules to talk to each other."""
from itertools import chain
from typing import Sequence
from pydantic.main import BaseModel
from pydicom.dataset import Dataset
from dicomtrolley.exceptions import DICOMTrolleyException
class DICOMObject(BaseModel):
"""An object in the DICOM world. Base for Study, Series, Instance.
dicomtrolley search methods always return instances based on DICOMObject
dicomtrolley download methods take instances based on DICOMObject as input
"""
uid: str
data: Dataset
def __str__(self):
return type(self).__name__ + " " + self.uid
def all_instances(self):
"""
Returns
-------
List[Instance]
All instances contained in this object
"""
raise NotImplementedError()
class Instance(DICOMObject):
parent: "Series"
def all_instances(self):
"""A list containing this instance itself. To match other signatures"""
return [self]
class Series(DICOMObject):
instances: Sequence[Instance]
parent: "Study"
def all_instances(self):
"""Each instance contained in this series"""
return self.instances
class Study(DICOMObject):
series: Sequence[Series]
def all_instances(self):
"""Return each instance contained in this study"""
return list(chain(*(x.instances for x in self.series)))
class Searcher:
"""Something that can search for DICOM studies. Base class."""
def find_studies(self, query) -> Sequence[Study]:
raise NotImplementedError()
def find_study(self, query) -> Study:
"""Like find_studies, but guarantees exactly one result. Exception if not.
This method is meant for searches that contain unique identifiers like
StudyInstanceUID, AccessionNumber, etc.
Raises
------
DICOMTrolleyException
If no results or more than one result is returned by query
"""
results = self.find_studies(query)
if len(results) == 0 or len(results) > 1:
raise DICOMTrolleyException(
f"Expected exactly one study for query '{query}', but"
f" found {len(results)}"
)
return results[0]
Instance.update_forward_refs() # enables pydantic validation
Series.update_forward_refs()
| [
1,
529,
276,
1112,
420,
29958,
29885,
436,
295,
29895,
554,
29914,
27774,
290,
29873,
1467,
2330,
13,
15945,
29908,
1184,
29894,
2247,
3619,
2967,
4413,
393,
2758,
1422,
10585,
304,
5193,
304,
1269,
916,
1213,
15945,
13,
3166,
4256,
8504,
1053,
9704,
13,
3166,
19229,
1053,
922,
3910,
13,
13,
3166,
282,
2941,
7716,
29889,
3396,
1053,
7399,
3195,
13,
3166,
282,
2941,
293,
290,
29889,
24713,
1053,
13373,
24541,
13,
13,
3166,
12124,
290,
29873,
1467,
2330,
29889,
11739,
29879,
1053,
360,
2965,
6488,
29911,
1467,
2330,
2451,
13,
13,
13,
1990,
360,
2965,
6488,
2061,
29898,
5160,
3195,
1125,
13,
1678,
9995,
2744,
1203,
297,
278,
360,
2965,
6488,
3186,
29889,
7399,
363,
29301,
29892,
10488,
29892,
2799,
749,
29889,
13,
13,
1678,
12124,
290,
29873,
1467,
2330,
2740,
3519,
2337,
736,
8871,
2729,
373,
360,
2965,
6488,
2061,
13,
1678,
12124,
290,
29873,
1467,
2330,
5142,
3519,
2125,
8871,
2729,
373,
360,
2965,
6488,
2061,
408,
1881,
13,
1678,
9995,
13,
13,
1678,
318,
333,
29901,
851,
13,
1678,
848,
29901,
13373,
24541,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1134,
29898,
1311,
467,
1649,
978,
1649,
718,
376,
376,
718,
1583,
29889,
5416,
13,
13,
1678,
822,
599,
29918,
2611,
2925,
29898,
1311,
1125,
13,
4706,
9995,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
2391,
29961,
4998,
29962,
13,
9651,
2178,
8871,
11122,
297,
445,
1203,
13,
4706,
9995,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
580,
13,
13,
13,
1990,
2799,
749,
29898,
29928,
2965,
6488,
2061,
1125,
13,
1678,
3847,
29901,
376,
19204,
29908,
13,
13,
1678,
822,
599,
29918,
2611,
2925,
29898,
1311,
1125,
13,
4706,
9995,
29909,
1051,
6943,
445,
2777,
3528,
29889,
1763,
1993,
916,
1804,
3698,
15945,
29908,
13,
4706,
736,
518,
1311,
29962,
13,
13,
13,
1990,
10488,
29898,
29928,
2965,
6488,
2061,
1125,
13,
1678,
8871,
29901,
922,
3910,
29961,
4998,
29962,
13,
1678,
3847,
29901,
376,
855,
566,
29891,
29908,
13,
13,
1678,
822,
599,
29918,
2611,
2925,
29898,
1311,
1125,
13,
4706,
9995,
9760,
2777,
11122,
297,
445,
3652,
15945,
29908,
13,
4706,
736,
1583,
29889,
2611,
2925,
13,
13,
13,
1990,
29301,
29898,
29928,
2965,
6488,
2061,
1125,
13,
1678,
3652,
29901,
922,
3910,
29961,
19204,
29962,
13,
13,
1678,
822,
599,
29918,
2611,
2925,
29898,
1311,
1125,
13,
4706,
9995,
11609,
1269,
2777,
11122,
297,
445,
6559,
15945,
29908,
13,
4706,
736,
1051,
29898,
14153,
10456,
29898,
29916,
29889,
2611,
2925,
363,
921,
297,
1583,
29889,
13757,
4961,
13,
13,
13,
1990,
11856,
261,
29901,
13,
1678,
9995,
16804,
393,
508,
2740,
363,
360,
2965,
6488,
11898,
29889,
7399,
770,
1213,
15945,
13,
13,
1678,
822,
1284,
29918,
18082,
583,
29898,
1311,
29892,
2346,
29897,
1599,
922,
3910,
29961,
855,
566,
29891,
5387,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
580,
13,
13,
1678,
822,
1284,
29918,
18082,
29891,
29898,
1311,
29892,
2346,
29897,
1599,
29301,
29901,
13,
4706,
9995,
27552,
1284,
29918,
18082,
583,
29892,
541,
10509,
267,
3721,
697,
1121,
29889,
8960,
565,
451,
29889,
13,
13,
4706,
910,
1158,
338,
6839,
363,
29645,
393,
1712,
5412,
2893,
14903,
763,
13,
4706,
29301,
4998,
11150,
29892,
4831,
1211,
4557,
29892,
2992,
29889,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
360,
2965,
6488,
29911,
1467,
2330,
2451,
13,
9651,
960,
694,
2582,
470,
901,
1135,
697,
1121,
338,
4133,
491,
2346,
13,
4706,
9995,
13,
4706,
2582,
353,
1583,
29889,
2886,
29918,
18082,
583,
29898,
1972,
29897,
13,
4706,
565,
7431,
29898,
9902,
29897,
1275,
29871,
29900,
470,
7431,
29898,
9902,
29897,
1405,
29871,
29896,
29901,
13,
9651,
12020,
360,
2965,
6488,
29911,
1467,
2330,
2451,
29898,
13,
18884,
285,
29908,
1252,
6021,
3721,
697,
6559,
363,
2346,
22372,
1972,
29913,
742,
541,
29908,
13,
18884,
285,
29908,
1476,
426,
2435,
29898,
9902,
2915,
29908,
13,
9651,
1723,
13,
4706,
736,
2582,
29961,
29900,
29962,
13,
13,
13,
4998,
29889,
5504,
29918,
11333,
29918,
24539,
580,
29871,
396,
28936,
282,
2941,
7716,
8845,
13,
19204,
29889,
5504,
29918,
11333,
29918,
24539,
580,
13,
2
] |
src/sqlite3_handler.py | simaoamorim/cnc_tooldb | 2 | 149467 | <reponame>simaoamorim/cnc_tooldb
#!/usr/bin/env python3
"""
Python module that handles the connection and actions to the local database
"""
import os.path
import sqlite3 as sql
class DB(object):
def __init__(self, dbname='database.db'):
"""Initialize the connection to the database and, if it doesn't exist, create the necessary tables"""
if os.path.isfile(dbname):
self.db_exists = True
else:
self.db_exists = False
self.conn = sql.connect(dbname)
self.cur = self.conn.cursor()
assert self.cur.connection == self.conn
if not self.db_exists:
self.init_db()
def init_db(self):
"""Create the needed tables in the new database file"""
self.cur.execute('''CREATE TABLE machine (ID INTEGER PRIMARY KEY, name VARCHAR(100));''')
self.cur.execute('''CREATE TABLE tool (ID INTEGER PRIMARY KEY, comment VARCHAR(100));''')
self.cur.execute('''
CREATE TABLE parameters (
IDMachine INTEGER NOT NULL,
IDTool INTEGER NOT NULL,
comment VARCHAR(100),
Xval REAL,
Yval REAL,
Zval REAL,
FOREIGN KEY (IDMachine) REFERENCES machine(ID) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY (IDTool) REFERENCES tool(ID) ON UPDATE CASCADE ON DELETE CASCADE,
PRIMARY KEY (IDMachine, IDTool)
);
''')
self.conn.commit()
def get_machines(self, cur=None):
if cur is None:
cur = self.cur
return cur.execute("SELECT name FROM machine")
def __del__(self):
"""Close the database connection and exit"""
self.conn.close()
| [
1,
529,
276,
1112,
420,
29958,
29879,
2946,
29877,
314,
272,
326,
29914,
29883,
17608,
29918,
517,
1025,
29890,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
15945,
29908,
13,
11980,
3883,
393,
17766,
278,
3957,
322,
8820,
304,
278,
1887,
2566,
13,
15945,
29908,
13,
5215,
2897,
29889,
2084,
13,
5215,
21120,
29941,
408,
4576,
13,
13,
13,
1990,
6535,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4833,
978,
2433,
9803,
29889,
2585,
29374,
13,
4706,
9995,
6644,
6646,
278,
3957,
304,
278,
2566,
322,
29892,
565,
372,
1838,
29915,
29873,
1863,
29892,
1653,
278,
5181,
6131,
15945,
29908,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
2585,
978,
1125,
13,
9651,
1583,
29889,
2585,
29918,
9933,
353,
5852,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
2585,
29918,
9933,
353,
7700,
13,
4706,
1583,
29889,
13082,
353,
4576,
29889,
6915,
29898,
2585,
978,
29897,
13,
4706,
1583,
29889,
2764,
353,
1583,
29889,
13082,
29889,
18127,
580,
13,
4706,
4974,
1583,
29889,
2764,
29889,
9965,
1275,
1583,
29889,
13082,
13,
4706,
565,
451,
1583,
29889,
2585,
29918,
9933,
29901,
13,
9651,
1583,
29889,
2344,
29918,
2585,
580,
13,
13,
1678,
822,
2069,
29918,
2585,
29898,
1311,
1125,
13,
4706,
9995,
4391,
278,
4312,
6131,
297,
278,
716,
2566,
934,
15945,
29908,
13,
4706,
1583,
29889,
2764,
29889,
7978,
877,
4907,
27045,
10911,
4933,
313,
1367,
2672,
4330,
17070,
29778,
14636,
29892,
1024,
21748,
29898,
29896,
29900,
29900,
2483,
4907,
1495,
13,
4706,
1583,
29889,
2764,
29889,
7978,
877,
4907,
27045,
10911,
5780,
313,
1367,
2672,
4330,
17070,
29778,
14636,
29892,
3440,
21748,
29898,
29896,
29900,
29900,
2483,
4907,
1495,
13,
4706,
1583,
29889,
2764,
29889,
7978,
877,
4907,
13,
462,
9651,
14602,
10911,
4128,
313,
13,
462,
18884,
3553,
29076,
2672,
4330,
17070,
6058,
4265,
29892,
13,
462,
18884,
3553,
12229,
2672,
4330,
17070,
6058,
4265,
29892,
13,
462,
18884,
3440,
21748,
29898,
29896,
29900,
29900,
511,
13,
462,
18884,
1060,
791,
5195,
1964,
29892,
13,
462,
18884,
612,
791,
5195,
1964,
29892,
13,
462,
18884,
796,
791,
5195,
1964,
29892,
13,
462,
18884,
18322,
1525,
17298,
14636,
313,
1367,
29076,
29897,
5195,
29943,
1001,
1430,
27266,
4933,
29898,
1367,
29897,
6732,
16924,
315,
3289,
5454,
2287,
6732,
5012,
18476,
315,
3289,
5454,
2287,
29892,
13,
462,
18884,
18322,
1525,
17298,
14636,
313,
1367,
12229,
29897,
5195,
29943,
1001,
1430,
27266,
5780,
29898,
1367,
29897,
6732,
16924,
315,
3289,
5454,
2287,
6732,
5012,
18476,
315,
3289,
5454,
2287,
29892,
13,
462,
18884,
29778,
14636,
313,
1367,
29076,
29892,
3553,
12229,
29897,
29871,
13,
462,
9651,
3482,
13,
462,
4706,
6629,
1495,
13,
4706,
1583,
29889,
13082,
29889,
15060,
580,
13,
13,
1678,
822,
679,
29918,
29885,
496,
1475,
29898,
1311,
29892,
3151,
29922,
8516,
1125,
13,
4706,
565,
3151,
338,
6213,
29901,
13,
9651,
3151,
353,
1583,
29889,
2764,
13,
4706,
736,
3151,
29889,
7978,
703,
6404,
1024,
3895,
4933,
1159,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
9995,
11123,
278,
2566,
3957,
322,
6876,
15945,
29908,
13,
4706,
1583,
29889,
13082,
29889,
5358,
580,
13,
2
] |
git_vote_cog/issues.py | dbford/votecog | 0 | 110044 | from typing import Optional, Set
import github
from github.PullRequest import PullRequest
from git_vote_cog.util import wrap_async
class Issue:
def __init__(self, pr: Optional[PullRequest]):
# class variables def
self._pr: Optional[PullRequest] = None
self.id: int = -1
self.url: str = ""
self.title: str = ""
self.description: str = ""
self.author: str = ""
self.labels: Set[str] = set()
self.exists: bool = False
# init class
self.pr = pr
@wrap_async
def remove_label(self, tag: [str]):
try:
self.pr.remove_from_labels(tag)
except github.GithubException as err:
if not err.status == 404:
raise err
try:
self.labels.remove(tag)
except KeyError:
pass
@wrap_async
def add_label(self, tag: str):
self.pr.add_to_labels(tag)
self.labels.add(tag)
@wrap_async
def update(self):
if self.pr is None:
return
try:
self.pr.update()
self.pr = self.pr
except github.UnknownObjectException:
self.pr = None
@property
def pr(self) -> Optional[PullRequest]:
return self._pr
@pr.setter
def pr(self, pr: Optional[PullRequest]):
self._pr = pr
if pr is None:
self.id = -1
self.exists = False
else:
self.id = pr.number
self.url = pr.html_url
self.title = pr.title
self.description = pr.body
self.author = pr.user.login
self.labels = {label.name for label in pr.labels}
self.exists = pr.state == "open" and not pr.is_merged()
def __str__(self) -> str:
return f"PR(id={self.id}, exists={self.exists})"
| [
1,
515,
19229,
1053,
28379,
29892,
3789,
13,
13,
5215,
18546,
13,
3166,
18546,
29889,
29925,
913,
3089,
1053,
349,
913,
3089,
13,
13,
3166,
6315,
29918,
15814,
29918,
29883,
468,
29889,
4422,
1053,
12244,
29918,
12674,
13,
13,
13,
1990,
26246,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
544,
29901,
28379,
29961,
29925,
913,
3089,
29962,
1125,
13,
4706,
396,
770,
3651,
822,
13,
4706,
1583,
3032,
558,
29901,
28379,
29961,
29925,
913,
3089,
29962,
353,
6213,
13,
4706,
1583,
29889,
333,
29901,
938,
353,
448,
29896,
13,
4706,
1583,
29889,
2271,
29901,
851,
353,
5124,
13,
4706,
1583,
29889,
3257,
29901,
851,
353,
5124,
13,
4706,
1583,
29889,
8216,
29901,
851,
353,
5124,
13,
4706,
1583,
29889,
8921,
29901,
851,
353,
5124,
13,
4706,
1583,
29889,
21134,
29901,
3789,
29961,
710,
29962,
353,
731,
580,
13,
4706,
1583,
29889,
9933,
29901,
6120,
353,
7700,
13,
13,
4706,
396,
2069,
770,
13,
4706,
1583,
29889,
558,
353,
544,
13,
13,
1678,
732,
6312,
29918,
12674,
13,
1678,
822,
3349,
29918,
1643,
29898,
1311,
29892,
4055,
29901,
518,
710,
29962,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
558,
29889,
5992,
29918,
3166,
29918,
21134,
29898,
4039,
29897,
13,
4706,
5174,
18546,
29889,
29954,
2985,
2451,
408,
4589,
29901,
13,
9651,
565,
451,
4589,
29889,
4882,
1275,
29871,
29946,
29900,
29946,
29901,
13,
18884,
12020,
4589,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
21134,
29889,
5992,
29898,
4039,
29897,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
1209,
13,
13,
1678,
732,
6312,
29918,
12674,
13,
1678,
822,
788,
29918,
1643,
29898,
1311,
29892,
4055,
29901,
851,
1125,
13,
4706,
1583,
29889,
558,
29889,
1202,
29918,
517,
29918,
21134,
29898,
4039,
29897,
13,
4706,
1583,
29889,
21134,
29889,
1202,
29898,
4039,
29897,
13,
13,
1678,
732,
6312,
29918,
12674,
13,
1678,
822,
2767,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
558,
338,
6213,
29901,
13,
9651,
736,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
558,
29889,
5504,
580,
13,
9651,
1583,
29889,
558,
353,
1583,
29889,
558,
13,
4706,
5174,
18546,
29889,
14148,
2061,
2451,
29901,
13,
9651,
1583,
29889,
558,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
544,
29898,
1311,
29897,
1599,
28379,
29961,
29925,
913,
3089,
5387,
13,
4706,
736,
1583,
3032,
558,
13,
13,
1678,
732,
558,
29889,
842,
357,
13,
1678,
822,
544,
29898,
1311,
29892,
544,
29901,
28379,
29961,
29925,
913,
3089,
29962,
1125,
13,
4706,
1583,
3032,
558,
353,
544,
13,
4706,
565,
544,
338,
6213,
29901,
13,
9651,
1583,
29889,
333,
353,
448,
29896,
13,
9651,
1583,
29889,
9933,
353,
7700,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
333,
353,
544,
29889,
4537,
13,
9651,
1583,
29889,
2271,
353,
544,
29889,
1420,
29918,
2271,
13,
9651,
1583,
29889,
3257,
353,
544,
29889,
3257,
13,
9651,
1583,
29889,
8216,
353,
544,
29889,
2587,
13,
9651,
1583,
29889,
8921,
353,
544,
29889,
1792,
29889,
7507,
13,
9651,
1583,
29889,
21134,
353,
426,
1643,
29889,
978,
363,
3858,
297,
544,
29889,
21134,
29913,
13,
9651,
1583,
29889,
9933,
353,
544,
29889,
3859,
1275,
376,
3150,
29908,
322,
451,
544,
29889,
275,
29918,
1050,
3192,
580,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
285,
29908,
10593,
29898,
333,
3790,
1311,
29889,
333,
1118,
4864,
3790,
1311,
29889,
9933,
1800,
29908,
13,
2
] |
tests/utils/frameworks/tensorflow_utils.py | matheusMoreno/BentoML | 0 | 195963 | import re
import string
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
def custom_activation(x):
return tf.nn.tanh(x) ** 2
class CustomLayer(keras.layers.Layer):
def __init__(self, units=32, **kwargs):
super(CustomLayer, self).__init__(**kwargs)
self.units = tf.Variable(units, name="units")
def call(self, inputs, training=False):
if training:
return inputs * self.units
else:
return inputs
def get_config(self):
config = super(CustomLayer, self).get_config()
config.update({"units": self.units.numpy()})
return config
def KerasSequentialModel() -> keras.models.Model:
net = keras.models.Sequential(
(
keras.layers.Dense(
units=1,
input_shape=(5,),
use_bias=False,
kernel_initializer=keras.initializers.Ones(),
),
)
)
opt = keras.optimizers.Adam(0.002, 0.5)
net.compile(optimizer=opt, loss="binary_crossentropy", metrics=["accuracy"])
return net
def KerasNLPModel() -> keras.models.Model:
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
def custom_standardization(input_data: str) -> tf.Tensor:
lowercase = tf.strings.lower(input_data)
stripped_html = tf.strings.regex_replace(lowercase, "<br />", " ")
return tf.strings.regex_replace(
stripped_html, "[%s]" % re.escape(string.punctuation), ""
)
max_features = 20000
embedding_dims = 50
vectorize_layer = TextVectorization(
standardize=custom_standardization,
max_tokens=max_features,
output_mode="int",
output_sequence_length=400,
)
# A text input with preprocessing layers
text_input = keras.Input(shape=(1,), dtype=tf.string, name="text")
x = vectorize_layer(text_input)
x = keras.layers.Embedding(max_features + 1, embedding_dims)(x)
x = keras.layers.Dropout(0.2)(x)
# Conv1D + global max pooling
x = keras.layers.Conv1D(128, 7, padding="valid", activation="relu", strides=1)(x)
x = keras.layers.GlobalMaxPooling1D()(x)
# We add a vanilla hidden layer:
x = keras.layers.Dense(128, activation="relu")(x)
x = keras.layers.Dropout(0.2)(x)
# We project onto a single unit output layer, and squash it with a sigmoid:
predictions = keras.layers.Dense(1, activation="sigmoid", name="predictions")(x)
model = keras.Model(text_input, predictions)
model.compile(loss="binary_crossentropy", optimizer="adam", metrics=["accuracy"])
return model
class NativeModel(tf.Module):
def __init__(self):
super().__init__()
self.weights = np.asfarray([[1.0], [1.0], [1.0], [1.0], [1.0]])
self.dense = lambda inputs: tf.matmul(inputs, self.weights)
@tf.function(
input_signature=[tf.TensorSpec(shape=[1, 5], dtype=tf.float64, name="inputs")]
)
def __call__(self, inputs):
return self.dense(inputs)
class NativeRaggedModel(NativeModel):
@tf.function(
input_signature=[
tf.RaggedTensorSpec(tf.TensorShape([None, None]), tf.float64, 1, tf.int64)
]
)
def __call__(self, inputs):
inputs = inputs.to_tensor(shape=[None, 5], default_value=0)
return self.dense(inputs)
class MultiInputModel(tf.Module):
def __init__(self):
super().__init__()
self.weights = np.asfarray([[1.0], [1.0], [1.0], [1.0], [1.0]])
self.dense = lambda tensor: tf.matmul(tensor, self.weights)
@tf.function(
input_signature=[
tf.TensorSpec(shape=[1, 5], dtype=tf.float64, name="x1"),
tf.TensorSpec(shape=[1, 5], dtype=tf.float64, name="x2"),
tf.TensorSpec(shape=(), dtype=tf.float64, name="factor"),
]
)
def __call__(self, x1: tf.Tensor, x2: tf.Tensor, factor: tf.Tensor):
return self.dense(x1 + x2 * factor)
| [
1,
1053,
337,
13,
5215,
1347,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
26110,
408,
15886,
13,
5215,
26110,
29889,
3946,
294,
408,
13023,
294,
13,
13,
13,
1753,
2888,
29918,
11236,
362,
29898,
29916,
1125,
13,
1678,
736,
15886,
29889,
15755,
29889,
13161,
29882,
29898,
29916,
29897,
3579,
29871,
29906,
13,
13,
13,
1990,
8701,
14420,
29898,
3946,
294,
29889,
29277,
29889,
14420,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
10340,
29922,
29941,
29906,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
7281,
14420,
29892,
1583,
467,
1649,
2344,
12035,
1068,
19290,
29897,
13,
4706,
1583,
29889,
348,
1169,
353,
15886,
29889,
16174,
29898,
348,
1169,
29892,
1024,
543,
348,
1169,
1159,
13,
13,
1678,
822,
1246,
29898,
1311,
29892,
10970,
29892,
6694,
29922,
8824,
1125,
13,
4706,
565,
6694,
29901,
13,
9651,
736,
10970,
334,
1583,
29889,
348,
1169,
13,
4706,
1683,
29901,
13,
9651,
736,
10970,
13,
13,
1678,
822,
679,
29918,
2917,
29898,
1311,
1125,
13,
4706,
2295,
353,
2428,
29898,
7281,
14420,
29892,
1583,
467,
657,
29918,
2917,
580,
13,
4706,
2295,
29889,
5504,
3319,
29908,
348,
1169,
1115,
1583,
29889,
348,
1169,
29889,
23749,
580,
1800,
13,
4706,
736,
2295,
13,
13,
13,
1753,
12693,
294,
16941,
2556,
3195,
580,
1599,
13023,
294,
29889,
9794,
29889,
3195,
29901,
13,
1678,
7787,
353,
13023,
294,
29889,
9794,
29889,
16941,
2556,
29898,
13,
4706,
313,
13,
9651,
13023,
294,
29889,
29277,
29889,
29928,
1947,
29898,
13,
18884,
10340,
29922,
29896,
29892,
13,
18884,
1881,
29918,
12181,
7607,
29945,
29892,
511,
13,
18884,
671,
29918,
29890,
3173,
29922,
8824,
29892,
13,
18884,
8466,
29918,
11228,
3950,
29922,
3946,
294,
29889,
11228,
19427,
29889,
2951,
267,
3285,
13,
9651,
10353,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
3523,
353,
13023,
294,
29889,
20640,
19427,
29889,
3253,
314,
29898,
29900,
29889,
29900,
29900,
29906,
29892,
29871,
29900,
29889,
29945,
29897,
13,
1678,
7787,
29889,
12198,
29898,
20640,
3950,
29922,
3670,
29892,
6410,
543,
19541,
29918,
19128,
296,
14441,
613,
21556,
29922,
3366,
562,
2764,
4135,
20068,
13,
1678,
736,
7787,
13,
13,
13,
1753,
12693,
294,
29940,
13208,
3195,
580,
1599,
13023,
294,
29889,
9794,
29889,
3195,
29901,
13,
1678,
515,
26110,
29889,
3946,
294,
29889,
29277,
29889,
735,
27910,
29889,
1457,
19170,
1053,
3992,
12877,
2133,
13,
13,
1678,
822,
2888,
29918,
15770,
2133,
29898,
2080,
29918,
1272,
29901,
851,
29897,
1599,
15886,
29889,
29911,
6073,
29901,
13,
4706,
5224,
4878,
353,
15886,
29889,
19651,
29889,
13609,
29898,
2080,
29918,
1272,
29897,
13,
4706,
10076,
2986,
29918,
1420,
353,
15886,
29889,
19651,
29889,
13087,
29918,
6506,
29898,
13609,
4878,
29892,
9872,
1182,
2900,
613,
376,
16521,
13,
4706,
736,
15886,
29889,
19651,
29889,
13087,
29918,
6506,
29898,
13,
9651,
10076,
2986,
29918,
1420,
29892,
14704,
29995,
29879,
18017,
1273,
337,
29889,
21587,
29898,
1807,
29889,
29886,
18049,
29884,
362,
511,
5124,
13,
4706,
1723,
13,
13,
1678,
4236,
29918,
22100,
353,
29871,
29906,
29900,
29900,
29900,
29900,
13,
1678,
23655,
29918,
6229,
29879,
353,
29871,
29945,
29900,
13,
13,
1678,
4608,
675,
29918,
13148,
353,
3992,
12877,
2133,
29898,
13,
4706,
3918,
675,
29922,
6341,
29918,
15770,
2133,
29892,
13,
4706,
4236,
29918,
517,
12360,
29922,
3317,
29918,
22100,
29892,
13,
4706,
1962,
29918,
8513,
543,
524,
613,
13,
4706,
1962,
29918,
16506,
29918,
2848,
29922,
29946,
29900,
29900,
29892,
13,
1678,
1723,
13,
13,
1678,
396,
319,
1426,
1881,
411,
758,
19170,
15359,
13,
1678,
1426,
29918,
2080,
353,
13023,
294,
29889,
4290,
29898,
12181,
7607,
29896,
29892,
511,
26688,
29922,
13264,
29889,
1807,
29892,
1024,
543,
726,
1159,
13,
1678,
921,
353,
4608,
675,
29918,
13148,
29898,
726,
29918,
2080,
29897,
13,
1678,
921,
353,
13023,
294,
29889,
29277,
29889,
6026,
2580,
8497,
29898,
3317,
29918,
22100,
718,
29871,
29896,
29892,
23655,
29918,
6229,
29879,
5033,
29916,
29897,
13,
1678,
921,
353,
13023,
294,
29889,
29277,
29889,
15063,
449,
29898,
29900,
29889,
29906,
5033,
29916,
29897,
13,
13,
1678,
396,
1281,
29894,
29896,
29928,
718,
5534,
4236,
11565,
292,
13,
1678,
921,
353,
13023,
294,
29889,
29277,
29889,
1168,
29894,
29896,
29928,
29898,
29896,
29906,
29947,
29892,
29871,
29955,
29892,
7164,
543,
3084,
613,
26229,
543,
2674,
29884,
613,
851,
2247,
29922,
29896,
5033,
29916,
29897,
13,
1678,
921,
353,
13023,
294,
29889,
29277,
29889,
12756,
7976,
11426,
292,
29896,
29928,
580,
29898,
29916,
29897,
13,
13,
1678,
396,
1334,
788,
263,
1109,
2911,
7934,
7546,
29901,
13,
1678,
921,
353,
13023,
294,
29889,
29277,
29889,
29928,
1947,
29898,
29896,
29906,
29947,
29892,
26229,
543,
2674,
29884,
1159,
29898,
29916,
29897,
13,
1678,
921,
353,
13023,
294,
29889,
29277,
29889,
15063,
449,
29898,
29900,
29889,
29906,
5033,
29916,
29897,
13,
13,
1678,
396,
1334,
2060,
11480,
263,
2323,
5190,
1962,
7546,
29892,
322,
10674,
1161,
372,
411,
263,
4365,
29885,
3398,
29901,
13,
1678,
27303,
353,
13023,
294,
29889,
29277,
29889,
29928,
1947,
29898,
29896,
29892,
26229,
543,
18816,
29885,
3398,
613,
1024,
543,
27711,
1080,
1159,
29898,
29916,
29897,
13,
13,
1678,
1904,
353,
13023,
294,
29889,
3195,
29898,
726,
29918,
2080,
29892,
27303,
29897,
13,
1678,
1904,
29889,
12198,
29898,
6758,
543,
19541,
29918,
19128,
296,
14441,
613,
5994,
3950,
543,
328,
314,
613,
21556,
29922,
3366,
562,
2764,
4135,
20068,
13,
1678,
736,
1904,
13,
13,
13,
1990,
19042,
3195,
29898,
13264,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
705,
5861,
353,
7442,
29889,
294,
29888,
2378,
4197,
29961,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
24960,
13,
4706,
1583,
29889,
1145,
344,
353,
14013,
10970,
29901,
15886,
29889,
2922,
16109,
29898,
2080,
29879,
29892,
1583,
29889,
705,
5861,
29897,
13,
13,
1678,
732,
13264,
29889,
2220,
29898,
13,
4706,
1881,
29918,
4530,
1535,
11759,
13264,
29889,
29911,
6073,
10299,
29898,
12181,
11759,
29896,
29892,
29871,
29945,
1402,
26688,
29922,
13264,
29889,
7411,
29953,
29946,
29892,
1024,
543,
2080,
29879,
13531,
13,
1678,
1723,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
10970,
1125,
13,
4706,
736,
1583,
29889,
1145,
344,
29898,
2080,
29879,
29897,
13,
13,
13,
1990,
19042,
29934,
351,
3192,
3195,
29898,
11024,
3195,
1125,
13,
1678,
732,
13264,
29889,
2220,
29898,
13,
4706,
1881,
29918,
4530,
1535,
11759,
13,
9651,
15886,
29889,
29934,
351,
3192,
29911,
6073,
10299,
29898,
13264,
29889,
29911,
6073,
24111,
4197,
8516,
29892,
6213,
11724,
15886,
29889,
7411,
29953,
29946,
29892,
29871,
29896,
29892,
15886,
29889,
524,
29953,
29946,
29897,
13,
4706,
4514,
13,
1678,
1723,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
10970,
1125,
13,
4706,
10970,
353,
10970,
29889,
517,
29918,
20158,
29898,
12181,
11759,
8516,
29892,
29871,
29945,
1402,
2322,
29918,
1767,
29922,
29900,
29897,
13,
4706,
736,
1583,
29889,
1145,
344,
29898,
2080,
29879,
29897,
13,
13,
13,
1990,
14974,
4290,
3195,
29898,
13264,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
705,
5861,
353,
7442,
29889,
294,
29888,
2378,
4197,
29961,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
24960,
13,
4706,
1583,
29889,
1145,
344,
353,
14013,
12489,
29901,
15886,
29889,
2922,
16109,
29898,
20158,
29892,
1583,
29889,
705,
5861,
29897,
13,
13,
1678,
732,
13264,
29889,
2220,
29898,
13,
4706,
1881,
29918,
4530,
1535,
11759,
13,
9651,
15886,
29889,
29911,
6073,
10299,
29898,
12181,
11759,
29896,
29892,
29871,
29945,
1402,
26688,
29922,
13264,
29889,
7411,
29953,
29946,
29892,
1024,
543,
29916,
29896,
4968,
13,
9651,
15886,
29889,
29911,
6073,
10299,
29898,
12181,
11759,
29896,
29892,
29871,
29945,
1402,
26688,
29922,
13264,
29889,
7411,
29953,
29946,
29892,
1024,
543,
29916,
29906,
4968,
13,
9651,
15886,
29889,
29911,
6073,
10299,
29898,
12181,
29922,
3285,
26688,
29922,
13264,
29889,
7411,
29953,
29946,
29892,
1024,
543,
19790,
4968,
13,
4706,
4514,
13,
1678,
1723,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
921,
29896,
29901,
15886,
29889,
29911,
6073,
29892,
921,
29906,
29901,
15886,
29889,
29911,
6073,
29892,
7329,
29901,
15886,
29889,
29911,
6073,
1125,
13,
4706,
736,
1583,
29889,
1145,
344,
29898,
29916,
29896,
718,
921,
29906,
334,
7329,
29897,
13,
2
] |
pixelpuncher/player/migrations/0020_auto_20160604_1602.py | ej2/pixelpuncher | 0 | 55356 | <reponame>ej2/pixelpuncher
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-06-04 16:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('player', '0019_avatarlayer_playeravatar'),
]
operations = [
migrations.AlterField(
model_name='avatarlayer',
name='unlock_method',
field=models.CharField(choices=[(b'start', b'Starter'), (b'discvr', b'Discover'), (b'purcha', b'Purchase'), (b'secret', b'Secret')], default=b'discov', max_length=6),
),
migrations.AlterField(
model_name='playeravatar',
name='layer',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='+', to='player.AvatarLayer'),
),
migrations.AlterField(
model_name='playeravatar',
name='player',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='layers', to='player.Player'),
),
]
| [
1,
529,
276,
1112,
420,
29958,
10337,
29906,
29914,
29886,
15711,
29886,
3322,
261,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
3251,
630,
491,
15337,
29871,
29896,
29889,
29929,
373,
29871,
29906,
29900,
29896,
29953,
29899,
29900,
29953,
29899,
29900,
29946,
29871,
29896,
29953,
29901,
29900,
29906,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
9106,
742,
525,
29900,
29900,
29896,
29929,
29918,
485,
14873,
13148,
29918,
9106,
485,
14873,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
485,
14873,
13148,
742,
13,
9651,
1024,
2433,
348,
908,
29918,
5696,
742,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
1859,
1575,
11759,
29898,
29890,
29915,
2962,
742,
289,
29915,
855,
4254,
5477,
313,
29890,
29915,
2218,
11023,
29878,
742,
289,
29915,
4205,
11911,
5477,
313,
29890,
29915,
29886,
2458,
29874,
742,
289,
29915,
29925,
27574,
5477,
313,
29890,
29915,
19024,
742,
289,
29915,
28459,
1495,
1402,
2322,
29922,
29890,
29915,
2218,
24542,
742,
4236,
29918,
2848,
29922,
29953,
511,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
9106,
485,
14873,
742,
13,
9651,
1024,
2433,
13148,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
4475,
29918,
978,
2433,
29974,
742,
304,
2433,
9106,
29889,
29909,
9046,
279,
14420,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
9106,
485,
14873,
742,
13,
9651,
1024,
2433,
9106,
742,
13,
9651,
1746,
29922,
9794,
29889,
27755,
2558,
29898,
265,
29918,
8143,
29922,
14095,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
29889,
29907,
3289,
5454,
2287,
29892,
4475,
29918,
978,
2433,
29277,
742,
304,
2433,
9106,
29889,
9075,
5477,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
conpaas-services/scripts/manager/notify_git_push.py | bopopescu/conpaas-2 | 5 | 132476 | <filename>conpaas-services/scripts/manager/notify_git_push.py
#!/usr/bin/env python
import simplejson
from conpaas.core.https import client
def main():
client.conpaas_init_ssl_ctx('/etc/cpsmanager/certs', 'user')
method = 'git_push_hook'
manager_ip = '127.0.0.1'
res = client.jsonrpc_post(manager_ip, 443, '/', method)
if res[0] == 200:
try:
data = simplejson.loads(res[1])
except simplejson.decoder.JSONDecodeError:
# Not JSON, simply return what we got
return res[1]
return data.get('result', data)
raise Exception("Call to method %s on %s failed with HTTP code %s: %s."
% (method, manager_ip, res[0], res[1]))
if __name__ == "__main__":
res = main()
print "%s" % res
| [
1,
529,
9507,
29958,
535,
3274,
294,
29899,
9916,
29914,
16713,
29914,
12847,
29914,
25140,
29918,
5559,
29918,
5910,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
2560,
3126,
13,
13,
3166,
378,
3274,
294,
29889,
3221,
29889,
991,
1053,
3132,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
3132,
29889,
535,
3274,
294,
29918,
2344,
29918,
16265,
29918,
13073,
11219,
7070,
29914,
29883,
567,
12847,
29914,
6327,
29879,
742,
525,
1792,
1495,
13,
1678,
1158,
353,
525,
5559,
29918,
5910,
29918,
20849,
29915,
13,
1678,
8455,
29918,
666,
353,
525,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29915,
13,
1678,
620,
353,
3132,
29889,
3126,
29878,
6739,
29918,
2490,
29898,
12847,
29918,
666,
29892,
29871,
29946,
29946,
29941,
29892,
8207,
742,
1158,
29897,
13,
13,
1678,
565,
620,
29961,
29900,
29962,
1275,
29871,
29906,
29900,
29900,
29901,
13,
4706,
1018,
29901,
13,
9651,
848,
353,
2560,
3126,
29889,
18132,
29898,
690,
29961,
29896,
2314,
13,
4706,
5174,
2560,
3126,
29889,
7099,
6119,
29889,
7249,
2772,
401,
2392,
29901,
13,
9651,
396,
2216,
4663,
29892,
3763,
736,
825,
591,
2355,
13,
9651,
736,
620,
29961,
29896,
29962,
13,
13,
4706,
736,
848,
29889,
657,
877,
2914,
742,
848,
29897,
13,
13,
1678,
12020,
8960,
703,
5594,
304,
1158,
1273,
29879,
373,
1273,
29879,
5229,
411,
7331,
775,
1273,
29879,
29901,
1273,
29879,
1213,
13,
462,
1678,
1273,
313,
5696,
29892,
8455,
29918,
666,
29892,
620,
29961,
29900,
1402,
620,
29961,
29896,
12622,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
620,
353,
1667,
580,
13,
1678,
1596,
11860,
29879,
29908,
1273,
620,
13,
2
] |
src/pyon/container/test/test_procs.py | scionrep/scioncc_new | 2 | 164856 | <gh_stars>1-10
#!/usr/bin/env python
__author__ = '<NAME>'
from unittest import SkipTest
from mock import Mock, patch, ANY, sentinel, call
from nose.plugins.attrib import attr
from gevent.event import AsyncResult, Event
import gevent
from ion.agent.agent import ResourceAgent
from pyon.container.procs import ProcManager
from pyon.core.exception import BadRequest, NotFound
from pyon.ion.endpoint import ProcessRPCServer
from pyon.ion.process import IonProcessError
from pyon.net.transport import NameTrio, TransportError
from pyon.public import PRED, CCAP, IonObject
from pyon.ion.service import BaseService
from pyon.util.int_test import IonIntegrationTestCase
from pyon.util.unit_test import PyonTestCase
from interface.objects import ProcessStateEnum
class FakeContainer(object):
def __init__(self):
self.id = "containerid"
self.node = None
self.name = "containername"
self.CCAP = CCAP
def has_capability(self, cap):
return True
class SampleProcess(BaseService):
name = 'sample'
dependencies = []
def call_process(self, *args, **kwargs):
pass
class BadProcess(BaseService):
name = 'bad'
dependencies = []
def on_quit(self):
bad = 3 / 0 # boom
return bad
def sleep_target(self, *args, **kwargs):
self.sleep_event = Event()
gevent.sleep(0.2)
self.sleep_event.set()
def fail_target(self, *args, **kwargs):
raise Exception("Blow up to test failure chain")
class SampleAgent(ResourceAgent):
dependencies = []
class TestRPCServer(ProcessRPCServer):
pass
@attr('UNIT')
class TestProcManager(PyonTestCase):
def setUp(self):
self.container = Mock()
self.pm = ProcManager(self.container)
self.container.resource_registry.create.return_value = (sentinel.rid, sentinel.rev)
self.container.resource_registry.find_resources.return_value = ([sentinel.oid], [sentinel.orev])
def test_start(self):
self.pm.start()
self.assertEquals(self.pm.cc_id, sentinel.rid)
def test_start_with_org(self):
self.patch_cfg('pyon.container.procs.CFG', {'container':{'org_name':'NOT_DEFAULT'}})
self.pm.start()
self.container.resource_registry.create_association.assert_called_once_with(sentinel.oid, PRED.hasResource, sentinel.rid)
@patch('pyon.container.procs.log')
def test_stop_with_error(self, mocklog):
self.pm.start()
self.pm.terminate_process = Mock(side_effect=BadRequest)
procmock = Mock()
procmock._proc_start_time = 0
procmock.id = sentinel.pid
self.pm.procs[sentinel.pid] = procmock
self.pm.procs_by_name['dummy'] = procmock
self.pm.stop()
self.pm.terminate_process.assert_called_once_with(sentinel.pid)
mocklog.warn.assert_has_calls([call("Failed to terminate process (%s): %s", sentinel.pid, ANY),
call("ProcManager procs not empty: %s", self.pm.procs),
call("ProcManager procs_by_name not empty: %s", self.pm.procs_by_name)])
def test_list_local_processes(self):
pmock = Mock()
pmock.process_type = sentinel.ptype
pmock2 = Mock()
pmock2.process_type = sentinel.ptype2
self.pm.procs = {'one':pmock,
'two':pmock2,
'three':pmock}
self.assertEquals(self.pm.list_local_processes(),
[pmock, pmock2, pmock])
def test_list_local_processes_proc_type_filter(self):
pmock = Mock()
pmock.process_type = sentinel.ptype
pmock2 = Mock()
pmock2.process_type = sentinel.ptype2
self.pm.procs = {'one':pmock,
'two':pmock2,
'three':pmock}
self.assertEquals(self.pm.list_local_processes(sentinel.ptype2),
[pmock2])
def test_get_a_local_process(self):
pmock = Mock()
pmock.name = sentinel.name
pmock2 = Mock()
pmock2.name = sentinel.name2
self.pm.procs = {'one':pmock,
'two':pmock2}
self.assertEquals(self.pm.get_a_local_process(sentinel.name2),
pmock2)
def test_get_a_local_process_for_agent_res_id(self):
pmock = Mock()
pmock.process_type = 'agent'
pmock.resource_type = sentinel.rtype
pmock2 = Mock()
pmock2.process_type = 'agent'
pmock2.resource_type = sentinel.rtype2
self.pm.procs = {'one':pmock,
'two':pmock2}
self.assertEquals(self.pm.get_a_local_process(sentinel.rtype2),
pmock2)
def test_get_a_local_process_no_match(self):
self.assertIsNone(self.pm.get_a_local_process())
def test_is_local_service_process(self):
pmock = Mock()
pmock.name = sentinel.name
pmock.process_type = 'simple'
pmock2 = Mock()
pmock2.name = sentinel.name2
pmock2.process_type = 'service'
pmock3 = Mock()
pmock3.name = sentinel.name3
pmock3.process_type = 'service'
self.pm.procs = {'one':pmock,
'two':pmock2,
'three':pmock3}
self.assertTrue(self.pm.is_local_service_process(sentinel.name3))
def test_is_local_service_process_name_matches_but_type_doesnt(self):
pmock = Mock()
pmock.name = sentinel.name
pmock.process_type = 'simple'
pmock2 = Mock()
pmock2.name = sentinel.name2
pmock2.process_type = 'notservice'
pmock3 = Mock()
pmock3.name = sentinel.name3
pmock3.process_type = 'notservice'
self.pm.procs = {'one':pmock,
'two':pmock2,
'three':pmock3}
self.assertFalse(self.pm.is_local_service_process(sentinel.name3))
def test_is_local_agent_process(self):
# agent is similar to above, but checks resource_type instead
pmock = Mock()
pmock.name = sentinel.name
pmock.process_type = 'simple'
pmock2 = Mock()
pmock2.resource_type = sentinel.name2
pmock2.process_type = 'agent'
pmock3 = Mock()
pmock3.name = sentinel.name3
pmock3.process_type = 'notservice'
self.pm.procs = {'one':pmock,
'two':pmock2,
'three':pmock3}
self.assertTrue(self.pm.is_local_agent_process(sentinel.name2))
def test_is_local_agent_process_not_found(self):
self.assertFalse(self.pm.is_local_agent_process(sentinel.one))
def test__unregister_process_errors(self):
pmock = Mock()
pmock._proc_name = '1'
pmock._proc_type = 'service'
pmock._proc_res_id = sentinel.presid
pmock._proc_svc_id = sentinel.psvcid
self.container.resource_registry.delete.side_effect = NotFound
self.pm.procs[sentinel.pid] = pmock
self.pm.procs_by_name['1'] = pmock
self.container.resource_registry.find_objects.reset_mock()
self.container.resource_registry.find_objects.side_effect = None
self.container.resource_registry.find_objects.return_value = ([],[])
self.pm._unregister_process(sentinel.pid, pmock)
# show we tried to interact with the RR
self.container.resource_registry.delete.assert_call(sentinel.presid, del_associations=True)
self.container.resource_registry.find_objects.assert_called_once_with(sentinel.psvcid, "hasProcess", "Process", id_only=True)
self.assertEquals(self.pm.procs, {})
self.assertEquals(self.pm.procs_by_name, {})
# NEXT: find_objects works fine and gives us an error deletion
self.container.resource_registry.delete.reset_mock()
self.container.resource_registry.find_objects.reset_mock()
self.container.resource_registry.find_objects.side_effect = None
self.container.resource_registry.find_objects.return_value = ([sentinel.svcid],[None])
self.pm.procs[sentinel.pid] = pmock
self.pm.procs_by_name['1'] = pmock
self.pm._unregister_process(sentinel.pid, pmock)
self.container.resource_registry.delete.assert_calls([call(sentinel.presid, del_associations=True),
call(sentinel.psvcid, del_associations=True)])
# NEXT: agent
pmock = Mock()
pmock.id = sentinel.pid
pmock._proc_name = '1'
pmock._proc_type = 'agent'
self.pm.procs[sentinel.pid] = pmock
self.pm.procs_by_name['1'] = pmock
self.pm._unregister_process(sentinel.pid, pmock)
self.container.directory.unregister_safe.assert_called_once_with("/Agents", sentinel.pid)
def test__create_listening_endpoint_with_cfg(self):
self.patch_cfg('pyon.container.procs.CFG', container=dict(messaging=dict(endpoint=dict(proc_listening_type='pyon.container.test.test_procs.TestRPCServer'))))
ep = self.pm._create_listening_endpoint(process=sentinel.process)
self.assertIsInstance(ep, TestRPCServer)
def test__create_listening_endpoint_without_cfg_and_no_conv(self):
self.patch_cfg('pyon.container.procs.CFG', container=dict(messaging=dict(endpoint=dict(proc_listening_type=None))))
ep = self.pm._create_listening_endpoint(process=sentinel.process)
self.assertIsInstance(ep, ProcessRPCServer)
def test_failed_process(self):
self.pm.start()
self.container.fail_fast = Mock()
self.pm.procs['pid1'] = Mock()
proc2 = BadProcess()
self.pm.proc_sup.spawn(name="bad", service=proc2, target=proc2.fail_target)
gevent.sleep(0) # Allow the new thread to fail and trigger the chain
self.assertFalse(self.container.fail_fast.called)
del self.pm.procs['pid1']
proc3 = BadProcess()
self.pm.proc_sup.spawn(name="bad", service=proc3, target=proc3.fail_target)
gevent.sleep(0) # Allow the new thread to fail and trigger the chain
self.assertTrue(self.container.fail_fast.called)
@attr('INT')
class TestProcManagerInt(IonIntegrationTestCase):
class ExpectedFailure(Exception):
pass
def test_proc_fails(self):
raise SkipTest("Fails with gevent 1.0, leaves bad container. Investigate")
self._start_container()
pm = self.container.proc_manager
ar = AsyncResult()
def failedhandler(proc, state, container):
if state == ProcessStateEnum.FAILED:
ar.set()
pm.add_proc_state_changed_callback(failedhandler)
pid = self._spawnproc(pm, 'service')
# cause a failure
pm.procs[pid]._process._ctrl_thread.proc.kill(exception=self.ExpectedFailure, block=False)
# wait for proc state changed notification
ar.get(timeout=5)
# make sure removed
self.assertNotIn(pid, pm.procs)
def test_procmanager_iso(self):
fakecc = FakeContainer()
fakecc.resource_registry = Mock()
fakecc.resource_registry.create.return_value=["ID","rev"]
fakecc.start_time = Mock()
fakecc.version = Mock()
pm = ProcManager(fakecc)
self.assertTrue(hasattr(fakecc, "spawn_process"))
pm.start()
pm.stop()
def test_procmanager(self):
self._start_container()
pm = self.container.proc_manager
pid1 = self._spawnproc(pm, 'service')
pid2 = self._spawnproc(pm, 'stream_process')
pid3 = self._spawnproc(pm, 'agent', 'SampleAgent')
pid4 = self._spawnproc(pm, 'standalone')
pid5 = self._spawnproc(pm, 'simple')
pid6 = self._spawnproc(pm, 'immediate')
with self.assertRaises(Exception) as ex:
config = {'process':{'type':'unknown_type'}}
pid = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
self.assertEqual(ex.exception, 'Unknown process type: BAMM')
self.assertEquals(len(pm.procs), 5) # service, stream_proc, (no agent), standalone, simple. NO IMMEDIATE
pm.terminate_process(pid1)
pm.terminate_process(pid2)
pm.terminate_process(pid3)
pm.terminate_process(pid4)
pm.terminate_process(pid5)
self.assertEquals(len(pm.procs), 0)
def _spawnproc(self, pm, ptype, pcls=None):
pcls = pcls or 'SampleProcess'
config = {'process':{'type':ptype}}
pid = pm.spawn_process('sample1', 'pyon.container.test.test_procs', pcls, config)
self.assertTrue(pid)
return pid
def test_proc_org(self):
self._start_container()
pm = self.container.proc_manager
config = {'process':{'type':'standalone'}}
pid1 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
self.assertTrue(pid1)
config = {'process':{'type':'standalone'}, 'org_governance_name': 'Org2'}
pid2 = pm.spawn_process('sample2', 'pyon.container.test.test_procs', 'SampleProcess', config)
self.assertTrue(pid2)
proc = pm.procs_by_name['sample1']
self.assertEqual(proc.org_governance_name,'ION')
proc = pm.procs_by_name['sample2']
self.assertEqual(proc.org_governance_name,'Org2')
def test_procmanager_shutdown(self):
self.test_procmanager()
pm = self.container.proc_manager
pm.stop()
self.assertEquals(len(pm.procs), 0)
def test_procmanager_badquit_shutdown(self):
self._start_container()
pm = self.container.proc_manager
pid = pm.spawn_process('badprocess', 'pyon.container.test.test_procs', 'BadProcess', {'process':{'type':'service'}})
with patch('pyon.ion.service.log') as m:
pm.stop()
self.assertEquals(len(pm.procs), 0)
self.assertEquals(m.exception.call_count, 1)
def test_immediate_terminate(self):
self._start_container()
self._spawnproc(self.container.proc_manager, 'immediate')
self.assertEquals(len(self.container.proc_manager.procs), 0)
def test_terminate_process(self):
self._start_container()
pid = self._spawnproc(self.container.proc_manager, 'service')
self.container.terminate_process(pid)
self.assertEquals(len(self.container.proc_manager.procs), 0)
# now try to terminate it again, it shouldn't exist
self.assertRaises(BadRequest, self.container.terminate_process, pid)
def test_proc_state_change_callback(self):
self._start_container()
m = Mock()
pm = self.container.proc_manager
pm.add_proc_state_changed_callback(m)
pid = self._spawnproc(pm, 'service')
m.assert_called_with(ANY, ProcessStateEnum.RUNNING, self.container)
self.assertIsInstance(m.call_args[0][0], SampleProcess)
self.container.terminate_process(pid)
m.assert_called_with(ANY, ProcessStateEnum.TERMINATED, self.container)
self.assertIsInstance(m.call_args[0][0], SampleProcess)
pm.remove_proc_state_changed_callback(m)
cur_call_count = m.call_count
pid = self._spawnproc(pm, 'service')
self.assertEquals(m.call_count, cur_call_count) # should not have been touched
self.container.terminate_process(pid)
self.assertEquals(m.call_count, cur_call_count) # should not have been touched
def test_create_listening_endpoint(self):
self.patch_cfg('pyon.container.procs.CFG', {'container':{'messaging':{'endpoint':{'proc_listening_type':'pyon.container.test.test_procs.TestRPCServer'}}}})
fakecc = FakeContainer()
fakecc.resource_registry = Mock()
fakecc.resource_registry.create.return_value=["ID","rev"]
with patch('pyon.container.procs.ProcManager._get_execution_engine_config', Mock(return_value={})):
pm = ProcManager(fakecc)
pm._get_execution_engine_config = Mock()
ep = pm._create_listening_endpoint(node=sentinel.node,
service=sentinel.service,
process=sentinel.process)
self.assertIsInstance(ep, TestRPCServer)
def test_error_on_start_listeners_of_proc(self):
self._start_container()
m = Mock()
pm = self.container.proc_manager
pm.add_proc_state_changed_callback(m)
with patch('pyon.ion.process.IonProcessThread.start_listeners', Mock(side_effect=IonProcessError)):
pid = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', {'process':{'type':'service'}})
self.assertIsNone(pid)
pid = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', {'process':{'type':'stream_process'}})
self.assertIsNone(pid)
pid = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', {'process':{'type':'standalone'}})
self.assertIsNone(pid)
m.assert_calls([call(ANY, ProcessStateEnum.FAILED),
call(ANY, ProcessStateEnum.FAILED),
call(ANY, ProcessStateEnum.FAILED)])
def test_process_config_reg(self):
self._start_container()
pm = self.container.proc_manager
# Test OK case
res_config = {'special':{'more':'exists'}}
res_obj = IonObject("AgentInstance", driver_config=res_config)
res_id, _ = self.container.resource_registry.create(res_obj)
config_ref = "resources:%s/driver_config" % res_id
config = {'process':{'config_ref':config_ref}}
pid1 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
self.assertTrue(pid1)
proc = pm.procs_by_name['sample1']
self.assertTrue(proc)
self.assertIn('special', proc.CFG)
self.assertTrue(proc.CFG.get_safe("special.more"), 'exists')
pm.terminate_process(pid1)
# Test failure cases
config_ref = "XXXXX:%s/driver_config" % res_id
config = {'process':{'config_ref':config_ref}}
with self.assertRaises(BadRequest) as ex:
pid2 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
config_ref = "resources:badbadbad/driver_config"
config = {'process':{'config_ref':config_ref}}
with self.assertRaises(NotFound) as ex:
pid3 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
config_ref = "resources:%s/not_existing" % res_id
config = {'process':{'config_ref':config_ref}}
with self.assertRaises(BadRequest) as ex:
pid4 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
config_ref = "resources:%s/name" % res_id
config = {'process':{'config_ref':config_ref}}
with self.assertRaises(BadRequest) as ex:
pid4 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
# Test for objects method
obj_id = "test_" + res_id
self.container.object_store.create_doc(res_config, object_id=obj_id)
obj2 = self.container.object_store.read_doc(obj_id)
self.assertEquals(obj2, res_config)
config_ref = "objects:%s/" % obj_id
config = {'process':{'config_ref':config_ref}}
pid1 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
self.assertTrue(pid1)
proc = pm.procs_by_name['sample1']
self.assertTrue(proc)
self.assertIn('special', proc.CFG)
self.assertTrue(proc.CFG.get_safe("special.more"), 'exists')
pm.terminate_process(pid1)
config_ref = "objects:%s/special" % obj_id
config = {'process':{'config_ref':config_ref}}
pid1 = pm.spawn_process('sample1', 'pyon.container.test.test_procs', 'SampleProcess', config)
self.assertTrue(pid1)
proc = pm.procs_by_name['sample1']
self.assertTrue(proc)
self.assertIn('more', proc.CFG)
self.assertTrue(proc.CFG.more, 'exists')
pm.terminate_process(pid1)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
1649,
8921,
1649,
353,
12801,
5813,
16299,
13,
13,
3166,
443,
27958,
1053,
4971,
666,
3057,
13,
3166,
11187,
1053,
26297,
29892,
13261,
29892,
13764,
29979,
29892,
2665,
262,
295,
29892,
1246,
13,
3166,
26414,
29889,
12800,
29889,
1131,
1091,
1053,
12421,
13,
3166,
1737,
794,
29889,
3696,
1053,
20688,
3591,
29892,
6864,
13,
5215,
1737,
794,
13,
13,
3166,
16346,
29889,
14748,
29889,
14748,
1053,
18981,
19661,
13,
3166,
11451,
265,
29889,
7611,
29889,
771,
2395,
1053,
1019,
29883,
3260,
13,
3166,
11451,
265,
29889,
3221,
29889,
11739,
1053,
9178,
3089,
29892,
2216,
9692,
13,
3166,
11451,
265,
29889,
291,
29889,
29734,
1053,
10554,
29934,
9026,
6004,
13,
3166,
11451,
265,
29889,
291,
29889,
5014,
1053,
306,
265,
7032,
2392,
13,
3166,
11451,
265,
29889,
1212,
29889,
27882,
1053,
4408,
29911,
5378,
29892,
15710,
2392,
13,
3166,
11451,
265,
29889,
3597,
1053,
349,
19386,
29892,
19178,
3301,
29892,
306,
265,
2061,
13,
3166,
11451,
265,
29889,
291,
29889,
5509,
1053,
7399,
3170,
13,
3166,
11451,
265,
29889,
4422,
29889,
524,
29918,
1688,
1053,
306,
265,
23573,
362,
3057,
8259,
13,
3166,
11451,
265,
29889,
4422,
29889,
5441,
29918,
1688,
1053,
10772,
265,
3057,
8259,
13,
13,
3166,
5067,
29889,
12650,
1053,
10554,
2792,
16854,
13,
13,
13,
1990,
383,
1296,
7895,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
333,
353,
376,
7611,
333,
29908,
13,
4706,
1583,
29889,
3177,
353,
6213,
13,
4706,
1583,
29889,
978,
353,
376,
1285,
475,
4510,
29908,
13,
4706,
1583,
29889,
4174,
3301,
353,
19178,
3301,
13,
1678,
822,
756,
29918,
5030,
3097,
29898,
1311,
29892,
2117,
1125,
13,
4706,
736,
5852,
13,
13,
1990,
21029,
7032,
29898,
5160,
3170,
1125,
13,
1678,
1024,
353,
525,
11249,
29915,
13,
1678,
9962,
353,
5159,
13,
13,
1678,
822,
1246,
29918,
5014,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1990,
9178,
7032,
29898,
5160,
3170,
1125,
13,
1678,
1024,
353,
525,
12313,
29915,
13,
1678,
9962,
353,
5159,
13,
13,
1678,
822,
373,
29918,
28358,
29898,
1311,
1125,
13,
4706,
4319,
353,
29871,
29941,
847,
29871,
29900,
268,
396,
1045,
290,
13,
4706,
736,
4319,
13,
13,
1678,
822,
8709,
29918,
5182,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
17059,
29918,
3696,
353,
6864,
580,
13,
4706,
1737,
794,
29889,
17059,
29898,
29900,
29889,
29906,
29897,
13,
4706,
1583,
29889,
17059,
29918,
3696,
29889,
842,
580,
13,
13,
1678,
822,
4418,
29918,
5182,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
12020,
8960,
703,
29933,
677,
701,
304,
1243,
10672,
9704,
1159,
13,
13,
1990,
21029,
19661,
29898,
6848,
19661,
1125,
13,
1678,
9962,
353,
5159,
13,
13,
1990,
4321,
29934,
9026,
6004,
29898,
7032,
29934,
9026,
6004,
1125,
13,
1678,
1209,
13,
13,
13,
29992,
5552,
877,
3904,
1806,
1495,
13,
1990,
4321,
27893,
3260,
29898,
19737,
265,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
7611,
353,
26297,
580,
13,
4706,
1583,
29889,
3358,
353,
1019,
29883,
3260,
29898,
1311,
29889,
7611,
29897,
13,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
3258,
29889,
2457,
29918,
1767,
353,
313,
29879,
15440,
295,
29889,
2429,
29892,
2665,
262,
295,
29889,
13478,
29897,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
13237,
29889,
2457,
29918,
1767,
353,
9310,
29879,
15440,
295,
29889,
3398,
1402,
518,
29879,
15440,
295,
29889,
487,
29894,
2314,
13,
13,
1678,
822,
1243,
29918,
2962,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3358,
29889,
2962,
580,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
1311,
29889,
3358,
29889,
617,
29918,
333,
29892,
2665,
262,
295,
29889,
2429,
29897,
13,
13,
1678,
822,
1243,
29918,
2962,
29918,
2541,
29918,
990,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5041,
29918,
16859,
877,
2272,
265,
29889,
7611,
29889,
771,
2395,
29889,
9207,
29954,
742,
11117,
7611,
2396,
10998,
990,
29918,
978,
22099,
12256,
29918,
23397,
29915,
24289,
13,
4706,
1583,
29889,
3358,
29889,
2962,
580,
13,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
3258,
29918,
21264,
362,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
29898,
29879,
15440,
295,
29889,
3398,
29892,
349,
19386,
29889,
5349,
6848,
29892,
2665,
262,
295,
29889,
2429,
29897,
13,
13,
1678,
732,
5041,
877,
2272,
265,
29889,
7611,
29889,
771,
2395,
29889,
1188,
1495,
13,
1678,
822,
1243,
29918,
9847,
29918,
2541,
29918,
2704,
29898,
1311,
29892,
11187,
1188,
1125,
13,
4706,
1583,
29889,
3358,
29889,
2962,
580,
13,
4706,
1583,
29889,
3358,
29889,
18821,
403,
29918,
5014,
353,
26297,
29898,
2975,
29918,
15987,
29922,
22050,
3089,
29897,
13,
13,
4706,
410,
4912,
1698,
353,
26297,
580,
13,
4706,
410,
4912,
1698,
3032,
15439,
29918,
2962,
29918,
2230,
353,
29871,
29900,
13,
4706,
410,
4912,
1698,
29889,
333,
353,
2665,
262,
295,
29889,
5935,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29961,
29879,
15440,
295,
29889,
5935,
29962,
353,
410,
4912,
1698,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
29881,
11770,
2033,
353,
410,
4912,
1698,
13,
13,
4706,
1583,
29889,
3358,
29889,
9847,
580,
13,
13,
4706,
1583,
29889,
3358,
29889,
18821,
403,
29918,
5014,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
29898,
29879,
15440,
295,
29889,
5935,
29897,
13,
4706,
11187,
1188,
29889,
25442,
29889,
9294,
29918,
5349,
29918,
29883,
4293,
4197,
4804,
703,
17776,
304,
29504,
1889,
313,
29995,
29879,
1125,
1273,
29879,
613,
2665,
262,
295,
29889,
5935,
29892,
13764,
29979,
511,
13,
462,
462,
539,
1246,
703,
27893,
3260,
410,
2395,
451,
4069,
29901,
1273,
29879,
613,
1583,
29889,
3358,
29889,
771,
2395,
511,
13,
462,
462,
539,
1246,
703,
27893,
3260,
410,
2395,
29918,
1609,
29918,
978,
451,
4069,
29901,
1273,
29879,
613,
1583,
29889,
3358,
29889,
771,
2395,
29918,
1609,
29918,
978,
29897,
2314,
13,
13,
1678,
822,
1243,
29918,
1761,
29918,
2997,
29918,
5014,
267,
29898,
1311,
1125,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
5014,
29918,
1853,
353,
2665,
262,
295,
29889,
415,
668,
13,
4706,
282,
17640,
29906,
353,
26297,
580,
13,
4706,
282,
17640,
29906,
29889,
5014,
29918,
1853,
353,
2665,
262,
295,
29889,
415,
668,
29906,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
353,
11117,
650,
2396,
3358,
1698,
29892,
13,
462,
308,
525,
10184,
2396,
3358,
1698,
29906,
29892,
13,
462,
308,
525,
17536,
2396,
3358,
1698,
29913,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
1311,
29889,
3358,
29889,
1761,
29918,
2997,
29918,
5014,
267,
3285,
13,
462,
3986,
518,
3358,
1698,
29892,
282,
17640,
29906,
29892,
282,
17640,
2314,
13,
13,
1678,
822,
1243,
29918,
1761,
29918,
2997,
29918,
5014,
267,
29918,
15439,
29918,
1853,
29918,
4572,
29898,
1311,
1125,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
5014,
29918,
1853,
353,
2665,
262,
295,
29889,
415,
668,
13,
4706,
282,
17640,
29906,
353,
26297,
580,
13,
4706,
282,
17640,
29906,
29889,
5014,
29918,
1853,
353,
2665,
262,
295,
29889,
415,
668,
29906,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
353,
11117,
650,
2396,
3358,
1698,
29892,
13,
462,
308,
525,
10184,
2396,
3358,
1698,
29906,
29892,
13,
462,
308,
525,
17536,
2396,
3358,
1698,
29913,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
1311,
29889,
3358,
29889,
1761,
29918,
2997,
29918,
5014,
267,
29898,
29879,
15440,
295,
29889,
415,
668,
29906,
511,
13,
462,
3986,
518,
3358,
1698,
29906,
2314,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
29874,
29918,
2997,
29918,
5014,
29898,
1311,
1125,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
978,
353,
2665,
262,
295,
29889,
978,
13,
4706,
282,
17640,
29906,
353,
26297,
580,
13,
4706,
282,
17640,
29906,
29889,
978,
353,
2665,
262,
295,
29889,
978,
29906,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
353,
11117,
650,
2396,
3358,
1698,
29892,
13,
462,
308,
525,
10184,
2396,
3358,
1698,
29906,
29913,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
1311,
29889,
3358,
29889,
657,
29918,
29874,
29918,
2997,
29918,
5014,
29898,
29879,
15440,
295,
29889,
978,
29906,
511,
13,
462,
3986,
282,
17640,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
29874,
29918,
2997,
29918,
5014,
29918,
1454,
29918,
14748,
29918,
690,
29918,
333,
29898,
1311,
1125,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
5014,
29918,
1853,
353,
525,
14748,
29915,
13,
4706,
282,
17640,
29889,
10314,
29918,
1853,
353,
2665,
262,
295,
29889,
29878,
1853,
13,
4706,
282,
17640,
29906,
353,
26297,
580,
13,
4706,
282,
17640,
29906,
29889,
5014,
29918,
1853,
353,
525,
14748,
29915,
13,
4706,
282,
17640,
29906,
29889,
10314,
29918,
1853,
353,
2665,
262,
295,
29889,
29878,
1853,
29906,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
353,
11117,
650,
2396,
3358,
1698,
29892,
13,
462,
308,
525,
10184,
2396,
3358,
1698,
29906,
29913,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
1311,
29889,
3358,
29889,
657,
29918,
29874,
29918,
2997,
29918,
5014,
29898,
29879,
15440,
295,
29889,
29878,
1853,
29906,
511,
13,
462,
3986,
282,
17640,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
29874,
29918,
2997,
29918,
5014,
29918,
1217,
29918,
4352,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
3624,
8516,
29898,
1311,
29889,
3358,
29889,
657,
29918,
29874,
29918,
2997,
29918,
5014,
3101,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
2997,
29918,
5509,
29918,
5014,
29898,
1311,
1125,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
978,
3986,
353,
2665,
262,
295,
29889,
978,
13,
4706,
282,
17640,
29889,
5014,
29918,
1853,
353,
525,
12857,
29915,
13,
4706,
282,
17640,
29906,
353,
26297,
580,
13,
4706,
282,
17640,
29906,
29889,
978,
308,
353,
2665,
262,
295,
29889,
978,
29906,
13,
4706,
282,
17640,
29906,
29889,
5014,
29918,
1853,
353,
525,
5509,
29915,
13,
4706,
282,
17640,
29941,
353,
26297,
580,
13,
4706,
282,
17640,
29941,
29889,
978,
308,
353,
2665,
262,
295,
29889,
978,
29941,
13,
4706,
282,
17640,
29941,
29889,
5014,
29918,
1853,
353,
525,
5509,
29915,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
353,
11117,
650,
2396,
3358,
1698,
29892,
13,
462,
308,
525,
10184,
2396,
3358,
1698,
29906,
29892,
13,
462,
308,
525,
17536,
2396,
3358,
1698,
29941,
29913,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
3358,
29889,
275,
29918,
2997,
29918,
5509,
29918,
5014,
29898,
29879,
15440,
295,
29889,
978,
29941,
876,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
2997,
29918,
5509,
29918,
5014,
29918,
978,
29918,
20317,
29918,
4187,
29918,
1853,
29918,
13221,
593,
29898,
1311,
1125,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
978,
3986,
353,
2665,
262,
295,
29889,
978,
13,
4706,
282,
17640,
29889,
5014,
29918,
1853,
353,
525,
12857,
29915,
13,
4706,
282,
17640,
29906,
353,
26297,
580,
13,
4706,
282,
17640,
29906,
29889,
978,
308,
353,
2665,
262,
295,
29889,
978,
29906,
13,
4706,
282,
17640,
29906,
29889,
5014,
29918,
1853,
353,
525,
1333,
5509,
29915,
13,
4706,
282,
17640,
29941,
353,
26297,
580,
13,
4706,
282,
17640,
29941,
29889,
978,
308,
353,
2665,
262,
295,
29889,
978,
29941,
13,
4706,
282,
17640,
29941,
29889,
5014,
29918,
1853,
353,
525,
1333,
5509,
29915,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
353,
11117,
650,
2396,
3358,
1698,
29892,
13,
462,
308,
525,
10184,
2396,
3358,
1698,
29906,
29892,
13,
462,
308,
525,
17536,
2396,
3358,
1698,
29941,
29913,
13,
13,
4706,
1583,
29889,
9294,
8824,
29898,
1311,
29889,
3358,
29889,
275,
29918,
2997,
29918,
5509,
29918,
5014,
29898,
29879,
15440,
295,
29889,
978,
29941,
876,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
2997,
29918,
14748,
29918,
5014,
29898,
1311,
1125,
13,
4706,
396,
10823,
338,
2788,
304,
2038,
29892,
541,
12747,
6503,
29918,
1853,
2012,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
978,
3986,
353,
2665,
262,
295,
29889,
978,
13,
4706,
282,
17640,
29889,
5014,
29918,
1853,
353,
525,
12857,
29915,
13,
4706,
282,
17640,
29906,
353,
26297,
580,
13,
4706,
282,
17640,
29906,
29889,
10314,
29918,
1853,
353,
2665,
262,
295,
29889,
978,
29906,
13,
4706,
282,
17640,
29906,
29889,
5014,
29918,
1853,
353,
525,
14748,
29915,
13,
4706,
282,
17640,
29941,
353,
26297,
580,
13,
4706,
282,
17640,
29941,
29889,
978,
308,
353,
2665,
262,
295,
29889,
978,
29941,
13,
4706,
282,
17640,
29941,
29889,
5014,
29918,
1853,
353,
525,
1333,
5509,
29915,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
353,
11117,
650,
2396,
3358,
1698,
29892,
13,
462,
308,
525,
10184,
2396,
3358,
1698,
29906,
29892,
13,
462,
308,
525,
17536,
2396,
3358,
1698,
29941,
29913,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
3358,
29889,
275,
29918,
2997,
29918,
14748,
29918,
5014,
29898,
29879,
15440,
295,
29889,
978,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
2997,
29918,
14748,
29918,
5014,
29918,
1333,
29918,
11940,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
8824,
29898,
1311,
29889,
3358,
29889,
275,
29918,
2997,
29918,
14748,
29918,
5014,
29898,
29879,
15440,
295,
29889,
650,
876,
13,
13,
1678,
822,
1243,
1649,
348,
9573,
29918,
5014,
29918,
12523,
29898,
1311,
1125,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
3032,
15439,
29918,
978,
353,
525,
29896,
29915,
13,
4706,
282,
17640,
3032,
15439,
29918,
1853,
353,
525,
5509,
29915,
13,
4706,
282,
17640,
3032,
15439,
29918,
690,
29918,
333,
353,
2665,
262,
295,
29889,
4569,
333,
13,
4706,
282,
17640,
3032,
15439,
29918,
4501,
29883,
29918,
333,
353,
2665,
262,
295,
29889,
567,
7071,
333,
13,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
8143,
29889,
2975,
29918,
15987,
353,
2216,
9692,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29961,
29879,
15440,
295,
29889,
5935,
29962,
353,
282,
17640,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
29896,
2033,
353,
282,
17640,
13,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
12650,
29889,
12071,
29918,
17640,
580,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
12650,
29889,
2975,
29918,
15987,
353,
6213,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
12650,
29889,
2457,
29918,
1767,
353,
9310,
16272,
2314,
13,
13,
4706,
1583,
29889,
3358,
3032,
348,
9573,
29918,
5014,
29898,
29879,
15440,
295,
29889,
5935,
29892,
282,
17640,
29897,
13,
13,
4706,
396,
1510,
591,
1898,
304,
16254,
411,
278,
390,
29934,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
8143,
29889,
9294,
29918,
4804,
29898,
29879,
15440,
295,
29889,
4569,
333,
29892,
628,
29918,
21264,
800,
29922,
5574,
29897,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
12650,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
29898,
29879,
15440,
295,
29889,
567,
7071,
333,
29892,
376,
5349,
7032,
613,
376,
7032,
613,
1178,
29918,
6194,
29922,
5574,
29897,
13,
4706,
1583,
29889,
9294,
14776,
29898,
1311,
29889,
3358,
29889,
771,
2395,
29892,
426,
1800,
13,
4706,
1583,
29889,
9294,
14776,
29898,
1311,
29889,
3358,
29889,
771,
2395,
29918,
1609,
29918,
978,
29892,
426,
1800,
13,
13,
4706,
396,
405,
12194,
29901,
1284,
29918,
12650,
1736,
2691,
322,
4076,
502,
385,
1059,
7374,
291,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
8143,
29889,
12071,
29918,
17640,
580,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
12650,
29889,
12071,
29918,
17640,
580,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
12650,
29889,
2975,
29918,
15987,
353,
6213,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
2886,
29918,
12650,
29889,
2457,
29918,
1767,
353,
9310,
29879,
15440,
295,
29889,
4501,
25232,
16272,
8516,
2314,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29961,
29879,
15440,
295,
29889,
5935,
29962,
353,
282,
17640,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
29896,
2033,
353,
282,
17640,
13,
13,
4706,
1583,
29889,
3358,
3032,
348,
9573,
29918,
5014,
29898,
29879,
15440,
295,
29889,
5935,
29892,
282,
17640,
29897,
13,
13,
4706,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
8143,
29889,
9294,
29918,
29883,
4293,
4197,
4804,
29898,
29879,
15440,
295,
29889,
4569,
333,
29892,
628,
29918,
21264,
800,
29922,
5574,
511,
13,
462,
462,
462,
795,
1246,
29898,
29879,
15440,
295,
29889,
567,
7071,
333,
29892,
628,
29918,
21264,
800,
29922,
5574,
29897,
2314,
13,
13,
4706,
396,
405,
12194,
29901,
10823,
13,
4706,
282,
17640,
353,
26297,
580,
13,
4706,
282,
17640,
29889,
333,
353,
2665,
262,
295,
29889,
5935,
13,
4706,
282,
17640,
3032,
15439,
29918,
978,
353,
525,
29896,
29915,
13,
4706,
282,
17640,
3032,
15439,
29918,
1853,
353,
525,
14748,
29915,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29961,
29879,
15440,
295,
29889,
5935,
29962,
353,
282,
17640,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
29896,
2033,
353,
282,
17640,
13,
13,
4706,
1583,
29889,
3358,
3032,
348,
9573,
29918,
5014,
29898,
29879,
15440,
295,
29889,
5935,
29892,
282,
17640,
29897,
13,
13,
4706,
1583,
29889,
7611,
29889,
12322,
29889,
348,
9573,
29918,
11177,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
11974,
14769,
1237,
613,
2665,
262,
295,
29889,
5935,
29897,
13,
13,
1678,
822,
1243,
1649,
3258,
29918,
1761,
8333,
29918,
29734,
29918,
2541,
29918,
16859,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5041,
29918,
16859,
877,
2272,
265,
29889,
7611,
29889,
771,
2395,
29889,
9207,
29954,
742,
5639,
29922,
8977,
29898,
12062,
6751,
29922,
8977,
29898,
29734,
29922,
8977,
29898,
15439,
29918,
1761,
8333,
29918,
1853,
2433,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
29889,
3057,
29934,
9026,
6004,
8785,
876,
13,
13,
4706,
9358,
353,
1583,
29889,
3358,
3032,
3258,
29918,
1761,
8333,
29918,
29734,
29898,
5014,
29922,
29879,
15440,
295,
29889,
5014,
29897,
13,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
1022,
29892,
4321,
29934,
9026,
6004,
29897,
13,
13,
1678,
822,
1243,
1649,
3258,
29918,
1761,
8333,
29918,
29734,
29918,
14037,
29918,
16859,
29918,
392,
29918,
1217,
29918,
20580,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5041,
29918,
16859,
877,
2272,
265,
29889,
7611,
29889,
771,
2395,
29889,
9207,
29954,
742,
5639,
29922,
8977,
29898,
12062,
6751,
29922,
8977,
29898,
29734,
29922,
8977,
29898,
15439,
29918,
1761,
8333,
29918,
1853,
29922,
8516,
13697,
13,
13,
4706,
9358,
353,
1583,
29889,
3358,
3032,
3258,
29918,
1761,
8333,
29918,
29734,
29898,
5014,
29922,
29879,
15440,
295,
29889,
5014,
29897,
13,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
1022,
29892,
10554,
29934,
9026,
6004,
29897,
13,
13,
1678,
822,
1243,
29918,
26061,
29918,
5014,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3358,
29889,
2962,
580,
13,
4706,
1583,
29889,
7611,
29889,
14057,
29918,
11255,
353,
26297,
580,
13,
13,
4706,
1583,
29889,
3358,
29889,
771,
2395,
1839,
5935,
29896,
2033,
353,
26297,
580,
13,
13,
4706,
9580,
29906,
353,
9178,
7032,
580,
13,
4706,
1583,
29889,
3358,
29889,
15439,
29918,
12587,
29889,
1028,
18101,
29898,
978,
543,
12313,
613,
2669,
29922,
15439,
29906,
29892,
3646,
29922,
15439,
29906,
29889,
14057,
29918,
5182,
29897,
13,
4706,
1737,
794,
29889,
17059,
29898,
29900,
29897,
29871,
396,
29408,
278,
716,
3244,
304,
4418,
322,
7135,
278,
9704,
13,
13,
4706,
1583,
29889,
9294,
8824,
29898,
1311,
29889,
7611,
29889,
14057,
29918,
11255,
29889,
13998,
29897,
13,
13,
4706,
628,
1583,
29889,
3358,
29889,
771,
2395,
1839,
5935,
29896,
2033,
13,
13,
4706,
9580,
29941,
353,
9178,
7032,
580,
13,
4706,
1583,
29889,
3358,
29889,
15439,
29918,
12587,
29889,
1028,
18101,
29898,
978,
543,
12313,
613,
2669,
29922,
15439,
29941,
29892,
3646,
29922,
15439,
29941,
29889,
14057,
29918,
5182,
29897,
13,
4706,
1737,
794,
29889,
17059,
29898,
29900,
29897,
29871,
396,
29408,
278,
716,
3244,
304,
4418,
322,
7135,
278,
9704,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
7611,
29889,
14057,
29918,
11255,
29889,
13998,
29897,
13,
13,
29992,
5552,
877,
10192,
1495,
13,
1990,
4321,
27893,
3260,
2928,
29898,
29902,
265,
23573,
362,
3057,
8259,
1125,
13,
13,
1678,
770,
1222,
6021,
24155,
29898,
2451,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
15439,
29918,
29888,
2234,
29898,
1311,
1125,
13,
4706,
12020,
4971,
666,
3057,
703,
29943,
2234,
411,
1737,
794,
29871,
29896,
29889,
29900,
29892,
11308,
4319,
5639,
29889,
28246,
403,
1159,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
13,
4706,
564,
353,
20688,
3591,
580,
13,
4706,
822,
5229,
13789,
29898,
15439,
29892,
2106,
29892,
5639,
1125,
13,
9651,
565,
2106,
1275,
10554,
2792,
16854,
29889,
4519,
29902,
20566,
29901,
13,
18884,
564,
29889,
842,
580,
13,
4706,
26354,
29889,
1202,
29918,
15439,
29918,
3859,
29918,
15033,
29918,
14035,
29898,
26061,
13789,
29897,
13,
13,
4706,
23107,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
5509,
1495,
13,
13,
4706,
396,
4556,
263,
10672,
13,
4706,
26354,
29889,
771,
2395,
29961,
5935,
1822,
29918,
5014,
3032,
24220,
29918,
7097,
29889,
15439,
29889,
21174,
29898,
11739,
29922,
1311,
29889,
1252,
6021,
24155,
29892,
2908,
29922,
8824,
29897,
13,
13,
4706,
396,
4480,
363,
9580,
2106,
3939,
12519,
13,
4706,
564,
29889,
657,
29898,
15619,
29922,
29945,
29897,
13,
13,
4706,
396,
1207,
1854,
6206,
13,
4706,
1583,
29889,
9294,
3664,
797,
29898,
5935,
29892,
26354,
29889,
771,
2395,
29897,
13,
13,
1678,
822,
1243,
29918,
15439,
12847,
29918,
10718,
29898,
1311,
1125,
13,
4706,
25713,
617,
353,
383,
1296,
7895,
580,
13,
4706,
25713,
617,
29889,
10314,
29918,
1727,
6020,
353,
26297,
580,
13,
4706,
25713,
617,
29889,
10314,
29918,
1727,
6020,
29889,
3258,
29889,
2457,
29918,
1767,
29922,
3366,
1367,
3284,
13478,
3108,
13,
4706,
25713,
617,
29889,
2962,
29918,
2230,
353,
26297,
580,
13,
4706,
25713,
617,
29889,
3259,
353,
26297,
580,
13,
13,
4706,
26354,
353,
1019,
29883,
3260,
29898,
29888,
1296,
617,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5349,
5552,
29898,
29888,
1296,
617,
29892,
376,
1028,
18101,
29918,
5014,
5783,
13,
4706,
26354,
29889,
2962,
580,
13,
4706,
26354,
29889,
9847,
580,
13,
13,
1678,
822,
1243,
29918,
15439,
12847,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
13,
4706,
23107,
29896,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
5509,
1495,
13,
13,
4706,
23107,
29906,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
5461,
29918,
5014,
1495,
13,
13,
4706,
23107,
29941,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
14748,
742,
525,
17708,
19661,
1495,
13,
13,
4706,
23107,
29946,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
1689,
18785,
1495,
13,
13,
4706,
23107,
29945,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
12857,
1495,
13,
13,
4706,
23107,
29953,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
326,
13847,
1495,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2451,
29897,
408,
429,
29901,
13,
9651,
2295,
353,
11117,
5014,
2396,
10998,
1853,
22099,
26690,
29918,
1853,
29915,
930,
13,
9651,
23107,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
9651,
1583,
29889,
9294,
9843,
29898,
735,
29889,
11739,
29892,
525,
14148,
1889,
1134,
29901,
350,
5194,
29924,
1495,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
2435,
29898,
3358,
29889,
771,
2395,
511,
29871,
29945,
29897,
268,
396,
2669,
29892,
4840,
29918,
15439,
29892,
313,
1217,
10823,
511,
2317,
18785,
29892,
2560,
29889,
29871,
11698,
22313,
2303,
4571,
3040,
13,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29896,
29897,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29906,
29897,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29941,
29897,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29946,
29897,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29945,
29897,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
2435,
29898,
3358,
29889,
771,
2395,
511,
29871,
29900,
29897,
13,
13,
1678,
822,
903,
1028,
18101,
15439,
29898,
1311,
29892,
26354,
29892,
282,
1853,
29892,
282,
25932,
29922,
8516,
1125,
13,
4706,
282,
25932,
353,
282,
25932,
470,
525,
17708,
7032,
29915,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
1853,
2396,
415,
668,
930,
13,
4706,
23107,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
282,
25932,
29892,
2295,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5935,
29897,
13,
13,
4706,
736,
23107,
13,
13,
1678,
822,
1243,
29918,
15439,
29918,
990,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
1853,
22099,
1689,
18785,
29915,
930,
13,
4706,
23107,
29896,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5935,
29896,
29897,
13,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
1853,
22099,
1689,
18785,
16675,
525,
990,
29918,
29887,
6170,
749,
29918,
978,
2396,
525,
2816,
29887,
29906,
10827,
13,
4706,
23107,
29906,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29906,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5935,
29906,
29897,
13,
13,
4706,
9580,
353,
26354,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
11249,
29896,
2033,
13,
4706,
1583,
29889,
9294,
9843,
29898,
15439,
29889,
990,
29918,
29887,
6170,
749,
29918,
978,
5501,
2725,
1495,
13,
13,
4706,
9580,
353,
26354,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
11249,
29906,
2033,
13,
4706,
1583,
29889,
9294,
9843,
29898,
15439,
29889,
990,
29918,
29887,
6170,
749,
29918,
978,
5501,
2816,
29887,
29906,
1495,
13,
13,
13,
1678,
822,
1243,
29918,
15439,
12847,
29918,
845,
329,
3204,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1688,
29918,
15439,
12847,
580,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
13,
4706,
26354,
29889,
9847,
580,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
2435,
29898,
3358,
29889,
771,
2395,
511,
29871,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
15439,
12847,
29918,
12313,
28358,
29918,
845,
329,
3204,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
4706,
23107,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
12313,
5014,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
22050,
7032,
742,
11117,
5014,
2396,
10998,
1853,
22099,
5509,
29915,
24289,
13,
13,
4706,
411,
13261,
877,
2272,
265,
29889,
291,
29889,
5509,
29889,
1188,
1495,
408,
286,
29901,
13,
9651,
26354,
29889,
9847,
580,
13,
9651,
1583,
29889,
9294,
14776,
29898,
2435,
29898,
3358,
29889,
771,
2395,
511,
29871,
29900,
29897,
13,
9651,
1583,
29889,
9294,
14776,
29898,
29885,
29889,
11739,
29889,
4804,
29918,
2798,
29892,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
326,
13847,
29918,
18821,
403,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
1583,
3032,
1028,
18101,
15439,
29898,
1311,
29889,
7611,
29889,
15439,
29918,
12847,
29892,
525,
326,
13847,
1495,
13,
4706,
1583,
29889,
9294,
14776,
29898,
2435,
29898,
1311,
29889,
7611,
29889,
15439,
29918,
12847,
29889,
771,
2395,
511,
29871,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
18821,
403,
29918,
5014,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
23107,
353,
1583,
3032,
1028,
18101,
15439,
29898,
1311,
29889,
7611,
29889,
15439,
29918,
12847,
29892,
525,
5509,
1495,
13,
13,
4706,
1583,
29889,
7611,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29897,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
2435,
29898,
1311,
29889,
7611,
29889,
15439,
29918,
12847,
29889,
771,
2395,
511,
29871,
29900,
29897,
13,
13,
4706,
396,
1286,
1018,
304,
29504,
372,
1449,
29892,
372,
9273,
29915,
29873,
1863,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
22050,
3089,
29892,
1583,
29889,
7611,
29889,
18821,
403,
29918,
5014,
29892,
23107,
29897,
13,
13,
1678,
822,
1243,
29918,
15439,
29918,
3859,
29918,
3167,
29918,
14035,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
286,
353,
26297,
580,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
4706,
26354,
29889,
1202,
29918,
15439,
29918,
3859,
29918,
15033,
29918,
14035,
29898,
29885,
29897,
13,
13,
4706,
23107,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
5509,
1495,
13,
13,
4706,
286,
29889,
9294,
29918,
13998,
29918,
2541,
29898,
2190,
29979,
29892,
10554,
2792,
16854,
29889,
29934,
3904,
29940,
4214,
29892,
1583,
29889,
7611,
29897,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29885,
29889,
4804,
29918,
5085,
29961,
29900,
3816,
29900,
1402,
21029,
7032,
29897,
13,
13,
4706,
1583,
29889,
7611,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29897,
13,
13,
4706,
286,
29889,
9294,
29918,
13998,
29918,
2541,
29898,
2190,
29979,
29892,
10554,
2792,
16854,
29889,
4945,
16173,
3040,
29928,
29892,
1583,
29889,
7611,
29897,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29885,
29889,
4804,
29918,
5085,
29961,
29900,
3816,
29900,
1402,
21029,
7032,
29897,
13,
13,
4706,
26354,
29889,
5992,
29918,
15439,
29918,
3859,
29918,
15033,
29918,
14035,
29898,
29885,
29897,
13,
13,
4706,
3151,
29918,
4804,
29918,
2798,
353,
286,
29889,
4804,
29918,
2798,
13,
4706,
23107,
353,
1583,
3032,
1028,
18101,
15439,
29898,
3358,
29892,
525,
5509,
1495,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
29885,
29889,
4804,
29918,
2798,
29892,
3151,
29918,
4804,
29918,
2798,
29897,
396,
881,
451,
505,
1063,
23051,
13,
13,
4706,
1583,
29889,
7611,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29897,
13,
13,
4706,
1583,
29889,
9294,
14776,
29898,
29885,
29889,
4804,
29918,
2798,
29892,
3151,
29918,
4804,
29918,
2798,
29897,
396,
881,
451,
505,
1063,
23051,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
1761,
8333,
29918,
29734,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5041,
29918,
16859,
877,
2272,
265,
29889,
7611,
29889,
771,
2395,
29889,
9207,
29954,
742,
11117,
7611,
2396,
10998,
12062,
6751,
2396,
10998,
29734,
2396,
10998,
15439,
29918,
1761,
8333,
29918,
1853,
22099,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
29889,
3057,
29934,
9026,
6004,
29915,
930,
24289,
13,
13,
4706,
25713,
617,
353,
383,
1296,
7895,
580,
13,
4706,
25713,
617,
29889,
10314,
29918,
1727,
6020,
353,
26297,
580,
13,
4706,
25713,
617,
29889,
10314,
29918,
1727,
6020,
29889,
3258,
29889,
2457,
29918,
1767,
29922,
3366,
1367,
3284,
13478,
3108,
13,
13,
4706,
411,
13261,
877,
2272,
265,
29889,
7611,
29889,
771,
2395,
29889,
27893,
3260,
3032,
657,
29918,
22256,
29918,
10599,
29918,
2917,
742,
26297,
29898,
2457,
29918,
1767,
3790,
20073,
29901,
13,
9651,
26354,
353,
1019,
29883,
3260,
29898,
29888,
1296,
617,
29897,
13,
9651,
26354,
3032,
657,
29918,
22256,
29918,
10599,
29918,
2917,
353,
26297,
580,
13,
13,
9651,
9358,
353,
26354,
3032,
3258,
29918,
1761,
8333,
29918,
29734,
29898,
3177,
29922,
29879,
15440,
295,
29889,
3177,
29892,
13,
462,
462,
1669,
2669,
29922,
29879,
15440,
295,
29889,
5509,
29892,
13,
462,
462,
1669,
1889,
29922,
29879,
15440,
295,
29889,
5014,
29897,
13,
13,
9651,
1583,
29889,
9294,
3624,
4998,
29898,
1022,
29892,
4321,
29934,
9026,
6004,
29897,
13,
13,
1678,
822,
1243,
29918,
2704,
29918,
265,
29918,
2962,
29918,
20631,
414,
29918,
974,
29918,
15439,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
286,
353,
26297,
580,
13,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
4706,
26354,
29889,
1202,
29918,
15439,
29918,
3859,
29918,
15033,
29918,
14035,
29898,
29885,
29897,
13,
13,
4706,
411,
13261,
877,
2272,
265,
29889,
291,
29889,
5014,
29889,
29902,
265,
7032,
4899,
29889,
2962,
29918,
20631,
414,
742,
26297,
29898,
2975,
29918,
15987,
29922,
29902,
265,
7032,
2392,
22164,
13,
9651,
23107,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
11117,
5014,
2396,
10998,
1853,
22099,
5509,
29915,
24289,
13,
9651,
1583,
29889,
9294,
3624,
8516,
29898,
5935,
29897,
13,
13,
9651,
23107,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
11117,
5014,
2396,
10998,
1853,
22099,
5461,
29918,
5014,
29915,
24289,
13,
9651,
1583,
29889,
9294,
3624,
8516,
29898,
5935,
29897,
13,
13,
9651,
23107,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
11117,
5014,
2396,
10998,
1853,
22099,
1689,
18785,
29915,
24289,
13,
9651,
1583,
29889,
9294,
3624,
8516,
29898,
5935,
29897,
13,
13,
9651,
286,
29889,
9294,
29918,
29883,
4293,
4197,
4804,
29898,
2190,
29979,
29892,
10554,
2792,
16854,
29889,
4519,
29902,
20566,
511,
13,
462,
9651,
1246,
29898,
2190,
29979,
29892,
10554,
2792,
16854,
29889,
4519,
29902,
20566,
511,
13,
462,
9651,
1246,
29898,
2190,
29979,
29892,
10554,
2792,
16854,
29889,
4519,
29902,
20566,
29897,
2314,
13,
13,
13,
1678,
822,
1243,
29918,
5014,
29918,
2917,
29918,
1727,
29898,
1311,
1125,
13,
4706,
1583,
3032,
2962,
29918,
7611,
580,
13,
13,
4706,
26354,
353,
1583,
29889,
7611,
29889,
15439,
29918,
12847,
13,
13,
4706,
396,
4321,
9280,
1206,
13,
13,
4706,
620,
29918,
2917,
353,
11117,
18732,
2396,
10998,
5514,
22099,
9933,
29915,
930,
13,
4706,
620,
29918,
5415,
353,
306,
265,
2061,
703,
19661,
4998,
613,
7156,
29918,
2917,
29922,
690,
29918,
2917,
29897,
13,
4706,
620,
29918,
333,
29892,
903,
353,
1583,
29889,
7611,
29889,
10314,
29918,
1727,
6020,
29889,
3258,
29898,
690,
29918,
5415,
29897,
13,
4706,
2295,
29918,
999,
353,
376,
13237,
16664,
29879,
29914,
9465,
29918,
2917,
29908,
1273,
620,
29918,
333,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
2917,
29918,
999,
2396,
2917,
29918,
999,
930,
13,
13,
4706,
23107,
29896,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5935,
29896,
29897,
13,
13,
4706,
9580,
353,
26354,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
11249,
29896,
2033,
13,
4706,
1583,
29889,
9294,
5574,
29898,
15439,
29897,
13,
4706,
1583,
29889,
9294,
797,
877,
18732,
742,
9580,
29889,
9207,
29954,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
15439,
29889,
9207,
29954,
29889,
657,
29918,
11177,
703,
18732,
29889,
5514,
4968,
525,
9933,
1495,
13,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29896,
29897,
13,
13,
4706,
396,
4321,
10672,
4251,
13,
13,
4706,
2295,
29918,
999,
353,
376,
19165,
29990,
16664,
29879,
29914,
9465,
29918,
2917,
29908,
1273,
620,
29918,
333,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
2917,
29918,
999,
2396,
2917,
29918,
999,
930,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
22050,
3089,
29897,
408,
429,
29901,
13,
9651,
23107,
29906,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
13,
4706,
2295,
29918,
999,
353,
376,
13237,
29901,
12313,
12313,
12313,
29914,
9465,
29918,
2917,
29908,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
2917,
29918,
999,
2396,
2917,
29918,
999,
930,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
17413,
29897,
408,
429,
29901,
13,
9651,
23107,
29941,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
13,
4706,
2295,
29918,
999,
353,
376,
13237,
16664,
29879,
29914,
1333,
29918,
735,
15423,
29908,
1273,
620,
29918,
333,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
2917,
29918,
999,
2396,
2917,
29918,
999,
930,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
22050,
3089,
29897,
408,
429,
29901,
13,
9651,
23107,
29946,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
13,
4706,
2295,
29918,
999,
353,
376,
13237,
16664,
29879,
29914,
978,
29908,
1273,
620,
29918,
333,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
2917,
29918,
999,
2396,
2917,
29918,
999,
930,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
22050,
3089,
29897,
408,
429,
29901,
13,
9651,
23107,
29946,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
13,
13,
4706,
396,
4321,
363,
3618,
1158,
13,
13,
4706,
5446,
29918,
333,
353,
376,
1688,
27508,
718,
620,
29918,
333,
13,
4706,
1583,
29889,
7611,
29889,
3318,
29918,
8899,
29889,
3258,
29918,
1514,
29898,
690,
29918,
2917,
29892,
1203,
29918,
333,
29922,
5415,
29918,
333,
29897,
13,
4706,
5446,
29906,
353,
1583,
29889,
7611,
29889,
3318,
29918,
8899,
29889,
949,
29918,
1514,
29898,
5415,
29918,
333,
29897,
13,
4706,
1583,
29889,
9294,
14776,
29898,
5415,
29906,
29892,
620,
29918,
2917,
29897,
13,
13,
4706,
2295,
29918,
999,
353,
376,
12650,
16664,
29879,
12975,
1273,
5446,
29918,
333,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
2917,
29918,
999,
2396,
2917,
29918,
999,
930,
13,
13,
4706,
23107,
29896,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5935,
29896,
29897,
13,
13,
4706,
9580,
353,
26354,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
11249,
29896,
2033,
13,
4706,
1583,
29889,
9294,
5574,
29898,
15439,
29897,
13,
4706,
1583,
29889,
9294,
797,
877,
18732,
742,
9580,
29889,
9207,
29954,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
15439,
29889,
9207,
29954,
29889,
657,
29918,
11177,
703,
18732,
29889,
5514,
4968,
525,
9933,
1495,
13,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29896,
29897,
13,
13,
13,
4706,
2295,
29918,
999,
353,
376,
12650,
16664,
29879,
29914,
18732,
29908,
1273,
5446,
29918,
333,
13,
4706,
2295,
353,
11117,
5014,
2396,
10998,
2917,
29918,
999,
2396,
2917,
29918,
999,
930,
13,
13,
4706,
23107,
29896,
353,
26354,
29889,
1028,
18101,
29918,
5014,
877,
11249,
29896,
742,
525,
2272,
265,
29889,
7611,
29889,
1688,
29889,
1688,
29918,
771,
2395,
742,
525,
17708,
7032,
742,
2295,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
5935,
29896,
29897,
13,
13,
4706,
9580,
353,
26354,
29889,
771,
2395,
29918,
1609,
29918,
978,
1839,
11249,
29896,
2033,
13,
4706,
1583,
29889,
9294,
5574,
29898,
15439,
29897,
13,
4706,
1583,
29889,
9294,
797,
877,
5514,
742,
9580,
29889,
9207,
29954,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
15439,
29889,
9207,
29954,
29889,
5514,
29892,
525,
9933,
1495,
13,
13,
4706,
26354,
29889,
18821,
403,
29918,
5014,
29898,
5935,
29896,
29897,
13,
2
] |
boundaries/kml.py | MinnPost/represent-boundaries | 20 | 1607809 | <reponame>MinnPost/represent-boundaries
from __future__ import unicode_literals
from xml.sax.saxutils import escape
def generate_placemark(name, geom):
return "<Placemark><name>%s</name>%s</Placemark>" % (escape(name), geom.kml)
def generate_kml_document(placemarks):
return """<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
%s
</Document>
</kml>""" % "\n".join(placemarks)
| [
1,
529,
276,
1112,
420,
29958,
29924,
2559,
6747,
29914,
276,
6338,
29899,
9917,
4314,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
4903,
29889,
29879,
1165,
29889,
29879,
1165,
13239,
1053,
10169,
13,
13,
13,
1753,
5706,
29918,
29886,
4620,
24212,
29898,
978,
29892,
23216,
1125,
13,
1678,
736,
9872,
29925,
4620,
24212,
5299,
978,
29958,
29995,
29879,
829,
978,
29958,
29995,
29879,
829,
29925,
4620,
24212,
11903,
1273,
313,
21587,
29898,
978,
511,
23216,
29889,
29895,
828,
29897,
13,
13,
13,
1753,
5706,
29918,
29895,
828,
29918,
3225,
29898,
29886,
4620,
331,
17862,
1125,
13,
1678,
736,
9995,
8169,
3134,
1873,
543,
29896,
29889,
29900,
29908,
8025,
543,
10496,
29899,
29947,
18943,
13,
29966,
29895,
828,
9463,
543,
1124,
597,
1636,
29889,
459,
996,
275,
29889,
1212,
29914,
29895,
828,
29914,
29906,
29889,
29906,
1013,
13,
29966,
6268,
29958,
13,
29995,
29879,
13,
829,
6268,
29958,
13,
829,
29895,
828,
11903,
15945,
1273,
6634,
29876,
1642,
7122,
29898,
29886,
4620,
331,
17862,
29897,
13,
2
] |
constants.py | tyukesz/Command-word-recognition-keras- | 3 | 159415 | VERBOSITY = 1
SAMPLE_RATE = 16000
DURATION_MS = 1000
FEATURES_COUNT = 64
DESIRED_SAMPLES = int(SAMPLE_RATE * DURATION_MS / 1000)
DROPOUT_RATE = 0.5
TESING_PERCENTAGE = 15
VALIDATION_PERCENTAGE = 15
VALIDATION_FREQUENCY = 10
SAVE_PERIOD = 10
EPOCHS = 100
BATCH_SIZE = 512
DATASET_URL = 'http://download.tensorflow.org/data/speech_commands_v0.02.tar.gz'
SOUNDS_DIR = './trainset/sounds/'
MFCCS_DIR = './trainset/MFCCS/'
MODELS_DIR = './models/'
LABELS_PATH = MODELS_DIR + 'labels.txt'
WANTED_WORDS = ['left', 'right', 'up', 'down']
| [
1,
478,
1001,
29933,
3267,
11937,
353,
29871,
29896,
13,
8132,
3580,
1307,
29918,
29934,
3040,
353,
29871,
29896,
29953,
29900,
29900,
29900,
13,
29928,
4574,
8098,
29918,
4345,
353,
29871,
29896,
29900,
29900,
29900,
13,
16359,
1299,
11499,
29903,
29918,
18736,
353,
29871,
29953,
29946,
13,
2287,
5425,
19386,
29918,
8132,
3580,
17101,
353,
938,
29898,
8132,
3580,
1307,
29918,
29934,
3040,
334,
360,
4574,
8098,
29918,
4345,
847,
29871,
29896,
29900,
29900,
29900,
29897,
13,
13,
29928,
29366,
12015,
29918,
29934,
3040,
353,
29871,
29900,
29889,
29945,
13,
29911,
2890,
4214,
29918,
13171,
29907,
3919,
10461,
353,
29871,
29896,
29945,
13,
26707,
8098,
29918,
13171,
29907,
3919,
10461,
353,
29871,
29896,
29945,
13,
26707,
8098,
29918,
29943,
1525,
13356,
1430,
29907,
29979,
353,
29871,
29896,
29900,
13,
29903,
7520,
29923,
29918,
13171,
5971,
29928,
353,
29871,
29896,
29900,
13,
29923,
13152,
3210,
29903,
353,
29871,
29896,
29900,
29900,
13,
29933,
14789,
29918,
14226,
353,
29871,
29945,
29896,
29906,
13,
13,
25832,
8127,
29911,
29918,
4219,
353,
525,
1124,
597,
10382,
29889,
29056,
29889,
990,
29914,
1272,
29914,
5965,
5309,
29918,
26381,
29918,
29894,
29900,
29889,
29900,
29906,
29889,
12637,
29889,
18828,
29915,
13,
6156,
18783,
29903,
29918,
9464,
353,
19283,
14968,
842,
29914,
29879,
3885,
22208,
13,
29924,
29943,
4174,
29903,
29918,
9464,
353,
19283,
14968,
842,
29914,
29924,
29943,
4174,
29903,
22208,
13,
20387,
8547,
29918,
9464,
353,
19283,
9794,
22208,
13,
24461,
6670,
29903,
29918,
10145,
353,
16999,
2287,
8547,
29918,
9464,
718,
525,
21134,
29889,
3945,
29915,
13,
13,
29956,
13566,
3352,
29918,
11686,
8452,
353,
6024,
1563,
742,
525,
1266,
742,
525,
786,
742,
525,
3204,
2033,
13,
2
] |
booktags/flaskapp/book/views.py | MagicSword/Booktags | 0 | 2498 | <reponame>MagicSword/Booktags
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
example.py
~~~~~~~~~
A simple command line application to run flask apps.
:copyright: 2019 Miller
:license: BSD-3-Clause
"""
# Known bugs that can't be fixed here:
# - synopsis() cannot be prevented from clobbering existing
# loaded modules.
# - If the __file__ attribute on a module is a relative path and
# the current directory is changed with os.chdir(), an incorrect
# path will be displayed.
from flask import render_template, redirect, request, url_for, flash,jsonify,current_app
from flask_login import login_user, logout_user, login_required, current_user
from . import book
from flask_sqlalchemy import get_debug_queries
from sqlalchemy.sql.expression import cast
from datatables import ColumnDT, DataTables
from .. import auth
from .. import db
from .forms import EditBookForm, HackmdMeta
# from booktags.db.basemodels import Book
from booktags.flaskapp.model.models import BookMain
# --------------------------------------------------------- common routines
@book.after_app_request
def after_request(response):
for query in get_debug_queries():
if query.duration >= current_app.config['PROJECT_SLOW_DB_QUERY_TIME']:
current_app.logger.warning(
'Slow query: %s\nParameters: %s\nDuration: %fs\nContext: %s\n'
% (query.statement, query.parameters, query.duration,
query.context))
return response
@book.route('/', methods=['GET', 'POST'])
def index():
# books=BookMain.get_all_book()
query = BookMain.query
page = request.args.get('page', 1, type=int)
pagination = query.order_by(cast(BookMain.id, db.Integer)).paginate(
page, per_page=current_app.config['PROJECT_BOOKS_PER_PAGE'],
error_out=False)
books = pagination.items
return render_template('book/index.html',books=books,pagination=pagination)
# @book.route('/list/', methods=['GET', 'POST'])
# def list_book():
# """
#
# :param field: col name
# :param order: asc or desc
# :return: renew query
# """
# books = BookMain.get_all_book()
# return render_template('book/list_book.html',books=books)
@book.route("/list")
def list_book():
"""List users with DataTables <= 1.10.x."""
return render_template('book/list_book.html')
@book.route('/data', methods=['GET', 'POST'])
def data():
"""Return server side data."""
# defining columns
# - explicitly cast date to string, so string searching the date
# will search a date formatted equal to how it is presented
# in the table
columns = [
# ColumnDT(cast(BookMain.id, db.Integer)),
ColumnDT(BookMain.id),
ColumnDT(BookMain.isbn),
ColumnDT(BookMain.title_short),
ColumnDT(BookMain.title),
ColumnDT(BookMain.catalogue),
ColumnDT(BookMain.cutter),
ColumnDT(BookMain.pub_year),
ColumnDT(BookMain.copy_info)
# ColumnDT(BookMain.get_link),
# ColumnDT(BookMain.note),
# ColumnDT(BookMain.reprint),
# ColumnDT(BookMain.removed),
# ColumnDT(BookMain.keepsite)
]
# defining the initial query depending on your purpose
query = db.session.query().select_from(BookMain)
# GET parameters
params = request.args.to_dict()
# instantiating a DataTable for the query and table needed
rowTable = DataTables(params, query, columns)
# returns what is needed by DataTable
return jsonify(rowTable.output_result())
@book.route('/get/<int:id>', methods=['GET', 'POST'])
def get_book():
return f"Hello book index : {id}"
@book.route('/post/', methods=['GET', 'POST'])
def post_book():
"""
post new book entry
:return:
"""
book = BookMain.query.all()
id = int(book[-1].id) + 1
print(f"id is : {id}")
form = EditBookForm()
if form.validate_on_submit():
book.id = form.id.data
book.isbn = form.isbn.data
book.title_short = form.title_short.data
book.title = form.title.data
book.catalogue = form.catalogue.data
book.cutter = form.cutter.data
book.pub_year = form.pub_year.data
book.copy_info = form.copy_info.data
book.get_link = form.get_link.data
book.note = form.note.data
book.reprint = form.reprint.data
book.removed = form.removed.data
book.keepsite = form.keepsite.data
db.session.add(book)
db.session.commit()
flash('Your book data has been added.', 'success')
return redirect(url_for('book.index'))
form.id.data = id
return render_template('book/edit_book.html', form=form)
@book.route('/edit/<int:id>', methods=['GET', 'POST'])
def edit_book(id):
"""
edit , put book data
:param id:
:return:
"""
form = EditBookForm()
book = BookMain.query.filter_by(id=id).first_or_404()
if form.validate_on_submit():
# book.id = form.id.data
book.isbn = form.isbn.data
book.title_short = form.title_short.data
book.title = form.title.data
book.catalogue = form.catalogue.data
book.cutter = form.cutter.data
book.pub_year = form.pub_year.data
book.copy_info = form.copy_info.data
book.get_link = form.get_link.data
book.note = form.note.data
book.reprint = form.reprint.data
book.removed = form.removed.data
book.keepsite = form.keepsite.data
db.session.add(book)
db.session.commit()
flash('Your book data has been updated.', 'success')
return redirect(url_for('book.index'))
form.id.data = book.id
form.isbn.data = book.isbn
form.title_short.data = book.title_short
form.title.data = book.title
form.catalogue.data = book.catalogue
form.cutter.data = book.cutter
form.pub_year.data = book.pub_year
form.copy_info.data = book.copy_info
form.get_link.data = book.get_link
form.note.data = book.note
form.reprint.data = book.reprint
form.removed.data = book.removed
form.keepsite.data = book.keepsite
return render_template('book/edit_book.html', form=form)
@book.route('/del/<int:id>', methods=['GET', 'POST'])
def del_book(id):
return f"Hello book index: del {id}"
@book.route('/hackmdmeta', methods=['GET', 'POST'])
def hackmd_meta():
"""
:return:
"""
from booktags.vendor.hackmd_meta import get_hackmdmeta
form = HackmdMeta()
if form.validate_on_submit():
booksn = str(form.booksn.data)
# print(f"booksn is : {booksn}")
temp = get_hackmdmeta(booksn)
# print(temp)
form.body.data = temp
# flash('Your book data has been updated.', 'success')
# return redirect(url_for('book.hackmd_meta'))
return render_template('book/hackmd_meta.html',form=form)
if __name__ == '__main__':
pass
| [
1,
529,
276,
1112,
420,
29958,
19095,
293,
29903,
1742,
29914,
10967,
11338,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
1678,
1342,
29889,
2272,
13,
1678,
3695,
26594,
13,
1678,
319,
2560,
1899,
1196,
2280,
304,
1065,
29784,
11446,
29889,
13,
1678,
584,
8552,
1266,
29901,
29871,
29906,
29900,
29896,
29929,
16498,
13,
1678,
584,
506,
1947,
29901,
350,
7230,
29899,
29941,
29899,
20216,
1509,
13,
15945,
29908,
13,
13,
29937,
8360,
776,
24557,
393,
508,
29915,
29873,
367,
4343,
1244,
29901,
13,
29937,
259,
448,
5222,
15368,
580,
2609,
367,
5557,
287,
515,
274,
2127,
495,
292,
5923,
13,
29937,
268,
7500,
10585,
29889,
13,
29937,
259,
448,
960,
278,
4770,
1445,
1649,
5352,
373,
263,
3883,
338,
263,
6198,
2224,
322,
13,
29937,
268,
278,
1857,
3884,
338,
3939,
411,
2897,
29889,
305,
3972,
3285,
385,
10240,
13,
29937,
268,
2224,
674,
367,
8833,
29889,
13,
13,
13,
13,
3166,
29784,
1053,
4050,
29918,
6886,
29892,
6684,
29892,
2009,
29892,
3142,
29918,
1454,
29892,
11013,
29892,
3126,
1598,
29892,
3784,
29918,
932,
13,
3166,
29784,
29918,
7507,
1053,
6464,
29918,
1792,
29892,
1480,
449,
29918,
1792,
29892,
6464,
29918,
12403,
29892,
1857,
29918,
1792,
13,
13,
3166,
869,
1053,
3143,
13,
3166,
29784,
29918,
2850,
284,
305,
6764,
1053,
679,
29918,
8382,
29918,
339,
6358,
13,
3166,
4576,
284,
305,
6764,
29889,
2850,
29889,
17471,
1053,
4320,
13,
3166,
1418,
271,
1849,
1053,
12481,
12972,
29892,
3630,
24924,
13,
13,
3166,
6317,
1053,
4817,
13,
3166,
6317,
1053,
4833,
13,
13,
3166,
869,
9514,
1053,
7641,
10967,
2500,
29892,
379,
547,
3487,
19346,
13,
29937,
515,
3143,
11338,
29889,
2585,
29889,
6500,
331,
397,
1379,
1053,
6726,
13,
3166,
3143,
11338,
29889,
1579,
1278,
932,
29889,
4299,
29889,
9794,
1053,
6726,
6330,
13,
13,
29937,
448,
2683,
2683,
2683,
1378,
3619,
6745,
1475,
13,
13,
29992,
2909,
29889,
7045,
29918,
932,
29918,
3827,
13,
1753,
1156,
29918,
3827,
29898,
5327,
1125,
13,
1678,
363,
2346,
297,
679,
29918,
8382,
29918,
339,
6358,
7295,
13,
4706,
565,
2346,
29889,
19708,
6736,
1857,
29918,
932,
29889,
2917,
1839,
8618,
17637,
29918,
29903,
27998,
29918,
4051,
29918,
13356,
24422,
29918,
15307,
2033,
29901,
13,
9651,
1857,
29918,
932,
29889,
21707,
29889,
27392,
29898,
13,
18884,
525,
29903,
677,
2346,
29901,
1273,
29879,
29905,
29876,
11507,
29901,
1273,
29879,
29905,
29876,
18984,
29901,
1273,
5847,
29905,
29876,
2677,
29901,
1273,
29879,
29905,
29876,
29915,
13,
18884,
1273,
313,
1972,
29889,
20788,
29892,
2346,
29889,
16744,
29892,
2346,
29889,
19708,
29892,
13,
462,
259,
2346,
29889,
4703,
876,
13,
1678,
736,
2933,
13,
13,
13,
29992,
2909,
29889,
13134,
11219,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
1753,
2380,
7295,
13,
1678,
396,
8277,
29922,
10967,
6330,
29889,
657,
29918,
497,
29918,
2909,
580,
13,
1678,
2346,
353,
6726,
6330,
29889,
1972,
13,
1678,
1813,
353,
2009,
29889,
5085,
29889,
657,
877,
3488,
742,
29871,
29896,
29892,
1134,
29922,
524,
29897,
13,
1678,
10203,
3381,
353,
2346,
29889,
2098,
29918,
1609,
29898,
4384,
29898,
10967,
6330,
29889,
333,
29892,
4833,
29889,
7798,
8106,
13573,
16976,
29898,
13,
4706,
1813,
29892,
639,
29918,
3488,
29922,
3784,
29918,
932,
29889,
2917,
1839,
8618,
17637,
29918,
8456,
8949,
29903,
29918,
13171,
29918,
7228,
1692,
7464,
13,
4706,
1059,
29918,
449,
29922,
8824,
29897,
13,
1678,
8277,
353,
10203,
3381,
29889,
7076,
13,
1678,
736,
4050,
29918,
6886,
877,
2909,
29914,
2248,
29889,
1420,
742,
12733,
29922,
12733,
29892,
13573,
3381,
29922,
13573,
3381,
29897,
13,
13,
29937,
732,
2909,
29889,
13134,
11219,
1761,
29914,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
29937,
822,
1051,
29918,
2909,
7295,
13,
29937,
268,
9995,
13,
29937,
13,
29937,
268,
584,
3207,
1746,
29901,
784,
1024,
13,
29937,
268,
584,
3207,
1797,
29901,
12066,
470,
5153,
13,
29937,
268,
584,
2457,
29901,
23011,
2346,
13,
29937,
268,
9995,
13,
29937,
268,
8277,
353,
6726,
6330,
29889,
657,
29918,
497,
29918,
2909,
580,
13,
29937,
268,
736,
4050,
29918,
6886,
877,
2909,
29914,
1761,
29918,
2909,
29889,
1420,
742,
12733,
29922,
12733,
29897,
13,
13,
29992,
2909,
29889,
13134,
11974,
1761,
1159,
13,
1753,
1051,
29918,
2909,
7295,
13,
1678,
9995,
1293,
4160,
411,
3630,
24924,
5277,
29871,
29896,
29889,
29896,
29900,
29889,
29916,
1213,
15945,
13,
1678,
736,
4050,
29918,
6886,
877,
2909,
29914,
1761,
29918,
2909,
29889,
1420,
1495,
13,
13,
13,
29992,
2909,
29889,
13134,
11219,
1272,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
1753,
848,
7295,
13,
1678,
9995,
11609,
1923,
2625,
848,
1213,
15945,
13,
1678,
396,
16184,
4341,
13,
1678,
396,
29871,
448,
9479,
4320,
2635,
304,
1347,
29892,
577,
1347,
11975,
278,
2635,
13,
1678,
396,
1678,
674,
2740,
263,
2635,
20917,
5186,
304,
920,
372,
338,
9132,
13,
1678,
396,
1678,
297,
278,
1591,
13,
1678,
4341,
353,
518,
13,
4706,
396,
12481,
12972,
29898,
4384,
29898,
10967,
6330,
29889,
333,
29892,
4833,
29889,
7798,
8243,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
333,
511,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
275,
11197,
511,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
3257,
29918,
12759,
511,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
3257,
511,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
28045,
434,
511,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
29883,
6463,
511,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
5467,
29918,
6360,
511,
13,
4706,
12481,
12972,
29898,
10967,
6330,
29889,
8552,
29918,
3888,
29897,
13,
4706,
396,
12481,
12972,
29898,
10967,
6330,
29889,
657,
29918,
2324,
511,
13,
4706,
396,
12481,
12972,
29898,
10967,
6330,
29889,
6812,
511,
13,
4706,
396,
12481,
12972,
29898,
10967,
6330,
29889,
276,
2158,
511,
13,
4706,
396,
12481,
12972,
29898,
10967,
6330,
29889,
1745,
8238,
511,
13,
4706,
396,
12481,
12972,
29898,
10967,
6330,
29889,
446,
8961,
568,
29897,
13,
1678,
4514,
13,
13,
1678,
396,
16184,
278,
2847,
2346,
8679,
373,
596,
6437,
13,
1678,
2346,
353,
4833,
29889,
7924,
29889,
1972,
2141,
2622,
29918,
3166,
29898,
10967,
6330,
29897,
13,
13,
13,
1678,
396,
12354,
4128,
13,
1678,
8636,
353,
2009,
29889,
5085,
29889,
517,
29918,
8977,
580,
13,
13,
13,
1678,
396,
13213,
1218,
263,
3630,
3562,
363,
278,
2346,
322,
1591,
4312,
13,
1678,
1948,
3562,
353,
3630,
24924,
29898,
7529,
29892,
2346,
29892,
4341,
29897,
13,
13,
1678,
396,
3639,
825,
338,
4312,
491,
3630,
3562,
13,
1678,
736,
4390,
1598,
29898,
798,
3562,
29889,
4905,
29918,
2914,
3101,
13,
13,
13,
13,
29992,
2909,
29889,
13134,
11219,
657,
29914,
29966,
524,
29901,
333,
29958,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
1753,
679,
29918,
2909,
7295,
13,
1678,
736,
285,
29908,
10994,
3143,
2380,
584,
426,
333,
5038,
13,
13,
13,
29992,
2909,
29889,
13134,
11219,
2490,
29914,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
1753,
1400,
29918,
2909,
7295,
13,
1678,
9995,
13,
1678,
1400,
716,
3143,
6251,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
3143,
353,
6726,
6330,
29889,
1972,
29889,
497,
580,
13,
1678,
1178,
353,
938,
29898,
2909,
14352,
29896,
1822,
333,
29897,
718,
29871,
29896,
13,
1678,
1596,
29898,
29888,
29908,
333,
338,
584,
426,
333,
27195,
13,
1678,
883,
353,
7641,
10967,
2500,
580,
13,
1678,
565,
883,
29889,
15480,
29918,
265,
29918,
7892,
7295,
13,
4706,
3143,
29889,
333,
353,
883,
29889,
333,
29889,
1272,
13,
4706,
3143,
29889,
275,
11197,
353,
883,
29889,
275,
11197,
29889,
1272,
13,
4706,
3143,
29889,
3257,
29918,
12759,
353,
883,
29889,
3257,
29918,
12759,
29889,
1272,
13,
4706,
3143,
29889,
3257,
353,
883,
29889,
3257,
29889,
1272,
13,
4706,
3143,
29889,
28045,
434,
353,
883,
29889,
28045,
434,
29889,
1272,
13,
4706,
3143,
29889,
29883,
6463,
353,
883,
29889,
29883,
6463,
29889,
1272,
13,
4706,
3143,
29889,
5467,
29918,
6360,
353,
883,
29889,
5467,
29918,
6360,
29889,
1272,
13,
4706,
3143,
29889,
8552,
29918,
3888,
353,
883,
29889,
8552,
29918,
3888,
29889,
1272,
13,
4706,
3143,
29889,
657,
29918,
2324,
353,
883,
29889,
657,
29918,
2324,
29889,
1272,
13,
4706,
3143,
29889,
6812,
353,
883,
29889,
6812,
29889,
1272,
13,
4706,
3143,
29889,
276,
2158,
353,
883,
29889,
276,
2158,
29889,
1272,
13,
4706,
3143,
29889,
1745,
8238,
353,
883,
29889,
1745,
8238,
29889,
1272,
13,
4706,
3143,
29889,
446,
8961,
568,
353,
883,
29889,
446,
8961,
568,
29889,
1272,
13,
13,
4706,
4833,
29889,
7924,
29889,
1202,
29898,
2909,
29897,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
4706,
11013,
877,
10858,
3143,
848,
756,
1063,
2715,
29889,
742,
525,
8698,
1495,
13,
4706,
736,
6684,
29898,
2271,
29918,
1454,
877,
2909,
29889,
2248,
8785,
13,
1678,
883,
29889,
333,
29889,
1272,
353,
1178,
13,
1678,
736,
4050,
29918,
6886,
877,
2909,
29914,
5628,
29918,
2909,
29889,
1420,
742,
883,
29922,
689,
29897,
13,
13,
13,
29992,
2909,
29889,
13134,
11219,
5628,
29914,
29966,
524,
29901,
333,
29958,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
1753,
3863,
29918,
2909,
29898,
333,
1125,
13,
1678,
9995,
13,
1678,
3863,
1919,
29871,
1925,
3143,
848,
13,
1678,
584,
3207,
1178,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
883,
353,
7641,
10967,
2500,
580,
13,
1678,
3143,
353,
6726,
6330,
29889,
1972,
29889,
4572,
29918,
1609,
29898,
333,
29922,
333,
467,
4102,
29918,
272,
29918,
29946,
29900,
29946,
580,
13,
1678,
565,
883,
29889,
15480,
29918,
265,
29918,
7892,
7295,
13,
4706,
396,
3143,
29889,
333,
353,
883,
29889,
333,
29889,
1272,
13,
4706,
3143,
29889,
275,
11197,
353,
883,
29889,
275,
11197,
29889,
1272,
13,
4706,
3143,
29889,
3257,
29918,
12759,
353,
883,
29889,
3257,
29918,
12759,
29889,
1272,
13,
4706,
3143,
29889,
3257,
353,
883,
29889,
3257,
29889,
1272,
13,
4706,
3143,
29889,
28045,
434,
353,
883,
29889,
28045,
434,
29889,
1272,
13,
4706,
3143,
29889,
29883,
6463,
353,
883,
29889,
29883,
6463,
29889,
1272,
13,
4706,
3143,
29889,
5467,
29918,
6360,
353,
883,
29889,
5467,
29918,
6360,
29889,
1272,
13,
4706,
3143,
29889,
8552,
29918,
3888,
353,
883,
29889,
8552,
29918,
3888,
29889,
1272,
13,
4706,
3143,
29889,
657,
29918,
2324,
353,
883,
29889,
657,
29918,
2324,
29889,
1272,
13,
4706,
3143,
29889,
6812,
353,
883,
29889,
6812,
29889,
1272,
13,
4706,
3143,
29889,
276,
2158,
353,
883,
29889,
276,
2158,
29889,
1272,
13,
4706,
3143,
29889,
1745,
8238,
353,
883,
29889,
1745,
8238,
29889,
1272,
13,
4706,
3143,
29889,
446,
8961,
568,
353,
883,
29889,
446,
8961,
568,
29889,
1272,
13,
13,
4706,
4833,
29889,
7924,
29889,
1202,
29898,
2909,
29897,
13,
4706,
4833,
29889,
7924,
29889,
15060,
580,
13,
4706,
11013,
877,
10858,
3143,
848,
756,
1063,
4784,
29889,
742,
525,
8698,
1495,
13,
4706,
736,
6684,
29898,
2271,
29918,
1454,
877,
2909,
29889,
2248,
8785,
13,
1678,
883,
29889,
333,
29889,
1272,
353,
3143,
29889,
333,
13,
1678,
883,
29889,
275,
11197,
29889,
1272,
353,
3143,
29889,
275,
11197,
13,
1678,
883,
29889,
3257,
29918,
12759,
29889,
1272,
353,
3143,
29889,
3257,
29918,
12759,
13,
1678,
883,
29889,
3257,
29889,
1272,
353,
3143,
29889,
3257,
13,
1678,
883,
29889,
28045,
434,
29889,
1272,
353,
3143,
29889,
28045,
434,
13,
1678,
883,
29889,
29883,
6463,
29889,
1272,
353,
3143,
29889,
29883,
6463,
13,
1678,
883,
29889,
5467,
29918,
6360,
29889,
1272,
353,
3143,
29889,
5467,
29918,
6360,
13,
1678,
883,
29889,
8552,
29918,
3888,
29889,
1272,
353,
3143,
29889,
8552,
29918,
3888,
13,
1678,
883,
29889,
657,
29918,
2324,
29889,
1272,
353,
3143,
29889,
657,
29918,
2324,
13,
1678,
883,
29889,
6812,
29889,
1272,
353,
3143,
29889,
6812,
13,
1678,
883,
29889,
276,
2158,
29889,
1272,
353,
3143,
29889,
276,
2158,
13,
1678,
883,
29889,
1745,
8238,
29889,
1272,
353,
3143,
29889,
1745,
8238,
13,
1678,
883,
29889,
446,
8961,
568,
29889,
1272,
353,
3143,
29889,
446,
8961,
568,
13,
1678,
736,
4050,
29918,
6886,
877,
2909,
29914,
5628,
29918,
2909,
29889,
1420,
742,
883,
29922,
689,
29897,
13,
13,
29992,
2909,
29889,
13134,
11219,
6144,
29914,
29966,
524,
29901,
333,
29958,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
1753,
628,
29918,
2909,
29898,
333,
1125,
13,
1678,
736,
285,
29908,
10994,
3143,
2380,
29901,
628,
426,
333,
5038,
13,
13,
29992,
2909,
29889,
13134,
11219,
29882,
547,
3487,
7299,
742,
3519,
29922,
1839,
7194,
742,
525,
5438,
11287,
13,
1753,
15833,
3487,
29918,
7299,
7295,
13,
1678,
9995,
13,
268,
13,
1678,
584,
2457,
29901,
29871,
13,
1678,
9995,
13,
1678,
515,
3143,
11338,
29889,
19167,
29889,
29882,
547,
3487,
29918,
7299,
1053,
679,
29918,
29882,
547,
3487,
7299,
13,
1678,
883,
353,
379,
547,
3487,
19346,
580,
13,
1678,
565,
883,
29889,
15480,
29918,
265,
29918,
7892,
7295,
13,
4706,
8277,
29876,
353,
851,
29898,
689,
29889,
12733,
29876,
29889,
1272,
29897,
13,
4706,
396,
1596,
29898,
29888,
29908,
12733,
29876,
338,
584,
426,
12733,
29876,
27195,
13,
4706,
5694,
353,
679,
29918,
29882,
547,
3487,
7299,
29898,
12733,
29876,
29897,
13,
4706,
396,
1596,
29898,
7382,
29897,
13,
4706,
883,
29889,
2587,
29889,
1272,
353,
5694,
13,
13,
4706,
396,
11013,
877,
10858,
3143,
848,
756,
1063,
4784,
29889,
742,
525,
8698,
1495,
13,
4706,
396,
736,
6684,
29898,
2271,
29918,
1454,
877,
2909,
29889,
29882,
547,
3487,
29918,
7299,
8785,
13,
13,
13,
1678,
736,
4050,
29918,
6886,
877,
2909,
29914,
29882,
547,
3487,
29918,
7299,
29889,
1420,
742,
689,
29922,
689,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1209,
13,
2
] |
src/token/__init__.py | mingz2013/py.script | 1 | 12169 | <gh_stars>1-10
# -*- coding:utf-8 -*-
"""
"""
__date__ = "14/12/2017"
__author__ = "zhaojm"
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
15945,
29908,
13,
1649,
1256,
1649,
353,
376,
29896,
29946,
29914,
29896,
29906,
29914,
29906,
29900,
29896,
29955,
29908,
13,
1649,
8921,
1649,
353,
376,
29920,
2350,
3848,
29885,
29908,
13,
2
] |
web-app/app/main/modules.py | sandbernar/anti-corona-crm | 0 | 48574 | <reponame>sandbernar/anti-corona-crm
from flask import request
import math
from wtforms import SelectField
from wtforms.validators import DataRequired
from flask_wtf import FlaskForm
class TableModule:
class WrongPageError(Exception):
pass
class WrongSortingParameterError(Exception):
pass
class TableForm(FlaskForm):
per_page = SelectField(choices=[(num, str(num)) for num in [5, 10, 25, 50, 100, 250, 500]],
default=5, validators=[DataRequired()])
def __init__(self, request, q, table_head, header_button = None, search_form = None, sort_param = None,
page = 1, per_page = 5, table_title = "", is_downloadable_xls = False, table_head_info = dict()):
if "page" in request.args:
try:
page = int(request.args["page"])
except ValueError:
raise self.WrongPageError
self.page = page
self.per_page = per_page
self.table_head_dict = table_head
self.table_head = []
self.request = request
self.q = q
self.header_button = header_button
self.search_form = search_form
self.sort_param = sort_param
self.search_params = []
self.is_downloadable_xls = is_downloadable_xls
self.xls_response = None
self.table_head_info = table_head_info
self.table_title = table_title
self.table_form = self.TableForm()
try:
per_page = request.args.get("per_page", None)
if per_page:
per_page = int(per_page)
self.table_form.per_page.default = per_page
self.per_page = per_page
except ValueError:
print("Wrong Per Page Value")
if page < 1:
raise self.WrongPageError
self.table_form.process()
self.total_len = q.count()
self.max_page = 0
self.search_table()
self.sort_table()
download_xls = request.args.get("download_xls", None)
if download_xls == self.__class__.__name__:
self.xls_response = self.download_xls()
# Should always be the last one to be called
self.entries = self.get_entries()
def print_entry(self, result):
pass
def get_entries(self):
if self.total_len:
entries = []
self.total_len = self.q.count()
for result in self.q.offset((self.page-1)*self.per_page).limit(self.per_page).all():
entry = {"data": self.print_entry(result)}
entries.append(entry)
entries = self.preprocess_entries(entries)
self.max_page = math.ceil(self.total_len/self.per_page)
return entries
def preprocess_entries(self, entries):
return entries
def search_table(self):
pass
def download_xls(self):
pass
def sort_table(self):
self.sort_by = None
self.sort_by_asc = True
if "sort_by_asc" in request.args:
self.sort_by = request.args["sort_by_asc"]
elif "sort_by_desc" in request.args:
self.sort_by = request.args["sort_by_desc"]
self.sort_by_asc = False
for i, th in enumerate(self.table_head_dict):
new_th = (th, th) if len(self.table_head_dict[th]) > 0 else th
self.table_head.append(new_th)
first = self.q.first()
if first and self.sort_param != None:
first = getattr(first, self.sort_param)
if len(self.q._entities) == 1:
first = [first]
if self.sort_by:
if first:
for m in first:
if self.sort_by in self.table_head_dict:
for s in self.table_head_dict[self.sort_by]:
if hasattr(m, "__dict__"):
if s in m.__dict__.keys():
param = getattr(type(m), s)
if self.sort_by_asc:
self.q = self.q.order_by(param.asc())
else:
self.q = self.q.order_by(param.desc()) | [
1,
529,
276,
1112,
420,
29958,
29879,
392,
5892,
279,
29914,
3656,
29899,
2616,
2681,
29899,
29883,
1758,
13,
3166,
29784,
1053,
2009,
13,
5215,
5844,
13,
3166,
281,
29873,
9514,
1053,
7605,
3073,
13,
3166,
281,
29873,
9514,
29889,
3084,
4097,
1053,
3630,
19347,
13,
3166,
29784,
29918,
29893,
13264,
1053,
2379,
1278,
2500,
13,
13,
1990,
6137,
7355,
29901,
13,
1678,
770,
399,
29373,
5074,
2392,
29898,
2451,
1125,
13,
4706,
1209,
13,
13,
1678,
770,
399,
29373,
13685,
292,
9329,
2392,
29898,
2451,
1125,
13,
4706,
1209,
13,
13,
1678,
770,
6137,
2500,
29898,
8754,
1278,
2500,
1125,
13,
4706,
639,
29918,
3488,
353,
7605,
3073,
29898,
1859,
1575,
11759,
29898,
1949,
29892,
851,
29898,
1949,
876,
363,
954,
297,
518,
29945,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
29945,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29906,
29945,
29900,
29892,
29871,
29945,
29900,
29900,
20526,
29871,
13,
462,
18884,
2322,
29922,
29945,
29892,
2854,
4097,
11759,
1469,
19347,
580,
2314,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2009,
29892,
3855,
29892,
1591,
29918,
2813,
29892,
4839,
29918,
3092,
353,
6213,
29892,
2740,
29918,
689,
353,
6213,
29892,
2656,
29918,
3207,
353,
6213,
29892,
13,
18884,
1813,
353,
29871,
29896,
29892,
639,
29918,
3488,
353,
29871,
29945,
29892,
1591,
29918,
3257,
353,
12633,
338,
29918,
10382,
519,
29918,
20267,
353,
7700,
29892,
1591,
29918,
2813,
29918,
3888,
353,
9657,
580,
1125,
13,
4706,
565,
376,
3488,
29908,
297,
2009,
29889,
5085,
29901,
13,
9651,
1018,
29901,
13,
18884,
1813,
353,
938,
29898,
3827,
29889,
5085,
3366,
3488,
20068,
13,
9651,
5174,
7865,
2392,
29901,
13,
18884,
12020,
1583,
29889,
29956,
29373,
5074,
2392,
13,
13,
4706,
1583,
29889,
3488,
353,
1813,
13,
4706,
1583,
29889,
546,
29918,
3488,
353,
639,
29918,
3488,
13,
4706,
1583,
29889,
2371,
29918,
2813,
29918,
8977,
353,
1591,
29918,
2813,
13,
4706,
1583,
29889,
2371,
29918,
2813,
353,
5159,
13,
4706,
1583,
29889,
3827,
353,
2009,
13,
4706,
1583,
29889,
29939,
353,
3855,
13,
4706,
1583,
29889,
6672,
29918,
3092,
353,
4839,
29918,
3092,
13,
4706,
1583,
29889,
4478,
29918,
689,
353,
2740,
29918,
689,
13,
4706,
1583,
29889,
6605,
29918,
3207,
353,
2656,
29918,
3207,
13,
13,
4706,
1583,
29889,
4478,
29918,
7529,
353,
5159,
13,
308,
13,
4706,
1583,
29889,
275,
29918,
10382,
519,
29918,
20267,
353,
338,
29918,
10382,
519,
29918,
20267,
13,
4706,
1583,
29889,
20267,
29918,
5327,
353,
6213,
13,
13,
4706,
1583,
29889,
2371,
29918,
2813,
29918,
3888,
353,
1591,
29918,
2813,
29918,
3888,
13,
13,
4706,
1583,
29889,
2371,
29918,
3257,
353,
1591,
29918,
3257,
13,
13,
4706,
1583,
29889,
2371,
29918,
689,
353,
1583,
29889,
3562,
2500,
580,
13,
4706,
1018,
29901,
13,
9651,
639,
29918,
3488,
353,
2009,
29889,
5085,
29889,
657,
703,
546,
29918,
3488,
613,
6213,
29897,
13,
9651,
565,
639,
29918,
3488,
29901,
13,
18884,
639,
29918,
3488,
353,
938,
29898,
546,
29918,
3488,
29897,
13,
18884,
1583,
29889,
2371,
29918,
689,
29889,
546,
29918,
3488,
29889,
4381,
353,
639,
29918,
3488,
13,
18884,
1583,
29889,
546,
29918,
3488,
353,
639,
29918,
3488,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
1596,
703,
29956,
29373,
2431,
9305,
7865,
1159,
308,
13,
13,
4706,
565,
1813,
529,
29871,
29896,
29901,
13,
9651,
12020,
1583,
29889,
29956,
29373,
5074,
2392,
13,
4706,
1583,
29889,
2371,
29918,
689,
29889,
5014,
580,
13,
13,
4706,
1583,
29889,
7827,
29918,
2435,
353,
3855,
29889,
2798,
580,
13,
4706,
1583,
29889,
3317,
29918,
3488,
353,
29871,
29900,
13,
13,
4706,
1583,
29889,
4478,
29918,
2371,
580,
13,
4706,
1583,
29889,
6605,
29918,
2371,
580,
13,
13,
4706,
5142,
29918,
20267,
353,
2009,
29889,
5085,
29889,
657,
703,
10382,
29918,
20267,
613,
6213,
29897,
13,
4706,
565,
5142,
29918,
20267,
1275,
1583,
17255,
1990,
1649,
17255,
978,
1649,
29901,
13,
9651,
1583,
29889,
20267,
29918,
5327,
353,
1583,
29889,
10382,
29918,
20267,
580,
13,
13,
4706,
396,
10575,
2337,
367,
278,
1833,
697,
304,
367,
2000,
13,
4706,
1583,
29889,
26586,
353,
1583,
29889,
657,
29918,
26586,
580,
13,
13,
1678,
822,
1596,
29918,
8269,
29898,
1311,
29892,
1121,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
679,
29918,
26586,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
7827,
29918,
2435,
29901,
13,
9651,
9976,
353,
5159,
13,
13,
9651,
1583,
29889,
7827,
29918,
2435,
353,
1583,
29889,
29939,
29889,
2798,
580,
13,
632,
13,
9651,
363,
1121,
297,
1583,
29889,
29939,
29889,
10289,
3552,
1311,
29889,
3488,
29899,
29896,
11877,
1311,
29889,
546,
29918,
3488,
467,
13400,
29898,
1311,
29889,
546,
29918,
3488,
467,
497,
7295,
13,
18884,
6251,
353,
8853,
1272,
1115,
1583,
29889,
2158,
29918,
8269,
29898,
2914,
2915,
13,
18884,
9976,
29889,
4397,
29898,
8269,
29897,
13,
13,
9651,
9976,
353,
1583,
29889,
1457,
5014,
29918,
26586,
29898,
26586,
29897,
13,
13,
9651,
1583,
29889,
3317,
29918,
3488,
353,
5844,
29889,
27696,
29898,
1311,
29889,
7827,
29918,
2435,
29914,
1311,
29889,
546,
29918,
3488,
29897,
13,
13,
9651,
736,
9976,
13,
13,
1678,
822,
758,
5014,
29918,
26586,
29898,
1311,
29892,
9976,
1125,
13,
4706,
736,
9976,
13,
13,
1678,
822,
2740,
29918,
2371,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
5142,
29918,
20267,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
2656,
29918,
2371,
29898,
1311,
1125,
13,
4706,
1583,
29889,
6605,
29918,
1609,
353,
6213,
13,
4706,
1583,
29889,
6605,
29918,
1609,
29918,
6151,
353,
5852,
13,
308,
13,
4706,
565,
376,
6605,
29918,
1609,
29918,
6151,
29908,
297,
2009,
29889,
5085,
29901,
13,
9651,
1583,
29889,
6605,
29918,
1609,
353,
2009,
29889,
5085,
3366,
6605,
29918,
1609,
29918,
6151,
3108,
13,
4706,
25342,
376,
6605,
29918,
1609,
29918,
14273,
29908,
297,
2009,
29889,
5085,
29901,
13,
9651,
1583,
29889,
6605,
29918,
1609,
353,
2009,
29889,
5085,
3366,
6605,
29918,
1609,
29918,
14273,
3108,
13,
9651,
1583,
29889,
6605,
29918,
1609,
29918,
6151,
353,
7700,
13,
13,
4706,
363,
474,
29892,
266,
297,
26985,
29898,
1311,
29889,
2371,
29918,
2813,
29918,
8977,
1125,
13,
9651,
716,
29918,
386,
353,
313,
386,
29892,
266,
29897,
565,
7431,
29898,
1311,
29889,
2371,
29918,
2813,
29918,
8977,
29961,
386,
2314,
1405,
29871,
29900,
1683,
266,
13,
9651,
1583,
29889,
2371,
29918,
2813,
29889,
4397,
29898,
1482,
29918,
386,
29897,
13,
13,
4706,
937,
353,
1583,
29889,
29939,
29889,
4102,
580,
13,
13,
4706,
565,
937,
322,
1583,
29889,
6605,
29918,
3207,
2804,
6213,
29901,
13,
9651,
937,
353,
679,
5552,
29898,
4102,
29892,
1583,
29889,
6605,
29918,
3207,
29897,
13,
13,
4706,
565,
7431,
29898,
1311,
29889,
29939,
3032,
296,
1907,
29897,
1275,
29871,
29896,
29901,
13,
9651,
937,
353,
518,
4102,
29962,
13,
4706,
565,
1583,
29889,
6605,
29918,
1609,
29901,
13,
9651,
565,
937,
29901,
13,
18884,
363,
286,
297,
937,
29901,
13,
462,
1678,
565,
1583,
29889,
6605,
29918,
1609,
297,
1583,
29889,
2371,
29918,
2813,
29918,
8977,
29901,
13,
462,
4706,
363,
269,
297,
1583,
29889,
2371,
29918,
2813,
29918,
8977,
29961,
1311,
29889,
6605,
29918,
1609,
5387,
13,
462,
9651,
565,
756,
5552,
29898,
29885,
29892,
376,
1649,
8977,
1649,
29908,
1125,
13,
462,
18884,
565,
269,
297,
286,
17255,
8977,
26914,
8149,
7295,
13,
462,
462,
1678,
1828,
353,
679,
5552,
29898,
1853,
29898,
29885,
511,
269,
29897,
13,
462,
462,
1678,
565,
1583,
29889,
6605,
29918,
1609,
29918,
6151,
29901,
13,
462,
462,
4706,
1583,
29889,
29939,
353,
1583,
29889,
29939,
29889,
2098,
29918,
1609,
29898,
3207,
29889,
6151,
3101,
13,
462,
462,
1678,
1683,
29901,
13,
462,
462,
4706,
1583,
29889,
29939,
353,
1583,
29889,
29939,
29889,
2098,
29918,
1609,
29898,
3207,
29889,
14273,
3101,
2
] |
solutions/problem_101.py | ksvr444/daily-coding-problem | 1,921 | 135529 | def is_prime(num, primes):
for prime in primes:
if prime == num:
return True
if not num % prime:
return False
return True
def get_primes(num):
limit = (num // 2) + 1
candidates = list()
primes = list()
for i in range(2, limit):
if is_prime(i, primes):
primes.append(i)
candidates.append((i, num - i))
new_candidates = list()
for first, second in candidates[::-1]:
if is_prime(second, primes):
primes.append(second)
new_candidates.append((first, second))
return new_candidates[-1]
assert get_primes(4) == (2, 2)
assert get_primes(10) == (3, 7)
assert get_primes(100) == (3, 97)
| [
1,
822,
338,
29918,
10080,
29898,
1949,
29892,
544,
1355,
1125,
13,
1678,
363,
6019,
297,
544,
1355,
29901,
13,
4706,
565,
6019,
1275,
954,
29901,
13,
9651,
736,
5852,
13,
4706,
565,
451,
954,
1273,
6019,
29901,
13,
9651,
736,
7700,
13,
1678,
736,
5852,
13,
13,
13,
1753,
679,
29918,
558,
1355,
29898,
1949,
1125,
13,
1678,
4046,
353,
313,
1949,
849,
29871,
29906,
29897,
718,
29871,
29896,
13,
13,
1678,
21669,
353,
1051,
580,
13,
1678,
544,
1355,
353,
1051,
580,
13,
1678,
363,
474,
297,
3464,
29898,
29906,
29892,
4046,
1125,
13,
4706,
565,
338,
29918,
10080,
29898,
29875,
29892,
544,
1355,
1125,
13,
9651,
544,
1355,
29889,
4397,
29898,
29875,
29897,
13,
9651,
21669,
29889,
4397,
3552,
29875,
29892,
954,
448,
474,
876,
13,
13,
1678,
716,
29918,
29883,
5380,
1078,
353,
1051,
580,
13,
1678,
363,
937,
29892,
1473,
297,
21669,
29961,
1057,
29899,
29896,
5387,
13,
4706,
565,
338,
29918,
10080,
29898,
7496,
29892,
544,
1355,
1125,
13,
9651,
544,
1355,
29889,
4397,
29898,
7496,
29897,
13,
9651,
716,
29918,
29883,
5380,
1078,
29889,
4397,
3552,
4102,
29892,
1473,
876,
13,
13,
1678,
736,
716,
29918,
29883,
5380,
1078,
14352,
29896,
29962,
13,
13,
13,
9294,
679,
29918,
558,
1355,
29898,
29946,
29897,
1275,
313,
29906,
29892,
29871,
29906,
29897,
13,
9294,
679,
29918,
558,
1355,
29898,
29896,
29900,
29897,
1275,
313,
29941,
29892,
29871,
29955,
29897,
13,
9294,
679,
29918,
558,
1355,
29898,
29896,
29900,
29900,
29897,
1275,
313,
29941,
29892,
29871,
29929,
29955,
29897,
13,
2
] |
Linux_Android_Classification/Src/GridSearchCV/SVM/SVM_search.py | Syuukakou/DeepLook_into_Android-type_ELF | 0 | 1600741 | <reponame>Syuukakou/DeepLook_into_Android-type_ELF<gh_stars>0
from sklearn import svm
from Linux_Android_Classification.Src.data_process import get_firstN_rows_opcodes, data_process_opcodes
from Linux_Android_Classification.Src.common_libs import *
# from sklearn.ensemble import RandomForestClassifier
# from sklearn.tree import DecisionTreeClassifier
# from sklearn.naive_bayes import GaussianNB, MultinomialNB, ComplementNB, BernoulliNB, CategoricalNB
# from sklearn.neural_network import MLPClassifier
# r"../Files/opcodes624_fcns98-malicious.csv"
filepath = r"../../../Files/opcodes624_fcns249-malicious.csv"
data, label = data_process_opcodes(filepath)
# data, label = get_firstN_rows_opcodes(filepath)
print(data, label)
label = np.array(label)
result_params = []
lsvc_resluts = []
lsvc_recall = []
lsvc_f1 = []
lsvc_precision = []
# svc_results = []
# data_train, data_test, label_train, label_test = train_test_split(data, label, test_size=0.1, shuffle=True)
skf = StratifiedKFold(n_splits=10)
# skf.get_n_splits(data, label)
for train_index, test_index in skf.split(data, label):
results = {}
data_train, data_test = data[train_index], data[test_index]
label_train, label_test = label[train_index], label[test_index]
print("TRAIN: ", train_index, "TEST: ", test_index)
seed = 1
"""
'LinearSVC',
'SVC',
"""
models = ['LSVC']
# svm.NuSVC(random_state=seed, probability=True), ,
# svm.SVC(probability=True, random_state=seed)
clfs = [svm.LinearSVC(random_state=seed)]
# ,
# models[1]: {'C': [10, 100, 1000], 'kernel': ['linear', 'poly', 'rbf'], 'gamma': ['scale', 'auto']}
# models[0]: {'penalty': ['l2'], 'loss': ['hinge'], 'C': [1, 10, 100]
params = {
models[0]: {'penalty': ['l2'], 'loss': ['hinge'], 'C': [1, 100]}
}
for name, estimator in zip(models, clfs):
print(name)
clf = GridSearchCV(estimator, params[name], scoring='roc_auc', refit=True, n_jobs=-1, cv=10)
clf.fit(data_train, label_train)
print("best params: " + str(clf.best_params_))
print("best scores: " + str(clf.best_score_))
# print(clf.best_estimator_.feature_importance())
results[name] = {'best params': str(clf.best_params_), 'best scores': str(clf.best_score_)}
result_params.append(results)
# evaluate on the dataset
lsvc_params = ast.literal_eval(results["LSVC"]["best params"])
clf_lsvc = svm.LinearSVC(C=lsvc_params["C"], loss=lsvc_params["loss"], penalty=lsvc_params['penalty'])
clf_lsvc.fit(data_train, label_train)
label_predict = clf_lsvc.predict(data_test)
clf_lsvc_score = roc_auc_score(label_test, label_predict)
lsvc_resluts.append(clf_lsvc_score)
clf_lsvc_recall = recall_score(label_test, label_predict)
lsvc_recall.append(clf_lsvc_recall)
clf_lsvc_f1 = f1_score(label_test, label_predict)
lsvc_f1.append(clf_lsvc_f1)
clf_lsvc_precision = precision_score(label_test, label_predict)
lsvc_precision.append(clf_lsvc_precision)
print(clf_lsvc_score)
# print(clf_lsvc.coef_)
# svc_params = ast.literal_eval(results["SVC"]["best params"])
# clf_svc = svm.SVC(C=svc_params['C'], gamma=svc_params['gamma'], kernel=svc_params["kernel"])
# clf_svc.fit(data_train, label_train)
# clf_svc_score = clf_svc.score(data_test, label_test)
# svc_results.append(clf_svc_score)
# print(clf_svc_score)
# print(list(set(result_params)))
with open(r"results_1/opcodes_fcns_lsvc_best_params.json", "w") as bf:
json.dump(result_params, bf)
# with open(r"lsvc_results.txt", "w") as lf:
# for l in lsvc_resluts:
# lf.write("%s\n" % l)
with open(r"results_1/opcodes_fcns_lsvc_results.txt", "w") as sf:
for s in lsvc_resluts:
sf.write("%s\n" % s)
with open(r"results_1/opcodes_fcns_lsvc_recall.txt", "w") as rf:
for r in lsvc_recall:
rf.write("%s\n" % r)
with open(r"results_1/opcodes_fcns_lsvc_f1.txt", "w") as ff:
for f in lsvc_f1:
ff.write("%s\n" % f)
with open(r"results_1/opcodes_fcns_lsvc_precision.txt", "w") as pf:
for p in lsvc_precision:
pf.write("%s\n" % p)
# estimates = clf.predict_proba(data_test)
# y_test += estimates
# acc = accuracy_score()
| [
1,
529,
276,
1112,
420,
29958,
29903,
29891,
29884,
2679,
557,
283,
29914,
2772,
1022,
14959,
29918,
8941,
29918,
8136,
29899,
1853,
29918,
6670,
29943,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
2071,
19668,
1053,
3731,
29885,
13,
3166,
8074,
29918,
8136,
29918,
2385,
2450,
29889,
29903,
2214,
29889,
1272,
29918,
5014,
1053,
679,
29918,
4102,
29940,
29918,
5727,
29918,
459,
18137,
29892,
848,
29918,
5014,
29918,
459,
18137,
13,
3166,
8074,
29918,
8136,
29918,
2385,
2450,
29889,
29903,
2214,
29889,
9435,
29918,
10254,
1053,
334,
13,
29937,
515,
2071,
19668,
29889,
24031,
1053,
16968,
2831,
342,
2385,
3709,
13,
29937,
515,
2071,
19668,
29889,
8336,
1053,
3826,
2459,
9643,
2385,
3709,
13,
29937,
515,
2071,
19668,
29889,
1056,
573,
29918,
27495,
267,
1053,
22477,
23189,
29892,
9683,
262,
7615,
23189,
29892,
422,
2037,
23189,
29892,
6209,
5059,
492,
23189,
29892,
315,
20440,
936,
23189,
13,
29937,
515,
2071,
19668,
29889,
484,
3631,
29918,
11618,
1053,
341,
13208,
2385,
3709,
13,
13,
13,
29937,
364,
29908,
6995,
10547,
29914,
459,
18137,
29953,
29906,
29946,
29918,
13801,
1983,
29929,
29947,
29899,
5156,
14803,
29889,
7638,
29908,
13,
1445,
2084,
353,
364,
29908,
21546,
6995,
10547,
29914,
459,
18137,
29953,
29906,
29946,
29918,
13801,
1983,
29906,
29946,
29929,
29899,
5156,
14803,
29889,
7638,
29908,
13,
1272,
29892,
3858,
353,
848,
29918,
5014,
29918,
459,
18137,
29898,
1445,
2084,
29897,
13,
29937,
848,
29892,
3858,
353,
679,
29918,
4102,
29940,
29918,
5727,
29918,
459,
18137,
29898,
1445,
2084,
29897,
13,
13,
2158,
29898,
1272,
29892,
3858,
29897,
13,
1643,
353,
7442,
29889,
2378,
29898,
1643,
29897,
13,
13,
2914,
29918,
7529,
353,
5159,
13,
3137,
7071,
29918,
690,
29880,
8842,
353,
5159,
13,
3137,
7071,
29918,
3757,
497,
353,
5159,
13,
3137,
7071,
29918,
29888,
29896,
353,
5159,
13,
3137,
7071,
29918,
17990,
2459,
353,
5159,
13,
29937,
3731,
29883,
29918,
9902,
353,
5159,
13,
29937,
848,
29918,
14968,
29892,
848,
29918,
1688,
29892,
3858,
29918,
14968,
29892,
3858,
29918,
1688,
353,
7945,
29918,
1688,
29918,
5451,
29898,
1272,
29892,
3858,
29892,
1243,
29918,
2311,
29922,
29900,
29889,
29896,
29892,
528,
21897,
29922,
5574,
29897,
13,
808,
29888,
353,
3767,
271,
2164,
29968,
29943,
1025,
29898,
29876,
29918,
23579,
1169,
29922,
29896,
29900,
29897,
13,
29937,
2071,
29888,
29889,
657,
29918,
29876,
29918,
23579,
1169,
29898,
1272,
29892,
3858,
29897,
13,
1454,
7945,
29918,
2248,
29892,
1243,
29918,
2248,
297,
2071,
29888,
29889,
5451,
29898,
1272,
29892,
3858,
1125,
13,
1678,
2582,
353,
6571,
13,
1678,
848,
29918,
14968,
29892,
848,
29918,
1688,
353,
848,
29961,
14968,
29918,
2248,
1402,
848,
29961,
1688,
29918,
2248,
29962,
13,
1678,
3858,
29918,
14968,
29892,
3858,
29918,
1688,
353,
3858,
29961,
14968,
29918,
2248,
1402,
3858,
29961,
1688,
29918,
2248,
29962,
13,
1678,
1596,
703,
29911,
4717,
1177,
29901,
9162,
7945,
29918,
2248,
29892,
376,
18267,
29901,
9162,
1243,
29918,
2248,
29897,
13,
13,
1678,
16717,
353,
29871,
29896,
13,
1678,
9995,
13,
1678,
525,
12697,
7597,
29907,
742,
13,
1678,
525,
7597,
29907,
742,
13,
259,
9995,
13,
1678,
4733,
353,
6024,
29931,
7597,
29907,
2033,
13,
1678,
396,
3731,
29885,
29889,
29940,
29884,
7597,
29907,
29898,
8172,
29918,
3859,
29922,
26776,
29892,
6976,
29922,
5574,
511,
1919,
13,
1678,
396,
632,
3731,
29885,
29889,
7597,
29907,
29898,
22795,
3097,
29922,
5574,
29892,
4036,
29918,
3859,
29922,
26776,
29897,
13,
1678,
1067,
5847,
353,
518,
4501,
29885,
29889,
12697,
7597,
29907,
29898,
8172,
29918,
3859,
29922,
26776,
4638,
13,
13,
1678,
396,
1919,
13,
1678,
396,
308,
4733,
29961,
29896,
5387,
11117,
29907,
2396,
518,
29896,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29900,
1402,
525,
17460,
2396,
6024,
10660,
742,
525,
22678,
742,
525,
29878,
1635,
7464,
525,
4283,
2396,
6024,
7052,
742,
525,
6921,
2033,
29913,
13,
1678,
396,
4733,
29961,
29900,
5387,
11117,
2238,
18745,
2396,
6024,
29880,
29906,
7464,
525,
6758,
2396,
6024,
2790,
29872,
7464,
525,
29907,
2396,
518,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29900,
29900,
29962,
13,
1678,
8636,
353,
426,
13,
4706,
4733,
29961,
29900,
5387,
11117,
2238,
18745,
2396,
6024,
29880,
29906,
7464,
525,
6758,
2396,
6024,
2790,
29872,
7464,
525,
29907,
2396,
518,
29896,
29892,
29871,
29896,
29900,
29900,
12258,
13,
1678,
500,
13,
13,
1678,
363,
1024,
29892,
4844,
1061,
297,
14319,
29898,
9794,
29892,
1067,
5847,
1125,
13,
4706,
1596,
29898,
978,
29897,
13,
4706,
1067,
29888,
353,
11657,
7974,
15633,
29898,
342,
326,
1061,
29892,
8636,
29961,
978,
1402,
26654,
2433,
10198,
29918,
14766,
742,
2143,
277,
29922,
5574,
29892,
302,
29918,
9057,
29879,
10457,
29896,
29892,
13850,
29922,
29896,
29900,
29897,
13,
4706,
1067,
29888,
29889,
9202,
29898,
1272,
29918,
14968,
29892,
3858,
29918,
14968,
29897,
13,
13,
4706,
1596,
703,
13318,
8636,
29901,
376,
718,
851,
29898,
695,
29888,
29889,
13318,
29918,
7529,
29918,
876,
13,
4706,
1596,
703,
13318,
19435,
29901,
376,
718,
851,
29898,
695,
29888,
29889,
13318,
29918,
13628,
29918,
876,
13,
4706,
396,
1596,
29898,
695,
29888,
29889,
13318,
29918,
342,
326,
1061,
5396,
14394,
29918,
5215,
749,
3101,
13,
4706,
2582,
29961,
978,
29962,
353,
11117,
13318,
8636,
2396,
851,
29898,
695,
29888,
29889,
13318,
29918,
7529,
29918,
511,
525,
13318,
19435,
2396,
851,
29898,
695,
29888,
29889,
13318,
29918,
13628,
29918,
2915,
13,
4706,
1121,
29918,
7529,
29889,
4397,
29898,
9902,
29897,
13,
13,
1678,
396,
14707,
373,
278,
8783,
13,
1678,
301,
4501,
29883,
29918,
7529,
353,
8717,
29889,
20889,
284,
29918,
14513,
29898,
9902,
3366,
29931,
7597,
29907,
3108,
3366,
13318,
8636,
20068,
13,
1678,
1067,
29888,
29918,
3137,
7071,
353,
3731,
29885,
29889,
12697,
7597,
29907,
29898,
29907,
29922,
3137,
7071,
29918,
7529,
3366,
29907,
12436,
6410,
29922,
3137,
7071,
29918,
7529,
3366,
6758,
12436,
27368,
29922,
3137,
7071,
29918,
7529,
1839,
2238,
18745,
11287,
13,
1678,
1067,
29888,
29918,
3137,
7071,
29889,
9202,
29898,
1272,
29918,
14968,
29892,
3858,
29918,
14968,
29897,
13,
1678,
3858,
29918,
27711,
353,
1067,
29888,
29918,
3137,
7071,
29889,
27711,
29898,
1272,
29918,
1688,
29897,
13,
13,
1678,
1067,
29888,
29918,
3137,
7071,
29918,
13628,
353,
696,
29883,
29918,
14766,
29918,
13628,
29898,
1643,
29918,
1688,
29892,
3858,
29918,
27711,
29897,
13,
1678,
301,
4501,
29883,
29918,
690,
29880,
8842,
29889,
4397,
29898,
695,
29888,
29918,
3137,
7071,
29918,
13628,
29897,
13,
1678,
1067,
29888,
29918,
3137,
7071,
29918,
3757,
497,
353,
17386,
29918,
13628,
29898,
1643,
29918,
1688,
29892,
3858,
29918,
27711,
29897,
13,
1678,
301,
4501,
29883,
29918,
3757,
497,
29889,
4397,
29898,
695,
29888,
29918,
3137,
7071,
29918,
3757,
497,
29897,
13,
1678,
1067,
29888,
29918,
3137,
7071,
29918,
29888,
29896,
353,
285,
29896,
29918,
13628,
29898,
1643,
29918,
1688,
29892,
3858,
29918,
27711,
29897,
13,
1678,
301,
4501,
29883,
29918,
29888,
29896,
29889,
4397,
29898,
695,
29888,
29918,
3137,
7071,
29918,
29888,
29896,
29897,
13,
1678,
1067,
29888,
29918,
3137,
7071,
29918,
17990,
2459,
353,
16716,
29918,
13628,
29898,
1643,
29918,
1688,
29892,
3858,
29918,
27711,
29897,
13,
1678,
301,
4501,
29883,
29918,
17990,
2459,
29889,
4397,
29898,
695,
29888,
29918,
3137,
7071,
29918,
17990,
2459,
29897,
13,
13,
1678,
1596,
29898,
695,
29888,
29918,
3137,
7071,
29918,
13628,
29897,
13,
1678,
396,
1596,
29898,
695,
29888,
29918,
3137,
7071,
29889,
1111,
1389,
19925,
13,
13,
1678,
396,
3731,
29883,
29918,
7529,
353,
8717,
29889,
20889,
284,
29918,
14513,
29898,
9902,
3366,
7597,
29907,
3108,
3366,
13318,
8636,
20068,
13,
1678,
396,
1067,
29888,
29918,
4501,
29883,
353,
3731,
29885,
29889,
7597,
29907,
29898,
29907,
29922,
4501,
29883,
29918,
7529,
1839,
29907,
7464,
330,
2735,
29922,
4501,
29883,
29918,
7529,
1839,
4283,
7464,
8466,
29922,
4501,
29883,
29918,
7529,
3366,
17460,
20068,
13,
1678,
396,
1067,
29888,
29918,
4501,
29883,
29889,
9202,
29898,
1272,
29918,
14968,
29892,
3858,
29918,
14968,
29897,
13,
1678,
396,
1067,
29888,
29918,
4501,
29883,
29918,
13628,
353,
1067,
29888,
29918,
4501,
29883,
29889,
13628,
29898,
1272,
29918,
1688,
29892,
3858,
29918,
1688,
29897,
13,
1678,
396,
3731,
29883,
29918,
9902,
29889,
4397,
29898,
695,
29888,
29918,
4501,
29883,
29918,
13628,
29897,
13,
1678,
396,
1596,
29898,
695,
29888,
29918,
4501,
29883,
29918,
13628,
29897,
13,
13,
29937,
1596,
29898,
1761,
29898,
842,
29898,
2914,
29918,
7529,
4961,
13,
2541,
1722,
29898,
29878,
29908,
9902,
29918,
29896,
29914,
459,
18137,
29918,
13801,
1983,
29918,
3137,
7071,
29918,
13318,
29918,
7529,
29889,
3126,
613,
376,
29893,
1159,
408,
289,
29888,
29901,
13,
1678,
4390,
29889,
15070,
29898,
2914,
29918,
7529,
29892,
289,
29888,
29897,
13,
29937,
411,
1722,
29898,
29878,
29908,
3137,
7071,
29918,
9902,
29889,
3945,
613,
376,
29893,
1159,
408,
301,
29888,
29901,
13,
29937,
268,
363,
301,
297,
301,
4501,
29883,
29918,
690,
29880,
8842,
29901,
13,
29937,
308,
301,
29888,
29889,
3539,
11702,
29879,
29905,
29876,
29908,
1273,
301,
29897,
13,
2541,
1722,
29898,
29878,
29908,
9902,
29918,
29896,
29914,
459,
18137,
29918,
13801,
1983,
29918,
3137,
7071,
29918,
9902,
29889,
3945,
613,
376,
29893,
1159,
408,
18668,
29901,
13,
1678,
363,
269,
297,
301,
4501,
29883,
29918,
690,
29880,
8842,
29901,
13,
4706,
18668,
29889,
3539,
11702,
29879,
29905,
29876,
29908,
1273,
269,
29897,
13,
13,
2541,
1722,
29898,
29878,
29908,
9902,
29918,
29896,
29914,
459,
18137,
29918,
13801,
1983,
29918,
3137,
7071,
29918,
3757,
497,
29889,
3945,
613,
376,
29893,
1159,
408,
364,
29888,
29901,
13,
1678,
363,
364,
297,
301,
4501,
29883,
29918,
3757,
497,
29901,
13,
4706,
364,
29888,
29889,
3539,
11702,
29879,
29905,
29876,
29908,
1273,
364,
29897,
13,
13,
2541,
1722,
29898,
29878,
29908,
9902,
29918,
29896,
29914,
459,
18137,
29918,
13801,
1983,
29918,
3137,
7071,
29918,
29888,
29896,
29889,
3945,
613,
376,
29893,
1159,
408,
14336,
29901,
13,
1678,
363,
285,
297,
301,
4501,
29883,
29918,
29888,
29896,
29901,
13,
4706,
14336,
29889,
3539,
11702,
29879,
29905,
29876,
29908,
1273,
285,
29897,
13,
13,
2541,
1722,
29898,
29878,
29908,
9902,
29918,
29896,
29914,
459,
18137,
29918,
13801,
1983,
29918,
3137,
7071,
29918,
17990,
2459,
29889,
3945,
613,
376,
29893,
1159,
408,
282,
29888,
29901,
13,
1678,
363,
282,
297,
301,
4501,
29883,
29918,
17990,
2459,
29901,
13,
4706,
282,
29888,
29889,
3539,
11702,
29879,
29905,
29876,
29908,
1273,
282,
29897,
13,
13,
29937,
21875,
353,
1067,
29888,
29889,
27711,
29918,
771,
2291,
29898,
1272,
29918,
1688,
29897,
13,
29937,
343,
29918,
1688,
4619,
21875,
13,
29937,
1035,
353,
13600,
29918,
13628,
580,
13,
2
] |
src/services/StudentAppServicer.py | comword/TCD20-DP-DeepModel | 0 | 185392 | <reponame>comword/TCD20-DP-DeepModel<filename>src/services/StudentAppServicer.py
import src.gen_proto.student_pb2_grpc as student_pb2__grpc
class StudentAppServicer(student_pb2__grpc.StudentAppServicer):
def __init__(self):
pass
def UpPredictResult(self, request, context):
pass
def GetExams(self, request, context):
pass
def GetPredicts(self, request, context):
pass
def GetUserDetail(self, request, context):
pass
def PutUserDetail(self, request, context):
pass
def StreamVideo(self, request_iterator, context):
pass | [
1,
529,
276,
1112,
420,
29958,
510,
1742,
29914,
29911,
6530,
29906,
29900,
29899,
11191,
29899,
2772,
1022,
3195,
29966,
9507,
29958,
4351,
29914,
9916,
29914,
20791,
2052,
6889,
293,
261,
29889,
2272,
13,
5215,
4765,
29889,
1885,
29918,
17529,
29889,
18945,
29918,
24381,
29906,
29918,
629,
6739,
408,
8368,
29918,
24381,
29906,
1649,
629,
6739,
13,
13,
1990,
15740,
2052,
6889,
293,
261,
29898,
18945,
29918,
24381,
29906,
1649,
629,
6739,
29889,
20791,
2052,
6889,
293,
261,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
5020,
23084,
919,
3591,
29898,
1311,
29892,
2009,
29892,
3030,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
3617,
1252,
2232,
29898,
1311,
29892,
2009,
29892,
3030,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
3617,
23084,
919,
29879,
29898,
1311,
29892,
2009,
29892,
3030,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
3617,
2659,
16570,
29898,
1311,
29892,
2009,
29892,
3030,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
12065,
2659,
16570,
29898,
1311,
29892,
2009,
29892,
3030,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
13763,
15167,
29898,
1311,
29892,
2009,
29918,
17609,
29892,
3030,
1125,
13,
4706,
1209,
2
] |
steps/make/haxe.py | flipcoder/siege-tools | 6 | 85378 | #!/usr/bin/env python
import os
import sgmake
from common import Status
from common import Support
from common import Settings
from common.Plugin import Plugin
import subprocess
from common import call
def make(project):
cmd = [ 'haxe', 'compile.hxml' ]
try:
call(cmd)
except subprocess.CalledProcessError:
return Status.FAILURE
return Status.SUCCESS
def update(project):
pass
def compatible(project):
support = Support.MASK & (~Support.PROJECT)
if os.path.isfile("compile.hxml"):
support |= Support.PROJECT
return support
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
2897,
13,
5215,
269,
29887,
5675,
13,
3166,
3619,
1053,
16034,
13,
3166,
3619,
1053,
18601,
13,
3166,
3619,
1053,
19215,
13,
3166,
3619,
29889,
16288,
1053,
1858,
3851,
13,
5215,
1014,
5014,
13,
3166,
3619,
1053,
1246,
13,
13,
1753,
1207,
29898,
4836,
1125,
13,
13,
1678,
9920,
353,
518,
525,
29882,
1165,
29872,
742,
525,
12198,
29889,
29882,
3134,
29915,
4514,
13,
268,
13,
1678,
1018,
29901,
13,
4706,
1246,
29898,
9006,
29897,
13,
1678,
5174,
1014,
5014,
29889,
29907,
4212,
7032,
2392,
29901,
13,
4706,
736,
16034,
29889,
4519,
6227,
11499,
13,
13,
1678,
736,
16034,
29889,
14605,
26925,
13,
13,
1753,
2767,
29898,
4836,
1125,
13,
1678,
1209,
13,
268,
13,
1753,
15878,
29898,
4836,
1125,
13,
1678,
2304,
353,
18601,
29889,
1529,
16033,
669,
313,
30022,
14039,
29889,
8618,
17637,
29897,
13,
1678,
565,
2897,
29889,
2084,
29889,
275,
1445,
703,
12198,
29889,
29882,
3134,
29908,
1125,
13,
4706,
2304,
891,
29922,
18601,
29889,
8618,
17637,
13,
1678,
736,
2304,
13,
13,
2
] |
flying_desktop/__main__.py | roee30/flying_desktop | 1 | 127257 | """
Run the Flying Desktop application.
"""
import asyncio
import sys
import threading
import tkinter as tk
from .log import logging_setup
logging_setup()
from .utils import loop
from flying_desktop.app.main_window import AppWindow
def loop_worker(loop_: asyncio.AbstractEventLoop):
"""
Thread for running the asyncio event loop
"""
asyncio.set_event_loop(loop_)
loop_.run_forever()
def main():
loop_thread = threading.Thread(target=loop_worker, args=(loop,), daemon=True)
loop_thread.start()
root = tk.Tk()
app = AppWindow(loop, root)
app.pack(fill="both", expand=True)
root.mainloop()
if __name__ == "__main__":
sys.exit(main())
| [
1,
9995,
13,
6558,
278,
383,
5890,
2726,
6883,
2280,
29889,
13,
15945,
29908,
13,
5215,
408,
948,
3934,
13,
5215,
10876,
13,
5215,
3244,
292,
13,
5215,
18883,
1639,
408,
18883,
13,
13,
3166,
869,
1188,
1053,
12183,
29918,
14669,
13,
21027,
29918,
14669,
580,
13,
13,
13,
3166,
869,
13239,
1053,
2425,
13,
3166,
22764,
29918,
20858,
29889,
932,
29889,
3396,
29918,
7165,
1053,
2401,
5907,
13,
13,
13,
1753,
2425,
29918,
24602,
29898,
7888,
29918,
29901,
408,
948,
3934,
29889,
9118,
2624,
18405,
1125,
13,
1678,
9995,
13,
1678,
10480,
363,
2734,
278,
408,
948,
3934,
1741,
2425,
13,
1678,
9995,
13,
1678,
408,
948,
3934,
29889,
842,
29918,
3696,
29918,
7888,
29898,
7888,
19925,
13,
1678,
2425,
5396,
3389,
29918,
1079,
369,
580,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
2425,
29918,
7097,
353,
3244,
292,
29889,
4899,
29898,
5182,
29922,
7888,
29918,
24602,
29892,
6389,
7607,
7888,
29892,
511,
1146,
9857,
29922,
5574,
29897,
13,
1678,
2425,
29918,
7097,
29889,
2962,
580,
13,
1678,
3876,
353,
18883,
29889,
29911,
29895,
580,
13,
1678,
623,
353,
2401,
5907,
29898,
7888,
29892,
3876,
29897,
13,
1678,
623,
29889,
4058,
29898,
5589,
543,
20313,
613,
7985,
29922,
5574,
29897,
13,
13,
1678,
3876,
29889,
3396,
7888,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
10876,
29889,
13322,
29898,
3396,
3101,
13,
2
] |
fellowcrm/__init__.py | Fellow-Consulting-AG/fellowcrm | 0 | 145236 | from flask import Flask, render_template, request, session
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
from flask_login import LoginManager
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
from flask_babel import Babel
import os
from .config import DevelopmentConfig, TestConfig, ProductionConfig, DigitalocenDEV
# database handle
db = SQLAlchemy(session_options={"autoflush": False})
# encryptor handle
bcrypt = Bcrypt()
# manage user login
login_manager = LoginManager()
# function name of the login route that
# tells the path which facilitates authentication
login_manager.login_view = 'users.login'
def run_install(app_ctx):
from fellowcrm.install.routes import install
app_ctx.register_blueprint(install)
return app_ctx
def create_app(config_class=ProductionConfig):
app = Flask(__name__, instance_relative_config=True)
if os.getenv('FLASK_ENV') == 'development':
config_class = DevelopmentConfig()
elif os.getenv('FLASK_ENV') == 'DigitalocenDEV':
config_class = DigitalocenDEV()
elif os.getenv('FLASK_ENV') == 'production':
config_class = ProductionConfig()
elif os.getenv('FLASK_ENV') == 'testing':
config_class = TestConfig()
app.config.from_object(config_class)
configure_extensions(app)
with app.app_context():
# check if the config table exists, otherwise run install
engine = db.get_engine(app)
if not engine.dialect.has_table(engine, 'app_config'):
return run_install(app)
else:
from fellowcrm.settings.models import AppConfig
row = AppConfig.query.first()
if not row:
return run_install(app)
# application is installed so extends the config
from fellowcrm.settings.models import AppConfig, Currency, TimeZone
app_cfg = AppConfig.query.first()
app.config['def_currency'] = Currency.get_currency_by_id(app_cfg.default_currency)
app.config['def_tz'] = TimeZone.get_tz_by_id(app_cfg.default_timezone)
# include the routes
# from fellowcrm import routes
from fellowcrm.main.routes import main
from fellowcrm.users.routes import users
from fellowcrm.leads.routes import leads
from fellowcrm.accounts.routes import accounts
from fellowcrm.contacts.routes import contacts
from fellowcrm.deals.routes import deals
from fellowcrm.activities.routes import activities
from fellowcrm.settings.routes import settings
from fellowcrm.settings.app_routes import app_config
from fellowcrm.reports.routes import reports
from fellowcrm.picklists.routes import picklists
from fellowcrm.upgrade.routes import upgrade
# register routes with blueprint
app.register_blueprint(main)
app.register_blueprint(users)
app.register_blueprint(settings)
app.register_blueprint(app_config)
app.register_blueprint(leads)
app.register_blueprint(accounts)
app.register_blueprint(contacts)
app.register_blueprint(deals)
app.register_blueprint(activities)
app.register_blueprint(reports)
app.register_blueprint(picklists)
app.register_blueprint(upgrade)
return app
def configure_extensions(app):
"""configure flask extensions"""
#jwt.init_app(app)
app.url_map.strict_slashes = False
app.jinja_env.globals.update(zip=zip)
migrate = Migrate(app, db)
babel = Babel(app)
@babel.localeselector
def get_locale():
if 'language' in session:
if session['language'] is not None:
return session['language']
return 'en'
else:
return 'en'
@babel.timezoneselector
def get_timezone():
#user = getattr(g, 'user', None)
#if user is not None:
return user.timezone
manager = Manager(app)
manager.add_command('db', MigrateCommand)
login_manager.init_app(app)
db.init_app(app)
bcrypt.init_app(app)
| [
1,
515,
29784,
1053,
2379,
1278,
29892,
4050,
29918,
6886,
29892,
2009,
29892,
4867,
13,
3166,
29784,
29918,
2850,
284,
305,
6764,
1053,
3758,
2499,
305,
6764,
13,
3166,
29784,
29918,
12328,
4641,
1053,
350,
29883,
4641,
13,
3166,
29784,
29918,
7507,
1053,
19130,
3260,
13,
3166,
29784,
29918,
26983,
403,
1053,
341,
4481,
403,
29892,
341,
4481,
403,
6255,
13,
3166,
29784,
29918,
2154,
1053,
15629,
13,
3166,
29784,
29918,
28727,
1053,
350,
1107,
13,
13,
5215,
2897,
13,
13,
3166,
869,
2917,
1053,
14650,
3991,
29892,
4321,
3991,
29892,
19561,
3991,
29892,
15918,
542,
264,
2287,
29963,
13,
13,
29937,
2566,
4386,
13,
2585,
353,
3758,
2499,
305,
6764,
29898,
7924,
29918,
6768,
3790,
29908,
1300,
974,
29880,
1878,
1115,
7700,
1800,
13,
13,
29937,
27924,
272,
4386,
13,
12328,
4641,
353,
350,
29883,
4641,
580,
13,
13,
29937,
10933,
1404,
6464,
13,
7507,
29918,
12847,
353,
19130,
3260,
580,
13,
13,
29937,
740,
1024,
310,
278,
6464,
5782,
393,
13,
29937,
10603,
278,
2224,
607,
16089,
277,
1078,
10760,
13,
7507,
29918,
12847,
29889,
7507,
29918,
1493,
353,
525,
7193,
29889,
7507,
29915,
13,
13,
13,
13,
1753,
1065,
29918,
6252,
29898,
932,
29918,
13073,
1125,
13,
1678,
515,
10404,
29883,
1758,
29889,
6252,
29889,
27894,
1053,
2601,
13,
1678,
623,
29918,
13073,
29889,
9573,
29918,
9539,
2158,
29898,
6252,
29897,
13,
1678,
736,
623,
29918,
13073,
13,
13,
13,
13,
13,
1753,
1653,
29918,
932,
29898,
2917,
29918,
1990,
29922,
23665,
428,
3991,
1125,
13,
1678,
623,
353,
2379,
1278,
22168,
978,
1649,
29892,
2777,
29918,
22925,
29918,
2917,
29922,
5574,
29897,
13,
29871,
13,
1678,
565,
2897,
29889,
657,
6272,
877,
10536,
3289,
29968,
29918,
25838,
1495,
1275,
525,
25431,
2396,
13,
4706,
2295,
29918,
1990,
353,
14650,
3991,
580,
13,
1678,
25342,
2897,
29889,
657,
6272,
877,
10536,
3289,
29968,
29918,
25838,
1495,
1275,
525,
27103,
542,
264,
2287,
29963,
2396,
13,
4706,
2295,
29918,
1990,
353,
15918,
542,
264,
2287,
29963,
580,
13,
1678,
25342,
2897,
29889,
657,
6272,
877,
10536,
3289,
29968,
29918,
25838,
1495,
1275,
525,
24601,
2396,
13,
4706,
2295,
29918,
1990,
353,
19561,
3991,
580,
13,
1678,
25342,
2897,
29889,
657,
6272,
877,
10536,
3289,
29968,
29918,
25838,
1495,
1275,
525,
13424,
2396,
13,
4706,
2295,
29918,
1990,
353,
4321,
3991,
580,
13,
1678,
623,
29889,
2917,
29889,
3166,
29918,
3318,
29898,
2917,
29918,
1990,
29897,
13,
13,
1678,
10822,
29918,
24299,
29898,
932,
29897,
13,
13,
268,
13,
13,
1678,
411,
623,
29889,
932,
29918,
4703,
7295,
13,
4706,
396,
1423,
565,
278,
2295,
1591,
4864,
29892,
6467,
1065,
2601,
13,
4706,
13,
4706,
6012,
353,
4833,
29889,
657,
29918,
10599,
29898,
932,
29897,
13,
4706,
565,
451,
6012,
29889,
15321,
781,
29889,
5349,
29918,
2371,
29898,
10599,
29892,
525,
932,
29918,
2917,
29374,
13,
9651,
736,
1065,
29918,
6252,
29898,
932,
29897,
13,
4706,
1683,
29901,
13,
9651,
515,
10404,
29883,
1758,
29889,
11027,
29889,
9794,
1053,
2401,
3991,
13,
9651,
1948,
353,
2401,
3991,
29889,
1972,
29889,
4102,
580,
13,
9651,
565,
451,
1948,
29901,
13,
18884,
736,
1065,
29918,
6252,
29898,
932,
29897,
13,
268,
13,
4706,
396,
2280,
338,
5130,
577,
4988,
278,
2295,
13,
4706,
515,
10404,
29883,
1758,
29889,
11027,
29889,
9794,
1053,
2401,
3991,
29892,
315,
10880,
29892,
5974,
18482,
13,
4706,
623,
29918,
16859,
353,
2401,
3991,
29889,
1972,
29889,
4102,
580,
13,
4706,
623,
29889,
2917,
1839,
1753,
29918,
26095,
2033,
353,
315,
10880,
29889,
657,
29918,
26095,
29918,
1609,
29918,
333,
29898,
932,
29918,
16859,
29889,
4381,
29918,
26095,
29897,
13,
4706,
623,
29889,
2917,
1839,
1753,
29918,
17559,
2033,
353,
5974,
18482,
29889,
657,
29918,
17559,
29918,
1609,
29918,
333,
29898,
932,
29918,
16859,
29889,
4381,
29918,
2230,
8028,
29897,
13,
13,
4706,
396,
3160,
278,
12049,
13,
4706,
396,
515,
10404,
29883,
1758,
1053,
12049,
13,
13,
308,
13,
13,
4706,
515,
10404,
29883,
1758,
29889,
3396,
29889,
27894,
1053,
1667,
13,
4706,
515,
10404,
29883,
1758,
29889,
7193,
29889,
27894,
1053,
4160,
13,
4706,
515,
10404,
29883,
1758,
29889,
280,
7925,
29889,
27894,
1053,
11981,
13,
4706,
515,
10404,
29883,
1758,
29889,
10149,
29879,
29889,
27894,
1053,
15303,
13,
4706,
515,
10404,
29883,
1758,
29889,
12346,
29879,
29889,
27894,
1053,
25957,
13,
4706,
515,
10404,
29883,
1758,
29889,
311,
1338,
29889,
27894,
1053,
316,
1338,
13,
4706,
515,
10404,
29883,
1758,
29889,
11236,
1907,
29889,
27894,
1053,
14188,
13,
4706,
515,
10404,
29883,
1758,
29889,
11027,
29889,
27894,
1053,
6055,
13,
4706,
515,
10404,
29883,
1758,
29889,
11027,
29889,
932,
29918,
27894,
1053,
623,
29918,
2917,
13,
4706,
515,
10404,
29883,
1758,
29889,
276,
4011,
29889,
27894,
1053,
13676,
13,
4706,
515,
10404,
29883,
1758,
29889,
23945,
21513,
29889,
27894,
1053,
5839,
21513,
13,
4706,
515,
10404,
29883,
1758,
29889,
786,
8228,
29889,
27894,
1053,
14955,
13,
13,
4706,
396,
6036,
12049,
411,
7254,
2158,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
3396,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
7193,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
11027,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
932,
29918,
2917,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
280,
7925,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
10149,
29879,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
12346,
29879,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
311,
1338,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
11236,
1907,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
276,
4011,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
23945,
21513,
29897,
13,
4706,
623,
29889,
9573,
29918,
9539,
2158,
29898,
786,
8228,
29897,
13,
4706,
736,
623,
13,
13,
13,
1753,
10822,
29918,
24299,
29898,
932,
1125,
13,
1678,
9995,
17591,
29784,
17752,
15945,
29908,
13,
1678,
13,
1678,
396,
29926,
14554,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
268,
13,
1678,
623,
29889,
2271,
29918,
1958,
29889,
710,
919,
29918,
17057,
267,
353,
7700,
13,
1678,
623,
29889,
28789,
1764,
29918,
6272,
29889,
23705,
1338,
29889,
5504,
29898,
7554,
29922,
7554,
29897,
13,
1678,
9725,
403,
353,
341,
4481,
403,
29898,
932,
29892,
4833,
29897,
13,
13,
1678,
289,
1107,
353,
350,
1107,
29898,
932,
29897,
13,
13,
1678,
732,
28727,
29889,
2997,
968,
781,
272,
13,
1678,
822,
679,
29918,
23337,
7295,
13,
4706,
565,
525,
11675,
29915,
297,
4867,
29901,
13,
9651,
565,
4867,
1839,
11675,
2033,
338,
451,
6213,
29901,
13,
18884,
736,
4867,
1839,
11675,
2033,
13,
9651,
736,
525,
264,
29915,
13,
4706,
1683,
29901,
13,
9651,
736,
525,
264,
29915,
13,
1678,
732,
28727,
29889,
2230,
6626,
968,
781,
272,
13,
1678,
822,
679,
29918,
2230,
8028,
7295,
13,
4706,
396,
1792,
353,
679,
5552,
29898,
29887,
29892,
525,
1792,
742,
6213,
29897,
13,
13,
4706,
396,
361,
1404,
338,
451,
6213,
29901,
13,
4706,
736,
1404,
29889,
2230,
8028,
13,
13,
1678,
8455,
353,
15629,
29898,
932,
29897,
13,
1678,
8455,
29889,
1202,
29918,
6519,
877,
2585,
742,
341,
4481,
403,
6255,
29897,
13,
13,
1678,
6464,
29918,
12847,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
13,
13,
1678,
4833,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
289,
29883,
4641,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
13,
2
] |
main_copy.py | Kevincj/TwitterCopyFollowing | 0 | 111744 | <gh_stars>0
from requests_oauthlib import OAuth1Session
import os
import json
import sys, traceback
import numpy as np
import time
import random
import threading
from datetime import datetime
import configparser
def getOAuth():
global account_name
def load_api_key_set():
config = configparser.ConfigParser()
config.read("api.keys")
return config
api_key_set = load_api_key_set()
oauth = OAuth1Session(
api_key_set["DEFAULT"]["api_key"],
client_secret=api_key_set["DEFAULT"]["api_key_secret"],
resource_owner_key=api_key_set["DEFAULT"]["access_token"],
resource_owner_secret=api_key_set["DEFAULT"]["access_token_secret"]
)
if oauth:
print("Default OAuth OK.")
params = {
"screen_name": account_name
}
response = oauth.get(
"https://api.twitter.com/1.1/lists/list.json",
params = params
)
if response.status_code != 200:
print("Authorizing...")
request_token_url = "https://api.twitter.com/oauth/request_token"
oauth = OAuth1Session(api_key_set["DEFAULT"]['api_key'], client_secret=api_key_set["DEFAULT"]['api_key_secret'])
try:
fetch_response = oauth.fetch_request_token(request_token_url)
except ValueError:
print(
"There may have been an issue with the api_key or api_key_secret you entered."
)
resource_owner_key = fetch_response.get("oauth_token")
resource_owner_secret = fetch_response.get("oauth_token_secret")
print("Got OAuth token: %s" % resource_owner_key)
# Get authorization
base_authorization_url = "https://api.twitter.com/oauth/authorize"
authorization_url = oauth.authorization_url(base_authorization_url)
print("Please authorize via: %s" % authorization_url)
verifier = input("Enter your PIN here:")
# Get the access token
access_token_url = "https://api.twitter.com/oauth/access_token"
oauth = OAuth1Session(
api_key_set["DEFAULT"]["api_key"],
client_secret=api_key_set["DEFAULT"]["api_key_secret"],
resource_owner_key=resource_owner_key,
resource_owner_secret=resource_owner_secret,
verifier=verifier,
)
oauth_tokens = oauth.fetch_access_token(access_token_url)
access_token = oauth_tokens["oauth_token"]
access_token_secret = oauth_tokens["oauth_token_secret"]
# Make the request
oauth = OAuth1Session(
api_key_set["DEFAULT"]["api_key"],
client_secret=api_key_set["DEFAULT"]["api_key_secret"],
resource_owner_key=access_token,
resource_owner_secret=access_token_secret,
)
api_key_set["DEFAULT"]["access_token"] = access_token
api_key_set["DEFAULT"]["access_token_secret"] = access_token_secret
with open("api.keys", 'w') as f:
api_key_set.write(f)
if oauth:
print("OAuth OK.")
return oauth
else:
print("OAuth failed. Please try again.")
return None
def get_list_members(list_id, count = 2000):
ids = []
cursor = -1
while cursor != 0:
params = {
"count": count,
"list_id": list_id,
"cursor": cursor
}
response = oauth.get(
"https://api.twitter.com/1.1/lists/members.json",
params = params
)
if response.status_code == 200:
contents = json.loads(response.content.decode('utf8'))
ids += [str(content['id']) for content in contents['users']]
cursor = contents['next_cursor']
else:
print("get_like_ids", response.status_code, response.content)
break
return ids
def get_user_following(target_user, count = 2000):
ids = []
cursor = -1
while cursor != 0:
params = {
"count": count,
"screen_name": target_user,
"cursor": cursor
}
response = oauth.get(
"https://api.twitter.com/1.1/friends/ids.json",
params = params
)
if response.status_code == 200:
contents = json.loads(response.content.decode('utf8'))
ids += [str(content) for content in contents['ids']]
cursor = contents['next_cursor']
else:
print("get_user_following", response.status_code, response.content)
break
return ids
def copyFollowing(target_user, account):
global oauth
print("Time: %s" % time.ctime())
if type(target_user) == str:
ids = get_user_following(target_user)
else:
ids = target_user
print("%d users followed in total" % (len(ids)))
if type(account) == str:
id_existing = get_user_following(account)
else:
id_existing = account
print("%d users followed existing" % (len(id_existing)))
diff = list(set(ids) - set(id_existing))
print("%d users to add" % len(diff))
err_ret_ids = []
count = 0
limit = False
while diff:
sampled_id = diff[-1]
if sampled_id in pending_users:
diff.pop()
continue
response = oauth.post(
"https://api.twitter.com/1.1/friendships/create.json",
params = {
"user_id": sampled_id
}
)
if response.status_code == 200:
# print("Successfully followed", sampled_id)
response = oauth.post(
"https://api.twitter.com/1.1/friendships/update.json",
params = {
"user_id": sampled_id,
"retweets": "false"
}
)
if response.status_code != 200:
print("Disable retweets", response.status_code, response.content)
err_ret_ids.append(sampled_id)
if json.loads(response.content.decode('utf8'))["errors"][0]["code"] != 167:
break
else:
diff.pop()
count += 1
print(count, "...OK")
id_existing.append(sampled_id)
limit = False
else:
code = json.loads(response.content.decode('utf8'))["errors"][0]["code"]
if code == 160 or code == 162:
print(sampled_id, code)
pending_users.append(sampled_id)
diff.pop()
limit = False
continue
elif code == 161:
print("Last limit:", limit)
if limit: break
print("API limit...")
limit = True
time.sleep(60)
continue
else:
print("Follow", response.status_code, response.content)
break
time.sleep(np.random.randint(256))
with open("following.users", "w") as f:
json.dump(ids, f)
next_hour = None
account_name = sys.argv[1]
oauth = getOAuth()
dt = datetime.now()
while True:
dt = datetime.now()
if not next_hour:
next_hour = dt.hour
else:
print("Current hour: %d, waiting until: %d" % (dt.hour, next_hour))
while dt.hour != next_hour:
dt = datetime.now()
time.sleep(30)
continue
print("Run @", dt)
try:
with open("pending.users", "r") as f:
pending_users = json.load(f)
except:
pending_users = []
try:
with open("following.users", "r") as f:
account = json.load(f)
except:
account = account_name
if len(sys.argv) >= 3:
target = sys.argv[2]
else:
try:
with open("all.users", "r") as f:
target = json.load(f)
except:
target = []
try:
copyFollowing(target_user = target, account = account)
print("Finished.")
except KeyboardInterrupt:
pass
except Exception:
traceback.print_exc()
finally:
print("Saving...")
with open("pending.users", "w") as f:
json.dump(pending_users, f)
time.sleep(3600) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
7274,
29918,
23106,
1982,
1053,
438,
6444,
29896,
7317,
13,
5215,
2897,
13,
5215,
4390,
13,
5215,
10876,
29892,
9637,
1627,
13,
5215,
12655,
408,
7442,
13,
5215,
931,
13,
5215,
4036,
13,
5215,
3244,
292,
13,
3166,
12865,
1053,
12865,
13,
5215,
2295,
16680,
13,
13,
1753,
679,
29949,
6444,
7295,
13,
1678,
5534,
3633,
29918,
978,
13,
1678,
822,
2254,
29918,
2754,
29918,
1989,
29918,
842,
7295,
13,
4706,
2295,
353,
2295,
16680,
29889,
3991,
11726,
580,
13,
4706,
2295,
29889,
949,
703,
2754,
29889,
8149,
1159,
13,
4706,
736,
2295,
13,
13,
1678,
7882,
29918,
1989,
29918,
842,
353,
2254,
29918,
2754,
29918,
1989,
29918,
842,
580,
13,
1678,
288,
5150,
353,
438,
6444,
29896,
7317,
29898,
13,
4706,
7882,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
2754,
29918,
1989,
12436,
13,
4706,
3132,
29918,
19024,
29922,
2754,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
2754,
29918,
1989,
29918,
19024,
12436,
13,
4706,
6503,
29918,
20348,
29918,
1989,
29922,
2754,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
5943,
29918,
6979,
12436,
13,
4706,
6503,
29918,
20348,
29918,
19024,
29922,
2754,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
5943,
29918,
6979,
29918,
19024,
3108,
13,
1678,
1723,
13,
13,
1678,
565,
288,
5150,
29901,
13,
4706,
1596,
703,
4592,
438,
6444,
9280,
23157,
13,
13,
13,
4706,
8636,
353,
426,
13,
9651,
376,
10525,
29918,
978,
1115,
3633,
29918,
978,
13,
4706,
500,
13,
4706,
2933,
353,
288,
5150,
29889,
657,
29898,
13,
9651,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
29896,
29889,
29896,
29914,
21513,
29914,
1761,
29889,
3126,
613,
13,
9651,
8636,
353,
8636,
13,
4706,
1723,
13,
4706,
565,
2933,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
29901,
13,
13,
9651,
1596,
703,
13720,
5281,
856,
1159,
13,
13,
9651,
2009,
29918,
6979,
29918,
2271,
353,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
23106,
29914,
3827,
29918,
6979,
29908,
13,
9651,
288,
5150,
353,
438,
6444,
29896,
7317,
29898,
2754,
29918,
1989,
29918,
842,
3366,
23397,
3108,
1839,
2754,
29918,
1989,
7464,
3132,
29918,
19024,
29922,
2754,
29918,
1989,
29918,
842,
3366,
23397,
3108,
1839,
2754,
29918,
1989,
29918,
19024,
11287,
13,
13,
9651,
1018,
29901,
13,
18884,
6699,
29918,
5327,
353,
288,
5150,
29889,
9155,
29918,
3827,
29918,
6979,
29898,
3827,
29918,
6979,
29918,
2271,
29897,
13,
9651,
5174,
7865,
2392,
29901,
13,
18884,
1596,
29898,
13,
462,
1678,
376,
8439,
1122,
505,
1063,
385,
2228,
411,
278,
7882,
29918,
1989,
470,
7882,
29918,
1989,
29918,
19024,
366,
7802,
1213,
13,
18884,
1723,
13,
13,
9651,
6503,
29918,
20348,
29918,
1989,
353,
6699,
29918,
5327,
29889,
657,
703,
23106,
29918,
6979,
1159,
13,
9651,
6503,
29918,
20348,
29918,
19024,
353,
6699,
29918,
5327,
29889,
657,
703,
23106,
29918,
6979,
29918,
19024,
1159,
13,
9651,
1596,
703,
29954,
327,
438,
6444,
5993,
29901,
1273,
29879,
29908,
1273,
6503,
29918,
20348,
29918,
1989,
29897,
13,
13,
9651,
396,
3617,
28733,
13,
9651,
2967,
29918,
8921,
2133,
29918,
2271,
353,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
23106,
29914,
8921,
675,
29908,
13,
9651,
28733,
29918,
2271,
353,
288,
5150,
29889,
8921,
2133,
29918,
2271,
29898,
3188,
29918,
8921,
2133,
29918,
2271,
29897,
13,
9651,
1596,
703,
12148,
4148,
675,
3025,
29901,
1273,
29879,
29908,
1273,
28733,
29918,
2271,
29897,
13,
9651,
1147,
3709,
353,
1881,
703,
10399,
596,
349,
1177,
1244,
29901,
1159,
13,
13,
9651,
396,
3617,
278,
2130,
5993,
13,
9651,
2130,
29918,
6979,
29918,
2271,
353,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
23106,
29914,
5943,
29918,
6979,
29908,
13,
9651,
288,
5150,
353,
438,
6444,
29896,
7317,
29898,
13,
18884,
7882,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
2754,
29918,
1989,
12436,
13,
18884,
3132,
29918,
19024,
29922,
2754,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
2754,
29918,
1989,
29918,
19024,
12436,
13,
18884,
6503,
29918,
20348,
29918,
1989,
29922,
10314,
29918,
20348,
29918,
1989,
29892,
13,
18884,
6503,
29918,
20348,
29918,
19024,
29922,
10314,
29918,
20348,
29918,
19024,
29892,
13,
18884,
1147,
3709,
29922,
369,
3709,
29892,
13,
9651,
1723,
13,
9651,
288,
5150,
29918,
517,
12360,
353,
288,
5150,
29889,
9155,
29918,
5943,
29918,
6979,
29898,
5943,
29918,
6979,
29918,
2271,
29897,
13,
13,
13,
9651,
2130,
29918,
6979,
353,
288,
5150,
29918,
517,
12360,
3366,
23106,
29918,
6979,
3108,
13,
9651,
2130,
29918,
6979,
29918,
19024,
353,
288,
5150,
29918,
517,
12360,
3366,
23106,
29918,
6979,
29918,
19024,
3108,
13,
13,
9651,
396,
8561,
278,
2009,
13,
9651,
288,
5150,
353,
438,
6444,
29896,
7317,
29898,
13,
18884,
7882,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
2754,
29918,
1989,
12436,
13,
18884,
3132,
29918,
19024,
29922,
2754,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
2754,
29918,
1989,
29918,
19024,
12436,
13,
18884,
6503,
29918,
20348,
29918,
1989,
29922,
5943,
29918,
6979,
29892,
13,
18884,
6503,
29918,
20348,
29918,
19024,
29922,
5943,
29918,
6979,
29918,
19024,
29892,
13,
9651,
1723,
13,
13,
9651,
7882,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
5943,
29918,
6979,
3108,
353,
2130,
29918,
6979,
13,
9651,
7882,
29918,
1989,
29918,
842,
3366,
23397,
3108,
3366,
5943,
29918,
6979,
29918,
19024,
3108,
353,
2130,
29918,
6979,
29918,
19024,
13,
13,
9651,
411,
1722,
703,
2754,
29889,
8149,
613,
525,
29893,
1495,
408,
285,
29901,
13,
18884,
7882,
29918,
1989,
29918,
842,
29889,
3539,
29898,
29888,
29897,
13,
13,
1678,
565,
288,
5150,
29901,
13,
4706,
1596,
703,
29949,
6444,
9280,
23157,
13,
4706,
736,
288,
5150,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
29949,
6444,
5229,
29889,
3529,
1018,
1449,
23157,
13,
4706,
736,
6213,
13,
13,
13,
1753,
679,
29918,
1761,
29918,
28109,
29898,
1761,
29918,
333,
29892,
2302,
353,
29871,
29906,
29900,
29900,
29900,
1125,
13,
1678,
18999,
353,
5159,
13,
1678,
10677,
353,
448,
29896,
13,
1678,
1550,
10677,
2804,
29871,
29900,
29901,
13,
4706,
8636,
353,
426,
13,
9651,
376,
2798,
1115,
2302,
29892,
13,
9651,
376,
1761,
29918,
333,
1115,
1051,
29918,
333,
29892,
13,
9651,
376,
18127,
1115,
10677,
13,
9651,
500,
13,
4706,
2933,
353,
288,
5150,
29889,
657,
29898,
13,
9651,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
29896,
29889,
29896,
29914,
21513,
29914,
28109,
29889,
3126,
613,
13,
9651,
8636,
353,
8636,
13,
9651,
1723,
13,
4706,
565,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
29901,
13,
9651,
8118,
353,
4390,
29889,
18132,
29898,
5327,
29889,
3051,
29889,
13808,
877,
9420,
29947,
8785,
13,
9651,
18999,
4619,
518,
710,
29898,
3051,
1839,
333,
11287,
363,
2793,
297,
8118,
1839,
7193,
2033,
29962,
13,
9651,
10677,
353,
8118,
1839,
4622,
29918,
18127,
2033,
13,
632,
13,
4706,
1683,
29901,
13,
9651,
1596,
703,
657,
29918,
4561,
29918,
4841,
613,
2933,
29889,
4882,
29918,
401,
29892,
2933,
29889,
3051,
29897,
13,
9651,
2867,
13,
1678,
736,
18999,
13,
13,
1753,
679,
29918,
1792,
29918,
23031,
292,
29898,
5182,
29918,
1792,
29892,
2302,
353,
29871,
29906,
29900,
29900,
29900,
1125,
13,
13,
1678,
18999,
353,
5159,
13,
1678,
10677,
353,
448,
29896,
13,
1678,
1550,
10677,
2804,
29871,
29900,
29901,
13,
4706,
8636,
353,
426,
13,
9651,
376,
2798,
1115,
2302,
29892,
13,
9651,
376,
10525,
29918,
978,
1115,
3646,
29918,
1792,
29892,
13,
9651,
376,
18127,
1115,
10677,
13,
9651,
500,
13,
4706,
2933,
353,
288,
5150,
29889,
657,
29898,
13,
9651,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
29896,
29889,
29896,
29914,
7932,
1975,
29914,
4841,
29889,
3126,
613,
13,
9651,
8636,
353,
8636,
13,
4706,
1723,
13,
4706,
565,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
29901,
13,
9651,
8118,
353,
4390,
29889,
18132,
29898,
5327,
29889,
3051,
29889,
13808,
877,
9420,
29947,
8785,
13,
9651,
18999,
4619,
518,
710,
29898,
3051,
29897,
363,
2793,
297,
8118,
1839,
4841,
2033,
29962,
13,
9651,
10677,
353,
8118,
1839,
4622,
29918,
18127,
2033,
13,
632,
13,
4706,
1683,
29901,
13,
9651,
1596,
703,
657,
29918,
1792,
29918,
23031,
292,
613,
2933,
29889,
4882,
29918,
401,
29892,
2933,
29889,
3051,
29897,
13,
9651,
2867,
13,
13,
29871,
13,
1678,
736,
18999,
13,
13,
1753,
3509,
29943,
2952,
292,
29898,
5182,
29918,
1792,
29892,
3633,
1125,
13,
1678,
5534,
288,
5150,
13,
1678,
1596,
703,
2481,
29901,
1273,
29879,
29908,
1273,
931,
29889,
312,
603,
3101,
13,
268,
13,
268,
13,
1678,
565,
1134,
29898,
5182,
29918,
1792,
29897,
1275,
851,
29901,
13,
4706,
18999,
353,
679,
29918,
1792,
29918,
23031,
292,
29898,
5182,
29918,
1792,
29897,
13,
1678,
1683,
29901,
13,
4706,
18999,
353,
3646,
29918,
1792,
13,
1678,
1596,
11702,
29881,
4160,
5643,
297,
3001,
29908,
1273,
313,
2435,
29898,
4841,
4961,
13,
13,
1678,
565,
1134,
29898,
10149,
29897,
1275,
851,
29901,
13,
4706,
1178,
29918,
735,
15423,
353,
679,
29918,
1792,
29918,
23031,
292,
29898,
10149,
29897,
13,
1678,
1683,
29901,
13,
4706,
1178,
29918,
735,
15423,
353,
3633,
13,
1678,
1596,
11702,
29881,
4160,
5643,
5923,
29908,
1273,
313,
2435,
29898,
333,
29918,
735,
15423,
4961,
13,
268,
13,
1678,
2923,
353,
1051,
29898,
842,
29898,
4841,
29897,
448,
731,
29898,
333,
29918,
735,
15423,
876,
13,
1678,
1596,
11702,
29881,
4160,
304,
788,
29908,
1273,
7431,
29898,
12765,
876,
13,
965,
13,
1678,
4589,
29918,
2267,
29918,
4841,
353,
5159,
13,
1678,
2302,
353,
29871,
29900,
13,
1678,
4046,
353,
7700,
13,
1678,
1550,
2923,
29901,
13,
4706,
4559,
29881,
29918,
333,
353,
2923,
14352,
29896,
29962,
13,
4706,
565,
4559,
29881,
29918,
333,
297,
28235,
29918,
7193,
29901,
13,
9651,
2923,
29889,
7323,
580,
13,
9651,
6773,
13,
4706,
2933,
353,
288,
5150,
29889,
2490,
29898,
13,
3986,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
29896,
29889,
29896,
29914,
18326,
9981,
29914,
3258,
29889,
3126,
613,
13,
3986,
8636,
353,
426,
13,
9651,
376,
1792,
29918,
333,
1115,
4559,
29881,
29918,
333,
13,
3986,
500,
13,
4706,
1723,
13,
4706,
565,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
29901,
13,
1678,
396,
308,
1596,
703,
14191,
3730,
5643,
613,
4559,
29881,
29918,
333,
29897,
13,
9651,
2933,
353,
288,
5150,
29889,
2490,
29898,
13,
795,
376,
991,
597,
2754,
29889,
24946,
29889,
510,
29914,
29896,
29889,
29896,
29914,
18326,
9981,
29914,
5504,
29889,
3126,
613,
13,
795,
8636,
353,
426,
13,
18884,
376,
1792,
29918,
333,
1115,
4559,
29881,
29918,
333,
29892,
13,
18884,
376,
2267,
705,
1691,
1115,
376,
4541,
29908,
13,
795,
500,
13,
9651,
1723,
13,
9651,
565,
2933,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
29901,
13,
18884,
1596,
703,
4205,
519,
3240,
705,
1691,
613,
2933,
29889,
4882,
29918,
401,
29892,
2933,
29889,
3051,
29897,
13,
18884,
4589,
29918,
2267,
29918,
4841,
29889,
4397,
29898,
11249,
29881,
29918,
333,
29897,
13,
18884,
565,
4390,
29889,
18132,
29898,
5327,
29889,
3051,
29889,
13808,
877,
9420,
29947,
8785,
3366,
12523,
3108,
29961,
29900,
29962,
3366,
401,
3108,
29871,
2804,
29871,
29896,
29953,
29955,
29901,
13,
462,
1678,
2867,
13,
9651,
1683,
29901,
13,
18884,
2923,
29889,
7323,
580,
13,
18884,
2302,
4619,
29871,
29896,
13,
18884,
1596,
29898,
2798,
29892,
29804,
8949,
1159,
13,
18884,
1178,
29918,
735,
15423,
29889,
4397,
29898,
11249,
29881,
29918,
333,
29897,
13,
9651,
4046,
353,
7700,
13,
4706,
1683,
29901,
13,
632,
13,
9651,
775,
353,
4390,
29889,
18132,
29898,
5327,
29889,
3051,
29889,
13808,
877,
9420,
29947,
8785,
3366,
12523,
3108,
29961,
29900,
29962,
3366,
401,
3108,
13,
9651,
565,
775,
1275,
29871,
29896,
29953,
29900,
470,
775,
1275,
29871,
29896,
29953,
29906,
29901,
13,
18884,
1596,
29898,
11249,
29881,
29918,
333,
29892,
775,
29897,
13,
18884,
28235,
29918,
7193,
29889,
4397,
29898,
11249,
29881,
29918,
333,
29897,
13,
18884,
2923,
29889,
7323,
580,
13,
18884,
4046,
353,
7700,
13,
18884,
6773,
13,
9651,
25342,
775,
1275,
29871,
29896,
29953,
29896,
29901,
13,
18884,
1596,
703,
8897,
4046,
29901,
613,
4046,
29897,
13,
18884,
565,
4046,
29901,
2867,
13,
18884,
1596,
703,
8787,
4046,
856,
1159,
13,
18884,
4046,
353,
5852,
13,
18884,
931,
29889,
17059,
29898,
29953,
29900,
29897,
13,
18884,
6773,
13,
9651,
1683,
29901,
13,
18884,
1596,
703,
29943,
2952,
613,
2933,
29889,
4882,
29918,
401,
29892,
2933,
29889,
3051,
29897,
13,
18884,
2867,
13,
4706,
931,
29889,
17059,
29898,
9302,
29889,
8172,
29889,
9502,
524,
29898,
29906,
29945,
29953,
876,
13,
268,
13,
13,
1678,
411,
1722,
703,
23031,
292,
29889,
7193,
613,
376,
29893,
1159,
408,
285,
29901,
13,
4706,
4390,
29889,
15070,
29898,
4841,
29892,
285,
29897,
13,
13,
13,
13,
13,
13,
13,
4622,
29918,
18721,
353,
6213,
13,
10149,
29918,
978,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
23106,
353,
679,
29949,
6444,
580,
13,
6008,
353,
12865,
29889,
3707,
580,
13,
13,
8000,
5852,
29901,
13,
1678,
11636,
353,
12865,
29889,
3707,
580,
13,
1678,
565,
451,
2446,
29918,
18721,
29901,
13,
4706,
2446,
29918,
18721,
353,
11636,
29889,
18721,
13,
1678,
1683,
29901,
13,
4706,
1596,
703,
7583,
7234,
29901,
1273,
29881,
29892,
10534,
2745,
29901,
1273,
29881,
29908,
1273,
313,
6008,
29889,
18721,
29892,
2446,
29918,
18721,
876,
13,
4706,
1550,
11636,
29889,
18721,
2804,
2446,
29918,
18721,
29901,
13,
9651,
11636,
353,
12865,
29889,
3707,
580,
13,
9651,
931,
29889,
17059,
29898,
29941,
29900,
29897,
13,
9651,
6773,
13,
13,
1678,
1596,
703,
6558,
732,
613,
11636,
29897,
13,
268,
13,
13,
13,
1678,
1018,
29901,
13,
4706,
411,
1722,
703,
29886,
2548,
29889,
7193,
613,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
28235,
29918,
7193,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
1678,
5174,
29901,
13,
4706,
28235,
29918,
7193,
353,
5159,
13,
13,
1678,
1018,
29901,
13,
4706,
411,
1722,
703,
23031,
292,
29889,
7193,
613,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
3633,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
1678,
5174,
29901,
13,
4706,
3633,
353,
3633,
29918,
978,
13,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
6736,
29871,
29941,
29901,
13,
4706,
3646,
353,
10876,
29889,
19218,
29961,
29906,
29962,
13,
1678,
1683,
29901,
13,
4706,
1018,
29901,
13,
9651,
411,
1722,
703,
497,
29889,
7193,
613,
376,
29878,
1159,
408,
285,
29901,
13,
18884,
3646,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
4706,
5174,
29901,
13,
9651,
3646,
353,
5159,
13,
13,
1678,
1018,
29901,
13,
4706,
3509,
29943,
2952,
292,
29898,
5182,
29918,
1792,
353,
3646,
29892,
3633,
353,
3633,
29897,
13,
4706,
1596,
703,
12881,
3276,
23157,
13,
1678,
5174,
7670,
3377,
4074,
6685,
29901,
13,
4706,
1209,
13,
1678,
5174,
8960,
29901,
13,
4706,
9637,
1627,
29889,
2158,
29918,
735,
29883,
580,
13,
1678,
7146,
29901,
13,
13,
4706,
1596,
703,
29903,
5555,
856,
1159,
13,
632,
13,
4706,
411,
1722,
703,
29886,
2548,
29889,
7193,
613,
376,
29893,
1159,
408,
285,
29901,
13,
9651,
4390,
29889,
15070,
29898,
29886,
2548,
29918,
7193,
29892,
285,
29897,
13,
1678,
931,
29889,
17059,
29898,
29941,
29953,
29900,
29900,
29897,
2
] |
dataingest/main_pub_kafka.py | sodadata/soda-streaming | 22 | 118032 | <reponame>sodadata/soda-streaming<filename>dataingest/main_pub_kafka.py
from queue import Queue
import time
import os
from utils.io import CustomAvroKafkaPublisher
from utils.configurator import RestConfigurator
import logging
# Set proper logging
LOGLEVEL = os.environ.get('LOGLEVEL', 'DEBUG').upper()
logging.basicConfig(format="%(asctime)s | %(levelname)s | %(threadName)s | %(message)s",
level=LOGLEVEL,
datefmt="%H:%M:%S")
if __name__ == "__main__":
#todo: create the customavrokafkapublisher automatically and add queue
all_queues = {"travel": Queue(), "food": Queue()}
travel_kafka_config = {
"bootstrap_server": os.getenv("BOOTSTRAP_SERVER", 'localhost:9092'),
"topic_name": "travel",
"topic_description": "travel"
}
travel_data_generation_rate_msg_sec = int(os.getenv("TRAVEL_RATE_MSG_SEC", 10))
travel_publisher = CustomAvroKafkaPublisher(kafka_config=travel_kafka_config,
data_generation_rate_msg_sec=travel_data_generation_rate_msg_sec,
queue=all_queues["travel"])
food_kafka_config = {
"bootstrap_server": os.getenv("BOOTSTRAP_SERVER", 'localhost:9092'),
"topic_name": "food",
"topic_description": "food"
}
food_data_generation_rate_msg_sec = int(os.getenv("FOOD_RATE_MSG_SEC", 5))
food_publisher = CustomAvroKafkaPublisher(kafka_config=food_kafka_config,
data_generation_rate_msg_sec=food_data_generation_rate_msg_sec,
queue=all_queues["food"])
restconfigthread = RestConfigurator(all_queues=all_queues)
restconfigthread.start()
publishers = [travel_publisher, food_publisher]
for publisher in publishers:
publisher.start()
#publisher.join()
| [
1,
529,
276,
1112,
420,
29958,
29879,
397,
7221,
29914,
29879,
8887,
29899,
5461,
292,
29966,
9507,
29958,
1272,
292,
342,
29914,
3396,
29918,
5467,
29918,
28510,
29889,
2272,
13,
3166,
9521,
1053,
5462,
434,
13,
5215,
931,
13,
5215,
2897,
13,
3166,
3667,
29879,
29889,
601,
1053,
8701,
12810,
307,
29968,
20817,
21076,
1674,
261,
13,
3166,
3667,
29879,
29889,
2917,
332,
1061,
1053,
11654,
3991,
332,
1061,
13,
13,
5215,
12183,
13,
13,
29937,
3789,
1571,
12183,
13,
14480,
1307,
29963,
6670,
353,
2897,
29889,
21813,
29889,
657,
877,
14480,
1307,
29963,
6670,
742,
525,
18525,
2824,
21064,
580,
13,
21027,
29889,
16121,
3991,
29898,
4830,
543,
29995,
29898,
294,
312,
603,
29897,
29879,
891,
1273,
29898,
5563,
978,
29897,
29879,
891,
1273,
29898,
7097,
1170,
29897,
29879,
891,
1273,
29898,
4906,
29897,
29879,
613,
13,
462,
1678,
3233,
29922,
14480,
1307,
29963,
6670,
29892,
13,
462,
1678,
2635,
23479,
543,
29995,
29950,
16664,
29924,
16664,
29903,
1159,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
396,
29873,
8144,
29901,
1653,
278,
2888,
485,
307,
26564,
21474,
431,
1674,
261,
6336,
322,
788,
9521,
13,
1678,
599,
29918,
802,
1041,
353,
8853,
3018,
955,
1115,
5462,
434,
3285,
376,
1181,
397,
1115,
5462,
434,
28296,
13,
13,
1678,
9850,
29918,
28510,
29918,
2917,
353,
426,
13,
4706,
376,
8704,
29918,
2974,
1115,
2897,
29889,
657,
6272,
703,
8456,
2891,
10810,
3301,
29918,
18603,
613,
525,
7640,
29901,
29929,
29900,
29929,
29906,
5477,
13,
4706,
376,
13010,
29918,
978,
1115,
376,
3018,
955,
613,
13,
4706,
376,
13010,
29918,
8216,
1115,
376,
3018,
955,
29908,
13,
1678,
500,
13,
1678,
9850,
29918,
1272,
29918,
4738,
362,
29918,
10492,
29918,
7645,
29918,
3471,
353,
938,
29898,
359,
29889,
657,
6272,
703,
29911,
4717,
29963,
6670,
29918,
29934,
3040,
29918,
4345,
29954,
29918,
1660,
29907,
613,
29871,
29896,
29900,
876,
13,
1678,
9850,
29918,
23679,
261,
353,
8701,
12810,
307,
29968,
20817,
21076,
1674,
261,
29898,
28510,
29918,
2917,
29922,
3018,
955,
29918,
28510,
29918,
2917,
29892,
13,
462,
462,
462,
848,
29918,
4738,
362,
29918,
10492,
29918,
7645,
29918,
3471,
29922,
3018,
955,
29918,
1272,
29918,
4738,
362,
29918,
10492,
29918,
7645,
29918,
3471,
29892,
13,
462,
462,
462,
9521,
29922,
497,
29918,
802,
1041,
3366,
3018,
955,
20068,
13,
13,
1678,
9687,
29918,
28510,
29918,
2917,
353,
426,
13,
4706,
376,
8704,
29918,
2974,
1115,
2897,
29889,
657,
6272,
703,
8456,
2891,
10810,
3301,
29918,
18603,
613,
525,
7640,
29901,
29929,
29900,
29929,
29906,
5477,
13,
4706,
376,
13010,
29918,
978,
1115,
376,
1181,
397,
613,
13,
4706,
376,
13010,
29918,
8216,
1115,
376,
1181,
397,
29908,
13,
1678,
500,
13,
1678,
9687,
29918,
1272,
29918,
4738,
362,
29918,
10492,
29918,
7645,
29918,
3471,
353,
938,
29898,
359,
29889,
657,
6272,
703,
5800,
13668,
29918,
29934,
3040,
29918,
4345,
29954,
29918,
1660,
29907,
613,
29871,
29945,
876,
13,
1678,
9687,
29918,
23679,
261,
353,
8701,
12810,
307,
29968,
20817,
21076,
1674,
261,
29898,
28510,
29918,
2917,
29922,
1181,
397,
29918,
28510,
29918,
2917,
29892,
13,
462,
462,
462,
1678,
848,
29918,
4738,
362,
29918,
10492,
29918,
7645,
29918,
3471,
29922,
1181,
397,
29918,
1272,
29918,
4738,
362,
29918,
10492,
29918,
7645,
29918,
3471,
29892,
13,
462,
462,
462,
1678,
9521,
29922,
497,
29918,
802,
1041,
3366,
1181,
397,
20068,
13,
13,
1678,
1791,
2917,
7097,
353,
11654,
3991,
332,
1061,
29898,
497,
29918,
802,
1041,
29922,
497,
29918,
802,
1041,
29897,
13,
1678,
1791,
2917,
7097,
29889,
2962,
580,
13,
13,
1678,
9805,
414,
353,
518,
3018,
955,
29918,
23679,
261,
29892,
9687,
29918,
23679,
261,
29962,
13,
1678,
363,
9805,
261,
297,
9805,
414,
29901,
13,
4706,
9805,
261,
29889,
2962,
580,
13,
4706,
396,
23679,
261,
29889,
7122,
580,
13,
13,
13,
13,
13,
13,
2
] |
custom_components/yahoofinance/__init__.py | Nag94/HomeAssistantConfig | 65 | 79755 | """
The Yahoo finance component.
https://github.com/iprak/yahoofinance
"""
from __future__ import annotations
from datetime import timedelta
import logging
from typing import Final, Union
from homeassistant.const import CONF_SCAN_INTERVAL
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType
import voluptuous as vol
from custom_components.yahoofinance.coordinator import YahooSymbolUpdateCoordinator
from .const import (
CONF_DECIMAL_PLACES,
CONF_INCLUDE_FIFTY_DAY_VALUES,
CONF_INCLUDE_POST_VALUES,
CONF_INCLUDE_PRE_VALUES,
CONF_INCLUDE_TWO_HUNDRED_DAY_VALUES,
CONF_SHOW_TRENDING_ICON,
CONF_SYMBOLS,
CONF_TARGET_CURRENCY,
DEFAULT_CONF_DECIMAL_PLACES,
DEFAULT_CONF_INCLUDE_FIFTY_DAY_VALUES,
DEFAULT_CONF_INCLUDE_POST_VALUES,
DEFAULT_CONF_INCLUDE_PRE_VALUES,
DEFAULT_CONF_INCLUDE_TWO_HUNDRED_DAY_VALUES,
DEFAULT_CONF_SHOW_TRENDING_ICON,
DOMAIN,
HASS_DATA_CONFIG,
HASS_DATA_COORDINATOR,
SERVICE_REFRESH,
)
_LOGGER = logging.getLogger(__name__)
DEFAULT_SCAN_INTERVAL: Final = timedelta(hours=6)
MINIMUM_SCAN_INTERVAL: Final = timedelta(seconds=30)
BASIC_SYMBOL_SCHEMA = vol.All(cv.string, vol.Upper)
COMPLEX_SYMBOL_SCHEMA = vol.All(
dict,
vol.Schema(
{
vol.Required("symbol"): BASIC_SYMBOL_SCHEMA,
vol.Optional(CONF_TARGET_CURRENCY): BASIC_SYMBOL_SCHEMA,
}
),
)
CONFIG_SCHEMA = vol.Schema(
{
DOMAIN: vol.Schema(
{
vol.Required(CONF_SYMBOLS): vol.All(
cv.ensure_list,
[vol.Any(BASIC_SYMBOL_SCHEMA, COMPLEX_SYMBOL_SCHEMA)],
),
vol.Optional(
CONF_SCAN_INTERVAL, default=DEFAULT_SCAN_INTERVAL
): vol.Any("none", "None", cv.positive_time_period),
vol.Optional(CONF_TARGET_CURRENCY): vol.All(cv.string, vol.Upper),
vol.Optional(
CONF_SHOW_TRENDING_ICON, default=DEFAULT_CONF_SHOW_TRENDING_ICON
): cv.boolean,
vol.Optional(
CONF_DECIMAL_PLACES, default=DEFAULT_CONF_DECIMAL_PLACES
): vol.Coerce(int),
vol.Optional(
CONF_INCLUDE_FIFTY_DAY_VALUES,
default=DEFAULT_CONF_INCLUDE_FIFTY_DAY_VALUES,
): cv.boolean,
vol.Optional(
CONF_INCLUDE_POST_VALUES, default=DEFAULT_CONF_INCLUDE_POST_VALUES
): cv.boolean,
vol.Optional(
CONF_INCLUDE_PRE_VALUES, default=DEFAULT_CONF_INCLUDE_PRE_VALUES
): cv.boolean,
vol.Optional(
CONF_INCLUDE_TWO_HUNDRED_DAY_VALUES,
default=DEFAULT_CONF_INCLUDE_TWO_HUNDRED_DAY_VALUES,
): cv.boolean,
}
)
},
# The complete HA configuration is passed down to`async_setup`, allow the extra keys.
extra=vol.ALLOW_EXTRA,
)
class SymbolDefinition:
"""Symbol definition."""
symbol: str
target_currency: str
def __init__(self, symbol: str, target_currency: Union[str, None] = None) -> None:
"""Create a new symbol definition."""
self.symbol = symbol
self.target_currency = target_currency
def __repr__(self) -> str:
"""Return the representation."""
return f"{self.symbol},{self.target_currency}"
def __eq__(self, other: any) -> bool:
"""Return the comparison."""
return (
isinstance(other, SymbolDefinition)
and self.symbol == other.symbol
and self.target_currency == other.target_currency
)
def __hash__(self) -> int:
"""Make hashable."""
return hash((self.symbol, self.target_currency))
def parse_scan_interval(scan_interval: Union[timedelta, str]) -> timedelta:
"""Parse and validate scan_interval."""
if isinstance(scan_interval, str):
if isinstance(scan_interval, str):
if scan_interval.lower() == "none":
scan_interval = None
else:
raise vol.Invalid(
f"Invalid {CONF_SCAN_INTERVAL} specified: {scan_interval}"
)
elif scan_interval < MINIMUM_SCAN_INTERVAL:
raise vol.Invalid("Scan interval should be at least 30 seconds.")
return scan_interval
def normalize_input(defined_symbols: list) -> tuple[list[str], list[SymbolDefinition]]:
"""Normalize input and remove duplicates."""
symbols = set()
symbol_definitions: list[SymbolDefinition] = []
for value in defined_symbols:
if isinstance(value, str):
if value not in symbols:
symbols.add(value)
symbol_definitions.append(SymbolDefinition(value))
else:
symbol = value["symbol"]
if symbol not in symbols:
symbols.add(symbol)
symbol_definitions.append(
SymbolDefinition(symbol, value.get(CONF_TARGET_CURRENCY))
)
return (list(symbols), symbol_definitions)
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the component."""
domain_config = config.get(DOMAIN, {})
defined_symbols = domain_config.get(CONF_SYMBOLS, [])
symbols, symbol_definitions = normalize_input(defined_symbols)
domain_config[CONF_SYMBOLS] = symbol_definitions
scan_interval = parse_scan_interval(domain_config.get(CONF_SCAN_INTERVAL))
# Populate parsed value into domain_config
domain_config[CONF_SCAN_INTERVAL] = scan_interval
coordinator = YahooSymbolUpdateCoordinator(symbols, hass, scan_interval)
# Refresh coordinator to get initial symbol data
_LOGGER.info(
"Requesting data from coordinator with update interval of %s.", scan_interval
)
await coordinator.async_refresh()
# Pass down the coordinator and config to platforms.
hass.data[DOMAIN] = {
HASS_DATA_COORDINATOR: coordinator,
HASS_DATA_CONFIG: domain_config,
}
async def handle_refresh_symbols(_call) -> None:
"""Refresh symbol data."""
_LOGGER.info("Processing refresh_symbols")
await coordinator.async_request_refresh()
hass.services.async_register(
DOMAIN,
SERVICE_REFRESH,
handle_refresh_symbols,
)
if not coordinator.last_update_success:
_LOGGER.debug("Coordinator did not report any data, requesting async_refresh")
hass.async_create_task(coordinator.async_request_refresh())
hass.async_create_task(
discovery.async_load_platform(hass, "sensor", DOMAIN, {}, config)
)
return True
def convert_to_float(value) -> float | None:
"""Convert specified value to float."""
try:
return float(value)
except: # noqa: E722 pylint: disable=bare-except
return None
| [
1,
9995,
13,
1576,
612,
26779,
1436,
749,
4163,
29889,
13,
13,
991,
597,
3292,
29889,
510,
29914,
666,
4442,
29914,
29891,
29745,
974,
262,
749,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
25495,
13,
13,
3166,
12865,
1053,
5335,
287,
2554,
13,
5215,
12183,
13,
3166,
19229,
1053,
9550,
29892,
7761,
13,
13,
3166,
3271,
465,
22137,
29889,
3075,
1053,
8707,
29943,
29918,
7187,
2190,
29918,
23845,
8932,
13,
3166,
3271,
465,
22137,
29889,
3221,
1053,
8778,
7900,
22137,
13,
3166,
3271,
465,
22137,
29889,
3952,
6774,
1053,
20699,
13,
5215,
3271,
465,
22137,
29889,
3952,
6774,
29889,
2917,
29918,
18157,
408,
13850,
13,
3166,
3271,
465,
22137,
29889,
3952,
6774,
29889,
1017,
15702,
1053,
12782,
1542,
13,
5215,
1700,
21245,
17269,
408,
1700,
13,
13,
3166,
2888,
29918,
14036,
29889,
29891,
29745,
974,
262,
749,
29889,
1111,
4194,
1061,
1053,
612,
26779,
14730,
6422,
7967,
4194,
1061,
13,
13,
3166,
869,
3075,
1053,
313,
13,
1678,
8707,
29943,
29918,
2287,
29907,
2260,
29931,
29918,
7390,
2477,
2890,
29892,
13,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
3738,
7818,
29979,
29918,
28658,
29918,
8932,
12996,
29892,
13,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
5438,
29918,
8932,
12996,
29892,
13,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
15094,
29918,
8932,
12996,
29892,
13,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
16240,
29949,
29918,
29950,
18783,
19386,
29918,
28658,
29918,
8932,
12996,
29892,
13,
1678,
8707,
29943,
29918,
7068,
9806,
29918,
5659,
11794,
4214,
29918,
2965,
1164,
29892,
13,
1678,
8707,
29943,
29918,
14816,
9486,
5607,
29903,
29892,
13,
1678,
8707,
29943,
29918,
29911,
1718,
7194,
29918,
22484,
29934,
1430,
29907,
29979,
29892,
13,
1678,
22236,
29918,
6007,
29943,
29918,
2287,
29907,
2260,
29931,
29918,
7390,
2477,
2890,
29892,
13,
1678,
22236,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
3738,
7818,
29979,
29918,
28658,
29918,
8932,
12996,
29892,
13,
1678,
22236,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
5438,
29918,
8932,
12996,
29892,
13,
1678,
22236,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
15094,
29918,
8932,
12996,
29892,
13,
1678,
22236,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
16240,
29949,
29918,
29950,
18783,
19386,
29918,
28658,
29918,
8932,
12996,
29892,
13,
1678,
22236,
29918,
6007,
29943,
29918,
7068,
9806,
29918,
5659,
11794,
4214,
29918,
2965,
1164,
29892,
13,
1678,
11662,
29032,
29892,
13,
1678,
379,
22933,
29918,
14573,
29918,
25903,
29892,
13,
1678,
379,
22933,
29918,
14573,
29918,
3217,
25593,
1177,
1299,
1955,
29892,
13,
1678,
26996,
19059,
29918,
25866,
1525,
7068,
29892,
13,
29897,
13,
13,
29918,
14480,
17070,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
23397,
29918,
7187,
2190,
29918,
23845,
8932,
29901,
9550,
353,
5335,
287,
2554,
29898,
29882,
2470,
29922,
29953,
29897,
13,
16173,
7833,
5005,
29918,
7187,
2190,
29918,
23845,
8932,
29901,
9550,
353,
5335,
287,
2554,
29898,
23128,
29922,
29941,
29900,
29897,
13,
13,
13,
29933,
3289,
2965,
29918,
14816,
9486,
5607,
29918,
29903,
3210,
26862,
353,
1700,
29889,
3596,
29898,
11023,
29889,
1807,
29892,
1700,
29889,
26214,
29897,
13,
13,
21514,
1307,
29990,
29918,
14816,
9486,
5607,
29918,
29903,
3210,
26862,
353,
1700,
29889,
3596,
29898,
13,
1678,
9657,
29892,
13,
1678,
1700,
29889,
12763,
29898,
13,
4706,
426,
13,
9651,
1700,
29889,
19347,
703,
18098,
29908,
1125,
350,
3289,
2965,
29918,
14816,
9486,
5607,
29918,
29903,
3210,
26862,
29892,
13,
9651,
1700,
29889,
27636,
29898,
6007,
29943,
29918,
29911,
1718,
7194,
29918,
22484,
29934,
1430,
29907,
29979,
1125,
350,
3289,
2965,
29918,
14816,
9486,
5607,
29918,
29903,
3210,
26862,
29892,
13,
4706,
500,
13,
1678,
10353,
13,
29897,
13,
13,
25903,
29918,
29903,
3210,
26862,
353,
1700,
29889,
12763,
29898,
13,
1678,
426,
13,
4706,
11662,
29032,
29901,
1700,
29889,
12763,
29898,
13,
9651,
426,
13,
18884,
1700,
29889,
19347,
29898,
6007,
29943,
29918,
14816,
9486,
5607,
29903,
1125,
1700,
29889,
3596,
29898,
13,
462,
1678,
13850,
29889,
7469,
29918,
1761,
29892,
13,
462,
1678,
518,
1555,
29889,
10773,
29898,
29933,
3289,
2965,
29918,
14816,
9486,
5607,
29918,
29903,
3210,
26862,
29892,
4810,
3580,
1307,
29990,
29918,
14816,
9486,
5607,
29918,
29903,
3210,
26862,
29897,
1402,
13,
18884,
10353,
13,
18884,
1700,
29889,
27636,
29898,
13,
462,
1678,
8707,
29943,
29918,
7187,
2190,
29918,
23845,
8932,
29892,
2322,
29922,
23397,
29918,
7187,
2190,
29918,
23845,
8932,
13,
462,
1125,
1700,
29889,
10773,
703,
9290,
613,
376,
8516,
613,
13850,
29889,
1066,
3321,
29918,
2230,
29918,
19145,
511,
13,
18884,
1700,
29889,
27636,
29898,
6007,
29943,
29918,
29911,
1718,
7194,
29918,
22484,
29934,
1430,
29907,
29979,
1125,
1700,
29889,
3596,
29898,
11023,
29889,
1807,
29892,
1700,
29889,
26214,
511,
13,
18884,
1700,
29889,
27636,
29898,
13,
462,
1678,
8707,
29943,
29918,
7068,
9806,
29918,
5659,
11794,
4214,
29918,
2965,
1164,
29892,
2322,
29922,
23397,
29918,
6007,
29943,
29918,
7068,
9806,
29918,
5659,
11794,
4214,
29918,
2965,
1164,
13,
462,
1125,
13850,
29889,
20054,
29892,
13,
18884,
1700,
29889,
27636,
29898,
13,
462,
1678,
8707,
29943,
29918,
2287,
29907,
2260,
29931,
29918,
7390,
2477,
2890,
29892,
2322,
29922,
23397,
29918,
6007,
29943,
29918,
2287,
29907,
2260,
29931,
29918,
7390,
2477,
2890,
13,
462,
1125,
1700,
29889,
7967,
261,
346,
29898,
524,
511,
13,
18884,
1700,
29889,
27636,
29898,
13,
462,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
3738,
7818,
29979,
29918,
28658,
29918,
8932,
12996,
29892,
13,
462,
1678,
2322,
29922,
23397,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
3738,
7818,
29979,
29918,
28658,
29918,
8932,
12996,
29892,
13,
462,
1125,
13850,
29889,
20054,
29892,
13,
18884,
1700,
29889,
27636,
29898,
13,
462,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
5438,
29918,
8932,
12996,
29892,
2322,
29922,
23397,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
5438,
29918,
8932,
12996,
13,
462,
1125,
13850,
29889,
20054,
29892,
13,
18884,
1700,
29889,
27636,
29898,
13,
462,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
15094,
29918,
8932,
12996,
29892,
2322,
29922,
23397,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
15094,
29918,
8932,
12996,
13,
462,
1125,
13850,
29889,
20054,
29892,
13,
18884,
1700,
29889,
27636,
29898,
13,
462,
1678,
8707,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
16240,
29949,
29918,
29950,
18783,
19386,
29918,
28658,
29918,
8932,
12996,
29892,
13,
462,
1678,
2322,
29922,
23397,
29918,
6007,
29943,
29918,
1177,
6154,
29965,
2287,
29918,
16240,
29949,
29918,
29950,
18783,
19386,
29918,
28658,
29918,
8932,
12996,
29892,
13,
462,
1125,
13850,
29889,
20054,
29892,
13,
9651,
500,
13,
4706,
1723,
13,
1678,
2981,
13,
1678,
396,
450,
4866,
379,
29909,
5285,
338,
4502,
1623,
304,
29952,
12674,
29918,
14669,
1673,
2758,
278,
4805,
6611,
29889,
13,
1678,
4805,
29922,
1555,
29889,
1964,
27998,
29918,
12194,
4717,
29892,
13,
29897,
13,
13,
13,
1990,
23858,
14683,
29901,
13,
1678,
9995,
14730,
5023,
1213,
15945,
13,
13,
1678,
5829,
29901,
851,
13,
1678,
3646,
29918,
26095,
29901,
851,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5829,
29901,
851,
29892,
3646,
29918,
26095,
29901,
7761,
29961,
710,
29892,
6213,
29962,
353,
6213,
29897,
1599,
6213,
29901,
13,
4706,
9995,
4391,
263,
716,
5829,
5023,
1213,
15945,
13,
4706,
1583,
29889,
18098,
353,
5829,
13,
4706,
1583,
29889,
5182,
29918,
26095,
353,
3646,
29918,
26095,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
11609,
278,
8954,
1213,
15945,
13,
4706,
736,
285,
29908,
29912,
1311,
29889,
18098,
29087,
1311,
29889,
5182,
29918,
26095,
5038,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
29901,
738,
29897,
1599,
6120,
29901,
13,
4706,
9995,
11609,
278,
10230,
1213,
15945,
13,
4706,
736,
313,
13,
9651,
338,
8758,
29898,
1228,
29892,
23858,
14683,
29897,
13,
9651,
322,
1583,
29889,
18098,
1275,
916,
29889,
18098,
13,
9651,
322,
1583,
29889,
5182,
29918,
26095,
1275,
916,
29889,
5182,
29918,
26095,
13,
4706,
1723,
13,
13,
1678,
822,
4770,
8568,
12035,
1311,
29897,
1599,
938,
29901,
13,
4706,
9995,
9984,
6608,
519,
1213,
15945,
13,
4706,
736,
6608,
3552,
1311,
29889,
18098,
29892,
1583,
29889,
5182,
29918,
26095,
876,
13,
13,
13,
1753,
6088,
29918,
16192,
29918,
19207,
29898,
16192,
29918,
19207,
29901,
7761,
29961,
9346,
287,
2554,
29892,
851,
2314,
1599,
5335,
287,
2554,
29901,
13,
1678,
9995,
12914,
322,
12725,
12812,
29918,
19207,
1213,
15945,
13,
1678,
565,
338,
8758,
29898,
16192,
29918,
19207,
29892,
851,
1125,
13,
4706,
565,
338,
8758,
29898,
16192,
29918,
19207,
29892,
851,
1125,
13,
9651,
565,
12812,
29918,
19207,
29889,
13609,
580,
1275,
376,
9290,
1115,
13,
18884,
12812,
29918,
19207,
353,
6213,
13,
9651,
1683,
29901,
13,
18884,
12020,
1700,
29889,
13919,
29898,
13,
462,
1678,
285,
29908,
13919,
426,
6007,
29943,
29918,
7187,
2190,
29918,
23845,
8932,
29913,
6790,
29901,
426,
16192,
29918,
19207,
5038,
13,
18884,
1723,
13,
1678,
25342,
12812,
29918,
19207,
529,
341,
1177,
7833,
5005,
29918,
7187,
2190,
29918,
23845,
8932,
29901,
13,
4706,
12020,
1700,
29889,
13919,
703,
29083,
7292,
881,
367,
472,
3203,
29871,
29941,
29900,
6923,
23157,
13,
13,
1678,
736,
12812,
29918,
19207,
13,
13,
13,
1753,
4226,
675,
29918,
2080,
29898,
12119,
29918,
18098,
29879,
29901,
1051,
29897,
1599,
18761,
29961,
1761,
29961,
710,
1402,
1051,
29961,
14730,
14683,
5262,
29901,
13,
1678,
9995,
19077,
675,
1881,
322,
3349,
20955,
1213,
15945,
13,
1678,
15072,
353,
731,
580,
13,
1678,
5829,
29918,
25476,
2187,
29901,
1051,
29961,
14730,
14683,
29962,
353,
5159,
13,
13,
1678,
363,
995,
297,
3342,
29918,
18098,
29879,
29901,
13,
4706,
565,
338,
8758,
29898,
1767,
29892,
851,
1125,
13,
9651,
565,
995,
451,
297,
15072,
29901,
13,
18884,
15072,
29889,
1202,
29898,
1767,
29897,
13,
18884,
5829,
29918,
25476,
2187,
29889,
4397,
29898,
14730,
14683,
29898,
1767,
876,
13,
4706,
1683,
29901,
13,
9651,
5829,
353,
995,
3366,
18098,
3108,
13,
9651,
565,
5829,
451,
297,
15072,
29901,
13,
18884,
15072,
29889,
1202,
29898,
18098,
29897,
13,
18884,
5829,
29918,
25476,
2187,
29889,
4397,
29898,
13,
462,
1678,
23858,
14683,
29898,
18098,
29892,
995,
29889,
657,
29898,
6007,
29943,
29918,
29911,
1718,
7194,
29918,
22484,
29934,
1430,
29907,
29979,
876,
13,
18884,
1723,
13,
13,
1678,
736,
313,
1761,
29898,
18098,
29879,
511,
5829,
29918,
25476,
2187,
29897,
13,
13,
13,
12674,
822,
7465,
29918,
14669,
29898,
29882,
465,
29901,
8778,
7900,
22137,
29892,
2295,
29901,
12782,
1542,
29897,
1599,
6120,
29901,
13,
1678,
9995,
2697,
701,
278,
4163,
1213,
15945,
13,
1678,
5354,
29918,
2917,
353,
2295,
29889,
657,
29898,
3970,
29032,
29892,
426,
1800,
13,
1678,
3342,
29918,
18098,
29879,
353,
5354,
29918,
2917,
29889,
657,
29898,
6007,
29943,
29918,
14816,
9486,
5607,
29903,
29892,
518,
2314,
13,
13,
1678,
15072,
29892,
5829,
29918,
25476,
2187,
353,
4226,
675,
29918,
2080,
29898,
12119,
29918,
18098,
29879,
29897,
13,
1678,
5354,
29918,
2917,
29961,
6007,
29943,
29918,
14816,
9486,
5607,
29903,
29962,
353,
5829,
29918,
25476,
2187,
13,
13,
1678,
12812,
29918,
19207,
353,
6088,
29918,
16192,
29918,
19207,
29898,
7247,
29918,
2917,
29889,
657,
29898,
6007,
29943,
29918,
7187,
2190,
29918,
23845,
8932,
876,
13,
13,
1678,
396,
6977,
5987,
21213,
995,
964,
5354,
29918,
2917,
13,
1678,
5354,
29918,
2917,
29961,
6007,
29943,
29918,
7187,
2190,
29918,
23845,
8932,
29962,
353,
12812,
29918,
19207,
13,
13,
1678,
6615,
1061,
353,
612,
26779,
14730,
6422,
7967,
4194,
1061,
29898,
18098,
29879,
29892,
298,
465,
29892,
12812,
29918,
19207,
29897,
13,
13,
1678,
396,
9897,
3781,
6615,
1061,
304,
679,
2847,
5829,
848,
13,
1678,
903,
14480,
17070,
29889,
3888,
29898,
13,
4706,
376,
3089,
292,
848,
515,
6615,
1061,
411,
2767,
7292,
310,
1273,
29879,
19602,
12812,
29918,
19207,
13,
1678,
1723,
13,
1678,
7272,
6615,
1061,
29889,
12674,
29918,
22379,
580,
13,
13,
1678,
396,
6978,
1623,
278,
6615,
1061,
322,
2295,
304,
21796,
29889,
13,
1678,
298,
465,
29889,
1272,
29961,
3970,
29032,
29962,
353,
426,
13,
4706,
379,
22933,
29918,
14573,
29918,
3217,
25593,
1177,
1299,
1955,
29901,
6615,
1061,
29892,
13,
4706,
379,
22933,
29918,
14573,
29918,
25903,
29901,
5354,
29918,
2917,
29892,
13,
1678,
500,
13,
13,
1678,
7465,
822,
4386,
29918,
22379,
29918,
18098,
29879,
7373,
4804,
29897,
1599,
6213,
29901,
13,
4706,
9995,
27132,
5829,
848,
1213,
15945,
13,
4706,
903,
14480,
17070,
29889,
3888,
703,
7032,
292,
11086,
29918,
18098,
29879,
1159,
13,
4706,
7272,
6615,
1061,
29889,
12674,
29918,
3827,
29918,
22379,
580,
13,
13,
1678,
298,
465,
29889,
9916,
29889,
12674,
29918,
9573,
29898,
13,
4706,
11662,
29032,
29892,
13,
4706,
26996,
19059,
29918,
25866,
1525,
7068,
29892,
13,
4706,
4386,
29918,
22379,
29918,
18098,
29879,
29892,
13,
1678,
1723,
13,
13,
1678,
565,
451,
6615,
1061,
29889,
4230,
29918,
5504,
29918,
8698,
29901,
13,
4706,
903,
14480,
17070,
29889,
8382,
703,
7967,
4194,
1061,
1258,
451,
3461,
738,
848,
29892,
2009,
292,
7465,
29918,
22379,
1159,
13,
4706,
298,
465,
29889,
12674,
29918,
3258,
29918,
7662,
29898,
1111,
4194,
1061,
29889,
12674,
29918,
3827,
29918,
22379,
3101,
13,
13,
1678,
298,
465,
29889,
12674,
29918,
3258,
29918,
7662,
29898,
13,
4706,
20699,
29889,
12674,
29918,
1359,
29918,
12120,
29898,
29882,
465,
29892,
376,
29879,
6073,
613,
11662,
29032,
29892,
24335,
2295,
29897,
13,
1678,
1723,
13,
13,
1678,
736,
5852,
13,
13,
13,
1753,
3588,
29918,
517,
29918,
7411,
29898,
1767,
29897,
1599,
5785,
891,
6213,
29901,
13,
1678,
9995,
18455,
6790,
995,
304,
5785,
1213,
15945,
13,
1678,
1018,
29901,
13,
4706,
736,
5785,
29898,
1767,
29897,
13,
1678,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29906,
29906,
282,
2904,
524,
29901,
11262,
29922,
18354,
29899,
19499,
13,
4706,
736,
6213,
13,
2
] |
decimal to binary.py | Kshitijkrishnadas/haribol | 0 | 15737 | <gh_stars>0
a=''
n=int(input())
while n != 0:
a=str(n%2)+a
n//=2
print(a)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29874,
2433,
29915,
13,
29876,
29922,
524,
29898,
2080,
3101,
13,
8000,
302,
2804,
29871,
29900,
29901,
13,
1678,
263,
29922,
710,
29898,
29876,
29995,
29906,
7240,
29874,
13,
1678,
302,
458,
29922,
29906,
13,
2158,
29898,
29874,
29897,
13,
2
] |
hangpy/tests/repositories/test_server_repository.py | luizfernandomeier/hangpy | 5 | 61447 | import unittest
from hangpy.repositories import ServerRepository
class TestServerRepository(unittest.TestCase):
def test_instantiate(self):
server_repository = FakeServerRepository()
self.assertIsNone(server_repository.get_servers())
self.assertIsNone(server_repository.add_server(None))
self.assertIsNone(server_repository.update_server(None))
class FakeServerRepository(ServerRepository):
def get_servers(self):
return ServerRepository.get_servers(self)
def add_server(self, server):
return ServerRepository.add_server(self, server)
def update_server(self, server):
return ServerRepository.update_server(self, server)
if (__name__ == "__main__"):
unittest.main()
| [
1,
1053,
443,
27958,
13,
3166,
13958,
2272,
29889,
276,
1066,
20106,
1053,
5656,
11481,
13,
13,
13,
1990,
4321,
6004,
11481,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
2611,
3656,
403,
29898,
1311,
1125,
13,
4706,
1923,
29918,
19033,
353,
383,
1296,
6004,
11481,
580,
13,
4706,
1583,
29889,
9294,
3624,
8516,
29898,
2974,
29918,
19033,
29889,
657,
29918,
643,
874,
3101,
13,
4706,
1583,
29889,
9294,
3624,
8516,
29898,
2974,
29918,
19033,
29889,
1202,
29918,
2974,
29898,
8516,
876,
13,
4706,
1583,
29889,
9294,
3624,
8516,
29898,
2974,
29918,
19033,
29889,
5504,
29918,
2974,
29898,
8516,
876,
13,
13,
13,
1990,
383,
1296,
6004,
11481,
29898,
6004,
11481,
1125,
13,
13,
1678,
822,
679,
29918,
643,
874,
29898,
1311,
1125,
13,
4706,
736,
5656,
11481,
29889,
657,
29918,
643,
874,
29898,
1311,
29897,
13,
13,
1678,
822,
788,
29918,
2974,
29898,
1311,
29892,
1923,
1125,
13,
4706,
736,
5656,
11481,
29889,
1202,
29918,
2974,
29898,
1311,
29892,
1923,
29897,
13,
13,
1678,
822,
2767,
29918,
2974,
29898,
1311,
29892,
1923,
1125,
13,
4706,
736,
5656,
11481,
29889,
5504,
29918,
2974,
29898,
1311,
29892,
1923,
29897,
13,
13,
13,
361,
313,
1649,
978,
1649,
1275,
376,
1649,
3396,
1649,
29908,
1125,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
tests/test_softmax.py | kcosta42/Multilayer_Perceptron | 1 | 190230 | <filename>tests/test_softmax.py
import numpy as np
import matplotlib.pyplot as plt
from libft.activations import ReLU, Softmax
from libft.layers import Dense, Input
from libft.losses import BinaryCrossentropy
from libft.metrics import BinaryAccuracy
from libft.models import Sequential
from libft.optimizers import SGD
from libft.preprocessing import to_categorical
np.seterr(all='raise')
X = np.random.rand(500, 30)
X_std = np.copy(X)
X_std[:, 0] = (X[:, 0] - X[:, 0].mean()) / X[:, 0].std()
X_std[:, 1] = (X[:, 1] - X[:, 1].mean()) / X[:, 1].std()
y = to_categorical(np.random.randint(0, 2, 500))
model = Sequential([
Input(input_shape=(30,)),
Dense(16),
ReLU(),
Dense(2),
Softmax(),
])
model.summary()
model.compile(loss=BinaryCrossentropy(),
optimizer=SGD(learning_rate=1e-4),
metrics=BinaryAccuracy())
epochs = 100
history = model.fit(X_std, y,
batch_size=128,
epochs=epochs,
verbose=1,
validation_split=0.1)
epoch_range = range(1, epochs + 1)
plt.plot(epoch_range, model.losses['training'], c='blue')
plt.plot(epoch_range, model.losses['validation'], c='red', ls='dashed')
plt.xlabel('Epochs')
plt.ylabel('Cost function')
plt.show()
plt.plot(epoch_range, model.metrics['training'], c='blue')
plt.plot(epoch_range, model.metrics['validation'], c='red', ls='dashed')
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.show()
| [
1,
529,
9507,
29958,
21150,
29914,
1688,
29918,
2695,
3317,
29889,
2272,
13,
5215,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
3166,
4303,
615,
29889,
11236,
800,
1053,
830,
29931,
29965,
29892,
1105,
615,
3317,
13,
3166,
4303,
615,
29889,
29277,
1053,
360,
1947,
29892,
10567,
13,
3166,
4303,
615,
29889,
6758,
267,
1053,
29479,
29907,
2124,
296,
14441,
13,
3166,
4303,
615,
29889,
2527,
10817,
1053,
29479,
7504,
332,
4135,
13,
3166,
4303,
615,
29889,
9794,
1053,
922,
339,
2556,
13,
3166,
4303,
615,
29889,
20640,
19427,
1053,
317,
29954,
29928,
13,
3166,
4303,
615,
29889,
1457,
19170,
1053,
304,
29918,
29883,
20440,
936,
13,
13,
9302,
29889,
842,
3127,
29898,
497,
2433,
22692,
1495,
13,
13,
29990,
353,
7442,
29889,
8172,
29889,
9502,
29898,
29945,
29900,
29900,
29892,
29871,
29941,
29900,
29897,
13,
29990,
29918,
4172,
353,
7442,
29889,
8552,
29898,
29990,
29897,
13,
29990,
29918,
4172,
7503,
29892,
29871,
29900,
29962,
353,
313,
29990,
7503,
29892,
29871,
29900,
29962,
448,
1060,
7503,
29892,
29871,
29900,
1822,
12676,
3101,
847,
1060,
7503,
29892,
29871,
29900,
1822,
4172,
580,
13,
29990,
29918,
4172,
7503,
29892,
29871,
29896,
29962,
353,
313,
29990,
7503,
29892,
29871,
29896,
29962,
448,
1060,
7503,
29892,
29871,
29896,
1822,
12676,
3101,
847,
1060,
7503,
29892,
29871,
29896,
1822,
4172,
580,
13,
13,
29891,
353,
304,
29918,
29883,
20440,
936,
29898,
9302,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
29871,
29906,
29892,
29871,
29945,
29900,
29900,
876,
13,
13,
4299,
353,
922,
339,
2556,
4197,
13,
1678,
10567,
29898,
2080,
29918,
12181,
7607,
29941,
29900,
29892,
8243,
13,
1678,
360,
1947,
29898,
29896,
29953,
511,
13,
1678,
830,
29931,
29965,
3285,
13,
1678,
360,
1947,
29898,
29906,
511,
13,
1678,
1105,
615,
3317,
3285,
13,
2314,
13,
13,
4299,
29889,
7727,
580,
13,
13,
4299,
29889,
12198,
29898,
6758,
29922,
25196,
29907,
2124,
296,
14441,
3285,
13,
795,
5994,
3950,
29922,
26016,
29928,
29898,
21891,
29918,
10492,
29922,
29896,
29872,
29899,
29946,
511,
13,
795,
21556,
29922,
25196,
7504,
332,
4135,
3101,
13,
13,
1022,
2878,
29879,
353,
29871,
29896,
29900,
29900,
13,
18434,
353,
1904,
29889,
9202,
29898,
29990,
29918,
4172,
29892,
343,
29892,
13,
462,
1678,
9853,
29918,
2311,
29922,
29896,
29906,
29947,
29892,
13,
462,
1678,
21502,
12168,
29922,
1022,
2878,
29879,
29892,
13,
462,
1678,
26952,
29922,
29896,
29892,
13,
462,
1678,
8845,
29918,
5451,
29922,
29900,
29889,
29896,
29897,
13,
13,
1022,
2878,
29918,
3881,
353,
3464,
29898,
29896,
29892,
21502,
12168,
718,
29871,
29896,
29897,
13,
572,
29873,
29889,
5317,
29898,
1022,
2878,
29918,
3881,
29892,
1904,
29889,
6758,
267,
1839,
26495,
7464,
274,
2433,
9539,
1495,
13,
572,
29873,
29889,
5317,
29898,
1022,
2878,
29918,
3881,
29892,
1904,
29889,
6758,
267,
1839,
18157,
7464,
274,
2433,
1127,
742,
19375,
2433,
14592,
287,
1495,
13,
572,
29873,
29889,
29916,
1643,
877,
29923,
1129,
12168,
1495,
13,
572,
29873,
29889,
29891,
1643,
877,
25733,
740,
1495,
13,
572,
29873,
29889,
4294,
580,
13,
13,
572,
29873,
29889,
5317,
29898,
1022,
2878,
29918,
3881,
29892,
1904,
29889,
2527,
10817,
1839,
26495,
7464,
274,
2433,
9539,
1495,
13,
572,
29873,
29889,
5317,
29898,
1022,
2878,
29918,
3881,
29892,
1904,
29889,
2527,
10817,
1839,
18157,
7464,
274,
2433,
1127,
742,
19375,
2433,
14592,
287,
1495,
13,
572,
29873,
29889,
29916,
1643,
877,
29923,
1129,
12168,
1495,
13,
572,
29873,
29889,
29891,
1643,
877,
7504,
332,
4135,
1495,
13,
572,
29873,
29889,
4294,
580,
13,
2
] |
service/__init__.py | 2890841438/fast-index.py | 4 | 1393 | <filename>service/__init__.py
# -*- coding = utf-8 -*-
# @Time: 2020/9/4 18:52
# @Author: dimples_yj
# @File: __init__.py.py
# @Software: PyCharm
| [
1,
529,
9507,
29958,
5509,
29914,
1649,
2344,
26914,
2272,
13,
29937,
448,
29930,
29899,
14137,
353,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
732,
2481,
29901,
29871,
29906,
29900,
29906,
29900,
29914,
29929,
29914,
29946,
29871,
29896,
29947,
29901,
29945,
29906,
13,
29937,
732,
13720,
29901,
3964,
2701,
29918,
17472,
13,
29937,
732,
2283,
29901,
4770,
2344,
26914,
2272,
29889,
2272,
13,
29937,
732,
6295,
14093,
29901,
10772,
1451,
2817,
13,
2
] |
Source_Code/Python/ConductedTest/case_generator.py | fenglwh/instruments | 0 | 12927 | <gh_stars>0
import json
from labinstrument.SS.CMW500.CMW500_WIFI.CMW500_WIFI import *
if __name__ == '__main__':
new_config_name='emm'
new_config=CMW_WIFI(17).get_parameters()
config=json.load(open('config.txt'))
config[new_config_name]=new_config
json.dump(config,open('config.txt','w')) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
4390,
13,
3166,
9775,
2611,
15461,
29889,
1799,
29889,
24494,
29956,
29945,
29900,
29900,
29889,
24494,
29956,
29945,
29900,
29900,
29918,
22119,
3738,
29889,
24494,
29956,
29945,
29900,
29900,
29918,
22119,
3738,
1053,
334,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
716,
29918,
2917,
29918,
978,
2433,
331,
29885,
29915,
13,
1678,
716,
29918,
2917,
29922,
24494,
29956,
29918,
22119,
3738,
29898,
29896,
29955,
467,
657,
29918,
16744,
580,
13,
1678,
2295,
29922,
3126,
29889,
1359,
29898,
3150,
877,
2917,
29889,
3945,
8785,
13,
1678,
2295,
29961,
1482,
29918,
2917,
29918,
978,
13192,
1482,
29918,
2917,
13,
1678,
4390,
29889,
15070,
29898,
2917,
29892,
3150,
877,
2917,
29889,
3945,
3788,
29893,
8785,
2
] |
gen-po-comm-invoice.py | tschutter/cctools | 0 | 158295 | #!/usr/bin/env python2
"""
Generates a Purchase Order / Commercial Invoice.
All known products are included. If you are never ordering a product
again, then just don't order it. Or use the --exclude-sku option.
"""
from __future__ import print_function
import ConfigParser
import argparse
import datetime
import itertools
import logging
import os
import re
import openpyxl # sudo pip install openpyxl
import cctools
import notify_send_handler
CHECK_FOR_LACK_OF_ANY = False # until most "Any" variants have been added
NUMBER_FORMAT_USD = "$#,##0.00;-$#,##0.00"
RE_SIZE_VARIANT = re.compile("^(Length|Size)$")
# Column numbers of product values.
COL_LINE_NO = 1
COL_SKU = 2
COL_DESCRIPTION = 3
COL_SIZE = 4
COL_PRICE = 5
COL_QTY = 6
COL_TOTAL = 7
COL_HTSUS_NO = 8
COL_INSTRUCTIONS = 9
def set_cell(
worksheet,
row,
col,
value,
font_bold=False,
font_size=11,
alignment_horizontal="general",
alignment_vertical="bottom",
number_format="General"
):
"""Set cell value and style."""
cell = worksheet.cell(row=row, column=col)
cell.value = value
cell.font = openpyxl.styles.Font(bold=font_bold, size=font_size)
cell.alignment = openpyxl.styles.Alignment(
horizontal=alignment_horizontal,
vertical=alignment_vertical
)
if number_format != "General":
cell.number_format = number_format
def col_letter(col):
"""Return column letter for given column."""
return chr(ord("A") + col - 1)
def add_title(worksheet):
"""Add worksheet title."""
set_cell(worksheet, 1, 1, "Purchase Order", font_bold=True, font_size=20)
worksheet.merge_cells(
start_row=1,
start_column=1,
end_row=1,
end_column=3
)
worksheet.row_dimensions[1].height = 25
def set_label_value(
worksheet,
row,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
label,
value
):
"""Add label: value."""
if col_label_start != col_label_end:
worksheet.merge_cells(
start_row=row,
start_column=col_label_start,
end_row=row,
end_column=col_label_end
)
col_label = col_label_start
else:
col_label = col_label_end
set_cell(
worksheet,
row,
col_label,
label,
font_bold=True,
alignment_horizontal="right"
)
if col_value_start != col_value_end:
worksheet.merge_cells(
start_row=row,
start_column=col_value_start,
end_row=row,
end_column=col_value_end
)
col_value = col_value_start
else:
col_value = col_value_end
cell = worksheet.cell(row=row, column=col_value)
cell.set_explicit_value(value) # Force type to be string.
def add_header(args, config, worksheet, row):
"""Add PO/Invoice header."""
col_label_start = 3
col_label_end = 3
col_value_start = col_label_end + 1
col_value_end = col_value_start
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Invoice #: ",
args.number
)
row += 1
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Associated PO #s: ",
args.number
)
row += 1
date_str = datetime.date.today().strftime("%B %d, %Y")
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Date: ",
date_str
)
row += 1
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Country of Origin: ",
config.get("invoice", "country_of_origin")
)
row += 1
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Manufacturer ID: ",
config.get("invoice", "manufacturer_id")
)
row += 1
first_row = True
for key, value in config.items("invoice"):
if key.startswith("consignee"):
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Ultimate Consignee: " if first_row else "",
value
)
first_row = False
row += 1
# Unit of measurement.
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Unit of Measurement: ",
config.get("invoice", "unit_of_measurement")
)
row += 1
# Terms of sale.
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Currency: ",
config.get("invoice", "currency")
)
row += 1
# Transport and delivery.
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Transport and Delivery: ",
config.get("invoice", "transport_and_delivery")
)
row += 1
# Terms of sale.
set_label_value(
worksheet,
row - 1,
col_label_start,
col_label_end,
col_value_start,
col_value_end,
"Terms of Sale: ",
config.get("invoice", "terms_of_sale")
)
row += 1
return row
def add_variant(
worksheet,
row,
lineno,
sku,
description,
size,
cost,
htsus_no
):
"""Add a row for a variant."""
set_cell(worksheet, row, COL_LINE_NO, lineno)
set_cell(
worksheet,
row,
COL_SKU,
sku,
alignment_horizontal="left"
)
set_cell(worksheet, row, COL_DESCRIPTION, description)
set_cell(worksheet, row, COL_SIZE, size)
set_cell(worksheet, row, COL_PRICE, cost, number_format=NUMBER_FORMAT_USD)
total_formula = "=IF({}{}=\"\", \"\", {}{} * {}{})".format(
col_letter(COL_QTY),
row,
col_letter(COL_PRICE),
row,
col_letter(COL_QTY),
row
)
set_cell(
worksheet,
row,
COL_TOTAL,
total_formula,
number_format=NUMBER_FORMAT_USD
)
if htsus_no is not None:
set_cell(worksheet, row, COL_HTSUS_NO, htsus_no)
def get_product_variants(variants, sku):
"""Returns a list of variants for a product."""
product_variants = [
variant for variant in variants
if variant["Product SKU"] == sku and variant["Variant Enabled"] == "Y"
]
product_variants.sort(key=lambda variant: variant["Variant Sort"])
return product_variants
def add_product(worksheet, row, lineno, product, variants):
"""Add row for each variant."""
product_name = product["Product Name"]
sku = product["SKU"]
teaser = cctools.html_to_plain_text(product["Teaser"])
size = product["Size"]
cost = float(product["Cost"])
if "HTSUS No" in product:
htsus_no = product["HTSUS No"]
else:
htsus_no = None
product_variants = get_product_variants(variants, sku)
if len(product_variants) == 0:
description = "{}: {}".format(product_name, teaser)
add_variant(
worksheet,
row,
lineno,
sku,
description,
size,
cost,
htsus_no
)
row += 1
lineno += 1
else:
any_variant_exists = False
for variant in product_variants:
variant_sku = variant["Variant SKU"]
if variant_sku == "ANY" or variant_sku == "VAR":
any_variant_exists = True
variant_sku = "{}-{}".format(sku, variant_sku)
variant_add_cost = float(variant["Variant Add Cost"])
variant_name = variant["Variant Name"]
description = "{} ({}): {}".format(
product_name,
variant_name,
teaser
)
variant_group = variant["Variant Group"]
if RE_SIZE_VARIANT.match(variant_group):
size = variant_name
add_variant(
worksheet,
row,
lineno,
variant_sku,
description,
size,
cost + variant_add_cost,
htsus_no
)
row += 1
lineno += 1
if CHECK_FOR_LACK_OF_ANY and not any_variant_exists:
logging.getLogger().warning(
"No 'Any' or 'Variety' variant exists for {} {}".format(
sku,
product_name
)
)
return row, lineno
def add_products(worksheet, row, cc_browser, products, has_htsus_no):
"""Add row for each product."""
# Add header row.
set_cell(
worksheet,
row,
COL_LINE_NO,
"Line No",
font_bold=True,
alignment_horizontal="right"
)
set_cell(
worksheet,
row,
COL_SKU,
"SKU",
font_bold=True,
alignment_horizontal="left"
)
set_cell(worksheet, row, COL_DESCRIPTION, "Description", font_bold=True)
set_cell(worksheet, row, COL_SIZE, "Size", font_bold=True)
set_cell(
worksheet,
row,
COL_PRICE,
"Price",
font_bold=True,
alignment_horizontal="right"
)
set_cell(
worksheet,
row,
COL_QTY,
"Qty",
font_bold=True,
alignment_horizontal="right"
)
set_cell(
worksheet,
row,
COL_TOTAL,
"Total",
font_bold=True,
alignment_horizontal="right"
)
if has_htsus_no:
set_cell(
worksheet,
row,
COL_HTSUS_NO,
"HTSUS No",
font_bold=True
)
set_cell(
worksheet,
row,
COL_INSTRUCTIONS,
"Item Special Instructions",
font_bold=True
)
row += 1
# Fetch variants list.
variants = cc_browser.get_variants()
# Group products by category.
first_product_row = row
lineno = 1
for _, product_group in itertools.groupby(
products,
key=cc_browser.product_key_by_category
):
# Leave a row for the category name.
category = "unknown"
category_row = row
row += 1
# Add product rows.
for product in product_group:
row, lineno = add_product(
worksheet,
row,
lineno,
product,
variants
)
category = product["Category"]
# Go back and insert category name.
if category == "":
category = "Uncategorized"
set_cell(
worksheet,
category_row,
COL_DESCRIPTION,
category,
font_bold=True
)
last_product_row = row - 1
# Set column widths.
worksheet.column_dimensions[col_letter(COL_LINE_NO)].width = 8
worksheet.column_dimensions[col_letter(COL_SKU)].width = 15
worksheet.column_dimensions[col_letter(COL_DESCRIPTION)].width = 100
worksheet.column_dimensions[col_letter(COL_SIZE)].width = 28
worksheet.column_dimensions[col_letter(COL_PRICE)].width = 7
worksheet.column_dimensions[col_letter(COL_QTY)].width = 5
worksheet.column_dimensions[col_letter(COL_TOTAL)].width = 10
if has_htsus_no:
worksheet.column_dimensions[col_letter(COL_HTSUS_NO)].width = 13
worksheet.column_dimensions[col_letter(COL_INSTRUCTIONS)].width = 30
return row, first_product_row, last_product_row
def set_label_dollar_value(
worksheet,
row,
col_label_start,
col_label_end,
col_total,
label,
value,
font_bold=False
):
"""Add label: value."""
worksheet.merge_cells(
start_row=row,
start_column=col_label_start,
end_row=row,
end_column=col_label_end
)
set_cell(
worksheet,
row,
col_label_start,
label,
font_bold=font_bold,
alignment_horizontal="right"
)
set_cell(
worksheet,
row,
col_total,
value,
number_format=NUMBER_FORMAT_USD,
font_bold=font_bold
)
def add_totals(
worksheet,
config,
row,
col_total,
first_product_row,
last_product_row
):
"""Add subtotals and totals."""
col_label_start = col_total - 3
col_label_end = col_total - 1
# Subtotal.
subtotal_formula = "=SUM({}{}:{}{})".format(
col_letter(col_total),
first_product_row,
col_letter(col_total),
last_product_row
)
set_label_dollar_value(
worksheet,
row,
col_label_start,
col_label_end,
col_total,
"Subtotal:",
subtotal_formula
)
subtotal_row = row
last_adjustment_row = row
row += 1
# Discount.
if config.has_option("invoice", "percent_discount"):
percent_discount = config.getfloat("invoice", "percent_discount")
discount_formula = "={}{} * {}".format(
col_letter(col_total),
subtotal_row,
-percent_discount / 100.0
)
set_label_dollar_value(
worksheet,
row,
col_label_start,
col_label_end,
col_total,
"{}% Discount:".format(percent_discount),
discount_formula
)
row += 1
# Shipping.
set_label_dollar_value(
worksheet,
row,
col_label_start,
col_label_end,
col_total,
"Shipping:",
0.0
)
row += 1
# Adjustments.
last_adjustment_row = row - 1
for key, value in config.items("invoice"):
if key.startswith("adjustment"):
set_label_dollar_value(
worksheet,
row,
col_label_start,
col_label_end,
col_total,
value + ":",
""
)
last_adjustment_row = row
row += 1
# Total.
total_formula = "=SUM({}{}:{}{})".format(
col_letter(col_total),
subtotal_row,
col_letter(col_total),
last_adjustment_row
)
set_label_dollar_value(
worksheet,
row,
col_label_start,
col_label_end,
col_total,
"Total:",
total_formula
)
# Create a data-validation object with list validation.
in_accounting_choices = [
"Not in accounting system",
"Entered into accounting system"
]
validator = openpyxl.worksheet.datavalidation.DataValidation(
type="list",
formula1="\"{}\"".format(",".join(in_accounting_choices)),
allow_blank=False
)
# Add the data-validation object to the worksheet.
worksheet.add_data_validation(validator)
# Set the cell and add to the data-validation object.
cell = worksheet.cell(row=row, column=col_total + 2)
cell.value = in_accounting_choices[0]
validator.add(cell)
row += 1
return row
def add_summary(
worksheet,
row,
first_product_row,
last_product_row,
htsus_numbers
):
"""
Add a section that summarizes total cost by HTSUS number. This
is intended to make the customs inspector's job easier and
therefore less likely to be grumpy and cause problems.
"""
# Section title.
worksheet.merge_cells(
start_row=row,
start_column=COL_PRICE,
end_row=row,
end_column=COL_HTSUS_NO
)
set_cell(
worksheet,
row,
COL_PRICE,
"Summary by HTSUS number:",
font_bold=True
)
row += 1
for htsus_no in sorted(htsus_numbers):
total_range = "{0}{1}:{0}{2}".format(
col_letter(COL_TOTAL),
first_product_row,
last_product_row
)
htsus_no_range = "{0}{1}:{0}{2}".format(
col_letter(COL_HTSUS_NO),
first_product_row,
last_product_row
)
if htsus_no == "":
htsus_no = "Not assigned"
# SUMIF() with "" test does not work.
total_formula = "=SUMPRODUCT({}, {}=\"\")".format(
total_range,
htsus_no_range
)
else:
total_formula = "=SUMIF({}, \"{}\", {})".format(
htsus_no_range,
htsus_no,
total_range,
)
set_cell(
worksheet,
row,
COL_TOTAL,
total_formula,
number_format=NUMBER_FORMAT_USD
)
set_cell(worksheet, row, COL_HTSUS_NO, htsus_no)
row += 1
return row
def add_special_instructions(worksheet, row):
"""Add special instructions."""
col_value_name = 3
# Special instructions.
set_cell(
worksheet,
row,
col_value_name,
"General Special Instructions:",
font_bold=True
)
def add_invoice(args, config, cc_browser, worksheet):
"""Create the PO-Invoice worksheet."""
# Prepare worksheet.
worksheet.title = "PO-Invoice"
# Add title.
add_title(worksheet)
# Add header.
row = 3
row = add_header(args, config, worksheet, row)
# Blank row.
row += 1
# Fetch products list.
products = cc_browser.get_products()
# Remove excluded SKUs.
if args.exclude_skus:
products = [
x for x in products if str(x["SKU"]) not in args.exclude_skus
]
# Sort products by category, product_name.
products = sorted(products, key=cc_browser.product_key_by_cat_and_name)
# Determine if products include HTSUS number.
has_htsus_no = len(products) > 0 and "HTSUS No" in products[0]
# Add products.
row, first_product_row, last_product_row = add_products(
worksheet,
row,
cc_browser,
products,
has_htsus_no
)
# Blank row.
row += 1
# Add subtotals and total.
row = add_totals(
worksheet,
config,
row,
COL_TOTAL,
first_product_row,
last_product_row
)
# Blank row.
row += 1
if has_htsus_no:
# Create list of unique HTSUS numbers.
htsus_numbers = []
for product in products:
if product["HTSUS No"] not in htsus_numbers:
htsus_numbers.append(product["HTSUS No"])
# Add summary by HTSUS.
row = add_summary(
worksheet,
row,
first_product_row,
last_product_row,
htsus_numbers
)
# Blank row.
row += 1
# Add special instructions.
add_special_instructions(worksheet, row)
def add_instructions(config, worksheet):
"""Create the Instructions worksheet."""
# Prepare worksheet.
worksheet.title = "Instructions"
col_instruction = 1
row = 1
# Add instructions.
for key, value in config.items("invoice"):
if key.startswith("instruction"):
if value == "[EMPTY]":
row += 1
continue
bold = False
if value.startswith("[BOLD]"):
bold = True
value = value[6:]
set_cell(worksheet, row, col_instruction, value, font_bold=bold)
row += 1
# Set column widths.
worksheet.column_dimensions[col_letter(col_instruction)].width = 120
def generate_xlsx(args, config, cc_browser):
"""Generate the XLS file."""
# Construct a document.
workbook = openpyxl.workbook.Workbook()
# Create PO-Invoice worksheet.
add_invoice(args, config, cc_browser, workbook.worksheets[0])
# Create Instructions worksheet.
add_instructions(config, workbook.create_sheet())
# Write to file.
workbook.save(args.xlsx_filename)
def main():
"""main"""
default_config = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"cctools.cfg"
)
now = datetime.datetime.now()
default_number = now.strftime("%y%m%d00")
default_xlsx_filename = now.strftime("%Y-%m-%d-PurchaseOrder.xlsx")
arg_parser = argparse.ArgumentParser(
description="Generates a Purchase Order / Commercial Invoice."
)
arg_parser.add_argument(
"--config",
action="store",
dest="config",
metavar="FILE",
default=default_config,
help="configuration filename (default=%(default)s)"
)
arg_parser.add_argument(
"--number",
action="store",
dest="number",
metavar="NUM",
default=default_number,
help="PO/Invoice number (default=%(default)s)"
)
arg_parser.add_argument(
"--outfile",
action="store",
dest="xlsx_filename",
metavar="FILE",
default=default_xlsx_filename,
help="output XLSX filename (default=%(default)s)"
)
arg_parser.add_argument(
"--exclude-sku",
action="append",
dest="exclude_skus",
metavar="SKU",
help="exclude SKU from output"
)
arg_parser.add_argument(
"--verbose",
action="store_true",
default=False,
help="display progress messages"
)
# Parse command line arguments.
args = arg_parser.parse_args()
# Configure logging.
logging.basicConfig(
level=logging.INFO if args.verbose else logging.WARNING
)
logger = logging.getLogger()
# Also log using notify-send if it is available.
if notify_send_handler.NotifySendHandler.is_available():
logger.addHandler(
notify_send_handler.NotifySendHandler(
os.path.splitext(os.path.basename(__file__))[0]
)
)
# Read config file.
config = ConfigParser.RawConfigParser()
config.readfp(open(args.config))
# Create a connection to CoreCommerce.
cc_browser = cctools.CCBrowser(
config.get("website", "base_url"),
config.get("website", "username"),
config.get("website", "password")
)
# Generate spreadsheet.
logger.debug("Generating {}\n".format(os.path.abspath(args.xlsx_filename)))
generate_xlsx(args, config, cc_browser)
logger.debug("Generation complete")
return 0
if __name__ == "__main__":
main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29906,
13,
13,
15945,
29908,
13,
5631,
1078,
263,
349,
27574,
8170,
847,
422,
1050,
1455,
512,
14917,
29889,
13,
13,
3596,
2998,
9316,
526,
5134,
29889,
29871,
960,
366,
526,
2360,
20520,
263,
3234,
13,
351,
475,
29892,
769,
925,
1016,
29915,
29873,
1797,
372,
29889,
29871,
1394,
671,
278,
1192,
735,
2325,
29899,
18181,
2984,
29889,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
5215,
12782,
11726,
13,
5215,
1852,
5510,
13,
5215,
12865,
13,
5215,
4256,
8504,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
337,
13,
13,
5215,
1722,
2272,
15524,
29871,
396,
9196,
8450,
2601,
1722,
2272,
15524,
13,
13,
5215,
274,
312,
8789,
13,
5215,
26051,
29918,
6717,
29918,
13789,
13,
13,
3210,
16658,
29918,
22051,
29918,
29931,
11375,
29918,
9800,
29918,
2190,
29979,
353,
7700,
29871,
396,
2745,
1556,
376,
10773,
29908,
29161,
505,
1063,
2715,
13,
13,
23207,
29918,
19094,
1299,
29918,
3308,
29928,
353,
3908,
6552,
2277,
29900,
29889,
29900,
29900,
29936,
18039,
6552,
2277,
29900,
29889,
29900,
29900,
29908,
13,
13,
1525,
29918,
14226,
29918,
26865,
29902,
13566,
353,
337,
29889,
12198,
703,
23733,
6513,
29989,
3505,
1262,
1159,
13,
13,
29937,
12481,
3694,
310,
3234,
1819,
29889,
13,
15032,
29918,
18521,
29918,
6632,
353,
29871,
29896,
13,
15032,
29918,
16033,
29965,
353,
29871,
29906,
13,
15032,
29918,
2287,
7187,
24290,
2725,
353,
29871,
29941,
13,
15032,
29918,
14226,
353,
29871,
29946,
13,
15032,
29918,
10593,
12107,
353,
29871,
29945,
13,
15032,
29918,
29984,
15631,
353,
29871,
29953,
13,
15032,
29918,
29911,
2891,
1964,
353,
29871,
29955,
13,
15032,
29918,
3912,
29903,
3308,
29918,
6632,
353,
29871,
29947,
13,
15032,
29918,
1177,
10810,
29965,
9838,
29903,
353,
29871,
29929,
13,
13,
13,
1753,
731,
29918,
3729,
29898,
13,
1678,
1736,
4155,
29892,
13,
1678,
1948,
29892,
13,
1678,
784,
29892,
13,
1678,
995,
29892,
13,
1678,
4079,
29918,
8934,
29922,
8824,
29892,
13,
1678,
4079,
29918,
2311,
29922,
29896,
29896,
29892,
13,
1678,
22239,
29918,
22672,
543,
17492,
613,
13,
1678,
22239,
29918,
18575,
543,
8968,
613,
13,
1678,
1353,
29918,
4830,
543,
15263,
29908,
13,
1125,
13,
1678,
9995,
2697,
3038,
995,
322,
3114,
1213,
15945,
13,
1678,
3038,
353,
1736,
4155,
29889,
3729,
29898,
798,
29922,
798,
29892,
1897,
29922,
1054,
29897,
13,
1678,
3038,
29889,
1767,
353,
995,
13,
1678,
3038,
29889,
5657,
353,
1722,
2272,
15524,
29889,
9783,
29889,
9824,
29898,
8934,
29922,
5657,
29918,
8934,
29892,
2159,
29922,
5657,
29918,
2311,
29897,
13,
1678,
3038,
29889,
2520,
358,
353,
1722,
2272,
15524,
29889,
9783,
29889,
14658,
29898,
13,
4706,
14698,
29922,
2520,
358,
29918,
22672,
29892,
13,
4706,
11408,
29922,
2520,
358,
29918,
18575,
13,
1678,
1723,
13,
1678,
565,
1353,
29918,
4830,
2804,
376,
15263,
1115,
13,
4706,
3038,
29889,
4537,
29918,
4830,
353,
1353,
29918,
4830,
13,
13,
13,
1753,
784,
29918,
15670,
29898,
1054,
1125,
13,
1678,
9995,
11609,
1897,
5497,
363,
2183,
1897,
1213,
15945,
13,
1678,
736,
18460,
29898,
536,
703,
29909,
1159,
718,
784,
448,
29871,
29896,
29897,
13,
13,
13,
1753,
788,
29918,
3257,
29898,
1287,
9855,
1125,
13,
1678,
9995,
2528,
1736,
4155,
3611,
1213,
15945,
13,
1678,
731,
29918,
3729,
29898,
1287,
9855,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
376,
29925,
27574,
8170,
613,
4079,
29918,
8934,
29922,
5574,
29892,
4079,
29918,
2311,
29922,
29906,
29900,
29897,
13,
1678,
1736,
4155,
29889,
14634,
29918,
3729,
29879,
29898,
13,
4706,
1369,
29918,
798,
29922,
29896,
29892,
13,
4706,
1369,
29918,
4914,
29922,
29896,
29892,
13,
4706,
1095,
29918,
798,
29922,
29896,
29892,
13,
4706,
1095,
29918,
4914,
29922,
29941,
13,
1678,
1723,
13,
1678,
1736,
4155,
29889,
798,
29918,
6229,
5580,
29961,
29896,
1822,
3545,
353,
29871,
29906,
29945,
13,
13,
13,
1753,
731,
29918,
1643,
29918,
1767,
29898,
13,
1678,
1736,
4155,
29892,
13,
1678,
1948,
29892,
13,
1678,
784,
29918,
1643,
29918,
2962,
29892,
13,
1678,
784,
29918,
1643,
29918,
355,
29892,
13,
1678,
784,
29918,
1767,
29918,
2962,
29892,
13,
1678,
784,
29918,
1767,
29918,
355,
29892,
13,
1678,
3858,
29892,
13,
1678,
995,
13,
1125,
13,
1678,
9995,
2528,
3858,
29901,
995,
1213,
15945,
13,
1678,
565,
784,
29918,
1643,
29918,
2962,
2804,
784,
29918,
1643,
29918,
355,
29901,
13,
4706,
1736,
4155,
29889,
14634,
29918,
3729,
29879,
29898,
13,
9651,
1369,
29918,
798,
29922,
798,
29892,
13,
9651,
1369,
29918,
4914,
29922,
1054,
29918,
1643,
29918,
2962,
29892,
13,
9651,
1095,
29918,
798,
29922,
798,
29892,
13,
9651,
1095,
29918,
4914,
29922,
1054,
29918,
1643,
29918,
355,
13,
4706,
1723,
13,
4706,
784,
29918,
1643,
353,
784,
29918,
1643,
29918,
2962,
13,
1678,
1683,
29901,
13,
4706,
784,
29918,
1643,
353,
784,
29918,
1643,
29918,
355,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
1643,
29892,
13,
4706,
3858,
29892,
13,
4706,
4079,
29918,
8934,
29922,
5574,
29892,
13,
4706,
22239,
29918,
22672,
543,
1266,
29908,
13,
1678,
1723,
13,
13,
1678,
565,
784,
29918,
1767,
29918,
2962,
2804,
784,
29918,
1767,
29918,
355,
29901,
13,
4706,
1736,
4155,
29889,
14634,
29918,
3729,
29879,
29898,
13,
9651,
1369,
29918,
798,
29922,
798,
29892,
13,
9651,
1369,
29918,
4914,
29922,
1054,
29918,
1767,
29918,
2962,
29892,
13,
9651,
1095,
29918,
798,
29922,
798,
29892,
13,
9651,
1095,
29918,
4914,
29922,
1054,
29918,
1767,
29918,
355,
13,
4706,
1723,
13,
4706,
784,
29918,
1767,
353,
784,
29918,
1767,
29918,
2962,
13,
1678,
1683,
29901,
13,
4706,
784,
29918,
1767,
353,
784,
29918,
1767,
29918,
355,
13,
1678,
3038,
353,
1736,
4155,
29889,
3729,
29898,
798,
29922,
798,
29892,
1897,
29922,
1054,
29918,
1767,
29897,
13,
1678,
3038,
29889,
842,
29918,
4548,
4019,
29918,
1767,
29898,
1767,
29897,
29871,
396,
11004,
1134,
304,
367,
1347,
29889,
13,
13,
13,
1753,
788,
29918,
6672,
29898,
5085,
29892,
2295,
29892,
1736,
4155,
29892,
1948,
1125,
13,
1678,
9995,
2528,
21521,
29914,
797,
14917,
4839,
1213,
15945,
13,
13,
1678,
784,
29918,
1643,
29918,
2962,
353,
29871,
29941,
13,
1678,
784,
29918,
1643,
29918,
355,
353,
29871,
29941,
13,
1678,
784,
29918,
1767,
29918,
2962,
353,
784,
29918,
1643,
29918,
355,
718,
29871,
29896,
13,
1678,
784,
29918,
1767,
29918,
355,
353,
784,
29918,
1767,
29918,
2962,
13,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
797,
14917,
396,
29901,
9162,
13,
4706,
6389,
29889,
4537,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
29254,
630,
21521,
396,
29879,
29901,
9162,
13,
4706,
6389,
29889,
4537,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
2635,
29918,
710,
353,
12865,
29889,
1256,
29889,
27765,
2141,
710,
615,
603,
11702,
29933,
1273,
29881,
29892,
1273,
29979,
1159,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
2539,
29901,
9162,
13,
4706,
2635,
29918,
710,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
20779,
310,
22118,
29901,
9162,
13,
4706,
2295,
29889,
657,
703,
262,
14917,
613,
376,
13509,
29918,
974,
29918,
12574,
1159,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
2517,
9765,
9945,
3553,
29901,
9162,
13,
4706,
2295,
29889,
657,
703,
262,
14917,
613,
376,
1171,
9765,
9945,
29918,
333,
1159,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
937,
29918,
798,
353,
5852,
13,
1678,
363,
1820,
29892,
995,
297,
2295,
29889,
7076,
703,
262,
14917,
29908,
1125,
13,
4706,
565,
1820,
29889,
27382,
2541,
703,
3200,
4895,
29872,
29908,
1125,
13,
9651,
731,
29918,
1643,
29918,
1767,
29898,
13,
18884,
1736,
4155,
29892,
13,
18884,
1948,
448,
29871,
29896,
29892,
13,
18884,
784,
29918,
1643,
29918,
2962,
29892,
13,
18884,
784,
29918,
1643,
29918,
355,
29892,
13,
18884,
784,
29918,
1767,
29918,
2962,
29892,
13,
18884,
784,
29918,
1767,
29918,
355,
29892,
13,
18884,
376,
29965,
1896,
6490,
2138,
4895,
29872,
29901,
376,
565,
937,
29918,
798,
1683,
12633,
13,
18884,
995,
13,
9651,
1723,
13,
9651,
937,
29918,
798,
353,
7700,
13,
9651,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
13223,
310,
20039,
29889,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
8325,
310,
2191,
3745,
358,
29901,
9162,
13,
4706,
2295,
29889,
657,
703,
262,
14917,
613,
376,
5441,
29918,
974,
29918,
26658,
358,
1159,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
11814,
29879,
310,
14686,
29889,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
29907,
10880,
29901,
9162,
13,
4706,
2295,
29889,
657,
703,
262,
14917,
613,
376,
26095,
1159,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
15710,
322,
28289,
29889,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
27395,
322,
360,
27657,
29901,
9162,
13,
4706,
2295,
29889,
657,
703,
262,
14917,
613,
376,
27882,
29918,
392,
29918,
29881,
27657,
1159,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
11814,
29879,
310,
14686,
29889,
13,
1678,
731,
29918,
1643,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
448,
29871,
29896,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
1767,
29918,
2962,
29892,
13,
4706,
784,
29918,
1767,
29918,
355,
29892,
13,
4706,
376,
14343,
29879,
310,
317,
744,
29901,
9162,
13,
4706,
2295,
29889,
657,
703,
262,
14917,
613,
376,
357,
1516,
29918,
974,
29918,
29879,
744,
1159,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
736,
1948,
13,
13,
13,
1753,
788,
29918,
19365,
29898,
13,
1678,
1736,
4155,
29892,
13,
1678,
1948,
29892,
13,
1678,
6276,
8154,
29892,
13,
1678,
2071,
29884,
29892,
13,
1678,
6139,
29892,
13,
1678,
2159,
29892,
13,
1678,
3438,
29892,
13,
1678,
298,
1372,
375,
29918,
1217,
13,
1125,
13,
1678,
9995,
2528,
263,
1948,
363,
263,
17305,
1213,
15945,
13,
13,
1678,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
18521,
29918,
6632,
29892,
6276,
8154,
29897,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
16033,
29965,
29892,
13,
4706,
2071,
29884,
29892,
13,
4706,
22239,
29918,
22672,
543,
1563,
29908,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
2287,
7187,
24290,
2725,
29892,
6139,
29897,
13,
1678,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
14226,
29892,
2159,
29897,
13,
1678,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
10593,
12107,
29892,
3438,
29892,
1353,
29918,
4830,
29922,
23207,
29918,
19094,
1299,
29918,
3308,
29928,
29897,
13,
1678,
3001,
29918,
689,
2497,
353,
376,
29922,
6545,
3319,
1157,
8738,
29908,
23370,
13218,
23370,
426,
1157,
29913,
334,
426,
1157,
1800,
1642,
4830,
29898,
13,
4706,
784,
29918,
15670,
29898,
15032,
29918,
29984,
15631,
511,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
15670,
29898,
15032,
29918,
10593,
12107,
511,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
15670,
29898,
15032,
29918,
29984,
15631,
511,
13,
4706,
1948,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
29911,
2891,
1964,
29892,
13,
4706,
3001,
29918,
689,
2497,
29892,
13,
4706,
1353,
29918,
4830,
29922,
23207,
29918,
19094,
1299,
29918,
3308,
29928,
13,
1678,
1723,
13,
1678,
565,
298,
1372,
375,
29918,
1217,
338,
451,
6213,
29901,
13,
4706,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
3912,
29903,
3308,
29918,
6632,
29892,
298,
1372,
375,
29918,
1217,
29897,
13,
13,
13,
1753,
679,
29918,
4704,
29918,
5927,
1934,
29898,
5927,
1934,
29892,
2071,
29884,
1125,
13,
1678,
9995,
11609,
29879,
263,
1051,
310,
29161,
363,
263,
3234,
1213,
15945,
13,
1678,
3234,
29918,
5927,
1934,
353,
518,
13,
4706,
17305,
363,
17305,
297,
29161,
13,
4706,
565,
17305,
3366,
7566,
18581,
29965,
3108,
1275,
2071,
29884,
322,
17305,
3366,
10444,
424,
1174,
3606,
3108,
1275,
376,
29979,
29908,
13,
1678,
4514,
13,
1678,
3234,
29918,
5927,
1934,
29889,
6605,
29898,
1989,
29922,
2892,
17305,
29901,
17305,
3366,
10444,
424,
20025,
20068,
13,
1678,
736,
3234,
29918,
5927,
1934,
13,
13,
13,
1753,
788,
29918,
4704,
29898,
1287,
9855,
29892,
1948,
29892,
6276,
8154,
29892,
3234,
29892,
29161,
1125,
13,
1678,
9995,
2528,
1948,
363,
1269,
17305,
1213,
15945,
13,
1678,
3234,
29918,
978,
353,
3234,
3366,
7566,
4408,
3108,
13,
1678,
2071,
29884,
353,
3234,
3366,
16033,
29965,
3108,
13,
1678,
734,
29440,
353,
274,
312,
8789,
29889,
1420,
29918,
517,
29918,
24595,
29918,
726,
29898,
4704,
3366,
7141,
29440,
20068,
13,
1678,
2159,
353,
3234,
3366,
3505,
3108,
13,
1678,
3438,
353,
5785,
29898,
4704,
3366,
25733,
20068,
13,
1678,
565,
376,
3912,
29903,
3308,
1939,
29908,
297,
3234,
29901,
13,
4706,
298,
1372,
375,
29918,
1217,
353,
3234,
3366,
3912,
29903,
3308,
1939,
3108,
13,
1678,
1683,
29901,
13,
4706,
298,
1372,
375,
29918,
1217,
353,
6213,
13,
1678,
3234,
29918,
5927,
1934,
353,
679,
29918,
4704,
29918,
5927,
1934,
29898,
5927,
1934,
29892,
2071,
29884,
29897,
13,
1678,
565,
7431,
29898,
4704,
29918,
5927,
1934,
29897,
1275,
29871,
29900,
29901,
13,
4706,
6139,
353,
29850,
6177,
6571,
1642,
4830,
29898,
4704,
29918,
978,
29892,
734,
29440,
29897,
13,
4706,
788,
29918,
19365,
29898,
13,
9651,
1736,
4155,
29892,
13,
9651,
1948,
29892,
13,
9651,
6276,
8154,
29892,
13,
9651,
2071,
29884,
29892,
13,
9651,
6139,
29892,
13,
9651,
2159,
29892,
13,
9651,
3438,
29892,
13,
9651,
298,
1372,
375,
29918,
1217,
13,
4706,
1723,
13,
4706,
1948,
4619,
29871,
29896,
13,
4706,
6276,
8154,
4619,
29871,
29896,
13,
1678,
1683,
29901,
13,
4706,
738,
29918,
19365,
29918,
9933,
353,
7700,
13,
4706,
363,
17305,
297,
3234,
29918,
5927,
1934,
29901,
13,
9651,
17305,
29918,
18181,
353,
17305,
3366,
10444,
424,
18581,
29965,
3108,
13,
9651,
565,
17305,
29918,
18181,
1275,
376,
2190,
29979,
29908,
470,
17305,
29918,
18181,
1275,
376,
26865,
1115,
13,
18884,
738,
29918,
19365,
29918,
9933,
353,
5852,
13,
9651,
17305,
29918,
18181,
353,
29850,
7402,
8875,
1642,
4830,
29898,
18181,
29892,
17305,
29918,
18181,
29897,
13,
9651,
17305,
29918,
1202,
29918,
18253,
353,
5785,
29898,
19365,
3366,
10444,
424,
3462,
9839,
20068,
13,
9651,
17305,
29918,
978,
353,
17305,
3366,
10444,
424,
4408,
3108,
13,
9651,
6139,
353,
376,
8875,
313,
8875,
1125,
6571,
1642,
4830,
29898,
13,
18884,
3234,
29918,
978,
29892,
13,
18884,
17305,
29918,
978,
29892,
13,
18884,
734,
29440,
13,
9651,
1723,
13,
9651,
17305,
29918,
2972,
353,
17305,
3366,
10444,
424,
6431,
3108,
13,
9651,
565,
5195,
29918,
14226,
29918,
26865,
29902,
13566,
29889,
4352,
29898,
19365,
29918,
2972,
1125,
13,
18884,
2159,
353,
17305,
29918,
978,
13,
9651,
788,
29918,
19365,
29898,
13,
18884,
1736,
4155,
29892,
13,
18884,
1948,
29892,
13,
18884,
6276,
8154,
29892,
13,
18884,
17305,
29918,
18181,
29892,
13,
18884,
6139,
29892,
13,
18884,
2159,
29892,
13,
18884,
3438,
718,
17305,
29918,
1202,
29918,
18253,
29892,
13,
18884,
298,
1372,
375,
29918,
1217,
13,
9651,
1723,
13,
9651,
1948,
4619,
29871,
29896,
13,
9651,
6276,
8154,
4619,
29871,
29896,
13,
4706,
565,
23557,
29918,
22051,
29918,
29931,
11375,
29918,
9800,
29918,
2190,
29979,
322,
451,
738,
29918,
19365,
29918,
9933,
29901,
13,
9651,
12183,
29889,
657,
16363,
2141,
27392,
29898,
13,
18884,
376,
3782,
525,
10773,
29915,
470,
525,
10444,
3305,
29915,
17305,
4864,
363,
6571,
6571,
1642,
4830,
29898,
13,
462,
1678,
2071,
29884,
29892,
13,
462,
1678,
3234,
29918,
978,
13,
18884,
1723,
13,
9651,
1723,
13,
13,
1678,
736,
1948,
29892,
6276,
8154,
13,
13,
13,
1753,
788,
29918,
14456,
29898,
1287,
9855,
29892,
1948,
29892,
21759,
29918,
15965,
29892,
9316,
29892,
756,
29918,
400,
29879,
375,
29918,
1217,
1125,
13,
1678,
9995,
2528,
1948,
363,
1269,
3234,
1213,
15945,
13,
13,
1678,
396,
3462,
4839,
1948,
29889,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
18521,
29918,
6632,
29892,
13,
4706,
376,
3542,
1939,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
29892,
13,
4706,
22239,
29918,
22672,
543,
1266,
29908,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
16033,
29965,
29892,
13,
4706,
376,
16033,
29965,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
29892,
13,
4706,
22239,
29918,
22672,
543,
1563,
29908,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
2287,
7187,
24290,
2725,
29892,
376,
9868,
613,
4079,
29918,
8934,
29922,
5574,
29897,
13,
1678,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
14226,
29892,
376,
3505,
613,
4079,
29918,
8934,
29922,
5574,
29897,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
10593,
12107,
29892,
13,
4706,
376,
13026,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
29892,
13,
4706,
22239,
29918,
22672,
543,
1266,
29908,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
29984,
15631,
29892,
13,
4706,
376,
29984,
1017,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
29892,
13,
4706,
22239,
29918,
22672,
543,
1266,
29908,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
29911,
2891,
1964,
29892,
13,
4706,
376,
11536,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
29892,
13,
4706,
22239,
29918,
22672,
543,
1266,
29908,
13,
1678,
1723,
13,
1678,
565,
756,
29918,
400,
29879,
375,
29918,
1217,
29901,
13,
4706,
731,
29918,
3729,
29898,
13,
9651,
1736,
4155,
29892,
13,
9651,
1948,
29892,
13,
9651,
23958,
29918,
3912,
29903,
3308,
29918,
6632,
29892,
13,
9651,
376,
3912,
29903,
3308,
1939,
613,
13,
9651,
4079,
29918,
8934,
29922,
5574,
13,
4706,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
1177,
10810,
29965,
9838,
29903,
29892,
13,
4706,
376,
2001,
12630,
2799,
582,
1953,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
383,
3486,
29161,
1051,
29889,
13,
1678,
29161,
353,
21759,
29918,
15965,
29889,
657,
29918,
5927,
1934,
580,
13,
13,
1678,
396,
6431,
9316,
491,
7663,
29889,
13,
1678,
937,
29918,
4704,
29918,
798,
353,
1948,
13,
1678,
6276,
8154,
353,
29871,
29896,
13,
1678,
363,
17117,
3234,
29918,
2972,
297,
4256,
8504,
29889,
27789,
29898,
13,
4706,
9316,
29892,
13,
4706,
1820,
29922,
617,
29918,
15965,
29889,
4704,
29918,
1989,
29918,
1609,
29918,
7320,
13,
268,
1125,
13,
4706,
396,
951,
1351,
263,
1948,
363,
278,
7663,
1024,
29889,
13,
4706,
7663,
353,
376,
26690,
29908,
13,
4706,
7663,
29918,
798,
353,
1948,
13,
4706,
1948,
4619,
29871,
29896,
13,
13,
4706,
396,
3462,
3234,
4206,
29889,
13,
4706,
363,
3234,
297,
3234,
29918,
2972,
29901,
13,
9651,
1948,
29892,
6276,
8154,
353,
788,
29918,
4704,
29898,
13,
18884,
1736,
4155,
29892,
13,
18884,
1948,
29892,
13,
18884,
6276,
8154,
29892,
13,
18884,
3234,
29892,
13,
18884,
29161,
13,
9651,
1723,
13,
9651,
7663,
353,
3234,
3366,
10900,
3108,
13,
13,
4706,
396,
2921,
1250,
322,
4635,
7663,
1024,
29889,
13,
4706,
565,
7663,
1275,
376,
1115,
13,
9651,
7663,
353,
376,
2525,
29883,
20440,
1891,
29908,
13,
4706,
731,
29918,
3729,
29898,
13,
9651,
1736,
4155,
29892,
13,
9651,
7663,
29918,
798,
29892,
13,
9651,
23958,
29918,
2287,
7187,
24290,
2725,
29892,
13,
9651,
7663,
29892,
13,
9651,
4079,
29918,
8934,
29922,
5574,
13,
4706,
1723,
13,
1678,
1833,
29918,
4704,
29918,
798,
353,
1948,
448,
29871,
29896,
13,
13,
1678,
396,
3789,
1897,
2920,
29879,
29889,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
18521,
29918,
6632,
29897,
1822,
2103,
353,
29871,
29947,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
16033,
29965,
29897,
1822,
2103,
353,
29871,
29896,
29945,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
2287,
7187,
24290,
2725,
29897,
1822,
2103,
353,
29871,
29896,
29900,
29900,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
14226,
29897,
1822,
2103,
353,
29871,
29906,
29947,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
10593,
12107,
29897,
1822,
2103,
353,
29871,
29955,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
29984,
15631,
29897,
1822,
2103,
353,
29871,
29945,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
29911,
2891,
1964,
29897,
1822,
2103,
353,
29871,
29896,
29900,
13,
1678,
565,
756,
29918,
400,
29879,
375,
29918,
1217,
29901,
13,
4706,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
3912,
29903,
3308,
29918,
6632,
29897,
1822,
2103,
353,
29871,
29896,
29941,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
15032,
29918,
1177,
10810,
29965,
9838,
29903,
29897,
1822,
2103,
353,
29871,
29941,
29900,
13,
13,
1678,
736,
1948,
29892,
937,
29918,
4704,
29918,
798,
29892,
1833,
29918,
4704,
29918,
798,
13,
13,
13,
1753,
731,
29918,
1643,
29918,
29881,
26810,
29918,
1767,
29898,
13,
1678,
1736,
4155,
29892,
13,
1678,
1948,
29892,
13,
1678,
784,
29918,
1643,
29918,
2962,
29892,
13,
1678,
784,
29918,
1643,
29918,
355,
29892,
13,
1678,
784,
29918,
7827,
29892,
13,
1678,
3858,
29892,
13,
1678,
995,
29892,
13,
1678,
4079,
29918,
8934,
29922,
8824,
13,
1125,
13,
1678,
9995,
2528,
3858,
29901,
995,
1213,
15945,
13,
1678,
1736,
4155,
29889,
14634,
29918,
3729,
29879,
29898,
13,
4706,
1369,
29918,
798,
29922,
798,
29892,
13,
4706,
1369,
29918,
4914,
29922,
1054,
29918,
1643,
29918,
2962,
29892,
13,
4706,
1095,
29918,
798,
29922,
798,
29892,
13,
4706,
1095,
29918,
4914,
29922,
1054,
29918,
1643,
29918,
355,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
3858,
29892,
13,
4706,
4079,
29918,
8934,
29922,
5657,
29918,
8934,
29892,
13,
4706,
22239,
29918,
22672,
543,
1266,
29908,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
7827,
29892,
13,
4706,
995,
29892,
13,
4706,
1353,
29918,
4830,
29922,
23207,
29918,
19094,
1299,
29918,
3308,
29928,
29892,
13,
4706,
4079,
29918,
8934,
29922,
5657,
29918,
8934,
13,
1678,
1723,
13,
13,
13,
1753,
788,
29918,
4260,
1338,
29898,
13,
1678,
1736,
4155,
29892,
13,
1678,
2295,
29892,
13,
1678,
1948,
29892,
13,
1678,
784,
29918,
7827,
29892,
13,
1678,
937,
29918,
4704,
29918,
798,
29892,
13,
1678,
1833,
29918,
4704,
29918,
798,
13,
1125,
13,
1678,
9995,
2528,
1014,
4260,
1338,
322,
2025,
1338,
1213,
15945,
13,
13,
1678,
784,
29918,
1643,
29918,
2962,
353,
784,
29918,
7827,
448,
29871,
29941,
13,
1678,
784,
29918,
1643,
29918,
355,
353,
784,
29918,
7827,
448,
29871,
29896,
13,
13,
1678,
396,
3323,
7827,
29889,
13,
1678,
1014,
7827,
29918,
689,
2497,
353,
376,
29922,
25021,
3319,
1157,
6177,
29912,
1157,
1800,
1642,
4830,
29898,
13,
4706,
784,
29918,
15670,
29898,
1054,
29918,
7827,
511,
13,
4706,
937,
29918,
4704,
29918,
798,
29892,
13,
4706,
784,
29918,
15670,
29898,
1054,
29918,
7827,
511,
13,
4706,
1833,
29918,
4704,
29918,
798,
13,
1678,
1723,
13,
1678,
731,
29918,
1643,
29918,
29881,
26810,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
7827,
29892,
13,
4706,
376,
4035,
7827,
29901,
613,
13,
4706,
1014,
7827,
29918,
689,
2497,
13,
1678,
1723,
13,
1678,
1014,
7827,
29918,
798,
353,
1948,
13,
1678,
1833,
29918,
328,
5143,
358,
29918,
798,
353,
1948,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
3295,
2798,
29889,
13,
1678,
565,
2295,
29889,
5349,
29918,
3385,
703,
262,
14917,
613,
376,
25376,
29918,
2218,
2798,
29908,
1125,
13,
4706,
10151,
29918,
2218,
2798,
353,
2295,
29889,
657,
7411,
703,
262,
14917,
613,
376,
25376,
29918,
2218,
2798,
1159,
13,
4706,
2313,
792,
29918,
689,
2497,
353,
376,
3790,
1157,
29913,
334,
6571,
1642,
4830,
29898,
13,
9651,
784,
29918,
15670,
29898,
1054,
29918,
7827,
511,
13,
9651,
1014,
7827,
29918,
798,
29892,
13,
9651,
448,
25376,
29918,
2218,
2798,
847,
29871,
29896,
29900,
29900,
29889,
29900,
13,
4706,
1723,
13,
4706,
731,
29918,
1643,
29918,
29881,
26810,
29918,
1767,
29898,
13,
9651,
1736,
4155,
29892,
13,
9651,
1948,
29892,
13,
9651,
784,
29918,
1643,
29918,
2962,
29892,
13,
9651,
784,
29918,
1643,
29918,
355,
29892,
13,
9651,
784,
29918,
7827,
29892,
13,
9651,
376,
8875,
29995,
3295,
2798,
29901,
1642,
4830,
29898,
25376,
29918,
2218,
2798,
511,
13,
9651,
2313,
792,
29918,
689,
2497,
13,
4706,
1723,
13,
4706,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
1383,
17347,
29889,
13,
1678,
731,
29918,
1643,
29918,
29881,
26810,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
7827,
29892,
13,
4706,
376,
2713,
17347,
29901,
613,
13,
308,
29900,
29889,
29900,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
2087,
5143,
1860,
29889,
13,
1678,
1833,
29918,
328,
5143,
358,
29918,
798,
353,
1948,
448,
29871,
29896,
13,
1678,
363,
1820,
29892,
995,
297,
2295,
29889,
7076,
703,
262,
14917,
29908,
1125,
13,
4706,
565,
1820,
29889,
27382,
2541,
703,
328,
5143,
358,
29908,
1125,
13,
9651,
731,
29918,
1643,
29918,
29881,
26810,
29918,
1767,
29898,
13,
18884,
1736,
4155,
29892,
13,
18884,
1948,
29892,
13,
18884,
784,
29918,
1643,
29918,
2962,
29892,
13,
18884,
784,
29918,
1643,
29918,
355,
29892,
13,
18884,
784,
29918,
7827,
29892,
13,
18884,
995,
718,
29242,
613,
13,
18884,
5124,
13,
9651,
1723,
13,
9651,
1833,
29918,
328,
5143,
358,
29918,
798,
353,
1948,
13,
9651,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
14990,
29889,
13,
1678,
3001,
29918,
689,
2497,
353,
376,
29922,
25021,
3319,
1157,
6177,
29912,
1157,
1800,
1642,
4830,
29898,
13,
4706,
784,
29918,
15670,
29898,
1054,
29918,
7827,
511,
13,
4706,
1014,
7827,
29918,
798,
29892,
13,
4706,
784,
29918,
15670,
29898,
1054,
29918,
7827,
511,
13,
4706,
1833,
29918,
328,
5143,
358,
29918,
798,
13,
1678,
1723,
13,
1678,
731,
29918,
1643,
29918,
29881,
26810,
29918,
1767,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
1643,
29918,
2962,
29892,
13,
4706,
784,
29918,
1643,
29918,
355,
29892,
13,
4706,
784,
29918,
7827,
29892,
13,
4706,
376,
11536,
29901,
613,
13,
4706,
3001,
29918,
689,
2497,
13,
1678,
1723,
13,
13,
1678,
396,
6204,
263,
848,
29899,
18157,
1203,
411,
1051,
8845,
29889,
13,
1678,
297,
29918,
10149,
292,
29918,
1859,
1575,
353,
518,
13,
4706,
376,
3664,
297,
3633,
292,
1788,
613,
13,
4706,
376,
10399,
287,
964,
3633,
292,
1788,
29908,
13,
1678,
4514,
13,
1678,
2854,
1061,
353,
1722,
2272,
15524,
29889,
1287,
9855,
29889,
4130,
7712,
333,
362,
29889,
1469,
19448,
29898,
13,
4706,
1134,
543,
1761,
613,
13,
4706,
7063,
29896,
543,
5931,
29912,
1012,
29908,
1642,
4830,
28165,
1642,
7122,
29898,
262,
29918,
10149,
292,
29918,
1859,
1575,
8243,
13,
4706,
2758,
29918,
19465,
29922,
8824,
13,
1678,
1723,
13,
13,
1678,
396,
3462,
278,
848,
29899,
18157,
1203,
304,
278,
1736,
4155,
29889,
13,
1678,
1736,
4155,
29889,
1202,
29918,
1272,
29918,
18157,
29898,
3084,
1061,
29897,
13,
13,
1678,
396,
3789,
278,
3038,
322,
788,
304,
278,
848,
29899,
18157,
1203,
29889,
13,
1678,
3038,
353,
1736,
4155,
29889,
3729,
29898,
798,
29922,
798,
29892,
1897,
29922,
1054,
29918,
7827,
718,
29871,
29906,
29897,
13,
1678,
3038,
29889,
1767,
353,
297,
29918,
10149,
292,
29918,
1859,
1575,
29961,
29900,
29962,
13,
1678,
2854,
1061,
29889,
1202,
29898,
3729,
29897,
13,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
736,
1948,
13,
13,
13,
1753,
788,
29918,
7727,
29898,
13,
1678,
1736,
4155,
29892,
13,
1678,
1948,
29892,
13,
1678,
937,
29918,
4704,
29918,
798,
29892,
13,
1678,
1833,
29918,
4704,
29918,
798,
29892,
13,
1678,
298,
1372,
375,
29918,
20326,
13,
1125,
13,
1678,
9995,
13,
1678,
3462,
263,
4004,
393,
19138,
7093,
3001,
3438,
491,
3154,
29903,
3308,
1353,
29889,
29871,
910,
13,
1678,
338,
9146,
304,
1207,
278,
2888,
29879,
16096,
272,
29915,
29879,
4982,
6775,
322,
13,
1678,
5480,
3109,
5517,
304,
367,
867,
398,
2272,
322,
4556,
4828,
29889,
13,
1678,
9995,
13,
13,
1678,
396,
9779,
3611,
29889,
13,
1678,
1736,
4155,
29889,
14634,
29918,
3729,
29879,
29898,
13,
4706,
1369,
29918,
798,
29922,
798,
29892,
13,
4706,
1369,
29918,
4914,
29922,
15032,
29918,
10593,
12107,
29892,
13,
4706,
1095,
29918,
798,
29922,
798,
29892,
13,
4706,
1095,
29918,
4914,
29922,
15032,
29918,
3912,
29903,
3308,
29918,
6632,
13,
1678,
1723,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
10593,
12107,
29892,
13,
4706,
376,
26289,
491,
3154,
29903,
3308,
1353,
29901,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
13,
1678,
1723,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
363,
298,
1372,
375,
29918,
1217,
297,
12705,
29898,
400,
29879,
375,
29918,
20326,
1125,
13,
4706,
3001,
29918,
3881,
353,
29850,
29900,
1157,
29896,
6177,
29912,
29900,
1157,
29906,
29913,
1642,
4830,
29898,
13,
9651,
784,
29918,
15670,
29898,
15032,
29918,
29911,
2891,
1964,
511,
13,
9651,
937,
29918,
4704,
29918,
798,
29892,
13,
9651,
1833,
29918,
4704,
29918,
798,
13,
4706,
1723,
13,
4706,
298,
1372,
375,
29918,
1217,
29918,
3881,
353,
29850,
29900,
1157,
29896,
6177,
29912,
29900,
1157,
29906,
29913,
1642,
4830,
29898,
13,
9651,
784,
29918,
15670,
29898,
15032,
29918,
3912,
29903,
3308,
29918,
6632,
511,
13,
9651,
937,
29918,
4704,
29918,
798,
29892,
13,
9651,
1833,
29918,
4704,
29918,
798,
13,
4706,
1723,
13,
4706,
565,
298,
1372,
375,
29918,
1217,
1275,
376,
1115,
13,
9651,
298,
1372,
375,
29918,
1217,
353,
376,
3664,
9859,
29908,
13,
9651,
396,
22753,
6545,
580,
411,
5124,
1243,
947,
451,
664,
29889,
13,
9651,
3001,
29918,
689,
2497,
353,
376,
29922,
14605,
3580,
1672,
14849,
1783,
3319,
1118,
6571,
14672,
29905,
1159,
1642,
4830,
29898,
13,
18884,
3001,
29918,
3881,
29892,
13,
18884,
298,
1372,
375,
29918,
1217,
29918,
3881,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
3001,
29918,
689,
2497,
353,
376,
29922,
25021,
6545,
3319,
1118,
13218,
29912,
1012,
613,
426,
1800,
1642,
4830,
29898,
13,
18884,
298,
1372,
375,
29918,
1217,
29918,
3881,
29892,
13,
18884,
298,
1372,
375,
29918,
1217,
29892,
13,
18884,
3001,
29918,
3881,
29892,
13,
9651,
1723,
13,
4706,
731,
29918,
3729,
29898,
13,
9651,
1736,
4155,
29892,
13,
9651,
1948,
29892,
13,
9651,
23958,
29918,
29911,
2891,
1964,
29892,
13,
9651,
3001,
29918,
689,
2497,
29892,
13,
9651,
1353,
29918,
4830,
29922,
23207,
29918,
19094,
1299,
29918,
3308,
29928,
13,
4706,
1723,
13,
4706,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
23958,
29918,
3912,
29903,
3308,
29918,
6632,
29892,
298,
1372,
375,
29918,
1217,
29897,
13,
4706,
1948,
4619,
29871,
29896,
13,
13,
1678,
736,
1948,
13,
13,
13,
1753,
788,
29918,
18732,
29918,
2611,
582,
1953,
29898,
1287,
9855,
29892,
1948,
1125,
13,
1678,
9995,
2528,
4266,
11994,
1213,
15945,
13,
1678,
784,
29918,
1767,
29918,
978,
353,
29871,
29941,
13,
13,
1678,
396,
12630,
11994,
29889,
13,
1678,
731,
29918,
3729,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
784,
29918,
1767,
29918,
978,
29892,
13,
4706,
376,
15263,
12630,
2799,
582,
1953,
29901,
613,
13,
4706,
4079,
29918,
8934,
29922,
5574,
13,
1678,
1723,
13,
13,
13,
1753,
788,
29918,
262,
14917,
29898,
5085,
29892,
2295,
29892,
21759,
29918,
15965,
29892,
1736,
4155,
1125,
13,
1678,
9995,
4391,
278,
21521,
29899,
797,
14917,
1736,
4155,
1213,
15945,
13,
13,
1678,
396,
349,
3445,
598,
1736,
4155,
29889,
13,
1678,
1736,
4155,
29889,
3257,
353,
376,
13152,
29899,
797,
14917,
29908,
13,
13,
1678,
396,
3462,
3611,
29889,
13,
1678,
788,
29918,
3257,
29898,
1287,
9855,
29897,
13,
13,
1678,
396,
3462,
4839,
29889,
13,
1678,
1948,
353,
29871,
29941,
13,
1678,
1948,
353,
788,
29918,
6672,
29898,
5085,
29892,
2295,
29892,
1736,
4155,
29892,
1948,
29897,
13,
13,
1678,
396,
3164,
804,
1948,
29889,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
383,
3486,
9316,
1051,
29889,
13,
1678,
9316,
353,
21759,
29918,
15965,
29889,
657,
29918,
14456,
580,
13,
13,
1678,
396,
15154,
429,
13347,
18581,
15922,
29889,
13,
1678,
565,
6389,
29889,
735,
2325,
29918,
808,
375,
29901,
13,
4706,
9316,
353,
518,
13,
9651,
921,
363,
921,
297,
9316,
565,
851,
29898,
29916,
3366,
16033,
29965,
20068,
451,
297,
6389,
29889,
735,
2325,
29918,
808,
375,
13,
4706,
4514,
13,
13,
1678,
396,
20025,
9316,
491,
7663,
29892,
3234,
29918,
978,
29889,
13,
1678,
9316,
353,
12705,
29898,
14456,
29892,
1820,
29922,
617,
29918,
15965,
29889,
4704,
29918,
1989,
29918,
1609,
29918,
4117,
29918,
392,
29918,
978,
29897,
13,
13,
1678,
396,
5953,
837,
457,
565,
9316,
3160,
3154,
29903,
3308,
1353,
29889,
13,
1678,
756,
29918,
400,
29879,
375,
29918,
1217,
353,
7431,
29898,
14456,
29897,
1405,
29871,
29900,
322,
376,
3912,
29903,
3308,
1939,
29908,
297,
9316,
29961,
29900,
29962,
13,
13,
1678,
396,
3462,
9316,
29889,
13,
1678,
1948,
29892,
937,
29918,
4704,
29918,
798,
29892,
1833,
29918,
4704,
29918,
798,
353,
788,
29918,
14456,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
1948,
29892,
13,
4706,
21759,
29918,
15965,
29892,
13,
4706,
9316,
29892,
13,
4706,
756,
29918,
400,
29879,
375,
29918,
1217,
13,
1678,
1723,
13,
13,
1678,
396,
3164,
804,
1948,
29889,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
3462,
1014,
4260,
1338,
322,
3001,
29889,
13,
1678,
1948,
353,
788,
29918,
4260,
1338,
29898,
13,
4706,
1736,
4155,
29892,
13,
4706,
2295,
29892,
13,
4706,
1948,
29892,
13,
4706,
23958,
29918,
29911,
2891,
1964,
29892,
13,
4706,
937,
29918,
4704,
29918,
798,
29892,
13,
4706,
1833,
29918,
4704,
29918,
798,
13,
1678,
1723,
13,
13,
1678,
396,
3164,
804,
1948,
29889,
13,
1678,
1948,
4619,
29871,
29896,
13,
13,
1678,
565,
756,
29918,
400,
29879,
375,
29918,
1217,
29901,
13,
4706,
396,
6204,
1051,
310,
5412,
3154,
29903,
3308,
3694,
29889,
13,
4706,
298,
1372,
375,
29918,
20326,
353,
5159,
13,
4706,
363,
3234,
297,
9316,
29901,
13,
9651,
565,
3234,
3366,
3912,
29903,
3308,
1939,
3108,
451,
297,
298,
1372,
375,
29918,
20326,
29901,
13,
18884,
298,
1372,
375,
29918,
20326,
29889,
4397,
29898,
4704,
3366,
3912,
29903,
3308,
1939,
20068,
13,
13,
4706,
396,
3462,
15837,
491,
3154,
29903,
3308,
29889,
13,
4706,
1948,
353,
788,
29918,
7727,
29898,
13,
9651,
1736,
4155,
29892,
13,
9651,
1948,
29892,
13,
9651,
937,
29918,
4704,
29918,
798,
29892,
13,
9651,
1833,
29918,
4704,
29918,
798,
29892,
13,
9651,
298,
1372,
375,
29918,
20326,
13,
4706,
1723,
13,
13,
4706,
396,
3164,
804,
1948,
29889,
13,
4706,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
3462,
4266,
11994,
29889,
13,
1678,
788,
29918,
18732,
29918,
2611,
582,
1953,
29898,
1287,
9855,
29892,
1948,
29897,
13,
13,
13,
1753,
788,
29918,
2611,
582,
1953,
29898,
2917,
29892,
1736,
4155,
1125,
13,
1678,
9995,
4391,
278,
2799,
582,
1953,
1736,
4155,
1213,
15945,
13,
13,
1678,
396,
349,
3445,
598,
1736,
4155,
29889,
13,
1678,
1736,
4155,
29889,
3257,
353,
376,
3379,
582,
1953,
29908,
13,
1678,
784,
29918,
2611,
4080,
353,
29871,
29896,
13,
1678,
1948,
353,
29871,
29896,
13,
13,
1678,
396,
3462,
11994,
29889,
13,
1678,
363,
1820,
29892,
995,
297,
2295,
29889,
7076,
703,
262,
14917,
29908,
1125,
13,
4706,
565,
1820,
29889,
27382,
2541,
703,
2611,
4080,
29908,
1125,
13,
9651,
565,
995,
1275,
14704,
29923,
3580,
15631,
29962,
1115,
13,
18884,
1948,
4619,
29871,
29896,
13,
18884,
6773,
13,
9651,
14288,
353,
7700,
13,
9651,
565,
995,
29889,
27382,
2541,
703,
29961,
29933,
5607,
29928,
18017,
1125,
13,
18884,
14288,
353,
5852,
13,
18884,
995,
353,
995,
29961,
29953,
17531,
13,
9651,
731,
29918,
3729,
29898,
1287,
9855,
29892,
1948,
29892,
784,
29918,
2611,
4080,
29892,
995,
29892,
4079,
29918,
8934,
29922,
8934,
29897,
13,
9651,
1948,
4619,
29871,
29896,
13,
13,
1678,
396,
3789,
1897,
2920,
29879,
29889,
13,
1678,
1736,
4155,
29889,
4914,
29918,
6229,
5580,
29961,
1054,
29918,
15670,
29898,
1054,
29918,
2611,
4080,
29897,
1822,
2103,
353,
29871,
29896,
29906,
29900,
13,
13,
13,
1753,
5706,
29918,
20267,
29916,
29898,
5085,
29892,
2295,
29892,
21759,
29918,
15965,
1125,
13,
1678,
9995,
5631,
403,
278,
1060,
8547,
934,
1213,
15945,
13,
13,
1678,
396,
1281,
4984,
263,
1842,
29889,
13,
1678,
664,
2909,
353,
1722,
2272,
15524,
29889,
1287,
2909,
29889,
26501,
580,
13,
13,
1678,
396,
6204,
21521,
29899,
797,
14917,
1736,
4155,
29889,
13,
1678,
788,
29918,
262,
14917,
29898,
5085,
29892,
2295,
29892,
21759,
29918,
15965,
29892,
664,
2909,
29889,
1287,
19360,
29961,
29900,
2314,
13,
13,
1678,
396,
6204,
2799,
582,
1953,
1736,
4155,
29889,
13,
1678,
788,
29918,
2611,
582,
1953,
29898,
2917,
29892,
664,
2909,
29889,
3258,
29918,
9855,
3101,
13,
13,
1678,
396,
14350,
304,
934,
29889,
13,
1678,
664,
2909,
29889,
7620,
29898,
5085,
29889,
20267,
29916,
29918,
9507,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
9995,
3396,
15945,
29908,
13,
1678,
2322,
29918,
2917,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
4706,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
8243,
13,
4706,
376,
29883,
312,
8789,
29889,
16859,
29908,
13,
1678,
1723,
13,
1678,
1286,
353,
12865,
29889,
12673,
29889,
3707,
580,
13,
1678,
2322,
29918,
4537,
353,
1286,
29889,
710,
615,
603,
11702,
29891,
29995,
29885,
29995,
29881,
29900,
29900,
1159,
13,
1678,
2322,
29918,
20267,
29916,
29918,
9507,
353,
1286,
29889,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
29899,
29925,
27574,
7514,
29889,
20267,
29916,
1159,
13,
13,
1678,
1852,
29918,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
543,
5631,
1078,
263,
349,
27574,
8170,
847,
422,
1050,
1455,
512,
14917,
1213,
13,
1678,
1723,
13,
1678,
1852,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
2917,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
2731,
543,
2917,
613,
13,
4706,
1539,
485,
279,
543,
7724,
613,
13,
4706,
2322,
29922,
4381,
29918,
2917,
29892,
13,
4706,
1371,
543,
13305,
10422,
313,
4381,
16328,
29898,
4381,
29897,
29879,
5513,
13,
1678,
1723,
13,
1678,
1852,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
4537,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
2731,
543,
4537,
613,
13,
4706,
1539,
485,
279,
543,
13967,
613,
13,
4706,
2322,
29922,
4381,
29918,
4537,
29892,
13,
4706,
1371,
543,
13152,
29914,
797,
14917,
1353,
313,
4381,
16328,
29898,
4381,
29897,
29879,
5513,
13,
1678,
1723,
13,
1678,
1852,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
449,
1445,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
2731,
543,
20267,
29916,
29918,
9507,
613,
13,
4706,
1539,
485,
279,
543,
7724,
613,
13,
4706,
2322,
29922,
4381,
29918,
20267,
29916,
29918,
9507,
29892,
13,
4706,
1371,
543,
4905,
1060,
8547,
29990,
10422,
313,
4381,
16328,
29898,
4381,
29897,
29879,
5513,
13,
1678,
1723,
13,
1678,
1852,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
735,
2325,
29899,
18181,
613,
13,
4706,
3158,
543,
4397,
613,
13,
4706,
2731,
543,
735,
2325,
29918,
808,
375,
613,
13,
4706,
1539,
485,
279,
543,
16033,
29965,
613,
13,
4706,
1371,
543,
735,
2325,
18581,
29965,
515,
1962,
29908,
13,
1678,
1723,
13,
1678,
1852,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
369,
15828,
613,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
2322,
29922,
8824,
29892,
13,
4706,
1371,
543,
4990,
6728,
7191,
29908,
13,
1678,
1723,
13,
13,
1678,
396,
20969,
1899,
1196,
6273,
29889,
13,
1678,
6389,
353,
1852,
29918,
16680,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
396,
1281,
4532,
12183,
29889,
13,
1678,
12183,
29889,
16121,
3991,
29898,
13,
4706,
3233,
29922,
21027,
29889,
11690,
565,
6389,
29889,
369,
15828,
1683,
12183,
29889,
29956,
25614,
13,
1678,
1723,
13,
1678,
17927,
353,
12183,
29889,
657,
16363,
580,
13,
13,
1678,
396,
3115,
1480,
773,
26051,
29899,
6717,
565,
372,
338,
3625,
29889,
13,
1678,
565,
26051,
29918,
6717,
29918,
13789,
29889,
3664,
1598,
12600,
4598,
29889,
275,
29918,
16515,
7295,
13,
4706,
17927,
29889,
1202,
4598,
29898,
13,
9651,
26051,
29918,
6717,
29918,
13789,
29889,
3664,
1598,
12600,
4598,
29898,
13,
18884,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
359,
29889,
2084,
29889,
6500,
3871,
22168,
1445,
1649,
876,
29961,
29900,
29962,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
396,
7523,
2295,
934,
29889,
13,
1678,
2295,
353,
12782,
11726,
29889,
22131,
3991,
11726,
580,
13,
1678,
2295,
29889,
949,
18091,
29898,
3150,
29898,
5085,
29889,
2917,
876,
13,
13,
1678,
396,
6204,
263,
3957,
304,
10239,
1523,
15667,
29889,
13,
1678,
21759,
29918,
15965,
353,
274,
312,
8789,
29889,
4174,
21537,
29898,
13,
4706,
2295,
29889,
657,
703,
22942,
613,
376,
3188,
29918,
2271,
4968,
13,
4706,
2295,
29889,
657,
703,
22942,
613,
376,
6786,
4968,
13,
4706,
2295,
29889,
657,
703,
22942,
613,
376,
5630,
1159,
13,
1678,
1723,
13,
13,
1678,
396,
3251,
403,
9677,
9855,
29889,
13,
1678,
17927,
29889,
8382,
703,
5631,
1218,
426,
1012,
29876,
1642,
4830,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
5085,
29889,
20267,
29916,
29918,
9507,
4961,
13,
1678,
5706,
29918,
20267,
29916,
29898,
5085,
29892,
2295,
29892,
21759,
29918,
15965,
29897,
13,
13,
1678,
17927,
29889,
8382,
703,
5631,
362,
4866,
1159,
13,
1678,
736,
29871,
29900,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
LeetCode-All-Solution/Python3/LC-0061-Rotate-List.py | YuweiYin/Algorithm_YuweiYin | 0 | 100693 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0061-Rotate-List.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-03-11
=================================================================="""
import sys
import time
from typing import List, Optional
"""
LeetCode - 0061 - (Medium) - Rotate List
https://leetcode.com/problems/rotate-list/
Description & Requirement:
Given the head of a linked list,
rotate the list to the right by k places.
Example 1:
Input: head = [1,2,3,4,5], k = 2
Output: [4,5,1,2,3]
Example 2:
Input: head = [0,1,2], k = 4
Output: [2,0,1]
Constraints:
The number of nodes in the list is in the range [0, 500].
-100 <= Node.val <= 100
0 <= k <= 2 * 10^9
"""
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next # this means (by default): end_node.next == None
@staticmethod
def build_singly_linked_list(val_list: List[int]):
if not isinstance(val_list, list) or len(val_list) <= 0:
return None
head_node = ListNode(val=val_list[0])
ptr = head_node
len_val = len(val_list)
val_index = 1
while val_index < len_val:
new_node = ListNode(val=val_list[val_index]) # create new node
ptr.next = new_node # singly link
ptr = new_node # move
val_index += 1
return head_node
@staticmethod
def show_val_singly_linked_list(head_node) -> None:
# exception case
if (not isinstance(head_node, ListNode)) and (head_node is not None):
return None # Error head_node type
if not isinstance(head_node, ListNode):
return None # Error n type or needn't delete
ptr = head_node
while ptr:
print(ptr.val)
ptr = ptr.next
class Solution:
def rotateRight(self, head: Optional[ListNode], k: int) -> Optional[ListNode]:
# exception case
if not isinstance(head, ListNode):
return None # Error head type
if not isinstance(head.next, ListNode):
return head # only one element
assert isinstance(k, int) and k >= 0
if k == 0:
return head
# main method: (scan, record the head, tail, and K-th node, where K = k % len(singly-linked list))
return self._rotateRight(head, k)
def _rotateRight(self, head_node: Optional[ListNode], k: int) -> Optional[ListNode]:
assert isinstance(head_node, ListNode) and isinstance(head_node.next, ListNode)
pseudo_head = ListNode(val=sys.maxsize, next=head_node) # Constraint: -100 <= Node.val <= 100
tail = pseudo_head
sll_len = 0
while isinstance(tail.next, ListNode): # get len(singly-linked list)
sll_len += 1
tail = tail.next
# now ptr is the tail node
k %= sll_len
if k == 0:
return head_node
# find the two breaking nodes
breaking_left = pseudo_head
step_counter = sll_len - k
for _ in range(step_counter):
breaking_left = breaking_left.next
breaking_right = breaking_left.next
# head...breaking_left breaking_right...tail -> breaking_right...tail head...breaking_left
pseudo_head.next = breaking_right
breaking_left.next = None
tail.next = head_node
return pseudo_head.next
def main():
# Example 1: Output: [4,5,1,2,3]
# head = [1, 2, 3, 4, 5]
# k = 2
# Example 2: Output: [2,0,1]
head = [0, 1, 2]
k = 4
head_node = ListNode.build_singly_linked_list(head)
# init instance
solution = Solution()
# run & time
start = time.process_time()
ans = solution.rotateRight(head_node, k)
end = time.process_time()
# show answer
print('\nAnswer:')
# print(ans.val)
ListNode.show_val_singly_linked_list(ans)
# show time consumption
print('Running Time: %.5f ms' % ((end - start) * 1000))
if __name__ == "__main__":
sys.exit(main())
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
9166,
9166,
9166,
9166,
29922,
13,
29992,
7653,
584,
29068,
29918,
29979,
21074,
29875,
29979,
262,
29914,
3226,
300,
3399,
29899,
3596,
29899,
13296,
918,
29914,
11980,
29941,
13,
29992,
2283,
1678,
584,
365,
29907,
29899,
29900,
29900,
29953,
29896,
29899,
21281,
403,
29899,
1293,
29889,
2272,
13,
29992,
13720,
29871,
584,
518,
29979,
21074,
29875,
29979,
262,
850,
991,
597,
3292,
29889,
510,
29914,
29979,
21074,
29875,
29979,
262,
29897,
13,
29992,
2539,
1678,
584,
29871,
29906,
29900,
29906,
29906,
29899,
29900,
29941,
29899,
29896,
29896,
13,
9166,
9166,
9166,
9166,
29922,
13776,
29908,
13,
13,
5215,
10876,
13,
5215,
931,
13,
3166,
19229,
1053,
2391,
29892,
28379,
13,
13,
15945,
29908,
13,
3226,
300,
3399,
448,
29871,
29900,
29900,
29953,
29896,
448,
313,
19302,
1974,
29897,
448,
9664,
403,
2391,
13,
991,
597,
280,
300,
401,
29889,
510,
29914,
17199,
29879,
29914,
23361,
29899,
1761,
29914,
13,
13,
9868,
669,
830,
1548,
358,
29901,
13,
1678,
11221,
278,
2343,
310,
263,
9024,
1051,
29892,
29871,
13,
1678,
16734,
278,
1051,
304,
278,
1492,
491,
413,
7600,
29889,
13,
13,
14023,
29871,
29896,
29901,
13,
1678,
10567,
29901,
2343,
353,
518,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
29892,
29945,
1402,
413,
353,
29871,
29906,
13,
1678,
10604,
29901,
518,
29946,
29892,
29945,
29892,
29896,
29892,
29906,
29892,
29941,
29962,
13,
14023,
29871,
29906,
29901,
13,
1678,
10567,
29901,
2343,
353,
518,
29900,
29892,
29896,
29892,
29906,
1402,
413,
353,
29871,
29946,
13,
1678,
10604,
29901,
518,
29906,
29892,
29900,
29892,
29896,
29962,
13,
13,
27427,
29901,
13,
1678,
450,
1353,
310,
7573,
297,
278,
1051,
338,
297,
278,
3464,
518,
29900,
29892,
29871,
29945,
29900,
29900,
1822,
13,
1678,
448,
29896,
29900,
29900,
5277,
9071,
29889,
791,
5277,
29871,
29896,
29900,
29900,
13,
268,
29900,
5277,
413,
5277,
29871,
29906,
334,
29871,
29896,
29900,
29985,
29929,
13,
15945,
29908,
13,
13,
13,
29937,
21940,
363,
1809,
368,
29899,
2324,
287,
1051,
29889,
13,
1990,
2391,
4247,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
659,
29922,
29900,
29892,
2446,
29922,
8516,
1125,
13,
4706,
1583,
29889,
791,
353,
659,
13,
4706,
1583,
29889,
4622,
353,
2446,
29871,
396,
445,
2794,
313,
1609,
2322,
1125,
1095,
29918,
3177,
29889,
4622,
1275,
6213,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2048,
29918,
2976,
368,
29918,
2324,
287,
29918,
1761,
29898,
791,
29918,
1761,
29901,
2391,
29961,
524,
29962,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
791,
29918,
1761,
29892,
1051,
29897,
470,
7431,
29898,
791,
29918,
1761,
29897,
5277,
29871,
29900,
29901,
13,
9651,
736,
6213,
13,
4706,
2343,
29918,
3177,
353,
2391,
4247,
29898,
791,
29922,
791,
29918,
1761,
29961,
29900,
2314,
13,
4706,
23246,
353,
2343,
29918,
3177,
13,
4706,
7431,
29918,
791,
353,
7431,
29898,
791,
29918,
1761,
29897,
13,
4706,
659,
29918,
2248,
353,
29871,
29896,
13,
4706,
1550,
659,
29918,
2248,
529,
7431,
29918,
791,
29901,
13,
9651,
716,
29918,
3177,
353,
2391,
4247,
29898,
791,
29922,
791,
29918,
1761,
29961,
791,
29918,
2248,
2314,
29871,
396,
1653,
716,
2943,
13,
9651,
23246,
29889,
4622,
353,
716,
29918,
3177,
29871,
396,
1809,
368,
1544,
13,
9651,
23246,
353,
716,
29918,
3177,
29871,
396,
4337,
13,
9651,
659,
29918,
2248,
4619,
29871,
29896,
13,
4706,
736,
2343,
29918,
3177,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1510,
29918,
791,
29918,
2976,
368,
29918,
2324,
287,
29918,
1761,
29898,
2813,
29918,
3177,
29897,
1599,
6213,
29901,
13,
4706,
396,
3682,
1206,
13,
4706,
565,
313,
1333,
338,
8758,
29898,
2813,
29918,
3177,
29892,
2391,
4247,
876,
322,
313,
2813,
29918,
3177,
338,
451,
6213,
1125,
13,
9651,
736,
6213,
29871,
396,
4829,
2343,
29918,
3177,
1134,
13,
4706,
565,
451,
338,
8758,
29898,
2813,
29918,
3177,
29892,
2391,
4247,
1125,
13,
9651,
736,
6213,
29871,
396,
4829,
302,
1134,
470,
817,
29876,
29915,
29873,
5217,
13,
4706,
23246,
353,
2343,
29918,
3177,
13,
4706,
1550,
23246,
29901,
13,
9651,
1596,
29898,
7414,
29889,
791,
29897,
13,
9651,
23246,
353,
23246,
29889,
4622,
13,
13,
13,
1990,
24380,
29901,
13,
1678,
822,
16734,
7341,
29898,
1311,
29892,
2343,
29901,
28379,
29961,
1293,
4247,
1402,
413,
29901,
938,
29897,
1599,
28379,
29961,
1293,
4247,
5387,
13,
4706,
396,
3682,
1206,
13,
4706,
565,
451,
338,
8758,
29898,
2813,
29892,
2391,
4247,
1125,
13,
9651,
736,
6213,
29871,
396,
4829,
2343,
1134,
13,
4706,
565,
451,
338,
8758,
29898,
2813,
29889,
4622,
29892,
2391,
4247,
1125,
13,
9651,
736,
2343,
29871,
396,
871,
697,
1543,
13,
4706,
4974,
338,
8758,
29898,
29895,
29892,
938,
29897,
322,
413,
6736,
29871,
29900,
13,
4706,
565,
413,
1275,
29871,
29900,
29901,
13,
9651,
736,
2343,
13,
4706,
396,
1667,
1158,
29901,
313,
16192,
29892,
2407,
278,
2343,
29892,
12464,
29892,
322,
476,
29899,
386,
2943,
29892,
988,
476,
353,
413,
1273,
7431,
29898,
2976,
368,
29899,
2324,
287,
1051,
876,
13,
4706,
736,
1583,
3032,
23361,
7341,
29898,
2813,
29892,
413,
29897,
13,
13,
1678,
822,
903,
23361,
7341,
29898,
1311,
29892,
2343,
29918,
3177,
29901,
28379,
29961,
1293,
4247,
1402,
413,
29901,
938,
29897,
1599,
28379,
29961,
1293,
4247,
5387,
13,
4706,
4974,
338,
8758,
29898,
2813,
29918,
3177,
29892,
2391,
4247,
29897,
322,
338,
8758,
29898,
2813,
29918,
3177,
29889,
4622,
29892,
2391,
4247,
29897,
13,
13,
4706,
17381,
29918,
2813,
353,
2391,
4247,
29898,
791,
29922,
9675,
29889,
3317,
2311,
29892,
2446,
29922,
2813,
29918,
3177,
29897,
29871,
396,
1281,
4151,
524,
29901,
448,
29896,
29900,
29900,
5277,
9071,
29889,
791,
5277,
29871,
29896,
29900,
29900,
13,
13,
4706,
12464,
353,
17381,
29918,
2813,
13,
4706,
269,
645,
29918,
2435,
353,
29871,
29900,
13,
4706,
1550,
338,
8758,
29898,
18237,
29889,
4622,
29892,
2391,
4247,
1125,
29871,
396,
679,
7431,
29898,
2976,
368,
29899,
2324,
287,
1051,
29897,
13,
9651,
269,
645,
29918,
2435,
4619,
29871,
29896,
13,
9651,
12464,
353,
12464,
29889,
4622,
13,
4706,
396,
1286,
23246,
338,
278,
12464,
2943,
13,
4706,
413,
1273,
29922,
269,
645,
29918,
2435,
13,
4706,
565,
413,
1275,
29871,
29900,
29901,
13,
9651,
736,
2343,
29918,
3177,
13,
13,
4706,
396,
1284,
278,
1023,
16679,
7573,
13,
4706,
16679,
29918,
1563,
353,
17381,
29918,
2813,
13,
4706,
4331,
29918,
11808,
353,
269,
645,
29918,
2435,
448,
413,
13,
4706,
363,
903,
297,
3464,
29898,
10568,
29918,
11808,
1125,
13,
9651,
16679,
29918,
1563,
353,
16679,
29918,
1563,
29889,
4622,
13,
4706,
16679,
29918,
1266,
353,
16679,
29918,
1563,
29889,
4622,
13,
13,
4706,
396,
2343,
856,
1030,
5086,
29918,
1563,
29871,
16679,
29918,
1266,
856,
18237,
29871,
1599,
29871,
16679,
29918,
1266,
856,
18237,
29871,
2343,
856,
1030,
5086,
29918,
1563,
13,
4706,
17381,
29918,
2813,
29889,
4622,
353,
16679,
29918,
1266,
13,
4706,
16679,
29918,
1563,
29889,
4622,
353,
6213,
13,
4706,
12464,
29889,
4622,
353,
2343,
29918,
3177,
13,
13,
4706,
736,
17381,
29918,
2813,
29889,
4622,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
396,
8741,
29871,
29896,
29901,
10604,
29901,
518,
29946,
29892,
29945,
29892,
29896,
29892,
29906,
29892,
29941,
29962,
13,
1678,
396,
2343,
353,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29962,
13,
1678,
396,
413,
353,
29871,
29906,
13,
13,
1678,
396,
8741,
29871,
29906,
29901,
10604,
29901,
518,
29906,
29892,
29900,
29892,
29896,
29962,
13,
1678,
2343,
353,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
29962,
13,
1678,
413,
353,
29871,
29946,
13,
13,
1678,
2343,
29918,
3177,
353,
2391,
4247,
29889,
4282,
29918,
2976,
368,
29918,
2324,
287,
29918,
1761,
29898,
2813,
29897,
13,
13,
1678,
396,
2069,
2777,
13,
1678,
1650,
353,
24380,
580,
13,
13,
1678,
396,
1065,
669,
931,
13,
1678,
1369,
353,
931,
29889,
5014,
29918,
2230,
580,
13,
1678,
6063,
353,
1650,
29889,
23361,
7341,
29898,
2813,
29918,
3177,
29892,
413,
29897,
13,
1678,
1095,
353,
931,
29889,
5014,
29918,
2230,
580,
13,
13,
1678,
396,
1510,
1234,
13,
1678,
1596,
28909,
29876,
22550,
29901,
1495,
13,
1678,
396,
1596,
29898,
550,
29889,
791,
29897,
13,
1678,
2391,
4247,
29889,
4294,
29918,
791,
29918,
2976,
368,
29918,
2324,
287,
29918,
1761,
29898,
550,
29897,
13,
13,
1678,
396,
1510,
931,
27430,
13,
1678,
1596,
877,
27795,
5974,
29901,
18695,
29945,
29888,
10887,
29915,
1273,
5135,
355,
448,
1369,
29897,
334,
29871,
29896,
29900,
29900,
29900,
876,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
10876,
29889,
13322,
29898,
3396,
3101,
13,
2
] |
app/health.py | statisticsnorway/bip-initializer | 3 | 1608701 | from fastapi import APIRouter
router = APIRouter()
@router.get("/health/alive")
async def alive():
return {"status": "I'm not dead!"}
@router.get("/health/ready")
async def ready():
return {"status": "Ready"}
| [
1,
515,
5172,
2754,
1053,
3450,
23971,
13,
13,
15140,
353,
3450,
23971,
580,
13,
13,
13,
29992,
15140,
29889,
657,
11974,
354,
4298,
29914,
284,
573,
1159,
13,
12674,
822,
18758,
7295,
13,
1678,
736,
8853,
4882,
1115,
376,
29902,
29915,
29885,
451,
7123,
3850,
29913,
13,
13,
13,
29992,
15140,
29889,
657,
11974,
354,
4298,
29914,
2040,
1159,
13,
12674,
822,
7960,
7295,
13,
1678,
736,
8853,
4882,
1115,
376,
28181,
9092,
13,
2
] |
robot.py | dragonrobotics/2018-PowerUp | 2 | 23314 | import wpilib
import constants
import swerve
import lift
import winch
import sys
from teleop import Teleop
from autonomous.baseline_simple import Autonomous
from sensors.imu import IMU
def log(src, msg):
try:
full_msg = "[{:.3f}] [{}] {}".format(
wpilib.Timer.getMatchTime(), str(src), str(msg)
)
print(full_msg, file=sys.stderr)
except: # noqa: E772
full_msg = "[{:.3f}] [log] Caught exception when logging: {} {}".format( # noqa: E501
wpilib.Timer.getMatchTime(),
str(sys.exc_info()[0]),
str(sys.exc_info()[1])
)
print(full_msg, file=sys.stderr)
def log_exception(src, locstr):
# i.e. caught {ValueError} {in my_method}: {could not cast X to Y}
log(src, "Caught {} {}: {}".format(
str(sys.exc_info()[0]), locstr, str(sys.exc_info()[1])
))
class Robot(wpilib.IterativeRobot):
def robotInit(self):
constants.load_control_config()
wpilib.CameraServer.launch('driver_vision.py:main')
self.autoPositionSelect = wpilib.SendableChooser()
self.autoPositionSelect.addDefault('Middle-Baseline', 'Middle-Baseline')
self.autoPositionSelect.addObject('Middle-Placement', 'Middle-Placement') # noqa: E501
self.autoPositionSelect.addObject('Left', 'Left')
self.autoPositionSelect.addObject('Right', 'Right')
wpilib.SmartDashboard.putData(
'Robot Starting Position',
self.autoPositionSelect)
self.drivetrain = swerve.SwerveDrive(
constants.chassis_length,
constants.chassis_width,
constants.swerve_config
)
self.drivetrain.load_config_values()
self.lift = lift.ManualControlLift(
constants.lift_ids['left'],
constants.lift_ids['right'],
constants.lift_limit_channel,
constants.start_limit_channel
)
self.winch = winch.Winch(
constants.winch_id
)
self.throttle = wpilib.Joystick(1)
self.claw = lift.Claw(
constants.claw_id,
constants.claw_follower_id
)
self.imu = IMU(wpilib.SPI.Port.kMXP)
self.sd_update_timer = wpilib.Timer()
self.sd_update_timer.reset()
self.sd_update_timer.start()
def disabledInit(self):
pass
def disabledPeriodic(self):
try:
self.lift.load_config_values()
self.drivetrain.load_config_values()
except: # noqa: E772
log_exception('disabled', 'when loading config')
try:
self.drivetrain.update_smart_dashboard()
self.imu.update_smart_dashboard()
self.lift.update_smart_dashboard()
self.winch.update_smart_dashboard()
wpilib.SmartDashboard.putNumber(
"Throttle Pos", self.throttle.getRawAxis(constants.liftAxis)
)
except: # noqa: E772
log_exception('disabled', 'when updating SmartDashboard')
try:
self.lift.checkLimitSwitch()
pass
except: # noqa: E772
log_exception('disabled', 'when checking lift limit switch')
self.drivetrain.update_smart_dashboard()
def autonomousInit(self):
try:
self.drivetrain.load_config_values()
self.lift.load_config_values()
except: # noqa: E772
log_exception('auto-init', 'when loading config')
self.autoPos = None
try:
self.autoPos = self.autoPositionSelect.getSelected()
except: # noqa: E772
self.autoPos = None
log_exception('auto-init', 'when getting robot start position')
try:
if self.autoPos is not None and self.autoPos != 'None':
self.auto = Autonomous(self, self.autoPos)
else:
log('auto-init', 'Disabling autonomous...')
except: # noqa: E772
log_exception('auto-init', 'in Autonomous constructor')
try:
self.lift.checkLimitSwitch()
pass
except: # noqa: E772
log_exception('auto-init', 'when checking lift limit switch')
def autonomousPeriodic(self):
try:
if self.sd_update_timer.hasPeriodPassed(0.5):
self.auto.update_smart_dashboard()
self.imu.update_smart_dashboard()
self.drivetrain.update_smart_dashboard()
self.lift.update_smart_dashboard()
self.winch.update_smart_dashboard()
except: # noqa: E772
log_exception('auto', 'when updating SmartDashboard')
try:
if self.autoPos is not None and self.autoPos != 'None':
self.auto.periodic()
except: # noqa: E772
# Stop everything.
self.drivetrain.immediate_stop()
self.lift.setLiftPower(0)
self.claw.set_power(0)
self.winch.stop()
log_exception('auto', 'in auto :periodic()')
try:
self.lift.checkLimitSwitch()
pass
except: # noqa: E772
log_exception('auto', 'when checking lift limit switch')
def teleopInit(self):
try:
self.teleop = Teleop(self)
except: # noqa: E772
log_exception('teleop-init', 'in Teleop constructor')
try:
self.drivetrain.load_config_values()
self.lift.load_config_values()
constants.load_control_config()
except: # noqa: E772
log_exception('teleop-init', 'when loading config')
try:
self.lift.checkLimitSwitch()
pass
except: # noqa: E772
log_exception('teleop-init', 'when checking lift limit switch')
def teleopPeriodic(self):
try:
self.teleop.drive()
except: # noqa: E772
log_exception('teleop', 'in drive control')
self.drivetrain.immediate_stop()
try:
self.teleop.buttons()
except: # noqa: E772
log_exception('teleop', 'in button handler')
try:
self.teleop.lift_control()
except: # noqa: E772
log_exception('teleop', 'in lift_control')
self.lift.setLiftPower(0)
try:
self.teleop.claw_control()
except: # noqa: E772
log_exception('teleop', 'in claw_control')
self.claw.set_power(0)
try:
self.teleop.winch_control()
except: # noqa: E772
log_exception('teleop', 'in winch_control')
self.winch.stop()
try:
self.lift.checkLimitSwitch()
pass
except: # noqa: E772
log_exception('teleop', 'in lift.checkLimitSwitch')
if self.sd_update_timer.hasPeriodPassed(0.5):
try:
constants.load_control_config()
self.drivetrain.load_config_values()
self.lift.load_config_values()
except: # noqa: E772
log_exception('teleop', 'when loading config')
try:
self.drivetrain.update_smart_dashboard()
self.teleop.update_smart_dashboard()
self.imu.update_smart_dashboard()
self.lift.update_smart_dashboard()
self.winch.update_smart_dashboard()
except: # noqa: E772
log_exception('teleop', 'when updating SmartDashboard')
# for module in self.drivetrain.modules:
# module.set_steer_angle(0)
if __name__ == "__main__":
wpilib.run(Robot)
| [
1,
1053,
19247,
15943,
13,
5215,
17727,
13,
5215,
269,
556,
345,
13,
5215,
13777,
13,
5215,
5401,
305,
13,
5215,
10876,
13,
3166,
4382,
459,
1053,
9699,
459,
13,
3166,
28273,
681,
29889,
6500,
5570,
29918,
12857,
1053,
5202,
4917,
681,
13,
3166,
4771,
943,
29889,
326,
29884,
1053,
22313,
29965,
13,
13,
13,
1753,
1480,
29898,
4351,
29892,
10191,
1125,
13,
1678,
1018,
29901,
13,
4706,
2989,
29918,
7645,
353,
14704,
25641,
29889,
29941,
29888,
6525,
15974,
6525,
6571,
1642,
4830,
29898,
13,
9651,
19247,
15943,
29889,
14745,
29889,
657,
9652,
2481,
3285,
851,
29898,
4351,
511,
851,
29898,
7645,
29897,
13,
4706,
1723,
13,
13,
4706,
1596,
29898,
8159,
29918,
7645,
29892,
934,
29922,
9675,
29889,
303,
20405,
29897,
13,
1678,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
4706,
2989,
29918,
7645,
353,
14704,
25641,
29889,
29941,
29888,
6525,
518,
1188,
29962,
315,
6482,
3682,
746,
12183,
29901,
6571,
6571,
1642,
4830,
29898,
29871,
396,
694,
25621,
29901,
382,
29945,
29900,
29896,
13,
9651,
19247,
15943,
29889,
14745,
29889,
657,
9652,
2481,
3285,
13,
9651,
851,
29898,
9675,
29889,
735,
29883,
29918,
3888,
580,
29961,
29900,
11724,
13,
9651,
851,
29898,
9675,
29889,
735,
29883,
29918,
3888,
580,
29961,
29896,
2314,
13,
4706,
1723,
13,
13,
4706,
1596,
29898,
8159,
29918,
7645,
29892,
934,
29922,
9675,
29889,
303,
20405,
29897,
13,
13,
13,
1753,
1480,
29918,
11739,
29898,
4351,
29892,
1180,
710,
1125,
13,
1678,
396,
474,
29889,
29872,
29889,
12624,
426,
1917,
2392,
29913,
426,
262,
590,
29918,
5696,
6177,
426,
26680,
451,
4320,
1060,
304,
612,
29913,
13,
1678,
1480,
29898,
4351,
29892,
376,
29907,
6482,
6571,
426,
6177,
6571,
1642,
4830,
29898,
13,
4706,
851,
29898,
9675,
29889,
735,
29883,
29918,
3888,
580,
29961,
29900,
11724,
1180,
710,
29892,
851,
29898,
9675,
29889,
735,
29883,
29918,
3888,
580,
29961,
29896,
2314,
13,
268,
876,
13,
13,
13,
1990,
6417,
327,
29898,
11912,
15943,
29889,
13463,
1230,
21860,
327,
1125,
13,
1678,
822,
19964,
6644,
29898,
1311,
1125,
13,
4706,
17727,
29889,
1359,
29918,
6451,
29918,
2917,
580,
13,
13,
4706,
19247,
15943,
29889,
20717,
6004,
29889,
15343,
877,
9465,
29918,
4924,
29889,
2272,
29901,
3396,
1495,
13,
13,
4706,
1583,
29889,
6921,
8003,
3549,
353,
19247,
15943,
29889,
12600,
519,
15954,
22969,
580,
13,
4706,
1583,
29889,
6921,
8003,
3549,
29889,
1202,
4592,
877,
25411,
29899,
9496,
5570,
742,
525,
25411,
29899,
9496,
5570,
1495,
13,
4706,
1583,
29889,
6921,
8003,
3549,
29889,
1202,
2061,
877,
25411,
29899,
29925,
9552,
742,
525,
25411,
29899,
29925,
9552,
1495,
29871,
396,
694,
25621,
29901,
382,
29945,
29900,
29896,
13,
4706,
1583,
29889,
6921,
8003,
3549,
29889,
1202,
2061,
877,
8091,
742,
525,
8091,
1495,
13,
4706,
1583,
29889,
6921,
8003,
3549,
29889,
1202,
2061,
877,
7341,
742,
525,
7341,
1495,
13,
13,
4706,
19247,
15943,
29889,
12636,
442,
29928,
1161,
3377,
29889,
649,
1469,
29898,
13,
9651,
525,
21860,
327,
23748,
20627,
742,
13,
9651,
1583,
29889,
6921,
8003,
3549,
29897,
13,
13,
4706,
1583,
29889,
29881,
1150,
300,
6038,
353,
269,
556,
345,
29889,
29903,
556,
345,
29928,
4401,
29898,
13,
9651,
17727,
29889,
305,
465,
275,
29918,
2848,
29892,
13,
9651,
17727,
29889,
305,
465,
275,
29918,
2103,
29892,
13,
9651,
17727,
29889,
581,
345,
29918,
2917,
13,
4706,
1723,
13,
4706,
1583,
29889,
29881,
1150,
300,
6038,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
13,
4706,
1583,
29889,
29880,
2027,
353,
13777,
29889,
2517,
950,
4809,
29931,
2027,
29898,
13,
9651,
17727,
29889,
29880,
2027,
29918,
4841,
1839,
1563,
7464,
13,
9651,
17727,
29889,
29880,
2027,
29918,
4841,
1839,
1266,
7464,
13,
9651,
17727,
29889,
29880,
2027,
29918,
13400,
29918,
12719,
29892,
13,
9651,
17727,
29889,
2962,
29918,
13400,
29918,
12719,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
5080,
305,
353,
5401,
305,
29889,
17734,
305,
29898,
13,
9651,
17727,
29889,
5080,
305,
29918,
333,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
386,
26970,
280,
353,
19247,
15943,
29889,
10844,
858,
860,
29898,
29896,
29897,
13,
13,
4706,
1583,
29889,
29883,
10653,
353,
13777,
29889,
29907,
10653,
29898,
13,
9651,
17727,
29889,
29883,
10653,
29918,
333,
29892,
13,
9651,
17727,
29889,
29883,
10653,
29918,
23031,
261,
29918,
333,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
326,
29884,
353,
22313,
29965,
29898,
11912,
15943,
29889,
29903,
2227,
29889,
2290,
29889,
29895,
29924,
29990,
29925,
29897,
13,
13,
4706,
1583,
29889,
4928,
29918,
5504,
29918,
20404,
353,
19247,
15943,
29889,
14745,
580,
13,
4706,
1583,
29889,
4928,
29918,
5504,
29918,
20404,
29889,
12071,
580,
13,
4706,
1583,
29889,
4928,
29918,
5504,
29918,
20404,
29889,
2962,
580,
13,
13,
1678,
822,
12708,
6644,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
12708,
29853,
293,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29880,
2027,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
9651,
1583,
29889,
29881,
1150,
300,
6038,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
18279,
742,
525,
8256,
8363,
2295,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29881,
1150,
300,
6038,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
9651,
1583,
29889,
326,
29884,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
9651,
1583,
29889,
29880,
2027,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
9651,
1583,
29889,
5080,
305,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
13,
9651,
19247,
15943,
29889,
12636,
442,
29928,
1161,
3377,
29889,
649,
4557,
29898,
13,
18884,
376,
1349,
26970,
280,
10321,
613,
1583,
29889,
386,
26970,
280,
29889,
657,
22131,
16070,
29898,
3075,
1934,
29889,
29880,
2027,
16070,
29897,
13,
9651,
1723,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
18279,
742,
525,
8256,
13271,
4116,
442,
29928,
1161,
3377,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29880,
2027,
29889,
3198,
24445,
24995,
580,
13,
9651,
1209,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
18279,
742,
525,
8256,
8454,
13777,
4046,
4607,
1495,
13,
13,
4706,
1583,
29889,
29881,
1150,
300,
6038,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
13,
1678,
822,
28273,
681,
6644,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29881,
1150,
300,
6038,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
9651,
1583,
29889,
29880,
2027,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
6921,
29899,
2344,
742,
525,
8256,
8363,
2295,
1495,
13,
13,
4706,
1583,
29889,
6921,
9135,
353,
6213,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
6921,
9135,
353,
1583,
29889,
6921,
8003,
3549,
29889,
657,
8592,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1583,
29889,
6921,
9135,
353,
6213,
13,
9651,
1480,
29918,
11739,
877,
6921,
29899,
2344,
742,
525,
8256,
2805,
19964,
1369,
2602,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
565,
1583,
29889,
6921,
9135,
338,
451,
6213,
322,
1583,
29889,
6921,
9135,
2804,
525,
8516,
2396,
13,
18884,
1583,
29889,
6921,
353,
5202,
4917,
681,
29898,
1311,
29892,
1583,
29889,
6921,
9135,
29897,
13,
9651,
1683,
29901,
13,
18884,
1480,
877,
6921,
29899,
2344,
742,
525,
4205,
17961,
28273,
681,
856,
1495,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
6921,
29899,
2344,
742,
525,
262,
5202,
4917,
681,
5823,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29880,
2027,
29889,
3198,
24445,
24995,
580,
13,
9651,
1209,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
6921,
29899,
2344,
742,
525,
8256,
8454,
13777,
4046,
4607,
1495,
13,
13,
1678,
822,
28273,
681,
29853,
293,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
565,
1583,
29889,
4928,
29918,
5504,
29918,
20404,
29889,
5349,
29853,
7129,
287,
29898,
29900,
29889,
29945,
1125,
13,
18884,
1583,
29889,
6921,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
326,
29884,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
29881,
1150,
300,
6038,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
29880,
2027,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
5080,
305,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
6921,
742,
525,
8256,
13271,
4116,
442,
29928,
1161,
3377,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
565,
1583,
29889,
6921,
9135,
338,
451,
6213,
322,
1583,
29889,
6921,
9135,
2804,
525,
8516,
2396,
13,
18884,
1583,
29889,
6921,
29889,
19145,
293,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
396,
22303,
4129,
29889,
13,
9651,
1583,
29889,
29881,
1150,
300,
6038,
29889,
326,
13847,
29918,
9847,
580,
13,
9651,
1583,
29889,
29880,
2027,
29889,
842,
29931,
2027,
21472,
29898,
29900,
29897,
13,
9651,
1583,
29889,
29883,
10653,
29889,
842,
29918,
13519,
29898,
29900,
29897,
13,
9651,
1583,
29889,
5080,
305,
29889,
9847,
580,
13,
9651,
1480,
29918,
11739,
877,
6921,
742,
525,
262,
4469,
584,
19145,
293,
580,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29880,
2027,
29889,
3198,
24445,
24995,
580,
13,
9651,
1209,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
6921,
742,
525,
8256,
8454,
13777,
4046,
4607,
1495,
13,
13,
1678,
822,
4382,
459,
6644,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
15494,
459,
353,
9699,
459,
29898,
1311,
29897,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
29899,
2344,
742,
525,
262,
9699,
459,
5823,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29881,
1150,
300,
6038,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
9651,
1583,
29889,
29880,
2027,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
9651,
17727,
29889,
1359,
29918,
6451,
29918,
2917,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
29899,
2344,
742,
525,
8256,
8363,
2295,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29880,
2027,
29889,
3198,
24445,
24995,
580,
13,
9651,
1209,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
29899,
2344,
742,
525,
8256,
8454,
13777,
4046,
4607,
1495,
13,
13,
1678,
822,
4382,
459,
29853,
293,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
15494,
459,
29889,
21594,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
262,
7899,
2761,
1495,
13,
9651,
1583,
29889,
29881,
1150,
300,
6038,
29889,
326,
13847,
29918,
9847,
580,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
15494,
459,
29889,
4187,
7453,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
262,
2826,
7834,
1495,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
15494,
459,
29889,
29880,
2027,
29918,
6451,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
262,
13777,
29918,
6451,
1495,
13,
9651,
1583,
29889,
29880,
2027,
29889,
842,
29931,
2027,
21472,
29898,
29900,
29897,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
15494,
459,
29889,
29883,
10653,
29918,
6451,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
262,
3711,
29893,
29918,
6451,
1495,
13,
9651,
1583,
29889,
29883,
10653,
29889,
842,
29918,
13519,
29898,
29900,
29897,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
15494,
459,
29889,
5080,
305,
29918,
6451,
580,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
262,
5401,
305,
29918,
6451,
1495,
13,
9651,
1583,
29889,
5080,
305,
29889,
9847,
580,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
29880,
2027,
29889,
3198,
24445,
24995,
580,
13,
9651,
1209,
13,
4706,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
9651,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
262,
13777,
29889,
3198,
24445,
24995,
1495,
13,
13,
4706,
565,
1583,
29889,
4928,
29918,
5504,
29918,
20404,
29889,
5349,
29853,
7129,
287,
29898,
29900,
29889,
29945,
1125,
13,
9651,
1018,
29901,
13,
18884,
17727,
29889,
1359,
29918,
6451,
29918,
2917,
580,
13,
18884,
1583,
29889,
29881,
1150,
300,
6038,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
18884,
1583,
29889,
29880,
2027,
29889,
1359,
29918,
2917,
29918,
5975,
580,
13,
9651,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
18884,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
8256,
8363,
2295,
1495,
13,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
29881,
1150,
300,
6038,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
15494,
459,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
326,
29884,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
29880,
2027,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
18884,
1583,
29889,
5080,
305,
29889,
5504,
29918,
3844,
442,
29918,
14592,
3377,
580,
13,
9651,
5174,
29901,
29871,
396,
694,
25621,
29901,
382,
29955,
29955,
29906,
13,
18884,
1480,
29918,
11739,
877,
15494,
459,
742,
525,
8256,
13271,
4116,
442,
29928,
1161,
3377,
1495,
13,
4706,
396,
363,
3883,
297,
1583,
29889,
29881,
1150,
300,
6038,
29889,
7576,
29901,
13,
4706,
396,
268,
3883,
29889,
842,
29918,
1655,
261,
29918,
2521,
29898,
29900,
29897,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
19247,
15943,
29889,
3389,
29898,
21860,
327,
29897,
13,
2
] |
python/mzcloud/models/historical_deployment_delta.py | MaterializeInc/cloud-sdks | 0 | 115646 | from typing import Any, BinaryIO, Dict, List, Optional, TextIO, Tuple, Type, TypeVar, cast
import attr
from ..models.historical_deployment_change import HistoricalDeploymentChange
from ..models.historical_deployment_metadata import HistoricalDeploymentMetadata
from ..types import UNSET, Unset
T = TypeVar("T", bound="HistoricalDeploymentDelta")
@attr.s(auto_attribs=True)
class HistoricalDeploymentDelta:
""" """
changes: HistoricalDeploymentChange
metadata: HistoricalDeploymentMetadata
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
def to_dict(self) -> Dict[str, Any]:
changes = self.changes.to_dict()
metadata = self.metadata.to_dict()
field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
field_dict.update(
{
"changes": changes,
"metadata": metadata,
}
)
return field_dict
@classmethod
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
d = src_dict.copy()
changes = HistoricalDeploymentChange.from_dict(d.pop("changes"))
metadata = HistoricalDeploymentMetadata.from_dict(d.pop("metadata"))
historical_deployment_delta = cls(
changes=changes,
metadata=metadata,
)
historical_deployment_delta.additional_properties = d
return historical_deployment_delta
@property
def additional_keys(self) -> List[str]:
return list(self.additional_properties.keys())
def __getitem__(self, key: str) -> Any:
return self.additional_properties[key]
def __setitem__(self, key: str, value: Any) -> None:
self.additional_properties[key] = value
def __delitem__(self, key: str) -> None:
del self.additional_properties[key]
def __contains__(self, key: str) -> bool:
return key in self.additional_properties
| [
1,
515,
19229,
1053,
3139,
29892,
29479,
5971,
29892,
360,
919,
29892,
2391,
29892,
28379,
29892,
3992,
5971,
29892,
12603,
552,
29892,
5167,
29892,
5167,
9037,
29892,
4320,
13,
13,
5215,
12421,
13,
13,
3166,
6317,
9794,
29889,
16211,
936,
29918,
16519,
358,
29918,
3167,
1053,
20315,
8498,
22812,
7277,
13,
3166,
6317,
9794,
29889,
16211,
936,
29918,
16519,
358,
29918,
19635,
1053,
20315,
8498,
22812,
18417,
13,
3166,
6317,
8768,
1053,
8291,
10490,
29892,
853,
842,
13,
13,
29911,
353,
5167,
9037,
703,
29911,
613,
3216,
543,
29950,
2118,
936,
8498,
22812,
5268,
1159,
13,
13,
13,
29992,
5552,
29889,
29879,
29898,
6921,
29918,
1131,
1091,
29879,
29922,
5574,
29897,
13,
1990,
20315,
8498,
22812,
5268,
29901,
13,
1678,
9995,
9995,
13,
13,
1678,
3620,
29901,
20315,
8498,
22812,
7277,
13,
1678,
15562,
29901,
20315,
8498,
22812,
18417,
13,
1678,
5684,
29918,
11330,
29901,
360,
919,
29961,
710,
29892,
3139,
29962,
353,
12421,
29889,
747,
29898,
2344,
29922,
8824,
29892,
12529,
29922,
8977,
29897,
13,
13,
1678,
822,
304,
29918,
8977,
29898,
1311,
29897,
1599,
360,
919,
29961,
710,
29892,
3139,
5387,
13,
4706,
3620,
353,
1583,
29889,
25990,
29889,
517,
29918,
8977,
580,
13,
13,
4706,
15562,
353,
1583,
29889,
19635,
29889,
517,
29918,
8977,
580,
13,
13,
4706,
1746,
29918,
8977,
29901,
360,
919,
29961,
710,
29892,
3139,
29962,
353,
6571,
13,
4706,
1746,
29918,
8977,
29889,
5504,
29898,
1311,
29889,
1202,
3245,
29918,
11330,
29897,
13,
4706,
1746,
29918,
8977,
29889,
5504,
29898,
13,
9651,
426,
13,
18884,
376,
25990,
1115,
3620,
29892,
13,
18884,
376,
19635,
1115,
15562,
29892,
13,
9651,
500,
13,
4706,
1723,
13,
13,
4706,
736,
1746,
29918,
8977,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
8977,
29898,
25932,
29901,
5167,
29961,
29911,
1402,
4765,
29918,
8977,
29901,
360,
919,
29961,
710,
29892,
3139,
2314,
1599,
323,
29901,
13,
4706,
270,
353,
4765,
29918,
8977,
29889,
8552,
580,
13,
4706,
3620,
353,
20315,
8498,
22812,
7277,
29889,
3166,
29918,
8977,
29898,
29881,
29889,
7323,
703,
25990,
5783,
13,
13,
4706,
15562,
353,
20315,
8498,
22812,
18417,
29889,
3166,
29918,
8977,
29898,
29881,
29889,
7323,
703,
19635,
5783,
13,
13,
4706,
15839,
29918,
16519,
358,
29918,
4181,
353,
1067,
29879,
29898,
13,
9651,
3620,
29922,
25990,
29892,
13,
9651,
15562,
29922,
19635,
29892,
13,
4706,
1723,
13,
13,
4706,
15839,
29918,
16519,
358,
29918,
4181,
29889,
1202,
3245,
29918,
11330,
353,
270,
13,
4706,
736,
15839,
29918,
16519,
358,
29918,
4181,
13,
13,
1678,
732,
6799,
13,
1678,
822,
5684,
29918,
8149,
29898,
1311,
29897,
1599,
2391,
29961,
710,
5387,
13,
4706,
736,
1051,
29898,
1311,
29889,
1202,
3245,
29918,
11330,
29889,
8149,
3101,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
1820,
29901,
851,
29897,
1599,
3139,
29901,
13,
4706,
736,
1583,
29889,
1202,
3245,
29918,
11330,
29961,
1989,
29962,
13,
13,
1678,
822,
4770,
842,
667,
12035,
1311,
29892,
1820,
29901,
851,
29892,
995,
29901,
3139,
29897,
1599,
6213,
29901,
13,
4706,
1583,
29889,
1202,
3245,
29918,
11330,
29961,
1989,
29962,
353,
995,
13,
13,
1678,
822,
4770,
6144,
667,
12035,
1311,
29892,
1820,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
628,
1583,
29889,
1202,
3245,
29918,
11330,
29961,
1989,
29962,
13,
13,
1678,
822,
4770,
11516,
12035,
1311,
29892,
1820,
29901,
851,
29897,
1599,
6120,
29901,
13,
4706,
736,
1820,
297,
1583,
29889,
1202,
3245,
29918,
11330,
13,
2
] |
scripts/labtainer-instructor/bin/regresstest.py | jakuta-tech/Labtainers | 0 | 62472 | <gh_stars>0
#!/usr/bin/env python3
'''
This software was created by United States Government employees at
The Center for Cybersecurity and Cyber Operations (C3O)
at the Naval Postgraduate School NPS. Please note that within the
United States, copyright protection is not available for any works
created by United States Government employees, pursuant to Title 17
United States Code Section 105. This software is in the public
domain and is not subject to copyright.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
'''
# Filename: regresstest.py
# Description:
# Regression Testing script. This script will make use of labutils.
#
#
import sys
import os
import getpass
import time
import imp
gradelab = imp.load_source('gradelab', 'bin/gradelab')
instructor_cwd = os.getcwd()
student_cwd = instructor_cwd.replace('labtainer-instructor', 'labtainer-student')
# Append Student CWD to sys.path
sys.path.append(student_cwd+"/bin")
import labutils
import logging
import LabtainerLogging
import ParseLabtainerConfig
def usage():
sys.stderr.write("Usage: regresstest.py [<labname> | -a <labname>]\n")
sys.stderr.write(" <labname> : regression test on <labname> only\n")
sys.stderr.write(" -a <labname> : continue running regression test from <labname>\n")
sys.exit(1)
LABS_ROOT = os.path.abspath('../../labs')
def compareGrades(GradesGold, Grades):
GradesGoldLines = {}
GradesLines = {}
with open(GradesGold) as gradesgoldfile:
for line in gradesgoldfile:
linestrip = line.strip()
if not linestrip or linestrip.startswith("#"):
continue
linetoken = linestrip.split()
student_email = linetoken[0]
if "_at_" in student_email:
if student_email in GradesGoldLines:
logger.error("GradesGold file error: Multiple entries for the same student's e-mail %s" % student_email)
return False
else:
new_line = line.strip().replace(" ", "")
GradesGoldLines[student_email] = new_line
with open(Grades) as gradesfile:
for line in gradesfile:
linestrip = line.strip()
if not linestrip or linestrip.startswith("#"):
continue
linetoken = linestrip.split()
student_email = linetoken[0]
if "_at_" in student_email:
if student_email in GradesLines:
logger.error("Grades file error: Multiple entries for the same student's e-mail %s" % student_email)
return False
else:
new_line = line.strip().replace(" ", "")
GradesLines[student_email] = new_line
if GradesGoldLines == GradesLines:
return True
else:
return False
def RegressTest(lab_path, standard, logger):
labname = os.path.basename(lab_path)
labtainer_config_dir = os.path.join(os.path.dirname(os.path.dirname(lab_path)), 'config', 'labtainer.config')
labtainer_config = ParseLabtainerConfig.ParseLabtainerConfig(labtainer_config_dir, logger)
labutils.is_valid_lab(lab_path)
regresstest_lab_path = os.path.join(labtainer_config.testsets_root, labname, standard)
host_home_xfer = os.path.join(labtainer_config.host_home_xfer, labname)
logger.debug("Host Xfer directory for labname %s is %s" % (labname, host_home_xfer))
logger.debug("Regression Test path for labname %s is %s" % (labname, regresstest_lab_path))
GradesGold = "%s/%s.grades.txt" % (regresstest_lab_path, labname)
username = getpass.getuser()
Grades = "/home/%s/%s/%s.grades.txt" % (username, host_home_xfer, labname)
logger.debug("GradesGold is %s - Grades is %s" % (GradesGold, Grades))
is_regress_test = standard
check_watermark = False
auto_grade = True
debug_grade = False
gradelab.doGrade(labname, False, False, True, False, regress_test=GradesGold)
# for name, container in start_config.containers.items():
# mycontainer_name = container.full_name
# container_user = container.user
#
# if mycontainer_name == start_config.grade_container:
# logger.debug('about to RunInstructorCreateDradeFile for container %s' % start_config.grade_container)
# RunInstructorCreateGradeFile(start_config.grade_container, container_user, labname, check_watermark)
# Pass 'True' to ignore_stop_error (i.e., ignore stop error)
CompareResult = False
# GradesGold and Grades must exist
logger.debug('compare %s to %s' % (GradesGold, Grades))
if not os.path.exists(GradesGold):
logger.error("GradesGold %s file does not exist!" % GradesGold)
elif not os.path.exists(Grades):
logger.error("Grades %s file does not exist!" % Grades)
else:
CompareResult = compareGrades(GradesGold, Grades)
return CompareResult
def main():
labnamelist = []
num_args = len(sys.argv)
choplist = False
if num_args == 1:
labnamelist = os.listdir(LABS_ROOT)
elif num_args == 2:
labnamelist.append(sys.argv[1])
elif num_args == 3:
dash_a = sys.argv[1]
if dash_a != "-a":
usage()
labnamelist = os.listdir(LABS_ROOT)
labnamestart = sys.argv[2]
if labnamestart not in labnamelist:
sys.stderr.write("Using non-existent <labname> with -a option!\n")
usage()
choplist = True
else:
usage()
finallabnamelist = []
if choplist:
startfound = False
for labname in sorted(labnamelist):
if not startfound:
if labname == labnamestart:
finallabnamelist.append(labname)
startfound = True
else:
continue
else:
finallabnamelist.append(labname)
else:
finallabnamelist = labnamelist
for labname in sorted(finallabnamelist):
labutils.logger = LabtainerLogging.LabtainerLogging("labtainer-regress.log", labname, "../../config/labtainer.config")
labutils.logger.info("Begin logging regresstest.py for %s lab" % labname)
labutils.logger.debug("Current name is (%s)" % labname)
fulllabname = os.path.join(LABS_ROOT, labname)
if labname == "etc" or labname == "bin":
labutils.logger.debug("skipping etc or bin")
continue
if os.path.isdir(fulllabname):
labutils.logger.debug("(%s) is directory - assume (%s) is a labname" % (fulllabname, labname))
# RegressTest will do test following:
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path = dir_path[:dir_path.index("scripts")]
dir_path += "testsets/labs/" + labname
if not os.path.isdir(dir_path):
labutils.logger.info("no tests found for "+labname)
continue
crude_standards = os.listdir(dir_path)
standards = []
for items in crude_standards:
if "." not in items:
standards.append(items)
lab_path = os.path.join(LABS_ROOT, labname)
if len(standards) == 0:
print('Did not find any subdirectories under %s' % lab_path)
print('Test paths should be testsets/labs/[lab]/GOLD/...')
for standard in standards:
RegressTestResult = RegressTest(lab_path, standard, labutils.logger)
if RegressTestResult == False:
# False means grades.txt.GOLD != grades.txt, output error then break
print("RegressTest fails on %s lab %s" % (labname, standard))
sys.exit(1)
else:
print("RegressTest on %s lab SUCCESS %s" % (labname, standard))
return 0
if __name__ == '__main__':
sys.exit(main())
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
12008,
13,
4013,
7047,
471,
2825,
491,
3303,
3900,
10354,
22873,
472,
29871,
13,
1576,
7817,
363,
8045,
495,
8926,
322,
8045,
495,
6607,
800,
313,
29907,
29941,
29949,
29897,
29871,
13,
271,
278,
21590,
4918,
5105,
27240,
4523,
405,
7024,
29889,
29871,
3529,
4443,
393,
2629,
278,
29871,
13,
2525,
1573,
3900,
29892,
3509,
1266,
13047,
338,
451,
3625,
363,
738,
1736,
29871,
13,
11600,
29871,
491,
3303,
3900,
10354,
22873,
29892,
12359,
29884,
424,
304,
18527,
29871,
29896,
29955,
29871,
13,
2525,
1573,
3900,
5920,
9779,
29871,
29896,
29900,
29945,
29889,
259,
910,
7047,
338,
297,
278,
970,
29871,
13,
7247,
322,
338,
451,
4967,
304,
3509,
1266,
29889,
29871,
13,
9039,
391,
3224,
322,
671,
297,
2752,
322,
7581,
7190,
29892,
411,
470,
1728,
13,
1545,
2450,
29892,
526,
21905,
4944,
393,
278,
1494,
5855,
13,
598,
1539,
29901,
13,
259,
29896,
29889,
4367,
391,
3224,
29879,
310,
2752,
775,
1818,
11551,
278,
2038,
3509,
1266,
13,
268,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
29889,
13,
259,
29906,
29889,
4367,
391,
3224,
29879,
297,
7581,
883,
1818,
18532,
278,
2038,
3509,
1266,
13,
268,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
297,
278,
13,
268,
5106,
322,
29914,
272,
916,
17279,
4944,
411,
278,
4978,
29889,
13,
13,
4690,
3235,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
6770,
6093,
26524,
29950,
1955,
4954,
3289,
8519,
4907,
5300,
13764,
29979,
8528,
15094,
1799,
6323,
13,
29902,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
29892,
2672,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
6093,
306,
3580,
5265,
3352,
13,
29956,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
5300,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
319,
1525,
13,
23711,
13875,
8890,
29928,
29889,
29871,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
26524,
29950,
1955,
20700,
17705,
6181,
15842,
13764,
29979,
22471,
26282,
29892,
13,
1177,
4571,
26282,
29892,
2672,
29907,
1367,
3919,
1964,
29892,
317,
4162,
8426,
1964,
29892,
8528,
29923,
3580,
29931,
19926,
29892,
6323,
8707,
1660,
13356,
3919,
25758,
21330,
1529,
1692,
29903,
13,
29898,
1177,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
13756,
29907,
11499,
13780,
8079,
27092,
1254,
1806,
26027,
21947,
29949,
8452,
6323,
13,
6304,
29963,
2965,
2890,
29936,
11247,
1799,
8079,
501,
1660,
29892,
360,
8254,
29892,
6323,
13756,
29943,
1806,
29903,
29936,
6323,
350,
3308,
8895,
1799,
2672,
4945,
29934,
4897,
29911,
2725,
29897,
13,
8187,
8851,
5348,
12766,
17171,
29928,
5300,
6732,
13764,
29979,
6093,
18929,
8079,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
8707,
29911,
4717,
1783,
29892,
13,
1254,
3960,
1783,
17705,
2882,
6227,
11937,
29892,
6323,
323,
8476,
313,
1177,
6154,
15789,
4214,
405,
11787,
5265,
24647,
4741,
6323,
438,
29911,
4448,
22119,
1660,
29897,
9033,
3235,
4214,
2672,
13,
2190,
29979,
399,
29909,
29979,
19474,
8079,
6093,
501,
1660,
8079,
3446,
3235,
7791,
7818,
12982,
1525,
29892,
382,
29963,
1430,
10762,
11033,
18118,
1660,
29928,
8079,
6093,
13,
13152,
1799,
8979,
6227,
11937,
8079,
20134,
3210,
21330,
1529,
1692,
29889,
13,
12008,
13,
13,
29937,
2514,
3871,
29901,
26653,
303,
342,
29889,
2272,
13,
29937,
12953,
29901,
13,
29937,
2169,
23881,
4321,
292,
2471,
29889,
910,
2471,
674,
1207,
671,
310,
9775,
13239,
29889,
13,
29937,
13,
29937,
13,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
679,
3364,
13,
5215,
931,
13,
5215,
2411,
13,
5105,
295,
370,
353,
2411,
29889,
1359,
29918,
4993,
877,
5105,
295,
370,
742,
525,
2109,
29914,
5105,
295,
370,
1495,
13,
2611,
1247,
272,
29918,
29883,
9970,
353,
2897,
29889,
657,
29883,
9970,
580,
13,
18945,
29918,
29883,
9970,
353,
18690,
272,
29918,
29883,
9970,
29889,
6506,
877,
8205,
2408,
261,
29899,
2611,
1247,
272,
742,
525,
8205,
2408,
261,
29899,
18945,
1495,
13,
29937,
22871,
15740,
315,
24668,
304,
10876,
29889,
2084,
13,
9675,
29889,
2084,
29889,
4397,
29898,
18945,
29918,
29883,
9970,
13578,
29914,
2109,
1159,
13,
5215,
9775,
13239,
13,
5215,
12183,
13,
5215,
12016,
2408,
261,
3403,
3460,
13,
5215,
20969,
28632,
2408,
261,
3991,
13,
13,
1753,
8744,
7295,
13,
1678,
10876,
29889,
303,
20405,
29889,
3539,
703,
27573,
29901,
26653,
303,
342,
29889,
2272,
518,
29966,
8205,
978,
29958,
891,
448,
29874,
529,
8205,
978,
29958,
10725,
29876,
1159,
13,
1678,
10876,
29889,
303,
20405,
29889,
3539,
703,
539,
529,
8205,
978,
29958,
584,
17855,
1243,
373,
529,
8205,
978,
29958,
871,
29905,
29876,
1159,
13,
1678,
10876,
29889,
303,
20405,
29889,
3539,
703,
539,
448,
29874,
529,
8205,
978,
29958,
584,
6773,
2734,
17855,
1243,
515,
529,
8205,
978,
14247,
29876,
1159,
13,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
24461,
29903,
29918,
21289,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
877,
21546,
29880,
6897,
1495,
13,
13,
13,
1753,
7252,
3338,
3076,
29898,
3338,
3076,
29954,
1025,
29892,
1632,
3076,
1125,
13,
1678,
1632,
3076,
29954,
1025,
20261,
353,
6571,
13,
1678,
1632,
3076,
20261,
353,
6571,
13,
1678,
411,
1722,
29898,
3338,
3076,
29954,
1025,
29897,
408,
867,
3076,
29887,
1025,
1445,
29901,
13,
4706,
363,
1196,
297,
867,
3076,
29887,
1025,
1445,
29901,
13,
9651,
6276,
342,
6472,
353,
1196,
29889,
17010,
580,
13,
9651,
565,
451,
6276,
342,
6472,
470,
6276,
342,
6472,
29889,
27382,
2541,
14822,
29908,
1125,
13,
18884,
6773,
13,
9651,
6276,
300,
4476,
353,
6276,
342,
6472,
29889,
5451,
580,
13,
9651,
8368,
29918,
5269,
353,
6276,
300,
4476,
29961,
29900,
29962,
13,
9651,
565,
11119,
271,
27508,
297,
8368,
29918,
5269,
29901,
13,
18884,
565,
8368,
29918,
5269,
297,
1632,
3076,
29954,
1025,
20261,
29901,
13,
462,
1678,
17927,
29889,
2704,
703,
3338,
3076,
29954,
1025,
934,
1059,
29901,
26905,
9976,
363,
278,
1021,
8368,
29915,
29879,
321,
29899,
2549,
1273,
29879,
29908,
1273,
8368,
29918,
5269,
29897,
13,
462,
1678,
736,
7700,
13,
18884,
1683,
29901,
13,
462,
1678,
716,
29918,
1220,
353,
1196,
29889,
17010,
2141,
6506,
703,
9162,
20569,
13,
462,
1678,
1632,
3076,
29954,
1025,
20261,
29961,
18945,
29918,
5269,
29962,
353,
716,
29918,
1220,
13,
1678,
411,
1722,
29898,
3338,
3076,
29897,
408,
867,
3076,
1445,
29901,
13,
4706,
363,
1196,
297,
867,
3076,
1445,
29901,
13,
9651,
6276,
342,
6472,
353,
1196,
29889,
17010,
580,
13,
9651,
565,
451,
6276,
342,
6472,
470,
6276,
342,
6472,
29889,
27382,
2541,
14822,
29908,
1125,
13,
18884,
6773,
13,
9651,
6276,
300,
4476,
353,
6276,
342,
6472,
29889,
5451,
580,
13,
9651,
8368,
29918,
5269,
353,
6276,
300,
4476,
29961,
29900,
29962,
13,
9651,
565,
11119,
271,
27508,
297,
8368,
29918,
5269,
29901,
13,
18884,
565,
8368,
29918,
5269,
297,
1632,
3076,
20261,
29901,
13,
462,
1678,
17927,
29889,
2704,
703,
3338,
3076,
934,
1059,
29901,
26905,
9976,
363,
278,
1021,
8368,
29915,
29879,
321,
29899,
2549,
1273,
29879,
29908,
1273,
8368,
29918,
5269,
29897,
13,
462,
1678,
736,
7700,
13,
18884,
1683,
29901,
13,
462,
1678,
716,
29918,
1220,
353,
1196,
29889,
17010,
2141,
6506,
703,
9162,
20569,
13,
462,
1678,
1632,
3076,
20261,
29961,
18945,
29918,
5269,
29962,
353,
716,
29918,
1220,
13,
1678,
565,
1632,
3076,
29954,
1025,
20261,
1275,
1632,
3076,
20261,
29901,
13,
4706,
736,
5852,
13,
1678,
1683,
29901,
13,
4706,
736,
7700,
13,
13,
13,
1753,
2169,
1253,
3057,
29898,
8205,
29918,
2084,
29892,
3918,
29892,
17927,
1125,
13,
1678,
9775,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
8205,
29918,
2084,
29897,
13,
1678,
9775,
2408,
261,
29918,
2917,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
25721,
29898,
8205,
29918,
2084,
8243,
525,
2917,
742,
525,
8205,
2408,
261,
29889,
2917,
1495,
13,
1678,
9775,
2408,
261,
29918,
2917,
353,
20969,
28632,
2408,
261,
3991,
29889,
12914,
28632,
2408,
261,
3991,
29898,
8205,
2408,
261,
29918,
2917,
29918,
3972,
29892,
17927,
29897,
13,
13,
1678,
9775,
13239,
29889,
275,
29918,
3084,
29918,
8205,
29898,
8205,
29918,
2084,
29897,
13,
1678,
26653,
303,
342,
29918,
8205,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
8205,
2408,
261,
29918,
2917,
29889,
1688,
7224,
29918,
4632,
29892,
9775,
978,
29892,
3918,
29897,
13,
1678,
3495,
29918,
5184,
29918,
29916,
571,
353,
2897,
29889,
2084,
29889,
7122,
29898,
8205,
2408,
261,
29918,
2917,
29889,
3069,
29918,
5184,
29918,
29916,
571,
29892,
9775,
978,
29897,
13,
1678,
17927,
29889,
8382,
703,
8514,
1060,
571,
3884,
363,
9775,
978,
1273,
29879,
338,
1273,
29879,
29908,
1273,
313,
8205,
978,
29892,
3495,
29918,
5184,
29918,
29916,
571,
876,
13,
1678,
17927,
29889,
8382,
703,
4597,
23881,
4321,
2224,
363,
9775,
978,
1273,
29879,
338,
1273,
29879,
29908,
1273,
313,
8205,
978,
29892,
26653,
303,
342,
29918,
8205,
29918,
2084,
876,
13,
13,
1678,
1632,
3076,
29954,
1025,
353,
11860,
29879,
22584,
29879,
29889,
629,
3076,
29889,
3945,
29908,
1273,
313,
276,
7201,
303,
342,
29918,
8205,
29918,
2084,
29892,
9775,
978,
29897,
13,
1678,
8952,
353,
679,
3364,
29889,
657,
1792,
580,
13,
1678,
1632,
3076,
353,
5591,
5184,
22584,
29879,
22584,
29879,
22584,
29879,
29889,
629,
3076,
29889,
3945,
29908,
1273,
313,
6786,
29892,
3495,
29918,
5184,
29918,
29916,
571,
29892,
9775,
978,
29897,
13,
1678,
17927,
29889,
8382,
703,
3338,
3076,
29954,
1025,
338,
1273,
29879,
448,
1632,
3076,
338,
1273,
29879,
29908,
1273,
313,
3338,
3076,
29954,
1025,
29892,
1632,
3076,
876,
13,
13,
1678,
338,
29918,
276,
3663,
29918,
1688,
353,
3918,
13,
1678,
1423,
29918,
29893,
271,
837,
935,
353,
7700,
13,
1678,
4469,
29918,
8228,
353,
5852,
13,
1678,
4744,
29918,
8228,
353,
7700,
13,
1678,
4656,
295,
370,
29889,
1867,
29954,
15464,
29898,
8205,
978,
29892,
7700,
29892,
7700,
29892,
5852,
29892,
7700,
29892,
337,
3663,
29918,
1688,
29922,
3338,
3076,
29954,
1025,
29897,
13,
13,
29937,
1678,
363,
1024,
29892,
5639,
297,
1369,
29918,
2917,
29889,
1285,
475,
414,
29889,
7076,
7295,
13,
29937,
4706,
590,
7611,
29918,
978,
539,
353,
5639,
29889,
8159,
29918,
978,
13,
29937,
4706,
5639,
29918,
1792,
308,
353,
5639,
29889,
1792,
13,
29937,
13,
29937,
4706,
565,
590,
7611,
29918,
978,
1275,
1369,
29918,
2917,
29889,
8228,
29918,
7611,
29901,
13,
29937,
9651,
17927,
29889,
8382,
877,
12717,
304,
7525,
3379,
1247,
272,
4391,
29928,
15464,
2283,
363,
5639,
1273,
29879,
29915,
1273,
1369,
29918,
2917,
29889,
8228,
29918,
7611,
29897,
13,
29937,
9651,
7525,
3379,
1247,
272,
4391,
29954,
15464,
2283,
29898,
2962,
29918,
2917,
29889,
8228,
29918,
7611,
29892,
5639,
29918,
1792,
29892,
9775,
978,
29892,
1423,
29918,
29893,
271,
837,
935,
29897,
13,
13,
1678,
396,
6978,
525,
5574,
29915,
304,
11455,
29918,
9847,
29918,
2704,
313,
29875,
29889,
29872,
1696,
11455,
5040,
1059,
29897,
13,
13,
1678,
3831,
598,
3591,
353,
7700,
13,
1678,
396,
1632,
3076,
29954,
1025,
322,
1632,
3076,
1818,
1863,
13,
1678,
17927,
29889,
8382,
877,
18307,
1273,
29879,
304,
1273,
29879,
29915,
1273,
313,
3338,
3076,
29954,
1025,
29892,
1632,
3076,
876,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3338,
3076,
29954,
1025,
1125,
13,
4706,
17927,
29889,
2704,
703,
3338,
3076,
29954,
1025,
1273,
29879,
934,
947,
451,
1863,
3850,
1273,
1632,
3076,
29954,
1025,
29897,
13,
1678,
25342,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3338,
3076,
1125,
13,
4706,
17927,
29889,
2704,
703,
3338,
3076,
1273,
29879,
934,
947,
451,
1863,
3850,
1273,
1632,
3076,
29897,
13,
1678,
1683,
29901,
13,
4706,
3831,
598,
3591,
353,
7252,
3338,
3076,
29898,
3338,
3076,
29954,
1025,
29892,
1632,
3076,
29897,
13,
1678,
736,
3831,
598,
3591,
13,
13,
1753,
1667,
7295,
13,
1678,
9775,
8588,
295,
391,
353,
5159,
13,
1678,
954,
29918,
5085,
353,
7431,
29898,
9675,
29889,
19218,
29897,
13,
1678,
521,
459,
1761,
353,
7700,
13,
1678,
565,
954,
29918,
5085,
1275,
29871,
29896,
29901,
13,
4706,
9775,
8588,
295,
391,
353,
2897,
29889,
1761,
3972,
29898,
24461,
29903,
29918,
21289,
29897,
13,
1678,
25342,
954,
29918,
5085,
1275,
29871,
29906,
29901,
13,
4706,
9775,
8588,
295,
391,
29889,
4397,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
13,
1678,
25342,
954,
29918,
5085,
1275,
29871,
29941,
29901,
13,
4706,
12569,
29918,
29874,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
4706,
565,
12569,
29918,
29874,
2804,
11663,
29874,
1115,
13,
9651,
8744,
580,
13,
4706,
9775,
8588,
295,
391,
353,
2897,
29889,
1761,
3972,
29898,
24461,
29903,
29918,
21289,
29897,
13,
4706,
9775,
8588,
342,
442,
353,
10876,
29889,
19218,
29961,
29906,
29962,
13,
4706,
565,
9775,
8588,
342,
442,
451,
297,
9775,
8588,
295,
391,
29901,
13,
9651,
10876,
29889,
303,
20405,
29889,
3539,
703,
15156,
1661,
29899,
735,
9696,
529,
8205,
978,
29958,
411,
448,
29874,
2984,
9903,
29876,
1159,
13,
9651,
8744,
580,
13,
4706,
521,
459,
1761,
353,
5852,
13,
1678,
1683,
29901,
13,
4706,
8744,
580,
13,
13,
1678,
1436,
497,
370,
8588,
295,
391,
353,
5159,
13,
1678,
565,
521,
459,
1761,
29901,
13,
4706,
1369,
11940,
353,
7700,
13,
4706,
363,
9775,
978,
297,
12705,
29898,
8205,
8588,
295,
391,
1125,
13,
9651,
565,
451,
1369,
11940,
29901,
13,
18884,
565,
9775,
978,
1275,
9775,
8588,
342,
442,
29901,
13,
462,
1678,
1436,
497,
370,
8588,
295,
391,
29889,
4397,
29898,
8205,
978,
29897,
13,
462,
1678,
1369,
11940,
353,
5852,
13,
18884,
1683,
29901,
13,
462,
1678,
6773,
13,
9651,
1683,
29901,
13,
18884,
1436,
497,
370,
8588,
295,
391,
29889,
4397,
29898,
8205,
978,
29897,
13,
1678,
1683,
29901,
13,
4706,
1436,
497,
370,
8588,
295,
391,
353,
9775,
8588,
295,
391,
13,
13,
1678,
363,
9775,
978,
297,
12705,
29898,
4951,
497,
370,
8588,
295,
391,
1125,
13,
4706,
9775,
13239,
29889,
21707,
353,
12016,
2408,
261,
3403,
3460,
29889,
28632,
2408,
261,
3403,
3460,
703,
8205,
2408,
261,
29899,
276,
3663,
29889,
1188,
613,
9775,
978,
29892,
376,
21546,
2917,
29914,
8205,
2408,
261,
29889,
2917,
1159,
13,
4706,
9775,
13239,
29889,
21707,
29889,
3888,
703,
17946,
12183,
26653,
303,
342,
29889,
2272,
363,
1273,
29879,
9775,
29908,
1273,
9775,
978,
29897,
13,
4706,
9775,
13239,
29889,
21707,
29889,
8382,
703,
7583,
1024,
338,
313,
29995,
29879,
5513,
1273,
9775,
978,
29897,
13,
4706,
6095,
645,
370,
978,
353,
2897,
29889,
2084,
29889,
7122,
29898,
24461,
29903,
29918,
21289,
29892,
9775,
978,
29897,
13,
4706,
565,
9775,
978,
1275,
376,
7070,
29908,
470,
9775,
978,
1275,
376,
2109,
1115,
13,
9651,
9775,
13239,
29889,
21707,
29889,
8382,
703,
2574,
3262,
2992,
470,
9016,
1159,
13,
9651,
6773,
13,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
1319,
645,
370,
978,
1125,
13,
9651,
9775,
13239,
29889,
21707,
29889,
8382,
703,
29414,
29879,
29897,
338,
3884,
448,
5251,
313,
29995,
29879,
29897,
338,
263,
9775,
978,
29908,
1273,
313,
1319,
645,
370,
978,
29892,
9775,
978,
876,
13,
268,
13,
9651,
396,
2169,
1253,
3057,
674,
437,
1243,
1494,
29901,
13,
12,
1678,
4516,
29918,
2084,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
876,
13,
12,
1678,
4516,
29918,
2084,
353,
4516,
29918,
2084,
7503,
3972,
29918,
2084,
29889,
2248,
703,
16713,
13531,
29871,
13,
12,
1678,
4516,
29918,
2084,
4619,
376,
1688,
7224,
29914,
29880,
6897,
12975,
718,
9775,
978,
13,
9651,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
3972,
29918,
2084,
1125,
13,
18884,
9775,
13239,
29889,
21707,
29889,
3888,
703,
1217,
6987,
1476,
363,
15691,
8205,
978,
29897,
13,
18884,
6773,
13,
13,
12,
1678,
7618,
311,
29918,
1689,
3163,
353,
2897,
29889,
1761,
3972,
29898,
3972,
29918,
2084,
29897,
13,
12,
1678,
20801,
353,
5159,
13,
12,
1678,
363,
4452,
297,
7618,
311,
29918,
1689,
3163,
29901,
13,
12,
12,
361,
376,
1213,
451,
297,
4452,
29901,
13,
12,
12,
1678,
20801,
29889,
4397,
29898,
7076,
29897,
13,
9651,
9775,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
24461,
29903,
29918,
21289,
29892,
9775,
978,
29897,
13,
9651,
565,
7431,
29898,
1689,
3163,
29897,
1275,
29871,
29900,
29901,
13,
18884,
1596,
877,
9260,
451,
1284,
738,
1014,
11851,
3842,
1090,
1273,
29879,
29915,
1273,
9775,
29918,
2084,
29897,
13,
18884,
1596,
877,
3057,
10898,
881,
367,
1243,
7224,
29914,
29880,
6897,
29914,
29961,
8205,
16261,
29954,
5607,
29928,
29914,
856,
1495,
13,
12,
1678,
363,
3918,
297,
20801,
29901,
13,
632,
12,
4597,
1253,
3057,
3591,
353,
2169,
1253,
3057,
29898,
8205,
29918,
2084,
29892,
3918,
29892,
9775,
13239,
29889,
21707,
29897,
12,
13,
632,
12,
361,
2169,
1253,
3057,
3591,
1275,
7700,
29901,
13,
18884,
396,
7700,
2794,
867,
3076,
29889,
3945,
29889,
29954,
5607,
29928,
2804,
867,
3076,
29889,
3945,
29892,
1962,
1059,
769,
2867,
13,
462,
1678,
1596,
703,
4597,
1253,
3057,
8465,
373,
1273,
29879,
9775,
1273,
29879,
29908,
1273,
313,
8205,
978,
29892,
3918,
876,
13,
462,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
632,
12,
2870,
29901,
13,
462,
1678,
1596,
703,
4597,
1253,
3057,
373,
1273,
29879,
9775,
20134,
26925,
1273,
29879,
29908,
1273,
313,
8205,
978,
29892,
3918,
876,
13,
13,
1678,
736,
29871,
29900,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
10876,
29889,
13322,
29898,
3396,
3101,
13,
13,
2
] |
lambdata_robdbennett/__example_module__.py | RobDBennett/lambdata | 0 | 71585 | #!/usr/bin/env python
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import plot_confusion_matrix
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.impute import SimpleImputer
import category_encoders as ce
x=2
def increment(number):
"""A toy function that increases a given number by 1"""
return number + 1
class Animal:
"""A toy Class layout, designed to create an animal.
Parameters:
-----------
: name- The name of the critter.
: weight- the weight, in pounds, of the critter.
: diet_type- what the critter eats.
Outputs:
-----------
How the animal runs.
"""
def __init__(self, name, weight, diet_type):
self.name = str(name)
if weight > 0:
self.weight = weight
else:
raise Exception
self.diet_type = diet_type
def run(self):
return 'Vroom!'
class Tiger(Animal):
"""A toy class that inherits the attributes of the Animal class.
Parameters:
----------
: num_stripes- The number of stripes on the tiger.
Outputs:
----------
What does the tiger say?
"""
def __init__(self, name, weight, diet_type, num_stripes):
super().__init__(name, weight, diet_type)
self.num_stripes = num_stripes
def say_great(self):
return 'Its Greeattt!'
def split_it(dataframe):
"""A function that takes a dataframe and splits into a train
, validate, test. Test is 15% of the total, validate is 20%
of the remainder.
This will return the variables of train, val, test."""
base, test = train_test_split(dataframe, test_size=.15)
train, val = train_test_split(base, test_size=.2)
return train, val, test
def pipe_it(train, val, features, target):
"""A function that inputs train, val, features and target. It is
recommended that you establish features and target as lists before
running this function.
The function will break the train and validate database into the
X and y categories, apply a Logistic Regression machine learning
function in a pipeline. The pipeline also applies an ordinal encoder,
an imputer, and scaler. This isn't appropriate for all machine
learning applications.
The function returns the pipe, X_val, y_val variables, for easy
scoring or graphing."""
pipe = make_pipeline(ce.OrdinalEncoder(),
SimpleImputer(),
StandardScaler(),
LogisticRegression(max_iter=200))
X_train = train[features]
X_val = val[features]
y_train = train[target]
y_val = val[target]
pipe.fit(X_train, y_train)
return pipe, X_val, y_val
def make_df(csv):
"""A proof of concept function that turns a csv file into a
Pandas database."""
df = pd.read_csv(csv)
return df
def confuse_me(train, val, features, target):
"""A function that takes a train, validate database, with listed features
and target. It runs this through a pipeline, and then produces a
confusion matrix."""
pipe, X_val, y_val = pipe_it(train, val, features, target)
return plot_confusion_matrix(pipe, X_val, y_val, values_format='.0f', xticks_rotation='vertical')
COLORS = ('Blue', 'Orange', 'Green', 'Red', 'Black', 'Cyan', 'Purple')
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
3166,
2071,
19668,
29889,
4299,
29918,
21731,
1053,
7945,
29918,
1688,
29918,
5451,
13,
3166,
2071,
19668,
29889,
2527,
10817,
1053,
6492,
29918,
5527,
3958,
29918,
5344,
13,
3166,
2071,
19668,
29889,
1457,
19170,
1053,
10117,
29636,
261,
13,
3166,
2071,
19668,
29889,
10660,
29918,
4299,
1053,
4522,
4695,
4597,
23881,
13,
3166,
2071,
19668,
29889,
13096,
5570,
1053,
1207,
29918,
13096,
5570,
13,
3166,
2071,
19668,
29889,
326,
649,
29872,
1053,
12545,
1888,
649,
261,
13,
5215,
7663,
29918,
3977,
397,
414,
408,
2257,
13,
13,
13,
29916,
29922,
29906,
13,
13,
1753,
11924,
29898,
4537,
1125,
13,
1678,
9995,
29909,
304,
29891,
740,
393,
16415,
263,
2183,
1353,
491,
29871,
29896,
15945,
29908,
13,
1678,
736,
1353,
718,
29871,
29896,
13,
13,
1990,
22809,
29901,
13,
1678,
9995,
29909,
304,
29891,
4134,
5912,
29892,
8688,
304,
1653,
385,
13019,
29889,
13,
1678,
12662,
2699,
29901,
13,
1678,
448,
28400,
13,
1678,
584,
1024,
29899,
450,
1024,
310,
278,
3994,
357,
29889,
13,
1678,
584,
7688,
29899,
278,
7688,
29892,
297,
24261,
29892,
310,
278,
3994,
357,
29889,
13,
1678,
584,
652,
300,
29918,
1853,
29899,
825,
278,
3994,
357,
321,
1446,
29889,
13,
1678,
10604,
29879,
29901,
13,
1678,
448,
28400,
13,
1678,
1128,
278,
13019,
6057,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
7688,
29892,
652,
300,
29918,
1853,
1125,
13,
4706,
1583,
29889,
978,
353,
851,
29898,
978,
29897,
13,
4706,
565,
7688,
1405,
29871,
29900,
29901,
13,
9651,
1583,
29889,
7915,
353,
7688,
13,
4706,
1683,
29901,
13,
9651,
12020,
8960,
13,
4706,
1583,
29889,
29881,
2035,
29918,
1853,
353,
652,
300,
29918,
1853,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
736,
525,
29963,
8345,
20714,
13,
13,
1990,
323,
4087,
29898,
2744,
3039,
1125,
13,
1678,
9995,
29909,
304,
29891,
770,
393,
7846,
1169,
278,
8393,
310,
278,
22809,
770,
29889,
13,
1678,
12662,
2699,
29901,
13,
1678,
448,
1378,
29899,
13,
1678,
584,
954,
29918,
303,
374,
5547,
29899,
450,
1353,
310,
10076,
5547,
373,
278,
260,
4087,
29889,
13,
1678,
10604,
29879,
29901,
13,
1678,
448,
1378,
29899,
13,
1678,
1724,
947,
278,
260,
4087,
1827,
29973,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
7688,
29892,
652,
300,
29918,
1853,
29892,
954,
29918,
303,
374,
5547,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
978,
29892,
7688,
29892,
652,
300,
29918,
1853,
29897,
13,
4706,
1583,
29889,
1949,
29918,
303,
374,
5547,
353,
954,
29918,
303,
374,
5547,
13,
1678,
822,
1827,
29918,
7979,
271,
29898,
1311,
1125,
13,
4706,
736,
525,
29902,
1372,
18438,
271,
698,
20714,
13,
13,
1753,
6219,
29918,
277,
29898,
1272,
2557,
1125,
13,
13,
1678,
9995,
29909,
740,
393,
4893,
263,
12205,
322,
8536,
1169,
964,
263,
7945,
13,
1678,
1919,
12725,
29892,
1243,
29889,
4321,
338,
29871,
29896,
29945,
29995,
310,
278,
3001,
29892,
12725,
338,
29871,
29906,
29900,
29995,
13,
1678,
310,
278,
21162,
29889,
29871,
13,
1678,
910,
674,
736,
278,
3651,
310,
7945,
29892,
659,
29892,
1243,
1213,
15945,
13,
1678,
2967,
29892,
1243,
353,
7945,
29918,
1688,
29918,
5451,
29898,
1272,
2557,
29892,
1243,
29918,
2311,
21098,
29896,
29945,
29897,
13,
1678,
7945,
29892,
659,
353,
7945,
29918,
1688,
29918,
5451,
29898,
3188,
29892,
1243,
29918,
2311,
21098,
29906,
29897,
13,
1678,
736,
7945,
29892,
659,
29892,
1243,
13,
13,
1753,
14282,
29918,
277,
29898,
14968,
29892,
659,
29892,
5680,
29892,
3646,
1125,
13,
1678,
9995,
29909,
740,
393,
10970,
7945,
29892,
659,
29892,
5680,
322,
3646,
29889,
739,
338,
13,
1678,
13622,
393,
366,
10127,
5680,
322,
3646,
408,
8857,
1434,
13,
1678,
2734,
445,
740,
29889,
29871,
13,
1678,
450,
740,
674,
2867,
278,
7945,
322,
12725,
2566,
964,
278,
13,
1678,
1060,
322,
343,
13997,
29892,
3394,
263,
4522,
4695,
2169,
23881,
4933,
6509,
13,
1678,
740,
297,
263,
16439,
29889,
450,
16439,
884,
16058,
385,
4356,
979,
2094,
6119,
29892,
13,
1678,
385,
527,
649,
261,
29892,
322,
8716,
261,
29889,
910,
3508,
29915,
29873,
8210,
363,
599,
4933,
29871,
13,
1678,
6509,
8324,
29889,
13,
1678,
450,
740,
3639,
278,
14282,
29892,
1060,
29918,
791,
29892,
343,
29918,
791,
3651,
29892,
363,
4780,
13,
1678,
26654,
470,
3983,
292,
1213,
15945,
13,
1678,
14282,
353,
1207,
29918,
13096,
5570,
29898,
346,
29889,
23302,
979,
8566,
6119,
3285,
13,
462,
4706,
12545,
1888,
649,
261,
3285,
13,
462,
4706,
10117,
29636,
261,
3285,
13,
462,
4706,
4522,
4695,
4597,
23881,
29898,
3317,
29918,
1524,
29922,
29906,
29900,
29900,
876,
13,
1678,
1060,
29918,
14968,
353,
7945,
29961,
22100,
29962,
13,
1678,
1060,
29918,
791,
353,
659,
29961,
22100,
29962,
13,
1678,
343,
29918,
14968,
353,
7945,
29961,
5182,
29962,
13,
1678,
343,
29918,
791,
353,
659,
29961,
5182,
29962,
13,
1678,
14282,
29889,
9202,
29898,
29990,
29918,
14968,
29892,
343,
29918,
14968,
29897,
13,
1678,
736,
14282,
29892,
1060,
29918,
791,
29892,
343,
29918,
791,
13,
13,
1753,
1207,
29918,
2176,
29898,
7638,
1125,
13,
1678,
9995,
29909,
5296,
310,
6964,
740,
393,
12169,
263,
11799,
934,
964,
263,
29871,
13,
1678,
349,
7086,
2566,
1213,
15945,
13,
1678,
4489,
353,
10518,
29889,
949,
29918,
7638,
29898,
7638,
29897,
13,
1678,
736,
4489,
13,
13,
1753,
1970,
1509,
29918,
1004,
29898,
14968,
29892,
659,
29892,
5680,
29892,
3646,
1125,
13,
1678,
9995,
29909,
740,
393,
4893,
263,
7945,
29892,
12725,
2566,
29892,
411,
9904,
5680,
13,
1678,
322,
3646,
29889,
739,
6057,
445,
1549,
263,
16439,
29892,
322,
769,
13880,
263,
13,
1678,
14679,
4636,
1213,
15945,
13,
1678,
14282,
29892,
1060,
29918,
791,
29892,
343,
29918,
791,
353,
14282,
29918,
277,
29898,
14968,
29892,
659,
29892,
5680,
29892,
3646,
29897,
13,
1678,
736,
6492,
29918,
5527,
3958,
29918,
5344,
29898,
17760,
29892,
1060,
29918,
791,
29892,
343,
29918,
791,
29892,
1819,
29918,
4830,
2433,
29889,
29900,
29888,
742,
29871,
486,
7358,
29918,
5450,
362,
2433,
18575,
1495,
13,
13,
15032,
24125,
353,
6702,
21319,
742,
525,
29949,
3881,
742,
525,
24599,
742,
525,
9039,
742,
525,
18700,
742,
525,
29907,
10094,
742,
525,
29925,
332,
552,
1495,
13,
2
] |
tests/unit/test_plugin_type_manager.py | thijskramer/flake8 | 2,013 | 195654 | """Tests for flake8.plugins.manager.PluginTypeManager."""
from unittest import mock
import pytest
from flake8 import exceptions
from flake8.plugins import manager
TEST_NAMESPACE = "testing.plugin-type-manager"
def create_plugin_mock(raise_exception=False):
"""Create an auto-spec'd mock of a flake8 Plugin."""
plugin = mock.create_autospec(manager.Plugin, instance=True)
if raise_exception:
plugin.load_plugin.side_effect = exceptions.FailedToLoadPlugin(
plugin_name="T101",
exception=ValueError("Test failure"),
)
return plugin
def create_mapping_manager_mock(plugins):
"""Create a mock for the PluginManager."""
# Have a function that will actually call the method underneath
def fake_map(func):
for plugin in plugins.values():
yield func(plugin)
# Mock out the PluginManager instance
manager_mock = mock.Mock(spec=["map"])
# Replace the map method
manager_mock.map = fake_map
# Store the plugins
manager_mock.plugins = plugins
return manager_mock
class FakeTestType(manager.PluginTypeManager):
"""Fake PluginTypeManager."""
namespace = TEST_NAMESPACE
@mock.patch("flake8.plugins.manager.PluginManager", autospec=True)
def test_instantiates_a_manager(PluginManager): # noqa: N803
"""Verify we create a PluginManager on instantiation."""
FakeTestType()
PluginManager.assert_called_once_with(TEST_NAMESPACE, local_plugins=None)
@mock.patch("flake8.plugins.manager.PluginManager", autospec=True)
def test_proxies_names_to_manager(PluginManager): # noqa: N803
"""Verify we proxy the names attribute."""
PluginManager.return_value = mock.Mock(names=["T100", "T200", "T300"])
type_mgr = FakeTestType()
assert type_mgr.names == ["T100", "T200", "T300"]
@mock.patch("flake8.plugins.manager.PluginManager", autospec=True)
def test_proxies_plugins_to_manager(PluginManager): # noqa: N803
"""Verify we proxy the plugins attribute."""
PluginManager.return_value = mock.Mock(plugins=["T100", "T200", "T300"])
type_mgr = FakeTestType()
assert type_mgr.plugins == ["T100", "T200", "T300"]
def test_generate_call_function():
"""Verify the function we generate."""
optmanager = object()
plugin = mock.Mock(method_name=lambda x: x)
func = manager.PluginTypeManager._generate_call_function(
"method_name",
optmanager,
)
assert callable(func)
assert func(plugin) is optmanager
@mock.patch("flake8.plugins.manager.PluginManager", autospec=True)
def test_load_plugins(PluginManager): # noqa: N803
"""Verify load plugins loads *every* plugin."""
# Create a bunch of fake plugins
plugins = {"T10%i" % i: create_plugin_mock() for i in range(8)}
# Return our PluginManager mock
PluginManager.return_value.plugins = plugins
type_mgr = FakeTestType()
# Load the plugins (do what we're actually testing)
type_mgr.load_plugins()
# Assert that our closure does what we think it does
for plugin in plugins.values():
plugin.load_plugin.assert_called_once_with()
assert type_mgr.plugins_loaded is True
@mock.patch("flake8.plugins.manager.PluginManager")
def test_load_plugins_fails(PluginManager): # noqa: N803
"""Verify load plugins bubbles up exceptions."""
plugins_list = [create_plugin_mock(i == 1) for i in range(8)]
plugins = {"T10%i" % i: plugin for i, plugin in enumerate(plugins_list)}
# Return our PluginManager mock
PluginManager.return_value.plugins = plugins
type_mgr = FakeTestType()
with pytest.raises(exceptions.FailedToLoadPlugin):
type_mgr.load_plugins()
# Assert we didn't finish loading plugins
assert type_mgr.plugins_loaded is False
# Assert the first two plugins had their load_plugin method called
plugins_list[0].load_plugin.assert_called_once_with()
plugins_list[1].load_plugin.assert_called_once_with()
# Assert the rest of the plugins were not loaded
for plugin in plugins_list[2:]:
assert plugin.load_plugin.called is False
@mock.patch("flake8.plugins.manager.PluginManager")
def test_register_options(PluginManager): # noqa: N803
"""Test that we map over every plugin to register options."""
plugins = {"T10%i" % i: create_plugin_mock() for i in range(8)}
# Return our PluginManager mock
PluginManager.return_value = create_mapping_manager_mock(plugins)
optmanager = object()
type_mgr = FakeTestType()
type_mgr.register_options(optmanager)
for plugin in plugins.values():
plugin.register_options.assert_called_with(optmanager)
@mock.patch("flake8.plugins.manager.PluginManager")
def test_provide_options(PluginManager): # noqa: N803
"""Test that we map over every plugin to provide parsed options."""
plugins = {"T10%i" % i: create_plugin_mock() for i in range(8)}
# Return our PluginManager mock
PluginManager.return_value = create_mapping_manager_mock(plugins)
optmanager = object()
options = object()
type_mgr = FakeTestType()
type_mgr.provide_options(optmanager, options, [])
for plugin in plugins.values():
plugin.provide_options.assert_called_with(optmanager, options, [])
@mock.patch("flake8.plugins.manager.PluginManager", autospec=True)
def test_proxy_contains_to_managers_plugins_dict(PluginManager): # noqa: N803
"""Verify that we proxy __contains__ to the manager's dictionary."""
plugins = {"T10%i" % i: create_plugin_mock() for i in range(8)}
# Return our PluginManager mock
PluginManager.return_value.plugins = plugins
type_mgr = FakeTestType()
for i in range(8):
key = "<KEY>
assert key in type_mgr
@mock.patch("flake8.plugins.manager.PluginManager")
def test_proxies_getitem_to_managers_plugins_dict(PluginManager): # noqa: N803
"""Verify that we can use the PluginTypeManager like a dictionary."""
plugins = {"T10%i" % i: create_plugin_mock() for i in range(8)}
# Return our PluginManager mock
PluginManager.return_value.plugins = plugins
type_mgr = FakeTestType()
for i in range(8):
key = "<KEY>
assert type_mgr[key] is plugins[key]
| [
1,
9995,
24376,
363,
17422,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
1542,
3260,
1213,
15945,
13,
3166,
443,
27958,
1053,
11187,
13,
13,
5215,
11451,
1688,
13,
13,
3166,
17422,
446,
29947,
1053,
15283,
13,
3166,
17422,
446,
29947,
29889,
12800,
1053,
8455,
13,
13,
18267,
29918,
5813,
5550,
11538,
353,
376,
13424,
29889,
8582,
29899,
1853,
29899,
12847,
29908,
13,
13,
13,
1753,
1653,
29918,
8582,
29918,
17640,
29898,
22692,
29918,
11739,
29922,
8824,
1125,
13,
1678,
9995,
4391,
385,
4469,
29899,
6550,
29915,
29881,
11187,
310,
263,
17422,
446,
29947,
1858,
3851,
1213,
15945,
13,
1678,
7079,
353,
11187,
29889,
3258,
29918,
1300,
359,
3135,
29898,
12847,
29889,
16288,
29892,
2777,
29922,
5574,
29897,
13,
1678,
565,
12020,
29918,
11739,
29901,
13,
4706,
7079,
29889,
1359,
29918,
8582,
29889,
2975,
29918,
15987,
353,
15283,
29889,
17776,
1762,
5896,
16288,
29898,
13,
9651,
7079,
29918,
978,
543,
29911,
29896,
29900,
29896,
613,
13,
9651,
3682,
29922,
1917,
2392,
703,
3057,
10672,
4968,
13,
4706,
1723,
13,
1678,
736,
7079,
13,
13,
13,
1753,
1653,
29918,
20698,
29918,
12847,
29918,
17640,
29898,
12800,
1125,
13,
1678,
9995,
4391,
263,
11187,
363,
278,
1858,
3851,
3260,
1213,
15945,
13,
1678,
396,
6975,
263,
740,
393,
674,
2869,
1246,
278,
1158,
1090,
484,
493,
13,
1678,
822,
25713,
29918,
1958,
29898,
9891,
1125,
13,
4706,
363,
7079,
297,
18224,
29889,
5975,
7295,
13,
9651,
7709,
3653,
29898,
8582,
29897,
13,
13,
1678,
396,
26297,
714,
278,
1858,
3851,
3260,
2777,
13,
1678,
8455,
29918,
17640,
353,
11187,
29889,
18680,
29898,
6550,
29922,
3366,
1958,
20068,
13,
1678,
396,
22108,
278,
2910,
1158,
13,
1678,
8455,
29918,
17640,
29889,
1958,
353,
25713,
29918,
1958,
13,
1678,
396,
14491,
278,
18224,
13,
1678,
8455,
29918,
17640,
29889,
12800,
353,
18224,
13,
1678,
736,
8455,
29918,
17640,
13,
13,
13,
1990,
383,
1296,
3057,
1542,
29898,
12847,
29889,
16288,
1542,
3260,
1125,
13,
1678,
9995,
29943,
1296,
1858,
3851,
1542,
3260,
1213,
15945,
13,
13,
1678,
7397,
353,
17067,
1254,
29918,
5813,
5550,
11538,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
613,
1120,
359,
3135,
29922,
5574,
29897,
13,
1753,
1243,
29918,
2611,
3656,
1078,
29918,
29874,
29918,
12847,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
6565,
1598,
591,
1653,
263,
1858,
3851,
3260,
373,
13213,
362,
1213,
15945,
13,
1678,
383,
1296,
3057,
1542,
580,
13,
13,
1678,
1858,
3851,
3260,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
29898,
18267,
29918,
5813,
5550,
11538,
29892,
1887,
29918,
12800,
29922,
8516,
29897,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
613,
1120,
359,
3135,
29922,
5574,
29897,
13,
1753,
1243,
29918,
771,
29916,
583,
29918,
7039,
29918,
517,
29918,
12847,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
6565,
1598,
591,
10166,
278,
2983,
5352,
1213,
15945,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
353,
11187,
29889,
18680,
29898,
7039,
29922,
3366,
29911,
29896,
29900,
29900,
613,
376,
29911,
29906,
29900,
29900,
613,
376,
29911,
29941,
29900,
29900,
20068,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
13,
1678,
4974,
1134,
29918,
29885,
629,
29889,
7039,
1275,
6796,
29911,
29896,
29900,
29900,
613,
376,
29911,
29906,
29900,
29900,
613,
376,
29911,
29941,
29900,
29900,
3108,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
613,
1120,
359,
3135,
29922,
5574,
29897,
13,
1753,
1243,
29918,
771,
29916,
583,
29918,
12800,
29918,
517,
29918,
12847,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
6565,
1598,
591,
10166,
278,
18224,
5352,
1213,
15945,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
353,
11187,
29889,
18680,
29898,
12800,
29922,
3366,
29911,
29896,
29900,
29900,
613,
376,
29911,
29906,
29900,
29900,
613,
376,
29911,
29941,
29900,
29900,
20068,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
13,
1678,
4974,
1134,
29918,
29885,
629,
29889,
12800,
1275,
6796,
29911,
29896,
29900,
29900,
613,
376,
29911,
29906,
29900,
29900,
613,
376,
29911,
29941,
29900,
29900,
3108,
13,
13,
13,
1753,
1243,
29918,
17158,
29918,
4804,
29918,
2220,
7295,
13,
1678,
9995,
6565,
1598,
278,
740,
591,
5706,
1213,
15945,
13,
1678,
3523,
12847,
353,
1203,
580,
13,
1678,
7079,
353,
11187,
29889,
18680,
29898,
5696,
29918,
978,
29922,
2892,
921,
29901,
921,
29897,
13,
1678,
3653,
353,
8455,
29889,
16288,
1542,
3260,
3032,
17158,
29918,
4804,
29918,
2220,
29898,
13,
4706,
376,
5696,
29918,
978,
613,
13,
4706,
3523,
12847,
29892,
13,
1678,
1723,
13,
13,
1678,
4974,
1246,
519,
29898,
9891,
29897,
13,
1678,
4974,
3653,
29898,
8582,
29897,
338,
3523,
12847,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
613,
1120,
359,
3135,
29922,
5574,
29897,
13,
1753,
1243,
29918,
1359,
29918,
12800,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
6565,
1598,
2254,
18224,
15376,
334,
17991,
29930,
7079,
1213,
15945,
13,
1678,
396,
6204,
263,
14928,
310,
25713,
18224,
13,
1678,
18224,
353,
8853,
29911,
29896,
29900,
29995,
29875,
29908,
1273,
474,
29901,
1653,
29918,
8582,
29918,
17640,
580,
363,
474,
297,
3464,
29898,
29947,
2915,
13,
1678,
396,
7106,
1749,
1858,
3851,
3260,
11187,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
29889,
12800,
353,
18224,
13,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
1678,
396,
16012,
278,
18224,
313,
1867,
825,
591,
29915,
276,
2869,
6724,
29897,
13,
1678,
1134,
29918,
29885,
629,
29889,
1359,
29918,
12800,
580,
13,
1678,
396,
16499,
393,
1749,
18424,
947,
825,
591,
1348,
372,
947,
13,
1678,
363,
7079,
297,
18224,
29889,
5975,
7295,
13,
4706,
7079,
29889,
1359,
29918,
8582,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
580,
13,
1678,
4974,
1134,
29918,
29885,
629,
29889,
12800,
29918,
15638,
338,
5852,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
1159,
13,
1753,
1243,
29918,
1359,
29918,
12800,
29918,
29888,
2234,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
6565,
1598,
2254,
18224,
289,
431,
7586,
701,
15283,
1213,
15945,
13,
1678,
18224,
29918,
1761,
353,
518,
3258,
29918,
8582,
29918,
17640,
29898,
29875,
1275,
29871,
29896,
29897,
363,
474,
297,
3464,
29898,
29947,
4638,
13,
1678,
18224,
353,
8853,
29911,
29896,
29900,
29995,
29875,
29908,
1273,
474,
29901,
7079,
363,
474,
29892,
7079,
297,
26985,
29898,
12800,
29918,
1761,
2915,
13,
1678,
396,
7106,
1749,
1858,
3851,
3260,
11187,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
29889,
12800,
353,
18224,
13,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
11739,
29879,
29889,
17776,
1762,
5896,
16288,
1125,
13,
4706,
1134,
29918,
29885,
629,
29889,
1359,
29918,
12800,
580,
13,
13,
1678,
396,
16499,
591,
3282,
29915,
29873,
8341,
8363,
18224,
13,
1678,
4974,
1134,
29918,
29885,
629,
29889,
12800,
29918,
15638,
338,
7700,
13,
1678,
396,
16499,
278,
937,
1023,
18224,
750,
1009,
2254,
29918,
8582,
1158,
2000,
13,
1678,
18224,
29918,
1761,
29961,
29900,
1822,
1359,
29918,
8582,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
580,
13,
1678,
18224,
29918,
1761,
29961,
29896,
1822,
1359,
29918,
8582,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
580,
13,
1678,
396,
16499,
278,
1791,
310,
278,
18224,
892,
451,
7500,
13,
1678,
363,
7079,
297,
18224,
29918,
1761,
29961,
29906,
29901,
5387,
13,
4706,
4974,
7079,
29889,
1359,
29918,
8582,
29889,
13998,
338,
7700,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
1159,
13,
1753,
1243,
29918,
9573,
29918,
6768,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
3057,
393,
591,
2910,
975,
1432,
7079,
304,
6036,
3987,
1213,
15945,
13,
1678,
18224,
353,
8853,
29911,
29896,
29900,
29995,
29875,
29908,
1273,
474,
29901,
1653,
29918,
8582,
29918,
17640,
580,
363,
474,
297,
3464,
29898,
29947,
2915,
13,
1678,
396,
7106,
1749,
1858,
3851,
3260,
11187,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
353,
1653,
29918,
20698,
29918,
12847,
29918,
17640,
29898,
12800,
29897,
13,
1678,
3523,
12847,
353,
1203,
580,
13,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
1678,
1134,
29918,
29885,
629,
29889,
9573,
29918,
6768,
29898,
3670,
12847,
29897,
13,
13,
1678,
363,
7079,
297,
18224,
29889,
5975,
7295,
13,
4706,
7079,
29889,
9573,
29918,
6768,
29889,
9294,
29918,
13998,
29918,
2541,
29898,
3670,
12847,
29897,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
1159,
13,
1753,
1243,
29918,
16123,
680,
29918,
6768,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
3057,
393,
591,
2910,
975,
1432,
7079,
304,
3867,
21213,
3987,
1213,
15945,
13,
1678,
18224,
353,
8853,
29911,
29896,
29900,
29995,
29875,
29908,
1273,
474,
29901,
1653,
29918,
8582,
29918,
17640,
580,
363,
474,
297,
3464,
29898,
29947,
2915,
13,
1678,
396,
7106,
1749,
1858,
3851,
3260,
11187,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
353,
1653,
29918,
20698,
29918,
12847,
29918,
17640,
29898,
12800,
29897,
13,
1678,
3523,
12847,
353,
1203,
580,
13,
1678,
3987,
353,
1203,
580,
13,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
1678,
1134,
29918,
29885,
629,
29889,
16123,
680,
29918,
6768,
29898,
3670,
12847,
29892,
3987,
29892,
518,
2314,
13,
13,
1678,
363,
7079,
297,
18224,
29889,
5975,
7295,
13,
4706,
7079,
29889,
16123,
680,
29918,
6768,
29889,
9294,
29918,
13998,
29918,
2541,
29898,
3670,
12847,
29892,
3987,
29892,
518,
2314,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
613,
1120,
359,
3135,
29922,
5574,
29897,
13,
1753,
1243,
29918,
14701,
29918,
11516,
29918,
517,
29918,
1171,
18150,
29918,
12800,
29918,
8977,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
6565,
1598,
393,
591,
10166,
4770,
11516,
1649,
304,
278,
8455,
29915,
29879,
8600,
1213,
15945,
13,
1678,
18224,
353,
8853,
29911,
29896,
29900,
29995,
29875,
29908,
1273,
474,
29901,
1653,
29918,
8582,
29918,
17640,
580,
363,
474,
297,
3464,
29898,
29947,
2915,
13,
1678,
396,
7106,
1749,
1858,
3851,
3260,
11187,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
29889,
12800,
353,
18224,
13,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
1678,
363,
474,
297,
3464,
29898,
29947,
1125,
13,
4706,
1820,
353,
9872,
10818,
29958,
13,
4706,
4974,
1820,
297,
1134,
29918,
29885,
629,
13,
13,
13,
29992,
17640,
29889,
5041,
703,
29888,
433,
446,
29947,
29889,
12800,
29889,
12847,
29889,
16288,
3260,
1159,
13,
1753,
1243,
29918,
771,
29916,
583,
29918,
657,
667,
29918,
517,
29918,
1171,
18150,
29918,
12800,
29918,
8977,
29898,
16288,
3260,
1125,
29871,
396,
694,
25621,
29901,
405,
29947,
29900,
29941,
13,
1678,
9995,
6565,
1598,
393,
591,
508,
671,
278,
1858,
3851,
1542,
3260,
763,
263,
8600,
1213,
15945,
13,
1678,
18224,
353,
8853,
29911,
29896,
29900,
29995,
29875,
29908,
1273,
474,
29901,
1653,
29918,
8582,
29918,
17640,
580,
363,
474,
297,
3464,
29898,
29947,
2915,
13,
1678,
396,
7106,
1749,
1858,
3851,
3260,
11187,
13,
1678,
1858,
3851,
3260,
29889,
2457,
29918,
1767,
29889,
12800,
353,
18224,
13,
13,
1678,
1134,
29918,
29885,
629,
353,
383,
1296,
3057,
1542,
580,
13,
1678,
363,
474,
297,
3464,
29898,
29947,
1125,
13,
4706,
1820,
353,
9872,
10818,
29958,
13,
4706,
4974,
1134,
29918,
29885,
629,
29961,
1989,
29962,
338,
18224,
29961,
1989,
29962,
13,
2
] |
web/index/migrations/0003_auto_20200407_1756.py | laozhudetui/LSpider | 311 | 70615 | <reponame>laozhudetui/LSpider<gh_stars>100-1000
# Generated by Django 3.0.1 on 2020-04-07 09:56
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('index', '0002_scantask_last_scan_time'),
]
operations = [
migrations.AlterField(
model_name='scantask',
name='last_scan_time',
field=models.DateTimeField(default=datetime.datetime(2020, 4, 7, 9, 56, 27, 101552, tzinfo=utc)),
),
]
| [
1,
529,
276,
1112,
420,
29958,
433,
2112,
29882,
566,
300,
1481,
29914,
29931,
5592,
1241,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
29937,
3251,
630,
491,
15337,
29871,
29941,
29889,
29900,
29889,
29896,
373,
29871,
29906,
29900,
29906,
29900,
29899,
29900,
29946,
29899,
29900,
29955,
29871,
29900,
29929,
29901,
29945,
29953,
13,
13,
5215,
12865,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
3166,
9557,
29889,
13239,
29889,
2230,
8028,
1053,
3477,
29883,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
2248,
742,
525,
29900,
29900,
29900,
29906,
29918,
1557,
424,
1278,
29918,
4230,
29918,
16192,
29918,
2230,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
1557,
424,
1278,
742,
13,
9651,
1024,
2433,
4230,
29918,
16192,
29918,
2230,
742,
13,
9651,
1746,
29922,
9794,
29889,
11384,
3073,
29898,
4381,
29922,
12673,
29889,
12673,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29946,
29892,
29871,
29955,
29892,
29871,
29929,
29892,
29871,
29945,
29953,
29892,
29871,
29906,
29955,
29892,
29871,
29896,
29900,
29896,
29945,
29945,
29906,
29892,
260,
29920,
3888,
29922,
329,
29883,
8243,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
Hl7_Parser.py | AnaniSkywalker/HL7_Parser | 1 | 53455 | ## Author: <NAME>
import json
import io
import os
import re
from hl7apy.parser import parse_message
from hl7apy.exceptions import UnsupportedVersion
#receives the name of the file and reads the messages in the file
def readMessageFile(filename):
#read the file
message = open(filename, 'r').read()
print("Step 1: File read successfully")
return message
#This method splits the 3 messages based on the blank line that is between messages
def splitMessages(strmsg):
messageslist = re.split('\\n\\n', strmsg)
print("Step 2: Messages splitted successfully")
return messageslist
def hl7StrToDictionary(hl7string, use_long_name=True):
""" Takes a string parameter and converts it to a Dictionary
:param hl7string: HL7 string that is passed to the method
:returns: A dictionary representation of the HL7 message
"""
hl7string = hl7string.replace("\n", "\r")
try :
m = parse_message(hl7string)
except UnsupportedVersion:
print(" Error! : The specified version in the file is unsurpoted.")
print(" Kindly change the version number in the text file to 2.5")
#We create a dictionary to ensure it is json serializable
return hl7MessageToDictionary(m, use_long_name=use_long_name)
def hl7MessageToDictionary(m, use_long_name=True):
"""Convert an HL7 message to a dictionary
"""
if m.children:
d = {}
for c in m.children:
name = c.name.lower()
if use_long_name:
name = c.long_name.lower() if c.long_name else name
dictified = hl7MessageToDictionary(c, use_long_name=use_long_name)
if name in d:
if not isinstance(d[name], list):
d[name] = [d[name]]
d[name].append(dictified)
else:
d[name] = dictified
return d
else:
return m.to_er7()
def writeJsonFile(dictionary):
# Write JSON file
try:
to_unicode = unicode
except NameError:
to_unicode = str
#we want to write all messages into one file so we append
#to file first and then delete any previously writen file
with io.open('ml7tojson.json', 'a', encoding='utf8') as outfile:
str_ = json.dumps(dictionary,
indent=4, sort_keys=False,
separators=(',', ':'), ensure_ascii=False)
outfile.write(to_unicode(str_))
#read messages from file
strmsg = readMessageFile("HL7_Final.hl7")
#split the messages based on the blank line between messages
msgList = splitMessages(strmsg)
#lets remove a previously writen json file if the file exists, delete it
if os.path.isfile('ml7tojson.json'):
os.remove('ml7tojson.json')
print("Step 3: Previous json file deleted Successfully")
#Loop through the message to handle each message at a time
for message in msgList:
# Convert it to a dictionary
d = hl7StrToDictionary(message)
#write JSON file
writeJsonFile(d)
print ("A jason file with the message has been created")
| [
1,
444,
13361,
29901,
529,
5813,
29958,
13,
5215,
4390,
13,
5215,
12013,
13,
5215,
2897,
13,
5215,
337,
13,
3166,
298,
29880,
29955,
27580,
29889,
16680,
1053,
6088,
29918,
4906,
13,
3166,
298,
29880,
29955,
27580,
29889,
11739,
29879,
1053,
853,
23765,
6594,
13,
13,
29937,
13556,
3145,
278,
1024,
310,
278,
934,
322,
13623,
278,
7191,
297,
278,
934,
13,
1753,
1303,
3728,
2283,
29898,
9507,
1125,
13,
1678,
396,
949,
278,
934,
13,
1678,
2643,
353,
1722,
29898,
9507,
29892,
525,
29878,
2824,
949,
580,
13,
1678,
1596,
703,
14448,
29871,
29896,
29901,
3497,
1303,
8472,
1159,
13,
1678,
736,
2643,
13,
13,
29937,
4013,
1158,
8536,
1169,
278,
29871,
29941,
7191,
2729,
373,
278,
9654,
1196,
393,
338,
1546,
7191,
13,
1753,
6219,
25510,
29898,
710,
7645,
1125,
13,
1678,
7191,
1761,
353,
337,
29889,
5451,
877,
1966,
29876,
1966,
29876,
742,
851,
7645,
29897,
13,
1678,
1596,
703,
14448,
29871,
29906,
29901,
11946,
1179,
8536,
4430,
8472,
1159,
13,
1678,
736,
7191,
1761,
13,
13,
13,
13,
1753,
298,
29880,
29955,
5015,
1762,
11513,
29898,
4415,
29955,
1807,
29892,
671,
29918,
5426,
29918,
978,
29922,
5574,
1125,
13,
4706,
9995,
323,
6926,
263,
1347,
3443,
322,
29436,
372,
304,
263,
13343,
13,
4706,
584,
3207,
298,
29880,
29955,
1807,
29901,
379,
29931,
29955,
1347,
393,
338,
4502,
304,
278,
1158,
13,
4706,
584,
18280,
29901,
319,
8600,
8954,
310,
278,
379,
29931,
29955,
2643,
13,
4706,
9995,
13,
4706,
298,
29880,
29955,
1807,
353,
298,
29880,
29955,
1807,
29889,
6506,
14182,
29876,
613,
6634,
29878,
1159,
13,
4706,
1018,
584,
13,
9651,
286,
353,
6088,
29918,
4906,
29898,
4415,
29955,
1807,
29897,
13,
4706,
5174,
853,
23765,
6594,
29901,
13,
9651,
1596,
703,
4829,
29991,
584,
450,
6790,
1873,
297,
278,
934,
338,
443,
7610,
29886,
5715,
23157,
13,
9651,
1596,
703,
13187,
368,
1735,
278,
1873,
1353,
297,
278,
1426,
934,
304,
29871,
29906,
29889,
29945,
1159,
13,
13,
4706,
396,
4806,
1653,
263,
8600,
304,
9801,
372,
338,
4390,
7797,
13902,
13,
4706,
736,
298,
29880,
29955,
3728,
1762,
11513,
29898,
29885,
29892,
671,
29918,
5426,
29918,
978,
29922,
1509,
29918,
5426,
29918,
978,
29897,
13,
13,
1753,
298,
29880,
29955,
3728,
1762,
11513,
29898,
29885,
29892,
671,
29918,
5426,
29918,
978,
29922,
5574,
1125,
13,
4706,
9995,
18455,
385,
379,
29931,
29955,
2643,
304,
263,
8600,
13,
4706,
9995,
13,
4706,
565,
286,
29889,
11991,
29901,
13,
9651,
270,
353,
6571,
13,
9651,
363,
274,
297,
286,
29889,
11991,
29901,
13,
18884,
1024,
353,
274,
29889,
978,
29889,
13609,
580,
13,
18884,
565,
671,
29918,
5426,
29918,
978,
29901,
13,
462,
1678,
1024,
353,
274,
29889,
5426,
29918,
978,
29889,
13609,
580,
565,
274,
29889,
5426,
29918,
978,
1683,
1024,
13,
18884,
9657,
2164,
353,
298,
29880,
29955,
3728,
1762,
11513,
29898,
29883,
29892,
671,
29918,
5426,
29918,
978,
29922,
1509,
29918,
5426,
29918,
978,
29897,
13,
18884,
565,
1024,
297,
270,
29901,
13,
462,
1678,
565,
451,
338,
8758,
29898,
29881,
29961,
978,
1402,
1051,
1125,
13,
462,
4706,
270,
29961,
978,
29962,
353,
518,
29881,
29961,
978,
5262,
13,
462,
1678,
270,
29961,
978,
1822,
4397,
29898,
8977,
2164,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
270,
29961,
978,
29962,
353,
9657,
2164,
13,
13,
9651,
736,
270,
13,
4706,
1683,
29901,
13,
9651,
736,
286,
29889,
517,
29918,
261,
29955,
580,
13,
13,
1753,
2436,
8148,
2283,
29898,
27126,
1125,
13,
4706,
396,
14350,
4663,
934,
13,
4706,
1018,
29901,
13,
9651,
304,
29918,
2523,
356,
353,
29104,
13,
4706,
5174,
4408,
2392,
29901,
13,
9651,
304,
29918,
2523,
356,
353,
851,
13,
4706,
396,
705,
864,
304,
2436,
599,
7191,
964,
697,
934,
577,
591,
9773,
13,
4706,
396,
517,
934,
937,
322,
769,
5217,
738,
9251,
2044,
264,
934,
13,
4706,
411,
12013,
29889,
3150,
877,
828,
29955,
517,
3126,
29889,
3126,
742,
525,
29874,
742,
8025,
2433,
9420,
29947,
1495,
408,
714,
1445,
29901,
13,
9651,
851,
29918,
353,
4390,
29889,
29881,
17204,
29898,
27126,
29892,
13,
462,
795,
29536,
29922,
29946,
29892,
2656,
29918,
8149,
29922,
8824,
29892,
13,
462,
795,
2903,
4097,
7607,
742,
742,
525,
29901,
5477,
9801,
29918,
294,
18869,
29922,
8824,
29897,
13,
9651,
714,
1445,
29889,
3539,
29898,
517,
29918,
2523,
356,
29898,
710,
29918,
876,
13,
13,
13,
29937,
949,
7191,
515,
934,
13,
710,
7645,
353,
1303,
3728,
2283,
703,
15444,
29955,
29918,
15790,
29889,
4415,
29955,
1159,
13,
13,
29937,
5451,
278,
7191,
2729,
373,
278,
9654,
1196,
1546,
7191,
13,
7645,
1293,
353,
6219,
25510,
29898,
710,
7645,
29897,
13,
29937,
10376,
3349,
263,
9251,
2044,
264,
4390,
934,
565,
278,
934,
4864,
29892,
5217,
372,
13,
361,
2897,
29889,
2084,
29889,
275,
1445,
877,
828,
29955,
517,
3126,
29889,
3126,
29374,
13,
1678,
2897,
29889,
5992,
877,
828,
29955,
517,
3126,
29889,
3126,
1495,
13,
1678,
1596,
703,
14448,
29871,
29941,
29901,
4721,
2366,
4390,
934,
11132,
21397,
3730,
1159,
13,
13,
29937,
18405,
1549,
278,
2643,
304,
4386,
1269,
2643,
472,
263,
931,
13,
1454,
2643,
297,
10191,
1293,
29901,
13,
1678,
396,
14806,
372,
304,
263,
8600,
13,
1678,
270,
353,
298,
29880,
29955,
5015,
1762,
11513,
29898,
4906,
29897,
13,
1678,
396,
3539,
4663,
934,
13,
1678,
2436,
8148,
2283,
29898,
29881,
29897,
13,
13,
2158,
4852,
29909,
432,
1658,
934,
411,
278,
2643,
756,
1063,
2825,
1159,
13,
2
] |
modules/SOM_F1.[Scatter Changes in Temp and GDP Sulfate].py | YixuanZheng/Aerosol_Inequality_2019 | 3 | 107870 | <reponame>YixuanZheng/Aerosol_Inequality_2019
# -*- coding: utf-8 -*-
'''
This code generates Fig. S11
Country-level temperature changes and the associated GDP increment induced by anthropogenic SULFATE aerosols
by <NAME> (<EMAIL>)
'''
import _env
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
import seaborn.apionly as sns
from matplotlib.colors import ListedColormap
from netCDF4 import Dataset
matplotlib.rcParams['font.family'] = 'sans-serif'
matplotlib.rcParams['font.sans-serif'] = 'Helvetica'
gdp_year = _env.year
sgdp_year = str(gdp_year)
p_scen = 'No-Sulfate' #aerosol removal scenario
ds = 'ERA-Interim'
if_temp = _env.odir_root + '/summary_' + ds + '/country_specific_statistics_Temp_' + ds + '_' + p_scen + '.csv'
if_gdp = _env.odir_root + '/summary_' + ds + '/country_specific_statistics_GDP_' + ds + '_' + p_scen + '_Burke.xls'
odir_plot = _env.odir_root + '/plot/'
_env.mkdirs(odir_plot)
of_plot = odir_plot + 'SOM_F1.Scatter_Changes_in_Temp_and_GDP_Sulfate.png'
itbl_temp = pd.read_csv(if_temp,index_col = 0)
itbl_gdp = pd.read_excel(if_gdp,'country-lag0')
mtbl_tg = itbl_temp[['Temp_mean_climatological', 'Temp_mean_noaero', 'Temp_Changes']].copy()
for gc in ['iso', sgdp_year + '_gdp', sgdp_year + '_pop', 'GDP_median_benefit_ratio']:
mtbl_tg[gc] = itbl_gdp[gc].copy()
##############################################################################
##########################Panel a###########################
fig=plt.figure(figsize=(9,13))
ax=plt.subplot(211)
my_cmap = ListedColormap(sns.color_palette('viridis',11).as_hex()) #[::-1]) #modified by yz mar21,2019, suggested by SJD
pscat = plt.scatter(-mtbl_tg['Temp_Changes'],mtbl_tg['GDP_median_benefit_ratio'],c = mtbl_tg['Temp_mean_climatological'],vmin=-3,vmax=30,cmap=my_cmap,s=np.sqrt(mtbl_tg['2010_gdp']/1e7),
edgecolors='none',alpha=0.8,label=None)
##global mean results
g_pop = mtbl_tg['2010_pop'].sum()
g_gdp = (mtbl_tg['2010_gdp'].sum())
inc_temp = Dataset(_env.odir_root + '/sim_temperature/' + 'Simulated_Global_and_Country_TREFHT_20yravg.nc')
g_t_change = np.mean(inc_temp['TREFHT_Global_PW'][:,2]-inc_temp['TREFHT_Global_PW'][:,0])
g_gdp_change = ((mtbl_tg['GDP_median_benefit_ratio']*mtbl_tg['2010_gdp']).sum())/(mtbl_tg['2010_gdp'].sum())
g_gdp_size = 3*1e10
plt.scatter(-g_t_change,g_gdp_change,c = 'black',vmin=-3,vmax=30,s=np.sqrt(g_gdp_size/1e7),alpha=0.8)
#generate legend to indicate GDP size
gdp_labels = ['10$^9$','10$^{10}$','10$^{11}$','10$^{12}$','10$^{13}$']
for igdp,gdp in enumerate([1e9, 1e10, 1e11,1e12,1e13]):
plt.scatter([], [], c='',edgecolor='k', s=np.sqrt(gdp/1e7),
label=gdp_labels[igdp])
plt.legend(scatterpoints=1, frameon=False, labelspacing=0.5, title='GDP ($)',loc=6)
def plot_rec(llx,lly,urx,ury):
plt.vlines(llx,lly,ury,colors='grey',linestyle = 'dashed',lw=1)
plt.hlines(lly,llx,urx,colors='grey',linestyle = 'dashed',lw=1)
plt.vlines(urx,lly,ury,colors='grey',linestyle = 'dashed',lw=1)
plt.hlines(ury,llx,urx,colors='grey',linestyle = 'dashed',lw=1)
ollx = -1.2
olly = -0.5
ourx = -0.4
oury = 1.5
plot_rec(ollx,olly,ourx,oury)
ax.set_ylim(-2,2.2)
ax.set_xlim(-1.8,-0.2)
#set font size
plt.xticks(size=14)
plt.yticks(size=14)
ax.set_xlabel('Sulfate-induced temperature changes (\N{DEGREE SIGN}C)',fontsize=16)
ax.set_ylabel('GDP changes due to sulfate-induced cooling (%)',fontsize=16)
cbar = plt.colorbar(pscat,ticks=[0,3,6,9,12,15,18,21,24,27])
cbar.set_label('2010 temperature (\N{DEGREE SIGN}C)',fontsize = 16,rotation=270,labelpad=18)
cbar.ax.set_yticklabels([0,3,6,9,12,15,18,21,24,27],size=14)
plt.text(0.03,0.98, (chr(ord('a') + 0)),size=16, horizontalalignment='center',#fontweight = 'bold',
verticalalignment='top',transform=ax.transAxes,fontweight='bold')
##############################################################################
##########################Panel b###########################
#
ax=plt.subplot(212)
pscat = plt.scatter(-mtbl_tg['Temp_Changes'],mtbl_tg['GDP_median_benefit_ratio'],c = mtbl_tg['Temp_mean_climatological'],vmin=-3,vmax=30,cmap=my_cmap,s=np.sqrt(mtbl_tg['2010_gdp']/1e7),
edgecolors='none',alpha=0.8)
plt.scatter(-g_t_change,g_gdp_change,c = 'black',vmin=-3,vmax=30,s=np.sqrt(g_gdp_size/1e7),alpha=0.8)
#set font size
plt.xticks(size=14)
plt.yticks(size=14)
ax.set_ylim([olly,oury])
ax.set_xlim([ollx,ourx])
ax.set_xlabel('Sulfate-induced temperature changes (\N{DEGREE SIGN}C)',fontsize=16)
ax.set_ylabel('GDP changes due to sulfate-induced cooling (%)',fontsize=16)
cbar = plt.colorbar(pscat,ticks=[0,3,6,9,12,15,18,21,24,27])
cbar.set_label('2010 temperature (\N{DEGREE SIGN}C)',fontsize = 16,rotation=270,labelpad=18)
cbar.ax.set_yticklabels([0,3,6,9,12,15,18,21,24,27],size=14)
plt.text(0.03,0.98, (chr(ord('a') + 1)),size=16, horizontalalignment='center',#fontweight = 'bold',
verticalalignment='top',transform=ax.transAxes,fontweight='bold')
plt.savefig(of_plot, dpi=300,bbox_inches='tight')
| [
1,
529,
276,
1112,
420,
29958,
29979,
861,
12323,
29999,
29882,
996,
29914,
29909,
9672,
324,
29918,
29902,
484,
29567,
29918,
29906,
29900,
29896,
29929,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
12008,
13,
4013,
775,
16785,
5104,
29889,
317,
29896,
29896,
13,
13,
20779,
29899,
5563,
10430,
3620,
322,
278,
6942,
402,
11191,
11924,
20974,
491,
24612,
1336,
6352,
293,
317,
13309,
29943,
3040,
263,
9672,
3775,
13,
13,
1609,
529,
5813,
29958,
313,
29966,
26862,
6227,
12948,
13,
12008,
1678,
13,
13,
5215,
903,
6272,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
22889,
13,
5215,
409,
370,
1398,
29889,
481,
291,
368,
408,
269,
1983,
13,
3166,
22889,
29889,
27703,
1053,
2391,
287,
1625,
555,
481,
13,
3166,
7787,
29907,
4037,
29946,
1053,
13373,
24541,
13,
13,
2922,
17357,
29889,
2214,
9629,
1839,
5657,
29889,
11922,
2033,
353,
525,
29879,
550,
29899,
643,
361,
29915,
13,
2922,
17357,
29889,
2214,
9629,
1839,
5657,
29889,
29879,
550,
29899,
643,
361,
2033,
353,
525,
7658,
5990,
983,
29915,
13,
13,
29887,
6099,
29918,
6360,
353,
903,
6272,
29889,
6360,
13,
5311,
6099,
29918,
6360,
353,
851,
29898,
29887,
6099,
29918,
6360,
29897,
13,
13,
29886,
29918,
1557,
264,
353,
525,
3782,
29899,
29903,
16302,
403,
29915,
396,
29874,
9672,
324,
28744,
10483,
13,
6289,
353,
525,
1001,
29909,
29899,
4074,
326,
29915,
13,
13,
361,
29918,
7382,
353,
903,
6272,
29889,
397,
381,
29918,
4632,
718,
8207,
7727,
29918,
29915,
718,
18031,
718,
8207,
13509,
29918,
14940,
29918,
6112,
6765,
29918,
15637,
29918,
29915,
718,
18031,
718,
22868,
29915,
718,
282,
29918,
1557,
264,
718,
15300,
7638,
29915,
13,
361,
29918,
29887,
6099,
353,
903,
6272,
29889,
397,
381,
29918,
4632,
718,
8207,
7727,
29918,
29915,
718,
18031,
718,
8207,
13509,
29918,
14940,
29918,
6112,
6765,
29918,
29954,
11191,
29918,
29915,
718,
18031,
718,
22868,
29915,
718,
282,
29918,
1557,
264,
718,
22868,
29933,
332,
446,
29889,
20267,
29915,
13,
13,
397,
381,
29918,
5317,
353,
903,
6272,
29889,
397,
381,
29918,
4632,
718,
8207,
5317,
22208,
13,
29918,
6272,
29889,
11256,
3972,
29879,
29898,
397,
381,
29918,
5317,
29897,
13,
13,
974,
29918,
5317,
353,
2413,
381,
29918,
5317,
718,
525,
6156,
29924,
29918,
29943,
29896,
29889,
4421,
2620,
29918,
21459,
29918,
262,
29918,
15637,
29918,
392,
29918,
29954,
11191,
29918,
29903,
16302,
403,
29889,
2732,
29915,
13,
13,
277,
2204,
29918,
7382,
353,
10518,
29889,
949,
29918,
7638,
29898,
361,
29918,
7382,
29892,
2248,
29918,
1054,
353,
29871,
29900,
29897,
13,
277,
2204,
29918,
29887,
6099,
353,
10518,
29889,
949,
29918,
24633,
29898,
361,
29918,
29887,
6099,
5501,
13509,
29899,
3110,
29900,
1495,
13,
13,
4378,
2204,
29918,
29873,
29887,
353,
372,
2204,
29918,
7382,
29961,
1839,
15637,
29918,
12676,
29918,
695,
15840,
5996,
742,
525,
15637,
29918,
12676,
29918,
1217,
29874,
1489,
742,
525,
15637,
29918,
21459,
2033,
1822,
8552,
580,
13,
1454,
330,
29883,
297,
6024,
10718,
742,
269,
29887,
6099,
29918,
6360,
718,
22868,
29887,
6099,
742,
269,
29887,
6099,
29918,
6360,
718,
22868,
7323,
742,
525,
29954,
11191,
29918,
2168,
713,
29918,
1785,
1389,
277,
29918,
3605,
601,
2033,
29901,
13,
1678,
286,
16400,
29918,
29873,
29887,
29961,
27354,
29962,
353,
372,
2204,
29918,
29887,
6099,
29961,
27354,
1822,
8552,
580,
13,
29871,
13,
268,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
13,
13383,
7346,
2277,
7490,
263,
13383,
7346,
2277,
29937,
13,
13,
1003,
29922,
572,
29873,
29889,
4532,
29898,
1003,
2311,
7607,
29929,
29892,
29896,
29941,
876,
13,
1165,
29922,
572,
29873,
29889,
1491,
5317,
29898,
29906,
29896,
29896,
29897,
13,
13,
1357,
29918,
29883,
1958,
353,
2391,
287,
1625,
555,
481,
29898,
29879,
1983,
29889,
2780,
29918,
29886,
26456,
877,
2405,
333,
275,
742,
29896,
29896,
467,
294,
29918,
20970,
3101,
29871,
14330,
1057,
29899,
29896,
2314,
396,
1545,
2164,
491,
343,
29920,
1766,
29906,
29896,
29892,
29906,
29900,
29896,
29929,
29892,
7829,
491,
317,
29967,
29928,
13,
13,
13,
567,
4117,
353,
14770,
29889,
1557,
2620,
6278,
4378,
2204,
29918,
29873,
29887,
1839,
15637,
29918,
21459,
7464,
4378,
2204,
29918,
29873,
29887,
1839,
29954,
11191,
29918,
2168,
713,
29918,
1785,
1389,
277,
29918,
3605,
601,
7464,
29883,
353,
286,
16400,
29918,
29873,
29887,
1839,
15637,
29918,
12676,
29918,
695,
15840,
5996,
7464,
29894,
1195,
10457,
29941,
29892,
29894,
3317,
29922,
29941,
29900,
29892,
29883,
1958,
29922,
1357,
29918,
29883,
1958,
29892,
29879,
29922,
9302,
29889,
3676,
29898,
4378,
2204,
29918,
29873,
29887,
1839,
29906,
29900,
29896,
29900,
29918,
29887,
6099,
2033,
29914,
29896,
29872,
29955,
511,
13,
462,
1678,
7636,
27703,
2433,
9290,
742,
2312,
29922,
29900,
29889,
29947,
29892,
1643,
29922,
8516,
29897,
29871,
13,
13,
2277,
10945,
2099,
2582,
13,
29887,
29918,
7323,
353,
286,
16400,
29918,
29873,
29887,
1839,
29906,
29900,
29896,
29900,
29918,
7323,
13359,
2083,
580,
13,
29887,
29918,
29887,
6099,
353,
313,
4378,
2204,
29918,
29873,
29887,
1839,
29906,
29900,
29896,
29900,
29918,
29887,
6099,
13359,
2083,
3101,
13,
13,
3742,
29918,
7382,
353,
13373,
24541,
7373,
6272,
29889,
397,
381,
29918,
4632,
718,
8207,
3601,
29918,
12863,
1535,
22208,
29871,
718,
525,
8942,
7964,
29918,
12756,
29918,
392,
29918,
20779,
29918,
29911,
25866,
3912,
29918,
29906,
29900,
29891,
5705,
29887,
29889,
17608,
1495,
13,
29887,
29918,
29873,
29918,
3167,
353,
7442,
29889,
12676,
29898,
3742,
29918,
7382,
1839,
29911,
25866,
3912,
29918,
12756,
29918,
29925,
29956,
2033,
7503,
29892,
29906,
29962,
29899,
3742,
29918,
7382,
1839,
29911,
25866,
3912,
29918,
12756,
29918,
29925,
29956,
2033,
7503,
29892,
29900,
2314,
13,
29887,
29918,
29887,
6099,
29918,
3167,
353,
5135,
4378,
2204,
29918,
29873,
29887,
1839,
29954,
11191,
29918,
2168,
713,
29918,
1785,
1389,
277,
29918,
3605,
601,
2033,
29930,
4378,
2204,
29918,
29873,
29887,
1839,
29906,
29900,
29896,
29900,
29918,
29887,
6099,
2033,
467,
2083,
3101,
14571,
4378,
2204,
29918,
29873,
29887,
1839,
29906,
29900,
29896,
29900,
29918,
29887,
6099,
13359,
2083,
3101,
13,
29887,
29918,
29887,
6099,
29918,
2311,
353,
29871,
29941,
29930,
29896,
29872,
29896,
29900,
29871,
13,
13,
572,
29873,
29889,
1557,
2620,
6278,
29887,
29918,
29873,
29918,
3167,
29892,
29887,
29918,
29887,
6099,
29918,
3167,
29892,
29883,
353,
525,
8517,
742,
29894,
1195,
10457,
29941,
29892,
29894,
3317,
29922,
29941,
29900,
29892,
29879,
29922,
9302,
29889,
3676,
29898,
29887,
29918,
29887,
6099,
29918,
2311,
29914,
29896,
29872,
29955,
511,
2312,
29922,
29900,
29889,
29947,
29897,
13,
13,
13,
29937,
17158,
15983,
304,
12266,
402,
11191,
2159,
13,
29887,
6099,
29918,
21134,
353,
6024,
29896,
29900,
29938,
29985,
29929,
29938,
3788,
29896,
29900,
29938,
998,
29896,
29900,
1042,
3788,
29896,
29900,
29938,
998,
29896,
29896,
1042,
3788,
29896,
29900,
29938,
998,
29896,
29906,
1042,
3788,
29896,
29900,
29938,
998,
29896,
29941,
1042,
2033,
13,
1454,
8919,
6099,
29892,
29887,
6099,
297,
26985,
4197,
29896,
29872,
29929,
29892,
29871,
29896,
29872,
29896,
29900,
29892,
29871,
29896,
29872,
29896,
29896,
29892,
29896,
29872,
29896,
29906,
29892,
29896,
29872,
29896,
29941,
29962,
1125,
13,
1678,
14770,
29889,
1557,
2620,
4197,
1402,
19997,
274,
2433,
742,
12864,
2780,
2433,
29895,
742,
269,
29922,
9302,
29889,
3676,
29898,
29887,
6099,
29914,
29896,
29872,
29955,
511,
13,
18884,
3858,
29922,
29887,
6099,
29918,
21134,
29961,
335,
6099,
2314,
13,
572,
29873,
29889,
26172,
29898,
1557,
2620,
9748,
29922,
29896,
29892,
3515,
265,
29922,
8824,
29892,
3858,
1028,
9390,
29922,
29900,
29889,
29945,
29892,
3611,
2433,
29954,
11191,
3255,
29897,
742,
2029,
29922,
29953,
29897,
13,
13,
1753,
6492,
29918,
3757,
29898,
645,
29916,
29892,
29880,
368,
29892,
332,
29916,
29892,
2857,
1125,
13,
1678,
14770,
29889,
29894,
9012,
29898,
645,
29916,
29892,
29880,
368,
29892,
2857,
29892,
27703,
2433,
7979,
29891,
742,
1915,
342,
1508,
353,
525,
14592,
287,
742,
29880,
29893,
29922,
29896,
29897,
13,
1678,
14770,
29889,
4415,
1475,
29898,
29880,
368,
29892,
645,
29916,
29892,
332,
29916,
29892,
27703,
2433,
7979,
29891,
742,
1915,
342,
1508,
353,
525,
14592,
287,
742,
29880,
29893,
29922,
29896,
29897,
13,
13,
1678,
14770,
29889,
29894,
9012,
29898,
332,
29916,
29892,
29880,
368,
29892,
2857,
29892,
27703,
2433,
7979,
29891,
742,
1915,
342,
1508,
353,
525,
14592,
287,
742,
29880,
29893,
29922,
29896,
29897,
13,
1678,
14770,
29889,
4415,
1475,
29898,
2857,
29892,
645,
29916,
29892,
332,
29916,
29892,
27703,
2433,
7979,
29891,
742,
1915,
342,
1508,
353,
525,
14592,
287,
742,
29880,
29893,
29922,
29896,
29897,
13,
13,
3028,
29916,
353,
448,
29896,
29889,
29906,
13,
18368,
353,
448,
29900,
29889,
29945,
13,
473,
29916,
353,
448,
29900,
29889,
29946,
13,
473,
29891,
353,
29871,
29896,
29889,
29945,
13,
13,
5317,
29918,
3757,
29898,
3028,
29916,
29892,
18368,
29892,
473,
29916,
29892,
473,
29891,
29897,
13,
13,
13,
1165,
29889,
842,
29918,
29891,
2576,
6278,
29906,
29892,
29906,
29889,
29906,
29897,
13,
1165,
29889,
842,
29918,
29916,
2576,
6278,
29896,
29889,
29947,
6653,
29900,
29889,
29906,
29897,
13,
29937,
842,
4079,
2159,
13,
572,
29873,
29889,
486,
7358,
29898,
2311,
29922,
29896,
29946,
29897,
13,
572,
29873,
29889,
3637,
7358,
29898,
2311,
29922,
29896,
29946,
29897,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29903,
16302,
403,
29899,
19910,
1133,
10430,
3620,
3441,
29940,
29912,
2287,
29954,
21661,
317,
17298,
29913,
29907,
29897,
742,
5657,
2311,
29922,
29896,
29953,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29954,
11191,
3620,
2861,
304,
5394,
29888,
403,
29899,
19910,
1133,
12528,
292,
313,
10997,
742,
5657,
2311,
29922,
29896,
29953,
29897,
29871,
13,
13,
29883,
1646,
353,
14770,
29889,
2780,
1646,
29898,
567,
4117,
29892,
29873,
7358,
11759,
29900,
29892,
29941,
29892,
29953,
29892,
29929,
29892,
29896,
29906,
29892,
29896,
29945,
29892,
29896,
29947,
29892,
29906,
29896,
29892,
29906,
29946,
29892,
29906,
29955,
2314,
13,
29883,
1646,
29889,
842,
29918,
1643,
877,
29906,
29900,
29896,
29900,
10430,
3441,
29940,
29912,
2287,
29954,
21661,
317,
17298,
29913,
29907,
29897,
742,
5657,
2311,
353,
29871,
29896,
29953,
29892,
5450,
362,
29922,
29906,
29955,
29900,
29892,
1643,
8305,
29922,
29896,
29947,
29897,
13,
29883,
1646,
29889,
1165,
29889,
842,
29918,
3637,
860,
21134,
4197,
29900,
29892,
29941,
29892,
29953,
29892,
29929,
29892,
29896,
29906,
29892,
29896,
29945,
29892,
29896,
29947,
29892,
29906,
29896,
29892,
29906,
29946,
29892,
29906,
29955,
1402,
2311,
29922,
29896,
29946,
29897,
13,
572,
29873,
29889,
726,
29898,
29900,
29889,
29900,
29941,
29892,
29900,
29889,
29929,
29947,
29892,
313,
22495,
29898,
536,
877,
29874,
1495,
718,
29871,
29900,
8243,
2311,
29922,
29896,
29953,
29892,
14698,
2520,
358,
2433,
5064,
742,
29937,
5657,
7915,
353,
525,
8934,
742,
13,
632,
11408,
2520,
358,
2433,
3332,
742,
9067,
29922,
1165,
29889,
3286,
29909,
9100,
29892,
5657,
7915,
2433,
8934,
1495,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
13,
13383,
7346,
2277,
7490,
289,
13383,
7346,
2277,
29937,
13,
29937,
13,
1165,
29922,
572,
29873,
29889,
1491,
5317,
29898,
29906,
29896,
29906,
29897,
13,
13,
567,
4117,
353,
14770,
29889,
1557,
2620,
6278,
4378,
2204,
29918,
29873,
29887,
1839,
15637,
29918,
21459,
7464,
4378,
2204,
29918,
29873,
29887,
1839,
29954,
11191,
29918,
2168,
713,
29918,
1785,
1389,
277,
29918,
3605,
601,
7464,
29883,
353,
286,
16400,
29918,
29873,
29887,
1839,
15637,
29918,
12676,
29918,
695,
15840,
5996,
7464,
29894,
1195,
10457,
29941,
29892,
29894,
3317,
29922,
29941,
29900,
29892,
29883,
1958,
29922,
1357,
29918,
29883,
1958,
29892,
29879,
29922,
9302,
29889,
3676,
29898,
4378,
2204,
29918,
29873,
29887,
1839,
29906,
29900,
29896,
29900,
29918,
29887,
6099,
2033,
29914,
29896,
29872,
29955,
511,
13,
462,
1678,
7636,
27703,
2433,
9290,
742,
2312,
29922,
29900,
29889,
29947,
29897,
13,
572,
29873,
29889,
1557,
2620,
6278,
29887,
29918,
29873,
29918,
3167,
29892,
29887,
29918,
29887,
6099,
29918,
3167,
29892,
29883,
353,
525,
8517,
742,
29894,
1195,
10457,
29941,
29892,
29894,
3317,
29922,
29941,
29900,
29892,
29879,
29922,
9302,
29889,
3676,
29898,
29887,
29918,
29887,
6099,
29918,
2311,
29914,
29896,
29872,
29955,
511,
2312,
29922,
29900,
29889,
29947,
29897,
13,
13,
29937,
842,
4079,
2159,
13,
572,
29873,
29889,
486,
7358,
29898,
2311,
29922,
29896,
29946,
29897,
13,
572,
29873,
29889,
3637,
7358,
29898,
2311,
29922,
29896,
29946,
29897,
13,
13,
1165,
29889,
842,
29918,
29891,
2576,
4197,
18368,
29892,
473,
29891,
2314,
13,
1165,
29889,
842,
29918,
29916,
2576,
4197,
3028,
29916,
29892,
473,
29916,
2314,
13,
13,
1165,
29889,
842,
29918,
29916,
1643,
877,
29903,
16302,
403,
29899,
19910,
1133,
10430,
3620,
3441,
29940,
29912,
2287,
29954,
21661,
317,
17298,
29913,
29907,
29897,
742,
5657,
2311,
29922,
29896,
29953,
29897,
13,
1165,
29889,
842,
29918,
29891,
1643,
877,
29954,
11191,
3620,
2861,
304,
5394,
29888,
403,
29899,
19910,
1133,
12528,
292,
313,
10997,
742,
5657,
2311,
29922,
29896,
29953,
29897,
29871,
13,
13,
29883,
1646,
353,
14770,
29889,
2780,
1646,
29898,
567,
4117,
29892,
29873,
7358,
11759,
29900,
29892,
29941,
29892,
29953,
29892,
29929,
29892,
29896,
29906,
29892,
29896,
29945,
29892,
29896,
29947,
29892,
29906,
29896,
29892,
29906,
29946,
29892,
29906,
29955,
2314,
13,
29883,
1646,
29889,
842,
29918,
1643,
877,
29906,
29900,
29896,
29900,
10430,
3441,
29940,
29912,
2287,
29954,
21661,
317,
17298,
29913,
29907,
29897,
742,
5657,
2311,
353,
29871,
29896,
29953,
29892,
5450,
362,
29922,
29906,
29955,
29900,
29892,
1643,
8305,
29922,
29896,
29947,
29897,
13,
29883,
1646,
29889,
1165,
29889,
842,
29918,
3637,
860,
21134,
4197,
29900,
29892,
29941,
29892,
29953,
29892,
29929,
29892,
29896,
29906,
29892,
29896,
29945,
29892,
29896,
29947,
29892,
29906,
29896,
29892,
29906,
29946,
29892,
29906,
29955,
1402,
2311,
29922,
29896,
29946,
29897,
13,
572,
29873,
29889,
726,
29898,
29900,
29889,
29900,
29941,
29892,
29900,
29889,
29929,
29947,
29892,
313,
22495,
29898,
536,
877,
29874,
1495,
718,
29871,
29896,
8243,
2311,
29922,
29896,
29953,
29892,
14698,
2520,
358,
2433,
5064,
742,
29937,
5657,
7915,
353,
525,
8934,
742,
13,
632,
11408,
2520,
358,
2433,
3332,
742,
9067,
29922,
1165,
29889,
3286,
29909,
9100,
29892,
5657,
7915,
2433,
8934,
1495,
13,
572,
29873,
29889,
7620,
1003,
29898,
974,
29918,
5317,
29892,
270,
1631,
29922,
29941,
29900,
29900,
29892,
29890,
1884,
29918,
262,
6609,
2433,
29873,
523,
1495,
259,
13,
2
] |
Research/encoders.py | ylzhang29/GAN-for-tabular-data | 272 | 194662 | from typing import List
import numpy as np
import pandas as pd
from category_encoders.backward_difference import BackwardDifferenceEncoder
from category_encoders.cat_boost import CatBoostEncoder
from category_encoders.helmert import HelmertEncoder
from category_encoders.james_stein import JamesSteinEncoder
from category_encoders.leave_one_out import LeaveOneOutEncoder
from category_encoders.m_estimate import MEstimateEncoder
from category_encoders.one_hot import OneHotEncoder
from category_encoders.ordinal import OrdinalEncoder
from category_encoders.sum_coding import SumEncoder
from category_encoders.target_encoder import TargetEncoder
from category_encoders.woe import WOEEncoder
from sklearn.model_selection import RepeatedStratifiedKFold
def get_single_encoder(encoder_name: str, cat_cols: list):
"""
Get encoder by its name
:param encoder_name: Name of desired encoder
:param cat_cols: Cat columns for encoding
:return: Categorical encoder
"""
if encoder_name == "FrequencyEncoder":
encoder = FrequencyEncoder(cols=cat_cols)
if encoder_name == "WOEEncoder":
encoder = WOEEncoder(cols=cat_cols)
if encoder_name == "TargetEncoder":
encoder = TargetEncoder(cols=cat_cols)
if encoder_name == "SumEncoder":
encoder = SumEncoder(cols=cat_cols)
if encoder_name == "MEstimateEncoder":
encoder = MEstimateEncoder(cols=cat_cols)
if encoder_name == "LeaveOneOutEncoder":
encoder = LeaveOneOutEncoder(cols=cat_cols)
if encoder_name == "HelmertEncoder":
encoder = HelmertEncoder(cols=cat_cols)
if encoder_name == "BackwardDifferenceEncoder":
encoder = BackwardDifferenceEncoder(cols=cat_cols)
if encoder_name == "JamesSteinEncoder":
encoder = JamesSteinEncoder(cols=cat_cols)
if encoder_name == "OrdinalEncoder":
encoder = OrdinalEncoder(cols=cat_cols)
if encoder_name == "CatBoostEncoder":
encoder = CatBoostEncoder(cols=cat_cols)
if encoder_name == "MEstimateEncoder":
encoder = MEstimateEncoder(cols=cat_cols)
if encoder_name == "OneHotEncoder":
encoder = OneHotEncoder(cols=cat_cols)
if encoder is None:
raise NotImplementedError("To be implemented")
return encoder
class DoubleValidationEncoderNumerical:
"""
Encoder with validation within
"""
def __init__(self, cols, encoders_names_tuple=()):
"""
:param cols: Categorical columns
:param encoders_names_tuple: Tuple of str with encoders
"""
self.cols, self.num_cols = cols, None
self.encoders_names_tuple = encoders_names_tuple
self.n_folds, self.n_repeats = 5, 3
self.model_validation = RepeatedStratifiedKFold(
n_splits=self.n_folds, n_repeats=self.n_repeats, random_state=0
)
self.encoders_dict = {}
self.storage = None
def fit_transform(self, X: pd.DataFrame, y: np.array) -> pd.DataFrame:
self.num_cols = [col for col in X.columns if col not in self.cols]
self.storage = []
for encoder_name in self.encoders_names_tuple:
for n_fold, (train_idx, val_idx) in enumerate(
self.model_validation.split(X, y)
):
encoder = get_single_encoder(encoder_name, self.cols)
X_train, X_val = (
X.loc[train_idx].reset_index(drop=True),
X.loc[val_idx].reset_index(drop=True),
)
y_train, y_val = y[train_idx], y[val_idx]
_ = encoder.fit_transform(X_train, y_train)
# transform validation part and get all necessary cols
val_t = encoder.transform(X_val)
val_t = val_t[
[col for col in val_t.columns if col not in self.num_cols]
].values
if encoder_name not in self.encoders_dict.keys():
cols_representation = np.zeros((X.shape[0], val_t.shape[1]))
self.encoders_dict[encoder_name] = [encoder]
else:
self.encoders_dict[encoder_name].append(encoder)
cols_representation[val_idx, :] += val_t / self.n_repeats
cols_representation = pd.DataFrame(cols_representation)
cols_representation.columns = [
f"encoded_{encoder_name}_{i}"
for i in range(cols_representation.shape[1])
]
self.storage.append(cols_representation)
for df in self.storage:
X = pd.concat([X, df], axis=1)
X.drop(self.cols, axis=1, inplace=True)
return X
def transform(self, X: pd.DataFrame) -> pd.DataFrame:
self.storage = []
for encoder_name in self.encoders_names_tuple:
cols_representation = None
for encoder in self.encoders_dict[encoder_name]:
test_tr = encoder.transform(X)
test_tr = test_tr[
[col for col in test_tr.columns if col not in self.num_cols]
].values
if cols_representation is None:
cols_representation = np.zeros(test_tr.shape)
cols_representation = (
cols_representation + test_tr / self.n_folds / self.n_repeats
)
cols_representation = pd.DataFrame(cols_representation)
cols_representation.columns = [
f"encoded_{encoder_name}_{i}"
for i in range(cols_representation.shape[1])
]
self.storage.append(cols_representation)
for df in self.storage:
X = pd.concat([X, df], axis=1)
X.drop(self.cols, axis=1, inplace=True)
return X
class MultipleEncoder:
"""
Multiple encoder for categorical columns
"""
def __init__(self, cols: List[str], encoders_names_tuple=()):
"""
:param cols: List of categorical columns
:param encoders_names_tuple: Tuple of categorical encoders names. Possible values in tuple are:
"FrequencyEncoder", "WOEEncoder", "TargetEncoder", "SumEncoder", "MEstimateEncoder", "LeaveOneOutEncoder",
"HelmertEncoder", "BackwardDifferenceEncoder", "JamesSteinEncoder", "OrdinalEncoder""CatBoostEncoder"
"""
self.cols = cols
self.num_cols = None
self.encoders_names_tuple = encoders_names_tuple
self.encoders_dict = {}
# list for storing results of transformation from each encoder
self.storage = None
def fit_transform(self, X: pd.DataFrame, y: np.array) -> pd.DataFrame:
self.num_cols = [col for col in X.columns if col not in self.cols]
self.storage = []
for encoder_name in self.encoders_names_tuple:
encoder = get_single_encoder(encoder_name=encoder_name, cat_cols=self.cols)
cols_representation = encoder.fit_transform(X, y)
self.encoders_dict[encoder_name] = encoder
cols_representation = cols_representation[
[col for col in cols_representation.columns if col not in self.num_cols]
].values
cols_representation = pd.DataFrame(cols_representation)
cols_representation.columns = [
f"encoded_{encoder_name}_{i}"
for i in range(cols_representation.shape[1])
]
self.storage.append(cols_representation)
# concat cat cols representations with initial dataframe
for df in self.storage:
X = pd.concat([X, df], axis=1)
# remove all columns as far as we have their representations
X.drop(self.cols, axis=1, inplace=True)
return X
def transform(self, X) -> pd.DataFrame:
self.storage = []
for encoder_name in self.encoders_names_tuple:
# get representation of cat columns and form a pd.DataFrame for it
cols_representation = self.encoders_dict[encoder_name].transform(X)
cols_representation = cols_representation[
[col for col in cols_representation.columns if col not in self.num_cols]
].values
cols_representation = pd.DataFrame(cols_representation)
cols_representation.columns = [
f"encoded_{encoder_name}_{i}"
for i in range(cols_representation.shape[1])
]
self.storage.append(cols_representation)
# concat cat cols representations with initial dataframe
for df in self.storage:
X = pd.concat([X, df], axis=1)
# remove all columns as far as we have their representations
X.drop(self.cols, axis=1, inplace=True)
return X
class FrequencyEncoder:
def __init__(self, cols):
self.cols = cols
self.counts_dict = None
def fit(self, X: pd.DataFrame, y=None) -> pd.DataFrame:
counts_dict = {}
for col in self.cols:
values, counts = np.unique(X[col], return_counts=True)
counts_dict[col] = dict(zip(values, counts))
self.counts_dict = counts_dict
def transform(self, X: pd.DataFrame) -> pd.DataFrame:
counts_dict_test = {}
res = []
for col in self.cols:
values, counts = np.unique(X[col], return_counts=True)
counts_dict_test[col] = dict(zip(values, counts))
# if value is in "train" keys - replace "test" counts with "train" counts
for k in [
key
for key in counts_dict_test[col].keys()
if key in self.counts_dict[col].keys()
]:
counts_dict_test[col][k] = self.counts_dict[col][k]
res.append(X[col].map(counts_dict_test[col]).values.reshape(-1, 1))
res = np.hstack(res)
X[self.cols] = res
return X
def fit_transform(self, X: pd.DataFrame, y=None) -> pd.DataFrame:
self.fit(X, y)
X = self.transform(X)
return X
if __name__ == "__main__":
df = pd.DataFrame({})
df["cat_col"] = [1, 2, 3, 1, 2, 3, 1, 1, 1]
df["target"] = [0, 1, 0, 1, 0, 1, 0, 1, 0]
#
temp = df.copy()
enc = CatBoostEncoder(cols=["cat_col"])
print(enc.fit_transform(temp, temp["target"]))
#
temp = df.copy()
enc = MultipleEncoder(cols=["cat_col"], encoders_names_tuple=("CatBoostEncoder",))
print(enc.fit_transform(temp, temp["target"]))
#
temp = df.copy()
enc = DoubleValidationEncoderNumerical(
cols=["cat_col"], encoders_names_tuple=("CatBoostEncoder",)
)
print(enc.fit_transform(temp, temp["target"]))
| [
1,
515,
19229,
1053,
2391,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
1627,
1328,
29918,
29881,
17678,
1053,
7437,
1328,
29928,
17678,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
4117,
29918,
17079,
1053,
10459,
8431,
520,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
9421,
814,
1053,
6162,
29885,
814,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
29926,
1280,
29918,
5465,
1053,
5011,
7789,
262,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
280,
1351,
29918,
650,
29918,
449,
1053,
951,
1351,
6716,
3744,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
29885,
29918,
342,
6490,
1053,
341,
12787,
6490,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
650,
29918,
8711,
1053,
3118,
28917,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
536,
979,
1053,
16557,
979,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
2083,
29918,
29883,
3689,
1053,
6991,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
5182,
29918,
3977,
6119,
1053,
17157,
8566,
6119,
13,
3166,
7663,
29918,
3977,
397,
414,
29889,
827,
29872,
1053,
399,
29949,
29923,
8566,
6119,
13,
3166,
2071,
19668,
29889,
4299,
29918,
21731,
1053,
830,
412,
630,
5015,
271,
2164,
29968,
29943,
1025,
13,
13,
13,
1753,
679,
29918,
14369,
29918,
3977,
6119,
29898,
3977,
6119,
29918,
978,
29901,
851,
29892,
6635,
29918,
22724,
29901,
1051,
1125,
13,
1678,
9995,
13,
1678,
3617,
2094,
6119,
491,
967,
1024,
13,
1678,
584,
3207,
2094,
6119,
29918,
978,
29901,
4408,
310,
7429,
2094,
6119,
13,
1678,
584,
3207,
6635,
29918,
22724,
29901,
10459,
4341,
363,
8025,
13,
1678,
584,
2457,
29901,
315,
20440,
936,
2094,
6119,
13,
1678,
9995,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
23923,
23860,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
3878,
23860,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
29956,
29949,
29923,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
399,
29949,
29923,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
8667,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
17157,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
11139,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
6991,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
2303,
303,
6490,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
341,
12787,
6490,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
3226,
1351,
6716,
3744,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
951,
1351,
6716,
3744,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
7658,
29885,
814,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
6162,
29885,
814,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
5841,
1328,
29928,
17678,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
7437,
1328,
29928,
17678,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
29470,
7789,
262,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
5011,
7789,
262,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
23302,
979,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
16557,
979,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
9694,
8431,
520,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
10459,
8431,
520,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
2303,
303,
6490,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
341,
12787,
6490,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
1678,
565,
2094,
6119,
29918,
978,
1275,
376,
6716,
28917,
8566,
6119,
1115,
13,
4706,
2094,
6119,
353,
3118,
28917,
8566,
6119,
29898,
22724,
29922,
4117,
29918,
22724,
29897,
13,
1678,
565,
2094,
6119,
338,
6213,
29901,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
703,
1762,
367,
8762,
1159,
13,
1678,
736,
2094,
6119,
13,
13,
13,
1990,
11599,
19448,
8566,
6119,
29940,
4680,
936,
29901,
13,
1678,
9995,
13,
1678,
11346,
6119,
411,
8845,
2629,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
28730,
29892,
2094,
397,
414,
29918,
7039,
29918,
23583,
29922,
580,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
28730,
29901,
315,
20440,
936,
4341,
13,
4706,
584,
3207,
2094,
397,
414,
29918,
7039,
29918,
23583,
29901,
12603,
552,
310,
851,
411,
2094,
397,
414,
13,
4706,
9995,
13,
4706,
1583,
29889,
22724,
29892,
1583,
29889,
1949,
29918,
22724,
353,
28730,
29892,
6213,
13,
4706,
1583,
29889,
3977,
397,
414,
29918,
7039,
29918,
23583,
353,
2094,
397,
414,
29918,
7039,
29918,
23583,
13,
13,
4706,
1583,
29889,
29876,
29918,
29888,
3361,
29892,
1583,
29889,
29876,
29918,
276,
412,
1446,
353,
29871,
29945,
29892,
29871,
29941,
13,
4706,
1583,
29889,
4299,
29918,
18157,
353,
830,
412,
630,
5015,
271,
2164,
29968,
29943,
1025,
29898,
13,
9651,
302,
29918,
23579,
1169,
29922,
1311,
29889,
29876,
29918,
29888,
3361,
29892,
302,
29918,
276,
412,
1446,
29922,
1311,
29889,
29876,
29918,
276,
412,
1446,
29892,
4036,
29918,
3859,
29922,
29900,
13,
4706,
1723,
13,
4706,
1583,
29889,
3977,
397,
414,
29918,
8977,
353,
6571,
13,
13,
4706,
1583,
29889,
12925,
353,
6213,
13,
13,
1678,
822,
6216,
29918,
9067,
29898,
1311,
29892,
1060,
29901,
10518,
29889,
17271,
29892,
343,
29901,
7442,
29889,
2378,
29897,
1599,
10518,
29889,
17271,
29901,
13,
4706,
1583,
29889,
1949,
29918,
22724,
353,
518,
1054,
363,
784,
297,
1060,
29889,
13099,
565,
784,
451,
297,
1583,
29889,
22724,
29962,
13,
4706,
1583,
29889,
12925,
353,
5159,
13,
13,
4706,
363,
2094,
6119,
29918,
978,
297,
1583,
29889,
3977,
397,
414,
29918,
7039,
29918,
23583,
29901,
13,
9651,
363,
302,
29918,
8771,
29892,
313,
14968,
29918,
13140,
29892,
659,
29918,
13140,
29897,
297,
26985,
29898,
13,
18884,
1583,
29889,
4299,
29918,
18157,
29889,
5451,
29898,
29990,
29892,
343,
29897,
13,
632,
1125,
13,
18884,
2094,
6119,
353,
679,
29918,
14369,
29918,
3977,
6119,
29898,
3977,
6119,
29918,
978,
29892,
1583,
29889,
22724,
29897,
13,
13,
18884,
1060,
29918,
14968,
29892,
1060,
29918,
791,
353,
313,
13,
462,
1678,
1060,
29889,
2029,
29961,
14968,
29918,
13140,
1822,
12071,
29918,
2248,
29898,
8865,
29922,
5574,
511,
13,
462,
1678,
1060,
29889,
2029,
29961,
791,
29918,
13140,
1822,
12071,
29918,
2248,
29898,
8865,
29922,
5574,
511,
13,
18884,
1723,
13,
18884,
343,
29918,
14968,
29892,
343,
29918,
791,
353,
343,
29961,
14968,
29918,
13140,
1402,
343,
29961,
791,
29918,
13140,
29962,
13,
18884,
903,
353,
2094,
6119,
29889,
9202,
29918,
9067,
29898,
29990,
29918,
14968,
29892,
343,
29918,
14968,
29897,
13,
13,
18884,
396,
4327,
8845,
760,
322,
679,
599,
5181,
28730,
13,
18884,
659,
29918,
29873,
353,
2094,
6119,
29889,
9067,
29898,
29990,
29918,
791,
29897,
13,
18884,
659,
29918,
29873,
353,
659,
29918,
29873,
29961,
13,
462,
1678,
518,
1054,
363,
784,
297,
659,
29918,
29873,
29889,
13099,
565,
784,
451,
297,
1583,
29889,
1949,
29918,
22724,
29962,
13,
462,
1822,
5975,
13,
13,
18884,
565,
2094,
6119,
29918,
978,
451,
297,
1583,
29889,
3977,
397,
414,
29918,
8977,
29889,
8149,
7295,
13,
462,
1678,
28730,
29918,
276,
26081,
353,
7442,
29889,
3298,
359,
3552,
29990,
29889,
12181,
29961,
29900,
1402,
659,
29918,
29873,
29889,
12181,
29961,
29896,
12622,
13,
462,
1678,
1583,
29889,
3977,
397,
414,
29918,
8977,
29961,
3977,
6119,
29918,
978,
29962,
353,
518,
3977,
6119,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
1583,
29889,
3977,
397,
414,
29918,
8977,
29961,
3977,
6119,
29918,
978,
1822,
4397,
29898,
3977,
6119,
29897,
13,
13,
18884,
28730,
29918,
276,
26081,
29961,
791,
29918,
13140,
29892,
584,
29962,
4619,
659,
29918,
29873,
847,
1583,
29889,
29876,
29918,
276,
412,
1446,
13,
13,
9651,
28730,
29918,
276,
26081,
353,
10518,
29889,
17271,
29898,
22724,
29918,
276,
26081,
29897,
13,
9651,
28730,
29918,
276,
26081,
29889,
13099,
353,
518,
13,
18884,
285,
29908,
26716,
648,
3977,
6119,
29918,
978,
3227,
29875,
5038,
13,
18884,
363,
474,
297,
3464,
29898,
22724,
29918,
276,
26081,
29889,
12181,
29961,
29896,
2314,
13,
9651,
4514,
13,
9651,
1583,
29889,
12925,
29889,
4397,
29898,
22724,
29918,
276,
26081,
29897,
13,
13,
4706,
363,
4489,
297,
1583,
29889,
12925,
29901,
13,
9651,
1060,
353,
10518,
29889,
17685,
4197,
29990,
29892,
4489,
1402,
9685,
29922,
29896,
29897,
13,
13,
4706,
1060,
29889,
8865,
29898,
1311,
29889,
22724,
29892,
9685,
29922,
29896,
29892,
297,
6689,
29922,
5574,
29897,
13,
4706,
736,
1060,
13,
13,
1678,
822,
4327,
29898,
1311,
29892,
1060,
29901,
10518,
29889,
17271,
29897,
1599,
10518,
29889,
17271,
29901,
13,
4706,
1583,
29889,
12925,
353,
5159,
13,
4706,
363,
2094,
6119,
29918,
978,
297,
1583,
29889,
3977,
397,
414,
29918,
7039,
29918,
23583,
29901,
13,
9651,
28730,
29918,
276,
26081,
353,
6213,
13,
13,
9651,
363,
2094,
6119,
297,
1583,
29889,
3977,
397,
414,
29918,
8977,
29961,
3977,
6119,
29918,
978,
5387,
13,
18884,
1243,
29918,
509,
353,
2094,
6119,
29889,
9067,
29898,
29990,
29897,
13,
18884,
1243,
29918,
509,
353,
1243,
29918,
509,
29961,
13,
462,
1678,
518,
1054,
363,
784,
297,
1243,
29918,
509,
29889,
13099,
565,
784,
451,
297,
1583,
29889,
1949,
29918,
22724,
29962,
13,
462,
1822,
5975,
13,
13,
18884,
565,
28730,
29918,
276,
26081,
338,
6213,
29901,
13,
462,
1678,
28730,
29918,
276,
26081,
353,
7442,
29889,
3298,
359,
29898,
1688,
29918,
509,
29889,
12181,
29897,
13,
13,
18884,
28730,
29918,
276,
26081,
353,
313,
13,
462,
1678,
28730,
29918,
276,
26081,
718,
1243,
29918,
509,
847,
1583,
29889,
29876,
29918,
29888,
3361,
847,
1583,
29889,
29876,
29918,
276,
412,
1446,
13,
18884,
1723,
13,
13,
9651,
28730,
29918,
276,
26081,
353,
10518,
29889,
17271,
29898,
22724,
29918,
276,
26081,
29897,
13,
9651,
28730,
29918,
276,
26081,
29889,
13099,
353,
518,
13,
18884,
285,
29908,
26716,
648,
3977,
6119,
29918,
978,
3227,
29875,
5038,
13,
18884,
363,
474,
297,
3464,
29898,
22724,
29918,
276,
26081,
29889,
12181,
29961,
29896,
2314,
13,
9651,
4514,
13,
9651,
1583,
29889,
12925,
29889,
4397,
29898,
22724,
29918,
276,
26081,
29897,
13,
13,
4706,
363,
4489,
297,
1583,
29889,
12925,
29901,
13,
9651,
1060,
353,
10518,
29889,
17685,
4197,
29990,
29892,
4489,
1402,
9685,
29922,
29896,
29897,
13,
13,
4706,
1060,
29889,
8865,
29898,
1311,
29889,
22724,
29892,
9685,
29922,
29896,
29892,
297,
6689,
29922,
5574,
29897,
13,
4706,
736,
1060,
13,
13,
13,
1990,
26905,
8566,
6119,
29901,
13,
1678,
9995,
13,
1678,
26905,
2094,
6119,
363,
11608,
936,
4341,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
28730,
29901,
2391,
29961,
710,
1402,
2094,
397,
414,
29918,
7039,
29918,
23583,
29922,
580,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
28730,
29901,
2391,
310,
11608,
936,
4341,
13,
4706,
584,
3207,
2094,
397,
414,
29918,
7039,
29918,
23583,
29901,
12603,
552,
310,
11608,
936,
2094,
397,
414,
2983,
29889,
20049,
1819,
297,
18761,
526,
29901,
13,
4706,
376,
23923,
23860,
8566,
6119,
613,
376,
29956,
29949,
29923,
8566,
6119,
613,
376,
8667,
8566,
6119,
613,
376,
11139,
8566,
6119,
613,
376,
2303,
303,
6490,
8566,
6119,
613,
376,
3226,
1351,
6716,
3744,
8566,
6119,
613,
13,
4706,
376,
7658,
29885,
814,
8566,
6119,
613,
376,
5841,
1328,
29928,
17678,
8566,
6119,
613,
376,
29470,
7789,
262,
8566,
6119,
613,
376,
23302,
979,
8566,
6119,
15945,
9694,
8431,
520,
8566,
6119,
29908,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
22724,
353,
28730,
13,
4706,
1583,
29889,
1949,
29918,
22724,
353,
6213,
13,
4706,
1583,
29889,
3977,
397,
414,
29918,
7039,
29918,
23583,
353,
2094,
397,
414,
29918,
7039,
29918,
23583,
13,
4706,
1583,
29889,
3977,
397,
414,
29918,
8977,
353,
6571,
13,
13,
4706,
396,
1051,
363,
15446,
2582,
310,
13852,
515,
1269,
2094,
6119,
13,
4706,
1583,
29889,
12925,
353,
6213,
13,
13,
1678,
822,
6216,
29918,
9067,
29898,
1311,
29892,
1060,
29901,
10518,
29889,
17271,
29892,
343,
29901,
7442,
29889,
2378,
29897,
1599,
10518,
29889,
17271,
29901,
13,
4706,
1583,
29889,
1949,
29918,
22724,
353,
518,
1054,
363,
784,
297,
1060,
29889,
13099,
565,
784,
451,
297,
1583,
29889,
22724,
29962,
13,
4706,
1583,
29889,
12925,
353,
5159,
13,
4706,
363,
2094,
6119,
29918,
978,
297,
1583,
29889,
3977,
397,
414,
29918,
7039,
29918,
23583,
29901,
13,
9651,
2094,
6119,
353,
679,
29918,
14369,
29918,
3977,
6119,
29898,
3977,
6119,
29918,
978,
29922,
3977,
6119,
29918,
978,
29892,
6635,
29918,
22724,
29922,
1311,
29889,
22724,
29897,
13,
13,
9651,
28730,
29918,
276,
26081,
353,
2094,
6119,
29889,
9202,
29918,
9067,
29898,
29990,
29892,
343,
29897,
13,
9651,
1583,
29889,
3977,
397,
414,
29918,
8977,
29961,
3977,
6119,
29918,
978,
29962,
353,
2094,
6119,
13,
9651,
28730,
29918,
276,
26081,
353,
28730,
29918,
276,
26081,
29961,
13,
18884,
518,
1054,
363,
784,
297,
28730,
29918,
276,
26081,
29889,
13099,
565,
784,
451,
297,
1583,
29889,
1949,
29918,
22724,
29962,
13,
632,
1822,
5975,
13,
9651,
28730,
29918,
276,
26081,
353,
10518,
29889,
17271,
29898,
22724,
29918,
276,
26081,
29897,
13,
9651,
28730,
29918,
276,
26081,
29889,
13099,
353,
518,
13,
18884,
285,
29908,
26716,
648,
3977,
6119,
29918,
978,
3227,
29875,
5038,
13,
18884,
363,
474,
297,
3464,
29898,
22724,
29918,
276,
26081,
29889,
12181,
29961,
29896,
2314,
13,
9651,
4514,
13,
9651,
1583,
29889,
12925,
29889,
4397,
29898,
22724,
29918,
276,
26081,
29897,
13,
13,
4706,
396,
3022,
271,
6635,
28730,
22540,
411,
2847,
12205,
13,
4706,
363,
4489,
297,
1583,
29889,
12925,
29901,
13,
9651,
1060,
353,
10518,
29889,
17685,
4197,
29990,
29892,
4489,
1402,
9685,
29922,
29896,
29897,
13,
13,
4706,
396,
3349,
599,
4341,
408,
2215,
408,
591,
505,
1009,
22540,
13,
4706,
1060,
29889,
8865,
29898,
1311,
29889,
22724,
29892,
9685,
29922,
29896,
29892,
297,
6689,
29922,
5574,
29897,
13,
4706,
736,
1060,
13,
13,
1678,
822,
4327,
29898,
1311,
29892,
1060,
29897,
1599,
10518,
29889,
17271,
29901,
13,
4706,
1583,
29889,
12925,
353,
5159,
13,
4706,
363,
2094,
6119,
29918,
978,
297,
1583,
29889,
3977,
397,
414,
29918,
7039,
29918,
23583,
29901,
13,
9651,
396,
679,
8954,
310,
6635,
4341,
322,
883,
263,
10518,
29889,
17271,
363,
372,
13,
9651,
28730,
29918,
276,
26081,
353,
1583,
29889,
3977,
397,
414,
29918,
8977,
29961,
3977,
6119,
29918,
978,
1822,
9067,
29898,
29990,
29897,
13,
9651,
28730,
29918,
276,
26081,
353,
28730,
29918,
276,
26081,
29961,
13,
18884,
518,
1054,
363,
784,
297,
28730,
29918,
276,
26081,
29889,
13099,
565,
784,
451,
297,
1583,
29889,
1949,
29918,
22724,
29962,
13,
632,
1822,
5975,
13,
9651,
28730,
29918,
276,
26081,
353,
10518,
29889,
17271,
29898,
22724,
29918,
276,
26081,
29897,
13,
9651,
28730,
29918,
276,
26081,
29889,
13099,
353,
518,
13,
18884,
285,
29908,
26716,
648,
3977,
6119,
29918,
978,
3227,
29875,
5038,
13,
18884,
363,
474,
297,
3464,
29898,
22724,
29918,
276,
26081,
29889,
12181,
29961,
29896,
2314,
13,
9651,
4514,
13,
9651,
1583,
29889,
12925,
29889,
4397,
29898,
22724,
29918,
276,
26081,
29897,
13,
13,
4706,
396,
3022,
271,
6635,
28730,
22540,
411,
2847,
12205,
13,
4706,
363,
4489,
297,
1583,
29889,
12925,
29901,
13,
9651,
1060,
353,
10518,
29889,
17685,
4197,
29990,
29892,
4489,
1402,
9685,
29922,
29896,
29897,
13,
13,
4706,
396,
3349,
599,
4341,
408,
2215,
408,
591,
505,
1009,
22540,
13,
4706,
1060,
29889,
8865,
29898,
1311,
29889,
22724,
29892,
9685,
29922,
29896,
29892,
297,
6689,
29922,
5574,
29897,
13,
4706,
736,
1060,
13,
13,
13,
1990,
3878,
23860,
8566,
6119,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
28730,
1125,
13,
4706,
1583,
29889,
22724,
353,
28730,
13,
4706,
1583,
29889,
2798,
29879,
29918,
8977,
353,
6213,
13,
13,
1678,
822,
6216,
29898,
1311,
29892,
1060,
29901,
10518,
29889,
17271,
29892,
343,
29922,
8516,
29897,
1599,
10518,
29889,
17271,
29901,
13,
4706,
18139,
29918,
8977,
353,
6571,
13,
4706,
363,
784,
297,
1583,
29889,
22724,
29901,
13,
9651,
1819,
29892,
18139,
353,
7442,
29889,
13092,
29898,
29990,
29961,
1054,
1402,
736,
29918,
2798,
29879,
29922,
5574,
29897,
13,
9651,
18139,
29918,
8977,
29961,
1054,
29962,
353,
9657,
29898,
7554,
29898,
5975,
29892,
18139,
876,
13,
4706,
1583,
29889,
2798,
29879,
29918,
8977,
353,
18139,
29918,
8977,
13,
13,
1678,
822,
4327,
29898,
1311,
29892,
1060,
29901,
10518,
29889,
17271,
29897,
1599,
10518,
29889,
17271,
29901,
13,
4706,
18139,
29918,
8977,
29918,
1688,
353,
6571,
13,
4706,
620,
353,
5159,
13,
4706,
363,
784,
297,
1583,
29889,
22724,
29901,
13,
9651,
1819,
29892,
18139,
353,
7442,
29889,
13092,
29898,
29990,
29961,
1054,
1402,
736,
29918,
2798,
29879,
29922,
5574,
29897,
13,
9651,
18139,
29918,
8977,
29918,
1688,
29961,
1054,
29962,
353,
9657,
29898,
7554,
29898,
5975,
29892,
18139,
876,
13,
13,
9651,
396,
565,
995,
338,
297,
376,
14968,
29908,
6611,
448,
5191,
376,
1688,
29908,
18139,
411,
376,
14968,
29908,
18139,
13,
9651,
363,
413,
297,
518,
13,
18884,
1820,
13,
18884,
363,
1820,
297,
18139,
29918,
8977,
29918,
1688,
29961,
1054,
1822,
8149,
580,
13,
18884,
565,
1820,
297,
1583,
29889,
2798,
29879,
29918,
8977,
29961,
1054,
1822,
8149,
580,
13,
9651,
4514,
29901,
13,
18884,
18139,
29918,
8977,
29918,
1688,
29961,
1054,
3816,
29895,
29962,
353,
1583,
29889,
2798,
29879,
29918,
8977,
29961,
1054,
3816,
29895,
29962,
13,
13,
9651,
620,
29889,
4397,
29898,
29990,
29961,
1054,
1822,
1958,
29898,
2798,
29879,
29918,
8977,
29918,
1688,
29961,
1054,
14664,
5975,
29889,
690,
14443,
6278,
29896,
29892,
29871,
29896,
876,
13,
4706,
620,
353,
7442,
29889,
29882,
1429,
29898,
690,
29897,
13,
13,
4706,
1060,
29961,
1311,
29889,
22724,
29962,
353,
620,
13,
4706,
736,
1060,
13,
13,
1678,
822,
6216,
29918,
9067,
29898,
1311,
29892,
1060,
29901,
10518,
29889,
17271,
29892,
343,
29922,
8516,
29897,
1599,
10518,
29889,
17271,
29901,
13,
4706,
1583,
29889,
9202,
29898,
29990,
29892,
343,
29897,
13,
4706,
1060,
353,
1583,
29889,
9067,
29898,
29990,
29897,
13,
4706,
736,
1060,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
4489,
353,
10518,
29889,
17271,
3319,
1800,
13,
1678,
4489,
3366,
4117,
29918,
1054,
3108,
353,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29962,
13,
1678,
4489,
3366,
5182,
3108,
353,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29962,
13,
13,
1678,
396,
13,
1678,
5694,
353,
4489,
29889,
8552,
580,
13,
1678,
2094,
353,
10459,
8431,
520,
8566,
6119,
29898,
22724,
29922,
3366,
4117,
29918,
1054,
20068,
13,
1678,
1596,
29898,
3977,
29889,
9202,
29918,
9067,
29898,
7382,
29892,
5694,
3366,
5182,
3108,
876,
13,
13,
1678,
396,
13,
1678,
5694,
353,
4489,
29889,
8552,
580,
13,
1678,
2094,
353,
26905,
8566,
6119,
29898,
22724,
29922,
3366,
4117,
29918,
1054,
12436,
2094,
397,
414,
29918,
7039,
29918,
23583,
29922,
703,
9694,
8431,
520,
8566,
6119,
613,
876,
13,
1678,
1596,
29898,
3977,
29889,
9202,
29918,
9067,
29898,
7382,
29892,
5694,
3366,
5182,
3108,
876,
13,
13,
1678,
396,
13,
1678,
5694,
353,
4489,
29889,
8552,
580,
13,
1678,
2094,
353,
11599,
19448,
8566,
6119,
29940,
4680,
936,
29898,
13,
4706,
28730,
29922,
3366,
4117,
29918,
1054,
12436,
2094,
397,
414,
29918,
7039,
29918,
23583,
29922,
703,
9694,
8431,
520,
8566,
6119,
613,
29897,
13,
1678,
1723,
13,
1678,
1596,
29898,
3977,
29889,
9202,
29918,
9067,
29898,
7382,
29892,
5694,
3366,
5182,
3108,
876,
13,
2
] |
python算法/5.6如何对由大小写字母组成的字符数组排序.py | RobinYaoWenbin/Python-CommonCode | 12 | 134334 | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 19:36:03 2020
@author: Administrator
"""
"""
有一个由大小写字母组成的字符串,请对它进行重新组合,使得其中的所有小写字母排在大写字母的前面
(大写字母或小写字母之间不要求保持原来的次序)
"""
def SortStr(s):
i = 0 ; j = len(s) - 1
while i < j:
if s[i].isupper():
pass
else:
i += 1
if s[j].islower():
pass
else:
j -= 1
if s[i].isupper() and s[j].islower():
if j < len(s) - 1:
s = s[0:i] + s[j] + s[i+1:j] + s[i] + s[j+1:]
else:
s = s[0:i] + s[j] + s[i+1:j] + s[i]
i+=1 ; j-=1
return s
if __name__ == "__main__":
s = "AbcDefa"
s = SortStr(s)
print("The string after sorting is : " , s) | [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
15945,
19451,
13,
20399,
373,
15050,
26319,
29871,
29896,
29906,
29871,
29896,
29929,
29901,
29941,
29953,
29901,
29900,
29941,
29871,
29906,
29900,
29906,
29900,
30004,
13,
30004,
13,
29992,
8921,
29901,
24510,
1061,
30004,
13,
15945,
19451,
13,
30004,
13,
15945,
19451,
13,
30417,
30287,
30502,
31272,
30257,
30446,
31479,
30578,
31763,
31263,
30494,
30210,
30578,
31277,
31767,
29892,
31088,
30783,
232,
177,
134,
31174,
30448,
30908,
30374,
31263,
30733,
29892,
30785,
31050,
31149,
30275,
30210,
30744,
30417,
30446,
31479,
30578,
31763,
233,
145,
149,
30505,
30257,
31479,
30578,
31763,
30210,
30658,
30806,
30004,
13,
29898,
30257,
31479,
30578,
31763,
31391,
30446,
31479,
30578,
31763,
30577,
31016,
30413,
30698,
31376,
30982,
31695,
30667,
30805,
30210,
30936,
31463,
8443,
13,
15945,
19451,
13,
30004,
13,
1753,
20025,
5015,
29898,
29879,
1125,
30004,
13,
1678,
474,
353,
29871,
29900,
2056,
432,
353,
7431,
29898,
29879,
29897,
448,
29871,
29896,
30004,
13,
1678,
1550,
474,
529,
432,
29901,
30004,
13,
4706,
565,
269,
29961,
29875,
1822,
275,
21064,
7295,
30004,
13,
9651,
1209,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
474,
4619,
29871,
29896,
30004,
13,
4706,
565,
269,
29961,
29926,
1822,
275,
13609,
7295,
30004,
13,
9651,
1209,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
432,
22361,
29871,
29896,
30004,
13,
4706,
565,
269,
29961,
29875,
1822,
275,
21064,
580,
322,
269,
29961,
29926,
1822,
275,
13609,
7295,
30004,
13,
9651,
565,
432,
529,
7431,
29898,
29879,
29897,
448,
29871,
29896,
29901,
30004,
13,
18884,
269,
353,
269,
29961,
29900,
29901,
29875,
29962,
718,
269,
29961,
29926,
29962,
718,
269,
29961,
29875,
29974,
29896,
29901,
29926,
29962,
718,
269,
29961,
29875,
29962,
718,
269,
29961,
29926,
29974,
29896,
17531,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
269,
353,
269,
29961,
29900,
29901,
29875,
29962,
718,
269,
29961,
29926,
29962,
718,
269,
29961,
29875,
29974,
29896,
29901,
29926,
29962,
718,
269,
29961,
29875,
29962,
30004,
13,
9651,
474,
23661,
29896,
2056,
432,
29899,
29922,
29896,
30004,
13,
1678,
736,
269,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
1678,
269,
353,
376,
4920,
29883,
3206,
29874,
19451,
13,
1678,
269,
353,
20025,
5015,
29898,
29879,
8443,
13,
1678,
1596,
703,
1576,
1347,
1156,
16548,
338,
584,
376,
1919,
269,
29897,
2
] |
transcendental-maps/program/processor.py | alexn11/complex-dynamics-progs | 3 | 155909 | #!/usr/bin/python
# todo: preview doesnt work
# TODO: new types: pixel (rgba)
# todo: legacy? e.g. compute image of points, computation illustration etc.
# todo: doesn't detect wrong number of args
# todo: set color
# todo: filled julia with the number of it
# todo: implement missing rect and arg and line complex
# todo: filled julia: nb it as output also
# todo: copy, useless?
# todo: lyapunov
# todo: implement arg_density + option set_smooth_argument
# todo: "rect_cdensity" : 7, # real src, double density, bool, bool, real, bool
# todo: "set_color" : 5,
# todo: "set_edge_thickness" : 1,
# todo: #"set_arg_shading" : 1,
# todo: "set_rect_shading" : 1,
# todo: "set_imaginary_part" : 1,
# todo: "draw_rect_edge" : 2,
# todo: "draw_rect_cross" : 2,
# todo: "draw_shade_arg" : 2,
# todo: implement load/save
from ezInputConf import convert_string_to_boolean
from ezInputConf import convert_string_to_string
# todo: this should be external
instruction_descriptors = {
# name : (arg types, var types)
"abs" : (
("variable", "variable"),
("complex", "real")),
"add_test_enter_disk" : (
("complex", "real"),
()),
"add_test_leave_annulus" : (
("complex", "real", "real"),
()),
"add_test_leave_disk" : (
("complex", "real"),
()),
"add_test_leave_left_half_plane" : (
("real", ),
()),
"add_test_leave_right_half_plane" : (
("real", ),
()),
"annulus_index" : (
("complex", "real", "real", "variable", "variable"),
("complex", "integer")),
"arg" : (
("complex", "variable", "variable"),
("complex", "real")),
"arg_density" : (
("variable", "variable"),
("real", "real")),
"boundaries" : (
("variable", "variable"),
("integer", "real")),
"cauliflower_julia" : ( # nit, pts, stop
("integer", "variable", "variable"),
("complex", "integer")),
"coord_rect" : (
("complex", "complex", "variable", "variable"),
("complex", "complex")),
"draw_complex_density" : (
("variable", "string"),
("complex", )),
"draw_density" : (
("variable", "string"),
("real", )),
"draw_indexes" : (
("variable", "string"),
("integer", ),
),
"draw_integers" : (
("variable", "string"),
("integer", )),
"draw_reals" : (
("variable", "string"),
("real", )),
"eval_main_map" : (
("variable", "variable"),
("complex", "complex")),
"exit" : (
("string", ),
()),
"is_in_annulus" : (
("complex", "real", "real", "variable", "variable"),
("complex", "integer")),
"is_in_disk" : (
("complex", "real", "variable", "variable"),
("complex", "integer")),
"is_in_filled_julia_set" : (
("integer", "real", "variable", "variable"),
("complex", "integer")),
"is_nan" : (
("variable", "variable"),
("complex", "integer")),
"is_where_wrt_annulus" : (
("complex", "real", "real", "variable", "variable"),
("complex", "integer")),
"iterate_main_map" : ( # z, z_n, n=nb_it, stop_value
("integer", "variable", "variable", "variable", "variable"),
("complex", "complex", "integer", "integer")),
"load_complexes" : (
("string", "variable"),
("complex", )),
"load_integers" : (
("string", "variable"),
("integer", )),
"load_reals" : (
("string", "variable"),
("real", )),
"make_grid" : (
("variable", ),
("complex", )),
"name" : (
("string", ),
()),
"nop" : (
(),
()),
"print_complexes" : (
("variable", ),
("complex", )),
"replace_nans" : (
("complex", "variable", "variable"),
("complex", "complex")),
"save_complexes" : (
("variable", "string"),
("complex", )),
"save_integers" : (
("variable", "string"),
("integer", )),
"save_reals" : (
("variable", "string"),
("real", )),
"reset_tests" : (
(),
()),
"set_critical_value" : (
("complex", ),
()),
"set_drawing_threshold" : (
("real", ),
()),
"set_drawing_type" : (
("string", ),
()),
"set_grid_tlbr" : (
("real", "real", "real", "real"),
()),
"set_grid_width" : (
("integer", ),
()),
"set_main_map_type" : (
("string", ),
()),
"set_number_of_indexes" : (
("integer", ),
()),
"set_number_of_iterations" : (
("integer", ),
()),
"set_preview_parameters" : (
("boolean", "integer", "integer", "real", "string", "string"),
()),
"set_shade_enhance_power" : (
("real", ),
()),
"set_shade_max" : (
("string", ),
()),
"set_shade_type" : (
("string", ),
()),
"set_smooth_argument" : (
("boolean",),
()),
"setup_fatou_inverse_data" : (
("complex", "real"),
()),
"setup_linearizer_data" : (
("integer", "complex", "real", "integer"),
()),
"show_help" : (
("string", ),
()),
}
# -----------------------------------------------------------------------------
instruction_number_args = {
name : len (instruction_descriptors [name] [0])
for name in instruction_descriptors }
variable_types_in_arguments = {
name : instruction_descriptors [name] [1]
for name in instruction_descriptors }
instruction_argument_types = {
name : instruction_descriptors [name] [0]
for name in instruction_descriptors }
def make_variable_positions_in_arguments (instruction_descriptors):
positions = {}
for instr_name in instruction_descriptors:
pos = []
args = instruction_descriptors [instr_name] [0]
for pos_id in range (len (args)):
if (args [pos_id] == "variable"):
pos . append (pos_id)
positions [instr_name] = tuple (pos)
return positions
variable_positions_in_arguments = (
make_variable_positions_in_arguments (instruction_descriptors))
def cat_dict (dict0, dict1):
return { ** dict0, ** dict1 }
class Processor:
def __init__ (self, program, external_variables):
self . program = program
self . split_program ()
self . cursor = 0
self . external_variables = external_variables
self . original_variables = {
"Results" : "complex",
"Iterations" : "integer", }
self . original_variable_names = (
list (self . original_variables . keys ()))
self . requested_variables = {}
#self . requested_variables_names = []
self . instructions = []
self . assemble ()
self . variables = cat_dict (self . original_variables,
self . requested_variables)
return
def assemble (self):
current_line = self . get_next_line ()
while (current_line != ""):
self . interpret_line (current_line)
current_line = self . get_next_line ()
return
def split_program (self):
prog_lines = self . program . splitlines ()
self . prog_lines = []
self . line_numbers = []
line_number = 0
for line in prog_lines:
line_number += 1
line = line . strip ()
if (line == ""):
continue
if (line [0] == "#"):
continue
comment_start = line . find ("#")
# NOTE: this forbid "#" in arguments
if (comment_start > 0):
line = line [:comment_start]
self . prog_lines . append (line)
self . line_numbers . append (line_number)
self . prog_len = len (self . prog_lines)
def get_next_line (self):
if (self . cursor == self . prog_len):
return ""
line = self . prog_lines [self . cursor]
self . cursor += 1
return line
def describe_position (self):
if (self . cursor == 0):
return "(nowhere)"
return "(@ " + str (self . line_numbers [self . cursor - 1]) + ")"
def add_requested_variables (self, arg_variables):
#print ("arg_variables="+str(arg_variables))
previous_variable_names = list (self . requested_variables . keys ())
for variable in arg_variables:
var_name = variable [0]
var_type = variable [1]
try:
expected_var_type = self . original_variables [var_name]
except (KeyError):
pass
else:
if (var_type == expected_var_type):
continue
else:
raise Exception (self . describe_position () + " Wrong var type")
try:
expected_var_type = self . requested_variables [var_name]
except (KeyError):
self . requested_variables [var_name] = var_type
else:
if (expected_var_type == "any"):
continue
elif (var_type != expected_var_type):
raise Exception (self . describe_position () + " Wrong var type")
return
def skip_spaces_in_line (self, cursor):
while ((cursor < len (self . instruction_text))
and (self . instruction_text [cursor] == " ")):
cursor += 1
return cursor
def find_end_of_argument_string (self, cursor):
line_len = len (self . instruction_text)
while (self . instruction_text [cursor] not in ['"']):
if (cursor == line_len - 1):
raise Exception ("Unended string "
+ self . describe_position ()
+ " in \""
+ self . instruction_text
+ "\"")
else:
if (self . instruction_text [cursor] == '\\'):
cursor += 2
if (cursor == line_len):
raise Exception ("Unended string "
+ self . describe_position ()
+ " in \""
+ self . instruction_text
+ "\"")
else:
cursor += 1
return cursor + 1
def find_argument_end (self, argument_start):
if (self . instruction_text [argument_start] == '"'):
argument_end = (
self . find_end_of_argument_string (argument_start + 1))
else:
c = argument_start
while ((c < len (self . instruction_text))
and (self . instruction_text [c] != ",")
and (self . instruction_text [c] != " ")):
c += 1
argument_end = c
return argument_end
def split_instuction_line (self):
raise Exception ("not here yet")
line = self . instruction_text
len_line = len (line)
next_space = line . find (" ")
if (next_space < 0):
first_word = line
arguments = []
else:
first_word = line [: next_space]
next_nonspace = self . skip_spaces_in_line (next_space)
if (next_nonspace == len_line):
arguments = []
else:
while (False):
#todo
pass
self . structured_line = [first_word] + arguments
def get_next_word (self):
cursor = self . instruction_cursor
line = self . instruction_text
len_line = len (line)
#print (cursor)
if (cursor == len_line):
return ""
word_start = cursor
#print ("line="+line)
#print ("start="+line [word_start:])
if (cursor == 0):
word_end = line . find (" ")
if (word_end < 0):
word_end = len_line
next_cursor = len_line
else:
next_cursor = self . skip_spaces_in_line (word_end)
else:
# NOTE: this restrict the use of coma only between arguments
# NOTE: that is forbid it in strings (=only file names)
# it's changing
#NOTE: no empty string allowed?
#if (line [word_start] != ","):
# raise Exception ("Missing coma in \""
# + line
# + "\" -> "
# + line [word_start :])
if (line [word_start] == ","):
word_start += 1
word_start = self . skip_spaces_in_line (word_start)
word_end = self . find_argument_end (word_start)
#print ("word_end="+str(word_end))
if (word_end == len_line):
next_cursor = len_line
else:
next_cursor = self . skip_spaces_in_line (word_end)
if ((next_cursor < len_line) and (line [next_cursor] != ",")):
raise Exception (self . describe_position ()
+ " Expected coma, had:"
+ line [word_end :]
+ " <- "
+ line)
if (next_cursor != len_line):
# note: line has been stripped of trailing spaces
# NOTE: no "," at the end of the line (will provocke an error)
while (line [next_cursor] == " "):
next_cursor += 1
word = line [word_start : word_end]
#print ("*** word="+word)
if (word == ""):
raise Exception (self . describe_position () + " Empty word: " + line)
self . instruction_cursor = next_cursor
return word
def get_instruction_and_arguments (self, line):
self . instruction_cursor = 0
self . instruction_text = line
instruction = self . get_next_word ()
nb_args = instruction_number_args [instruction]
arguments = nb_args * [""]
for arg_index in range (nb_args):
arguments [arg_index] = self . get_next_word ()
if (self . instruction_cursor != len (self . instruction_text)):
raise Exception (self . describe_position () + " Extra arguments: " + self . instruction_text)
return (instruction, arguments)
def determine_variable_type (self,
instruction,
variable_index):
var_type = variable_types_in_arguments [instruction] [variable_index]
if (var_type == "any"):
var_type = "any"
#raise Exception ("Could not determine type of variable")
return var_type
def convert_variable_id_to_full_variable_object (self,
argument,
instruction,
variable_index):
if (argument [0] == "$"):
argument = argument [1:]
type_char = argument [0]
var_type = self . determine_variable_type (instruction,
variable_index)
var_name = argument
return (var_name, var_type)
def get_instruction_variables (self, instruction_and_arguments):
(instruction, arguments) = instruction_and_arguments
variable_positions = variable_positions_in_arguments [instruction]
variables = []
for variable_index in range (len (variable_positions)):
position = variable_positions [variable_index]
variables . append (
self . convert_variable_id_to_full_variable_object (
arguments [position],
instruction,
variable_index))
return variables
def interpret_arguments (self,
instruction_and_arguments,
variables,
external_variables_dict):
instruction = instruction_and_arguments [0]
arguments = instruction_and_arguments [1]
argument_types = instruction_argument_types [instruction]
variable_index = 0
interpreted_arguments = []
for arg_type, arg in zip (argument_types, arguments):
if (arg [0] == "$"):
arg = external_variables_dict [arg [1:]]
if (arg_type == "boolean"):
interpreted_argument = (convert_string_to_boolean (arg))
elif (arg_type == "integer"):
interpreted_argument = (int (arg))
elif (arg_type == "real"):
interpreted_argument = (float (arg))
elif (arg_type == "complex"):
interpreted_argument = (complex (arg))
elif (arg_type == "string"):
interpreted_argument = (convert_string_to_string (arg))
elif (arg_type == "variable"):
interpreted_argument = (variables [variable_index])
variable_index += 1
else:
raise Exception (self . describe_position () + " Unknown argument type: " + str (arg_type))
interpreted_arguments . append (interpreted_argument)
return interpreted_arguments
def interpret_line (self, line):
instruction_and_arguments = self . get_instruction_and_arguments (line)
arg_variables = (
self . get_instruction_variables (instruction_and_arguments))
self . add_requested_variables (arg_variables)
instruction = instruction_and_arguments [0]
arguments = self . interpret_arguments (instruction_and_arguments,
arg_variables,
self . external_variables)
self . instructions . append ((instruction, arguments))
return
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
13,
13,
29937,
10481,
29901,
25267,
19403,
664,
13,
29937,
14402,
29901,
716,
4072,
29901,
15526,
313,
11007,
2291,
29897,
13,
29937,
10481,
29901,
25000,
29973,
321,
29889,
29887,
29889,
10272,
1967,
310,
3291,
29892,
16287,
8632,
362,
2992,
29889,
13,
29937,
10481,
29901,
1838,
29915,
29873,
6459,
2743,
1353,
310,
6389,
13,
29937,
10481,
29901,
731,
2927,
13,
29937,
10481,
29901,
10423,
5757,
423,
411,
278,
1353,
310,
372,
13,
29937,
10481,
29901,
2334,
4567,
7705,
322,
1852,
322,
1196,
4280,
13,
29937,
10481,
29901,
10423,
5757,
423,
29901,
302,
29890,
372,
408,
1962,
884,
13,
29937,
10481,
29901,
3509,
29892,
19315,
29973,
13,
29937,
10481,
29901,
21261,
481,
348,
586,
13,
29937,
10481,
29901,
2334,
1852,
29918,
21518,
537,
718,
2984,
731,
29918,
3844,
6983,
29918,
23516,
13,
29937,
10481,
29901,
376,
1621,
29918,
2252,
575,
537,
29908,
584,
29871,
29955,
29892,
396,
1855,
4765,
29892,
3765,
9027,
29892,
6120,
29892,
6120,
29892,
1855,
29892,
6120,
13,
29937,
10481,
29901,
376,
842,
29918,
2780,
29908,
584,
29871,
29945,
29892,
13,
29937,
10481,
29901,
376,
842,
29918,
12864,
29918,
27996,
2264,
29908,
584,
29871,
29896,
29892,
13,
29937,
10481,
29901,
396,
29908,
842,
29918,
1191,
29918,
845,
9382,
29908,
584,
29871,
29896,
29892,
13,
29937,
10481,
29901,
376,
842,
29918,
1621,
29918,
845,
9382,
29908,
584,
29871,
29896,
29892,
13,
29937,
10481,
29901,
376,
842,
29918,
326,
351,
3821,
29918,
1595,
29908,
584,
29871,
29896,
29892,
13,
29937,
10481,
29901,
376,
4012,
29918,
1621,
29918,
12864,
29908,
584,
29871,
29906,
29892,
13,
29937,
10481,
29901,
376,
4012,
29918,
1621,
29918,
19128,
29908,
584,
29871,
29906,
29892,
13,
29937,
10481,
29901,
376,
4012,
29918,
845,
1943,
29918,
1191,
29908,
584,
29871,
29906,
29892,
13,
29937,
10481,
29901,
29871,
2334,
2254,
29914,
7620,
13,
13,
13,
3166,
20803,
4290,
16376,
1053,
3588,
29918,
1807,
29918,
517,
29918,
20054,
13,
3166,
20803,
4290,
16376,
1053,
3588,
29918,
1807,
29918,
517,
29918,
1807,
13,
13,
29937,
10481,
29901,
445,
881,
367,
7029,
13,
2611,
4080,
29918,
2783,
924,
943,
353,
426,
13,
1678,
396,
1024,
584,
313,
1191,
4072,
29892,
722,
4072,
29897,
13,
1678,
376,
6897,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
6370,
1159,
511,
13,
1678,
376,
1202,
29918,
1688,
29918,
5893,
29918,
20960,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
4968,
13,
4706,
3861,
511,
13,
1678,
376,
1202,
29918,
1688,
29918,
280,
1351,
29918,
812,
14999,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
613,
376,
6370,
4968,
13,
4706,
3861,
511,
13,
1678,
376,
1202,
29918,
1688,
29918,
280,
1351,
29918,
20960,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
4968,
13,
4706,
3861,
511,
13,
1678,
376,
1202,
29918,
1688,
29918,
280,
1351,
29918,
1563,
29918,
24498,
29918,
22116,
29908,
584,
313,
13,
4706,
4852,
6370,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
1202,
29918,
1688,
29918,
280,
1351,
29918,
1266,
29918,
24498,
29918,
22116,
29908,
584,
313,
13,
4706,
4852,
6370,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
812,
14999,
29918,
2248,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
613,
376,
6370,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
16031,
1159,
511,
13,
1678,
376,
1191,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
6370,
1159,
511,
13,
1678,
376,
1191,
29918,
21518,
537,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
6370,
613,
376,
6370,
1159,
511,
13,
1678,
376,
9917,
4314,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
16031,
613,
376,
6370,
1159,
511,
13,
1678,
376,
1113,
352,
361,
13609,
29918,
29926,
352,
423,
29908,
584,
313,
396,
21767,
29892,
282,
1372,
29892,
5040,
13,
4706,
4852,
16031,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
16031,
1159,
511,
13,
1678,
376,
1111,
536,
29918,
1621,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
19676,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
19676,
1159,
511,
13,
1678,
376,
4012,
29918,
19676,
29918,
21518,
537,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
19676,
613,
1723,
511,
13,
1678,
376,
4012,
29918,
21518,
537,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
6370,
613,
1723,
511,
13,
1678,
376,
4012,
29918,
2248,
267,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
16031,
613,
10353,
13,
4706,
10353,
13,
1678,
376,
4012,
29918,
6693,
5743,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
16031,
613,
1723,
511,
13,
1678,
376,
4012,
29918,
276,
1338,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
6370,
613,
1723,
511,
13,
1678,
376,
14513,
29918,
3396,
29918,
1958,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
19676,
1159,
511,
13,
1678,
376,
13322,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
275,
29918,
262,
29918,
812,
14999,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
613,
376,
6370,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
16031,
1159,
511,
13,
1678,
376,
275,
29918,
262,
29918,
20960,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
16031,
1159,
511,
13,
1678,
376,
275,
29918,
262,
29918,
26940,
29918,
29926,
352,
423,
29918,
842,
29908,
584,
313,
13,
4706,
4852,
16031,
613,
376,
6370,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
16031,
1159,
511,
13,
1678,
376,
275,
29918,
13707,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
16031,
1159,
511,
13,
1678,
376,
275,
29918,
3062,
29918,
29893,
2273,
29918,
812,
14999,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
613,
376,
6370,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
16031,
1159,
511,
13,
1678,
376,
1524,
403,
29918,
3396,
29918,
1958,
29908,
584,
313,
396,
503,
29892,
503,
29918,
29876,
29892,
302,
29922,
9877,
29918,
277,
29892,
5040,
29918,
1767,
13,
4706,
4852,
16031,
613,
376,
11918,
613,
376,
11918,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
19676,
613,
376,
16031,
613,
376,
16031,
1159,
511,
13,
1678,
376,
1359,
29918,
5729,
9100,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
1723,
511,
13,
1678,
376,
1359,
29918,
6693,
5743,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
376,
11918,
4968,
13,
4706,
4852,
16031,
613,
1723,
511,
13,
1678,
376,
1359,
29918,
276,
1338,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
376,
11918,
4968,
13,
4706,
4852,
6370,
613,
1723,
511,
13,
1678,
376,
5675,
29918,
7720,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
10353,
13,
4706,
4852,
19676,
613,
1723,
511,
13,
1678,
376,
978,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
29876,
459,
29908,
584,
313,
13,
4706,
313,
511,
13,
4706,
3861,
511,
13,
1678,
376,
2158,
29918,
5729,
9100,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
10353,
13,
4706,
4852,
19676,
613,
1723,
511,
13,
1678,
376,
6506,
29918,
29876,
550,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
11918,
613,
376,
11918,
4968,
13,
4706,
4852,
19676,
613,
376,
19676,
1159,
511,
13,
1678,
376,
7620,
29918,
5729,
9100,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
19676,
613,
1723,
511,
13,
1678,
376,
7620,
29918,
6693,
5743,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
16031,
613,
1723,
511,
13,
1678,
376,
7620,
29918,
276,
1338,
29908,
584,
313,
13,
4706,
4852,
11918,
613,
376,
1807,
4968,
13,
4706,
4852,
6370,
613,
1723,
511,
13,
1678,
376,
12071,
29918,
21150,
29908,
584,
313,
13,
4706,
313,
511,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
9695,
936,
29918,
1767,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
4012,
292,
29918,
386,
12268,
29908,
584,
313,
13,
4706,
4852,
6370,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
4012,
292,
29918,
1853,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
7720,
29918,
15206,
1182,
29908,
584,
313,
13,
4706,
4852,
6370,
613,
376,
6370,
613,
376,
6370,
613,
376,
6370,
4968,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
7720,
29918,
2103,
29908,
584,
313,
13,
4706,
4852,
16031,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
3396,
29918,
1958,
29918,
1853,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
4537,
29918,
974,
29918,
2248,
267,
29908,
584,
313,
13,
4706,
4852,
16031,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
4537,
29918,
974,
29918,
1524,
800,
29908,
584,
313,
13,
4706,
4852,
16031,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
25347,
29918,
16744,
29908,
584,
313,
13,
4706,
4852,
20054,
613,
376,
16031,
613,
376,
16031,
613,
376,
6370,
613,
376,
1807,
613,
376,
1807,
4968,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
845,
1943,
29918,
264,
29882,
749,
29918,
13519,
29908,
584,
313,
13,
4706,
4852,
6370,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
845,
1943,
29918,
3317,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
845,
1943,
29918,
1853,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
376,
842,
29918,
3844,
6983,
29918,
23516,
29908,
584,
313,
13,
4706,
4852,
20054,
613,
511,
13,
4706,
3861,
511,
13,
1678,
376,
14669,
29918,
29888,
271,
283,
29918,
262,
3901,
29918,
1272,
29908,
584,
313,
13,
4706,
4852,
19676,
613,
376,
6370,
4968,
13,
4706,
3861,
511,
13,
1678,
376,
14669,
29918,
10660,
3950,
29918,
1272,
29908,
584,
313,
13,
4706,
4852,
16031,
613,
376,
19676,
613,
376,
6370,
613,
376,
16031,
4968,
13,
4706,
3861,
511,
13,
1678,
376,
4294,
29918,
8477,
29908,
584,
313,
13,
4706,
4852,
1807,
613,
10353,
13,
4706,
3861,
511,
13,
1678,
500,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
9072,
13,
13,
2611,
4080,
29918,
4537,
29918,
5085,
353,
426,
13,
1678,
1024,
584,
7431,
313,
2611,
4080,
29918,
2783,
924,
943,
518,
978,
29962,
518,
29900,
2314,
13,
1678,
363,
1024,
297,
15278,
29918,
2783,
924,
943,
500,
13,
13,
13,
11918,
29918,
8768,
29918,
262,
29918,
25699,
353,
426,
13,
1678,
1024,
584,
15278,
29918,
2783,
924,
943,
518,
978,
29962,
518,
29896,
29962,
13,
1678,
363,
1024,
297,
15278,
29918,
2783,
924,
943,
500,
13,
13,
2611,
4080,
29918,
23516,
29918,
8768,
353,
426,
13,
1678,
1024,
584,
15278,
29918,
2783,
924,
943,
518,
978,
29962,
518,
29900,
29962,
13,
1678,
363,
1024,
297,
15278,
29918,
2783,
924,
943,
500,
13,
268,
13,
13,
1753,
1207,
29918,
11918,
29918,
1066,
2187,
29918,
262,
29918,
25699,
313,
2611,
4080,
29918,
2783,
924,
943,
1125,
13,
1678,
11909,
353,
6571,
13,
1678,
363,
297,
710,
29918,
978,
297,
15278,
29918,
2783,
924,
943,
29901,
13,
4706,
926,
353,
5159,
13,
4706,
6389,
353,
15278,
29918,
2783,
924,
943,
518,
262,
710,
29918,
978,
29962,
518,
29900,
29962,
13,
4706,
363,
926,
29918,
333,
297,
3464,
313,
2435,
313,
5085,
22164,
13,
9651,
565,
313,
5085,
518,
1066,
29918,
333,
29962,
1275,
376,
11918,
29908,
1125,
13,
18884,
926,
869,
9773,
313,
1066,
29918,
333,
29897,
13,
4706,
11909,
518,
262,
710,
29918,
978,
29962,
353,
18761,
313,
1066,
29897,
13,
1678,
736,
11909,
13,
13,
11918,
29918,
1066,
2187,
29918,
262,
29918,
25699,
353,
313,
13,
1678,
1207,
29918,
11918,
29918,
1066,
2187,
29918,
262,
29918,
25699,
313,
2611,
4080,
29918,
2783,
924,
943,
876,
13,
13,
13,
1753,
6635,
29918,
8977,
313,
8977,
29900,
29892,
9657,
29896,
1125,
13,
1678,
736,
426,
3579,
9657,
29900,
29892,
3579,
9657,
29896,
500,
13,
13,
13,
1990,
10554,
272,
29901,
13,
13,
1678,
822,
4770,
2344,
1649,
313,
1311,
29892,
1824,
29892,
7029,
29918,
20897,
1125,
13,
4706,
1583,
869,
1824,
353,
1824,
13,
4706,
1583,
869,
6219,
29918,
8860,
3861,
13,
4706,
1583,
869,
10677,
353,
29871,
29900,
13,
4706,
1583,
869,
7029,
29918,
20897,
353,
7029,
29918,
20897,
13,
4706,
1583,
869,
2441,
29918,
20897,
353,
426,
13,
9651,
376,
12191,
29908,
584,
376,
19676,
613,
13,
9651,
376,
13463,
800,
29908,
584,
376,
16031,
613,
500,
13,
4706,
1583,
869,
2441,
29918,
11918,
29918,
7039,
353,
313,
13,
9651,
1051,
313,
1311,
869,
2441,
29918,
20897,
869,
6611,
313,
4961,
13,
4706,
1583,
869,
13877,
29918,
20897,
353,
6571,
13,
4706,
396,
1311,
869,
13877,
29918,
20897,
29918,
7039,
353,
5159,
13,
4706,
1583,
869,
11994,
353,
5159,
13,
4706,
1583,
869,
24940,
3861,
13,
4706,
1583,
869,
3651,
353,
6635,
29918,
8977,
313,
1311,
869,
2441,
29918,
20897,
29892,
13,
462,
462,
268,
1583,
869,
13877,
29918,
20897,
29897,
13,
4706,
736,
13,
13,
1678,
822,
24940,
313,
1311,
1125,
13,
4706,
1857,
29918,
1220,
353,
1583,
869,
679,
29918,
4622,
29918,
1220,
3861,
13,
4706,
1550,
313,
3784,
29918,
1220,
2804,
5124,
1125,
13,
9651,
1583,
869,
6613,
29918,
1220,
313,
3784,
29918,
1220,
29897,
13,
9651,
1857,
29918,
1220,
353,
1583,
869,
679,
29918,
4622,
29918,
1220,
3861,
13,
4706,
736,
13,
13,
1678,
822,
6219,
29918,
8860,
313,
1311,
1125,
13,
4706,
410,
29887,
29918,
9012,
353,
1583,
869,
1824,
869,
6219,
9012,
3861,
13,
4706,
1583,
869,
410,
29887,
29918,
9012,
353,
5159,
13,
4706,
1583,
869,
1196,
29918,
20326,
353,
5159,
13,
4706,
1196,
29918,
4537,
353,
29871,
29900,
13,
4706,
363,
1196,
297,
410,
29887,
29918,
9012,
29901,
13,
9651,
1196,
29918,
4537,
4619,
29871,
29896,
13,
9651,
1196,
353,
1196,
869,
17820,
3861,
13,
9651,
565,
313,
1220,
1275,
5124,
1125,
13,
18884,
6773,
13,
9651,
565,
313,
1220,
518,
29900,
29962,
1275,
12305,
29908,
1125,
13,
18884,
6773,
13,
9651,
3440,
29918,
2962,
353,
1196,
869,
1284,
4852,
29937,
1159,
13,
9651,
396,
6058,
29923,
29901,
445,
19752,
333,
12305,
29908,
297,
6273,
13,
9651,
565,
313,
9342,
29918,
2962,
1405,
29871,
29900,
1125,
13,
18884,
1196,
353,
1196,
20840,
9342,
29918,
2962,
29962,
13,
9651,
1583,
869,
410,
29887,
29918,
9012,
869,
9773,
313,
1220,
29897,
13,
9651,
1583,
869,
1196,
29918,
20326,
869,
9773,
313,
1220,
29918,
4537,
29897,
13,
4706,
1583,
869,
410,
29887,
29918,
2435,
353,
7431,
313,
1311,
869,
410,
29887,
29918,
9012,
29897,
13,
13,
308,
13,
13,
1678,
822,
679,
29918,
4622,
29918,
1220,
313,
1311,
1125,
13,
4706,
565,
313,
1311,
869,
10677,
1275,
1583,
869,
410,
29887,
29918,
2435,
1125,
13,
9651,
736,
5124,
13,
4706,
1196,
353,
1583,
869,
410,
29887,
29918,
9012,
518,
1311,
869,
10677,
29962,
13,
4706,
1583,
869,
10677,
4619,
29871,
29896,
13,
4706,
736,
1196,
13,
13,
13,
1678,
822,
8453,
29918,
3283,
313,
1311,
1125,
13,
418,
565,
313,
1311,
869,
10677,
1275,
29871,
29900,
1125,
13,
4706,
736,
18227,
3707,
4150,
5513,
13,
418,
736,
376,
10394,
376,
718,
851,
313,
1311,
869,
1196,
29918,
20326,
518,
1311,
869,
10677,
448,
29871,
29896,
2314,
718,
376,
5513,
13,
308,
13,
13,
1678,
822,
788,
29918,
3827,
287,
29918,
20897,
313,
1311,
29892,
1852,
29918,
20897,
1125,
13,
4706,
396,
2158,
4852,
1191,
29918,
20897,
543,
29974,
710,
29898,
1191,
29918,
20897,
876,
13,
4706,
3517,
29918,
11918,
29918,
7039,
353,
1051,
313,
1311,
869,
13877,
29918,
20897,
869,
6611,
313,
876,
13,
4706,
363,
2286,
297,
1852,
29918,
20897,
29901,
13,
9651,
722,
29918,
978,
353,
2286,
518,
29900,
29962,
13,
9651,
722,
29918,
1853,
353,
2286,
518,
29896,
29962,
13,
9651,
1018,
29901,
13,
18884,
3806,
29918,
1707,
29918,
1853,
353,
1583,
869,
2441,
29918,
20897,
518,
1707,
29918,
978,
29962,
13,
9651,
5174,
313,
2558,
2392,
1125,
13,
18884,
1209,
13,
9651,
1683,
29901,
13,
18884,
565,
313,
1707,
29918,
1853,
1275,
3806,
29918,
1707,
29918,
1853,
1125,
13,
462,
1678,
6773,
13,
18884,
1683,
29901,
13,
462,
1678,
12020,
8960,
313,
1311,
869,
8453,
29918,
3283,
3861,
718,
376,
399,
29373,
722,
1134,
1159,
13,
9651,
1018,
29901,
13,
18884,
3806,
29918,
1707,
29918,
1853,
353,
1583,
869,
13877,
29918,
20897,
518,
1707,
29918,
978,
29962,
13,
9651,
5174,
313,
2558,
2392,
1125,
13,
18884,
1583,
869,
13877,
29918,
20897,
518,
1707,
29918,
978,
29962,
353,
722,
29918,
1853,
13,
9651,
1683,
29901,
13,
18884,
565,
313,
9684,
29918,
1707,
29918,
1853,
1275,
376,
1384,
29908,
1125,
13,
462,
1678,
6773,
13,
18884,
25342,
313,
1707,
29918,
1853,
2804,
3806,
29918,
1707,
29918,
1853,
1125,
13,
462,
1678,
12020,
8960,
313,
1311,
869,
8453,
29918,
3283,
3861,
718,
376,
399,
29373,
722,
1134,
1159,
13,
13,
4706,
736,
13,
13,
13,
1678,
822,
14383,
29918,
22854,
29918,
262,
29918,
1220,
313,
1311,
29892,
10677,
1125,
13,
4706,
1550,
5135,
18127,
529,
7431,
313,
1311,
869,
15278,
29918,
726,
876,
13,
1669,
322,
313,
1311,
869,
15278,
29918,
726,
518,
18127,
29962,
1275,
376,
376,
22164,
13,
9651,
10677,
4619,
29871,
29896,
13,
4706,
736,
10677,
13,
13,
1678,
822,
1284,
29918,
355,
29918,
974,
29918,
23516,
29918,
1807,
313,
1311,
29892,
10677,
1125,
13,
4706,
1196,
29918,
2435,
353,
7431,
313,
1311,
869,
15278,
29918,
726,
29897,
13,
4706,
1550,
313,
1311,
869,
15278,
29918,
726,
518,
18127,
29962,
451,
297,
6024,
29908,
2033,
1125,
13,
9651,
565,
313,
18127,
1275,
1196,
29918,
2435,
448,
29871,
29896,
1125,
13,
18884,
12020,
8960,
4852,
2525,
2760,
1347,
376,
13,
462,
462,
718,
1583,
869,
8453,
29918,
3283,
3861,
13,
462,
462,
718,
376,
297,
13218,
29908,
13,
462,
462,
718,
1583,
869,
15278,
29918,
726,
13,
462,
462,
718,
376,
5931,
1159,
13,
9651,
1683,
29901,
13,
18884,
565,
313,
1311,
869,
15278,
29918,
726,
518,
18127,
29962,
1275,
525,
1966,
29374,
13,
462,
1678,
10677,
4619,
29871,
29906,
13,
462,
1678,
565,
313,
18127,
1275,
1196,
29918,
2435,
1125,
13,
462,
4706,
12020,
8960,
4852,
2525,
2760,
1347,
376,
13,
462,
462,
308,
718,
1583,
869,
8453,
29918,
3283,
3861,
13,
462,
462,
308,
718,
376,
297,
13218,
29908,
13,
462,
462,
308,
718,
1583,
869,
15278,
29918,
726,
13,
462,
462,
308,
718,
376,
5931,
1159,
13,
18884,
1683,
29901,
13,
462,
1678,
10677,
4619,
29871,
29896,
13,
4706,
736,
10677,
718,
29871,
29896,
13,
462,
268,
13,
1678,
822,
1284,
29918,
23516,
29918,
355,
313,
1311,
29892,
2980,
29918,
2962,
1125,
13,
4706,
565,
313,
1311,
869,
15278,
29918,
726,
518,
23516,
29918,
2962,
29962,
1275,
18793,
29374,
13,
9651,
2980,
29918,
355,
353,
313,
13,
18884,
1583,
869,
1284,
29918,
355,
29918,
974,
29918,
23516,
29918,
1807,
313,
23516,
29918,
2962,
718,
29871,
29896,
876,
13,
4706,
1683,
29901,
13,
9651,
274,
353,
2980,
29918,
2962,
13,
9651,
1550,
5135,
29883,
529,
7431,
313,
1311,
869,
15278,
29918,
726,
876,
13,
462,
259,
322,
313,
1311,
869,
15278,
29918,
726,
518,
29883,
29962,
2804,
9162,
1159,
13,
462,
259,
322,
313,
1311,
869,
15278,
29918,
726,
518,
29883,
29962,
2804,
376,
376,
22164,
13,
18884,
274,
4619,
29871,
29896,
13,
9651,
2980,
29918,
355,
353,
274,
13,
4706,
736,
2980,
29918,
355,
13,
13,
1678,
822,
6219,
29918,
2611,
29884,
428,
29918,
1220,
313,
1311,
1125,
13,
4706,
12020,
8960,
4852,
1333,
1244,
3447,
1159,
13,
4706,
1196,
353,
1583,
869,
15278,
29918,
726,
13,
4706,
7431,
29918,
1220,
353,
7431,
313,
1220,
29897,
13,
4706,
2446,
29918,
3493,
353,
1196,
869,
1284,
4852,
16521,
13,
4706,
565,
313,
4622,
29918,
3493,
529,
29871,
29900,
1125,
13,
9651,
937,
29918,
1742,
353,
1196,
13,
9651,
6273,
353,
5159,
13,
4706,
1683,
29901,
13,
9651,
937,
29918,
1742,
353,
1196,
20840,
2446,
29918,
3493,
29962,
13,
9651,
2446,
29918,
29876,
787,
3535,
353,
1583,
869,
14383,
29918,
22854,
29918,
262,
29918,
1220,
313,
4622,
29918,
3493,
29897,
13,
9651,
565,
313,
4622,
29918,
29876,
787,
3535,
1275,
7431,
29918,
1220,
1125,
13,
18884,
6273,
353,
5159,
13,
9651,
1683,
29901,
13,
18884,
1550,
313,
8824,
1125,
13,
462,
1678,
396,
29873,
8144,
13,
462,
1678,
1209,
13,
462,
13,
4706,
1583,
869,
2281,
2955,
29918,
1220,
353,
518,
4102,
29918,
1742,
29962,
718,
6273,
13,
632,
13,
632,
13,
1678,
822,
679,
29918,
4622,
29918,
1742,
313,
1311,
1125,
13,
4706,
10677,
353,
1583,
869,
15278,
29918,
18127,
13,
4706,
1196,
353,
1583,
869,
15278,
29918,
726,
13,
4706,
7431,
29918,
1220,
353,
7431,
313,
1220,
29897,
13,
13,
4706,
396,
2158,
313,
18127,
29897,
13,
308,
13,
4706,
565,
313,
18127,
1275,
7431,
29918,
1220,
1125,
13,
9651,
736,
5124,
13,
308,
13,
4706,
1734,
29918,
2962,
353,
10677,
13,
4706,
396,
2158,
4852,
1220,
543,
29974,
1220,
29897,
13,
4706,
396,
2158,
4852,
2962,
543,
29974,
1220,
518,
1742,
29918,
2962,
29901,
2314,
13,
308,
13,
4706,
565,
313,
18127,
1275,
29871,
29900,
1125,
13,
9651,
1734,
29918,
355,
353,
1196,
869,
1284,
4852,
16521,
13,
9651,
565,
313,
1742,
29918,
355,
529,
29871,
29900,
1125,
13,
18884,
1734,
29918,
355,
353,
7431,
29918,
1220,
13,
18884,
2446,
29918,
18127,
353,
7431,
29918,
1220,
13,
9651,
1683,
29901,
13,
18884,
2446,
29918,
18127,
353,
1583,
869,
14383,
29918,
22854,
29918,
262,
29918,
1220,
313,
1742,
29918,
355,
29897,
13,
4706,
1683,
29901,
13,
9651,
396,
6058,
29923,
29901,
445,
9250,
278,
671,
310,
419,
29874,
871,
1546,
6273,
13,
9651,
396,
6058,
29923,
29901,
393,
338,
19752,
333,
372,
297,
6031,
11070,
6194,
934,
2983,
29897,
13,
9651,
396,
372,
29915,
29879,
6480,
13,
9651,
396,
12256,
29923,
29901,
694,
4069,
1347,
6068,
29973,
13,
13,
9651,
396,
361,
313,
1220,
518,
1742,
29918,
2962,
29962,
2804,
28796,
1125,
13,
9651,
396,
1678,
12020,
8960,
4852,
18552,
292,
419,
29874,
297,
13218,
29908,
13,
9651,
396,
462,
268,
718,
1196,
13,
9651,
396,
462,
268,
718,
376,
5931,
1599,
376,
13,
9651,
396,
462,
268,
718,
1196,
518,
1742,
29918,
2962,
584,
2314,
13,
9651,
565,
313,
1220,
518,
1742,
29918,
2962,
29962,
1275,
28796,
1125,
13,
18884,
1734,
29918,
2962,
4619,
29871,
29896,
13,
9651,
1734,
29918,
2962,
353,
1583,
869,
14383,
29918,
22854,
29918,
262,
29918,
1220,
313,
1742,
29918,
2962,
29897,
13,
9651,
1734,
29918,
355,
353,
1583,
869,
1284,
29918,
23516,
29918,
355,
313,
1742,
29918,
2962,
29897,
13,
9651,
396,
2158,
4852,
1742,
29918,
355,
543,
29974,
710,
29898,
1742,
29918,
355,
876,
13,
9651,
565,
313,
1742,
29918,
355,
1275,
7431,
29918,
1220,
1125,
13,
18884,
2446,
29918,
18127,
353,
7431,
29918,
1220,
13,
9651,
1683,
29901,
13,
18884,
2446,
29918,
18127,
353,
1583,
869,
14383,
29918,
22854,
29918,
262,
29918,
1220,
313,
1742,
29918,
355,
29897,
13,
9651,
565,
5135,
4622,
29918,
18127,
529,
7431,
29918,
1220,
29897,
322,
313,
1220,
518,
4622,
29918,
18127,
29962,
2804,
28796,
22164,
13,
18884,
12020,
8960,
313,
1311,
869,
8453,
29918,
3283,
3861,
13,
462,
462,
718,
376,
1222,
6021,
419,
29874,
29892,
750,
6160,
13,
462,
462,
718,
1196,
518,
1742,
29918,
355,
584,
29962,
13,
462,
462,
718,
376,
3705,
376,
13,
462,
462,
718,
1196,
29897,
13,
13,
13,
4706,
565,
313,
4622,
29918,
18127,
2804,
7431,
29918,
1220,
1125,
13,
9651,
396,
4443,
29901,
1196,
756,
1063,
10076,
2986,
310,
25053,
8162,
13,
9651,
396,
6058,
29923,
29901,
694,
28796,
472,
278,
1095,
310,
278,
1196,
313,
14043,
1326,
1698,
29872,
385,
1059,
29897,
13,
9651,
1550,
313,
1220,
518,
4622,
29918,
18127,
29962,
1275,
376,
376,
1125,
13,
18884,
2446,
29918,
18127,
4619,
29871,
29896,
13,
13,
462,
13,
4706,
1734,
353,
1196,
518,
1742,
29918,
2962,
584,
1734,
29918,
355,
29962,
13,
4706,
396,
2158,
4852,
17435,
1734,
543,
29974,
1742,
29897,
13,
13,
4706,
565,
313,
1742,
1275,
5124,
1125,
13,
9651,
12020,
8960,
313,
1311,
869,
8453,
29918,
3283,
3861,
718,
376,
2812,
2349,
1734,
29901,
376,
718,
1196,
29897,
13,
308,
13,
4706,
1583,
869,
15278,
29918,
18127,
353,
2446,
29918,
18127,
13,
308,
13,
4706,
736,
1734,
13,
13,
1678,
822,
679,
29918,
2611,
4080,
29918,
392,
29918,
25699,
313,
1311,
29892,
1196,
1125,
13,
4706,
1583,
869,
15278,
29918,
18127,
353,
29871,
29900,
13,
4706,
1583,
869,
15278,
29918,
726,
353,
1196,
13,
4706,
15278,
353,
1583,
869,
679,
29918,
4622,
29918,
1742,
3861,
13,
4706,
302,
29890,
29918,
5085,
353,
15278,
29918,
4537,
29918,
5085,
518,
2611,
4080,
29962,
13,
4706,
6273,
353,
302,
29890,
29918,
5085,
334,
6796,
3108,
13,
4706,
363,
1852,
29918,
2248,
297,
3464,
313,
9877,
29918,
5085,
1125,
13,
9651,
6273,
518,
1191,
29918,
2248,
29962,
353,
1583,
869,
679,
29918,
4622,
29918,
1742,
3861,
13,
4706,
565,
313,
1311,
869,
15278,
29918,
18127,
2804,
7431,
313,
1311,
869,
15278,
29918,
726,
22164,
13,
9651,
12020,
8960,
313,
1311,
869,
8453,
29918,
3283,
3861,
718,
376,
7338,
336,
6273,
29901,
376,
718,
1583,
869,
15278,
29918,
726,
29897,
13,
4706,
736,
313,
2611,
4080,
29892,
6273,
29897,
13,
13,
1678,
822,
8161,
29918,
11918,
29918,
1853,
313,
1311,
29892,
13,
462,
462,
15278,
29892,
13,
462,
462,
2286,
29918,
2248,
1125,
13,
4706,
722,
29918,
1853,
353,
2286,
29918,
8768,
29918,
262,
29918,
25699,
518,
2611,
4080,
29962,
518,
11918,
29918,
2248,
29962,
13,
4706,
565,
313,
1707,
29918,
1853,
1275,
376,
1384,
29908,
1125,
13,
9651,
722,
29918,
1853,
353,
376,
1384,
29908,
13,
9651,
396,
22692,
8960,
4852,
23323,
451,
8161,
1134,
310,
2286,
1159,
13,
4706,
736,
722,
29918,
1853,
13,
13,
1678,
822,
3588,
29918,
11918,
29918,
333,
29918,
517,
29918,
8159,
29918,
11918,
29918,
3318,
313,
1311,
29892,
13,
462,
462,
462,
268,
2980,
29892,
13,
462,
462,
462,
268,
15278,
29892,
13,
462,
462,
462,
268,
2286,
29918,
2248,
1125,
13,
4706,
565,
313,
23516,
518,
29900,
29962,
1275,
3908,
29908,
1125,
13,
9651,
2980,
353,
2980,
518,
29896,
17531,
13,
4706,
1134,
29918,
3090,
353,
2980,
518,
29900,
29962,
13,
4706,
722,
29918,
1853,
353,
1583,
869,
8161,
29918,
11918,
29918,
1853,
313,
2611,
4080,
29892,
13,
462,
462,
462,
259,
2286,
29918,
2248,
29897,
13,
4706,
722,
29918,
978,
353,
2980,
13,
4706,
736,
313,
1707,
29918,
978,
29892,
722,
29918,
1853,
29897,
13,
13,
1678,
822,
679,
29918,
2611,
4080,
29918,
20897,
313,
1311,
29892,
15278,
29918,
392,
29918,
25699,
1125,
13,
4706,
313,
2611,
4080,
29892,
6273,
29897,
353,
15278,
29918,
392,
29918,
25699,
13,
4706,
2286,
29918,
1066,
2187,
353,
2286,
29918,
1066,
2187,
29918,
262,
29918,
25699,
518,
2611,
4080,
29962,
13,
4706,
3651,
353,
5159,
13,
4706,
363,
2286,
29918,
2248,
297,
3464,
313,
2435,
313,
11918,
29918,
1066,
2187,
22164,
13,
9651,
2602,
353,
2286,
29918,
1066,
2187,
518,
11918,
29918,
2248,
29962,
13,
9651,
3651,
869,
9773,
313,
13,
18884,
1583,
869,
3588,
29918,
11918,
29918,
333,
29918,
517,
29918,
8159,
29918,
11918,
29918,
3318,
313,
13,
462,
1678,
6273,
518,
3283,
1402,
13,
462,
1678,
15278,
29892,
13,
462,
1678,
2286,
29918,
2248,
876,
13,
4706,
736,
3651,
13,
13,
1678,
822,
6613,
29918,
25699,
313,
1311,
29892,
13,
462,
632,
15278,
29918,
392,
29918,
25699,
29892,
13,
462,
632,
3651,
29892,
13,
462,
632,
7029,
29918,
20897,
29918,
8977,
1125,
13,
4706,
15278,
353,
15278,
29918,
392,
29918,
25699,
518,
29900,
29962,
13,
4706,
6273,
353,
15278,
29918,
392,
29918,
25699,
518,
29896,
29962,
13,
4706,
2980,
29918,
8768,
353,
15278,
29918,
23516,
29918,
8768,
518,
2611,
4080,
29962,
13,
4706,
2286,
29918,
2248,
353,
29871,
29900,
13,
4706,
21551,
29918,
25699,
353,
5159,
13,
4706,
363,
1852,
29918,
1853,
29892,
1852,
297,
14319,
313,
23516,
29918,
8768,
29892,
6273,
1125,
13,
9651,
565,
313,
1191,
518,
29900,
29962,
1275,
3908,
29908,
1125,
13,
18884,
1852,
353,
7029,
29918,
20897,
29918,
8977,
518,
1191,
518,
29896,
29901,
5262,
13,
9651,
565,
313,
1191,
29918,
1853,
1275,
376,
20054,
29908,
1125,
13,
18884,
21551,
29918,
23516,
353,
313,
13441,
29918,
1807,
29918,
517,
29918,
20054,
313,
1191,
876,
13,
9651,
25342,
313,
1191,
29918,
1853,
1275,
376,
16031,
29908,
1125,
13,
18884,
21551,
29918,
23516,
353,
313,
524,
313,
1191,
876,
13,
9651,
25342,
313,
1191,
29918,
1853,
1275,
376,
6370,
29908,
1125,
13,
18884,
21551,
29918,
23516,
353,
313,
7411,
313,
1191,
876,
13,
9651,
25342,
313,
1191,
29918,
1853,
1275,
376,
19676,
29908,
1125,
13,
18884,
21551,
29918,
23516,
353,
313,
19676,
313,
1191,
876,
13,
9651,
25342,
313,
1191,
29918,
1853,
1275,
376,
1807,
29908,
1125,
13,
18884,
21551,
29918,
23516,
353,
313,
13441,
29918,
1807,
29918,
517,
29918,
1807,
313,
1191,
876,
13,
9651,
25342,
313,
1191,
29918,
1853,
1275,
376,
11918,
29908,
1125,
13,
18884,
21551,
29918,
23516,
353,
313,
20897,
518,
11918,
29918,
2248,
2314,
13,
18884,
2286,
29918,
2248,
4619,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
12020,
8960,
313,
1311,
869,
8453,
29918,
3283,
3861,
718,
376,
853,
5203,
2980,
1134,
29901,
376,
718,
851,
313,
1191,
29918,
1853,
876,
13,
9651,
21551,
29918,
25699,
869,
9773,
313,
1639,
1457,
9446,
29918,
23516,
29897,
13,
4706,
736,
21551,
29918,
25699,
13,
13,
1678,
822,
6613,
29918,
1220,
313,
1311,
29892,
1196,
1125,
13,
4706,
15278,
29918,
392,
29918,
25699,
353,
1583,
869,
679,
29918,
2611,
4080,
29918,
392,
29918,
25699,
313,
1220,
29897,
13,
4706,
1852,
29918,
20897,
353,
313,
13,
9651,
1583,
869,
679,
29918,
2611,
4080,
29918,
20897,
313,
2611,
4080,
29918,
392,
29918,
25699,
876,
13,
4706,
1583,
869,
788,
29918,
3827,
287,
29918,
20897,
313,
1191,
29918,
20897,
29897,
13,
4706,
15278,
353,
15278,
29918,
392,
29918,
25699,
518,
29900,
29962,
13,
4706,
6273,
353,
1583,
869,
6613,
29918,
25699,
313,
2611,
4080,
29918,
392,
29918,
25699,
29892,
13,
462,
462,
18884,
1852,
29918,
20897,
29892,
13,
462,
462,
18884,
1583,
869,
7029,
29918,
20897,
29897,
13,
4706,
1583,
869,
11994,
869,
9773,
5135,
2611,
4080,
29892,
6273,
876,
13,
4706,
736,
13,
13,
268,
13,
2
] |
scripts/lidar_constants.py | priyablue/lidar_navigation | 2 | 1606381 | <filename>scripts/lidar_constants.py
import os
import sys
__path = os.path.abspath(sys.modules[__name__].__file__)
__dirname = os.path.dirname(__path)
HTTP_TEMPLATE_DEFAULT = __dirname + "/html/plot-image.html"
HTTP_PORT_DEFAULT = 8080
HTTP_DELAY_SECS_DEFAULT = 0
HTTP_PORT = "http_port"
TEMPLATE_FILE = "template_file"
HTTP_DELAY_SECS = "http_delay_secs"
HTTP_VERBOSE = "http_verbose"
LOG_LEVEL = "loglevel"
SLICE_SIZE = "slice_size"
SLICE_OFFSET = "slice_offset"
MAX_DIST_MULT = "max_dist_mult"
MAX_DIST_MULT_DEFAULT = 1.1
SLICE_SIZE_DEFAULT = 5
SLICE_OFFSET_DEFAULT = 0
PUBLISH_RATE = "publish_rate"
PUBLISH_RATE_DEFAULT = 30
SCAN_TOPIC = "scan_topic"
SCAN_TOPIC_DEFAULT = "/scan"
CONTOUR_TOPIC = "contour_topic"
CONTOUR_TOPIC_DEFAULT = "/contour"
CENTROID_TOPIC = "centroid_topic"
CENTROID_TOPIC_DEFAULT = "/centroid"
PC_TOPIC = "pc_topic"
PC_TOPIC_DEFAULT = "/pc2"
MAX_AXIS_MULT = "max_axis_mult"
MAX_AXIS_MULT_DEFAULT = 1.05
PLOT_ALL = "plot_all"
PLOT_CONTOUR = "plot_contour"
PLOT_CENTROID = "plot_centroid"
PLOT_POINTS = "plot_points"
PLOT_SLICES = "plot_slices"
PUBLISH_PC = "publish_pc"
PUBLISH_PC_DEFAULT = False
MAX_LINEAR = "max_linear"
MAX_LINEAR_DEFAULT = .35
MAX_ANGULAR = "max_angular"
MAX_ANGULAR_DEFAULT = 2.75
VEL_TOPIC = "vel_topic"
VEL_TOPIC_DEFAULT = "/cmd_vel"
STOP_ANGLE = "stop_angle"
STOP_ANGLE_DEFAULT = 70
PAUSE = "pause"
PAUSE_DEFAULT = 0
ITERATIONS = "iterations"
ITERATIONS_DEFAULT = 20
MIN_POINTS = "min_points"
MIN_POINTS_DEFAULT = 20
THRESHOLD = "threshold"
THRESHOLD_DEFAULT = 0.025
| [
1,
529,
9507,
29958,
16713,
29914,
29880,
333,
279,
29918,
3075,
1934,
29889,
2272,
13,
5215,
2897,
13,
13,
5215,
10876,
13,
13,
1649,
2084,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
9675,
29889,
7576,
29961,
1649,
978,
1649,
1822,
1649,
1445,
1649,
29897,
13,
1649,
25721,
353,
2897,
29889,
2084,
29889,
25721,
22168,
2084,
29897,
13,
10493,
29918,
4330,
3580,
29931,
3040,
29918,
23397,
353,
4770,
25721,
718,
5591,
1420,
29914,
5317,
29899,
3027,
29889,
1420,
29908,
13,
10493,
29918,
15082,
29918,
23397,
353,
29871,
29947,
29900,
29947,
29900,
13,
10493,
29918,
2287,
18799,
29918,
1660,
9295,
29918,
23397,
353,
29871,
29900,
13,
13,
10493,
29918,
15082,
353,
376,
1124,
29918,
637,
29908,
13,
4330,
3580,
29931,
3040,
29918,
7724,
353,
376,
6886,
29918,
1445,
29908,
13,
10493,
29918,
2287,
18799,
29918,
1660,
9295,
353,
376,
1124,
29918,
18829,
29918,
344,
2395,
29908,
13,
10493,
29918,
5348,
8456,
1660,
353,
376,
1124,
29918,
369,
15828,
29908,
13,
14480,
29918,
1307,
29963,
6670,
353,
376,
1188,
5563,
29908,
13,
13,
12750,
12107,
29918,
14226,
353,
376,
18337,
29918,
2311,
29908,
13,
12750,
12107,
29918,
27681,
10490,
353,
376,
18337,
29918,
10289,
29908,
13,
12648,
29918,
4571,
1254,
29918,
29924,
8647,
353,
376,
3317,
29918,
5721,
29918,
4713,
29908,
13,
12648,
29918,
4571,
1254,
29918,
29924,
8647,
29918,
23397,
353,
29871,
29896,
29889,
29896,
13,
12750,
12107,
29918,
14226,
29918,
23397,
353,
29871,
29945,
13,
12750,
12107,
29918,
27681,
10490,
29918,
23397,
353,
29871,
29900,
13,
7056,
13367,
3235,
29950,
29918,
29934,
3040,
353,
376,
23679,
29918,
10492,
29908,
13,
7056,
13367,
3235,
29950,
29918,
29934,
3040,
29918,
23397,
353,
29871,
29941,
29900,
13,
7187,
2190,
29918,
4986,
2227,
29907,
353,
376,
16192,
29918,
13010,
29908,
13,
7187,
2190,
29918,
4986,
2227,
29907,
29918,
23397,
353,
5591,
16192,
29908,
13,
6007,
4986,
4574,
29918,
4986,
2227,
29907,
353,
376,
1285,
473,
29918,
13010,
29908,
13,
6007,
4986,
4574,
29918,
4986,
2227,
29907,
29918,
23397,
353,
5591,
1285,
473,
29908,
13,
29907,
3919,
1672,
1367,
29918,
4986,
2227,
29907,
353,
376,
1760,
1007,
29918,
13010,
29908,
13,
29907,
3919,
1672,
1367,
29918,
4986,
2227,
29907,
29918,
23397,
353,
5591,
1760,
1007,
29908,
13,
9026,
29918,
4986,
2227,
29907,
353,
376,
6739,
29918,
13010,
29908,
13,
9026,
29918,
4986,
2227,
29907,
29918,
23397,
353,
5591,
6739,
29906,
29908,
13,
13,
12648,
29918,
6604,
3235,
29918,
29924,
8647,
353,
376,
3317,
29918,
8990,
29918,
4713,
29908,
13,
12648,
29918,
6604,
3235,
29918,
29924,
8647,
29918,
23397,
353,
29871,
29896,
29889,
29900,
29945,
13,
13,
7390,
2891,
29918,
9818,
353,
376,
5317,
29918,
497,
29908,
13,
7390,
2891,
29918,
6007,
4986,
4574,
353,
376,
5317,
29918,
1285,
473,
29908,
13,
7390,
2891,
29918,
29907,
3919,
1672,
1367,
353,
376,
5317,
29918,
1760,
1007,
29908,
13,
7390,
2891,
29918,
29925,
6992,
9375,
353,
376,
5317,
29918,
9748,
29908,
13,
7390,
2891,
29918,
12750,
2965,
2890,
353,
376,
5317,
29918,
29879,
29399,
29908,
13,
13,
7056,
13367,
3235,
29950,
29918,
9026,
353,
376,
23679,
29918,
6739,
29908,
13,
7056,
13367,
3235,
29950,
29918,
9026,
29918,
23397,
353,
7700,
13,
13,
12648,
29918,
18521,
1718,
353,
376,
3317,
29918,
10660,
29908,
13,
12648,
29918,
18521,
1718,
29918,
23397,
353,
869,
29941,
29945,
13,
13,
12648,
29918,
19453,
13309,
1718,
353,
376,
3317,
29918,
6825,
29908,
13,
12648,
29918,
19453,
13309,
1718,
29918,
23397,
353,
29871,
29906,
29889,
29955,
29945,
13,
13,
29963,
6670,
29918,
4986,
2227,
29907,
353,
376,
955,
29918,
13010,
29908,
13,
29963,
6670,
29918,
4986,
2227,
29907,
29918,
23397,
353,
5591,
9006,
29918,
955,
29908,
13,
13,
1254,
4590,
29918,
19453,
1307,
353,
376,
9847,
29918,
2521,
29908,
13,
1254,
4590,
29918,
19453,
1307,
29918,
23397,
353,
29871,
29955,
29900,
13,
13,
7228,
17171,
353,
376,
29886,
1071,
29908,
13,
7228,
17171,
29918,
23397,
353,
29871,
29900,
13,
1806,
1001,
8098,
29903,
353,
376,
1524,
800,
29908,
13,
1806,
1001,
8098,
29903,
29918,
23397,
353,
29871,
29906,
29900,
13,
16173,
29918,
29925,
6992,
9375,
353,
376,
1195,
29918,
9748,
29908,
13,
16173,
29918,
29925,
6992,
9375,
29918,
23397,
353,
29871,
29906,
29900,
13,
4690,
1525,
7068,
5607,
29928,
353,
376,
386,
12268,
29908,
13,
4690,
1525,
7068,
5607,
29928,
29918,
23397,
353,
29871,
29900,
29889,
29900,
29906,
29945,
13,
2
] |
tests/test_calculate_branch.py | ivergara/python-abc | 2 | 20073 | <reponame>ivergara/python-abc
import pytest
from tests import assert_source_returns_expected
BRANCH_CASES = [
# Call
('print("hello world")', 'b | print("hello world")'),
# Await
("await noop()", "b | await noop()"),
# Class instantiation
("Noop()", "b | Noop()"),
]
@pytest.mark.parametrize("source,expected", BRANCH_CASES)
def test_branch(capsys, source, expected):
assert_source_returns_expected(capsys, source, expected) is True
| [
1,
529,
276,
1112,
420,
29958,
2147,
29887,
2518,
29914,
4691,
29899,
10736,
13,
5215,
11451,
1688,
13,
13,
3166,
6987,
1053,
4974,
29918,
4993,
29918,
18280,
29918,
9684,
13,
13,
13,
15176,
2190,
3210,
29918,
23487,
29903,
353,
518,
13,
1678,
396,
8251,
13,
1678,
6702,
2158,
703,
12199,
3186,
1159,
742,
525,
29890,
891,
1596,
703,
12199,
3186,
1159,
5477,
13,
1678,
396,
319,
10685,
13,
1678,
4852,
20675,
694,
459,
580,
613,
376,
29890,
891,
7272,
694,
459,
580,
4968,
13,
1678,
396,
4134,
13213,
362,
13,
1678,
4852,
3782,
459,
580,
613,
376,
29890,
891,
1939,
459,
580,
4968,
13,
29962,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
4993,
29892,
9684,
613,
25185,
2190,
3210,
29918,
23487,
29903,
29897,
13,
1753,
1243,
29918,
17519,
29898,
29883,
2547,
952,
29892,
2752,
29892,
3806,
1125,
13,
1678,
4974,
29918,
4993,
29918,
18280,
29918,
9684,
29898,
29883,
2547,
952,
29892,
2752,
29892,
3806,
29897,
338,
5852,
13,
2
] |
spinoff/actor/validate.py | eallik/spinoff | 6 | 59393 | import re
_VALID_IP_RE = '(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])'
_VALID_HOSTNAME_RE = '(?:(?:[a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])'
_VALID_NODEID_RE = re.compile('(?:%s|%s):(?P<port>[0-9]+)$' % (_VALID_HOSTNAME_RE, _VALID_IP_RE))
def _validate_nodeid(nodeid):
if '|' in nodeid:
nodeid = nodeid.split('|', 1)[0]
# call from app code
m = _VALID_NODEID_RE.match(nodeid)
if not m: # pragma: no cover
raise ValueError("Node IDs should be in the format '<ip-or-hostname>:<port>': %s" % (nodeid,))
port = int(m.group(1))
if not (0 <= port <= 65535): # pragma: no cover
raise ValueError("Ports should be in the range 0-65535: %d" % (port,))
| [
1,
1053,
337,
13,
13,
13,
29918,
26707,
29918,
5690,
29918,
1525,
353,
525,
10780,
5919,
29973,
10834,
29900,
29899,
29929,
29962,
29989,
29961,
29896,
29899,
29929,
3816,
29900,
29899,
29929,
29962,
29989,
29896,
29961,
29900,
29899,
29929,
3199,
29906,
11079,
29906,
29961,
29900,
29899,
29946,
3816,
29900,
29899,
29929,
29962,
29989,
29906,
29945,
29961,
29900,
29899,
29945,
29962,
2144,
1846,
29912,
29941,
2119,
29973,
10834,
29900,
29899,
29929,
29962,
29989,
29961,
29896,
29899,
29929,
3816,
29900,
29899,
29929,
29962,
29989,
29896,
29961,
29900,
29899,
29929,
3199,
29906,
11079,
29906,
29961,
29900,
29899,
29946,
3816,
29900,
29899,
29929,
29962,
29989,
29906,
29945,
29961,
29900,
29899,
29945,
2314,
29915,
13,
29918,
26707,
29918,
20832,
5813,
29918,
1525,
353,
525,
10780,
5919,
29973,
10834,
29874,
29899,
25265,
29899,
29999,
29962,
29989,
29961,
29874,
29899,
25265,
29899,
29999,
3816,
29874,
29899,
25265,
29899,
29999,
29900,
29899,
29929,
29905,
29899,
14178,
29961,
29874,
29899,
25265,
29899,
29999,
29900,
29899,
29929,
29962,
2144,
1846,
29930,
10780,
10834,
29909,
29899,
29999,
29874,
29899,
29920,
29962,
29989,
29961,
29909,
29899,
29999,
29874,
29899,
29920,
3816,
29909,
29899,
29999,
29874,
29899,
29920,
29900,
29899,
29929,
29905,
29899,
14178,
29961,
29909,
29899,
29999,
29874,
29899,
29920,
29900,
29899,
29929,
2314,
29915,
13,
29918,
26707,
29918,
6632,
2287,
1367,
29918,
1525,
353,
337,
29889,
12198,
877,
10780,
16664,
29879,
29989,
29995,
29879,
1125,
10780,
29925,
29966,
637,
24566,
29900,
29899,
29929,
10062,
1262,
29915,
1273,
9423,
26707,
29918,
20832,
5813,
29918,
1525,
29892,
903,
26707,
29918,
5690,
29918,
1525,
876,
13,
13,
13,
1753,
903,
15480,
29918,
3177,
333,
29898,
3177,
333,
1125,
13,
1678,
565,
525,
29989,
29915,
297,
2943,
333,
29901,
13,
4706,
2943,
333,
353,
2943,
333,
29889,
5451,
877,
29989,
742,
29871,
29896,
9601,
29900,
29962,
13,
1678,
396,
1246,
515,
623,
775,
13,
1678,
286,
353,
903,
26707,
29918,
6632,
2287,
1367,
29918,
1525,
29889,
4352,
29898,
3177,
333,
29897,
13,
1678,
565,
451,
286,
29901,
29871,
396,
282,
23929,
29901,
694,
4612,
13,
4706,
12020,
7865,
2392,
703,
4247,
23481,
881,
367,
297,
278,
3402,
12801,
666,
29899,
272,
29899,
28988,
23917,
29966,
637,
29958,
2396,
1273,
29879,
29908,
1273,
313,
3177,
333,
29892,
876,
13,
1678,
2011,
353,
938,
29898,
29885,
29889,
2972,
29898,
29896,
876,
13,
1678,
565,
451,
313,
29900,
5277,
2011,
5277,
29871,
29953,
29945,
29945,
29941,
29945,
1125,
29871,
396,
282,
23929,
29901,
694,
4612,
13,
4706,
12020,
7865,
2392,
703,
2290,
29879,
881,
367,
297,
278,
3464,
29871,
29900,
29899,
29953,
29945,
29945,
29941,
29945,
29901,
1273,
29881,
29908,
1273,
313,
637,
29892,
876,
13,
2
] |
ProgramacaoFuncional/desafio_mdc.py | VictorMello1993/CursoPythonUdemy | 0 | 43511 | #Desafio MDC
def mdc(numeros):
pass
if __name__ == '__main__':
print(mdc([21, 7])) #7
print(mdc([125, 40])) #5
print(mdc([9, 564, 66, 3])) #3
print(mdc([55, 22])) #11
print(mdc([15, 150])) #15
print(mdc([7, 9])) #1 | [
1,
396,
4002,
2142,
601,
341,
12696,
13,
1753,
286,
13891,
29898,
8058,
359,
1125,
13,
1678,
1209,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1596,
29898,
3487,
29883,
4197,
29906,
29896,
29892,
29871,
29955,
12622,
396,
29955,
13,
1678,
1596,
29898,
3487,
29883,
4197,
29896,
29906,
29945,
29892,
29871,
29946,
29900,
12622,
396,
29945,
13,
1678,
1596,
29898,
3487,
29883,
4197,
29929,
29892,
29871,
29945,
29953,
29946,
29892,
29871,
29953,
29953,
29892,
29871,
29941,
12622,
396,
29941,
13,
1678,
1596,
29898,
3487,
29883,
4197,
29945,
29945,
29892,
29871,
29906,
29906,
12622,
396,
29896,
29896,
13,
1678,
1596,
29898,
3487,
29883,
4197,
29896,
29945,
29892,
29871,
29896,
29945,
29900,
12622,
396,
29896,
29945,
13,
1678,
1596,
29898,
3487,
29883,
4197,
29955,
29892,
29871,
29929,
12622,
396,
29896,
2
] |
haweb/libs/drf/api_views.py | edilio/tobeawebproperty | 0 | 54046 | <filename>haweb/libs/drf/api_views.py
from __future__ import unicode_literals
import warnings
from django.http import Http404
from django.conf import settings
from rest_framework import viewsets, mixins, status, serializers
from rest_framework.response import Response
from .error_responses import ErrorResponse
DEFAULT_LIST_LIMIT = settings.API_SETTINGS.get('DEFAULT_LIST_LIMIT', 30)
def get_offset_limit_params(request, default_limit=DEFAULT_LIST_LIMIT):
range_errors = []
offset, limit = 0, default_limit
try:
offset = int(request.GET.get('offset', 0))
if offset < 0:
raise ValueError
except ValueError:
range_errors.append("Invalid value '{0}' for offset. Expected >=0.".format(request.GET.get('offset')))
try:
limit = int(request.GET.get('limit', default_limit))
if limit < 1:
raise ValueError
except ValueError:
range_errors.append("Invalid value '{0}' for limit. Expected >0.".format(request.GET.get('limit')))
return limit, offset, range_errors
def get_object_list(offset, limit, queryset_or_list):
return queryset_or_list[offset:(offset+limit)]
class OffsetLimitMixin(object):
def get_offset_limit_params(self, default_limit=DEFAULT_LIST_LIMIT):
return get_offset_limit_params(self.request, default_limit)
class JEDListRetrieve(mixins.RetrieveModelMixin,
mixins.ListModelMixin,
viewsets.GenericViewSet,
OffsetLimitMixin):
"""
A viewset that provides default `retrieve()` and `list()` actions.
but the list will contains the way smart bear api should work with limit, offset
"""
include_total = False
@staticmethod
def get_object_not_found_error_response(object_name, object_lookup_key):
return ErrorResponse(data="{0} with ID '{1}' not found.".format(object_name, object_lookup_key),
status=status.HTTP_404_NOT_FOUND)
@staticmethod
def get_fields_for_sencha(serializer):
fields = serializer.get_fields().keys()
return [{'header': f, 'name': f} for f in fields]
def generate_list_response(self, query, object_list, serializer, offset, limit):
"""
:rtype : object
:param query: The whole query before limiting using offset and limit params
:param object_list: the result of applying offset and limit to the query
:param serializer: serialize or serialized_data for some uses
:param offset:
:param limit:
:return: a response object with the data serialized
"""
object_list_count = len(object_list) if isinstance(object_list, list) else object_list.count()
serialized_data = serializer.data if isinstance(serializer, serializers.Serializer) else serializer
json_dict = {
'success': True,
'metaData': {
'root': 'rows',
'totalProperty': 'totalCount',
'successProperty': 'success',
'idProperty': 'id',
'sortInfo': {
"field": 'id',
"direction": 'asc'
},
'fields': self.get_fields_for_sencha(serializer)
},
'rows': serialized_data,
'totalCount':object_list_count
}
return Response(json_dict)
def list(self, request, *args, **kwargs):
"""
list all
limit -- limit
offset -- offset
"""
query = self.filter_queryset(self.get_queryset())
if isinstance(query, ErrorResponse):
return query
default_limit = DEFAULT_LIST_LIMIT
limit, offset, range_errors = self.get_offset_limit_params(default_limit)
if range_errors:
return ErrorResponse(data=range_errors)
self.object_list = get_object_list(offset, limit, query)
# Default is to allow empty querysets. This can be altered by setting
# `.allow_empty = False`, to raise 404 errors on empty querysets.
if not self.allow_empty and not self.object_list:
warnings.warn(
'The `allow_empty` parameter is due to be deprecated. '
'To use `allow_empty=False` style behavior, You should override '
'`get_queryset()` and explicitly raise a 404 on empty querysets.',
PendingDeprecationWarning
)
class_name = self.__class__.__name__
error_msg = self.empty_error % {'class_name': class_name}
raise Http404(error_msg)
# the pagination is not supported, use offset and limit
serializer = self.get_serializer(self.object_list, many=True)
return self.generate_list_response(query, self.object_list, serializer, offset, limit)
class JEDModelViewSet(mixins.CreateModelMixin,
mixins.UpdateModelMixin,
mixins.DestroyModelMixin,
JEDListRetrieve):
"""
A viewset that provides default `create()`, `retrieve()`, `update()`,
`partial_update()`, `destroy()` and `list()` actions.
but the list will contains the way smart bear api should work with limit, offset
"""
pass
| [
1,
529,
9507,
29958,
2350,
2676,
29914,
10254,
29914,
7707,
29888,
29914,
2754,
29918,
7406,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
5215,
18116,
13,
13,
3166,
9557,
29889,
1124,
1053,
9056,
29946,
29900,
29946,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
13,
3166,
1791,
29918,
4468,
1053,
1776,
7224,
29892,
6837,
1144,
29892,
4660,
29892,
7797,
19427,
13,
3166,
1791,
29918,
4468,
29889,
5327,
1053,
13291,
13,
13,
3166,
869,
2704,
29918,
26679,
267,
1053,
4829,
5103,
13,
13,
13,
23397,
29918,
24360,
29918,
5265,
26349,
353,
6055,
29889,
8787,
29918,
10490,
29911,
4214,
29903,
29889,
657,
877,
23397,
29918,
24360,
29918,
5265,
26349,
742,
29871,
29941,
29900,
29897,
13,
13,
13,
1753,
679,
29918,
10289,
29918,
13400,
29918,
7529,
29898,
3827,
29892,
2322,
29918,
13400,
29922,
23397,
29918,
24360,
29918,
5265,
26349,
1125,
13,
1678,
3464,
29918,
12523,
353,
5159,
13,
1678,
9210,
29892,
4046,
353,
29871,
29900,
29892,
2322,
29918,
13400,
13,
1678,
1018,
29901,
13,
4706,
9210,
353,
938,
29898,
3827,
29889,
7194,
29889,
657,
877,
10289,
742,
29871,
29900,
876,
13,
4706,
565,
9210,
529,
29871,
29900,
29901,
13,
9651,
12020,
7865,
2392,
13,
1678,
5174,
7865,
2392,
29901,
13,
4706,
3464,
29918,
12523,
29889,
4397,
703,
13919,
995,
22372,
29900,
10162,
363,
9210,
29889,
1222,
6021,
6736,
29900,
1213,
29889,
4830,
29898,
3827,
29889,
7194,
29889,
657,
877,
10289,
29915,
4961,
13,
13,
1678,
1018,
29901,
13,
4706,
4046,
353,
938,
29898,
3827,
29889,
7194,
29889,
657,
877,
13400,
742,
2322,
29918,
13400,
876,
13,
4706,
565,
4046,
529,
29871,
29896,
29901,
13,
9651,
12020,
7865,
2392,
13,
1678,
5174,
7865,
2392,
29901,
13,
4706,
3464,
29918,
12523,
29889,
4397,
703,
13919,
995,
22372,
29900,
10162,
363,
4046,
29889,
1222,
6021,
1405,
29900,
1213,
29889,
4830,
29898,
3827,
29889,
7194,
29889,
657,
877,
13400,
29915,
4961,
13,
1678,
736,
4046,
29892,
9210,
29892,
3464,
29918,
12523,
13,
13,
13,
1753,
679,
29918,
3318,
29918,
1761,
29898,
10289,
29892,
4046,
29892,
2346,
842,
29918,
272,
29918,
1761,
1125,
13,
1678,
736,
2346,
842,
29918,
272,
29918,
1761,
29961,
10289,
5919,
10289,
29974,
13400,
4638,
13,
13,
13,
1990,
5947,
842,
24445,
29924,
861,
262,
29898,
3318,
1125,
13,
13,
1678,
822,
679,
29918,
10289,
29918,
13400,
29918,
7529,
29898,
1311,
29892,
2322,
29918,
13400,
29922,
23397,
29918,
24360,
29918,
5265,
26349,
1125,
13,
4706,
736,
679,
29918,
10289,
29918,
13400,
29918,
7529,
29898,
1311,
29889,
3827,
29892,
2322,
29918,
13400,
29897,
13,
13,
13,
1990,
435,
3352,
1293,
8015,
29878,
2418,
29898,
28084,
1144,
29889,
8015,
29878,
2418,
3195,
29924,
861,
262,
29892,
13,
462,
418,
6837,
1144,
29889,
1293,
3195,
29924,
861,
262,
29892,
13,
462,
418,
1776,
7224,
29889,
15809,
1043,
2697,
29892,
13,
462,
418,
5947,
842,
24445,
29924,
861,
262,
1125,
13,
1678,
9995,
13,
1678,
319,
1776,
842,
393,
8128,
2322,
421,
276,
509,
2418,
2555,
322,
421,
1761,
2555,
8820,
29889,
13,
1678,
541,
278,
1051,
674,
3743,
278,
982,
15040,
11460,
7882,
881,
664,
411,
4046,
29892,
9210,
13,
1678,
9995,
13,
1678,
3160,
29918,
7827,
353,
7700,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
3318,
29918,
1333,
29918,
11940,
29918,
2704,
29918,
5327,
29898,
3318,
29918,
978,
29892,
1203,
29918,
20401,
29918,
1989,
1125,
13,
4706,
736,
4829,
5103,
29898,
1272,
10724,
29900,
29913,
411,
3553,
22372,
29896,
10162,
451,
1476,
1213,
29889,
4830,
29898,
3318,
29918,
978,
29892,
1203,
29918,
20401,
29918,
1989,
511,
13,
462,
632,
4660,
29922,
4882,
29889,
10493,
29918,
29946,
29900,
29946,
29918,
12256,
29918,
5800,
18783,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
9621,
29918,
1454,
29918,
4881,
5815,
29898,
15550,
3950,
1125,
13,
4706,
4235,
353,
7797,
3950,
29889,
657,
29918,
9621,
2141,
8149,
580,
13,
4706,
736,
518,
10998,
6672,
2396,
285,
29892,
525,
978,
2396,
285,
29913,
363,
285,
297,
4235,
29962,
13,
13,
1678,
822,
5706,
29918,
1761,
29918,
5327,
29898,
1311,
29892,
2346,
29892,
1203,
29918,
1761,
29892,
7797,
3950,
29892,
9210,
29892,
4046,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
29878,
1853,
584,
1203,
13,
4706,
584,
3207,
2346,
29901,
450,
3353,
2346,
1434,
4046,
292,
773,
9210,
322,
4046,
8636,
13,
4706,
584,
3207,
1203,
29918,
1761,
29901,
278,
1121,
310,
15399,
9210,
322,
4046,
304,
278,
2346,
13,
4706,
584,
3207,
7797,
3950,
29901,
28755,
470,
7797,
1891,
29918,
1272,
363,
777,
3913,
13,
4706,
584,
3207,
9210,
29901,
13,
4706,
584,
3207,
4046,
29901,
13,
4706,
584,
2457,
29901,
263,
2933,
1203,
411,
278,
848,
7797,
1891,
13,
4706,
9995,
13,
4706,
1203,
29918,
1761,
29918,
2798,
353,
7431,
29898,
3318,
29918,
1761,
29897,
565,
338,
8758,
29898,
3318,
29918,
1761,
29892,
1051,
29897,
1683,
1203,
29918,
1761,
29889,
2798,
580,
13,
4706,
7797,
1891,
29918,
1272,
353,
7797,
3950,
29889,
1272,
565,
338,
8758,
29898,
15550,
3950,
29892,
7797,
19427,
29889,
17679,
29897,
1683,
7797,
3950,
13,
4706,
4390,
29918,
8977,
353,
426,
13,
9651,
525,
8698,
2396,
5852,
29892,
13,
9651,
525,
7299,
1469,
2396,
426,
13,
18884,
525,
4632,
2396,
525,
5727,
742,
13,
18884,
525,
7827,
4854,
2396,
525,
7827,
3981,
742,
13,
18884,
525,
8698,
4854,
2396,
525,
8698,
742,
13,
18884,
525,
333,
4854,
2396,
525,
333,
742,
13,
18884,
525,
6605,
3401,
2396,
426,
13,
462,
1678,
376,
2671,
1115,
525,
333,
742,
13,
462,
1678,
376,
20845,
1115,
525,
6151,
29915,
13,
18884,
2981,
13,
18884,
525,
9621,
2396,
1583,
29889,
657,
29918,
9621,
29918,
1454,
29918,
4881,
5815,
29898,
15550,
3950,
29897,
13,
9651,
2981,
13,
9651,
525,
5727,
2396,
7797,
1891,
29918,
1272,
29892,
13,
9651,
525,
7827,
3981,
2396,
3318,
29918,
1761,
29918,
2798,
13,
4706,
500,
13,
4706,
736,
13291,
29898,
3126,
29918,
8977,
29897,
13,
13,
1678,
822,
1051,
29898,
1311,
29892,
2009,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13,
4706,
1051,
599,
13,
4706,
4046,
1192,
4046,
13,
4706,
9210,
1192,
9210,
13,
4706,
9995,
13,
4706,
2346,
353,
1583,
29889,
4572,
29918,
1972,
842,
29898,
1311,
29889,
657,
29918,
1972,
842,
3101,
13,
4706,
565,
338,
8758,
29898,
1972,
29892,
4829,
5103,
1125,
13,
9651,
736,
2346,
13,
4706,
2322,
29918,
13400,
353,
22236,
29918,
24360,
29918,
5265,
26349,
13,
4706,
4046,
29892,
9210,
29892,
3464,
29918,
12523,
353,
1583,
29889,
657,
29918,
10289,
29918,
13400,
29918,
7529,
29898,
4381,
29918,
13400,
29897,
13,
4706,
565,
3464,
29918,
12523,
29901,
13,
9651,
736,
4829,
5103,
29898,
1272,
29922,
3881,
29918,
12523,
29897,
13,
13,
4706,
1583,
29889,
3318,
29918,
1761,
353,
679,
29918,
3318,
29918,
1761,
29898,
10289,
29892,
4046,
29892,
2346,
29897,
13,
13,
4706,
396,
13109,
338,
304,
2758,
4069,
2346,
7224,
29889,
29871,
910,
508,
367,
10551,
287,
491,
4444,
13,
4706,
396,
5050,
9536,
29918,
6310,
353,
7700,
1673,
304,
12020,
29871,
29946,
29900,
29946,
4436,
373,
4069,
2346,
7224,
29889,
13,
4706,
565,
451,
1583,
29889,
9536,
29918,
6310,
322,
451,
1583,
29889,
3318,
29918,
1761,
29901,
13,
9651,
18116,
29889,
25442,
29898,
13,
18884,
525,
1576,
421,
9536,
29918,
6310,
29952,
3443,
338,
2861,
304,
367,
18164,
29889,
525,
13,
18884,
525,
1762,
671,
421,
9536,
29918,
6310,
29922,
8824,
29952,
3114,
6030,
29892,
887,
881,
5712,
525,
13,
18884,
525,
29952,
657,
29918,
1972,
842,
2555,
322,
9479,
12020,
263,
29871,
29946,
29900,
29946,
373,
4069,
2346,
7224,
29889,
742,
13,
18884,
349,
2548,
8498,
3757,
362,
22709,
13,
9651,
1723,
13,
9651,
770,
29918,
978,
353,
1583,
17255,
1990,
1649,
17255,
978,
1649,
13,
9651,
1059,
29918,
7645,
353,
1583,
29889,
6310,
29918,
2704,
1273,
11117,
1990,
29918,
978,
2396,
770,
29918,
978,
29913,
13,
9651,
12020,
9056,
29946,
29900,
29946,
29898,
2704,
29918,
7645,
29897,
13,
13,
4706,
396,
278,
10203,
3381,
338,
451,
6969,
29892,
671,
9210,
322,
4046,
13,
4706,
7797,
3950,
353,
1583,
29889,
657,
29918,
15550,
3950,
29898,
1311,
29889,
3318,
29918,
1761,
29892,
1784,
29922,
5574,
29897,
13,
4706,
736,
1583,
29889,
17158,
29918,
1761,
29918,
5327,
29898,
1972,
29892,
1583,
29889,
3318,
29918,
1761,
29892,
7797,
3950,
29892,
9210,
29892,
4046,
29897,
13,
13,
13,
1990,
435,
3352,
3195,
1043,
2697,
29898,
28084,
1144,
29889,
4391,
3195,
29924,
861,
262,
29892,
13,
462,
268,
6837,
1144,
29889,
6422,
3195,
29924,
861,
262,
29892,
13,
462,
268,
6837,
1144,
29889,
14994,
4727,
3195,
29924,
861,
262,
29892,
13,
462,
268,
435,
3352,
1293,
8015,
29878,
2418,
1125,
13,
1678,
9995,
13,
1678,
319,
1776,
842,
393,
8128,
2322,
421,
3258,
16996,
421,
276,
509,
2418,
16996,
421,
5504,
16996,
13,
1678,
421,
3846,
29918,
5504,
16996,
421,
20524,
2555,
322,
421,
1761,
2555,
8820,
29889,
13,
1678,
541,
278,
1051,
674,
3743,
278,
982,
15040,
11460,
7882,
881,
664,
411,
4046,
29892,
9210,
13,
1678,
9995,
13,
1678,
1209,
13,
2
] |
archived-stock-trading-bot-v1/yf_extender.py | Allcallofduty10/stock-trading-bot | 101 | 35857 | <reponame>Allcallofduty10/stock-trading-bot
import sys
from datetime import datetime
import yfinance as yf
def get_ticker_symbol(ticker: yf.Ticker) -> str:
try:
return ticker.get_info()['symbol']
except ImportError:
return ""
def get_stock_state(ticker: yf.Ticker) -> {}:
stock_info = ticker.history("1d").iloc[0].to_dict()
stock_info['Time'] = datetime.now().strftime("%H:%M:%S")
del stock_info['Dividends']
del stock_info['Stock Splits']
return stock_info
# Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
def previous_high(ticker: yf.Ticker, time_period: str) -> float:
high = 0
stock_history = ticker.history(time_period)
for i in range(0, len(stock_history) - 2):
temp_high = stock_history.iloc[i].to_dict()['High']
if temp_high > high:
high = temp_high
return high
# Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
def calculate_sma(ticker: yf.Ticker, time_period="1mo", interval="1d") -> float:
stock_history = ticker.history(period=time_period, interval=interval)
summation = 0
time_period_days = 0
for i in range(0, len(stock_history) - 1):
summation += stock_history.iloc[i].to_dict()['Close']
time_period_days += 1
if time_period_days > 0:
return summation / time_period_days
return sys.maxsize
# Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
def calculate_ema(ticker: yf.Ticker, time_period="1mo") -> float:
stock_history = ticker.history(period=time_period)
return stock_history.iloc[len(stock_history) - 1].to_dict()['Close'] * (
2.5 / (1 + len(stock_history))) + calculate_sma(ticker, time_period) * (
1 - (2.5 / (1 + len(stock_history))))
# Valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
def calculate_previous_ema(ticker: yf.Ticker, time_period="1mo", days_previous=1) -> float:
time_period_days = len(ticker.history(period=time_period))
stock_history = ticker.history(period=time_period)
return stock_history.iloc[time_period_days - days_previous - 1].to_dict()['Close'] * (
2.5 / (1 + time_period_days)) + calculate_sma(ticker, time_period) * (
1 - (2.5 / (1 + time_period_days)))
def get_high2current_price_change_percent(ticker: yf.Ticker) -> float:
stock_info = ticker.history("1d").iloc[0].to_dict()
return (stock_info['Close'] - stock_info['High']) / stock_info['High']
def get_direction(ticker: yf.Ticker) -> float:
stock_history = ticker.history(period="1d", interval="1m")
return (stock_history.iloc[len(stock_history) - 1].to_dict()['Close'] - stock_history.iloc[len(stock_history) - 2].to_dict()['Close'])/stock_history.iloc[len(stock_history) - 2].to_dict()['Close']
| [
1,
529,
276,
1112,
420,
29958,
3596,
1052,
417,
11512,
329,
29891,
29896,
29900,
29914,
17712,
29899,
509,
9382,
29899,
7451,
13,
5215,
10876,
13,
3166,
12865,
1053,
12865,
13,
13,
5215,
343,
4951,
749,
408,
343,
29888,
13,
13,
13,
1753,
679,
29918,
29873,
6541,
29918,
18098,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29897,
1599,
851,
29901,
13,
1678,
1018,
29901,
13,
4706,
736,
260,
6541,
29889,
657,
29918,
3888,
580,
1839,
18098,
2033,
13,
1678,
5174,
16032,
2392,
29901,
13,
4706,
736,
5124,
13,
13,
13,
1753,
679,
29918,
17712,
29918,
3859,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29897,
1599,
426,
6177,
13,
1678,
10961,
29918,
3888,
353,
260,
6541,
29889,
18434,
703,
29896,
29881,
2564,
309,
542,
29961,
29900,
1822,
517,
29918,
8977,
580,
13,
1678,
10961,
29918,
3888,
1839,
2481,
2033,
353,
12865,
29889,
3707,
2141,
710,
615,
603,
11702,
29950,
16664,
29924,
16664,
29903,
1159,
13,
1678,
628,
10961,
29918,
3888,
1839,
29928,
3640,
1975,
2033,
13,
1678,
628,
10961,
29918,
3888,
1839,
20754,
384,
317,
572,
1169,
2033,
13,
1678,
736,
10961,
29918,
3888,
13,
13,
13,
29937,
15758,
23704,
29901,
29871,
29896,
29881,
29892,
29945,
29881,
29892,
29896,
4346,
29892,
29941,
4346,
29892,
29953,
4346,
29892,
29896,
29891,
29892,
29906,
29891,
29892,
29945,
29891,
29892,
29896,
29900,
29891,
29892,
29891,
1594,
29892,
3317,
13,
1753,
3517,
29918,
9812,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29892,
931,
29918,
19145,
29901,
851,
29897,
1599,
5785,
29901,
13,
1678,
1880,
353,
29871,
29900,
13,
1678,
10961,
29918,
18434,
353,
260,
6541,
29889,
18434,
29898,
2230,
29918,
19145,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
17712,
29918,
18434,
29897,
448,
29871,
29906,
1125,
13,
4706,
5694,
29918,
9812,
353,
10961,
29918,
18434,
29889,
309,
542,
29961,
29875,
1822,
517,
29918,
8977,
580,
1839,
16382,
2033,
13,
4706,
565,
5694,
29918,
9812,
1405,
1880,
29901,
13,
9651,
1880,
353,
5694,
29918,
9812,
13,
1678,
736,
1880,
13,
13,
13,
29937,
15758,
23704,
29901,
29871,
29896,
29881,
29892,
29945,
29881,
29892,
29896,
4346,
29892,
29941,
4346,
29892,
29953,
4346,
29892,
29896,
29891,
29892,
29906,
29891,
29892,
29945,
29891,
29892,
29896,
29900,
29891,
29892,
29891,
1594,
29892,
3317,
13,
1753,
8147,
29918,
29879,
655,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29892,
931,
29918,
19145,
543,
29896,
4346,
613,
7292,
543,
29896,
29881,
1159,
1599,
5785,
29901,
13,
1678,
10961,
29918,
18434,
353,
260,
6541,
29889,
18434,
29898,
19145,
29922,
2230,
29918,
19145,
29892,
7292,
29922,
19207,
29897,
13,
1678,
22792,
362,
353,
29871,
29900,
13,
1678,
931,
29918,
19145,
29918,
16700,
353,
29871,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
7431,
29898,
17712,
29918,
18434,
29897,
448,
29871,
29896,
1125,
13,
4706,
22792,
362,
4619,
10961,
29918,
18434,
29889,
309,
542,
29961,
29875,
1822,
517,
29918,
8977,
580,
1839,
11123,
2033,
13,
4706,
931,
29918,
19145,
29918,
16700,
4619,
29871,
29896,
13,
1678,
565,
931,
29918,
19145,
29918,
16700,
1405,
29871,
29900,
29901,
13,
4706,
736,
22792,
362,
847,
931,
29918,
19145,
29918,
16700,
13,
1678,
736,
10876,
29889,
3317,
2311,
13,
13,
13,
29937,
15758,
23704,
29901,
29871,
29896,
29881,
29892,
29945,
29881,
29892,
29896,
4346,
29892,
29941,
4346,
29892,
29953,
4346,
29892,
29896,
29891,
29892,
29906,
29891,
29892,
29945,
29891,
29892,
29896,
29900,
29891,
29892,
29891,
1594,
29892,
3317,
13,
1753,
8147,
29918,
2603,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29892,
931,
29918,
19145,
543,
29896,
4346,
1159,
1599,
5785,
29901,
13,
1678,
10961,
29918,
18434,
353,
260,
6541,
29889,
18434,
29898,
19145,
29922,
2230,
29918,
19145,
29897,
13,
1678,
736,
10961,
29918,
18434,
29889,
309,
542,
29961,
2435,
29898,
17712,
29918,
18434,
29897,
448,
29871,
29896,
1822,
517,
29918,
8977,
580,
1839,
11123,
2033,
334,
313,
13,
462,
29906,
29889,
29945,
847,
313,
29896,
718,
7431,
29898,
17712,
29918,
18434,
4961,
718,
8147,
29918,
29879,
655,
29898,
29873,
6541,
29892,
931,
29918,
19145,
29897,
334,
313,
13,
462,
1678,
29896,
448,
313,
29906,
29889,
29945,
847,
313,
29896,
718,
7431,
29898,
17712,
29918,
18434,
13697,
13,
13,
13,
29937,
15758,
23704,
29901,
29871,
29896,
29881,
29892,
29945,
29881,
29892,
29896,
4346,
29892,
29941,
4346,
29892,
29953,
4346,
29892,
29896,
29891,
29892,
29906,
29891,
29892,
29945,
29891,
29892,
29896,
29900,
29891,
29892,
29891,
1594,
29892,
3317,
13,
1753,
8147,
29918,
24957,
29918,
2603,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29892,
931,
29918,
19145,
543,
29896,
4346,
613,
3841,
29918,
24957,
29922,
29896,
29897,
1599,
5785,
29901,
13,
1678,
931,
29918,
19145,
29918,
16700,
353,
7431,
29898,
29873,
6541,
29889,
18434,
29898,
19145,
29922,
2230,
29918,
19145,
876,
13,
1678,
10961,
29918,
18434,
353,
260,
6541,
29889,
18434,
29898,
19145,
29922,
2230,
29918,
19145,
29897,
13,
1678,
736,
10961,
29918,
18434,
29889,
309,
542,
29961,
2230,
29918,
19145,
29918,
16700,
448,
3841,
29918,
24957,
448,
29871,
29896,
1822,
517,
29918,
8977,
580,
1839,
11123,
2033,
334,
313,
13,
632,
29906,
29889,
29945,
847,
313,
29896,
718,
931,
29918,
19145,
29918,
16700,
876,
718,
8147,
29918,
29879,
655,
29898,
29873,
6541,
29892,
931,
29918,
19145,
29897,
334,
313,
13,
462,
1678,
29896,
448,
313,
29906,
29889,
29945,
847,
313,
29896,
718,
931,
29918,
19145,
29918,
16700,
4961,
13,
13,
13,
1753,
679,
29918,
9812,
29906,
3784,
29918,
9175,
29918,
3167,
29918,
25376,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29897,
1599,
5785,
29901,
13,
1678,
10961,
29918,
3888,
353,
260,
6541,
29889,
18434,
703,
29896,
29881,
2564,
309,
542,
29961,
29900,
1822,
517,
29918,
8977,
580,
13,
1678,
736,
313,
17712,
29918,
3888,
1839,
11123,
2033,
448,
10961,
29918,
3888,
1839,
16382,
11287,
847,
10961,
29918,
3888,
1839,
16382,
2033,
13,
13,
13,
1753,
679,
29918,
20845,
29898,
29873,
6541,
29901,
343,
29888,
29889,
29911,
6541,
29897,
1599,
5785,
29901,
13,
1678,
10961,
29918,
18434,
353,
260,
6541,
29889,
18434,
29898,
19145,
543,
29896,
29881,
613,
7292,
543,
29896,
29885,
1159,
13,
1678,
736,
313,
17712,
29918,
18434,
29889,
309,
542,
29961,
2435,
29898,
17712,
29918,
18434,
29897,
448,
29871,
29896,
1822,
517,
29918,
8977,
580,
1839,
11123,
2033,
448,
10961,
29918,
18434,
29889,
309,
542,
29961,
2435,
29898,
17712,
29918,
18434,
29897,
448,
29871,
29906,
1822,
517,
29918,
8977,
580,
1839,
11123,
2033,
6802,
17712,
29918,
18434,
29889,
309,
542,
29961,
2435,
29898,
17712,
29918,
18434,
29897,
448,
29871,
29906,
1822,
517,
29918,
8977,
580,
1839,
11123,
2033,
13,
2
] |
regenerate_api.py | gregsmi/sample-metadata | 0 | 144522 | #!/usr/bin/env python3
# pylint: disable=logging-not-lazy,subprocess-popen-preexec-fn,consider-using-with
import argparse
import logging
import os
import re
import shutil
import signal
import subprocess
import tempfile
import time
from typing import List, Optional
import requests
MODULE_NAME = 'sample_metadata'
LOCAL_SCHEMA_PORT = os.getenv('PORT', '8000')
DEFAULT_SCHEMA_URL = f'http://localhost:{LOCAL_SCHEMA_PORT}/openapi.json'
DEFAULT_HOST_URL = 'http://localhost:8000'
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
def check_if_server_is_accessible(schema_url: str) -> bool:
"""Check if request to 'schema_url' returns OK"""
try:
return requests.get(schema_url).ok
except requests.ConnectionError:
return False
def start_server(
schema_url: str,
api_host_url: Optional[str],
docker_image: Optional[str]
) -> Optional[subprocess.Popen]:
"""Start the API server if necessary, and return a process when it's started"""
# Check if the schema endpoint is already running.
if check_if_server_is_accessible(schema_url):
if docker_image:
raise Exception(f'Can\'t run docker image - server already running at {schema_url}')
if api_host_url:
logger.warning(f'Server already running - can\'t apply api_host_url {api_host_url}')
logger.info(f'Using already running server {schema_url}')
return None
if not api_host_url:
api_host_url = os.getenv('SM_HOST_URL', DEFAULT_HOST_URL)
command = ['python', '-m', 'api.server']
if docker_image is not None:
command = [
'docker',
'run',
'-p8000:8000',
f'-eSM_HOST_URL={api_host_url}',
docker_image,
*command
]
logger.info('Starting local API server with: ' + ' '.join(command))
logger.info('Generated schema server endpoint will be ' + api_host_url)
_process = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
env={**os.environ, 'SM_HOST_URL':api_host_url},
# The os.setsid() is passed in the argument preexec_fn so
# it's run after the fork() and before exec() to run the shell.
preexec_fn=os.setsid,
)
assert _process.stdout
for c in iter(_process.stdout.readline, 'b'):
line = None
if c:
line = c.decode('utf-8').rstrip()
if line is not None:
logger.info('API: ' + line)
if 'running on http' in line.lower():
# server has been started
logger.info('Started process')
return _process
rc = _process.poll()
if rc is not None:
# the process exited early
logger.error(f'Server exited with rc={rc}')
raise SystemExit(1)
return None
def check_openapi_version(openapi_command: List[str]):
"""
Check compatible OpenAPI version
"""
command = [*openapi_command, '--version']
out = subprocess.check_output(command).decode().split('\n', maxsplit=1)[0].strip()
version_match = re.search(pattern=r'\d+\.\d+\.\d+', string=out)
if not version_match:
raise Exception(f'Could not detect version of openapi-generator from "{out}"')
version = version_match.group()
major = version.split('.')[0]
if int(major) != 5:
raise Exception(f'openapi-generator must be version 5.x.x, received: {version}')
def generate_api_and_copy(gen_command: List[str], output_copyer):
"""
Use OpenApiGenerator to generate the installable API
"""
tmpdir = tempfile.mkdtemp()
command = gen_command + ['-o', tmpdir]
logger.info('Generating with command: ' + ' '.join(command))
n_attempts = 1
succeeded = False
for i in range(n_attempts, 0, -1):
try:
stdout = subprocess.check_output(command)
logger.info('Generated API: ' + str(stdout.decode()))
succeeded = True
break
except subprocess.CalledProcessError as e:
logger.warning(f'openapi generation failed, trying {i-1} more times: {e}')
time.sleep(2)
if succeeded:
output_copyer(tmpdir)
shutil.rmtree(tmpdir)
def copy_typescript_files_from(tmpdir):
"""Copy typescript files to web/src/sm-api/"""
files_to_ignore = {
'README.md',
'.gitignore',
'.npmignore',
'.openapi-generator',
'.openapi-generator-ignore',
'git_push.sh',
}
dir_to_copy_to = 'web/src/sm-api/' # should be relative to this script
dir_to_copy_from = tmpdir
if not os.path.exists(dir_to_copy_to):
os.makedirs(dir_to_copy_to)
if not os.path.exists(dir_to_copy_from):
raise FileNotFoundError(
f"Directory to copy from doesn't exist ({dir_to_copy_from})"
)
# remove everything from dir_to_copy_to except those in files_to_ignore
logger.info('Removing files from dest directory ' + dir_to_copy_to)
for file_to_remove in os.listdir(dir_to_copy_to):
if file_to_remove in files_to_ignore:
continue
path_to_remove = os.path.join(dir_to_copy_to, file_to_remove)
if os.path.isdir(path_to_remove):
shutil.rmtree(path_to_remove)
else:
os.remove(path_to_remove)
files_to_copy = os.listdir(dir_to_copy_from)
logger.info(f'Copying {len(files_to_copy)} files / directories to {dir_to_copy_to}')
for file_to_copy in files_to_copy:
if file_to_copy in files_to_ignore:
continue
path_to_copy = os.path.join(dir_to_copy_from, file_to_copy)
output_path = os.path.join(dir_to_copy_to, file_to_copy)
if os.path.isdir(path_to_copy):
shutil.copytree(path_to_copy, output_path)
else:
shutil.copy(path_to_copy, output_path)
def copy_python_files_from(tmpdir):
"""
Copy a selection of API files generated from openapi-generator:
FROM: $tmpdir/sample_metadata
TO: ./sample_metadata
This clears the ./sample_metadata folder except for 'files_to_ignore'.
"""
files_to_ignore = {'README.md', 'parser'}
module_dir = MODULE_NAME.replace('.', '/')
dir_to_copy_to = module_dir # should be relative to this script
dir_to_copy_from = os.path.join(tmpdir, module_dir)
if not os.path.exists(dir_to_copy_to):
raise FileNotFoundError(
f"Directory to copy to doesn't exist ({dir_to_copy_to})"
)
if not os.path.exists(dir_to_copy_from):
raise FileNotFoundError(
f"Directory to copy from doesn't exist ({dir_to_copy_from})"
)
# remove everything from dir_to_copy_to except those in files_to_ignore
logger.info('Removing files from dest directory ' + dir_to_copy_to)
for file_to_remove in os.listdir(dir_to_copy_to):
if file_to_remove in files_to_ignore:
continue
path_to_remove = os.path.join(dir_to_copy_to, file_to_remove)
if os.path.isdir(path_to_remove):
shutil.rmtree(path_to_remove)
else:
os.remove(path_to_remove)
files_to_copy = os.listdir(dir_to_copy_from)
logger.info(f'Copying {len(files_to_copy)} files / directories to {dir_to_copy_to}')
for file_to_copy in files_to_copy:
if file_to_copy in files_to_ignore:
continue
path_to_copy = os.path.join(dir_to_copy_from, file_to_copy)
output_path = os.path.join(dir_to_copy_to, file_to_copy)
if os.path.isdir(path_to_copy):
shutil.copytree(path_to_copy, output_path)
else:
shutil.copy(path_to_copy, output_path)
docs_dir = os.path.join(tmpdir, 'docs')
static_dir = 'web/src/static'
output_docs_dir = os.path.join(static_dir, 'sm_docs')
if os.path.exists(output_docs_dir):
shutil.rmtree(output_docs_dir)
if not os.path.exists(static_dir):
os.makedirs(static_dir)
shutil.copytree(docs_dir, output_docs_dir)
shutil.copy(
os.path.join(tmpdir, 'README.md'), os.path.join(output_docs_dir, 'README.md')
)
shutil.copy('README.md', os.path.join(output_docs_dir, 'index.md'))
def stop_server(process):
if process:
pid = process.pid
logger.info(f'Stopping self-managed server by sending sigkill to {pid}')
os.killpg(
os.getpgid(process.pid), signal.SIGTERM
) # Send the signal to all the process groups
def main(args):
"""
Generates installable python API using:
- Start API server (if applicable);
- Call openapi-generator to generate python API to temp folder;
- Empty the 'sample_metadata' folder (except for some files);
- Copy relevant files to 'sample_metadata' in CWD;
- Stop the server (if applicable)
"""
openapi_command = args.openapi_command.split(' ')
check_openapi_version(openapi_command)
with open('deploy/python/version.txt', encoding='utf-8') as f:
version = f.read().strip()
process = start_server(args.schema_url, args.api_host_url, args.docker_image)
base_command = [
*openapi_command,
'generate',
*('-i', args.schema_url),
*('--package-name', MODULE_NAME),
*('--artifact-version', version),
'--skip-validate-spec',
]
try:
# Generate Python client, copying md docs to web/static/sm_docs directory.
command = base_command + ['-g', 'python'] + ['--template-dir', 'openapi-templates']
generate_api_and_copy(command, copy_python_files_from)
# Generate Typescript client and copy to web/sm-api directory.
command = base_command + ['-g', 'typescript-axios']
generate_api_and_copy(command, copy_typescript_files_from)
# pylint: disable=broad-except
except BaseException as e:
logger.error(str(e))
stop_server(process)
raise e
stop_server(process)
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description=(
"Generates sample_metadata Python and Typescript library code from a "
"sample-metadata API server OpenAPI schema endpoint. Starts a "
"local server if the schema endpoint is not already available."
)
)
parser.add_argument(
"-o",
"--openapi-command",
action="store",
type=str,
default="openapi-generator",
help=(
"OpenApi command syntax used to generate the library from the server endpoint. "
"(Default: 'openapi-generator')"
)
)
parser.add_argument(
"-s",
"--schema-url",
action="store",
type=str,
default=DEFAULT_SCHEMA_URL,
help=f"OpenApi schema host endpoint. (Default: '{DEFAULT_SCHEMA_URL}')"
)
parser.add_argument(
"-a",
"--api-host-url",
action="store",
type=str,
help=(
"Url configured as the default host API endpoint in the generated Python/Typescript code."
f"(Default: the value of SM_HOST_URL, if set, or '{DEFAULT_HOST_URL}' otherwise)"
)
)
parser.add_argument(
"-d",
"--docker-image",
action="store",
type=str,
help="[optional] Docker image to run to serve up the OpenApi endpoint. Cannot be already running."
)
main(parser.parse_args())
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
21027,
29899,
1333,
29899,
433,
1537,
29892,
1491,
5014,
29899,
29886,
3150,
29899,
1457,
4258,
29899,
9144,
29892,
3200,
1241,
29899,
4746,
29899,
2541,
13,
5215,
1852,
5510,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
337,
13,
5215,
528,
4422,
13,
5215,
7182,
13,
5215,
1014,
5014,
13,
5215,
5694,
1445,
13,
5215,
931,
13,
3166,
19229,
1053,
2391,
29892,
28379,
13,
13,
5215,
7274,
13,
13,
6720,
14849,
1307,
29918,
5813,
353,
525,
11249,
29918,
19635,
29915,
13,
16652,
1964,
29918,
29903,
3210,
26862,
29918,
15082,
353,
2897,
29889,
657,
6272,
877,
15082,
742,
525,
29947,
29900,
29900,
29900,
1495,
13,
23397,
29918,
29903,
3210,
26862,
29918,
4219,
353,
285,
29915,
1124,
597,
7640,
26254,
16652,
1964,
29918,
29903,
3210,
26862,
29918,
15082,
6822,
3150,
2754,
29889,
3126,
29915,
13,
23397,
29918,
20832,
29918,
4219,
353,
525,
1124,
597,
7640,
29901,
29947,
29900,
29900,
29900,
29915,
13,
13,
21027,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
18525,
29897,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
1423,
29918,
361,
29918,
2974,
29918,
275,
29918,
5943,
1821,
29898,
11010,
29918,
2271,
29901,
851,
29897,
1599,
6120,
29901,
13,
1678,
9995,
5596,
565,
2009,
304,
525,
11010,
29918,
2271,
29915,
3639,
9280,
15945,
29908,
13,
1678,
1018,
29901,
13,
4706,
736,
7274,
29889,
657,
29898,
11010,
29918,
2271,
467,
554,
13,
1678,
5174,
7274,
29889,
5350,
2392,
29901,
13,
4706,
736,
7700,
13,
13,
13,
1753,
1369,
29918,
2974,
29898,
13,
1678,
10938,
29918,
2271,
29901,
851,
29892,
29871,
13,
1678,
7882,
29918,
3069,
29918,
2271,
29901,
28379,
29961,
710,
1402,
29871,
13,
1678,
10346,
29918,
3027,
29901,
28379,
29961,
710,
29962,
13,
29897,
1599,
28379,
29961,
1491,
5014,
29889,
29925,
3150,
5387,
13,
1678,
9995,
4763,
278,
3450,
1923,
565,
5181,
29892,
322,
736,
263,
1889,
746,
372,
29915,
29879,
4687,
15945,
29908,
13,
13,
1678,
396,
5399,
565,
278,
10938,
16248,
338,
2307,
2734,
29889,
13,
1678,
565,
1423,
29918,
361,
29918,
2974,
29918,
275,
29918,
5943,
1821,
29898,
11010,
29918,
2271,
1125,
13,
4706,
565,
10346,
29918,
3027,
29901,
13,
9651,
12020,
8960,
29898,
29888,
29915,
6028,
20333,
29873,
1065,
10346,
1967,
448,
1923,
2307,
2734,
472,
426,
11010,
29918,
2271,
29913,
1495,
13,
4706,
565,
7882,
29918,
3069,
29918,
2271,
29901,
13,
9651,
17927,
29889,
27392,
29898,
29888,
29915,
6004,
2307,
2734,
448,
508,
20333,
29873,
3394,
7882,
29918,
3069,
29918,
2271,
426,
2754,
29918,
3069,
29918,
2271,
29913,
1495,
13,
4706,
17927,
29889,
3888,
29898,
29888,
29915,
15156,
2307,
2734,
1923,
426,
11010,
29918,
2271,
29913,
1495,
13,
4706,
736,
6213,
13,
268,
13,
1678,
565,
451,
7882,
29918,
3069,
29918,
2271,
29901,
13,
4706,
7882,
29918,
3069,
29918,
2271,
353,
2897,
29889,
657,
6272,
877,
17061,
29918,
20832,
29918,
4219,
742,
22236,
29918,
20832,
29918,
4219,
29897,
13,
13,
1678,
1899,
353,
6024,
4691,
742,
17411,
29885,
742,
525,
2754,
29889,
2974,
2033,
13,
13,
1678,
565,
10346,
29918,
3027,
338,
451,
6213,
29901,
13,
4706,
1899,
353,
518,
13,
9651,
525,
14695,
742,
13,
9651,
525,
3389,
742,
13,
9651,
17411,
29886,
29947,
29900,
29900,
29900,
29901,
29947,
29900,
29900,
29900,
742,
13,
9651,
285,
28560,
29872,
17061,
29918,
20832,
29918,
4219,
3790,
2754,
29918,
3069,
29918,
2271,
29913,
742,
13,
9651,
10346,
29918,
3027,
29892,
13,
9651,
334,
6519,
13,
4706,
4514,
13,
13,
1678,
17927,
29889,
3888,
877,
4763,
292,
1887,
3450,
1923,
411,
29901,
525,
718,
525,
15300,
7122,
29898,
6519,
876,
13,
1678,
17927,
29889,
3888,
877,
24565,
10938,
1923,
16248,
674,
367,
525,
718,
7882,
29918,
3069,
29918,
2271,
29897,
13,
13,
1678,
903,
5014,
353,
1014,
5014,
29889,
29925,
3150,
29898,
13,
4706,
1899,
29892,
13,
4706,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29892,
13,
4706,
380,
20405,
29922,
1491,
5014,
29889,
1254,
3970,
2692,
29892,
13,
4706,
8829,
3790,
1068,
359,
29889,
21813,
29892,
525,
17061,
29918,
20832,
29918,
4219,
2396,
2754,
29918,
3069,
29918,
2271,
1118,
13,
4706,
396,
450,
2897,
29889,
7224,
333,
580,
338,
4502,
297,
278,
2980,
758,
4258,
29918,
9144,
577,
13,
4706,
396,
372,
29915,
29879,
1065,
1156,
278,
27350,
580,
322,
1434,
29871,
2279,
580,
304,
1065,
278,
6473,
29889,
13,
4706,
758,
4258,
29918,
9144,
29922,
359,
29889,
7224,
333,
29892,
13,
1678,
1723,
13,
13,
1678,
4974,
903,
5014,
29889,
25393,
13,
1678,
363,
274,
297,
4256,
7373,
5014,
29889,
25393,
29889,
949,
1220,
29892,
525,
29890,
29374,
13,
4706,
1196,
353,
6213,
13,
4706,
565,
274,
29901,
13,
9651,
1196,
353,
274,
29889,
13808,
877,
9420,
29899,
29947,
2824,
29878,
17010,
580,
13,
9651,
565,
1196,
338,
451,
6213,
29901,
13,
18884,
17927,
29889,
3888,
877,
8787,
29901,
525,
718,
1196,
29897,
13,
18884,
565,
525,
21094,
373,
1732,
29915,
297,
1196,
29889,
13609,
7295,
13,
462,
1678,
396,
1923,
756,
1063,
4687,
13,
462,
1678,
17927,
29889,
3888,
877,
4763,
287,
1889,
1495,
13,
462,
1678,
736,
903,
5014,
13,
13,
4706,
364,
29883,
353,
903,
5014,
29889,
29886,
3028,
580,
13,
4706,
565,
364,
29883,
338,
451,
6213,
29901,
13,
9651,
396,
278,
1889,
429,
1573,
4688,
13,
9651,
17927,
29889,
2704,
29898,
29888,
29915,
6004,
429,
1573,
411,
364,
29883,
3790,
2214,
29913,
1495,
13,
9651,
12020,
2184,
24365,
29898,
29896,
29897,
13,
13,
1678,
736,
6213,
13,
13,
13,
1753,
1423,
29918,
3150,
2754,
29918,
3259,
29898,
3150,
2754,
29918,
6519,
29901,
2391,
29961,
710,
29962,
1125,
13,
1678,
9995,
13,
1678,
5399,
15878,
4673,
8787,
1873,
13,
1678,
9995,
13,
1678,
1899,
353,
518,
29930,
3150,
2754,
29918,
6519,
29892,
525,
489,
3259,
2033,
13,
1678,
714,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
6519,
467,
13808,
2141,
5451,
28909,
29876,
742,
4236,
5451,
29922,
29896,
9601,
29900,
1822,
17010,
580,
13,
1678,
1873,
29918,
4352,
353,
337,
29889,
4478,
29898,
11037,
29922,
29878,
12764,
29881,
3124,
7790,
29881,
3124,
7790,
29881,
29974,
742,
1347,
29922,
449,
29897,
13,
1678,
565,
451,
1873,
29918,
4352,
29901,
13,
4706,
12020,
8960,
29898,
29888,
29915,
23323,
451,
6459,
1873,
310,
1722,
2754,
29899,
27959,
515,
29850,
449,
5038,
1495,
13,
13,
1678,
1873,
353,
1873,
29918,
4352,
29889,
2972,
580,
13,
1678,
4655,
353,
1873,
29889,
5451,
12839,
29861,
29900,
29962,
13,
1678,
565,
938,
29898,
21355,
29897,
2804,
29871,
29945,
29901,
13,
4706,
12020,
8960,
29898,
29888,
29915,
3150,
2754,
29899,
27959,
1818,
367,
1873,
29871,
29945,
29889,
29916,
29889,
29916,
29892,
4520,
29901,
426,
3259,
29913,
1495,
13,
13,
13,
1753,
5706,
29918,
2754,
29918,
392,
29918,
8552,
29898,
1885,
29918,
6519,
29901,
2391,
29961,
710,
1402,
1962,
29918,
8552,
261,
1125,
13,
1678,
9995,
13,
1678,
4803,
4673,
11713,
21575,
304,
5706,
278,
2601,
519,
3450,
13,
1678,
9995,
13,
1678,
13128,
3972,
353,
5694,
1445,
29889,
11256,
29881,
7382,
580,
13,
1678,
1899,
353,
2531,
29918,
6519,
718,
6024,
29899,
29877,
742,
13128,
3972,
29962,
13,
1678,
17927,
29889,
3888,
877,
5631,
1218,
411,
1899,
29901,
525,
718,
525,
15300,
7122,
29898,
6519,
876,
13,
13,
1678,
302,
29918,
1131,
3456,
29879,
353,
29871,
29896,
13,
1678,
14792,
353,
7700,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
29918,
1131,
3456,
29879,
29892,
29871,
29900,
29892,
448,
29896,
1125,
13,
4706,
1018,
29901,
13,
9651,
27591,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
6519,
29897,
13,
9651,
17927,
29889,
3888,
877,
24565,
3450,
29901,
525,
718,
851,
29898,
25393,
29889,
13808,
22130,
13,
9651,
14792,
353,
5852,
13,
9651,
2867,
13,
13,
4706,
5174,
1014,
5014,
29889,
29907,
4212,
7032,
2392,
408,
321,
29901,
13,
9651,
17927,
29889,
27392,
29898,
29888,
29915,
3150,
2754,
12623,
5229,
29892,
1811,
426,
29875,
29899,
29896,
29913,
901,
3064,
29901,
426,
29872,
29913,
1495,
13,
9651,
931,
29889,
17059,
29898,
29906,
29897,
13,
13,
1678,
565,
14792,
29901,
13,
4706,
1962,
29918,
8552,
261,
29898,
7050,
3972,
29897,
13,
4706,
528,
4422,
29889,
1758,
8336,
29898,
7050,
3972,
29897,
13,
13,
13,
1753,
3509,
29918,
8768,
924,
29918,
5325,
29918,
3166,
29898,
7050,
3972,
1125,
13,
1678,
9995,
11882,
23741,
2066,
304,
1856,
29914,
4351,
29914,
3844,
29899,
2754,
12975,
15945,
13,
1678,
2066,
29918,
517,
29918,
17281,
353,
426,
13,
4706,
525,
16310,
2303,
29889,
3487,
742,
13,
4706,
15300,
5559,
17281,
742,
13,
4706,
15300,
14963,
17281,
742,
13,
4706,
15300,
3150,
2754,
29899,
27959,
742,
13,
4706,
15300,
3150,
2754,
29899,
27959,
29899,
17281,
742,
13,
4706,
525,
5559,
29918,
5910,
29889,
845,
742,
13,
1678,
500,
13,
13,
1678,
4516,
29918,
517,
29918,
8552,
29918,
517,
353,
525,
2676,
29914,
4351,
29914,
3844,
29899,
2754,
22208,
29871,
396,
881,
367,
6198,
304,
445,
2471,
13,
1678,
4516,
29918,
517,
29918,
8552,
29918,
3166,
353,
13128,
3972,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
29897,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3972,
29918,
517,
29918,
8552,
29918,
3166,
1125,
13,
4706,
12020,
3497,
17413,
2392,
29898,
13,
9651,
285,
29908,
9882,
304,
3509,
515,
1838,
29915,
29873,
1863,
21313,
3972,
29918,
517,
29918,
8552,
29918,
3166,
1800,
29908,
13,
4706,
1723,
13,
13,
1678,
396,
3349,
4129,
515,
4516,
29918,
517,
29918,
8552,
29918,
517,
5174,
1906,
297,
2066,
29918,
517,
29918,
17281,
13,
1678,
17927,
29889,
3888,
877,
7301,
21081,
2066,
515,
2731,
3884,
525,
718,
4516,
29918,
517,
29918,
8552,
29918,
517,
29897,
13,
1678,
363,
934,
29918,
517,
29918,
5992,
297,
2897,
29889,
1761,
3972,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
1125,
13,
4706,
565,
934,
29918,
517,
29918,
5992,
297,
2066,
29918,
517,
29918,
17281,
29901,
13,
9651,
6773,
13,
4706,
2224,
29918,
517,
29918,
5992,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
29892,
934,
29918,
517,
29918,
5992,
29897,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
2084,
29918,
517,
29918,
5992,
1125,
13,
9651,
528,
4422,
29889,
1758,
8336,
29898,
2084,
29918,
517,
29918,
5992,
29897,
13,
4706,
1683,
29901,
13,
9651,
2897,
29889,
5992,
29898,
2084,
29918,
517,
29918,
5992,
29897,
13,
13,
1678,
2066,
29918,
517,
29918,
8552,
353,
2897,
29889,
1761,
3972,
29898,
3972,
29918,
517,
29918,
8552,
29918,
3166,
29897,
13,
1678,
17927,
29889,
3888,
29898,
29888,
29915,
11882,
292,
426,
2435,
29898,
5325,
29918,
517,
29918,
8552,
2915,
2066,
847,
17525,
304,
426,
3972,
29918,
517,
29918,
8552,
29918,
517,
29913,
1495,
13,
1678,
363,
934,
29918,
517,
29918,
8552,
297,
2066,
29918,
517,
29918,
8552,
29901,
13,
4706,
565,
934,
29918,
517,
29918,
8552,
297,
2066,
29918,
517,
29918,
17281,
29901,
13,
9651,
6773,
13,
13,
4706,
2224,
29918,
517,
29918,
8552,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
517,
29918,
8552,
29918,
3166,
29892,
934,
29918,
517,
29918,
8552,
29897,
13,
4706,
1962,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
29892,
934,
29918,
517,
29918,
8552,
29897,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
2084,
29918,
517,
29918,
8552,
1125,
13,
9651,
528,
4422,
29889,
8552,
8336,
29898,
2084,
29918,
517,
29918,
8552,
29892,
1962,
29918,
2084,
29897,
13,
4706,
1683,
29901,
13,
9651,
528,
4422,
29889,
8552,
29898,
2084,
29918,
517,
29918,
8552,
29892,
1962,
29918,
2084,
29897,
13,
13,
13,
1753,
3509,
29918,
4691,
29918,
5325,
29918,
3166,
29898,
7050,
3972,
1125,
13,
1678,
9995,
13,
1678,
14187,
263,
9262,
310,
3450,
2066,
5759,
515,
1722,
2754,
29899,
27959,
29901,
13,
13,
4706,
3895,
29901,
259,
395,
7050,
3972,
29914,
11249,
29918,
19635,
13,
4706,
7495,
29901,
268,
11431,
11249,
29918,
19635,
13,
13,
1678,
910,
4531,
1503,
278,
11431,
11249,
29918,
19635,
4138,
5174,
363,
525,
5325,
29918,
517,
29918,
17281,
4286,
13,
1678,
9995,
13,
13,
1678,
2066,
29918,
517,
29918,
17281,
353,
11117,
16310,
2303,
29889,
3487,
742,
525,
16680,
10827,
13,
13,
1678,
3883,
29918,
3972,
353,
341,
13668,
29965,
1307,
29918,
5813,
29889,
6506,
12839,
742,
8207,
1495,
13,
1678,
4516,
29918,
517,
29918,
8552,
29918,
517,
353,
3883,
29918,
3972,
29871,
396,
881,
367,
6198,
304,
445,
2471,
13,
1678,
4516,
29918,
517,
29918,
8552,
29918,
3166,
353,
2897,
29889,
2084,
29889,
7122,
29898,
7050,
3972,
29892,
3883,
29918,
3972,
29897,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
1125,
13,
4706,
12020,
3497,
17413,
2392,
29898,
13,
9651,
285,
29908,
9882,
304,
3509,
304,
1838,
29915,
29873,
1863,
21313,
3972,
29918,
517,
29918,
8552,
29918,
517,
1800,
29908,
13,
4706,
1723,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3972,
29918,
517,
29918,
8552,
29918,
3166,
1125,
13,
4706,
12020,
3497,
17413,
2392,
29898,
13,
9651,
285,
29908,
9882,
304,
3509,
515,
1838,
29915,
29873,
1863,
21313,
3972,
29918,
517,
29918,
8552,
29918,
3166,
1800,
29908,
13,
4706,
1723,
13,
13,
1678,
396,
3349,
4129,
515,
4516,
29918,
517,
29918,
8552,
29918,
517,
5174,
1906,
297,
2066,
29918,
517,
29918,
17281,
13,
1678,
17927,
29889,
3888,
877,
7301,
21081,
2066,
515,
2731,
3884,
525,
718,
4516,
29918,
517,
29918,
8552,
29918,
517,
29897,
13,
1678,
363,
934,
29918,
517,
29918,
5992,
297,
2897,
29889,
1761,
3972,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
1125,
13,
4706,
565,
934,
29918,
517,
29918,
5992,
297,
2066,
29918,
517,
29918,
17281,
29901,
13,
9651,
6773,
13,
4706,
2224,
29918,
517,
29918,
5992,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
29892,
934,
29918,
517,
29918,
5992,
29897,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
2084,
29918,
517,
29918,
5992,
1125,
13,
9651,
528,
4422,
29889,
1758,
8336,
29898,
2084,
29918,
517,
29918,
5992,
29897,
13,
4706,
1683,
29901,
13,
9651,
2897,
29889,
5992,
29898,
2084,
29918,
517,
29918,
5992,
29897,
13,
13,
1678,
2066,
29918,
517,
29918,
8552,
353,
2897,
29889,
1761,
3972,
29898,
3972,
29918,
517,
29918,
8552,
29918,
3166,
29897,
13,
1678,
17927,
29889,
3888,
29898,
29888,
29915,
11882,
292,
426,
2435,
29898,
5325,
29918,
517,
29918,
8552,
2915,
2066,
847,
17525,
304,
426,
3972,
29918,
517,
29918,
8552,
29918,
517,
29913,
1495,
13,
1678,
363,
934,
29918,
517,
29918,
8552,
297,
2066,
29918,
517,
29918,
8552,
29901,
13,
4706,
565,
934,
29918,
517,
29918,
8552,
297,
2066,
29918,
517,
29918,
17281,
29901,
13,
9651,
6773,
13,
13,
4706,
2224,
29918,
517,
29918,
8552,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
517,
29918,
8552,
29918,
3166,
29892,
934,
29918,
517,
29918,
8552,
29897,
13,
4706,
1962,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
517,
29918,
8552,
29918,
517,
29892,
934,
29918,
517,
29918,
8552,
29897,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
2084,
29918,
517,
29918,
8552,
1125,
13,
9651,
528,
4422,
29889,
8552,
8336,
29898,
2084,
29918,
517,
29918,
8552,
29892,
1962,
29918,
2084,
29897,
13,
4706,
1683,
29901,
13,
9651,
528,
4422,
29889,
8552,
29898,
2084,
29918,
517,
29918,
8552,
29892,
1962,
29918,
2084,
29897,
13,
13,
1678,
10561,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
7050,
3972,
29892,
525,
2640,
1495,
13,
1678,
2294,
29918,
3972,
353,
525,
2676,
29914,
4351,
29914,
7959,
29915,
13,
1678,
1962,
29918,
2640,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
7959,
29918,
3972,
29892,
525,
3844,
29918,
2640,
1495,
13,
1678,
565,
2897,
29889,
2084,
29889,
9933,
29898,
4905,
29918,
2640,
29918,
3972,
1125,
13,
4706,
528,
4422,
29889,
1758,
8336,
29898,
4905,
29918,
2640,
29918,
3972,
29897,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
7959,
29918,
3972,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
7959,
29918,
3972,
29897,
13,
1678,
528,
4422,
29889,
8552,
8336,
29898,
2640,
29918,
3972,
29892,
1962,
29918,
2640,
29918,
3972,
29897,
13,
1678,
528,
4422,
29889,
8552,
29898,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
7050,
3972,
29892,
525,
16310,
2303,
29889,
3487,
5477,
2897,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
2640,
29918,
3972,
29892,
525,
16310,
2303,
29889,
3487,
1495,
13,
1678,
1723,
13,
1678,
528,
4422,
29889,
8552,
877,
16310,
2303,
29889,
3487,
742,
2897,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
2640,
29918,
3972,
29892,
525,
2248,
29889,
3487,
8785,
13,
13,
13,
1753,
5040,
29918,
2974,
29898,
5014,
1125,
13,
1678,
565,
1889,
29901,
13,
4706,
23107,
353,
1889,
29889,
5935,
13,
4706,
17927,
29889,
3888,
29898,
29888,
29915,
20754,
3262,
1583,
29899,
25240,
1923,
491,
9348,
4365,
21174,
304,
426,
5935,
29913,
1495,
13,
4706,
2897,
29889,
21174,
4061,
29898,
13,
9651,
2897,
29889,
657,
4061,
333,
29898,
5014,
29889,
5935,
511,
7182,
29889,
5425,
29954,
4945,
29924,
13,
4706,
1723,
29871,
396,
15076,
278,
7182,
304,
599,
278,
1889,
6471,
13,
13,
13,
1753,
1667,
29898,
5085,
1125,
13,
1678,
9995,
13,
1678,
3251,
1078,
2601,
519,
3017,
3450,
773,
29901,
13,
4706,
448,
7370,
3450,
1923,
313,
361,
22903,
416,
13,
4706,
448,
8251,
1722,
2754,
29899,
27959,
304,
5706,
3017,
3450,
304,
5694,
4138,
29936,
13,
4706,
448,
2812,
2349,
278,
525,
11249,
29918,
19635,
29915,
4138,
313,
19499,
363,
777,
2066,
416,
13,
4706,
448,
14187,
8018,
2066,
304,
525,
11249,
29918,
19635,
29915,
297,
315,
24668,
29936,
13,
4706,
448,
22303,
278,
1923,
313,
361,
22903,
29897,
13,
13,
1678,
9995,
13,
1678,
1722,
2754,
29918,
6519,
353,
6389,
29889,
3150,
2754,
29918,
6519,
29889,
5451,
877,
25710,
13,
1678,
1423,
29918,
3150,
2754,
29918,
3259,
29898,
3150,
2754,
29918,
6519,
29897,
13,
13,
1678,
411,
1722,
877,
16519,
29914,
4691,
29914,
3259,
29889,
3945,
742,
8025,
2433,
9420,
29899,
29947,
1495,
408,
285,
29901,
13,
4706,
1873,
353,
285,
29889,
949,
2141,
17010,
580,
13,
13,
1678,
1889,
353,
1369,
29918,
2974,
29898,
5085,
29889,
11010,
29918,
2271,
29892,
6389,
29889,
2754,
29918,
3069,
29918,
2271,
29892,
6389,
29889,
14695,
29918,
3027,
29897,
13,
13,
1678,
2967,
29918,
6519,
353,
518,
13,
4706,
334,
3150,
2754,
29918,
6519,
29892,
13,
4706,
525,
17158,
742,
13,
4706,
334,
877,
29899,
29875,
742,
6389,
29889,
11010,
29918,
2271,
511,
13,
4706,
334,
877,
489,
5113,
29899,
978,
742,
341,
13668,
29965,
1307,
29918,
5813,
511,
13,
4706,
334,
877,
489,
8813,
29899,
3259,
742,
1873,
511,
13,
4706,
525,
489,
11014,
29899,
15480,
29899,
6550,
742,
13,
1678,
4514,
13,
13,
1678,
1018,
29901,
13,
4706,
396,
3251,
403,
5132,
3132,
29892,
17596,
22821,
10561,
304,
1856,
29914,
7959,
29914,
3844,
29918,
2640,
3884,
29889,
13,
4706,
1899,
353,
2967,
29918,
6519,
718,
6024,
29899,
29887,
742,
525,
4691,
2033,
718,
6024,
489,
6886,
29899,
3972,
742,
525,
3150,
2754,
29899,
20943,
2033,
13,
4706,
5706,
29918,
2754,
29918,
392,
29918,
8552,
29898,
6519,
29892,
3509,
29918,
4691,
29918,
5325,
29918,
3166,
29897,
13,
4706,
396,
3251,
403,
28025,
924,
3132,
322,
3509,
304,
1856,
29914,
3844,
29899,
2754,
3884,
29889,
13,
4706,
1899,
353,
2967,
29918,
6519,
718,
6024,
29899,
29887,
742,
525,
8768,
924,
29899,
1165,
2363,
2033,
13,
4706,
5706,
29918,
2754,
29918,
392,
29918,
8552,
29898,
6519,
29892,
3509,
29918,
8768,
924,
29918,
5325,
29918,
3166,
29897,
13,
1678,
396,
282,
2904,
524,
29901,
11262,
29922,
6729,
328,
29899,
19499,
13,
1678,
5174,
7399,
2451,
408,
321,
29901,
13,
4706,
17927,
29889,
2704,
29898,
710,
29898,
29872,
876,
13,
4706,
5040,
29918,
2974,
29898,
5014,
29897,
13,
4706,
12020,
321,
13,
13,
1678,
5040,
29918,
2974,
29898,
5014,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
7607,
13,
9651,
376,
5631,
1078,
4559,
29918,
19635,
5132,
322,
28025,
924,
3489,
775,
515,
263,
376,
13,
9651,
376,
11249,
29899,
19635,
3450,
1923,
4673,
8787,
10938,
16248,
29889,
624,
5708,
263,
376,
13,
9651,
376,
2997,
1923,
565,
278,
10938,
16248,
338,
451,
2307,
3625,
1213,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29877,
613,
13,
4706,
376,
489,
3150,
2754,
29899,
6519,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
2322,
543,
3150,
2754,
29899,
27959,
613,
13,
4706,
1371,
7607,
13,
9651,
376,
6585,
11713,
1899,
5877,
1304,
304,
5706,
278,
3489,
515,
278,
1923,
16248,
29889,
376,
13,
9651,
18227,
4592,
29901,
525,
3150,
2754,
29899,
27959,
1495,
29908,
13,
4706,
1723,
13,
1678,
1723,
268,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29879,
613,
13,
4706,
376,
489,
11010,
29899,
2271,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
2322,
29922,
23397,
29918,
29903,
3210,
26862,
29918,
4219,
29892,
13,
4706,
1371,
29922,
29888,
29908,
6585,
11713,
10938,
3495,
16248,
29889,
313,
4592,
29901,
22372,
23397,
29918,
29903,
3210,
26862,
29918,
4219,
29913,
1495,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29874,
613,
13,
4706,
376,
489,
2754,
29899,
3069,
29899,
2271,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
7607,
13,
9651,
376,
5983,
13252,
408,
278,
2322,
3495,
3450,
16248,
297,
278,
5759,
5132,
29914,
10562,
924,
775,
1213,
13,
9651,
285,
29908,
29898,
4592,
29901,
278,
995,
310,
13766,
29918,
20832,
29918,
4219,
29892,
565,
731,
29892,
470,
22372,
23397,
29918,
20832,
29918,
4219,
10162,
6467,
5513,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29881,
613,
13,
4706,
376,
489,
14695,
29899,
3027,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
1134,
29922,
710,
29892,
13,
4706,
1371,
543,
29961,
25253,
29962,
20868,
1967,
304,
1065,
304,
9080,
701,
278,
4673,
11713,
16248,
29889,
15808,
367,
2307,
2734,
1213,
13,
1678,
1723,
268,
13,
13,
1678,
1667,
29898,
16680,
29889,
5510,
29918,
5085,
3101,
13,
2
] |
main.py | duyvu1991/license-plate-detection- | 0 | 50268 | <reponame>duyvu1991/license-plate-detection-
from flask import Flask, render_template
from blueprints import *
app = Flask(__name__)
app.register_blueprint(home)
app.register_blueprint(upload_api)
if __name__ == '__main__':
app.run(debug = True, host='127.0.0.1', port=5001)
| [
1,
529,
276,
1112,
420,
29958,
700,
29891,
24845,
29896,
29929,
29929,
29896,
29914,
506,
1947,
29899,
2341,
29899,
29881,
2650,
428,
29899,
13,
3166,
29784,
1053,
2379,
1278,
29892,
4050,
29918,
6886,
13,
3166,
7254,
2158,
29879,
1053,
334,
13,
13,
932,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
932,
29889,
9573,
29918,
9539,
2158,
29898,
5184,
29897,
13,
932,
29889,
9573,
29918,
9539,
2158,
29898,
9009,
29918,
2754,
29897,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
623,
29889,
3389,
29898,
8382,
353,
5852,
29892,
3495,
2433,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
742,
2011,
29922,
29945,
29900,
29900,
29896,
29897,
13,
2
] |
evoTurb_python/CalcCohx.py | YC-SWE/evoTurb | 2 | 153273 | # -*- coding: utf-8 -*-
"""
CalcCohx
function: calculate the longitudinal coherence
------------------------------------------------------------------------------------
Usage
Cohx,ConfigParameters = CalcCohx(ConfigParameters)
-----------------------------------------------------------------------------------
Inputs
ConfigParameters: -dict, configuration parameters
---------------------------------------------------------------------------------
Outputs
ConfigParameters: configuration parameters, -dict
Cohx: longitudinal coherence
- 3D array, with size of (Nplanes,Nplanes,number of freq)
--------------------------------------------------------------------------------
References
1.'Exp-UserDefined' uses the wind evolution model (Eq.4) and
'Exp-Simley' uses the wind evolution model (Eq.7) and in
# Simley, E., & Pao, L. Y. (2015).
# A longitudinal spatial coherence model for wind evolution based on large-eddy simulation.
# In 2015 American Control Conference (ACC) (pp. 3708–3714). IEEE.
# https://doi.org/10.1109/ACC.2015.7171906
This model is acquired from LES simulations.
2.'Kristensen' uses the wind evolution model (Eq.20) and G-function (Eq.29) in
# Kristensen, L. (1979).
# On longitudinal spectral coherence.
# Boundary-Layer Meteorology, 16(2), 145–153.
# https://doi.org/10.1007/BF02350508
This model is based on physical deduction.
3.'Exp-GPR' uses the wind evolution model (Eq.6) and
the GPR models case 15 for a and case 17 for b (Table5) in
# Chen, Y., Schlipf, D., & Cheng, P. W. (2021).
# Parameterization of wind evolution using lidar.
# Wind Energy Science, 6(1), 61–91.
# https://doi.org/10.5194/wes-6-61-2021
The GPR models are trained with measurement data from an onshore flat site.
Due to the limitation of the training data, it is not recommended to
use the GPR models for the cases where the separations between the unfrozen planes exceed 109 m.
----------------------------------------------------------------------------------------------------
Created on 20.06.2021
<NAME> (c) University of Stuttgart
<NAME> (c) Flensburg University of Applied Sciences
----------------------------------------------------------------------------------------------------
Modified
"""
# import libirary
from scipy.spatial.distance import cdist
import numpy as np
import math
# import scipy.io as sio
def CalcCohx(ConfigParameters):
# spatial distance x
X = np.reshape(ConfigParameters['Xpos'],(ConfigParameters['Nplanes'],1),order="F")
X = np.concatenate((X,0*X),axis=1)
r_x = np.reshape(cdist(X, X),(ConfigParameters['Nplanes']**2,1),order="F")
if ConfigParameters['EvoModel']!='Exp-UserDefined':
# calculate wind statistics to determine wind evolution model parameters
if ConfigParameters['TurbModel']=='Kaimal':
# Check Turbulence Class
# Iref: expected value of the turbulence intensity at 15 m/s. (IEC61400-1:2005 p.22)
# Note that IRef is defined as the mean value in this edition of the standard rather than as a representative value.
if ConfigParameters['TurbClass']=='A+':
Iref=0.18
elif ConfigParameters['TurbClass']=='A':
Iref=0.16
elif ConfigParameters['TurbClass']=='B':
Iref=0.14
elif ConfigParameters['TurbClass']=='C':
Iref=0.12
else:
raise ValueError('Wrong turbulence class. Please define IEC turbulence Class as A+, A, B, or C.')
# sigma_u: the representative value of the turbulence standard deviation,
# shall be given by the 90# quantile for the given hub height wind speed (IEC61400-1:2005 p.24)
sigma_u = Iref*(0.75*ConfigParameters['Uref']+5.6)
sigma_v = sigma_u*0.8
sigma_w = sigma_u*0.5
sigma_total = math.sqrt(sigma_u**2+sigma_v**2+sigma_w**2)
# Lambda = longitudinal turbulence scale parameter
if ConfigParameters['Href'] > 60:
Lambda = 42
else:
Lambda = 0.7*ConfigParameters['Href']
# Integral length scale
Lu = 8.1*Lambda
# save the parameters
ConfigParameters['sigma_u'] = sigma_u
ConfigParameters['sigma_v'] = sigma_v
ConfigParameters['sigma_w'] = sigma_w
ConfigParameters['L_u'] = Lu
elif ConfigParameters['TurbModel']=='Mann':
sigma_total = math.sqrt(ConfigParameters['sigma_u']**2+ConfigParameters['sigma_v']**2+ConfigParameters['sigma_w']**2)
Lu = ConfigParameters['L_u']
# coherence x
if ConfigParameters['EvoModel'] == 'Exp-UserDefined':
Cohx_squared = np.exp(-ConfigParameters['evo_a']*np.sqrt((ConfigParameters['f']*r_x/ConfigParameters['Uref'])**2+\
(ConfigParameters['evo_b']*r_x)**2))
elif ConfigParameters['EvoModel'] == 'Exp-Simley':
ConfigParameters['evo_a'] = 8.4*sigma_total/ConfigParameters['Uref']+0.05
ConfigParameters['evo_b'] = 0.25*Lu**(-1.24)
Cohx_squared = np.exp(-ConfigParameters['evo_a']*np.sqrt((ConfigParameters['f']*r_x/ConfigParameters['Uref'])**2+\
(ConfigParameters['evo_b']*r_x)**2))
elif ConfigParameters['EvoModel'] == 'Kristensen':
xi = ConfigParameters['f']*Lu/ConfigParameters['Uref']
alpha = sigma_total/ConfigParameters['Uref']*r_x/Lu
G = 33**(-2/3)*(33*xi)**2*(33*xi+3/11)**0.5/(33*xi+1)**(11/6)
m = 2*(alpha<=1)+1*(alpha>1)
Cohx_squared = np.exp(-2*alpha*G)*(1-np.exp(-1/(2*alpha**m*xi**2)))**2
# =============================================================================
# elif ConfigParameters['EvoModel'] == 'Exp-GPR':
# GPRmdl = sio.loadmat('ExpGPR.mat')
# predictor_a = struct2table(struct('V_long_mean',ConfigParameters.Uref,...
# 'V_vert_std',ConfigParameters.sigma_w,'DirError',0))
# predictor_b = struct2table(struct('V_long_mean',ConfigParameters.Uref*ones(size(r_x)),...
# 'V_long_TI_U',ConfigParameters.sigma_u/ConfigParameters.Uref*ones(size(r_x)),...
# 'V_long_skew',zeros(size(r_x)),'V_long_kurt',zeros(size(r_x)),...
# 'V_lat_skew',zeros(size(r_x)),'V_vert_skew',zeros(size(r_x)),...
# 'vlos_d',r_x))
# ConfigParameters.evo_a = predict(cgprMdl_a,predictor_a)
# ConfigParameters.evo_b = predict(cgprMdl_b,predictor_b)
# ConfigParameters.evo_b(predictor_b.vlos_d==0)=0
# Cohx_squared = exp(-sqrt(ConfigParameters.evo_a.^2.*(ConfigParameters.f.*r_x./ConfigParameters.Uref).^2+...
# ConfigParameters.evo_b.^2))
# =============================================================================
Cohx = np.reshape(np.sqrt(Cohx_squared),(ConfigParameters['Nplanes'],ConfigParameters['Nplanes'],len(ConfigParameters['f'])),order="F")
return Cohx,ConfigParameters
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
15945,
19451,
13,
7856,
29883,
29907,
1148,
29916,
30004,
13,
2220,
29901,
8147,
278,
25579,
979,
16165,
261,
663,
30004,
13,
2683,
2683,
2683,
2683,
2683,
807,
30004,
13,
27573,
30004,
13,
29907,
1148,
29916,
29892,
3991,
11507,
353,
3037,
29883,
29907,
1148,
29916,
29898,
3991,
11507,
8443,
13,
2683,
2683,
2683,
2683,
2683,
5634,
30004,
13,
4290,
29879,
30004,
13,
3991,
11507,
29901,
448,
8977,
29892,
5285,
4128,
6756,
13,
2683,
2683,
2683,
2683,
2683,
29899,
30004,
13,
6466,
29879,
30004,
13,
3991,
11507,
29901,
5285,
4128,
29892,
448,
8977,
6756,
13,
29907,
1148,
29916,
29901,
25579,
979,
16165,
261,
663,
30004,
13,
539,
448,
29871,
29941,
29928,
1409,
29892,
411,
2159,
310,
313,
29940,
9018,
267,
29892,
29940,
9018,
267,
29892,
4537,
310,
3005,
29939,
29897,
6756,
13,
2683,
2683,
2683,
2683,
2683,
30004,
13,
1123,
10662,
30004,
13,
29896,
6169,
9544,
29899,
2659,
3206,
1312,
29915,
3913,
278,
8805,
14675,
1904,
313,
18630,
29889,
29946,
29897,
322,
30004,
13,
29871,
525,
9544,
29899,
8942,
2330,
29915,
3913,
278,
8805,
14675,
1904,
313,
18630,
29889,
29955,
29897,
322,
297,
30004,
13,
4706,
396,
3439,
2330,
29892,
30081,
29923,
1696,
669,
2621,
29877,
29892,
30081,
29931,
29889,
30081,
29979,
29889,
313,
29906,
29900,
29896,
29945,
467,
6756,
13,
4706,
396,
319,
25579,
979,
18652,
16165,
261,
663,
1904,
363,
8805,
14675,
2729,
373,
2919,
29899,
287,
4518,
17402,
29889,
6756,
13,
4706,
396,
512,
29871,
29906,
29900,
29896,
29945,
3082,
11264,
16377,
313,
2477,
29907,
29897,
313,
407,
29889,
30081,
29941,
29955,
29900,
29947,
29994,
29941,
29955,
29896,
29946,
467,
7159,
17896,
29889,
6756,
13,
4706,
396,
2045,
597,
1867,
29875,
29889,
990,
29914,
29896,
29900,
29889,
29896,
29896,
29900,
29929,
29914,
2477,
29907,
29889,
29906,
29900,
29896,
29945,
29889,
29955,
29896,
29955,
29896,
29929,
29900,
29953,
30004,
13,
259,
910,
1904,
338,
16692,
515,
365,
2890,
23876,
22993,
13,
30004,
13,
29906,
6169,
29968,
2021,
14762,
29915,
3913,
278,
8805,
14675,
1904,
313,
18630,
29889,
29906,
29900,
29897,
322,
402,
29899,
2220,
313,
18630,
29889,
29906,
29929,
29897,
297,
30004,
13,
4706,
396,
17773,
14762,
29892,
30081,
29931,
29889,
313,
29896,
29929,
29955,
29929,
467,
6756,
13,
4706,
396,
1551,
25579,
979,
23161,
16165,
261,
663,
29889,
6756,
13,
4706,
396,
350,
618,
653,
29899,
14420,
29573,
3002,
29892,
29871,
29896,
29953,
29898,
29906,
511,
29871,
29896,
29946,
29945,
29994,
29896,
29945,
29941,
29889,
6756,
13,
4706,
396,
2045,
597,
1867,
29875,
29889,
990,
29914,
29896,
29900,
29889,
29896,
29900,
29900,
29955,
29914,
28062,
29900,
29906,
29941,
29945,
29900,
29945,
29900,
29947,
30004,
13,
259,
910,
1904,
338,
2729,
373,
9128,
21049,
428,
22993,
13,
1678,
6756,
13,
29941,
6169,
9544,
29899,
29954,
10593,
29915,
3913,
278,
8805,
14675,
1904,
313,
18630,
29889,
29953,
29897,
322,
6756,
13,
259,
278,
402,
10593,
4733,
1206,
29871,
29896,
29945,
363,
263,
322,
1206,
29871,
29896,
29955,
363,
289,
313,
3562,
29945,
29897,
297,
30004,
13,
4706,
396,
21589,
29892,
30081,
29979,
1696,
1102,
3466,
29888,
29892,
30081,
29928,
1696,
669,
678,
996,
29892,
30081,
29925,
29889,
30081,
29956,
29889,
313,
29906,
29900,
29906,
29896,
467,
6756,
13,
4706,
396,
24953,
2133,
310,
8805,
14675,
773,
17343,
279,
29889,
6756,
13,
4706,
396,
17311,
24836,
9327,
29892,
29871,
29953,
29898,
29896,
511,
29871,
29953,
29896,
29994,
29929,
29896,
29889,
6756,
13,
4706,
396,
2045,
597,
1867,
29875,
29889,
990,
29914,
29896,
29900,
29889,
29945,
29896,
29929,
29946,
29914,
29893,
267,
29899,
29953,
29899,
29953,
29896,
29899,
29906,
29900,
29906,
29896,
30004,
13,
259,
450,
402,
10593,
4733,
526,
16370,
411,
20039,
848,
515,
385,
373,
845,
487,
12151,
3268,
22993,
13,
259,
16809,
304,
278,
29485,
310,
278,
6694,
848,
29892,
372,
338,
451,
13622,
304,
6756,
13,
259,
671,
278,
402,
10593,
4733,
363,
278,
4251,
988,
278,
2903,
800,
1546,
278,
29395,
307,
2256,
3814,
267,
13461,
29871,
29896,
29900,
29929,
286,
22993,
13,
2683,
2683,
2683,
2683,
2683,
2683,
807,
30004,
13,
20399,
373,
29871,
29906,
29900,
29889,
29900,
29953,
29889,
29906,
29900,
29906,
29896,
6756,
13,
29966,
5813,
29958,
1678,
313,
29883,
29897,
3014,
310,
15402,
6756,
13,
29966,
5813,
29958,
418,
313,
29883,
29897,
2379,
575,
3074,
3014,
310,
2401,
2957,
17253,
30004,
13,
2683,
2683,
2683,
2683,
2683,
2683,
807,
30004,
13,
2111,
2164,
30004,
13,
30004,
13,
15945,
19451,
13,
30004,
13,
29937,
1053,
4303,
381,
653,
30004,
13,
3166,
4560,
2272,
29889,
1028,
15238,
29889,
19244,
1053,
274,
5721,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
5844,
30004,
13,
29937,
1053,
4560,
2272,
29889,
601,
408,
269,
601,
30004,
13,
30004,
13,
1753,
3037,
29883,
29907,
1148,
29916,
29898,
3991,
11507,
1125,
30004,
13,
30004,
13,
1678,
396,
18652,
5418,
921,
30004,
13,
1678,
1060,
353,
7442,
29889,
690,
14443,
29898,
3991,
11507,
1839,
29990,
1066,
7464,
29898,
3991,
11507,
1839,
29940,
9018,
267,
7464,
29896,
511,
2098,
543,
29943,
1159,
30004,
13,
1678,
1060,
353,
7442,
29889,
535,
29883,
2579,
403,
3552,
29990,
29892,
29900,
29930,
29990,
511,
8990,
29922,
29896,
8443,
13,
1678,
364,
29918,
29916,
353,
7442,
29889,
690,
14443,
29898,
2252,
391,
29898,
29990,
29892,
1060,
21336,
3991,
11507,
1839,
29940,
9018,
267,
2033,
1068,
29906,
29892,
29896,
511,
2098,
543,
29943,
1159,
259,
6756,
13,
1678,
6756,
13,
1678,
565,
12782,
11507,
1839,
29923,
1365,
3195,
2033,
29991,
2433,
9544,
29899,
2659,
3206,
1312,
2396,
30004,
13,
4706,
6756,
13,
4706,
396,
8147,
8805,
13964,
304,
8161,
8805,
14675,
1904,
4128,
259,
6756,
13,
4706,
565,
12782,
11507,
1839,
29911,
9265,
3195,
2033,
1360,
29915,
29968,
29874,
3039,
2396,
30004,
13,
268,
6756,
13,
9651,
396,
5399,
5383,
8645,
663,
4134,
30004,
13,
9651,
396,
306,
999,
29901,
3806,
995,
310,
278,
7013,
8645,
663,
26171,
472,
29871,
29896,
29945,
286,
29914,
29879,
29889,
313,
8673,
29907,
29953,
29896,
29946,
29900,
29900,
29899,
29896,
29901,
29906,
29900,
29900,
29945,
282,
29889,
29906,
29906,
8443,
13,
9651,
396,
539,
3940,
393,
306,
5620,
338,
3342,
408,
278,
2099,
995,
297,
445,
12203,
310,
278,
3918,
3265,
1135,
408,
263,
21097,
995,
29889,
4706,
6756,
13,
9651,
565,
12782,
11507,
1839,
29911,
9265,
2385,
2033,
1360,
29915,
29909,
29974,
2396,
30004,
13,
18884,
306,
999,
29922,
29900,
29889,
29896,
29947,
30004,
13,
9651,
25342,
12782,
11507,
1839,
29911,
9265,
2385,
2033,
1360,
29915,
29909,
2396,
30004,
13,
18884,
306,
999,
29922,
29900,
29889,
29896,
29953,
6756,
13,
9651,
25342,
12782,
11507,
1839,
29911,
9265,
2385,
2033,
1360,
29915,
29933,
2396,
30004,
13,
18884,
306,
999,
29922,
29900,
29889,
29896,
29946,
6756,
13,
9651,
25342,
12782,
11507,
1839,
29911,
9265,
2385,
2033,
1360,
29915,
29907,
2396,
30004,
13,
18884,
306,
999,
29922,
29900,
29889,
29896,
29906,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
12020,
7865,
2392,
877,
29956,
29373,
7013,
8645,
663,
770,
29889,
3529,
4529,
7159,
29907,
7013,
8645,
663,
4134,
408,
319,
29974,
29892,
319,
29892,
350,
29892,
470,
315,
29889,
1495,
30004,
13,
9651,
6756,
13,
9651,
396,
269,
2934,
29918,
29884,
29901,
278,
21097,
995,
310,
278,
7013,
8645,
663,
3918,
29522,
29892,
6756,
13,
9651,
396,
3986,
4091,
367,
2183,
491,
278,
29871,
29929,
29900,
29937,
4323,
488,
363,
278,
2183,
19766,
3171,
8805,
6210,
313,
8673,
29907,
29953,
29896,
29946,
29900,
29900,
29899,
29896,
29901,
29906,
29900,
29900,
29945,
282,
29889,
29906,
29946,
8443,
13,
9651,
269,
2934,
29918,
29884,
353,
306,
999,
16395,
29900,
29889,
29955,
29945,
29930,
3991,
11507,
1839,
29965,
999,
2033,
29974,
29945,
29889,
29953,
29897,
6756,
13,
9651,
269,
2934,
29918,
29894,
353,
269,
2934,
29918,
29884,
29930,
29900,
29889,
29947,
30004,
13,
9651,
269,
2934,
29918,
29893,
353,
269,
2934,
29918,
29884,
29930,
29900,
29889,
29945,
30004,
13,
9651,
269,
2934,
29918,
7827,
353,
5844,
29889,
3676,
29898,
3754,
29918,
29884,
1068,
29906,
29974,
3754,
29918,
29894,
1068,
29906,
29974,
3754,
29918,
29893,
1068,
29906,
8443,
13,
1678,
6756,
13,
9651,
396,
365,
2269,
353,
25579,
979,
7013,
8645,
663,
6287,
3443,
30004,
13,
9651,
565,
12782,
11507,
1839,
29950,
999,
2033,
1405,
29871,
29953,
29900,
29901,
30004,
13,
18884,
365,
2269,
353,
29871,
29946,
29906,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
365,
2269,
353,
29871,
29900,
29889,
29955,
29930,
3991,
11507,
1839,
29950,
999,
2033,
30004,
13,
1678,
6756,
13,
9651,
396,
17100,
284,
3309,
6287,
30004,
13,
9651,
3182,
353,
29871,
29947,
29889,
29896,
29930,
9099,
30004,
13,
9651,
6756,
13,
9651,
396,
4078,
278,
4128,
30004,
13,
9651,
12782,
11507,
1839,
3754,
29918,
29884,
2033,
353,
269,
2934,
29918,
29884,
30004,
13,
9651,
12782,
11507,
1839,
3754,
29918,
29894,
2033,
353,
269,
2934,
29918,
29894,
30004,
13,
9651,
12782,
11507,
1839,
3754,
29918,
29893,
2033,
353,
269,
2934,
29918,
29893,
30004,
13,
9651,
12782,
11507,
1839,
29931,
29918,
29884,
2033,
353,
3182,
30004,
13,
4706,
6756,
13,
4706,
25342,
12782,
11507,
1839,
29911,
9265,
3195,
2033,
1360,
29915,
29924,
812,
2396,
30004,
13,
9651,
6756,
13,
9651,
269,
2934,
29918,
7827,
353,
5844,
29889,
3676,
29898,
3991,
11507,
1839,
3754,
29918,
29884,
2033,
1068,
29906,
29974,
3991,
11507,
1839,
3754,
29918,
29894,
2033,
1068,
29906,
29974,
3991,
11507,
1839,
3754,
29918,
29893,
2033,
1068,
29906,
8443,
13,
9651,
3182,
353,
12782,
11507,
1839,
29931,
29918,
29884,
2033,
30004,
13,
1678,
6756,
13,
1678,
396,
16165,
261,
663,
921,
30004,
13,
1678,
565,
12782,
11507,
1839,
29923,
1365,
3195,
2033,
1275,
525,
9544,
29899,
2659,
3206,
1312,
2396,
30004,
13,
9651,
315,
1148,
29916,
29918,
26613,
1965,
353,
7442,
29889,
4548,
6278,
3991,
11507,
1839,
29872,
1365,
29918,
29874,
2033,
29930,
9302,
29889,
3676,
3552,
3991,
11507,
1839,
29888,
2033,
29930,
29878,
29918,
29916,
29914,
3991,
11507,
1839,
29965,
999,
11287,
1068,
29906,
3124,
30004,
13,
18884,
313,
3991,
11507,
1839,
29872,
1365,
29918,
29890,
2033,
29930,
29878,
29918,
29916,
29897,
1068,
29906,
876,
30004,
13,
4706,
6756,
13,
1678,
25342,
12782,
11507,
1839,
29923,
1365,
3195,
2033,
1275,
525,
9544,
29899,
8942,
2330,
2396,
30004,
13,
9651,
12782,
11507,
1839,
29872,
1365,
29918,
29874,
2033,
353,
29871,
29947,
29889,
29946,
29930,
3754,
29918,
7827,
29914,
3991,
11507,
1839,
29965,
999,
2033,
29974,
29900,
29889,
29900,
29945,
30004,
13,
9651,
12782,
11507,
1839,
29872,
1365,
29918,
29890,
2033,
353,
29871,
29900,
29889,
29906,
29945,
29930,
24126,
1068,
6278,
29896,
29889,
29906,
29946,
8443,
13,
9651,
315,
1148,
29916,
29918,
26613,
1965,
353,
7442,
29889,
4548,
6278,
3991,
11507,
1839,
29872,
1365,
29918,
29874,
2033,
29930,
9302,
29889,
3676,
3552,
3991,
11507,
1839,
29888,
2033,
29930,
29878,
29918,
29916,
29914,
3991,
11507,
1839,
29965,
999,
11287,
1068,
29906,
3124,
30004,
13,
18884,
313,
3991,
11507,
1839,
29872,
1365,
29918,
29890,
2033,
29930,
29878,
29918,
29916,
29897,
1068,
29906,
876,
30004,
13,
4706,
6756,
13,
1678,
25342,
12782,
11507,
1839,
29923,
1365,
3195,
2033,
1275,
525,
29968,
2021,
14762,
2396,
30004,
13,
9651,
921,
29875,
353,
12782,
11507,
1839,
29888,
2033,
29930,
24126,
29914,
3991,
11507,
1839,
29965,
999,
2033,
30004,
13,
9651,
15595,
353,
269,
2934,
29918,
7827,
29914,
3991,
11507,
1839,
29965,
999,
2033,
29930,
29878,
29918,
29916,
29914,
24126,
30004,
13,
9651,
402,
353,
29871,
29941,
29941,
1068,
6278,
29906,
29914,
29941,
11877,
29898,
29941,
29941,
29930,
5389,
29897,
1068,
29906,
16395,
29941,
29941,
29930,
5389,
29974,
29941,
29914,
29896,
29896,
29897,
1068,
29900,
29889,
29945,
14571,
29941,
29941,
29930,
5389,
29974,
29896,
29897,
1068,
29898,
29896,
29896,
29914,
29953,
8443,
13,
9651,
286,
353,
29871,
29906,
16395,
2312,
14065,
29896,
7240,
29896,
16395,
2312,
29958,
29896,
8443,
13,
9651,
315,
1148,
29916,
29918,
26613,
1965,
353,
7442,
29889,
4548,
6278,
29906,
29930,
2312,
29930,
29954,
11877,
29898,
29896,
29899,
9302,
29889,
4548,
6278,
29896,
14571,
29906,
29930,
2312,
1068,
29885,
29930,
5389,
1068,
29906,
4961,
1068,
29906,
30004,
13,
9651,
6756,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
25512,
30004,
13,
29937,
268,
25342,
12782,
11507,
1839,
29923,
1365,
3195,
2033,
1275,
525,
9544,
29899,
29954,
10593,
2396,
30004,
13,
29937,
632,
402,
10593,
3487,
29880,
353,
269,
601,
29889,
1359,
2922,
877,
9544,
29954,
10593,
29889,
2922,
1495,
6756,
13,
29937,
632,
8500,
272,
29918,
29874,
353,
2281,
29906,
2371,
29898,
4984,
877,
29963,
29918,
5426,
29918,
12676,
742,
3991,
11507,
29889,
29965,
999,
29892,
856,
30004,
13,
29937,
462,
525,
29963,
29918,
1765,
29918,
4172,
742,
3991,
11507,
29889,
3754,
29918,
29893,
5501,
9170,
2392,
742,
29900,
876,
30004,
13,
29937,
632,
8500,
272,
29918,
29890,
353,
2281,
29906,
2371,
29898,
4984,
877,
29963,
29918,
5426,
29918,
12676,
742,
3991,
11507,
29889,
29965,
999,
29930,
2873,
29898,
2311,
29898,
29878,
29918,
29916,
8243,
856,
30004,
13,
29937,
462,
525,
29963,
29918,
5426,
29918,
24301,
29918,
29965,
742,
3991,
11507,
29889,
3754,
29918,
29884,
29914,
3991,
11507,
29889,
29965,
999,
29930,
2873,
29898,
2311,
29898,
29878,
29918,
29916,
8243,
856,
30004,
13,
29937,
462,
525,
29963,
29918,
5426,
29918,
26050,
29893,
742,
3298,
359,
29898,
2311,
29898,
29878,
29918,
29916,
8243,
29915,
29963,
29918,
5426,
29918,
29895,
4227,
742,
3298,
359,
29898,
2311,
29898,
29878,
29918,
29916,
8243,
856,
30004,
13,
29937,
462,
525,
29963,
29918,
5066,
29918,
26050,
29893,
742,
3298,
359,
29898,
2311,
29898,
29878,
29918,
29916,
8243,
29915,
29963,
29918,
1765,
29918,
26050,
29893,
742,
3298,
359,
29898,
2311,
29898,
29878,
29918,
29916,
8243,
856,
30004,
13,
29937,
462,
525,
29894,
5409,
29918,
29881,
742,
29878,
29918,
29916,
876,
30004,
13,
29937,
632,
12782,
11507,
29889,
29872,
1365,
29918,
29874,
353,
8500,
29898,
29883,
29887,
558,
29924,
11671,
29918,
29874,
29892,
27711,
272,
29918,
29874,
8443,
13,
29937,
632,
12782,
11507,
29889,
29872,
1365,
29918,
29890,
353,
8500,
29898,
29883,
29887,
558,
29924,
11671,
29918,
29890,
29892,
27711,
272,
29918,
29890,
8443,
13,
29937,
632,
12782,
11507,
29889,
29872,
1365,
29918,
29890,
29898,
27711,
272,
29918,
29890,
29889,
29894,
5409,
29918,
29881,
1360,
29900,
3892,
29900,
6756,
13,
29937,
632,
315,
1148,
29916,
29918,
26613,
1965,
353,
1518,
6278,
3676,
29898,
3991,
11507,
29889,
29872,
1365,
29918,
29874,
29889,
29985,
29906,
5575,
29898,
3991,
11507,
29889,
29888,
5575,
29878,
29918,
29916,
6904,
3991,
11507,
29889,
29965,
999,
467,
29985,
29906,
29974,
856,
30004,
13,
29937,
462,
12782,
11507,
29889,
29872,
1365,
29918,
29890,
29889,
29985,
29906,
876,
30004,
13,
29937,
1275,
9166,
9166,
9166,
9166,
4936,
25512,
30004,
13,
308,
6756,
13,
1678,
6756,
13,
1678,
315,
1148,
29916,
353,
7442,
29889,
690,
14443,
29898,
9302,
29889,
3676,
29898,
29907,
1148,
29916,
29918,
26613,
1965,
21336,
3991,
11507,
1839,
29940,
9018,
267,
7464,
3991,
11507,
1839,
29940,
9018,
267,
7464,
2435,
29898,
3991,
11507,
1839,
29888,
2033,
8243,
2098,
543,
29943,
1159,
30004,
13,
30004,
13,
1678,
736,
315,
1148,
29916,
29892,
3991,
11507,
30004,
13,
2
] |
core/utils/network/sms.py | vsilent/smarty-bot | 1 | 113412 | <filename>core/utils/network/sms.py
from twilio.rest import TwilioRestClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "AC32a3c49700934481addd5ce1659f04d2"
auth_token = ""
client = TwilioRestClient(account_sid, auth_token)
message = client.sms.messages.create(body="Jenny please?! I love you <3",
to="+14159352345", # Replace with your phone number
from_="+14158141829") # Replace with your Twilio number
print message.sid
| [
1,
529,
9507,
29958,
3221,
29914,
13239,
29914,
11618,
29914,
29879,
1516,
29889,
2272,
13,
3166,
3252,
14876,
29889,
5060,
1053,
8168,
14876,
15078,
4032,
13,
29937,
3575,
16535,
19732,
322,
13189,
25159,
515,
3252,
14876,
29889,
510,
29914,
1792,
29914,
10149,
13,
10149,
29918,
29879,
333,
353,
376,
2477,
29941,
29906,
29874,
29941,
29883,
29946,
29929,
29955,
29900,
29900,
29929,
29941,
29946,
29946,
29947,
29896,
1202,
29881,
29945,
346,
29896,
29953,
29945,
29929,
29888,
29900,
29946,
29881,
29906,
29908,
13,
5150,
29918,
6979,
353,
5124,
13,
4645,
353,
8168,
14876,
15078,
4032,
29898,
10149,
29918,
29879,
333,
29892,
4817,
29918,
6979,
29897,
13,
4906,
353,
3132,
29889,
29879,
1516,
29889,
19158,
29889,
3258,
29898,
2587,
543,
29967,
264,
1460,
3113,
29973,
29991,
306,
5360,
366,
529,
29941,
613,
13,
517,
543,
29974,
29896,
29946,
29896,
29945,
29929,
29941,
29945,
29906,
29941,
29946,
29945,
613,
396,
22108,
411,
596,
9008,
1353,
13,
3166,
29918,
543,
29974,
29896,
29946,
29896,
29945,
29947,
29896,
29946,
29896,
29947,
29906,
29929,
1159,
396,
22108,
411,
596,
8168,
14876,
1353,
13,
2158,
2643,
29889,
29879,
333,
13,
2
] |
BBmap_scrapper/main.py | Cpt-Graby/web_scrapping | 0 | 72291 | import requests
from bs4 import BeautifulSoup
import random
import time
random.seed(60)
def get_page(url):
"""
Simple funtion that get the url with requests and return a bs4 object.
:param (str): The string of the url
:return: bs4 object
"""
try:
req = requests.get(url)
return BeautifulSoup(req.text, 'html.parser')
except requests.exceptions.RequestException:
print("Could load the page: {}".format(url))
def get_link_dicegrimorium():
"""
Funtion that returns all the links where to download the sample
:return: list of links
"""
bs = get_page('https://dicegrimorium.com/free-rpg-map-library/')
try:
content_images = bs.find_all('figure', {'class': 'wp-block-image size-large'})
links_page = []
for content in content_images:
links_page.append(content.find('a').get('href'))
return links_page
except:
print("""Some thing went wrong at the import of 'figure',
{'class': 'wp-block-image size-large'}""")
def dl_zip_dicegrimorium(url, title):
"""
:param url:
:param title:
:return:
"""
try:
r = requests.get(url, allow_redirects=True)
with open(title + ".zip", 'wb') as dl_file:
dl_file.write(r.content)
except:
print(f'Fail download: {title}')
def import_link_zip_dicegrimorium(links_pages):
"""
Given a list, this function will get all the href off the zip file in the url that are in the list.
"""
list_dl = []
list_wait_time = []
total_dl = len(links_pages)
iteration = 1
for i in links_pages:
index_fail = 0
if index_fail > 4:
break
try:
"""Making some verbose"""
print(f'{iteration}/{total_dl}')
index_fail = 0
wait_time = random.randint(10, 90)
list_wait_time.append(wait_time)
"""Main scraper"""
bs = get_page(i)
title_zip = bs.h2.text.replace(" ", "-").replace(".", "-").replace('\t', '').replace('\n', '').replace('--',
'')
print(title_zip)
dl_link = bs.find('figcaption').a.get('href')
dl_zip_dicegrimorium(dl_link, title_zip)
list_dl.append((title_zip, dl_link))
time.sleep(wait_time)
"""verbose _done"""
print(f'DL{iteration}/{total_dl}: done in {wait_time}')
iteration += 1
except:
print(f"Somethig went wrong with the {iteration}:{i}.\n")
index_fail += 1
return list_dl
def main_dicegrimorium():
all_links = get_link_dicegrimorium()
list_zip = import_link_zip_dicegrimorium(all_links)
return None
links = get_link_dicegrimorium()
print(import_link_zip_dicegrimorium(links))
| [
1,
1053,
7274,
13,
3166,
24512,
29946,
1053,
25685,
29903,
1132,
13,
5215,
4036,
13,
5215,
931,
13,
13,
8172,
29889,
26776,
29898,
29953,
29900,
29897,
13,
13,
13,
1753,
679,
29918,
3488,
29898,
2271,
1125,
13,
1678,
9995,
13,
418,
12545,
285,
1657,
291,
393,
679,
278,
3142,
411,
7274,
322,
736,
263,
24512,
29946,
1203,
29889,
13,
418,
584,
3207,
29871,
313,
710,
1125,
450,
1347,
310,
278,
3142,
13,
418,
584,
2457,
29901,
24512,
29946,
1203,
13,
418,
9995,
13,
1678,
1018,
29901,
13,
4706,
12428,
353,
7274,
29889,
657,
29898,
2271,
29897,
13,
4706,
736,
25685,
29903,
1132,
29898,
7971,
29889,
726,
29892,
525,
1420,
29889,
16680,
1495,
13,
1678,
5174,
7274,
29889,
11739,
29879,
29889,
3089,
2451,
29901,
13,
4706,
1596,
703,
23323,
2254,
278,
1813,
29901,
6571,
1642,
4830,
29898,
2271,
876,
13,
13,
13,
1753,
679,
29918,
2324,
29918,
27774,
4872,
326,
272,
1974,
7295,
13,
1678,
9995,
13,
1678,
383,
1657,
291,
393,
3639,
599,
278,
2988,
988,
304,
5142,
278,
4559,
13,
1678,
584,
2457,
29901,
1051,
310,
2988,
13,
1678,
9995,
13,
1678,
24512,
353,
679,
29918,
3488,
877,
991,
597,
27774,
4872,
326,
272,
1974,
29889,
510,
29914,
9021,
29899,
29878,
4061,
29899,
1958,
29899,
5258,
29914,
1495,
13,
1678,
1018,
29901,
13,
4706,
2793,
29918,
8346,
353,
24512,
29889,
2886,
29918,
497,
877,
4532,
742,
11117,
1990,
2396,
525,
11912,
29899,
1271,
29899,
3027,
2159,
29899,
16961,
29915,
1800,
13,
4706,
2988,
29918,
3488,
353,
5159,
13,
4706,
363,
2793,
297,
2793,
29918,
8346,
29901,
13,
9651,
2988,
29918,
3488,
29889,
4397,
29898,
3051,
29889,
2886,
877,
29874,
2824,
657,
877,
12653,
8785,
13,
4706,
736,
2988,
29918,
3488,
13,
1678,
5174,
29901,
13,
4706,
1596,
703,
15945,
9526,
2655,
3512,
2743,
472,
278,
1053,
310,
525,
4532,
742,
13,
308,
11117,
1990,
2396,
525,
11912,
29899,
1271,
29899,
3027,
2159,
29899,
16961,
29915,
5038,
29908,
1159,
13,
13,
13,
1753,
270,
29880,
29918,
7554,
29918,
27774,
4872,
326,
272,
1974,
29898,
2271,
29892,
3611,
1125,
13,
1678,
9995,
13,
13,
1678,
584,
3207,
3142,
29901,
13,
1678,
584,
3207,
3611,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
1018,
29901,
13,
4706,
364,
353,
7274,
29889,
657,
29898,
2271,
29892,
2758,
29918,
17886,
29879,
29922,
5574,
29897,
13,
4706,
411,
1722,
29898,
3257,
718,
11393,
7554,
613,
525,
29893,
29890,
1495,
408,
270,
29880,
29918,
1445,
29901,
13,
9651,
270,
29880,
29918,
1445,
29889,
3539,
29898,
29878,
29889,
3051,
29897,
13,
1678,
5174,
29901,
13,
4706,
1596,
29898,
29888,
29915,
16243,
5142,
29901,
426,
3257,
29913,
1495,
13,
13,
13,
1753,
1053,
29918,
2324,
29918,
7554,
29918,
27774,
4872,
326,
272,
1974,
29898,
4965,
29918,
12292,
1125,
13,
1678,
9995,
13,
268,
11221,
263,
1051,
29892,
445,
740,
674,
679,
599,
278,
2822,
1283,
278,
14319,
934,
297,
278,
3142,
393,
526,
297,
278,
1051,
29889,
13,
268,
9995,
13,
1678,
1051,
29918,
11671,
353,
5159,
13,
1678,
1051,
29918,
10685,
29918,
2230,
353,
5159,
13,
1678,
3001,
29918,
11671,
353,
7431,
29898,
4965,
29918,
12292,
29897,
13,
1678,
12541,
353,
29871,
29896,
13,
1678,
363,
474,
297,
2988,
29918,
12292,
29901,
13,
4706,
2380,
29918,
14057,
353,
29871,
29900,
13,
4706,
565,
2380,
29918,
14057,
1405,
29871,
29946,
29901,
13,
9651,
2867,
13,
4706,
1018,
29901,
13,
9651,
9995,
29924,
5086,
777,
26952,
15945,
29908,
13,
9651,
1596,
29898,
29888,
29915,
29912,
1524,
362,
6822,
29912,
7827,
29918,
11671,
29913,
1495,
13,
9651,
2380,
29918,
14057,
353,
29871,
29900,
13,
9651,
4480,
29918,
2230,
353,
4036,
29889,
9502,
524,
29898,
29896,
29900,
29892,
29871,
29929,
29900,
29897,
13,
9651,
1051,
29918,
10685,
29918,
2230,
29889,
4397,
29898,
10685,
29918,
2230,
29897,
13,
9651,
9995,
6330,
24559,
546,
15945,
29908,
13,
9651,
24512,
353,
679,
29918,
3488,
29898,
29875,
29897,
13,
9651,
3611,
29918,
7554,
353,
24512,
29889,
29882,
29906,
29889,
726,
29889,
6506,
703,
9162,
11663,
2564,
6506,
17350,
613,
11663,
2564,
6506,
28909,
29873,
742,
525,
2824,
6506,
28909,
29876,
742,
525,
2824,
6506,
877,
489,
742,
13,
462,
462,
462,
462,
462,
462,
462,
259,
27255,
13,
9651,
1596,
29898,
3257,
29918,
7554,
29897,
13,
9651,
270,
29880,
29918,
2324,
353,
24512,
29889,
2886,
877,
1003,
6671,
2824,
29874,
29889,
657,
877,
12653,
1495,
13,
9651,
270,
29880,
29918,
7554,
29918,
27774,
4872,
326,
272,
1974,
29898,
11671,
29918,
2324,
29892,
3611,
29918,
7554,
29897,
13,
9651,
1051,
29918,
11671,
29889,
4397,
3552,
3257,
29918,
7554,
29892,
270,
29880,
29918,
2324,
876,
13,
9651,
931,
29889,
17059,
29898,
10685,
29918,
2230,
29897,
13,
9651,
9995,
369,
15828,
903,
15091,
15945,
29908,
13,
9651,
1596,
29898,
29888,
29915,
19558,
29912,
1524,
362,
6822,
29912,
7827,
29918,
11671,
6177,
2309,
297,
426,
10685,
29918,
2230,
29913,
1495,
13,
9651,
12541,
4619,
29871,
29896,
13,
4706,
5174,
29901,
13,
9651,
1596,
29898,
29888,
29908,
29903,
290,
621,
335,
3512,
2743,
411,
278,
426,
1524,
362,
6177,
29912,
29875,
1836,
29905,
29876,
1159,
13,
9651,
2380,
29918,
14057,
4619,
29871,
29896,
13,
1678,
736,
1051,
29918,
11671,
13,
13,
13,
1753,
1667,
29918,
27774,
4872,
326,
272,
1974,
7295,
13,
1678,
599,
29918,
4965,
353,
679,
29918,
2324,
29918,
27774,
4872,
326,
272,
1974,
580,
13,
1678,
1051,
29918,
7554,
353,
1053,
29918,
2324,
29918,
7554,
29918,
27774,
4872,
326,
272,
1974,
29898,
497,
29918,
4965,
29897,
13,
1678,
736,
6213,
13,
13,
13,
4965,
353,
679,
29918,
2324,
29918,
27774,
4872,
326,
272,
1974,
580,
13,
2158,
29898,
5215,
29918,
2324,
29918,
7554,
29918,
27774,
4872,
326,
272,
1974,
29898,
4965,
876,
13,
2
] |
stencils/diffterm/kernel.py | pengdada/vecscatter-artifact | 0 | 189790 | from st.expr import Index, ConstRef
from st.grid import Grid
# Declare indices
i = Index(0)
j = Index(1)
k = Index(2)
# Declare grid
ux = Grid("ux", 3)
vx = Grid("vx", 3)
wx = Grid("wx", 3)
uy = Grid("uy", 3)
vy = Grid("vy", 3)
wy = Grid("wy", 3)
uz = Grid("uz", 3)
vz = Grid("vz", 3)
wz = Grid("wz", 3)
q_1 = Grid("q_1", 3)
q_2 = Grid("q_2", 3)
q_3 = Grid("q_3", 3)
q_5 = Grid("q_5", 3)
diffflux1 = Grid("diffflux1", 3)
diffflux2 = Grid("diffflux2", 3)
diffflux3 = Grid("diffflux3", 3)
diffflux4 = Grid("diffflux4", 3)
dxinv0 = ConstRef("dxinv0")
dxinv1 = ConstRef("dxinv1")
dxinv2 = ConstRef("dxinv2")
| [
1,
515,
380,
29889,
13338,
1053,
11374,
29892,
5798,
5620,
13,
3166,
380,
29889,
7720,
1053,
11657,
13,
13,
29937,
3826,
8663,
16285,
13,
29875,
353,
11374,
29898,
29900,
29897,
13,
29926,
353,
11374,
29898,
29896,
29897,
13,
29895,
353,
11374,
29898,
29906,
29897,
13,
13,
29937,
3826,
8663,
6856,
13,
1314,
353,
11657,
703,
1314,
613,
29871,
29941,
29897,
13,
29894,
29916,
353,
11657,
703,
29894,
29916,
613,
29871,
29941,
29897,
13,
23310,
353,
11657,
703,
23310,
613,
29871,
29941,
29897,
13,
13,
8631,
353,
11657,
703,
8631,
613,
29871,
29941,
29897,
13,
13308,
353,
11657,
703,
13308,
613,
29871,
29941,
29897,
13,
12822,
353,
11657,
703,
12822,
613,
29871,
29941,
29897,
13,
13,
3365,
353,
11657,
703,
3365,
613,
29871,
29941,
29897,
13,
29894,
29920,
353,
11657,
703,
29894,
29920,
613,
29871,
29941,
29897,
13,
29893,
29920,
353,
11657,
703,
29893,
29920,
613,
29871,
29941,
29897,
13,
13,
29939,
29918,
29896,
353,
11657,
703,
29939,
29918,
29896,
613,
29871,
29941,
29897,
13,
29939,
29918,
29906,
353,
11657,
703,
29939,
29918,
29906,
613,
29871,
29941,
29897,
13,
29939,
29918,
29941,
353,
11657,
703,
29939,
29918,
29941,
613,
29871,
29941,
29897,
13,
13,
29939,
29918,
29945,
353,
11657,
703,
29939,
29918,
29945,
613,
29871,
29941,
29897,
13,
13,
29881,
361,
600,
29880,
1314,
29896,
353,
11657,
703,
29881,
361,
600,
29880,
1314,
29896,
613,
29871,
29941,
29897,
13,
29881,
361,
600,
29880,
1314,
29906,
353,
11657,
703,
29881,
361,
600,
29880,
1314,
29906,
613,
29871,
29941,
29897,
13,
29881,
361,
600,
29880,
1314,
29941,
353,
11657,
703,
29881,
361,
600,
29880,
1314,
29941,
613,
29871,
29941,
29897,
13,
29881,
361,
600,
29880,
1314,
29946,
353,
11657,
703,
29881,
361,
600,
29880,
1314,
29946,
613,
29871,
29941,
29897,
13,
13,
8235,
11569,
29900,
353,
5798,
5620,
703,
8235,
11569,
29900,
1159,
13,
8235,
11569,
29896,
353,
5798,
5620,
703,
8235,
11569,
29896,
1159,
13,
8235,
11569,
29906,
353,
5798,
5620,
703,
8235,
11569,
29906,
1159,
13,
2
] |
appr/commands/logout.py | sergeyberezansky/appr | 31 | 6418 | <filename>appr/commands/logout.py
from __future__ import absolute_import, division, print_function
from appr.auth import ApprAuth
from appr.commands.command_base import CommandBase, PackageSplit
class LogoutCmd(CommandBase):
name = 'logout'
help_message = "logout"
def __init__(self, options):
super(LogoutCmd, self).__init__(options)
self.status = None
self.registry_host = options.registry_host
self.package_parts = options.package_parts
pname = self.package_parts.get('package', None)
namespace = self.package_parts.get('namespace', None)
self.package = None
if pname:
self.package = "%s/%s" % (namespace, pname)
elif namespace:
self.package = namespace
@classmethod
def _add_arguments(cls, parser):
cls._add_registryhost_option(parser)
parser.add_argument('registry', nargs='?', default=None, action=PackageSplit,
help="registry url: quay.io[/namespace][/repo]\n" +
"If namespace and/or repo are passed, creds only logout for them")
def _call(self):
client = self.RegistryClient(self.registry_host)
ApprAuth().delete_token(client.host, scope=self.package)
self.status = "Logout complete"
if self.registry_host != '*':
self.status += " from %s" % self.registry_host
def _render_dict(self):
return {"status": self.status, 'host': self.registry_host, "scope": self.package}
def _render_console(self):
return " >>> %s" % self.status
| [
1,
529,
9507,
29958,
932,
29878,
29914,
26381,
29914,
1188,
449,
29889,
2272,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
8542,
29892,
1596,
29918,
2220,
13,
13,
3166,
623,
29878,
29889,
5150,
1053,
2401,
29878,
6444,
13,
3166,
623,
29878,
29889,
26381,
29889,
6519,
29918,
3188,
1053,
10516,
5160,
29892,
22029,
18772,
13,
13,
13,
1990,
4522,
449,
23651,
29898,
6255,
5160,
1125,
13,
1678,
1024,
353,
525,
1188,
449,
29915,
13,
1678,
1371,
29918,
4906,
353,
376,
1188,
449,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3987,
1125,
13,
4706,
2428,
29898,
3403,
449,
23651,
29892,
1583,
467,
1649,
2344,
12035,
6768,
29897,
13,
4706,
1583,
29889,
4882,
353,
6213,
13,
4706,
1583,
29889,
1727,
6020,
29918,
3069,
353,
3987,
29889,
1727,
6020,
29918,
3069,
13,
4706,
1583,
29889,
5113,
29918,
20895,
353,
3987,
29889,
5113,
29918,
20895,
13,
4706,
282,
978,
353,
1583,
29889,
5113,
29918,
20895,
29889,
657,
877,
5113,
742,
6213,
29897,
13,
4706,
7397,
353,
1583,
29889,
5113,
29918,
20895,
29889,
657,
877,
22377,
742,
6213,
29897,
13,
4706,
1583,
29889,
5113,
353,
6213,
13,
4706,
565,
282,
978,
29901,
13,
9651,
1583,
29889,
5113,
353,
11860,
29879,
22584,
29879,
29908,
1273,
313,
22377,
29892,
282,
978,
29897,
13,
4706,
25342,
7397,
29901,
13,
9651,
1583,
29889,
5113,
353,
7397,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
903,
1202,
29918,
25699,
29898,
25932,
29892,
13812,
1125,
13,
4706,
1067,
29879,
3032,
1202,
29918,
1727,
6020,
3069,
29918,
3385,
29898,
16680,
29897,
13,
4706,
13812,
29889,
1202,
29918,
23516,
877,
1727,
6020,
742,
302,
5085,
2433,
29973,
742,
2322,
29922,
8516,
29892,
3158,
29922,
14459,
18772,
29892,
13,
462,
9651,
1371,
543,
1727,
6020,
3142,
29901,
439,
388,
29889,
601,
29961,
29914,
22377,
3816,
29914,
20095,
10725,
29876,
29908,
718,
13,
462,
9651,
376,
3644,
7397,
322,
29914,
272,
13761,
526,
4502,
29892,
907,
6289,
871,
1480,
449,
363,
963,
1159,
13,
13,
1678,
822,
903,
4804,
29898,
1311,
1125,
13,
4706,
3132,
353,
1583,
29889,
22579,
4032,
29898,
1311,
29889,
1727,
6020,
29918,
3069,
29897,
13,
4706,
2401,
29878,
6444,
2141,
8143,
29918,
6979,
29898,
4645,
29889,
3069,
29892,
6874,
29922,
1311,
29889,
5113,
29897,
13,
4706,
1583,
29889,
4882,
353,
376,
3403,
449,
4866,
29908,
13,
4706,
565,
1583,
29889,
1727,
6020,
29918,
3069,
2804,
525,
29930,
2396,
13,
9651,
1583,
29889,
4882,
4619,
376,
515,
1273,
29879,
29908,
1273,
1583,
29889,
1727,
6020,
29918,
3069,
13,
13,
1678,
822,
903,
9482,
29918,
8977,
29898,
1311,
1125,
13,
4706,
736,
8853,
4882,
1115,
1583,
29889,
4882,
29892,
525,
3069,
2396,
1583,
29889,
1727,
6020,
29918,
3069,
29892,
376,
6078,
1115,
1583,
29889,
5113,
29913,
13,
13,
1678,
822,
903,
9482,
29918,
11058,
29898,
1311,
1125,
13,
4706,
736,
376,
8653,
1273,
29879,
29908,
1273,
1583,
29889,
4882,
13,
2
] |
temboardui/plugins/pgconf/__init__.py | missmoiselle/temboard | 294 | 78124 | <filename>temboardui/plugins/pgconf/__init__.py
import logging
from os import path
import tornado.web
from tornado.escape import url_escape, url_unescape
from temboardui.web import (
Blueprint,
HTTPError,
Redirect,
TemplateRenderer,
)
PLUGIN_NAME = 'pgconf'
logger = logging.getLogger(__name__)
blueprint = Blueprint()
blueprint.generic_proxy("/pgconf/configuration", methods=["POST"])
plugin_path = path.dirname(path.realpath(__file__))
render_template = TemplateRenderer(plugin_path + "/templates")
def configuration(config):
return {}
def get_routes(config):
routes = blueprint.rules + [
(
r"/js/pgconf/(.*)",
tornado.web.StaticFileHandler,
{'path': plugin_path + "/static/js"}
),
(
r"/css/pgconf/(.*)",
tornado.web.StaticFileHandler,
{'path': plugin_path + "/static/css"}
),
]
return routes
@blueprint.instance_route("/pgconf/configuration(?:/category/(.+))?",
methods=["GET", "POST"])
def configuration_handler(request, category=None):
request.instance.check_active_plugin(PLUGIN_NAME)
profile = request.instance.get_profile()
agent_username = profile['username']
template_vars = {}
# Deduplicate HTTP prefix of plugin on agent.
prefix = "/pgconf/configuration"
query_filter = request.handler.get_argument('filter', None, strip=True)
status = request.instance.get(prefix + "/status")
categories = request.instance.get(prefix + "/categories")
if category:
category = url_unescape(category)
else:
category = categories['categories'][0]
logger.debug("category=%s", category)
if query_filter:
query = {'filter': query_filter}
configuration_url = prefix
else:
query = {}
configuration_url = prefix + "/category/" + url_escape(category)
configuration = request.instance.get(configuration_url, query=query)
if "POST" == request.method:
settings = {'settings': [
{'name': name, 'setting': value[0]}
for name, value in request.arguments.iteritems()
# 'filter' is not a setting, just ignore it.
if name != 'filter'
]}
try:
request.instance.post(prefix, body=settings)
# Redirect to GET page, same URI.
return Redirect(request.uri)
except HTTPError as e:
# Rerender HTML page with errors.
template_vars['error_code'] = e
template_vars['error_message'] = e.log_message
return render_template(
'configuration.html',
nav=True,
role=request.current_user,
instance=request.instance,
agent_username=agent_username,
plugin=PLUGIN_NAME,
xsession=request.instance.xsession,
current_cat=category,
configuration_categories=categories,
configuration_status=status,
data=configuration,
query_filter=query_filter,
**template_vars
)
| [
1,
529,
9507,
29958,
1356,
3377,
1481,
29914,
12800,
29914,
4061,
5527,
29914,
1649,
2344,
26914,
2272,
13,
5215,
12183,
13,
3166,
2897,
1053,
2224,
13,
5215,
10146,
912,
29889,
2676,
13,
3166,
10146,
912,
29889,
21587,
1053,
3142,
29918,
21587,
29892,
3142,
29918,
7844,
5738,
13,
13,
3166,
1350,
3377,
1481,
29889,
2676,
1053,
313,
13,
1678,
10924,
2158,
29892,
13,
1678,
7331,
2392,
29892,
13,
1678,
4367,
1088,
29892,
13,
1678,
25663,
21323,
29892,
13,
29897,
13,
13,
13,
7390,
23338,
1177,
29918,
5813,
353,
525,
4061,
5527,
29915,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
9539,
2158,
353,
10924,
2158,
580,
13,
9539,
2158,
29889,
19206,
29918,
14701,
11974,
4061,
5527,
29914,
13305,
613,
3519,
29922,
3366,
5438,
20068,
13,
8582,
29918,
2084,
353,
2224,
29889,
25721,
29898,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
876,
13,
9482,
29918,
6886,
353,
25663,
21323,
29898,
8582,
29918,
2084,
718,
5591,
20943,
1159,
13,
13,
13,
1753,
5285,
29898,
2917,
1125,
13,
1678,
736,
6571,
13,
13,
13,
1753,
679,
29918,
27894,
29898,
2917,
1125,
13,
1678,
12049,
353,
7254,
2158,
29889,
19238,
718,
518,
13,
4706,
313,
13,
9651,
364,
23901,
1315,
29914,
4061,
5527,
14571,
5575,
19123,
13,
9651,
10146,
912,
29889,
2676,
29889,
17046,
2283,
4598,
29892,
13,
9651,
11117,
2084,
2396,
7079,
29918,
2084,
718,
5591,
7959,
29914,
1315,
9092,
13,
4706,
10353,
13,
4706,
313,
13,
9651,
364,
23901,
4268,
29914,
4061,
5527,
14571,
5575,
19123,
13,
9651,
10146,
912,
29889,
2676,
29889,
17046,
2283,
4598,
29892,
13,
9651,
11117,
2084,
2396,
7079,
29918,
2084,
718,
5591,
7959,
29914,
4268,
9092,
13,
4706,
10353,
13,
1678,
4514,
13,
1678,
736,
12049,
13,
13,
13,
29992,
9539,
2158,
29889,
8758,
29918,
13134,
11974,
4061,
5527,
29914,
13305,
10780,
8419,
7320,
29914,
11891,
29974,
876,
29973,
613,
13,
462,
3986,
3519,
29922,
3366,
7194,
613,
376,
5438,
20068,
13,
1753,
5285,
29918,
13789,
29898,
3827,
29892,
7663,
29922,
8516,
1125,
13,
1678,
2009,
29889,
8758,
29889,
3198,
29918,
4925,
29918,
8582,
29898,
7390,
23338,
1177,
29918,
5813,
29897,
13,
1678,
8722,
353,
2009,
29889,
8758,
29889,
657,
29918,
10185,
580,
13,
1678,
10823,
29918,
6786,
353,
8722,
1839,
6786,
2033,
13,
1678,
4472,
29918,
16908,
353,
6571,
13,
1678,
396,
360,
287,
786,
5926,
7331,
10944,
310,
7079,
373,
10823,
29889,
13,
1678,
10944,
353,
5591,
4061,
5527,
29914,
13305,
29908,
13,
1678,
2346,
29918,
4572,
353,
2009,
29889,
13789,
29889,
657,
29918,
23516,
877,
4572,
742,
6213,
29892,
17820,
29922,
5574,
29897,
13,
13,
1678,
4660,
353,
2009,
29889,
8758,
29889,
657,
29898,
13506,
718,
5591,
4882,
1159,
13,
1678,
13997,
353,
2009,
29889,
8758,
29889,
657,
29898,
13506,
718,
5591,
20683,
1159,
13,
13,
1678,
565,
7663,
29901,
13,
4706,
7663,
353,
3142,
29918,
7844,
5738,
29898,
7320,
29897,
13,
1678,
1683,
29901,
13,
4706,
7663,
353,
13997,
1839,
20683,
2033,
29961,
29900,
29962,
13,
1678,
17927,
29889,
8382,
703,
7320,
16328,
29879,
613,
7663,
29897,
13,
13,
1678,
565,
2346,
29918,
4572,
29901,
13,
4706,
2346,
353,
11117,
4572,
2396,
2346,
29918,
4572,
29913,
13,
4706,
5285,
29918,
2271,
353,
10944,
13,
1678,
1683,
29901,
13,
4706,
2346,
353,
6571,
13,
4706,
5285,
29918,
2271,
353,
10944,
718,
5591,
7320,
12975,
718,
3142,
29918,
21587,
29898,
7320,
29897,
13,
1678,
5285,
353,
2009,
29889,
8758,
29889,
657,
29898,
13305,
29918,
2271,
29892,
2346,
29922,
1972,
29897,
13,
13,
1678,
565,
376,
5438,
29908,
1275,
2009,
29889,
5696,
29901,
13,
4706,
6055,
353,
11117,
11027,
2396,
518,
13,
9651,
11117,
978,
2396,
1024,
29892,
525,
26740,
2396,
995,
29961,
29900,
12258,
13,
9651,
363,
1024,
29892,
995,
297,
2009,
29889,
25699,
29889,
1524,
7076,
580,
13,
9651,
396,
525,
4572,
29915,
338,
451,
263,
4444,
29892,
925,
11455,
372,
29889,
13,
9651,
565,
1024,
2804,
525,
4572,
29915,
13,
4706,
4514,
29913,
13,
4706,
1018,
29901,
13,
9651,
2009,
29889,
8758,
29889,
2490,
29898,
13506,
29892,
3573,
29922,
11027,
29897,
13,
9651,
396,
4367,
1088,
304,
12354,
1813,
29892,
1021,
23539,
29889,
13,
9651,
736,
4367,
1088,
29898,
3827,
29889,
5338,
29897,
13,
4706,
5174,
7331,
2392,
408,
321,
29901,
13,
9651,
396,
390,
261,
1581,
4544,
1813,
411,
4436,
29889,
13,
9651,
4472,
29918,
16908,
1839,
2704,
29918,
401,
2033,
353,
321,
13,
9651,
4472,
29918,
16908,
1839,
2704,
29918,
4906,
2033,
353,
321,
29889,
1188,
29918,
4906,
13,
13,
1678,
736,
4050,
29918,
6886,
29898,
13,
4706,
525,
13305,
29889,
1420,
742,
13,
4706,
6283,
29922,
5574,
29892,
13,
4706,
6297,
29922,
3827,
29889,
3784,
29918,
1792,
29892,
13,
4706,
2777,
29922,
3827,
29889,
8758,
29892,
13,
4706,
10823,
29918,
6786,
29922,
14748,
29918,
6786,
29892,
13,
4706,
7079,
29922,
7390,
23338,
1177,
29918,
5813,
29892,
13,
4706,
921,
7924,
29922,
3827,
29889,
8758,
29889,
29916,
7924,
29892,
13,
4706,
1857,
29918,
4117,
29922,
7320,
29892,
13,
4706,
5285,
29918,
20683,
29922,
20683,
29892,
13,
4706,
5285,
29918,
4882,
29922,
4882,
29892,
13,
4706,
848,
29922,
13305,
29892,
13,
4706,
2346,
29918,
4572,
29922,
1972,
29918,
4572,
29892,
13,
4706,
3579,
6886,
29918,
16908,
13,
1678,
1723,
13,
2
] |
src/ros/spirit/src/helpers.py | masasin/spirit | 0 | 1606605 | # -*- coding: utf-8 -*-
"""
Helper functions and classes for general use.
"""
from __future__ import division
from functools import partial, update_wrapper
from time import localtime, strftime
import numpy as np
from numpy.linalg import norm
import rospy
from geometry_msgs.msg import Point, PoseStamped, Quaternion
from sensor_msgs.msg import Image
from std_msgs.msg import Header
import tf
d2r = np.deg2rad
r2d = np.rad2deg
EULER_CONVENTION = "rxyz"
def unit_vector(v):
"""
Change the length of the vector to unity in the same direction.
Parameters
----------
v : array-like
A vector to be normalized.
Returns
-------
np.ndarray
The normalized vector, or the original vector if it has a length of 0.
"""
norm = np.linalg.norm(v)
if norm:
return v / norm
else:
return np.asarray(v)
# noinspection PyPep8Naming
class memoize(object):
def __init__(self, func):
self.func = func
update_wrapper(self, func)
def __get__(self, instance, owner):
if instance is None:
return self.func
return partial(self, instance)
def __call__(self, *args, **kwargs):
obj = args[0]
try:
cache = obj.__cache__
except AttributeError:
cache = obj.__cache__ = {}
key = (self.func, args[1:], frozenset(kwargs.items()))
try:
res = cache[key]
except KeyError:
res = cache[key] = self.func(*args, **kwargs)
return res
class Pose(object):
"""
Convenience wrapper for PoseStamped.
Parameters
----------
pose_stamped : PoseStamped
The pose message.
Attributes
----------
pose_stamped : PoseStamped
The pose message.
position : np.ndarray
The x, y, and z coordinates contained in the pose.
orientation : np.ndarray
The x, y, z, and w quaternion contained in the pose.
header : Header
The header from the pose message
"""
def __init__(self, pose_stamped):
self.pose_stamped = pose_stamped
self.position, self.orientation = self._components(self.pose_stamped)
self.header = self.pose_stamped.header
def rel_position(self, pose, rotation_matrix=None):
"""
Calculate the relative position with another pose, with local reference.
Parameters
----------
pose : Pose
The target pose.
rotation_matrix : Optional[np.ndarray]
The rotation matrix to use. If not provided, the rotation matrix of
the current pose is used.
Returns
-------
np.ndarray
The x, y, z relative positions.
"""
if rotation_matrix is None:
rotation_matrix = Quat.rotation_matrix(self.orientation)
return rotation_matrix.dot(pose.position - self.position)
def rel_euler(self, pose):
"""
Calculate the relative angle with another pose.
Parameters
----------
pose : Pose
The target pose.
Returns
-------
np.ndarray
The relative angle as Euler, in the order of pitch, roll, yaw.
"""
return Quat.to_euler(Quat.rel_rotation(pose.orientation,
self.orientation))
def distance(self, pose):
"""
Calculate the distance to another pose.
Parameters
----------
pose : Pose
The target pose.
Returns
-------
float
The distance to the target pose.
"""
return norm(pose.position - self.position)
@staticmethod
def _components(pose_stamped):
"""
Return the position and orientation of a PoseStamped as numpy arrays.
Parameters
----------
pose_stamped : Pose(WithCovariance)?(Stamped)?
The pose to be decomposed.
Returns
-------
position : np.ndarray
The x, y, and z coordinates contained in the pose.
orientation : np.ndarray
The x, y, z, and w quaternion contained in the pose.
"""
position = np.array([pose_stamped.pose.position.x,
pose_stamped.pose.position.y,
pose_stamped.pose.position.z])
orientation = np.array([pose_stamped.pose.orientation.x,
pose_stamped.pose.orientation.y,
pose_stamped.pose.orientation.z,
pose_stamped.pose.orientation.w])
return position, orientation
@classmethod
def from_components(cls, position, orientation, sequence=0):
"""
Generate a Pose from its components.
Parameters
----------
position : Sequence[float]
The x, y, and z coordinates of the pose.
orientation : Sequence[float]
The x, y, z, and w quaternion of the pose.
sequence : Optional[int]
The sequence number of the pose.
Returns
-------
Pose
The generated pose.
"""
return cls(cls.generate_stamped(position, orientation, sequence))
@staticmethod
def generate_stamped(position, orientation, sequence=0):
"""
Generate a PoseStamped from its components.
Parameters
----------
position : Sequence[float]
The x, y, and z coordinates of the pose.
orientation : Sequence[float]
The x, y, z, and w quaternion of the pose.
sequence : Optional[int]
The sequence number of the pose.
Returns
-------
PoseStamped
The generated pose.
"""
pose_stamped = PoseStamped()
pose_stamped.header.seq = sequence
try:
pose_stamped.header.stamp = rospy.Time.now()
except rospy.exceptions.ROSInitException:
pass
pose_stamped.pose.position = Point(*position)
pose_stamped.pose.orientation = Quaternion(*orientation)
return pose_stamped
def __repr__(self):
return "<Pose ({position}, {orientation})>".format(
position=self.position.tolist(),
orientation=self.orientation.tolist(),
time=self.header.stamp)
def __str__(self):
return "<Pose ({position}, {orientation}): {time}>".format(
position=self.position.tolist(),
orientation=self.orientation.tolist(),
time=self.header.stamp)
class Frame(object):
"""
Encapsulate an image and the pose it was taken in.
Parameters
----------
pose_stamped : PoseStamped
The pose of the drone when the image was taken.
image : Image
The image that was taken.
Attributes
----------
pose_stamped : PoseStamped
The raw pose message of the drone at which the image was taken.
pose : Pose
The pose of the drone at which the image was taken.
rotation_matrix : np.ndarray
The rotation matrix of the frame orientation.
image : Image
The image that was taken.
stamp : rospy.rostime.Time
The timestamp of the pose.
stamp_str : str
The timestamp of the pose, in human readable format.
"""
def __init__(self, pose_stamped, image):
self.pose_stamped = pose_stamped
self.pose = Pose(pose_stamped)
self.rotation_matrix = Quat.rotation_matrix(self.pose.orientation)
self.image = image
self.stamp = self.pose.header.stamp
self.stamp_str = strftime("%Y-%m-%d %H:%M:%S",
localtime(self.stamp.to_time()))
@memoize
def rel_position(self, pose):
"""
Calculate the relative position with another pose, with local reference.
Parameters
----------
pose : Pose
The target pose.
Returns
-------
np.ndarray
The x, y, z relative positions.
"""
return self.pose.rel_position(pose,
rotation_matrix=self.rotation_matrix)
@memoize
def rel_euler(self, pose):
"""
Calculate the relative angle with another pose.
Parameters
----------
pose : Pose
The target pose.
Returns
-------
np.ndarray
The relative angle as Euler, in the order of pitch, roll, yaw.
"""
return self.pose.rel_euler(pose)
@memoize
def distance(self, pose):
"""
Calculate the distance to another pose.
Parameters
----------
pose : Pose
The target pose.
Returns
-------
float
The distance to the target pose.
"""
return self.pose.distance(pose)
def __repr__(self):
return "<Frame({pose})>".format(pose=self.pose)
class Fov(object):
"""
Field of view methods.
"""
@staticmethod
def d2v(fov_diagonal, aspect_ratio=4 / 3):
"""
Convert a diagonal field of view to vertical.
Parameters
----------
fov_diagonal : float
The diagonal field of view.
aspect_ratio: Optional[float]
The aspect ratio of the display. Default is 4:3.
Returns
-------
float
The vertical field of view.
"""
ratio_diagonal = np.sqrt(1 + aspect_ratio**2)
return 2 * r2d(np.arctan(np.tan(d2r(fov_diagonal) / 2)
/ ratio_diagonal))
@staticmethod
def v2h(fov_vertical, aspect_ratio=4 / 3):
"""
Convert a vertical field of view to horizontal.
Parameters
----------
fov_vertical : float
The vertical field of view.
aspect_ratio: Optional[float]
The aspect ratio of the display. Default is 4:3.
Returns
-------
float
The horizontal field of view.
"""
return 2 * r2d(np.arctan(np.tan(d2r(fov_vertical) / 2) * aspect_ratio))
class Quat(object):
"""
Quaternion methods.
"""
@staticmethod
def to_euler(quaternion):
"""
Change a quaternion to an Euler angle representation.
Parameters
----------
quaternion : np.ndarray
A quaternion in the order of x, y, z, w.
Returns
-------
np.ndarray
The Euler angle, in the order of pitch, roll, yaw.
"""
# noinspection PyUnresolvedReferences
return tf.transformations.euler_from_quaternion(quaternion,
EULER_CONVENTION)
@staticmethod
def to_axis(quaternion):
"""
Change a quaternion to an axis-angle representation.
Parameters
----------
quaternion : np.ndarray
A quaternion in the order of x, y, z, w.
Notes
-----
θ is in degrees rather than radians, for ease of integration in OpenGL.
Returns
-------
tuple
The angle in axis-angle representation, with the order of θ, x, y,
z. θ is in degrees.
"""
x, y, z, w = unit_vector(quaternion)
angle = r2d(2 * np.arccos(w))
if angle == 0:
axis_x = 1
axis_y = axis_z = 0
elif angle % 180 == 0:
axis_x, axis_y, axis_z = x, y, z
else:
axis_x = x / np.sqrt(1 - w**2)
axis_y = y / np.sqrt(1 - w**2)
axis_z = z / np.sqrt(1 - w**2)
return angle, axis_x, axis_y, axis_z
@staticmethod
def product(a, b):
"""
Find the product of two quaternions.
Parameters
----------
a : Sequence[float]
A quaternion, in the order of x, y, z, w
b : Sequence[float]
A quaternion, in the order of x, y, z, w
Returns
-------
np.ndarray
A quaternion, in the order of x, y, z, w
"""
imaginary_part = a[3] * b[:3] + b[3] * a[:3] + np.cross(a[:3], b[:3])
real_part = a[3] * b[3] - np.dot(a[:3], b[:3])
return np.append(imaginary_part, real_part)
@staticmethod
def inverse(quaternion):
"""
Return the inverse of a quaternion
Parameters
----------
quaternion : Sequence[float]
A quaternion, in the order of x, y, z, w
Returns
-------
np.ndarray
The inverse of the quaternion.
"""
return (quaternion * np.array([-1, -1, -1, 1])
/ np.linalg.norm(quaternion)**2)
@staticmethod
def rel_rotation(a, b):
"""
Find the quaternion which produces a rotation from `a` to `b`.
Parameters
----------
a : Sequence[float]
A quaternion, in the order of x, y, z, w
b : Sequence[float]
A quaternion, in the order of x, y, z, w
Returns
-------
np.ndarray
A quaternion, in the order of x, y, z, w
"""
return Quat.product(unit_vector(a), Quat.inverse(unit_vector(b)))
@staticmethod
def rotation_matrix(quaternion):
"""
Create the rotation matrix of a quaternion.
Parameters
----------
quaternion : np.ndarray
A quaternion in the order of x, y, z, w.
Returns
-------
np.ndarray
A 3x3 rotation matrix representing the quaternion.
References
----------
.. [1] Wikipedia, Rotation Matrix.
https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion
"""
x, y, z, w = quaternion
n = sum(quaternion**2)
if n == 0:
return np.identity(3)
s = 2 / n
wx = s * w * x
wy = s * w * y
wz = s * w * z
xx = s * x * x
xy = s * x * y
xz = s * x * z
yy = s * y * y
yz = s * y * z
zz = s * z * z
return np.array([[1 - (yy + zz), xy - wz, wy],
[wz, 1 - (xx + zz), yz - wx],
[xz - wy, yz + wx, 1 - (xx + yy)]])
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
10739,
3168,
322,
4413,
363,
2498,
671,
29889,
13,
13,
15945,
29908,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
2090,
312,
8789,
1053,
7687,
29892,
2767,
29918,
17699,
13,
3166,
931,
1053,
1887,
2230,
29892,
851,
615,
603,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
12655,
29889,
29880,
979,
29887,
1053,
6056,
13,
13,
5215,
696,
1028,
29891,
13,
3166,
16303,
29918,
1516,
3174,
29889,
7645,
1053,
8984,
29892,
349,
852,
855,
1160,
287,
29892,
751,
25744,
291,
13,
3166,
23530,
29918,
1516,
3174,
29889,
7645,
1053,
7084,
13,
3166,
3659,
29918,
1516,
3174,
29889,
7645,
1053,
19345,
13,
5215,
15886,
13,
13,
13,
29881,
29906,
29878,
353,
7442,
29889,
12163,
29906,
3665,
13,
29878,
29906,
29881,
353,
7442,
29889,
3665,
29906,
12163,
13,
29923,
13309,
1001,
29918,
6007,
29963,
3919,
2725,
353,
376,
29878,
20230,
29908,
13,
13,
13,
1753,
5190,
29918,
8111,
29898,
29894,
1125,
13,
1678,
9995,
13,
1678,
10726,
278,
3309,
310,
278,
4608,
304,
20107,
297,
278,
1021,
5305,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
325,
584,
1409,
29899,
4561,
13,
4706,
319,
4608,
304,
367,
4226,
1891,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
7442,
29889,
299,
2378,
13,
4706,
450,
4226,
1891,
4608,
29892,
470,
278,
2441,
4608,
565,
372,
756,
263,
3309,
310,
29871,
29900,
29889,
13,
13,
1678,
9995,
13,
1678,
6056,
353,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29894,
29897,
13,
1678,
565,
6056,
29901,
13,
4706,
736,
325,
847,
6056,
13,
1678,
1683,
29901,
13,
4706,
736,
7442,
29889,
294,
2378,
29898,
29894,
29897,
13,
13,
13,
29937,
694,
1144,
27988,
10772,
29925,
1022,
29947,
29940,
11500,
13,
1990,
2626,
29877,
675,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3653,
1125,
13,
4706,
1583,
29889,
9891,
353,
3653,
13,
4706,
2767,
29918,
17699,
29898,
1311,
29892,
3653,
29897,
13,
13,
1678,
822,
4770,
657,
12035,
1311,
29892,
2777,
29892,
12271,
1125,
13,
4706,
565,
2777,
338,
6213,
29901,
13,
9651,
736,
1583,
29889,
9891,
13,
4706,
736,
7687,
29898,
1311,
29892,
2777,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
5446,
353,
6389,
29961,
29900,
29962,
13,
4706,
1018,
29901,
13,
9651,
7090,
353,
5446,
17255,
8173,
1649,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
7090,
353,
5446,
17255,
8173,
1649,
353,
6571,
13,
4706,
1820,
353,
313,
1311,
29889,
9891,
29892,
6389,
29961,
29896,
29901,
1402,
14671,
29920,
575,
300,
29898,
19290,
29889,
7076,
22130,
13,
4706,
1018,
29901,
13,
9651,
620,
353,
7090,
29961,
1989,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
620,
353,
7090,
29961,
1989,
29962,
353,
1583,
29889,
9891,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
736,
620,
13,
13,
13,
1990,
349,
852,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
1281,
854,
5597,
14476,
363,
349,
852,
855,
1160,
287,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
18593,
29918,
303,
1160,
287,
584,
349,
852,
855,
1160,
287,
13,
4706,
450,
18593,
2643,
29889,
13,
13,
1678,
6212,
5026,
13,
1678,
448,
1378,
29899,
13,
1678,
18593,
29918,
303,
1160,
287,
584,
349,
852,
855,
1160,
287,
13,
4706,
450,
18593,
2643,
29889,
13,
1678,
2602,
584,
7442,
29889,
299,
2378,
13,
4706,
450,
921,
29892,
343,
29892,
322,
503,
10350,
11122,
297,
278,
18593,
29889,
13,
1678,
19843,
584,
7442,
29889,
299,
2378,
13,
4706,
450,
921,
29892,
343,
29892,
503,
29892,
322,
281,
439,
25744,
291,
11122,
297,
278,
18593,
29889,
13,
1678,
4839,
584,
19345,
13,
4706,
450,
4839,
515,
278,
18593,
2643,
13,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
18593,
29918,
303,
1160,
287,
1125,
13,
4706,
1583,
29889,
4220,
29918,
303,
1160,
287,
353,
18593,
29918,
303,
1160,
287,
13,
4706,
1583,
29889,
3283,
29892,
1583,
29889,
20659,
353,
1583,
3032,
14036,
29898,
1311,
29889,
4220,
29918,
303,
1160,
287,
29897,
13,
4706,
1583,
29889,
6672,
353,
1583,
29889,
4220,
29918,
303,
1160,
287,
29889,
6672,
13,
13,
1678,
822,
1104,
29918,
3283,
29898,
1311,
29892,
18593,
29892,
13733,
29918,
5344,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
278,
6198,
2602,
411,
1790,
18593,
29892,
411,
1887,
3407,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
18593,
584,
349,
852,
13,
9651,
450,
3646,
18593,
29889,
13,
4706,
13733,
29918,
5344,
584,
28379,
29961,
9302,
29889,
299,
2378,
29962,
13,
9651,
450,
13733,
4636,
304,
671,
29889,
960,
451,
4944,
29892,
278,
13733,
4636,
310,
13,
9651,
278,
1857,
18593,
338,
1304,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
921,
29892,
343,
29892,
503,
6198,
11909,
29889,
13,
13,
4706,
9995,
13,
4706,
565,
13733,
29918,
5344,
338,
6213,
29901,
13,
9651,
13733,
29918,
5344,
353,
751,
271,
29889,
5450,
362,
29918,
5344,
29898,
1311,
29889,
20659,
29897,
13,
4706,
736,
13733,
29918,
5344,
29889,
6333,
29898,
4220,
29889,
3283,
448,
1583,
29889,
3283,
29897,
13,
13,
1678,
822,
1104,
29918,
29872,
8584,
29898,
1311,
29892,
18593,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
278,
6198,
10696,
411,
1790,
18593,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
18593,
584,
349,
852,
13,
9651,
450,
3646,
18593,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
6198,
10696,
408,
382,
8584,
29892,
297,
278,
1797,
310,
15905,
29892,
9679,
29892,
343,
1450,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
751,
271,
29889,
517,
29918,
29872,
8584,
29898,
2182,
271,
29889,
2674,
29918,
5450,
362,
29898,
4220,
29889,
20659,
29892,
13,
462,
462,
1669,
1583,
29889,
20659,
876,
13,
13,
1678,
822,
5418,
29898,
1311,
29892,
18593,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
278,
5418,
304,
1790,
18593,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
18593,
584,
349,
852,
13,
9651,
450,
3646,
18593,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
5785,
13,
9651,
450,
5418,
304,
278,
3646,
18593,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
6056,
29898,
4220,
29889,
3283,
448,
1583,
29889,
3283,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
14036,
29898,
4220,
29918,
303,
1160,
287,
1125,
13,
4706,
9995,
13,
4706,
7106,
278,
2602,
322,
19843,
310,
263,
349,
852,
855,
1160,
287,
408,
12655,
7049,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
18593,
29918,
303,
1160,
287,
584,
349,
852,
29898,
3047,
29907,
586,
279,
8837,
6877,
29898,
855,
1160,
287,
6877,
13,
9651,
450,
18593,
304,
367,
17753,
4752,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
2602,
584,
7442,
29889,
299,
2378,
13,
9651,
450,
921,
29892,
343,
29892,
322,
503,
10350,
11122,
297,
278,
18593,
29889,
13,
4706,
19843,
584,
7442,
29889,
299,
2378,
13,
9651,
450,
921,
29892,
343,
29892,
503,
29892,
322,
281,
439,
25744,
291,
11122,
297,
278,
18593,
29889,
13,
13,
4706,
9995,
13,
4706,
2602,
353,
7442,
29889,
2378,
4197,
4220,
29918,
303,
1160,
287,
29889,
4220,
29889,
3283,
29889,
29916,
29892,
13,
462,
632,
18593,
29918,
303,
1160,
287,
29889,
4220,
29889,
3283,
29889,
29891,
29892,
13,
462,
632,
18593,
29918,
303,
1160,
287,
29889,
4220,
29889,
3283,
29889,
29920,
2314,
13,
13,
4706,
19843,
353,
7442,
29889,
2378,
4197,
4220,
29918,
303,
1160,
287,
29889,
4220,
29889,
20659,
29889,
29916,
29892,
13,
462,
18884,
18593,
29918,
303,
1160,
287,
29889,
4220,
29889,
20659,
29889,
29891,
29892,
13,
462,
18884,
18593,
29918,
303,
1160,
287,
29889,
4220,
29889,
20659,
29889,
29920,
29892,
13,
462,
18884,
18593,
29918,
303,
1160,
287,
29889,
4220,
29889,
20659,
29889,
29893,
2314,
13,
13,
4706,
736,
2602,
29892,
19843,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
14036,
29898,
25932,
29892,
2602,
29892,
19843,
29892,
5665,
29922,
29900,
1125,
13,
4706,
9995,
13,
4706,
3251,
403,
263,
349,
852,
515,
967,
7117,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
2602,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
450,
921,
29892,
343,
29892,
322,
503,
10350,
310,
278,
18593,
29889,
13,
4706,
19843,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
450,
921,
29892,
343,
29892,
503,
29892,
322,
281,
439,
25744,
291,
310,
278,
18593,
29889,
13,
4706,
5665,
584,
28379,
29961,
524,
29962,
13,
9651,
450,
5665,
1353,
310,
278,
18593,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
349,
852,
13,
9651,
450,
5759,
18593,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
1067,
29879,
29898,
25932,
29889,
17158,
29918,
303,
1160,
287,
29898,
3283,
29892,
19843,
29892,
5665,
876,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
5706,
29918,
303,
1160,
287,
29898,
3283,
29892,
19843,
29892,
5665,
29922,
29900,
1125,
13,
4706,
9995,
13,
4706,
3251,
403,
263,
349,
852,
855,
1160,
287,
515,
967,
7117,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
2602,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
450,
921,
29892,
343,
29892,
322,
503,
10350,
310,
278,
18593,
29889,
13,
4706,
19843,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
450,
921,
29892,
343,
29892,
503,
29892,
322,
281,
439,
25744,
291,
310,
278,
18593,
29889,
13,
4706,
5665,
584,
28379,
29961,
524,
29962,
13,
9651,
450,
5665,
1353,
310,
278,
18593,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
349,
852,
855,
1160,
287,
13,
9651,
450,
5759,
18593,
29889,
13,
13,
4706,
9995,
13,
4706,
18593,
29918,
303,
1160,
287,
353,
349,
852,
855,
1160,
287,
580,
13,
4706,
18593,
29918,
303,
1160,
287,
29889,
6672,
29889,
11762,
353,
5665,
13,
4706,
1018,
29901,
13,
9651,
18593,
29918,
303,
1160,
287,
29889,
6672,
29889,
303,
1160,
353,
696,
1028,
29891,
29889,
2481,
29889,
3707,
580,
13,
4706,
5174,
696,
1028,
29891,
29889,
11739,
29879,
29889,
1672,
29903,
6644,
2451,
29901,
13,
9651,
1209,
13,
13,
4706,
18593,
29918,
303,
1160,
287,
29889,
4220,
29889,
3283,
353,
8984,
10456,
3283,
29897,
13,
4706,
18593,
29918,
303,
1160,
287,
29889,
4220,
29889,
20659,
353,
751,
25744,
291,
10456,
20659,
29897,
13,
4706,
736,
18593,
29918,
303,
1160,
287,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
9872,
29925,
852,
21313,
3283,
1118,
426,
20659,
1800,
29958,
1642,
4830,
29898,
13,
9651,
2602,
29922,
1311,
29889,
3283,
29889,
25027,
391,
3285,
13,
9651,
19843,
29922,
1311,
29889,
20659,
29889,
25027,
391,
3285,
13,
9651,
931,
29922,
1311,
29889,
6672,
29889,
303,
1160,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
9872,
29925,
852,
21313,
3283,
1118,
426,
20659,
29913,
1125,
426,
2230,
17428,
1642,
4830,
29898,
13,
9651,
2602,
29922,
1311,
29889,
3283,
29889,
25027,
391,
3285,
13,
9651,
19843,
29922,
1311,
29889,
20659,
29889,
25027,
391,
3285,
13,
9651,
931,
29922,
1311,
29889,
6672,
29889,
303,
1160,
29897,
13,
13,
13,
1990,
12218,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
11346,
2547,
5987,
385,
1967,
322,
278,
18593,
372,
471,
4586,
297,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
18593,
29918,
303,
1160,
287,
584,
349,
852,
855,
1160,
287,
13,
4706,
450,
18593,
310,
278,
4192,
650,
746,
278,
1967,
471,
4586,
29889,
13,
1678,
1967,
584,
7084,
13,
4706,
450,
1967,
393,
471,
4586,
29889,
13,
13,
1678,
6212,
5026,
13,
1678,
448,
1378,
29899,
13,
1678,
18593,
29918,
303,
1160,
287,
584,
349,
852,
855,
1160,
287,
13,
4706,
450,
10650,
18593,
2643,
310,
278,
4192,
650,
472,
607,
278,
1967,
471,
4586,
29889,
13,
1678,
18593,
584,
349,
852,
13,
4706,
450,
18593,
310,
278,
4192,
650,
472,
607,
278,
1967,
471,
4586,
29889,
13,
1678,
13733,
29918,
5344,
584,
7442,
29889,
299,
2378,
13,
4706,
450,
13733,
4636,
310,
278,
3515,
19843,
29889,
13,
1678,
1967,
584,
7084,
13,
4706,
450,
1967,
393,
471,
4586,
29889,
13,
1678,
25214,
584,
696,
1028,
29891,
29889,
17627,
603,
29889,
2481,
13,
4706,
450,
14334,
310,
278,
18593,
29889,
13,
1678,
25214,
29918,
710,
584,
851,
13,
4706,
450,
14334,
310,
278,
18593,
29892,
297,
5199,
19909,
3402,
29889,
13,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
18593,
29918,
303,
1160,
287,
29892,
1967,
1125,
13,
4706,
1583,
29889,
4220,
29918,
303,
1160,
287,
353,
18593,
29918,
303,
1160,
287,
13,
4706,
1583,
29889,
4220,
353,
349,
852,
29898,
4220,
29918,
303,
1160,
287,
29897,
13,
4706,
1583,
29889,
5450,
362,
29918,
5344,
353,
751,
271,
29889,
5450,
362,
29918,
5344,
29898,
1311,
29889,
4220,
29889,
20659,
29897,
13,
4706,
1583,
29889,
3027,
353,
1967,
13,
4706,
1583,
29889,
303,
1160,
353,
1583,
29889,
4220,
29889,
6672,
29889,
303,
1160,
13,
4706,
1583,
29889,
303,
1160,
29918,
710,
353,
851,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
613,
13,
462,
462,
29871,
1887,
2230,
29898,
1311,
29889,
303,
1160,
29889,
517,
29918,
2230,
22130,
13,
13,
1678,
732,
6954,
29877,
675,
13,
1678,
822,
1104,
29918,
3283,
29898,
1311,
29892,
18593,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
278,
6198,
2602,
411,
1790,
18593,
29892,
411,
1887,
3407,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
18593,
584,
349,
852,
13,
9651,
450,
3646,
18593,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
921,
29892,
343,
29892,
503,
6198,
11909,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
4220,
29889,
2674,
29918,
3283,
29898,
4220,
29892,
13,
462,
462,
418,
13733,
29918,
5344,
29922,
1311,
29889,
5450,
362,
29918,
5344,
29897,
13,
13,
1678,
732,
6954,
29877,
675,
13,
1678,
822,
1104,
29918,
29872,
8584,
29898,
1311,
29892,
18593,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
278,
6198,
10696,
411,
1790,
18593,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
18593,
584,
349,
852,
13,
9651,
450,
3646,
18593,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
6198,
10696,
408,
382,
8584,
29892,
297,
278,
1797,
310,
15905,
29892,
9679,
29892,
343,
1450,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
4220,
29889,
2674,
29918,
29872,
8584,
29898,
4220,
29897,
13,
13,
1678,
732,
6954,
29877,
675,
13,
1678,
822,
5418,
29898,
1311,
29892,
18593,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
278,
5418,
304,
1790,
18593,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
18593,
584,
349,
852,
13,
9651,
450,
3646,
18593,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
5785,
13,
9651,
450,
5418,
304,
278,
3646,
18593,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
4220,
29889,
19244,
29898,
4220,
29897,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
9872,
4308,
3319,
4220,
1800,
29958,
1642,
4830,
29898,
4220,
29922,
1311,
29889,
4220,
29897,
13,
13,
13,
1990,
383,
586,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
8989,
310,
1776,
3519,
29889,
13,
13,
1678,
9995,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
270,
29906,
29894,
29898,
29888,
586,
29918,
6051,
351,
7177,
29892,
9565,
29918,
3605,
601,
29922,
29946,
847,
29871,
29941,
1125,
13,
4706,
9995,
13,
4706,
14806,
263,
19640,
1746,
310,
1776,
304,
11408,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
285,
586,
29918,
6051,
351,
7177,
584,
5785,
13,
9651,
450,
19640,
1746,
310,
1776,
29889,
13,
4706,
9565,
29918,
3605,
601,
29901,
28379,
29961,
7411,
29962,
13,
9651,
450,
9565,
11959,
310,
278,
2479,
29889,
13109,
338,
29871,
29946,
29901,
29941,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
5785,
13,
9651,
450,
11408,
1746,
310,
1776,
29889,
13,
13,
4706,
9995,
13,
4706,
11959,
29918,
6051,
351,
7177,
353,
7442,
29889,
3676,
29898,
29896,
718,
9565,
29918,
3605,
601,
1068,
29906,
29897,
13,
4706,
736,
29871,
29906,
334,
364,
29906,
29881,
29898,
9302,
29889,
27014,
273,
29898,
9302,
29889,
13161,
29898,
29881,
29906,
29878,
29898,
29888,
586,
29918,
6051,
351,
7177,
29897,
847,
29871,
29906,
29897,
13,
462,
462,
847,
11959,
29918,
6051,
351,
7177,
876,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
325,
29906,
29882,
29898,
29888,
586,
29918,
18575,
29892,
9565,
29918,
3605,
601,
29922,
29946,
847,
29871,
29941,
1125,
13,
4706,
9995,
13,
4706,
14806,
263,
11408,
1746,
310,
1776,
304,
14698,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
285,
586,
29918,
18575,
584,
5785,
13,
9651,
450,
11408,
1746,
310,
1776,
29889,
13,
4706,
9565,
29918,
3605,
601,
29901,
28379,
29961,
7411,
29962,
13,
9651,
450,
9565,
11959,
310,
278,
2479,
29889,
13109,
338,
29871,
29946,
29901,
29941,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
5785,
13,
9651,
450,
14698,
1746,
310,
1776,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
29871,
29906,
334,
364,
29906,
29881,
29898,
9302,
29889,
27014,
273,
29898,
9302,
29889,
13161,
29898,
29881,
29906,
29878,
29898,
29888,
586,
29918,
18575,
29897,
847,
29871,
29906,
29897,
334,
9565,
29918,
3605,
601,
876,
13,
13,
13,
1990,
751,
271,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
751,
25744,
291,
3519,
29889,
13,
13,
1678,
9995,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
304,
29918,
29872,
8584,
29898,
339,
25744,
291,
1125,
13,
4706,
9995,
13,
4706,
10726,
263,
439,
25744,
291,
304,
385,
382,
8584,
10696,
8954,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
439,
25744,
291,
584,
7442,
29889,
299,
2378,
13,
9651,
319,
439,
25744,
291,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
382,
8584,
10696,
29892,
297,
278,
1797,
310,
15905,
29892,
9679,
29892,
343,
1450,
29889,
13,
13,
4706,
9995,
13,
4706,
396,
694,
1144,
27988,
10772,
2525,
9778,
1490,
1123,
10662,
13,
4706,
736,
15886,
29889,
9067,
800,
29889,
29872,
8584,
29918,
3166,
29918,
339,
25744,
291,
29898,
339,
25744,
291,
29892,
13,
462,
462,
462,
4706,
382,
13309,
1001,
29918,
6007,
29963,
3919,
2725,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
304,
29918,
8990,
29898,
339,
25744,
291,
1125,
13,
4706,
9995,
13,
4706,
10726,
263,
439,
25744,
291,
304,
385,
9685,
29899,
2521,
8954,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
439,
25744,
291,
584,
7442,
29889,
299,
2378,
13,
9651,
319,
439,
25744,
291,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
29889,
13,
13,
4706,
8695,
13,
4706,
448,
807,
13,
308,
30209,
338,
297,
14496,
3265,
1135,
2971,
5834,
29892,
363,
16326,
310,
13465,
297,
29508,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
18761,
13,
9651,
450,
10696,
297,
9685,
29899,
2521,
8954,
29892,
411,
278,
1797,
310,
29871,
30209,
29892,
921,
29892,
343,
29892,
13,
9651,
503,
29889,
29871,
30209,
338,
297,
14496,
29889,
13,
13,
4706,
9995,
13,
4706,
921,
29892,
343,
29892,
503,
29892,
281,
353,
5190,
29918,
8111,
29898,
339,
25744,
291,
29897,
13,
4706,
10696,
353,
364,
29906,
29881,
29898,
29906,
334,
7442,
29889,
279,
617,
359,
29898,
29893,
876,
13,
13,
4706,
565,
10696,
1275,
29871,
29900,
29901,
13,
9651,
9685,
29918,
29916,
353,
29871,
29896,
13,
9651,
9685,
29918,
29891,
353,
9685,
29918,
29920,
353,
29871,
29900,
13,
4706,
25342,
10696,
1273,
29871,
29896,
29947,
29900,
1275,
29871,
29900,
29901,
13,
9651,
9685,
29918,
29916,
29892,
9685,
29918,
29891,
29892,
9685,
29918,
29920,
353,
921,
29892,
343,
29892,
503,
13,
4706,
1683,
29901,
13,
9651,
9685,
29918,
29916,
353,
921,
847,
7442,
29889,
3676,
29898,
29896,
448,
281,
1068,
29906,
29897,
13,
9651,
9685,
29918,
29891,
353,
343,
847,
7442,
29889,
3676,
29898,
29896,
448,
281,
1068,
29906,
29897,
13,
9651,
9685,
29918,
29920,
353,
503,
847,
7442,
29889,
3676,
29898,
29896,
448,
281,
1068,
29906,
29897,
13,
13,
4706,
736,
10696,
29892,
9685,
29918,
29916,
29892,
9685,
29918,
29891,
29892,
9685,
29918,
29920,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
3234,
29898,
29874,
29892,
289,
1125,
13,
4706,
9995,
13,
4706,
10987,
278,
3234,
310,
1023,
439,
25744,
1080,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
263,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
319,
439,
25744,
291,
29892,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
13,
4706,
289,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
319,
439,
25744,
291,
29892,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
319,
439,
25744,
291,
29892,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
13,
13,
4706,
9995,
13,
4706,
6382,
3821,
29918,
1595,
353,
263,
29961,
29941,
29962,
334,
289,
7503,
29941,
29962,
718,
289,
29961,
29941,
29962,
334,
263,
7503,
29941,
29962,
718,
7442,
29889,
19128,
29898,
29874,
7503,
29941,
1402,
289,
7503,
29941,
2314,
13,
4706,
1855,
29918,
1595,
353,
263,
29961,
29941,
29962,
334,
289,
29961,
29941,
29962,
448,
7442,
29889,
6333,
29898,
29874,
7503,
29941,
1402,
289,
7503,
29941,
2314,
13,
4706,
736,
7442,
29889,
4397,
29898,
326,
351,
3821,
29918,
1595,
29892,
1855,
29918,
1595,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
16402,
29898,
339,
25744,
291,
1125,
13,
4706,
9995,
13,
4706,
7106,
278,
16402,
310,
263,
439,
25744,
291,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
439,
25744,
291,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
319,
439,
25744,
291,
29892,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
16402,
310,
278,
439,
25744,
291,
29889,
13,
13,
4706,
9995,
13,
4706,
736,
313,
339,
25744,
291,
334,
7442,
29889,
2378,
4197,
29899,
29896,
29892,
448,
29896,
29892,
448,
29896,
29892,
29871,
29896,
2314,
13,
18884,
847,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
339,
25744,
291,
29897,
1068,
29906,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1104,
29918,
5450,
362,
29898,
29874,
29892,
289,
1125,
13,
4706,
9995,
13,
4706,
10987,
278,
439,
25744,
291,
607,
13880,
263,
13733,
515,
421,
29874,
29952,
304,
421,
29890,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
263,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
319,
439,
25744,
291,
29892,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
13,
4706,
289,
584,
922,
3910,
29961,
7411,
29962,
13,
9651,
319,
439,
25744,
291,
29892,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
319,
439,
25744,
291,
29892,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
13,
13,
4706,
9995,
13,
4706,
736,
751,
271,
29889,
4704,
29898,
5441,
29918,
8111,
29898,
29874,
511,
751,
271,
29889,
262,
3901,
29898,
5441,
29918,
8111,
29898,
29890,
4961,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
13733,
29918,
5344,
29898,
339,
25744,
291,
1125,
13,
4706,
9995,
13,
4706,
6204,
278,
13733,
4636,
310,
263,
439,
25744,
291,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
439,
25744,
291,
584,
7442,
29889,
299,
2378,
13,
9651,
319,
439,
25744,
291,
297,
278,
1797,
310,
921,
29892,
343,
29892,
503,
29892,
281,
29889,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
319,
29871,
29941,
29916,
29941,
13733,
4636,
15783,
278,
439,
25744,
291,
29889,
13,
13,
4706,
28318,
13,
4706,
448,
1378,
29899,
13,
4706,
6317,
518,
29896,
29962,
14109,
29892,
9664,
362,
22513,
29889,
13,
1669,
2045,
597,
264,
29889,
6011,
29889,
990,
29914,
4594,
29914,
21281,
362,
29918,
5344,
29937,
2182,
25744,
291,
13,
13,
4706,
9995,
13,
4706,
921,
29892,
343,
29892,
503,
29892,
281,
353,
439,
25744,
291,
13,
4706,
302,
353,
2533,
29898,
339,
25744,
291,
1068,
29906,
29897,
13,
13,
4706,
565,
302,
1275,
29871,
29900,
29901,
13,
9651,
736,
7442,
29889,
22350,
29898,
29941,
29897,
13,
13,
4706,
269,
353,
29871,
29906,
847,
302,
13,
13,
4706,
26437,
353,
269,
334,
281,
334,
921,
13,
4706,
5018,
353,
269,
334,
281,
334,
343,
13,
4706,
18589,
353,
269,
334,
281,
334,
503,
13,
13,
4706,
15473,
353,
269,
334,
921,
334,
921,
13,
4706,
921,
29891,
353,
269,
334,
921,
334,
343,
13,
4706,
921,
29920,
353,
269,
334,
921,
334,
503,
13,
13,
4706,
343,
29891,
353,
269,
334,
343,
334,
343,
13,
4706,
343,
29920,
353,
269,
334,
343,
334,
503,
13,
4706,
503,
29920,
353,
269,
334,
503,
334,
503,
13,
13,
4706,
736,
7442,
29889,
2378,
4197,
29961,
29896,
448,
313,
8071,
718,
503,
29920,
511,
921,
29891,
448,
18589,
29892,
5018,
1402,
13,
462,
308,
518,
29893,
29920,
29892,
29871,
29896,
448,
313,
4419,
718,
503,
29920,
511,
343,
29920,
448,
26437,
1402,
13,
462,
308,
518,
29916,
29920,
448,
5018,
29892,
343,
29920,
718,
26437,
29892,
29871,
29896,
448,
313,
4419,
718,
343,
29891,
4638,
2314,
13,
2
] |
train.py | Omrigan/shiny-language-learner | 2 | 166113 | <reponame>Omrigan/shiny-language-learner<gh_stars>1-10
import random
import telegram
import datetime
import study_settings
import copy
params = {}
langs = {
1: {'original': 'en',
'candidacies': 'ru'
},
2: {'original': 'ru',
'candidacies': 'en'
}
}
choose = 'Choose train type:\n' \
'1-foreign->native\n' \
'2-native->foreign\n' \
'3-write foreign'
def do_train(user, string):
if user['train']['type'] == 0:
user['train']['type'] = -1
telegram.send_message(user['chat_id'], choose, reply_markup=telegram.chooseTrainKeyboard)
elif user['train']['type'] == -1:
if string == 'end':
end_train(user, string)
else:
user['train']['type'] = int(string)
trains[user['train']['type']](user, string, overwrite=True)
else:
trains[user['train']['type']](user, string)
def do_variant_train(user, string, overwrite=False):
out_str = ""
was_incorrect = False
lang_original = langs[user['train']['type']]['original']
lang_candidacies = langs[user['train']['type']]['candidacies']
if string[0] == '/':
overwrite = True
if not overwrite:
try:
a = int(string) - 1
except ValueError:
telegram.send_message(user['chat_id'], "Error parse!")
return
for w in user['words']:
if w == user['train']['word']:
if user['train']['correct'] == a:
out_str += "Correct\n"
if w['stage'] < study_settings.max_stage:
w['stage'] += 1
w['expiration_date'] = datetime.datetime.utcnow() + study_settings.stages[w['stage']]
else:
out_str += "Incorrect\nThe correct one is %s \n" % (w[lang_candidacies],)
if w['stage'] > study_settings.min_stage:
w['stage'] -= 1
was_incorrect = True
if len(list(filter(lambda _: _['expiration_date'] < datetime.datetime.utcnow(), user['words']))) > 8:
if not was_incorrect:
word_list = sorted(user['words'], key=lambda _: _['expiration_date'])[0:8]
random.shuffle(word_list)
word_list = word_list[0:4]
user['train']['word_list'] = word_list
cnt = random.randint(0, 3)
user['train']['word'] = word_list[cnt]
user['train']['correct'] = cnt
out_str += user['train']['word'][lang_original] + "\n"
for i, w in zip(range(4), user['train']['word_list']):
out_str += "%s - %s\n" % (i + 1, w[lang_candidacies])
else:
out_str += "Not enough words\n"
user['train']['type'] = 0
if user['train']['type'] == 0:
telegram.send_message(user['chat_id'], out_str, reply_markup=telegram.hideKeyboard)
else:
telegram.send_message(user['chat_id'], out_str, reply_markup=telegram.variantTrainKeyboard)
def do_translate_train(user, string, overwrite=False):
out_str = ""
was_incorrect = False
if not overwrite:
for w in user['words']:
if w['ru'] == user['train']['word']['ru']:
if w['en'].lower() == string.lower():
out_str += "Correct\n"
if w['stage'] < study_settings.max_stage:
w['stage'] += 1
w['expiration_date'] = datetime.datetime.utcnow() + study_settings.stages[w['stage']]
else:
out_str += "Incorrect\nThe correct one is %s \n" % (w['en'],)
if w['stage'] > study_settings.min_stage:
w['stage'] -= 1
was_incorrect = True
sup = list(filter(lambda _: _['expiration_date'] < datetime.datetime.utcnow() and
_['stage'] >= study_settings.min_translation_stage, user['words']))
if len(sup) > 1:
if not was_incorrect:
word = copy.deepcopy(random.choice(sup))
user['train']['word'] = word
user['train']['shuffled'] = ''.join(random.sample(word['en'].lower(), len(word['en'])))
out_str += user['train']['word']['ru'] + "\n"
if 'shuffled' in user['train']:
out_str += user['train']['shuffled'] + "\n"
else:
out_str += "Not enough words\n"
user['train']['type'] = 0
telegram.send_message(user['chat_id'], out_str, reply_markup=telegram.hideKeyboard)
trains = {
1: do_variant_train,
2: do_variant_train,
3: do_translate_train
}
def end_train(user, string):
if user['train']['type'] == 0:
out_str = "No train is in process"
else:
out_str = "Train ended"
user['train']['type'] = 0
telegram.send_message(user['chat_id'], out_str, reply_markup=telegram.hideKeyboard)
| [
1,
529,
276,
1112,
420,
29958,
5673,
8966,
273,
29914,
845,
4901,
29899,
11675,
29899,
1945,
1089,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
4036,
13,
5215,
4382,
1393,
13,
5215,
12865,
13,
5215,
6559,
29918,
11027,
13,
5215,
3509,
13,
13,
7529,
353,
6571,
13,
13,
3893,
29879,
353,
426,
13,
13,
268,
29896,
29901,
11117,
13492,
2396,
525,
264,
742,
13,
4706,
525,
29883,
392,
1458,
2478,
2396,
525,
582,
29915,
13,
4706,
2981,
13,
268,
29906,
29901,
11117,
13492,
2396,
525,
582,
742,
13,
4706,
525,
29883,
392,
1458,
2478,
2396,
525,
264,
29915,
13,
4706,
500,
13,
29913,
13,
13,
21803,
353,
525,
15954,
852,
7945,
1134,
3583,
29876,
29915,
320,
13,
308,
525,
29896,
29899,
1079,
647,
976,
11487,
29905,
29876,
29915,
320,
13,
308,
525,
29906,
29899,
11487,
976,
1079,
647,
29905,
29876,
29915,
320,
13,
308,
525,
29941,
29899,
3539,
9117,
29915,
13,
13,
13,
1753,
437,
29918,
14968,
29898,
1792,
29892,
1347,
1125,
13,
1678,
565,
1404,
1839,
14968,
16215,
1853,
2033,
1275,
29871,
29900,
29901,
13,
4706,
1404,
1839,
14968,
16215,
1853,
2033,
353,
448,
29896,
13,
4706,
4382,
1393,
29889,
6717,
29918,
4906,
29898,
1792,
1839,
13496,
29918,
333,
7464,
6755,
29892,
8908,
29918,
3502,
786,
29922,
15494,
1393,
29889,
21803,
5323,
262,
2558,
3377,
29897,
13,
1678,
25342,
1404,
1839,
14968,
16215,
1853,
2033,
1275,
448,
29896,
29901,
13,
4706,
565,
1347,
1275,
525,
355,
2396,
13,
9651,
1095,
29918,
14968,
29898,
1792,
29892,
1347,
29897,
13,
4706,
1683,
29901,
13,
9651,
1404,
1839,
14968,
16215,
1853,
2033,
353,
938,
29898,
1807,
29897,
13,
9651,
22983,
29961,
1792,
1839,
14968,
16215,
1853,
2033,
850,
1792,
29892,
1347,
29892,
26556,
29922,
5574,
29897,
13,
1678,
1683,
29901,
13,
4706,
22983,
29961,
1792,
1839,
14968,
16215,
1853,
2033,
850,
1792,
29892,
1347,
29897,
13,
13,
13,
1753,
437,
29918,
19365,
29918,
14968,
29898,
1792,
29892,
1347,
29892,
26556,
29922,
8824,
1125,
13,
1678,
714,
29918,
710,
353,
5124,
13,
1678,
471,
29918,
262,
15728,
353,
7700,
13,
1678,
6361,
29918,
13492,
353,
6361,
29879,
29961,
1792,
1839,
14968,
16215,
1853,
2033,
22322,
13492,
2033,
13,
1678,
6361,
29918,
29883,
392,
1458,
2478,
353,
6361,
29879,
29961,
1792,
1839,
14968,
16215,
1853,
2033,
22322,
29883,
392,
1458,
2478,
2033,
13,
1678,
565,
1347,
29961,
29900,
29962,
1275,
8207,
2396,
13,
4706,
26556,
353,
5852,
13,
1678,
565,
451,
26556,
29901,
13,
13,
4706,
1018,
29901,
13,
9651,
263,
353,
938,
29898,
1807,
29897,
448,
29871,
29896,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
4382,
1393,
29889,
6717,
29918,
4906,
29898,
1792,
1839,
13496,
29918,
333,
7464,
376,
2392,
6088,
29991,
1159,
13,
9651,
736,
13,
4706,
363,
281,
297,
1404,
1839,
9303,
2033,
29901,
13,
9651,
565,
281,
1275,
1404,
1839,
14968,
16215,
1742,
2033,
29901,
13,
18884,
565,
1404,
1839,
14968,
16215,
15728,
2033,
1275,
263,
29901,
13,
462,
1678,
714,
29918,
710,
4619,
376,
12521,
1621,
29905,
29876,
29908,
13,
462,
1678,
565,
281,
1839,
19190,
2033,
529,
6559,
29918,
11027,
29889,
3317,
29918,
19190,
29901,
13,
462,
4706,
281,
1839,
19190,
2033,
4619,
29871,
29896,
13,
462,
1678,
281,
1839,
4548,
12232,
29918,
1256,
2033,
353,
12865,
29889,
12673,
29889,
329,
29883,
3707,
580,
718,
6559,
29918,
11027,
29889,
303,
1179,
29961,
29893,
1839,
19190,
2033,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
714,
29918,
710,
4619,
376,
797,
15728,
29905,
29876,
1576,
1959,
697,
338,
1273,
29879,
320,
29876,
29908,
1273,
313,
29893,
29961,
3893,
29918,
29883,
392,
1458,
2478,
1402,
29897,
13,
462,
1678,
565,
281,
1839,
19190,
2033,
1405,
6559,
29918,
11027,
29889,
1195,
29918,
19190,
29901,
13,
462,
4706,
281,
1839,
19190,
2033,
22361,
29871,
29896,
13,
462,
1678,
471,
29918,
262,
15728,
353,
5852,
13,
13,
1678,
565,
7431,
29898,
1761,
29898,
4572,
29898,
2892,
903,
29901,
903,
1839,
4548,
12232,
29918,
1256,
2033,
529,
12865,
29889,
12673,
29889,
329,
29883,
3707,
3285,
1404,
1839,
9303,
2033,
4961,
1405,
29871,
29947,
29901,
13,
4706,
565,
451,
471,
29918,
262,
15728,
29901,
13,
9651,
1734,
29918,
1761,
353,
12705,
29898,
1792,
1839,
9303,
7464,
1820,
29922,
2892,
903,
29901,
903,
1839,
4548,
12232,
29918,
1256,
2033,
9601,
29900,
29901,
29947,
29962,
13,
9651,
4036,
29889,
845,
21897,
29898,
1742,
29918,
1761,
29897,
13,
9651,
1734,
29918,
1761,
353,
1734,
29918,
1761,
29961,
29900,
29901,
29946,
29962,
13,
9651,
1404,
1839,
14968,
16215,
1742,
29918,
1761,
2033,
353,
1734,
29918,
1761,
13,
9651,
274,
593,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
29871,
29941,
29897,
13,
9651,
1404,
1839,
14968,
16215,
1742,
2033,
353,
1734,
29918,
1761,
29961,
20047,
29962,
13,
9651,
1404,
1839,
14968,
16215,
15728,
2033,
353,
274,
593,
13,
4706,
714,
29918,
710,
4619,
1404,
1839,
14968,
16215,
1742,
2033,
29961,
3893,
29918,
13492,
29962,
718,
6634,
29876,
29908,
13,
4706,
363,
474,
29892,
281,
297,
14319,
29898,
3881,
29898,
29946,
511,
1404,
1839,
14968,
16215,
1742,
29918,
1761,
2033,
1125,
13,
9651,
714,
29918,
710,
4619,
11860,
29879,
448,
1273,
29879,
29905,
29876,
29908,
1273,
313,
29875,
718,
29871,
29896,
29892,
281,
29961,
3893,
29918,
29883,
392,
1458,
2478,
2314,
13,
1678,
1683,
29901,
13,
4706,
714,
29918,
710,
4619,
376,
3664,
3307,
3838,
29905,
29876,
29908,
13,
4706,
1404,
1839,
14968,
16215,
1853,
2033,
353,
29871,
29900,
13,
1678,
565,
1404,
1839,
14968,
16215,
1853,
2033,
1275,
29871,
29900,
29901,
13,
4706,
4382,
1393,
29889,
6717,
29918,
4906,
29898,
1792,
1839,
13496,
29918,
333,
7464,
714,
29918,
710,
29892,
8908,
29918,
3502,
786,
29922,
15494,
1393,
29889,
11458,
2558,
3377,
29897,
13,
1678,
1683,
29901,
13,
4706,
4382,
1393,
29889,
6717,
29918,
4906,
29898,
1792,
1839,
13496,
29918,
333,
7464,
714,
29918,
710,
29892,
8908,
29918,
3502,
786,
29922,
15494,
1393,
29889,
19365,
5323,
262,
2558,
3377,
29897,
13,
13,
13,
1753,
437,
29918,
21652,
29918,
14968,
29898,
1792,
29892,
1347,
29892,
26556,
29922,
8824,
1125,
13,
1678,
714,
29918,
710,
353,
5124,
13,
1678,
471,
29918,
262,
15728,
353,
7700,
13,
1678,
565,
451,
26556,
29901,
13,
4706,
363,
281,
297,
1404,
1839,
9303,
2033,
29901,
13,
9651,
565,
281,
1839,
582,
2033,
1275,
1404,
1839,
14968,
16215,
1742,
16215,
582,
2033,
29901,
13,
18884,
565,
281,
1839,
264,
13359,
13609,
580,
1275,
1347,
29889,
13609,
7295,
13,
462,
1678,
714,
29918,
710,
4619,
376,
12521,
1621,
29905,
29876,
29908,
13,
462,
1678,
565,
281,
1839,
19190,
2033,
529,
6559,
29918,
11027,
29889,
3317,
29918,
19190,
29901,
13,
462,
4706,
281,
1839,
19190,
2033,
4619,
29871,
29896,
13,
462,
1678,
281,
1839,
4548,
12232,
29918,
1256,
2033,
353,
12865,
29889,
12673,
29889,
329,
29883,
3707,
580,
718,
6559,
29918,
11027,
29889,
303,
1179,
29961,
29893,
1839,
19190,
2033,
29962,
13,
18884,
1683,
29901,
13,
462,
1678,
714,
29918,
710,
4619,
376,
797,
15728,
29905,
29876,
1576,
1959,
697,
338,
1273,
29879,
320,
29876,
29908,
1273,
313,
29893,
1839,
264,
7464,
29897,
13,
462,
1678,
565,
281,
1839,
19190,
2033,
1405,
6559,
29918,
11027,
29889,
1195,
29918,
19190,
29901,
13,
462,
4706,
281,
1839,
19190,
2033,
22361,
29871,
29896,
13,
462,
1678,
471,
29918,
262,
15728,
353,
5852,
13,
1678,
13159,
353,
1051,
29898,
4572,
29898,
2892,
903,
29901,
903,
1839,
4548,
12232,
29918,
1256,
2033,
529,
12865,
29889,
12673,
29889,
329,
29883,
3707,
580,
322,
13,
462,
18884,
903,
1839,
19190,
2033,
6736,
6559,
29918,
11027,
29889,
1195,
29918,
3286,
18411,
29918,
19190,
29892,
1404,
1839,
9303,
25901,
13,
1678,
565,
7431,
29898,
12587,
29897,
1405,
29871,
29896,
29901,
13,
4706,
565,
451,
471,
29918,
262,
15728,
29901,
13,
9651,
1734,
353,
3509,
29889,
24535,
8552,
29898,
8172,
29889,
16957,
29898,
12587,
876,
13,
9651,
1404,
1839,
14968,
16215,
1742,
2033,
353,
1734,
13,
9651,
1404,
1839,
14968,
16215,
845,
3096,
839,
2033,
353,
525,
4286,
7122,
29898,
8172,
29889,
11249,
29898,
1742,
1839,
264,
13359,
13609,
3285,
7431,
29898,
1742,
1839,
264,
2033,
4961,
13,
4706,
714,
29918,
710,
4619,
1404,
1839,
14968,
16215,
1742,
16215,
582,
2033,
718,
6634,
29876,
29908,
13,
4706,
565,
525,
845,
3096,
839,
29915,
297,
1404,
1839,
14968,
2033,
29901,
13,
9651,
714,
29918,
710,
4619,
1404,
1839,
14968,
16215,
845,
3096,
839,
2033,
718,
6634,
29876,
29908,
13,
1678,
1683,
29901,
13,
4706,
714,
29918,
710,
4619,
376,
3664,
3307,
3838,
29905,
29876,
29908,
13,
4706,
1404,
1839,
14968,
16215,
1853,
2033,
353,
29871,
29900,
13,
1678,
4382,
1393,
29889,
6717,
29918,
4906,
29898,
1792,
1839,
13496,
29918,
333,
7464,
714,
29918,
710,
29892,
8908,
29918,
3502,
786,
29922,
15494,
1393,
29889,
11458,
2558,
3377,
29897,
13,
13,
13,
3018,
1144,
353,
426,
13,
268,
29896,
29901,
437,
29918,
19365,
29918,
14968,
29892,
13,
268,
29906,
29901,
437,
29918,
19365,
29918,
14968,
29892,
13,
268,
29941,
29901,
437,
29918,
21652,
29918,
14968,
13,
29913,
13,
13,
13,
1753,
1095,
29918,
14968,
29898,
1792,
29892,
1347,
1125,
13,
1678,
565,
1404,
1839,
14968,
16215,
1853,
2033,
1275,
29871,
29900,
29901,
13,
4706,
714,
29918,
710,
353,
376,
3782,
7945,
338,
297,
1889,
29908,
13,
1678,
1683,
29901,
13,
4706,
714,
29918,
710,
353,
376,
5323,
262,
9698,
29908,
13,
1678,
1404,
1839,
14968,
16215,
1853,
2033,
353,
29871,
29900,
13,
1678,
4382,
1393,
29889,
6717,
29918,
4906,
29898,
1792,
1839,
13496,
29918,
333,
7464,
714,
29918,
710,
29892,
8908,
29918,
3502,
786,
29922,
15494,
1393,
29889,
11458,
2558,
3377,
29897,
13,
2
] |
server.py | RaphaelOlivier/deepspeech.pytorch | 1 | 105056 | import logging
import os
from tempfile import NamedTemporaryFile
import hydra
import torch
from flask import Flask, request, jsonify
from hydra.core.config_store import ConfigStore
from deepspeech_pytorch.configs.inference_config import ServerConfig
from deepspeech_pytorch.inference import run_transcribe
from deepspeech_pytorch.loader.data_loader import SpectrogramParser
from deepspeech_pytorch.utils import load_model, load_decoder
app = Flask(__name__)
ALLOWED_EXTENSIONS = set(['.wav', '.mp3', '.ogg', '.webm'])
cs = ConfigStore.instance()
cs.store(name="config", node=ServerConfig)
@app.route('/transcribe', methods=['POST'])
def transcribe_file():
if request.method == 'POST':
res = {}
if 'file' not in request.files:
res['status'] = "error"
res['message'] = "audio file should be passed for the transcription"
return jsonify(res)
file = request.files['file']
filename = file.filename
_, file_extension = os.path.splitext(filename)
if file_extension.lower() not in ALLOWED_EXTENSIONS:
res['status'] = "error"
res['message'] = "{} is not supported format.".format(file_extension)
return jsonify(res)
with NamedTemporaryFile(suffix=file_extension) as tmp_saved_audio_file:
file.save(tmp_saved_audio_file.name)
logging.info('Transcribing file...')
transcription, _ = run_transcribe(
audio_path=tmp_saved_audio_file,
spect_parser=spect_parser,
model=model,
decoder=decoder,
device=device,
precision=config.model.precision
)
logging.info('File transcribed')
res['status'] = "OK"
res['transcription'] = transcription
return jsonify(res)
@hydra.main(config_name="config")
def main(cfg: ServerConfig):
global model, spect_parser, decoder, config, device
config = cfg
logging.getLogger().setLevel(logging.DEBUG)
logging.info('Setting up server...')
device = torch.device("cuda" if cfg.model.cuda else "cpu")
model = load_model(
device=device,
model_path=cfg.model.model_path
)
decoder = load_decoder(
labels=model.labels,
cfg=cfg.lm
)
spect_parser = SpectrogramParser(
audio_conf=model.spect_cfg,
normalize=True
)
logging.info('Server initialised')
app.run(
host=cfg.host,
port=cfg.port,
debug=True,
use_reloader=False
)
if __name__ == "__main__":
main()
| [
1,
1053,
12183,
13,
5215,
2897,
13,
3166,
5694,
1445,
1053,
405,
2795,
5776,
1971,
653,
2283,
13,
13,
5215,
27246,
336,
13,
5215,
4842,
305,
13,
3166,
29784,
1053,
2379,
1278,
29892,
2009,
29892,
4390,
1598,
13,
3166,
27246,
336,
29889,
3221,
29889,
2917,
29918,
8899,
1053,
12782,
9044,
13,
13,
3166,
316,
8961,
412,
5309,
29918,
2272,
7345,
305,
29889,
2917,
29879,
29889,
262,
1659,
29918,
2917,
1053,
5656,
3991,
13,
3166,
316,
8961,
412,
5309,
29918,
2272,
7345,
305,
29889,
262,
1659,
1053,
1065,
29918,
3286,
29581,
13,
3166,
316,
8961,
412,
5309,
29918,
2272,
7345,
305,
29889,
12657,
29889,
1272,
29918,
12657,
1053,
27738,
307,
1393,
11726,
13,
3166,
316,
8961,
412,
5309,
29918,
2272,
7345,
305,
29889,
13239,
1053,
2254,
29918,
4299,
29892,
2254,
29918,
7099,
6119,
13,
13,
932,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
1964,
27998,
3352,
29918,
12194,
1430,
13381,
29903,
353,
731,
18959,
29889,
29893,
485,
742,
15300,
1526,
29941,
742,
15300,
468,
29887,
742,
15300,
2676,
29885,
11287,
13,
13,
2395,
353,
12782,
9044,
29889,
8758,
580,
13,
2395,
29889,
8899,
29898,
978,
543,
2917,
613,
2943,
29922,
6004,
3991,
29897,
13,
13,
13,
29992,
932,
29889,
13134,
11219,
3286,
29581,
742,
3519,
29922,
1839,
5438,
11287,
13,
1753,
1301,
29581,
29918,
1445,
7295,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
620,
353,
6571,
13,
4706,
565,
525,
1445,
29915,
451,
297,
2009,
29889,
5325,
29901,
13,
9651,
620,
1839,
4882,
2033,
353,
376,
2704,
29908,
13,
9651,
620,
1839,
4906,
2033,
353,
376,
18494,
934,
881,
367,
4502,
363,
278,
1301,
3395,
29908,
13,
9651,
736,
4390,
1598,
29898,
690,
29897,
13,
4706,
934,
353,
2009,
29889,
5325,
1839,
1445,
2033,
13,
4706,
10422,
353,
934,
29889,
9507,
13,
4706,
17117,
934,
29918,
17588,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
9507,
29897,
13,
4706,
565,
934,
29918,
17588,
29889,
13609,
580,
451,
297,
15149,
9806,
3352,
29918,
12194,
1430,
13381,
29903,
29901,
13,
9651,
620,
1839,
4882,
2033,
353,
376,
2704,
29908,
13,
9651,
620,
1839,
4906,
2033,
353,
376,
8875,
338,
451,
6969,
3402,
1213,
29889,
4830,
29898,
1445,
29918,
17588,
29897,
13,
9651,
736,
4390,
1598,
29898,
690,
29897,
13,
4706,
411,
405,
2795,
5776,
1971,
653,
2283,
29898,
2146,
600,
861,
29922,
1445,
29918,
17588,
29897,
408,
13128,
29918,
17314,
29918,
18494,
29918,
1445,
29901,
13,
9651,
934,
29889,
7620,
29898,
7050,
29918,
17314,
29918,
18494,
29918,
1445,
29889,
978,
29897,
13,
9651,
12183,
29889,
3888,
877,
4300,
699,
10549,
934,
856,
1495,
13,
9651,
1301,
3395,
29892,
903,
353,
1065,
29918,
3286,
29581,
29898,
13,
18884,
10348,
29918,
2084,
29922,
7050,
29918,
17314,
29918,
18494,
29918,
1445,
29892,
13,
18884,
6683,
29918,
16680,
29922,
21494,
29918,
16680,
29892,
13,
18884,
1904,
29922,
4299,
29892,
13,
18884,
1602,
6119,
29922,
7099,
6119,
29892,
13,
18884,
4742,
29922,
10141,
29892,
13,
18884,
16716,
29922,
2917,
29889,
4299,
29889,
17990,
2459,
13,
9651,
1723,
13,
9651,
12183,
29889,
3888,
877,
2283,
1301,
23059,
1495,
13,
9651,
620,
1839,
4882,
2033,
353,
376,
8949,
29908,
13,
9651,
620,
1839,
3286,
3395,
2033,
353,
1301,
3395,
13,
9651,
736,
4390,
1598,
29898,
690,
29897,
13,
13,
13,
29992,
29882,
2941,
336,
29889,
3396,
29898,
2917,
29918,
978,
543,
2917,
1159,
13,
1753,
1667,
29898,
16859,
29901,
5656,
3991,
1125,
13,
1678,
5534,
1904,
29892,
6683,
29918,
16680,
29892,
1602,
6119,
29892,
2295,
29892,
4742,
13,
1678,
2295,
353,
274,
16434,
13,
1678,
12183,
29889,
657,
16363,
2141,
842,
10108,
29898,
21027,
29889,
18525,
29897,
13,
13,
1678,
12183,
29889,
3888,
877,
29020,
701,
1923,
856,
1495,
13,
1678,
4742,
353,
4842,
305,
29889,
10141,
703,
29883,
6191,
29908,
565,
274,
16434,
29889,
4299,
29889,
29883,
6191,
1683,
376,
21970,
1159,
13,
13,
1678,
1904,
353,
2254,
29918,
4299,
29898,
13,
4706,
4742,
29922,
10141,
29892,
13,
4706,
1904,
29918,
2084,
29922,
16859,
29889,
4299,
29889,
4299,
29918,
2084,
13,
1678,
1723,
13,
13,
1678,
1602,
6119,
353,
2254,
29918,
7099,
6119,
29898,
13,
4706,
11073,
29922,
4299,
29889,
21134,
29892,
13,
4706,
274,
16434,
29922,
16859,
29889,
21457,
13,
1678,
1723,
13,
13,
1678,
6683,
29918,
16680,
353,
27738,
307,
1393,
11726,
29898,
13,
4706,
10348,
29918,
5527,
29922,
4299,
29889,
21494,
29918,
16859,
29892,
13,
4706,
4226,
675,
29922,
5574,
13,
1678,
1723,
13,
268,
13,
1678,
12183,
29889,
3888,
877,
6004,
2847,
3368,
1495,
13,
1678,
623,
29889,
3389,
29898,
13,
4706,
3495,
29922,
16859,
29889,
3069,
29892,
13,
4706,
2011,
29922,
16859,
29889,
637,
29892,
13,
4706,
4744,
29922,
5574,
29892,
13,
4706,
671,
29918,
276,
12657,
29922,
8824,
13,
1678,
1723,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
tests/prefect_vault_secrets/conftest.py | vcdi/prefect-vault-secrets | 1 | 110753 | import pytest
import tempfile
import os
from prefect.utilities import configuration
@pytest.fixture()
def server_api():
"""
backend settings don't seem to be getting respected. As a work-around
set export PREFECT__BACKEND=server where running the tests to enforce
use of the server endpoint
"""
with tempfile.TemporaryDirectory() as tmp:
tmp = os.path.join(tmp, ".prefect")
os.makedirs(tmp)
with configuration.set_temporary_config({
"home_dir": tmp,
"backend": "server",
"cloud.api": "https:/localhost:4200",
"cloud.auth_token": "<PASSWORD>",
"cloud.use_local_secrets": False}):
yield
| [
1,
1053,
11451,
1688,
13,
5215,
5694,
1445,
13,
5215,
2897,
13,
13,
3166,
758,
3647,
29889,
4422,
1907,
1053,
5285,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
1923,
29918,
2754,
7295,
13,
1678,
9995,
13,
1678,
14998,
6055,
1016,
29915,
29873,
2833,
304,
367,
2805,
3390,
287,
29889,
29871,
1094,
263,
664,
29899,
11316,
13,
1678,
731,
5609,
349,
25866,
13845,
1649,
29933,
11375,
11794,
29922,
2974,
988,
2734,
278,
6987,
304,
427,
10118,
13,
1678,
671,
310,
278,
1923,
16248,
13,
1678,
9995,
13,
1678,
411,
5694,
1445,
29889,
5776,
1971,
653,
9882,
580,
408,
13128,
29901,
13,
4706,
13128,
353,
2897,
29889,
2084,
29889,
7122,
29898,
7050,
29892,
11393,
29886,
999,
522,
1159,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
7050,
29897,
13,
4706,
411,
5285,
29889,
842,
29918,
1356,
1971,
653,
29918,
2917,
3319,
13,
18884,
376,
5184,
29918,
3972,
1115,
13128,
29892,
13,
18884,
376,
27852,
1115,
376,
2974,
613,
13,
18884,
376,
9274,
29889,
2754,
1115,
376,
991,
8419,
7640,
29901,
29946,
29906,
29900,
29900,
613,
13,
18884,
376,
9274,
29889,
5150,
29918,
6979,
1115,
9872,
25711,
17013,
28341,
13,
18884,
376,
9274,
29889,
1509,
29918,
2997,
29918,
344,
1037,
1372,
1115,
7700,
29913,
1125,
13,
9651,
7709,
13,
2
] |
Comment/views.py | yqji/DJNeverDie | 0 | 73835 | <reponame>yqji/DJNeverDie
from django.shortcuts import render
from .models import Comment
def get_comments():
pass
| [
1,
529,
276,
1112,
420,
29958,
29891,
29939,
2397,
29914,
29928,
29967,
29940,
1310,
16334,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
13,
13,
3166,
869,
9794,
1053,
461,
13,
13,
13,
1753,
679,
29918,
21032,
7295,
13,
1678,
1209,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.