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
|
---|---|---|---|---|---|
py_projects_boilerplates/sphinx_loguru_pytest_boiler/app/modules/hello_world/tools/tools.py | rypaik/PYTHON | 0 | 45525 | <gh_stars>0
#from config import console, log
from config import console
from loguru import logger
import sys
#TODO: factory function to create logger
# setting up Logger
logger.add(sys.stderr, format="{time} {level} {message}", level="INFO")
logger.add("./common/loguru_log/Tools_{time}.log", rotation="500 MB")
# @logger.catch
# @logger.catch
def say_hello(message):
# print(message)
console.print(message, style="bold blue")
return message
logger.bind(special=True).info("This message, though, is logged to the file!") | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
3166,
2295,
1053,
2991,
29892,
1480,
13,
3166,
2295,
1053,
2991,
13,
3166,
1480,
20144,
1053,
17927,
13,
5215,
10876,
13,
29937,
4986,
3970,
29901,
12529,
740,
304,
1653,
17927,
13,
13,
29937,
4444,
701,
28468,
13,
21707,
29889,
1202,
29898,
9675,
29889,
303,
20405,
29892,
3402,
10724,
2230,
29913,
426,
5563,
29913,
426,
4906,
17671,
3233,
543,
11690,
1159,
13,
21707,
29889,
1202,
703,
6904,
9435,
29914,
1188,
20144,
29918,
1188,
29914,
24183,
648,
2230,
1836,
1188,
613,
13733,
543,
29945,
29900,
29900,
13232,
1159,
13,
13,
29937,
732,
21707,
29889,
12510,
29871,
13,
29937,
732,
21707,
29889,
12510,
13,
1753,
1827,
29918,
12199,
29898,
4906,
1125,
13,
1678,
396,
1596,
29898,
4906,
29897,
13,
1678,
2991,
29889,
2158,
29898,
4906,
29892,
3114,
543,
8934,
7254,
1159,
13,
1678,
736,
2643,
13,
1678,
17927,
29889,
5355,
29898,
18732,
29922,
5574,
467,
3888,
703,
4013,
2643,
29892,
2466,
29892,
338,
13817,
304,
278,
934,
29991,
1159,
2
] |
geniepy/src/geniepy/classmgmt/classifiers.py | geralddzx/genie | 1 | 61252 | """Implementation of predictive classifiers."""
from abc import ABC, abstractmethod
import pandas as pd
from google_drive_downloader import GoogleDriveDownloader as gdd
from joblib import load as jload
from geniepy.errors import ClassifierError
import geniepy.config as gc
ERROR_SCORE = float(-1)
PCPCLSFR_NAME = "pub_score"
CTCLSFR_NAME = "ct_score"
class BaseClassifier(ABC):
"""Base Classifier Abstract Class."""
__slots__ = [
"_is_trained", # True if classifier is trained
"_model", # The classifier model
"_name", # The name of the classifier (used as name of prediction col)
]
def __init__(self, name):
"""
Construct classifier obj.
Arguments:
name {[type]} -- The classifier's name
"""
self._name = name
self._is_trained = False
self._model = None
@property
def name(self):
"""Return name prediction column."""
return self._name
@property
def is_trained(self):
"""Return true is model is trained."""
return self._is_trained
@abstractmethod
def predict(self, features: pd.DataFrame) -> float:
"""
Calculate publication count label.
It is import for this method to always produce results and handle exceptions
internally, so execution isn't halted due to exceptions.
Arguments:
features {pd.DataFrame} -- Pandas series necessary prediction data
Returns:
float -- the classifier prediction
"""
def load(self):
"""
Load classifier model.
Raises:
ClassifierError -- If model doesn't load successfully
"""
# Download model from google drive
model_path = gc.TMP_DIR.joinpath("gene_disease_gbc.joblib")
model_id = gc.get_model()
try:
gdd.download_file_from_google_drive(
file_id=model_id, dest_path=model_path, unzip=True,
)
self._model = jload(model_path)
self._is_trained = True
model_path.unlink()
except Exception:
# If load fail
raise ClassifierError("Unable to load model")
class Classifier(BaseClassifier):
"""Implementation of Publication Count Predictive Classifier."""
def predict(self, features: pd.DataFrame):
"""
Calculate publication count label.
It is import for this method to always produce results and handle exceptions
internally, so execution isn't halted due to exceptions.
Arguments:
features {pd.DataFrame} -- Pandas series necessary prediction data
Returns:
float -- the classifier prediction
"""
if (not self._is_trained) or (features is None):
# TODO log event "Received None features to predict"
# TODO log event "Untrained classifier can't calculate predictions"
return ERROR_SCORE
# Only keep expected columns
features.dropna(inplace=True)
scores_df = pd.DataFrame(features["gene_disease_relationship"])
filtered_features = features[
[
"num_publications",
"citations_cum_sum",
"authors_cum_sum",
"chemicals_cum_sum",
"cum_sum_journals",
"num_languages",
"sjr",
"h_index",
"us_published",
"us_uk_published",
]
]
# Predictions and probabilities
predictions = self._model.predict(filtered_features)
probs = self._model.predict_proba(filtered_features)
prob_1 = [item[0] for item in probs] # Get positiive probs only
# Add new fields into original df
scores_df["classifier_prediction"] = predictions
scores_df["classifier_prob"] = prob_1
return scores_df
| [
1,
9995,
1888,
14607,
310,
8500,
573,
770,
14903,
1213,
15945,
13,
3166,
25638,
1053,
16417,
29892,
9846,
5696,
13,
5215,
11701,
408,
10518,
13,
3166,
5386,
29918,
21594,
29918,
10382,
261,
1053,
5087,
29928,
4401,
6767,
12657,
408,
330,
1289,
13,
3166,
4982,
1982,
1053,
2254,
408,
432,
1359,
13,
3166,
2531,
347,
2272,
29889,
12523,
1053,
4134,
3709,
2392,
13,
5215,
2531,
347,
2272,
29889,
2917,
408,
330,
29883,
13,
13,
11432,
29918,
29903,
3217,
1525,
353,
5785,
6278,
29896,
29897,
13,
13,
29925,
6271,
6154,
29903,
15860,
29918,
5813,
353,
376,
5467,
29918,
13628,
29908,
13,
1783,
6154,
29903,
15860,
29918,
5813,
353,
376,
312,
29918,
13628,
29908,
13,
13,
13,
1990,
7399,
2385,
3709,
29898,
19658,
1125,
13,
1678,
9995,
5160,
4134,
3709,
25513,
4134,
1213,
15945,
13,
13,
1678,
4770,
2536,
1862,
1649,
353,
518,
13,
4706,
11119,
275,
29918,
3018,
1312,
613,
29871,
396,
5852,
565,
770,
3709,
338,
16370,
13,
4706,
11119,
4299,
613,
29871,
396,
450,
770,
3709,
1904,
13,
4706,
11119,
978,
613,
29871,
396,
450,
1024,
310,
278,
770,
3709,
313,
3880,
408,
1024,
310,
18988,
784,
29897,
13,
1678,
4514,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
1125,
13,
4706,
9995,
13,
4706,
1281,
4984,
770,
3709,
5446,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
9651,
1024,
426,
29961,
1853,
12258,
1192,
450,
770,
3709,
29915,
29879,
1024,
13,
4706,
9995,
13,
4706,
1583,
3032,
978,
353,
1024,
13,
4706,
1583,
3032,
275,
29918,
3018,
1312,
353,
7700,
13,
4706,
1583,
3032,
4299,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1024,
29898,
1311,
1125,
13,
4706,
9995,
11609,
1024,
18988,
1897,
1213,
15945,
13,
4706,
736,
1583,
3032,
978,
13,
13,
1678,
732,
6799,
13,
1678,
822,
338,
29918,
3018,
1312,
29898,
1311,
1125,
13,
4706,
9995,
11609,
1565,
338,
1904,
338,
16370,
1213,
15945,
13,
4706,
736,
1583,
3032,
275,
29918,
3018,
1312,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
8500,
29898,
1311,
29892,
5680,
29901,
10518,
29889,
17271,
29897,
1599,
5785,
29901,
13,
4706,
9995,
13,
4706,
20535,
403,
17745,
2302,
3858,
29889,
13,
13,
4706,
739,
338,
1053,
363,
445,
1158,
304,
2337,
7738,
2582,
322,
4386,
15283,
13,
4706,
25106,
29892,
577,
8225,
3508,
29915,
29873,
25212,
287,
2861,
304,
15283,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
9651,
5680,
426,
15926,
29889,
17271,
29913,
1192,
349,
7086,
3652,
5181,
18988,
848,
13,
13,
4706,
16969,
29901,
13,
9651,
5785,
1192,
278,
770,
3709,
18988,
13,
4706,
9995,
13,
13,
1678,
822,
2254,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
16012,
770,
3709,
1904,
29889,
13,
13,
4706,
390,
1759,
267,
29901,
13,
9651,
4134,
3709,
2392,
1192,
960,
1904,
1838,
29915,
29873,
2254,
8472,
13,
4706,
9995,
13,
4706,
396,
25553,
1904,
515,
5386,
7899,
13,
4706,
1904,
29918,
2084,
353,
330,
29883,
29889,
29911,
3580,
29918,
9464,
29889,
7122,
2084,
703,
29887,
1600,
29918,
29881,
895,
559,
29918,
29887,
12328,
29889,
9057,
1982,
1159,
13,
4706,
1904,
29918,
333,
353,
330,
29883,
29889,
657,
29918,
4299,
580,
13,
4706,
1018,
29901,
13,
9651,
330,
1289,
29889,
10382,
29918,
1445,
29918,
3166,
29918,
3608,
29918,
21594,
29898,
13,
18884,
934,
29918,
333,
29922,
4299,
29918,
333,
29892,
2731,
29918,
2084,
29922,
4299,
29918,
2084,
29892,
443,
7554,
29922,
5574,
29892,
13,
9651,
1723,
13,
9651,
1583,
3032,
4299,
353,
432,
1359,
29898,
4299,
29918,
2084,
29897,
13,
9651,
1583,
3032,
275,
29918,
3018,
1312,
353,
5852,
13,
9651,
1904,
29918,
2084,
29889,
348,
2324,
580,
13,
4706,
5174,
8960,
29901,
13,
9651,
396,
960,
2254,
4418,
13,
9651,
12020,
4134,
3709,
2392,
703,
2525,
519,
304,
2254,
1904,
1159,
13,
13,
13,
1990,
4134,
3709,
29898,
5160,
2385,
3709,
1125,
13,
1678,
9995,
1888,
14607,
310,
5236,
362,
3917,
21099,
919,
573,
4134,
3709,
1213,
15945,
13,
13,
1678,
822,
8500,
29898,
1311,
29892,
5680,
29901,
10518,
29889,
17271,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
17745,
2302,
3858,
29889,
13,
13,
4706,
739,
338,
1053,
363,
445,
1158,
304,
2337,
7738,
2582,
322,
4386,
15283,
13,
4706,
25106,
29892,
577,
8225,
3508,
29915,
29873,
25212,
287,
2861,
304,
15283,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
9651,
5680,
426,
15926,
29889,
17271,
29913,
1192,
349,
7086,
3652,
5181,
18988,
848,
13,
13,
4706,
16969,
29901,
13,
9651,
5785,
1192,
278,
770,
3709,
18988,
13,
4706,
9995,
13,
4706,
565,
313,
1333,
1583,
3032,
275,
29918,
3018,
1312,
29897,
470,
313,
22100,
338,
6213,
1125,
13,
9651,
396,
14402,
1480,
1741,
376,
29816,
6213,
5680,
304,
8500,
29908,
13,
9651,
396,
14402,
1480,
1741,
376,
29965,
593,
22042,
770,
3709,
508,
29915,
29873,
8147,
27303,
29908,
13,
9651,
736,
14431,
29918,
29903,
3217,
1525,
13,
4706,
396,
9333,
3013,
3806,
4341,
13,
4706,
5680,
29889,
8865,
1056,
29898,
262,
6689,
29922,
5574,
29897,
13,
4706,
19435,
29918,
2176,
353,
10518,
29889,
17271,
29898,
22100,
3366,
29887,
1600,
29918,
29881,
895,
559,
29918,
2674,
800,
4034,
20068,
13,
4706,
22289,
29918,
22100,
353,
5680,
29961,
13,
9651,
518,
13,
18884,
376,
1949,
29918,
3597,
800,
613,
13,
18884,
376,
20752,
800,
29918,
29883,
398,
29918,
2083,
613,
13,
18884,
376,
5150,
943,
29918,
29883,
398,
29918,
2083,
613,
13,
18884,
376,
14969,
936,
29879,
29918,
29883,
398,
29918,
2083,
613,
13,
18884,
376,
29883,
398,
29918,
2083,
29918,
29926,
2905,
1338,
613,
13,
18884,
376,
1949,
29918,
29880,
8737,
613,
13,
18884,
376,
29879,
29926,
29878,
613,
13,
18884,
376,
29882,
29918,
2248,
613,
13,
18884,
376,
375,
29918,
5467,
3726,
613,
13,
18884,
376,
375,
29918,
2679,
29918,
5467,
3726,
613,
13,
9651,
4514,
13,
4706,
4514,
13,
4706,
396,
21099,
919,
1080,
322,
2070,
11614,
13,
4706,
27303,
353,
1583,
3032,
4299,
29889,
27711,
29898,
4572,
287,
29918,
22100,
29897,
13,
4706,
2070,
29879,
353,
1583,
3032,
4299,
29889,
27711,
29918,
771,
2291,
29898,
4572,
287,
29918,
22100,
29897,
13,
4706,
2070,
29918,
29896,
353,
518,
667,
29961,
29900,
29962,
363,
2944,
297,
2070,
29879,
29962,
29871,
396,
3617,
926,
4812,
573,
2070,
29879,
871,
13,
4706,
396,
3462,
716,
4235,
964,
2441,
4489,
13,
4706,
19435,
29918,
2176,
3366,
1990,
3709,
29918,
11965,
2463,
3108,
353,
27303,
13,
4706,
19435,
29918,
2176,
3366,
1990,
3709,
29918,
22795,
3108,
353,
2070,
29918,
29896,
13,
4706,
736,
19435,
29918,
2176,
13,
2
] |
ants/core/__init__.py | ncullen93/ANTsPy | 3 | 1603901 |
from .ants_image import *
from .ants_transform import *
from .image_io import *
from .transform_io import *
| [
1,
29871,
13,
3166,
869,
1934,
29918,
3027,
1053,
334,
13,
3166,
869,
1934,
29918,
9067,
1053,
334,
13,
13,
3166,
869,
3027,
29918,
601,
1053,
334,
13,
3166,
869,
9067,
29918,
601,
1053,
334,
13,
2
] |
DNN_Experiments/MaskRCNN/convert.py | wmjpillow/FlameDetectionAPP | 2 | 23770 | #!/usr/bin/env python
# convert jpg tp png
from glob import glob
import cv2
pngs = glob('./*.jpg')
for j in pngs:
img = cv2.imread(j)
cv2.imwrite(j[:-3] + 'png', img)
# delete jpg files
import glob
import os
dir = "/Users/wangmeijie/ALLImportantProjects/FlameDetectionAPP/Models/MaskRCNN/02_26_2020/Mask_RCNN/dataset/train"
for jpgpath in glob.iglob(os.path.join(dir, '*.jpg')):
os.remove(jpgpath) | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
3588,
432,
4061,
260,
29886,
282,
865,
13,
3166,
13149,
1053,
13149,
13,
5215,
13850,
29906,
13,
2732,
29879,
353,
13149,
12839,
5515,
29889,
6173,
1495,
13,
13,
1454,
432,
297,
282,
865,
29879,
29901,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
29926,
29897,
13,
1678,
13850,
29906,
29889,
326,
3539,
29898,
29926,
7503,
29899,
29941,
29962,
718,
525,
2732,
742,
10153,
29897,
13,
13,
13,
29937,
5217,
432,
4061,
2066,
13,
5215,
13149,
13,
5215,
2897,
13,
13,
3972,
353,
5591,
5959,
29914,
29893,
574,
1004,
823,
347,
29914,
9818,
17518,
424,
25119,
29914,
8754,
420,
29928,
2650,
428,
20576,
29914,
23785,
29914,
19832,
10363,
10262,
29914,
29900,
29906,
29918,
29906,
29953,
29918,
29906,
29900,
29906,
29900,
29914,
19832,
29918,
10363,
10262,
29914,
24713,
29914,
14968,
29908,
13,
13,
1454,
432,
4061,
2084,
297,
13149,
29889,
335,
2127,
29898,
359,
29889,
2084,
29889,
7122,
29898,
3972,
29892,
525,
10521,
6173,
8785,
29901,
13,
1678,
2897,
29889,
5992,
29898,
6173,
2084,
29897,
2
] |
linkcopy.py | priximmo/scripts-scripts | 1 | 166173 | # This script is for Windows
#
import sys
import pathlib
import subprocess as sub
if len(sys.argv) < 3:
print("{} - Make symbolic links for input's contents into output's contents"
.format(sys.argv[0]))
print("Usage: {} INPUT_DIRECTORY OUTPUT_DIRECTORY".format(sys.argv[0]))
sys.exit(1)
INPUT_DIRECTORY = pathlib.Path(sys.argv[1])
OUTPUT_DIRECTORY = pathlib.Path(sys.argv[2])
try:
for child in INPUT_DIRECTORY.iterdir():
# child is the FQ'ed path of below variable
current_file = child.parts[len(child.parts)-1]
new_path = OUTPUT_DIRECTORY
new_file = OUTPUT_DIRECTORY / current_file
command = "MKLINK \"%s\" \"%s\"" % (new_file, child)
ret = sub.call(command, shell=True)
if ret != 0:
raise OSError
print("INPUT: {}".format(child))
print("OUTPUT: {}".format(new_file))
except OSError:
print("The command was not completed successfully. :(")
sys.exit(1)
| [
1,
396,
910,
2471,
338,
363,
3852,
30004,
13,
29937,
30004,
13,
5215,
10876,
30004,
13,
5215,
2224,
1982,
30004,
13,
5215,
1014,
5014,
408,
1014,
30004,
13,
30004,
13,
361,
7431,
29898,
9675,
29889,
19218,
29897,
529,
29871,
29941,
29901,
30004,
13,
1678,
1596,
703,
8875,
448,
8561,
5829,
293,
2988,
363,
1881,
29915,
29879,
8118,
964,
1962,
29915,
29879,
8118,
19451,
13,
1678,
869,
4830,
29898,
9675,
29889,
19218,
29961,
29900,
12622,
30004,
13,
1678,
1596,
703,
27573,
29901,
6571,
2672,
12336,
29918,
4571,
26282,
18929,
19474,
12336,
29918,
4571,
26282,
18929,
1642,
4830,
29898,
9675,
29889,
19218,
29961,
29900,
12622,
30004,
13,
1678,
10876,
29889,
13322,
29898,
29896,
8443,
13,
30004,
13,
1177,
12336,
29918,
4571,
26282,
18929,
353,
2224,
1982,
29889,
2605,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
30004,
13,
12015,
12336,
29918,
4571,
26282,
18929,
353,
2224,
1982,
29889,
2605,
29898,
9675,
29889,
19218,
29961,
29906,
2314,
30004,
13,
30004,
13,
2202,
29901,
30004,
13,
1678,
363,
2278,
297,
2672,
12336,
29918,
4571,
26282,
18929,
29889,
1524,
3972,
7295,
30004,
13,
4706,
396,
2278,
338,
278,
383,
29984,
29915,
287,
2224,
310,
2400,
2286,
30004,
13,
4706,
1857,
29918,
1445,
353,
2278,
29889,
20895,
29961,
2435,
29898,
5145,
29889,
20895,
6817,
29896,
29962,
30004,
13,
4706,
716,
29918,
2084,
353,
19474,
12336,
29918,
4571,
26282,
18929,
30004,
13,
4706,
716,
29918,
1445,
353,
19474,
12336,
29918,
4571,
26282,
18929,
847,
1857,
29918,
1445,
30004,
13,
4706,
1899,
353,
376,
29924,
29968,
23714,
29968,
13218,
29995,
29879,
5931,
13218,
29995,
29879,
5931,
29908,
1273,
313,
1482,
29918,
1445,
29892,
2278,
8443,
13,
4706,
3240,
353,
1014,
29889,
4804,
29898,
6519,
29892,
6473,
29922,
5574,
8443,
13,
4706,
565,
3240,
2804,
29871,
29900,
29901,
30004,
13,
9651,
12020,
438,
29173,
30004,
13,
4706,
1596,
703,
1177,
12336,
29901,
6571,
1642,
4830,
29898,
5145,
876,
30004,
13,
4706,
1596,
703,
12015,
12336,
29901,
6571,
1642,
4830,
29898,
1482,
29918,
1445,
876,
30004,
13,
19499,
438,
29173,
29901,
30004,
13,
1678,
1596,
703,
1576,
1899,
471,
451,
8676,
8472,
29889,
584,
703,
8443,
13,
1678,
10876,
29889,
13322,
29898,
29896,
8443,
13,
2
] |
predict_with_ssd7.py | esp32wrangler/ssd_keras | 0 | 24775 | <gh_stars>0
from keras.optimizers import Adam
from keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau, TerminateOnNaN, CSVLogger
from keras import backend as K
from keras.models import load_model
from math import ceil
import numpy as np
from matplotlib import pyplot as plt
from models.keras_ssd7 import build_model
from keras_loss_function.keras_ssd_loss import SSDLoss
from keras_layers.keras_layer_AnchorBoxes import AnchorBoxes
from keras_layers.keras_layer_DecodeDetections import DecodeDetections
from keras_layers.keras_layer_DecodeDetectionsFast import DecodeDetectionsFast
from ssd_encoder_decoder.ssd_input_encoder import SSDInputEncoder
from ssd_encoder_decoder.ssd_output_decoder import decode_detections, decode_detections_fast
from data_generator.object_detection_2d_data_generator import DataGenerator
from data_generator.object_detection_2d_misc_utils import apply_inverse_transforms
from data_generator.data_augmentation_chain_variable_input_size import DataAugmentationVariableInputSize
from data_generator.data_augmentation_chain_constant_input_size import DataAugmentationConstantInputSize
from data_generator.data_augmentation_chain_original_ssd import SSDDataAugmentation
import cv2
img_height = 416 # Height of the input images
img_width = 416 # Width of the input images
img_channels = 3 # Number of color channels of the input images
intensity_mean = 127.5 # Set this to your preference (maybe `None`). The current settings transform the input pixel values to the interval `[-1,1]`.
intensity_range = 127.5 # Set this to your preference (maybe `None`). The current settings transform the input pixel values to the interval `[-1,1]`.
n_classes = 3 # Number of positive classes
scales = [0.08, 0.16, 0.32, 0.64, 0.96] # An explicit list of anchor box scaling factors. If this is passed, it will override `min_scale` and `max_scale`.
aspect_ratios = [0.5, 1.0, 2.0] # The list of aspect ratios for the anchor boxes
two_boxes_for_ar1 = True # Whether or not you want to generate two anchor boxes for aspect ratio 1
steps = None # In case you'd like to set the step sizes for the anchor box grids manually; not recommended
offsets = None # In case you'd like to set the offsets for the anchor box grids manually; not recommended
clip_boxes = False # Whether or not to clip the anchor boxes to lie entirely within the image boundaries
variances = [1.0, 1.0, 1.0, 1.0] # The list of variances by which the encoded target coordinates are scaled
normalize_coords = True # Whether or not the model is supposed to use coordinates relative to the image size
model_path = 'ssd7_epoch-07_loss-0.9988_val_loss-0.6916.h5'
# We need to create an SSDLoss object in order to pass that to the model loader.
ssd_loss = SSDLoss(neg_pos_ratio=3, alpha=1.0)
K.clear_session() # Clear previous models from memory.
model = build_model(image_size=(img_height, img_width, img_channels),
n_classes=n_classes,
mode='training',
l2_regularization=0.0005,
scales=scales,
aspect_ratios_global=aspect_ratios,
aspect_ratios_per_layer=None,
two_boxes_for_ar1=two_boxes_for_ar1,
steps=steps,
offsets=offsets,
clip_boxes=clip_boxes,
variances=variances,
normalize_coords=normalize_coords,
subtract_mean=intensity_mean,
divide_by_stddev=intensity_range)
# 2: Optional: Load some weights
model.load_weights(model_path, by_name=True)
train_dataset = DataGenerator(load_images_into_memory=False, hdf5_dataset_path=None)
val_dataset = DataGenerator(load_images_into_memory=False, hdf5_dataset_path=None)
# 2: Parse the image and label lists for the training and validation datasets.
# TODO: Set the paths to your dataset here.
# Images
images_dir = './infiles'
'''
# Ground truth
train_labels_filename = 'onsite-images-export.csv'
val_labels_filename = 'onsite-images-valid.csv'
train_dataset.parse_csv(images_dir=images_dir,
labels_filename=train_labels_filename,
input_format=['image_name', 'xmin', 'ymin', 'xmax', 'ymax', 'class_id'], # This is the order of the first six columns in the CSV file that contains the labels for your dataset. If your labels are in XML format, maybe the XML parser will be helpful, check the documentation.
include_classes='all')
val_dataset.parse_csv(images_dir=images_dir,
labels_filename=val_labels_filename,
input_format=['image_name', 'xmin', 'ymin', 'xmax', 'ymax', 'class_id'],
include_classes='all')
train_dataset.create_hdf5_dataset(file_path='train_imgs.h5',
resize=False,
variable_image_size=True,
verbose=True)
val_dataset.create_hdf5_dataset(file_path='val_imgs.h5',
resize=False,
variable_image_size=True,
verbose=True)
train_dataset_size = train_dataset.get_dataset_size()
val_dataset_size = val_dataset.get_dataset_size()
predict_generator = val_dataset.generate(batch_size=1,
shuffle=True,
transformations=[],
label_encoder=None,
returns={'processed_images',
'processed_labels',
'filenames'},
keep_images_without_gt=False)
batch_images, batch_labels, batch_filenames = next(predict_generator)
i = 0 # Which batch item to look at
print("Image:", batch_filenames[i])
print()
print("Ground truth boxes:\n")
print(batch_labels[i])
'''
import glob
import os
fnames = glob.glob(images_dir+"/*.png")
#fnames = [images_dir+"/yellow834159457.png"]
for fn in fnames:
img = cv2.imread(fn)
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
imgs = np.reshape(img_rgb, (1, 416, 416, 3))
y_pred = model.predict(imgs)
y_pred_decoded = decode_detections(y_pred,
confidence_thresh=0.7,
iou_threshold=0.45,
top_k=200,
normalize_coords=normalize_coords,
img_height=img_height,
img_width=img_width)
boxColors = [(0, 255, 255), (0, 0, 255), (0, 255, 0)]
#print y_pred_decoded
if len(y_pred_decoded) > 0:
y_pred_list = y_pred_decoded[0].tolist()
for sss in y_pred_list:
#print sss
cls, conf, xmin, ymin, xmax, ymax = sss
boxColor = boxColors[int(cls)-1]
cv2.rectangle(img, (int(xmin), int(ymin)),
(int(xmax), int(ymax)), boxColor, 2)
cv2.imwrite("outfiles/" + os.path.basename(fn), img)
'''
y_pred = model.predict(batch_images)
y_pred_decoded = decode_detections(y_pred,
confidence_thresh=0.2,
iou_threshold=0.45,
top_k=200,
normalize_coords=normalize_coords,
img_height=img_height,
img_width=img_width)
np.set_printoptions(precision=2, suppress=True, linewidth=90)
print("Predicted boxes:\n")
print(' class conf xmin ymin xmax ymax')
print(y_pred_decoded[i])
''' | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
13023,
294,
29889,
20640,
19427,
1053,
11783,
13,
3166,
13023,
294,
29889,
14035,
29879,
1053,
8125,
5596,
3149,
29892,
11095,
20754,
3262,
29892,
4367,
24551,
29931,
1672,
29876,
3247,
403,
585,
29892,
11814,
16976,
2951,
19377,
29892,
16874,
16363,
13,
3166,
13023,
294,
1053,
14998,
408,
476,
13,
3166,
13023,
294,
29889,
9794,
1053,
2254,
29918,
4299,
13,
3166,
5844,
1053,
2257,
309,
13,
5215,
12655,
408,
7442,
13,
3166,
22889,
1053,
11451,
5317,
408,
14770,
13,
13,
3166,
4733,
29889,
3946,
294,
29918,
893,
29881,
29955,
1053,
2048,
29918,
4299,
13,
3166,
13023,
294,
29918,
6758,
29918,
2220,
29889,
3946,
294,
29918,
893,
29881,
29918,
6758,
1053,
5886,
19558,
2209,
13,
3166,
13023,
294,
29918,
29277,
29889,
3946,
294,
29918,
13148,
29918,
24458,
3313,
267,
1053,
530,
8420,
3313,
267,
13,
3166,
13023,
294,
29918,
29277,
29889,
3946,
294,
29918,
13148,
29918,
2772,
401,
29928,
2650,
1953,
1053,
897,
401,
29928,
2650,
1953,
13,
3166,
13023,
294,
29918,
29277,
29889,
3946,
294,
29918,
13148,
29918,
2772,
401,
29928,
2650,
1953,
29943,
579,
1053,
897,
401,
29928,
2650,
1953,
29943,
579,
13,
13,
3166,
269,
4928,
29918,
3977,
6119,
29918,
7099,
6119,
29889,
893,
29881,
29918,
2080,
29918,
3977,
6119,
1053,
5886,
29928,
4290,
8566,
6119,
13,
3166,
269,
4928,
29918,
3977,
6119,
29918,
7099,
6119,
29889,
893,
29881,
29918,
4905,
29918,
7099,
6119,
1053,
21822,
29918,
29881,
2650,
1953,
29892,
21822,
29918,
29881,
2650,
1953,
29918,
11255,
13,
13,
3166,
848,
29918,
27959,
29889,
3318,
29918,
29881,
2650,
428,
29918,
29906,
29881,
29918,
1272,
29918,
27959,
1053,
3630,
21575,
13,
3166,
848,
29918,
27959,
29889,
3318,
29918,
29881,
2650,
428,
29918,
29906,
29881,
29918,
29885,
10669,
29918,
13239,
1053,
3394,
29918,
262,
3901,
29918,
9067,
29879,
13,
3166,
848,
29918,
27959,
29889,
1272,
29918,
2987,
358,
362,
29918,
14153,
29918,
11918,
29918,
2080,
29918,
2311,
1053,
3630,
29909,
688,
358,
362,
16174,
4290,
3505,
13,
3166,
848,
29918,
27959,
29889,
1272,
29918,
2987,
358,
362,
29918,
14153,
29918,
23362,
29918,
2080,
29918,
2311,
1053,
3630,
29909,
688,
358,
362,
12075,
424,
4290,
3505,
13,
3166,
848,
29918,
27959,
29889,
1272,
29918,
2987,
358,
362,
29918,
14153,
29918,
13492,
29918,
893,
29881,
1053,
5886,
29928,
1469,
29909,
688,
358,
362,
13,
5215,
13850,
29906,
13,
13,
13,
2492,
29918,
3545,
353,
29871,
29946,
29896,
29953,
396,
22907,
310,
278,
1881,
4558,
13,
2492,
29918,
2103,
353,
29871,
29946,
29896,
29953,
396,
21485,
310,
278,
1881,
4558,
13,
2492,
29918,
305,
12629,
353,
29871,
29941,
396,
9681,
310,
2927,
18196,
310,
278,
1881,
4558,
13,
524,
575,
537,
29918,
12676,
353,
29871,
29896,
29906,
29955,
29889,
29945,
396,
3789,
445,
304,
596,
24583,
313,
26026,
421,
8516,
12913,
450,
1857,
6055,
4327,
278,
1881,
15526,
1819,
304,
278,
7292,
10338,
29899,
29896,
29892,
29896,
27865,
13,
524,
575,
537,
29918,
3881,
353,
29871,
29896,
29906,
29955,
29889,
29945,
396,
3789,
445,
304,
596,
24583,
313,
26026,
421,
8516,
12913,
450,
1857,
6055,
4327,
278,
1881,
15526,
1819,
304,
278,
7292,
10338,
29899,
29896,
29892,
29896,
27865,
13,
29876,
29918,
13203,
353,
29871,
29941,
396,
9681,
310,
6374,
4413,
13,
19529,
267,
353,
518,
29900,
29889,
29900,
29947,
29892,
29871,
29900,
29889,
29896,
29953,
29892,
29871,
29900,
29889,
29941,
29906,
29892,
29871,
29900,
29889,
29953,
29946,
29892,
29871,
29900,
29889,
29929,
29953,
29962,
396,
530,
6261,
1051,
310,
17360,
3800,
21640,
13879,
29889,
960,
445,
338,
4502,
29892,
372,
674,
5712,
421,
1195,
29918,
7052,
29952,
322,
421,
3317,
29918,
7052,
1412,
13,
294,
1103,
29918,
29878,
2219,
359,
353,
518,
29900,
29889,
29945,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
29962,
396,
450,
1051,
310,
9565,
364,
2219,
359,
363,
278,
17360,
16273,
13,
10184,
29918,
1884,
267,
29918,
1454,
29918,
279,
29896,
353,
5852,
396,
26460,
470,
451,
366,
864,
304,
5706,
1023,
17360,
16273,
363,
9565,
11959,
29871,
29896,
13,
24530,
353,
6213,
396,
512,
1206,
366,
29915,
29881,
763,
304,
731,
278,
4331,
15786,
363,
278,
17360,
3800,
867,
4841,
7522,
29936,
451,
13622,
13,
2696,
7224,
353,
6213,
396,
512,
1206,
366,
29915,
29881,
763,
304,
731,
278,
1283,
7224,
363,
278,
17360,
3800,
867,
4841,
7522,
29936,
451,
13622,
13,
24049,
29918,
1884,
267,
353,
7700,
396,
26460,
470,
451,
304,
20102,
278,
17360,
16273,
304,
3804,
9186,
2629,
278,
1967,
24371,
13,
1707,
713,
778,
353,
518,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29962,
396,
450,
1051,
310,
722,
713,
778,
491,
607,
278,
18511,
3646,
10350,
526,
6287,
29881,
13,
8945,
675,
29918,
1111,
4339,
353,
5852,
396,
26460,
470,
451,
278,
1904,
338,
7424,
304,
671,
10350,
6198,
304,
278,
1967,
2159,
13,
4299,
29918,
2084,
353,
525,
893,
29881,
29955,
29918,
1022,
2878,
29899,
29900,
29955,
29918,
6758,
29899,
29900,
29889,
29929,
29929,
29947,
29947,
29918,
791,
29918,
6758,
29899,
29900,
29889,
29953,
29929,
29896,
29953,
29889,
29882,
29945,
29915,
13,
13,
29937,
1334,
817,
304,
1653,
385,
5886,
19558,
2209,
1203,
297,
1797,
304,
1209,
393,
304,
278,
1904,
23466,
29889,
13,
893,
29881,
29918,
6758,
353,
5886,
19558,
2209,
29898,
10052,
29918,
1066,
29918,
3605,
601,
29922,
29941,
29892,
15595,
29922,
29896,
29889,
29900,
29897,
13,
13,
29968,
29889,
8551,
29918,
7924,
580,
396,
17732,
3517,
4733,
515,
3370,
29889,
13,
13,
13,
4299,
353,
2048,
29918,
4299,
29898,
3027,
29918,
2311,
7607,
2492,
29918,
3545,
29892,
10153,
29918,
2103,
29892,
10153,
29918,
305,
12629,
511,
13,
462,
1678,
302,
29918,
13203,
29922,
29876,
29918,
13203,
29892,
13,
462,
1678,
4464,
2433,
26495,
742,
13,
462,
1678,
301,
29906,
29918,
15227,
2133,
29922,
29900,
29889,
29900,
29900,
29900,
29945,
29892,
13,
462,
1678,
23431,
29922,
19529,
267,
29892,
13,
462,
1678,
9565,
29918,
29878,
2219,
359,
29918,
10945,
29922,
294,
1103,
29918,
29878,
2219,
359,
29892,
13,
462,
1678,
9565,
29918,
29878,
2219,
359,
29918,
546,
29918,
13148,
29922,
8516,
29892,
13,
462,
1678,
1023,
29918,
1884,
267,
29918,
1454,
29918,
279,
29896,
29922,
10184,
29918,
1884,
267,
29918,
1454,
29918,
279,
29896,
29892,
13,
462,
1678,
6576,
29922,
24530,
29892,
13,
462,
1678,
1283,
7224,
29922,
2696,
7224,
29892,
13,
462,
1678,
20102,
29918,
1884,
267,
29922,
24049,
29918,
1884,
267,
29892,
13,
462,
1678,
722,
713,
778,
29922,
1707,
713,
778,
29892,
13,
462,
1678,
4226,
675,
29918,
1111,
4339,
29922,
8945,
675,
29918,
1111,
4339,
29892,
13,
462,
1678,
23197,
29918,
12676,
29922,
524,
575,
537,
29918,
12676,
29892,
13,
462,
1678,
16429,
29918,
1609,
29918,
4172,
3359,
29922,
524,
575,
537,
29918,
3881,
29897,
13,
13,
29937,
29871,
29906,
29901,
28379,
29901,
16012,
777,
18177,
13,
13,
4299,
29889,
1359,
29918,
705,
5861,
29898,
4299,
29918,
2084,
29892,
491,
29918,
978,
29922,
5574,
29897,
13,
13,
13,
14968,
29918,
24713,
353,
3630,
21575,
29898,
1359,
29918,
8346,
29918,
8941,
29918,
14834,
29922,
8824,
29892,
298,
2176,
29945,
29918,
24713,
29918,
2084,
29922,
8516,
29897,
13,
791,
29918,
24713,
353,
3630,
21575,
29898,
1359,
29918,
8346,
29918,
8941,
29918,
14834,
29922,
8824,
29892,
298,
2176,
29945,
29918,
24713,
29918,
2084,
29922,
8516,
29897,
13,
13,
29937,
29871,
29906,
29901,
20969,
278,
1967,
322,
3858,
8857,
363,
278,
6694,
322,
8845,
20035,
29889,
13,
13,
29937,
14402,
29901,
3789,
278,
10898,
304,
596,
8783,
1244,
29889,
13,
13,
29937,
1954,
1179,
13,
8346,
29918,
3972,
353,
19283,
262,
5325,
29915,
13,
12008,
13,
29937,
1632,
618,
8760,
13,
14968,
29918,
21134,
29918,
9507,
353,
525,
787,
568,
29899,
8346,
29899,
15843,
29889,
7638,
29915,
13,
791,
29918,
21134,
29918,
9507,
259,
353,
525,
787,
568,
29899,
8346,
29899,
3084,
29889,
7638,
29915,
13,
13,
14968,
29918,
24713,
29889,
5510,
29918,
7638,
29898,
8346,
29918,
3972,
29922,
8346,
29918,
3972,
29892,
13,
462,
4706,
11073,
29918,
9507,
29922,
14968,
29918,
21134,
29918,
9507,
29892,
13,
462,
4706,
1881,
29918,
4830,
29922,
1839,
3027,
29918,
978,
742,
525,
29916,
1195,
742,
525,
962,
262,
742,
525,
29916,
3317,
742,
525,
29891,
3317,
742,
525,
1990,
29918,
333,
7464,
396,
910,
338,
278,
1797,
310,
278,
937,
4832,
4341,
297,
278,
16874,
934,
393,
3743,
278,
11073,
363,
596,
8783,
29889,
960,
596,
11073,
526,
297,
6560,
3402,
29892,
5505,
278,
6560,
13812,
674,
367,
8444,
29892,
1423,
278,
5106,
29889,
13,
462,
4706,
3160,
29918,
13203,
2433,
497,
1495,
13,
13,
791,
29918,
24713,
29889,
5510,
29918,
7638,
29898,
8346,
29918,
3972,
29922,
8346,
29918,
3972,
29892,
13,
462,
418,
11073,
29918,
9507,
29922,
791,
29918,
21134,
29918,
9507,
29892,
13,
462,
418,
1881,
29918,
4830,
29922,
1839,
3027,
29918,
978,
742,
525,
29916,
1195,
742,
525,
962,
262,
742,
525,
29916,
3317,
742,
525,
29891,
3317,
742,
525,
1990,
29918,
333,
7464,
13,
462,
418,
3160,
29918,
13203,
2433,
497,
1495,
13,
13,
13,
14968,
29918,
24713,
29889,
3258,
29918,
29882,
2176,
29945,
29918,
24713,
29898,
1445,
29918,
2084,
2433,
14968,
29918,
2492,
29879,
29889,
29882,
29945,
742,
13,
462,
462,
29871,
19490,
29922,
8824,
29892,
13,
462,
462,
29871,
2286,
29918,
3027,
29918,
2311,
29922,
5574,
29892,
13,
462,
462,
29871,
26952,
29922,
5574,
29897,
13,
13,
791,
29918,
24713,
29889,
3258,
29918,
29882,
2176,
29945,
29918,
24713,
29898,
1445,
29918,
2084,
2433,
791,
29918,
2492,
29879,
29889,
29882,
29945,
742,
13,
462,
18884,
19490,
29922,
8824,
29892,
13,
462,
18884,
2286,
29918,
3027,
29918,
2311,
29922,
5574,
29892,
13,
462,
18884,
26952,
29922,
5574,
29897,
13,
13,
14968,
29918,
24713,
29918,
2311,
353,
7945,
29918,
24713,
29889,
657,
29918,
24713,
29918,
2311,
580,
13,
791,
29918,
24713,
29918,
2311,
259,
353,
659,
29918,
24713,
29889,
657,
29918,
24713,
29918,
2311,
580,
13,
13,
13,
13,
13,
13,
27711,
29918,
27959,
353,
659,
29918,
24713,
29889,
17158,
29898,
16175,
29918,
2311,
29922,
29896,
29892,
13,
462,
462,
308,
528,
21897,
29922,
5574,
29892,
13,
462,
462,
308,
29304,
11759,
1402,
13,
462,
462,
308,
3858,
29918,
3977,
6119,
29922,
8516,
29892,
13,
462,
462,
308,
3639,
3790,
29915,
5014,
287,
29918,
8346,
742,
13,
462,
462,
462,
29871,
525,
5014,
287,
29918,
21134,
742,
13,
462,
462,
462,
29871,
525,
1777,
264,
1280,
16675,
13,
462,
462,
308,
3013,
29918,
8346,
29918,
14037,
29918,
4141,
29922,
8824,
29897,
13,
13,
16175,
29918,
8346,
29892,
9853,
29918,
21134,
29892,
9853,
29918,
1777,
264,
1280,
353,
2446,
29898,
27711,
29918,
27959,
29897,
13,
13,
29875,
353,
29871,
29900,
396,
8449,
9853,
2944,
304,
1106,
472,
13,
13,
2158,
703,
2940,
29901,
613,
9853,
29918,
1777,
264,
1280,
29961,
29875,
2314,
13,
2158,
580,
13,
2158,
703,
3338,
618,
8760,
16273,
3583,
29876,
1159,
13,
2158,
29898,
16175,
29918,
21134,
29961,
29875,
2314,
13,
12008,
13,
5215,
13149,
13,
5215,
2897,
13,
13,
29888,
7039,
353,
13149,
29889,
23705,
29898,
8346,
29918,
3972,
13578,
5515,
29889,
2732,
1159,
13,
29937,
29888,
7039,
353,
518,
8346,
29918,
3972,
13578,
29914,
29136,
29947,
29941,
29946,
29896,
29945,
29929,
29946,
29945,
29955,
29889,
2732,
3108,
13,
13,
1454,
7876,
297,
285,
7039,
29901,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
9144,
29897,
13,
1678,
10153,
29918,
23973,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
2492,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
28212,
29897,
13,
1678,
527,
3174,
353,
7442,
29889,
690,
14443,
29898,
2492,
29918,
23973,
29892,
313,
29896,
29892,
29871,
29946,
29896,
29953,
29892,
29871,
29946,
29896,
29953,
29892,
29871,
29941,
876,
13,
13,
1678,
343,
29918,
11965,
353,
1904,
29889,
27711,
29898,
2492,
29879,
29897,
13,
1678,
343,
29918,
11965,
29918,
7099,
6797,
353,
21822,
29918,
29881,
2650,
1953,
29898,
29891,
29918,
11965,
29892,
13,
462,
462,
259,
16420,
29918,
386,
3781,
29922,
29900,
29889,
29955,
29892,
13,
462,
462,
259,
474,
283,
29918,
386,
12268,
29922,
29900,
29889,
29946,
29945,
29892,
13,
462,
462,
259,
2246,
29918,
29895,
29922,
29906,
29900,
29900,
29892,
13,
462,
462,
259,
4226,
675,
29918,
1111,
4339,
29922,
8945,
675,
29918,
1111,
4339,
29892,
13,
462,
462,
259,
10153,
29918,
3545,
29922,
2492,
29918,
3545,
29892,
13,
462,
462,
259,
10153,
29918,
2103,
29922,
2492,
29918,
2103,
29897,
13,
1678,
3800,
1625,
943,
353,
17288,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
511,
313,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
4638,
13,
13,
1678,
396,
2158,
343,
29918,
11965,
29918,
7099,
6797,
13,
1678,
565,
7431,
29898,
29891,
29918,
11965,
29918,
7099,
6797,
29897,
1405,
29871,
29900,
29901,
13,
4706,
343,
29918,
11965,
29918,
1761,
353,
343,
29918,
11965,
29918,
7099,
6797,
29961,
29900,
1822,
25027,
391,
580,
13,
4706,
363,
269,
893,
297,
343,
29918,
11965,
29918,
1761,
29901,
13,
9651,
396,
2158,
269,
893,
13,
9651,
1067,
29879,
29892,
1970,
29892,
921,
1195,
29892,
343,
1195,
29892,
921,
3317,
29892,
343,
3317,
353,
269,
893,
13,
9651,
3800,
3306,
353,
3800,
1625,
943,
29961,
524,
29898,
25932,
6817,
29896,
29962,
13,
9651,
13850,
29906,
29889,
1621,
2521,
29898,
2492,
29892,
313,
524,
29898,
29916,
1195,
511,
938,
29898,
962,
262,
8243,
13,
462,
3986,
313,
524,
29898,
29916,
3317,
511,
938,
29898,
29891,
3317,
8243,
3800,
3306,
29892,
29871,
29906,
29897,
13,
4706,
13850,
29906,
29889,
326,
3539,
703,
449,
5325,
12975,
718,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
9144,
511,
10153,
29897,
13,
13,
12008,
13,
29891,
29918,
11965,
353,
1904,
29889,
27711,
29898,
16175,
29918,
8346,
29897,
13,
13,
29891,
29918,
11965,
29918,
7099,
6797,
353,
21822,
29918,
29881,
2650,
1953,
29898,
29891,
29918,
11965,
29892,
13,
462,
462,
259,
16420,
29918,
386,
3781,
29922,
29900,
29889,
29906,
29892,
13,
462,
462,
259,
474,
283,
29918,
386,
12268,
29922,
29900,
29889,
29946,
29945,
29892,
13,
462,
462,
259,
2246,
29918,
29895,
29922,
29906,
29900,
29900,
29892,
13,
462,
462,
259,
4226,
675,
29918,
1111,
4339,
29922,
8945,
675,
29918,
1111,
4339,
29892,
13,
462,
462,
259,
10153,
29918,
3545,
29922,
2492,
29918,
3545,
29892,
13,
462,
462,
259,
10153,
29918,
2103,
29922,
2492,
29918,
2103,
29897,
13,
13,
9302,
29889,
842,
29918,
558,
8941,
1980,
29898,
17990,
2459,
29922,
29906,
29892,
21301,
29922,
5574,
29892,
1196,
2103,
29922,
29929,
29900,
29897,
13,
2158,
703,
23084,
18186,
16273,
3583,
29876,
1159,
13,
2158,
877,
259,
770,
259,
1970,
921,
1195,
259,
343,
1195,
259,
921,
3317,
259,
343,
3317,
1495,
13,
2158,
29898,
29891,
29918,
11965,
29918,
7099,
6797,
29961,
29875,
2314,
13,
12008,
2
] |
src/basic_example/catkin_generated/installspace/eye_node.py | juliojn/eye-saccade | 0 | 123294 | #!/usr/bin/python3.7
from std_msgs.msg import String
import opensim as osim
from basic_example.srv import *
import rospy
import sys
import os
# ----------------------------------------------------------------------
# Load the musculoskeletal model from a file.
# ----------------------------------------------------------------------
path = os.path.dirname(os.path.abspath(__file__))
model = osim.Model(path + "/../model/UPAT_Eye_Model_Passive_Pulleys_v2.osim")
# ----------------------------------------------------------------------
# Add a controller to the model's muscles.
# ----------------------------------------------------------------------
actuator_set = model.getActuators()
lateral_rectus = actuator_set.get("r_Lateral_Rectus")
medial_rectus = actuator_set.get("r_Medial_Rectus")
brain = osim.PrescribedController()
brain.addActuator(lateral_rectus)
brain.addActuator(medial_rectus)
brain.prescribeControlForActuator("r_Lateral_Rectus", osim.Constant(0.0))
brain.prescribeControlForActuator("r_Medial_Rectus", osim.Constant(0.0))
model.addController(brain)
# ----------------------------------------------------------------------
# Add a console reporter to print the following values:
# Position and speed of the adduction-abduction rotational Degree of
# Freedom (y-axis).
# Current fiber force applied to the Lateral Rectus and the
# Medial Rectus tendons.
# ----------------------------------------------------------------------
coordinate_set = model.getCoordinateSet()
eye_add_abd = coordinate_set.get("r_eye_add_abd")
reporter = osim.ConsoleReporter()
reporter.set_report_time_interval(0.002)
reporter.addToReport(eye_add_abd.getOutput("value"), "position")
reporter.addToReport(eye_add_abd.getOutput("speed"), "speed")
reporter.addToReport(lateral_rectus.getOutput("fiber_force"), "lateral_force")
reporter.addToReport(medial_rectus.getOutput("fiber_force"), "medial_force")
model.addComponent(reporter)
# --------------------------------------------------------------------------
# Configure the simulation of the model
# --------------------------------------------------------------------------
state = model.initSystem()
model.equilibrateMuscles(state)
manager = osim.Manager(model)
state.setTime(0)
manager.initialize(state)
# --------------------------------------------------------------------------
# Get the control signals of the Lateral Rectus an the Medial Rectus
# --------------------------------------------------------------------------
def getControlSignal(current_pos, time):
rospy.wait_for_service("get_control_signal")
try:
get_control_signal = rospy.ServiceProxy("get_control_signal", GetControlSignal)
response = get_control_signal(current_pos, time)
return response
except rospy.ServiceException as e:
print("Service call failed: %s"%e)
if __name__ == '__main__':
time = 0.0 # in seconds
sim_time = 0.002 # in seconds
while time < 5.0:
current_pos = eye_add_abd.getValue(state)
res = getControlSignal(current_pos, time)
brain.prescribeControlForActuator("r_Lateral_Rectus", osim.Constant(res.lateral_control))
brain.prescribeControlForActuator("r_Medial_Rectus", osim.Constant(res.medial_control))
time += sim_time
state = manager.integrate(time)
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
29941,
29889,
29955,
13,
3166,
3659,
29918,
1516,
3174,
29889,
7645,
1053,
1714,
13,
5215,
13246,
326,
408,
2897,
326,
13,
3166,
6996,
29918,
4773,
29889,
29879,
15291,
1053,
334,
13,
5215,
696,
1028,
29891,
13,
5215,
10876,
13,
5215,
2897,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
29937,
16012,
278,
2301,
1810,
359,
446,
1026,
284,
1904,
515,
263,
934,
29889,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
13,
2084,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
876,
13,
4299,
353,
2897,
326,
29889,
3195,
29898,
2084,
718,
5591,
6995,
4299,
29914,
4897,
1299,
29918,
29923,
4099,
29918,
3195,
29918,
7129,
573,
29918,
29925,
15104,
952,
29918,
29894,
29906,
29889,
359,
326,
1159,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
29937,
3462,
263,
4701,
304,
278,
1904,
29915,
29879,
2301,
7799,
29889,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
13,
627,
29884,
1061,
29918,
842,
353,
1904,
29889,
657,
2865,
29884,
4097,
580,
13,
29880,
1008,
284,
29918,
1621,
375,
353,
20331,
1061,
29918,
842,
29889,
657,
703,
29878,
29918,
29931,
1008,
284,
29918,
7364,
375,
1159,
13,
2168,
616,
29918,
1621,
375,
29871,
353,
20331,
1061,
29918,
842,
29889,
657,
703,
29878,
29918,
19302,
616,
29918,
7364,
375,
1159,
13,
13,
2634,
262,
353,
2897,
326,
29889,
13504,
23059,
2956,
580,
13,
2634,
262,
29889,
1202,
2865,
29884,
1061,
29898,
29880,
1008,
284,
29918,
1621,
375,
29897,
13,
2634,
262,
29889,
1202,
2865,
29884,
1061,
29898,
2168,
616,
29918,
1621,
375,
29897,
13,
13,
2634,
262,
29889,
4569,
29581,
4809,
2831,
2865,
29884,
1061,
703,
29878,
29918,
29931,
1008,
284,
29918,
7364,
375,
613,
2897,
326,
29889,
12075,
424,
29898,
29900,
29889,
29900,
876,
13,
2634,
262,
29889,
4569,
29581,
4809,
2831,
2865,
29884,
1061,
703,
29878,
29918,
19302,
616,
29918,
7364,
375,
613,
2897,
326,
29889,
12075,
424,
29898,
29900,
29889,
29900,
876,
13,
4299,
29889,
1202,
2956,
29898,
2634,
262,
29897,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
29937,
3462,
263,
2991,
1634,
9555,
304,
1596,
278,
1494,
1819,
29901,
13,
29937,
29871,
12,
8003,
322,
6210,
310,
278,
594,
700,
428,
29899,
370,
700,
428,
5731,
1288,
360,
387,
929,
310,
13,
29937,
29871,
12,
23923,
11607,
313,
29891,
29899,
8990,
467,
13,
29937,
29871,
12,
7583,
5713,
495,
4889,
29871,
7436,
304,
278,
12699,
284,
22914,
375,
322,
278,
13,
29937,
29871,
12,
19302,
616,
22914,
375,
10331,
787,
29889,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
13,
29302,
29918,
842,
353,
1904,
29889,
657,
7967,
16065,
2697,
580,
13,
1032,
29872,
29918,
1202,
29918,
370,
29881,
353,
14821,
29918,
842,
29889,
657,
703,
29878,
29918,
1032,
29872,
29918,
1202,
29918,
370,
29881,
1159,
13,
13,
276,
18505,
353,
2897,
326,
29889,
20008,
5612,
9555,
580,
13,
276,
18505,
29889,
842,
29918,
12276,
29918,
2230,
29918,
19207,
29898,
29900,
29889,
29900,
29900,
29906,
29897,
13,
276,
18505,
29889,
1202,
1762,
13020,
29898,
1032,
29872,
29918,
1202,
29918,
370,
29881,
29889,
657,
6466,
703,
1767,
4968,
376,
3283,
1159,
13,
276,
18505,
29889,
1202,
1762,
13020,
29898,
1032,
29872,
29918,
1202,
29918,
370,
29881,
29889,
657,
6466,
703,
19322,
4968,
376,
19322,
1159,
13,
276,
18505,
29889,
1202,
1762,
13020,
29898,
29880,
1008,
284,
29918,
1621,
375,
29889,
657,
6466,
703,
7241,
495,
29918,
10118,
4968,
376,
29880,
1008,
284,
29918,
10118,
1159,
13,
276,
18505,
29889,
1202,
1762,
13020,
29898,
2168,
616,
29918,
1621,
375,
29889,
657,
6466,
703,
7241,
495,
29918,
10118,
4968,
376,
2168,
616,
29918,
10118,
1159,
13,
4299,
29889,
1202,
5308,
29898,
276,
18505,
29897,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
29937,
1281,
4532,
278,
17402,
310,
278,
1904,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
13,
3859,
353,
1904,
29889,
2344,
3924,
580,
13,
4299,
29889,
1686,
309,
4626,
403,
14958,
7799,
29898,
3859,
29897,
13,
12847,
353,
2897,
326,
29889,
3260,
29898,
4299,
29897,
13,
3859,
29889,
842,
2481,
29898,
29900,
29897,
13,
12847,
29889,
24926,
29898,
3859,
29897,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
29937,
3617,
278,
2761,
18470,
310,
278,
12699,
284,
22914,
375,
385,
278,
3436,
616,
22914,
375,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
29899,
13,
13,
1753,
679,
4809,
10140,
284,
29898,
3784,
29918,
1066,
29892,
931,
1125,
13,
12,
307,
1028,
29891,
29889,
10685,
29918,
1454,
29918,
5509,
703,
657,
29918,
6451,
29918,
25436,
1159,
13,
12,
2202,
29901,
13,
12,
12,
657,
29918,
6451,
29918,
25436,
353,
696,
1028,
29891,
29889,
3170,
14048,
703,
657,
29918,
6451,
29918,
25436,
613,
3617,
4809,
10140,
284,
29897,
13,
12,
12,
5327,
353,
679,
29918,
6451,
29918,
25436,
29898,
3784,
29918,
1066,
29892,
931,
29897,
13,
12,
12,
2457,
2933,
13,
12,
19499,
696,
1028,
29891,
29889,
3170,
2451,
408,
321,
29901,
13,
12,
12,
2158,
703,
3170,
1246,
5229,
29901,
1273,
29879,
29908,
29995,
29872,
29897,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
12,
2230,
353,
29871,
29900,
29889,
29900,
12,
12,
12,
12,
29937,
297,
6923,
13,
12,
3601,
29918,
2230,
353,
29871,
29900,
29889,
29900,
29900,
29906,
12,
12,
29937,
297,
6923,
13,
13,
12,
8000,
931,
529,
29871,
29945,
29889,
29900,
29901,
13,
12,
12,
3784,
29918,
1066,
353,
10977,
29918,
1202,
29918,
370,
29881,
29889,
23433,
29898,
3859,
29897,
13,
12,
12,
690,
353,
679,
4809,
10140,
284,
29898,
3784,
29918,
1066,
29892,
931,
29897,
13,
12,
12,
2634,
262,
29889,
4569,
29581,
4809,
2831,
2865,
29884,
1061,
703,
29878,
29918,
29931,
1008,
284,
29918,
7364,
375,
613,
2897,
326,
29889,
12075,
424,
29898,
690,
29889,
29880,
1008,
284,
29918,
6451,
876,
13,
12,
12,
2634,
262,
29889,
4569,
29581,
4809,
2831,
2865,
29884,
1061,
703,
29878,
29918,
19302,
616,
29918,
7364,
375,
613,
2897,
326,
29889,
12075,
424,
29898,
690,
29889,
2168,
616,
29918,
6451,
876,
13,
12,
12,
2230,
4619,
1027,
29918,
2230,
13,
12,
12,
3859,
353,
8455,
29889,
14146,
403,
29898,
2230,
29897,
13,
2
] |
jpp_boosted_django/jpp_boosted/website/templatetags/project_overview_list.py | QualmandDriven/jpp_boosted | 1 | 45847 | from django import template
from django.template.loader import get_template
register = template.Library()
@register.inclusion_tag('project_overview_list.html')
def project_overview_list(project_list):
return {'project_list': project_list} | [
1,
515,
9557,
1053,
4472,
13,
3166,
9557,
29889,
6886,
29889,
12657,
1053,
679,
29918,
6886,
13,
9573,
353,
4472,
29889,
12284,
580,
13,
13,
29992,
9573,
29889,
262,
10085,
29918,
4039,
877,
4836,
29918,
957,
1493,
29918,
1761,
29889,
1420,
1495,
13,
1753,
2060,
29918,
957,
1493,
29918,
1761,
29898,
4836,
29918,
1761,
1125,
13,
1678,
736,
11117,
4836,
29918,
1761,
2396,
2060,
29918,
1761,
29913,
2
] |
analysis_helpers/general.py | davidcrowland/layer_vb_tagging | 0 | 177270 | from __future__ import print_function # Python 2.x
import os
import numpy as np
import pandas as pd
import h5py
import sys
import math
from fnmatch import fnmatch
# helper functions klusta analysis pipeline
def get_param_file(filename,params_folder):
found = False
params = []
for path, subdirs, files in os.walk(params_folder):
for name in files:
for string in filename.split("/"):
if string in name:
found = True
params = name
return found, params
return found, params
def n_user(filename):
#find n-drive username
n_drive_user = 'non_identified'
if 'MosersServer' in filename:
# assuming osx/linux:
idx = [i for i,x in enumerate(filename.split('/')) if x == 'MosersServer'][0]
n_drive_user = filename.split('/')[idx+1]
else:
# assuming windows:
idx = [i for i,x in enumerate(filename.split('/')) if x == 'N:'][0]
n_drive_user = filename.split('/')[idx+1]
return n_drive_user
def create_export_folders(filename):
# create export folders
export_folder = "/".join(filename.split("/")[:-1])+"/KLUSTA/"
if not os.path.exists(export_folder):
os.makedirs(export_folder)
print('Created export folder: {:s}'.format(export_folder))
export_folder_basesession= "/".join(filename.split("/")[:-1])+"/KLUSTA/base_session"
if not os.path.exists(export_folder_basesession):
os.makedirs(export_folder_basesession)
print('Created export_folder_basesession: {:s}'.format(export_folder_basesession))
export_folder_othersessions= "/".join(filename.split("/")[:-1])+"/KLUSTA/other_session"
if not os.path.exists(export_folder_othersessions):
os.makedirs(export_folder_othersessions)
print('Created export_folder_othersessions: {:s}'.format(export_folder_othersessions))
export_folder_othersessions= "/".join(filename.split("/")[:-1])+"/KLUSTA/other_session"
if not os.path.exists(export_folder_othersessions):
os.makedirs(export_folder_othersessions)
print('Created export_folder_othersessions: {:s}'.format(export_folder_othersessions))
export_folder_lfp = "/".join(filename.split("/")[:-1])+"/KLUSTA/LFP"
if not os.path.exists(export_folder_lfp):
os.makedirs(export_folder_lfp)
print('Created export_folder_lfp: {:s}'.format(export_folder_lfp))
return export_folder, export_folder_basesession, export_folder_othersessions, export_folder_lfp
def get_clusters(filename,key=None):
if not key:
sys.stdout.write('No cluster group key given.')
sys.exit()
cluster_group_names = []
key_clusters =[]
with h5py.File(filename, mode="r") as f:
cluster_groups = f['channel_groups/1/cluster_groups/main/'].keys()
for clusterg in cluster_groups:
name = f['channel_groups/1/cluster_groups/main/'+clusterg].attrs.values()
cluster_group_names.append(name[0][0])
for cluster in f['/channel_groups/1/clusters/main'].iteritems():
name = f['channel_groups/1/clusters/main/'+cluster[0]].attrs.get('cluster_group')
if cluster_group_names[int(name)] == key:
key_clusters.append(int(cluster[0]))
print('{} clusters: {}'.format(key,key_clusters))
if not key_clusters:
print('None found :(')
sys.exit() # apparently this is a bad way to abort the execution ... but it does the job.
return key_clusters
def get_clusters_dont_exit(filename,key=None):
'''
Had to add this function to debug stimulus artefacts ... it serves no other purpose...
'''
if not key:
sys.stdout.write('No cluster group key given.')
sys.exit()
cluster_group_names = []
key_clusters =[]
try:
with h5py.File(filename, mode="r") as f:
cluster_groups = f['channel_groups/1/cluster_groups/main/'].keys()
for clusterg in cluster_groups:
name = f['channel_groups/1/cluster_groups/main/'+clusterg].attrs.values()
cluster_group_names.append(name[0][0])
for cluster in f['/channel_groups/1/clusters/main'].iteritems():
name = f['channel_groups/1/clusters/main/'+cluster[0]].attrs.get('cluster_group')
if cluster_group_names[int(name)] == key:
key_clusters.append(int(cluster[0]))
print('{} clusters: {}'.format(key,key_clusters))
if not key_clusters:
print('None found :(')
except KeyError as err:
print('No valid cluster groups found.')
return key_clusters
def get_basenames(filename):
with h5py.File(filename, mode="r") as f:
basenames = f['basenames'][:]
return basenames
def extract_times(filename):
with h5py.File(filename, mode="r") as f:
spiketimes = np.array(f['/channel_groups/1/spikes/time_samples'][:],dtype=float)
sample_rate = float(f['/application_data/spikedetekt'].attrs.get('sample_rate'))
time_stamps = np.array(f['/event_types/sessions/events/time_samples'][:],dtype=float)
# extract the time stamps yet another way ...
time_stamps_sessions = np.cumsum(np.array(f['/time_stamps_sessions'][:], dtype=float))
time_stamps_sessions_sample_rate = 96000. # cannot extract that from hdf5???
print('Extracted spiketimes.')
return spiketimes,sample_rate,time_stamps, time_stamps_sessions, time_stamps_sessions_sample_rate
def extract_input(filename):
with h5py.File(filename, mode="r") as f:
input_data = f['/input/input_data'][:]
sample_rate_inp = f['/input'].attrs.get('sample_rate_inp')
status=True
try:
sample_rate_inp = float(sample_rate_inp)
except TypeError as error:
status=False
if not status:
input_data=np.nan;time_inp=np.nan;time_stamps_sessions_input=np.nan;
sample_rate_inp=np.nan;num_inp_samples=np.nan;duration_inp=np.nan
return input_data,time_inp,time_stamps_sessions_input,sample_rate_inp,num_inp_samples,duration_inp
# process:
time_inp = np.array(input_data['time'],dtype=float)
time_inp = time_inp/sample_rate_inp*1000. # in ms
num_inp_samples = len(input_data)
time_stamps_sessions_input = f['/input/time_stamps_sessions_input'][:]
time_stamps_sessions_input = np.array(time_stamps_sessions_input,dtype=np.float64)
time_stamps_sessions_input = np.cumsum(time_stamps_sessions_input)
time_stamps_sessions_input = time_stamps_sessions_input/sample_rate_inp*1000. # in ms
duration_inp = (time_stamps_sessions_input)[-1] # in ms
print('Extracted input data.')
return input_data,time_inp,time_stamps_sessions_input,sample_rate_inp,num_inp_samples,duration_inp
def extract_waveforms(filename):
# extract waveforms:
kwx_filename = filename[:-5] + '.kwx'
file_kwx = h5py.File(kwx_filename, 'r')
with h5py.File(kwx_filename, mode="r") as f:
waveforms = f['/channel_groups/1/waveforms_raw'][:]
print('Extracted waveforms.')
return waveforms
def extract_positions(filename):
with h5py.File(filename, mode="r") as f:
data_pos = f['/positions/data_pos'][:]
time_stamps_sessions_pos = np.cumsum(np.array(f['/positions/time_stamps_sessions_pos'][:]),dtype=float)
timebase_pos = float(f['/positions/'].attrs.get('timebase_pos'))
print('Extracted tracking data.')
return data_pos, time_stamps_sessions_pos, timebase_pos
#print('Found position samples at {} Hz ({} seconds over {} session(s))'.format(timebase_pos,time_stamps_sessions_pos[-1]/timebase_pos,len(time_stamps_sessions_pos)-1))
def extract_lfp(filename):
with h5py.File(filename, mode="r") as f:
eeg_raw = f['/eeg/data_eeg'][:]
samples_sessions_eeg = f['/eeg/samples_sessions_eeg'][:]
sample_rate_eeg = f['/eeg/'].attrs.get('sample_rate_eeg')
samples_sessions_eeg = np.cumsum(samples_sessions_eeg)
print('Extracted LFP data.')
#print('Found EEG: {} samples at {} Hz ({} s). Separate LFPs recorded: {}'.format(eeg_raw.shape[1],sample_rate_eeg,len_eeg_s,len(eeg_raw)))
return eeg_raw,samples_sessions_eeg,sample_rate_eeg
def eeg_make_df(eeg_raw,data_pos_df,sample_rate_eeg,timebase_pos):
eeg_df = pd.DataFrame()
for eeg_no in xrange(eeg_raw['eeg'].shape[0]):
eeg_df['eeg{}'.format(eeg_no)] = eeg_raw['eeg'][eeg_no]
eeg_df['eeg_mean'] = np.mean(eeg_raw['eeg'],axis=0)
eeg_df['speed'] = np.repeat(data_pos_df['speed_filtered'].values,sample_rate_eeg/timebase_pos)
eeg_df['time'] = eeg_df.index.values.astype(float)/float(sample_rate_eeg) # in sec
eeg_df.set_index('time', drop=True, append=False, inplace=True, verify_integrity=False)
return eeg_df
def sanity_check(spiketimes=None,sample_rate=None,time_stamps=None,time_stamps_sessions=None,time_stamps_sessions_sample_rate=None,
waveforms=None,time_stamps_sessions_pos=None,timebase_pos=None,data_pos=None,time_stamps_sessions_input=None,
samples_sessions_eeg=None,sample_rate_eeg=None):
# performs a check of length of sessions etc.
try:
sys.stdout.write('\nComparing recorded session lengths...')
if time_stamps is not None and sample_rate and time_stamps_sessions is not None and time_stamps_sessions_sample_rate:
length_session1 = float(time_stamps[-1])/sample_rate
length_session2 = float(time_stamps_sessions[-1])/time_stamps_sessions_sample_rate
if length_session1 != length_session2:
sys.stdout.write('\rInconsistency in calculated session lengths.')
sys.exit()
else:
sys.stdout.write('Success.')
else:
sys.stdout.write('\rNo basic session information found.')
except AttributeError:
sys.stdout.write('\rNo basic session information found.')
except TypeError:
sys.stdout.write('\rNo basic session information found.')
try:
sys.stdout.write('\nComparing waveform and spike numbers...')
if waveforms.shape[0] != len(spiketimes): # as many waveforms recorded as spikes?
sys.stdout.write('\rNumber of recorded waveforms does not match length of recorded spikes.')
sys.exit()
else:
sys.stdout.write('Success.')
except AttributeError:
sys.stdout.write('\rNo waveforms loaded.')
except TypeError:
sys.stdout.write('\rNo waveforms loaded.')
try:
sys.stdout.write('\nComparing recorded session lengths and position record...')
if time_stamps_sessions_pos is not None and timebase_pos and time_stamps is not None and sample_rate and data_pos is not None:
if not (time_stamps/sample_rate == time_stamps_sessions_pos/timebase_pos).all():
sys.stdout.write('\rLength of sessions and position file do not match.')
sys.exit()
elif not len(data_pos)/timebase_pos == (time_stamps/sample_rate)[-1]:
sys.stdout.write('\rLength of sessions and position file do not match.')
sys.exit()
else:
sys.stdout.write('Success.')
else:
sys.stdout.write('\rNo position data loaded.')
except AttributeError:
sys.stdout.write('\rNo position data loaded.')
except TypeError:
sys.stdout.write('\rNo position data loaded.')
# input data:
try:
sys.stdout.write('\nComparing recorded session lengths and input data...')
if time_stamps is not None and sample_rate and time_stamps_sessions_input is not None:
time_stamps_session = np.cumsum(time_stamps)/sample_rate
if (time_stamps_session != np.cumsum(time_stamps_sessions_input)/1000).any():
sys.stdout.write('\rInconsistency in calculated session lengths (session vs. input)')
sys.exit()
else:
sys.stdout.write('Success.')
else:
sys.stdout.write('\rNo basic session or input information found! ')
except AttributeError:
sys.stdout.write('\rNo basic session or input information found! ')
sys.exit() # this is fatal ...
except TypeError:
sys.stdout.write('\rNo basic session or input information found! ')
sys.exit() # this is fatal ...
# LFP data:
try:
sys.stdout.write('\nComparing recorded session lengths and LFP data...')
if time_stamps is not None and sample_rate and samples_sessions_eeg is not None and sample_rate_eeg:
if (time_stamps/sample_rate != samples_sessions_eeg/sample_rate_eeg).all():
sys.stdout.write('\rInconsistency in calculated session lengths (session vs. LFP)')
sys.exit()
else:
sys.stdout.write('Success.')
else:
sys.stdout.write('\rNo basic session or LFP information found!')
except AttributeError:
sys.stdout.write('\rNo basic session or LFP information found!')
sys.exit() # this is fatal ...
except TypeError:
sys.stdout.write('\rNo basic session or LFP information found!')
sys.exit() # this is fatal ...
def find_nearest(array,value):
idx = np.searchsorted(array, value, side="left")
if idx > 0 and (idx == len(array) or math.fabs(value - array[idx-1]) < math.fabs(value - array[idx])):
return idx-1
else:
return idx
print('Loaded analysis helpers: General')
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
396,
5132,
29871,
29906,
29889,
29916,
13,
13,
5215,
2897,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
298,
29945,
2272,
13,
5215,
10876,
13,
5215,
5844,
13,
3166,
7876,
4352,
1053,
7876,
4352,
13,
13,
29937,
16876,
3168,
9489,
29664,
7418,
16439,
13,
13,
1753,
679,
29918,
3207,
29918,
1445,
29898,
9507,
29892,
7529,
29918,
12083,
1125,
13,
1678,
1476,
353,
7700,
13,
1678,
8636,
353,
5159,
13,
1678,
363,
2224,
29892,
1014,
3972,
29879,
29892,
2066,
297,
2897,
29889,
20919,
29898,
7529,
29918,
12083,
1125,
13,
4706,
363,
1024,
297,
2066,
29901,
13,
9651,
363,
1347,
297,
10422,
29889,
5451,
11974,
29908,
1125,
13,
18884,
565,
1347,
297,
1024,
29901,
13,
462,
1678,
1476,
353,
5852,
13,
462,
1678,
8636,
353,
1024,
13,
462,
1678,
736,
1476,
29892,
8636,
13,
1678,
736,
1476,
29892,
8636,
13,
13,
1753,
302,
29918,
1792,
29898,
9507,
1125,
13,
1678,
396,
2886,
302,
29899,
21594,
8952,
13,
1678,
302,
29918,
21594,
29918,
1792,
353,
525,
5464,
29918,
1693,
2164,
29915,
13,
1678,
565,
525,
29924,
359,
414,
6004,
29915,
297,
10422,
29901,
13,
4706,
396,
10241,
2897,
29916,
29914,
9389,
29901,
13,
4706,
22645,
353,
518,
29875,
363,
474,
29892,
29916,
297,
26985,
29898,
9507,
29889,
5451,
11219,
8785,
565,
921,
1275,
525,
29924,
359,
414,
6004,
2033,
29961,
29900,
29962,
13,
4706,
302,
29918,
21594,
29918,
1792,
353,
10422,
29889,
5451,
11219,
29861,
13140,
29974,
29896,
29962,
13,
1678,
1683,
29901,
13,
4706,
396,
10241,
5417,
29901,
13,
4706,
22645,
353,
518,
29875,
363,
474,
29892,
29916,
297,
26985,
29898,
9507,
29889,
5451,
11219,
8785,
565,
921,
1275,
525,
29940,
29901,
2033,
29961,
29900,
29962,
13,
4706,
302,
29918,
21594,
29918,
1792,
353,
10422,
29889,
5451,
11219,
29861,
13140,
29974,
29896,
29962,
13,
13,
1678,
736,
302,
29918,
21594,
29918,
1792,
13,
13,
13,
1753,
1653,
29918,
15843,
29918,
8771,
414,
29898,
9507,
1125,
13,
1678,
396,
1653,
5609,
16495,
13,
1678,
5609,
29918,
12083,
353,
5591,
1642,
7122,
29898,
9507,
29889,
5451,
11974,
1159,
7503,
29899,
29896,
2314,
13578,
29914,
29968,
29931,
17321,
29909,
12975,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
15843,
29918,
12083,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
15843,
29918,
12083,
29897,
13,
4706,
1596,
877,
20399,
5609,
4138,
29901,
12365,
29879,
29913,
4286,
4830,
29898,
15843,
29918,
12083,
876,
13,
13,
1678,
5609,
29918,
12083,
29918,
29890,
2129,
1211,
29922,
5591,
1642,
7122,
29898,
9507,
29889,
5451,
11974,
1159,
7503,
29899,
29896,
2314,
13578,
29914,
29968,
29931,
17321,
29909,
29914,
3188,
29918,
7924,
29908,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
15843,
29918,
12083,
29918,
29890,
2129,
1211,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
15843,
29918,
12083,
29918,
29890,
2129,
1211,
29897,
13,
4706,
1596,
877,
20399,
5609,
29918,
12083,
29918,
29890,
2129,
1211,
29901,
12365,
29879,
29913,
4286,
4830,
29898,
15843,
29918,
12083,
29918,
29890,
2129,
1211,
876,
13,
13,
1678,
5609,
29918,
12083,
29918,
720,
414,
10964,
29922,
5591,
1642,
7122,
29898,
9507,
29889,
5451,
11974,
1159,
7503,
29899,
29896,
2314,
13578,
29914,
29968,
29931,
17321,
29909,
29914,
1228,
29918,
7924,
29908,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
15843,
29918,
12083,
29918,
720,
414,
10964,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
15843,
29918,
12083,
29918,
720,
414,
10964,
29897,
13,
4706,
1596,
877,
20399,
5609,
29918,
12083,
29918,
720,
414,
10964,
29901,
12365,
29879,
29913,
4286,
4830,
29898,
15843,
29918,
12083,
29918,
720,
414,
10964,
876,
13,
13,
1678,
5609,
29918,
12083,
29918,
720,
414,
10964,
29922,
5591,
1642,
7122,
29898,
9507,
29889,
5451,
11974,
1159,
7503,
29899,
29896,
2314,
13578,
29914,
29968,
29931,
17321,
29909,
29914,
1228,
29918,
7924,
29908,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
15843,
29918,
12083,
29918,
720,
414,
10964,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
15843,
29918,
12083,
29918,
720,
414,
10964,
29897,
13,
4706,
1596,
877,
20399,
5609,
29918,
12083,
29918,
720,
414,
10964,
29901,
12365,
29879,
29913,
4286,
4830,
29898,
15843,
29918,
12083,
29918,
720,
414,
10964,
876,
13,
13,
1678,
5609,
29918,
12083,
29918,
29880,
18091,
353,
5591,
1642,
7122,
29898,
9507,
29889,
5451,
11974,
1159,
7503,
29899,
29896,
2314,
13578,
29914,
29968,
29931,
17321,
29909,
29914,
29931,
26353,
29908,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
15843,
29918,
12083,
29918,
29880,
18091,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
15843,
29918,
12083,
29918,
29880,
18091,
29897,
13,
4706,
1596,
877,
20399,
5609,
29918,
12083,
29918,
29880,
18091,
29901,
12365,
29879,
29913,
4286,
4830,
29898,
15843,
29918,
12083,
29918,
29880,
18091,
876,
13,
13,
1678,
736,
5609,
29918,
12083,
29892,
5609,
29918,
12083,
29918,
29890,
2129,
1211,
29892,
5609,
29918,
12083,
29918,
720,
414,
10964,
29892,
5609,
29918,
12083,
29918,
29880,
18091,
13,
13,
1753,
679,
29918,
695,
504,
414,
29898,
9507,
29892,
1989,
29922,
8516,
1125,
13,
1678,
565,
451,
1820,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
877,
3782,
9867,
2318,
1820,
2183,
29889,
1495,
13,
4706,
10876,
29889,
13322,
580,
13,
13,
1678,
9867,
29918,
2972,
29918,
7039,
353,
5159,
13,
1678,
1820,
29918,
695,
504,
414,
353,
2636,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
4706,
9867,
29918,
13155,
353,
285,
1839,
12719,
29918,
13155,
29914,
29896,
29914,
19594,
29918,
13155,
29914,
3396,
29914,
13359,
8149,
580,
13,
4706,
363,
9867,
29887,
297,
9867,
29918,
13155,
29901,
13,
9651,
1024,
353,
285,
1839,
12719,
29918,
13155,
29914,
29896,
29914,
19594,
29918,
13155,
29914,
3396,
29914,
18717,
19594,
29887,
1822,
5552,
29879,
29889,
5975,
580,
13,
9651,
9867,
29918,
2972,
29918,
7039,
29889,
4397,
29898,
978,
29961,
29900,
3816,
29900,
2314,
13,
13,
4706,
363,
9867,
297,
285,
1839,
29914,
12719,
29918,
13155,
29914,
29896,
29914,
695,
504,
414,
29914,
3396,
13359,
1524,
7076,
7295,
13,
9651,
1024,
353,
285,
1839,
12719,
29918,
13155,
29914,
29896,
29914,
695,
504,
414,
29914,
3396,
29914,
18717,
19594,
29961,
29900,
29962,
1822,
5552,
29879,
29889,
657,
877,
19594,
29918,
2972,
1495,
13,
9651,
565,
9867,
29918,
2972,
29918,
7039,
29961,
524,
29898,
978,
4638,
1275,
1820,
29901,
13,
18884,
1820,
29918,
695,
504,
414,
29889,
4397,
29898,
524,
29898,
19594,
29961,
29900,
12622,
13,
1678,
1596,
877,
8875,
24554,
29901,
6571,
4286,
4830,
29898,
1989,
29892,
1989,
29918,
695,
504,
414,
876,
13,
1678,
565,
451,
1820,
29918,
695,
504,
414,
29901,
13,
4706,
1596,
877,
8516,
1476,
584,
877,
29897,
13,
4706,
10876,
29889,
13322,
580,
396,
13229,
445,
338,
263,
4319,
982,
304,
27450,
278,
8225,
2023,
541,
372,
947,
278,
4982,
29889,
13,
1678,
736,
1820,
29918,
695,
504,
414,
13,
13,
1753,
679,
29918,
695,
504,
414,
29918,
29881,
609,
29918,
13322,
29898,
9507,
29892,
1989,
29922,
8516,
1125,
13,
1678,
14550,
13,
1678,
14302,
304,
788,
445,
740,
304,
4744,
20436,
14999,
20160,
17028,
29879,
2023,
372,
19700,
694,
916,
6437,
856,
13,
1678,
14550,
13,
13,
1678,
565,
451,
1820,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
877,
3782,
9867,
2318,
1820,
2183,
29889,
1495,
13,
4706,
10876,
29889,
13322,
580,
13,
13,
1678,
9867,
29918,
2972,
29918,
7039,
353,
5159,
13,
1678,
1820,
29918,
695,
504,
414,
353,
2636,
13,
1678,
1018,
29901,
13,
4706,
411,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
9651,
9867,
29918,
13155,
353,
285,
1839,
12719,
29918,
13155,
29914,
29896,
29914,
19594,
29918,
13155,
29914,
3396,
29914,
13359,
8149,
580,
13,
9651,
363,
9867,
29887,
297,
9867,
29918,
13155,
29901,
13,
18884,
1024,
353,
285,
1839,
12719,
29918,
13155,
29914,
29896,
29914,
19594,
29918,
13155,
29914,
3396,
29914,
18717,
19594,
29887,
1822,
5552,
29879,
29889,
5975,
580,
13,
18884,
9867,
29918,
2972,
29918,
7039,
29889,
4397,
29898,
978,
29961,
29900,
3816,
29900,
2314,
13,
13,
9651,
363,
9867,
297,
285,
1839,
29914,
12719,
29918,
13155,
29914,
29896,
29914,
695,
504,
414,
29914,
3396,
13359,
1524,
7076,
7295,
13,
18884,
1024,
353,
285,
1839,
12719,
29918,
13155,
29914,
29896,
29914,
695,
504,
414,
29914,
3396,
29914,
18717,
19594,
29961,
29900,
29962,
1822,
5552,
29879,
29889,
657,
877,
19594,
29918,
2972,
1495,
13,
18884,
565,
9867,
29918,
2972,
29918,
7039,
29961,
524,
29898,
978,
4638,
1275,
1820,
29901,
13,
462,
1678,
1820,
29918,
695,
504,
414,
29889,
4397,
29898,
524,
29898,
19594,
29961,
29900,
12622,
13,
4706,
1596,
877,
8875,
24554,
29901,
6571,
4286,
4830,
29898,
1989,
29892,
1989,
29918,
695,
504,
414,
876,
13,
4706,
565,
451,
1820,
29918,
695,
504,
414,
29901,
13,
9651,
1596,
877,
8516,
1476,
584,
877,
29897,
13,
1678,
5174,
7670,
2392,
408,
4589,
29901,
13,
4706,
1596,
877,
3782,
2854,
9867,
6471,
1476,
29889,
1495,
13,
13,
1678,
736,
1820,
29918,
695,
504,
414,
13,
13,
1753,
679,
29918,
6500,
264,
1280,
29898,
9507,
1125,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
4706,
2362,
264,
1280,
353,
285,
1839,
6500,
264,
1280,
2033,
7503,
29962,
13,
1678,
736,
2362,
264,
1280,
13,
13,
1753,
6597,
29918,
3706,
29898,
9507,
1125,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
4706,
805,
638,
300,
1355,
353,
7442,
29889,
2378,
29898,
29888,
1839,
29914,
12719,
29918,
13155,
29914,
29896,
29914,
1028,
29379,
29914,
2230,
29918,
27736,
2033,
7503,
1402,
29881,
1853,
29922,
7411,
29897,
13,
4706,
4559,
29918,
10492,
353,
5785,
29898,
29888,
1839,
29914,
6214,
29918,
1272,
29914,
1028,
638,
287,
2650,
1193,
13359,
5552,
29879,
29889,
657,
877,
11249,
29918,
10492,
8785,
13,
4706,
931,
29918,
303,
15092,
353,
7442,
29889,
2378,
29898,
29888,
1839,
29914,
3696,
29918,
8768,
29914,
29879,
10964,
29914,
13604,
29914,
2230,
29918,
27736,
2033,
7503,
1402,
29881,
1853,
29922,
7411,
29897,
13,
13,
4706,
396,
6597,
278,
931,
380,
15092,
3447,
1790,
982,
2023,
13,
4706,
931,
29918,
303,
15092,
29918,
29879,
10964,
353,
7442,
29889,
29883,
398,
2083,
29898,
9302,
29889,
2378,
29898,
29888,
1839,
29914,
2230,
29918,
303,
15092,
29918,
29879,
10964,
2033,
7503,
1402,
26688,
29922,
7411,
876,
13,
4706,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
11249,
29918,
10492,
353,
29871,
29929,
29953,
29900,
29900,
29900,
29889,
396,
2609,
6597,
393,
515,
298,
2176,
29945,
28772,
13,
1678,
1596,
877,
5647,
1461,
287,
805,
638,
300,
1355,
29889,
1495,
13,
1678,
736,
805,
638,
300,
1355,
29892,
11249,
29918,
10492,
29892,
2230,
29918,
303,
15092,
29892,
931,
29918,
303,
15092,
29918,
29879,
10964,
29892,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
11249,
29918,
10492,
13,
13,
1753,
6597,
29918,
2080,
29898,
9507,
1125,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
4706,
1881,
29918,
1272,
353,
285,
1839,
29914,
2080,
29914,
2080,
29918,
1272,
2033,
7503,
29962,
13,
4706,
4559,
29918,
10492,
29918,
262,
29886,
353,
285,
1839,
29914,
2080,
13359,
5552,
29879,
29889,
657,
877,
11249,
29918,
10492,
29918,
262,
29886,
1495,
13,
4706,
4660,
29922,
5574,
13,
4706,
1018,
29901,
13,
9651,
4559,
29918,
10492,
29918,
262,
29886,
353,
5785,
29898,
11249,
29918,
10492,
29918,
262,
29886,
29897,
13,
4706,
5174,
20948,
408,
1059,
29901,
13,
9651,
4660,
29922,
8824,
13,
4706,
565,
451,
4660,
29901,
13,
9651,
1881,
29918,
1272,
29922,
9302,
29889,
13707,
29936,
2230,
29918,
262,
29886,
29922,
9302,
29889,
13707,
29936,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
29922,
9302,
29889,
13707,
29936,
13,
9651,
4559,
29918,
10492,
29918,
262,
29886,
29922,
9302,
29889,
13707,
29936,
1949,
29918,
262,
29886,
29918,
27736,
29922,
9302,
29889,
13707,
29936,
19708,
29918,
262,
29886,
29922,
9302,
29889,
13707,
13,
9651,
736,
1881,
29918,
1272,
29892,
2230,
29918,
262,
29886,
29892,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
29892,
11249,
29918,
10492,
29918,
262,
29886,
29892,
1949,
29918,
262,
29886,
29918,
27736,
29892,
19708,
29918,
262,
29886,
13,
13,
4706,
396,
1889,
29901,
13,
4706,
931,
29918,
262,
29886,
353,
7442,
29889,
2378,
29898,
2080,
29918,
1272,
1839,
2230,
7464,
29881,
1853,
29922,
7411,
29897,
13,
4706,
931,
29918,
262,
29886,
353,
931,
29918,
262,
29886,
29914,
11249,
29918,
10492,
29918,
262,
29886,
29930,
29896,
29900,
29900,
29900,
29889,
396,
297,
10887,
13,
4706,
954,
29918,
262,
29886,
29918,
27736,
353,
7431,
29898,
2080,
29918,
1272,
29897,
13,
13,
4706,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
353,
285,
1839,
29914,
2080,
29914,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
2033,
7503,
29962,
13,
4706,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
353,
7442,
29889,
2378,
29898,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
29892,
29881,
1853,
29922,
9302,
29889,
7411,
29953,
29946,
29897,
13,
4706,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
353,
7442,
29889,
29883,
398,
2083,
29898,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
29897,
13,
4706,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
353,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
29914,
11249,
29918,
10492,
29918,
262,
29886,
29930,
29896,
29900,
29900,
29900,
29889,
396,
297,
10887,
13,
13,
4706,
14385,
29918,
262,
29886,
353,
313,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
9601,
29899,
29896,
29962,
396,
297,
10887,
13,
13,
1678,
1596,
877,
5647,
1461,
287,
1881,
848,
29889,
1495,
13,
1678,
736,
1881,
29918,
1272,
29892,
2230,
29918,
262,
29886,
29892,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
29892,
11249,
29918,
10492,
29918,
262,
29886,
29892,
1949,
29918,
262,
29886,
29918,
27736,
29892,
19708,
29918,
262,
29886,
13,
13,
1753,
6597,
29918,
27766,
9514,
29898,
9507,
1125,
13,
1678,
396,
6597,
10742,
9514,
29901,
13,
1678,
9049,
29916,
29918,
9507,
353,
10422,
7503,
29899,
29945,
29962,
718,
15300,
11022,
29916,
29915,
13,
1678,
934,
29918,
11022,
29916,
353,
298,
29945,
2272,
29889,
2283,
29898,
11022,
29916,
29918,
9507,
29892,
525,
29878,
1495,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
11022,
29916,
29918,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
4706,
10742,
9514,
353,
285,
1839,
29914,
12719,
29918,
13155,
29914,
29896,
29914,
27766,
9514,
29918,
1610,
2033,
7503,
29962,
13,
1678,
1596,
877,
5647,
1461,
287,
10742,
9514,
29889,
1495,
13,
1678,
736,
10742,
9514,
13,
13,
1753,
6597,
29918,
1066,
2187,
29898,
9507,
1125,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
4706,
848,
29918,
1066,
353,
285,
1839,
29914,
1066,
2187,
29914,
1272,
29918,
1066,
2033,
7503,
29962,
13,
4706,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
353,
7442,
29889,
29883,
398,
2083,
29898,
9302,
29889,
2378,
29898,
29888,
1839,
29914,
1066,
2187,
29914,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
2033,
7503,
11724,
29881,
1853,
29922,
7411,
29897,
13,
4706,
931,
3188,
29918,
1066,
353,
5785,
29898,
29888,
1839,
29914,
1066,
2187,
29914,
13359,
5552,
29879,
29889,
657,
877,
2230,
3188,
29918,
1066,
8785,
13,
1678,
1596,
877,
5647,
1461,
287,
23110,
848,
29889,
1495,
13,
1678,
736,
848,
29918,
1066,
29892,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
29892,
931,
3188,
29918,
1066,
13,
1678,
396,
2158,
877,
9692,
2602,
11916,
472,
6571,
379,
29920,
313,
8875,
6923,
975,
6571,
4867,
29898,
29879,
876,
4286,
4830,
29898,
2230,
3188,
29918,
1066,
29892,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
14352,
29896,
16261,
2230,
3188,
29918,
1066,
29892,
2435,
29898,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
6817,
29896,
876,
13,
13,
1753,
6597,
29918,
29880,
18091,
29898,
9507,
1125,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
9507,
29892,
4464,
543,
29878,
1159,
408,
285,
29901,
13,
4706,
321,
387,
29918,
1610,
353,
285,
1839,
29914,
29872,
387,
29914,
1272,
29918,
29872,
387,
2033,
7503,
29962,
13,
4706,
11916,
29918,
29879,
10964,
29918,
29872,
387,
353,
285,
1839,
29914,
29872,
387,
29914,
27736,
29918,
29879,
10964,
29918,
29872,
387,
2033,
7503,
29962,
13,
4706,
4559,
29918,
10492,
29918,
29872,
387,
353,
285,
1839,
29914,
29872,
387,
29914,
13359,
5552,
29879,
29889,
657,
877,
11249,
29918,
10492,
29918,
29872,
387,
1495,
13,
1678,
11916,
29918,
29879,
10964,
29918,
29872,
387,
353,
7442,
29889,
29883,
398,
2083,
29898,
27736,
29918,
29879,
10964,
29918,
29872,
387,
29897,
13,
1678,
1596,
877,
5647,
1461,
287,
365,
26353,
848,
29889,
1495,
13,
1678,
396,
2158,
877,
9692,
382,
11787,
29901,
6571,
11916,
472,
6571,
379,
29920,
313,
8875,
269,
467,
922,
862,
403,
365,
26353,
29879,
10478,
29901,
6571,
4286,
4830,
29898,
29872,
387,
29918,
1610,
29889,
12181,
29961,
29896,
1402,
11249,
29918,
10492,
29918,
29872,
387,
29892,
2435,
29918,
29872,
387,
29918,
29879,
29892,
2435,
29898,
29872,
387,
29918,
1610,
4961,
13,
1678,
736,
321,
387,
29918,
1610,
29892,
27736,
29918,
29879,
10964,
29918,
29872,
387,
29892,
11249,
29918,
10492,
29918,
29872,
387,
13,
13,
1753,
321,
387,
29918,
5675,
29918,
2176,
29898,
29872,
387,
29918,
1610,
29892,
1272,
29918,
1066,
29918,
2176,
29892,
11249,
29918,
10492,
29918,
29872,
387,
29892,
2230,
3188,
29918,
1066,
1125,
13,
1678,
321,
387,
29918,
2176,
353,
10518,
29889,
17271,
580,
13,
1678,
363,
321,
387,
29918,
1217,
297,
921,
3881,
29898,
29872,
387,
29918,
1610,
1839,
29872,
387,
13359,
12181,
29961,
29900,
29962,
1125,
13,
4706,
321,
387,
29918,
2176,
1839,
29872,
387,
8875,
4286,
4830,
29898,
29872,
387,
29918,
1217,
4638,
353,
321,
387,
29918,
1610,
1839,
29872,
387,
2033,
29961,
29872,
387,
29918,
1217,
29962,
13,
1678,
321,
387,
29918,
2176,
1839,
29872,
387,
29918,
12676,
2033,
353,
7442,
29889,
12676,
29898,
29872,
387,
29918,
1610,
1839,
29872,
387,
7464,
8990,
29922,
29900,
29897,
13,
1678,
321,
387,
29918,
2176,
1839,
19322,
2033,
353,
7442,
29889,
14358,
29898,
1272,
29918,
1066,
29918,
2176,
1839,
19322,
29918,
4572,
287,
13359,
5975,
29892,
11249,
29918,
10492,
29918,
29872,
387,
29914,
2230,
3188,
29918,
1066,
29897,
13,
13,
1678,
321,
387,
29918,
2176,
1839,
2230,
2033,
353,
321,
387,
29918,
2176,
29889,
2248,
29889,
5975,
29889,
579,
668,
29898,
7411,
6802,
7411,
29898,
11249,
29918,
10492,
29918,
29872,
387,
29897,
396,
297,
5226,
13,
1678,
321,
387,
29918,
2176,
29889,
842,
29918,
2248,
877,
2230,
742,
5768,
29922,
5574,
29892,
9773,
29922,
8824,
29892,
297,
6689,
29922,
5574,
29892,
11539,
29918,
14146,
537,
29922,
8824,
29897,
13,
1678,
736,
321,
387,
29918,
2176,
13,
13,
1753,
9753,
537,
29918,
3198,
29898,
1028,
638,
300,
1355,
29922,
8516,
29892,
11249,
29918,
10492,
29922,
8516,
29892,
2230,
29918,
303,
15092,
29922,
8516,
29892,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29922,
8516,
29892,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
11249,
29918,
10492,
29922,
8516,
29892,
13,
462,
10742,
9514,
29922,
8516,
29892,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
29922,
8516,
29892,
2230,
3188,
29918,
1066,
29922,
8516,
29892,
1272,
29918,
1066,
29922,
8516,
29892,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
29922,
8516,
29892,
13,
462,
11916,
29918,
29879,
10964,
29918,
29872,
387,
29922,
8516,
29892,
11249,
29918,
10492,
29918,
29872,
387,
29922,
8516,
1125,
13,
1678,
396,
23233,
263,
1423,
310,
3309,
310,
21396,
2992,
29889,
13,
13,
1678,
1018,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29876,
1523,
862,
292,
10478,
4867,
27497,
856,
1495,
13,
4706,
565,
931,
29918,
303,
15092,
338,
451,
6213,
322,
4559,
29918,
10492,
322,
931,
29918,
303,
15092,
29918,
29879,
10964,
338,
451,
6213,
322,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
11249,
29918,
10492,
29901,
13,
9651,
3309,
29918,
7924,
29896,
353,
5785,
29898,
2230,
29918,
303,
15092,
14352,
29896,
2314,
29914,
11249,
29918,
10492,
13,
9651,
3309,
29918,
7924,
29906,
353,
5785,
29898,
2230,
29918,
303,
15092,
29918,
29879,
10964,
14352,
29896,
2314,
29914,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
11249,
29918,
10492,
13,
9651,
565,
3309,
29918,
7924,
29896,
2804,
3309,
29918,
7924,
29906,
29901,
13,
18884,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
797,
3200,
391,
3819,
297,
12833,
4867,
27497,
29889,
1495,
13,
18884,
10876,
29889,
13322,
580,
13,
9651,
1683,
29901,
13,
18884,
10876,
29889,
25393,
29889,
3539,
877,
14191,
29889,
1495,
13,
4706,
1683,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
2472,
1476,
29889,
1495,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
2472,
1476,
29889,
1495,
13,
1678,
5174,
20948,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
2472,
1476,
29889,
1495,
13,
13,
1678,
1018,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29876,
1523,
862,
292,
10742,
689,
322,
805,
9345,
3694,
856,
1495,
13,
4706,
565,
10742,
9514,
29889,
12181,
29961,
29900,
29962,
2804,
7431,
29898,
1028,
638,
300,
1355,
1125,
396,
408,
1784,
10742,
9514,
10478,
408,
805,
29379,
29973,
13,
9651,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
4557,
310,
10478,
10742,
9514,
947,
451,
1993,
3309,
310,
10478,
805,
29379,
29889,
1495,
13,
9651,
10876,
29889,
13322,
580,
13,
4706,
1683,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
877,
14191,
29889,
1495,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
10742,
9514,
7500,
29889,
1495,
13,
1678,
5174,
20948,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
10742,
9514,
7500,
29889,
1495,
13,
13,
1678,
1018,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29876,
1523,
862,
292,
10478,
4867,
27497,
322,
2602,
2407,
856,
1495,
13,
4706,
565,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
338,
451,
6213,
322,
931,
3188,
29918,
1066,
322,
931,
29918,
303,
15092,
338,
451,
6213,
322,
4559,
29918,
10492,
322,
848,
29918,
1066,
338,
451,
6213,
29901,
13,
9651,
565,
451,
313,
2230,
29918,
303,
15092,
29914,
11249,
29918,
10492,
1275,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
1066,
29914,
2230,
3188,
29918,
1066,
467,
497,
7295,
13,
18884,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
6513,
310,
21396,
322,
2602,
934,
437,
451,
1993,
29889,
1495,
13,
18884,
10876,
29889,
13322,
580,
13,
9651,
25342,
451,
7431,
29898,
1272,
29918,
1066,
6802,
2230,
3188,
29918,
1066,
1275,
313,
2230,
29918,
303,
15092,
29914,
11249,
29918,
10492,
9601,
29899,
29896,
5387,
13,
18884,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
6513,
310,
21396,
322,
2602,
934,
437,
451,
1993,
29889,
1495,
13,
18884,
10876,
29889,
13322,
580,
13,
9651,
1683,
29901,
13,
18884,
10876,
29889,
25393,
29889,
3539,
877,
14191,
29889,
1495,
13,
4706,
1683,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
2602,
848,
7500,
29889,
1495,
13,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
2602,
848,
7500,
29889,
1495,
13,
1678,
5174,
20948,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
2602,
848,
7500,
29889,
1495,
13,
13,
1678,
396,
1881,
848,
29901,
13,
1678,
1018,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29876,
1523,
862,
292,
10478,
4867,
27497,
322,
1881,
848,
856,
1495,
13,
4706,
565,
931,
29918,
303,
15092,
338,
451,
6213,
322,
4559,
29918,
10492,
322,
931,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
338,
451,
6213,
29901,
13,
9651,
931,
29918,
303,
15092,
29918,
7924,
353,
7442,
29889,
29883,
398,
2083,
29898,
2230,
29918,
303,
15092,
6802,
11249,
29918,
10492,
13,
9651,
565,
313,
2230,
29918,
303,
15092,
29918,
7924,
2804,
7442,
29889,
29883,
398,
2083,
29898,
2230,
29918,
303,
15092,
29918,
29879,
10964,
29918,
2080,
6802,
29896,
29900,
29900,
29900,
467,
1384,
7295,
13,
18884,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
797,
3200,
391,
3819,
297,
12833,
4867,
27497,
313,
7924,
7186,
29889,
1881,
29897,
1495,
13,
18884,
10876,
29889,
13322,
580,
13,
9651,
1683,
29901,
13,
18884,
10876,
29889,
25393,
29889,
3539,
877,
14191,
29889,
1495,
13,
4706,
1683,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
470,
1881,
2472,
1476,
29991,
308,
25710,
13,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
470,
1881,
2472,
1476,
29991,
632,
25710,
13,
4706,
10876,
29889,
13322,
580,
396,
445,
338,
18409,
2023,
13,
1678,
5174,
20948,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
470,
1881,
2472,
1476,
29991,
632,
25710,
13,
4706,
10876,
29889,
13322,
580,
396,
445,
338,
18409,
2023,
13,
13,
1678,
396,
365,
26353,
848,
29901,
13,
1678,
1018,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29876,
1523,
862,
292,
10478,
4867,
27497,
322,
365,
26353,
848,
856,
1495,
13,
4706,
565,
931,
29918,
303,
15092,
338,
451,
6213,
322,
4559,
29918,
10492,
322,
11916,
29918,
29879,
10964,
29918,
29872,
387,
338,
451,
6213,
322,
4559,
29918,
10492,
29918,
29872,
387,
29901,
13,
9651,
565,
313,
2230,
29918,
303,
15092,
29914,
11249,
29918,
10492,
2804,
11916,
29918,
29879,
10964,
29918,
29872,
387,
29914,
11249,
29918,
10492,
29918,
29872,
387,
467,
497,
7295,
13,
18884,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
797,
3200,
391,
3819,
297,
12833,
4867,
27497,
313,
7924,
7186,
29889,
365,
26353,
29897,
1495,
13,
18884,
10876,
29889,
13322,
580,
13,
9651,
1683,
29901,
13,
18884,
10876,
29889,
25393,
29889,
3539,
877,
14191,
29889,
1495,
13,
4706,
1683,
29901,
13,
9651,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
470,
365,
26353,
2472,
1476,
29991,
1495,
13,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
470,
365,
26353,
2472,
1476,
29991,
1495,
13,
4706,
10876,
29889,
13322,
580,
396,
445,
338,
18409,
2023,
13,
1678,
5174,
20948,
29901,
13,
4706,
10876,
29889,
25393,
29889,
3539,
28909,
29878,
3782,
6996,
4867,
470,
365,
26353,
2472,
1476,
29991,
1495,
13,
4706,
10876,
29889,
13322,
580,
396,
445,
338,
18409,
2023,
13,
13,
13,
1753,
1284,
29918,
28502,
342,
29898,
2378,
29892,
1767,
1125,
13,
1678,
22645,
353,
7442,
29889,
4478,
24582,
29898,
2378,
29892,
995,
29892,
2625,
543,
1563,
1159,
13,
1678,
565,
22645,
1405,
29871,
29900,
322,
313,
13140,
1275,
7431,
29898,
2378,
29897,
470,
5844,
29889,
29888,
6897,
29898,
1767,
448,
1409,
29961,
13140,
29899,
29896,
2314,
529,
5844,
29889,
29888,
6897,
29898,
1767,
448,
1409,
29961,
13140,
12622,
29901,
13,
4706,
736,
22645,
29899,
29896,
13,
1678,
1683,
29901,
13,
4706,
736,
22645,
13,
13,
13,
2158,
877,
29147,
7418,
1371,
414,
29901,
4593,
1495,
13,
2
] |
42_Google_Hash_Code/pizza_ml_0/ingredients.py | gguarnay/42 | 1 | 94104 | import numpy as np
class Ingredients:
'''
Class for calculations of ingredients inside an area.
'''
def __init__(self, pizza_lines):
self._lines = [list(l) for l in pizza_lines]
self._unique, self._map = np.unique(self._lines, return_inverse=True)
self._map = self._map.reshape((len(self._lines),len(self._lines[0])))
self.shape = self._map.shape
self.total = self.shape[0]*self.shape[1]
self.total_unique = np.max(self._map)+1
self.initialize()
def initialize(self):
'''
Create an array for faster calculation of ingredients inside an area.
'''
from_origin = np.zeros((*self.shape, self.total_unique))
for r in range(self.shape[0]):
for c in range(self.shape[1]):
ingredient_id = self._map[r][c]
from_origin[r][c][ingredient_id] = 1
if r > 0:
from_origin[r][c] += from_origin[r-1][c]
if c > 0:
from_origin[r][c] += from_origin[r][c-1]
if r > 0 and c > 0:
from_origin[r][c] -= from_origin[r-1][c-1]
self._from_origin = from_origin
def of(self, slice):
'''
Return 1d array of number of ingredients, so i-th element is the number of
ingredient with id i inside specified slice.
'''
ingredients_inside_slice = np.copy(self._from_origin[
slice.r1,
slice.c1])
if slice.r0 > 0:
ingredients_inside_slice -= self._from_origin[slice.r0-1][slice.c1]
if slice.c0 > 0:
ingredients_inside_slice -= self._from_origin[slice.r1][slice.c0-1]
if slice.r0 > 0 and slice.c0 > 0:
ingredients_inside_slice += self._from_origin[slice.r0-1][slice.c0-1]
return ingredients_inside_slice
| [
1,
1053,
12655,
408,
7442,
13,
13,
1990,
22607,
1127,
10070,
29901,
13,
1678,
14550,
13,
1678,
4134,
363,
17203,
310,
2348,
1127,
10070,
2768,
385,
4038,
29889,
13,
1678,
14550,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
282,
24990,
29918,
9012,
1125,
13,
4706,
1583,
3032,
9012,
353,
518,
1761,
29898,
29880,
29897,
363,
301,
297,
282,
24990,
29918,
9012,
29962,
13,
4706,
1583,
3032,
13092,
29892,
1583,
3032,
1958,
353,
7442,
29889,
13092,
29898,
1311,
3032,
9012,
29892,
736,
29918,
262,
3901,
29922,
5574,
29897,
13,
4706,
1583,
3032,
1958,
353,
1583,
3032,
1958,
29889,
690,
14443,
3552,
2435,
29898,
1311,
3032,
9012,
511,
2435,
29898,
1311,
3032,
9012,
29961,
29900,
29962,
4961,
13,
4706,
1583,
29889,
12181,
353,
1583,
3032,
1958,
29889,
12181,
13,
13,
4706,
1583,
29889,
7827,
353,
1583,
29889,
12181,
29961,
29900,
14178,
1311,
29889,
12181,
29961,
29896,
29962,
13,
4706,
1583,
29889,
7827,
29918,
13092,
353,
7442,
29889,
3317,
29898,
1311,
3032,
1958,
7240,
29896,
13,
13,
4706,
1583,
29889,
24926,
580,
13,
13,
1678,
822,
11905,
29898,
1311,
1125,
13,
4706,
14550,
13,
4706,
6204,
385,
1409,
363,
8473,
13944,
310,
2348,
1127,
10070,
2768,
385,
4038,
29889,
13,
4706,
14550,
13,
13,
4706,
515,
29918,
12574,
353,
7442,
29889,
3298,
359,
3552,
29930,
1311,
29889,
12181,
29892,
1583,
29889,
7827,
29918,
13092,
876,
13,
13,
4706,
363,
364,
297,
3464,
29898,
1311,
29889,
12181,
29961,
29900,
29962,
1125,
13,
9651,
363,
274,
297,
3464,
29898,
1311,
29889,
12181,
29961,
29896,
29962,
1125,
13,
18884,
2348,
1127,
993,
29918,
333,
353,
1583,
3032,
1958,
29961,
29878,
3816,
29883,
29962,
13,
18884,
515,
29918,
12574,
29961,
29878,
3816,
29883,
3816,
292,
1127,
993,
29918,
333,
29962,
353,
29871,
29896,
13,
18884,
565,
364,
1405,
29871,
29900,
29901,
13,
462,
1678,
515,
29918,
12574,
29961,
29878,
3816,
29883,
29962,
4619,
515,
29918,
12574,
29961,
29878,
29899,
29896,
3816,
29883,
29962,
13,
18884,
565,
274,
1405,
29871,
29900,
29901,
13,
462,
1678,
515,
29918,
12574,
29961,
29878,
3816,
29883,
29962,
4619,
515,
29918,
12574,
29961,
29878,
3816,
29883,
29899,
29896,
29962,
13,
18884,
565,
364,
1405,
29871,
29900,
322,
274,
1405,
29871,
29900,
29901,
13,
462,
1678,
515,
29918,
12574,
29961,
29878,
3816,
29883,
29962,
22361,
515,
29918,
12574,
29961,
29878,
29899,
29896,
3816,
29883,
29899,
29896,
29962,
13,
13,
4706,
1583,
3032,
3166,
29918,
12574,
353,
515,
29918,
12574,
13,
13,
1678,
822,
310,
29898,
1311,
29892,
22780,
1125,
13,
4706,
14550,
13,
4706,
7106,
29871,
29896,
29881,
1409,
310,
1353,
310,
2348,
1127,
10070,
29892,
577,
474,
29899,
386,
1543,
338,
278,
1353,
310,
13,
4706,
2348,
1127,
993,
411,
1178,
474,
2768,
6790,
22780,
29889,
13,
4706,
14550,
13,
13,
4706,
2348,
1127,
10070,
29918,
26102,
29918,
18337,
353,
7442,
29889,
8552,
29898,
1311,
3032,
3166,
29918,
12574,
29961,
13,
18884,
22780,
29889,
29878,
29896,
29892,
13,
18884,
22780,
29889,
29883,
29896,
2314,
13,
13,
4706,
565,
22780,
29889,
29878,
29900,
1405,
29871,
29900,
29901,
13,
9651,
2348,
1127,
10070,
29918,
26102,
29918,
18337,
22361,
1583,
3032,
3166,
29918,
12574,
29961,
18337,
29889,
29878,
29900,
29899,
29896,
3816,
18337,
29889,
29883,
29896,
29962,
13,
4706,
565,
22780,
29889,
29883,
29900,
1405,
29871,
29900,
29901,
13,
9651,
2348,
1127,
10070,
29918,
26102,
29918,
18337,
22361,
1583,
3032,
3166,
29918,
12574,
29961,
18337,
29889,
29878,
29896,
3816,
18337,
29889,
29883,
29900,
29899,
29896,
29962,
13,
4706,
565,
22780,
29889,
29878,
29900,
1405,
29871,
29900,
322,
22780,
29889,
29883,
29900,
1405,
29871,
29900,
29901,
13,
9651,
2348,
1127,
10070,
29918,
26102,
29918,
18337,
4619,
1583,
3032,
3166,
29918,
12574,
29961,
18337,
29889,
29878,
29900,
29899,
29896,
3816,
18337,
29889,
29883,
29900,
29899,
29896,
29962,
13,
13,
4706,
736,
2348,
1127,
10070,
29918,
26102,
29918,
18337,
13,
2
] |
nested_admin/tests/gfk/models.py | mionch/django-nested-admin | 0 | 74097 | from __future__ import unicode_literals
from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import ForeignKey, CASCADE
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class GFKB(models.Model):
name = models.CharField(max_length=255)
position = models.PositiveIntegerField()
content_type = ForeignKey(ContentType, on_delete=CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey()
class Meta:
ordering = ['object_id', 'position']
def __str__(self):
parts = ["%s[%d]" % (self.name, self.position)]
if self.content_object:
parts.insert(0, "%s" % self.content_object)
return "/".join(parts)
@python_2_unicode_compatible
class GFKA(models.Model):
slug = models.CharField(max_length=255)
position = models.PositiveIntegerField()
content_type = ForeignKey(ContentType, on_delete=CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey()
b_set = GenericRelation(GFKB)
class Meta:
ordering = ['object_id', 'position']
def __str__(self):
parts = ["%s[%d]" % (self.slug, self.position)]
if self.content_object:
parts.insert(0, "%s" % self.content_object)
return "/".join(parts)
@python_2_unicode_compatible
class GFKRoot(models.Model):
slug = models.CharField(max_length=255)
a_set = GenericRelation(GFKA)
def __str__(self):
return self.slug
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
9557,
29889,
21570,
29889,
3051,
8768,
29889,
9621,
1053,
3251,
293,
9662,
362,
29892,
3251,
293,
27755,
2558,
13,
3166,
9557,
29889,
21570,
29889,
3051,
8768,
29889,
9794,
1053,
10576,
1542,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
9557,
29889,
2585,
29889,
9794,
1053,
19358,
2558,
29892,
315,
3289,
5454,
2287,
13,
3166,
9557,
29889,
13239,
29889,
22331,
1053,
3017,
29918,
29906,
29918,
2523,
356,
29918,
23712,
13,
13,
13,
29992,
4691,
29918,
29906,
29918,
2523,
356,
29918,
23712,
13,
1990,
402,
29943,
26067,
29898,
9794,
29889,
3195,
1125,
13,
1678,
1024,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29897,
13,
1678,
2602,
353,
4733,
29889,
9135,
3321,
7798,
3073,
580,
13,
1678,
2793,
29918,
1853,
353,
19358,
2558,
29898,
3916,
1542,
29892,
373,
29918,
8143,
29922,
29907,
3289,
5454,
2287,
29897,
13,
1678,
1203,
29918,
333,
353,
4733,
29889,
9135,
3321,
7798,
3073,
580,
13,
1678,
2793,
29918,
3318,
353,
3251,
293,
27755,
2558,
580,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
20520,
353,
6024,
3318,
29918,
333,
742,
525,
3283,
2033,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
5633,
353,
6796,
29995,
29879,
29961,
29995,
29881,
18017,
1273,
313,
1311,
29889,
978,
29892,
1583,
29889,
3283,
4638,
13,
4706,
565,
1583,
29889,
3051,
29918,
3318,
29901,
13,
9651,
5633,
29889,
7851,
29898,
29900,
29892,
11860,
29879,
29908,
1273,
1583,
29889,
3051,
29918,
3318,
29897,
13,
4706,
736,
5591,
1642,
7122,
29898,
20895,
29897,
13,
13,
13,
29992,
4691,
29918,
29906,
29918,
2523,
356,
29918,
23712,
13,
1990,
402,
29943,
29968,
29909,
29898,
9794,
29889,
3195,
1125,
13,
1678,
2243,
688,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29897,
13,
1678,
2602,
353,
4733,
29889,
9135,
3321,
7798,
3073,
580,
13,
1678,
2793,
29918,
1853,
353,
19358,
2558,
29898,
3916,
1542,
29892,
373,
29918,
8143,
29922,
29907,
3289,
5454,
2287,
29897,
13,
1678,
1203,
29918,
333,
353,
4733,
29889,
9135,
3321,
7798,
3073,
580,
13,
1678,
2793,
29918,
3318,
353,
3251,
293,
27755,
2558,
580,
13,
1678,
289,
29918,
842,
353,
3251,
293,
9662,
362,
29898,
29954,
29943,
26067,
29897,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
20520,
353,
6024,
3318,
29918,
333,
742,
525,
3283,
2033,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
5633,
353,
6796,
29995,
29879,
29961,
29995,
29881,
18017,
1273,
313,
1311,
29889,
29517,
29892,
1583,
29889,
3283,
4638,
13,
4706,
565,
1583,
29889,
3051,
29918,
3318,
29901,
13,
9651,
5633,
29889,
7851,
29898,
29900,
29892,
11860,
29879,
29908,
1273,
1583,
29889,
3051,
29918,
3318,
29897,
13,
4706,
736,
5591,
1642,
7122,
29898,
20895,
29897,
13,
13,
13,
29992,
4691,
29918,
29906,
29918,
2523,
356,
29918,
23712,
13,
1990,
402,
29943,
29968,
10303,
29898,
9794,
29889,
3195,
1125,
13,
1678,
2243,
688,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29906,
29945,
29945,
29897,
13,
1678,
263,
29918,
842,
353,
3251,
293,
9662,
362,
29898,
29954,
29943,
29968,
29909,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
29517,
13,
2
] |
src/spectrabuster/Spectrum/spectrum.py | eduardosprp/spectrabuster | 0 | 146853 | import numpy as np
from time import sleep
from math import exp
import matplotlib.pyplot as plt
from scipy.integrate import trapz
from os import path
import struct
import spectrabuster.functions as sbf
from importlib import import_module
from datetime import date, datetime
from functools import partial
class Spectrum(object):
"""
Class variables. Mainly default values that are used whenever their
instance counterparts are not specified when initializing a Spectrum
object.
"""
# {{{
to_save = {
"int_time",
"correct_nl",
"correct_dc",
"UV_index",
"capture_date",
"capture_time",
"temp",
} # fields that will be written to the file
samples = 1 # how many samples to average
optimize = True # whether or not to call optimize_int_time when sensor saturation is detected
UV_index = None
# }}}
def __init__(self, int_time=None, **kwargs):
# {{{
"""
Initializes the Spectrum with the values specified by kwargs. Absence
of a key results in the attribute taking a default value.
"""
# First of all, define a backend
backend = kwargs["backend"] if "backend" in kwargs else None
try:
self.backend = sbf.get_backend(backend)
except RuntimeError:
self._warn("No backend specified. Using none by default.")
self.backend = sbf.get_backend("none")
# Then get the device
if "device" in kwargs:
self.device = self.backend.Device(kwargs["device"])
else:
self.device = self.backend.first_available_device()
# Some features of the device
if self.backend.features["int_time_limits"]:
self.int_time_limits = self.device.int_time_limits
else:
self.int_time_limits = None
if self.backend.features["sat_intensity"]:
self.sat_intensity = self.device.sat_intensity
else:
self.sat_intensity = None
# Bunch of optional parameters
self.from_index = kwargs["from_index"] if "from_index" in kwargs else None
self.to_index = kwargs["to_index"] if "to_index" in kwargs else None
self.correct_nl = kwargs["correct_nl"] if "correct_nl" in kwargs else False
self.correct_dc = kwargs["correct_dc"] if "correct_dc" in kwargs else False
self.samples = kwargs["samples"] if "samples" in kwargs else None
self.int_time = int_time
# Then the wavelengths and the intensities. It'll get each from the
# device unless provided at the instantiation.
if "wavelengths" in kwargs:
self.wavel = np.array(kwargs["wavelengths"])
elif self.backend.features["measure"]:
self.wavel = self.device.wavelengths()
else:
raise RuntimeError(
f"No wavelengths array passed, and the {self.backend} cannot make measurements."
)
if "intensities" in kwargs:
self.inten = np.array(kwargs["intensities"])
elif self.backend.features["measure"]:
self.inten = self.measure_inten(int_time=self.int_time)
else:
raise RuntimeError(
f"No intensities array passed, and the {self.backend} cannot make masurements."
)
# Finally, slice the intensities and wavelengths arrays.
self.wavel, self.inten, self.slice = self.slice_array(
self.wavel, self.inten, (self.from_index, self.to_index)
)
# }}}
def measure_inten(self, int_time=None, samples=None, **kwargs):
# {{{
samples = samples if samples is not None else self.samples
int_time = int_time if int_time is not None else self.int_time
correct_dc = kwargs["correct_dc"] if "correct_dc" in kwargs else self.correct_dc
correct_nl = kwargs["correct_nl"] if "correct_nl" in kwargs else self.correct_nl
if samples is None:
samples = 1
elif type(samples) is not int or samples < 0:
raise ValueError(
f"Invalid value of {self.samples} for the number of samples to average."
)
if int_time is None:
pass
else:
try:
self.device.set_int_time(float(int_time))
except (TypeError, ValueError) as e:
raise ValueError(
f"Invalid type or value of {int_time} for integration time"
)
measure = partial(
self.device.measure, correct_dc=correct_dc, correct_nl=correct_nl
)
inten_avg = np.average([measure() for i in range(samples)], axis=0)
return inten_avg
# }}}
def write_to_file(self, file_path=None, save_fields=True, **kwargs):
# {{{
"""
Stores spectrum in a .dat text file, using a format that is easy to parse
in gnu octave, R or any other programming language, or visualize in gnuplot,
or any spreadsheet program.
"""
overwrite = kwargs["overwrite"] if "overwrite" in kwargs else None
if path.exists(file_path):
if overwrite:
self._warn(f"WARNING: File {file_path} exists. Overwriting it.")
else:
raise RuntimeError(
f"File {file_path} already exists. Pass 'overwrite=True' if you are sure you want to overwrite it."
)
only_wavelengths = (
kwargs["only_wavelengths"] if "only_wavelengths" in kwargs else False
)
only_intensities = (
kwargs["only_intensities"] if "only_intensities" in kwargs else False
)
to_save = self.to_save # fields that will be written to the file
if not file_path or not isinstance(file_path, str):
raise ValueError(
"Please pass a string as the file path wherein to save the spectrum."
)
with open(file_path, "w+") as arq:
gen_comments = (
f"# {name} = {value}\n"
for name, value in vars(self).items()
if name in to_save
)
arq.writelines(gen_comments)
if only_wavelengths:
gen_wavel_inten = (f"{wavel}\n" for wavel in self.wavel)
elif only_intensities:
gen_wavel_inten = (f"{inten}\n" for inten in self.inten)
else:
gen_wavel_inten = (
f"{wavel}\t{inten}\n" for wavel, inten in zip(*self.spectrum)
)
arq.writelines(gen_wavel_inten)
# }}}
def to_spectral_irrad(self, calibration_file=None, int_time=None):
# {{{
"""
Applies the spectral irradiance calibration and returns another
Spectrum object for the irradiance spectrum.
It also has to be a file with the wavelengths and spectral sensitivity,
by the way. And note that this function assumes that the current
Spectrum and the calibration file have the same wavelengths array,
maybe just sliced differently
"""
if not calibration_file:
raise RuntimeError(
"Please pass the path to the calibration file as an argument."
)
if not int_time and not self.int_time:
raise ValueError(
"No integration time argument passed, and this spectrum's int_time field is empty."
)
elif not int_time and self.int_time:
int_time = self.int_time
calib_wavel, calib_inten, _ = self._read_file(calibration_file)
if self.wavel.size > calib_wavel.size:
from_index = self.find_wavel_index(self.wavel, calib_wavel[0])
to_index = self.find_wavel_index(self.wavel, calib_wavel[-1])
wavel_array = self.wavel[from_index : to_index + 1]
inten_array = self.inten[from_index : to_index + 1]
elif calib_wavel.size > self.wavel.size:
from_index = self.find_wavel_index(calib_wavel, self.wavel[0])
to_index = self.find_wavel_index(calib_wavel, self.wavel[-1])
calib_inten = calib_inten[from_index : to_index + 1]
wavel_array = calib_wavel[from_index : to_index + 1]
inten_array = self.inten
else:
inten_array = self.inten
wavel_array = self.wavel
apply_calibration = lambda counts, calib: counts / (int_time * calib * 0.000001)
inten_array = apply_calibration(inten_array, calib_inten)
return Spectrum(
intensities=inten_array,
wavelengths=wavel_array,
int_time=int_time,
from_index=self.from_index,
to_index=self.to_index,
)
self_params = vars(self).copy()
self_params.update({"intensities": inten_array, "wavelengths": wavel_array})
return Spectrum(**self_params)
# }}}
def to_count_rate(self):
# {{{
"""
Divides the spectrum by its integration time and that's it.
"""
if self.int_time:
return self / (self.int_time * 0.000001)
else:
raise ValueError(
"Integration time undefined for calculation of count rate."
)
# }}}
def calc_uv_index(self, from_wavel=286.0):
# {{{
"""
Calculates the UV index based on Mckinley-Diffey's action spectra for erythema.
"""
weighted_irrad = np.array(
[
self.weight_irrad(wavel, irrad, from_wavel)
for wavel, irrad in zip(*self.spectrum)
]
)
self.UV_index = round(0.04 * trapz(weighted_irrad, self.wavel), 2)
return self.UV_index # just for convenience
# }}}
def optimize_int_time(self, initial=None, limits=(0.8, 1), max_tries=5):
# {{{
"""
Attemps to find an integration time that maximizes signal to noise
ratio while avoiding sensor saturation.
This could probably be done more elegantly with recursion, but I
haven't got time to think about that. Also BEWARE that this will
overwrite the current spectrum.
"""
if initial is None:
initial = self.int_time
min_int_time, max_int_time = self.device.int_time_limits
max_counts = self.device.sat_intensity
target_counts = abs((limits[1] + limits[0]) / 2) * max_counts
int_time = initial
self.int_time = int_time
print("Optimizing integration time...")
i = 0
while i < max_tries or inten_max == max_counts:
self.inten = self.measure_inten(
correct_nl=False, correct_dc=False, samples=1
)
inten_max = np.amax(self.inten)
ratio = inten_max / target_counts
print(f"{i} {self.int_time} {ratio} {inten_max}")
if limits[0] <= ratio <= limits[1]:
break
elif limits[1] <= ratio <= 1:
int_time *= ratio ** 2
elif ratio > 1:
int_time /= ratio ** 2
else:
int_time /= ratio
while int_time < min_int_time or int_time > max_int_time:
int_time /= 2
self.int_time = int_time
i += 1
self.inten = self.measure_inten()[self.slice]
return int_time # just for convenience
# }}}
def join(self, other):
# {{{
"""
Joins two spectra. It will give preference to itself when resolving
overlaps. Probably one of the first functions to get a rewrite.
"""
if not isinstance(other, Spectrum):
raise TypeError("join takes only spectra as arguments")
self_wavel_max = self.wavel[-1]
self_wavel_min = self.wavel[0]
other_wavel_max = other.wavel[-1]
other_wavel_min = other.wavel[0]
# other.wavel starts before self.wavel ends
if np.isclose(other.wavel, self_wavel_max).any():
# NOTE: These variables are indexes referring to self.wavelengths and
# other.wavelengths respectively!
start_overlap = np.argmax(np.isclose(self.wavel, other_wavel_min))
end_overlap = np.argmax(np.isclose(other.wavel, self_wavel_max))
Spectrum._warn(
f"WARNING: The spectra overlap from {other_wavel_min} to {self_wavel_max}"
)
# For some god forsaken reason np.concatenate will only work if you pass
# a tuple of arrays...
new_wavels = np.copy(self.wavel)
new_wavels = np.concatenate(
(new_wavels, np.copy(other.wavel[end_overlap + 1 :]))
)
new_intens = np.copy(self.inten)
new_intens = np.concatenate(
(new_intens, np.copy(other.inten[end_overlap + 1 :]))
)
# self.wavelengths starts before other.wavelengths ends
elif np.isclose(self.wavel, other_wavel_max).any():
# NOTE: These variables are indexes referring to other.wavel and
# self.wavel respectively!
start_overlap = np.argmax(np.isclose(other.wavel, self_wavel_min))
end_overlap = np.argmax(np.isclose(self.wavel, other_wavel_max))
Spectrum._warn(
f"WARNING: The spectra overlap from {self_wavel_min} to {other_wavel_max}"
)
# You see, the preference is always given to self
new_wavels = np.copy(other.wavel[:start_overlap])
new_wavels = np.concatenate((new_wavels, np.copy(self.wavel)))
new_intens = np.copy(other.inten[:start_overlap])
new_intens = np.concatenate((new_intens, np.copy(self.inten)))
# There is no overlap
else:
if other_wavel_min > self_wavel_min:
new_wavels = np.concatenate(
(np.copy(self.wavel), np.copy(other.wavel))
)
new_intens = np.concatenate(
(np.copy(self.inten), np.copy(other.inten))
)
elif other_wavel_min < self_wavel_min:
new_wavels = np.concatenate(
(np.copy(other.wavel), np.copy(self.wavel))
)
new_intens = np.concatenate(
(np.copy(other.inten), np.copy(self.inten))
)
self_params = vars(self).copy()
self_params.update(
{
"intensities": new_intens,
"wavelengths": new_wavels,
"from_index": None,
"to_index": None,
"backend": "none",
}
)
return Spectrum(**self_params)
# }}}
# Esse um é para que o animal lembre de consertar quando saporra
# inevitavelmente der erro
@property
def max_counts(self):
return np.amax(self.inten)
@property
def uv(self):
# {{{
# Lmao...
if self.UV_index:
return self.UV_index
else:
return self.calc_uv_index()
# }}}
@property
def spectrum(self):
return self.wavel, self.inten
@property
def wavelengths(self):
return self.wavel
@property
def intensities(self):
return self.inten
@classmethod
def from_file(cls, inten_wavel_file=None, **kwargs):
# {{{
"""
Creates a spectrum instance with the wavelengths and/or intensities
read from a text file. Additionally, it looks for key-word arguments at
the first few lines of the file. If the same kwargs are passed to this
function, they take precedence.
When retrieving a Spectrum from a file, it will always be assigned the
backend 'none'.
"""
wavel_file = kwargs["wavel_file"] if "wavel_file" in kwargs else None
inten_file = kwargs["inten_file"] if "inten_file" in kwargs else None
inten_wavel_file = (
kwargs["inten_wavel_file"]
if "inten_wavel_file" in kwargs
else inten_wavel_file
)
inten_array = None
wavel_array = None
new_kwargs = {}
if inten_wavel_file:
wavel_array, inten_array, new_kwargs = cls._read_file(inten_wavel_file)
if wavel_file:
wavel_array, _, new_kwargs = cls._read_file(wavel_file)
if inten_file:
inten_array, _, new_kwargs = cls._read_file(inten_file)
if not inten_file and not inten_wavel_file and not wavel_file:
cls._warn(
"WARNING: Instantiating a spectrum with function from_file, but no file path arguments were passed."
)
new_kwargs["intensities"] = inten_array
new_kwargs["wavelengths"] = wavel_array
# The backend 'none' will always be used when loading a
# Spectrum from a file
new_kwargs["backend"] = "none"
new_kwargs.update(kwargs)
return cls(**new_kwargs)
# }}}
@staticmethod
def _read_file(text_file):
# {{{
"""
Used internally by the class method from_file. Returns as many numpy arrays
as there are columns in the file, and a dictionary with whatever comments
(prefaced by #) it finds.
"""
dict_args = {}
col1 = []
col2 = []
with open(text_file, "r") as arq:
# Generator for the lines in the archive
gen_lines = (line.split() for line in arq)
for line_split in gen_lines:
if (
line_split[0] == "#"
): # comment, presumably containing arguments for __init__
dict_args[line_split[1]] = line_split[3]
elif (
len(line_split) > 1
): # 2 or more columns. Will ignore anything after the second column
col1.append(float(line_split[0]))
col2.append(float(line_split[1]))
elif len(line_split) == 1: # 1 column
col1.append(float(line_split[0]))
if not dict_args and not col1 and not col2:
# Check if they're all empty
raise RuntimeError(
f"No arguments, wavelengths and intensities found in {text_file}. Please check if this is a valid file."
)
return np.array(col1), np.array(col2), dict_args
# }}}
@staticmethod
def weight_irrad(wavel, irrad, from_wavel=286.0):
# {{{
"""
Simple implementation of Mckinley-Diffey's action spectrum.
"""
if from_wavel <= wavel < 298:
return irrad
elif 298 <= wavel < 328:
return exp(0.216 * (298 - wavel)) * irrad
elif 328 <= wavel < 400:
return exp(0.034 * (139 - wavel)) * irrad
else:
return 0
# }}}
@staticmethod
def find_wavel_index(wavel_array, wavel, margin=0.5):
# {{{
"""
Attempts to find 'wavel' in 'wavel_array'. Will try using the closest wavelength
at most 0.5 units from 'wavel'
"""
array_diffs = np.abs(wavel_array - wavel)
closest_index = array_diffs.argmin()
if np.isclose(wavel_array[closest_index], wavel):
return closest_index
elif array_diffs[closest_index] < 0.5:
Spectrum._warn(
f"Exact match for {wavel} not found. Using {wavel_array[closest_index]} instead."
)
return closest_index
else:
raise ValueError(
f"A close enough {wavel} wasn't found. Closest value is {wavel_array[closest_index]}."
)
# }}}
@staticmethod
def slice_array(wavel, inten, indices, **kwargs):
# {{{
"""
Takes in two arrays and returns them sliced according to
indices=(from_index, to_index).
If the indeces are integers, it takes them to be literal indeces for the
array. If they are floats, then it'll assume they are wavelengths whose
literal indeces must be found before slicing.
This behaviour can be overriden by passing literal_indices=True or False
"""
literal = kwargs["literal"] if "literal" in kwargs else None
len_array = len(wavel)
if len(inten) != len_array:
raise ValueError("The arrays must be of equal length.")
new_indices = []
for index in indices:
if index is None:
new_indices.append(index)
elif type(index) is int or literal is True:
if not (0 <= abs(index) <= len_array):
raise IndexError(
f"Invalid index of {index} for array of size {len_array}."
)
else:
new_indices.append(index)
elif type(index) in (float, np.float64) or literal is False:
index_wavel = Spectrum.find_wavel_index(wavel, index)
new_indices.append(index_wavel)
array_slice = slice(new_indices[0], new_indices[1])
return wavel[array_slice], inten[array_slice], array_slice
# }}}
@staticmethod
def _warn(string):
# {{{
"""
Warnings can be disabled by setting the class variable 'opt_warnings' to False
"""
print(string)
# }}}
# Magic methods start here
def __iter__(self):
return zip(*self.spectrum)
def __add__(self, other):
# {{{
"""
Adds the first spectrum's intensities with the second's. It can add spectrums
with numpy arrays and lists as well, as long as they are the same length as the
spectrum's wavelengths array.
This operation will always return another spectrum with the added intensities.
"""
if isinstance(other, Spectrum):
if np.isclose(self.wavel, other.wavel).all():
new_inten = self.inten + other.inten
else:
raise ValueError(
"The divided spectrums must have the same wavelengths array."
)
elif isinstance(other, (np.ndarray, list)):
if len(other) == self.wavel.size or len(other) == 1:
new_inten = self.inten + other
else:
raise (
ValueError(
"The other operand must have the same size as the spectrum's wavelengths array, or size 1."
)
)
elif isinstance(other, (float, int)):
new_inten = self.inten + other
else:
raise (TypeError("Incompatible types for addition."))
self_params = vars(self).copy()
self_params.update(
{
"intensities": new_inten,
"wavelengths": self.wavel,
"from_index": None,
"to_index": None,
"backend": "none",
}
)
return Spectrum(**self_params)
# }}}
def __radd__(self, other):
return self + other
def __sub__(self, other):
# {{{
if isinstance(other, Spectrum):
if np.isclose(self.wavel, other.wavel).all():
return self + np.negative(other.intensities)
else:
raise ValueError(
"The subtracted spectrums must have the same wavelengths array."
)
else:
return self + np.negative(other)
# }}}
def __rsub__(self, other):
raise NotImplementedError
def __mul__(self, other):
# {{{
"""
Multiplies the first spectrum's intensities by the second. It can
multiply spectrums with numpy arrays and lists as well, as long as they
are the same length as the spectrum's wavelengths array.
This operation will always return another spectrum with the multiplied intensities.
"""
if isinstance(other, Spectrum):
if np.isclose(self.wavel, other.wavel).all():
new_inten = self.inten * other.inten
else:
raise ValueError(
"The divided spectrums must have the same wavelengths array."
)
elif isinstance(other, (np.ndarray, list)):
if len(other) == self.wavel.size or len(other) == 1:
new_inten = self.inten * other
else:
raise (
ValueError(
"The other operand must have the same size as the spectrum's wavelengths array, or size 1."
)
)
elif isinstance(other, (float, int)):
new_inten = self.inten * other
else:
raise (TypeError("Incompatible types for multiplication."))
self_params = vars(self).copy()
self_params.update(
{
"intensities": new_inten,
"wavelengths": self.wavel,
"from_index": None,
"to_index": None,
"backend": "none",
}
)
return Spectrum(**self_params)
# }}}
def __rmul__(self, other):
return self * other
def __truediv__(self, other):
# {{{
"""
Divides the first spectrum's intensities by the second. I makes no checks whether
division by zero is being requested, that I leave to numpy.
This operation will always return another spectrum with the divided intensities.
The new spectrum's fields will be inherited from the first operand.
"""
if isinstance(other, Spectrum):
if np.isclose(self.wavel, other.wavel).all():
new_inten = self.inten / other.inten
else:
raise ValueError(
"The divided spectrums must have the same wavelengths array."
)
elif isinstance(other, (np.ndarray, list)):
if len(other) == self.wavel.size or len(other) == 1:
new_inten = self.inten / other
else:
raise (
ValueError(
"The other operand must have the same size as the spectrum's wavelengths array, or size 1."
)
)
elif isinstance(other, (float, int)):
new_inten = self.inten / other
else:
raise (TypeError("Incompatible types for division."))
self_params = vars(self).copy()
self_params.update(
{
"intensities": new_inten,
"wavelengths": self.wavel,
"from_index": None,
"to_index": None,
"backend": "none",
}
)
return Spectrum(**self_params)
# }}}
def __rdiv__(self, other):
raise NotImplementedError
def __getitem__(self, key):
# {{{
"""
Takes the key to be a proper index if it is an integer, and as a wavelength
if it is float. It also accepts numpy slices and regular slices, of course.
"""
if isinstance(key, (int, list, np.ndarray)):
return self.inten[key]
elif isinstance(key, float):
int_index = self.find_wavel_index(self.wavel, key)
return self.inten[int_index]
else:
raise TypeError(
"Invalid type for index. Please enter an integer, list, numpy array or a float."
)
# }}}
def __setitem__(self, key, val):
# {{{
"""
Changes the intensity with index 'key' to 'val'. The new value must be a number,
a tuple, list or numpy array. In the latter 3 cases, numpy will handle the assignment.
"""
if isinstance(key, (list, tuple, np.ndarray)):
# Melhorar isto. Adicionar gerenciamento de exceções
key = [
self.find_wavel_index(self.wavel, x)
if isinstance(x, float)
else x
for x in key
]
elif isinstance(key, float):
key = self.find_wavel_index(self.wavel, key)
elif isinstance(key, int):
if abs(key) > self.wavel.size:
raise IndexError(
f"Invalid index of {val} for wavelengths array of size {self.wavel.size}"
)
else:
raise TypeError(
"Invalid type for index. Please enter an integer, list, numpy array or a float."
)
if isinstance(val, (tuple, list, np.ndarray)):
try:
val = [float(x) for x in val]
except (TypeError, ValueError) as exception:
raise ValueError(f"The {type(val)} {val} must contain only numbers.")
else:
try:
val = float(val)
except:
raise ValueError(
f"Invalid value of {val} for intensity. Please enter something convertible to float."
)
self.inten[key] = val
# }}}
def __contains__(self, value):
raise NotImplementedError
def __repr__(self):
return "Spectrum({}, {})".format(self.wavel, self.inten)
def __len__(self):
return self.wavel.size
| [
1,
1053,
12655,
408,
7442,
13,
3166,
931,
1053,
8709,
13,
3166,
5844,
1053,
1518,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
3166,
4560,
2272,
29889,
14146,
403,
1053,
26505,
29920,
13,
3166,
2897,
1053,
2224,
13,
5215,
2281,
13,
5215,
6683,
4201,
5402,
29889,
12171,
408,
269,
1635,
13,
3166,
1053,
1982,
1053,
1053,
29918,
5453,
13,
3166,
12865,
1053,
2635,
29892,
12865,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
13,
13,
1990,
27738,
5848,
29898,
3318,
1125,
13,
13,
1678,
9995,
13,
1678,
4134,
3651,
29889,
4241,
368,
2322,
1819,
393,
526,
1304,
10940,
1009,
13,
1678,
2777,
6795,
20895,
526,
451,
6790,
746,
2847,
5281,
263,
27738,
5848,
13,
1678,
1203,
29889,
13,
1678,
9995,
13,
13,
1678,
396,
426,
6224,
13,
1678,
304,
29918,
7620,
353,
426,
13,
4706,
376,
524,
29918,
2230,
613,
13,
4706,
376,
15728,
29918,
12938,
613,
13,
4706,
376,
15728,
29918,
13891,
613,
13,
4706,
376,
29965,
29963,
29918,
2248,
613,
13,
4706,
376,
17885,
545,
29918,
1256,
613,
13,
4706,
376,
17885,
545,
29918,
2230,
613,
13,
4706,
376,
7382,
613,
13,
1678,
500,
29871,
396,
4235,
393,
674,
367,
3971,
304,
278,
934,
13,
1678,
11916,
353,
29871,
29896,
29871,
396,
920,
1784,
11916,
304,
6588,
13,
1678,
24656,
353,
5852,
29871,
396,
3692,
470,
451,
304,
1246,
24656,
29918,
524,
29918,
2230,
746,
23530,
269,
1337,
362,
338,
17809,
13,
1678,
501,
29963,
29918,
2248,
353,
6213,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
938,
29918,
2230,
29922,
8516,
29892,
3579,
19290,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
17250,
7093,
278,
27738,
5848,
411,
278,
1819,
6790,
491,
9049,
5085,
29889,
24650,
663,
13,
4706,
310,
263,
1820,
2582,
297,
278,
5352,
5622,
263,
2322,
995,
29889,
13,
4706,
9995,
13,
13,
4706,
396,
3824,
310,
599,
29892,
4529,
263,
14998,
13,
4706,
14998,
353,
9049,
5085,
3366,
27852,
3108,
565,
376,
27852,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
27852,
353,
269,
1635,
29889,
657,
29918,
27852,
29898,
27852,
29897,
13,
4706,
5174,
24875,
2392,
29901,
13,
9651,
1583,
3032,
25442,
703,
3782,
14998,
6790,
29889,
5293,
5642,
491,
2322,
23157,
13,
9651,
1583,
29889,
27852,
353,
269,
1635,
29889,
657,
29918,
27852,
703,
9290,
1159,
13,
13,
4706,
396,
1987,
679,
278,
4742,
13,
4706,
565,
376,
10141,
29908,
297,
9049,
5085,
29901,
13,
9651,
1583,
29889,
10141,
353,
1583,
29889,
27852,
29889,
11501,
29898,
19290,
3366,
10141,
20068,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
10141,
353,
1583,
29889,
27852,
29889,
4102,
29918,
16515,
29918,
10141,
580,
13,
13,
4706,
396,
3834,
5680,
310,
278,
4742,
13,
4706,
565,
1583,
29889,
27852,
29889,
22100,
3366,
524,
29918,
2230,
29918,
12514,
3108,
29901,
13,
9651,
1583,
29889,
524,
29918,
2230,
29918,
12514,
353,
1583,
29889,
10141,
29889,
524,
29918,
2230,
29918,
12514,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
524,
29918,
2230,
29918,
12514,
353,
6213,
13,
4706,
565,
1583,
29889,
27852,
29889,
22100,
3366,
29879,
271,
29918,
524,
575,
537,
3108,
29901,
13,
9651,
1583,
29889,
29879,
271,
29918,
524,
575,
537,
353,
1583,
29889,
10141,
29889,
29879,
271,
29918,
524,
575,
537,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
29879,
271,
29918,
524,
575,
537,
353,
6213,
13,
13,
4706,
396,
350,
3322,
310,
13136,
4128,
13,
4706,
1583,
29889,
3166,
29918,
2248,
353,
9049,
5085,
3366,
3166,
29918,
2248,
3108,
565,
376,
3166,
29918,
2248,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
1583,
29889,
517,
29918,
2248,
353,
9049,
5085,
3366,
517,
29918,
2248,
3108,
565,
376,
517,
29918,
2248,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
1583,
29889,
15728,
29918,
12938,
353,
9049,
5085,
3366,
15728,
29918,
12938,
3108,
565,
376,
15728,
29918,
12938,
29908,
297,
9049,
5085,
1683,
7700,
13,
4706,
1583,
29889,
15728,
29918,
13891,
353,
9049,
5085,
3366,
15728,
29918,
13891,
3108,
565,
376,
15728,
29918,
13891,
29908,
297,
9049,
5085,
1683,
7700,
13,
4706,
1583,
29889,
27736,
353,
9049,
5085,
3366,
27736,
3108,
565,
376,
27736,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
1583,
29889,
524,
29918,
2230,
353,
938,
29918,
2230,
13,
13,
4706,
396,
1987,
278,
281,
6447,
1477,
29879,
322,
278,
12838,
1907,
29889,
739,
29915,
645,
679,
1269,
515,
278,
13,
4706,
396,
4742,
6521,
4944,
472,
278,
13213,
362,
29889,
13,
4706,
565,
376,
29893,
6447,
1477,
29879,
29908,
297,
9049,
5085,
29901,
13,
9651,
1583,
29889,
29893,
6447,
353,
7442,
29889,
2378,
29898,
19290,
3366,
29893,
6447,
1477,
29879,
20068,
13,
4706,
25342,
1583,
29889,
27852,
29889,
22100,
3366,
26658,
3108,
29901,
13,
9651,
1583,
29889,
29893,
6447,
353,
1583,
29889,
10141,
29889,
29893,
6447,
1477,
29879,
580,
13,
4706,
1683,
29901,
13,
9651,
12020,
24875,
2392,
29898,
13,
18884,
285,
29908,
3782,
281,
6447,
1477,
29879,
1409,
4502,
29892,
322,
278,
426,
1311,
29889,
27852,
29913,
2609,
1207,
20398,
1213,
13,
9651,
1723,
13,
13,
4706,
565,
376,
524,
575,
1907,
29908,
297,
9049,
5085,
29901,
13,
9651,
1583,
29889,
524,
264,
353,
7442,
29889,
2378,
29898,
19290,
3366,
524,
575,
1907,
20068,
13,
4706,
25342,
1583,
29889,
27852,
29889,
22100,
3366,
26658,
3108,
29901,
13,
9651,
1583,
29889,
524,
264,
353,
1583,
29889,
26658,
29918,
524,
264,
29898,
524,
29918,
2230,
29922,
1311,
29889,
524,
29918,
2230,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
24875,
2392,
29898,
13,
18884,
285,
29908,
3782,
12838,
1907,
1409,
4502,
29892,
322,
278,
426,
1311,
29889,
27852,
29913,
2609,
1207,
286,
3745,
1860,
1213,
13,
9651,
1723,
13,
13,
4706,
396,
9788,
29892,
22780,
278,
12838,
1907,
322,
281,
6447,
1477,
29879,
7049,
29889,
13,
4706,
1583,
29889,
29893,
6447,
29892,
1583,
29889,
524,
264,
29892,
1583,
29889,
18337,
353,
1583,
29889,
18337,
29918,
2378,
29898,
13,
9651,
1583,
29889,
29893,
6447,
29892,
1583,
29889,
524,
264,
29892,
313,
1311,
29889,
3166,
29918,
2248,
29892,
1583,
29889,
517,
29918,
2248,
29897,
13,
4706,
1723,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
5645,
29918,
524,
264,
29898,
1311,
29892,
938,
29918,
2230,
29922,
8516,
29892,
11916,
29922,
8516,
29892,
3579,
19290,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
11916,
353,
11916,
565,
11916,
338,
451,
6213,
1683,
1583,
29889,
27736,
13,
4706,
938,
29918,
2230,
353,
938,
29918,
2230,
565,
938,
29918,
2230,
338,
451,
6213,
1683,
1583,
29889,
524,
29918,
2230,
13,
4706,
1959,
29918,
13891,
353,
9049,
5085,
3366,
15728,
29918,
13891,
3108,
565,
376,
15728,
29918,
13891,
29908,
297,
9049,
5085,
1683,
1583,
29889,
15728,
29918,
13891,
13,
4706,
1959,
29918,
12938,
353,
9049,
5085,
3366,
15728,
29918,
12938,
3108,
565,
376,
15728,
29918,
12938,
29908,
297,
9049,
5085,
1683,
1583,
29889,
15728,
29918,
12938,
13,
13,
4706,
565,
11916,
338,
6213,
29901,
13,
9651,
11916,
353,
29871,
29896,
13,
4706,
25342,
1134,
29898,
27736,
29897,
338,
451,
938,
470,
11916,
529,
29871,
29900,
29901,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
285,
29908,
13919,
995,
310,
426,
1311,
29889,
27736,
29913,
363,
278,
1353,
310,
11916,
304,
6588,
1213,
13,
9651,
1723,
13,
13,
4706,
565,
938,
29918,
2230,
338,
6213,
29901,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
1018,
29901,
13,
18884,
1583,
29889,
10141,
29889,
842,
29918,
524,
29918,
2230,
29898,
7411,
29898,
524,
29918,
2230,
876,
13,
9651,
5174,
313,
1542,
2392,
29892,
7865,
2392,
29897,
408,
321,
29901,
13,
18884,
12020,
7865,
2392,
29898,
13,
462,
1678,
285,
29908,
13919,
1134,
470,
995,
310,
426,
524,
29918,
2230,
29913,
363,
13465,
931,
29908,
13,
18884,
1723,
13,
13,
4706,
5645,
353,
7687,
29898,
13,
9651,
1583,
29889,
10141,
29889,
26658,
29892,
1959,
29918,
13891,
29922,
15728,
29918,
13891,
29892,
1959,
29918,
12938,
29922,
15728,
29918,
12938,
13,
4706,
1723,
13,
4706,
17818,
29918,
485,
29887,
353,
7442,
29889,
12483,
482,
4197,
26658,
580,
363,
474,
297,
3464,
29898,
27736,
29897,
1402,
9685,
29922,
29900,
29897,
13,
13,
4706,
736,
17818,
29918,
485,
29887,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
2436,
29918,
517,
29918,
1445,
29898,
1311,
29892,
934,
29918,
2084,
29922,
8516,
29892,
4078,
29918,
9621,
29922,
5574,
29892,
3579,
19290,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
624,
2361,
18272,
297,
263,
869,
4130,
1426,
934,
29892,
773,
263,
3402,
393,
338,
4780,
304,
6088,
13,
4706,
297,
330,
3433,
4725,
1351,
29892,
390,
470,
738,
916,
8720,
4086,
29892,
470,
7604,
675,
297,
330,
3433,
5317,
29892,
13,
4706,
470,
738,
9677,
9855,
1824,
29889,
13,
4706,
9995,
13,
13,
4706,
26556,
353,
9049,
5085,
3366,
957,
3539,
3108,
565,
376,
957,
3539,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
565,
2224,
29889,
9933,
29898,
1445,
29918,
2084,
1125,
13,
9651,
565,
26556,
29901,
13,
18884,
1583,
3032,
25442,
29898,
29888,
29908,
29956,
25614,
29901,
3497,
426,
1445,
29918,
2084,
29913,
4864,
29889,
6811,
16554,
372,
23157,
13,
9651,
1683,
29901,
13,
18884,
12020,
24875,
2392,
29898,
13,
462,
1678,
285,
29908,
2283,
426,
1445,
29918,
2084,
29913,
2307,
4864,
29889,
6978,
525,
957,
3539,
29922,
5574,
29915,
565,
366,
526,
1854,
366,
864,
304,
26556,
372,
1213,
13,
18884,
1723,
13,
13,
4706,
871,
29918,
29893,
6447,
1477,
29879,
353,
313,
13,
9651,
9049,
5085,
3366,
6194,
29918,
29893,
6447,
1477,
29879,
3108,
565,
376,
6194,
29918,
29893,
6447,
1477,
29879,
29908,
297,
9049,
5085,
1683,
7700,
13,
4706,
1723,
13,
4706,
871,
29918,
524,
575,
1907,
353,
313,
13,
9651,
9049,
5085,
3366,
6194,
29918,
524,
575,
1907,
3108,
565,
376,
6194,
29918,
524,
575,
1907,
29908,
297,
9049,
5085,
1683,
7700,
13,
4706,
1723,
13,
13,
4706,
304,
29918,
7620,
353,
1583,
29889,
517,
29918,
7620,
29871,
396,
4235,
393,
674,
367,
3971,
304,
278,
934,
13,
13,
4706,
565,
451,
934,
29918,
2084,
470,
451,
338,
8758,
29898,
1445,
29918,
2084,
29892,
851,
1125,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
376,
12148,
1209,
263,
1347,
408,
278,
934,
2224,
988,
262,
304,
4078,
278,
18272,
1213,
13,
9651,
1723,
13,
13,
4706,
411,
1722,
29898,
1445,
29918,
2084,
29892,
376,
29893,
29974,
1159,
408,
564,
29939,
29901,
13,
9651,
2531,
29918,
21032,
353,
313,
13,
18884,
285,
29908,
29937,
426,
978,
29913,
353,
426,
1767,
1012,
29876,
29908,
13,
18884,
363,
1024,
29892,
995,
297,
24987,
29898,
1311,
467,
7076,
580,
13,
18884,
565,
1024,
297,
304,
29918,
7620,
13,
9651,
1723,
13,
9651,
564,
29939,
29889,
8231,
24210,
29898,
1885,
29918,
21032,
29897,
13,
13,
9651,
565,
871,
29918,
29893,
6447,
1477,
29879,
29901,
13,
18884,
2531,
29918,
29893,
6447,
29918,
524,
264,
353,
313,
29888,
29908,
29912,
29893,
6447,
1012,
29876,
29908,
363,
281,
6447,
297,
1583,
29889,
29893,
6447,
29897,
13,
9651,
25342,
871,
29918,
524,
575,
1907,
29901,
13,
18884,
2531,
29918,
29893,
6447,
29918,
524,
264,
353,
313,
29888,
29908,
29912,
524,
264,
1012,
29876,
29908,
363,
17818,
297,
1583,
29889,
524,
264,
29897,
13,
9651,
1683,
29901,
13,
18884,
2531,
29918,
29893,
6447,
29918,
524,
264,
353,
313,
13,
462,
1678,
285,
29908,
29912,
29893,
6447,
1012,
29873,
29912,
524,
264,
1012,
29876,
29908,
363,
281,
6447,
29892,
17818,
297,
14319,
10456,
1311,
29889,
21494,
5848,
29897,
13,
18884,
1723,
13,
13,
9651,
564,
29939,
29889,
8231,
24210,
29898,
1885,
29918,
29893,
6447,
29918,
524,
264,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
304,
29918,
21494,
1705,
29918,
381,
3665,
29898,
1311,
29892,
1208,
26218,
29918,
1445,
29922,
8516,
29892,
938,
29918,
2230,
29922,
8516,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
2401,
3687,
278,
23161,
3805,
3665,
8837,
1208,
26218,
322,
3639,
1790,
13,
4706,
27738,
5848,
1203,
363,
278,
3805,
3665,
8837,
18272,
29889,
13,
13,
4706,
739,
884,
756,
304,
367,
263,
934,
411,
278,
281,
6447,
1477,
29879,
322,
23161,
4771,
24858,
29892,
13,
4706,
491,
278,
982,
29889,
1126,
4443,
393,
445,
740,
15894,
393,
278,
1857,
13,
4706,
27738,
5848,
322,
278,
1208,
26218,
934,
505,
278,
1021,
281,
6447,
1477,
29879,
1409,
29892,
13,
4706,
5505,
925,
269,
506,
287,
17587,
13,
4706,
9995,
13,
13,
4706,
565,
451,
1208,
26218,
29918,
1445,
29901,
13,
9651,
12020,
24875,
2392,
29898,
13,
18884,
376,
12148,
1209,
278,
2224,
304,
278,
1208,
26218,
934,
408,
385,
2980,
1213,
13,
9651,
1723,
13,
13,
4706,
565,
451,
938,
29918,
2230,
322,
451,
1583,
29889,
524,
29918,
2230,
29901,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
376,
3782,
13465,
931,
2980,
4502,
29892,
322,
445,
18272,
29915,
29879,
938,
29918,
2230,
1746,
338,
4069,
1213,
13,
9651,
1723,
13,
4706,
25342,
451,
938,
29918,
2230,
322,
1583,
29889,
524,
29918,
2230,
29901,
13,
9651,
938,
29918,
2230,
353,
1583,
29889,
524,
29918,
2230,
13,
13,
4706,
1208,
747,
29918,
29893,
6447,
29892,
1208,
747,
29918,
524,
264,
29892,
903,
353,
1583,
3032,
949,
29918,
1445,
29898,
1052,
26218,
29918,
1445,
29897,
13,
13,
4706,
565,
1583,
29889,
29893,
6447,
29889,
2311,
1405,
1208,
747,
29918,
29893,
6447,
29889,
2311,
29901,
13,
9651,
515,
29918,
2248,
353,
1583,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
1311,
29889,
29893,
6447,
29892,
1208,
747,
29918,
29893,
6447,
29961,
29900,
2314,
13,
9651,
304,
29918,
2248,
353,
1583,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
1311,
29889,
29893,
6447,
29892,
1208,
747,
29918,
29893,
6447,
14352,
29896,
2314,
13,
13,
9651,
281,
6447,
29918,
2378,
353,
1583,
29889,
29893,
6447,
29961,
3166,
29918,
2248,
584,
304,
29918,
2248,
718,
29871,
29896,
29962,
13,
9651,
17818,
29918,
2378,
353,
1583,
29889,
524,
264,
29961,
3166,
29918,
2248,
584,
304,
29918,
2248,
718,
29871,
29896,
29962,
13,
13,
4706,
25342,
1208,
747,
29918,
29893,
6447,
29889,
2311,
1405,
1583,
29889,
29893,
6447,
29889,
2311,
29901,
13,
9651,
515,
29918,
2248,
353,
1583,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
1052,
747,
29918,
29893,
6447,
29892,
1583,
29889,
29893,
6447,
29961,
29900,
2314,
13,
9651,
304,
29918,
2248,
353,
1583,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
1052,
747,
29918,
29893,
6447,
29892,
1583,
29889,
29893,
6447,
14352,
29896,
2314,
13,
13,
9651,
1208,
747,
29918,
524,
264,
353,
1208,
747,
29918,
524,
264,
29961,
3166,
29918,
2248,
584,
304,
29918,
2248,
718,
29871,
29896,
29962,
13,
9651,
281,
6447,
29918,
2378,
353,
1208,
747,
29918,
29893,
6447,
29961,
3166,
29918,
2248,
584,
304,
29918,
2248,
718,
29871,
29896,
29962,
13,
9651,
17818,
29918,
2378,
353,
1583,
29889,
524,
264,
13,
13,
4706,
1683,
29901,
13,
9651,
17818,
29918,
2378,
353,
1583,
29889,
524,
264,
13,
9651,
281,
6447,
29918,
2378,
353,
1583,
29889,
29893,
6447,
13,
13,
4706,
3394,
29918,
1052,
26218,
353,
14013,
18139,
29892,
1208,
747,
29901,
18139,
847,
313,
524,
29918,
2230,
334,
1208,
747,
334,
29871,
29900,
29889,
29900,
29900,
29900,
29900,
29900,
29896,
29897,
13,
13,
4706,
17818,
29918,
2378,
353,
3394,
29918,
1052,
26218,
29898,
524,
264,
29918,
2378,
29892,
1208,
747,
29918,
524,
264,
29897,
13,
4706,
736,
27738,
5848,
29898,
13,
9651,
12838,
1907,
29922,
524,
264,
29918,
2378,
29892,
13,
9651,
281,
6447,
1477,
29879,
29922,
29893,
6447,
29918,
2378,
29892,
13,
9651,
938,
29918,
2230,
29922,
524,
29918,
2230,
29892,
13,
9651,
515,
29918,
2248,
29922,
1311,
29889,
3166,
29918,
2248,
29892,
13,
9651,
304,
29918,
2248,
29922,
1311,
29889,
517,
29918,
2248,
29892,
13,
4706,
1723,
13,
13,
4706,
1583,
29918,
7529,
353,
24987,
29898,
1311,
467,
8552,
580,
13,
4706,
1583,
29918,
7529,
29889,
5504,
3319,
29908,
524,
575,
1907,
1115,
17818,
29918,
2378,
29892,
376,
29893,
6447,
1477,
29879,
1115,
281,
6447,
29918,
2378,
1800,
13,
13,
4706,
736,
27738,
5848,
29898,
1068,
1311,
29918,
7529,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
304,
29918,
2798,
29918,
10492,
29898,
1311,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
4910,
2247,
278,
18272,
491,
967,
13465,
931,
322,
393,
29915,
29879,
372,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
1583,
29889,
524,
29918,
2230,
29901,
13,
9651,
736,
1583,
847,
313,
1311,
29889,
524,
29918,
2230,
334,
29871,
29900,
29889,
29900,
29900,
29900,
29900,
29900,
29896,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
376,
23573,
362,
931,
7580,
363,
13944,
310,
2302,
6554,
1213,
13,
9651,
1723,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
22235,
29918,
4090,
29918,
2248,
29898,
1311,
29892,
515,
29918,
29893,
6447,
29922,
29906,
29947,
29953,
29889,
29900,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
20535,
1078,
278,
501,
29963,
2380,
2729,
373,
341,
384,
262,
2330,
29899,
26023,
1032,
29915,
29879,
3158,
6683,
336,
363,
604,
1541,
2603,
29889,
13,
4706,
9995,
13,
13,
4706,
7688,
287,
29918,
381,
3665,
353,
7442,
29889,
2378,
29898,
13,
9651,
518,
13,
18884,
1583,
29889,
7915,
29918,
381,
3665,
29898,
29893,
6447,
29892,
3805,
3665,
29892,
515,
29918,
29893,
6447,
29897,
13,
18884,
363,
281,
6447,
29892,
3805,
3665,
297,
14319,
10456,
1311,
29889,
21494,
5848,
29897,
13,
9651,
4514,
13,
4706,
1723,
13,
4706,
1583,
29889,
29965,
29963,
29918,
2248,
353,
4513,
29898,
29900,
29889,
29900,
29946,
334,
26505,
29920,
29898,
7915,
287,
29918,
381,
3665,
29892,
1583,
29889,
29893,
6447,
511,
29871,
29906,
29897,
13,
13,
4706,
736,
1583,
29889,
29965,
29963,
29918,
2248,
29871,
396,
925,
363,
29703,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
24656,
29918,
524,
29918,
2230,
29898,
1311,
29892,
2847,
29922,
8516,
29892,
13071,
7607,
29900,
29889,
29947,
29892,
29871,
29896,
511,
4236,
29918,
29873,
2722,
29922,
29945,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
6212,
331,
567,
304,
1284,
385,
13465,
931,
393,
5256,
7093,
7182,
304,
11462,
13,
4706,
11959,
1550,
4772,
292,
23530,
269,
1337,
362,
29889,
13,
13,
4706,
910,
1033,
3117,
367,
2309,
901,
10618,
10835,
411,
20437,
29892,
541,
306,
13,
4706,
7359,
29915,
29873,
2355,
931,
304,
1348,
1048,
393,
29889,
3115,
20700,
12982,
1525,
393,
445,
674,
13,
4706,
26556,
278,
1857,
18272,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
2847,
338,
6213,
29901,
13,
9651,
2847,
353,
1583,
29889,
524,
29918,
2230,
13,
13,
4706,
1375,
29918,
524,
29918,
2230,
29892,
4236,
29918,
524,
29918,
2230,
353,
1583,
29889,
10141,
29889,
524,
29918,
2230,
29918,
12514,
13,
13,
4706,
4236,
29918,
2798,
29879,
353,
1583,
29889,
10141,
29889,
29879,
271,
29918,
524,
575,
537,
13,
4706,
3646,
29918,
2798,
29879,
353,
6425,
3552,
12514,
29961,
29896,
29962,
718,
13071,
29961,
29900,
2314,
847,
29871,
29906,
29897,
334,
4236,
29918,
2798,
29879,
13,
13,
4706,
938,
29918,
2230,
353,
2847,
13,
4706,
1583,
29889,
524,
29918,
2230,
353,
938,
29918,
2230,
13,
13,
4706,
1596,
703,
20624,
326,
5281,
13465,
931,
856,
1159,
13,
4706,
474,
353,
29871,
29900,
13,
4706,
1550,
474,
529,
4236,
29918,
29873,
2722,
470,
17818,
29918,
3317,
1275,
4236,
29918,
2798,
29879,
29901,
13,
9651,
1583,
29889,
524,
264,
353,
1583,
29889,
26658,
29918,
524,
264,
29898,
13,
18884,
1959,
29918,
12938,
29922,
8824,
29892,
1959,
29918,
13891,
29922,
8824,
29892,
11916,
29922,
29896,
13,
9651,
1723,
13,
9651,
17818,
29918,
3317,
353,
7442,
29889,
314,
1165,
29898,
1311,
29889,
524,
264,
29897,
13,
9651,
11959,
353,
17818,
29918,
3317,
847,
3646,
29918,
2798,
29879,
13,
9651,
1596,
29898,
29888,
29908,
29912,
29875,
29913,
426,
1311,
29889,
524,
29918,
2230,
29913,
426,
3605,
601,
29913,
426,
524,
264,
29918,
3317,
27195,
13,
13,
9651,
565,
13071,
29961,
29900,
29962,
5277,
11959,
5277,
13071,
29961,
29896,
5387,
13,
18884,
2867,
13,
9651,
25342,
13071,
29961,
29896,
29962,
5277,
11959,
5277,
29871,
29896,
29901,
13,
18884,
938,
29918,
2230,
334,
29922,
11959,
3579,
29871,
29906,
13,
9651,
25342,
11959,
1405,
29871,
29896,
29901,
13,
18884,
938,
29918,
2230,
847,
29922,
11959,
3579,
29871,
29906,
13,
9651,
1683,
29901,
13,
18884,
938,
29918,
2230,
847,
29922,
11959,
13,
13,
9651,
1550,
938,
29918,
2230,
529,
1375,
29918,
524,
29918,
2230,
470,
938,
29918,
2230,
1405,
4236,
29918,
524,
29918,
2230,
29901,
13,
18884,
938,
29918,
2230,
847,
29922,
29871,
29906,
13,
13,
9651,
1583,
29889,
524,
29918,
2230,
353,
938,
29918,
2230,
13,
13,
9651,
474,
4619,
29871,
29896,
13,
13,
4706,
1583,
29889,
524,
264,
353,
1583,
29889,
26658,
29918,
524,
264,
580,
29961,
1311,
29889,
18337,
29962,
13,
13,
4706,
736,
938,
29918,
2230,
29871,
396,
925,
363,
29703,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
5988,
29898,
1311,
29892,
916,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
3650,
1144,
1023,
6683,
336,
29889,
739,
674,
2367,
24583,
304,
3528,
746,
3770,
1747,
13,
4706,
975,
14128,
29889,
21606,
697,
310,
278,
937,
3168,
304,
679,
263,
10683,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
451,
338,
8758,
29898,
1228,
29892,
27738,
5848,
1125,
13,
9651,
12020,
20948,
703,
7122,
4893,
871,
6683,
336,
408,
6273,
1159,
13,
13,
4706,
1583,
29918,
29893,
6447,
29918,
3317,
353,
1583,
29889,
29893,
6447,
14352,
29896,
29962,
13,
4706,
1583,
29918,
29893,
6447,
29918,
1195,
353,
1583,
29889,
29893,
6447,
29961,
29900,
29962,
13,
4706,
916,
29918,
29893,
6447,
29918,
3317,
353,
916,
29889,
29893,
6447,
14352,
29896,
29962,
13,
4706,
916,
29918,
29893,
6447,
29918,
1195,
353,
916,
29889,
29893,
6447,
29961,
29900,
29962,
13,
13,
4706,
396,
916,
29889,
29893,
6447,
8665,
1434,
1583,
29889,
29893,
6447,
10614,
13,
4706,
565,
7442,
29889,
275,
5358,
29898,
1228,
29889,
29893,
6447,
29892,
1583,
29918,
29893,
6447,
29918,
3317,
467,
1384,
7295,
13,
13,
9651,
396,
6058,
29923,
29901,
4525,
3651,
526,
18111,
16811,
304,
1583,
29889,
29893,
6447,
1477,
29879,
322,
13,
9651,
396,
916,
29889,
29893,
6447,
1477,
29879,
8307,
29991,
13,
9651,
1369,
29918,
957,
6984,
353,
7442,
29889,
1191,
3317,
29898,
9302,
29889,
275,
5358,
29898,
1311,
29889,
29893,
6447,
29892,
916,
29918,
29893,
6447,
29918,
1195,
876,
13,
9651,
1095,
29918,
957,
6984,
353,
7442,
29889,
1191,
3317,
29898,
9302,
29889,
275,
5358,
29898,
1228,
29889,
29893,
6447,
29892,
1583,
29918,
29893,
6447,
29918,
3317,
876,
13,
13,
9651,
27738,
5848,
3032,
25442,
29898,
13,
18884,
285,
29908,
29956,
25614,
29901,
450,
6683,
336,
25457,
515,
426,
1228,
29918,
29893,
6447,
29918,
1195,
29913,
304,
426,
1311,
29918,
29893,
6447,
29918,
3317,
5038,
13,
9651,
1723,
13,
13,
9651,
396,
1152,
777,
7339,
363,
29879,
9424,
2769,
7442,
29889,
535,
29883,
2579,
403,
674,
871,
664,
565,
366,
1209,
13,
9651,
396,
263,
18761,
310,
7049,
856,
13,
9651,
716,
29918,
29893,
485,
1379,
353,
7442,
29889,
8552,
29898,
1311,
29889,
29893,
6447,
29897,
13,
9651,
716,
29918,
29893,
485,
1379,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
13,
18884,
313,
1482,
29918,
29893,
485,
1379,
29892,
7442,
29889,
8552,
29898,
1228,
29889,
29893,
6447,
29961,
355,
29918,
957,
6984,
718,
29871,
29896,
584,
12622,
13,
9651,
1723,
13,
13,
9651,
716,
29918,
524,
575,
353,
7442,
29889,
8552,
29898,
1311,
29889,
524,
264,
29897,
13,
9651,
716,
29918,
524,
575,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
13,
18884,
313,
1482,
29918,
524,
575,
29892,
7442,
29889,
8552,
29898,
1228,
29889,
524,
264,
29961,
355,
29918,
957,
6984,
718,
29871,
29896,
584,
12622,
13,
9651,
1723,
13,
13,
4706,
396,
1583,
29889,
29893,
6447,
1477,
29879,
8665,
1434,
916,
29889,
29893,
6447,
1477,
29879,
10614,
13,
4706,
25342,
7442,
29889,
275,
5358,
29898,
1311,
29889,
29893,
6447,
29892,
916,
29918,
29893,
6447,
29918,
3317,
467,
1384,
7295,
13,
13,
9651,
396,
6058,
29923,
29901,
4525,
3651,
526,
18111,
16811,
304,
916,
29889,
29893,
6447,
322,
13,
9651,
396,
1583,
29889,
29893,
6447,
8307,
29991,
13,
9651,
1369,
29918,
957,
6984,
353,
7442,
29889,
1191,
3317,
29898,
9302,
29889,
275,
5358,
29898,
1228,
29889,
29893,
6447,
29892,
1583,
29918,
29893,
6447,
29918,
1195,
876,
13,
9651,
1095,
29918,
957,
6984,
353,
7442,
29889,
1191,
3317,
29898,
9302,
29889,
275,
5358,
29898,
1311,
29889,
29893,
6447,
29892,
916,
29918,
29893,
6447,
29918,
3317,
876,
13,
13,
9651,
27738,
5848,
3032,
25442,
29898,
13,
18884,
285,
29908,
29956,
25614,
29901,
450,
6683,
336,
25457,
515,
426,
1311,
29918,
29893,
6447,
29918,
1195,
29913,
304,
426,
1228,
29918,
29893,
6447,
29918,
3317,
5038,
13,
9651,
1723,
13,
13,
9651,
396,
887,
1074,
29892,
278,
24583,
338,
2337,
2183,
304,
1583,
13,
9651,
716,
29918,
29893,
485,
1379,
353,
7442,
29889,
8552,
29898,
1228,
29889,
29893,
6447,
7503,
2962,
29918,
957,
6984,
2314,
13,
9651,
716,
29918,
29893,
485,
1379,
353,
7442,
29889,
535,
29883,
2579,
403,
3552,
1482,
29918,
29893,
485,
1379,
29892,
7442,
29889,
8552,
29898,
1311,
29889,
29893,
6447,
4961,
13,
13,
9651,
716,
29918,
524,
575,
353,
7442,
29889,
8552,
29898,
1228,
29889,
524,
264,
7503,
2962,
29918,
957,
6984,
2314,
13,
9651,
716,
29918,
524,
575,
353,
7442,
29889,
535,
29883,
2579,
403,
3552,
1482,
29918,
524,
575,
29892,
7442,
29889,
8552,
29898,
1311,
29889,
524,
264,
4961,
13,
13,
4706,
396,
1670,
338,
694,
25457,
13,
4706,
1683,
29901,
13,
13,
9651,
565,
916,
29918,
29893,
6447,
29918,
1195,
1405,
1583,
29918,
29893,
6447,
29918,
1195,
29901,
13,
13,
18884,
716,
29918,
29893,
485,
1379,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
13,
462,
1678,
313,
9302,
29889,
8552,
29898,
1311,
29889,
29893,
6447,
511,
7442,
29889,
8552,
29898,
1228,
29889,
29893,
6447,
876,
13,
18884,
1723,
13,
13,
18884,
716,
29918,
524,
575,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
13,
462,
1678,
313,
9302,
29889,
8552,
29898,
1311,
29889,
524,
264,
511,
7442,
29889,
8552,
29898,
1228,
29889,
524,
264,
876,
13,
18884,
1723,
13,
13,
9651,
25342,
916,
29918,
29893,
6447,
29918,
1195,
529,
1583,
29918,
29893,
6447,
29918,
1195,
29901,
13,
13,
18884,
716,
29918,
29893,
485,
1379,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
13,
462,
1678,
313,
9302,
29889,
8552,
29898,
1228,
29889,
29893,
6447,
511,
7442,
29889,
8552,
29898,
1311,
29889,
29893,
6447,
876,
13,
18884,
1723,
13,
13,
18884,
716,
29918,
524,
575,
353,
7442,
29889,
535,
29883,
2579,
403,
29898,
13,
462,
1678,
313,
9302,
29889,
8552,
29898,
1228,
29889,
524,
264,
511,
7442,
29889,
8552,
29898,
1311,
29889,
524,
264,
876,
13,
18884,
1723,
13,
13,
4706,
1583,
29918,
7529,
353,
24987,
29898,
1311,
467,
8552,
580,
13,
4706,
1583,
29918,
7529,
29889,
5504,
29898,
13,
9651,
426,
13,
18884,
376,
524,
575,
1907,
1115,
716,
29918,
524,
575,
29892,
13,
18884,
376,
29893,
6447,
1477,
29879,
1115,
716,
29918,
29893,
485,
1379,
29892,
13,
18884,
376,
3166,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
517,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
27852,
1115,
376,
9290,
613,
13,
9651,
500,
13,
4706,
1723,
13,
13,
4706,
736,
27738,
5848,
29898,
1068,
1311,
29918,
7529,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
396,
3423,
344,
1922,
904,
1702,
712,
288,
13019,
9336,
1030,
316,
378,
1940,
279,
9836,
21672,
272,
336,
13,
1678,
396,
297,
5750,
277,
6447,
2689,
589,
604,
307,
13,
1678,
732,
6799,
13,
1678,
822,
4236,
29918,
2798,
29879,
29898,
1311,
1125,
13,
4706,
736,
7442,
29889,
314,
1165,
29898,
1311,
29889,
524,
264,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
318,
29894,
29898,
1311,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
396,
365,
655,
29877,
856,
13,
4706,
565,
1583,
29889,
29965,
29963,
29918,
2248,
29901,
13,
9651,
736,
1583,
29889,
29965,
29963,
29918,
2248,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
28667,
29918,
4090,
29918,
2248,
580,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
732,
6799,
13,
1678,
822,
18272,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29893,
6447,
29892,
1583,
29889,
524,
264,
13,
13,
1678,
732,
6799,
13,
1678,
822,
281,
6447,
1477,
29879,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
29893,
6447,
13,
13,
1678,
732,
6799,
13,
1678,
822,
12838,
1907,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
524,
264,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
1445,
29898,
25932,
29892,
17818,
29918,
29893,
6447,
29918,
1445,
29922,
8516,
29892,
3579,
19290,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
6760,
1078,
263,
18272,
2777,
411,
278,
281,
6447,
1477,
29879,
322,
29914,
272,
12838,
1907,
13,
4706,
1303,
515,
263,
1426,
934,
29889,
19814,
29892,
372,
3430,
363,
1820,
29899,
1742,
6273,
472,
13,
4706,
278,
937,
2846,
3454,
310,
278,
934,
29889,
960,
278,
1021,
9049,
5085,
526,
4502,
304,
445,
13,
4706,
740,
29892,
896,
2125,
9399,
663,
29889,
13,
13,
4706,
1932,
5663,
15387,
263,
27738,
5848,
515,
263,
934,
29892,
372,
674,
2337,
367,
9859,
278,
13,
4706,
14998,
525,
9290,
4286,
13,
4706,
9995,
13,
13,
4706,
281,
6447,
29918,
1445,
353,
9049,
5085,
3366,
29893,
6447,
29918,
1445,
3108,
565,
376,
29893,
6447,
29918,
1445,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
17818,
29918,
1445,
353,
9049,
5085,
3366,
524,
264,
29918,
1445,
3108,
565,
376,
524,
264,
29918,
1445,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
17818,
29918,
29893,
6447,
29918,
1445,
353,
313,
13,
9651,
9049,
5085,
3366,
524,
264,
29918,
29893,
6447,
29918,
1445,
3108,
13,
9651,
565,
376,
524,
264,
29918,
29893,
6447,
29918,
1445,
29908,
297,
9049,
5085,
13,
9651,
1683,
17818,
29918,
29893,
6447,
29918,
1445,
13,
4706,
1723,
13,
4706,
17818,
29918,
2378,
353,
6213,
13,
4706,
281,
6447,
29918,
2378,
353,
6213,
13,
4706,
716,
29918,
19290,
353,
6571,
13,
13,
4706,
565,
17818,
29918,
29893,
6447,
29918,
1445,
29901,
13,
9651,
281,
6447,
29918,
2378,
29892,
17818,
29918,
2378,
29892,
716,
29918,
19290,
353,
1067,
29879,
3032,
949,
29918,
1445,
29898,
524,
264,
29918,
29893,
6447,
29918,
1445,
29897,
13,
13,
4706,
565,
281,
6447,
29918,
1445,
29901,
13,
9651,
281,
6447,
29918,
2378,
29892,
17117,
716,
29918,
19290,
353,
1067,
29879,
3032,
949,
29918,
1445,
29898,
29893,
6447,
29918,
1445,
29897,
13,
13,
4706,
565,
17818,
29918,
1445,
29901,
13,
9651,
17818,
29918,
2378,
29892,
17117,
716,
29918,
19290,
353,
1067,
29879,
3032,
949,
29918,
1445,
29898,
524,
264,
29918,
1445,
29897,
13,
13,
4706,
565,
451,
17818,
29918,
1445,
322,
451,
17818,
29918,
29893,
6447,
29918,
1445,
322,
451,
281,
6447,
29918,
1445,
29901,
13,
9651,
1067,
29879,
3032,
25442,
29898,
13,
18884,
376,
29956,
25614,
29901,
2799,
3656,
1218,
263,
18272,
411,
740,
515,
29918,
1445,
29892,
541,
694,
934,
2224,
6273,
892,
4502,
1213,
13,
9651,
1723,
13,
13,
4706,
716,
29918,
19290,
3366,
524,
575,
1907,
3108,
353,
17818,
29918,
2378,
13,
4706,
716,
29918,
19290,
3366,
29893,
6447,
1477,
29879,
3108,
353,
281,
6447,
29918,
2378,
13,
4706,
396,
450,
14998,
525,
9290,
29915,
674,
2337,
367,
1304,
746,
8363,
263,
13,
4706,
396,
27738,
5848,
515,
263,
934,
13,
4706,
716,
29918,
19290,
3366,
27852,
3108,
353,
376,
9290,
29908,
13,
4706,
716,
29918,
19290,
29889,
5504,
29898,
19290,
29897,
13,
13,
4706,
736,
1067,
29879,
29898,
1068,
1482,
29918,
19290,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
949,
29918,
1445,
29898,
726,
29918,
1445,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
501,
8485,
25106,
491,
278,
770,
1158,
515,
29918,
1445,
29889,
16969,
408,
1784,
12655,
7049,
13,
4706,
408,
727,
526,
4341,
297,
278,
934,
29892,
322,
263,
8600,
411,
6514,
6589,
13,
4706,
313,
29886,
999,
562,
287,
491,
396,
29897,
372,
14061,
29889,
13,
4706,
9995,
13,
13,
4706,
9657,
29918,
5085,
353,
6571,
13,
4706,
784,
29896,
353,
5159,
13,
4706,
784,
29906,
353,
5159,
13,
13,
4706,
411,
1722,
29898,
726,
29918,
1445,
29892,
376,
29878,
1159,
408,
564,
29939,
29901,
13,
13,
9651,
396,
3251,
1061,
363,
278,
3454,
297,
278,
18871,
13,
9651,
2531,
29918,
9012,
353,
313,
1220,
29889,
5451,
580,
363,
1196,
297,
564,
29939,
29897,
13,
13,
9651,
363,
1196,
29918,
5451,
297,
2531,
29918,
9012,
29901,
13,
13,
18884,
565,
313,
13,
462,
1678,
1196,
29918,
5451,
29961,
29900,
29962,
1275,
12305,
29908,
13,
462,
1125,
29871,
396,
3440,
29892,
2225,
24873,
6943,
6273,
363,
4770,
2344,
1649,
13,
462,
1678,
9657,
29918,
5085,
29961,
1220,
29918,
5451,
29961,
29896,
5262,
353,
1196,
29918,
5451,
29961,
29941,
29962,
13,
18884,
25342,
313,
13,
462,
1678,
7431,
29898,
1220,
29918,
5451,
29897,
1405,
29871,
29896,
13,
462,
1125,
29871,
396,
29871,
29906,
470,
901,
4341,
29889,
2811,
11455,
3099,
1156,
278,
1473,
1897,
13,
462,
1678,
784,
29896,
29889,
4397,
29898,
7411,
29898,
1220,
29918,
5451,
29961,
29900,
12622,
13,
462,
1678,
784,
29906,
29889,
4397,
29898,
7411,
29898,
1220,
29918,
5451,
29961,
29896,
12622,
13,
18884,
25342,
7431,
29898,
1220,
29918,
5451,
29897,
1275,
29871,
29896,
29901,
29871,
396,
29871,
29896,
1897,
13,
462,
1678,
784,
29896,
29889,
4397,
29898,
7411,
29898,
1220,
29918,
5451,
29961,
29900,
12622,
13,
13,
9651,
565,
451,
9657,
29918,
5085,
322,
451,
784,
29896,
322,
451,
784,
29906,
29901,
13,
18884,
396,
5399,
565,
896,
29915,
276,
599,
4069,
13,
13,
18884,
12020,
24875,
2392,
29898,
13,
462,
1678,
285,
29908,
3782,
6273,
29892,
281,
6447,
1477,
29879,
322,
12838,
1907,
1476,
297,
426,
726,
29918,
1445,
1836,
3529,
1423,
565,
445,
338,
263,
2854,
934,
1213,
13,
18884,
1723,
13,
13,
9651,
736,
7442,
29889,
2378,
29898,
1054,
29896,
511,
7442,
29889,
2378,
29898,
1054,
29906,
511,
9657,
29918,
5085,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
7688,
29918,
381,
3665,
29898,
29893,
6447,
29892,
3805,
3665,
29892,
515,
29918,
29893,
6447,
29922,
29906,
29947,
29953,
29889,
29900,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
12545,
5314,
310,
341,
384,
262,
2330,
29899,
26023,
1032,
29915,
29879,
3158,
18272,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
515,
29918,
29893,
6447,
5277,
281,
6447,
529,
29871,
29906,
29929,
29947,
29901,
13,
9651,
736,
3805,
3665,
13,
4706,
25342,
29871,
29906,
29929,
29947,
5277,
281,
6447,
529,
29871,
29941,
29906,
29947,
29901,
13,
9651,
736,
1518,
29898,
29900,
29889,
29906,
29896,
29953,
334,
313,
29906,
29929,
29947,
448,
281,
6447,
876,
334,
3805,
3665,
13,
4706,
25342,
29871,
29941,
29906,
29947,
5277,
281,
6447,
529,
29871,
29946,
29900,
29900,
29901,
13,
9651,
736,
1518,
29898,
29900,
29889,
29900,
29941,
29946,
334,
313,
29896,
29941,
29929,
448,
281,
6447,
876,
334,
3805,
3665,
13,
4706,
1683,
29901,
13,
9651,
736,
29871,
29900,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1284,
29918,
29893,
6447,
29918,
2248,
29898,
29893,
6447,
29918,
2378,
29892,
281,
6447,
29892,
5906,
29922,
29900,
29889,
29945,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
6212,
3456,
29879,
304,
1284,
525,
29893,
6447,
29915,
297,
525,
29893,
6447,
29918,
2378,
4286,
2811,
1018,
773,
278,
21438,
281,
6447,
1477,
13,
4706,
472,
1556,
29871,
29900,
29889,
29945,
10340,
515,
525,
29893,
6447,
29915,
13,
4706,
9995,
13,
13,
4706,
1409,
29918,
12765,
29879,
353,
7442,
29889,
6897,
29898,
29893,
6447,
29918,
2378,
448,
281,
6447,
29897,
13,
4706,
21438,
29918,
2248,
353,
1409,
29918,
12765,
29879,
29889,
1191,
1195,
580,
13,
13,
4706,
565,
7442,
29889,
275,
5358,
29898,
29893,
6447,
29918,
2378,
29961,
11291,
342,
29918,
2248,
1402,
281,
6447,
1125,
13,
9651,
736,
21438,
29918,
2248,
13,
13,
4706,
25342,
1409,
29918,
12765,
29879,
29961,
11291,
342,
29918,
2248,
29962,
529,
29871,
29900,
29889,
29945,
29901,
13,
9651,
27738,
5848,
3032,
25442,
29898,
13,
18884,
285,
29908,
1252,
627,
1993,
363,
426,
29893,
6447,
29913,
451,
1476,
29889,
5293,
426,
29893,
6447,
29918,
2378,
29961,
11291,
342,
29918,
2248,
12258,
2012,
1213,
13,
9651,
1723,
13,
9651,
736,
21438,
29918,
2248,
13,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
285,
29908,
29909,
3802,
3307,
426,
29893,
6447,
29913,
9007,
29915,
29873,
1476,
29889,
2233,
359,
342,
995,
338,
426,
29893,
6447,
29918,
2378,
29961,
11291,
342,
29918,
2248,
12258,
1213,
13,
9651,
1723,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
22780,
29918,
2378,
29898,
29893,
6447,
29892,
17818,
29892,
16285,
29892,
3579,
19290,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
323,
6926,
297,
1023,
7049,
322,
3639,
963,
269,
506,
287,
5034,
304,
13,
4706,
16285,
7607,
3166,
29918,
2248,
29892,
304,
29918,
2248,
467,
13,
13,
4706,
960,
278,
5704,
778,
526,
11920,
29892,
372,
4893,
963,
304,
367,
16333,
5704,
778,
363,
278,
13,
4706,
1409,
29889,
960,
896,
526,
5685,
1446,
29892,
769,
372,
29915,
645,
5251,
896,
526,
281,
6447,
1477,
29879,
5069,
13,
4706,
16333,
5704,
778,
1818,
367,
1476,
1434,
269,
506,
292,
29889,
13,
13,
4706,
910,
10468,
508,
367,
20831,
264,
491,
6819,
16333,
29918,
513,
1575,
29922,
5574,
470,
7700,
13,
4706,
9995,
13,
13,
4706,
16333,
353,
9049,
5085,
3366,
20889,
284,
3108,
565,
376,
20889,
284,
29908,
297,
9049,
5085,
1683,
6213,
13,
4706,
7431,
29918,
2378,
353,
7431,
29898,
29893,
6447,
29897,
13,
13,
4706,
565,
7431,
29898,
524,
264,
29897,
2804,
7431,
29918,
2378,
29901,
13,
9651,
12020,
7865,
2392,
703,
1576,
7049,
1818,
367,
310,
5186,
3309,
23157,
13,
13,
4706,
716,
29918,
513,
1575,
353,
5159,
13,
13,
4706,
363,
2380,
297,
16285,
29901,
13,
9651,
565,
2380,
338,
6213,
29901,
13,
18884,
716,
29918,
513,
1575,
29889,
4397,
29898,
2248,
29897,
13,
9651,
25342,
1134,
29898,
2248,
29897,
338,
938,
470,
16333,
338,
5852,
29901,
13,
18884,
565,
451,
313,
29900,
5277,
6425,
29898,
2248,
29897,
5277,
7431,
29918,
2378,
1125,
13,
462,
1678,
12020,
11374,
2392,
29898,
13,
462,
4706,
285,
29908,
13919,
2380,
310,
426,
2248,
29913,
363,
1409,
310,
2159,
426,
2435,
29918,
2378,
29913,
1213,
13,
462,
1678,
1723,
13,
18884,
1683,
29901,
13,
462,
1678,
716,
29918,
513,
1575,
29889,
4397,
29898,
2248,
29897,
13,
9651,
25342,
1134,
29898,
2248,
29897,
297,
313,
7411,
29892,
7442,
29889,
7411,
29953,
29946,
29897,
470,
16333,
338,
7700,
29901,
13,
18884,
2380,
29918,
29893,
6447,
353,
27738,
5848,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
29893,
6447,
29892,
2380,
29897,
13,
18884,
716,
29918,
513,
1575,
29889,
4397,
29898,
2248,
29918,
29893,
6447,
29897,
13,
13,
4706,
1409,
29918,
18337,
353,
22780,
29898,
1482,
29918,
513,
1575,
29961,
29900,
1402,
716,
29918,
513,
1575,
29961,
29896,
2314,
13,
4706,
736,
281,
6447,
29961,
2378,
29918,
18337,
1402,
17818,
29961,
2378,
29918,
18337,
1402,
1409,
29918,
18337,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
25442,
29898,
1807,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
399,
2753,
886,
508,
367,
12708,
491,
4444,
278,
770,
2286,
525,
3670,
29918,
25442,
886,
29915,
304,
7700,
13,
4706,
9995,
13,
13,
4706,
1596,
29898,
1807,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
396,
26494,
3519,
1369,
1244,
13,
13,
1678,
822,
4770,
1524,
12035,
1311,
1125,
13,
4706,
736,
14319,
10456,
1311,
29889,
21494,
5848,
29897,
13,
13,
1678,
822,
4770,
1202,
12035,
1311,
29892,
916,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
3462,
29879,
278,
937,
18272,
29915,
29879,
12838,
1907,
411,
278,
1473,
29915,
29879,
29889,
739,
508,
788,
18272,
29879,
13,
4706,
411,
12655,
7049,
322,
8857,
408,
1532,
29892,
408,
1472,
408,
896,
526,
278,
1021,
3309,
408,
278,
13,
4706,
18272,
29915,
29879,
281,
6447,
1477,
29879,
1409,
29889,
13,
13,
4706,
910,
5858,
674,
2337,
736,
1790,
18272,
411,
278,
2715,
12838,
1907,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
338,
8758,
29898,
1228,
29892,
27738,
5848,
1125,
13,
13,
9651,
565,
7442,
29889,
275,
5358,
29898,
1311,
29889,
29893,
6447,
29892,
916,
29889,
29893,
6447,
467,
497,
7295,
13,
18884,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
718,
916,
29889,
524,
264,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
29898,
13,
462,
1678,
376,
1576,
13931,
18272,
29879,
1818,
505,
278,
1021,
281,
6447,
1477,
29879,
1409,
1213,
13,
18884,
1723,
13,
13,
4706,
25342,
338,
8758,
29898,
1228,
29892,
313,
9302,
29889,
299,
2378,
29892,
1051,
22164,
13,
13,
9651,
565,
7431,
29898,
1228,
29897,
1275,
1583,
29889,
29893,
6447,
29889,
2311,
470,
7431,
29898,
1228,
29897,
1275,
29871,
29896,
29901,
13,
18884,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
718,
916,
13,
13,
9651,
1683,
29901,
13,
18884,
12020,
313,
13,
462,
1678,
7865,
2392,
29898,
13,
462,
4706,
376,
1576,
916,
1751,
392,
1818,
505,
278,
1021,
2159,
408,
278,
18272,
29915,
29879,
281,
6447,
1477,
29879,
1409,
29892,
470,
2159,
29871,
29896,
1213,
13,
462,
1678,
1723,
13,
18884,
1723,
13,
13,
4706,
25342,
338,
8758,
29898,
1228,
29892,
313,
7411,
29892,
938,
22164,
13,
13,
9651,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
718,
916,
13,
13,
4706,
1683,
29901,
13,
9651,
12020,
313,
1542,
2392,
703,
797,
23712,
4072,
363,
6124,
1213,
876,
13,
13,
4706,
1583,
29918,
7529,
353,
24987,
29898,
1311,
467,
8552,
580,
13,
4706,
1583,
29918,
7529,
29889,
5504,
29898,
13,
9651,
426,
13,
18884,
376,
524,
575,
1907,
1115,
716,
29918,
524,
264,
29892,
13,
18884,
376,
29893,
6447,
1477,
29879,
1115,
1583,
29889,
29893,
6447,
29892,
13,
18884,
376,
3166,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
517,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
27852,
1115,
376,
9290,
613,
13,
9651,
500,
13,
4706,
1723,
13,
13,
4706,
736,
27738,
5848,
29898,
1068,
1311,
29918,
7529,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
4770,
29878,
1202,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
718,
916,
13,
13,
1678,
822,
4770,
1491,
12035,
1311,
29892,
916,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
565,
338,
8758,
29898,
1228,
29892,
27738,
5848,
1125,
13,
9651,
565,
7442,
29889,
275,
5358,
29898,
1311,
29889,
29893,
6447,
29892,
916,
29889,
29893,
6447,
467,
497,
7295,
13,
18884,
736,
1583,
718,
7442,
29889,
22198,
29898,
1228,
29889,
524,
575,
1907,
29897,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
29898,
13,
462,
1678,
376,
1576,
23197,
287,
18272,
29879,
1818,
505,
278,
1021,
281,
6447,
1477,
29879,
1409,
1213,
13,
18884,
1723,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
718,
7442,
29889,
22198,
29898,
1228,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
4770,
29878,
1491,
12035,
1311,
29892,
916,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
4770,
16109,
12035,
1311,
29892,
916,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
9683,
666,
3687,
278,
937,
18272,
29915,
29879,
12838,
1907,
491,
278,
1473,
29889,
739,
508,
13,
4706,
22932,
18272,
29879,
411,
12655,
7049,
322,
8857,
408,
1532,
29892,
408,
1472,
408,
896,
13,
4706,
526,
278,
1021,
3309,
408,
278,
18272,
29915,
29879,
281,
6447,
1477,
29879,
1409,
29889,
13,
13,
4706,
910,
5858,
674,
2337,
736,
1790,
18272,
411,
278,
6674,
2957,
12838,
1907,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
338,
8758,
29898,
1228,
29892,
27738,
5848,
1125,
13,
13,
9651,
565,
7442,
29889,
275,
5358,
29898,
1311,
29889,
29893,
6447,
29892,
916,
29889,
29893,
6447,
467,
497,
7295,
13,
18884,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
334,
916,
29889,
524,
264,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
29898,
13,
462,
1678,
376,
1576,
13931,
18272,
29879,
1818,
505,
278,
1021,
281,
6447,
1477,
29879,
1409,
1213,
13,
18884,
1723,
13,
13,
4706,
25342,
338,
8758,
29898,
1228,
29892,
313,
9302,
29889,
299,
2378,
29892,
1051,
22164,
13,
13,
9651,
565,
7431,
29898,
1228,
29897,
1275,
1583,
29889,
29893,
6447,
29889,
2311,
470,
7431,
29898,
1228,
29897,
1275,
29871,
29896,
29901,
13,
18884,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
334,
916,
13,
13,
9651,
1683,
29901,
13,
18884,
12020,
313,
13,
462,
1678,
7865,
2392,
29898,
13,
462,
4706,
376,
1576,
916,
1751,
392,
1818,
505,
278,
1021,
2159,
408,
278,
18272,
29915,
29879,
281,
6447,
1477,
29879,
1409,
29892,
470,
2159,
29871,
29896,
1213,
13,
462,
1678,
1723,
13,
18884,
1723,
13,
13,
4706,
25342,
338,
8758,
29898,
1228,
29892,
313,
7411,
29892,
938,
22164,
13,
13,
9651,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
334,
916,
13,
13,
4706,
1683,
29901,
13,
9651,
12020,
313,
1542,
2392,
703,
797,
23712,
4072,
363,
21666,
1213,
876,
13,
13,
4706,
1583,
29918,
7529,
353,
24987,
29898,
1311,
467,
8552,
580,
13,
4706,
1583,
29918,
7529,
29889,
5504,
29898,
13,
9651,
426,
13,
18884,
376,
524,
575,
1907,
1115,
716,
29918,
524,
264,
29892,
13,
18884,
376,
29893,
6447,
1477,
29879,
1115,
1583,
29889,
29893,
6447,
29892,
13,
18884,
376,
3166,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
517,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
27852,
1115,
376,
9290,
613,
13,
9651,
500,
13,
4706,
1723,
13,
13,
4706,
736,
27738,
5848,
29898,
1068,
1311,
29918,
7529,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
4770,
1758,
352,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
334,
916,
13,
13,
1678,
822,
4770,
509,
6742,
440,
12035,
1311,
29892,
916,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
4910,
2247,
278,
937,
18272,
29915,
29879,
12838,
1907,
491,
278,
1473,
29889,
306,
3732,
694,
12747,
3692,
13,
4706,
8542,
491,
5225,
338,
1641,
13877,
29892,
393,
306,
5967,
304,
12655,
29889,
13,
13,
4706,
910,
5858,
674,
2337,
736,
1790,
18272,
411,
278,
13931,
12838,
1907,
29889,
13,
4706,
450,
716,
18272,
29915,
29879,
4235,
674,
367,
23878,
515,
278,
937,
1751,
392,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
338,
8758,
29898,
1228,
29892,
27738,
5848,
1125,
13,
13,
9651,
565,
7442,
29889,
275,
5358,
29898,
1311,
29889,
29893,
6447,
29892,
916,
29889,
29893,
6447,
467,
497,
7295,
13,
18884,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
847,
916,
29889,
524,
264,
13,
9651,
1683,
29901,
13,
18884,
12020,
7865,
2392,
29898,
13,
462,
1678,
376,
1576,
13931,
18272,
29879,
1818,
505,
278,
1021,
281,
6447,
1477,
29879,
1409,
1213,
13,
18884,
1723,
13,
13,
4706,
25342,
338,
8758,
29898,
1228,
29892,
313,
9302,
29889,
299,
2378,
29892,
1051,
22164,
13,
13,
9651,
565,
7431,
29898,
1228,
29897,
1275,
1583,
29889,
29893,
6447,
29889,
2311,
470,
7431,
29898,
1228,
29897,
1275,
29871,
29896,
29901,
13,
18884,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
847,
916,
13,
13,
9651,
1683,
29901,
13,
18884,
12020,
313,
13,
462,
1678,
7865,
2392,
29898,
13,
462,
4706,
376,
1576,
916,
1751,
392,
1818,
505,
278,
1021,
2159,
408,
278,
18272,
29915,
29879,
281,
6447,
1477,
29879,
1409,
29892,
470,
2159,
29871,
29896,
1213,
13,
462,
1678,
1723,
13,
18884,
1723,
13,
13,
4706,
25342,
338,
8758,
29898,
1228,
29892,
313,
7411,
29892,
938,
22164,
13,
13,
9651,
716,
29918,
524,
264,
353,
1583,
29889,
524,
264,
847,
916,
13,
13,
4706,
1683,
29901,
13,
9651,
12020,
313,
1542,
2392,
703,
797,
23712,
4072,
363,
8542,
1213,
876,
13,
13,
4706,
1583,
29918,
7529,
353,
24987,
29898,
1311,
467,
8552,
580,
13,
4706,
1583,
29918,
7529,
29889,
5504,
29898,
13,
9651,
426,
13,
18884,
376,
524,
575,
1907,
1115,
716,
29918,
524,
264,
29892,
13,
18884,
376,
29893,
6447,
1477,
29879,
1115,
1583,
29889,
29893,
6447,
29892,
13,
18884,
376,
3166,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
517,
29918,
2248,
1115,
6213,
29892,
13,
18884,
376,
27852,
1115,
376,
9290,
613,
13,
9651,
500,
13,
4706,
1723,
13,
13,
4706,
736,
27738,
5848,
29898,
1068,
1311,
29918,
7529,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
4770,
29878,
4563,
12035,
1311,
29892,
916,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
1820,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
323,
6926,
278,
1820,
304,
367,
263,
1571,
2380,
565,
372,
338,
385,
6043,
29892,
322,
408,
263,
281,
6447,
1477,
13,
4706,
565,
372,
338,
5785,
29889,
739,
884,
21486,
12655,
269,
29399,
322,
4943,
269,
29399,
29892,
310,
3236,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
338,
8758,
29898,
1989,
29892,
313,
524,
29892,
1051,
29892,
7442,
29889,
299,
2378,
22164,
13,
9651,
736,
1583,
29889,
524,
264,
29961,
1989,
29962,
13,
4706,
25342,
338,
8758,
29898,
1989,
29892,
5785,
1125,
13,
9651,
938,
29918,
2248,
353,
1583,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
1311,
29889,
29893,
6447,
29892,
1820,
29897,
13,
9651,
736,
1583,
29889,
524,
264,
29961,
524,
29918,
2248,
29962,
13,
4706,
1683,
29901,
13,
9651,
12020,
20948,
29898,
13,
18884,
376,
13919,
1134,
363,
2380,
29889,
3529,
3896,
385,
6043,
29892,
1051,
29892,
12655,
1409,
470,
263,
5785,
1213,
13,
9651,
1723,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
4770,
842,
667,
12035,
1311,
29892,
1820,
29892,
659,
1125,
13,
4706,
396,
426,
6224,
13,
4706,
9995,
13,
4706,
678,
6916,
278,
26171,
411,
2380,
525,
1989,
29915,
304,
525,
791,
4286,
450,
716,
995,
1818,
367,
263,
1353,
29892,
13,
4706,
263,
18761,
29892,
1051,
470,
12655,
1409,
29889,
512,
278,
7480,
29871,
29941,
4251,
29892,
12655,
674,
4386,
278,
12827,
29889,
13,
4706,
9995,
13,
13,
4706,
565,
338,
8758,
29898,
1989,
29892,
313,
1761,
29892,
18761,
29892,
7442,
29889,
299,
2378,
22164,
13,
9651,
396,
6286,
2015,
279,
338,
517,
29889,
2087,
15353,
279,
330,
4578,
455,
4487,
316,
429,
346,
5616,
13,
9651,
1820,
353,
518,
13,
18884,
1583,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
1311,
29889,
29893,
6447,
29892,
921,
29897,
13,
18884,
565,
338,
8758,
29898,
29916,
29892,
5785,
29897,
13,
18884,
1683,
921,
13,
18884,
363,
921,
297,
1820,
13,
9651,
4514,
13,
4706,
25342,
338,
8758,
29898,
1989,
29892,
5785,
1125,
13,
9651,
1820,
353,
1583,
29889,
2886,
29918,
29893,
6447,
29918,
2248,
29898,
1311,
29889,
29893,
6447,
29892,
1820,
29897,
13,
4706,
25342,
338,
8758,
29898,
1989,
29892,
938,
1125,
13,
9651,
565,
6425,
29898,
1989,
29897,
1405,
1583,
29889,
29893,
6447,
29889,
2311,
29901,
13,
18884,
12020,
11374,
2392,
29898,
13,
462,
1678,
285,
29908,
13919,
2380,
310,
426,
791,
29913,
363,
281,
6447,
1477,
29879,
1409,
310,
2159,
426,
1311,
29889,
29893,
6447,
29889,
2311,
5038,
13,
18884,
1723,
13,
4706,
1683,
29901,
13,
9651,
12020,
20948,
29898,
13,
18884,
376,
13919,
1134,
363,
2380,
29889,
3529,
3896,
385,
6043,
29892,
1051,
29892,
12655,
1409,
470,
263,
5785,
1213,
13,
9651,
1723,
13,
13,
4706,
565,
338,
8758,
29898,
791,
29892,
313,
23583,
29892,
1051,
29892,
7442,
29889,
299,
2378,
22164,
13,
9651,
1018,
29901,
13,
18884,
659,
353,
518,
7411,
29898,
29916,
29897,
363,
921,
297,
659,
29962,
13,
9651,
5174,
313,
1542,
2392,
29892,
7865,
2392,
29897,
408,
3682,
29901,
13,
18884,
12020,
7865,
2392,
29898,
29888,
29908,
1576,
426,
1853,
29898,
791,
2915,
426,
791,
29913,
1818,
1712,
871,
3694,
23157,
13,
4706,
1683,
29901,
13,
9651,
1018,
29901,
13,
18884,
659,
353,
5785,
29898,
791,
29897,
13,
9651,
5174,
29901,
13,
18884,
12020,
7865,
2392,
29898,
13,
462,
1678,
285,
29908,
13919,
995,
310,
426,
791,
29913,
363,
26171,
29889,
3529,
3896,
1554,
3588,
1821,
304,
5785,
1213,
13,
18884,
1723,
13,
13,
4706,
1583,
29889,
524,
264,
29961,
1989,
29962,
353,
659,
13,
13,
1678,
396,
500,
930,
13,
13,
1678,
822,
4770,
11516,
12035,
1311,
29892,
995,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
376,
29903,
1103,
5848,
3319,
1118,
426,
1800,
1642,
4830,
29898,
1311,
29889,
29893,
6447,
29892,
1583,
29889,
524,
264,
29897,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
29893,
6447,
29889,
2311,
13,
2
] |
bbc1/libs/bbclib_msgtype.py | imony/py-bbclib | 1 | 1601752 | <reponame>imony/py-bbclib
# -*- coding: utf-8 -*-
"""
Copyright (c) 2018 beyond-blockchain.org.
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.
"""
class MsgType:
"""Message types for between core node and client"""
REQUEST_SETUP_DOMAIN = 0
RESPONSE_SETUP_DOMAIN = 1
REQUEST_SET_STATIC_NODE = 4
RESPONSE_SET_STATIC_NODE = 5
REQUEST_GET_CONFIG = 8
RESPONSE_GET_CONFIG = 9
REQUEST_MANIP_LEDGER_SUBSYS = 10
RESPONSE_MANIP_LEDGER_SUBSYS = 11
DOMAIN_PING = 12
REQUEST_GET_DOMAINLIST = 13
RESPONSE_GET_DOMAINLIST = 14
REQUEST_INSERT_NOTIFICATION = 15
CANCEL_INSERT_NOTIFICATION = 16
REQUEST_GET_STATS = 17
RESPONSE_GET_STATS = 18
NOTIFY_DOMAIN_KEY_UPDATE = 19
REQUEST_GET_NEIGHBORLIST = 21
RESPONSE_GET_NEIGHBORLIST = 22
REQUEST_GET_USERS = 23
RESPONSE_GET_USERS = 24
REQUEST_GET_FORWARDING_LIST = 25
RESPONSE_GET_FORWARDING_LIST = 26
REQUEST_GET_NODEID = 27
RESPONSE_GET_NODEID = 28
REQUEST_GET_NOTIFICATION_LIST = 29
RESPONSE_GET_NOTIFICATION_LIST = 30
REQUEST_CLOSE_DOMAIN = 31
RESPONSE_CLOSE_DOMAIN = 32
REQUEST_ECDH_KEY_EXCHANGE = 33
RESPONSE_ECDH_KEY_EXCHANGE = 34
REGISTER = 64
UNREGISTER = 65
MESSAGE = 66
REQUEST_GATHER_SIGNATURE = 67
RESPONSE_GATHER_SIGNATURE = 68
REQUEST_SIGNATURE = 69
RESPONSE_SIGNATURE = 70
REQUEST_INSERT = 71
RESPONSE_INSERT = 72
NOTIFY_INSERTED = 73
NOTIFY_CROSS_REF = 74
REQUEST_SEARCH_TRANSACTION = 82
RESPONSE_SEARCH_TRANSACTION = 83
REQUEST_SEARCH_WITH_CONDITIONS = 86
RESPONSE_SEARCH_WITH_CONDITIONS = 87
REQUEST_TRAVERSE_TRANSACTIONS = 88
RESPONSE_TRAVERSE_TRANSACTIONS = 89
REQUEST_CROSS_REF_VERIFY = 90
RESPONSE_CROSS_REF_VERIFY = 91
REQUEST_CROSS_REF_LIST = 92
RESPONSE_CROSS_REF_LIST = 93
REQUEST_REPAIR = 94
REQUEST_COUNT_TRANSACTIONS = 95
RESPONSE_COUNT_TRANSACTIONS = 95
REQUEST_REGISTER_HASH_IN_SUBSYS = 128
RESPONSE_REGISTER_HASH_IN_SUBSYS = 129
REQUEST_VERIFY_HASH_IN_SUBSYS = 130
RESPONSE_VERIFY_HASH_IN_SUBSYS = 131
| [
1,
529,
276,
1112,
420,
29958,
326,
2592,
29914,
2272,
29899,
1327,
29883,
1982,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
11882,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29947,
8724,
29899,
1271,
14153,
29889,
990,
29889,
13,
13,
29931,
293,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
6293,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
3492,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
13,
1678,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
13,
2525,
2222,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
5721,
7541,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29956,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
13393,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
13400,
800,
1090,
278,
19245,
29889,
13,
15945,
29908,
13,
13,
13,
1990,
28264,
1542,
29901,
13,
1678,
9995,
3728,
4072,
363,
1546,
7136,
2943,
322,
3132,
15945,
29908,
13,
1678,
5195,
14130,
29918,
10490,
4897,
29918,
3970,
29032,
353,
29871,
29900,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
10490,
4897,
29918,
3970,
29032,
353,
29871,
29896,
13,
1678,
5195,
14130,
29918,
10490,
29918,
17816,
2965,
29918,
6632,
2287,
353,
29871,
29946,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
10490,
29918,
17816,
2965,
29918,
6632,
2287,
353,
29871,
29945,
13,
1678,
5195,
14130,
29918,
7194,
29918,
25903,
353,
29871,
29947,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
25903,
353,
29871,
29929,
13,
1678,
5195,
14130,
29918,
27616,
5690,
29918,
20566,
17070,
29918,
20633,
14816,
29903,
353,
29871,
29896,
29900,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
27616,
5690,
29918,
20566,
17070,
29918,
20633,
14816,
29903,
353,
29871,
29896,
29896,
13,
1678,
11662,
29032,
29918,
29925,
4214,
353,
29871,
29896,
29906,
13,
1678,
5195,
14130,
29918,
7194,
29918,
3970,
29032,
24360,
353,
29871,
29896,
29941,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
3970,
29032,
24360,
353,
29871,
29896,
29946,
13,
1678,
5195,
14130,
29918,
19460,
29918,
12256,
6545,
28541,
353,
29871,
29896,
29945,
13,
1678,
315,
23219,
29931,
29918,
19460,
29918,
12256,
6545,
28541,
353,
29871,
29896,
29953,
13,
1678,
5195,
14130,
29918,
7194,
29918,
17816,
29903,
353,
29871,
29896,
29955,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
17816,
29903,
353,
29871,
29896,
29947,
13,
1678,
6058,
6545,
29979,
29918,
3970,
29032,
29918,
10818,
29918,
14474,
353,
29871,
29896,
29929,
13,
1678,
5195,
14130,
29918,
7194,
29918,
8186,
6259,
29950,
29933,
1955,
24360,
353,
29871,
29906,
29896,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
8186,
6259,
29950,
29933,
1955,
24360,
353,
29871,
29906,
29906,
13,
1678,
5195,
14130,
29918,
7194,
29918,
11889,
29903,
353,
29871,
29906,
29941,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
11889,
29903,
353,
29871,
29906,
29946,
13,
1678,
5195,
14130,
29918,
7194,
29918,
22051,
29956,
17011,
4214,
29918,
24360,
353,
29871,
29906,
29945,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
22051,
29956,
17011,
4214,
29918,
24360,
353,
29871,
29906,
29953,
13,
1678,
5195,
14130,
29918,
7194,
29918,
6632,
2287,
1367,
353,
29871,
29906,
29955,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
6632,
2287,
1367,
353,
29871,
29906,
29947,
13,
1678,
5195,
14130,
29918,
7194,
29918,
12256,
6545,
28541,
29918,
24360,
353,
29871,
29906,
29929,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
7194,
29918,
12256,
6545,
28541,
29918,
24360,
353,
29871,
29941,
29900,
13,
1678,
5195,
14130,
29918,
29907,
3927,
1660,
29918,
3970,
29032,
353,
29871,
29941,
29896,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
29907,
3927,
1660,
29918,
3970,
29032,
353,
29871,
29941,
29906,
13,
1678,
5195,
14130,
29918,
29923,
6530,
29950,
29918,
10818,
29918,
5746,
3210,
24336,
353,
29871,
29941,
29941,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
29923,
6530,
29950,
29918,
10818,
29918,
5746,
3210,
24336,
353,
29871,
29941,
29946,
13,
13,
1678,
5195,
29954,
9047,
1001,
353,
29871,
29953,
29946,
13,
1678,
8291,
18166,
9047,
1001,
353,
29871,
29953,
29945,
13,
1678,
22986,
1799,
10461,
353,
29871,
29953,
29953,
13,
13,
1678,
5195,
14130,
29918,
29954,
1299,
4448,
29918,
5425,
20728,
1299,
11499,
353,
29871,
29953,
29955,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
29954,
1299,
4448,
29918,
5425,
20728,
1299,
11499,
353,
29871,
29953,
29947,
13,
1678,
5195,
14130,
29918,
5425,
20728,
1299,
11499,
353,
29871,
29953,
29929,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
5425,
20728,
1299,
11499,
353,
29871,
29955,
29900,
13,
1678,
5195,
14130,
29918,
19460,
353,
29871,
29955,
29896,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
19460,
353,
29871,
29955,
29906,
13,
1678,
6058,
6545,
29979,
29918,
19460,
3352,
353,
29871,
29955,
29941,
13,
1678,
6058,
6545,
29979,
29918,
29907,
1672,
1799,
29918,
25866,
353,
29871,
29955,
29946,
13,
13,
1678,
5195,
14130,
29918,
1660,
1718,
3210,
29918,
26813,
8132,
9838,
353,
29871,
29947,
29906,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
1660,
1718,
3210,
29918,
26813,
8132,
9838,
353,
29871,
29947,
29941,
13,
1678,
5195,
14130,
29918,
1660,
1718,
3210,
29918,
29956,
13054,
29918,
6007,
29928,
22122,
29903,
353,
29871,
29947,
29953,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
1660,
1718,
3210,
29918,
29956,
13054,
29918,
6007,
29928,
22122,
29903,
353,
29871,
29947,
29955,
13,
1678,
5195,
14130,
29918,
29911,
4717,
5348,
1660,
29918,
26813,
8132,
9838,
29903,
353,
29871,
29947,
29947,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
29911,
4717,
5348,
1660,
29918,
26813,
8132,
9838,
29903,
353,
29871,
29947,
29929,
13,
1678,
5195,
14130,
29918,
29907,
1672,
1799,
29918,
25866,
29918,
5348,
6545,
29979,
353,
29871,
29929,
29900,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
29907,
1672,
1799,
29918,
25866,
29918,
5348,
6545,
29979,
353,
29871,
29929,
29896,
13,
1678,
5195,
14130,
29918,
29907,
1672,
1799,
29918,
25866,
29918,
24360,
353,
29871,
29929,
29906,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
29907,
1672,
1799,
29918,
25866,
29918,
24360,
353,
29871,
29929,
29941,
13,
1678,
5195,
14130,
29918,
1525,
7228,
8193,
353,
29871,
29929,
29946,
13,
1678,
5195,
14130,
29918,
18736,
29918,
26813,
8132,
9838,
29903,
353,
29871,
29929,
29945,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
18736,
29918,
26813,
8132,
9838,
29903,
353,
29871,
29929,
29945,
13,
13,
1678,
5195,
14130,
29918,
18166,
9047,
1001,
29918,
29950,
24943,
29918,
1177,
29918,
20633,
14816,
29903,
353,
29871,
29896,
29906,
29947,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
18166,
9047,
1001,
29918,
29950,
24943,
29918,
1177,
29918,
20633,
14816,
29903,
353,
29871,
29896,
29906,
29929,
13,
1678,
5195,
14130,
29918,
5348,
6545,
29979,
29918,
29950,
24943,
29918,
1177,
29918,
20633,
14816,
29903,
353,
29871,
29896,
29941,
29900,
13,
1678,
390,
2890,
29925,
1164,
1660,
29918,
5348,
6545,
29979,
29918,
29950,
24943,
29918,
1177,
29918,
20633,
14816,
29903,
353,
29871,
29896,
29941,
29896,
13,
2
] |
src/psqlsync/ghmoteqlync/sync.py | tiptenbrink/psqlsync | 0 | 88447 | from pathlib import Path
from functools import partial
import tempfile
import logging
import tomli
import trio
from dirgh import find_download
import psqlsync.actions
logger = logging.getLogger(__name__)
def prepare(target, owner, repo, repo_dir, overwrite, config, token, verbose):
logger.info("Downloading backup files...")
run = partial(find_download, owner, repo, repo_dir, target, overwrite=overwrite,
token=token)
trio.run(run)
latest_save = find_latest(target)
temp_dir = Path(tempfile.gettempdir()).absolute()
restore_filename = temp_dir.joinpath('restore.dump.gz')
manager_config = {
'BACKUP_PATH': temp_dir,
'LOCAL_BACKUP_PATH': target
}
with open(config, "rb") as f:
cfg = tomli.load(f)
restore_uncompressed = temp_dir.joinpath('restore.dump')
postgresql_cfg = cfg.get('postgresql')
postgres_host = postgresql_cfg.get('host')
postgres_port = postgresql_cfg.get('port')
postgres_db = postgresql_cfg.get('db')
postgres_restore = "{}_psqlsync_temp_restore".format(postgres_db)
postgres_user = postgresql_cfg.get('user')
postgres_password = postgresql_cfg.get('password')
psqlsync.actions.restore(latest_save, restore_filename, 'LOCAL', manager_config, postgres_restore, None,
postgres_db,
postgres_host,
postgres_port,
postgres_user,
postgres_password,
restore_uncompressed, verbose)
logger.info("Sync finished successfully.")
def find_latest(target: str):
db_path = Path(target)
globbed = db_path.glob("*")
backup_files = []
for glb in globbed:
if glb.is_file():
if "backup" in glb.name and "gz" in glb.suffix:
dash_split = glb.name.split('-')
backup_time = '-'.join([p for p in dash_split if p.isnumeric()])
backup_files.append(backup_time)
if not backup_files:
raise ValueError("No backup files could be found, did download succeed?")
# ascending order
backup_files = sorted(backup_files)
return backup_files[-1]
| [
1,
515,
2224,
1982,
1053,
10802,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
5215,
5694,
1445,
13,
5215,
12183,
13,
5215,
6454,
492,
13,
5215,
3367,
29877,
13,
3166,
4516,
12443,
1053,
1284,
29918,
10382,
13,
13,
5215,
282,
2850,
16593,
29889,
7387,
13,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1753,
19012,
29898,
5182,
29892,
12271,
29892,
13761,
29892,
13761,
29918,
3972,
29892,
26556,
29892,
2295,
29892,
5993,
29892,
26952,
1125,
13,
1678,
17927,
29889,
3888,
703,
6767,
13234,
16199,
2066,
856,
1159,
13,
13,
1678,
1065,
353,
7687,
29898,
2886,
29918,
10382,
29892,
12271,
29892,
13761,
29892,
13761,
29918,
3972,
29892,
3646,
29892,
26556,
29922,
957,
3539,
29892,
13,
462,
29871,
5993,
29922,
6979,
29897,
13,
1678,
3367,
29877,
29889,
3389,
29898,
3389,
29897,
13,
1678,
9281,
29918,
7620,
353,
1284,
29918,
12333,
29898,
5182,
29897,
13,
13,
1678,
5694,
29918,
3972,
353,
10802,
29898,
7382,
1445,
29889,
657,
7382,
3972,
16655,
23552,
580,
13,
1678,
17749,
29918,
9507,
353,
5694,
29918,
3972,
29889,
7122,
2084,
877,
5060,
487,
29889,
15070,
29889,
18828,
1495,
13,
1678,
8455,
29918,
2917,
353,
426,
13,
4706,
525,
29933,
11375,
4897,
29918,
10145,
2396,
5694,
29918,
3972,
29892,
13,
4706,
525,
16652,
1964,
29918,
29933,
11375,
4897,
29918,
10145,
2396,
3646,
13,
1678,
500,
13,
1678,
411,
1722,
29898,
2917,
29892,
376,
6050,
1159,
408,
285,
29901,
13,
4706,
274,
16434,
353,
6454,
492,
29889,
1359,
29898,
29888,
29897,
13,
1678,
17749,
29918,
348,
510,
13120,
353,
5694,
29918,
3972,
29889,
7122,
2084,
877,
5060,
487,
29889,
15070,
1495,
13,
1678,
27035,
29918,
16859,
353,
274,
16434,
29889,
657,
877,
29272,
1495,
13,
1678,
1400,
7201,
29918,
3069,
353,
27035,
29918,
16859,
29889,
657,
877,
3069,
1495,
13,
1678,
1400,
7201,
29918,
637,
353,
27035,
29918,
16859,
29889,
657,
877,
637,
1495,
13,
1678,
1400,
7201,
29918,
2585,
353,
27035,
29918,
16859,
29889,
657,
877,
2585,
1495,
13,
1678,
1400,
7201,
29918,
5060,
487,
353,
29850,
2403,
567,
1519,
16593,
29918,
7382,
29918,
5060,
487,
1642,
4830,
29898,
2490,
7201,
29918,
2585,
29897,
13,
1678,
1400,
7201,
29918,
1792,
353,
27035,
29918,
16859,
29889,
657,
877,
1792,
1495,
13,
1678,
1400,
7201,
29918,
5630,
353,
27035,
29918,
16859,
29889,
657,
877,
5630,
1495,
13,
1678,
282,
2850,
16593,
29889,
7387,
29889,
5060,
487,
29898,
12333,
29918,
7620,
29892,
17749,
29918,
9507,
29892,
525,
16652,
1964,
742,
8455,
29918,
2917,
29892,
1400,
7201,
29918,
5060,
487,
29892,
6213,
29892,
13,
462,
632,
1400,
7201,
29918,
2585,
29892,
13,
462,
632,
1400,
7201,
29918,
3069,
29892,
13,
462,
632,
1400,
7201,
29918,
637,
29892,
13,
462,
632,
1400,
7201,
29918,
1792,
29892,
13,
462,
632,
1400,
7201,
29918,
5630,
29892,
13,
462,
632,
17749,
29918,
348,
510,
13120,
29892,
26952,
29897,
13,
1678,
17927,
29889,
3888,
703,
21077,
7743,
8472,
23157,
13,
13,
13,
1753,
1284,
29918,
12333,
29898,
5182,
29901,
851,
1125,
13,
1678,
4833,
29918,
2084,
353,
10802,
29898,
5182,
29897,
13,
1678,
15482,
1327,
287,
353,
4833,
29918,
2084,
29889,
23705,
703,
29930,
1159,
13,
1678,
16199,
29918,
5325,
353,
5159,
13,
13,
1678,
363,
3144,
29890,
297,
15482,
1327,
287,
29901,
13,
4706,
565,
3144,
29890,
29889,
275,
29918,
1445,
7295,
13,
9651,
565,
376,
1627,
786,
29908,
297,
3144,
29890,
29889,
978,
322,
376,
18828,
29908,
297,
3144,
29890,
29889,
2146,
600,
861,
29901,
13,
18884,
12569,
29918,
5451,
353,
3144,
29890,
29889,
978,
29889,
5451,
877,
29899,
1495,
13,
18884,
16199,
29918,
2230,
353,
17411,
4286,
7122,
4197,
29886,
363,
282,
297,
12569,
29918,
5451,
565,
282,
29889,
275,
21574,
580,
2314,
13,
18884,
16199,
29918,
5325,
29889,
4397,
29898,
1627,
786,
29918,
2230,
29897,
13,
13,
1678,
565,
451,
16199,
29918,
5325,
29901,
13,
4706,
12020,
7865,
2392,
703,
3782,
16199,
2066,
1033,
367,
1476,
29892,
1258,
5142,
9269,
29973,
1159,
13,
13,
1678,
396,
12066,
2548,
1797,
13,
1678,
16199,
29918,
5325,
353,
12705,
29898,
1627,
786,
29918,
5325,
29897,
13,
13,
1678,
736,
16199,
29918,
5325,
14352,
29896,
29962,
13,
2
] |
PDA_Transport/multi_period_aam.py | gaufung/LMDI | 4 | 72334 | <filename>PDA_Transport/multi_period_aam.py
# -*- encoding:utf-8 -*-
from single_period_aam import Spaam
class Mpaam(object):
def __init__(self, dmus_s, name, global_dmus, cefs, years):
self._period_count = len(dmus_s)
self._dmus_s = dmus_s
self._province_count = len(dmus_s[0])
self._province_names = [item.name for item in dmus_s[0]]
self._name = name
self._cache = {}
self._global_dmus = global_dmus
self._cefs = cefs
self._years = years
@property
def name(self):
return self._name
@property
def province_names(self):
return self._province_names
def _get_spaam(self, left, right):
assert left != right
label = str(left) + '-' + str(right)
if label not in self._cache:
self._cache[label] = Spaam.build(self._dmus_s[left], self._dmus_s[right],
self._years[left] + '-' + self._years[right],
self._global_dmus, self._cefs)
return self._cache[label]
def _index_t(self, t, index_name):
result = 1.0
for i in range(1, t + 1):
result *= getattr(self._get_spaam(i - 1, i), index_name)
return result
def _index(self, index_name):
result = []
for i in range(self._province_count):
value = 0.0
for t in range(1, self._period_count):
aggerate_value = self._index_t(t - 1, index_name)
spaam_t_1_t = self._get_spaam(t - 1, t)
contribution = (getattr(spaam_t_1_t, 'r' + index_name)()[i] *
getattr(spaam_t_1_t, index_name + '_ratio')()[i])
value += aggerate_value * contribution
result.append(value)
return result
# emx
def emx(self):
return self._index('emx')
def emx_t(self, t):
return self._index_t(t, 'emx')
# cef
def cef(self):
return self._index('cef')
def cef_t(self, t):
return self._index_t(t, 'cef')
# pei
def pei_t(self, t):
return self._index_t(t, 'pei')
def pei(self):
return self._index('pei')
# est
def est_t(self, t):
return self._index_t(t, 'est')
def est(self):
return self._index('est')
# eue
def eue_t(self, t):
return self._index_t(t, 'eue')
def eue(self):
return self._index('eue')
# pti
def pti_t(self, t):
return self._index_t(t, 'pti')
def pti(self):
return self._index('pti')
# yoe
def yoe_t(self, t):
return self._index_t(t, 'yoe')
def yoe(self):
return self._index('yoe')
# yct
def yct_t(self, t):
return self._index_t(t, 'yct')
def yct(self):
return self._index('yct')
# rts
def rts_t(self, t):
return self._index_t(t, 'rts')
def rts(self):
return self._index('rts')
def indexes(self, t):
return [self.cef_t(t), self.emx_t(t), self.pei_t(t),
self.est_t(t), self.eue_t(t), self.pti_t(t),
self.yoe_t(t), self.yct_t(t), self.rts_t(t)] | [
1,
529,
9507,
29958,
29925,
7698,
29918,
27395,
29914,
9910,
29918,
19145,
29918,
29874,
314,
29889,
2272,
13,
29937,
448,
29930,
29899,
8025,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
3166,
2323,
29918,
19145,
29918,
29874,
314,
1053,
1706,
29874,
314,
13,
13,
13,
1990,
341,
3274,
314,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
270,
8366,
29918,
29879,
29892,
1024,
29892,
5534,
29918,
29881,
8366,
29892,
274,
1389,
29879,
29892,
2440,
1125,
13,
4706,
1583,
3032,
19145,
29918,
2798,
353,
7431,
29898,
29881,
8366,
29918,
29879,
29897,
13,
4706,
1583,
3032,
29881,
8366,
29918,
29879,
353,
270,
8366,
29918,
29879,
13,
4706,
1583,
3032,
16123,
1239,
29918,
2798,
353,
7431,
29898,
29881,
8366,
29918,
29879,
29961,
29900,
2314,
13,
4706,
1583,
3032,
16123,
1239,
29918,
7039,
353,
518,
667,
29889,
978,
363,
2944,
297,
270,
8366,
29918,
29879,
29961,
29900,
5262,
13,
4706,
1583,
3032,
978,
353,
1024,
13,
4706,
1583,
3032,
8173,
353,
6571,
13,
4706,
1583,
3032,
10945,
29918,
29881,
8366,
353,
5534,
29918,
29881,
8366,
13,
4706,
1583,
3032,
346,
5847,
353,
274,
1389,
29879,
13,
4706,
1583,
3032,
6360,
29879,
353,
2440,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1024,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
978,
13,
13,
1678,
732,
6799,
13,
1678,
822,
12291,
29918,
7039,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
16123,
1239,
29918,
7039,
13,
13,
1678,
822,
903,
657,
29918,
1028,
29874,
314,
29898,
1311,
29892,
2175,
29892,
1492,
1125,
13,
4706,
4974,
2175,
2804,
1492,
13,
4706,
3858,
353,
851,
29898,
1563,
29897,
718,
17411,
29915,
718,
851,
29898,
1266,
29897,
13,
4706,
565,
3858,
451,
297,
1583,
3032,
8173,
29901,
13,
9651,
1583,
3032,
8173,
29961,
1643,
29962,
353,
1706,
29874,
314,
29889,
4282,
29898,
1311,
3032,
29881,
8366,
29918,
29879,
29961,
1563,
1402,
1583,
3032,
29881,
8366,
29918,
29879,
29961,
1266,
1402,
13,
462,
462,
632,
1583,
3032,
6360,
29879,
29961,
1563,
29962,
718,
17411,
29915,
718,
1583,
3032,
6360,
29879,
29961,
1266,
1402,
13,
462,
462,
632,
1583,
3032,
10945,
29918,
29881,
8366,
29892,
1583,
3032,
346,
5847,
29897,
13,
4706,
736,
1583,
3032,
8173,
29961,
1643,
29962,
13,
13,
1678,
822,
903,
2248,
29918,
29873,
29898,
1311,
29892,
260,
29892,
2380,
29918,
978,
1125,
13,
4706,
1121,
353,
29871,
29896,
29889,
29900,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
260,
718,
29871,
29896,
1125,
13,
9651,
1121,
334,
29922,
679,
5552,
29898,
1311,
3032,
657,
29918,
1028,
29874,
314,
29898,
29875,
448,
29871,
29896,
29892,
474,
511,
2380,
29918,
978,
29897,
13,
4706,
736,
1121,
13,
13,
1678,
822,
903,
2248,
29898,
1311,
29892,
2380,
29918,
978,
1125,
13,
4706,
1121,
353,
5159,
13,
4706,
363,
474,
297,
3464,
29898,
1311,
3032,
16123,
1239,
29918,
2798,
1125,
13,
9651,
995,
353,
29871,
29900,
29889,
29900,
13,
9651,
363,
260,
297,
3464,
29898,
29896,
29892,
1583,
3032,
19145,
29918,
2798,
1125,
13,
18884,
946,
914,
403,
29918,
1767,
353,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
448,
29871,
29896,
29892,
2380,
29918,
978,
29897,
13,
18884,
805,
29874,
314,
29918,
29873,
29918,
29896,
29918,
29873,
353,
1583,
3032,
657,
29918,
1028,
29874,
314,
29898,
29873,
448,
29871,
29896,
29892,
260,
29897,
13,
18884,
11896,
353,
313,
657,
5552,
29898,
1028,
29874,
314,
29918,
29873,
29918,
29896,
29918,
29873,
29892,
525,
29878,
29915,
718,
2380,
29918,
978,
29897,
580,
29961,
29875,
29962,
334,
13,
462,
18884,
679,
5552,
29898,
1028,
29874,
314,
29918,
29873,
29918,
29896,
29918,
29873,
29892,
2380,
29918,
978,
718,
22868,
3605,
601,
1495,
580,
29961,
29875,
2314,
13,
18884,
995,
4619,
946,
914,
403,
29918,
1767,
334,
11896,
13,
9651,
1121,
29889,
4397,
29898,
1767,
29897,
13,
4706,
736,
1121,
13,
13,
1678,
396,
953,
29916,
13,
1678,
822,
953,
29916,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
331,
29916,
1495,
13,
13,
1678,
822,
953,
29916,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
331,
29916,
1495,
13,
13,
1678,
396,
274,
1389,
13,
1678,
822,
274,
1389,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
346,
29888,
1495,
13,
13,
1678,
822,
274,
1389,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
346,
29888,
1495,
13,
13,
1678,
396,
1236,
29875,
13,
1678,
822,
1236,
29875,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
412,
29875,
1495,
13,
13,
1678,
822,
1236,
29875,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
412,
29875,
1495,
13,
13,
1678,
396,
707,
13,
1678,
822,
707,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
342,
1495,
13,
13,
1678,
822,
707,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
342,
1495,
13,
13,
1678,
396,
321,
434,
13,
1678,
822,
321,
434,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
29872,
434,
1495,
13,
13,
1678,
822,
321,
434,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
29872,
434,
1495,
13,
13,
1678,
396,
282,
2034,
13,
1678,
822,
282,
2034,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
415,
29875,
1495,
13,
13,
1678,
822,
282,
2034,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
415,
29875,
1495,
13,
13,
1678,
396,
343,
7297,
13,
1678,
822,
343,
7297,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
29891,
7297,
1495,
13,
13,
1678,
822,
343,
7297,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
29891,
7297,
1495,
13,
13,
1678,
396,
343,
312,
13,
1678,
822,
343,
312,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
29891,
312,
1495,
13,
13,
1678,
822,
343,
312,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
29891,
312,
1495,
13,
13,
1678,
396,
364,
1372,
13,
1678,
822,
364,
1372,
29918,
29873,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
1583,
3032,
2248,
29918,
29873,
29898,
29873,
29892,
525,
29878,
1372,
1495,
13,
13,
1678,
822,
364,
1372,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
2248,
877,
29878,
1372,
1495,
13,
13,
1678,
822,
18111,
29898,
1311,
29892,
260,
1125,
13,
4706,
736,
518,
1311,
29889,
346,
29888,
29918,
29873,
29898,
29873,
511,
1583,
29889,
331,
29916,
29918,
29873,
29898,
29873,
511,
1583,
29889,
412,
29875,
29918,
29873,
29898,
29873,
511,
13,
18884,
1583,
29889,
342,
29918,
29873,
29898,
29873,
511,
1583,
29889,
29872,
434,
29918,
29873,
29898,
29873,
511,
1583,
29889,
415,
29875,
29918,
29873,
29898,
29873,
511,
13,
18884,
1583,
29889,
29891,
7297,
29918,
29873,
29898,
29873,
511,
1583,
29889,
29891,
312,
29918,
29873,
29898,
29873,
511,
1583,
29889,
29878,
1372,
29918,
29873,
29898,
29873,
4638,
2
] |
ivy/test/afterinit1.py | b1f6c1c4/cfg-enum | 113 | 42268 |
from ivy import ivy_module as im
from ivy.ivy_compiler import ivy_from_string
from ivy.tk_ui import new_ui
from ivy import ivy_utils as iu
prog = """#lang ivy1.6
type t
individual x(X:t) : t
object foo(me:t) = {
after init {
x(me) := me;
assert false
}
}
isolate iso_foo(me:t) = foo(me) with x(me)
"""
with im.Module():
iu.set_parameters({'mode':'induction','isolate':'iso_foo','show_compiled':'true'})
main_ui = new_ui()
ui = main_ui.add(ivy_from_string(prog))
main_ui.tk.update_idletasks()
main_ui.answer("OK")
ui.check_safety_node(ui.node(0))
assert not ui.node(0).safe
# ui.check_inductiveness()
# # ui = ui.cti
# cg = ui.current_concept_graph
# cg.show_relation(cg.relation('link(X,Y)'),'+')
# cg.gather()
# main_ui.answer("OK")
# cg.strengthen()
# main_ui.answer("OK")
# ui.check_inductiveness()
# # cg.show_relation(cg.relation('semaphore'),'+')
# cg.gather()
# main_ui.answer("View")
# cg.bmc_conjecture(bound=1)
# main_ui.mainloop()
| [
1,
29871,
13,
3166,
20444,
29891,
1053,
20444,
29891,
29918,
5453,
408,
527,
13,
3166,
20444,
29891,
29889,
440,
29891,
29918,
21789,
1053,
20444,
29891,
29918,
3166,
29918,
1807,
13,
3166,
20444,
29891,
29889,
11178,
29918,
1481,
1053,
716,
29918,
1481,
13,
3166,
20444,
29891,
1053,
20444,
29891,
29918,
13239,
408,
474,
29884,
13,
13,
29097,
353,
9995,
29937,
3893,
20444,
29891,
29896,
29889,
29953,
13,
13,
1853,
260,
13,
13,
513,
23352,
921,
29898,
29990,
29901,
29873,
29897,
584,
260,
13,
13,
3318,
7953,
29898,
1004,
29901,
29873,
29897,
353,
426,
13,
1678,
1156,
2069,
426,
13,
4706,
921,
29898,
1004,
29897,
3490,
592,
29936,
13,
4706,
4974,
2089,
13,
1678,
500,
13,
29913,
13,
13,
275,
23167,
338,
29877,
29918,
5431,
29898,
1004,
29901,
29873,
29897,
353,
7953,
29898,
1004,
29897,
411,
921,
29898,
1004,
29897,
13,
13,
15945,
29908,
13,
13,
2541,
527,
29889,
7355,
7295,
13,
1678,
474,
29884,
29889,
842,
29918,
16744,
3319,
29915,
8513,
22099,
19910,
428,
3788,
275,
23167,
22099,
10718,
29918,
5431,
3788,
4294,
29918,
2388,
2356,
22099,
3009,
29915,
1800,
13,
1678,
1667,
29918,
1481,
353,
716,
29918,
1481,
580,
13,
1678,
14313,
353,
1667,
29918,
1481,
29889,
1202,
29898,
440,
29891,
29918,
3166,
29918,
1807,
29898,
29097,
876,
13,
1678,
1667,
29918,
1481,
29889,
11178,
29889,
5504,
29918,
333,
1026,
1278,
29879,
580,
268,
13,
1678,
1667,
29918,
1481,
29889,
12011,
703,
8949,
1159,
13,
1678,
14313,
29889,
3198,
29918,
29879,
2142,
3305,
29918,
3177,
29898,
1481,
29889,
3177,
29898,
29900,
876,
13,
1678,
4974,
451,
14313,
29889,
3177,
29898,
29900,
467,
11177,
13,
29937,
268,
14313,
29889,
3198,
29918,
513,
5313,
20193,
580,
13,
29937,
396,
1678,
14313,
353,
14313,
29889,
312,
29875,
13,
29937,
268,
274,
29887,
353,
14313,
29889,
3784,
29918,
535,
1547,
29918,
4262,
13,
29937,
268,
274,
29887,
29889,
4294,
29918,
23445,
29898,
29883,
29887,
29889,
23445,
877,
2324,
29898,
29990,
29892,
29979,
29897,
5477,
18717,
1495,
13,
29937,
268,
274,
29887,
29889,
29887,
1624,
580,
13,
29937,
268,
1667,
29918,
1481,
29889,
12011,
703,
8949,
1159,
13,
29937,
268,
274,
29887,
29889,
710,
1477,
264,
580,
13,
29937,
268,
1667,
29918,
1481,
29889,
12011,
703,
8949,
1159,
13,
29937,
268,
14313,
29889,
3198,
29918,
513,
5313,
20193,
580,
13,
29937,
396,
1678,
274,
29887,
29889,
4294,
29918,
23445,
29898,
29883,
29887,
29889,
23445,
877,
12846,
12451,
487,
5477,
18717,
1495,
13,
29937,
268,
274,
29887,
29889,
29887,
1624,
580,
13,
29937,
268,
1667,
29918,
1481,
29889,
12011,
703,
1043,
1159,
13,
29937,
268,
274,
29887,
29889,
5838,
29883,
29918,
535,
622,
545,
29898,
9917,
29922,
29896,
29897,
13,
29937,
1678,
1667,
29918,
1481,
29889,
3396,
7888,
580,
13,
13,
13,
2
] |
grammar.py | ankieter-gui/release | 0 | 79750 | import typing
import error
REQUEST_TABLE = {
'get': [[str]],
'as': [str],
'by': ([str], 'optional'),
'if': ([list], 'optional'),
'except': ([list], 'optional'),
'join': ([
{
'name': str,
'of': [str],
}
], 'optional'),
'macro': ([str], 'optional'),
}
REQUEST_TABLE_QUESTION_COUNT = {
'get': [[str]],
'if': ([list], 'optional'),
'except': ([list], 'optional'),
'macro': [str],
}
REQUEST_CREATE_SURVEY = {
'surveyId': int,
'title': str,
}
REQUEST_CHANGE_PERMISSIONS = {
'r': ([int], 'optional'),
'w': ([int], 'optional'),
'n': ([int], 'optional'),
}
REQUEST_GROUP = {
'group': str,
}
REQUEST_USER = {
'userId': int,
}
REQUEST_SURVEY_LINK = {
'permission': str,
'surveyId': int
}
REQUEST_REPORT_LINK = {
'permission': str,
'reportId': int
}
def analyze(tp: typing.Any, obj: typing.Any) -> str:
"""Analyze object structure.
Keyword arguments:
tp -- expected object structure
obj -- given object
Return value:
returns message after analyze
"""
# Check if obj is of the desired type
if type(tp) is type:
if type(obj) is tp:
return ''
else:
return f'expected {tp.__name__}, got {type(obj).__name__}'
# If the desired type is a list, check types of each of its elements
if type(tp) is list:
if type(obj) is not list:
return f'expected {type(tp).__name__}, got {type(obj).__name__}'
for i, o in enumerate(obj):
if msg := analyze(tp[0], o):
return f'in element [{i}]: {msg}'
return ''
# If the desired type is a dict, check types of values under each key
if type(tp) is dict:
if type(obj) is not dict:
return f'expected {type(tp).__name__}, got {type(obj).__name__}'
for k, t in tp.items():
if type(t) is tuple:
t, *params = t
else:
params = []
if k not in obj:
if 'optional' in params:
continue
return f'expected key \'{k}\''
if msg := analyze(t, obj[k]):
return f'in element \'{k}\': {msg}'
return ''
return 'unexpected object type'
def check(tp: typing.Any, obj: typing.Any):
"""Validate object structure.
Keyword arguments:
tp -- expected object structure
obj -- given object
"""
if msg := analyze(tp, obj):
raise error.API(msg)
| [
1,
1053,
19229,
13,
5215,
1059,
13,
13,
16244,
29918,
21009,
353,
426,
13,
1678,
525,
657,
2396,
1678,
5519,
710,
20526,
13,
1678,
525,
294,
2396,
268,
518,
710,
1402,
13,
1678,
525,
1609,
2396,
268,
9310,
710,
1402,
29871,
525,
25253,
5477,
13,
1678,
525,
361,
2396,
268,
9310,
1761,
1402,
525,
25253,
5477,
13,
1678,
525,
19499,
2396,
9310,
1761,
1402,
525,
25253,
5477,
13,
1678,
525,
7122,
2396,
259,
9310,
13,
4706,
426,
13,
9651,
525,
978,
2396,
851,
29892,
13,
9651,
525,
974,
2396,
259,
518,
710,
1402,
13,
4706,
500,
13,
1678,
21251,
525,
25253,
5477,
13,
1678,
525,
25254,
2396,
29871,
9310,
710,
1402,
1678,
525,
25253,
5477,
13,
29913,
13,
13,
16244,
29918,
21009,
29918,
14130,
2725,
29918,
18736,
353,
426,
13,
1678,
525,
657,
2396,
1678,
5519,
710,
20526,
13,
1678,
525,
361,
2396,
268,
9310,
1761,
1402,
525,
25253,
5477,
13,
1678,
525,
19499,
2396,
9310,
1761,
1402,
525,
25253,
5477,
13,
1678,
525,
25254,
2396,
29871,
518,
710,
1402,
13,
29913,
13,
13,
16244,
29918,
27045,
29918,
29903,
4574,
12064,
29979,
353,
426,
13,
1678,
525,
7610,
6950,
1204,
2396,
938,
29892,
13,
1678,
525,
3257,
2396,
1678,
851,
29892,
13,
29913,
13,
13,
16244,
29918,
3210,
24336,
29918,
13171,
10403,
13507,
29903,
353,
426,
13,
1678,
525,
29878,
2396,
9310,
524,
1402,
525,
25253,
5477,
13,
1678,
525,
29893,
2396,
9310,
524,
1402,
525,
25253,
5477,
13,
1678,
525,
29876,
2396,
9310,
524,
1402,
525,
25253,
5477,
13,
29913,
13,
13,
16244,
29918,
26284,
353,
426,
13,
1678,
525,
2972,
2396,
851,
29892,
13,
29913,
13,
13,
16244,
29918,
11889,
353,
426,
13,
1678,
525,
29721,
2396,
938,
29892,
13,
29913,
13,
13,
16244,
29918,
29903,
4574,
12064,
29979,
29918,
23714,
29968,
353,
426,
13,
1678,
525,
16074,
2396,
851,
29892,
13,
1678,
525,
7610,
6950,
1204,
2396,
938,
13,
29913,
13,
13,
16244,
29918,
1525,
15082,
29918,
23714,
29968,
353,
426,
13,
1678,
525,
16074,
2396,
851,
29892,
13,
1678,
525,
12276,
1204,
2396,
938,
13,
29913,
13,
13,
13,
1753,
27599,
29898,
9392,
29901,
19229,
29889,
10773,
29892,
5446,
29901,
19229,
29889,
10773,
29897,
1599,
851,
29901,
13,
1678,
9995,
2744,
14997,
911,
1203,
3829,
29889,
13,
13,
1678,
7670,
1742,
6273,
29901,
13,
1678,
260,
29886,
1192,
3806,
1203,
3829,
13,
1678,
5446,
1192,
2183,
1203,
13,
13,
1678,
7106,
995,
29901,
13,
1678,
3639,
2643,
1156,
27599,
13,
1678,
9995,
13,
13,
1678,
396,
5399,
565,
5446,
338,
310,
278,
7429,
1134,
13,
1678,
565,
1134,
29898,
9392,
29897,
338,
1134,
29901,
13,
4706,
565,
1134,
29898,
5415,
29897,
338,
260,
29886,
29901,
13,
9651,
736,
6629,
13,
4706,
1683,
29901,
13,
9651,
736,
285,
29915,
9684,
426,
9392,
17255,
978,
1649,
1118,
2355,
426,
1853,
29898,
5415,
467,
1649,
978,
1649,
10162,
13,
13,
1678,
396,
960,
278,
7429,
1134,
338,
263,
1051,
29892,
1423,
4072,
310,
1269,
310,
967,
3161,
13,
1678,
565,
1134,
29898,
9392,
29897,
338,
1051,
29901,
13,
4706,
565,
1134,
29898,
5415,
29897,
338,
451,
1051,
29901,
13,
9651,
736,
285,
29915,
9684,
426,
1853,
29898,
9392,
467,
1649,
978,
1649,
1118,
2355,
426,
1853,
29898,
5415,
467,
1649,
978,
1649,
10162,
13,
4706,
363,
474,
29892,
288,
297,
26985,
29898,
5415,
1125,
13,
9651,
565,
10191,
3490,
27599,
29898,
9392,
29961,
29900,
1402,
288,
1125,
13,
18884,
736,
285,
29915,
262,
1543,
15974,
29875,
29913,
5387,
426,
7645,
10162,
13,
4706,
736,
6629,
13,
13,
1678,
396,
960,
278,
7429,
1134,
338,
263,
9657,
29892,
1423,
4072,
310,
1819,
1090,
1269,
1820,
13,
1678,
565,
1134,
29898,
9392,
29897,
338,
9657,
29901,
13,
4706,
565,
1134,
29898,
5415,
29897,
338,
451,
9657,
29901,
13,
9651,
736,
285,
29915,
9684,
426,
1853,
29898,
9392,
467,
1649,
978,
1649,
1118,
2355,
426,
1853,
29898,
5415,
467,
1649,
978,
1649,
10162,
13,
4706,
363,
413,
29892,
260,
297,
260,
29886,
29889,
7076,
7295,
13,
9651,
565,
1134,
29898,
29873,
29897,
338,
18761,
29901,
13,
18884,
260,
29892,
334,
7529,
353,
260,
13,
9651,
1683,
29901,
13,
18884,
8636,
353,
5159,
13,
9651,
565,
413,
451,
297,
5446,
29901,
13,
18884,
565,
525,
25253,
29915,
297,
8636,
29901,
13,
462,
1678,
6773,
13,
18884,
736,
285,
29915,
9684,
1820,
320,
29915,
29912,
29895,
1012,
4907,
13,
9651,
565,
10191,
3490,
27599,
29898,
29873,
29892,
5446,
29961,
29895,
29962,
1125,
13,
18884,
736,
285,
29915,
262,
1543,
320,
29915,
29912,
29895,
1012,
2396,
426,
7645,
10162,
13,
4706,
736,
6629,
13,
1678,
736,
525,
348,
9684,
1203,
1134,
29915,
13,
13,
13,
1753,
1423,
29898,
9392,
29901,
19229,
29889,
10773,
29892,
5446,
29901,
19229,
29889,
10773,
1125,
13,
1678,
9995,
7211,
403,
1203,
3829,
29889,
13,
13,
1678,
7670,
1742,
6273,
29901,
13,
1678,
260,
29886,
1192,
3806,
1203,
3829,
13,
1678,
5446,
1192,
2183,
1203,
13,
1678,
9995,
13,
13,
1678,
565,
10191,
3490,
27599,
29898,
9392,
29892,
5446,
1125,
13,
4706,
12020,
1059,
29889,
8787,
29898,
7645,
29897,
13,
2
] |
python2.7/site-packages/zope/interface/tests/test_verify.py | 84KaliPleXon3/sslstrip-hsts-openwrt | 4 | 1609893 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Interface Verify tests
$Id: test_verify.py 26866 2004-08-02 20:57:00Z jim $
"""
from zope.interface import Interface, implements, classImplements, Attribute
from zope.interface.verify import verifyClass, verifyObject
from zope.interface.exceptions import DoesNotImplement, BrokenImplementation
from zope.interface.exceptions import BrokenMethodImplementation
import unittest
class Test(unittest.TestCase):
def testNotImplemented(self):
class C(object): pass
class I(Interface): pass
self.assertRaises(DoesNotImplement, verifyClass, I, C)
classImplements(C, I)
verifyClass(I, C)
def testMissingAttr(self):
class I(Interface):
def f(): pass
class C(object):
implements(I)
self.assertRaises(BrokenImplementation, verifyClass, I, C)
C.f=lambda self: None
verifyClass(I, C)
def testMissingAttr_with_Extended_Interface(self):
class II(Interface):
def f():
pass
class I(II):
pass
class C(object):
implements(I)
self.assertRaises(BrokenImplementation, verifyClass, I, C)
C.f=lambda self: None
verifyClass(I, C)
def testWrongArgs(self):
class I(Interface):
def f(a): pass
class C(object):
def f(self, b): pass
implements(I)
# We no longer require names to match.
#self.assertRaises(BrokenMethodImplementation, verifyClass, I, C)
C.f=lambda self, a: None
verifyClass(I, C)
C.f=lambda self, **kw: None
self.assertRaises(BrokenMethodImplementation, verifyClass, I, C)
C.f=lambda self, a, *args: None
verifyClass(I, C)
C.f=lambda self, a, *args, **kw: None
verifyClass(I, C)
C.f=lambda self, *args: None
verifyClass(I, C)
def testExtraArgs(self):
class I(Interface):
def f(a): pass
class C(object):
def f(self, a, b): pass
implements(I)
self.assertRaises(BrokenMethodImplementation, verifyClass, I, C)
C.f=lambda self, a: None
verifyClass(I, C)
C.f=lambda self, a, b=None: None
verifyClass(I, C)
def testNoVar(self):
class I(Interface):
def f(a, *args): pass
class C(object):
def f(self, a): pass
implements(I)
self.assertRaises(BrokenMethodImplementation, verifyClass, I, C)
C.f=lambda self, a, *foo: None
verifyClass(I, C)
def testNoKW(self):
class I(Interface):
def f(a, **args): pass
class C(object):
def f(self, a): pass
implements(I)
self.assertRaises(BrokenMethodImplementation, verifyClass, I, C)
C.f=lambda self, a, **foo: None
verifyClass(I, C)
def testModule(self):
from zope.interface.tests.ifoo import IFoo
from zope.interface.tests import dummy
verifyObject(IFoo, dummy)
def testMethodForAttr(self):
class IFoo(Interface):
foo = Attribute("The foo Attribute")
class Foo:
implements(IFoo)
def foo(self):
pass
verifyClass(IFoo, Foo)
def testNonMethodForMethod(self):
class IBar(Interface):
def foo():
pass
class Bar:
implements(IBar)
foo = 1
self.assertRaises(BrokenMethodImplementation, verifyClass, IBar, Bar)
def test_suite():
loader=unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
if __name__=='__main__':
unittest.TextTestRunner().run(test_suite())
| [
1,
835,
13383,
13383,
13383,
13383,
7346,
2277,
29937,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29900,
29896,
29892,
29871,
29906,
29900,
29900,
29906,
796,
2300,
15025,
322,
2866,
1091,
29560,
29889,
13,
29937,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
910,
7047,
338,
4967,
304,
278,
1326,
12112,
310,
278,
796,
2300,
5236,
19245,
29892,
13,
29937,
10079,
29871,
29906,
29889,
29896,
313,
29999,
7390,
467,
29871,
319,
3509,
310,
278,
796,
7390,
881,
10259,
1384,
445,
4978,
29889,
13,
29937,
3446,
3235,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
29908,
5300,
13764,
29979,
5300,
15149,
8528,
15094,
1799,
6323,
306,
3580,
5265,
3352,
13,
29937,
399,
1718,
29934,
13566,
29059,
319,
1525,
28657,
13875,
8890,
29928,
29892,
2672,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
6093,
306,
3580,
5265,
3352,
13,
29937,
399,
1718,
29934,
13566,
29059,
8079,
323,
1806,
1307,
29892,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
319,
12739,
25580,
2672,
15860,
1177,
1692,
13780,
29892,
5300,
383,
1806,
8186,
1799,
13,
29937,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
29889,
13,
29937,
13,
13383,
13383,
13383,
13383,
7346,
4136,
2277,
13,
15945,
29908,
10448,
1798,
1598,
6987,
13,
13,
29938,
1204,
29901,
1243,
29918,
27902,
29889,
2272,
29871,
29906,
29953,
29947,
29953,
29953,
29871,
29906,
29900,
29900,
29946,
29899,
29900,
29947,
29899,
29900,
29906,
29871,
29906,
29900,
29901,
29945,
29955,
29901,
29900,
29900,
29999,
432,
326,
395,
13,
15945,
29908,
13,
3166,
503,
2300,
29889,
13248,
1053,
25796,
29892,
10703,
29892,
770,
1888,
9711,
29892,
23833,
13,
3166,
503,
2300,
29889,
13248,
29889,
27902,
1053,
11539,
2385,
29892,
11539,
2061,
13,
3166,
503,
2300,
29889,
13248,
29889,
11739,
29879,
1053,
5538,
3664,
1888,
2037,
29892,
4358,
1717,
1888,
14607,
13,
3166,
503,
2300,
29889,
13248,
29889,
11739,
29879,
1053,
4358,
1717,
4062,
1888,
14607,
13,
13,
5215,
443,
27958,
13,
13,
1990,
4321,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
3664,
1888,
2037,
287,
29898,
1311,
1125,
13,
13,
4706,
770,
315,
29898,
3318,
1125,
1209,
13,
13,
4706,
770,
306,
29898,
10448,
1125,
1209,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
25125,
3664,
1888,
2037,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
770,
1888,
9711,
29898,
29907,
29892,
306,
29897,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
1678,
822,
1243,
18552,
292,
25098,
29898,
1311,
1125,
13,
13,
4706,
770,
306,
29898,
10448,
1125,
13,
9651,
822,
285,
7295,
1209,
13,
13,
4706,
770,
315,
29898,
3318,
1125,
13,
9651,
10703,
29898,
29902,
29897,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
1888,
14607,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
1678,
822,
1243,
18552,
292,
25098,
29918,
2541,
29918,
5647,
2760,
29918,
10448,
29898,
1311,
1125,
13,
13,
4706,
770,
1944,
29898,
10448,
1125,
13,
9651,
822,
285,
7295,
13,
18884,
1209,
13,
13,
4706,
770,
306,
29898,
2687,
1125,
13,
9651,
1209,
13,
13,
4706,
770,
315,
29898,
3318,
1125,
13,
9651,
10703,
29898,
29902,
29897,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
1888,
14607,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
1678,
822,
1243,
29956,
29373,
7883,
29898,
1311,
1125,
13,
13,
4706,
770,
306,
29898,
10448,
1125,
13,
9651,
822,
285,
29898,
29874,
1125,
1209,
13,
13,
4706,
770,
315,
29898,
3318,
1125,
13,
9651,
822,
285,
29898,
1311,
29892,
289,
1125,
1209,
13,
13,
9651,
10703,
29898,
29902,
29897,
13,
13,
4706,
396,
1334,
694,
5520,
1996,
2983,
304,
1993,
29889,
13,
4706,
396,
1311,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
4062,
1888,
14607,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
263,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
3579,
11022,
29901,
6213,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
4062,
1888,
14607,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
263,
29892,
334,
5085,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
263,
29892,
334,
5085,
29892,
3579,
11022,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
334,
5085,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
1678,
822,
1243,
18126,
7883,
29898,
1311,
1125,
13,
13,
4706,
770,
306,
29898,
10448,
1125,
13,
9651,
822,
285,
29898,
29874,
1125,
1209,
13,
13,
4706,
770,
315,
29898,
3318,
1125,
13,
9651,
822,
285,
29898,
1311,
29892,
263,
29892,
289,
1125,
1209,
13,
13,
9651,
10703,
29898,
29902,
29897,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
4062,
1888,
14607,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
263,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
263,
29892,
289,
29922,
8516,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
1678,
822,
1243,
3782,
9037,
29898,
1311,
1125,
13,
13,
4706,
770,
306,
29898,
10448,
1125,
13,
9651,
822,
285,
29898,
29874,
29892,
334,
5085,
1125,
1209,
13,
13,
4706,
770,
315,
29898,
3318,
1125,
13,
9651,
822,
285,
29898,
1311,
29892,
263,
1125,
1209,
13,
13,
9651,
10703,
29898,
29902,
29897,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
4062,
1888,
14607,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
263,
29892,
334,
5431,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
1678,
822,
1243,
3782,
29968,
29956,
29898,
1311,
1125,
13,
13,
4706,
770,
306,
29898,
10448,
1125,
13,
9651,
822,
285,
29898,
29874,
29892,
3579,
5085,
1125,
1209,
13,
13,
4706,
770,
315,
29898,
3318,
1125,
13,
9651,
822,
285,
29898,
1311,
29892,
263,
1125,
1209,
13,
13,
9651,
10703,
29898,
29902,
29897,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
4062,
1888,
14607,
29892,
11539,
2385,
29892,
306,
29892,
315,
29897,
13,
13,
4706,
315,
29889,
29888,
29922,
2892,
1583,
29892,
263,
29892,
3579,
5431,
29901,
6213,
13,
13,
4706,
11539,
2385,
29898,
29902,
29892,
315,
29897,
13,
13,
1678,
822,
1243,
7355,
29898,
1311,
1125,
13,
13,
4706,
515,
503,
2300,
29889,
13248,
29889,
21150,
29889,
361,
3634,
1053,
10762,
3634,
13,
4706,
515,
503,
2300,
29889,
13248,
29889,
21150,
1053,
20254,
13,
13,
4706,
11539,
2061,
29898,
6545,
3634,
29892,
20254,
29897,
13,
13,
1678,
822,
1243,
4062,
2831,
25098,
29898,
1311,
1125,
13,
308,
13,
4706,
770,
10762,
3634,
29898,
10448,
1125,
13,
632,
7953,
353,
23833,
703,
1576,
7953,
23833,
1159,
13,
13,
13,
4706,
770,
13679,
29901,
13,
632,
10703,
29898,
6545,
3634,
29897,
13,
13,
632,
822,
7953,
29898,
1311,
1125,
13,
462,
1209,
13,
13,
4706,
11539,
2385,
29898,
6545,
3634,
29892,
13679,
29897,
13,
13,
1678,
822,
1243,
12283,
4062,
2831,
4062,
29898,
1311,
1125,
13,
13,
4706,
770,
306,
4297,
29898,
10448,
1125,
13,
632,
822,
7953,
7295,
13,
462,
1209,
13,
13,
4706,
770,
2261,
29901,
13,
9651,
10703,
29898,
29902,
4297,
29897,
13,
13,
9651,
7953,
353,
29871,
29896,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29857,
1717,
4062,
1888,
14607,
29892,
11539,
2385,
29892,
306,
4297,
29892,
2261,
29897,
13,
308,
13,
13,
1753,
1243,
29918,
13495,
7295,
13,
1678,
23466,
29922,
348,
27958,
29889,
3057,
10036,
580,
13,
1678,
736,
23466,
29889,
1359,
24376,
4591,
3057,
8259,
29898,
3057,
29897,
13,
13,
361,
4770,
978,
1649,
1360,
29915,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
1626,
3057,
16802,
2141,
3389,
29898,
1688,
29918,
13495,
3101,
13,
2
] |
databasetools/projectiontest.py | salhasalman/DatabaseTools | 0 | 145558 | # pew in databasetools-venv python /home/hayj/wm-dist-tmp/DatabaseTools/databasetools/projectiontest.py
import sys, os; sys.path.append("/".join(os.path.abspath(__file__).split("/")[0:-2]))
import pymongo
import random
import string
import time
from systemtools.system import *
from systemtools.duration import *
# We init db name, host...:
dbTest = "student"
host = "localhost"
port = "27017"
# We init users:
if isHostname("hjlat"):
user = None
password = None
elif isHostname("datascience01"):
user = "student"
password = "<PASSWORD>"
else:
print("Pls execute on hjlat or datascience01.") ; exit()
# We make the mongo scheme:
mongoConnectionScheme = "mongodb://" + host + ":" + port
if user is not None:
mongoConnectionScheme = "mongodb://" + user + ":" + password + "@" + host + ":" + port
myclient = pymongo.MongoClient(mongoConnectionScheme)
# The function which create a fake collection:
def createFakeCollection(alwaysRecreate=True):
collectionName = "usercrawl"
mydb = myclient[dbTest]
mycol = mydb[collectionName]
if alwaysRecreate or (mycol.count({}) < 100 and (collectionName == "test" or collectionName == "student")):
mycol.create_index("user_id")
mycol.delete_many({})
for i in range(1000):
text = ""
for u in range(1000):
text += ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
o = {"timestamp": time.time(), "text": text, "user_id": i + 5000}
mycol.insert_one(o)
return mycol
def getUserCrawl():
if not isHostname("datascience01"):
print("Pls execute on datascience01.") ; exit()
mydb = myclient["twitter"]
return mydb["usercrawl"]
def copyUserCrawlCollection(copyCount=1000, alwaysRecreate=False):
mydb = myclient["twitter"]
userCrawl = mydb["usercrawl"]
mydbTest = myclient[dbTest]
testCol = mydbTest[dbTest]
testCol.create_index("user_id")
if alwaysRecreate or testCol.count() < copyCount:
testCol.delete_many({})
i = 0
for row in userCrawl.find({}):
del row["_id"]
testCol.insert_one(row)
if i >= copyCount:
break
if i % int(copyCount / 50) == 0:
print(str(int(i / copyCount * 100)) + "%")
i += 1
return testCol
# for row in mycol.find({}):
# if not dictContains(row, "user_id"):
# print("FUCK")
# print(row["url"])
# exit()
tt = TicToc()
tt.tic()
mycol = createFakeCollection(alwaysRecreate=False)
# mycol = createFakeCollection(alwaysRecreate=True)
# mycol = getUserCrawl()
# mycol = copyUserCrawlCollection()
tt.tic("collection init DONE")
iterationMaxCount = 20
print("Test started.")
i = 0
for row in mycol.find({}):
if i % int(iterationMaxCount / 3) == 0:
print(str(i) + ": " + str(lts(row)[0:60]))
if i > iterationMaxCount:
break
i += 1
tt.tic("Find done.")
iterationMaxCount = 200
i = 0
for row in mycol.distinct("user_id"):
if i % int(iterationMaxCount / 3) == 0:
print(str(i) + ": " + str(row)[0:60])
if i > 200:
break
i += 1
tt.tic("Find distincts done.")
i = 0
for row in mycol.find({}, projection={"user_id": True}):
if i % int(iterationMaxCount / 3) == 0:
print(str(i) + ": " + str(lts(row)[0:60]))
if i > 200:
break
i += 1
tt.tic("Find with projection done.")
| [
1,
396,
282,
809,
297,
16236,
24541,
8789,
29899,
854,
29894,
3017,
847,
5184,
29914,
29882,
388,
29926,
29914,
29893,
29885,
29899,
5721,
29899,
7050,
29914,
9112,
24183,
29914,
29503,
24541,
8789,
29914,
771,
6929,
1688,
29889,
2272,
13,
13,
5215,
10876,
29892,
2897,
29936,
10876,
29889,
2084,
29889,
4397,
11974,
1642,
7122,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
22168,
1445,
1649,
467,
5451,
11974,
1159,
29961,
29900,
13018,
29906,
12622,
13,
13,
5215,
282,
962,
7443,
13,
5215,
4036,
13,
5215,
1347,
13,
5215,
931,
13,
13,
3166,
1788,
8504,
29889,
5205,
1053,
334,
13,
3166,
1788,
8504,
29889,
19708,
1053,
334,
13,
13,
29937,
1334,
2069,
4833,
1024,
29892,
3495,
856,
29901,
13,
2585,
3057,
353,
376,
18945,
29908,
13,
3069,
353,
376,
7640,
29908,
13,
637,
353,
376,
29906,
29955,
29900,
29896,
29955,
29908,
13,
13,
29937,
1334,
2069,
4160,
29901,
13,
361,
338,
8514,
978,
703,
29882,
29926,
5066,
29908,
1125,
13,
12,
1792,
353,
6213,
13,
12,
5630,
353,
6213,
13,
23681,
338,
8514,
978,
703,
14538,
15277,
29900,
29896,
29908,
1125,
13,
12,
1792,
353,
376,
18945,
29908,
13,
12,
5630,
353,
9872,
25711,
17013,
11903,
13,
2870,
29901,
13,
12,
2158,
703,
29925,
3137,
6222,
373,
298,
29926,
5066,
470,
6155,
15277,
29900,
29896,
23157,
2056,
6876,
580,
13,
13,
29937,
1334,
1207,
278,
19476,
11380,
29901,
13,
29885,
7443,
5350,
4504,
2004,
353,
376,
23264,
597,
29908,
718,
3495,
718,
376,
6160,
718,
2011,
13,
361,
1404,
338,
451,
6213,
29901,
13,
12,
29885,
7443,
5350,
4504,
2004,
353,
376,
23264,
597,
29908,
718,
1404,
718,
376,
6160,
718,
4800,
718,
376,
5507,
718,
3495,
718,
376,
6160,
718,
2011,
13,
1357,
4645,
353,
282,
962,
7443,
29889,
29924,
7443,
4032,
29898,
29885,
7443,
5350,
4504,
2004,
29897,
13,
13,
29937,
450,
740,
607,
1653,
263,
25713,
4333,
29901,
13,
1753,
1653,
29943,
1296,
7196,
29898,
21936,
4789,
3015,
29922,
5574,
1125,
13,
12,
10855,
1170,
353,
376,
1792,
29883,
1610,
29880,
29908,
13,
12,
1357,
2585,
353,
590,
4645,
29961,
2585,
3057,
29962,
13,
12,
1357,
1054,
353,
590,
2585,
29961,
10855,
1170,
29962,
13,
12,
361,
2337,
4789,
3015,
470,
313,
1357,
1054,
29889,
2798,
3319,
1800,
529,
29871,
29896,
29900,
29900,
322,
313,
10855,
1170,
1275,
376,
1688,
29908,
470,
4333,
1170,
1275,
376,
18945,
5783,
29901,
13,
12,
12,
1357,
1054,
29889,
3258,
29918,
2248,
703,
1792,
29918,
333,
1159,
13,
12,
12,
1357,
1054,
29889,
8143,
29918,
13011,
3319,
1800,
13,
12,
12,
1454,
474,
297,
3464,
29898,
29896,
29900,
29900,
29900,
1125,
13,
12,
12,
12,
726,
353,
5124,
13,
12,
12,
12,
1454,
318,
297,
3464,
29898,
29896,
29900,
29900,
29900,
1125,
13,
12,
12,
12,
12,
726,
4619,
525,
4286,
7122,
29898,
8172,
29889,
16957,
29898,
1807,
29889,
294,
18869,
29918,
21064,
4878,
718,
1347,
29889,
7501,
1169,
29897,
363,
903,
297,
3464,
29898,
29896,
29900,
876,
13,
12,
12,
12,
29877,
353,
8853,
16394,
1115,
931,
29889,
2230,
3285,
376,
726,
1115,
1426,
29892,
376,
1792,
29918,
333,
1115,
474,
718,
29871,
29945,
29900,
29900,
29900,
29913,
13,
12,
12,
12,
1357,
1054,
29889,
7851,
29918,
650,
29898,
29877,
29897,
13,
12,
2457,
590,
1054,
13,
13,
1753,
679,
2659,
29907,
1610,
29880,
7295,
13,
12,
361,
451,
338,
8514,
978,
703,
14538,
15277,
29900,
29896,
29908,
1125,
13,
12,
12,
2158,
703,
29925,
3137,
6222,
373,
6155,
15277,
29900,
29896,
23157,
2056,
6876,
580,
13,
12,
1357,
2585,
353,
590,
4645,
3366,
24946,
3108,
13,
12,
2457,
590,
2585,
3366,
1792,
29883,
1610,
29880,
3108,
13,
13,
13,
1753,
3509,
2659,
29907,
1610,
29880,
7196,
29898,
8552,
3981,
29922,
29896,
29900,
29900,
29900,
29892,
2337,
4789,
3015,
29922,
8824,
1125,
13,
12,
1357,
2585,
353,
590,
4645,
3366,
24946,
3108,
13,
12,
1792,
29907,
1610,
29880,
353,
590,
2585,
3366,
1792,
29883,
1610,
29880,
3108,
13,
12,
1357,
2585,
3057,
353,
590,
4645,
29961,
2585,
3057,
29962,
13,
12,
1688,
1625,
353,
590,
2585,
3057,
29961,
2585,
3057,
29962,
13,
12,
1688,
1625,
29889,
3258,
29918,
2248,
703,
1792,
29918,
333,
1159,
13,
12,
361,
2337,
4789,
3015,
470,
1243,
1625,
29889,
2798,
580,
529,
3509,
3981,
29901,
13,
12,
12,
1688,
1625,
29889,
8143,
29918,
13011,
3319,
1800,
13,
12,
12,
29875,
353,
29871,
29900,
13,
12,
12,
1454,
1948,
297,
1404,
29907,
1610,
29880,
29889,
2886,
3319,
29913,
1125,
13,
12,
12,
12,
6144,
1948,
3366,
29918,
333,
3108,
13,
12,
12,
12,
1688,
1625,
29889,
7851,
29918,
650,
29898,
798,
29897,
13,
12,
12,
12,
361,
474,
6736,
3509,
3981,
29901,
13,
12,
12,
12,
12,
8690,
13,
12,
12,
12,
361,
474,
1273,
938,
29898,
8552,
3981,
847,
29871,
29945,
29900,
29897,
1275,
29871,
29900,
29901,
13,
12,
12,
12,
12,
2158,
29898,
710,
29898,
524,
29898,
29875,
847,
3509,
3981,
334,
29871,
29896,
29900,
29900,
876,
718,
11860,
1159,
13,
12,
12,
12,
29875,
4619,
29871,
29896,
13,
12,
2457,
1243,
1625,
13,
13,
13,
13,
29937,
363,
1948,
297,
590,
1054,
29889,
2886,
3319,
29913,
1125,
13,
29937,
29871,
12,
361,
451,
9657,
21409,
29898,
798,
29892,
376,
1792,
29918,
333,
29908,
1125,
13,
29937,
29871,
12,
12,
2158,
703,
29943,
29965,
7077,
1159,
13,
29937,
29871,
12,
12,
2158,
29898,
798,
3366,
2271,
20068,
13,
29937,
29871,
12,
12,
13322,
580,
13,
13,
698,
353,
323,
293,
29911,
542,
580,
13,
698,
29889,
29873,
293,
580,
13,
1357,
1054,
353,
1653,
29943,
1296,
7196,
29898,
21936,
4789,
3015,
29922,
8824,
29897,
13,
29937,
590,
1054,
353,
1653,
29943,
1296,
7196,
29898,
21936,
4789,
3015,
29922,
5574,
29897,
13,
29937,
590,
1054,
353,
679,
2659,
29907,
1610,
29880,
580,
13,
29937,
590,
1054,
353,
3509,
2659,
29907,
1610,
29880,
7196,
580,
13,
698,
29889,
29873,
293,
703,
10855,
2069,
360,
12413,
1159,
13,
13,
1524,
362,
7976,
3981,
353,
29871,
29906,
29900,
13,
2158,
703,
3057,
4687,
23157,
13,
29875,
353,
29871,
29900,
13,
1454,
1948,
297,
590,
1054,
29889,
2886,
3319,
29913,
1125,
13,
12,
361,
474,
1273,
938,
29898,
1524,
362,
7976,
3981,
847,
29871,
29941,
29897,
1275,
29871,
29900,
29901,
13,
12,
12,
2158,
29898,
710,
29898,
29875,
29897,
718,
29242,
376,
718,
851,
29898,
29880,
1372,
29898,
798,
9601,
29900,
29901,
29953,
29900,
12622,
13,
12,
361,
474,
1405,
12541,
7976,
3981,
29901,
13,
12,
12,
8690,
13,
12,
29875,
4619,
29871,
29896,
13,
698,
29889,
29873,
293,
703,
12542,
2309,
23157,
13,
13,
1524,
362,
7976,
3981,
353,
29871,
29906,
29900,
29900,
13,
29875,
353,
29871,
29900,
13,
1454,
1948,
297,
590,
1054,
29889,
5721,
5562,
703,
1792,
29918,
333,
29908,
1125,
13,
12,
361,
474,
1273,
938,
29898,
1524,
362,
7976,
3981,
847,
29871,
29941,
29897,
1275,
29871,
29900,
29901,
13,
12,
12,
2158,
29898,
710,
29898,
29875,
29897,
718,
29242,
376,
718,
851,
29898,
798,
9601,
29900,
29901,
29953,
29900,
2314,
13,
12,
361,
474,
1405,
29871,
29906,
29900,
29900,
29901,
13,
12,
12,
8690,
13,
12,
29875,
4619,
29871,
29896,
13,
698,
29889,
29873,
293,
703,
12542,
8359,
29879,
2309,
23157,
13,
13,
29875,
353,
29871,
29900,
13,
1454,
1948,
297,
590,
1054,
29889,
2886,
3319,
1118,
18246,
3790,
29908,
1792,
29918,
333,
1115,
5852,
29913,
1125,
13,
12,
361,
474,
1273,
938,
29898,
1524,
362,
7976,
3981,
847,
29871,
29941,
29897,
1275,
29871,
29900,
29901,
13,
12,
12,
2158,
29898,
710,
29898,
29875,
29897,
718,
29242,
376,
718,
851,
29898,
29880,
1372,
29898,
798,
9601,
29900,
29901,
29953,
29900,
12622,
13,
12,
361,
474,
1405,
29871,
29906,
29900,
29900,
29901,
13,
12,
12,
8690,
13,
12,
29875,
4619,
29871,
29896,
13,
698,
29889,
29873,
293,
703,
12542,
411,
18246,
2309,
23157,
13,
13,
2
] |
dev/otu_handler.py | michaelwiest/microbiome_rnn | 0 | 185844 | <filename>dev/otu_handler.py<gh_stars>0
import copy
import pandas as pd
import numpy as np
from scipy.stats.mstats import gmean, zscore
'''
This is the main object that handles the OTU data.
It has a few main functions:
1. Managing data normalization.
2. Managing training, validation, and test data.
3. Data sampling.
All of the different models use this data handler to get data samples.
'''
def clr(some_array, axis):
'''
Had to reimplement this because the server is python2 and
skbio is only python3
'''
gms = gmean(some_array, axis=axis)
gms = np.expand_dims(gms, axis=axis)
gms = np.repeat(gms, some_array.shape[axis], axis=axis)
return np.log(some_array / gms)
class OTUHandler(object):
'''
Class for handling OTU data. It generates samples and keeps track of
training and validation data.
'''
def __init__(self, files, test_files=None):
# Read in the sample data.
self.samples = []
for f in files:
self.samples.append(pd.read_csv(f, index_col=0))
# If test_files are provided then read them in.
if test_files is not None:
self.test_data = []
for f in test_files:
self.test_data.append(pd.read_csv(f, index_col=0))
else:
self.test_data = None
# Helper variables that are used elsewhere in the code.
self.strains = list(self.samples[0].index.values)
self.num_strains = len(self.strains)
# These get set when calling set_train_val
self.train_data = None
self.val_data = None
def set_train_val(self, percent=0.8, minsize=20):
'''
Set the training and validation data for each sample. Can include
a lower bound on size of train/validation
'''
# For keeping track of the minimum size that the train/val data need to be.
self.min_len = minsize
# To be populated.
self.train_data = []
self.val_data = []
temp_sizes = []
# Go through each of the samples.
for i, sample in enumerate(self.samples):
# Where in the sample to set the split.
index = int(percent * sample.shape[1])
# If not enough examples, skip this file.
if not ((sample.iloc[:, :index].shape[1]) < minsize or
(sample.iloc[:, index:].shape[1]) < minsize):
# Append the new data to the appropriate location.
self.train_data.append(sample.iloc[:, :index])
self.val_data.append(sample.iloc[:, index:])
else:
# If it's too small only use it as training data.
print('Skipping file, {}, because it\'s of shape: {}'.format(i, sample.shape))
self.train_data.append(sample)
def normalize_data(self, method='zscore'):
'''
Method for normalizing the input data. This can currently zscore and
clr the data. Other methods could be added.
'''
method = method.lower()
if method not in ['zscore', 'clr']:
raise ValueError('Specify "zscore" or "clr" for method')
if method == 'zscore':
m = zscore
else:
m = clr
# Keep track of the new data.
new_vals = []
for i, which_data in enumerate([self.samples, self.test_data]):
# This is in case the test data is not supplied.
if which_data is not None:
new_vals = []
# For each of the dataframes.
for s in which_data:
# Apply the normalization method.
new_vals.append(pd.DataFrame(m(s.values, axis=0),
index=s.index,
columns=s.columns))
# This is sort of a hack which is annoying.
# Basically set the data to be the normalized version.
if i == 0:
self.samples = new_vals
elif i == 1:
self.test_data = new_vals
def get_N_samples_and_targets(self, N, input_slice_size,
target_slice_size,
which_data='train',
target_slice=True,
slice_offset=1,
which_donor=None):
'''
This is the main function for generating samples of data with which
to train the neural network.
Returns two things, an input and a target (both numpy arrays):
input:[N x num_otus x input_slice_size]
target: [N x num_otus x target_slice_size]
Selects N random examples from all possible training samples.
It selects from them based upon the number of timepoints present in
each donor. So donors with more data get sampled more often.
'''
# What data source to sample from.
which_data = which_data.lower()
if which_data not in ['train', 'validation', 'test']:
raise ValueError('Please specify either: train, validaiton, or test'
' for argument "which_sample"')
if self.test_data is None and which_data == 'test':
raise ValueError('Do not select for test data when none is set.')
# Set the appropriate location.
if which_data == 'train':
data_source = self.train_data
elif which_data == 'validation':
data_source = self.val_data
elif which_data == 'test':
data_source = self.test_data
samples = [] # Samples to feed to the model.
targets = [] # Targets to compare predictions against.
# If train validation split hasn't been specified.
if self.train_data is None:
raise AttributeError('Please specify train and val data before '
'calling this function.')
# This flag is for generating samples from a particular donor.
# During training this is always set as None so that it samples from
# a distribution.
if which_donor is None:
# Samples from data based on number of samples. Ie, samples with more
# data points get more selection.
all_sizes = [d.shape[1] for d in data_source]
probs = [s / (1.0 * sum(all_sizes)) for s in all_sizes]
# Get the samples based on sizes.
which_samples = np.random.choice(len(data_source), N, p=probs)
else:
# If we know what donor we want then only sample from that one.
which_samples = [which_donor] * N
# For each of the specified samples to pick.
for ws in which_samples:
sample = data_source[ws]
# Pick a random starting point in the example. Get the data in
# that slice and then the values immediately after.
start_index = np.random.randint(sample.shape[1] - input_slice_size - target_slice_size)
data = sample.iloc[:, start_index: start_index + input_slice_size].values
# For the LSTM and EncoderDecoer we want a whole slice of values
# to compare against. Not just a single target like in the FFN.
# Now this just increments the input by one position for the target.
if not target_slice:
target = sample.iloc[:, start_index + input_slice_size].values
else:
target = sample.iloc[:, start_index + slice_offset:
start_index + target_slice_size + slice_offset].values
# Store all the values
samples.append(data)
targets.append(target)
samples = np.array(samples)
targets = np.array(targets)
return samples, targets
| [
1,
529,
9507,
29958,
3359,
29914,
327,
29884,
29918,
13789,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
3509,
13,
5215,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
3166,
4560,
2272,
29889,
16202,
29889,
29885,
16202,
1053,
330,
12676,
29892,
503,
13628,
13,
13,
12008,
13,
4013,
29871,
338,
278,
1667,
1203,
393,
17766,
278,
438,
29911,
29965,
848,
29889,
13,
3112,
756,
263,
2846,
1667,
3168,
29901,
13,
268,
29896,
29889,
2315,
6751,
848,
4226,
2133,
29889,
13,
268,
29906,
29889,
2315,
6751,
6694,
29892,
8845,
29892,
322,
1243,
848,
29889,
13,
268,
29941,
29889,
3630,
23460,
29889,
13,
3596,
310,
278,
1422,
4733,
671,
445,
848,
7834,
304,
679,
848,
11916,
29889,
13,
12008,
13,
13,
1753,
1067,
29878,
29898,
5372,
29918,
2378,
29892,
9685,
1125,
13,
1678,
14550,
13,
1678,
14302,
304,
337,
326,
2037,
445,
1363,
278,
1923,
338,
3017,
29906,
322,
13,
1678,
2071,
24840,
338,
871,
3017,
29941,
13,
1678,
14550,
13,
1678,
330,
1516,
353,
330,
12676,
29898,
5372,
29918,
2378,
29892,
9685,
29922,
8990,
29897,
13,
1678,
330,
1516,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
29887,
1516,
29892,
9685,
29922,
8990,
29897,
13,
1678,
330,
1516,
353,
7442,
29889,
14358,
29898,
29887,
1516,
29892,
777,
29918,
2378,
29889,
12181,
29961,
8990,
1402,
9685,
29922,
8990,
29897,
13,
1678,
736,
7442,
29889,
1188,
29898,
5372,
29918,
2378,
847,
330,
1516,
29897,
13,
13,
13,
13,
1990,
438,
29911,
29965,
4598,
29898,
3318,
1125,
13,
1678,
14550,
13,
1678,
4134,
363,
11415,
438,
29911,
29965,
848,
29889,
739,
16785,
11916,
322,
14874,
5702,
310,
13,
1678,
6694,
322,
8845,
848,
29889,
13,
1678,
14550,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2066,
29892,
1243,
29918,
5325,
29922,
8516,
1125,
13,
4706,
396,
7523,
297,
278,
4559,
848,
29889,
13,
4706,
1583,
29889,
27736,
353,
5159,
13,
4706,
363,
285,
297,
2066,
29901,
13,
9651,
1583,
29889,
27736,
29889,
4397,
29898,
15926,
29889,
949,
29918,
7638,
29898,
29888,
29892,
2380,
29918,
1054,
29922,
29900,
876,
13,
4706,
396,
960,
1243,
29918,
5325,
526,
4944,
769,
1303,
963,
297,
29889,
13,
4706,
565,
1243,
29918,
5325,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
1688,
29918,
1272,
353,
5159,
13,
9651,
363,
285,
297,
1243,
29918,
5325,
29901,
13,
18884,
1583,
29889,
1688,
29918,
1272,
29889,
4397,
29898,
15926,
29889,
949,
29918,
7638,
29898,
29888,
29892,
2380,
29918,
1054,
29922,
29900,
876,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1688,
29918,
1272,
353,
6213,
13,
13,
4706,
396,
6162,
546,
3651,
393,
526,
1304,
17551,
297,
278,
775,
29889,
13,
4706,
1583,
29889,
4151,
1144,
353,
1051,
29898,
1311,
29889,
27736,
29961,
29900,
1822,
2248,
29889,
5975,
29897,
13,
4706,
1583,
29889,
1949,
29918,
4151,
1144,
353,
7431,
29898,
1311,
29889,
4151,
1144,
29897,
13,
4706,
396,
4525,
679,
731,
746,
5432,
731,
29918,
14968,
29918,
791,
13,
4706,
1583,
29889,
14968,
29918,
1272,
353,
6213,
13,
4706,
1583,
29889,
791,
29918,
1272,
353,
6213,
13,
13,
1678,
822,
731,
29918,
14968,
29918,
791,
29898,
1311,
29892,
10151,
29922,
29900,
29889,
29947,
29892,
286,
1144,
675,
29922,
29906,
29900,
1125,
13,
4706,
14550,
13,
4706,
3789,
278,
6694,
322,
8845,
848,
363,
1269,
4559,
29889,
1815,
3160,
13,
4706,
263,
5224,
3216,
373,
2159,
310,
7945,
29914,
18157,
13,
4706,
14550,
13,
4706,
396,
1152,
12515,
5702,
310,
278,
9212,
2159,
393,
278,
7945,
29914,
791,
848,
817,
304,
367,
29889,
13,
4706,
1583,
29889,
1195,
29918,
2435,
353,
286,
1144,
675,
13,
4706,
396,
1763,
367,
24146,
29889,
13,
4706,
1583,
29889,
14968,
29918,
1272,
353,
5159,
13,
4706,
1583,
29889,
791,
29918,
1272,
353,
5159,
13,
4706,
5694,
29918,
29879,
7093,
353,
5159,
13,
4706,
396,
2921,
1549,
1269,
310,
278,
11916,
29889,
13,
4706,
363,
474,
29892,
4559,
297,
26985,
29898,
1311,
29889,
27736,
1125,
13,
9651,
396,
6804,
297,
278,
4559,
304,
731,
278,
6219,
29889,
13,
9651,
2380,
353,
938,
29898,
25376,
334,
4559,
29889,
12181,
29961,
29896,
2314,
13,
9651,
396,
960,
451,
3307,
6455,
29892,
14383,
445,
934,
29889,
13,
9651,
565,
451,
5135,
11249,
29889,
309,
542,
7503,
29892,
584,
2248,
1822,
12181,
29961,
29896,
2314,
529,
286,
1144,
675,
470,
13,
462,
1678,
313,
11249,
29889,
309,
542,
7503,
29892,
2380,
29901,
1822,
12181,
29961,
29896,
2314,
529,
286,
1144,
675,
1125,
13,
18884,
396,
22871,
278,
716,
848,
304,
278,
8210,
4423,
29889,
13,
18884,
1583,
29889,
14968,
29918,
1272,
29889,
4397,
29898,
11249,
29889,
309,
542,
7503,
29892,
584,
2248,
2314,
13,
18884,
1583,
29889,
791,
29918,
1272,
29889,
4397,
29898,
11249,
29889,
309,
542,
7503,
29892,
2380,
29901,
2314,
13,
9651,
1683,
29901,
13,
18884,
396,
960,
372,
29915,
29879,
2086,
2319,
871,
671,
372,
408,
6694,
848,
29889,
13,
18884,
1596,
877,
29903,
1984,
3262,
934,
29892,
24335,
1363,
372,
20333,
29879,
310,
8267,
29901,
6571,
4286,
4830,
29898,
29875,
29892,
4559,
29889,
12181,
876,
13,
18884,
1583,
29889,
14968,
29918,
1272,
29889,
4397,
29898,
11249,
29897,
13,
13,
1678,
822,
4226,
675,
29918,
1272,
29898,
1311,
29892,
1158,
2433,
29920,
13628,
29374,
13,
4706,
14550,
13,
4706,
8108,
363,
4226,
5281,
278,
1881,
848,
29889,
910,
508,
5279,
503,
13628,
322,
13,
4706,
1067,
29878,
278,
848,
29889,
5901,
3519,
1033,
367,
2715,
29889,
13,
4706,
14550,
13,
4706,
1158,
353,
1158,
29889,
13609,
580,
13,
4706,
565,
1158,
451,
297,
6024,
29920,
13628,
742,
525,
695,
29878,
2033,
29901,
13,
9651,
12020,
7865,
2392,
877,
10299,
1598,
376,
29920,
13628,
29908,
470,
376,
695,
29878,
29908,
363,
1158,
1495,
13,
4706,
565,
1158,
1275,
525,
29920,
13628,
2396,
13,
9651,
286,
353,
503,
13628,
13,
4706,
1683,
29901,
13,
9651,
286,
353,
1067,
29878,
13,
13,
4706,
396,
19152,
5702,
310,
278,
716,
848,
29889,
13,
4706,
716,
29918,
791,
29879,
353,
5159,
13,
4706,
363,
474,
29892,
607,
29918,
1272,
297,
26985,
4197,
1311,
29889,
27736,
29892,
1583,
29889,
1688,
29918,
1272,
29962,
1125,
13,
9651,
396,
910,
338,
297,
1206,
278,
1243,
848,
338,
451,
19056,
29889,
13,
9651,
565,
607,
29918,
1272,
338,
451,
6213,
29901,
13,
18884,
716,
29918,
791,
29879,
353,
5159,
13,
18884,
396,
1152,
1269,
310,
278,
848,
19935,
29889,
13,
18884,
363,
269,
297,
607,
29918,
1272,
29901,
13,
462,
1678,
396,
2401,
368,
278,
4226,
2133,
1158,
29889,
13,
462,
1678,
716,
29918,
791,
29879,
29889,
4397,
29898,
15926,
29889,
17271,
29898,
29885,
29898,
29879,
29889,
5975,
29892,
9685,
29922,
29900,
511,
13,
462,
462,
462,
2380,
29922,
29879,
29889,
2248,
29892,
13,
462,
462,
462,
4341,
29922,
29879,
29889,
13099,
876,
13,
13,
18884,
396,
910,
338,
2656,
310,
263,
15833,
607,
338,
12327,
5414,
29889,
13,
18884,
396,
13702,
731,
278,
848,
304,
367,
278,
4226,
1891,
1873,
29889,
13,
18884,
565,
474,
1275,
29871,
29900,
29901,
13,
462,
1678,
1583,
29889,
27736,
353,
716,
29918,
791,
29879,
13,
18884,
25342,
474,
1275,
29871,
29896,
29901,
13,
462,
1678,
1583,
29889,
1688,
29918,
1272,
353,
716,
29918,
791,
29879,
13,
13,
1678,
822,
679,
29918,
29940,
29918,
27736,
29918,
392,
29918,
5182,
29879,
29898,
1311,
29892,
405,
29892,
1881,
29918,
18337,
29918,
2311,
29892,
13,
462,
462,
29871,
3646,
29918,
18337,
29918,
2311,
29892,
13,
462,
462,
29871,
607,
29918,
1272,
2433,
14968,
742,
13,
462,
462,
29871,
3646,
29918,
18337,
29922,
5574,
29892,
13,
462,
462,
29871,
22780,
29918,
10289,
29922,
29896,
29892,
13,
462,
462,
29871,
607,
29918,
9176,
272,
29922,
8516,
1125,
13,
4706,
14550,
13,
4706,
910,
338,
278,
1667,
740,
363,
14655,
11916,
310,
848,
411,
607,
13,
4706,
304,
7945,
278,
19677,
3564,
29889,
13,
13,
4706,
16969,
1023,
2712,
29892,
385,
1881,
322,
263,
3646,
313,
20313,
12655,
7049,
1125,
13,
9651,
1881,
10834,
29940,
921,
954,
29918,
327,
375,
921,
1881,
29918,
18337,
29918,
2311,
29962,
13,
9651,
3646,
29901,
518,
29940,
921,
954,
29918,
327,
375,
921,
3646,
29918,
18337,
29918,
2311,
29962,
13,
13,
4706,
7605,
29879,
405,
4036,
6455,
515,
599,
1950,
6694,
11916,
29889,
13,
4706,
739,
27778,
515,
963,
2729,
2501,
278,
1353,
310,
931,
9748,
2198,
297,
13,
4706,
1269,
1016,
272,
29889,
1105,
1016,
943,
411,
901,
848,
679,
4559,
29881,
901,
4049,
29889,
13,
4706,
14550,
13,
13,
4706,
396,
1724,
848,
2752,
304,
4559,
515,
29889,
13,
4706,
607,
29918,
1272,
353,
607,
29918,
1272,
29889,
13609,
580,
13,
4706,
565,
607,
29918,
1272,
451,
297,
6024,
14968,
742,
525,
18157,
742,
525,
1688,
2033,
29901,
13,
9651,
12020,
7865,
2392,
877,
12148,
6084,
2845,
29901,
7945,
29892,
2854,
1249,
265,
29892,
470,
1243,
29915,
13,
462,
632,
525,
363,
2980,
376,
4716,
29918,
11249,
29908,
1495,
13,
4706,
565,
1583,
29889,
1688,
29918,
1272,
338,
6213,
322,
607,
29918,
1272,
1275,
525,
1688,
2396,
13,
9651,
12020,
7865,
2392,
877,
6132,
451,
1831,
363,
1243,
848,
746,
5642,
338,
731,
29889,
1495,
13,
4706,
396,
3789,
278,
8210,
4423,
29889,
13,
4706,
565,
607,
29918,
1272,
1275,
525,
14968,
2396,
13,
9651,
848,
29918,
4993,
353,
1583,
29889,
14968,
29918,
1272,
13,
4706,
25342,
607,
29918,
1272,
1275,
525,
18157,
2396,
13,
9651,
848,
29918,
4993,
353,
1583,
29889,
791,
29918,
1272,
13,
4706,
25342,
607,
29918,
1272,
1275,
525,
1688,
2396,
13,
9651,
848,
29918,
4993,
353,
1583,
29889,
1688,
29918,
1272,
13,
13,
4706,
11916,
353,
5159,
29871,
396,
3685,
2701,
304,
8343,
304,
278,
1904,
29889,
13,
4706,
22525,
353,
5159,
29871,
396,
17157,
29879,
304,
7252,
27303,
2750,
29889,
13,
13,
4706,
396,
960,
7945,
8845,
6219,
22602,
29915,
29873,
1063,
6790,
29889,
13,
4706,
565,
1583,
29889,
14968,
29918,
1272,
338,
6213,
29901,
13,
9651,
12020,
23833,
2392,
877,
12148,
6084,
7945,
322,
659,
848,
1434,
525,
13,
462,
462,
525,
4804,
292,
445,
740,
29889,
1495,
13,
4706,
396,
910,
7353,
338,
363,
14655,
11916,
515,
263,
3153,
1016,
272,
29889,
13,
4706,
396,
7133,
6694,
445,
338,
2337,
731,
408,
6213,
577,
393,
372,
11916,
515,
13,
4706,
396,
263,
4978,
29889,
13,
4706,
565,
607,
29918,
9176,
272,
338,
6213,
29901,
13,
9651,
396,
3685,
2701,
515,
848,
2729,
373,
1353,
310,
11916,
29889,
306,
29872,
29892,
11916,
411,
901,
13,
9651,
396,
848,
3291,
679,
901,
9262,
29889,
13,
9651,
599,
29918,
29879,
7093,
353,
518,
29881,
29889,
12181,
29961,
29896,
29962,
363,
270,
297,
848,
29918,
4993,
29962,
13,
9651,
2070,
29879,
353,
518,
29879,
847,
313,
29896,
29889,
29900,
334,
2533,
29898,
497,
29918,
29879,
7093,
876,
363,
269,
297,
599,
29918,
29879,
7093,
29962,
13,
9651,
396,
3617,
278,
11916,
2729,
373,
15786,
29889,
13,
9651,
607,
29918,
27736,
353,
7442,
29889,
8172,
29889,
16957,
29898,
2435,
29898,
1272,
29918,
4993,
511,
405,
29892,
282,
29922,
771,
5824,
29897,
13,
4706,
1683,
29901,
13,
9651,
396,
960,
591,
1073,
825,
1016,
272,
591,
864,
769,
871,
4559,
515,
393,
697,
29889,
13,
9651,
607,
29918,
27736,
353,
518,
4716,
29918,
9176,
272,
29962,
334,
405,
13,
13,
4706,
396,
1152,
1269,
310,
278,
6790,
11916,
304,
5839,
29889,
13,
4706,
363,
16904,
297,
607,
29918,
27736,
29901,
13,
9651,
4559,
353,
848,
29918,
4993,
29961,
5652,
29962,
13,
13,
9651,
396,
23868,
263,
4036,
6257,
1298,
297,
278,
1342,
29889,
3617,
278,
848,
297,
13,
9651,
396,
393,
22780,
322,
769,
278,
1819,
7389,
1156,
29889,
13,
9651,
1369,
29918,
2248,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
11249,
29889,
12181,
29961,
29896,
29962,
448,
1881,
29918,
18337,
29918,
2311,
448,
3646,
29918,
18337,
29918,
2311,
29897,
13,
9651,
848,
353,
4559,
29889,
309,
542,
7503,
29892,
1369,
29918,
2248,
29901,
1369,
29918,
2248,
718,
1881,
29918,
18337,
29918,
2311,
1822,
5975,
13,
13,
9651,
396,
1152,
278,
365,
1254,
29924,
322,
11346,
6119,
6185,
29877,
261,
591,
864,
263,
3353,
22780,
310,
1819,
13,
9651,
396,
304,
7252,
2750,
29889,
2216,
925,
263,
2323,
3646,
763,
297,
278,
21379,
29940,
29889,
13,
9651,
396,
2567,
445,
925,
3079,
1860,
278,
1881,
491,
697,
2602,
363,
278,
3646,
29889,
13,
9651,
565,
451,
3646,
29918,
18337,
29901,
13,
18884,
3646,
353,
4559,
29889,
309,
542,
7503,
29892,
1369,
29918,
2248,
718,
1881,
29918,
18337,
29918,
2311,
1822,
5975,
13,
9651,
1683,
29901,
13,
18884,
3646,
353,
4559,
29889,
309,
542,
7503,
29892,
1369,
29918,
2248,
718,
22780,
29918,
10289,
29901,
13,
462,
462,
4706,
1369,
29918,
2248,
718,
3646,
29918,
18337,
29918,
2311,
718,
22780,
29918,
10289,
1822,
5975,
13,
9651,
396,
14491,
599,
278,
1819,
13,
9651,
11916,
29889,
4397,
29898,
1272,
29897,
13,
9651,
22525,
29889,
4397,
29898,
5182,
29897,
13,
13,
4706,
11916,
353,
7442,
29889,
2378,
29898,
27736,
29897,
13,
4706,
22525,
353,
7442,
29889,
2378,
29898,
5182,
29879,
29897,
13,
13,
4706,
736,
11916,
29892,
22525,
13,
2
] |
pos_tagger/pos_replace_v5.py | ZirconiumZr/UOB_SIT | 0 | 1617223 | <gh_stars>0
# -*- coding: utf-8 -*-
"""pos_replace_v5.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Mdfqrn2Nc8xE6xFlAstCmzPeEMCgguP-
"""
import nltk
from nltk import word_tokenize, pos_tag
import pandas as pd
import io
from nltk.tokenize.treebank import TreebankWordDetokenizer
try:
nltk.data.find('tokenizers/punkt')
except LookupError:
nltk.download('punkt')
try:
nltk.data.find('taggers/averaged_perceptron_tagger')
except LookupError:
nltk.download('averaged_perceptron_tagger')
try:
nltk.data.find('taggers/universal_tagset')
except LookupError:
nltk.download('universal_tagset')
template = pd.read_csv('/content/replace_template.csv')
# template=template.fillna('')
text1 = "i'm fine at your bb and u o p is a bank"
text2 = "i'm from uob and i'm fine in u o b"
text3 = "you can get youll be credit card"
def pos_replace(l, template):
'''
l: the stt sentence
template: DataFrame, read as csv from stt_replace_template.txt
pos_tag reference: https://universaldependencies.org/u/pos/all.html#al-u-pos/
'''
flag_change = ""
words = word_tokenize(l)
# l_r = TreebankWordDetokenizer().detokenize(words)
l_r = " ".join(words)
for i in range(len(template)):
row = template.iloc[i]
pos_before = str(row['pos_before']).split(';')
pos_after = str(row['pos_after']).split(';')
replace_list = str(row['replace']).split(';')
flag_direct_replace = str(row['flag_direct_replace'])
key = word_tokenize(row['key'])
for p in replace_list:
p_w = word_tokenize(p)
# p_s = TreebankWordDetokenizer().detokenize(p_w)
p_s = " ".join(p_w)
if p_s in l_r:
# p_w = word_tokenize(p)
lenth_p = len(p_w)
words = word_tokenize(l_r)
words_pos = pos_tag(words, tagset='universal')
lenth_w = len(words)
# r_len = lenth_w-lenth_p+1
if flag_direct_replace.lower() == "x":
i = 0
# for i in range(lenth_w-lenth_p+1):
while i < lenth_w-lenth_p+1:
# print(i)
if words[i:i+lenth_p]==p_w:
print('directly replace', p, 'with',row[0])
words[i:i+lenth_p] = key
words_pos = pos_tag(words, tagset='universal')
lenth_w = len(words)
# r_len = lenth_w-lenth_p+1
flag_change = "x"
i += 1
else:
# for i in range(lenth_w-lenth_p+1):
i = 0
while i < lenth_w-lenth_p+1:
# print(i)
if words[i:i+lenth_p]==p_w:
if words_pos[i-1][1] in pos_before:
print('the pos of the word before', p, 'is',words_pos[i-1][1])
words[i:i+lenth_p] = key
words_pos = pos_tag(words, tagset='universal')
lenth_w = len(words)
# r_len = lenth_w-lenth_p+1
flag_change = "x"
# l_r=l_r.replace(p, row[0])
# l_r = " ".join(words)
# print(l_r)
elif i+lenth_p<len(words) and words_pos[i+lenth_p][1] in pos_after:
print('the pos of the word after', p, 'is',words_pos[i+lenth_p][1])
words[i:i+lenth_p] = key
words_pos = pos_tag(words, tagset='universal')
lenth_w = len(words)
# r_len = lenth_w-lenth_p+1
flag_change = "x"
# l_r=l_r.replace(p, row[0])
# l_r = " ".join(words)
# print(l_r)
i += 1
if flag_change == "x":
print(l_r)
l_r = " ".join(words)
# l_r = TreebankWordDetokenizer().detokenize(words)
print(l_r)
flag_change = ""
# l_r = l
# for i in range(len(template)): # get every row in the template
# row = template.iloc[i]
# pos_before = str(row['pos_before']).split(';')
# pos_after = str(row['pos_after']).split(';')
# replace_list = str(row['replace']).split(';')
# print('replace_list:',replace_list)
# for p in replace_list: # get each element in replace_list of template row[i]
# print('find p for=', p)
# if p in l_r:
# print('find p if=', p)
# # y = p.replace(' ','')
# y = re.sub(r'[^\w\s]','',p) # replace punctuations to blank str
# print('y: ',y)
# interim = l_r.replace(p, y)
# words = word_tokenize(interim)
# interim_pos = pos_tag(words, tagset='universal')
# index_=[i for i,x in enumerate(interim_pos) if x[0]==y]
# for i in index_:
# if interim_pos[i-1][1] in pos_before:
# print('the pos of the word before', p, 'is',interim_pos[i-1][1])
# words[i] = row[0]
# # l_r=l_r.replace(p, row[0])
# l_r = " ".join(words)
# print(l_r)
# elif interim_pos[i+1][1] in pos_after:
# print('the pos of the word after', p, 'is',interim_pos[i+1][1])
# words[i] = row[0]
# # l_r=l_r.replace(p, row[0])
# l_r = " ".join(words)
# print(l_r)
return l_r
pos_replace(text1, template)
pos_replace(text2, template)
pos_replace(text3, template) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
1066,
29918,
6506,
29918,
29894,
29945,
29889,
666,
948,
29890,
13,
13,
28451,
19574,
5759,
491,
1530,
3717,
7606,
29889,
13,
13,
26036,
934,
338,
5982,
472,
13,
1678,
2045,
597,
1054,
370,
29889,
690,
2842,
29889,
3608,
29889,
510,
29914,
21594,
29914,
29896,
29924,
2176,
29939,
27539,
29906,
29940,
29883,
29947,
29916,
29923,
29953,
29916,
8754,
29909,
303,
29907,
29885,
29920,
15666,
29923,
12513,
1505,
29884,
29925,
29899,
13,
15945,
29908,
13,
13,
5215,
302,
1896,
29895,
13,
3166,
302,
1896,
29895,
1053,
1734,
29918,
6979,
675,
29892,
926,
29918,
4039,
13,
5215,
11701,
408,
10518,
13,
5215,
12013,
29871,
13,
3166,
302,
1896,
29895,
29889,
6979,
675,
29889,
2484,
774,
804,
1053,
6479,
774,
804,
14463,
6362,
4476,
3950,
13,
13,
2202,
29901,
13,
29871,
302,
1896,
29895,
29889,
1272,
29889,
2886,
877,
6979,
19427,
29914,
19294,
1495,
13,
19499,
7419,
786,
2392,
29901,
13,
29871,
302,
1896,
29895,
29889,
10382,
877,
19294,
1495,
13,
13,
2202,
29901,
13,
29871,
302,
1896,
29895,
29889,
1272,
29889,
2886,
877,
4039,
5743,
29914,
12483,
4063,
29918,
546,
1547,
1617,
29918,
4039,
914,
1495,
13,
19499,
7419,
786,
2392,
29901,
13,
29871,
302,
1896,
29895,
29889,
10382,
877,
12483,
4063,
29918,
546,
1547,
1617,
29918,
4039,
914,
1495,
13,
13,
2202,
29901,
13,
29871,
302,
1896,
29895,
29889,
1272,
29889,
2886,
877,
4039,
5743,
29914,
14540,
284,
29918,
11338,
300,
1495,
13,
19499,
7419,
786,
2392,
29901,
13,
29871,
302,
1896,
29895,
29889,
10382,
877,
14540,
284,
29918,
11338,
300,
1495,
13,
13,
6886,
353,
10518,
29889,
949,
29918,
7638,
11219,
3051,
29914,
6506,
29918,
6886,
29889,
7638,
1495,
13,
13,
29937,
4472,
29922,
6886,
29889,
5589,
1056,
877,
1495,
13,
13,
726,
29896,
353,
376,
29875,
29915,
29885,
2691,
472,
596,
289,
29890,
322,
318,
288,
282,
338,
263,
9124,
29908,
13,
13,
726,
29906,
353,
376,
29875,
29915,
29885,
515,
318,
711,
322,
474,
29915,
29885,
2691,
297,
318,
288,
289,
29908,
13,
13,
726,
29941,
353,
376,
6293,
508,
679,
366,
645,
367,
16200,
5881,
29908,
13,
13,
1753,
926,
29918,
6506,
29898,
29880,
29892,
4472,
1125,
13,
1678,
14550,
13,
1678,
301,
29901,
278,
380,
29873,
10541,
13,
1678,
4472,
29901,
3630,
4308,
29892,
1303,
408,
11799,
515,
380,
29873,
29918,
6506,
29918,
6886,
29889,
3945,
13,
1678,
926,
29918,
4039,
3407,
29901,
2045,
597,
14540,
284,
22594,
29889,
990,
29914,
29884,
29914,
1066,
29914,
497,
29889,
1420,
29937,
284,
29899,
29884,
29899,
1066,
29914,
13,
1678,
14550,
13,
1678,
7353,
29918,
3167,
353,
5124,
13,
1678,
3838,
353,
1734,
29918,
6979,
675,
29898,
29880,
29897,
13,
1678,
396,
301,
29918,
29878,
353,
6479,
774,
804,
14463,
6362,
4476,
3950,
2141,
4801,
4476,
675,
29898,
9303,
29897,
13,
1678,
301,
29918,
29878,
353,
376,
11393,
7122,
29898,
9303,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
6886,
22164,
13,
4706,
1948,
353,
4472,
29889,
309,
542,
29961,
29875,
29962,
13,
4706,
926,
29918,
11083,
353,
851,
29898,
798,
1839,
1066,
29918,
11083,
2033,
467,
5451,
877,
29936,
1495,
13,
4706,
926,
29918,
7045,
353,
851,
29898,
798,
1839,
1066,
29918,
7045,
2033,
467,
5451,
877,
29936,
1495,
13,
4706,
5191,
29918,
1761,
353,
851,
29898,
798,
1839,
6506,
2033,
467,
5451,
877,
29936,
1495,
13,
4706,
7353,
29918,
11851,
29918,
6506,
353,
851,
29898,
798,
1839,
15581,
29918,
11851,
29918,
6506,
11287,
13,
4706,
1820,
353,
1734,
29918,
6979,
675,
29898,
798,
1839,
1989,
11287,
9651,
13,
4706,
363,
282,
297,
5191,
29918,
1761,
29901,
13,
9651,
282,
29918,
29893,
353,
1734,
29918,
6979,
675,
29898,
29886,
29897,
13,
9651,
396,
282,
29918,
29879,
353,
6479,
774,
804,
14463,
6362,
4476,
3950,
2141,
4801,
4476,
675,
29898,
29886,
29918,
29893,
29897,
13,
9651,
282,
29918,
29879,
353,
376,
11393,
7122,
29898,
29886,
29918,
29893,
29897,
13,
9651,
565,
282,
29918,
29879,
297,
301,
29918,
29878,
29901,
13,
18884,
396,
282,
29918,
29893,
353,
1734,
29918,
6979,
675,
29898,
29886,
29897,
13,
18884,
301,
9097,
29918,
29886,
353,
7431,
29898,
29886,
29918,
29893,
29897,
13,
18884,
3838,
353,
1734,
29918,
6979,
675,
29898,
29880,
29918,
29878,
29897,
13,
18884,
3838,
29918,
1066,
353,
926,
29918,
4039,
29898,
9303,
29892,
8282,
300,
2433,
14540,
284,
1495,
13,
18884,
301,
9097,
29918,
29893,
353,
7431,
29898,
9303,
29897,
13,
18884,
396,
364,
29918,
2435,
353,
301,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
13,
18884,
565,
7353,
29918,
11851,
29918,
6506,
29889,
13609,
580,
1275,
376,
29916,
1115,
13,
462,
1678,
474,
353,
29871,
29900,
13,
462,
1678,
396,
363,
474,
297,
3464,
29898,
29880,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
1125,
13,
462,
1678,
1550,
474,
529,
301,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
29901,
13,
462,
4706,
396,
1596,
29898,
29875,
29897,
13,
462,
4706,
565,
3838,
29961,
29875,
29901,
29875,
29974,
29880,
9097,
29918,
29886,
29962,
1360,
29886,
29918,
29893,
29901,
13,
462,
9651,
1596,
877,
11851,
368,
5191,
742,
282,
29892,
525,
2541,
742,
798,
29961,
29900,
2314,
13,
462,
9651,
3838,
29961,
29875,
29901,
29875,
29974,
29880,
9097,
29918,
29886,
29962,
353,
1820,
13,
462,
9651,
3838,
29918,
1066,
353,
926,
29918,
4039,
29898,
9303,
29892,
8282,
300,
2433,
14540,
284,
1495,
13,
462,
9651,
301,
9097,
29918,
29893,
353,
7431,
29898,
9303,
29897,
13,
462,
9651,
396,
364,
29918,
2435,
353,
301,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
13,
462,
9651,
7353,
29918,
3167,
353,
376,
29916,
29908,
13,
462,
4706,
474,
4619,
29871,
29896,
13,
18884,
1683,
29901,
13,
462,
1678,
396,
363,
474,
297,
3464,
29898,
29880,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
1125,
13,
462,
1678,
474,
353,
29871,
29900,
13,
462,
1678,
1550,
474,
529,
301,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
29901,
13,
462,
4706,
396,
1596,
29898,
29875,
29897,
13,
462,
4706,
565,
3838,
29961,
29875,
29901,
29875,
29974,
29880,
9097,
29918,
29886,
29962,
1360,
29886,
29918,
29893,
29901,
13,
462,
9651,
565,
3838,
29918,
1066,
29961,
29875,
29899,
29896,
3816,
29896,
29962,
297,
926,
29918,
11083,
29901,
13,
462,
18884,
1596,
877,
1552,
926,
310,
278,
1734,
1434,
742,
282,
29892,
525,
275,
742,
9303,
29918,
1066,
29961,
29875,
29899,
29896,
3816,
29896,
2314,
13,
462,
18884,
3838,
29961,
29875,
29901,
29875,
29974,
29880,
9097,
29918,
29886,
29962,
353,
1820,
13,
462,
18884,
3838,
29918,
1066,
353,
926,
29918,
4039,
29898,
9303,
29892,
8282,
300,
2433,
14540,
284,
1495,
13,
462,
18884,
301,
9097,
29918,
29893,
353,
7431,
29898,
9303,
29897,
13,
462,
18884,
396,
364,
29918,
2435,
353,
301,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
13,
462,
18884,
7353,
29918,
3167,
353,
376,
29916,
29908,
13,
462,
18884,
396,
301,
29918,
29878,
29922,
29880,
29918,
29878,
29889,
6506,
29898,
29886,
29892,
1948,
29961,
29900,
2314,
13,
462,
18884,
396,
301,
29918,
29878,
353,
376,
11393,
7122,
29898,
9303,
29897,
13,
462,
18884,
396,
1596,
29898,
29880,
29918,
29878,
29897,
13,
462,
9651,
25342,
474,
29974,
29880,
9097,
29918,
29886,
29966,
2435,
29898,
9303,
29897,
322,
3838,
29918,
1066,
29961,
29875,
29974,
29880,
9097,
29918,
29886,
3816,
29896,
29962,
297,
926,
29918,
7045,
29901,
13,
462,
18884,
1596,
877,
1552,
926,
310,
278,
1734,
1156,
742,
282,
29892,
525,
275,
742,
9303,
29918,
1066,
29961,
29875,
29974,
29880,
9097,
29918,
29886,
3816,
29896,
2314,
13,
462,
18884,
3838,
29961,
29875,
29901,
29875,
29974,
29880,
9097,
29918,
29886,
29962,
353,
1820,
13,
462,
18884,
3838,
29918,
1066,
353,
926,
29918,
4039,
29898,
9303,
29892,
8282,
300,
2433,
14540,
284,
1495,
13,
462,
18884,
301,
9097,
29918,
29893,
353,
7431,
29898,
9303,
29897,
13,
462,
18884,
396,
364,
29918,
2435,
353,
301,
9097,
29918,
29893,
29899,
29880,
9097,
29918,
29886,
29974,
29896,
13,
462,
18884,
7353,
29918,
3167,
353,
376,
29916,
29908,
13,
462,
18884,
396,
301,
29918,
29878,
29922,
29880,
29918,
29878,
29889,
6506,
29898,
29886,
29892,
1948,
29961,
29900,
2314,
13,
462,
18884,
396,
301,
29918,
29878,
353,
376,
11393,
7122,
29898,
9303,
29897,
13,
462,
18884,
396,
1596,
29898,
29880,
29918,
29878,
29897,
13,
462,
4706,
474,
4619,
29871,
29896,
13,
18884,
565,
7353,
29918,
3167,
1275,
376,
29916,
1115,
13,
462,
1678,
1596,
29898,
29880,
29918,
29878,
29897,
13,
462,
1678,
301,
29918,
29878,
353,
376,
11393,
7122,
29898,
9303,
29897,
13,
462,
1678,
396,
301,
29918,
29878,
353,
6479,
774,
804,
14463,
6362,
4476,
3950,
2141,
4801,
4476,
675,
29898,
9303,
29897,
13,
462,
1678,
1596,
29898,
29880,
29918,
29878,
29897,
13,
462,
1678,
7353,
29918,
3167,
353,
5124,
13,
18884,
13,
308,
13,
1678,
396,
301,
29918,
29878,
353,
301,
13,
1678,
396,
363,
474,
297,
3464,
29898,
2435,
29898,
6886,
22164,
259,
396,
679,
1432,
1948,
297,
278,
4472,
13,
1678,
396,
268,
1948,
353,
4472,
29889,
309,
542,
29961,
29875,
29962,
13,
1678,
396,
268,
926,
29918,
11083,
353,
851,
29898,
798,
1839,
1066,
29918,
11083,
2033,
467,
5451,
877,
29936,
1495,
13,
1678,
396,
268,
926,
29918,
7045,
353,
851,
29898,
798,
1839,
1066,
29918,
7045,
2033,
467,
5451,
877,
29936,
1495,
13,
1678,
396,
268,
5191,
29918,
1761,
353,
851,
29898,
798,
1839,
6506,
2033,
467,
5451,
877,
29936,
1495,
13,
1678,
396,
268,
1596,
877,
6506,
29918,
1761,
29901,
742,
6506,
29918,
1761,
29897,
13,
1678,
396,
268,
363,
282,
297,
5191,
29918,
1761,
29901,
259,
396,
679,
1269,
1543,
297,
5191,
29918,
1761,
310,
4472,
1948,
29961,
29875,
29962,
13,
1678,
396,
308,
1596,
877,
2886,
282,
363,
29922,
742,
282,
29897,
13,
1678,
396,
308,
565,
282,
297,
301,
29918,
29878,
29901,
13,
1678,
396,
632,
1596,
877,
2886,
282,
565,
29922,
742,
282,
29897,
13,
1678,
396,
632,
396,
343,
353,
282,
29889,
6506,
877,
525,
5501,
1495,
13,
1678,
396,
632,
343,
353,
337,
29889,
1491,
29898,
29878,
29915,
29961,
3823,
29893,
29905,
29879,
29962,
3788,
742,
29886,
29897,
29871,
396,
5191,
6035,
22999,
800,
304,
9654,
851,
13,
1678,
396,
632,
1596,
877,
29891,
29901,
13420,
29891,
29897,
13,
1678,
396,
632,
1006,
326,
353,
301,
29918,
29878,
29889,
6506,
29898,
29886,
29892,
343,
29897,
13,
1678,
396,
632,
3838,
353,
1734,
29918,
6979,
675,
29898,
1639,
326,
29897,
13,
1678,
396,
632,
1006,
326,
29918,
1066,
353,
926,
29918,
4039,
29898,
9303,
29892,
8282,
300,
2433,
14540,
284,
1495,
13,
1678,
396,
632,
2380,
29918,
11759,
29875,
363,
474,
29892,
29916,
297,
26985,
29898,
1639,
326,
29918,
1066,
29897,
565,
921,
29961,
29900,
29962,
1360,
29891,
29962,
13,
1678,
396,
632,
363,
474,
297,
2380,
29918,
29901,
13,
1678,
396,
462,
565,
1006,
326,
29918,
1066,
29961,
29875,
29899,
29896,
3816,
29896,
29962,
297,
926,
29918,
11083,
29901,
13,
1678,
396,
462,
268,
1596,
877,
1552,
926,
310,
278,
1734,
1434,
742,
282,
29892,
525,
275,
742,
1639,
326,
29918,
1066,
29961,
29875,
29899,
29896,
3816,
29896,
2314,
13,
1678,
396,
462,
268,
3838,
29961,
29875,
29962,
353,
1948,
29961,
29900,
29962,
13,
1678,
396,
462,
268,
396,
301,
29918,
29878,
29922,
29880,
29918,
29878,
29889,
6506,
29898,
29886,
29892,
1948,
29961,
29900,
2314,
13,
1678,
396,
462,
268,
301,
29918,
29878,
353,
376,
11393,
7122,
29898,
9303,
29897,
13,
1678,
396,
462,
268,
1596,
29898,
29880,
29918,
29878,
29897,
13,
1678,
396,
462,
25342,
1006,
326,
29918,
1066,
29961,
29875,
29974,
29896,
3816,
29896,
29962,
297,
926,
29918,
7045,
29901,
13,
1678,
396,
462,
268,
1596,
877,
1552,
926,
310,
278,
1734,
1156,
742,
282,
29892,
525,
275,
742,
1639,
326,
29918,
1066,
29961,
29875,
29974,
29896,
3816,
29896,
2314,
13,
1678,
396,
462,
268,
3838,
29961,
29875,
29962,
353,
1948,
29961,
29900,
29962,
13,
1678,
396,
462,
268,
396,
301,
29918,
29878,
29922,
29880,
29918,
29878,
29889,
6506,
29898,
29886,
29892,
1948,
29961,
29900,
2314,
13,
1678,
396,
462,
268,
301,
29918,
29878,
353,
376,
11393,
7122,
29898,
9303,
29897,
13,
1678,
396,
462,
268,
1596,
29898,
29880,
29918,
29878,
29897,
13,
1678,
736,
301,
29918,
29878,
13,
13,
1066,
29918,
6506,
29898,
726,
29896,
29892,
4472,
29897,
13,
13,
1066,
29918,
6506,
29898,
726,
29906,
29892,
4472,
29897,
13,
13,
1066,
29918,
6506,
29898,
726,
29941,
29892,
4472,
29897,
2
] |
helpers/labml_helpers/datasets/remote/test/mnist_server.py | mcx/labml | 174 | 113625 | <reponame>mcx/labml<gh_stars>100-1000
from labml import lab
from labml_helpers.datasets.remote import DatasetServer
from torchvision import datasets, transforms
def main():
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize((0.1307,), (0.3081,))
])
train_dataset = datasets.MNIST(str(lab.get_data_path()),
train=True,
download=True,
transform=transform)
valid_dataset = datasets.MNIST(str(lab.get_data_path()),
train=False,
download=True,
transform=transform)
ds = DatasetServer()
ds.add_dataset('mnist_train', train_dataset)
ds.add_dataset('mnist_valid', valid_dataset)
ds.start()
if __name__ == '__main__':
main()
| [
1,
529,
276,
1112,
420,
29958,
14047,
29916,
29914,
8205,
828,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
3166,
9775,
828,
1053,
9775,
13,
3166,
9775,
828,
29918,
3952,
6774,
29889,
14538,
1691,
29889,
16674,
1053,
13373,
24541,
6004,
13,
3166,
4842,
305,
4924,
1053,
20035,
29892,
4327,
29879,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
4327,
353,
4327,
29879,
29889,
1523,
4220,
4197,
13,
4706,
4327,
29879,
29889,
1762,
29911,
6073,
3285,
13,
4706,
4327,
29879,
29889,
19077,
675,
3552,
29900,
29889,
29896,
29941,
29900,
29955,
29892,
511,
313,
29900,
29889,
29941,
29900,
29947,
29896,
29892,
876,
13,
268,
2314,
13,
13,
1678,
7945,
29918,
24713,
353,
20035,
29889,
29924,
29940,
9047,
29898,
710,
29898,
8205,
29889,
657,
29918,
1272,
29918,
2084,
25739,
13,
462,
462,
259,
7945,
29922,
5574,
29892,
13,
462,
462,
259,
5142,
29922,
5574,
29892,
13,
462,
462,
259,
4327,
29922,
9067,
29897,
13,
13,
1678,
2854,
29918,
24713,
353,
20035,
29889,
29924,
29940,
9047,
29898,
710,
29898,
8205,
29889,
657,
29918,
1272,
29918,
2084,
25739,
13,
462,
462,
259,
7945,
29922,
8824,
29892,
13,
462,
462,
259,
5142,
29922,
5574,
29892,
13,
462,
462,
259,
4327,
29922,
9067,
29897,
13,
13,
1678,
18031,
353,
13373,
24541,
6004,
580,
13,
1678,
18031,
29889,
1202,
29918,
24713,
877,
23521,
391,
29918,
14968,
742,
7945,
29918,
24713,
29897,
13,
1678,
18031,
29889,
1202,
29918,
24713,
877,
23521,
391,
29918,
3084,
742,
2854,
29918,
24713,
29897,
13,
13,
1678,
18031,
29889,
2962,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
costflow/config.py | StdioA/costflow | 0 | 183685 | <filename>costflow/config.py<gh_stars>0
from dataclasses import dataclass, field
@dataclass
class Config:
default_currency: str = "CNY"
formulas: dict = field(default_factory=dict)
def get_formula(self, name):
return self.formulas.get(name, "")
# TODO: Beancount loader for default currency
# Global store
config = Config()
| [
1,
529,
9507,
29958,
18253,
1731,
29914,
2917,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
848,
13203,
1053,
848,
1990,
29892,
1746,
13,
13,
13,
29992,
1272,
1990,
13,
1990,
12782,
29901,
13,
1678,
2322,
29918,
26095,
29901,
851,
353,
376,
13778,
29979,
29908,
13,
1678,
26760,
29901,
9657,
353,
1746,
29898,
4381,
29918,
14399,
29922,
8977,
29897,
13,
13,
1678,
822,
679,
29918,
689,
2497,
29898,
1311,
29892,
1024,
1125,
13,
4706,
736,
1583,
29889,
689,
15173,
29889,
657,
29898,
978,
29892,
20569,
13,
13,
1678,
396,
14402,
29901,
1522,
273,
2798,
23466,
363,
2322,
27550,
13,
13,
13,
29937,
12002,
3787,
13,
2917,
353,
12782,
580,
13,
2
] |
django/dashboard/views/index.py | aistairc/voteclustering_aist | 0 | 69666 | from django.db.models import Count, Q
from django.shortcuts import redirect, render
from django.utils import timezone
from AIST_survey.models import Enquete, Respondent, Question, Choice, Evaluation
def index(request):
if "enquete_id" not in request.session:
return redirect("login")
enquete_id = request.session["enquete_id"]
enquete = Enquete.objects.get(id=int(enquete_id))
params = get_index_params(enquete)
return render(request, 'dashboard/index.html', params)
def get_index_params(enquete):
respondents = Respondent.objects.filter(enquete_id=enquete.id)
questions = Question.objects.filter(enquete_id=enquete.id)
choices = []
for q in questions:
choice_data = Choice.objects.filter(question_id=q.id)
choices.extend(choice_data)
params = {
'enquete': enquete,
'respondent_num': len(respondents),
'today_respondents_num': get_today_respondents_num(enquete),
'remaining_days': get_remaining_days(enquete),
'respondent_transition_data': get_respondent_transition_data(enquete),
'question_graph_data': get_question_graph_data(enquete)
}
return params
def get_question_graph_data(enquete):
questions = Question.objects.filter(enquete_id=enquete.id)
graph_data = []
for q in questions:
if q.type == Question.SINGLE or q.type == Question.MULTI:
data = {
"question_text": q.text,
"type": "selection",
"graph_data": get_selection_data(q)
}
graph_data.append(data)
elif q.type == Question.QUESTION:
data = {
"question_text": q.text,
"type": "open_end",
"graph_data": get_question_data(q)
}
graph_data.append(data)
return graph_data
def get_selection_data(question):
choices = Choice.objects.filter(question=question)
selection_labels = []
selection_data = []
for c in choices:
choice_num = Evaluation.objects.filter(choice=c).count()
selection_labels.append(c.text)
selection_data.append(choice_num)
return {"labels": selection_labels, "data": selection_data}
def get_question_data(question):
choices = Choice.objects.filter(question=question)
question_data = {
"like": [],
"time": [],
}
choices_timestamp = choices.order_by("-timestamp")[0:5]
for choice in choices_timestamp:
question_data["time"].append({
"time": choice.timestamp,
"text": choice.text
})
choices_like = choices\
.annotate(
count=Count(
"evaluation",
filter=Q(evaluation__assessment=Evaluation.LIKED) | Q(evaluation__assessment=Evaluation.PROPOSED)
)
)\
.order_by("-count")[0:5]
for choice in choices_like:
question_data["like"].append({
"text": choice.text,
"like": choice.count,
"timestamp": choice.timestamp
})
return question_data
def get_today_respondents_num(enquete):
today_respondents = Respondent.objects.filter(enquete_id=enquete.id, finishTime__date=timezone.now())
return today_respondents.count()
def get_remaining_days(enquete):
remaining_days = (enquete.expired_at - timezone.now()).days
return remaining_days if remaining_days > 0 else 0
def get_respondent_transition_data(enquete):
today = timezone.now().date()
date_list = []
respondent_count_list = []
publish_day = enquete.published_at.astimezone().replace(hour=23, minute=59, second=59, microsecond=999999)
while publish_day.date() <= today:
respondent_count = Respondent.objects.filter(finishTime__date__lte=publish_day, enquete_id=enquete.id).count()
date_list.append(publish_day.strftime("%Y/%m/%d"))
respondent_count_list.append(respondent_count)
publish_day += timezone.timedelta(days=1)
return {'labels': date_list, 'values': respondent_count_list}
| [
1,
515,
9557,
29889,
2585,
29889,
9794,
1053,
3917,
29892,
660,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
6684,
29892,
4050,
13,
3166,
9557,
29889,
13239,
1053,
29431,
13,
13,
3166,
319,
9047,
29918,
7610,
6950,
29889,
9794,
1053,
1174,
339,
2650,
29892,
2538,
2818,
296,
29892,
894,
29892,
14542,
625,
29892,
382,
4387,
362,
13,
13,
13,
1753,
2380,
29898,
3827,
1125,
13,
1678,
565,
376,
264,
339,
2650,
29918,
333,
29908,
451,
297,
2009,
29889,
7924,
29901,
13,
4706,
736,
6684,
703,
7507,
1159,
13,
1678,
22085,
2650,
29918,
333,
353,
2009,
29889,
7924,
3366,
264,
339,
2650,
29918,
333,
3108,
13,
1678,
22085,
2650,
353,
1174,
339,
2650,
29889,
12650,
29889,
657,
29898,
333,
29922,
524,
29898,
264,
339,
2650,
29918,
333,
876,
13,
13,
1678,
8636,
353,
679,
29918,
2248,
29918,
7529,
29898,
264,
339,
2650,
29897,
13,
1678,
736,
4050,
29898,
3827,
29892,
525,
14592,
3377,
29914,
2248,
29889,
1420,
742,
8636,
29897,
13,
13,
13,
1753,
679,
29918,
2248,
29918,
7529,
29898,
264,
339,
2650,
1125,
13,
1678,
10049,
1237,
353,
2538,
2818,
296,
29889,
12650,
29889,
4572,
29898,
264,
339,
2650,
29918,
333,
29922,
264,
339,
2650,
29889,
333,
29897,
13,
1678,
5155,
353,
894,
29889,
12650,
29889,
4572,
29898,
264,
339,
2650,
29918,
333,
29922,
264,
339,
2650,
29889,
333,
29897,
13,
1678,
19995,
353,
5159,
13,
1678,
363,
3855,
297,
5155,
29901,
13,
4706,
7348,
29918,
1272,
353,
14542,
625,
29889,
12650,
29889,
4572,
29898,
12470,
29918,
333,
29922,
29939,
29889,
333,
29897,
13,
4706,
19995,
29889,
21843,
29898,
16957,
29918,
1272,
29897,
13,
1678,
8636,
353,
426,
13,
4706,
525,
264,
339,
2650,
2396,
22085,
2650,
29892,
13,
4706,
525,
3636,
296,
29918,
1949,
2396,
7431,
29898,
3636,
1237,
511,
13,
4706,
525,
27765,
29918,
3636,
1237,
29918,
1949,
2396,
679,
29918,
27765,
29918,
3636,
1237,
29918,
1949,
29898,
264,
339,
2650,
511,
13,
4706,
525,
1745,
17225,
29918,
16700,
2396,
679,
29918,
1745,
17225,
29918,
16700,
29898,
264,
339,
2650,
511,
13,
4706,
525,
3636,
296,
29918,
20543,
29918,
1272,
2396,
679,
29918,
3636,
296,
29918,
20543,
29918,
1272,
29898,
264,
339,
2650,
511,
13,
4706,
525,
12470,
29918,
4262,
29918,
1272,
2396,
679,
29918,
12470,
29918,
4262,
29918,
1272,
29898,
264,
339,
2650,
29897,
13,
1678,
500,
13,
1678,
736,
8636,
13,
13,
13,
1753,
679,
29918,
12470,
29918,
4262,
29918,
1272,
29898,
264,
339,
2650,
1125,
13,
1678,
5155,
353,
894,
29889,
12650,
29889,
4572,
29898,
264,
339,
2650,
29918,
333,
29922,
264,
339,
2650,
29889,
333,
29897,
13,
1678,
3983,
29918,
1272,
353,
5159,
13,
1678,
363,
3855,
297,
5155,
29901,
13,
4706,
565,
3855,
29889,
1853,
1275,
894,
29889,
29903,
4214,
1307,
470,
3855,
29889,
1853,
1275,
894,
29889,
29924,
8647,
29902,
29901,
13,
9651,
848,
353,
426,
13,
18884,
376,
12470,
29918,
726,
1115,
3855,
29889,
726,
29892,
13,
18884,
376,
1853,
1115,
376,
21731,
613,
13,
18884,
376,
4262,
29918,
1272,
1115,
679,
29918,
21731,
29918,
1272,
29898,
29939,
29897,
13,
9651,
500,
13,
9651,
3983,
29918,
1272,
29889,
4397,
29898,
1272,
29897,
13,
4706,
25342,
3855,
29889,
1853,
1275,
894,
29889,
14130,
2725,
29901,
13,
9651,
848,
353,
426,
13,
18884,
376,
12470,
29918,
726,
1115,
3855,
29889,
726,
29892,
13,
18884,
376,
1853,
1115,
376,
3150,
29918,
355,
613,
13,
18884,
376,
4262,
29918,
1272,
1115,
679,
29918,
12470,
29918,
1272,
29898,
29939,
29897,
13,
9651,
500,
13,
9651,
3983,
29918,
1272,
29889,
4397,
29898,
1272,
29897,
13,
1678,
736,
3983,
29918,
1272,
13,
13,
13,
1753,
679,
29918,
21731,
29918,
1272,
29898,
12470,
1125,
13,
1678,
19995,
353,
14542,
625,
29889,
12650,
29889,
4572,
29898,
12470,
29922,
12470,
29897,
13,
1678,
9262,
29918,
21134,
353,
5159,
13,
1678,
9262,
29918,
1272,
353,
5159,
13,
1678,
363,
274,
297,
19995,
29901,
13,
4706,
7348,
29918,
1949,
353,
382,
4387,
362,
29889,
12650,
29889,
4572,
29898,
16957,
29922,
29883,
467,
2798,
580,
13,
4706,
9262,
29918,
21134,
29889,
4397,
29898,
29883,
29889,
726,
29897,
13,
4706,
9262,
29918,
1272,
29889,
4397,
29898,
16957,
29918,
1949,
29897,
13,
1678,
736,
8853,
21134,
1115,
9262,
29918,
21134,
29892,
376,
1272,
1115,
9262,
29918,
1272,
29913,
13,
13,
13,
1753,
679,
29918,
12470,
29918,
1272,
29898,
12470,
1125,
13,
1678,
19995,
353,
14542,
625,
29889,
12650,
29889,
4572,
29898,
12470,
29922,
12470,
29897,
13,
1678,
1139,
29918,
1272,
353,
426,
13,
4706,
376,
4561,
1115,
19997,
13,
4706,
376,
2230,
1115,
19997,
13,
1678,
500,
13,
1678,
19995,
29918,
16394,
353,
19995,
29889,
2098,
29918,
1609,
703,
29899,
16394,
1159,
29961,
29900,
29901,
29945,
29962,
13,
1678,
363,
7348,
297,
19995,
29918,
16394,
29901,
13,
4706,
1139,
29918,
1272,
3366,
2230,
16862,
4397,
3319,
13,
9651,
376,
2230,
1115,
7348,
29889,
16394,
29892,
13,
9651,
376,
726,
1115,
7348,
29889,
726,
13,
4706,
5615,
13,
1678,
19995,
29918,
4561,
353,
19995,
29905,
13,
4706,
869,
6735,
403,
29898,
13,
9651,
2302,
29922,
3981,
29898,
13,
18884,
376,
24219,
362,
613,
13,
18884,
4175,
29922,
29984,
29898,
24219,
362,
1649,
465,
404,
358,
29922,
29923,
4387,
362,
29889,
5265,
29968,
3352,
29897,
891,
660,
29898,
24219,
362,
1649,
465,
404,
358,
29922,
29923,
4387,
362,
29889,
8618,
13152,
1660,
29928,
29897,
13,
9651,
1723,
13,
4706,
1723,
29905,
13,
4706,
869,
2098,
29918,
1609,
703,
29899,
2798,
1159,
29961,
29900,
29901,
29945,
29962,
13,
1678,
363,
7348,
297,
19995,
29918,
4561,
29901,
13,
4706,
1139,
29918,
1272,
3366,
4561,
16862,
4397,
3319,
13,
9651,
376,
726,
1115,
7348,
29889,
726,
29892,
13,
9651,
376,
4561,
1115,
7348,
29889,
2798,
29892,
13,
9651,
376,
16394,
1115,
7348,
29889,
16394,
13,
4706,
5615,
13,
1678,
736,
1139,
29918,
1272,
13,
13,
13,
1753,
679,
29918,
27765,
29918,
3636,
1237,
29918,
1949,
29898,
264,
339,
2650,
1125,
13,
1678,
9826,
29918,
3636,
1237,
353,
2538,
2818,
296,
29889,
12650,
29889,
4572,
29898,
264,
339,
2650,
29918,
333,
29922,
264,
339,
2650,
29889,
333,
29892,
8341,
2481,
1649,
1256,
29922,
2230,
8028,
29889,
3707,
3101,
13,
1678,
736,
9826,
29918,
3636,
1237,
29889,
2798,
580,
13,
13,
13,
1753,
679,
29918,
1745,
17225,
29918,
16700,
29898,
264,
339,
2650,
1125,
13,
1678,
9886,
29918,
16700,
353,
313,
264,
339,
2650,
29889,
4548,
2859,
29918,
271,
448,
29431,
29889,
3707,
16655,
16700,
13,
1678,
736,
9886,
29918,
16700,
565,
9886,
29918,
16700,
1405,
29871,
29900,
1683,
29871,
29900,
13,
13,
13,
1753,
679,
29918,
3636,
296,
29918,
20543,
29918,
1272,
29898,
264,
339,
2650,
1125,
13,
1678,
9826,
353,
29431,
29889,
3707,
2141,
1256,
580,
13,
1678,
2635,
29918,
1761,
353,
5159,
13,
1678,
10049,
296,
29918,
2798,
29918,
1761,
353,
5159,
13,
1678,
9805,
29918,
3250,
353,
22085,
2650,
29889,
5467,
3726,
29918,
271,
29889,
579,
603,
8028,
2141,
6506,
29898,
18721,
29922,
29906,
29941,
29892,
11015,
29922,
29945,
29929,
29892,
1473,
29922,
29945,
29929,
29892,
9200,
7496,
29922,
29929,
29929,
29929,
29929,
29929,
29929,
29897,
13,
1678,
1550,
9805,
29918,
3250,
29889,
1256,
580,
5277,
9826,
29901,
13,
4706,
10049,
296,
29918,
2798,
353,
2538,
2818,
296,
29889,
12650,
29889,
4572,
29898,
4951,
728,
2481,
1649,
1256,
1649,
29880,
371,
29922,
23679,
29918,
3250,
29892,
22085,
2650,
29918,
333,
29922,
264,
339,
2650,
29889,
333,
467,
2798,
580,
13,
4706,
2635,
29918,
1761,
29889,
4397,
29898,
23679,
29918,
3250,
29889,
710,
615,
603,
11702,
29979,
22584,
29885,
22584,
29881,
5783,
13,
4706,
10049,
296,
29918,
2798,
29918,
1761,
29889,
4397,
29898,
3636,
296,
29918,
2798,
29897,
13,
4706,
9805,
29918,
3250,
4619,
29431,
29889,
9346,
287,
2554,
29898,
16700,
29922,
29896,
29897,
13,
1678,
736,
11117,
21134,
2396,
2635,
29918,
1761,
29892,
525,
5975,
2396,
10049,
296,
29918,
2798,
29918,
1761,
29913,
13,
2
] |
test/test_server.py | sebastianludwig/SensationDriver | 0 | 116373 | <reponame>sebastianludwig/SensationDriver<filename>test/test_server.py
from utils import *
from sensationdriver.server import Server
class TestServer(unittest.TestCase):
class MemoryHandler(object):
def __init__(self):
self.set_up_called_counter = 0
self.tear_down_called_counter = 0
@asyncio.coroutine
def set_up(self):
self.set_up_called_counter += 1
@asyncio.coroutine
def tear_down(self):
self.tear_down_called_counter += 1
def test_handler_torn_down_after_server_usage(self):
server = Server()
handler = self.MemoryHandler()
server.handler = handler
with server:
pass
self.assertEqual(handler.tear_down_called_counter, 1)
def test_handler_set_up_called_on_restart(self):
server = Server()
handler = self.MemoryHandler()
server.handler = handler
with server:
pass
with server:
self.assertEqual(handler.set_up_called_counter, 2)
def test_handler_set_up_not_called_twice_on_start(self):
server = Server()
handler = self.MemoryHandler()
server.handler = handler
with server:
self.assertEqual(handler.set_up_called_counter, 1)
if __name__ == '__main__':
unittest.main()
| [
1,
529,
276,
1112,
420,
29958,
344,
29890,
579,
713,
29880,
566,
9192,
29914,
29903,
575,
362,
12376,
29966,
9507,
29958,
1688,
29914,
1688,
29918,
2974,
29889,
2272,
13,
3166,
3667,
29879,
1053,
334,
13,
13,
3166,
4771,
362,
9465,
29889,
2974,
1053,
5656,
13,
13,
13,
1990,
4321,
6004,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
770,
18914,
4598,
29898,
3318,
1125,
13,
4706,
822,
4770,
2344,
12035,
1311,
1125,
13,
9651,
1583,
29889,
842,
29918,
786,
29918,
13998,
29918,
11808,
353,
29871,
29900,
13,
9651,
1583,
29889,
371,
279,
29918,
3204,
29918,
13998,
29918,
11808,
353,
29871,
29900,
13,
13,
4706,
732,
294,
948,
3934,
29889,
2616,
449,
457,
13,
4706,
822,
731,
29918,
786,
29898,
1311,
1125,
13,
9651,
1583,
29889,
842,
29918,
786,
29918,
13998,
29918,
11808,
4619,
29871,
29896,
13,
13,
4706,
732,
294,
948,
3934,
29889,
2616,
449,
457,
13,
4706,
822,
734,
279,
29918,
3204,
29898,
1311,
1125,
13,
9651,
1583,
29889,
371,
279,
29918,
3204,
29918,
13998,
29918,
11808,
4619,
29871,
29896,
13,
13,
1678,
822,
1243,
29918,
13789,
29918,
29873,
1398,
29918,
3204,
29918,
7045,
29918,
2974,
29918,
21125,
29898,
1311,
1125,
13,
4706,
1923,
353,
5656,
580,
13,
4706,
7834,
353,
1583,
29889,
16015,
4598,
580,
13,
4706,
1923,
29889,
13789,
353,
7834,
13,
4706,
411,
1923,
29901,
13,
9651,
1209,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13789,
29889,
371,
279,
29918,
3204,
29918,
13998,
29918,
11808,
29892,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
13789,
29918,
842,
29918,
786,
29918,
13998,
29918,
265,
29918,
5060,
442,
29898,
1311,
1125,
13,
4706,
1923,
353,
5656,
580,
13,
4706,
7834,
353,
1583,
29889,
16015,
4598,
580,
13,
4706,
1923,
29889,
13789,
353,
7834,
13,
4706,
411,
1923,
29901,
13,
9651,
1209,
13,
13,
4706,
411,
1923,
29901,
13,
9651,
1583,
29889,
9294,
9843,
29898,
13789,
29889,
842,
29918,
786,
29918,
13998,
29918,
11808,
29892,
29871,
29906,
29897,
13,
13,
13,
1678,
822,
1243,
29918,
13789,
29918,
842,
29918,
786,
29918,
1333,
29918,
13998,
29918,
7516,
625,
29918,
265,
29918,
2962,
29898,
1311,
1125,
13,
4706,
1923,
353,
5656,
580,
13,
4706,
7834,
353,
1583,
29889,
16015,
4598,
580,
13,
4706,
1923,
29889,
13789,
353,
7834,
13,
4706,
411,
1923,
29901,
13,
9651,
1583,
29889,
9294,
9843,
29898,
13789,
29889,
842,
29918,
786,
29918,
13998,
29918,
11808,
29892,
29871,
29896,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
statsWaveletFilt/threshold.py | Tiarles/Statistical-Wavelet-Filtering | 3 | 61809 | <reponame>Tiarles/Statistical-Wavelet-Filtering<filename>statsWaveletFilt/threshold.py<gh_stars>1-10
# -*- coding: utf-8 -*-
'''
**Wavelet Based in CUSUM control chart for filtering signals Project (module**
``statsWaveletFilt.threshold`` **):** Statistic functions for obtain threshold
values for wavelet coefficients based in some referenced works.
*Created by <NAME>, 2018*
'''
def lambdasVisuShrink(wavCoeff):
'''
Computes the threshold value (lambda) by VisuShrink [1] method.
Parameters
---------
wavCoeff: list of lists or array-like
Wavelet coefficients
Returns
-------
list of float:
The threshold values for each wavelet coefficients
vector.
See also
--------
filtration: Function that use this function for filter via wavelet
coefficients
pywt.wavedec: Function that decomposes the signal in wavelet and
scale coefficients
pywt.waverec: Function that recomposes the signal from wavelet and
scale coefficients
References
----------
.. [1] <NAME>.; <NAME>. Ideal spatial adaptation via
wavelet shrinkage. Biometrika, v. 81, p. 425–455, 1994.
'''
import numpy as np
# Coefficients Vector from the bigger resolution
d_m1 = list(wavCoeff[-1]) # Make a copy
d_m1 = np.array(d_m1) # Turns a numpy.array
estDeviation = np.median(np.abs(d_m1))/.6745
lambdaValues = [estDeviation * np.sqrt(2*np.log10(d_m1.size))] * \
len(wavCoeff)
return lambdaValues
def _sure(vector, ti):
'''
Internal function, for lambdasSureShrink method.
.. note::
After the test (via **pytest**) the fuction was changed for better
performance.
Parameters
---------
vector: list or array-like
vector of coefficients who lambdasSureShrink function needs for the
computes.
t: list or array-like
Intern parameter set by lambdasSureShrink method.
Returns
-------
list of float:
Based on work of Stein [1].
See also
--------
filtration: Function that use this function to filter via wavelet
coefficients
lambdasSureShrink: Function that use this function for sureshrink
algorithm
References
----------
.. [1] STEIN, C. Estimation of the mean of a multivariate normal
distribution. Annals of Statistics, v. 9, p. 1135–1151, 1981.
'''
import numpy as np
vector2 = np.array(list(vector))
soma1 = np.sum(vector2 <= ti)
ti_list = [[ti]]*vector2.size
soma2 = np.sum(np.power(np.minimum(vector2, np.concatenate(ti_list)), 2))
return vector2.size - 2 * soma1 + soma2
def lambdasSureShrink(wavCoeff, dim_t=1024):
'''
Computes the threshold value (lambda) by SureShrink [1] method. It's showed
also in [2].
.. note::
After the test (via **pytest**) the fuction was changed for better
performance.
Parameters
---------
wavCoeff: list of lists or array-like
Wavelet coefficients
dim_t: optional, 1024 by default. t-dimension. Input vector from
internal function _sure(vector, dim_t).
Returns
-------
list of float:
The threshold values for each wavelet coefficients vector.
See also
--------
filtration: Function that use this function to filter via wavelet
coefficients
pywt.wavedec: Function that decomposes the signal in wavelet and
scale coefficients
pywt.waverec: Function that recomposes the signal from wavelet and
scale coefficients
References
----------
.. [1] <NAME>.; <NAME>. Ideal spatial adaptation via
wavelet shrinkage. Biometrika, v. 81, p. 425–455, 1994.
.. [2] <NAME>.; <NAME>. Filtragem de sinais via
limiarização de coeficientes wavelet. Ciência e Natura, v. 36,
p. 37–51, 2014. In portuguese.
'''
import numpy as np
wavCoeff2 = [np.array(list(wavCoeff_i)) for wavCoeff_i in wavCoeff]
lambdaValues = []
for coeff in wavCoeff2:
estDeviation = np.median(np.abs(coeff))/.6745
tmax = estDeviation*np.sqrt(2*np.log10(coeff.size))
t = np.linspace(0, tmax, dim_t)
res_sure = [_sure(coeff, ti) for ti in t]
lambdaValues.append(t[np.argmin(res_sure)])
return lambdaValues
def lambdasBayesShrink(wavCoeff):
'''
Computes the threshold value (lambda) by BayesShrink [1] method. It's
showed also in [2].
Parameters
---------
wavCoeff: list of lists or array-like
Wavelet coefficients
Returns
-------
list of float:
The threshold values for each wavelet coefficients vector.
See also
--------
filtration: Function that use this function to filter via wavelet
coefficients
pywt.wavedec: Function that decomposes the signal in wavelet and
scale coefficients
pywt.waverec: Function that recomposes the signal from wavelet and
scale coefficients
References
----------
.. [1] <NAME>.; <NAME>.; <NAME>. Adaptive wavelet thresholding
for image denoising and compression. IEEE Transactions on Image
Processing, v. 9, p. 1532–1546, 2000.
.. [2] <NAME>.; <NAME>. Filtragem de sinais via
limiarização de coeficientes wavelet. Ciência e Natura, v. 36,
p. 37–51, 2014. In portuguese.
'''
import numpy as np
wavCoeff2 = [np.array(list(wavCoeff_i)) for wavCoeff_i in wavCoeff]
d_m1 = wavCoeff2[-1]
deviation_square = np.power(np.median(np.abs(d_m1))/0.6745, 2)
lambdaValues = []
for wavCoeff_i in wavCoeff2:
deviation2_wavCoeff_i = np.sum(np.power(wavCoeff_i, 2))/wavCoeff_i.size
deviation_Xj = np.sqrt(
np.maximum(deviation2_wavCoeff_i - deviation_square, 0))
lambdaValues.append(deviation_square/deviation_Xj)
return lambdaValues
def lambdasSPC_Threshold(wavCoeff, p=3):
'''
Computes the threshold value (lambda) by SPC-Threshold [1], [2] method
.. note::
After the test (via **pytest**) the fuction was changed for better
performance.
Parameters
---------
wavCoeff: list of lists or array-like
Wavelet coefficients
p: int or float
Optional, 3 by default. Parameter for the algorithm [1],
generally is used 2 or 3.
Returns
-------
list of float:
The threshold values for each wavelet coefficients
vector.
See also
--------
filtration: Function that use this function to filter via wavelet
coefficients
pywt.wavedec: Function that decomposes the signal in wavelet and
scale coefficients
pywt.waverec: Function that recomposes the signal from wavelet and
scale coefficients
References
----------
.. [1] <NAME>.; <NAME>. SPC-threshold: uma proposta de
limiarização para filtragem adaptativa de sinais. Tendências em
Matemática Aplicada e Computacional, v. 11, n. 2, p. 121–132, 2010.
In portuguese.
.. [2] <NAME>.; <NAME>. Filtragem de sinais via
limiarização de coeficientes wavelet. Ciência e Natura, v. 36,
p. 37–51, 2014. In portuguese.
'''
import numpy as np
wavCoeff2 = [np.array(list(wavCoeff_i)) for wavCoeff_i in wavCoeff]
lambdaValues = []
for wavCoeff_i in wavCoeff2:
Sj = np.sqrt(1./(wavCoeff_i.size - 1) *
np.sum(np.power(wavCoeff_i - wavCoeff_i.mean(), 2)))
while (np.abs(wavCoeff_i) >= p*Sj).any():
wavCoeff_i = wavCoeff_i[np.abs(wavCoeff_i) < p*Sj]
Sj = np.sqrt(1./(wavCoeff_i.size - 1) *
np.sum(np.power(wavCoeff_i - wavCoeff_i.mean(), 2)))
lambdaValues.append(p*Sj)
return lambdaValues
| [
1,
529,
276,
1112,
420,
29958,
29911,
4447,
793,
29914,
9513,
391,
936,
29899,
29956,
1351,
1026,
29899,
5072,
292,
29966,
9507,
29958,
16202,
29956,
1351,
1026,
29943,
2782,
29914,
386,
12268,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
12008,
13,
1068,
29956,
1351,
1026,
16564,
297,
315,
3308,
5005,
2761,
8727,
363,
21166,
18470,
8010,
313,
5453,
1068,
13,
16159,
16202,
29956,
1351,
1026,
29943,
2782,
29889,
386,
12268,
16159,
3579,
1125,
1068,
6666,
4695,
3168,
363,
4017,
16897,
13,
5975,
363,
10742,
1026,
16127,
2729,
297,
777,
16180,
1736,
29889,
13,
13,
29930,
20399,
491,
529,
5813,
10202,
29871,
29906,
29900,
29896,
29947,
29930,
13,
12008,
13,
13,
13,
1753,
301,
1117,
17370,
6116,
29884,
29903,
1092,
682,
29898,
29893,
485,
29907,
7297,
600,
1125,
13,
1678,
14550,
13,
1678,
11796,
267,
278,
16897,
995,
313,
2892,
29897,
491,
5741,
29884,
29903,
1092,
682,
518,
29896,
29962,
1158,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
13,
1678,
281,
485,
29907,
7297,
600,
29901,
1051,
310,
8857,
470,
1409,
29899,
4561,
13,
4706,
399,
1351,
1026,
16127,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1051,
310,
5785,
29901,
13,
4706,
450,
16897,
1819,
363,
1269,
10742,
1026,
16127,
13,
4706,
4608,
29889,
13,
13,
1678,
2823,
884,
13,
1678,
448,
26589,
13,
1678,
977,
509,
362,
29901,
6680,
393,
671,
445,
740,
363,
4175,
3025,
10742,
1026,
13,
4706,
16127,
13,
1678,
282,
5693,
29873,
29889,
29893,
10511,
687,
29901,
6680,
393,
17753,
10590,
278,
7182,
297,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
1678,
282,
5693,
29873,
29889,
2766,
369,
687,
29901,
6680,
393,
27878,
10590,
278,
7182,
515,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
529,
5813,
29958,
8670,
529,
5813,
15513,
13001,
284,
18652,
28206,
3025,
13,
965,
10742,
1026,
14653,
682,
482,
29889,
3457,
3297,
374,
1335,
29892,
325,
29889,
29871,
29947,
29896,
29892,
282,
29889,
29871,
29946,
29906,
29945,
29994,
29946,
29945,
29945,
29892,
29871,
29896,
29929,
29929,
29946,
29889,
13,
1678,
14550,
13,
13,
1678,
1053,
12655,
408,
7442,
13,
13,
1678,
396,
3189,
8462,
29879,
16510,
515,
278,
16600,
10104,
13,
1678,
270,
29918,
29885,
29896,
353,
1051,
29898,
29893,
485,
29907,
7297,
600,
14352,
29896,
2314,
29871,
396,
8561,
263,
3509,
13,
1678,
270,
29918,
29885,
29896,
353,
7442,
29889,
2378,
29898,
29881,
29918,
29885,
29896,
29897,
539,
396,
9603,
29879,
263,
12655,
29889,
2378,
13,
13,
1678,
707,
2772,
14641,
353,
7442,
29889,
2168,
713,
29898,
9302,
29889,
6897,
29898,
29881,
29918,
29885,
29896,
876,
6294,
29953,
29955,
29946,
29945,
13,
13,
1678,
14013,
9065,
353,
518,
342,
2772,
14641,
334,
7442,
29889,
3676,
29898,
29906,
29930,
9302,
29889,
1188,
29896,
29900,
29898,
29881,
29918,
29885,
29896,
29889,
2311,
28166,
334,
320,
13,
4706,
7431,
29898,
29893,
485,
29907,
7297,
600,
29897,
13,
13,
1678,
736,
14013,
9065,
13,
13,
13,
1753,
903,
29879,
545,
29898,
8111,
29892,
19538,
1125,
13,
1678,
14550,
13,
1678,
512,
1890,
740,
29892,
363,
301,
1117,
17370,
29903,
545,
29903,
1092,
682,
1158,
29889,
13,
13,
1678,
6317,
4443,
1057,
13,
4706,
2860,
278,
1243,
313,
6071,
3579,
2272,
1688,
1068,
29897,
278,
4084,
428,
471,
3939,
363,
2253,
13,
4706,
4180,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
13,
1678,
4608,
29901,
1051,
470,
1409,
29899,
4561,
13,
4706,
4608,
310,
16127,
1058,
301,
1117,
17370,
29903,
545,
29903,
1092,
682,
740,
4225,
363,
278,
13,
4706,
2912,
267,
29889,
13,
13,
1678,
260,
29901,
1051,
470,
1409,
29899,
4561,
13,
4706,
2422,
3443,
731,
491,
301,
1117,
17370,
29903,
545,
29903,
1092,
682,
1158,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1051,
310,
5785,
29901,
13,
4706,
16564,
373,
664,
310,
14808,
518,
29896,
1822,
13,
13,
1678,
2823,
884,
13,
1678,
448,
26589,
13,
1678,
977,
509,
362,
29901,
6680,
393,
671,
445,
740,
304,
4175,
3025,
10742,
1026,
13,
4706,
16127,
13,
1678,
301,
1117,
17370,
29903,
545,
29903,
1092,
682,
29901,
6680,
393,
671,
445,
740,
363,
1190,
267,
1092,
682,
13,
4706,
5687,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
317,
4330,
1177,
29892,
315,
29889,
2661,
7715,
310,
278,
2099,
310,
263,
1773,
27432,
403,
4226,
13,
965,
4978,
29889,
8081,
1338,
310,
27098,
29892,
325,
29889,
29871,
29929,
29892,
282,
29889,
29871,
29896,
29896,
29941,
29945,
29994,
29896,
29896,
29945,
29896,
29892,
29871,
29896,
29929,
29947,
29896,
29889,
13,
1678,
14550,
13,
13,
1678,
1053,
12655,
408,
7442,
13,
13,
1678,
4608,
29906,
353,
7442,
29889,
2378,
29898,
1761,
29898,
8111,
876,
13,
13,
1678,
1047,
29874,
29896,
353,
7442,
29889,
2083,
29898,
8111,
29906,
5277,
19538,
29897,
13,
13,
1678,
19538,
29918,
1761,
353,
5519,
2034,
5262,
29930,
8111,
29906,
29889,
2311,
13,
13,
1678,
1047,
29874,
29906,
353,
7442,
29889,
2083,
29898,
9302,
29889,
13519,
29898,
9302,
29889,
1195,
12539,
29898,
8111,
29906,
29892,
7442,
29889,
535,
29883,
2579,
403,
29898,
2034,
29918,
1761,
8243,
29871,
29906,
876,
13,
13,
1678,
736,
4608,
29906,
29889,
2311,
448,
29871,
29906,
334,
1047,
29874,
29896,
718,
1047,
29874,
29906,
13,
13,
13,
1753,
301,
1117,
17370,
29903,
545,
29903,
1092,
682,
29898,
29893,
485,
29907,
7297,
600,
29892,
3964,
29918,
29873,
29922,
29896,
29900,
29906,
29946,
1125,
13,
1678,
14550,
13,
1678,
11796,
267,
278,
16897,
995,
313,
2892,
29897,
491,
18585,
29903,
1092,
682,
518,
29896,
29962,
1158,
29889,
739,
29915,
29879,
10018,
13,
1678,
884,
297,
518,
29906,
1822,
13,
13,
1678,
6317,
4443,
1057,
13,
4706,
2860,
278,
1243,
313,
6071,
3579,
2272,
1688,
1068,
29897,
278,
4084,
428,
471,
3939,
363,
2253,
13,
4706,
4180,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
13,
1678,
281,
485,
29907,
7297,
600,
29901,
1051,
310,
8857,
470,
1409,
29899,
4561,
13,
4706,
399,
1351,
1026,
16127,
13,
1678,
3964,
29918,
29873,
29901,
13136,
29892,
29871,
29896,
29900,
29906,
29946,
491,
2322,
29889,
260,
29899,
6229,
2673,
29889,
10567,
4608,
515,
13,
4706,
7463,
740,
903,
29879,
545,
29898,
8111,
29892,
3964,
29918,
29873,
467,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1051,
310,
5785,
29901,
13,
4706,
450,
16897,
1819,
363,
1269,
10742,
1026,
16127,
4608,
29889,
13,
13,
1678,
2823,
884,
13,
1678,
448,
26589,
13,
1678,
977,
509,
362,
29901,
6680,
393,
671,
445,
740,
304,
4175,
3025,
10742,
1026,
13,
4706,
16127,
13,
1678,
282,
5693,
29873,
29889,
29893,
10511,
687,
29901,
6680,
393,
17753,
10590,
278,
7182,
297,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
1678,
282,
5693,
29873,
29889,
2766,
369,
687,
29901,
6680,
393,
27878,
10590,
278,
7182,
515,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
529,
5813,
29958,
8670,
529,
5813,
15513,
13001,
284,
18652,
28206,
3025,
13,
965,
10742,
1026,
14653,
682,
482,
29889,
3457,
3297,
374,
1335,
29892,
325,
29889,
29871,
29947,
29896,
29892,
282,
29889,
29871,
29946,
29906,
29945,
29994,
29946,
29945,
29945,
29892,
29871,
29896,
29929,
29929,
29946,
29889,
13,
13,
1678,
6317,
518,
29906,
29962,
529,
5813,
29958,
8670,
529,
5813,
15513,
2514,
29873,
1431,
331,
316,
269,
1099,
275,
3025,
13,
965,
2485,
4447,
20945,
316,
1302,
1389,
293,
13833,
10742,
1026,
29889,
11402,
10544,
321,
405,
7969,
29892,
325,
29889,
29871,
29941,
29953,
29892,
13,
965,
282,
29889,
29871,
29941,
29955,
29994,
29945,
29896,
29892,
29871,
29906,
29900,
29896,
29946,
29889,
512,
15056,
23053,
29889,
13,
1678,
14550,
13,
13,
1678,
1053,
12655,
408,
7442,
13,
13,
1678,
281,
485,
29907,
7297,
600,
29906,
353,
518,
9302,
29889,
2378,
29898,
1761,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
876,
363,
281,
485,
29907,
7297,
600,
29918,
29875,
297,
281,
485,
29907,
7297,
600,
29962,
13,
13,
1678,
14013,
9065,
353,
5159,
13,
13,
1678,
363,
1302,
12352,
297,
281,
485,
29907,
7297,
600,
29906,
29901,
13,
13,
4706,
707,
2772,
14641,
353,
7442,
29889,
2168,
713,
29898,
9302,
29889,
6897,
29898,
1111,
12352,
876,
6294,
29953,
29955,
29946,
29945,
13,
13,
4706,
260,
3317,
353,
707,
2772,
14641,
29930,
9302,
29889,
3676,
29898,
29906,
29930,
9302,
29889,
1188,
29896,
29900,
29898,
1111,
12352,
29889,
2311,
876,
13,
13,
4706,
260,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
260,
3317,
29892,
3964,
29918,
29873,
29897,
13,
13,
4706,
620,
29918,
29879,
545,
353,
23160,
29879,
545,
29898,
1111,
12352,
29892,
19538,
29897,
363,
19538,
297,
260,
29962,
13,
13,
4706,
14013,
9065,
29889,
4397,
29898,
29873,
29961,
9302,
29889,
1191,
1195,
29898,
690,
29918,
29879,
545,
29897,
2314,
13,
1678,
736,
14013,
9065,
13,
13,
13,
1753,
301,
1117,
17370,
29933,
388,
267,
29903,
1092,
682,
29898,
29893,
485,
29907,
7297,
600,
1125,
13,
1678,
14550,
13,
1678,
11796,
267,
278,
16897,
995,
313,
2892,
29897,
491,
6211,
267,
29903,
1092,
682,
518,
29896,
29962,
1158,
29889,
739,
29915,
29879,
13,
1678,
10018,
884,
297,
518,
29906,
1822,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
13,
1678,
281,
485,
29907,
7297,
600,
29901,
1051,
310,
8857,
470,
1409,
29899,
4561,
13,
4706,
399,
1351,
1026,
16127,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1051,
310,
5785,
29901,
13,
4706,
450,
16897,
1819,
363,
1269,
10742,
1026,
16127,
4608,
29889,
13,
13,
1678,
2823,
884,
13,
1678,
448,
26589,
13,
1678,
977,
509,
362,
29901,
6680,
393,
671,
445,
740,
304,
4175,
3025,
10742,
1026,
13,
4706,
16127,
13,
1678,
282,
5693,
29873,
29889,
29893,
10511,
687,
29901,
6680,
393,
17753,
10590,
278,
7182,
297,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
1678,
282,
5693,
29873,
29889,
2766,
369,
687,
29901,
6680,
393,
27878,
10590,
278,
7182,
515,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
529,
5813,
29958,
8670,
529,
5813,
29958,
8670,
529,
5813,
15513,
23255,
415,
573,
10742,
1026,
16897,
292,
13,
965,
363,
1967,
972,
29877,
5921,
322,
24221,
29889,
7159,
17896,
4103,
7387,
373,
7084,
13,
965,
10554,
292,
29892,
325,
29889,
29871,
29929,
29892,
282,
29889,
29871,
29896,
29945,
29941,
29906,
29994,
29896,
29945,
29946,
29953,
29892,
29871,
29906,
29900,
29900,
29900,
29889,
13,
13,
1678,
6317,
518,
29906,
29962,
529,
5813,
29958,
8670,
529,
5813,
15513,
2514,
29873,
1431,
331,
316,
269,
1099,
275,
3025,
13,
965,
2485,
4447,
20945,
316,
1302,
1389,
293,
13833,
10742,
1026,
29889,
11402,
10544,
321,
405,
7969,
29892,
325,
29889,
29871,
29941,
29953,
29892,
13,
965,
282,
29889,
29871,
29941,
29955,
29994,
29945,
29896,
29892,
29871,
29906,
29900,
29896,
29946,
29889,
512,
15056,
23053,
29889,
13,
1678,
14550,
13,
13,
1678,
1053,
12655,
408,
7442,
13,
13,
1678,
281,
485,
29907,
7297,
600,
29906,
353,
518,
9302,
29889,
2378,
29898,
1761,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
876,
363,
281,
485,
29907,
7297,
600,
29918,
29875,
297,
281,
485,
29907,
7297,
600,
29962,
13,
13,
1678,
270,
29918,
29885,
29896,
353,
281,
485,
29907,
7297,
600,
29906,
14352,
29896,
29962,
13,
1678,
29522,
29918,
17619,
353,
7442,
29889,
13519,
29898,
9302,
29889,
2168,
713,
29898,
9302,
29889,
6897,
29898,
29881,
29918,
29885,
29896,
876,
29914,
29900,
29889,
29953,
29955,
29946,
29945,
29892,
29871,
29906,
29897,
13,
13,
1678,
14013,
9065,
353,
5159,
13,
13,
1678,
363,
281,
485,
29907,
7297,
600,
29918,
29875,
297,
281,
485,
29907,
7297,
600,
29906,
29901,
13,
4706,
29522,
29906,
29918,
29893,
485,
29907,
7297,
600,
29918,
29875,
353,
7442,
29889,
2083,
29898,
9302,
29889,
13519,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
29892,
29871,
29906,
876,
29914,
29893,
485,
29907,
7297,
600,
29918,
29875,
29889,
2311,
13,
13,
4706,
29522,
29918,
29990,
29926,
353,
7442,
29889,
3676,
29898,
13,
9651,
7442,
29889,
27525,
398,
29898,
311,
14641,
29906,
29918,
29893,
485,
29907,
7297,
600,
29918,
29875,
448,
29522,
29918,
17619,
29892,
29871,
29900,
876,
13,
13,
4706,
14013,
9065,
29889,
4397,
29898,
311,
14641,
29918,
17619,
29914,
311,
14641,
29918,
29990,
29926,
29897,
13,
13,
1678,
736,
14013,
9065,
13,
13,
13,
1753,
301,
1117,
17370,
5550,
29907,
29918,
1349,
12268,
29898,
29893,
485,
29907,
7297,
600,
29892,
282,
29922,
29941,
1125,
13,
1678,
14550,
13,
1678,
11796,
267,
278,
16897,
995,
313,
2892,
29897,
491,
317,
9026,
29899,
1349,
12268,
518,
29896,
1402,
518,
29906,
29962,
1158,
13,
13,
1678,
6317,
4443,
1057,
13,
4706,
2860,
278,
1243,
313,
6071,
3579,
2272,
1688,
1068,
29897,
278,
4084,
428,
471,
3939,
363,
2253,
13,
4706,
4180,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
13,
1678,
281,
485,
29907,
7297,
600,
29901,
1051,
310,
8857,
470,
1409,
29899,
4561,
13,
4706,
399,
1351,
1026,
16127,
13,
1678,
282,
29901,
938,
470,
5785,
13,
4706,
28379,
29892,
29871,
29941,
491,
2322,
29889,
24953,
363,
278,
5687,
518,
29896,
1402,
13,
4706,
6892,
338,
1304,
29871,
29906,
470,
29871,
29941,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1051,
310,
5785,
29901,
13,
4706,
450,
16897,
1819,
363,
1269,
10742,
1026,
16127,
13,
4706,
4608,
29889,
13,
13,
1678,
2823,
884,
13,
1678,
448,
26589,
13,
1678,
977,
509,
362,
29901,
6680,
393,
671,
445,
740,
304,
4175,
3025,
10742,
1026,
13,
4706,
16127,
13,
1678,
282,
5693,
29873,
29889,
29893,
10511,
687,
29901,
6680,
393,
17753,
10590,
278,
7182,
297,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
1678,
282,
5693,
29873,
29889,
2766,
369,
687,
29901,
6680,
393,
27878,
10590,
278,
7182,
515,
10742,
1026,
322,
13,
4706,
6287,
16127,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
6317,
518,
29896,
29962,
529,
5813,
29958,
8670,
529,
5813,
15513,
317,
9026,
29899,
386,
12268,
29901,
29871,
3672,
410,
27363,
316,
13,
965,
2485,
4447,
20945,
1702,
977,
29873,
1431,
331,
7744,
8657,
316,
269,
1099,
275,
29889,
323,
355,
9339,
953,
13,
965,
5345,
331,
17781,
6225,
506,
1114,
321,
11796,
4264,
29892,
325,
29889,
29871,
29896,
29896,
29892,
302,
29889,
29871,
29906,
29892,
282,
29889,
29871,
29896,
29906,
29896,
29994,
29896,
29941,
29906,
29892,
29871,
29906,
29900,
29896,
29900,
29889,
13,
965,
512,
15056,
23053,
29889,
13,
13,
1678,
6317,
518,
29906,
29962,
529,
5813,
29958,
8670,
529,
5813,
15513,
2514,
29873,
1431,
331,
316,
269,
1099,
275,
3025,
13,
965,
2485,
4447,
20945,
316,
1302,
1389,
293,
13833,
10742,
1026,
29889,
11402,
10544,
321,
405,
7969,
29892,
325,
29889,
29871,
29941,
29953,
29892,
13,
965,
282,
29889,
29871,
29941,
29955,
29994,
29945,
29896,
29892,
29871,
29906,
29900,
29896,
29946,
29889,
512,
15056,
23053,
29889,
13,
1678,
14550,
13,
13,
1678,
1053,
12655,
408,
7442,
13,
13,
1678,
281,
485,
29907,
7297,
600,
29906,
353,
518,
9302,
29889,
2378,
29898,
1761,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
876,
363,
281,
485,
29907,
7297,
600,
29918,
29875,
297,
281,
485,
29907,
7297,
600,
29962,
13,
13,
1678,
14013,
9065,
353,
5159,
13,
13,
1678,
363,
281,
485,
29907,
7297,
600,
29918,
29875,
297,
281,
485,
29907,
7297,
600,
29906,
29901,
13,
4706,
317,
29926,
353,
7442,
29889,
3676,
29898,
29896,
6904,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
29889,
2311,
448,
29871,
29896,
29897,
334,
13,
462,
268,
7442,
29889,
2083,
29898,
9302,
29889,
13519,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
448,
281,
485,
29907,
7297,
600,
29918,
29875,
29889,
12676,
3285,
29871,
29906,
4961,
13,
13,
4706,
1550,
313,
9302,
29889,
6897,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
29897,
6736,
282,
29930,
29903,
29926,
467,
1384,
7295,
13,
9651,
281,
485,
29907,
7297,
600,
29918,
29875,
353,
281,
485,
29907,
7297,
600,
29918,
29875,
29961,
9302,
29889,
6897,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
29897,
529,
282,
29930,
29903,
29926,
29962,
13,
9651,
317,
29926,
353,
7442,
29889,
3676,
29898,
29896,
6904,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
29889,
2311,
448,
29871,
29896,
29897,
334,
13,
462,
308,
7442,
29889,
2083,
29898,
9302,
29889,
13519,
29898,
29893,
485,
29907,
7297,
600,
29918,
29875,
448,
281,
485,
29907,
7297,
600,
29918,
29875,
29889,
12676,
3285,
29871,
29906,
4961,
13,
13,
4706,
14013,
9065,
29889,
4397,
29898,
29886,
29930,
29903,
29926,
29897,
13,
1678,
736,
14013,
9065,
13,
2
] |
school/eCornell/Python Cert/Currency Converter/src/exchangeit.py | KyleGortych/sample_work | 0 | 1605067 | """
User interface for module currency
When run as a script, this module prompts the user for two currencies and amount.
It prints out the result of converting the first currency to the second.
Author: <NAME>
Date: 02/16/2022
"""
import currency
src = input("3-letter code for original currency: ")
src = str(src)
dst = input("3-letter code for the new currency: ")
dst = str(dst)
amt = input("Amount of the original currency: ")
amt = float(amt)
json = currency.service_response(src,dst,amt)
# print(json)
src_result = currency.before_space(currency.get_src(json))
sub_str = src
dst_result = currency.exchange(src,dst,amt)
dst_rounded = round(dst_result, 3)
sub_str2 = str(dst_rounded)
sub_str3 = dst
print("You can exchange " + src_result + " " + sub_str + " for " + sub_str2 + " " + sub_str3 + ".")
| [
1,
9995,
13,
2659,
5067,
363,
3883,
27550,
13,
13,
10401,
1065,
408,
263,
2471,
29892,
445,
3883,
9508,
29879,
278,
1404,
363,
1023,
16256,
15942,
322,
5253,
29889,
13,
3112,
14677,
714,
278,
1121,
310,
17415,
278,
937,
27550,
304,
278,
1473,
29889,
13,
13,
13720,
29901,
529,
5813,
29958,
13,
2539,
29901,
1678,
29900,
29906,
29914,
29896,
29953,
29914,
29906,
29900,
29906,
29906,
13,
15945,
29908,
13,
5215,
27550,
13,
13,
4351,
353,
1881,
703,
29941,
29899,
15670,
775,
363,
2441,
27550,
29901,
16521,
13,
4351,
353,
851,
29898,
4351,
29897,
13,
13,
22992,
353,
1881,
703,
29941,
29899,
15670,
775,
363,
278,
716,
27550,
29901,
16521,
13,
22992,
353,
851,
29898,
22992,
29897,
13,
13,
8035,
353,
1881,
703,
18087,
310,
278,
2441,
27550,
29901,
16521,
13,
8035,
353,
5785,
29898,
8035,
29897,
13,
13,
3126,
353,
27550,
29889,
5509,
29918,
5327,
29898,
4351,
29892,
22992,
29892,
8035,
29897,
13,
29937,
1596,
29898,
3126,
29897,
13,
13,
4351,
29918,
2914,
353,
27550,
29889,
11083,
29918,
3493,
29898,
26095,
29889,
657,
29918,
4351,
29898,
3126,
876,
13,
1491,
29918,
710,
353,
4765,
13,
13,
22992,
29918,
2914,
353,
27550,
29889,
6543,
29898,
4351,
29892,
22992,
29892,
8035,
29897,
13,
22992,
29918,
29878,
7261,
353,
4513,
29898,
22992,
29918,
2914,
29892,
29871,
29941,
29897,
13,
1491,
29918,
710,
29906,
353,
851,
29898,
22992,
29918,
29878,
7261,
29897,
13,
13,
1491,
29918,
710,
29941,
353,
29743,
13,
13,
2158,
703,
3492,
508,
14523,
376,
718,
4765,
29918,
2914,
718,
376,
376,
718,
1014,
29918,
710,
718,
376,
363,
376,
718,
1014,
29918,
710,
29906,
718,
376,
376,
718,
1014,
29918,
710,
29941,
718,
11393,
1159,
13,
2
] |
PythonMPI/computepi/ComputePiSeq.py | terasakisatoshi/MPI | 1 | 177540 | import math
import time
#compute \pi using formula shown below:
#\pi=\int_{0}^{1}\frac{4}{1+x^2}dx \sim =\frac{1}{n}\sum_{i=0}^{n-1}\frac{4}{1+(\frac{i+0.5}{n})^2}
#
def compute_pi(num_step):
h=1.0/num_step
s=0.0
for i in range(num_step):
x=h*(i+0.5)
s+=4.0/(1.0+x**2)
return s*h
def main():
n=int(1.0e8)
start=time.time()
pi=compute_pi(n)
diff=abs(pi-math.pi)
print("pi is approximately %.16f,diff=compute_pi-math.pi is %.16f" % (pi,diff))
elapsed_time=time.time()-start
print("elapsed_time=%f" % elapsed_time )
if __name__ == '__main__':
main() | [
1,
1053,
5844,
13,
5215,
931,
13,
29937,
26017,
320,
1631,
773,
7063,
4318,
2400,
29901,
13,
29937,
29905,
1631,
2013,
524,
648,
29900,
2844,
29896,
1012,
1154,
29912,
29946,
1157,
29896,
29974,
29916,
29985,
29906,
29913,
8235,
320,
3601,
17313,
1154,
29912,
29896,
1157,
29876,
1012,
2083,
648,
29875,
29922,
29900,
2844,
29876,
29899,
29896,
1012,
1154,
29912,
29946,
1157,
29896,
29974,
1194,
1154,
29912,
29875,
29974,
29900,
29889,
29945,
1157,
29876,
28813,
29906,
29913,
13,
29937,
13,
1753,
10272,
29918,
1631,
29898,
1949,
29918,
10568,
1125,
13,
1678,
298,
29922,
29896,
29889,
29900,
29914,
1949,
29918,
10568,
13,
1678,
269,
29922,
29900,
29889,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
1949,
29918,
10568,
1125,
13,
4706,
921,
29922,
29882,
16395,
29875,
29974,
29900,
29889,
29945,
29897,
13,
4706,
269,
23661,
29946,
29889,
29900,
14571,
29896,
29889,
29900,
29974,
29916,
1068,
29906,
29897,
13,
1678,
736,
269,
29930,
29882,
13,
13,
1753,
1667,
7295,
13,
1678,
302,
29922,
524,
29898,
29896,
29889,
29900,
29872,
29947,
29897,
13,
1678,
1369,
29922,
2230,
29889,
2230,
580,
13,
1678,
2930,
29922,
26017,
29918,
1631,
29898,
29876,
29897,
13,
1678,
2923,
29922,
6897,
29898,
1631,
29899,
755,
29889,
1631,
29897,
13,
1678,
1596,
703,
1631,
338,
14235,
18695,
29896,
29953,
29888,
29892,
12765,
29922,
26017,
29918,
1631,
29899,
755,
29889,
1631,
338,
18695,
29896,
29953,
29888,
29908,
1273,
313,
1631,
29892,
12765,
876,
13,
1678,
560,
28170,
29918,
2230,
29922,
2230,
29889,
2230,
580,
29899,
2962,
13,
1678,
1596,
703,
295,
28170,
29918,
2230,
16328,
29888,
29908,
1273,
560,
28170,
29918,
2230,
1723,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
2
] |
code/tensorflow/tests/test_image_generator.py | siduojiang/BERTVision | 5 | 106254 | <reponame>siduojiang/BERTVision<gh_stars>1-10
import unittest
import h5py
#git repo specific setup
import sys
sys.path.append('../utils')
from training_utils import *
from evaluation import *
class TestBERTImageGenerator(unittest.TestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.model = PretrainedBertSquad2Faster('../../bert_base_squad_1e-5_adam_4batchsize_2epochs_weights_BERT_ONLY.h5').model
train = h5py.File('../../../SQuADv2/train_386.h5', 'r')
self.start_ids = train['input_start']
self.end_ids = train['input_end']
self.train_inputs = np.array(train['input_ids'])
self.train_masks = np.array(train['attention_mask'])
self.labels = np.vstack([self.start_ids, self.end_ids]).T
self.offset = 2
self.start_idx = 14325
self.end_idx = 14642
self.images = BERTImageGenerator('../../../data/train/',
self.labels,
batch_size=1,
start_idx = self.start_idx,
end_idx = self.end_idx,
shuffle = False)
self.subset = self.images[self.offset]
def setUp(self):
self.idx = self.start_idx + self.offset
def test_embeddings_shape(self):
#extract image 2 with starting index 14325, leading to image 14325
self.assertEqual(len(self.subset), 2)
self.assertEqual(self.subset[0].shape, (1, 24, 386, 1024))
self.assertEqual(self.subset[1].shape, (1, 2))
def test_offset(self):
manual_load = h5py.File('../../../data/train/%d.h5' %self.idx, 'r')
self.assertTrue((np.array(manual_load['hidden_state_activations'])[0][-1] == self.subset[0][0][0][-1]).all())
def test_label_ids(self):
self.assertEqual(self.subset[1][0][0], self.start_ids[self.idx])
self.assertEqual(self.subset[1][0][1], self.end_ids[self.idx])
def test_embeddings_with_model(self):
embeddings, outputs = self.model.predict([self.train_inputs[[self.idx]], self.train_masks[[self.idx]]])
non_zero_idx = np.sum(self.train_inputs[[self.idx]] != 0)
self.assertTrue((embeddings[12][0][:non_zero_idx][-1] == self.subset[0][0][12][-1]).all())
def test_shuffle_ids(self):
pass
def test_shuffled_labels(self):
pass
if __name__ == '__main__':
unittest.main()
| [
1,
529,
276,
1112,
420,
29958,
29879,
333,
25608,
2397,
574,
29914,
13635,
8050,
2459,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
5215,
443,
27958,
13,
5215,
298,
29945,
2272,
13,
13,
29937,
5559,
13761,
2702,
6230,
13,
5215,
10876,
13,
9675,
29889,
2084,
29889,
4397,
877,
6995,
13239,
1495,
13,
13,
3166,
6694,
29918,
13239,
1053,
334,
13,
3166,
17983,
1053,
334,
13,
13,
1990,
4321,
13635,
29911,
2940,
21575,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
1583,
29889,
4299,
353,
349,
2267,
22042,
29933,
814,
29903,
3425,
29906,
29943,
1901,
877,
21546,
2151,
29918,
3188,
29918,
29879,
3425,
29918,
29896,
29872,
29899,
29945,
29918,
328,
314,
29918,
29946,
16175,
2311,
29918,
29906,
1022,
2878,
29879,
29918,
705,
5861,
29918,
13635,
29911,
29918,
1164,
16786,
29889,
29882,
29945,
2824,
4299,
13,
13,
4706,
7945,
353,
298,
29945,
2272,
29889,
2283,
877,
21546,
6995,
29903,
2182,
3035,
29894,
29906,
29914,
14968,
29918,
29941,
29947,
29953,
29889,
29882,
29945,
742,
525,
29878,
1495,
13,
4706,
1583,
29889,
2962,
29918,
4841,
353,
7945,
1839,
2080,
29918,
2962,
2033,
13,
4706,
1583,
29889,
355,
29918,
4841,
353,
7945,
1839,
2080,
29918,
355,
2033,
13,
4706,
1583,
29889,
14968,
29918,
2080,
29879,
353,
7442,
29889,
2378,
29898,
14968,
1839,
2080,
29918,
4841,
11287,
13,
4706,
1583,
29889,
14968,
29918,
13168,
29879,
353,
7442,
29889,
2378,
29898,
14968,
1839,
1131,
2509,
29918,
13168,
11287,
13,
4706,
1583,
29889,
21134,
353,
7442,
29889,
29894,
1429,
4197,
1311,
29889,
2962,
29918,
4841,
29892,
1583,
29889,
355,
29918,
4841,
14664,
29911,
13,
4706,
1583,
29889,
10289,
353,
29871,
29906,
13,
4706,
1583,
29889,
2962,
29918,
13140,
353,
29871,
29896,
29946,
29941,
29906,
29945,
13,
4706,
1583,
29889,
355,
29918,
13140,
353,
29871,
29896,
29946,
29953,
29946,
29906,
13,
13,
4706,
1583,
29889,
8346,
353,
350,
20161,
2940,
21575,
877,
21546,
6995,
1272,
29914,
14968,
29914,
742,
13,
462,
9651,
1583,
29889,
21134,
29892,
13,
462,
9651,
9853,
29918,
2311,
29922,
29896,
29892,
13,
462,
9651,
1369,
29918,
13140,
353,
1583,
29889,
2962,
29918,
13140,
29892,
13,
462,
9651,
1095,
29918,
13140,
353,
1583,
29889,
355,
29918,
13140,
29892,
13,
462,
9651,
528,
21897,
353,
7700,
29897,
13,
13,
4706,
1583,
29889,
6484,
353,
1583,
29889,
8346,
29961,
1311,
29889,
10289,
29962,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
13140,
353,
1583,
29889,
2962,
29918,
13140,
718,
1583,
29889,
10289,
13,
13,
1678,
822,
1243,
29918,
17987,
29881,
886,
29918,
12181,
29898,
1311,
1125,
13,
4706,
396,
21111,
1967,
29871,
29906,
411,
6257,
2380,
29871,
29896,
29946,
29941,
29906,
29945,
29892,
8236,
304,
1967,
29871,
29896,
29946,
29941,
29906,
29945,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
1311,
29889,
6484,
511,
29871,
29906,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
6484,
29961,
29900,
1822,
12181,
29892,
313,
29896,
29892,
29871,
29906,
29946,
29892,
29871,
29941,
29947,
29953,
29892,
29871,
29896,
29900,
29906,
29946,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
6484,
29961,
29896,
1822,
12181,
29892,
313,
29896,
29892,
29871,
29906,
876,
13,
13,
1678,
822,
1243,
29918,
10289,
29898,
1311,
1125,
13,
13,
4706,
12219,
29918,
1359,
353,
298,
29945,
2272,
29889,
2283,
877,
21546,
6995,
1272,
29914,
14968,
22584,
29881,
29889,
29882,
29945,
29915,
1273,
1311,
29889,
13140,
29892,
525,
29878,
1495,
13,
4706,
1583,
29889,
9294,
5574,
3552,
9302,
29889,
2378,
29898,
11288,
29918,
1359,
1839,
10892,
29918,
3859,
29918,
11236,
800,
2033,
9601,
29900,
3816,
29899,
29896,
29962,
1275,
1583,
29889,
6484,
29961,
29900,
3816,
29900,
3816,
29900,
3816,
29899,
29896,
14664,
497,
3101,
13,
13,
1678,
822,
1243,
29918,
1643,
29918,
4841,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
6484,
29961,
29896,
3816,
29900,
3816,
29900,
1402,
1583,
29889,
2962,
29918,
4841,
29961,
1311,
29889,
13140,
2314,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
6484,
29961,
29896,
3816,
29900,
3816,
29896,
1402,
1583,
29889,
355,
29918,
4841,
29961,
1311,
29889,
13140,
2314,
13,
13,
1678,
822,
1243,
29918,
17987,
29881,
886,
29918,
2541,
29918,
4299,
29898,
1311,
1125,
13,
13,
4706,
8297,
29881,
886,
29892,
14391,
353,
1583,
29889,
4299,
29889,
27711,
4197,
1311,
29889,
14968,
29918,
2080,
29879,
8999,
1311,
29889,
13140,
20526,
1583,
29889,
14968,
29918,
13168,
29879,
8999,
1311,
29889,
13140,
5262,
2314,
13,
4706,
1661,
29918,
9171,
29918,
13140,
353,
7442,
29889,
2083,
29898,
1311,
29889,
14968,
29918,
2080,
29879,
8999,
1311,
29889,
13140,
5262,
2804,
29871,
29900,
29897,
13,
4706,
1583,
29889,
9294,
5574,
3552,
17987,
29881,
886,
29961,
29896,
29906,
3816,
29900,
3816,
29901,
5464,
29918,
9171,
29918,
13140,
3816,
29899,
29896,
29962,
1275,
1583,
29889,
6484,
29961,
29900,
3816,
29900,
3816,
29896,
29906,
3816,
29899,
29896,
14664,
497,
3101,
13,
13,
1678,
822,
1243,
29918,
845,
21897,
29918,
4841,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
1243,
29918,
845,
3096,
839,
29918,
21134,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
Crypto-hardRSA/flag.py | JSW2020/hsctf-2019-freshmen | 16 | 14930 | flag = "flag{b3453333-9da9-49ae-b4ed-0017c392d58e}"
e1 = 65537
e2 = 368273 | [
1,
7353,
353,
376,
15581,
29912,
29890,
29941,
29946,
29945,
29941,
29941,
29941,
29941,
29899,
29929,
1388,
29929,
29899,
29946,
29929,
3660,
29899,
29890,
29946,
287,
29899,
29900,
29900,
29896,
29955,
29883,
29941,
29929,
29906,
29881,
29945,
29947,
29872,
5038,
13,
29872,
29896,
353,
29871,
29953,
29945,
29945,
29941,
29955,
13,
29872,
29906,
353,
29871,
29941,
29953,
29947,
29906,
29955,
29941,
2
] |
tests/service/ai/test_not_killing_itself_ai.py | jonashellmann/informaticup21-team-chillow | 3 | 11942 | import unittest
from datetime import datetime, timezone
from typing import List
from chillow.service.ai.not_killing_itself_ai import NotKillingItselfAI
from chillow.model.action import Action
from chillow.model.cell import Cell
from chillow.model.direction import Direction
from chillow.model.game import Game
from chillow.model.player import Player
from chillow.service.game_service import GameService
class NotKillingItselfAITest(unittest.TestCase):
def test_ai_should_choose_the_own_non_killing_itself_action(self):
player1 = Player(1, 0, 0, Direction.up, 1, True, "")
player2 = Player(2, 4, 4, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell([player1]), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell([player2])]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 3)
actions: List[Action] = sut.find_surviving_actions(game_service, 3)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 1)
def test_ai_should_choose_the_correct_list_of_actions_non_killing_itself(self):
player1 = Player(1, 0, 1, Direction.up, 1, True, "")
player2 = Player(2, 4, 4, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player1]), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell([player2])]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 3)
actions: List[Action] = sut.find_surviving_actions(game_service, 3)
self.assertTrue(Action.change_nothing in actions)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 2)
def test_ai_should_choose_the_correct_list_of_actions_non_killing_itself2(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell([player2]), Cell(), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 3)
actions: List[Action] = sut.find_surviving_actions(game_service, 3)
self.assertTrue(Action.turn_left in actions)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 2)
def test_ai_should_choose_the_correct_list_of_actions_non_killing_itself_in_turn_6(self):
player1 = Player(1, 0, 4, Direction.up, 3, True, "")
player2 = Player(2, 0, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player1]), Cell(), Cell(), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
game_service.turn.turn_ctr = 6
sut = NotKillingItselfAI(player1, [], 4, 0, 3)
actions: List[Action] = sut.find_surviving_actions(game_service, 1)
self.assertTrue(Action.slow_down in actions)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(Action.speed_up in actions)
self.assertTrue(len(actions) == 3)
def test_ai_should_not_choose_speed_up_if_max_speed_is_allready_reached(self):
MAX_SPEED = 3
player1 = Player(1, 0, 4, Direction.up, MAX_SPEED, True, "")
player2 = Player(2, 0, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player1]), Cell(), Cell(), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], MAX_SPEED, 0, 3)
actions: List[Action] = sut.find_surviving_actions(game_service, 1)
self.assertTrue(Action.slow_down in actions)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 2)
def test_ai_should_calc_action_with_max_distance(self):
player1 = Player(1, 0, 4, Direction.up, 1, True, "")
player2 = Player(2, 0, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player1]), Cell(), Cell(), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 3)
actions: List[Action] = sut.calc_action_with_max_distance_to_visited_cells(game_service, [Action.speed_up,
Action.change_nothing,
Action.turn_right])
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 1)
def test_ai_should_calc_all_action_with_max_distance_with_max_worse_distance(self):
MAX_WORSE_DISTANCE = 1
player1 = Player(1, 0, 4, Direction.up, 1, True, "")
player2 = Player(2, 4, 4, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player1]), Cell(), Cell(), Cell(), Cell([player2])]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, MAX_WORSE_DISTANCE, 3)
actions: List[Action] = sut.calc_action_with_max_distance_to_visited_cells(game_service, [Action.speed_up,
Action.change_nothing,
Action.turn_right])
self.assertTrue(Action.speed_up in actions)
self.assertTrue(Action.change_nothing in actions)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 3)
def test_get_information(self):
player = Player(1, 0, 4, Direction.up, 1, True, "")
sut = NotKillingItselfAI(player, [], 3, 1, 3)
expected = "max_speed=3, max_worse_distance=1, depth=3"
result = sut.get_information()
self.assertEqual(expected, result)
def test_ai_should_choose_the_correct_list_of_actions_non_killing_itself_with_depth_greater_than_one(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell([player2]), Cell(), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell(), Cell()],
[Cell([player2]), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 2)
actions: List[Action] = sut.find_surviving_actions(game_service, 2)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 1)
def test_ai_should_choose_empty_list_with_depth_greater_than_one_and_no_surviving_action(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell([player2]), Cell([player2]), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell([player2]), Cell()],
[Cell([player2]), Cell(), Cell([player2]), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 2)
actions: List[Action] = sut.find_surviving_actions(game_service, 2)
self.assertTrue(len(actions) == 0)
def test_ai_should_choose_correct_list_with_depth_three_and_surviving_action(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell([player2]), Cell([player2]), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell([player2]), Cell()],
[Cell([player2]), Cell(), Cell(), Cell(), Cell()],
[Cell(), Cell(), Cell(), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 3)
actions: List[Action] = sut.find_surviving_actions(game_service, 3)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 1)
def test_ai_should_choose_empty_list_with_depth_three_and_no_surviving_action(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell([player2]), Cell([player2]), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell([player2]), Cell()],
[Cell([player2]), Cell([player2]), Cell(), Cell([player2]), Cell()],
[Cell(), Cell(), Cell([player2]), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 3)
actions: List[Action] = sut.find_surviving_actions(game_service, 3)
self.assertTrue(len(actions) == 0)
def test_ai_should_choose_best_list_of_actions_by_depth_from_lower_depth(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell([player2]), Cell([player2]), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell([player2]), Cell()],
[Cell([player2]), Cell([player2]), Cell(), Cell([player2]), Cell()],
[Cell(), Cell(), Cell([player2]), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 5)
actions: List[Action] = sut.find_surviving_actions_with_best_depth(game_service)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 1)
def test_ai_should_choose_best_list_of_actions_by_depth(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell([player2]), Cell([player2]), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell([player2]), Cell()],
[Cell([player2]), Cell(), Cell(), Cell([player2]), Cell()],
[Cell(), Cell(), Cell([player2]), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 5)
actions: List[Action] = sut.find_surviving_actions_with_best_depth(game_service)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 1)
def test_ai_should_choose_best_list_of_actions_in_lowest_possible_depth(self):
player1 = Player(1, 1, 2, Direction.up, 1, True, "")
player2 = Player(2, 1, 1, Direction.down, 3, True, "")
players = [player1, player2]
cells = [[Cell(), Cell(), Cell(), Cell(), Cell()],
[Cell([player2]), Cell([player2]), Cell([player2]), Cell(), Cell()],
[Cell(), Cell([player1]), Cell(), Cell([player2]), Cell()],
[Cell([player2]), Cell(), Cell([player2]), Cell([player2]), Cell()],
[Cell(), Cell(), Cell([player2]), Cell(), Cell()]]
time = datetime(2020, 10, 1, 12, 5, 13, 0, timezone.utc)
game = Game(5, 5, cells, players, 2, True, time)
game_service = GameService(game)
sut = NotKillingItselfAI(player1, [], 3, 0, 5)
actions: List[Action] = sut.find_surviving_actions_with_best_depth(game_service)
self.assertTrue(Action.turn_left in actions)
self.assertTrue(Action.turn_right in actions)
self.assertTrue(len(actions) == 2)
| [
1,
1053,
443,
27958,
13,
3166,
12865,
1053,
12865,
29892,
29431,
13,
3166,
19229,
1053,
2391,
13,
13,
3166,
521,
453,
340,
29889,
5509,
29889,
1794,
29889,
1333,
29918,
29895,
8873,
29918,
1169,
761,
29918,
1794,
1053,
2216,
29968,
8873,
3112,
1311,
23869,
13,
3166,
521,
453,
340,
29889,
4299,
29889,
2467,
1053,
9123,
13,
3166,
521,
453,
340,
29889,
4299,
29889,
3729,
1053,
19413,
13,
3166,
521,
453,
340,
29889,
4299,
29889,
20845,
1053,
360,
8684,
13,
3166,
521,
453,
340,
29889,
4299,
29889,
11802,
1053,
8448,
13,
3166,
521,
453,
340,
29889,
4299,
29889,
9106,
1053,
14574,
13,
3166,
521,
453,
340,
29889,
5509,
29889,
11802,
29918,
5509,
1053,
8448,
3170,
13,
13,
13,
1990,
2216,
29968,
8873,
3112,
1311,
29909,
1806,
342,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
1552,
29918,
776,
29918,
5464,
29918,
29895,
8873,
29918,
1169,
761,
29918,
2467,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29946,
29892,
29871,
29946,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
4197,
9106,
29906,
2314,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29941,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
1552,
29918,
15728,
29918,
1761,
29918,
974,
29918,
7387,
29918,
5464,
29918,
29895,
8873,
29918,
1169,
761,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29946,
29892,
29871,
29946,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
4197,
9106,
29906,
2314,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29941,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
3167,
29918,
28450,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
1552,
29918,
15728,
29918,
1761,
29918,
974,
29918,
7387,
29918,
5464,
29918,
29895,
8873,
29918,
1169,
761,
29906,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
4197,
9106,
29906,
11724,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29941,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1563,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
1552,
29918,
15728,
29918,
1761,
29918,
974,
29918,
7387,
29918,
5464,
29918,
29895,
8873,
29918,
1169,
761,
29918,
262,
29918,
685,
29918,
29953,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29900,
29892,
29871,
29946,
29892,
360,
8684,
29889,
786,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
5262,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
3748,
29918,
5509,
29889,
685,
29889,
685,
29918,
9988,
353,
29871,
29953,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29946,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29896,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
28544,
29918,
3204,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
19322,
29918,
786,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29941,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
1333,
29918,
21803,
29918,
19322,
29918,
786,
29918,
361,
29918,
3317,
29918,
19322,
29918,
275,
29918,
497,
2040,
29918,
276,
3791,
29898,
1311,
1125,
13,
4706,
18134,
29918,
29903,
4162,
3352,
353,
29871,
29941,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29900,
29892,
29871,
29946,
29892,
360,
8684,
29889,
786,
29892,
18134,
29918,
29903,
4162,
3352,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
5262,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
18134,
29918,
29903,
4162,
3352,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29896,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
28544,
29918,
3204,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
28667,
29918,
2467,
29918,
2541,
29918,
3317,
29918,
19244,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29900,
29892,
29871,
29946,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
5262,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
28667,
29918,
2467,
29918,
2541,
29918,
3317,
29918,
19244,
29918,
517,
29918,
1730,
1573,
29918,
3729,
29879,
29898,
11802,
29918,
5509,
29892,
518,
4276,
29889,
19322,
29918,
786,
29892,
13,
462,
462,
462,
462,
462,
462,
29871,
9123,
29889,
3167,
29918,
28450,
29892,
13,
462,
462,
462,
462,
462,
462,
29871,
9123,
29889,
685,
29918,
1266,
2314,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
28667,
29918,
497,
29918,
2467,
29918,
2541,
29918,
3317,
29918,
19244,
29918,
2541,
29918,
3317,
29918,
13762,
344,
29918,
19244,
29898,
1311,
1125,
13,
4706,
18134,
29918,
11686,
1660,
29918,
4571,
1254,
23219,
353,
29871,
29896,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29900,
29892,
29871,
29946,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29946,
29892,
29871,
29946,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
4197,
9106,
29906,
2314,
5262,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
18134,
29918,
11686,
1660,
29918,
4571,
1254,
23219,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
28667,
29918,
2467,
29918,
2541,
29918,
3317,
29918,
19244,
29918,
517,
29918,
1730,
1573,
29918,
3729,
29879,
29898,
11802,
29918,
5509,
29892,
518,
4276,
29889,
19322,
29918,
786,
29892,
13,
462,
462,
462,
462,
462,
462,
29871,
9123,
29889,
3167,
29918,
28450,
29892,
13,
462,
462,
462,
462,
462,
462,
29871,
9123,
29889,
685,
29918,
1266,
2314,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
19322,
29918,
786,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
3167,
29918,
28450,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29941,
29897,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
19678,
29898,
1311,
1125,
13,
4706,
4847,
353,
14574,
29898,
29896,
29892,
29871,
29900,
29892,
29871,
29946,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29892,
19997,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29941,
29897,
13,
4706,
3806,
353,
376,
3317,
29918,
19322,
29922,
29941,
29892,
4236,
29918,
13762,
344,
29918,
19244,
29922,
29896,
29892,
10809,
29922,
29941,
29908,
13,
13,
4706,
1121,
353,
269,
329,
29889,
657,
29918,
19678,
580,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
9684,
29892,
1121,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
1552,
29918,
15728,
29918,
1761,
29918,
974,
29918,
7387,
29918,
5464,
29918,
29895,
8873,
29918,
1169,
761,
29918,
2541,
29918,
19488,
29918,
7979,
1008,
29918,
27603,
29918,
650,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
965,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
3285,
19413,
3285,
19413,
3285,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
19413,
3285,
259,
19413,
3285,
19413,
3285,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29906,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29906,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
6310,
29918,
1761,
29918,
2541,
29918,
19488,
29918,
7979,
1008,
29918,
27603,
29918,
650,
29918,
392,
29918,
1217,
29918,
7610,
29894,
4357,
29918,
2467,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
3285,
3986,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29906,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29906,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
15728,
29918,
1761,
29918,
2541,
29918,
19488,
29918,
17536,
29918,
392,
29918,
7610,
29894,
4357,
29918,
2467,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29941,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
6310,
29918,
1761,
29918,
2541,
29918,
19488,
29918,
17536,
29918,
392,
29918,
1217,
29918,
7610,
29894,
4357,
29918,
2467,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
3285,
3986,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29941,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29898,
11802,
29918,
5509,
29892,
29871,
29941,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
13318,
29918,
1761,
29918,
974,
29918,
7387,
29918,
1609,
29918,
19488,
29918,
3166,
29918,
13609,
29918,
19488,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
3285,
3986,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29945,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29918,
2541,
29918,
13318,
29918,
19488,
29898,
11802,
29918,
5509,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
13318,
29918,
1761,
29918,
974,
29918,
7387,
29918,
1609,
29918,
19488,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
3285,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
3285,
3986,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29945,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29918,
2541,
29918,
13318,
29918,
19488,
29898,
11802,
29918,
5509,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
1794,
29918,
9344,
29918,
21803,
29918,
13318,
29918,
1761,
29918,
974,
29918,
7387,
29918,
262,
29918,
677,
342,
29918,
27338,
29918,
19488,
29898,
1311,
1125,
13,
4706,
4847,
29896,
353,
14574,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
29892,
360,
8684,
29889,
786,
29892,
29871,
29896,
29892,
5852,
29892,
20569,
13,
4706,
4847,
29906,
353,
14574,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
360,
8684,
29889,
3204,
29892,
29871,
29941,
29892,
5852,
29892,
20569,
13,
4706,
10769,
353,
518,
9106,
29896,
29892,
4847,
29906,
29962,
13,
4706,
9101,
353,
5519,
4617,
3285,
965,
19413,
3285,
3986,
19413,
3285,
9651,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
4197,
9106,
29906,
11724,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
4197,
9106,
29896,
11724,
19413,
3285,
9651,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
4197,
9106,
29906,
11724,
29871,
19413,
3285,
3986,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
4197,
9106,
29906,
11724,
1678,
19413,
580,
1402,
13,
462,
518,
4617,
3285,
965,
19413,
3285,
3986,
19413,
4197,
9106,
29906,
11724,
259,
19413,
3285,
632,
19413,
580,
5262,
13,
13,
4706,
931,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29945,
29892,
29871,
29896,
29941,
29892,
29871,
29900,
29892,
29431,
29889,
329,
29883,
29897,
13,
4706,
3748,
353,
8448,
29898,
29945,
29892,
29871,
29945,
29892,
9101,
29892,
10769,
29892,
29871,
29906,
29892,
5852,
29892,
931,
29897,
13,
4706,
3748,
29918,
5509,
353,
8448,
3170,
29898,
11802,
29897,
13,
4706,
269,
329,
353,
2216,
29968,
8873,
3112,
1311,
23869,
29898,
9106,
29896,
29892,
19997,
29871,
29941,
29892,
29871,
29900,
29892,
29871,
29945,
29897,
13,
13,
4706,
8820,
29901,
2391,
29961,
4276,
29962,
353,
269,
329,
29889,
2886,
29918,
7610,
29894,
4357,
29918,
7387,
29918,
2541,
29918,
13318,
29918,
19488,
29898,
11802,
29918,
5509,
29897,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1563,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
4276,
29889,
685,
29918,
1266,
297,
8820,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2435,
29898,
7387,
29897,
1275,
29871,
29906,
29897,
13,
2
] |
ebl/tests/corpus/test_line.py | ElectronicBabylonianLiterature/ebl-api | 4 | 111754 | <gh_stars>1-10
from typing import Sequence
import pytest
from ebl.corpus.domain.line import Line, LineVariant, ManuscriptLine
from ebl.transliteration.domain.atf import Ruling, Surface
from ebl.transliteration.domain.dollar_line import RulingDollarLine
from ebl.transliteration.domain.enclosure_tokens import BrokenAway
from ebl.transliteration.domain.labels import ColumnLabel, Label, SurfaceLabel
from ebl.transliteration.domain.line_number import LineNumber
from ebl.transliteration.domain.markup import StringPart
from ebl.transliteration.domain.normalized_akkadian import AkkadianWord
from ebl.transliteration.domain.note_line import NoteLine
from ebl.transliteration.domain.parallel_line import ParallelComposition
from ebl.transliteration.domain.sign_tokens import Reading
from ebl.transliteration.domain.text_line import TextLine
from ebl.transliteration.domain.tokens import ValueToken
from ebl.transliteration.domain.translation_line import Extent, TranslationLine
from ebl.transliteration.domain.word_tokens import Word
LINE_NUMBER = LineNumber(1)
LINE_RECONSTRUCTION = (AkkadianWord.of((ValueToken.of("buāru"),)),)
NOTE = None
MANUSCRIPT_ID = 9001
LABELS = (SurfaceLabel.from_label(Surface.OBVERSE),)
MANUSCRIPT_TEXT = TextLine(LINE_NUMBER, (Word.of([Reading.of([ValueToken.of("ku")])]),))
PARATEXT = (NoteLine((StringPart("note"),)), RulingDollarLine(Ruling.SINGLE))
OMITTED_WORDS = (1,)
PARALLEL_LINES = (ParallelComposition(False, "a composition", LineNumber(7)),)
INTERTEXT = (StringPart("foo"),)
LINE_VARIANT = LineVariant(
LINE_RECONSTRUCTION,
NOTE,
(ManuscriptLine(MANUSCRIPT_ID, LABELS, MANUSCRIPT_TEXT, PARATEXT, OMITTED_WORDS),),
PARALLEL_LINES,
INTERTEXT,
)
def test_invalid_extent() -> None:
translation = TranslationLine(
tuple(), extent=Extent(LineNumber(1), (SurfaceLabel(tuple(), Surface.OBVERSE),))
)
with pytest.raises(
ValueError, match="Labels are not allowed in line translations."
):
Line(LineNumber(1), tuple(), translation=(translation,)),
def test_line_variant_constructor():
assert LINE_VARIANT.reconstruction == LINE_RECONSTRUCTION
assert LINE_VARIANT.note == NOTE
assert LINE_VARIANT.parallel_lines == PARALLEL_LINES
assert LINE_VARIANT.intertext == INTERTEXT
assert LINE_VARIANT.manuscripts[0].manuscript_id == MANUSCRIPT_ID
assert LINE_VARIANT.manuscripts[0].labels == LABELS
assert LINE_VARIANT.manuscripts[0].line == MANUSCRIPT_TEXT
assert LINE_VARIANT.manuscripts[0].paratext == PARATEXT
assert LINE_VARIANT.manuscripts[0].omitted_words == OMITTED_WORDS
@pytest.mark.parametrize( # pyre-ignore[56]
"labels",
[
(ColumnLabel.from_label("i"), ColumnLabel.from_label("ii")),
(
SurfaceLabel.from_label(Surface.OBVERSE),
SurfaceLabel.from_label(Surface.REVERSE),
),
(ColumnLabel.from_label("i"), SurfaceLabel.from_label(Surface.REVERSE)),
],
)
def test_invalid_labels(labels: Sequence[Label]):
with pytest.raises(ValueError):
ManuscriptLine(manuscript_id=1, labels=labels, line=TextLine(LineNumber(1)))
def test_invalid_reconstruction():
with pytest.raises(ValueError):
Line(
LINE_NUMBER,
(LineVariant((AkkadianWord.of((BrokenAway.open(),)),), NOTE, tuple()),),
False,
False,
)
def test_update_manuscript_alignment():
word1 = Word.of(
[Reading.of_name("ku")], alignment=0, variant=Word.of([Reading.of_name("uk")])
)
word2 = Word.of(
[Reading.of_name("ra")], alignment=1, variant=Word.of([Reading.of_name("ar")])
)
word3 = Word.of(
[Reading.of_name("pa")], alignment=2, variant=Word.of([Reading.of_name("ap")])
)
manuscript = ManuscriptLine(
MANUSCRIPT_ID,
LABELS,
TextLine(LineNumber(1), (word1, word2, word3)),
PARATEXT,
(1, 3),
)
expected = ManuscriptLine(
MANUSCRIPT_ID,
LABELS,
TextLine(
LineNumber(1),
(
word1.set_alignment(None, None),
word2.set_alignment(0, word2.variant),
word3.set_alignment(None, None),
),
),
PARATEXT,
(0,),
)
assert manuscript.update_alignments([None, 0]) == expected
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
19229,
1053,
922,
3910,
13,
13,
5215,
11451,
1688,
13,
13,
3166,
321,
2204,
29889,
2616,
13364,
29889,
7247,
29889,
1220,
1053,
7407,
29892,
7407,
10444,
424,
29892,
2315,
375,
924,
3542,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
271,
29888,
1053,
390,
19478,
29892,
6298,
2161,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
29881,
26810,
29918,
1220,
1053,
390,
19478,
29928,
26810,
3542,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
264,
25071,
29918,
517,
12360,
1053,
4358,
1717,
29909,
1582,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
21134,
1053,
12481,
4775,
29892,
15796,
29892,
6298,
2161,
4775,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
1220,
29918,
4537,
1053,
7407,
4557,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
3502,
786,
1053,
1714,
7439,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
8945,
1891,
29918,
557,
29895,
328,
713,
1053,
319,
6859,
328,
713,
14463,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
6812,
29918,
1220,
1053,
3940,
3542,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
23482,
29918,
1220,
1053,
1459,
6553,
1523,
3283,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
4530,
29918,
517,
12360,
1053,
21439,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
726,
29918,
1220,
1053,
3992,
3542,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
517,
12360,
1053,
7865,
6066,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
3286,
18411,
29918,
1220,
1053,
7338,
296,
29892,
4103,
18411,
3542,
13,
3166,
321,
2204,
29889,
3286,
20889,
362,
29889,
7247,
29889,
1742,
29918,
517,
12360,
1053,
10803,
13,
13,
13,
18521,
29918,
23207,
353,
7407,
4557,
29898,
29896,
29897,
13,
18521,
29918,
1525,
6007,
10810,
29965,
9838,
353,
313,
29909,
6859,
328,
713,
14463,
29889,
974,
3552,
1917,
6066,
29889,
974,
703,
2423,
30107,
582,
4968,
8243,
29897,
13,
12256,
29923,
353,
6213,
13,
27616,
3308,
29907,
24290,
29918,
1367,
353,
29871,
29929,
29900,
29900,
29896,
13,
24461,
6670,
29903,
353,
313,
18498,
2161,
4775,
29889,
3166,
29918,
1643,
29898,
18498,
2161,
29889,
14824,
5348,
1660,
511,
29897,
13,
27616,
3308,
29907,
24290,
29918,
16975,
353,
3992,
3542,
29898,
18521,
29918,
23207,
29892,
313,
14463,
29889,
974,
4197,
6359,
292,
29889,
974,
4197,
1917,
6066,
29889,
974,
703,
2120,
1159,
2314,
11724,
876,
13,
16320,
3040,
12188,
353,
313,
9842,
3542,
3552,
1231,
7439,
703,
6812,
4968,
8243,
390,
19478,
29928,
26810,
3542,
29898,
29934,
19478,
29889,
29903,
4214,
1307,
876,
13,
6488,
1806,
29911,
3352,
29918,
11686,
8452,
353,
313,
29896,
29892,
29897,
13,
16320,
1964,
1307,
29931,
29918,
23714,
2890,
353,
313,
2177,
6553,
1523,
3283,
29898,
8824,
29892,
376,
29874,
15259,
613,
7407,
4557,
29898,
29955,
8243,
29897,
13,
23845,
16975,
353,
313,
1231,
7439,
703,
5431,
4968,
29897,
13,
13,
18521,
29918,
26865,
29902,
13566,
353,
7407,
10444,
424,
29898,
13,
1678,
365,
8895,
29918,
1525,
6007,
10810,
29965,
9838,
29892,
13,
1678,
6058,
29923,
29892,
13,
1678,
313,
2517,
375,
924,
3542,
29898,
27616,
3308,
29907,
24290,
29918,
1367,
29892,
365,
2882,
6670,
29903,
29892,
341,
2190,
3308,
29907,
24290,
29918,
16975,
29892,
349,
1718,
3040,
12188,
29892,
438,
26349,
29911,
3352,
29918,
11686,
8452,
511,
511,
13,
1678,
349,
1718,
1964,
1307,
29931,
29918,
23714,
2890,
29892,
13,
1678,
2672,
4945,
16975,
29892,
13,
29897,
13,
13,
13,
1753,
1243,
29918,
20965,
29918,
1062,
296,
580,
1599,
6213,
29901,
13,
1678,
13962,
353,
4103,
18411,
3542,
29898,
13,
4706,
18761,
3285,
15834,
29922,
5647,
296,
29898,
3542,
4557,
29898,
29896,
511,
313,
18498,
2161,
4775,
29898,
23583,
3285,
6298,
2161,
29889,
14824,
5348,
1660,
511,
876,
13,
1678,
1723,
13,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
13,
4706,
7865,
2392,
29892,
1993,
543,
4775,
29879,
526,
451,
6068,
297,
1196,
5578,
800,
1213,
13,
268,
1125,
13,
4706,
7407,
29898,
3542,
4557,
29898,
29896,
511,
18761,
3285,
13962,
7607,
3286,
18411,
29892,
8243,
13,
13,
13,
1753,
1243,
29918,
1220,
29918,
19365,
29918,
27821,
7295,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
276,
3075,
4080,
1275,
365,
8895,
29918,
1525,
6007,
10810,
29965,
9838,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
6812,
1275,
6058,
29923,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
23482,
29918,
9012,
1275,
349,
1718,
1964,
1307,
29931,
29918,
23714,
2890,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
1639,
726,
1275,
2672,
4945,
16975,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
1171,
375,
924,
29879,
29961,
29900,
1822,
1171,
375,
924,
29918,
333,
1275,
341,
2190,
3308,
29907,
24290,
29918,
1367,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
1171,
375,
924,
29879,
29961,
29900,
1822,
21134,
1275,
365,
2882,
6670,
29903,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
1171,
375,
924,
29879,
29961,
29900,
1822,
1220,
1275,
341,
2190,
3308,
29907,
24290,
29918,
16975,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
1171,
375,
924,
29879,
29961,
29900,
1822,
862,
403,
486,
1275,
349,
1718,
3040,
12188,
13,
1678,
4974,
365,
8895,
29918,
26865,
29902,
13566,
29889,
1171,
375,
924,
29879,
29961,
29900,
1822,
290,
4430,
29918,
9303,
1275,
438,
26349,
29911,
3352,
29918,
11686,
8452,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
29871,
396,
11451,
276,
29899,
17281,
29961,
29945,
29953,
29962,
13,
1678,
376,
21134,
613,
13,
1678,
518,
13,
4706,
313,
4409,
4775,
29889,
3166,
29918,
1643,
703,
29875,
4968,
12481,
4775,
29889,
3166,
29918,
1643,
703,
2236,
1159,
511,
13,
4706,
313,
13,
9651,
6298,
2161,
4775,
29889,
3166,
29918,
1643,
29898,
18498,
2161,
29889,
14824,
5348,
1660,
511,
13,
9651,
6298,
2161,
4775,
29889,
3166,
29918,
1643,
29898,
18498,
2161,
29889,
1525,
5348,
1660,
511,
13,
4706,
10353,
13,
4706,
313,
4409,
4775,
29889,
3166,
29918,
1643,
703,
29875,
4968,
6298,
2161,
4775,
29889,
3166,
29918,
1643,
29898,
18498,
2161,
29889,
1525,
5348,
1660,
8243,
13,
1678,
21251,
13,
29897,
13,
1753,
1243,
29918,
20965,
29918,
21134,
29898,
21134,
29901,
922,
3910,
29961,
4775,
29962,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
4706,
2315,
375,
924,
3542,
29898,
1171,
375,
924,
29918,
333,
29922,
29896,
29892,
11073,
29922,
21134,
29892,
1196,
29922,
1626,
3542,
29898,
3542,
4557,
29898,
29896,
4961,
13,
13,
13,
1753,
1243,
29918,
20965,
29918,
276,
3075,
4080,
7295,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
4706,
7407,
29898,
13,
9651,
365,
8895,
29918,
23207,
29892,
13,
9651,
313,
3542,
10444,
424,
3552,
29909,
6859,
328,
713,
14463,
29889,
974,
3552,
29857,
1717,
29909,
1582,
29889,
3150,
3285,
8243,
511,
6058,
29923,
29892,
18761,
25739,
511,
13,
9651,
7700,
29892,
13,
9651,
7700,
29892,
13,
4706,
1723,
13,
13,
13,
1753,
1243,
29918,
5504,
29918,
1171,
375,
924,
29918,
2520,
358,
7295,
13,
1678,
1734,
29896,
353,
10803,
29889,
974,
29898,
13,
4706,
518,
6359,
292,
29889,
974,
29918,
978,
703,
2120,
1159,
1402,
22239,
29922,
29900,
29892,
17305,
29922,
14463,
29889,
974,
4197,
6359,
292,
29889,
974,
29918,
978,
703,
2679,
1159,
2314,
13,
1678,
1723,
13,
1678,
1734,
29906,
353,
10803,
29889,
974,
29898,
13,
4706,
518,
6359,
292,
29889,
974,
29918,
978,
703,
336,
1159,
1402,
22239,
29922,
29896,
29892,
17305,
29922,
14463,
29889,
974,
4197,
6359,
292,
29889,
974,
29918,
978,
703,
279,
1159,
2314,
13,
1678,
1723,
13,
1678,
1734,
29941,
353,
10803,
29889,
974,
29898,
13,
4706,
518,
6359,
292,
29889,
974,
29918,
978,
703,
3274,
1159,
1402,
22239,
29922,
29906,
29892,
17305,
29922,
14463,
29889,
974,
4197,
6359,
292,
29889,
974,
29918,
978,
703,
481,
1159,
2314,
13,
1678,
1723,
13,
1678,
27593,
353,
2315,
375,
924,
3542,
29898,
13,
4706,
341,
2190,
3308,
29907,
24290,
29918,
1367,
29892,
13,
4706,
365,
2882,
6670,
29903,
29892,
13,
4706,
3992,
3542,
29898,
3542,
4557,
29898,
29896,
511,
313,
1742,
29896,
29892,
1734,
29906,
29892,
1734,
29941,
8243,
13,
4706,
349,
1718,
3040,
12188,
29892,
13,
4706,
313,
29896,
29892,
29871,
29941,
511,
13,
1678,
1723,
13,
1678,
3806,
353,
2315,
375,
924,
3542,
29898,
13,
4706,
341,
2190,
3308,
29907,
24290,
29918,
1367,
29892,
13,
4706,
365,
2882,
6670,
29903,
29892,
13,
4706,
3992,
3542,
29898,
13,
9651,
7407,
4557,
29898,
29896,
511,
13,
9651,
313,
13,
18884,
1734,
29896,
29889,
842,
29918,
2520,
358,
29898,
8516,
29892,
6213,
511,
13,
18884,
1734,
29906,
29889,
842,
29918,
2520,
358,
29898,
29900,
29892,
1734,
29906,
29889,
19365,
511,
13,
18884,
1734,
29941,
29889,
842,
29918,
2520,
358,
29898,
8516,
29892,
6213,
511,
13,
9651,
10353,
13,
4706,
10353,
13,
4706,
349,
1718,
3040,
12188,
29892,
13,
4706,
313,
29900,
29892,
511,
13,
1678,
1723,
13,
13,
1678,
4974,
27593,
29889,
5504,
29918,
2520,
1860,
4197,
8516,
29892,
29871,
29900,
2314,
1275,
3806,
13,
2
] |
plottwist/bootstrap/maya/userSetup.py | Plot-Twist-Short-Film/plottwist-bootstrap | 0 | 152413 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Initialization for Plot Twist Tools
"""
from __future__ import print_function, division, absolute_import
__author__ = "<NAME>"
__license__ = "MIT"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
import maya.cmds as cmds # Do not remove
def init():
print('=' * 100)
print('| Plot Twist ArtellaPipe | > Loading Plot Twist Tools')
try:
# Initialize tpDcc library
import tpDcc.loader
print(tpDcc.loader)
tpDcc.loader.init(dev=False)
# Initialize artellapipe library
import artellapipe.loader
artellapipe.loader.init(dev=False)
# Initialize plottwist project
import plottwist.loader
plottwist.loader.init(dev=False)
print('| Plot Twist Pipeline | Plot Twist loaded successfully!')
print('=' * 100)
except Exception as exc:
import traceback
print('ERROR: Impossible to load Plot Twist Tools, contact TD!')
print('{} | {}'.format(exc, traceback.format_exc()))
# We must launch it with low priority, otherwise USD plugin loading operations will fail
cmds.evalDeferred(init, lp=True)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
15945,
29908,
13,
15514,
2133,
363,
18399,
8168,
391,
27564,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
29892,
8542,
29892,
8380,
29918,
5215,
13,
13,
1649,
8921,
1649,
353,
9872,
5813,
11903,
13,
1649,
506,
1947,
1649,
353,
376,
26349,
29908,
13,
1649,
29885,
2365,
4008,
1649,
353,
9872,
5813,
11903,
13,
1649,
5269,
1649,
353,
9872,
26862,
6227,
11903,
13,
13,
5215,
1122,
29874,
29889,
9006,
29879,
408,
9920,
29879,
4706,
396,
1938,
451,
3349,
13,
13,
13,
1753,
2069,
7295,
13,
13,
1678,
1596,
877,
2433,
334,
29871,
29896,
29900,
29900,
29897,
13,
1678,
1596,
877,
29989,
18399,
8168,
391,
3012,
3547,
12197,
412,
891,
1405,
4309,
9382,
18399,
8168,
391,
27564,
1495,
13,
13,
1678,
1018,
29901,
13,
4706,
396,
25455,
260,
29886,
29928,
617,
3489,
13,
4706,
1053,
260,
29886,
29928,
617,
29889,
12657,
13,
4706,
1596,
29898,
9392,
29928,
617,
29889,
12657,
29897,
13,
4706,
260,
29886,
29928,
617,
29889,
12657,
29889,
2344,
29898,
3359,
29922,
8824,
29897,
13,
13,
4706,
396,
25455,
1616,
3547,
17760,
3489,
13,
4706,
1053,
1616,
3547,
17760,
29889,
12657,
13,
4706,
1616,
3547,
17760,
29889,
12657,
29889,
2344,
29898,
3359,
29922,
8824,
29897,
13,
13,
4706,
396,
25455,
715,
1501,
29893,
391,
2060,
13,
4706,
1053,
715,
1501,
29893,
391,
29889,
12657,
13,
4706,
715,
1501,
29893,
391,
29889,
12657,
29889,
2344,
29898,
3359,
29922,
8824,
29897,
13,
13,
4706,
1596,
877,
29989,
18399,
8168,
391,
349,
23828,
891,
18399,
8168,
391,
7500,
8472,
29991,
1495,
13,
4706,
1596,
877,
2433,
334,
29871,
29896,
29900,
29900,
29897,
13,
1678,
5174,
8960,
408,
5566,
29901,
13,
4706,
1053,
9637,
1627,
13,
4706,
1596,
877,
11432,
29901,
1954,
27338,
304,
2254,
18399,
8168,
391,
27564,
29892,
6958,
323,
29928,
29991,
1495,
13,
4706,
1596,
877,
8875,
891,
6571,
4286,
4830,
29898,
735,
29883,
29892,
9637,
1627,
29889,
4830,
29918,
735,
29883,
22130,
13,
13,
13,
29937,
1334,
1818,
6826,
372,
411,
4482,
20136,
29892,
6467,
3148,
29928,
7079,
8363,
6931,
674,
4418,
13,
9006,
29879,
29889,
14513,
2772,
14373,
29898,
2344,
29892,
301,
29886,
29922,
5574,
29897,
13,
2
] |
kensu/client/models/field_def.py | vidma/kensu-py | 16 | 46838 | <reponame>vidma/kensu-py
# coding: utf-8
"""
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: beta
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
class FieldDef(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'name': 'str',
'field_type': 'str',
'nullable': 'bool'
}
attribute_map = {
'name': 'name',
'field_type': 'fieldType',
'nullable': 'nullable'
}
def __init__(self, name=None, field_type=None, nullable=None):
"""
FieldDef - a model defined in Swagger
"""
self._name = None
self._field_type = None
self._nullable = None
self.name = name
self.field_type = field_type
self.nullable = nullable
@property
def name(self):
"""
Gets the name of this FieldDef.
:return: The name of this FieldDef.
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""
Sets the name of this FieldDef.
:param name: The name of this FieldDef.
:type: str
"""
if name is None:
raise ValueError("Invalid value for `name`, must not be `None`")
self._name = name
@property
def field_type(self):
"""
Gets the field_type of this FieldDef.
:return: The field_type of this FieldDef.
:rtype: str
"""
return self._field_type
@field_type.setter
def field_type(self, field_type):
"""
Sets the field_type of this FieldDef.
:param field_type: The field_type of this FieldDef.
:type: str
"""
if field_type is None:
raise ValueError("Invalid value for `field_type`, must not be `None`")
self._field_type = field_type
@property
def nullable(self):
"""
Gets the nullable of this FieldDef.
:return: The nullable of this FieldDef.
:rtype: bool
"""
return self._nullable
@nullable.setter
def nullable(self, nullable):
"""
Sets the nullable of this FieldDef.
:param nullable: The nullable of this FieldDef.
:type: bool
"""
if nullable is None:
raise ValueError("Invalid value for `nullable`, must not be `None`")
self._nullable = nullable
def to_dict(self):
"""
Returns the model properties as a dict
"""
result = {}
for attr, _ in iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
return result
def to_str(self):
"""
Returns the string representation of the model
"""
return pformat(self.to_dict())
def __repr__(self):
"""
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
if not isinstance(other, FieldDef):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other
| [
1,
529,
276,
1112,
420,
29958,
8590,
655,
29914,
12360,
29884,
29899,
2272,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
13,
15945,
29908,
13,
268,
13,
13,
1678,
1939,
6139,
4944,
313,
13525,
491,
3925,
9921,
5920,
1885,
2045,
597,
3292,
29889,
510,
29914,
2774,
9921,
29899,
2754,
29914,
2774,
9921,
29899,
401,
1885,
29897,
13,
13,
1678,
4673,
8787,
1580,
1873,
29901,
21762,
13,
268,
13,
1678,
3251,
630,
491,
29901,
2045,
597,
3292,
29889,
510,
29914,
2774,
9921,
29899,
2754,
29914,
2774,
9921,
29899,
401,
1885,
29889,
5559,
13,
15945,
29908,
13,
13,
13,
3166,
282,
2158,
1053,
282,
4830,
13,
13,
3166,
4832,
1053,
4256,
7076,
13,
13,
13,
1990,
8989,
3206,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
6058,
29923,
29901,
910,
770,
338,
4469,
5759,
491,
278,
2381,
9921,
775,
15299,
1824,
29889,
13,
1678,
1938,
451,
3863,
278,
770,
7522,
29889,
13,
1678,
9995,
13,
13,
13,
1678,
9995,
13,
1678,
6212,
5026,
29901,
13,
418,
2381,
9921,
29918,
8768,
313,
8977,
1125,
450,
1820,
338,
5352,
1024,
13,
462,
9651,
322,
278,
995,
338,
5352,
1134,
29889,
13,
418,
5352,
29918,
1958,
313,
8977,
1125,
450,
1820,
338,
5352,
1024,
13,
462,
9651,
322,
278,
995,
338,
4390,
1820,
297,
5023,
29889,
13,
1678,
9995,
13,
1678,
2381,
9921,
29918,
8768,
353,
426,
13,
4706,
525,
978,
2396,
525,
710,
742,
13,
4706,
525,
2671,
29918,
1853,
2396,
525,
710,
742,
13,
4706,
525,
4304,
519,
2396,
525,
11227,
29915,
13,
1678,
500,
13,
13,
1678,
5352,
29918,
1958,
353,
426,
13,
4706,
525,
978,
2396,
525,
978,
742,
13,
4706,
525,
2671,
29918,
1853,
2396,
525,
2671,
1542,
742,
13,
4706,
525,
4304,
519,
2396,
525,
4304,
519,
29915,
13,
1678,
500,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29922,
8516,
29892,
1746,
29918,
1853,
29922,
8516,
29892,
1870,
519,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
8989,
3206,
448,
263,
1904,
3342,
297,
3925,
9921,
13,
4706,
9995,
13,
13,
4706,
1583,
3032,
978,
353,
6213,
13,
4706,
1583,
3032,
2671,
29918,
1853,
353,
6213,
13,
4706,
1583,
3032,
4304,
519,
353,
6213,
13,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
2671,
29918,
1853,
353,
1746,
29918,
1853,
13,
4706,
1583,
29889,
4304,
519,
353,
1870,
519,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1024,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
402,
1691,
278,
1024,
310,
445,
8989,
3206,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
1024,
310,
445,
8989,
3206,
29889,
13,
4706,
584,
29878,
1853,
29901,
851,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
978,
13,
13,
1678,
732,
978,
29889,
842,
357,
13,
1678,
822,
1024,
29898,
1311,
29892,
1024,
1125,
13,
4706,
9995,
13,
4706,
317,
1691,
278,
1024,
310,
445,
8989,
3206,
29889,
13,
13,
4706,
584,
3207,
1024,
29901,
450,
1024,
310,
445,
8989,
3206,
29889,
13,
4706,
584,
1853,
29901,
851,
13,
4706,
9995,
13,
4706,
565,
1024,
338,
6213,
29901,
13,
9651,
12020,
7865,
2392,
703,
13919,
995,
363,
421,
978,
1673,
1818,
451,
367,
421,
8516,
29952,
1159,
13,
13,
4706,
1583,
3032,
978,
353,
1024,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1746,
29918,
1853,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
402,
1691,
278,
1746,
29918,
1853,
310,
445,
8989,
3206,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
1746,
29918,
1853,
310,
445,
8989,
3206,
29889,
13,
4706,
584,
29878,
1853,
29901,
851,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
2671,
29918,
1853,
13,
13,
1678,
732,
2671,
29918,
1853,
29889,
842,
357,
13,
1678,
822,
1746,
29918,
1853,
29898,
1311,
29892,
1746,
29918,
1853,
1125,
13,
4706,
9995,
13,
4706,
317,
1691,
278,
1746,
29918,
1853,
310,
445,
8989,
3206,
29889,
13,
13,
4706,
584,
3207,
1746,
29918,
1853,
29901,
450,
1746,
29918,
1853,
310,
445,
8989,
3206,
29889,
13,
4706,
584,
1853,
29901,
851,
13,
4706,
9995,
13,
4706,
565,
1746,
29918,
1853,
338,
6213,
29901,
13,
9651,
12020,
7865,
2392,
703,
13919,
995,
363,
421,
2671,
29918,
1853,
1673,
1818,
451,
367,
421,
8516,
29952,
1159,
13,
13,
4706,
1583,
3032,
2671,
29918,
1853,
353,
1746,
29918,
1853,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1870,
519,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
402,
1691,
278,
1870,
519,
310,
445,
8989,
3206,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
1870,
519,
310,
445,
8989,
3206,
29889,
13,
4706,
584,
29878,
1853,
29901,
6120,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
4304,
519,
13,
13,
1678,
732,
4304,
519,
29889,
842,
357,
13,
1678,
822,
1870,
519,
29898,
1311,
29892,
1870,
519,
1125,
13,
4706,
9995,
13,
4706,
317,
1691,
278,
1870,
519,
310,
445,
8989,
3206,
29889,
13,
13,
4706,
584,
3207,
1870,
519,
29901,
450,
1870,
519,
310,
445,
8989,
3206,
29889,
13,
4706,
584,
1853,
29901,
6120,
13,
4706,
9995,
13,
4706,
565,
1870,
519,
338,
6213,
29901,
13,
9651,
12020,
7865,
2392,
703,
13919,
995,
363,
421,
4304,
519,
1673,
1818,
451,
367,
421,
8516,
29952,
1159,
13,
13,
4706,
1583,
3032,
4304,
519,
353,
1870,
519,
13,
13,
1678,
822,
304,
29918,
8977,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
16969,
278,
1904,
4426,
408,
263,
9657,
13,
4706,
9995,
13,
4706,
1121,
353,
6571,
13,
13,
4706,
363,
12421,
29892,
903,
297,
4256,
7076,
29898,
1311,
29889,
2774,
9921,
29918,
8768,
1125,
13,
9651,
995,
353,
679,
5552,
29898,
1311,
29892,
12421,
29897,
13,
9651,
565,
338,
8758,
29898,
1767,
29892,
1051,
1125,
13,
18884,
1121,
29961,
5552,
29962,
353,
1051,
29898,
1958,
29898,
13,
462,
1678,
14013,
921,
29901,
921,
29889,
517,
29918,
8977,
580,
565,
756,
5552,
29898,
29916,
29892,
376,
517,
29918,
8977,
1159,
1683,
921,
29892,
13,
462,
1678,
995,
13,
462,
876,
13,
9651,
25342,
756,
5552,
29898,
1767,
29892,
376,
517,
29918,
8977,
29908,
1125,
13,
18884,
1121,
29961,
5552,
29962,
353,
995,
29889,
517,
29918,
8977,
580,
13,
9651,
25342,
338,
8758,
29898,
1767,
29892,
9657,
1125,
13,
18884,
1121,
29961,
5552,
29962,
353,
9657,
29898,
1958,
29898,
13,
462,
1678,
14013,
2944,
29901,
313,
667,
29961,
29900,
1402,
2944,
29961,
29896,
1822,
517,
29918,
8977,
3101,
13,
462,
1678,
565,
756,
5552,
29898,
667,
29961,
29896,
1402,
376,
517,
29918,
8977,
1159,
1683,
2944,
29892,
13,
462,
1678,
995,
29889,
7076,
580,
13,
462,
876,
13,
9651,
1683,
29901,
13,
18884,
1121,
29961,
5552,
29962,
353,
995,
13,
13,
4706,
736,
1121,
13,
13,
1678,
822,
304,
29918,
710,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
16969,
278,
1347,
8954,
310,
278,
1904,
13,
4706,
9995,
13,
4706,
736,
282,
4830,
29898,
1311,
29889,
517,
29918,
8977,
3101,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
9995,
13,
4706,
1152,
421,
2158,
29952,
322,
421,
407,
29878,
524,
29952,
13,
4706,
9995,
13,
4706,
736,
1583,
29889,
517,
29918,
710,
580,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
9995,
13,
4706,
16969,
1565,
565,
1716,
3618,
526,
5186,
13,
4706,
9995,
13,
4706,
565,
451,
338,
8758,
29898,
1228,
29892,
8989,
3206,
1125,
13,
9651,
736,
7700,
13,
13,
4706,
736,
1583,
17255,
8977,
1649,
1275,
916,
17255,
8977,
1649,
13,
13,
1678,
822,
4770,
484,
12035,
1311,
29892,
916,
1125,
13,
4706,
9995,
13,
4706,
16969,
1565,
565,
1716,
3618,
526,
451,
5186,
13,
4706,
9995,
13,
4706,
736,
451,
1583,
1275,
916,
13,
2
] |
psi/controller/plugin.py | bburan/psiexperiment | 5 | 193981 | <reponame>bburan/psiexperiment
import logging
log = logging.getLogger(__name__)
from functools import partial
import operator as op
import threading
import numpy as np
from atom.api import Enum, Bool, Typed, Property
from enaml.application import deferred_call
from enaml.qt.QtCore import QTimer
from enaml.workbench.api import Extension
from enaml.workbench.plugin import Plugin
from .calibration.util import load_calibration
from .channel import Channel, OutputMixin, InputMixin
from .engine import Engine
from .output import Output, Synchronized
from .input import Input
from .device import Device
from .experiment_action import (ExperimentAction, ExperimentActionBase,
ExperimentCallback, ExperimentEvent,
ExperimentState)
from .output import ContinuousOutput, EpochOutput
IO_POINT = 'psi.controller.io'
ACTION_POINT = 'psi.controller.actions'
def get_inputs(input):
inputs = []
for child in input.children:
inputs.extend(get_inputs(child))
inputs.append(input)
return inputs
def get_outputs(output):
outputs = []
for child in output.children:
outputs.extend(get_outputs(child))
outputs.append(output)
return outputs
def find_devices(point):
devices = {}
for extension in point.extensions:
for device in extension.get_children(Device):
devices[device.name] = device
return devices
engine_error = '''
More than one engine named "{}"
To fix this, please review the IO manifest (i.e., hardware configuration) you
selected and verify that all engines have unique names.
'''
def find_engines(point):
master_engine = None
engines = {}
for extension in point.extensions:
for e in extension.get_children(Engine):
if e.name in engines:
raise ValueError(engine_error.strip().format(e.name))
engines[e.name] = e
if e.master_clock:
if master_engine is not None:
m = 'Only one engine can be defined as the master'
raise ValueError(m)
master_engine = e
return engines, master_engine
def find_channels(engines):
channels = {}
for e in engines.values():
for c in e.get_channels(active=False):
channels[c.name] = c
return channels
def find_outputs(channels, point):
outputs = {}
supporting = {}
# Find all the outputs already connected to a channel
for c in channels.values():
if isinstance(c, OutputMixin):
for o in c.children:
for oi in get_outputs(o):
outputs[oi.name] = oi
# Find unconnected outputs and inputs (these are allowed so that we can
# split processing hierarchies across multiple manifests).
for extension in point.extensions:
for o in extension.get_children(Output):
outputs[o.name] = o
for s in extension.get_children(Synchronized):
supporting[s.name] = s
for o in s.outputs:
outputs[o.name] = o
return outputs, supporting
def find_inputs(channels, point):
inputs = {}
# Find all the outputs already connected to a channel
for c in channels.values():
if isinstance(c, InputMixin):
for i in c.children:
for ci in get_inputs(i):
inputs[ci.name] = ci
for extension in point.extensions:
for i in extension.get_children(Input):
# Recurse through input tree. Currently we assume that
# inputs can be nested/hierarchial while outputs are not.
for ci in get_inputs(i):
inputs[ci.name] = ci
return inputs
class ControllerPlugin(Plugin):
# Tracks the state of the controller.
experiment_state = Enum('initialized', 'running', 'paused', 'stopped')
# Provides direct access to plugins rather than going through the core
# command system. Right now the context plugin is so fundamentally important
# to the controller that it would be cumbersome to use the core command
# system.
core = Typed(Plugin)
context = Typed(Plugin)
data = Typed(Plugin)
# We should not respond to changes during the course of a trial. These
# flags indicate changes or requests from the user are pending and should
# be processed when the opportunity arises (e.g., at the end of the trial).
_apply_requested = Bool(False)
_remind_requested = Bool(False)
_pause_requested = Bool(False)
# Can the experiment be paused?
_pause_ok = Bool(False)
# Available engines
_engines = Typed(dict, {})
# Available channels
_channels = Typed(dict, {})
# Available outputs
_outputs = Typed(dict, {})
# Available supporting classes for outputs (right now only Synchronized)
_supporting = Typed(dict, {})
# Available inputs
_inputs = Typed(dict, {})
# Available devices
_devices = Typed(dict, {})
# This determines which engine is responsible for the clock
_master_engine = Typed(Engine)
# List of events and actions that can be associated with the event
_events = Typed(dict, {})
_states = Typed(dict, {})
_action_context = Typed(dict, {})
_timers = Typed(dict, {})
# Plugin actions are automatically registered when the manifests are
# loaded. In contrast, registered actions are registered by setup code
# (e.g., when one doesn't know in advance which output/input the user wants
# to record from).
_plugin_actions = Typed(list, {})
_registered_actions = Typed(list, {})
_actions = Property()
def _get__actions(self):
return self._registered_actions + self._plugin_actions
def start(self):
log.debug('Starting controller plugin')
self._refresh_io()
self._refresh_actions()
self._bind_observers()
self.core = self.workbench.get_plugin('enaml.workbench.core')
self.context = self.workbench.get_plugin('psi.context')
self.data = self.workbench.get_plugin('psi.data')
def stop(self):
self._unbind_observers()
def _bind_observers(self):
self.workbench.get_extension_point(IO_POINT) \
.observe('extensions', self._refresh_io)
self.workbench.get_extension_point(ACTION_POINT) \
.observe('extensions', self._refresh_actions)
def _unbind_observers(self):
self.workbench.get_extension_point(IO_POINT) \
.unobserve('extensions',self._refresh_io)
self.workbench.get_extension_point(ACTION_POINT) \
.unobserve('extensions', self._refresh_actions)
def _refresh_io(self, event=None):
# TODO: Allow disabling of devices.
log.debug('Loading IO')
point = self.workbench.get_extension_point(IO_POINT)
self._devices = find_devices(point)
self._engines, self._master_engine = find_engines(point)
self._channels = find_channels(self._engines)
self._outputs, self._supporting = find_outputs(self._channels, point)
self._inputs = find_inputs(self._channels, point)
for c in self._channels.values():
c.load_manifest(self.workbench)
for d in self._devices.values():
d.load_manifest(self.workbench)
for s in self._supporting.values():
s.load_manifest(self.workbench)
for e in self._engines.values():
e.load_manifest(self.workbench)
for o in self._outputs.values():
o.load_manifest(self.workbench)
for i in self._inputs.values():
i.load_manifest(self.workbench)
log.warn('***********************************************')
log.warn(str(self._outputs.keys()))
def _connect_outputs(self):
for o in self._outputs.values():
# First, make sure that the output is connected to a target. Check
# to see if the target is named. If not, then check to see if it
# has a parent one can use.
if o.target is None and o.target_name:
self.connect_output(o.name, o.target_name)
elif o.target is None and not isinstance(o.parent, Extension):
o.parent.add_output(o)
elif o.target is None:
log.warn('Unconnected output %s', o.name)
def _connect_inputs(self):
for i in self._inputs.values():
# First, make sure the input is connected to a source
try:
if i.source is None and i.source_name:
self.connect_input(i.name, i.source_name)
elif i.source is None and not isinstance(i.parent, Extension):
i.parent.add_input(i)
elif i.source is None:
log.warn('Unconnected input %s', i.name)
except:
pass
def connect_output(self, output_name, target_name):
# Link up outputs with channels if needed. TODO: Can another output be
# the target (e.g., if one wanted to combine multiple tokens into a
# single stream)?
if target_name in self._channels:
target = self._channels[target_name]
else:
m = "Unknown target {} specified for output {}" \
.format(target_name, output_name)
raise ValueError(m)
o = self._outputs[output_name]
target.add_output(o)
m = 'Connected output %s to target %s'
log.debug(m, output_name, target_name)
def connect_input(self, input_name, source_name):
if source_name in self._inputs:
source = self._inputs[source_name]
elif source_name in self._channels:
source = self._channels[source_name]
else:
m = "Unknown source {}".format(source_name)
raise ValueError(m)
i = self._inputs[input_name]
source.add_input(i)
m = 'Connected input %s to source %s'
log.debug(m, input_name, source_name)
def _refresh_actions(self, event=None):
actions = []
events = {}
states = {}
point = self.workbench.get_extension_point(ACTION_POINT)
for extension in point.extensions:
found_states = extension.get_children(ExperimentState)
found_events = extension.get_children(ExperimentEvent)
found_actions = extension.get_children(ExperimentActionBase)
for state in found_states:
if state.name in states:
m = '{} state already exists'.format(state.name)
raise ValueError(m)
states[state.name] = state
found_events.extend(state._generate_events())
for event in found_events:
if event.name in events:
m = '{} event already exists'.format(event.name)
raise ValueError(m)
events[event.name] = event
actions.extend(found_actions)
context = {}
for state_name in states:
context[state_name + '_active'] = False
for event_name in events:
context[event_name] = False
actions.sort(key=lambda a: a.weight)
self._states = states
self._events = events
self._plugin_actions = actions
self._action_context = context
def register_action(self, event, command, kwargs=None):
if kwargs is None:
kwargs = {}
if isinstance(command, str):
action = ExperimentAction(event=event, command=command,
kwargs=kwargs)
else:
action = ExperimentCallback(event=event, callback=command,
kwargs=kwargs)
self._registered_actions.append(action)
def finalize_io(self):
self._connect_outputs()
self._connect_inputs()
def configure_engines(self):
log.debug('Configuring engines')
for engine in self._engines.values():
# Check to see if engine is being used
if engine.get_channels():
engine.configure()
cb = partial(self.invoke_actions, '{}_end'.format(engine.name))
engine.register_done_callback(cb)
self.invoke_actions('engines_configured')
def start_engines(self):
log.debug('Starting engines')
for engine in self._engines.values():
engine.start()
def stop_engines(self):
for name, timer in list(self._timers.items()):
timer.timeout.disconnect()
timer.stop()
del self._timers[name]
for engine in self._engines.values():
engine.stop()
def reset_engines(self):
for engine in self._engines.values():
engine.reset()
def get_output(self, output_name):
return self._outputs[output_name]
def get_input(self, input_name):
return self._inputs[input_name]
def set_input_attr(self, input_name, attr_name, value):
setattr(self._inputs[input_name], attr_name, value)
def get_channel(self, channel_name):
return self._channels[channel_name]
def get_channels(self, mode=None, direction=None, timing=None,
active=True):
'''
Return channels matching criteria across all engines
Parameters
----------
mode : {None, 'analog', 'digital'
Type of channel
direction : {None, 'input, 'output'}
Direction
timing : {None, 'hardware', 'software'}
Hardware or software-timed channel. Hardware-timed channels have a
sampling frequency greater than 0.
active : bool
If True, return only channels that have configured inputs or
outputs.
'''
channels = []
for engine in self._engines.values():
ec = engine.get_channels(mode, direction, timing, active)
channels.extend(ec)
return channels
def load_calibration(self, calibration_file):
channels = list(self._channels.values())
load_calibration(calibration_file, channels)
def invoke_actions(self, event_name, timestamp=None, delayed=False,
cancel_existing=True, kw=None):
log.debug('Invoking actions for %s', event_name)
if cancel_existing:
deferred_call(self.stop_timer, event_name)
if delayed:
delay = timestamp-self.get_ts()
if delay > 0:
cb = lambda: self._invoke_actions(event_name, timestamp)
deferred_call(self.start_timer, event_name, delay, cb)
return
self._invoke_actions(event_name, timestamp, kw)
def event_used(self, event_name):
'''
Returns true if the experiment event is bound to an experiment action.
This is typically used internally as a performance-optimization so we
don't configure callbacks for events that are unused. For example, we
can attach actions to the <input_name>_acquired event. However, this
event typically occurs several times a second for each input. This
would result in unecessary calls to `invoke_actions`.
Parameters
----------
event_name : str
Name of event
Returns
-------
used : bool
True if event is bound to an action, False otherwise.
'''
for action in self._actions:
if event_name in action.dependencies:
return True
return False
def _invoke_actions(self, event_name, timestamp=None, kw=None):
log.debug('Triggering event {}'.format(event_name))
if timestamp is not None:
data = {'event': event_name, 'timestamp': timestamp}
self.invoke_actions('experiment_event', kw={'data': data})
# If this is a stateful event, update the associated state.
if event_name.endswith('_start'):
key = event_name[:-6]
self._action_context[key + '_active'] = True
elif event_name.endswith('_end'):
key = event_name[:-4]
self._action_context[key + '_active'] = False
# Make a copy of the context and set the event to True. We don't want
# to set the state on the main context since it may affect recursive
# notifications.
context = self._action_context.copy()
context[event_name] = True
for action in self._actions:
if action.match(context):
log.debug('... invoking action %s', action)
self._invoke_action(action, event_name, timestamp, kw)
def _invoke_action(self, action, event_name, timestamp, kw):
# Add the event name and timestamp to the parameters passed to the
# command.
kwargs = action.kwargs.copy()
kwargs['timestamp'] = timestamp
kwargs['event'] = event_name
if kw is not None:
kwargs.update(kw)
if isinstance(action, ExperimentAction):
self.core.invoke_command(action.command, parameters=kwargs)
elif isinstance(action, ExperimentCallback):
action.callback(**kwargs)
def request_apply(self):
if not self.apply_changes():
log.debug('Apply requested')
deferred_call(lambda: setattr(self, '_apply_requested', True))
def request_remind(self):
deferred_call(lambda: setattr(self, '_remind_requested', True))
def request_pause(self):
if not self.pause_experiment():
log.debug('Pause requested')
deferred_call(lambda: setattr(self, '_pause_requested', True))
def request_resume(self):
self._pause_requested = False
deferred_call(lambda: setattr(self, 'experiment_state', 'running'))
def apply_changes(self):
raise NotImplementedError
def start_experiment(self):
self.invoke_actions('experiment_initialize')
self.invoke_actions('experiment_prepare')
self.invoke_actions('experiment_start')
deferred_call(lambda: setattr(self, 'experiment_state', 'running'))
def stop_experiment(self):
try:
self.invoke_actions('experiment_end', self.get_ts())
except Exception as e:
log.exception(e)
deferred_call(lambda: setattr(self, 'experiment_state', 'stopped'))
def pause_experiment(self):
raise NotImplementedError
def get_ts(self):
return self._master_engine.get_ts()
def set_pause_ok(self, value):
deferred_call(lambda: setattr(self, '_pause_ok', value))
def start_timer(self, name, duration, callback):
log.debug('Starting %f sec. timer %s', duration, name)
timer = QTimer()
timer.timeout.connect(callback)
timer.setSingleShot(True)
timer.start(duration*1e3)
self._timers[name] = timer
def stop_timer(self, name):
if self._timers.get(name) is not None:
self._timers[name].timeout.disconnect()
self._timers[name].stop()
del self._timers[name]
log.debug('Disabled deferred event %s', name)
| [
1,
529,
276,
1112,
420,
29958,
1327,
332,
273,
29914,
567,
347,
29916,
15362,
13,
5215,
12183,
13,
1188,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
5215,
5455,
408,
1015,
13,
5215,
3244,
292,
13,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
12301,
29889,
2754,
1053,
1174,
398,
29892,
18912,
29892,
14213,
287,
29892,
9079,
13,
3166,
427,
8807,
29889,
6214,
1053,
316,
14373,
29918,
4804,
13,
3166,
427,
8807,
29889,
17915,
29889,
17303,
9203,
1053,
660,
14745,
13,
3166,
427,
8807,
29889,
1287,
1785,
305,
29889,
2754,
1053,
7338,
2673,
13,
3166,
427,
8807,
29889,
1287,
1785,
305,
29889,
8582,
1053,
1858,
3851,
13,
13,
3166,
869,
1052,
26218,
29889,
4422,
1053,
2254,
29918,
1052,
26218,
13,
3166,
869,
12719,
1053,
17368,
29892,
10604,
29924,
861,
262,
29892,
10567,
29924,
861,
262,
13,
3166,
869,
10599,
1053,
10863,
13,
3166,
869,
4905,
1053,
10604,
29892,
317,
9524,
1891,
13,
3166,
869,
2080,
1053,
10567,
13,
3166,
869,
10141,
1053,
21830,
13,
13,
3166,
869,
735,
15362,
29918,
2467,
1053,
313,
1252,
15362,
4276,
29892,
1222,
15362,
4276,
5160,
29892,
13,
462,
18884,
1222,
15362,
10717,
29892,
1222,
15362,
2624,
29892,
13,
462,
18884,
1222,
15362,
2792,
29897,
13,
3166,
869,
4905,
1053,
2866,
8675,
681,
6466,
29892,
382,
1129,
305,
6466,
13,
13,
13,
5971,
29918,
29925,
6992,
29911,
353,
525,
6134,
29889,
8299,
29889,
601,
29915,
13,
24705,
29918,
29925,
6992,
29911,
353,
525,
6134,
29889,
8299,
29889,
7387,
29915,
13,
13,
13,
1753,
679,
29918,
2080,
29879,
29898,
2080,
1125,
13,
1678,
10970,
353,
5159,
13,
1678,
363,
2278,
297,
1881,
29889,
11991,
29901,
13,
4706,
10970,
29889,
21843,
29898,
657,
29918,
2080,
29879,
29898,
5145,
876,
13,
1678,
10970,
29889,
4397,
29898,
2080,
29897,
13,
1678,
736,
10970,
13,
13,
13,
1753,
679,
29918,
4905,
29879,
29898,
4905,
1125,
13,
1678,
14391,
353,
5159,
13,
1678,
363,
2278,
297,
1962,
29889,
11991,
29901,
13,
4706,
14391,
29889,
21843,
29898,
657,
29918,
4905,
29879,
29898,
5145,
876,
13,
1678,
14391,
29889,
4397,
29898,
4905,
29897,
13,
1678,
736,
14391,
13,
13,
13,
1753,
1284,
29918,
3359,
1575,
29898,
3149,
1125,
13,
1678,
9224,
353,
6571,
13,
1678,
363,
6081,
297,
1298,
29889,
24299,
29901,
13,
4706,
363,
4742,
297,
6081,
29889,
657,
29918,
11991,
29898,
11501,
1125,
13,
9651,
9224,
29961,
10141,
29889,
978,
29962,
353,
4742,
13,
1678,
736,
9224,
13,
13,
13,
10599,
29918,
2704,
353,
14550,
13,
20761,
1135,
697,
6012,
4257,
29850,
5038,
13,
13,
1762,
2329,
445,
29892,
3113,
9076,
278,
10663,
10419,
313,
29875,
29889,
29872,
1696,
12837,
5285,
29897,
366,
13,
8391,
322,
11539,
393,
599,
24000,
505,
5412,
2983,
29889,
13,
12008,
13,
13,
1753,
1284,
29918,
996,
1475,
29898,
3149,
1125,
13,
1678,
5835,
29918,
10599,
353,
6213,
13,
1678,
24000,
353,
6571,
13,
1678,
363,
6081,
297,
1298,
29889,
24299,
29901,
13,
4706,
363,
321,
297,
6081,
29889,
657,
29918,
11991,
29898,
12412,
1125,
13,
9651,
565,
321,
29889,
978,
297,
24000,
29901,
13,
18884,
12020,
7865,
2392,
29898,
10599,
29918,
2704,
29889,
17010,
2141,
4830,
29898,
29872,
29889,
978,
876,
13,
9651,
24000,
29961,
29872,
29889,
978,
29962,
353,
321,
13,
9651,
565,
321,
29889,
6207,
29918,
13058,
29901,
13,
18884,
565,
5835,
29918,
10599,
338,
451,
6213,
29901,
13,
462,
1678,
286,
353,
525,
11730,
697,
6012,
508,
367,
3342,
408,
278,
5835,
29915,
13,
462,
1678,
12020,
7865,
2392,
29898,
29885,
29897,
13,
18884,
5835,
29918,
10599,
353,
321,
13,
1678,
736,
24000,
29892,
5835,
29918,
10599,
13,
13,
13,
1753,
1284,
29918,
305,
12629,
29898,
996,
1475,
1125,
13,
1678,
18196,
353,
6571,
13,
1678,
363,
321,
297,
24000,
29889,
5975,
7295,
13,
4706,
363,
274,
297,
321,
29889,
657,
29918,
305,
12629,
29898,
4925,
29922,
8824,
1125,
13,
9651,
18196,
29961,
29883,
29889,
978,
29962,
353,
274,
13,
1678,
736,
18196,
13,
13,
13,
1753,
1284,
29918,
4905,
29879,
29898,
305,
12629,
29892,
1298,
1125,
13,
1678,
14391,
353,
6571,
13,
1678,
20382,
353,
6571,
13,
13,
1678,
396,
10987,
599,
278,
14391,
2307,
6631,
304,
263,
8242,
13,
1678,
363,
274,
297,
18196,
29889,
5975,
7295,
13,
4706,
565,
338,
8758,
29898,
29883,
29892,
10604,
29924,
861,
262,
1125,
13,
9651,
363,
288,
297,
274,
29889,
11991,
29901,
13,
18884,
363,
288,
29875,
297,
679,
29918,
4905,
29879,
29898,
29877,
1125,
13,
462,
1678,
14391,
29961,
7768,
29889,
978,
29962,
353,
288,
29875,
13,
13,
1678,
396,
10987,
443,
18045,
14391,
322,
10970,
313,
386,
968,
526,
6068,
577,
393,
591,
508,
13,
1678,
396,
6219,
9068,
6128,
1279,
583,
4822,
2999,
10419,
29879,
467,
13,
1678,
363,
6081,
297,
1298,
29889,
24299,
29901,
13,
4706,
363,
288,
297,
6081,
29889,
657,
29918,
11991,
29898,
6466,
1125,
13,
9651,
14391,
29961,
29877,
29889,
978,
29962,
353,
288,
13,
4706,
363,
269,
297,
6081,
29889,
657,
29918,
11991,
29898,
29903,
9524,
1891,
1125,
13,
9651,
20382,
29961,
29879,
29889,
978,
29962,
353,
269,
13,
9651,
363,
288,
297,
269,
29889,
4905,
29879,
29901,
13,
18884,
14391,
29961,
29877,
29889,
978,
29962,
353,
288,
13,
13,
1678,
736,
14391,
29892,
20382,
13,
13,
13,
1753,
1284,
29918,
2080,
29879,
29898,
305,
12629,
29892,
1298,
1125,
13,
1678,
10970,
353,
6571,
13,
13,
1678,
396,
10987,
599,
278,
14391,
2307,
6631,
304,
263,
8242,
13,
1678,
363,
274,
297,
18196,
29889,
5975,
7295,
13,
4706,
565,
338,
8758,
29898,
29883,
29892,
10567,
29924,
861,
262,
1125,
13,
9651,
363,
474,
297,
274,
29889,
11991,
29901,
13,
18884,
363,
4583,
297,
679,
29918,
2080,
29879,
29898,
29875,
1125,
13,
462,
1678,
10970,
29961,
455,
29889,
978,
29962,
353,
4583,
13,
13,
1678,
363,
6081,
297,
1298,
29889,
24299,
29901,
13,
4706,
363,
474,
297,
6081,
29889,
657,
29918,
11991,
29898,
4290,
1125,
13,
9651,
396,
3599,
332,
344,
1549,
1881,
5447,
29889,
15447,
591,
5251,
393,
13,
9651,
396,
10970,
508,
367,
9322,
29914,
29882,
631,
1279,
616,
1550,
14391,
526,
451,
29889,
13,
9651,
363,
4583,
297,
679,
29918,
2080,
29879,
29898,
29875,
1125,
13,
18884,
10970,
29961,
455,
29889,
978,
29962,
353,
4583,
13,
13,
1678,
736,
10970,
13,
13,
13,
1990,
15830,
16288,
29898,
16288,
1125,
13,
13,
1678,
396,
3201,
4684,
278,
2106,
310,
278,
4701,
29889,
13,
1678,
7639,
29918,
3859,
353,
1174,
398,
877,
11228,
1891,
742,
525,
21094,
742,
525,
29886,
15244,
742,
525,
7864,
2986,
1495,
13,
13,
1678,
396,
9133,
2247,
1513,
2130,
304,
18224,
3265,
1135,
2675,
1549,
278,
7136,
13,
1678,
396,
1899,
1788,
29889,
10428,
1286,
278,
3030,
7079,
338,
577,
5220,
1166,
635,
4100,
13,
1678,
396,
304,
278,
4701,
393,
372,
723,
367,
13299,
2596,
608,
304,
671,
278,
7136,
1899,
13,
1678,
396,
1788,
29889,
13,
1678,
7136,
353,
14213,
287,
29898,
16288,
29897,
13,
1678,
3030,
353,
14213,
287,
29898,
16288,
29897,
13,
1678,
848,
353,
14213,
287,
29898,
16288,
29897,
13,
13,
1678,
396,
1334,
881,
451,
10049,
304,
3620,
2645,
278,
3236,
310,
263,
14260,
29889,
4525,
13,
1678,
396,
13449,
12266,
3620,
470,
7274,
515,
278,
1404,
526,
28235,
322,
881,
13,
1678,
396,
367,
19356,
746,
278,
15130,
564,
4637,
313,
29872,
29889,
29887,
1696,
472,
278,
1095,
310,
278,
14260,
467,
13,
1678,
903,
7302,
29918,
3827,
287,
353,
18912,
29898,
8824,
29897,
13,
1678,
903,
1745,
513,
29918,
3827,
287,
353,
18912,
29898,
8824,
29897,
13,
1678,
903,
29886,
1071,
29918,
3827,
287,
353,
18912,
29898,
8824,
29897,
13,
13,
1678,
396,
1815,
278,
7639,
367,
28454,
29973,
13,
1678,
903,
29886,
1071,
29918,
554,
353,
18912,
29898,
8824,
29897,
13,
13,
1678,
396,
7740,
3106,
24000,
13,
1678,
903,
996,
1475,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
13,
1678,
396,
7740,
3106,
18196,
13,
1678,
903,
305,
12629,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
13,
1678,
396,
7740,
3106,
14391,
13,
1678,
903,
4905,
29879,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
13,
1678,
396,
7740,
3106,
20382,
4413,
363,
14391,
313,
1266,
1286,
871,
317,
9524,
1891,
29897,
13,
1678,
903,
5924,
292,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
13,
1678,
396,
7740,
3106,
10970,
13,
1678,
903,
2080,
29879,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
13,
1678,
396,
7740,
3106,
9224,
13,
1678,
903,
3359,
1575,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
13,
1678,
396,
910,
3683,
1475,
607,
6012,
338,
14040,
363,
278,
12006,
13,
1678,
903,
6207,
29918,
10599,
353,
14213,
287,
29898,
12412,
29897,
13,
13,
1678,
396,
2391,
310,
4959,
322,
8820,
393,
508,
367,
6942,
411,
278,
1741,
13,
1678,
903,
13604,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
1678,
903,
28631,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
1678,
903,
2467,
29918,
4703,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
1678,
903,
9346,
414,
353,
14213,
287,
29898,
8977,
29892,
426,
1800,
13,
13,
1678,
396,
1858,
3851,
8820,
526,
6336,
15443,
746,
278,
10419,
29879,
526,
13,
1678,
396,
7500,
29889,
512,
12814,
29892,
15443,
8820,
526,
15443,
491,
6230,
775,
13,
1678,
396,
313,
29872,
29889,
29887,
1696,
746,
697,
1838,
29915,
29873,
1073,
297,
6564,
607,
1962,
29914,
2080,
278,
1404,
10753,
13,
1678,
396,
304,
2407,
515,
467,
13,
1678,
903,
8582,
29918,
7387,
353,
14213,
287,
29898,
1761,
29892,
426,
1800,
13,
1678,
903,
9573,
287,
29918,
7387,
353,
14213,
287,
29898,
1761,
29892,
426,
1800,
13,
1678,
903,
7387,
353,
9079,
580,
13,
13,
1678,
822,
903,
657,
1649,
7387,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
9573,
287,
29918,
7387,
718,
1583,
3032,
8582,
29918,
7387,
13,
13,
1678,
822,
1369,
29898,
1311,
1125,
13,
4706,
1480,
29889,
8382,
877,
4763,
292,
4701,
7079,
1495,
13,
4706,
1583,
3032,
22379,
29918,
601,
580,
13,
4706,
1583,
3032,
22379,
29918,
7387,
580,
13,
4706,
1583,
3032,
5355,
29918,
711,
643,
874,
580,
13,
4706,
1583,
29889,
3221,
353,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
8582,
877,
264,
8807,
29889,
1287,
1785,
305,
29889,
3221,
1495,
13,
4706,
1583,
29889,
4703,
353,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
8582,
877,
6134,
29889,
4703,
1495,
13,
4706,
1583,
29889,
1272,
353,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
8582,
877,
6134,
29889,
1272,
1495,
13,
13,
1678,
822,
5040,
29898,
1311,
1125,
13,
4706,
1583,
3032,
348,
5355,
29918,
711,
643,
874,
580,
13,
13,
1678,
822,
903,
5355,
29918,
711,
643,
874,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
17588,
29918,
3149,
29898,
5971,
29918,
29925,
6992,
29911,
29897,
320,
13,
9651,
869,
711,
16349,
877,
24299,
742,
1583,
3032,
22379,
29918,
601,
29897,
13,
4706,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
17588,
29918,
3149,
29898,
24705,
29918,
29925,
6992,
29911,
29897,
320,
13,
9651,
869,
711,
16349,
877,
24299,
742,
1583,
3032,
22379,
29918,
7387,
29897,
13,
13,
1678,
822,
903,
348,
5355,
29918,
711,
643,
874,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
17588,
29918,
3149,
29898,
5971,
29918,
29925,
6992,
29911,
29897,
320,
13,
9651,
869,
348,
711,
16349,
877,
24299,
742,
1311,
3032,
22379,
29918,
601,
29897,
13,
4706,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
17588,
29918,
3149,
29898,
24705,
29918,
29925,
6992,
29911,
29897,
320,
13,
9651,
869,
348,
711,
16349,
877,
24299,
742,
1583,
3032,
22379,
29918,
7387,
29897,
13,
13,
1678,
822,
903,
22379,
29918,
601,
29898,
1311,
29892,
1741,
29922,
8516,
1125,
13,
4706,
396,
14402,
29901,
29408,
766,
17961,
310,
9224,
29889,
13,
4706,
1480,
29889,
8382,
877,
23456,
10663,
1495,
13,
4706,
1298,
353,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
17588,
29918,
3149,
29898,
5971,
29918,
29925,
6992,
29911,
29897,
13,
13,
4706,
1583,
3032,
3359,
1575,
353,
1284,
29918,
3359,
1575,
29898,
3149,
29897,
13,
4706,
1583,
3032,
996,
1475,
29892,
1583,
3032,
6207,
29918,
10599,
353,
1284,
29918,
996,
1475,
29898,
3149,
29897,
13,
4706,
1583,
3032,
305,
12629,
353,
1284,
29918,
305,
12629,
29898,
1311,
3032,
996,
1475,
29897,
13,
4706,
1583,
3032,
4905,
29879,
29892,
1583,
3032,
5924,
292,
353,
1284,
29918,
4905,
29879,
29898,
1311,
3032,
305,
12629,
29892,
1298,
29897,
13,
4706,
1583,
3032,
2080,
29879,
353,
1284,
29918,
2080,
29879,
29898,
1311,
3032,
305,
12629,
29892,
1298,
29897,
13,
13,
4706,
363,
274,
297,
1583,
3032,
305,
12629,
29889,
5975,
7295,
13,
9651,
274,
29889,
1359,
29918,
29135,
29898,
1311,
29889,
1287,
1785,
305,
29897,
13,
13,
4706,
363,
270,
297,
1583,
3032,
3359,
1575,
29889,
5975,
7295,
13,
9651,
270,
29889,
1359,
29918,
29135,
29898,
1311,
29889,
1287,
1785,
305,
29897,
13,
13,
4706,
363,
269,
297,
1583,
3032,
5924,
292,
29889,
5975,
7295,
13,
9651,
269,
29889,
1359,
29918,
29135,
29898,
1311,
29889,
1287,
1785,
305,
29897,
13,
13,
4706,
363,
321,
297,
1583,
3032,
996,
1475,
29889,
5975,
7295,
13,
9651,
321,
29889,
1359,
29918,
29135,
29898,
1311,
29889,
1287,
1785,
305,
29897,
13,
13,
4706,
363,
288,
297,
1583,
3032,
4905,
29879,
29889,
5975,
7295,
13,
9651,
288,
29889,
1359,
29918,
29135,
29898,
1311,
29889,
1287,
1785,
305,
29897,
13,
13,
4706,
363,
474,
297,
1583,
3032,
2080,
29879,
29889,
5975,
7295,
13,
9651,
474,
29889,
1359,
29918,
29135,
29898,
1311,
29889,
1287,
1785,
305,
29897,
13,
13,
4706,
1480,
29889,
25442,
877,
7775,
7775,
4189,
2328,
17435,
1495,
13,
4706,
1480,
29889,
25442,
29898,
710,
29898,
1311,
3032,
4905,
29879,
29889,
8149,
22130,
13,
13,
1678,
822,
903,
6915,
29918,
4905,
29879,
29898,
1311,
1125,
13,
4706,
363,
288,
297,
1583,
3032,
4905,
29879,
29889,
5975,
7295,
13,
9651,
396,
3824,
29892,
1207,
1854,
393,
278,
1962,
338,
6631,
304,
263,
3646,
29889,
5399,
13,
9651,
396,
304,
1074,
565,
278,
3646,
338,
4257,
29889,
960,
451,
29892,
769,
1423,
304,
1074,
565,
372,
13,
9651,
396,
756,
263,
3847,
697,
508,
671,
29889,
13,
9651,
565,
288,
29889,
5182,
338,
6213,
322,
288,
29889,
5182,
29918,
978,
29901,
13,
18884,
1583,
29889,
6915,
29918,
4905,
29898,
29877,
29889,
978,
29892,
288,
29889,
5182,
29918,
978,
29897,
13,
9651,
25342,
288,
29889,
5182,
338,
6213,
322,
451,
338,
8758,
29898,
29877,
29889,
3560,
29892,
7338,
2673,
1125,
13,
18884,
288,
29889,
3560,
29889,
1202,
29918,
4905,
29898,
29877,
29897,
13,
9651,
25342,
288,
29889,
5182,
338,
6213,
29901,
13,
18884,
1480,
29889,
25442,
877,
2525,
18045,
1962,
1273,
29879,
742,
288,
29889,
978,
29897,
13,
13,
1678,
822,
903,
6915,
29918,
2080,
29879,
29898,
1311,
1125,
13,
4706,
363,
474,
297,
1583,
3032,
2080,
29879,
29889,
5975,
7295,
13,
9651,
396,
3824,
29892,
1207,
1854,
278,
1881,
338,
6631,
304,
263,
2752,
13,
9651,
1018,
29901,
13,
18884,
565,
474,
29889,
4993,
338,
6213,
322,
474,
29889,
4993,
29918,
978,
29901,
13,
462,
1678,
1583,
29889,
6915,
29918,
2080,
29898,
29875,
29889,
978,
29892,
474,
29889,
4993,
29918,
978,
29897,
13,
18884,
25342,
474,
29889,
4993,
338,
6213,
322,
451,
338,
8758,
29898,
29875,
29889,
3560,
29892,
7338,
2673,
1125,
13,
462,
1678,
474,
29889,
3560,
29889,
1202,
29918,
2080,
29898,
29875,
29897,
13,
18884,
25342,
474,
29889,
4993,
338,
6213,
29901,
13,
462,
1678,
1480,
29889,
25442,
877,
2525,
18045,
1881,
1273,
29879,
742,
474,
29889,
978,
29897,
13,
9651,
5174,
29901,
13,
18884,
1209,
13,
13,
1678,
822,
4511,
29918,
4905,
29898,
1311,
29892,
1962,
29918,
978,
29892,
3646,
29918,
978,
1125,
13,
4706,
396,
6645,
701,
14391,
411,
18196,
565,
4312,
29889,
29871,
14402,
29901,
1815,
1790,
1962,
367,
13,
4706,
396,
278,
3646,
313,
29872,
29889,
29887,
1696,
565,
697,
5131,
304,
14405,
2999,
18897,
964,
263,
13,
4706,
396,
2323,
4840,
6877,
13,
4706,
565,
3646,
29918,
978,
297,
1583,
3032,
305,
12629,
29901,
13,
9651,
3646,
353,
1583,
3032,
305,
12629,
29961,
5182,
29918,
978,
29962,
13,
4706,
1683,
29901,
13,
9651,
286,
353,
376,
14148,
3646,
6571,
6790,
363,
1962,
426,
5038,
320,
13,
18884,
869,
4830,
29898,
5182,
29918,
978,
29892,
1962,
29918,
978,
29897,
13,
9651,
12020,
7865,
2392,
29898,
29885,
29897,
13,
13,
4706,
288,
353,
1583,
3032,
4905,
29879,
29961,
4905,
29918,
978,
29962,
13,
4706,
3646,
29889,
1202,
29918,
4905,
29898,
29877,
29897,
13,
4706,
286,
353,
525,
20971,
2954,
1962,
1273,
29879,
304,
3646,
1273,
29879,
29915,
13,
4706,
1480,
29889,
8382,
29898,
29885,
29892,
1962,
29918,
978,
29892,
3646,
29918,
978,
29897,
13,
13,
1678,
822,
4511,
29918,
2080,
29898,
1311,
29892,
1881,
29918,
978,
29892,
2752,
29918,
978,
1125,
13,
4706,
565,
2752,
29918,
978,
297,
1583,
3032,
2080,
29879,
29901,
13,
9651,
2752,
353,
1583,
3032,
2080,
29879,
29961,
4993,
29918,
978,
29962,
13,
4706,
25342,
2752,
29918,
978,
297,
1583,
3032,
305,
12629,
29901,
13,
9651,
2752,
353,
1583,
3032,
305,
12629,
29961,
4993,
29918,
978,
29962,
13,
4706,
1683,
29901,
13,
9651,
286,
353,
376,
14148,
2752,
6571,
1642,
4830,
29898,
4993,
29918,
978,
29897,
13,
9651,
12020,
7865,
2392,
29898,
29885,
29897,
13,
13,
4706,
474,
353,
1583,
3032,
2080,
29879,
29961,
2080,
29918,
978,
29962,
13,
4706,
2752,
29889,
1202,
29918,
2080,
29898,
29875,
29897,
13,
4706,
286,
353,
525,
20971,
2954,
1881,
1273,
29879,
304,
2752,
1273,
29879,
29915,
13,
4706,
1480,
29889,
8382,
29898,
29885,
29892,
1881,
29918,
978,
29892,
2752,
29918,
978,
29897,
13,
13,
1678,
822,
903,
22379,
29918,
7387,
29898,
1311,
29892,
1741,
29922,
8516,
1125,
13,
4706,
8820,
353,
5159,
13,
4706,
4959,
353,
6571,
13,
4706,
5922,
353,
6571,
13,
13,
4706,
1298,
353,
1583,
29889,
1287,
1785,
305,
29889,
657,
29918,
17588,
29918,
3149,
29898,
24705,
29918,
29925,
6992,
29911,
29897,
13,
4706,
363,
6081,
297,
1298,
29889,
24299,
29901,
13,
9651,
1476,
29918,
28631,
353,
6081,
29889,
657,
29918,
11991,
29898,
1252,
15362,
2792,
29897,
13,
9651,
1476,
29918,
13604,
353,
6081,
29889,
657,
29918,
11991,
29898,
1252,
15362,
2624,
29897,
13,
9651,
1476,
29918,
7387,
353,
6081,
29889,
657,
29918,
11991,
29898,
1252,
15362,
4276,
5160,
29897,
13,
13,
9651,
363,
2106,
297,
1476,
29918,
28631,
29901,
13,
18884,
565,
2106,
29889,
978,
297,
5922,
29901,
13,
462,
1678,
286,
353,
525,
8875,
2106,
2307,
4864,
4286,
4830,
29898,
3859,
29889,
978,
29897,
13,
462,
1678,
12020,
7865,
2392,
29898,
29885,
29897,
13,
18884,
5922,
29961,
3859,
29889,
978,
29962,
353,
2106,
13,
18884,
1476,
29918,
13604,
29889,
21843,
29898,
3859,
3032,
17158,
29918,
13604,
3101,
13,
13,
9651,
363,
1741,
297,
1476,
29918,
13604,
29901,
13,
18884,
565,
1741,
29889,
978,
297,
4959,
29901,
13,
462,
1678,
286,
353,
525,
8875,
1741,
2307,
4864,
4286,
4830,
29898,
3696,
29889,
978,
29897,
13,
462,
1678,
12020,
7865,
2392,
29898,
29885,
29897,
13,
18884,
4959,
29961,
3696,
29889,
978,
29962,
353,
1741,
13,
13,
9651,
8820,
29889,
21843,
29898,
11940,
29918,
7387,
29897,
13,
13,
4706,
3030,
353,
6571,
13,
4706,
363,
2106,
29918,
978,
297,
5922,
29901,
13,
9651,
3030,
29961,
3859,
29918,
978,
718,
22868,
4925,
2033,
353,
7700,
13,
4706,
363,
1741,
29918,
978,
297,
4959,
29901,
13,
9651,
3030,
29961,
3696,
29918,
978,
29962,
353,
7700,
13,
13,
4706,
8820,
29889,
6605,
29898,
1989,
29922,
2892,
263,
29901,
263,
29889,
7915,
29897,
13,
4706,
1583,
3032,
28631,
353,
5922,
13,
4706,
1583,
3032,
13604,
353,
4959,
13,
4706,
1583,
3032,
8582,
29918,
7387,
353,
8820,
13,
4706,
1583,
3032,
2467,
29918,
4703,
353,
3030,
13,
13,
1678,
822,
6036,
29918,
2467,
29898,
1311,
29892,
1741,
29892,
1899,
29892,
9049,
5085,
29922,
8516,
1125,
13,
4706,
565,
9049,
5085,
338,
6213,
29901,
13,
9651,
9049,
5085,
353,
6571,
13,
4706,
565,
338,
8758,
29898,
6519,
29892,
851,
1125,
13,
9651,
3158,
353,
1222,
15362,
4276,
29898,
3696,
29922,
3696,
29892,
1899,
29922,
6519,
29892,
13,
462,
462,
418,
9049,
5085,
29922,
19290,
29897,
13,
4706,
1683,
29901,
13,
9651,
3158,
353,
1222,
15362,
10717,
29898,
3696,
29922,
3696,
29892,
6939,
29922,
6519,
29892,
13,
462,
462,
4706,
9049,
5085,
29922,
19290,
29897,
13,
4706,
1583,
3032,
9573,
287,
29918,
7387,
29889,
4397,
29898,
2467,
29897,
13,
13,
1678,
822,
2186,
675,
29918,
601,
29898,
1311,
1125,
13,
4706,
1583,
3032,
6915,
29918,
4905,
29879,
580,
13,
4706,
1583,
3032,
6915,
29918,
2080,
29879,
580,
13,
13,
1678,
822,
10822,
29918,
996,
1475,
29898,
1311,
1125,
13,
4706,
1480,
29889,
8382,
877,
3991,
3864,
24000,
1495,
13,
4706,
363,
6012,
297,
1583,
3032,
996,
1475,
29889,
5975,
7295,
13,
9651,
396,
5399,
304,
1074,
565,
6012,
338,
1641,
1304,
13,
9651,
565,
6012,
29889,
657,
29918,
305,
12629,
7295,
13,
18884,
6012,
29889,
17591,
580,
13,
18884,
26324,
353,
7687,
29898,
1311,
29889,
9772,
29918,
7387,
29892,
22372,
2403,
355,
4286,
4830,
29898,
10599,
29889,
978,
876,
13,
18884,
6012,
29889,
9573,
29918,
15091,
29918,
14035,
29898,
10702,
29897,
13,
4706,
1583,
29889,
9772,
29918,
7387,
877,
996,
1475,
29918,
2917,
2955,
1495,
13,
13,
1678,
822,
1369,
29918,
996,
1475,
29898,
1311,
1125,
13,
4706,
1480,
29889,
8382,
877,
4763,
292,
24000,
1495,
13,
4706,
363,
6012,
297,
1583,
3032,
996,
1475,
29889,
5975,
7295,
13,
9651,
6012,
29889,
2962,
580,
13,
13,
1678,
822,
5040,
29918,
996,
1475,
29898,
1311,
1125,
13,
4706,
363,
1024,
29892,
12237,
297,
1051,
29898,
1311,
3032,
9346,
414,
29889,
7076,
580,
1125,
13,
9651,
12237,
29889,
15619,
29889,
2218,
6915,
580,
13,
9651,
12237,
29889,
9847,
580,
13,
9651,
628,
1583,
3032,
9346,
414,
29961,
978,
29962,
13,
4706,
363,
6012,
297,
1583,
3032,
996,
1475,
29889,
5975,
7295,
13,
9651,
6012,
29889,
9847,
580,
13,
13,
1678,
822,
10092,
29918,
996,
1475,
29898,
1311,
1125,
13,
4706,
363,
6012,
297,
1583,
3032,
996,
1475,
29889,
5975,
7295,
13,
9651,
6012,
29889,
12071,
580,
13,
13,
1678,
822,
679,
29918,
4905,
29898,
1311,
29892,
1962,
29918,
978,
1125,
13,
4706,
736,
1583,
3032,
4905,
29879,
29961,
4905,
29918,
978,
29962,
13,
13,
1678,
822,
679,
29918,
2080,
29898,
1311,
29892,
1881,
29918,
978,
1125,
13,
4706,
736,
1583,
3032,
2080,
29879,
29961,
2080,
29918,
978,
29962,
13,
13,
1678,
822,
731,
29918,
2080,
29918,
5552,
29898,
1311,
29892,
1881,
29918,
978,
29892,
12421,
29918,
978,
29892,
995,
1125,
13,
4706,
731,
5552,
29898,
1311,
3032,
2080,
29879,
29961,
2080,
29918,
978,
1402,
12421,
29918,
978,
29892,
995,
29897,
13,
13,
1678,
822,
679,
29918,
12719,
29898,
1311,
29892,
8242,
29918,
978,
1125,
13,
4706,
736,
1583,
3032,
305,
12629,
29961,
12719,
29918,
978,
29962,
13,
13,
1678,
822,
679,
29918,
305,
12629,
29898,
1311,
29892,
4464,
29922,
8516,
29892,
5305,
29922,
8516,
29892,
28750,
29922,
8516,
29892,
13,
462,
268,
6136,
29922,
5574,
1125,
13,
4706,
14550,
13,
4706,
7106,
18196,
9686,
16614,
4822,
599,
24000,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
4464,
584,
426,
8516,
29892,
525,
7054,
468,
742,
525,
7501,
2410,
29915,
13,
9651,
5167,
310,
8242,
13,
4706,
5305,
584,
426,
8516,
29892,
525,
2080,
29892,
525,
4905,
10827,
13,
9651,
360,
8684,
13,
4706,
28750,
584,
426,
8516,
29892,
525,
6800,
2519,
742,
525,
20415,
10827,
13,
9651,
10999,
2519,
470,
7047,
29899,
9346,
287,
8242,
29889,
10999,
2519,
29899,
9346,
287,
18196,
505,
263,
13,
9651,
23460,
10868,
7621,
1135,
29871,
29900,
29889,
13,
4706,
6136,
584,
6120,
13,
9651,
960,
5852,
29892,
736,
871,
18196,
393,
505,
13252,
10970,
470,
13,
9651,
14391,
29889,
13,
4706,
14550,
13,
4706,
18196,
353,
5159,
13,
4706,
363,
6012,
297,
1583,
3032,
996,
1475,
29889,
5975,
7295,
13,
9651,
21226,
353,
6012,
29889,
657,
29918,
305,
12629,
29898,
8513,
29892,
5305,
29892,
28750,
29892,
6136,
29897,
13,
9651,
18196,
29889,
21843,
29898,
687,
29897,
13,
4706,
736,
18196,
13,
13,
1678,
822,
2254,
29918,
1052,
26218,
29898,
1311,
29892,
1208,
26218,
29918,
1445,
1125,
13,
4706,
18196,
353,
1051,
29898,
1311,
3032,
305,
12629,
29889,
5975,
3101,
13,
4706,
2254,
29918,
1052,
26218,
29898,
1052,
26218,
29918,
1445,
29892,
18196,
29897,
13,
13,
1678,
822,
15928,
29918,
7387,
29898,
1311,
29892,
1741,
29918,
978,
29892,
14334,
29922,
8516,
29892,
29801,
29922,
8824,
29892,
13,
462,
539,
12611,
29918,
735,
15423,
29922,
5574,
29892,
9049,
29922,
8516,
1125,
13,
4706,
1480,
29889,
8382,
877,
12165,
17223,
8820,
363,
1273,
29879,
742,
1741,
29918,
978,
29897,
13,
4706,
565,
12611,
29918,
735,
15423,
29901,
13,
9651,
316,
14373,
29918,
4804,
29898,
1311,
29889,
9847,
29918,
20404,
29892,
1741,
29918,
978,
29897,
13,
4706,
565,
29801,
29901,
13,
9651,
9055,
353,
14334,
29899,
1311,
29889,
657,
29918,
1372,
580,
13,
9651,
565,
9055,
1405,
29871,
29900,
29901,
13,
18884,
26324,
353,
14013,
29901,
1583,
3032,
9772,
29918,
7387,
29898,
3696,
29918,
978,
29892,
14334,
29897,
13,
18884,
316,
14373,
29918,
4804,
29898,
1311,
29889,
2962,
29918,
20404,
29892,
1741,
29918,
978,
29892,
9055,
29892,
26324,
29897,
13,
18884,
736,
13,
4706,
1583,
3032,
9772,
29918,
7387,
29898,
3696,
29918,
978,
29892,
14334,
29892,
9049,
29897,
13,
13,
1678,
822,
1741,
29918,
3880,
29898,
1311,
29892,
1741,
29918,
978,
1125,
13,
4706,
14550,
13,
4706,
16969,
1565,
565,
278,
7639,
1741,
338,
3216,
304,
385,
7639,
3158,
29889,
13,
13,
4706,
910,
338,
12234,
1304,
25106,
408,
263,
4180,
29899,
20640,
2133,
577,
591,
13,
4706,
1016,
29915,
29873,
10822,
6939,
29879,
363,
4959,
393,
526,
443,
3880,
29889,
1152,
1342,
29892,
591,
13,
4706,
508,
10641,
8820,
304,
278,
529,
2080,
29918,
978,
29958,
29918,
562,
5958,
1741,
29889,
2398,
29892,
445,
13,
4706,
1741,
12234,
10008,
3196,
3064,
263,
1473,
363,
1269,
1881,
29889,
910,
13,
4706,
723,
1121,
297,
443,
687,
404,
653,
5717,
304,
421,
9772,
29918,
7387,
1412,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
1741,
29918,
978,
584,
851,
13,
9651,
4408,
310,
1741,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
1304,
584,
6120,
13,
9651,
5852,
565,
1741,
338,
3216,
304,
385,
3158,
29892,
7700,
6467,
29889,
13,
4706,
14550,
13,
4706,
363,
3158,
297,
1583,
3032,
7387,
29901,
13,
9651,
565,
1741,
29918,
978,
297,
3158,
29889,
22594,
29901,
13,
18884,
736,
5852,
13,
4706,
736,
7700,
13,
13,
1678,
822,
903,
9772,
29918,
7387,
29898,
1311,
29892,
1741,
29918,
978,
29892,
14334,
29922,
8516,
29892,
9049,
29922,
8516,
1125,
13,
4706,
1480,
29889,
8382,
877,
20211,
292,
1741,
6571,
4286,
4830,
29898,
3696,
29918,
978,
876,
13,
13,
4706,
565,
14334,
338,
451,
6213,
29901,
13,
9651,
848,
353,
11117,
3696,
2396,
1741,
29918,
978,
29892,
525,
16394,
2396,
14334,
29913,
13,
9651,
1583,
29889,
9772,
29918,
7387,
877,
735,
15362,
29918,
3696,
742,
9049,
3790,
29915,
1272,
2396,
848,
1800,
13,
13,
4706,
396,
960,
445,
338,
263,
2106,
1319,
1741,
29892,
2767,
278,
6942,
2106,
29889,
13,
4706,
565,
1741,
29918,
978,
29889,
1975,
2541,
877,
29918,
2962,
29374,
13,
9651,
1820,
353,
1741,
29918,
978,
7503,
29899,
29953,
29962,
13,
9651,
1583,
3032,
2467,
29918,
4703,
29961,
1989,
718,
22868,
4925,
2033,
353,
5852,
13,
4706,
25342,
1741,
29918,
978,
29889,
1975,
2541,
877,
29918,
355,
29374,
13,
9651,
1820,
353,
1741,
29918,
978,
7503,
29899,
29946,
29962,
13,
9651,
1583,
3032,
2467,
29918,
4703,
29961,
1989,
718,
22868,
4925,
2033,
353,
7700,
13,
13,
4706,
396,
8561,
263,
3509,
310,
278,
3030,
322,
731,
278,
1741,
304,
5852,
29889,
1334,
1016,
29915,
29873,
864,
13,
4706,
396,
304,
731,
278,
2106,
373,
278,
1667,
3030,
1951,
372,
1122,
6602,
16732,
13,
4706,
396,
25913,
29889,
13,
4706,
3030,
353,
1583,
3032,
2467,
29918,
4703,
29889,
8552,
580,
13,
4706,
3030,
29961,
3696,
29918,
978,
29962,
353,
5852,
13,
13,
4706,
363,
3158,
297,
1583,
3032,
7387,
29901,
13,
9651,
565,
3158,
29889,
4352,
29898,
4703,
1125,
13,
18884,
1480,
29889,
8382,
877,
856,
2437,
17223,
3158,
1273,
29879,
742,
3158,
29897,
13,
18884,
1583,
3032,
9772,
29918,
2467,
29898,
2467,
29892,
1741,
29918,
978,
29892,
14334,
29892,
9049,
29897,
13,
13,
1678,
822,
903,
9772,
29918,
2467,
29898,
1311,
29892,
3158,
29892,
1741,
29918,
978,
29892,
14334,
29892,
9049,
1125,
13,
4706,
396,
3462,
278,
1741,
1024,
322,
14334,
304,
278,
4128,
4502,
304,
278,
13,
4706,
396,
1899,
29889,
13,
4706,
9049,
5085,
353,
3158,
29889,
19290,
29889,
8552,
580,
13,
4706,
9049,
5085,
1839,
16394,
2033,
353,
14334,
13,
4706,
9049,
5085,
1839,
3696,
2033,
353,
1741,
29918,
978,
13,
4706,
565,
9049,
338,
451,
6213,
29901,
13,
9651,
9049,
5085,
29889,
5504,
29898,
11022,
29897,
13,
4706,
565,
338,
8758,
29898,
2467,
29892,
1222,
15362,
4276,
1125,
13,
9651,
1583,
29889,
3221,
29889,
9772,
29918,
6519,
29898,
2467,
29889,
6519,
29892,
4128,
29922,
19290,
29897,
13,
4706,
25342,
338,
8758,
29898,
2467,
29892,
1222,
15362,
10717,
1125,
13,
9651,
3158,
29889,
14035,
29898,
1068,
19290,
29897,
13,
13,
1678,
822,
2009,
29918,
7302,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
7302,
29918,
25990,
7295,
13,
9651,
1480,
29889,
8382,
877,
2052,
368,
13877,
1495,
13,
9651,
316,
14373,
29918,
4804,
29898,
2892,
29901,
731,
5552,
29898,
1311,
29892,
22868,
7302,
29918,
3827,
287,
742,
5852,
876,
13,
13,
1678,
822,
2009,
29918,
1745,
513,
29898,
1311,
1125,
13,
4706,
316,
14373,
29918,
4804,
29898,
2892,
29901,
731,
5552,
29898,
1311,
29892,
22868,
1745,
513,
29918,
3827,
287,
742,
5852,
876,
13,
13,
1678,
822,
2009,
29918,
29886,
1071,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
29889,
29886,
1071,
29918,
735,
15362,
7295,
13,
9651,
1480,
29889,
8382,
877,
29925,
1071,
13877,
1495,
13,
9651,
316,
14373,
29918,
4804,
29898,
2892,
29901,
731,
5552,
29898,
1311,
29892,
22868,
29886,
1071,
29918,
3827,
287,
742,
5852,
876,
13,
13,
1678,
822,
2009,
29918,
690,
2017,
29898,
1311,
1125,
13,
4706,
1583,
3032,
29886,
1071,
29918,
3827,
287,
353,
7700,
13,
4706,
316,
14373,
29918,
4804,
29898,
2892,
29901,
731,
5552,
29898,
1311,
29892,
525,
735,
15362,
29918,
3859,
742,
525,
21094,
8785,
13,
13,
1678,
822,
3394,
29918,
25990,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
1369,
29918,
735,
15362,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9772,
29918,
7387,
877,
735,
15362,
29918,
24926,
1495,
13,
4706,
1583,
29889,
9772,
29918,
7387,
877,
735,
15362,
29918,
19125,
1495,
13,
4706,
1583,
29889,
9772,
29918,
7387,
877,
735,
15362,
29918,
2962,
1495,
13,
4706,
316,
14373,
29918,
4804,
29898,
2892,
29901,
731,
5552,
29898,
1311,
29892,
525,
735,
15362,
29918,
3859,
742,
525,
21094,
8785,
13,
13,
1678,
822,
5040,
29918,
735,
15362,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
9772,
29918,
7387,
877,
735,
15362,
29918,
355,
742,
1583,
29889,
657,
29918,
1372,
3101,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
1480,
29889,
11739,
29898,
29872,
29897,
13,
4706,
316,
14373,
29918,
4804,
29898,
2892,
29901,
731,
5552,
29898,
1311,
29892,
525,
735,
15362,
29918,
3859,
742,
525,
7864,
2986,
8785,
13,
13,
1678,
822,
19957,
29918,
735,
15362,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
679,
29918,
1372,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
6207,
29918,
10599,
29889,
657,
29918,
1372,
580,
13,
13,
1678,
822,
731,
29918,
29886,
1071,
29918,
554,
29898,
1311,
29892,
995,
1125,
13,
4706,
316,
14373,
29918,
4804,
29898,
2892,
29901,
731,
5552,
29898,
1311,
29892,
22868,
29886,
1071,
29918,
554,
742,
995,
876,
13,
13,
1678,
822,
1369,
29918,
20404,
29898,
1311,
29892,
1024,
29892,
14385,
29892,
6939,
1125,
13,
4706,
1480,
29889,
8382,
877,
4763,
292,
1273,
29888,
5226,
29889,
12237,
1273,
29879,
742,
14385,
29892,
1024,
29897,
13,
4706,
12237,
353,
660,
14745,
580,
13,
4706,
12237,
29889,
15619,
29889,
6915,
29898,
14035,
29897,
13,
4706,
12237,
29889,
842,
15771,
2713,
327,
29898,
5574,
29897,
13,
4706,
12237,
29889,
2962,
29898,
19708,
29930,
29896,
29872,
29941,
29897,
13,
4706,
1583,
3032,
9346,
414,
29961,
978,
29962,
353,
12237,
13,
13,
1678,
822,
5040,
29918,
20404,
29898,
1311,
29892,
1024,
1125,
13,
4706,
565,
1583,
3032,
9346,
414,
29889,
657,
29898,
978,
29897,
338,
451,
6213,
29901,
13,
9651,
1583,
3032,
9346,
414,
29961,
978,
1822,
15619,
29889,
2218,
6915,
580,
13,
9651,
1583,
3032,
9346,
414,
29961,
978,
1822,
9847,
580,
13,
9651,
628,
1583,
3032,
9346,
414,
29961,
978,
29962,
13,
9651,
1480,
29889,
8382,
877,
4205,
3606,
316,
14373,
1741,
1273,
29879,
742,
1024,
29897,
13,
2
] |
stable-baselines/tests/test_deterministic.py | princeton-vl/PackIt | 49 | 9989 | import pytest
from stable_baselines import A2C, ACER, ACKTR, DeepQ, DDPG, PPO1, PPO2, TRPO
from stable_baselines.ddpg import AdaptiveParamNoiseSpec
from stable_baselines.common.identity_env import IdentityEnv, IdentityEnvBox
from stable_baselines.common.vec_env import DummyVecEnv
PARAM_NOISE_DDPG = AdaptiveParamNoiseSpec(initial_stddev=float(0.2), desired_action_stddev=float(0.2))
# Hyperparameters for learning identity for each RL model
LEARN_FUNC_DICT = {
'a2c': lambda e: A2C(policy="MlpPolicy", env=e).learn(total_timesteps=1000),
'acer': lambda e: ACER(policy="MlpPolicy", env=e).learn(total_timesteps=1000),
'acktr': lambda e: ACKTR(policy="MlpPolicy", env=e).learn(total_timesteps=1000),
'deepq': lambda e: DeepQ(policy="MlpPolicy", env=e).learn(total_timesteps=1000),
'ddpg': lambda e: DDPG(policy="MlpPolicy", env=e, param_noise=PARAM_NOISE_DDPG).learn(total_timesteps=1000),
'ppo1': lambda e: PPO1(policy="MlpPolicy", env=e).learn(total_timesteps=1000),
'ppo2': lambda e: PPO2(policy="MlpPolicy", env=e).learn(total_timesteps=1000),
'trpo': lambda e: TRPO(policy="MlpPolicy", env=e).learn(total_timesteps=1000),
}
@pytest.mark.slow
@pytest.mark.parametrize("model_name", ['a2c', 'acer', 'acktr', 'deepq', 'ppo1', 'ppo2', 'trpo'])
def test_identity(model_name):
"""
Test if the algorithm (with a given policy)
can learn an identity transformation (i.e. return observation as an action)
:param model_name: (str) Name of the RL model
"""
env = DummyVecEnv([lambda: IdentityEnv(10)])
model = LEARN_FUNC_DICT[model_name](env)
n_trials = 1000
obs = env.reset()
action_shape = model.predict(obs, deterministic=False)[0].shape
action, _ = model.predict(obs, deterministic=True)
assert action.shape == action_shape
for _ in range(n_trials):
new_action = model.predict(obs, deterministic=True)[0]
assert action == model.predict(obs, deterministic=True)[0]
assert new_action.shape == action_shape
# Free memory
del model, env
@pytest.mark.slow
@pytest.mark.parametrize("model_name", ['a2c', 'ddpg', 'ppo1', 'ppo2', 'trpo'])
def test_identity_continuous(model_name):
"""
Test if the algorithm (with a given policy)
can learn an identity transformation (i.e. return observation as an action)
:param model_name: (str) Name of the RL model
"""
env = DummyVecEnv([lambda: IdentityEnvBox(eps=0.5)])
model = LEARN_FUNC_DICT[model_name](env)
n_trials = 1000
obs = env.reset()
action_shape = model.predict(obs, deterministic=False)[0].shape
action, _ = model.predict(obs, deterministic=True)
assert action.shape == action_shape
for _ in range(n_trials):
new_action = model.predict(obs, deterministic=True)[0]
assert action == model.predict(obs, deterministic=True)[0]
assert new_action.shape == action_shape
| [
1,
1053,
11451,
1688,
13,
13,
3166,
13714,
29918,
6500,
24210,
1053,
319,
29906,
29907,
29892,
14614,
1001,
29892,
319,
7077,
5659,
29892,
21784,
29984,
29892,
360,
11191,
29954,
29892,
349,
13152,
29896,
29892,
349,
13152,
29906,
29892,
10014,
13152,
13,
3166,
13714,
29918,
6500,
24210,
29889,
1289,
4061,
1053,
23255,
415,
573,
4736,
3782,
895,
10299,
13,
3166,
13714,
29918,
6500,
24210,
29889,
9435,
29889,
22350,
29918,
6272,
1053,
27486,
21745,
29892,
27486,
21745,
3313,
13,
3166,
13714,
29918,
6500,
24210,
29889,
9435,
29889,
2003,
29918,
6272,
1053,
360,
11770,
25987,
21745,
13,
13,
16320,
5194,
29918,
6632,
29902,
1660,
29918,
7858,
16903,
353,
23255,
415,
573,
4736,
3782,
895,
10299,
29898,
11228,
29918,
4172,
3359,
29922,
7411,
29898,
29900,
29889,
29906,
511,
7429,
29918,
2467,
29918,
4172,
3359,
29922,
7411,
29898,
29900,
29889,
29906,
876,
13,
13,
29937,
26078,
16744,
363,
6509,
10110,
363,
1269,
390,
29931,
1904,
13,
1307,
15249,
29918,
29943,
3904,
29907,
29918,
4571,
1783,
353,
426,
13,
1678,
525,
29874,
29906,
29883,
2396,
14013,
321,
29901,
319,
29906,
29907,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
1678,
525,
562,
261,
2396,
14013,
321,
29901,
14614,
1001,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
1678,
525,
547,
509,
2396,
14013,
321,
29901,
319,
7077,
5659,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
1678,
525,
24535,
29939,
2396,
14013,
321,
29901,
21784,
29984,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
1678,
525,
1289,
4061,
2396,
14013,
321,
29901,
360,
11191,
29954,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
29892,
1828,
29918,
1217,
895,
29922,
16320,
5194,
29918,
6632,
29902,
1660,
29918,
7858,
16903,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
1678,
525,
9759,
29896,
2396,
14013,
321,
29901,
349,
13152,
29896,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
1678,
525,
9759,
29906,
2396,
14013,
321,
29901,
349,
13152,
29906,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
1678,
525,
509,
1129,
2396,
14013,
321,
29901,
10014,
13152,
29898,
22197,
543,
29924,
22833,
15644,
613,
8829,
29922,
29872,
467,
19668,
29898,
7827,
29918,
9346,
4196,
567,
29922,
29896,
29900,
29900,
29900,
511,
13,
29913,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
28544,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
4299,
29918,
978,
613,
6024,
29874,
29906,
29883,
742,
525,
562,
261,
742,
525,
547,
509,
742,
525,
24535,
29939,
742,
525,
9759,
29896,
742,
525,
9759,
29906,
742,
525,
509,
1129,
11287,
13,
1753,
1243,
29918,
22350,
29898,
4299,
29918,
978,
1125,
13,
1678,
9995,
13,
1678,
4321,
565,
278,
5687,
313,
2541,
263,
2183,
8898,
29897,
13,
1678,
508,
5110,
385,
10110,
13852,
313,
29875,
29889,
29872,
29889,
736,
15500,
408,
385,
3158,
29897,
13,
13,
1678,
584,
3207,
1904,
29918,
978,
29901,
313,
710,
29897,
4408,
310,
278,
390,
29931,
1904,
13,
1678,
9995,
13,
1678,
8829,
353,
360,
11770,
25987,
21745,
4197,
2892,
29901,
27486,
21745,
29898,
29896,
29900,
29897,
2314,
13,
13,
1678,
1904,
353,
11060,
15249,
29918,
29943,
3904,
29907,
29918,
4571,
1783,
29961,
4299,
29918,
978,
850,
6272,
29897,
13,
13,
1678,
302,
29918,
3626,
1338,
353,
29871,
29896,
29900,
29900,
29900,
13,
1678,
20881,
353,
8829,
29889,
12071,
580,
13,
1678,
3158,
29918,
12181,
353,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
8824,
9601,
29900,
1822,
12181,
13,
1678,
3158,
29892,
903,
353,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
5574,
29897,
13,
1678,
4974,
3158,
29889,
12181,
1275,
3158,
29918,
12181,
13,
1678,
363,
903,
297,
3464,
29898,
29876,
29918,
3626,
1338,
1125,
13,
4706,
716,
29918,
2467,
353,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
5574,
9601,
29900,
29962,
13,
4706,
4974,
3158,
1275,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
5574,
9601,
29900,
29962,
13,
4706,
4974,
716,
29918,
2467,
29889,
12181,
1275,
3158,
29918,
12181,
13,
1678,
396,
12362,
3370,
13,
1678,
628,
1904,
29892,
8829,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
28544,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
4299,
29918,
978,
613,
6024,
29874,
29906,
29883,
742,
525,
1289,
4061,
742,
525,
9759,
29896,
742,
525,
9759,
29906,
742,
525,
509,
1129,
11287,
13,
1753,
1243,
29918,
22350,
29918,
20621,
681,
29898,
4299,
29918,
978,
1125,
13,
1678,
9995,
13,
1678,
4321,
565,
278,
5687,
313,
2541,
263,
2183,
8898,
29897,
13,
1678,
508,
5110,
385,
10110,
13852,
313,
29875,
29889,
29872,
29889,
736,
15500,
408,
385,
3158,
29897,
13,
13,
1678,
584,
3207,
1904,
29918,
978,
29901,
313,
710,
29897,
4408,
310,
278,
390,
29931,
1904,
13,
1678,
9995,
13,
1678,
8829,
353,
360,
11770,
25987,
21745,
4197,
2892,
29901,
27486,
21745,
3313,
29898,
8961,
29922,
29900,
29889,
29945,
29897,
2314,
13,
13,
1678,
1904,
353,
11060,
15249,
29918,
29943,
3904,
29907,
29918,
4571,
1783,
29961,
4299,
29918,
978,
850,
6272,
29897,
13,
13,
1678,
302,
29918,
3626,
1338,
353,
29871,
29896,
29900,
29900,
29900,
13,
1678,
20881,
353,
8829,
29889,
12071,
580,
13,
1678,
3158,
29918,
12181,
353,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
8824,
9601,
29900,
1822,
12181,
13,
1678,
3158,
29892,
903,
353,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
5574,
29897,
13,
1678,
4974,
3158,
29889,
12181,
1275,
3158,
29918,
12181,
13,
1678,
363,
903,
297,
3464,
29898,
29876,
29918,
3626,
1338,
1125,
13,
4706,
716,
29918,
2467,
353,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
5574,
9601,
29900,
29962,
13,
4706,
4974,
3158,
1275,
1904,
29889,
27711,
29898,
26290,
29892,
11806,
4695,
29922,
5574,
9601,
29900,
29962,
13,
4706,
4974,
716,
29918,
2467,
29889,
12181,
1275,
3158,
29918,
12181,
13,
2
] |
bot/utils/github.py | mtrsk/PUGMA-bot | 9 | 119869 | """
Modulo dedicado a classes/funções sem nenhuma outra dependência ou
que não sejam parte do core do Bot.
"""
import json
import requests
def photo_meetup(repo_data, matches):
"""
Recebe como entrada uma Dataclass com dados do nosso
repositório no Github e retorna a url de uma imagem
do meetup.
"""
contents_url = f"{repo_data.url}/contents/palestras?ref=master"
response = requests.get(contents_url, headers=repo_data.headers)
content = json.loads(response.content)
content_length = len(content)
if len(matches) == 1:
# /meetup retorna sempre o último
return content[-1].get("download_url"), (content_length)
elif int(matches[1]) < content_length:
# /meetup \d{1,2}
event_num = int(matches[1])
return content[event_num - 1].get("download_url"), event_num
else:
# Numero invalido
return None, None
| [
1,
9995,
13,
2111,
7207,
8856,
912,
263,
4413,
29914,
7692,
5616,
3031,
302,
264,
29882,
10859,
714,
336,
8839,
10544,
2123,
13,
802,
8145,
409,
29926,
314,
3810,
437,
7136,
437,
11273,
29889,
13,
15945,
29908,
13,
5215,
4390,
13,
13,
5215,
7274,
13,
13,
13,
1753,
15373,
29918,
1004,
300,
786,
29898,
20095,
29918,
1272,
29892,
7087,
1125,
13,
1678,
9995,
13,
1678,
24328,
915,
1986,
9953,
1114,
3672,
3630,
1990,
419,
270,
2255,
437,
7814,
578,
13,
1678,
17573,
277,
29980,
5378,
694,
402,
2985,
321,
3240,
272,
1056,
263,
3142,
316,
3672,
6382,
331,
13,
1678,
437,
5870,
786,
29889,
13,
1678,
9995,
13,
1678,
8118,
29918,
2271,
353,
285,
29908,
29912,
20095,
29918,
1272,
29889,
2271,
6822,
10853,
29914,
7830,
342,
3417,
29973,
999,
29922,
6207,
29908,
13,
13,
1678,
2933,
353,
7274,
29889,
657,
29898,
10853,
29918,
2271,
29892,
9066,
29922,
20095,
29918,
1272,
29889,
13662,
29897,
13,
1678,
2793,
353,
4390,
29889,
18132,
29898,
5327,
29889,
3051,
29897,
13,
1678,
2793,
29918,
2848,
353,
7431,
29898,
3051,
29897,
13,
13,
1678,
565,
7431,
29898,
20317,
29897,
1275,
29871,
29896,
29901,
13,
4706,
396,
847,
1004,
300,
786,
3240,
272,
1056,
14472,
288,
20195,
13,
4706,
736,
2793,
14352,
29896,
1822,
657,
703,
10382,
29918,
2271,
4968,
313,
3051,
29918,
2848,
29897,
13,
1678,
25342,
938,
29898,
20317,
29961,
29896,
2314,
529,
2793,
29918,
2848,
29901,
13,
4706,
396,
847,
1004,
300,
786,
320,
29881,
29912,
29896,
29892,
29906,
29913,
13,
4706,
1741,
29918,
1949,
353,
938,
29898,
20317,
29961,
29896,
2314,
13,
4706,
736,
2793,
29961,
3696,
29918,
1949,
448,
29871,
29896,
1822,
657,
703,
10382,
29918,
2271,
4968,
1741,
29918,
1949,
13,
1678,
1683,
29901,
13,
4706,
396,
11848,
1489,
297,
791,
1941,
13,
4706,
736,
6213,
29892,
6213,
13,
2
] |
src/experiments/random_projections_aistats_ridge_regression.py | c-dickens/FrequentDirectionsRidgeRegression | 0 | 116922 | # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
from timeit import default_timer as timer
class RPRidge:
def __init__(self,rp_dim:int,rp_mode='Sparse',gamma=1.0):
self.rp_dim = rp_dim
self.rp_mode = rp_mode
self.gamma = gamma
def iterate_single(self,X,y,iterations=10,seed=100):
'''
Fits the iterated ridge model with FD
'''
d = X.shape[1]
w = np.zeros((d,1),dtype=float)
all_w = np.zeros((d,iterations))
XTy = (X.T@y).reshape(-1,1)
# Fit the FD
SA = self._get_sketch(X,seed)
H = SA.T@SA + (self.gamma)*np.eye(d)
H_inv = np.linalg.pinv(H)
for it in range(iterations):
grad = X.T@(X@w) + self.gamma*w - XTy
w += - H_inv@grad
all_w[:,it] = np.squeeze(w)
return np.squeeze(w), all_w
def iterate_multiple(self,X,y,iterations=10):
'''
Fits the iterated ridge model with FD
'''
d = X.shape[1]
w = np.zeros((d,1),dtype=float)
all_w = np.zeros((d,iterations))
XTy = (X.T@y).reshape(-1,1)
for it in range(iterations):
SA = self._get_sketch(X,seed=100*it)
H = SA.T@SA + (self.gamma)*np.eye(d)
H_inv = np.linalg.pinv(H)
grad = X.T@(X@w) + self.gamma*w - XTy
w += - H_inv@grad
all_w[:,it] = np.squeeze(w)
return np.squeeze(w), all_w
def _naive_hessian_update(self, sketched_data, vec):
"""
Naively performs the hessian update by evaluating the approximate Hessian
and inverting.
"""
H = sketched_data.T@sketched_data + (self.gamma)*np.eye(sketched_data.shape[1])
H_inv = np.linalg.pinv(H)
return H_inv@vec
def _linear_solve_hessian_update(self, sketched_data, vec):
"""
Implements the hessian_inv@gradient efficiently by using Woodbury.
"""
K = sketched_data@sketched_data.T / self.gamma + np.eye(sketched_data.shape[0])
u = (1/self.gamma)*vec - (sketched_data.T / self.gamma**2)@(np.linalg.solve(K,sketched_data@vec))
return u
def iterate_multiple_timing(self, X, y, iterations=10):
"""
Fits the iterated ridge model with a new sketch every iteration
"""
# * Initialisation not timed
d = X.shape[1]
w = np.zeros((d,1),dtype=float)
all_w = np.zeros((d,iterations))
if self.rp_dim < d:
update_method = self._linear_solve_hessian_update
else:
update_method = self._naive_hessian_update
measurables = {
'sketch time' : None,
'all_times' : np.zeros(iterations+1,dtype=float),
'gradients' : np.zeros((d,iterations),dtype=float),
'updates' : np.zeros((d,iterations),dtype=float),
'sketch' : None
}
SKETCH_TIME = 0.0
TIMER_START = timer()
XTy = (X.T@y).reshape(-1,1)
for it in range(iterations):
# * Timing the sketch separately
SKETCH_TIMER_START = timer()
SA = self._get_sketch(X,seed=10*it)
SKETCH_TIME += timer() - SKETCH_TIMER_START
# * Into grad updates
grad = X.T@(X@w) + self.gamma*w - XTy
update = update_method(SA, grad)
w += - update
all_w[:,it] = np.squeeze(w)
measurables['all_times'][it+1] = timer() - TIMER_START
measurables['sketch time'] = SKETCH_TIME
return np.squeeze(w), all_w, measurables
def iterate_single_timing(self, X, y, iterations=10, seed=100):
"""
Fits the iterated ridge model with a new sketch every iteration
"""
# * Initialisation not timed
d = X.shape[1]
w = np.zeros((d,1),dtype=float)
all_w = np.zeros((d,iterations))
if self.rp_dim < d:
update_method = self._linear_solve_hessian_update
else:
update_method = self._naive_hessian_update
measurables = {
'sketch time' : None,
'all_times' : np.zeros(iterations+1,dtype=float),
'gradients' : np.zeros((d,iterations),dtype=float),
'updates' : np.zeros((d,iterations),dtype=float),
'sketch' : None
}
TIMER_START = timer()
XTy = (X.T@y).reshape(-1,1)
SA = self._get_sketch(X,seed)
SKETCH_TIME = timer() - TIMER_START
for it in range(iterations):
grad = X.T@(X@w) + self.gamma*w - XTy
update = update_method(SA, grad)
w += - update
all_w[:,it] = np.squeeze(w)
measurables['all_times'][it+1] = timer() - TIMER_START
measurables['sketch time'] = SKETCH_TIME
return np.squeeze(w), all_w, measurables
def _get_sketch(self,data,seed=10):
'''
Performs the sketch depending on the chosen mode.
'''
if self.rp_mode == 'Gaussian':
return self._gaussian_projection(data,seed)
elif self.rp_mode == 'SJLT':
return self._sparse_projection(data,10,seed)
else:
raise NotImplementedError
def fit_classical(self,X,y):
'''
Fits the ridge regression model on data X with targets y
'''
d = X.shape[1]
data = np.c_[X,y]
#S_data = self._sparse_projection(data,self.rp_dim)
#S_data = self._gaussian_projection(data,self.rp_dim)
S_data = self._get_sketch(data)
SX = S_data[:,:-1]
Sy = S_data[:,-1]
H_est = SX.T@SX + self.gamma*np.eye(d)
self.H = H_est
self.classical_coef_ = np.linalg.solve(H_est,SX.T@Sy)
def fit_hessian_sketch(self,X,y):
'''
Fits the ridge regression model on data X with targets y
'''
d = X.shape[1]
#SX = self._gaussian_projection(X,self.rp_dim)
#SX = self._sparse_projection(X,self.rp_dim)
SX = self._get_sketch(X)
H_est = SX.T@SX + self.gamma*np.eye(d)
self.hessian_coef_ = np.linalg.solve(H_est,X.T@y)
def get_classical_bias(self,X,w0):
'''
Returns the bias of the estimate
'''
return (self.gamma)*np.linalg.norm(np.linalg.pinv(self.H)@w0)
#return (np.linalg.pinv(self.H)@(self.H - self.gamma*np.eye(X.shape[1])))@w0 - w0
def get_classical_variance(self,X):
'''
Returns the variance term: ||S.T@S@A H_gamma^{-1}||_F^2
'''
S = self.sketch_mat
#return np.linalg.norm(np.linalg.pinv(self.H)@(X.T@(S.T@S)),ord='fro')**2
return np.linalg.norm( S.T@(S@([email protected](self.H))) ,ord='fro')**2
def get_hessian_sketch_bias(self,X,w0):
'''
Returns the bias of the Hessian sketch method for regression
'''
return np.linalg.pinv(self.H)@(X.T@(X@w0)) - w0
def get_hessian_sketch_variance(self,X):
'''
Returns the variance term: ||A H_gamma^{-1}||_F^2
'''
return np.linalg.norm([email protected](self.H),ord='fro')**2
def _sparse_projection(self,mat,sparsity=1,random_seed=10):
"""
Performs the sparse johnson lindenstrauss transform of Kane and Nelson
"""
[n,_] = mat.shape
sketch = np.zeros((self.rp_dim ,n),dtype=float)
for i in range(n):
nnz_loc = np.random.choice(self.rp_dim ,size=sparsity,replace=False)
nnz_sign = np.random.choice([-1,1],size=sparsity,replace=True)
sketch[nnz_loc,i] = nnz_sign
self.sketch_mat = sketch
return (1./np.sqrt(sparsity))*sketch@mat
def _gaussian_projection(self,mat,random_seed=10):
"""
Performs the dense gaussian random projection.
"""
[n,_] = mat.shape
np.random.seed(random_seed)
S = np.random.randn(self.rp_dim,n) / np.sqrt(self.rp_dim)
self.sketch_mat = S
return S@mat
| [
1,
396,
10413,
21144,
304,
278,
13380,
18540,
10606,
313,
3289,
29943,
29897,
1090,
697,
470,
901,
13,
29937,
17737,
3406,
19405,
8571,
4110,
29889,
29871,
2823,
278,
6058,
12107,
934,
13235,
411,
13,
29937,
445,
664,
363,
5684,
2472,
11211,
3509,
1266,
27428,
29889,
13,
29937,
450,
3339,
29943,
7794,
11259,
445,
934,
304,
887,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
13,
29937,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
13,
29937,
278,
19245,
29889,
29871,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
931,
277,
1053,
2322,
29918,
20404,
408,
12237,
13,
13,
1990,
390,
10593,
5525,
29901,
13,
268,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
19080,
29918,
6229,
29901,
524,
29892,
19080,
29918,
8513,
2433,
29903,
5510,
742,
4283,
29922,
29896,
29889,
29900,
1125,
13,
4706,
1583,
29889,
19080,
29918,
6229,
539,
353,
364,
29886,
29918,
6229,
13,
4706,
1583,
29889,
19080,
29918,
8513,
418,
353,
364,
29886,
29918,
8513,
13,
4706,
1583,
29889,
4283,
4706,
353,
330,
2735,
13,
13,
259,
13,
1678,
822,
13649,
29918,
14369,
29898,
1311,
29892,
29990,
29892,
29891,
29892,
1524,
800,
29922,
29896,
29900,
29892,
26776,
29922,
29896,
29900,
29900,
1125,
13,
4706,
14550,
13,
4706,
383,
1169,
278,
4256,
630,
364,
5525,
1904,
411,
383,
29928,
13,
4706,
14550,
13,
4706,
270,
353,
1060,
29889,
12181,
29961,
29896,
29962,
13,
4706,
281,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
29896,
511,
29881,
1853,
29922,
7411,
29897,
13,
4706,
599,
29918,
29893,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
876,
13,
4706,
1060,
21314,
353,
313,
29990,
29889,
29911,
29992,
29891,
467,
690,
14443,
6278,
29896,
29892,
29896,
29897,
13,
308,
13,
4706,
396,
383,
277,
278,
383,
29928,
13,
4706,
16698,
353,
1583,
3032,
657,
29918,
808,
3486,
29898,
29990,
29892,
26776,
29897,
13,
4706,
379,
353,
16698,
29889,
29911,
29992,
8132,
718,
313,
1311,
29889,
4283,
11877,
9302,
29889,
1032,
29872,
29898,
29881,
29897,
13,
4706,
379,
29918,
11569,
353,
7442,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
29950,
29897,
13,
4706,
363,
372,
297,
3464,
29898,
1524,
800,
1125,
13,
13,
9651,
4656,
353,
1060,
29889,
29911,
29992,
29898,
29990,
29992,
29893,
29897,
718,
1583,
29889,
4283,
29930,
29893,
448,
1060,
21314,
13,
9651,
281,
4619,
448,
379,
29918,
11569,
29992,
5105,
13,
9651,
599,
29918,
29893,
7503,
29892,
277,
29962,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
29897,
13,
4706,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
511,
599,
29918,
29893,
13,
13,
1678,
822,
13649,
29918,
20787,
29898,
1311,
29892,
29990,
29892,
29891,
29892,
1524,
800,
29922,
29896,
29900,
1125,
13,
4706,
14550,
13,
4706,
383,
1169,
278,
4256,
630,
364,
5525,
1904,
411,
383,
29928,
13,
4706,
14550,
13,
4706,
270,
353,
1060,
29889,
12181,
29961,
29896,
29962,
13,
4706,
281,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
29896,
511,
29881,
1853,
29922,
7411,
29897,
13,
4706,
599,
29918,
29893,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
876,
13,
4706,
1060,
21314,
353,
313,
29990,
29889,
29911,
29992,
29891,
467,
690,
14443,
6278,
29896,
29892,
29896,
29897,
13,
308,
13,
4706,
363,
372,
297,
3464,
29898,
1524,
800,
1125,
13,
9651,
16698,
353,
1583,
3032,
657,
29918,
808,
3486,
29898,
29990,
29892,
26776,
29922,
29896,
29900,
29900,
29930,
277,
29897,
13,
9651,
379,
353,
16698,
29889,
29911,
29992,
8132,
718,
313,
1311,
29889,
4283,
11877,
9302,
29889,
1032,
29872,
29898,
29881,
29897,
13,
9651,
379,
29918,
11569,
353,
7442,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
29950,
29897,
13,
9651,
4656,
353,
1060,
29889,
29911,
29992,
29898,
29990,
29992,
29893,
29897,
718,
1583,
29889,
4283,
29930,
29893,
448,
1060,
21314,
13,
9651,
281,
4619,
448,
379,
29918,
11569,
29992,
5105,
13,
9651,
599,
29918,
29893,
7503,
29892,
277,
29962,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
29897,
13,
4706,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
511,
599,
29918,
29893,
13,
13,
1678,
822,
903,
1056,
573,
29918,
29882,
404,
713,
29918,
5504,
29898,
1311,
29892,
21256,
287,
29918,
1272,
29892,
9649,
1125,
13,
4706,
9995,
13,
4706,
4465,
3598,
23233,
278,
298,
404,
713,
2767,
491,
6161,
1218,
278,
26368,
379,
404,
713,
29871,
13,
4706,
322,
297,
369,
1259,
29889,
13,
4706,
9995,
13,
4706,
379,
353,
21256,
287,
29918,
1272,
29889,
29911,
29992,
808,
3486,
287,
29918,
1272,
718,
313,
1311,
29889,
4283,
11877,
9302,
29889,
1032,
29872,
29898,
808,
3486,
287,
29918,
1272,
29889,
12181,
29961,
29896,
2314,
13,
4706,
379,
29918,
11569,
353,
7442,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
29950,
29897,
13,
4706,
736,
379,
29918,
11569,
29992,
2003,
13,
268,
13,
1678,
822,
903,
10660,
29918,
2929,
345,
29918,
29882,
404,
713,
29918,
5504,
29898,
1311,
29892,
21256,
287,
29918,
1272,
29892,
9649,
1125,
13,
4706,
9995,
13,
4706,
1954,
9711,
278,
298,
404,
713,
29918,
11569,
29992,
24970,
29497,
491,
773,
10180,
11059,
29889,
13,
4706,
9995,
13,
4706,
476,
353,
21256,
287,
29918,
1272,
29992,
808,
3486,
287,
29918,
1272,
29889,
29911,
847,
1583,
29889,
4283,
718,
7442,
29889,
1032,
29872,
29898,
808,
3486,
287,
29918,
1272,
29889,
12181,
29961,
29900,
2314,
13,
4706,
318,
353,
313,
29896,
29914,
1311,
29889,
4283,
11877,
2003,
448,
313,
808,
3486,
287,
29918,
1272,
29889,
29911,
847,
1583,
29889,
4283,
1068,
29906,
29897,
29992,
29898,
9302,
29889,
29880,
979,
29887,
29889,
2929,
345,
29898,
29968,
29892,
808,
3486,
287,
29918,
1272,
29992,
2003,
876,
13,
4706,
736,
318,
13,
13,
1678,
822,
13649,
29918,
20787,
29918,
9346,
292,
29898,
1311,
29892,
1060,
29892,
343,
29892,
24372,
29922,
29896,
29900,
1125,
13,
4706,
9995,
13,
4706,
383,
1169,
278,
4256,
630,
364,
5525,
1904,
411,
263,
716,
21256,
1432,
12541,
13,
4706,
9995,
13,
4706,
396,
334,
17250,
4371,
451,
5335,
287,
13,
4706,
270,
353,
1060,
29889,
12181,
29961,
29896,
29962,
13,
4706,
281,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
29896,
511,
29881,
1853,
29922,
7411,
29897,
13,
4706,
599,
29918,
29893,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
876,
13,
4706,
565,
1583,
29889,
19080,
29918,
6229,
529,
270,
29901,
13,
9651,
2767,
29918,
5696,
353,
1583,
3032,
10660,
29918,
2929,
345,
29918,
29882,
404,
713,
29918,
5504,
13,
4706,
1683,
29901,
13,
9651,
2767,
29918,
5696,
353,
1583,
3032,
1056,
573,
29918,
29882,
404,
713,
29918,
5504,
13,
13,
4706,
7540,
332,
1849,
353,
426,
13,
4706,
525,
808,
3486,
931,
29915,
584,
6213,
29892,
13,
4706,
525,
497,
29918,
3706,
29915,
259,
584,
7442,
29889,
3298,
359,
29898,
1524,
800,
29974,
29896,
29892,
29881,
1853,
29922,
7411,
511,
13,
4706,
525,
5105,
10070,
29915,
259,
584,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
511,
29881,
1853,
29922,
7411,
511,
13,
4706,
525,
786,
15190,
29915,
268,
584,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
511,
29881,
1853,
29922,
7411,
511,
13,
4706,
525,
808,
3486,
29915,
418,
584,
6213,
13,
4706,
500,
13,
4706,
18581,
2544,
3210,
29918,
15307,
353,
29871,
29900,
29889,
29900,
29871,
13,
4706,
323,
7833,
1001,
29918,
25826,
353,
12237,
580,
13,
4706,
1060,
21314,
353,
313,
29990,
29889,
29911,
29992,
29891,
467,
690,
14443,
6278,
29896,
29892,
29896,
29897,
13,
4706,
363,
372,
297,
3464,
29898,
1524,
800,
1125,
13,
9651,
396,
334,
7870,
292,
278,
21256,
16949,
13,
9651,
18581,
2544,
3210,
29918,
29911,
7833,
1001,
29918,
25826,
353,
12237,
580,
13,
9651,
16698,
353,
1583,
3032,
657,
29918,
808,
3486,
29898,
29990,
29892,
26776,
29922,
29896,
29900,
29930,
277,
29897,
13,
9651,
18581,
2544,
3210,
29918,
15307,
4619,
12237,
580,
448,
18581,
2544,
3210,
29918,
29911,
7833,
1001,
29918,
25826,
13,
632,
13,
9651,
396,
334,
512,
517,
4656,
11217,
13,
9651,
4656,
353,
1060,
29889,
29911,
29992,
29898,
29990,
29992,
29893,
29897,
718,
1583,
29889,
4283,
29930,
29893,
448,
1060,
21314,
13,
9651,
2767,
353,
2767,
29918,
5696,
29898,
8132,
29892,
4656,
29897,
13,
9651,
281,
4619,
448,
2767,
29871,
13,
9651,
599,
29918,
29893,
7503,
29892,
277,
29962,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
29897,
13,
9651,
7540,
332,
1849,
1839,
497,
29918,
3706,
2033,
29961,
277,
29974,
29896,
29962,
353,
12237,
580,
448,
323,
7833,
1001,
29918,
25826,
13,
4706,
7540,
332,
1849,
1839,
808,
3486,
931,
2033,
353,
18581,
2544,
3210,
29918,
15307,
13,
4706,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
511,
599,
29918,
29893,
29892,
7540,
332,
1849,
13,
13,
13,
1678,
822,
13649,
29918,
14369,
29918,
9346,
292,
29898,
1311,
29892,
1060,
29892,
343,
29892,
24372,
29922,
29896,
29900,
29892,
16717,
29922,
29896,
29900,
29900,
1125,
13,
4706,
9995,
13,
4706,
383,
1169,
278,
4256,
630,
364,
5525,
1904,
411,
263,
716,
21256,
1432,
12541,
13,
4706,
9995,
13,
4706,
396,
334,
17250,
4371,
451,
5335,
287,
13,
4706,
270,
353,
1060,
29889,
12181,
29961,
29896,
29962,
13,
4706,
281,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
29896,
511,
29881,
1853,
29922,
7411,
29897,
13,
4706,
599,
29918,
29893,
353,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
876,
13,
4706,
565,
1583,
29889,
19080,
29918,
6229,
529,
270,
29901,
13,
9651,
2767,
29918,
5696,
353,
1583,
3032,
10660,
29918,
2929,
345,
29918,
29882,
404,
713,
29918,
5504,
13,
4706,
1683,
29901,
13,
9651,
2767,
29918,
5696,
353,
1583,
3032,
1056,
573,
29918,
29882,
404,
713,
29918,
5504,
13,
13,
4706,
7540,
332,
1849,
353,
426,
13,
4706,
525,
808,
3486,
931,
29915,
584,
6213,
29892,
13,
4706,
525,
497,
29918,
3706,
29915,
259,
584,
7442,
29889,
3298,
359,
29898,
1524,
800,
29974,
29896,
29892,
29881,
1853,
29922,
7411,
511,
13,
4706,
525,
5105,
10070,
29915,
259,
584,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
511,
29881,
1853,
29922,
7411,
511,
13,
4706,
525,
786,
15190,
29915,
268,
584,
7442,
29889,
3298,
359,
3552,
29881,
29892,
1524,
800,
511,
29881,
1853,
29922,
7411,
511,
13,
4706,
525,
808,
3486,
29915,
418,
584,
6213,
13,
4706,
500,
13,
4706,
13,
4706,
323,
7833,
1001,
29918,
25826,
353,
12237,
580,
13,
4706,
1060,
21314,
353,
313,
29990,
29889,
29911,
29992,
29891,
467,
690,
14443,
6278,
29896,
29892,
29896,
29897,
13,
4706,
16698,
353,
1583,
3032,
657,
29918,
808,
3486,
29898,
29990,
29892,
26776,
29897,
13,
4706,
18581,
2544,
3210,
29918,
15307,
353,
12237,
580,
448,
323,
7833,
1001,
29918,
25826,
13,
4706,
363,
372,
297,
3464,
29898,
1524,
800,
1125,
13,
9651,
4656,
353,
1060,
29889,
29911,
29992,
29898,
29990,
29992,
29893,
29897,
718,
1583,
29889,
4283,
29930,
29893,
448,
1060,
21314,
13,
9651,
2767,
353,
2767,
29918,
5696,
29898,
8132,
29892,
4656,
29897,
13,
9651,
281,
4619,
448,
2767,
29871,
13,
9651,
599,
29918,
29893,
7503,
29892,
277,
29962,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
29897,
13,
9651,
7540,
332,
1849,
1839,
497,
29918,
3706,
2033,
29961,
277,
29974,
29896,
29962,
353,
12237,
580,
448,
323,
7833,
1001,
29918,
25826,
13,
4706,
7540,
332,
1849,
1839,
808,
3486,
931,
2033,
353,
18581,
2544,
3210,
29918,
15307,
13,
4706,
736,
7442,
29889,
29879,
802,
29872,
911,
29898,
29893,
511,
599,
29918,
29893,
29892,
7540,
332,
1849,
13,
13,
1678,
822,
903,
657,
29918,
808,
3486,
29898,
1311,
29892,
1272,
29892,
26776,
29922,
29896,
29900,
1125,
13,
4706,
14550,
13,
4706,
2431,
9514,
278,
21256,
8679,
373,
278,
10434,
4464,
29889,
13,
4706,
14550,
13,
4706,
565,
1583,
29889,
19080,
29918,
8513,
1275,
525,
29954,
17019,
2396,
13,
9651,
736,
1583,
3032,
29887,
17019,
29918,
771,
6929,
29898,
1272,
29892,
26776,
29897,
13,
4706,
25342,
1583,
29889,
19080,
29918,
8513,
1275,
525,
29903,
29967,
5850,
2396,
13,
9651,
736,
1583,
3032,
29879,
5510,
29918,
771,
6929,
29898,
1272,
29892,
29896,
29900,
29892,
26776,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
308,
13,
13,
13,
1678,
822,
6216,
29918,
1990,
936,
29898,
1311,
29892,
29990,
29892,
29891,
1125,
13,
4706,
14550,
13,
4706,
383,
1169,
278,
364,
5525,
17855,
1904,
373,
848,
1060,
411,
22525,
343,
13,
4706,
14550,
13,
4706,
270,
353,
1060,
29889,
12181,
29961,
29896,
29962,
13,
4706,
848,
353,
7442,
29889,
29883,
29918,
29961,
29990,
29892,
29891,
29962,
13,
4706,
396,
29903,
29918,
1272,
353,
1583,
3032,
29879,
5510,
29918,
771,
6929,
29898,
1272,
29892,
1311,
29889,
19080,
29918,
6229,
29897,
13,
4706,
396,
29903,
29918,
1272,
353,
1583,
3032,
29887,
17019,
29918,
771,
6929,
29898,
1272,
29892,
1311,
29889,
19080,
29918,
6229,
29897,
13,
4706,
317,
29918,
1272,
353,
1583,
3032,
657,
29918,
808,
3486,
29898,
1272,
29897,
13,
4706,
317,
29990,
353,
317,
29918,
1272,
7503,
29892,
13018,
29896,
29962,
13,
4706,
8713,
353,
317,
29918,
1272,
7503,
6653,
29896,
29962,
13,
4706,
379,
29918,
342,
353,
317,
29990,
29889,
29911,
29992,
29903,
29990,
718,
1583,
29889,
4283,
29930,
9302,
29889,
1032,
29872,
29898,
29881,
29897,
13,
4706,
1583,
29889,
29950,
353,
379,
29918,
342,
13,
4706,
1583,
29889,
1990,
936,
29918,
1111,
1389,
29918,
353,
7442,
29889,
29880,
979,
29887,
29889,
2929,
345,
29898,
29950,
29918,
342,
29892,
29903,
29990,
29889,
29911,
29992,
29903,
29891,
29897,
13,
308,
13,
1678,
822,
6216,
29918,
29882,
404,
713,
29918,
808,
3486,
29898,
1311,
29892,
29990,
29892,
29891,
1125,
13,
4706,
14550,
13,
4706,
383,
1169,
278,
364,
5525,
17855,
1904,
373,
848,
1060,
411,
22525,
343,
13,
4706,
14550,
13,
4706,
270,
353,
1060,
29889,
12181,
29961,
29896,
29962,
13,
4706,
396,
29903,
29990,
29871,
353,
1583,
3032,
29887,
17019,
29918,
771,
6929,
29898,
29990,
29892,
1311,
29889,
19080,
29918,
6229,
29897,
13,
4706,
396,
29903,
29990,
353,
1583,
3032,
29879,
5510,
29918,
771,
6929,
29898,
29990,
29892,
1311,
29889,
19080,
29918,
6229,
29897,
13,
4706,
317,
29990,
353,
1583,
3032,
657,
29918,
808,
3486,
29898,
29990,
29897,
13,
4706,
379,
29918,
342,
353,
317,
29990,
29889,
29911,
29992,
29903,
29990,
718,
1583,
29889,
4283,
29930,
9302,
29889,
1032,
29872,
29898,
29881,
29897,
13,
4706,
1583,
29889,
29882,
404,
713,
29918,
1111,
1389,
29918,
353,
7442,
29889,
29880,
979,
29887,
29889,
2929,
345,
29898,
29950,
29918,
342,
29892,
29990,
29889,
29911,
29992,
29891,
29897,
13,
268,
13,
1678,
822,
679,
29918,
1990,
936,
29918,
29890,
3173,
29898,
1311,
29892,
29990,
29892,
29893,
29900,
1125,
13,
4706,
14550,
13,
4706,
16969,
278,
24003,
310,
278,
12678,
13,
4706,
14550,
13,
4706,
736,
313,
1311,
29889,
4283,
11877,
9302,
29889,
29880,
979,
29887,
29889,
12324,
29898,
9302,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
1311,
29889,
29950,
29897,
29992,
29893,
29900,
29897,
13,
4706,
396,
2457,
313,
9302,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
1311,
29889,
29950,
29897,
29992,
29898,
1311,
29889,
29950,
448,
1583,
29889,
4283,
29930,
9302,
29889,
1032,
29872,
29898,
29990,
29889,
12181,
29961,
29896,
29962,
4961,
29992,
29893,
29900,
448,
281,
29900,
13,
13,
1678,
822,
679,
29918,
1990,
936,
29918,
1707,
8837,
29898,
1311,
29892,
29990,
1125,
13,
4706,
14550,
13,
4706,
16969,
278,
20162,
1840,
29901,
3830,
29903,
29889,
29911,
29992,
29903,
29992,
29909,
379,
29918,
4283,
3426,
29896,
29913,
8876,
29918,
29943,
29985,
29906,
13,
4706,
14550,
13,
4706,
317,
353,
1583,
29889,
808,
3486,
29918,
2922,
13,
4706,
396,
2457,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
9302,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
1311,
29889,
29950,
29897,
29992,
29898,
29990,
29889,
29911,
29992,
29898,
29903,
29889,
29911,
29992,
29903,
8243,
536,
2433,
29888,
307,
1495,
1068,
29906,
13,
4706,
736,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
317,
29889,
29911,
29992,
29898,
29903,
29992,
29898,
29990,
29992,
9302,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
1311,
29889,
29950,
4961,
29871,
1919,
536,
2433,
29888,
307,
1495,
1068,
29906,
13,
13,
1678,
822,
679,
29918,
29882,
404,
713,
29918,
808,
3486,
29918,
29890,
3173,
29898,
1311,
29892,
29990,
29892,
29893,
29900,
1125,
13,
4706,
14550,
13,
4706,
16969,
278,
24003,
310,
278,
379,
404,
713,
21256,
1158,
363,
17855,
13,
4706,
14550,
13,
4706,
736,
7442,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
1311,
29889,
29950,
29897,
29992,
29898,
29990,
29889,
29911,
29992,
29898,
29990,
29992,
29893,
29900,
876,
448,
281,
29900,
13,
13,
1678,
822,
679,
29918,
29882,
404,
713,
29918,
808,
3486,
29918,
1707,
8837,
29898,
1311,
29892,
29990,
1125,
13,
4706,
14550,
13,
4706,
16969,
278,
20162,
1840,
29901,
3830,
29909,
379,
29918,
4283,
3426,
29896,
29913,
8876,
29918,
29943,
29985,
29906,
13,
4706,
14550,
13,
4706,
736,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
29990,
29992,
9302,
29889,
29880,
979,
29887,
29889,
29886,
11569,
29898,
1311,
29889,
29950,
511,
536,
2433,
29888,
307,
1495,
1068,
29906,
13,
13,
1678,
822,
903,
29879,
5510,
29918,
771,
6929,
29898,
1311,
29892,
2922,
29892,
29879,
862,
29879,
537,
29922,
29896,
29892,
8172,
29918,
26776,
29922,
29896,
29900,
1125,
13,
4706,
9995,
13,
4706,
2431,
9514,
278,
29234,
432,
6547,
1100,
301,
10060,
4151,
1558,
4327,
310,
476,
1662,
322,
19135,
13,
4706,
9995,
13,
4706,
518,
29876,
29892,
29918,
29962,
353,
1775,
29889,
12181,
13,
4706,
21256,
353,
7442,
29889,
3298,
359,
3552,
1311,
29889,
19080,
29918,
6229,
1919,
29876,
511,
29881,
1853,
29922,
7411,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
29876,
1125,
13,
9651,
302,
29876,
29920,
29918,
2029,
353,
7442,
29889,
8172,
29889,
16957,
29898,
1311,
29889,
19080,
29918,
6229,
1919,
2311,
29922,
29879,
862,
29879,
537,
29892,
6506,
29922,
8824,
29897,
13,
9651,
302,
29876,
29920,
29918,
4530,
353,
7442,
29889,
8172,
29889,
16957,
4197,
29899,
29896,
29892,
29896,
1402,
2311,
29922,
29879,
862,
29879,
537,
29892,
6506,
29922,
5574,
29897,
13,
9651,
21256,
29961,
15755,
29920,
29918,
2029,
29892,
29875,
29962,
353,
302,
29876,
29920,
29918,
4530,
13,
4706,
1583,
29889,
808,
3486,
29918,
2922,
353,
21256,
13,
4706,
736,
313,
29896,
6904,
9302,
29889,
3676,
29898,
29879,
862,
29879,
537,
876,
29930,
808,
3486,
29992,
2922,
13,
13,
1678,
822,
903,
29887,
17019,
29918,
771,
6929,
29898,
1311,
29892,
2922,
29892,
8172,
29918,
26776,
29922,
29896,
29900,
1125,
13,
4706,
9995,
13,
4706,
2431,
9514,
278,
20619,
330,
17019,
4036,
18246,
29889,
13,
4706,
9995,
13,
4706,
518,
29876,
29892,
29918,
29962,
353,
1775,
29889,
12181,
13,
4706,
7442,
29889,
8172,
29889,
26776,
29898,
8172,
29918,
26776,
29897,
13,
4706,
317,
353,
7442,
29889,
8172,
29889,
9502,
29876,
29898,
1311,
29889,
19080,
29918,
6229,
29892,
29876,
29897,
847,
7442,
29889,
3676,
29898,
1311,
29889,
19080,
29918,
6229,
29897,
13,
4706,
1583,
29889,
808,
3486,
29918,
2922,
353,
317,
13,
4706,
736,
317,
29992,
2922,
13,
268,
13,
268,
13,
308,
2
] |
emoticonvis/apps/api/tests/test_serializers.py | nanchenchen/emoticon-analysis | 0 | 127553 | from django.test import TestCase
from django.utils.timezone import now, timedelta
from emoticonvis.apps.corpus import models as corpus_models
from emoticonvis.apps.corpus import utils as corpus_utils
from emoticonvis.apps.coding import models as coding_models
from emoticonvis.apps.api import serializers
from django.contrib.auth.models import User
from emoticonvis.apps.api.tests import api_time_format
class CodeSerializerTest(TestCase):
"""
"""
def test_code_definition_serialization(self):
master = User.objects.create_user(username='master')
user1 = User.objects.create_user(username='user1')
code = corpus_models.Code.objects.create(text='testcode')
dataset = corpus_models.Dataset.objects.create(name='test', description='test')
messages = [corpus_models.Message.objects.create(dataset=dataset, text='msg0'),
corpus_models.Message.objects.create(dataset=dataset, text='msg1'),
corpus_models.Message.objects.create(dataset=dataset, text='msg2')]
code_definition1 = coding_models.CodeDefinition.objects.create(code=code, source=master, text='master_def')
code_definition1.examples.add(messages[0])
code_definition1.examples.add(messages[2])
code_definition2 = coding_models.CodeDefinition.objects.create(code=code, source=user1, text='user1_def')
code_definition2.examples.add(messages[1])
code_definition2.examples.add(messages[2])
desired_result = [
{
"code": code.text,
"source": "master",
"text": "master_def",
"examples": [serializers.MessageSerializer(messages[0]).data, serializers.MessageSerializer(messages[2]).data]
},
{
"code": code.text,
"source": "user1",
"text": "user1_def",
"examples": [serializers.MessageSerializer(messages[1]).data, serializers.MessageSerializer(messages[2]).data]
}
]
code_definitions = [code.get_definition(master), code.get_definition(user1)]
serializer = serializers.CodeDefinitionSerializer(code_definitions, many=True)
try:
result = serializer.data
self.assertListEqual(result, desired_result)
except:
import pdb
pdb.set_trace()
def test_code_message_serialization(self):
master = User.objects.create_user(username='master')
code = corpus_models.Code.objects.create(text='testcode')
code2 = corpus_models.Code.objects.create(text='testcode2')
dataset = corpus_models.Dataset.objects.create(name='test', description='test')
messages = [corpus_models.Message.objects.create(dataset=dataset, text='msg0'),
corpus_models.Message.objects.create(dataset=dataset, text='msg1'),
corpus_models.Message.objects.create(dataset=dataset, text='msg2')]
code_assignment1 = coding_models.CodeAssignment.objects.create(code=code, source=master, message=messages[0])
code_assignment2 = coding_models.CodeAssignment.objects.create(code=code, source=master, message=messages[1])
code_assignment3 = coding_models.CodeAssignment.objects.create(code=code2, source=master, message=messages[1])
desired_result = [
{
"code": code.text,
"source": "master",
"messages": [serializers.MessageSerializer(messages[0]).data, serializers.MessageSerializer(messages[1]).data]
},
{
"code": code2.text,
"source": "master",
"messages": [serializers.MessageSerializer(messages[1]).data]
}
]
source = master
codes = [code.text, code2.text]
code_messages = []
for code in codes:
if corpus_models.Code.objects.filter(text=code).exists():
code_obj = corpus_models.Code.objects.get(text=code)
messages = corpus_models.Message.objects.filter(code_assignments__valid=True,
code_assignments__source=source,
code_assignments__code=code_obj).all()
code_messages.append({
"code": code,
"source": source,
"messages": messages,
})
serializer = serializers.CodeMessageSerializer(code_messages, many=True)
try:
result = serializer.data
self.assertListEqual(result, desired_result)
except:
import pdb
pdb.set_trace()
| [
1,
515,
9557,
29889,
1688,
1053,
4321,
8259,
13,
3166,
9557,
29889,
13239,
29889,
2230,
8028,
1053,
1286,
29892,
5335,
287,
2554,
13,
3166,
23023,
4144,
1730,
29889,
13371,
29889,
2616,
13364,
1053,
4733,
408,
1034,
13364,
29918,
9794,
13,
3166,
23023,
4144,
1730,
29889,
13371,
29889,
2616,
13364,
1053,
3667,
29879,
408,
1034,
13364,
29918,
13239,
13,
3166,
23023,
4144,
1730,
29889,
13371,
29889,
29883,
3689,
1053,
4733,
408,
14137,
29918,
9794,
13,
3166,
23023,
4144,
1730,
29889,
13371,
29889,
2754,
1053,
7797,
19427,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9794,
1053,
4911,
13,
13,
3166,
23023,
4144,
1730,
29889,
13371,
29889,
2754,
29889,
21150,
1053,
7882,
29918,
2230,
29918,
4830,
13,
13,
13,
1990,
5920,
17679,
3057,
29898,
3057,
8259,
1125,
13,
1678,
9995,
13,
13,
1678,
9995,
13,
13,
1678,
822,
1243,
29918,
401,
29918,
16553,
29918,
15550,
2133,
29898,
1311,
1125,
13,
4706,
5835,
353,
4911,
29889,
12650,
29889,
3258,
29918,
1792,
29898,
6786,
2433,
6207,
1495,
13,
4706,
1404,
29896,
353,
4911,
29889,
12650,
29889,
3258,
29918,
1792,
29898,
6786,
2433,
1792,
29896,
1495,
13,
4706,
775,
353,
1034,
13364,
29918,
9794,
29889,
3399,
29889,
12650,
29889,
3258,
29898,
726,
2433,
1688,
401,
1495,
13,
4706,
8783,
353,
1034,
13364,
29918,
9794,
29889,
16390,
24541,
29889,
12650,
29889,
3258,
29898,
978,
2433,
1688,
742,
6139,
2433,
1688,
1495,
13,
4706,
7191,
353,
518,
2616,
13364,
29918,
9794,
29889,
3728,
29889,
12650,
29889,
3258,
29898,
24713,
29922,
24713,
29892,
1426,
2433,
7645,
29900,
5477,
13,
462,
1678,
1034,
13364,
29918,
9794,
29889,
3728,
29889,
12650,
29889,
3258,
29898,
24713,
29922,
24713,
29892,
1426,
2433,
7645,
29896,
5477,
13,
462,
1678,
1034,
13364,
29918,
9794,
29889,
3728,
29889,
12650,
29889,
3258,
29898,
24713,
29922,
24713,
29892,
1426,
2433,
7645,
29906,
1495,
29962,
13,
13,
4706,
775,
29918,
16553,
29896,
353,
14137,
29918,
9794,
29889,
3399,
14683,
29889,
12650,
29889,
3258,
29898,
401,
29922,
401,
29892,
2752,
29922,
6207,
29892,
1426,
2433,
6207,
29918,
1753,
1495,
13,
4706,
775,
29918,
16553,
29896,
29889,
19057,
29889,
1202,
29898,
19158,
29961,
29900,
2314,
13,
4706,
775,
29918,
16553,
29896,
29889,
19057,
29889,
1202,
29898,
19158,
29961,
29906,
2314,
13,
13,
4706,
775,
29918,
16553,
29906,
353,
14137,
29918,
9794,
29889,
3399,
14683,
29889,
12650,
29889,
3258,
29898,
401,
29922,
401,
29892,
2752,
29922,
1792,
29896,
29892,
1426,
2433,
1792,
29896,
29918,
1753,
1495,
13,
4706,
775,
29918,
16553,
29906,
29889,
19057,
29889,
1202,
29898,
19158,
29961,
29896,
2314,
13,
4706,
775,
29918,
16553,
29906,
29889,
19057,
29889,
1202,
29898,
19158,
29961,
29906,
2314,
13,
13,
4706,
7429,
29918,
2914,
353,
518,
13,
9651,
426,
13,
18884,
376,
401,
1115,
775,
29889,
726,
29892,
13,
18884,
376,
4993,
1115,
376,
6207,
613,
13,
18884,
376,
726,
1115,
376,
6207,
29918,
1753,
613,
13,
18884,
376,
19057,
1115,
518,
15550,
19427,
29889,
3728,
17679,
29898,
19158,
29961,
29900,
14664,
1272,
29892,
7797,
19427,
29889,
3728,
17679,
29898,
19158,
29961,
29906,
14664,
1272,
29962,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
376,
401,
1115,
775,
29889,
726,
29892,
13,
18884,
376,
4993,
1115,
376,
1792,
29896,
613,
13,
18884,
376,
726,
1115,
376,
1792,
29896,
29918,
1753,
613,
13,
18884,
376,
19057,
1115,
518,
15550,
19427,
29889,
3728,
17679,
29898,
19158,
29961,
29896,
14664,
1272,
29892,
7797,
19427,
29889,
3728,
17679,
29898,
19158,
29961,
29906,
14664,
1272,
29962,
13,
9651,
500,
13,
4706,
4514,
13,
13,
4706,
775,
29918,
25476,
2187,
353,
518,
401,
29889,
657,
29918,
16553,
29898,
6207,
511,
775,
29889,
657,
29918,
16553,
29898,
1792,
29896,
4638,
13,
13,
4706,
7797,
3950,
353,
7797,
19427,
29889,
3399,
14683,
17679,
29898,
401,
29918,
25476,
2187,
29892,
1784,
29922,
5574,
29897,
13,
4706,
1018,
29901,
13,
9651,
1121,
353,
7797,
3950,
29889,
1272,
13,
9651,
1583,
29889,
9294,
1293,
9843,
29898,
2914,
29892,
7429,
29918,
2914,
29897,
13,
4706,
5174,
29901,
13,
9651,
1053,
282,
2585,
13,
9651,
282,
2585,
29889,
842,
29918,
15003,
580,
13,
13,
13,
1678,
822,
1243,
29918,
401,
29918,
4906,
29918,
15550,
2133,
29898,
1311,
1125,
13,
4706,
5835,
353,
4911,
29889,
12650,
29889,
3258,
29918,
1792,
29898,
6786,
2433,
6207,
1495,
13,
4706,
775,
353,
1034,
13364,
29918,
9794,
29889,
3399,
29889,
12650,
29889,
3258,
29898,
726,
2433,
1688,
401,
1495,
13,
4706,
775,
29906,
353,
1034,
13364,
29918,
9794,
29889,
3399,
29889,
12650,
29889,
3258,
29898,
726,
2433,
1688,
401,
29906,
1495,
13,
4706,
8783,
353,
1034,
13364,
29918,
9794,
29889,
16390,
24541,
29889,
12650,
29889,
3258,
29898,
978,
2433,
1688,
742,
6139,
2433,
1688,
1495,
13,
4706,
7191,
353,
518,
2616,
13364,
29918,
9794,
29889,
3728,
29889,
12650,
29889,
3258,
29898,
24713,
29922,
24713,
29892,
1426,
2433,
7645,
29900,
5477,
13,
462,
1678,
1034,
13364,
29918,
9794,
29889,
3728,
29889,
12650,
29889,
3258,
29898,
24713,
29922,
24713,
29892,
1426,
2433,
7645,
29896,
5477,
13,
462,
1678,
1034,
13364,
29918,
9794,
29889,
3728,
29889,
12650,
29889,
3258,
29898,
24713,
29922,
24713,
29892,
1426,
2433,
7645,
29906,
1495,
29962,
13,
13,
4706,
775,
29918,
465,
10194,
29896,
353,
14137,
29918,
9794,
29889,
3399,
7900,
10194,
29889,
12650,
29889,
3258,
29898,
401,
29922,
401,
29892,
2752,
29922,
6207,
29892,
2643,
29922,
19158,
29961,
29900,
2314,
13,
4706,
775,
29918,
465,
10194,
29906,
353,
14137,
29918,
9794,
29889,
3399,
7900,
10194,
29889,
12650,
29889,
3258,
29898,
401,
29922,
401,
29892,
2752,
29922,
6207,
29892,
2643,
29922,
19158,
29961,
29896,
2314,
13,
4706,
775,
29918,
465,
10194,
29941,
353,
14137,
29918,
9794,
29889,
3399,
7900,
10194,
29889,
12650,
29889,
3258,
29898,
401,
29922,
401,
29906,
29892,
2752,
29922,
6207,
29892,
2643,
29922,
19158,
29961,
29896,
2314,
13,
13,
13,
13,
4706,
7429,
29918,
2914,
353,
518,
13,
9651,
426,
13,
18884,
376,
401,
1115,
775,
29889,
726,
29892,
13,
18884,
376,
4993,
1115,
376,
6207,
613,
13,
18884,
376,
19158,
1115,
518,
15550,
19427,
29889,
3728,
17679,
29898,
19158,
29961,
29900,
14664,
1272,
29892,
7797,
19427,
29889,
3728,
17679,
29898,
19158,
29961,
29896,
14664,
1272,
29962,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
376,
401,
1115,
775,
29906,
29889,
726,
29892,
13,
18884,
376,
4993,
1115,
376,
6207,
613,
13,
18884,
376,
19158,
1115,
518,
15550,
19427,
29889,
3728,
17679,
29898,
19158,
29961,
29896,
14664,
1272,
29962,
13,
9651,
500,
13,
4706,
4514,
13,
13,
4706,
2752,
353,
5835,
13,
4706,
11561,
353,
518,
401,
29889,
726,
29892,
775,
29906,
29889,
726,
29962,
13,
4706,
775,
29918,
19158,
353,
5159,
13,
4706,
363,
775,
297,
11561,
29901,
13,
9651,
565,
1034,
13364,
29918,
9794,
29889,
3399,
29889,
12650,
29889,
4572,
29898,
726,
29922,
401,
467,
9933,
7295,
13,
18884,
775,
29918,
5415,
353,
1034,
13364,
29918,
9794,
29889,
3399,
29889,
12650,
29889,
657,
29898,
726,
29922,
401,
29897,
13,
18884,
7191,
353,
1034,
13364,
29918,
9794,
29889,
3728,
29889,
12650,
29889,
4572,
29898,
401,
29918,
16645,
1860,
1649,
3084,
29922,
5574,
29892,
13,
462,
462,
462,
18884,
775,
29918,
16645,
1860,
1649,
4993,
29922,
4993,
29892,
13,
462,
462,
462,
18884,
775,
29918,
16645,
1860,
1649,
401,
29922,
401,
29918,
5415,
467,
497,
580,
13,
18884,
775,
29918,
19158,
29889,
4397,
3319,
13,
462,
1678,
376,
401,
1115,
775,
29892,
13,
462,
1678,
376,
4993,
1115,
2752,
29892,
13,
462,
1678,
376,
19158,
1115,
7191,
29892,
13,
18884,
5615,
13,
13,
4706,
7797,
3950,
353,
7797,
19427,
29889,
3399,
3728,
17679,
29898,
401,
29918,
19158,
29892,
1784,
29922,
5574,
29897,
13,
4706,
1018,
29901,
13,
9651,
1121,
353,
7797,
3950,
29889,
1272,
13,
9651,
1583,
29889,
9294,
1293,
9843,
29898,
2914,
29892,
7429,
29918,
2914,
29897,
13,
4706,
5174,
29901,
13,
9651,
1053,
282,
2585,
13,
9651,
282,
2585,
29889,
842,
29918,
15003,
580,
13,
2
] |
migrations/versions/1fba1a39c681_initial_data.py | eubr-bigsea/thorn | 0 | 114245 | <filename>migrations/versions/1fba1a39c681_initial_data.py
"""initial data
Revision ID: <KEY>
Revises: <PASSWORD>
Create Date: 2020-03-02 09:28:48.614317
"""
import datetime
import bcrypt
from alembic import context
from alembic import op
from sqlalchemy import String, Integer, DateTime
from sqlalchemy.orm import sessionmaker
from sqlalchemy.sql import table, column
from thorn.migration_utils import is_mysql
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '2f93dbc61a5d'
branch_labels = None
depends_on = None
def _insert_permissions():
tb = table(
'permission',
column('id', Integer),
column('name', String),
column('applicable_to', String),
column('enabled', String),
)
columns = [c.name for c in tb.columns]
data = [
(1, 'WORKFLOW_VIEW_ANY', 'WORKFLOW', True),
(2, 'WORKFLOW_EDIT_ANY', 'WORKFLOW', True),
(3, 'WORKFLOW_EXECUTE_ANY', 'WORKFLOW', True),
(4, 'WORKFLOW_VIEW', 'WORKFLOW', True),
(5, 'WORKFLOW_EDIT', 'WORKFLOW', True),
(6, 'WORKFLOW_EXECUTE', 'WORKFLOW', True),
(7, 'DATA_SOURCE_VIEW_ANY', 'DATA_SOURCE', True),
(8, 'DATA_SOURCE_EDIT_ANY', 'DATA_SOURCE', True),
(9, 'DATA_SOURCE_USE_ANY', 'DATA_SOURCE', True),
(10, 'DATA_SOURCE_VIEW', 'DATA_SOURCE', True),
(11, 'DATA_SOURCE_EDIT', 'DATA_SOURCE', True),
(12, 'DATA_SOURCE_USE', 'DATA_SOURCE', True),
(13, 'DASHBOARD_VIEW_ANY', 'DASHBOARD', True),
(14, 'DASHBOARD_EDIT_ANY', 'DASHBOARD', True),
(15, 'DASHBOARD_VIEW', 'DASHBOARD', True),
(16, 'DASHBOARD_EDIT', 'DASHBOARD', True),
(100, 'USER_MANAGE', 'USER', True),
(101, 'STORAGE_MANAGE', 'SYSTEM', True),
(102, 'CLUSTER_MANAGE', 'SYSTEM', True),
(1000, 'ADMINISTRATOR', 'SYSTEM', True),
]
rows = [dict(list(zip(columns, row))) for row in data]
op.bulk_insert(tb, rows)
def _insert_permission_translations():
tb = table(
'permission_translation',
column('id', Integer),
column('locale', String),
column('description', String)
)
columns = [c.name for c in tb.columns]
data = [
(1, 'pt', 'Visualizar qualquer fluxo de trabalho'),
(1, 'en', 'View any workflow'),
(2, 'pt', 'Editar qualquer fluxo de trabalho'),
(2, 'en', 'Edit any workflow'),
(3, 'pt', 'Executar qualquer fluxo de trabalho'),
(3, 'en', 'Execute any workflow'),
(4, 'pt', 'Visualizar fluxo de trabalho'),
(4, 'en', 'View workflow'),
(5, 'pt', 'Editar fluxo de trabalho'),
(5, 'en', 'Edit workflow'),
(6, 'pt', 'Executar fluxo de trabalho'),
(6, 'en', 'Execute workflow'),
(7, 'pt', 'Visualizar qualquer fonte de dados'),
(7, 'en', 'View any data source'),
(8, 'pt', 'Editar qualquer fonte de dados'),
(8, 'en', 'Edit any data source'),
(9, 'pt', 'Usar qualquer fonte de dados'),
(9, 'en', 'Use any data source'),
(10, 'pt', 'Visualizar fonte de dados'),
(10, 'en', 'View data source'),
(11, 'pt', 'Editar fonte de dados'),
(11, 'en', 'Edit data source'),
(12, 'pt', 'Usar fonte de dados'),
(12, 'en', 'Use data source'),
(13, 'pt', 'Visualizar qualquer dashboard'),
(13, 'en', 'View any dashboard'),
(14, 'pt', 'Editar qualquer dashboard'),
(14, 'en', 'Edit any dashboard'),
(15, 'pt', 'Visualizar dashboard'),
(15, 'en', 'View dashboard'),
(16, 'pt', 'Editar dashboard'),
(16, 'en', 'Edit dashboard'),
(100, 'pt', 'Gerenciar usuários'),
(100, 'en', 'Manage users'),
(101, 'pt', 'Gerenciar armazenamentos'),
(101, 'en', 'Manage stores'),
(102, 'pt', 'Gerenciar clusters'),
(102, 'en', 'Manage clusters'),
(1000, 'en', 'Administrator'),
(1000, 'pt', 'Administrador'),
]
rows = [dict(list(zip(columns, row))) for row in data]
op.bulk_insert(tb, rows)
def _insert_admin():
tb = table(
'user',
column('id', Integer),
column('login', String),
column('email', String),
column('encrypted_password', String),
column('created_at', DateTime),
column('first_name', String),
column('last_name', String),
column('locale', String),
column('enabled', Integer),
column('authentication_type', String)
)
columns = [c.name for c in tb.columns]
hashed = bcrypt.hashpw('admin'.encode('utf8'),
bcrypt.gensalt(12)).decode('utf8')
data = [
(1, '<EMAIL>', '<EMAIL>',
hashed, datetime.datetime.now(), 'Admin', '', 'pt', True, 'INTERNAL'),
]
rows = [dict(list(zip(columns, row))) for row in data]
op.bulk_insert(tb, rows)
def _insert_roles():
tb = table(
'role',
column('id', Integer),
column('name', String),
column('all_user', Integer),
column('enabled', Integer),
)
columns = [c.name for c in tb.columns]
data = [
(1, 'admin', False, True),
(100, 'public', True, True),
]
rows = [dict(list(zip(columns, row))) for row in data]
op.bulk_insert(tb, rows)
def _insert_role_translations():
tb = table(
'role_translation',
column('id', Integer),
column('locale', String),
column('description', String)
)
columns = [c.name for c in tb.columns]
data = [
(1, 'pt', 'Administrador'),
(1, 'en', 'Administrator'),
(100, 'pt', 'Público'),
(100, 'en', 'Public'),
]
rows = [dict(list(zip(columns, row))) for row in data]
op.bulk_insert(tb, rows)
def _insert_user_roles():
tb = table(
'user_role',
column('user_id', Integer),
column('role_id', Integer),
)
columns = [c.name for c in tb.columns]
data = [
(1, 1),
]
rows = [dict(list(zip(columns, row))) for row in data]
op.bulk_insert(tb, rows)
def _insert_role_permission():
tb = table(
'role_permission',
column('role_id', Integer),
column('permission_id', Integer),
)
columns = [c.name for c in tb.columns]
data = [
(1, 1000),
]
rows = [dict(list(zip(columns, row))) for row in data]
op.bulk_insert(tb, rows)
def get_commands():
user_table = 'user' if is_mysql() else '"user"'
all_commands = [
(_insert_permissions, 'DELETE FROM permission WHERE id BETWEEN 1 AND 16 OR '
'id BETWEEN 100 AND 102 OR id BETWEEN 1000 AND 1000'),
(_insert_permission_translations,
'DELETE FROM permission_translation WHERE id BETWEEN 1 AND 16 OR '
'id BETWEEN 100 AND 102 OR id BETWEEN 1000 AND 1000'),
(_insert_admin, f'DELETE FROM {user_table} WHERE id BETWEEN 1 AND 1 '),
(_insert_roles, 'DELETE FROM role WHERE id BETWEEN 1 AND 1 OR id '
'BETWEEN 100 AND 100'),
(_insert_role_translations,
'DELETE FROM role_translation WHERE id BETWEEN 1 AND 1 OR id '
'BETWEEN 100 AND 100'),
(_insert_user_roles, 'DELETE FROM user_role WHERE user_id BETWEEN 1 AND 1'),
(_insert_role_permission, 'DELETE FROM role_permission WHERE role_id = 1 '
'AND permission_id = 1000')
]
return all_commands
def upgrade():
ctx = context.get_context()
session = sessionmaker(bind=ctx.bind)()
connection = session.connection()
all_commands = get_commands()
try:
for cmd in all_commands:
if isinstance(cmd[0], str):
connection.execute(cmd[0])
elif isinstance(cmd[0], list):
for row in cmd[0]:
connection.execute(row)
else:
cmd[0]()
except:
session.rollback()
raise
session.commit()
def downgrade():
ctx = context.get_context()
session = sessionmaker(bind=ctx.bind)()
connection = session.connection()
all_commands = get_commands()
try:
for cmd in reversed(all_commands):
if isinstance(cmd[1], str):
connection.execute(cmd[1])
elif isinstance(cmd[1], list):
for row in cmd[1]:
connection.execute(row)
else:
cmd[1]()
except:
session.rollback()
raise
session.commit()
| [
1,
529,
9507,
29958,
26983,
800,
29914,
26100,
29914,
29896,
29888,
2291,
29896,
29874,
29941,
29929,
29883,
29953,
29947,
29896,
29918,
11228,
29918,
1272,
29889,
2272,
13,
15945,
29908,
11228,
848,
13,
13,
1123,
4924,
3553,
29901,
529,
10818,
29958,
13,
1123,
1730,
267,
29901,
529,
25711,
17013,
29958,
13,
4391,
4712,
29901,
29871,
29906,
29900,
29906,
29900,
29899,
29900,
29941,
29899,
29900,
29906,
29871,
29900,
29929,
29901,
29906,
29947,
29901,
29946,
29947,
29889,
29953,
29896,
29946,
29941,
29896,
29955,
13,
13,
15945,
29908,
13,
5215,
12865,
13,
13,
5215,
289,
29883,
4641,
13,
3166,
20712,
29890,
293,
1053,
3030,
13,
3166,
20712,
29890,
293,
1053,
1015,
13,
3166,
4576,
284,
305,
6764,
1053,
1714,
29892,
8102,
29892,
12315,
13,
3166,
4576,
284,
305,
6764,
29889,
555,
1053,
4867,
28107,
13,
3166,
4576,
284,
305,
6764,
29889,
2850,
1053,
1591,
29892,
1897,
13,
3166,
266,
1398,
29889,
29885,
16783,
29918,
13239,
1053,
338,
29918,
7938,
13,
13,
29937,
26554,
2893,
14903,
29892,
1304,
491,
319,
2409,
29890,
293,
29889,
13,
276,
4924,
353,
12801,
10818,
16299,
13,
3204,
29918,
276,
4924,
353,
525,
29906,
29888,
29929,
29941,
11140,
29953,
29896,
29874,
29945,
29881,
29915,
13,
17519,
29918,
21134,
353,
6213,
13,
2716,
1975,
29918,
265,
353,
6213,
13,
13,
13,
1753,
903,
7851,
29918,
17858,
6847,
7295,
13,
1678,
260,
29890,
353,
1591,
29898,
13,
4706,
525,
16074,
742,
13,
4706,
1897,
877,
333,
742,
8102,
511,
13,
4706,
1897,
877,
978,
742,
1714,
511,
13,
4706,
1897,
877,
932,
506,
519,
29918,
517,
742,
1714,
511,
13,
4706,
1897,
877,
17590,
742,
1714,
511,
13,
1678,
1723,
13,
13,
1678,
4341,
353,
518,
29883,
29889,
978,
363,
274,
297,
260,
29890,
29889,
13099,
29962,
13,
1678,
848,
353,
518,
13,
4706,
313,
29896,
29892,
525,
11686,
29968,
29943,
27998,
29918,
29963,
8673,
29956,
29918,
2190,
29979,
742,
525,
11686,
29968,
29943,
27998,
742,
5852,
511,
13,
4706,
313,
29906,
29892,
525,
11686,
29968,
29943,
27998,
29918,
12378,
29918,
2190,
29979,
742,
525,
11686,
29968,
29943,
27998,
742,
5852,
511,
13,
4706,
313,
29941,
29892,
525,
11686,
29968,
29943,
27998,
29918,
5746,
11206,
26027,
29918,
2190,
29979,
742,
525,
11686,
29968,
29943,
27998,
742,
5852,
511,
13,
4706,
313,
29946,
29892,
525,
11686,
29968,
29943,
27998,
29918,
29963,
8673,
29956,
742,
525,
11686,
29968,
29943,
27998,
742,
5852,
511,
13,
4706,
313,
29945,
29892,
525,
11686,
29968,
29943,
27998,
29918,
12378,
742,
525,
11686,
29968,
29943,
27998,
742,
5852,
511,
13,
4706,
313,
29953,
29892,
525,
11686,
29968,
29943,
27998,
29918,
5746,
11206,
26027,
742,
525,
11686,
29968,
29943,
27998,
742,
5852,
511,
13,
13,
4706,
313,
29955,
29892,
525,
14573,
29918,
27839,
4741,
29918,
29963,
8673,
29956,
29918,
2190,
29979,
742,
525,
14573,
29918,
27839,
4741,
742,
5852,
511,
13,
4706,
313,
29947,
29892,
525,
14573,
29918,
27839,
4741,
29918,
12378,
29918,
2190,
29979,
742,
525,
14573,
29918,
27839,
4741,
742,
5852,
511,
13,
4706,
313,
29929,
29892,
525,
14573,
29918,
27839,
4741,
29918,
17171,
29918,
2190,
29979,
742,
525,
14573,
29918,
27839,
4741,
742,
5852,
511,
13,
4706,
313,
29896,
29900,
29892,
525,
14573,
29918,
27839,
4741,
29918,
29963,
8673,
29956,
742,
525,
14573,
29918,
27839,
4741,
742,
5852,
511,
13,
4706,
313,
29896,
29896,
29892,
525,
14573,
29918,
27839,
4741,
29918,
12378,
742,
525,
14573,
29918,
27839,
4741,
742,
5852,
511,
13,
4706,
313,
29896,
29906,
29892,
525,
14573,
29918,
27839,
4741,
29918,
17171,
742,
525,
14573,
29918,
27839,
4741,
742,
5852,
511,
13,
13,
4706,
313,
29896,
29941,
29892,
525,
29928,
24943,
8456,
17011,
29918,
29963,
8673,
29956,
29918,
2190,
29979,
742,
525,
29928,
24943,
8456,
17011,
742,
5852,
511,
13,
4706,
313,
29896,
29946,
29892,
525,
29928,
24943,
8456,
17011,
29918,
12378,
29918,
2190,
29979,
742,
525,
29928,
24943,
8456,
17011,
742,
5852,
511,
13,
4706,
313,
29896,
29945,
29892,
525,
29928,
24943,
8456,
17011,
29918,
29963,
8673,
29956,
742,
525,
29928,
24943,
8456,
17011,
742,
5852,
511,
13,
4706,
313,
29896,
29953,
29892,
525,
29928,
24943,
8456,
17011,
29918,
12378,
742,
525,
29928,
24943,
8456,
17011,
742,
5852,
511,
13,
13,
4706,
313,
29896,
29900,
29900,
29892,
525,
11889,
29918,
1529,
3521,
1692,
742,
525,
11889,
742,
5852,
511,
13,
4706,
313,
29896,
29900,
29896,
29892,
525,
1254,
1955,
10461,
29918,
1529,
3521,
1692,
742,
525,
14816,
1254,
12665,
742,
5852,
511,
13,
4706,
313,
29896,
29900,
29906,
29892,
525,
6154,
17321,
1001,
29918,
1529,
3521,
1692,
742,
525,
14816,
1254,
12665,
742,
5852,
511,
13,
13,
4706,
313,
29896,
29900,
29900,
29900,
29892,
525,
3035,
16173,
9047,
29934,
1299,
1955,
742,
525,
14816,
1254,
12665,
742,
5852,
511,
13,
13,
1678,
4514,
13,
1678,
4206,
353,
518,
8977,
29898,
1761,
29898,
7554,
29898,
13099,
29892,
1948,
4961,
363,
1948,
297,
848,
29962,
13,
1678,
1015,
29889,
8645,
29895,
29918,
7851,
29898,
22625,
29892,
4206,
29897,
13,
13,
13,
1753,
903,
7851,
29918,
16074,
29918,
3286,
29880,
800,
7295,
13,
1678,
260,
29890,
353,
1591,
29898,
13,
4706,
525,
16074,
29918,
3286,
18411,
742,
13,
4706,
1897,
877,
333,
742,
8102,
511,
13,
4706,
1897,
877,
23337,
742,
1714,
511,
13,
4706,
1897,
877,
8216,
742,
1714,
29897,
13,
1678,
1723,
13,
13,
1678,
4341,
353,
518,
29883,
29889,
978,
363,
274,
297,
260,
29890,
29889,
13099,
29962,
13,
1678,
848,
353,
518,
13,
4706,
313,
29896,
29892,
525,
415,
742,
525,
16227,
15356,
4021,
7808,
19389,
29877,
316,
19739,
1251,
5477,
13,
4706,
313,
29896,
29892,
525,
264,
742,
525,
1043,
738,
27321,
5477,
13,
4706,
313,
29906,
29892,
525,
415,
742,
525,
3853,
3673,
4021,
7808,
19389,
29877,
316,
19739,
1251,
5477,
13,
4706,
313,
29906,
29892,
525,
264,
742,
525,
6103,
738,
27321,
5477,
13,
4706,
313,
29941,
29892,
525,
415,
742,
525,
5379,
329,
279,
4021,
7808,
19389,
29877,
316,
19739,
1251,
5477,
13,
4706,
313,
29941,
29892,
525,
264,
742,
525,
12296,
738,
27321,
5477,
13,
4706,
313,
29946,
29892,
525,
415,
742,
525,
16227,
15356,
19389,
29877,
316,
19739,
1251,
5477,
13,
4706,
313,
29946,
29892,
525,
264,
742,
525,
1043,
27321,
5477,
13,
4706,
313,
29945,
29892,
525,
415,
742,
525,
3853,
3673,
19389,
29877,
316,
19739,
1251,
5477,
13,
4706,
313,
29945,
29892,
525,
264,
742,
525,
6103,
27321,
5477,
13,
4706,
313,
29953,
29892,
525,
415,
742,
525,
5379,
329,
279,
19389,
29877,
316,
19739,
1251,
5477,
13,
4706,
313,
29953,
29892,
525,
264,
742,
525,
12296,
27321,
5477,
13,
13,
4706,
313,
29955,
29892,
525,
415,
742,
525,
16227,
15356,
4021,
7808,
285,
9568,
316,
270,
2255,
5477,
13,
4706,
313,
29955,
29892,
525,
264,
742,
525,
1043,
738,
848,
2752,
5477,
13,
4706,
313,
29947,
29892,
525,
415,
742,
525,
3853,
3673,
4021,
7808,
285,
9568,
316,
270,
2255,
5477,
13,
4706,
313,
29947,
29892,
525,
264,
742,
525,
6103,
738,
848,
2752,
5477,
13,
4706,
313,
29929,
29892,
525,
415,
742,
525,
15922,
279,
4021,
7808,
285,
9568,
316,
270,
2255,
5477,
13,
4706,
313,
29929,
29892,
525,
264,
742,
525,
11403,
738,
848,
2752,
5477,
13,
4706,
313,
29896,
29900,
29892,
525,
415,
742,
525,
16227,
15356,
285,
9568,
316,
270,
2255,
5477,
13,
4706,
313,
29896,
29900,
29892,
525,
264,
742,
525,
1043,
848,
2752,
5477,
13,
4706,
313,
29896,
29896,
29892,
525,
415,
742,
525,
3853,
3673,
285,
9568,
316,
270,
2255,
5477,
13,
4706,
313,
29896,
29896,
29892,
525,
264,
742,
525,
6103,
848,
2752,
5477,
13,
4706,
313,
29896,
29906,
29892,
525,
415,
742,
525,
15922,
279,
285,
9568,
316,
270,
2255,
5477,
13,
4706,
313,
29896,
29906,
29892,
525,
264,
742,
525,
11403,
848,
2752,
5477,
13,
13,
4706,
313,
29896,
29941,
29892,
525,
415,
742,
525,
16227,
15356,
4021,
7808,
12569,
3377,
5477,
13,
4706,
313,
29896,
29941,
29892,
525,
264,
742,
525,
1043,
738,
12569,
3377,
5477,
13,
4706,
313,
29896,
29946,
29892,
525,
415,
742,
525,
3853,
3673,
4021,
7808,
12569,
3377,
5477,
13,
4706,
313,
29896,
29946,
29892,
525,
264,
742,
525,
6103,
738,
12569,
3377,
5477,
13,
4706,
313,
29896,
29945,
29892,
525,
415,
742,
525,
16227,
15356,
12569,
3377,
5477,
13,
4706,
313,
29896,
29945,
29892,
525,
264,
742,
525,
1043,
12569,
3377,
5477,
13,
4706,
313,
29896,
29953,
29892,
525,
415,
742,
525,
3853,
3673,
12569,
3377,
5477,
13,
4706,
313,
29896,
29953,
29892,
525,
264,
742,
525,
6103,
12569,
3377,
5477,
13,
13,
4706,
313,
29896,
29900,
29900,
29892,
525,
415,
742,
525,
29954,
4578,
455,
279,
502,
29884,
26047,
5477,
13,
4706,
313,
29896,
29900,
29900,
29892,
525,
264,
742,
525,
2517,
482,
4160,
5477,
13,
4706,
313,
29896,
29900,
29896,
29892,
525,
415,
742,
525,
29954,
4578,
455,
279,
564,
655,
2256,
26376,
5477,
13,
4706,
313,
29896,
29900,
29896,
29892,
525,
264,
742,
525,
2517,
482,
14422,
5477,
13,
4706,
313,
29896,
29900,
29906,
29892,
525,
415,
742,
525,
29954,
4578,
455,
279,
24554,
5477,
13,
4706,
313,
29896,
29900,
29906,
29892,
525,
264,
742,
525,
2517,
482,
24554,
5477,
13,
13,
4706,
313,
29896,
29900,
29900,
29900,
29892,
525,
264,
742,
525,
12754,
2132,
1061,
5477,
13,
4706,
313,
29896,
29900,
29900,
29900,
29892,
525,
415,
742,
525,
12754,
2132,
3136,
5477,
13,
13,
1678,
4514,
13,
1678,
4206,
353,
518,
8977,
29898,
1761,
29898,
7554,
29898,
13099,
29892,
1948,
4961,
363,
1948,
297,
848,
29962,
13,
1678,
1015,
29889,
8645,
29895,
29918,
7851,
29898,
22625,
29892,
4206,
29897,
13,
13,
13,
1753,
903,
7851,
29918,
6406,
7295,
13,
1678,
260,
29890,
353,
1591,
29898,
13,
4706,
525,
1792,
742,
13,
4706,
1897,
877,
333,
742,
8102,
511,
13,
4706,
1897,
877,
7507,
742,
1714,
511,
13,
4706,
1897,
877,
5269,
742,
1714,
511,
13,
4706,
1897,
877,
3977,
14740,
29918,
5630,
742,
1714,
511,
13,
4706,
1897,
877,
11600,
29918,
271,
742,
12315,
511,
13,
4706,
1897,
877,
4102,
29918,
978,
742,
1714,
511,
13,
4706,
1897,
877,
4230,
29918,
978,
742,
1714,
511,
13,
4706,
1897,
877,
23337,
742,
1714,
511,
13,
4706,
1897,
877,
17590,
742,
8102,
511,
13,
4706,
1897,
877,
23055,
29918,
1853,
742,
1714,
29897,
13,
1678,
1723,
13,
13,
1678,
4341,
353,
518,
29883,
29889,
978,
363,
274,
297,
260,
29890,
29889,
13099,
29962,
13,
1678,
6608,
287,
353,
289,
29883,
4641,
29889,
8568,
29886,
29893,
877,
6406,
4286,
12508,
877,
9420,
29947,
5477,
13,
462,
965,
289,
29883,
4641,
29889,
17397,
1997,
29898,
29896,
29906,
8106,
13808,
877,
9420,
29947,
1495,
13,
1678,
848,
353,
518,
13,
4706,
313,
29896,
29892,
12801,
26862,
6227,
29958,
742,
12801,
26862,
6227,
29958,
742,
13,
308,
6608,
287,
29892,
12865,
29889,
12673,
29889,
3707,
3285,
525,
12754,
742,
15516,
525,
415,
742,
5852,
29892,
525,
23845,
29940,
1964,
5477,
13,
1678,
4514,
13,
1678,
4206,
353,
518,
8977,
29898,
1761,
29898,
7554,
29898,
13099,
29892,
1948,
4961,
363,
1948,
297,
848,
29962,
13,
1678,
1015,
29889,
8645,
29895,
29918,
7851,
29898,
22625,
29892,
4206,
29897,
13,
13,
13,
1753,
903,
7851,
29918,
307,
793,
7295,
13,
1678,
260,
29890,
353,
1591,
29898,
13,
4706,
525,
12154,
742,
13,
4706,
1897,
877,
333,
742,
8102,
511,
13,
4706,
1897,
877,
978,
742,
1714,
511,
13,
4706,
1897,
877,
497,
29918,
1792,
742,
8102,
511,
13,
4706,
1897,
877,
17590,
742,
8102,
511,
13,
1678,
1723,
13,
1678,
4341,
353,
518,
29883,
29889,
978,
363,
274,
297,
260,
29890,
29889,
13099,
29962,
13,
1678,
848,
353,
518,
13,
4706,
313,
29896,
29892,
525,
6406,
742,
7700,
29892,
5852,
511,
13,
4706,
313,
29896,
29900,
29900,
29892,
525,
3597,
742,
5852,
29892,
5852,
511,
13,
1678,
4514,
13,
1678,
4206,
353,
518,
8977,
29898,
1761,
29898,
7554,
29898,
13099,
29892,
1948,
4961,
363,
1948,
297,
848,
29962,
13,
1678,
1015,
29889,
8645,
29895,
29918,
7851,
29898,
22625,
29892,
4206,
29897,
13,
13,
13,
1753,
903,
7851,
29918,
12154,
29918,
3286,
29880,
800,
7295,
13,
1678,
260,
29890,
353,
1591,
29898,
13,
4706,
525,
12154,
29918,
3286,
18411,
742,
13,
4706,
1897,
877,
333,
742,
8102,
511,
13,
4706,
1897,
877,
23337,
742,
1714,
511,
13,
4706,
1897,
877,
8216,
742,
1714,
29897,
13,
1678,
1723,
13,
1678,
4341,
353,
518,
29883,
29889,
978,
363,
274,
297,
260,
29890,
29889,
13099,
29962,
13,
1678,
848,
353,
518,
13,
4706,
313,
29896,
29892,
525,
415,
742,
525,
12754,
2132,
3136,
5477,
13,
4706,
313,
29896,
29892,
525,
264,
742,
525,
12754,
2132,
1061,
5477,
13,
4706,
313,
29896,
29900,
29900,
29892,
525,
415,
742,
525,
29925,
7627,
29877,
5477,
13,
4706,
313,
29896,
29900,
29900,
29892,
525,
264,
742,
525,
19858,
5477,
13,
1678,
4514,
13,
1678,
4206,
353,
518,
8977,
29898,
1761,
29898,
7554,
29898,
13099,
29892,
1948,
4961,
363,
1948,
297,
848,
29962,
13,
1678,
1015,
29889,
8645,
29895,
29918,
7851,
29898,
22625,
29892,
4206,
29897,
13,
13,
13,
1753,
903,
7851,
29918,
1792,
29918,
307,
793,
7295,
13,
1678,
260,
29890,
353,
1591,
29898,
13,
4706,
525,
1792,
29918,
12154,
742,
13,
4706,
1897,
877,
1792,
29918,
333,
742,
8102,
511,
13,
4706,
1897,
877,
12154,
29918,
333,
742,
8102,
511,
13,
1678,
1723,
13,
1678,
4341,
353,
518,
29883,
29889,
978,
363,
274,
297,
260,
29890,
29889,
13099,
29962,
13,
1678,
848,
353,
518,
13,
4706,
313,
29896,
29892,
29871,
29896,
511,
13,
1678,
4514,
13,
1678,
4206,
353,
518,
8977,
29898,
1761,
29898,
7554,
29898,
13099,
29892,
1948,
4961,
363,
1948,
297,
848,
29962,
13,
1678,
1015,
29889,
8645,
29895,
29918,
7851,
29898,
22625,
29892,
4206,
29897,
13,
13,
13,
1753,
903,
7851,
29918,
12154,
29918,
16074,
7295,
13,
1678,
260,
29890,
353,
1591,
29898,
13,
4706,
525,
12154,
29918,
16074,
742,
13,
4706,
1897,
877,
12154,
29918,
333,
742,
8102,
511,
13,
4706,
1897,
877,
16074,
29918,
333,
742,
8102,
511,
13,
1678,
1723,
13,
1678,
4341,
353,
518,
29883,
29889,
978,
363,
274,
297,
260,
29890,
29889,
13099,
29962,
13,
1678,
848,
353,
518,
13,
4706,
313,
29896,
29892,
29871,
29896,
29900,
29900,
29900,
511,
13,
1678,
4514,
13,
1678,
4206,
353,
518,
8977,
29898,
1761,
29898,
7554,
29898,
13099,
29892,
1948,
4961,
363,
1948,
297,
848,
29962,
13,
1678,
1015,
29889,
8645,
29895,
29918,
7851,
29898,
22625,
29892,
4206,
29897,
13,
13,
1753,
679,
29918,
26381,
7295,
13,
1678,
1404,
29918,
2371,
353,
525,
1792,
29915,
565,
338,
29918,
7938,
580,
1683,
18793,
1792,
29908,
29915,
13,
1678,
599,
29918,
26381,
353,
518,
13,
4706,
9423,
7851,
29918,
17858,
6847,
29892,
525,
2287,
18476,
3895,
10751,
5754,
1178,
350,
2544,
8851,
1430,
29871,
29896,
5300,
29871,
29896,
29953,
6323,
525,
13,
462,
795,
525,
333,
350,
2544,
8851,
1430,
29871,
29896,
29900,
29900,
5300,
29871,
29896,
29900,
29906,
6323,
1178,
350,
2544,
8851,
1430,
29871,
29896,
29900,
29900,
29900,
5300,
29871,
29896,
29900,
29900,
29900,
5477,
13,
4706,
9423,
7851,
29918,
16074,
29918,
3286,
29880,
800,
29892,
13,
308,
525,
2287,
18476,
3895,
10751,
29918,
3286,
18411,
5754,
1178,
350,
2544,
8851,
1430,
29871,
29896,
5300,
29871,
29896,
29953,
6323,
525,
13,
308,
525,
333,
350,
2544,
8851,
1430,
29871,
29896,
29900,
29900,
5300,
29871,
29896,
29900,
29906,
6323,
1178,
350,
2544,
8851,
1430,
29871,
29896,
29900,
29900,
29900,
5300,
29871,
29896,
29900,
29900,
29900,
5477,
13,
268,
13,
4706,
9423,
7851,
29918,
6406,
29892,
285,
29915,
2287,
18476,
3895,
426,
1792,
29918,
2371,
29913,
5754,
1178,
350,
2544,
8851,
1430,
29871,
29896,
5300,
29871,
29896,
525,
511,
13,
4706,
9423,
7851,
29918,
307,
793,
29892,
525,
2287,
18476,
3895,
6297,
5754,
1178,
350,
2544,
8851,
1430,
29871,
29896,
5300,
29871,
29896,
6323,
1178,
525,
13,
462,
4706,
525,
29933,
2544,
8851,
1430,
29871,
29896,
29900,
29900,
5300,
29871,
29896,
29900,
29900,
5477,
13,
4706,
9423,
7851,
29918,
12154,
29918,
3286,
29880,
800,
29892,
13,
308,
525,
2287,
18476,
3895,
6297,
29918,
3286,
18411,
5754,
1178,
350,
2544,
8851,
1430,
29871,
29896,
5300,
29871,
29896,
6323,
1178,
525,
13,
308,
525,
29933,
2544,
8851,
1430,
29871,
29896,
29900,
29900,
5300,
29871,
29896,
29900,
29900,
5477,
13,
4706,
9423,
7851,
29918,
1792,
29918,
307,
793,
29892,
525,
2287,
18476,
3895,
1404,
29918,
12154,
5754,
1404,
29918,
333,
350,
2544,
8851,
1430,
29871,
29896,
5300,
29871,
29896,
5477,
13,
268,
13,
4706,
9423,
7851,
29918,
12154,
29918,
16074,
29892,
525,
2287,
18476,
3895,
6297,
29918,
16074,
5754,
6297,
29918,
333,
353,
29871,
29896,
525,
13,
462,
462,
29871,
525,
9468,
10751,
29918,
333,
353,
29871,
29896,
29900,
29900,
29900,
1495,
13,
1678,
4514,
13,
1678,
736,
599,
29918,
26381,
13,
13,
1753,
14955,
7295,
13,
1678,
12893,
353,
3030,
29889,
657,
29918,
4703,
580,
13,
1678,
4867,
353,
4867,
28107,
29898,
5355,
29922,
13073,
29889,
5355,
29897,
580,
13,
1678,
3957,
353,
4867,
29889,
9965,
580,
13,
1678,
599,
29918,
26381,
353,
679,
29918,
26381,
580,
13,
13,
1678,
1018,
29901,
13,
4706,
363,
9920,
297,
599,
29918,
26381,
29901,
13,
9651,
565,
338,
8758,
29898,
9006,
29961,
29900,
1402,
851,
1125,
13,
18884,
3957,
29889,
7978,
29898,
9006,
29961,
29900,
2314,
13,
9651,
25342,
338,
8758,
29898,
9006,
29961,
29900,
1402,
1051,
1125,
13,
18884,
363,
1948,
297,
9920,
29961,
29900,
5387,
13,
462,
1678,
3957,
29889,
7978,
29898,
798,
29897,
13,
9651,
1683,
29901,
13,
18884,
9920,
29961,
29900,
29962,
580,
13,
1678,
5174,
29901,
13,
4706,
4867,
29889,
1245,
1627,
580,
13,
4706,
12020,
13,
1678,
4867,
29889,
15060,
580,
13,
13,
13,
1753,
1623,
8228,
7295,
13,
1678,
12893,
353,
3030,
29889,
657,
29918,
4703,
580,
13,
1678,
4867,
353,
4867,
28107,
29898,
5355,
29922,
13073,
29889,
5355,
29897,
580,
13,
1678,
3957,
353,
4867,
29889,
9965,
580,
13,
1678,
599,
29918,
26381,
353,
679,
29918,
26381,
580,
13,
13,
1678,
1018,
29901,
13,
4706,
363,
9920,
297,
18764,
287,
29898,
497,
29918,
26381,
1125,
13,
9651,
565,
338,
8758,
29898,
9006,
29961,
29896,
1402,
851,
1125,
13,
18884,
3957,
29889,
7978,
29898,
9006,
29961,
29896,
2314,
13,
9651,
25342,
338,
8758,
29898,
9006,
29961,
29896,
1402,
1051,
1125,
13,
18884,
363,
1948,
297,
9920,
29961,
29896,
5387,
13,
462,
1678,
3957,
29889,
7978,
29898,
798,
29897,
13,
9651,
1683,
29901,
13,
18884,
9920,
29961,
29896,
29962,
580,
13,
1678,
5174,
29901,
13,
4706,
4867,
29889,
1245,
1627,
580,
13,
4706,
12020,
13,
1678,
4867,
29889,
15060,
580,
13,
2
] |
effect_of_vanishing_photos/effect_of_vanishing_photos.py | gil9red/SimplePyScripts | 117 | 144049 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
"""Эффект исчезновения фотографии
Кликая на области на фотографии запускаются процессы плавного увеличения
прозрачности пикселей, эффект как круги воды, будут расходиться пока не
закончатся непрозрачные пиксели"""
import sys
import traceback
try:
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
except:
try:
from PyQt4.QtGui import *
from PyQt4.QtCore import *
except:
from PySide.QtGui import *
from PySide.QtCore import *
def log_uncaught_exceptions(ex_cls, ex, tb):
text = '{}: {}:\n'.format(ex_cls.__name__, ex)
text += ''.join(traceback.format_tb(tb))
print(text)
QMessageBox.critical(None, 'Error', text)
sys.exit(1)
sys.excepthook = log_uncaught_exceptions
class Timer(QTimer):
class Circle:
def __init__(self, pos_center):
self.pos_center = pos_center
self.radii = 1
def next(self):
self.radii += 1
def __init__(self, widget, image):
super().__init__()
self.circle_list = list()
self.widget = widget
self.setInterval(60)
self.timeout.connect(self.tick)
self.painter = QPainter(image)
self.painter.setRenderHint(QPainter.Antialiasing)
self.painter.setCompositionMode(QPainter.CompositionMode_Clear)
self.painter.setPen(Qt.NoPen)
self.painter.setBrush(Qt.transparent)
def add(self, pos_center):
self.circle_list.append(Timer.Circle(pos_center))
def tick(self):
for circle in self.circle_list:
self.painter.drawEllipse(circle.pos_center, circle.radii, circle.radii)
circle.next()
self.widget.update()
class Widget(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle('effect_of_vanishing_photos.py')
self.im = QImage('im.png')
self.resize(self.im.size())
self.timer = Timer(self, self.im)
self.timer.start()
def mouseReleaseEvent(self, event):
super().mouseReleaseEvent(event)
self.timer.add(event.pos())
def paintEvent(self, event):
super().paintEvent(event)
p = QPainter(self)
p.setBrush(Qt.white)
p.drawRect(self.rect())
p.setBrush(Qt.yellow)
p.drawRect(self.width() // 6, self.width() // 5, self.width() // 3, self.height() // 4)
p.drawImage(0, 0, self.im)
if __name__ == '__main__':
app = QApplication(sys.argv)
w = Widget()
w.show()
app.exec_()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
1649,
8921,
1649,
353,
525,
666,
18184,
1161,
29915,
13,
13,
13,
15945,
29908,
30082,
30011,
18201,
29932,
9971,
1093,
29972,
27290,
1587,
26592,
14694,
29917,
13,
30014,
644,
22972,
665,
9308,
665,
26592,
14694,
29917,
1077,
2968,
2494,
9480,
14852,
29935,
5551,
469,
5206,
1868,
863,
19630,
12395,
13,
5945,
29972,
494,
4913,
1415,
6712,
29951,
1502,
6188,
29892,
2352,
30011,
18201,
29932,
5413,
1186,
1086,
1892,
1786,
4184,
29892,
22770,
29932,
7421,
4647,
4199,
25693,
1538,
13,
1902,
6587,
1282,
7489,
1538,
5945,
29972,
494,
20125,
6712,
29951,
1502,
644,
15945,
29908,
13,
13,
13,
5215,
10876,
13,
5215,
9637,
1627,
13,
13,
13,
2202,
29901,
13,
1678,
515,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
334,
13,
1678,
515,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
334,
13,
1678,
515,
10772,
17303,
29945,
29889,
17303,
9203,
1053,
334,
13,
13,
19499,
29901,
13,
1678,
1018,
29901,
13,
4706,
515,
10772,
17303,
29946,
29889,
17303,
28707,
1053,
334,
13,
4706,
515,
10772,
17303,
29946,
29889,
17303,
9203,
1053,
334,
13,
13,
1678,
5174,
29901,
13,
4706,
515,
10772,
23908,
29889,
17303,
28707,
1053,
334,
13,
4706,
515,
10772,
23908,
29889,
17303,
9203,
1053,
334,
13,
13,
13,
1753,
1480,
29918,
4661,
6482,
29918,
11739,
29879,
29898,
735,
29918,
25932,
29892,
429,
29892,
260,
29890,
1125,
13,
1678,
1426,
353,
22372,
6177,
6571,
3583,
29876,
4286,
4830,
29898,
735,
29918,
25932,
17255,
978,
1649,
29892,
429,
29897,
13,
1678,
1426,
4619,
525,
4286,
7122,
29898,
15003,
1627,
29889,
4830,
29918,
22625,
29898,
22625,
876,
13,
13,
1678,
1596,
29898,
726,
29897,
13,
1678,
660,
3728,
3313,
29889,
9695,
936,
29898,
8516,
29892,
525,
2392,
742,
1426,
29897,
13,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
13,
9675,
29889,
735,
13300,
386,
2550,
353,
1480,
29918,
4661,
6482,
29918,
11739,
29879,
13,
13,
13,
1990,
29168,
29898,
29984,
14745,
1125,
13,
1678,
770,
27927,
29901,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
926,
29918,
5064,
1125,
13,
9651,
1583,
29889,
1066,
29918,
5064,
353,
926,
29918,
5064,
13,
9651,
1583,
29889,
3665,
2236,
353,
29871,
29896,
13,
13,
4706,
822,
2446,
29898,
1311,
1125,
13,
9651,
1583,
29889,
3665,
2236,
4619,
29871,
29896,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
11109,
29892,
1967,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
4706,
1583,
29889,
16622,
29918,
1761,
353,
1051,
580,
13,
13,
4706,
1583,
29889,
8030,
353,
11109,
13,
13,
4706,
1583,
29889,
842,
12506,
29898,
29953,
29900,
29897,
13,
4706,
1583,
29889,
15619,
29889,
6915,
29898,
1311,
29889,
24667,
29897,
13,
13,
4706,
1583,
29889,
29886,
475,
357,
353,
660,
29925,
475,
357,
29898,
3027,
29897,
13,
4706,
1583,
29889,
29886,
475,
357,
29889,
842,
10716,
28016,
29898,
29984,
29925,
475,
357,
29889,
13448,
616,
3173,
292,
29897,
13,
4706,
1583,
29889,
29886,
475,
357,
29889,
842,
1523,
3283,
6818,
29898,
29984,
29925,
475,
357,
29889,
1523,
3283,
6818,
29918,
18759,
29897,
13,
4706,
1583,
29889,
29886,
475,
357,
29889,
842,
29925,
264,
29898,
17303,
29889,
3782,
29925,
264,
29897,
13,
4706,
1583,
29889,
29886,
475,
357,
29889,
842,
27680,
29898,
17303,
29889,
3286,
3560,
29897,
13,
13,
1678,
822,
788,
29898,
1311,
29892,
926,
29918,
5064,
1125,
13,
4706,
1583,
29889,
16622,
29918,
1761,
29889,
4397,
29898,
14745,
29889,
23495,
280,
29898,
1066,
29918,
5064,
876,
13,
13,
1678,
822,
16892,
29898,
1311,
1125,
13,
4706,
363,
8607,
297,
1583,
29889,
16622,
29918,
1761,
29901,
13,
9651,
1583,
29889,
29886,
475,
357,
29889,
4012,
6489,
5843,
29898,
16622,
29889,
1066,
29918,
5064,
29892,
8607,
29889,
3665,
2236,
29892,
8607,
29889,
3665,
2236,
29897,
13,
9651,
8607,
29889,
4622,
580,
13,
13,
4706,
1583,
29889,
8030,
29889,
5504,
580,
13,
13,
13,
1990,
27080,
29898,
29984,
8801,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
4706,
1583,
29889,
842,
5907,
7030,
877,
15987,
29918,
974,
29918,
3703,
14424,
29918,
561,
15788,
29889,
2272,
1495,
13,
13,
4706,
1583,
29889,
326,
353,
660,
2940,
877,
326,
29889,
2732,
1495,
13,
4706,
1583,
29889,
21476,
29898,
1311,
29889,
326,
29889,
2311,
3101,
13,
13,
4706,
1583,
29889,
20404,
353,
29168,
29898,
1311,
29892,
1583,
29889,
326,
29897,
13,
4706,
1583,
29889,
20404,
29889,
2962,
580,
13,
13,
1678,
822,
9495,
19729,
2624,
29898,
1311,
29892,
1741,
1125,
13,
4706,
2428,
2141,
15769,
19729,
2624,
29898,
3696,
29897,
13,
13,
4706,
1583,
29889,
20404,
29889,
1202,
29898,
3696,
29889,
1066,
3101,
13,
13,
1678,
822,
10675,
2624,
29898,
1311,
29892,
1741,
1125,
13,
4706,
2428,
2141,
29886,
2365,
2624,
29898,
3696,
29897,
13,
13,
4706,
282,
353,
660,
29925,
475,
357,
29898,
1311,
29897,
13,
4706,
282,
29889,
842,
27680,
29898,
17303,
29889,
10921,
29897,
13,
4706,
282,
29889,
4012,
7364,
29898,
1311,
29889,
1621,
3101,
13,
13,
4706,
282,
29889,
842,
27680,
29898,
17303,
29889,
29136,
29897,
13,
4706,
282,
29889,
4012,
7364,
29898,
1311,
29889,
2103,
580,
849,
29871,
29953,
29892,
1583,
29889,
2103,
580,
849,
29871,
29945,
29892,
1583,
29889,
2103,
580,
849,
29871,
29941,
29892,
1583,
29889,
3545,
580,
849,
29871,
29946,
29897,
13,
4706,
282,
29889,
4012,
2940,
29898,
29900,
29892,
29871,
29900,
29892,
1583,
29889,
326,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
623,
353,
660,
4873,
29898,
9675,
29889,
19218,
29897,
13,
13,
1678,
281,
353,
27080,
580,
13,
1678,
281,
29889,
4294,
580,
13,
13,
1678,
623,
29889,
4258,
29918,
580,
13,
2
] |
tests/fixtures/test_product.py | oldarmyc/cap | 1 | 22815 | <reponame>oldarmyc/cap
# Copyright 2016 <NAME>
#
# 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.
sample_product = {
"title": "Test",
"us_url": "http://us.test.com",
"uk_url": "http://uk.test.com",
"active": True,
"db_name": "test",
"require_region": True,
"doc_url": "http://doc.test.com",
"pitchfork_url": "https://pitchfork/url"
}
sample_limit = {
"product": "test",
"title": "Test",
"uri": "/limits",
"slug": "test",
"active": True,
"absolute_path": "test/path",
"absolute_type": "list",
"limit_key": "test_limit",
"value_key": "test_value"
}
sample_log = {
"queried": ["dns"],
"queried_by": "skeletor",
"region": "dfw",
"ddi": "123456",
'query_results': []
}
sample_auth_failure = {
'message': (
'<strong>Error!</strong> Authentication has failed due to'
' incorrect token or DDI. Please check the token and DDI '
'and try again.'
)
}
""" DNS Tests """
dns = {
"title": "DNS",
"us_url": "https://us.test.com",
"uk_url": "https://uk.test.com",
"active": True,
"db_name": "dns",
"require_region": True,
"doc_url": "https://doc.test.com",
"pitchfork_url": "https://pitchfork.url",
"limit_maps": []
}
dns_limit = {
"product": "dns",
"title": "Domains",
"uri": "/limits",
"slug": "domains",
"active": True,
"absolute_path": "limits.absolute",
"absolute_type": "dict",
"value_key": "",
"limit_key": "domains"
}
dns_limit_return = {
"limits": {
"rate": [
{
"regex": ".*/v\\d+\\.\\d+/(\\d+/domains/search).*",
"limit": [
{
"value": 20,
"verb": "GET",
"next-available": "2016-01-12T13:56:11.450Z",
"remaining": 20,
"unit": "MINUTE"
}
],
"uri": "*/domains/search*"
}
],
"absolute": {
"domains": 500,
"records per domain": 500
}
}
}
dns_list_return = {
"domains": [
{
"comment": "Test",
"updated": "2015-12-08T20:47:02.000+0000",
"name": "test.net",
"created": "2015-04-09T15:42:49.000+0000",
"emailAddress": "<EMAIL>",
"id": 123465798,
"accountId": 1234567
}
],
"totalEntries": 1
}
dns_full_return = {
'dns': {
'values': {'Domains': 1},
'limits': {'Domains': 500}
}
}
""" Autoscale """
autoscale = {
"title": "Autoscale",
"us_url": "https://us.test.com",
"uk_url": "https://uk.test.com",
"active": True,
"db_name": "autoscale",
"require_region": True,
"doc_url": "https://doc.test.com",
"pitchfork_url": "https://pitchfork.url",
"limit_maps": []
}
autoscale_limit = {
"product": "autoscale",
"title": "Max Groups",
"absolute_path": "limits.absolute",
"uri": "/v1.0/{ddi}/limits",
"slug": "max_groups",
"value_key": "",
"absolute_type": "dict",
"active": True,
"limit_key": "maxGroups"
}
autoscale_limit_return = {
"limits": {
"rate": [
{
"regex": "/v1\\.0/execute/(.*)",
"limit": [
{
"value": 10,
"verb": "ALL",
"next-available": "2016-01-12T14:51:13.402Z",
"remaining": 10,
"unit": "SECOND"
}
],
"uri": "/v1.0/execute/*"
}
],
"absolute": {
"maxGroups": 1000,
"maxPoliciesPerGroup": 100,
"maxWebhooksPerPolicy": 25
}
}
}
autoscale_list_return = {
"groups": [
{
"state": {
"status": "ACTIVE",
"desiredCapacity": 0,
"paused": False,
"active": [],
"pendingCapacity": 0,
"activeCapacity": 0,
"name": "test"
},
"id": "d446f3c2-612f-41b8-92dc-4d6e1422bde2",
"links": [
{
"href": (
'https://dfw.autoscale.api.rackspacecloud.com/v1.0'
'/1234567/groups/d446f3c2-612f-41b8-92dc-4d6e1422bde2/'
),
"rel": "self"
}
]
}
],
"groups_links": []
}
autoscale_full_return = {
'autoscale': {
'values': {'Max Groups': 1},
'limits': {'Max Groups': 1000}
}
}
""" Big Data """
big_data = {
"title": "Big Data",
"us_url": "https://us.test.com",
"uk_url": "https://uk.test.com",
"active": True,
"db_name": "big_data",
"require_region": True,
"doc_url": "https://doc.test.com",
"pitchfork_url": "https://pitchfork.url",
"limit_maps": []
}
big_data_limit = [
{
"product": "big_data",
"title": "Node Count",
"absolute_path": "limits.absolute.node_count",
"uri": "/v2/{ddi}/limits",
"slug": "node_count",
"value_key": "remaining",
"absolute_type": "dict",
"active": True,
"limit_key": "limit"
}, {
"product": "big_data",
"title": "Disk - MB",
"absolute_path": "limits.absolute.disk",
"uri": "/v2/{ddi}/limits",
"slug": "disk_-_mb",
"value_key": "remaining",
"absolute_type": "dict",
"active": True,
"limit_key": "limit"
}
]
big_data_limit_return = {
"limits": {
"absolute": {
"node_count": {
"limit": 15,
"remaining": 8
},
"disk": {
"limit": 50000,
"remaining": 25000
},
"ram": {
"limit": 655360,
"remaining": 555360
},
"vcpus": {
"limit": 200,
"remaining": 120
}
}
}
}
big_data_full_return = {
'big_data': {
'values': {'Node Count': 7, 'Disk - MB': 25000},
'limits': {'Node Count': 15, 'Disk - MB': 50000}
}
}
""" CBS """
cbs = {
"title": "CBS",
"us_url": "https://us.test.com",
"uk_url": "https://uk.test.com",
"active": True,
"db_name": "cbs",
"require_region": True,
"doc_url": "https://doc.test.com",
"pitchfork_url": "https://pitchfork.url",
"limit_maps": []
}
cbs_limit = {
"product": "cbs",
"title": "SATA - GB",
"absolute_path": "quota_set.gigabytes_SATA",
"uri": "/v1/{ddi}/os-quota-sets/{ddi}?usage=True",
"slug": "sata_-_gb",
"value_key": "in_use",
"absolute_type": "dict",
"active": True,
"limit_key": "limit"
}
cbs_limit_return = {
"quota_set": {
"volumes": {
"limit": -1,
"reserved": 0,
"in_use": 3
},
"gigabytes_SATA": {
"limit": 10240,
"reserved": 0,
"in_use": 325
},
"gigabytes_SSD": {
"limit": 10240,
"reserved": 0,
"in_use": 50
}
}
}
cbs_full_return = {
'cbs': {
'values': {'SATA - GB': 9915},
'limits': {'SATA - GB': 10240}
}
}
""" Load Balancers """
clb = {
"title": "Load Balancers",
"us_url": "https://us.test.com",
"uk_url": "https://uk.test.com",
"active": True,
"db_name": "load_balancers",
"require_region": True,
"doc_url": "https://doc.test.com",
"pitchfork_url": "https://pitchfork.url",
"limit_maps": []
}
clb_limit = [
{
"product": "load_balancers",
"title": "Total Load Balancers",
"uri": "/v1.0/{ddi}/loadbalancers/absolutelimits",
"slug": "total_load_balancers",
"active": True,
"path": "absolute['LOADBALANCER_LIMIT']",
"absolute_path": "absolute",
"value_key": "",
"absolute_type": "list",
"limit_key": "LOADBALANCER_LIMIT"
}, {
"product": "load_balancers",
"title": "Nodes per LB",
"uri": "/v1.0/{ddi}/loadbalancers/absolutelimits",
"slug": "nodes_per_lb",
"active": True,
"path": "absolute['NODE_LIMIT']",
"absolute_path": "absolute",
"value_key": "",
"absolute_type": "list",
"limit_key": "NODE_LIMIT"
}
]
clb_limit_return = {
"absolute": [
{
"name": "IPV6_LIMIT",
"value": 25
}, {
"name": "LOADBALANCER_LIMIT",
"value": 25
}, {
"name": "BATCH_DELETE_LIMIT",
"value": 10
}, {
"name": "ACCESS_LIST_LIMIT",
"value": 100
}, {
"name": "NODE_LIMIT",
"value": 25
}, {
"name": "NODE_META_LIMIT",
"value": 25
}, {
"name": "LOADBALANCER_META_LIMIT",
"value": 25
}, {
"name": "CERTIFICATE_MAPPING_LIMIT",
"value": 20
}
]
}
clb_list_return = {
"loadBalancers": [
{
"status": "ACTIVE",
"updated": {
"time": "2016-01-12T16:04:44Z"
},
"protocol": "HTTP",
"name": "test",
"algorithm": "LEAST_CONNECTIONS",
"created": {
"time": "2016-01-12T16:04:44Z"
},
"virtualIps": [
{
"ipVersion": "IPV4",
"type": "PUBLIC",
"id": 19875,
"address": "172.16.31.10"
}, {
"ipVersion": "IPV6",
"type": "PUBLIC",
"id": 9318325,
"address": "fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b"
}
],
"id": 506497,
"timeout": 30,
"nodeCount": 0,
"port": 80
}
]
}
clb_full_return = {
'load_balancers': {
'values': {'Total Load Balancers': 1},
'limits': {'Total Load Balancers': 25, 'Nodes per LB': 25}
}
}
""" Servers """
server = {
"title": "Servers",
"us_url": "https://us.test.com",
"uk_url": "https://uk.test.com",
"active": True,
"db_name": "servers",
"require_region": True,
"doc_url": "https://doc.test.com",
"pitchfork_url": "https://pitchfork.url",
"limit_maps": []
}
server_limit = [
{
"product": "servers",
"title": "Servers",
"uri": "/v2/{ddi}/limits",
"slug": "servers",
"active": True,
"path": "absolute['maxTotalInstances']",
"absolute_path": "limits.absolute",
"value_key": "",
"absolute_type": "dict",
"limit_key": "maxTotalInstances"
}, {
"product": "servers",
"title": "Private Networks",
"uri": "/v2/{ddi}/limits",
"slug": "private_networks",
"active": True,
"path": "absolute['maxTotalPrivateNetworks']",
"absolute_path": "limits.absolute",
"value_key": "",
"absolute_type": "dict",
"limit_key": "maxTotalPrivateNetworks"
}, {
"product": "servers",
"title": "Ram - MB",
"uri": "/v2/{ddi}/limits",
"slug": "ram_-_mb",
"active": True,
"path": "absolute['maxTotalRAMSize']",
"absolute_path": "limits.absolute",
"value_key": "",
"absolute_type": "dict",
"limit_key": "maxTotalRAMSize"
}
]
server_limit_return = {
"limits": {
"rate": [
{
"regex": "/[^/]*/?$",
"limit": [
{
"next-available": "2016-01-12T16:14:47.624Z",
"unit": "MINUTE",
"verb": "GET",
"remaining": 2200,
"value": 2200
}
],
"uri": "*"
}, {
"regex": (
"/v[^/]+/[^/]+/servers/([^/]+)/rax-si-image-schedule"
),
"limit": [
{
"next-available": "2016-01-12T16:14:47.624Z",
"unit": "SECOND",
"verb": "POST",
"remaining": 10,
"value": 10
}
],
"uri": "/servers/{id}/rax-si-image-schedule"
}
],
"absolute": {
"maxPersonalitySize": 1000,
"maxTotalCores": -1,
"maxPersonality": 5,
"totalPrivateNetworksUsed": 1,
"maxImageMeta": 40,
"maxTotalPrivateNetworks": 10,
"maxSecurityGroupRules": -1,
"maxTotalKeypairs": 100,
"totalRAMUsed": 4096,
"maxSecurityGroups": -1,
"totalFloatingIpsUsed": 0,
"totalInstancesUsed": 3,
"totalSecurityGroupsUsed": 0,
"maxServerMeta": 40,
"maxTotalFloatingIps": -1,
"maxTotalInstances": 200,
"totalCoresUsed": 4,
"maxTotalRAMSize": 256000
}
}
}
server_list_return = {
"servers": [
{
"OS-EXT-STS:task_state": None,
"addresses": {
"public": [
{
"version": 4,
"addr": "192.168.3.11"
}, {
"version": 6,
"addr": "fc00:e968:6179::de52:7100"
}
],
"private": [
{
"version": 4,
"addr": "10.176.205.68"
}
]
},
"flavor": {
"id": "general1-1",
"links": [
{
"href": (
"https://iad.servers.api.rackspacecloud.com"
"/766030/flavors/general1-1"
),
"rel": "bookmark"
}
]
},
"id": "3290e50d-888f-4500-a934-16c10f3b8a10",
"user_id": "284275",
"OS-DCF:diskConfig": "MANUAL",
"accessIPv4": "192.168.3.11",
"accessIPv6": "fc00:e968:6179::de52:7100",
"progress": 100,
"OS-EXT-STS:power_state": 1,
"config_drive": "",
"status": "ACTIVE",
"updated": "2016-01-12T15:16:37Z",
"name": "test-server",
"created": "2016-01-12T15:15:39Z",
"tenant_id": "1234567",
"metadata": {
"build_config": "",
"rax_service_level_automation": "Complete"
}
}
]
}
server_list_processed_return = [
{
'status': 'ACTIVE',
'updated': '2016-01-12T15:16:37Z',
'OS-EXT-STS:task_state': None,
'user_id': '284275',
'addresses': {
'public': [
{
'version': 4,
'addr': '192.168.3.11'
}, {
'version': 6,
'addr': 'fc00:e968:6179::de52:7100'
}
],
'private': [
{
'version': 4,
'addr': '10.176.205.68'
}
]
},
'created': '2016-01-12T15:15:39Z',
'tenant_id': '1234567',
'OS-DCF:diskConfig': 'MANUAL',
'id': '3290e50d-888f-4500-a934-16c10f3b8a10',
'accessIPv4': '192.168.3.11',
'accessIPv6': 'fc00:e968:6179::de52:7100',
'config_drive': '',
'progress': 100,
'OS-EXT-STS:power_state': 1,
'metadata': {
'build_config': '',
'rax_service_level_automation': 'Complete'
},
'flavor': {
'id': 'general1-1',
'links': [
{
'href': (
'https://iad.servers.api.rackspacecloud.com'
'/766030/flavors/general1-1'
),
'rel': 'bookmark'
}
]
},
'name': 'test-server'
}
]
network_list_return = {
"networks": [
{
"status": "ACTIVE",
"subnets": [
"879ff280-6f17-4fd8-b684-19237d88fc45"
],
"name": "test-network",
"admin_state_up": True,
"tenant_id": "1234567",
"shared": False,
"id": "e737483a-00d7-4517-afc3-bd1fbbbd4cd3"
}
]
}
network_processed_list = [
{
'status': 'ACTIVE',
'subnets': [
'879ff280-6f17-4fd8-b684-19237d88fc45'
],
'name': 'test-network',
'admin_state_up': True,
'tenant_id': '1234567',
'shared': False,
'id': 'e737483a-00d7-4517-afc3-bd1fbbbd4cd3'
}
]
server_flavor_return = {
"flavor": {
"ram": 1024,
"name": "1 GB General Purpose v1",
"OS-FLV-WITH-EXT-SPECS:extra_specs": {
"number_of_data_disks": "0",
"class": "general1",
"disk_io_index": "40",
"policy_class": "general_flavor"
},
"vcpus": 1,
"swap": "",
"rxtx_factor": 200.0,
"OS-FLV-EXT-DATA:ephemeral": 0,
"disk": 20,
"id": "general1-1"
}
}
server_full_return = {
'servers': {
'values': {
'Private Networks': 1,
'Ram - MB': 1024,
'Servers': 1
},
'limits': {
'Private Networks': 10,
'Ram - MB': 256000,
'Servers': 200
}
}
}
| [
1,
529,
276,
1112,
420,
29958,
1025,
279,
1357,
29883,
29914,
5030,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29953,
529,
5813,
29958,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
13,
13,
11249,
29918,
4704,
353,
426,
13,
1678,
376,
3257,
1115,
376,
3057,
613,
13,
1678,
376,
375,
29918,
2271,
1115,
376,
1124,
597,
375,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
2679,
29918,
2271,
1115,
376,
1124,
597,
2679,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
2585,
29918,
978,
1115,
376,
1688,
613,
13,
1678,
376,
12277,
29918,
12803,
1115,
5852,
29892,
13,
1678,
376,
1514,
29918,
2271,
1115,
376,
1124,
597,
1514,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
29886,
2335,
29888,
548,
29918,
2271,
1115,
376,
991,
597,
29886,
2335,
29888,
548,
29914,
2271,
29908,
13,
29913,
13,
13,
11249,
29918,
13400,
353,
426,
13,
1678,
376,
4704,
1115,
376,
1688,
613,
13,
1678,
376,
3257,
1115,
376,
3057,
613,
13,
1678,
376,
5338,
1115,
5591,
12514,
613,
13,
1678,
376,
29517,
1115,
376,
1688,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
23552,
29918,
2084,
1115,
376,
1688,
29914,
2084,
613,
13,
1678,
376,
23552,
29918,
1853,
1115,
376,
1761,
613,
13,
1678,
376,
13400,
29918,
1989,
1115,
376,
1688,
29918,
13400,
613,
13,
1678,
376,
1767,
29918,
1989,
1115,
376,
1688,
29918,
1767,
29908,
13,
29913,
13,
13,
11249,
29918,
1188,
353,
426,
13,
1678,
376,
7808,
1000,
1115,
6796,
29881,
1983,
12436,
13,
1678,
376,
7808,
1000,
29918,
1609,
1115,
376,
26050,
1026,
272,
613,
13,
1678,
376,
12803,
1115,
376,
2176,
29893,
613,
13,
1678,
376,
1289,
29875,
1115,
376,
29896,
29906,
29941,
29946,
29945,
29953,
613,
13,
1678,
525,
1972,
29918,
9902,
2396,
5159,
13,
29913,
13,
13,
11249,
29918,
5150,
29918,
14057,
545,
353,
426,
13,
1678,
525,
4906,
2396,
313,
13,
4706,
12801,
1110,
29958,
2392,
29991,
829,
1110,
29958,
27241,
756,
5229,
2861,
304,
29915,
13,
4706,
525,
10240,
5993,
470,
360,
4571,
29889,
3529,
1423,
278,
5993,
322,
360,
4571,
525,
13,
4706,
525,
392,
1018,
1449,
6169,
13,
1678,
1723,
13,
29913,
13,
13,
15945,
29908,
16332,
4321,
29879,
9995,
13,
13,
29881,
1983,
353,
426,
13,
1678,
376,
3257,
1115,
376,
29928,
3059,
613,
13,
1678,
376,
375,
29918,
2271,
1115,
376,
991,
597,
375,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
2679,
29918,
2271,
1115,
376,
991,
597,
2679,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
2585,
29918,
978,
1115,
376,
29881,
1983,
613,
13,
1678,
376,
12277,
29918,
12803,
1115,
5852,
29892,
13,
1678,
376,
1514,
29918,
2271,
1115,
376,
991,
597,
1514,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
29886,
2335,
29888,
548,
29918,
2271,
1115,
376,
991,
597,
29886,
2335,
29888,
548,
29889,
2271,
613,
13,
1678,
376,
13400,
29918,
10339,
1115,
5159,
13,
29913,
13,
13,
29881,
1983,
29918,
13400,
353,
426,
13,
1678,
376,
4704,
1115,
376,
29881,
1983,
613,
13,
1678,
376,
3257,
1115,
376,
11096,
2708,
613,
13,
1678,
376,
5338,
1115,
5591,
12514,
613,
13,
1678,
376,
29517,
1115,
376,
3129,
2708,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
23552,
29918,
2084,
1115,
376,
12514,
29889,
23552,
613,
13,
1678,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
1678,
376,
1767,
29918,
1989,
1115,
12633,
13,
1678,
376,
13400,
29918,
1989,
1115,
376,
3129,
2708,
29908,
13,
29913,
13,
13,
29881,
1983,
29918,
13400,
29918,
2457,
353,
426,
13,
1678,
376,
12514,
1115,
426,
13,
4706,
376,
10492,
1115,
518,
13,
9651,
426,
13,
18884,
376,
13087,
1115,
11393,
3877,
29894,
1966,
29881,
29974,
1966,
29889,
1966,
29881,
29974,
29914,
1194,
29905,
29881,
29974,
29914,
3129,
2708,
29914,
4478,
467,
29930,
613,
13,
18884,
376,
13400,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
1767,
1115,
29871,
29906,
29900,
29892,
13,
462,
4706,
376,
18248,
1115,
376,
7194,
613,
13,
462,
4706,
376,
4622,
29899,
16515,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29941,
29901,
29945,
29953,
29901,
29896,
29896,
29889,
29946,
29945,
29900,
29999,
613,
13,
462,
4706,
376,
1745,
17225,
1115,
29871,
29906,
29900,
29892,
13,
462,
4706,
376,
5441,
1115,
376,
16173,
26027,
29908,
13,
462,
1678,
500,
13,
18884,
21251,
13,
18884,
376,
5338,
1115,
376,
3877,
3129,
2708,
29914,
4478,
20605,
13,
9651,
500,
13,
4706,
21251,
13,
4706,
376,
23552,
1115,
426,
13,
9651,
376,
3129,
2708,
1115,
29871,
29945,
29900,
29900,
29892,
13,
9651,
376,
3757,
4339,
639,
5354,
1115,
29871,
29945,
29900,
29900,
13,
4706,
500,
13,
1678,
500,
13,
29913,
13,
13,
29881,
1983,
29918,
1761,
29918,
2457,
353,
426,
13,
1678,
376,
3129,
2708,
1115,
518,
13,
4706,
426,
13,
9651,
376,
9342,
1115,
376,
3057,
613,
13,
9651,
376,
21402,
1115,
376,
29906,
29900,
29896,
29945,
29899,
29896,
29906,
29899,
29900,
29947,
29911,
29906,
29900,
29901,
29946,
29955,
29901,
29900,
29906,
29889,
29900,
29900,
29900,
29974,
29900,
29900,
29900,
29900,
613,
13,
9651,
376,
978,
1115,
376,
1688,
29889,
1212,
613,
13,
9651,
376,
11600,
1115,
376,
29906,
29900,
29896,
29945,
29899,
29900,
29946,
29899,
29900,
29929,
29911,
29896,
29945,
29901,
29946,
29906,
29901,
29946,
29929,
29889,
29900,
29900,
29900,
29974,
29900,
29900,
29900,
29900,
613,
13,
9651,
376,
5269,
7061,
1115,
9872,
26862,
6227,
28341,
13,
9651,
376,
333,
1115,
29871,
29896,
29906,
29941,
29946,
29953,
29945,
29955,
29929,
29947,
29892,
13,
9651,
376,
10149,
1204,
1115,
29871,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
13,
4706,
500,
13,
1678,
21251,
13,
1678,
376,
7827,
5292,
2722,
1115,
29871,
29896,
13,
29913,
13,
13,
29881,
1983,
29918,
8159,
29918,
2457,
353,
426,
13,
1678,
525,
29881,
1983,
2396,
426,
13,
4706,
525,
5975,
2396,
11117,
11096,
2708,
2396,
29871,
29896,
1118,
13,
4706,
525,
12514,
2396,
11117,
11096,
2708,
2396,
29871,
29945,
29900,
29900,
29913,
13,
1678,
500,
13,
29913,
13,
13,
15945,
29908,
5202,
14174,
744,
9995,
13,
13,
1300,
14174,
744,
353,
426,
13,
1678,
376,
3257,
1115,
376,
6147,
14174,
744,
613,
13,
1678,
376,
375,
29918,
2271,
1115,
376,
991,
597,
375,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
2679,
29918,
2271,
1115,
376,
991,
597,
2679,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
2585,
29918,
978,
1115,
376,
1300,
14174,
744,
613,
13,
1678,
376,
12277,
29918,
12803,
1115,
5852,
29892,
13,
1678,
376,
1514,
29918,
2271,
1115,
376,
991,
597,
1514,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
29886,
2335,
29888,
548,
29918,
2271,
1115,
376,
991,
597,
29886,
2335,
29888,
548,
29889,
2271,
613,
13,
1678,
376,
13400,
29918,
10339,
1115,
5159,
13,
29913,
13,
13,
1300,
14174,
744,
29918,
13400,
353,
426,
13,
1678,
376,
4704,
1115,
376,
1300,
14174,
744,
613,
13,
1678,
376,
3257,
1115,
376,
7976,
1632,
4410,
613,
13,
1678,
376,
23552,
29918,
2084,
1115,
376,
12514,
29889,
23552,
613,
13,
1678,
376,
5338,
1115,
5591,
29894,
29896,
29889,
29900,
19248,
1289,
29875,
6822,
12514,
613,
13,
1678,
376,
29517,
1115,
376,
3317,
29918,
13155,
613,
13,
1678,
376,
1767,
29918,
1989,
1115,
12633,
13,
1678,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
13400,
29918,
1989,
1115,
376,
3317,
24020,
29908,
13,
29913,
13,
13,
1300,
14174,
744,
29918,
13400,
29918,
2457,
353,
426,
13,
1678,
376,
12514,
1115,
426,
13,
4706,
376,
10492,
1115,
518,
13,
9651,
426,
13,
18884,
376,
13087,
1115,
5591,
29894,
29896,
1966,
29889,
29900,
29914,
7978,
14571,
5575,
19123,
13,
18884,
376,
13400,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
1767,
1115,
29871,
29896,
29900,
29892,
13,
462,
4706,
376,
18248,
1115,
376,
9818,
613,
13,
462,
4706,
376,
4622,
29899,
16515,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29946,
29901,
29945,
29896,
29901,
29896,
29941,
29889,
29946,
29900,
29906,
29999,
613,
13,
462,
4706,
376,
1745,
17225,
1115,
29871,
29896,
29900,
29892,
13,
462,
4706,
376,
5441,
1115,
376,
1660,
6007,
29928,
29908,
13,
462,
1678,
500,
13,
18884,
21251,
13,
18884,
376,
5338,
1115,
5591,
29894,
29896,
29889,
29900,
29914,
7978,
5515,
29908,
13,
9651,
500,
13,
4706,
21251,
13,
4706,
376,
23552,
1115,
426,
13,
9651,
376,
3317,
24020,
1115,
29871,
29896,
29900,
29900,
29900,
29892,
13,
9651,
376,
3317,
7713,
293,
583,
5894,
4782,
1115,
29871,
29896,
29900,
29900,
29892,
13,
9651,
376,
3317,
3609,
1251,
12117,
5894,
15644,
1115,
29871,
29906,
29945,
13,
4706,
500,
13,
1678,
500,
13,
29913,
13,
13,
1300,
14174,
744,
29918,
1761,
29918,
2457,
353,
426,
13,
1678,
376,
13155,
1115,
518,
13,
4706,
426,
13,
9651,
376,
3859,
1115,
426,
13,
18884,
376,
4882,
1115,
376,
17923,
18474,
613,
13,
18884,
376,
2783,
2859,
12415,
5946,
1115,
29871,
29900,
29892,
13,
18884,
376,
29886,
15244,
1115,
7700,
29892,
13,
18884,
376,
4925,
1115,
19997,
13,
18884,
376,
29886,
2548,
12415,
5946,
1115,
29871,
29900,
29892,
13,
18884,
376,
4925,
12415,
5946,
1115,
29871,
29900,
29892,
13,
18884,
376,
978,
1115,
376,
1688,
29908,
13,
9651,
2981,
13,
9651,
376,
333,
1115,
376,
29881,
29946,
29946,
29953,
29888,
29941,
29883,
29906,
29899,
29953,
29896,
29906,
29888,
29899,
29946,
29896,
29890,
29947,
29899,
29929,
29906,
13891,
29899,
29946,
29881,
29953,
29872,
29896,
29946,
29906,
29906,
29890,
311,
29906,
613,
13,
9651,
376,
4965,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
12653,
1115,
313,
13,
462,
4706,
525,
991,
597,
2176,
29893,
29889,
1300,
14174,
744,
29889,
2754,
29889,
22282,
3493,
9274,
29889,
510,
29914,
29894,
29896,
29889,
29900,
29915,
13,
462,
4706,
8207,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
29914,
13155,
29914,
29881,
29946,
29946,
29953,
29888,
29941,
29883,
29906,
29899,
29953,
29896,
29906,
29888,
29899,
29946,
29896,
29890,
29947,
29899,
29929,
29906,
13891,
29899,
29946,
29881,
29953,
29872,
29896,
29946,
29906,
29906,
29890,
311,
29906,
22208,
13,
462,
1678,
10353,
13,
462,
1678,
376,
2674,
1115,
376,
1311,
29908,
13,
18884,
500,
13,
9651,
4514,
13,
4706,
500,
13,
1678,
21251,
13,
1678,
376,
13155,
29918,
4965,
1115,
5159,
13,
29913,
13,
13,
1300,
14174,
744,
29918,
8159,
29918,
2457,
353,
426,
13,
1678,
525,
1300,
14174,
744,
2396,
426,
13,
4706,
525,
5975,
2396,
11117,
7976,
1632,
4410,
2396,
29871,
29896,
1118,
13,
4706,
525,
12514,
2396,
11117,
7976,
1632,
4410,
2396,
29871,
29896,
29900,
29900,
29900,
29913,
13,
1678,
500,
13,
29913,
13,
13,
15945,
29908,
7997,
3630,
9995,
13,
13,
3752,
29918,
1272,
353,
426,
13,
1678,
376,
3257,
1115,
376,
6970,
3630,
613,
13,
1678,
376,
375,
29918,
2271,
1115,
376,
991,
597,
375,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
2679,
29918,
2271,
1115,
376,
991,
597,
2679,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
2585,
29918,
978,
1115,
376,
3752,
29918,
1272,
613,
13,
1678,
376,
12277,
29918,
12803,
1115,
5852,
29892,
13,
1678,
376,
1514,
29918,
2271,
1115,
376,
991,
597,
1514,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
29886,
2335,
29888,
548,
29918,
2271,
1115,
376,
991,
597,
29886,
2335,
29888,
548,
29889,
2271,
613,
13,
1678,
376,
13400,
29918,
10339,
1115,
5159,
13,
29913,
13,
13,
3752,
29918,
1272,
29918,
13400,
353,
518,
13,
1678,
426,
13,
4706,
376,
4704,
1115,
376,
3752,
29918,
1272,
613,
13,
4706,
376,
3257,
1115,
376,
4247,
3917,
613,
13,
4706,
376,
23552,
29918,
2084,
1115,
376,
12514,
29889,
23552,
29889,
3177,
29918,
2798,
613,
13,
4706,
376,
5338,
1115,
5591,
29894,
29906,
19248,
1289,
29875,
6822,
12514,
613,
13,
4706,
376,
29517,
1115,
376,
3177,
29918,
2798,
613,
13,
4706,
376,
1767,
29918,
1989,
1115,
376,
1745,
17225,
613,
13,
4706,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
4706,
376,
4925,
1115,
5852,
29892,
13,
4706,
376,
13400,
29918,
1989,
1115,
376,
13400,
29908,
13,
1678,
2981,
426,
13,
4706,
376,
4704,
1115,
376,
3752,
29918,
1272,
613,
13,
4706,
376,
3257,
1115,
376,
29928,
3873,
448,
13232,
613,
13,
4706,
376,
23552,
29918,
2084,
1115,
376,
12514,
29889,
23552,
29889,
20960,
613,
13,
4706,
376,
5338,
1115,
5591,
29894,
29906,
19248,
1289,
29875,
6822,
12514,
613,
13,
4706,
376,
29517,
1115,
376,
20960,
29918,
29899,
29918,
8337,
613,
13,
4706,
376,
1767,
29918,
1989,
1115,
376,
1745,
17225,
613,
13,
4706,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
4706,
376,
4925,
1115,
5852,
29892,
13,
4706,
376,
13400,
29918,
1989,
1115,
376,
13400,
29908,
13,
1678,
500,
13,
29962,
13,
13,
3752,
29918,
1272,
29918,
13400,
29918,
2457,
353,
426,
13,
1678,
376,
12514,
1115,
426,
13,
4706,
376,
23552,
1115,
426,
13,
9651,
376,
3177,
29918,
2798,
1115,
426,
13,
18884,
376,
13400,
1115,
29871,
29896,
29945,
29892,
13,
18884,
376,
1745,
17225,
1115,
29871,
29947,
13,
9651,
2981,
13,
9651,
376,
20960,
1115,
426,
13,
18884,
376,
13400,
1115,
29871,
29945,
29900,
29900,
29900,
29900,
29892,
13,
18884,
376,
1745,
17225,
1115,
29871,
29906,
29945,
29900,
29900,
29900,
13,
9651,
2981,
13,
9651,
376,
2572,
1115,
426,
13,
18884,
376,
13400,
1115,
29871,
29953,
29945,
29945,
29941,
29953,
29900,
29892,
13,
18884,
376,
1745,
17225,
1115,
29871,
29945,
29945,
29945,
29941,
29953,
29900,
13,
9651,
2981,
13,
9651,
376,
29894,
6814,
375,
1115,
426,
13,
18884,
376,
13400,
1115,
29871,
29906,
29900,
29900,
29892,
13,
18884,
376,
1745,
17225,
1115,
29871,
29896,
29906,
29900,
13,
9651,
500,
13,
4706,
500,
13,
1678,
500,
13,
29913,
13,
13,
3752,
29918,
1272,
29918,
8159,
29918,
2457,
353,
426,
13,
1678,
525,
3752,
29918,
1272,
2396,
426,
13,
4706,
525,
5975,
2396,
11117,
4247,
3917,
2396,
29871,
29955,
29892,
525,
29928,
3873,
448,
13232,
2396,
29871,
29906,
29945,
29900,
29900,
29900,
1118,
13,
4706,
525,
12514,
2396,
11117,
4247,
3917,
2396,
29871,
29896,
29945,
29892,
525,
29928,
3873,
448,
13232,
2396,
29871,
29945,
29900,
29900,
29900,
29900,
29913,
13,
1678,
500,
13,
29913,
13,
13,
15945,
29908,
29589,
9995,
13,
13,
29883,
5824,
353,
426,
13,
1678,
376,
3257,
1115,
376,
29907,
9851,
613,
13,
1678,
376,
375,
29918,
2271,
1115,
376,
991,
597,
375,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
2679,
29918,
2271,
1115,
376,
991,
597,
2679,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
2585,
29918,
978,
1115,
376,
29883,
5824,
613,
13,
1678,
376,
12277,
29918,
12803,
1115,
5852,
29892,
13,
1678,
376,
1514,
29918,
2271,
1115,
376,
991,
597,
1514,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
29886,
2335,
29888,
548,
29918,
2271,
1115,
376,
991,
597,
29886,
2335,
29888,
548,
29889,
2271,
613,
13,
1678,
376,
13400,
29918,
10339,
1115,
5159,
13,
29913,
13,
13,
29883,
5824,
29918,
13400,
353,
426,
13,
1678,
376,
4704,
1115,
376,
29883,
5824,
613,
13,
1678,
376,
3257,
1115,
376,
29903,
8254,
448,
19289,
613,
13,
1678,
376,
23552,
29918,
2084,
1115,
376,
339,
4616,
29918,
842,
29889,
29887,
335,
10798,
2167,
29918,
29903,
8254,
613,
13,
1678,
376,
5338,
1115,
5591,
29894,
29896,
19248,
1289,
29875,
6822,
359,
29899,
339,
4616,
29899,
7224,
19248,
1289,
29875,
29913,
29973,
21125,
29922,
5574,
613,
13,
1678,
376,
29517,
1115,
376,
29879,
532,
29918,
29899,
29918,
26300,
613,
13,
1678,
376,
1767,
29918,
1989,
1115,
376,
262,
29918,
1509,
613,
13,
1678,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
13400,
29918,
1989,
1115,
376,
13400,
29908,
13,
29913,
13,
13,
29883,
5824,
29918,
13400,
29918,
2457,
353,
426,
13,
1678,
376,
339,
4616,
29918,
842,
1115,
426,
13,
4706,
376,
1555,
9351,
1115,
426,
13,
9651,
376,
13400,
1115,
448,
29896,
29892,
13,
9651,
376,
690,
9841,
1115,
29871,
29900,
29892,
13,
9651,
376,
262,
29918,
1509,
1115,
29871,
29941,
13,
4706,
2981,
13,
4706,
376,
29887,
335,
10798,
2167,
29918,
29903,
8254,
1115,
426,
13,
9651,
376,
13400,
1115,
29871,
29896,
29900,
29906,
29946,
29900,
29892,
13,
9651,
376,
690,
9841,
1115,
29871,
29900,
29892,
13,
9651,
376,
262,
29918,
1509,
1115,
29871,
29941,
29906,
29945,
13,
4706,
2981,
13,
4706,
376,
29887,
335,
10798,
2167,
29918,
1799,
29928,
1115,
426,
13,
9651,
376,
13400,
1115,
29871,
29896,
29900,
29906,
29946,
29900,
29892,
13,
9651,
376,
690,
9841,
1115,
29871,
29900,
29892,
13,
9651,
376,
262,
29918,
1509,
1115,
29871,
29945,
29900,
13,
4706,
500,
13,
1678,
500,
13,
29913,
13,
13,
29883,
5824,
29918,
8159,
29918,
2457,
353,
426,
13,
1678,
525,
29883,
5824,
2396,
426,
13,
4706,
525,
5975,
2396,
11117,
29903,
8254,
448,
19289,
2396,
29871,
29929,
29929,
29896,
29945,
1118,
13,
4706,
525,
12514,
2396,
11117,
29903,
8254,
448,
19289,
2396,
29871,
29896,
29900,
29906,
29946,
29900,
29913,
13,
1678,
500,
13,
29913,
13,
13,
15945,
29908,
16012,
7392,
4564,
414,
9995,
13,
13,
695,
29890,
353,
426,
13,
1678,
376,
3257,
1115,
376,
5896,
7392,
4564,
414,
613,
13,
1678,
376,
375,
29918,
2271,
1115,
376,
991,
597,
375,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
2679,
29918,
2271,
1115,
376,
991,
597,
2679,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
2585,
29918,
978,
1115,
376,
1359,
29918,
5521,
4564,
414,
613,
13,
1678,
376,
12277,
29918,
12803,
1115,
5852,
29892,
13,
1678,
376,
1514,
29918,
2271,
1115,
376,
991,
597,
1514,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
29886,
2335,
29888,
548,
29918,
2271,
1115,
376,
991,
597,
29886,
2335,
29888,
548,
29889,
2271,
613,
13,
1678,
376,
13400,
29918,
10339,
1115,
5159,
13,
29913,
13,
13,
695,
29890,
29918,
13400,
353,
518,
13,
1678,
426,
13,
4706,
376,
4704,
1115,
376,
1359,
29918,
5521,
4564,
414,
613,
13,
4706,
376,
3257,
1115,
376,
11536,
16012,
7392,
4564,
414,
613,
13,
4706,
376,
5338,
1115,
5591,
29894,
29896,
29889,
29900,
19248,
1289,
29875,
6822,
1359,
5521,
4564,
414,
29914,
370,
2929,
329,
295,
326,
1169,
613,
13,
4706,
376,
29517,
1115,
376,
7827,
29918,
1359,
29918,
5521,
4564,
414,
613,
13,
4706,
376,
4925,
1115,
5852,
29892,
13,
4706,
376,
2084,
1115,
376,
23552,
1839,
29428,
29933,
1964,
2190,
29907,
1001,
29918,
5265,
26349,
2033,
613,
13,
4706,
376,
23552,
29918,
2084,
1115,
376,
23552,
613,
13,
4706,
376,
1767,
29918,
1989,
1115,
12633,
13,
4706,
376,
23552,
29918,
1853,
1115,
376,
1761,
613,
13,
4706,
376,
13400,
29918,
1989,
1115,
376,
29428,
29933,
1964,
2190,
29907,
1001,
29918,
5265,
26349,
29908,
13,
1678,
2981,
426,
13,
4706,
376,
4704,
1115,
376,
1359,
29918,
5521,
4564,
414,
613,
13,
4706,
376,
3257,
1115,
376,
20284,
639,
365,
29933,
613,
13,
4706,
376,
5338,
1115,
5591,
29894,
29896,
29889,
29900,
19248,
1289,
29875,
6822,
1359,
5521,
4564,
414,
29914,
370,
2929,
329,
295,
326,
1169,
613,
13,
4706,
376,
29517,
1115,
376,
18010,
29918,
546,
29918,
27728,
613,
13,
4706,
376,
4925,
1115,
5852,
29892,
13,
4706,
376,
2084,
1115,
376,
23552,
1839,
6632,
2287,
29918,
5265,
26349,
2033,
613,
13,
4706,
376,
23552,
29918,
2084,
1115,
376,
23552,
613,
13,
4706,
376,
1767,
29918,
1989,
1115,
12633,
13,
4706,
376,
23552,
29918,
1853,
1115,
376,
1761,
613,
13,
4706,
376,
13400,
29918,
1989,
1115,
376,
6632,
2287,
29918,
5265,
26349,
29908,
13,
1678,
500,
13,
29962,
13,
13,
695,
29890,
29918,
13400,
29918,
2457,
353,
426,
13,
1678,
376,
23552,
1115,
518,
13,
4706,
426,
13,
9651,
376,
978,
1115,
376,
5690,
29963,
29953,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29906,
29945,
13,
4706,
2981,
426,
13,
9651,
376,
978,
1115,
376,
29428,
29933,
1964,
2190,
29907,
1001,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29906,
29945,
13,
4706,
2981,
426,
13,
9651,
376,
978,
1115,
376,
29933,
14789,
29918,
2287,
18476,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29896,
29900,
13,
4706,
2981,
426,
13,
9651,
376,
978,
1115,
376,
2477,
23524,
29918,
24360,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29896,
29900,
29900,
13,
4706,
2981,
426,
13,
9651,
376,
978,
1115,
376,
6632,
2287,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29906,
29945,
13,
4706,
2981,
426,
13,
9651,
376,
978,
1115,
376,
6632,
2287,
29918,
2303,
6040,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29906,
29945,
13,
4706,
2981,
426,
13,
9651,
376,
978,
1115,
376,
29428,
29933,
1964,
2190,
29907,
1001,
29918,
2303,
6040,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29906,
29945,
13,
4706,
2981,
426,
13,
9651,
376,
978,
1115,
376,
29907,
20161,
6545,
2965,
3040,
29918,
1529,
18009,
4214,
29918,
5265,
26349,
613,
13,
9651,
376,
1767,
1115,
29871,
29906,
29900,
13,
4706,
500,
13,
1678,
4514,
13,
29913,
13,
13,
695,
29890,
29918,
1761,
29918,
2457,
353,
426,
13,
1678,
376,
1359,
22031,
4564,
414,
1115,
518,
13,
4706,
426,
13,
9651,
376,
4882,
1115,
376,
17923,
18474,
613,
13,
9651,
376,
21402,
1115,
426,
13,
18884,
376,
2230,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29953,
29901,
29900,
29946,
29901,
29946,
29946,
29999,
29908,
13,
9651,
2981,
13,
9651,
376,
20464,
1115,
376,
10493,
613,
13,
9651,
376,
978,
1115,
376,
1688,
613,
13,
9651,
376,
20567,
1115,
376,
1307,
28938,
29918,
6007,
8186,
9838,
29903,
613,
13,
9651,
376,
11600,
1115,
426,
13,
18884,
376,
2230,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29953,
29901,
29900,
29946,
29901,
29946,
29946,
29999,
29908,
13,
9651,
2981,
13,
9651,
376,
18714,
29902,
567,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
666,
6594,
1115,
376,
5690,
29963,
29946,
613,
13,
462,
1678,
376,
1853,
1115,
376,
7056,
13367,
2965,
613,
13,
462,
1678,
376,
333,
1115,
29871,
29896,
29929,
29947,
29955,
29945,
29892,
13,
462,
1678,
376,
7328,
1115,
376,
29896,
29955,
29906,
29889,
29896,
29953,
29889,
29941,
29896,
29889,
29896,
29900,
29908,
13,
18884,
2981,
426,
13,
462,
1678,
376,
666,
6594,
1115,
376,
5690,
29963,
29953,
613,
13,
462,
1678,
376,
1853,
1115,
376,
7056,
13367,
2965,
613,
13,
462,
1678,
376,
333,
1115,
29871,
29929,
29941,
29896,
29947,
29941,
29906,
29945,
29892,
13,
462,
1678,
376,
7328,
1115,
376,
11512,
29900,
29900,
29901,
29883,
29906,
29890,
29953,
29901,
29890,
29906,
29946,
29890,
29901,
915,
29953,
29955,
29901,
29906,
29947,
29906,
29955,
29901,
29953,
29947,
29947,
29881,
29901,
29872,
29953,
29874,
29896,
29901,
29953,
29874,
29941,
29890,
29908,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
333,
1115,
29871,
29945,
29900,
29953,
29946,
29929,
29955,
29892,
13,
9651,
376,
15619,
1115,
29871,
29941,
29900,
29892,
13,
9651,
376,
3177,
3981,
1115,
29871,
29900,
29892,
13,
9651,
376,
637,
1115,
29871,
29947,
29900,
13,
4706,
500,
13,
1678,
4514,
13,
29913,
13,
13,
695,
29890,
29918,
8159,
29918,
2457,
353,
426,
13,
1678,
525,
1359,
29918,
5521,
4564,
414,
2396,
426,
13,
4706,
525,
5975,
2396,
11117,
11536,
16012,
7392,
4564,
414,
2396,
29871,
29896,
1118,
13,
4706,
525,
12514,
2396,
11117,
11536,
16012,
7392,
4564,
414,
2396,
29871,
29906,
29945,
29892,
525,
20284,
639,
365,
29933,
2396,
29871,
29906,
29945,
29913,
13,
1678,
500,
13,
29913,
13,
13,
15945,
29908,
1816,
874,
9995,
13,
13,
2974,
353,
426,
13,
1678,
376,
3257,
1115,
376,
1748,
874,
613,
13,
1678,
376,
375,
29918,
2271,
1115,
376,
991,
597,
375,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
2679,
29918,
2271,
1115,
376,
991,
597,
2679,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
4925,
1115,
5852,
29892,
13,
1678,
376,
2585,
29918,
978,
1115,
376,
643,
874,
613,
13,
1678,
376,
12277,
29918,
12803,
1115,
5852,
29892,
13,
1678,
376,
1514,
29918,
2271,
1115,
376,
991,
597,
1514,
29889,
1688,
29889,
510,
613,
13,
1678,
376,
29886,
2335,
29888,
548,
29918,
2271,
1115,
376,
991,
597,
29886,
2335,
29888,
548,
29889,
2271,
613,
13,
1678,
376,
13400,
29918,
10339,
1115,
5159,
13,
29913,
13,
13,
2974,
29918,
13400,
353,
518,
13,
1678,
426,
13,
4706,
376,
4704,
1115,
376,
643,
874,
613,
13,
4706,
376,
3257,
1115,
376,
1748,
874,
613,
13,
4706,
376,
5338,
1115,
5591,
29894,
29906,
19248,
1289,
29875,
6822,
12514,
613,
13,
4706,
376,
29517,
1115,
376,
643,
874,
613,
13,
4706,
376,
4925,
1115,
5852,
29892,
13,
4706,
376,
2084,
1115,
376,
23552,
1839,
3317,
11536,
3379,
2925,
2033,
613,
13,
4706,
376,
23552,
29918,
2084,
1115,
376,
12514,
29889,
23552,
613,
13,
4706,
376,
1767,
29918,
1989,
1115,
12633,
13,
4706,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
4706,
376,
13400,
29918,
1989,
1115,
376,
3317,
11536,
3379,
2925,
29908,
13,
1678,
2981,
426,
13,
4706,
376,
4704,
1115,
376,
643,
874,
613,
13,
4706,
376,
3257,
1115,
376,
25207,
8527,
29879,
613,
13,
4706,
376,
5338,
1115,
5591,
29894,
29906,
19248,
1289,
29875,
6822,
12514,
613,
13,
4706,
376,
29517,
1115,
376,
9053,
29918,
11618,
29879,
613,
13,
4706,
376,
4925,
1115,
5852,
29892,
13,
4706,
376,
2084,
1115,
376,
23552,
1839,
3317,
11536,
25207,
13724,
29879,
2033,
613,
13,
4706,
376,
23552,
29918,
2084,
1115,
376,
12514,
29889,
23552,
613,
13,
4706,
376,
1767,
29918,
1989,
1115,
12633,
13,
4706,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
4706,
376,
13400,
29918,
1989,
1115,
376,
3317,
11536,
25207,
13724,
29879,
29908,
13,
1678,
2981,
426,
13,
4706,
376,
4704,
1115,
376,
643,
874,
613,
13,
4706,
376,
3257,
1115,
376,
29934,
314,
448,
13232,
613,
13,
4706,
376,
5338,
1115,
5591,
29894,
29906,
19248,
1289,
29875,
6822,
12514,
613,
13,
4706,
376,
29517,
1115,
376,
2572,
29918,
29899,
29918,
8337,
613,
13,
4706,
376,
4925,
1115,
5852,
29892,
13,
4706,
376,
2084,
1115,
376,
23552,
1839,
3317,
11536,
25058,
3505,
2033,
613,
13,
4706,
376,
23552,
29918,
2084,
1115,
376,
12514,
29889,
23552,
613,
13,
4706,
376,
1767,
29918,
1989,
1115,
12633,
13,
4706,
376,
23552,
29918,
1853,
1115,
376,
8977,
613,
13,
4706,
376,
13400,
29918,
1989,
1115,
376,
3317,
11536,
25058,
3505,
29908,
13,
1678,
500,
13,
29962,
13,
13,
2974,
29918,
13400,
29918,
2457,
353,
426,
13,
1678,
376,
12514,
1115,
426,
13,
4706,
376,
10492,
1115,
518,
13,
9651,
426,
13,
18884,
376,
13087,
1115,
5591,
22896,
29914,
29962,
3877,
29973,
29938,
613,
13,
18884,
376,
13400,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
4622,
29899,
16515,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29953,
29901,
29896,
29946,
29901,
29946,
29955,
29889,
29953,
29906,
29946,
29999,
613,
13,
462,
4706,
376,
5441,
1115,
376,
16173,
26027,
613,
13,
462,
4706,
376,
18248,
1115,
376,
7194,
613,
13,
462,
4706,
376,
1745,
17225,
1115,
29871,
29906,
29906,
29900,
29900,
29892,
13,
462,
4706,
376,
1767,
1115,
29871,
29906,
29906,
29900,
29900,
13,
462,
1678,
500,
13,
18884,
21251,
13,
18884,
376,
5338,
1115,
376,
20605,
13,
9651,
2981,
426,
13,
18884,
376,
13087,
1115,
313,
13,
462,
1678,
5591,
29894,
22896,
29914,
10062,
29914,
22896,
29914,
10062,
29914,
643,
874,
29914,
4197,
29985,
29914,
10062,
6802,
336,
29916,
29899,
1039,
29899,
3027,
29899,
816,
11272,
29908,
13,
18884,
10353,
13,
18884,
376,
13400,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
4622,
29899,
16515,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29953,
29901,
29896,
29946,
29901,
29946,
29955,
29889,
29953,
29906,
29946,
29999,
613,
13,
462,
4706,
376,
5441,
1115,
376,
1660,
6007,
29928,
613,
13,
462,
4706,
376,
18248,
1115,
376,
5438,
613,
13,
462,
4706,
376,
1745,
17225,
1115,
29871,
29896,
29900,
29892,
13,
462,
4706,
376,
1767,
1115,
29871,
29896,
29900,
13,
462,
1678,
500,
13,
18884,
21251,
13,
18884,
376,
5338,
1115,
5591,
643,
874,
19248,
333,
6822,
336,
29916,
29899,
1039,
29899,
3027,
29899,
816,
11272,
29908,
13,
9651,
500,
13,
4706,
21251,
13,
4706,
376,
23552,
1115,
426,
13,
9651,
376,
3317,
7435,
2877,
3505,
1115,
29871,
29896,
29900,
29900,
29900,
29892,
13,
9651,
376,
3317,
11536,
29907,
2361,
1115,
448,
29896,
29892,
13,
9651,
376,
3317,
7435,
2877,
1115,
29871,
29945,
29892,
13,
9651,
376,
7827,
25207,
13724,
29879,
29965,
8485,
1115,
29871,
29896,
29892,
13,
9651,
376,
3317,
2940,
19346,
1115,
29871,
29946,
29900,
29892,
13,
9651,
376,
3317,
11536,
25207,
13724,
29879,
1115,
29871,
29896,
29900,
29892,
13,
9651,
376,
3317,
13228,
4782,
29934,
2540,
1115,
448,
29896,
29892,
13,
9651,
376,
3317,
11536,
2558,
29886,
7121,
1115,
29871,
29896,
29900,
29900,
29892,
13,
9651,
376,
7827,
25058,
29965,
8485,
1115,
29871,
29946,
29900,
29929,
29953,
29892,
13,
9651,
376,
3317,
13228,
24020,
1115,
448,
29896,
29892,
13,
9651,
376,
7827,
29943,
417,
1218,
29902,
567,
29965,
8485,
1115,
29871,
29900,
29892,
13,
9651,
376,
7827,
3379,
2925,
29965,
8485,
1115,
29871,
29941,
29892,
13,
9651,
376,
7827,
13228,
24020,
29965,
8485,
1115,
29871,
29900,
29892,
13,
9651,
376,
3317,
6004,
19346,
1115,
29871,
29946,
29900,
29892,
13,
9651,
376,
3317,
11536,
29943,
417,
1218,
29902,
567,
1115,
448,
29896,
29892,
13,
9651,
376,
3317,
11536,
3379,
2925,
1115,
29871,
29906,
29900,
29900,
29892,
13,
9651,
376,
7827,
29907,
2361,
29965,
8485,
1115,
29871,
29946,
29892,
13,
9651,
376,
3317,
11536,
25058,
3505,
1115,
29871,
29906,
29945,
29953,
29900,
29900,
29900,
13,
4706,
500,
13,
1678,
500,
13,
29913,
13,
13,
2974,
29918,
1761,
29918,
2457,
353,
426,
13,
1678,
376,
643,
874,
1115,
518,
13,
4706,
426,
13,
9651,
376,
3267,
29899,
12194,
29899,
1254,
29903,
29901,
7662,
29918,
3859,
1115,
6213,
29892,
13,
9651,
376,
7328,
267,
1115,
426,
13,
18884,
376,
3597,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
3259,
1115,
29871,
29946,
29892,
13,
462,
4706,
376,
10030,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29941,
29889,
29896,
29896,
29908,
13,
462,
1678,
2981,
426,
13,
462,
4706,
376,
3259,
1115,
29871,
29953,
29892,
13,
462,
4706,
376,
10030,
1115,
376,
13801,
29900,
29900,
29901,
29872,
29929,
29953,
29947,
29901,
29953,
29896,
29955,
29929,
1057,
311,
29945,
29906,
29901,
29955,
29896,
29900,
29900,
29908,
13,
462,
1678,
500,
13,
18884,
21251,
13,
18884,
376,
9053,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
3259,
1115,
29871,
29946,
29892,
13,
462,
4706,
376,
10030,
1115,
376,
29896,
29900,
29889,
29896,
29955,
29953,
29889,
29906,
29900,
29945,
29889,
29953,
29947,
29908,
13,
462,
1678,
500,
13,
18884,
4514,
13,
9651,
2981,
13,
9651,
376,
29888,
4112,
272,
1115,
426,
13,
18884,
376,
333,
1115,
376,
17492,
29896,
29899,
29896,
613,
13,
18884,
376,
4965,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
12653,
1115,
313,
13,
462,
9651,
376,
991,
597,
29875,
328,
29889,
643,
874,
29889,
2754,
29889,
22282,
3493,
9274,
29889,
510,
29908,
13,
462,
9651,
5591,
29955,
29953,
29953,
29900,
29941,
29900,
29914,
29888,
4112,
943,
29914,
17492,
29896,
29899,
29896,
29908,
13,
462,
4706,
10353,
13,
462,
4706,
376,
2674,
1115,
376,
2909,
3502,
29908,
13,
462,
1678,
500,
13,
18884,
4514,
13,
9651,
2981,
13,
9651,
376,
333,
1115,
376,
29941,
29906,
29929,
29900,
29872,
29945,
29900,
29881,
29899,
29947,
29947,
29947,
29888,
29899,
29946,
29945,
29900,
29900,
29899,
29874,
29929,
29941,
29946,
29899,
29896,
29953,
29883,
29896,
29900,
29888,
29941,
29890,
29947,
29874,
29896,
29900,
613,
13,
9651,
376,
1792,
29918,
333,
1115,
376,
29906,
29947,
29946,
29906,
29955,
29945,
613,
13,
9651,
376,
3267,
29899,
29928,
9207,
29901,
20960,
3991,
1115,
376,
1529,
11601,
1964,
613,
13,
9651,
376,
5943,
5690,
29894,
29946,
1115,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29941,
29889,
29896,
29896,
613,
13,
9651,
376,
5943,
5690,
29894,
29953,
1115,
376,
13801,
29900,
29900,
29901,
29872,
29929,
29953,
29947,
29901,
29953,
29896,
29955,
29929,
1057,
311,
29945,
29906,
29901,
29955,
29896,
29900,
29900,
613,
13,
9651,
376,
18035,
1115,
29871,
29896,
29900,
29900,
29892,
13,
9651,
376,
3267,
29899,
12194,
29899,
1254,
29903,
29901,
13519,
29918,
3859,
1115,
29871,
29896,
29892,
13,
9651,
376,
2917,
29918,
21594,
1115,
12633,
13,
9651,
376,
4882,
1115,
376,
17923,
18474,
613,
13,
9651,
376,
21402,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29945,
29901,
29896,
29953,
29901,
29941,
29955,
29999,
613,
13,
9651,
376,
978,
1115,
376,
1688,
29899,
2974,
613,
13,
9651,
376,
11600,
1115,
376,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29945,
29901,
29896,
29945,
29901,
29941,
29929,
29999,
613,
13,
9651,
376,
841,
424,
29918,
333,
1115,
376,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
613,
13,
9651,
376,
19635,
1115,
426,
13,
18884,
376,
4282,
29918,
2917,
1115,
12633,
13,
18884,
376,
336,
29916,
29918,
5509,
29918,
5563,
29918,
17405,
362,
1115,
376,
17813,
29908,
13,
9651,
500,
13,
4706,
500,
13,
1678,
4514,
13,
29913,
13,
13,
2974,
29918,
1761,
29918,
5014,
287,
29918,
2457,
353,
518,
13,
1678,
426,
13,
4706,
525,
4882,
2396,
525,
17923,
18474,
742,
13,
4706,
525,
21402,
2396,
525,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29945,
29901,
29896,
29953,
29901,
29941,
29955,
29999,
742,
13,
4706,
525,
3267,
29899,
12194,
29899,
1254,
29903,
29901,
7662,
29918,
3859,
2396,
6213,
29892,
13,
4706,
525,
1792,
29918,
333,
2396,
525,
29906,
29947,
29946,
29906,
29955,
29945,
742,
13,
4706,
525,
7328,
267,
2396,
426,
13,
9651,
525,
3597,
2396,
518,
13,
18884,
426,
13,
462,
1678,
525,
3259,
2396,
29871,
29946,
29892,
13,
462,
1678,
525,
10030,
2396,
525,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29941,
29889,
29896,
29896,
29915,
13,
18884,
2981,
426,
13,
462,
1678,
525,
3259,
2396,
29871,
29953,
29892,
13,
462,
1678,
525,
10030,
2396,
525,
13801,
29900,
29900,
29901,
29872,
29929,
29953,
29947,
29901,
29953,
29896,
29955,
29929,
1057,
311,
29945,
29906,
29901,
29955,
29896,
29900,
29900,
29915,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
525,
9053,
2396,
518,
13,
18884,
426,
13,
462,
1678,
525,
3259,
2396,
29871,
29946,
29892,
13,
462,
1678,
525,
10030,
2396,
525,
29896,
29900,
29889,
29896,
29955,
29953,
29889,
29906,
29900,
29945,
29889,
29953,
29947,
29915,
13,
18884,
500,
13,
9651,
4514,
13,
4706,
2981,
13,
4706,
525,
11600,
2396,
525,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29896,
29906,
29911,
29896,
29945,
29901,
29896,
29945,
29901,
29941,
29929,
29999,
742,
13,
4706,
525,
841,
424,
29918,
333,
2396,
525,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
742,
13,
4706,
525,
3267,
29899,
29928,
9207,
29901,
20960,
3991,
2396,
525,
1529,
11601,
1964,
742,
13,
4706,
525,
333,
2396,
525,
29941,
29906,
29929,
29900,
29872,
29945,
29900,
29881,
29899,
29947,
29947,
29947,
29888,
29899,
29946,
29945,
29900,
29900,
29899,
29874,
29929,
29941,
29946,
29899,
29896,
29953,
29883,
29896,
29900,
29888,
29941,
29890,
29947,
29874,
29896,
29900,
742,
13,
4706,
525,
5943,
5690,
29894,
29946,
2396,
525,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29941,
29889,
29896,
29896,
742,
13,
4706,
525,
5943,
5690,
29894,
29953,
2396,
525,
13801,
29900,
29900,
29901,
29872,
29929,
29953,
29947,
29901,
29953,
29896,
29955,
29929,
1057,
311,
29945,
29906,
29901,
29955,
29896,
29900,
29900,
742,
13,
4706,
525,
2917,
29918,
21594,
2396,
15516,
13,
4706,
525,
18035,
2396,
29871,
29896,
29900,
29900,
29892,
13,
4706,
525,
3267,
29899,
12194,
29899,
1254,
29903,
29901,
13519,
29918,
3859,
2396,
29871,
29896,
29892,
13,
4706,
525,
19635,
2396,
426,
13,
9651,
525,
4282,
29918,
2917,
2396,
15516,
13,
9651,
525,
336,
29916,
29918,
5509,
29918,
5563,
29918,
17405,
362,
2396,
525,
17813,
29915,
13,
4706,
2981,
13,
4706,
525,
29888,
4112,
272,
2396,
426,
13,
9651,
525,
333,
2396,
525,
17492,
29896,
29899,
29896,
742,
13,
9651,
525,
4965,
2396,
518,
13,
18884,
426,
13,
462,
1678,
525,
12653,
2396,
313,
13,
462,
4706,
525,
991,
597,
29875,
328,
29889,
643,
874,
29889,
2754,
29889,
22282,
3493,
9274,
29889,
510,
29915,
13,
462,
4706,
8207,
29955,
29953,
29953,
29900,
29941,
29900,
29914,
29888,
4112,
943,
29914,
17492,
29896,
29899,
29896,
29915,
13,
462,
1678,
10353,
13,
462,
1678,
525,
2674,
2396,
525,
2909,
3502,
29915,
13,
18884,
500,
13,
9651,
4514,
13,
4706,
2981,
13,
4706,
525,
978,
2396,
525,
1688,
29899,
2974,
29915,
13,
1678,
500,
13,
29962,
13,
13,
11618,
29918,
1761,
29918,
2457,
353,
426,
13,
1678,
376,
11618,
29879,
1115,
518,
13,
4706,
426,
13,
9651,
376,
4882,
1115,
376,
17923,
18474,
613,
13,
9651,
376,
1491,
1212,
29879,
1115,
518,
13,
18884,
376,
29947,
29955,
29929,
600,
29906,
29947,
29900,
29899,
29953,
29888,
29896,
29955,
29899,
29946,
11512,
29947,
29899,
29890,
29953,
29947,
29946,
29899,
29896,
29929,
29906,
29941,
29955,
29881,
29947,
29947,
13801,
29946,
29945,
29908,
13,
9651,
21251,
13,
9651,
376,
978,
1115,
376,
1688,
29899,
11618,
613,
13,
9651,
376,
6406,
29918,
3859,
29918,
786,
1115,
5852,
29892,
13,
9651,
376,
841,
424,
29918,
333,
1115,
376,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
613,
13,
9651,
376,
12366,
1115,
7700,
29892,
13,
9651,
376,
333,
1115,
376,
29872,
29955,
29941,
29955,
29946,
29947,
29941,
29874,
29899,
29900,
29900,
29881,
29955,
29899,
29946,
29945,
29896,
29955,
29899,
2142,
29883,
29941,
29899,
6448,
29896,
29888,
1327,
6448,
29946,
2252,
29941,
29908,
13,
4706,
500,
13,
1678,
4514,
13,
29913,
13,
13,
11618,
29918,
5014,
287,
29918,
1761,
353,
518,
13,
1678,
426,
13,
4706,
525,
4882,
2396,
525,
17923,
18474,
742,
13,
4706,
525,
1491,
1212,
29879,
2396,
518,
13,
9651,
525,
29947,
29955,
29929,
600,
29906,
29947,
29900,
29899,
29953,
29888,
29896,
29955,
29899,
29946,
11512,
29947,
29899,
29890,
29953,
29947,
29946,
29899,
29896,
29929,
29906,
29941,
29955,
29881,
29947,
29947,
13801,
29946,
29945,
29915,
13,
4706,
21251,
13,
4706,
525,
978,
2396,
525,
1688,
29899,
11618,
742,
13,
4706,
525,
6406,
29918,
3859,
29918,
786,
2396,
5852,
29892,
13,
4706,
525,
841,
424,
29918,
333,
2396,
525,
29896,
29906,
29941,
29946,
29945,
29953,
29955,
742,
13,
4706,
525,
12366,
2396,
7700,
29892,
13,
4706,
525,
333,
2396,
525,
29872,
29955,
29941,
29955,
29946,
29947,
29941,
29874,
29899,
29900,
29900,
29881,
29955,
29899,
29946,
29945,
29896,
29955,
29899,
2142,
29883,
29941,
29899,
6448,
29896,
29888,
1327,
6448,
29946,
2252,
29941,
29915,
13,
1678,
500,
13,
29962,
13,
13,
2974,
29918,
29888,
4112,
272,
29918,
2457,
353,
426,
13,
1678,
376,
29888,
4112,
272,
1115,
426,
13,
4706,
376,
2572,
1115,
29871,
29896,
29900,
29906,
29946,
29892,
13,
4706,
376,
978,
1115,
376,
29896,
19289,
4593,
15247,
4220,
325,
29896,
613,
13,
4706,
376,
3267,
29899,
10536,
29963,
29899,
29956,
13054,
29899,
12194,
29899,
29903,
4162,
9295,
29901,
17833,
29918,
5965,
2395,
1115,
426,
13,
9651,
376,
4537,
29918,
974,
29918,
1272,
29918,
2218,
2039,
1115,
376,
29900,
613,
13,
9651,
376,
1990,
1115,
376,
17492,
29896,
613,
13,
9651,
376,
20960,
29918,
601,
29918,
2248,
1115,
376,
29946,
29900,
613,
13,
9651,
376,
22197,
29918,
1990,
1115,
376,
17492,
29918,
29888,
4112,
272,
29908,
13,
4706,
2981,
13,
4706,
376,
29894,
6814,
375,
1115,
29871,
29896,
29892,
13,
4706,
376,
26276,
1115,
12633,
13,
4706,
376,
29878,
486,
29916,
29918,
19790,
1115,
29871,
29906,
29900,
29900,
29889,
29900,
29892,
13,
4706,
376,
3267,
29899,
10536,
29963,
29899,
12194,
29899,
14573,
29901,
29872,
561,
331,
13537,
1115,
29871,
29900,
29892,
13,
4706,
376,
20960,
1115,
29871,
29906,
29900,
29892,
13,
4706,
376,
333,
1115,
376,
17492,
29896,
29899,
29896,
29908,
13,
1678,
500,
13,
29913,
13,
13,
2974,
29918,
8159,
29918,
2457,
353,
426,
13,
1678,
525,
643,
874,
2396,
426,
13,
4706,
525,
5975,
2396,
426,
13,
9651,
525,
25207,
8527,
29879,
2396,
29871,
29896,
29892,
13,
9651,
525,
29934,
314,
448,
13232,
2396,
29871,
29896,
29900,
29906,
29946,
29892,
13,
9651,
525,
1748,
874,
2396,
29871,
29896,
13,
4706,
2981,
13,
4706,
525,
12514,
2396,
426,
13,
9651,
525,
25207,
8527,
29879,
2396,
29871,
29896,
29900,
29892,
13,
9651,
525,
29934,
314,
448,
13232,
2396,
29871,
29906,
29945,
29953,
29900,
29900,
29900,
29892,
13,
9651,
525,
1748,
874,
2396,
29871,
29906,
29900,
29900,
13,
4706,
500,
13,
1678,
500,
13,
29913,
13,
2
] |
models.py | danger-ahead/notes-backend-service | 1 | 134936 | from sqlalchemy.orm import relationship
from sqlalchemy.sql.functions import now
from sqlalchemy.sql.schema import ForeignKey
from sqlalchemy.sql.sqltypes import TIMESTAMP
from database import Base
from sqlalchemy import Column, Integer, String
class Note(Base):
__tablename__ = "notes"
id = Column(Integer, primary_key=True, nullable=False)
title = Column(String, nullable=False)
content = Column(String, nullable=True)
created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=now())
last_updated_at = Column(
TIMESTAMP(timezone=True), nullable=False, server_default=now()
)
username = Column(
String, ForeignKey("users.username", ondelete="CASCADE"), nullable=False
)
user = relationship("User")
class User(Base):
__tablename__ = "users"
username = Column(String, nullable=False, unique=True, primary_key=True)
password = Column(String, nullable=False)
created_at = Column(TIMESTAMP(timezone=True), nullable=False, server_default=now())
| [
1,
515,
4576,
284,
305,
6764,
29889,
555,
1053,
9443,
13,
3166,
4576,
284,
305,
6764,
29889,
2850,
29889,
12171,
1053,
1286,
13,
3166,
4576,
284,
305,
6764,
29889,
2850,
29889,
11010,
1053,
19358,
2558,
13,
3166,
4576,
284,
305,
6764,
29889,
2850,
29889,
2850,
8768,
1053,
323,
8890,
1254,
19297,
13,
3166,
2566,
1053,
7399,
13,
3166,
4576,
284,
305,
6764,
1053,
12481,
29892,
8102,
29892,
1714,
13,
13,
13,
1990,
3940,
29898,
5160,
1125,
13,
1678,
4770,
3891,
2435,
420,
1649,
353,
376,
16953,
29908,
13,
13,
1678,
1178,
353,
12481,
29898,
7798,
29892,
7601,
29918,
1989,
29922,
5574,
29892,
1870,
519,
29922,
8824,
29897,
13,
1678,
3611,
353,
12481,
29898,
1231,
29892,
1870,
519,
29922,
8824,
29897,
13,
1678,
2793,
353,
12481,
29898,
1231,
29892,
1870,
519,
29922,
5574,
29897,
13,
1678,
2825,
29918,
271,
353,
12481,
29898,
15307,
1254,
19297,
29898,
2230,
8028,
29922,
5574,
511,
1870,
519,
29922,
8824,
29892,
1923,
29918,
4381,
29922,
3707,
3101,
13,
1678,
1833,
29918,
21402,
29918,
271,
353,
12481,
29898,
13,
4706,
323,
8890,
1254,
19297,
29898,
2230,
8028,
29922,
5574,
511,
1870,
519,
29922,
8824,
29892,
1923,
29918,
4381,
29922,
3707,
580,
13,
1678,
1723,
13,
1678,
8952,
353,
12481,
29898,
13,
4706,
1714,
29892,
19358,
2558,
703,
7193,
29889,
6786,
613,
373,
8143,
543,
29907,
3289,
5454,
2287,
4968,
1870,
519,
29922,
8824,
13,
1678,
1723,
13,
13,
1678,
1404,
353,
9443,
703,
2659,
1159,
13,
13,
13,
1990,
4911,
29898,
5160,
1125,
13,
1678,
4770,
3891,
2435,
420,
1649,
353,
376,
7193,
29908,
13,
13,
1678,
8952,
353,
12481,
29898,
1231,
29892,
1870,
519,
29922,
8824,
29892,
5412,
29922,
5574,
29892,
7601,
29918,
1989,
29922,
5574,
29897,
13,
1678,
4800,
353,
12481,
29898,
1231,
29892,
1870,
519,
29922,
8824,
29897,
13,
1678,
2825,
29918,
271,
353,
12481,
29898,
15307,
1254,
19297,
29898,
2230,
8028,
29922,
5574,
511,
1870,
519,
29922,
8824,
29892,
1923,
29918,
4381,
29922,
3707,
3101,
13,
2
] |
gui/verifyseed.py | roshan-c/shoeshive.tv | 2 | 162861 | import PySimpleGUI as sg
sg.theme('SandyBeach')
layout = [
[sg.Text('Please enter your Username and the Seed provided by the Host')],
[sg.Text('Username', size =(15, 1)), sg.InputText()],
[sg.Text('Server Seed', size =(15, 1)), sg.InputText()],
[sg.Submit(), sg.Cancel()]
]
window = sg.Window('Shoeshine.tv', layout)
event, values = window.read()
window.close()
username = values[0]
seedinput = values[1]
print(username)
print(seedinput)
connect = False
with open('seed.txt') as f:
seed = f.read()
print(seed)
if seed == seedinput:
connect = True
print('True')
f.close()
else:
connect = False
print('False')
f.close() | [
1,
1053,
10772,
15427,
29954,
3120,
408,
269,
29887,
30004,
13,
30004,
13,
5311,
29889,
18193,
877,
29903,
13910,
3629,
496,
1495,
418,
6756,
13,
2680,
353,
518,
30004,
13,
1678,
518,
5311,
29889,
1626,
877,
12148,
3896,
596,
4911,
978,
322,
278,
922,
287,
4944,
491,
278,
16956,
1495,
1402,
30004,
13,
1678,
518,
5311,
29889,
1626,
877,
20249,
742,
2159,
353,
29898,
29896,
29945,
29892,
29871,
29896,
8243,
269,
29887,
29889,
4290,
1626,
580,
1402,
30004,
13,
1678,
518,
5311,
29889,
1626,
877,
6004,
922,
287,
742,
2159,
353,
29898,
29896,
29945,
29892,
29871,
29896,
8243,
269,
29887,
29889,
4290,
1626,
580,
1402,
30004,
13,
1678,
518,
5311,
29889,
16228,
3285,
269,
29887,
29889,
19420,
580,
29962,
30004,
13,
29962,
30004,
13,
29871,
6756,
13,
7165,
353,
269,
29887,
29889,
5907,
877,
29903,
1251,
12094,
457,
29889,
12427,
742,
5912,
8443,
13,
3696,
29892,
1819,
353,
3474,
29889,
949,
26471,
13,
7165,
29889,
5358,
26471,
13,
30004,
13,
6786,
353,
1819,
29961,
29900,
29962,
30004,
13,
26776,
2080,
353,
1819,
29961,
29896,
29962,
30004,
13,
30004,
13,
2158,
29898,
6786,
8443,
13,
2158,
29898,
26776,
2080,
8443,
13,
30004,
13,
6915,
353,
7700,
30004,
13,
2541,
1722,
877,
26776,
29889,
3945,
1495,
408,
285,
29901,
30004,
13,
1678,
16717,
353,
285,
29889,
949,
26471,
13,
1678,
1596,
29898,
26776,
8443,
13,
30004,
13,
361,
16717,
1275,
16717,
2080,
29901,
30004,
13,
1678,
4511,
353,
5852,
30004,
13,
1678,
1596,
877,
5574,
1495,
30004,
13,
1678,
285,
29889,
5358,
26471,
13,
2870,
29901,
30004,
13,
1678,
4511,
353,
7700,
30004,
13,
1678,
1596,
877,
8824,
1495,
30004,
13,
1678,
285,
29889,
5358,
580,
2
] |
Curso_Coursera/Ex1_ParImpar.py | shirleyguimaraes/Linguagem_Python | 0 | 33098 |
def main():
n = int(input("Digite um número inteiro: "))
resto = n % 2
if resto == 0:
print("Par")
else:
print("Impar")
main()
| [
1,
6756,
13,
1753,
1667,
7295,
30004,
13,
30004,
13,
1678,
302,
353,
938,
29898,
2080,
703,
14991,
568,
1922,
13831,
2293,
3350,
29901,
376,
876,
30004,
13,
30004,
13,
1678,
25814,
353,
302,
1273,
29871,
29906,
30004,
13,
30004,
13,
1678,
565,
25814,
1275,
29871,
29900,
29901,
30004,
13,
4706,
1596,
703,
2177,
1159,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
1596,
703,
1888,
862,
1159,
30004,
13,
30004,
13,
30004,
13,
3396,
26471,
13,
2
] |
cttools/config.py | nik849/ct-tools | 0 | 74928 | import numpy as np
from .parse import parse_xtekct_file
class Config(object):
def __init__(self):
""" Configuration object which contains all settings neccessary for the forward projection
and tomographic reconstruction using the axitom algorithm.
"""
self.n_voxels_x = 2000
self.n_voxels_y = 2000
self.n_voxels_z = 2000
self.object_size_x = 27.229675726
self.object_size_y = 27.229675726
self.object_size_z = 27.229675726
self.n_pixels_u = 2000
self.n_pixels_v = 2000
self.detector_size_u = 400.
self.detector_size_v = 400.
self.source_to_detector_dist = 797.8693
self.source_to_object_dist = 95.1665735244751
self.angular_inc = 1.
self.pixel_offset_u = 0
self.pixel_offset_v = 0
self.center_of_rot_y = 0
self.projection_angs = np.arange(0., 360, self.angular_inc)
self.n_projections = len(self.projection_angs)
self.voxel_size_x = self.object_size_x / self.n_voxels_x
self.voxel_size_y = self.object_size_y / self.n_voxels_y
self.voxel_size_z = self.object_size_z / self.n_voxels_z
self.pixel_size_u = self.detector_size_u / self.n_pixels_u
self.pixel_size_v = self.detector_size_v / self.n_pixels_v
self.object_xs = (np.arange(self.n_voxels_x, dtype=np.float32) - self.n_voxels_x / 2.) * self.voxel_size_x
self.object_ys = (np.arange(self.n_voxels_y, dtype=np.float32) - self.n_voxels_y / 2.) * self.voxel_size_y
self.object_zs = (np.arange(self.n_voxels_z, dtype=np.float32) - self.n_voxels_z / 2.) * self.voxel_size_z
self.detector_us = (np.arange(self.n_pixels_u,
dtype=np.float32) - self.n_pixels_u / 2.) * self.pixel_size_u + self.pixel_offset_u * self.pixel_size_u
self.detector_vs = (np.arange(self.n_pixels_v,
dtype=np.float32) - self.n_pixels_v / 2.) * self.pixel_size_v + self.pixel_offset_v * self.pixel_size_v
def update(self):
self.projection_angs = np.arange(0., 360, self.angular_inc)
self.n_projections = len(self.projection_angs)
self.voxel_size_x = self.object_size_x / self.n_voxels_x
self.voxel_size_y = self.object_size_y / self.n_voxels_y
self.voxel_size_z = self.object_size_z / self.n_voxels_z
self.pixel_size_u = self.detector_size_u / self.n_pixels_u
self.pixel_size_v = self.detector_size_v / self.n_pixels_v
self.object_xs = (np.arange(self.n_voxels_x, dtype=np.float32) - self.n_voxels_x / 2.) * self.voxel_size_x
self.object_ys = (np.arange(self.n_voxels_y, dtype=np.float32) - self.n_voxels_y / 2.) * self.voxel_size_y
self.object_zs = (np.arange(self.n_voxels_z, dtype=np.float32) - self.n_voxels_z / 2.) * self.voxel_size_z
self.detector_us = (np.arange(self.n_pixels_u,
dtype=np.float32) - self.n_pixels_u / 2.) * self.pixel_size_u + self.pixel_offset_u * self.pixel_size_u
self.detector_vs = (np.arange(self.n_pixels_v,
dtype=np.float32) - self.n_pixels_v / 2.) * self.pixel_size_v + self.pixel_offset_v * self.pixel_size_v
def config_from_xtekct(file_path):
""" Make config object from a Nikon X-tek CT input file
The .xtekct file is parsed and a config file containing all relevant settings is returned.
Parameters
----------
file_path : str
The path to the .xtekct file
Returns
-------
obj
Config object
"""
inputfile = parse_xtekct_file(file_path)
conf = Config()
try:
conf.n_voxels_x = inputfile["VoxelsX"]
conf.n_voxels_y = inputfile["VoxelsY"]
conf.n_voxels_z = inputfile["VoxelsZ"]
conf.object_size_x = inputfile["VoxelSizeX"] * conf.n_voxels_x
conf.object_size_y = inputfile["VoxelSizeY"] * conf.n_voxels_y
conf.object_size_z = inputfile["VoxelSizeZ"] * conf.n_voxels_z
conf.n_pixels_u = inputfile["DetectorPixelsX"]
conf.n_pixels_v = inputfile["DetectorPixelsY"]
conf.detector_size_u = inputfile["DetectorPixelSizeX"] * conf.n_pixels_u
conf.detector_size_v = inputfile["DetectorPixelSizeY"] * conf.n_pixels_v
conf.source_to_detector_dist = inputfile["SrcToDetector"]
conf.source_to_object_dist = inputfile["SrcToObject"]
except Exception as e:
raise IOError("Parsing of X-tec file failed with key: ", e)
return conf
| [
1,
1053,
12655,
408,
7442,
13,
3166,
869,
5510,
1053,
6088,
29918,
29916,
12681,
312,
29918,
1445,
13,
13,
13,
1990,
12782,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
9995,
20999,
1203,
607,
3743,
599,
6055,
452,
1676,
653,
363,
278,
6375,
18246,
13,
9651,
322,
6454,
12122,
17789,
4080,
773,
278,
4853,
277,
290,
5687,
29889,
13,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
353,
29871,
29906,
29900,
29900,
29900,
13,
4706,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
353,
29871,
29906,
29900,
29900,
29900,
13,
4706,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
353,
29871,
29906,
29900,
29900,
29900,
13,
13,
4706,
1583,
29889,
3318,
29918,
2311,
29918,
29916,
353,
29871,
29906,
29955,
29889,
29906,
29906,
29929,
29953,
29955,
29945,
29955,
29906,
29953,
13,
4706,
1583,
29889,
3318,
29918,
2311,
29918,
29891,
353,
29871,
29906,
29955,
29889,
29906,
29906,
29929,
29953,
29955,
29945,
29955,
29906,
29953,
13,
4706,
1583,
29889,
3318,
29918,
2311,
29918,
29920,
353,
29871,
29906,
29955,
29889,
29906,
29906,
29929,
29953,
29955,
29945,
29955,
29906,
29953,
13,
13,
4706,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
353,
29871,
29906,
29900,
29900,
29900,
13,
4706,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
353,
29871,
29906,
29900,
29900,
29900,
13,
13,
4706,
1583,
29889,
4801,
3019,
29918,
2311,
29918,
29884,
353,
29871,
29946,
29900,
29900,
29889,
13,
4706,
1583,
29889,
4801,
3019,
29918,
2311,
29918,
29894,
353,
29871,
29946,
29900,
29900,
29889,
13,
4706,
1583,
29889,
4993,
29918,
517,
29918,
4801,
3019,
29918,
5721,
353,
29871,
29955,
29929,
29955,
29889,
29947,
29953,
29929,
29941,
13,
4706,
1583,
29889,
4993,
29918,
517,
29918,
3318,
29918,
5721,
353,
29871,
29929,
29945,
29889,
29896,
29953,
29953,
29945,
29955,
29941,
29945,
29906,
29946,
29946,
29955,
29945,
29896,
13,
4706,
1583,
29889,
6825,
29918,
3742,
353,
29871,
29896,
29889,
13,
13,
4706,
1583,
29889,
29886,
15711,
29918,
10289,
29918,
29884,
353,
29871,
29900,
13,
4706,
1583,
29889,
29886,
15711,
29918,
10289,
29918,
29894,
353,
29871,
29900,
13,
13,
4706,
1583,
29889,
5064,
29918,
974,
29918,
5450,
29918,
29891,
353,
29871,
29900,
13,
13,
4706,
1583,
29889,
771,
6929,
29918,
25128,
353,
7442,
29889,
279,
927,
29898,
29900,
1696,
29871,
29941,
29953,
29900,
29892,
1583,
29889,
6825,
29918,
3742,
29897,
13,
4706,
1583,
29889,
29876,
29918,
771,
24247,
353,
7431,
29898,
1311,
29889,
771,
6929,
29918,
25128,
29897,
13,
13,
4706,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29916,
353,
1583,
29889,
3318,
29918,
2311,
29918,
29916,
847,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
13,
4706,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29891,
353,
1583,
29889,
3318,
29918,
2311,
29918,
29891,
847,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
13,
4706,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29920,
353,
1583,
29889,
3318,
29918,
2311,
29918,
29920,
847,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
13,
13,
4706,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29884,
353,
1583,
29889,
4801,
3019,
29918,
2311,
29918,
29884,
847,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
13,
4706,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29894,
353,
1583,
29889,
4801,
3019,
29918,
2311,
29918,
29894,
847,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
13,
13,
4706,
1583,
29889,
3318,
29918,
10351,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
847,
29871,
29906,
1846,
334,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29916,
13,
4706,
1583,
29889,
3318,
29918,
952,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
847,
29871,
29906,
1846,
334,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29891,
13,
4706,
1583,
29889,
3318,
29918,
22381,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
847,
29871,
29906,
1846,
334,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29920,
13,
13,
4706,
1583,
29889,
4801,
3019,
29918,
375,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
29892,
13,
462,
462,
418,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
847,
29871,
29906,
1846,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29884,
718,
1583,
29889,
29886,
15711,
29918,
10289,
29918,
29884,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29884,
13,
4706,
1583,
29889,
4801,
3019,
29918,
4270,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
29892,
13,
462,
462,
418,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
847,
29871,
29906,
1846,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29894,
718,
1583,
29889,
29886,
15711,
29918,
10289,
29918,
29894,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29894,
13,
13,
1678,
822,
2767,
29898,
1311,
1125,
13,
4706,
1583,
29889,
771,
6929,
29918,
25128,
353,
7442,
29889,
279,
927,
29898,
29900,
1696,
29871,
29941,
29953,
29900,
29892,
1583,
29889,
6825,
29918,
3742,
29897,
13,
4706,
1583,
29889,
29876,
29918,
771,
24247,
353,
7431,
29898,
1311,
29889,
771,
6929,
29918,
25128,
29897,
13,
13,
4706,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29916,
353,
1583,
29889,
3318,
29918,
2311,
29918,
29916,
847,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
13,
4706,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29891,
353,
1583,
29889,
3318,
29918,
2311,
29918,
29891,
847,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
13,
4706,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29920,
353,
1583,
29889,
3318,
29918,
2311,
29918,
29920,
847,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
13,
13,
4706,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29884,
353,
1583,
29889,
4801,
3019,
29918,
2311,
29918,
29884,
847,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
13,
4706,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29894,
353,
1583,
29889,
4801,
3019,
29918,
2311,
29918,
29894,
847,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
13,
13,
4706,
1583,
29889,
3318,
29918,
10351,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
847,
29871,
29906,
1846,
334,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29916,
13,
4706,
1583,
29889,
3318,
29918,
952,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
847,
29871,
29906,
1846,
334,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29891,
13,
4706,
1583,
29889,
3318,
29918,
22381,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
29892,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
847,
29871,
29906,
1846,
334,
1583,
29889,
1365,
29916,
295,
29918,
2311,
29918,
29920,
13,
13,
4706,
1583,
29889,
4801,
3019,
29918,
375,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
29892,
13,
462,
462,
418,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
847,
29871,
29906,
1846,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29884,
718,
1583,
29889,
29886,
15711,
29918,
10289,
29918,
29884,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29884,
13,
4706,
1583,
29889,
4801,
3019,
29918,
4270,
353,
313,
9302,
29889,
279,
927,
29898,
1311,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
29892,
13,
462,
462,
418,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
448,
1583,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
847,
29871,
29906,
1846,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29894,
718,
1583,
29889,
29886,
15711,
29918,
10289,
29918,
29894,
334,
1583,
29889,
29886,
15711,
29918,
2311,
29918,
29894,
13,
13,
13,
1753,
2295,
29918,
3166,
29918,
29916,
12681,
312,
29898,
1445,
29918,
2084,
1125,
13,
1678,
9995,
8561,
2295,
1203,
515,
263,
405,
10344,
1060,
29899,
12681,
26637,
1881,
934,
13,
13,
4706,
450,
869,
29916,
12681,
312,
934,
338,
21213,
322,
263,
2295,
934,
6943,
599,
8018,
6055,
338,
4133,
29889,
13,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
934,
29918,
2084,
584,
851,
13,
9651,
450,
2224,
304,
278,
869,
29916,
12681,
312,
934,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
5446,
13,
9651,
12782,
1203,
13,
13,
4706,
9995,
13,
13,
1678,
1881,
1445,
353,
6088,
29918,
29916,
12681,
312,
29918,
1445,
29898,
1445,
29918,
2084,
29897,
13,
1678,
1970,
353,
12782,
580,
13,
13,
1678,
1018,
29901,
13,
4706,
1970,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
353,
1881,
1445,
3366,
29963,
2251,
1379,
29990,
3108,
13,
4706,
1970,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
353,
1881,
1445,
3366,
29963,
2251,
1379,
29979,
3108,
13,
4706,
1970,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
353,
1881,
1445,
3366,
29963,
2251,
1379,
29999,
3108,
13,
13,
4706,
1970,
29889,
3318,
29918,
2311,
29918,
29916,
353,
1881,
1445,
3366,
29963,
2251,
295,
3505,
29990,
3108,
334,
1970,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29916,
13,
4706,
1970,
29889,
3318,
29918,
2311,
29918,
29891,
353,
1881,
1445,
3366,
29963,
2251,
295,
3505,
29979,
3108,
334,
1970,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29891,
13,
4706,
1970,
29889,
3318,
29918,
2311,
29918,
29920,
353,
1881,
1445,
3366,
29963,
2251,
295,
3505,
29999,
3108,
334,
1970,
29889,
29876,
29918,
1365,
29916,
1379,
29918,
29920,
13,
13,
4706,
1970,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
353,
1881,
1445,
3366,
6362,
3019,
29925,
861,
1379,
29990,
3108,
13,
4706,
1970,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
353,
1881,
1445,
3366,
6362,
3019,
29925,
861,
1379,
29979,
3108,
13,
13,
4706,
1970,
29889,
4801,
3019,
29918,
2311,
29918,
29884,
353,
1881,
1445,
3366,
6362,
3019,
29637,
3505,
29990,
3108,
334,
1970,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29884,
13,
4706,
1970,
29889,
4801,
3019,
29918,
2311,
29918,
29894,
353,
1881,
1445,
3366,
6362,
3019,
29637,
3505,
29979,
3108,
334,
1970,
29889,
29876,
29918,
29886,
861,
1379,
29918,
29894,
13,
13,
4706,
1970,
29889,
4993,
29918,
517,
29918,
4801,
3019,
29918,
5721,
353,
1881,
1445,
3366,
29903,
2214,
1762,
6362,
3019,
3108,
13,
4706,
1970,
29889,
4993,
29918,
517,
29918,
3318,
29918,
5721,
353,
1881,
1445,
3366,
29903,
2214,
1762,
2061,
3108,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
12020,
10663,
2392,
703,
29925,
1503,
292,
310,
1060,
29899,
371,
29883,
934,
5229,
411,
1820,
29901,
9162,
321,
29897,
13,
13,
1678,
736,
1970,
13,
2
] |
tests/basic_store.py | fmarczin/simplekv | 0 | 134401 | <gh_stars>0
# coding: utf8
import os
import time
import tempfile
from tempdir import TempDir
import pytest
from simplekv._compat import BytesIO, xrange, text_type
from simplekv.decorator import PrefixDecorator
from simplekv.crypt import HMACDecorator
from simplekv.idgen import UUIDDecorator, HashDecorator
from simplekv import CopyMixin
class BasicStore(object):
def test_store(self, store, key, value):
key = store.put(key, value)
assert isinstance(key, text_type)
def test_unicode_store(self, store, key, unicode_value):
with pytest.raises(IOError):
store.put(key, unicode_value)
def test_store_and_retrieve(self, store, key, value):
store.put(key, value)
assert store.get(key) == value
def test_store_and_retrieve_filelike(self, store, key, value):
store.put_file(key, BytesIO(value))
assert store.get(key) == value
def test_store_and_retrieve_overwrite(self, store, key, value, value2):
store.put_file(key, BytesIO(value))
assert store.get(key) == value
store.put(key, value2)
assert store.get(key) == value2
def test_store_and_open(self, store, key, value):
store.put_file(key, BytesIO(value))
assert store.open(key).read() == value
def test_store_and_copy(self, store, key, key2, value):
if not isinstance(store, CopyMixin):
pytest.skip()
store.put(key, value)
assert store.get(key) == value
store.copy(key, key2)
assert store.get(key) == value
assert store.get(key2) == value
def test_store_and_copy_overwrite(self, store, key, key2,
value, value2):
if not isinstance(store, CopyMixin):
pytest.skip()
store.put(key, value)
store.put(key2, value2)
assert store.get(key) == value
assert store.get(key2) == value2
store.copy(key, key2)
assert store.get(key) == value
assert store.get(key2) == value
def test_open_incremental_read(self, store, key, long_value):
store.put_file(key, BytesIO(long_value))
ok = store.open(key)
assert long_value[:3] == ok.read(3)
assert long_value[3:5] == ok.read(2)
assert long_value[5:8] == ok.read(3)
def test_bytestring_key_store(self, store, bytestring_key, value):
with pytest.raises(ValueError):
store.put(bytestring_key, value)
def test_key_error_on_nonexistant_get(self, store, key):
with pytest.raises(KeyError):
store.get(key)
def test_key_error_on_nonexistant_copy(self, store, key, key2):
if not isinstance(store, CopyMixin):
pytest.skip()
with pytest.raises(KeyError):
store.copy(key, key2)
def test_key_error_on_nonexistant_open(self, store, key):
with pytest.raises(KeyError):
store.open(key)
def test_key_error_on_nonexistant_get_file(self, store, key):
with pytest.raises(KeyError):
store.get_file(key, BytesIO())
def test_key_error_on_nonexistant_get_filename(self, store, key):
with pytest.raises(KeyError):
store.get_file(key, '/dev/null')
def test_exception_on_invalid_key_get(self, store, invalid_key):
with pytest.raises(ValueError):
store.get(invalid_key)
def test_exception_on_invalid_key_copy(self, store, invalid_key, key):
if not isinstance(store, CopyMixin):
pytest.skip()
with pytest.raises(ValueError):
store.copy(invalid_key, key)
with pytest.raises(ValueError):
store.copy(key, invalid_key)
def test_exception_on_invalid_key_get_file(self, store, invalid_key):
with pytest.raises(ValueError):
store.get_file(invalid_key, '/dev/null')
def test_exception_on_invalid_key_delete(self, store, invalid_key):
with pytest.raises(ValueError):
store.delete(invalid_key)
def test_put_file(self, store, key, value):
tmp = tempfile.NamedTemporaryFile(delete=False)
try:
tmp.write(value)
tmp.close()
store.put_file(key, tmp.name)
assert store.get(key) == value
finally:
if os.path.exists(tmp.name):
os.unlink(tmp.name)
def test_put_opened_file(self, store, key, value):
with tempfile.NamedTemporaryFile() as tmp:
tmp.write(value)
tmp.flush()
store.put_file(key, open(tmp.name, 'rb'))
assert store.get(key) == value
def test_get_into_file(self, store, key, value):
with TempDir() as tmpdir:
store.put(key, value)
out_filename = os.path.join(tmpdir, 'output')
store.get_file(key, out_filename)
assert open(out_filename, 'rb').read() == value
def test_get_into_stream(self, store, key, value):
store.put(key, value)
output = BytesIO()
store.get_file(key, output)
assert output.getvalue() == value
def test_put_return_value(self, store, key, value):
assert key == store.put(key, value)
def test_put_file_return_value(self, store, key, value):
assert key == store.put_file(key, BytesIO(value))
def test_put_filename_return_value(self, store, key, value):
tmp = tempfile.NamedTemporaryFile(delete=False)
try:
tmp.write(value)
tmp.close()
assert key == store.put_file(key, tmp.name)
finally:
if os.path.exists(tmp.name):
os.unlink(tmp.name)
def test_delete(self, store, key, value):
store.put(key, value)
assert value == store.get(key)
store.delete(key)
with pytest.raises(KeyError):
store.get(key)
def test_multiple_delete_fails_without_error(self, store, key, value):
store.put(key, value)
store.delete(key)
store.delete(key)
store.delete(key)
def test_can_delete_key_that_never_exists(self, store, key):
store.delete(key)
def test_key_iterator(self, store, key, key2, value, value2):
store.put(key, value)
store.put(key2, value2)
l = []
for k in store.iter_keys():
assert isinstance(k, text_type)
l.append(k)
l.sort()
assert l == sorted([key, key2])
def test_key_iterator_with_prefix(self, store, key, key2, value):
prefix = key
key_prefix_1 = prefix + '_key1'
key_prefix_2 = prefix + '_key2'
store.put(key_prefix_1, value)
store.put(key_prefix_2, value)
store.put(key2, value)
l = []
for k in store.iter_keys():
l.append(k)
l.sort()
assert l == sorted([key_prefix_1, key_prefix_2, key2])
l = []
for k in store.iter_keys(prefix):
l.append(k)
l.sort()
assert l == sorted([key_prefix_1, key_prefix_2])
def test_keys(self, store, key, key2, value, value2):
store.put(key, value)
store.put(key2, value2)
l = sorted(store.keys())
for k in l:
assert isinstance(k, text_type)
assert l == sorted([key, key2])
def test_keys_with_prefix(self, store, key, key2, value):
prefix = key
key_prefix_1 = prefix + '_key1'
key_prefix_2 = prefix + '_key2'
store.put(key_prefix_1, value)
store.put(key_prefix_2, value)
store.put(key2, value)
l = sorted(store.keys())
assert l == sorted([key_prefix_1, key_prefix_2, key2])
l = sorted(store.keys(prefix))
assert l == sorted([key_prefix_1, key_prefix_2])
def test_has_key(self, store, key, key2, value):
store.put(key, value)
assert key in store
assert key2 not in store
def test_has_key_with_delete(self, store, key, value):
assert key not in store
store.put(key, value)
assert key in store
store.delete(key)
assert key not in store
store.put(key, value)
assert key in store
def test_get_with_delete(self, store, key, value):
with pytest.raises(KeyError):
store.get(key)
store.put(key, value)
store.get(key)
store.delete(key)
with pytest.raises(KeyError):
store.get(key)
store.put(key, value)
store.get(key)
def test_max_key_length(self, store, max_key, value):
new_key = store.put(max_key, value)
assert new_key == max_key
assert value == store.get(max_key)
def test_a_lot_of_puts(self, store, key, value):
a_lot = 20
for i in xrange(a_lot):
key = key + '_{}'.format(i)
store.put(key, value)
# small extra time added to account for variance
TTL_MARGIN = 1
class TTLStore(object):
@pytest.fixture
def ustore(self, store):
return UUIDDecorator(store)
@pytest.fixture(params=['hash', 'uuid', 'hmac', 'prefix'])
def dstore(self, request, store, secret_key):
if request.param == 'hash':
return HashDecorator(store)
elif request.param == 'uuid':
return self.ustore(store)
elif request.param == 'hmac':
return HMACDecorator(secret_key, store)
elif request.param == 'prefix':
return PrefixDecorator('SaMpLe_PrEfIX', store)
@pytest.fixture(params=[0.4, 1])
def small_ttl(self, request):
return request.param
def test_put_with_negative_ttl_throws_error(self, store, key, value):
with pytest.raises(ValueError):
store.put(key, value, ttl_secs=-1)
def test_put_with_non_numeric_ttl_throws_error(self, store, key, value):
with pytest.raises(ValueError):
store.put(key, value, ttl_secs='badttl')
def test_put_with_ttl_argument(self, store, key, value, small_ttl):
store.put(key, value, small_ttl)
time.sleep(small_ttl + TTL_MARGIN)
with pytest.raises(KeyError):
store.get(key)
def test_put_set_default(self, store, key, value, small_ttl):
store.default_ttl_secs = small_ttl
store.put(key, value)
time.sleep(small_ttl + TTL_MARGIN)
with pytest.raises(KeyError):
store.get(key)
def test_put_file_with_ttl_argument(self, store, key, value, small_ttl):
store.put_file(key, BytesIO(value), small_ttl)
time.sleep(small_ttl + TTL_MARGIN)
with pytest.raises(KeyError):
store.get(key)
def test_put_file_set_default(self, store, key, value, small_ttl):
store.default_ttl_secs = small_ttl
store.put_file(key, BytesIO(value))
time.sleep(small_ttl + TTL_MARGIN)
with pytest.raises(KeyError):
store.get(key)
def test_uuid_decorator(self, ustore, value):
key = ustore.put(None, value)
assert key
def test_advertises_ttl_features(self, store):
assert store.ttl_support is True
assert hasattr(store, 'ttl_support')
assert getattr(store, 'ttl_support') is True
def test_advertises_ttl_features_through_decorator(self, dstore):
assert dstore.ttl_support is True
assert hasattr(dstore, 'ttl_support')
assert getattr(dstore, 'ttl_support') is True
def test_can_pass_ttl_through_decorator(self, dstore, key, value):
dstore.put(key, value, ttl_secs=10)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14137,
29901,
23616,
29947,
13,
13,
5215,
2897,
13,
5215,
931,
13,
5215,
5694,
1445,
13,
3166,
5694,
3972,
1053,
21121,
9170,
13,
13,
5215,
11451,
1688,
13,
3166,
2560,
27049,
3032,
12667,
1053,
2648,
2167,
5971,
29892,
921,
3881,
29892,
1426,
29918,
1853,
13,
3166,
2560,
27049,
29889,
19557,
1061,
1053,
349,
9569,
6185,
272,
1061,
13,
3166,
2560,
27049,
29889,
29883,
4641,
1053,
379,
1529,
29907,
6185,
272,
1061,
13,
3166,
2560,
27049,
29889,
333,
1885,
1053,
501,
11150,
6185,
272,
1061,
29892,
11874,
6185,
272,
1061,
13,
3166,
2560,
27049,
1053,
14187,
29924,
861,
262,
13,
13,
13,
1990,
19219,
9044,
29898,
3318,
1125,
13,
1678,
822,
1243,
29918,
8899,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
1820,
353,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
4974,
338,
8758,
29898,
1989,
29892,
1426,
29918,
1853,
29897,
13,
13,
1678,
822,
1243,
29918,
2523,
356,
29918,
8899,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
29104,
29918,
1767,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
5971,
2392,
1125,
13,
9651,
3787,
29889,
649,
29898,
1989,
29892,
29104,
29918,
1767,
29897,
13,
13,
1678,
822,
1243,
29918,
8899,
29918,
392,
29918,
276,
509,
2418,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
8899,
29918,
392,
29918,
276,
509,
2418,
29918,
1445,
4561,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
29898,
1767,
876,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
8899,
29918,
392,
29918,
276,
509,
2418,
29918,
957,
3539,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
29892,
995,
29906,
1125,
13,
4706,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
29898,
1767,
876,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29906,
29897,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
29906,
13,
13,
1678,
822,
1243,
29918,
8899,
29918,
392,
29918,
3150,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
29898,
1767,
876,
13,
4706,
4974,
3787,
29889,
3150,
29898,
1989,
467,
949,
580,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
8899,
29918,
392,
29918,
8552,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
29892,
995,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
8899,
29892,
14187,
29924,
861,
262,
1125,
13,
9651,
11451,
1688,
29889,
11014,
580,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
4706,
3787,
29889,
8552,
29898,
1989,
29892,
1820,
29906,
29897,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29906,
29897,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
8899,
29918,
392,
29918,
8552,
29918,
957,
3539,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
29892,
13,
462,
462,
418,
995,
29892,
995,
29906,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
8899,
29892,
14187,
29924,
861,
262,
1125,
13,
9651,
11451,
1688,
29889,
11014,
580,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
3787,
29889,
649,
29898,
1989,
29906,
29892,
995,
29906,
29897,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29906,
29897,
1275,
995,
29906,
13,
4706,
3787,
29889,
8552,
29898,
1989,
29892,
1820,
29906,
29897,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
4706,
4974,
3787,
29889,
657,
29898,
1989,
29906,
29897,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
3150,
29918,
25629,
284,
29918,
949,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1472,
29918,
1767,
1125,
13,
4706,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
29898,
5426,
29918,
1767,
876,
13,
4706,
3431,
353,
3787,
29889,
3150,
29898,
1989,
29897,
13,
4706,
4974,
1472,
29918,
1767,
7503,
29941,
29962,
1275,
3431,
29889,
949,
29898,
29941,
29897,
13,
4706,
4974,
1472,
29918,
1767,
29961,
29941,
29901,
29945,
29962,
1275,
3431,
29889,
949,
29898,
29906,
29897,
13,
4706,
4974,
1472,
29918,
1767,
29961,
29945,
29901,
29947,
29962,
1275,
3431,
29889,
949,
29898,
29941,
29897,
13,
13,
1678,
822,
1243,
29918,
1609,
1688,
5393,
29918,
1989,
29918,
8899,
29898,
1311,
29892,
3787,
29892,
491,
1688,
5393,
29918,
1989,
29892,
995,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
649,
29898,
1609,
1688,
5393,
29918,
1989,
29892,
995,
29897,
13,
13,
1678,
822,
1243,
29918,
1989,
29918,
2704,
29918,
265,
29918,
9290,
29916,
22137,
29918,
657,
29898,
1311,
29892,
3787,
29892,
1820,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
1989,
29918,
2704,
29918,
265,
29918,
9290,
29916,
22137,
29918,
8552,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
8899,
29892,
14187,
29924,
861,
262,
1125,
13,
9651,
11451,
1688,
29889,
11014,
580,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
8552,
29898,
1989,
29892,
1820,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1989,
29918,
2704,
29918,
265,
29918,
9290,
29916,
22137,
29918,
3150,
29898,
1311,
29892,
3787,
29892,
1820,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
3150,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
1989,
29918,
2704,
29918,
265,
29918,
9290,
29916,
22137,
29918,
657,
29918,
1445,
29898,
1311,
29892,
3787,
29892,
1820,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
3101,
13,
13,
1678,
822,
1243,
29918,
1989,
29918,
2704,
29918,
265,
29918,
9290,
29916,
22137,
29918,
657,
29918,
9507,
29898,
1311,
29892,
3787,
29892,
1820,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29918,
1445,
29898,
1989,
29892,
8207,
3359,
29914,
4304,
1495,
13,
13,
1678,
822,
1243,
29918,
11739,
29918,
265,
29918,
20965,
29918,
1989,
29918,
657,
29898,
1311,
29892,
3787,
29892,
8340,
29918,
1989,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
20965,
29918,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
11739,
29918,
265,
29918,
20965,
29918,
1989,
29918,
8552,
29898,
1311,
29892,
3787,
29892,
8340,
29918,
1989,
29892,
1820,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
8899,
29892,
14187,
29924,
861,
262,
1125,
13,
9651,
11451,
1688,
29889,
11014,
580,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
8552,
29898,
20965,
29918,
1989,
29892,
1820,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
8552,
29898,
1989,
29892,
8340,
29918,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
11739,
29918,
265,
29918,
20965,
29918,
1989,
29918,
657,
29918,
1445,
29898,
1311,
29892,
3787,
29892,
8340,
29918,
1989,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
657,
29918,
1445,
29898,
20965,
29918,
1989,
29892,
8207,
3359,
29914,
4304,
1495,
13,
13,
1678,
822,
1243,
29918,
11739,
29918,
265,
29918,
20965,
29918,
1989,
29918,
8143,
29898,
1311,
29892,
3787,
29892,
8340,
29918,
1989,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
8143,
29898,
20965,
29918,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
1445,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
13128,
353,
5694,
1445,
29889,
22175,
5776,
1971,
653,
2283,
29898,
8143,
29922,
8824,
29897,
13,
4706,
1018,
29901,
13,
9651,
13128,
29889,
3539,
29898,
1767,
29897,
13,
9651,
13128,
29889,
5358,
580,
13,
13,
9651,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
13128,
29889,
978,
29897,
13,
13,
9651,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
4706,
7146,
29901,
13,
9651,
565,
2897,
29889,
2084,
29889,
9933,
29898,
7050,
29889,
978,
1125,
13,
18884,
2897,
29889,
348,
2324,
29898,
7050,
29889,
978,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
3150,
287,
29918,
1445,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
411,
5694,
1445,
29889,
22175,
5776,
1971,
653,
2283,
580,
408,
13128,
29901,
13,
9651,
13128,
29889,
3539,
29898,
1767,
29897,
13,
9651,
13128,
29889,
23126,
580,
13,
13,
9651,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
1722,
29898,
7050,
29889,
978,
29892,
525,
6050,
8785,
13,
13,
9651,
4974,
3787,
29889,
657,
29898,
1989,
29897,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
8941,
29918,
1445,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
411,
21121,
9170,
580,
408,
13128,
3972,
29901,
13,
9651,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
9651,
714,
29918,
9507,
353,
2897,
29889,
2084,
29889,
7122,
29898,
7050,
3972,
29892,
525,
4905,
1495,
13,
13,
9651,
3787,
29889,
657,
29918,
1445,
29898,
1989,
29892,
714,
29918,
9507,
29897,
13,
13,
9651,
4974,
1722,
29898,
449,
29918,
9507,
29892,
525,
6050,
2824,
949,
580,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
8941,
29918,
5461,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
13,
4706,
1962,
353,
2648,
2167,
5971,
580,
13,
13,
4706,
3787,
29889,
657,
29918,
1445,
29898,
1989,
29892,
1962,
29897,
13,
4706,
4974,
1962,
29889,
657,
1767,
580,
1275,
995,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
2457,
29918,
1767,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
4974,
1820,
1275,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
1445,
29918,
2457,
29918,
1767,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
4974,
1820,
1275,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
29898,
1767,
876,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
9507,
29918,
2457,
29918,
1767,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
13128,
353,
5694,
1445,
29889,
22175,
5776,
1971,
653,
2283,
29898,
8143,
29922,
8824,
29897,
13,
4706,
1018,
29901,
13,
9651,
13128,
29889,
3539,
29898,
1767,
29897,
13,
9651,
13128,
29889,
5358,
580,
13,
13,
9651,
4974,
1820,
1275,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
13128,
29889,
978,
29897,
13,
4706,
7146,
29901,
13,
9651,
565,
2897,
29889,
2084,
29889,
9933,
29898,
7050,
29889,
978,
1125,
13,
18884,
2897,
29889,
348,
2324,
29898,
7050,
29889,
978,
29897,
13,
13,
1678,
822,
1243,
29918,
8143,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
13,
4706,
4974,
995,
1275,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
4706,
3787,
29889,
8143,
29898,
1989,
29897,
13,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
20787,
29918,
8143,
29918,
29888,
2234,
29918,
14037,
29918,
2704,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
13,
4706,
3787,
29889,
8143,
29898,
1989,
29897,
13,
4706,
3787,
29889,
8143,
29898,
1989,
29897,
13,
4706,
3787,
29889,
8143,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
8143,
29918,
1989,
29918,
5747,
29918,
484,
369,
29918,
9933,
29898,
1311,
29892,
3787,
29892,
1820,
1125,
13,
4706,
3787,
29889,
8143,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
1989,
29918,
17609,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
29892,
995,
29892,
995,
29906,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
3787,
29889,
649,
29898,
1989,
29906,
29892,
995,
29906,
29897,
13,
13,
4706,
301,
353,
5159,
13,
4706,
363,
413,
297,
3787,
29889,
1524,
29918,
8149,
7295,
13,
9651,
4974,
338,
8758,
29898,
29895,
29892,
1426,
29918,
1853,
29897,
13,
9651,
301,
29889,
4397,
29898,
29895,
29897,
13,
13,
4706,
301,
29889,
6605,
580,
13,
13,
4706,
4974,
301,
1275,
12705,
4197,
1989,
29892,
1820,
29906,
2314,
13,
13,
1678,
822,
1243,
29918,
1989,
29918,
17609,
29918,
2541,
29918,
13506,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
29892,
995,
1125,
13,
4706,
10944,
353,
1820,
13,
4706,
1820,
29918,
13506,
29918,
29896,
353,
10944,
718,
22868,
1989,
29896,
29915,
13,
4706,
1820,
29918,
13506,
29918,
29906,
353,
10944,
718,
22868,
1989,
29906,
29915,
13,
4706,
3787,
29889,
649,
29898,
1989,
29918,
13506,
29918,
29896,
29892,
995,
29897,
13,
4706,
3787,
29889,
649,
29898,
1989,
29918,
13506,
29918,
29906,
29892,
995,
29897,
13,
4706,
3787,
29889,
649,
29898,
1989,
29906,
29892,
995,
29897,
13,
13,
4706,
301,
353,
5159,
13,
4706,
363,
413,
297,
3787,
29889,
1524,
29918,
8149,
7295,
13,
9651,
301,
29889,
4397,
29898,
29895,
29897,
13,
4706,
301,
29889,
6605,
580,
13,
13,
4706,
4974,
301,
1275,
12705,
4197,
1989,
29918,
13506,
29918,
29896,
29892,
1820,
29918,
13506,
29918,
29906,
29892,
1820,
29906,
2314,
13,
13,
4706,
301,
353,
5159,
13,
4706,
363,
413,
297,
3787,
29889,
1524,
29918,
8149,
29898,
13506,
1125,
13,
9651,
301,
29889,
4397,
29898,
29895,
29897,
13,
4706,
301,
29889,
6605,
580,
13,
4706,
4974,
301,
1275,
12705,
4197,
1989,
29918,
13506,
29918,
29896,
29892,
1820,
29918,
13506,
29918,
29906,
2314,
13,
13,
1678,
822,
1243,
29918,
8149,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
29892,
995,
29892,
995,
29906,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
3787,
29889,
649,
29898,
1989,
29906,
29892,
995,
29906,
29897,
13,
13,
4706,
301,
353,
12705,
29898,
8899,
29889,
8149,
3101,
13,
4706,
363,
413,
297,
301,
29901,
13,
9651,
4974,
338,
8758,
29898,
29895,
29892,
1426,
29918,
1853,
29897,
13,
13,
4706,
4974,
301,
1275,
12705,
4197,
1989,
29892,
1820,
29906,
2314,
13,
13,
1678,
822,
1243,
29918,
8149,
29918,
2541,
29918,
13506,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
29892,
995,
1125,
13,
4706,
10944,
353,
1820,
13,
4706,
1820,
29918,
13506,
29918,
29896,
353,
10944,
718,
22868,
1989,
29896,
29915,
13,
4706,
1820,
29918,
13506,
29918,
29906,
353,
10944,
718,
22868,
1989,
29906,
29915,
13,
4706,
3787,
29889,
649,
29898,
1989,
29918,
13506,
29918,
29896,
29892,
995,
29897,
13,
4706,
3787,
29889,
649,
29898,
1989,
29918,
13506,
29918,
29906,
29892,
995,
29897,
13,
4706,
3787,
29889,
649,
29898,
1989,
29906,
29892,
995,
29897,
13,
13,
4706,
301,
353,
12705,
29898,
8899,
29889,
8149,
3101,
13,
4706,
4974,
301,
1275,
12705,
4197,
1989,
29918,
13506,
29918,
29896,
29892,
1820,
29918,
13506,
29918,
29906,
29892,
1820,
29906,
2314,
13,
13,
4706,
301,
353,
12705,
29898,
8899,
29889,
8149,
29898,
13506,
876,
13,
4706,
4974,
301,
1275,
12705,
4197,
1989,
29918,
13506,
29918,
29896,
29892,
1820,
29918,
13506,
29918,
29906,
2314,
13,
13,
1678,
822,
1243,
29918,
5349,
29918,
1989,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
1820,
29906,
29892,
995,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
13,
4706,
4974,
1820,
297,
3787,
13,
4706,
4974,
1820,
29906,
451,
297,
3787,
13,
13,
1678,
822,
1243,
29918,
5349,
29918,
1989,
29918,
2541,
29918,
8143,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
4974,
1820,
451,
297,
3787,
13,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
4974,
1820,
297,
3787,
13,
13,
4706,
3787,
29889,
8143,
29898,
1989,
29897,
13,
4706,
4974,
1820,
451,
297,
3787,
13,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
4974,
1820,
297,
3787,
13,
13,
1678,
822,
1243,
29918,
657,
29918,
2541,
29918,
8143,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
4706,
3787,
29889,
8143,
29898,
1989,
29897,
13,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
4706,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
3317,
29918,
1989,
29918,
2848,
29898,
1311,
29892,
3787,
29892,
4236,
29918,
1989,
29892,
995,
1125,
13,
4706,
716,
29918,
1989,
353,
3787,
29889,
649,
29898,
3317,
29918,
1989,
29892,
995,
29897,
13,
13,
4706,
4974,
716,
29918,
1989,
1275,
4236,
29918,
1989,
13,
4706,
4974,
995,
1275,
3787,
29889,
657,
29898,
3317,
29918,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
29874,
29918,
8276,
29918,
974,
29918,
649,
29879,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
263,
29918,
8276,
353,
29871,
29906,
29900,
13,
13,
4706,
363,
474,
297,
921,
3881,
29898,
29874,
29918,
8276,
1125,
13,
9651,
1820,
353,
1820,
718,
525,
648,
29913,
4286,
4830,
29898,
29875,
29897,
13,
9651,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
13,
13,
29937,
2319,
4805,
931,
2715,
304,
3633,
363,
20162,
13,
29911,
14632,
29918,
1529,
29934,
29954,
1177,
353,
29871,
29896,
13,
13,
13,
1990,
323,
14632,
9044,
29898,
3318,
1125,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
13,
1678,
822,
318,
8899,
29898,
1311,
29892,
3787,
1125,
13,
4706,
736,
501,
11150,
6185,
272,
1061,
29898,
8899,
29897,
13,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
29898,
7529,
29922,
1839,
8568,
742,
525,
25118,
742,
525,
7184,
562,
742,
525,
13506,
11287,
13,
1678,
822,
270,
8899,
29898,
1311,
29892,
2009,
29892,
3787,
29892,
7035,
29918,
1989,
1125,
13,
4706,
565,
2009,
29889,
3207,
1275,
525,
8568,
2396,
13,
9651,
736,
11874,
6185,
272,
1061,
29898,
8899,
29897,
13,
4706,
25342,
2009,
29889,
3207,
1275,
525,
25118,
2396,
13,
9651,
736,
1583,
29889,
504,
487,
29898,
8899,
29897,
13,
4706,
25342,
2009,
29889,
3207,
1275,
525,
7184,
562,
2396,
13,
9651,
736,
379,
1529,
29907,
6185,
272,
1061,
29898,
19024,
29918,
1989,
29892,
3787,
29897,
13,
4706,
25342,
2009,
29889,
3207,
1275,
525,
13506,
2396,
13,
9651,
736,
349,
9569,
6185,
272,
1061,
877,
17618,
29924,
29886,
3226,
29918,
4040,
29923,
29888,
6415,
742,
3787,
29897,
13,
13,
1678,
732,
2272,
1688,
29889,
7241,
15546,
29898,
7529,
11759,
29900,
29889,
29946,
29892,
29871,
29896,
2314,
13,
1678,
822,
2319,
29918,
698,
29880,
29898,
1311,
29892,
2009,
1125,
13,
4706,
736,
2009,
29889,
3207,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
2541,
29918,
22198,
29918,
698,
29880,
29918,
386,
5727,
29918,
2704,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
649,
29898,
1989,
29892,
995,
29892,
260,
15206,
29918,
344,
2395,
10457,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
2541,
29918,
5464,
29918,
21574,
29918,
698,
29880,
29918,
386,
5727,
29918,
2704,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
1125,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
1125,
13,
9651,
3787,
29889,
649,
29898,
1989,
29892,
995,
29892,
260,
15206,
29918,
344,
2395,
2433,
12313,
698,
29880,
1495,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
2541,
29918,
698,
29880,
29918,
23516,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
29892,
2319,
29918,
698,
29880,
1125,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29892,
2319,
29918,
698,
29880,
29897,
13,
13,
4706,
931,
29889,
17059,
29898,
9278,
29918,
698,
29880,
718,
323,
14632,
29918,
1529,
29934,
29954,
1177,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
842,
29918,
4381,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
29892,
2319,
29918,
698,
29880,
1125,
13,
4706,
3787,
29889,
4381,
29918,
698,
29880,
29918,
344,
2395,
353,
2319,
29918,
698,
29880,
13,
13,
4706,
3787,
29889,
649,
29898,
1989,
29892,
995,
29897,
13,
13,
4706,
931,
29889,
17059,
29898,
9278,
29918,
698,
29880,
718,
323,
14632,
29918,
1529,
29934,
29954,
1177,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
1445,
29918,
2541,
29918,
698,
29880,
29918,
23516,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
29892,
2319,
29918,
698,
29880,
1125,
13,
4706,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
29898,
1767,
511,
2319,
29918,
698,
29880,
29897,
13,
13,
4706,
931,
29889,
17059,
29898,
9278,
29918,
698,
29880,
718,
323,
14632,
29918,
1529,
29934,
29954,
1177,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
1445,
29918,
842,
29918,
4381,
29898,
1311,
29892,
3787,
29892,
1820,
29892,
995,
29892,
2319,
29918,
698,
29880,
1125,
13,
4706,
3787,
29889,
4381,
29918,
698,
29880,
29918,
344,
2395,
353,
2319,
29918,
698,
29880,
13,
13,
4706,
3787,
29889,
649,
29918,
1445,
29898,
1989,
29892,
2648,
2167,
5971,
29898,
1767,
876,
13,
13,
4706,
931,
29889,
17059,
29898,
9278,
29918,
698,
29880,
718,
323,
14632,
29918,
1529,
29934,
29954,
1177,
29897,
13,
4706,
411,
11451,
1688,
29889,
336,
4637,
29898,
2558,
2392,
1125,
13,
9651,
3787,
29889,
657,
29898,
1989,
29897,
13,
13,
1678,
822,
1243,
29918,
25118,
29918,
19557,
1061,
29898,
1311,
29892,
318,
8899,
29892,
995,
1125,
13,
4706,
1820,
353,
318,
8899,
29889,
649,
29898,
8516,
29892,
995,
29897,
13,
13,
4706,
4974,
1820,
13,
13,
1678,
822,
1243,
29918,
328,
1765,
4637,
29918,
698,
29880,
29918,
22100,
29898,
1311,
29892,
3787,
1125,
13,
4706,
4974,
3787,
29889,
698,
29880,
29918,
5924,
338,
5852,
13,
4706,
4974,
756,
5552,
29898,
8899,
29892,
525,
698,
29880,
29918,
5924,
1495,
13,
4706,
4974,
679,
5552,
29898,
8899,
29892,
525,
698,
29880,
29918,
5924,
1495,
338,
5852,
13,
13,
1678,
822,
1243,
29918,
328,
1765,
4637,
29918,
698,
29880,
29918,
22100,
29918,
20678,
29918,
19557,
1061,
29898,
1311,
29892,
270,
8899,
1125,
13,
4706,
4974,
270,
8899,
29889,
698,
29880,
29918,
5924,
338,
5852,
13,
4706,
4974,
756,
5552,
29898,
29881,
8899,
29892,
525,
698,
29880,
29918,
5924,
1495,
13,
4706,
4974,
679,
5552,
29898,
29881,
8899,
29892,
525,
698,
29880,
29918,
5924,
1495,
338,
5852,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
3364,
29918,
698,
29880,
29918,
20678,
29918,
19557,
1061,
29898,
1311,
29892,
270,
8899,
29892,
1820,
29892,
995,
1125,
13,
4706,
270,
8899,
29889,
649,
29898,
1989,
29892,
995,
29892,
260,
15206,
29918,
344,
2395,
29922,
29896,
29900,
29897,
13,
2
] |
usermess/migrations/0002_auto_20181111_2211.py | HemanthJella/ewallet | 0 | 138956 | # Generated by Django 2.1.2 on 2018-11-11 22:11
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('usermess', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='couponsbought',
name='boughtTime',
field=models.DateTimeField(default=datetime.datetime(2018, 11, 11, 22, 11, 23, 928786)),
),
migrations.AlterField(
model_name='couponsbought',
name='couponId',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='mess.Coupons'),
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29906,
29889,
29896,
29889,
29906,
373,
29871,
29906,
29900,
29896,
29947,
29899,
29896,
29896,
29899,
29896,
29896,
29871,
29906,
29906,
29901,
29896,
29896,
30004,
13,
30004,
13,
5215,
12865,
30004,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
30004,
13,
5215,
9557,
29889,
2585,
29889,
9794,
29889,
311,
1026,
291,
30004,
13,
30004,
13,
30004,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
30004,
13,
30004,
13,
1678,
9962,
353,
518,
30004,
13,
4706,
6702,
375,
837,
404,
742,
525,
29900,
29900,
29900,
29896,
29918,
11228,
5477,
30004,
13,
1678,
4514,
30004,
13,
30004,
13,
1678,
6931,
353,
518,
30004,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
30004,
13,
9651,
1904,
29918,
978,
2433,
29883,
1132,
787,
29890,
1774,
23592,
13,
9651,
1024,
2433,
29890,
1774,
2481,
23592,
13,
9651,
1746,
29922,
9794,
29889,
11384,
3073,
29898,
4381,
29922,
12673,
29889,
12673,
29898,
29906,
29900,
29896,
29947,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29896,
29892,
29871,
29906,
29906,
29892,
29871,
29896,
29896,
29892,
29871,
29906,
29941,
29892,
29871,
29929,
29906,
29947,
29955,
29947,
29953,
8243,
30004,
13,
4706,
10353,
30004,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
30004,
13,
9651,
1904,
29918,
978,
2433,
29883,
1132,
787,
29890,
1774,
23592,
13,
9651,
1024,
2433,
16589,
1112,
1204,
23592,
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,
12062,
29889,
29907,
1132,
787,
5477,
30004,
13,
4706,
10353,
30004,
13,
1678,
4514,
30004,
13,
2
] |
sdk/python/pulumi_aiven/get_service_user.py | pulumi/pulumi-aiven | 7 | 180868 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities
__all__ = [
'GetServiceUserResult',
'AwaitableGetServiceUserResult',
'get_service_user',
]
@pulumi.output_type
class GetServiceUserResult:
"""
A collection of values returned by getServiceUser.
"""
def __init__(__self__, access_cert=None, access_key=None, authentication=None, id=None, password=<PASSWORD>, project=None, redis_acl_categories=None, redis_acl_channels=None, redis_acl_commands=None, redis_acl_keys=None, service_name=None, type=None, username=None):
if access_cert and not isinstance(access_cert, str):
raise TypeError("Expected argument 'access_cert' to be a str")
pulumi.set(__self__, "access_cert", access_cert)
if access_key and not isinstance(access_key, str):
raise TypeError("Expected argument 'access_key' to be a str")
pulumi.set(__self__, "access_key", access_key)
if authentication and not isinstance(authentication, str):
raise TypeError("Expected argument 'authentication' to be a str")
pulumi.set(__self__, "authentication", authentication)
if id and not isinstance(id, str):
raise TypeError("Expected argument 'id' to be a str")
pulumi.set(__self__, "id", id)
if password and not isinstance(password, str):
raise TypeError("Expected argument 'password' to be a str")
pulumi.set(__self__, "password", password)
if project and not isinstance(project, str):
raise TypeError("Expected argument 'project' to be a str")
pulumi.set(__self__, "project", project)
if redis_acl_categories and not isinstance(redis_acl_categories, list):
raise TypeError("Expected argument 'redis_acl_categories' to be a list")
pulumi.set(__self__, "redis_acl_categories", redis_acl_categories)
if redis_acl_channels and not isinstance(redis_acl_channels, list):
raise TypeError("Expected argument 'redis_acl_channels' to be a list")
pulumi.set(__self__, "redis_acl_channels", redis_acl_channels)
if redis_acl_commands and not isinstance(redis_acl_commands, list):
raise TypeError("Expected argument 'redis_acl_commands' to be a list")
pulumi.set(__self__, "redis_acl_commands", redis_acl_commands)
if redis_acl_keys and not isinstance(redis_acl_keys, list):
raise TypeError("Expected argument 'redis_acl_keys' to be a list")
pulumi.set(__self__, "redis_acl_keys", redis_acl_keys)
if service_name and not isinstance(service_name, str):
raise TypeError("Expected argument 'service_name' to be a str")
pulumi.set(__self__, "service_name", service_name)
if type and not isinstance(type, str):
raise TypeError("Expected argument 'type' to be a str")
pulumi.set(__self__, "type", type)
if username and not isinstance(username, str):
raise TypeError("Expected argument 'username' to be a str")
pulumi.set(__self__, "username", username)
@property
@pulumi.getter(name="accessCert")
def access_cert(self) -> str:
"""
is the access certificate of the user (not applicable for all services).
"""
return pulumi.get(self, "access_cert")
@property
@pulumi.getter(name="accessKey")
def access_key(self) -> str:
"""
is the access key of the user (not applicable for all services).
"""
return pulumi.get(self, "access_key")
@property
@pulumi.getter
def authentication(self) -> Optional[str]:
return pulumi.get(self, "authentication")
@property
@pulumi.getter
def id(self) -> str:
"""
The provider-assigned unique ID for this managed resource.
"""
return pulumi.get(self, "id")
@property
@pulumi.getter
def password(self) -> str:
"""
is the password of the user (not applicable for all services).
"""
return pulumi.get(self, "password")
@property
@pulumi.getter
def project(self) -> str:
return pulumi.get(self, "project")
@property
@pulumi.getter(name="redisAclCategories")
def redis_acl_categories(self) -> Optional[Sequence[str]]:
"""
Redis specific field, defines command category rules.
"""
return pulumi.get(self, "redis_acl_categories")
@property
@pulumi.getter(name="redisAclChannels")
def redis_acl_channels(self) -> Optional[Sequence[str]]:
return pulumi.get(self, "redis_acl_channels")
@property
@pulumi.getter(name="redisAclCommands")
def redis_acl_commands(self) -> Optional[Sequence[str]]:
"""
Redis specific field, defines rules for individual commands.
"""
return pulumi.get(self, "redis_acl_commands")
@property
@pulumi.getter(name="redisAclKeys")
def redis_acl_keys(self) -> Optional[Sequence[str]]:
"""
Redis specific field, defines key access rules.
"""
return pulumi.get(self, "redis_acl_keys")
@property
@pulumi.getter(name="serviceName")
def service_name(self) -> str:
return pulumi.get(self, "service_name")
@property
@pulumi.getter
def type(self) -> str:
"""
tells whether the user is primary account or regular account.
"""
return pulumi.get(self, "type")
@property
@pulumi.getter
def username(self) -> str:
return pulumi.get(self, "username")
class AwaitableGetServiceUserResult(GetServiceUserResult):
# pylint: disable=using-constant-test
def __await__(self):
if False:
yield self
return GetServiceUserResult(
access_cert=self.access_cert,
access_key=self.access_key,
authentication=self.authentication,
id=self.id,
password=<PASSWORD>,
project=self.project,
redis_acl_categories=self.redis_acl_categories,
redis_acl_channels=self.redis_acl_channels,
redis_acl_commands=self.redis_acl_commands,
redis_acl_keys=self.redis_acl_keys,
service_name=self.service_name,
type=self.type,
username=self.username)
def get_service_user(access_cert: Optional[str] = None,
access_key: Optional[str] = None,
authentication: Optional[str] = None,
password: Optional[str] = None,
project: Optional[str] = None,
redis_acl_categories: Optional[Sequence[str]] = None,
redis_acl_channels: Optional[Sequence[str]] = None,
redis_acl_commands: Optional[Sequence[str]] = None,
redis_acl_keys: Optional[Sequence[str]] = None,
service_name: Optional[str] = None,
type: Optional[str] = None,
username: Optional[str] = None,
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetServiceUserResult:
"""
## # Service User Data Source
The Service User data source provides information about the existing Aiven Service User.
## Example Usage
```python
import pulumi
import pulumi_aiven as aiven
myserviceuser = aiven.get_service_user(project=aiven_project["myproject"]["project"],
service_name=aiven_service["myservice"]["service_name"],
username="<USERNAME>")
```
> **Note** The service user data source is not supported for Aiven Grafana services.
:param str access_cert: is the access certificate of the user (not applicable for all services).
:param str access_key: is the access key of the user (not applicable for all services).
:param str password: is the password of the user (not applicable for all services).
:param str project: and `service_name` - (Required) define the project and service the user belongs to. They should be defined
using reference as shown above to set up dependencies correctly.
:param Sequence[str] redis_acl_categories: Redis specific field, defines command category rules.
:param Sequence[str] redis_acl_commands: Redis specific field, defines rules for individual commands.
:param Sequence[str] redis_acl_keys: Redis specific field, defines key access rules.
:param str type: tells whether the user is primary account or regular account.
:param str username: is the actual name of the user account.
"""
__args__ = dict()
__args__['accessCert'] = access_cert
__args__['accessKey'] = access_key
__args__['authentication'] = authentication
__args__['password'] = password
__args__['project'] = project
__args__['redisAclCategories'] = redis_acl_categories
__args__['redisAclChannels'] = redis_acl_channels
__args__['redisAclCommands'] = redis_acl_commands
__args__['redisAclKeys'] = redis_acl_keys
__args__['serviceName'] = service_name
__args__['type'] = type
__args__['username'] = username
if opts is None:
opts = pulumi.InvokeOptions()
if opts.version is None:
opts.version = _utilities.get_version()
__ret__ = pulumi.runtime.invoke('aiven:index/getServiceUser:getServiceUser', __args__, opts=opts, typ=GetServiceUserResult).value
return AwaitableGetServiceUserResult(
access_cert=__ret__.access_cert,
access_key=__ret__.access_key,
authentication=__ret__.authentication,
id=__ret__.id,
password=__<PASSWORD>,
project=__ret__.project,
redis_acl_categories=__ret__.redis_acl_categories,
redis_acl_channels=__ret__.redis_acl_channels,
redis_acl_commands=__ret__.redis_acl_commands,
redis_acl_keys=__ret__.redis_acl_keys,
service_name=__ret__.service_name,
type=__ret__.type,
username=__ret__.username)
| [
1,
396,
14137,
29922,
9420,
29899,
29947,
13,
29937,
18610,
399,
25614,
29901,
445,
934,
471,
5759,
491,
278,
27477,
15547,
20839,
689,
16230,
313,
13264,
1885,
29897,
21704,
29889,
18610,
13,
29937,
18610,
1938,
451,
3863,
491,
1361,
6521,
366,
29915,
276,
3058,
366,
1073,
825,
366,
526,
2599,
29991,
18610,
13,
13,
5215,
18116,
13,
5215,
9505,
15547,
13,
5215,
9505,
15547,
29889,
15634,
13,
3166,
19229,
1053,
3139,
29892,
341,
20304,
29892,
28379,
29892,
922,
3910,
29892,
7761,
29892,
975,
1359,
13,
3166,
869,
1053,
903,
4422,
1907,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
2577,
3170,
2659,
3591,
742,
13,
1678,
525,
29909,
10685,
519,
2577,
3170,
2659,
3591,
742,
13,
1678,
525,
657,
29918,
5509,
29918,
1792,
742,
13,
29962,
13,
13,
29992,
29886,
352,
15547,
29889,
4905,
29918,
1853,
13,
1990,
3617,
3170,
2659,
3591,
29901,
13,
1678,
9995,
13,
1678,
319,
4333,
310,
1819,
4133,
491,
679,
3170,
2659,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1649,
1311,
1649,
29892,
2130,
29918,
6327,
29922,
8516,
29892,
2130,
29918,
1989,
29922,
8516,
29892,
10760,
29922,
8516,
29892,
1178,
29922,
8516,
29892,
4800,
29922,
29966,
25711,
17013,
10202,
2060,
29922,
8516,
29892,
29825,
29918,
562,
29880,
29918,
20683,
29922,
8516,
29892,
29825,
29918,
562,
29880,
29918,
305,
12629,
29922,
8516,
29892,
29825,
29918,
562,
29880,
29918,
26381,
29922,
8516,
29892,
29825,
29918,
562,
29880,
29918,
8149,
29922,
8516,
29892,
2669,
29918,
978,
29922,
8516,
29892,
1134,
29922,
8516,
29892,
8952,
29922,
8516,
1125,
13,
4706,
565,
2130,
29918,
6327,
322,
451,
338,
8758,
29898,
5943,
29918,
6327,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
5943,
29918,
6327,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
5943,
29918,
6327,
613,
2130,
29918,
6327,
29897,
13,
4706,
565,
2130,
29918,
1989,
322,
451,
338,
8758,
29898,
5943,
29918,
1989,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
5943,
29918,
1989,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
5943,
29918,
1989,
613,
2130,
29918,
1989,
29897,
13,
4706,
565,
10760,
322,
451,
338,
8758,
29898,
23055,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
23055,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
23055,
613,
10760,
29897,
13,
4706,
565,
1178,
322,
451,
338,
8758,
29898,
333,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
333,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
333,
613,
1178,
29897,
13,
4706,
565,
4800,
322,
451,
338,
8758,
29898,
5630,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
5630,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
5630,
613,
4800,
29897,
13,
4706,
565,
2060,
322,
451,
338,
8758,
29898,
4836,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
4836,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
4836,
613,
2060,
29897,
13,
4706,
565,
29825,
29918,
562,
29880,
29918,
20683,
322,
451,
338,
8758,
29898,
1127,
275,
29918,
562,
29880,
29918,
20683,
29892,
1051,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
1127,
275,
29918,
562,
29880,
29918,
20683,
29915,
304,
367,
263,
1051,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
20683,
613,
29825,
29918,
562,
29880,
29918,
20683,
29897,
13,
4706,
565,
29825,
29918,
562,
29880,
29918,
305,
12629,
322,
451,
338,
8758,
29898,
1127,
275,
29918,
562,
29880,
29918,
305,
12629,
29892,
1051,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
1127,
275,
29918,
562,
29880,
29918,
305,
12629,
29915,
304,
367,
263,
1051,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
305,
12629,
613,
29825,
29918,
562,
29880,
29918,
305,
12629,
29897,
13,
4706,
565,
29825,
29918,
562,
29880,
29918,
26381,
322,
451,
338,
8758,
29898,
1127,
275,
29918,
562,
29880,
29918,
26381,
29892,
1051,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
1127,
275,
29918,
562,
29880,
29918,
26381,
29915,
304,
367,
263,
1051,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
26381,
613,
29825,
29918,
562,
29880,
29918,
26381,
29897,
13,
4706,
565,
29825,
29918,
562,
29880,
29918,
8149,
322,
451,
338,
8758,
29898,
1127,
275,
29918,
562,
29880,
29918,
8149,
29892,
1051,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
1127,
275,
29918,
562,
29880,
29918,
8149,
29915,
304,
367,
263,
1051,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
8149,
613,
29825,
29918,
562,
29880,
29918,
8149,
29897,
13,
4706,
565,
2669,
29918,
978,
322,
451,
338,
8758,
29898,
5509,
29918,
978,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
5509,
29918,
978,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
5509,
29918,
978,
613,
2669,
29918,
978,
29897,
13,
4706,
565,
1134,
322,
451,
338,
8758,
29898,
1853,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
1853,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
1853,
613,
1134,
29897,
13,
4706,
565,
8952,
322,
451,
338,
8758,
29898,
6786,
29892,
851,
1125,
13,
9651,
12020,
20948,
703,
1252,
6021,
2980,
525,
6786,
29915,
304,
367,
263,
851,
1159,
13,
4706,
9505,
15547,
29889,
842,
22168,
1311,
1649,
29892,
376,
6786,
613,
8952,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
29898,
978,
543,
5943,
20455,
1159,
13,
1678,
822,
2130,
29918,
6327,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
338,
278,
2130,
12289,
310,
278,
1404,
313,
1333,
22903,
363,
599,
5786,
467,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
5943,
29918,
6327,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
29898,
978,
543,
5943,
2558,
1159,
13,
1678,
822,
2130,
29918,
1989,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
338,
278,
2130,
1820,
310,
278,
1404,
313,
1333,
22903,
363,
599,
5786,
467,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
5943,
29918,
1989,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
13,
1678,
822,
10760,
29898,
1311,
29897,
1599,
28379,
29961,
710,
5387,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
23055,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
13,
1678,
822,
1178,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
450,
13113,
29899,
465,
12961,
5412,
3553,
363,
445,
8745,
6503,
29889,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
333,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
13,
1678,
822,
4800,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
338,
278,
4800,
310,
278,
1404,
313,
1333,
22903,
363,
599,
5786,
467,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
5630,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
13,
1678,
822,
2060,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
4836,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
29898,
978,
543,
1127,
275,
29909,
695,
29907,
14404,
1159,
13,
1678,
822,
29825,
29918,
562,
29880,
29918,
20683,
29898,
1311,
29897,
1599,
28379,
29961,
20529,
29961,
710,
5262,
29901,
13,
4706,
9995,
13,
4706,
4367,
275,
2702,
1746,
29892,
17645,
1899,
7663,
6865,
29889,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
20683,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
29898,
978,
543,
1127,
275,
29909,
695,
1451,
12629,
1159,
13,
1678,
822,
29825,
29918,
562,
29880,
29918,
305,
12629,
29898,
1311,
29897,
1599,
28379,
29961,
20529,
29961,
710,
5262,
29901,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
305,
12629,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
29898,
978,
543,
1127,
275,
29909,
695,
5261,
4167,
1159,
13,
1678,
822,
29825,
29918,
562,
29880,
29918,
26381,
29898,
1311,
29897,
1599,
28379,
29961,
20529,
29961,
710,
5262,
29901,
13,
4706,
9995,
13,
4706,
4367,
275,
2702,
1746,
29892,
17645,
6865,
363,
5375,
8260,
29889,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
26381,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
29898,
978,
543,
1127,
275,
29909,
695,
15506,
1159,
13,
1678,
822,
29825,
29918,
562,
29880,
29918,
8149,
29898,
1311,
29897,
1599,
28379,
29961,
20529,
29961,
710,
5262,
29901,
13,
4706,
9995,
13,
4706,
4367,
275,
2702,
1746,
29892,
17645,
1820,
2130,
6865,
29889,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
1127,
275,
29918,
562,
29880,
29918,
8149,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
29898,
978,
543,
5509,
1170,
1159,
13,
1678,
822,
2669,
29918,
978,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
5509,
29918,
978,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
13,
1678,
822,
1134,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
13,
4706,
10603,
3692,
278,
1404,
338,
7601,
3633,
470,
4943,
3633,
29889,
13,
4706,
9995,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
1853,
1159,
13,
13,
1678,
732,
6799,
13,
1678,
732,
29886,
352,
15547,
29889,
657,
357,
13,
1678,
822,
8952,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
9505,
15547,
29889,
657,
29898,
1311,
29892,
376,
6786,
1159,
13,
13,
13,
1990,
319,
10685,
519,
2577,
3170,
2659,
3591,
29898,
2577,
3170,
2659,
3591,
1125,
13,
1678,
396,
282,
2904,
524,
29901,
11262,
29922,
4746,
29899,
23362,
29899,
1688,
13,
1678,
822,
4770,
20675,
12035,
1311,
1125,
13,
4706,
565,
7700,
29901,
13,
9651,
7709,
1583,
13,
4706,
736,
3617,
3170,
2659,
3591,
29898,
13,
9651,
2130,
29918,
6327,
29922,
1311,
29889,
5943,
29918,
6327,
29892,
13,
9651,
2130,
29918,
1989,
29922,
1311,
29889,
5943,
29918,
1989,
29892,
13,
9651,
10760,
29922,
1311,
29889,
23055,
29892,
13,
9651,
1178,
29922,
1311,
29889,
333,
29892,
13,
9651,
4800,
29922,
29966,
25711,
17013,
10202,
13,
9651,
2060,
29922,
1311,
29889,
4836,
29892,
13,
9651,
29825,
29918,
562,
29880,
29918,
20683,
29922,
1311,
29889,
1127,
275,
29918,
562,
29880,
29918,
20683,
29892,
13,
9651,
29825,
29918,
562,
29880,
29918,
305,
12629,
29922,
1311,
29889,
1127,
275,
29918,
562,
29880,
29918,
305,
12629,
29892,
13,
9651,
29825,
29918,
562,
29880,
29918,
26381,
29922,
1311,
29889,
1127,
275,
29918,
562,
29880,
29918,
26381,
29892,
13,
9651,
29825,
29918,
562,
29880,
29918,
8149,
29922,
1311,
29889,
1127,
275,
29918,
562,
29880,
29918,
8149,
29892,
13,
9651,
2669,
29918,
978,
29922,
1311,
29889,
5509,
29918,
978,
29892,
13,
9651,
1134,
29922,
1311,
29889,
1853,
29892,
13,
9651,
8952,
29922,
1311,
29889,
6786,
29897,
13,
13,
13,
1753,
679,
29918,
5509,
29918,
1792,
29898,
5943,
29918,
6327,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
2130,
29918,
1989,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
10760,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
4800,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
2060,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
29825,
29918,
562,
29880,
29918,
20683,
29901,
28379,
29961,
20529,
29961,
710,
5262,
353,
6213,
29892,
13,
462,
268,
29825,
29918,
562,
29880,
29918,
305,
12629,
29901,
28379,
29961,
20529,
29961,
710,
5262,
353,
6213,
29892,
13,
462,
268,
29825,
29918,
562,
29880,
29918,
26381,
29901,
28379,
29961,
20529,
29961,
710,
5262,
353,
6213,
29892,
13,
462,
268,
29825,
29918,
562,
29880,
29918,
8149,
29901,
28379,
29961,
20529,
29961,
710,
5262,
353,
6213,
29892,
13,
462,
268,
2669,
29918,
978,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
1134,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
8952,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
462,
268,
29111,
29901,
28379,
29961,
29886,
352,
15547,
29889,
20731,
5856,
29962,
353,
6213,
29897,
1599,
319,
10685,
519,
2577,
3170,
2659,
3591,
29901,
13,
1678,
9995,
13,
1678,
444,
396,
6692,
4911,
3630,
7562,
13,
13,
1678,
450,
6692,
4911,
848,
2752,
8128,
2472,
1048,
278,
5923,
319,
5428,
6692,
4911,
29889,
13,
13,
1678,
444,
8741,
10783,
482,
13,
13,
1678,
7521,
4691,
13,
1678,
1053,
9505,
15547,
13,
1678,
1053,
9505,
15547,
29918,
29874,
5428,
408,
263,
5428,
13,
13,
1678,
590,
5509,
1792,
353,
263,
5428,
29889,
657,
29918,
5509,
29918,
1792,
29898,
4836,
29922,
29874,
5428,
29918,
4836,
3366,
1357,
4836,
3108,
3366,
4836,
12436,
13,
4706,
2669,
29918,
978,
29922,
29874,
5428,
29918,
5509,
3366,
1357,
5509,
3108,
3366,
5509,
29918,
978,
12436,
13,
4706,
8952,
543,
29966,
11889,
5813,
29958,
1159,
13,
1678,
7521,
13,
13,
1678,
1405,
3579,
9842,
1068,
450,
2669,
1404,
848,
2752,
338,
451,
6969,
363,
319,
5428,
13721,
1648,
5786,
29889,
13,
13,
13,
1678,
584,
3207,
851,
2130,
29918,
6327,
29901,
338,
278,
2130,
12289,
310,
278,
1404,
313,
1333,
22903,
363,
599,
5786,
467,
13,
1678,
584,
3207,
851,
2130,
29918,
1989,
29901,
338,
278,
2130,
1820,
310,
278,
1404,
313,
1333,
22903,
363,
599,
5786,
467,
13,
1678,
584,
3207,
851,
4800,
29901,
338,
278,
4800,
310,
278,
1404,
313,
1333,
22903,
363,
599,
5786,
467,
13,
1678,
584,
3207,
851,
2060,
29901,
322,
421,
5509,
29918,
978,
29952,
448,
313,
19347,
29897,
4529,
278,
2060,
322,
2669,
278,
1404,
14393,
304,
29889,
2688,
881,
367,
3342,
13,
965,
773,
3407,
408,
4318,
2038,
304,
731,
701,
9962,
5149,
29889,
13,
1678,
584,
3207,
922,
3910,
29961,
710,
29962,
29825,
29918,
562,
29880,
29918,
20683,
29901,
4367,
275,
2702,
1746,
29892,
17645,
1899,
7663,
6865,
29889,
13,
1678,
584,
3207,
922,
3910,
29961,
710,
29962,
29825,
29918,
562,
29880,
29918,
26381,
29901,
4367,
275,
2702,
1746,
29892,
17645,
6865,
363,
5375,
8260,
29889,
13,
1678,
584,
3207,
922,
3910,
29961,
710,
29962,
29825,
29918,
562,
29880,
29918,
8149,
29901,
4367,
275,
2702,
1746,
29892,
17645,
1820,
2130,
6865,
29889,
13,
1678,
584,
3207,
851,
1134,
29901,
10603,
3692,
278,
1404,
338,
7601,
3633,
470,
4943,
3633,
29889,
13,
1678,
584,
3207,
851,
8952,
29901,
338,
278,
3935,
1024,
310,
278,
1404,
3633,
29889,
13,
1678,
9995,
13,
1678,
4770,
5085,
1649,
353,
9657,
580,
13,
1678,
4770,
5085,
1649,
1839,
5943,
20455,
2033,
353,
2130,
29918,
6327,
13,
1678,
4770,
5085,
1649,
1839,
5943,
2558,
2033,
353,
2130,
29918,
1989,
13,
1678,
4770,
5085,
1649,
1839,
23055,
2033,
353,
10760,
13,
1678,
4770,
5085,
1649,
1839,
5630,
2033,
353,
4800,
13,
1678,
4770,
5085,
1649,
1839,
4836,
2033,
353,
2060,
13,
1678,
4770,
5085,
1649,
1839,
1127,
275,
29909,
695,
29907,
14404,
2033,
353,
29825,
29918,
562,
29880,
29918,
20683,
13,
1678,
4770,
5085,
1649,
1839,
1127,
275,
29909,
695,
1451,
12629,
2033,
353,
29825,
29918,
562,
29880,
29918,
305,
12629,
13,
1678,
4770,
5085,
1649,
1839,
1127,
275,
29909,
695,
5261,
4167,
2033,
353,
29825,
29918,
562,
29880,
29918,
26381,
13,
1678,
4770,
5085,
1649,
1839,
1127,
275,
29909,
695,
15506,
2033,
353,
29825,
29918,
562,
29880,
29918,
8149,
13,
1678,
4770,
5085,
1649,
1839,
5509,
1170,
2033,
353,
2669,
29918,
978,
13,
1678,
4770,
5085,
1649,
1839,
1853,
2033,
353,
1134,
13,
1678,
4770,
5085,
1649,
1839,
6786,
2033,
353,
8952,
13,
1678,
565,
29111,
338,
6213,
29901,
13,
4706,
29111,
353,
9505,
15547,
29889,
20731,
5856,
580,
13,
1678,
565,
29111,
29889,
3259,
338,
6213,
29901,
13,
4706,
29111,
29889,
3259,
353,
903,
4422,
1907,
29889,
657,
29918,
3259,
580,
13,
1678,
4770,
2267,
1649,
353,
9505,
15547,
29889,
15634,
29889,
9772,
877,
29874,
5428,
29901,
2248,
29914,
657,
3170,
2659,
29901,
657,
3170,
2659,
742,
4770,
5085,
1649,
29892,
29111,
29922,
25707,
29892,
2393,
29922,
2577,
3170,
2659,
3591,
467,
1767,
13,
13,
1678,
736,
319,
10685,
519,
2577,
3170,
2659,
3591,
29898,
13,
4706,
2130,
29918,
6327,
29922,
1649,
2267,
26914,
5943,
29918,
6327,
29892,
13,
4706,
2130,
29918,
1989,
29922,
1649,
2267,
26914,
5943,
29918,
1989,
29892,
13,
4706,
10760,
29922,
1649,
2267,
26914,
23055,
29892,
13,
4706,
1178,
29922,
1649,
2267,
26914,
333,
29892,
13,
4706,
4800,
29922,
1649,
29966,
25711,
17013,
10202,
13,
4706,
2060,
29922,
1649,
2267,
26914,
4836,
29892,
13,
4706,
29825,
29918,
562,
29880,
29918,
20683,
29922,
1649,
2267,
26914,
1127,
275,
29918,
562,
29880,
29918,
20683,
29892,
13,
4706,
29825,
29918,
562,
29880,
29918,
305,
12629,
29922,
1649,
2267,
26914,
1127,
275,
29918,
562,
29880,
29918,
305,
12629,
29892,
13,
4706,
29825,
29918,
562,
29880,
29918,
26381,
29922,
1649,
2267,
26914,
1127,
275,
29918,
562,
29880,
29918,
26381,
29892,
13,
4706,
29825,
29918,
562,
29880,
29918,
8149,
29922,
1649,
2267,
26914,
1127,
275,
29918,
562,
29880,
29918,
8149,
29892,
13,
4706,
2669,
29918,
978,
29922,
1649,
2267,
26914,
5509,
29918,
978,
29892,
13,
4706,
1134,
29922,
1649,
2267,
26914,
1853,
29892,
13,
4706,
8952,
29922,
1649,
2267,
26914,
6786,
29897,
13,
2
] |
gwk/constants.py | aixcyi/gwk | 1 | 181388 | # -*- coding: utf-8 -*-
__all__ = [
'GachaType',
'WishType',
'JsonStruct',
'CEILINGS',
'UNIFORM_TIME_FORMAT',
'DT_STAMP_OFFSET_CHANGE',
'DT_VERSION_START_2_3',
]
from datetime import datetime
from enum import Enum
from gwk.typing import Choices
class GachaType(Choices):
"""祈愿的卡池类型。"""
BEGINNERS_WISH = '100', '新手祈愿'
WANDERLUST_INVOCATION = '200', '常驻祈愿'
CHARACTER_EVENT_WISH = '301', '角色活动祈愿'
WEAPON_EVENT_WISH = '302', '武器活动祈愿'
CHARACTER_EVENT_WISH_2 = '400', '角色活动祈愿-2'
class WishType(Choices):
"""祈愿卡池的类型。"""
BEGINNERS_WISH = '100', '新手祈愿'
WANDERLUST_INVOCATION = '200', '常驻祈愿'
CHARACTER_EVENT_WISH = '301', '角色活动祈愿'
WEAPON_EVENT_WISH = '302', '武器活动祈愿'
class JsonStruct(Enum):
"""导出的祈愿记录JSON文件的格式。"""
GWK = 'GWK'
UIGF = 'UIGF'
CEILINGS = {
WishType.BEGINNERS_WISH: 90, # 新手祈愿
WishType.WANDERLUST_INVOCATION: 90, # 常驻祈愿
WishType.CHARACTER_EVENT_WISH: 90, # 角色活动祈愿
WishType.WEAPON_EVENT_WISH: 80, # 武器活动祈愿
# WishType.CHARACTER_EVENT_WISH_2: 90, # 角色活动祈愿-2
}
# Time Format
UNIFORM_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
# Datetime
DT_STAMP_OFFSET_CHANGE = datetime(2020, 12, 31)
DT_VERSION_START_2_3 = datetime(2021, 11, 24, 7, 0, 0)
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
29954,
496,
29874,
1542,
742,
13,
1678,
525,
29956,
728,
1542,
742,
13,
1678,
525,
8148,
19560,
742,
13,
1678,
525,
4741,
6227,
4214,
29903,
742,
13,
1678,
525,
3904,
6545,
12054,
29918,
15307,
29918,
19094,
1299,
742,
13,
1678,
525,
12972,
29918,
1254,
19297,
29918,
27681,
10490,
29918,
3210,
24336,
742,
13,
1678,
525,
12972,
29918,
16358,
29918,
25826,
29918,
29906,
29918,
29941,
742,
13,
29962,
13,
13,
3166,
12865,
1053,
12865,
13,
3166,
14115,
1053,
1174,
398,
13,
13,
3166,
330,
29893,
29895,
29889,
1017,
15702,
1053,
14542,
1575,
13,
13,
13,
1990,
402,
496,
29874,
1542,
29898,
15954,
1575,
1125,
13,
1678,
9995,
234,
168,
139,
233,
135,
194,
30210,
232,
144,
164,
31853,
30832,
30883,
30267,
15945,
29908,
13,
13,
1678,
22815,
13865,
29903,
29918,
29956,
3235,
29950,
353,
525,
29896,
29900,
29900,
742,
525,
30374,
30880,
234,
168,
139,
233,
135,
194,
29915,
13,
1678,
399,
2190,
8032,
29931,
17321,
29918,
1177,
29963,
20166,
8098,
353,
525,
29906,
29900,
29900,
742,
525,
31190,
236,
172,
190,
234,
168,
139,
233,
135,
194,
29915,
13,
1678,
26871,
17923,
1001,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
353,
525,
29941,
29900,
29896,
742,
525,
31432,
31085,
31704,
30846,
234,
168,
139,
233,
135,
194,
29915,
13,
1678,
399,
29923,
3301,
1164,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
353,
525,
29941,
29900,
29906,
742,
525,
30819,
30943,
31704,
30846,
234,
168,
139,
233,
135,
194,
29915,
13,
1678,
26871,
17923,
1001,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
29918,
29906,
353,
525,
29946,
29900,
29900,
742,
525,
31432,
31085,
31704,
30846,
234,
168,
139,
233,
135,
194,
29899,
29906,
29915,
13,
13,
13,
1990,
399,
728,
1542,
29898,
15954,
1575,
1125,
13,
1678,
9995,
234,
168,
139,
233,
135,
194,
232,
144,
164,
31853,
30210,
30832,
30883,
30267,
15945,
29908,
13,
13,
1678,
22815,
13865,
29903,
29918,
29956,
3235,
29950,
353,
525,
29896,
29900,
29900,
742,
525,
30374,
30880,
234,
168,
139,
233,
135,
194,
29915,
13,
1678,
399,
2190,
8032,
29931,
17321,
29918,
1177,
29963,
20166,
8098,
353,
525,
29906,
29900,
29900,
742,
525,
31190,
236,
172,
190,
234,
168,
139,
233,
135,
194,
29915,
13,
1678,
26871,
17923,
1001,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
353,
525,
29941,
29900,
29896,
742,
525,
31432,
31085,
31704,
30846,
234,
168,
139,
233,
135,
194,
29915,
13,
1678,
399,
29923,
3301,
1164,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
353,
525,
29941,
29900,
29906,
742,
525,
30819,
30943,
31704,
30846,
234,
168,
139,
233,
135,
194,
29915,
13,
13,
13,
1990,
14355,
19560,
29898,
16854,
1125,
13,
1678,
9995,
31943,
30544,
30210,
234,
168,
139,
233,
135,
194,
31410,
31283,
7249,
30333,
30631,
30210,
31168,
30607,
30267,
15945,
29908,
13,
13,
1678,
402,
29956,
29968,
353,
525,
29954,
29956,
29968,
29915,
13,
1678,
3740,
29954,
29943,
353,
525,
3120,
29954,
29943,
29915,
13,
13,
13,
4741,
6227,
4214,
29903,
353,
426,
13,
1678,
399,
728,
1542,
29889,
29933,
17958,
13865,
29903,
29918,
29956,
3235,
29950,
29901,
29871,
29929,
29900,
29892,
29871,
396,
29871,
30374,
30880,
234,
168,
139,
233,
135,
194,
13,
1678,
399,
728,
1542,
29889,
29956,
2190,
8032,
29931,
17321,
29918,
1177,
29963,
20166,
8098,
29901,
29871,
29929,
29900,
29892,
29871,
396,
29871,
31190,
236,
172,
190,
234,
168,
139,
233,
135,
194,
13,
1678,
399,
728,
1542,
29889,
11282,
17923,
1001,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
29901,
29871,
29929,
29900,
29892,
29871,
396,
29871,
31432,
31085,
31704,
30846,
234,
168,
139,
233,
135,
194,
13,
1678,
399,
728,
1542,
29889,
8851,
3301,
1164,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
29901,
29871,
29947,
29900,
29892,
29871,
396,
29871,
30819,
30943,
31704,
30846,
234,
168,
139,
233,
135,
194,
13,
1678,
396,
399,
728,
1542,
29889,
11282,
17923,
1001,
29918,
22240,
3919,
29918,
29956,
3235,
29950,
29918,
29906,
29901,
29871,
29929,
29900,
29892,
29871,
396,
29871,
31432,
31085,
31704,
30846,
234,
168,
139,
233,
135,
194,
29899,
29906,
13,
29913,
13,
13,
29937,
5974,
19191,
13,
3904,
6545,
12054,
29918,
15307,
29918,
19094,
1299,
353,
14210,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
29915,
13,
13,
29937,
13373,
5410,
13,
12972,
29918,
1254,
19297,
29918,
27681,
10490,
29918,
3210,
24336,
353,
12865,
29898,
29906,
29900,
29906,
29900,
29892,
29871,
29896,
29906,
29892,
29871,
29941,
29896,
29897,
13,
12972,
29918,
16358,
29918,
25826,
29918,
29906,
29918,
29941,
353,
12865,
29898,
29906,
29900,
29906,
29896,
29892,
29871,
29896,
29896,
29892,
29871,
29906,
29946,
29892,
29871,
29955,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
2
] |
Python/Code/Python3-Base/11_Advance/Generator.py | hiloWang/notes | 2 | 40781 | <filename>Python/Code/Python3-Base/11_Advance/Generator.py
#########################
# 生成器
#########################
# 创建一个生成器
L = (x * 2 for x in range(5))
print(type(L))
print(L)
for value in L:
print(value, end=' ')
print()
# 创建一个函数生成器
def fib(times):
n = 0
a, b = 0, 1
while n < times:
"""
在循环过程中不断调用 yield ,就会不断中断。当然要给循环设置一个条件来退出循环,不然就会产生一个无限数列出来。
同样的,把函数改成generator后,我们基本上从来不会用 next() 来获取下一个返回值,而是直接使用 for 循环来迭代
"""
yield b
a, b = b, a + b
n += 1
return 'done'
for value in fib(10):
print(value, end=' ')
print()
# 如果想要拿到返回值,必须捕获StopIteration错误,返回值包含在StopIteration的value中
try:
fibSqu = fib(10)
while True:
print(next(fibSqu), end=' ')
except StopIteration as e:
print("生成器返回值:%s" % e.value, end='')
print()
# 使用send
def gen():
i = 0
while i < 5:
# temp为外部调用send函数时发送的值
temp = yield i
print('gen ', temp, end=' ')
i += 1
f = gen()
print(f.__next__()) # 必须先调用 __next__或 send(None)
print('send ', f.send('a'))
print('send ', f.send('b'))
print('send ', f.send('c'))
| [
1,
529,
9507,
29958,
11980,
29914,
3399,
29914,
11980,
29941,
29899,
5160,
29914,
29896,
29896,
29918,
3253,
29894,
749,
29914,
21575,
29889,
2272,
13,
13383,
7346,
29937,
13,
29937,
259,
30486,
30494,
30943,
13,
13383,
7346,
29937,
13,
13,
29937,
29871,
31441,
30886,
30287,
30502,
30486,
30494,
30943,
13,
29931,
353,
313,
29916,
334,
29871,
29906,
363,
921,
297,
3464,
29898,
29945,
876,
13,
2158,
29898,
1853,
29898,
29931,
876,
13,
2158,
29898,
29931,
29897,
13,
13,
1454,
995,
297,
365,
29901,
13,
1678,
1596,
29898,
1767,
29892,
1095,
2433,
25710,
13,
2158,
580,
13,
13,
13,
29937,
29871,
31441,
30886,
30287,
30502,
31629,
30354,
30486,
30494,
30943,
13,
13,
1753,
18755,
29898,
3706,
1125,
13,
1678,
302,
353,
29871,
29900,
13,
1678,
263,
29892,
289,
353,
29871,
29900,
29892,
29871,
29896,
13,
1678,
1550,
302,
529,
3064,
29901,
13,
4706,
9995,
13,
308,
30505,
232,
193,
173,
234,
145,
178,
31138,
31101,
30275,
30413,
31683,
31268,
30406,
7709,
29871,
30214,
31238,
30437,
30413,
31683,
30275,
31683,
30267,
30948,
31516,
30698,
31999,
232,
193,
173,
234,
145,
178,
30872,
30669,
30287,
30502,
31217,
30631,
30805,
236,
131,
131,
30544,
232,
193,
173,
234,
145,
178,
30214,
30413,
31516,
31238,
30437,
231,
189,
170,
30486,
30287,
30502,
31352,
31175,
30354,
31025,
30544,
30805,
30267,
13,
308,
30980,
31819,
30210,
30214,
233,
141,
141,
31629,
30354,
31264,
30494,
27959,
30822,
30214,
30672,
31381,
31359,
30346,
30429,
31594,
30805,
30413,
30437,
30406,
2446,
580,
29871,
30805,
31024,
30683,
30557,
30287,
30502,
31086,
30742,
30959,
30214,
31325,
30392,
31157,
31092,
30785,
30406,
363,
29871,
232,
193,
173,
234,
145,
178,
30805,
235,
194,
176,
30690,
13,
4706,
9995,
13,
4706,
7709,
289,
13,
4706,
263,
29892,
289,
353,
289,
29892,
263,
718,
289,
13,
4706,
302,
4619,
29871,
29896,
13,
1678,
736,
525,
15091,
29915,
13,
13,
13,
1454,
995,
297,
18755,
29898,
29896,
29900,
1125,
13,
1678,
1596,
29898,
1767,
29892,
1095,
2433,
25710,
13,
2158,
580,
13,
13,
29937,
29871,
30847,
30801,
31522,
30698,
233,
142,
194,
30780,
31086,
30742,
30959,
30214,
31641,
236,
164,
190,
233,
144,
152,
31024,
16329,
13463,
362,
31745,
235,
178,
178,
30214,
31086,
30742,
30959,
31473,
232,
147,
174,
30505,
16329,
13463,
362,
30210,
1767,
30275,
13,
2202,
29901,
13,
1678,
18755,
29903,
339,
353,
18755,
29898,
29896,
29900,
29897,
13,
1678,
1550,
5852,
29901,
13,
4706,
1596,
29898,
4622,
29898,
29888,
747,
29903,
339,
511,
1095,
2433,
25710,
13,
19499,
22303,
13463,
362,
408,
321,
29901,
13,
1678,
1596,
703,
30486,
30494,
30943,
31086,
30742,
30959,
30383,
29995,
29879,
29908,
1273,
321,
29889,
1767,
29892,
1095,
2433,
1495,
13,
2158,
580,
13,
13,
13,
29937,
29871,
30785,
30406,
6717,
13,
13,
1753,
2531,
7295,
13,
1678,
474,
353,
29871,
29900,
13,
1678,
1550,
474,
529,
29871,
29945,
29901,
13,
4706,
396,
5694,
30573,
31066,
30636,
31268,
30406,
6717,
31629,
30354,
30594,
30910,
31545,
30210,
30959,
13,
4706,
5694,
353,
7709,
474,
13,
4706,
1596,
877,
1885,
13420,
5694,
29892,
1095,
2433,
25710,
13,
4706,
474,
4619,
29871,
29896,
13,
13,
13,
29888,
353,
2531,
580,
13,
2158,
29898,
29888,
17255,
4622,
1649,
3101,
396,
29871,
31641,
236,
164,
190,
31244,
31268,
30406,
4770,
4622,
1649,
31391,
3638,
29898,
8516,
29897,
13,
2158,
877,
6717,
13420,
285,
29889,
6717,
877,
29874,
8785,
13,
2158,
877,
6717,
13420,
285,
29889,
6717,
877,
29890,
8785,
13,
2158,
877,
6717,
13420,
285,
29889,
6717,
877,
29883,
8785,
13,
2
] |
Language Skills/Python/Unit 11/2-Classes/Using Classes/7-Creating class methods.py | vpstudios/codecademy-exercise-answers | 1 | 197192 | <reponame>vpstudios/codecademy-exercise-answers<gh_stars>1-10
class Car(object):
condition = "new"
def __init__(self, model, color, mpg):
self.model = model
self.color = color
self.mpg = mpg
def display_car(self):
return "This is a %s %s with %s MPG." % (self.color, self.model, str(self.mpg))
my_car = Car("DeLorean","silver", 88)
print my_car.display_car()
| [
1,
529,
276,
1112,
420,
29958,
29894,
29886,
18082,
2363,
29914,
401,
9567,
29899,
735,
6269,
895,
29899,
550,
17538,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
1990,
1704,
29898,
3318,
1125,
13,
1678,
4195,
353,
376,
1482,
29908,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1904,
29892,
2927,
29892,
286,
4061,
1125,
13,
4706,
1583,
29889,
4299,
353,
1904,
13,
4706,
1583,
29889,
2780,
353,
2927,
13,
4706,
1583,
29889,
1526,
29887,
259,
353,
286,
4061,
13,
13,
1678,
822,
2479,
29918,
4287,
29898,
1311,
1125,
13,
4706,
736,
376,
4013,
338,
263,
1273,
29879,
1273,
29879,
411,
1273,
29879,
16379,
29954,
1213,
1273,
313,
1311,
29889,
2780,
29892,
1583,
29889,
4299,
29892,
851,
29898,
1311,
29889,
1526,
29887,
876,
13,
13,
1357,
29918,
4287,
353,
1704,
703,
2772,
29931,
487,
273,
3284,
25590,
369,
613,
29871,
29947,
29947,
29897,
13,
2158,
590,
29918,
4287,
29889,
4990,
29918,
4287,
580,
13,
2
] |
training/pretrainav/weightsampling.py | rub-ksv/-lrs_avsr1_local- | 1 | 170559 | <reponame>rub-ksv/-lrs_avsr1_local-
import torch
from espnet.nets.pytorch_backend.transformer.embedding import PositionalEncoding
class Conv2dSubsampling(torch.nn.Module):
"""Convolutional 2D subsampling (to 1/4 length)
:param int idim: input dim
:param int odim: output dim
:param flaot dropout_rate: dropout rate
"""
def __init__(self, idim, odim, dropout_rate):
super(Conv2dSubsampling, self).__init__()
self.out = torch.nn.Sequential(torch.nn.Linear(idim, odim))
def forward(self, x, x_mask):
"""Subsample x
:param torch.Tensor x: input tensor
:param torch.Tensor x_mask: input mask
:return: subsampled x and mask
:rtype Tuple[torch.Tensor, torch.Tensor]
"""
x = self.out(x)
if x_mask is None:
return x, None
return x, x_mask
| [
1,
529,
276,
1112,
420,
29958,
29878,
431,
29899,
2039,
29894,
24028,
29880,
2288,
29918,
485,
21935,
29896,
29918,
2997,
29899,
13,
5215,
4842,
305,
13,
13,
3166,
5152,
1212,
29889,
1212,
29879,
29889,
2272,
7345,
305,
29918,
27852,
29889,
9067,
261,
29889,
17987,
8497,
1053,
10321,
3245,
14934,
13,
13,
13,
1990,
1281,
29894,
29906,
29881,
4035,
13445,
10335,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
13,
1678,
9995,
1168,
4068,
284,
29871,
29906,
29928,
11684,
314,
10335,
313,
517,
29871,
29896,
29914,
29946,
3309,
29897,
13,
13,
1678,
584,
3207,
938,
1178,
326,
29901,
1881,
3964,
13,
1678,
584,
3207,
938,
2413,
326,
29901,
1962,
3964,
13,
1678,
584,
3207,
17422,
327,
5768,
449,
29918,
10492,
29901,
5768,
449,
6554,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1178,
326,
29892,
2413,
326,
29892,
5768,
449,
29918,
10492,
1125,
13,
4706,
2428,
29898,
1168,
29894,
29906,
29881,
4035,
13445,
10335,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
449,
353,
4842,
305,
29889,
15755,
29889,
16941,
2556,
29898,
7345,
305,
29889,
15755,
29889,
12697,
29898,
333,
326,
29892,
2413,
326,
876,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
29892,
921,
29918,
13168,
1125,
13,
4706,
9995,
4035,
11249,
921,
13,
13,
4706,
584,
3207,
4842,
305,
29889,
29911,
6073,
921,
29901,
1881,
12489,
13,
4706,
584,
3207,
4842,
305,
29889,
29911,
6073,
921,
29918,
13168,
29901,
1881,
11105,
13,
4706,
584,
2457,
29901,
1014,
11249,
29881,
921,
322,
11105,
13,
4706,
584,
29878,
1853,
12603,
552,
29961,
7345,
305,
29889,
29911,
6073,
29892,
4842,
305,
29889,
29911,
6073,
29962,
13,
4706,
9995,
13,
13,
4706,
921,
353,
1583,
29889,
449,
29898,
29916,
29897,
13,
4706,
565,
921,
29918,
13168,
338,
6213,
29901,
13,
9651,
736,
921,
29892,
6213,
13,
4706,
736,
921,
29892,
921,
29918,
13168,
13,
2
] |
csbiginteger/BigIntegerNet.py | NeoResearch/csBigInteger.py | 2 | 30829 | <gh_stars>1-10
#!/usr/bin/python3
from csbiginteger.BigInteger import BigInteger
from functools import total_ordering
# requires: pip install msl-loadlib pycparser pythonnet
from msl.loadlib import LoadLibrary
# remember to execute first: cd csbiginteger/dotnet && dotnet build -c Release
net = LoadLibrary('csbiginteger/dotnet/bin/Release/netstandard2.0/publish/csbiginteger.dll', 'net')
biglib = net.lib.csbiglib.BigIntegerLib()
z = biglib.zero()
print(bytearray(z.ToByteArray()))
m1 = biglib.from_int32(-1)
print(bytearray(m1.ToByteArray()))
i255 = biglib.from_int32(255)
print(bytearray(i255.ToByteArray()))
b2 = biglib.from_bytes(bytearray(i255.ToByteArray()))
print(biglib.to_int32(b2))
b3 = biglib.from_string("0xff", 16)
print(biglib.to_int32(b3))
print(biglib.to_string(b3, 16))
print(biglib.to_string(b3, 10))
print(bytearray(biglib.to_bytes(b3)))
@total_ordering
class BigIntegerNet(BigInteger):
# param may be: int, bytearray, bytes, string (parsed with base)
# bytes and bytearray should be received in little-endian format (same as to_bytearray() returns)
def __init__(self, param=0, base=10):
if type(param) is int:
param = str(param) # convert to base-10 integer
base = 10 # force base 10
if type(param) is bytearray:
param = bytes(param) # bytearray to bytes
if type(param) is bytes:
self._big = biglib.from_bytes(bytearray(param))
if type(param) is str:
self._big = biglib.from_string(param, base)
# returns value in signed int32 limit (or exception)
def to_int(self):
return biglib.to_int32(self._big)
def to_long(self):
return biglib.to_int64(self._big)
# bytearray is returned in little-endian format
def to_bytearray(self):
return bytearray(biglib.to_bytes(self._big))
def to_str(self, base=16):
return str(biglib.to_string(self._big, base))
def add(self, other):
if type(other) is int:
other = BigIntegerNet(other)
big3 = BigIntegerNet()
big3._big = self._big.Add(self._big, other._big)
return big3
def sub(self, other):
if type(other) is int:
other = BigIntegerNet(other)
big3 = BigIntegerNet()
big3._big = self._big.Subtract(self._big, other._big)
return big3
def mul(self, other):
if type(other) is int:
other = BigIntegerNet(other)
big3 = BigIntegerNet()
big3._big = self._big.Multiply(self._big, other._big)
return big3
def div(self, other):
if type(other) is int:
other = BigIntegerNet(other)
big3 = BigIntegerNet()
big3._big = self._big.Divide(self._big, other._big)
return big3
def mod(self, other):
if type(other) is int:
other = BigIntegerNet(other)
big3 = BigIntegerNet()
big3._big = self._big.DivRem(self._big, other._big)
return big3
def shl(self, other):
if type(other) is int:
other = BigIntegerNet(other)
big3 = BigIntegerNet()
big3._big = self._big.op_LeftShift(other._big)
return big3
def shr(self, other):
if type(other) is int:
other = BigIntegerNet(other)
big3 = BigIntegerNet()
big3._big = self._big.op_RightShift(other._big)
return big3
def eq(self, other):
if type(other) is int:
other = BigIntegerNet(other)
return self._big.op_Equality(other._big)
def lt(self, other):
if type(other) is int:
other = BigIntegerNet(other)
return self._big.op_LessThan(other._big)
def __repr__(self):
return str(self)
def __str__(self):
return self.to_str(10)
def __len__(self):
return len(self.to_bytearray())
# ---------
# operators
# ---------
def __add__(self, other):
return self.add(other)
def __sub__(self, other):
return self.sub(other)
def __mul__(self, other):
return self.mul(other)
# note that python usually follows 'pure floor' operation here, on a // b => floor(a/b)
# example: -5 // 2 => -3 (standard int on python)
# however, this library follows hardware-standard (from c/c++/java/fortran), of truncating positive or negative
# so, here: BigInteger(-5) // BigInteger(2) => -2 ("rounding" up, not down)
# floordiv is thus not a good name, since it's only floor for positive division, but ceil for negative, but that's what we have :)
def __floordiv__(self, other):
return self.div(other)
# truediv does not exist (using a // b)
def __truediv__(self, other):
return self.div(other)
def __mod__(self, other):
return self.mod(other)
def __rshift__(self, other):
return self.shr(other)
def __lshift__(self, other):
return self.shl(other)
# comparisons
# -----------
def __eq__(self, other):
return self.eq(other)
# def __gt__(self, other):
# return self.gt(other)
def __lt__(self, other):
return self.lt(other)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
29941,
13,
13,
13,
3166,
5939,
3752,
16031,
29889,
6970,
7798,
1053,
7997,
7798,
13,
13,
3166,
2090,
312,
8789,
1053,
3001,
29918,
2098,
292,
13,
13,
29937,
6858,
29901,
8450,
2601,
286,
2536,
29899,
1359,
1982,
282,
11078,
16680,
3017,
1212,
13,
3166,
286,
2536,
29889,
1359,
1982,
1053,
16012,
12284,
13,
13,
29937,
6456,
304,
6222,
937,
29901,
14965,
5939,
3752,
16031,
29914,
21328,
2607,
8329,
1212,
2048,
448,
29883,
23708,
13,
1212,
353,
16012,
12284,
877,
2395,
3752,
16031,
29914,
21328,
29914,
2109,
29914,
19729,
29914,
1212,
15770,
29906,
29889,
29900,
29914,
23679,
29914,
2395,
3752,
16031,
29889,
12396,
742,
525,
1212,
1495,
13,
13,
3752,
1982,
353,
7787,
29889,
1982,
29889,
2395,
3752,
1982,
29889,
6970,
7798,
14868,
580,
13,
13,
29920,
353,
4802,
1982,
29889,
9171,
580,
13,
2158,
29898,
10389,
2378,
29898,
29920,
29889,
1762,
12901,
2588,
22130,
13,
13,
29885,
29896,
353,
4802,
1982,
29889,
3166,
29918,
524,
29941,
29906,
6278,
29896,
29897,
13,
2158,
29898,
10389,
2378,
29898,
29885,
29896,
29889,
1762,
12901,
2588,
22130,
13,
13,
29875,
29906,
29945,
29945,
353,
4802,
1982,
29889,
3166,
29918,
524,
29941,
29906,
29898,
29906,
29945,
29945,
29897,
13,
2158,
29898,
10389,
2378,
29898,
29875,
29906,
29945,
29945,
29889,
1762,
12901,
2588,
22130,
13,
13,
29890,
29906,
353,
4802,
1982,
29889,
3166,
29918,
13193,
29898,
10389,
2378,
29898,
29875,
29906,
29945,
29945,
29889,
1762,
12901,
2588,
22130,
13,
2158,
29898,
3752,
1982,
29889,
517,
29918,
524,
29941,
29906,
29898,
29890,
29906,
876,
13,
13,
29890,
29941,
353,
4802,
1982,
29889,
3166,
29918,
1807,
703,
29900,
29916,
600,
613,
29871,
29896,
29953,
29897,
13,
2158,
29898,
3752,
1982,
29889,
517,
29918,
524,
29941,
29906,
29898,
29890,
29941,
876,
13,
13,
2158,
29898,
3752,
1982,
29889,
517,
29918,
1807,
29898,
29890,
29941,
29892,
29871,
29896,
29953,
876,
13,
2158,
29898,
3752,
1982,
29889,
517,
29918,
1807,
29898,
29890,
29941,
29892,
29871,
29896,
29900,
876,
13,
2158,
29898,
10389,
2378,
29898,
3752,
1982,
29889,
517,
29918,
13193,
29898,
29890,
29941,
4961,
13,
13,
29992,
7827,
29918,
2098,
292,
13,
1990,
7997,
7798,
6779,
29898,
6970,
7798,
1125,
13,
1678,
396,
1828,
1122,
367,
29901,
938,
29892,
7023,
2378,
29892,
6262,
29892,
1347,
313,
862,
8485,
411,
2967,
29897,
13,
1678,
396,
6262,
322,
7023,
2378,
881,
367,
4520,
297,
2217,
29899,
355,
713,
3402,
313,
17642,
408,
304,
29918,
10389,
2378,
580,
3639,
29897,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1828,
29922,
29900,
29892,
2967,
29922,
29896,
29900,
1125,
13,
4706,
565,
1134,
29898,
3207,
29897,
338,
938,
29901,
13,
9651,
1828,
353,
851,
29898,
3207,
29897,
29871,
396,
3588,
304,
2967,
29899,
29896,
29900,
6043,
13,
9651,
2967,
353,
29871,
29896,
29900,
29871,
396,
4889,
2967,
29871,
29896,
29900,
13,
4706,
565,
1134,
29898,
3207,
29897,
338,
7023,
2378,
29901,
13,
9651,
1828,
353,
6262,
29898,
3207,
29897,
29871,
396,
7023,
2378,
304,
6262,
13,
4706,
565,
1134,
29898,
3207,
29897,
338,
6262,
29901,
13,
9651,
1583,
3032,
3752,
353,
4802,
1982,
29889,
3166,
29918,
13193,
29898,
10389,
2378,
29898,
3207,
876,
13,
4706,
565,
1134,
29898,
3207,
29897,
338,
851,
29901,
13,
9651,
1583,
3032,
3752,
353,
4802,
1982,
29889,
3166,
29918,
1807,
29898,
3207,
29892,
2967,
29897,
13,
13,
13,
1678,
396,
3639,
995,
297,
8794,
938,
29941,
29906,
4046,
313,
272,
3682,
29897,
13,
1678,
822,
304,
29918,
524,
29898,
1311,
1125,
13,
4706,
736,
4802,
1982,
29889,
517,
29918,
524,
29941,
29906,
29898,
1311,
3032,
3752,
29897,
13,
13,
1678,
822,
304,
29918,
5426,
29898,
1311,
1125,
13,
4706,
736,
4802,
1982,
29889,
517,
29918,
524,
29953,
29946,
29898,
1311,
3032,
3752,
29897,
13,
13,
1678,
396,
7023,
2378,
338,
4133,
297,
2217,
29899,
355,
713,
3402,
13,
1678,
822,
304,
29918,
10389,
2378,
29898,
1311,
1125,
13,
4706,
736,
7023,
2378,
29898,
3752,
1982,
29889,
517,
29918,
13193,
29898,
1311,
3032,
3752,
876,
13,
13,
1678,
822,
304,
29918,
710,
29898,
1311,
29892,
2967,
29922,
29896,
29953,
1125,
13,
4706,
736,
851,
29898,
3752,
1982,
29889,
517,
29918,
1807,
29898,
1311,
3032,
3752,
29892,
2967,
876,
13,
13,
1678,
822,
788,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
4802,
29941,
353,
7997,
7798,
6779,
580,
13,
4706,
4802,
29941,
3032,
3752,
353,
1583,
3032,
3752,
29889,
2528,
29898,
1311,
3032,
3752,
29892,
916,
3032,
3752,
29897,
13,
4706,
736,
4802,
29941,
13,
13,
1678,
822,
1014,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
4802,
29941,
353,
7997,
7798,
6779,
580,
13,
4706,
4802,
29941,
3032,
3752,
353,
1583,
3032,
3752,
29889,
4035,
29873,
1461,
29898,
1311,
3032,
3752,
29892,
916,
3032,
3752,
29897,
13,
4706,
736,
4802,
29941,
13,
13,
1678,
822,
15065,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
4802,
29941,
353,
7997,
7798,
6779,
580,
13,
4706,
4802,
29941,
3032,
3752,
353,
1583,
3032,
3752,
29889,
6857,
666,
368,
29898,
1311,
3032,
3752,
29892,
916,
3032,
3752,
29897,
13,
4706,
736,
4802,
29941,
13,
13,
1678,
822,
1933,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
4802,
29941,
353,
7997,
7798,
6779,
580,
13,
4706,
4802,
29941,
3032,
3752,
353,
1583,
3032,
3752,
29889,
12596,
680,
29898,
1311,
3032,
3752,
29892,
916,
3032,
3752,
29897,
13,
4706,
736,
4802,
29941,
13,
13,
13,
1678,
822,
878,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
4802,
29941,
353,
7997,
7798,
6779,
580,
13,
4706,
4802,
29941,
3032,
3752,
353,
1583,
3032,
3752,
29889,
12596,
7301,
29898,
1311,
3032,
3752,
29892,
916,
3032,
3752,
29897,
13,
4706,
736,
4802,
29941,
13,
13,
13,
1678,
822,
528,
29880,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
4802,
29941,
353,
7997,
7798,
6779,
580,
13,
4706,
4802,
29941,
3032,
3752,
353,
1583,
3032,
3752,
29889,
459,
29918,
8091,
29657,
29898,
1228,
3032,
3752,
29897,
13,
4706,
736,
4802,
29941,
13,
13,
13,
1678,
822,
14653,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
4802,
29941,
353,
7997,
7798,
6779,
580,
13,
4706,
4802,
29941,
3032,
3752,
353,
1583,
3032,
3752,
29889,
459,
29918,
7341,
29657,
29898,
1228,
3032,
3752,
29897,
13,
4706,
736,
4802,
29941,
13,
13,
1678,
822,
11594,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
736,
1583,
3032,
3752,
29889,
459,
29918,
6108,
2877,
29898,
1228,
3032,
3752,
29897,
13,
13,
13,
1678,
822,
301,
29873,
29898,
1311,
29892,
916,
1125,
13,
4706,
565,
1134,
29898,
1228,
29897,
338,
938,
29901,
13,
9651,
916,
353,
7997,
7798,
6779,
29898,
1228,
29897,
13,
308,
13,
4706,
736,
1583,
3032,
3752,
29889,
459,
29918,
29931,
404,
1349,
273,
29898,
1228,
3032,
3752,
29897,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
851,
29898,
1311,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
517,
29918,
710,
29898,
29896,
29900,
29897,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
29889,
517,
29918,
10389,
2378,
3101,
13,
13,
1678,
396,
448,
1378,
13,
1678,
396,
12768,
13,
1678,
396,
448,
1378,
13,
1678,
822,
4770,
1202,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
1202,
29898,
1228,
29897,
13,
13,
1678,
822,
4770,
1491,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
1491,
29898,
1228,
29897,
13,
13,
1678,
822,
4770,
16109,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
16109,
29898,
1228,
29897,
13,
13,
1678,
396,
4443,
393,
3017,
5491,
4477,
525,
29886,
545,
11904,
29915,
5858,
1244,
29892,
373,
263,
849,
289,
1149,
11904,
29898,
29874,
29914,
29890,
29897,
13,
1678,
396,
1342,
29901,
448,
29945,
849,
29871,
29906,
1149,
448,
29941,
313,
15770,
938,
373,
3017,
29897,
13,
1678,
396,
3138,
29892,
445,
3489,
4477,
12837,
29899,
15770,
313,
3166,
274,
29914,
29883,
1817,
29914,
1645,
29914,
3921,
661,
511,
310,
21022,
1218,
6374,
470,
8178,
13,
1678,
396,
577,
29892,
1244,
29901,
7997,
7798,
6278,
29945,
29897,
849,
7997,
7798,
29898,
29906,
29897,
1149,
448,
29906,
4852,
29878,
12449,
29908,
701,
29892,
451,
1623,
29897,
13,
1678,
396,
5685,
536,
440,
338,
4550,
451,
263,
1781,
1024,
29892,
1951,
372,
29915,
29879,
871,
11904,
363,
6374,
8542,
29892,
541,
2257,
309,
363,
8178,
29892,
541,
393,
29915,
29879,
825,
591,
505,
4248,
13,
1678,
822,
4770,
29888,
417,
536,
440,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
4563,
29898,
1228,
29897,
13,
13,
1678,
396,
534,
6742,
440,
947,
451,
1863,
313,
4746,
263,
849,
289,
29897,
13,
1678,
822,
4770,
509,
6742,
440,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
4563,
29898,
1228,
29897,
13,
13,
1678,
822,
4770,
1545,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
1545,
29898,
1228,
29897,
13,
13,
1678,
822,
4770,
29878,
10889,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
845,
29878,
29898,
1228,
29897,
13,
13,
1678,
822,
4770,
29880,
10889,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
845,
29880,
29898,
1228,
29897,
13,
13,
1678,
396,
5734,
14125,
13,
1678,
396,
448,
28400,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
1837,
29898,
1228,
29897,
13,
13,
1678,
396,
822,
4770,
4141,
12035,
1311,
29892,
916,
1125,
13,
1678,
396,
1678,
736,
1583,
29889,
4141,
29898,
1228,
29897,
13,
13,
1678,
822,
4770,
1896,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
1583,
29889,
1896,
29898,
1228,
29897,
13,
2
] |
drs2.py | gling07/Text2DRS | 3 | 1608128 | <filename>drs2.py
# MIT License
#
# Copyright (c) [2018] [<NAME> (<EMAIL>),
# <NAME> (<EMAIL>)]
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import verbnetsrl
import pprint
drs_dict = dict()
verb_pos = ['VBD', 'VB', 'VBN', 'VBG', 'VBP']
noun_lst = ['NNP', 'NN', 'PRP', 'NNS']
def drs_generator(data_dct_lst, coref_dictionary):
omit_list = get_omit_entities(coref_dictionary)
entities = get_all_entities(data_dct_lst, omit_list)
entities_map = mapping_entity(entities)
property = retrieve_property(entities_map)
(events_map, event_property) = retrieve_event(data_dct_lst)
event_type = retrieve_event_type(data_dct_lst)
event_time = retrieve_event_time(events_map)
event_argument = retrieve_event_argument(data_dct_lst, property, event_type, event_property)
drs_dict['entity'] = [k for k in entities_map.keys()]
drs_dict['property'] = property
drs_dict['event'] = [k for k in events_map.keys()]
drs_dict['eventType'] = event_type
drs_dict['eventTime'] = event_time
drs_dict['eventArgument'] = event_argument
return drs_dict
def get_omit_entities(coref_dictionary):
special = "'"+'s'
omit_list = list()
for key, value in coref_dictionary.items():
if ' ' in key and special not in key:
entity = key.split(' ')[-1]
for v in value[1:]:
omit_list.append((entity, v))
else:
for v in value[1:]:
omit_list.append((key, v))
return omit_list
def get_all_entities(data_dct_lst, omit_list):
entities = list()
num = 0
for sentences in data_dct_lst:
num += 1
for sen in sentences:
if sen.get('PPOS') in noun_lst:
tmp = (sen.get('Form'), num)
if tmp not in omit_list:
entities.append(sen.get('Form'))
return entities
def mapping_entity(entities):
entities_dictionary = dict()
count = 1
for entity in entities:
entities_dictionary['r'+ str(count)] = entity
count += 1
return entities_dictionary
def retrieve_property(entities_map):
properties = list()
for key, entity in entities_map.items():
temp = (key, entity)
properties.append(temp)
return properties
def retrieve_event(data_dct_lst):
events_dictionary = dict()
events_property = dict()
count = 1
sentence_id = 1
for sentences in data_dct_lst:
verb = list()
for sen in sentences:
if sen.get('Pred') != '_' and sen.get('PPOS') in verb_pos:
events_dictionary['e' + str(count)] = sen.get('PLemma')
verb.append((sen.get('PLemma'), 'e' + str(count)))
count += 1
events_property[sentence_id] = verb
sentence_id += 1
return (events_dictionary, events_property)
# include picking first vn-class if multiple returns
def retrieve_event_type(data_dct_lst):
event_type_dictionary = dict()
count = 1
for sentence in data_dct_lst:
for item in sentence:
if item.get('PPOS') in verb_pos:
pred = item.get('Pred')
if item.get(pred + ':vb-class') is not None:
event_type_dictionary['e' + str(count)] = item.get(pred + ':vb-class')[0]
count += 1
event_type_list = [(k, v) for k, v in event_type_dictionary.items()]
return event_type_list
def retrieve_event_time(events_map):
event_time_dictionary = dict()
count = 0
for event, value in events_map.items():
event_time_dictionary[event] = count
count += 1
event_time_list = [(k, v) for k, v in event_time_dictionary.items()]
return event_time_list
def retrieve_event_argument(data_dct_lst, property, event_type, event_property):
event_argument_list = list()
sentence_id = 1
for sentence in data_dct_lst:
predicates = verbnetsrl.get_predicates(sentence)
events = event_type[0:len(predicates)]
event_type = event_type[len(predicates):]
for (pred, event) in zip(predicates, events):
event_ref = event[0]
for sent in sentence:
if sent.get('Args:' + pred) != '_':
# use first verb class as vn class
vn_role = sent.get(pred + ':vn-class')[0][1]
if sent.get('PPOS') in noun_lst:
for (ref, ent) in property:
if ent == sent.get('Form'):
event_argument_list.append((event_ref, vn_role, ref))
break
elif sent.get('PPOS') in verb_pos:
verb_property = event_property.get(sentence_id)
for (plemma, eref) in verb_property:
if sent.get('PLemma') == plemma:
event_argument_list.append((event_ref, vn_role, eref))
sentence_id += 1
return event_argument_list
| [
1,
529,
9507,
29958,
29881,
2288,
29906,
29889,
2272,
13,
29937,
341,
1806,
19245,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
518,
29906,
29900,
29896,
29947,
29962,
518,
29966,
5813,
29958,
313,
29966,
26862,
6227,
29958,
511,
13,
29937,
462,
418,
529,
5813,
29958,
313,
29966,
26862,
6227,
29958,
4638,
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,
9750,
1212,
29879,
2096,
13,
5215,
282,
2158,
13,
29881,
2288,
29918,
8977,
353,
9657,
580,
13,
18248,
29918,
1066,
353,
6024,
24281,
29928,
742,
525,
24281,
742,
525,
24281,
29940,
742,
525,
24281,
29954,
742,
525,
24281,
29925,
2033,
13,
29876,
1309,
29918,
20155,
353,
6024,
10262,
29925,
742,
525,
10262,
742,
525,
10593,
29925,
742,
525,
29940,
3059,
2033,
13,
13,
13,
1753,
270,
2288,
29918,
27959,
29898,
1272,
29918,
29881,
312,
29918,
20155,
29892,
7136,
29888,
29918,
27126,
1125,
13,
13,
1678,
288,
2415,
29918,
1761,
353,
679,
29918,
290,
277,
29918,
296,
1907,
29898,
3221,
29888,
29918,
27126,
29897,
13,
1678,
16212,
353,
679,
29918,
497,
29918,
296,
1907,
29898,
1272,
29918,
29881,
312,
29918,
20155,
29892,
288,
2415,
29918,
1761,
29897,
13,
1678,
16212,
29918,
1958,
353,
10417,
29918,
10041,
29898,
296,
1907,
29897,
13,
1678,
2875,
353,
10563,
29918,
6799,
29898,
296,
1907,
29918,
1958,
29897,
13,
1678,
313,
13604,
29918,
1958,
29892,
1741,
29918,
6799,
29897,
353,
10563,
29918,
3696,
29898,
1272,
29918,
29881,
312,
29918,
20155,
29897,
13,
1678,
1741,
29918,
1853,
353,
10563,
29918,
3696,
29918,
1853,
29898,
1272,
29918,
29881,
312,
29918,
20155,
29897,
13,
1678,
1741,
29918,
2230,
353,
10563,
29918,
3696,
29918,
2230,
29898,
13604,
29918,
1958,
29897,
13,
1678,
1741,
29918,
23516,
353,
10563,
29918,
3696,
29918,
23516,
29898,
1272,
29918,
29881,
312,
29918,
20155,
29892,
2875,
29892,
1741,
29918,
1853,
29892,
1741,
29918,
6799,
29897,
13,
13,
1678,
270,
2288,
29918,
8977,
1839,
10041,
2033,
353,
518,
29895,
363,
413,
297,
16212,
29918,
1958,
29889,
8149,
580,
29962,
13,
1678,
270,
2288,
29918,
8977,
1839,
6799,
2033,
353,
2875,
13,
1678,
270,
2288,
29918,
8977,
1839,
3696,
2033,
353,
518,
29895,
363,
413,
297,
4959,
29918,
1958,
29889,
8149,
580,
29962,
13,
1678,
270,
2288,
29918,
8977,
1839,
3696,
1542,
2033,
353,
1741,
29918,
1853,
13,
1678,
270,
2288,
29918,
8977,
1839,
3696,
2481,
2033,
353,
1741,
29918,
2230,
13,
1678,
270,
2288,
29918,
8977,
1839,
3696,
15730,
2033,
353,
1741,
29918,
23516,
13,
13,
1678,
736,
270,
2288,
29918,
8977,
13,
13,
13,
1753,
679,
29918,
290,
277,
29918,
296,
1907,
29898,
3221,
29888,
29918,
27126,
1125,
13,
1678,
4266,
353,
376,
11838,
23097,
29879,
29915,
13,
1678,
288,
2415,
29918,
1761,
353,
1051,
580,
13,
1678,
363,
1820,
29892,
995,
297,
7136,
29888,
29918,
27126,
29889,
7076,
7295,
13,
4706,
565,
525,
525,
297,
1820,
322,
4266,
451,
297,
1820,
29901,
13,
9651,
7855,
353,
1820,
29889,
5451,
877,
525,
9601,
29899,
29896,
29962,
13,
9651,
363,
325,
297,
995,
29961,
29896,
29901,
5387,
13,
18884,
288,
2415,
29918,
1761,
29889,
4397,
3552,
10041,
29892,
325,
876,
13,
4706,
1683,
29901,
13,
9651,
363,
325,
297,
995,
29961,
29896,
29901,
5387,
13,
18884,
288,
2415,
29918,
1761,
29889,
4397,
3552,
1989,
29892,
325,
876,
13,
1678,
736,
288,
2415,
29918,
1761,
13,
13,
13,
1753,
679,
29918,
497,
29918,
296,
1907,
29898,
1272,
29918,
29881,
312,
29918,
20155,
29892,
288,
2415,
29918,
1761,
1125,
13,
1678,
16212,
353,
1051,
580,
13,
1678,
954,
353,
29871,
29900,
13,
1678,
363,
25260,
297,
848,
29918,
29881,
312,
29918,
20155,
29901,
13,
4706,
954,
4619,
29871,
29896,
13,
4706,
363,
6940,
297,
25260,
29901,
13,
9651,
565,
6940,
29889,
657,
877,
18009,
3267,
1495,
297,
302,
1309,
29918,
20155,
29901,
13,
18884,
13128,
353,
313,
4881,
29889,
657,
877,
2500,
5477,
954,
29897,
13,
18884,
565,
13128,
451,
297,
288,
2415,
29918,
1761,
29901,
13,
462,
1678,
16212,
29889,
4397,
29898,
4881,
29889,
657,
877,
2500,
8785,
13,
13,
1678,
736,
16212,
13,
13,
13,
1753,
10417,
29918,
10041,
29898,
296,
1907,
1125,
13,
1678,
16212,
29918,
27126,
353,
9657,
580,
13,
1678,
2302,
353,
29871,
29896,
13,
1678,
363,
7855,
297,
16212,
29901,
13,
4706,
16212,
29918,
27126,
1839,
29878,
18717,
851,
29898,
2798,
4638,
353,
7855,
13,
4706,
2302,
4619,
29871,
29896,
13,
13,
1678,
736,
16212,
29918,
27126,
13,
13,
13,
1753,
10563,
29918,
6799,
29898,
296,
1907,
29918,
1958,
1125,
13,
1678,
4426,
353,
1051,
580,
13,
1678,
363,
1820,
29892,
7855,
297,
16212,
29918,
1958,
29889,
7076,
7295,
13,
4706,
5694,
353,
313,
1989,
29892,
7855,
29897,
13,
4706,
4426,
29889,
4397,
29898,
7382,
29897,
13,
13,
1678,
736,
4426,
13,
13,
13,
1753,
10563,
29918,
3696,
29898,
1272,
29918,
29881,
312,
29918,
20155,
1125,
13,
1678,
4959,
29918,
27126,
353,
9657,
580,
13,
1678,
4959,
29918,
6799,
353,
9657,
580,
13,
1678,
2302,
353,
29871,
29896,
13,
1678,
10541,
29918,
333,
353,
29871,
29896,
13,
1678,
363,
25260,
297,
848,
29918,
29881,
312,
29918,
20155,
29901,
13,
4706,
9750,
353,
1051,
580,
13,
4706,
363,
6940,
297,
25260,
29901,
13,
9651,
565,
6940,
29889,
657,
877,
23084,
1495,
2804,
22868,
29915,
322,
6940,
29889,
657,
877,
18009,
3267,
1495,
297,
9750,
29918,
1066,
29901,
13,
18884,
4959,
29918,
27126,
1839,
29872,
29915,
718,
851,
29898,
2798,
4638,
353,
6940,
29889,
657,
877,
7390,
331,
655,
1495,
13,
18884,
9750,
29889,
4397,
3552,
4881,
29889,
657,
877,
7390,
331,
655,
5477,
525,
29872,
29915,
718,
851,
29898,
2798,
4961,
13,
18884,
2302,
4619,
29871,
29896,
13,
4706,
4959,
29918,
6799,
29961,
18616,
663,
29918,
333,
29962,
353,
9750,
13,
4706,
10541,
29918,
333,
4619,
29871,
29896,
13,
1678,
736,
313,
13604,
29918,
27126,
29892,
4959,
29918,
6799,
29897,
13,
13,
13,
29937,
3160,
5839,
292,
937,
325,
29876,
29899,
1990,
565,
2999,
3639,
13,
1753,
10563,
29918,
3696,
29918,
1853,
29898,
1272,
29918,
29881,
312,
29918,
20155,
1125,
13,
1678,
1741,
29918,
1853,
29918,
27126,
353,
9657,
580,
13,
1678,
2302,
353,
29871,
29896,
13,
1678,
363,
10541,
297,
848,
29918,
29881,
312,
29918,
20155,
29901,
13,
4706,
363,
2944,
297,
10541,
29901,
13,
9651,
565,
2944,
29889,
657,
877,
18009,
3267,
1495,
297,
9750,
29918,
1066,
29901,
13,
18884,
4450,
353,
2944,
29889,
657,
877,
23084,
1495,
13,
18884,
565,
2944,
29889,
657,
29898,
11965,
718,
525,
29901,
24666,
29899,
1990,
1495,
338,
451,
6213,
29901,
13,
462,
1678,
1741,
29918,
1853,
29918,
27126,
1839,
29872,
29915,
718,
851,
29898,
2798,
4638,
353,
2944,
29889,
657,
29898,
11965,
718,
525,
29901,
24666,
29899,
1990,
29861,
29900,
29962,
13,
462,
1678,
2302,
4619,
29871,
29896,
13,
13,
1678,
1741,
29918,
1853,
29918,
1761,
353,
17288,
29895,
29892,
325,
29897,
363,
413,
29892,
325,
297,
1741,
29918,
1853,
29918,
27126,
29889,
7076,
580,
29962,
13,
1678,
736,
1741,
29918,
1853,
29918,
1761,
13,
13,
13,
1753,
10563,
29918,
3696,
29918,
2230,
29898,
13604,
29918,
1958,
1125,
13,
1678,
1741,
29918,
2230,
29918,
27126,
353,
9657,
580,
13,
1678,
2302,
353,
29871,
29900,
13,
1678,
363,
1741,
29892,
995,
297,
4959,
29918,
1958,
29889,
7076,
7295,
13,
4706,
1741,
29918,
2230,
29918,
27126,
29961,
3696,
29962,
353,
2302,
13,
4706,
2302,
4619,
29871,
29896,
13,
13,
1678,
1741,
29918,
2230,
29918,
1761,
353,
17288,
29895,
29892,
325,
29897,
363,
413,
29892,
325,
297,
1741,
29918,
2230,
29918,
27126,
29889,
7076,
580,
29962,
13,
1678,
736,
1741,
29918,
2230,
29918,
1761,
13,
13,
13,
1753,
10563,
29918,
3696,
29918,
23516,
29898,
1272,
29918,
29881,
312,
29918,
20155,
29892,
2875,
29892,
1741,
29918,
1853,
29892,
1741,
29918,
6799,
1125,
13,
1678,
1741,
29918,
23516,
29918,
1761,
353,
1051,
580,
13,
1678,
10541,
29918,
333,
353,
29871,
29896,
13,
1678,
363,
10541,
297,
848,
29918,
29881,
312,
29918,
20155,
29901,
13,
4706,
4450,
293,
1078,
353,
9750,
1212,
29879,
2096,
29889,
657,
29918,
11965,
293,
1078,
29898,
18616,
663,
29897,
13,
4706,
4959,
353,
1741,
29918,
1853,
29961,
29900,
29901,
2435,
29898,
11965,
293,
1078,
4638,
13,
4706,
1741,
29918,
1853,
353,
1741,
29918,
1853,
29961,
2435,
29898,
11965,
293,
1078,
1125,
29962,
13,
4706,
363,
313,
11965,
29892,
1741,
29897,
297,
14319,
29898,
11965,
293,
1078,
29892,
4959,
1125,
13,
9651,
1741,
29918,
999,
353,
1741,
29961,
29900,
29962,
13,
9651,
363,
2665,
297,
10541,
29901,
13,
18884,
565,
2665,
29889,
657,
877,
7883,
11283,
718,
4450,
29897,
2804,
22868,
2396,
13,
462,
1678,
396,
671,
937,
9750,
770,
408,
325,
29876,
770,
13,
462,
1678,
325,
29876,
29918,
12154,
353,
2665,
29889,
657,
29898,
11965,
718,
525,
29901,
18564,
29899,
1990,
29861,
29900,
3816,
29896,
29962,
13,
462,
1678,
565,
2665,
29889,
657,
877,
18009,
3267,
1495,
297,
302,
1309,
29918,
20155,
29901,
13,
462,
4706,
363,
313,
999,
29892,
875,
29897,
297,
2875,
29901,
13,
462,
9651,
565,
875,
1275,
2665,
29889,
657,
877,
2500,
29374,
13,
462,
18884,
1741,
29918,
23516,
29918,
1761,
29889,
4397,
3552,
3696,
29918,
999,
29892,
325,
29876,
29918,
12154,
29892,
2143,
876,
13,
462,
18884,
2867,
13,
462,
1678,
25342,
2665,
29889,
657,
877,
18009,
3267,
1495,
297,
9750,
29918,
1066,
29901,
13,
462,
4706,
9750,
29918,
6799,
353,
1741,
29918,
6799,
29889,
657,
29898,
18616,
663,
29918,
333,
29897,
13,
462,
4706,
363,
313,
552,
29885,
655,
29892,
14737,
29888,
29897,
297,
9750,
29918,
6799,
29901,
13,
462,
9651,
565,
2665,
29889,
657,
877,
7390,
331,
655,
1495,
1275,
282,
13846,
29901,
13,
462,
18884,
1741,
29918,
23516,
29918,
1761,
29889,
4397,
3552,
3696,
29918,
999,
29892,
325,
29876,
29918,
12154,
29892,
14737,
29888,
876,
13,
13,
4706,
10541,
29918,
333,
4619,
29871,
29896,
13,
13,
1678,
736,
1741,
29918,
23516,
29918,
1761,
13,
2
] |
hrl_dynamic_mpc/src/opt_traj_tools.py | gt-ros-pkg/hrl-haptic-manip | 1 | 75566 | #
#
# Copyright (c) 2013, Georgia Tech Research Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Georgia Tech Research Corporation nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEORGIA TECH RESEARCH CORPORATION ''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 GEORGIA TECH 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.
#
# \authors: <NAME> (Healthcare Robotics Lab, Georgia Tech.)
# \adviser: <NAME> (Healthcare Robotics Lab, Georgia Tech.)
import itertools
import matplotlib.pyplot as pp
import roslib; roslib.load_manifest('hrl_dynamic_mpc')
import rospy
import hrl_lib.util as ut
import hrl_lib.matplotlib_util as mpu
from matplotlib import pyplot as pl
from numpy import matrix, cos, arange, zeros, ones, asarray, zeros, mat, array, transpose, vstack, min, max
from numpy import dot, radians, degrees, size, shape, cov, log, linalg, random as rd
import numpy as np
import random
import math
import sys
import time
######################################################################################
## Joint Limits ##
# create joint limit dicts
# if arm == 'r':
# max_lim = np.radians([ 120.00, 122.15, 77.5, 144., 122., 45., 45.])
# min_lim = np.radians([ -47.61, -20., -77.5, 0., -80., -45., -45.])
# else:
# max_lim = np.radians([ 120.00, 20., 77.5, 144., 80., 45., 45.])
# min_lim = np.radians([ -47.61, -122.15, -77.5, 0., -122., -45., -45.])
## Velocity Limits ##
# 5 deg/s to 15 deg/s
# Optimization Criteria
# d-optimality criterion : -log(det(M)) : M = covariance matrix of regressor matrix
#####################################################################################
def get_init_condition(vl, vh, tf, wf, N):
qdot_list = []
t = arange(0,tf,0.1)
M = size(t)
A = zeros((M,2*N+1))
for i in range(M):
qdot_list.append(radians(random.randrange(vl,vh)))
for i in range(M):
j = 0
k = 1
while (j < 2*N):
A[i][j] = (math.sin(wf*t[i]*k))/(wf*k)
A[i][j+1] = (math.cos(wf*t[i]*k))/(wf*k)
k=k+1
j=j+2
A[i][j] = 1
ans = dot((array(((matrix(A).T)*matrix(A)).I)*(matrix(A).T)),array(qdot_list))
return ans.tolist()
def get_ref_traj_at_time(x, time, num_dof, N):
wf = 0.1*2*math.pi
q = []
qd = []
qdd = []
for j in xrange(num_dof):
q_buff = x[(j+1)*(2*N)]
qd_buff = 0.
qdd_buff = 0.
for k in xrange(N):
t = time
a = x[j*(2*N+1)+2*k]
b = x[j*(2*N+1)+2*k+1]
q_buff = q_buff + a*(math.sin(wf*t*(k+1)))/(wf*(k+1)) - b*(math.cos(wf*t*(k+1)))/(wf*(k+1))
qd_buff = qd_buff + a*(math.cos(wf*t*(k+1))) - b*(math.sin(wf*t*(k+1)))
qdd_buff = qdd_buff + a*(wf*(k+1))*(math.sin(wf*t*(k+1))) + b*(wf*(k+1))*(math.cos(wf*t*(k+1)))
q.append(q_buff)
qd.append(qd_buff)
qdd.append(qdd_buff)
return q, qd, qdd
def get_ref_traj(x, t_total, rate, num_dof, N):
wf = 0.1*2*math.pi
num_samples = int(t_total/float(rate))
q = []
qd = []
qdd = []
# print "x is :", x
# print "num_samples is :", num_samples
for i in xrange(num_samples):
q_cur = []
qd_cur = []
qdd_cur = []
for j in xrange(num_dof):
q_buff = x[(j+1)*(2*N)]
# print "j is :", j
# print "x[(j+1)*(2*N)]", x[(j+1)*(2*N)]
qd_buff = 0.
qdd_buff = 0.
for k in xrange(N):
t = i*rate
a = x[j*(2*N+1)+2*k]
b = x[j*(2*N+1)+2*k+1]
if False:
print "t is :", t
print "a is :", a
print "b is :", b
print "wf is :", wf
print "k is :", k
print "(wf*t*(k+1))", (wf*t*(k+1))
q_buff = q_buff + a*(math.sin(wf*t*(k+1)))/(wf*(k+1)) - b*(math.cos(wf*t*(k+1)))/(wf*(k+1))
qd_buff = qd_buff + a*(math.cos(wf*t*(k+1))) - b*(math.sin(wf*t*(k+1)))
qdd_buff = qdd_buff + a*(wf*(k+1))*(math.sin(wf*t*(k+1))) + b*(wf*(k+1))*(math.cos(wf*t*(k+1)))
#raw_input()
q_cur.append(q_buff)
qd_cur.append(qd_buff)
qdd_cur.append(qdd_buff)
q.append(q_cur)
qd.append(qd_cur)
qdd.append(qdd_cur)
# pp.figure()
# pp.plot(q)
# pp.show()
#time.sleep(5)
return q, qd, qdd
# def get_ref_traj(init_delta, t, num_dof):
# wf = 0.1
# N = 5
# numJoints = num_dof
# q_list = []
# qdot_list = []
# qddot_list = []
# rows = numJoints
# columns = 2*N + 1
# temp_delta = zeros((rows, columns))
# for row in range(rows):
# for column in range(columns):
# temp_delta[row][column] = init_delta[row*columns+column]
# for row in range(rows):
# delta = temp_delta[row].tolist()
# q_element = 0.0
# qdot_element = 0.0
# qddot_element = 0.0
# j = 0
# k = 1
# while (j < 2*N):
# q_element = q_element + delta[j]*(math.sin(wf*t*k))/(wf*k) - delta[j+1]*(math.cos(wf*t*k))/(wf*k)
# qdot_element = qdot_element + delta[j]*(math.cos(wf*t*k)) + delta[j+1]*(math.sin(wf*t*k))
# qdfdot_element = qddot_element - delta[j]*(wf*k)*(math.sin(wf*t*k)) + delta[j+1]*(wf*k)*(math.cos(wf*t*k))
# k=k+1
# j=j+2
# q_list.append(q_element + delta[2*N])
# qdot_list.append(qdot_element)
# qddot_list.append(qddot_element)
# return q_list, qdot_list, qddot_list
if __name__ == '__main__':
print "hello. world."
| [
1,
396,
13,
29937,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29941,
29892,
16762,
1920,
305,
10550,
15025,
13,
29937,
2178,
10462,
21676,
29889,
13,
29937,
29871,
13,
29937,
4367,
391,
3224,
322,
671,
297,
2752,
322,
7581,
7190,
29892,
411,
470,
1728,
13,
29937,
21733,
29892,
526,
21905,
4944,
393,
278,
1494,
5855,
526,
1539,
29901,
13,
29937,
268,
334,
4367,
391,
3224,
29879,
310,
2752,
775,
1818,
11551,
278,
2038,
3509,
1266,
13,
29937,
539,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
29889,
13,
29937,
268,
334,
4367,
391,
3224,
29879,
297,
7581,
883,
1818,
18532,
278,
2038,
3509,
1266,
13,
29937,
539,
8369,
29892,
445,
1051,
310,
5855,
322,
278,
1494,
2313,
433,
4193,
297,
278,
13,
29937,
539,
5106,
322,
29914,
272,
916,
17279,
4944,
411,
278,
4978,
29889,
13,
29937,
268,
334,
2448,
2121,
278,
1024,
310,
278,
16762,
1920,
305,
10550,
15025,
3643,
278,
13,
29937,
539,
2983,
310,
967,
17737,
29560,
1122,
367,
1304,
304,
1095,
272,
344,
470,
27391,
9316,
13,
29937,
539,
10723,
515,
445,
7047,
1728,
2702,
7536,
3971,
10751,
29889,
13,
29937,
29871,
13,
29937,
3446,
3235,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
6770,
402,
29923,
1955,
29954,
10764,
17067,
3210,
5195,
1660,
1718,
3210,
315,
1955,
29925,
1955,
8098,
6629,
3289,
8519,
4907,
5300,
13,
29937,
13764,
29979,
8528,
15094,
1799,
6323,
306,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
29892,
2672,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
6093,
306,
3580,
5265,
3352,
13,
29937,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
5300,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
319,
1525,
13,
29937,
28657,
13875,
8890,
29928,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
402,
29923,
1955,
29954,
10764,
17067,
3210,
20700,
17705,
6181,
15842,
13764,
29979,
22471,
26282,
29892,
2672,
4571,
26282,
29892,
13,
29937,
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,
313,
1177,
6154,
15789,
4214,
29892,
350,
2692,
6058,
13,
29937,
27848,
3352,
7495,
29892,
13756,
29907,
11499,
13780,
8079,
27092,
1254,
1806,
26027,
21947,
29949,
8452,
6323,
26996,
29963,
2965,
2890,
29936,
11247,
1799,
8079,
501,
1660,
29892,
360,
8254,
29892,
13,
29937,
6323,
13756,
29943,
1806,
29903,
29936,
6323,
350,
3308,
8895,
1799,
2672,
4945,
29934,
4897,
29911,
2725,
29897,
29832,
8851,
5348,
12766,
17171,
29928,
5300,
6732,
13764,
29979,
6093,
18929,
8079,
13,
29937,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
8707,
29911,
4717,
1783,
29892,
6850,
3960,
1783,
17705,
2882,
6227,
11937,
29892,
6323,
323,
8476,
313,
1177,
6154,
15789,
4214,
405,
11787,
5265,
24647,
4741,
13,
29937,
6323,
438,
29911,
4448,
22119,
1660,
29897,
9033,
3235,
4214,
2672,
13764,
29979,
399,
29909,
29979,
19474,
8079,
6093,
501,
1660,
8079,
3446,
3235,
7791,
7818,
12982,
1525,
29892,
382,
29963,
1430,
10762,
13,
29937,
11033,
18118,
1660,
29928,
8079,
6093,
21521,
1799,
8979,
6227,
11937,
8079,
20134,
3210,
21330,
1529,
1692,
29889,
13,
29937,
13,
13,
29937,
320,
5150,
943,
29901,
529,
5813,
29958,
313,
3868,
4298,
18020,
6417,
327,
1199,
12016,
29892,
16762,
1920,
305,
1846,
13,
29937,
320,
328,
1730,
261,
29901,
529,
5813,
29958,
313,
3868,
4298,
18020,
6417,
327,
1199,
12016,
29892,
16762,
1920,
305,
1846,
13,
13,
13,
5215,
4256,
8504,
13,
5215,
22889,
29889,
2272,
5317,
408,
6499,
13,
13,
5215,
14652,
1982,
29936,
14652,
1982,
29889,
1359,
29918,
29135,
877,
1092,
29880,
29918,
16626,
29918,
1526,
29883,
1495,
13,
13,
5215,
696,
1028,
29891,
13,
13,
5215,
298,
2096,
29918,
1982,
29889,
4422,
408,
3477,
13,
5215,
298,
2096,
29918,
1982,
29889,
2922,
17357,
29918,
4422,
408,
286,
3746,
13,
3166,
22889,
1053,
11451,
5317,
408,
715,
13,
13,
3166,
12655,
1053,
4636,
29892,
6776,
29892,
564,
927,
29892,
24786,
29892,
6743,
29892,
408,
2378,
29892,
24786,
29892,
1775,
29892,
1409,
29892,
1301,
4220,
29892,
325,
1429,
29892,
1375,
29892,
4236,
13,
3166,
12655,
1053,
8329,
29892,
2971,
5834,
29892,
14496,
29892,
2159,
29892,
8267,
29892,
18838,
29892,
1480,
29892,
301,
979,
29887,
29892,
4036,
408,
364,
29881,
13,
5215,
12655,
408,
7442,
13,
5215,
4036,
13,
5215,
5844,
13,
5215,
10876,
13,
5215,
931,
29871,
13,
13,
13383,
13383,
13383,
13383,
13383,
4136,
2277,
13,
2277,
435,
2461,
9628,
1169,
444,
13,
29937,
1653,
14002,
4046,
9657,
29879,
13,
29937,
4706,
565,
5075,
1275,
525,
29878,
2396,
13,
29937,
9651,
4236,
29918,
2576,
353,
7442,
29889,
3665,
5834,
4197,
29871,
29896,
29906,
29900,
29889,
29900,
29900,
29892,
29871,
29896,
29906,
29906,
29889,
29896,
29945,
29892,
29871,
29955,
29955,
29889,
29945,
29892,
29871,
29896,
29946,
29946,
1696,
29871,
29896,
29906,
29906,
1696,
259,
29946,
29945,
1696,
259,
29946,
29945,
29889,
2314,
13,
29937,
9651,
1375,
29918,
2576,
353,
7442,
29889,
3665,
5834,
4197,
448,
29946,
29955,
29889,
29953,
29896,
29892,
29871,
448,
29906,
29900,
1696,
448,
29955,
29955,
29889,
29945,
29892,
1678,
29900,
1696,
448,
29947,
29900,
1696,
448,
29946,
29945,
1696,
448,
29946,
29945,
29889,
2314,
13,
29937,
4706,
1683,
29901,
13,
29937,
9651,
4236,
29918,
2576,
353,
7442,
29889,
3665,
5834,
4197,
29871,
29896,
29906,
29900,
29889,
29900,
29900,
29892,
1678,
29906,
29900,
1696,
259,
29955,
29955,
29889,
29945,
29892,
29871,
29896,
29946,
29946,
1696,
1678,
29947,
29900,
1696,
259,
29946,
29945,
1696,
259,
29946,
29945,
29889,
2314,
13,
29937,
9651,
1375,
29918,
2576,
353,
7442,
29889,
3665,
5834,
4197,
448,
29946,
29955,
29889,
29953,
29896,
29892,
448,
29896,
29906,
29906,
29889,
29896,
29945,
29892,
448,
29955,
29955,
29889,
29945,
29892,
1678,
29900,
1696,
448,
29896,
29906,
29906,
1696,
448,
29946,
29945,
1696,
448,
29946,
29945,
29889,
2314,
13,
13,
2277,
12019,
25245,
9628,
1169,
444,
13,
29937,
29871,
29945,
3587,
29914,
29879,
304,
29871,
29896,
29945,
3587,
29914,
29879,
13,
13,
29937,
20693,
326,
2133,
315,
21977,
13,
29937,
270,
29899,
20640,
2877,
28770,
291,
584,
448,
1188,
29898,
4801,
29898,
29924,
876,
584,
341,
353,
18838,
279,
8837,
4636,
310,
337,
3663,
272,
4636,
13,
13,
13383,
13383,
13383,
13383,
13383,
4136,
29937,
13,
13,
1753,
679,
29918,
2344,
29918,
16122,
29898,
20901,
29892,
325,
29882,
29892,
15886,
29892,
281,
29888,
29892,
405,
1125,
13,
1678,
3855,
6333,
29918,
1761,
353,
5159,
13,
1678,
260,
353,
564,
927,
29898,
29900,
29892,
13264,
29892,
29900,
29889,
29896,
29897,
13,
1678,
341,
353,
2159,
29898,
29873,
29897,
13,
1678,
319,
353,
24786,
3552,
29924,
29892,
29906,
29930,
29940,
29974,
29896,
876,
13,
1678,
363,
474,
297,
3464,
29898,
29924,
1125,
13,
4706,
3855,
6333,
29918,
1761,
29889,
4397,
29898,
3665,
5834,
29898,
8172,
29889,
9502,
3881,
29898,
20901,
29892,
29894,
29882,
4961,
13,
13,
1678,
363,
474,
297,
3464,
29898,
29924,
1125,
13,
4706,
432,
353,
29871,
29900,
13,
4706,
413,
353,
29871,
29896,
13,
4706,
1550,
313,
29926,
529,
29871,
29906,
29930,
29940,
1125,
13,
9651,
319,
29961,
29875,
3816,
29926,
29962,
353,
313,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
29961,
29875,
14178,
29895,
876,
14571,
29893,
29888,
29930,
29895,
29897,
13,
9651,
319,
29961,
29875,
3816,
29926,
29974,
29896,
29962,
353,
313,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
29961,
29875,
14178,
29895,
876,
14571,
29893,
29888,
29930,
29895,
29897,
13,
9651,
413,
29922,
29895,
29974,
29896,
13,
9651,
432,
29922,
29926,
29974,
29906,
13,
4706,
319,
29961,
29875,
3816,
29926,
29962,
353,
29871,
29896,
1678,
13,
13,
1678,
6063,
353,
8329,
3552,
2378,
3552,
29898,
5344,
29898,
29909,
467,
29911,
11877,
5344,
29898,
29909,
8106,
29902,
11877,
29898,
5344,
29898,
29909,
467,
29911,
8243,
2378,
29898,
29939,
6333,
29918,
1761,
876,
13,
1678,
736,
6063,
29889,
25027,
391,
580,
13,
13,
1753,
679,
29918,
999,
29918,
3018,
29926,
29918,
271,
29918,
2230,
29898,
29916,
29892,
931,
29892,
954,
29918,
29881,
974,
29892,
405,
1125,
13,
1678,
281,
29888,
353,
29871,
29900,
29889,
29896,
29930,
29906,
29930,
755,
29889,
1631,
13,
1678,
3855,
353,
5159,
13,
1678,
3855,
29881,
353,
5159,
13,
1678,
3855,
1289,
353,
5159,
13,
13,
1678,
363,
432,
297,
921,
3881,
29898,
1949,
29918,
29881,
974,
1125,
13,
4706,
3855,
29918,
28040,
353,
921,
15625,
29926,
29974,
29896,
11877,
29898,
29906,
29930,
29940,
4638,
13,
4706,
3855,
29881,
29918,
28040,
353,
29871,
29900,
29889,
13,
4706,
3855,
1289,
29918,
28040,
353,
29871,
29900,
29889,
13,
4706,
363,
413,
297,
921,
3881,
29898,
29940,
1125,
13,
9651,
260,
353,
931,
13,
9651,
263,
353,
921,
29961,
29926,
16395,
29906,
29930,
29940,
29974,
29896,
7240,
29906,
29930,
29895,
29962,
13,
9651,
289,
353,
921,
29961,
29926,
16395,
29906,
29930,
29940,
29974,
29896,
7240,
29906,
29930,
29895,
29974,
29896,
29962,
13,
9651,
3855,
29918,
28040,
353,
3855,
29918,
28040,
718,
263,
16395,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
14571,
29893,
29888,
16395,
29895,
29974,
29896,
876,
448,
289,
16395,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
14571,
29893,
29888,
16395,
29895,
29974,
29896,
876,
13,
9651,
3855,
29881,
29918,
28040,
353,
3855,
29881,
29918,
28040,
718,
263,
16395,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
448,
289,
16395,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
13,
9651,
3855,
1289,
29918,
28040,
353,
3855,
1289,
29918,
28040,
718,
263,
16395,
29893,
29888,
16395,
29895,
29974,
29896,
876,
16395,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
718,
289,
16395,
29893,
29888,
16395,
29895,
29974,
29896,
876,
16395,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
13,
4706,
3855,
29889,
4397,
29898,
29939,
29918,
28040,
29897,
13,
4706,
3855,
29881,
29889,
4397,
29898,
29939,
29881,
29918,
28040,
29897,
13,
4706,
3855,
1289,
29889,
4397,
29898,
29939,
1289,
29918,
28040,
29897,
13,
13,
1678,
736,
3855,
29892,
3855,
29881,
29892,
3855,
1289,
13,
13,
13,
13,
1753,
679,
29918,
999,
29918,
3018,
29926,
29898,
29916,
29892,
260,
29918,
7827,
29892,
6554,
29892,
954,
29918,
29881,
974,
29892,
405,
1125,
13,
1678,
281,
29888,
353,
29871,
29900,
29889,
29896,
29930,
29906,
29930,
755,
29889,
1631,
13,
13,
1678,
954,
29918,
27736,
353,
938,
29898,
29873,
29918,
7827,
29914,
7411,
29898,
10492,
876,
13,
1678,
3855,
353,
5159,
13,
1678,
3855,
29881,
353,
5159,
13,
1678,
3855,
1289,
353,
5159,
13,
13,
1678,
396,
1596,
376,
29916,
338,
584,
613,
921,
13,
1678,
396,
1596,
376,
1949,
29918,
27736,
338,
584,
613,
954,
29918,
27736,
13,
1678,
363,
474,
297,
921,
3881,
29898,
1949,
29918,
27736,
1125,
13,
4706,
3855,
29918,
2764,
353,
5159,
13,
4706,
3855,
29881,
29918,
2764,
353,
5159,
13,
4706,
3855,
1289,
29918,
2764,
353,
5159,
13,
13,
4706,
363,
432,
297,
921,
3881,
29898,
1949,
29918,
29881,
974,
1125,
13,
9651,
3855,
29918,
28040,
353,
921,
15625,
29926,
29974,
29896,
11877,
29898,
29906,
29930,
29940,
4638,
13,
9651,
396,
1596,
376,
29926,
338,
584,
613,
432,
13,
9651,
396,
1596,
376,
29916,
15625,
29926,
29974,
29896,
11877,
29898,
29906,
29930,
29940,
4638,
613,
921,
15625,
29926,
29974,
29896,
11877,
29898,
29906,
29930,
29940,
4638,
13,
9651,
3855,
29881,
29918,
28040,
353,
29871,
29900,
29889,
13,
9651,
3855,
1289,
29918,
28040,
353,
29871,
29900,
29889,
13,
9651,
363,
413,
297,
921,
3881,
29898,
29940,
1125,
13,
18884,
260,
353,
474,
29930,
10492,
13,
18884,
263,
353,
921,
29961,
29926,
16395,
29906,
29930,
29940,
29974,
29896,
7240,
29906,
29930,
29895,
29962,
13,
18884,
289,
353,
921,
29961,
29926,
16395,
29906,
29930,
29940,
29974,
29896,
7240,
29906,
29930,
29895,
29974,
29896,
29962,
13,
18884,
565,
7700,
29901,
13,
462,
1678,
1596,
376,
29873,
338,
584,
613,
260,
13,
462,
1678,
1596,
376,
29874,
338,
584,
613,
263,
13,
462,
1678,
1596,
376,
29890,
338,
584,
613,
289,
13,
462,
1678,
1596,
376,
29893,
29888,
338,
584,
613,
281,
29888,
13,
462,
1678,
1596,
376,
29895,
338,
584,
613,
413,
13,
462,
1678,
1596,
18227,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
876,
613,
313,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
876,
13,
18884,
3855,
29918,
28040,
353,
3855,
29918,
28040,
718,
263,
16395,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
14571,
29893,
29888,
16395,
29895,
29974,
29896,
876,
448,
289,
16395,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
14571,
29893,
29888,
16395,
29895,
29974,
29896,
876,
13,
18884,
3855,
29881,
29918,
28040,
353,
3855,
29881,
29918,
28040,
718,
263,
16395,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
448,
289,
16395,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
13,
18884,
3855,
1289,
29918,
28040,
353,
3855,
1289,
29918,
28040,
718,
263,
16395,
29893,
29888,
16395,
29895,
29974,
29896,
876,
16395,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
718,
289,
16395,
29893,
29888,
16395,
29895,
29974,
29896,
876,
16395,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
16395,
29895,
29974,
29896,
4961,
13,
18884,
396,
1610,
29918,
2080,
580,
13,
9651,
3855,
29918,
2764,
29889,
4397,
29898,
29939,
29918,
28040,
29897,
13,
9651,
3855,
29881,
29918,
2764,
29889,
4397,
29898,
29939,
29881,
29918,
28040,
29897,
13,
9651,
3855,
1289,
29918,
2764,
29889,
4397,
29898,
29939,
1289,
29918,
28040,
29897,
13,
4706,
3855,
29889,
4397,
29898,
29939,
29918,
2764,
29897,
13,
4706,
3855,
29881,
29889,
4397,
29898,
29939,
29881,
29918,
2764,
29897,
13,
4706,
3855,
1289,
29889,
4397,
29898,
29939,
1289,
29918,
2764,
29897,
13,
13,
1678,
396,
6499,
29889,
4532,
580,
13,
1678,
396,
6499,
29889,
5317,
29898,
29939,
29897,
13,
1678,
396,
6499,
29889,
4294,
580,
13,
1678,
396,
2230,
29889,
17059,
29898,
29945,
29897,
13,
1678,
736,
3855,
29892,
3855,
29881,
29892,
3855,
1289,
13,
13,
13,
29937,
822,
679,
29918,
999,
29918,
3018,
29926,
29898,
2344,
29918,
4181,
29892,
260,
29892,
954,
29918,
29881,
974,
1125,
13,
29937,
268,
281,
29888,
353,
29871,
29900,
29889,
29896,
13,
29937,
268,
405,
353,
29871,
29945,
13,
29937,
268,
954,
29967,
2461,
29879,
353,
954,
29918,
29881,
974,
13,
29937,
268,
3855,
29918,
1761,
353,
5159,
13,
29937,
268,
3855,
6333,
29918,
1761,
353,
5159,
13,
29937,
268,
3855,
1289,
327,
29918,
1761,
353,
5159,
13,
29937,
268,
4206,
353,
954,
29967,
2461,
29879,
13,
29937,
268,
4341,
353,
29871,
29906,
29930,
29940,
718,
29871,
29896,
13,
29937,
268,
5694,
29918,
4181,
353,
24786,
3552,
5727,
29892,
4341,
876,
13,
29937,
268,
363,
1948,
297,
3464,
29898,
5727,
1125,
13,
29937,
308,
363,
1897,
297,
3464,
29898,
13099,
1125,
13,
29937,
632,
5694,
29918,
4181,
29961,
798,
3816,
4914,
29962,
353,
2069,
29918,
4181,
29961,
798,
29930,
13099,
29974,
4914,
29962,
13,
29937,
268,
363,
1948,
297,
3464,
29898,
5727,
1125,
13,
29937,
308,
19471,
353,
5694,
29918,
4181,
29961,
798,
1822,
25027,
391,
580,
13,
29937,
308,
3855,
29918,
5029,
353,
29871,
29900,
29889,
29900,
13,
29937,
308,
3855,
6333,
29918,
5029,
353,
29871,
29900,
29889,
29900,
13,
29937,
308,
3855,
1289,
327,
29918,
5029,
353,
29871,
29900,
29889,
29900,
13,
29937,
308,
432,
353,
29871,
29900,
13,
29937,
308,
413,
353,
29871,
29896,
13,
29937,
308,
1550,
313,
29926,
529,
29871,
29906,
29930,
29940,
1125,
13,
29937,
632,
3855,
29918,
5029,
353,
3855,
29918,
5029,
718,
19471,
29961,
29926,
14178,
29898,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
29930,
29895,
876,
14571,
29893,
29888,
29930,
29895,
29897,
448,
19471,
29961,
29926,
29974,
29896,
14178,
29898,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
29930,
29895,
876,
14571,
29893,
29888,
29930,
29895,
29897,
13,
29937,
632,
3855,
6333,
29918,
5029,
353,
3855,
6333,
29918,
5029,
718,
19471,
29961,
29926,
14178,
29898,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
29930,
29895,
876,
718,
19471,
29961,
29926,
29974,
29896,
14178,
29898,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
29930,
29895,
876,
29871,
13,
29937,
632,
3855,
2176,
6333,
29918,
5029,
353,
3855,
1289,
327,
29918,
5029,
448,
19471,
29961,
29926,
14178,
29898,
29893,
29888,
29930,
29895,
11877,
29898,
755,
29889,
5223,
29898,
29893,
29888,
29930,
29873,
29930,
29895,
876,
718,
19471,
29961,
29926,
29974,
29896,
14178,
29898,
29893,
29888,
29930,
29895,
11877,
29898,
755,
29889,
3944,
29898,
29893,
29888,
29930,
29873,
29930,
29895,
876,
13,
29937,
632,
413,
29922,
29895,
29974,
29896,
13,
29937,
632,
432,
29922,
29926,
29974,
29906,
1678,
13,
29937,
308,
3855,
29918,
1761,
29889,
4397,
29898,
29939,
29918,
5029,
718,
19471,
29961,
29906,
29930,
29940,
2314,
13,
29937,
308,
3855,
6333,
29918,
1761,
29889,
4397,
29898,
29939,
6333,
29918,
5029,
29897,
13,
29937,
308,
3855,
1289,
327,
29918,
1761,
29889,
4397,
29898,
29939,
1289,
327,
29918,
5029,
29897,
13,
29937,
268,
736,
3855,
29918,
1761,
29892,
3855,
6333,
29918,
1761,
29892,
3855,
1289,
327,
29918,
1761,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
268,
13,
1678,
1596,
376,
12199,
29889,
3186,
1213,
13,
13,
13,
2
] |
General/serverInfo.py | Aggis15/T4NK0R | 0 | 195310 | import logging
import discord
from discord.ext import commands
from discord.commands import slash_command
import json
import requests
from PIL import Image, ImageDraw, ImageFont
from resizeimage import resizeimage
# Logging
logging.basicConfig(
filename="./logs/discordlogs.log",
filemode="w",
format="%(name)s - %(levelname)s - %(message)s",
)
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# Initiate json
file = open("config.json")
data = json.load(file)
# Public variables
guildID = data["guildID"][0]
class serverInfo(commands.Cog):
def __init__(self, bot):
self.bot = bot
@slash_command(
guild_ids=[guildID], description="A command to check the server information!"
)
async def server(self, ctx):
guild = ctx.guild
serverLevel = guild.premium_tier
serverBoosts = guild.premium_subscription_count
serverMembers = len(guild.members)
serverTextChannels = len(guild.text_channels)
serverVoiceChannels = len(guild.voice_channels)
serverEmojis = len(guild.emojis)
serverRoles = len(guild.roles)
# Download the avatar
getGuildAvatar = requests.get(guild.icon.url)
with open(f"./Images/avatarCache/{guild.id}.png", "wb") as outfile:
outfile.write(getGuildAvatar.content)
guildAvatarImage = Image.open(f"./Images/avatarCache/{guild.id}.png")
# Crop the avatar to make it a circle
width, height = guildAvatarImage.size
x = width - height
img_cropped = guildAvatarImage.crop((x, 0, x + height, height))
mask = Image.new("L", img_cropped.size)
mask_draw = ImageDraw.Draw(mask)
width, height = img_cropped.size
mask_draw.ellipse((0, 0, width, height), fill=255)
img_cropped.putalpha(mask)
img_cropped.save(f"./Images/avatarCache/{guild.id}.png")
# Resize the avatar to fit the image
resizeAvatar = Image.open(f"./Images/avatarCache/{guild.id}.png")
resizeAvatar = resizeimage.resize_width(resizeAvatar, 100)
resizeAvatar.save(f"./Images/avatarCache/{guild.id}.png", resizeAvatar.format)
defaultImage = Image.open("./Images/serverInfo.png")
draw = ImageDraw.Draw(defaultImage)
font = ImageFont.truetype("Bungee-Regular.ttf", 36)
draw.text((438, 38), str(serverLevel), (157, 156, 157), font=font)
draw.text((332, 85), str(serverBoosts), (157, 156, 157), font=font)
draw.text((246, 148), str(serverMembers), (157, 156, 157), font=font)
draw.text((370, 199), str(serverTextChannels), (157, 156, 157), font=font)
draw.text((394, 243), str(serverVoiceChannels), (157, 156, 157), font=font)
draw.text((388, 288), str(serverEmojis), (157, 156, 157), font=font)
draw.text((357, 334), str(serverRoles), (157, 156, 157), font=font)
avatarImage = Image.open(f"./Images/avatarCache/{guild.id}.png")
defaultImage.paste(avatarImage, (40, 40), avatarImage)
defaultImage.save("./Images/serverImageReady.png")
await ctx.respond(file=discord.File("./Images/serverImageReady.png"))
logger.info(
f"{ctx.author.name} with ID: {ctx.author.id} has used the info slash command"
)
@server.error
async def server_error(self, ctx, error):
await ctx.respond(f"`{error}`")
def setup(bot):
bot.add_cog(serverInfo(bot))
| [
1,
1053,
12183,
13,
5215,
2313,
536,
13,
3166,
2313,
536,
29889,
1062,
1053,
8260,
13,
3166,
2313,
536,
29889,
26381,
1053,
24765,
29918,
6519,
13,
5215,
4390,
13,
5215,
7274,
13,
3166,
349,
6227,
1053,
7084,
29892,
7084,
8537,
29892,
7084,
9824,
13,
3166,
19490,
3027,
1053,
19490,
3027,
13,
13,
29937,
4522,
3460,
13,
21027,
29889,
16121,
3991,
29898,
13,
1678,
10422,
543,
6904,
20756,
29914,
2218,
16090,
20756,
29889,
1188,
613,
13,
1678,
934,
8513,
543,
29893,
613,
13,
1678,
3402,
543,
29995,
29898,
978,
29897,
29879,
448,
1273,
29898,
5563,
978,
29897,
29879,
448,
1273,
29898,
4906,
29897,
29879,
613,
13,
29897,
13,
21707,
353,
12183,
29889,
657,
16363,
580,
13,
21707,
29889,
842,
10108,
29898,
21027,
29889,
11690,
29897,
13,
13,
29937,
512,
4812,
403,
4390,
13,
1445,
353,
1722,
703,
2917,
29889,
3126,
1159,
13,
1272,
353,
4390,
29889,
1359,
29898,
1445,
29897,
13,
13,
29937,
5236,
3651,
13,
2543,
789,
1367,
353,
848,
3366,
2543,
789,
1367,
3108,
29961,
29900,
29962,
13,
13,
13,
1990,
1923,
3401,
29898,
26381,
29889,
29907,
468,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9225,
1125,
13,
4706,
1583,
29889,
7451,
353,
9225,
13,
13,
1678,
732,
17057,
29918,
6519,
29898,
13,
4706,
1410,
789,
29918,
4841,
11759,
2543,
789,
1367,
1402,
6139,
543,
29909,
1899,
304,
1423,
278,
1923,
2472,
3850,
13,
1678,
1723,
13,
1678,
7465,
822,
1923,
29898,
1311,
29892,
12893,
1125,
13,
4706,
1410,
789,
353,
12893,
29889,
2543,
789,
13,
4706,
1923,
10108,
353,
1410,
789,
29889,
1457,
29885,
1974,
29918,
29873,
631,
13,
4706,
1923,
8431,
520,
29879,
353,
1410,
789,
29889,
1457,
29885,
1974,
29918,
1491,
22371,
29918,
2798,
13,
4706,
1923,
29924,
13415,
353,
7431,
29898,
2543,
789,
29889,
28109,
29897,
13,
4706,
1923,
1626,
1451,
12629,
353,
7431,
29898,
2543,
789,
29889,
726,
29918,
305,
12629,
29897,
13,
4706,
1923,
29963,
29877,
625,
1451,
12629,
353,
7431,
29898,
2543,
789,
29889,
14917,
29918,
305,
12629,
29897,
13,
4706,
1923,
6026,
3848,
275,
353,
7431,
29898,
2543,
789,
29889,
331,
3848,
275,
29897,
13,
4706,
1923,
29934,
6544,
353,
7431,
29898,
2543,
789,
29889,
307,
793,
29897,
13,
4706,
396,
25553,
278,
1029,
14873,
13,
4706,
679,
9485,
789,
29909,
9046,
279,
353,
7274,
29889,
657,
29898,
2543,
789,
29889,
4144,
29889,
2271,
29897,
13,
4706,
411,
1722,
29898,
29888,
1642,
29914,
20163,
29914,
485,
14873,
10408,
19248,
2543,
789,
29889,
333,
1836,
2732,
613,
376,
29893,
29890,
1159,
408,
714,
1445,
29901,
13,
9651,
714,
1445,
29889,
3539,
29898,
657,
9485,
789,
29909,
9046,
279,
29889,
3051,
29897,
13,
4706,
1410,
789,
29909,
9046,
279,
2940,
353,
7084,
29889,
3150,
29898,
29888,
1642,
29914,
20163,
29914,
485,
14873,
10408,
19248,
2543,
789,
29889,
333,
1836,
2732,
1159,
13,
4706,
396,
315,
1336,
278,
1029,
14873,
304,
1207,
372,
263,
8607,
13,
4706,
2920,
29892,
3171,
353,
1410,
789,
29909,
9046,
279,
2940,
29889,
2311,
13,
4706,
921,
353,
2920,
448,
3171,
13,
4706,
10153,
29918,
24077,
2986,
353,
1410,
789,
29909,
9046,
279,
2940,
29889,
29883,
1336,
3552,
29916,
29892,
29871,
29900,
29892,
921,
718,
3171,
29892,
3171,
876,
13,
4706,
11105,
353,
7084,
29889,
1482,
703,
29931,
613,
10153,
29918,
24077,
2986,
29889,
2311,
29897,
13,
4706,
11105,
29918,
4012,
353,
7084,
8537,
29889,
8537,
29898,
13168,
29897,
13,
4706,
2920,
29892,
3171,
353,
10153,
29918,
24077,
2986,
29889,
2311,
13,
4706,
11105,
29918,
4012,
29889,
295,
5843,
3552,
29900,
29892,
29871,
29900,
29892,
2920,
29892,
3171,
511,
5445,
29922,
29906,
29945,
29945,
29897,
13,
4706,
10153,
29918,
24077,
2986,
29889,
649,
2312,
29898,
13168,
29897,
13,
4706,
10153,
29918,
24077,
2986,
29889,
7620,
29898,
29888,
1642,
29914,
20163,
29914,
485,
14873,
10408,
19248,
2543,
789,
29889,
333,
1836,
2732,
1159,
13,
4706,
396,
2538,
675,
278,
1029,
14873,
304,
6216,
278,
1967,
13,
4706,
19490,
29909,
9046,
279,
353,
7084,
29889,
3150,
29898,
29888,
1642,
29914,
20163,
29914,
485,
14873,
10408,
19248,
2543,
789,
29889,
333,
1836,
2732,
1159,
13,
4706,
19490,
29909,
9046,
279,
353,
19490,
3027,
29889,
21476,
29918,
2103,
29898,
21476,
29909,
9046,
279,
29892,
29871,
29896,
29900,
29900,
29897,
13,
4706,
19490,
29909,
9046,
279,
29889,
7620,
29898,
29888,
1642,
29914,
20163,
29914,
485,
14873,
10408,
19248,
2543,
789,
29889,
333,
1836,
2732,
613,
19490,
29909,
9046,
279,
29889,
4830,
29897,
13,
4706,
2322,
2940,
353,
7084,
29889,
3150,
703,
6904,
20163,
29914,
2974,
3401,
29889,
2732,
1159,
13,
4706,
4216,
353,
7084,
8537,
29889,
8537,
29898,
4381,
2940,
29897,
13,
4706,
4079,
353,
7084,
9824,
29889,
509,
14484,
668,
703,
29933,
19440,
29872,
29899,
4597,
1070,
29889,
698,
29888,
613,
29871,
29941,
29953,
29897,
13,
4706,
4216,
29889,
726,
3552,
29946,
29941,
29947,
29892,
29871,
29941,
29947,
511,
851,
29898,
2974,
10108,
511,
313,
29896,
29945,
29955,
29892,
29871,
29896,
29945,
29953,
29892,
29871,
29896,
29945,
29955,
511,
4079,
29922,
5657,
29897,
13,
4706,
4216,
29889,
726,
3552,
29941,
29941,
29906,
29892,
29871,
29947,
29945,
511,
851,
29898,
2974,
8431,
520,
29879,
511,
313,
29896,
29945,
29955,
29892,
29871,
29896,
29945,
29953,
29892,
29871,
29896,
29945,
29955,
511,
4079,
29922,
5657,
29897,
13,
4706,
4216,
29889,
726,
3552,
29906,
29946,
29953,
29892,
29871,
29896,
29946,
29947,
511,
851,
29898,
2974,
29924,
13415,
511,
313,
29896,
29945,
29955,
29892,
29871,
29896,
29945,
29953,
29892,
29871,
29896,
29945,
29955,
511,
4079,
29922,
5657,
29897,
13,
4706,
4216,
29889,
726,
3552,
29941,
29955,
29900,
29892,
29871,
29896,
29929,
29929,
511,
851,
29898,
2974,
1626,
1451,
12629,
511,
313,
29896,
29945,
29955,
29892,
29871,
29896,
29945,
29953,
29892,
29871,
29896,
29945,
29955,
511,
4079,
29922,
5657,
29897,
13,
4706,
4216,
29889,
726,
3552,
29941,
29929,
29946,
29892,
29871,
29906,
29946,
29941,
511,
851,
29898,
2974,
29963,
29877,
625,
1451,
12629,
511,
313,
29896,
29945,
29955,
29892,
29871,
29896,
29945,
29953,
29892,
29871,
29896,
29945,
29955,
511,
4079,
29922,
5657,
29897,
13,
4706,
4216,
29889,
726,
3552,
29941,
29947,
29947,
29892,
29871,
29906,
29947,
29947,
511,
851,
29898,
2974,
6026,
3848,
275,
511,
313,
29896,
29945,
29955,
29892,
29871,
29896,
29945,
29953,
29892,
29871,
29896,
29945,
29955,
511,
4079,
29922,
5657,
29897,
13,
4706,
4216,
29889,
726,
3552,
29941,
29945,
29955,
29892,
29871,
29941,
29941,
29946,
511,
851,
29898,
2974,
29934,
6544,
511,
313,
29896,
29945,
29955,
29892,
29871,
29896,
29945,
29953,
29892,
29871,
29896,
29945,
29955,
511,
4079,
29922,
5657,
29897,
13,
4706,
1029,
14873,
2940,
353,
7084,
29889,
3150,
29898,
29888,
1642,
29914,
20163,
29914,
485,
14873,
10408,
19248,
2543,
789,
29889,
333,
1836,
2732,
1159,
13,
4706,
2322,
2940,
29889,
16179,
29898,
485,
14873,
2940,
29892,
313,
29946,
29900,
29892,
29871,
29946,
29900,
511,
1029,
14873,
2940,
29897,
13,
4706,
2322,
2940,
29889,
7620,
703,
6904,
20163,
29914,
2974,
2940,
28181,
29889,
2732,
1159,
13,
4706,
7272,
12893,
29889,
3636,
29898,
1445,
29922,
2218,
16090,
29889,
2283,
703,
6904,
20163,
29914,
2974,
2940,
28181,
29889,
2732,
5783,
13,
13,
4706,
17927,
29889,
3888,
29898,
13,
9651,
285,
29908,
29912,
13073,
29889,
8921,
29889,
978,
29913,
411,
3553,
29901,
426,
13073,
29889,
8921,
29889,
333,
29913,
756,
1304,
278,
5235,
24765,
1899,
29908,
13,
4706,
1723,
13,
13,
1678,
732,
2974,
29889,
2704,
13,
1678,
7465,
822,
1923,
29918,
2704,
29898,
1311,
29892,
12893,
29892,
1059,
1125,
13,
4706,
7272,
12893,
29889,
3636,
29898,
29888,
6937,
29912,
2704,
10114,
1159,
13,
13,
13,
1753,
6230,
29898,
7451,
1125,
13,
1678,
9225,
29889,
1202,
29918,
29883,
468,
29898,
2974,
3401,
29898,
7451,
876,
13,
2
] |
tests/test_mangling.py | ecoinvent/brightway2-parameters | 0 | 23145 | from bw2parameters import *
def test_mangle_formula():
given = "log(foo * bar) + 7 / baz"
prefix = "pre"
assert mangle_formula(given, prefix, ['bar']) == '(log((pre__foo * bar)) + (7 / pre__baz))'
def test_prefix_parameter_dict():
given = {
'a': {'formula': 'a + b / c', 'foo': True},
'b': {'formula': '2 * a - exp(7 - b)'},
'catch': {}
}
expected = {
't_a': {'formula': '(t_a + (t_b / c))', 'foo': True, 'original': 'a'},
't_b': {'formula': '((2 * t_a) - exp((7 - t_b)))', 'original': 'b'},
't_catch': {'original': 'catch'}
}
substitutions = {'a': 't_a', 'b': 't_b', 'catch': 't_catch'}
assert prefix_parameter_dict(given, "t_") == (expected, substitutions)
def test_chain_prefix_parameter_dict():
given = {'a': {'formula': 'a + b / c'}}
g_copy = {'a': {'formula': 'a + b / c'}}
expected = {
't_a': {'formula': '(t_a + (b / c))', 'original': 'a'},
}
substitutions = {'a': 't_a'}
assert prefix_parameter_dict(given, "t_") == (expected, substitutions)
assert given == g_copy
given, _ = prefix_parameter_dict(given, "t_")
s1 = {'b': 'dog'}
r1 = substitute_in_formulas(given, s1)
expected = {'t_a': {'formula': '(t_a + (dog / c))', 'original': 'a'}}
assert r1 == expected
s2 = {'c': 'cat'}
r2 = substitute_in_formulas(r1, s2)
expected = {'t_a': {'formula': '(t_a + (dog / cat))', 'original': 'a'}}
assert r2 == expected
| [
1,
515,
289,
29893,
29906,
16744,
1053,
334,
13,
13,
13,
1753,
1243,
29918,
29885,
2521,
29918,
689,
2497,
7295,
13,
1678,
2183,
353,
376,
1188,
29898,
5431,
334,
2594,
29897,
718,
29871,
29955,
847,
12741,
29908,
13,
1678,
10944,
353,
376,
1457,
29908,
13,
1678,
4974,
286,
2521,
29918,
689,
2497,
29898,
29887,
5428,
29892,
10944,
29892,
6024,
1646,
11287,
1275,
525,
29898,
1188,
3552,
1457,
1649,
5431,
334,
2594,
876,
718,
313,
29955,
847,
758,
1649,
27975,
876,
29915,
13,
13,
1753,
1243,
29918,
13506,
29918,
15501,
29918,
8977,
7295,
13,
1678,
2183,
353,
426,
13,
4706,
525,
29874,
2396,
11117,
689,
2497,
2396,
525,
29874,
718,
289,
847,
274,
742,
525,
5431,
2396,
5852,
1118,
13,
4706,
525,
29890,
2396,
11117,
689,
2497,
2396,
525,
29906,
334,
263,
448,
1518,
29898,
29955,
448,
289,
16029,
1118,
13,
4706,
525,
12510,
2396,
6571,
13,
1678,
500,
13,
1678,
3806,
353,
426,
13,
4706,
525,
29873,
29918,
29874,
2396,
11117,
689,
2497,
2396,
525,
29898,
29873,
29918,
29874,
718,
313,
29873,
29918,
29890,
847,
274,
876,
742,
525,
5431,
2396,
5852,
29892,
525,
13492,
2396,
525,
29874,
16675,
13,
4706,
525,
29873,
29918,
29890,
2396,
11117,
689,
2497,
2396,
525,
3552,
29906,
334,
260,
29918,
29874,
29897,
448,
1518,
3552,
29955,
448,
260,
29918,
29890,
4961,
742,
525,
13492,
2396,
525,
29890,
16675,
13,
4706,
525,
29873,
29918,
12510,
2396,
11117,
13492,
2396,
525,
12510,
10827,
13,
1678,
500,
13,
1678,
23697,
29879,
353,
11117,
29874,
2396,
525,
29873,
29918,
29874,
742,
525,
29890,
2396,
525,
29873,
29918,
29890,
742,
525,
12510,
2396,
525,
29873,
29918,
12510,
10827,
13,
1678,
4974,
10944,
29918,
15501,
29918,
8977,
29898,
29887,
5428,
29892,
376,
29873,
29918,
1159,
1275,
313,
9684,
29892,
23697,
29879,
29897,
13,
13,
1753,
1243,
29918,
14153,
29918,
13506,
29918,
15501,
29918,
8977,
7295,
13,
1678,
2183,
353,
11117,
29874,
2396,
11117,
689,
2497,
2396,
525,
29874,
718,
289,
847,
274,
29915,
930,
13,
1678,
330,
29918,
8552,
353,
11117,
29874,
2396,
11117,
689,
2497,
2396,
525,
29874,
718,
289,
847,
274,
29915,
930,
13,
1678,
3806,
353,
426,
13,
4706,
525,
29873,
29918,
29874,
2396,
11117,
689,
2497,
2396,
525,
29898,
29873,
29918,
29874,
718,
313,
29890,
847,
274,
876,
742,
525,
13492,
2396,
525,
29874,
16675,
13,
1678,
500,
13,
1678,
23697,
29879,
353,
11117,
29874,
2396,
525,
29873,
29918,
29874,
10827,
13,
1678,
4974,
10944,
29918,
15501,
29918,
8977,
29898,
29887,
5428,
29892,
376,
29873,
29918,
1159,
1275,
313,
9684,
29892,
23697,
29879,
29897,
13,
1678,
4974,
2183,
1275,
330,
29918,
8552,
13,
1678,
2183,
29892,
903,
353,
10944,
29918,
15501,
29918,
8977,
29898,
29887,
5428,
29892,
376,
29873,
29918,
1159,
13,
1678,
269,
29896,
353,
11117,
29890,
2396,
525,
26169,
10827,
13,
1678,
364,
29896,
353,
23764,
29918,
262,
29918,
689,
15173,
29898,
29887,
5428,
29892,
269,
29896,
29897,
13,
1678,
3806,
353,
11117,
29873,
29918,
29874,
2396,
11117,
689,
2497,
2396,
525,
29898,
29873,
29918,
29874,
718,
313,
26169,
847,
274,
876,
742,
525,
13492,
2396,
525,
29874,
29915,
930,
13,
1678,
4974,
364,
29896,
1275,
3806,
13,
13,
1678,
269,
29906,
353,
11117,
29883,
2396,
525,
4117,
10827,
13,
1678,
364,
29906,
353,
23764,
29918,
262,
29918,
689,
15173,
29898,
29878,
29896,
29892,
269,
29906,
29897,
13,
1678,
3806,
353,
11117,
29873,
29918,
29874,
2396,
11117,
689,
2497,
2396,
525,
29898,
29873,
29918,
29874,
718,
313,
26169,
847,
6635,
876,
742,
525,
13492,
2396,
525,
29874,
29915,
930,
13,
1678,
4974,
364,
29906,
1275,
3806,
13,
2
] |
designer/new_dialog.py | katnino/kivy-designer | 0 | 100068 | from functools import partial
from os.path import join
from designer.helper_functions import get_kd_dir
from kivy.adapters.listadapter import ListAdapter
from kivy.core.window import Keyboard, Window
from kivy.factory import Factory
from kivy.properties import NumericProperty, ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.image import Image
from kivy.uix.listview import ListView
NEW_PROJECTS = {
'FloatLayout': ('template_floatlayout_kv',
'template_floatlayout_py'),
'BoxLayout': ('template_boxlayout_kv',
'template_boxlayout_py'),
'ScreenManager': ('template_screen_manager_kv',
'template_screen_manager_py'),
'ActionBar': ('template_actionbar_kv',
'template_actionbar_py'),
'Carousel and ActionBar': ('template_actionbar_carousel_kv',
'template_actionbar_carousel_py'),
'ScreenManager and ActionBar': ('template_screen_manager_actionbar_kv',
'template_screen_manager_actionbar_py'),
'TabbedPanel': ('template_tabbed_panel_kv',
'template_tabbed_panel_py'),
'TextInput and ScrollView': ('template_textinput_scrollview_kv',
'template_textinput_scrollview_py')}
NEW_TEMPLATES_DIR = 'new_templates'
NEW_TEMPLATE_IMAGE_PATH = join(NEW_TEMPLATES_DIR, 'images')
class NewProjectDialog(BoxLayout):
listview = ObjectProperty(None)
''':class:`~kivy.uix.listview.ListView` used for showing file paths.
:data:`listview` is a :class:`~kivy.properties.ObjectProperty`
'''
select_button = ObjectProperty(None)
''':class:`~kivy.uix.button.Button` used to select the list item.
:data:`select_button` is a :class:`~kivy.properties.ObjectProperty`
'''
cancel_button = ObjectProperty(None)
''':class:`~kivy.uix.button.Button` to cancel the dialog.
:data:`cancel_button` is a :class:`~kivy.properties.ObjectProperty`
'''
adapter = ObjectProperty(None)
''':class:`~kivy.uix.listview.ListAdapter` used for selecting files.
:data:`adapter` is a :class:`~kivy.properties.ObjectProperty`
'''
image = ObjectProperty(None)
'''Type of :class:`~kivy.uix.image.Image` to display image of selected
new template.
:data:`image` is a :class:`~kivy.properties.ObjectProperty`
'''
list_parent = ObjectProperty(None)
'''Parent of listview.
:data:`list_parent` is a :class:`~kivy.properties.ObjectProperty`
'''
prev_selection = NumericProperty(0)
'''to memorize the previous selection.
:attr:`prev_selection` is a :class:
`~kivy.properties.NumericProperty`, defaults to (0).
'''
__events__ = ('on_select', 'on_cancel')
def __init__(self, **kwargs):
super(NewProjectDialog, self).__init__(**kwargs)
item_strings = list(NEW_PROJECTS.keys())
item_strings.sort()
self.adapter = ListAdapter(cls=Factory.DesignerListItemButton,
data=item_strings,
selection_mode='single',
allow_empty_selection=False)
self.adapter.check_for_empty_selection = self.check_for_empty_selection
self.adapter.bind(on_selection_change=self.on_adapter_selection_change)
self.listview = ListView(adapter=self.adapter)
self.listview.size_hint = (0.5, 1)
self.listview.pos_hint = {'top': 1}
self.list_parent.add_widget(self.listview, 1)
self.on_adapter_selection_change(self.adapter)
def on_parent(self, *args):
if self.parent:
Window.bind(on_key_down=self._on_keyboard_down)
else:
Window.unbind(on_key_down=self._on_keyboard_down)
def _on_keyboard_down(self, keyboard, key, codepoint,
text, modifier, *args):
'''To detect which key is pressed
'''
if modifier:
return False
key_str = Keyboard.keycode_to_string(Window._system_keyboard, key)
if key_str == 'up':
v = self.adapter.get_view(self.prev_selection - 1)
if v is not None:
self.adapter.handle_selection(v)
return True
if key_str == 'down':
v = self.adapter.get_view(self.prev_selection + 1)
if v is not None:
self.adapter.handle_selection(v)
return True
if key_str == 'enter':
self.dispatch('on_select')
return True
def check_for_empty_selection(self, *args):
if not self.adapter.allow_empty_selection:
if len(self.adapter.selection) == 0:
# Select the first item if we have it.
v = self.adapter.get_view(self.prev_selection)
if v is not None:
self.adapter.handle_selection(v)
def on_adapter_selection_change(self, adapter):
'''Event handler for 'on_selection_change' event of adapter.
'''
name = adapter.selection[0].text.lower() + '.png'
name = name.replace(' and ', '_')
image_source = join(NEW_TEMPLATE_IMAGE_PATH, name)
_dir = get_kd_dir()
image_source = join(_dir, image_source)
parent = self.image.parent
parent.remove_widget(self.image)
self.image = Image(source=image_source)
parent.add_widget(self.image)
self.prev_selection = adapter.data.index(adapter.selection[0].text)
def on_touch_down(self, touch):
'''Used to determine where touch is down and to detect double
tap.
'''
if touch.is_double_tap:
self.dispatch('on_select')
return super(NewProjectDialog, self).on_touch_down(touch)
def on_select(self, *args):
'''Default Event Handler for 'on_select' event
'''
pass
def on_cancel(self, *args):
'''Default Event Handler for 'on_cancel' event
'''
pass
def on_select_button(self, *args):
'''Event Handler for 'on_release' of select button.
'''
self.select_button.bind(on_press=partial(self.dispatch, 'on_select'))
def on_cancel_button(self, *args):
'''Event Handler for 'on_release' of cancel button.
'''
self.cancel_button.bind(on_press=partial(self.dispatch, 'on_cancel'))
| [
1,
515,
2090,
312,
8789,
1053,
7687,
13,
3166,
2897,
29889,
2084,
1053,
5988,
13,
13,
3166,
23383,
29889,
20907,
29918,
12171,
1053,
679,
29918,
29895,
29881,
29918,
3972,
13,
3166,
413,
440,
29891,
29889,
328,
481,
2153,
29889,
1761,
21412,
1053,
2391,
6168,
13,
3166,
413,
440,
29891,
29889,
3221,
29889,
7165,
1053,
7670,
3377,
29892,
18379,
13,
3166,
413,
440,
29891,
29889,
14399,
1053,
27561,
13,
3166,
413,
440,
29891,
29889,
11330,
1053,
405,
25099,
4854,
29892,
4669,
4854,
13,
3166,
413,
440,
29891,
29889,
29884,
861,
29889,
1884,
2680,
1053,
11773,
3453,
13,
3166,
413,
440,
29891,
29889,
29884,
861,
29889,
3027,
1053,
7084,
13,
3166,
413,
440,
29891,
29889,
29884,
861,
29889,
1761,
1493,
1053,
22184,
13,
13,
13,
28577,
29918,
8618,
17637,
29903,
353,
426,
13,
1678,
525,
11031,
3453,
2396,
6702,
6886,
29918,
7411,
2680,
29918,
27049,
742,
13,
462,
1678,
525,
6886,
29918,
7411,
2680,
29918,
2272,
5477,
13,
1678,
525,
3313,
3453,
2396,
6702,
6886,
29918,
1884,
2680,
29918,
27049,
742,
13,
462,
29871,
525,
6886,
29918,
1884,
2680,
29918,
2272,
5477,
13,
1678,
525,
11357,
3260,
2396,
6702,
6886,
29918,
10525,
29918,
12847,
29918,
27049,
742,
13,
462,
418,
525,
6886,
29918,
10525,
29918,
12847,
29918,
2272,
5477,
13,
1678,
525,
4276,
4297,
2396,
6702,
6886,
29918,
2467,
1646,
29918,
27049,
742,
13,
462,
29871,
525,
6886,
29918,
2467,
1646,
29918,
2272,
5477,
13,
1678,
525,
8179,
21299,
322,
9123,
4297,
2396,
6702,
6886,
29918,
2467,
1646,
29918,
4287,
21299,
29918,
27049,
742,
13,
462,
1669,
525,
6886,
29918,
2467,
1646,
29918,
4287,
21299,
29918,
2272,
5477,
13,
1678,
525,
11357,
3260,
322,
9123,
4297,
2396,
6702,
6886,
29918,
10525,
29918,
12847,
29918,
2467,
1646,
29918,
27049,
742,
13,
462,
462,
1678,
525,
6886,
29918,
10525,
29918,
12847,
29918,
2467,
1646,
29918,
2272,
5477,
13,
1678,
525,
8863,
2580,
7490,
2396,
6702,
6886,
29918,
3891,
2580,
29918,
15119,
29918,
27049,
742,
13,
462,
1678,
525,
6886,
29918,
3891,
2580,
29918,
15119,
29918,
2272,
5477,
13,
1678,
525,
1626,
4290,
322,
28797,
1043,
2396,
6702,
6886,
29918,
726,
2080,
29918,
10510,
1493,
29918,
27049,
742,
13,
462,
462,
525,
6886,
29918,
726,
2080,
29918,
10510,
1493,
29918,
2272,
1495,
29913,
13,
13,
28577,
29918,
4330,
3580,
29931,
1299,
2890,
29918,
9464,
353,
525,
1482,
29918,
20943,
29915,
13,
28577,
29918,
4330,
3580,
29931,
3040,
29918,
2382,
29918,
10145,
353,
5988,
29898,
28577,
29918,
4330,
3580,
29931,
1299,
2890,
29918,
9464,
29892,
525,
8346,
1495,
13,
13,
13,
1990,
1570,
7653,
7647,
29898,
3313,
3453,
1125,
13,
13,
1678,
28349,
353,
4669,
4854,
29898,
8516,
29897,
13,
1678,
6629,
2396,
1990,
18078,
30022,
29895,
440,
29891,
29889,
29884,
861,
29889,
1761,
1493,
29889,
15660,
29952,
1304,
363,
6445,
934,
10898,
29889,
13,
539,
584,
1272,
18078,
1761,
1493,
29952,
338,
263,
584,
1990,
18078,
30022,
29895,
440,
29891,
29889,
11330,
29889,
2061,
4854,
29952,
13,
1678,
14550,
13,
13,
1678,
1831,
29918,
3092,
353,
4669,
4854,
29898,
8516,
29897,
13,
1678,
6629,
2396,
1990,
18078,
30022,
29895,
440,
29891,
29889,
29884,
861,
29889,
3092,
29889,
3125,
29952,
1304,
304,
1831,
278,
1051,
2944,
29889,
13,
539,
584,
1272,
18078,
2622,
29918,
3092,
29952,
338,
263,
584,
1990,
18078,
30022,
29895,
440,
29891,
29889,
11330,
29889,
2061,
4854,
29952,
13,
1678,
14550,
13,
13,
1678,
12611,
29918,
3092,
353,
4669,
4854,
29898,
8516,
29897,
13,
1678,
6629,
2396,
1990,
18078,
30022,
29895,
440,
29891,
29889,
29884,
861,
29889,
3092,
29889,
3125,
29952,
304,
12611,
278,
7928,
29889,
13,
539,
584,
1272,
18078,
20713,
29918,
3092,
29952,
338,
263,
584,
1990,
18078,
30022,
29895,
440,
29891,
29889,
11330,
29889,
2061,
4854,
29952,
13,
1678,
14550,
13,
13,
1678,
13304,
353,
4669,
4854,
29898,
8516,
29897,
13,
1678,
6629,
2396,
1990,
18078,
30022,
29895,
440,
29891,
29889,
29884,
861,
29889,
1761,
1493,
29889,
1293,
6168,
29952,
1304,
363,
18851,
2066,
29889,
13,
539,
584,
1272,
18078,
21412,
29952,
338,
263,
584,
1990,
18078,
30022,
29895,
440,
29891,
29889,
11330,
29889,
2061,
4854,
29952,
13,
1678,
14550,
13,
13,
1678,
1967,
353,
4669,
4854,
29898,
8516,
29897,
13,
1678,
14550,
1542,
310,
584,
1990,
18078,
30022,
29895,
440,
29891,
29889,
29884,
861,
29889,
3027,
29889,
2940,
29952,
304,
2479,
1967,
310,
4629,
13,
539,
716,
4472,
29889,
13,
539,
584,
1272,
18078,
3027,
29952,
338,
263,
584,
1990,
18078,
30022,
29895,
440,
29891,
29889,
11330,
29889,
2061,
4854,
29952,
13,
1678,
14550,
13,
13,
1678,
1051,
29918,
3560,
353,
4669,
4854,
29898,
8516,
29897,
13,
1678,
14550,
9780,
310,
28349,
29889,
13,
539,
584,
1272,
18078,
1761,
29918,
3560,
29952,
338,
263,
584,
1990,
18078,
30022,
29895,
440,
29891,
29889,
11330,
29889,
2061,
4854,
29952,
13,
1678,
14550,
13,
13,
1678,
12379,
29918,
21731,
353,
405,
25099,
4854,
29898,
29900,
29897,
13,
1678,
14550,
517,
26959,
675,
278,
3517,
9262,
29889,
13,
539,
584,
5552,
18078,
16304,
29918,
21731,
29952,
338,
263,
584,
1990,
29901,
13,
539,
421,
30022,
29895,
440,
29891,
29889,
11330,
29889,
29940,
25099,
4854,
1673,
21274,
304,
313,
29900,
467,
13,
1678,
14550,
13,
13,
1678,
4770,
13604,
1649,
353,
6702,
265,
29918,
2622,
742,
525,
265,
29918,
20713,
1495,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
4373,
7653,
7647,
29892,
1583,
467,
1649,
2344,
12035,
1068,
19290,
29897,
13,
4706,
2944,
29918,
19651,
353,
1051,
29898,
28577,
29918,
8618,
17637,
29903,
29889,
8149,
3101,
13,
4706,
2944,
29918,
19651,
29889,
6605,
580,
13,
4706,
1583,
29889,
21412,
353,
2391,
6168,
29898,
25932,
29922,
5126,
29889,
4002,
21216,
27490,
3125,
29892,
13,
462,
462,
259,
848,
29922,
667,
29918,
19651,
29892,
13,
462,
462,
259,
9262,
29918,
8513,
2433,
14369,
742,
13,
462,
462,
259,
2758,
29918,
6310,
29918,
21731,
29922,
8824,
29897,
13,
4706,
1583,
29889,
21412,
29889,
3198,
29918,
1454,
29918,
6310,
29918,
21731,
353,
1583,
29889,
3198,
29918,
1454,
29918,
6310,
29918,
21731,
13,
4706,
1583,
29889,
21412,
29889,
5355,
29898,
265,
29918,
21731,
29918,
3167,
29922,
1311,
29889,
265,
29918,
21412,
29918,
21731,
29918,
3167,
29897,
13,
4706,
1583,
29889,
1761,
1493,
353,
22184,
29898,
21412,
29922,
1311,
29889,
21412,
29897,
13,
4706,
1583,
29889,
1761,
1493,
29889,
2311,
29918,
29882,
524,
353,
313,
29900,
29889,
29945,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
1761,
1493,
29889,
1066,
29918,
29882,
524,
353,
11117,
3332,
2396,
29871,
29896,
29913,
13,
4706,
1583,
29889,
1761,
29918,
3560,
29889,
1202,
29918,
8030,
29898,
1311,
29889,
1761,
1493,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
265,
29918,
21412,
29918,
21731,
29918,
3167,
29898,
1311,
29889,
21412,
29897,
13,
13,
1678,
822,
373,
29918,
3560,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
565,
1583,
29889,
3560,
29901,
13,
9651,
18379,
29889,
5355,
29898,
265,
29918,
1989,
29918,
3204,
29922,
1311,
3032,
265,
29918,
1989,
3377,
29918,
3204,
29897,
13,
4706,
1683,
29901,
13,
9651,
18379,
29889,
348,
5355,
29898,
265,
29918,
1989,
29918,
3204,
29922,
1311,
3032,
265,
29918,
1989,
3377,
29918,
3204,
29897,
13,
13,
1678,
822,
903,
265,
29918,
1989,
3377,
29918,
3204,
29898,
1311,
29892,
12247,
29892,
1820,
29892,
775,
3149,
29892,
13,
462,
3986,
1426,
29892,
878,
3709,
29892,
334,
5085,
1125,
13,
4706,
14550,
1762,
6459,
607,
1820,
338,
15385,
13,
4706,
14550,
13,
4706,
565,
878,
3709,
29901,
13,
9651,
736,
7700,
13,
4706,
1820,
29918,
710,
353,
7670,
3377,
29889,
1989,
401,
29918,
517,
29918,
1807,
29898,
5907,
3032,
5205,
29918,
1989,
3377,
29892,
1820,
29897,
13,
4706,
565,
1820,
29918,
710,
1275,
525,
786,
2396,
13,
9651,
325,
353,
1583,
29889,
21412,
29889,
657,
29918,
1493,
29898,
1311,
29889,
16304,
29918,
21731,
448,
29871,
29896,
29897,
13,
9651,
565,
325,
338,
451,
6213,
29901,
13,
18884,
1583,
29889,
21412,
29889,
8411,
29918,
21731,
29898,
29894,
29897,
13,
18884,
736,
5852,
13,
4706,
565,
1820,
29918,
710,
1275,
525,
3204,
2396,
13,
9651,
325,
353,
1583,
29889,
21412,
29889,
657,
29918,
1493,
29898,
1311,
29889,
16304,
29918,
21731,
718,
29871,
29896,
29897,
13,
9651,
565,
325,
338,
451,
6213,
29901,
13,
18884,
1583,
29889,
21412,
29889,
8411,
29918,
21731,
29898,
29894,
29897,
13,
18884,
736,
5852,
13,
4706,
565,
1820,
29918,
710,
1275,
525,
5893,
2396,
13,
9651,
1583,
29889,
13369,
877,
265,
29918,
2622,
1495,
13,
9651,
736,
5852,
13,
13,
1678,
822,
1423,
29918,
1454,
29918,
6310,
29918,
21731,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
565,
451,
1583,
29889,
21412,
29889,
9536,
29918,
6310,
29918,
21731,
29901,
13,
9651,
565,
7431,
29898,
1311,
29889,
21412,
29889,
21731,
29897,
1275,
29871,
29900,
29901,
13,
18884,
396,
7605,
278,
937,
2944,
565,
591,
505,
372,
29889,
13,
18884,
325,
353,
1583,
29889,
21412,
29889,
657,
29918,
1493,
29898,
1311,
29889,
16304,
29918,
21731,
29897,
13,
18884,
565,
325,
338,
451,
6213,
29901,
13,
462,
1678,
1583,
29889,
21412,
29889,
8411,
29918,
21731,
29898,
29894,
29897,
13,
13,
1678,
822,
373,
29918,
21412,
29918,
21731,
29918,
3167,
29898,
1311,
29892,
13304,
1125,
13,
4706,
14550,
2624,
7834,
363,
525,
265,
29918,
21731,
29918,
3167,
29915,
1741,
310,
13304,
29889,
13,
4706,
14550,
13,
4706,
1024,
353,
13304,
29889,
21731,
29961,
29900,
1822,
726,
29889,
13609,
580,
718,
15300,
2732,
29915,
13,
4706,
1024,
353,
1024,
29889,
6506,
877,
322,
13420,
22868,
1495,
13,
4706,
1967,
29918,
4993,
353,
5988,
29898,
28577,
29918,
4330,
3580,
29931,
3040,
29918,
2382,
29918,
10145,
29892,
1024,
29897,
13,
4706,
903,
3972,
353,
679,
29918,
29895,
29881,
29918,
3972,
580,
13,
4706,
1967,
29918,
4993,
353,
5988,
7373,
3972,
29892,
1967,
29918,
4993,
29897,
13,
4706,
3847,
353,
1583,
29889,
3027,
29889,
3560,
13,
4706,
3847,
29889,
5992,
29918,
8030,
29898,
1311,
29889,
3027,
29897,
13,
4706,
1583,
29889,
3027,
353,
7084,
29898,
4993,
29922,
3027,
29918,
4993,
29897,
13,
4706,
3847,
29889,
1202,
29918,
8030,
29898,
1311,
29889,
3027,
29897,
13,
4706,
1583,
29889,
16304,
29918,
21731,
353,
13304,
29889,
1272,
29889,
2248,
29898,
21412,
29889,
21731,
29961,
29900,
1822,
726,
29897,
13,
13,
1678,
822,
373,
29918,
16747,
29918,
3204,
29898,
1311,
29892,
6023,
1125,
13,
4706,
14550,
29965,
8485,
304,
8161,
988,
6023,
338,
1623,
322,
304,
6459,
3765,
13,
965,
18751,
29889,
13,
4706,
14550,
13,
4706,
565,
6023,
29889,
275,
29918,
8896,
29918,
29873,
481,
29901,
13,
9651,
1583,
29889,
13369,
877,
265,
29918,
2622,
1495,
13,
4706,
736,
2428,
29898,
4373,
7653,
7647,
29892,
1583,
467,
265,
29918,
16747,
29918,
3204,
29898,
16747,
29897,
13,
13,
1678,
822,
373,
29918,
2622,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
14550,
4592,
6864,
5166,
1358,
363,
525,
265,
29918,
2622,
29915,
1741,
13,
4706,
14550,
13,
4706,
1209,
13,
13,
1678,
822,
373,
29918,
20713,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
14550,
4592,
6864,
5166,
1358,
363,
525,
265,
29918,
20713,
29915,
1741,
13,
4706,
14550,
13,
4706,
1209,
13,
13,
1678,
822,
373,
29918,
2622,
29918,
3092,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
14550,
2624,
5166,
1358,
363,
525,
265,
29918,
14096,
29915,
310,
1831,
2826,
29889,
13,
4706,
14550,
13,
4706,
1583,
29889,
2622,
29918,
3092,
29889,
5355,
29898,
265,
29918,
2139,
29922,
3846,
29898,
1311,
29889,
13369,
29892,
525,
265,
29918,
2622,
8785,
13,
13,
1678,
822,
373,
29918,
20713,
29918,
3092,
29898,
1311,
29892,
334,
5085,
1125,
13,
4706,
14550,
2624,
5166,
1358,
363,
525,
265,
29918,
14096,
29915,
310,
12611,
2826,
29889,
13,
4706,
14550,
13,
4706,
1583,
29889,
20713,
29918,
3092,
29889,
5355,
29898,
265,
29918,
2139,
29922,
3846,
29898,
1311,
29889,
13369,
29892,
525,
265,
29918,
20713,
8785,
13,
2
] |
Extensions/Dependencies/tools/extract_objects.py | kylefmohr/Pyto | 0 | 1605021 | from subprocess import check_output
import sys
objects = check_output(["ar", "-t", sys.argv[1]]).decode().split("\n")
for object in objects:
if not object.endswith(".o") or object.endswith("lso.o"):
continue
check_output(["ar", "-xv", sys.argv[1], object])
| [
1,
515,
1014,
5014,
1053,
1423,
29918,
4905,
13,
5215,
10876,
13,
13,
12650,
353,
1423,
29918,
4905,
29898,
3366,
279,
613,
11663,
29873,
613,
10876,
29889,
19218,
29961,
29896,
5262,
467,
13808,
2141,
5451,
14182,
29876,
1159,
13,
13,
1454,
1203,
297,
3618,
29901,
13,
1678,
565,
451,
1203,
29889,
1975,
2541,
17350,
29877,
1159,
470,
1203,
29889,
1975,
2541,
703,
29880,
578,
29889,
29877,
29908,
1125,
13,
4706,
6773,
13,
268,
13,
1678,
1423,
29918,
4905,
29898,
3366,
279,
613,
29871,
11663,
29916,
29894,
613,
10876,
29889,
19218,
29961,
29896,
1402,
1203,
2314,
13,
13,
2
] |
node-api/get-block-transfers/request.py | Venoox/casper-integrations | 5 | 11051 | <reponame>Venoox/casper-integrations
import json
import os
import pycspr
# A known casper test-net node address.
_NODE_ADDRESS = os.getenv("CASPER_NODE_ADDRESS", "192.168.127.12")
# A known block hash.
_BLOCK_HASH: bytes = bytes.fromhex("c7148e1e2e115d8fba357e04be2073d721847c982dc70d5c36b5f6d3cf66331c")
# A known block height.
_BLOCK_HEIGHT: int = 20652
def main():
"""Retrieves transfers by block.
"""
# Set client.
client = pycspr.NodeClient(pycspr.NodeConnectionInfo(host=_NODE_ADDRESS))
# Set block by known hash.
block_transers_1: tuple = client.queries.get_block_transfers(_BLOCK_HASH)
# Set block by known height.
block_transers_2: tuple = client.queries.get_block_transfers(_BLOCK_HEIGHT)
# Verify block information equivalence.
assert block_transers_1 == block_transers_2
print("-----------------------------------------------------------------------------------------------------")
print(f"QUERIED TEST-NET NODE {_NODE_ADDRESS}")
print("-----------------------------------------------------------------------------------------------------")
print(f"Block transfers = {json.dumps(block_transers_1, indent=4)}")
print("-----------------------------------------------------------------------------------------------------")
if __name__ == "__main__":
try:
main()
except Exception as err:
print(f"API ERROR @ NODE {_NODE_ADDRESS} :: {err}")
| [
1,
529,
276,
1112,
420,
29958,
29963,
8154,
2251,
29914,
9398,
546,
29899,
14146,
800,
13,
5215,
4390,
13,
5215,
2897,
13,
13,
5215,
11451,
2395,
558,
13,
13,
13,
13,
29937,
319,
2998,
3209,
546,
1243,
29899,
1212,
2943,
3211,
29889,
13,
29918,
6632,
2287,
29918,
17744,
26785,
353,
2897,
29889,
657,
6272,
703,
29907,
3289,
13171,
29918,
6632,
2287,
29918,
17744,
26785,
613,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29896,
29906,
29955,
29889,
29896,
29906,
1159,
13,
13,
29937,
319,
2998,
2908,
6608,
29889,
13,
29918,
29933,
21339,
29918,
29950,
24943,
29901,
6262,
353,
6262,
29889,
3166,
20970,
703,
29883,
29955,
29896,
29946,
29947,
29872,
29896,
29872,
29906,
29872,
29896,
29896,
29945,
29881,
29947,
29888,
2291,
29941,
29945,
29955,
29872,
29900,
29946,
915,
29906,
29900,
29955,
29941,
29881,
29955,
29906,
29896,
29947,
29946,
29955,
29883,
29929,
29947,
29906,
13891,
29955,
29900,
29881,
29945,
29883,
29941,
29953,
29890,
29945,
29888,
29953,
29881,
29941,
6854,
29953,
29953,
29941,
29941,
29896,
29883,
1159,
13,
13,
29937,
319,
2998,
2908,
3171,
29889,
13,
29918,
29933,
21339,
29918,
9606,
22530,
29901,
938,
353,
29871,
29906,
29900,
29953,
29945,
29906,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
9995,
8015,
2546,
1960,
1301,
25534,
491,
2908,
29889,
13,
268,
13,
1678,
9995,
13,
1678,
396,
3789,
3132,
29889,
13,
1678,
3132,
353,
11451,
2395,
558,
29889,
4247,
4032,
29898,
2272,
2395,
558,
29889,
4247,
5350,
3401,
29898,
3069,
29922,
29918,
6632,
2287,
29918,
17744,
26785,
876,
13,
13,
1678,
396,
3789,
2908,
491,
2998,
6608,
29889,
13,
1678,
2908,
29918,
3286,
414,
29918,
29896,
29901,
18761,
353,
3132,
29889,
339,
6358,
29889,
657,
29918,
1271,
29918,
3286,
25534,
7373,
29933,
21339,
29918,
29950,
24943,
29897,
13,
13,
1678,
396,
3789,
2908,
491,
2998,
3171,
29889,
13,
1678,
2908,
29918,
3286,
414,
29918,
29906,
29901,
18761,
353,
3132,
29889,
339,
6358,
29889,
657,
29918,
1271,
29918,
3286,
25534,
7373,
29933,
21339,
29918,
9606,
22530,
29897,
13,
13,
1678,
396,
1798,
1598,
2908,
2472,
24796,
29889,
13,
1678,
4974,
2908,
29918,
3286,
414,
29918,
29896,
1275,
2908,
29918,
3286,
414,
29918,
29906,
13,
268,
13,
1678,
1596,
703,
2683,
2683,
2683,
2683,
2683,
2683,
23648,
1159,
13,
1678,
1596,
29898,
29888,
29908,
13356,
1001,
29902,
3352,
17067,
1254,
29899,
6006,
11698,
2287,
426,
29918,
6632,
2287,
29918,
17744,
26785,
27195,
13,
1678,
1596,
703,
2683,
2683,
2683,
2683,
2683,
2683,
23648,
1159,
13,
1678,
1596,
29898,
29888,
29908,
7445,
1301,
25534,
353,
426,
3126,
29889,
29881,
17204,
29898,
1271,
29918,
3286,
414,
29918,
29896,
29892,
29536,
29922,
29946,
2915,
1159,
13,
1678,
1596,
703,
2683,
2683,
2683,
2683,
2683,
2683,
23648,
1159,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1018,
29901,
13,
4706,
1667,
580,
13,
1678,
5174,
8960,
408,
4589,
29901,
13,
4706,
1596,
29898,
29888,
29908,
8787,
14431,
732,
11698,
2287,
426,
29918,
6632,
2287,
29918,
17744,
26785,
29913,
4761,
426,
3127,
27195,
13,
2
] |
setup.py | saquib-mehmood/pyproblib | 1 | 186089 | <reponame>saquib-mehmood/pyproblib
from setuptools import setup
setup(name='pyproblib',
version='1.1',
description='Probability Distribution Functions',
packages=['pyproblib'],
author='<NAME>',
author_email='<EMAIL>',
zip_safe=False) | [
1,
529,
276,
1112,
420,
29958,
4977,
339,
747,
29899,
1004,
7184,
2092,
29914,
2272,
22795,
1982,
13,
13,
3166,
731,
21245,
8789,
1053,
6230,
13,
13,
14669,
29898,
978,
2433,
2272,
22795,
1982,
742,
13,
418,
1873,
2433,
29896,
29889,
29896,
742,
13,
418,
6139,
2433,
1184,
29890,
3097,
17740,
6680,
29879,
742,
13,
418,
9741,
29922,
1839,
2272,
22795,
1982,
7464,
13,
418,
4148,
2433,
29966,
5813,
29958,
742,
13,
418,
4148,
29918,
5269,
2433,
29966,
26862,
6227,
29958,
742,
13,
418,
14319,
29918,
11177,
29922,
8824,
29897,
2
] |
aioinject/__init__.py | ThirVondukr/aioinject | 4 | 176713 | from .containers import Container
from .context import InjectionContext, SyncInjectionContext
from .decorators import inject
from .markers import Inject
from .providers import Callable, Object, Provider, Singleton
__all__ = [
"Container",
"InjectionContext",
"SyncInjectionContext",
"inject",
"Inject",
"Callable",
"Provider",
"Singleton",
"Object",
]
| [
1,
515,
869,
1285,
475,
414,
1053,
21679,
13,
3166,
869,
4703,
1053,
512,
6929,
2677,
29892,
317,
2720,
797,
6929,
2677,
13,
3166,
869,
19557,
4097,
1053,
11658,
13,
3166,
869,
3502,
414,
1053,
512,
622,
13,
3166,
869,
771,
29454,
1053,
8251,
519,
29892,
4669,
29892,
1019,
5489,
29892,
6106,
11285,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
376,
7895,
613,
13,
1678,
376,
797,
6929,
2677,
613,
13,
1678,
376,
21077,
797,
6929,
2677,
613,
13,
1678,
376,
21920,
613,
13,
1678,
376,
28329,
613,
13,
1678,
376,
5594,
519,
613,
13,
1678,
376,
6980,
613,
13,
1678,
376,
10873,
11285,
613,
13,
1678,
376,
2061,
613,
13,
29962,
13,
2
] |
zinc/utils/validation.py | PressLabs/zinc | 29 | 37359 | <gh_stars>10-100
import ipaddress
def is_ipv6(ip_addr):
try:
ipaddress.IPv6Address(ip_addr)
return True
except ipaddress.AddressValueError:
return False
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
10377,
7328,
13,
13,
13,
1753,
338,
29918,
666,
29894,
29953,
29898,
666,
29918,
10030,
1125,
13,
1678,
1018,
29901,
13,
4706,
10377,
7328,
29889,
5690,
29894,
29953,
7061,
29898,
666,
29918,
10030,
29897,
13,
4706,
736,
5852,
13,
1678,
5174,
10377,
7328,
29889,
7061,
1917,
2392,
29901,
13,
4706,
736,
7700,
13,
2
] |
resistics/window.py | resistics/resistics | 38 | 193431 | """
Module for calculating window related data. Windows can be indexed relative to
two starting indices.
- Local window index
- Window index relative to the TimeData is called "local_win"
- Local window indices always start at 0
- Global window index
- The global window index is relative to the project reference time
- The 0 index window begins at the reference time
- This window indexing is to synchronise data across sites
The global window index is considered the default and sometimes referred to as
the window. Local windows should be explicitly referred to as local_win in
all cases.
The window module includes functionality to do the following:
- Windowing utility functions to calculate window and overlap sizes
- Functions to map windows to samples in TimeData
- Converting a global index array to datetime
Usually with windowing, there is a window size and windows overlap with each
other for a set number of samples. As an illustrative examples, consider a
signal sampled at 10 Hz (dt=0.1 seconds) with 24 samples. This will be windowed
using a window size of 8 samples per window and a 2 sample overlap.
.. plot::
>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> fs = 10
>>> n_samples = 24
>>> win_size = 8
>>> olap_size = 2
>>> times = np.arange(0, n_samples) * (1/fs)
The first window
>>> start_win1 = 0
>>> end_win1 = win_size
>>> win1_times = times[start_win1:end_win1]
The second window
>>> start_win2 = end_win1 - olap_size
>>> end_win2 = start_win2 + win_size
>>> win2_times = times[start_win2:end_win2]
The third window
>>> start_win3 = end_win2 - olap_size
>>> end_win3 = start_win3 + win_size
>>> win3_times = times[start_win3:end_win3]
The fourth window
>>> start_win4= end_win3 - olap_size
>>> end_win4 = start_win4 + win_size
>>> win4_times = times[start_win4:end_win4]
Let's look at the actual window times for each window
>>> win1_times
array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7])
>>> win2_times
array([0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2, 1.3])
>>> win3_times
array([1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9])
>>> win4_times
array([1.8, 1.9, 2. , 2.1, 2.2, 2.3])
The duration and increments of windows can be calculated using provided
methods
>>> from resistics.window import win_duration, inc_duration
>>> print(win_duration(win_size, fs))
0:00:00.7
>>> print(inc_duration(win_size, olap_size, fs))
0:00:00.6
Plot the windows to give an illustration of how it works
>>> plt.plot(win1_times, np.ones_like(win1_times), "bo", label="window1") # doctest: +SKIP
>>> plt.plot(win2_times, np.ones_like(win2_times)*2, "ro", label="window2") # doctest: +SKIP
>>> plt.plot(win3_times, np.ones_like(win3_times)*3, "go", label="window3") # doctest: +SKIP
>>> plt.plot(win4_times, np.ones_like(win4_times)*4, "co", label="window4") # doctest: +SKIP
>>> plt.xlabel("Time [s]") # doctest: +SKIP
>>> plt.legend() # doctest: +SKIP
>>> plt.grid() # doctest: +SKIP
>>> plt.tight_layout() # doctest: +SKIP
>>> plt.show() # doctest: +SKIP
"""
from loguru import logger
from pathlib import Path
from typing import Optional, List, Tuple, Dict, Union, Any
from pydantic import PositiveInt
import numpy as np
import pandas as pd
from resistics.errors import ProcessRunError
from resistics.common import History, ResisticsModel, ResisticsData, ResisticsProcess
from resistics.common import ResisticsWriter, Metadata, WriteableMetadata
from resistics.sampling import RSDateTime, RSTimeDelta, HighResDateTime
from resistics.time import ChanMetadata
from resistics.decimate import DecimatedLevelMetadata, DecimatedData
def win_duration(win_size: int, fs: float) -> RSTimeDelta:
"""
Get the window duration
Parameters
----------
win_size : int
Window size in samples
fs : float
Sampling frequency Hz
Returns
-------
RSTimeDelta
Duration
Examples
--------
A few examples with different sampling frequencies and window sizes
>>> from resistics.window import win_duration
>>> duration = win_duration(512, 512)
>>> print(duration)
0:00:00.998046875
>>> duration = win_duration(520, 512)
>>> print(duration)
0:00:01.013671875
>>> duration = win_duration(4096, 16_384)
>>> print(duration)
0:00:00.24993896484375
>>> duration = win_duration(200, 0.05)
>>> print(duration)
1:06:20
"""
from resistics.sampling import to_timedelta
return to_timedelta(1 / fs) * float(win_size - 1)
def inc_duration(win_size: int, olap_size: int, fs: float) -> RSTimeDelta:
"""
Get the increment between window start times
If the overlap size = 0, then the time increment between windows is simply
the window duration. However, when there is an overlap, the increment
between window start times has to be adjusted by the overlap size
Parameters
----------
win_size : int
The window size in samples
olap_size : int
The overlap size in samples
fs : float
The sample frequency Hz
Returns
-------
RSTimeDelta
The duration of the window
Examples
--------
>>> from resistics.window import inc_duration
>>> increment = inc_duration(128, 32, 128)
>>> print(increment)
0:00:00.75
>>> increment = inc_duration(128*3600, 128*60, 128)
>>> print(increment)
0:59:00
"""
from resistics.sampling import to_timedelta
return to_timedelta(1 / fs) * float(win_size - olap_size)
def win_to_datetime(
ref_time: RSDateTime, global_win: int, increment: RSTimeDelta
) -> RSDateTime:
"""
Convert reference window index to start time of window
Parameters
----------
ref_time : RSDateTime
Reference time
global_win : int
Window index relative to reference time
increment : RSTimeDelta
The increment duration
Returns
-------
RSDateTime
Start time of window
Examples
--------
An example with sampling at 1 Hz, a window size of 100 and an overlap size
of 25.
>>> from resistics.sampling import to_datetime
>>> from resistics.window import inc_duration, win_to_datetime
>>> ref_time = to_datetime("2021-01-01 00:00:00")
>>> fs = 1
>>> win_size = 60
>>> olap_size = 15
>>> increment = inc_duration(win_size, olap_size, fs)
>>> print(increment)
0:00:45
The increment is the time increment between the start of time one window and
the succeeding window.
>>> print(win_to_datetime(ref_time, 0, increment))
2021-01-01 00:00:00
>>> print(win_to_datetime(ref_time, 1, increment))
2021-01-01 00:00:45
>>> print(win_to_datetime(ref_time, 2, increment))
2021-01-01 00:01:30
>>> print(win_to_datetime(ref_time, 3, increment))
2021-01-01 00:02:15
"""
return ref_time + (global_win * increment)
def datetime_to_win(
ref_time: RSDateTime,
time: RSDateTime,
increment: RSTimeDelta,
method: str = "round",
) -> int:
"""
Convert a datetime to a global window index
Parameters
----------
ref_time : RSDateTime
Reference time
time : RSDateTime
Datetime to convert
increment : RSTimeDelta
The increment duration
method : str, optional
Method for dealing with float results, by default "round"
Returns
-------
int
The global window index i.e. the window index relative to the reference
time
Raises
------
ValueError
If time < ref_time
Examples
--------
A simple example to show the logic
>>> from resistics.sampling import to_datetime, to_timedelta
>>> from resistics.window import datetime_to_win, win_to_datetime, inc_duration
>>> ref_time = to_datetime("2021-01-01 00:00:00")
>>> time = to_datetime("2021-01-01 00:01:00")
>>> increment = to_timedelta(60)
>>> global_win = datetime_to_win(ref_time, time, increment)
>>> global_win
1
>>> print(win_to_datetime(ref_time, global_win, increment))
2021-01-01 00:01:00
A more complex logic with window sizes, overlap sizes and sampling
frequencies
>>> fs = 128
>>> win_size = 256
>>> olap_size = 64
>>> ref_time = to_datetime("2021-03-15 00:00:00")
>>> time = to_datetime("2021-04-17 18:00:00")
>>> increment = inc_duration(win_size, olap_size, fs)
>>> print(increment)
0:00:01.5
>>> global_win = datetime_to_win(ref_time, time, increment)
>>> global_win
1944000
>>> print(win_to_datetime(ref_time, global_win, increment))
2021-04-17 18:00:00
In this scenario, explore the use of rounding
>>> time = to_datetime("2021-04-17 18:00:00.50")
>>> global_win = datetime_to_win(ref_time, time, increment, method = "floor")
>>> global_win
1944000
>>> print(win_to_datetime(ref_time, global_win, increment))
2021-04-17 18:00:00
>>> global_win = datetime_to_win(ref_time, time, increment, method = "ceil")
>>> global_win
1944001
>>> print(win_to_datetime(ref_time, global_win, increment))
2021-04-17 18:00:01.5
>>> global_win = datetime_to_win(ref_time, time, increment, method = "round")
>>> global_win
1944000
>>> print(win_to_datetime(ref_time, global_win, increment))
2021-04-17 18:00:00
Another example with a window duration of greater than a day
>>> fs = 4.8828125e-05
>>> win_size = 64
>>> olap_size = 16
>>> ref_time = to_datetime("1985-07-18 01:00:20")
>>> time = to_datetime("1985-09-22 23:00:00")
>>> increment = inc_duration(win_size, olap_size, fs)
>>> print(increment)
11 days, 9:04:00
>>> global_win = datetime_to_win(ref_time, time, increment)
>>> global_win
6
>>> print(win_to_datetime(ref_time, global_win, increment))
1985-09-24 07:24:20
This time is greater than the time that was transformed to global window,
1985-09-22 23:00:00. Try again, this time with the floor option.
>>> global_win = datetime_to_win(ref_time, time, increment, method="floor")
>>> global_win
5
>>> print(win_to_datetime(ref_time, global_win, increment))
1985-09-12 22:20:20
"""
from math import floor, ceil
from resistics.sampling import to_seconds
if time < ref_time:
raise ValueError(f"Time {str(time)} < reference time {str(ref_time)}")
increment_days_in_seconds, increment_remaining_in_seconds = to_seconds(increment)
increment_seconds = increment_days_in_seconds + increment_remaining_in_seconds
delta_days_in_seconds, delta_remaining_in_seconds = to_seconds(time - ref_time)
delta_total_in_seconds = delta_days_in_seconds + delta_remaining_in_seconds
n_increments = delta_total_in_seconds / increment_seconds
if n_increments.is_integer():
n_increments = int(n_increments)
elif method == "floor":
n_increments = int(floor(n_increments))
elif method == "ceil":
n_increments = int(ceil(n_increments))
else:
n_increments = int(round(n_increments))
return n_increments
def get_first_and_last_win(
ref_time: RSDateTime,
metadata: DecimatedLevelMetadata,
win_size: int,
olap_size: int,
) -> Tuple[int, int]:
"""
Get first and last window for a decimated data level
.. note::
For the last window, on initial calculation this may be one or a
maximum of two windows beyond the last time. The last window is adjusted
in this function.
Two windows may occur when the time of the last sample is in the overlap
of the final two windows.
Parameters
----------
ref_time : RSDateTime
The reference time
metadata : DecimatedLevelMetadata
Metadata for the decimation level
win_size : int
Window size in samples
olap_size : int
Overlap size in samples
Returns
-------
Tuple[int, int]
First and last global windows. This is window indices relative to the
reference time
Raises
------
ValueError
If unable to calculate the last window correctly as this will result in
an incorrect number of windows
Examples
--------
Get the first and last window for the first decimation level in a decimated
data instance.
>>> from resistics.testing import decimated_data_random
>>> from resistics.sampling import to_datetime
>>> from resistics.window import get_first_and_last_win, win_to_datetime
>>> from resistics.window import win_duration, inc_duration
>>> ref_time = to_datetime("2021-01-01 00:00:00")
>>> dec_data = decimated_data_random(fs=0.1, first_time="2021-01-01 00:05:10", n_samples=100, factor=10)
Get the metadata for decimation level 0
>>> level_metadata = dec_data.metadata.levels_metadata[0]
>>> level_metadata.summary()
{
'fs': 10.0,
'n_samples': 10000,
'first_time': '2021-01-01 00:05:10.000000_000000_000000_000000',
'last_time': '2021-01-01 00:21:49.899999_999999_977300_000000'
}
.. note::
As a point of interest, note how the last time is actually slightly
incorrect. This is due to machine precision issues described in more
detail here https://docs.python.org/3/tutorial/floatingpoint.html.
Whilst there is value in using the high resolution datetime format for
high sampling rates, there is a tradeoff. Such are the perils of
floating point arithmetic.
The next step is to calculate the first and last window, relative to the
reference time
>>> win_size = 100
>>> olap_size = 25
>>> first_win, last_win = get_first_and_last_win(ref_time, level_metadata, win_size, olap_size)
>>> print(first_win, last_win)
42 173
These window indices can be converted to start times of the windows. The
last window is checked to make sure it does not extend past the end of the
time data. First get the window duration and increments.
>>> duration = win_duration(win_size, level_metadata.fs)
>>> print(duration)
0:00:09.9
>>> increment = inc_duration(win_size, olap_size, level_metadata.fs)
>>> print(increment)
0:00:07.5
Now calculate the times of the windows
>>> first_win_start_time = win_to_datetime(ref_time, 42, increment)
>>> last_win_start_time = win_to_datetime(ref_time, 173, increment)
>>> print(first_win_start_time, last_win_start_time)
2021-01-01 00:05:15 2021-01-01 00:21:37.5
>>> print(last_win_start_time + duration)
2021-01-01 00:21:47.4
>>> print(level_metadata.last_time)
2021-01-01 00:21:49.8999999999999773
>>> level_metadata.last_time > last_win_start_time + increment
True
"""
duration = win_duration(win_size, metadata.fs)
increment = inc_duration(win_size, olap_size, metadata.fs)
first_win = datetime_to_win(ref_time, metadata.first_time, increment, method="ceil")
last_win = datetime_to_win(ref_time, metadata.last_time, increment, method="floor")
# adjust if there is not enough date to complete the last window
last_win_time = win_to_datetime(ref_time, last_win, increment)
for attempt in range(2):
if metadata.last_time >= last_win_time + duration:
break
logger.debug(f"Adjusting last window attempt {attempt + 1}")
last_win -= 1
last_win_time = win_to_datetime(ref_time, last_win, increment)
if metadata.last_time < last_win_time + duration:
raise ValueError("Unable to correctly get the last window")
return first_win, last_win
def get_win_starts(
ref_time: RSDateTime,
win_size: int,
olap_size: int,
fs: float,
n_wins: int,
index_offset: int,
) -> pd.DatetimeIndex:
"""
Get window start times
This is a useful for getting the timestamps for the windows in a dataset
Parameters
----------
ref_time : RSDateTime
The reference time
win_size : int
The window size
olap_size : int
The overlap size
fs : float
The sampling frequency
n_wins : int
The number of windows
index_offset : int
The index offset from the reference time
Returns
-------
pd.DatetimeIndex
The start times of the windows
Examples
--------
>>> import pandas as pd
>>> from resistics.sampling import to_datetime
>>> from resistics.window import get_win_starts
>>> ref_time = to_datetime("2021-01-01 00:00:00")
>>> win_size = 100
>>> olap_size = 25
>>> fs = 10
>>> n_wins = 3
>>> index_offset = 480
>>> starts = get_win_starts(ref_time, win_size, olap_size, fs, n_wins, index_offset)
>>> pd.Series(starts)
0 2021-01-01 01:00:00.000
1 2021-01-01 01:00:07.500
2 2021-01-01 01:00:15.000
dtype: datetime64[ns]
"""
from resistics.sampling import datetime_array_estimate
increment = inc_duration(win_size, olap_size, fs)
first_win_time = win_to_datetime(ref_time, index_offset, increment)
increment_size = win_size - olap_size
return datetime_array_estimate(first_win_time, fs / increment_size, n_wins)
def get_win_ends(
starts: pd.DatetimeIndex,
win_size: int,
fs: float,
) -> pd.DatetimeIndex:
"""
Get window end times
Parameters
----------
starts : RSDateTime
The start times of the windows
win_size : int
The window size
fs : float
The sampling frequency
Returns
-------
pd.DatetimeIndex
The end times of the windows
Examples
--------
>>> import pandas as pd
>>> from resistics.sampling import to_datetime
>>> from resistics.window import get_win_starts, get_win_ends
>>> ref_time = to_datetime("2021-01-01 00:00:00")
>>> win_size = 100
>>> olap_size = 25
>>> fs = 10
>>> n_wins = 3
>>> index_offset = 480
>>> starts = get_win_starts(ref_time, win_size, olap_size, fs, n_wins, index_offset)
>>> pd.Series(starts)
0 2021-01-01 01:00:00.000
1 2021-01-01 01:00:07.500
2 2021-01-01 01:00:15.000
dtype: datetime64[ns]
>>> ends = get_win_ends(starts, win_size, fs)
>>> pd.Series(ends)
0 2021-01-01 01:00:09.900
1 2021-01-01 01:00:17.400
2 2021-01-01 01:00:24.900
dtype: datetime64[ns]
"""
return starts + pd.Timedelta((win_size - 1) * (1 / fs), "s")
def get_win_table(
ref_time: RSDateTime,
metadata: DecimatedLevelMetadata,
win_size: int,
olap_size: int,
) -> pd.DataFrame:
"""
Get a DataFrame with
Parameters
----------
ref_time : RSDateTime
Reference
metadata : DecimatedLevelMetadata
Metadata for the decimation level
win_size : int
The window size
olap_size : int
The overlap size
Returns
-------
pd.DataFrame
A pandas DataFrame with details about each window
Examples
--------
.. plot::
:width: 90%
>>> import matplotlib.pyplot as plt
>>> from resistics.decimate import DecimatedLevelMetadata
>>> from resistics.sampling import to_datetime, to_timedelta
>>> from resistics.window import get_win_table
>>> ref_time = to_datetime("2021-01-01 00:00:00")
>>> fs = 10
>>> n_samples = 1000
>>> first_time = to_datetime("2021-01-01 01:00:00")
>>> last_time = first_time + to_timedelta((n_samples-1)/fs)
>>> metadata = DecimatedLevelMetadata(fs=10, n_samples=1000, first_time=first_time, last_time=last_time)
>>> print(metadata.fs, metadata.first_time, metadata.last_time)
10.0 2021-01-01 01:00:00 2021-01-01 01:01:39.9
>>> win_size = 100
>>> olap_size = 25
>>> df = get_win_table(ref_time, metadata, win_size, olap_size)
>>> print(df.to_string())
global local from_sample to_sample win_start win_end
0 480 0 0 99 2021-01-01 01:00:00.000 2021-01-01 01:00:09.900
1 481 1 75 174 2021-01-01 01:00:07.500 2021-01-01 01:00:17.400
2 482 2 150 249 2021-01-01 01:00:15.000 2021-01-01 01:00:24.900
3 483 3 225 324 2021-01-01 01:00:22.500 2021-01-01 01:00:32.400
4 484 4 300 399 2021-01-01 01:00:30.000 2021-01-01 01:00:39.900
5 485 5 375 474 2021-01-01 01:00:37.500 2021-01-01 01:00:47.400
6 486 6 450 549 2021-01-01 01:00:45.000 2021-01-01 01:00:54.900
7 487 7 525 624 2021-01-01 01:00:52.500 2021-01-01 01:01:02.400
8 488 8 600 699 2021-01-01 01:01:00.000 2021-01-01 01:01:09.900
9 489 9 675 774 2021-01-01 01:01:07.500 2021-01-01 01:01:17.400
10 490 10 750 849 2021-01-01 01:01:15.000 2021-01-01 01:01:24.900
11 491 11 825 924 2021-01-01 01:01:22.500 2021-01-01 01:01:32.400
12 492 12 900 999 2021-01-01 01:01:30.000 2021-01-01 01:01:39.900
Plot six windows to illustrate the overlap
>>> plt.figure(figsize=(8, 3)) # doctest: +SKIP
>>> for idx, row in df.iterrows():
... color = "red" if idx%2 == 0 else "blue"
... plt.axvspan(row.loc["win_start"], row.loc["win_end"], alpha=0.5, color=color) # doctest: +SKIP
... if idx > 5:
... break
>>> plt.tight_layout() # doctest: +SKIP
>>> plt.show() # doctest: +SKIP
"""
from resistics.sampling import to_n_samples, datetime_array_estimate
increment_size = win_size - olap_size
increment = inc_duration(win_size, olap_size, metadata.fs)
fs = metadata.fs
first_time = metadata.first_time
first_win, last_win = get_first_and_last_win(
ref_time, metadata, win_size, olap_size
)
first_win_time = win_to_datetime(ref_time, first_win, increment)
n_wins = last_win - first_win + 1
local_wins = np.arange(n_wins).astype(int)
# samples - use the floor here to avoid a situation where it is rounded up
# and then there are insufficient samples
first_sample = to_n_samples(first_win_time - first_time, fs, method="floor") - 1
starts = datetime_array_estimate(first_win_time, fs / increment_size, n_wins)
ends = get_win_ends(starts, win_size, fs)
df_dict = {
"global": np.arange(first_win, last_win + 1),
"local": local_wins,
"from_sample": first_sample + (local_wins * increment_size),
"to_sample": first_sample + win_size - 1 + (local_wins * increment_size),
"win_start": starts,
"win_end": ends,
}
return pd.DataFrame(data=df_dict)
class WindowParameters(ResisticsModel):
"""
Windowing parameters per decimation level
Windowing parameters are the window and overlap size for each decimation
level.
Parameters
----------
n_levels : int
The number of decimation levels
min_n_wins : int
Minimum number of windows
win_sizes : List[int]
The window sizes per decimation level
olap_sizes : List[int]
The overlap sizes per decimation level
Examples
--------
Generate decimation and windowing parameters for data sampled at 4096 Hz.
Note that requesting window sizes or overlap sizes for decimation levels
that do not exist will raise a ValueError.
>>> from resistics.decimate import DecimationSetup
>>> from resistics.window import WindowSetup
>>> dec_setup = DecimationSetup(n_levels=3, per_level=3)
>>> dec_params = dec_setup.run(4096)
>>> dec_params.summary()
{
'fs': 4096.0,
'n_levels': 3,
'per_level': 3,
'min_samples': 256,
'eval_freqs': [
1024.0,
724.0773439350246,
512.0,
362.0386719675123,
256.0,
181.01933598375615,
128.0,
90.50966799187808,
64.0
],
'dec_factors': [1, 2, 8],
'dec_increments': [1, 2, 4],
'dec_fs': [4096.0, 2048.0, 512.0]
}
>>> win_params = WindowSetup().run(dec_params.n_levels, dec_params.dec_fs)
>>> win_params.summary()
{
'n_levels': 3,
'min_n_wins': 5,
'win_sizes': [1024, 512, 128],
'olap_sizes': [256, 128, 32]
}
>>> win_params.get_win_size(0)
1024
>>> win_params.get_olap_size(0)
256
>>> win_params.get_olap_size(3)
Traceback (most recent call last):
...
ValueError: Level 3 must be 0 <= level < 3
"""
n_levels: int
min_n_wins: int
win_sizes: List[int]
olap_sizes: List[int]
def check_level(self, level: int):
"""Check the decimation level is within range"""
if level < 0 or level >= self.n_levels:
raise ValueError(f"Level {level} must be 0 <= level < {self.n_levels}")
def get_win_size(self, level: int) -> int:
"""Get window size for a decimation level"""
self.check_level(level)
return self.win_sizes[level]
def get_olap_size(self, level: int) -> int:
"""Get overlap size for a decimation level"""
self.check_level(level)
return self.olap_sizes[level]
class WindowSetup(ResisticsProcess):
"""
Setup WindowParameters
WindowSetup outputs the WindowParameters to use for windowing decimated
time data.
Window parameters are simply the window and overlap sizes for each
decimation level.
Parameters
----------
min_size : int, optional
Minimum window size, by default 128
min_olap : int, optional
Minimum overlap size, by default 32
win_factor : int, optional
Window factor, by default 4. Window sizes are calculated by sampling
frequency / 4 to ensure sufficient frequency resolution. If the
sampling frequency is small, window size will be adjusted to
min_size
olap_proportion : float, optional
The proportion of the window size to use as the overlap, by default
0.25. For example, for a window size of 128, the overlap would be
0.25 * 128 = 32
min_n_wins : int, optional
The minimum number of windows needed in a decimation level, by
default 5
win_sizes : Optional[List[int]], optional
Explicit define window sizes, by default None. Must have the same
length as number of decimation levels
olap_sizes : Optional[List[int]], optional
Explicitly define overlap sizes, by default None. Must have the same
length as number of decimation levels
Examples
--------
Generate decimation and windowing parameters for data sampled at 0.05 Hz or
20 seconds sampling period
>>> from resistics.decimate import DecimationSetup
>>> from resistics.window import WindowSetup
>>> dec_params = DecimationSetup(n_levels=3, per_level=3).run(0.05)
>>> dec_params.summary()
{
'fs': 0.05,
'n_levels': 3,
'per_level': 3,
'min_samples': 256,
'eval_freqs': [
0.0125,
0.008838834764831844,
0.00625,
0.004419417382415922,
0.003125,
0.002209708691207961,
0.0015625,
0.0011048543456039805,
0.00078125
],
'dec_factors': [1, 2, 8],
'dec_increments': [1, 2, 4],
'dec_fs': [0.05, 0.025, 0.00625]
}
>>> win_params = WindowSetup().run(dec_params.n_levels, dec_params.dec_fs)
>>> win_params.summary()
{
'n_levels': 3,
'min_n_wins': 5,
'win_sizes': [128, 128, 128],
'olap_sizes': [32, 32, 32]
}
Window parameters can also be explicitly defined
>>> from resistics.decimate import DecimationSetup
>>> from resistics.window import WindowSetup
>>> dec_setup = DecimationSetup(n_levels=3, per_level=3)
>>> dec_params = dec_setup.run(0.05)
>>> win_setup = WindowSetup(win_sizes=[1000, 578, 104])
>>> win_params = win_setup.run(dec_params.n_levels, dec_params.dec_fs)
>>> win_params.summary()
{
'n_levels': 3,
'min_n_wins': 5,
'win_sizes': [1000, 578, 104],
'olap_sizes': [250, 144, 32]
}
"""
min_size: int = 128
min_olap: int = 32
win_factor: int = 4
olap_proportion: float = 0.25
min_n_wins: int = 5
win_sizes: Optional[List[int]] = None
olap_sizes: Optional[List[int]] = None
def run(self, n_levels: int, dec_fs: List[float]) -> WindowParameters:
"""
Calculate window and overlap sizes for each decimation level based on
decimation level sampling frequency and minimum allowable parameters
The window and overlap sizes (number of samples) are calculated based in
the following way:
- window size = frequency at decimation level / window factor
- overlap size = window size * overlap proportion
This is to ensure good frequency resolution at high frequencies. At low
sampling frequencies, this would result in very small window sizes,
therefore, there a minimum allowable sizes for both windows and overlap
defined by min_size and min_olap in the initialiser. If window sizes
or overlaps size are calculated below these respecitively, they will be
set to the minimum values.
Parameters
----------
n_levels : int
The number of decimation levels
dec_fs : List[float]
The sampling frequencies for each decimation level
Returns
-------
WindowParameters
The window parameters, the window sizes and overlaps for each
decimation level
Raises
------
ValueError
If the number of windows does not match the number of levels
ValueError
If the number of overlaps does not match the number of levels
"""
if self.win_sizes is None:
win_sizes = self._get_win_sizes(n_levels, dec_fs)
else:
win_sizes = list(self.win_sizes)
if len(win_sizes) < n_levels:
raise ValueError(f"Num. windows {len(win_sizes)} < n_levels {n_levels}")
if len(win_sizes) > n_levels:
# this may happen with user input windows
# but decimated data has fewer levels
win_sizes = win_sizes[:n_levels]
if self.olap_sizes is None:
olap_sizes = self._get_olap_sizes(win_sizes)
else:
olap_sizes = self.olap_sizes
if len(olap_sizes) < n_levels:
raise ValueError(f"Num. overlaps {len(olap_sizes)} < n_levels {n_levels}")
if len(olap_sizes) > n_levels:
# this may happen with user input windows
# but decimated data has fewer levels
olap_sizes = olap_sizes[:n_levels]
return WindowParameters(
n_levels=n_levels,
min_n_wins=self.min_n_wins,
win_sizes=win_sizes,
olap_sizes=olap_sizes,
)
def _get_win_sizes(self, n_levels: int, dec_fs: List[float]) -> List[int]:
"""
Get the window sizes
Parameters
----------
n_levels : int
The number of decimation levels
dec_fs : List[float]
The sampling frequencies for each decimation level
Returns
-------
List[int]
Window sizes
"""
win_sizes = []
for ilevel in range(n_levels):
win_size = dec_fs[ilevel] // self.win_factor
if win_size < self.min_size:
win_size = self.min_size
win_sizes.append(int(win_size))
return win_sizes
def _get_olap_sizes(self, win_sizes: List[int]) -> List[int]:
"""
Get overlap sizes
Parameters
----------
win_sizes : List[int]
The window sizes
Returns
-------
List[int]
The overlap sizes
"""
olap_sizes = []
for win_size in win_sizes:
olap_size = int(win_size * self.olap_proportion)
if olap_size < self.min_olap:
olap_size = self.min_olap
olap_sizes.append(olap_size)
return olap_sizes
class WindowedLevelMetadata(Metadata):
"""Metadata for a windowed level"""
fs: float
"""The sampling frequency for the decimation level"""
n_wins: int
"""The number of windows"""
win_size: PositiveInt
"""The window size in samples"""
olap_size: PositiveInt
"""The overlap size in samples"""
index_offset: int
"""The global window offset for local window 0"""
@property
def dt(self):
return 1 / self.fs
class WindowedMetadata(WriteableMetadata):
"""Metadata for windowed data"""
fs: List[float]
chans: List[str]
n_chans: Optional[int] = None
n_levels: int
first_time: HighResDateTime
last_time: HighResDateTime
system: str = ""
serial: str = ""
wgs84_latitude: float = -999.0
wgs84_longitude: float = -999.0
easting: float = -999.0
northing: float = -999.0
elevation: float = -999.0
chans_metadata: Dict[str, ChanMetadata]
levels_metadata: List[WindowedLevelMetadata]
ref_time: HighResDateTime
history: History = History()
class Config:
extra = "ignore"
class WindowedData(ResisticsData):
"""
Windows of a DecimatedData object
The windowed data is stored in a dictionary attribute named data. This is
a dictionary with an entry for each decimation level. The shape for a single
decimation level is as follows:
n_wins x n_chans x n_samples
"""
def __init__(
self,
metadata: WindowedMetadata,
data: Dict[int, np.ndarray],
):
"""
Initialise the WindowedData
Parameters
----------
metadata : WindowedDataMetadata
The metadata for the windowed data
data : Dict[int, WindowedTimeData]
The windowed data
"""
logger.debug(f"Creating WindowedData with data type {data[0].dtype}")
self.metadata = metadata
self.data = data
def get_level(self, level: int) -> np.ndarray:
"""
Get windows for a decimation level
Parameters
----------
level : int
The decimation level
Returns
-------
np.ndarray
The window array
Raises
------
ValueError
If decimation level is not within range
"""
if level >= self.metadata.n_levels:
raise ValueError(f"Level {level} not <= max {self.metadata.n_levels - 1}")
return self.data[level]
def get_local(self, level: int, local_win: int) -> np.ndarray:
"""
Get window using local index
Parameters
----------
level : int
The decimation level
local_win : int
Local window index
Returns
-------
np.ndarray
Window data
Raises
------
ValueError
If local window index is out of range
"""
n_wins = self.metadata.levels_metadata[level].n_wins
if local_win < 0 or local_win >= n_wins:
raise ValueError(f"Local window {local_win} not 0 <= local_win < {n_wins}")
return self.get_level(level)[local_win]
def get_global(self, level: int, global_win: int) -> np.ndarray:
"""
Get window using global index
Parameters
----------
level : int
The decimation level
global_win : int
Global window index
Returns
-------
np.ndarray
Window data
"""
index_offset = self.metadata.levels_metadata[level].index_offset
return self.get_local(level, global_win + index_offset)
def get_chan(self, level: int, chan: str) -> np.ndarray:
"""
Get all the windows for a channel
Parameters
----------
level : int
The decimation level
chan : str
The channel
Returns
-------
np.ndarray
The data for the channels
Raises
------
ChannelNotFoundError
If the channel is not found in the data
"""
from resistics.errors import ChannelNotFoundError
if chan not in self.metadata.chans:
raise ChannelNotFoundError(chan, self.metadata.chans)
idx = self.metadata.chans.index(chan)
return self.get_level(level)[..., idx, :]
def to_string(self) -> str:
"""Class information as a string"""
return self.metadata.to_string()
class Windower(ResisticsProcess):
"""
Windows DecimatedData
This is the primary window making process for resistics and should be used
when alignment of windows with a site or across sites is required.
This method uses numpy striding to produce window views into the decimated
data.
See Also
--------
WindowerTarget : A windower to make a target number of windows
Examples
--------
The Windower windows a DecimatedData object given a reference time and some
window parameters.
There's quite a few imports needed for this example. Begin by doing the
imports, defining a reference time and generating random decimated data.
>>> from resistics.sampling import to_datetime
>>> from resistics.testing import decimated_data_linear
>>> from resistics.window import WindowSetup, Windower
>>> dec_data = decimated_data_linear(fs=128)
>>> ref_time = dec_data.metadata.first_time
>>> print(dec_data.to_string())
<class 'resistics.decimate.DecimatedData'>
fs dt n_samples first_time last_time
level
0 2048.0 0.000488 16384 2021-01-01 00:00:00 2021-01-01 00:00:07.99951171875
1 512.0 0.001953 4096 2021-01-01 00:00:00 2021-01-01 00:00:07.998046875
2 128.0 0.007812 1024 2021-01-01 00:00:00 2021-01-01 00:00:07.9921875
Next, initialise the window parameters. For this example, use small windows,
which will make inspecting them easier.
>>> win_params = WindowSetup(win_sizes=[16,16,16], min_olap=4).run(dec_data.metadata.n_levels, dec_data.metadata.fs)
>>> win_params.summary()
{
'n_levels': 3,
'min_n_wins': 5,
'win_sizes': [16, 16, 16],
'olap_sizes': [4, 4, 4]
}
Perform the windowing. This actually creates views into the decimated data
using the numpy.lib.stride_tricks.sliding_window_view function. The shape
for a data array at a decimation level is: n_wins x n_chans x win_size. The
information about each level is also in the levels_metadata attribute of
WindowedMetadata.
>>> win_data = Windower().run(ref_time, win_params, dec_data)
>>> win_data.data[0].shape
(1365, 2, 16)
>>> for level_metadata in win_data.metadata.levels_metadata:
... level_metadata.summary()
{
'fs': 2048.0,
'n_wins': 1365,
'win_size': 16,
'olap_size': 4,
'index_offset': 0
}
{
'fs': 512.0,
'n_wins': 341,
'win_size': 16,
'olap_size': 4,
'index_offset': 0
}
{
'fs': 128.0,
'n_wins': 85,
'win_size': 16,
'olap_size': 4,
'index_offset': 0
}
Let's look at an example of data from the first decimation level for the
first channel. This is simply a linear set of data ranging from 0...16_383.
>>> dec_data.data[0][0]
array([ 0, 1, 2, ..., 16381, 16382, 16383])
Inspecting the first few windows shows they are as expected including the
overlap.
>>> win_data.data[0][0, 0]
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])
>>> win_data.data[0][1, 0]
array([12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27])
>>> win_data.data[0][2, 0]
array([24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39])
"""
def run(
self,
ref_time: RSDateTime,
win_params: WindowParameters,
dec_data: DecimatedData,
) -> WindowedData:
"""
Perform windowing of DecimatedData
Parameters
----------
ref_time : RSDateTime
The reference time
win_params : WindowParameters
The window parameters
dec_data : DecimatedData
The decimated data
Returns
-------
WindowedData
Windows for decimated data
Raises
------
ProcessRunError
If the number of windows calculated in the window table does not
match the size of the array views
"""
metadata_dict = dec_data.metadata.dict()
data = {}
win_levels_metadata = []
messages = []
for ilevel in range(0, dec_data.metadata.n_levels):
logger.info(f"Windowing decimation level {ilevel}")
win_size = win_params.get_win_size(ilevel)
olap_size = win_params.get_olap_size(ilevel)
level_metadata = dec_data.metadata.levels_metadata[ilevel]
win_table = get_win_table(ref_time, level_metadata, win_size, olap_size)
n_wins = len(win_table.index)
logger.info(f"{n_wins} windows, size {win_size}, overlap {olap_size}")
messages.append(f"Level {ilevel}, generated {n_wins} windows")
messages.append(f"Window size {win_size}, olap_size {olap_size}")
if n_wins < win_params.min_n_wins:
logger.debug(f"Number windows {n_wins} < min. {win_params.min_n_wins}")
messages.append(f"Num. windows {n_wins} < min. {win_params.min_n_wins}")
messages.append(f"Level {ilevel} incomplete, terminating windowing")
break
win_level_data = self._get_level_data(
dec_data.get_level(ilevel),
win_table,
dec_data.metadata.n_chans,
win_size,
olap_size,
)
if win_level_data.shape[0] != n_wins:
raise ProcessRunError(
self.name,
f"Num. windows mismatch {win_level_data.shape[0]} != {n_wins}",
)
win_level_metadata = self._get_level_metadata(
level_metadata,
win_table,
win_size,
olap_size,
)
data[ilevel] = win_level_data
win_levels_metadata.append(win_level_metadata)
metadata_dict["ref_time"] = ref_time
metadata = self._get_metadata(metadata_dict, win_levels_metadata)
metadata.history.add_record(self._get_record(messages))
logger.info("Windowing completed")
return WindowedData(metadata, data)
def _get_level_data(
self,
data: np.ndarray,
win_table: pd.DataFrame,
n_chans: int,
win_size: int,
olap_size: int,
) -> np.ndarray:
"""
Get window data for a decimation level
Parameters
----------
data : np.ndarray
The decimated time data for the level
win_table : pd.DataFrame
The window table
n_chans : int
The number of channels
win_size : int
The window size
olap_size : int
The overlap size
Returns
-------
np.ndarray
Sliding window views in an array for the decimation level
"""
from numpy.lib.stride_tricks import sliding_window_view
from_sample = win_table.loc[0, "from_sample"]
to_sample = win_table.loc[win_table.index[-1], "from_sample"]
increment_size = win_size - olap_size
view = np.squeeze(
sliding_window_view(data, window_shape=(n_chans, win_size), writeable=True)
)
return view[from_sample : to_sample + 1 : increment_size]
def _get_level_metadata(
self,
level_metadata: DecimatedLevelMetadata,
win_table: pd.DataFrame,
win_size: int,
olap_size: int,
) -> WindowedLevelMetadata:
"""Get the windowed metadata for a decimation level"""
offset = (win_table["global"] - win_table["local"]).unique()
if len(offset) != 1:
raise ValueError("Malformed window table, varying local to global offset")
return WindowedLevelMetadata(
fs=level_metadata.fs,
n_wins=len(win_table.index),
win_size=win_size,
olap_size=olap_size,
index_offset=offset[0],
)
def _get_metadata(
self,
metadata_dict: Dict[str, Any],
levels_metadata: List[WindowedLevelMetadata],
) -> WindowedMetadata:
"""Get the metadata for the windowed data"""
metadata_dict.pop("file_info")
metadata_dict["n_levels"] = len(levels_metadata)
metadata_dict["levels_metadata"] = levels_metadata
return WindowedMetadata(**metadata_dict)
class WindowerTarget(Windower):
"""
Windower that selects window sizes to meet a target number of windows
The minimum window size in window parameters will be respected even if the
generated number of windows is below the target. This is to avoid situations
where excessively small windows sizes are selected.
.. warning::
This process is primarily useful for quick processing of a single
measurement and should not be used when any alignment of windows is
required within a site or across sites.
Parameters
----------
target : int
The target number of windows for each decimation level
olap_proportion : float
The overlap proportion of the window size
See Also
--------
Windower : The window making process to use when alignment is required
"""
target: int = 1000
min_size: int = 64
olap_proportion: float = 0.25
def run(
self,
ref_time: RSDateTime,
win_params: WindowParameters,
dec_data: DecimatedData,
) -> WindowedData:
metadata_dict = dec_data.metadata.dict()
data = {}
win_levels_metadata = []
messages = []
for ilevel in range(0, dec_data.metadata.n_levels):
logger.info(f"Windowing decimation level {ilevel}")
level_metadata = dec_data.metadata.levels_metadata[ilevel]
win_size = self._get_win_size(level_metadata)
olap_size = int(np.floor(self.olap_proportion * win_size))
win_table = get_win_table(ref_time, level_metadata, win_size, olap_size)
n_wins = len(win_table.index)
logger.info(f"{n_wins} windows, size {win_size}, overlap {olap_size}")
messages.append(f"Level {ilevel}, generated {n_wins} windows")
messages.append(f"Window size {win_size}, olap_size {olap_size}")
if n_wins < win_params.min_n_wins:
logger.debug(f"Number windows {n_wins} < min. {win_params.min_n_wins}")
messages.append(f"Num. windows {n_wins} < min. {win_params.min_n_wins}")
messages.append(f"Level {ilevel} incomplete, terminating windowing")
break
win_level_data = self._get_level_data(
dec_data.get_level(ilevel),
win_table,
dec_data.metadata.n_chans,
win_size,
olap_size,
)
win_level_metadata = self._get_level_metadata(
level_metadata,
win_table,
win_size,
olap_size,
)
data[ilevel] = win_level_data
win_levels_metadata.append(win_level_metadata)
metadata_dict["ref_time"] = metadata_dict["first_time"]
metadata = self._get_metadata(metadata_dict, win_levels_metadata)
metadata.history.add_record(self._get_record(messages))
logger.info("Windowing completed")
return WindowedData(metadata, data)
def _get_win_size(self, level_metadata: DecimatedLevelMetadata) -> int:
r"""
Get window size that gives close to the target number of windows
Windows increment by (window size - overlap size), therefore the
follwing equation is solved,
.. math::
n_{samples} / ((1 - n_{overlap})*n_{window}) = target
Rearrangning, get,
.. math::
n_{window} = n_{samples} / ((1 - n_{overlap})*target)
Parameters
----------
level_metadata : DecimatedLevelMetadata
The metadata for the decimation level
Returns
-------
int
The window size
"""
win_size = level_metadata.n_samples / ((1 - self.olap_proportion) * self.target)
win_size = int(np.floor(win_size))
if win_size < self.min_size:
return self.min_size
return win_size
class WindowedDataWriter(ResisticsWriter):
"""Writer of resistics windowed data"""
def run(self, dir_path: Path, win_data: WindowedData) -> None:
"""
Write out WindowedData
Parameters
----------
dir_path : Path
The directory path to write to
win_data : WindowedData
Windowed data to write out
Raises
------
WriteError
If unable to write to the directory
"""
from resistics.errors import WriteError
if not self._check_dir(dir_path):
raise WriteError(dir_path, "Unable to write to directory, check logs")
logger.info(f"Writing windowed data to {dir_path}")
metadata_path = dir_path / "metadata.json"
data_path = dir_path / "data"
np.savez_compressed(data_path, **{str(x): y for x, y in win_data.data.items()})
metadata = win_data.metadata.copy()
metadata.history.add_record(self._get_record(dir_path, type(win_data)))
metadata.write(metadata_path)
class WindowedDataReader(ResisticsProcess):
"""Reader of resistics windowed data"""
def run(
self, dir_path: Path, metadata_only: bool = False
) -> Union[WindowedMetadata, WindowedData]:
"""
Read WindowedData
Parameters
----------
dir_path : Path
The directory path to read from
metadata_only : bool, optional
Flag for getting metadata only, by default False
Returns
-------
Union[WindowedMetadata, WindowedData]
The WindowedData or WindowedMetadata if metadata_only is True
Raises
------
ReadError
If the directory does not exist
"""
from resistics.errors import ReadError
if not dir_path.exists():
raise ReadError(dir_path, "Directory does not exist")
logger.info(f"Reading windowed data from {dir_path}")
metadata_path = dir_path / "metadata.json"
metadata = WindowedMetadata.parse_file(metadata_path)
if metadata_only:
return metadata
data_path = dir_path / "data.npz"
npz_file = np.load(data_path)
data = {int(level): npz_file[level] for level in npz_file.files}
messages = [f"Windowed data read from {dir_path}"]
metadata.history.add_record(self._get_record(messages))
return WindowedData(metadata, data)
| [
1,
9995,
13,
7355,
363,
25202,
3474,
4475,
848,
29889,
3852,
508,
367,
27541,
6198,
304,
13,
10184,
6257,
16285,
29889,
13,
13,
29899,
9959,
3474,
2380,
13,
13,
1678,
448,
18379,
2380,
6198,
304,
278,
5974,
1469,
338,
2000,
376,
2997,
29918,
5080,
29908,
13,
1678,
448,
9959,
3474,
16285,
2337,
1369,
472,
29871,
29900,
13,
13,
29899,
12002,
3474,
2380,
13,
13,
1678,
448,
450,
5534,
3474,
2380,
338,
6198,
304,
278,
2060,
3407,
931,
13,
1678,
448,
450,
29871,
29900,
2380,
3474,
16410,
472,
278,
3407,
931,
13,
1678,
448,
910,
3474,
26190,
338,
304,
12231,
895,
848,
4822,
11840,
13,
13,
1576,
5534,
3474,
2380,
338,
5545,
278,
2322,
322,
6041,
12992,
304,
408,
13,
1552,
3474,
29889,
9959,
5417,
881,
367,
9479,
12992,
304,
408,
1887,
29918,
5080,
297,
13,
497,
4251,
29889,
13,
13,
1576,
3474,
3883,
7805,
9863,
304,
437,
278,
1494,
29901,
13,
13,
29899,
18379,
292,
19725,
3168,
304,
8147,
3474,
322,
25457,
15786,
13,
29899,
6680,
29879,
304,
2910,
5417,
304,
11916,
297,
5974,
1469,
13,
29899,
1281,
369,
1259,
263,
5534,
2380,
1409,
304,
12865,
13,
13,
15922,
1474,
411,
3474,
292,
29892,
727,
338,
263,
3474,
2159,
322,
5417,
25457,
411,
1269,
13,
1228,
363,
263,
731,
1353,
310,
11916,
29889,
1094,
385,
8632,
1230,
6455,
29892,
2050,
263,
13,
25436,
4559,
29881,
472,
29871,
29896,
29900,
379,
29920,
313,
6008,
29922,
29900,
29889,
29896,
6923,
29897,
411,
29871,
29906,
29946,
11916,
29889,
910,
674,
367,
3474,
287,
13,
4746,
263,
3474,
2159,
310,
29871,
29947,
11916,
639,
3474,
322,
263,
29871,
29906,
4559,
25457,
29889,
13,
13,
636,
6492,
1057,
13,
13,
1678,
8653,
1053,
12655,
408,
7442,
13,
1678,
8653,
1053,
22889,
29889,
2272,
5317,
408,
14770,
13,
1678,
8653,
18920,
353,
29871,
29896,
29900,
13,
1678,
8653,
302,
29918,
27736,
353,
29871,
29906,
29946,
13,
1678,
8653,
5401,
29918,
2311,
353,
29871,
29947,
13,
1678,
8653,
288,
6984,
29918,
2311,
353,
29871,
29906,
13,
1678,
8653,
3064,
353,
7442,
29889,
279,
927,
29898,
29900,
29892,
302,
29918,
27736,
29897,
334,
313,
29896,
29914,
5847,
29897,
13,
13,
1678,
450,
937,
3474,
13,
13,
1678,
8653,
1369,
29918,
5080,
29896,
353,
29871,
29900,
13,
1678,
8653,
1095,
29918,
5080,
29896,
353,
5401,
29918,
2311,
13,
1678,
8653,
5401,
29896,
29918,
3706,
353,
3064,
29961,
2962,
29918,
5080,
29896,
29901,
355,
29918,
5080,
29896,
29962,
13,
13,
1678,
450,
1473,
3474,
13,
13,
1678,
8653,
1369,
29918,
5080,
29906,
353,
1095,
29918,
5080,
29896,
448,
288,
6984,
29918,
2311,
13,
1678,
8653,
1095,
29918,
5080,
29906,
353,
1369,
29918,
5080,
29906,
718,
5401,
29918,
2311,
13,
1678,
8653,
5401,
29906,
29918,
3706,
353,
3064,
29961,
2962,
29918,
5080,
29906,
29901,
355,
29918,
5080,
29906,
29962,
13,
13,
1678,
450,
4654,
3474,
13,
13,
1678,
8653,
1369,
29918,
5080,
29941,
353,
1095,
29918,
5080,
29906,
448,
288,
6984,
29918,
2311,
13,
1678,
8653,
1095,
29918,
5080,
29941,
353,
1369,
29918,
5080,
29941,
718,
5401,
29918,
2311,
13,
1678,
8653,
5401,
29941,
29918,
3706,
353,
3064,
29961,
2962,
29918,
5080,
29941,
29901,
355,
29918,
5080,
29941,
29962,
13,
13,
1678,
450,
11582,
3474,
13,
13,
1678,
8653,
1369,
29918,
5080,
29946,
29922,
1095,
29918,
5080,
29941,
448,
288,
6984,
29918,
2311,
13,
1678,
8653,
1095,
29918,
5080,
29946,
353,
1369,
29918,
5080,
29946,
718,
5401,
29918,
2311,
13,
1678,
8653,
5401,
29946,
29918,
3706,
353,
3064,
29961,
2962,
29918,
5080,
29946,
29901,
355,
29918,
5080,
29946,
29962,
13,
13,
1678,
2803,
29915,
29879,
1106,
472,
278,
3935,
3474,
3064,
363,
1269,
3474,
13,
13,
1678,
8653,
5401,
29896,
29918,
3706,
13,
1678,
1409,
4197,
29900,
29889,
1919,
29871,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29946,
29892,
29871,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29953,
29892,
29871,
29900,
29889,
29955,
2314,
13,
1678,
8653,
5401,
29906,
29918,
3706,
13,
1678,
1409,
4197,
29900,
29889,
29953,
29892,
29871,
29900,
29889,
29955,
29892,
29871,
29900,
29889,
29947,
29892,
29871,
29900,
29889,
29929,
29892,
29871,
29896,
29889,
1919,
29871,
29896,
29889,
29896,
29892,
29871,
29896,
29889,
29906,
29892,
29871,
29896,
29889,
29941,
2314,
13,
1678,
8653,
5401,
29941,
29918,
3706,
13,
1678,
1409,
4197,
29896,
29889,
29906,
29892,
29871,
29896,
29889,
29941,
29892,
29871,
29896,
29889,
29946,
29892,
29871,
29896,
29889,
29945,
29892,
29871,
29896,
29889,
29953,
29892,
29871,
29896,
29889,
29955,
29892,
29871,
29896,
29889,
29947,
29892,
29871,
29896,
29889,
29929,
2314,
13,
1678,
8653,
5401,
29946,
29918,
3706,
13,
1678,
1409,
4197,
29896,
29889,
29947,
29892,
29871,
29896,
29889,
29929,
29892,
29871,
29906,
29889,
1919,
29871,
29906,
29889,
29896,
29892,
29871,
29906,
29889,
29906,
29892,
29871,
29906,
29889,
29941,
2314,
13,
13,
1678,
450,
14385,
322,
3079,
1860,
310,
5417,
508,
367,
12833,
773,
4944,
13,
1678,
3519,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
5401,
29918,
19708,
29892,
5528,
29918,
19708,
13,
1678,
8653,
1596,
29898,
5080,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
18920,
876,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29955,
13,
1678,
8653,
1596,
29898,
3742,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
18920,
876,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29953,
13,
13,
1678,
18399,
278,
5417,
304,
2367,
385,
8632,
362,
310,
920,
372,
1736,
13,
13,
1678,
8653,
14770,
29889,
5317,
29898,
5080,
29896,
29918,
3706,
29892,
7442,
29889,
2873,
29918,
4561,
29898,
5080,
29896,
29918,
3706,
511,
376,
833,
613,
3858,
543,
7165,
29896,
1159,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
5317,
29898,
5080,
29906,
29918,
3706,
29892,
7442,
29889,
2873,
29918,
4561,
29898,
5080,
29906,
29918,
3706,
11877,
29906,
29892,
376,
307,
613,
3858,
543,
7165,
29906,
1159,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
5317,
29898,
5080,
29941,
29918,
3706,
29892,
7442,
29889,
2873,
29918,
4561,
29898,
5080,
29941,
29918,
3706,
11877,
29941,
29892,
376,
1484,
613,
3858,
543,
7165,
29941,
1159,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
5317,
29898,
5080,
29946,
29918,
3706,
29892,
7442,
29889,
2873,
29918,
4561,
29898,
5080,
29946,
29918,
3706,
11877,
29946,
29892,
376,
1111,
613,
3858,
543,
7165,
29946,
1159,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
29916,
1643,
703,
2481,
518,
29879,
29962,
1159,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
26172,
580,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
7720,
580,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
29873,
523,
29918,
2680,
580,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
8653,
14770,
29889,
4294,
580,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
15945,
29908,
13,
3166,
1480,
20144,
1053,
17927,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
19229,
1053,
28379,
29892,
2391,
29892,
12603,
552,
29892,
360,
919,
29892,
7761,
29892,
3139,
13,
3166,
282,
2941,
7716,
1053,
10321,
3321,
2928,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
13,
3166,
620,
6765,
29889,
12523,
1053,
10554,
6558,
2392,
13,
3166,
620,
6765,
29889,
9435,
1053,
5298,
29892,
2538,
6765,
3195,
29892,
2538,
6765,
1469,
29892,
2538,
6765,
7032,
13,
3166,
620,
6765,
29889,
9435,
1053,
2538,
6765,
10507,
29892,
4737,
7221,
29892,
14350,
519,
18417,
13,
3166,
620,
6765,
29889,
13445,
10335,
1053,
390,
29903,
11384,
29892,
390,
1254,
603,
5268,
29892,
5057,
1666,
11384,
13,
3166,
620,
6765,
29889,
2230,
1053,
22433,
18417,
13,
3166,
620,
6765,
29889,
7099,
6490,
1053,
3826,
326,
630,
10108,
18417,
29892,
3826,
326,
630,
1469,
13,
13,
13,
1753,
5401,
29918,
19708,
29898,
5080,
29918,
2311,
29901,
938,
29892,
18920,
29901,
5785,
29897,
1599,
390,
1254,
603,
5268,
29901,
13,
1678,
9995,
13,
1678,
3617,
278,
3474,
14385,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
5401,
29918,
2311,
584,
938,
13,
4706,
18379,
2159,
297,
11916,
13,
1678,
18920,
584,
5785,
13,
4706,
3685,
10335,
10868,
379,
29920,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
390,
1254,
603,
5268,
13,
4706,
360,
2633,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
319,
2846,
6455,
411,
1422,
23460,
29511,
322,
3474,
15786,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
5401,
29918,
19708,
13,
1678,
8653,
14385,
353,
5401,
29918,
19708,
29898,
29945,
29896,
29906,
29892,
29871,
29945,
29896,
29906,
29897,
13,
1678,
8653,
1596,
29898,
19708,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29929,
29929,
29947,
29900,
29946,
29953,
29947,
29955,
29945,
13,
1678,
8653,
14385,
353,
5401,
29918,
19708,
29898,
29945,
29906,
29900,
29892,
29871,
29945,
29896,
29906,
29897,
13,
1678,
8653,
1596,
29898,
19708,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29896,
29889,
29900,
29896,
29941,
29953,
29955,
29896,
29947,
29955,
29945,
13,
1678,
8653,
14385,
353,
5401,
29918,
19708,
29898,
29946,
29900,
29929,
29953,
29892,
29871,
29896,
29953,
29918,
29941,
29947,
29946,
29897,
13,
1678,
8653,
1596,
29898,
19708,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29906,
29946,
29929,
29929,
29941,
29947,
29929,
29953,
29946,
29947,
29946,
29941,
29955,
29945,
13,
1678,
8653,
14385,
353,
5401,
29918,
19708,
29898,
29906,
29900,
29900,
29892,
29871,
29900,
29889,
29900,
29945,
29897,
13,
1678,
8653,
1596,
29898,
19708,
29897,
13,
268,
29896,
29901,
29900,
29953,
29901,
29906,
29900,
13,
1678,
9995,
13,
1678,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
9346,
287,
2554,
13,
13,
1678,
736,
304,
29918,
9346,
287,
2554,
29898,
29896,
847,
18920,
29897,
334,
5785,
29898,
5080,
29918,
2311,
448,
29871,
29896,
29897,
13,
13,
13,
1753,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29901,
938,
29892,
288,
6984,
29918,
2311,
29901,
938,
29892,
18920,
29901,
5785,
29897,
1599,
390,
1254,
603,
5268,
29901,
13,
1678,
9995,
13,
1678,
3617,
278,
11924,
1546,
3474,
1369,
3064,
13,
13,
1678,
960,
278,
25457,
2159,
353,
29871,
29900,
29892,
769,
278,
931,
11924,
1546,
5417,
338,
3763,
13,
1678,
278,
3474,
14385,
29889,
2398,
29892,
746,
727,
338,
385,
25457,
29892,
278,
11924,
13,
1678,
1546,
3474,
1369,
3064,
756,
304,
367,
10365,
287,
491,
278,
25457,
2159,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
5401,
29918,
2311,
584,
938,
13,
4706,
450,
3474,
2159,
297,
11916,
13,
1678,
288,
6984,
29918,
2311,
584,
938,
13,
4706,
450,
25457,
2159,
297,
11916,
13,
1678,
18920,
584,
5785,
13,
4706,
450,
4559,
10868,
379,
29920,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
390,
1254,
603,
5268,
13,
4706,
450,
14385,
310,
278,
3474,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
5528,
29918,
19708,
13,
1678,
8653,
11924,
353,
5528,
29918,
19708,
29898,
29896,
29906,
29947,
29892,
29871,
29941,
29906,
29892,
29871,
29896,
29906,
29947,
29897,
13,
1678,
8653,
1596,
29898,
25629,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29955,
29945,
13,
1678,
8653,
11924,
353,
5528,
29918,
19708,
29898,
29896,
29906,
29947,
29930,
29941,
29953,
29900,
29900,
29892,
29871,
29896,
29906,
29947,
29930,
29953,
29900,
29892,
29871,
29896,
29906,
29947,
29897,
13,
1678,
8653,
1596,
29898,
25629,
29897,
13,
268,
29900,
29901,
29945,
29929,
29901,
29900,
29900,
13,
1678,
9995,
13,
1678,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
9346,
287,
2554,
13,
13,
1678,
736,
304,
29918,
9346,
287,
2554,
29898,
29896,
847,
18920,
29897,
334,
5785,
29898,
5080,
29918,
2311,
448,
288,
6984,
29918,
2311,
29897,
13,
13,
13,
1753,
5401,
29918,
517,
29918,
12673,
29898,
13,
1678,
2143,
29918,
2230,
29901,
390,
29903,
11384,
29892,
5534,
29918,
5080,
29901,
938,
29892,
11924,
29901,
390,
1254,
603,
5268,
13,
29897,
1599,
390,
29903,
11384,
29901,
13,
1678,
9995,
13,
1678,
14806,
3407,
3474,
2380,
304,
1369,
931,
310,
3474,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2143,
29918,
2230,
584,
390,
29903,
11384,
13,
4706,
12105,
931,
13,
1678,
5534,
29918,
5080,
584,
938,
13,
4706,
18379,
2380,
6198,
304,
3407,
931,
13,
1678,
11924,
584,
390,
1254,
603,
5268,
13,
4706,
450,
11924,
14385,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
390,
29903,
11384,
13,
4706,
7370,
931,
310,
3474,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
530,
1342,
411,
23460,
472,
29871,
29896,
379,
29920,
29892,
263,
3474,
2159,
310,
29871,
29896,
29900,
29900,
322,
385,
25457,
2159,
13,
1678,
310,
29871,
29906,
29945,
29889,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
12673,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
5528,
29918,
19708,
29892,
5401,
29918,
517,
29918,
12673,
13,
1678,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
18920,
353,
29871,
29896,
13,
1678,
8653,
5401,
29918,
2311,
353,
29871,
29953,
29900,
13,
1678,
8653,
288,
6984,
29918,
2311,
353,
29871,
29896,
29945,
13,
1678,
8653,
11924,
353,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
18920,
29897,
13,
1678,
8653,
1596,
29898,
25629,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29946,
29945,
13,
13,
1678,
450,
11924,
338,
278,
931,
11924,
1546,
278,
1369,
310,
931,
697,
3474,
322,
13,
1678,
278,
9269,
292,
3474,
29889,
13,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
29871,
29900,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
29871,
29896,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29946,
29945,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
29871,
29906,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29896,
29901,
29941,
29900,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
29871,
29941,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29906,
29901,
29896,
29945,
13,
1678,
9995,
13,
1678,
736,
2143,
29918,
2230,
718,
313,
10945,
29918,
5080,
334,
11924,
29897,
13,
13,
13,
1753,
12865,
29918,
517,
29918,
5080,
29898,
13,
1678,
2143,
29918,
2230,
29901,
390,
29903,
11384,
29892,
13,
1678,
931,
29901,
390,
29903,
11384,
29892,
13,
1678,
11924,
29901,
390,
1254,
603,
5268,
29892,
13,
1678,
1158,
29901,
851,
353,
376,
14486,
613,
13,
29897,
1599,
938,
29901,
13,
1678,
9995,
13,
1678,
14806,
263,
12865,
304,
263,
5534,
3474,
2380,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2143,
29918,
2230,
584,
390,
29903,
11384,
13,
4706,
12105,
931,
13,
1678,
931,
584,
390,
29903,
11384,
13,
4706,
13373,
5410,
304,
3588,
13,
1678,
11924,
584,
390,
1254,
603,
5268,
13,
4706,
450,
11924,
14385,
13,
1678,
1158,
584,
851,
29892,
13136,
13,
4706,
8108,
363,
16743,
411,
5785,
2582,
29892,
491,
2322,
376,
14486,
29908,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
938,
13,
4706,
450,
5534,
3474,
2380,
474,
29889,
29872,
29889,
278,
3474,
2380,
6198,
304,
278,
3407,
13,
4706,
931,
13,
13,
1678,
390,
1759,
267,
13,
1678,
448,
23648,
13,
1678,
7865,
2392,
13,
4706,
960,
931,
529,
2143,
29918,
2230,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
319,
2560,
1342,
304,
1510,
278,
5900,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
12673,
29892,
304,
29918,
9346,
287,
2554,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
12865,
29918,
517,
29918,
5080,
29892,
5401,
29918,
517,
29918,
12673,
29892,
5528,
29918,
19708,
13,
1678,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
931,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29896,
29901,
29900,
29900,
1159,
13,
1678,
8653,
11924,
353,
304,
29918,
9346,
287,
2554,
29898,
29953,
29900,
29897,
13,
1678,
8653,
5534,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
931,
29892,
11924,
29897,
13,
1678,
8653,
5534,
29918,
5080,
13,
268,
29896,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
5534,
29918,
5080,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29896,
29901,
29900,
29900,
13,
13,
1678,
319,
901,
4280,
5900,
411,
3474,
15786,
29892,
25457,
15786,
322,
23460,
13,
1678,
29511,
13,
13,
1678,
8653,
18920,
353,
29871,
29896,
29906,
29947,
13,
1678,
8653,
5401,
29918,
2311,
353,
29871,
29906,
29945,
29953,
13,
1678,
8653,
288,
6984,
29918,
2311,
353,
29871,
29953,
29946,
13,
1678,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29941,
29899,
29896,
29945,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
931,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29946,
29899,
29896,
29955,
29871,
29896,
29947,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
11924,
353,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
18920,
29897,
13,
1678,
8653,
1596,
29898,
25629,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29896,
29889,
29945,
13,
1678,
8653,
5534,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
931,
29892,
11924,
29897,
13,
1678,
8653,
5534,
29918,
5080,
13,
268,
29896,
29929,
29946,
29946,
29900,
29900,
29900,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
5534,
29918,
5080,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29946,
29899,
29896,
29955,
29871,
29896,
29947,
29901,
29900,
29900,
29901,
29900,
29900,
13,
13,
1678,
512,
445,
10483,
29892,
26987,
278,
671,
310,
4513,
292,
13,
13,
1678,
8653,
931,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29946,
29899,
29896,
29955,
29871,
29896,
29947,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29945,
29900,
1159,
13,
1678,
8653,
5534,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
931,
29892,
11924,
29892,
1158,
353,
376,
14939,
1159,
13,
1678,
8653,
5534,
29918,
5080,
13,
268,
29896,
29929,
29946,
29946,
29900,
29900,
29900,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
5534,
29918,
5080,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29946,
29899,
29896,
29955,
29871,
29896,
29947,
29901,
29900,
29900,
29901,
29900,
29900,
13,
1678,
8653,
5534,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
931,
29892,
11924,
29892,
1158,
353,
376,
27696,
1159,
13,
1678,
8653,
5534,
29918,
5080,
13,
268,
29896,
29929,
29946,
29946,
29900,
29900,
29896,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
5534,
29918,
5080,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29946,
29899,
29896,
29955,
29871,
29896,
29947,
29901,
29900,
29900,
29901,
29900,
29896,
29889,
29945,
13,
1678,
8653,
5534,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
931,
29892,
11924,
29892,
1158,
353,
376,
14486,
1159,
13,
1678,
8653,
5534,
29918,
5080,
13,
268,
29896,
29929,
29946,
29946,
29900,
29900,
29900,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
5534,
29918,
5080,
29892,
11924,
876,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29946,
29899,
29896,
29955,
29871,
29896,
29947,
29901,
29900,
29900,
29901,
29900,
29900,
13,
13,
1678,
7280,
1342,
411,
263,
3474,
14385,
310,
7621,
1135,
263,
2462,
13,
13,
1678,
8653,
18920,
353,
29871,
29946,
29889,
29947,
29947,
29906,
29947,
29896,
29906,
29945,
29872,
29899,
29900,
29945,
13,
1678,
8653,
5401,
29918,
2311,
353,
29871,
29953,
29946,
13,
1678,
8653,
288,
6984,
29918,
2311,
353,
29871,
29896,
29953,
13,
1678,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29896,
29929,
29947,
29945,
29899,
29900,
29955,
29899,
29896,
29947,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29906,
29900,
1159,
13,
1678,
8653,
931,
353,
304,
29918,
12673,
703,
29896,
29929,
29947,
29945,
29899,
29900,
29929,
29899,
29906,
29906,
29871,
29906,
29941,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
11924,
353,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
18920,
29897,
13,
1678,
8653,
1596,
29898,
25629,
29897,
13,
268,
29896,
29896,
3841,
29892,
29871,
29929,
29901,
29900,
29946,
29901,
29900,
29900,
13,
1678,
8653,
5534,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
931,
29892,
11924,
29897,
13,
1678,
8653,
5534,
29918,
5080,
13,
268,
29953,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
5534,
29918,
5080,
29892,
11924,
876,
13,
268,
29896,
29929,
29947,
29945,
29899,
29900,
29929,
29899,
29906,
29946,
29871,
29900,
29955,
29901,
29906,
29946,
29901,
29906,
29900,
13,
13,
1678,
910,
931,
338,
7621,
1135,
278,
931,
393,
471,
27615,
304,
5534,
3474,
29892,
13,
268,
29896,
29929,
29947,
29945,
29899,
29900,
29929,
29899,
29906,
29906,
29871,
29906,
29941,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
3967,
1449,
29892,
445,
931,
411,
278,
11904,
2984,
29889,
13,
13,
1678,
8653,
5534,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
931,
29892,
11924,
29892,
1158,
543,
14939,
1159,
13,
1678,
8653,
5534,
29918,
5080,
13,
268,
29945,
13,
1678,
8653,
1596,
29898,
5080,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
5534,
29918,
5080,
29892,
11924,
876,
13,
268,
29896,
29929,
29947,
29945,
29899,
29900,
29929,
29899,
29896,
29906,
29871,
29906,
29906,
29901,
29906,
29900,
29901,
29906,
29900,
13,
13,
1678,
9995,
13,
1678,
515,
5844,
1053,
11904,
29892,
2257,
309,
13,
1678,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
23128,
13,
13,
1678,
565,
931,
529,
2143,
29918,
2230,
29901,
13,
4706,
12020,
7865,
2392,
29898,
29888,
29908,
2481,
426,
710,
29898,
2230,
2915,
529,
3407,
931,
426,
710,
29898,
999,
29918,
2230,
2915,
1159,
13,
13,
1678,
11924,
29918,
16700,
29918,
262,
29918,
23128,
29892,
11924,
29918,
1745,
17225,
29918,
262,
29918,
23128,
353,
304,
29918,
23128,
29898,
25629,
29897,
13,
1678,
11924,
29918,
23128,
353,
11924,
29918,
16700,
29918,
262,
29918,
23128,
718,
11924,
29918,
1745,
17225,
29918,
262,
29918,
23128,
13,
13,
1678,
19471,
29918,
16700,
29918,
262,
29918,
23128,
29892,
19471,
29918,
1745,
17225,
29918,
262,
29918,
23128,
353,
304,
29918,
23128,
29898,
2230,
448,
2143,
29918,
2230,
29897,
13,
1678,
19471,
29918,
7827,
29918,
262,
29918,
23128,
353,
19471,
29918,
16700,
29918,
262,
29918,
23128,
718,
19471,
29918,
1745,
17225,
29918,
262,
29918,
23128,
13,
1678,
302,
29918,
262,
1037,
1860,
353,
19471,
29918,
7827,
29918,
262,
29918,
23128,
847,
11924,
29918,
23128,
13,
13,
1678,
565,
302,
29918,
262,
1037,
1860,
29889,
275,
29918,
16031,
7295,
13,
4706,
302,
29918,
262,
1037,
1860,
353,
938,
29898,
29876,
29918,
262,
1037,
1860,
29897,
13,
1678,
25342,
1158,
1275,
376,
14939,
1115,
13,
4706,
302,
29918,
262,
1037,
1860,
353,
938,
29898,
14939,
29898,
29876,
29918,
262,
1037,
1860,
876,
13,
1678,
25342,
1158,
1275,
376,
27696,
1115,
13,
4706,
302,
29918,
262,
1037,
1860,
353,
938,
29898,
27696,
29898,
29876,
29918,
262,
1037,
1860,
876,
13,
1678,
1683,
29901,
13,
4706,
302,
29918,
262,
1037,
1860,
353,
938,
29898,
14486,
29898,
29876,
29918,
262,
1037,
1860,
876,
13,
1678,
736,
302,
29918,
262,
1037,
1860,
13,
13,
13,
1753,
679,
29918,
4102,
29918,
392,
29918,
4230,
29918,
5080,
29898,
13,
1678,
2143,
29918,
2230,
29901,
390,
29903,
11384,
29892,
13,
1678,
15562,
29901,
3826,
326,
630,
10108,
18417,
29892,
13,
1678,
5401,
29918,
2311,
29901,
938,
29892,
13,
1678,
288,
6984,
29918,
2311,
29901,
938,
29892,
13,
29897,
1599,
12603,
552,
29961,
524,
29892,
938,
5387,
13,
1678,
9995,
13,
1678,
3617,
937,
322,
1833,
3474,
363,
263,
1602,
326,
630,
848,
3233,
13,
13,
1678,
6317,
4443,
1057,
13,
13,
4706,
1152,
278,
1833,
3474,
29892,
373,
2847,
13944,
445,
1122,
367,
697,
470,
263,
13,
4706,
7472,
310,
1023,
5417,
8724,
278,
1833,
931,
29889,
450,
1833,
3474,
338,
10365,
287,
13,
4706,
297,
445,
740,
29889,
13,
13,
4706,
7803,
5417,
1122,
6403,
746,
278,
931,
310,
278,
1833,
4559,
338,
297,
278,
25457,
13,
4706,
310,
278,
2186,
1023,
5417,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2143,
29918,
2230,
584,
390,
29903,
11384,
13,
4706,
450,
3407,
931,
13,
1678,
15562,
584,
3826,
326,
630,
10108,
18417,
13,
4706,
4737,
7221,
363,
278,
1602,
7715,
3233,
13,
1678,
5401,
29918,
2311,
584,
938,
13,
4706,
18379,
2159,
297,
11916,
13,
1678,
288,
6984,
29918,
2311,
584,
938,
13,
4706,
6811,
6984,
2159,
297,
11916,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
12603,
552,
29961,
524,
29892,
938,
29962,
13,
4706,
3824,
322,
1833,
5534,
5417,
29889,
910,
338,
3474,
16285,
6198,
304,
278,
13,
4706,
3407,
931,
13,
13,
1678,
390,
1759,
267,
13,
1678,
448,
23648,
13,
1678,
7865,
2392,
13,
4706,
960,
9368,
304,
8147,
278,
1833,
3474,
5149,
408,
445,
674,
1121,
297,
13,
4706,
385,
10240,
1353,
310,
5417,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
3617,
278,
937,
322,
1833,
3474,
363,
278,
937,
1602,
7715,
3233,
297,
263,
1602,
326,
630,
13,
1678,
848,
2777,
29889,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
13424,
1053,
1602,
326,
630,
29918,
1272,
29918,
8172,
13,
1678,
8653,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
12673,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
679,
29918,
4102,
29918,
392,
29918,
4230,
29918,
5080,
29892,
5401,
29918,
517,
29918,
12673,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
5401,
29918,
19708,
29892,
5528,
29918,
19708,
13,
1678,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
1602,
29918,
1272,
353,
1602,
326,
630,
29918,
1272,
29918,
8172,
29898,
5847,
29922,
29900,
29889,
29896,
29892,
937,
29918,
2230,
543,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29945,
29901,
29896,
29900,
613,
302,
29918,
27736,
29922,
29896,
29900,
29900,
29892,
7329,
29922,
29896,
29900,
29897,
13,
13,
1678,
3617,
278,
15562,
363,
1602,
7715,
3233,
29871,
29900,
13,
13,
1678,
8653,
3233,
29918,
19635,
353,
1602,
29918,
1272,
29889,
19635,
29889,
5563,
29879,
29918,
19635,
29961,
29900,
29962,
13,
1678,
8653,
3233,
29918,
19635,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
5847,
2396,
29871,
29896,
29900,
29889,
29900,
29892,
13,
4706,
525,
29876,
29918,
27736,
2396,
29871,
29896,
29900,
29900,
29900,
29900,
29892,
13,
4706,
525,
4102,
29918,
2230,
2396,
525,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29945,
29901,
29896,
29900,
29889,
29900,
29900,
29900,
29900,
29900,
29900,
29918,
29900,
29900,
29900,
29900,
29900,
29900,
29918,
29900,
29900,
29900,
29900,
29900,
29900,
29918,
29900,
29900,
29900,
29900,
29900,
29900,
742,
13,
4706,
525,
4230,
29918,
2230,
2396,
525,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29906,
29896,
29901,
29946,
29929,
29889,
29947,
29929,
29929,
29929,
29929,
29929,
29918,
29929,
29929,
29929,
29929,
29929,
29929,
29918,
29929,
29955,
29955,
29941,
29900,
29900,
29918,
29900,
29900,
29900,
29900,
29900,
29900,
29915,
13,
1678,
500,
13,
13,
1678,
6317,
4443,
1057,
13,
13,
4706,
1094,
263,
1298,
310,
4066,
29892,
4443,
920,
278,
1833,
931,
338,
2869,
10029,
13,
4706,
10240,
29889,
910,
338,
2861,
304,
4933,
16716,
5626,
5439,
297,
901,
13,
4706,
9493,
1244,
2045,
597,
2640,
29889,
4691,
29889,
990,
29914,
29941,
29914,
12631,
29914,
29888,
417,
1218,
3149,
29889,
1420,
29889,
13,
4706,
806,
16613,
727,
338,
995,
297,
773,
278,
1880,
10104,
12865,
3402,
363,
13,
4706,
1880,
23460,
19257,
29892,
727,
338,
263,
11302,
2696,
29889,
10506,
526,
278,
639,
2719,
310,
13,
4706,
16526,
1298,
23342,
29889,
13,
13,
1678,
450,
2446,
4331,
338,
304,
8147,
278,
937,
322,
1833,
3474,
29892,
6198,
304,
278,
13,
1678,
3407,
931,
13,
13,
1678,
8653,
5401,
29918,
2311,
353,
29871,
29896,
29900,
29900,
13,
1678,
8653,
288,
6984,
29918,
2311,
353,
29871,
29906,
29945,
13,
1678,
8653,
937,
29918,
5080,
29892,
1833,
29918,
5080,
353,
679,
29918,
4102,
29918,
392,
29918,
4230,
29918,
5080,
29898,
999,
29918,
2230,
29892,
3233,
29918,
19635,
29892,
5401,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29897,
13,
1678,
8653,
1596,
29898,
4102,
29918,
5080,
29892,
1833,
29918,
5080,
29897,
13,
268,
29946,
29906,
29871,
29896,
29955,
29941,
13,
13,
1678,
4525,
3474,
16285,
508,
367,
11543,
304,
1369,
3064,
310,
278,
5417,
29889,
450,
13,
1678,
1833,
3474,
338,
7120,
304,
1207,
1854,
372,
947,
451,
10985,
4940,
278,
1095,
310,
278,
13,
1678,
931,
848,
29889,
3824,
679,
278,
3474,
14385,
322,
3079,
1860,
29889,
13,
13,
1678,
8653,
14385,
353,
5401,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
3233,
29918,
19635,
29889,
5847,
29897,
13,
1678,
8653,
1596,
29898,
19708,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29929,
29889,
29929,
13,
1678,
8653,
11924,
353,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
3233,
29918,
19635,
29889,
5847,
29897,
13,
1678,
8653,
1596,
29898,
25629,
29897,
13,
268,
29900,
29901,
29900,
29900,
29901,
29900,
29955,
29889,
29945,
13,
13,
1678,
2567,
8147,
278,
3064,
310,
278,
5417,
13,
13,
1678,
8653,
937,
29918,
5080,
29918,
2962,
29918,
2230,
353,
5401,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
29871,
29946,
29906,
29892,
11924,
29897,
13,
1678,
8653,
1833,
29918,
5080,
29918,
2962,
29918,
2230,
353,
5401,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
29871,
29896,
29955,
29941,
29892,
11924,
29897,
13,
1678,
8653,
1596,
29898,
4102,
29918,
5080,
29918,
2962,
29918,
2230,
29892,
1833,
29918,
5080,
29918,
2962,
29918,
2230,
29897,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29945,
29901,
29896,
29945,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29906,
29896,
29901,
29941,
29955,
29889,
29945,
13,
1678,
8653,
1596,
29898,
4230,
29918,
5080,
29918,
2962,
29918,
2230,
718,
14385,
29897,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29906,
29896,
29901,
29946,
29955,
29889,
29946,
13,
1678,
8653,
1596,
29898,
5563,
29918,
19635,
29889,
4230,
29918,
2230,
29897,
13,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29906,
29896,
29901,
29946,
29929,
29889,
29947,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29929,
29955,
29955,
29941,
13,
1678,
8653,
3233,
29918,
19635,
29889,
4230,
29918,
2230,
1405,
1833,
29918,
5080,
29918,
2962,
29918,
2230,
718,
11924,
13,
1678,
5852,
13,
1678,
9995,
13,
1678,
14385,
353,
5401,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
15562,
29889,
5847,
29897,
13,
1678,
11924,
353,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
15562,
29889,
5847,
29897,
13,
1678,
937,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
15562,
29889,
4102,
29918,
2230,
29892,
11924,
29892,
1158,
543,
27696,
1159,
13,
1678,
1833,
29918,
5080,
353,
12865,
29918,
517,
29918,
5080,
29898,
999,
29918,
2230,
29892,
15562,
29889,
4230,
29918,
2230,
29892,
11924,
29892,
1158,
543,
14939,
1159,
13,
1678,
396,
10365,
565,
727,
338,
451,
3307,
2635,
304,
4866,
278,
1833,
3474,
13,
1678,
1833,
29918,
5080,
29918,
2230,
353,
5401,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
1833,
29918,
5080,
29892,
11924,
29897,
13,
1678,
363,
4218,
297,
3464,
29898,
29906,
1125,
13,
4706,
565,
15562,
29889,
4230,
29918,
2230,
6736,
1833,
29918,
5080,
29918,
2230,
718,
14385,
29901,
13,
9651,
2867,
13,
4706,
17927,
29889,
8382,
29898,
29888,
29908,
3253,
5143,
292,
1833,
3474,
4218,
426,
1131,
3456,
718,
29871,
29896,
27195,
13,
4706,
1833,
29918,
5080,
22361,
29871,
29896,
13,
4706,
1833,
29918,
5080,
29918,
2230,
353,
5401,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
1833,
29918,
5080,
29892,
11924,
29897,
13,
1678,
565,
15562,
29889,
4230,
29918,
2230,
529,
1833,
29918,
5080,
29918,
2230,
718,
14385,
29901,
13,
4706,
12020,
7865,
2392,
703,
2525,
519,
304,
5149,
679,
278,
1833,
3474,
1159,
13,
1678,
736,
937,
29918,
5080,
29892,
1833,
29918,
5080,
13,
13,
13,
1753,
679,
29918,
5080,
29918,
27382,
29898,
13,
1678,
2143,
29918,
2230,
29901,
390,
29903,
11384,
29892,
13,
1678,
5401,
29918,
2311,
29901,
938,
29892,
13,
1678,
288,
6984,
29918,
2311,
29901,
938,
29892,
13,
1678,
18920,
29901,
5785,
29892,
13,
1678,
302,
29918,
29893,
1144,
29901,
938,
29892,
13,
1678,
2380,
29918,
10289,
29901,
938,
29892,
13,
29897,
1599,
10518,
29889,
16390,
5410,
3220,
29901,
13,
1678,
9995,
13,
1678,
3617,
3474,
1369,
3064,
13,
13,
1678,
910,
338,
263,
5407,
363,
2805,
278,
5335,
342,
15092,
363,
278,
5417,
297,
263,
8783,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2143,
29918,
2230,
584,
390,
29903,
11384,
13,
4706,
450,
3407,
931,
13,
1678,
5401,
29918,
2311,
584,
938,
13,
4706,
450,
3474,
2159,
13,
1678,
288,
6984,
29918,
2311,
584,
938,
13,
4706,
450,
25457,
2159,
13,
1678,
18920,
584,
5785,
13,
4706,
450,
23460,
10868,
13,
1678,
302,
29918,
29893,
1144,
584,
938,
13,
4706,
450,
1353,
310,
5417,
13,
1678,
2380,
29918,
10289,
584,
938,
13,
4706,
450,
2380,
9210,
515,
278,
3407,
931,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
10518,
29889,
16390,
5410,
3220,
13,
4706,
450,
1369,
3064,
310,
278,
5417,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
8653,
1053,
11701,
408,
10518,
13,
1678,
8653,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
12673,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
679,
29918,
5080,
29918,
27382,
13,
1678,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
5401,
29918,
2311,
353,
29871,
29896,
29900,
29900,
13,
1678,
8653,
288,
6984,
29918,
2311,
353,
29871,
29906,
29945,
13,
1678,
8653,
18920,
353,
29871,
29896,
29900,
13,
1678,
8653,
302,
29918,
29893,
1144,
353,
29871,
29941,
13,
1678,
8653,
2380,
29918,
10289,
353,
29871,
29946,
29947,
29900,
13,
1678,
8653,
8665,
353,
679,
29918,
5080,
29918,
27382,
29898,
999,
29918,
2230,
29892,
5401,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
18920,
29892,
302,
29918,
29893,
1144,
29892,
2380,
29918,
10289,
29897,
13,
1678,
8653,
10518,
29889,
19204,
29898,
27382,
29897,
13,
268,
29900,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29900,
29900,
29900,
13,
268,
29896,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29955,
29889,
29945,
29900,
29900,
13,
268,
29906,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29896,
29945,
29889,
29900,
29900,
29900,
13,
1678,
26688,
29901,
12865,
29953,
29946,
29961,
1983,
29962,
13,
1678,
9995,
13,
1678,
515,
620,
6765,
29889,
13445,
10335,
1053,
12865,
29918,
2378,
29918,
342,
6490,
13,
13,
1678,
11924,
353,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
18920,
29897,
13,
1678,
937,
29918,
5080,
29918,
2230,
353,
5401,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
2380,
29918,
10289,
29892,
11924,
29897,
13,
1678,
11924,
29918,
2311,
353,
5401,
29918,
2311,
448,
288,
6984,
29918,
2311,
13,
1678,
736,
12865,
29918,
2378,
29918,
342,
6490,
29898,
4102,
29918,
5080,
29918,
2230,
29892,
18920,
847,
11924,
29918,
2311,
29892,
302,
29918,
29893,
1144,
29897,
13,
13,
13,
1753,
679,
29918,
5080,
29918,
1975,
29898,
13,
1678,
8665,
29901,
10518,
29889,
16390,
5410,
3220,
29892,
13,
1678,
5401,
29918,
2311,
29901,
938,
29892,
13,
1678,
18920,
29901,
5785,
29892,
13,
29897,
1599,
10518,
29889,
16390,
5410,
3220,
29901,
13,
1678,
9995,
13,
1678,
3617,
3474,
1095,
3064,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
8665,
584,
390,
29903,
11384,
13,
4706,
450,
1369,
3064,
310,
278,
5417,
13,
1678,
5401,
29918,
2311,
584,
938,
13,
4706,
450,
3474,
2159,
13,
1678,
18920,
584,
5785,
13,
4706,
450,
23460,
10868,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
10518,
29889,
16390,
5410,
3220,
13,
4706,
450,
1095,
3064,
310,
278,
5417,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
8653,
1053,
11701,
408,
10518,
13,
1678,
8653,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
12673,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
679,
29918,
5080,
29918,
27382,
29892,
679,
29918,
5080,
29918,
1975,
13,
1678,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
1678,
8653,
5401,
29918,
2311,
353,
29871,
29896,
29900,
29900,
13,
1678,
8653,
288,
6984,
29918,
2311,
353,
29871,
29906,
29945,
13,
1678,
8653,
18920,
353,
29871,
29896,
29900,
13,
1678,
8653,
302,
29918,
29893,
1144,
353,
29871,
29941,
13,
1678,
8653,
2380,
29918,
10289,
353,
29871,
29946,
29947,
29900,
13,
1678,
8653,
8665,
353,
679,
29918,
5080,
29918,
27382,
29898,
999,
29918,
2230,
29892,
5401,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
18920,
29892,
302,
29918,
29893,
1144,
29892,
2380,
29918,
10289,
29897,
13,
1678,
8653,
10518,
29889,
19204,
29898,
27382,
29897,
13,
268,
29900,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29900,
29900,
29900,
13,
268,
29896,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29955,
29889,
29945,
29900,
29900,
13,
268,
29906,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29896,
29945,
29889,
29900,
29900,
29900,
13,
1678,
26688,
29901,
12865,
29953,
29946,
29961,
1983,
29962,
13,
1678,
8653,
10614,
353,
679,
29918,
5080,
29918,
1975,
29898,
27382,
29892,
5401,
29918,
2311,
29892,
18920,
29897,
13,
1678,
8653,
10518,
29889,
19204,
29898,
1975,
29897,
13,
268,
29900,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29929,
29889,
29929,
29900,
29900,
13,
268,
29896,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29896,
29955,
29889,
29946,
29900,
29900,
13,
268,
29906,
1678,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29906,
29946,
29889,
29929,
29900,
29900,
13,
1678,
26688,
29901,
12865,
29953,
29946,
29961,
1983,
29962,
13,
1678,
9995,
13,
1678,
736,
8665,
718,
10518,
29889,
13711,
287,
2554,
3552,
5080,
29918,
2311,
448,
29871,
29896,
29897,
334,
313,
29896,
847,
18920,
511,
376,
29879,
1159,
13,
13,
13,
1753,
679,
29918,
5080,
29918,
2371,
29898,
13,
1678,
2143,
29918,
2230,
29901,
390,
29903,
11384,
29892,
13,
1678,
15562,
29901,
3826,
326,
630,
10108,
18417,
29892,
13,
1678,
5401,
29918,
2311,
29901,
938,
29892,
13,
1678,
288,
6984,
29918,
2311,
29901,
938,
29892,
13,
29897,
1599,
10518,
29889,
17271,
29901,
13,
1678,
9995,
13,
1678,
3617,
263,
3630,
4308,
411,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
2143,
29918,
2230,
584,
390,
29903,
11384,
13,
4706,
12105,
13,
1678,
15562,
584,
3826,
326,
630,
10108,
18417,
13,
4706,
4737,
7221,
363,
278,
1602,
7715,
3233,
13,
1678,
5401,
29918,
2311,
584,
938,
13,
4706,
450,
3474,
2159,
13,
1678,
288,
6984,
29918,
2311,
584,
938,
13,
4706,
450,
25457,
2159,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
10518,
29889,
17271,
13,
4706,
319,
11701,
3630,
4308,
411,
4902,
1048,
1269,
3474,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
6317,
6492,
1057,
13,
4706,
584,
2103,
29901,
29871,
29929,
29900,
29995,
13,
13,
4706,
8653,
1053,
22889,
29889,
2272,
5317,
408,
14770,
13,
4706,
8653,
515,
620,
6765,
29889,
7099,
6490,
1053,
3826,
326,
630,
10108,
18417,
13,
4706,
8653,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
12673,
29892,
304,
29918,
9346,
287,
2554,
13,
4706,
8653,
515,
620,
6765,
29889,
7165,
1053,
679,
29918,
5080,
29918,
2371,
13,
4706,
8653,
2143,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
4706,
8653,
18920,
353,
29871,
29896,
29900,
13,
4706,
8653,
302,
29918,
27736,
353,
29871,
29896,
29900,
29900,
29900,
13,
4706,
8653,
937,
29918,
2230,
353,
304,
29918,
12673,
703,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29900,
1159,
13,
4706,
8653,
1833,
29918,
2230,
353,
937,
29918,
2230,
718,
304,
29918,
9346,
287,
2554,
3552,
29876,
29918,
27736,
29899,
29896,
6802,
5847,
29897,
13,
4706,
8653,
15562,
353,
3826,
326,
630,
10108,
18417,
29898,
5847,
29922,
29896,
29900,
29892,
302,
29918,
27736,
29922,
29896,
29900,
29900,
29900,
29892,
937,
29918,
2230,
29922,
4102,
29918,
2230,
29892,
1833,
29918,
2230,
29922,
4230,
29918,
2230,
29897,
13,
4706,
8653,
1596,
29898,
19635,
29889,
5847,
29892,
15562,
29889,
4102,
29918,
2230,
29892,
15562,
29889,
4230,
29918,
2230,
29897,
13,
308,
29896,
29900,
29889,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29941,
29929,
29889,
29929,
13,
4706,
8653,
5401,
29918,
2311,
353,
29871,
29896,
29900,
29900,
13,
4706,
8653,
288,
6984,
29918,
2311,
353,
29871,
29906,
29945,
13,
4706,
8653,
4489,
353,
679,
29918,
5080,
29918,
2371,
29898,
999,
29918,
2230,
29892,
15562,
29892,
5401,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29897,
13,
4706,
8653,
1596,
29898,
2176,
29889,
517,
29918,
1807,
3101,
13,
9651,
5534,
29871,
1887,
29871,
515,
29918,
11249,
29871,
304,
29918,
11249,
1669,
5401,
29918,
2962,
462,
5401,
29918,
355,
13,
308,
29900,
539,
29946,
29947,
29900,
539,
29900,
632,
29900,
3986,
29929,
29929,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29900,
29889,
29900,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29929,
29889,
29929,
29900,
29900,
13,
308,
29896,
539,
29946,
29947,
29896,
539,
29896,
9651,
29955,
29945,
308,
29896,
29955,
29946,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29900,
29955,
29889,
29945,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29896,
29955,
29889,
29946,
29900,
29900,
13,
308,
29906,
539,
29946,
29947,
29906,
539,
29906,
965,
29896,
29945,
29900,
308,
29906,
29946,
29929,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29896,
29945,
29889,
29900,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29906,
29946,
29889,
29929,
29900,
29900,
13,
308,
29941,
539,
29946,
29947,
29941,
539,
29941,
965,
29906,
29906,
29945,
308,
29941,
29906,
29946,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29906,
29906,
29889,
29945,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29941,
29906,
29889,
29946,
29900,
29900,
13,
308,
29946,
539,
29946,
29947,
29946,
539,
29946,
965,
29941,
29900,
29900,
308,
29941,
29929,
29929,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29941,
29900,
29889,
29900,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29941,
29929,
29889,
29929,
29900,
29900,
13,
308,
29945,
539,
29946,
29947,
29945,
539,
29945,
965,
29941,
29955,
29945,
308,
29946,
29955,
29946,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29941,
29955,
29889,
29945,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29946,
29955,
29889,
29946,
29900,
29900,
13,
308,
29953,
539,
29946,
29947,
29953,
539,
29953,
965,
29946,
29945,
29900,
308,
29945,
29946,
29929,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29946,
29945,
29889,
29900,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29945,
29946,
29889,
29929,
29900,
29900,
13,
308,
29955,
539,
29946,
29947,
29955,
539,
29955,
965,
29945,
29906,
29945,
308,
29953,
29906,
29946,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29900,
29901,
29945,
29906,
29889,
29945,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29900,
29906,
29889,
29946,
29900,
29900,
13,
308,
29947,
539,
29946,
29947,
29947,
539,
29947,
965,
29953,
29900,
29900,
308,
29953,
29929,
29929,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29900,
29900,
29889,
29900,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29900,
29929,
29889,
29929,
29900,
29900,
13,
308,
29929,
539,
29946,
29947,
29929,
539,
29929,
965,
29953,
29955,
29945,
308,
29955,
29955,
29946,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29900,
29955,
29889,
29945,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29896,
29955,
29889,
29946,
29900,
29900,
13,
308,
29896,
29900,
418,
29946,
29929,
29900,
418,
29896,
29900,
965,
29955,
29945,
29900,
308,
29947,
29946,
29929,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29896,
29945,
29889,
29900,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29906,
29946,
29889,
29929,
29900,
29900,
13,
308,
29896,
29896,
418,
29946,
29929,
29896,
418,
29896,
29896,
965,
29947,
29906,
29945,
308,
29929,
29906,
29946,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29906,
29906,
29889,
29945,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29941,
29906,
29889,
29946,
29900,
29900,
13,
308,
29896,
29906,
418,
29946,
29929,
29906,
418,
29896,
29906,
965,
29929,
29900,
29900,
308,
29929,
29929,
29929,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29941,
29900,
29889,
29900,
29900,
29900,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29896,
29901,
29900,
29896,
29901,
29941,
29929,
29889,
29929,
29900,
29900,
13,
13,
4706,
18399,
4832,
5417,
304,
28475,
278,
25457,
13,
13,
4706,
8653,
14770,
29889,
4532,
29898,
1003,
2311,
7607,
29947,
29892,
29871,
29941,
876,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
4706,
8653,
363,
22645,
29892,
1948,
297,
4489,
29889,
1524,
5727,
7295,
13,
4706,
2023,
268,
2927,
353,
376,
1127,
29908,
565,
22645,
29995,
29906,
1275,
29871,
29900,
1683,
376,
9539,
29908,
13,
4706,
2023,
268,
14770,
29889,
1165,
29894,
9653,
29898,
798,
29889,
2029,
3366,
5080,
29918,
2962,
12436,
1948,
29889,
2029,
3366,
5080,
29918,
355,
12436,
15595,
29922,
29900,
29889,
29945,
29892,
2927,
29922,
2780,
29897,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
4706,
2023,
268,
565,
22645,
1405,
29871,
29945,
29901,
13,
4706,
2023,
308,
2867,
13,
4706,
8653,
14770,
29889,
29873,
523,
29918,
2680,
580,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
4706,
8653,
14770,
29889,
4294,
580,
396,
437,
312,
342,
29901,
718,
16033,
5690,
13,
1678,
9995,
13,
1678,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
29876,
29918,
27736,
29892,
12865,
29918,
2378,
29918,
342,
6490,
13,
13,
1678,
11924,
29918,
2311,
353,
5401,
29918,
2311,
448,
288,
6984,
29918,
2311,
13,
1678,
11924,
353,
5528,
29918,
19708,
29898,
5080,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29892,
15562,
29889,
5847,
29897,
13,
1678,
18920,
353,
15562,
29889,
5847,
13,
1678,
937,
29918,
2230,
353,
15562,
29889,
4102,
29918,
2230,
13,
13,
1678,
937,
29918,
5080,
29892,
1833,
29918,
5080,
353,
679,
29918,
4102,
29918,
392,
29918,
4230,
29918,
5080,
29898,
13,
4706,
2143,
29918,
2230,
29892,
15562,
29892,
5401,
29918,
2311,
29892,
288,
6984,
29918,
2311,
13,
1678,
1723,
13,
1678,
937,
29918,
5080,
29918,
2230,
353,
5401,
29918,
517,
29918,
12673,
29898,
999,
29918,
2230,
29892,
937,
29918,
5080,
29892,
11924,
29897,
13,
1678,
302,
29918,
29893,
1144,
353,
1833,
29918,
5080,
448,
937,
29918,
5080,
718,
29871,
29896,
13,
1678,
1887,
29918,
29893,
1144,
353,
7442,
29889,
279,
927,
29898,
29876,
29918,
29893,
1144,
467,
579,
668,
29898,
524,
29897,
13,
1678,
396,
11916,
448,
671,
278,
11904,
1244,
304,
4772,
263,
6434,
988,
372,
338,
28240,
701,
13,
1678,
396,
322,
769,
727,
526,
1663,
29884,
4543,
11916,
13,
1678,
937,
29918,
11249,
353,
304,
29918,
29876,
29918,
27736,
29898,
4102,
29918,
5080,
29918,
2230,
448,
937,
29918,
2230,
29892,
18920,
29892,
1158,
543,
14939,
1159,
448,
29871,
29896,
13,
1678,
8665,
353,
12865,
29918,
2378,
29918,
342,
6490,
29898,
4102,
29918,
5080,
29918,
2230,
29892,
18920,
847,
11924,
29918,
2311,
29892,
302,
29918,
29893,
1144,
29897,
13,
1678,
10614,
353,
679,
29918,
5080,
29918,
1975,
29898,
27382,
29892,
5401,
29918,
2311,
29892,
18920,
29897,
13,
1678,
4489,
29918,
8977,
353,
426,
13,
4706,
376,
10945,
1115,
7442,
29889,
279,
927,
29898,
4102,
29918,
5080,
29892,
1833,
29918,
5080,
718,
29871,
29896,
511,
13,
4706,
376,
2997,
1115,
1887,
29918,
29893,
1144,
29892,
13,
4706,
376,
3166,
29918,
11249,
1115,
937,
29918,
11249,
718,
313,
2997,
29918,
29893,
1144,
334,
11924,
29918,
2311,
511,
13,
4706,
376,
517,
29918,
11249,
1115,
937,
29918,
11249,
718,
5401,
29918,
2311,
448,
29871,
29896,
718,
313,
2997,
29918,
29893,
1144,
334,
11924,
29918,
2311,
511,
13,
4706,
376,
5080,
29918,
2962,
1115,
8665,
29892,
13,
4706,
376,
5080,
29918,
355,
1115,
10614,
29892,
13,
1678,
500,
13,
1678,
736,
10518,
29889,
17271,
29898,
1272,
29922,
2176,
29918,
8977,
29897,
13,
13,
13,
1990,
18379,
11507,
29898,
1666,
6765,
3195,
1125,
13,
1678,
9995,
13,
1678,
18379,
292,
4128,
639,
1602,
7715,
3233,
13,
13,
1678,
18379,
292,
4128,
526,
278,
3474,
322,
25457,
2159,
363,
1269,
1602,
7715,
13,
1678,
3233,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
302,
29918,
5563,
29879,
584,
938,
13,
4706,
450,
1353,
310,
1602,
7715,
11174,
13,
1678,
1375,
29918,
29876,
29918,
29893,
1144,
584,
938,
13,
4706,
3080,
12539,
1353,
310,
5417,
13,
1678,
5401,
29918,
29879,
7093,
584,
2391,
29961,
524,
29962,
13,
4706,
450,
3474,
15786,
639,
1602,
7715,
3233,
13,
1678,
288,
6984,
29918,
29879,
7093,
584,
2391,
29961,
524,
29962,
13,
4706,
450,
25457,
15786,
639,
1602,
7715,
3233,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
3251,
403,
1602,
7715,
322,
3474,
292,
4128,
363,
848,
4559,
29881,
472,
29871,
29946,
29900,
29929,
29953,
379,
29920,
29889,
13,
1678,
3940,
393,
2009,
292,
3474,
15786,
470,
25457,
15786,
363,
1602,
7715,
11174,
13,
1678,
393,
437,
451,
1863,
674,
12020,
263,
7865,
2392,
29889,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
7099,
6490,
1053,
3826,
7715,
26947,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
18379,
26947,
13,
1678,
8653,
1602,
29918,
14669,
353,
3826,
7715,
26947,
29898,
29876,
29918,
5563,
29879,
29922,
29941,
29892,
639,
29918,
5563,
29922,
29941,
29897,
13,
1678,
8653,
1602,
29918,
7529,
353,
1602,
29918,
14669,
29889,
3389,
29898,
29946,
29900,
29929,
29953,
29897,
13,
1678,
8653,
1602,
29918,
7529,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
5847,
2396,
29871,
29946,
29900,
29929,
29953,
29889,
29900,
29892,
13,
4706,
525,
29876,
29918,
5563,
29879,
2396,
29871,
29941,
29892,
13,
4706,
525,
546,
29918,
5563,
2396,
29871,
29941,
29892,
13,
4706,
525,
1195,
29918,
27736,
2396,
29871,
29906,
29945,
29953,
29892,
13,
4706,
525,
14513,
29918,
29888,
7971,
29879,
2396,
518,
13,
632,
29896,
29900,
29906,
29946,
29889,
29900,
29892,
13,
632,
29955,
29906,
29946,
29889,
29900,
29955,
29955,
29941,
29946,
29941,
29929,
29941,
29945,
29900,
29906,
29946,
29953,
29892,
13,
632,
29945,
29896,
29906,
29889,
29900,
29892,
13,
632,
29941,
29953,
29906,
29889,
29900,
29941,
29947,
29953,
29955,
29896,
29929,
29953,
29955,
29945,
29896,
29906,
29941,
29892,
13,
632,
29906,
29945,
29953,
29889,
29900,
29892,
13,
632,
29896,
29947,
29896,
29889,
29900,
29896,
29929,
29941,
29941,
29945,
29929,
29947,
29941,
29955,
29945,
29953,
29896,
29945,
29892,
13,
632,
29896,
29906,
29947,
29889,
29900,
29892,
13,
632,
29929,
29900,
29889,
29945,
29900,
29929,
29953,
29953,
29955,
29929,
29929,
29896,
29947,
29955,
29947,
29900,
29947,
29892,
13,
632,
29953,
29946,
29889,
29900,
13,
4706,
21251,
13,
4706,
525,
7099,
29918,
17028,
943,
2396,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29947,
1402,
13,
4706,
525,
7099,
29918,
262,
1037,
1860,
2396,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29946,
1402,
13,
4706,
525,
7099,
29918,
5847,
2396,
518,
29946,
29900,
29929,
29953,
29889,
29900,
29892,
29871,
29906,
29900,
29946,
29947,
29889,
29900,
29892,
29871,
29945,
29896,
29906,
29889,
29900,
29962,
13,
1678,
500,
13,
1678,
8653,
5401,
29918,
7529,
353,
18379,
26947,
2141,
3389,
29898,
7099,
29918,
7529,
29889,
29876,
29918,
5563,
29879,
29892,
1602,
29918,
7529,
29889,
7099,
29918,
5847,
29897,
13,
1678,
8653,
5401,
29918,
7529,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
29876,
29918,
5563,
29879,
2396,
29871,
29941,
29892,
13,
4706,
525,
1195,
29918,
29876,
29918,
29893,
1144,
2396,
29871,
29945,
29892,
13,
4706,
525,
5080,
29918,
29879,
7093,
2396,
518,
29896,
29900,
29906,
29946,
29892,
29871,
29945,
29896,
29906,
29892,
29871,
29896,
29906,
29947,
1402,
13,
4706,
525,
324,
481,
29918,
29879,
7093,
2396,
518,
29906,
29945,
29953,
29892,
29871,
29896,
29906,
29947,
29892,
29871,
29941,
29906,
29962,
13,
1678,
500,
13,
1678,
8653,
5401,
29918,
7529,
29889,
657,
29918,
5080,
29918,
2311,
29898,
29900,
29897,
13,
268,
29896,
29900,
29906,
29946,
13,
1678,
8653,
5401,
29918,
7529,
29889,
657,
29918,
324,
481,
29918,
2311,
29898,
29900,
29897,
13,
268,
29906,
29945,
29953,
13,
1678,
8653,
5401,
29918,
7529,
29889,
657,
29918,
324,
481,
29918,
2311,
29898,
29941,
29897,
13,
1678,
29243,
313,
3242,
7786,
1246,
1833,
1125,
13,
1678,
2023,
13,
1678,
7865,
2392,
29901,
21597,
29871,
29941,
1818,
367,
29871,
29900,
5277,
3233,
529,
29871,
29941,
13,
1678,
9995,
13,
13,
1678,
302,
29918,
5563,
29879,
29901,
938,
13,
1678,
1375,
29918,
29876,
29918,
29893,
1144,
29901,
938,
13,
1678,
5401,
29918,
29879,
7093,
29901,
2391,
29961,
524,
29962,
13,
1678,
288,
6984,
29918,
29879,
7093,
29901,
2391,
29961,
524,
29962,
13,
13,
1678,
822,
1423,
29918,
5563,
29898,
1311,
29892,
3233,
29901,
938,
1125,
13,
4706,
9995,
5596,
278,
1602,
7715,
3233,
338,
2629,
3464,
15945,
29908,
13,
4706,
565,
3233,
529,
29871,
29900,
470,
3233,
6736,
1583,
29889,
29876,
29918,
5563,
29879,
29901,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29908,
10108,
426,
5563,
29913,
1818,
367,
29871,
29900,
5277,
3233,
529,
426,
1311,
29889,
29876,
29918,
5563,
29879,
27195,
13,
13,
1678,
822,
679,
29918,
5080,
29918,
2311,
29898,
1311,
29892,
3233,
29901,
938,
29897,
1599,
938,
29901,
13,
4706,
9995,
2577,
3474,
2159,
363,
263,
1602,
7715,
3233,
15945,
29908,
13,
4706,
1583,
29889,
3198,
29918,
5563,
29898,
5563,
29897,
13,
4706,
736,
1583,
29889,
5080,
29918,
29879,
7093,
29961,
5563,
29962,
13,
13,
1678,
822,
679,
29918,
324,
481,
29918,
2311,
29898,
1311,
29892,
3233,
29901,
938,
29897,
1599,
938,
29901,
13,
4706,
9995,
2577,
25457,
2159,
363,
263,
1602,
7715,
3233,
15945,
29908,
13,
4706,
1583,
29889,
3198,
29918,
5563,
29898,
5563,
29897,
13,
4706,
736,
1583,
29889,
324,
481,
29918,
29879,
7093,
29961,
5563,
29962,
13,
13,
13,
1990,
18379,
26947,
29898,
1666,
6765,
7032,
1125,
13,
1678,
9995,
13,
1678,
3789,
786,
18379,
11507,
13,
13,
1678,
18379,
26947,
14391,
278,
18379,
11507,
304,
671,
363,
3474,
292,
1602,
326,
630,
13,
1678,
931,
848,
29889,
13,
13,
1678,
18379,
4128,
526,
3763,
278,
3474,
322,
25457,
15786,
363,
1269,
13,
1678,
1602,
7715,
3233,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
1375,
29918,
2311,
584,
938,
29892,
13136,
13,
4706,
3080,
12539,
3474,
2159,
29892,
491,
2322,
29871,
29896,
29906,
29947,
13,
1678,
1375,
29918,
324,
481,
584,
938,
29892,
13136,
13,
4706,
3080,
12539,
25457,
2159,
29892,
491,
2322,
29871,
29941,
29906,
13,
1678,
5401,
29918,
19790,
584,
938,
29892,
13136,
13,
4706,
18379,
7329,
29892,
491,
2322,
29871,
29946,
29889,
18379,
15786,
526,
12833,
491,
23460,
13,
4706,
10868,
847,
29871,
29946,
304,
9801,
8002,
10868,
10104,
29889,
960,
278,
13,
4706,
23460,
10868,
338,
2319,
29892,
3474,
2159,
674,
367,
10365,
287,
304,
13,
4706,
1375,
29918,
2311,
13,
1678,
288,
6984,
29918,
771,
637,
291,
584,
5785,
29892,
13136,
13,
4706,
450,
18618,
310,
278,
3474,
2159,
304,
671,
408,
278,
25457,
29892,
491,
2322,
13,
308,
29900,
29889,
29906,
29945,
29889,
1152,
1342,
29892,
363,
263,
3474,
2159,
310,
29871,
29896,
29906,
29947,
29892,
278,
25457,
723,
367,
13,
308,
29900,
29889,
29906,
29945,
334,
29871,
29896,
29906,
29947,
353,
29871,
29941,
29906,
13,
1678,
1375,
29918,
29876,
29918,
29893,
1144,
584,
938,
29892,
13136,
13,
4706,
450,
9212,
1353,
310,
5417,
4312,
297,
263,
1602,
7715,
3233,
29892,
491,
13,
4706,
2322,
29871,
29945,
13,
1678,
5401,
29918,
29879,
7093,
584,
28379,
29961,
1293,
29961,
524,
20526,
13136,
13,
4706,
12027,
4019,
4529,
3474,
15786,
29892,
491,
2322,
6213,
29889,
19928,
505,
278,
1021,
13,
4706,
3309,
408,
1353,
310,
1602,
7715,
11174,
13,
1678,
288,
6984,
29918,
29879,
7093,
584,
28379,
29961,
1293,
29961,
524,
20526,
13136,
13,
4706,
12027,
4019,
368,
4529,
25457,
15786,
29892,
491,
2322,
6213,
29889,
19928,
505,
278,
1021,
13,
4706,
3309,
408,
1353,
310,
1602,
7715,
11174,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
3251,
403,
1602,
7715,
322,
3474,
292,
4128,
363,
848,
4559,
29881,
472,
29871,
29900,
29889,
29900,
29945,
379,
29920,
470,
13,
268,
29906,
29900,
6923,
23460,
3785,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
7099,
6490,
1053,
3826,
7715,
26947,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
18379,
26947,
13,
1678,
8653,
1602,
29918,
7529,
353,
3826,
7715,
26947,
29898,
29876,
29918,
5563,
29879,
29922,
29941,
29892,
639,
29918,
5563,
29922,
29941,
467,
3389,
29898,
29900,
29889,
29900,
29945,
29897,
13,
1678,
8653,
1602,
29918,
7529,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
5847,
2396,
29871,
29900,
29889,
29900,
29945,
29892,
13,
4706,
525,
29876,
29918,
5563,
29879,
2396,
29871,
29941,
29892,
13,
4706,
525,
546,
29918,
5563,
2396,
29871,
29941,
29892,
13,
4706,
525,
1195,
29918,
27736,
2396,
29871,
29906,
29945,
29953,
29892,
13,
4706,
525,
14513,
29918,
29888,
7971,
29879,
2396,
518,
13,
632,
29900,
29889,
29900,
29896,
29906,
29945,
29892,
13,
632,
29900,
29889,
29900,
29900,
29947,
29947,
29941,
29947,
29947,
29941,
29946,
29955,
29953,
29946,
29947,
29941,
29896,
29947,
29946,
29946,
29892,
13,
632,
29900,
29889,
29900,
29900,
29953,
29906,
29945,
29892,
13,
632,
29900,
29889,
29900,
29900,
29946,
29946,
29896,
29929,
29946,
29896,
29955,
29941,
29947,
29906,
29946,
29896,
29945,
29929,
29906,
29906,
29892,
13,
632,
29900,
29889,
29900,
29900,
29941,
29896,
29906,
29945,
29892,
13,
632,
29900,
29889,
29900,
29900,
29906,
29906,
29900,
29929,
29955,
29900,
29947,
29953,
29929,
29896,
29906,
29900,
29955,
29929,
29953,
29896,
29892,
13,
632,
29900,
29889,
29900,
29900,
29896,
29945,
29953,
29906,
29945,
29892,
13,
632,
29900,
29889,
29900,
29900,
29896,
29896,
29900,
29946,
29947,
29945,
29946,
29941,
29946,
29945,
29953,
29900,
29941,
29929,
29947,
29900,
29945,
29892,
13,
632,
29900,
29889,
29900,
29900,
29900,
29955,
29947,
29896,
29906,
29945,
13,
4706,
21251,
13,
4706,
525,
7099,
29918,
17028,
943,
2396,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29947,
1402,
13,
4706,
525,
7099,
29918,
262,
1037,
1860,
2396,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29946,
1402,
13,
4706,
525,
7099,
29918,
5847,
2396,
518,
29900,
29889,
29900,
29945,
29892,
29871,
29900,
29889,
29900,
29906,
29945,
29892,
29871,
29900,
29889,
29900,
29900,
29953,
29906,
29945,
29962,
13,
1678,
500,
13,
1678,
8653,
5401,
29918,
7529,
353,
18379,
26947,
2141,
3389,
29898,
7099,
29918,
7529,
29889,
29876,
29918,
5563,
29879,
29892,
1602,
29918,
7529,
29889,
7099,
29918,
5847,
29897,
13,
1678,
8653,
5401,
29918,
7529,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
29876,
29918,
5563,
29879,
2396,
29871,
29941,
29892,
13,
4706,
525,
1195,
29918,
29876,
29918,
29893,
1144,
2396,
29871,
29945,
29892,
13,
4706,
525,
5080,
29918,
29879,
7093,
2396,
518,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
1402,
13,
4706,
525,
324,
481,
29918,
29879,
7093,
2396,
518,
29941,
29906,
29892,
29871,
29941,
29906,
29892,
29871,
29941,
29906,
29962,
13,
1678,
500,
13,
13,
1678,
18379,
4128,
508,
884,
367,
9479,
3342,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
7099,
6490,
1053,
3826,
7715,
26947,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
18379,
26947,
13,
1678,
8653,
1602,
29918,
14669,
353,
3826,
7715,
26947,
29898,
29876,
29918,
5563,
29879,
29922,
29941,
29892,
639,
29918,
5563,
29922,
29941,
29897,
13,
1678,
8653,
1602,
29918,
7529,
353,
1602,
29918,
14669,
29889,
3389,
29898,
29900,
29889,
29900,
29945,
29897,
13,
1678,
8653,
5401,
29918,
14669,
353,
18379,
26947,
29898,
5080,
29918,
29879,
7093,
11759,
29896,
29900,
29900,
29900,
29892,
29871,
29945,
29955,
29947,
29892,
29871,
29896,
29900,
29946,
2314,
13,
1678,
8653,
5401,
29918,
7529,
353,
5401,
29918,
14669,
29889,
3389,
29898,
7099,
29918,
7529,
29889,
29876,
29918,
5563,
29879,
29892,
1602,
29918,
7529,
29889,
7099,
29918,
5847,
29897,
13,
1678,
8653,
5401,
29918,
7529,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
29876,
29918,
5563,
29879,
2396,
29871,
29941,
29892,
13,
4706,
525,
1195,
29918,
29876,
29918,
29893,
1144,
2396,
29871,
29945,
29892,
13,
4706,
525,
5080,
29918,
29879,
7093,
2396,
518,
29896,
29900,
29900,
29900,
29892,
29871,
29945,
29955,
29947,
29892,
29871,
29896,
29900,
29946,
1402,
13,
4706,
525,
324,
481,
29918,
29879,
7093,
2396,
518,
29906,
29945,
29900,
29892,
29871,
29896,
29946,
29946,
29892,
29871,
29941,
29906,
29962,
13,
1678,
500,
13,
1678,
9995,
13,
13,
1678,
1375,
29918,
2311,
29901,
938,
353,
29871,
29896,
29906,
29947,
13,
1678,
1375,
29918,
324,
481,
29901,
938,
353,
29871,
29941,
29906,
13,
1678,
5401,
29918,
19790,
29901,
938,
353,
29871,
29946,
13,
1678,
288,
6984,
29918,
771,
637,
291,
29901,
5785,
353,
29871,
29900,
29889,
29906,
29945,
13,
1678,
1375,
29918,
29876,
29918,
29893,
1144,
29901,
938,
353,
29871,
29945,
13,
1678,
5401,
29918,
29879,
7093,
29901,
28379,
29961,
1293,
29961,
524,
5262,
353,
6213,
13,
1678,
288,
6984,
29918,
29879,
7093,
29901,
28379,
29961,
1293,
29961,
524,
5262,
353,
6213,
13,
13,
1678,
822,
1065,
29898,
1311,
29892,
302,
29918,
5563,
29879,
29901,
938,
29892,
1602,
29918,
5847,
29901,
2391,
29961,
7411,
2314,
1599,
18379,
11507,
29901,
13,
4706,
9995,
13,
4706,
20535,
403,
3474,
322,
25457,
15786,
363,
1269,
1602,
7715,
3233,
2729,
373,
13,
4706,
1602,
7715,
3233,
23460,
10868,
322,
9212,
2758,
519,
4128,
13,
13,
4706,
450,
3474,
322,
25457,
15786,
313,
4537,
310,
11916,
29897,
526,
12833,
2729,
297,
13,
4706,
278,
1494,
982,
29901,
13,
13,
4706,
448,
3474,
2159,
353,
10868,
472,
1602,
7715,
3233,
847,
3474,
7329,
13,
4706,
448,
25457,
2159,
353,
3474,
2159,
334,
25457,
18618,
13,
13,
4706,
910,
338,
304,
9801,
1781,
10868,
10104,
472,
1880,
29511,
29889,
2180,
4482,
13,
4706,
23460,
29511,
29892,
445,
723,
1121,
297,
1407,
2319,
3474,
15786,
29892,
13,
4706,
5480,
29892,
727,
263,
9212,
2758,
519,
15786,
363,
1716,
5417,
322,
25457,
13,
4706,
3342,
491,
1375,
29918,
2311,
322,
1375,
29918,
324,
481,
297,
278,
2847,
7608,
29889,
960,
3474,
15786,
13,
4706,
470,
975,
14128,
2159,
526,
12833,
2400,
1438,
620,
3135,
277,
3598,
29892,
896,
674,
367,
13,
4706,
731,
304,
278,
9212,
1819,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
302,
29918,
5563,
29879,
584,
938,
13,
9651,
450,
1353,
310,
1602,
7715,
11174,
13,
4706,
1602,
29918,
5847,
584,
2391,
29961,
7411,
29962,
13,
9651,
450,
23460,
29511,
363,
1269,
1602,
7715,
3233,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
18379,
11507,
13,
9651,
450,
3474,
4128,
29892,
278,
3474,
15786,
322,
975,
14128,
363,
1269,
13,
9651,
1602,
7715,
3233,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
7865,
2392,
13,
9651,
960,
278,
1353,
310,
5417,
947,
451,
1993,
278,
1353,
310,
11174,
13,
4706,
7865,
2392,
13,
9651,
960,
278,
1353,
310,
975,
14128,
947,
451,
1993,
278,
1353,
310,
11174,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
5080,
29918,
29879,
7093,
338,
6213,
29901,
13,
9651,
5401,
29918,
29879,
7093,
353,
1583,
3032,
657,
29918,
5080,
29918,
29879,
7093,
29898,
29876,
29918,
5563,
29879,
29892,
1602,
29918,
5847,
29897,
13,
4706,
1683,
29901,
13,
9651,
5401,
29918,
29879,
7093,
353,
1051,
29898,
1311,
29889,
5080,
29918,
29879,
7093,
29897,
13,
13,
4706,
565,
7431,
29898,
5080,
29918,
29879,
7093,
29897,
529,
302,
29918,
5563,
29879,
29901,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29908,
8009,
29889,
5417,
426,
2435,
29898,
5080,
29918,
29879,
7093,
2915,
529,
302,
29918,
5563,
29879,
426,
29876,
29918,
5563,
29879,
27195,
13,
4706,
565,
7431,
29898,
5080,
29918,
29879,
7093,
29897,
1405,
302,
29918,
5563,
29879,
29901,
13,
9651,
396,
445,
1122,
3799,
411,
1404,
1881,
5417,
13,
9651,
396,
541,
1602,
326,
630,
848,
756,
28145,
11174,
13,
9651,
5401,
29918,
29879,
7093,
353,
5401,
29918,
29879,
7093,
7503,
29876,
29918,
5563,
29879,
29962,
13,
13,
4706,
565,
1583,
29889,
324,
481,
29918,
29879,
7093,
338,
6213,
29901,
13,
9651,
288,
6984,
29918,
29879,
7093,
353,
1583,
3032,
657,
29918,
324,
481,
29918,
29879,
7093,
29898,
5080,
29918,
29879,
7093,
29897,
13,
4706,
1683,
29901,
13,
9651,
288,
6984,
29918,
29879,
7093,
353,
1583,
29889,
324,
481,
29918,
29879,
7093,
13,
13,
4706,
565,
7431,
29898,
324,
481,
29918,
29879,
7093,
29897,
529,
302,
29918,
5563,
29879,
29901,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29908,
8009,
29889,
975,
14128,
426,
2435,
29898,
324,
481,
29918,
29879,
7093,
2915,
529,
302,
29918,
5563,
29879,
426,
29876,
29918,
5563,
29879,
27195,
13,
4706,
565,
7431,
29898,
324,
481,
29918,
29879,
7093,
29897,
1405,
302,
29918,
5563,
29879,
29901,
13,
9651,
396,
445,
1122,
3799,
411,
1404,
1881,
5417,
13,
9651,
396,
541,
1602,
326,
630,
848,
756,
28145,
11174,
13,
9651,
288,
6984,
29918,
29879,
7093,
353,
288,
6984,
29918,
29879,
7093,
7503,
29876,
29918,
5563,
29879,
29962,
13,
13,
4706,
736,
18379,
11507,
29898,
13,
9651,
302,
29918,
5563,
29879,
29922,
29876,
29918,
5563,
29879,
29892,
13,
9651,
1375,
29918,
29876,
29918,
29893,
1144,
29922,
1311,
29889,
1195,
29918,
29876,
29918,
29893,
1144,
29892,
13,
9651,
5401,
29918,
29879,
7093,
29922,
5080,
29918,
29879,
7093,
29892,
13,
9651,
288,
6984,
29918,
29879,
7093,
29922,
324,
481,
29918,
29879,
7093,
29892,
13,
4706,
1723,
13,
13,
1678,
822,
903,
657,
29918,
5080,
29918,
29879,
7093,
29898,
1311,
29892,
302,
29918,
5563,
29879,
29901,
938,
29892,
1602,
29918,
5847,
29901,
2391,
29961,
7411,
2314,
1599,
2391,
29961,
524,
5387,
13,
4706,
9995,
13,
4706,
3617,
278,
3474,
15786,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
302,
29918,
5563,
29879,
584,
938,
13,
9651,
450,
1353,
310,
1602,
7715,
11174,
13,
4706,
1602,
29918,
5847,
584,
2391,
29961,
7411,
29962,
13,
9651,
450,
23460,
29511,
363,
1269,
1602,
7715,
3233,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
2391,
29961,
524,
29962,
13,
9651,
18379,
15786,
13,
4706,
9995,
13,
4706,
5401,
29918,
29879,
7093,
353,
5159,
13,
4706,
363,
474,
5563,
297,
3464,
29898,
29876,
29918,
5563,
29879,
1125,
13,
9651,
5401,
29918,
2311,
353,
1602,
29918,
5847,
29961,
488,
955,
29962,
849,
1583,
29889,
5080,
29918,
19790,
13,
9651,
565,
5401,
29918,
2311,
529,
1583,
29889,
1195,
29918,
2311,
29901,
13,
18884,
5401,
29918,
2311,
353,
1583,
29889,
1195,
29918,
2311,
13,
9651,
5401,
29918,
29879,
7093,
29889,
4397,
29898,
524,
29898,
5080,
29918,
2311,
876,
13,
4706,
736,
5401,
29918,
29879,
7093,
13,
13,
1678,
822,
903,
657,
29918,
324,
481,
29918,
29879,
7093,
29898,
1311,
29892,
5401,
29918,
29879,
7093,
29901,
2391,
29961,
524,
2314,
1599,
2391,
29961,
524,
5387,
13,
4706,
9995,
13,
4706,
3617,
25457,
15786,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
5401,
29918,
29879,
7093,
584,
2391,
29961,
524,
29962,
13,
9651,
450,
3474,
15786,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
2391,
29961,
524,
29962,
13,
9651,
450,
25457,
15786,
13,
4706,
9995,
13,
4706,
288,
6984,
29918,
29879,
7093,
353,
5159,
13,
4706,
363,
5401,
29918,
2311,
297,
5401,
29918,
29879,
7093,
29901,
13,
9651,
288,
6984,
29918,
2311,
353,
938,
29898,
5080,
29918,
2311,
334,
1583,
29889,
324,
481,
29918,
771,
637,
291,
29897,
13,
9651,
565,
288,
6984,
29918,
2311,
529,
1583,
29889,
1195,
29918,
324,
481,
29901,
13,
18884,
288,
6984,
29918,
2311,
353,
1583,
29889,
1195,
29918,
324,
481,
13,
9651,
288,
6984,
29918,
29879,
7093,
29889,
4397,
29898,
324,
481,
29918,
2311,
29897,
13,
4706,
736,
288,
6984,
29918,
29879,
7093,
13,
13,
13,
1990,
18379,
287,
10108,
18417,
29898,
18417,
1125,
13,
1678,
9995,
18417,
363,
263,
3474,
287,
3233,
15945,
29908,
13,
13,
1678,
18920,
29901,
5785,
13,
1678,
9995,
1576,
23460,
10868,
363,
278,
1602,
7715,
3233,
15945,
29908,
13,
1678,
302,
29918,
29893,
1144,
29901,
938,
13,
1678,
9995,
1576,
1353,
310,
5417,
15945,
29908,
13,
1678,
5401,
29918,
2311,
29901,
10321,
3321,
2928,
13,
1678,
9995,
1576,
3474,
2159,
297,
11916,
15945,
29908,
13,
1678,
288,
6984,
29918,
2311,
29901,
10321,
3321,
2928,
13,
1678,
9995,
1576,
25457,
2159,
297,
11916,
15945,
29908,
13,
1678,
2380,
29918,
10289,
29901,
938,
13,
1678,
9995,
1576,
5534,
3474,
9210,
363,
1887,
3474,
29871,
29900,
15945,
29908,
13,
13,
1678,
732,
6799,
13,
1678,
822,
11636,
29898,
1311,
1125,
13,
4706,
736,
29871,
29896,
847,
1583,
29889,
5847,
13,
13,
13,
1990,
18379,
287,
18417,
29898,
6113,
519,
18417,
1125,
13,
1678,
9995,
18417,
363,
3474,
287,
848,
15945,
29908,
13,
13,
1678,
18920,
29901,
2391,
29961,
7411,
29962,
13,
1678,
521,
550,
29901,
2391,
29961,
710,
29962,
13,
1678,
302,
29918,
305,
550,
29901,
28379,
29961,
524,
29962,
353,
6213,
13,
1678,
302,
29918,
5563,
29879,
29901,
938,
13,
1678,
937,
29918,
2230,
29901,
5057,
1666,
11384,
13,
1678,
1833,
29918,
2230,
29901,
5057,
1666,
11384,
13,
1678,
1788,
29901,
851,
353,
5124,
13,
1678,
7797,
29901,
851,
353,
5124,
13,
1678,
281,
3174,
29947,
29946,
29918,
5066,
4279,
29901,
5785,
353,
448,
29929,
29929,
29929,
29889,
29900,
13,
1678,
281,
3174,
29947,
29946,
29918,
5426,
4279,
29901,
5785,
353,
448,
29929,
29929,
29929,
29889,
29900,
13,
1678,
9755,
292,
29901,
5785,
353,
448,
29929,
29929,
29929,
29889,
29900,
13,
1678,
3643,
1918,
29901,
5785,
353,
448,
29929,
29929,
29929,
29889,
29900,
13,
1678,
11858,
362,
29901,
5785,
353,
448,
29929,
29929,
29929,
29889,
29900,
13,
1678,
521,
550,
29918,
19635,
29901,
360,
919,
29961,
710,
29892,
22433,
18417,
29962,
13,
1678,
11174,
29918,
19635,
29901,
2391,
29961,
5907,
287,
10108,
18417,
29962,
13,
1678,
2143,
29918,
2230,
29901,
5057,
1666,
11384,
13,
1678,
4955,
29901,
5298,
353,
5298,
580,
13,
13,
1678,
770,
12782,
29901,
13,
13,
4706,
4805,
353,
376,
17281,
29908,
13,
13,
13,
1990,
18379,
287,
1469,
29898,
1666,
6765,
1469,
1125,
13,
1678,
9995,
13,
1678,
3852,
310,
263,
3826,
326,
630,
1469,
1203,
13,
13,
1678,
450,
3474,
287,
848,
338,
6087,
297,
263,
8600,
5352,
4257,
848,
29889,
910,
338,
13,
1678,
263,
8600,
411,
385,
6251,
363,
1269,
1602,
7715,
3233,
29889,
450,
8267,
363,
263,
2323,
13,
1678,
1602,
7715,
3233,
338,
408,
4477,
29901,
13,
13,
1678,
302,
29918,
29893,
1144,
921,
302,
29918,
305,
550,
921,
302,
29918,
27736,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
15562,
29901,
18379,
287,
18417,
29892,
13,
4706,
848,
29901,
360,
919,
29961,
524,
29892,
7442,
29889,
299,
2378,
1402,
13,
268,
1125,
13,
4706,
9995,
13,
4706,
17250,
895,
278,
18379,
287,
1469,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
15562,
584,
18379,
287,
1469,
18417,
13,
9651,
450,
15562,
363,
278,
3474,
287,
848,
13,
4706,
848,
584,
360,
919,
29961,
524,
29892,
18379,
287,
2481,
1469,
29962,
13,
9651,
450,
3474,
287,
848,
13,
4706,
9995,
13,
4706,
17927,
29889,
8382,
29898,
29888,
29908,
9832,
1218,
18379,
287,
1469,
411,
848,
1134,
426,
1272,
29961,
29900,
1822,
29881,
1853,
27195,
13,
4706,
1583,
29889,
19635,
353,
15562,
13,
4706,
1583,
29889,
1272,
353,
848,
13,
13,
1678,
822,
679,
29918,
5563,
29898,
1311,
29892,
3233,
29901,
938,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
3617,
5417,
363,
263,
1602,
7715,
3233,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
3233,
584,
938,
13,
9651,
450,
1602,
7715,
3233,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
3474,
1409,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
7865,
2392,
13,
9651,
960,
1602,
7715,
3233,
338,
451,
2629,
3464,
13,
4706,
9995,
13,
4706,
565,
3233,
6736,
1583,
29889,
19635,
29889,
29876,
29918,
5563,
29879,
29901,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29908,
10108,
426,
5563,
29913,
451,
5277,
4236,
426,
1311,
29889,
19635,
29889,
29876,
29918,
5563,
29879,
448,
29871,
29896,
27195,
13,
4706,
736,
1583,
29889,
1272,
29961,
5563,
29962,
13,
13,
1678,
822,
679,
29918,
2997,
29898,
1311,
29892,
3233,
29901,
938,
29892,
1887,
29918,
5080,
29901,
938,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
3617,
3474,
773,
1887,
2380,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
3233,
584,
938,
13,
9651,
450,
1602,
7715,
3233,
13,
4706,
1887,
29918,
5080,
584,
938,
13,
9651,
9959,
3474,
2380,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
18379,
848,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
7865,
2392,
13,
9651,
960,
1887,
3474,
2380,
338,
714,
310,
3464,
13,
4706,
9995,
13,
4706,
302,
29918,
29893,
1144,
353,
1583,
29889,
19635,
29889,
5563,
29879,
29918,
19635,
29961,
5563,
1822,
29876,
29918,
29893,
1144,
13,
4706,
565,
1887,
29918,
5080,
529,
29871,
29900,
470,
1887,
29918,
5080,
6736,
302,
29918,
29893,
1144,
29901,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29908,
7717,
3474,
426,
2997,
29918,
5080,
29913,
451,
29871,
29900,
5277,
1887,
29918,
5080,
529,
426,
29876,
29918,
29893,
1144,
27195,
13,
4706,
736,
1583,
29889,
657,
29918,
5563,
29898,
5563,
9601,
2997,
29918,
5080,
29962,
13,
13,
1678,
822,
679,
29918,
10945,
29898,
1311,
29892,
3233,
29901,
938,
29892,
5534,
29918,
5080,
29901,
938,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
3617,
3474,
773,
5534,
2380,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
3233,
584,
938,
13,
9651,
450,
1602,
7715,
3233,
13,
4706,
5534,
29918,
5080,
584,
938,
13,
9651,
12002,
3474,
2380,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
18379,
848,
13,
4706,
9995,
13,
4706,
2380,
29918,
10289,
353,
1583,
29889,
19635,
29889,
5563,
29879,
29918,
19635,
29961,
5563,
1822,
2248,
29918,
10289,
13,
4706,
736,
1583,
29889,
657,
29918,
2997,
29898,
5563,
29892,
5534,
29918,
5080,
718,
2380,
29918,
10289,
29897,
13,
13,
1678,
822,
679,
29918,
5083,
29898,
1311,
29892,
3233,
29901,
938,
29892,
521,
273,
29901,
851,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
3617,
599,
278,
5417,
363,
263,
8242,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
3233,
584,
938,
13,
9651,
450,
1602,
7715,
3233,
13,
4706,
521,
273,
584,
851,
13,
9651,
450,
8242,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
450,
848,
363,
278,
18196,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
17368,
17413,
2392,
13,
9651,
960,
278,
8242,
338,
451,
1476,
297,
278,
848,
13,
4706,
9995,
13,
4706,
515,
620,
6765,
29889,
12523,
1053,
17368,
17413,
2392,
13,
13,
4706,
565,
521,
273,
451,
297,
1583,
29889,
19635,
29889,
305,
550,
29901,
13,
9651,
12020,
17368,
17413,
2392,
29898,
5083,
29892,
1583,
29889,
19635,
29889,
305,
550,
29897,
13,
4706,
22645,
353,
1583,
29889,
19635,
29889,
305,
550,
29889,
2248,
29898,
5083,
29897,
13,
4706,
736,
1583,
29889,
657,
29918,
5563,
29898,
5563,
9601,
16361,
22645,
29892,
584,
29962,
13,
13,
1678,
822,
304,
29918,
1807,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
9995,
2385,
2472,
408,
263,
1347,
15945,
29908,
13,
4706,
736,
1583,
29889,
19635,
29889,
517,
29918,
1807,
580,
13,
13,
13,
1990,
17311,
1680,
29898,
1666,
6765,
7032,
1125,
13,
1678,
9995,
13,
1678,
3852,
3826,
326,
630,
1469,
13,
13,
1678,
910,
338,
278,
7601,
3474,
3907,
1889,
363,
620,
6765,
322,
881,
367,
1304,
13,
1678,
746,
22239,
310,
5417,
411,
263,
3268,
470,
4822,
11840,
338,
3734,
29889,
13,
13,
1678,
910,
1158,
3913,
12655,
851,
4821,
304,
7738,
3474,
8386,
964,
278,
1602,
326,
630,
13,
1678,
848,
29889,
13,
13,
1678,
2823,
3115,
13,
1678,
448,
26589,
13,
1678,
17311,
1680,
8667,
584,
319,
8805,
1680,
304,
1207,
263,
3646,
1353,
310,
5417,
13,
13,
1678,
1222,
9422,
13,
1678,
448,
26589,
13,
1678,
450,
17311,
1680,
5417,
263,
3826,
326,
630,
1469,
1203,
2183,
263,
3407,
931,
322,
777,
13,
1678,
3474,
4128,
29889,
13,
13,
1678,
1670,
29915,
29879,
3755,
263,
2846,
24802,
4312,
363,
445,
1342,
29889,
14893,
491,
2599,
278,
13,
1678,
24802,
29892,
16184,
263,
3407,
931,
322,
14655,
4036,
1602,
326,
630,
848,
29889,
13,
13,
1678,
8653,
515,
620,
6765,
29889,
13445,
10335,
1053,
304,
29918,
12673,
13,
1678,
8653,
515,
620,
6765,
29889,
13424,
1053,
1602,
326,
630,
29918,
1272,
29918,
10660,
13,
1678,
8653,
515,
620,
6765,
29889,
7165,
1053,
18379,
26947,
29892,
17311,
1680,
13,
1678,
8653,
1602,
29918,
1272,
353,
1602,
326,
630,
29918,
1272,
29918,
10660,
29898,
5847,
29922,
29896,
29906,
29947,
29897,
13,
1678,
8653,
2143,
29918,
2230,
353,
1602,
29918,
1272,
29889,
19635,
29889,
4102,
29918,
2230,
13,
1678,
8653,
1596,
29898,
7099,
29918,
1272,
29889,
517,
29918,
1807,
3101,
13,
1678,
529,
1990,
525,
690,
6765,
29889,
7099,
6490,
29889,
6185,
326,
630,
1469,
11041,
13,
1669,
18920,
4706,
11636,
29871,
302,
29918,
27736,
965,
937,
29918,
2230,
462,
4706,
1833,
29918,
2230,
13,
1678,
3233,
13,
268,
29900,
539,
29906,
29900,
29946,
29947,
29889,
29900,
259,
29900,
29889,
29900,
29900,
29900,
29946,
29947,
29947,
539,
29896,
29953,
29941,
29947,
29946,
259,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
259,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29955,
29889,
29929,
29929,
29929,
29945,
29896,
29896,
29955,
29896,
29947,
29955,
29945,
13,
268,
29896,
4706,
29945,
29896,
29906,
29889,
29900,
259,
29900,
29889,
29900,
29900,
29896,
29929,
29945,
29941,
4706,
29946,
29900,
29929,
29953,
259,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
268,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29955,
29889,
29929,
29929,
29947,
29900,
29946,
29953,
29947,
29955,
29945,
13,
268,
29906,
4706,
29896,
29906,
29947,
29889,
29900,
259,
29900,
29889,
29900,
29900,
29955,
29947,
29896,
29906,
4706,
29896,
29900,
29906,
29946,
259,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29900,
539,
29906,
29900,
29906,
29896,
29899,
29900,
29896,
29899,
29900,
29896,
29871,
29900,
29900,
29901,
29900,
29900,
29901,
29900,
29955,
29889,
29929,
29929,
29906,
29896,
29947,
29955,
29945,
13,
13,
1678,
8084,
29892,
2847,
895,
278,
3474,
4128,
29889,
1152,
445,
1342,
29892,
671,
2319,
5417,
29892,
13,
1678,
607,
674,
1207,
16096,
292,
963,
6775,
29889,
13,
13,
1678,
8653,
5401,
29918,
7529,
353,
18379,
26947,
29898,
5080,
29918,
29879,
7093,
11759,
29896,
29953,
29892,
29896,
29953,
29892,
29896,
29953,
1402,
1375,
29918,
324,
481,
29922,
29946,
467,
3389,
29898,
7099,
29918,
1272,
29889,
19635,
29889,
29876,
29918,
5563,
29879,
29892,
1602,
29918,
1272,
29889,
19635,
29889,
5847,
29897,
13,
1678,
8653,
5401,
29918,
7529,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
29876,
29918,
5563,
29879,
2396,
29871,
29941,
29892,
13,
4706,
525,
1195,
29918,
29876,
29918,
29893,
1144,
2396,
29871,
29945,
29892,
13,
4706,
525,
5080,
29918,
29879,
7093,
2396,
518,
29896,
29953,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29953,
1402,
13,
4706,
525,
324,
481,
29918,
29879,
7093,
2396,
518,
29946,
29892,
29871,
29946,
29892,
29871,
29946,
29962,
13,
1678,
500,
13,
13,
1678,
27313,
278,
3474,
292,
29889,
910,
2869,
10017,
8386,
964,
278,
1602,
326,
630,
848,
13,
1678,
773,
278,
12655,
29889,
1982,
29889,
303,
2426,
29918,
509,
7358,
29889,
2536,
4821,
29918,
7165,
29918,
1493,
740,
29889,
450,
8267,
13,
1678,
363,
263,
848,
1409,
472,
263,
1602,
7715,
3233,
338,
29901,
302,
29918,
29893,
1144,
921,
302,
29918,
305,
550,
921,
5401,
29918,
2311,
29889,
450,
13,
1678,
2472,
1048,
1269,
3233,
338,
884,
297,
278,
11174,
29918,
19635,
5352,
310,
13,
1678,
18379,
287,
18417,
29889,
13,
13,
1678,
8653,
5401,
29918,
1272,
353,
17311,
1680,
2141,
3389,
29898,
999,
29918,
2230,
29892,
5401,
29918,
7529,
29892,
1602,
29918,
1272,
29897,
13,
1678,
8653,
5401,
29918,
1272,
29889,
1272,
29961,
29900,
1822,
12181,
13,
1678,
313,
29896,
29941,
29953,
29945,
29892,
29871,
29906,
29892,
29871,
29896,
29953,
29897,
13,
1678,
8653,
363,
3233,
29918,
19635,
297,
5401,
29918,
1272,
29889,
19635,
29889,
5563,
29879,
29918,
19635,
29901,
13,
1678,
2023,
268,
3233,
29918,
19635,
29889,
7727,
580,
13,
1678,
426,
13,
4706,
525,
5847,
2396,
29871,
29906,
29900,
29946,
29947,
29889,
29900,
29892,
13,
4706,
525,
29876,
29918,
29893,
1144,
2396,
29871,
29896,
29941,
29953,
29945,
29892,
13,
4706,
525,
5080,
29918,
2311,
2396,
29871,
29896,
29953,
29892,
13,
4706,
525,
324,
481,
29918,
2311,
2396,
29871,
29946,
29892,
13,
4706,
525,
2248,
29918,
10289,
2396,
29871,
29900,
13,
1678,
500,
13,
1678,
426,
13,
4706,
525,
5847,
2396,
29871,
29945,
29896,
29906,
29889,
29900,
29892,
13,
4706,
525,
29876,
29918,
29893,
1144,
2396,
29871,
29941,
29946,
29896,
29892,
13,
4706,
525,
5080,
29918,
2311,
2396,
29871,
29896,
29953,
29892,
13,
4706,
525,
324,
481,
29918,
2311,
2396,
29871,
29946,
29892,
13,
4706,
525,
2248,
29918,
10289,
2396,
29871,
29900,
13,
1678,
500,
13,
1678,
426,
13,
4706,
525,
5847,
2396,
29871,
29896,
29906,
29947,
29889,
29900,
29892,
13,
4706,
525,
29876,
29918,
29893,
1144,
2396,
29871,
29947,
29945,
29892,
13,
4706,
525,
5080,
29918,
2311,
2396,
29871,
29896,
29953,
29892,
13,
4706,
525,
324,
481,
29918,
2311,
2396,
29871,
29946,
29892,
13,
4706,
525,
2248,
29918,
10289,
2396,
29871,
29900,
13,
1678,
500,
13,
13,
1678,
2803,
29915,
29879,
1106,
472,
385,
1342,
310,
848,
515,
278,
937,
1602,
7715,
3233,
363,
278,
13,
1678,
937,
8242,
29889,
910,
338,
3763,
263,
5608,
731,
310,
848,
364,
9776,
515,
29871,
29900,
856,
29896,
29953,
29918,
29941,
29947,
29941,
29889,
13,
13,
1678,
8653,
1602,
29918,
1272,
29889,
1272,
29961,
29900,
3816,
29900,
29962,
13,
1678,
1409,
4197,
268,
29900,
29892,
418,
29896,
29892,
418,
29906,
29892,
2023,
29892,
29871,
29896,
29953,
29941,
29947,
29896,
29892,
29871,
29896,
29953,
29941,
29947,
29906,
29892,
29871,
29896,
29953,
29941,
29947,
29941,
2314,
13,
13,
1678,
13377,
1103,
292,
278,
937,
2846,
5417,
3697,
896,
526,
408,
3806,
3704,
278,
13,
1678,
25457,
29889,
13,
13,
1678,
8653,
5401,
29918,
1272,
29889,
1272,
29961,
29900,
3816,
29900,
29892,
29871,
29900,
29962,
13,
1678,
1409,
4197,
29871,
29900,
29892,
259,
29896,
29892,
259,
29906,
29892,
259,
29941,
29892,
259,
29946,
29892,
259,
29945,
29892,
259,
29953,
29892,
259,
29955,
29892,
259,
29947,
29892,
259,
29929,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29945,
2314,
13,
1678,
8653,
5401,
29918,
1272,
29889,
1272,
29961,
29900,
3816,
29896,
29892,
29871,
29900,
29962,
13,
1678,
1409,
4197,
29896,
29906,
29892,
29871,
29896,
29941,
29892,
29871,
29896,
29946,
29892,
29871,
29896,
29945,
29892,
29871,
29896,
29953,
29892,
29871,
29896,
29955,
29892,
29871,
29896,
29947,
29892,
29871,
29896,
29929,
29892,
29871,
29906,
29900,
29892,
29871,
29906,
29896,
29892,
29871,
29906,
29906,
29892,
29871,
29906,
29941,
29892,
29871,
29906,
29946,
29892,
29871,
29906,
29945,
29892,
29871,
29906,
29953,
29892,
29871,
29906,
29955,
2314,
13,
1678,
8653,
5401,
29918,
1272,
29889,
1272,
29961,
29900,
3816,
29906,
29892,
29871,
29900,
29962,
13,
1678,
1409,
4197,
29906,
29946,
29892,
29871,
29906,
29945,
29892,
29871,
29906,
29953,
29892,
29871,
29906,
29955,
29892,
29871,
29906,
29947,
29892,
29871,
29906,
29929,
29892,
29871,
29941,
29900,
29892,
29871,
29941,
29896,
29892,
29871,
29941,
29906,
29892,
29871,
29941,
29941,
29892,
29871,
29941,
29946,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29941,
29955,
29892,
29871,
29941,
29947,
29892,
29871,
29941,
29929,
2314,
13,
1678,
9995,
13,
13,
1678,
822,
1065,
29898,
13,
4706,
1583,
29892,
13,
4706,
2143,
29918,
2230,
29901,
390,
29903,
11384,
29892,
13,
4706,
5401,
29918,
7529,
29901,
18379,
11507,
29892,
13,
4706,
1602,
29918,
1272,
29901,
3826,
326,
630,
1469,
29892,
13,
1678,
1723,
1599,
18379,
287,
1469,
29901,
13,
4706,
9995,
13,
4706,
27313,
3474,
292,
310,
3826,
326,
630,
1469,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
2143,
29918,
2230,
584,
390,
29903,
11384,
13,
9651,
450,
3407,
931,
13,
4706,
5401,
29918,
7529,
584,
18379,
11507,
13,
9651,
450,
3474,
4128,
13,
4706,
1602,
29918,
1272,
584,
3826,
326,
630,
1469,
13,
9651,
450,
1602,
326,
630,
848,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
18379,
287,
1469,
13,
9651,
3852,
363,
1602,
326,
630,
848,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
10554,
6558,
2392,
13,
9651,
960,
278,
1353,
310,
5417,
12833,
297,
278,
3474,
1591,
947,
451,
13,
9651,
1993,
278,
2159,
310,
278,
1409,
8386,
13,
4706,
9995,
13,
4706,
15562,
29918,
8977,
353,
1602,
29918,
1272,
29889,
19635,
29889,
8977,
580,
13,
4706,
848,
353,
6571,
13,
4706,
5401,
29918,
5563,
29879,
29918,
19635,
353,
5159,
13,
4706,
7191,
353,
5159,
13,
4706,
363,
474,
5563,
297,
3464,
29898,
29900,
29892,
1602,
29918,
1272,
29889,
19635,
29889,
29876,
29918,
5563,
29879,
1125,
13,
9651,
17927,
29889,
3888,
29898,
29888,
29908,
5907,
292,
1602,
7715,
3233,
426,
488,
955,
27195,
13,
9651,
5401,
29918,
2311,
353,
5401,
29918,
7529,
29889,
657,
29918,
5080,
29918,
2311,
29898,
488,
955,
29897,
13,
9651,
288,
6984,
29918,
2311,
353,
5401,
29918,
7529,
29889,
657,
29918,
324,
481,
29918,
2311,
29898,
488,
955,
29897,
13,
9651,
3233,
29918,
19635,
353,
1602,
29918,
1272,
29889,
19635,
29889,
5563,
29879,
29918,
19635,
29961,
488,
955,
29962,
13,
9651,
5401,
29918,
2371,
353,
679,
29918,
5080,
29918,
2371,
29898,
999,
29918,
2230,
29892,
3233,
29918,
19635,
29892,
5401,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29897,
13,
9651,
302,
29918,
29893,
1144,
353,
7431,
29898,
5080,
29918,
2371,
29889,
2248,
29897,
13,
9651,
17927,
29889,
3888,
29898,
29888,
29908,
29912,
29876,
29918,
29893,
1144,
29913,
5417,
29892,
2159,
426,
5080,
29918,
2311,
1118,
25457,
426,
324,
481,
29918,
2311,
27195,
13,
9651,
7191,
29889,
4397,
29898,
29888,
29908,
10108,
426,
488,
955,
1118,
5759,
426,
29876,
29918,
29893,
1144,
29913,
5417,
1159,
13,
9651,
7191,
29889,
4397,
29898,
29888,
29908,
5907,
2159,
426,
5080,
29918,
2311,
1118,
288,
6984,
29918,
2311,
426,
324,
481,
29918,
2311,
27195,
13,
13,
9651,
565,
302,
29918,
29893,
1144,
529,
5401,
29918,
7529,
29889,
1195,
29918,
29876,
29918,
29893,
1144,
29901,
13,
18884,
17927,
29889,
8382,
29898,
29888,
29908,
4557,
5417,
426,
29876,
29918,
29893,
1144,
29913,
529,
1375,
29889,
426,
5080,
29918,
7529,
29889,
1195,
29918,
29876,
29918,
29893,
1144,
27195,
13,
18884,
7191,
29889,
4397,
29898,
29888,
29908,
8009,
29889,
5417,
426,
29876,
29918,
29893,
1144,
29913,
529,
1375,
29889,
426,
5080,
29918,
7529,
29889,
1195,
29918,
29876,
29918,
29893,
1144,
27195,
13,
18884,
7191,
29889,
4397,
29898,
29888,
29908,
10108,
426,
488,
955,
29913,
28907,
29892,
6624,
1218,
3474,
292,
1159,
13,
18884,
2867,
13,
13,
9651,
5401,
29918,
5563,
29918,
1272,
353,
1583,
3032,
657,
29918,
5563,
29918,
1272,
29898,
13,
18884,
1602,
29918,
1272,
29889,
657,
29918,
5563,
29898,
488,
955,
511,
13,
18884,
5401,
29918,
2371,
29892,
13,
18884,
1602,
29918,
1272,
29889,
19635,
29889,
29876,
29918,
305,
550,
29892,
13,
18884,
5401,
29918,
2311,
29892,
13,
18884,
288,
6984,
29918,
2311,
29892,
13,
9651,
1723,
13,
9651,
565,
5401,
29918,
5563,
29918,
1272,
29889,
12181,
29961,
29900,
29962,
2804,
302,
29918,
29893,
1144,
29901,
13,
18884,
12020,
10554,
6558,
2392,
29898,
13,
462,
1678,
1583,
29889,
978,
29892,
13,
462,
1678,
285,
29908,
8009,
29889,
5417,
29635,
426,
5080,
29918,
5563,
29918,
1272,
29889,
12181,
29961,
29900,
12258,
2804,
426,
29876,
29918,
29893,
1144,
17671,
13,
18884,
1723,
13,
9651,
5401,
29918,
5563,
29918,
19635,
353,
1583,
3032,
657,
29918,
5563,
29918,
19635,
29898,
13,
18884,
3233,
29918,
19635,
29892,
13,
18884,
5401,
29918,
2371,
29892,
13,
18884,
5401,
29918,
2311,
29892,
13,
18884,
288,
6984,
29918,
2311,
29892,
13,
9651,
1723,
13,
9651,
848,
29961,
488,
955,
29962,
353,
5401,
29918,
5563,
29918,
1272,
13,
9651,
5401,
29918,
5563,
29879,
29918,
19635,
29889,
4397,
29898,
5080,
29918,
5563,
29918,
19635,
29897,
13,
4706,
15562,
29918,
8977,
3366,
999,
29918,
2230,
3108,
353,
2143,
29918,
2230,
13,
4706,
15562,
353,
1583,
3032,
657,
29918,
19635,
29898,
19635,
29918,
8977,
29892,
5401,
29918,
5563,
29879,
29918,
19635,
29897,
13,
4706,
15562,
29889,
18434,
29889,
1202,
29918,
11651,
29898,
1311,
3032,
657,
29918,
11651,
29898,
19158,
876,
13,
4706,
17927,
29889,
3888,
703,
5907,
292,
8676,
1159,
13,
4706,
736,
18379,
287,
1469,
29898,
19635,
29892,
848,
29897,
13,
13,
1678,
822,
903,
657,
29918,
5563,
29918,
1272,
29898,
13,
4706,
1583,
29892,
13,
4706,
848,
29901,
7442,
29889,
299,
2378,
29892,
13,
4706,
5401,
29918,
2371,
29901,
10518,
29889,
17271,
29892,
13,
4706,
302,
29918,
305,
550,
29901,
938,
29892,
13,
4706,
5401,
29918,
2311,
29901,
938,
29892,
13,
4706,
288,
6984,
29918,
2311,
29901,
938,
29892,
13,
1678,
1723,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
3617,
3474,
848,
363,
263,
1602,
7715,
3233,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
848,
584,
7442,
29889,
299,
2378,
13,
9651,
450,
1602,
326,
630,
931,
848,
363,
278,
3233,
13,
4706,
5401,
29918,
2371,
584,
10518,
29889,
17271,
13,
9651,
450,
3474,
1591,
13,
4706,
302,
29918,
305,
550,
584,
938,
13,
9651,
450,
1353,
310,
18196,
13,
4706,
5401,
29918,
2311,
584,
938,
13,
9651,
450,
3474,
2159,
13,
4706,
288,
6984,
29918,
2311,
584,
938,
13,
9651,
450,
25457,
2159,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7442,
29889,
299,
2378,
13,
9651,
14866,
4821,
3474,
8386,
297,
385,
1409,
363,
278,
1602,
7715,
3233,
13,
4706,
9995,
13,
4706,
515,
12655,
29889,
1982,
29889,
303,
2426,
29918,
509,
7358,
1053,
2243,
4821,
29918,
7165,
29918,
1493,
13,
13,
4706,
515,
29918,
11249,
353,
5401,
29918,
2371,
29889,
2029,
29961,
29900,
29892,
376,
3166,
29918,
11249,
3108,
13,
4706,
304,
29918,
11249,
353,
5401,
29918,
2371,
29889,
2029,
29961,
5080,
29918,
2371,
29889,
2248,
14352,
29896,
1402,
376,
3166,
29918,
11249,
3108,
13,
4706,
11924,
29918,
2311,
353,
5401,
29918,
2311,
448,
288,
6984,
29918,
2311,
13,
4706,
1776,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
13,
9651,
2243,
4821,
29918,
7165,
29918,
1493,
29898,
1272,
29892,
3474,
29918,
12181,
7607,
29876,
29918,
305,
550,
29892,
5401,
29918,
2311,
511,
2436,
519,
29922,
5574,
29897,
13,
4706,
1723,
13,
4706,
736,
1776,
29961,
3166,
29918,
11249,
584,
304,
29918,
11249,
718,
29871,
29896,
584,
11924,
29918,
2311,
29962,
13,
13,
1678,
822,
903,
657,
29918,
5563,
29918,
19635,
29898,
13,
4706,
1583,
29892,
13,
4706,
3233,
29918,
19635,
29901,
3826,
326,
630,
10108,
18417,
29892,
13,
4706,
5401,
29918,
2371,
29901,
10518,
29889,
17271,
29892,
13,
4706,
5401,
29918,
2311,
29901,
938,
29892,
13,
4706,
288,
6984,
29918,
2311,
29901,
938,
29892,
13,
1678,
1723,
1599,
18379,
287,
10108,
18417,
29901,
13,
4706,
9995,
2577,
278,
3474,
287,
15562,
363,
263,
1602,
7715,
3233,
15945,
29908,
13,
4706,
9210,
353,
313,
5080,
29918,
2371,
3366,
10945,
3108,
448,
5401,
29918,
2371,
3366,
2997,
3108,
467,
13092,
580,
13,
4706,
565,
7431,
29898,
10289,
29897,
2804,
29871,
29896,
29901,
13,
9651,
12020,
7865,
2392,
703,
22995,
15628,
3474,
1591,
29892,
24099,
1887,
304,
5534,
9210,
1159,
13,
4706,
736,
18379,
287,
10108,
18417,
29898,
13,
9651,
18920,
29922,
5563,
29918,
19635,
29889,
5847,
29892,
13,
9651,
302,
29918,
29893,
1144,
29922,
2435,
29898,
5080,
29918,
2371,
29889,
2248,
511,
13,
9651,
5401,
29918,
2311,
29922,
5080,
29918,
2311,
29892,
13,
9651,
288,
6984,
29918,
2311,
29922,
324,
481,
29918,
2311,
29892,
13,
9651,
2380,
29918,
10289,
29922,
10289,
29961,
29900,
1402,
13,
4706,
1723,
13,
13,
1678,
822,
903,
657,
29918,
19635,
29898,
13,
4706,
1583,
29892,
13,
4706,
15562,
29918,
8977,
29901,
360,
919,
29961,
710,
29892,
3139,
1402,
13,
4706,
11174,
29918,
19635,
29901,
2391,
29961,
5907,
287,
10108,
18417,
1402,
13,
1678,
1723,
1599,
18379,
287,
18417,
29901,
13,
4706,
9995,
2577,
278,
15562,
363,
278,
3474,
287,
848,
15945,
29908,
13,
4706,
15562,
29918,
8977,
29889,
7323,
703,
1445,
29918,
3888,
1159,
13,
4706,
15562,
29918,
8977,
3366,
29876,
29918,
5563,
29879,
3108,
353,
7431,
29898,
5563,
29879,
29918,
19635,
29897,
13,
4706,
15562,
29918,
8977,
3366,
5563,
29879,
29918,
19635,
3108,
353,
11174,
29918,
19635,
13,
4706,
736,
18379,
287,
18417,
29898,
1068,
19635,
29918,
8977,
29897,
13,
13,
13,
1990,
17311,
1680,
8667,
29898,
29956,
513,
1680,
1125,
13,
1678,
9995,
13,
1678,
17311,
1680,
393,
27778,
3474,
15786,
304,
5870,
263,
3646,
1353,
310,
5417,
13,
13,
1678,
450,
9212,
3474,
2159,
297,
3474,
4128,
674,
367,
3390,
287,
1584,
565,
278,
13,
1678,
5759,
1353,
310,
5417,
338,
2400,
278,
3646,
29889,
910,
338,
304,
4772,
18845,
13,
1678,
988,
19163,
3598,
2319,
5417,
15786,
526,
4629,
29889,
13,
13,
1678,
6317,
9177,
1057,
13,
13,
4706,
910,
1889,
338,
19434,
5407,
363,
4996,
9068,
310,
263,
2323,
13,
4706,
20039,
322,
881,
451,
367,
1304,
746,
738,
22239,
310,
5417,
338,
13,
4706,
3734,
2629,
263,
3268,
470,
4822,
11840,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
3646,
584,
938,
13,
4706,
450,
3646,
1353,
310,
5417,
363,
1269,
1602,
7715,
3233,
13,
1678,
288,
6984,
29918,
771,
637,
291,
584,
5785,
13,
4706,
450,
25457,
18618,
310,
278,
3474,
2159,
13,
13,
1678,
2823,
3115,
13,
1678,
448,
26589,
13,
1678,
17311,
1680,
584,
450,
3474,
3907,
1889,
304,
671,
746,
22239,
338,
3734,
13,
1678,
9995,
13,
13,
1678,
3646,
29901,
938,
353,
29871,
29896,
29900,
29900,
29900,
13,
1678,
1375,
29918,
2311,
29901,
938,
353,
29871,
29953,
29946,
13,
1678,
288,
6984,
29918,
771,
637,
291,
29901,
5785,
353,
29871,
29900,
29889,
29906,
29945,
13,
13,
1678,
822,
1065,
29898,
13,
4706,
1583,
29892,
13,
4706,
2143,
29918,
2230,
29901,
390,
29903,
11384,
29892,
13,
4706,
5401,
29918,
7529,
29901,
18379,
11507,
29892,
13,
4706,
1602,
29918,
1272,
29901,
3826,
326,
630,
1469,
29892,
13,
1678,
1723,
1599,
18379,
287,
1469,
29901,
13,
4706,
15562,
29918,
8977,
353,
1602,
29918,
1272,
29889,
19635,
29889,
8977,
580,
13,
4706,
848,
353,
6571,
13,
4706,
5401,
29918,
5563,
29879,
29918,
19635,
353,
5159,
13,
4706,
7191,
353,
5159,
13,
4706,
363,
474,
5563,
297,
3464,
29898,
29900,
29892,
1602,
29918,
1272,
29889,
19635,
29889,
29876,
29918,
5563,
29879,
1125,
13,
9651,
17927,
29889,
3888,
29898,
29888,
29908,
5907,
292,
1602,
7715,
3233,
426,
488,
955,
27195,
13,
9651,
3233,
29918,
19635,
353,
1602,
29918,
1272,
29889,
19635,
29889,
5563,
29879,
29918,
19635,
29961,
488,
955,
29962,
13,
9651,
5401,
29918,
2311,
353,
1583,
3032,
657,
29918,
5080,
29918,
2311,
29898,
5563,
29918,
19635,
29897,
13,
9651,
288,
6984,
29918,
2311,
353,
938,
29898,
9302,
29889,
14939,
29898,
1311,
29889,
324,
481,
29918,
771,
637,
291,
334,
5401,
29918,
2311,
876,
13,
9651,
5401,
29918,
2371,
353,
679,
29918,
5080,
29918,
2371,
29898,
999,
29918,
2230,
29892,
3233,
29918,
19635,
29892,
5401,
29918,
2311,
29892,
288,
6984,
29918,
2311,
29897,
13,
9651,
302,
29918,
29893,
1144,
353,
7431,
29898,
5080,
29918,
2371,
29889,
2248,
29897,
13,
9651,
17927,
29889,
3888,
29898,
29888,
29908,
29912,
29876,
29918,
29893,
1144,
29913,
5417,
29892,
2159,
426,
5080,
29918,
2311,
1118,
25457,
426,
324,
481,
29918,
2311,
27195,
13,
9651,
7191,
29889,
4397,
29898,
29888,
29908,
10108,
426,
488,
955,
1118,
5759,
426,
29876,
29918,
29893,
1144,
29913,
5417,
1159,
13,
9651,
7191,
29889,
4397,
29898,
29888,
29908,
5907,
2159,
426,
5080,
29918,
2311,
1118,
288,
6984,
29918,
2311,
426,
324,
481,
29918,
2311,
27195,
13,
13,
9651,
565,
302,
29918,
29893,
1144,
529,
5401,
29918,
7529,
29889,
1195,
29918,
29876,
29918,
29893,
1144,
29901,
13,
18884,
17927,
29889,
8382,
29898,
29888,
29908,
4557,
5417,
426,
29876,
29918,
29893,
1144,
29913,
529,
1375,
29889,
426,
5080,
29918,
7529,
29889,
1195,
29918,
29876,
29918,
29893,
1144,
27195,
13,
18884,
7191,
29889,
4397,
29898,
29888,
29908,
8009,
29889,
5417,
426,
29876,
29918,
29893,
1144,
29913,
529,
1375,
29889,
426,
5080,
29918,
7529,
29889,
1195,
29918,
29876,
29918,
29893,
1144,
27195,
13,
18884,
7191,
29889,
4397,
29898,
29888,
29908,
10108,
426,
488,
955,
29913,
28907,
29892,
6624,
1218,
3474,
292,
1159,
13,
18884,
2867,
13,
13,
9651,
5401,
29918,
5563,
29918,
1272,
353,
1583,
3032,
657,
29918,
5563,
29918,
1272,
29898,
13,
18884,
1602,
29918,
1272,
29889,
657,
29918,
5563,
29898,
488,
955,
511,
13,
18884,
5401,
29918,
2371,
29892,
13,
18884,
1602,
29918,
1272,
29889,
19635,
29889,
29876,
29918,
305,
550,
29892,
13,
18884,
5401,
29918,
2311,
29892,
13,
18884,
288,
6984,
29918,
2311,
29892,
13,
9651,
1723,
13,
9651,
5401,
29918,
5563,
29918,
19635,
353,
1583,
3032,
657,
29918,
5563,
29918,
19635,
29898,
13,
18884,
3233,
29918,
19635,
29892,
13,
18884,
5401,
29918,
2371,
29892,
13,
18884,
5401,
29918,
2311,
29892,
13,
18884,
288,
6984,
29918,
2311,
29892,
13,
9651,
1723,
13,
9651,
848,
29961,
488,
955,
29962,
353,
5401,
29918,
5563,
29918,
1272,
13,
9651,
5401,
29918,
5563,
29879,
29918,
19635,
29889,
4397,
29898,
5080,
29918,
5563,
29918,
19635,
29897,
13,
4706,
15562,
29918,
8977,
3366,
999,
29918,
2230,
3108,
353,
15562,
29918,
8977,
3366,
4102,
29918,
2230,
3108,
13,
4706,
15562,
353,
1583,
3032,
657,
29918,
19635,
29898,
19635,
29918,
8977,
29892,
5401,
29918,
5563,
29879,
29918,
19635,
29897,
13,
4706,
15562,
29889,
18434,
29889,
1202,
29918,
11651,
29898,
1311,
3032,
657,
29918,
11651,
29898,
19158,
876,
13,
4706,
17927,
29889,
3888,
703,
5907,
292,
8676,
1159,
13,
4706,
736,
18379,
287,
1469,
29898,
19635,
29892,
848,
29897,
13,
13,
1678,
822,
903,
657,
29918,
5080,
29918,
2311,
29898,
1311,
29892,
3233,
29918,
19635,
29901,
3826,
326,
630,
10108,
18417,
29897,
1599,
938,
29901,
13,
4706,
364,
15945,
29908,
13,
4706,
3617,
3474,
2159,
393,
4076,
3802,
304,
278,
3646,
1353,
310,
5417,
13,
13,
4706,
3852,
11924,
491,
313,
7165,
2159,
448,
25457,
2159,
511,
5480,
278,
13,
4706,
900,
29880,
16958,
6306,
338,
7484,
29892,
13,
13,
4706,
6317,
5844,
1057,
13,
13,
9651,
302,
648,
27736,
29913,
847,
5135,
29896,
448,
302,
648,
957,
6984,
1800,
29930,
29876,
648,
7165,
1800,
353,
3646,
13,
13,
4706,
390,
799,
29878,
574,
1076,
29892,
679,
29892,
13,
13,
4706,
6317,
5844,
1057,
13,
13,
9651,
302,
648,
7165,
29913,
353,
302,
648,
27736,
29913,
847,
5135,
29896,
448,
302,
648,
957,
6984,
1800,
29930,
5182,
29897,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
3233,
29918,
19635,
584,
3826,
326,
630,
10108,
18417,
13,
9651,
450,
15562,
363,
278,
1602,
7715,
3233,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
938,
13,
9651,
450,
3474,
2159,
13,
4706,
9995,
13,
4706,
5401,
29918,
2311,
353,
3233,
29918,
19635,
29889,
29876,
29918,
27736,
847,
5135,
29896,
448,
1583,
29889,
324,
481,
29918,
771,
637,
291,
29897,
334,
1583,
29889,
5182,
29897,
13,
4706,
5401,
29918,
2311,
353,
938,
29898,
9302,
29889,
14939,
29898,
5080,
29918,
2311,
876,
13,
4706,
565,
5401,
29918,
2311,
529,
1583,
29889,
1195,
29918,
2311,
29901,
13,
9651,
736,
1583,
29889,
1195,
29918,
2311,
13,
4706,
736,
5401,
29918,
2311,
13,
13,
13,
1990,
18379,
287,
1469,
10507,
29898,
1666,
6765,
10507,
1125,
13,
1678,
9995,
10507,
310,
620,
6765,
3474,
287,
848,
15945,
29908,
13,
13,
1678,
822,
1065,
29898,
1311,
29892,
4516,
29918,
2084,
29901,
10802,
29892,
5401,
29918,
1272,
29901,
18379,
287,
1469,
29897,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
14350,
714,
18379,
287,
1469,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
4516,
29918,
2084,
584,
10802,
13,
9651,
450,
3884,
2224,
304,
2436,
304,
13,
4706,
5401,
29918,
1272,
584,
18379,
287,
1469,
13,
9651,
18379,
287,
848,
304,
2436,
714,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
14350,
2392,
13,
9651,
960,
9368,
304,
2436,
304,
278,
3884,
13,
4706,
9995,
13,
4706,
515,
620,
6765,
29889,
12523,
1053,
14350,
2392,
13,
13,
4706,
565,
451,
1583,
3032,
3198,
29918,
3972,
29898,
3972,
29918,
2084,
1125,
13,
9651,
12020,
14350,
2392,
29898,
3972,
29918,
2084,
29892,
376,
2525,
519,
304,
2436,
304,
3884,
29892,
1423,
10748,
1159,
13,
4706,
17927,
29889,
3888,
29898,
29888,
29908,
29956,
768,
292,
3474,
287,
848,
304,
426,
3972,
29918,
2084,
27195,
13,
4706,
15562,
29918,
2084,
353,
4516,
29918,
2084,
847,
376,
19635,
29889,
3126,
29908,
13,
4706,
848,
29918,
2084,
353,
4516,
29918,
2084,
847,
376,
1272,
29908,
13,
4706,
7442,
29889,
7620,
29920,
29918,
510,
13120,
29898,
1272,
29918,
2084,
29892,
3579,
29912,
710,
29898,
29916,
1125,
343,
363,
921,
29892,
343,
297,
5401,
29918,
1272,
29889,
1272,
29889,
7076,
580,
1800,
13,
4706,
15562,
353,
5401,
29918,
1272,
29889,
19635,
29889,
8552,
580,
13,
4706,
15562,
29889,
18434,
29889,
1202,
29918,
11651,
29898,
1311,
3032,
657,
29918,
11651,
29898,
3972,
29918,
2084,
29892,
1134,
29898,
5080,
29918,
1272,
4961,
13,
4706,
15562,
29889,
3539,
29898,
19635,
29918,
2084,
29897,
13,
13,
13,
1990,
18379,
287,
1469,
6982,
29898,
1666,
6765,
7032,
1125,
13,
1678,
9995,
6982,
310,
620,
6765,
3474,
287,
848,
15945,
29908,
13,
13,
1678,
822,
1065,
29898,
13,
4706,
1583,
29892,
4516,
29918,
2084,
29901,
10802,
29892,
15562,
29918,
6194,
29901,
6120,
353,
7700,
13,
1678,
1723,
1599,
7761,
29961,
5907,
287,
18417,
29892,
18379,
287,
1469,
5387,
13,
4706,
9995,
13,
4706,
7523,
18379,
287,
1469,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
4516,
29918,
2084,
584,
10802,
13,
9651,
450,
3884,
2224,
304,
1303,
515,
13,
4706,
15562,
29918,
6194,
584,
6120,
29892,
13136,
13,
9651,
28697,
363,
2805,
15562,
871,
29892,
491,
2322,
7700,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7761,
29961,
5907,
287,
18417,
29892,
18379,
287,
1469,
29962,
13,
9651,
450,
18379,
287,
1469,
470,
18379,
287,
18417,
565,
15562,
29918,
6194,
338,
5852,
13,
13,
4706,
390,
1759,
267,
13,
4706,
448,
23648,
13,
4706,
7523,
2392,
13,
9651,
960,
278,
3884,
947,
451,
1863,
13,
4706,
9995,
13,
4706,
515,
620,
6765,
29889,
12523,
1053,
7523,
2392,
13,
13,
4706,
565,
451,
4516,
29918,
2084,
29889,
9933,
7295,
13,
9651,
12020,
7523,
2392,
29898,
3972,
29918,
2084,
29892,
376,
9882,
947,
451,
1863,
1159,
13,
4706,
17927,
29889,
3888,
29898,
29888,
29908,
6359,
292,
3474,
287,
848,
515,
426,
3972,
29918,
2084,
27195,
13,
4706,
15562,
29918,
2084,
353,
4516,
29918,
2084,
847,
376,
19635,
29889,
3126,
29908,
13,
4706,
15562,
353,
18379,
287,
18417,
29889,
5510,
29918,
1445,
29898,
19635,
29918,
2084,
29897,
13,
4706,
565,
15562,
29918,
6194,
29901,
13,
9651,
736,
15562,
13,
4706,
848,
29918,
2084,
353,
4516,
29918,
2084,
847,
376,
1272,
29889,
9302,
29920,
29908,
13,
4706,
7442,
29920,
29918,
1445,
353,
7442,
29889,
1359,
29898,
1272,
29918,
2084,
29897,
13,
4706,
848,
353,
426,
524,
29898,
5563,
1125,
7442,
29920,
29918,
1445,
29961,
5563,
29962,
363,
3233,
297,
7442,
29920,
29918,
1445,
29889,
5325,
29913,
13,
4706,
7191,
353,
518,
29888,
29908,
5907,
287,
848,
1303,
515,
426,
3972,
29918,
2084,
29913,
3108,
13,
4706,
15562,
29889,
18434,
29889,
1202,
29918,
11651,
29898,
1311,
3032,
657,
29918,
11651,
29898,
19158,
876,
13,
4706,
736,
18379,
287,
1469,
29898,
19635,
29892,
848,
29897,
13,
2
] |
acmicpc/python/14405.py | hyeongyun0916/Algorithm | 1 | 1600248 | <reponame>hyeongyun0916/Algorithm
import sys
# chupikachupipichu
s = sys.stdin.readline().strip()
i = 0
while i < len(s):
if s[i] == 'p':
if i+1 < len(s) and s[i+1] == 'i':
i += 1
else:
print('NO')
exit()
elif s[i] == 'k':
if i+1 < len(s) and s[i+1] == 'a':
i += 1
else:
print('NO')
exit()
elif s[i] == 'c':
if i+2 < len(s) and s[i+1] == 'h' and s[i+2] == 'u':
i += 2
else:
print('NO')
exit()
else:
print('NO')
exit()
i += 1
print('YES') | [
1,
529,
276,
1112,
420,
29958,
29882,
4099,
549,
29891,
348,
29900,
29929,
29896,
29953,
29914,
22461,
4540,
13,
5215,
10876,
13,
29937,
521,
786,
638,
496,
786,
666,
436,
29884,
13,
13,
29879,
353,
10876,
29889,
4172,
262,
29889,
949,
1220,
2141,
17010,
580,
13,
13,
29875,
353,
29871,
29900,
13,
8000,
474,
529,
7431,
29898,
29879,
1125,
13,
1678,
565,
269,
29961,
29875,
29962,
1275,
525,
29886,
2396,
13,
4706,
565,
474,
29974,
29896,
529,
7431,
29898,
29879,
29897,
322,
269,
29961,
29875,
29974,
29896,
29962,
1275,
525,
29875,
2396,
13,
9651,
474,
4619,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
6632,
1495,
13,
9651,
6876,
580,
13,
1678,
25342,
269,
29961,
29875,
29962,
1275,
525,
29895,
2396,
13,
4706,
565,
474,
29974,
29896,
529,
7431,
29898,
29879,
29897,
322,
269,
29961,
29875,
29974,
29896,
29962,
1275,
525,
29874,
2396,
13,
9651,
474,
4619,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
6632,
1495,
13,
9651,
6876,
580,
13,
1678,
25342,
269,
29961,
29875,
29962,
1275,
525,
29883,
2396,
13,
4706,
565,
474,
29974,
29906,
529,
7431,
29898,
29879,
29897,
322,
269,
29961,
29875,
29974,
29896,
29962,
1275,
525,
29882,
29915,
322,
269,
29961,
29875,
29974,
29906,
29962,
1275,
525,
29884,
2396,
13,
9651,
474,
4619,
29871,
29906,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
6632,
1495,
13,
9651,
6876,
580,
1678,
13,
1678,
1683,
29901,
13,
4706,
1596,
877,
6632,
1495,
13,
4706,
6876,
580,
13,
1678,
474,
4619,
29871,
29896,
13,
2158,
877,
21143,
1495,
2
] |
save_restore/check_frozen_model.py | scotthuang1989/mytensorflow_example_code | 32 | 141193 | import tensorflow as tf
import argparse
def load_graph(frozen_graph_filename):
# We load the protobuf file from the disk and parse it to retrieve the
# unserialized graph_def
with tf.gfile.GFile(frozen_graph_filename, "rb") as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
# Then, we import the graph_def into a new Graph and returns it
with tf.Graph().as_default() as graph:
# The name var will prefix every op/nodes in your graph
# Since we load everything in a new graph, this is not needed
tf.import_graph_def(graph_def, name="")
return graph
if __name__ == '__main__':
# Let's allow the user to pass the filename as an argument
parser = argparse.ArgumentParser()
# parser.add_argument("--frozen_model_filename", default="/home/scott/Downloads/ssd_mobilenet_v1_coco_11_06_2017/frozen_inference_graph.pb", type=str, help="Frozen model file to import")
parser.add_argument("--frozen_model_filename", default="/home/scott/Downloads/faster_rcnn_inception_resnet_v2_atrous_coco_11_06_2017/frozen_inference_graph.pb", type=str, help="Frozen model file to import")
args = parser.parse_args()
# We use our "load_graph" function
graph = load_graph(args.frozen_model_filename)
# We can verify that we can access the list of operations in the graph
for op in graph.get_operations():
print(op.name)
# prefix/Placeholder/inputs_placeholder
# ...
# prefix/Accuracy/predictions
# y = graph.get_tensor_by_name('prefix/Accuracy/predictions:0')
| [
1,
1053,
26110,
408,
15886,
13,
5215,
1852,
5510,
13,
13,
1753,
2254,
29918,
4262,
29898,
29888,
307,
2256,
29918,
4262,
29918,
9507,
1125,
13,
1678,
396,
1334,
2254,
278,
17814,
9721,
934,
515,
278,
8086,
322,
6088,
372,
304,
10563,
278,
13,
1678,
396,
443,
15550,
1891,
3983,
29918,
1753,
13,
1678,
411,
15886,
29889,
29887,
1445,
29889,
29954,
2283,
29898,
29888,
307,
2256,
29918,
4262,
29918,
9507,
29892,
376,
6050,
1159,
408,
285,
29901,
13,
4706,
3983,
29918,
1753,
353,
15886,
29889,
9527,
3206,
580,
13,
4706,
3983,
29918,
1753,
29889,
12914,
4591,
1231,
29898,
29888,
29889,
949,
3101,
13,
13,
1678,
396,
1987,
29892,
591,
1053,
278,
3983,
29918,
1753,
964,
263,
716,
12367,
322,
3639,
372,
13,
1678,
411,
15886,
29889,
9527,
2141,
294,
29918,
4381,
580,
408,
3983,
29901,
13,
4706,
396,
450,
1024,
722,
674,
10944,
1432,
1015,
29914,
18010,
297,
596,
3983,
13,
4706,
396,
4001,
591,
2254,
4129,
297,
263,
716,
3983,
29892,
445,
338,
451,
4312,
13,
4706,
15886,
29889,
5215,
29918,
4262,
29918,
1753,
29898,
4262,
29918,
1753,
29892,
1024,
543,
1159,
13,
1678,
736,
3983,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
2803,
29915,
29879,
2758,
278,
1404,
304,
1209,
278,
10422,
408,
385,
2980,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
396,
13812,
29889,
1202,
29918,
23516,
703,
489,
29888,
307,
2256,
29918,
4299,
29918,
9507,
613,
2322,
13802,
5184,
29914,
1557,
1501,
29914,
6767,
18132,
29914,
893,
29881,
29918,
29885,
12213,
264,
300,
29918,
29894,
29896,
29918,
29883,
6235,
29918,
29896,
29896,
29918,
29900,
29953,
29918,
29906,
29900,
29896,
29955,
29914,
29888,
307,
2256,
29918,
262,
1659,
29918,
4262,
29889,
24381,
613,
1134,
29922,
710,
29892,
1371,
543,
29943,
307,
2256,
1904,
934,
304,
1053,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
29888,
307,
2256,
29918,
4299,
29918,
9507,
613,
2322,
13802,
5184,
29914,
1557,
1501,
29914,
6767,
18132,
29914,
29888,
1901,
29918,
2214,
15755,
29918,
1239,
683,
29918,
690,
1212,
29918,
29894,
29906,
29918,
8141,
681,
29918,
29883,
6235,
29918,
29896,
29896,
29918,
29900,
29953,
29918,
29906,
29900,
29896,
29955,
29914,
29888,
307,
2256,
29918,
262,
1659,
29918,
4262,
29889,
24381,
613,
1134,
29922,
710,
29892,
1371,
543,
29943,
307,
2256,
1904,
934,
304,
1053,
1159,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
396,
1334,
671,
1749,
376,
1359,
29918,
4262,
29908,
740,
13,
1678,
3983,
353,
2254,
29918,
4262,
29898,
5085,
29889,
29888,
307,
2256,
29918,
4299,
29918,
9507,
29897,
13,
13,
1678,
396,
1334,
508,
11539,
393,
591,
508,
2130,
278,
1051,
310,
6931,
297,
278,
3983,
13,
1678,
363,
1015,
297,
3983,
29889,
657,
29918,
3372,
800,
7295,
13,
4706,
1596,
29898,
459,
29889,
978,
29897,
13,
4706,
396,
10944,
29914,
22150,
7694,
29914,
2080,
29879,
29918,
27074,
13,
4706,
396,
2023,
13,
4706,
396,
10944,
29914,
7504,
332,
4135,
29914,
27711,
1080,
13,
13,
1678,
396,
343,
353,
3983,
29889,
657,
29918,
20158,
29918,
1609,
29918,
978,
877,
13506,
29914,
7504,
332,
4135,
29914,
27711,
1080,
29901,
29900,
1495,
13,
2
] |
learning/LearnPython3TheHardWay/InteractiveFictionClass/GoogleColabStarterCode/Parser.py | AlexanderTN/Python | 1 | 47793 | <filename>learning/LearnPython3TheHardWay/InteractiveFictionClass/GoogleColabStarterCode/Parser.py<gh_stars>1-10
class Parser:
"""The Parser is the class that handles the player's input. The player
writes commands, and the parser performs natural language understanding
in order to interpret what the player intended, and how that intent
is reflected in the simulated world.
"""
def __init__(self, game):
# A list of all of the commands that the player has issued.
self.command_history = []
# A pointer to the game.
self.game = game
def get_player_intent(self,command):
command = command.lower()
if "," in command:
# Let the player type in a comma separted sequence of commands
return "sequence"
elif self.get_direction(command):
# Check for the direction intent
return "direction"
elif command.lower() == "look" or command.lower() == "l":
# when the user issues a "look" command, re-describe what they see
return "redescribe"
elif "examine " in command or command.lower().startswith("x "):
return "examine"
elif "take " in command or "get " in command:
return "take"
elif "drop " in command:
return "drop"
elif "inventory" in command or command.lower() == "i":
return "inventory"
else:
for item in self.game.get_items_in_scope():
special_commands = item.get_commands()
for special_command in special_commands:
if command == special_command.lower():
return "special"
def parse_command(self, command):
# add this command to the history
self.command_history.append(command)
# By default, none of the intents end the game. The following are ways this
# flag can be changed to True.
# * Going to a certain place.
# * Entering a certain special command
# * Picking up a certain object.
end_game = False
# Intents are functions that can be executed
intent = self.get_player_intent(command)
if intent == "direction":
end_game = self.go_in_direction(command)
elif intent == "redescribe":
self.game.describe()
elif intent == "examine":
self.examine(command)
elif intent == "take":
end_game = self.take(command)
elif intent == "drop":
self.drop(command)
elif intent == "inventory":
self.check_inventory() #Tam: Actually there is no usage of the command in here, so I will remove it out of the parameters list passed in the function, old: self.check_inventory(command)
elif intent == "special":
end_game = self.run_special_command(command)
elif intent == "sequence":
#end_game = self.execute_sequence(command)
self.execute_sequence(command) #Tam3 change it as this function dont return value
else:
print("I'm not sure what you want to do.")
return end_game
### Intent Functions ###
def go_in_direction(self, command):
""" The user wants to in some direction """
direction = self.get_direction(command)
if direction:
if direction in self.game.curr_location.connections:
if self.game.curr_location.is_blocked(direction, self.game):
# check to see whether that direction is blocked.
print(self.game.curr_location.get_block_description(direction))
else:
# if it's not blocked, then move there
self.game.curr_location = self.game.curr_location.connections[direction]
# If moving to this location ends the game, only describe the location
# and not the available items or actions.
if self.game.curr_location.end_game:
self.game.describe_current_location()
else:
self.game.describe()
else:
print("You can't go %s from here." % direction.capitalize())
return self.game.curr_location.end_game
def check_inventory(self): #Tam: Actually there is no usage of the command in here, so I will remove it out of the parameters list passed in the function, old: def check_inventory(self,command):
""" The player wants to check their inventory"""
if len(self.game.inventory) == 0:
print("You don't have anything.")
else:
descriptions = []
for item_name in self.game.inventory:
item = self.game.inventory[item_name]
descriptions.append(item.description)
print("You have: ", end = '')
print(*descriptions, sep = ", ",)
def examine(self, command):
""" The player wants to examine something """
command = command.lower()
matched_item = False
# check whether any of the items at this location match the command
for item_name in self.game.curr_location.items:
if item_name in command:
item = self.game.curr_location.items[item_name]
if item.examine_text:
print(item.examine_text)
matched_item = True
break
# check whether any of the items in the inventory match the command
for item_name in self.game.inventory:
if item_name in command:
item = self.game.inventory[item_name]
if item.examine_text:
print(item.examine_text)
matched_item = True
# fail
if not matched_item:
print("You don't see anything special.")
def take(self, command):
""" The player wants to put something in their inventory """
command = command.lower()
matched_item = False
# This gets set to True if posession of this object ends the game.
end_game = False
# check whether any of the items at this location match the command
for item_name in self.game.curr_location.items:
if item_name in command:
item = self.game.curr_location.items[item_name]
if item.gettable:
self.game.add_to_inventory(item)
self.game.curr_location.remove_item(item)
print(item.take_text)
end_game = item.end_game
else:
print("You cannot take the %s." % item_name)
matched_item = True
break
# check whether any of the items in the inventory match the command
if not matched_item:
for item_name in self.game.inventory:
if item_name in command:
print("You already have the %s." % item_name)
matched_item = True
# fail
if not matched_item:
print("You can't find it.")
return end_game
def drop(self, command):
""" The player wants to remove something from their inventory """
command = command.lower()
matched_item = False
# check whether any of the items in the inventory match the command
if not matched_item:
for item_name in self.game.inventory:
if item_name in command:
matched_item = True
item = self.game.inventory[item_name]
self.game.curr_location.add_item(item_name, item)
self.game.inventory.pop(item_name)
print("You drop the %s." % item_name)
break
# fail
if not matched_item:
print("You don't have that.")
def run_special_command(self, command):
"""Run a special command associated with one of the items in this location
or in the player's inventory"""
for item in self.game.get_items_in_scope():
special_commands = item.get_commands()
for special_command in special_commands:
if command == special_command.lower():
return item.do_action(special_command, self.game)
def execute_sequence(self, command):
for cmd in command.split(","):
cmd = cmd.strip()
self.parse_command(cmd)
#return 1 #Tam add to pass the error
def get_direction(self, command):
command = command.lower()
if command == "n" or "north" in command:
return "north"
if command == "s" or "south" in command:
return "south"
if command == "e" or "east" in command:
return "east"
if command == "w" or "west" in command:
return "west"
if command == "up":
return "up"
if command == "down":
return "down"
if command.startswith("go out"):
return "out"
if command.startswith("go in"):
return "in"
for exit in self.game.curr_location.connections.keys():
if command == exit.lower() or command == "go " + exit.lower():
return exit
return None | [
1,
529,
9507,
29958,
21891,
29914,
29931,
799,
29876,
11980,
29941,
1576,
29950,
538,
29956,
388,
29914,
4074,
4925,
29943,
2463,
2385,
29914,
14207,
1625,
370,
855,
4254,
3399,
29914,
11726,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
1990,
1459,
643,
29901,
13,
1678,
9995,
1576,
1459,
643,
338,
278,
770,
393,
17766,
278,
4847,
29915,
29879,
1881,
29889,
29871,
450,
4847,
29871,
13,
1678,
15873,
8260,
29892,
322,
278,
13812,
23233,
5613,
4086,
8004,
13,
1678,
297,
1797,
304,
6613,
825,
278,
4847,
9146,
29892,
322,
920,
393,
7609,
13,
1678,
338,
25312,
297,
278,
1027,
7964,
3186,
29889,
29871,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3748,
1125,
13,
4706,
396,
319,
1051,
310,
599,
310,
278,
8260,
393,
278,
4847,
756,
16610,
29889,
13,
4706,
1583,
29889,
6519,
29918,
18434,
353,
5159,
13,
4706,
396,
319,
4879,
304,
278,
3748,
29889,
13,
4706,
1583,
29889,
11802,
353,
3748,
13,
13,
1678,
822,
679,
29918,
9106,
29918,
14029,
29898,
1311,
29892,
6519,
1125,
13,
4706,
1899,
353,
1899,
29889,
13609,
580,
13,
4706,
565,
28796,
297,
1899,
29901,
13,
9651,
396,
2803,
278,
4847,
1134,
297,
263,
16694,
409,
1595,
287,
5665,
310,
8260,
13,
9651,
736,
376,
16506,
29908,
13,
4706,
25342,
1583,
29889,
657,
29918,
20845,
29898,
6519,
1125,
13,
9651,
396,
5399,
363,
278,
5305,
7609,
13,
9651,
736,
376,
20845,
29908,
13,
4706,
25342,
1899,
29889,
13609,
580,
1275,
376,
6914,
29908,
470,
1899,
29889,
13609,
580,
1275,
376,
29880,
1115,
13,
9651,
396,
746,
278,
1404,
5626,
263,
376,
6914,
29908,
1899,
29892,
337,
29899,
2783,
29581,
825,
896,
1074,
13,
9651,
736,
376,
1127,
267,
29581,
29908,
13,
4706,
25342,
376,
735,
314,
457,
376,
297,
1899,
470,
1899,
29889,
13609,
2141,
27382,
2541,
703,
29916,
376,
1125,
13,
9651,
736,
376,
735,
314,
457,
29908,
13,
4706,
25342,
29871,
376,
19730,
376,
297,
1899,
470,
376,
657,
376,
297,
1899,
29901,
13,
9651,
736,
376,
19730,
29908,
13,
4706,
25342,
376,
8865,
376,
297,
1899,
29901,
13,
9651,
736,
376,
8865,
29908,
13,
4706,
25342,
376,
262,
23886,
29908,
297,
1899,
470,
1899,
29889,
13609,
580,
1275,
376,
29875,
1115,
13,
9651,
736,
376,
262,
23886,
29908,
13,
4706,
1683,
29901,
29871,
13,
9651,
363,
2944,
297,
1583,
29889,
11802,
29889,
657,
29918,
7076,
29918,
262,
29918,
6078,
7295,
13,
18884,
4266,
29918,
26381,
353,
2944,
29889,
657,
29918,
26381,
580,
13,
18884,
363,
4266,
29918,
6519,
297,
4266,
29918,
26381,
29901,
13,
462,
1678,
565,
1899,
1275,
4266,
29918,
6519,
29889,
13609,
7295,
13,
462,
4706,
736,
376,
18732,
29908,
13,
13,
1678,
822,
6088,
29918,
6519,
29898,
1311,
29892,
1899,
1125,
13,
4706,
396,
788,
445,
1899,
304,
278,
4955,
13,
4706,
1583,
29889,
6519,
29918,
18434,
29889,
4397,
29898,
6519,
29897,
13,
13,
4706,
396,
2648,
2322,
29892,
5642,
310,
278,
938,
1237,
1095,
278,
3748,
29889,
450,
1494,
526,
5837,
445,
13,
4706,
396,
7353,
508,
367,
3939,
304,
5852,
29889,
13,
4706,
396,
334,
2921,
292,
304,
263,
3058,
2058,
29889,
13,
4706,
396,
334,
9041,
292,
263,
3058,
4266,
1899,
13,
4706,
396,
334,
23868,
292,
701,
263,
3058,
1203,
29889,
13,
13,
4706,
1095,
29918,
11802,
353,
7700,
13,
13,
4706,
396,
3159,
1237,
526,
3168,
393,
508,
367,
8283,
13,
4706,
7609,
353,
1583,
29889,
657,
29918,
9106,
29918,
14029,
29898,
6519,
29897,
13,
4706,
565,
7609,
1275,
376,
20845,
1115,
13,
9651,
1095,
29918,
11802,
353,
1583,
29889,
1484,
29918,
262,
29918,
20845,
29898,
6519,
29897,
13,
4706,
25342,
7609,
1275,
376,
1127,
267,
29581,
1115,
13,
9651,
1583,
29889,
11802,
29889,
2783,
29581,
580,
13,
4706,
25342,
7609,
1275,
376,
735,
314,
457,
1115,
13,
9651,
1583,
29889,
735,
314,
457,
29898,
6519,
29897,
13,
4706,
25342,
7609,
1275,
376,
19730,
1115,
13,
9651,
1095,
29918,
11802,
353,
1583,
29889,
19730,
29898,
6519,
29897,
13,
4706,
25342,
7609,
1275,
376,
8865,
1115,
13,
9651,
1583,
29889,
8865,
29898,
6519,
29897,
13,
4706,
25342,
7609,
1275,
376,
262,
23886,
1115,
13,
9651,
1583,
29889,
3198,
29918,
262,
23886,
580,
396,
29911,
314,
29901,
12823,
727,
338,
694,
8744,
310,
278,
1899,
297,
1244,
29892,
577,
306,
674,
3349,
372,
714,
310,
278,
4128,
1051,
4502,
297,
278,
740,
29892,
2030,
29901,
1583,
29889,
3198,
29918,
262,
23886,
29898,
6519,
29897,
13,
4706,
25342,
7609,
1275,
376,
18732,
1115,
13,
9651,
1095,
29918,
11802,
353,
1583,
29889,
3389,
29918,
18732,
29918,
6519,
29898,
6519,
29897,
13,
4706,
25342,
7609,
1275,
376,
16506,
1115,
13,
9651,
396,
355,
29918,
11802,
353,
1583,
29889,
7978,
29918,
16506,
29898,
6519,
29897,
13,
9651,
1583,
29889,
7978,
29918,
16506,
29898,
6519,
29897,
396,
29911,
314,
29941,
1735,
372,
408,
445,
740,
4555,
736,
995,
13,
4706,
1683,
29901,
13,
9651,
1596,
703,
29902,
29915,
29885,
451,
1854,
825,
366,
864,
304,
437,
23157,
13,
4706,
736,
1095,
29918,
11802,
13,
13,
1678,
835,
11171,
6680,
29879,
835,
13,
13,
1678,
822,
748,
29918,
262,
29918,
20845,
29898,
1311,
29892,
1899,
1125,
13,
4706,
9995,
450,
1404,
10753,
304,
297,
777,
5305,
9995,
13,
4706,
5305,
353,
1583,
29889,
657,
29918,
20845,
29898,
6519,
29897,
13,
13,
4706,
565,
5305,
29901,
13,
9651,
565,
5305,
297,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
11958,
1953,
29901,
13,
18884,
565,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
275,
29918,
1271,
287,
29898,
20845,
29892,
1583,
29889,
11802,
1125,
13,
462,
1678,
396,
1423,
304,
1074,
3692,
393,
5305,
338,
24370,
29889,
13,
462,
1678,
1596,
29898,
1311,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
657,
29918,
1271,
29918,
8216,
29898,
20845,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
396,
565,
372,
29915,
29879,
451,
24370,
29892,
769,
4337,
727,
29871,
13,
462,
1678,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
353,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
11958,
1953,
29961,
20845,
29962,
13,
13,
462,
1678,
396,
960,
8401,
304,
445,
4423,
10614,
278,
3748,
29892,
871,
8453,
278,
4423,
13,
462,
1678,
396,
322,
451,
278,
3625,
4452,
470,
8820,
29889,
13,
462,
1678,
565,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
355,
29918,
11802,
29901,
13,
462,
4706,
1583,
29889,
11802,
29889,
2783,
29581,
29918,
3784,
29918,
5479,
580,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1583,
29889,
11802,
29889,
2783,
29581,
580,
13,
9651,
1683,
29901,
13,
18884,
1596,
703,
3492,
508,
29915,
29873,
748,
1273,
29879,
515,
1244,
1213,
1273,
5305,
29889,
5030,
2410,
675,
3101,
13,
4706,
736,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
355,
29918,
11802,
13,
13,
1678,
822,
1423,
29918,
262,
23886,
29898,
1311,
1125,
396,
29911,
314,
29901,
12823,
727,
338,
694,
8744,
310,
278,
1899,
297,
1244,
29892,
577,
306,
674,
3349,
372,
714,
310,
278,
4128,
1051,
4502,
297,
278,
740,
29892,
2030,
29901,
822,
1423,
29918,
262,
23886,
29898,
1311,
29892,
6519,
1125,
13,
4706,
9995,
450,
4847,
10753,
304,
1423,
1009,
11817,
706,
15945,
29908,
13,
4706,
565,
7431,
29898,
1311,
29889,
11802,
29889,
262,
23886,
29897,
1275,
29871,
29900,
29901,
13,
9651,
1596,
703,
3492,
1016,
29915,
29873,
505,
3099,
23157,
13,
4706,
1683,
29901,
13,
9651,
2342,
1980,
353,
5159,
13,
9651,
363,
2944,
29918,
978,
297,
1583,
29889,
11802,
29889,
262,
23886,
29901,
13,
18884,
2944,
353,
1583,
29889,
11802,
29889,
262,
23886,
29961,
667,
29918,
978,
29962,
13,
18884,
2342,
1980,
29889,
4397,
29898,
667,
29889,
8216,
29897,
13,
9651,
1596,
703,
3492,
505,
29901,
9162,
1095,
353,
27255,
13,
9651,
1596,
10456,
2783,
699,
1980,
29892,
16345,
353,
9162,
9162,
29897,
13,
259,
13,
13,
1678,
822,
25917,
29898,
1311,
29892,
1899,
1125,
13,
4706,
9995,
450,
4847,
10753,
304,
25917,
1554,
9995,
13,
4706,
1899,
353,
1899,
29889,
13609,
580,
13,
4706,
19228,
29918,
667,
353,
7700,
13,
4706,
396,
1423,
3692,
738,
310,
278,
4452,
472,
445,
4423,
1993,
278,
1899,
13,
4706,
363,
2944,
29918,
978,
297,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
7076,
29901,
13,
9651,
565,
2944,
29918,
978,
297,
1899,
29901,
13,
18884,
2944,
353,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
7076,
29961,
667,
29918,
978,
29962,
13,
18884,
565,
2944,
29889,
735,
314,
457,
29918,
726,
29901,
13,
462,
1678,
1596,
29898,
667,
29889,
735,
314,
457,
29918,
726,
29897,
13,
462,
1678,
19228,
29918,
667,
353,
5852,
13,
18884,
2867,
13,
4706,
396,
1423,
3692,
738,
310,
278,
4452,
297,
278,
11817,
706,
1993,
278,
1899,
13,
4706,
363,
2944,
29918,
978,
297,
1583,
29889,
11802,
29889,
262,
23886,
29901,
13,
9651,
565,
2944,
29918,
978,
297,
1899,
29901,
13,
18884,
2944,
353,
1583,
29889,
11802,
29889,
262,
23886,
29961,
667,
29918,
978,
29962,
13,
18884,
565,
2944,
29889,
735,
314,
457,
29918,
726,
29901,
13,
462,
1678,
1596,
29898,
667,
29889,
735,
314,
457,
29918,
726,
29897,
13,
462,
1678,
19228,
29918,
667,
353,
5852,
13,
4706,
396,
4418,
13,
4706,
565,
451,
19228,
29918,
667,
29901,
13,
9651,
1596,
703,
3492,
1016,
29915,
29873,
1074,
3099,
4266,
23157,
13,
13,
13,
1678,
822,
2125,
29898,
1311,
29892,
1899,
1125,
13,
4706,
9995,
450,
4847,
10753,
304,
1925,
1554,
297,
1009,
11817,
706,
9995,
13,
4706,
1899,
353,
1899,
29889,
13609,
580,
13,
4706,
19228,
29918,
667,
353,
7700,
13,
13,
4706,
396,
910,
4947,
731,
304,
5852,
565,
926,
1211,
310,
445,
1203,
10614,
278,
3748,
29889,
13,
4706,
1095,
29918,
11802,
353,
7700,
13,
13,
4706,
396,
1423,
3692,
738,
310,
278,
4452,
472,
445,
4423,
1993,
278,
1899,
13,
4706,
363,
2944,
29918,
978,
297,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
7076,
29901,
13,
9651,
565,
2944,
29918,
978,
297,
1899,
29901,
13,
18884,
2944,
353,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
7076,
29961,
667,
29918,
978,
29962,
13,
18884,
565,
2944,
29889,
657,
2371,
29901,
13,
462,
1678,
1583,
29889,
11802,
29889,
1202,
29918,
517,
29918,
262,
23886,
29898,
667,
29897,
13,
462,
1678,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
5992,
29918,
667,
29898,
667,
29897,
13,
462,
1678,
1596,
29898,
667,
29889,
19730,
29918,
726,
29897,
13,
462,
1678,
1095,
29918,
11802,
353,
2944,
29889,
355,
29918,
11802,
13,
18884,
1683,
29901,
13,
462,
1678,
1596,
703,
3492,
2609,
2125,
278,
1273,
29879,
1213,
1273,
2944,
29918,
978,
29897,
13,
18884,
19228,
29918,
667,
353,
5852,
13,
18884,
2867,
13,
4706,
396,
1423,
3692,
738,
310,
278,
4452,
297,
278,
11817,
706,
1993,
278,
1899,
13,
4706,
565,
451,
19228,
29918,
667,
29901,
13,
9651,
363,
2944,
29918,
978,
297,
1583,
29889,
11802,
29889,
262,
23886,
29901,
13,
18884,
565,
2944,
29918,
978,
297,
1899,
29901,
13,
462,
1678,
1596,
703,
3492,
2307,
505,
278,
1273,
29879,
1213,
1273,
2944,
29918,
978,
29897,
13,
462,
1678,
19228,
29918,
667,
353,
5852,
13,
4706,
396,
4418,
13,
4706,
565,
451,
19228,
29918,
667,
29901,
13,
9651,
1596,
703,
3492,
508,
29915,
29873,
1284,
372,
23157,
13,
13,
4706,
736,
1095,
29918,
11802,
13,
13,
1678,
822,
5768,
29898,
1311,
29892,
1899,
1125,
13,
4706,
9995,
450,
4847,
10753,
304,
3349,
1554,
515,
1009,
11817,
706,
9995,
13,
4706,
1899,
353,
1899,
29889,
13609,
580,
13,
4706,
19228,
29918,
667,
353,
7700,
13,
4706,
396,
1423,
3692,
738,
310,
278,
4452,
297,
278,
11817,
706,
1993,
278,
1899,
13,
4706,
565,
451,
19228,
29918,
667,
29901,
13,
9651,
363,
2944,
29918,
978,
297,
1583,
29889,
11802,
29889,
262,
23886,
29901,
13,
18884,
565,
2944,
29918,
978,
297,
1899,
29901,
13,
462,
1678,
19228,
29918,
667,
353,
5852,
13,
462,
1678,
2944,
353,
1583,
29889,
11802,
29889,
262,
23886,
29961,
667,
29918,
978,
29962,
13,
462,
1678,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
1202,
29918,
667,
29898,
667,
29918,
978,
29892,
2944,
29897,
13,
462,
1678,
1583,
29889,
11802,
29889,
262,
23886,
29889,
7323,
29898,
667,
29918,
978,
29897,
13,
462,
1678,
1596,
703,
3492,
5768,
278,
1273,
29879,
1213,
1273,
2944,
29918,
978,
29897,
13,
462,
1678,
2867,
13,
4706,
396,
4418,
13,
4706,
565,
451,
19228,
29918,
667,
29901,
13,
9651,
1596,
703,
3492,
1016,
29915,
29873,
505,
393,
23157,
13,
13,
13,
1678,
822,
1065,
29918,
18732,
29918,
6519,
29898,
1311,
29892,
1899,
1125,
13,
4706,
9995,
6558,
263,
4266,
1899,
6942,
411,
697,
310,
278,
4452,
297,
445,
4423,
13,
539,
470,
297,
278,
4847,
29915,
29879,
11817,
706,
15945,
29908,
13,
4706,
363,
2944,
297,
1583,
29889,
11802,
29889,
657,
29918,
7076,
29918,
262,
29918,
6078,
7295,
13,
18884,
4266,
29918,
26381,
353,
2944,
29889,
657,
29918,
26381,
580,
13,
18884,
363,
4266,
29918,
6519,
297,
4266,
29918,
26381,
29901,
13,
462,
1678,
565,
1899,
1275,
4266,
29918,
6519,
29889,
13609,
7295,
13,
462,
4706,
736,
2944,
29889,
1867,
29918,
2467,
29898,
18732,
29918,
6519,
29892,
1583,
29889,
11802,
29897,
13,
13,
1678,
822,
6222,
29918,
16506,
29898,
1311,
29892,
1899,
1125,
13,
4706,
363,
9920,
297,
1899,
29889,
5451,
29898,
3284,
1125,
13,
9651,
9920,
353,
9920,
29889,
17010,
580,
13,
9651,
1583,
29889,
5510,
29918,
6519,
29898,
9006,
29897,
13,
4706,
396,
2457,
29871,
29896,
396,
29911,
314,
788,
304,
1209,
278,
1059,
13,
1678,
822,
679,
29918,
20845,
29898,
1311,
29892,
1899,
1125,
13,
4706,
1899,
353,
1899,
29889,
13609,
580,
13,
4706,
565,
1899,
1275,
376,
29876,
29908,
470,
376,
29876,
2072,
29908,
297,
1899,
29901,
13,
9651,
736,
376,
29876,
2072,
29908,
29871,
13,
4706,
565,
1899,
1275,
376,
29879,
29908,
470,
376,
29879,
2438,
29908,
297,
1899,
29901,
13,
9651,
736,
376,
29879,
2438,
29908,
13,
4706,
565,
1899,
1275,
376,
29872,
29908,
470,
376,
23027,
29908,
297,
1899,
29901,
29871,
13,
9651,
736,
376,
23027,
29908,
13,
4706,
565,
1899,
1275,
376,
29893,
29908,
470,
376,
5933,
29908,
297,
1899,
29901,
13,
9651,
736,
376,
5933,
29908,
13,
4706,
565,
1899,
1275,
376,
786,
1115,
13,
9651,
736,
376,
786,
29908,
13,
4706,
565,
1899,
1275,
376,
3204,
1115,
13,
9651,
736,
376,
3204,
29908,
13,
4706,
565,
1899,
29889,
27382,
2541,
703,
1484,
714,
29908,
1125,
13,
9651,
736,
376,
449,
29908,
13,
4706,
565,
1899,
29889,
27382,
2541,
703,
1484,
297,
29908,
1125,
13,
9651,
736,
376,
262,
29908,
13,
4706,
363,
6876,
297,
1583,
29889,
11802,
29889,
21962,
29918,
5479,
29889,
11958,
1953,
29889,
8149,
7295,
13,
9651,
565,
1899,
1275,
6876,
29889,
13609,
580,
470,
1899,
1275,
376,
1484,
376,
718,
6876,
29889,
13609,
7295,
13,
18884,
736,
6876,
13,
4706,
736,
6213,
2
] |
run.py | zgoda/kyfood | 0 | 193311 | from argparse import ArgumentParser
from dotenv import find_dotenv, load_dotenv
from werkzeug.serving import run_simple
from api._local import API
def get_options():
parser = ArgumentParser()
parser.add_argument(
"-o", "--host", default="127.0.0.1", help="host name or IP address to bind"
)
parser.add_argument(
"-p", "--port", type=int, default=5000, help="port number to listen"
)
parser.add_argument(
"--no-reload", action="store_true", default=False, help="disable hot reload"
)
return parser.parse_args()
def main(options):
app = API()
reload_ = not options.no_reload
run_simple(options.host, options.port, app, use_reloader=reload_)
if __name__ == "__main__":
load_dotenv(find_dotenv())
opts = get_options()
main(opts)
| [
1,
515,
1852,
5510,
1053,
23125,
11726,
13,
13,
3166,
8329,
6272,
1053,
1284,
29918,
6333,
6272,
29892,
2254,
29918,
6333,
6272,
13,
3166,
23085,
13289,
29889,
643,
1747,
1053,
1065,
29918,
12857,
13,
13,
3166,
7882,
3032,
2997,
1053,
3450,
13,
13,
13,
1753,
679,
29918,
6768,
7295,
13,
1678,
13812,
353,
23125,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29877,
613,
376,
489,
3069,
613,
2322,
543,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
613,
1371,
543,
3069,
1024,
470,
5641,
3211,
304,
7868,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29886,
613,
376,
489,
637,
613,
1134,
29922,
524,
29892,
2322,
29922,
29945,
29900,
29900,
29900,
29892,
1371,
543,
637,
1353,
304,
11621,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
28120,
613,
3158,
543,
8899,
29918,
3009,
613,
2322,
29922,
8824,
29892,
1371,
543,
20472,
7375,
19763,
29908,
13,
1678,
1723,
13,
1678,
736,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
13,
1753,
1667,
29898,
6768,
1125,
13,
1678,
623,
353,
3450,
580,
13,
1678,
19763,
29918,
353,
451,
3987,
29889,
1217,
29918,
28120,
13,
1678,
1065,
29918,
12857,
29898,
6768,
29889,
3069,
29892,
3987,
29889,
637,
29892,
623,
29892,
671,
29918,
276,
12657,
29922,
28120,
19925,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
2254,
29918,
6333,
6272,
29898,
2886,
29918,
6333,
6272,
3101,
13,
1678,
29111,
353,
679,
29918,
6768,
580,
13,
1678,
1667,
29898,
25707,
29897,
13,
2
] |
question_bank/merge-two-binary-trees/merge-two-binary-trees.py | yatengLG/leetcode-python | 9 | 143442 | # -*- coding: utf-8 -*-
# @Author : LG
"""
执行用时:104 ms, 在所有 Python3 提交中击败了64.10% 的用户
内存消耗:14.4 MB, 在所有 Python3 提交中击败了79.35% 的用户
解题思路:
具体实现见代码注释
"""
class Solution:
def mergeTrees(self, t1: TreeNode, t2: TreeNode) -> TreeNode:
def find(root1, root2): # 两棵树的对应节点
if root1 and root2: # 如果节点都存在
node = TreeNode(root1.val + root2.val) # 合并后的当前节点为两树节点和
node.left = find(root1.left, root2.left) # 处理两树的对应左子树, 返回的节点为当前合并子树的左子树
node.right = find(root1.right, root2.right) # 处理两树的对应右子树
elif root1 or root2: # 只存在一个节点
node = TreeNode(root1.val if root1 else root2.val) # 当前节点等于存在节点值
node.left = find(root1.left if root1 else None, root2.left if root2 else None) # 遍历存在节点的左子树
node.right = find(root1.right if root1 else None, root2.right if root2 else None) # 遍历存在节点的右子树
else:
return None # 均不存在返回None
return node
t = find(t1, t2)
return t
"""
执行用时:100 ms, 在所有 Python3 提交中击败了91.61% 的用户
内存消耗:14.5 MB, 在所有 Python3 提交中击败了46.33% 的用户
解题思路:
同上,但不新建树
"""
class Solution:
def mergeTrees(self, t1: TreeNode, t2: TreeNode) -> TreeNode:
def find(root1, root2): # 两棵树的对应节点
if root1 and root2: # 如果节点都存在
root1.val = root1.val + root2.val # 合并后的当前节点为两树节点和
root1.left = find(root1.left, root2.left) # 处理两树的对应左子树, 返回的节点为当前合并子树的左子树
root1.right = find(root1.right, root2.right) # 处理两树的对应右子树
elif root1 or root2: # 只存在一个节点, 直接返回存在的节点即可
return root1 if root1 else root2
else:
return None # 均不存在返回None
return root1
t = find(t1, t2)
return t | [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
732,
13720,
29871,
584,
365,
29954,
13,
13,
15945,
29908,
13,
233,
140,
170,
30448,
30406,
30594,
30383,
29896,
29900,
29946,
10887,
29892,
29871,
30505,
30744,
30417,
5132,
29941,
29871,
31302,
31398,
30275,
31768,
31955,
30743,
29953,
29946,
29889,
29896,
29900,
29995,
29871,
30210,
30406,
31229,
13,
30728,
30946,
31276,
235,
131,
154,
30383,
29896,
29946,
29889,
29946,
13232,
29892,
29871,
30505,
30744,
30417,
5132,
29941,
29871,
31302,
31398,
30275,
31768,
31955,
30743,
29955,
29929,
29889,
29941,
29945,
29995,
29871,
30210,
30406,
31229,
13,
13,
31201,
31596,
31579,
30874,
30383,
13,
268,
232,
136,
186,
30988,
31195,
31424,
235,
170,
132,
30690,
31183,
31368,
236,
138,
141,
13,
15945,
29908,
13,
1990,
24380,
29901,
13,
1678,
822,
10366,
29911,
11003,
29898,
1311,
29892,
260,
29896,
29901,
15472,
4247,
29892,
260,
29906,
29901,
15472,
4247,
29897,
1599,
15472,
4247,
29901,
13,
4706,
822,
1284,
29898,
4632,
29896,
29892,
3876,
29906,
1125,
396,
29871,
31977,
233,
166,
184,
233,
163,
148,
30210,
30783,
31370,
31669,
30940,
13,
9651,
565,
3876,
29896,
322,
3876,
29906,
29901,
396,
29871,
30847,
30801,
31669,
30940,
30769,
30946,
30505,
13,
18884,
2943,
353,
15472,
4247,
29898,
4632,
29896,
29889,
791,
718,
3876,
29906,
29889,
791,
29897,
29871,
396,
29871,
30733,
31666,
30822,
30210,
30948,
30658,
31669,
30940,
30573,
31977,
233,
163,
148,
31669,
30940,
30503,
13,
18884,
2943,
29889,
1563,
353,
1284,
29898,
4632,
29896,
29889,
1563,
29892,
3876,
29906,
29889,
1563,
29897,
1678,
396,
29871,
31548,
30687,
31977,
233,
163,
148,
30210,
30783,
31370,
31651,
30319,
233,
163,
148,
30214,
29871,
31086,
30742,
30210,
31669,
30940,
30573,
30948,
30658,
30733,
31666,
30319,
233,
163,
148,
30210,
31651,
30319,
233,
163,
148,
13,
18884,
2943,
29889,
1266,
353,
1284,
29898,
4632,
29896,
29889,
1266,
29892,
3876,
29906,
29889,
1266,
29897,
396,
29871,
31548,
30687,
31977,
233,
163,
148,
30210,
30783,
31370,
31803,
30319,
233,
163,
148,
13,
13,
9651,
25342,
3876,
29896,
470,
3876,
29906,
29901,
1678,
396,
29871,
31557,
30946,
30505,
30287,
30502,
31669,
30940,
13,
18884,
2943,
353,
15472,
4247,
29898,
4632,
29896,
29889,
791,
565,
3876,
29896,
1683,
3876,
29906,
29889,
791,
29897,
29871,
396,
29871,
30948,
30658,
31669,
30940,
31184,
30909,
30946,
30505,
31669,
30940,
30959,
13,
18884,
2943,
29889,
1563,
353,
1284,
29898,
4632,
29896,
29889,
1563,
565,
3876,
29896,
1683,
6213,
29892,
3876,
29906,
29889,
1563,
565,
3876,
29906,
1683,
6213,
29897,
29871,
396,
29871,
236,
132,
144,
232,
145,
137,
30946,
30505,
31669,
30940,
30210,
31651,
30319,
233,
163,
148,
13,
18884,
2943,
29889,
1266,
353,
1284,
29898,
4632,
29896,
29889,
1266,
565,
3876,
29896,
1683,
6213,
29892,
3876,
29906,
29889,
1266,
565,
3876,
29906,
1683,
6213,
29897,
259,
396,
29871,
236,
132,
144,
232,
145,
137,
30946,
30505,
31669,
30940,
30210,
31803,
30319,
233,
163,
148,
13,
9651,
1683,
29901,
13,
18884,
736,
6213,
396,
29871,
232,
160,
138,
30413,
30946,
30505,
31086,
30742,
8516,
13,
9651,
736,
2943,
13,
4706,
260,
353,
1284,
29898,
29873,
29896,
29892,
260,
29906,
29897,
13,
4706,
736,
260,
13,
13,
13,
15945,
29908,
13,
233,
140,
170,
30448,
30406,
30594,
30383,
29896,
29900,
29900,
10887,
29892,
29871,
30505,
30744,
30417,
5132,
29941,
29871,
31302,
31398,
30275,
31768,
31955,
30743,
29929,
29896,
29889,
29953,
29896,
29995,
29871,
30210,
30406,
31229,
13,
30728,
30946,
31276,
235,
131,
154,
30383,
29896,
29946,
29889,
29945,
13232,
29892,
29871,
30505,
30744,
30417,
5132,
29941,
29871,
31302,
31398,
30275,
31768,
31955,
30743,
29946,
29953,
29889,
29941,
29941,
29995,
29871,
30210,
30406,
31229,
13,
13,
31201,
31596,
31579,
30874,
30383,
13,
268,
30980,
30429,
30214,
231,
192,
137,
30413,
30374,
30886,
233,
163,
148,
13,
15945,
29908,
13,
1990,
24380,
29901,
13,
1678,
822,
10366,
29911,
11003,
29898,
1311,
29892,
260,
29896,
29901,
15472,
4247,
29892,
260,
29906,
29901,
15472,
4247,
29897,
1599,
15472,
4247,
29901,
13,
4706,
822,
1284,
29898,
4632,
29896,
29892,
3876,
29906,
1125,
396,
29871,
31977,
233,
166,
184,
233,
163,
148,
30210,
30783,
31370,
31669,
30940,
13,
9651,
565,
3876,
29896,
322,
3876,
29906,
29901,
396,
29871,
30847,
30801,
31669,
30940,
30769,
30946,
30505,
13,
18884,
3876,
29896,
29889,
791,
353,
3876,
29896,
29889,
791,
718,
3876,
29906,
29889,
791,
29871,
396,
29871,
30733,
31666,
30822,
30210,
30948,
30658,
31669,
30940,
30573,
31977,
233,
163,
148,
31669,
30940,
30503,
13,
18884,
3876,
29896,
29889,
1563,
353,
1284,
29898,
4632,
29896,
29889,
1563,
29892,
3876,
29906,
29889,
1563,
29897,
1678,
396,
29871,
31548,
30687,
31977,
233,
163,
148,
30210,
30783,
31370,
31651,
30319,
233,
163,
148,
30214,
29871,
31086,
30742,
30210,
31669,
30940,
30573,
30948,
30658,
30733,
31666,
30319,
233,
163,
148,
30210,
31651,
30319,
233,
163,
148,
13,
18884,
3876,
29896,
29889,
1266,
353,
1284,
29898,
4632,
29896,
29889,
1266,
29892,
3876,
29906,
29889,
1266,
29897,
396,
29871,
31548,
30687,
31977,
233,
163,
148,
30210,
30783,
31370,
31803,
30319,
233,
163,
148,
13,
13,
9651,
25342,
3876,
29896,
470,
3876,
29906,
29901,
1678,
396,
29871,
31557,
30946,
30505,
30287,
30502,
31669,
30940,
29892,
29871,
31157,
31092,
31086,
30742,
30946,
30505,
30210,
31669,
30940,
232,
144,
182,
30682,
13,
18884,
736,
3876,
29896,
565,
3876,
29896,
1683,
3876,
29906,
13,
9651,
1683,
29901,
13,
18884,
736,
6213,
396,
29871,
232,
160,
138,
30413,
30946,
30505,
31086,
30742,
8516,
13,
9651,
736,
3876,
29896,
13,
4706,
260,
353,
1284,
29898,
29873,
29896,
29892,
260,
29906,
29897,
13,
4706,
736,
260,
2
] |
Ex021-Tocando_um_mp3.py | Diego-Sil/Python_do_Curso_em_Video | 0 | 110403 | import pygame
pygame.mixer.init()
pygame.init()
pygame.mixer.music.load('asus-yamete-kudasai.mp3')
pygame.mixer.music.play()
pygame.event.wait()
| [
1,
1053,
22028,
13,
2272,
11802,
29889,
28084,
261,
29889,
2344,
580,
13,
2272,
11802,
29889,
2344,
580,
13,
2272,
11802,
29889,
28084,
261,
29889,
23596,
29889,
1359,
877,
294,
375,
29899,
29891,
314,
2650,
29899,
29895,
566,
294,
1794,
29889,
1526,
29941,
1495,
13,
2272,
11802,
29889,
28084,
261,
29889,
23596,
29889,
1456,
580,
13,
2272,
11802,
29889,
3696,
29889,
10685,
580,
13,
13,
2
] |
tests/test_search_core.py | dinghino/searchengine | 0 | 75747 | <gh_stars>0
"""
Testing module for the search core functionalities
"""
from search import core
from tests.helpers import Item
class TestCore:
@classmethod
def setup_class(cls):
cls.items = Item.setup()
cls.search = core.SearchEngine(['words'], limit=10)
def test_single_words(self):
seq = Item.get_by_length(max_length=1)
res = self.search('inconvene', seq)
assert res == ['inconvenience']
res = self.search('laugh', seq)
assert res == ['laughter']
def test_short_phrases(self):
seq = Item.get_by_length(3, 5)
results = self.search('sherlock holmes', seq)
reversed_query_results = self.search('holmes sherlock', seq)
expected = [
'sherlock holmes clapped upon knee',
'sherlock holmes foretold exquisite mouth',
'sherlock holmes upon grey walls',
'sherlock holmes wrote english capital',
]
assert results == expected
assert reversed_query_results == expected
results = self.search('watson', seq)
assert results == [
"watson have learned something",
"what wanted what doctor watson",
]
def test_search_with_params(self):
seq = Item.get_by_length(3, 5)
res = self.search('sherlock holmes', seq, limit=2, threshold=.95)
expected = [
'sherlock holmes clapped upon knee',
'sherlock holmes foretold exquisite mouth',
]
assert res == expected
def test_search_long_phrases(self):
seq = Item.get_by_length(12, 15)
results = self.search('sherlock holmes', seq)
expected = [
'facts these about four clock when sherlock holmes took step between wharf ruffian pursued', # noqa: E501
'moment intimacy there were other traces sherlock holmes stopped front aberdeen shipping company', # noqa: E501
'rushed down just have taken mind understand from some small dealings with sherlock holmes', # noqa: E501
'sherlock holmes brought gush hope which sank into desultory chat with over despair', # noqa: E501
'sherlock holmes great many scattered papers have whatever bears upon stone professional work attend' # noqa: E501
]
assert results == expected
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
3057,
292,
3883,
363,
278,
2740,
7136,
13303,
1907,
13,
15945,
29908,
13,
3166,
2740,
1053,
7136,
13,
3166,
6987,
29889,
3952,
6774,
1053,
10976,
13,
13,
13,
1990,
4321,
9203,
29901,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
6230,
29918,
1990,
29898,
25932,
1125,
13,
4706,
1067,
29879,
29889,
7076,
353,
10976,
29889,
14669,
580,
13,
4706,
1067,
29879,
29889,
4478,
353,
7136,
29889,
7974,
12412,
18959,
9303,
7464,
4046,
29922,
29896,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
14369,
29918,
9303,
29898,
1311,
1125,
13,
4706,
19359,
353,
10976,
29889,
657,
29918,
1609,
29918,
2848,
29898,
3317,
29918,
2848,
29922,
29896,
29897,
13,
13,
4706,
620,
353,
1583,
29889,
4478,
877,
262,
535,
854,
29872,
742,
19359,
29897,
13,
4706,
4974,
620,
1275,
6024,
262,
535,
854,
5597,
2033,
13,
13,
4706,
620,
353,
1583,
29889,
4478,
877,
433,
6129,
742,
19359,
29897,
13,
4706,
4974,
620,
1275,
6024,
433,
6129,
357,
2033,
13,
13,
1678,
822,
1243,
29918,
12759,
29918,
24588,
2129,
29898,
1311,
1125,
13,
4706,
19359,
353,
10976,
29889,
657,
29918,
1609,
29918,
2848,
29898,
29941,
29892,
29871,
29945,
29897,
13,
4706,
2582,
353,
1583,
29889,
4478,
877,
845,
261,
908,
8753,
4467,
742,
19359,
29897,
13,
4706,
18764,
287,
29918,
1972,
29918,
9902,
353,
1583,
29889,
4478,
877,
5391,
4467,
528,
261,
908,
742,
19359,
29897,
13,
4706,
3806,
353,
518,
13,
9651,
525,
845,
261,
908,
8753,
4467,
3711,
2986,
2501,
17905,
29872,
742,
13,
9651,
525,
845,
261,
908,
8753,
4467,
363,
300,
1025,
429,
7680,
568,
13394,
742,
13,
9651,
525,
845,
261,
908,
8753,
4467,
2501,
18345,
14603,
742,
13,
9651,
525,
845,
261,
908,
8753,
4467,
5456,
3033,
1674,
7483,
742,
13,
4706,
4514,
13,
13,
4706,
4974,
2582,
1275,
3806,
13,
4706,
4974,
18764,
287,
29918,
1972,
29918,
9902,
1275,
3806,
13,
4706,
2582,
353,
1583,
29889,
4478,
877,
29893,
271,
1100,
742,
19359,
29897,
13,
4706,
4974,
2582,
1275,
518,
13,
9651,
376,
29893,
271,
1100,
505,
10972,
1554,
613,
13,
9651,
376,
5816,
5131,
825,
11619,
16699,
1100,
613,
13,
4706,
4514,
13,
13,
1678,
822,
1243,
29918,
4478,
29918,
2541,
29918,
7529,
29898,
1311,
1125,
13,
4706,
19359,
353,
10976,
29889,
657,
29918,
1609,
29918,
2848,
29898,
29941,
29892,
29871,
29945,
29897,
13,
4706,
620,
353,
1583,
29889,
4478,
877,
845,
261,
908,
8753,
4467,
742,
19359,
29892,
4046,
29922,
29906,
29892,
16897,
21098,
29929,
29945,
29897,
13,
4706,
3806,
353,
518,
13,
9651,
525,
845,
261,
908,
8753,
4467,
3711,
2986,
2501,
17905,
29872,
742,
13,
9651,
525,
845,
261,
908,
8753,
4467,
363,
300,
1025,
429,
7680,
568,
13394,
742,
13,
4706,
4514,
13,
4706,
4974,
620,
1275,
3806,
13,
13,
1678,
822,
1243,
29918,
4478,
29918,
5426,
29918,
24588,
2129,
29898,
1311,
1125,
13,
4706,
19359,
353,
10976,
29889,
657,
29918,
1609,
29918,
2848,
29898,
29896,
29906,
29892,
29871,
29896,
29945,
29897,
13,
4706,
2582,
353,
1583,
29889,
4478,
877,
845,
261,
908,
8753,
4467,
742,
19359,
29897,
13,
4706,
3806,
353,
518,
13,
9651,
525,
17028,
29879,
1438,
1048,
3023,
12006,
746,
528,
261,
908,
8753,
4467,
3614,
4331,
1546,
377,
29293,
364,
3096,
713,
12359,
6742,
742,
9651,
396,
694,
25621,
29901,
382,
29945,
29900,
29896,
13,
9651,
525,
29885,
2932,
938,
326,
4135,
727,
892,
916,
26695,
528,
261,
908,
8753,
4467,
11084,
4565,
6126,
311,
264,
528,
17347,
5001,
742,
418,
396,
694,
25621,
29901,
382,
29945,
29900,
29896,
13,
9651,
525,
29878,
15392,
1623,
925,
505,
4586,
3458,
2274,
515,
777,
2319,
5376,
886,
411,
528,
261,
908,
8753,
4467,
742,
9651,
396,
694,
25621,
29901,
382,
29945,
29900,
29896,
13,
9651,
525,
845,
261,
908,
8753,
4467,
6296,
330,
1878,
4966,
607,
269,
804,
964,
553,
499,
706,
13563,
411,
975,
8913,
1466,
742,
462,
259,
396,
694,
25621,
29901,
382,
29945,
29900,
29896,
13,
9651,
525,
845,
261,
908,
8753,
4467,
2107,
1784,
29574,
15055,
505,
6514,
367,
1503,
2501,
12565,
10257,
664,
14333,
29915,
259,
396,
694,
25621,
29901,
382,
29945,
29900,
29896,
13,
4706,
4514,
13,
4706,
4974,
2582,
1275,
3806,
13,
2
] |
stian/day_thirteen/python/day_thirteen.py | stian-eng/advent-2021 | 0 | 65965 | <reponame>stian-eng/advent-2021
from requests.api import get
import time
import aoc_frame
def get_points(data) :
points = []
instr = []
flag = True
for i in data :
if i :
if flag :
x, y = i.split(',')
points.append((int(x), int(y)))
else :
y = i.split()
x = y[-1]
axis, num = x.split('=')
instr.append((axis, int(num)))
else :
flag = False
return points, instr
def fold(points, fold) :
if fold[0] == 'y' :
for i in range(len(points)) :
curr = points[i]
if curr[1] > fold[1] :
points[i] = (curr[0], fold[1] - (curr[1] - fold[1]))
elif fold[0] == 'x' :
for i in range(len(points)) :
curr = points[i]
if curr[0] > fold[1] :
points[i] = (fold[1] - (curr[0] - fold[1]), curr[1])
return points
def part_one(data, flag2) :
points, instr = get_points(data)
for f in instr :
points = fold(points, f)
if flag2 :
seen = set()
count = 0
for i in points :
if i not in seen :
seen.add(i)
count += 1
return count
return points
def part_two(data) :
points = part_one(data, False)
max_x = max([i[0] for i in points])
max_y = max([i[1] for i in points])
matrix = [[' ' for i in range(max_x + 1)] for i in range(max_y + 1)]
seen = set()
for p in points :
if p not in seen :
matrix[p[1]][p[0]] = '#'
seen.add(p)
for i in matrix :
print(i)
# answer:
"""
[[' ', '#', '#', ' ', ' ', '#', '#', '#', ' ', ' ', '#', ' ', ' ', '#', ' ', '#', '#', '#', '#', ' ', '#', '#', '#', ' ', ' ', ' ', '#', '#', ' ', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#'],
['#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', ' ', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#'],
['#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', '#', '#', '#', ' ', ' ', ' ', '#', ' ', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', '#', ' ', '#', '#', '#', '#'],
['#', '#', '#', '#', ' ', '#', '#', '#', ' ', ' ', '#', ' ', ' ', '#', ' ', ' ', '#', ' ', ' ', ' ', '#', '#', '#', ' ', ' ', '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#'],
['#', ' ', ' ', '#', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#'],
['#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', '#', '#', '#', '#', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', '#', ' ', ' ', ' ', '#', '#', ' ', ' ', '#', ' ', ' ', '#']]
"""
if __name__ == '__main__' :
data = []
test = []
with open('day_thirteen.txt', 'r') as f :
for line in f.readlines() :
data.append(line.strip('\n'))
with open('test.txt', 'r') as f :
for line in f.readlines() :
test.append(line.strip('\n'))
t0 = time.time()
aoc_frame.format_strings(part_one(data, True), part_one(test, True), 1, t0)
t0 = time.time()
aoc_frame.format_strings(part_two(data), part_two(test), 2, t0) | [
1,
529,
276,
1112,
420,
29958,
303,
713,
29899,
996,
29914,
328,
794,
29899,
29906,
29900,
29906,
29896,
13,
3166,
7274,
29889,
2754,
1053,
679,
13,
5215,
931,
13,
5215,
263,
542,
29918,
2557,
13,
13,
1753,
679,
29918,
9748,
29898,
1272,
29897,
584,
13,
1678,
3291,
353,
5159,
13,
1678,
297,
710,
353,
5159,
13,
1678,
7353,
353,
5852,
13,
1678,
363,
474,
297,
848,
584,
13,
4706,
565,
474,
584,
13,
9651,
565,
7353,
584,
13,
18884,
921,
29892,
343,
353,
474,
29889,
5451,
29317,
1495,
13,
18884,
3291,
29889,
4397,
3552,
524,
29898,
29916,
511,
938,
29898,
29891,
4961,
13,
9651,
1683,
584,
13,
18884,
343,
353,
474,
29889,
5451,
580,
13,
18884,
921,
353,
343,
14352,
29896,
29962,
13,
18884,
9685,
29892,
954,
353,
921,
29889,
5451,
877,
29922,
1495,
13,
18884,
297,
710,
29889,
4397,
3552,
8990,
29892,
938,
29898,
1949,
4961,
13,
4706,
1683,
584,
13,
9651,
7353,
353,
7700,
13,
13,
1678,
736,
3291,
29892,
297,
710,
13,
13,
13,
1753,
900,
29881,
29898,
9748,
29892,
900,
29881,
29897,
584,
13,
1678,
565,
900,
29881,
29961,
29900,
29962,
1275,
525,
29891,
29915,
584,
13,
9651,
363,
474,
297,
3464,
29898,
2435,
29898,
9748,
876,
584,
13,
18884,
16256,
353,
3291,
29961,
29875,
29962,
13,
18884,
565,
16256,
29961,
29896,
29962,
1405,
900,
29881,
29961,
29896,
29962,
584,
13,
462,
1678,
3291,
29961,
29875,
29962,
353,
313,
21962,
29961,
29900,
1402,
900,
29881,
29961,
29896,
29962,
448,
313,
21962,
29961,
29896,
29962,
448,
900,
29881,
29961,
29896,
12622,
13,
308,
13,
1678,
25342,
900,
29881,
29961,
29900,
29962,
1275,
525,
29916,
29915,
584,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
9748,
876,
584,
13,
9651,
16256,
353,
3291,
29961,
29875,
29962,
13,
9651,
565,
16256,
29961,
29900,
29962,
1405,
900,
29881,
29961,
29896,
29962,
584,
13,
18884,
3291,
29961,
29875,
29962,
353,
313,
8771,
29961,
29896,
29962,
448,
313,
21962,
29961,
29900,
29962,
448,
900,
29881,
29961,
29896,
11724,
16256,
29961,
29896,
2314,
13,
268,
13,
1678,
736,
3291,
13,
13,
1753,
760,
29918,
650,
29898,
1272,
29892,
7353,
29906,
29897,
584,
13,
1678,
3291,
29892,
297,
710,
353,
679,
29918,
9748,
29898,
1272,
29897,
13,
13,
1678,
363,
285,
297,
297,
710,
584,
13,
4706,
3291,
353,
900,
29881,
29898,
9748,
29892,
285,
29897,
13,
4706,
565,
7353,
29906,
584,
13,
9651,
3595,
353,
731,
580,
13,
9651,
2302,
353,
29871,
29900,
13,
9651,
363,
474,
297,
3291,
584,
13,
18884,
565,
474,
451,
297,
3595,
584,
13,
462,
1678,
3595,
29889,
1202,
29898,
29875,
29897,
13,
462,
1678,
2302,
4619,
29871,
29896,
13,
308,
13,
9651,
736,
2302,
13,
268,
13,
1678,
736,
3291,
13,
13,
13,
1753,
760,
29918,
10184,
29898,
1272,
29897,
584,
13,
1678,
3291,
353,
760,
29918,
650,
29898,
1272,
29892,
7700,
29897,
13,
1678,
4236,
29918,
29916,
353,
4236,
4197,
29875,
29961,
29900,
29962,
363,
474,
297,
3291,
2314,
13,
1678,
4236,
29918,
29891,
353,
4236,
4197,
29875,
29961,
29896,
29962,
363,
474,
297,
3291,
2314,
13,
1678,
4636,
353,
518,
1839,
525,
363,
474,
297,
3464,
29898,
3317,
29918,
29916,
718,
29871,
29896,
4638,
363,
474,
297,
3464,
29898,
3317,
29918,
29891,
718,
29871,
29896,
4638,
13,
1678,
3595,
353,
731,
580,
13,
1678,
363,
282,
297,
3291,
584,
13,
4706,
565,
282,
451,
297,
3595,
584,
13,
9651,
4636,
29961,
29886,
29961,
29896,
29962,
3816,
29886,
29961,
29900,
5262,
353,
16321,
29915,
13,
9651,
3595,
29889,
1202,
29898,
29886,
29897,
13,
1678,
363,
474,
297,
4636,
584,
13,
4706,
1596,
29898,
29875,
29897,
13,
13,
1678,
396,
1234,
29901,
13,
1678,
9995,
13,
1678,
518,
1839,
13420,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
7464,
29871,
13,
268,
6024,
29937,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
7464,
29871,
13,
268,
6024,
29937,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
16321,
7464,
29871,
13,
268,
6024,
29937,
742,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
7464,
29871,
13,
268,
6024,
29937,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
7464,
29871,
13,
268,
6024,
29937,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
16321,
742,
16321,
742,
16321,
742,
16321,
742,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
525,
13420,
16321,
742,
16321,
742,
525,
13420,
525,
13420,
16321,
742,
525,
13420,
525,
13420,
16321,
2033,
29962,
13,
1678,
9995,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
29915,
584,
13,
1678,
848,
353,
5159,
13,
1678,
1243,
353,
5159,
13,
13,
1678,
411,
1722,
877,
3250,
29918,
386,
381,
9404,
29889,
3945,
742,
525,
29878,
1495,
408,
285,
584,
13,
4706,
363,
1196,
297,
285,
29889,
949,
9012,
580,
584,
13,
9651,
848,
29889,
4397,
29898,
1220,
29889,
17010,
28909,
29876,
8785,
13,
268,
13,
1678,
411,
1722,
877,
1688,
29889,
3945,
742,
525,
29878,
1495,
408,
285,
584,
13,
4706,
363,
1196,
297,
285,
29889,
949,
9012,
580,
584,
13,
9651,
1243,
29889,
4397,
29898,
1220,
29889,
17010,
28909,
29876,
8785,
13,
13,
1678,
260,
29900,
353,
931,
29889,
2230,
580,
13,
1678,
263,
542,
29918,
2557,
29889,
4830,
29918,
19651,
29898,
1595,
29918,
650,
29898,
1272,
29892,
5852,
511,
760,
29918,
650,
29898,
1688,
29892,
5852,
511,
29871,
29896,
29892,
260,
29900,
29897,
13,
268,
13,
1678,
260,
29900,
353,
931,
29889,
2230,
580,
13,
1678,
263,
542,
29918,
2557,
29889,
4830,
29918,
19651,
29898,
1595,
29918,
10184,
29898,
1272,
511,
760,
29918,
10184,
29898,
1688,
511,
29871,
29906,
29892,
260,
29900,
29897,
2
] |
queue_services/common/tests/integration/test_queue_connections.py | argush3/lear | 8 | 139742 | <reponame>argush3/lear
# Copyright © 2019 Province of British Columbia
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The Test Suite to ensure queue connections are working as expected."""
import pytest
from nats.aio.client import Client as Nats
from stan.aio.client import Client as Stan
from stan.aio.errors import StanError
@pytest.mark.asyncio
async def test_queue_connection(stan_server, event_loop, client_id):
"""Assert that we connect to the queue configuration used by the tests."""
nc = Nats()
await nc.connect(loop=event_loop)
sc = Stan()
await sc.connect('test-cluster', client_id, nats=nc)
assert sc._pub_prefix # pylint: disable=protected-access; sc does not expose a connection check
assert sc._conn_id # pylint: disable=protected-access; sc does not expose a connection check
await sc.close() # should not close the connection
assert nc.is_connected
with pytest.raises(StanError):
await sc.close()
await nc.close()
assert not nc.is_connected
| [
1,
529,
276,
1112,
420,
29958,
1191,
1878,
29941,
29914,
1945,
13,
29937,
14187,
1266,
29871,
30211,
29871,
29906,
29900,
29896,
29929,
17325,
310,
4908,
15411,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
15945,
29908,
1576,
4321,
2166,
568,
304,
9801,
9521,
12368,
526,
1985,
408,
3806,
1213,
15945,
13,
5215,
11451,
1688,
13,
3166,
302,
1446,
29889,
29874,
601,
29889,
4645,
1053,
12477,
408,
405,
1446,
13,
3166,
11075,
29889,
29874,
601,
29889,
4645,
1053,
12477,
408,
7813,
13,
3166,
11075,
29889,
29874,
601,
29889,
12523,
1053,
7813,
2392,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
294,
948,
3934,
13,
12674,
822,
1243,
29918,
9990,
29918,
9965,
29898,
14411,
29918,
2974,
29892,
1741,
29918,
7888,
29892,
3132,
29918,
333,
1125,
13,
1678,
9995,
14697,
393,
591,
4511,
304,
278,
9521,
5285,
1304,
491,
278,
6987,
1213,
15945,
13,
1678,
302,
29883,
353,
405,
1446,
580,
13,
1678,
7272,
302,
29883,
29889,
6915,
29898,
7888,
29922,
3696,
29918,
7888,
29897,
13,
13,
1678,
885,
353,
7813,
580,
13,
1678,
7272,
885,
29889,
6915,
877,
1688,
29899,
19594,
742,
3132,
29918,
333,
29892,
302,
1446,
29922,
17608,
29897,
13,
13,
1678,
4974,
885,
3032,
5467,
29918,
13506,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
29936,
885,
947,
451,
24396,
263,
3957,
1423,
13,
1678,
4974,
885,
3032,
13082,
29918,
333,
29871,
396,
282,
2904,
524,
29901,
11262,
29922,
24681,
29899,
5943,
29936,
885,
947,
451,
24396,
263,
3957,
1423,
13,
13,
1678,
7272,
885,
29889,
5358,
580,
29871,
396,
881,
451,
3802,
278,
3957,
13,
1678,
4974,
302,
29883,
29889,
275,
29918,
18045,
13,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
855,
273,
2392,
1125,
13,
4706,
7272,
885,
29889,
5358,
580,
13,
13,
1678,
7272,
302,
29883,
29889,
5358,
580,
13,
1678,
4974,
451,
302,
29883,
29889,
275,
29918,
18045,
13,
2
] |
docs/generate_example_images.py | KhaledSharif/kornia | 0 | 8661 | <reponame>KhaledSharif/kornia<gh_stars>0
import importlib
import math
import os
from pathlib import Path
from typing import Optional, Tuple
import cv2
import numpy as np
import requests
import torch
import kornia as K
def read_img_from_url(url: str, resize_to: Optional[Tuple[int, int]] = None) -> torch.Tensor:
# perform request
response = requests.get(url).content
# convert to array of ints
nparr = np.frombuffer(response, np.uint8)
# convert to image array and resize
img: np.ndarray = cv2.imdecode(nparr, cv2.IMREAD_UNCHANGED)[..., :3]
# convert the image to a tensor
img_t: torch.Tensor = K.utils.image_to_tensor(img, keepdim=False) # 1xCxHXW
img_t = img_t.float() / 255.0
if resize_to is None:
img_t = K.geometry.resize(img_t, 184)
else:
img_t = K.geometry.resize(img_t, resize_to)
return img_t
def main():
# load the images
BASE_IMAGE_URL1: str = "https://raw.githubusercontent.com/kornia/data/main/panda.jpg" # augmentation
BASE_IMAGE_URL2: str = "https://raw.githubusercontent.com/kornia/data/main/simba.png" # color
BASE_IMAGE_URL3: str = "https://raw.githubusercontent.com/kornia/data/main/girona.png" # enhance
BASE_IMAGE_URL4: str = "https://raw.githubusercontent.com/kornia/data/main/baby_giraffe.png" # morphology
BASE_IMAGE_URL5: str = "https://raw.githubusercontent.com/kornia/data/main/persistencia_memoria.jpg" # filters
BASE_IMAGE_URL6: str = "https://raw.githubusercontent.com/kornia/data/main/delorean.png" # geometry
OUTPUT_PATH = Path(__file__).absolute().parent / "source/_static/img"
os.makedirs(OUTPUT_PATH, exist_ok=True)
print(f"Pointing images to path {OUTPUT_PATH}.")
img1 = read_img_from_url(BASE_IMAGE_URL1)
img2 = read_img_from_url(BASE_IMAGE_URL2, img1.shape[-2:])
img3 = read_img_from_url(BASE_IMAGE_URL3, img1.shape[-2:])
img4 = read_img_from_url(BASE_IMAGE_URL4)
img5 = read_img_from_url(BASE_IMAGE_URL5, (234, 320))
img6 = read_img_from_url(BASE_IMAGE_URL6)
# TODO: make this more generic for modules out of kornia.augmentation
# Dictionary containing the transforms to generate the sample images:
# Key: Name of the transform class.
# Value: (parameters, num_samples, seed)
mod = importlib.import_module("kornia.augmentation")
augmentations_list: dict = {
"CenterCrop": ((184, 184), 1, 2018),
"ColorJitter": ((0.3, 0.3, 0.3, 0.3), 2, 2018),
"RandomAffine": (((-15.0, 20.0), (0.1, 0.1), (0.7, 1.3), 20), 2, 2019),
"RandomBoxBlur": (((7, 7),), 1, 2020),
"RandomCrop": ((img1.shape[-2:], (50, 50)), 2, 2020),
"RandomChannelShuffle": ((), 1, 2020),
"RandomElasticTransform": (((63, 63), (32, 32), (2.0, 2.0)), 2, 2018),
"RandomEqualize": ((), 1, 2020),
"RandomErasing": (((0.2, 0.4), (0.3, 1 / 0.3)), 2, 2017),
"RandomFisheye": ((torch.tensor([-0.3, 0.3]), torch.tensor([-0.3, 0.3]), torch.tensor([0.9, 1.0])), 2, 2020),
"RandomGaussianBlur": (((3, 3), (0.1, 2.0)), 1, 2020),
"RandomGaussianNoise": ((0.0, 0.05), 1, 2020),
"RandomGrayscale": ((), 1, 2020),
"RandomHorizontalFlip": ((), 1, 2020),
"RandomInvert": ((), 1, 2020),
"RandomMotionBlur": ((7, 35.0, 0.5), 2, 2020),
"RandomPerspective": ((0.2,), 2, 2020),
"RandomPlanckianJitter": ((), 2, 2022),
"RandomPosterize": (((1, 4),), 2, 2016),
"RandomResizedCrop": ((img1.shape[-2:], (1.0, 2.0), (1.0, 2.0)), 2, 2020),
"RandomRotation": ((45.0,), 2, 2019),
"RandomSharpness": ((16.0,), 1, 2019),
"RandomSolarize": ((0.2, 0.2), 2, 2019),
"RandomVerticalFlip": ((), 1, 2020),
"RandomThinPlateSpline": ((), 1, 2020),
}
# ITERATE OVER THE TRANSFORMS
for aug_name, (args, num_samples, seed) in augmentations_list.items():
img_in = img1.repeat(num_samples, 1, 1, 1)
# dynamically create the class instance
cls = getattr(mod, aug_name)
aug = cls(*args, p=1.0)
# set seed
torch.manual_seed(seed)
# apply the augmentaiton to the image and concat
out = aug(img_in)
if aug_name == "CenterCrop":
h, w = img1.shape[-2:]
h_new, w_new = out.shape[-2:]
h_dif, w_dif = int(h - h_new), int(w - w_new)
out = torch.nn.functional.pad(out, (w_dif // 2, w_dif // 2, 0, h_dif))
out = torch.cat([img_in[0], *(out[i] for i in range(out.size(0)))], dim=-1)
# save the output image
out_np = K.utils.tensor_to_image((out * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{aug_name}.png"), out_np)
sig = f"{aug_name}({', '.join([str(a) for a in args])}, p=1.0)"
print(f"Generated image example for {aug_name}. {sig}")
mod = importlib.import_module("kornia.augmentation")
mix_augmentations_list: dict = {
"RandomMixUp": (((0.3, 0.4),), 2, 20),
"RandomCutMix": ((img1.shape[-2], img1.shape[-1]), 2, 2019),
}
# ITERATE OVER THE TRANSFORMS
for aug_name, (args, num_samples, seed) in mix_augmentations_list.items():
img_in = torch.cat([img1, img2])
# dynamically create the class instance
cls = getattr(mod, aug_name)
aug = cls(*args, p=1.0)
# set seed
torch.manual_seed(seed)
# apply the augmentaiton to the image and concat
out, _ = aug(img_in, torch.tensor([0, 1]))
out = torch.cat([img_in[0], img_in[1], *(out[i] for i in range(out.size(0)))], dim=-1)
# save the output image
out_np = K.utils.tensor_to_image((out * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{aug_name}.png"), out_np)
sig = f"{aug_name}({', '.join([str(a) for a in args])}, p=1.0)"
print(f"Generated image example for {aug_name}. {sig}")
mod = importlib.import_module("kornia.color")
color_transforms_list: dict = {
"grayscale_to_rgb": ((), 3),
"rgb_to_bgr": ((), 1),
"rgb_to_grayscale": ((), 1),
"rgb_to_hsv": ((), 1),
"rgb_to_hls": ((), 1),
"rgb_to_luv": ((), 1),
"rgb_to_lab": ((), 1),
# "rgb_to_rgba": ((1.,), 1),
"rgb_to_xyz": ((), 1),
"rgb_to_ycbcr": ((), 1),
"rgb_to_yuv": ((), 1),
"rgb_to_linear_rgb": ((), 1),
}
# ITERATE OVER THE TRANSFORMS
for fn_name, (args, num_samples) in color_transforms_list.items():
# import function and apply
fn = getattr(mod, fn_name)
if fn_name == "grayscale_to_rgb":
out = fn(K.color.rgb_to_grayscale(img2), *args)
else:
out = fn(img2, *args)
# perform normalization to visualize
if fn_name == "rgb_to_lab":
out = out[:, :1] / 100.0
elif fn_name == "rgb_to_hsv":
out[:, :1] = out[:, :1] / 2 * math.pi
elif fn_name == "rgb_to_luv":
out = out[:, :1] / 116.0
# repeat channels for grayscale
if out.shape[1] != 3:
out = out.repeat(1, 3, 1, 1)
# save the output image
if fn_name == "grayscale_to_rgb":
out = torch.cat(
[K.color.rgb_to_grayscale(img2[0]).repeat(3, 1, 1), *(out[i] for i in range(out.size(0)))], dim=-1
)
else:
out = torch.cat([img2[0], *(out[i] for i in range(out.size(0)))], dim=-1)
out_np = K.utils.tensor_to_image((out * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{fn_name}.png"), out_np)
sig = f"{fn_name}({', '.join([str(a) for a in args])})"
print(f"Generated image example for {fn_name}. {sig}")
# korna.enhance module
mod = importlib.import_module("kornia.enhance")
transforms: dict = {
"adjust_brightness": ((torch.tensor([0.25, 0.5]),), 2),
"adjust_contrast": ((torch.tensor([0.65, 0.5]),), 2),
"adjust_gamma": ((torch.tensor([0.85, 0.75]), 2.0), 2),
"adjust_hue": ((torch.tensor([-math.pi / 4, math.pi / 4]),), 2),
"adjust_saturation": ((torch.tensor([1.0, 2.0]),), 2),
"solarize": ((torch.tensor([0.8, 0.5]), torch.tensor([-0.25, 0.25])), 2),
"posterize": ((torch.tensor([4, 2]),), 2),
"sharpness": ((torch.tensor([1.0, 2.5]),), 2),
"equalize": ((), 1),
"invert": ((), 1),
"equalize_clahe": ((), 1),
"add_weighted": ((0.75, 0.25, 2.0), 1),
}
# ITERATE OVER THE TRANSFORMS
for fn_name, (args, num_samples) in transforms.items():
img_in = img3.repeat(num_samples, 1, 1, 1)
if fn_name == "add_weighted":
args_in = (img_in, args[0], img2, args[1], args[2])
else:
args_in = (img_in, *args)
# import function and apply
fn = getattr(mod, fn_name)
out = fn(*args_in)
# save the output image
out = torch.cat([img_in[0], *(out[i] for i in range(out.size(0)))], dim=-1)
out_np = K.utils.tensor_to_image((out * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{fn_name}.png"), out_np)
sig = f"{fn_name}({', '.join([str(a) for a in args])})"
print(f"Generated image example for {fn_name}. {sig}")
# korna.morphology module
mod = importlib.import_module("kornia.morphology")
kernel = torch.tensor([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
transforms: dict = {
"dilation": ((kernel,), 1),
"erosion": ((kernel,), 1),
"opening": ((kernel,), 1),
"closing": ((kernel,), 1),
"gradient": ((kernel,), 1),
"top_hat": ((kernel,), 1),
"bottom_hat": ((kernel,), 1),
}
# ITERATE OVER THE TRANSFORMS
for fn_name, (args, num_samples) in transforms.items():
img_in = img4.repeat(num_samples, 1, 1, 1)
args_in = (img_in, *args)
# import function and apply
# import pdb;pdb.set_trace()
fn = getattr(mod, fn_name)
out = fn(*args_in)
# save the output image
out = torch.cat([img_in[0], *(out[i] for i in range(out.size(0)))], dim=-1)
out_np = K.utils.tensor_to_image((out * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{fn_name}.png"), out_np)
sig = f"{fn_name}({', '.join([str(a) for a in args])})"
print(f"Generated image example for {fn_name}. {sig}")
# korna.filters module
mod = importlib.import_module("kornia.filters")
kernel = torch.tensor([[0, 1, 0], [1, 1, 1], [0, 1, 0]])
transforms: dict = {
"box_blur": (((5, 5),), 1),
"median_blur": (((5, 5),), 1),
"gaussian_blur2d": (((5, 5), (1.5, 1.5)), 1),
"motion_blur": ((5, 90.0, 1.0), 1),
"max_blur_pool2d": ((5,), 1),
"blur_pool2d": ((5,), 1),
"unsharp_mask": (((5, 5), (1.5, 1.5)), 1),
"laplacian": ((5,), 1),
"sobel": ((), 1),
"spatial_gradient": ((), 1),
"canny": ((), 1),
}
# ITERATE OVER THE TRANSFORMS
for fn_name, (args, num_samples) in transforms.items():
img_in = img5.repeat(num_samples, 1, 1, 1)
args_in = (img_in, *args)
# import function and apply
fn = getattr(mod, fn_name)
out = fn(*args_in)
if fn_name in ("max_blur_pool2d", "blur_pool2d"):
out = K.geometry.resize(out, img_in.shape[-2:])
if fn_name == "canny":
out = out[1].repeat(1, 3, 1, 1)
if isinstance(out, torch.Tensor):
out = out.clamp(min=0.0, max=1.0)
if fn_name in ("laplacian", "sobel", "spatial_gradient", "canny"):
out = K.enhance.normalize_min_max(out)
if fn_name == "spatial_gradient":
out = out.permute(2, 1, 0, 3, 4).squeeze()
# save the output image
out = torch.cat([img_in[0], *(out[i] for i in range(out.size(0)))], dim=-1)
out_np = K.utils.tensor_to_image((out * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{fn_name}.png"), out_np)
sig = f"{fn_name}({', '.join([str(a) for a in args])})"
print(f"Generated image example for {fn_name}. {sig}")
# korna.geometry.transform module
mod = importlib.import_module("kornia.geometry.transform")
h, w = img6.shape[-2:]
def _get_tps_args():
src = torch.tensor([[[-1.0, -1.0], [-1.0, 1.0], [1.0, -1.0], [1.0, -1.0], [0.0, 0.0]]]).repeat(2, 1, 1) # Bx5x2
dst = src + torch.distributions.Uniform(-0.2, 0.2).rsample((2, 5, 2))
kernel, affine = K.geometry.transform.get_tps_transform(dst, src)
return src, kernel, affine
transforms: dict = {
"warp_affine": (
(
K.geometry.transform.get_affine_matrix2d(
translations=torch.zeros(2, 2),
center=(torch.tensor([w, h]) / 2).repeat(2, 1),
scale=torch.distributions.Uniform(0.5, 1.5).rsample((2, 2)),
angle=torch.tensor([-25.0, 25.0]),
)[:, :2, :3],
(h, w),
),
2,
),
"remap": (
(
*(K.utils.create_meshgrid(h, w, normalized_coordinates=True) - 0.25).unbind(-1),
'bilinear',
'zeros',
True,
True,
),
1,
),
"warp_image_tps": ((_get_tps_args()), 2),
"rotate": ((torch.tensor([-15.0, 25.0]),), 2),
"translate": ((torch.tensor([[10.0, -15], [50.0, -25.0]]),), 2),
"scale": ((torch.tensor([[0.5, 1.25], [1.0, 1.5]]),), 2),
"shear": ((torch.tensor([[0.1, -0.2], [-0.2, 0.1]]),), 2),
"rot180": ((), 1),
"hflip": ((), 1),
"vflip": ((), 1),
"resize": (((120, 220),), 1),
"rescale": ((0.5,), 1),
"elastic_transform2d": ((torch.rand(1, 2, h, w) * 2 - 1, (63, 63), (32, 32), (4.0, 4.0)), 1),
"pyrdown": ((), 1),
"pyrup": ((), 1),
"build_pyramid": ((3,), 1),
}
# ITERATE OVER THE TRANSFORMS
for fn_name, (args, num_samples) in transforms.items():
img_in = img6.repeat(num_samples, 1, 1, 1)
args_in = (img_in, *args)
# import function and apply
fn = getattr(mod, fn_name)
out = fn(*args_in)
if fn_name in ("resize", "rescale", "pyrdown", "pyrup"):
h_new, w_new = out.shape[-2:]
out = torch.nn.functional.pad(out, (0, (w - w_new), 0, (h - h_new)))
if fn_name == "build_pyramid":
_out = []
for pyr in out[1:]:
h_new, w_new = pyr.shape[-2:]
out_tmp = torch.nn.functional.pad(pyr, (0, (w - w_new), 0, (h - h_new)))
_out.append(out_tmp)
out = torch.cat(_out)
# save the output image
out = torch.cat([img_in[0], *(out[i] for i in range(out.size(0)))], dim=-1)
out_np = K.utils.tensor_to_image((out * 255.0).byte())
cv2.imwrite(str(OUTPUT_PATH / f"{fn_name}.png"), out_np)
sig = f"{fn_name}({', '.join([str(a) for a in args])})"
print(f"Generated image example for {fn_name}. {sig}")
if __name__ == "__main__":
main()
| [
1,
529,
276,
1112,
420,
29958,
29968,
29882,
7943,
2713,
279,
361,
29914,
29895,
1398,
423,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
1053,
1982,
13,
5215,
5844,
13,
5215,
2897,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
19229,
1053,
28379,
29892,
12603,
552,
13,
13,
5215,
13850,
29906,
13,
5215,
12655,
408,
7442,
13,
5215,
7274,
13,
5215,
4842,
305,
13,
13,
5215,
413,
1398,
423,
408,
476,
13,
13,
13,
1753,
1303,
29918,
2492,
29918,
3166,
29918,
2271,
29898,
2271,
29901,
851,
29892,
19490,
29918,
517,
29901,
28379,
29961,
23215,
552,
29961,
524,
29892,
938,
5262,
353,
6213,
29897,
1599,
4842,
305,
29889,
29911,
6073,
29901,
13,
1678,
396,
2189,
2009,
13,
1678,
2933,
353,
7274,
29889,
657,
29898,
2271,
467,
3051,
13,
1678,
396,
3588,
304,
1409,
310,
938,
29879,
13,
1678,
302,
862,
29878,
353,
7442,
29889,
3166,
9040,
29898,
5327,
29892,
7442,
29889,
13470,
29947,
29897,
13,
1678,
396,
3588,
304,
1967,
1409,
322,
19490,
13,
1678,
10153,
29901,
7442,
29889,
299,
2378,
353,
13850,
29906,
29889,
326,
13808,
29898,
29876,
862,
29878,
29892,
13850,
29906,
29889,
7833,
16310,
29918,
3904,
3210,
24336,
29928,
9601,
16361,
584,
29941,
29962,
13,
1678,
396,
3588,
278,
1967,
304,
263,
12489,
13,
1678,
10153,
29918,
29873,
29901,
4842,
305,
29889,
29911,
6073,
353,
476,
29889,
13239,
29889,
3027,
29918,
517,
29918,
20158,
29898,
2492,
29892,
3013,
6229,
29922,
8824,
29897,
29871,
396,
29871,
29896,
29916,
29907,
29916,
29950,
29990,
29956,
13,
1678,
10153,
29918,
29873,
353,
10153,
29918,
29873,
29889,
7411,
580,
847,
29871,
29906,
29945,
29945,
29889,
29900,
13,
1678,
565,
19490,
29918,
517,
338,
6213,
29901,
13,
4706,
10153,
29918,
29873,
353,
476,
29889,
19156,
29889,
21476,
29898,
2492,
29918,
29873,
29892,
29871,
29896,
29947,
29946,
29897,
13,
1678,
1683,
29901,
13,
4706,
10153,
29918,
29873,
353,
476,
29889,
19156,
29889,
21476,
29898,
2492,
29918,
29873,
29892,
19490,
29918,
517,
29897,
13,
1678,
736,
10153,
29918,
29873,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
396,
2254,
278,
4558,
13,
1678,
350,
8127,
29918,
2382,
29918,
4219,
29896,
29901,
851,
353,
376,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
29895,
1398,
423,
29914,
1272,
29914,
3396,
29914,
29886,
5863,
29889,
6173,
29908,
29871,
396,
18765,
362,
13,
1678,
350,
8127,
29918,
2382,
29918,
4219,
29906,
29901,
851,
353,
376,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
29895,
1398,
423,
29914,
1272,
29914,
3396,
29914,
3601,
2291,
29889,
2732,
29908,
29871,
396,
2927,
13,
1678,
350,
8127,
29918,
2382,
29918,
4219,
29941,
29901,
851,
353,
376,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
29895,
1398,
423,
29914,
1272,
29914,
3396,
29914,
29887,
381,
2681,
29889,
2732,
29908,
29871,
396,
26371,
749,
13,
1678,
350,
8127,
29918,
2382,
29918,
4219,
29946,
29901,
851,
353,
376,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
29895,
1398,
423,
29914,
1272,
29914,
3396,
29914,
29890,
10798,
29918,
29887,
3055,
17615,
29889,
2732,
29908,
29871,
396,
18131,
3002,
13,
1678,
350,
8127,
29918,
2382,
29918,
4219,
29945,
29901,
851,
353,
376,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
29895,
1398,
423,
29914,
1272,
29914,
3396,
29914,
6774,
391,
5760,
29918,
6954,
4108,
29889,
6173,
29908,
29871,
396,
18094,
13,
1678,
350,
8127,
29918,
2382,
29918,
4219,
29953,
29901,
851,
353,
376,
991,
597,
1610,
29889,
3292,
1792,
3051,
29889,
510,
29914,
29895,
1398,
423,
29914,
1272,
29914,
3396,
29914,
6144,
487,
273,
29889,
2732,
29908,
29871,
396,
16303,
13,
1678,
19474,
12336,
29918,
10145,
353,
10802,
22168,
1445,
1649,
467,
23552,
2141,
3560,
847,
376,
4993,
19891,
7959,
29914,
2492,
29908,
13,
13,
1678,
2897,
29889,
29885,
12535,
12935,
29898,
12015,
12336,
29918,
10145,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
1678,
1596,
29898,
29888,
29908,
5228,
292,
4558,
304,
2224,
426,
12015,
12336,
29918,
10145,
1836,
1159,
13,
1678,
10153,
29896,
353,
1303,
29918,
2492,
29918,
3166,
29918,
2271,
29898,
25416,
29918,
2382,
29918,
4219,
29896,
29897,
13,
1678,
10153,
29906,
353,
1303,
29918,
2492,
29918,
3166,
29918,
2271,
29898,
25416,
29918,
2382,
29918,
4219,
29906,
29892,
10153,
29896,
29889,
12181,
14352,
29906,
29901,
2314,
13,
1678,
10153,
29941,
353,
1303,
29918,
2492,
29918,
3166,
29918,
2271,
29898,
25416,
29918,
2382,
29918,
4219,
29941,
29892,
10153,
29896,
29889,
12181,
14352,
29906,
29901,
2314,
13,
1678,
10153,
29946,
353,
1303,
29918,
2492,
29918,
3166,
29918,
2271,
29898,
25416,
29918,
2382,
29918,
4219,
29946,
29897,
13,
1678,
10153,
29945,
353,
1303,
29918,
2492,
29918,
3166,
29918,
2271,
29898,
25416,
29918,
2382,
29918,
4219,
29945,
29892,
313,
29906,
29941,
29946,
29892,
29871,
29941,
29906,
29900,
876,
13,
1678,
10153,
29953,
353,
1303,
29918,
2492,
29918,
3166,
29918,
2271,
29898,
25416,
29918,
2382,
29918,
4219,
29953,
29897,
13,
13,
1678,
396,
14402,
29901,
1207,
445,
901,
10035,
363,
10585,
714,
310,
413,
1398,
423,
29889,
2987,
358,
362,
13,
1678,
396,
13343,
6943,
278,
4327,
29879,
304,
5706,
278,
4559,
4558,
29901,
13,
1678,
396,
7670,
29901,
4408,
310,
278,
4327,
770,
29889,
13,
1678,
396,
7865,
29901,
313,
16744,
29892,
954,
29918,
27736,
29892,
16717,
29897,
13,
1678,
878,
353,
1053,
1982,
29889,
5215,
29918,
5453,
703,
29895,
1398,
423,
29889,
2987,
358,
362,
1159,
13,
1678,
18765,
800,
29918,
1761,
29901,
9657,
353,
426,
13,
4706,
376,
13409,
29907,
1336,
1115,
5135,
29896,
29947,
29946,
29892,
29871,
29896,
29947,
29946,
511,
29871,
29896,
29892,
29871,
29906,
29900,
29896,
29947,
511,
13,
4706,
376,
3306,
29967,
5171,
1115,
5135,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29941,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29947,
511,
13,
4706,
376,
17875,
27867,
457,
1115,
313,
3552,
29899,
29896,
29945,
29889,
29900,
29892,
29871,
29906,
29900,
29889,
29900,
511,
313,
29900,
29889,
29896,
29892,
29871,
29900,
29889,
29896,
511,
313,
29900,
29889,
29955,
29892,
29871,
29896,
29889,
29941,
511,
29871,
29906,
29900,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29929,
511,
13,
4706,
376,
17875,
3313,
10358,
332,
1115,
313,
3552,
29955,
29892,
29871,
29955,
511,
511,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
29907,
1336,
1115,
5135,
2492,
29896,
29889,
12181,
14352,
29906,
29901,
1402,
313,
29945,
29900,
29892,
29871,
29945,
29900,
8243,
29871,
29906,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
13599,
2713,
21897,
1115,
313,
3285,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
29923,
4230,
293,
13372,
1115,
313,
3552,
29953,
29941,
29892,
29871,
29953,
29941,
511,
313,
29941,
29906,
29892,
29871,
29941,
29906,
511,
313,
29906,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
8243,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29947,
511,
13,
4706,
376,
17875,
9843,
675,
1115,
313,
3285,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
2110,
5832,
1115,
313,
3552,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29946,
511,
313,
29900,
29889,
29941,
29892,
29871,
29896,
847,
29871,
29900,
29889,
29941,
8243,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29955,
511,
13,
4706,
376,
17875,
29943,
275,
354,
4099,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29899,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29941,
11724,
4842,
305,
29889,
20158,
4197,
29899,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29941,
11724,
4842,
305,
29889,
20158,
4197,
29900,
29889,
29929,
29892,
29871,
29896,
29889,
29900,
2314,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
29954,
17019,
10358,
332,
1115,
313,
3552,
29941,
29892,
29871,
29941,
511,
313,
29900,
29889,
29896,
29892,
29871,
29906,
29889,
29900,
8243,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
29954,
17019,
3782,
895,
1115,
5135,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
29945,
511,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
29954,
764,
7052,
1115,
313,
3285,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
24932,
29943,
3466,
1115,
313,
3285,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
797,
1765,
1115,
313,
3285,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
29924,
8194,
10358,
332,
1115,
5135,
29955,
29892,
29871,
29941,
29945,
29889,
29900,
29892,
29871,
29900,
29889,
29945,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
15136,
12645,
1115,
5135,
29900,
29889,
29906,
29892,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
20334,
384,
713,
29967,
5171,
1115,
313,
3285,
29871,
29906,
29892,
29871,
29906,
29900,
29906,
29906,
511,
13,
4706,
376,
17875,
6747,
261,
675,
1115,
313,
3552,
29896,
29892,
29871,
29946,
511,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29953,
511,
13,
4706,
376,
17875,
1666,
1891,
29907,
1336,
1115,
5135,
2492,
29896,
29889,
12181,
14352,
29906,
29901,
1402,
313,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
511,
313,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
8243,
29871,
29906,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
21281,
362,
1115,
5135,
29946,
29945,
29889,
29900,
29892,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29929,
511,
13,
4706,
376,
17875,
2713,
6834,
2264,
1115,
5135,
29896,
29953,
29889,
29900,
29892,
511,
29871,
29896,
29892,
29871,
29906,
29900,
29896,
29929,
511,
13,
4706,
376,
17875,
29903,
10170,
675,
1115,
5135,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29906,
511,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29929,
511,
13,
4706,
376,
17875,
29270,
29943,
3466,
1115,
313,
3285,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
4706,
376,
17875,
1349,
262,
3247,
403,
29903,
572,
457,
1115,
313,
3285,
29871,
29896,
29892,
29871,
29906,
29900,
29906,
29900,
511,
13,
1678,
500,
13,
13,
1678,
396,
306,
4945,
3040,
438,
5348,
6093,
10014,
2190,
20322,
1955,
4345,
13,
1678,
363,
11307,
29918,
978,
29892,
313,
5085,
29892,
954,
29918,
27736,
29892,
16717,
29897,
297,
18765,
800,
29918,
1761,
29889,
7076,
7295,
13,
4706,
10153,
29918,
262,
353,
10153,
29896,
29889,
14358,
29898,
1949,
29918,
27736,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
396,
11200,
1653,
278,
770,
2777,
13,
4706,
1067,
29879,
353,
679,
5552,
29898,
1545,
29892,
11307,
29918,
978,
29897,
13,
4706,
11307,
353,
1067,
29879,
10456,
5085,
29892,
282,
29922,
29896,
29889,
29900,
29897,
13,
4706,
396,
731,
16717,
13,
4706,
4842,
305,
29889,
11288,
29918,
26776,
29898,
26776,
29897,
13,
4706,
396,
3394,
278,
18765,
1249,
265,
304,
278,
1967,
322,
3022,
271,
13,
4706,
714,
353,
11307,
29898,
2492,
29918,
262,
29897,
13,
13,
4706,
565,
11307,
29918,
978,
1275,
376,
13409,
29907,
1336,
1115,
13,
9651,
298,
29892,
281,
353,
10153,
29896,
29889,
12181,
14352,
29906,
17531,
13,
9651,
298,
29918,
1482,
29892,
281,
29918,
1482,
353,
714,
29889,
12181,
14352,
29906,
17531,
13,
9651,
298,
29918,
29881,
361,
29892,
281,
29918,
29881,
361,
353,
938,
29898,
29882,
448,
298,
29918,
1482,
511,
938,
29898,
29893,
448,
281,
29918,
1482,
29897,
13,
9651,
714,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
8305,
29898,
449,
29892,
313,
29893,
29918,
29881,
361,
849,
29871,
29906,
29892,
281,
29918,
29881,
361,
849,
29871,
29906,
29892,
29871,
29900,
29892,
298,
29918,
29881,
361,
876,
13,
13,
4706,
714,
353,
4842,
305,
29889,
4117,
4197,
2492,
29918,
262,
29961,
29900,
1402,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
29897,
13,
4706,
396,
4078,
278,
1962,
1967,
13,
4706,
714,
29918,
9302,
353,
476,
29889,
13239,
29889,
20158,
29918,
517,
29918,
3027,
3552,
449,
334,
29871,
29906,
29945,
29945,
29889,
29900,
467,
10389,
3101,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
710,
29898,
12015,
12336,
29918,
10145,
847,
285,
29908,
29912,
2987,
29918,
978,
1836,
2732,
4968,
714,
29918,
9302,
29897,
13,
4706,
4365,
353,
285,
29908,
29912,
2987,
29918,
978,
2119,
29912,
742,
15300,
7122,
4197,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
2314,
1118,
282,
29922,
29896,
29889,
29900,
5513,
13,
4706,
1596,
29898,
29888,
29908,
24565,
1967,
1342,
363,
426,
2987,
29918,
978,
1836,
426,
18816,
27195,
13,
13,
1678,
878,
353,
1053,
1982,
29889,
5215,
29918,
5453,
703,
29895,
1398,
423,
29889,
2987,
358,
362,
1159,
13,
1678,
6837,
29918,
2987,
358,
800,
29918,
1761,
29901,
9657,
353,
426,
13,
4706,
376,
17875,
29924,
861,
3373,
1115,
313,
3552,
29900,
29889,
29941,
29892,
29871,
29900,
29889,
29946,
511,
511,
29871,
29906,
29892,
29871,
29906,
29900,
511,
13,
4706,
376,
17875,
29907,
329,
29924,
861,
1115,
5135,
2492,
29896,
29889,
12181,
14352,
29906,
1402,
10153,
29896,
29889,
12181,
14352,
29896,
11724,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29929,
511,
13,
1678,
500,
13,
1678,
396,
306,
4945,
3040,
438,
5348,
6093,
10014,
2190,
20322,
1955,
4345,
13,
1678,
363,
11307,
29918,
978,
29892,
313,
5085,
29892,
954,
29918,
27736,
29892,
16717,
29897,
297,
6837,
29918,
2987,
358,
800,
29918,
1761,
29889,
7076,
7295,
13,
4706,
10153,
29918,
262,
353,
4842,
305,
29889,
4117,
4197,
2492,
29896,
29892,
10153,
29906,
2314,
13,
4706,
396,
11200,
1653,
278,
770,
2777,
13,
4706,
1067,
29879,
353,
679,
5552,
29898,
1545,
29892,
11307,
29918,
978,
29897,
13,
4706,
11307,
353,
1067,
29879,
10456,
5085,
29892,
282,
29922,
29896,
29889,
29900,
29897,
13,
4706,
396,
731,
16717,
13,
4706,
4842,
305,
29889,
11288,
29918,
26776,
29898,
26776,
29897,
13,
4706,
396,
3394,
278,
18765,
1249,
265,
304,
278,
1967,
322,
3022,
271,
13,
4706,
714,
29892,
903,
353,
11307,
29898,
2492,
29918,
262,
29892,
4842,
305,
29889,
20158,
4197,
29900,
29892,
29871,
29896,
12622,
13,
4706,
714,
353,
4842,
305,
29889,
4117,
4197,
2492,
29918,
262,
29961,
29900,
1402,
10153,
29918,
262,
29961,
29896,
1402,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
29897,
13,
4706,
396,
4078,
278,
1962,
1967,
13,
4706,
714,
29918,
9302,
353,
476,
29889,
13239,
29889,
20158,
29918,
517,
29918,
3027,
3552,
449,
334,
29871,
29906,
29945,
29945,
29889,
29900,
467,
10389,
3101,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
710,
29898,
12015,
12336,
29918,
10145,
847,
285,
29908,
29912,
2987,
29918,
978,
1836,
2732,
4968,
714,
29918,
9302,
29897,
13,
4706,
4365,
353,
285,
29908,
29912,
2987,
29918,
978,
2119,
29912,
742,
15300,
7122,
4197,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
2314,
1118,
282,
29922,
29896,
29889,
29900,
5513,
13,
4706,
1596,
29898,
29888,
29908,
24565,
1967,
1342,
363,
426,
2987,
29918,
978,
1836,
426,
18816,
27195,
13,
13,
1678,
878,
353,
1053,
1982,
29889,
5215,
29918,
5453,
703,
29895,
1398,
423,
29889,
2780,
1159,
13,
1678,
2927,
29918,
9067,
29879,
29918,
1761,
29901,
9657,
353,
426,
13,
4706,
376,
21012,
7052,
29918,
517,
29918,
23973,
1115,
313,
3285,
29871,
29941,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
29890,
629,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
21012,
7052,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
29882,
4501,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
29882,
3137,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
29880,
4090,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
8205,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
396,
376,
23973,
29918,
517,
29918,
11007,
2291,
1115,
5135,
29896,
1696,
511,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
20230,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
29891,
10702,
7283,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
29891,
4090,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
23973,
29918,
517,
29918,
10660,
29918,
23973,
1115,
313,
3285,
29871,
29896,
511,
13,
1678,
500,
13,
1678,
396,
306,
4945,
3040,
438,
5348,
6093,
10014,
2190,
20322,
1955,
4345,
13,
1678,
363,
7876,
29918,
978,
29892,
313,
5085,
29892,
954,
29918,
27736,
29897,
297,
2927,
29918,
9067,
29879,
29918,
1761,
29889,
7076,
7295,
13,
4706,
396,
1053,
740,
322,
3394,
13,
4706,
7876,
353,
679,
5552,
29898,
1545,
29892,
7876,
29918,
978,
29897,
13,
4706,
565,
7876,
29918,
978,
1275,
376,
21012,
7052,
29918,
517,
29918,
23973,
1115,
13,
9651,
714,
353,
7876,
29898,
29968,
29889,
2780,
29889,
23973,
29918,
517,
29918,
21012,
7052,
29898,
2492,
29906,
511,
334,
5085,
29897,
13,
4706,
1683,
29901,
13,
9651,
714,
353,
7876,
29898,
2492,
29906,
29892,
334,
5085,
29897,
13,
4706,
396,
2189,
4226,
2133,
304,
7604,
675,
13,
4706,
565,
7876,
29918,
978,
1275,
376,
23973,
29918,
517,
29918,
8205,
1115,
13,
9651,
714,
353,
714,
7503,
29892,
584,
29896,
29962,
847,
29871,
29896,
29900,
29900,
29889,
29900,
13,
4706,
25342,
7876,
29918,
978,
1275,
376,
23973,
29918,
517,
29918,
29882,
4501,
1115,
13,
9651,
714,
7503,
29892,
584,
29896,
29962,
353,
714,
7503,
29892,
584,
29896,
29962,
847,
29871,
29906,
334,
5844,
29889,
1631,
13,
4706,
25342,
7876,
29918,
978,
1275,
376,
23973,
29918,
517,
29918,
29880,
4090,
1115,
13,
9651,
714,
353,
714,
7503,
29892,
584,
29896,
29962,
847,
29871,
29896,
29896,
29953,
29889,
29900,
13,
4706,
396,
12312,
18196,
363,
16749,
7052,
13,
4706,
565,
714,
29889,
12181,
29961,
29896,
29962,
2804,
29871,
29941,
29901,
13,
9651,
714,
353,
714,
29889,
14358,
29898,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
396,
4078,
278,
1962,
1967,
13,
4706,
565,
7876,
29918,
978,
1275,
376,
21012,
7052,
29918,
517,
29918,
23973,
1115,
13,
9651,
714,
353,
4842,
305,
29889,
4117,
29898,
13,
18884,
518,
29968,
29889,
2780,
29889,
23973,
29918,
517,
29918,
21012,
7052,
29898,
2492,
29906,
29961,
29900,
14664,
14358,
29898,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
511,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
714,
353,
4842,
305,
29889,
4117,
4197,
2492,
29906,
29961,
29900,
1402,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
29897,
13,
4706,
714,
29918,
9302,
353,
476,
29889,
13239,
29889,
20158,
29918,
517,
29918,
3027,
3552,
449,
334,
29871,
29906,
29945,
29945,
29889,
29900,
467,
10389,
3101,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
710,
29898,
12015,
12336,
29918,
10145,
847,
285,
29908,
29912,
9144,
29918,
978,
1836,
2732,
4968,
714,
29918,
9302,
29897,
13,
4706,
4365,
353,
285,
29908,
29912,
9144,
29918,
978,
2119,
29912,
742,
15300,
7122,
4197,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
2314,
1800,
29908,
13,
4706,
1596,
29898,
29888,
29908,
24565,
1967,
1342,
363,
426,
9144,
29918,
978,
1836,
426,
18816,
27195,
13,
13,
1678,
396,
10871,
1056,
29889,
264,
29882,
749,
3883,
13,
1678,
878,
353,
1053,
1982,
29889,
5215,
29918,
5453,
703,
29895,
1398,
423,
29889,
264,
29882,
749,
1159,
13,
1678,
4327,
29879,
29901,
9657,
353,
426,
13,
4706,
376,
328,
5143,
29918,
1182,
523,
2264,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29900,
29889,
29906,
29945,
29892,
29871,
29900,
29889,
29945,
11724,
511,
29871,
29906,
511,
13,
4706,
376,
328,
5143,
29918,
9996,
579,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29900,
29889,
29953,
29945,
29892,
29871,
29900,
29889,
29945,
11724,
511,
29871,
29906,
511,
13,
4706,
376,
328,
5143,
29918,
4283,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29900,
29889,
29947,
29945,
29892,
29871,
29900,
29889,
29955,
29945,
11724,
29871,
29906,
29889,
29900,
511,
29871,
29906,
511,
13,
4706,
376,
328,
5143,
29918,
29882,
434,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29899,
755,
29889,
1631,
847,
29871,
29946,
29892,
5844,
29889,
1631,
847,
29871,
29946,
11724,
511,
29871,
29906,
511,
13,
4706,
376,
328,
5143,
29918,
29879,
1337,
362,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29900,
11724,
511,
29871,
29906,
511,
13,
4706,
376,
2929,
279,
675,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29900,
29889,
29947,
29892,
29871,
29900,
29889,
29945,
11724,
4842,
305,
29889,
20158,
4197,
29899,
29900,
29889,
29906,
29945,
29892,
29871,
29900,
29889,
29906,
29945,
2314,
511,
29871,
29906,
511,
13,
4706,
376,
2490,
261,
675,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29946,
29892,
29871,
29906,
11724,
511,
29871,
29906,
511,
13,
4706,
376,
22064,
2264,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29896,
29889,
29900,
29892,
29871,
29906,
29889,
29945,
11724,
511,
29871,
29906,
511,
13,
4706,
376,
11745,
675,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
262,
1765,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
11745,
675,
29918,
16398,
354,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
1202,
29918,
7915,
287,
1115,
5135,
29900,
29889,
29955,
29945,
29892,
29871,
29900,
29889,
29906,
29945,
29892,
29871,
29906,
29889,
29900,
511,
29871,
29896,
511,
13,
1678,
500,
13,
1678,
396,
306,
4945,
3040,
438,
5348,
6093,
10014,
2190,
20322,
1955,
4345,
13,
1678,
363,
7876,
29918,
978,
29892,
313,
5085,
29892,
954,
29918,
27736,
29897,
297,
4327,
29879,
29889,
7076,
7295,
13,
4706,
10153,
29918,
262,
353,
10153,
29941,
29889,
14358,
29898,
1949,
29918,
27736,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
565,
7876,
29918,
978,
1275,
376,
1202,
29918,
7915,
287,
1115,
13,
9651,
6389,
29918,
262,
353,
313,
2492,
29918,
262,
29892,
6389,
29961,
29900,
1402,
10153,
29906,
29892,
6389,
29961,
29896,
1402,
6389,
29961,
29906,
2314,
13,
4706,
1683,
29901,
13,
9651,
6389,
29918,
262,
353,
313,
2492,
29918,
262,
29892,
334,
5085,
29897,
13,
4706,
396,
1053,
740,
322,
3394,
13,
4706,
7876,
353,
679,
5552,
29898,
1545,
29892,
7876,
29918,
978,
29897,
13,
4706,
714,
353,
7876,
10456,
5085,
29918,
262,
29897,
13,
4706,
396,
4078,
278,
1962,
1967,
13,
4706,
714,
353,
4842,
305,
29889,
4117,
4197,
2492,
29918,
262,
29961,
29900,
1402,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
29897,
13,
4706,
714,
29918,
9302,
353,
476,
29889,
13239,
29889,
20158,
29918,
517,
29918,
3027,
3552,
449,
334,
29871,
29906,
29945,
29945,
29889,
29900,
467,
10389,
3101,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
710,
29898,
12015,
12336,
29918,
10145,
847,
285,
29908,
29912,
9144,
29918,
978,
1836,
2732,
4968,
714,
29918,
9302,
29897,
13,
4706,
4365,
353,
285,
29908,
29912,
9144,
29918,
978,
2119,
29912,
742,
15300,
7122,
4197,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
2314,
1800,
29908,
13,
4706,
1596,
29898,
29888,
29908,
24565,
1967,
1342,
363,
426,
9144,
29918,
978,
1836,
426,
18816,
27195,
13,
13,
1678,
396,
10871,
1056,
29889,
29885,
5676,
3002,
3883,
13,
1678,
878,
353,
1053,
1982,
29889,
5215,
29918,
5453,
703,
29895,
1398,
423,
29889,
29885,
5676,
3002,
1159,
13,
1678,
8466,
353,
4842,
305,
29889,
20158,
4197,
29961,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
24960,
13,
1678,
4327,
29879,
29901,
9657,
353,
426,
13,
4706,
376,
29881,
8634,
1115,
5135,
17460,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
9672,
291,
1115,
5135,
17460,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
3150,
292,
1115,
5135,
17460,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
11291,
292,
1115,
5135,
17460,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
24970,
1115,
5135,
17460,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
3332,
29918,
2455,
1115,
5135,
17460,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
8968,
29918,
2455,
1115,
5135,
17460,
29892,
511,
29871,
29896,
511,
13,
1678,
500,
13,
1678,
396,
306,
4945,
3040,
438,
5348,
6093,
10014,
2190,
20322,
1955,
4345,
13,
1678,
363,
7876,
29918,
978,
29892,
313,
5085,
29892,
954,
29918,
27736,
29897,
297,
4327,
29879,
29889,
7076,
7295,
13,
4706,
10153,
29918,
262,
353,
10153,
29946,
29889,
14358,
29898,
1949,
29918,
27736,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
6389,
29918,
262,
353,
313,
2492,
29918,
262,
29892,
334,
5085,
29897,
13,
4706,
396,
1053,
740,
322,
3394,
13,
4706,
396,
1053,
282,
2585,
29936,
29886,
2585,
29889,
842,
29918,
15003,
580,
13,
4706,
7876,
353,
679,
5552,
29898,
1545,
29892,
7876,
29918,
978,
29897,
13,
4706,
714,
353,
7876,
10456,
5085,
29918,
262,
29897,
13,
4706,
396,
4078,
278,
1962,
1967,
13,
4706,
714,
353,
4842,
305,
29889,
4117,
4197,
2492,
29918,
262,
29961,
29900,
1402,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
29897,
13,
4706,
714,
29918,
9302,
353,
476,
29889,
13239,
29889,
20158,
29918,
517,
29918,
3027,
3552,
449,
334,
29871,
29906,
29945,
29945,
29889,
29900,
467,
10389,
3101,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
710,
29898,
12015,
12336,
29918,
10145,
847,
285,
29908,
29912,
9144,
29918,
978,
1836,
2732,
4968,
714,
29918,
9302,
29897,
13,
4706,
4365,
353,
285,
29908,
29912,
9144,
29918,
978,
2119,
29912,
742,
15300,
7122,
4197,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
2314,
1800,
29908,
13,
4706,
1596,
29898,
29888,
29908,
24565,
1967,
1342,
363,
426,
9144,
29918,
978,
1836,
426,
18816,
27195,
13,
13,
1678,
396,
10871,
1056,
29889,
26705,
3883,
13,
1678,
878,
353,
1053,
1982,
29889,
5215,
29918,
5453,
703,
29895,
1398,
423,
29889,
26705,
1159,
13,
1678,
8466,
353,
4842,
305,
29889,
20158,
4197,
29961,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1402,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
518,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
24960,
13,
1678,
4327,
29879,
29901,
9657,
353,
426,
13,
4706,
376,
1884,
29918,
2204,
332,
1115,
313,
3552,
29945,
29892,
29871,
29945,
511,
511,
29871,
29896,
511,
13,
4706,
376,
2168,
713,
29918,
2204,
332,
1115,
313,
3552,
29945,
29892,
29871,
29945,
511,
511,
29871,
29896,
511,
13,
4706,
376,
29887,
17019,
29918,
2204,
332,
29906,
29881,
1115,
313,
3552,
29945,
29892,
29871,
29945,
511,
313,
29896,
29889,
29945,
29892,
29871,
29896,
29889,
29945,
8243,
29871,
29896,
511,
13,
4706,
376,
29885,
8194,
29918,
2204,
332,
1115,
5135,
29945,
29892,
29871,
29929,
29900,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
511,
29871,
29896,
511,
13,
4706,
376,
3317,
29918,
2204,
332,
29918,
10109,
29906,
29881,
1115,
5135,
29945,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
2204,
332,
29918,
10109,
29906,
29881,
1115,
5135,
29945,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
348,
22064,
29918,
13168,
1115,
313,
3552,
29945,
29892,
29871,
29945,
511,
313,
29896,
29889,
29945,
29892,
29871,
29896,
29889,
29945,
8243,
29871,
29896,
511,
13,
4706,
376,
6984,
433,
28445,
1115,
5135,
29945,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
578,
6596,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
1028,
15238,
29918,
24970,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
29883,
14763,
1115,
313,
3285,
29871,
29896,
511,
13,
1678,
500,
13,
1678,
396,
306,
4945,
3040,
438,
5348,
6093,
10014,
2190,
20322,
1955,
4345,
13,
1678,
363,
7876,
29918,
978,
29892,
313,
5085,
29892,
954,
29918,
27736,
29897,
297,
4327,
29879,
29889,
7076,
7295,
13,
4706,
10153,
29918,
262,
353,
10153,
29945,
29889,
14358,
29898,
1949,
29918,
27736,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
6389,
29918,
262,
353,
313,
2492,
29918,
262,
29892,
334,
5085,
29897,
13,
4706,
396,
1053,
740,
322,
3394,
13,
4706,
7876,
353,
679,
5552,
29898,
1545,
29892,
7876,
29918,
978,
29897,
13,
4706,
714,
353,
7876,
10456,
5085,
29918,
262,
29897,
13,
4706,
565,
7876,
29918,
978,
297,
4852,
3317,
29918,
2204,
332,
29918,
10109,
29906,
29881,
613,
376,
2204,
332,
29918,
10109,
29906,
29881,
29908,
1125,
13,
9651,
714,
353,
476,
29889,
19156,
29889,
21476,
29898,
449,
29892,
10153,
29918,
262,
29889,
12181,
14352,
29906,
29901,
2314,
13,
4706,
565,
7876,
29918,
978,
1275,
376,
29883,
14763,
1115,
13,
9651,
714,
353,
714,
29961,
29896,
1822,
14358,
29898,
29896,
29892,
29871,
29941,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
565,
338,
8758,
29898,
449,
29892,
4842,
305,
29889,
29911,
6073,
1125,
13,
9651,
714,
353,
714,
29889,
695,
1160,
29898,
1195,
29922,
29900,
29889,
29900,
29892,
4236,
29922,
29896,
29889,
29900,
29897,
13,
4706,
565,
7876,
29918,
978,
297,
4852,
6984,
433,
28445,
613,
376,
578,
6596,
613,
376,
1028,
15238,
29918,
24970,
613,
376,
29883,
14763,
29908,
1125,
13,
9651,
714,
353,
476,
29889,
264,
29882,
749,
29889,
8945,
675,
29918,
1195,
29918,
3317,
29898,
449,
29897,
13,
4706,
565,
7876,
29918,
978,
1275,
376,
1028,
15238,
29918,
24970,
1115,
13,
9651,
714,
353,
714,
29889,
17858,
1082,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29941,
29892,
29871,
29946,
467,
29879,
802,
29872,
911,
580,
13,
4706,
396,
4078,
278,
1962,
1967,
13,
4706,
714,
353,
4842,
305,
29889,
4117,
4197,
2492,
29918,
262,
29961,
29900,
1402,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
29897,
13,
4706,
714,
29918,
9302,
353,
476,
29889,
13239,
29889,
20158,
29918,
517,
29918,
3027,
3552,
449,
334,
29871,
29906,
29945,
29945,
29889,
29900,
467,
10389,
3101,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
710,
29898,
12015,
12336,
29918,
10145,
847,
285,
29908,
29912,
9144,
29918,
978,
1836,
2732,
4968,
714,
29918,
9302,
29897,
13,
4706,
4365,
353,
285,
29908,
29912,
9144,
29918,
978,
2119,
29912,
742,
15300,
7122,
4197,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
2314,
1800,
29908,
13,
4706,
1596,
29898,
29888,
29908,
24565,
1967,
1342,
363,
426,
9144,
29918,
978,
1836,
426,
18816,
27195,
13,
13,
1678,
396,
10871,
1056,
29889,
19156,
29889,
9067,
3883,
13,
1678,
878,
353,
1053,
1982,
29889,
5215,
29918,
5453,
703,
29895,
1398,
423,
29889,
19156,
29889,
9067,
1159,
13,
1678,
298,
29892,
281,
353,
10153,
29953,
29889,
12181,
14352,
29906,
17531,
13,
13,
1678,
822,
903,
657,
29918,
29873,
567,
29918,
5085,
7295,
13,
4706,
4765,
353,
4842,
305,
29889,
20158,
4197,
8999,
29899,
29896,
29889,
29900,
29892,
448,
29896,
29889,
29900,
1402,
21069,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
29892,
448,
29896,
29889,
29900,
1402,
518,
29896,
29889,
29900,
29892,
448,
29896,
29889,
29900,
1402,
518,
29900,
29889,
29900,
29892,
29871,
29900,
29889,
29900,
5262,
14664,
14358,
29898,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
29871,
396,
350,
29916,
29945,
29916,
29906,
13,
4706,
29743,
353,
4765,
718,
4842,
305,
29889,
27691,
29879,
29889,
2525,
5560,
6278,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29906,
467,
2288,
981,
3552,
29906,
29892,
29871,
29945,
29892,
29871,
29906,
876,
13,
4706,
8466,
29892,
2756,
457,
353,
476,
29889,
19156,
29889,
9067,
29889,
657,
29918,
29873,
567,
29918,
9067,
29898,
22992,
29892,
4765,
29897,
13,
4706,
736,
4765,
29892,
8466,
29892,
2756,
457,
13,
13,
1678,
4327,
29879,
29901,
9657,
353,
426,
13,
4706,
376,
4495,
29886,
29918,
3470,
457,
1115,
313,
13,
9651,
313,
13,
18884,
476,
29889,
19156,
29889,
9067,
29889,
657,
29918,
3470,
457,
29918,
5344,
29906,
29881,
29898,
13,
462,
1678,
5578,
800,
29922,
7345,
305,
29889,
3298,
359,
29898,
29906,
29892,
29871,
29906,
511,
13,
462,
1678,
4818,
7607,
7345,
305,
29889,
20158,
4197,
29893,
29892,
298,
2314,
847,
29871,
29906,
467,
14358,
29898,
29906,
29892,
29871,
29896,
511,
13,
462,
1678,
6287,
29922,
7345,
305,
29889,
27691,
29879,
29889,
2525,
5560,
29898,
29900,
29889,
29945,
29892,
29871,
29896,
29889,
29945,
467,
2288,
981,
3552,
29906,
29892,
29871,
29906,
8243,
13,
462,
1678,
10696,
29922,
7345,
305,
29889,
20158,
4197,
29899,
29906,
29945,
29889,
29900,
29892,
29871,
29906,
29945,
29889,
29900,
11724,
13,
18884,
1723,
7503,
29892,
584,
29906,
29892,
584,
29941,
1402,
13,
18884,
313,
29882,
29892,
281,
511,
13,
9651,
10353,
13,
632,
29906,
29892,
13,
4706,
10353,
13,
4706,
376,
1745,
481,
1115,
313,
13,
9651,
313,
13,
18884,
334,
29898,
29968,
29889,
13239,
29889,
3258,
29918,
4467,
29882,
7720,
29898,
29882,
29892,
281,
29892,
4226,
1891,
29918,
1111,
24266,
29922,
5574,
29897,
448,
29871,
29900,
29889,
29906,
29945,
467,
348,
5355,
6278,
29896,
511,
13,
18884,
525,
18152,
457,
279,
742,
13,
18884,
525,
3298,
359,
742,
13,
18884,
5852,
29892,
13,
18884,
5852,
29892,
13,
9651,
10353,
13,
632,
29896,
29892,
13,
4706,
10353,
13,
4706,
376,
4495,
29886,
29918,
3027,
29918,
29873,
567,
1115,
5135,
29918,
657,
29918,
29873,
567,
29918,
5085,
25739,
29871,
29906,
511,
13,
4706,
376,
23361,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29899,
29896,
29945,
29889,
29900,
29892,
29871,
29906,
29945,
29889,
29900,
11724,
511,
29871,
29906,
511,
13,
4706,
376,
21652,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29961,
29896,
29900,
29889,
29900,
29892,
448,
29896,
29945,
1402,
518,
29945,
29900,
29889,
29900,
29892,
448,
29906,
29945,
29889,
29900,
5262,
511,
511,
29871,
29906,
511,
13,
4706,
376,
7052,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29961,
29900,
29889,
29945,
29892,
29871,
29896,
29889,
29906,
29945,
1402,
518,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29945,
5262,
511,
511,
29871,
29906,
511,
13,
4706,
376,
11360,
279,
1115,
5135,
7345,
305,
29889,
20158,
4197,
29961,
29900,
29889,
29896,
29892,
448,
29900,
29889,
29906,
1402,
21069,
29900,
29889,
29906,
29892,
29871,
29900,
29889,
29896,
5262,
511,
511,
29871,
29906,
511,
13,
4706,
376,
5450,
29896,
29947,
29900,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
29882,
29888,
3466,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
29894,
29888,
3466,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
21476,
1115,
313,
3552,
29896,
29906,
29900,
29892,
29871,
29906,
29906,
29900,
511,
511,
29871,
29896,
511,
13,
4706,
376,
690,
29883,
744,
1115,
5135,
29900,
29889,
29945,
29892,
511,
29871,
29896,
511,
13,
4706,
376,
295,
6288,
29918,
9067,
29906,
29881,
1115,
5135,
7345,
305,
29889,
9502,
29898,
29896,
29892,
29871,
29906,
29892,
298,
29892,
281,
29897,
334,
29871,
29906,
448,
29871,
29896,
29892,
313,
29953,
29941,
29892,
29871,
29953,
29941,
511,
313,
29941,
29906,
29892,
29871,
29941,
29906,
511,
313,
29946,
29889,
29900,
29892,
29871,
29946,
29889,
29900,
8243,
29871,
29896,
511,
13,
4706,
376,
2272,
29878,
3204,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
2272,
17827,
1115,
313,
3285,
29871,
29896,
511,
13,
4706,
376,
4282,
29918,
2272,
2572,
333,
1115,
5135,
29941,
29892,
511,
29871,
29896,
511,
13,
1678,
500,
13,
1678,
396,
306,
4945,
3040,
438,
5348,
6093,
10014,
2190,
20322,
1955,
4345,
13,
1678,
363,
7876,
29918,
978,
29892,
313,
5085,
29892,
954,
29918,
27736,
29897,
297,
4327,
29879,
29889,
7076,
7295,
13,
4706,
10153,
29918,
262,
353,
10153,
29953,
29889,
14358,
29898,
1949,
29918,
27736,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
6389,
29918,
262,
353,
313,
2492,
29918,
262,
29892,
334,
5085,
29897,
13,
4706,
396,
1053,
740,
322,
3394,
13,
4706,
7876,
353,
679,
5552,
29898,
1545,
29892,
7876,
29918,
978,
29897,
13,
4706,
714,
353,
7876,
10456,
5085,
29918,
262,
29897,
13,
4706,
565,
7876,
29918,
978,
297,
4852,
21476,
613,
376,
690,
29883,
744,
613,
376,
2272,
29878,
3204,
613,
376,
2272,
17827,
29908,
1125,
13,
9651,
298,
29918,
1482,
29892,
281,
29918,
1482,
353,
714,
29889,
12181,
14352,
29906,
17531,
13,
9651,
714,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
8305,
29898,
449,
29892,
313,
29900,
29892,
313,
29893,
448,
281,
29918,
1482,
511,
29871,
29900,
29892,
313,
29882,
448,
298,
29918,
1482,
4961,
13,
4706,
565,
7876,
29918,
978,
1275,
376,
4282,
29918,
2272,
2572,
333,
1115,
13,
9651,
903,
449,
353,
5159,
13,
9651,
363,
282,
4316,
297,
714,
29961,
29896,
29901,
5387,
13,
18884,
298,
29918,
1482,
29892,
281,
29918,
1482,
353,
282,
4316,
29889,
12181,
14352,
29906,
17531,
13,
18884,
714,
29918,
7050,
353,
4842,
305,
29889,
15755,
29889,
2220,
284,
29889,
8305,
29898,
2272,
29878,
29892,
313,
29900,
29892,
313,
29893,
448,
281,
29918,
1482,
511,
29871,
29900,
29892,
313,
29882,
448,
298,
29918,
1482,
4961,
13,
18884,
903,
449,
29889,
4397,
29898,
449,
29918,
7050,
29897,
13,
9651,
714,
353,
4842,
305,
29889,
4117,
7373,
449,
29897,
13,
4706,
396,
4078,
278,
1962,
1967,
13,
4706,
714,
353,
4842,
305,
29889,
4117,
4197,
2492,
29918,
262,
29961,
29900,
1402,
334,
29898,
449,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
449,
29889,
2311,
29898,
29900,
4961,
1402,
3964,
10457,
29896,
29897,
13,
4706,
714,
29918,
9302,
353,
476,
29889,
13239,
29889,
20158,
29918,
517,
29918,
3027,
3552,
449,
334,
29871,
29906,
29945,
29945,
29889,
29900,
467,
10389,
3101,
13,
4706,
13850,
29906,
29889,
326,
3539,
29898,
710,
29898,
12015,
12336,
29918,
10145,
847,
285,
29908,
29912,
9144,
29918,
978,
1836,
2732,
4968,
714,
29918,
9302,
29897,
13,
4706,
4365,
353,
285,
29908,
29912,
9144,
29918,
978,
2119,
29912,
742,
15300,
7122,
4197,
710,
29898,
29874,
29897,
363,
263,
297,
6389,
2314,
1800,
29908,
13,
4706,
1596,
29898,
29888,
29908,
24565,
1967,
1342,
363,
426,
9144,
29918,
978,
1836,
426,
18816,
27195,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
userprofile/migrations/0014_auto_20190430_2023.py | Riphiphip/website | 25 | 167600 | <gh_stars>10-100
# Generated by Django 2.0.10 on 2019-04-30 20:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('userprofile', '0013_auto_20190408_1825'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='social_slack',
),
migrations.AlterField(
model_name='profile',
name='social_battlenet',
field=models.CharField(blank=True, max_length=30, null=True, verbose_name='Battle.net-tag'),
),
migrations.AlterField(
model_name='profile',
name='social_git',
field=models.CharField(blank=True, max_length=30, null=True, verbose_name='Git navn'),
),
migrations.AlterField(
model_name='profile',
name='social_steam',
field=models.CharField(blank=True, max_length=30, null=True, verbose_name='Steam navn'),
),
]
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
29937,
3251,
630,
491,
15337,
29871,
29906,
29889,
29900,
29889,
29896,
29900,
373,
29871,
29906,
29900,
29896,
29929,
29899,
29900,
29946,
29899,
29941,
29900,
29871,
29906,
29900,
29901,
29906,
29941,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
1792,
10185,
742,
525,
29900,
29900,
29896,
29941,
29918,
6921,
29918,
29906,
29900,
29896,
29929,
29900,
29946,
29900,
29947,
29918,
29896,
29947,
29906,
29945,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
15941,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
10185,
742,
13,
9651,
1024,
2433,
24911,
29918,
29879,
2364,
742,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
10185,
742,
13,
9651,
1024,
2433,
24911,
29918,
29890,
1131,
2435,
300,
742,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
19465,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29941,
29900,
29892,
1870,
29922,
5574,
29892,
26952,
29918,
978,
2433,
29933,
5315,
29889,
1212,
29899,
4039,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
10185,
742,
13,
9651,
1024,
2433,
24911,
29918,
5559,
742,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
19465,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29941,
29900,
29892,
1870,
29922,
5574,
29892,
26952,
29918,
978,
2433,
28712,
6283,
29876,
5477,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
10185,
742,
13,
9651,
1024,
2433,
24911,
29918,
1655,
314,
742,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
19465,
29922,
5574,
29892,
4236,
29918,
2848,
29922,
29941,
29900,
29892,
1870,
29922,
5574,
29892,
26952,
29918,
978,
2433,
7789,
314,
6283,
29876,
5477,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
python2/probe_yd.py | Nzen/run_ydl | 0 | 22214 | <filename>python2/probe_yd.py<gh_stars>0
from sys import argv
from subprocess import call
try :
link = argv[ 1 ]
except IndexError:
link = raw_input( " - which url interests you? " )
try:
ydl_answ = call( "youtube-dl -F "+ link, shell = True )
if ydl_answ is not 0 :
print "-- failed "+ link + " code "+ str(ydl_answ)
except OSError as ose :
print "Execution failed:", ose
| [
1,
529,
9507,
29958,
4691,
29906,
29914,
771,
915,
29918,
2941,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
10876,
1053,
1852,
29894,
13,
3166,
1014,
5014,
1053,
1246,
13,
13,
13,
2202,
584,
13,
12,
2324,
353,
1852,
29894,
29961,
29871,
29896,
4514,
13,
19499,
11374,
2392,
29901,
13,
12,
2324,
353,
10650,
29918,
2080,
29898,
376,
448,
607,
3142,
20017,
366,
29973,
376,
1723,
13,
13,
2202,
29901,
13,
12,
2941,
29880,
29918,
550,
29893,
353,
1246,
29898,
376,
19567,
29899,
11671,
448,
29943,
15691,
1544,
29892,
6473,
353,
5852,
1723,
13,
12,
361,
343,
11671,
29918,
550,
29893,
338,
451,
29871,
29900,
584,
13,
12,
12,
2158,
376,
489,
5229,
15691,
1544,
718,
376,
775,
15691,
851,
29898,
2941,
29880,
29918,
550,
29893,
29897,
13,
19499,
438,
29173,
408,
288,
344,
584,
13,
12,
2158,
376,
20418,
5229,
29901,
613,
288,
344,
13,
2
] |
lib/ldapconn.py | ArcaniteSolutions/zabbix-ldap-sync | 0 | 1615065 | import ldap
import ldap.filter
import logging
class LDAPConn(object):
"""
LDAP connector class
Defines methods for retrieving users and groups from LDAP server.
"""
def __init__(self, config):
self.conn = None
self.disabled_filter = config.ad_filterdisabled
self.uri = config.ldap_uri
self.base = config.ldap_base
self.ldap_accountids = config.ldap_accountids
self.ldap_user = config.ldap_user
self.ldap_pass = config.ldap_passwd
self.ldap_type = config.ldap_type
self.group_member_attribute = config.ldap_group_member_attribute
self.group_filter = config.ldap_group_filter
self.uid_attribute = config.ldap_uid_attribute
self.active_directory = config.ldap_active_directory
self.recursive = config.ldap_recursive
if self.recursive and self.active_directory:
self.memberof_filter = config.ldap_memberof_filter
self.skipdisabled = config.ldap_skipdisabled
self.user_filter = config.ldap_user_filter
self.verbose = config.verbose
self.openldap_type = config.openldap_type
self.logger = logging.getLogger(self.__class__.__name__)
# Log from pyldap
log = logging.getLogger('ldap')
if self.verbose:
log.setLevel(logging.DEBUG)
ldap.set_option(ldap.OPT_DEBUG_LEVEL, 4095)
if config.ldap_ignore_tls_errors:
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
def connect(self):
"""
Establish a connection to the LDAP server.
Raises:
SystemExit
"""
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
self.conn = ldap.initialize(self.uri)
self.conn.set_option(ldap.OPT_REFERRALS, ldap.OPT_OFF)
try:
self.conn.simple_bind_s(self.ldap_user, self.ldap_pass)
except ldap.SERVER_DOWN as e:
raise SystemExit('Cannot connect to LDAP server: %s' % e)
def disconnect(self):
"""
Disconnect from the LDAP server.
"""
self.conn.unbind()
def remove_ad_referrals(self, result: list):
"""
Remove referrals from AD query result
"""
return [i for i in result if i[0] is not None]
def get_group_members(self, group: str):
"""
Retrieves the members of an LDAP group
Args:
group (str): The LDAP group name
Returns:
A list of all users in the LDAP group
"""
attrlist = [self.group_member_attribute]
filter = self.group_filter % group
self.logger.debug('Searching LDAP with filter >>>%s<<<' % filter)
result = self.conn.search_s(base=self.base,
scope=ldap.SCOPE_SUBTREE,
filterstr=filter,
attrlist=attrlist)
if not result:
self.logger.info('Unable to find group "%s" with filter "%s", skipping group' % (group, filter))
return None
# Get DN for each user in the group
if self.active_directory:
return self.get_group_members_active_directory(result)
else:
return self.get_group_members_ldap(result)
def get_group_members_ldap(self, result: list):
dn, users = result.pop()
if not users:
return {}
final_listing = {}
group_members = []
# Get info for each user in the group
for memberid in users[self.group_member_attribute]:
memberid = memberid.decode("utf-8")
if self.openldap_type == "groupofnames":
filter = "(objectClass=*)"
# memberid is user dn
base = memberid
else:
# memberid is user attribute, most likely uid
filter = self.user_filter % memberid
base = self.base
attrlist = [self.uid_attribute]
# get the actual LDAP object for each group member
self.logger.debug('Searching LDAP with filter >>>%s<<<' % filter)
uid = self.conn.search_s(base=base,
scope=ldap.SCOPE_SUBTREE,
filterstr=filter,
attrlist=attrlist)
for item in uid:
group_members.append(item)
# Fill dictionary with usernames and corresponding DNs
for item in group_members:
dn = item[0]
username = item[1][self.uid_attribute]
user = ''.join(username[0].decode('utf-8'))
final_listing[user] = dn
return final_listing
def get_group_members_active_directory(self, result: list):
result = self.remove_ad_referrals(result)
final_listing = {}
for members in result:
result_dn = members[0]
result_attrs = members[1]
group_members = []
attrlist = [self.uid_attribute]
if self.recursive:
# Get a DN for all users in a group (recursive)
# It's available only on domain controllers with Windows Server 2003 SP2 or later
member_of_filter_dn = self.memberof_filter % result_dn
if self.skipdisabled:
filter = "(&%s%s%s)" % (self.user_filter, member_of_filter_dn, self.disabled_filter)
else:
filter = "(&%s%s)" % (self.user_filter, member_of_filter_dn)
self.logger.debug('Searching LDAP with filter >>>%s<<<' % filter)
uid = self.conn.search_s(base=self.base,
scope=ldap.SCOPE_SUBTREE,
filterstr=filter,
attrlist=attrlist)
for item in self.remove_ad_referrals(uid):
group_members.append(item)
else:
# Otherwise, just get a DN for each user in the group
for member in result_attrs[self.group_member_attribute]:
if self.skipdisabled:
filter = "(&%s%s)" % (self.user_filter, self.disabled_filter)
else:
filter = "(&%s)" % self.user_filter
self.logger.debug('Searching LDAP with filter >>>%s<<<' % filter)
uid = self.conn.search_s(base=member.decode('utf8'),
scope=ldap.SCOPE_BASE,
filterstr=filter,
attrlist=attrlist)
for item in uid:
group_members.append(item)
# Fill dictionary with usernames and corresponding DNs
for item in group_members:
dn = item[0]
username = item[1][self.uid_attribute]
if self.ldap_accountids:
username = username[0].decode('utf8')
else:
username = username[0].decode('utf8').lower()
final_listing[username] = dn
return final_listing
def get_user_media(self, dn: str, ldap_media: list):
"""
Retrieves the 'media' attribute of an LDAP user
Args:
dn (str): The LDAP distinguished name to lookup
ldap_media (str): The name of the field containing the media address
Returns:
The user's media attribute value
"""
attrlist = [ldap_media]
result = self.conn.search_s(base=dn,
scope=ldap.SCOPE_BASE,
attrlist=attrlist)
if not result:
return None
dn, data = result.pop()
mail = data.get(ldap_media)
if not mail:
return None
return mail.pop()
def get_user_sn(self, dn: str):
"""
Retrieves the 'sn' attribute of an LDAP user
Args:
dn (str): The LDAP distinguished name to lookup
Returns:
The user's surname attribute
"""
attrlist = ['sn']
result = self.conn.search_s(base=dn,
scope=ldap.SCOPE_BASE,
attrlist=attrlist)
if not result:
return None
dn, data = result.pop()
sn = data.get('sn')
if not sn:
return None
return sn.pop()
def get_user_givenName(self, dn: str):
"""
Retrieves the 'givenName' attribute of an LDAP user
Args:
dn (str): The LDAP distinguished name to lookup
Returns:
The user's given name attribute
"""
attrlist = ['givenName']
result = self.conn.search_s(base=dn,
scope=ldap.SCOPE_BASE,
attrlist=attrlist)
if not result:
return None
dn, data = result.pop()
name = data.get('givenName')
if not name:
return None
return name.pop()
def get_groups_with_wildcard(self, groups_wildcard: str):
filters = []
for wildcard in groups_wildcard:
self.logger.info("Search groups with wildcard: %s" % wildcard)
filters.append(self.group_filter % wildcard)
ldap_filter = "(| %s)" % (" ".join(filters))
result_groups = []
self.logger.debug('Searching LDAP with filter >>>%s<<<' % ldap_filter)
result = self.conn.search_s(base=self.base,
scope=ldap.SCOPE_SUBTREE,
filterstr=ldap_filter)
for group in result:
# Skip refldap (when Active Directory used)
# [0]==None
if group[0]:
group_name = group[1]['name'][0].decode()
self.logger.info("Found group %s" % group_name)
result_groups.append(group_name)
if not result_groups:
self.logger.info('Unable to find group "%s", skipping group wildcard' % groups_wildcard)
return result_groups
| [
1,
1053,
301,
29881,
481,
13,
5215,
301,
29881,
481,
29889,
4572,
13,
5215,
12183,
13,
13,
13,
1990,
365,
29928,
3301,
1168,
29876,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
365,
29928,
3301,
1826,
2801,
770,
13,
13,
1678,
5282,
1475,
3519,
363,
5663,
15387,
4160,
322,
6471,
515,
365,
29928,
3301,
1923,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2295,
1125,
13,
4706,
1583,
29889,
13082,
353,
6213,
13,
4706,
1583,
29889,
18279,
29918,
4572,
353,
2295,
29889,
328,
29918,
4572,
18279,
13,
4706,
1583,
29889,
5338,
353,
2295,
29889,
430,
481,
29918,
5338,
13,
4706,
1583,
29889,
3188,
353,
2295,
29889,
430,
481,
29918,
3188,
13,
4706,
1583,
29889,
430,
481,
29918,
10149,
4841,
353,
2295,
29889,
430,
481,
29918,
10149,
4841,
13,
4706,
1583,
29889,
430,
481,
29918,
1792,
353,
2295,
29889,
430,
481,
29918,
1792,
13,
4706,
1583,
29889,
430,
481,
29918,
3364,
353,
2295,
29889,
430,
481,
29918,
3364,
9970,
13,
4706,
1583,
29889,
430,
481,
29918,
1853,
353,
2295,
29889,
430,
481,
29918,
1853,
13,
4706,
1583,
29889,
2972,
29918,
14242,
29918,
12715,
353,
2295,
29889,
430,
481,
29918,
2972,
29918,
14242,
29918,
12715,
13,
4706,
1583,
29889,
2972,
29918,
4572,
353,
2295,
29889,
430,
481,
29918,
2972,
29918,
4572,
13,
4706,
1583,
29889,
5416,
29918,
12715,
353,
2295,
29889,
430,
481,
29918,
5416,
29918,
12715,
13,
4706,
1583,
29889,
4925,
29918,
12322,
353,
2295,
29889,
430,
481,
29918,
4925,
29918,
12322,
13,
4706,
1583,
29889,
3757,
25397,
353,
2295,
29889,
430,
481,
29918,
3757,
25397,
13,
4706,
565,
1583,
29889,
3757,
25397,
322,
1583,
29889,
4925,
29918,
12322,
29901,
13,
9651,
1583,
29889,
14242,
974,
29918,
4572,
353,
2295,
29889,
430,
481,
29918,
14242,
974,
29918,
4572,
13,
4706,
1583,
29889,
11014,
18279,
353,
2295,
29889,
430,
481,
29918,
11014,
18279,
13,
4706,
1583,
29889,
1792,
29918,
4572,
353,
2295,
29889,
430,
481,
29918,
1792,
29918,
4572,
13,
4706,
1583,
29889,
369,
15828,
353,
2295,
29889,
369,
15828,
13,
4706,
1583,
29889,
3150,
430,
481,
29918,
1853,
353,
2295,
29889,
3150,
430,
481,
29918,
1853,
13,
13,
4706,
1583,
29889,
21707,
353,
12183,
29889,
657,
16363,
29898,
1311,
17255,
1990,
1649,
17255,
978,
1649,
29897,
13,
4706,
396,
4522,
515,
11451,
430,
481,
13,
4706,
1480,
353,
12183,
29889,
657,
16363,
877,
430,
481,
1495,
13,
4706,
565,
1583,
29889,
369,
15828,
29901,
13,
9651,
1480,
29889,
842,
10108,
29898,
21027,
29889,
18525,
29897,
13,
9651,
301,
29881,
481,
29889,
842,
29918,
3385,
29898,
430,
481,
29889,
14094,
29918,
18525,
29918,
1307,
29963,
6670,
29892,
29871,
29946,
29900,
29929,
29945,
29897,
13,
13,
4706,
565,
2295,
29889,
430,
481,
29918,
17281,
29918,
29873,
3137,
29918,
12523,
29901,
13,
9651,
301,
29881,
481,
29889,
842,
29918,
3385,
29898,
430,
481,
29889,
14094,
29918,
29990,
29918,
29911,
8547,
29918,
1525,
29984,
3120,
1525,
29918,
29907,
20161,
29892,
301,
29881,
481,
29889,
14094,
29918,
29990,
29918,
29911,
8547,
29918,
8186,
5348,
29897,
13,
13,
1678,
822,
4511,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
2661,
370,
1674,
263,
3957,
304,
278,
365,
29928,
3301,
1923,
29889,
13,
13,
4706,
390,
1759,
267,
29901,
13,
9651,
2184,
24365,
13,
13,
4706,
9995,
13,
4706,
301,
29881,
481,
29889,
842,
29918,
3385,
29898,
430,
481,
29889,
14094,
29918,
29990,
29918,
29911,
8547,
29918,
1525,
29984,
3120,
1525,
29918,
29907,
20161,
29892,
301,
29881,
481,
29889,
14094,
29918,
29990,
29918,
29911,
8547,
29918,
8186,
5348,
29897,
13,
4706,
1583,
29889,
13082,
353,
301,
29881,
481,
29889,
24926,
29898,
1311,
29889,
5338,
29897,
13,
4706,
1583,
29889,
13082,
29889,
842,
29918,
3385,
29898,
430,
481,
29889,
14094,
29918,
25866,
21662,
1964,
29903,
29892,
301,
29881,
481,
29889,
14094,
29918,
27681,
29897,
13,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
13082,
29889,
12857,
29918,
5355,
29918,
29879,
29898,
1311,
29889,
430,
481,
29918,
1792,
29892,
1583,
29889,
430,
481,
29918,
3364,
29897,
13,
4706,
5174,
301,
29881,
481,
29889,
18603,
29918,
3970,
16048,
408,
321,
29901,
13,
9651,
12020,
2184,
24365,
877,
29089,
4511,
304,
365,
29928,
3301,
1923,
29901,
1273,
29879,
29915,
1273,
321,
29897,
13,
13,
1678,
822,
766,
6915,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
3295,
6915,
515,
278,
365,
29928,
3301,
1923,
29889,
13,
13,
4706,
9995,
13,
4706,
1583,
29889,
13082,
29889,
348,
5355,
580,
13,
13,
1678,
822,
3349,
29918,
328,
29918,
20275,
29878,
1338,
29898,
1311,
29892,
1121,
29901,
1051,
1125,
13,
4706,
9995,
13,
4706,
15154,
2737,
29878,
1338,
515,
11033,
2346,
1121,
13,
13,
4706,
9995,
13,
4706,
736,
518,
29875,
363,
474,
297,
1121,
565,
474,
29961,
29900,
29962,
338,
451,
6213,
29962,
13,
13,
1678,
822,
679,
29918,
2972,
29918,
28109,
29898,
1311,
29892,
2318,
29901,
851,
1125,
13,
4706,
9995,
13,
4706,
19338,
1960,
278,
5144,
310,
385,
365,
29928,
3301,
2318,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2318,
313,
710,
1125,
450,
365,
29928,
3301,
2318,
1024,
13,
13,
4706,
16969,
29901,
13,
9651,
319,
1051,
310,
599,
4160,
297,
278,
365,
29928,
3301,
2318,
13,
13,
4706,
9995,
13,
4706,
12421,
1761,
353,
518,
1311,
29889,
2972,
29918,
14242,
29918,
12715,
29962,
13,
4706,
4175,
353,
1583,
29889,
2972,
29918,
4572,
1273,
2318,
13,
4706,
1583,
29889,
21707,
29889,
8382,
877,
7974,
292,
365,
29928,
3301,
411,
4175,
8653,
29995,
29879,
9314,
26717,
1273,
4175,
29897,
13,
4706,
1121,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
1311,
29889,
3188,
29892,
13,
462,
462,
1678,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
20633,
29911,
21661,
29892,
13,
462,
462,
1678,
4175,
710,
29922,
4572,
29892,
13,
462,
462,
1678,
12421,
1761,
29922,
5552,
1761,
29897,
13,
13,
4706,
565,
451,
1121,
29901,
13,
9651,
1583,
29889,
21707,
29889,
3888,
877,
2525,
519,
304,
1284,
2318,
11860,
29879,
29908,
411,
4175,
11860,
29879,
613,
14993,
3262,
2318,
29915,
1273,
313,
2972,
29892,
4175,
876,
13,
9651,
736,
6213,
13,
13,
4706,
396,
3617,
360,
29940,
363,
1269,
1404,
297,
278,
2318,
13,
4706,
565,
1583,
29889,
4925,
29918,
12322,
29901,
13,
9651,
736,
1583,
29889,
657,
29918,
2972,
29918,
28109,
29918,
4925,
29918,
12322,
29898,
2914,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
657,
29918,
2972,
29918,
28109,
29918,
430,
481,
29898,
2914,
29897,
13,
13,
1678,
822,
679,
29918,
2972,
29918,
28109,
29918,
430,
481,
29898,
1311,
29892,
1121,
29901,
1051,
1125,
13,
4706,
270,
29876,
29892,
4160,
353,
1121,
29889,
7323,
580,
13,
4706,
565,
451,
4160,
29901,
13,
9651,
736,
6571,
13,
4706,
2186,
29918,
1761,
292,
353,
6571,
13,
4706,
2318,
29918,
28109,
353,
5159,
13,
4706,
396,
3617,
5235,
363,
1269,
1404,
297,
278,
2318,
13,
4706,
363,
4509,
333,
297,
4160,
29961,
1311,
29889,
2972,
29918,
14242,
29918,
12715,
5387,
13,
9651,
4509,
333,
353,
4509,
333,
29889,
13808,
703,
9420,
29899,
29947,
1159,
13,
13,
9651,
565,
1583,
29889,
3150,
430,
481,
29918,
1853,
1275,
376,
2972,
974,
7039,
1115,
13,
18884,
4175,
353,
18227,
3318,
2385,
29922,
29930,
5513,
13,
18884,
396,
4509,
333,
338,
1404,
270,
29876,
13,
18884,
2967,
353,
4509,
333,
13,
9651,
1683,
29901,
13,
13,
18884,
396,
4509,
333,
338,
1404,
5352,
29892,
1556,
5517,
318,
333,
13,
18884,
4175,
353,
1583,
29889,
1792,
29918,
4572,
1273,
4509,
333,
13,
18884,
2967,
353,
1583,
29889,
3188,
13,
13,
9651,
12421,
1761,
353,
518,
1311,
29889,
5416,
29918,
12715,
29962,
13,
13,
9651,
396,
679,
278,
3935,
365,
29928,
3301,
1203,
363,
1269,
2318,
4509,
13,
9651,
1583,
29889,
21707,
29889,
8382,
877,
7974,
292,
365,
29928,
3301,
411,
4175,
8653,
29995,
29879,
9314,
26717,
1273,
4175,
29897,
13,
9651,
318,
333,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
3188,
29892,
13,
462,
462,
268,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
20633,
29911,
21661,
29892,
13,
462,
462,
268,
4175,
710,
29922,
4572,
29892,
13,
462,
462,
268,
12421,
1761,
29922,
5552,
1761,
29897,
13,
13,
9651,
363,
2944,
297,
318,
333,
29901,
13,
18884,
2318,
29918,
28109,
29889,
4397,
29898,
667,
29897,
13,
13,
9651,
396,
383,
453,
8600,
411,
502,
824,
1280,
322,
6590,
360,
29940,
29879,
13,
9651,
363,
2944,
297,
2318,
29918,
28109,
29901,
13,
18884,
270,
29876,
353,
2944,
29961,
29900,
29962,
13,
13,
18884,
8952,
353,
2944,
29961,
29896,
3816,
1311,
29889,
5416,
29918,
12715,
29962,
13,
18884,
1404,
353,
525,
4286,
7122,
29898,
6786,
29961,
29900,
1822,
13808,
877,
9420,
29899,
29947,
8785,
13,
13,
18884,
2186,
29918,
1761,
292,
29961,
1792,
29962,
353,
270,
29876,
13,
13,
4706,
736,
2186,
29918,
1761,
292,
13,
13,
1678,
822,
679,
29918,
2972,
29918,
28109,
29918,
4925,
29918,
12322,
29898,
1311,
29892,
1121,
29901,
1051,
1125,
13,
4706,
1121,
353,
1583,
29889,
5992,
29918,
328,
29918,
20275,
29878,
1338,
29898,
2914,
29897,
13,
4706,
2186,
29918,
1761,
292,
353,
6571,
13,
13,
4706,
363,
5144,
297,
1121,
29901,
13,
9651,
1121,
29918,
5200,
353,
5144,
29961,
29900,
29962,
13,
9651,
1121,
29918,
5552,
29879,
353,
5144,
29961,
29896,
29962,
13,
9651,
2318,
29918,
28109,
353,
5159,
13,
9651,
12421,
1761,
353,
518,
1311,
29889,
5416,
29918,
12715,
29962,
13,
9651,
565,
1583,
29889,
3757,
25397,
29901,
13,
18884,
396,
3617,
263,
360,
29940,
363,
599,
4160,
297,
263,
2318,
313,
3757,
25397,
29897,
13,
18884,
396,
739,
29915,
29879,
3625,
871,
373,
5354,
21385,
411,
3852,
5656,
29871,
29906,
29900,
29900,
29941,
10937,
29906,
470,
2678,
13,
13,
18884,
4509,
29918,
974,
29918,
4572,
29918,
5200,
353,
1583,
29889,
14242,
974,
29918,
4572,
1273,
1121,
29918,
5200,
13,
13,
18884,
565,
1583,
29889,
11014,
18279,
29901,
13,
462,
1678,
4175,
353,
376,
6243,
29995,
29879,
29995,
29879,
29995,
29879,
5513,
1273,
313,
1311,
29889,
1792,
29918,
4572,
29892,
4509,
29918,
974,
29918,
4572,
29918,
5200,
29892,
1583,
29889,
18279,
29918,
4572,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
4175,
353,
376,
6243,
29995,
29879,
29995,
29879,
5513,
1273,
313,
1311,
29889,
1792,
29918,
4572,
29892,
4509,
29918,
974,
29918,
4572,
29918,
5200,
29897,
13,
13,
18884,
1583,
29889,
21707,
29889,
8382,
877,
7974,
292,
365,
29928,
3301,
411,
4175,
8653,
29995,
29879,
9314,
26717,
1273,
4175,
29897,
13,
18884,
318,
333,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
1311,
29889,
3188,
29892,
13,
462,
462,
308,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
20633,
29911,
21661,
29892,
13,
462,
462,
308,
4175,
710,
29922,
4572,
29892,
13,
462,
462,
308,
12421,
1761,
29922,
5552,
1761,
29897,
13,
13,
18884,
363,
2944,
297,
1583,
29889,
5992,
29918,
328,
29918,
20275,
29878,
1338,
29898,
5416,
1125,
13,
462,
1678,
2318,
29918,
28109,
29889,
4397,
29898,
667,
29897,
13,
9651,
1683,
29901,
13,
18884,
396,
13466,
29892,
925,
679,
263,
360,
29940,
363,
1269,
1404,
297,
278,
2318,
13,
18884,
363,
4509,
297,
1121,
29918,
5552,
29879,
29961,
1311,
29889,
2972,
29918,
14242,
29918,
12715,
5387,
13,
462,
1678,
565,
1583,
29889,
11014,
18279,
29901,
13,
462,
4706,
4175,
353,
376,
6243,
29995,
29879,
29995,
29879,
5513,
1273,
313,
1311,
29889,
1792,
29918,
4572,
29892,
1583,
29889,
18279,
29918,
4572,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
4175,
353,
376,
6243,
29995,
29879,
5513,
1273,
1583,
29889,
1792,
29918,
4572,
13,
13,
462,
1678,
1583,
29889,
21707,
29889,
8382,
877,
7974,
292,
365,
29928,
3301,
411,
4175,
8653,
29995,
29879,
9314,
26717,
1273,
4175,
29897,
13,
462,
1678,
318,
333,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
14242,
29889,
13808,
877,
9420,
29947,
5477,
13,
462,
462,
632,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
25416,
29892,
13,
462,
462,
632,
4175,
710,
29922,
4572,
29892,
13,
462,
462,
632,
12421,
1761,
29922,
5552,
1761,
29897,
13,
462,
1678,
363,
2944,
297,
318,
333,
29901,
13,
462,
4706,
2318,
29918,
28109,
29889,
4397,
29898,
667,
29897,
13,
9651,
396,
383,
453,
8600,
411,
502,
824,
1280,
322,
6590,
360,
29940,
29879,
13,
9651,
363,
2944,
297,
2318,
29918,
28109,
29901,
13,
18884,
270,
29876,
353,
2944,
29961,
29900,
29962,
13,
18884,
8952,
353,
2944,
29961,
29896,
3816,
1311,
29889,
5416,
29918,
12715,
29962,
13,
13,
18884,
565,
1583,
29889,
430,
481,
29918,
10149,
4841,
29901,
13,
462,
1678,
8952,
353,
8952,
29961,
29900,
1822,
13808,
877,
9420,
29947,
1495,
13,
18884,
1683,
29901,
13,
462,
1678,
8952,
353,
8952,
29961,
29900,
1822,
13808,
877,
9420,
29947,
2824,
13609,
580,
13,
13,
18884,
2186,
29918,
1761,
292,
29961,
6786,
29962,
353,
270,
29876,
13,
4706,
736,
2186,
29918,
1761,
292,
13,
13,
1678,
822,
679,
29918,
1792,
29918,
9799,
29898,
1311,
29892,
270,
29876,
29901,
851,
29892,
301,
29881,
481,
29918,
9799,
29901,
1051,
1125,
13,
4706,
9995,
13,
4706,
19338,
1960,
278,
525,
9799,
29915,
5352,
310,
385,
365,
29928,
3301,
1404,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
270,
29876,
313,
710,
1125,
450,
365,
29928,
3301,
20660,
1024,
304,
16280,
13,
9651,
301,
29881,
481,
29918,
9799,
313,
710,
1125,
450,
1024,
310,
278,
1746,
6943,
278,
5745,
3211,
13,
13,
4706,
16969,
29901,
13,
9651,
450,
1404,
29915,
29879,
5745,
5352,
995,
13,
13,
4706,
9995,
13,
4706,
12421,
1761,
353,
518,
430,
481,
29918,
9799,
29962,
13,
13,
4706,
1121,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
5200,
29892,
13,
462,
462,
1678,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
25416,
29892,
13,
462,
462,
1678,
12421,
1761,
29922,
5552,
1761,
29897,
13,
13,
4706,
565,
451,
1121,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
270,
29876,
29892,
848,
353,
1121,
29889,
7323,
580,
13,
13,
4706,
10524,
353,
848,
29889,
657,
29898,
430,
481,
29918,
9799,
29897,
13,
13,
4706,
565,
451,
10524,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
736,
10524,
29889,
7323,
580,
13,
13,
1678,
822,
679,
29918,
1792,
29918,
16586,
29898,
1311,
29892,
270,
29876,
29901,
851,
1125,
13,
4706,
9995,
13,
4706,
19338,
1960,
278,
525,
16586,
29915,
5352,
310,
385,
365,
29928,
3301,
1404,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
270,
29876,
313,
710,
1125,
450,
365,
29928,
3301,
20660,
1024,
304,
16280,
13,
13,
4706,
16969,
29901,
13,
9651,
450,
1404,
29915,
29879,
23403,
5352,
13,
13,
4706,
9995,
13,
4706,
12421,
1761,
353,
6024,
16586,
2033,
13,
13,
4706,
1121,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
5200,
29892,
13,
462,
462,
1678,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
25416,
29892,
13,
462,
462,
1678,
12421,
1761,
29922,
5552,
1761,
29897,
13,
13,
4706,
565,
451,
1121,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
270,
29876,
29892,
848,
353,
1121,
29889,
7323,
580,
13,
13,
4706,
5807,
353,
848,
29889,
657,
877,
16586,
1495,
13,
13,
4706,
565,
451,
5807,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
736,
5807,
29889,
7323,
580,
13,
13,
1678,
822,
679,
29918,
1792,
29918,
29887,
5428,
1170,
29898,
1311,
29892,
270,
29876,
29901,
851,
1125,
13,
4706,
9995,
13,
4706,
19338,
1960,
278,
525,
29887,
5428,
1170,
29915,
5352,
310,
385,
365,
29928,
3301,
1404,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
270,
29876,
313,
710,
1125,
450,
365,
29928,
3301,
20660,
1024,
304,
16280,
13,
13,
4706,
16969,
29901,
13,
9651,
450,
1404,
29915,
29879,
2183,
1024,
5352,
13,
13,
4706,
9995,
13,
4706,
12421,
1761,
353,
6024,
29887,
5428,
1170,
2033,
13,
13,
4706,
1121,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
5200,
29892,
13,
462,
462,
1678,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
25416,
29892,
13,
462,
462,
1678,
12421,
1761,
29922,
5552,
1761,
29897,
13,
13,
4706,
565,
451,
1121,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
270,
29876,
29892,
848,
353,
1121,
29889,
7323,
580,
13,
13,
4706,
1024,
353,
848,
29889,
657,
877,
29887,
5428,
1170,
1495,
13,
13,
4706,
565,
451,
1024,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
736,
1024,
29889,
7323,
580,
13,
13,
1678,
822,
679,
29918,
13155,
29918,
2541,
29918,
29893,
789,
7543,
29898,
1311,
29892,
6471,
29918,
29893,
789,
7543,
29901,
851,
1125,
13,
13,
4706,
18094,
353,
5159,
13,
4706,
363,
8775,
7543,
297,
6471,
29918,
29893,
789,
7543,
29901,
13,
9651,
1583,
29889,
21707,
29889,
3888,
703,
7974,
6471,
411,
8775,
7543,
29901,
1273,
29879,
29908,
1273,
8775,
7543,
29897,
13,
9651,
18094,
29889,
4397,
29898,
1311,
29889,
2972,
29918,
4572,
1273,
8775,
7543,
29897,
13,
13,
4706,
301,
29881,
481,
29918,
4572,
353,
18227,
29989,
1273,
29879,
5513,
1273,
4852,
11393,
7122,
29898,
26705,
876,
13,
13,
4706,
1121,
29918,
13155,
353,
5159,
13,
13,
4706,
1583,
29889,
21707,
29889,
8382,
877,
7974,
292,
365,
29928,
3301,
411,
4175,
8653,
29995,
29879,
9314,
26717,
1273,
301,
29881,
481,
29918,
4572,
29897,
13,
4706,
1121,
353,
1583,
29889,
13082,
29889,
4478,
29918,
29879,
29898,
3188,
29922,
1311,
29889,
3188,
29892,
13,
462,
462,
1678,
6874,
29922,
430,
481,
29889,
29903,
3217,
4162,
29918,
20633,
29911,
21661,
29892,
13,
462,
462,
1678,
4175,
710,
29922,
430,
481,
29918,
4572,
29897,
13,
13,
4706,
363,
2318,
297,
1121,
29901,
13,
9651,
396,
4971,
666,
2143,
430,
481,
313,
8256,
10731,
18862,
1304,
29897,
13,
9651,
396,
518,
29900,
29962,
1360,
8516,
13,
9651,
565,
2318,
29961,
29900,
5387,
13,
18884,
2318,
29918,
978,
353,
2318,
29961,
29896,
22322,
978,
2033,
29961,
29900,
1822,
13808,
580,
13,
18884,
1583,
29889,
21707,
29889,
3888,
703,
9692,
2318,
1273,
29879,
29908,
1273,
2318,
29918,
978,
29897,
13,
18884,
1121,
29918,
13155,
29889,
4397,
29898,
2972,
29918,
978,
29897,
13,
13,
4706,
565,
451,
1121,
29918,
13155,
29901,
13,
9651,
1583,
29889,
21707,
29889,
3888,
877,
2525,
519,
304,
1284,
2318,
11860,
29879,
613,
14993,
3262,
2318,
8775,
7543,
29915,
1273,
6471,
29918,
29893,
789,
7543,
29897,
13,
13,
4706,
736,
1121,
29918,
13155,
13,
2
] |
google/cloud/bigquery/reservation_v1/types/reservation.py | shollyman/python-bigquery-reservation | 0 | 137874 | <gh_stars>0
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from google.protobuf import field_mask_pb2 as field_mask # type: ignore
from google.protobuf import timestamp_pb2 as timestamp # type: ignore
from google.rpc import status_pb2 as status # type: ignore
__protobuf__ = proto.module(
package="google.cloud.bigquery.reservation.v1",
manifest={
"Reservation",
"CapacityCommitment",
"CreateReservationRequest",
"ListReservationsRequest",
"ListReservationsResponse",
"GetReservationRequest",
"DeleteReservationRequest",
"UpdateReservationRequest",
"CreateCapacityCommitmentRequest",
"ListCapacityCommitmentsRequest",
"ListCapacityCommitmentsResponse",
"GetCapacityCommitmentRequest",
"DeleteCapacityCommitmentRequest",
"UpdateCapacityCommitmentRequest",
"SplitCapacityCommitmentRequest",
"SplitCapacityCommitmentResponse",
"MergeCapacityCommitmentsRequest",
"Assignment",
"CreateAssignmentRequest",
"ListAssignmentsRequest",
"ListAssignmentsResponse",
"DeleteAssignmentRequest",
"SearchAssignmentsRequest",
"SearchAssignmentsResponse",
"MoveAssignmentRequest",
"BiReservation",
"GetBiReservationRequest",
"UpdateBiReservationRequest",
},
)
class Reservation(proto.Message):
r"""A reservation is a mechanism used to guarantee slots to
users.
Attributes:
name (str):
The resource name of the reservation, e.g.,
``projects/*/locations/*/reservations/team1-prod``.
slot_capacity (int):
Minimum slots available to this reservation. A slot is a
unit of computational power in BigQuery, and serves as the
unit of parallelism.
Queries using this reservation might use more slots during
runtime if ignore_idle_slots is set to false.
If the new reservation's slot capacity exceed the parent's
slot capacity or if total slot capacity of the new
reservation and its siblings exceeds the parent's slot
capacity, the request will fail with
``google.rpc.Code.RESOURCE_EXHAUSTED``.
ignore_idle_slots (bool):
If false, any query using this reservation
will use idle slots from other reservations
within the same admin project. If true, a query
using this reservation will execute with the
slot capacity specified above at most.
"""
name = proto.Field(proto.STRING, number=1)
slot_capacity = proto.Field(proto.INT64, number=2)
ignore_idle_slots = proto.Field(proto.BOOL, number=4)
class CapacityCommitment(proto.Message):
r"""Capacity commitment is a way to purchase compute capacity for
BigQuery jobs (in the form of slots) with some committed period
of usage. Annual commitments renew by default. Commitments can
be removed after their commitment end time passes.
In order to remove annual commitment, its plan needs to be
changed to monthly or flex first.
A capacity commitment resource exists as a child resource of the
admin project.
Attributes:
name (str):
Output only. The resource name of the capacity commitment,
e.g.,
``projects/myproject/locations/US/capacityCommitments/123``
slot_count (int):
Number of slots in this commitment.
plan (~.gcbr_reservation.CapacityCommitment.CommitmentPlan):
Capacity commitment commitment plan.
state (~.gcbr_reservation.CapacityCommitment.State):
Output only. State of the commitment.
commitment_end_time (~.timestamp.Timestamp):
Output only. The end of the current
commitment period. It is applicable only for
ACTIVE capacity commitments.
failure_status (~.status.Status):
Output only. For FAILED commitment plan,
provides the reason of failure.
renewal_plan (~.gcbr_reservation.CapacityCommitment.CommitmentPlan):
The plan this capacity commitment is converted to after
commitment_end_time passes. Once the plan is changed,
committed period is extended according to commitment plan.
Only applicable for ANNUAL and TRIAL commitments.
"""
class CommitmentPlan(proto.Enum):
r"""Commitment plan defines the current committed period.
Capacity commitment cannot be deleted during it's committed
period.
"""
COMMITMENT_PLAN_UNSPECIFIED = 0
FLEX = 3
TRIAL = 5
MONTHLY = 2
ANNUAL = 4
class State(proto.Enum):
r"""Capacity commitment can either become ACTIVE right away or
transition from PENDING to ACTIVE or FAILED.
"""
STATE_UNSPECIFIED = 0
PENDING = 1
ACTIVE = 2
FAILED = 3
name = proto.Field(proto.STRING, number=1)
slot_count = proto.Field(proto.INT64, number=2)
plan = proto.Field(proto.ENUM, number=3, enum=CommitmentPlan)
state = proto.Field(proto.ENUM, number=4, enum=State)
commitment_end_time = proto.Field(
proto.MESSAGE, number=5, message=timestamp.Timestamp
)
failure_status = proto.Field(proto.MESSAGE, number=7, message=status.Status)
renewal_plan = proto.Field(proto.ENUM, number=8, enum=CommitmentPlan)
class CreateReservationRequest(proto.Message):
r"""The request for
[ReservationService.CreateReservation][google.cloud.bigquery.reservation.v1.ReservationService.CreateReservation].
Attributes:
parent (str):
Required. Project, location. E.g.,
``projects/myproject/locations/US``
reservation_id (str):
The reservation ID. This field must only
contain lower case alphanumeric characters or
dash. Max length is 64 characters.
reservation (~.gcbr_reservation.Reservation):
Definition of the new reservation to create.
"""
parent = proto.Field(proto.STRING, number=1)
reservation_id = proto.Field(proto.STRING, number=2)
reservation = proto.Field(proto.MESSAGE, number=3, message=Reservation)
class ListReservationsRequest(proto.Message):
r"""The request for
[ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
Attributes:
parent (str):
Required. The parent resource name containing
project and location, e.g.:
"projects/myproject/locations/US".
page_size (int):
The maximum number of items to return per
page.
page_token (str):
The next_page_token value returned from a previous List
request, if any.
"""
parent = proto.Field(proto.STRING, number=1)
page_size = proto.Field(proto.INT32, number=2)
page_token = proto.Field(proto.STRING, number=3)
class ListReservationsResponse(proto.Message):
r"""The response for
[ReservationService.ListReservations][google.cloud.bigquery.reservation.v1.ReservationService.ListReservations].
Attributes:
reservations (Sequence[~.gcbr_reservation.Reservation]):
List of reservations visible to the user.
next_page_token (str):
Token to retrieve the next page of results,
or empty if there are no more results in the
list.
"""
@property
def raw_page(self):
return self
reservations = proto.RepeatedField(proto.MESSAGE, number=1, message=Reservation)
next_page_token = proto.Field(proto.STRING, number=2)
class GetReservationRequest(proto.Message):
r"""The request for
[ReservationService.GetReservation][google.cloud.bigquery.reservation.v1.ReservationService.GetReservation].
Attributes:
name (str):
Required. Resource name of the reservation to retrieve.
E.g.,
``projects/myproject/locations/US/reservations/team1-prod``
"""
name = proto.Field(proto.STRING, number=1)
class DeleteReservationRequest(proto.Message):
r"""The request for
[ReservationService.DeleteReservation][google.cloud.bigquery.reservation.v1.ReservationService.DeleteReservation].
Attributes:
name (str):
Required. Resource name of the reservation to retrieve.
E.g.,
``projects/myproject/locations/US/reservations/team1-prod``
"""
name = proto.Field(proto.STRING, number=1)
class UpdateReservationRequest(proto.Message):
r"""The request for
[ReservationService.UpdateReservation][google.cloud.bigquery.reservation.v1.ReservationService.UpdateReservation].
Attributes:
reservation (~.gcbr_reservation.Reservation):
Content of the reservation to update.
update_mask (~.field_mask.FieldMask):
Standard field mask for the set of fields to
be updated.
"""
reservation = proto.Field(proto.MESSAGE, number=1, message=Reservation)
update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask)
class CreateCapacityCommitmentRequest(proto.Message):
r"""The request for
[ReservationService.CreateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.CreateCapacityCommitment].
Attributes:
parent (str):
Required. Resource name of the parent
reservation. E.g.,
projects/myproject/locations/US
capacity_commitment (~.gcbr_reservation.CapacityCommitment):
Content of the capacity commitment to create.
enforce_single_admin_project_per_org (bool):
If true, fail the request if another project
in the organization has a capacity commitment.
"""
parent = proto.Field(proto.STRING, number=1)
capacity_commitment = proto.Field(
proto.MESSAGE, number=2, message=CapacityCommitment
)
enforce_single_admin_project_per_org = proto.Field(proto.BOOL, number=4)
class ListCapacityCommitmentsRequest(proto.Message):
r"""The request for
[ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
Attributes:
parent (str):
Required. Resource name of the parent
reservation. E.g.,
projects/myproject/locations/US
page_size (int):
The maximum number of items to return.
page_token (str):
The next_page_token value returned from a previous List
request, if any.
"""
parent = proto.Field(proto.STRING, number=1)
page_size = proto.Field(proto.INT32, number=2)
page_token = proto.Field(proto.STRING, number=3)
class ListCapacityCommitmentsResponse(proto.Message):
r"""The response for
[ReservationService.ListCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.ListCapacityCommitments].
Attributes:
capacity_commitments (Sequence[~.gcbr_reservation.CapacityCommitment]):
List of capacity commitments visible to the
user.
next_page_token (str):
Token to retrieve the next page of results,
or empty if there are no more results in the
list.
"""
@property
def raw_page(self):
return self
capacity_commitments = proto.RepeatedField(
proto.MESSAGE, number=1, message=CapacityCommitment
)
next_page_token = proto.Field(proto.STRING, number=2)
class GetCapacityCommitmentRequest(proto.Message):
r"""The request for
[ReservationService.GetCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.GetCapacityCommitment].
Attributes:
name (str):
Required. Resource name of the capacity
commitment to retrieve. E.g.,
projects/myproject/locations/US/capacityCommitments/123
"""
name = proto.Field(proto.STRING, number=1)
class DeleteCapacityCommitmentRequest(proto.Message):
r"""The request for
[ReservationService.DeleteCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteCapacityCommitment].
Attributes:
name (str):
Required. Resource name of the capacity
commitment to delete. E.g.,
projects/myproject/locations/US/capacityCommitments/123
"""
name = proto.Field(proto.STRING, number=1)
class UpdateCapacityCommitmentRequest(proto.Message):
r"""The request for
[ReservationService.UpdateCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.UpdateCapacityCommitment].
Attributes:
capacity_commitment (~.gcbr_reservation.CapacityCommitment):
Content of the capacity commitment to update.
update_mask (~.field_mask.FieldMask):
Standard field mask for the set of fields to
be updated.
"""
capacity_commitment = proto.Field(
proto.MESSAGE, number=1, message=CapacityCommitment
)
update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask)
class SplitCapacityCommitmentRequest(proto.Message):
r"""The request for
[ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
Attributes:
name (str):
Required. The resource name e.g.,:
projects/myproject/locations/US/capacityCommitments/123
slot_count (int):
Number of slots in the capacity commitment
after the split.
"""
name = proto.Field(proto.STRING, number=1)
slot_count = proto.Field(proto.INT64, number=2)
class SplitCapacityCommitmentResponse(proto.Message):
r"""The response for
[ReservationService.SplitCapacityCommitment][google.cloud.bigquery.reservation.v1.ReservationService.SplitCapacityCommitment].
Attributes:
first (~.gcbr_reservation.CapacityCommitment):
First capacity commitment, result of a split.
second (~.gcbr_reservation.CapacityCommitment):
Second capacity commitment, result of a
split.
"""
first = proto.Field(proto.MESSAGE, number=1, message=CapacityCommitment)
second = proto.Field(proto.MESSAGE, number=2, message=CapacityCommitment)
class MergeCapacityCommitmentsRequest(proto.Message):
r"""The request for
[ReservationService.MergeCapacityCommitments][google.cloud.bigquery.reservation.v1.ReservationService.MergeCapacityCommitments].
Attributes:
parent (str):
Parent resource that identifies admin project
and location e.g.,
projects/myproject/locations/us
capacity_commitment_ids (Sequence[str]):
Ids of capacity commitments to merge.
These capacity commitments must exist under
admin project and location specified in the
parent.
"""
parent = proto.Field(proto.STRING, number=1)
capacity_commitment_ids = proto.RepeatedField(proto.STRING, number=2)
class Assignment(proto.Message):
r"""A Assignment allows a project to submit jobs
of a certain type using slots from the specified reservation.
Attributes:
name (str):
Output only. Name of the resource. E.g.:
``projects/myproject/locations/US/reservations/team1-prod/assignments/123``.
assignee (str):
The resource which will use the reservation. E.g.
``projects/myproject``, ``folders/123``, or
``organizations/456``.
job_type (~.gcbr_reservation.Assignment.JobType):
Which type of jobs will use the reservation.
state (~.gcbr_reservation.Assignment.State):
Output only. State of the assignment.
"""
class JobType(proto.Enum):
r"""Types of job, which could be specified when using the
reservation.
"""
JOB_TYPE_UNSPECIFIED = 0
PIPELINE = 1
QUERY = 2
class State(proto.Enum):
r"""Assignment will remain in PENDING state if no active capacity
commitment is present. It will become ACTIVE when some capacity
commitment becomes active.
"""
STATE_UNSPECIFIED = 0
PENDING = 1
ACTIVE = 2
name = proto.Field(proto.STRING, number=1)
assignee = proto.Field(proto.STRING, number=4)
job_type = proto.Field(proto.ENUM, number=3, enum=JobType)
state = proto.Field(proto.ENUM, number=6, enum=State)
class CreateAssignmentRequest(proto.Message):
r"""The request for
[ReservationService.CreateAssignment][google.cloud.bigquery.reservation.v1.ReservationService.CreateAssignment].
Note: "bigquery.reservationAssignments.create" permission is
required on the related assignee.
Attributes:
parent (str):
Required. The parent resource name of the assignment E.g.
``projects/myproject/locations/US/reservations/team1-prod``
assignment (~.gcbr_reservation.Assignment):
Assignment resource to create.
"""
parent = proto.Field(proto.STRING, number=1)
assignment = proto.Field(proto.MESSAGE, number=2, message=Assignment)
class ListAssignmentsRequest(proto.Message):
r"""The request for
[ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
Attributes:
parent (str):
Required. The parent resource name e.g.:
``projects/myproject/locations/US/reservations/team1-prod``
Or:
``projects/myproject/locations/US/reservations/-``
page_size (int):
The maximum number of items to return per
page.
page_token (str):
The next_page_token value returned from a previous List
request, if any.
"""
parent = proto.Field(proto.STRING, number=1)
page_size = proto.Field(proto.INT32, number=2)
page_token = proto.Field(proto.STRING, number=3)
class ListAssignmentsResponse(proto.Message):
r"""The response for
[ReservationService.ListAssignments][google.cloud.bigquery.reservation.v1.ReservationService.ListAssignments].
Attributes:
assignments (Sequence[~.gcbr_reservation.Assignment]):
List of assignments visible to the user.
next_page_token (str):
Token to retrieve the next page of results,
or empty if there are no more results in the
list.
"""
@property
def raw_page(self):
return self
assignments = proto.RepeatedField(proto.MESSAGE, number=1, message=Assignment)
next_page_token = proto.Field(proto.STRING, number=2)
class DeleteAssignmentRequest(proto.Message):
r"""The request for
[ReservationService.DeleteAssignment][google.cloud.bigquery.reservation.v1.ReservationService.DeleteAssignment].
Note: "bigquery.reservationAssignments.delete" permission is
required on the related assignee.
Attributes:
name (str):
Required. Name of the resource, e.g.
``projects/myproject/locations/US/reservations/team1-prod/assignments/123``
"""
name = proto.Field(proto.STRING, number=1)
class SearchAssignmentsRequest(proto.Message):
r"""The request for
[ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
Note: "bigquery.reservationAssignments.search" permission is
required on the related assignee.
Attributes:
parent (str):
Required. The resource name of the admin
project(containing project and location), e.g.:
"projects/myproject/locations/US".
query (str):
Please specify resource name as assignee in the query.
Examples:
- ``assignee=projects/myproject``
- ``assignee=folders/123``
- ``assignee=organizations/456``
page_size (int):
The maximum number of items to return per
page.
page_token (str):
The next_page_token value returned from a previous List
request, if any.
"""
parent = proto.Field(proto.STRING, number=1)
query = proto.Field(proto.STRING, number=2)
page_size = proto.Field(proto.INT32, number=3)
page_token = proto.Field(proto.STRING, number=4)
class SearchAssignmentsResponse(proto.Message):
r"""The response for
[ReservationService.SearchAssignments][google.cloud.bigquery.reservation.v1.ReservationService.SearchAssignments].
Attributes:
assignments (Sequence[~.gcbr_reservation.Assignment]):
List of assignments visible to the user.
next_page_token (str):
Token to retrieve the next page of results,
or empty if there are no more results in the
list.
"""
@property
def raw_page(self):
return self
assignments = proto.RepeatedField(proto.MESSAGE, number=1, message=Assignment)
next_page_token = proto.Field(proto.STRING, number=2)
class MoveAssignmentRequest(proto.Message):
r"""The request for
[ReservationService.MoveAssignment][google.cloud.bigquery.reservation.v1.ReservationService.MoveAssignment].
**Note**: "bigquery.reservationAssignments.create" permission is
required on the destination_id.
**Note**: "bigquery.reservationAssignments.create" and
"bigquery.reservationAssignments.delete" permission are required on
the related assignee.
Attributes:
name (str):
Required. The resource name of the assignment, e.g.
``projects/myproject/locations/US/reservations/team1-prod/assignments/123``
destination_id (str):
The new reservation ID, e.g.:
``projects/myotherproject/locations/US/reservations/team2-prod``
"""
name = proto.Field(proto.STRING, number=1)
destination_id = proto.Field(proto.STRING, number=3)
class BiReservation(proto.Message):
r"""Represents a BI Reservation.
Attributes:
name (str):
The resource name of the singleton BI reservation.
Reservation names have the form
``projects/{project_id}/locations/{location_id}/bireservation``.
update_time (~.timestamp.Timestamp):
Output only. The last update timestamp of a
reservation.
size (int):
Size of a reservation, in bytes.
"""
name = proto.Field(proto.STRING, number=1)
update_time = proto.Field(proto.MESSAGE, number=3, message=timestamp.Timestamp)
size = proto.Field(proto.INT64, number=4)
class GetBiReservationRequest(proto.Message):
r"""A request to get a singleton BI reservation.
Attributes:
name (str):
Required. Name of the requested reservation, for example:
``projects/{project_id}/locations/{location_id}/bireservation``
"""
name = proto.Field(proto.STRING, number=1)
class UpdateBiReservationRequest(proto.Message):
r"""A request to update a BI reservation.
Attributes:
bi_reservation (~.gcbr_reservation.BiReservation):
A reservation to update.
update_mask (~.field_mask.FieldMask):
A list of fields to be updated in this
request.
"""
bi_reservation = proto.Field(proto.MESSAGE, number=1, message=BiReservation)
update_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask.FieldMask)
__all__ = tuple(sorted(__protobuf__.manifest))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29900,
5087,
365,
12182,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
29937,
13,
13,
5215,
17814,
29871,
396,
1134,
29901,
11455,
13,
13,
13,
3166,
5386,
29889,
17529,
9721,
1053,
1746,
29918,
13168,
29918,
24381,
29906,
408,
1746,
29918,
13168,
29871,
396,
1134,
29901,
11455,
13,
3166,
5386,
29889,
17529,
9721,
1053,
14334,
29918,
24381,
29906,
408,
14334,
29871,
396,
1134,
29901,
11455,
13,
3166,
5386,
29889,
29878,
6739,
1053,
4660,
29918,
24381,
29906,
408,
4660,
29871,
396,
1134,
29901,
11455,
13,
13,
13,
1649,
17529,
9721,
1649,
353,
17814,
29889,
5453,
29898,
13,
1678,
3577,
543,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
613,
13,
1678,
10419,
3790,
13,
4706,
376,
1666,
20525,
613,
13,
4706,
376,
12415,
5946,
1523,
2415,
358,
613,
13,
4706,
376,
4391,
1666,
20525,
3089,
613,
13,
4706,
376,
1293,
1666,
6972,
800,
3089,
613,
13,
4706,
376,
1293,
1666,
6972,
800,
5103,
613,
13,
4706,
376,
2577,
1666,
20525,
3089,
613,
13,
4706,
376,
12498,
1666,
20525,
3089,
613,
13,
4706,
376,
6422,
1666,
20525,
3089,
613,
13,
4706,
376,
4391,
12415,
5946,
1523,
2415,
358,
3089,
613,
13,
4706,
376,
1293,
12415,
5946,
1523,
2415,
1860,
3089,
613,
13,
4706,
376,
1293,
12415,
5946,
1523,
2415,
1860,
5103,
613,
13,
4706,
376,
2577,
12415,
5946,
1523,
2415,
358,
3089,
613,
13,
4706,
376,
12498,
12415,
5946,
1523,
2415,
358,
3089,
613,
13,
4706,
376,
6422,
12415,
5946,
1523,
2415,
358,
3089,
613,
13,
4706,
376,
18772,
12415,
5946,
1523,
2415,
358,
3089,
613,
13,
4706,
376,
18772,
12415,
5946,
1523,
2415,
358,
5103,
613,
13,
4706,
376,
15836,
479,
12415,
5946,
1523,
2415,
1860,
3089,
613,
13,
4706,
376,
7900,
10194,
613,
13,
4706,
376,
4391,
7900,
10194,
3089,
613,
13,
4706,
376,
1293,
7900,
647,
1860,
3089,
613,
13,
4706,
376,
1293,
7900,
647,
1860,
5103,
613,
13,
4706,
376,
12498,
7900,
10194,
3089,
613,
13,
4706,
376,
7974,
7900,
647,
1860,
3089,
613,
13,
4706,
376,
7974,
7900,
647,
1860,
5103,
613,
13,
4706,
376,
16619,
7900,
10194,
3089,
613,
13,
4706,
376,
20517,
1666,
20525,
613,
13,
4706,
376,
2577,
20517,
1666,
20525,
3089,
613,
13,
4706,
376,
6422,
20517,
1666,
20525,
3089,
613,
13,
1678,
2981,
13,
29897,
13,
13,
13,
1990,
2538,
20525,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
29909,
620,
20525,
338,
263,
13336,
1304,
304,
18818,
2243,
1862,
304,
13,
1678,
4160,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
450,
6503,
1024,
310,
278,
620,
20525,
29892,
321,
29889,
29887,
1696,
13,
9651,
4954,
16418,
29914,
3877,
2029,
800,
29914,
3877,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
29952,
1412,
13,
4706,
21497,
29918,
5030,
5946,
313,
524,
1125,
13,
9651,
3080,
12539,
2243,
1862,
3625,
304,
445,
620,
20525,
29889,
319,
21497,
338,
263,
13,
9651,
5190,
310,
26845,
3081,
297,
7997,
3010,
29892,
322,
19700,
408,
278,
13,
9651,
5190,
310,
8943,
1608,
29889,
13,
13,
9651,
751,
6358,
773,
445,
620,
20525,
1795,
671,
901,
2243,
1862,
2645,
13,
9651,
10073,
565,
11455,
29918,
333,
280,
29918,
2536,
1862,
338,
731,
304,
2089,
29889,
13,
13,
9651,
960,
278,
716,
620,
20525,
29915,
29879,
21497,
13284,
13461,
278,
3847,
29915,
29879,
13,
9651,
21497,
13284,
470,
565,
3001,
21497,
13284,
310,
278,
716,
13,
9651,
620,
20525,
322,
967,
27767,
18964,
13461,
29879,
278,
3847,
29915,
29879,
21497,
13,
9651,
13284,
29892,
278,
2009,
674,
4418,
411,
13,
9651,
4954,
3608,
29889,
29878,
6739,
29889,
3399,
29889,
1525,
27839,
4741,
29918,
5746,
15715,
17321,
3352,
29952,
1412,
13,
4706,
11455,
29918,
333,
280,
29918,
2536,
1862,
313,
11227,
1125,
13,
9651,
960,
2089,
29892,
738,
2346,
773,
445,
620,
20525,
13,
9651,
674,
671,
28132,
2243,
1862,
515,
916,
620,
6972,
800,
13,
9651,
2629,
278,
1021,
4113,
2060,
29889,
960,
1565,
29892,
263,
2346,
13,
9651,
773,
445,
620,
20525,
674,
6222,
411,
278,
13,
9651,
21497,
13284,
6790,
2038,
472,
1556,
29889,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
21497,
29918,
5030,
5946,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29953,
29946,
29892,
1353,
29922,
29906,
29897,
13,
1678,
11455,
29918,
333,
280,
29918,
2536,
1862,
353,
17814,
29889,
3073,
29898,
17529,
29889,
28443,
29892,
1353,
29922,
29946,
29897,
13,
13,
13,
1990,
5915,
5946,
1523,
2415,
358,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
12415,
5946,
9063,
358,
338,
263,
982,
304,
20590,
10272,
13284,
363,
13,
1678,
7997,
3010,
17643,
313,
262,
278,
883,
310,
2243,
1862,
29897,
411,
777,
19355,
3785,
13,
1678,
310,
8744,
29889,
8081,
950,
9063,
1860,
23011,
491,
2322,
29889,
1876,
277,
1860,
508,
13,
1678,
367,
6206,
1156,
1009,
9063,
358,
1095,
931,
14517,
29889,
13,
13,
1678,
512,
1797,
304,
3349,
17568,
9063,
358,
29892,
967,
3814,
4225,
304,
367,
13,
1678,
3939,
304,
4098,
368,
470,
8525,
937,
29889,
13,
13,
1678,
319,
13284,
9063,
358,
6503,
4864,
408,
263,
2278,
6503,
310,
278,
13,
1678,
4113,
2060,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
10604,
871,
29889,
450,
6503,
1024,
310,
278,
13284,
9063,
358,
29892,
13,
9651,
321,
29889,
29887,
1696,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
5030,
5946,
1523,
2415,
1860,
29914,
29896,
29906,
29941,
16159,
13,
4706,
21497,
29918,
2798,
313,
524,
1125,
13,
9651,
9681,
310,
2243,
1862,
297,
445,
9063,
358,
29889,
13,
4706,
3814,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
29889,
1523,
2415,
358,
20334,
1125,
13,
9651,
5915,
5946,
9063,
358,
9063,
358,
3814,
29889,
13,
4706,
2106,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
29889,
2792,
1125,
13,
9651,
10604,
871,
29889,
4306,
310,
278,
9063,
358,
29889,
13,
4706,
9063,
358,
29918,
355,
29918,
2230,
313,
30022,
29889,
16394,
29889,
27939,
1125,
13,
9651,
10604,
871,
29889,
450,
1095,
310,
278,
1857,
13,
9651,
9063,
358,
3785,
29889,
739,
338,
22903,
871,
363,
13,
9651,
319,
1783,
18474,
13284,
9063,
1860,
29889,
13,
4706,
10672,
29918,
4882,
313,
30022,
29889,
4882,
29889,
5709,
1125,
13,
9651,
10604,
871,
29889,
1152,
13515,
29902,
20566,
9063,
358,
3814,
29892,
13,
9651,
8128,
278,
2769,
310,
10672,
29889,
13,
4706,
23011,
284,
29918,
9018,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
29889,
1523,
2415,
358,
20334,
1125,
13,
9651,
450,
3814,
445,
13284,
9063,
358,
338,
11543,
304,
1156,
13,
9651,
9063,
358,
29918,
355,
29918,
2230,
14517,
29889,
9038,
278,
3814,
338,
3939,
29892,
13,
9651,
19355,
3785,
338,
10410,
5034,
304,
9063,
358,
3814,
29889,
13,
9651,
9333,
22903,
363,
319,
10262,
29965,
1964,
322,
323,
3960,
1964,
9063,
1860,
29889,
13,
1678,
9995,
13,
13,
1678,
770,
1876,
277,
358,
20334,
29898,
17529,
29889,
16854,
1125,
13,
4706,
364,
15945,
29908,
1523,
2415,
358,
3814,
17645,
278,
1857,
19355,
3785,
29889,
13,
4706,
5915,
5946,
9063,
358,
2609,
367,
11132,
2645,
372,
29915,
29879,
19355,
13,
4706,
3785,
29889,
13,
4706,
9995,
13,
4706,
4810,
7428,
1806,
13780,
29918,
7390,
2190,
29918,
29965,
3059,
4162,
8426,
3738,
3352,
353,
29871,
29900,
13,
4706,
383,
1307,
29990,
353,
29871,
29941,
13,
4706,
323,
3960,
1964,
353,
29871,
29945,
13,
4706,
341,
1164,
4690,
16786,
353,
29871,
29906,
13,
4706,
319,
10262,
29965,
1964,
353,
29871,
29946,
13,
13,
1678,
770,
4306,
29898,
17529,
29889,
16854,
1125,
13,
4706,
364,
15945,
29908,
12415,
5946,
9063,
358,
508,
2845,
4953,
319,
1783,
18474,
1492,
3448,
470,
13,
4706,
9558,
515,
349,
11794,
4214,
304,
319,
1783,
18474,
470,
13515,
29902,
20566,
29889,
13,
4706,
9995,
13,
4706,
6850,
3040,
29918,
29965,
3059,
4162,
8426,
3738,
3352,
353,
29871,
29900,
13,
4706,
349,
11794,
4214,
353,
29871,
29896,
13,
4706,
319,
1783,
18474,
353,
29871,
29906,
13,
4706,
13515,
29902,
20566,
353,
29871,
29941,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
21497,
29918,
2798,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29953,
29946,
29892,
1353,
29922,
29906,
29897,
13,
1678,
3814,
353,
17814,
29889,
3073,
29898,
17529,
29889,
1430,
5005,
29892,
1353,
29922,
29941,
29892,
14115,
29922,
1523,
2415,
358,
20334,
29897,
13,
1678,
2106,
353,
17814,
29889,
3073,
29898,
17529,
29889,
1430,
5005,
29892,
1353,
29922,
29946,
29892,
14115,
29922,
2792,
29897,
13,
1678,
9063,
358,
29918,
355,
29918,
2230,
353,
17814,
29889,
3073,
29898,
13,
4706,
17814,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29945,
29892,
2643,
29922,
16394,
29889,
27939,
13,
1678,
1723,
13,
1678,
10672,
29918,
4882,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29955,
29892,
2643,
29922,
4882,
29889,
5709,
29897,
13,
1678,
23011,
284,
29918,
9018,
353,
17814,
29889,
3073,
29898,
17529,
29889,
1430,
5005,
29892,
1353,
29922,
29947,
29892,
14115,
29922,
1523,
2415,
358,
20334,
29897,
13,
13,
13,
1990,
6204,
1666,
20525,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
4391,
1666,
20525,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
4391,
1666,
20525,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
8010,
29892,
4423,
29889,
382,
29889,
29887,
1696,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
16159,
13,
4706,
620,
20525,
29918,
333,
313,
710,
1125,
13,
9651,
450,
620,
20525,
3553,
29889,
910,
1746,
1818,
871,
13,
9651,
1712,
5224,
1206,
394,
16711,
25099,
4890,
470,
13,
9651,
12569,
29889,
5918,
3309,
338,
29871,
29953,
29946,
4890,
29889,
13,
4706,
620,
20525,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
1666,
20525,
1125,
13,
9651,
21940,
310,
278,
716,
620,
20525,
304,
1653,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
620,
20525,
29918,
333,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29906,
29897,
13,
1678,
620,
20525,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29941,
29892,
2643,
29922,
1666,
20525,
29897,
13,
13,
13,
1990,
2391,
1666,
6972,
800,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
1293,
1666,
6972,
800,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
1293,
1666,
6972,
800,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
450,
3847,
6503,
1024,
6943,
13,
9651,
2060,
322,
4423,
29892,
321,
29889,
29887,
4898,
13,
9651,
376,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
1642,
13,
4706,
1813,
29918,
2311,
313,
524,
1125,
13,
9651,
450,
7472,
1353,
310,
4452,
304,
736,
639,
13,
9651,
1813,
29889,
13,
4706,
1813,
29918,
6979,
313,
710,
1125,
13,
9651,
450,
2446,
29918,
3488,
29918,
6979,
995,
4133,
515,
263,
3517,
2391,
13,
9651,
2009,
29892,
565,
738,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
1813,
29918,
2311,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29941,
29906,
29892,
1353,
29922,
29906,
29897,
13,
1678,
1813,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29941,
29897,
13,
13,
13,
1990,
2391,
1666,
6972,
800,
5103,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2933,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
1293,
1666,
6972,
800,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
1293,
1666,
6972,
800,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
620,
6972,
800,
313,
20529,
29961,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
1666,
20525,
29962,
1125,
13,
9651,
2391,
310,
620,
6972,
800,
7962,
304,
278,
1404,
29889,
13,
4706,
2446,
29918,
3488,
29918,
6979,
313,
710,
1125,
13,
9651,
25159,
304,
10563,
278,
2446,
1813,
310,
2582,
29892,
13,
9651,
470,
4069,
565,
727,
526,
694,
901,
2582,
297,
278,
13,
9651,
1051,
29889,
13,
1678,
9995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10650,
29918,
3488,
29898,
1311,
1125,
13,
4706,
736,
1583,
13,
13,
1678,
620,
6972,
800,
353,
17814,
29889,
1123,
412,
630,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
1666,
20525,
29897,
13,
1678,
2446,
29918,
3488,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29906,
29897,
13,
13,
13,
1990,
3617,
1666,
20525,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
2577,
1666,
20525,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
2577,
1666,
20525,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
18981,
1024,
310,
278,
620,
20525,
304,
10563,
29889,
13,
9651,
382,
29889,
29887,
1696,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
16159,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
13,
13,
1990,
21267,
1666,
20525,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
12498,
1666,
20525,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
12498,
1666,
20525,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
18981,
1024,
310,
278,
620,
20525,
304,
10563,
29889,
13,
9651,
382,
29889,
29887,
1696,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
16159,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
13,
13,
1990,
10318,
1666,
20525,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
6422,
1666,
20525,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
6422,
1666,
20525,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
620,
20525,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
1666,
20525,
1125,
13,
9651,
10576,
310,
278,
620,
20525,
304,
2767,
29889,
13,
4706,
2767,
29918,
13168,
313,
30022,
29889,
2671,
29918,
13168,
29889,
3073,
19832,
1125,
13,
9651,
10117,
1746,
11105,
363,
278,
731,
310,
4235,
304,
13,
9651,
367,
4784,
29889,
13,
1678,
9995,
13,
13,
1678,
620,
20525,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
1666,
20525,
29897,
13,
1678,
2767,
29918,
13168,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29906,
29892,
2643,
29922,
2671,
29918,
13168,
29889,
3073,
19832,
29897,
13,
13,
13,
1990,
6204,
12415,
5946,
1523,
2415,
358,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
4391,
12415,
5946,
1523,
2415,
358,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
4391,
12415,
5946,
1523,
2415,
358,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
18981,
1024,
310,
278,
3847,
13,
9651,
620,
20525,
29889,
382,
29889,
29887,
1696,
13,
9651,
9279,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
13,
4706,
13284,
29918,
15060,
358,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
1125,
13,
9651,
10576,
310,
278,
13284,
9063,
358,
304,
1653,
29889,
13,
4706,
427,
10118,
29918,
14369,
29918,
6406,
29918,
4836,
29918,
546,
29918,
990,
313,
11227,
1125,
13,
9651,
960,
1565,
29892,
4418,
278,
2009,
565,
1790,
2060,
13,
9651,
297,
278,
13013,
756,
263,
13284,
9063,
358,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
13284,
29918,
15060,
358,
353,
17814,
29889,
3073,
29898,
13,
4706,
17814,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29906,
29892,
2643,
29922,
12415,
5946,
1523,
2415,
358,
13,
1678,
1723,
13,
1678,
427,
10118,
29918,
14369,
29918,
6406,
29918,
4836,
29918,
546,
29918,
990,
353,
17814,
29889,
3073,
29898,
17529,
29889,
28443,
29892,
1353,
29922,
29946,
29897,
13,
13,
13,
1990,
2391,
12415,
5946,
1523,
2415,
1860,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
1293,
12415,
5946,
1523,
2415,
1860,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
1293,
12415,
5946,
1523,
2415,
1860,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
18981,
1024,
310,
278,
3847,
13,
9651,
620,
20525,
29889,
382,
29889,
29887,
1696,
13,
9651,
9279,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
13,
4706,
1813,
29918,
2311,
313,
524,
1125,
13,
9651,
450,
7472,
1353,
310,
4452,
304,
736,
29889,
13,
4706,
1813,
29918,
6979,
313,
710,
1125,
13,
9651,
450,
2446,
29918,
3488,
29918,
6979,
995,
4133,
515,
263,
3517,
2391,
13,
9651,
2009,
29892,
565,
738,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
1813,
29918,
2311,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29941,
29906,
29892,
1353,
29922,
29906,
29897,
13,
1678,
1813,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29941,
29897,
13,
13,
13,
1990,
2391,
12415,
5946,
1523,
2415,
1860,
5103,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2933,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
1293,
12415,
5946,
1523,
2415,
1860,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
1293,
12415,
5946,
1523,
2415,
1860,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
13284,
29918,
15060,
1860,
313,
20529,
29961,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
29962,
1125,
13,
9651,
2391,
310,
13284,
9063,
1860,
7962,
304,
278,
13,
9651,
1404,
29889,
13,
4706,
2446,
29918,
3488,
29918,
6979,
313,
710,
1125,
13,
9651,
25159,
304,
10563,
278,
2446,
1813,
310,
2582,
29892,
13,
9651,
470,
4069,
565,
727,
526,
694,
901,
2582,
297,
278,
13,
9651,
1051,
29889,
13,
1678,
9995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10650,
29918,
3488,
29898,
1311,
1125,
13,
4706,
736,
1583,
13,
13,
1678,
13284,
29918,
15060,
1860,
353,
17814,
29889,
1123,
412,
630,
3073,
29898,
13,
4706,
17814,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
12415,
5946,
1523,
2415,
358,
13,
1678,
1723,
13,
1678,
2446,
29918,
3488,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29906,
29897,
13,
13,
13,
1990,
3617,
12415,
5946,
1523,
2415,
358,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
2577,
12415,
5946,
1523,
2415,
358,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
2577,
12415,
5946,
1523,
2415,
358,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
18981,
1024,
310,
278,
13284,
13,
9651,
9063,
358,
304,
10563,
29889,
382,
29889,
29887,
1696,
13,
9651,
9279,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
5030,
5946,
1523,
2415,
1860,
29914,
29896,
29906,
29941,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
13,
13,
1990,
21267,
12415,
5946,
1523,
2415,
358,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
12498,
12415,
5946,
1523,
2415,
358,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
12498,
12415,
5946,
1523,
2415,
358,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
18981,
1024,
310,
278,
13284,
13,
9651,
9063,
358,
304,
5217,
29889,
382,
29889,
29887,
1696,
13,
9651,
9279,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
5030,
5946,
1523,
2415,
1860,
29914,
29896,
29906,
29941,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
13,
13,
1990,
10318,
12415,
5946,
1523,
2415,
358,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
6422,
12415,
5946,
1523,
2415,
358,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
6422,
12415,
5946,
1523,
2415,
358,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
13284,
29918,
15060,
358,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
1125,
13,
9651,
10576,
310,
278,
13284,
9063,
358,
304,
2767,
29889,
13,
4706,
2767,
29918,
13168,
313,
30022,
29889,
2671,
29918,
13168,
29889,
3073,
19832,
1125,
13,
9651,
10117,
1746,
11105,
363,
278,
731,
310,
4235,
304,
13,
9651,
367,
4784,
29889,
13,
1678,
9995,
13,
13,
1678,
13284,
29918,
15060,
358,
353,
17814,
29889,
3073,
29898,
13,
4706,
17814,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
12415,
5946,
1523,
2415,
358,
13,
1678,
1723,
13,
1678,
2767,
29918,
13168,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29906,
29892,
2643,
29922,
2671,
29918,
13168,
29889,
3073,
19832,
29897,
13,
13,
13,
1990,
26178,
12415,
5946,
1523,
2415,
358,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
18772,
12415,
5946,
1523,
2415,
358,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
18772,
12415,
5946,
1523,
2415,
358,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
450,
6503,
1024,
321,
29889,
29887,
1696,
29901,
13,
9651,
9279,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
5030,
5946,
1523,
2415,
1860,
29914,
29896,
29906,
29941,
13,
4706,
21497,
29918,
2798,
313,
524,
1125,
13,
9651,
9681,
310,
2243,
1862,
297,
278,
13284,
9063,
358,
13,
9651,
1156,
278,
6219,
29889,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
21497,
29918,
2798,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29953,
29946,
29892,
1353,
29922,
29906,
29897,
13,
13,
13,
1990,
26178,
12415,
5946,
1523,
2415,
358,
5103,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2933,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
18772,
12415,
5946,
1523,
2415,
358,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
18772,
12415,
5946,
1523,
2415,
358,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
937,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
1125,
13,
9651,
3824,
13284,
9063,
358,
29892,
1121,
310,
263,
6219,
29889,
13,
4706,
1473,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
12415,
5946,
1523,
2415,
358,
1125,
13,
9651,
6440,
13284,
9063,
358,
29892,
1121,
310,
263,
13,
9651,
6219,
29889,
13,
1678,
9995,
13,
13,
1678,
937,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
12415,
5946,
1523,
2415,
358,
29897,
13,
1678,
1473,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29906,
29892,
2643,
29922,
12415,
5946,
1523,
2415,
358,
29897,
13,
13,
13,
1990,
4702,
479,
12415,
5946,
1523,
2415,
1860,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
15836,
479,
12415,
5946,
1523,
2415,
1860,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
15836,
479,
12415,
5946,
1523,
2415,
1860,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
22280,
6503,
393,
2893,
11057,
4113,
2060,
13,
9651,
322,
4423,
321,
29889,
29887,
1696,
13,
9651,
9279,
29914,
1357,
4836,
29914,
2029,
800,
29914,
375,
13,
4706,
13284,
29918,
15060,
358,
29918,
4841,
313,
20529,
29961,
710,
29962,
1125,
13,
9651,
5163,
29879,
310,
13284,
9063,
1860,
304,
10366,
29889,
13,
9651,
4525,
13284,
9063,
1860,
1818,
1863,
1090,
13,
9651,
4113,
2060,
322,
4423,
6790,
297,
278,
13,
9651,
3847,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
13284,
29918,
15060,
358,
29918,
4841,
353,
17814,
29889,
1123,
412,
630,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29906,
29897,
13,
13,
13,
1990,
4007,
10194,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
29909,
4007,
10194,
6511,
263,
2060,
304,
9752,
17643,
13,
1678,
310,
263,
3058,
1134,
773,
2243,
1862,
515,
278,
6790,
620,
20525,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
10604,
871,
29889,
4408,
310,
278,
6503,
29889,
382,
29889,
29887,
4898,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
29914,
16645,
1860,
29914,
29896,
29906,
29941,
29952,
1412,
13,
4706,
1223,
4895,
29872,
313,
710,
1125,
13,
9651,
450,
6503,
607,
674,
671,
278,
620,
20525,
29889,
382,
29889,
29887,
29889,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29952,
1673,
4954,
8771,
414,
29914,
29896,
29906,
29941,
29952,
1673,
470,
13,
9651,
4954,
6388,
17063,
29914,
29946,
29945,
29953,
29952,
1412,
13,
4706,
4982,
29918,
1853,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
7900,
10194,
29889,
11947,
1542,
1125,
13,
9651,
8449,
1134,
310,
17643,
674,
671,
278,
620,
20525,
29889,
13,
4706,
2106,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
7900,
10194,
29889,
2792,
1125,
13,
9651,
10604,
871,
29889,
4306,
310,
278,
12827,
29889,
13,
1678,
9995,
13,
13,
1678,
770,
17163,
1542,
29898,
17529,
29889,
16854,
1125,
13,
4706,
364,
15945,
29908,
10562,
310,
4982,
29892,
607,
1033,
367,
6790,
746,
773,
278,
13,
4706,
620,
20525,
29889,
13,
4706,
9995,
13,
4706,
435,
14824,
29918,
11116,
29918,
29965,
3059,
4162,
8426,
3738,
3352,
353,
29871,
29900,
13,
4706,
349,
29902,
4162,
18521,
353,
29871,
29896,
13,
4706,
660,
29965,
24422,
353,
29871,
29906,
13,
13,
1678,
770,
4306,
29898,
17529,
29889,
16854,
1125,
13,
4706,
364,
15945,
29908,
7900,
10194,
674,
3933,
297,
349,
11794,
4214,
2106,
565,
694,
6136,
13284,
13,
4706,
9063,
358,
338,
2198,
29889,
739,
674,
4953,
319,
1783,
18474,
746,
777,
13284,
13,
4706,
9063,
358,
7415,
6136,
29889,
13,
4706,
9995,
13,
4706,
6850,
3040,
29918,
29965,
3059,
4162,
8426,
3738,
3352,
353,
29871,
29900,
13,
4706,
349,
11794,
4214,
353,
29871,
29896,
13,
4706,
319,
1783,
18474,
353,
29871,
29906,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
1223,
4895,
29872,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29946,
29897,
13,
1678,
4982,
29918,
1853,
353,
17814,
29889,
3073,
29898,
17529,
29889,
1430,
5005,
29892,
1353,
29922,
29941,
29892,
14115,
29922,
11947,
1542,
29897,
13,
1678,
2106,
353,
17814,
29889,
3073,
29898,
17529,
29889,
1430,
5005,
29892,
1353,
29922,
29953,
29892,
14115,
29922,
2792,
29897,
13,
13,
13,
1990,
6204,
7900,
10194,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
4391,
7900,
10194,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
4391,
7900,
10194,
1822,
13,
1678,
3940,
29901,
376,
3752,
1972,
29889,
690,
20525,
7900,
647,
1860,
29889,
3258,
29908,
10751,
338,
13,
1678,
3734,
373,
278,
4475,
1223,
4895,
29872,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
450,
3847,
6503,
1024,
310,
278,
12827,
382,
29889,
29887,
29889,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
16159,
13,
4706,
12827,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
7900,
10194,
1125,
13,
9651,
4007,
10194,
6503,
304,
1653,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
12827,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29906,
29892,
2643,
29922,
7900,
10194,
29897,
13,
13,
13,
1990,
2391,
7900,
647,
1860,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
1293,
7900,
647,
1860,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
1293,
7900,
647,
1860,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
450,
3847,
6503,
1024,
321,
29889,
29887,
4898,
13,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
16159,
13,
13,
9651,
1394,
29901,
13,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
24028,
16159,
13,
4706,
1813,
29918,
2311,
313,
524,
1125,
13,
9651,
450,
7472,
1353,
310,
4452,
304,
736,
639,
13,
9651,
1813,
29889,
13,
4706,
1813,
29918,
6979,
313,
710,
1125,
13,
9651,
450,
2446,
29918,
3488,
29918,
6979,
995,
4133,
515,
263,
3517,
2391,
13,
9651,
2009,
29892,
565,
738,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
1813,
29918,
2311,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29941,
29906,
29892,
1353,
29922,
29906,
29897,
13,
1678,
1813,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29941,
29897,
13,
13,
13,
1990,
2391,
7900,
647,
1860,
5103,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2933,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
1293,
7900,
647,
1860,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
1293,
7900,
647,
1860,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3566,
1860,
313,
20529,
29961,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
7900,
10194,
29962,
1125,
13,
9651,
2391,
310,
3566,
1860,
7962,
304,
278,
1404,
29889,
13,
4706,
2446,
29918,
3488,
29918,
6979,
313,
710,
1125,
13,
9651,
25159,
304,
10563,
278,
2446,
1813,
310,
2582,
29892,
13,
9651,
470,
4069,
565,
727,
526,
694,
901,
2582,
297,
278,
13,
9651,
1051,
29889,
13,
1678,
9995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10650,
29918,
3488,
29898,
1311,
1125,
13,
4706,
736,
1583,
13,
13,
1678,
3566,
1860,
353,
17814,
29889,
1123,
412,
630,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
7900,
10194,
29897,
13,
1678,
2446,
29918,
3488,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29906,
29897,
13,
13,
13,
1990,
21267,
7900,
10194,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
12498,
7900,
10194,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
12498,
7900,
10194,
1822,
13,
1678,
3940,
29901,
376,
3752,
1972,
29889,
690,
20525,
7900,
647,
1860,
29889,
8143,
29908,
10751,
338,
13,
1678,
3734,
373,
278,
4475,
1223,
4895,
29872,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
4408,
310,
278,
6503,
29892,
321,
29889,
29887,
29889,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
29914,
16645,
1860,
29914,
29896,
29906,
29941,
16159,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
13,
13,
1990,
11856,
7900,
647,
1860,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
7974,
7900,
647,
1860,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
7974,
7900,
647,
1860,
1822,
13,
1678,
3940,
29901,
376,
3752,
1972,
29889,
690,
20525,
7900,
647,
1860,
29889,
4478,
29908,
10751,
338,
13,
1678,
3734,
373,
278,
4475,
1223,
4895,
29872,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3847,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
450,
6503,
1024,
310,
278,
4113,
13,
9651,
2060,
29898,
1285,
17225,
2060,
322,
4423,
511,
321,
29889,
29887,
4898,
13,
9651,
376,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
1642,
13,
4706,
2346,
313,
710,
1125,
13,
9651,
3529,
6084,
6503,
1024,
408,
1223,
4895,
29872,
297,
278,
2346,
29889,
13,
13,
9651,
1222,
9422,
29901,
13,
13,
9651,
448,
29871,
4954,
465,
4895,
29872,
29922,
16418,
29914,
1357,
4836,
16159,
13,
9651,
448,
29871,
4954,
465,
4895,
29872,
29922,
8771,
414,
29914,
29896,
29906,
29941,
16159,
13,
9651,
448,
29871,
4954,
465,
4895,
29872,
29922,
6388,
17063,
29914,
29946,
29945,
29953,
16159,
13,
4706,
1813,
29918,
2311,
313,
524,
1125,
13,
9651,
450,
7472,
1353,
310,
4452,
304,
736,
639,
13,
9651,
1813,
29889,
13,
4706,
1813,
29918,
6979,
313,
710,
1125,
13,
9651,
450,
2446,
29918,
3488,
29918,
6979,
995,
4133,
515,
263,
3517,
2391,
13,
9651,
2009,
29892,
565,
738,
29889,
13,
1678,
9995,
13,
13,
1678,
3847,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
2346,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29906,
29897,
13,
1678,
1813,
29918,
2311,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29941,
29906,
29892,
1353,
29922,
29941,
29897,
13,
1678,
1813,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29946,
29897,
13,
13,
13,
1990,
11856,
7900,
647,
1860,
5103,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2933,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
7974,
7900,
647,
1860,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
7974,
7900,
647,
1860,
1822,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
3566,
1860,
313,
20529,
29961,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
7900,
10194,
29962,
1125,
13,
9651,
2391,
310,
3566,
1860,
7962,
304,
278,
1404,
29889,
13,
4706,
2446,
29918,
3488,
29918,
6979,
313,
710,
1125,
13,
9651,
25159,
304,
10563,
278,
2446,
1813,
310,
2582,
29892,
13,
9651,
470,
4069,
565,
727,
526,
694,
901,
2582,
297,
278,
13,
9651,
1051,
29889,
13,
1678,
9995,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10650,
29918,
3488,
29898,
1311,
1125,
13,
4706,
736,
1583,
13,
13,
1678,
3566,
1860,
353,
17814,
29889,
1123,
412,
630,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
7900,
10194,
29897,
13,
1678,
2446,
29918,
3488,
29918,
6979,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29906,
29897,
13,
13,
13,
1990,
25249,
7900,
10194,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1576,
2009,
363,
13,
1678,
518,
1666,
20525,
3170,
29889,
16619,
7900,
10194,
3816,
3608,
29889,
9274,
29889,
3752,
1972,
29889,
690,
20525,
29889,
29894,
29896,
29889,
1666,
20525,
3170,
29889,
16619,
7900,
10194,
1822,
13,
13,
1678,
3579,
9842,
1068,
29901,
376,
3752,
1972,
29889,
690,
20525,
7900,
647,
1860,
29889,
3258,
29908,
10751,
338,
13,
1678,
3734,
373,
278,
12551,
29918,
333,
29889,
13,
13,
1678,
3579,
9842,
1068,
29901,
376,
3752,
1972,
29889,
690,
20525,
7900,
647,
1860,
29889,
3258,
29908,
322,
13,
1678,
376,
3752,
1972,
29889,
690,
20525,
7900,
647,
1860,
29889,
8143,
29908,
10751,
526,
3734,
373,
13,
1678,
278,
4475,
1223,
4895,
29872,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
450,
6503,
1024,
310,
278,
12827,
29892,
321,
29889,
29887,
29889,
13,
9651,
4954,
16418,
29914,
1357,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29896,
29899,
10633,
29914,
16645,
1860,
29914,
29896,
29906,
29941,
16159,
13,
4706,
12551,
29918,
333,
313,
710,
1125,
13,
9651,
450,
716,
620,
20525,
3553,
29892,
321,
29889,
29887,
4898,
13,
9651,
4954,
16418,
29914,
1357,
1228,
4836,
29914,
2029,
800,
29914,
3308,
29914,
690,
6972,
800,
29914,
14318,
29906,
29899,
10633,
16159,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
12551,
29918,
333,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29941,
29897,
13,
13,
13,
1990,
3457,
1666,
20525,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
1123,
4569,
1237,
263,
350,
29902,
2538,
20525,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
450,
6503,
1024,
310,
278,
27130,
350,
29902,
620,
20525,
29889,
13,
9651,
2538,
20525,
2983,
505,
278,
883,
13,
9651,
4954,
16418,
19248,
4836,
29918,
333,
6822,
2029,
800,
19248,
5479,
29918,
333,
6822,
29890,
2658,
20525,
29952,
1412,
13,
4706,
2767,
29918,
2230,
313,
30022,
29889,
16394,
29889,
27939,
1125,
13,
9651,
10604,
871,
29889,
450,
1833,
2767,
14334,
310,
263,
13,
9651,
620,
20525,
29889,
13,
4706,
2159,
313,
524,
1125,
13,
9651,
21179,
310,
263,
620,
20525,
29892,
297,
6262,
29889,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
1678,
2767,
29918,
2230,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29941,
29892,
2643,
29922,
16394,
29889,
27939,
29897,
13,
1678,
2159,
353,
17814,
29889,
3073,
29898,
17529,
29889,
10192,
29953,
29946,
29892,
1353,
29922,
29946,
29897,
13,
13,
13,
1990,
3617,
20517,
1666,
20525,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
29909,
2009,
304,
679,
263,
27130,
350,
29902,
620,
20525,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
1024,
313,
710,
1125,
13,
9651,
830,
5958,
29889,
4408,
310,
278,
13877,
620,
20525,
29892,
363,
1342,
29901,
13,
9651,
4954,
16418,
19248,
4836,
29918,
333,
6822,
2029,
800,
19248,
5479,
29918,
333,
6822,
29890,
2658,
20525,
16159,
13,
1678,
9995,
13,
13,
1678,
1024,
353,
17814,
29889,
3073,
29898,
17529,
29889,
20785,
29892,
1353,
29922,
29896,
29897,
13,
13,
13,
1990,
10318,
20517,
1666,
20525,
3089,
29898,
17529,
29889,
3728,
1125,
13,
1678,
364,
15945,
29908,
29909,
2009,
304,
2767,
263,
350,
29902,
620,
20525,
29889,
13,
13,
1678,
6212,
5026,
29901,
13,
4706,
4768,
29918,
690,
20525,
313,
30022,
29889,
27354,
1182,
29918,
690,
20525,
29889,
20517,
1666,
20525,
1125,
13,
9651,
319,
620,
20525,
304,
2767,
29889,
13,
4706,
2767,
29918,
13168,
313,
30022,
29889,
2671,
29918,
13168,
29889,
3073,
19832,
1125,
13,
9651,
319,
1051,
310,
4235,
304,
367,
4784,
297,
445,
13,
9651,
2009,
29889,
13,
1678,
9995,
13,
13,
1678,
4768,
29918,
690,
20525,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29896,
29892,
2643,
29922,
20517,
1666,
20525,
29897,
13,
1678,
2767,
29918,
13168,
353,
17814,
29889,
3073,
29898,
17529,
29889,
2303,
1799,
10461,
29892,
1353,
29922,
29906,
29892,
2643,
29922,
2671,
29918,
13168,
29889,
3073,
19832,
29897,
13,
13,
13,
1649,
497,
1649,
353,
18761,
29898,
24582,
22168,
17529,
9721,
26914,
29135,
876,
13,
2
] |
job-queue-portal/postgres_django_queue/djangoenv/lib/python3.8/site-packages/django_celery_results/utils.py | Sruthi-Ganesh/postgres-django-queue | 0 | 185979 | """Utilities."""
# -- XXX This module must not use translation as that causes
# -- a recursive loader import!
from django.conf import settings
from django.utils import timezone
# see Issue celery/django-celery#222
now_localtime = getattr(timezone, 'template_localtime', timezone.localtime)
def now():
"""Return the current date and time."""
if getattr(settings, 'USE_TZ', False):
return now_localtime(timezone.now())
else:
return timezone.now()
| [
1,
9995,
7270,
1907,
1213,
15945,
13,
29937,
1192,
22615,
910,
3883,
1818,
451,
671,
13962,
408,
393,
9946,
13,
29937,
1192,
263,
16732,
23466,
1053,
29991,
13,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
13239,
1053,
29431,
13,
13,
29937,
1074,
26246,
6432,
708,
29914,
14095,
29899,
2242,
708,
29937,
29906,
29906,
29906,
13,
3707,
29918,
2997,
2230,
353,
679,
5552,
29898,
2230,
8028,
29892,
525,
6886,
29918,
2997,
2230,
742,
29431,
29889,
2997,
2230,
29897,
13,
13,
13,
1753,
1286,
7295,
13,
1678,
9995,
11609,
278,
1857,
2635,
322,
931,
1213,
15945,
13,
1678,
565,
679,
5552,
29898,
11027,
29892,
525,
17171,
29918,
29911,
29999,
742,
7700,
1125,
13,
4706,
736,
1286,
29918,
2997,
2230,
29898,
2230,
8028,
29889,
3707,
3101,
13,
1678,
1683,
29901,
13,
4706,
736,
29431,
29889,
3707,
580,
13,
2
] |
code/Dictionary/key_of_min.py | jumploop/30-seconds-of-python | 0 | 197308 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
功能实现:在字典中查找最小值的键。
解读:
使用min()并将key参数设置为dict.get()来查找并返回给定字典中最小值的键。
"""
def key_of_min(d):
return min(d, key=d.get)
# Examples
print(key_of_min({'a': 4, 'b': 0, 'c': 13}))
# output:
# b
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
31134,
30815,
31195,
31424,
30383,
30505,
30578,
31259,
30275,
31213,
233,
140,
193,
30878,
30446,
30959,
30210,
236,
151,
177,
30267,
13,
13,
31201,
235,
178,
190,
30383,
13,
30785,
30406,
1195,
580,
31666,
30998,
1989,
31125,
30354,
30872,
30669,
30573,
8977,
29889,
657,
580,
30805,
31213,
233,
140,
193,
31666,
31086,
30742,
31999,
30495,
30578,
31259,
30275,
30878,
30446,
30959,
30210,
236,
151,
177,
30267,
13,
15945,
29908,
13,
13,
13,
1753,
1820,
29918,
974,
29918,
1195,
29898,
29881,
1125,
13,
1678,
736,
1375,
29898,
29881,
29892,
1820,
29922,
29881,
29889,
657,
29897,
13,
13,
13,
29937,
1222,
9422,
13,
13,
2158,
29898,
1989,
29918,
974,
29918,
1195,
3319,
29915,
29874,
2396,
29871,
29946,
29892,
525,
29890,
2396,
29871,
29900,
29892,
525,
29883,
2396,
29871,
29896,
29941,
20073,
13,
29937,
1962,
29901,
13,
29937,
289,
13,
2
] |
dronesym-python/flask-api/src/dronepool.py | dilinade/DroneSym | 1 | 3946 | <reponame>dilinade/DroneSym<filename>dronesym-python/flask-api/src/dronepool.py
#DronePool module which handles interaction with SITLs
from dronekit import Vehicle, VehicleMode, connect
from dronekit_sitl import SITL
from threading import Lock
import node, time
import mavparser
import threadrunner
drone_pool = {}
instance_count = 0
env_test = False
q = None
mq = None
lock = Lock()
class Sim(SITL, object):
def __init__(self, instance=1, home=None):
super(Sim, self).download("copter", "3.3", verbose=not env_test)
self.instance = instance
if home:
self.home = home
else:
self.home = {"lat":6.9271, "lon":79.8612, "alt": 1}
self.p = None
return
def connection_string(self):
return super(Sim, self).connection_string()[:-4] + str(5760 + self.instance * 10)
def launch(self):
home_str = str(self.home['lat']) + ',' + str(self.home['lon']) + ',0,353'
super(Sim, self).launch(["--instance", str(self.instance), "--home", home_str], await_ready=True, verbose=not env_test)
def get_sitl_status(self):
return { 'id': self.instance, 'home': self.home }
def initialize():
global q, mq, instance_count
q = threadrunner.q
mq = threadrunner.mq
drones = node.get_drones()['drones']
if not drones:
return
for drone_id in drones:
if drone_id not in list(drone_pool.keys()):
drone = node.get_drone_by_id(drone_id)
location = drone['location']
q.put((create_new_drone, { "db_key" : drone_id, "home" : location }))
if 'status' in list(drone.keys()) and drone['status'] == 'FLYING':
q.put((resume_flight, { "drone_id" : drone_id }))
def resume_flight(kwargs):
drone_id = kwargs.get("drone_id", None)
drone = node.get_drone_by_id(drone_id)
waypoints = []
for wp in sorted(drone['waypoints']):
waypoints.append(drone['waypoints'][wp])
next_waypoint = waypoints.index(drone['waypoint'])
print (next_waypoint)
q.put((takeoff_drone, { "drone_id" : drone_id, "waypoints" : waypoints[next_waypoint:] }))
def create_new_drone(kwargs):
global instance_count
instance_count += 1
home = kwargs.get("home", None)
db_key = kwargs.get("db_key", None)
retries = 3
drone = Sim(instance_count, home)
drone.launch()
while retries > 0:
try:
drone_conn = connect(drone.connection_string(), wait_ready=True)
break
except:
print ("Retrying...")
retries -= 1
drone_pool[db_key] = drone_conn
res = { "status" : "OK", "id" : db_key }
return res
def remove_drone(kwargs):
drone_id = kwargs.get("drone_id", None)
if drone_id not in drone_pool:
return { "status" : "ERROR", "msg" : "Drone instance not found" }
drone = drone_pool[drone_id]
if drone.mode == VehicleMode('AUTO'):
return { "status" : "ERROR", "msg" : "Drone in operation" }
del drone_pool[drone_id]
return { "status" : "OK", "id" : drone_id }
def run_mission(drone, target_height, waypoints):
while True:
print(("Reaching target alt : " + str(drone.location.global_relative_frame.alt)))
if drone.location.global_relative_frame.alt >= target_height * 0.9:
break
print ('target alt reached')
mavparser.create_mission(drone, waypoints)
print ('mission acquired')
drone.mode = VehicleMode('AUTO')
print ('initiating sequence')
print ('in mission')
def attach_listener(kwargs):
attr = kwargs.get('attr', None)
fn = kwargs.get('fn', None)
attach_fn = kwargs.get('attach_fn', None)
if not fn == None and not attr == None and not attach_fn == None:
attach_fn(attr, fn)
def takeoff_drone(kwargs):
global q
drone_id = kwargs.get("drone_id", None)
target_height = kwargs.get("target_height", 10)
waypoints = kwargs.get("waypoints", None)
try:
drone = drone_pool[drone_id]
except:
raise
drone.initialize()
drone.mode = VehicleMode('GUIDED')
drone.armed = True
while not drone.armed:
time.sleep(1)
drone.simple_takeoff(target_height)
print (waypoints)
if waypoints:
run_mission(drone, target_height, waypoints)
def detach_event_listeners(drone, value, status):
drone.remove_attribute_listener('location', update_location)
drone.remove_attribute_listener('airspeed', update_airspeed)
drone.remove_attribute_listener('attitude', udpate_attitude)
drone.remove_attribute_listener('heading', update_heading)
node.update_drone(drone_id, { "location" : {"lat": value.global_relative_frame.lat, "lon": value.global_relative_frame.lon, "alt": value.global_relative_frame.alt}, "status": status})
return
def update_location(self, attr_name, value):
node.update_drone(drone_id, { "location" : {"lat": value.global_relative_frame.lat, "lon": value.global_relative_frame.lon, "alt": value.global_relative_frame.alt}, "status": "FLYING"})
command_len = len(drone.commands)
wp_len = len(waypoints)
if command_len >= wp_len :
diff = command_len - wp_len
next_wp = max(drone.commands.__next__ - diff, 0) % len(waypoints)
waypoint = waypoints[next_wp]
# print "df: " + `diff`
# print next_wp
node.update_drone(drone_id, { "waypoint" : waypoint })
if drone.mode == VehicleMode('LAND') and drone.location.global_relative_frame.alt <= 0.1:
detach_event_listeners(drone, value, "HALTED")
return
if drone.commands.__next__ == len(drone.commands):
detach_event_listeners(drone, value, "FINISHED")
return
def update_airspeed(self, attr_name, value):
node.update_drone(drone_id, {"airspeed": value})
def udpate_attitude(self, attr_name, value):
node.update_drone(drone_id, { "pitch": value.pitch, 'roll': value.roll, 'yaw': value.yaw })
def update_heading(self, attr_name, value):
node.update_drone(drone_id, { "heading": value })
mq.put((attach_listener, { "attach_fn" : drone.add_attribute_listener, "attr" : 'location', "fn" : update_location }))
mq.put((attach_listener, { "attach_fn" : drone.add_attribute_listener, "attr" : 'airspeed', "fn" : update_airspeed }))
mq.put((attach_listener, { "attach_fn" : drone.add_attribute_listener, "attr" : 'attitude', "fn" : udpate_attitude }))
mq.put((attach_listener, { "attach_fn" : drone.add_attribute_listener, "attr" : 'heading', "fn" : update_heading }))
print ('took off')
return True
def land_drone(kwargs):
drone_id = kwargs.get("drone_id", None)
try:
drone = drone_pool[drone_id]
except:
raise
if not drone.armed:
return False
cmds = drone.commands
cmds.wait_ready()
cmds.clear()
drone.mode = VehicleMode('LAND')
print((drone.mode))
return True
| [
1,
529,
276,
1112,
420,
29958,
29881,
309,
1099,
311,
29914,
25639,
650,
25548,
29966,
9507,
29958,
29881,
1617,
267,
962,
29899,
4691,
29914,
1579,
1278,
29899,
2754,
29914,
4351,
29914,
7707,
650,
10109,
29889,
2272,
13,
29937,
25639,
650,
11426,
3883,
607,
17766,
14881,
411,
317,
1806,
29931,
29879,
13,
13,
3166,
4192,
650,
7354,
1053,
8980,
29882,
2512,
29892,
8980,
29882,
2512,
6818,
29892,
4511,
13,
3166,
4192,
650,
7354,
29918,
29879,
277,
29880,
1053,
317,
1806,
29931,
13,
3166,
3244,
292,
1053,
18199,
13,
5215,
2943,
29892,
931,
13,
5215,
286,
485,
16680,
13,
5215,
3244,
27492,
13,
13,
7707,
650,
29918,
10109,
353,
6571,
13,
8758,
29918,
2798,
353,
29871,
29900,
13,
6272,
29918,
1688,
353,
7700,
13,
13,
29939,
353,
6213,
13,
28466,
353,
6213,
13,
908,
353,
18199,
580,
13,
13,
1990,
3439,
29898,
29903,
1806,
29931,
29892,
1203,
1125,
13,
12,
1753,
4770,
2344,
12035,
1311,
29892,
2777,
29922,
29896,
29892,
3271,
29922,
8516,
1125,
13,
12,
12,
9136,
29898,
8942,
29892,
1583,
467,
10382,
703,
9708,
357,
613,
376,
29941,
29889,
29941,
613,
26952,
29922,
1333,
8829,
29918,
1688,
29897,
13,
12,
12,
1311,
29889,
8758,
353,
2777,
13,
13,
12,
12,
361,
3271,
29901,
13,
12,
12,
12,
1311,
29889,
5184,
353,
3271,
13,
12,
12,
2870,
29901,
13,
12,
12,
12,
1311,
29889,
5184,
353,
8853,
5066,
1115,
29953,
29889,
29929,
29906,
29955,
29896,
29892,
376,
12957,
1115,
29955,
29929,
29889,
29947,
29953,
29896,
29906,
29892,
376,
1997,
1115,
29871,
29896,
29913,
13,
13,
12,
12,
1311,
29889,
29886,
353,
6213,
13,
12,
12,
2457,
13,
13,
12,
1753,
3957,
29918,
1807,
29898,
1311,
1125,
13,
12,
12,
2457,
2428,
29898,
8942,
29892,
1583,
467,
9965,
29918,
1807,
580,
7503,
29899,
29946,
29962,
718,
851,
29898,
29945,
29955,
29953,
29900,
718,
1583,
29889,
8758,
334,
29871,
29896,
29900,
29897,
13,
13,
12,
1753,
6826,
29898,
1311,
1125,
13,
12,
12,
5184,
29918,
710,
353,
851,
29898,
1311,
29889,
5184,
1839,
5066,
11287,
718,
525,
5501,
718,
851,
29898,
1311,
29889,
5184,
1839,
12957,
11287,
718,
13420,
29900,
29892,
29941,
29945,
29941,
29915,
13,
12,
12,
9136,
29898,
8942,
29892,
1583,
467,
15343,
29898,
3366,
489,
8758,
613,
851,
29898,
1311,
29889,
8758,
511,
376,
489,
5184,
613,
3271,
29918,
710,
1402,
7272,
29918,
2040,
29922,
5574,
29892,
26952,
29922,
1333,
8829,
29918,
1688,
29897,
13,
13,
12,
1753,
679,
29918,
29879,
277,
29880,
29918,
4882,
29898,
1311,
1125,
13,
12,
12,
2457,
426,
525,
333,
2396,
1583,
29889,
8758,
29892,
525,
5184,
2396,
1583,
29889,
5184,
500,
13,
13,
1753,
11905,
7295,
13,
12,
10945,
3855,
29892,
286,
29939,
29892,
2777,
29918,
2798,
13,
12,
29939,
353,
3244,
27492,
29889,
29939,
13,
12,
28466,
353,
3244,
27492,
29889,
28466,
13,
13,
12,
29881,
1617,
267,
353,
2943,
29889,
657,
29918,
29881,
1617,
267,
580,
1839,
29881,
1617,
267,
2033,
13,
13,
12,
361,
451,
270,
1617,
267,
29901,
13,
12,
12,
2457,
13,
13,
12,
1454,
4192,
650,
29918,
333,
297,
270,
1617,
267,
29901,
13,
12,
12,
361,
4192,
650,
29918,
333,
451,
297,
1051,
29898,
7707,
650,
29918,
10109,
29889,
8149,
580,
1125,
13,
12,
12,
12,
7707,
650,
353,
2943,
29889,
657,
29918,
7707,
650,
29918,
1609,
29918,
333,
29898,
7707,
650,
29918,
333,
29897,
13,
12,
12,
12,
5479,
353,
4192,
650,
1839,
5479,
2033,
13,
12,
12,
12,
29939,
29889,
649,
3552,
3258,
29918,
1482,
29918,
7707,
650,
29892,
426,
376,
2585,
29918,
1989,
29908,
584,
4192,
650,
29918,
333,
29892,
376,
5184,
29908,
584,
4423,
500,
876,
13,
13,
12,
12,
12,
361,
525,
4882,
29915,
297,
1051,
29898,
7707,
650,
29889,
8149,
3101,
322,
4192,
650,
1839,
4882,
2033,
1275,
525,
10536,
29979,
4214,
2396,
13,
12,
12,
12,
12,
29939,
29889,
649,
3552,
690,
2017,
29918,
1579,
523,
29892,
426,
376,
7707,
650,
29918,
333,
29908,
584,
4192,
650,
29918,
333,
500,
876,
13,
13,
1753,
620,
2017,
29918,
1579,
523,
29898,
19290,
1125,
13,
12,
7707,
650,
29918,
333,
353,
9049,
5085,
29889,
657,
703,
7707,
650,
29918,
333,
613,
6213,
29897,
13,
12,
7707,
650,
353,
2943,
29889,
657,
29918,
7707,
650,
29918,
1609,
29918,
333,
29898,
7707,
650,
29918,
333,
29897,
13,
13,
12,
1582,
9748,
353,
5159,
13,
13,
12,
1454,
19247,
297,
12705,
29898,
7707,
650,
1839,
1582,
9748,
2033,
1125,
13,
12,
12,
1582,
9748,
29889,
4397,
29898,
7707,
650,
1839,
1582,
9748,
2033,
29961,
11912,
2314,
13,
13,
12,
4622,
29918,
1582,
3149,
353,
982,
9748,
29889,
2248,
29898,
7707,
650,
1839,
1582,
3149,
11287,
13,
12,
2158,
313,
4622,
29918,
1582,
3149,
29897,
13,
13,
12,
29939,
29889,
649,
3552,
19730,
2696,
29918,
7707,
650,
29892,
426,
376,
7707,
650,
29918,
333,
29908,
584,
4192,
650,
29918,
333,
29892,
376,
1582,
9748,
29908,
584,
982,
9748,
29961,
4622,
29918,
1582,
3149,
17531,
500,
876,
13,
13,
1753,
1653,
29918,
1482,
29918,
7707,
650,
29898,
19290,
1125,
13,
12,
10945,
2777,
29918,
2798,
13,
12,
8758,
29918,
2798,
4619,
29871,
29896,
13,
12,
5184,
353,
9049,
5085,
29889,
657,
703,
5184,
613,
6213,
29897,
13,
12,
2585,
29918,
1989,
353,
9049,
5085,
29889,
657,
703,
2585,
29918,
1989,
613,
6213,
29897,
13,
13,
12,
2267,
2722,
353,
29871,
29941,
13,
13,
12,
7707,
650,
353,
3439,
29898,
8758,
29918,
2798,
29892,
3271,
29897,
13,
12,
7707,
650,
29889,
15343,
580,
13,
13,
12,
8000,
3240,
2722,
1405,
29871,
29900,
29901,
13,
12,
12,
2202,
29901,
13,
12,
12,
12,
7707,
650,
29918,
13082,
353,
4511,
29898,
7707,
650,
29889,
9965,
29918,
1807,
3285,
4480,
29918,
2040,
29922,
5574,
29897,
13,
12,
12,
12,
8690,
13,
12,
12,
19499,
29901,
13,
12,
12,
12,
2158,
4852,
8015,
719,
292,
856,
1159,
13,
12,
12,
12,
2267,
2722,
22361,
29871,
29896,
13,
13,
13,
12,
7707,
650,
29918,
10109,
29961,
2585,
29918,
1989,
29962,
353,
4192,
650,
29918,
13082,
13,
13,
12,
690,
353,
426,
376,
4882,
29908,
584,
376,
8949,
613,
376,
333,
29908,
584,
4833,
29918,
1989,
500,
13,
12,
2457,
620,
13,
13,
1753,
3349,
29918,
7707,
650,
29898,
19290,
1125,
13,
12,
7707,
650,
29918,
333,
353,
9049,
5085,
29889,
657,
703,
7707,
650,
29918,
333,
613,
6213,
29897,
13,
12,
361,
4192,
650,
29918,
333,
451,
297,
4192,
650,
29918,
10109,
29901,
13,
12,
12,
2457,
426,
376,
4882,
29908,
584,
376,
11432,
613,
376,
7645,
29908,
584,
376,
25639,
650,
2777,
451,
1476,
29908,
500,
13,
13,
12,
7707,
650,
353,
4192,
650,
29918,
10109,
29961,
7707,
650,
29918,
333,
29962,
13,
13,
12,
361,
4192,
650,
29889,
8513,
1275,
8980,
29882,
2512,
6818,
877,
20656,
29949,
29374,
13,
12,
12,
2457,
426,
376,
4882,
29908,
584,
376,
11432,
613,
376,
7645,
29908,
584,
376,
25639,
650,
297,
5858,
29908,
500,
13,
13,
12,
6144,
4192,
650,
29918,
10109,
29961,
7707,
650,
29918,
333,
29962,
13,
13,
12,
2457,
426,
376,
4882,
29908,
584,
376,
8949,
613,
376,
333,
29908,
584,
4192,
650,
29918,
333,
500,
13,
13,
13,
1753,
1065,
29918,
6737,
29898,
7707,
650,
29892,
3646,
29918,
3545,
29892,
982,
9748,
1125,
13,
12,
8000,
5852,
29901,
13,
12,
12,
2158,
29898,
703,
1123,
9733,
3646,
5272,
584,
376,
718,
851,
29898,
7707,
650,
29889,
5479,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
1997,
4961,
13,
12,
12,
361,
4192,
650,
29889,
5479,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
1997,
6736,
3646,
29918,
3545,
334,
29871,
29900,
29889,
29929,
29901,
13,
12,
12,
12,
8690,
13,
13,
12,
2158,
6702,
5182,
5272,
7450,
1495,
13,
13,
12,
29885,
485,
16680,
29889,
3258,
29918,
6737,
29898,
7707,
650,
29892,
982,
9748,
29897,
13,
12,
2158,
6702,
6737,
16692,
1495,
13,
13,
12,
7707,
650,
29889,
8513,
353,
8980,
29882,
2512,
6818,
877,
20656,
29949,
1495,
13,
12,
2158,
6702,
2344,
29875,
1218,
5665,
1495,
13,
13,
12,
2158,
6702,
262,
10655,
1495,
13,
13,
1753,
10641,
29918,
25894,
29898,
19290,
1125,
13,
12,
5552,
353,
9049,
5085,
29889,
657,
877,
5552,
742,
6213,
29897,
13,
12,
9144,
353,
9049,
5085,
29889,
657,
877,
9144,
742,
6213,
29897,
13,
12,
14930,
29918,
9144,
353,
9049,
5085,
29889,
657,
877,
14930,
29918,
9144,
742,
6213,
29897,
13,
13,
12,
361,
451,
7876,
1275,
6213,
322,
451,
12421,
1275,
6213,
322,
451,
10641,
29918,
9144,
1275,
6213,
29901,
13,
12,
12,
14930,
29918,
9144,
29898,
5552,
29892,
7876,
29897,
13,
13,
1753,
2125,
2696,
29918,
7707,
650,
29898,
19290,
1125,
13,
12,
10945,
3855,
13,
13,
12,
7707,
650,
29918,
333,
353,
9049,
5085,
29889,
657,
703,
7707,
650,
29918,
333,
613,
6213,
29897,
13,
12,
5182,
29918,
3545,
353,
9049,
5085,
29889,
657,
703,
5182,
29918,
3545,
613,
29871,
29896,
29900,
29897,
13,
12,
1582,
9748,
353,
9049,
5085,
29889,
657,
703,
1582,
9748,
613,
6213,
29897,
13,
13,
12,
2202,
29901,
13,
12,
12,
7707,
650,
353,
4192,
650,
29918,
10109,
29961,
7707,
650,
29918,
333,
29962,
13,
12,
19499,
29901,
13,
12,
12,
22692,
13,
13,
12,
7707,
650,
29889,
24926,
580,
13,
13,
12,
7707,
650,
29889,
8513,
353,
8980,
29882,
2512,
6818,
877,
29954,
11150,
3352,
1495,
13,
12,
7707,
650,
29889,
279,
2168,
353,
5852,
13,
13,
12,
8000,
451,
4192,
650,
29889,
279,
2168,
29901,
13,
12,
12,
2230,
29889,
17059,
29898,
29896,
29897,
13,
13,
12,
7707,
650,
29889,
12857,
29918,
19730,
2696,
29898,
5182,
29918,
3545,
29897,
13,
13,
12,
2158,
313,
1582,
9748,
29897,
13,
13,
12,
361,
982,
9748,
29901,
13,
12,
12,
3389,
29918,
6737,
29898,
7707,
650,
29892,
3646,
29918,
3545,
29892,
982,
9748,
29897,
13,
13,
12,
1753,
1439,
496,
29918,
3696,
29918,
20631,
414,
29898,
7707,
650,
29892,
995,
29892,
4660,
1125,
13,
12,
12,
7707,
650,
29889,
5992,
29918,
12715,
29918,
25894,
877,
5479,
742,
2767,
29918,
5479,
29897,
13,
12,
12,
7707,
650,
29889,
5992,
29918,
12715,
29918,
25894,
877,
1466,
19322,
742,
2767,
29918,
1466,
19322,
29897,
13,
12,
12,
7707,
650,
29889,
5992,
29918,
12715,
29918,
25894,
877,
1131,
4279,
742,
318,
6099,
403,
29918,
1131,
4279,
29897,
13,
12,
12,
7707,
650,
29889,
5992,
29918,
12715,
29918,
25894,
877,
2813,
292,
742,
2767,
29918,
2813,
292,
29897,
13,
12,
12,
3177,
29889,
5504,
29918,
7707,
650,
29898,
7707,
650,
29918,
333,
29892,
426,
376,
5479,
29908,
584,
8853,
5066,
1115,
995,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
5066,
29892,
376,
12957,
1115,
995,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
12957,
29892,
376,
1997,
1115,
995,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
1997,
1118,
376,
4882,
1115,
4660,
1800,
13,
12,
12,
2457,
13,
13,
12,
1753,
2767,
29918,
5479,
29898,
1311,
29892,
12421,
29918,
978,
29892,
995,
1125,
13,
13,
12,
12,
3177,
29889,
5504,
29918,
7707,
650,
29898,
7707,
650,
29918,
333,
29892,
426,
376,
5479,
29908,
584,
8853,
5066,
1115,
995,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
5066,
29892,
376,
12957,
1115,
995,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
12957,
29892,
376,
1997,
1115,
995,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
1997,
1118,
376,
4882,
1115,
376,
10536,
29979,
4214,
29908,
1800,
13,
13,
12,
12,
6519,
29918,
2435,
353,
7431,
29898,
7707,
650,
29889,
26381,
29897,
13,
12,
12,
11912,
29918,
2435,
353,
7431,
29898,
1582,
9748,
29897,
13,
13,
12,
12,
361,
1899,
29918,
2435,
6736,
19247,
29918,
2435,
584,
13,
12,
12,
12,
12765,
353,
1899,
29918,
2435,
448,
19247,
29918,
2435,
13,
12,
12,
12,
4622,
29918,
11912,
353,
4236,
29898,
7707,
650,
29889,
26381,
17255,
4622,
1649,
448,
2923,
29892,
29871,
29900,
29897,
1273,
7431,
29898,
1582,
9748,
29897,
13,
12,
12,
12,
1582,
3149,
353,
982,
9748,
29961,
4622,
29918,
11912,
29962,
13,
12,
12,
12,
29937,
1596,
376,
2176,
29901,
376,
718,
421,
12765,
29952,
13,
12,
12,
12,
29937,
1596,
2446,
29918,
11912,
13,
12,
12,
12,
3177,
29889,
5504,
29918,
7707,
650,
29898,
7707,
650,
29918,
333,
29892,
426,
376,
1582,
3149,
29908,
584,
982,
3149,
5615,
13,
13,
12,
12,
361,
4192,
650,
29889,
8513,
1275,
8980,
29882,
2512,
6818,
877,
29931,
9468,
1495,
322,
4192,
650,
29889,
5479,
29889,
10945,
29918,
22925,
29918,
2557,
29889,
1997,
5277,
29871,
29900,
29889,
29896,
29901,
13,
12,
12,
12,
4801,
496,
29918,
3696,
29918,
20631,
414,
29898,
7707,
650,
29892,
995,
29892,
376,
29950,
1964,
29911,
3352,
1159,
13,
12,
12,
12,
2457,
13,
13,
12,
12,
361,
4192,
650,
29889,
26381,
17255,
4622,
1649,
1275,
7431,
29898,
7707,
650,
29889,
26381,
1125,
13,
12,
12,
12,
4801,
496,
29918,
3696,
29918,
20631,
414,
29898,
7707,
650,
29892,
995,
29892,
376,
29943,
1177,
3235,
29950,
3352,
1159,
13,
12,
12,
12,
2457,
13,
13,
13,
12,
1753,
2767,
29918,
1466,
19322,
29898,
1311,
29892,
12421,
29918,
978,
29892,
995,
1125,
13,
12,
12,
3177,
29889,
5504,
29918,
7707,
650,
29898,
7707,
650,
29918,
333,
29892,
8853,
1466,
19322,
1115,
995,
1800,
13,
13,
12,
1753,
318,
6099,
403,
29918,
1131,
4279,
29898,
1311,
29892,
12421,
29918,
978,
29892,
995,
1125,
13,
12,
12,
3177,
29889,
5504,
29918,
7707,
650,
29898,
7707,
650,
29918,
333,
29892,
426,
376,
29886,
2335,
1115,
995,
29889,
29886,
2335,
29892,
525,
1245,
2396,
995,
29889,
1245,
29892,
525,
29891,
1450,
2396,
995,
29889,
29891,
1450,
5615,
13,
13,
12,
1753,
2767,
29918,
2813,
292,
29898,
1311,
29892,
12421,
29918,
978,
29892,
995,
1125,
13,
12,
12,
3177,
29889,
5504,
29918,
7707,
650,
29898,
7707,
650,
29918,
333,
29892,
426,
376,
2813,
292,
1115,
995,
5615,
13,
13,
12,
28466,
29889,
649,
3552,
14930,
29918,
25894,
29892,
426,
376,
14930,
29918,
9144,
29908,
584,
4192,
650,
29889,
1202,
29918,
12715,
29918,
25894,
29892,
376,
5552,
29908,
584,
525,
5479,
742,
376,
9144,
29908,
584,
2767,
29918,
5479,
500,
876,
13,
12,
28466,
29889,
649,
3552,
14930,
29918,
25894,
29892,
426,
376,
14930,
29918,
9144,
29908,
584,
4192,
650,
29889,
1202,
29918,
12715,
29918,
25894,
29892,
376,
5552,
29908,
584,
525,
1466,
19322,
742,
376,
9144,
29908,
584,
2767,
29918,
1466,
19322,
500,
876,
13,
12,
28466,
29889,
649,
3552,
14930,
29918,
25894,
29892,
426,
376,
14930,
29918,
9144,
29908,
584,
4192,
650,
29889,
1202,
29918,
12715,
29918,
25894,
29892,
376,
5552,
29908,
584,
525,
1131,
4279,
742,
376,
9144,
29908,
584,
318,
6099,
403,
29918,
1131,
4279,
500,
876,
13,
12,
28466,
29889,
649,
3552,
14930,
29918,
25894,
29892,
426,
376,
14930,
29918,
9144,
29908,
584,
4192,
650,
29889,
1202,
29918,
12715,
29918,
25894,
29892,
376,
5552,
29908,
584,
525,
2813,
292,
742,
376,
9144,
29908,
584,
2767,
29918,
2813,
292,
500,
876,
13,
13,
12,
2158,
6702,
517,
554,
1283,
1495,
13,
13,
12,
2457,
5852,
13,
13,
1753,
2982,
29918,
7707,
650,
29898,
19290,
1125,
13,
12,
7707,
650,
29918,
333,
353,
9049,
5085,
29889,
657,
703,
7707,
650,
29918,
333,
613,
6213,
29897,
13,
12,
2202,
29901,
13,
12,
12,
7707,
650,
353,
4192,
650,
29918,
10109,
29961,
7707,
650,
29918,
333,
29962,
13,
12,
19499,
29901,
13,
12,
12,
22692,
13,
13,
12,
361,
451,
4192,
650,
29889,
279,
2168,
29901,
13,
12,
12,
2457,
7700,
13,
13,
12,
9006,
29879,
353,
4192,
650,
29889,
26381,
13,
12,
9006,
29879,
29889,
10685,
29918,
2040,
580,
13,
12,
9006,
29879,
29889,
8551,
580,
13,
13,
12,
7707,
650,
29889,
8513,
353,
8980,
29882,
2512,
6818,
877,
29931,
9468,
1495,
13,
12,
2158,
3552,
7707,
650,
29889,
8513,
876,
13,
12,
2457,
5852,
13,
2
] |
python3/hackerrank_leetcode/coin_change/main.py | seLain/codesnippets | 0 | 183246 | '''
Hackerrank: https://www.hackerrank.com/challenges/coin-change/problem
this solution will get timeout in many test cases
however, this solution can get all the combination during computation
'''
import sys
from collections import Counter, defaultdict
sys.setrecursionlimit(10000)
memory = defaultdict(list)
def recur_getWays(n, c):
#print('enter: n='+str(n))
if n < 0:
return False, []
elif n == 0:
return True, [Counter()]
if n in memory.keys():
return True, memory[n]
all_combs_count = []
for coin in c:
#print('choose coin:'+str(coin))
valid, combs = recur_getWays(n-coin, c)
if valid:
for comb in combs:
comb = comb + Counter({coin:1})
existed = False
for existed_comb in all_combs_count:
if existed_comb == comb:
existed = True
break
if not existed:
all_combs_count.append(comb)
#print('memorize: n='+str(n)+' count:'+str(all_combs_count))
memory[n] = all_combs_count
return True, all_combs_count
def getWays(n, c):
# Complete this function
valid, combs = recur_getWays(n, c)
#print(memory)
return len(combs)
n, m = input().strip().split(' ')
n, m = [int(n), int(m)]
c = list(map(int, input().strip().split(' ')))
# Print the number of ways of making change for 'n' units using coins having the values given by 'c'
ways = getWays(n, c)
print(ways) | [
1,
14550,
13,
29950,
28940,
10003,
29901,
2045,
597,
1636,
29889,
29882,
28940,
10003,
29889,
510,
29914,
305,
16047,
267,
29914,
1111,
262,
29899,
3167,
29914,
17199,
13,
1366,
1650,
674,
679,
11815,
297,
1784,
1243,
4251,
13,
3525,
1310,
29892,
445,
1650,
508,
679,
599,
278,
10296,
2645,
16287,
13,
12008,
13,
5215,
10876,
13,
13,
3166,
16250,
1053,
315,
5336,
29892,
2322,
8977,
13,
9675,
29889,
842,
3757,
1295,
291,
13400,
29898,
29896,
29900,
29900,
29900,
29900,
29897,
13,
13,
14834,
353,
2322,
8977,
29898,
1761,
29897,
13,
13,
1753,
1162,
332,
29918,
657,
29956,
1036,
29898,
29876,
29892,
274,
1125,
13,
1678,
396,
2158,
877,
5893,
29901,
302,
2433,
29974,
710,
29898,
29876,
876,
13,
1678,
565,
302,
529,
29871,
29900,
29901,
13,
4706,
736,
7700,
29892,
5159,
13,
1678,
25342,
302,
1275,
29871,
29900,
29901,
13,
4706,
736,
5852,
29892,
518,
17779,
580,
29962,
13,
268,
13,
1678,
565,
302,
297,
3370,
29889,
8149,
7295,
13,
4706,
736,
5852,
29892,
3370,
29961,
29876,
29962,
13,
268,
13,
1678,
599,
29918,
510,
5824,
29918,
2798,
353,
5159,
13,
1678,
363,
19480,
297,
274,
29901,
13,
4706,
396,
2158,
877,
21803,
19480,
11283,
29974,
710,
29898,
1111,
262,
876,
13,
4706,
2854,
29892,
4145,
29879,
353,
1162,
332,
29918,
657,
29956,
1036,
29898,
29876,
29899,
1111,
262,
29892,
274,
29897,
13,
4706,
565,
2854,
29901,
13,
9651,
363,
4145,
297,
4145,
29879,
29901,
13,
18884,
4145,
353,
4145,
718,
315,
5336,
3319,
1111,
262,
29901,
29896,
1800,
13,
18884,
22856,
353,
7700,
13,
18884,
363,
22856,
29918,
17743,
297,
599,
29918,
510,
5824,
29918,
2798,
29901,
13,
462,
1678,
565,
22856,
29918,
17743,
1275,
4145,
29901,
13,
462,
4706,
22856,
353,
5852,
13,
462,
4706,
2867,
13,
18884,
565,
451,
22856,
29901,
13,
462,
1678,
599,
29918,
510,
5824,
29918,
2798,
29889,
4397,
29898,
17743,
29897,
13,
1678,
396,
2158,
877,
6954,
272,
675,
29901,
302,
2433,
29974,
710,
29898,
29876,
7240,
29915,
2302,
11283,
29974,
710,
29898,
497,
29918,
510,
5824,
29918,
2798,
876,
13,
1678,
3370,
29961,
29876,
29962,
353,
599,
29918,
510,
5824,
29918,
2798,
13,
268,
13,
1678,
736,
5852,
29892,
599,
29918,
510,
5824,
29918,
2798,
13,
13,
1753,
679,
29956,
1036,
29898,
29876,
29892,
274,
1125,
13,
1678,
396,
25034,
445,
740,
13,
1678,
2854,
29892,
4145,
29879,
353,
1162,
332,
29918,
657,
29956,
1036,
29898,
29876,
29892,
274,
29897,
13,
1678,
396,
2158,
29898,
14834,
29897,
13,
1678,
736,
7431,
29898,
510,
5824,
29897,
13,
13,
29876,
29892,
286,
353,
1881,
2141,
17010,
2141,
5451,
877,
25710,
13,
29876,
29892,
286,
353,
518,
524,
29898,
29876,
511,
938,
29898,
29885,
4638,
13,
29883,
353,
1051,
29898,
1958,
29898,
524,
29892,
1881,
2141,
17010,
2141,
5451,
877,
525,
4961,
13,
29937,
13905,
278,
1353,
310,
5837,
310,
3907,
1735,
363,
525,
29876,
29915,
10340,
773,
1302,
1144,
2534,
278,
1819,
2183,
491,
525,
29883,
29915,
13,
1994,
353,
679,
29956,
1036,
29898,
29876,
29892,
274,
29897,
13,
2158,
29898,
1994,
29897,
2
] |
src/sdk/pynni/nni/compressors/torch_compressor/_nnimc_torch.py | LeonardoWang/nni | 0 | 123083 | <gh_stars>0
from torch import Tensor
from torch.nn import Module, Parameter
from ruamel.yaml import YAML
from typing import List
import logging
logger = logging.getLogger('torch_compressor')
__all__ = [
'TorchCompressor',
'TorchPruner',
'TorchQuantizer',
'_torch_detect_prunable_layers',
'_torch_default_get_configure',
'_torch_default_load_configure_file'
]
class TorchCompressor:
"""
Base compressor for pytorch
"""
def __init__(self):
self._bound_model = None
def compress(self, model):
"""
Compress the model with algorithm implemented by subclass.
The model will be instrumented and user should never edit it after calling this method.
"""
assert self._bound_model is None, "Each NNI compressor instance can only compress one model"
self._bound_model = model
self.bind_model(model)
def bind_model(self, model):
"""
This method is called when a model is bound to the compressor.
Users can optionally overload this method to do model-specific initialization.
It is guaranteed that only one model will be bound to each compressor instance.
"""
pass
def update_epoch(self, epoch):
"""
if user want to update model every epoch, user can override this method
"""
pass
def step(self):
"""
if user want to update model every step, user can override this method
"""
pass
class TorchLayerInfo:
"""
layer info for pytorch
"""
def __init__(self, name, layer):
self.name = name
self.layer = layer
self._forward = None
def _torch_detect_prunable_layers(model):
# search for all layers which have parameter "weight"
ret = []
for name, layer in model.named_modules():
try:
if isinstance(layer.weight, Parameter) and isinstance(layer.weight.data, Tensor):
ret.append(TorchLayerInfo(name, layer))
except AttributeError:
pass
return ret
def _torch_default_get_configure(configure_list, layer_info):
"""
Get configure for input layer
defaultly the later config will cover front config
WARNING: please mask sure default configure is the first in the list
"""
if not configure_list:
logger.warning('WARNING: configure list is None')
configure = {}
for config in configure_list:
if config.get('support_type', '') == 'default':
configure = config
elif type(layer_info.layer).__name__ in config.get('support_type', []):
configure = config
elif layer_info.name in config.get('support_op', []):
configure = config
if not configure:
logger.warning('WARNING: can not get configure, default NONE!!!')
return configure
def _torch_default_load_configure_file(config_path, class_name):
logger.info('load CLASS:{0} from PATH:{1}'.format(class_name, config_path))
assert config_path is not None and config_path.endswith('yaml')
file = open(config_path, 'r')
yaml = YAML(typ='safe')
yaml_text = yaml.load(file.read())
configure_file = yaml_text.get(class_name, {})
if not configure_file:
logger.warning('WARNING: load Nothing from configure file, Default { }')
return configure_file
class TorchPruner(TorchCompressor):
"""
Base pruner for pytorch pruner
"""
def __init__(self):
super().__init__()
def __call__(self, model):
self.compress(model)
return model
def calc_mask(self, layer_info, weight):
"""
Pruners should overload this method to provide mask for weight tensors.
The mask must have the same shape and type comparing to the weight.
It will be applied with `mul()` operation.
This method is effectively hooked to `forward()` method of the model.
"""
raise NotImplementedError("Pruners must overload calc_mask()")
def compress(self, model):
super().compress(model)
# TODO: configurable whitelist
for layer_info in _torch_detect_prunable_layers(model):
self._instrument_layer(layer_info)
def _instrument_layer(self, layer_info):
# TODO: bind additional properties to layer_info instead of layer
# create a wrapper forward function to replace the original one
assert layer_info._forward is None, 'Each model can only be compressed once'
layer_info._forward = layer_info.layer.forward
def new_forward(*input):
# apply mask to weight
mask = self.calc_mask(layer_info, layer_info.layer.weight.data)
layer_info._backup_weight = layer_info.layer.weight.data
layer_info.layer.weight.data = layer_info.layer.weight.data.mul(mask)
# calculate forward
ret = layer_info._forward(*input)
# recover original weight
layer_info.layer.weight.data = layer_info._backup_weight
return ret
layer_info.layer.forward = new_forward
class TorchQuantizer(TorchCompressor):
"""
Base quantizer for pytorch quantizer
"""
def __init__(self):
super().__init__()
def __call__(self, model):
self.compress(model)
return model
def quantize_weight(self, layer_info, weight):
"""
user should know where dequantize goes and implement it in quantize method
we now do not provide dequantize method
"""
raise NotImplementedError("Quantizer must overload quantize_weight()")
def compress(self, model):
super().compress(model)
count = 0
for layer_info in _torch_detect_prunable_layers(model):
if count == 0:
count = count +1
continue
self._instrument_layer(layer_info)
def _instrument_layer(self, layer_info):
assert layer_info._forward is None
layer_info._forward = layer_info.layer.forward
def new_forward(*input):
layer_info.layer.weight.data = self.quantize_weight(layer_info, layer_info.layer.weight.data)
return layer_info._forward(*input)
layer_info.layer.forward = new_forward
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
4842,
305,
1053,
323,
6073,
13,
3166,
4842,
305,
29889,
15755,
1053,
15591,
29892,
24953,
13,
3166,
5796,
314,
295,
29889,
25162,
1053,
612,
23956,
13,
3166,
19229,
1053,
2391,
13,
5215,
12183,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
877,
7345,
305,
29918,
510,
2139,
272,
1495,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
29911,
25350,
1523,
2139,
272,
742,
13,
1678,
525,
29911,
25350,
29925,
3389,
261,
742,
13,
1678,
525,
29911,
25350,
22930,
3950,
742,
13,
1678,
22868,
7345,
305,
29918,
4801,
522,
29918,
558,
348,
519,
29918,
29277,
742,
13,
1678,
22868,
7345,
305,
29918,
4381,
29918,
657,
29918,
17591,
742,
13,
1678,
22868,
7345,
305,
29918,
4381,
29918,
1359,
29918,
17591,
29918,
1445,
29915,
13,
29962,
13,
13,
13,
1990,
4794,
305,
1523,
2139,
272,
29901,
13,
1678,
9995,
13,
1678,
7399,
27122,
272,
363,
282,
3637,
25350,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
9917,
29918,
4299,
353,
6213,
13,
13,
13,
1678,
822,
27122,
29898,
1311,
29892,
1904,
1125,
13,
4706,
9995,
13,
4706,
422,
2139,
278,
1904,
411,
5687,
8762,
491,
19481,
29889,
13,
4706,
450,
1904,
674,
367,
11395,
287,
322,
1404,
881,
2360,
3863,
372,
1156,
5432,
445,
1158,
29889,
13,
4706,
9995,
13,
4706,
4974,
1583,
3032,
9917,
29918,
4299,
338,
6213,
29892,
376,
9760,
405,
12916,
27122,
272,
2777,
508,
871,
27122,
697,
1904,
29908,
13,
4706,
1583,
3032,
9917,
29918,
4299,
353,
1904,
13,
4706,
1583,
29889,
5355,
29918,
4299,
29898,
4299,
29897,
13,
13,
13,
1678,
822,
7868,
29918,
4299,
29898,
1311,
29892,
1904,
1125,
13,
4706,
9995,
13,
4706,
910,
1158,
338,
2000,
746,
263,
1904,
338,
3216,
304,
278,
27122,
272,
29889,
13,
4706,
23861,
508,
2984,
635,
975,
1359,
445,
1158,
304,
437,
1904,
29899,
14940,
17865,
29889,
13,
4706,
739,
338,
22688,
393,
871,
697,
1904,
674,
367,
3216,
304,
1269,
27122,
272,
2777,
29889,
13,
4706,
9995,
13,
4706,
1209,
13,
268,
13,
1678,
822,
2767,
29918,
1022,
2878,
29898,
1311,
29892,
21502,
305,
1125,
13,
4706,
9995,
13,
4706,
565,
1404,
864,
304,
2767,
1904,
1432,
21502,
305,
29892,
1404,
508,
5712,
445,
1158,
13,
4706,
9995,
13,
4706,
1209,
13,
268,
13,
1678,
822,
4331,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
565,
1404,
864,
304,
2767,
1904,
1432,
4331,
29892,
1404,
508,
5712,
445,
1158,
13,
4706,
9995,
13,
4706,
1209,
13,
13,
13,
1990,
4794,
305,
14420,
3401,
29901,
13,
1678,
9995,
13,
1678,
7546,
5235,
363,
282,
3637,
25350,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
7546,
1125,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
13148,
353,
7546,
13,
13,
4706,
1583,
3032,
11333,
353,
6213,
13,
13,
13,
1753,
903,
7345,
305,
29918,
4801,
522,
29918,
558,
348,
519,
29918,
29277,
29898,
4299,
1125,
13,
1678,
396,
2740,
363,
599,
15359,
607,
505,
3443,
376,
7915,
29908,
13,
1678,
3240,
353,
5159,
13,
1678,
363,
1024,
29892,
7546,
297,
1904,
29889,
17514,
29918,
7576,
7295,
13,
4706,
1018,
29901,
13,
9651,
565,
338,
8758,
29898,
13148,
29889,
7915,
29892,
24953,
29897,
322,
338,
8758,
29898,
13148,
29889,
7915,
29889,
1272,
29892,
323,
6073,
1125,
13,
18884,
3240,
29889,
4397,
29898,
29911,
25350,
14420,
3401,
29898,
978,
29892,
7546,
876,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
1209,
13,
1678,
736,
3240,
13,
13,
1753,
903,
7345,
305,
29918,
4381,
29918,
657,
29918,
17591,
29898,
17591,
29918,
1761,
29892,
7546,
29918,
3888,
1125,
13,
1678,
9995,
13,
1678,
3617,
10822,
363,
1881,
7546,
13,
1678,
2322,
368,
278,
2678,
2295,
674,
4612,
4565,
2295,
13,
1678,
399,
25614,
29901,
3113,
11105,
1854,
2322,
10822,
338,
278,
937,
297,
278,
1051,
13,
1678,
9995,
13,
1678,
565,
451,
10822,
29918,
1761,
29901,
13,
4706,
17927,
29889,
27392,
877,
29956,
25614,
29901,
10822,
1051,
338,
6213,
1495,
13,
1678,
10822,
353,
6571,
13,
1678,
363,
2295,
297,
10822,
29918,
1761,
29901,
13,
4706,
565,
2295,
29889,
657,
877,
5924,
29918,
1853,
742,
27255,
1275,
525,
4381,
2396,
13,
9651,
10822,
353,
2295,
13,
4706,
25342,
1134,
29898,
13148,
29918,
3888,
29889,
13148,
467,
1649,
978,
1649,
297,
2295,
29889,
657,
877,
5924,
29918,
1853,
742,
5159,
1125,
13,
9651,
10822,
353,
2295,
13,
4706,
25342,
7546,
29918,
3888,
29889,
978,
297,
2295,
29889,
657,
877,
5924,
29918,
459,
742,
5159,
1125,
13,
9651,
10822,
353,
2295,
13,
1678,
565,
451,
10822,
29901,
13,
4706,
17927,
29889,
27392,
877,
29956,
25614,
29901,
508,
451,
679,
10822,
29892,
2322,
405,
12413,
21004,
1495,
13,
1678,
736,
10822,
13,
13,
1753,
903,
7345,
305,
29918,
4381,
29918,
1359,
29918,
17591,
29918,
1445,
29898,
2917,
29918,
2084,
29892,
770,
29918,
978,
1125,
13,
1678,
17927,
29889,
3888,
877,
1359,
315,
4375,
1799,
26254,
29900,
29913,
515,
23611,
26254,
29896,
29913,
4286,
4830,
29898,
1990,
29918,
978,
29892,
2295,
29918,
2084,
876,
13,
1678,
4974,
2295,
29918,
2084,
338,
451,
6213,
322,
2295,
29918,
2084,
29889,
1975,
2541,
877,
25162,
1495,
13,
1678,
934,
353,
1722,
29898,
2917,
29918,
2084,
29892,
525,
29878,
1495,
13,
1678,
343,
8807,
353,
612,
23956,
29898,
22449,
2433,
11177,
1495,
13,
1678,
343,
8807,
29918,
726,
353,
343,
8807,
29889,
1359,
29898,
1445,
29889,
949,
3101,
13,
1678,
10822,
29918,
1445,
353,
343,
8807,
29918,
726,
29889,
657,
29898,
1990,
29918,
978,
29892,
426,
1800,
13,
1678,
565,
451,
10822,
29918,
1445,
29901,
13,
4706,
17927,
29889,
27392,
877,
29956,
25614,
29901,
2254,
9531,
515,
10822,
934,
29892,
13109,
426,
500,
1495,
13,
1678,
736,
10822,
29918,
1445,
13,
13,
13,
1990,
4794,
305,
29925,
3389,
261,
29898,
29911,
25350,
1523,
2139,
272,
1125,
13,
1678,
9995,
13,
1678,
7399,
544,
348,
261,
363,
282,
3637,
25350,
544,
348,
261,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
1904,
1125,
13,
4706,
1583,
29889,
510,
2139,
29898,
4299,
29897,
13,
4706,
736,
1904,
13,
13,
1678,
822,
22235,
29918,
13168,
29898,
1311,
29892,
7546,
29918,
3888,
29892,
7688,
1125,
13,
4706,
9995,
13,
4706,
1588,
348,
414,
881,
975,
1359,
445,
1158,
304,
3867,
11105,
363,
7688,
25187,
943,
29889,
13,
4706,
450,
11105,
1818,
505,
278,
1021,
8267,
322,
1134,
17420,
304,
278,
7688,
29889,
13,
4706,
739,
674,
367,
7436,
411,
421,
16109,
2555,
5858,
29889,
13,
4706,
910,
1158,
338,
17583,
12422,
287,
304,
421,
11333,
2555,
1158,
310,
278,
1904,
29889,
13,
4706,
9995,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
703,
29925,
3389,
414,
1818,
975,
1359,
22235,
29918,
13168,
580,
1159,
13,
13,
13,
1678,
822,
27122,
29898,
1311,
29892,
1904,
1125,
13,
4706,
2428,
2141,
510,
2139,
29898,
4299,
29897,
13,
4706,
396,
14402,
29901,
17127,
519,
377,
7454,
391,
13,
4706,
363,
7546,
29918,
3888,
297,
903,
7345,
305,
29918,
4801,
522,
29918,
558,
348,
519,
29918,
29277,
29898,
4299,
1125,
13,
9651,
1583,
3032,
2611,
15461,
29918,
13148,
29898,
13148,
29918,
3888,
29897,
13,
13,
1678,
822,
903,
2611,
15461,
29918,
13148,
29898,
1311,
29892,
7546,
29918,
3888,
1125,
13,
4706,
396,
14402,
29901,
7868,
5684,
4426,
304,
7546,
29918,
3888,
2012,
310,
7546,
13,
4706,
396,
1653,
263,
14476,
6375,
740,
304,
5191,
278,
2441,
697,
13,
4706,
4974,
7546,
29918,
3888,
3032,
11333,
338,
6213,
29892,
525,
9760,
1904,
508,
871,
367,
419,
13120,
2748,
29915,
13,
4706,
7546,
29918,
3888,
3032,
11333,
353,
7546,
29918,
3888,
29889,
13148,
29889,
11333,
13,
13,
4706,
822,
716,
29918,
11333,
10456,
2080,
1125,
13,
9651,
396,
3394,
11105,
304,
7688,
13,
9651,
11105,
353,
1583,
29889,
28667,
29918,
13168,
29898,
13148,
29918,
3888,
29892,
7546,
29918,
3888,
29889,
13148,
29889,
7915,
29889,
1272,
29897,
13,
9651,
7546,
29918,
3888,
3032,
1627,
786,
29918,
7915,
353,
7546,
29918,
3888,
29889,
13148,
29889,
7915,
29889,
1272,
13,
9651,
7546,
29918,
3888,
29889,
13148,
29889,
7915,
29889,
1272,
353,
7546,
29918,
3888,
29889,
13148,
29889,
7915,
29889,
1272,
29889,
16109,
29898,
13168,
29897,
13,
9651,
396,
8147,
6375,
13,
9651,
3240,
353,
7546,
29918,
3888,
3032,
11333,
10456,
2080,
29897,
13,
9651,
396,
9792,
2441,
7688,
13,
9651,
7546,
29918,
3888,
29889,
13148,
29889,
7915,
29889,
1272,
353,
7546,
29918,
3888,
3032,
1627,
786,
29918,
7915,
13,
9651,
736,
3240,
13,
13,
4706,
7546,
29918,
3888,
29889,
13148,
29889,
11333,
353,
716,
29918,
11333,
13,
268,
13,
13,
13,
1990,
4794,
305,
22930,
3950,
29898,
29911,
25350,
1523,
2139,
272,
1125,
13,
1678,
9995,
13,
1678,
7399,
4323,
3950,
363,
282,
3637,
25350,
4323,
3950,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
1904,
1125,
13,
4706,
1583,
29889,
510,
2139,
29898,
4299,
29897,
13,
4706,
736,
1904,
13,
268,
13,
1678,
822,
4323,
675,
29918,
7915,
29898,
1311,
29892,
7546,
29918,
3888,
29892,
7688,
1125,
13,
4706,
9995,
13,
4706,
1404,
881,
1073,
988,
316,
12150,
675,
5771,
322,
2334,
372,
297,
4323,
675,
1158,
13,
4706,
591,
1286,
437,
451,
3867,
316,
12150,
675,
1158,
13,
4706,
9995,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
703,
22930,
3950,
1818,
975,
1359,
4323,
675,
29918,
7915,
580,
1159,
13,
13,
1678,
822,
27122,
29898,
1311,
29892,
1904,
1125,
13,
4706,
2428,
2141,
510,
2139,
29898,
4299,
29897,
13,
4706,
2302,
353,
29871,
29900,
13,
4706,
363,
7546,
29918,
3888,
297,
903,
7345,
305,
29918,
4801,
522,
29918,
558,
348,
519,
29918,
29277,
29898,
4299,
1125,
13,
9651,
565,
2302,
1275,
29871,
29900,
29901,
13,
18884,
2302,
353,
2302,
718,
29896,
13,
18884,
6773,
13,
9651,
1583,
3032,
2611,
15461,
29918,
13148,
29898,
13148,
29918,
3888,
29897,
13,
13,
1678,
822,
903,
2611,
15461,
29918,
13148,
29898,
1311,
29892,
7546,
29918,
3888,
1125,
13,
4706,
4974,
7546,
29918,
3888,
3032,
11333,
338,
6213,
13,
4706,
7546,
29918,
3888,
3032,
11333,
353,
7546,
29918,
3888,
29889,
13148,
29889,
11333,
13,
13,
4706,
822,
716,
29918,
11333,
10456,
2080,
1125,
13,
9651,
7546,
29918,
3888,
29889,
13148,
29889,
7915,
29889,
1272,
353,
1583,
29889,
12150,
675,
29918,
7915,
29898,
13148,
29918,
3888,
29892,
7546,
29918,
3888,
29889,
13148,
29889,
7915,
29889,
1272,
29897,
13,
9651,
736,
7546,
29918,
3888,
3032,
11333,
10456,
2080,
29897,
13,
13,
4706,
7546,
29918,
3888,
29889,
13148,
29889,
11333,
353,
716,
29918,
11333,
13,
268,
13,
268,
13,
2
] |
Python/problem0050.py | 1050669722/LeetCode-Answers | 0 | 43814 | # -*- coding: utf-8 -*-
"""
Created on Fri May 31 10:11:51 2019
@author: Administrator
"""
class Solution:
def myPow(self, x: float, n: int) -> float:
# if n == 1:
# return x
# if x!=0 and n == 0:
# return 1
# if x == 0 and n <= 0:
# return None
# if n>0:
# if n%2 == 0:
# return self.myPow(x, n//2) * self.myPow(x, n//2)
# else:
# return self.myPow(x, n//2) * self.myPow(x, n//2) * x
# if n<0:
# if n%2 == 0:
# return 1. / ( self.myPow(x, -n//2) * self.myPow(x, -n//2) )
# else:
# return 1. / ( self.myPow(x, -n//2) * self.myPow(x, -n//2) * x )
## if n == 1:
## return x
## if n == 0:
## return 1
# if n == 1:
# return x
# if x!=0 and n == 0:
# return 1
# if x == 0 and n <= 0:
# return None
# if n>0:
# temp = self.myPow(x, n//2)
# if n%2 == 0:
# return temp * temp
# else:
# return temp * temp * x
# if n<0:
# temp = self.myPow(x, -n//2)
# if n%2 == 0:
# return 1. / ( temp * temp )
# else:
# return 1. / ( temp * temp * x )
# if n == 1: return x
# if n == 0: return 1
# t = self.myPow(x, abs(n) // 2)
# if n % 2 == 0:
# t = t * t
# else: t = x * t * t
# if n < 0:
# return 1.0 /t
# return t
if n<0:
n = -n
x = 1. / x
ans = 1
cp = x
while n>=1:
ans = ans*cp**(n%2)
# cp **= 2
cp *= cp
n //= 2
return ans
solu = Solution()
x, n = 2.00000, 10
#x, n = 2.00000, 4
#x, n = 2.10000, 3
#x, n = 2.00000, -2
#x, n = 0.00001, 2147483647#2**31-1#
#x, n = 0.00000, -1
print(solu.myPow(x, n)) | [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
11169,
2610,
29871,
29941,
29896,
29871,
29896,
29900,
29901,
29896,
29896,
29901,
29945,
29896,
29871,
29906,
29900,
29896,
29929,
13,
13,
29992,
8921,
29901,
24510,
1061,
13,
15945,
29908,
13,
13,
1990,
24380,
29901,
13,
1678,
822,
590,
29925,
340,
29898,
1311,
29892,
921,
29901,
5785,
29892,
302,
29901,
938,
29897,
1599,
5785,
29901,
13,
29937,
4706,
565,
302,
1275,
29871,
29896,
29901,
13,
29937,
9651,
736,
921,
13,
29937,
4706,
565,
921,
19216,
29900,
322,
302,
1275,
29871,
29900,
29901,
13,
29937,
9651,
736,
29871,
29896,
13,
29937,
4706,
565,
921,
1275,
29871,
29900,
322,
302,
5277,
29871,
29900,
29901,
13,
29937,
9651,
736,
6213,
13,
29937,
4706,
565,
302,
29958,
29900,
29901,
13,
29937,
9651,
565,
302,
29995,
29906,
1275,
29871,
29900,
29901,
13,
29937,
18884,
736,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
302,
458,
29906,
29897,
334,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
302,
458,
29906,
29897,
13,
29937,
9651,
1683,
29901,
13,
29937,
18884,
736,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
302,
458,
29906,
29897,
334,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
302,
458,
29906,
29897,
334,
921,
13,
29937,
4706,
565,
302,
29966,
29900,
29901,
13,
29937,
9651,
565,
302,
29995,
29906,
1275,
29871,
29900,
29901,
13,
29937,
18884,
736,
29871,
29896,
29889,
847,
313,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
448,
29876,
458,
29906,
29897,
334,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
448,
29876,
458,
29906,
29897,
1723,
13,
29937,
9651,
1683,
29901,
13,
29937,
18884,
736,
29871,
29896,
29889,
847,
313,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
448,
29876,
458,
29906,
29897,
334,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
448,
29876,
458,
29906,
29897,
334,
921,
1723,
13,
308,
13,
2277,
4706,
565,
302,
1275,
29871,
29896,
29901,
13,
2277,
9651,
736,
921,
13,
2277,
4706,
565,
302,
1275,
29871,
29900,
29901,
13,
2277,
9651,
736,
29871,
29896,
13,
29937,
4706,
565,
302,
1275,
29871,
29896,
29901,
13,
29937,
9651,
736,
921,
13,
29937,
4706,
565,
921,
19216,
29900,
322,
302,
1275,
29871,
29900,
29901,
13,
29937,
9651,
736,
29871,
29896,
13,
29937,
4706,
565,
921,
1275,
29871,
29900,
322,
302,
5277,
29871,
29900,
29901,
13,
29937,
9651,
736,
6213,
13,
29937,
4706,
565,
302,
29958,
29900,
29901,
13,
29937,
9651,
5694,
353,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
302,
458,
29906,
29897,
13,
29937,
9651,
565,
302,
29995,
29906,
1275,
29871,
29900,
29901,
13,
29937,
18884,
736,
5694,
334,
5694,
13,
29937,
9651,
1683,
29901,
13,
29937,
18884,
736,
5694,
334,
5694,
334,
921,
13,
29937,
4706,
565,
302,
29966,
29900,
29901,
13,
29937,
9651,
5694,
353,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
448,
29876,
458,
29906,
29897,
13,
29937,
9651,
565,
302,
29995,
29906,
1275,
29871,
29900,
29901,
13,
29937,
18884,
736,
29871,
29896,
29889,
847,
313,
5694,
334,
5694,
1723,
13,
29937,
9651,
1683,
29901,
13,
29937,
18884,
736,
29871,
29896,
29889,
847,
313,
5694,
334,
5694,
334,
921,
1723,
13,
308,
13,
29937,
4706,
565,
302,
1275,
29871,
29896,
29901,
736,
921,
13,
29937,
4706,
565,
302,
1275,
29871,
29900,
29901,
736,
29871,
29896,
13,
29937,
4706,
260,
353,
1583,
29889,
1357,
29925,
340,
29898,
29916,
29892,
6425,
29898,
29876,
29897,
849,
29871,
29906,
29897,
13,
29937,
4706,
565,
302,
1273,
29871,
29906,
1275,
29871,
29900,
29901,
13,
29937,
9651,
260,
353,
260,
334,
260,
13,
29937,
4706,
1683,
29901,
260,
353,
29871,
921,
334,
260,
334,
260,
13,
29937,
4706,
565,
302,
529,
29871,
29900,
29901,
13,
29937,
9651,
736,
29871,
29896,
29889,
29900,
29871,
847,
29873,
13,
29937,
4706,
736,
260,
13,
308,
13,
4706,
565,
302,
29966,
29900,
29901,
13,
9651,
302,
353,
448,
29876,
13,
9651,
921,
353,
29871,
29896,
29889,
847,
921,
13,
4706,
6063,
353,
29871,
29896,
13,
4706,
21447,
353,
921,
13,
4706,
1550,
302,
18572,
29896,
29901,
13,
9651,
6063,
353,
6063,
29930,
6814,
1068,
29898,
29876,
29995,
29906,
29897,
13,
29937,
9651,
21447,
3579,
29922,
29871,
29906,
13,
9651,
21447,
334,
29922,
21447,
13,
9651,
302,
849,
29922,
29871,
29906,
13,
4706,
736,
6063,
13,
308,
13,
2929,
29884,
353,
24380,
580,
13,
29916,
29892,
302,
353,
29871,
29906,
29889,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
29896,
29900,
13,
29937,
29916,
29892,
302,
353,
29871,
29906,
29889,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
29946,
13,
29937,
29916,
29892,
302,
353,
29871,
29906,
29889,
29896,
29900,
29900,
29900,
29900,
29892,
29871,
29941,
13,
29937,
29916,
29892,
302,
353,
29871,
29906,
29889,
29900,
29900,
29900,
29900,
29900,
29892,
448,
29906,
13,
29937,
29916,
29892,
302,
353,
29871,
29900,
29889,
29900,
29900,
29900,
29900,
29896,
29892,
29871,
29906,
29896,
29946,
29955,
29946,
29947,
29941,
29953,
29946,
29955,
29937,
29906,
1068,
29941,
29896,
29899,
29896,
29937,
13,
29937,
29916,
29892,
302,
353,
29871,
29900,
29889,
29900,
29900,
29900,
29900,
29900,
29892,
448,
29896,
13,
2158,
29898,
2929,
29884,
29889,
1357,
29925,
340,
29898,
29916,
29892,
302,
876,
2
] |
ConvertShellcode.py | rvrsh3ll/CPLResourceRunner | 232 | 110036 | <reponame>rvrsh3ll/CPLResourceRunner<filename>ConvertShellcode.py
#!/usr/bin/env python
import binascii
import sys
file_name = sys.argv[1]
with open (file_name) as f:
hexdata = binascii.hexlify(f.read())
hexlist = map(''.join, zip(hexdata[::2], hexdata[1::2]))
shellcode = ''
for i in hexlist:
shellcode += "0x{},".format(i)
shellcode = shellcode[:-1]
output = open('shellcode.txt', 'w')
output.write(shellcode)
output.close()
print "Shellcode written to shellcode.txt" | [
1,
529,
276,
1112,
420,
29958,
29878,
13416,
845,
29941,
645,
29914,
6271,
29931,
6848,
16802,
29966,
9507,
29958,
18455,
16037,
401,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
9016,
294,
18869,
13,
5215,
10876,
13,
13,
1445,
29918,
978,
353,
10876,
29889,
19218,
29961,
29896,
29962,
13,
2541,
1722,
313,
1445,
29918,
978,
29897,
408,
285,
29901,
13,
12,
20970,
1272,
353,
9016,
294,
18869,
29889,
354,
15524,
1598,
29898,
29888,
29889,
949,
3101,
13,
12,
20970,
1761,
353,
2910,
877,
4286,
7122,
29892,
14319,
29898,
20970,
1272,
29961,
1057,
29906,
1402,
15090,
1272,
29961,
29896,
1057,
29906,
12622,
13,
12,
15903,
401,
353,
6629,
13,
12,
1454,
474,
297,
15090,
1761,
29901,
13,
12,
12,
15903,
401,
4619,
376,
29900,
29916,
29912,
1118,
1642,
4830,
29898,
29875,
29897,
13,
12,
15903,
401,
353,
6473,
401,
7503,
29899,
29896,
29962,
13,
12,
4905,
353,
1722,
877,
15903,
401,
29889,
3945,
742,
525,
29893,
1495,
13,
12,
4905,
29889,
3539,
29898,
15903,
401,
29897,
13,
12,
4905,
29889,
5358,
580,
13,
13,
2158,
376,
16037,
401,
3971,
304,
6473,
401,
29889,
3945,
29908,
2
] |
rnn.py | peterwilliams97/deidentification | 0 | 70497 | <reponame>peterwilliams97/deidentification
import tensorflow as tf
import numpy as np
from tensorflow.contrib import rnn
from os.path import expanduser
from glob import glob
import re
import random
import time
import os
import spacy
from collections import defaultdict
# Parameters
seed = 112
use_spacy = True
MAX_VOCAB = 40000
MAX_WORDS = 1000000
SMALL_TEXT = False
learning_rate = 0.001
n_input = 3
batch_size = 100
test_frac = .2
n_epochs = 1000
n_epochs_report = 1
patience = 100
model_folder = 'models'
# number of units in RNN cell
n_hidden = 512
UNKNOWN = '<UNKNOWN>'
random.seed(seed)
# Target log path
logs_path = '/tmp/tensorflow/rnn_words'
writer = tf.summary.FileWriter(logs_path)
start_time = time.time()
def elapsed():
sec = time.time() - start_time
if sec < 60:
return "%.2f sec" % sec
elif sec < 60 * 60:
return "%.2f min" % (sec / 60.0)
else:
return "%.2f hour" % (sec / (60 * 60))
def show(name, x):
try:
v = '%s:%s' % (list(x.shape), x.dtype)
except AttributeError:
if isinstance(x, (list, tuple)):
v = '%d:%s' % (len(x), type(x[0]))
else:
v = type(x)
print('"%s"=%s' % (name, v))
def read_text(path):
with open(path, 'rt') as f:
return f.read()
def make_text():
if SMALL_TEXT:
return read_text('belling_the_cat.txt')
# mask = expanduser('~/testdata.clean/deploy/PDF32000_2008.txt')
mask = expanduser('~/testdata.clean/deploy/The_Block_Cipher_Companion.txt')
file_list = sorted(glob(mask))
print('%d files' % len(file_list))
return '\n'.join(read_text(path) for path in file_list)
RE_SPACE = re.compile(r'[\s,\.:;!\?\-\(\)]+', re.DOTALL | re.MULTILINE)
RE_NUMBER = re.compile(r'[^A-Z^a-z]')
def tokenize_simple(text, max_words):
words = RE_SPACE.split(text)
words = [w for w in words if len(w) > 1 and not RE_NUMBER.search(w)]
if max_words > 0:
words = words[:max_words]
return [words]
spacy_nlp = spacy.load('en')
punct = {',', '.', ';', ':', '\n', '\t', '\f', ''}
def tokenize_spacy(text, n_input, max_words):
document = spacy_nlp(text)
doc_sents = list(document.sents)
print(len(doc_sents))
# for i, sent in enumerate(doc_sents[:20]):
# print(i, type(sent), len(sent), sent[:5])
# sentences
sentences = []
n_words = 0
for span in document.sents:
sent = [token.text.strip() for token in span]
sent = [w for w in sent if w not in punct]
if len(sent) < n_input + 1:
continue
sentences.append(sent)
n_words += len(sent)
if max_words > 0 and n_words >= max_words:
break
# for token in sentence:
# print(token)
# token_dict = {}
# token_dict['start'], token_dict['end'] = get_start_and_end_offset_of_token_from_spacy(token)
# token_dict['text'] = text[token_dict['start']:token_dict['end']]
# if token_dict['text'].strip() in ['\n', '\t', ' ', '']:
# continue
# # Make sure that the token text does not contain any space
# if len(token_dict['text'].split(' ')) != 1:
# print("WARNING: the text of the token contains space character, replaced with "
# "hyphen\n\t{0}\n\t{1}".format(token_dict['text'], token_dict['text'].replace(' ', '-')))
# token_dict['text'] = token_dict['text'].replace(' ', '-')
# sentence_tokens.append(token_dict)
# sentences.append(sentence_tokens)
print('!!!', len(sentences))
for i, sent in enumerate(sentences[:5]):
print(i, type(sent), len(sent), sent[:5])
return sentences
def tokenize(text, n_input, max_words):
if use_spacy:
return tokenize_spacy(text, n_input, max_words)
return tokenize_simple(text, max_words)
def train_test(sentences, n_input, test_frac):
random.shuffle(sentences)
n_samples = sum((len(sent) - n_input) for sent in sentences)
n_test = int(n_samples * test_frac)
test = []
i_test = 0
for sent in sentences:
if i_test + len(sent) - n_input > n_test:
break
test.append(sent)
i_test += len(sent) - n_input
train = sentences[len(test):]
assert train and test, (len(sentences), len(test), len(train), test_frac)
return train, test
def build_indexes(sentences, max_vocab):
word_counts = defaultdict(int)
for sent in sentences:
for w in sent:
word_counts[w] += 1
vocabulary_list = sorted(word_counts, key=lambda x: (-word_counts[x], x))[:max_vocab - 1]
vocabulary_list.append(UNKNOWN)
vocabulary = set(vocabulary_list)
# for i, w in enumerate(words[:5]):
# marker = '***' if w in vocabulary else ''
# print('%3d: %-20s %s' % (i, w, marker))
vocab_size = len(vocabulary)
unk_index = vocab_size - 1
word_index = {w: i for i, w in enumerate(vocabulary_list)}
word_index[UNKNOWN] = unk_index
index_word = {i: w for w, i in word_index.items()}
# for i in sorted(index_word)[:5]:
# print(i, index_word[i], type(i))
# for i in range(vocab_size):
# assert i in index_word, i
return word_index, index_word, unk_index
def build_embeddings(word_index):
embeddings = {w: np.zeros(len(word_index), dtype=np.float32) for w in word_index}
for w, i in word_index.items():
embeddings[w][i] = 1.0
unk_embedding = embeddings[UNKNOWN]
return embeddings, unk_embedding
text = make_text()
print('%7d bytes' % len(text))
sentences = tokenize(text, n_input, MAX_WORDS)
print('ALL')
print('%7d sentences' % len(sentences))
print('%7d words' % sum(len(sent) for sent in sentences))
train, test_sentences = train_test(sentences, n_input, test_frac)
sentences = train
print('TRAIN')
print('%7d sentences' % len(sentences))
print('%7d words' % sum(len(sent) for sent in sentences))
word_index, index_word, unk_index = build_indexes(sentences, MAX_VOCAB)
vocab_size = len(word_index)
print('%7d vocab' % vocab_size)
embeddings, unk_embedding = build_embeddings(word_index)
n_samples = sum((len(sent) - n_input) for sent in sentences)
print('%7d samples' % n_samples)
def batch_getter(sentences, n_input, batch_size):
"""Generator that returns x, y, oneh_y in `batch_size` batches
phrase is a random phrase of length n_input + 1 from words
x = indexes of first n_input words
y = index of last word
returns x, y, one hot encoding of y
"""
sequence_numbers = []
for i, sent in enumerate(sentences):
for j in range(len(sent) - n_input - 1):
sequence_numbers.append((i, j))
random.shuffle(sequence_numbers)
for k0 in range(0, len(sequence_numbers), batch_size):
n = min(len(sequence_numbers) - k0, batch_size)
# print('****', k, n, len(sequence_numbers))
oneh_y = np.empty((n, vocab_size), dtype=np.float32)
indexes_x = np.empty((n, n_input), dtype=int)
indexes_y = np.empty((n), dtype=int)
for k in range(n):
i, j = sequence_numbers[k0 + k]
words = sentences[i]
assert j < len(words) - n_input - 1, (i, j, len(words), n_input)
assert j + n_input < len(words), 'i=%d j=%d words=%d sequence_numbers n_input=%d' % (
i, j, len(words), len(sequence_numbers), n_input)
phrase_x = words[j:j + n_input]
phrase_y = words[j + n_input]
wx = [word_index.get(w, unk_index) for w in phrase_x]
wy = word_index.get(phrase_y, unk_index)
indexes_x[k] = np.array(wx)
indexes_y[k] = np.array(wy)
oneh_y[k] = embeddings.get(phrase_y, unk_embedding)
# show('indexes_x', indexes_y)
yield indexes_x, indexes_y, oneh_y
# tf Graph inputs
# x = indexes of first n_input words in phrase
# y = one hot encoding of last word in phrase
x = tf.placeholder("float", [None, n_input])
y = tf.placeholder("float", [None, vocab_size])
# RNN output node weights and biases
weights = tf.Variable(tf.random_normal([n_hidden, vocab_size]))
biases = tf.Variable(tf.random_normal([vocab_size]))
def RNN(x, weights, biases):
"""RNN predicts y (one hot) from x (indexes), weights and biases
y = g(x) * W + b, where
g = LSTM
x = indexes of input words
y = one-hot encoding of output word
"""
show('x', x)
# Generate a n_input-element sequence of inputs
# (eg. [had] [a] [general] -> [20] [6] [33])
x = tf.split(x, n_input, 1)
show('x split', x)
# 1-layer LSTM with n_hidden units.
rnn_cell = rnn.BasicLSTMCell(n_hidden)
# generate prediction
outputs, states = rnn.static_rnn(rnn_cell, x, dtype=tf.float32)
# there are n_input outputs but we only want the last output
y = tf.matmul(outputs[-1], weights) + biases
show('y', y)
return y
pred = RNN(x, weights, biases)
# Loss and optimizer
cost = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(logits=pred, labels=y))
optimizer = tf.train.RMSPropOptimizer(learning_rate=learning_rate).minimize(cost)
# Model evaluation
correct_pred = tf.equal(tf.argmax(pred, 1), tf.argmax(y, 1))
accuracy = tf.reduce_mean(tf.cast(correct_pred, tf.float32))
# Initializing the variables
init = tf.global_variables_initializer()
os.makedirs(model_folder, exist_ok=True)
saver = tf.train.Saver(max_to_keep=3)
def demonstrate(indexes_x, indexes_y, onehot_pred, step, i):
indexes = [int(indexes_x[i, j]) for j in range(indexes_x.shape[1])]
symbols_in = [index_word.get(j, UNKNOWN) for j in indexes]
symbols_out = index_word.get(indexes_y[i], UNKNOWN)
v = tf.argmax(onehot_pred, 1).eval()
symbols_out_pred = index_word[int(v[i])]
mark = '****' if symbols_out_pred == symbols_out else ''
return "%5d: %60s -> [%s] -- [%s] %s" % (step, symbols_in, symbols_out, symbols_out_pred, mark)
def make_prediction(session, x):
y_pred = tf.run([y], feed_dict={x: x})
def test_model(session, x):
return tf.run([accuracy], feed_dict={x: x})
def test_results(session):
batch_size = 1000
acc_total = 0.0
loss_total = 0.0
predictions = []
source = batch_getter(test_sentences, n_input, batch_size)
step = 0
# Process minibatches of size `batch_size`
for _, (indexes_x, indexes_y, onehot_y) in enumerate(source):
# print('*** %s %d %d' % (list(indexes_y.shape), n_samples, batch_size))
frac = len(indexes_y) / n_samples
# Update the model
acc, loss, onehot_pred = session.run([accuracy, cost, pred],
feed_dict={x: indexes_x,
y: onehot_y})
loss_total += loss * frac
acc_total += acc * frac
assert acc <= 1.0, (acc, loss, frac)
assert frac <= 1.0, (acc, loss, frac)
assert acc_total <= 1.0, (acc, loss)
for i in range(len(indexes_y)):
if step < 10:
predictions.append(demonstrate(indexes_x, indexes_y, onehot_pred, step, i))
step += 1
return loss_total, acc_total, predictions
# Launch the graph
with tf.Session() as session:
session.run(init)
writer.add_graph(session.graph)
best_acc = 0.0
best_epoch = -1
new_best = False
if False:
devices = session.list_devices()
for d in devices:
print(d.name)
assert False
for epoch in range(n_epochs):
accuracies = []
train_acc = 0.0
train_loss = 0.0
source = batch_getter(sentences, n_input, batch_size)
# Process minibatches of size `batch_size`
for step, (indexes_x, indexes_y, onehot_y) in enumerate(source):
# print('*** %s %d %d' % (list(indexes_y.shape), n_samples, batch_size))
frac = len(indexes_y) / n_samples
# Update the model
_, acc, loss, onehot_pred = session.run([optimizer, accuracy, cost, pred],
feed_dict={x: indexes_x,
y: onehot_y})
train_loss += loss * frac
train_acc += acc * frac
accuracies.append(acc)
assert acc <= 1.0, (acc, loss, frac, accuracies)
assert frac <= 1.0, (acc, loss, frac, accuracies)
assert train_acc <= 1.0, (acc, loss, frac, accuracies)
# assert (len(accuracies) + 1) * batch_size > n_samples, (len(accuracies), batch_size, n_samples)
test_loss, test_acc, predictions = test_results(session)
# Show some progress statistics
if test_acc > best_acc:
best_epoch = epoch
best_acc = test_acc
best_predictions = predictions
new_best = True
# saver.save(session, os.path.join(model_folder, 'model_%06d.ckpt' % step))
print('epoch=%3d train_acc=%.2f test_acc=%.2f' % (epoch + 1,
100.0 * train_acc, 100.0 * test_acc))
done = epoch > best_epoch + patience or epoch == n_epochs - 1
if (epoch + 1) % n_epochs_report == 0 or done:
print("epoch=%3d (best=%3d): Train Loss=%9.6f Accuracy=%5.2f%% -- "
"Test Loss=%9.6f Accuracy=%5.2f%%" %
(epoch + 1, best_epoch + 1,
train_loss, 100.0 * train_acc,
test_loss, 100.0 * test_acc))
if new_best:
print('\n'.join(best_predictions))
new_best = False
# indexes = [int(indexes_x[0, i]) for i in range(indexes_x.shape[1])]
# symbols_in = [index_word.get(i, UNKNOWN) for i in indexes]
# symbols_out = index_word.get(indexes_y[0], UNKNOWN)
# v = tf.argmax(onehot_pred, 1).eval()
# symbols_out_pred = index_word[int(v[0])]
# print("%s -> [%s] predicted [%s]" % (symbols_in, symbols_out, symbols_out_pred))
if done:
break
print("Optimization Finished!")
print("Elapsed time: ", elapsed())
print("Run on command line.")
print("\ttensorboard --logdir=%s" % (logs_path))
print("Point your web browser to: http://localhost:6006/")
# while True:
# prompt = "%s words: " % n_input
# sentence = input(prompt)
# sentence = sentence.strip()
# words = sentence.split(' ')
# if len(words) != n_input:
# continue
# try:
# indexes = [word_index.get(w, unk_index) for w in words]
# for i in range(32):
# keys = np.reshape(np.array(indexes), [-1, n_input])
# onehot_pred = session.run(pred, feed_dict={x: keys})
# indexes_pred = int(tf.argmax(onehot_pred, 1).eval())
# sentence = "%s %s" % (sentence, index_word[indexes_pred])
# indexes = indexes[1:]
# indexes.append(indexes_pred)
# print(sentence)
# except KeyError:
# print("Word not in dictionary")
| [
1,
529,
276,
1112,
420,
29958,
29886,
1308,
14043,
10909,
29929,
29955,
29914,
311,
1693,
2450,
13,
5215,
26110,
408,
15886,
13,
5215,
12655,
408,
7442,
13,
3166,
26110,
29889,
21570,
1053,
364,
15755,
13,
3166,
2897,
29889,
2084,
1053,
7985,
1792,
13,
3166,
13149,
1053,
13149,
13,
5215,
337,
13,
5215,
4036,
13,
5215,
931,
13,
5215,
2897,
13,
5215,
805,
4135,
13,
3166,
16250,
1053,
2322,
8977,
13,
13,
13,
29937,
12662,
2699,
13,
26776,
353,
29871,
29896,
29896,
29906,
13,
1509,
29918,
1028,
4135,
353,
5852,
13,
12648,
29918,
29963,
20166,
2882,
353,
29871,
29946,
29900,
29900,
29900,
29900,
13,
12648,
29918,
11686,
8452,
353,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
13,
29903,
1529,
2208,
29918,
16975,
353,
7700,
13,
21891,
29918,
10492,
353,
29871,
29900,
29889,
29900,
29900,
29896,
13,
29876,
29918,
2080,
353,
29871,
29941,
13,
16175,
29918,
2311,
353,
29871,
29896,
29900,
29900,
13,
1688,
29918,
1154,
353,
869,
29906,
13,
29876,
29918,
1022,
2878,
29879,
353,
29871,
29896,
29900,
29900,
29900,
13,
29876,
29918,
1022,
2878,
29879,
29918,
12276,
353,
29871,
29896,
13,
29886,
24701,
353,
29871,
29896,
29900,
29900,
13,
4299,
29918,
12083,
353,
525,
9794,
29915,
13,
13,
29937,
1353,
310,
10340,
297,
390,
10262,
3038,
13,
29876,
29918,
10892,
353,
29871,
29945,
29896,
29906,
13,
13,
3904,
29968,
6632,
16048,
353,
12801,
3904,
29968,
6632,
16048,
16299,
13,
13,
8172,
29889,
26776,
29898,
26776,
29897,
13,
13,
29937,
17157,
1480,
2224,
13,
20756,
29918,
2084,
353,
8207,
7050,
29914,
29056,
29914,
29878,
15755,
29918,
9303,
29915,
13,
13236,
353,
15886,
29889,
7727,
29889,
2283,
10507,
29898,
20756,
29918,
2084,
29897,
13,
13,
2962,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
13,
13,
1753,
560,
28170,
7295,
13,
1678,
5226,
353,
931,
29889,
2230,
580,
448,
1369,
29918,
2230,
13,
1678,
565,
5226,
529,
29871,
29953,
29900,
29901,
13,
4706,
736,
11860,
29889,
29906,
29888,
5226,
29908,
1273,
5226,
13,
1678,
25342,
5226,
529,
29871,
29953,
29900,
334,
29871,
29953,
29900,
29901,
13,
4706,
736,
11860,
29889,
29906,
29888,
1375,
29908,
1273,
313,
3471,
847,
29871,
29953,
29900,
29889,
29900,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
11860,
29889,
29906,
29888,
7234,
29908,
1273,
313,
3471,
847,
313,
29953,
29900,
334,
29871,
29953,
29900,
876,
13,
13,
13,
1753,
1510,
29898,
978,
29892,
921,
1125,
13,
1678,
1018,
29901,
13,
4706,
325,
353,
14210,
29879,
16664,
29879,
29915,
1273,
313,
1761,
29898,
29916,
29889,
12181,
511,
921,
29889,
29881,
1853,
29897,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
565,
338,
8758,
29898,
29916,
29892,
313,
1761,
29892,
18761,
22164,
13,
9651,
325,
353,
14210,
29881,
16664,
29879,
29915,
1273,
313,
2435,
29898,
29916,
511,
1134,
29898,
29916,
29961,
29900,
12622,
13,
4706,
1683,
29901,
13,
9651,
325,
353,
1134,
29898,
29916,
29897,
13,
1678,
1596,
877,
29908,
29995,
29879,
29908,
16328,
29879,
29915,
1273,
313,
978,
29892,
325,
876,
13,
13,
13,
1753,
1303,
29918,
726,
29898,
2084,
1125,
13,
1678,
411,
1722,
29898,
2084,
29892,
525,
2273,
1495,
408,
285,
29901,
13,
4706,
736,
285,
29889,
949,
580,
13,
13,
13,
1753,
1207,
29918,
726,
7295,
13,
1678,
565,
317,
1529,
2208,
29918,
16975,
29901,
13,
4706,
736,
1303,
29918,
726,
877,
29890,
7807,
29918,
1552,
29918,
4117,
29889,
3945,
1495,
13,
1678,
396,
11105,
353,
7985,
1792,
877,
20038,
1688,
1272,
29889,
14941,
29914,
16519,
29914,
8493,
29941,
29906,
29900,
29900,
29900,
29918,
29906,
29900,
29900,
29947,
29889,
3945,
1495,
13,
1678,
11105,
353,
7985,
1792,
877,
20038,
1688,
1272,
29889,
14941,
29914,
16519,
29914,
1576,
29918,
7445,
29918,
29907,
29875,
8096,
29918,
6843,
273,
291,
29889,
3945,
1495,
13,
13,
1678,
934,
29918,
1761,
353,
12705,
29898,
23705,
29898,
13168,
876,
13,
1678,
1596,
877,
29995,
29881,
2066,
29915,
1273,
7431,
29898,
1445,
29918,
1761,
876,
13,
1678,
736,
11297,
29876,
4286,
7122,
29898,
949,
29918,
726,
29898,
2084,
29897,
363,
2224,
297,
934,
29918,
1761,
29897,
13,
13,
13,
1525,
29918,
5550,
11538,
353,
337,
29889,
12198,
29898,
29878,
29915,
7110,
29879,
2053,
4898,
29936,
9903,
29973,
29905,
2612,
1194,
4638,
29974,
742,
337,
29889,
29928,
2891,
9818,
891,
337,
29889,
29924,
8647,
6227,
8895,
29897,
13,
1525,
29918,
23207,
353,
337,
29889,
12198,
29898,
29878,
29915,
22896,
29909,
29899,
29999,
29985,
29874,
29899,
29920,
29962,
1495,
13,
13,
13,
1753,
5993,
675,
29918,
12857,
29898,
726,
29892,
4236,
29918,
9303,
1125,
13,
1678,
3838,
353,
5195,
29918,
5550,
11538,
29889,
5451,
29898,
726,
29897,
13,
1678,
3838,
353,
518,
29893,
363,
281,
297,
3838,
565,
7431,
29898,
29893,
29897,
1405,
29871,
29896,
322,
451,
5195,
29918,
23207,
29889,
4478,
29898,
29893,
4638,
13,
1678,
565,
4236,
29918,
9303,
1405,
29871,
29900,
29901,
13,
4706,
3838,
353,
3838,
7503,
3317,
29918,
9303,
29962,
13,
1678,
736,
518,
9303,
29962,
13,
13,
13,
1028,
4135,
29918,
12938,
29886,
353,
805,
4135,
29889,
1359,
877,
264,
1495,
13,
29886,
18049,
353,
426,
742,
742,
15300,
742,
21921,
742,
525,
29901,
742,
11297,
29876,
742,
11297,
29873,
742,
11297,
29888,
742,
6629,
29913,
13,
13,
13,
1753,
5993,
675,
29918,
1028,
4135,
29898,
726,
29892,
302,
29918,
2080,
29892,
4236,
29918,
9303,
1125,
13,
1678,
1842,
353,
805,
4135,
29918,
12938,
29886,
29898,
726,
29897,
13,
1678,
1574,
29918,
29879,
1237,
353,
1051,
29898,
3225,
29889,
29879,
1237,
29897,
13,
1678,
1596,
29898,
2435,
29898,
1514,
29918,
29879,
1237,
876,
13,
1678,
396,
363,
474,
29892,
2665,
297,
26985,
29898,
1514,
29918,
29879,
1237,
7503,
29906,
29900,
29962,
1125,
13,
1678,
396,
268,
1596,
29898,
29875,
29892,
1134,
29898,
18616,
511,
7431,
29898,
18616,
511,
2665,
7503,
29945,
2314,
13,
1678,
396,
25260,
13,
1678,
25260,
353,
5159,
13,
1678,
302,
29918,
9303,
353,
29871,
29900,
13,
1678,
363,
10638,
297,
1842,
29889,
29879,
1237,
29901,
13,
4706,
2665,
353,
518,
6979,
29889,
726,
29889,
17010,
580,
363,
5993,
297,
10638,
29962,
13,
4706,
2665,
353,
518,
29893,
363,
281,
297,
2665,
565,
281,
451,
297,
6035,
312,
29962,
13,
4706,
565,
7431,
29898,
18616,
29897,
529,
302,
29918,
2080,
718,
29871,
29896,
29901,
13,
9651,
6773,
13,
4706,
25260,
29889,
4397,
29898,
18616,
29897,
13,
4706,
302,
29918,
9303,
4619,
7431,
29898,
18616,
29897,
13,
4706,
565,
4236,
29918,
9303,
1405,
29871,
29900,
322,
302,
29918,
9303,
6736,
4236,
29918,
9303,
29901,
13,
9651,
2867,
13,
4706,
396,
363,
5993,
297,
10541,
29901,
13,
4706,
396,
268,
1596,
29898,
6979,
29897,
13,
4706,
396,
268,
5993,
29918,
8977,
353,
6571,
13,
4706,
396,
268,
5993,
29918,
8977,
1839,
2962,
7464,
5993,
29918,
8977,
1839,
355,
2033,
353,
679,
29918,
2962,
29918,
392,
29918,
355,
29918,
10289,
29918,
974,
29918,
6979,
29918,
3166,
29918,
1028,
4135,
29898,
6979,
29897,
13,
4706,
396,
268,
5993,
29918,
8977,
1839,
726,
2033,
353,
1426,
29961,
6979,
29918,
8977,
1839,
2962,
2033,
29901,
6979,
29918,
8977,
1839,
355,
2033,
29962,
13,
4706,
396,
268,
565,
5993,
29918,
8977,
1839,
726,
13359,
17010,
580,
297,
6024,
29905,
29876,
742,
11297,
29873,
742,
525,
13420,
525,
2033,
29901,
13,
4706,
396,
308,
6773,
13,
4706,
396,
268,
396,
8561,
1854,
393,
278,
5993,
1426,
947,
451,
1712,
738,
2913,
13,
4706,
396,
268,
565,
7431,
29898,
6979,
29918,
8977,
1839,
726,
13359,
5451,
877,
525,
876,
2804,
29871,
29896,
29901,
13,
4706,
396,
308,
1596,
703,
29956,
25614,
29901,
278,
1426,
310,
278,
5993,
3743,
2913,
2931,
29892,
8611,
411,
376,
13,
4706,
396,
1669,
376,
5819,
9789,
29905,
29876,
29905,
29873,
29912,
29900,
1012,
29876,
29905,
29873,
29912,
29896,
29913,
1642,
4830,
29898,
6979,
29918,
8977,
1839,
726,
7464,
5993,
29918,
8977,
1839,
726,
13359,
6506,
877,
13420,
17411,
29915,
4961,
13,
4706,
396,
308,
5993,
29918,
8977,
1839,
726,
2033,
353,
5993,
29918,
8977,
1839,
726,
13359,
6506,
877,
13420,
17411,
1495,
13,
4706,
396,
268,
10541,
29918,
517,
12360,
29889,
4397,
29898,
6979,
29918,
8977,
29897,
13,
4706,
396,
25260,
29889,
4397,
29898,
18616,
663,
29918,
517,
12360,
29897,
13,
1678,
1596,
877,
21004,
742,
7431,
29898,
18616,
2063,
876,
13,
1678,
363,
474,
29892,
2665,
297,
26985,
29898,
18616,
2063,
7503,
29945,
29962,
1125,
13,
4706,
1596,
29898,
29875,
29892,
1134,
29898,
18616,
511,
7431,
29898,
18616,
511,
2665,
7503,
29945,
2314,
13,
1678,
736,
25260,
13,
13,
13,
1753,
5993,
675,
29898,
726,
29892,
302,
29918,
2080,
29892,
4236,
29918,
9303,
1125,
13,
1678,
565,
671,
29918,
1028,
4135,
29901,
13,
4706,
736,
5993,
675,
29918,
1028,
4135,
29898,
726,
29892,
302,
29918,
2080,
29892,
4236,
29918,
9303,
29897,
13,
1678,
736,
5993,
675,
29918,
12857,
29898,
726,
29892,
4236,
29918,
9303,
29897,
13,
13,
13,
1753,
7945,
29918,
1688,
29898,
18616,
2063,
29892,
302,
29918,
2080,
29892,
1243,
29918,
1154,
1125,
13,
1678,
4036,
29889,
845,
21897,
29898,
18616,
2063,
29897,
13,
1678,
302,
29918,
27736,
353,
2533,
3552,
2435,
29898,
18616,
29897,
448,
302,
29918,
2080,
29897,
363,
2665,
297,
25260,
29897,
13,
1678,
302,
29918,
1688,
353,
938,
29898,
29876,
29918,
27736,
334,
1243,
29918,
1154,
29897,
13,
1678,
1243,
353,
5159,
13,
1678,
474,
29918,
1688,
353,
29871,
29900,
13,
1678,
363,
2665,
297,
25260,
29901,
13,
4706,
565,
474,
29918,
1688,
718,
7431,
29898,
18616,
29897,
448,
302,
29918,
2080,
1405,
302,
29918,
1688,
29901,
13,
9651,
2867,
13,
4706,
1243,
29889,
4397,
29898,
18616,
29897,
13,
4706,
474,
29918,
1688,
4619,
7431,
29898,
18616,
29897,
448,
302,
29918,
2080,
13,
1678,
7945,
353,
25260,
29961,
2435,
29898,
1688,
1125,
29962,
13,
1678,
4974,
7945,
322,
1243,
29892,
313,
2435,
29898,
18616,
2063,
511,
7431,
29898,
1688,
511,
7431,
29898,
14968,
511,
1243,
29918,
1154,
29897,
13,
1678,
736,
7945,
29892,
1243,
13,
13,
13,
1753,
2048,
29918,
2248,
267,
29898,
18616,
2063,
29892,
4236,
29918,
29894,
542,
370,
1125,
13,
1678,
1734,
29918,
2798,
29879,
353,
2322,
8977,
29898,
524,
29897,
13,
1678,
363,
2665,
297,
25260,
29901,
13,
4706,
363,
281,
297,
2665,
29901,
13,
9651,
1734,
29918,
2798,
29879,
29961,
29893,
29962,
4619,
29871,
29896,
13,
1678,
7931,
370,
352,
653,
29918,
1761,
353,
12705,
29898,
1742,
29918,
2798,
29879,
29892,
1820,
29922,
2892,
921,
29901,
8521,
1742,
29918,
2798,
29879,
29961,
29916,
1402,
921,
876,
7503,
3317,
29918,
29894,
542,
370,
448,
29871,
29896,
29962,
13,
1678,
7931,
370,
352,
653,
29918,
1761,
29889,
4397,
29898,
3904,
29968,
6632,
16048,
29897,
13,
1678,
7931,
370,
352,
653,
353,
731,
29898,
29894,
542,
370,
352,
653,
29918,
1761,
29897,
13,
1678,
396,
363,
474,
29892,
281,
297,
26985,
29898,
9303,
7503,
29945,
29962,
1125,
13,
1678,
396,
268,
17456,
353,
525,
17435,
29915,
565,
281,
297,
7931,
370,
352,
653,
1683,
6629,
13,
1678,
396,
268,
1596,
877,
29995,
29941,
29881,
29901,
1273,
29899,
29906,
29900,
29879,
1273,
29879,
29915,
1273,
313,
29875,
29892,
281,
29892,
17456,
876,
13,
13,
1678,
7931,
370,
29918,
2311,
353,
7431,
29898,
29894,
542,
370,
352,
653,
29897,
13,
1678,
443,
29895,
29918,
2248,
353,
7931,
370,
29918,
2311,
448,
29871,
29896,
13,
1678,
1734,
29918,
2248,
353,
426,
29893,
29901,
474,
363,
474,
29892,
281,
297,
26985,
29898,
29894,
542,
370,
352,
653,
29918,
1761,
2915,
13,
1678,
1734,
29918,
2248,
29961,
3904,
29968,
6632,
16048,
29962,
353,
443,
29895,
29918,
2248,
13,
1678,
2380,
29918,
1742,
353,
426,
29875,
29901,
281,
363,
281,
29892,
474,
297,
1734,
29918,
2248,
29889,
7076,
28296,
13,
13,
1678,
396,
363,
474,
297,
12705,
29898,
2248,
29918,
1742,
29897,
7503,
29945,
5387,
13,
1678,
396,
268,
1596,
29898,
29875,
29892,
2380,
29918,
1742,
29961,
29875,
1402,
1134,
29898,
29875,
876,
13,
13,
1678,
396,
363,
474,
297,
3464,
29898,
29894,
542,
370,
29918,
2311,
1125,
13,
1678,
396,
268,
4974,
474,
297,
2380,
29918,
1742,
29892,
474,
13,
13,
1678,
736,
1734,
29918,
2248,
29892,
2380,
29918,
1742,
29892,
443,
29895,
29918,
2248,
13,
13,
13,
1753,
2048,
29918,
17987,
29881,
886,
29898,
1742,
29918,
2248,
1125,
13,
1678,
8297,
29881,
886,
353,
426,
29893,
29901,
7442,
29889,
3298,
359,
29898,
2435,
29898,
1742,
29918,
2248,
511,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
363,
281,
297,
1734,
29918,
2248,
29913,
13,
1678,
363,
281,
29892,
474,
297,
1734,
29918,
2248,
29889,
7076,
7295,
13,
4706,
8297,
29881,
886,
29961,
29893,
3816,
29875,
29962,
353,
29871,
29896,
29889,
29900,
13,
1678,
443,
29895,
29918,
17987,
8497,
353,
8297,
29881,
886,
29961,
3904,
29968,
6632,
16048,
29962,
13,
1678,
736,
8297,
29881,
886,
29892,
443,
29895,
29918,
17987,
8497,
13,
13,
13,
726,
353,
1207,
29918,
726,
580,
13,
2158,
877,
29995,
29955,
29881,
6262,
29915,
1273,
7431,
29898,
726,
876,
13,
18616,
2063,
353,
5993,
675,
29898,
726,
29892,
302,
29918,
2080,
29892,
18134,
29918,
11686,
8452,
29897,
13,
2158,
877,
9818,
1495,
13,
2158,
877,
29995,
29955,
29881,
25260,
29915,
1273,
7431,
29898,
18616,
2063,
876,
13,
2158,
877,
29995,
29955,
29881,
3838,
29915,
1273,
2533,
29898,
2435,
29898,
18616,
29897,
363,
2665,
297,
25260,
876,
13,
13,
14968,
29892,
1243,
29918,
18616,
2063,
353,
7945,
29918,
1688,
29898,
18616,
2063,
29892,
302,
29918,
2080,
29892,
1243,
29918,
1154,
29897,
13,
18616,
2063,
353,
7945,
13,
13,
2158,
877,
29911,
4717,
1177,
1495,
13,
2158,
877,
29995,
29955,
29881,
25260,
29915,
1273,
7431,
29898,
18616,
2063,
876,
13,
2158,
877,
29995,
29955,
29881,
3838,
29915,
1273,
2533,
29898,
2435,
29898,
18616,
29897,
363,
2665,
297,
25260,
876,
13,
13,
13,
1742,
29918,
2248,
29892,
2380,
29918,
1742,
29892,
443,
29895,
29918,
2248,
353,
2048,
29918,
2248,
267,
29898,
18616,
2063,
29892,
18134,
29918,
29963,
20166,
2882,
29897,
13,
29894,
542,
370,
29918,
2311,
353,
7431,
29898,
1742,
29918,
2248,
29897,
13,
2158,
877,
29995,
29955,
29881,
7931,
370,
29915,
1273,
7931,
370,
29918,
2311,
29897,
13,
17987,
29881,
886,
29892,
443,
29895,
29918,
17987,
8497,
353,
2048,
29918,
17987,
29881,
886,
29898,
1742,
29918,
2248,
29897,
13,
29876,
29918,
27736,
353,
2533,
3552,
2435,
29898,
18616,
29897,
448,
302,
29918,
2080,
29897,
363,
2665,
297,
25260,
29897,
13,
2158,
877,
29995,
29955,
29881,
11916,
29915,
1273,
302,
29918,
27736,
29897,
13,
13,
13,
1753,
9853,
29918,
657,
357,
29898,
18616,
2063,
29892,
302,
29918,
2080,
29892,
9853,
29918,
2311,
1125,
13,
1678,
9995,
21575,
393,
3639,
921,
29892,
343,
29892,
697,
29882,
29918,
29891,
297,
421,
16175,
29918,
2311,
29952,
9853,
267,
13,
4706,
16549,
338,
263,
4036,
16549,
310,
3309,
302,
29918,
2080,
718,
29871,
29896,
515,
3838,
13,
4706,
921,
353,
18111,
310,
937,
302,
29918,
2080,
3838,
13,
4706,
343,
353,
2380,
310,
1833,
1734,
13,
4706,
3639,
921,
29892,
343,
29892,
697,
7375,
8025,
310,
343,
13,
1678,
9995,
13,
1678,
5665,
29918,
20326,
353,
5159,
13,
1678,
363,
474,
29892,
2665,
297,
26985,
29898,
18616,
2063,
1125,
13,
4706,
363,
432,
297,
3464,
29898,
2435,
29898,
18616,
29897,
448,
302,
29918,
2080,
448,
29871,
29896,
1125,
13,
9651,
5665,
29918,
20326,
29889,
4397,
3552,
29875,
29892,
432,
876,
13,
1678,
4036,
29889,
845,
21897,
29898,
16506,
29918,
20326,
29897,
13,
13,
1678,
363,
413,
29900,
297,
3464,
29898,
29900,
29892,
7431,
29898,
16506,
29918,
20326,
511,
9853,
29918,
2311,
1125,
13,
4706,
302,
353,
1375,
29898,
2435,
29898,
16506,
29918,
20326,
29897,
448,
413,
29900,
29892,
9853,
29918,
2311,
29897,
13,
4706,
396,
1596,
877,
2328,
742,
413,
29892,
302,
29892,
7431,
29898,
16506,
29918,
20326,
876,
13,
4706,
697,
29882,
29918,
29891,
353,
7442,
29889,
6310,
3552,
29876,
29892,
7931,
370,
29918,
2311,
511,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
13,
4706,
18111,
29918,
29916,
353,
7442,
29889,
6310,
3552,
29876,
29892,
302,
29918,
2080,
511,
26688,
29922,
524,
29897,
13,
4706,
18111,
29918,
29891,
353,
7442,
29889,
6310,
3552,
29876,
511,
26688,
29922,
524,
29897,
13,
13,
4706,
363,
413,
297,
3464,
29898,
29876,
1125,
13,
9651,
474,
29892,
432,
353,
5665,
29918,
20326,
29961,
29895,
29900,
718,
413,
29962,
13,
9651,
3838,
353,
25260,
29961,
29875,
29962,
13,
9651,
4974,
432,
529,
7431,
29898,
9303,
29897,
448,
302,
29918,
2080,
448,
29871,
29896,
29892,
313,
29875,
29892,
432,
29892,
7431,
29898,
9303,
511,
302,
29918,
2080,
29897,
13,
9651,
4974,
432,
718,
302,
29918,
2080,
529,
7431,
29898,
9303,
511,
525,
29875,
16328,
29881,
432,
16328,
29881,
3838,
16328,
29881,
5665,
29918,
20326,
302,
29918,
2080,
16328,
29881,
29915,
1273,
313,
13,
18884,
474,
29892,
432,
29892,
7431,
29898,
9303,
511,
7431,
29898,
16506,
29918,
20326,
511,
302,
29918,
2080,
29897,
13,
13,
9651,
16549,
29918,
29916,
353,
3838,
29961,
29926,
29901,
29926,
718,
302,
29918,
2080,
29962,
13,
9651,
16549,
29918,
29891,
353,
3838,
29961,
29926,
718,
302,
29918,
2080,
29962,
13,
9651,
26437,
353,
518,
1742,
29918,
2248,
29889,
657,
29898,
29893,
29892,
443,
29895,
29918,
2248,
29897,
363,
281,
297,
16549,
29918,
29916,
29962,
13,
9651,
5018,
353,
1734,
29918,
2248,
29889,
657,
29898,
24588,
559,
29918,
29891,
29892,
443,
29895,
29918,
2248,
29897,
13,
13,
9651,
18111,
29918,
29916,
29961,
29895,
29962,
353,
7442,
29889,
2378,
29898,
23310,
29897,
13,
9651,
18111,
29918,
29891,
29961,
29895,
29962,
353,
7442,
29889,
2378,
29898,
12822,
29897,
13,
9651,
697,
29882,
29918,
29891,
29961,
29895,
29962,
353,
8297,
29881,
886,
29889,
657,
29898,
24588,
559,
29918,
29891,
29892,
443,
29895,
29918,
17987,
8497,
29897,
13,
13,
4706,
396,
1510,
877,
2248,
267,
29918,
29916,
742,
18111,
29918,
29891,
29897,
13,
4706,
7709,
18111,
29918,
29916,
29892,
18111,
29918,
29891,
29892,
697,
29882,
29918,
29891,
13,
13,
13,
29937,
15886,
12367,
10970,
13,
29937,
921,
353,
18111,
310,
937,
302,
29918,
2080,
3838,
297,
16549,
13,
29937,
343,
353,
697,
7375,
8025,
310,
1833,
1734,
297,
16549,
13,
29916,
353,
15886,
29889,
27074,
703,
7411,
613,
518,
8516,
29892,
302,
29918,
2080,
2314,
13,
29891,
353,
15886,
29889,
27074,
703,
7411,
613,
518,
8516,
29892,
7931,
370,
29918,
2311,
2314,
13,
13,
29937,
390,
10262,
1962,
2943,
18177,
322,
4768,
2129,
13,
705,
5861,
353,
15886,
29889,
16174,
29898,
13264,
29889,
8172,
29918,
8945,
4197,
29876,
29918,
10892,
29892,
7931,
370,
29918,
2311,
12622,
13,
5365,
2129,
353,
15886,
29889,
16174,
29898,
13264,
29889,
8172,
29918,
8945,
4197,
29894,
542,
370,
29918,
2311,
12622,
13,
13,
13,
1753,
390,
10262,
29898,
29916,
29892,
18177,
29892,
4768,
2129,
1125,
13,
1678,
9995,
29934,
10262,
8500,
29879,
343,
313,
650,
7375,
29897,
515,
921,
313,
2248,
267,
511,
18177,
322,
4768,
2129,
13,
4706,
343,
353,
330,
29898,
29916,
29897,
334,
399,
718,
289,
29892,
988,
13,
9651,
330,
353,
365,
1254,
29924,
13,
9651,
921,
353,
18111,
310,
1881,
3838,
13,
9651,
343,
353,
697,
29899,
8711,
8025,
310,
1962,
1734,
13,
13,
1678,
9995,
13,
1678,
1510,
877,
29916,
742,
921,
29897,
13,
13,
1678,
396,
3251,
403,
263,
302,
29918,
2080,
29899,
5029,
5665,
310,
10970,
13,
1678,
396,
313,
387,
29889,
518,
21312,
29962,
518,
29874,
29962,
518,
17492,
29962,
1599,
518,
29906,
29900,
29962,
518,
29953,
29962,
518,
29941,
29941,
2314,
13,
1678,
921,
353,
15886,
29889,
5451,
29898,
29916,
29892,
302,
29918,
2080,
29892,
29871,
29896,
29897,
13,
1678,
1510,
877,
29916,
6219,
742,
921,
29897,
13,
13,
1678,
396,
29871,
29896,
29899,
13148,
365,
1254,
29924,
411,
302,
29918,
10892,
10340,
29889,
13,
1678,
364,
15755,
29918,
3729,
353,
364,
15755,
29889,
16616,
29931,
1254,
29924,
4617,
29898,
29876,
29918,
10892,
29897,
13,
13,
1678,
396,
5706,
18988,
13,
1678,
14391,
29892,
5922,
353,
364,
15755,
29889,
7959,
29918,
29878,
15755,
29898,
29878,
15755,
29918,
3729,
29892,
921,
29892,
26688,
29922,
13264,
29889,
7411,
29941,
29906,
29897,
13,
13,
1678,
396,
727,
526,
302,
29918,
2080,
14391,
541,
591,
871,
864,
278,
1833,
1962,
13,
1678,
343,
353,
15886,
29889,
2922,
16109,
29898,
4905,
29879,
14352,
29896,
1402,
18177,
29897,
718,
4768,
2129,
13,
1678,
1510,
877,
29891,
742,
343,
29897,
13,
1678,
736,
343,
13,
13,
13,
11965,
353,
390,
10262,
29898,
29916,
29892,
18177,
29892,
4768,
2129,
29897,
13,
13,
29937,
365,
2209,
322,
5994,
3950,
13,
18253,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
15755,
29889,
2695,
3317,
29918,
19128,
29918,
296,
14441,
29918,
2541,
29918,
1188,
1169,
29898,
1188,
1169,
29922,
11965,
29892,
11073,
29922,
29891,
876,
13,
20640,
3950,
353,
15886,
29889,
14968,
29889,
29934,
4345,
20420,
20624,
326,
3950,
29898,
21891,
29918,
10492,
29922,
21891,
29918,
10492,
467,
1195,
326,
675,
29898,
18253,
29897,
13,
13,
29937,
8125,
17983,
13,
15728,
29918,
11965,
353,
15886,
29889,
11745,
29898,
13264,
29889,
1191,
3317,
29898,
11965,
29892,
29871,
29896,
511,
15886,
29889,
1191,
3317,
29898,
29891,
29892,
29871,
29896,
876,
13,
562,
2764,
4135,
353,
15886,
29889,
17469,
29918,
12676,
29898,
13264,
29889,
4384,
29898,
15728,
29918,
11965,
29892,
15886,
29889,
7411,
29941,
29906,
876,
13,
13,
29937,
17250,
5281,
278,
3651,
13,
2344,
353,
15886,
29889,
10945,
29918,
20897,
29918,
11228,
3950,
580,
13,
13,
359,
29889,
29885,
12535,
12935,
29898,
4299,
29918,
12083,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
4977,
369,
353,
15886,
29889,
14968,
29889,
29903,
12483,
29898,
3317,
29918,
517,
29918,
17462,
29922,
29941,
29897,
13,
13,
13,
1753,
22222,
29898,
2248,
267,
29918,
29916,
29892,
18111,
29918,
29891,
29892,
697,
8711,
29918,
11965,
29892,
4331,
29892,
474,
1125,
13,
1678,
18111,
353,
518,
524,
29898,
2248,
267,
29918,
29916,
29961,
29875,
29892,
432,
2314,
363,
432,
297,
3464,
29898,
2248,
267,
29918,
29916,
29889,
12181,
29961,
29896,
2314,
29962,
13,
1678,
15072,
29918,
262,
353,
518,
2248,
29918,
1742,
29889,
657,
29898,
29926,
29892,
8291,
29968,
6632,
16048,
29897,
363,
432,
297,
18111,
29962,
13,
1678,
15072,
29918,
449,
353,
2380,
29918,
1742,
29889,
657,
29898,
2248,
267,
29918,
29891,
29961,
29875,
1402,
8291,
29968,
6632,
16048,
29897,
13,
1678,
325,
353,
15886,
29889,
1191,
3317,
29898,
650,
8711,
29918,
11965,
29892,
29871,
29896,
467,
14513,
580,
13,
1678,
15072,
29918,
449,
29918,
11965,
353,
2380,
29918,
1742,
29961,
524,
29898,
29894,
29961,
29875,
2314,
29962,
13,
1678,
2791,
353,
525,
2328,
29915,
565,
15072,
29918,
449,
29918,
11965,
1275,
15072,
29918,
449,
1683,
6629,
13,
1678,
736,
11860,
29945,
29881,
29901,
1273,
29953,
29900,
29879,
1599,
518,
29995,
29879,
29962,
1192,
518,
29995,
29879,
29962,
1273,
29879,
29908,
1273,
313,
10568,
29892,
15072,
29918,
262,
29892,
15072,
29918,
449,
29892,
15072,
29918,
449,
29918,
11965,
29892,
2791,
29897,
13,
13,
13,
1753,
1207,
29918,
11965,
2463,
29898,
7924,
29892,
921,
1125,
13,
1678,
343,
29918,
11965,
353,
15886,
29889,
3389,
4197,
29891,
1402,
8343,
29918,
8977,
3790,
29916,
29901,
921,
1800,
13,
13,
13,
1753,
1243,
29918,
4299,
29898,
7924,
29892,
921,
1125,
13,
1678,
736,
15886,
29889,
3389,
4197,
562,
2764,
4135,
1402,
8343,
29918,
8977,
3790,
29916,
29901,
921,
1800,
13,
13,
13,
1753,
1243,
29918,
9902,
29898,
7924,
1125,
13,
1678,
9853,
29918,
2311,
353,
29871,
29896,
29900,
29900,
29900,
13,
13,
1678,
1035,
29918,
7827,
353,
29871,
29900,
29889,
29900,
13,
1678,
6410,
29918,
7827,
353,
29871,
29900,
29889,
29900,
13,
1678,
27303,
353,
5159,
13,
13,
1678,
2752,
353,
9853,
29918,
657,
357,
29898,
1688,
29918,
18616,
2063,
29892,
302,
29918,
2080,
29892,
9853,
29918,
2311,
29897,
13,
13,
1678,
4331,
353,
29871,
29900,
13,
1678,
396,
10554,
1375,
747,
905,
267,
310,
2159,
421,
16175,
29918,
2311,
29952,
13,
1678,
363,
17117,
313,
2248,
267,
29918,
29916,
29892,
18111,
29918,
29891,
29892,
697,
8711,
29918,
29891,
29897,
297,
26985,
29898,
4993,
1125,
13,
4706,
396,
1596,
877,
17435,
1273,
29879,
1273,
29881,
1273,
29881,
29915,
1273,
313,
1761,
29898,
2248,
267,
29918,
29891,
29889,
12181,
511,
302,
29918,
27736,
29892,
9853,
29918,
2311,
876,
13,
4706,
285,
945,
353,
7431,
29898,
2248,
267,
29918,
29891,
29897,
847,
302,
29918,
27736,
13,
13,
4706,
396,
10318,
278,
1904,
13,
4706,
1035,
29892,
6410,
29892,
697,
8711,
29918,
11965,
353,
4867,
29889,
3389,
4197,
562,
2764,
4135,
29892,
3438,
29892,
4450,
1402,
13,
462,
18884,
8343,
29918,
8977,
3790,
29916,
29901,
18111,
29918,
29916,
29892,
13,
462,
462,
965,
343,
29901,
697,
8711,
29918,
29891,
1800,
13,
4706,
6410,
29918,
7827,
4619,
6410,
334,
285,
945,
13,
4706,
1035,
29918,
7827,
4619,
1035,
334,
285,
945,
13,
4706,
4974,
1035,
5277,
29871,
29896,
29889,
29900,
29892,
313,
5753,
29892,
6410,
29892,
285,
945,
29897,
13,
4706,
4974,
285,
945,
5277,
29871,
29896,
29889,
29900,
29892,
313,
5753,
29892,
6410,
29892,
285,
945,
29897,
13,
4706,
4974,
1035,
29918,
7827,
5277,
29871,
29896,
29889,
29900,
29892,
313,
5753,
29892,
6410,
29897,
13,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
2248,
267,
29918,
29891,
22164,
13,
9651,
565,
4331,
529,
29871,
29896,
29900,
29901,
13,
18884,
27303,
29889,
4397,
29898,
2310,
265,
710,
403,
29898,
2248,
267,
29918,
29916,
29892,
18111,
29918,
29891,
29892,
697,
8711,
29918,
11965,
29892,
4331,
29892,
474,
876,
13,
9651,
4331,
4619,
29871,
29896,
13,
13,
1678,
736,
6410,
29918,
7827,
29892,
1035,
29918,
7827,
29892,
27303,
13,
13,
13,
29937,
997,
3322,
278,
3983,
13,
2541,
15886,
29889,
7317,
580,
408,
4867,
29901,
13,
1678,
4867,
29889,
3389,
29898,
2344,
29897,
13,
1678,
9227,
29889,
1202,
29918,
4262,
29898,
7924,
29889,
4262,
29897,
13,
1678,
1900,
29918,
5753,
353,
29871,
29900,
29889,
29900,
13,
1678,
1900,
29918,
1022,
2878,
353,
448,
29896,
13,
1678,
716,
29918,
13318,
353,
7700,
13,
13,
1678,
565,
7700,
29901,
13,
4706,
9224,
353,
4867,
29889,
1761,
29918,
3359,
1575,
580,
13,
4706,
363,
270,
297,
9224,
29901,
13,
9651,
1596,
29898,
29881,
29889,
978,
29897,
13,
4706,
4974,
7700,
13,
13,
1678,
363,
21502,
305,
297,
3464,
29898,
29876,
29918,
1022,
2878,
29879,
1125,
13,
4706,
1035,
2002,
2478,
353,
5159,
13,
4706,
7945,
29918,
5753,
353,
29871,
29900,
29889,
29900,
13,
4706,
7945,
29918,
6758,
353,
29871,
29900,
29889,
29900,
13,
4706,
2752,
353,
9853,
29918,
657,
357,
29898,
18616,
2063,
29892,
302,
29918,
2080,
29892,
9853,
29918,
2311,
29897,
13,
13,
4706,
396,
10554,
1375,
747,
905,
267,
310,
2159,
421,
16175,
29918,
2311,
29952,
13,
4706,
363,
4331,
29892,
313,
2248,
267,
29918,
29916,
29892,
18111,
29918,
29891,
29892,
697,
8711,
29918,
29891,
29897,
297,
26985,
29898,
4993,
1125,
13,
9651,
396,
1596,
877,
17435,
1273,
29879,
1273,
29881,
1273,
29881,
29915,
1273,
313,
1761,
29898,
2248,
267,
29918,
29891,
29889,
12181,
511,
302,
29918,
27736,
29892,
9853,
29918,
2311,
876,
13,
9651,
285,
945,
353,
7431,
29898,
2248,
267,
29918,
29891,
29897,
847,
302,
29918,
27736,
13,
13,
9651,
396,
10318,
278,
1904,
13,
9651,
17117,
1035,
29892,
6410,
29892,
697,
8711,
29918,
11965,
353,
4867,
29889,
3389,
4197,
20640,
3950,
29892,
13600,
29892,
3438,
29892,
4450,
1402,
13,
462,
462,
462,
1678,
8343,
29918,
8977,
3790,
29916,
29901,
18111,
29918,
29916,
29892,
13,
462,
462,
462,
1669,
343,
29901,
697,
8711,
29918,
29891,
1800,
13,
9651,
7945,
29918,
6758,
4619,
6410,
334,
285,
945,
13,
9651,
7945,
29918,
5753,
4619,
1035,
334,
285,
945,
13,
9651,
1035,
2002,
2478,
29889,
4397,
29898,
5753,
29897,
13,
9651,
4974,
1035,
5277,
29871,
29896,
29889,
29900,
29892,
313,
5753,
29892,
6410,
29892,
285,
945,
29892,
1035,
2002,
2478,
29897,
13,
9651,
4974,
285,
945,
5277,
29871,
29896,
29889,
29900,
29892,
313,
5753,
29892,
6410,
29892,
285,
945,
29892,
1035,
2002,
2478,
29897,
13,
9651,
4974,
7945,
29918,
5753,
5277,
29871,
29896,
29889,
29900,
29892,
313,
5753,
29892,
6410,
29892,
285,
945,
29892,
1035,
2002,
2478,
29897,
13,
9651,
396,
4974,
313,
2435,
29898,
5753,
2002,
2478,
29897,
718,
29871,
29896,
29897,
334,
9853,
29918,
2311,
1405,
302,
29918,
27736,
29892,
313,
2435,
29898,
5753,
2002,
2478,
511,
9853,
29918,
2311,
29892,
302,
29918,
27736,
29897,
13,
13,
4706,
1243,
29918,
6758,
29892,
1243,
29918,
5753,
29892,
27303,
353,
1243,
29918,
9902,
29898,
7924,
29897,
13,
4706,
396,
7704,
777,
6728,
13964,
13,
4706,
565,
1243,
29918,
5753,
1405,
1900,
29918,
5753,
29901,
13,
9651,
1900,
29918,
1022,
2878,
353,
21502,
305,
13,
9651,
1900,
29918,
5753,
353,
1243,
29918,
5753,
13,
9651,
1900,
29918,
27711,
1080,
353,
27303,
13,
9651,
716,
29918,
13318,
353,
5852,
13,
9651,
396,
872,
369,
29889,
7620,
29898,
7924,
29892,
2897,
29889,
2084,
29889,
7122,
29898,
4299,
29918,
12083,
29892,
525,
4299,
29918,
29995,
29900,
29953,
29881,
29889,
384,
415,
29915,
1273,
4331,
876,
13,
9651,
1596,
877,
1022,
2878,
16328,
29941,
29881,
7945,
29918,
5753,
29922,
15543,
29906,
29888,
1243,
29918,
5753,
29922,
15543,
29906,
29888,
29915,
1273,
313,
1022,
2878,
718,
29871,
29896,
29892,
13,
462,
29896,
29900,
29900,
29889,
29900,
334,
7945,
29918,
5753,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
334,
1243,
29918,
5753,
876,
13,
13,
4706,
2309,
353,
21502,
305,
1405,
1900,
29918,
1022,
2878,
718,
282,
24701,
470,
21502,
305,
1275,
302,
29918,
1022,
2878,
29879,
448,
29871,
29896,
13,
4706,
565,
313,
1022,
2878,
718,
29871,
29896,
29897,
1273,
302,
29918,
1022,
2878,
29879,
29918,
12276,
1275,
29871,
29900,
470,
2309,
29901,
13,
9651,
1596,
703,
1022,
2878,
16328,
29941,
29881,
313,
13318,
16328,
29941,
29881,
1125,
28186,
365,
2209,
16328,
29929,
29889,
29953,
29888,
4831,
332,
4135,
16328,
29945,
29889,
29906,
29888,
7686,
1192,
376,
13,
462,
29871,
376,
3057,
365,
2209,
16328,
29929,
29889,
29953,
29888,
29871,
4831,
332,
4135,
16328,
29945,
29889,
29906,
29888,
7686,
29908,
1273,
13,
462,
29871,
313,
1022,
2878,
718,
29871,
29896,
29892,
1900,
29918,
1022,
2878,
718,
29871,
29896,
29892,
13,
462,
259,
7945,
29918,
6758,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
334,
7945,
29918,
5753,
29892,
13,
462,
259,
1243,
29918,
6758,
29892,
29871,
29896,
29900,
29900,
29889,
29900,
334,
1243,
29918,
5753,
876,
13,
9651,
565,
716,
29918,
13318,
29901,
13,
18884,
1596,
28909,
29876,
4286,
7122,
29898,
13318,
29918,
27711,
1080,
876,
13,
18884,
716,
29918,
13318,
353,
7700,
13,
13,
9651,
396,
18111,
353,
518,
524,
29898,
2248,
267,
29918,
29916,
29961,
29900,
29892,
474,
2314,
363,
474,
297,
3464,
29898,
2248,
267,
29918,
29916,
29889,
12181,
29961,
29896,
2314,
29962,
13,
9651,
396,
15072,
29918,
262,
353,
518,
2248,
29918,
1742,
29889,
657,
29898,
29875,
29892,
8291,
29968,
6632,
16048,
29897,
363,
474,
297,
18111,
29962,
13,
9651,
396,
15072,
29918,
449,
353,
2380,
29918,
1742,
29889,
657,
29898,
2248,
267,
29918,
29891,
29961,
29900,
1402,
8291,
29968,
6632,
16048,
29897,
13,
9651,
396,
325,
353,
15886,
29889,
1191,
3317,
29898,
650,
8711,
29918,
11965,
29892,
29871,
29896,
467,
14513,
580,
13,
9651,
396,
15072,
29918,
449,
29918,
11965,
353,
2380,
29918,
1742,
29961,
524,
29898,
29894,
29961,
29900,
2314,
29962,
13,
9651,
396,
1596,
11702,
29879,
1599,
518,
29995,
29879,
29962,
25383,
518,
29995,
29879,
18017,
1273,
313,
18098,
29879,
29918,
262,
29892,
15072,
29918,
449,
29892,
15072,
29918,
449,
29918,
11965,
876,
13,
13,
4706,
565,
2309,
29901,
13,
9651,
2867,
13,
13,
1678,
1596,
703,
20624,
326,
2133,
4231,
3276,
29991,
1159,
13,
1678,
1596,
703,
29923,
23384,
931,
29901,
9162,
560,
28170,
3101,
13,
1678,
1596,
703,
6558,
373,
1899,
1196,
23157,
13,
1678,
1596,
14182,
698,
6073,
3377,
1192,
1188,
3972,
16328,
29879,
29908,
1273,
313,
20756,
29918,
2084,
876,
13,
1678,
1596,
703,
5228,
596,
1856,
4714,
304,
29901,
1732,
597,
7640,
29901,
29953,
29900,
29900,
29953,
29914,
1159,
13,
1678,
396,
1550,
5852,
29901,
13,
1678,
396,
268,
9508,
353,
11860,
29879,
3838,
29901,
376,
1273,
302,
29918,
2080,
13,
1678,
396,
268,
10541,
353,
1881,
29898,
14032,
415,
29897,
13,
1678,
396,
268,
10541,
353,
10541,
29889,
17010,
580,
13,
1678,
396,
268,
3838,
353,
10541,
29889,
5451,
877,
25710,
13,
1678,
396,
268,
565,
7431,
29898,
9303,
29897,
2804,
302,
29918,
2080,
29901,
13,
1678,
396,
308,
6773,
13,
1678,
396,
268,
1018,
29901,
13,
1678,
396,
308,
18111,
353,
518,
1742,
29918,
2248,
29889,
657,
29898,
29893,
29892,
443,
29895,
29918,
2248,
29897,
363,
281,
297,
3838,
29962,
13,
1678,
396,
308,
363,
474,
297,
3464,
29898,
29941,
29906,
1125,
13,
1678,
396,
632,
6611,
353,
7442,
29889,
690,
14443,
29898,
9302,
29889,
2378,
29898,
2248,
267,
511,
21069,
29896,
29892,
302,
29918,
2080,
2314,
13,
1678,
396,
632,
697,
8711,
29918,
11965,
353,
4867,
29889,
3389,
29898,
11965,
29892,
8343,
29918,
8977,
3790,
29916,
29901,
6611,
1800,
13,
1678,
396,
632,
18111,
29918,
11965,
353,
938,
29898,
13264,
29889,
1191,
3317,
29898,
650,
8711,
29918,
11965,
29892,
29871,
29896,
467,
14513,
3101,
13,
1678,
396,
632,
10541,
353,
11860,
29879,
1273,
29879,
29908,
1273,
313,
18616,
663,
29892,
2380,
29918,
1742,
29961,
2248,
267,
29918,
11965,
2314,
13,
1678,
396,
632,
18111,
353,
18111,
29961,
29896,
17531,
13,
1678,
396,
632,
18111,
29889,
4397,
29898,
2248,
267,
29918,
11965,
29897,
13,
1678,
396,
308,
1596,
29898,
18616,
663,
29897,
13,
1678,
396,
268,
5174,
7670,
2392,
29901,
13,
1678,
396,
308,
1596,
703,
14463,
451,
297,
8600,
1159,
13,
2
] |
account_verification_flask/services/twilio_services.py | TwilioDevEd/account-verification-flask | 8 | 191141 | <reponame>TwilioDevEd/account-verification-flask<gh_stars>1-10
import account_verification_flask.utilities
from account_verification_flask.utilities.settings import TwilioSettings
from twilio.rest import Client
class TwilioServices:
twilio_client = None
def __init__(self):
if TwilioServices.twilio_client is None:
TwilioServices.twilio_client = Client(
TwilioSettings.api_key(),
TwilioSettings.api_secret(),
TwilioSettings.account_sid(),
)
def send_registration_success_sms(self, to_number):
self.twilio_client.messages.create(
body=account_verification_flask.utilities.Signup_Complete,
to=to_number,
from_=TwilioSettings.phone_number(),
)
| [
1,
529,
276,
1112,
420,
29958,
27418,
14876,
16618,
3853,
29914,
10149,
29899,
369,
2450,
29899,
1579,
1278,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
30143,
5215,
3633,
29918,
369,
2450,
29918,
1579,
1278,
29889,
4422,
1907,
13,
3166,
3633,
29918,
369,
2450,
29918,
1579,
1278,
29889,
4422,
1907,
29889,
11027,
1053,
8168,
14876,
9585,
13,
3166,
3252,
14876,
29889,
5060,
1053,
12477,
13,
13,
13,
1990,
8168,
14876,
13779,
29901,
13,
1678,
3252,
14876,
29918,
4645,
353,
6213,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
565,
8168,
14876,
13779,
29889,
7516,
14876,
29918,
4645,
338,
6213,
29901,
13,
9651,
8168,
14876,
13779,
29889,
7516,
14876,
29918,
4645,
353,
12477,
29898,
13,
18884,
8168,
14876,
9585,
29889,
2754,
29918,
1989,
3285,
13,
18884,
8168,
14876,
9585,
29889,
2754,
29918,
19024,
3285,
13,
18884,
8168,
14876,
9585,
29889,
10149,
29918,
29879,
333,
3285,
13,
9651,
1723,
13,
13,
1678,
822,
3638,
29918,
1727,
8306,
29918,
8698,
29918,
29879,
1516,
29898,
1311,
29892,
304,
29918,
4537,
1125,
13,
4706,
1583,
29889,
7516,
14876,
29918,
4645,
29889,
19158,
29889,
3258,
29898,
13,
9651,
3573,
29922,
10149,
29918,
369,
2450,
29918,
1579,
1278,
29889,
4422,
1907,
29889,
10140,
786,
29918,
17813,
29892,
13,
9651,
304,
29922,
517,
29918,
4537,
29892,
13,
9651,
515,
29918,
29922,
27418,
14876,
9585,
29889,
6710,
29918,
4537,
3285,
13,
4706,
1723,
13,
2
] |
utils/glove.py | MirunaPislar/Word2vec | 13 | 5371 | import numpy as np
DEFAULT_FILE_PATH = "utils/datasets/glove.6B.50d.txt"
def loadWordVectors(tokens, filepath=DEFAULT_FILE_PATH, dimensions=50):
"""Read pretrained GloVe vectors"""
wordVectors = np.zeros((len(tokens), dimensions))
with open(filepath) as ifs:
for line in ifs:
line = line.strip()
if not line:
continue
row = line.split()
token = row[0]
if token not in tokens:
continue
data = [float(x) for x in row[1:]]
if len(data) != dimensions:
raise RuntimeError("wrong number of dimensions")
wordVectors[tokens[token]] = np.asarray(data)
return wordVectors
| [
1,
1053,
12655,
408,
7442,
13,
13,
23397,
29918,
7724,
29918,
10145,
353,
376,
13239,
29914,
14538,
1691,
29914,
29887,
417,
345,
29889,
29953,
29933,
29889,
29945,
29900,
29881,
29889,
3945,
29908,
13,
13,
1753,
2254,
14463,
29963,
11142,
29898,
517,
12360,
29892,
934,
2084,
29922,
23397,
29918,
7724,
29918,
10145,
29892,
13391,
29922,
29945,
29900,
1125,
13,
1678,
9995,
6359,
758,
3018,
1312,
21806,
29963,
29872,
12047,
15945,
29908,
13,
1678,
1734,
29963,
11142,
353,
7442,
29889,
3298,
359,
3552,
2435,
29898,
517,
12360,
511,
13391,
876,
13,
1678,
411,
1722,
29898,
1445,
2084,
29897,
408,
565,
29879,
29901,
13,
4706,
363,
1196,
297,
565,
29879,
29901,
13,
9651,
1196,
353,
1196,
29889,
17010,
580,
13,
9651,
565,
451,
1196,
29901,
13,
18884,
6773,
13,
9651,
1948,
353,
1196,
29889,
5451,
580,
13,
9651,
5993,
353,
1948,
29961,
29900,
29962,
13,
9651,
565,
5993,
451,
297,
18897,
29901,
13,
18884,
6773,
13,
9651,
848,
353,
518,
7411,
29898,
29916,
29897,
363,
921,
297,
1948,
29961,
29896,
29901,
5262,
13,
9651,
565,
7431,
29898,
1272,
29897,
2804,
13391,
29901,
13,
18884,
12020,
24875,
2392,
703,
15866,
549,
1353,
310,
13391,
1159,
13,
9651,
1734,
29963,
11142,
29961,
517,
12360,
29961,
6979,
5262,
353,
7442,
29889,
294,
2378,
29898,
1272,
29897,
13,
1678,
736,
1734,
29963,
11142,
13,
2
] |
to_excel_demo.py | 46319943/geopandas_demo | 0 | 190712 | <filename>to_excel_demo.py<gh_stars>0
from pathlib2 import Path
import geopandas
# 存放所有城市的目录
source_dir = Path(r'D:\Document\HousePricing\公司')
# 获取所有目录名字
city_dir_list = [x for x in source_dir.iterdir() if x.is_dir()]
# 输出目录
output_dir = Path(r'D:\Document\HousePricing\公司')
for city_dir in city_dir_list:
if (city_dir/'公司.shp').exists():
geodf = geopandas.read_file(str(city_dir/'公司.shp'),encoding="UTF-8")
print(geodf.head())
geodf.iloc[:, 0:-1].to_excel(str(city_dir/'公司.xlsx'),index=False)
| [
1,
529,
9507,
29958,
517,
29918,
24633,
29918,
17482,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
2224,
1982,
29906,
1053,
10802,
13,
5215,
1737,
459,
7086,
13,
13,
29937,
29871,
30946,
31182,
30744,
30417,
30626,
30461,
30210,
30895,
31283,
13,
4993,
29918,
3972,
353,
10802,
29898,
29878,
29915,
29928,
3583,
6268,
29905,
29950,
1709,
29925,
2200,
292,
29905,
30539,
30931,
1495,
13,
29937,
29871,
31024,
30683,
30744,
30417,
30895,
31283,
30548,
30578,
13,
12690,
29918,
3972,
29918,
1761,
353,
518,
29916,
363,
921,
297,
2752,
29918,
3972,
29889,
1524,
3972,
580,
565,
921,
29889,
275,
29918,
3972,
580,
29962,
13,
29937,
29871,
31573,
30544,
30895,
31283,
13,
4905,
29918,
3972,
353,
10802,
29898,
29878,
29915,
29928,
3583,
6268,
29905,
29950,
1709,
29925,
2200,
292,
29905,
30539,
30931,
1495,
13,
13,
1454,
4272,
29918,
3972,
297,
4272,
29918,
3972,
29918,
1761,
29901,
13,
1678,
565,
313,
12690,
29918,
3972,
22208,
30539,
30931,
29889,
845,
29886,
2824,
9933,
7295,
13,
4706,
1737,
397,
29888,
353,
1737,
459,
7086,
29889,
949,
29918,
1445,
29898,
710,
29898,
12690,
29918,
3972,
22208,
30539,
30931,
29889,
845,
29886,
5477,
22331,
543,
10496,
29899,
29947,
1159,
13,
4706,
1596,
29898,
479,
397,
29888,
29889,
2813,
3101,
13,
4706,
1737,
397,
29888,
29889,
309,
542,
7503,
29892,
29871,
29900,
13018,
29896,
1822,
517,
29918,
24633,
29898,
710,
29898,
12690,
29918,
3972,
22208,
30539,
30931,
29889,
20267,
29916,
5477,
2248,
29922,
8824,
29897,
13,
2
] |
bin/lmi-add-cat.py | mkelley/dct-redux | 0 | 44897 | #!/usr/bin/env python3
from astropy.modeling.models import Const1D, Const2D, Gaussian1D, Gaussian2D
from astropy.modeling.fitting import LevMarLSQFitter
from astropy.modeling import Fittable2DModel, Parameter
import sys
import logging
import argparse
import warnings
from datetime import datetime
from glob import glob
import numpy as np
import scipy.ndimage as nd
from matplotlib.patches import Ellipse
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.stats import sigma_clipped_stats
from astropy.wcs import WCS
from astropy.table import Table
from astropy.wcs import FITSFixedWarning
import photutils as pu
import sep
parser = argparse.ArgumentParser()
parser.add_argument('files', nargs='*', help='files to process')
parser.add_argument('--reprocess', action='store_true')
parser.add_argument('--verbose', '-v', action='store_true',
help='verbose logging')
args = parser.parse_args()
######################################################################
class GaussianConst2D(Fittable2DModel):
"""A model for a 2D Gaussian plus a constant.
Code from photutils (Copyright (c) 2011, Photutils developers).
Parameters
----------
constant : float
Value of the constant.
amplitude : float
Amplitude of the Gaussian.
x_mean : float
Mean of the Gaussian in x.
y_mean : float
Mean of the Gaussian in y.
x_stddev : float
Standard deviation of the Gaussian in x. ``x_stddev`` and
``y_stddev`` must be specified unless a covariance matrix
(``cov_matrix``) is input.
y_stddev : float
Standard deviation of the Gaussian in y. ``x_stddev`` and
``y_stddev`` must be specified unless a covariance matrix
(``cov_matrix``) is input.
theta : float, optional
Rotation angle in radians. The rotation angle increases
counterclockwise.
"""
constant = Parameter(default=1)
amplitude = Parameter(default=1)
x_mean = Parameter(default=0)
y_mean = Parameter(default=0)
x_stddev = Parameter(default=1)
y_stddev = Parameter(default=1)
theta = Parameter(default=0)
@staticmethod
def evaluate(x, y, constant, amplitude, x_mean, y_mean, x_stddev,
y_stddev, theta):
"""Two dimensional Gaussian plus constant function."""
model = Const2D(constant)(x, y) + Gaussian2D(amplitude, x_mean,
y_mean, x_stddev,
y_stddev, theta)(x, y)
return model
def fit_2dgaussian(data):
"""Fit a 2D Gaussian plus a constant to a 2D image.
Based on code from photutils (Copyright (c) 2011, Photutils developers).
Parameters
----------
data : array_like
The 2D array of the image.
Returns
-------
result : A `GaussianConst2D` model instance.
The best-fitting Gaussian 2D model.
"""
if np.ma.count(data) < 7:
raise ValueError('Input data must have a least 7 unmasked values to '
'fit a 2D Gaussian plus a constant.')
data.fill_value = 0.
data = data.filled()
# Subtract the minimum of the data as a rough background estimate.
# This will also make the data values positive, preventing issues with
# the moment estimation in data_properties. Moments from negative data
# values can yield undefined Gaussian parameters, e.g., x/y_stddev.
data = data - np.min(data)
guess_y, guess_x = np.array(data.shape) / 2
init_amplitude = np.ptp(data)
g_init = GaussianConst2D(constant=0, amplitude=init_amplitude,
x_mean=guess_x,
y_mean=guess_y,
x_stddev=3,
y_stddev=3,
theta=0)
fitter = LevMarLSQFitter()
y, x = np.indices(data.shape)
gfit = fitter(g_init, x, y, data)
return gfit
######################################################################
# setup logging
logger = logging.Logger('LMI Add Catalog')
logger.setLevel(logging.DEBUG)
# this allows logging to work when lmi-add-cat is run multiple times from
# ipython
if len(logger.handlers) == 0:
formatter = logging.Formatter('%(levelname)s: %(message)s')
level = logging.DEBUG if args.verbose else logging.INFO
console = logging.StreamHandler(sys.stdout)
console.setLevel(level)
console.setFormatter(formatter)
logger.addHandler(console)
logfile = logging.FileHandler('lmi-add-cat.log')
logfile.setLevel(level)
logfile.setFormatter(formatter)
logger.addHandler(logfile)
logger.info('#' * 70)
logger.info(datetime.now().isoformat())
logger.info('Command line: ' + ' '.join(sys.argv[1:]))
######################################################################
# suppress unnecessary warnings
warnings.simplefilter('ignore', FITSFixedWarning)
######################################################################
def show_objects(im, objects):
# plot background-subtracted image
fig, ax = plt.subplots()
m, s = np.mean(im), np.std(im)
im = ax.imshow(im, interpolation='nearest', cmap='gray',
vmin=m-s, vmax=m+s, origin='lower')
# plot an ellipse for each object
for i in range(len(objects)):
e = Ellipse(xy=(objects['x'][i], objects['y'][i]),
width=6*objects['a'][i],
height=6*objects['b'][i],
angle=objects['theta'][i] * 180. / np.pi)
e.set_facecolor('none')
e.set_edgecolor('red')
ax.add_artist(e)
for f in args.files:
if fits.getheader(f)['IMAGETYP'] != 'OBJECT':
continue
logger.debug(f)
with fits.open(f, mode='update') as hdu:
im = hdu[0].data + 0
h = hdu[0].header
if h['IMAGETYP'].upper() != 'OBJECT':
logger.warning(
f'Refusing to measure {f} with image type {h["imagetyp"]}.')
continue
if 'MASK' in hdu:
mask = hdu['MASK'].data.astype(bool)
else:
mask = np.zeros_like(im, bool)
if 'cat' in hdu:
if not args.reprocess:
continue
else:
del hdu['cat']
det = np.zeros_like(mask)
for iteration in range(3):
bkg = sep.Background(im, mask=det | mask, bw=64, bh=64, fw=3, fh=3)
# mask potential sources
det = ((im - bkg) / bkg.globalrms) > 3
# remove isolated pixels
det = nd.binary_closing(det)
bkg = sep.Background(im, mask=det | mask, bw=64, bh=64, fw=3, fh=3)
if 'bg' in hdu:
del hdu['bg']
hdu.append(fits.ImageHDU(bkg.back(), name='bg'))
hdu['bg'].header['bg'] = bkg.globalback
hdu['bg'].header['rms'] = bkg.globalrms
data = im - bkg
data[mask] = 0
try:
objects, labels = sep.extract(data, 3, err=bkg.globalrms,
segmentation_map=True)
except Exception as e:
logger.error(f'{f}: Object detection failed - {str(e)}')
continue
hdu[0].header['ncat'] = len(objects), 'number of objects in catalog'
if len(objects) == 0:
continue
#show_objects(data, objects)
# estimate seeing
fwhms = []
segmap = pu.SegmentationImage(labels)
for i in np.random.choice(len(segmap.segments), 50):
obj = segmap.segments[i].make_cutout(data, masked_array=True)
try:
g = fit_2dgaussian(obj)
except:
continue
fwhm = np.mean((g.x_stddev.value, g.y_stddev.value)) * 2.35
if fwhm < 1:
continue
fwhms.append(fwhm)
fwhm = sigma_clipped_stats(fwhms)[1]
rap = fwhm * 2 if np.isfinite(fwhm) else 10
flux, fluxerr, flag = sep.sum_circle(
data, objects['x'], objects['y'], rap, err=bkg.globalrms,
gain=h['gain'])
kronrad, krflag = sep.kron_radius(data, objects['x'], objects['y'],
objects['a'], objects['b'],
objects['theta'], 6.0)
krflux, krfluxerr, _flag = sep.sum_ellipse(
data, objects['x'], objects['y'], objects['a'], objects['b'],
np.minimum(objects['theta'], np.pi / 2.00001),
2.5 * kronrad, subpix=1, err=bkg.globalrms,
gain=h['gain'])
krflag |= _flag # combine flags
wcs = WCS(h)
ra, dec = wcs.all_pix2world(objects['x'], objects['y'], 0)
tab = Table((objects['x'], objects['y'], ra, dec, flux, fluxerr,
flag, objects['a'], objects['b'], objects['theta'],
kronrad, krflux, krfluxerr, krflag),
names=('x', 'y', 'ra', 'dec', 'flux', 'fluxerr', 'flag',
'a', 'b', 'theta', 'kronrad', 'krflux',
'krfluxerr', 'krflag'))
if 'cat' in hdu:
del hdu['cat']
hdu.append(fits.BinTableHDU(tab, name='cat'))
hdu['cat'].header['FWHM'] = fwhm, 'estimated median FWHM'
hdu['cat'].header['RADIUS'] = 2 * fwhm, 'aperture photometry radius'
logger.info(f"{f}: {len(tab)} objects, seeing = {fwhm:.1f}, background mean/rms = "
f"{hdu['bg'].header['bg']:.1f}/{hdu['bg'].header['rms']:.1f}")
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
3166,
8717,
14441,
29889,
4299,
292,
29889,
9794,
1053,
5798,
29896,
29928,
29892,
5798,
29906,
29928,
29892,
22477,
29896,
29928,
29892,
22477,
29906,
29928,
13,
3166,
8717,
14441,
29889,
4299,
292,
29889,
29888,
5367,
1053,
20708,
7083,
8547,
29984,
29943,
5171,
13,
3166,
8717,
14441,
29889,
4299,
292,
1053,
383,
986,
519,
29906,
29928,
3195,
29892,
24953,
13,
5215,
10876,
13,
5215,
12183,
13,
5215,
1852,
5510,
13,
5215,
18116,
13,
3166,
12865,
1053,
12865,
13,
3166,
13149,
1053,
13149,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
4560,
2272,
29889,
299,
3027,
408,
29871,
299,
13,
3166,
22889,
29889,
5041,
267,
1053,
1260,
5843,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
3166,
8717,
14441,
29889,
601,
1053,
23994,
13,
3166,
8717,
14441,
29889,
16202,
1053,
269,
2934,
29918,
11303,
2986,
29918,
16202,
13,
3166,
8717,
14441,
29889,
29893,
2395,
1053,
399,
9295,
13,
3166,
8717,
14441,
29889,
2371,
1053,
6137,
13,
3166,
8717,
14441,
29889,
29893,
2395,
1053,
383,
1806,
20322,
11925,
22709,
13,
5215,
6731,
13239,
408,
2653,
13,
5215,
16345,
13,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
16680,
29889,
1202,
29918,
23516,
877,
5325,
742,
302,
5085,
2433,
29930,
742,
1371,
2433,
5325,
304,
1889,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
276,
5014,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
369,
15828,
742,
17411,
29894,
742,
3158,
2433,
8899,
29918,
3009,
742,
13,
462,
1678,
1371,
2433,
369,
15828,
12183,
1495,
13,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
13383,
13383,
13383,
13383,
4136,
2277,
13,
13,
13,
1990,
22477,
12075,
29906,
29928,
29898,
29943,
986,
519,
29906,
29928,
3195,
1125,
13,
1678,
9995,
29909,
1904,
363,
263,
29871,
29906,
29928,
22477,
2298,
263,
4868,
29889,
13,
13,
1678,
5920,
515,
6731,
13239,
313,
11882,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29896,
29892,
19040,
13239,
18777,
467,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
4868,
584,
5785,
13,
4706,
7865,
310,
278,
4868,
29889,
13,
13,
1678,
28347,
584,
5785,
13,
4706,
1913,
2830,
1151,
310,
278,
22477,
29889,
13,
13,
1678,
921,
29918,
12676,
584,
5785,
13,
4706,
16316,
310,
278,
22477,
297,
921,
29889,
13,
13,
1678,
343,
29918,
12676,
584,
5785,
13,
4706,
16316,
310,
278,
22477,
297,
343,
29889,
13,
13,
1678,
921,
29918,
4172,
3359,
584,
5785,
13,
4706,
10117,
29522,
310,
278,
22477,
297,
921,
29889,
4954,
29916,
29918,
4172,
3359,
16159,
322,
13,
4706,
4954,
29891,
29918,
4172,
3359,
16159,
1818,
367,
6790,
6521,
263,
18838,
279,
8837,
4636,
13,
4706,
6695,
29952,
24542,
29918,
5344,
29952,
6348,
338,
1881,
29889,
13,
13,
1678,
343,
29918,
4172,
3359,
584,
5785,
13,
4706,
10117,
29522,
310,
278,
22477,
297,
343,
29889,
4954,
29916,
29918,
4172,
3359,
16159,
322,
13,
4706,
4954,
29891,
29918,
4172,
3359,
16159,
1818,
367,
6790,
6521,
263,
18838,
279,
8837,
4636,
13,
4706,
6695,
29952,
24542,
29918,
5344,
29952,
6348,
338,
1881,
29889,
13,
13,
1678,
278,
941,
584,
5785,
29892,
13136,
13,
4706,
9664,
362,
10696,
297,
2971,
5834,
29889,
450,
13733,
10696,
16415,
13,
4706,
6795,
13058,
3538,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
4868,
353,
24953,
29898,
4381,
29922,
29896,
29897,
13,
1678,
28347,
353,
24953,
29898,
4381,
29922,
29896,
29897,
13,
1678,
921,
29918,
12676,
353,
24953,
29898,
4381,
29922,
29900,
29897,
13,
1678,
343,
29918,
12676,
353,
24953,
29898,
4381,
29922,
29900,
29897,
13,
1678,
921,
29918,
4172,
3359,
353,
24953,
29898,
4381,
29922,
29896,
29897,
13,
1678,
343,
29918,
4172,
3359,
353,
24953,
29898,
4381,
29922,
29896,
29897,
13,
1678,
278,
941,
353,
24953,
29898,
4381,
29922,
29900,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
14707,
29898,
29916,
29892,
343,
29892,
4868,
29892,
28347,
29892,
921,
29918,
12676,
29892,
343,
29918,
12676,
29892,
921,
29918,
4172,
3359,
29892,
13,
462,
343,
29918,
4172,
3359,
29892,
278,
941,
1125,
13,
4706,
9995,
13985,
22112,
22477,
2298,
4868,
740,
1213,
15945,
13,
13,
4706,
1904,
353,
5798,
29906,
29928,
29898,
23362,
5033,
29916,
29892,
343,
29897,
718,
22477,
29906,
29928,
29898,
314,
2830,
1151,
29892,
921,
29918,
12676,
29892,
13,
462,
462,
462,
268,
343,
29918,
12676,
29892,
921,
29918,
4172,
3359,
29892,
13,
462,
462,
462,
268,
343,
29918,
4172,
3359,
29892,
278,
941,
5033,
29916,
29892,
343,
29897,
13,
4706,
736,
1904,
13,
13,
13,
1753,
6216,
29918,
29906,
20726,
17019,
29898,
1272,
1125,
13,
1678,
9995,
29943,
277,
263,
29871,
29906,
29928,
22477,
2298,
263,
4868,
304,
263,
29871,
29906,
29928,
1967,
29889,
13,
13,
1678,
16564,
373,
775,
515,
6731,
13239,
313,
11882,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29896,
29892,
19040,
13239,
18777,
467,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
848,
584,
1409,
29918,
4561,
13,
4706,
450,
29871,
29906,
29928,
1409,
310,
278,
1967,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
1121,
584,
319,
421,
29954,
17019,
12075,
29906,
29928,
29952,
1904,
2777,
29889,
13,
4706,
450,
1900,
29899,
29888,
5367,
22477,
29871,
29906,
29928,
1904,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
565,
7442,
29889,
655,
29889,
2798,
29898,
1272,
29897,
529,
29871,
29955,
29901,
13,
4706,
12020,
7865,
2392,
877,
4290,
848,
1818,
505,
263,
3203,
29871,
29955,
443,
13168,
287,
1819,
304,
525,
13,
462,
308,
525,
9202,
263,
29871,
29906,
29928,
22477,
2298,
263,
4868,
29889,
1495,
13,
13,
1678,
848,
29889,
5589,
29918,
1767,
353,
29871,
29900,
29889,
13,
1678,
848,
353,
848,
29889,
26940,
580,
13,
13,
1678,
396,
3323,
29873,
1461,
278,
9212,
310,
278,
848,
408,
263,
12164,
3239,
12678,
29889,
13,
1678,
396,
910,
674,
884,
1207,
278,
848,
1819,
6374,
29892,
5557,
292,
5626,
411,
13,
1678,
396,
278,
3256,
23248,
297,
848,
29918,
11330,
29889,
341,
290,
1237,
515,
8178,
848,
13,
1678,
396,
1819,
508,
7709,
7580,
22477,
4128,
29892,
321,
29889,
29887,
1696,
921,
29914,
29891,
29918,
4172,
3359,
29889,
13,
1678,
848,
353,
848,
448,
7442,
29889,
1195,
29898,
1272,
29897,
13,
1678,
4140,
29918,
29891,
29892,
4140,
29918,
29916,
353,
7442,
29889,
2378,
29898,
1272,
29889,
12181,
29897,
847,
29871,
29906,
13,
13,
1678,
2069,
29918,
314,
2830,
1151,
353,
7442,
29889,
415,
29886,
29898,
1272,
29897,
13,
1678,
330,
29918,
2344,
353,
22477,
12075,
29906,
29928,
29898,
23362,
29922,
29900,
29892,
28347,
29922,
2344,
29918,
314,
2830,
1151,
29892,
13,
462,
632,
921,
29918,
12676,
29922,
2543,
404,
29918,
29916,
29892,
13,
462,
632,
343,
29918,
12676,
29922,
2543,
404,
29918,
29891,
29892,
13,
462,
632,
921,
29918,
4172,
3359,
29922,
29941,
29892,
13,
462,
632,
343,
29918,
4172,
3359,
29922,
29941,
29892,
13,
462,
632,
278,
941,
29922,
29900,
29897,
13,
1678,
285,
5171,
353,
20708,
7083,
8547,
29984,
29943,
5171,
580,
13,
1678,
343,
29892,
921,
353,
7442,
29889,
513,
1575,
29898,
1272,
29889,
12181,
29897,
13,
1678,
330,
9202,
353,
285,
5171,
29898,
29887,
29918,
2344,
29892,
921,
29892,
343,
29892,
848,
29897,
13,
13,
1678,
736,
330,
9202,
13,
13,
13,
13383,
13383,
13383,
13383,
4136,
2277,
13,
29937,
6230,
12183,
13,
21707,
353,
12183,
29889,
16363,
877,
29931,
10403,
3462,
5725,
1495,
13,
21707,
29889,
842,
10108,
29898,
21027,
29889,
18525,
29897,
13,
13,
29937,
445,
6511,
12183,
304,
664,
746,
301,
2460,
29899,
1202,
29899,
4117,
338,
1065,
2999,
3064,
515,
13,
29937,
474,
4691,
13,
361,
7431,
29898,
21707,
29889,
3179,
9306,
29897,
1275,
29871,
29900,
29901,
13,
1678,
883,
2620,
353,
12183,
29889,
18522,
877,
29995,
29898,
5563,
978,
29897,
29879,
29901,
1273,
29898,
4906,
29897,
29879,
1495,
13,
1678,
3233,
353,
12183,
29889,
18525,
565,
6389,
29889,
369,
15828,
1683,
12183,
29889,
11690,
13,
13,
1678,
2991,
353,
12183,
29889,
3835,
4598,
29898,
9675,
29889,
25393,
29897,
13,
1678,
2991,
29889,
842,
10108,
29898,
5563,
29897,
13,
1678,
2991,
29889,
842,
18522,
29898,
689,
2620,
29897,
13,
1678,
17927,
29889,
1202,
4598,
29898,
11058,
29897,
13,
13,
1678,
1480,
1445,
353,
12183,
29889,
2283,
4598,
877,
29880,
2460,
29899,
1202,
29899,
4117,
29889,
1188,
1495,
13,
1678,
1480,
1445,
29889,
842,
10108,
29898,
5563,
29897,
13,
1678,
1480,
1445,
29889,
842,
18522,
29898,
689,
2620,
29897,
13,
1678,
17927,
29889,
1202,
4598,
29898,
1188,
1445,
29897,
13,
13,
21707,
29889,
3888,
14237,
29915,
334,
29871,
29955,
29900,
29897,
13,
21707,
29889,
3888,
29898,
12673,
29889,
3707,
2141,
10718,
4830,
3101,
13,
21707,
29889,
3888,
877,
6255,
1196,
29901,
525,
718,
525,
15300,
7122,
29898,
9675,
29889,
19218,
29961,
29896,
29901,
12622,
13,
13,
13383,
13383,
13383,
13383,
4136,
2277,
13,
29937,
21301,
19039,
18116,
13,
25442,
886,
29889,
12857,
4572,
877,
17281,
742,
383,
1806,
20322,
11925,
22709,
29897,
13,
13,
13383,
13383,
13383,
13383,
4136,
2277,
13,
13,
13,
1753,
1510,
29918,
12650,
29898,
326,
29892,
3618,
1125,
13,
1678,
396,
6492,
3239,
29899,
1491,
29873,
1461,
287,
1967,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
580,
13,
1678,
286,
29892,
269,
353,
7442,
29889,
12676,
29898,
326,
511,
7442,
29889,
4172,
29898,
326,
29897,
13,
1678,
527,
353,
4853,
29889,
326,
4294,
29898,
326,
29892,
29694,
2433,
28502,
342,
742,
274,
1958,
2433,
21012,
742,
13,
462,
259,
325,
1195,
29922,
29885,
29899,
29879,
29892,
325,
3317,
29922,
29885,
29974,
29879,
29892,
3978,
2433,
13609,
1495,
13,
13,
1678,
396,
6492,
385,
560,
5843,
363,
1269,
1203,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
12650,
22164,
13,
4706,
321,
353,
1260,
5843,
29898,
3594,
7607,
12650,
1839,
29916,
2033,
29961,
29875,
1402,
3618,
1839,
29891,
2033,
29961,
29875,
11724,
13,
462,
1678,
2920,
29922,
29953,
29930,
12650,
1839,
29874,
2033,
29961,
29875,
1402,
13,
462,
1678,
3171,
29922,
29953,
29930,
12650,
1839,
29890,
2033,
29961,
29875,
1402,
13,
462,
1678,
10696,
29922,
12650,
1839,
3416,
2033,
29961,
29875,
29962,
334,
29871,
29896,
29947,
29900,
29889,
847,
7442,
29889,
1631,
29897,
13,
4706,
321,
29889,
842,
29918,
2161,
2780,
877,
9290,
1495,
13,
4706,
321,
29889,
842,
29918,
12864,
2780,
877,
1127,
1495,
13,
4706,
4853,
29889,
1202,
29918,
442,
391,
29898,
29872,
29897,
13,
13,
13,
1454,
285,
297,
6389,
29889,
5325,
29901,
13,
1678,
565,
23994,
29889,
657,
6672,
29898,
29888,
29897,
1839,
2382,
15631,
29925,
2033,
2804,
525,
14824,
17637,
2396,
13,
4706,
6773,
13,
13,
1678,
17927,
29889,
8382,
29898,
29888,
29897,
13,
13,
1678,
411,
23994,
29889,
3150,
29898,
29888,
29892,
4464,
2433,
5504,
1495,
408,
298,
700,
29901,
13,
4706,
527,
353,
298,
700,
29961,
29900,
1822,
1272,
718,
29871,
29900,
13,
4706,
298,
353,
298,
700,
29961,
29900,
1822,
6672,
13,
13,
4706,
565,
298,
1839,
2382,
15631,
29925,
13359,
21064,
580,
2804,
525,
14824,
17637,
2396,
13,
9651,
17927,
29889,
27392,
29898,
13,
18884,
285,
29915,
5620,
4746,
304,
5645,
426,
29888,
29913,
411,
1967,
1134,
426,
29882,
3366,
326,
26084,
1478,
3108,
1836,
1495,
13,
9651,
6773,
13,
13,
4706,
565,
525,
1529,
16033,
29915,
297,
298,
700,
29901,
13,
9651,
11105,
353,
298,
700,
1839,
1529,
16033,
13359,
1272,
29889,
579,
668,
29898,
11227,
29897,
13,
4706,
1683,
29901,
13,
9651,
11105,
353,
7442,
29889,
3298,
359,
29918,
4561,
29898,
326,
29892,
6120,
29897,
13,
13,
4706,
565,
525,
4117,
29915,
297,
298,
700,
29901,
13,
9651,
565,
451,
6389,
29889,
276,
5014,
29901,
13,
18884,
6773,
13,
9651,
1683,
29901,
13,
18884,
628,
298,
700,
1839,
4117,
2033,
13,
13,
4706,
1439,
353,
7442,
29889,
3298,
359,
29918,
4561,
29898,
13168,
29897,
13,
4706,
363,
12541,
297,
3464,
29898,
29941,
1125,
13,
9651,
289,
9415,
353,
16345,
29889,
10581,
29898,
326,
29892,
11105,
29922,
4801,
891,
11105,
29892,
289,
29893,
29922,
29953,
29946,
29892,
289,
29882,
29922,
29953,
29946,
29892,
285,
29893,
29922,
29941,
29892,
285,
29882,
29922,
29941,
29897,
13,
13,
9651,
396,
11105,
7037,
8974,
13,
9651,
1439,
353,
5135,
326,
448,
289,
9415,
29897,
847,
289,
9415,
29889,
10945,
29878,
1516,
29897,
1405,
29871,
29941,
13,
9651,
396,
259,
3349,
23968,
17036,
13,
9651,
1439,
353,
29871,
299,
29889,
19541,
29918,
11291,
292,
29898,
4801,
29897,
13,
13,
4706,
289,
9415,
353,
16345,
29889,
10581,
29898,
326,
29892,
11105,
29922,
4801,
891,
11105,
29892,
289,
29893,
29922,
29953,
29946,
29892,
289,
29882,
29922,
29953,
29946,
29892,
285,
29893,
29922,
29941,
29892,
285,
29882,
29922,
29941,
29897,
13,
13,
4706,
565,
525,
16264,
29915,
297,
298,
700,
29901,
13,
9651,
628,
298,
700,
1839,
16264,
2033,
13,
4706,
298,
700,
29889,
4397,
29898,
29888,
1169,
29889,
2940,
29950,
14849,
29898,
29890,
9415,
29889,
1627,
3285,
1024,
2433,
16264,
8785,
13,
4706,
298,
700,
1839,
16264,
13359,
6672,
1839,
16264,
2033,
353,
289,
9415,
29889,
10945,
1627,
13,
4706,
298,
700,
1839,
16264,
13359,
6672,
1839,
29878,
1516,
2033,
353,
289,
9415,
29889,
10945,
29878,
1516,
13,
13,
4706,
848,
353,
527,
448,
289,
9415,
13,
4706,
848,
29961,
13168,
29962,
353,
29871,
29900,
13,
4706,
1018,
29901,
13,
9651,
3618,
29892,
11073,
353,
16345,
29889,
21111,
29898,
1272,
29892,
29871,
29941,
29892,
4589,
29922,
29890,
9415,
29889,
10945,
29878,
1516,
29892,
13,
462,
462,
3986,
10768,
362,
29918,
1958,
29922,
5574,
29897,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
17927,
29889,
2704,
29898,
29888,
29915,
29912,
29888,
6177,
4669,
15326,
5229,
448,
426,
710,
29898,
29872,
2915,
1495,
13,
9651,
6773,
13,
13,
4706,
298,
700,
29961,
29900,
1822,
6672,
1839,
29876,
4117,
2033,
353,
7431,
29898,
12650,
511,
525,
4537,
310,
3618,
297,
16653,
29915,
13,
4706,
565,
7431,
29898,
12650,
29897,
1275,
29871,
29900,
29901,
13,
9651,
6773,
13,
13,
4706,
396,
4294,
29918,
12650,
29898,
1272,
29892,
3618,
29897,
13,
13,
4706,
396,
12678,
8790,
13,
4706,
285,
1332,
1516,
353,
5159,
13,
4706,
2377,
1958,
353,
2653,
29889,
17669,
358,
362,
2940,
29898,
21134,
29897,
13,
4706,
363,
474,
297,
7442,
29889,
8172,
29889,
16957,
29898,
2435,
29898,
10199,
1958,
29889,
10199,
1860,
511,
29871,
29945,
29900,
1125,
13,
9651,
5446,
353,
2377,
1958,
29889,
10199,
1860,
29961,
29875,
1822,
5675,
29918,
7582,
449,
29898,
1272,
29892,
11105,
287,
29918,
2378,
29922,
5574,
29897,
13,
9651,
1018,
29901,
13,
18884,
330,
353,
6216,
29918,
29906,
20726,
17019,
29898,
5415,
29897,
13,
9651,
5174,
29901,
13,
18884,
6773,
13,
13,
9651,
285,
1332,
29885,
353,
7442,
29889,
12676,
3552,
29887,
29889,
29916,
29918,
4172,
3359,
29889,
1767,
29892,
330,
29889,
29891,
29918,
4172,
3359,
29889,
1767,
876,
334,
29871,
29906,
29889,
29941,
29945,
13,
9651,
565,
285,
1332,
29885,
529,
29871,
29896,
29901,
13,
18884,
6773,
13,
9651,
285,
1332,
1516,
29889,
4397,
29898,
29888,
1332,
29885,
29897,
13,
13,
4706,
285,
1332,
29885,
353,
269,
2934,
29918,
11303,
2986,
29918,
16202,
29898,
29888,
1332,
1516,
9601,
29896,
29962,
13,
4706,
14937,
353,
285,
1332,
29885,
334,
29871,
29906,
565,
7442,
29889,
4492,
262,
568,
29898,
29888,
1332,
29885,
29897,
1683,
29871,
29896,
29900,
13,
13,
4706,
19389,
29892,
19389,
3127,
29892,
7353,
353,
16345,
29889,
2083,
29918,
16622,
29898,
13,
9651,
848,
29892,
3618,
1839,
29916,
7464,
3618,
1839,
29891,
7464,
14937,
29892,
4589,
29922,
29890,
9415,
29889,
10945,
29878,
1516,
29892,
13,
9651,
11581,
29922,
29882,
1839,
29887,
475,
11287,
13,
13,
4706,
413,
1617,
3665,
29892,
12920,
15581,
353,
16345,
29889,
29895,
1617,
29918,
13471,
29898,
1272,
29892,
3618,
1839,
29916,
7464,
3618,
1839,
29891,
7464,
13,
462,
462,
3986,
3618,
1839,
29874,
7464,
3618,
1839,
29890,
7464,
13,
462,
462,
3986,
3618,
1839,
3416,
7464,
29871,
29953,
29889,
29900,
29897,
13,
4706,
12920,
1579,
1314,
29892,
12920,
1579,
1314,
3127,
29892,
903,
15581,
353,
16345,
29889,
2083,
29918,
295,
5843,
29898,
13,
9651,
848,
29892,
3618,
1839,
29916,
7464,
3618,
1839,
29891,
7464,
3618,
1839,
29874,
7464,
3618,
1839,
29890,
7464,
13,
9651,
7442,
29889,
1195,
12539,
29898,
12650,
1839,
3416,
7464,
7442,
29889,
1631,
847,
29871,
29906,
29889,
29900,
29900,
29900,
29900,
29896,
511,
13,
632,
29906,
29889,
29945,
334,
413,
1617,
3665,
29892,
1014,
29886,
861,
29922,
29896,
29892,
4589,
29922,
29890,
9415,
29889,
10945,
29878,
1516,
29892,
13,
9651,
11581,
29922,
29882,
1839,
29887,
475,
11287,
13,
4706,
12920,
15581,
891,
29922,
903,
15581,
29871,
396,
14405,
13449,
13,
13,
4706,
281,
2395,
353,
399,
9295,
29898,
29882,
29897,
13,
4706,
1153,
29892,
1602,
353,
281,
2395,
29889,
497,
29918,
29886,
861,
29906,
11526,
29898,
12650,
1839,
29916,
7464,
3618,
1839,
29891,
7464,
29871,
29900,
29897,
13,
13,
4706,
4434,
353,
6137,
3552,
12650,
1839,
29916,
7464,
3618,
1839,
29891,
7464,
1153,
29892,
1602,
29892,
19389,
29892,
19389,
3127,
29892,
13,
462,
268,
7353,
29892,
3618,
1839,
29874,
7464,
3618,
1839,
29890,
7464,
3618,
1839,
3416,
7464,
13,
462,
268,
413,
1617,
3665,
29892,
12920,
1579,
1314,
29892,
12920,
1579,
1314,
3127,
29892,
12920,
15581,
511,
13,
462,
1678,
2983,
29922,
877,
29916,
742,
525,
29891,
742,
525,
336,
742,
525,
7099,
742,
525,
1579,
1314,
742,
525,
1579,
1314,
3127,
742,
525,
15581,
742,
13,
462,
965,
525,
29874,
742,
525,
29890,
742,
525,
3416,
742,
525,
29895,
1617,
3665,
742,
525,
12748,
1579,
1314,
742,
13,
462,
965,
525,
12748,
1579,
1314,
3127,
742,
525,
12748,
15581,
8785,
13,
4706,
565,
525,
4117,
29915,
297,
298,
700,
29901,
13,
9651,
628,
298,
700,
1839,
4117,
2033,
13,
4706,
298,
700,
29889,
4397,
29898,
29888,
1169,
29889,
29933,
262,
3562,
29950,
14849,
29898,
3891,
29892,
1024,
2433,
4117,
8785,
13,
4706,
298,
700,
1839,
4117,
13359,
6672,
1839,
29943,
25039,
29924,
2033,
353,
285,
1332,
29885,
29892,
525,
342,
326,
630,
19194,
383,
25039,
29924,
29915,
13,
4706,
298,
700,
1839,
4117,
13359,
6672,
1839,
29934,
3035,
29902,
3308,
2033,
353,
29871,
29906,
334,
285,
1332,
29885,
29892,
525,
481,
814,
545,
6731,
7843,
11855,
29915,
13,
13,
4706,
17927,
29889,
3888,
29898,
29888,
29908,
29912,
29888,
6177,
426,
2435,
29898,
3891,
2915,
3618,
29892,
8790,
353,
426,
29888,
1332,
29885,
29901,
29889,
29896,
29888,
1118,
3239,
2099,
29914,
29878,
1516,
353,
376,
13,
462,
1678,
285,
29908,
29912,
29882,
700,
1839,
16264,
13359,
6672,
1839,
16264,
2033,
29901,
29889,
29896,
29888,
6822,
29912,
29882,
700,
1839,
16264,
13359,
6672,
1839,
29878,
1516,
2033,
29901,
29889,
29896,
29888,
27195,
13,
2
] |
lib/evaluation/sort_class_mean_accuracy.py | YerongLi2/LTVRR | 13 | 196691 | <filename>lib/evaluation/sort_class_mean_accuracy.py
'''
# How can we do the long tail with the soft?
# we pick the winner from our table (most likely a hubness) and the baseline.
# I want a csv that tells me for every predition (rel. or sbj.)
# a) its class, (optionally the class-frequency), and the top-1 or top-5 [choose]
# score per a soft matrix.
'''
import pandas as pd
import os.path as osp
#method_name = '_hubness10k'
method_name = '_hubness'
#method_name = '_baseline'
workon = 'relation' # or 'relations'
#in_csv_file = '/ibex/scratch/x_abdelks/MetricAnalysis/VQA/_focal_loss_g025/test/subjects_data_GQA.csv' # method
in_csv_file = '/ibex/scratch/x_abdelks/MetricAnalysis/VQA/{}/test/predicates_data_GQA.csv'.format(method_name) # method
#similarities_used = ['word2vec_GNews'] # pick one
similarities_used = ['word2vec_visualVG'] # pick one
top_aux_data_dir = './' # where are the freq. dictionaries
print(method_name, similarities_used, workon)
df = pd.read_csv(in_csv_file)
## Clip similarities to [-1, 1] range.
for sim in similarities_used:
too_large = df[sim] > 1
df.loc[too_large, sim] = 1
too_small = df[sim] < -1
df.loc[too_small, sim] = -1
freq_info = pd.read_csv(osp.join(top_aux_data_dir, 'gvqa_{}_to_train_freq.csv'.format(workon)))
freq_info_dict = dict()
if workon == 'subject':
x, y = freq_info.gt_sbj, freq_info.sbj_freq_gt
elif workon == 'relation':
x, y = freq_info.gt_rel, freq_info.rel_freq_gt
for k, v in zip(x, y):
freq_info_dict[k] = v
ndf = df[df['i'] == 0][[sim, 'gold']] # top-1
g = ndf.groupby('gold')
average_per_class = g[sim].mean().reset_index()
average_per_class['frequency'] = average_per_class['gold'].apply(lambda x: freq_info_dict[x])
average_per_class = average_per_class.sort_values('frequency', ascending=False)
average_per_class.to_csv('{}_vgqa_sorted_mean_acc_per_class_on_{}_with_{}.csv'.format(method_name, workon, sim))
| [
1,
529,
9507,
29958,
1982,
29914,
24219,
362,
29914,
6605,
29918,
1990,
29918,
12676,
29918,
562,
2764,
4135,
29889,
2272,
13,
12008,
13,
29937,
1128,
508,
591,
437,
278,
1472,
12464,
411,
278,
4964,
29973,
29871,
13,
29937,
591,
5839,
278,
19576,
515,
1749,
1591,
313,
3242,
5517,
263,
19766,
2264,
29897,
322,
278,
2362,
5570,
29889,
13,
29937,
306,
864,
263,
11799,
393,
10603,
592,
363,
1432,
4450,
654,
313,
2674,
29889,
470,
17444,
29926,
1846,
13,
29937,
263,
29897,
967,
770,
29892,
313,
3385,
635,
278,
770,
29899,
10745,
23860,
511,
322,
278,
2246,
29899,
29896,
470,
2246,
29899,
29945,
518,
21803,
29962,
13,
29937,
8158,
639,
263,
4964,
4636,
29889,
13,
12008,
13,
13,
5215,
11701,
408,
10518,
13,
5215,
2897,
29889,
2084,
29871,
408,
288,
1028,
13,
13,
29937,
5696,
29918,
978,
353,
22868,
29882,
431,
2264,
29896,
29900,
29895,
29915,
13,
5696,
29918,
978,
353,
22868,
29882,
431,
2264,
29915,
13,
29937,
5696,
29918,
978,
353,
22868,
6500,
5570,
29915,
13,
1287,
265,
353,
525,
23445,
29915,
396,
470,
525,
2674,
800,
29915,
13,
29937,
262,
29918,
7638,
29918,
1445,
353,
8207,
747,
735,
29914,
10526,
905,
29914,
29916,
29918,
370,
6144,
2039,
29914,
10095,
2200,
21067,
4848,
29914,
29963,
29984,
29909,
19891,
29888,
18642,
29918,
6758,
29918,
29887,
29900,
29906,
29945,
29914,
1688,
29914,
16009,
29879,
29918,
1272,
29918,
29954,
29984,
29909,
29889,
7638,
29915,
29871,
396,
1158,
13,
262,
29918,
7638,
29918,
1445,
353,
8207,
747,
735,
29914,
10526,
905,
29914,
29916,
29918,
370,
6144,
2039,
29914,
10095,
2200,
21067,
4848,
29914,
29963,
29984,
29909,
19248,
6822,
1688,
29914,
11965,
293,
1078,
29918,
1272,
29918,
29954,
29984,
29909,
29889,
7638,
4286,
4830,
29898,
5696,
29918,
978,
29897,
29871,
396,
1158,
13,
29937,
29764,
1907,
29918,
3880,
353,
6024,
1742,
29906,
2003,
29918,
29954,
29328,
2033,
396,
5839,
697,
13,
29764,
1907,
29918,
3880,
353,
6024,
1742,
29906,
2003,
29918,
20119,
29963,
29954,
2033,
396,
5839,
697,
13,
3332,
29918,
2993,
29918,
1272,
29918,
3972,
353,
19283,
29915,
396,
988,
526,
278,
3005,
29939,
29889,
21503,
4314,
13,
2158,
29898,
5696,
29918,
978,
29892,
2788,
1907,
29918,
3880,
29892,
664,
265,
29897,
13,
2176,
353,
10518,
29889,
949,
29918,
7638,
29898,
262,
29918,
7638,
29918,
1445,
29897,
13,
2277,
315,
3466,
2788,
1907,
304,
21069,
29896,
29892,
29871,
29896,
29962,
3464,
29889,
13,
1454,
1027,
297,
2788,
1907,
29918,
3880,
29901,
13,
1678,
2086,
29918,
16961,
353,
4489,
29961,
3601,
29962,
1405,
29871,
29896,
268,
13,
1678,
4489,
29889,
2029,
29961,
517,
29877,
29918,
16961,
29892,
1027,
29962,
353,
29871,
29896,
13,
1678,
2086,
29918,
9278,
353,
4489,
29961,
3601,
29962,
529,
448,
29896,
13,
1678,
4489,
29889,
2029,
29961,
517,
29877,
29918,
9278,
29892,
1027,
29962,
353,
448,
29896,
13,
13,
29888,
7971,
29918,
3888,
353,
10518,
29889,
949,
29918,
7638,
29898,
4705,
29889,
7122,
29898,
3332,
29918,
2993,
29918,
1272,
29918,
3972,
29892,
525,
29887,
29894,
25621,
648,
2403,
517,
29918,
14968,
29918,
29888,
7971,
29889,
7638,
4286,
4830,
29898,
1287,
265,
4961,
13,
29888,
7971,
29918,
3888,
29918,
8977,
353,
9657,
580,
13,
13,
361,
664,
265,
1275,
525,
16009,
2396,
13,
1678,
921,
29892,
343,
353,
3005,
29939,
29918,
3888,
29889,
4141,
29918,
20778,
29926,
29892,
3005,
29939,
29918,
3888,
29889,
20778,
29926,
29918,
29888,
7971,
29918,
4141,
13,
23681,
664,
265,
1275,
525,
23445,
2396,
13,
1678,
921,
29892,
343,
353,
3005,
29939,
29918,
3888,
29889,
4141,
29918,
2674,
29892,
3005,
29939,
29918,
3888,
29889,
2674,
29918,
29888,
7971,
29918,
4141,
13,
13,
1454,
413,
29892,
325,
297,
14319,
29898,
29916,
29892,
343,
1125,
13,
1678,
3005,
29939,
29918,
3888,
29918,
8977,
29961,
29895,
29962,
353,
325,
13,
13,
299,
29888,
353,
4489,
29961,
2176,
1839,
29875,
2033,
1275,
29871,
29900,
3816,
29961,
3601,
29892,
525,
29887,
1025,
2033,
29962,
29871,
396,
2246,
29899,
29896,
13,
29887,
353,
29871,
299,
29888,
29889,
27789,
877,
29887,
1025,
1495,
13,
12483,
482,
29918,
546,
29918,
1990,
353,
330,
29961,
3601,
1822,
12676,
2141,
12071,
29918,
2248,
580,
13,
12483,
482,
29918,
546,
29918,
1990,
1839,
10745,
23860,
2033,
353,
6588,
29918,
546,
29918,
1990,
1839,
29887,
1025,
13359,
7302,
29898,
2892,
921,
29901,
3005,
29939,
29918,
3888,
29918,
8977,
29961,
29916,
2314,
13,
12483,
482,
29918,
546,
29918,
1990,
353,
6588,
29918,
546,
29918,
1990,
29889,
6605,
29918,
5975,
877,
10745,
23860,
742,
12066,
2548,
29922,
8824,
29897,
13,
12483,
482,
29918,
546,
29918,
1990,
29889,
517,
29918,
7638,
877,
29912,
2403,
29894,
29887,
25621,
29918,
24582,
29918,
12676,
29918,
5753,
29918,
546,
29918,
1990,
29918,
265,
648,
2403,
2541,
648,
1836,
7638,
4286,
4830,
29898,
5696,
29918,
978,
29892,
664,
265,
29892,
1027,
876,
13,
2
] |
supervisor/medusa/text_socket.py | infoxchange/supervisor | 1 | 100089 | # -*- Mode: Python -*-
__author__ = '<NAME>'
from supervisor.compat import PY3
from supervisor.compat import as_string, as_bytes
from socket import * # relied on to be imported from elsewhere
if PY3:
bin_socket = socket
class text_socket(socket):
def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None):
bin_socket.__init__(self, family, type, proto, fileno)
def recv(self, *args, **kwargs):
return as_string(bin_socket.recv(self, *args, **kwargs))
def recvfrom(self, *args, **kwargs):
reply, whence = bin_socket.recvfrom(self, *args, **kwargs)
reply = as_string(reply)
return reply, whence
def send(self, data, *args, **kwargs):
b = as_bytes(data)
return bin_socket.send(self, b, *args, **kwargs)
def sendall(self, data, *args, **kwargs):
return bin_socket.sendall(self, as_bytes(data), *args, **kwargs)
def sendto(self, data, *args, **kwargs):
return bin_socket.sendto(self, as_bytes(data), *args, **kwargs)
def accept(self):
# sock, addr = bin_socket.accept(self)
# sock = text_socket(self.family, self.type, self.proto, fileno=sock.fileno())
fd, addr = self._accept()
sock = text_socket(self.family, self.type, self.proto, fileno=fd)
# Issue #7995: if no default timeout is set and the listening
# socket had a (non-zero) timeout, force the new socket in blocking
# mode to override platform-specific socket flags inheritance.
if getdefaulttimeout() is None and self.gettimeout():
sock.setblocking(True)
return sock, addr
text_socket.__init__.__doc__ = bin_socket.__init__.__doc__
socket = text_socket
| [
1,
396,
448,
29930,
29899,
21864,
29901,
5132,
448,
29930,
29899,
13,
13,
1649,
8921,
1649,
353,
12801,
5813,
16299,
13,
13,
3166,
2428,
19188,
29889,
12667,
1053,
349,
29979,
29941,
13,
3166,
2428,
19188,
29889,
12667,
1053,
408,
29918,
1807,
29892,
408,
29918,
13193,
13,
13,
3166,
9909,
1053,
334,
396,
337,
2957,
373,
304,
367,
19673,
515,
17551,
13,
13,
361,
349,
29979,
29941,
29901,
13,
1678,
9016,
29918,
11514,
353,
9909,
13,
1678,
770,
1426,
29918,
11514,
29898,
11514,
1125,
13,
4706,
822,
4770,
2344,
12035,
1311,
29892,
3942,
29922,
5098,
29918,
1177,
2544,
29892,
1134,
29922,
6156,
7077,
29918,
1254,
1525,
5194,
29892,
17814,
29922,
29900,
29892,
977,
8154,
29922,
8516,
1125,
13,
9651,
9016,
29918,
11514,
17255,
2344,
12035,
1311,
29892,
3942,
29892,
1134,
29892,
17814,
29892,
977,
8154,
29897,
13,
13,
4706,
822,
1162,
29894,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
9651,
736,
408,
29918,
1807,
29898,
2109,
29918,
11514,
29889,
3757,
29894,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
876,
13,
13,
4706,
822,
1162,
29894,
3166,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
9651,
8908,
29892,
377,
663,
353,
9016,
29918,
11514,
29889,
3757,
29894,
3166,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
9651,
8908,
353,
408,
29918,
1807,
29898,
3445,
368,
29897,
13,
9651,
736,
8908,
29892,
377,
663,
13,
13,
4706,
822,
3638,
29898,
1311,
29892,
848,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
9651,
289,
353,
408,
29918,
13193,
29898,
1272,
29897,
13,
9651,
736,
9016,
29918,
11514,
29889,
6717,
29898,
1311,
29892,
289,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
822,
3638,
497,
29898,
1311,
29892,
848,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
9651,
736,
9016,
29918,
11514,
29889,
6717,
497,
29898,
1311,
29892,
408,
29918,
13193,
29898,
1272,
511,
334,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
822,
3638,
517,
29898,
1311,
29892,
848,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
9651,
736,
9016,
29918,
11514,
29889,
6717,
517,
29898,
1311,
29892,
408,
29918,
13193,
29898,
1272,
511,
334,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
822,
3544,
29898,
1311,
1125,
13,
29937,
9651,
577,
384,
29892,
28915,
353,
9016,
29918,
11514,
29889,
16044,
29898,
1311,
29897,
13,
29937,
9651,
577,
384,
353,
1426,
29918,
11514,
29898,
1311,
29889,
11922,
29892,
1583,
29889,
1853,
29892,
1583,
29889,
17529,
29892,
977,
8154,
29922,
21852,
29889,
1777,
8154,
3101,
13,
9651,
285,
29881,
29892,
28915,
353,
1583,
3032,
16044,
580,
13,
9651,
577,
384,
353,
1426,
29918,
11514,
29898,
1311,
29889,
11922,
29892,
1583,
29889,
1853,
29892,
1583,
29889,
17529,
29892,
977,
8154,
29922,
11512,
29897,
13,
9651,
396,
26246,
396,
29955,
29929,
29929,
29945,
29901,
565,
694,
2322,
11815,
338,
731,
322,
278,
19866,
13,
9651,
396,
9909,
750,
263,
313,
5464,
29899,
9171,
29897,
11815,
29892,
4889,
278,
716,
9909,
297,
23473,
13,
9651,
396,
4464,
304,
5712,
7481,
29899,
14940,
9909,
13449,
20328,
29889,
13,
9651,
565,
679,
4381,
15619,
580,
338,
6213,
322,
1583,
29889,
657,
15619,
7295,
13,
18884,
577,
384,
29889,
842,
1271,
292,
29898,
5574,
29897,
13,
9651,
736,
577,
384,
29892,
28915,
13,
13,
1678,
1426,
29918,
11514,
17255,
2344,
1649,
17255,
1514,
1649,
353,
9016,
29918,
11514,
17255,
2344,
1649,
17255,
1514,
1649,
13,
1678,
9909,
353,
1426,
29918,
11514,
13,
2
] |
irc/bot.py | suut/psychic-happiness | 1 | 1607972 | <gh_stars>1-10
# -*- coding: utf-8 -*-
# Copyright (C) 1999-2002 <NAME>
# Portions Copyright © 2011-2012 <NAME>
"""
Simple IRC bot library.
This module contains a single-server IRC bot class that can be used to
write simpler bots.
"""
from __future__ import absolute_import
import sys
import irc.client
import irc.modes
from .dict import IRCDict
class ServerSpec(object):
"""
An IRC server specification.
>>> spec = ServerSpec('localhost')
>>> spec.host
'localhost'
>>> spec.port
6667
>>> spec.password
>>> spec = ServerSpec('127.0.0.1', 6697, '<PASSWORD>')
>>> spec.password
'<PASSWORD>'
"""
def __init__(self, host, port=6667, password=None):
self.host = host
self.port = port
self.password = password
class SingleServerIRCBot(irc.client.SimpleIRCClient):
"""A single-server IRC bot class.
The bot tries to reconnect if it is disconnected.
The bot keeps track of the channels it has joined, the other
clients that are present in the channels and which of those that
have operator or voice modes. The "database" is kept in the
self.channels attribute, which is an IRCDict of Channels.
"""
def __init__(self, server_list, nickname, username, realname,
reconnection_interval=60, **connect_params):
"""Constructor for SingleServerIRCBot objects.
Arguments:
server_list -- A list of ServerSpec objects or tuples of
parameters suitable for constructing ServerSpec
objects. Defines the list of servers the bot will
use (in order).
nickname -- The bot's nickname.
realname -- The bot's realname.
reconnection_interval -- How long the bot should wait
before trying to reconnect.
dcc_connections -- A list of initiated/accepted DCC
connections.
**connect_params -- parameters to pass through to the connect
method.
"""
super(SingleServerIRCBot, self).__init__()
self.__connect_params = connect_params
self.channels = IRCDict()
self.server_list = [
ServerSpec(*server)
if isinstance(server, (tuple, list))
else server
for server in server_list
]
assert all(
isinstance(server, ServerSpec)
for server in self.server_list
)
if not reconnection_interval or reconnection_interval < 0:
reconnection_interval = 2 ** 31
self.reconnection_interval = reconnection_interval
self._nickname = nickname
self._realname = realname
self._username = username
for i in ["disconnect", "join", "kick", "mode",
"namreply", "nick", "part", "quit"]:
self.connection.add_global_handler(i, getattr(self, "_on_" + i),
-20)
def _connected_checker(self):
"""[Internal]"""
if not self.connection.is_connected():
self.connection.execute_delayed(self.reconnection_interval,
self._connected_checker)
self.jump_server()
def _connect(self):
"""
Establish a connection to the server at the front of the server_list.
"""
server = self.server_list[0]
try:
self.connect(server.host, server.port, self._nickname,
server.password, self._username, self._realname,
**self.__connect_params)
except irc.client.ServerConnectionError:
pass
def _on_disconnect(self, c, e):
self.channels = IRCDict()
self.connection.execute_delayed(self.reconnection_interval,
self._connected_checker)
def _on_join(self, c, e):
ch = e.target
nick = e.source.nick
if nick == c.get_nickname():
self.channels[ch] = Channel()
self.channels[ch].add_user(nick)
def _on_kick(self, c, e):
nick = e.arguments[0]
channel = e.target
if nick == c.get_nickname():
del self.channels[channel]
else:
self.channels[channel].remove_user(nick)
def _on_mode(self, c, e):
modes = irc.modes.parse_channel_modes(" ".join(e.arguments))
t = e.target
if irc.client.is_channel(t):
ch = self.channels[t]
for mode in modes:
if mode[0] == "+":
f = ch.set_mode
else:
f = ch.clear_mode
f(mode[1], mode[2])
else:
# Mode on self... XXX
pass
def _on_namreply(self, c, e):
# e.arguments[0] == "@" for secret channels,
# "*" for private channels,
# "=" for others (public channels)
# e.arguments[1] == channel
# e.arguments[2] == nick list
ch_type, channel, nick_list = e.arguments
if channel == '*':
# User is not in any visible channel
# http://tools.ietf.org/html/rfc2812#section-3.2.5
return
for nick in nick_list.split():
nick_modes = []
if nick[0] in self.connection.features.prefix:
nick_modes.append(self.connection.features.prefix[nick[0]])
nick = nick[1:]
for mode in nick_modes:
self.channels[channel].set_mode(mode, nick)
self.channels[channel].add_user(nick)
def _on_nick(self, c, e):
before = e.source.nick
after = e.target
for ch in self.channels.values():
if ch.has_user(before):
ch.change_nick(before, after)
def _on_part(self, c, e):
nick = e.source.nick
channel = e.target
if nick == c.get_nickname():
del self.channels[channel]
else:
self.channels[channel].remove_user(nick)
def _on_quit(self, c, e):
nick = e.source.nick
for ch in self.channels.values():
if ch.has_user(nick):
ch.remove_user(nick)
def die(self, msg="Bye, cruel world!"):
"""Let the bot die.
Arguments:
msg -- Quit message.
"""
self.connection.disconnect(msg)
sys.exit(0)
def disconnect(self, msg="I'll be back!"):
"""Disconnect the bot.
The bot will try to reconnect after a while.
Arguments:
msg -- Quit message.
"""
self.connection.disconnect(msg)
def get_version(self):
"""Returns the bot version.
Used when answering a CTCP VERSION request.
"""
return "Python irc.bot ({version})".format(
version=irc.client.VERSION_STRING)
def jump_server(self, msg="Changing servers"):
"""Connect to a new server, possibly disconnecting from the current.
The bot will skip to next server in the server_list each time
jump_server is called.
"""
if self.connection.is_connected():
self.connection.disconnect(msg)
self.server_list.append(self.server_list.pop(0))
self._connect()
def on_ctcp(self, c, e):
"""Default handler for ctcp events.
Replies to VERSION and PING requests and relays DCC requests
to the on_dccchat method.
"""
nick = e.source.nick
if e.arguments[0] == "VERSION":
c.ctcp_reply(nick, "VERSION " + self.get_version())
elif e.arguments[0] == "PING":
if len(e.arguments) > 1:
c.ctcp_reply(nick, "PING " + e.arguments[1])
elif e.arguments[0] == "DCC" and e.arguments[1].split(" ", 1)[0] == "CHAT":
self.on_dccchat(c, e)
def on_dccchat(self, c, e):
pass
def start(self):
"""Start the bot."""
self._connect()
super(SingleServerIRCBot, self).start()
class Channel(object):
"""A class for keeping information about an IRC channel.
This class can be improved a lot.
"""
def __init__(self):
self.userdict = IRCDict()
self.operdict = IRCDict()
self.voiceddict = IRCDict()
self.ownerdict = IRCDict()
self.halfopdict = IRCDict()
self.modes = {}
def users(self):
"""Returns an unsorted list of the channel's users."""
return self.userdict.keys()
def opers(self):
"""Returns an unsorted list of the channel's operators."""
return self.operdict.keys()
def voiced(self):
"""Returns an unsorted list of the persons that have voice
mode set in the channel."""
return self.voiceddict.keys()
def owners(self):
"""Returns an unsorted list of the channel's owners."""
return self.ownerdict.keys()
def halfops(self):
"""Returns an unsorted list of the channel's half-operators."""
return self.halfopdict.keys()
def has_user(self, nick):
"""Check whether the channel has a user."""
return nick in self.userdict
def is_oper(self, nick):
"""Check whether a user has operator status in the channel."""
return nick in self.operdict
def is_voiced(self, nick):
"""Check whether a user has voice mode set in the channel."""
return nick in self.voiceddict
def is_owner(self, nick):
"""Check whether a user has owner status in the channel."""
return nick in self.ownerdict
def is_halfop(self, nick):
"""Check whether a user has half-operator status in the channel."""
return nick in self.halfopdict
def add_user(self, nick):
self.userdict[nick] = 1
def remove_user(self, nick):
for d in self.userdict, self.operdict, self.voiceddict:
if nick in d:
del d[nick]
def change_nick(self, before, after):
self.userdict[after] = self.userdict.pop(before)
if before in self.operdict:
self.operdict[after] = self.operdict.pop(before)
if before in self.voiceddict:
self.voiceddict[after] = self.voiceddict.pop(before)
def set_userdetails(self, nick, details):
if nick in self.userdict:
self.userdict[nick] = details
def set_mode(self, mode, value=None):
"""Set mode on the channel.
Arguments:
mode -- The mode (a single-character string).
value -- Value
"""
if mode == "o":
self.operdict[value] = 1
elif mode == "v":
self.voiceddict[value] = 1
elif mode == "q":
self.ownerdict[value] = 1
elif mode == "h":
self.halfopdict[value] = 1
else:
self.modes[mode] = value
def clear_mode(self, mode, value=None):
"""Clear mode on the channel.
Arguments:
mode -- The mode (a single-character string).
value -- Value
"""
try:
if mode == "o":
del self.operdict[value]
elif mode == "v":
del self.voiceddict[value]
elif mode == "q":
del self.ownerdict[value]
elif mode == "h":
del self.halfopdict[value]
else:
del self.modes[mode]
except KeyError:
pass
def has_mode(self, mode):
return mode in self.modes
def is_moderated(self):
return self.has_mode("m")
def is_secret(self):
return self.has_mode("s")
def is_protected(self):
return self.has_mode("p")
def has_topic_lock(self):
return self.has_mode("t")
def is_invite_only(self):
return self.has_mode("i")
def has_allow_external_messages(self):
return self.has_mode("n")
def has_limit(self):
return self.has_mode("l")
def limit(self):
if self.has_limit():
return self.modes["l"]
else:
return None
def has_key(self):
return self.has_mode("k")
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29896,
29929,
29929,
29929,
29899,
29906,
29900,
29900,
29906,
29871,
529,
5813,
29958,
13,
29937,
3371,
1080,
14187,
1266,
29871,
30211,
29871,
29906,
29900,
29896,
29896,
29899,
29906,
29900,
29896,
29906,
529,
5813,
29958,
13,
13,
15945,
29908,
13,
15427,
306,
10363,
9225,
3489,
29889,
13,
13,
4013,
3883,
3743,
263,
2323,
29899,
2974,
306,
10363,
9225,
770,
393,
508,
367,
1304,
304,
13,
3539,
13682,
289,
1862,
29889,
13,
15945,
29908,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
13,
5215,
10876,
13,
13,
5215,
29871,
2076,
29889,
4645,
13,
5215,
29871,
2076,
29889,
1545,
267,
13,
3166,
869,
8977,
1053,
23292,
6530,
919,
13,
13,
1990,
5656,
10299,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
530,
306,
10363,
1923,
21992,
29889,
13,
13,
1678,
8653,
1580,
353,
5656,
10299,
877,
7640,
1495,
13,
1678,
8653,
1580,
29889,
3069,
13,
1678,
525,
7640,
29915,
13,
1678,
8653,
1580,
29889,
637,
13,
268,
29953,
29953,
29953,
29955,
13,
1678,
8653,
1580,
29889,
5630,
13,
13,
1678,
8653,
1580,
353,
5656,
10299,
877,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
742,
29871,
29953,
29953,
29929,
29955,
29892,
12801,
25711,
17013,
29958,
1495,
13,
1678,
8653,
1580,
29889,
5630,
13,
1678,
12801,
25711,
17013,
16299,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3495,
29892,
2011,
29922,
29953,
29953,
29953,
29955,
29892,
4800,
29922,
8516,
1125,
13,
4706,
1583,
29889,
3069,
353,
3495,
13,
4706,
1583,
29889,
637,
353,
2011,
13,
4706,
1583,
29889,
5630,
353,
4800,
13,
13,
1990,
16740,
6004,
8193,
21685,
327,
29898,
2076,
29889,
4645,
29889,
15427,
8193,
29907,
4032,
1125,
13,
1678,
9995,
29909,
2323,
29899,
2974,
306,
10363,
9225,
770,
29889,
13,
13,
1678,
450,
9225,
14335,
304,
337,
6915,
565,
372,
338,
766,
18045,
29889,
13,
13,
1678,
450,
9225,
14874,
5702,
310,
278,
18196,
372,
756,
8772,
29892,
278,
916,
13,
1678,
13154,
393,
526,
2198,
297,
278,
18196,
322,
607,
310,
1906,
393,
13,
1678,
505,
5455,
470,
7314,
18893,
29889,
29871,
450,
376,
9803,
29908,
338,
8126,
297,
278,
13,
1678,
1583,
29889,
305,
12629,
5352,
29892,
607,
338,
385,
23292,
6530,
919,
310,
678,
12629,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1923,
29918,
1761,
29892,
25985,
978,
29892,
8952,
29892,
1855,
978,
29892,
13,
268,
12,
12,
12,
276,
9965,
29918,
19207,
29922,
29953,
29900,
29892,
3579,
6915,
29918,
7529,
1125,
13,
4706,
9995,
23770,
363,
16740,
6004,
8193,
21685,
327,
3618,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
13,
9651,
1923,
29918,
1761,
1192,
319,
1051,
310,
5656,
10299,
3618,
470,
5291,
2701,
310,
13,
462,
965,
4128,
13907,
363,
3386,
292,
5656,
10299,
13,
462,
965,
3618,
29889,
5282,
1475,
278,
1051,
310,
12424,
278,
9225,
674,
13,
462,
965,
671,
313,
262,
1797,
467,
13,
13,
9651,
25985,
978,
1192,
450,
9225,
29915,
29879,
25985,
978,
29889,
13,
13,
9651,
1855,
978,
1192,
450,
9225,
29915,
29879,
1855,
978,
29889,
13,
13,
9651,
8265,
3559,
29918,
19207,
1192,
1128,
1472,
278,
9225,
881,
4480,
13,
462,
462,
268,
1434,
1811,
304,
337,
6915,
29889,
13,
13,
9651,
270,
617,
29918,
11958,
1953,
1192,
319,
1051,
310,
14511,
630,
29914,
16044,
287,
360,
4174,
13,
9651,
12368,
29889,
13,
13,
9651,
3579,
6915,
29918,
7529,
1192,
4128,
304,
1209,
1549,
304,
278,
4511,
13,
462,
18884,
1158,
29889,
13,
4706,
9995,
13,
13,
4706,
2428,
29898,
15771,
6004,
8193,
21685,
327,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
17255,
6915,
29918,
7529,
353,
4511,
29918,
7529,
13,
4706,
1583,
29889,
305,
12629,
353,
23292,
6530,
919,
580,
13,
4706,
1583,
29889,
2974,
29918,
1761,
353,
518,
13,
9651,
5656,
10299,
10456,
2974,
29897,
13,
18884,
565,
338,
8758,
29898,
2974,
29892,
313,
23583,
29892,
1051,
876,
13,
18884,
1683,
1923,
13,
9651,
363,
1923,
297,
1923,
29918,
1761,
13,
4706,
4514,
13,
4706,
4974,
599,
29898,
13,
9651,
338,
8758,
29898,
2974,
29892,
5656,
10299,
29897,
13,
9651,
363,
1923,
297,
1583,
29889,
2974,
29918,
1761,
13,
4706,
1723,
13,
4706,
565,
451,
8265,
3559,
29918,
19207,
470,
8265,
3559,
29918,
19207,
529,
29871,
29900,
29901,
13,
9651,
8265,
3559,
29918,
19207,
353,
29871,
29906,
3579,
29871,
29941,
29896,
13,
4706,
1583,
29889,
276,
9965,
29918,
19207,
353,
8265,
3559,
29918,
19207,
13,
13,
4706,
1583,
3032,
19254,
978,
353,
25985,
978,
13,
4706,
1583,
3032,
6370,
978,
353,
1855,
978,
13,
4706,
1583,
3032,
6786,
353,
8952,
13,
4706,
363,
474,
297,
6796,
2218,
6915,
613,
376,
7122,
613,
376,
29895,
860,
613,
376,
8513,
613,
13,
462,
29871,
376,
8588,
3445,
368,
613,
376,
19254,
613,
376,
1595,
613,
376,
28358,
3108,
29901,
13,
9651,
1583,
29889,
9965,
29889,
1202,
29918,
10945,
29918,
13789,
29898,
29875,
29892,
679,
5552,
29898,
1311,
29892,
11119,
265,
27508,
718,
474,
511,
13,
18884,
448,
29906,
29900,
29897,
13,
13,
1678,
822,
903,
18045,
29918,
3198,
261,
29898,
1311,
1125,
13,
4706,
9995,
29961,
16491,
29962,
15945,
29908,
13,
4706,
565,
451,
1583,
29889,
9965,
29889,
275,
29918,
18045,
7295,
13,
9651,
1583,
29889,
9965,
29889,
7978,
29918,
18829,
287,
29898,
1311,
29889,
276,
9965,
29918,
19207,
29892,
13,
462,
462,
9651,
1583,
3032,
18045,
29918,
3198,
261,
29897,
13,
9651,
1583,
29889,
29926,
3427,
29918,
2974,
580,
13,
13,
1678,
822,
903,
6915,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
2661,
370,
1674,
263,
3957,
304,
278,
1923,
472,
278,
4565,
310,
278,
1923,
29918,
1761,
29889,
13,
4706,
9995,
13,
4706,
1923,
353,
1583,
29889,
2974,
29918,
1761,
29961,
29900,
29962,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
6915,
29898,
2974,
29889,
3069,
29892,
1923,
29889,
637,
29892,
1583,
3032,
19254,
978,
29892,
13,
18884,
1923,
29889,
5630,
29892,
1583,
3032,
6786,
29892,
1583,
3032,
6370,
978,
29892,
13,
18884,
3579,
1311,
17255,
6915,
29918,
7529,
29897,
13,
4706,
5174,
29871,
2076,
29889,
4645,
29889,
6004,
5350,
2392,
29901,
13,
9651,
1209,
13,
13,
1678,
822,
903,
265,
29918,
2218,
6915,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
1583,
29889,
305,
12629,
353,
23292,
6530,
919,
580,
13,
4706,
1583,
29889,
9965,
29889,
7978,
29918,
18829,
287,
29898,
1311,
29889,
276,
9965,
29918,
19207,
29892,
13,
462,
462,
4706,
1583,
3032,
18045,
29918,
3198,
261,
29897,
13,
13,
1678,
822,
903,
265,
29918,
7122,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
521,
353,
321,
29889,
5182,
13,
4706,
25985,
353,
321,
29889,
4993,
29889,
19254,
13,
4706,
565,
25985,
1275,
274,
29889,
657,
29918,
19254,
978,
7295,
13,
9651,
1583,
29889,
305,
12629,
29961,
305,
29962,
353,
17368,
580,
13,
4706,
1583,
29889,
305,
12629,
29961,
305,
1822,
1202,
29918,
1792,
29898,
19254,
29897,
13,
13,
1678,
822,
903,
265,
29918,
29895,
860,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
25985,
353,
321,
29889,
25699,
29961,
29900,
29962,
13,
4706,
8242,
353,
321,
29889,
5182,
13,
13,
4706,
565,
25985,
1275,
274,
29889,
657,
29918,
19254,
978,
7295,
13,
9651,
628,
1583,
29889,
305,
12629,
29961,
12719,
29962,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
305,
12629,
29961,
12719,
1822,
5992,
29918,
1792,
29898,
19254,
29897,
13,
13,
1678,
822,
903,
265,
29918,
8513,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
18893,
353,
29871,
2076,
29889,
1545,
267,
29889,
5510,
29918,
12719,
29918,
1545,
267,
703,
11393,
7122,
29898,
29872,
29889,
25699,
876,
13,
4706,
260,
353,
321,
29889,
5182,
13,
4706,
565,
29871,
2076,
29889,
4645,
29889,
275,
29918,
12719,
29898,
29873,
1125,
13,
9651,
521,
353,
1583,
29889,
305,
12629,
29961,
29873,
29962,
13,
9651,
363,
4464,
297,
18893,
29901,
13,
18884,
565,
4464,
29961,
29900,
29962,
1275,
15691,
1115,
13,
462,
1678,
285,
353,
521,
29889,
842,
29918,
8513,
13,
18884,
1683,
29901,
13,
462,
1678,
285,
353,
521,
29889,
8551,
29918,
8513,
13,
18884,
285,
29898,
8513,
29961,
29896,
1402,
4464,
29961,
29906,
2314,
13,
4706,
1683,
29901,
13,
9651,
396,
21864,
373,
1583,
856,
22615,
13,
9651,
1209,
13,
13,
1678,
822,
903,
265,
29918,
8588,
3445,
368,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
396,
321,
29889,
25699,
29961,
29900,
29962,
1275,
376,
5507,
363,
7035,
18196,
29892,
13,
4706,
396,
462,
268,
376,
20605,
363,
2024,
18196,
29892,
13,
4706,
396,
462,
268,
376,
543,
363,
4045,
313,
3597,
18196,
29897,
13,
4706,
396,
321,
29889,
25699,
29961,
29896,
29962,
1275,
8242,
13,
4706,
396,
321,
29889,
25699,
29961,
29906,
29962,
1275,
25985,
1051,
13,
13,
4706,
521,
29918,
1853,
29892,
8242,
29892,
25985,
29918,
1761,
353,
321,
29889,
25699,
13,
13,
4706,
565,
8242,
1275,
525,
29930,
2396,
13,
9651,
396,
4911,
338,
451,
297,
738,
7962,
8242,
13,
9651,
396,
1732,
597,
8504,
29889,
2035,
29888,
29889,
990,
29914,
1420,
29914,
9600,
29883,
29906,
29947,
29896,
29906,
29937,
2042,
29899,
29941,
29889,
29906,
29889,
29945,
13,
9651,
736,
13,
13,
4706,
363,
25985,
297,
25985,
29918,
1761,
29889,
5451,
7295,
13,
9651,
25985,
29918,
1545,
267,
353,
5159,
13,
13,
9651,
565,
25985,
29961,
29900,
29962,
297,
1583,
29889,
9965,
29889,
22100,
29889,
13506,
29901,
13,
18884,
25985,
29918,
1545,
267,
29889,
4397,
29898,
1311,
29889,
9965,
29889,
22100,
29889,
13506,
29961,
19254,
29961,
29900,
24960,
13,
18884,
25985,
353,
25985,
29961,
29896,
17531,
13,
13,
9651,
363,
4464,
297,
25985,
29918,
1545,
267,
29901,
13,
18884,
1583,
29889,
305,
12629,
29961,
12719,
1822,
842,
29918,
8513,
29898,
8513,
29892,
25985,
29897,
13,
13,
9651,
1583,
29889,
305,
12629,
29961,
12719,
1822,
1202,
29918,
1792,
29898,
19254,
29897,
13,
13,
1678,
822,
903,
265,
29918,
19254,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
1434,
353,
321,
29889,
4993,
29889,
19254,
13,
4706,
1156,
353,
321,
29889,
5182,
13,
4706,
363,
521,
297,
1583,
29889,
305,
12629,
29889,
5975,
7295,
13,
9651,
565,
521,
29889,
5349,
29918,
1792,
29898,
11083,
1125,
13,
18884,
521,
29889,
3167,
29918,
19254,
29898,
11083,
29892,
1156,
29897,
13,
13,
1678,
822,
903,
265,
29918,
1595,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
25985,
353,
321,
29889,
4993,
29889,
19254,
13,
4706,
8242,
353,
321,
29889,
5182,
13,
13,
4706,
565,
25985,
1275,
274,
29889,
657,
29918,
19254,
978,
7295,
13,
9651,
628,
1583,
29889,
305,
12629,
29961,
12719,
29962,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
305,
12629,
29961,
12719,
1822,
5992,
29918,
1792,
29898,
19254,
29897,
13,
13,
1678,
822,
903,
265,
29918,
28358,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
25985,
353,
321,
29889,
4993,
29889,
19254,
13,
4706,
363,
521,
297,
1583,
29889,
305,
12629,
29889,
5975,
7295,
13,
9651,
565,
521,
29889,
5349,
29918,
1792,
29898,
19254,
1125,
13,
18884,
521,
29889,
5992,
29918,
1792,
29898,
19254,
29897,
13,
13,
1678,
822,
762,
29898,
1311,
29892,
10191,
543,
2059,
29872,
29892,
24116,
3186,
3850,
1125,
13,
4706,
9995,
12024,
278,
9225,
762,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
13,
9651,
10191,
1192,
751,
277,
2643,
29889,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
9965,
29889,
2218,
6915,
29898,
7645,
29897,
13,
4706,
10876,
29889,
13322,
29898,
29900,
29897,
13,
13,
1678,
822,
766,
6915,
29898,
1311,
29892,
10191,
543,
29902,
29915,
645,
367,
1250,
3850,
1125,
13,
4706,
9995,
4205,
6915,
278,
9225,
29889,
13,
13,
4706,
450,
9225,
674,
1018,
304,
337,
6915,
1156,
263,
1550,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
13,
9651,
10191,
1192,
751,
277,
2643,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
9965,
29889,
2218,
6915,
29898,
7645,
29897,
13,
13,
1678,
822,
679,
29918,
3259,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
278,
9225,
1873,
29889,
13,
13,
4706,
501,
8485,
746,
22862,
263,
26637,
6271,
478,
1001,
13381,
2009,
29889,
13,
4706,
9995,
13,
4706,
736,
376,
11980,
29871,
2076,
29889,
7451,
21313,
3259,
1800,
1642,
4830,
29898,
13,
9651,
1873,
29922,
2076,
29889,
4645,
29889,
16358,
29918,
20785,
29897,
13,
13,
1678,
822,
12500,
29918,
2974,
29898,
1311,
29892,
10191,
543,
1451,
9776,
12424,
29908,
1125,
13,
4706,
9995,
17918,
304,
263,
716,
1923,
29892,
10075,
766,
6915,
292,
515,
278,
1857,
29889,
13,
13,
4706,
450,
9225,
674,
14383,
304,
2446,
1923,
297,
278,
1923,
29918,
1761,
1269,
931,
13,
4706,
12500,
29918,
2974,
338,
2000,
29889,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
9965,
29889,
275,
29918,
18045,
7295,
13,
9651,
1583,
29889,
9965,
29889,
2218,
6915,
29898,
7645,
29897,
13,
13,
4706,
1583,
29889,
2974,
29918,
1761,
29889,
4397,
29898,
1311,
29889,
2974,
29918,
1761,
29889,
7323,
29898,
29900,
876,
13,
4706,
1583,
3032,
6915,
580,
13,
13,
1678,
822,
373,
29918,
312,
6814,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
9995,
4592,
7834,
363,
274,
23981,
4959,
29889,
13,
13,
4706,
10088,
3687,
304,
478,
1001,
13381,
322,
349,
4214,
7274,
322,
1104,
1036,
360,
4174,
7274,
13,
4706,
304,
278,
373,
29918,
29881,
617,
13496,
1158,
29889,
13,
4706,
9995,
13,
4706,
25985,
353,
321,
29889,
4993,
29889,
19254,
13,
4706,
565,
321,
29889,
25699,
29961,
29900,
29962,
1275,
376,
16358,
1115,
13,
9651,
274,
29889,
312,
6814,
29918,
3445,
368,
29898,
19254,
29892,
376,
16358,
376,
718,
1583,
29889,
657,
29918,
3259,
3101,
13,
4706,
25342,
321,
29889,
25699,
29961,
29900,
29962,
1275,
376,
29925,
4214,
1115,
13,
9651,
565,
7431,
29898,
29872,
29889,
25699,
29897,
1405,
29871,
29896,
29901,
13,
18884,
274,
29889,
312,
6814,
29918,
3445,
368,
29898,
19254,
29892,
376,
29925,
4214,
376,
718,
321,
29889,
25699,
29961,
29896,
2314,
13,
4706,
25342,
321,
29889,
25699,
29961,
29900,
29962,
1275,
376,
29928,
4174,
29908,
322,
321,
29889,
25699,
29961,
29896,
1822,
5451,
703,
9162,
29871,
29896,
9601,
29900,
29962,
1275,
376,
3210,
1299,
1115,
13,
9651,
1583,
29889,
265,
29918,
29881,
617,
13496,
29898,
29883,
29892,
321,
29897,
13,
13,
1678,
822,
373,
29918,
29881,
617,
13496,
29898,
1311,
29892,
274,
29892,
321,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
1369,
29898,
1311,
1125,
13,
4706,
9995,
4763,
278,
9225,
1213,
15945,
13,
4706,
1583,
3032,
6915,
580,
13,
4706,
2428,
29898,
15771,
6004,
8193,
21685,
327,
29892,
1583,
467,
2962,
580,
13,
13,
13,
1990,
17368,
29898,
3318,
1125,
13,
1678,
9995,
29909,
770,
363,
12515,
2472,
1048,
385,
306,
10363,
8242,
29889,
13,
13,
1678,
910,
770,
508,
367,
16710,
263,
3287,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
1792,
8977,
353,
23292,
6530,
919,
580,
13,
4706,
1583,
29889,
459,
2018,
919,
353,
23292,
6530,
919,
580,
13,
4706,
1583,
29889,
1365,
7612,
8977,
353,
23292,
6530,
919,
580,
13,
4706,
1583,
29889,
776,
2018,
919,
353,
23292,
6530,
919,
580,
13,
4706,
1583,
29889,
24498,
459,
8977,
353,
23292,
6530,
919,
580,
13,
4706,
1583,
29889,
1545,
267,
353,
6571,
13,
13,
1678,
822,
4160,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
385,
443,
24582,
1051,
310,
278,
8242,
29915,
29879,
4160,
1213,
15945,
13,
4706,
736,
1583,
29889,
1792,
8977,
29889,
8149,
580,
13,
13,
1678,
822,
1015,
414,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
385,
443,
24582,
1051,
310,
278,
8242,
29915,
29879,
12768,
1213,
15945,
13,
4706,
736,
1583,
29889,
459,
2018,
919,
29889,
8149,
580,
13,
13,
1678,
822,
992,
7612,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
385,
443,
24582,
1051,
310,
278,
12407,
393,
505,
7314,
13,
4706,
4464,
731,
297,
278,
8242,
1213,
15945,
13,
4706,
736,
1583,
29889,
1365,
7612,
8977,
29889,
8149,
580,
13,
13,
1678,
822,
1914,
414,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
385,
443,
24582,
1051,
310,
278,
8242,
29915,
29879,
1914,
414,
1213,
15945,
13,
4706,
736,
1583,
29889,
776,
2018,
919,
29889,
8149,
580,
13,
13,
1678,
822,
4203,
3554,
29898,
1311,
1125,
13,
4706,
9995,
11609,
29879,
385,
443,
24582,
1051,
310,
278,
8242,
29915,
29879,
4203,
29899,
3372,
4097,
1213,
15945,
13,
4706,
736,
1583,
29889,
24498,
459,
8977,
29889,
8149,
580,
13,
13,
1678,
822,
756,
29918,
1792,
29898,
1311,
29892,
25985,
1125,
13,
4706,
9995,
5596,
3692,
278,
8242,
756,
263,
1404,
1213,
15945,
13,
4706,
736,
25985,
297,
1583,
29889,
1792,
8977,
13,
13,
1678,
822,
338,
29918,
3372,
29898,
1311,
29892,
25985,
1125,
13,
4706,
9995,
5596,
3692,
263,
1404,
756,
5455,
4660,
297,
278,
8242,
1213,
15945,
13,
4706,
736,
25985,
297,
1583,
29889,
459,
2018,
919,
13,
13,
1678,
822,
338,
29918,
1365,
7612,
29898,
1311,
29892,
25985,
1125,
13,
4706,
9995,
5596,
3692,
263,
1404,
756,
7314,
4464,
731,
297,
278,
8242,
1213,
15945,
13,
4706,
736,
25985,
297,
1583,
29889,
1365,
7612,
8977,
13,
13,
1678,
822,
338,
29918,
20348,
29898,
1311,
29892,
25985,
1125,
13,
4706,
9995,
5596,
3692,
263,
1404,
756,
12271,
4660,
297,
278,
8242,
1213,
15945,
13,
4706,
736,
25985,
297,
1583,
29889,
776,
2018,
919,
13,
13,
1678,
822,
338,
29918,
24498,
459,
29898,
1311,
29892,
25985,
1125,
13,
4706,
9995,
5596,
3692,
263,
1404,
756,
4203,
29899,
6891,
4660,
297,
278,
8242,
1213,
15945,
13,
4706,
736,
25985,
297,
1583,
29889,
24498,
459,
8977,
13,
13,
1678,
822,
788,
29918,
1792,
29898,
1311,
29892,
25985,
1125,
13,
4706,
1583,
29889,
1792,
8977,
29961,
19254,
29962,
353,
29871,
29896,
13,
13,
1678,
822,
3349,
29918,
1792,
29898,
1311,
29892,
25985,
1125,
13,
4706,
363,
270,
297,
1583,
29889,
1792,
8977,
29892,
1583,
29889,
459,
2018,
919,
29892,
1583,
29889,
1365,
7612,
8977,
29901,
13,
9651,
565,
25985,
297,
270,
29901,
13,
18884,
628,
270,
29961,
19254,
29962,
13,
13,
1678,
822,
1735,
29918,
19254,
29898,
1311,
29892,
1434,
29892,
1156,
1125,
13,
4706,
1583,
29889,
1792,
8977,
29961,
7045,
29962,
353,
1583,
29889,
1792,
8977,
29889,
7323,
29898,
11083,
29897,
13,
4706,
565,
1434,
297,
1583,
29889,
459,
2018,
919,
29901,
13,
9651,
1583,
29889,
459,
2018,
919,
29961,
7045,
29962,
353,
1583,
29889,
459,
2018,
919,
29889,
7323,
29898,
11083,
29897,
13,
4706,
565,
1434,
297,
1583,
29889,
1365,
7612,
8977,
29901,
13,
9651,
1583,
29889,
1365,
7612,
8977,
29961,
7045,
29962,
353,
1583,
29889,
1365,
7612,
8977,
29889,
7323,
29898,
11083,
29897,
13,
13,
1678,
822,
731,
29918,
1792,
14144,
29898,
1311,
29892,
25985,
29892,
4902,
1125,
13,
4706,
565,
25985,
297,
1583,
29889,
1792,
8977,
29901,
13,
9651,
1583,
29889,
1792,
8977,
29961,
19254,
29962,
353,
4902,
13,
13,
1678,
822,
731,
29918,
8513,
29898,
1311,
29892,
4464,
29892,
995,
29922,
8516,
1125,
13,
4706,
9995,
2697,
4464,
373,
278,
8242,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
13,
9651,
4464,
1192,
450,
4464,
313,
29874,
2323,
29899,
18609,
1347,
467,
13,
13,
9651,
995,
1192,
7865,
13,
4706,
9995,
13,
4706,
565,
4464,
1275,
376,
29877,
1115,
13,
9651,
1583,
29889,
459,
2018,
919,
29961,
1767,
29962,
353,
29871,
29896,
13,
4706,
25342,
4464,
1275,
376,
29894,
1115,
13,
9651,
1583,
29889,
1365,
7612,
8977,
29961,
1767,
29962,
353,
29871,
29896,
13,
4706,
25342,
4464,
1275,
376,
29939,
1115,
13,
9651,
1583,
29889,
776,
2018,
919,
29961,
1767,
29962,
353,
29871,
29896,
13,
4706,
25342,
4464,
1275,
376,
29882,
1115,
13,
9651,
1583,
29889,
24498,
459,
8977,
29961,
1767,
29962,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1545,
267,
29961,
8513,
29962,
353,
995,
13,
13,
1678,
822,
2821,
29918,
8513,
29898,
1311,
29892,
4464,
29892,
995,
29922,
8516,
1125,
13,
4706,
9995,
18759,
4464,
373,
278,
8242,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
13,
9651,
4464,
1192,
450,
4464,
313,
29874,
2323,
29899,
18609,
1347,
467,
13,
13,
9651,
995,
1192,
7865,
13,
4706,
9995,
13,
4706,
1018,
29901,
13,
9651,
565,
4464,
1275,
376,
29877,
1115,
13,
18884,
628,
1583,
29889,
459,
2018,
919,
29961,
1767,
29962,
13,
9651,
25342,
4464,
1275,
376,
29894,
1115,
13,
18884,
628,
1583,
29889,
1365,
7612,
8977,
29961,
1767,
29962,
13,
9651,
25342,
4464,
1275,
376,
29939,
1115,
13,
18884,
628,
1583,
29889,
776,
2018,
919,
29961,
1767,
29962,
13,
9651,
25342,
4464,
1275,
376,
29882,
1115,
13,
18884,
628,
1583,
29889,
24498,
459,
8977,
29961,
1767,
29962,
13,
9651,
1683,
29901,
13,
18884,
628,
1583,
29889,
1545,
267,
29961,
8513,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
1209,
13,
13,
1678,
822,
756,
29918,
8513,
29898,
1311,
29892,
4464,
1125,
13,
4706,
736,
4464,
297,
1583,
29889,
1545,
267,
13,
13,
1678,
822,
338,
29918,
1545,
261,
630,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29885,
1159,
13,
13,
1678,
822,
338,
29918,
19024,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29879,
1159,
13,
13,
1678,
822,
338,
29918,
24681,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29886,
1159,
13,
13,
1678,
822,
756,
29918,
13010,
29918,
908,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29873,
1159,
13,
13,
1678,
822,
338,
29918,
11569,
568,
29918,
6194,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29875,
1159,
13,
13,
1678,
822,
756,
29918,
9536,
29918,
23176,
29918,
19158,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29876,
1159,
13,
13,
1678,
822,
756,
29918,
13400,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29880,
1159,
13,
13,
1678,
822,
4046,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
5349,
29918,
13400,
7295,
13,
9651,
736,
1583,
29889,
1545,
267,
3366,
29880,
3108,
13,
4706,
1683,
29901,
13,
9651,
736,
6213,
13,
13,
1678,
822,
756,
29918,
1989,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
5349,
29918,
8513,
703,
29895,
1159,
13,
2
] |
schema/test_connection.py | ramrod-project/database-brain | 0 | 166709 | <filename>schema/test_connection.py<gh_stars>0
"""
Pytest file for the connection wrapper
"""
from os import environ
from pytest import fixture, raises
import docker
from .brain import connect, r
from .brain.connection import DefaultConnection, BrainNotReady
CLIENT = docker.from_env()
@fixture(scope='module')
def rethink():
try:
tag = environ.get("TRAVIS_BRANCH", "dev").replace("master", "latest")
except KeyError:
tag = "latest"
container_name = "brainmoduletest"
CLIENT.containers.run(
"ramrodpcp/database-brain:{}".format(tag),
name=container_name,
detach=True,
ports={"28015/tcp": 28015},
remove=True
)
yield True
# Teardown for module tests
containers = CLIENT.containers.list()
for container in containers:
if container.name == container_name:
container.stop()
break
def test_brain_interface(rethink):
return connect()
def test_brain_interface_with_host(rethink):
import rethinkdb
return connect("localhost", rethinkdb.DEFAULT_PORT)
def test_direct_interface(rethink):
r.connect()
if __name__ == "__main__":
a = rethink()
c = test_brain_interface(a.__next__())
try:
a.__next__()
except StopIteration:
pass
| [
1,
529,
9507,
29958,
11010,
29914,
1688,
29918,
9965,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
19737,
1688,
934,
363,
278,
3957,
14476,
13,
15945,
29908,
13,
13,
3166,
2897,
1053,
12471,
13,
3166,
11451,
1688,
1053,
5713,
15546,
29892,
1153,
4637,
13,
5215,
10346,
13,
13,
3166,
869,
2634,
262,
1053,
4511,
29892,
364,
13,
3166,
869,
2634,
262,
29889,
9965,
1053,
13109,
5350,
29892,
5032,
262,
3664,
28181,
13,
27205,
3919,
353,
10346,
29889,
3166,
29918,
6272,
580,
13,
13,
13,
29992,
7241,
15546,
29898,
6078,
2433,
5453,
1495,
13,
1753,
337,
386,
682,
7295,
13,
1678,
1018,
29901,
13,
4706,
4055,
353,
12471,
29889,
657,
703,
29911,
4717,
28607,
29918,
15176,
2190,
3210,
613,
376,
3359,
2564,
6506,
703,
6207,
613,
376,
12333,
1159,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
4055,
353,
376,
12333,
29908,
13,
1678,
5639,
29918,
978,
353,
376,
2634,
262,
1545,
29884,
1026,
342,
29908,
13,
1678,
24492,
3919,
29889,
1285,
475,
414,
29889,
3389,
29898,
13,
4706,
376,
2572,
5964,
6739,
29886,
29914,
9803,
29899,
2634,
262,
29901,
8875,
1642,
4830,
29898,
4039,
511,
13,
4706,
1024,
29922,
7611,
29918,
978,
29892,
13,
4706,
1439,
496,
29922,
5574,
29892,
13,
4706,
16169,
3790,
29908,
29906,
29947,
29900,
29896,
29945,
29914,
23981,
1115,
29871,
29906,
29947,
29900,
29896,
29945,
1118,
13,
4706,
3349,
29922,
5574,
13,
1678,
1723,
13,
1678,
7709,
5852,
13,
1678,
396,
1920,
538,
776,
363,
3883,
6987,
13,
1678,
22637,
353,
24492,
3919,
29889,
1285,
475,
414,
29889,
1761,
580,
13,
1678,
363,
5639,
297,
22637,
29901,
13,
4706,
565,
5639,
29889,
978,
1275,
5639,
29918,
978,
29901,
13,
9651,
5639,
29889,
9847,
580,
13,
9651,
2867,
13,
13,
13,
13,
1753,
1243,
29918,
2634,
262,
29918,
13248,
29898,
276,
386,
682,
1125,
13,
1678,
736,
4511,
580,
13,
13,
1753,
1243,
29918,
2634,
262,
29918,
13248,
29918,
2541,
29918,
3069,
29898,
276,
386,
682,
1125,
13,
1678,
1053,
337,
386,
682,
2585,
13,
1678,
736,
4511,
703,
7640,
613,
337,
386,
682,
2585,
29889,
23397,
29918,
15082,
29897,
13,
13,
13,
1753,
1243,
29918,
11851,
29918,
13248,
29898,
276,
386,
682,
1125,
13,
1678,
364,
29889,
6915,
580,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
263,
353,
337,
386,
682,
580,
13,
1678,
274,
353,
1243,
29918,
2634,
262,
29918,
13248,
29898,
29874,
17255,
4622,
1649,
3101,
13,
1678,
1018,
29901,
13,
4706,
263,
17255,
4622,
1649,
580,
13,
1678,
5174,
22303,
13463,
362,
29901,
13,
4706,
1209,
13,
2
] |
Main/migrations/0072_auto_20210506_0016.py | Muhammet-Yildiz/Ecommerce_Website-HepsiOrada | 10 | 8383 | # Generated by Django 3.1.4 on 2021-05-05 21:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Main', '0071_auto_20210506_0004'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='chooseColor',
),
migrations.RemoveField(
model_name='product',
name='chooseSize',
),
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29941,
29889,
29896,
29889,
29946,
373,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29945,
29899,
29900,
29945,
29871,
29906,
29896,
29901,
29896,
29953,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
6330,
742,
525,
29900,
29900,
29955,
29896,
29918,
6921,
29918,
29906,
29900,
29906,
29896,
29900,
29945,
29900,
29953,
29918,
29900,
29900,
29900,
29946,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
15941,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
4704,
742,
13,
9651,
1024,
2433,
21803,
3306,
742,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
15941,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
4704,
742,
13,
9651,
1024,
2433,
21803,
3505,
742,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
tools/c7n_mailer/tests/common.py | gowthamsubbu/cloud-custodian | 0 | 131359 | <filename>tools/c7n_mailer/tests/common.py<gh_stars>0
# Copyright 2017 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import fakeredis
import logging
from c7n_mailer.ldap_lookup import LdapLookup, Redis
from ldap3 import Server, Connection, MOCK_SYNC
from ldap3.strategy import mockBase
logger = logging.getLogger('custodian.mailer')
PETER = (
'uid=peter,cn=users,dc=initech,dc=com',
{
'uid': ['peter'],
'manager': 'uid=bill_lumbergh,cn=users,dc=initech,dc=com',
'mail': '<EMAIL>',
'displayName': 'Peter',
'objectClass': 'person'
}
)
BILL = (
'uid=bill_lumbergh,cn=users,dc=initech,dc=com',
{
'uid': ['bill_lumbergh'],
'mail': '<EMAIL>',
'displayName': '<NAME>',
'objectClass': 'person'
}
)
MAILER_CONFIG = {
'smtp_port': 25,
'from_address': '<EMAIL>',
'contact_tags': ['OwnerEmail', 'SupportEmail'],
'queue_url': 'https://sqs.us-east-1.amazonaws.com/xxxx/cloudcustodian-mailer',
'region': 'us-east-1',
'ldap_uri': 'ldap.initech.com',
'smtp_server': 'smtp.inittech.com',
'cache_engine': 'sqlite',
'role': 'arn:aws:iam::xxxx:role/cloudcustodian-mailer',
'ldap_uid_tags': ['CreatorName', 'Owner'],
}
RESOURCE_1 = {
'AvailabilityZone': 'us-east-1a',
'Attachments': [],
'Tags': [
{
'Value': '<EMAIL>',
'Key': 'SupportEmail'
},
{
'Value': 'peter',
'Key': 'CreatorName'
}
],
'VolumeId': 'vol-01a0e6ea6b89f0099'
}
RESOURCE_2 = {
'AvailabilityZone': 'us-east-1c',
'Attachments': [],
'Tags': [
{
'Value': '<EMAIL>',
'Key': 'SupportEmail'
},
{
'Value': 'peter',
'Key': 'CreatorName'
}
],
'VolumeId': 'vol-21a0e7ea9b19f0043',
'Size': 8
}
SQS_MESSAGE_1 = {
'account': 'core-services-dev',
'account_id': '000000000000',
'region': 'us-east-1',
'action': {
'to': ['resource-owner', 'ldap_uid_tags'],
'email_ldap_username_manager': True,
'template': '',
'priority_header': '1',
'type': 'notify',
'transport': {'queue': 'xxx', 'type': 'sqs'},
'subject': '{{ account }} AWS EBS Volumes will be DELETED in 15 DAYS!'
},
'policy': {
'filters': [{'Attachments': []}, {'tag:maid_status': 'absent'}],
'resource': 'ebs',
'actions': [
{
'type': 'mark-for-op',
'days': 15,
'op': 'delete'
},
{
'to': ['resource-owner', 'ldap_uid_tags'],
'email_ldap_username_manager': True,
'template': '',
'priority_header': '1',
'type': 'notify',
'subject': 'EBS Volumes will be DELETED in 15 DAYS!'
}
],
'comments': 'We are deleting your EBS volumes.',
'name': 'ebs-mark-unattached-deletion'
},
'event': None,
'resources': [RESOURCE_1]
}
SQS_MESSAGE_2 = {
'account': 'core-services-dev',
'account_id': '000000000000',
'region': 'us-east-1',
'action': {
'type': 'notify',
'to': ['datadog://?metric_name=EBS_volume.available.size']
},
'policy': {
'filters': [{'Attachments': []}, {'tag:maid_status': 'absent'}],
'resource': 'ebs',
'actions': [
{
'type': 'mark-for-op',
'days': 15,
'op': 'delete'
},
{
'type': 'notify',
'to': ['datadog://?metric_name=EBS_volume.available.size']
}
],
'comments': 'We are deleting your EBS volumes.',
'name': 'ebs-mark-unattached-deletion'
},
'event': None,
'resources': [RESOURCE_1, RESOURCE_2]
}
SQS_MESSAGE_3 = {
'account': 'core-services-dev',
'account_id': '000000000000',
'region': 'us-east-1',
'action': {
'type': 'notify',
'to': ['datadog://?metric_name=EBS_volume.available.size&metric_value_tag=Size']
},
'policy': {
'filters': [{'Attachments': []}, {'tag:maid_status': 'absent'}],
'resource': 'ebs',
'actions': [
{
'type': 'mark-for-op',
'days': 15,
'op': 'delete'
},
{
'type': 'notify',
'to': ['datadog://?metric_name=EBS_volume.available.size&metric_value_tag=Size']
}
],
'comments': 'We are deleting your EBS volumes.',
'name': 'ebs-mark-unattached-deletion'
},
'event': None,
'resources': [RESOURCE_2]
}
# Monkey-patch ldap3 to work around a bytes/text handling bug.
_safe_rdn = mockBase.safe_rdn
def safe_rdn(*a, **kw):
return [(k, mockBase.to_raw(v)) for k, v in _safe_rdn(*a, **kw)]
mockBase.safe_rdn = safe_rdn
def get_fake_ldap_connection():
server = Server('my_fake_server')
connection = Connection(
server,
client_strategy=MOCK_SYNC
)
connection.bind()
connection.strategy.add_entry(PETER[0], PETER[1])
connection.strategy.add_entry(BILL[0], BILL[1])
return connection
def get_ldap_lookup(cache_engine=None, uid_regex=None):
if cache_engine == 'sqlite':
config = {
'cache_engine': 'sqlite',
'ldap_cache_file': ':memory:'
}
elif cache_engine == 'redis':
config = {
'cache_engine': 'redis',
'redis_host': 'localhost'
}
if uid_regex:
config['ldap_uid_regex'] = uid_regex
ldap_lookup = MockLdapLookup(config, logger)
michael_bolton = {
'dn': 'CN=<NAME>,cn=users,dc=initech,dc=com',
'mail': '<EMAIL>',
'manager': 'CN=Milton,cn=users,dc=initech,dc=com',
'displayName': '<NAME>'
}
milton = {
'uid': '123456',
'dn': 'CN=Milton,cn=users,dc=initech,dc=com',
'mail': '<EMAIL>',
'manager': 'CN=cthulhu,cn=users,dc=initech,dc=com',
'displayName': 'Milton'
}
bob_porter = {
'dn': 'CN=<NAME>,cn=users,dc=initech,dc=com',
'mail': '<EMAIL>',
'manager': 'CN=<NAME>,cn=users,dc=initech,dc=com',
'displayName': '<NAME>'
}
ldap_lookup.base_dn = 'cn=users,dc=initech,dc=com'
ldap_lookup.uid_key = 'uid'
ldap_lookup.attributes.append('uid')
ldap_lookup.caching.set('michael_bolton', michael_bolton)
ldap_lookup.caching.set(bob_porter['dn'], bob_porter)
ldap_lookup.caching.set('123456', milton)
ldap_lookup.caching.set(milton['dn'], milton)
return ldap_lookup
class MockLdapLookup(LdapLookup):
# allows us to instantiate this object and not need a redis daemon
def get_redis_connection(self, redis_host, redis_port):
return MockRedisLookup()
# us to instantiate this object and not have ldap3 try to connect
# to anything or raise exception in unit tests, we replace connection with a mock
def get_connection(self, ignore, these, params):
return get_fake_ldap_connection()
class MockRedisLookup(Redis):
def __init__(self):
self.connection = fakeredis.FakeStrictRedis()
| [
1,
529,
9507,
29958,
8504,
29914,
29883,
29955,
29876,
29918,
2549,
261,
29914,
21150,
29914,
9435,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29955,
25343,
3118,
15538,
29892,
365,
12182,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
5215,
285,
5790,
287,
275,
13,
5215,
12183,
13,
13,
3166,
274,
29955,
29876,
29918,
2549,
261,
29889,
430,
481,
29918,
20401,
1053,
365,
29881,
481,
14959,
786,
29892,
4367,
275,
13,
3166,
301,
29881,
481,
29941,
1053,
5656,
29892,
15160,
29892,
16999,
7077,
29918,
14816,
15868,
13,
3166,
301,
29881,
481,
29941,
29889,
710,
8963,
1053,
11187,
5160,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
877,
29883,
504,
397,
713,
29889,
2549,
261,
1495,
13,
13,
29925,
2544,
1001,
353,
313,
13,
1678,
525,
5416,
29922,
29886,
1308,
29892,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
1678,
426,
13,
4706,
525,
5416,
2396,
6024,
29886,
1308,
7464,
13,
4706,
525,
12847,
2396,
525,
5416,
29922,
29890,
453,
29918,
29880,
398,
2552,
29882,
29892,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
4706,
525,
2549,
2396,
12801,
26862,
6227,
29958,
742,
13,
4706,
525,
4990,
1170,
2396,
525,
23686,
742,
13,
4706,
525,
3318,
2385,
2396,
525,
10532,
29915,
13,
1678,
500,
13,
29897,
13,
12809,
2208,
353,
313,
13,
1678,
525,
5416,
29922,
29890,
453,
29918,
29880,
398,
2552,
29882,
29892,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
1678,
426,
13,
4706,
525,
5416,
2396,
6024,
29890,
453,
29918,
29880,
398,
2552,
29882,
7464,
13,
4706,
525,
2549,
2396,
12801,
26862,
6227,
29958,
742,
13,
4706,
525,
4990,
1170,
2396,
12801,
5813,
29958,
742,
13,
4706,
525,
3318,
2385,
2396,
525,
10532,
29915,
13,
1678,
500,
13,
29897,
13,
13,
1529,
6227,
1001,
29918,
25903,
353,
426,
13,
1678,
525,
3844,
9392,
29918,
637,
2396,
29871,
29906,
29945,
29892,
13,
1678,
525,
3166,
29918,
7328,
2396,
12801,
26862,
6227,
29958,
742,
13,
1678,
525,
12346,
29918,
11338,
2396,
6024,
28213,
9823,
742,
525,
14039,
9823,
7464,
13,
1678,
525,
9990,
29918,
2271,
2396,
525,
991,
597,
3044,
29879,
29889,
375,
29899,
23027,
29899,
29896,
29889,
17260,
10467,
29889,
510,
29914,
14633,
29914,
9274,
29883,
504,
397,
713,
29899,
2549,
261,
742,
13,
1678,
525,
12803,
2396,
525,
375,
29899,
23027,
29899,
29896,
742,
13,
1678,
525,
430,
481,
29918,
5338,
2396,
525,
430,
481,
29889,
262,
568,
305,
29889,
510,
742,
13,
1678,
525,
3844,
9392,
29918,
2974,
2396,
525,
3844,
9392,
29889,
2344,
11345,
29889,
510,
742,
13,
1678,
525,
8173,
29918,
10599,
2396,
525,
22793,
742,
13,
1678,
525,
12154,
2396,
525,
2753,
29901,
10467,
29901,
2829,
1057,
14633,
29901,
12154,
29914,
9274,
29883,
504,
397,
713,
29899,
2549,
261,
742,
13,
1678,
525,
430,
481,
29918,
5416,
29918,
11338,
2396,
6024,
9832,
1061,
1170,
742,
525,
28213,
7464,
13,
29913,
13,
13,
1525,
27839,
4741,
29918,
29896,
353,
426,
13,
1678,
525,
12810,
737,
3097,
18482,
2396,
525,
375,
29899,
23027,
29899,
29896,
29874,
742,
13,
1678,
525,
4165,
496,
1860,
2396,
19997,
13,
1678,
525,
28089,
2396,
518,
13,
4706,
426,
13,
9651,
525,
1917,
2396,
12801,
26862,
6227,
29958,
742,
13,
9651,
525,
2558,
2396,
525,
14039,
9823,
29915,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
1917,
2396,
525,
29886,
1308,
742,
13,
9651,
525,
2558,
2396,
525,
9832,
1061,
1170,
29915,
13,
4706,
500,
13,
1678,
21251,
13,
1678,
525,
24679,
1204,
2396,
525,
1555,
29899,
29900,
29896,
29874,
29900,
29872,
29953,
11248,
29953,
29890,
29947,
29929,
29888,
29900,
29900,
29929,
29929,
29915,
13,
29913,
13,
13,
1525,
27839,
4741,
29918,
29906,
353,
426,
13,
1678,
525,
12810,
737,
3097,
18482,
2396,
525,
375,
29899,
23027,
29899,
29896,
29883,
742,
13,
1678,
525,
4165,
496,
1860,
2396,
19997,
13,
1678,
525,
28089,
2396,
518,
13,
4706,
426,
13,
9651,
525,
1917,
2396,
12801,
26862,
6227,
29958,
742,
13,
9651,
525,
2558,
2396,
525,
14039,
9823,
29915,
13,
4706,
2981,
13,
4706,
426,
13,
9651,
525,
1917,
2396,
525,
29886,
1308,
742,
13,
9651,
525,
2558,
2396,
525,
9832,
1061,
1170,
29915,
13,
4706,
500,
13,
1678,
21251,
13,
1678,
525,
24679,
1204,
2396,
525,
1555,
29899,
29906,
29896,
29874,
29900,
29872,
29955,
11248,
29929,
29890,
29896,
29929,
29888,
29900,
29900,
29946,
29941,
742,
13,
1678,
525,
3505,
2396,
29871,
29947,
13,
29913,
13,
13,
29903,
29984,
29903,
29918,
2303,
1799,
10461,
29918,
29896,
353,
426,
13,
1678,
525,
10149,
2396,
525,
3221,
29899,
9916,
29899,
3359,
742,
13,
1678,
525,
10149,
29918,
333,
2396,
525,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
742,
13,
1678,
525,
12803,
2396,
525,
375,
29899,
23027,
29899,
29896,
742,
13,
1678,
525,
2467,
2396,
426,
13,
4706,
525,
517,
2396,
6024,
10314,
29899,
20348,
742,
525,
430,
481,
29918,
5416,
29918,
11338,
7464,
13,
4706,
525,
5269,
29918,
430,
481,
29918,
6786,
29918,
12847,
2396,
5852,
29892,
13,
4706,
525,
6886,
2396,
15516,
13,
4706,
525,
29886,
21766,
29918,
6672,
2396,
525,
29896,
742,
13,
4706,
525,
1853,
2396,
525,
25140,
742,
13,
4706,
525,
27882,
2396,
11117,
9990,
2396,
525,
12353,
742,
525,
1853,
2396,
525,
3044,
29879,
16675,
13,
4706,
525,
16009,
2396,
525,
6224,
3633,
9156,
15540,
382,
9851,
3684,
9351,
674,
367,
5012,
1307,
29911,
3352,
297,
29871,
29896,
29945,
21330,
21554,
20714,
13,
1678,
2981,
13,
1678,
525,
22197,
2396,
426,
13,
4706,
525,
26705,
2396,
518,
10998,
4165,
496,
1860,
2396,
5159,
1118,
11117,
4039,
29901,
655,
333,
29918,
4882,
2396,
525,
6897,
296,
10827,
1402,
13,
4706,
525,
10314,
2396,
525,
774,
29879,
742,
13,
4706,
525,
7387,
2396,
518,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3502,
29899,
1454,
29899,
459,
742,
13,
18884,
525,
16700,
2396,
29871,
29896,
29945,
29892,
13,
18884,
525,
459,
2396,
525,
8143,
29915,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
517,
2396,
6024,
10314,
29899,
20348,
742,
525,
430,
481,
29918,
5416,
29918,
11338,
7464,
13,
18884,
525,
5269,
29918,
430,
481,
29918,
6786,
29918,
12847,
2396,
5852,
29892,
13,
18884,
525,
6886,
2396,
15516,
13,
18884,
525,
29886,
21766,
29918,
6672,
2396,
525,
29896,
742,
13,
18884,
525,
1853,
2396,
525,
25140,
742,
13,
18884,
525,
16009,
2396,
525,
29923,
9851,
3684,
9351,
674,
367,
5012,
1307,
29911,
3352,
297,
29871,
29896,
29945,
21330,
21554,
20714,
13,
9651,
500,
13,
4706,
21251,
13,
4706,
525,
21032,
2396,
525,
4806,
526,
21228,
596,
382,
9851,
18167,
29889,
742,
13,
4706,
525,
978,
2396,
525,
774,
29879,
29899,
3502,
29899,
348,
1131,
3791,
29899,
311,
1026,
291,
29915,
13,
1678,
2981,
13,
1678,
525,
3696,
2396,
6213,
29892,
13,
1678,
525,
13237,
2396,
518,
1525,
27839,
4741,
29918,
29896,
29962,
13,
29913,
13,
13,
29903,
29984,
29903,
29918,
2303,
1799,
10461,
29918,
29906,
353,
426,
13,
1678,
525,
10149,
2396,
525,
3221,
29899,
9916,
29899,
3359,
742,
13,
1678,
525,
10149,
29918,
333,
2396,
525,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
742,
13,
1678,
525,
12803,
2396,
525,
375,
29899,
23027,
29899,
29896,
742,
13,
1678,
525,
2467,
2396,
426,
13,
4706,
525,
1853,
2396,
525,
25140,
742,
13,
4706,
525,
517,
2396,
6024,
4130,
328,
468,
597,
29973,
16414,
29918,
978,
29922,
29923,
9851,
29918,
24623,
29889,
16515,
29889,
2311,
2033,
13,
1678,
2981,
13,
1678,
525,
22197,
2396,
426,
13,
4706,
525,
26705,
2396,
518,
10998,
4165,
496,
1860,
2396,
5159,
1118,
11117,
4039,
29901,
655,
333,
29918,
4882,
2396,
525,
6897,
296,
10827,
1402,
13,
4706,
525,
10314,
2396,
525,
774,
29879,
742,
13,
4706,
525,
7387,
2396,
518,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3502,
29899,
1454,
29899,
459,
742,
13,
18884,
525,
16700,
2396,
29871,
29896,
29945,
29892,
13,
18884,
525,
459,
2396,
525,
8143,
29915,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
25140,
742,
13,
18884,
525,
517,
2396,
6024,
4130,
328,
468,
597,
29973,
16414,
29918,
978,
29922,
29923,
9851,
29918,
24623,
29889,
16515,
29889,
2311,
2033,
13,
9651,
500,
13,
4706,
21251,
13,
4706,
525,
21032,
2396,
525,
4806,
526,
21228,
596,
382,
9851,
18167,
29889,
742,
13,
4706,
525,
978,
2396,
525,
774,
29879,
29899,
3502,
29899,
348,
1131,
3791,
29899,
311,
1026,
291,
29915,
13,
1678,
2981,
13,
1678,
525,
3696,
2396,
6213,
29892,
13,
1678,
525,
13237,
2396,
518,
1525,
27839,
4741,
29918,
29896,
29892,
390,
2890,
22970,
4741,
29918,
29906,
29962,
13,
29913,
13,
13,
29903,
29984,
29903,
29918,
2303,
1799,
10461,
29918,
29941,
353,
426,
13,
1678,
525,
10149,
2396,
525,
3221,
29899,
9916,
29899,
3359,
742,
13,
1678,
525,
10149,
29918,
333,
2396,
525,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
742,
13,
1678,
525,
12803,
2396,
525,
375,
29899,
23027,
29899,
29896,
742,
13,
1678,
525,
2467,
2396,
426,
13,
4706,
525,
1853,
2396,
525,
25140,
742,
13,
4706,
525,
517,
2396,
6024,
4130,
328,
468,
597,
29973,
16414,
29918,
978,
29922,
29923,
9851,
29918,
24623,
29889,
16515,
29889,
2311,
29987,
16414,
29918,
1767,
29918,
4039,
29922,
3505,
2033,
13,
1678,
2981,
13,
1678,
525,
22197,
2396,
426,
13,
4706,
525,
26705,
2396,
518,
10998,
4165,
496,
1860,
2396,
5159,
1118,
11117,
4039,
29901,
655,
333,
29918,
4882,
2396,
525,
6897,
296,
10827,
1402,
13,
4706,
525,
10314,
2396,
525,
774,
29879,
742,
13,
4706,
525,
7387,
2396,
518,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
3502,
29899,
1454,
29899,
459,
742,
13,
18884,
525,
16700,
2396,
29871,
29896,
29945,
29892,
13,
18884,
525,
459,
2396,
525,
8143,
29915,
13,
9651,
2981,
13,
9651,
426,
13,
18884,
525,
1853,
2396,
525,
25140,
742,
13,
18884,
525,
517,
2396,
6024,
4130,
328,
468,
597,
29973,
16414,
29918,
978,
29922,
29923,
9851,
29918,
24623,
29889,
16515,
29889,
2311,
29987,
16414,
29918,
1767,
29918,
4039,
29922,
3505,
2033,
13,
9651,
500,
13,
4706,
21251,
13,
4706,
525,
21032,
2396,
525,
4806,
526,
21228,
596,
382,
9851,
18167,
29889,
742,
13,
4706,
525,
978,
2396,
525,
774,
29879,
29899,
3502,
29899,
348,
1131,
3791,
29899,
311,
1026,
291,
29915,
13,
1678,
2981,
13,
1678,
525,
3696,
2396,
6213,
29892,
13,
1678,
525,
13237,
2396,
518,
1525,
27839,
4741,
29918,
29906,
29962,
13,
29913,
13,
13,
13,
29937,
2598,
1989,
29899,
5041,
301,
29881,
481,
29941,
304,
664,
2820,
263,
6262,
29914,
726,
11415,
6494,
29889,
13,
13,
29918,
11177,
29918,
29878,
5200,
353,
11187,
5160,
29889,
11177,
29918,
29878,
5200,
13,
13,
13,
1753,
9109,
29918,
29878,
5200,
10456,
29874,
29892,
3579,
11022,
1125,
13,
1678,
736,
17288,
29895,
29892,
11187,
5160,
29889,
517,
29918,
1610,
29898,
29894,
876,
363,
413,
29892,
325,
297,
903,
11177,
29918,
29878,
5200,
10456,
29874,
29892,
3579,
11022,
4638,
13,
13,
13,
17640,
5160,
29889,
11177,
29918,
29878,
5200,
353,
9109,
29918,
29878,
5200,
13,
13,
13,
1753,
679,
29918,
29888,
1296,
29918,
430,
481,
29918,
9965,
7295,
13,
1678,
1923,
353,
5656,
877,
1357,
29918,
29888,
1296,
29918,
2974,
1495,
13,
1678,
3957,
353,
15160,
29898,
13,
4706,
1923,
29892,
13,
4706,
3132,
29918,
710,
8963,
29922,
6720,
7077,
29918,
14816,
15868,
13,
1678,
1723,
13,
1678,
3957,
29889,
5355,
580,
13,
1678,
3957,
29889,
710,
8963,
29889,
1202,
29918,
8269,
29898,
29925,
2544,
1001,
29961,
29900,
1402,
349,
2544,
1001,
29961,
29896,
2314,
13,
1678,
3957,
29889,
710,
8963,
29889,
1202,
29918,
8269,
29898,
12809,
2208,
29961,
29900,
1402,
350,
24071,
29961,
29896,
2314,
13,
1678,
736,
3957,
13,
13,
13,
1753,
679,
29918,
430,
481,
29918,
20401,
29898,
8173,
29918,
10599,
29922,
8516,
29892,
318,
333,
29918,
13087,
29922,
8516,
1125,
13,
4706,
565,
7090,
29918,
10599,
1275,
525,
22793,
2396,
13,
9651,
2295,
353,
426,
13,
18884,
525,
8173,
29918,
10599,
2396,
525,
22793,
742,
13,
18884,
525,
430,
481,
29918,
8173,
29918,
1445,
2396,
525,
29901,
14834,
11283,
13,
9651,
500,
13,
4706,
25342,
7090,
29918,
10599,
1275,
525,
1127,
275,
2396,
13,
9651,
2295,
353,
426,
13,
18884,
525,
8173,
29918,
10599,
2396,
525,
1127,
275,
742,
13,
18884,
525,
1127,
275,
29918,
3069,
2396,
525,
7640,
29915,
13,
9651,
500,
13,
4706,
565,
318,
333,
29918,
13087,
29901,
13,
9651,
2295,
1839,
430,
481,
29918,
5416,
29918,
13087,
2033,
353,
318,
333,
29918,
13087,
13,
4706,
301,
29881,
481,
29918,
20401,
353,
26297,
29931,
29881,
481,
14959,
786,
29898,
2917,
29892,
17927,
29897,
13,
4706,
21488,
4271,
29918,
2095,
880,
353,
426,
13,
9651,
525,
5200,
2396,
525,
13778,
29922,
29966,
5813,
10202,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
9651,
525,
2549,
2396,
12801,
26862,
6227,
29958,
742,
13,
9651,
525,
12847,
2396,
525,
13778,
29922,
29316,
880,
29892,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
9651,
525,
4990,
1170,
2396,
12801,
5813,
16299,
13,
4706,
500,
13,
4706,
2316,
880,
353,
426,
13,
9651,
525,
5416,
2396,
525,
29896,
29906,
29941,
29946,
29945,
29953,
742,
13,
9651,
525,
5200,
2396,
525,
13778,
29922,
29316,
880,
29892,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
9651,
525,
2549,
2396,
12801,
26862,
6227,
29958,
742,
13,
9651,
525,
12847,
2396,
525,
13778,
29922,
312,
29882,
352,
6905,
29892,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
9651,
525,
4990,
1170,
2396,
525,
29316,
880,
29915,
13,
4706,
500,
13,
4706,
289,
711,
29918,
18505,
353,
426,
13,
9651,
525,
5200,
2396,
525,
13778,
29922,
29966,
5813,
10202,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
9651,
525,
2549,
2396,
12801,
26862,
6227,
29958,
742,
13,
9651,
525,
12847,
2396,
525,
13778,
29922,
29966,
5813,
10202,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
742,
13,
9651,
525,
4990,
1170,
2396,
12801,
5813,
16299,
13,
4706,
500,
13,
4706,
301,
29881,
481,
29918,
20401,
29889,
3188,
29918,
5200,
353,
525,
18038,
29922,
7193,
29892,
13891,
29922,
262,
568,
305,
29892,
13891,
29922,
510,
29915,
13,
4706,
301,
29881,
481,
29918,
20401,
29889,
5416,
29918,
1989,
353,
525,
5416,
29915,
13,
4706,
301,
29881,
481,
29918,
20401,
29889,
15697,
29889,
4397,
877,
5416,
1495,
13,
4706,
301,
29881,
481,
29918,
20401,
29889,
29883,
9733,
29889,
842,
877,
29885,
436,
4271,
29918,
2095,
880,
742,
21488,
4271,
29918,
2095,
880,
29897,
13,
4706,
301,
29881,
481,
29918,
20401,
29889,
29883,
9733,
29889,
842,
29898,
29890,
711,
29918,
18505,
1839,
5200,
7464,
289,
711,
29918,
18505,
29897,
13,
4706,
301,
29881,
481,
29918,
20401,
29889,
29883,
9733,
29889,
842,
877,
29896,
29906,
29941,
29946,
29945,
29953,
742,
2316,
880,
29897,
13,
4706,
301,
29881,
481,
29918,
20401,
29889,
29883,
9733,
29889,
842,
29898,
23853,
880,
1839,
5200,
7464,
2316,
880,
29897,
13,
4706,
736,
301,
29881,
481,
29918,
20401,
13,
13,
13,
1990,
26297,
29931,
29881,
481,
14959,
786,
29898,
29931,
29881,
481,
14959,
786,
1125,
13,
13,
1678,
396,
6511,
502,
304,
25112,
445,
1203,
322,
451,
817,
263,
29825,
1146,
9857,
13,
1678,
822,
679,
29918,
1127,
275,
29918,
9965,
29898,
1311,
29892,
29825,
29918,
3069,
29892,
29825,
29918,
637,
1125,
13,
4706,
736,
26297,
9039,
275,
14959,
786,
580,
13,
13,
1678,
396,
502,
304,
25112,
445,
1203,
322,
451,
505,
301,
29881,
481,
29941,
1018,
304,
4511,
13,
1678,
396,
304,
3099,
470,
12020,
3682,
297,
5190,
6987,
29892,
591,
5191,
3957,
411,
263,
11187,
13,
1678,
822,
679,
29918,
9965,
29898,
1311,
29892,
11455,
29892,
1438,
29892,
8636,
1125,
13,
4706,
736,
679,
29918,
29888,
1296,
29918,
430,
481,
29918,
9965,
580,
13,
13,
13,
1990,
26297,
9039,
275,
14959,
786,
29898,
9039,
275,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
9965,
353,
285,
5790,
287,
275,
29889,
29943,
1296,
5015,
919,
9039,
275,
580,
13,
2
] |
pymic/transform/threshold.py | HiLab-git/PyMIC | 147 | 22249 | <reponame>HiLab-git/PyMIC
# -*- coding: utf-8 -*-
from __future__ import print_function, division
import torch
import json
import math
import random
import numpy as np
from scipy import ndimage
from pymic.transform.abstract_transform import AbstractTransform
from pymic.util.image_process import *
class ChannelWiseThreshold(AbstractTransform):
"""Threshold the image (shape [C, D, H, W] or [C, H, W]) for each channel
"""
def __init__(self, params):
"""
channels (tuple/list/None): the list of specified channels for thresholding. Default value
is all the channels.
threshold_lower (tuple/list/None): The lower threshold values for specified channels.
threshold_upper (tuple/list/None): The uppoer threshold values for specified channels.
replace_lower (tuple/list/None): new values for pixels with intensity smaller than
threshold_lower. Default value is
replace_upper (tuple/list/None): new values for pixels with intensity larger than threshold_upper.
"""
super(ChannelWiseThreshold, self).__init__(params)
self.channlels = params['ChannelWiseThreshold_channels'.lower()]
self.threshold_lower = params['ChannelWiseThreshold_threshold_lower'.lower()]
self.threshold_upper = params['ChannelWiseThreshold_threshold_upper'.lower()]
self.replace_lower = params['ChannelWiseThreshold_replace_lower'.lower()]
self.replace_upper = params['ChannelWiseThreshold_replace_upper'.lower()]
self.inverse = params.get('ChannelWiseThreshold_inverse'.lower(), False)
def __call__(self, sample):
image= sample['image']
channels = range(image.shape[0]) if self.channlels is None else self.channlels
for i in range(len(channels)):
chn = channels[i]
if((self.threshold_lower is not None) and (self.threshold_lower[i] is not None)):
t_lower = self.threshold_lower[i]
r_lower = self.threshold_lower[i]
if((self.replace_lower is not None) and (self.replace_lower[i] is not None)):
r_lower = self.replace_lower[i]
image[chn][image[chn] < t_lower] = r_lower
if((self.threshold_upper is not None) and (self.threshold_upper[i] is not None)):
t_upper = self.threshold_upper[i]
r_upper = self.threshold_upper[i]
if((self.replace_upper is not None) and (self.replace_upper[i] is not None)):
r_upper= self.replace_upper[i]
image[chn][image[chn] > t_upper] = r_upper
sample['image'] = image
return sample
class ChannelWiseThresholdWithNormalize(AbstractTransform):
"""
Note that this can be replaced by ChannelWiseThreshold + NormalizeWithMinMax
Threshold the image (shape [C, D, H, W] or [C, H, W]) for each channel
and then normalize the image based on remaining pixels
"""
def __init__(self, params):
"""
:param threshold_lower: (tuple/list/None) The lower threshold value along each channel.
:param threshold_upper: (typle/list/None) The upper threshold value along each channel.
:param mean_std_mode: (bool) If true, nomalize the image based on mean and std values,
and pixels values outside the threshold value are replaced random number.
If false, use the min and max values for normalization.
"""
super(ChannelWiseThresholdWithNormalize, self).__init__(params)
self.threshold_lower = params['ChannelWiseThresholdWithNormalize_threshold_lower'.lower()]
self.threshold_upper = params['ChannelWiseThresholdWithNormalize_threshold_upper'.lower()]
self.mean_std_mode = params['ChannelWiseThresholdWithNormalize_mean_std_mode'.lower()]
self.inverse = params.get('ChannelWiseThresholdWithNormalize_inverse'.lower(), False)
def __call__(self, sample):
image= sample['image']
for chn in range(image.shape[0]):
v0 = self.threshold_lower[chn]
v1 = self.threshold_upper[chn]
if(self.mean_std_mode == True):
mask = np.ones_like(image[chn])
if(v0 is not None):
mask = mask * np.asarray(image[chn] > v0)
if(v1 is not None):
mask = mask * np.asarray(image[chn] < v1)
pixels = image[chn][mask > 0]
chn_mean = pixels.mean()
chn_std = pixels.std()
chn_norm = (image[chn] - chn_mean)/chn_std
chn_random = np.random.normal(0, 1, size = chn_norm.shape)
chn_norm[mask == 0] = chn_random[mask == 0]
image[chn] = chn_norm
else:
img_chn = image[chn]
if(v0 is not None):
img_chn[img_chn < v0] = v0
min_value = v0
else:
min_value = img_chn.min()
if(v1 is not None):
img_chn[img_chn > v1] = v1
max_value = img_chn.max()
else:
max_value = img_chn.max()
img_chn = (img_chn - min_value) / (max_value - min_value)
image[chn] = img_chn
sample['image'] = image
return sample | [
1,
529,
276,
1112,
420,
29958,
18567,
28632,
29899,
5559,
29914,
19737,
29924,
2965,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
29892,
8542,
13,
13,
5215,
4842,
305,
13,
5215,
4390,
13,
5215,
5844,
13,
5215,
4036,
13,
5215,
12655,
408,
7442,
13,
3166,
4560,
2272,
1053,
29871,
299,
3027,
13,
3166,
282,
962,
293,
29889,
9067,
29889,
16595,
29918,
9067,
1053,
25513,
13372,
13,
3166,
282,
962,
293,
29889,
4422,
29889,
3027,
29918,
5014,
1053,
334,
13,
13,
13,
1990,
17368,
29956,
895,
1349,
12268,
29898,
9118,
13372,
1125,
13,
1678,
9995,
1349,
12268,
278,
1967,
313,
12181,
518,
29907,
29892,
360,
29892,
379,
29892,
399,
29962,
470,
518,
29907,
29892,
379,
29892,
399,
2314,
363,
1269,
8242,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8636,
1125,
13,
4706,
9995,
13,
4706,
18196,
313,
23583,
29914,
1761,
29914,
8516,
1125,
278,
1051,
310,
6790,
18196,
363,
16897,
292,
29889,
13109,
995,
29871,
13,
9651,
338,
599,
278,
18196,
29889,
13,
4706,
16897,
29918,
13609,
313,
23583,
29914,
1761,
29914,
8516,
1125,
450,
5224,
16897,
1819,
363,
6790,
18196,
29889,
13,
4706,
16897,
29918,
21064,
313,
23583,
29914,
1761,
29914,
8516,
1125,
450,
318,
9759,
261,
16897,
1819,
363,
6790,
18196,
29889,
13,
4706,
5191,
29918,
13609,
313,
23583,
29914,
1761,
29914,
8516,
1125,
716,
1819,
363,
17036,
411,
26171,
7968,
1135,
29871,
13,
9651,
16897,
29918,
13609,
29889,
13109,
995,
338,
29871,
13,
4706,
5191,
29918,
21064,
313,
23583,
29914,
1761,
29914,
8516,
1125,
716,
1819,
363,
17036,
411,
26171,
7200,
1135,
16897,
29918,
21064,
29889,
13,
4706,
9995,
13,
4706,
2428,
29898,
13599,
29956,
895,
1349,
12268,
29892,
1583,
467,
1649,
2344,
12035,
7529,
29897,
13,
4706,
1583,
29889,
305,
812,
280,
3137,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
29918,
305,
12629,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
386,
12268,
29918,
13609,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
29918,
386,
12268,
29918,
13609,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
386,
12268,
29918,
21064,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
29918,
386,
12268,
29918,
21064,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
6506,
29918,
13609,
259,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
29918,
6506,
29918,
13609,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
6506,
29918,
21064,
259,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
29918,
6506,
29918,
21064,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
262,
3901,
353,
8636,
29889,
657,
877,
13599,
29956,
895,
1349,
12268,
29918,
262,
3901,
4286,
13609,
3285,
7700,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
4559,
1125,
13,
4706,
1967,
29922,
4559,
1839,
3027,
2033,
13,
4706,
18196,
353,
3464,
29898,
3027,
29889,
12181,
29961,
29900,
2314,
565,
1583,
29889,
305,
812,
280,
3137,
338,
6213,
1683,
1583,
29889,
305,
812,
280,
3137,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
305,
12629,
22164,
13,
9651,
521,
29876,
353,
18196,
29961,
29875,
29962,
13,
9651,
565,
3552,
1311,
29889,
386,
12268,
29918,
13609,
338,
451,
6213,
29897,
322,
313,
1311,
29889,
386,
12268,
29918,
13609,
29961,
29875,
29962,
338,
451,
6213,
22164,
13,
18884,
260,
29918,
13609,
353,
1583,
29889,
386,
12268,
29918,
13609,
29961,
29875,
29962,
13,
18884,
364,
29918,
13609,
353,
1583,
29889,
386,
12268,
29918,
13609,
29961,
29875,
29962,
13,
18884,
565,
3552,
1311,
29889,
6506,
29918,
13609,
338,
451,
6213,
29897,
322,
313,
1311,
29889,
6506,
29918,
13609,
29961,
29875,
29962,
338,
451,
6213,
22164,
13,
462,
1678,
364,
29918,
13609,
353,
1583,
29889,
6506,
29918,
13609,
29961,
29875,
29962,
13,
18884,
1967,
29961,
3049,
3816,
3027,
29961,
3049,
29962,
529,
260,
29918,
13609,
29962,
353,
364,
29918,
13609,
13,
632,
13,
9651,
565,
3552,
1311,
29889,
386,
12268,
29918,
21064,
338,
451,
6213,
29897,
322,
313,
1311,
29889,
386,
12268,
29918,
21064,
29961,
29875,
29962,
338,
451,
6213,
22164,
13,
18884,
260,
29918,
21064,
353,
1583,
29889,
386,
12268,
29918,
21064,
29961,
29875,
29962,
13,
18884,
364,
29918,
21064,
353,
1583,
29889,
386,
12268,
29918,
21064,
29961,
29875,
29962,
13,
18884,
565,
3552,
1311,
29889,
6506,
29918,
21064,
338,
451,
6213,
29897,
322,
313,
1311,
29889,
6506,
29918,
21064,
29961,
29875,
29962,
338,
451,
6213,
22164,
13,
462,
1678,
364,
29918,
21064,
29922,
1583,
29889,
6506,
29918,
21064,
29961,
29875,
29962,
13,
18884,
1967,
29961,
3049,
3816,
3027,
29961,
3049,
29962,
1405,
260,
29918,
21064,
29962,
353,
364,
29918,
21064,
13,
4706,
4559,
1839,
3027,
2033,
353,
1967,
13,
4706,
736,
4559,
13,
13,
1990,
17368,
29956,
895,
1349,
12268,
3047,
19077,
675,
29898,
9118,
13372,
1125,
13,
1678,
9995,
13,
1678,
3940,
393,
445,
508,
367,
8611,
491,
17368,
29956,
895,
1349,
12268,
718,
21981,
675,
3047,
8140,
7976,
13,
268,
13,
1678,
498,
12268,
278,
1967,
313,
12181,
518,
29907,
29892,
360,
29892,
379,
29892,
399,
29962,
470,
518,
29907,
29892,
379,
29892,
399,
2314,
363,
1269,
8242,
13,
539,
322,
769,
4226,
675,
278,
1967,
2729,
373,
9886,
17036,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8636,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
16897,
29918,
13609,
29901,
313,
23583,
29914,
1761,
29914,
8516,
29897,
450,
5224,
16897,
995,
3412,
1269,
8242,
29889,
13,
4706,
584,
3207,
16897,
29918,
21064,
29901,
313,
1017,
552,
29914,
1761,
29914,
8516,
29897,
450,
7568,
16897,
995,
3412,
1269,
8242,
29889,
13,
4706,
584,
3207,
2099,
29918,
4172,
29918,
8513,
29901,
313,
11227,
29897,
960,
1565,
29892,
2245,
284,
675,
278,
1967,
2729,
373,
2099,
322,
3659,
1819,
29892,
13,
9651,
322,
17036,
1819,
5377,
278,
16897,
995,
526,
8611,
4036,
1353,
29889,
13,
9651,
960,
2089,
29892,
671,
278,
1375,
322,
4236,
1819,
363,
4226,
2133,
29889,
13,
4706,
9995,
13,
4706,
2428,
29898,
13599,
29956,
895,
1349,
12268,
3047,
19077,
675,
29892,
1583,
467,
1649,
2344,
12035,
7529,
29897,
13,
4706,
1583,
29889,
386,
12268,
29918,
13609,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
3047,
19077,
675,
29918,
386,
12268,
29918,
13609,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
386,
12268,
29918,
21064,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
3047,
19077,
675,
29918,
386,
12268,
29918,
21064,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
12676,
29918,
4172,
29918,
8513,
259,
353,
8636,
1839,
13599,
29956,
895,
1349,
12268,
3047,
19077,
675,
29918,
12676,
29918,
4172,
29918,
8513,
4286,
13609,
580,
29962,
13,
4706,
1583,
29889,
262,
3901,
353,
8636,
29889,
657,
877,
13599,
29956,
895,
1349,
12268,
3047,
19077,
675,
29918,
262,
3901,
4286,
13609,
3285,
7700,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
4559,
1125,
13,
4706,
1967,
29922,
4559,
1839,
3027,
2033,
13,
4706,
363,
521,
29876,
297,
3464,
29898,
3027,
29889,
12181,
29961,
29900,
29962,
1125,
13,
9651,
325,
29900,
353,
1583,
29889,
386,
12268,
29918,
13609,
29961,
3049,
29962,
13,
9651,
325,
29896,
353,
1583,
29889,
386,
12268,
29918,
21064,
29961,
3049,
29962,
13,
9651,
565,
29898,
1311,
29889,
12676,
29918,
4172,
29918,
8513,
1275,
5852,
1125,
13,
18884,
11105,
353,
7442,
29889,
2873,
29918,
4561,
29898,
3027,
29961,
3049,
2314,
13,
18884,
565,
29898,
29894,
29900,
338,
451,
6213,
1125,
13,
462,
1678,
11105,
353,
11105,
334,
7442,
29889,
294,
2378,
29898,
3027,
29961,
3049,
29962,
1405,
325,
29900,
29897,
13,
18884,
565,
29898,
29894,
29896,
338,
451,
6213,
1125,
13,
462,
1678,
11105,
353,
11105,
334,
7442,
29889,
294,
2378,
29898,
3027,
29961,
3049,
29962,
529,
325,
29896,
29897,
13,
18884,
17036,
259,
353,
1967,
29961,
3049,
3816,
13168,
1405,
29871,
29900,
29962,
13,
18884,
521,
29876,
29918,
12676,
353,
17036,
29889,
12676,
580,
13,
18884,
521,
29876,
29918,
4172,
29871,
353,
17036,
29889,
4172,
580,
13,
18884,
521,
29876,
29918,
12324,
353,
313,
3027,
29961,
3049,
29962,
448,
521,
29876,
29918,
12676,
6802,
3049,
29918,
4172,
13,
18884,
521,
29876,
29918,
8172,
353,
7442,
29889,
8172,
29889,
8945,
29898,
29900,
29892,
29871,
29896,
29892,
2159,
353,
521,
29876,
29918,
12324,
29889,
12181,
29897,
13,
18884,
521,
29876,
29918,
12324,
29961,
13168,
1275,
29871,
29900,
29962,
353,
521,
29876,
29918,
8172,
29961,
13168,
1275,
29871,
29900,
29962,
13,
18884,
1967,
29961,
3049,
29962,
353,
521,
29876,
29918,
12324,
13,
9651,
1683,
29901,
13,
18884,
10153,
29918,
3049,
353,
1967,
29961,
3049,
29962,
13,
18884,
565,
29898,
29894,
29900,
338,
451,
6213,
1125,
13,
462,
1678,
10153,
29918,
3049,
29961,
2492,
29918,
3049,
529,
325,
29900,
29962,
353,
325,
29900,
13,
462,
1678,
1375,
29918,
1767,
353,
325,
29900,
29871,
13,
18884,
1683,
29901,
13,
462,
1678,
1375,
29918,
1767,
353,
10153,
29918,
3049,
29889,
1195,
580,
13,
18884,
565,
29898,
29894,
29896,
338,
451,
6213,
1125,
13,
462,
1678,
10153,
29918,
3049,
29961,
2492,
29918,
3049,
1405,
325,
29896,
29962,
353,
325,
29896,
29871,
13,
462,
1678,
4236,
29918,
1767,
353,
10153,
29918,
3049,
29889,
3317,
580,
29871,
13,
18884,
1683,
29901,
13,
462,
1678,
4236,
29918,
1767,
353,
10153,
29918,
3049,
29889,
3317,
580,
29871,
13,
18884,
10153,
29918,
3049,
353,
313,
2492,
29918,
3049,
448,
1375,
29918,
1767,
29897,
847,
313,
3317,
29918,
1767,
448,
1375,
29918,
1767,
29897,
13,
18884,
1967,
29961,
3049,
29962,
353,
10153,
29918,
3049,
13,
4706,
4559,
1839,
3027,
2033,
353,
1967,
13,
4706,
736,
4559,
2
] |
Node_Utility.py | SBCV/PythonBlenderUtility | 1 | 74203 |
import bpy
import os
from collections import defaultdict
from Utility.Logging_Extension import logger
# http://blender.stackexchange.com/questions/8936/does-switching-from-blender-render-to-cycles-mess-things-up
# * All matierals in cycles use nodes (even if you set up the material in the Properties panel, it will create
# nodes in the node editor).
# * Since BI materials don't use nodes by default, when you switch to cycles from BI there won't be any BI
# nodes in the node tree, yet nodes will be enabled. This will make the material render as transparent.
# One must switch / toggle between use_shader nodes
# Remark:
# info pannel in cycles:
# the info pannel in cycles misses a lot of different commands
# http://blender.stackexchange.com/questions/18020/print-all-commands-in-the-info-view
# https://www.blender.org/api/blender_python_api_2_72_release/info_api_reference.html#operators
# Most key-strokes and buttons in Blender call an operator which is also exposed to python via bpy.ops,
# To see the Python equivalent hover your mouse over the button and see the tool-tip,
# eg Python: bpy.ops.render.render(), If there is no tool-tip or the Python: line is missing then this button
# is not using an operator and can't be accessed from Python.
# If you want to use this in a script you can press Control-C while your mouse is over the button to copy it to the
# clipboard.
# =================
# alternative approach (not tested yet)
# http://blender.stackexchange.com/questions/364/how-do-i-convert-materials-from-blender-internal-to-cycles
# https://blenderartists.org/forum/showthread.php?247271-Cycles-Automatic-Material-Textures-Node
def rearrange_nodes():
logger.info('rearrange_nodes: ...')
# TODO
# https://www.blendernation.com/2015/11/03/development-cleaning-up-node-trees/
# https://github.com/JuhaW/NodeArrange/blob/master/__init__.py
assert False
def create_viewer_node(scene, preceeding_node_name, preceeding_channel_name):
"""
For debug purposes. Allows to visualize intermediate nodes.
:param scene:
:param preceeding_node_name:
:param preceeding_channel_name:
:return:
"""
logger.info('create_viewer_node: ...')
scene_nodes = scene.node_tree.nodes
scene_links = scene.node_tree.links
mask_id_node = scene_nodes.get(preceeding_node_name)
viewer_node = scene_nodes.new('CompositorNodeViewer')
scene_links.new(mask_id_node.outputs[preceeding_channel_name],
viewer_node.inputs['Image'])
logger.info('create_viewer_node: Done')
def create_depth_viewer_node(scene):
"""
This will save the z buffer in the Viewer Node after rendering
bpy.ops.render.render()
rendered_image = bpy.data.images['Viewer Node']
pixels = rendered_image.pixels
:param scene:
:return:
"""
logger.info('create_depth_output_nodes: ...')
scene.use_nodes = True
scene_nodes = scene.node_tree.nodes
scene_links = scene.node_tree.links
default_render_layers_node = scene_nodes.get('Render Layers')
# output_value = default_render_layers_node.outputs[output_type]
# print(type(output_value))
viewer_node = scene_nodes.get('Depth Viewer')
if viewer_node is None:
viewer_node = scene_nodes.new('CompositorNodeViewer')
viewer_node.name = 'Depth Viewer'
logger.vinfo('viewer_node.name', viewer_node.name)
viewer_node.use_alpha = False
output_type = 'Depth'
scene_links.new(
default_render_layers_node.outputs[output_type],
viewer_node.inputs[0]) # link Z to output
logger.info('create_depth_output_nodes: Done')
def create_additional_optical_flow_output_nodes(scene,
output_path=None,
image_stem=None,
leading_zeroes_template='#####'):
logger.info('create_additional_optical_flow_output_nodes: ...')
default_render_layer = scene.render.layers.get(scene.render.layers.active.name)
default_render_layer.use_pass_vector = True
default_render_layer.pass_alpha_threshold = 0
scene.use_nodes = True
scene_links = scene.node_tree.links
scene_nodes = scene.node_tree.nodes
default_render_layers_node = scene_nodes.get('Render Layers')
optical_flow_output_node = scene_nodes.new('CompositorNodeOutputFile')
optical_flow_output_node.format.file_format = 'OPEN_EXR'
#optical_flow_output_node.format.use_zbuffer = True # Store floats
if output_path is not None:
optical_flow_output_node.base_path = output_path
if image_stem is not None:
optical_flow_output_node.file_slots[0].path = image_stem + leading_zeroes_template
scene_links.new(default_render_layers_node.outputs['Vector'],
optical_flow_output_node.inputs['Image'])
logger.info('create_additional_optical_flow_output_nodes: Done')
return optical_flow_output_node
def create_additional_depth_output_nodes(scene,
output_path=None,
image_stem=None,
leading_zeroes_template='#####'):
logger.info('create_additional_depth_output_nodes: ...')
default_render_layer = scene.render.layers.get(scene.render.layers.active.name)
default_render_layer.pass_alpha_threshold = 0
scene.use_nodes = True
scene_nodes = scene.node_tree.nodes
scene_links = scene.node_tree.links
default_render_layers_node = scene_nodes.get('Render Layers')
depth_image_output_node = scene_nodes.new('CompositorNodeOutputFile')
depth_image_output_node.format.file_format = 'OPEN_EXR'
depth_image_output_node.format.use_zbuffer = True # Store floats
if output_path is not None:
depth_image_output_node.base_path = output_path
if image_stem is not None:
depth_image_output_node.file_slots[0].path = image_stem + leading_zeroes_template
scene_links.new(default_render_layers_node.outputs['Depth'],
depth_image_output_node.inputs['Image'])
logger.info('create_additional_depth_output_nodes: Done')
return depth_image_output_node
def create_additional_mask_output_nodes(scene,
object_index,
output_path=None,
image_stem=None,
leading_zeroes_template='#####'):
logger.info('create_additional_mask_output_nodes: ...')
# Make sure that the render layer passes the object index
default_render_layer = scene.render.layers.get(scene.render.layers.active.name)
# Add additional pass values
# default_render_layer.use_pass_combined = True
# default_render_layer.use_pass_mist = True
# default_render_layer.use_pass_normal = True
# default_render_layer.use_pass_vector = True
# default_render_layer.use_pass_uv = True
default_render_layer.use_pass_object_index = True
# default_render_layer.use_pass_material_index = True
# default_render_layer.use_pass_shadow = True
# ========== IMPORTANT FOR TRANSPARENT MATERIALS =========
default_render_layer.pass_alpha_threshold = 0
scene.use_nodes = True
scene_nodes = scene.node_tree.nodes
scene_links = scene.node_tree.links
default_render_layers_node = scene_nodes.get('Render Layers')
mask_node = scene_nodes.new('CompositorNodeIDMask')
mask_node.index = object_index
mask_node.use_antialiasing = True
image_output_node = scene_nodes.new('CompositorNodeOutputFile')
if output_path is not None:
image_output_node.base_path = output_path
if image_stem is not None:
image_output_node.file_slots[0].path = image_stem + leading_zeroes_template
scene_links.new(
default_render_layers_node.outputs['IndexOB'],
mask_node.inputs['ID value'])
scene_links.new(
mask_node.outputs['Alpha'],
image_output_node.inputs['Image'])
logger.info('create_additional_mask_output_nodes: Done')
return mask_node, image_output_node
def create_simple_material():
logger.info('Create Simple Material: ...')
simple_material = bpy.data.materials.new('simple_material')
simple_material.use_nodes = True
simple_material_nodes = simple_material.node_tree.nodes
simple_material_links = simple_material.node_tree.links
shader_node_diffuse_bsdf = simple_material_nodes.get(NodeUtility.DIFFUSE_BSDF)
shader_node_diffuse_bsdf.inputs[0].default_value = [255,0,0, 1]
return simple_material
def enable_backdrop(enable=True):
logger.info('enable_backdrop: ...')
# Enable backdrop
for area in bpy.context.screen.areas:
if area.type == 'NODE_EDITOR':
for space in area.spaces:
if space.type == 'NODE_EDITOR':
logger.info('Backdrop Enabled')
space.show_backdrop = enable
break
logger.info('enable_backdrop: Done')
class NodeUtility:
USE_MAP_COLOR_DIFFUSE = 'use_map_color_diffuse'
USE_MAP_NORMAL = 'use_map_normal'
DIFFUSE_BSDF = 'Diffuse BSDF'
GLOSSY_BSDF = 'Glossy BSDF'
TRANSPARENT_BSDF = 'Transparent BSDF'
GLASS_BSDF = 'Glass BSDF'
EMISSION = 'Emission'
OBJECT_INFO = 'Object Info'
MATERIAL_OUTPUT = 'Material Output'
SHADER_NODE_RGB = 'ShaderNodeRGB'
SHADER_NODE_MIX_RGB = 'ShaderNodeMixRGB'
SHADER_NODE_EMISSION = 'ShaderNodeEmission'
SHADER_NODE_BSDF_GLASS = 'ShaderNodeBsdfGlass'
SHADER_NODE_OBJECT_INFO = 'ShaderNodeObjectInfo'
@staticmethod
def _collect_texture(type_to_texture_file_path, use_map_type, filepath):
logger.debug('filepath: ' + filepath)
if type_to_texture_file_path[use_map_type] is None:
type_to_texture_file_path[use_map_type] = filepath
else:
logger.warning('Two Textures with the same use_type:')
logger.warning('First: ' + use_map_type + ', ' + type_to_texture_file_path[use_map_type])
logger.warning('Second: ' + use_map_type + ', ' + filepath)
logger.warning('We use the first texture as : ' + use_map_type)
@staticmethod
def _get_blender_internal_texture_type_to_file_paths(material):
some_other_name = material.name
logger.debug(some_other_name)
# fprint('material: ' + material.name)
texture_name_set = set()
texture_type_to_file_path = defaultdict(lambda: None)
for texture_slot in material.texture_slots:
if texture_slot:
texture = texture_slot.texture
texture_name_set.add(texture)
# fprint('texture: ' + texture.name)
if hasattr(texture, 'image'):
logger.debug('Material: ' + material.name + ', Texture: ' + texture.name)
logger.debug('use_map_color_diffuse: ' + str(texture_slot.use_map_color_diffuse))
logger.debug('use_map_normal: ' + str(texture_slot.use_map_normal))
# ==== Remark ====
# Relative paths start with '//' and are relative to the blend file.
# The prefix of paths to textures packed inside the .blend file are dependent on the original
# file path. For example <blend_file_folder>/textures/texture_file.ext, i.e. look like the
# following '//textures/<texturename>.<textureextension>'
if texture.image.packed_file is not None:
logger.debug('Image is packed')
# If the texture is packed, the file is definitively valid, otherwise check the file
image_is_valid = True
else:
logger.debug('Image is an external source')
image_is_valid = os.path.isfile(bpy.path.abspath(texture.image.filepath))
if image_is_valid:
if texture_slot.use_map_color_diffuse:
NodeUtility._collect_texture(texture_type_to_file_path,
NodeUtility.USE_MAP_COLOR_DIFFUSE,
texture.image.filepath)
elif texture_slot.use_map_normal:
NodeUtility._collect_texture(texture_type_to_file_path,
NodeUtility.USE_MAP_NORMAL,
texture.image.filepath)
logger.info('texture_type_to_file_path: ' + str(texture_type_to_file_path))
return texture_type_to_file_path
@staticmethod
def replace_bsdf_node_in_material(material, old_node, new_node, preceding_node=None, next_node=None):
nodes = material.node_tree.nodes
links = material.node_tree.links
# we replace the oldf bsdf with a new one
nodes.remove(old_node)
if preceding_node is not None:
links.new(preceding_node.outputs[0], new_node.inputs[0])
if next_node is not None:
links.new(new_node.outputs[0], next_node.inputs[0])
@staticmethod
def create_material_nodes_for_cycle_using_blender_internal_textures(material_default_bsdf_type=DIFFUSE_BSDF,
transparent_default_bsdf_type=TRANSPARENT_BSDF):
"""
:param material_default_bsdf_type: DIFFUSE_BSDF or GLOSSY_BSDF
:param transparent_default_bsdf_type: TRANSPARENT_BSDF or GLASS_BSDF
:return:
"""
logger.info('create_material_nodes_for_cycle_using_blender_internal_textures: ...')
bpy.context.scene.render.engine = 'CYCLES'
# # each object has several material slots, which link to the materials provided in bpy.data.materials
# for material in bpy.data.materials:
for object in bpy.data.objects:
logger.debug('object.name: ' + object.name)
for material_slot in object.material_slots:
material = material_slot.material
# https://wiki.blender.org/index.php/Dev:Py/Scripts/Cookbook/Code_snippets/Nodes
logger.info('material.name: ' + material.name)
# change only blender internal materials (keep cycle materials as is)
if not material.use_nodes:
logger.debug('Adding nodes ...')
# this adds by default a node "Material Output" and a node "Diffuse BSDF"
material.use_nodes = True
# get the "Diffuse BSDF" node
nodes = material.node_tree.nodes
links = material.node_tree.links
# this diffuse node does automatically inherit the color of the material
shader_node_diffuse_bsdf = nodes.get(NodeUtility.DIFFUSE_BSDF)
shader_node_material_output = nodes.get("Material Output")
# These texture file path should be valid
texture_type_to_file_path = NodeUtility._get_blender_internal_texture_type_to_file_paths(material)
# 1 Case: Material is just a texture
# Image Texture -> Diffuse BSDF/Glossy BSDF -> Material Output
color_texture_file_path = texture_type_to_file_path[NodeUtility.USE_MAP_COLOR_DIFFUSE]
logger.debug('color_texture_file_path: ' + str(color_texture_file_path))
if color_texture_file_path is not None:
logger.debug('Converting Material With Texture: ' + color_texture_file_path)
logger.debug('Texture path is valid')
# test if the image texture node has already been created
shader_node_tex_image = nodes.get("Image Texture")
if not shader_node_tex_image:
shader_node_tex_image = nodes.new(type='ShaderNodeTexImage')
shader_node_tex_image.image = bpy.data.images.load(color_texture_file_path)
# link the nodes
links.new(shader_node_tex_image.outputs[0], shader_node_diffuse_bsdf.inputs[0])
# if material_default_bsdf_type == BICyclesMaterialConverter.GLOSSY_BSDF:
#
# logger.debug('Replace Diffuse Material Node with Glossy Material Node' )
# shader_node_glossy_bsdf = nodes.get(BICyclesMaterialConverter.GLOSSY_BSDF)
# if not shader_node_glossy_bsdf:
#
# shader_node_glossy_bsdf = nodes.new(type='ShaderNodeBsdfGlossy')
#
# BICyclesMaterialConverter._replace_bsdf_node(material,
# old_node=shader_node_diffuse_bsdf,
# new_node=shader_node_glossy_bsdf,
# preceding_node=shader_node_tex_image,
# next_node=shader_node_material_output)
# 2 Case: Material is transparent
# RGB -> Transparent BSDF/Glass BSDF -> Material Output
elif material.use_transparency:
logger.debug('Converting Transparent Material')
shader_node_transparent_or_glass_bsdf = nodes.get(transparent_default_bsdf_type)
if not shader_node_transparent_or_glass_bsdf:
if transparent_default_bsdf_type == NodeUtility.GLASS_BSDF:
shader_node_transparent_or_glass_bsdf = nodes.new(type='ShaderNodeBsdfGlass')
else:
shader_node_transparent_or_glass_bsdf = nodes.new(type='ShaderNodeBsdfTransparent')
shader_node_RGB = nodes.new(type='ShaderNodeRGB')
NodeUtility.replace_bsdf_node_in_material(material,
old_node=shader_node_diffuse_bsdf,
new_node=shader_node_transparent_or_glass_bsdf,
preceding_node=shader_node_RGB,
next_node=shader_node_material_output)
else:
logger.debug('Converting Material With Simple Color')
# by default there is just a diffuse bsdf created using the color of the material
if material_default_bsdf_type == NodeUtility.GLOSSY_BSDF:
logger.debug('Replace Diffuse Material Node with Glossy Material Node')
shader_node_glossy_bsdf = nodes.get(NodeUtility.GLOSSY_BSDF)
if not shader_node_glossy_bsdf:
shader_node_glossy_bsdf = nodes.new(type='ShaderNodeBsdfGlossy')
NodeUtility.replace_bsdf_node_in_material(material,
old_node=shader_node_diffuse_bsdf,
new_node=shader_node_glossy_bsdf,
preceding_node=None,
next_node=shader_node_material_output)
else:
logger.debug('Material has already a node ...')
logger.info('create_material_nodes_for_cycle_using_blender_internal_textures: Done') | [
1,
29871,
13,
5215,
289,
2272,
13,
5215,
2897,
13,
13,
3166,
16250,
1053,
2322,
8977,
13,
3166,
22310,
537,
29889,
3403,
3460,
29918,
17657,
1053,
17927,
13,
13,
29937,
1732,
597,
2204,
1581,
29889,
7041,
29889,
510,
29914,
2619,
29914,
29947,
29929,
29941,
29953,
29914,
13221,
29899,
15123,
292,
29899,
3166,
29899,
2204,
1581,
29899,
9482,
29899,
517,
29899,
1270,
7799,
29899,
12062,
29899,
386,
886,
29899,
786,
13,
29937,
334,
2178,
1775,
631,
1338,
297,
25785,
671,
7573,
313,
11884,
565,
366,
731,
701,
278,
5518,
297,
278,
21582,
9451,
29892,
372,
674,
1653,
13,
29937,
7573,
297,
278,
2943,
6920,
467,
13,
29937,
334,
4001,
350,
29902,
17279,
1016,
29915,
29873,
671,
7573,
491,
2322,
29892,
746,
366,
4607,
304,
25785,
515,
350,
29902,
727,
2113,
29915,
29873,
367,
738,
350,
29902,
13,
29937,
7573,
297,
278,
2943,
5447,
29892,
3447,
7573,
674,
367,
9615,
29889,
910,
674,
1207,
278,
5518,
4050,
408,
17772,
29889,
13,
13,
29937,
3118,
1818,
4607,
847,
20429,
1546,
671,
29918,
845,
1664,
7573,
13,
13,
29937,
5240,
935,
29901,
13,
29937,
5235,
282,
4143,
297,
25785,
29901,
13,
29937,
259,
278,
5235,
282,
4143,
297,
25785,
3052,
267,
263,
3287,
310,
1422,
8260,
13,
29937,
539,
1732,
597,
2204,
1581,
29889,
7041,
29889,
510,
29914,
2619,
29914,
29896,
29947,
29900,
29906,
29900,
29914,
2158,
29899,
497,
29899,
26381,
29899,
262,
29899,
1552,
29899,
3888,
29899,
1493,
13,
29937,
259,
2045,
597,
1636,
29889,
2204,
1581,
29889,
990,
29914,
2754,
29914,
2204,
1581,
29918,
4691,
29918,
2754,
29918,
29906,
29918,
29955,
29906,
29918,
14096,
29914,
3888,
29918,
2754,
29918,
5679,
29889,
1420,
29937,
3372,
4097,
13,
29937,
539,
7849,
1820,
29899,
303,
307,
10794,
322,
9828,
297,
3164,
1581,
1246,
385,
5455,
607,
338,
884,
19884,
304,
3017,
3025,
289,
2272,
29889,
3554,
29892,
13,
29937,
539,
1763,
1074,
278,
5132,
7126,
16758,
596,
9495,
975,
278,
2826,
322,
1074,
278,
5780,
29899,
12632,
29892,
13,
29937,
539,
8087,
5132,
29901,
289,
2272,
29889,
3554,
29889,
9482,
29889,
9482,
3285,
960,
727,
338,
694,
5780,
29899,
12632,
470,
278,
5132,
29901,
1196,
338,
4567,
769,
445,
2826,
13,
29937,
338,
451,
773,
385,
5455,
322,
508,
29915,
29873,
367,
20592,
515,
5132,
29889,
13,
29937,
960,
366,
864,
304,
671,
445,
297,
263,
2471,
366,
508,
3965,
11264,
29899,
29907,
1550,
596,
9495,
338,
975,
278,
2826,
304,
3509,
372,
304,
278,
13,
29937,
20102,
3377,
29889,
13,
13,
29937,
1275,
4936,
2751,
25512,
13,
29937,
8671,
2948,
313,
1333,
9528,
3447,
29897,
13,
29937,
1732,
597,
2204,
1581,
29889,
7041,
29889,
510,
29914,
2619,
29914,
29941,
29953,
29946,
29914,
3525,
29899,
1867,
29899,
29875,
29899,
13441,
29899,
15388,
29879,
29899,
3166,
29899,
2204,
1581,
29899,
7564,
29899,
517,
29899,
1270,
7799,
13,
29937,
2045,
597,
2204,
1581,
442,
2879,
29889,
990,
29914,
23343,
29914,
4294,
7097,
29889,
1961,
29973,
29906,
29946,
29955,
29906,
29955,
29896,
29899,
29733,
7799,
29899,
28451,
2454,
29899,
24095,
29899,
1626,
1973,
29899,
4247,
13,
13,
13,
1753,
18983,
3881,
29918,
18010,
7295,
13,
1678,
17927,
29889,
3888,
877,
276,
279,
3881,
29918,
18010,
29901,
2023,
1495,
13,
1678,
396,
14402,
13,
1678,
396,
2045,
597,
1636,
29889,
2204,
355,
824,
362,
29889,
510,
29914,
29906,
29900,
29896,
29945,
29914,
29896,
29896,
29914,
29900,
29941,
29914,
25431,
29899,
14941,
292,
29899,
786,
29899,
3177,
29899,
28737,
29914,
13,
1678,
396,
2045,
597,
3292,
29889,
510,
29914,
29967,
29884,
2350,
29956,
29914,
4247,
1433,
3881,
29914,
10054,
29914,
6207,
29914,
1649,
2344,
26914,
2272,
13,
1678,
4974,
7700,
13,
13,
13,
1753,
1653,
29918,
29894,
15580,
29918,
3177,
29898,
24645,
29892,
758,
3947,
292,
29918,
3177,
29918,
978,
29892,
758,
3947,
292,
29918,
12719,
29918,
978,
1125,
13,
1678,
9995,
13,
1678,
1152,
4744,
11976,
29889,
2178,
1242,
304,
7604,
675,
19697,
7573,
29889,
13,
13,
1678,
584,
3207,
9088,
29901,
13,
1678,
584,
3207,
758,
3947,
292,
29918,
3177,
29918,
978,
29901,
13,
1678,
584,
3207,
758,
3947,
292,
29918,
12719,
29918,
978,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
29894,
15580,
29918,
3177,
29901,
2023,
1495,
13,
13,
1678,
9088,
29918,
18010,
353,
9088,
29889,
3177,
29918,
8336,
29889,
18010,
13,
1678,
9088,
29918,
4965,
353,
9088,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
1678,
11105,
29918,
333,
29918,
3177,
353,
9088,
29918,
18010,
29889,
657,
29898,
1457,
3947,
292,
29918,
3177,
29918,
978,
29897,
13,
1678,
6316,
556,
29918,
3177,
353,
9088,
29918,
18010,
29889,
1482,
877,
1523,
1066,
2105,
4247,
29963,
15580,
1495,
13,
13,
1678,
9088,
29918,
4965,
29889,
1482,
29898,
13168,
29918,
333,
29918,
3177,
29889,
4905,
29879,
29961,
1457,
3947,
292,
29918,
12719,
29918,
978,
1402,
13,
462,
1678,
6316,
556,
29918,
3177,
29889,
2080,
29879,
1839,
2940,
11287,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
29894,
15580,
29918,
3177,
29901,
25679,
1495,
13,
13,
13,
1753,
1653,
29918,
19488,
29918,
29894,
15580,
29918,
3177,
29898,
24645,
1125,
13,
13,
1678,
9995,
13,
1678,
910,
674,
4078,
278,
503,
6835,
297,
278,
478,
15580,
9071,
1156,
15061,
13,
13,
1678,
289,
2272,
29889,
3554,
29889,
9482,
29889,
9482,
580,
13,
1678,
13751,
29918,
3027,
353,
289,
2272,
29889,
1272,
29889,
8346,
1839,
29963,
15580,
9071,
2033,
13,
1678,
17036,
353,
13751,
29918,
3027,
29889,
29886,
861,
1379,
13,
13,
1678,
584,
3207,
9088,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
19488,
29918,
4905,
29918,
18010,
29901,
2023,
1495,
13,
13,
1678,
9088,
29889,
1509,
29918,
18010,
353,
5852,
13,
1678,
9088,
29918,
18010,
353,
9088,
29889,
3177,
29918,
8336,
29889,
18010,
13,
1678,
9088,
29918,
4965,
353,
9088,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
1678,
2322,
29918,
9482,
29918,
29277,
29918,
3177,
353,
9088,
29918,
18010,
29889,
657,
877,
10716,
365,
388,
414,
1495,
13,
13,
1678,
396,
1962,
29918,
1767,
353,
2322,
29918,
9482,
29918,
29277,
29918,
3177,
29889,
4905,
29879,
29961,
4905,
29918,
1853,
29962,
13,
1678,
396,
1596,
29898,
1853,
29898,
4905,
29918,
1767,
876,
13,
13,
1678,
6316,
556,
29918,
3177,
353,
9088,
29918,
18010,
29889,
657,
877,
8498,
386,
478,
15580,
1495,
13,
1678,
565,
6316,
556,
29918,
3177,
338,
6213,
29901,
13,
4706,
6316,
556,
29918,
3177,
353,
9088,
29918,
18010,
29889,
1482,
877,
1523,
1066,
2105,
4247,
29963,
15580,
1495,
13,
4706,
6316,
556,
29918,
3177,
29889,
978,
353,
525,
8498,
386,
478,
15580,
29915,
13,
13,
1678,
17927,
29889,
3845,
1181,
877,
29894,
15580,
29918,
3177,
29889,
978,
742,
6316,
556,
29918,
3177,
29889,
978,
29897,
13,
13,
1678,
6316,
556,
29918,
3177,
29889,
1509,
29918,
2312,
353,
7700,
13,
13,
1678,
1962,
29918,
1853,
353,
525,
8498,
386,
29915,
13,
1678,
9088,
29918,
4965,
29889,
1482,
29898,
13,
4706,
2322,
29918,
9482,
29918,
29277,
29918,
3177,
29889,
4905,
29879,
29961,
4905,
29918,
1853,
1402,
13,
4706,
6316,
556,
29918,
3177,
29889,
2080,
29879,
29961,
29900,
2314,
29871,
396,
1544,
796,
304,
1962,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
19488,
29918,
4905,
29918,
18010,
29901,
25679,
1495,
13,
13,
13,
1753,
1653,
29918,
1202,
3245,
29918,
3670,
936,
29918,
1731,
29918,
4905,
29918,
18010,
29898,
24645,
29892,
13,
462,
462,
18884,
1962,
29918,
2084,
29922,
8516,
29892,
13,
462,
462,
18884,
1967,
29918,
303,
331,
29922,
8516,
29892,
13,
462,
462,
18884,
8236,
29918,
9171,
267,
29918,
6886,
2433,
4136,
29937,
29374,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
1202,
3245,
29918,
3670,
936,
29918,
1731,
29918,
4905,
29918,
18010,
29901,
2023,
1495,
13,
13,
1678,
2322,
29918,
9482,
29918,
13148,
353,
9088,
29889,
9482,
29889,
29277,
29889,
657,
29898,
24645,
29889,
9482,
29889,
29277,
29889,
4925,
29889,
978,
29897,
13,
1678,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
8111,
353,
5852,
13,
13,
1678,
2322,
29918,
9482,
29918,
13148,
29889,
3364,
29918,
2312,
29918,
386,
12268,
353,
29871,
29900,
13,
1678,
9088,
29889,
1509,
29918,
18010,
353,
5852,
13,
13,
1678,
9088,
29918,
4965,
353,
9088,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
1678,
9088,
29918,
18010,
353,
9088,
29889,
3177,
29918,
8336,
29889,
18010,
13,
1678,
2322,
29918,
9482,
29918,
29277,
29918,
3177,
353,
9088,
29918,
18010,
29889,
657,
877,
10716,
365,
388,
414,
1495,
13,
13,
1678,
27070,
29918,
1731,
29918,
4905,
29918,
3177,
353,
9088,
29918,
18010,
29889,
1482,
877,
1523,
1066,
2105,
4247,
6466,
2283,
1495,
13,
1678,
27070,
29918,
1731,
29918,
4905,
29918,
3177,
29889,
4830,
29889,
1445,
29918,
4830,
353,
525,
4590,
1430,
29918,
5746,
29934,
29915,
13,
1678,
396,
3670,
936,
29918,
1731,
29918,
4905,
29918,
3177,
29889,
4830,
29889,
1509,
29918,
29920,
9040,
353,
5852,
539,
396,
14491,
5685,
1446,
13,
13,
1678,
565,
1962,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
27070,
29918,
1731,
29918,
4905,
29918,
3177,
29889,
3188,
29918,
2084,
353,
1962,
29918,
2084,
13,
1678,
565,
1967,
29918,
303,
331,
338,
451,
6213,
29901,
13,
4706,
27070,
29918,
1731,
29918,
4905,
29918,
3177,
29889,
1445,
29918,
2536,
1862,
29961,
29900,
1822,
2084,
353,
1967,
29918,
303,
331,
718,
8236,
29918,
9171,
267,
29918,
6886,
13,
1678,
9088,
29918,
4965,
29889,
1482,
29898,
4381,
29918,
9482,
29918,
29277,
29918,
3177,
29889,
4905,
29879,
1839,
12877,
7464,
13,
462,
1678,
27070,
29918,
1731,
29918,
4905,
29918,
3177,
29889,
2080,
29879,
1839,
2940,
11287,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
1202,
3245,
29918,
3670,
936,
29918,
1731,
29918,
4905,
29918,
18010,
29901,
25679,
1495,
13,
1678,
736,
27070,
29918,
1731,
29918,
4905,
29918,
3177,
13,
13,
13,
1753,
1653,
29918,
1202,
3245,
29918,
19488,
29918,
4905,
29918,
18010,
29898,
24645,
29892,
13,
462,
462,
308,
1962,
29918,
2084,
29922,
8516,
29892,
13,
462,
462,
308,
1967,
29918,
303,
331,
29922,
8516,
29892,
13,
462,
462,
308,
8236,
29918,
9171,
267,
29918,
6886,
2433,
4136,
29937,
29374,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
1202,
3245,
29918,
19488,
29918,
4905,
29918,
18010,
29901,
2023,
1495,
13,
13,
1678,
2322,
29918,
9482,
29918,
13148,
353,
9088,
29889,
9482,
29889,
29277,
29889,
657,
29898,
24645,
29889,
9482,
29889,
29277,
29889,
4925,
29889,
978,
29897,
13,
13,
1678,
2322,
29918,
9482,
29918,
13148,
29889,
3364,
29918,
2312,
29918,
386,
12268,
353,
29871,
29900,
13,
1678,
9088,
29889,
1509,
29918,
18010,
353,
5852,
13,
1678,
9088,
29918,
18010,
353,
9088,
29889,
3177,
29918,
8336,
29889,
18010,
13,
1678,
9088,
29918,
4965,
353,
9088,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
1678,
2322,
29918,
9482,
29918,
29277,
29918,
3177,
353,
9088,
29918,
18010,
29889,
657,
877,
10716,
365,
388,
414,
1495,
13,
13,
1678,
10809,
29918,
3027,
29918,
4905,
29918,
3177,
353,
9088,
29918,
18010,
29889,
1482,
877,
1523,
1066,
2105,
4247,
6466,
2283,
1495,
13,
1678,
10809,
29918,
3027,
29918,
4905,
29918,
3177,
29889,
4830,
29889,
1445,
29918,
4830,
353,
525,
4590,
1430,
29918,
5746,
29934,
29915,
13,
1678,
10809,
29918,
3027,
29918,
4905,
29918,
3177,
29889,
4830,
29889,
1509,
29918,
29920,
9040,
353,
5852,
539,
396,
14491,
5685,
1446,
13,
13,
1678,
565,
1962,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
10809,
29918,
3027,
29918,
4905,
29918,
3177,
29889,
3188,
29918,
2084,
353,
1962,
29918,
2084,
13,
1678,
565,
1967,
29918,
303,
331,
338,
451,
6213,
29901,
13,
4706,
10809,
29918,
3027,
29918,
4905,
29918,
3177,
29889,
1445,
29918,
2536,
1862,
29961,
29900,
1822,
2084,
353,
1967,
29918,
303,
331,
718,
8236,
29918,
9171,
267,
29918,
6886,
13,
1678,
9088,
29918,
4965,
29889,
1482,
29898,
4381,
29918,
9482,
29918,
29277,
29918,
3177,
29889,
4905,
29879,
1839,
8498,
386,
7464,
13,
462,
1678,
10809,
29918,
3027,
29918,
4905,
29918,
3177,
29889,
2080,
29879,
1839,
2940,
11287,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
1202,
3245,
29918,
19488,
29918,
4905,
29918,
18010,
29901,
25679,
1495,
13,
1678,
736,
10809,
29918,
3027,
29918,
4905,
29918,
3177,
13,
13,
13,
1753,
1653,
29918,
1202,
3245,
29918,
13168,
29918,
4905,
29918,
18010,
29898,
24645,
29892,
13,
462,
462,
4706,
1203,
29918,
2248,
29892,
13,
462,
462,
4706,
1962,
29918,
2084,
29922,
8516,
29892,
13,
462,
462,
4706,
1967,
29918,
303,
331,
29922,
8516,
29892,
13,
462,
462,
4706,
8236,
29918,
9171,
267,
29918,
6886,
2433,
4136,
29937,
29374,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
1202,
3245,
29918,
13168,
29918,
4905,
29918,
18010,
29901,
2023,
1495,
13,
1678,
396,
8561,
1854,
393,
278,
4050,
7546,
14517,
278,
1203,
2380,
13,
1678,
2322,
29918,
9482,
29918,
13148,
353,
9088,
29889,
9482,
29889,
29277,
29889,
657,
29898,
24645,
29889,
9482,
29889,
29277,
29889,
4925,
29889,
978,
29897,
13,
1678,
396,
3462,
5684,
1209,
1819,
13,
1678,
396,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
17743,
1312,
353,
5852,
13,
1678,
396,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
29885,
391,
353,
5852,
13,
1678,
396,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
8945,
353,
5852,
13,
1678,
396,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
8111,
353,
5852,
13,
1678,
396,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
4090,
353,
5852,
13,
1678,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
3318,
29918,
2248,
353,
5852,
13,
1678,
396,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
15388,
29918,
2248,
353,
5852,
13,
1678,
396,
2322,
29918,
9482,
29918,
13148,
29889,
1509,
29918,
3364,
29918,
17505,
353,
5852,
13,
13,
1678,
396,
1275,
4936,
306,
3580,
8476,
13566,
15842,
10014,
2190,
5550,
1718,
3919,
341,
1299,
1001,
25758,
29903,
1275,
2751,
25512,
13,
1678,
2322,
29918,
9482,
29918,
13148,
29889,
3364,
29918,
2312,
29918,
386,
12268,
353,
29871,
29900,
13,
13,
1678,
9088,
29889,
1509,
29918,
18010,
353,
5852,
13,
1678,
9088,
29918,
18010,
353,
9088,
29889,
3177,
29918,
8336,
29889,
18010,
13,
1678,
9088,
29918,
4965,
353,
9088,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
1678,
2322,
29918,
9482,
29918,
29277,
29918,
3177,
353,
9088,
29918,
18010,
29889,
657,
877,
10716,
365,
388,
414,
1495,
13,
13,
1678,
11105,
29918,
3177,
353,
9088,
29918,
18010,
29889,
1482,
877,
1523,
1066,
2105,
4247,
1367,
19832,
1495,
13,
1678,
11105,
29918,
3177,
29889,
2248,
353,
1203,
29918,
2248,
13,
1678,
11105,
29918,
3177,
29889,
1509,
29918,
424,
616,
3173,
292,
353,
5852,
13,
1678,
1967,
29918,
4905,
29918,
3177,
353,
9088,
29918,
18010,
29889,
1482,
877,
1523,
1066,
2105,
4247,
6466,
2283,
1495,
13,
1678,
565,
1962,
29918,
2084,
338,
451,
6213,
29901,
13,
4706,
1967,
29918,
4905,
29918,
3177,
29889,
3188,
29918,
2084,
353,
1962,
29918,
2084,
13,
1678,
565,
1967,
29918,
303,
331,
338,
451,
6213,
29901,
13,
4706,
1967,
29918,
4905,
29918,
3177,
29889,
1445,
29918,
2536,
1862,
29961,
29900,
1822,
2084,
353,
1967,
29918,
303,
331,
718,
8236,
29918,
9171,
267,
29918,
6886,
13,
1678,
9088,
29918,
4965,
29889,
1482,
29898,
13,
4706,
2322,
29918,
9482,
29918,
29277,
29918,
3177,
29889,
4905,
29879,
1839,
3220,
14824,
7464,
13,
4706,
11105,
29918,
3177,
29889,
2080,
29879,
1839,
1367,
995,
11287,
13,
1678,
9088,
29918,
4965,
29889,
1482,
29898,
13,
4706,
11105,
29918,
3177,
29889,
4905,
29879,
1839,
28630,
7464,
13,
4706,
1967,
29918,
4905,
29918,
3177,
29889,
2080,
29879,
1839,
2940,
11287,
13,
13,
1678,
17927,
29889,
3888,
877,
3258,
29918,
1202,
3245,
29918,
13168,
29918,
4905,
29918,
18010,
29901,
25679,
1495,
13,
13,
1678,
736,
11105,
29918,
3177,
29892,
1967,
29918,
4905,
29918,
3177,
13,
13,
13,
1753,
1653,
29918,
12857,
29918,
15388,
7295,
13,
13,
1678,
17927,
29889,
3888,
877,
4391,
12545,
17582,
29901,
2023,
1495,
13,
1678,
2560,
29918,
15388,
353,
289,
2272,
29889,
1272,
29889,
15388,
29879,
29889,
1482,
877,
12857,
29918,
15388,
1495,
13,
1678,
2560,
29918,
15388,
29889,
1509,
29918,
18010,
353,
5852,
13,
1678,
2560,
29918,
15388,
29918,
18010,
353,
2560,
29918,
15388,
29889,
3177,
29918,
8336,
29889,
18010,
13,
1678,
2560,
29918,
15388,
29918,
4965,
353,
2560,
29918,
15388,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
1678,
528,
1664,
29918,
3177,
29918,
12765,
1509,
29918,
5824,
2176,
353,
2560,
29918,
15388,
29918,
18010,
29889,
657,
29898,
4247,
7270,
537,
29889,
4571,
4198,
17171,
29918,
9851,
4037,
29897,
13,
1678,
528,
1664,
29918,
3177,
29918,
12765,
1509,
29918,
5824,
2176,
29889,
2080,
29879,
29961,
29900,
1822,
4381,
29918,
1767,
353,
518,
29906,
29945,
29945,
29892,
29900,
29892,
29900,
29892,
29871,
29896,
29962,
13,
13,
1678,
736,
2560,
29918,
15388,
13,
13,
13,
1753,
9025,
29918,
1627,
8865,
29898,
12007,
29922,
5574,
1125,
13,
1678,
17927,
29889,
3888,
877,
12007,
29918,
1627,
8865,
29901,
2023,
1495,
13,
1678,
396,
1174,
519,
1250,
8865,
13,
1678,
363,
4038,
297,
289,
2272,
29889,
4703,
29889,
10525,
29889,
598,
294,
29901,
13,
4706,
565,
4038,
29889,
1853,
1275,
525,
6632,
2287,
29918,
12378,
1955,
2396,
13,
9651,
363,
2913,
297,
4038,
29889,
22854,
29901,
13,
18884,
565,
2913,
29889,
1853,
1275,
525,
6632,
2287,
29918,
12378,
1955,
2396,
13,
462,
1678,
17927,
29889,
3888,
877,
5841,
8865,
1174,
3606,
1495,
13,
462,
1678,
2913,
29889,
4294,
29918,
1627,
8865,
353,
9025,
13,
462,
1678,
2867,
13,
1678,
17927,
29889,
3888,
877,
12007,
29918,
1627,
8865,
29901,
25679,
1495,
13,
13,
13,
1990,
9071,
7270,
537,
29901,
13,
13,
1678,
501,
1660,
29918,
23827,
29918,
15032,
1955,
29918,
4571,
4198,
17171,
353,
525,
1509,
29918,
1958,
29918,
2780,
29918,
12765,
1509,
29915,
13,
1678,
501,
1660,
29918,
23827,
29918,
29940,
1955,
1529,
29931,
353,
525,
1509,
29918,
1958,
29918,
8945,
29915,
13,
13,
1678,
22471,
4198,
17171,
29918,
9851,
4037,
353,
525,
26023,
1509,
350,
29903,
4037,
29915,
13,
1678,
402,
3927,
1799,
29979,
29918,
9851,
4037,
353,
525,
29954,
6758,
29891,
350,
29903,
4037,
29915,
13,
1678,
10014,
2190,
5550,
1718,
3919,
29918,
9851,
4037,
353,
525,
4300,
3560,
350,
29903,
4037,
29915,
13,
1678,
402,
4375,
1799,
29918,
9851,
4037,
353,
525,
29954,
605,
350,
29903,
4037,
29915,
13,
1678,
382,
10403,
13507,
353,
525,
6026,
2333,
29915,
13,
1678,
438,
29933,
17637,
29918,
11690,
353,
525,
2061,
22140,
29915,
13,
1678,
341,
1299,
1001,
25758,
29918,
12015,
12336,
353,
525,
24095,
10604,
29915,
13,
13,
1678,
24972,
3035,
1001,
29918,
6632,
2287,
29918,
28212,
353,
525,
2713,
1664,
4247,
28212,
29915,
13,
1678,
24972,
3035,
1001,
29918,
6632,
2287,
29918,
29924,
6415,
29918,
28212,
353,
525,
2713,
1664,
4247,
29924,
861,
28212,
29915,
13,
1678,
24972,
3035,
1001,
29918,
6632,
2287,
29918,
29923,
10403,
13507,
353,
525,
2713,
1664,
4247,
6026,
2333,
29915,
13,
1678,
24972,
3035,
1001,
29918,
6632,
2287,
29918,
9851,
4037,
29918,
29954,
4375,
1799,
353,
525,
2713,
1664,
4247,
29933,
29879,
2176,
29954,
605,
29915,
13,
1678,
24972,
3035,
1001,
29918,
6632,
2287,
29918,
14824,
17637,
29918,
11690,
353,
525,
2713,
1664,
4247,
2061,
3401,
29915,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
15914,
29918,
726,
545,
29898,
1853,
29918,
517,
29918,
726,
545,
29918,
1445,
29918,
2084,
29892,
671,
29918,
1958,
29918,
1853,
29892,
934,
2084,
1125,
13,
4706,
17927,
29889,
8382,
877,
1445,
2084,
29901,
525,
718,
934,
2084,
29897,
13,
4706,
565,
1134,
29918,
517,
29918,
726,
545,
29918,
1445,
29918,
2084,
29961,
1509,
29918,
1958,
29918,
1853,
29962,
338,
6213,
29901,
13,
9651,
1134,
29918,
517,
29918,
726,
545,
29918,
1445,
29918,
2084,
29961,
1509,
29918,
1958,
29918,
1853,
29962,
353,
934,
2084,
13,
4706,
1683,
29901,
13,
9651,
17927,
29889,
27392,
877,
13985,
3992,
1973,
411,
278,
1021,
671,
29918,
1853,
29901,
1495,
13,
9651,
17927,
29889,
27392,
877,
6730,
29901,
525,
718,
671,
29918,
1958,
29918,
1853,
718,
13420,
525,
718,
1134,
29918,
517,
29918,
726,
545,
29918,
1445,
29918,
2084,
29961,
1509,
29918,
1958,
29918,
1853,
2314,
13,
9651,
17927,
29889,
27392,
877,
11863,
29901,
525,
718,
671,
29918,
1958,
29918,
1853,
718,
13420,
525,
718,
934,
2084,
29897,
13,
9651,
17927,
29889,
27392,
877,
4806,
671,
278,
937,
18459,
408,
584,
525,
718,
671,
29918,
1958,
29918,
1853,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
657,
29918,
2204,
1581,
29918,
7564,
29918,
726,
545,
29918,
1853,
29918,
517,
29918,
1445,
29918,
24772,
29898,
15388,
1125,
13,
13,
4706,
777,
29918,
1228,
29918,
978,
353,
5518,
29889,
978,
13,
4706,
17927,
29889,
8382,
29898,
5372,
29918,
1228,
29918,
978,
29897,
13,
13,
4706,
396,
285,
2158,
877,
15388,
29901,
525,
718,
5518,
29889,
978,
29897,
13,
4706,
18459,
29918,
978,
29918,
842,
353,
731,
580,
13,
4706,
18459,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
353,
2322,
8977,
29898,
2892,
29901,
6213,
29897,
13,
4706,
363,
18459,
29918,
2536,
327,
297,
5518,
29889,
726,
545,
29918,
2536,
1862,
29901,
13,
13,
9651,
565,
18459,
29918,
2536,
327,
29901,
13,
18884,
18459,
353,
18459,
29918,
2536,
327,
29889,
726,
545,
13,
13,
18884,
18459,
29918,
978,
29918,
842,
29889,
1202,
29898,
726,
545,
29897,
13,
18884,
396,
285,
2158,
877,
726,
545,
29901,
525,
718,
18459,
29889,
978,
29897,
13,
18884,
565,
756,
5552,
29898,
726,
545,
29892,
525,
3027,
29374,
13,
462,
1678,
17927,
29889,
8382,
877,
24095,
29901,
525,
718,
5518,
29889,
978,
718,
13420,
3992,
545,
29901,
525,
718,
18459,
29889,
978,
29897,
13,
13,
462,
1678,
17927,
29889,
8382,
877,
1509,
29918,
1958,
29918,
2780,
29918,
12765,
1509,
29901,
525,
718,
851,
29898,
726,
545,
29918,
2536,
327,
29889,
1509,
29918,
1958,
29918,
2780,
29918,
12765,
1509,
876,
13,
462,
1678,
17927,
29889,
8382,
877,
1509,
29918,
1958,
29918,
8945,
29901,
525,
718,
851,
29898,
726,
545,
29918,
2536,
327,
29889,
1509,
29918,
1958,
29918,
8945,
876,
13,
13,
462,
1678,
396,
1275,
1360,
5240,
935,
1275,
1360,
13,
462,
1678,
396,
6376,
1230,
10898,
1369,
411,
525,
458,
29915,
322,
526,
6198,
304,
278,
1999,
355,
934,
29889,
13,
462,
1678,
396,
450,
10944,
310,
10898,
304,
1426,
1973,
4870,
287,
2768,
278,
869,
2204,
355,
934,
526,
14278,
373,
278,
2441,
13,
462,
1678,
396,
934,
2224,
29889,
1152,
1342,
529,
2204,
355,
29918,
1445,
29918,
12083,
20690,
726,
1973,
29914,
726,
545,
29918,
1445,
29889,
1062,
29892,
474,
29889,
29872,
29889,
1106,
763,
278,
13,
462,
1678,
396,
1494,
525,
458,
726,
1973,
29914,
29966,
726,
332,
3871,
15513,
29966,
726,
545,
17588,
16299,
13,
13,
462,
1678,
565,
18459,
29889,
3027,
29889,
4058,
287,
29918,
1445,
338,
451,
6213,
29901,
13,
462,
4706,
17927,
29889,
8382,
877,
2940,
338,
4870,
287,
1495,
13,
462,
4706,
396,
960,
278,
18459,
338,
4870,
287,
29892,
278,
934,
338,
8422,
3598,
2854,
29892,
6467,
1423,
278,
934,
13,
462,
4706,
1967,
29918,
275,
29918,
3084,
353,
5852,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
17927,
29889,
8382,
877,
2940,
338,
385,
7029,
2752,
1495,
13,
462,
4706,
1967,
29918,
275,
29918,
3084,
353,
2897,
29889,
2084,
29889,
275,
1445,
29898,
29890,
2272,
29889,
2084,
29889,
370,
1028,
493,
29898,
726,
545,
29889,
3027,
29889,
1445,
2084,
876,
13,
13,
462,
1678,
565,
1967,
29918,
275,
29918,
3084,
29901,
13,
462,
4706,
565,
18459,
29918,
2536,
327,
29889,
1509,
29918,
1958,
29918,
2780,
29918,
12765,
1509,
29901,
13,
462,
9651,
9071,
7270,
537,
3032,
15914,
29918,
726,
545,
29898,
726,
545,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
29892,
13,
462,
462,
462,
308,
9071,
7270,
537,
29889,
17171,
29918,
23827,
29918,
15032,
1955,
29918,
4571,
4198,
17171,
29892,
13,
462,
462,
462,
308,
18459,
29889,
3027,
29889,
1445,
2084,
29897,
13,
13,
462,
4706,
25342,
18459,
29918,
2536,
327,
29889,
1509,
29918,
1958,
29918,
8945,
29901,
13,
462,
9651,
9071,
7270,
537,
3032,
15914,
29918,
726,
545,
29898,
726,
545,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
29892,
13,
462,
462,
462,
308,
9071,
7270,
537,
29889,
17171,
29918,
23827,
29918,
29940,
1955,
1529,
29931,
29892,
13,
462,
462,
462,
308,
18459,
29889,
3027,
29889,
1445,
2084,
29897,
13,
13,
4706,
17927,
29889,
3888,
877,
726,
545,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
29901,
525,
718,
851,
29898,
726,
545,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
876,
13,
13,
4706,
736,
18459,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
5191,
29918,
5824,
2176,
29918,
3177,
29918,
262,
29918,
15388,
29898,
15388,
29892,
2030,
29918,
3177,
29892,
716,
29918,
3177,
29892,
26328,
29918,
3177,
29922,
8516,
29892,
2446,
29918,
3177,
29922,
8516,
1125,
13,
13,
4706,
7573,
353,
5518,
29889,
3177,
29918,
8336,
29889,
18010,
13,
4706,
2988,
353,
5518,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
4706,
396,
591,
5191,
278,
2030,
29888,
24512,
2176,
411,
263,
716,
697,
13,
4706,
7573,
29889,
5992,
29898,
1025,
29918,
3177,
29897,
13,
13,
4706,
565,
26328,
29918,
3177,
338,
451,
6213,
29901,
13,
9651,
2988,
29889,
1482,
29898,
1457,
1133,
292,
29918,
3177,
29889,
4905,
29879,
29961,
29900,
1402,
716,
29918,
3177,
29889,
2080,
29879,
29961,
29900,
2314,
13,
13,
4706,
565,
2446,
29918,
3177,
338,
451,
6213,
29901,
13,
9651,
2988,
29889,
1482,
29898,
1482,
29918,
3177,
29889,
4905,
29879,
29961,
29900,
1402,
2446,
29918,
3177,
29889,
2080,
29879,
29961,
29900,
2314,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1653,
29918,
15388,
29918,
18010,
29918,
1454,
29918,
23090,
29918,
4746,
29918,
2204,
1581,
29918,
7564,
29918,
726,
1973,
29898,
15388,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
29922,
4571,
4198,
17171,
29918,
9851,
4037,
29892,
13,
462,
462,
462,
462,
4706,
17772,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
29922,
26813,
5550,
1718,
3919,
29918,
9851,
4037,
1125,
13,
13,
4706,
9995,
13,
13,
4706,
584,
3207,
5518,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
29901,
22471,
4198,
17171,
29918,
9851,
4037,
470,
402,
3927,
1799,
29979,
29918,
9851,
4037,
13,
4706,
584,
3207,
17772,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
29901,
10014,
2190,
5550,
1718,
3919,
29918,
9851,
4037,
470,
402,
4375,
1799,
29918,
9851,
4037,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
13,
4706,
17927,
29889,
3888,
877,
3258,
29918,
15388,
29918,
18010,
29918,
1454,
29918,
23090,
29918,
4746,
29918,
2204,
1581,
29918,
7564,
29918,
726,
1973,
29901,
2023,
1495,
13,
13,
4706,
289,
2272,
29889,
4703,
29889,
24645,
29889,
9482,
29889,
10599,
353,
525,
29907,
29979,
29907,
17101,
29915,
13,
13,
4706,
396,
396,
1269,
1203,
756,
3196,
5518,
2243,
1862,
29892,
607,
1544,
304,
278,
17279,
4944,
297,
289,
2272,
29889,
1272,
29889,
15388,
29879,
13,
4706,
396,
363,
5518,
297,
289,
2272,
29889,
1272,
29889,
15388,
29879,
29901,
13,
13,
4706,
363,
1203,
297,
289,
2272,
29889,
1272,
29889,
12650,
29901,
13,
13,
9651,
17927,
29889,
8382,
877,
3318,
29889,
978,
29901,
525,
718,
1203,
29889,
978,
29897,
13,
13,
9651,
363,
5518,
29918,
2536,
327,
297,
1203,
29889,
15388,
29918,
2536,
1862,
29901,
13,
18884,
5518,
353,
5518,
29918,
2536,
327,
29889,
15388,
13,
13,
18884,
396,
2045,
597,
4594,
29889,
2204,
1581,
29889,
990,
29914,
2248,
29889,
1961,
29914,
16618,
29901,
19737,
29914,
4081,
29879,
29914,
19159,
2909,
29914,
3399,
29918,
29879,
1240,
27421,
29914,
20284,
13,
18884,
17927,
29889,
3888,
877,
15388,
29889,
978,
29901,
525,
718,
5518,
29889,
978,
29897,
13,
13,
18884,
396,
1735,
871,
1999,
1581,
7463,
17279,
313,
17462,
11412,
17279,
408,
338,
29897,
13,
18884,
565,
451,
5518,
29889,
1509,
29918,
18010,
29901,
13,
13,
462,
1678,
17927,
29889,
8382,
877,
2528,
292,
7573,
2023,
1495,
13,
13,
462,
1678,
396,
445,
12778,
491,
2322,
263,
2943,
376,
24095,
10604,
29908,
322,
263,
2943,
376,
26023,
1509,
350,
29903,
4037,
29908,
13,
462,
1678,
5518,
29889,
1509,
29918,
18010,
353,
5852,
13,
13,
462,
1678,
396,
679,
278,
376,
26023,
1509,
350,
29903,
4037,
29908,
2943,
13,
462,
1678,
7573,
353,
5518,
29889,
3177,
29918,
8336,
29889,
18010,
13,
462,
1678,
2988,
353,
5518,
29889,
3177,
29918,
8336,
29889,
4965,
13,
13,
462,
1678,
396,
445,
2923,
1509,
2943,
947,
6336,
13125,
278,
2927,
310,
278,
5518,
13,
462,
1678,
528,
1664,
29918,
3177,
29918,
12765,
1509,
29918,
5824,
2176,
353,
7573,
29889,
657,
29898,
4247,
7270,
537,
29889,
4571,
4198,
17171,
29918,
9851,
4037,
29897,
13,
462,
1678,
528,
1664,
29918,
3177,
29918,
15388,
29918,
4905,
353,
7573,
29889,
657,
703,
24095,
10604,
1159,
13,
13,
462,
1678,
396,
4525,
18459,
934,
2224,
881,
367,
2854,
13,
462,
1678,
18459,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
353,
9071,
7270,
537,
3032,
657,
29918,
2204,
1581,
29918,
7564,
29918,
726,
545,
29918,
1853,
29918,
517,
29918,
1445,
29918,
24772,
29898,
15388,
29897,
13,
13,
462,
1678,
396,
29871,
29896,
11733,
29901,
17582,
338,
925,
263,
18459,
13,
462,
1678,
396,
308,
7084,
3992,
545,
1599,
360,
2593,
1509,
350,
29903,
4037,
29914,
29954,
6758,
29891,
350,
29903,
4037,
1599,
17582,
10604,
13,
462,
1678,
2927,
29918,
726,
545,
29918,
1445,
29918,
2084,
353,
18459,
29918,
1853,
29918,
517,
29918,
1445,
29918,
2084,
29961,
4247,
7270,
537,
29889,
17171,
29918,
23827,
29918,
15032,
1955,
29918,
4571,
4198,
17171,
29962,
13,
462,
1678,
17927,
29889,
8382,
877,
2780,
29918,
726,
545,
29918,
1445,
29918,
2084,
29901,
525,
718,
851,
29898,
2780,
29918,
726,
545,
29918,
1445,
29918,
2084,
876,
13,
13,
462,
1678,
565,
2927,
29918,
726,
545,
29918,
1445,
29918,
2084,
338,
451,
6213,
29901,
13,
13,
462,
4706,
17927,
29889,
8382,
877,
1168,
369,
1259,
17582,
2973,
3992,
545,
29901,
525,
718,
2927,
29918,
726,
545,
29918,
1445,
29918,
2084,
29897,
13,
13,
462,
4706,
17927,
29889,
8382,
877,
21898,
2224,
338,
2854,
1495,
13,
13,
462,
4706,
396,
1243,
565,
278,
1967,
18459,
2943,
756,
2307,
1063,
2825,
13,
462,
4706,
528,
1664,
29918,
3177,
29918,
4776,
29918,
3027,
353,
7573,
29889,
657,
703,
2940,
3992,
545,
1159,
13,
462,
4706,
565,
451,
528,
1664,
29918,
3177,
29918,
4776,
29918,
3027,
29901,
13,
13,
462,
9651,
528,
1664,
29918,
3177,
29918,
4776,
29918,
3027,
353,
7573,
29889,
1482,
29898,
1853,
2433,
2713,
1664,
4247,
26887,
2940,
1495,
13,
462,
9651,
528,
1664,
29918,
3177,
29918,
4776,
29918,
3027,
29889,
3027,
353,
289,
2272,
29889,
1272,
29889,
8346,
29889,
1359,
29898,
2780,
29918,
726,
545,
29918,
1445,
29918,
2084,
29897,
13,
13,
462,
9651,
396,
1544,
278,
7573,
13,
462,
9651,
2988,
29889,
1482,
29898,
845,
1664,
29918,
3177,
29918,
4776,
29918,
3027,
29889,
4905,
29879,
29961,
29900,
1402,
528,
1664,
29918,
3177,
29918,
12765,
1509,
29918,
5824,
2176,
29889,
2080,
29879,
29961,
29900,
2314,
13,
13,
462,
4706,
396,
565,
5518,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
1275,
350,
2965,
29891,
7799,
24095,
18545,
29889,
29954,
3927,
1799,
29979,
29918,
9851,
4037,
29901,
13,
462,
4706,
396,
13,
462,
4706,
396,
268,
17927,
29889,
8382,
877,
20083,
360,
2593,
1509,
17582,
9071,
411,
402,
6758,
29891,
17582,
9071,
29915,
1723,
13,
462,
4706,
396,
268,
528,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
353,
7573,
29889,
657,
29898,
29933,
2965,
29891,
7799,
24095,
18545,
29889,
29954,
3927,
1799,
29979,
29918,
9851,
4037,
29897,
13,
462,
4706,
396,
268,
565,
451,
528,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
29901,
13,
462,
4706,
396,
13,
462,
4706,
396,
308,
528,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
353,
7573,
29889,
1482,
29898,
1853,
2433,
2713,
1664,
4247,
29933,
29879,
2176,
29954,
6758,
29891,
1495,
13,
462,
4706,
396,
13,
462,
4706,
396,
308,
350,
2965,
29891,
7799,
24095,
18545,
3032,
6506,
29918,
5824,
2176,
29918,
3177,
29898,
15388,
29892,
13,
462,
4706,
396,
462,
462,
462,
418,
2030,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
12765,
1509,
29918,
5824,
2176,
29892,
13,
462,
4706,
396,
462,
462,
462,
418,
716,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
29892,
13,
462,
4706,
396,
462,
462,
462,
418,
26328,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
4776,
29918,
3027,
29892,
13,
462,
4706,
396,
462,
462,
462,
418,
2446,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
15388,
29918,
4905,
29897,
13,
13,
462,
1678,
396,
29871,
29906,
11733,
29901,
17582,
338,
17772,
13,
462,
1678,
396,
308,
390,
7210,
1599,
4103,
3560,
350,
29903,
4037,
29914,
29954,
605,
350,
29903,
4037,
1599,
17582,
10604,
13,
462,
1678,
25342,
5518,
29889,
1509,
29918,
3286,
862,
3819,
29901,
13,
13,
462,
4706,
17927,
29889,
8382,
877,
1168,
369,
1259,
4103,
3560,
17582,
1495,
13,
13,
462,
4706,
528,
1664,
29918,
3177,
29918,
3286,
3560,
29918,
272,
29918,
29050,
29918,
5824,
2176,
353,
7573,
29889,
657,
29898,
3286,
3560,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
29897,
13,
462,
4706,
565,
451,
528,
1664,
29918,
3177,
29918,
3286,
3560,
29918,
272,
29918,
29050,
29918,
5824,
2176,
29901,
13,
13,
462,
9651,
565,
17772,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
1275,
9071,
7270,
537,
29889,
29954,
4375,
1799,
29918,
9851,
4037,
29901,
13,
462,
18884,
528,
1664,
29918,
3177,
29918,
3286,
3560,
29918,
272,
29918,
29050,
29918,
5824,
2176,
353,
7573,
29889,
1482,
29898,
1853,
2433,
2713,
1664,
4247,
29933,
29879,
2176,
29954,
605,
1495,
13,
462,
9651,
1683,
29901,
13,
462,
18884,
528,
1664,
29918,
3177,
29918,
3286,
3560,
29918,
272,
29918,
29050,
29918,
5824,
2176,
353,
7573,
29889,
1482,
29898,
1853,
2433,
2713,
1664,
4247,
29933,
29879,
2176,
4300,
3560,
1495,
13,
13,
462,
9651,
528,
1664,
29918,
3177,
29918,
28212,
353,
7573,
29889,
1482,
29898,
1853,
2433,
2713,
1664,
4247,
28212,
1495,
13,
13,
462,
9651,
9071,
7270,
537,
29889,
6506,
29918,
5824,
2176,
29918,
3177,
29918,
262,
29918,
15388,
29898,
15388,
29892,
13,
462,
462,
462,
462,
418,
2030,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
12765,
1509,
29918,
5824,
2176,
29892,
13,
462,
462,
462,
462,
418,
716,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
3286,
3560,
29918,
272,
29918,
29050,
29918,
5824,
2176,
29892,
13,
462,
462,
462,
462,
418,
26328,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
28212,
29892,
13,
462,
462,
462,
462,
418,
2446,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
15388,
29918,
4905,
29897,
13,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
17927,
29889,
8382,
877,
1168,
369,
1259,
17582,
2973,
12545,
9159,
1495,
13,
462,
4706,
396,
491,
2322,
727,
338,
925,
263,
2923,
1509,
24512,
2176,
2825,
773,
278,
2927,
310,
278,
5518,
13,
13,
462,
4706,
565,
5518,
29918,
4381,
29918,
5824,
2176,
29918,
1853,
1275,
9071,
7270,
537,
29889,
29954,
3927,
1799,
29979,
29918,
9851,
4037,
29901,
13,
13,
462,
9651,
17927,
29889,
8382,
877,
20083,
360,
2593,
1509,
17582,
9071,
411,
402,
6758,
29891,
17582,
9071,
1495,
13,
462,
9651,
528,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
353,
7573,
29889,
657,
29898,
4247,
7270,
537,
29889,
29954,
3927,
1799,
29979,
29918,
9851,
4037,
29897,
13,
462,
9651,
565,
451,
528,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
29901,
13,
462,
18884,
528,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
353,
7573,
29889,
1482,
29898,
1853,
2433,
2713,
1664,
4247,
29933,
29879,
2176,
29954,
6758,
29891,
1495,
13,
13,
462,
18884,
9071,
7270,
537,
29889,
6506,
29918,
5824,
2176,
29918,
3177,
29918,
262,
29918,
15388,
29898,
15388,
29892,
13,
462,
462,
462,
462,
3986,
2030,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
12765,
1509,
29918,
5824,
2176,
29892,
13,
462,
462,
462,
462,
3986,
716,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
3820,
2209,
29891,
29918,
5824,
2176,
29892,
13,
462,
462,
462,
462,
3986,
26328,
29918,
3177,
29922,
8516,
29892,
13,
462,
462,
462,
462,
3986,
2446,
29918,
3177,
29922,
845,
1664,
29918,
3177,
29918,
15388,
29918,
4905,
29897,
13,
13,
18884,
1683,
29901,
13,
462,
1678,
17927,
29889,
8382,
877,
24095,
756,
2307,
263,
2943,
2023,
1495,
13,
13,
4706,
17927,
29889,
3888,
877,
3258,
29918,
15388,
29918,
18010,
29918,
1454,
29918,
23090,
29918,
4746,
29918,
2204,
1581,
29918,
7564,
29918,
726,
1973,
29901,
25679,
1495,
2
] |
trivector/trivector.py | nklapste/trivector | 1 | 70706 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Image conversion functionality for trivector"""
from enum import Enum
import numpy as np
import svgwrite
import cv2
import progressbar
def upper_tri_sum(d3array: np.ndarray) -> np.ndarray:
"""Get a 3D image array's upper diagonal's pixel color average
:param d3array: 3D image array derived from :func:`cv2.imread`
Treat the 3D array as 2d array. Having the innermost array (pixel BGR
values) be considered base values to be averaged.
:return: BGR array of the average color of the upper diagonal of the
3D image array
"""
x, y, _ = d3array.shape
tri = []
for i in range(x):
if i > y:
break
for j in range(y - i):
tri.append(d3array[i][i + j])
return np.sum(tri, axis=0) // len(tri)
def lower_tri_sum(d3array: np.ndarray) -> np.ndarray:
"""Get a 3D image array's lower diagonal's pixel color average
:param d3array: 3D image array derived from :func:`cv2.imread`
Treat the 3D array as 2d array. Having the innermost array (pixel BGR
values) be considered base values to be averaged.
.. note::
If the lower diagonal cannot be computed (eg: flat/malformed 3D array)
use the 3D image array's upper diagonal's pixel color average instead.
:return: BGR array of the average color of the lower diagonal of the
3D image array
"""
x, y, _ = d3array.shape
tri = []
for i in range(x):
if i > y:
break
for j in range(i):
tri.append(d3array[i][j])
# if bottom tri is empty use the upper tri's sum
if not tri:
return upper_tri_sum(d3array)
return np.sum(tri, axis=0) // len(tri)
def vectorize_sector_left(sub_img: np.ndarray, svg_drawing: svgwrite.Drawing,
x: int, y: int, cut_size: int):
"""Add two triangles to ``svg_drawing`` whose colors are derived from
the color averages from the top and bottom diagonals of the 3D BGR image
array of the sub image"""
b, g, r = upper_tri_sum(sub_img)
svg_drawing.add(
svg_drawing.polygon(
[(x, y), (x + cut_size, y), (x + cut_size, y + cut_size)],
fill=svgwrite.rgb(r, g, b, "RGB")
)
)
b, g, r = lower_tri_sum(sub_img)
svg_drawing.add(
svg_drawing.polygon(
[(x, y), (x, y + cut_size), (x + cut_size, y + cut_size)],
fill=svgwrite.rgb(r, g, b, "RGB")
)
)
def vectorize_sector_right(sub_img: np.ndarray, svg_drawing: svgwrite.Drawing,
x: int, y: int, cut_size: int):
"""Add two triangles to ``svg_drawing`` whose colors are derived from
the color averages from the top and bottom diagonals of the 3D BGR image
array of the sub image"""
b, g, r = upper_tri_sum(sub_img)
svg_drawing.add(
svg_drawing.polygon(
[(x, y + cut_size), (x + cut_size, y + cut_size), (x + cut_size, y)],
fill=svgwrite.rgb(r, g, b, "RGB")
)
)
b, g, r = lower_tri_sum(sub_img)
svg_drawing.add(
svg_drawing.polygon(
[(x, y + cut_size), (x, y), (x + cut_size, y)],
fill=svgwrite.rgb(r, g, b, "RGB")
)
)
class DiagonalStyle(Enum):
"""Styling options noting the diagonal arrangement of the
triangle sectors"""
right = "right"
left = "left"
alternating = "alternating"
def __str__(self):
return self.value
def trivector(image_path: str, cut_size: int, output_path: str,
diagonal_style: DiagonalStyle = DiagonalStyle.alternating):
"""Convert an image into a SVG vector image composed of triangular sectors
:param image_path: path to the image to trivector
:param cut_size: size in pixels for each triangle sector
:param diagonal_style: diagonal arrangement of the triangle sectors
:param output_path: path to write the trivectored image
"""
image = cv2.imread(image_path) # pylint:disable=no-member
height, width, _ = image.shape
width_slices = range(0, width, cut_size)
height_slices = range(0, height, cut_size)
svg_drawing = svgwrite.Drawing(
output_path,
profile="full",
size=(len(width_slices)*cut_size, len(height_slices)*cut_size)
)
# start up the progress bar
# each image sector is one tick one the progress bar
bar = progressbar.ProgressBar(max_value=len(width_slices)*len(height_slices))
counter_2 = 0
sector_num = 0
for y in height_slices:
counter_1 = counter_2
counter_2 += 1
for x in width_slices:
sector_image = image[y:y + cut_size, x:x + cut_size]
if (diagonal_style == DiagonalStyle.left) or \
(diagonal_style == DiagonalStyle.alternating and counter_1 % 2):
vectorize_sector_left(sector_image, svg_drawing, x, y, cut_size)
else:
sector_image = np.rot90(sector_image, axes=(0, 1))
vectorize_sector_right(sector_image, svg_drawing, x, y, cut_size)
sector_num += 1
counter_1 += 1
bar.update(sector_num)
svg_drawing.save()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
15945,
29908,
2940,
11301,
9863,
363,
3367,
8111,
15945,
29908,
13,
13,
3166,
14115,
1053,
1174,
398,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
25773,
3539,
13,
13,
5215,
13850,
29906,
13,
5215,
6728,
1646,
13,
13,
13,
1753,
7568,
29918,
3626,
29918,
2083,
29898,
29881,
29941,
2378,
29901,
7442,
29889,
299,
2378,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
1678,
9995,
2577,
263,
29871,
29941,
29928,
1967,
1409,
29915,
29879,
7568,
19640,
29915,
29879,
15526,
2927,
6588,
13,
13,
1678,
584,
3207,
270,
29941,
2378,
29901,
29871,
29941,
29928,
1967,
1409,
10723,
515,
584,
9891,
18078,
11023,
29906,
29889,
326,
949,
29952,
13,
13,
1678,
6479,
271,
278,
29871,
29941,
29928,
1409,
408,
29871,
29906,
29881,
1409,
29889,
15950,
278,
7622,
837,
520,
1409,
313,
29886,
15711,
350,
14345,
13,
1678,
1819,
29897,
367,
5545,
2967,
1819,
304,
367,
4759,
4063,
29889,
13,
13,
1678,
584,
2457,
29901,
350,
14345,
1409,
310,
278,
6588,
2927,
310,
278,
7568,
19640,
310,
278,
13,
308,
29941,
29928,
1967,
1409,
13,
1678,
9995,
13,
1678,
921,
29892,
343,
29892,
903,
353,
270,
29941,
2378,
29889,
12181,
13,
1678,
3367,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29916,
1125,
13,
4706,
565,
474,
1405,
343,
29901,
13,
9651,
2867,
13,
4706,
363,
432,
297,
3464,
29898,
29891,
448,
474,
1125,
13,
9651,
3367,
29889,
4397,
29898,
29881,
29941,
2378,
29961,
29875,
3816,
29875,
718,
432,
2314,
13,
1678,
736,
7442,
29889,
2083,
29898,
3626,
29892,
9685,
29922,
29900,
29897,
849,
7431,
29898,
3626,
29897,
13,
13,
13,
1753,
5224,
29918,
3626,
29918,
2083,
29898,
29881,
29941,
2378,
29901,
7442,
29889,
299,
2378,
29897,
1599,
7442,
29889,
299,
2378,
29901,
13,
1678,
9995,
2577,
263,
29871,
29941,
29928,
1967,
1409,
29915,
29879,
5224,
19640,
29915,
29879,
15526,
2927,
6588,
13,
13,
1678,
584,
3207,
270,
29941,
2378,
29901,
29871,
29941,
29928,
1967,
1409,
10723,
515,
584,
9891,
18078,
11023,
29906,
29889,
326,
949,
29952,
13,
13,
1678,
6479,
271,
278,
29871,
29941,
29928,
1409,
408,
29871,
29906,
29881,
1409,
29889,
15950,
278,
7622,
837,
520,
1409,
313,
29886,
15711,
350,
14345,
13,
1678,
1819,
29897,
367,
5545,
2967,
1819,
304,
367,
4759,
4063,
29889,
13,
13,
1678,
6317,
4443,
1057,
13,
13,
4706,
960,
278,
5224,
19640,
2609,
367,
15712,
313,
387,
29901,
12151,
29914,
5156,
15628,
29871,
29941,
29928,
1409,
29897,
13,
4706,
671,
278,
29871,
29941,
29928,
1967,
1409,
29915,
29879,
7568,
19640,
29915,
29879,
15526,
2927,
6588,
2012,
29889,
13,
13,
1678,
584,
2457,
29901,
350,
14345,
1409,
310,
278,
6588,
2927,
310,
278,
5224,
19640,
310,
278,
13,
308,
29941,
29928,
1967,
1409,
13,
1678,
9995,
13,
1678,
921,
29892,
343,
29892,
903,
353,
270,
29941,
2378,
29889,
12181,
13,
1678,
3367,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29916,
1125,
13,
4706,
565,
474,
1405,
343,
29901,
13,
9651,
2867,
13,
4706,
363,
432,
297,
3464,
29898,
29875,
1125,
13,
9651,
3367,
29889,
4397,
29898,
29881,
29941,
2378,
29961,
29875,
3816,
29926,
2314,
13,
13,
1678,
396,
565,
5970,
3367,
338,
4069,
671,
278,
7568,
3367,
29915,
29879,
2533,
13,
1678,
565,
451,
3367,
29901,
13,
4706,
736,
7568,
29918,
3626,
29918,
2083,
29898,
29881,
29941,
2378,
29897,
13,
1678,
736,
7442,
29889,
2083,
29898,
3626,
29892,
9685,
29922,
29900,
29897,
849,
7431,
29898,
3626,
29897,
13,
13,
13,
1753,
4608,
675,
29918,
344,
2801,
29918,
1563,
29898,
1491,
29918,
2492,
29901,
7442,
29889,
299,
2378,
29892,
25773,
29918,
4012,
292,
29901,
25773,
3539,
29889,
16327,
29892,
13,
462,
3986,
921,
29901,
938,
29892,
343,
29901,
938,
29892,
5700,
29918,
2311,
29901,
938,
1125,
13,
1678,
9995,
2528,
1023,
3367,
19536,
304,
4954,
15120,
29918,
4012,
292,
16159,
5069,
11955,
526,
10723,
515,
13,
1678,
278,
2927,
4759,
1179,
515,
278,
2246,
322,
5970,
7936,
265,
1338,
310,
278,
29871,
29941,
29928,
350,
14345,
1967,
13,
1678,
1409,
310,
278,
1014,
1967,
15945,
29908,
13,
1678,
289,
29892,
330,
29892,
364,
353,
7568,
29918,
3626,
29918,
2083,
29898,
1491,
29918,
2492,
29897,
13,
1678,
25773,
29918,
4012,
292,
29889,
1202,
29898,
13,
4706,
25773,
29918,
4012,
292,
29889,
3733,
17125,
29898,
13,
9651,
17288,
29916,
29892,
343,
511,
313,
29916,
718,
5700,
29918,
2311,
29892,
343,
511,
313,
29916,
718,
5700,
29918,
2311,
29892,
343,
718,
5700,
29918,
2311,
29897,
1402,
13,
9651,
5445,
29922,
15120,
3539,
29889,
23973,
29898,
29878,
29892,
330,
29892,
289,
29892,
376,
28212,
1159,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
289,
29892,
330,
29892,
364,
353,
5224,
29918,
3626,
29918,
2083,
29898,
1491,
29918,
2492,
29897,
13,
1678,
25773,
29918,
4012,
292,
29889,
1202,
29898,
13,
4706,
25773,
29918,
4012,
292,
29889,
3733,
17125,
29898,
13,
9651,
17288,
29916,
29892,
343,
511,
313,
29916,
29892,
343,
718,
5700,
29918,
2311,
511,
313,
29916,
718,
5700,
29918,
2311,
29892,
343,
718,
5700,
29918,
2311,
29897,
1402,
13,
9651,
5445,
29922,
15120,
3539,
29889,
23973,
29898,
29878,
29892,
330,
29892,
289,
29892,
376,
28212,
1159,
13,
4706,
1723,
13,
1678,
1723,
13,
13,
13,
1753,
4608,
675,
29918,
344,
2801,
29918,
1266,
29898,
1491,
29918,
2492,
29901,
7442,
29889,
299,
2378,
29892,
25773,
29918,
4012,
292,
29901,
25773,
3539,
29889,
16327,
29892,
13,
462,
965,
921,
29901,
938,
29892,
343,
29901,
938,
29892,
5700,
29918,
2311,
29901,
938,
1125,
13,
1678,
9995,
2528,
1023,
3367,
19536,
304,
4954,
15120,
29918,
4012,
292,
16159,
5069,
11955,
526,
10723,
515,
13,
1678,
278,
2927,
4759,
1179,
515,
278,
2246,
322,
5970,
7936,
265,
1338,
310,
278,
29871,
29941,
29928,
350,
14345,
1967,
13,
1678,
1409,
310,
278,
1014,
1967,
15945,
29908,
13,
1678,
289,
29892,
330,
29892,
364,
353,
7568,
29918,
3626,
29918,
2083,
29898,
1491,
29918,
2492,
29897,
13,
1678,
25773,
29918,
4012,
292,
29889,
1202,
29898,
13,
4706,
25773,
29918,
4012,
292,
29889,
3733,
17125,
29898,
13,
9651,
17288,
29916,
29892,
343,
718,
5700,
29918,
2311,
511,
313,
29916,
718,
5700,
29918,
2311,
29892,
343,
718,
5700,
29918,
2311,
511,
313,
29916,
718,
5700,
29918,
2311,
29892,
343,
29897,
1402,
13,
9651,
5445,
29922,
15120,
3539,
29889,
23973,
29898,
29878,
29892,
330,
29892,
289,
29892,
376,
28212,
1159,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
289,
29892,
330,
29892,
364,
353,
5224,
29918,
3626,
29918,
2083,
29898,
1491,
29918,
2492,
29897,
13,
1678,
25773,
29918,
4012,
292,
29889,
1202,
29898,
13,
4706,
25773,
29918,
4012,
292,
29889,
3733,
17125,
29898,
13,
9651,
17288,
29916,
29892,
343,
718,
5700,
29918,
2311,
511,
313,
29916,
29892,
343,
511,
313,
29916,
718,
5700,
29918,
2311,
29892,
343,
29897,
1402,
13,
9651,
5445,
29922,
15120,
3539,
29889,
23973,
29898,
29878,
29892,
330,
29892,
289,
29892,
376,
28212,
1159,
13,
4706,
1723,
13,
1678,
1723,
13,
13,
13,
1990,
4671,
351,
7177,
5568,
29898,
16854,
1125,
13,
1678,
9995,
855,
29891,
1847,
3987,
451,
292,
278,
19640,
24628,
310,
278,
13,
1678,
17205,
409,
14359,
15945,
29908,
13,
1678,
1492,
353,
376,
1266,
29908,
13,
1678,
2175,
353,
376,
1563,
29908,
13,
1678,
5136,
1218,
353,
376,
26123,
1218,
29908,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
1583,
29889,
1767,
13,
13,
13,
1753,
3367,
8111,
29898,
3027,
29918,
2084,
29901,
851,
29892,
5700,
29918,
2311,
29901,
938,
29892,
1962,
29918,
2084,
29901,
851,
29892,
13,
795,
19640,
29918,
3293,
29901,
4671,
351,
7177,
5568,
353,
4671,
351,
7177,
5568,
29889,
26123,
1218,
1125,
13,
1678,
9995,
18455,
385,
1967,
964,
263,
13955,
29954,
4608,
1967,
13725,
310,
3367,
6825,
409,
14359,
13,
13,
1678,
584,
3207,
1967,
29918,
2084,
29901,
2224,
304,
278,
1967,
304,
3367,
8111,
13,
1678,
584,
3207,
5700,
29918,
2311,
29901,
2159,
297,
17036,
363,
1269,
17205,
17535,
13,
1678,
584,
3207,
19640,
29918,
3293,
29901,
19640,
24628,
310,
278,
17205,
409,
14359,
13,
1678,
584,
3207,
1962,
29918,
2084,
29901,
2224,
304,
2436,
278,
3367,
8111,
287,
1967,
13,
1678,
9995,
13,
1678,
1967,
353,
13850,
29906,
29889,
326,
949,
29898,
3027,
29918,
2084,
29897,
29871,
396,
282,
2904,
524,
29901,
20472,
29922,
1217,
29899,
14242,
13,
13,
1678,
3171,
29892,
2920,
29892,
903,
353,
1967,
29889,
12181,
13,
13,
1678,
2920,
29918,
29879,
29399,
353,
3464,
29898,
29900,
29892,
2920,
29892,
5700,
29918,
2311,
29897,
13,
1678,
3171,
29918,
29879,
29399,
353,
3464,
29898,
29900,
29892,
3171,
29892,
5700,
29918,
2311,
29897,
13,
1678,
25773,
29918,
4012,
292,
353,
25773,
3539,
29889,
16327,
29898,
13,
4706,
1962,
29918,
2084,
29892,
13,
4706,
8722,
543,
8159,
613,
13,
4706,
2159,
7607,
2435,
29898,
2103,
29918,
29879,
29399,
11877,
7582,
29918,
2311,
29892,
7431,
29898,
3545,
29918,
29879,
29399,
11877,
7582,
29918,
2311,
29897,
13,
1678,
1723,
13,
13,
1678,
396,
1369,
701,
278,
6728,
2594,
13,
1678,
396,
1269,
1967,
17535,
338,
697,
16892,
697,
278,
6728,
2594,
13,
1678,
2594,
353,
6728,
1646,
29889,
14470,
4297,
29898,
3317,
29918,
1767,
29922,
2435,
29898,
2103,
29918,
29879,
29399,
11877,
2435,
29898,
3545,
29918,
29879,
29399,
876,
13,
1678,
6795,
29918,
29906,
353,
29871,
29900,
13,
1678,
17535,
29918,
1949,
353,
29871,
29900,
13,
1678,
363,
343,
297,
3171,
29918,
29879,
29399,
29901,
13,
4706,
6795,
29918,
29896,
353,
6795,
29918,
29906,
13,
4706,
6795,
29918,
29906,
4619,
29871,
29896,
13,
4706,
363,
921,
297,
2920,
29918,
29879,
29399,
29901,
13,
9651,
17535,
29918,
3027,
353,
1967,
29961,
29891,
29901,
29891,
718,
5700,
29918,
2311,
29892,
921,
29901,
29916,
718,
5700,
29918,
2311,
29962,
13,
9651,
565,
313,
6051,
351,
7177,
29918,
3293,
1275,
4671,
351,
7177,
5568,
29889,
1563,
29897,
470,
320,
13,
462,
1678,
313,
6051,
351,
7177,
29918,
3293,
1275,
4671,
351,
7177,
5568,
29889,
26123,
1218,
322,
6795,
29918,
29896,
1273,
29871,
29906,
1125,
13,
18884,
4608,
675,
29918,
344,
2801,
29918,
1563,
29898,
344,
2801,
29918,
3027,
29892,
25773,
29918,
4012,
292,
29892,
921,
29892,
343,
29892,
5700,
29918,
2311,
29897,
13,
9651,
1683,
29901,
13,
18884,
17535,
29918,
3027,
353,
7442,
29889,
5450,
29929,
29900,
29898,
344,
2801,
29918,
3027,
29892,
27815,
7607,
29900,
29892,
29871,
29896,
876,
13,
18884,
4608,
675,
29918,
344,
2801,
29918,
1266,
29898,
344,
2801,
29918,
3027,
29892,
25773,
29918,
4012,
292,
29892,
921,
29892,
343,
29892,
5700,
29918,
2311,
29897,
13,
9651,
17535,
29918,
1949,
4619,
29871,
29896,
13,
9651,
6795,
29918,
29896,
4619,
29871,
29896,
13,
9651,
2594,
29889,
5504,
29898,
344,
2801,
29918,
1949,
29897,
13,
13,
1678,
25773,
29918,
4012,
292,
29889,
7620,
580,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.