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
|
---|---|---|---|---|---|
notebooks/deliver/bawe_rnn_train.py | grchristensen/avpd | 0 | 56205 | from datetime import datetime
import os
from os.path import join
import pandas as pd
from pathlib import Path
import pickle
import spacy
import sys
import torch
from torch import optim
from torch.nn import Embedding, LSTM
from torch.nn.functional import mse_loss
from torch.utils.data import TensorDataset
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
project_root = Path('..')
sys.path.append(os.path.abspath(project_root))
from notebooks.utils import init_data_dir # noqa
from notebooks import pipes # noqa
from notebooks.datatools import AuthorDataset, EqualOpDataLoader # noqa
from notebooks.nets import EuclideanDiscriminator, PackedEmbedder, StyleEncoder, Seq2Vec # noqa
from notebooks.utils import POSVocab # noqa
init_data_dir(project_root)
preprocess_path = join(project_root, Path('data/preprocess'))
dev = torch.device(0)
nlp = spacy.load('en_core_web_sm')
pos_vocab = POSVocab()
writer_dir = join(project_root, 'runs')
writer = SummaryWriter(join(writer_dir, f'{datetime.now()}-bawe-par-encoder'))
reprocess = False
train_data_path = join(preprocess_path, 'bawe_train_sentences_tokenized.hdf5')
valid_data_path = join(preprocess_path, 'bawe_valid_sentences_tokenized.hdf5')
train_data_exists = os.path.exists(train_data_path)
valid_data_exists = os.path.exists(valid_data_path)
pipeline = pipes.POSTokenize(nlp=nlp, pos_vocab=pos_vocab, show_loading=True)
if not (train_data_exists and valid_data_exists) or reprocess:
print('Processing...', flush=True)
train_df = pd.read_hdf(join(preprocess_path, 'bawe_train_sentences.hdf5'))
valid_df = pd.read_hdf(join(preprocess_path, 'bawe_valid_sentences.hdf5'))
train_data = pipeline(train_df)
valid_data = pipeline(valid_df)
train_data.to_hdf(train_data_path, 'bawe_train_sentences_tokenized')
valid_data.to_hdf(valid_data_path, 'bawe_valid_sentences_tokenized')
else:
train_data = pd.read_hdf(train_data_path)
valid_data = pd.read_hdf(valid_data_path)
train_data.loc[(28, 0, 1)]
num_sentences = 20
pipeline = pipes.GroupSentences(n=num_sentences)
train_data = pipeline(train_data)
valid_data = pipeline(valid_data)
train_set = AuthorDataset(train_data)
valid_set = AuthorDataset(valid_data)
embedder = PackedEmbedder(Embedding(len(pos_vocab), 10,
padding_idx=pos_vocab['<pad>']))
sentence_encoder = Seq2Vec(LSTM(10, 5))
style_encoder = StyleEncoder(embedder, sentence_encoder).to(dev)
style_discriminator = EuclideanDiscriminator(n=num_sentences).to(dev)
torch.seed()
# Hyperparameters
batch_count = 1000
lr = 1e-6
opt = optim.SGD([{'params': style_discriminator.parameters()},
{'params': style_encoder.parameters()}], lr=lr)
criterion = mse_loss
bs = 75
pipeline = pipes.PackSequence(dev=dev)
train_dl = EqualOpDataLoader(train_set, bs=bs, pipeline=pipeline)
valid_dl = EqualOpDataLoader(valid_set, bs=bs, pipeline=pipeline)
def fit(validate=True, validate_every=100):
train_dl.batch_count = batch_count
for index, ((x1b, y1b), (x2b, y2b)) in tqdm(enumerate(train_dl),
total=len(train_dl)):
x1_encoding = style_encoder(x1b)
x2_encoding = style_encoder(x2b)
pred = style_discriminator(x1_encoding, x2_encoding).squeeze(1)
yb = y_difference(y1b, y2b).to(dtype=torch.float)
loss = criterion(pred, yb)
loss.backward()
opt.step()
opt.zero_grad()
writer.add_scalar('Training Loss', loss, index)
writer.flush()
if validate:
if index % 100 == 0:
valid_loss, valid_acc = evaluate(valid_dl, give_acc=True)
writer.add_scalar('Validation Loss', valid_loss, index)
writer.add_scalar('Validation Accuracy', valid_acc, index)
writer.flush()
def y_difference(y1, y2):
return torch.logical_not((y1 == y2)).to(dtype=int).to(dev)
def evaluate(dl, give_acc=False):
with torch.no_grad():
preds_y = [(style_discriminator(style_encoder(x1b),
style_encoder(x2b)),
y_difference(y1b, y2b))
for (x1b, y1b), (x2b, y2b) in dl]
losses = [criterion(preds_b.squeeze(1), yb) for preds_b, yb in preds_y]
loss = sum(losses) / len(losses)
if give_acc:
accs = [accuracy(preds_b, yb) for preds_b, yb in preds_y]
acc = sum(accs) / len(accs)
return loss, acc
return loss
def accuracy(out, y):
preds = out > 0.5
return (preds == y).float().mean()
fit(validate=False)
outputs_dir = join(project_root, 'outputs')
if not os.path.isdir(outputs_dir):
os.mkdir(outputs_dir)
torch.save(style_encoder.state_dict(),
join(outputs_dir, 'bawe_style_encoder_sd.pt'))
torch.save(style_discriminator.state_dict(),
join(outputs_dir, 'bawe_style_discriminator_sd.pt'))
writer.close()
| [
1,
515,
12865,
1053,
12865,
13,
5215,
2897,
13,
3166,
2897,
29889,
2084,
1053,
5988,
13,
5215,
11701,
408,
10518,
13,
3166,
2224,
1982,
1053,
10802,
13,
5215,
5839,
280,
13,
5215,
805,
4135,
13,
5215,
10876,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
1053,
5994,
13,
3166,
4842,
305,
29889,
15755,
1053,
2812,
2580,
8497,
29892,
365,
1254,
29924,
13,
3166,
4842,
305,
29889,
15755,
29889,
2220,
284,
1053,
286,
344,
29918,
6758,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
323,
6073,
16390,
24541,
13,
3166,
4842,
305,
29889,
13239,
29889,
20158,
3377,
1053,
6991,
5219,
10507,
13,
3166,
260,
29939,
18933,
1053,
260,
29939,
18933,
13,
13,
4836,
29918,
4632,
353,
10802,
877,
636,
1495,
13,
9675,
29889,
2084,
29889,
4397,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
4836,
29918,
4632,
876,
13,
3166,
451,
19273,
29879,
29889,
13239,
1053,
2069,
29918,
1272,
29918,
3972,
29871,
396,
694,
25621,
13,
13,
3166,
451,
19273,
29879,
1053,
8450,
267,
29871,
396,
694,
25621,
13,
3166,
451,
19273,
29879,
29889,
4130,
1219,
3775,
1053,
13361,
16390,
24541,
29892,
11243,
284,
11746,
1469,
10036,
29871,
396,
694,
25621,
13,
3166,
451,
19273,
29879,
29889,
1212,
29879,
1053,
382,
27511,
4205,
29883,
20386,
1061,
29892,
18744,
287,
6026,
2580,
672,
29892,
22135,
8566,
6119,
29892,
25981,
29906,
25987,
29871,
396,
694,
25621,
13,
3166,
451,
19273,
29879,
29889,
13239,
1053,
349,
3267,
29963,
542,
370,
29871,
396,
694,
25621,
13,
13,
2344,
29918,
1272,
29918,
3972,
29898,
4836,
29918,
4632,
29897,
13,
13,
1457,
5014,
29918,
2084,
353,
5988,
29898,
4836,
29918,
4632,
29892,
10802,
877,
1272,
29914,
1457,
5014,
8785,
13,
13,
3359,
353,
4842,
305,
29889,
10141,
29898,
29900,
29897,
13,
12938,
29886,
353,
805,
4135,
29889,
1359,
877,
264,
29918,
3221,
29918,
2676,
29918,
3844,
1495,
13,
1066,
29918,
29894,
542,
370,
353,
349,
3267,
29963,
542,
370,
580,
13,
13,
13236,
29918,
3972,
353,
5988,
29898,
4836,
29918,
4632,
29892,
525,
3389,
29879,
1495,
13,
13,
13236,
353,
6991,
5219,
10507,
29898,
7122,
29898,
13236,
29918,
3972,
29892,
285,
29915,
29912,
12673,
29889,
3707,
580,
7402,
2291,
705,
29899,
862,
29899,
3977,
6119,
8785,
13,
13,
276,
5014,
353,
7700,
13,
13,
14968,
29918,
1272,
29918,
2084,
353,
5988,
29898,
1457,
5014,
29918,
2084,
29892,
525,
2291,
705,
29918,
14968,
29918,
18616,
2063,
29918,
6979,
1891,
29889,
29882,
2176,
29945,
1495,
13,
3084,
29918,
1272,
29918,
2084,
353,
5988,
29898,
1457,
5014,
29918,
2084,
29892,
525,
2291,
705,
29918,
3084,
29918,
18616,
2063,
29918,
6979,
1891,
29889,
29882,
2176,
29945,
1495,
13,
13,
14968,
29918,
1272,
29918,
9933,
353,
2897,
29889,
2084,
29889,
9933,
29898,
14968,
29918,
1272,
29918,
2084,
29897,
13,
3084,
29918,
1272,
29918,
9933,
353,
2897,
29889,
2084,
29889,
9933,
29898,
3084,
29918,
1272,
29918,
2084,
29897,
13,
13,
13096,
5570,
353,
8450,
267,
29889,
5438,
4476,
675,
29898,
12938,
29886,
29922,
12938,
29886,
29892,
926,
29918,
29894,
542,
370,
29922,
1066,
29918,
29894,
542,
370,
29892,
1510,
29918,
13234,
29922,
5574,
29897,
13,
13,
361,
451,
313,
14968,
29918,
1272,
29918,
9933,
322,
2854,
29918,
1272,
29918,
9933,
29897,
470,
337,
5014,
29901,
13,
1678,
1596,
877,
7032,
292,
856,
742,
28371,
29922,
5574,
29897,
13,
13,
1678,
7945,
29918,
2176,
353,
10518,
29889,
949,
29918,
29882,
2176,
29898,
7122,
29898,
1457,
5014,
29918,
2084,
29892,
525,
2291,
705,
29918,
14968,
29918,
18616,
2063,
29889,
29882,
2176,
29945,
8785,
13,
1678,
2854,
29918,
2176,
353,
10518,
29889,
949,
29918,
29882,
2176,
29898,
7122,
29898,
1457,
5014,
29918,
2084,
29892,
525,
2291,
705,
29918,
3084,
29918,
18616,
2063,
29889,
29882,
2176,
29945,
8785,
13,
13,
1678,
7945,
29918,
1272,
353,
16439,
29898,
14968,
29918,
2176,
29897,
13,
1678,
2854,
29918,
1272,
353,
16439,
29898,
3084,
29918,
2176,
29897,
13,
13,
1678,
7945,
29918,
1272,
29889,
517,
29918,
29882,
2176,
29898,
14968,
29918,
1272,
29918,
2084,
29892,
525,
2291,
705,
29918,
14968,
29918,
18616,
2063,
29918,
6979,
1891,
1495,
13,
1678,
2854,
29918,
1272,
29889,
517,
29918,
29882,
2176,
29898,
3084,
29918,
1272,
29918,
2084,
29892,
525,
2291,
705,
29918,
3084,
29918,
18616,
2063,
29918,
6979,
1891,
1495,
13,
2870,
29901,
13,
1678,
7945,
29918,
1272,
353,
10518,
29889,
949,
29918,
29882,
2176,
29898,
14968,
29918,
1272,
29918,
2084,
29897,
13,
1678,
2854,
29918,
1272,
353,
10518,
29889,
949,
29918,
29882,
2176,
29898,
3084,
29918,
1272,
29918,
2084,
29897,
13,
13,
14968,
29918,
1272,
29889,
2029,
15625,
29906,
29947,
29892,
29871,
29900,
29892,
29871,
29896,
4638,
13,
13,
1949,
29918,
18616,
2063,
353,
29871,
29906,
29900,
13,
13,
13096,
5570,
353,
8450,
267,
29889,
4782,
29903,
296,
2063,
29898,
29876,
29922,
1949,
29918,
18616,
2063,
29897,
13,
13,
14968,
29918,
1272,
353,
16439,
29898,
14968,
29918,
1272,
29897,
13,
3084,
29918,
1272,
353,
16439,
29898,
3084,
29918,
1272,
29897,
13,
13,
14968,
29918,
842,
353,
13361,
16390,
24541,
29898,
14968,
29918,
1272,
29897,
13,
3084,
29918,
842,
353,
13361,
16390,
24541,
29898,
3084,
29918,
1272,
29897,
13,
13,
17987,
672,
353,
18744,
287,
6026,
2580,
672,
29898,
6026,
2580,
8497,
29898,
2435,
29898,
1066,
29918,
29894,
542,
370,
511,
29871,
29896,
29900,
29892,
13,
462,
462,
1678,
7164,
29918,
13140,
29922,
1066,
29918,
29894,
542,
370,
1839,
29966,
8305,
29958,
25901,
13,
18616,
663,
29918,
3977,
6119,
353,
25981,
29906,
25987,
29898,
29931,
1254,
29924,
29898,
29896,
29900,
29892,
29871,
29945,
876,
13,
13,
3293,
29918,
3977,
6119,
353,
22135,
8566,
6119,
29898,
17987,
672,
29892,
10541,
29918,
3977,
6119,
467,
517,
29898,
3359,
29897,
13,
3293,
29918,
2218,
29883,
20386,
1061,
353,
382,
27511,
4205,
29883,
20386,
1061,
29898,
29876,
29922,
1949,
29918,
18616,
2063,
467,
517,
29898,
3359,
29897,
13,
13,
7345,
305,
29889,
26776,
580,
13,
13,
29937,
26078,
16744,
13,
16175,
29918,
2798,
353,
29871,
29896,
29900,
29900,
29900,
13,
29212,
353,
29871,
29896,
29872,
29899,
29953,
13,
3670,
353,
5994,
29889,
26016,
29928,
4197,
10998,
7529,
2396,
3114,
29918,
2218,
29883,
20386,
1061,
29889,
16744,
580,
1118,
13,
462,
11117,
7529,
2396,
3114,
29918,
3977,
6119,
29889,
16744,
28296,
1402,
301,
29878,
29922,
29212,
29897,
13,
29883,
5385,
291,
353,
286,
344,
29918,
6758,
13,
5824,
353,
29871,
29955,
29945,
13,
13,
13096,
5570,
353,
8450,
267,
29889,
16638,
20529,
29898,
3359,
29922,
3359,
29897,
13,
14968,
29918,
11671,
353,
11243,
284,
11746,
1469,
10036,
29898,
14968,
29918,
842,
29892,
24512,
29922,
5824,
29892,
16439,
29922,
13096,
5570,
29897,
13,
3084,
29918,
11671,
353,
11243,
284,
11746,
1469,
10036,
29898,
3084,
29918,
842,
29892,
24512,
29922,
5824,
29892,
16439,
29922,
13096,
5570,
29897,
13,
13,
13,
1753,
6216,
29898,
15480,
29922,
5574,
29892,
12725,
29918,
17991,
29922,
29896,
29900,
29900,
1125,
13,
1678,
7945,
29918,
11671,
29889,
16175,
29918,
2798,
353,
9853,
29918,
2798,
13,
1678,
363,
2380,
29892,
5135,
29916,
29896,
29890,
29892,
343,
29896,
29890,
511,
313,
29916,
29906,
29890,
29892,
343,
29906,
29890,
876,
297,
260,
29939,
18933,
29898,
15172,
29898,
14968,
29918,
11671,
511,
13,
462,
462,
18884,
3001,
29922,
2435,
29898,
14968,
29918,
11671,
22164,
13,
4706,
921,
29896,
29918,
22331,
353,
3114,
29918,
3977,
6119,
29898,
29916,
29896,
29890,
29897,
13,
4706,
921,
29906,
29918,
22331,
353,
3114,
29918,
3977,
6119,
29898,
29916,
29906,
29890,
29897,
13,
13,
4706,
4450,
353,
3114,
29918,
2218,
29883,
20386,
1061,
29898,
29916,
29896,
29918,
22331,
29892,
921,
29906,
29918,
22331,
467,
29879,
802,
29872,
911,
29898,
29896,
29897,
13,
13,
4706,
343,
29890,
353,
343,
29918,
29881,
17678,
29898,
29891,
29896,
29890,
29892,
343,
29906,
29890,
467,
517,
29898,
29881,
1853,
29922,
7345,
305,
29889,
7411,
29897,
13,
13,
4706,
6410,
353,
28770,
291,
29898,
11965,
29892,
343,
29890,
29897,
13,
13,
4706,
6410,
29889,
1627,
1328,
580,
13,
13,
4706,
3523,
29889,
10568,
580,
13,
4706,
3523,
29889,
9171,
29918,
5105,
580,
13,
13,
4706,
9227,
29889,
1202,
29918,
19529,
279,
877,
5323,
2827,
365,
2209,
742,
6410,
29892,
2380,
29897,
13,
4706,
9227,
29889,
23126,
580,
13,
13,
4706,
565,
12725,
29901,
13,
9651,
565,
2380,
1273,
29871,
29896,
29900,
29900,
1275,
29871,
29900,
29901,
13,
18884,
2854,
29918,
6758,
29892,
2854,
29918,
5753,
353,
14707,
29898,
3084,
29918,
11671,
29892,
2367,
29918,
5753,
29922,
5574,
29897,
13,
18884,
9227,
29889,
1202,
29918,
19529,
279,
877,
19448,
365,
2209,
742,
2854,
29918,
6758,
29892,
2380,
29897,
13,
18884,
9227,
29889,
1202,
29918,
19529,
279,
877,
19448,
4831,
332,
4135,
742,
2854,
29918,
5753,
29892,
2380,
29897,
13,
18884,
9227,
29889,
23126,
580,
13,
13,
13,
1753,
343,
29918,
29881,
17678,
29898,
29891,
29896,
29892,
343,
29906,
1125,
13,
1678,
736,
4842,
305,
29889,
1188,
936,
29918,
1333,
3552,
29891,
29896,
1275,
343,
29906,
8106,
517,
29898,
29881,
1853,
29922,
524,
467,
517,
29898,
3359,
29897,
13,
13,
13,
1753,
14707,
29898,
11671,
29892,
2367,
29918,
5753,
29922,
8824,
1125,
13,
1678,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
4706,
4450,
29879,
29918,
29891,
353,
17288,
3293,
29918,
2218,
29883,
20386,
1061,
29898,
3293,
29918,
3977,
6119,
29898,
29916,
29896,
29890,
511,
13,
462,
462,
4706,
3114,
29918,
3977,
6119,
29898,
29916,
29906,
29890,
8243,
13,
462,
1678,
343,
29918,
29881,
17678,
29898,
29891,
29896,
29890,
29892,
343,
29906,
29890,
876,
13,
462,
259,
363,
313,
29916,
29896,
29890,
29892,
343,
29896,
29890,
511,
313,
29916,
29906,
29890,
29892,
343,
29906,
29890,
29897,
297,
270,
29880,
29962,
13,
13,
4706,
28495,
353,
518,
29883,
5385,
291,
29898,
11965,
29879,
29918,
29890,
29889,
29879,
802,
29872,
911,
29898,
29896,
511,
343,
29890,
29897,
363,
4450,
29879,
29918,
29890,
29892,
343,
29890,
297,
4450,
29879,
29918,
29891,
29962,
13,
4706,
6410,
353,
2533,
29898,
6758,
267,
29897,
847,
7431,
29898,
6758,
267,
29897,
13,
13,
4706,
565,
2367,
29918,
5753,
29901,
13,
9651,
1035,
29879,
353,
518,
562,
2764,
4135,
29898,
11965,
29879,
29918,
29890,
29892,
343,
29890,
29897,
363,
4450,
29879,
29918,
29890,
29892,
343,
29890,
297,
4450,
29879,
29918,
29891,
29962,
13,
9651,
1035,
353,
2533,
29898,
562,
2395,
29897,
847,
7431,
29898,
562,
2395,
29897,
13,
13,
9651,
736,
6410,
29892,
1035,
13,
13,
4706,
736,
6410,
13,
13,
13,
1753,
13600,
29898,
449,
29892,
343,
1125,
13,
1678,
4450,
29879,
353,
714,
1405,
29871,
29900,
29889,
29945,
13,
1678,
736,
313,
11965,
29879,
1275,
343,
467,
7411,
2141,
12676,
580,
13,
13,
9202,
29898,
15480,
29922,
8824,
29897,
13,
13,
4905,
29879,
29918,
3972,
353,
5988,
29898,
4836,
29918,
4632,
29892,
525,
4905,
29879,
1495,
13,
361,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
4905,
29879,
29918,
3972,
1125,
13,
1678,
2897,
29889,
11256,
3972,
29898,
4905,
29879,
29918,
3972,
29897,
13,
13,
7345,
305,
29889,
7620,
29898,
3293,
29918,
3977,
6119,
29889,
3859,
29918,
8977,
3285,
13,
965,
5988,
29898,
4905,
29879,
29918,
3972,
29892,
525,
2291,
705,
29918,
3293,
29918,
3977,
6119,
29918,
4928,
29889,
415,
8785,
13,
7345,
305,
29889,
7620,
29898,
3293,
29918,
2218,
29883,
20386,
1061,
29889,
3859,
29918,
8977,
3285,
13,
965,
5988,
29898,
4905,
29879,
29918,
3972,
29892,
525,
2291,
705,
29918,
3293,
29918,
2218,
29883,
20386,
1061,
29918,
4928,
29889,
415,
8785,
13,
13,
13236,
29889,
5358,
580,
13,
2
] |
cogs/report.py | fennr/Samuro-HotsBot | 1 | 108166 | <reponame>fennr/Samuro-HotsBot
import discord
from discord import Embed
from discord.ext import commands
from discord.ext.commands import command, Cog, errors
from discord_components import DiscordComponents, Button, ButtonStyle, Select, SelectOption
from discord_slash.context import ComponentContext, MenuContext
from utils import check
from utils.classes.Const import config
labels = {
'Questions': {
'Error': 'Ошибка',
'Question': 'Вопрос',
'Report': 'Жалоба',
'Offer': 'Предложение',
},
'Close': 'Закрыть тикет'
}
TICKET_CATEGORY = 'Tickets'
menu_buttons = [
# Button(style=ButtonStyle.gray, label=labels['Error'],),
Button(style=ButtonStyle.gray, label=labels['Questions']['Question']),
Button(style=ButtonStyle.gray, label=labels['Questions']['Report']),
Button(style=ButtonStyle.gray, label=labels['Questions']['Offer']),
]
remove_button = [
Button(style=ButtonStyle.red, label=labels['Close'])
]
class Report(commands.Cog, name="Report"):
def __init__(self, bot):
self.bot = bot
@command(name='create_rep')
@check.is_owner()
async def create_report(self, ctx):
message = 'Воспользовавшись кнопками ниже можно связаться с модерацией по интересующим вопросам'
embed = Embed(
title='Поддержка',
description=message,
color=config.success
)
await ctx.message.delete()
await ctx.send(embed=embed, components=[menu_buttons])
@command(name='ruhots_report')
@check.is_admin()
async def ruhots_report(self, ctx):
message = 'Воспользовавшись кнопками ниже можно написать модераторам\n' \
'по интересующим вопросам'
embed_image = Embed(
color=config.grey,
)
embed = Embed(
description=message,
color=config.grey
)
await ctx.message.delete()
filename = 'support.png'
file = discord.File('data/img/support-ruhots.png', filename=filename)
embed_image.set_image(url=f'attachment://{filename}')
await ctx.send(file=file, embeds=[embed_image, embed], components=[menu_buttons])
@command(name='select')
async def select_test(self, ctx):
stalk = discord.utils.get(ctx.guild.emojis, name='stalk')
rqg = discord.utils.get(ctx.guild.emojis, name='RQG2')
event_5x5 = discord.utils.get(ctx.guild.emojis, name='kotj')
select = Select(
options=[ # the options in your dropdown
SelectOption(label="Сталк", value="stlk", emoji=stalk),
SelectOption(label="RQG", value="rqg", emoji=rqg),
SelectOption(label="Бои 5х5", value="5x5", emoji=event_5x5),
],
placeholder="Выберите подписки", # the placeholder text to show when no options have been chosen
min_values=1, # the minimum number of options a user must select
max_values=2, # the maximum number of options a user can select
)
await ctx.message.delete()
await ctx.send("Здесь можно подписаться на разделы", components=[select])
@Cog.listener()
async def on_component(self, ctx: ComponentContext):
if ctx.selected_options is not None:
# ctx.selected_options is a list of all the values the user selected
await ctx.send(content=f"You selected {ctx.selected_options}")
@Cog.listener()
async def on_button_click(self, interaction):
if interaction.component.label == labels['Close']:
await interaction.channel.delete()
if interaction.component.label in labels['Questions'].values():
category = discord.utils.get(interaction.guild.categories, name=TICKET_CATEGORY)
name = f"{interaction.component.label}-{interaction.author.name}"
channel = await interaction.guild.create_text_channel(name, category=category, sync_permissions=True)
overwrite = discord.PermissionOverwrite()
overwrite.send_messages = True
overwrite.read_messages = True
await channel.set_permissions(target=interaction.author, overwrite=overwrite)
ticket_created_embed = discord.Embed(
title="Заявка открыта",
description=f"""Привет {interaction.author.name}! Напиши свое сообщение в данном чате.\n
Если вопрос решен, заявку можно закрыть нажав кнопку ниже""",
)
await channel.send(
interaction.author.mention, embed=ticket_created_embed, components=[remove_button]
) # ping the user who pressed the button, and send the embed
try:
await interaction.respond()
except:
pass
def setup(bot):
bot.add_cog(Report(bot))
| [
1,
529,
276,
1112,
420,
29958,
29888,
2108,
29878,
29914,
22966,
2192,
29899,
29950,
1862,
29933,
327,
13,
5215,
2313,
536,
13,
3166,
2313,
536,
1053,
2812,
2580,
13,
3166,
2313,
536,
29889,
1062,
1053,
8260,
13,
3166,
2313,
536,
29889,
1062,
29889,
26381,
1053,
1899,
29892,
315,
468,
29892,
4436,
13,
3166,
2313,
536,
29918,
14036,
1053,
8565,
536,
25503,
29892,
11025,
29892,
11025,
5568,
29892,
7605,
29892,
7605,
8375,
13,
3166,
2313,
536,
29918,
17057,
29889,
4703,
1053,
15924,
2677,
29892,
20019,
2677,
13,
3166,
3667,
29879,
1053,
1423,
13,
3166,
3667,
29879,
29889,
13203,
29889,
12075,
1053,
2295,
13,
13,
21134,
353,
426,
13,
1678,
525,
2182,
2297,
2396,
426,
13,
4706,
525,
2392,
2396,
525,
30038,
1911,
23348,
742,
13,
4706,
525,
16492,
2396,
525,
27129,
5945,
29935,
742,
13,
4706,
525,
13020,
2396,
525,
30100,
29910,
843,
3102,
742,
13,
4706,
525,
2776,
571,
2396,
525,
30013,
4715,
843,
11567,
742,
13,
1678,
2981,
13,
1678,
525,
11123,
2396,
525,
15578,
10300,
1413,
7109,
27268,
29915,
13,
29913,
13,
13,
29911,
2965,
29968,
2544,
29918,
29907,
3040,
29954,
18929,
353,
525,
29911,
860,
1691,
29915,
13,
13,
6510,
29918,
4187,
7453,
353,
518,
13,
1678,
396,
11025,
29898,
3293,
29922,
3125,
5568,
29889,
21012,
29892,
3858,
29922,
21134,
1839,
2392,
7464,
511,
13,
1678,
11025,
29898,
3293,
29922,
3125,
5568,
29889,
21012,
29892,
3858,
29922,
21134,
1839,
2182,
2297,
16215,
16492,
2033,
511,
13,
1678,
11025,
29898,
3293,
29922,
3125,
5568,
29889,
21012,
29892,
3858,
29922,
21134,
1839,
2182,
2297,
16215,
13020,
2033,
511,
13,
1678,
11025,
29898,
3293,
29922,
3125,
5568,
29889,
21012,
29892,
3858,
29922,
21134,
1839,
2182,
2297,
16215,
2776,
571,
2033,
511,
13,
29962,
13,
13,
5992,
29918,
3092,
353,
518,
13,
1678,
11025,
29898,
3293,
29922,
3125,
5568,
29889,
1127,
29892,
3858,
29922,
21134,
1839,
11123,
11287,
13,
29962,
13,
13,
13,
1990,
13969,
29898,
26381,
29889,
29907,
468,
29892,
1024,
543,
13020,
29908,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9225,
1125,
13,
4706,
1583,
29889,
7451,
353,
9225,
13,
13,
1678,
732,
6519,
29898,
978,
2433,
3258,
29918,
3445,
1495,
13,
1678,
732,
3198,
29889,
275,
29918,
20348,
580,
13,
1678,
7465,
822,
1653,
29918,
12276,
29898,
1311,
29892,
12893,
1125,
13,
4706,
2643,
353,
525,
30012,
3264,
18360,
9718,
6687,
1210,
1186,
570,
29964,
13021,
7380,
1498,
26634,
9690,
1902,
4199,
531,
2569,
1216,
494,
23417,
733,
26133,
587,
2937,
28002,
29309,
2019,
29959,
29915,
13,
4706,
8297,
353,
2812,
2580,
29898,
13,
9651,
3611,
2433,
30013,
10285,
6620,
29998,
642,
742,
13,
9651,
6139,
29922,
4906,
29892,
13,
9651,
2927,
29922,
2917,
29889,
8698,
13,
4706,
1723,
13,
4706,
7272,
12893,
29889,
4906,
29889,
8143,
580,
13,
4706,
7272,
12893,
29889,
6717,
29898,
17987,
29922,
17987,
29892,
7117,
11759,
6510,
29918,
4187,
7453,
2314,
13,
13,
1678,
732,
6519,
29898,
978,
2433,
582,
29882,
1862,
29918,
12276,
1495,
13,
1678,
732,
3198,
29889,
275,
29918,
6406,
580,
13,
1678,
7465,
822,
5796,
29882,
1862,
29918,
12276,
29898,
1311,
29892,
12893,
1125,
13,
4706,
2643,
353,
525,
30012,
3264,
18360,
9718,
6687,
1210,
1186,
570,
29964,
13021,
7380,
1498,
26634,
25043,
1413,
2569,
1216,
494,
9011,
29959,
29905,
29876,
29915,
320,
13,
462,
29871,
525,
1268,
26133,
587,
2937,
28002,
29309,
2019,
29959,
29915,
13,
4706,
8297,
29918,
3027,
353,
2812,
2580,
29898,
13,
9651,
2927,
29922,
2917,
29889,
7979,
29891,
29892,
13,
4706,
1723,
13,
4706,
8297,
353,
2812,
2580,
29898,
13,
9651,
6139,
29922,
4906,
29892,
13,
9651,
2927,
29922,
2917,
29889,
7979,
29891,
13,
4706,
1723,
13,
4706,
7272,
12893,
29889,
4906,
29889,
8143,
580,
13,
4706,
10422,
353,
525,
5924,
29889,
2732,
29915,
13,
4706,
934,
353,
2313,
536,
29889,
2283,
877,
1272,
29914,
2492,
29914,
5924,
29899,
582,
29882,
1862,
29889,
2732,
742,
10422,
29922,
9507,
29897,
13,
4706,
8297,
29918,
3027,
29889,
842,
29918,
3027,
29898,
2271,
29922,
29888,
29915,
14930,
358,
597,
29912,
9507,
29913,
1495,
13,
4706,
7272,
12893,
29889,
6717,
29898,
1445,
29922,
1445,
29892,
8297,
29879,
11759,
17987,
29918,
3027,
29892,
8297,
1402,
7117,
11759,
6510,
29918,
4187,
7453,
2314,
13,
13,
1678,
732,
6519,
29898,
978,
2433,
2622,
1495,
13,
1678,
7465,
822,
1831,
29918,
1688,
29898,
1311,
29892,
12893,
1125,
13,
4706,
380,
2235,
353,
2313,
536,
29889,
13239,
29889,
657,
29898,
13073,
29889,
2543,
789,
29889,
331,
3848,
275,
29892,
1024,
2433,
303,
2235,
1495,
13,
4706,
364,
29939,
29887,
353,
2313,
536,
29889,
13239,
29889,
657,
29898,
13073,
29889,
2543,
789,
29889,
331,
3848,
275,
29892,
1024,
2433,
29934,
29984,
29954,
29906,
1495,
13,
4706,
1741,
29918,
29945,
29916,
29945,
353,
2313,
536,
29889,
13239,
29889,
657,
29898,
13073,
29889,
2543,
789,
29889,
331,
3848,
275,
29892,
1024,
2433,
29895,
327,
29926,
1495,
13,
4706,
1831,
353,
7605,
29898,
13,
9651,
3987,
11759,
29871,
396,
278,
3987,
297,
596,
14687,
13,
18884,
7605,
8375,
29898,
1643,
543,
30008,
9829,
29951,
613,
995,
543,
303,
29880,
29895,
613,
953,
29877,
2397,
29922,
303,
2235,
511,
13,
18884,
7605,
8375,
29898,
1643,
543,
29934,
29984,
29954,
613,
995,
543,
29878,
29939,
29887,
613,
953,
29877,
2397,
29922,
29878,
29939,
29887,
511,
13,
18884,
7605,
8375,
29898,
1643,
543,
30031,
29904,
29917,
29871,
29945,
29988,
29945,
613,
995,
543,
29945,
29916,
29945,
613,
953,
29877,
2397,
29922,
3696,
29918,
29945,
29916,
29945,
511,
13,
9651,
21251,
13,
9651,
12983,
543,
30012,
29982,
3759,
23314,
3693,
1668,
1305,
613,
29871,
396,
278,
12983,
1426,
304,
1510,
746,
694,
3987,
505,
1063,
10434,
13,
9651,
1375,
29918,
5975,
29922,
29896,
29892,
29871,
396,
278,
9212,
1353,
310,
3987,
263,
1404,
1818,
1831,
13,
9651,
4236,
29918,
5975,
29922,
29906,
29892,
29871,
396,
278,
7472,
1353,
310,
3987,
263,
1404,
508,
1831,
13,
4706,
1723,
13,
4706,
7272,
12893,
29889,
4906,
29889,
8143,
580,
13,
4706,
7272,
12893,
29889,
6717,
703,
30060,
1216,
1210,
26634,
3693,
7832,
4199,
665,
3212,
1216,
5985,
613,
7117,
11759,
2622,
2314,
13,
13,
1678,
732,
29907,
468,
29889,
25894,
580,
13,
1678,
7465,
822,
373,
29918,
9700,
29898,
1311,
29892,
12893,
29901,
15924,
2677,
1125,
13,
4706,
565,
12893,
29889,
8391,
29918,
6768,
338,
451,
6213,
29901,
13,
9651,
396,
12893,
29889,
8391,
29918,
6768,
338,
263,
1051,
310,
599,
278,
1819,
278,
1404,
4629,
13,
9651,
7272,
12893,
29889,
6717,
29898,
3051,
29922,
29888,
29908,
3492,
4629,
426,
13073,
29889,
8391,
29918,
6768,
27195,
13,
13,
1678,
732,
29907,
468,
29889,
25894,
580,
13,
1678,
7465,
822,
373,
29918,
3092,
29918,
3808,
29898,
1311,
29892,
14881,
1125,
13,
4706,
565,
14881,
29889,
9700,
29889,
1643,
1275,
11073,
1839,
11123,
2033,
29901,
13,
9651,
7272,
14881,
29889,
12719,
29889,
8143,
580,
13,
4706,
565,
14881,
29889,
9700,
29889,
1643,
297,
11073,
1839,
2182,
2297,
13359,
5975,
7295,
13,
9651,
7663,
353,
2313,
536,
29889,
13239,
29889,
657,
29898,
1639,
2467,
29889,
2543,
789,
29889,
20683,
29892,
1024,
29922,
29911,
2965,
29968,
2544,
29918,
29907,
3040,
29954,
18929,
29897,
13,
9651,
1024,
353,
285,
29908,
29912,
1639,
2467,
29889,
9700,
29889,
1643,
7402,
29912,
1639,
2467,
29889,
8921,
29889,
978,
5038,
13,
9651,
8242,
353,
7272,
14881,
29889,
2543,
789,
29889,
3258,
29918,
726,
29918,
12719,
29898,
978,
29892,
7663,
29922,
7320,
29892,
16523,
29918,
17858,
6847,
29922,
5574,
29897,
13,
9651,
26556,
353,
2313,
536,
29889,
27293,
3563,
3539,
580,
13,
9651,
26556,
29889,
6717,
29918,
19158,
353,
5852,
13,
9651,
26556,
29889,
949,
29918,
19158,
353,
5852,
13,
9651,
7272,
8242,
29889,
842,
29918,
17858,
6847,
29898,
5182,
29922,
1639,
2467,
29889,
8921,
29892,
26556,
29922,
957,
3539,
29897,
13,
9651,
23381,
29918,
11600,
29918,
17987,
353,
2313,
536,
29889,
6026,
2580,
29898,
13,
18884,
3611,
543,
15578,
15432,
642,
17282,
676,
613,
13,
18884,
6139,
29922,
29888,
15945,
29908,
30013,
641,
7616,
426,
1639,
2467,
29889,
8921,
29889,
978,
29913,
29991,
2372,
1668,
1911,
3862,
29919,
25032,
24849,
490,
11650,
2815,
3655,
730,
7790,
29876,
13,
18884,
3337,
12068,
29309,
29935,
1909,
10084,
29892,
1077,
15432,
1382,
26634,
1077,
10300,
1413,
665,
2711,
29942,
1186,
570,
29964,
1382,
7380,
1498,
15945,
613,
13,
9651,
1723,
13,
9651,
7272,
8242,
29889,
6717,
29898,
13,
18884,
14881,
29889,
8921,
29889,
358,
291,
29892,
8297,
29922,
29873,
8522,
29918,
11600,
29918,
17987,
29892,
7117,
11759,
5992,
29918,
3092,
29962,
13,
9651,
1723,
29871,
396,
24543,
278,
1404,
1058,
15385,
278,
2826,
29892,
322,
3638,
278,
8297,
13,
4706,
1018,
29901,
13,
9651,
7272,
14881,
29889,
3636,
580,
13,
4706,
5174,
29901,
13,
9651,
1209,
13,
13,
13,
1753,
6230,
29898,
7451,
1125,
13,
1678,
9225,
29889,
1202,
29918,
29883,
468,
29898,
13020,
29898,
7451,
876,
13,
2
] |
src/bepasty/storage/__init__.py | Emojigit/bepasty-server | 123 | 171712 | import importlib
def create_storage(app):
"""
Load specified storage and return the object.
"""
if 'STORAGE' not in app.config:
raise Exception("Missing STORAGE config key")
storage = importlib.import_module('.' + app.config['STORAGE'], __name__)
return storage.create_storage(app)
| [
1,
1053,
1053,
1982,
13,
13,
13,
1753,
1653,
29918,
12925,
29898,
932,
1125,
13,
1678,
9995,
13,
1678,
16012,
6790,
8635,
322,
736,
278,
1203,
29889,
13,
1678,
9995,
13,
1678,
565,
525,
1254,
1955,
10461,
29915,
451,
297,
623,
29889,
2917,
29901,
13,
4706,
12020,
8960,
703,
18552,
292,
6850,
1955,
10461,
2295,
1820,
1159,
13,
13,
1678,
8635,
353,
1053,
1982,
29889,
5215,
29918,
5453,
877,
6169,
718,
623,
29889,
2917,
1839,
1254,
1955,
10461,
7464,
4770,
978,
1649,
29897,
13,
1678,
736,
8635,
29889,
3258,
29918,
12925,
29898,
932,
29897,
13,
2
] |
scripts/parse_groot-report.py | alexmsalmeida/amr-profiler | 2 | 93844 | <reponame>alexmsalmeida/amr-profiler
#!/usr/bin/env python
import sys
import os
if len(sys.argv) < 2:
print("usage: script.py res_classes.tsv groot.report")
sys.exit(1)
bla = ["CTX", "TEM", "OXA", "SHV", "OXY", "LEN",
"MIR", "DHA", "CMY", "PDC", "OKP", "CBL"]
arg = {"AGL": "Aminoglycoside", "MLS": "MLS",
"TMT": "Trimethoprim", "PHE": "Phenicol"}
resfinder = {}
# store resfinder ontology
with open(sys.argv[1], "r") as f:
for line in f:
line = line.strip("\n")
cols = line.split("\t")
gene = cols[0][:3].upper()
name = cols[1]
resfinder[gene] = name
groot = {}
name = sys.argv[2].split(".report")[0]
amr_counts = open(name+"_amr_counts.tsv", "w")
amr_classes = open(name+"_amr_classes.tsv", "w")
# go through groot report
with open(sys.argv[2], "r") as f:
for line in f:
line = line.strip("\n")
cols = line.split("\t")
amr_counts.write("%s\t%s\n" % (os.path.basename(name), "\t".join(cols[:-1])))
full_gene = cols[0]
if "RESFINDER" in full_gene:
gene = full_gene.split("__")[-1].split("_")[0].upper()
abclass = resfinder[gene[:3]]
elif "CARD" in full_gene:
gene = full_gene.split("|")[-1].upper()
try:
abclass = resfinder[gene[:3]]
except:
if gene[:3] in bla:
abclass = "Beta-lactam"
else:
abclass = "Other"
elif "ARGANNOT" in full_gene:
gene = full_gene.split("__")[-1].split(":")[0].upper()
if "(AGly_Flqn)" in gene:
abclass = "Aminoglycoside/Fluoroquinolone"
else:
try:
abclass = resfinder[gene[1:4]]
except:
try:
gene_name = gene.split(")")[-1][:3]
abclass = resfinder[gene_name]
except:
abbrev = gene[1:4]
try:
abclass = arg[abbrev]
except:
abclass = "Other"
if abclass not in groot.keys():
groot[abclass] = 1
else:
groot[abclass] += 1
for class_name in groot:
amr_classes.write("%s\t%s\t%i\n" % (os.path.basename(name), class_name, groot[class_name]))
amr_counts.close()
amr_classes.close()
| [
1,
529,
276,
1112,
420,
29958,
744,
29916,
1516,
284,
1004,
1458,
29914,
314,
29878,
29899,
771,
1777,
261,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
5215,
10876,
13,
5215,
2897,
13,
13,
361,
7431,
29898,
9675,
29889,
19218,
29897,
529,
29871,
29906,
29901,
13,
1678,
1596,
703,
21125,
29901,
2471,
29889,
2272,
620,
29918,
13203,
29889,
1372,
29894,
23138,
29889,
12276,
1159,
13,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
17530,
353,
6796,
1783,
29990,
613,
376,
4330,
29924,
613,
376,
29949,
29990,
29909,
613,
376,
7068,
29963,
613,
376,
29949,
18454,
613,
376,
1307,
29940,
613,
29871,
13,
539,
376,
29924,
8193,
613,
376,
29928,
15715,
613,
376,
29907,
17870,
613,
376,
29925,
12696,
613,
376,
8949,
29925,
613,
376,
29907,
13367,
3108,
13,
13,
1191,
353,
8853,
29909,
7239,
1115,
376,
29909,
1195,
468,
368,
3944,
680,
613,
376,
1988,
29903,
1115,
376,
1988,
29903,
613,
13,
539,
376,
29911,
11490,
1115,
376,
2308,
326,
621,
459,
5632,
613,
376,
29925,
9606,
1115,
376,
29925,
3169,
5283,
9092,
29871,
13,
13,
690,
2886,
261,
353,
6571,
13,
13,
29937,
3787,
620,
2886,
261,
4625,
3002,
13,
2541,
1722,
29898,
9675,
29889,
19218,
29961,
29896,
1402,
376,
29878,
1159,
408,
285,
29901,
13,
1678,
363,
1196,
297,
285,
29901,
13,
4706,
1196,
353,
1196,
29889,
17010,
14182,
29876,
1159,
13,
4706,
28730,
353,
1196,
29889,
5451,
14182,
29873,
1159,
13,
4706,
18530,
353,
28730,
29961,
29900,
3816,
29901,
29941,
1822,
21064,
580,
13,
4706,
1024,
353,
28730,
29961,
29896,
29962,
13,
4706,
620,
2886,
261,
29961,
29887,
1600,
29962,
353,
1024,
13,
13,
29887,
4632,
353,
6571,
13,
978,
353,
10876,
29889,
19218,
29961,
29906,
1822,
5451,
17350,
12276,
1159,
29961,
29900,
29962,
13,
314,
29878,
29918,
2798,
29879,
353,
1722,
29898,
978,
13578,
29918,
314,
29878,
29918,
2798,
29879,
29889,
1372,
29894,
613,
376,
29893,
1159,
13,
314,
29878,
29918,
13203,
353,
1722,
29898,
978,
13578,
29918,
314,
29878,
29918,
13203,
29889,
1372,
29894,
613,
376,
29893,
1159,
13,
13,
29937,
748,
1549,
23138,
3461,
13,
2541,
1722,
29898,
9675,
29889,
19218,
29961,
29906,
1402,
376,
29878,
1159,
408,
285,
29901,
13,
1678,
363,
1196,
297,
285,
29901,
13,
4706,
1196,
353,
1196,
29889,
17010,
14182,
29876,
1159,
13,
4706,
28730,
353,
1196,
29889,
5451,
14182,
29873,
1159,
13,
4706,
626,
29878,
29918,
2798,
29879,
29889,
3539,
11702,
29879,
29905,
29873,
29995,
29879,
29905,
29876,
29908,
1273,
313,
359,
29889,
2084,
29889,
6500,
3871,
29898,
978,
511,
6634,
29873,
1642,
7122,
29898,
22724,
7503,
29899,
29896,
29962,
4961,
13,
4706,
2989,
29918,
29887,
1600,
353,
28730,
29961,
29900,
29962,
13,
4706,
565,
376,
15989,
29943,
1177,
8032,
29908,
297,
2989,
29918,
29887,
1600,
29901,
13,
9651,
18530,
353,
2989,
29918,
29887,
1600,
29889,
5451,
703,
1649,
1159,
14352,
29896,
1822,
5451,
703,
29918,
1159,
29961,
29900,
1822,
21064,
580,
13,
9651,
633,
1990,
353,
620,
2886,
261,
29961,
29887,
1600,
7503,
29941,
5262,
13,
4706,
25342,
376,
29907,
17011,
29908,
297,
2989,
29918,
29887,
1600,
29901,
13,
9651,
18530,
353,
2989,
29918,
29887,
1600,
29889,
5451,
703,
29989,
1159,
14352,
29896,
1822,
21064,
580,
13,
9651,
1018,
29901,
13,
18884,
633,
1990,
353,
620,
2886,
261,
29961,
29887,
1600,
7503,
29941,
5262,
13,
9651,
5174,
29901,
13,
18884,
565,
18530,
7503,
29941,
29962,
297,
12995,
29901,
13,
462,
1678,
633,
1990,
353,
376,
29933,
1187,
29899,
433,
312,
314,
29908,
13,
18884,
1683,
29901,
13,
462,
1678,
633,
1990,
353,
376,
16107,
29908,
13,
4706,
25342,
376,
1718,
29954,
2190,
12256,
29908,
297,
2989,
29918,
29887,
1600,
29901,
13,
9651,
18530,
353,
2989,
29918,
29887,
1600,
29889,
5451,
703,
1649,
1159,
14352,
29896,
1822,
5451,
703,
29901,
1159,
29961,
29900,
1822,
21064,
580,
13,
9651,
565,
18227,
10051,
368,
29918,
8754,
29939,
29876,
5513,
297,
18530,
29901,
13,
18884,
633,
1990,
353,
376,
29909,
1195,
468,
368,
3944,
680,
29914,
29943,
6092,
5801,
24150,
324,
650,
29908,
13,
9651,
1683,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
633,
1990,
353,
620,
2886,
261,
29961,
29887,
1600,
29961,
29896,
29901,
29946,
5262,
13,
18884,
5174,
29901,
13,
462,
1678,
1018,
29901,
13,
462,
4706,
18530,
29918,
978,
353,
18530,
29889,
5451,
703,
25760,
14352,
29896,
3816,
29901,
29941,
29962,
13,
462,
4706,
633,
1990,
353,
620,
2886,
261,
29961,
29887,
1600,
29918,
978,
29962,
13,
462,
1678,
5174,
29901,
13,
462,
4706,
29759,
29894,
353,
18530,
29961,
29896,
29901,
29946,
29962,
13,
462,
4706,
1018,
29901,
13,
462,
9651,
633,
1990,
353,
1852,
29961,
370,
1030,
29894,
29962,
13,
462,
4706,
5174,
29901,
13,
462,
9651,
633,
1990,
353,
376,
16107,
29908,
13,
4706,
565,
633,
1990,
451,
297,
23138,
29889,
8149,
7295,
13,
9651,
23138,
29961,
370,
1990,
29962,
353,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
23138,
29961,
370,
1990,
29962,
4619,
29871,
29896,
13,
13,
1454,
770,
29918,
978,
297,
23138,
29901,
13,
1678,
626,
29878,
29918,
13203,
29889,
3539,
11702,
29879,
29905,
29873,
29995,
29879,
29905,
29873,
29995,
29875,
29905,
29876,
29908,
1273,
313,
359,
29889,
2084,
29889,
6500,
3871,
29898,
978,
511,
770,
29918,
978,
29892,
23138,
29961,
1990,
29918,
978,
12622,
13,
13,
314,
29878,
29918,
2798,
29879,
29889,
5358,
580,
13,
314,
29878,
29918,
13203,
29889,
5358,
580,
13,
2
] |
codes/nlper/modules/modeling_outputs.py | zhaoxiongjun/NLPer-Arsenal | 1 | 170959 | <reponame>zhaoxiongjun/NLPer-Arsenal<gh_stars>1-10
from collections import OrderedDict
import torch
class ModelOutput(OrderedDict):
"""修改自transformers.file_utils.ModelOutput,允许下标、索引、属性访问,根据创建时的顺序决定
>>> t = ModelOutput(lr=1e-5)
>>> t.update(n_epochs=2)
>>> t
>>> ModelOutput([('lr', 1e-05), ('n_epochs', 2)])
>>> t[0] == t['lr'] == t.lr
>>> True
>>> t.lr = 5e-5 # equals t[0]=5e-5 or t['lr']=5e-5
>>> t.batch_size = 8 # equal t['batch_size']=8
>>> del t.lr # equals "del t[0]" or "del t['lr']"
"""
def __getitem__(self, k):
"""允许索引访问,同时也允许下标"""
if isinstance(k, str):
inner_dict = {k: v for (k, v) in self.items()}
return inner_dict[k]
else:
return self.to_tuple()[k]
def __setattr__(self, name, value):
"""设置属性时,会覆盖同名item"""
super().__setitem__(name, value)
super().__setattr__(name, value)
def __setitem__(self, key, value):
"""设置item的同时,也设置属性"""
# Will raise a KeyException if needed
if isinstance(key, int):
key = list(self.keys())[key]
super().__setitem__(key, value)
# Don't call self.__setattr__ to avoid recursion errors
super().__setattr__(key, value)
def __delattr__(self, item):
"""同时删除item和属性,只有通过该模型注册的才能被删除"""
super().__delattr__(item)
if item in self.keys():
self.__delitem__(item)
def __delitem__(self, key):
"""同时删除item和属性,只有通过该模型注册的才能被删除"""
if isinstance(key, int):
key = list(self.keys())[key]
super().__delitem__(key)
if key in self.__dict__:
self.__delattr__(key)
def pop(self, key):
result = self[key]
del self[key]
return result
def update(self, **kwargs):
for k, v in kwargs.items():
self.__setitem__(k, v)
def to_tuple(self):
"""
Convert self to a tuple containing all the attributes/keys that are not ``None``.
"""
return tuple(self[k] for k in self.keys())
class LightningOutput(ModelOutput):
"""
封装mpl.StandardModel中training_step、validation_step的输出
Args:
loss: 可求导的损失
preds: list, [batch_size, xxx], 模型的输出值,用于和golds计算指标,具体形式根据不同的任务决定
golds: list, [batch_size, xxx], 数据的真实标签,用于和preds计算指标
"""
loss: torch.Tensor = None
preds: list = []
golds: list = []
target_score: float = 0.0
class TextCLFOutput(ModelOutput):
"""
封装TextCLF模型的输出
Args:
logits: Tensor, [batch_size, num_labels], 模型最后的输出结果,用于计算损失,非概率值
seqEmb: Tensor, [batch_size, hidden_size], 最终用于分类的句子级表示
"""
logits: torch.Tensor = None
seqEmb: torch.Tensor = None
class EncoderOutput(ModelOutput):
"""
封装Encoder的输出
Args:
seqEmb: Tensor, [batch_size, seq_len, hidden_size]
"""
seqEmb: torch.Tensor = None
class DecoderOutput(ModelOutput):
"""
封装Decoder的输出
Args:
last_hidden_state: Tensor, [batch_size, seq_len, hidden_size], 解码器的预测结果
"""
last_hidden_state: torch.Tensor = None
class TextGenOutput(ModelOutput):
"""
封装TextGen模型的输出
Args:
pred: Tensor, [batch_size, seq_len, vocab_size], 用于计算loss
""" | [
1,
529,
276,
1112,
420,
29958,
29920,
2350,
2251,
291,
29887,
29926,
348,
29914,
25103,
5894,
29899,
1433,
4881,
284,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
16250,
1053,
8170,
287,
21533,
13,
5215,
4842,
305,
13,
13,
13,
1990,
8125,
6466,
29898,
7514,
287,
21533,
1125,
13,
1678,
9995,
31273,
31264,
30688,
9067,
414,
29889,
1445,
29918,
13239,
29889,
3195,
6466,
30214,
232,
136,
132,
235,
177,
187,
30557,
31062,
30330,
31836,
31674,
30330,
31360,
30952,
235,
177,
194,
31658,
30214,
31393,
30763,
31441,
30886,
30594,
30210,
236,
164,
189,
31463,
232,
137,
182,
30495,
13,
13,
1678,
8653,
260,
353,
8125,
6466,
29898,
29212,
29922,
29896,
29872,
29899,
29945,
29897,
13,
1678,
8653,
260,
29889,
5504,
29898,
29876,
29918,
1022,
2878,
29879,
29922,
29906,
29897,
13,
1678,
8653,
260,
13,
1678,
8653,
8125,
6466,
4197,
877,
29212,
742,
29871,
29896,
29872,
29899,
29900,
29945,
511,
6702,
29876,
29918,
1022,
2878,
29879,
742,
29871,
29906,
29897,
2314,
13,
1678,
8653,
260,
29961,
29900,
29962,
1275,
260,
1839,
29212,
2033,
1275,
260,
29889,
29212,
13,
1678,
8653,
5852,
13,
1678,
8653,
260,
29889,
29212,
353,
29871,
29945,
29872,
29899,
29945,
29871,
396,
15743,
260,
29961,
29900,
13192,
29945,
29872,
29899,
29945,
470,
260,
1839,
29212,
2033,
29922,
29945,
29872,
29899,
29945,
13,
1678,
8653,
260,
29889,
16175,
29918,
2311,
353,
29871,
29947,
29871,
396,
5186,
260,
1839,
16175,
29918,
2311,
2033,
29922,
29947,
13,
1678,
8653,
628,
260,
29889,
29212,
29871,
396,
15743,
376,
6144,
260,
29961,
29900,
18017,
470,
376,
6144,
260,
1839,
29212,
2033,
29908,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
413,
1125,
13,
4706,
9995,
232,
136,
132,
235,
177,
187,
31836,
31674,
235,
177,
194,
31658,
30214,
30980,
30594,
30953,
232,
136,
132,
235,
177,
187,
30557,
31062,
15945,
29908,
13,
4706,
565,
338,
8758,
29898,
29895,
29892,
851,
1125,
13,
9651,
6426,
29918,
8977,
353,
426,
29895,
29901,
325,
363,
313,
29895,
29892,
325,
29897,
297,
1583,
29889,
7076,
28296,
13,
9651,
736,
6426,
29918,
8977,
29961,
29895,
29962,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
517,
29918,
23583,
580,
29961,
29895,
29962,
13,
13,
1678,
822,
4770,
842,
5552,
12035,
1311,
29892,
1024,
29892,
995,
1125,
13,
4706,
9995,
30872,
30669,
31360,
30952,
30594,
30214,
30437,
235,
169,
137,
234,
158,
153,
30980,
30548,
667,
15945,
29908,
13,
4706,
2428,
2141,
1649,
842,
667,
12035,
978,
29892,
995,
29897,
13,
4706,
2428,
2141,
1649,
842,
5552,
12035,
978,
29892,
995,
29897,
13,
13,
1678,
822,
4770,
842,
667,
12035,
1311,
29892,
1820,
29892,
995,
1125,
13,
4706,
9995,
30872,
30669,
667,
30210,
30980,
30594,
30214,
30953,
30872,
30669,
31360,
30952,
15945,
29908,
13,
4706,
396,
2811,
12020,
263,
7670,
2451,
565,
4312,
13,
4706,
565,
338,
8758,
29898,
1989,
29892,
938,
1125,
13,
9651,
1820,
353,
1051,
29898,
1311,
29889,
8149,
3101,
29961,
1989,
29962,
13,
4706,
2428,
2141,
1649,
842,
667,
12035,
1989,
29892,
995,
29897,
13,
4706,
396,
3872,
29915,
29873,
1246,
1583,
17255,
842,
5552,
1649,
304,
4772,
20437,
4436,
13,
4706,
2428,
2141,
1649,
842,
5552,
12035,
1989,
29892,
995,
29897,
13,
13,
1678,
822,
4770,
6144,
5552,
12035,
1311,
29892,
2944,
1125,
13,
4706,
9995,
30980,
30594,
31916,
31152,
667,
30503,
31360,
30952,
30214,
31557,
30417,
30768,
31138,
31751,
31382,
30883,
31368,
232,
137,
143,
30210,
31979,
30815,
31407,
31916,
31152,
15945,
29908,
13,
4706,
2428,
2141,
1649,
6144,
5552,
12035,
667,
29897,
13,
4706,
565,
2944,
297,
1583,
29889,
8149,
7295,
13,
9651,
1583,
17255,
6144,
667,
12035,
667,
29897,
13,
13,
1678,
822,
4770,
6144,
667,
12035,
1311,
29892,
1820,
1125,
13,
4706,
9995,
30980,
30594,
31916,
31152,
667,
30503,
31360,
30952,
30214,
31557,
30417,
30768,
31138,
31751,
31382,
30883,
31368,
232,
137,
143,
30210,
31979,
30815,
31407,
31916,
31152,
15945,
29908,
13,
4706,
565,
338,
8758,
29898,
1989,
29892,
938,
1125,
13,
9651,
1820,
353,
1051,
29898,
1311,
29889,
8149,
3101,
29961,
1989,
29962,
13,
4706,
2428,
2141,
1649,
6144,
667,
12035,
1989,
29897,
13,
4706,
565,
1820,
297,
1583,
17255,
8977,
1649,
29901,
13,
9651,
1583,
17255,
6144,
5552,
12035,
1989,
29897,
13,
13,
1678,
822,
1835,
29898,
1311,
29892,
1820,
1125,
13,
4706,
1121,
353,
1583,
29961,
1989,
29962,
13,
4706,
628,
1583,
29961,
1989,
29962,
13,
4706,
736,
1121,
13,
13,
1678,
822,
2767,
29898,
1311,
29892,
3579,
19290,
1125,
13,
4706,
363,
413,
29892,
325,
297,
9049,
5085,
29889,
7076,
7295,
13,
9651,
1583,
17255,
842,
667,
12035,
29895,
29892,
325,
29897,
13,
13,
1678,
822,
304,
29918,
23583,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
14806,
1583,
304,
263,
18761,
6943,
599,
278,
8393,
29914,
8149,
393,
526,
451,
4954,
8516,
29952,
1412,
13,
4706,
9995,
13,
4706,
736,
18761,
29898,
1311,
29961,
29895,
29962,
363,
413,
297,
1583,
29889,
8149,
3101,
13,
13,
13,
1990,
12790,
1076,
6466,
29898,
3195,
6466,
1125,
13,
1678,
9995,
13,
268,
232,
179,
132,
31905,
29885,
572,
29889,
15449,
3195,
30275,
26495,
29918,
10568,
30330,
18157,
29918,
10568,
30210,
31573,
30544,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
6410,
29901,
29871,
30682,
31376,
31943,
30210,
233,
144,
162,
31369,
13,
4706,
4450,
29879,
29901,
1051,
29892,
518,
16175,
29918,
2311,
29892,
921,
4419,
1402,
29871,
31382,
30883,
30210,
31573,
30544,
30959,
30214,
30406,
30909,
30503,
29887,
3361,
31466,
31565,
31084,
31062,
30214,
232,
136,
186,
30988,
31305,
30607,
31393,
30763,
30413,
30980,
30210,
31450,
31358,
232,
137,
182,
30495,
13,
4706,
330,
3361,
29901,
1051,
29892,
518,
16175,
29918,
2311,
29892,
921,
4419,
1402,
29871,
30354,
30763,
30210,
30848,
31195,
31062,
234,
176,
193,
30214,
30406,
30909,
30503,
11965,
29879,
31466,
31565,
31084,
31062,
13,
1678,
9995,
13,
1678,
6410,
29901,
4842,
305,
29889,
29911,
6073,
353,
6213,
13,
1678,
4450,
29879,
29901,
1051,
353,
5159,
13,
1678,
330,
3361,
29901,
1051,
353,
5159,
13,
1678,
3646,
29918,
13628,
29901,
5785,
353,
29871,
29900,
29889,
29900,
13,
13,
13,
1990,
3992,
6154,
29943,
6466,
29898,
3195,
6466,
1125,
13,
1678,
9995,
13,
268,
232,
179,
132,
31905,
1626,
6154,
29943,
31382,
30883,
30210,
31573,
30544,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1480,
1169,
29901,
323,
6073,
29892,
518,
16175,
29918,
2311,
29892,
954,
29918,
21134,
1402,
29871,
31382,
30883,
30878,
30822,
30210,
31573,
30544,
31320,
30801,
30214,
30406,
30909,
31466,
31565,
233,
144,
162,
31369,
30214,
31838,
233,
169,
133,
234,
145,
138,
30959,
13,
4706,
19359,
6026,
29890,
29901,
323,
6073,
29892,
518,
16175,
29918,
2311,
29892,
7934,
29918,
2311,
1402,
29871,
30878,
234,
190,
139,
30406,
30909,
30748,
30832,
30210,
232,
146,
168,
30319,
234,
189,
170,
30746,
30858,
13,
1678,
9995,
13,
1678,
1480,
1169,
29901,
4842,
305,
29889,
29911,
6073,
353,
6213,
13,
1678,
19359,
6026,
29890,
29901,
4842,
305,
29889,
29911,
6073,
353,
6213,
13,
13,
13,
1990,
11346,
6119,
6466,
29898,
3195,
6466,
1125,
13,
1678,
9995,
13,
268,
232,
179,
132,
31905,
8566,
6119,
30210,
31573,
30544,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
19359,
6026,
29890,
29901,
323,
6073,
29892,
518,
16175,
29918,
2311,
29892,
19359,
29918,
2435,
29892,
7934,
29918,
2311,
29962,
13,
1678,
9995,
13,
1678,
19359,
6026,
29890,
29901,
4842,
305,
29889,
29911,
6073,
353,
6213,
13,
13,
13,
1990,
3826,
6119,
6466,
29898,
3195,
6466,
1125,
13,
1678,
9995,
13,
268,
232,
179,
132,
31905,
6185,
6119,
30210,
31573,
30544,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1833,
29918,
10892,
29918,
3859,
29901,
323,
6073,
29892,
518,
16175,
29918,
2311,
29892,
19359,
29918,
2435,
29892,
7934,
29918,
2311,
1402,
29871,
31201,
31183,
30943,
30210,
236,
165,
135,
31851,
31320,
30801,
13,
1678,
9995,
13,
1678,
1833,
29918,
10892,
29918,
3859,
29901,
4842,
305,
29889,
29911,
6073,
353,
6213,
13,
13,
13,
1990,
3992,
15462,
6466,
29898,
3195,
6466,
1125,
13,
1678,
9995,
13,
268,
232,
179,
132,
31905,
1626,
15462,
31382,
30883,
30210,
31573,
30544,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
4450,
29901,
323,
6073,
29892,
518,
16175,
29918,
2311,
29892,
19359,
29918,
2435,
29892,
7931,
370,
29918,
2311,
1402,
29871,
30406,
30909,
31466,
31565,
6758,
13,
13,
1678,
9995,
2
] |
paww/augmentation.py | SauravMaheshkar/paww | 0 | 145217 | <filename>paww/augmentation.py<gh_stars>0
from typing import Any
import albumentations as A
from albumentations.pytorch import ToTensorV2
__all__ = ["get_transforms"]
def get_transforms(cfg: dict, data: str) -> Any:
if data == "train":
return A.Compose(
[
A.RandomResizedCrop(cfg["size"], cfg["size"], scale=(0.85, 1.0)),
A.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
ToTensorV2(),
]
)
elif data == "valid":
return A.Compose(
[
A.Resize(cfg["size"], cfg["size"]),
A.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
ToTensorV2(),
]
)
| [
1,
529,
9507,
29958,
29886,
1450,
29893,
29914,
2987,
358,
362,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
19229,
1053,
3139,
13,
13,
5215,
27234,
942,
800,
408,
319,
13,
3166,
27234,
942,
800,
29889,
2272,
7345,
305,
1053,
1763,
29911,
6073,
29963,
29906,
13,
13,
1649,
497,
1649,
353,
6796,
657,
29918,
9067,
29879,
3108,
13,
13,
13,
1753,
679,
29918,
9067,
29879,
29898,
16859,
29901,
9657,
29892,
848,
29901,
851,
29897,
1599,
3139,
29901,
13,
13,
1678,
565,
848,
1275,
376,
14968,
1115,
13,
4706,
736,
319,
29889,
1523,
4220,
29898,
13,
9651,
518,
13,
18884,
319,
29889,
17875,
1666,
1891,
29907,
1336,
29898,
16859,
3366,
2311,
12436,
274,
16434,
3366,
2311,
12436,
6287,
7607,
29900,
29889,
29947,
29945,
29892,
29871,
29896,
29889,
29900,
8243,
13,
18884,
319,
29889,
19077,
675,
29898,
12676,
11759,
29900,
29889,
29946,
29947,
29945,
29892,
29871,
29900,
29889,
29946,
29945,
29953,
29892,
29871,
29900,
29889,
29946,
29900,
29953,
1402,
3659,
11759,
29900,
29889,
29906,
29906,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29946,
29892,
29871,
29900,
29889,
29906,
29906,
29945,
11724,
13,
18884,
1763,
29911,
6073,
29963,
29906,
3285,
13,
9651,
4514,
13,
4706,
1723,
13,
13,
1678,
25342,
848,
1275,
376,
3084,
1115,
13,
4706,
736,
319,
29889,
1523,
4220,
29898,
13,
9651,
518,
13,
18884,
319,
29889,
1666,
675,
29898,
16859,
3366,
2311,
12436,
274,
16434,
3366,
2311,
3108,
511,
13,
18884,
319,
29889,
19077,
675,
29898,
12676,
11759,
29900,
29889,
29946,
29947,
29945,
29892,
29871,
29900,
29889,
29946,
29945,
29953,
29892,
29871,
29900,
29889,
29946,
29900,
29953,
1402,
3659,
11759,
29900,
29889,
29906,
29906,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29946,
29892,
29871,
29900,
29889,
29906,
29906,
29945,
11724,
13,
18884,
1763,
29911,
6073,
29963,
29906,
3285,
13,
9651,
4514,
13,
4706,
1723,
13,
2
] |
src/python/dxpy/toolkit_version.py | Vidium-LLC/dx-toolkit | 0 | 1612159 | <filename>src/python/dxpy/toolkit_version.py
version = '0.303.0'
| [
1,
529,
9507,
29958,
4351,
29914,
4691,
29914,
8235,
2272,
29914,
10154,
7354,
29918,
3259,
29889,
2272,
13,
3259,
353,
525,
29900,
29889,
29941,
29900,
29941,
29889,
29900,
29915,
13,
2
] |
members/urls.py | Moha369/vector | 0 | 100484 |
from django.contrib import admin
from django.urls import path
from . import views
from django.conf.urls.static import static
from django.conf import settings
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth import views as auth_views
urlpatterns = [
path('', views.home, name = 'home'),
path('register/', views.register, name = 'register'),
path('profile/', views.profile, name = 'user_dashboard'),
path('login/', auth_views.LoginView.as_view(template_name = 'members/login.html'), name = 'login'),
path('logout/', auth_views.LogoutView.as_view(template_name = 'members/logout.html'), name = 'logout'),
path('contact/', views.contact, name = 'contact'),
path('members/', views.members, name = 'members'),
path('members/<username>', views.user_url, name = 'user_profile'),
path('about/', views.about, name = 'about')
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
| [
1,
29871,
13,
3166,
9557,
29889,
21570,
1053,
4113,
13,
3166,
9557,
29889,
26045,
1053,
2224,
13,
3166,
869,
1053,
8386,
13,
3166,
9557,
29889,
5527,
29889,
26045,
29889,
7959,
1053,
2294,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
21570,
29889,
6406,
29889,
7406,
29889,
19557,
4097,
1053,
13925,
29918,
14242,
29918,
12403,
13,
3166,
9557,
29889,
21570,
29889,
5150,
1053,
8386,
408,
4817,
29918,
7406,
13,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
2224,
877,
742,
8386,
29889,
5184,
29892,
1024,
353,
525,
5184,
5477,
13,
1678,
2224,
877,
9573,
29914,
742,
8386,
29889,
9573,
29892,
1024,
353,
525,
9573,
5477,
13,
1678,
2224,
877,
10185,
29914,
742,
8386,
29889,
10185,
29892,
1024,
353,
525,
1792,
29918,
14592,
3377,
5477,
13,
1678,
2224,
877,
7507,
29914,
742,
4817,
29918,
7406,
29889,
11049,
1043,
29889,
294,
29918,
1493,
29898,
6886,
29918,
978,
353,
525,
28109,
29914,
7507,
29889,
1420,
5477,
1024,
353,
525,
7507,
5477,
13,
1678,
2224,
877,
1188,
449,
29914,
742,
4817,
29918,
7406,
29889,
3403,
449,
1043,
29889,
294,
29918,
1493,
29898,
6886,
29918,
978,
353,
525,
28109,
29914,
1188,
449,
29889,
1420,
5477,
1024,
353,
525,
1188,
449,
5477,
13,
1678,
2224,
877,
12346,
29914,
742,
8386,
29889,
12346,
29892,
1024,
353,
525,
12346,
5477,
13,
1678,
2224,
877,
28109,
29914,
742,
8386,
29889,
28109,
29892,
1024,
353,
525,
28109,
5477,
13,
1678,
2224,
877,
28109,
29914,
29966,
6786,
29958,
742,
8386,
29889,
1792,
29918,
2271,
29892,
1024,
353,
525,
1792,
29918,
10185,
5477,
13,
1678,
2224,
877,
12717,
29914,
742,
8386,
29889,
12717,
29892,
1024,
353,
525,
12717,
1495,
13,
29962,
718,
2294,
29898,
11027,
29889,
17816,
2965,
29918,
4219,
29892,
1842,
29918,
4632,
29922,
11027,
29889,
17816,
2965,
29918,
21289,
29897,
13,
13,
361,
6055,
29889,
18525,
29901,
13,
1678,
3142,
11037,
29879,
4619,
2294,
29898,
11027,
29889,
2303,
4571,
29909,
29918,
4219,
29892,
1842,
29918,
4632,
29922,
11027,
29889,
2303,
4571,
29909,
29918,
21289,
29897,
13,
2
] |
blitzdb/fields/integer.py | marcinguy/blitzdb3 | 252 | 42277 | <gh_stars>100-1000
from .base import BaseField
class IntegerField(BaseField):
pass
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
3166,
869,
3188,
1053,
7399,
3073,
13,
13,
13,
1990,
8102,
3073,
29898,
5160,
3073,
1125,
13,
1678,
1209,
13,
2
] |
tests/unit_tests/test_UpdatedSynDataset_specified_target_with_background.py | liyu711/SUAS | 0 | 181356 | <gh_stars>0
"""
Running Successfully
import unittest
import math
from PIL import Image
from SyntheticDataset2.ImageCreator.specified_target_with_background import SpecifiedTargetWithBackground
class SpecifiedTargetWithBackgroundTestCase(unittest.TestCase):
def setUp(self):
self.path_to_background = "tests/images/competition_grass_1.JPG"
self.test_image1 = SpecifiedTargetWithBackground("circle", "?", "A", (255, 255, 255, 255), (255, 0, 0, 255), 0).create_specified_target_with_background()
self.test_image2 = SpecifiedTargetWithBackground("semicircle", "E", "E", (0, 255, 0, 255), (0, 0, 255, 255), 45).create_specified_target_with_background()
self.test_image3 = SpecifiedTargetWithBackground("cross", "D", "I", (255, 255, 0, 255), (255, 0, 255, 255), 90).create_specified_target_with_background()
self.test_image4 = SpecifiedTargetWithBackground("heptagon", "S", "O", (0, 255, 255, 255), (0, 0, 0, 255), 135).create_specified_target_with_background()
self.test_image5 = SpecifiedTargetWithBackground("star", "N", "U", (66, 66, 66, 255), (233, 233, 233, 255), 180).create_specified_target_with_background()
'''
Settings:
PPSI = 10
SINGLE_TARGET_SIZE_IN_INCHES = 24
SINGLE_TARGET_PROPORTIONALITY = 2.5
PIXELIZATION_LEVEL = 0
NOISE_LEVEL = 0
'''
def test_create_specified_target_with_specified_background(self):
self.assertTrue(abs(max(self.test_image1.width, self.test_image1.height) - 260) < 3)
self.assertTrue(self.test_image1.load()[self.test_image1.width/2, self.test_image1.height/2] == (255, 255, 255))
self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3)
self.assertTrue(self.test_image2.load()[self.test_image2.width/2, self.test_image2.height/2] == (0, 255, 0))
self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3)
self.assertTrue(self.test_image3.load()[self.test_image3.width/2, self.test_image3.height/2] == (255, 0, 255))
self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3)
self.assertTrue(self.test_image4.load()[self.test_image4.width/2, self.test_image4.height/2] == (0, 255, 255))
self.assertTrue(abs(max(self.test_image2.width, self.test_image2.height) - 260) < 3)
self.assertTrue(self.test_image5.load()[self.test_image5.width/2, self.test_image5.height/2] == (66, 66, 66))
"""
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
27795,
21397,
3730,
13,
13,
5215,
443,
27958,
13,
5215,
5844,
13,
3166,
349,
6227,
1053,
7084,
13,
3166,
10829,
386,
7492,
16390,
24541,
29906,
29889,
2940,
9832,
1061,
29889,
6550,
2164,
29918,
5182,
29918,
2541,
29918,
7042,
1053,
12048,
2164,
8667,
3047,
10581,
13,
13,
1990,
12048,
2164,
8667,
3047,
10581,
3057,
8259,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
2084,
29918,
517,
29918,
7042,
353,
376,
21150,
29914,
8346,
29914,
2388,
300,
654,
29918,
629,
465,
29918,
29896,
29889,
29967,
16903,
29908,
13,
4706,
1583,
29889,
1688,
29918,
3027,
29896,
353,
12048,
2164,
8667,
3047,
10581,
703,
16622,
613,
376,
29973,
613,
376,
29909,
613,
313,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
313,
29906,
29945,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
511,
29871,
29900,
467,
3258,
29918,
6550,
2164,
29918,
5182,
29918,
2541,
29918,
7042,
580,
13,
4706,
1583,
29889,
1688,
29918,
3027,
29906,
353,
12048,
2164,
8667,
3047,
10581,
703,
12846,
293,
2076,
280,
613,
376,
29923,
613,
376,
29923,
613,
313,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
511,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
29871,
29946,
29945,
467,
3258,
29918,
6550,
2164,
29918,
5182,
29918,
2541,
29918,
7042,
580,
13,
4706,
1583,
29889,
1688,
29918,
3027,
29941,
353,
12048,
2164,
8667,
3047,
10581,
703,
19128,
613,
376,
29928,
613,
376,
29902,
613,
313,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
511,
313,
29906,
29945,
29945,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
29871,
29929,
29900,
467,
3258,
29918,
6550,
2164,
29918,
5182,
29918,
2541,
29918,
7042,
580,
13,
4706,
1583,
29889,
1688,
29918,
3027,
29946,
353,
12048,
2164,
8667,
3047,
10581,
703,
354,
415,
12841,
613,
376,
29903,
613,
376,
29949,
613,
313,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
511,
29871,
29896,
29941,
29945,
467,
3258,
29918,
6550,
2164,
29918,
5182,
29918,
2541,
29918,
7042,
580,
13,
4706,
1583,
29889,
1688,
29918,
3027,
29945,
353,
12048,
2164,
8667,
3047,
10581,
703,
8508,
613,
376,
29940,
613,
376,
29965,
613,
313,
29953,
29953,
29892,
29871,
29953,
29953,
29892,
29871,
29953,
29953,
29892,
29871,
29906,
29945,
29945,
511,
313,
29906,
29941,
29941,
29892,
29871,
29906,
29941,
29941,
29892,
29871,
29906,
29941,
29941,
29892,
29871,
29906,
29945,
29945,
511,
29871,
29896,
29947,
29900,
467,
3258,
29918,
6550,
2164,
29918,
5182,
29918,
2541,
29918,
7042,
580,
13,
4706,
14550,
13,
4706,
19215,
29901,
13,
4706,
349,
29925,
5425,
353,
29871,
29896,
29900,
13,
4706,
317,
4214,
1307,
29918,
29911,
1718,
7194,
29918,
14226,
29918,
1177,
29918,
1177,
3210,
2890,
353,
29871,
29906,
29946,
13,
4706,
317,
4214,
1307,
29918,
29911,
1718,
7194,
29918,
8618,
15082,
2725,
1964,
11937,
353,
29871,
29906,
29889,
29945,
13,
4706,
349,
6415,
29923,
5265,
29999,
8098,
29918,
1307,
29963,
6670,
353,
29871,
29900,
13,
4706,
11698,
29902,
1660,
29918,
1307,
29963,
6670,
353,
29871,
29900,
13,
4706,
14550,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
6550,
2164,
29918,
5182,
29918,
2541,
29918,
6550,
2164,
29918,
7042,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6897,
29898,
3317,
29898,
1311,
29889,
1688,
29918,
3027,
29896,
29889,
2103,
29892,
1583,
29889,
1688,
29918,
3027,
29896,
29889,
3545,
29897,
448,
29871,
29906,
29953,
29900,
29897,
529,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
1688,
29918,
3027,
29896,
29889,
1359,
580,
29961,
1311,
29889,
1688,
29918,
3027,
29896,
29889,
2103,
29914,
29906,
29892,
1583,
29889,
1688,
29918,
3027,
29896,
29889,
3545,
29914,
29906,
29962,
1275,
313,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
876,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6897,
29898,
3317,
29898,
1311,
29889,
1688,
29918,
3027,
29906,
29889,
2103,
29892,
1583,
29889,
1688,
29918,
3027,
29906,
29889,
3545,
29897,
448,
29871,
29906,
29953,
29900,
29897,
529,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
1688,
29918,
3027,
29906,
29889,
1359,
580,
29961,
1311,
29889,
1688,
29918,
3027,
29906,
29889,
2103,
29914,
29906,
29892,
1583,
29889,
1688,
29918,
3027,
29906,
29889,
3545,
29914,
29906,
29962,
1275,
313,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
876,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6897,
29898,
3317,
29898,
1311,
29889,
1688,
29918,
3027,
29906,
29889,
2103,
29892,
1583,
29889,
1688,
29918,
3027,
29906,
29889,
3545,
29897,
448,
29871,
29906,
29953,
29900,
29897,
529,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
1688,
29918,
3027,
29941,
29889,
1359,
580,
29961,
1311,
29889,
1688,
29918,
3027,
29941,
29889,
2103,
29914,
29906,
29892,
1583,
29889,
1688,
29918,
3027,
29941,
29889,
3545,
29914,
29906,
29962,
1275,
313,
29906,
29945,
29945,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
876,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6897,
29898,
3317,
29898,
1311,
29889,
1688,
29918,
3027,
29906,
29889,
2103,
29892,
1583,
29889,
1688,
29918,
3027,
29906,
29889,
3545,
29897,
448,
29871,
29906,
29953,
29900,
29897,
529,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
1688,
29918,
3027,
29946,
29889,
1359,
580,
29961,
1311,
29889,
1688,
29918,
3027,
29946,
29889,
2103,
29914,
29906,
29892,
1583,
29889,
1688,
29918,
3027,
29946,
29889,
3545,
29914,
29906,
29962,
1275,
313,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
876,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6897,
29898,
3317,
29898,
1311,
29889,
1688,
29918,
3027,
29906,
29889,
2103,
29892,
1583,
29889,
1688,
29918,
3027,
29906,
29889,
3545,
29897,
448,
29871,
29906,
29953,
29900,
29897,
529,
29871,
29941,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
1688,
29918,
3027,
29945,
29889,
1359,
580,
29961,
1311,
29889,
1688,
29918,
3027,
29945,
29889,
2103,
29914,
29906,
29892,
1583,
29889,
1688,
29918,
3027,
29945,
29889,
3545,
29914,
29906,
29962,
1275,
313,
29953,
29953,
29892,
29871,
29953,
29953,
29892,
29871,
29953,
29953,
876,
13,
15945,
29908,
13,
2
] |
tests/test_django_url_check.py | jambonsw/django-url-checks | 5 | 109633 | <filename>tests/test_django_url_check.py
"""Tests for django-url-check"""
import url_checks
def test_version():
"""Check that package has a version"""
assert hasattr(url_checks, "__version__")
assert isinstance(url_checks.__version__, str)
def test_default_app():
"""Check that package has a default Django app
https://docs.djangoproject.com/en/stable/ref/applications/#configuring-applications
"""
assert hasattr(url_checks, "default_app_config")
assert isinstance(url_checks.default_app_config, str)
| [
1,
529,
9507,
29958,
21150,
29914,
1688,
29918,
14095,
29918,
2271,
29918,
3198,
29889,
2272,
13,
15945,
29908,
24376,
363,
9557,
29899,
2271,
29899,
3198,
15945,
29908,
13,
5215,
3142,
29918,
3198,
29879,
13,
13,
13,
1753,
1243,
29918,
3259,
7295,
13,
1678,
9995,
5596,
393,
3577,
756,
263,
1873,
15945,
29908,
13,
1678,
4974,
756,
5552,
29898,
2271,
29918,
3198,
29879,
29892,
376,
1649,
3259,
1649,
1159,
13,
1678,
4974,
338,
8758,
29898,
2271,
29918,
3198,
29879,
17255,
3259,
1649,
29892,
851,
29897,
13,
13,
13,
1753,
1243,
29918,
4381,
29918,
932,
7295,
13,
1678,
9995,
5596,
393,
3577,
756,
263,
2322,
15337,
623,
13,
13,
1678,
2045,
597,
2640,
29889,
19776,
574,
26555,
622,
29889,
510,
29914,
264,
29914,
13844,
29914,
999,
29914,
932,
5795,
8484,
2917,
3864,
29899,
932,
5795,
13,
1678,
9995,
13,
1678,
4974,
756,
5552,
29898,
2271,
29918,
3198,
29879,
29892,
376,
4381,
29918,
932,
29918,
2917,
1159,
13,
1678,
4974,
338,
8758,
29898,
2271,
29918,
3198,
29879,
29889,
4381,
29918,
932,
29918,
2917,
29892,
851,
29897,
13,
2
] |
controllers/json_types.py | OSevangelist/vsf-odoo | 84 | 1616938 | <gh_stars>10-100
import urllib.parse
class JSONTypes():
@staticmethod
def productJSON(name, item_id, code, price, attribute_line_ids, variants, configurable_children, size_attribute_name, color_attribute_name, host_odoo):
# Configurable options
configurable_options_array = []
for variant in variants:
configurable_options_array.append(
JSONTypes.configurable_option_JSON(
variant,
item_id,
size_attribute_name,
color_attribute_name
)
)
# Configurable children
configurable_children_array = []
for configurable in configurable_children:
configurable_children_array.append(
JSONTypes.configurable_children_JSON(
name,
configurable,
item_id,
size_attribute_name,
color_attribute_name,
host_odoo
)
)
# First variant id
first_variant_id = configurable_children[0].get("id")
source = {
"attribute_line_ids": attribute_line_ids,
"variants": variants,
"configurable_children_array": configurable_children_array,
"pattern":"197",
"description": "La nueva temporada llega con un estilo que te renovará de pies a cabeza como nunca antes. Los nuevos colores de la temporada 2019 llegan para quedarse en esta nueva colección con la marca como protagonista de tu nuevo estilo.",
"eco_collection":"1",
# START OF CONFIGURABLE OPTIONS
"configurable_options_original": variants,
"configurable_options": configurable_options_array,
# END OF CONFIGURABLE OPTIONS
"tsk":1551705236617,
"custom_attributes": None,
"size_options":[],
"regular_price":29,
"erin_recommends":"0",
"final_price": price,
"price":29,
"color_options":[],
"links":{},
"id": item_id,
"category_ids":[
"25",
"33",
"8",
"36",
"2"
],
"sku": str(item_id),
"stock":{
"min_sale_qty":1,
"item_id":item_id,
"min_qty":0,
"stock_status_changed_auto":0,
"is_in_stock":True,
"max_sale_qty":10000,
"show_default_notification_message":False,
"backorders":0,
"product_id":item_id,
"qty":0,
"is_decimal_divided":False,
"is_qty_decimal":False,
"low_stock_date": None,
"use_config_qty_increments":True
},
"slug": code,
"url_path": code,
"image": host_odoo + "/web/image/product.product/" + str(first_variant_id) + "/image",
"new":"1",
"thumbnail": host_odoo + "/web/image/product.product/" + str(first_variant_id) + "/image",
"visibility":4,
"type_id":"configurable",
"tax_class_id":"2",
"media_gallery": [],
"climate":"205,209",
"style_general":"136",
"url_key": JSONTypes.url_key(name),
"performance_fabric":"0",
"sale":"0",
"max_price": price,
"minimal_regular_price": price,
"material":"153,154",
"special_price":0,
"minimal_price": price,
"name": name,
# START OF CONFIGURABLE CHILDREN
"configurable_children_original": configurable_children,
"configurable_children": configurable_children_array,
# END OF CONFIGURABLE CHILDREN
"max_regular_price": price,
"category":[],
"status":1,
"priceTax":6.67,
"priceInclTax": price,
"specialPriceTax": None,
"specialPriceInclTax": None
}
return {
"_source": source,
"_score": 1
}
@staticmethod
def configurable_option_JSON(variant, item_id, size_attribute_name, color_attribute_name):
attribute_id = variant.get("attribute_id")[0]
attribute_name = variant.get("attribute_id")[1]
attribute_label_json = None
attribute_code_json = None
if attribute_name == size_attribute_name:
attribute_label_json = "Size"
attribute_code_json = "size"
elif attribute_name == color_attribute_name:
attribute_label_json = "Color"
attribute_code_json = "color"
values_array = []
attributes = variant.get("attributes")
for attribute in attributes:
if attribute_name == size_attribute_name:
values_array.append({
"value_index": attribute[0].get("id"),
"label": str(attribute[0].get("name")),
})
elif attribute_name == color_attribute_name:
values_array.append({
"value_index": attribute[0].get("id"),
"label": "#" + str(attribute[0].get("html_color")),
})
result = {
"attribute_id": attribute_id,
"values": values_array,
"product_id": item_id,
"id": attribute_id,
"label": attribute_label_json,
"position": 0,
"attribute_code": attribute_code_json
}
return result
@staticmethod
def url_key(name):
return urllib.parse.quote_plus(name).lower().replace("+", "-")
@staticmethod
def configurable_children_JSON(name, configurable, item_id, size_attribute_name, color_attribute_name, host_odoo):
# Get size and color
size_id = None
color_id = None
attributes = configurable.get("attributes")
for attribute in attributes:
attribute_name = attribute[0].get("attribute_id")[1]
if attribute_name == size_attribute_name:
size_id = attribute[0].get("id")
elif attribute_name == color_attribute_name:
color_id = attribute[0].get("id")
size_id_string = str(size_id)
color_id_string = str(color_id)
result = {
"image": host_odoo + "/web/image/product.product/" + str(configurable.get("id")) + "/image",
"thumbnail": host_odoo + "/web/image/product.product/" + str(configurable.get("id")) + "/image",
"color": color_id_string,
"small_image": host_odoo + "/web/image/product.product/" + str(configurable.get("id")) + "/image",
"tax_class_id":"2",
"has_options":"0",
"url_key": JSONTypes.url_key(name),
"regular_price": configurable.get("list_price"),
"required_options":"0",
"max_price": configurable.get("list_price"),
"minimal_regular_price": configurable.get("list_price"),
"size": size_id_string,
"final_price": configurable.get("list_price"),
"special_price":0,
"price":29,
"minimal_price": configurable.get("list_price"),
"name": size_id_string + "-" + color_id_string,
"id": configurable.get("id"),
"category_ids":[],
"sku": str(configurable.get("id")),
"max_regular_price": configurable.get("list_price"),
"status":1,
"priceTax":6.67,
"priceInclTax": configurable.get("list_price"),
"specialPriceTax": None,
"specialPriceInclTax": None
}
return result
@staticmethod
def attributeJSON(attribute_id, attribute_code, default_frontend_label):
return {
"is_wysiwyg_enabled": False,
"is_html_allowed_on_front": True,
"used_for_sort_by": False,
"is_filterable": True,
"is_filterable_in_search": False,
"is_used_in_grid": False,
"is_visible_in_grid": False,
"is_filterable_in_grid": False,
"position": 0,
"apply_to": [],
"is_searchable": "0",
"is_visible_in_advanced_search": "0",
"is_comparable": "0",
"is_used_for_promo_rules": "1",
"is_visible_on_front": "0",
"used_in_product_listing": "1",
"is_visible": True,
"scope": "global",
"attribute_id": attribute_id,
"attribute_code": attribute_code,
"frontend_input": "select",
"entity_type_id": "4",
"is_required": False,
"options": [],
"is_user_defined": True,
"default_frontend_label": default_frontend_label,
"frontend_labels": None,
"backend_type": "int",
"is_unique": "0",
"validation_rules": [],
"id": 142,
"tsk": 1512134647691,
"default_value": "91",
"source_model": "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",
"sgn": "vHkjS2mGumtgjjzlDrGJnF6i8EeUU2twc2zkZe69ABc"
}
@staticmethod
def category_json(name, id, parent_id, childs, level, category_offset):
children_data = []
for child in childs:
children_data.append({
"id": child
})
children_count = len(children_data)
if children_count == 0:
result = {
"_index":"vue_storefront_catalog_1552559102",
"_type":"category",
"_id": id,
"_score": None,
"_source":{
"path":"1/2/20",
"is_active": True,
"level": level,
"product_count":1,
"children_count": str(children_count),
"parent_id": parent_id,
"name": name,
"id": id + category_offset,
"url_path": "categories/category-" + str(id + category_offset),
"url_key": str(id + category_offset),
},
"sort":[
2
]
}
else:
result = {
"_index": "vue_storefront_catalog_1552559102",
"_type": "category",
"_id": id,
"_score": None,
"_source": {
"path": "1/2/20",
"is_active": True,
"level": level,
"product_count": 1,
"children_count": str(children_count),
"parent_id": parent_id,
"name": name,
"id": id + category_offset,
"url_path": "categories/category-" + str(id + category_offset),
"url_key": str(id + category_offset),
"children_data": children_data
},
"sort": [
2
]
}
return result
@staticmethod
def categories_to_response(categories, level, parent_id, category_offset):
categories_array = []
for category in categories:
categories_array.append(JSONTypes.category_json(
category["name"],
category["id"],
parent_id,
category["child_id"],
level,
category_offset
))
response = {
"took": 1,
"timed_out": False,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 6,
"max_score": None,
"hits": categories_array
}
}
return response
@staticmethod
def attributeJSON(
is_html_allowed_on_front,
used_for_sort_by,
is_used_in_grid,
is_filterable_in_grid,
apply_to,
is_searchable,
is_visible_in_advanced_search,
is_used_for_promo_rules,
used_in_product_listing,
attribute_id,
attribute_code,
frontend_input,
is_required,
options,
is_user_defined,
default_frontend_label,
backend_type,
backend_model,
source_model,
default_value,
id
):
response = {
"is_wysiwyg_enabled": False,
"is_html_allowed_on_front": is_html_allowed_on_front,
"used_for_sort_by": used_for_sort_by,
"is_filterable": True,
"is_filterable_in_search": False,
"is_used_in_grid": is_used_in_grid,
"is_visible_in_grid": False,
"is_filterable_in_grid": is_filterable_in_grid,
"position":0,
"apply_to": apply_to,
"is_searchable": is_searchable,
"is_visible_in_advanced_search": is_visible_in_advanced_search,
"is_comparable":"0",
"is_used_for_promo_rules": is_used_for_promo_rules,
"is_visible_on_front":"0",
"used_in_product_listing": used_in_product_listing,
"is_visible": True,
"scope":"global",
"attribute_id": attribute_id,
"attribute_code": attribute_code,
"frontend_input": frontend_input,
"entity_type_id":"4",
"is_required": is_required,
"options": options,
"is_user_defined": is_user_defined,
"default_frontend_label": default_frontend_label,
"frontend_labels": None,
"backend_type": backend_type,
"backend_model": backend_model,
"source_model": source_model,
"default_value": default_value,
"is_unique":"0",
"validation_rules":[
],
"id": id,
"tsk":1551705231251
}
return response
@staticmethod
def order_json(
order_id,
confirmation_date,
amount_total,
amount_tax,
amount_untaxed,
shipping_amount,
discount_amount,
items_array,
name,
lastname,
city,
postcode,
street,
):
result = {
"applied_rule_ids": "1,5",
"base_currency_code": "USD",
"base_discount_amount": (-1) * discount_amount,
"base_grand_total": amount_total,
"base_discount_tax_compensation_amount": 0,
"base_shipping_amount": shipping_amount,
"base_shipping_discount_amount": 0,
"base_shipping_incl_tax": shipping_amount,
"base_shipping_tax_amount": 0,
"base_subtotal": amount_untaxed,
"base_subtotal_incl_tax": amount_total,
"base_tax_amount": amount_tax,
"base_total_due": amount_total,
"base_to_global_rate": 1,
"base_to_order_rate": 1,
"billing_address_id": 204,
"created_at": confirmation_date,
"customer_email": "<EMAIL>",
"customer_group_id": 0,
"customer_is_guest": 1,
"customer_note_notify": 1,
"discount_amount": (-1) * discount_amount,
"email_sent": 1,
"entity_id": order_id,
"global_currency_code": "USD",
"grand_total": amount_total,
"discount_tax_compensation_amount": 0,
"increment_id": str(order_id),
"is_virtual": 0,
"order_currency_code": "USD",
"protect_code": "3984835d33abd2423b8a47efd0f74579",
"quote_id": 1112,
"shipping_amount": shipping_amount,
"shipping_description": "Flat Rate - Fixed",
"shipping_discount_amount": 0,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": shipping_amount,
"shipping_tax_amount": 0,
"state": "new",
"status": "pending",
"store_currency_code": "USD",
"store_id": 1,
"store_name": "Main Website\nMain Website Store\n",
"store_to_base_rate": 0,
"store_to_order_rate": 0,
"subtotal": amount_untaxed,
"subtotal_incl_tax": amount_total,
"tax_amount": amount_tax,
"total_due": amount_total,
"total_item_count": 1,
"total_qty_ordered": 1,
"updated_at": confirmation_date,
"weight": 1,
"items": items_array,
"billing_address": {
"address_type": "billing",
"city": city,
"company": "Divante",
"country_id": "PL",
"email": "<EMAIL>",
"entity_id": 204,
"firstname": name,
"lastname": lastname,
"parent_id": order_id,
"postcode": postcode,
"street": [
street,
""
],
"telephone": None,
"vat_id": "PL8951930748"
},
"payment": {
"account_status": None,
"additional_information": [
"Cash On Delivery",
""
],
"amount_ordered": amount_total,
"base_amount_ordered": amount_total,
"base_shipping_amount": shipping_amount,
"cc_last4": None,
"entity_id": order_id,
"method": "cashondelivery",
"parent_id": order_id,
"shipping_amount": 5
},
"status_histories": [],
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"address": {
"address_type": "shipping",
"city": city,
"company": "NA",
"country_id": "PL",
"email": "<EMAIL>",
"entity_id": 203,
"firstname": name,
"lastname": lastname,
"parent_id": order_id,
"postcode": postcode,
"street": [
street,
""
],
"telephone": None
},
"method": "flatrate_flatrate",
"total": {
"base_shipping_amount": shipping_amount,
"base_shipping_discount_amount": 0,
"base_shipping_incl_tax": shipping_amount,
"base_shipping_tax_amount": 0,
"shipping_amount": shipping_amount,
"shipping_discount_amount": 0,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": shipping_amount,
"shipping_tax_amount": 0
}
},
"items": items_array
}
]
}
}
return result
@staticmethod
def order_item_json(
order_id,
confirmation_date,
item_name,
sku,
price_unit_with_tax,
quantity,
row_total_with_tax,
discount_amount,
):
result = {
"amount_refunded": 0,
"applied_rule_ids": "1,5",
"base_amount_refunded": 0,
"base_discount_amount": discount_amount,
"base_discount_invoiced": 0,
"base_discount_tax_compensation_amount": 0,
"base_original_price": 22,
"base_price": 22,
"base_price_incl_tax": price_unit_with_tax,
"base_row_invoiced": 0,
"base_row_total": 22,
"base_row_total_incl_tax": row_total_with_tax,
"base_tax_amount": 4.3,
"base_tax_invoiced": 0,
"created_at": confirmation_date,
"discount_amount": discount_amount,
"discount_invoiced": 0,
"discount_percent": 15,
"free_shipping": 0,
"discount_tax_compensation_amount": 0,
"is_qty_decimal": 0,
"is_virtual": 0,
"item_id": 224,
"name": item_name,
"no_discount": 0,
"order_id": order_id,
"original_price": 22,
"price": 22,
"price_incl_tax": price_unit_with_tax,
"product_id": 1546,
"product_type": "simple",
"qty_canceled": 0,
"qty_invoiced": 0,
"qty_ordered": 1,
"qty_refunded": 0,
"qty_shipped": 0,
"quote_item_id": 675,
"row_invoiced": 0,
"row_total": 22,
"row_total_incl_tax": row_total_with_tax,
"row_weight": 1,
"sku": str(sku),
"store_id": 1,
"tax_amount": 4.3,
"tax_invoiced": 0,
"tax_percent": 23,
"updated_at": confirmation_date,
"weight": 1
}
return result
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
3142,
1982,
29889,
5510,
13,
13,
1990,
4663,
10562,
7295,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
3234,
7249,
29898,
978,
29892,
2944,
29918,
333,
29892,
775,
29892,
8666,
29892,
5352,
29918,
1220,
29918,
4841,
29892,
29161,
29892,
17127,
519,
29918,
11991,
29892,
2159,
29918,
12715,
29918,
978,
29892,
2927,
29918,
12715,
29918,
978,
29892,
3495,
29918,
397,
3634,
1125,
13,
13,
4706,
396,
12782,
21115,
3987,
13,
4706,
17127,
519,
29918,
6768,
29918,
2378,
353,
5159,
13,
4706,
363,
17305,
297,
29161,
29901,
13,
9651,
17127,
519,
29918,
6768,
29918,
2378,
29889,
4397,
29898,
13,
18884,
4663,
10562,
29889,
2917,
21115,
29918,
3385,
29918,
7249,
29898,
13,
462,
1678,
17305,
29892,
13,
462,
1678,
2944,
29918,
333,
29892,
13,
462,
1678,
2159,
29918,
12715,
29918,
978,
29892,
13,
462,
1678,
2927,
29918,
12715,
29918,
978,
13,
18884,
1723,
13,
9651,
1723,
13,
13,
4706,
396,
12782,
21115,
4344,
13,
4706,
17127,
519,
29918,
11991,
29918,
2378,
353,
5159,
13,
4706,
363,
17127,
519,
297,
17127,
519,
29918,
11991,
29901,
13,
9651,
17127,
519,
29918,
11991,
29918,
2378,
29889,
4397,
29898,
13,
18884,
4663,
10562,
29889,
2917,
21115,
29918,
11991,
29918,
7249,
29898,
13,
462,
1678,
1024,
29892,
13,
462,
1678,
17127,
519,
29892,
13,
462,
1678,
2944,
29918,
333,
29892,
13,
462,
1678,
2159,
29918,
12715,
29918,
978,
29892,
13,
462,
1678,
2927,
29918,
12715,
29918,
978,
29892,
13,
462,
1678,
3495,
29918,
397,
3634,
13,
18884,
1723,
13,
9651,
1723,
13,
13,
4706,
396,
3824,
17305,
1178,
13,
4706,
937,
29918,
19365,
29918,
333,
353,
17127,
519,
29918,
11991,
29961,
29900,
1822,
657,
703,
333,
1159,
13,
13,
4706,
2752,
353,
426,
13,
9651,
376,
12715,
29918,
1220,
29918,
4841,
1115,
5352,
29918,
1220,
29918,
4841,
29892,
13,
9651,
376,
5927,
1934,
1115,
29161,
29892,
13,
9651,
376,
2917,
21115,
29918,
11991,
29918,
2378,
1115,
17127,
519,
29918,
11991,
29918,
2378,
29892,
13,
9651,
376,
11037,
4710,
29896,
29929,
29955,
613,
13,
9651,
376,
8216,
1115,
376,
5661,
22288,
12826,
10953,
29874,
378,
443,
25605,
712,
734,
25615,
20484,
316,
282,
583,
263,
27444,
1362,
1986,
28456,
12971,
29889,
4602,
8005,
23517,
784,
2361,
316,
425,
12826,
29871,
29906,
29900,
29896,
29929,
10953,
273,
1702,
18061,
7989,
427,
7444,
22288,
27181,
6941,
378,
425,
17363,
1986,
29609,
316,
5291,
15671,
25605,
19602,
13,
9651,
376,
687,
29877,
29918,
10855,
4710,
29896,
613,
13,
9651,
396,
6850,
8322,
8079,
8707,
18667,
4574,
6181,
6418,
29911,
27946,
13,
9651,
376,
2917,
21115,
29918,
6768,
29918,
13492,
1115,
29161,
29892,
13,
9651,
376,
2917,
21115,
29918,
6768,
1115,
17127,
519,
29918,
6768,
29918,
2378,
29892,
13,
9651,
396,
11056,
8079,
8707,
18667,
4574,
6181,
6418,
29911,
27946,
13,
9651,
376,
29873,
808,
1115,
29896,
29945,
29945,
29896,
29955,
29900,
29945,
29906,
29941,
29953,
29953,
29896,
29955,
29892,
13,
9651,
376,
6341,
29918,
15697,
1115,
6213,
29892,
13,
9651,
376,
2311,
29918,
6768,
1115,
29961,
1402,
13,
9651,
376,
15227,
29918,
9175,
1115,
29906,
29929,
29892,
13,
9651,
376,
261,
262,
29918,
276,
2055,
1975,
4710,
29900,
613,
13,
9651,
376,
8394,
29918,
9175,
1115,
8666,
29892,
13,
9651,
376,
9175,
1115,
29906,
29929,
29892,
13,
9651,
376,
2780,
29918,
6768,
1115,
29961,
1402,
13,
9651,
376,
4965,
1115,
29912,
1118,
13,
9651,
376,
333,
1115,
2944,
29918,
333,
29892,
13,
9651,
376,
7320,
29918,
4841,
1115,
29961,
13,
795,
376,
29906,
29945,
613,
13,
795,
376,
29941,
29941,
613,
13,
795,
376,
29947,
613,
13,
795,
376,
29941,
29953,
613,
13,
795,
376,
29906,
29908,
13,
9651,
21251,
13,
9651,
376,
18181,
1115,
851,
29898,
667,
29918,
333,
511,
13,
9651,
376,
17712,
1115,
29912,
13,
795,
376,
1195,
29918,
29879,
744,
29918,
29939,
1017,
1115,
29896,
29892,
13,
795,
376,
667,
29918,
333,
1115,
667,
29918,
333,
29892,
13,
795,
376,
1195,
29918,
29939,
1017,
1115,
29900,
29892,
13,
795,
376,
17712,
29918,
4882,
29918,
15033,
29918,
6921,
1115,
29900,
29892,
13,
795,
376,
275,
29918,
262,
29918,
17712,
1115,
5574,
29892,
13,
795,
376,
3317,
29918,
29879,
744,
29918,
29939,
1017,
1115,
29896,
29900,
29900,
29900,
29900,
29892,
13,
795,
376,
4294,
29918,
4381,
29918,
24671,
29918,
4906,
1115,
8824,
29892,
13,
795,
376,
1627,
20488,
1115,
29900,
29892,
13,
795,
376,
4704,
29918,
333,
1115,
667,
29918,
333,
29892,
13,
795,
376,
29939,
1017,
1115,
29900,
29892,
13,
795,
376,
275,
29918,
7099,
3039,
29918,
4563,
2618,
1115,
8824,
29892,
13,
795,
376,
275,
29918,
29939,
1017,
29918,
7099,
3039,
1115,
8824,
29892,
13,
795,
376,
677,
29918,
17712,
29918,
1256,
1115,
6213,
29892,
13,
795,
376,
1509,
29918,
2917,
29918,
29939,
1017,
29918,
262,
1037,
1860,
1115,
5574,
13,
9651,
2981,
13,
965,
376,
29517,
1115,
775,
29892,
13,
965,
376,
2271,
29918,
2084,
1115,
775,
29892,
13,
965,
376,
3027,
1115,
3495,
29918,
397,
3634,
718,
5591,
2676,
29914,
3027,
29914,
4704,
29889,
4704,
12975,
718,
851,
29898,
4102,
29918,
19365,
29918,
333,
29897,
718,
5591,
3027,
613,
13,
965,
376,
1482,
4710,
29896,
613,
13,
965,
376,
386,
21145,
1115,
3495,
29918,
397,
3634,
718,
5591,
2676,
29914,
3027,
29914,
4704,
29889,
4704,
12975,
718,
851,
29898,
4102,
29918,
19365,
29918,
333,
29897,
718,
5591,
3027,
613,
13,
965,
376,
28814,
1115,
29946,
29892,
13,
965,
376,
1853,
29918,
333,
4710,
2917,
21115,
613,
13,
965,
376,
20725,
29918,
1990,
29918,
333,
4710,
29906,
613,
13,
965,
376,
9799,
29918,
29887,
23365,
1115,
19997,
13,
965,
376,
695,
6490,
4710,
29906,
29900,
29945,
29892,
29906,
29900,
29929,
613,
13,
965,
376,
3293,
29918,
17492,
4710,
29896,
29941,
29953,
613,
13,
965,
376,
2271,
29918,
1989,
1115,
4663,
10562,
29889,
2271,
29918,
1989,
29898,
978,
511,
13,
965,
376,
546,
13390,
29918,
16582,
2200,
4710,
29900,
613,
13,
965,
376,
29879,
744,
4710,
29900,
613,
13,
965,
376,
3317,
29918,
9175,
1115,
8666,
29892,
13,
965,
376,
1195,
3039,
29918,
15227,
29918,
9175,
1115,
8666,
29892,
13,
965,
376,
15388,
4710,
29896,
29945,
29941,
29892,
29896,
29945,
29946,
613,
13,
965,
376,
18732,
29918,
9175,
1115,
29900,
29892,
13,
965,
376,
1195,
3039,
29918,
9175,
1115,
8666,
29892,
13,
965,
376,
978,
1115,
1024,
29892,
13,
9651,
396,
6850,
8322,
8079,
8707,
18667,
4574,
6181,
5868,
6227,
8353,
1430,
13,
9651,
376,
2917,
21115,
29918,
11991,
29918,
13492,
1115,
17127,
519,
29918,
11991,
29892,
13,
9651,
376,
2917,
21115,
29918,
11991,
1115,
17127,
519,
29918,
11991,
29918,
2378,
29892,
13,
9651,
396,
11056,
8079,
8707,
18667,
4574,
6181,
5868,
6227,
8353,
1430,
13,
9651,
376,
3317,
29918,
15227,
29918,
9175,
1115,
8666,
29892,
13,
9651,
376,
7320,
1115,
29961,
1402,
13,
9651,
376,
4882,
1115,
29896,
29892,
13,
9651,
376,
9175,
29911,
1165,
1115,
29953,
29889,
29953,
29955,
29892,
13,
9651,
376,
9175,
797,
695,
29911,
1165,
1115,
8666,
29892,
13,
9651,
376,
18732,
13026,
29911,
1165,
1115,
6213,
29892,
13,
9651,
376,
18732,
13026,
797,
695,
29911,
1165,
1115,
6213,
13,
4706,
500,
13,
4706,
736,
426,
13,
9651,
11119,
4993,
1115,
2752,
29892,
13,
9651,
11119,
13628,
1115,
29871,
29896,
13,
4706,
500,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
17127,
519,
29918,
3385,
29918,
7249,
29898,
19365,
29892,
2944,
29918,
333,
29892,
2159,
29918,
12715,
29918,
978,
29892,
2927,
29918,
12715,
29918,
978,
1125,
13,
13,
4706,
5352,
29918,
333,
353,
17305,
29889,
657,
703,
12715,
29918,
333,
1159,
29961,
29900,
29962,
13,
4706,
5352,
29918,
978,
353,
17305,
29889,
657,
703,
12715,
29918,
333,
1159,
29961,
29896,
29962,
13,
13,
4706,
5352,
29918,
1643,
29918,
3126,
353,
6213,
13,
4706,
5352,
29918,
401,
29918,
3126,
353,
6213,
13,
13,
4706,
565,
5352,
29918,
978,
1275,
2159,
29918,
12715,
29918,
978,
29901,
13,
9651,
5352,
29918,
1643,
29918,
3126,
353,
376,
3505,
29908,
13,
9651,
5352,
29918,
401,
29918,
3126,
353,
376,
2311,
29908,
13,
4706,
25342,
5352,
29918,
978,
1275,
2927,
29918,
12715,
29918,
978,
29901,
13,
9651,
5352,
29918,
1643,
29918,
3126,
353,
376,
3306,
29908,
13,
9651,
5352,
29918,
401,
29918,
3126,
353,
376,
2780,
29908,
13,
13,
4706,
1819,
29918,
2378,
353,
5159,
13,
4706,
8393,
353,
17305,
29889,
657,
703,
15697,
1159,
13,
4706,
363,
5352,
297,
8393,
29901,
13,
13,
9651,
565,
5352,
29918,
978,
1275,
2159,
29918,
12715,
29918,
978,
29901,
13,
18884,
1819,
29918,
2378,
29889,
4397,
3319,
13,
462,
1678,
376,
1767,
29918,
2248,
1115,
5352,
29961,
29900,
1822,
657,
703,
333,
4968,
13,
462,
1678,
376,
1643,
1115,
851,
29898,
12715,
29961,
29900,
1822,
657,
703,
978,
1159,
511,
13,
18884,
5615,
13,
9651,
25342,
5352,
29918,
978,
1275,
2927,
29918,
12715,
29918,
978,
29901,
13,
18884,
1819,
29918,
2378,
29889,
4397,
3319,
13,
462,
1678,
376,
1767,
29918,
2248,
1115,
5352,
29961,
29900,
1822,
657,
703,
333,
4968,
13,
462,
1678,
376,
1643,
1115,
12305,
29908,
718,
851,
29898,
12715,
29961,
29900,
1822,
657,
703,
1420,
29918,
2780,
1159,
511,
13,
18884,
5615,
13,
13,
4706,
1121,
353,
426,
13,
632,
376,
12715,
29918,
333,
1115,
5352,
29918,
333,
29892,
13,
632,
376,
5975,
1115,
1819,
29918,
2378,
29892,
13,
632,
376,
4704,
29918,
333,
1115,
2944,
29918,
333,
29892,
13,
632,
376,
333,
1115,
5352,
29918,
333,
29892,
13,
632,
376,
1643,
1115,
5352,
29918,
1643,
29918,
3126,
29892,
13,
632,
376,
3283,
1115,
29871,
29900,
29892,
13,
632,
376,
12715,
29918,
401,
1115,
5352,
29918,
401,
29918,
3126,
13,
3986,
500,
13,
4706,
736,
1121,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
3142,
29918,
1989,
29898,
978,
1125,
13,
4706,
736,
3142,
1982,
29889,
5510,
29889,
1396,
29918,
11242,
29898,
978,
467,
13609,
2141,
6506,
703,
29974,
613,
11663,
1159,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
17127,
519,
29918,
11991,
29918,
7249,
29898,
978,
29892,
17127,
519,
29892,
2944,
29918,
333,
29892,
2159,
29918,
12715,
29918,
978,
29892,
2927,
29918,
12715,
29918,
978,
29892,
3495,
29918,
397,
3634,
1125,
13,
13,
4706,
396,
3617,
2159,
322,
2927,
13,
4706,
2159,
29918,
333,
353,
6213,
13,
4706,
2927,
29918,
333,
353,
6213,
13,
4706,
8393,
353,
17127,
519,
29889,
657,
703,
15697,
1159,
13,
4706,
363,
5352,
297,
8393,
29901,
13,
13,
9651,
5352,
29918,
978,
353,
5352,
29961,
29900,
1822,
657,
703,
12715,
29918,
333,
1159,
29961,
29896,
29962,
13,
13,
9651,
565,
5352,
29918,
978,
1275,
2159,
29918,
12715,
29918,
978,
29901,
13,
18884,
2159,
29918,
333,
353,
5352,
29961,
29900,
1822,
657,
703,
333,
1159,
13,
9651,
25342,
5352,
29918,
978,
1275,
2927,
29918,
12715,
29918,
978,
29901,
13,
18884,
2927,
29918,
333,
353,
5352,
29961,
29900,
1822,
657,
703,
333,
1159,
13,
13,
4706,
2159,
29918,
333,
29918,
1807,
353,
851,
29898,
2311,
29918,
333,
29897,
13,
4706,
2927,
29918,
333,
29918,
1807,
353,
851,
29898,
2780,
29918,
333,
29897,
13,
13,
4706,
1121,
353,
426,
13,
632,
376,
3027,
1115,
3495,
29918,
397,
3634,
718,
5591,
2676,
29914,
3027,
29914,
4704,
29889,
4704,
12975,
718,
851,
29898,
2917,
21115,
29889,
657,
703,
333,
5783,
718,
5591,
3027,
613,
13,
632,
376,
386,
21145,
1115,
3495,
29918,
397,
3634,
718,
5591,
2676,
29914,
3027,
29914,
4704,
29889,
4704,
12975,
718,
851,
29898,
2917,
21115,
29889,
657,
703,
333,
5783,
718,
5591,
3027,
613,
13,
632,
376,
2780,
1115,
2927,
29918,
333,
29918,
1807,
29892,
13,
632,
376,
9278,
29918,
3027,
1115,
3495,
29918,
397,
3634,
718,
5591,
2676,
29914,
3027,
29914,
4704,
29889,
4704,
12975,
718,
851,
29898,
2917,
21115,
29889,
657,
703,
333,
5783,
718,
5591,
3027,
613,
13,
632,
376,
20725,
29918,
1990,
29918,
333,
4710,
29906,
613,
13,
632,
376,
5349,
29918,
6768,
4710,
29900,
613,
13,
632,
376,
2271,
29918,
1989,
1115,
4663,
10562,
29889,
2271,
29918,
1989,
29898,
978,
511,
13,
632,
376,
15227,
29918,
9175,
1115,
17127,
519,
29889,
657,
703,
1761,
29918,
9175,
4968,
13,
632,
376,
12403,
29918,
6768,
4710,
29900,
613,
13,
632,
376,
3317,
29918,
9175,
1115,
17127,
519,
29889,
657,
703,
1761,
29918,
9175,
4968,
13,
632,
376,
1195,
3039,
29918,
15227,
29918,
9175,
1115,
17127,
519,
29889,
657,
703,
1761,
29918,
9175,
4968,
13,
632,
376,
2311,
1115,
2159,
29918,
333,
29918,
1807,
29892,
13,
632,
376,
8394,
29918,
9175,
1115,
17127,
519,
29889,
657,
703,
1761,
29918,
9175,
4968,
13,
632,
376,
18732,
29918,
9175,
1115,
29900,
29892,
13,
632,
376,
9175,
1115,
29906,
29929,
29892,
13,
632,
376,
1195,
3039,
29918,
9175,
1115,
17127,
519,
29889,
657,
703,
1761,
29918,
9175,
4968,
13,
632,
376,
978,
1115,
2159,
29918,
333,
29918,
1807,
718,
11663,
29908,
718,
2927,
29918,
333,
29918,
1807,
29892,
13,
632,
376,
333,
1115,
17127,
519,
29889,
657,
703,
333,
4968,
13,
632,
376,
7320,
29918,
4841,
1115,
29961,
1402,
13,
632,
376,
18181,
1115,
851,
29898,
2917,
21115,
29889,
657,
703,
333,
1159,
511,
13,
632,
376,
3317,
29918,
15227,
29918,
9175,
1115,
17127,
519,
29889,
657,
703,
1761,
29918,
9175,
4968,
13,
632,
376,
4882,
1115,
29896,
29892,
13,
632,
376,
9175,
29911,
1165,
1115,
29953,
29889,
29953,
29955,
29892,
13,
632,
376,
9175,
797,
695,
29911,
1165,
1115,
17127,
519,
29889,
657,
703,
1761,
29918,
9175,
4968,
13,
632,
376,
18732,
13026,
29911,
1165,
1115,
6213,
29892,
13,
632,
376,
18732,
13026,
797,
695,
29911,
1165,
1115,
6213,
13,
3986,
500,
13,
4706,
736,
1121,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
5352,
7249,
29898,
12715,
29918,
333,
29892,
5352,
29918,
401,
29892,
2322,
29918,
8862,
355,
29918,
1643,
1125,
13,
4706,
736,
426,
13,
3986,
376,
275,
29918,
29893,
952,
9429,
4790,
29918,
17590,
1115,
7700,
29892,
13,
3986,
376,
275,
29918,
1420,
29918,
24622,
29918,
265,
29918,
8862,
1115,
5852,
29892,
13,
3986,
376,
3880,
29918,
1454,
29918,
6605,
29918,
1609,
1115,
7700,
29892,
13,
3986,
376,
275,
29918,
4572,
519,
1115,
5852,
29892,
13,
3986,
376,
275,
29918,
4572,
519,
29918,
262,
29918,
4478,
1115,
7700,
29892,
13,
3986,
376,
275,
29918,
3880,
29918,
262,
29918,
7720,
1115,
7700,
29892,
13,
3986,
376,
275,
29918,
12872,
29918,
262,
29918,
7720,
1115,
7700,
29892,
13,
3986,
376,
275,
29918,
4572,
519,
29918,
262,
29918,
7720,
1115,
7700,
29892,
13,
3986,
376,
3283,
1115,
29871,
29900,
29892,
13,
3986,
376,
7302,
29918,
517,
1115,
19997,
13,
3986,
376,
275,
29918,
4478,
519,
1115,
376,
29900,
613,
13,
3986,
376,
275,
29918,
12872,
29918,
262,
29918,
328,
16858,
29918,
4478,
1115,
376,
29900,
613,
13,
3986,
376,
275,
29918,
510,
862,
519,
1115,
376,
29900,
613,
13,
3986,
376,
275,
29918,
3880,
29918,
1454,
29918,
14032,
29877,
29918,
19238,
1115,
376,
29896,
613,
13,
3986,
376,
275,
29918,
12872,
29918,
265,
29918,
8862,
1115,
376,
29900,
613,
13,
3986,
376,
3880,
29918,
262,
29918,
4704,
29918,
1761,
292,
1115,
376,
29896,
613,
13,
3986,
376,
275,
29918,
12872,
1115,
5852,
29892,
13,
3986,
376,
6078,
1115,
376,
10945,
613,
13,
3986,
376,
12715,
29918,
333,
1115,
5352,
29918,
333,
29892,
13,
3986,
376,
12715,
29918,
401,
1115,
5352,
29918,
401,
29892,
13,
3986,
376,
8862,
355,
29918,
2080,
1115,
376,
2622,
613,
13,
3986,
376,
10041,
29918,
1853,
29918,
333,
1115,
376,
29946,
613,
13,
3986,
376,
275,
29918,
12403,
1115,
7700,
29892,
13,
3986,
376,
6768,
1115,
19997,
13,
3986,
376,
275,
29918,
1792,
29918,
12119,
1115,
5852,
29892,
13,
3986,
376,
4381,
29918,
8862,
355,
29918,
1643,
1115,
2322,
29918,
8862,
355,
29918,
1643,
29892,
13,
3986,
376,
8862,
355,
29918,
21134,
1115,
6213,
29892,
13,
3986,
376,
27852,
29918,
1853,
1115,
376,
524,
613,
13,
3986,
376,
275,
29918,
13092,
1115,
376,
29900,
613,
13,
3986,
376,
18157,
29918,
19238,
1115,
19997,
13,
3986,
376,
333,
1115,
29871,
29896,
29946,
29906,
29892,
13,
3986,
376,
29873,
808,
1115,
29871,
29896,
29945,
29896,
29906,
29896,
29941,
29946,
29953,
29946,
29955,
29953,
29929,
29896,
29892,
13,
3986,
376,
4381,
29918,
1767,
1115,
376,
29929,
29896,
613,
13,
3986,
376,
4993,
29918,
4299,
1115,
376,
19095,
9239,
1966,
29923,
485,
1966,
3195,
1966,
6691,
1966,
6708,
1966,
4435,
1966,
3562,
613,
13,
3986,
376,
29879,
5138,
1115,
376,
29894,
29950,
29895,
29926,
29903,
29906,
29885,
29954,
398,
29873,
29887,
29926,
29926,
29920,
29880,
25639,
29954,
29967,
29876,
29943,
29953,
29875,
29947,
29923,
29872,
29965,
29965,
29906,
7516,
29883,
29906,
7730,
24625,
29953,
29929,
2882,
29883,
29908,
13,
4706,
500,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
7663,
29918,
3126,
29898,
978,
29892,
1178,
29892,
3847,
29918,
333,
29892,
2278,
29879,
29892,
3233,
29892,
7663,
29918,
10289,
1125,
13,
4706,
4344,
29918,
1272,
353,
5159,
13,
4706,
363,
2278,
297,
2278,
29879,
29901,
13,
9651,
4344,
29918,
1272,
29889,
4397,
3319,
13,
18884,
376,
333,
1115,
2278,
13,
9651,
5615,
13,
4706,
4344,
29918,
2798,
353,
7431,
29898,
11991,
29918,
1272,
29897,
13,
13,
4706,
565,
4344,
29918,
2798,
1275,
29871,
29900,
29901,
13,
9651,
1121,
353,
426,
13,
18884,
11119,
2248,
4710,
19682,
29918,
8899,
8862,
29918,
28045,
29918,
29896,
29945,
29945,
29906,
29945,
29945,
29929,
29896,
29900,
29906,
613,
13,
18884,
11119,
1853,
4710,
7320,
613,
13,
18884,
11119,
333,
1115,
1178,
29892,
13,
18884,
11119,
13628,
1115,
6213,
29892,
13,
18884,
11119,
4993,
1115,
29912,
13,
462,
1678,
376,
2084,
4710,
29896,
29914,
29906,
29914,
29906,
29900,
613,
13,
462,
1678,
376,
275,
29918,
4925,
1115,
5852,
29892,
13,
462,
1678,
376,
5563,
1115,
3233,
29892,
13,
462,
1678,
376,
4704,
29918,
2798,
1115,
29896,
29892,
13,
462,
1678,
376,
11991,
29918,
2798,
1115,
851,
29898,
11991,
29918,
2798,
511,
13,
462,
1678,
376,
3560,
29918,
333,
1115,
3847,
29918,
333,
29892,
13,
462,
1678,
376,
978,
1115,
1024,
29892,
13,
462,
1678,
376,
333,
1115,
1178,
718,
7663,
29918,
10289,
29892,
13,
462,
1678,
376,
2271,
29918,
2084,
1115,
376,
20683,
29914,
7320,
29899,
29908,
718,
851,
29898,
333,
718,
7663,
29918,
10289,
511,
13,
462,
1678,
376,
2271,
29918,
1989,
1115,
851,
29898,
333,
718,
7663,
29918,
10289,
511,
13,
18884,
2981,
13,
18884,
376,
6605,
1115,
29961,
13,
462,
268,
29906,
13,
18884,
4514,
13,
9651,
500,
13,
4706,
1683,
29901,
13,
9651,
1121,
353,
426,
13,
18884,
11119,
2248,
1115,
376,
19682,
29918,
8899,
8862,
29918,
28045,
29918,
29896,
29945,
29945,
29906,
29945,
29945,
29929,
29896,
29900,
29906,
613,
13,
18884,
11119,
1853,
1115,
376,
7320,
613,
13,
18884,
11119,
333,
1115,
1178,
29892,
13,
18884,
11119,
13628,
1115,
6213,
29892,
13,
18884,
11119,
4993,
1115,
426,
13,
462,
1678,
376,
2084,
1115,
376,
29896,
29914,
29906,
29914,
29906,
29900,
613,
13,
462,
1678,
376,
275,
29918,
4925,
1115,
5852,
29892,
13,
462,
1678,
376,
5563,
1115,
3233,
29892,
13,
462,
1678,
376,
4704,
29918,
2798,
1115,
29871,
29896,
29892,
13,
462,
1678,
376,
11991,
29918,
2798,
1115,
851,
29898,
11991,
29918,
2798,
511,
13,
462,
1678,
376,
3560,
29918,
333,
1115,
3847,
29918,
333,
29892,
13,
462,
1678,
376,
978,
1115,
1024,
29892,
13,
462,
1678,
376,
333,
1115,
1178,
718,
7663,
29918,
10289,
29892,
13,
462,
1678,
376,
2271,
29918,
2084,
1115,
376,
20683,
29914,
7320,
29899,
29908,
718,
851,
29898,
333,
718,
7663,
29918,
10289,
511,
13,
462,
1678,
376,
2271,
29918,
1989,
1115,
851,
29898,
333,
718,
7663,
29918,
10289,
511,
13,
462,
1678,
376,
11991,
29918,
1272,
1115,
4344,
29918,
1272,
13,
18884,
2981,
13,
18884,
376,
6605,
1115,
518,
13,
462,
268,
29906,
13,
18884,
4514,
13,
9651,
500,
13,
4706,
736,
1121,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
13997,
29918,
517,
29918,
5327,
29898,
20683,
29892,
3233,
29892,
3847,
29918,
333,
29892,
7663,
29918,
10289,
1125,
13,
4706,
13997,
29918,
2378,
353,
5159,
13,
4706,
363,
7663,
297,
13997,
29901,
13,
9651,
13997,
29918,
2378,
29889,
4397,
29898,
7249,
10562,
29889,
7320,
29918,
3126,
29898,
13,
18884,
7663,
3366,
978,
12436,
13,
18884,
7663,
3366,
333,
12436,
13,
18884,
3847,
29918,
333,
29892,
13,
18884,
7663,
3366,
5145,
29918,
333,
12436,
13,
18884,
3233,
29892,
13,
18884,
7663,
29918,
10289,
13,
632,
876,
13,
13,
4706,
2933,
353,
426,
13,
9651,
376,
517,
554,
1115,
29871,
29896,
29892,
13,
9651,
376,
9346,
287,
29918,
449,
1115,
7700,
29892,
13,
9651,
11119,
845,
3163,
1115,
426,
13,
18884,
376,
7827,
1115,
29871,
29945,
29892,
13,
18884,
376,
8698,
1319,
1115,
29871,
29945,
29892,
13,
18884,
376,
2574,
2986,
1115,
29871,
29900,
29892,
13,
18884,
376,
26061,
1115,
29871,
29900,
13,
9651,
2981,
13,
9651,
376,
29882,
1169,
1115,
426,
13,
18884,
376,
7827,
1115,
29871,
29953,
29892,
13,
18884,
376,
3317,
29918,
13628,
1115,
6213,
29892,
13,
18884,
376,
29882,
1169,
1115,
13997,
29918,
2378,
13,
9651,
500,
13,
4706,
500,
13,
4706,
736,
2933,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
5352,
7249,
29898,
13,
9651,
338,
29918,
1420,
29918,
24622,
29918,
265,
29918,
8862,
29892,
13,
9651,
1304,
29918,
1454,
29918,
6605,
29918,
1609,
29892,
13,
9651,
338,
29918,
3880,
29918,
262,
29918,
7720,
29892,
13,
9651,
338,
29918,
4572,
519,
29918,
262,
29918,
7720,
29892,
13,
9651,
3394,
29918,
517,
29892,
13,
9651,
338,
29918,
4478,
519,
29892,
13,
9651,
338,
29918,
12872,
29918,
262,
29918,
328,
16858,
29918,
4478,
29892,
13,
9651,
338,
29918,
3880,
29918,
1454,
29918,
14032,
29877,
29918,
19238,
29892,
13,
9651,
1304,
29918,
262,
29918,
4704,
29918,
1761,
292,
29892,
13,
9651,
5352,
29918,
333,
29892,
13,
9651,
5352,
29918,
401,
29892,
13,
9651,
4565,
355,
29918,
2080,
29892,
13,
9651,
338,
29918,
12403,
29892,
13,
9651,
3987,
29892,
13,
9651,
338,
29918,
1792,
29918,
12119,
29892,
13,
9651,
2322,
29918,
8862,
355,
29918,
1643,
29892,
13,
9651,
14998,
29918,
1853,
29892,
13,
9651,
14998,
29918,
4299,
29892,
13,
9651,
2752,
29918,
4299,
29892,
13,
9651,
2322,
29918,
1767,
29892,
13,
9651,
1178,
13,
308,
1125,
13,
4706,
2933,
353,
426,
13,
965,
376,
275,
29918,
29893,
952,
9429,
4790,
29918,
17590,
1115,
7700,
29892,
13,
965,
376,
275,
29918,
1420,
29918,
24622,
29918,
265,
29918,
8862,
1115,
338,
29918,
1420,
29918,
24622,
29918,
265,
29918,
8862,
29892,
13,
965,
376,
3880,
29918,
1454,
29918,
6605,
29918,
1609,
1115,
1304,
29918,
1454,
29918,
6605,
29918,
1609,
29892,
13,
965,
376,
275,
29918,
4572,
519,
1115,
5852,
29892,
13,
965,
376,
275,
29918,
4572,
519,
29918,
262,
29918,
4478,
1115,
7700,
29892,
13,
965,
376,
275,
29918,
3880,
29918,
262,
29918,
7720,
1115,
338,
29918,
3880,
29918,
262,
29918,
7720,
29892,
13,
965,
376,
275,
29918,
12872,
29918,
262,
29918,
7720,
1115,
7700,
29892,
13,
965,
376,
275,
29918,
4572,
519,
29918,
262,
29918,
7720,
1115,
338,
29918,
4572,
519,
29918,
262,
29918,
7720,
29892,
13,
965,
376,
3283,
1115,
29900,
29892,
13,
965,
376,
7302,
29918,
517,
1115,
3394,
29918,
517,
29892,
13,
965,
376,
275,
29918,
4478,
519,
1115,
338,
29918,
4478,
519,
29892,
13,
965,
376,
275,
29918,
12872,
29918,
262,
29918,
328,
16858,
29918,
4478,
1115,
338,
29918,
12872,
29918,
262,
29918,
328,
16858,
29918,
4478,
29892,
13,
965,
376,
275,
29918,
510,
862,
519,
4710,
29900,
613,
13,
965,
376,
275,
29918,
3880,
29918,
1454,
29918,
14032,
29877,
29918,
19238,
1115,
338,
29918,
3880,
29918,
1454,
29918,
14032,
29877,
29918,
19238,
29892,
13,
965,
376,
275,
29918,
12872,
29918,
265,
29918,
8862,
4710,
29900,
613,
13,
965,
376,
3880,
29918,
262,
29918,
4704,
29918,
1761,
292,
1115,
1304,
29918,
262,
29918,
4704,
29918,
1761,
292,
29892,
13,
965,
376,
275,
29918,
12872,
1115,
5852,
29892,
13,
965,
376,
6078,
4710,
10945,
613,
13,
965,
376,
12715,
29918,
333,
1115,
5352,
29918,
333,
29892,
13,
965,
376,
12715,
29918,
401,
1115,
5352,
29918,
401,
29892,
13,
965,
376,
8862,
355,
29918,
2080,
1115,
4565,
355,
29918,
2080,
29892,
13,
965,
376,
10041,
29918,
1853,
29918,
333,
4710,
29946,
613,
13,
965,
376,
275,
29918,
12403,
1115,
338,
29918,
12403,
29892,
13,
965,
376,
6768,
1115,
3987,
29892,
13,
965,
376,
275,
29918,
1792,
29918,
12119,
1115,
338,
29918,
1792,
29918,
12119,
29892,
13,
965,
376,
4381,
29918,
8862,
355,
29918,
1643,
1115,
2322,
29918,
8862,
355,
29918,
1643,
29892,
13,
965,
376,
8862,
355,
29918,
21134,
1115,
6213,
29892,
13,
965,
376,
27852,
29918,
1853,
1115,
14998,
29918,
1853,
29892,
13,
965,
376,
27852,
29918,
4299,
1115,
14998,
29918,
4299,
29892,
13,
965,
376,
4993,
29918,
4299,
1115,
2752,
29918,
4299,
29892,
13,
965,
376,
4381,
29918,
1767,
1115,
2322,
29918,
1767,
29892,
13,
965,
376,
275,
29918,
13092,
4710,
29900,
613,
13,
965,
376,
18157,
29918,
19238,
1115,
29961,
13,
13,
965,
21251,
13,
965,
376,
333,
1115,
1178,
29892,
13,
965,
376,
29873,
808,
1115,
29896,
29945,
29945,
29896,
29955,
29900,
29945,
29906,
29941,
29896,
29906,
29945,
29896,
13,
4706,
500,
13,
4706,
736,
2933,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1797,
29918,
3126,
29898,
13,
9651,
1797,
29918,
333,
29892,
13,
9651,
9659,
362,
29918,
1256,
29892,
13,
9651,
5253,
29918,
7827,
29892,
13,
9651,
5253,
29918,
20725,
29892,
13,
9651,
5253,
29918,
16138,
29916,
287,
29892,
13,
9651,
528,
17347,
29918,
14506,
29892,
13,
9651,
2313,
792,
29918,
14506,
29892,
13,
9651,
4452,
29918,
2378,
29892,
13,
9651,
1024,
29892,
13,
9651,
1833,
978,
29892,
13,
9651,
4272,
29892,
13,
9651,
1400,
401,
29892,
13,
9651,
11952,
29892,
13,
268,
1125,
13,
4706,
1121,
353,
426,
13,
9651,
376,
932,
2957,
29918,
7491,
29918,
4841,
1115,
376,
29896,
29892,
29945,
613,
13,
9651,
376,
3188,
29918,
26095,
29918,
401,
1115,
376,
3308,
29928,
613,
13,
9651,
376,
3188,
29918,
2218,
2798,
29918,
14506,
1115,
8521,
29896,
29897,
334,
2313,
792,
29918,
14506,
29892,
13,
9651,
376,
3188,
29918,
27857,
29918,
7827,
1115,
5253,
29918,
7827,
29892,
13,
9651,
376,
3188,
29918,
2218,
2798,
29918,
20725,
29918,
2388,
575,
362,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
3188,
29918,
845,
17347,
29918,
14506,
1115,
528,
17347,
29918,
14506,
29892,
13,
9651,
376,
3188,
29918,
845,
17347,
29918,
2218,
2798,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
3188,
29918,
845,
17347,
29918,
262,
695,
29918,
20725,
1115,
528,
17347,
29918,
14506,
29892,
13,
9651,
376,
3188,
29918,
845,
17347,
29918,
20725,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
3188,
29918,
1491,
7827,
1115,
5253,
29918,
16138,
29916,
287,
29892,
13,
9651,
376,
3188,
29918,
1491,
7827,
29918,
262,
695,
29918,
20725,
1115,
5253,
29918,
7827,
29892,
13,
9651,
376,
3188,
29918,
20725,
29918,
14506,
1115,
5253,
29918,
20725,
29892,
13,
9651,
376,
3188,
29918,
7827,
29918,
29123,
1115,
5253,
29918,
7827,
29892,
13,
9651,
376,
3188,
29918,
517,
29918,
10945,
29918,
10492,
1115,
29871,
29896,
29892,
13,
9651,
376,
3188,
29918,
517,
29918,
2098,
29918,
10492,
1115,
29871,
29896,
29892,
13,
9651,
376,
29890,
8873,
29918,
7328,
29918,
333,
1115,
29871,
29906,
29900,
29946,
29892,
13,
9651,
376,
11600,
29918,
271,
1115,
9659,
362,
29918,
1256,
29892,
13,
9651,
376,
15539,
29918,
5269,
1115,
9872,
26862,
6227,
28341,
13,
9651,
376,
15539,
29918,
2972,
29918,
333,
1115,
29871,
29900,
29892,
13,
9651,
376,
15539,
29918,
275,
29918,
2543,
342,
1115,
29871,
29896,
29892,
13,
9651,
376,
15539,
29918,
6812,
29918,
25140,
1115,
29871,
29896,
29892,
13,
9651,
376,
2218,
2798,
29918,
14506,
1115,
8521,
29896,
29897,
334,
2313,
792,
29918,
14506,
29892,
13,
9651,
376,
5269,
29918,
18616,
1115,
29871,
29896,
29892,
13,
9651,
376,
10041,
29918,
333,
1115,
1797,
29918,
333,
29892,
13,
9651,
376,
10945,
29918,
26095,
29918,
401,
1115,
376,
3308,
29928,
613,
13,
9651,
376,
27857,
29918,
7827,
1115,
5253,
29918,
7827,
29892,
13,
9651,
376,
2218,
2798,
29918,
20725,
29918,
2388,
575,
362,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
25629,
29918,
333,
1115,
851,
29898,
2098,
29918,
333,
511,
13,
9651,
376,
275,
29918,
18714,
1115,
29871,
29900,
29892,
13,
9651,
376,
2098,
29918,
26095,
29918,
401,
1115,
376,
3308,
29928,
613,
13,
9651,
376,
14676,
312,
29918,
401,
1115,
376,
29941,
29929,
29947,
29946,
29947,
29941,
29945,
29881,
29941,
29941,
370,
29881,
29906,
29946,
29906,
29941,
29890,
29947,
29874,
29946,
29955,
1389,
29881,
29900,
29888,
29955,
29946,
29945,
29955,
29929,
613,
13,
9651,
376,
1396,
29918,
333,
1115,
29871,
29896,
29896,
29896,
29906,
29892,
13,
9651,
376,
845,
17347,
29918,
14506,
1115,
528,
17347,
29918,
14506,
29892,
13,
9651,
376,
845,
17347,
29918,
8216,
1115,
376,
29943,
5066,
390,
403,
448,
383,
11925,
613,
13,
9651,
376,
845,
17347,
29918,
2218,
2798,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
845,
17347,
29918,
2218,
2798,
29918,
20725,
29918,
2388,
575,
362,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
845,
17347,
29918,
262,
695,
29918,
20725,
1115,
528,
17347,
29918,
14506,
29892,
13,
9651,
376,
845,
17347,
29918,
20725,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
3859,
1115,
376,
1482,
613,
13,
9651,
376,
4882,
1115,
376,
29886,
2548,
613,
13,
9651,
376,
8899,
29918,
26095,
29918,
401,
1115,
376,
3308,
29928,
613,
13,
9651,
376,
8899,
29918,
333,
1115,
29871,
29896,
29892,
13,
9651,
376,
8899,
29918,
978,
1115,
376,
6330,
13253,
29905,
29876,
6330,
13253,
14491,
29905,
29876,
613,
13,
9651,
376,
8899,
29918,
517,
29918,
3188,
29918,
10492,
1115,
29871,
29900,
29892,
13,
9651,
376,
8899,
29918,
517,
29918,
2098,
29918,
10492,
1115,
29871,
29900,
29892,
13,
9651,
376,
1491,
7827,
1115,
5253,
29918,
16138,
29916,
287,
29892,
13,
9651,
376,
1491,
7827,
29918,
262,
695,
29918,
20725,
1115,
5253,
29918,
7827,
29892,
13,
9651,
376,
20725,
29918,
14506,
1115,
5253,
29918,
20725,
29892,
13,
9651,
376,
7827,
29918,
29123,
1115,
5253,
29918,
7827,
29892,
13,
9651,
376,
7827,
29918,
667,
29918,
2798,
1115,
29871,
29896,
29892,
13,
9651,
376,
7827,
29918,
29939,
1017,
29918,
21693,
1115,
29871,
29896,
29892,
13,
9651,
376,
21402,
29918,
271,
1115,
9659,
362,
29918,
1256,
29892,
13,
9651,
376,
7915,
1115,
29871,
29896,
29892,
13,
9651,
376,
7076,
1115,
4452,
29918,
2378,
29892,
13,
9651,
376,
29890,
8873,
29918,
7328,
1115,
426,
13,
18884,
376,
7328,
29918,
1853,
1115,
376,
29890,
8873,
613,
13,
18884,
376,
12690,
1115,
4272,
29892,
13,
18884,
376,
14518,
1115,
376,
12596,
1647,
613,
13,
18884,
376,
13509,
29918,
333,
1115,
376,
7390,
613,
13,
18884,
376,
5269,
1115,
9872,
26862,
6227,
28341,
13,
18884,
376,
10041,
29918,
333,
1115,
29871,
29906,
29900,
29946,
29892,
13,
18884,
376,
4102,
978,
1115,
1024,
29892,
13,
18884,
376,
4230,
978,
1115,
1833,
978,
29892,
13,
18884,
376,
3560,
29918,
333,
1115,
1797,
29918,
333,
29892,
13,
18884,
376,
2490,
401,
1115,
1400,
401,
29892,
13,
18884,
376,
29352,
1115,
518,
13,
462,
1678,
11952,
29892,
13,
462,
1678,
5124,
13,
18884,
21251,
13,
18884,
376,
15494,
6710,
1115,
6213,
29892,
13,
18884,
376,
9046,
29918,
333,
1115,
376,
7390,
29947,
29929,
29945,
29896,
29929,
29941,
29900,
29955,
29946,
29947,
29908,
13,
9651,
2981,
13,
9651,
376,
27825,
1115,
426,
13,
18884,
376,
10149,
29918,
4882,
1115,
6213,
29892,
13,
18884,
376,
1202,
3245,
29918,
19678,
1115,
518,
13,
462,
1678,
376,
29907,
1161,
1551,
360,
27657,
613,
13,
462,
1678,
5124,
13,
18884,
21251,
13,
18884,
376,
14506,
29918,
21693,
1115,
5253,
29918,
7827,
29892,
13,
18884,
376,
3188,
29918,
14506,
29918,
21693,
1115,
5253,
29918,
7827,
29892,
13,
18884,
376,
3188,
29918,
845,
17347,
29918,
14506,
1115,
528,
17347,
29918,
14506,
29892,
13,
18884,
376,
617,
29918,
4230,
29946,
1115,
6213,
29892,
13,
18884,
376,
10041,
29918,
333,
1115,
1797,
29918,
333,
29892,
13,
18884,
376,
5696,
1115,
376,
29883,
1161,
898,
27657,
613,
13,
18884,
376,
3560,
29918,
333,
1115,
1797,
29918,
333,
29892,
13,
18884,
376,
845,
17347,
29918,
14506,
1115,
29871,
29945,
13,
9651,
2981,
13,
9651,
376,
4882,
29918,
16211,
583,
1115,
19997,
13,
9651,
376,
17588,
29918,
15697,
1115,
426,
13,
18884,
376,
845,
17347,
29918,
16645,
1860,
1115,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
845,
17347,
1115,
426,
13,
462,
9651,
376,
7328,
1115,
426,
13,
462,
18884,
376,
7328,
29918,
1853,
1115,
376,
845,
17347,
613,
13,
462,
18884,
376,
12690,
1115,
4272,
29892,
13,
462,
18884,
376,
14518,
1115,
376,
3521,
613,
13,
462,
18884,
376,
13509,
29918,
333,
1115,
376,
7390,
613,
13,
462,
18884,
376,
5269,
1115,
9872,
26862,
6227,
28341,
13,
462,
18884,
376,
10041,
29918,
333,
1115,
29871,
29906,
29900,
29941,
29892,
13,
462,
18884,
376,
4102,
978,
1115,
1024,
29892,
13,
462,
18884,
376,
4230,
978,
1115,
1833,
978,
29892,
13,
462,
18884,
376,
3560,
29918,
333,
1115,
1797,
29918,
333,
29892,
13,
462,
18884,
376,
2490,
401,
1115,
1400,
401,
29892,
13,
462,
18884,
376,
29352,
1115,
518,
13,
462,
462,
1678,
11952,
29892,
13,
462,
462,
1678,
5124,
13,
462,
18884,
21251,
13,
462,
18884,
376,
15494,
6710,
1115,
6213,
13,
462,
9651,
2981,
13,
462,
9651,
376,
5696,
1115,
376,
1579,
8141,
403,
29918,
1579,
8141,
403,
613,
13,
462,
9651,
376,
7827,
1115,
426,
13,
462,
18884,
376,
3188,
29918,
845,
17347,
29918,
14506,
1115,
528,
17347,
29918,
14506,
29892,
13,
462,
18884,
376,
3188,
29918,
845,
17347,
29918,
2218,
2798,
29918,
14506,
1115,
29871,
29900,
29892,
13,
462,
18884,
376,
3188,
29918,
845,
17347,
29918,
262,
695,
29918,
20725,
1115,
528,
17347,
29918,
14506,
29892,
13,
462,
18884,
376,
3188,
29918,
845,
17347,
29918,
20725,
29918,
14506,
1115,
29871,
29900,
29892,
13,
462,
18884,
376,
845,
17347,
29918,
14506,
1115,
528,
17347,
29918,
14506,
29892,
13,
462,
18884,
376,
845,
17347,
29918,
2218,
2798,
29918,
14506,
1115,
29871,
29900,
29892,
13,
462,
18884,
376,
845,
17347,
29918,
2218,
2798,
29918,
20725,
29918,
2388,
575,
362,
29918,
14506,
1115,
29871,
29900,
29892,
13,
462,
18884,
376,
845,
17347,
29918,
262,
695,
29918,
20725,
1115,
528,
17347,
29918,
14506,
29892,
13,
462,
18884,
376,
845,
17347,
29918,
20725,
29918,
14506,
1115,
29871,
29900,
13,
462,
9651,
500,
13,
462,
4706,
2981,
13,
462,
4706,
376,
7076,
1115,
4452,
29918,
2378,
13,
462,
1678,
500,
13,
18884,
4514,
13,
9651,
500,
13,
4706,
500,
13,
4706,
736,
1121,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1797,
29918,
667,
29918,
3126,
29898,
13,
9651,
1797,
29918,
333,
29892,
13,
9651,
9659,
362,
29918,
1256,
29892,
13,
9651,
2944,
29918,
978,
29892,
13,
9651,
2071,
29884,
29892,
13,
9651,
8666,
29918,
5441,
29918,
2541,
29918,
20725,
29892,
13,
9651,
14728,
29892,
13,
9651,
1948,
29918,
7827,
29918,
2541,
29918,
20725,
29892,
13,
9651,
2313,
792,
29918,
14506,
29892,
13,
268,
1125,
13,
4706,
1121,
353,
426,
13,
9651,
376,
14506,
29918,
999,
870,
287,
1115,
29871,
29900,
29892,
13,
9651,
376,
932,
2957,
29918,
7491,
29918,
4841,
1115,
376,
29896,
29892,
29945,
613,
13,
9651,
376,
3188,
29918,
14506,
29918,
999,
870,
287,
1115,
29871,
29900,
29892,
13,
9651,
376,
3188,
29918,
2218,
2798,
29918,
14506,
1115,
2313,
792,
29918,
14506,
29892,
13,
9651,
376,
3188,
29918,
2218,
2798,
29918,
262,
1365,
7612,
1115,
29871,
29900,
29892,
13,
9651,
376,
3188,
29918,
2218,
2798,
29918,
20725,
29918,
2388,
575,
362,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
3188,
29918,
13492,
29918,
9175,
1115,
29871,
29906,
29906,
29892,
13,
9651,
376,
3188,
29918,
9175,
1115,
29871,
29906,
29906,
29892,
13,
9651,
376,
3188,
29918,
9175,
29918,
262,
695,
29918,
20725,
1115,
8666,
29918,
5441,
29918,
2541,
29918,
20725,
29892,
13,
9651,
376,
3188,
29918,
798,
29918,
262,
1365,
7612,
1115,
29871,
29900,
29892,
13,
9651,
376,
3188,
29918,
798,
29918,
7827,
1115,
29871,
29906,
29906,
29892,
13,
9651,
376,
3188,
29918,
798,
29918,
7827,
29918,
262,
695,
29918,
20725,
1115,
1948,
29918,
7827,
29918,
2541,
29918,
20725,
29892,
13,
9651,
376,
3188,
29918,
20725,
29918,
14506,
1115,
29871,
29946,
29889,
29941,
29892,
13,
9651,
376,
3188,
29918,
20725,
29918,
262,
1365,
7612,
1115,
29871,
29900,
29892,
13,
9651,
376,
11600,
29918,
271,
1115,
9659,
362,
29918,
1256,
29892,
13,
9651,
376,
2218,
2798,
29918,
14506,
1115,
2313,
792,
29918,
14506,
29892,
13,
9651,
376,
2218,
2798,
29918,
262,
1365,
7612,
1115,
29871,
29900,
29892,
13,
9651,
376,
2218,
2798,
29918,
25376,
1115,
29871,
29896,
29945,
29892,
13,
9651,
376,
9021,
29918,
845,
17347,
1115,
29871,
29900,
29892,
13,
9651,
376,
2218,
2798,
29918,
20725,
29918,
2388,
575,
362,
29918,
14506,
1115,
29871,
29900,
29892,
13,
9651,
376,
275,
29918,
29939,
1017,
29918,
7099,
3039,
1115,
29871,
29900,
29892,
13,
9651,
376,
275,
29918,
18714,
1115,
29871,
29900,
29892,
13,
9651,
376,
667,
29918,
333,
1115,
29871,
29906,
29906,
29946,
29892,
13,
9651,
376,
978,
1115,
2944,
29918,
978,
29892,
13,
9651,
376,
1217,
29918,
2218,
2798,
1115,
29871,
29900,
29892,
13,
9651,
376,
2098,
29918,
333,
1115,
1797,
29918,
333,
29892,
13,
9651,
376,
13492,
29918,
9175,
1115,
29871,
29906,
29906,
29892,
13,
9651,
376,
9175,
1115,
29871,
29906,
29906,
29892,
13,
9651,
376,
9175,
29918,
262,
695,
29918,
20725,
1115,
8666,
29918,
5441,
29918,
2541,
29918,
20725,
29892,
13,
9651,
376,
4704,
29918,
333,
1115,
29871,
29896,
29945,
29946,
29953,
29892,
13,
9651,
376,
4704,
29918,
1853,
1115,
376,
12857,
613,
13,
9651,
376,
29939,
1017,
29918,
29883,
749,
839,
1115,
29871,
29900,
29892,
13,
9651,
376,
29939,
1017,
29918,
262,
1365,
7612,
1115,
29871,
29900,
29892,
13,
9651,
376,
29939,
1017,
29918,
21693,
1115,
29871,
29896,
29892,
13,
9651,
376,
29939,
1017,
29918,
999,
870,
287,
1115,
29871,
29900,
29892,
13,
9651,
376,
29939,
1017,
29918,
845,
16242,
1115,
29871,
29900,
29892,
13,
9651,
376,
1396,
29918,
667,
29918,
333,
1115,
29871,
29953,
29955,
29945,
29892,
13,
9651,
376,
798,
29918,
262,
1365,
7612,
1115,
29871,
29900,
29892,
13,
9651,
376,
798,
29918,
7827,
1115,
29871,
29906,
29906,
29892,
13,
9651,
376,
798,
29918,
7827,
29918,
262,
695,
29918,
20725,
1115,
1948,
29918,
7827,
29918,
2541,
29918,
20725,
29892,
13,
9651,
376,
798,
29918,
7915,
1115,
29871,
29896,
29892,
13,
9651,
376,
18181,
1115,
851,
29898,
18181,
511,
13,
9651,
376,
8899,
29918,
333,
1115,
29871,
29896,
29892,
13,
9651,
376,
20725,
29918,
14506,
1115,
29871,
29946,
29889,
29941,
29892,
13,
9651,
376,
20725,
29918,
262,
1365,
7612,
1115,
29871,
29900,
29892,
13,
9651,
376,
20725,
29918,
25376,
1115,
29871,
29906,
29941,
29892,
13,
9651,
376,
21402,
29918,
271,
1115,
9659,
362,
29918,
1256,
29892,
13,
9651,
376,
7915,
1115,
29871,
29896,
13,
4706,
500,
13,
4706,
736,
1121,
13,
2
] |
roomtools/checks.py | entchen66/sinbad3.1 | 0 | 135269 | from typing import TYPE_CHECKING
from redbot.core import commands
if TYPE_CHECKING:
from . import RoomTools
def tmpc_active():
async def check(ctx: commands.Context):
if not ctx.guild:
return False
cog = ctx.bot.get_cog("RoomTools")
if TYPE_CHECKING:
assert isinstance(cog, RoomTools) # nosec
if not cog:
return False
return await cog.tmpc_config.guild(ctx.guild).active()
return commands.check(check)
def aa_active():
async def check(ctx: commands.Context):
if not ctx.guild:
return False
cog = ctx.bot.get_cog("RoomTools")
if TYPE_CHECKING:
assert isinstance(cog, RoomTools) # nosec
if not cog:
return False
return await cog.ar_config.guild(ctx.guild).active()
return commands.check(check)
| [
1,
515,
19229,
1053,
323,
6959,
29918,
3210,
16658,
4214,
13,
3166,
337,
2585,
327,
29889,
3221,
1053,
8260,
13,
13,
13,
361,
323,
6959,
29918,
3210,
16658,
4214,
29901,
13,
1678,
515,
869,
1053,
25114,
24183,
13,
13,
13,
1753,
13128,
29883,
29918,
4925,
7295,
13,
1678,
7465,
822,
1423,
29898,
13073,
29901,
8260,
29889,
2677,
1125,
13,
4706,
565,
451,
12893,
29889,
2543,
789,
29901,
13,
9651,
736,
7700,
13,
4706,
274,
468,
353,
12893,
29889,
7451,
29889,
657,
29918,
29883,
468,
703,
9588,
290,
24183,
1159,
13,
4706,
565,
323,
6959,
29918,
3210,
16658,
4214,
29901,
13,
9651,
4974,
338,
8758,
29898,
29883,
468,
29892,
25114,
24183,
29897,
29871,
396,
694,
3471,
13,
4706,
565,
451,
274,
468,
29901,
13,
9651,
736,
7700,
13,
4706,
736,
7272,
274,
468,
29889,
7050,
29883,
29918,
2917,
29889,
2543,
789,
29898,
13073,
29889,
2543,
789,
467,
4925,
580,
13,
13,
1678,
736,
8260,
29889,
3198,
29898,
3198,
29897,
13,
13,
13,
1753,
29099,
29918,
4925,
7295,
13,
1678,
7465,
822,
1423,
29898,
13073,
29901,
8260,
29889,
2677,
1125,
13,
4706,
565,
451,
12893,
29889,
2543,
789,
29901,
13,
9651,
736,
7700,
13,
4706,
274,
468,
353,
12893,
29889,
7451,
29889,
657,
29918,
29883,
468,
703,
9588,
290,
24183,
1159,
13,
4706,
565,
323,
6959,
29918,
3210,
16658,
4214,
29901,
13,
9651,
4974,
338,
8758,
29898,
29883,
468,
29892,
25114,
24183,
29897,
29871,
396,
694,
3471,
13,
4706,
565,
451,
274,
468,
29901,
13,
9651,
736,
7700,
13,
4706,
736,
7272,
274,
468,
29889,
279,
29918,
2917,
29889,
2543,
789,
29898,
13073,
29889,
2543,
789,
467,
4925,
580,
13,
13,
1678,
736,
8260,
29889,
3198,
29898,
3198,
29897,
13,
2
] |
recipes/LibriMix/prepare_data.py | anonymspeechbrain/speechbrain | 0 | 65899 | <reponame>anonymspeechbrain/speechbrain<gh_stars>0
"""
The functions to create the .csv files for LibriMix
Author
* Anonymous
"""
import os
import csv
def prepare_librimix(
datapath,
savepath,
n_spks=2,
skip_prep=False,
librimix_addnoise=False,
fs=8000,
):
"""
Prepare .csv files for librimix
Arguments:
----------
datapath (str) : path for the wsj0-mix dataset.
savepath (str) : path where we save the csv file.
n_spks (int): number of speakers
skip_prep (bool): If True, skip data preparation
librimix_addnoise: If True, add whamnoise to librimix datasets
"""
if skip_prep:
return
if "Libri" in datapath:
# Libri 2/3Mix datasets
if n_spks == 2:
assert (
"Libri2Mix" in datapath
), "Inconsistent number of speakers and datapath"
create_libri2mix_csv(datapath, savepath, addnoise=librimix_addnoise)
elif n_spks == 3:
assert (
"Libri3Mix" in datapath
), "Inconsistent number of speakers and datapath"
create_libri3mix_csv(datapath, savepath, addnoise=librimix_addnoise)
else:
raise ValueError("Unsupported Number of Speakers")
else:
raise ValueError("Unsupported Dataset")
def create_libri2mix_csv(
datapath,
savepath,
addnoise=False,
version="wav8k/min/",
set_types=["train-360", "dev", "test"],
):
"""
This functions creates the .csv file for the libri2mix dataset
"""
for set_type in set_types:
if addnoise:
mix_path = os.path.join(datapath, version, set_type, "mix_both/")
else:
mix_path = os.path.join(datapath, version, set_type, "mix_clean/")
s1_path = os.path.join(datapath, version, set_type, "s1/")
s2_path = os.path.join(datapath, version, set_type, "s2/")
noise_path = os.path.join(datapath, version, set_type, "noise/")
files = os.listdir(mix_path)
mix_fl_paths = [mix_path + fl for fl in files]
s1_fl_paths = [s1_path + fl for fl in files]
s2_fl_paths = [s2_path + fl for fl in files]
noise_fl_paths = [noise_path + fl for fl in files]
csv_columns = [
"ID",
"duration",
"mix_wav",
"mix_wav_format",
"mix_wav_opts",
"s1_wav",
"s1_wav_format",
"s1_wav_opts",
"s2_wav",
"s2_wav_format",
"s2_wav_opts",
"noise_wav",
"noise_wav_format",
"noise_wav_opts",
]
with open(savepath + "/libri2mix_" + set_type + ".csv", "w") as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=csv_columns)
writer.writeheader()
for i, (mix_path, s1_path, s2_path, noise_path) in enumerate(
zip(mix_fl_paths, s1_fl_paths, s2_fl_paths, noise_fl_paths)
):
row = {
"ID": i,
"duration": 1.0,
"mix_wav": mix_path,
"mix_wav_format": "wav",
"mix_wav_opts": None,
"s1_wav": s1_path,
"s1_wav_format": "wav",
"s1_wav_opts": None,
"s2_wav": s2_path,
"s2_wav_format": "wav",
"s2_wav_opts": None,
"noise_wav": noise_path,
"noise_wav_format": "wav",
"noise_wav_opts": None,
}
writer.writerow(row)
def create_libri3mix_csv(
datapath,
savepath,
addnoise=False,
version="wav8k/min/",
set_types=["train-360", "dev", "test"],
):
"""
This functions creates the .csv file for the libri3mix dataset
"""
for set_type in set_types:
if addnoise:
mix_path = os.path.join(datapath, version, set_type, "mix_both/")
else:
mix_path = os.path.join(datapath, version, set_type, "mix_clean/")
s1_path = os.path.join(datapath, version, set_type, "s1/")
s2_path = os.path.join(datapath, version, set_type, "s2/")
s3_path = os.path.join(datapath, version, set_type, "s3/")
noise_path = os.path.join(datapath, version, set_type, "noise/")
files = os.listdir(mix_path)
mix_fl_paths = [mix_path + fl for fl in files]
s1_fl_paths = [s1_path + fl for fl in files]
s2_fl_paths = [s2_path + fl for fl in files]
s3_fl_paths = [s3_path + fl for fl in files]
noise_fl_paths = [noise_path + fl for fl in files]
csv_columns = [
"ID",
"duration",
"mix_wav",
"mix_wav_format",
"mix_wav_opts",
"s1_wav",
"s1_wav_format",
"s1_wav_opts",
"s2_wav",
"s2_wav_format",
"s2_wav_opts",
"s3_wav",
"s3_wav_format",
"s3_wav_opts",
"noise_wav",
"noise_wav_format",
"noise_wav_opts",
]
with open(savepath + "/libri3mix_" + set_type + ".csv", "w") as csvfile:
writer = csv.DictWriter(csvfile, fieldnames=csv_columns)
writer.writeheader()
for (
i,
(mix_path, s1_path, s2_path, s3_path, noise_path),
) in enumerate(
zip(
mix_fl_paths,
s1_fl_paths,
s2_fl_paths,
s3_fl_paths,
noise_fl_paths,
)
):
row = {
"ID": i,
"duration": 1.0,
"mix_wav": mix_path,
"mix_wav_format": "wav",
"mix_wav_opts": None,
"s1_wav": s1_path,
"s1_wav_format": "wav",
"s1_wav_opts": None,
"s2_wav": s2_path,
"s2_wav_format": "wav",
"s2_wav_opts": None,
"s3_wav": s3_path,
"s3_wav_format": "wav",
"s3_wav_opts": None,
"noise_wav": noise_path,
"noise_wav_format": "wav",
"noise_wav_opts": None,
}
writer.writerow(row)
| [
1,
529,
276,
1112,
420,
29958,
273,
4735,
5965,
5309,
2634,
262,
29914,
5965,
5309,
2634,
262,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
1576,
3168,
304,
1653,
278,
869,
7638,
2066,
363,
8153,
374,
29924,
861,
13,
13,
13720,
13,
334,
530,
11428,
13,
15945,
29908,
13,
13,
5215,
2897,
13,
5215,
11799,
13,
13,
13,
1753,
19012,
29918,
492,
1182,
326,
861,
29898,
13,
1678,
1418,
481,
493,
29892,
13,
1678,
4078,
2084,
29892,
13,
1678,
302,
29918,
1028,
2039,
29922,
29906,
29892,
13,
1678,
14383,
29918,
15287,
29922,
8824,
29892,
13,
1678,
619,
1182,
326,
861,
29918,
1202,
1217,
895,
29922,
8824,
29892,
13,
1678,
18920,
29922,
29947,
29900,
29900,
29900,
29892,
13,
1125,
13,
1678,
9995,
13,
13,
1678,
349,
3445,
598,
869,
7638,
2066,
363,
619,
1182,
326,
861,
13,
13,
1678,
11842,
9331,
29901,
13,
1678,
448,
1378,
29899,
13,
4706,
1418,
481,
493,
313,
710,
29897,
584,
2224,
363,
278,
16904,
29926,
29900,
29899,
28084,
8783,
29889,
13,
4706,
4078,
2084,
313,
710,
29897,
584,
2224,
988,
591,
4078,
278,
11799,
934,
29889,
13,
4706,
302,
29918,
1028,
2039,
313,
524,
1125,
1353,
310,
7726,
414,
13,
4706,
14383,
29918,
15287,
313,
11227,
1125,
960,
5852,
29892,
14383,
848,
10223,
362,
13,
4706,
619,
1182,
326,
861,
29918,
1202,
1217,
895,
29901,
960,
5852,
29892,
788,
377,
314,
1217,
895,
304,
619,
1182,
326,
861,
20035,
13,
1678,
9995,
13,
13,
1678,
565,
14383,
29918,
15287,
29901,
13,
4706,
736,
13,
13,
1678,
565,
376,
14868,
374,
29908,
297,
1418,
481,
493,
29901,
13,
4706,
396,
8153,
374,
29871,
29906,
29914,
29941,
29924,
861,
20035,
13,
4706,
565,
302,
29918,
1028,
2039,
1275,
29871,
29906,
29901,
13,
9651,
4974,
313,
13,
18884,
376,
14868,
374,
29906,
29924,
861,
29908,
297,
1418,
481,
493,
13,
9651,
10353,
376,
797,
3200,
9696,
1353,
310,
7726,
414,
322,
1418,
481,
493,
29908,
13,
9651,
1653,
29918,
1982,
374,
29906,
28084,
29918,
7638,
29898,
4130,
481,
493,
29892,
4078,
2084,
29892,
788,
1217,
895,
29922,
492,
1182,
326,
861,
29918,
1202,
1217,
895,
29897,
13,
4706,
25342,
302,
29918,
1028,
2039,
1275,
29871,
29941,
29901,
13,
9651,
4974,
313,
13,
18884,
376,
14868,
374,
29941,
29924,
861,
29908,
297,
1418,
481,
493,
13,
9651,
10353,
376,
797,
3200,
9696,
1353,
310,
7726,
414,
322,
1418,
481,
493,
29908,
13,
9651,
1653,
29918,
1982,
374,
29941,
28084,
29918,
7638,
29898,
4130,
481,
493,
29892,
4078,
2084,
29892,
788,
1217,
895,
29922,
492,
1182,
326,
861,
29918,
1202,
1217,
895,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
703,
25807,
29884,
3016,
287,
9681,
310,
5013,
21079,
1159,
13,
1678,
1683,
29901,
13,
4706,
12020,
7865,
2392,
703,
25807,
29884,
3016,
287,
13373,
24541,
1159,
13,
13,
13,
1753,
1653,
29918,
1982,
374,
29906,
28084,
29918,
7638,
29898,
13,
1678,
1418,
481,
493,
29892,
13,
1678,
4078,
2084,
29892,
13,
1678,
788,
1217,
895,
29922,
8824,
29892,
13,
1678,
1873,
543,
29893,
485,
29947,
29895,
29914,
1195,
29914,
613,
13,
1678,
731,
29918,
8768,
29922,
3366,
14968,
29899,
29941,
29953,
29900,
613,
376,
3359,
613,
376,
1688,
12436,
13,
1125,
13,
1678,
9995,
13,
1678,
910,
3168,
10017,
278,
869,
7638,
934,
363,
278,
4303,
374,
29906,
28084,
8783,
13,
1678,
9995,
13,
13,
1678,
363,
731,
29918,
1853,
297,
731,
29918,
8768,
29901,
13,
4706,
565,
788,
1217,
895,
29901,
13,
9651,
6837,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
28084,
29918,
20313,
29914,
1159,
13,
4706,
1683,
29901,
13,
9651,
6837,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
28084,
29918,
14941,
29914,
1159,
13,
13,
4706,
269,
29896,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
29879,
29896,
29914,
1159,
13,
4706,
269,
29906,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
29879,
29906,
29914,
1159,
13,
4706,
11462,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
1217,
895,
29914,
1159,
13,
13,
4706,
2066,
353,
2897,
29889,
1761,
3972,
29898,
28084,
29918,
2084,
29897,
13,
13,
4706,
6837,
29918,
1579,
29918,
24772,
353,
518,
28084,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
4706,
269,
29896,
29918,
1579,
29918,
24772,
353,
518,
29879,
29896,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
4706,
269,
29906,
29918,
1579,
29918,
24772,
353,
518,
29879,
29906,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
4706,
11462,
29918,
1579,
29918,
24772,
353,
518,
1217,
895,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
13,
4706,
11799,
29918,
13099,
353,
518,
13,
9651,
376,
1367,
613,
13,
9651,
376,
19708,
613,
13,
9651,
376,
28084,
29918,
29893,
485,
613,
13,
9651,
376,
28084,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
28084,
29918,
29893,
485,
29918,
25707,
613,
13,
9651,
376,
29879,
29896,
29918,
29893,
485,
613,
13,
9651,
376,
29879,
29896,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
29879,
29896,
29918,
29893,
485,
29918,
25707,
613,
13,
9651,
376,
29879,
29906,
29918,
29893,
485,
613,
13,
9651,
376,
29879,
29906,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
29879,
29906,
29918,
29893,
485,
29918,
25707,
613,
13,
9651,
376,
1217,
895,
29918,
29893,
485,
613,
13,
9651,
376,
1217,
895,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
1217,
895,
29918,
29893,
485,
29918,
25707,
613,
13,
4706,
4514,
13,
13,
4706,
411,
1722,
29898,
7620,
2084,
718,
5591,
1982,
374,
29906,
28084,
27508,
718,
731,
29918,
1853,
718,
11393,
7638,
613,
376,
29893,
1159,
408,
11799,
1445,
29901,
13,
9651,
9227,
353,
11799,
29889,
21533,
10507,
29898,
7638,
1445,
29892,
1746,
7039,
29922,
7638,
29918,
13099,
29897,
13,
9651,
9227,
29889,
3539,
6672,
580,
13,
9651,
363,
474,
29892,
313,
28084,
29918,
2084,
29892,
269,
29896,
29918,
2084,
29892,
269,
29906,
29918,
2084,
29892,
11462,
29918,
2084,
29897,
297,
26985,
29898,
13,
18884,
14319,
29898,
28084,
29918,
1579,
29918,
24772,
29892,
269,
29896,
29918,
1579,
29918,
24772,
29892,
269,
29906,
29918,
1579,
29918,
24772,
29892,
11462,
29918,
1579,
29918,
24772,
29897,
13,
632,
1125,
13,
13,
18884,
1948,
353,
426,
13,
462,
1678,
376,
1367,
1115,
474,
29892,
13,
462,
1678,
376,
19708,
1115,
29871,
29896,
29889,
29900,
29892,
13,
462,
1678,
376,
28084,
29918,
29893,
485,
1115,
6837,
29918,
2084,
29892,
13,
462,
1678,
376,
28084,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
28084,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
462,
1678,
376,
29879,
29896,
29918,
29893,
485,
1115,
269,
29896,
29918,
2084,
29892,
13,
462,
1678,
376,
29879,
29896,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
29879,
29896,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
462,
1678,
376,
29879,
29906,
29918,
29893,
485,
1115,
269,
29906,
29918,
2084,
29892,
13,
462,
1678,
376,
29879,
29906,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
29879,
29906,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
462,
1678,
376,
1217,
895,
29918,
29893,
485,
1115,
11462,
29918,
2084,
29892,
13,
462,
1678,
376,
1217,
895,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
1217,
895,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
18884,
500,
13,
18884,
9227,
29889,
13236,
340,
29898,
798,
29897,
13,
13,
13,
1753,
1653,
29918,
1982,
374,
29941,
28084,
29918,
7638,
29898,
13,
1678,
1418,
481,
493,
29892,
13,
1678,
4078,
2084,
29892,
13,
1678,
788,
1217,
895,
29922,
8824,
29892,
13,
1678,
1873,
543,
29893,
485,
29947,
29895,
29914,
1195,
29914,
613,
13,
1678,
731,
29918,
8768,
29922,
3366,
14968,
29899,
29941,
29953,
29900,
613,
376,
3359,
613,
376,
1688,
12436,
13,
1125,
13,
1678,
9995,
13,
1678,
910,
3168,
10017,
278,
869,
7638,
934,
363,
278,
4303,
374,
29941,
28084,
8783,
13,
1678,
9995,
13,
13,
1678,
363,
731,
29918,
1853,
297,
731,
29918,
8768,
29901,
13,
4706,
565,
788,
1217,
895,
29901,
13,
9651,
6837,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
28084,
29918,
20313,
29914,
1159,
13,
4706,
1683,
29901,
13,
9651,
6837,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
28084,
29918,
14941,
29914,
1159,
13,
13,
4706,
269,
29896,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
29879,
29896,
29914,
1159,
13,
4706,
269,
29906,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
29879,
29906,
29914,
1159,
13,
4706,
269,
29941,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
29879,
29941,
29914,
1159,
13,
4706,
11462,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4130,
481,
493,
29892,
1873,
29892,
731,
29918,
1853,
29892,
376,
1217,
895,
29914,
1159,
13,
13,
4706,
2066,
353,
2897,
29889,
1761,
3972,
29898,
28084,
29918,
2084,
29897,
13,
13,
4706,
6837,
29918,
1579,
29918,
24772,
353,
518,
28084,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
4706,
269,
29896,
29918,
1579,
29918,
24772,
353,
518,
29879,
29896,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
4706,
269,
29906,
29918,
1579,
29918,
24772,
353,
518,
29879,
29906,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
4706,
269,
29941,
29918,
1579,
29918,
24772,
353,
518,
29879,
29941,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
4706,
11462,
29918,
1579,
29918,
24772,
353,
518,
1217,
895,
29918,
2084,
718,
1652,
363,
1652,
297,
2066,
29962,
13,
13,
4706,
11799,
29918,
13099,
353,
518,
13,
9651,
376,
1367,
613,
13,
9651,
376,
19708,
613,
13,
9651,
376,
28084,
29918,
29893,
485,
613,
13,
9651,
376,
28084,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
28084,
29918,
29893,
485,
29918,
25707,
613,
13,
9651,
376,
29879,
29896,
29918,
29893,
485,
613,
13,
9651,
376,
29879,
29896,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
29879,
29896,
29918,
29893,
485,
29918,
25707,
613,
13,
9651,
376,
29879,
29906,
29918,
29893,
485,
613,
13,
9651,
376,
29879,
29906,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
29879,
29906,
29918,
29893,
485,
29918,
25707,
613,
13,
9651,
376,
29879,
29941,
29918,
29893,
485,
613,
13,
9651,
376,
29879,
29941,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
29879,
29941,
29918,
29893,
485,
29918,
25707,
613,
13,
9651,
376,
1217,
895,
29918,
29893,
485,
613,
13,
9651,
376,
1217,
895,
29918,
29893,
485,
29918,
4830,
613,
13,
9651,
376,
1217,
895,
29918,
29893,
485,
29918,
25707,
613,
13,
4706,
4514,
13,
13,
4706,
411,
1722,
29898,
7620,
2084,
718,
5591,
1982,
374,
29941,
28084,
27508,
718,
731,
29918,
1853,
718,
11393,
7638,
613,
376,
29893,
1159,
408,
11799,
1445,
29901,
13,
9651,
9227,
353,
11799,
29889,
21533,
10507,
29898,
7638,
1445,
29892,
1746,
7039,
29922,
7638,
29918,
13099,
29897,
13,
9651,
9227,
29889,
3539,
6672,
580,
13,
9651,
363,
313,
13,
18884,
474,
29892,
13,
18884,
313,
28084,
29918,
2084,
29892,
269,
29896,
29918,
2084,
29892,
269,
29906,
29918,
2084,
29892,
269,
29941,
29918,
2084,
29892,
11462,
29918,
2084,
511,
13,
9651,
1723,
297,
26985,
29898,
13,
18884,
14319,
29898,
13,
462,
1678,
6837,
29918,
1579,
29918,
24772,
29892,
13,
462,
1678,
269,
29896,
29918,
1579,
29918,
24772,
29892,
13,
462,
1678,
269,
29906,
29918,
1579,
29918,
24772,
29892,
13,
462,
1678,
269,
29941,
29918,
1579,
29918,
24772,
29892,
13,
462,
1678,
11462,
29918,
1579,
29918,
24772,
29892,
13,
18884,
1723,
13,
632,
1125,
13,
18884,
1948,
353,
426,
13,
462,
1678,
376,
1367,
1115,
474,
29892,
13,
462,
1678,
376,
19708,
1115,
29871,
29896,
29889,
29900,
29892,
13,
462,
1678,
376,
28084,
29918,
29893,
485,
1115,
6837,
29918,
2084,
29892,
13,
462,
1678,
376,
28084,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
28084,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
462,
1678,
376,
29879,
29896,
29918,
29893,
485,
1115,
269,
29896,
29918,
2084,
29892,
13,
462,
1678,
376,
29879,
29896,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
29879,
29896,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
462,
1678,
376,
29879,
29906,
29918,
29893,
485,
1115,
269,
29906,
29918,
2084,
29892,
13,
462,
1678,
376,
29879,
29906,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
29879,
29906,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
462,
1678,
376,
29879,
29941,
29918,
29893,
485,
1115,
269,
29941,
29918,
2084,
29892,
13,
462,
1678,
376,
29879,
29941,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
29879,
29941,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
462,
1678,
376,
1217,
895,
29918,
29893,
485,
1115,
11462,
29918,
2084,
29892,
13,
462,
1678,
376,
1217,
895,
29918,
29893,
485,
29918,
4830,
1115,
376,
29893,
485,
613,
13,
462,
1678,
376,
1217,
895,
29918,
29893,
485,
29918,
25707,
1115,
6213,
29892,
13,
18884,
500,
13,
18884,
9227,
29889,
13236,
340,
29898,
798,
29897,
13,
2
] |
bert/training/trainer.py | 292916808/MolCloze | 0 | 59441 | <gh_stars>0
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# author: chinshin
# datetime: 2020/4/20 15:41
import sys
import tqdm
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from .optim_schedule import Scheduleoptim
from bert.model import MolBertLM, MolBertDis, LinearActivation
from bert.model.decoder import InnerProductDecoder, BilinearDecoder, NNBilinearDecoder
def sampling(input_ids, generator_logits, masked_lm_labels):
generator_id = torch.argmax(generator_logits, dim=-1).detach()
origin_input = input_ids.clone()
fake_input = torch.where(masked_lm_labels < 1, origin_input, generator_id)
corrupt_label = (masked_lm_labels != 0)
origin_input[corrupt_label] = masked_lm_labels[corrupt_label]
discriminator_label = torch.eq(origin_input, fake_input)
return generator_id, discriminator_label
def get_energy_loss(device, logits, targets, weights, vocab_size, batch_size, seq_len=140):
# targets = torch.unsqueeze(targets, dim=1)
# print(torch.zeros(batch_size, seq_len, vocab_size).size(), targets.unsqueeze(-1).size())
oh_labels = torch.zeros(batch_size, seq_len, vocab_size).to(device).scatter_(2, targets.unsqueeze(-1), 1)
# ones = torch.sparse.torch.eye(vocab_size).to(device)
# oh_labels = ones.index_select(0, targets)
log_probs = F.log_softmax(logits, dim=-1)
# print(log_probs.size(), oh_labels.size())
label_log_probs = -torch.sum(log_probs * oh_labels, dim=-1)
# print(weights.is_cuda, label_log_probs.is_cuda)
numerator = torch.sum(weights * label_log_probs)
denominator = torch.sum(weights) + 1e-6
loss = numerator/denominator
return loss
def get_token_energy_logits(device, LinearAct, inputs, table, weights, targets, vocab_size, batch_size):
energy_hidden = LinearAct(inputs)
# print(energy_hidden.size(), table.size())
logits = torch.matmul(energy_hidden, table.transpose(-2,-1))
energy_loss = get_energy_loss(device, logits, targets, weights, vocab_size, batch_size)
return logits, energy_loss
def get_cloze_outputs(device, candidate_mask, LinearAct, inputs, table, targets, vocab_size, batch_size):
weights = candidate_mask.type(torch.FloatTensor).to(device)
logits, energy_loss = get_token_energy_logits(device, LinearAct, inputs, table, weights, targets, vocab_size, batch_size)
return logits, energy_loss, weights
def get_discriminator_energy_loss(device, hidden, dis_output, criterion, input_ids, cloze_logits, weights, vocab_size, \
batch_size, discriminator_label, candidate_mask, mask_prob=0.15, seq_len=140):
# print(input_ids.size())
oh_labels = torch.zeros(batch_size, seq_len, vocab_size).to(device).scatter_(2, input_ids.unsqueeze(-1), 1)
# print(cloze_logits.size(), oh_labels.size())
log_q = torch.sum(F.log_softmax(cloze_logits, -1) * oh_labels.type(torch.FloatTensor).to(device), dim=-1).detach()
# print(logits.size(), log_q.size())
logits = torch.squeeze(hidden(dis_output), -1)
logits += log_q
logits += torch.log(mask_prob/(1-mask_prob)*torch.ones_like(logits))
unmask_labels = torch.mul(discriminator_label, candidate_mask).type(torch.FloatTensor).to(device)
losses = criterion(logits, unmask_labels) * weights
loss = torch.sum(losses)/(torch.sum(weights)+1e-6)
return loss
class MolBertTrainer(object):
def __init__(self, bert, vocab_size,
train_loader, test_loader, batch_size,
lr=1e-4, betas=(0.9, 0.999),
weight_decay=0.01, warmup_steps=10000,
with_cuda=True, cuda_devices=None,
with_span=False, with_mask=False, with_proximity=False,
log_freq=10, logger=None):
super(MolBertTrainer, self).__init__()
cuda_condition = torch.cuda.is_available() and with_cuda
self.device = torch.device("cuda:0" if cuda_condition else "cpu")
self.vocab_size = vocab_size
self.bert = bert
self.model = MolBertLM(bert, vocab_size).to(self.device)
self.discriminator = MolBertDis(bert).to(self.device)
self.get_energy_logits = LinearActivation(self.bert.hidden, self.bert.hidden).to(self.device)
self.dis_energy_preds = LinearActivation(self.bert.hidden, 1).to(self.device)
if with_cuda and torch.cuda.device_count() > 1:
logger.info('Using {} GPUs for Bert'.format(torch.cuda.device_count()))
self.model = nn.DataParallel(self.model, device_ids=cuda_devices)
self.discriminator = nn.DataParallel(self.discriminator, device_ids=cuda_devices)
self.train_loader = train_loader
self.test_loader = test_loader
self.optim = torch.optim.Adam(self.model.parameters(), lr=lr, betas=betas, weight_decay=weight_decay)
self.optim_schedule = Scheduleoptim(self.optim, self.bert.hidden, n_warmup_steps=warmup_steps, grad_clip=5.)
self.criterion = nn.NLLLoss(ignore_index=0)
self.dis_det_criterion = nn.BCEWithLogitsLoss()
self.dis_ene_criterion = nn.BCEWithLogitsLoss()
self.with_span = with_span
self.with_mask = with_mask
self.with_proximity = with_proximity
if with_proximity:
# self.decoder = BilinearDecoder(input_dim=bert.hidden)
self.decoder = InnerProductDecoder(input_dim=bert.hidden)
self.dec_criterion = nn.MSELoss()
self.log_freq = log_freq
self.logger = logger
self.batch_size = batch_size
logger.info('Total parameters: {}'.format(
sum([p.nelement() for p in self.model.parameters()])+sum([p.nelement() for p in self.discriminator.parameters()])
))
# def _tie_embeddings(self):
def train(self, epoch):
self.iteration(epoch, self.train_loader)
def test(self, epoch):
self.iteration(epoch, self.test_loader, train=False)
def iteration(self, epoch, loader, train=True):
logger = self.logger
str_code = 'train' if train else 'test'
data_iter = tqdm.tqdm(
enumerate(loader),
desc='{} : epoch {}'.format(str_code, epoch),
total=len(loader),
bar_format='{l_bar}{r_bar}'
)
avg_loss = 0.0
avg_dec_loss = 0.0
for i, data in data_iter:
# 0. batch_data will be sent into the device
data = {key: value.to(self.device) for key, value in data.items()}
bert_table = [i for i in range(self.vocab_size)]
bert_table = torch.LongTensor(bert_table).to(self.device)
bert_table = self.bert.embedding.token(bert_table)
# 1. forward masked_lm_model
# # for span masking
# mask_lm_output, bert_outputs = self.model.forward(data['bert_input'], data['segment_label'])
if self.with_span:
mask_lm_output, _, bert_output = self.model.forward(data['bert_input'], data['segment_label'],
data['masked_adj'])
elif self.with_mask:
mask_lm_output, _, bert_output = self.model.forward(data['bert_input'], data['segment_label'],
data['masked_adj'])
elif self.with_proximity:
mask_lm_output, _, bert_output = self.model.forward(data['bert_input'], data['segment_label'],
data['masked_adj'])
rec_adj = self.decoder(bert_outputs[-1])
ori_adj = data['bert_adj'].view(-1)
dec_loss = self.dec_criterion(rec_adj, ori_adj)
else:
mask_lm_output, _, bert_output = self.model.forward(data['bert_input'], data['segment_label'])
# print(data['bert_input'].size()[0])
# 2-1. NLL(negative log likelihood) loss
# mask_lm_output = (mask_lm_output < 1e-6) * torch.ones_like(mask_lm_output) * 1e-6 + (mask_lm_output >= 1e-6) * mask_lm_output
mask_loss = self.criterion(mask_lm_output.transpose(1, 2), data['bert_label'])
# print(data['bert_table'][0])
# print(self.bert.embedding.token(data['bert_table'][0]).size())
cloze_logits, gen_ene_loss, weights = get_cloze_outputs(self.device, data['bert_mask'], self.get_energy_logits, bert_output, \
bert_table, data['bert_input'], self.vocab_size, data['bert_input'].size()[0])
discriminator_input, discriminator_label = sampling(data['bert_input'], bert_output, data['bert_label'])
if self.with_mask:
dis_preds, dis_output = self.discriminator.forward(discriminator_input, data['segment_label'], data['masked_adj'])
else:
dis_preds, dis_output = self.discriminator.forward(discriminator_input, data['segment_label'])
# print(dis_output.size())
# print(data['bert_label'].size(), mask_lm_output.size(), dis_output.size())
dis_det_loss = self.dis_det_criterion(dis_preds.view(-1), discriminator_label.view(-1).float())
dis_ene_loss = get_discriminator_energy_loss(self.device, self.dis_energy_preds, dis_output, self.dis_ene_criterion, discriminator_input, cloze_logits, weights, \
self.vocab_size, self.batch_size, discriminator_label, data['bert_mask'])
# print(gen_ene_loss, dis_ene_loss)
loss = mask_loss + 20 * dis_det_loss + (gen_ene_loss + dis_ene_loss)
if np.isnan(loss.item()):
print(data['bert_input'])
print(mask_lm_output)
sys.exit(-1)
if self.with_proximity:
loss += dec_loss
avg_dec_loss += dec_loss
# 3. backward and optimization only in train
if train:
self.optim_schedule.zero_grad()
loss.backward()
self.optim_schedule.step_and_update_lr()
avg_loss += loss.item()
post_fix = {
'epoch': epoch,
'iter': i,
'avg_loss': avg_loss / (i + 1),
'loss': loss.item(),
'mask_loss': mask_loss.item(),
'gen_ene_loss': gen_ene_loss.item(),
'dis_det_loss': dis_det_loss.item(),
'dis_ene_loss': dis_ene_loss.item()
}
if self.with_proximity:
post_fix.update(
{'avg_dec_loss': avg_dec_loss.item() / (i + 1)}
)
if i % self.log_freq == 0:
data_iter.write(str(post_fix))
logger.info('{} : epoch {}, avg_loss = {:.4f}'.format(
str_code, epoch, avg_loss / len(data_iter)
))
def save(self, epoch, file_path='output/bert_trained.model'):
logger = self.logger
output_filepath = file_path + '.ep{}'.format(epoch)
torch.save(self.bert.cpu(), output_filepath)
self.bert.to(self.device)
logger.info('Epoch {:>3d} Model save on: {}'.format(
epoch, output_filepath
))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
1738,
29914,
4855,
29914,
2109,
29914,
6272,
3017,
30004,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
29937,
4148,
29901,
521,
262,
845,
262,
30004,
13,
29937,
12865,
29901,
29871,
29906,
29900,
29906,
29900,
29914,
29946,
29914,
29906,
29900,
29871,
29896,
29945,
29901,
29946,
29896,
30004,
13,
5215,
10876,
30004,
13,
5215,
260,
29939,
18933,
30004,
13,
5215,
4842,
305,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
30004,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
30004,
13,
30004,
13,
3166,
869,
20640,
29918,
816,
11272,
1053,
1102,
11272,
20640,
30004,
13,
3166,
289,
814,
29889,
4299,
1053,
10750,
29933,
814,
26369,
29892,
10750,
29933,
814,
4205,
29892,
22985,
21786,
362,
30004,
13,
3166,
289,
814,
29889,
4299,
29889,
7099,
6119,
1053,
25665,
7566,
6185,
6119,
29892,
20347,
457,
279,
6185,
6119,
29892,
405,
23189,
309,
457,
279,
6185,
6119,
30004,
13,
30004,
13,
1753,
23460,
29898,
2080,
29918,
4841,
29892,
15299,
29918,
1188,
1169,
29892,
11105,
287,
29918,
21457,
29918,
21134,
1125,
30004,
13,
1678,
15299,
29918,
333,
353,
4842,
305,
29889,
1191,
3317,
29898,
27959,
29918,
1188,
1169,
29892,
3964,
10457,
29896,
467,
4801,
496,
26471,
13,
1678,
3978,
29918,
2080,
353,
1881,
29918,
4841,
29889,
16513,
26471,
13,
1678,
25713,
29918,
2080,
353,
4842,
305,
29889,
3062,
29898,
13168,
287,
29918,
21457,
29918,
21134,
529,
29871,
29896,
29892,
3978,
29918,
2080,
29892,
15299,
29918,
333,
8443,
13,
1678,
1034,
6685,
29918,
1643,
353,
313,
13168,
287,
29918,
21457,
29918,
21134,
2804,
29871,
29900,
8443,
13,
1678,
3978,
29918,
2080,
29961,
2616,
6685,
29918,
1643,
29962,
353,
11105,
287,
29918,
21457,
29918,
21134,
29961,
2616,
6685,
29918,
1643,
29962,
30004,
13,
1678,
2313,
20386,
1061,
29918,
1643,
353,
4842,
305,
29889,
1837,
29898,
12574,
29918,
2080,
29892,
25713,
29918,
2080,
8443,
13,
1678,
736,
15299,
29918,
333,
29892,
2313,
20386,
1061,
29918,
1643,
30004,
13,
30004,
13,
1753,
679,
29918,
27548,
29918,
6758,
29898,
10141,
29892,
1480,
1169,
29892,
22525,
29892,
18177,
29892,
7931,
370,
29918,
2311,
29892,
9853,
29918,
2311,
29892,
19359,
29918,
2435,
29922,
29896,
29946,
29900,
1125,
30004,
13,
1678,
396,
22525,
353,
4842,
305,
29889,
6948,
802,
29872,
911,
29898,
5182,
29879,
29892,
3964,
29922,
29896,
8443,
13,
1678,
396,
1596,
29898,
7345,
305,
29889,
3298,
359,
29898,
16175,
29918,
2311,
29892,
19359,
29918,
2435,
29892,
7931,
370,
29918,
2311,
467,
2311,
3285,
22525,
29889,
6948,
802,
29872,
911,
6278,
29896,
467,
2311,
3101,
30004,
13,
1678,
9360,
29918,
21134,
353,
4842,
305,
29889,
3298,
359,
29898,
16175,
29918,
2311,
29892,
19359,
29918,
2435,
29892,
7931,
370,
29918,
2311,
467,
517,
29898,
10141,
467,
1557,
2620,
23538,
29906,
29892,
22525,
29889,
6948,
802,
29872,
911,
6278,
29896,
511,
29871,
29896,
8443,
13,
1678,
396,
6743,
353,
4842,
305,
29889,
29879,
5510,
29889,
7345,
305,
29889,
1032,
29872,
29898,
29894,
542,
370,
29918,
2311,
467,
517,
29898,
10141,
8443,
13,
1678,
396,
9360,
29918,
21134,
353,
6743,
29889,
2248,
29918,
2622,
29898,
29900,
29892,
22525,
8443,
13,
1678,
1480,
29918,
771,
5824,
353,
383,
29889,
1188,
29918,
2695,
3317,
29898,
1188,
1169,
29892,
3964,
10457,
29896,
8443,
13,
1678,
396,
1596,
29898,
1188,
29918,
771,
5824,
29889,
2311,
3285,
9360,
29918,
21134,
29889,
2311,
3101,
30004,
13,
1678,
3858,
29918,
1188,
29918,
771,
5824,
353,
448,
7345,
305,
29889,
2083,
29898,
1188,
29918,
771,
5824,
334,
9360,
29918,
21134,
29892,
3964,
10457,
29896,
8443,
13,
1678,
396,
1596,
29898,
705,
5861,
29889,
275,
29918,
29883,
6191,
29892,
3858,
29918,
1188,
29918,
771,
5824,
29889,
275,
29918,
29883,
6191,
8443,
13,
1678,
4825,
1061,
353,
4842,
305,
29889,
2083,
29898,
705,
5861,
334,
3858,
29918,
1188,
29918,
771,
5824,
8443,
13,
1678,
14267,
1061,
353,
4842,
305,
29889,
2083,
29898,
705,
5861,
29897,
718,
29871,
29896,
29872,
29899,
29953,
30004,
13,
1678,
6410,
353,
4825,
1061,
29914,
1145,
5817,
1061,
30004,
13,
1678,
736,
6410,
30004,
13,
30004,
13,
1753,
679,
29918,
6979,
29918,
27548,
29918,
1188,
1169,
29898,
10141,
29892,
22985,
2865,
29892,
10970,
29892,
1591,
29892,
18177,
29892,
22525,
29892,
7931,
370,
29918,
2311,
29892,
9853,
29918,
2311,
1125,
30004,
13,
1678,
5864,
29918,
10892,
353,
22985,
2865,
29898,
2080,
29879,
8443,
13,
1678,
396,
1596,
29898,
27548,
29918,
10892,
29889,
2311,
3285,
1591,
29889,
2311,
3101,
30004,
13,
1678,
1480,
1169,
353,
4842,
305,
29889,
2922,
16109,
29898,
27548,
29918,
10892,
29892,
1591,
29889,
3286,
4220,
6278,
29906,
6653,
29896,
876,
30004,
13,
1678,
5864,
29918,
6758,
353,
679,
29918,
27548,
29918,
6758,
29898,
10141,
29892,
1480,
1169,
29892,
22525,
29892,
18177,
29892,
7931,
370,
29918,
2311,
29892,
9853,
29918,
2311,
8443,
13,
1678,
736,
1480,
1169,
29892,
5864,
29918,
6758,
30004,
13,
30004,
13,
1753,
679,
29918,
15126,
911,
29918,
4905,
29879,
29898,
10141,
29892,
14020,
29918,
13168,
29892,
22985,
2865,
29892,
10970,
29892,
1591,
29892,
22525,
29892,
7931,
370,
29918,
2311,
29892,
9853,
29918,
2311,
1125,
30004,
13,
1678,
18177,
353,
14020,
29918,
13168,
29889,
1853,
29898,
7345,
305,
29889,
11031,
29911,
6073,
467,
517,
29898,
10141,
8443,
13,
1678,
1480,
1169,
29892,
5864,
29918,
6758,
353,
679,
29918,
6979,
29918,
27548,
29918,
1188,
1169,
29898,
10141,
29892,
22985,
2865,
29892,
10970,
29892,
1591,
29892,
18177,
29892,
22525,
29892,
7931,
370,
29918,
2311,
29892,
9853,
29918,
2311,
8443,
13,
1678,
736,
1480,
1169,
29892,
5864,
29918,
6758,
29892,
18177,
30004,
13,
30004,
13,
1753,
679,
29918,
2218,
29883,
20386,
1061,
29918,
27548,
29918,
6758,
29898,
10141,
29892,
7934,
29892,
766,
29918,
4905,
29892,
28770,
291,
29892,
1881,
29918,
4841,
29892,
17184,
911,
29918,
1188,
1169,
29892,
18177,
29892,
7931,
370,
29918,
2311,
29892,
320,
30004,
13,
462,
462,
1678,
9853,
29918,
2311,
29892,
2313,
20386,
1061,
29918,
1643,
29892,
14020,
29918,
13168,
29892,
11105,
29918,
22795,
29922,
29900,
29889,
29896,
29945,
29892,
19359,
29918,
2435,
29922,
29896,
29946,
29900,
1125,
30004,
13,
1678,
396,
1596,
29898,
2080,
29918,
4841,
29889,
2311,
3101,
30004,
13,
1678,
9360,
29918,
21134,
353,
4842,
305,
29889,
3298,
359,
29898,
16175,
29918,
2311,
29892,
19359,
29918,
2435,
29892,
7931,
370,
29918,
2311,
467,
517,
29898,
10141,
467,
1557,
2620,
23538,
29906,
29892,
1881,
29918,
4841,
29889,
6948,
802,
29872,
911,
6278,
29896,
511,
29871,
29896,
29897,
259,
6756,
13,
1678,
396,
1596,
29898,
15126,
911,
29918,
1188,
1169,
29889,
2311,
3285,
9360,
29918,
21134,
29889,
2311,
3101,
30004,
13,
1678,
1480,
29918,
29939,
353,
4842,
305,
29889,
2083,
29898,
29943,
29889,
1188,
29918,
2695,
3317,
29898,
15126,
911,
29918,
1188,
1169,
29892,
448,
29896,
29897,
334,
9360,
29918,
21134,
29889,
1853,
29898,
7345,
305,
29889,
11031,
29911,
6073,
467,
517,
29898,
10141,
511,
3964,
10457,
29896,
467,
4801,
496,
580,
6756,
13,
1678,
396,
1596,
29898,
1188,
1169,
29889,
2311,
3285,
1480,
29918,
29939,
29889,
2311,
3101,
30004,
13,
1678,
1480,
1169,
353,
4842,
305,
29889,
29879,
802,
29872,
911,
29898,
10892,
29898,
2218,
29918,
4905,
511,
448,
29896,
8443,
13,
1678,
1480,
1169,
4619,
1480,
29918,
29939,
6756,
13,
1678,
1480,
1169,
4619,
4842,
305,
29889,
1188,
29898,
13168,
29918,
22795,
14571,
29896,
29899,
13168,
29918,
22795,
11877,
7345,
305,
29889,
2873,
29918,
4561,
29898,
1188,
1169,
876,
30004,
13,
1678,
443,
13168,
29918,
21134,
353,
4842,
305,
29889,
16109,
29898,
2218,
29883,
20386,
1061,
29918,
1643,
29892,
14020,
29918,
13168,
467,
1853,
29898,
7345,
305,
29889,
11031,
29911,
6073,
467,
517,
29898,
10141,
8443,
13,
1678,
28495,
353,
28770,
291,
29898,
1188,
1169,
29892,
443,
13168,
29918,
21134,
29897,
334,
18177,
30004,
13,
1678,
6410,
353,
4842,
305,
29889,
2083,
29898,
6758,
267,
6802,
29898,
7345,
305,
29889,
2083,
29898,
705,
5861,
7240,
29896,
29872,
29899,
29953,
8443,
13,
1678,
736,
6410,
30004,
13,
30004,
13,
1990,
10750,
29933,
814,
5323,
4983,
29898,
3318,
1125,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
289,
814,
29892,
7931,
370,
29918,
2311,
29892,
6756,
13,
462,
7945,
29918,
12657,
29892,
1243,
29918,
12657,
29892,
9853,
29918,
2311,
11167,
13,
462,
301,
29878,
29922,
29896,
29872,
29899,
29946,
29892,
1010,
294,
7607,
29900,
29889,
29929,
29892,
29871,
29900,
29889,
29929,
29929,
29929,
511,
30004,
13,
462,
7688,
29918,
7099,
388,
29922,
29900,
29889,
29900,
29896,
29892,
14294,
786,
29918,
24530,
29922,
29896,
29900,
29900,
29900,
29900,
11167,
13,
462,
411,
29918,
29883,
6191,
29922,
5574,
29892,
274,
6191,
29918,
3359,
1575,
29922,
8516,
11167,
13,
462,
411,
29918,
9653,
29922,
8824,
29892,
411,
29918,
13168,
29922,
8824,
29892,
411,
29918,
771,
2657,
537,
29922,
8824,
11167,
13,
462,
1480,
29918,
29888,
7971,
29922,
29896,
29900,
29892,
17927,
29922,
8516,
1125,
30004,
13,
30004,
13,
4706,
2428,
29898,
29924,
324,
29933,
814,
5323,
4983,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
274,
6191,
29918,
16122,
353,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
322,
411,
29918,
29883,
6191,
30004,
13,
4706,
1583,
29889,
10141,
353,
4842,
305,
29889,
10141,
703,
29883,
6191,
29901,
29900,
29908,
565,
274,
6191,
29918,
16122,
1683,
376,
21970,
1159,
30004,
13,
30004,
13,
4706,
1583,
29889,
29894,
542,
370,
29918,
2311,
353,
7931,
370,
29918,
2311,
30004,
13,
4706,
1583,
29889,
2151,
353,
289,
814,
30004,
13,
4706,
1583,
29889,
4299,
353,
10750,
29933,
814,
26369,
29898,
2151,
29892,
7931,
370,
29918,
2311,
467,
517,
29898,
1311,
29889,
10141,
8443,
13,
4706,
1583,
29889,
2218,
29883,
20386,
1061,
353,
10750,
29933,
814,
4205,
29898,
2151,
467,
517,
29898,
1311,
29889,
10141,
8443,
13,
4706,
1583,
29889,
657,
29918,
27548,
29918,
1188,
1169,
353,
22985,
21786,
362,
29898,
1311,
29889,
2151,
29889,
10892,
29892,
1583,
29889,
2151,
29889,
10892,
467,
517,
29898,
1311,
29889,
10141,
8443,
13,
4706,
1583,
29889,
2218,
29918,
27548,
29918,
11965,
29879,
353,
22985,
21786,
362,
29898,
1311,
29889,
2151,
29889,
10892,
29892,
29871,
29896,
467,
517,
29898,
1311,
29889,
10141,
8443,
13,
30004,
13,
4706,
565,
411,
29918,
29883,
6191,
322,
4842,
305,
29889,
29883,
6191,
29889,
10141,
29918,
2798,
580,
1405,
29871,
29896,
29901,
30004,
13,
9651,
17927,
29889,
3888,
877,
15156,
6571,
22796,
29879,
363,
16662,
4286,
4830,
29898,
7345,
305,
29889,
29883,
6191,
29889,
10141,
29918,
2798,
22130,
30004,
13,
9651,
1583,
29889,
4299,
353,
302,
29876,
29889,
1469,
2177,
6553,
29898,
1311,
29889,
4299,
29892,
4742,
29918,
4841,
29922,
29883,
6191,
29918,
3359,
1575,
8443,
13,
9651,
1583,
29889,
2218,
29883,
20386,
1061,
353,
302,
29876,
29889,
1469,
2177,
6553,
29898,
1311,
29889,
2218,
29883,
20386,
1061,
29892,
4742,
29918,
4841,
29922,
29883,
6191,
29918,
3359,
1575,
8443,
13,
30004,
13,
4706,
1583,
29889,
14968,
29918,
12657,
353,
7945,
29918,
12657,
30004,
13,
4706,
1583,
29889,
1688,
29918,
12657,
353,
1243,
29918,
12657,
30004,
13,
30004,
13,
4706,
1583,
29889,
20640,
353,
4842,
305,
29889,
20640,
29889,
3253,
314,
29898,
1311,
29889,
4299,
29889,
16744,
3285,
301,
29878,
29922,
29212,
29892,
1010,
294,
29922,
6878,
294,
29892,
7688,
29918,
7099,
388,
29922,
7915,
29918,
7099,
388,
8443,
13,
4706,
1583,
29889,
20640,
29918,
816,
11272,
353,
1102,
11272,
20640,
29898,
1311,
29889,
20640,
29892,
1583,
29889,
2151,
29889,
10892,
29892,
302,
29918,
29893,
2817,
786,
29918,
24530,
29922,
29893,
2817,
786,
29918,
24530,
29892,
4656,
29918,
24049,
29922,
29945,
1846,
30004,
13,
30004,
13,
4706,
1583,
29889,
29883,
5385,
291,
353,
302,
29876,
29889,
29940,
2208,
29931,
2209,
29898,
17281,
29918,
2248,
29922,
29900,
8443,
13,
4706,
1583,
29889,
2218,
29918,
4801,
29918,
29883,
5385,
291,
353,
302,
29876,
29889,
29933,
4741,
3047,
3403,
1169,
29931,
2209,
26471,
13,
4706,
1583,
29889,
2218,
29918,
1600,
29918,
29883,
5385,
291,
353,
302,
29876,
29889,
29933,
4741,
3047,
3403,
1169,
29931,
2209,
26471,
13,
30004,
13,
4706,
1583,
29889,
2541,
29918,
9653,
353,
411,
29918,
9653,
30004,
13,
4706,
1583,
29889,
2541,
29918,
13168,
353,
411,
29918,
13168,
30004,
13,
4706,
1583,
29889,
2541,
29918,
771,
2657,
537,
353,
411,
29918,
771,
2657,
537,
30004,
13,
4706,
565,
411,
29918,
771,
2657,
537,
29901,
30004,
13,
9651,
396,
1583,
29889,
7099,
6119,
353,
20347,
457,
279,
6185,
6119,
29898,
2080,
29918,
6229,
29922,
2151,
29889,
10892,
8443,
13,
9651,
1583,
29889,
7099,
6119,
353,
25665,
7566,
6185,
6119,
29898,
2080,
29918,
6229,
29922,
2151,
29889,
10892,
8443,
13,
9651,
1583,
29889,
7099,
29918,
29883,
5385,
291,
353,
302,
29876,
29889,
29924,
1660,
29931,
2209,
26471,
13,
4706,
1583,
29889,
1188,
29918,
29888,
7971,
353,
1480,
29918,
29888,
7971,
30004,
13,
4706,
1583,
29889,
21707,
353,
17927,
30004,
13,
4706,
1583,
29889,
16175,
29918,
2311,
353,
9853,
29918,
2311,
30004,
13,
30004,
13,
4706,
17927,
29889,
3888,
877,
11536,
4128,
29901,
6571,
4286,
4830,
29898,
30004,
13,
9651,
2533,
4197,
29886,
29889,
484,
944,
580,
363,
282,
297,
1583,
29889,
4299,
29889,
16744,
580,
2314,
29974,
2083,
4197,
29886,
29889,
484,
944,
580,
363,
282,
297,
1583,
29889,
2218,
29883,
20386,
1061,
29889,
16744,
580,
2314,
30004,
13,
308,
876,
30004,
13,
30004,
13,
1678,
396,
822,
903,
29873,
347,
29918,
17987,
29881,
886,
29898,
1311,
1125,
30004,
13,
30004,
13,
1678,
822,
7945,
29898,
1311,
29892,
21502,
305,
1125,
30004,
13,
4706,
1583,
29889,
1524,
362,
29898,
1022,
2878,
29892,
1583,
29889,
14968,
29918,
12657,
8443,
13,
30004,
13,
1678,
822,
1243,
29898,
1311,
29892,
21502,
305,
1125,
30004,
13,
4706,
1583,
29889,
1524,
362,
29898,
1022,
2878,
29892,
1583,
29889,
1688,
29918,
12657,
29892,
7945,
29922,
8824,
8443,
13,
30004,
13,
1678,
822,
12541,
29898,
1311,
29892,
21502,
305,
29892,
23466,
29892,
7945,
29922,
5574,
1125,
30004,
13,
4706,
17927,
353,
1583,
29889,
21707,
30004,
13,
4706,
851,
29918,
401,
353,
525,
14968,
29915,
565,
7945,
1683,
525,
1688,
29915,
30004,
13,
4706,
848,
29918,
1524,
353,
260,
29939,
18933,
29889,
29873,
29939,
18933,
29898,
30004,
13,
9651,
26985,
29898,
12657,
511,
30004,
13,
9651,
5153,
2433,
8875,
584,
21502,
305,
6571,
4286,
4830,
29898,
710,
29918,
401,
29892,
21502,
305,
511,
30004,
13,
9651,
3001,
29922,
2435,
29898,
12657,
511,
30004,
13,
9651,
2594,
29918,
4830,
2433,
29912,
29880,
29918,
1646,
1157,
29878,
29918,
1646,
10162,
30004,
13,
4706,
1723,
30004,
13,
30004,
13,
4706,
1029,
29887,
29918,
6758,
353,
29871,
29900,
29889,
29900,
30004,
13,
4706,
1029,
29887,
29918,
7099,
29918,
6758,
353,
29871,
29900,
29889,
29900,
30004,
13,
30004,
13,
4706,
363,
474,
29892,
848,
297,
848,
29918,
1524,
29901,
30004,
13,
9651,
396,
29871,
29900,
29889,
9853,
29918,
1272,
674,
367,
2665,
964,
278,
4742,
30004,
13,
9651,
848,
353,
426,
1989,
29901,
995,
29889,
517,
29898,
1311,
29889,
10141,
29897,
363,
1820,
29892,
995,
297,
848,
29889,
7076,
580,
8117,
13,
9651,
289,
814,
29918,
2371,
353,
518,
29875,
363,
474,
297,
3464,
29898,
1311,
29889,
29894,
542,
370,
29918,
2311,
4638,
30004,
13,
9651,
289,
814,
29918,
2371,
353,
4842,
305,
29889,
8208,
29911,
6073,
29898,
2151,
29918,
2371,
467,
517,
29898,
1311,
29889,
10141,
8443,
13,
9651,
289,
814,
29918,
2371,
353,
1583,
29889,
2151,
29889,
17987,
8497,
29889,
6979,
29898,
2151,
29918,
2371,
8443,
13,
9651,
396,
29871,
29896,
29889,
6375,
11105,
287,
29918,
21457,
29918,
4299,
30004,
13,
9651,
396,
396,
363,
10638,
11105,
292,
30004,
13,
9651,
396,
11105,
29918,
21457,
29918,
4905,
29892,
289,
814,
29918,
4905,
29879,
353,
1583,
29889,
4299,
29889,
11333,
29898,
1272,
1839,
2151,
29918,
2080,
7464,
848,
1839,
28192,
29918,
1643,
2033,
8443,
13,
9651,
565,
1583,
29889,
2541,
29918,
9653,
29901,
30004,
13,
18884,
11105,
29918,
21457,
29918,
4905,
29892,
17117,
289,
814,
29918,
4905,
353,
1583,
29889,
4299,
29889,
11333,
29898,
1272,
1839,
2151,
29918,
2080,
7464,
848,
1839,
28192,
29918,
1643,
7464,
30004,
13,
462,
462,
462,
462,
29871,
848,
1839,
13168,
287,
29918,
26859,
2033,
8443,
13,
9651,
25342,
1583,
29889,
2541,
29918,
13168,
29901,
30004,
13,
18884,
11105,
29918,
21457,
29918,
4905,
29892,
17117,
289,
814,
29918,
4905,
353,
1583,
29889,
4299,
29889,
11333,
29898,
1272,
1839,
2151,
29918,
2080,
7464,
848,
1839,
28192,
29918,
1643,
7464,
30004,
13,
462,
462,
462,
462,
29871,
848,
1839,
13168,
287,
29918,
26859,
2033,
8443,
13,
9651,
25342,
1583,
29889,
2541,
29918,
771,
2657,
537,
29901,
30004,
13,
18884,
11105,
29918,
21457,
29918,
4905,
29892,
17117,
289,
814,
29918,
4905,
353,
1583,
29889,
4299,
29889,
11333,
29898,
1272,
1839,
2151,
29918,
2080,
7464,
848,
1839,
28192,
29918,
1643,
7464,
30004,
13,
462,
462,
462,
462,
29871,
848,
1839,
13168,
287,
29918,
26859,
2033,
8443,
13,
18884,
1162,
29918,
26859,
353,
1583,
29889,
7099,
6119,
29898,
2151,
29918,
4905,
29879,
14352,
29896,
2314,
30004,
13,
18884,
470,
29875,
29918,
26859,
353,
848,
1839,
2151,
29918,
26859,
13359,
1493,
6278,
29896,
8443,
13,
18884,
1602,
29918,
6758,
353,
1583,
29889,
7099,
29918,
29883,
5385,
291,
29898,
3757,
29918,
26859,
29892,
470,
29875,
29918,
26859,
8443,
13,
9651,
1683,
29901,
30004,
13,
18884,
11105,
29918,
21457,
29918,
4905,
29892,
17117,
289,
814,
29918,
4905,
353,
1583,
29889,
4299,
29889,
11333,
29898,
1272,
1839,
2151,
29918,
2080,
7464,
848,
1839,
28192,
29918,
1643,
2033,
8443,
13,
30004,
13,
9651,
396,
1596,
29898,
1272,
1839,
2151,
29918,
2080,
13359,
2311,
580,
29961,
29900,
2314,
30004,
13,
9651,
396,
29871,
29906,
29899,
29896,
29889,
405,
2208,
29898,
22198,
1480,
4188,
22342,
29897,
6410,
30004,
13,
9651,
396,
11105,
29918,
21457,
29918,
4905,
353,
313,
13168,
29918,
21457,
29918,
4905,
529,
29871,
29896,
29872,
29899,
29953,
29897,
334,
4842,
305,
29889,
2873,
29918,
4561,
29898,
13168,
29918,
21457,
29918,
4905,
29897,
334,
29871,
29896,
29872,
29899,
29953,
718,
313,
13168,
29918,
21457,
29918,
4905,
6736,
29871,
29896,
29872,
29899,
29953,
29897,
334,
11105,
29918,
21457,
29918,
4905,
30004,
13,
9651,
11105,
29918,
6758,
353,
1583,
29889,
29883,
5385,
291,
29898,
13168,
29918,
21457,
29918,
4905,
29889,
3286,
4220,
29898,
29896,
29892,
29871,
29906,
511,
848,
1839,
2151,
29918,
1643,
2033,
8443,
13,
9651,
396,
1596,
29898,
1272,
1839,
2151,
29918,
2371,
2033,
29961,
29900,
2314,
30004,
13,
9651,
396,
1596,
29898,
1311,
29889,
2151,
29889,
17987,
8497,
29889,
6979,
29898,
1272,
1839,
2151,
29918,
2371,
2033,
29961,
29900,
14664,
2311,
3101,
30004,
13,
9651,
17184,
911,
29918,
1188,
1169,
29892,
2531,
29918,
1600,
29918,
6758,
29892,
18177,
353,
679,
29918,
15126,
911,
29918,
4905,
29879,
29898,
1311,
29889,
10141,
29892,
848,
1839,
2151,
29918,
13168,
7464,
1583,
29889,
657,
29918,
27548,
29918,
1188,
1169,
29892,
289,
814,
29918,
4905,
29892,
320,
30004,
13,
462,
462,
462,
462,
4706,
289,
814,
29918,
2371,
29892,
848,
1839,
2151,
29918,
2080,
7464,
1583,
29889,
29894,
542,
370,
29918,
2311,
29892,
848,
1839,
2151,
29918,
2080,
13359,
2311,
580,
29961,
29900,
2314,
30004,
13,
9651,
2313,
20386,
1061,
29918,
2080,
29892,
2313,
20386,
1061,
29918,
1643,
353,
23460,
29898,
1272,
1839,
2151,
29918,
2080,
7464,
289,
814,
29918,
4905,
29892,
848,
1839,
2151,
29918,
1643,
2033,
8443,
13,
9651,
565,
1583,
29889,
2541,
29918,
13168,
29901,
30004,
13,
18884,
766,
29918,
11965,
29879,
29892,
766,
29918,
4905,
353,
1583,
29889,
2218,
29883,
20386,
1061,
29889,
11333,
29898,
2218,
29883,
20386,
1061,
29918,
2080,
29892,
848,
1839,
28192,
29918,
1643,
7464,
848,
1839,
13168,
287,
29918,
26859,
2033,
8443,
13,
9651,
1683,
29901,
30004,
13,
18884,
766,
29918,
11965,
29879,
29892,
766,
29918,
4905,
353,
1583,
29889,
2218,
29883,
20386,
1061,
29889,
11333,
29898,
2218,
29883,
20386,
1061,
29918,
2080,
29892,
848,
1839,
28192,
29918,
1643,
2033,
8443,
13,
4706,
6756,
13,
9651,
396,
1596,
29898,
2218,
29918,
4905,
29889,
2311,
3101,
30004,
13,
9651,
396,
1596,
29898,
1272,
1839,
2151,
29918,
1643,
13359,
2311,
3285,
11105,
29918,
21457,
29918,
4905,
29889,
2311,
3285,
766,
29918,
4905,
29889,
2311,
3101,
30004,
13,
9651,
766,
29918,
4801,
29918,
6758,
353,
1583,
29889,
2218,
29918,
4801,
29918,
29883,
5385,
291,
29898,
2218,
29918,
11965,
29879,
29889,
1493,
6278,
29896,
511,
2313,
20386,
1061,
29918,
1643,
29889,
1493,
6278,
29896,
467,
7411,
3101,
30004,
13,
9651,
766,
29918,
1600,
29918,
6758,
353,
679,
29918,
2218,
29883,
20386,
1061,
29918,
27548,
29918,
6758,
29898,
1311,
29889,
10141,
29892,
1583,
29889,
2218,
29918,
27548,
29918,
11965,
29879,
29892,
766,
29918,
4905,
29892,
1583,
29889,
2218,
29918,
1600,
29918,
29883,
5385,
291,
29892,
2313,
20386,
1061,
29918,
2080,
29892,
17184,
911,
29918,
1188,
1169,
29892,
18177,
29892,
320,
30004,
13,
462,
462,
462,
9651,
1583,
29889,
29894,
542,
370,
29918,
2311,
29892,
1583,
29889,
16175,
29918,
2311,
29892,
2313,
20386,
1061,
29918,
1643,
29892,
848,
1839,
2151,
29918,
13168,
2033,
8443,
13,
9651,
396,
1596,
29898,
1885,
29918,
1600,
29918,
6758,
29892,
766,
29918,
1600,
29918,
6758,
8443,
13,
9651,
6410,
353,
11105,
29918,
6758,
718,
29871,
29906,
29900,
334,
766,
29918,
4801,
29918,
6758,
718,
313,
1885,
29918,
1600,
29918,
6758,
718,
766,
29918,
1600,
29918,
6758,
8443,
13,
30004,
13,
9651,
565,
7442,
29889,
275,
13707,
29898,
6758,
29889,
667,
580,
1125,
30004,
13,
18884,
1596,
29898,
1272,
1839,
2151,
29918,
2080,
2033,
8443,
13,
18884,
1596,
29898,
13168,
29918,
21457,
29918,
4905,
8443,
13,
18884,
10876,
29889,
13322,
6278,
29896,
8443,
13,
30004,
13,
9651,
565,
1583,
29889,
2541,
29918,
771,
2657,
537,
29901,
30004,
13,
18884,
6410,
4619,
1602,
29918,
6758,
30004,
13,
18884,
1029,
29887,
29918,
7099,
29918,
6758,
4619,
1602,
29918,
6758,
30004,
13,
30004,
13,
9651,
396,
29871,
29941,
29889,
1250,
1328,
322,
13883,
871,
297,
7945,
30004,
13,
9651,
565,
7945,
29901,
30004,
13,
18884,
1583,
29889,
20640,
29918,
816,
11272,
29889,
9171,
29918,
5105,
26471,
13,
18884,
6410,
29889,
1627,
1328,
26471,
13,
18884,
1583,
29889,
20640,
29918,
816,
11272,
29889,
10568,
29918,
392,
29918,
5504,
29918,
29212,
26471,
13,
30004,
13,
9651,
1029,
29887,
29918,
6758,
4619,
6410,
29889,
667,
26471,
13,
30004,
13,
9651,
1400,
29918,
5878,
353,
3336,
13,
18884,
525,
1022,
2878,
2396,
21502,
305,
11167,
13,
18884,
525,
1524,
2396,
474,
11167,
13,
18884,
525,
485,
29887,
29918,
6758,
2396,
1029,
29887,
29918,
6758,
847,
313,
29875,
718,
29871,
29896,
511,
30004,
13,
18884,
525,
6758,
2396,
6410,
29889,
667,
3285,
30004,
13,
18884,
525,
13168,
29918,
6758,
2396,
11105,
29918,
6758,
29889,
667,
3285,
30004,
13,
18884,
525,
1885,
29918,
1600,
29918,
6758,
2396,
2531,
29918,
1600,
29918,
6758,
29889,
667,
3285,
30004,
13,
18884,
525,
2218,
29918,
4801,
29918,
6758,
2396,
766,
29918,
4801,
29918,
6758,
29889,
667,
3285,
30004,
13,
18884,
525,
2218,
29918,
1600,
29918,
6758,
2396,
766,
29918,
1600,
29918,
6758,
29889,
667,
26471,
13,
9651,
4970,
13,
9651,
565,
1583,
29889,
2541,
29918,
771,
2657,
537,
29901,
30004,
13,
18884,
1400,
29918,
5878,
29889,
5504,
29898,
30004,
13,
462,
1678,
11117,
485,
29887,
29918,
7099,
29918,
6758,
2396,
1029,
29887,
29918,
7099,
29918,
6758,
29889,
667,
580,
847,
313,
29875,
718,
29871,
29896,
2915,
30004,
13,
18884,
1723,
30004,
13,
30004,
13,
9651,
565,
474,
1273,
1583,
29889,
1188,
29918,
29888,
7971,
1275,
29871,
29900,
29901,
30004,
13,
18884,
848,
29918,
1524,
29889,
3539,
29898,
710,
29898,
2490,
29918,
5878,
876,
30004,
13,
30004,
13,
4706,
17927,
29889,
3888,
877,
8875,
584,
21502,
305,
24335,
1029,
29887,
29918,
6758,
353,
12365,
29889,
29946,
29888,
29913,
4286,
4830,
29898,
30004,
13,
9651,
851,
29918,
401,
29892,
21502,
305,
29892,
1029,
29887,
29918,
6758,
847,
7431,
29898,
1272,
29918,
1524,
8443,
13,
308,
876,
30004,
13,
30004,
13,
1678,
822,
4078,
29898,
1311,
29892,
21502,
305,
29892,
934,
29918,
2084,
2433,
4905,
29914,
2151,
29918,
3018,
1312,
29889,
4299,
29374,
30004,
13,
4706,
17927,
353,
1583,
29889,
21707,
30004,
13,
4706,
1962,
29918,
1445,
2084,
353,
934,
29918,
2084,
718,
15300,
1022,
8875,
4286,
4830,
29898,
1022,
2878,
8443,
13,
4706,
4842,
305,
29889,
7620,
29898,
1311,
29889,
2151,
29889,
21970,
3285,
1962,
29918,
1445,
2084,
8443,
13,
4706,
1583,
29889,
2151,
29889,
517,
29898,
1311,
29889,
10141,
8443,
13,
4706,
17927,
29889,
3888,
877,
29923,
1129,
305,
12365,
29958,
29941,
29881,
29913,
8125,
4078,
373,
29901,
6571,
4286,
4830,
29898,
30004,
13,
9651,
21502,
305,
29892,
1962,
29918,
1445,
2084,
30004,
13,
308,
876,
30004,
13,
2
] |
pymongoimport/restart.py | jdrumgoole/pymongodbimport | 1 | 109788 | """
Created on 30 Jul 2017
@author: jdrumgoole
"""
import socket
import sys
from datetime import datetime
from enum import Enum
import pymongo
from pymongoimport.canonical_path import Canonical_Path
class Restart_State(Enum):
undefined = 0
start = 1
inprogress = 2
finish = 3
class Restarter(object):
"""
Track insertion of a collection of docs by adding the last inserted
ID into a collection called "restartlog". Each time we insert we add
a doc with a timestamp and an ID field and a count of the number of
entries inserted to date. The doc also contains a batch
start time.
These class assumes the object ID is defined by default as per the MongoDB docs
(https://docs.mongodb.com/manual/reference/method/ObjectId/). In this case in a single run
of the pymongoimport the IDs will contain identical host and process components. We can use
these fields to identify inserts that happened in the previous run. So we search for all inserts
with an ID greater than the ID in the restartlog.
We then scan that list of inserts for a matching ID
(remember we may be running multiple batch uploads in parallel) to find the inserts related to this
batch restart. Once we have that list of matching inserts then we have the count of objects inserted.
Now we know where the restart position should be (restartlog number of entries + len( list of matching inserts)
We can now skip() to that position in the input file and update the restart log.
"""
def __init__(self, database, input_filename, batch_size, cmd=None):
"""
Constructor
"""
self._audit = database["AUDIT"]
self._name = Canonical_Path(input_filename)
self._batch_size = batch_size
self._hostname = socket.gethostname()
if cmd is None:
self._cmd = " ".join(sys.argv)
else:
self._cmd = cmd
self._restartDoc = self._audit.find_one({"name": self._name(),
"state": "inprogress"})
if self._restartDoc is None:
self.start()
@staticmethod
def split_ID(doc_id):
"""
Split a MongoDB Object ID
a 4-byte value representing the seconds since the Unix epoch,
a 3-byte machine identifier,
a 2-byte process id, and
A 3-byte counter, starting with a random value.
"""
id_str = str(doc_id)
# epoch 0 machine 1 process ID 2 counter 3
return (id_str[0:8], id_str[8:14], id_str[14:18], id_str[18:24])
def start(self):
self._audit.insert_one({"name": self._name(),
"ts": datetime.utcnow(),
"batch_size": self._batch_size,
"command": self._cmd,
"state": Restart_State.start})
def update(self, doc_id, count):
self._audit.insert_one({"name": self._name(),
"count": count,
"ts": datetime.utcnow(),
"doc_id": doc_id,
"state": Restart_State.inprogress})
def restart(self, collection):
"""
Get the restart doc. Now find any docs created after the restart doc was created
within the same process and machine. Count those so we know where we are.
Return the new doc count that we can skip too.
"""
self._restartDoc = self._audit.find_one({"name": self._name(),
"state": Restart_State.inprogress})
if self._restartDoc is None: # skip nothing, nothing to restart
return 0
count = self._restartDoc["count"]
(_, machine, pid, _) = Restarter.split_ID(self._restartDoc["doc_id"])
cursor = collection.find({"_id": {"$gt": self._restartDoc["doc_id"]}})
for i in cursor:
(_, i_machine, i_pid, _) = Restarter.split_ID(i["_id"])
if i_machine == machine and i_pid == pid:
count = count + 1
if count == self._restartDoc["batch_size"]:
# we have the full batch, we can't have inserted more than
# this before updating the restart doc
break
return count
def finish(self):
self._restartDoc = self._audit.insert_one({"name": self._name(),
"ts": datetime.utcnow(),
"state": Restart_State.finish})
def _find_last(self, col, doc):
if "ts" in doc:
cursor = col.find(doc).sort({"ts": pymongo.DESCENDING}).limit(1)
for c in cursor:
return c
return None
else:
raise ValueError("_find_last requires a timestamp field 'ts'")
def get_state(self, name):
doc = self._audit.find({"name": name,
"state": Restart_State.finish}).sort({"ts": pymongo.DESCENDING}).limit(1)
if doc:
return Restart_State.finish
doc = self._audit.find_one({"name": name,
"state": Restart_State.inprogress})
if doc:
return Restart_State.inprogress
doc = self._audit.find_one({"name": name,
"state": Restart_State.start})
def reset(self):
self._restartDoc = self._audit.find_one_and_update({"name": self._name()},
{"$set": {"timestamp": datetime.utcnow(),
"batch_size": self._batch_size,
"count": 0,
"last_doc_id": 0,
"state": "inprogress"}})
| [
1,
9995,
13,
20399,
373,
29871,
29941,
29900,
2739,
29871,
29906,
29900,
29896,
29955,
13,
13,
29992,
8921,
29901,
432,
29881,
5848,
1484,
1772,
13,
15945,
29908,
13,
5215,
9909,
13,
5215,
10876,
13,
3166,
12865,
1053,
12865,
13,
3166,
14115,
1053,
1174,
398,
13,
13,
5215,
282,
962,
7443,
13,
13,
3166,
282,
962,
7443,
5215,
29889,
3068,
265,
936,
29918,
2084,
1053,
1815,
265,
936,
29918,
2605,
13,
13,
13,
1990,
11654,
442,
29918,
2792,
29898,
16854,
1125,
13,
1678,
7580,
353,
29871,
29900,
13,
1678,
1369,
353,
29871,
29896,
13,
1678,
297,
18035,
353,
29871,
29906,
13,
1678,
8341,
353,
29871,
29941,
13,
13,
13,
1990,
11654,
4254,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
17026,
4635,
291,
310,
263,
4333,
310,
10561,
491,
4417,
278,
1833,
15478,
13,
1678,
3553,
964,
263,
4333,
2000,
376,
5060,
442,
1188,
1642,
7806,
931,
591,
4635,
591,
788,
13,
1678,
263,
1574,
411,
263,
14334,
322,
385,
3553,
1746,
322,
263,
2302,
310,
278,
1353,
310,
13,
1678,
9976,
15478,
304,
2635,
29889,
450,
1574,
884,
3743,
263,
9853,
13,
1678,
1369,
931,
29889,
13,
13,
1678,
4525,
770,
15894,
278,
1203,
3553,
338,
3342,
491,
2322,
408,
639,
278,
29004,
10561,
13,
1678,
313,
991,
597,
2640,
29889,
23264,
29889,
510,
29914,
11288,
29914,
5679,
29914,
5696,
29914,
2061,
1204,
12495,
512,
445,
1206,
297,
263,
2323,
1065,
13,
1678,
310,
278,
282,
962,
7443,
5215,
278,
23481,
674,
1712,
13557,
3495,
322,
1889,
7117,
29889,
1334,
508,
671,
13,
1678,
1438,
4235,
304,
12439,
13534,
1372,
393,
9559,
297,
278,
3517,
1065,
29889,
1105,
591,
2740,
363,
599,
13534,
1372,
13,
1678,
411,
385,
3553,
7621,
1135,
278,
3553,
297,
278,
10715,
1188,
29889,
13,
13,
1678,
1334,
769,
12812,
393,
1051,
310,
13534,
1372,
363,
263,
9686,
3553,
13,
1678,
313,
1745,
1096,
591,
1122,
367,
2734,
2999,
9853,
6441,
29879,
297,
8943,
29897,
304,
1284,
278,
13534,
1372,
4475,
304,
445,
13,
1678,
9853,
10715,
29889,
9038,
591,
505,
393,
1051,
310,
9686,
13534,
1372,
769,
591,
505,
278,
2302,
310,
3618,
15478,
29889,
13,
1678,
2567,
591,
1073,
988,
278,
10715,
2602,
881,
367,
313,
5060,
442,
1188,
1353,
310,
9976,
718,
7431,
29898,
1051,
310,
9686,
13534,
1372,
29897,
13,
1678,
1334,
508,
1286,
14383,
580,
304,
393,
2602,
297,
278,
1881,
934,
322,
2767,
278,
10715,
1480,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2566,
29892,
1881,
29918,
9507,
29892,
9853,
29918,
2311,
29892,
9920,
29922,
8516,
1125,
13,
4706,
9995,
13,
4706,
1281,
18769,
13,
4706,
9995,
13,
4706,
1583,
3032,
15052,
277,
353,
2566,
3366,
29909,
15789,
1806,
3108,
13,
4706,
1583,
3032,
978,
353,
1815,
265,
936,
29918,
2605,
29898,
2080,
29918,
9507,
29897,
13,
4706,
1583,
3032,
16175,
29918,
2311,
353,
9853,
29918,
2311,
13,
4706,
1583,
3032,
28988,
353,
9909,
29889,
29887,
621,
520,
978,
580,
13,
4706,
565,
9920,
338,
6213,
29901,
13,
9651,
1583,
3032,
9006,
353,
376,
11393,
7122,
29898,
9675,
29889,
19218,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
3032,
9006,
353,
9920,
13,
13,
4706,
1583,
3032,
5060,
442,
14526,
353,
1583,
3032,
15052,
277,
29889,
2886,
29918,
650,
3319,
29908,
978,
1115,
1583,
3032,
978,
3285,
13,
462,
462,
462,
376,
3859,
1115,
376,
262,
18035,
29908,
1800,
13,
13,
4706,
565,
1583,
3032,
5060,
442,
14526,
338,
6213,
29901,
13,
9651,
1583,
29889,
2962,
580,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6219,
29918,
1367,
29898,
1514,
29918,
333,
1125,
13,
4706,
9995,
13,
4706,
26178,
263,
29004,
4669,
3553,
13,
4706,
263,
29871,
29946,
29899,
10389,
995,
15783,
278,
6923,
1951,
278,
26663,
21502,
305,
29892,
13,
4706,
263,
29871,
29941,
29899,
10389,
4933,
15882,
29892,
13,
4706,
263,
29871,
29906,
29899,
10389,
1889,
1178,
29892,
322,
13,
4706,
319,
29871,
29941,
29899,
10389,
6795,
29892,
6257,
411,
263,
4036,
995,
29889,
13,
4706,
9995,
13,
4706,
1178,
29918,
710,
353,
851,
29898,
1514,
29918,
333,
29897,
13,
4706,
396,
4706,
21502,
305,
29871,
29900,
4706,
4933,
1678,
29896,
1678,
1889,
3553,
259,
29906,
1678,
6795,
29871,
29941,
13,
4706,
736,
313,
333,
29918,
710,
29961,
29900,
29901,
29947,
1402,
1178,
29918,
710,
29961,
29947,
29901,
29896,
29946,
1402,
1178,
29918,
710,
29961,
29896,
29946,
29901,
29896,
29947,
1402,
1178,
29918,
710,
29961,
29896,
29947,
29901,
29906,
29946,
2314,
13,
13,
1678,
822,
1369,
29898,
1311,
1125,
13,
4706,
1583,
3032,
15052,
277,
29889,
7851,
29918,
650,
3319,
29908,
978,
1115,
1583,
3032,
978,
3285,
13,
462,
18884,
376,
1372,
1115,
12865,
29889,
329,
29883,
3707,
3285,
13,
462,
18884,
376,
16175,
29918,
2311,
1115,
1583,
3032,
16175,
29918,
2311,
29892,
13,
462,
18884,
376,
6519,
1115,
1583,
3032,
9006,
29892,
13,
462,
18884,
376,
3859,
1115,
11654,
442,
29918,
2792,
29889,
2962,
1800,
13,
13,
1678,
822,
2767,
29898,
1311,
29892,
1574,
29918,
333,
29892,
2302,
1125,
13,
13,
4706,
1583,
3032,
15052,
277,
29889,
7851,
29918,
650,
3319,
29908,
978,
1115,
1583,
3032,
978,
3285,
13,
462,
18884,
376,
2798,
1115,
2302,
29892,
13,
462,
18884,
376,
1372,
1115,
12865,
29889,
329,
29883,
3707,
3285,
13,
462,
18884,
376,
1514,
29918,
333,
1115,
1574,
29918,
333,
29892,
13,
462,
18884,
376,
3859,
1115,
11654,
442,
29918,
2792,
29889,
262,
18035,
1800,
13,
13,
1678,
822,
10715,
29898,
1311,
29892,
4333,
1125,
13,
4706,
9995,
13,
4706,
3617,
278,
10715,
1574,
29889,
2567,
1284,
738,
10561,
2825,
1156,
278,
10715,
1574,
471,
2825,
13,
4706,
2629,
278,
1021,
1889,
322,
4933,
29889,
3917,
1906,
577,
591,
1073,
988,
591,
526,
29889,
13,
4706,
7106,
278,
716,
1574,
2302,
393,
591,
508,
14383,
2086,
29889,
13,
4706,
9995,
13,
13,
4706,
1583,
3032,
5060,
442,
14526,
353,
1583,
3032,
15052,
277,
29889,
2886,
29918,
650,
3319,
29908,
978,
1115,
1583,
3032,
978,
3285,
13,
462,
462,
462,
376,
3859,
1115,
11654,
442,
29918,
2792,
29889,
262,
18035,
1800,
13,
13,
4706,
565,
1583,
3032,
5060,
442,
14526,
338,
6213,
29901,
29871,
396,
14383,
3078,
29892,
3078,
304,
10715,
13,
9651,
736,
29871,
29900,
13,
13,
4706,
2302,
353,
1583,
3032,
5060,
442,
14526,
3366,
2798,
3108,
13,
4706,
313,
3383,
4933,
29892,
23107,
29892,
24459,
353,
11654,
4254,
29889,
5451,
29918,
1367,
29898,
1311,
3032,
5060,
442,
14526,
3366,
1514,
29918,
333,
20068,
13,
13,
4706,
10677,
353,
4333,
29889,
2886,
3319,
29908,
29918,
333,
1115,
8853,
29938,
4141,
1115,
1583,
3032,
5060,
442,
14526,
3366,
1514,
29918,
333,
3108,
24289,
13,
13,
4706,
363,
474,
297,
10677,
29901,
13,
9651,
313,
3383,
474,
29918,
23523,
29892,
474,
29918,
5935,
29892,
24459,
353,
11654,
4254,
29889,
5451,
29918,
1367,
29898,
29875,
3366,
29918,
333,
20068,
13,
13,
9651,
565,
474,
29918,
23523,
1275,
4933,
322,
474,
29918,
5935,
1275,
23107,
29901,
13,
18884,
2302,
353,
2302,
718,
29871,
29896,
13,
13,
9651,
565,
2302,
1275,
1583,
3032,
5060,
442,
14526,
3366,
16175,
29918,
2311,
3108,
29901,
13,
18884,
396,
591,
505,
278,
2989,
9853,
29892,
591,
508,
29915,
29873,
505,
15478,
901,
1135,
29871,
13,
18884,
396,
445,
1434,
13271,
278,
10715,
1574,
13,
18884,
2867,
13,
13,
4706,
736,
2302,
13,
13,
1678,
822,
8341,
29898,
1311,
1125,
13,
13,
4706,
1583,
3032,
5060,
442,
14526,
353,
1583,
3032,
15052,
277,
29889,
7851,
29918,
650,
3319,
29908,
978,
1115,
1583,
3032,
978,
3285,
13,
462,
462,
462,
259,
376,
1372,
1115,
12865,
29889,
329,
29883,
3707,
3285,
13,
462,
462,
462,
259,
376,
3859,
1115,
11654,
442,
29918,
2792,
29889,
4951,
728,
1800,
13,
13,
1678,
822,
903,
2886,
29918,
4230,
29898,
1311,
29892,
784,
29892,
1574,
1125,
13,
13,
4706,
565,
376,
1372,
29908,
297,
1574,
29901,
13,
9651,
10677,
353,
784,
29889,
2886,
29898,
1514,
467,
6605,
3319,
29908,
1372,
1115,
282,
962,
7443,
29889,
2287,
7187,
11794,
4214,
7690,
13400,
29898,
29896,
29897,
13,
9651,
363,
274,
297,
10677,
29901,
13,
18884,
736,
274,
13,
9651,
736,
6213,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
703,
29918,
2886,
29918,
4230,
6858,
263,
14334,
1746,
525,
1372,
29915,
1159,
13,
13,
1678,
822,
679,
29918,
3859,
29898,
1311,
29892,
1024,
1125,
13,
13,
4706,
1574,
353,
1583,
3032,
15052,
277,
29889,
2886,
3319,
29908,
978,
1115,
1024,
29892,
13,
462,
18884,
376,
3859,
1115,
11654,
442,
29918,
2792,
29889,
4951,
728,
7690,
6605,
3319,
29908,
1372,
1115,
282,
962,
7443,
29889,
2287,
7187,
11794,
4214,
7690,
13400,
29898,
29896,
29897,
13,
13,
4706,
565,
1574,
29901,
13,
9651,
736,
11654,
442,
29918,
2792,
29889,
4951,
728,
13,
13,
4706,
1574,
353,
1583,
3032,
15052,
277,
29889,
2886,
29918,
650,
3319,
29908,
978,
1115,
1024,
29892,
13,
462,
462,
1678,
376,
3859,
1115,
11654,
442,
29918,
2792,
29889,
262,
18035,
1800,
13,
13,
4706,
565,
1574,
29901,
13,
9651,
736,
11654,
442,
29918,
2792,
29889,
262,
18035,
13,
13,
4706,
1574,
353,
1583,
3032,
15052,
277,
29889,
2886,
29918,
650,
3319,
29908,
978,
1115,
1024,
29892,
13,
462,
462,
1678,
376,
3859,
1115,
11654,
442,
29918,
2792,
29889,
2962,
1800,
13,
13,
1678,
822,
10092,
29898,
1311,
1125,
13,
13,
4706,
1583,
3032,
5060,
442,
14526,
353,
1583,
3032,
15052,
277,
29889,
2886,
29918,
650,
29918,
392,
29918,
5504,
3319,
29908,
978,
1115,
1583,
3032,
978,
580,
1118,
13,
462,
462,
462,
965,
8853,
29938,
842,
1115,
8853,
16394,
1115,
12865,
29889,
329,
29883,
3707,
3285,
13,
462,
462,
462,
462,
268,
376,
16175,
29918,
2311,
1115,
1583,
3032,
16175,
29918,
2311,
29892,
13,
462,
462,
462,
462,
268,
376,
2798,
1115,
29871,
29900,
29892,
13,
462,
462,
462,
462,
268,
376,
4230,
29918,
1514,
29918,
333,
1115,
29871,
29900,
29892,
13,
462,
462,
462,
462,
268,
376,
3859,
1115,
376,
262,
18035,
29908,
24289,
13,
2
] |
neutron/services/logapi/drivers/manager.py | knodir/neutron | 0 | 79977 | <reponame>knodir/neutron
# Copyright (c) 2017 Fujitsu Limited
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib import exceptions
from oslo_log import log as logging
from neutron.services.logapi.common import constants as log_const
from neutron.services.logapi.common import exceptions as log_exc
from neutron.services.logapi.rpc import server as server_rpc
LOG = logging.getLogger(__name__)
RESOURCE_CB_CLASS_MAP = {}
# This function should be called by log_driver
def register(resource_type, obj_class):
if resource_type not in RESOURCE_CB_CLASS_MAP:
RESOURCE_CB_CLASS_MAP[resource_type] = obj_class
def _get_param(args, kwargs, name, index):
try:
return kwargs[name]
except KeyError:
try:
return args[index]
except IndexError:
msg = "Missing parameter %s" % name
raise log_exc.LogapiDriverException(exception_msg=msg)
class ResourceCallBackBase(object):
def __new__(cls, *args, **kwargs):
if not hasattr(cls, '_instance'):
cls._instance = super(ResourceCallBackBase, cls).__new__(cls)
return cls._instance
def __init__(self, resource, push_api):
self.resource_push_api = push_api
for event in (events.AFTER_CREATE, events.AFTER_UPDATE,
events.AFTER_DELETE):
registry.subscribe(self.handle_event, resource, event)
def handle_event(self, resource, event, trigger, **kwargs):
"""Handle resource callback event"""
pass
class LoggingServiceDriverManager(object):
def __init__(self):
self._drivers = set()
self.rpc_required = False
registry.publish(log_const.LOGGING_PLUGIN, events.AFTER_INIT, self)
if self.rpc_required:
self._start_rpc_listeners()
self.logging_rpc = server_rpc.LoggingApiNotification()
@property
def drivers(self):
return self._drivers
def register_driver(self, driver):
"""Register driver with logging plugin.
This method is called from drivers on INIT event.
"""
self._drivers.add(driver)
self.rpc_required |= driver.requires_rpc
# Handle callback event AFTER_UPDATE, AFTER_DELETE, AFTER_CREATE of
# resources which related to log object. For example: when a sg_rule
# is added or deleted from security group, if this rule is bounded by a
# log_resources, then it should tell to agent to trigger log_drivers.
self._setup_resources_cb_handle()
def _start_rpc_listeners(self):
self._skeleton = server_rpc.LoggingApiSkeleton()
return self._skeleton.conn.consume_in_threads()
@property
def supported_logging_types(self):
if not self._drivers:
return set()
log_types = set()
for driver in self._drivers:
log_types |= set(driver.supported_logging_types)
LOG.debug("Supported logging types (logging types supported "
"by at least one loaded log_driver): %s", log_types)
return log_types
def call(self, method_name, *args, **kwargs):
"""Helper method for calling a method across all extension drivers."""
exc_list = []
for driver in self._drivers:
try:
getattr(driver, method_name)(*args, **kwargs)
except Exception as exc:
exception_msg = ("Extension driver '%(name)s' failed in "
"%(method)s")
exception_data = {'name': driver.name, 'method': method_name}
LOG.exception(exception_msg, exception_data)
exc_list.append(exc)
if exc_list:
raise exceptions.DriverCallError(exc_list=exc_list)
if self.rpc_required:
context = _get_param(args, kwargs, 'context', index=0)
log_obj = _get_param(args, kwargs, 'log_obj', index=1)
try:
rpc_method = getattr(self.logging_rpc, method_name)
except AttributeError:
LOG.error("Method %s is not implemented in logging RPC",
method_name)
return
rpc_method(context, log_obj)
def _setup_resources_cb_handle(self):
for res, obj_class in RESOURCE_CB_CLASS_MAP.items():
obj_class(res, self.call)
| [
1,
529,
276,
1112,
420,
29958,
3959,
397,
381,
29914,
17821,
1617,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29955,
383,
8016,
1169,
29884,
28873,
13,
29937,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
1678,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
1678,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
1678,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
308,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
1678,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
1678,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
13,
29937,
1678,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
1678,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
1678,
1090,
278,
19245,
29889,
13,
13,
3166,
11553,
1617,
29918,
1982,
29889,
14035,
29879,
1053,
4959,
13,
3166,
11553,
1617,
29918,
1982,
29889,
14035,
29879,
1053,
21235,
13,
3166,
11553,
1617,
29918,
1982,
1053,
15283,
13,
3166,
2897,
417,
29918,
1188,
1053,
1480,
408,
12183,
13,
13,
3166,
11553,
1617,
29889,
9916,
29889,
1188,
2754,
29889,
9435,
1053,
17727,
408,
1480,
29918,
3075,
13,
3166,
11553,
1617,
29889,
9916,
29889,
1188,
2754,
29889,
9435,
1053,
15283,
408,
1480,
29918,
735,
29883,
13,
3166,
11553,
1617,
29889,
9916,
29889,
1188,
2754,
29889,
29878,
6739,
1053,
1923,
408,
1923,
29918,
29878,
6739,
13,
13,
14480,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
1525,
27839,
4741,
29918,
21685,
29918,
13875,
1799,
29918,
23827,
353,
6571,
13,
13,
13,
29937,
910,
740,
881,
367,
2000,
491,
1480,
29918,
9465,
13,
1753,
6036,
29898,
10314,
29918,
1853,
29892,
5446,
29918,
1990,
1125,
13,
1678,
565,
6503,
29918,
1853,
451,
297,
390,
2890,
22970,
4741,
29918,
21685,
29918,
13875,
1799,
29918,
23827,
29901,
13,
4706,
390,
2890,
22970,
4741,
29918,
21685,
29918,
13875,
1799,
29918,
23827,
29961,
10314,
29918,
1853,
29962,
353,
5446,
29918,
1990,
13,
13,
13,
1753,
903,
657,
29918,
3207,
29898,
5085,
29892,
9049,
5085,
29892,
1024,
29892,
2380,
1125,
13,
1678,
1018,
29901,
13,
4706,
736,
9049,
5085,
29961,
978,
29962,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
1018,
29901,
13,
9651,
736,
6389,
29961,
2248,
29962,
13,
4706,
5174,
11374,
2392,
29901,
13,
9651,
10191,
353,
376,
18552,
292,
3443,
1273,
29879,
29908,
1273,
1024,
13,
9651,
12020,
1480,
29918,
735,
29883,
29889,
3403,
2754,
12376,
2451,
29898,
11739,
29918,
7645,
29922,
7645,
29897,
13,
13,
13,
1990,
18981,
5594,
5841,
5160,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
1482,
12035,
25932,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
565,
451,
756,
5552,
29898,
25932,
29892,
22868,
8758,
29374,
13,
9651,
1067,
29879,
3032,
8758,
353,
2428,
29898,
6848,
5594,
5841,
5160,
29892,
1067,
29879,
467,
1649,
1482,
12035,
25932,
29897,
13,
4706,
736,
1067,
29879,
3032,
8758,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6503,
29892,
5503,
29918,
2754,
1125,
13,
4706,
1583,
29889,
10314,
29918,
5910,
29918,
2754,
353,
5503,
29918,
2754,
13,
4706,
363,
1741,
297,
313,
13604,
29889,
5098,
4945,
29918,
27045,
29892,
4959,
29889,
5098,
4945,
29918,
14474,
29892,
13,
462,
418,
4959,
29889,
5098,
4945,
29918,
2287,
18476,
1125,
13,
9651,
21235,
29889,
19496,
29898,
1311,
29889,
8411,
29918,
3696,
29892,
6503,
29892,
1741,
29897,
13,
13,
1678,
822,
4386,
29918,
3696,
29898,
1311,
29892,
6503,
29892,
1741,
29892,
7135,
29892,
3579,
19290,
1125,
13,
4706,
9995,
13554,
6503,
6939,
1741,
15945,
29908,
13,
4706,
1209,
13,
13,
13,
1990,
4522,
3460,
3170,
12376,
3260,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
24477,
874,
353,
731,
580,
13,
4706,
1583,
29889,
29878,
6739,
29918,
12403,
353,
7700,
13,
4706,
21235,
29889,
23679,
29898,
1188,
29918,
3075,
29889,
14480,
29954,
4214,
29918,
7390,
23338,
1177,
29892,
4959,
29889,
5098,
4945,
29918,
26019,
29892,
1583,
29897,
13,
13,
4706,
565,
1583,
29889,
29878,
6739,
29918,
12403,
29901,
13,
9651,
1583,
3032,
2962,
29918,
29878,
6739,
29918,
20631,
414,
580,
13,
9651,
1583,
29889,
21027,
29918,
29878,
6739,
353,
1923,
29918,
29878,
6739,
29889,
3403,
3460,
11713,
12958,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
18563,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
24477,
874,
13,
13,
1678,
822,
6036,
29918,
9465,
29898,
1311,
29892,
7156,
1125,
13,
4706,
9995,
15213,
7156,
411,
12183,
7079,
29889,
13,
13,
4706,
910,
1158,
338,
2000,
515,
18563,
373,
2672,
1806,
1741,
29889,
13,
4706,
9995,
13,
4706,
1583,
3032,
24477,
874,
29889,
1202,
29898,
9465,
29897,
13,
4706,
1583,
29889,
29878,
6739,
29918,
12403,
891,
29922,
7156,
29889,
276,
339,
2658,
29918,
29878,
6739,
13,
13,
4706,
396,
29273,
6939,
1741,
23844,
4945,
29918,
14474,
29892,
23844,
4945,
29918,
2287,
18476,
29892,
23844,
4945,
29918,
27045,
310,
13,
4706,
396,
7788,
607,
4475,
304,
1480,
1203,
29889,
1152,
1342,
29901,
746,
263,
269,
29887,
29918,
7491,
13,
4706,
396,
338,
2715,
470,
11132,
515,
6993,
2318,
29892,
565,
445,
5751,
338,
12635,
491,
263,
13,
4706,
396,
1480,
29918,
13237,
29892,
769,
372,
881,
2649,
304,
10823,
304,
7135,
1480,
29918,
24477,
874,
29889,
13,
4706,
1583,
3032,
14669,
29918,
13237,
29918,
10702,
29918,
8411,
580,
13,
13,
1678,
822,
903,
2962,
29918,
29878,
6739,
29918,
20631,
414,
29898,
1311,
1125,
13,
4706,
1583,
3032,
26050,
11285,
353,
1923,
29918,
29878,
6739,
29889,
3403,
3460,
11713,
29903,
446,
11285,
580,
13,
4706,
736,
1583,
3032,
26050,
11285,
29889,
13082,
29889,
3200,
2017,
29918,
262,
29918,
28993,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
6969,
29918,
21027,
29918,
8768,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
3032,
24477,
874,
29901,
13,
9651,
736,
731,
580,
13,
13,
4706,
1480,
29918,
8768,
353,
731,
580,
13,
13,
4706,
363,
7156,
297,
1583,
3032,
24477,
874,
29901,
13,
9651,
1480,
29918,
8768,
891,
29922,
731,
29898,
9465,
29889,
23765,
29918,
21027,
29918,
8768,
29897,
13,
4706,
25401,
29889,
8382,
703,
14039,
287,
12183,
4072,
313,
21027,
4072,
6969,
376,
13,
462,
29871,
376,
1609,
472,
3203,
697,
7500,
1480,
29918,
9465,
1125,
1273,
29879,
613,
1480,
29918,
8768,
29897,
13,
4706,
736,
1480,
29918,
8768,
13,
13,
1678,
822,
1246,
29898,
1311,
29892,
1158,
29918,
978,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
9995,
10739,
1158,
363,
5432,
263,
1158,
4822,
599,
6081,
18563,
1213,
15945,
13,
4706,
5566,
29918,
1761,
353,
5159,
13,
4706,
363,
7156,
297,
1583,
3032,
24477,
874,
29901,
13,
9651,
1018,
29901,
13,
18884,
679,
5552,
29898,
9465,
29892,
1158,
29918,
978,
5033,
29930,
5085,
29892,
3579,
19290,
29897,
13,
9651,
5174,
8960,
408,
5566,
29901,
13,
18884,
3682,
29918,
7645,
353,
4852,
17657,
7156,
14210,
29898,
978,
29897,
29879,
29915,
5229,
297,
376,
13,
462,
462,
11860,
29898,
5696,
29897,
29879,
1159,
13,
18884,
3682,
29918,
1272,
353,
11117,
978,
2396,
7156,
29889,
978,
29892,
525,
5696,
2396,
1158,
29918,
978,
29913,
13,
18884,
25401,
29889,
11739,
29898,
11739,
29918,
7645,
29892,
3682,
29918,
1272,
29897,
13,
18884,
5566,
29918,
1761,
29889,
4397,
29898,
735,
29883,
29897,
13,
13,
4706,
565,
5566,
29918,
1761,
29901,
13,
9651,
12020,
15283,
29889,
12376,
5594,
2392,
29898,
735,
29883,
29918,
1761,
29922,
735,
29883,
29918,
1761,
29897,
13,
13,
4706,
565,
1583,
29889,
29878,
6739,
29918,
12403,
29901,
13,
9651,
3030,
353,
903,
657,
29918,
3207,
29898,
5085,
29892,
9049,
5085,
29892,
525,
4703,
742,
2380,
29922,
29900,
29897,
13,
9651,
1480,
29918,
5415,
353,
903,
657,
29918,
3207,
29898,
5085,
29892,
9049,
5085,
29892,
525,
1188,
29918,
5415,
742,
2380,
29922,
29896,
29897,
13,
13,
9651,
1018,
29901,
13,
18884,
364,
6739,
29918,
5696,
353,
679,
5552,
29898,
1311,
29889,
21027,
29918,
29878,
6739,
29892,
1158,
29918,
978,
29897,
13,
9651,
5174,
23833,
2392,
29901,
13,
18884,
25401,
29889,
2704,
703,
4062,
1273,
29879,
338,
451,
8762,
297,
12183,
390,
9026,
613,
13,
462,
3986,
1158,
29918,
978,
29897,
13,
18884,
736,
13,
9651,
364,
6739,
29918,
5696,
29898,
4703,
29892,
1480,
29918,
5415,
29897,
13,
13,
1678,
822,
903,
14669,
29918,
13237,
29918,
10702,
29918,
8411,
29898,
1311,
1125,
13,
4706,
363,
620,
29892,
5446,
29918,
1990,
297,
390,
2890,
22970,
4741,
29918,
21685,
29918,
13875,
1799,
29918,
23827,
29889,
7076,
7295,
13,
9651,
5446,
29918,
1990,
29898,
690,
29892,
1583,
29889,
4804,
29897,
13,
2
] |
extensions/rules/checked_proof_test.py | VictoriaRoux/oppia | 3 | 111448 | # coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar
# 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.
"""Tests for classification of CheckedProof."""
__author__ = '<NAME>'
from extensions.rules import checked_proof
import test_utils
class CheckedProofRuleUnitTests(test_utils.GenericTestBase):
"""Tests for rules operating on CheckedProof objects."""
correct_example = {
'assumptions_string': 'p',
'target_string': 'q',
'proof_string': 'a proof',
'correct': True
}
incorrect_example_parsing = {
'assumptions_string': 'p',
'target_string': 'q',
'proof_string': 'a proof',
'correct': False,
'error_category': 'parsing',
'error_code': 'a code',
'error_message': 'a message',
'error_line_number': 3
}
incorrect_example_typing = {
'assumptions_string': 'p',
'target_string': 'q',
'proof_string': 'a proof',
'correct': False,
'error_category': 'typing',
'error_code': 'a code',
'error_message': 'a message',
'error_line_number': 4
}
def test_correct_rule(self):
rule = checked_proof.Correct()
self.assertTrue(rule.eval(self.correct_example))
self.assertFalse(rule.eval(self.incorrect_example_parsing))
self.assertFalse(rule.eval(self.incorrect_example_typing))
def test_not_correct_rule(self):
rule = checked_proof.NotCorrect()
self.assertFalse(rule.eval(self.correct_example))
self.assertTrue(rule.eval(self.incorrect_example_parsing))
self.assertTrue(rule.eval(self.incorrect_example_typing))
def test_not_correct_by_category_rule(self):
rule = checked_proof.NotCorrectByCategory('typing')
self.assertFalse(rule.eval(self.correct_example))
self.assertFalse(rule.eval(self.incorrect_example_parsing))
self.assertTrue(rule.eval(self.incorrect_example_typing))
| [
1,
396,
14137,
29901,
23616,
29899,
29947,
13,
29937,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29946,
450,
438,
407,
423,
13189,
943,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
4964,
4495,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
29899,
3235,
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,
15945,
29908,
24376,
363,
12965,
310,
5399,
287,
28116,
1213,
15945,
13,
13,
1649,
8921,
1649,
353,
12801,
5813,
16299,
13,
13,
3166,
17752,
29889,
19238,
1053,
7120,
29918,
8017,
13,
5215,
1243,
29918,
13239,
13,
13,
13,
1990,
5399,
287,
28116,
10740,
8325,
24376,
29898,
1688,
29918,
13239,
29889,
15809,
3057,
5160,
1125,
13,
1678,
9995,
24376,
363,
6865,
13598,
373,
5399,
287,
28116,
3618,
1213,
15945,
13,
13,
1678,
1959,
29918,
4773,
353,
426,
13,
4706,
525,
465,
398,
1980,
29918,
1807,
2396,
525,
29886,
742,
13,
4706,
525,
5182,
29918,
1807,
2396,
525,
29939,
742,
13,
4706,
525,
8017,
29918,
1807,
2396,
525,
29874,
5296,
742,
13,
4706,
525,
15728,
2396,
5852,
13,
1678,
500,
13,
1678,
10240,
29918,
4773,
29918,
862,
2976,
353,
426,
13,
4706,
525,
465,
398,
1980,
29918,
1807,
2396,
525,
29886,
742,
13,
4706,
525,
5182,
29918,
1807,
2396,
525,
29939,
742,
13,
4706,
525,
8017,
29918,
1807,
2396,
525,
29874,
5296,
742,
13,
4706,
525,
15728,
2396,
7700,
29892,
13,
4706,
525,
2704,
29918,
7320,
2396,
525,
862,
2976,
742,
13,
4706,
525,
2704,
29918,
401,
2396,
525,
29874,
775,
742,
13,
4706,
525,
2704,
29918,
4906,
2396,
525,
29874,
2643,
742,
13,
4706,
525,
2704,
29918,
1220,
29918,
4537,
2396,
29871,
29941,
13,
1678,
500,
13,
1678,
10240,
29918,
4773,
29918,
1017,
15702,
353,
426,
13,
4706,
525,
465,
398,
1980,
29918,
1807,
2396,
525,
29886,
742,
13,
4706,
525,
5182,
29918,
1807,
2396,
525,
29939,
742,
13,
4706,
525,
8017,
29918,
1807,
2396,
525,
29874,
5296,
742,
13,
4706,
525,
15728,
2396,
7700,
29892,
13,
4706,
525,
2704,
29918,
7320,
2396,
525,
1017,
15702,
742,
13,
4706,
525,
2704,
29918,
401,
2396,
525,
29874,
775,
742,
13,
4706,
525,
2704,
29918,
4906,
2396,
525,
29874,
2643,
742,
13,
4706,
525,
2704,
29918,
1220,
29918,
4537,
2396,
29871,
29946,
13,
1678,
500,
13,
13,
1678,
822,
1243,
29918,
15728,
29918,
7491,
29898,
1311,
1125,
13,
4706,
5751,
353,
7120,
29918,
8017,
29889,
12521,
1621,
580,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
15728,
29918,
4773,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
262,
15728,
29918,
4773,
29918,
862,
2976,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
262,
15728,
29918,
4773,
29918,
1017,
15702,
876,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
15728,
29918,
7491,
29898,
1311,
1125,
13,
4706,
5751,
353,
7120,
29918,
8017,
29889,
3664,
12521,
1621,
580,
13,
4706,
1583,
29889,
9294,
8824,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
15728,
29918,
4773,
876,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
262,
15728,
29918,
4773,
29918,
862,
2976,
876,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
262,
15728,
29918,
4773,
29918,
1017,
15702,
876,
13,
13,
1678,
822,
1243,
29918,
1333,
29918,
15728,
29918,
1609,
29918,
7320,
29918,
7491,
29898,
1311,
1125,
13,
4706,
5751,
353,
7120,
29918,
8017,
29889,
3664,
12521,
1621,
2059,
10900,
877,
1017,
15702,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
15728,
29918,
4773,
876,
13,
4706,
1583,
29889,
9294,
8824,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
262,
15728,
29918,
4773,
29918,
862,
2976,
876,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
29889,
14513,
29898,
1311,
29889,
262,
15728,
29918,
4773,
29918,
1017,
15702,
876,
13,
13,
13,
13,
2
] |
1.-MapReduce Spark/B-Datos Meteorologicos/Meteorologico_3.py | gorco/sgdi-lab | 0 | 34123 | # coding=utf-8
# Este fichero generado para la asignatura SGDI
# Practica 1 MapReduce Y Spark, Ejercicio B.3
# Autores: <NAME> y <NAME>
# <NAME> y <NAME> declaramos que esta solución es fruto exclusivamente de nuestro
# trabajo personal. No hemos sido ayudados por ninguna otra persona ni hemos obtenido la solución de fuentes externas,
# y tampoco hemos compartido nuestra solución con nadie. Declaramos además que no hemos realizado de manera deshonesta
# ninguna otra actividad que pueda mejorar nuestros resultados ni perjudicar los resultados de los demás.
from mrjob.job import MRJob
from operator import itemgetter
import sys
# 3.- Implementar una tarea MapReduce en mrjob que resuelva este problema utilizando las fases mapper, combiner y
# reducer
class MRMeteoOpt(MRJob):
MRJob.SORT_VALUES = True
# Fase MAP (line es una cadena de texto)
# Devuelve repetido el valor de la bateria para poder trabajar con los valores min, avg y max de manera sencilla en
# la fase combiner permitiendo que tanto entrada como salida sea del mismo formato
def mapper(self, key, line):
word = line.split(',')
if word[0] != 'date-time':
time = word[0].split('/')
yield str(time[1]) + '/' + str(time[0]), (word[8], word[8], word[8], 1)
# Fase COMBINER (key es una cadena texto, values un generador de valores)
def combiner(self, key, values):
valuesList = list(values)
sumValue = 0;
minValue = sys.maxint;
maxValue = 0;
count = 0
for l in valuesList:
sumValue += float(l[0])
count += 1
minValue = float(l[1]) if float(l[1]) < float(minValue) else float(minValue)
maxValue = float(l[2]) if float(l[2]) > float(maxValue) else float(maxValue)
yield key, (sumValue, minValue, maxValue, count)
# Fase REDUCE (key es una cadena texto, values un generador de valores)
def reducer(self, key, values):
valuesList = list(values)
sumValue = 0;
minValue = sys.maxint;
maxValue = 0;
count = 0
for l in valuesList:
sumValue += l[0]
count += l[3]
minValue = float(l[1]) if float(l[1]) < float(minValue) else float(minValue)
maxValue = float(l[2]) if float(l[2]) > float(maxValue) else float(maxValue)
if float(count) > 0:
avgValue = float(sumValue)/float(count)
yield key, dict(max=maxValue, avg=avgValue, min=minValue)
if __name__ == '__main__':
MRMeteoOpt.run()
| [
1,
396,
14137,
29922,
9420,
29899,
29947,
13,
13,
29937,
12723,
285,
436,
1489,
1176,
912,
1702,
425,
408,
647,
7969,
317,
29954,
4571,
13,
29937,
29124,
983,
29871,
29896,
7315,
29934,
6085,
346,
612,
20814,
29892,
26087,
6269,
11088,
350,
29889,
29941,
13,
29937,
5202,
2361,
29901,
529,
5813,
29958,
343,
529,
5813,
29958,
13,
13,
29937,
529,
5813,
29958,
343,
529,
5813,
29958,
7669,
14054,
712,
7444,
899,
16249,
831,
1424,
3066,
13489,
11778,
316,
4948,
16906,
13,
29937,
21844,
7333,
29889,
1939,
9736,
359,
11336,
10156,
566,
2255,
1277,
26511,
4347,
19744,
21411,
6836,
9736,
359,
16219,
1941,
425,
899,
16249,
316,
4084,
5326,
18083,
29892,
13,
29937,
343,
260,
1160,
6235,
9736,
359,
29078,
1941,
4948,
8505,
899,
16249,
378,
8642,
347,
29889,
3826,
4675,
14054,
22133,
712,
694,
9736,
359,
8869,
912,
316,
16354,
553,
27305,
4405,
13,
29937,
26511,
4347,
19744,
5039,
2368,
712,
2653,
8710,
16918,
279,
4948,
342,
1883,
1121,
2255,
6836,
639,
17675,
293,
279,
1232,
1121,
2255,
316,
1232,
1261,
1569,
29889,
13,
13,
3166,
286,
29878,
9057,
29889,
9057,
1053,
29751,
11947,
13,
3166,
5455,
1053,
2944,
657,
357,
13,
5215,
10876,
13,
13,
29937,
29871,
29941,
9229,
1954,
2037,
279,
1185,
260,
6203,
7315,
29934,
6085,
346,
427,
286,
29878,
9057,
712,
620,
2491,
1564,
4404,
21655,
11824,
1743,
1869,
285,
2129,
611,
2496,
29892,
5769,
261,
343,
13,
29937,
3724,
2265,
13,
1990,
29751,
29924,
2650,
29877,
20624,
29898,
21055,
11947,
1125,
13,
1678,
29751,
11947,
29889,
29903,
8476,
29918,
8932,
12996,
353,
5852,
13,
13,
12,
29937,
383,
559,
341,
3301,
313,
1220,
831,
1185,
13840,
2386,
316,
1426,
29877,
29897,
13,
1678,
396,
9481,
2491,
345,
21159,
1941,
560,
16497,
316,
425,
289,
1008,
423,
1702,
13540,
16069,
279,
378,
1232,
659,
2361,
1375,
29892,
1029,
29887,
343,
4236,
316,
16354,
269,
3977,
2911,
427,
13,
1678,
396,
425,
20851,
5769,
261,
14257,
17008,
712,
12264,
9953,
1114,
1986,
4497,
1458,
7205,
628,
11329,
883,
1219,
13,
1678,
822,
611,
2496,
29898,
1311,
29892,
1820,
29892,
1196,
1125,
13,
4706,
1734,
353,
1196,
29889,
5451,
29317,
1495,
13,
4706,
565,
1734,
29961,
29900,
29962,
2804,
525,
1256,
29899,
2230,
2396,
13,
9651,
931,
353,
1734,
29961,
29900,
1822,
5451,
11219,
1495,
13,
9651,
7709,
851,
29898,
2230,
29961,
29896,
2314,
718,
8207,
29915,
718,
851,
29898,
2230,
29961,
29900,
11724,
313,
1742,
29961,
29947,
1402,
1734,
29961,
29947,
1402,
1734,
29961,
29947,
1402,
29871,
29896,
29897,
13,
13,
1678,
396,
383,
559,
4810,
9486,
1177,
1001,
313,
1989,
831,
1185,
13840,
2386,
1426,
29877,
29892,
1819,
443,
1176,
3136,
316,
659,
2361,
29897,
13,
1678,
822,
5769,
261,
29898,
1311,
29892,
1820,
29892,
1819,
1125,
13,
4706,
1819,
1293,
353,
1051,
29898,
5975,
29897,
13,
4706,
2533,
1917,
353,
29871,
29900,
29936,
13,
4706,
1375,
1917,
353,
10876,
29889,
3317,
524,
29936,
13,
4706,
4236,
1917,
353,
29871,
29900,
29936,
13,
4706,
2302,
353,
29871,
29900,
13,
4706,
363,
301,
297,
1819,
1293,
29901,
13,
9651,
2533,
1917,
4619,
5785,
29898,
29880,
29961,
29900,
2314,
13,
9651,
2302,
4619,
29871,
29896,
13,
9651,
1375,
1917,
353,
5785,
29898,
29880,
29961,
29896,
2314,
565,
5785,
29898,
29880,
29961,
29896,
2314,
529,
5785,
29898,
1195,
1917,
29897,
1683,
5785,
29898,
1195,
1917,
29897,
13,
9651,
4236,
1917,
353,
5785,
29898,
29880,
29961,
29906,
2314,
565,
5785,
29898,
29880,
29961,
29906,
2314,
1405,
5785,
29898,
3317,
1917,
29897,
1683,
5785,
29898,
3317,
1917,
29897,
13,
4706,
7709,
1820,
29892,
313,
2083,
1917,
29892,
1375,
1917,
29892,
4236,
1917,
29892,
2302,
29897,
13,
13,
12,
29937,
383,
559,
390,
3352,
29965,
4741,
313,
1989,
831,
1185,
13840,
2386,
1426,
29877,
29892,
1819,
443,
1176,
3136,
316,
659,
2361,
29897,
13,
1678,
822,
3724,
2265,
29898,
1311,
29892,
1820,
29892,
1819,
1125,
13,
4706,
1819,
1293,
353,
1051,
29898,
5975,
29897,
13,
4706,
2533,
1917,
353,
29871,
29900,
29936,
13,
4706,
1375,
1917,
353,
10876,
29889,
3317,
524,
29936,
13,
4706,
4236,
1917,
353,
29871,
29900,
29936,
13,
4706,
2302,
353,
29871,
29900,
13,
4706,
363,
301,
297,
1819,
1293,
29901,
13,
9651,
2533,
1917,
4619,
301,
29961,
29900,
29962,
13,
9651,
2302,
4619,
301,
29961,
29941,
29962,
13,
9651,
1375,
1917,
353,
5785,
29898,
29880,
29961,
29896,
2314,
565,
5785,
29898,
29880,
29961,
29896,
2314,
529,
5785,
29898,
1195,
1917,
29897,
1683,
5785,
29898,
1195,
1917,
29897,
13,
9651,
4236,
1917,
353,
5785,
29898,
29880,
29961,
29906,
2314,
565,
5785,
29898,
29880,
29961,
29906,
2314,
1405,
5785,
29898,
3317,
1917,
29897,
1683,
5785,
29898,
3317,
1917,
29897,
13,
13,
4706,
565,
5785,
29898,
2798,
29897,
1405,
29871,
29900,
29901,
13,
9651,
1029,
29887,
1917,
353,
5785,
29898,
2083,
1917,
6802,
7411,
29898,
2798,
29897,
13,
9651,
7709,
1820,
29892,
9657,
29898,
3317,
29922,
3317,
1917,
29892,
1029,
29887,
29922,
485,
29887,
1917,
29892,
1375,
29922,
1195,
1917,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
29751,
29924,
2650,
29877,
20624,
29889,
3389,
580,
13,
2
] |
venv/Scripts/ex096.py | SamuelNunesDev/starting_point_in_python | 0 | 111947 | <filename>venv/Scripts/ex096.py
def area(l, c):
return f'A área do terreno {l}x{c} é de {l * c:.2f} m²'
print(area(float(input('Qual a largura do terreno? ')), float(input('Qual o comprimento do terreno? '))))
| [
1,
529,
9507,
29958,
854,
29894,
29914,
4081,
29879,
29914,
735,
29900,
29929,
29953,
29889,
2272,
13,
1753,
4038,
29898,
29880,
29892,
274,
1125,
13,
1678,
736,
285,
29915,
29909,
17335,
437,
1935,
26155,
426,
29880,
29913,
29916,
29912,
29883,
29913,
904,
316,
426,
29880,
334,
274,
29901,
29889,
29906,
29888,
29913,
286,
30088,
29915,
13,
13,
2158,
29898,
6203,
29898,
7411,
29898,
2080,
877,
24399,
263,
5573,
2002,
437,
1935,
26155,
29973,
525,
8243,
5785,
29898,
2080,
877,
24399,
288,
7199,
6174,
437,
1935,
26155,
29973,
525,
13697,
13,
2
] |
excut/feedback/rulebased_deduction/deduction_engine_extended.py | mhmgad/ExCut | 5 | 3975 | """
This module contains the rule-based inference (rulebased_deduction engine)
"""
import itertools
from collections import defaultdict
from itertools import chain
from excut.explanations_mining.descriptions import dump_explanations_to_file
from excut.explanations_mining.descriptions_new import Description2, Atom, load_from_file
from excut.explanations_mining.explaining_engines_extended import PathBasedClustersExplainerExtended
from excut.explanations_mining.simple_miner.description_miner_extended import DescriptionMinerExtended, ExplanationStructure
from excut.kg.kg_query_interface_extended import EndPointKGQueryInterfaceExtended, KGQueryInterfaceExtended
from excut.kg.kg_indexing import Indexer
from excut.kg.utils.data_formating import n3_repr
from excut.utils.logging import logger
from excut.kg.utils.Constants import DEFUALT_AUX_RELATION
from excut.clustering import target_entities as tes
class Prediction:
"""
An object to represent the prediction of the rules
:ivar triple: the predicted triple
:ivar all_sources: all rules that predicted the same triple
"""
# def __init__(self, triple: tuple, source_description=Description(), all_sources=None):
def __init__(self, triple=None, sources=None):
self.triple = triple
# self.source_description = source_descriptionf
self.all_sources = sources if sources else list() # sources if sources else {source_description}
def get_subject(self):
return self.triple[0]
def get_object(self):
return self.triple[2]
def get_quality(self, measure='x_coverage', method=max):
# return self.source_description.get_quality(measure)
return method([source.get_quality(measure) for source in self.all_sources])
def get_main_description(self, measure='x_coverage', method=max):
return method(self.all_sources, key=lambda d: d.get_quality(measure))
def __str__(self):
return str(self.triple) + '<<' + str(self.get_main_description())
def __repr__(self):
return "%s\t(\t%s,%s)" % (self.__class__.__name__, repr(self.triple), repr(self.all_sources))
def __eq__(self, other):
return other.triple == self.triple
def __hash__(self):
return hash(self.triple)
class DeductionEngine():
"""
Abstract rulebased_deduction/inference engine.
"""
def __init__(self, **kwargs):
pass
def infer(self, descriptions, recursive=False, topk=-1):
pass
class SparqlBasedDeductionEngineExtended(DeductionEngine):
"""
Deduction engine that converts the rules to sparql and fire them over the KG.
The rule-based_deduction takes care of consolidating similar predictions
"""
def __init__(self, kg_query_interface: KGQueryInterfaceExtended, relation=DEFUALT_AUX_RELATION, quality='x_coverage', quality_aggregation=max):
"""
:param kg_query_interface: interface for the KG.
:param relation: the relation used in the predicted triple (optional)
:param quality: objective quality measure for ranking the predictions (optional) by default
the exclusive coverage of the rules is used
:param quality_aggregation: the methd used for aggregating the score if multiple rules infers the same fact
(optional) by default max is used.
"""
super(SparqlBasedDeductionEngineExtended, self).__init__()
self.relation = relation
self.query_executer = kg_query_interface
self.quality = quality
self.quality_aggregation = quality_aggregation
self.labels_indexer=Indexer(store=kg_query_interface.type,
endpoint=kg_query_interface.endpoint,
graph= kg_query_interface.labels_graph,
identifier=kg_query_interface.labels_identifier)
def infer(self, descriptions_list, target_entities=None, min_quality=0, topk=-1, output_filepath=None,
clear_target_entities=True):
"""
Infer new facts for a giving set of descriptions
:param descriptions_list: list of explantions/descriptions rules
:param target_entities: entities and their labels for which predictions are generated
:param min_quality: minimum aggregated quality for the predictions
:param topk: k *distinct* highest quality predictions per entity,
:param output_filepath: predictions output file.
:param clear_target_entities: clear indexed target entities after done inference
:return: dictionary of predicted entity-clusters assignments
"""
if isinstance(descriptions_list,dict):
descriptions_list=list(itertools.chain.from_iterable(descriptions_list.values()))
if target_entities:
self.labels_indexer.index_triples(target_entities)
self.relation=target_entities.get_relation()
predictions = list(map(self._infer_single, descriptions_list))
per_entity_predictions = self.consolidate(predictions)
per_entity_predictions = self._merge_and_sort_cut(per_entity_predictions, min_quality, topk=topk)
if output_filepath:
dump_predictions_map(per_entity_predictions, output_filepath, triple_format=True, topk=topk, with_weight=True,
with_description=False, quality=self.quality)
if target_entities and clear_target_entities:
self.labels_indexer.drop()
return per_entity_predictions
def consolidate(self, predictions):
"""
Combine predictions from different rules
:param predictions: list of generated predictions
:return: combined single prediction with several sources for equivalent predictions
:rtype: dict
"""
# per_var_predictions = defaultdict(lambda: defaultdict(list))
# for p in chain.from_iterable(predictions):
# per_var_predictions[p.get_subject()][p.get_object()].append(p)
per_entity_predictions = defaultdict(lambda: defaultdict(Prediction))
for p in list(chain.from_iterable(predictions)):
cons_pred = per_entity_predictions[p.get_subject()][p.get_object()]
cons_pred.triple = p.triple
cons_pred.all_sources += p.all_sources
return per_entity_predictions
def _merge_and_sort_cut(self, per_entity_prediction, threshold=0, topk=-1):
"""
Merge the the inferred facts in case of functional predicates
:param per_entity_prediction:
:return:
"""
def quality_method(p):
return p.get_quality(self.quality, self.quality_aggregation)
per_entity_prediction_filtered = defaultdict(list)
for sub, per_obj_predictions in per_entity_prediction.items():
# print([(k, p.triple[2], qaulity_method(p)) for k, p in per_obj_predictions.items()])
merged_predictions = list(
filter(lambda p: quality_method(p) > threshold, list(per_obj_predictions.values())))
merged_predictions.sort(key=quality_method, reverse=True)
include = topk if topk > 0 else len(merged_predictions)
per_entity_prediction_filtered[sub] = merged_predictions[:include]
return per_entity_prediction_filtered
def _infer_single(self, description: Description2):
"""
Infer new facts for the given Description
:param description:
:return:
"""
bindings = self.query_executer.get_arguments_bindings(description,
restriction_pattern=Description2(body=[Atom('?x',
self.relation,
'?z')]))
head = description.head
# only supports p(?x,CONSTANT)
predictions = [Prediction((b, head.predicate, head.object), [description]) for b in bindings]
return predictions
def dump_predictions_map(per_var_predictions, out_filepath, triple_format=True, topk=-1, with_weight=True,
with_description=False, quality='x_coverage'):
"""
Writes the predictions to two files, the first is human readable and the other with .parsable extension that can be
parsed in python.
:param per_var_predictions:
:param out_filepath:
:param triple_format:
:param topk:
:param with_weight:
:param with_description:
:return:
"""
out_file_parsable = out_filepath + '.parsable'
out_filepath_with_type = out_filepath + ('.%s' % quality if len(quality) > 0 else '')
with open(out_filepath_with_type, 'w') as out_file:
for var, predictions in per_var_predictions.items():
if topk > 0:
predictions = predictions[:topk]
for p in predictions:
if triple_format:
# I only output normalized_coverage
out_str = n3_repr(p.triple) + ('\t%f' % p.get_quality(quality) if with_weight else '') + (
'\t%s' % p.source_description if with_description else '')
else:
out_str = str(p)
out_file.write(out_str)
out_file.write('\n')
with open(out_file_parsable + ('.%s' % quality if len(quality) > 0 else ''), 'w') as out_file:
out_file.write('\n'.join(
map(str, chain.from_iterable(map(lambda l: l[:topk] if topk > 0 else l, per_var_predictions.values())))))
return out_filepath_with_type
if __name__ == '__main__':
target_entities=tes.load_from_file('/scratch/GW/pool0/gadelrab/ExDEC/data/yago/yago_art_3_4k.tsv')
vos_executer = EndPointKGQueryInterfaceExtended('http://halimede:8890/sparql',
['http://yago-expr.org', 'http://yago-expr.org.types'],
labels_identifier='http://yago-expr.org.labels')
explainer=PathBasedClustersExplainerExtended(vos_executer, language_bias={'max_length': 4, 'structure': ExplanationStructure.TREE})
explans=explainer.explain(target_entities,
output_file='/scratch/GW/pool0/gadelrab/ExDEC/tmp/explanations_tree.txt')
ded = SparqlBasedDeductionEngineExtended(vos_executer)
per_var_predictions = ded.infer(explans, target_entities,
output_filepath='/scratch/GW/pool0/gadelrab/ExDEC/tmp/predictions_tree.tsv')
logger.info("Total variables with predictions subjects: %i", len(per_var_predictions))
| [
1,
9995,
13,
4013,
3883,
3743,
278,
5751,
29899,
6707,
27262,
313,
7491,
6707,
29918,
29881,
6085,
428,
6012,
29897,
13,
15945,
29908,
13,
5215,
4256,
8504,
13,
3166,
16250,
1053,
2322,
8977,
13,
3166,
4256,
8504,
1053,
9704,
13,
13,
3166,
5566,
329,
29889,
735,
9018,
800,
29918,
1195,
292,
29889,
2783,
699,
1980,
1053,
16766,
29918,
735,
9018,
800,
29918,
517,
29918,
1445,
13,
3166,
5566,
329,
29889,
735,
9018,
800,
29918,
1195,
292,
29889,
2783,
699,
1980,
29918,
1482,
1053,
12953,
29906,
29892,
2180,
290,
29892,
2254,
29918,
3166,
29918,
1445,
13,
3166,
5566,
329,
29889,
735,
9018,
800,
29918,
1195,
292,
29889,
4548,
433,
2827,
29918,
996,
1475,
29918,
1062,
2760,
1053,
10802,
29933,
1463,
6821,
504,
414,
9544,
433,
4983,
5647,
2760,
13,
3166,
5566,
329,
29889,
735,
9018,
800,
29918,
1195,
292,
29889,
12857,
29918,
1195,
261,
29889,
8216,
29918,
1195,
261,
29918,
1062,
2760,
1053,
12953,
29924,
4983,
5647,
2760,
29892,
1222,
9018,
362,
5015,
12425,
13,
3166,
5566,
329,
29889,
9415,
29889,
9415,
29918,
1972,
29918,
13248,
29918,
1062,
2760,
1053,
2796,
5228,
29968,
29954,
3010,
10448,
5647,
2760,
29892,
476,
29954,
3010,
10448,
5647,
2760,
13,
3166,
5566,
329,
29889,
9415,
29889,
9415,
29918,
2248,
292,
1053,
11374,
261,
13,
3166,
5566,
329,
29889,
9415,
29889,
13239,
29889,
1272,
29918,
689,
1218,
1053,
302,
29941,
29918,
276,
558,
13,
3166,
5566,
329,
29889,
13239,
29889,
21027,
1053,
17927,
13,
3166,
5566,
329,
29889,
9415,
29889,
13239,
29889,
26570,
1053,
5012,
29943,
29965,
1964,
29911,
29918,
25951,
29990,
29918,
1525,
29931,
8098,
13,
3166,
5566,
329,
29889,
695,
504,
3241,
1053,
3646,
29918,
296,
1907,
408,
260,
267,
13,
13,
13,
1990,
21099,
2463,
29901,
13,
1678,
9995,
13,
1678,
530,
1203,
304,
2755,
278,
18988,
310,
278,
6865,
13,
13,
1678,
584,
440,
279,
21954,
29901,
278,
25383,
21954,
13,
1678,
584,
440,
279,
599,
29918,
29879,
2863,
29901,
599,
6865,
393,
25383,
278,
1021,
21954,
13,
1678,
9995,
13,
13,
1678,
396,
822,
4770,
2344,
12035,
1311,
29892,
21954,
29901,
18761,
29892,
2752,
29918,
8216,
29922,
9868,
3285,
599,
29918,
29879,
2863,
29922,
8516,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
21954,
29922,
8516,
29892,
8974,
29922,
8516,
1125,
13,
4706,
1583,
29889,
3626,
552,
353,
21954,
13,
4706,
396,
1583,
29889,
4993,
29918,
8216,
353,
2752,
29918,
8216,
29888,
13,
4706,
1583,
29889,
497,
29918,
29879,
2863,
353,
8974,
565,
8974,
1683,
1051,
580,
29871,
396,
8974,
565,
8974,
1683,
426,
4993,
29918,
8216,
29913,
13,
13,
1678,
822,
679,
29918,
16009,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
3626,
552,
29961,
29900,
29962,
13,
13,
1678,
822,
679,
29918,
3318,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
3626,
552,
29961,
29906,
29962,
13,
13,
1678,
822,
679,
29918,
29567,
29898,
1311,
29892,
5645,
2433,
29916,
29918,
11911,
482,
742,
1158,
29922,
3317,
1125,
13,
13,
4706,
396,
736,
1583,
29889,
4993,
29918,
8216,
29889,
657,
29918,
29567,
29898,
26658,
29897,
13,
4706,
736,
1158,
4197,
4993,
29889,
657,
29918,
29567,
29898,
26658,
29897,
363,
2752,
297,
1583,
29889,
497,
29918,
29879,
2863,
2314,
13,
13,
1678,
822,
679,
29918,
3396,
29918,
8216,
29898,
1311,
29892,
5645,
2433,
29916,
29918,
11911,
482,
742,
1158,
29922,
3317,
1125,
13,
4706,
736,
1158,
29898,
1311,
29889,
497,
29918,
29879,
2863,
29892,
1820,
29922,
2892,
270,
29901,
270,
29889,
657,
29918,
29567,
29898,
26658,
876,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
851,
29898,
1311,
29889,
3626,
552,
29897,
718,
525,
9314,
29915,
718,
851,
29898,
1311,
29889,
657,
29918,
3396,
29918,
8216,
3101,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
11860,
29879,
29905,
29873,
1194,
29873,
29995,
29879,
24163,
29879,
5513,
1273,
313,
1311,
17255,
1990,
1649,
17255,
978,
1649,
29892,
2062,
29898,
1311,
29889,
3626,
552,
511,
2062,
29898,
1311,
29889,
497,
29918,
29879,
2863,
876,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
1125,
13,
4706,
736,
916,
29889,
3626,
552,
1275,
1583,
29889,
3626,
552,
13,
13,
1678,
822,
4770,
8568,
12035,
1311,
1125,
13,
4706,
736,
6608,
29898,
1311,
29889,
3626,
552,
29897,
13,
13,
13,
1990,
360,
6085,
428,
12412,
7295,
13,
1678,
9995,
13,
1678,
25513,
5751,
6707,
29918,
29881,
6085,
428,
29914,
262,
1659,
6012,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
19290,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
10115,
29898,
1311,
29892,
2342,
1980,
29892,
16732,
29922,
8824,
29892,
2246,
29895,
10457,
29896,
1125,
13,
4706,
1209,
13,
13,
13,
1990,
317,
862,
1519,
29933,
1463,
29928,
6085,
428,
12412,
5647,
2760,
29898,
29928,
6085,
428,
12412,
1125,
13,
1678,
9995,
13,
1678,
360,
6085,
428,
6012,
393,
29436,
278,
6865,
304,
805,
279,
1519,
322,
3974,
963,
975,
278,
476,
29954,
29889,
13,
13,
1678,
450,
5751,
29899,
6707,
29918,
29881,
6085,
428,
4893,
2562,
310,
1136,
17211,
1218,
2788,
27303,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12118,
29918,
1972,
29918,
13248,
29901,
476,
29954,
3010,
10448,
5647,
2760,
29892,
8220,
29922,
24405,
29965,
1964,
29911,
29918,
25951,
29990,
29918,
1525,
29931,
8098,
29892,
11029,
2433,
29916,
29918,
11911,
482,
742,
11029,
29918,
26193,
362,
29922,
3317,
1125,
13,
4706,
9995,
13,
4706,
584,
3207,
12118,
29918,
1972,
29918,
13248,
29901,
5067,
363,
278,
476,
29954,
29889,
13,
4706,
584,
3207,
8220,
29901,
278,
8220,
1304,
297,
278,
25383,
21954,
29871,
313,
25253,
29897,
13,
4706,
584,
3207,
11029,
29901,
12091,
11029,
5645,
363,
24034,
278,
27303,
313,
25253,
29897,
491,
2322,
13,
18884,
278,
29192,
23746,
310,
278,
6865,
338,
1304,
13,
4706,
584,
3207,
11029,
29918,
26193,
362,
29901,
278,
286,
621,
29881,
1304,
363,
11404,
1218,
278,
8158,
565,
2999,
6865,
3041,
414,
278,
1021,
2114,
13,
1669,
313,
25253,
29897,
491,
2322,
4236,
338,
1304,
29889,
13,
4706,
9995,
13,
4706,
2428,
29898,
29903,
862,
1519,
29933,
1463,
29928,
6085,
428,
12412,
5647,
2760,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
23445,
353,
8220,
13,
4706,
1583,
29889,
1972,
29918,
4258,
12811,
353,
12118,
29918,
1972,
29918,
13248,
13,
4706,
1583,
29889,
29567,
353,
11029,
13,
4706,
1583,
29889,
29567,
29918,
26193,
362,
353,
11029,
29918,
26193,
362,
13,
4706,
1583,
29889,
21134,
29918,
2248,
261,
29922,
3220,
261,
29898,
8899,
29922,
9415,
29918,
1972,
29918,
13248,
29889,
1853,
29892,
13,
462,
462,
1678,
16248,
29922,
9415,
29918,
1972,
29918,
13248,
29889,
29734,
29892,
13,
462,
462,
1678,
3983,
29922,
12118,
29918,
1972,
29918,
13248,
29889,
21134,
29918,
4262,
29892,
13,
462,
462,
1678,
15882,
29922,
9415,
29918,
1972,
29918,
13248,
29889,
21134,
29918,
25378,
29897,
13,
13,
1678,
822,
10115,
29898,
1311,
29892,
2342,
1980,
29918,
1761,
29892,
3646,
29918,
296,
1907,
29922,
8516,
29892,
1375,
29918,
29567,
29922,
29900,
29892,
2246,
29895,
10457,
29896,
29892,
1962,
29918,
1445,
2084,
29922,
8516,
29892,
13,
795,
2821,
29918,
5182,
29918,
296,
1907,
29922,
5574,
1125,
13,
4706,
9995,
13,
4706,
512,
571,
716,
17099,
363,
263,
6820,
731,
310,
2342,
1980,
13,
13,
4706,
584,
3207,
2342,
1980,
29918,
1761,
29901,
1051,
310,
3902,
424,
1080,
29914,
2783,
699,
1980,
6865,
13,
4706,
584,
3207,
3646,
29918,
296,
1907,
29901,
16212,
322,
1009,
11073,
363,
607,
27303,
526,
5759,
13,
4706,
584,
3207,
1375,
29918,
29567,
29901,
9212,
11404,
630,
11029,
363,
278,
27303,
13,
4706,
584,
3207,
2246,
29895,
29901,
413,
334,
5721,
5562,
29930,
9939,
11029,
27303,
639,
7855,
29892,
13,
4706,
584,
3207,
1962,
29918,
1445,
2084,
29901,
27303,
1962,
934,
29889,
13,
4706,
584,
3207,
2821,
29918,
5182,
29918,
296,
1907,
29901,
2821,
27541,
3646,
16212,
1156,
2309,
27262,
13,
4706,
584,
2457,
29901,
8600,
310,
25383,
7855,
29899,
695,
504,
414,
3566,
1860,
13,
4706,
9995,
13,
4706,
565,
338,
8758,
29898,
2783,
699,
1980,
29918,
1761,
29892,
8977,
1125,
13,
9651,
2342,
1980,
29918,
1761,
29922,
1761,
29898,
1524,
8504,
29889,
14153,
29889,
3166,
29918,
1524,
519,
29898,
2783,
699,
1980,
29918,
1761,
29889,
5975,
22130,
13,
13,
4706,
565,
3646,
29918,
296,
1907,
29901,
13,
9651,
1583,
29889,
21134,
29918,
2248,
261,
29889,
2248,
29918,
3626,
2701,
29898,
5182,
29918,
296,
1907,
29897,
13,
9651,
1583,
29889,
23445,
29922,
5182,
29918,
296,
1907,
29889,
657,
29918,
23445,
580,
13,
13,
4706,
27303,
353,
1051,
29898,
1958,
29898,
1311,
3032,
262,
571,
29918,
14369,
29892,
2342,
1980,
29918,
1761,
876,
13,
13,
4706,
639,
29918,
10041,
29918,
27711,
1080,
353,
1583,
29889,
535,
2929,
333,
403,
29898,
27711,
1080,
29897,
13,
13,
4706,
639,
29918,
10041,
29918,
27711,
1080,
353,
1583,
3032,
14634,
29918,
392,
29918,
6605,
29918,
7582,
29898,
546,
29918,
10041,
29918,
27711,
1080,
29892,
1375,
29918,
29567,
29892,
2246,
29895,
29922,
3332,
29895,
29897,
13,
13,
4706,
565,
1962,
29918,
1445,
2084,
29901,
13,
9651,
16766,
29918,
27711,
1080,
29918,
1958,
29898,
546,
29918,
10041,
29918,
27711,
1080,
29892,
1962,
29918,
1445,
2084,
29892,
21954,
29918,
4830,
29922,
5574,
29892,
2246,
29895,
29922,
3332,
29895,
29892,
411,
29918,
7915,
29922,
5574,
29892,
13,
462,
462,
411,
29918,
8216,
29922,
8824,
29892,
11029,
29922,
1311,
29889,
29567,
29897,
13,
13,
4706,
565,
3646,
29918,
296,
1907,
322,
2821,
29918,
5182,
29918,
296,
1907,
29901,
13,
9651,
1583,
29889,
21134,
29918,
2248,
261,
29889,
8865,
580,
13,
13,
4706,
736,
639,
29918,
10041,
29918,
27711,
1080,
13,
13,
1678,
822,
1136,
17211,
403,
29898,
1311,
29892,
27303,
1125,
13,
4706,
9995,
13,
4706,
422,
26062,
27303,
515,
1422,
6865,
13,
13,
4706,
584,
3207,
27303,
29901,
1051,
310,
5759,
27303,
13,
4706,
584,
2457,
29901,
12420,
2323,
18988,
411,
3196,
8974,
363,
7126,
27303,
13,
4706,
584,
29878,
1853,
29901,
9657,
13,
4706,
9995,
13,
13,
4706,
396,
639,
29918,
1707,
29918,
27711,
1080,
353,
2322,
8977,
29898,
2892,
29901,
2322,
8977,
29898,
1761,
876,
13,
4706,
396,
363,
282,
297,
9704,
29889,
3166,
29918,
1524,
519,
29898,
27711,
1080,
1125,
13,
4706,
396,
268,
639,
29918,
1707,
29918,
27711,
1080,
29961,
29886,
29889,
657,
29918,
16009,
580,
3816,
29886,
29889,
657,
29918,
3318,
580,
1822,
4397,
29898,
29886,
29897,
13,
13,
4706,
639,
29918,
10041,
29918,
27711,
1080,
353,
2322,
8977,
29898,
2892,
29901,
2322,
8977,
29898,
23084,
2463,
876,
13,
4706,
363,
282,
297,
1051,
29898,
14153,
29889,
3166,
29918,
1524,
519,
29898,
27711,
1080,
22164,
13,
9651,
1136,
29918,
11965,
353,
639,
29918,
10041,
29918,
27711,
1080,
29961,
29886,
29889,
657,
29918,
16009,
580,
3816,
29886,
29889,
657,
29918,
3318,
580,
29962,
13,
9651,
1136,
29918,
11965,
29889,
3626,
552,
353,
282,
29889,
3626,
552,
13,
9651,
1136,
29918,
11965,
29889,
497,
29918,
29879,
2863,
4619,
282,
29889,
497,
29918,
29879,
2863,
13,
13,
4706,
736,
639,
29918,
10041,
29918,
27711,
1080,
13,
13,
1678,
822,
903,
14634,
29918,
392,
29918,
6605,
29918,
7582,
29898,
1311,
29892,
639,
29918,
10041,
29918,
11965,
2463,
29892,
16897,
29922,
29900,
29892,
2246,
29895,
10457,
29896,
1125,
13,
4706,
9995,
13,
4706,
4702,
479,
278,
278,
10115,
1127,
17099,
297,
1206,
310,
13303,
4450,
293,
1078,
13,
13,
4706,
584,
3207,
639,
29918,
10041,
29918,
11965,
2463,
29901,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
13,
4706,
822,
11029,
29918,
5696,
29898,
29886,
1125,
13,
9651,
736,
282,
29889,
657,
29918,
29567,
29898,
1311,
29889,
29567,
29892,
1583,
29889,
29567,
29918,
26193,
362,
29897,
13,
13,
4706,
639,
29918,
10041,
29918,
11965,
2463,
29918,
4572,
287,
353,
2322,
8977,
29898,
1761,
29897,
13,
4706,
363,
1014,
29892,
639,
29918,
5415,
29918,
27711,
1080,
297,
639,
29918,
10041,
29918,
11965,
2463,
29889,
7076,
7295,
13,
9651,
396,
1596,
4197,
29898,
29895,
29892,
282,
29889,
3626,
552,
29961,
29906,
1402,
3855,
29874,
352,
537,
29918,
5696,
29898,
29886,
876,
363,
413,
29892,
282,
297,
639,
29918,
5415,
29918,
27711,
1080,
29889,
7076,
580,
2314,
13,
9651,
19412,
29918,
27711,
1080,
353,
1051,
29898,
13,
18884,
4175,
29898,
2892,
282,
29901,
11029,
29918,
5696,
29898,
29886,
29897,
1405,
16897,
29892,
1051,
29898,
546,
29918,
5415,
29918,
27711,
1080,
29889,
5975,
580,
4961,
13,
13,
9651,
19412,
29918,
27711,
1080,
29889,
6605,
29898,
1989,
29922,
29567,
29918,
5696,
29892,
11837,
29922,
5574,
29897,
13,
13,
9651,
3160,
353,
2246,
29895,
565,
2246,
29895,
1405,
29871,
29900,
1683,
7431,
29898,
1050,
3192,
29918,
27711,
1080,
29897,
13,
9651,
639,
29918,
10041,
29918,
11965,
2463,
29918,
4572,
287,
29961,
1491,
29962,
353,
19412,
29918,
27711,
1080,
7503,
2856,
29962,
13,
13,
4706,
736,
639,
29918,
10041,
29918,
11965,
2463,
29918,
4572,
287,
13,
13,
1678,
822,
903,
262,
571,
29918,
14369,
29898,
1311,
29892,
6139,
29901,
12953,
29906,
1125,
13,
4706,
9995,
13,
4706,
512,
571,
716,
17099,
363,
278,
2183,
12953,
13,
4706,
584,
3207,
6139,
29901,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
7868,
886,
353,
1583,
29889,
1972,
29918,
4258,
12811,
29889,
657,
29918,
25699,
29918,
5355,
886,
29898,
8216,
29892,
13,
462,
462,
462,
795,
24345,
29918,
11037,
29922,
9868,
29906,
29898,
2587,
11759,
4178,
290,
877,
29973,
29916,
742,
13,
462,
462,
462,
462,
462,
462,
3986,
1583,
29889,
23445,
29892,
13,
462,
462,
462,
462,
462,
462,
3986,
525,
29973,
29920,
1495,
12622,
13,
4706,
2343,
353,
6139,
29889,
2813,
13,
13,
4706,
396,
871,
11286,
282,
10780,
29916,
29892,
6007,
1254,
13566,
29897,
13,
4706,
27303,
353,
518,
23084,
2463,
3552,
29890,
29892,
2343,
29889,
11965,
9593,
29892,
2343,
29889,
3318,
511,
518,
8216,
2314,
363,
289,
297,
7868,
886,
29962,
13,
13,
4706,
736,
27303,
13,
13,
13,
1753,
16766,
29918,
27711,
1080,
29918,
1958,
29898,
546,
29918,
1707,
29918,
27711,
1080,
29892,
714,
29918,
1445,
2084,
29892,
21954,
29918,
4830,
29922,
5574,
29892,
2246,
29895,
10457,
29896,
29892,
411,
29918,
7915,
29922,
5574,
29892,
13,
462,
308,
411,
29918,
8216,
29922,
8824,
29892,
11029,
2433,
29916,
29918,
11911,
482,
29374,
13,
1678,
9995,
13,
1678,
16849,
267,
278,
27303,
304,
1023,
2066,
29892,
278,
937,
338,
5199,
19909,
322,
278,
916,
411,
869,
862,
29879,
519,
6081,
393,
508,
367,
13,
1678,
21213,
297,
3017,
29889,
13,
1678,
584,
3207,
639,
29918,
1707,
29918,
27711,
1080,
29901,
13,
1678,
584,
3207,
714,
29918,
1445,
2084,
29901,
13,
1678,
584,
3207,
21954,
29918,
4830,
29901,
13,
1678,
584,
3207,
2246,
29895,
29901,
13,
1678,
584,
3207,
411,
29918,
7915,
29901,
13,
1678,
584,
3207,
411,
29918,
8216,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
714,
29918,
1445,
29918,
862,
29879,
519,
353,
714,
29918,
1445,
2084,
718,
15300,
862,
29879,
519,
29915,
13,
1678,
714,
29918,
1445,
2084,
29918,
2541,
29918,
1853,
353,
714,
29918,
1445,
2084,
718,
313,
4286,
29995,
29879,
29915,
1273,
11029,
565,
7431,
29898,
29567,
29897,
1405,
29871,
29900,
1683,
27255,
13,
13,
1678,
411,
1722,
29898,
449,
29918,
1445,
2084,
29918,
2541,
29918,
1853,
29892,
525,
29893,
1495,
408,
714,
29918,
1445,
29901,
13,
4706,
363,
722,
29892,
27303,
297,
639,
29918,
1707,
29918,
27711,
1080,
29889,
7076,
7295,
13,
9651,
565,
2246,
29895,
1405,
29871,
29900,
29901,
13,
18884,
27303,
353,
27303,
7503,
3332,
29895,
29962,
13,
9651,
363,
282,
297,
27303,
29901,
13,
18884,
565,
21954,
29918,
4830,
29901,
13,
462,
1678,
396,
306,
871,
1962,
4226,
1891,
29918,
11911,
482,
13,
462,
1678,
714,
29918,
710,
353,
302,
29941,
29918,
276,
558,
29898,
29886,
29889,
3626,
552,
29897,
718,
6702,
29905,
29873,
29995,
29888,
29915,
1273,
282,
29889,
657,
29918,
29567,
29898,
29567,
29897,
565,
411,
29918,
7915,
1683,
27255,
718,
313,
13,
462,
4706,
11297,
29873,
29995,
29879,
29915,
1273,
282,
29889,
4993,
29918,
8216,
565,
411,
29918,
8216,
1683,
27255,
13,
18884,
1683,
29901,
13,
462,
1678,
714,
29918,
710,
353,
851,
29898,
29886,
29897,
13,
13,
18884,
714,
29918,
1445,
29889,
3539,
29898,
449,
29918,
710,
29897,
13,
18884,
714,
29918,
1445,
29889,
3539,
28909,
29876,
1495,
13,
13,
1678,
411,
1722,
29898,
449,
29918,
1445,
29918,
862,
29879,
519,
718,
313,
4286,
29995,
29879,
29915,
1273,
11029,
565,
7431,
29898,
29567,
29897,
1405,
29871,
29900,
1683,
525,
5477,
525,
29893,
1495,
408,
714,
29918,
1445,
29901,
13,
4706,
714,
29918,
1445,
29889,
3539,
28909,
29876,
4286,
7122,
29898,
13,
9651,
2910,
29898,
710,
29892,
9704,
29889,
3166,
29918,
1524,
519,
29898,
1958,
29898,
2892,
301,
29901,
301,
7503,
3332,
29895,
29962,
565,
2246,
29895,
1405,
29871,
29900,
1683,
301,
29892,
639,
29918,
1707,
29918,
27711,
1080,
29889,
5975,
22130,
4961,
13,
13,
1678,
736,
714,
29918,
1445,
2084,
29918,
2541,
29918,
1853,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
3646,
29918,
296,
1907,
29922,
2167,
29889,
1359,
29918,
3166,
29918,
1445,
11219,
10526,
905,
29914,
29954,
29956,
29914,
10109,
29900,
29914,
29887,
11165,
4201,
29914,
1252,
2287,
29907,
29914,
1272,
29914,
29891,
4425,
29914,
29891,
4425,
29918,
442,
29918,
29941,
29918,
29946,
29895,
29889,
1372,
29894,
1495,
13,
1678,
325,
359,
29918,
4258,
12811,
353,
2796,
5228,
29968,
29954,
3010,
10448,
5647,
2760,
877,
1124,
597,
4077,
326,
2742,
29901,
29947,
29947,
29929,
29900,
29914,
29879,
862,
1519,
742,
13,
462,
462,
462,
1678,
6024,
1124,
597,
29891,
4425,
29899,
13338,
29889,
990,
742,
525,
1124,
597,
29891,
4425,
29899,
13338,
29889,
990,
29889,
8768,
7464,
13,
462,
462,
462,
1678,
11073,
29918,
25378,
2433,
1124,
597,
29891,
4425,
29899,
13338,
29889,
990,
29889,
21134,
1495,
13,
13,
1678,
3641,
4983,
29922,
2605,
29933,
1463,
6821,
504,
414,
9544,
433,
4983,
5647,
2760,
29898,
23517,
29918,
4258,
12811,
29892,
4086,
29918,
29890,
3173,
3790,
29915,
3317,
29918,
2848,
2396,
29871,
29946,
29892,
525,
23905,
2396,
1222,
9018,
362,
5015,
12425,
29889,
29911,
21661,
1800,
13,
1678,
3902,
550,
29922,
4548,
433,
4983,
29889,
4548,
7420,
29898,
5182,
29918,
296,
1907,
29892,
13,
462,
1669,
1962,
29918,
1445,
2433,
29914,
10526,
905,
29914,
29954,
29956,
29914,
10109,
29900,
29914,
29887,
11165,
4201,
29914,
1252,
2287,
29907,
29914,
7050,
29914,
735,
9018,
800,
29918,
8336,
29889,
3945,
1495,
13,
13,
1678,
28262,
353,
317,
862,
1519,
29933,
1463,
29928,
6085,
428,
12412,
5647,
2760,
29898,
23517,
29918,
4258,
12811,
29897,
13,
1678,
639,
29918,
1707,
29918,
27711,
1080,
353,
28262,
29889,
262,
571,
29898,
24516,
550,
29892,
3646,
29918,
296,
1907,
29892,
13,
462,
462,
1678,
1962,
29918,
1445,
2084,
2433,
29914,
10526,
905,
29914,
29954,
29956,
29914,
10109,
29900,
29914,
29887,
11165,
4201,
29914,
1252,
2287,
29907,
29914,
7050,
29914,
27711,
1080,
29918,
8336,
29889,
1372,
29894,
1495,
13,
13,
1678,
17927,
29889,
3888,
703,
11536,
3651,
411,
27303,
17800,
29901,
1273,
29875,
613,
7431,
29898,
546,
29918,
1707,
29918,
27711,
1080,
876,
13,
13,
2
] |
measurement/tests.py | sigurdsa/angelika-api | 2 | 187703 | <filename>measurement/tests.py
from test.testcase import AngelikaAPITestCase
from patient.models import Patient
from measurement.models import Measurement
from threshold_value.models import ThresholdValue
from alarm.models import Alarm
import time
class PostMeasurementTests(AngelikaAPITestCase):
def create_and_authenticate_hub(self):
hub_user = self.create_hub('hub1')
self.patient = Patient.objects.get(user__username='larsoverhaug')
self.patient.hub = hub_user
self.patient.save()
self.force_authenticate('hub1')
def test_post_ignored_measurements(self):
self.create_and_authenticate_hub()
data = {
"Measurements": [
{
"date": 1414972800,
"type": "distance",
"unit": "m",
"value": 962.26
},
{
"date": 1414972800,
"type": "calories",
"unit": "kcal",
"value": 48.92
},
{
"date": 1414972800,
"type": "steps",
"unit": "steps",
"value": 1067
}
],
"Observation": {
"hub_id": "hub1"
}
}
self.assertEqual(Measurement.objects.count(), 0) # Nothing is created yet
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(response.data["num_measurements_created"], 1) # One object created
self.assertEqual(Measurement.objects.count(), 1) # One object created
self.assertAlmostEqual(Measurement.objects.first().value, 1067.0) # Correct no of steps
self.assertEqual(Measurement.objects.first().patient, self.patient) # Correct patient
self.assertEqual(Alarm.objects.count(), 0)
def test_post_when_not_authenticated(self):
response = self.client.post('/post-measurements/', {}, 'json')
self.assertEqual(response.status_code, 401)
def test_post_bad_hub_id(self):
self.create_and_authenticate_hub()
data = {
"Measurements": [
{
"date": 1414972800,
"type": "steps",
"unit": "steps",
"value": 1067
}
],
"Observation": {
"hub_id": "dsfkjhdsfkjhdsf"
}
}
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 400)
def test_post_abnormal_low_measurements(self):
self.create_and_authenticate_hub()
ThresholdValue.objects.create(
value=49,
patient=self.patient,
type='P',
is_upper_threshold=False,
)
ThresholdValue.objects.create(
value=165,
patient=self.patient,
type='P',
is_upper_threshold=True,
)
measurement_time = int(time.time()) + 10000
data = {
"Measurements": [
{
"date": measurement_time,
"type": "heart_rate",
"unit": "bpm",
"value": 42
}
],
"Observation": {
"hub_id": "hub1"
}
}
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 1)
self.assertEqual(Alarm.objects.count(), 1)
self.assertEqual(Alarm.objects.first().measurement.pk, Measurement.objects.first().pk)
self.assertEqual(Alarm.objects.first().reason, False)
def test_post_abnormal_high_measurement(self):
self.create_and_authenticate_hub()
ThresholdValue.objects.create(
value=49,
patient=self.patient,
type='P',
is_upper_threshold=False,
)
ThresholdValue.objects.create(
value=165,
patient=self.patient,
type='P',
is_upper_threshold=True,
)
measurement_time = int(time.time()) + 10000
data = {
"Measurements": [
{
"date": measurement_time,
"type": "heart_rate",
"unit": "bpm",
"value": 180
}
],
"Observation": {
"hub_id": "hub1"
}
}
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 1)
self.assertEqual(Alarm.objects.count(), 1)
self.assertEqual(Alarm.objects.first().measurement.pk, Measurement.objects.first().pk)
self.assertEqual(Alarm.objects.first().reason, True)
def test_post_high_o2_measurement(self):
self.create_and_authenticate_hub()
ThresholdValue.objects.create(
value=60,
patient=self.patient,
type='O',
is_upper_threshold=False,
)
ThresholdValue.objects.create(
value=85,
patient=self.patient,
type='O',
is_upper_threshold=True,
)
measurement_time = int(time.time()) + 10000
data = {
"Measurements": [
{
"date": measurement_time,
"type": "spo2",
"unit": "percent",
"value": 89
}
],
"Observation": {
"hub_id": "hub1"
}
}
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 1)
self.assertEqual(Alarm.objects.count(), 0) # no alarm is created for a "too high" O2 value
def test_post_abnormal_low_measurements_repeatedly(self):
self.create_and_authenticate_hub()
ThresholdValue.objects.create(
value=49,
patient=self.patient,
type='P',
is_upper_threshold=False,
)
ThresholdValue.objects.create(
value=165,
patient=self.patient,
type='P',
is_upper_threshold=True,
)
measurement_time = int(time.time()) + 10000
data = {
"Measurements": [
{
"date": measurement_time,
"type": "heart_rate",
"unit": "bpm",
"value": 42
}
],
"Observation": {
"hub_id": "hub1"
}
}
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 1)
self.assertEqual(Alarm.objects.count(), 1)
data = {
"Measurements": [
{
"date": measurement_time + 500,
"type": "heart_rate",
"unit": "bpm",
"value": 41
}
],
"Observation": {
"hub_id": "hub1"
}
}
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 2)
self.assertEqual(Alarm.objects.count(), 1) # no new alarm has been created
def test_post_abnormal_low_measurements_multiple_patients(self):
self.create_and_authenticate_hub()
hub_user2 = self.create_hub('hub2')
kristin = self.create_patient('kristin', '<NAME>', 'Taraldsen', '08105534879')
kristin.hub = hub_user2
kristin.save()
ThresholdValue.objects.create(
value=49,
patient=self.patient,
type='P',
is_upper_threshold=False,
)
ThresholdValue.objects.create(
value=165,
patient=self.patient,
type='P',
is_upper_threshold=True,
)
ThresholdValue.objects.create(
value=46,
patient=kristin,
type='P',
is_upper_threshold=False,
)
ThresholdValue.objects.create(
value=160,
patient=kristin,
type='P',
is_upper_threshold=True,
)
measurement_time = int(time.time()) + 10000
data1 = {
"Measurements": [
{
"date": measurement_time,
"type": "heart_rate",
"unit": "bpm",
"value": 42
}
],
"Observation": {
"hub_id": "hub1"
}
}
response = self.client.post('/post-measurements/', data1, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 1)
self.assertEqual(Alarm.objects.count(), 1)
self.force_authenticate('hub2')
data2 = {
"Measurements": [
{
"date": measurement_time + 50,
"type": "heart_rate",
"unit": "bpm",
"value": 45
}
],
"Observation": {
"hub_id": "hub2"
}
}
response = self.client.post('/post-measurements/', data2, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 2)
self.assertEqual(Alarm.objects.count(), 2) # another alarm has been created
def test_update_daily_activity_measurement(self):
self.create_and_authenticate_hub()
measurement_time = int(time.time())
data = {
"Measurements": [
{
"date": measurement_time,
"type": "steps",
"unit": "steps",
"value": 656
}
],
"Observation": {
"hub_id": "hub1"
}
}
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 201) # Created
self.assertEqual(Measurement.objects.count(), 1)
data['Measurements'][0]['value'] = 890
response = self.client.post('/post-measurements/', data, 'json')
self.assertEqual(response.status_code, 200) # OK
self.assertEqual(Measurement.objects.count(), 1)
self.assertEqual(Measurement.objects.first().value, 890)
| [
1,
529,
9507,
29958,
26658,
358,
29914,
21150,
29889,
2272,
13,
3166,
1243,
29889,
1688,
4878,
1053,
17323,
4106,
3301,
1806,
342,
8259,
13,
3166,
16500,
29889,
9794,
1053,
4121,
993,
13,
3166,
20039,
29889,
9794,
1053,
2191,
3745,
358,
13,
3166,
16897,
29918,
1767,
29889,
9794,
1053,
498,
12268,
1917,
13,
3166,
21200,
29889,
9794,
1053,
838,
2817,
13,
5215,
931,
13,
13,
13,
1990,
4918,
6816,
3745,
358,
24376,
29898,
9928,
295,
4106,
3301,
1806,
342,
8259,
1125,
13,
1678,
822,
1653,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
29898,
1311,
1125,
13,
4706,
19766,
29918,
1792,
353,
1583,
29889,
3258,
29918,
29882,
431,
877,
29882,
431,
29896,
1495,
13,
4706,
1583,
29889,
5031,
993,
353,
4121,
993,
29889,
12650,
29889,
657,
29898,
1792,
1649,
6786,
2433,
4675,
578,
369,
29882,
2987,
1495,
13,
4706,
1583,
29889,
5031,
993,
29889,
29882,
431,
353,
19766,
29918,
1792,
13,
4706,
1583,
29889,
5031,
993,
29889,
7620,
580,
13,
4706,
1583,
29889,
10118,
29918,
27218,
403,
877,
29882,
431,
29896,
1495,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
647,
4395,
29918,
26658,
1860,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
29871,
29896,
29946,
29896,
29946,
29929,
29955,
29906,
29947,
29900,
29900,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
19244,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29885,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29929,
29953,
29906,
29889,
29906,
29953,
13,
18884,
2981,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
29871,
29896,
29946,
29896,
29946,
29929,
29955,
29906,
29947,
29900,
29900,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
1052,
3842,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29895,
1052,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29946,
29947,
29889,
29929,
29906,
13,
18884,
2981,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
29871,
29896,
29946,
29896,
29946,
29929,
29955,
29906,
29947,
29900,
29900,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
24530,
613,
13,
462,
1678,
376,
5441,
1115,
376,
24530,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29896,
29900,
29953,
29955,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29900,
29897,
29871,
396,
9531,
338,
2825,
3447,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
1272,
3366,
1949,
29918,
26658,
1860,
29918,
11600,
12436,
29871,
29896,
29897,
29871,
396,
3118,
1203,
2825,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
29871,
396,
3118,
1203,
2825,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
4102,
2141,
1767,
29892,
29871,
29896,
29900,
29953,
29955,
29889,
29900,
29897,
29871,
396,
28518,
694,
310,
6576,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
4102,
2141,
5031,
993,
29892,
1583,
29889,
5031,
993,
29897,
29871,
396,
28518,
16500,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
8256,
29918,
1333,
29918,
27218,
630,
29898,
1311,
1125,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
24335,
525,
3126,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29946,
29900,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
12313,
29918,
29882,
431,
29918,
333,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
29871,
29896,
29946,
29896,
29946,
29929,
29955,
29906,
29947,
29900,
29900,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
24530,
613,
13,
462,
1678,
376,
5441,
1115,
376,
24530,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29896,
29900,
29953,
29955,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29881,
4668,
29895,
29926,
16440,
4668,
29895,
29926,
16440,
4668,
29908,
13,
9651,
500,
13,
4706,
500,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29946,
29900,
29900,
29897,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
370,
8945,
29918,
677,
29918,
26658,
1860,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29946,
29929,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
8824,
29892,
13,
4706,
1723,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29896,
29953,
29945,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
5574,
29892,
13,
4706,
1723,
13,
13,
4706,
20039,
29918,
2230,
353,
938,
29898,
2230,
29889,
2230,
3101,
718,
29871,
29896,
29900,
29900,
29900,
29900,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
23057,
29918,
10492,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29890,
3358,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29946,
29906,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
4102,
2141,
26658,
358,
29889,
20571,
29892,
2191,
3745,
358,
29889,
12650,
29889,
4102,
2141,
20571,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
4102,
2141,
23147,
29892,
7700,
29897,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
370,
8945,
29918,
9812,
29918,
26658,
358,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29946,
29929,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
8824,
29892,
13,
4706,
1723,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29896,
29953,
29945,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
5574,
29892,
13,
4706,
1723,
13,
13,
4706,
20039,
29918,
2230,
353,
938,
29898,
2230,
29889,
2230,
3101,
718,
29871,
29896,
29900,
29900,
29900,
29900,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
23057,
29918,
10492,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29890,
3358,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29896,
29947,
29900,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
4102,
2141,
26658,
358,
29889,
20571,
29892,
2191,
3745,
358,
29889,
12650,
29889,
4102,
2141,
20571,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
4102,
2141,
23147,
29892,
5852,
29897,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
9812,
29918,
29877,
29906,
29918,
26658,
358,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29953,
29900,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29949,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
8824,
29892,
13,
4706,
1723,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29947,
29945,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29949,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
5574,
29892,
13,
4706,
1723,
13,
13,
4706,
20039,
29918,
2230,
353,
938,
29898,
2230,
29889,
2230,
3101,
718,
29871,
29896,
29900,
29900,
29900,
29900,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
1028,
29877,
29906,
613,
13,
462,
1678,
376,
5441,
1115,
376,
25376,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29947,
29929,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29900,
29897,
29871,
396,
694,
21200,
338,
2825,
363,
263,
376,
517,
29877,
1880,
29908,
438,
29906,
995,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
370,
8945,
29918,
677,
29918,
26658,
1860,
29918,
276,
412,
630,
368,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29946,
29929,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
8824,
29892,
13,
4706,
1723,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29896,
29953,
29945,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
5574,
29892,
13,
4706,
1723,
13,
13,
4706,
20039,
29918,
2230,
353,
938,
29898,
2230,
29889,
2230,
3101,
718,
29871,
29896,
29900,
29900,
29900,
29900,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
23057,
29918,
10492,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29890,
3358,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29946,
29906,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
718,
29871,
29945,
29900,
29900,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
23057,
29918,
10492,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29890,
3358,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29946,
29896,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29906,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
29871,
396,
694,
716,
21200,
756,
1063,
2825,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
370,
8945,
29918,
677,
29918,
26658,
1860,
29918,
20787,
29918,
5031,
10070,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
13,
4706,
19766,
29918,
1792,
29906,
353,
1583,
29889,
3258,
29918,
29882,
431,
877,
29882,
431,
29906,
1495,
13,
4706,
413,
2021,
262,
353,
1583,
29889,
3258,
29918,
5031,
993,
877,
29895,
2021,
262,
742,
12801,
5813,
29958,
742,
525,
29911,
279,
2741,
4881,
742,
525,
29900,
29947,
29896,
29900,
29945,
29945,
29941,
29946,
29947,
29955,
29929,
1495,
13,
4706,
413,
2021,
262,
29889,
29882,
431,
353,
19766,
29918,
1792,
29906,
13,
4706,
413,
2021,
262,
29889,
7620,
580,
13,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29946,
29929,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
8824,
29892,
13,
4706,
1723,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29896,
29953,
29945,
29892,
13,
9651,
16500,
29922,
1311,
29889,
5031,
993,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
5574,
29892,
13,
4706,
1723,
13,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29946,
29953,
29892,
13,
9651,
16500,
29922,
29895,
2021,
262,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
8824,
29892,
13,
4706,
1723,
13,
4706,
498,
12268,
1917,
29889,
12650,
29889,
3258,
29898,
13,
9651,
995,
29922,
29896,
29953,
29900,
29892,
13,
9651,
16500,
29922,
29895,
2021,
262,
29892,
13,
9651,
1134,
2433,
29925,
742,
13,
9651,
338,
29918,
21064,
29918,
386,
12268,
29922,
5574,
29892,
13,
4706,
1723,
13,
13,
4706,
20039,
29918,
2230,
353,
938,
29898,
2230,
29889,
2230,
3101,
718,
29871,
29896,
29900,
29900,
29900,
29900,
13,
4706,
848,
29896,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
23057,
29918,
10492,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29890,
3358,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29946,
29906,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29896,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
13,
4706,
1583,
29889,
10118,
29918,
27218,
403,
877,
29882,
431,
29906,
1495,
13,
13,
4706,
848,
29906,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
718,
29871,
29945,
29900,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
23057,
29918,
10492,
613,
13,
462,
1678,
376,
5441,
1115,
376,
29890,
3358,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29946,
29945,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29906,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29906,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29906,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2499,
2817,
29889,
12650,
29889,
2798,
3285,
29871,
29906,
29897,
29871,
396,
1790,
21200,
756,
1063,
2825,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
29881,
8683,
29918,
10072,
29918,
26658,
358,
29898,
1311,
1125,
13,
4706,
1583,
29889,
3258,
29918,
392,
29918,
27218,
403,
29918,
29882,
431,
580,
13,
13,
4706,
20039,
29918,
2230,
353,
938,
29898,
2230,
29889,
2230,
3101,
13,
4706,
848,
353,
426,
13,
9651,
376,
6816,
3745,
1860,
1115,
518,
13,
18884,
426,
13,
462,
1678,
376,
1256,
1115,
20039,
29918,
2230,
29892,
13,
462,
1678,
376,
1853,
1115,
376,
24530,
613,
13,
462,
1678,
376,
5441,
1115,
376,
24530,
613,
13,
462,
1678,
376,
1767,
1115,
29871,
29953,
29945,
29953,
13,
18884,
500,
13,
9651,
21251,
13,
9651,
376,
6039,
2140,
362,
1115,
426,
13,
18884,
376,
29882,
431,
29918,
333,
1115,
376,
29882,
431,
29896,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29896,
29897,
29871,
396,
6760,
630,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
13,
4706,
848,
1839,
6816,
3745,
1860,
2033,
29961,
29900,
22322,
1767,
2033,
353,
29871,
29947,
29929,
29900,
13,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
11219,
2490,
29899,
26658,
1860,
29914,
742,
848,
29892,
525,
3126,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29900,
29897,
29871,
396,
9280,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
2798,
3285,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6816,
3745,
358,
29889,
12650,
29889,
4102,
2141,
1767,
29892,
29871,
29947,
29929,
29900,
29897,
13,
2
] |
setup.py | mattpatey/text2qrcode | 1 | 14854 | <reponame>mattpatey/text2qrcode
from setuptools import (
find_packages,
setup,
)
setup(
name="text2qrcode",
version="1.0-a1",
description="Render a QR code image from input text",
author="<NAME>",
packages=find_packages(),
install_requires=["qrcode", "pillow"],
entry_points={
"console_scripts": [
"t2qr=text2qrcode.main:main"
]
}
)
| [
1,
529,
276,
1112,
420,
29958,
29885,
1131,
29886,
403,
29891,
29914,
726,
29906,
29939,
29878,
401,
13,
3166,
731,
21245,
8789,
1053,
313,
13,
1678,
1284,
29918,
8318,
29892,
13,
1678,
6230,
29892,
13,
1678,
1723,
13,
13,
14669,
29898,
13,
1678,
1024,
543,
726,
29906,
29939,
29878,
401,
613,
13,
1678,
1873,
543,
29896,
29889,
29900,
29899,
29874,
29896,
613,
13,
1678,
6139,
543,
10716,
263,
660,
29934,
775,
1967,
515,
1881,
1426,
613,
13,
1678,
4148,
543,
29966,
5813,
28341,
13,
1678,
9741,
29922,
2886,
29918,
8318,
3285,
13,
1678,
2601,
29918,
276,
339,
2658,
29922,
3366,
29939,
29878,
401,
613,
376,
29886,
453,
340,
12436,
13,
1678,
6251,
29918,
9748,
3790,
13,
4706,
376,
11058,
29918,
16713,
1115,
518,
13,
9651,
376,
29873,
29906,
29939,
29878,
29922,
726,
29906,
29939,
29878,
401,
29889,
3396,
29901,
3396,
29908,
13,
4706,
4514,
13,
1678,
500,
13,
29897,
13,
2
] |
microsoft_auth/migrations/0002_fix_microsoft_id_length.py | etrimbymchd/django_microsoft_auth | 115 | 1611790 | # Generated by Django 2.1.7 on 2019-02-28 20:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("microsoft_auth", "0001_initial")]
operations = [
migrations.AlterField(
model_name="microsoftaccount",
name="microsoft_id",
field=models.CharField(
max_length=36, verbose_name="microsoft account id"
),
)
]
| [
1,
396,
3251,
630,
491,
15337,
29871,
29906,
29889,
29896,
29889,
29955,
373,
29871,
29906,
29900,
29896,
29929,
29899,
29900,
29906,
29899,
29906,
29947,
29871,
29906,
29900,
29901,
29941,
29900,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
703,
4994,
29918,
5150,
613,
376,
29900,
29900,
29900,
29896,
29918,
11228,
13531,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
543,
4994,
10149,
613,
13,
9651,
1024,
543,
4994,
29918,
333,
613,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
13,
18884,
4236,
29918,
2848,
29922,
29941,
29953,
29892,
26952,
29918,
978,
543,
4994,
3633,
1178,
29908,
13,
9651,
10353,
13,
4706,
1723,
13,
1678,
4514,
13,
2
] |
sqlmat/utils.py | haobtc/sqlmat | 0 | 7362 | from typing import Tuple, List, Optional
import json
import sys
import os
import shlex
import asyncio
import argparse
import logging
import tempfile
from urllib.parse import urlparse
logger = logging.getLogger(__name__)
def find_sqlmat_json() -> Optional[dict]:
json_path = os.getenv('SQLMAT_JSON_PATH')
if json_path:
with open(json_path) as f:
cfg = json.load(f)
return cfg
# iterate through the current dir up to the root dir "/" to find a
# .sqlmat.json
workdir = os.path.abspath(os.getcwd())
while workdir:
json_path = os.path.join(workdir, '.sqlmat.json')
if os.path.exists(json_path):
with open(json_path) as f:
cfg = json.load(f)
return cfg
parentdir = os.path.abspath(os.path.join(workdir, '..'))
if parentdir == workdir:
break
workdir = parentdir
logger.warning('fail to find .sqlmat.json')
return None
def find_dsn(prog: str, desc: str) -> Tuple[str, List[str]]:
parser = argparse.ArgumentParser(
prog=prog,
description=desc)
parser.add_argument('-d', '--dsn',
type=str,
help='postgresql dsn')
parser.add_argument('-g', '--db',
type=str,
default='default',
help='postgresql db instance defined in .sqlmat.json')
parser.add_argument('callee_args',
type=str,
nargs='*',
help='command line arguments of callee programs')
# from arguments
args = parser.parse_args()
if args.dsn:
return args.dsn, args.callee_args
# find dsn from ./.sqlmat.json
cfg = find_sqlmat_json()
if cfg:
dsn = cfg['databases'][args.db]['dsn']
assert isinstance(dsn, str)
return dsn, args.callee_args
# default dsn using username
user = os.getenv('USER', '')
default_dsn = f'postgres://{user}@127.0.0.1:5432/{args.db}'
logger.warning('no postgres dsn specified, use %s instead', default_dsn)
return default_dsn, args.callee_args
def joinargs(callee_args: List[str]) -> str:
if hasattr(shlex, 'join'):
return shlex.join(callee_args)
else:
return ' '.join(shlex.quote(a) for a in callee_args)
# run psql client
async def run_shell(dsn: str, callee_args: List[str]) -> None:
p = urlparse(dsn)
username = p.username or ''
password = p.password or ''
dbname = p.path[1:]
hostname = p.hostname
port = p.port or 5432
temp_pgpass = tempfile.NamedTemporaryFile(mode='w')
print(
'{}:{}:{}:{}:{}'.format(hostname, port, dbname, username, password),
file=temp_pgpass,
flush=True)
os.environ['PGPASSFILE'] = temp_pgpass.name
command = 'psql -h{} -p{} -U{} {} {}'.format(hostname, port, username, joinargs(callee_args), dbname)
proc = await asyncio.create_subprocess_shell(command)
await proc.communicate()
def cl_run_shell() -> None:
dsn, callee_args = find_dsn('sqlmat-shell', 'run psql client shell')
loop = asyncio.get_event_loop()
loop.run_until_complete(run_shell(dsn, callee_args))
# run dbdump
async def run_dbdump(dsn: str, callee_args: List[str]) -> None:
p = urlparse(dsn)
username = p.username or ''
password = p.password or ''
dbname = p.path[1:]
hostname = p.hostname
port = p.port or 5432
temp_pgpass = tempfile.NamedTemporaryFile(mode='w')
print(
'{}:{}:{}:{}:{}'.format(hostname, port, dbname, username, password),
file=temp_pgpass,
flush=True)
os.environ['PGPASSFILE'] = temp_pgpass.name
command = 'pg_dump -h{} -p{} -U{} {} {}'.format(hostname, port, username, joinargs(callee_args), dbname)
proc = await asyncio.create_subprocess_shell(command)
await proc.communicate()
def cl_run_dbdump() -> None:
dsn, callee_args = find_dsn('sqlmat-dump', 'dump database')
loop = asyncio.get_event_loop()
loop.run_until_complete(run_dbdump(dsn, callee_args))
# generate alembic migrations
def gen_migrate(dsn: str) -> None:
init_data = ALEMBIC_INIT.replace('{{dsn}}', dsn)
with open('alembic.ini', 'w') as f:
f.write(init_data)
def cl_gen_migrate() -> None:
dsn, callee_args = find_dsn('sqlmat-genmigrate', 'generate alembic migration')
gen_migrate(dsn)
print('Wrote alembic.ini')
ALEMBIC_INIT = '''\
# A generic, single database configuration.
[alembic]
# path to migration scripts
script_location = migrations
# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s
# timezone to use when rendering the date
# within the migration file as well as the filename.
# string value is passed to dateutil.tz.gettz()
# leave blank for localtime
# timezone =
# max length of characters to apply to the
# "slug" field
#truncate_slug_length = 40
# set to 'true' to run the environment during
# the 'revision' command, regardless of autogenerate
# revision_environment = false
# set to 'true' to allow .pyc and .pyo files without
# a source .py file to be detected as revisions in the
# versions/ directory
# sourceless = false
# version location specification; this defaults
# to migrations/versions. When using multiple version
# directories, initial revisions must be specified with --version-path
# version_locations = %(here)s/bar %(here)s/bat migrations/versions
# the output encoding used when revision files
# are written from script.py.mako
# output_encoding = utf-8
#sqlalchemy.url = driver://user:pass@localhost/dbname
sqlalchemy.url = {{dsn}}
# Logging configuration
[loggers]
keys = root,sqlalchemy,alembic
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
qualname =
[logger_sqlalchemy]
level = WARN
handlers =
qualname = sqlalchemy.engine
[logger_alembic]
level = INFO
handlers =
qualname = alembic
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(levelname)-5.5s [%(name)s] %(message)s
datefmt = %H:%M:%S
'''
| [
1,
515,
19229,
1053,
12603,
552,
29892,
2391,
29892,
28379,
13,
5215,
4390,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
528,
2506,
13,
5215,
408,
948,
3934,
13,
5215,
1852,
5510,
13,
5215,
12183,
13,
5215,
5694,
1445,
13,
3166,
3142,
1982,
29889,
5510,
1053,
3142,
5510,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
1753,
1284,
29918,
2850,
2922,
29918,
3126,
580,
1599,
28379,
29961,
8977,
5387,
13,
1678,
4390,
29918,
2084,
353,
2897,
29889,
657,
6272,
877,
4176,
29924,
1299,
29918,
7249,
29918,
10145,
1495,
13,
1678,
565,
4390,
29918,
2084,
29901,
13,
4706,
411,
1722,
29898,
3126,
29918,
2084,
29897,
408,
285,
29901,
13,
9651,
274,
16434,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
9651,
736,
274,
16434,
13,
13,
1678,
396,
13649,
1549,
278,
1857,
4516,
701,
304,
278,
3876,
4516,
5591,
29908,
304,
1284,
263,
13,
1678,
396,
869,
2850,
2922,
29889,
3126,
13,
1678,
664,
3972,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
657,
29883,
9970,
3101,
13,
1678,
1550,
664,
3972,
29901,
13,
4706,
4390,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1287,
3972,
29892,
15300,
2850,
2922,
29889,
3126,
1495,
13,
4706,
565,
2897,
29889,
2084,
29889,
9933,
29898,
3126,
29918,
2084,
1125,
13,
9651,
411,
1722,
29898,
3126,
29918,
2084,
29897,
408,
285,
29901,
13,
18884,
274,
16434,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
18884,
736,
274,
16434,
13,
4706,
3847,
3972,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1287,
3972,
29892,
525,
636,
8785,
13,
4706,
565,
3847,
3972,
1275,
664,
3972,
29901,
13,
9651,
2867,
13,
4706,
664,
3972,
353,
3847,
3972,
13,
1678,
17927,
29889,
27392,
877,
14057,
304,
1284,
869,
2850,
2922,
29889,
3126,
1495,
13,
1678,
736,
6213,
13,
13,
1753,
1284,
29918,
6289,
29876,
29898,
29097,
29901,
851,
29892,
5153,
29901,
851,
29897,
1599,
12603,
552,
29961,
710,
29892,
2391,
29961,
710,
5262,
29901,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
410,
29887,
29922,
29097,
29892,
13,
4706,
6139,
29922,
14273,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29881,
742,
525,
489,
6289,
29876,
742,
13,
462,
4706,
1134,
29922,
710,
29892,
13,
462,
4706,
1371,
2433,
29272,
270,
16586,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29887,
742,
525,
489,
2585,
742,
13,
462,
4706,
1134,
29922,
710,
29892,
13,
462,
4706,
2322,
2433,
4381,
742,
13,
462,
4706,
1371,
2433,
29272,
4833,
2777,
3342,
297,
869,
2850,
2922,
29889,
3126,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
1052,
17179,
29918,
5085,
742,
13,
462,
4706,
1134,
29922,
710,
29892,
13,
462,
4706,
302,
5085,
2433,
29930,
742,
13,
462,
4706,
1371,
2433,
6519,
1196,
6273,
310,
1208,
17179,
11104,
1495,
13,
13,
1678,
396,
515,
6273,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
565,
6389,
29889,
6289,
29876,
29901,
13,
4706,
736,
6389,
29889,
6289,
29876,
29892,
6389,
29889,
1052,
17179,
29918,
5085,
13,
13,
1678,
396,
1284,
270,
16586,
515,
869,
6294,
2850,
2922,
29889,
3126,
13,
1678,
274,
16434,
353,
1284,
29918,
2850,
2922,
29918,
3126,
580,
13,
1678,
565,
274,
16434,
29901,
13,
4706,
270,
16586,
353,
274,
16434,
1839,
29503,
2129,
2033,
29961,
5085,
29889,
2585,
22322,
6289,
29876,
2033,
13,
4706,
4974,
338,
8758,
29898,
6289,
29876,
29892,
851,
29897,
13,
4706,
736,
270,
16586,
29892,
6389,
29889,
1052,
17179,
29918,
5085,
13,
13,
1678,
396,
2322,
270,
16586,
773,
8952,
13,
1678,
1404,
353,
2897,
29889,
657,
6272,
877,
11889,
742,
27255,
13,
1678,
2322,
29918,
6289,
29876,
353,
285,
29915,
2490,
7201,
597,
29912,
1792,
29913,
29992,
29896,
29906,
29955,
29889,
29900,
29889,
29900,
29889,
29896,
29901,
29945,
29946,
29941,
29906,
19248,
5085,
29889,
2585,
10162,
13,
13,
1678,
17927,
29889,
27392,
877,
1217,
1400,
7201,
270,
16586,
6790,
29892,
671,
1273,
29879,
2012,
742,
2322,
29918,
6289,
29876,
29897,
13,
1678,
736,
2322,
29918,
6289,
29876,
29892,
6389,
29889,
1052,
17179,
29918,
5085,
13,
13,
1753,
5988,
5085,
29898,
1052,
17179,
29918,
5085,
29901,
2391,
29961,
710,
2314,
1599,
851,
29901,
13,
1678,
565,
756,
5552,
29898,
845,
2506,
29892,
525,
7122,
29374,
13,
4706,
736,
528,
2506,
29889,
7122,
29898,
1052,
17179,
29918,
5085,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
525,
15300,
7122,
29898,
845,
2506,
29889,
1396,
29898,
29874,
29897,
363,
263,
297,
1208,
17179,
29918,
5085,
29897,
13,
13,
29937,
1065,
282,
2850,
3132,
13,
12674,
822,
1065,
29918,
15903,
29898,
6289,
29876,
29901,
851,
29892,
1208,
17179,
29918,
5085,
29901,
2391,
29961,
710,
2314,
1599,
6213,
29901,
13,
1678,
282,
353,
3142,
5510,
29898,
6289,
29876,
29897,
13,
1678,
8952,
353,
282,
29889,
6786,
470,
6629,
13,
1678,
4800,
353,
282,
29889,
5630,
470,
6629,
13,
1678,
4833,
978,
353,
282,
29889,
2084,
29961,
29896,
17531,
13,
1678,
3495,
978,
353,
282,
29889,
28988,
13,
1678,
2011,
353,
282,
29889,
637,
470,
29871,
29945,
29946,
29941,
29906,
13,
13,
1678,
5694,
29918,
4061,
3364,
353,
5694,
1445,
29889,
22175,
5776,
1971,
653,
2283,
29898,
8513,
2433,
29893,
1495,
13,
1678,
1596,
29898,
13,
4706,
22372,
6177,
29912,
6177,
29912,
6177,
29912,
6177,
8875,
4286,
4830,
29898,
28988,
29892,
2011,
29892,
4833,
978,
29892,
8952,
29892,
4800,
511,
13,
9651,
934,
29922,
7382,
29918,
4061,
3364,
29892,
13,
9651,
28371,
29922,
5574,
29897,
13,
1678,
2897,
29889,
21813,
1839,
16903,
25711,
7724,
2033,
353,
5694,
29918,
4061,
3364,
29889,
978,
13,
1678,
1899,
353,
525,
567,
1519,
448,
29882,
8875,
448,
29886,
8875,
448,
29965,
8875,
6571,
6571,
4286,
4830,
29898,
28988,
29892,
2011,
29892,
8952,
29892,
5988,
5085,
29898,
1052,
17179,
29918,
5085,
511,
4833,
978,
29897,
13,
1678,
9580,
353,
7272,
408,
948,
3934,
29889,
3258,
29918,
1491,
5014,
29918,
15903,
29898,
6519,
29897,
13,
1678,
7272,
9580,
29889,
27820,
403,
580,
13,
13,
1753,
1067,
29918,
3389,
29918,
15903,
580,
1599,
6213,
29901,
13,
1678,
270,
16586,
29892,
1208,
17179,
29918,
5085,
353,
1284,
29918,
6289,
29876,
877,
2850,
2922,
29899,
15903,
742,
525,
3389,
282,
2850,
3132,
6473,
1495,
13,
1678,
2425,
353,
408,
948,
3934,
29889,
657,
29918,
3696,
29918,
7888,
580,
13,
1678,
2425,
29889,
3389,
29918,
29305,
29918,
8835,
29898,
3389,
29918,
15903,
29898,
6289,
29876,
29892,
1208,
17179,
29918,
5085,
876,
13,
13,
29937,
1065,
4833,
15070,
13,
12674,
822,
1065,
29918,
2585,
15070,
29898,
6289,
29876,
29901,
851,
29892,
1208,
17179,
29918,
5085,
29901,
2391,
29961,
710,
2314,
1599,
6213,
29901,
13,
1678,
282,
353,
3142,
5510,
29898,
6289,
29876,
29897,
13,
1678,
8952,
353,
282,
29889,
6786,
470,
6629,
13,
1678,
4800,
353,
282,
29889,
5630,
470,
6629,
13,
1678,
4833,
978,
353,
282,
29889,
2084,
29961,
29896,
17531,
13,
1678,
3495,
978,
353,
282,
29889,
28988,
13,
1678,
2011,
353,
282,
29889,
637,
470,
29871,
29945,
29946,
29941,
29906,
13,
13,
1678,
5694,
29918,
4061,
3364,
353,
5694,
1445,
29889,
22175,
5776,
1971,
653,
2283,
29898,
8513,
2433,
29893,
1495,
13,
1678,
1596,
29898,
13,
4706,
22372,
6177,
29912,
6177,
29912,
6177,
29912,
6177,
8875,
4286,
4830,
29898,
28988,
29892,
2011,
29892,
4833,
978,
29892,
8952,
29892,
4800,
511,
13,
4706,
934,
29922,
7382,
29918,
4061,
3364,
29892,
13,
4706,
28371,
29922,
5574,
29897,
13,
1678,
2897,
29889,
21813,
1839,
16903,
25711,
7724,
2033,
353,
5694,
29918,
4061,
3364,
29889,
978,
13,
1678,
1899,
353,
525,
4061,
29918,
15070,
448,
29882,
8875,
448,
29886,
8875,
448,
29965,
8875,
6571,
6571,
4286,
4830,
29898,
28988,
29892,
2011,
29892,
8952,
29892,
5988,
5085,
29898,
1052,
17179,
29918,
5085,
511,
4833,
978,
29897,
13,
1678,
9580,
353,
7272,
408,
948,
3934,
29889,
3258,
29918,
1491,
5014,
29918,
15903,
29898,
6519,
29897,
13,
1678,
7272,
9580,
29889,
27820,
403,
580,
13,
13,
1753,
1067,
29918,
3389,
29918,
2585,
15070,
580,
1599,
6213,
29901,
13,
1678,
270,
16586,
29892,
1208,
17179,
29918,
5085,
353,
1284,
29918,
6289,
29876,
877,
2850,
2922,
29899,
15070,
742,
525,
15070,
2566,
1495,
13,
1678,
2425,
353,
408,
948,
3934,
29889,
657,
29918,
3696,
29918,
7888,
580,
13,
1678,
2425,
29889,
3389,
29918,
29305,
29918,
8835,
29898,
3389,
29918,
2585,
15070,
29898,
6289,
29876,
29892,
1208,
17179,
29918,
5085,
876,
13,
13,
29937,
5706,
20712,
29890,
293,
9725,
800,
13,
1753,
2531,
29918,
26983,
403,
29898,
6289,
29876,
29901,
851,
29897,
1599,
6213,
29901,
13,
1678,
2069,
29918,
1272,
353,
319,
1307,
9486,
2965,
29918,
26019,
29889,
6506,
877,
6224,
6289,
29876,
930,
742,
270,
16586,
29897,
13,
1678,
411,
1722,
877,
744,
8337,
293,
29889,
2172,
742,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
285,
29889,
3539,
29898,
2344,
29918,
1272,
29897,
13,
13,
1753,
1067,
29918,
1885,
29918,
26983,
403,
580,
1599,
6213,
29901,
13,
1678,
270,
16586,
29892,
1208,
17179,
29918,
5085,
353,
1284,
29918,
6289,
29876,
877,
2850,
2922,
29899,
1885,
26983,
403,
742,
525,
17158,
20712,
29890,
293,
20332,
1495,
13,
1678,
2531,
29918,
26983,
403,
29898,
6289,
29876,
29897,
13,
1678,
1596,
877,
29956,
4859,
20712,
29890,
293,
29889,
2172,
1495,
13,
13,
29909,
1307,
9486,
2965,
29918,
26019,
353,
14550,
29905,
13,
29937,
319,
10035,
29892,
2323,
2566,
5285,
29889,
13,
13,
29961,
744,
8337,
293,
29962,
13,
29937,
2224,
304,
20332,
12078,
13,
2154,
29918,
5479,
353,
9725,
800,
13,
13,
29937,
4472,
1304,
304,
5706,
20332,
2066,
13,
29937,
934,
29918,
6886,
353,
17806,
29898,
13478,
29897,
29879,
29918,
7686,
29898,
29517,
29897,
29879,
13,
13,
29937,
29431,
304,
671,
746,
15061,
278,
2635,
13,
29937,
2629,
278,
20332,
934,
408,
1532,
408,
278,
10422,
29889,
13,
29937,
1347,
995,
338,
4502,
304,
2635,
4422,
29889,
17559,
29889,
657,
17559,
580,
13,
29937,
5967,
9654,
363,
1887,
2230,
13,
29937,
29431,
353,
13,
13,
29937,
4236,
3309,
310,
4890,
304,
3394,
304,
278,
13,
29937,
376,
29517,
29908,
1746,
13,
29937,
509,
4661,
403,
29918,
29517,
29918,
2848,
353,
29871,
29946,
29900,
13,
13,
29937,
731,
304,
525,
3009,
29915,
304,
1065,
278,
5177,
2645,
13,
29937,
278,
525,
276,
4924,
29915,
1899,
29892,
17126,
310,
1120,
468,
759,
403,
13,
29937,
26554,
29918,
20944,
353,
2089,
13,
13,
29937,
731,
304,
525,
3009,
29915,
304,
2758,
869,
2272,
29883,
322,
869,
2272,
29877,
2066,
1728,
13,
29937,
263,
2752,
869,
2272,
934,
304,
367,
17809,
408,
23484,
1080,
297,
278,
13,
29937,
6910,
29914,
3884,
13,
29937,
269,
473,
2242,
404,
353,
2089,
13,
13,
29937,
1873,
4423,
21992,
29936,
445,
21274,
13,
29937,
304,
9725,
800,
29914,
26100,
29889,
29871,
1932,
773,
2999,
1873,
13,
29937,
17525,
29892,
2847,
23484,
1080,
1818,
367,
6790,
411,
1192,
3259,
29899,
2084,
13,
29937,
1873,
29918,
2029,
800,
353,
1273,
29898,
4150,
29897,
29879,
29914,
1646,
1273,
29898,
4150,
29897,
29879,
29914,
10222,
9725,
800,
29914,
26100,
13,
13,
29937,
278,
1962,
8025,
1304,
746,
26554,
2066,
13,
29937,
526,
3971,
515,
2471,
29889,
2272,
29889,
29885,
4614,
13,
29937,
1962,
29918,
22331,
353,
23616,
29899,
29947,
13,
13,
29937,
2850,
284,
305,
6764,
29889,
2271,
353,
7156,
597,
1792,
29901,
3364,
29992,
7640,
29914,
2585,
978,
13,
2850,
284,
305,
6764,
29889,
2271,
353,
8620,
6289,
29876,
930,
13,
13,
29937,
4522,
3460,
5285,
13,
29961,
1188,
5743,
29962,
13,
8149,
353,
3876,
29892,
2850,
284,
305,
6764,
29892,
744,
8337,
293,
13,
13,
29961,
3179,
9306,
29962,
13,
8149,
353,
2991,
13,
13,
29961,
4830,
2153,
29962,
13,
8149,
353,
10035,
13,
13,
29961,
21707,
29918,
4632,
29962,
13,
5563,
353,
399,
15249,
13,
3179,
9306,
353,
2991,
13,
15380,
978,
353,
13,
13,
29961,
21707,
29918,
2850,
284,
305,
6764,
29962,
13,
5563,
353,
399,
15249,
13,
3179,
9306,
353,
13,
15380,
978,
353,
4576,
284,
305,
6764,
29889,
10599,
13,
13,
29961,
21707,
29918,
744,
8337,
293,
29962,
13,
5563,
353,
15233,
13,
3179,
9306,
353,
13,
15380,
978,
353,
20712,
29890,
293,
13,
13,
29961,
13789,
29918,
11058,
29962,
13,
1990,
353,
13763,
4598,
13,
5085,
353,
313,
9675,
29889,
303,
20405,
29892,
29897,
13,
5563,
353,
6058,
10490,
13,
689,
2620,
353,
10035,
13,
13,
29961,
689,
2620,
29918,
19206,
29962,
13,
4830,
353,
1273,
29898,
5563,
978,
6817,
29945,
29889,
29945,
29879,
518,
29995,
29898,
978,
29897,
29879,
29962,
1273,
29898,
4906,
29897,
29879,
13,
1256,
23479,
353,
1273,
29950,
16664,
29924,
16664,
29903,
13,
13,
12008,
13,
2
] |
cartbox/cart/management/commands/update_or_create_cats_and_prods.py | bayersglassey/cartbox | 0 | 100249 |
from django.core.management.base import BaseCommand, CommandError
from cart.default_data import update_or_create_cats_and_prods
class Command(BaseCommand):
help = (
"Updates or creates the default set of Product and "
"Category objects.")
def handle(self, *args, **options):
update_or_create_cats_and_prods()
| [
1,
29871,
13,
3166,
9557,
29889,
3221,
29889,
21895,
29889,
3188,
1053,
7399,
6255,
29892,
10516,
2392,
13,
13,
3166,
7774,
29889,
4381,
29918,
1272,
1053,
2767,
29918,
272,
29918,
3258,
29918,
29883,
1446,
29918,
392,
29918,
771,
6289,
13,
13,
13,
1990,
10516,
29898,
5160,
6255,
1125,
13,
13,
1678,
1371,
353,
313,
13,
4706,
376,
3373,
15190,
470,
10017,
278,
2322,
731,
310,
10969,
322,
376,
13,
4706,
376,
10900,
3618,
23157,
13,
13,
1678,
822,
4386,
29898,
1311,
29892,
334,
5085,
29892,
3579,
6768,
1125,
13,
4706,
2767,
29918,
272,
29918,
3258,
29918,
29883,
1446,
29918,
392,
29918,
771,
6289,
580,
13,
2
] |
lib/spack/spack/cmd/style.py | mt-empty/spack | 2 | 68467 | <reponame>mt-empty/spack
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from __future__ import print_function
import argparse
import os
import re
import sys
import llnl.util.tty as tty
import llnl.util.tty.color as color
from llnl.util.filesystem import working_dir
import spack.paths
from spack.util.executable import which
if sys.version_info < (3, 0):
from itertools import izip_longest # novm
zip_longest = izip_longest
else:
from itertools import zip_longest # novm
description = "runs source code style checks on spack"
section = "developer"
level = "long"
def grouper(iterable, n, fillvalue=None):
"Collect data into fixed-length chunks or blocks"
# grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
for group in zip_longest(*args, fillvalue=fillvalue):
yield filter(None, group)
#: directory where spack style started, for relativizing paths
initial_working_dir = None
#: List of directories to exclude from checks.
exclude_directories = [spack.paths.external_path]
#: order in which tools should be run. flake8 is last so that it can
#: double-check the results of other tools (if, e.g., --fix was provided)
tool_order = ["isort", "mypy", "black", "flake8"]
#: tools we run in spack style
tools = {}
def is_package(f):
"""Whether flake8 should consider a file as a core file or a package.
We run flake8 with different exceptions for the core and for
packages, since we allow `from spack import *` and poking globals
into packages.
"""
return f.startswith("var/spack/repos/") or "docs/tutorial/examples" in f
#: decorator for adding tools to the list
class tool(object):
def __init__(self, name, required=False):
self.name = name
self.required = required
def __call__(self, fun):
tools[self.name] = (fun, self.required)
return fun
def changed_files(base=None, untracked=True, all_files=False):
"""Get list of changed files in the Spack repository."""
git = which("git", required=True)
# GITHUB_BASE_REF is set to the base branch for pull request actions
if base is None:
base = os.environ.get("GITHUB_BASE_REF", "develop")
range = "{0}...".format(base)
git_args = [
# Add changed files committed since branching off of develop
["diff", "--name-only", "--diff-filter=ACMR", range],
# Add changed files that have been staged but not yet committed
["diff", "--name-only", "--diff-filter=ACMR", "--cached"],
# Add changed files that are unstaged
["diff", "--name-only", "--diff-filter=ACMR"],
]
# Add new files that are untracked
if untracked:
git_args.append(["ls-files", "--exclude-standard", "--other"])
# add everything if the user asked for it
if all_files:
git_args.append(["ls-files", "--exclude-standard"])
excludes = [os.path.realpath(f) for f in exclude_directories]
changed = set()
for arg_list in git_args:
files = git(*arg_list, output=str).split("\n")
for f in files:
# Ignore non-Python files
if not (f.endswith(".py") or f == "bin/spack"):
continue
# Ignore files in the exclude locations
if any(os.path.realpath(f).startswith(e) for e in excludes):
continue
changed.add(f)
return sorted(changed)
def setup_parser(subparser):
subparser.add_argument(
"-b",
"--base",
action="store",
default=None,
help="select base branch for collecting list of modified files",
)
subparser.add_argument(
"-a",
"--all",
action="store_true",
help="check all files, not just changed files",
)
subparser.add_argument(
"-r",
"--root-relative",
action="store_true",
default=False,
help="print root-relative paths (default: cwd-relative)",
)
subparser.add_argument(
"-U",
"--no-untracked",
dest="untracked",
action="store_false",
default=True,
help="exclude untracked files from checks",
)
subparser.add_argument(
"-f",
"--fix",
action="store_true",
default=False,
help="format automatically if possible (e.g., with isort, black)",
)
subparser.add_argument(
"--no-isort",
dest="isort",
action="store_false",
help="do not run isort (default: run isort if available)",
)
subparser.add_argument(
"--no-flake8",
dest="flake8",
action="store_false",
help="do not run flake8 (default: run flake8 or fail)",
)
subparser.add_argument(
"--no-mypy",
dest="mypy",
action="store_false",
help="do not run mypy (default: run mypy if available)",
)
subparser.add_argument(
"--black",
dest="black",
action="store_true",
help="run black if available (default: skip black)",
)
subparser.add_argument(
"files", nargs=argparse.REMAINDER, help="specific files to check"
)
def cwd_relative(path):
"""Translate prefix-relative path to current working directory-relative."""
return os.path.relpath(os.path.join(spack.paths.prefix, path), initial_working_dir)
def rewrite_and_print_output(
output, args, re_obj=re.compile(r"^(.+):([0-9]+):"), replacement=r"{0}:{1}:"
):
"""rewrite ouput with <file>:<line>: format to respect path args"""
# print results relative to current working directory
def translate(match):
return replacement.format(
cwd_relative(match.group(1)), *list(match.groups()[1:])
)
for line in output.split("\n"):
if not line:
continue
if not args.root_relative and re_obj:
line = re_obj.sub(translate, line)
print(" " + line)
def print_style_header(file_list, args):
tools = [tool for tool in tool_order if getattr(args, tool)]
tty.msg("Running style checks on spack:", "selected: " + ", ".join(tools))
# translate modified paths to cwd_relative if needed
paths = [filename.strip() for filename in file_list]
if not args.root_relative:
paths = [cwd_relative(filename) for filename in paths]
tty.msg("Modified files:", *paths)
sys.stdout.flush()
def print_tool_header(tool):
sys.stdout.flush()
tty.msg("Running %s checks" % tool)
sys.stdout.flush()
def print_tool_result(tool, returncode):
if returncode == 0:
color.cprint(" @g{%s checks were clean}" % tool)
else:
color.cprint(" @r{%s found errors}" % tool)
@tool("flake8", required=True)
def run_flake8(flake8_cmd, file_list, args):
returncode = 0
output = ""
# run in chunks of 100 at a time to avoid line length limit
# filename parameter in config *does not work* for this reliably
for chunk in grouper(file_list, 100):
output = flake8_cmd(
# use .flake8 implicitly to work around bug in flake8 upstream
# append-config is ignored if `--config` is explicitly listed
# see: https://gitlab.com/pycqa/flake8/-/issues/455
# "--config=.flake8",
*chunk,
fail_on_error=False,
output=str
)
returncode |= flake8_cmd.returncode
rewrite_and_print_output(output, args)
print_tool_result("flake8", returncode)
return returncode
@tool("mypy")
def run_mypy(mypy_cmd, file_list, args):
mpy_args = ["--package", "spack", "--package", "llnl", "--show-error-codes"]
# not yet, need other updates to enable this
# if any([is_package(f) for f in file_list]):
# mpy_args.extend(["--package", "packages"])
output = mypy_cmd(*mpy_args, fail_on_error=False, output=str)
returncode = mypy_cmd.returncode
rewrite_and_print_output(output, args)
print_tool_result("mypy", returncode)
return returncode
@tool("isort")
def run_isort(isort_cmd, file_list, args):
check_fix_args = () if args.fix else ("--check", "--diff")
pat = re.compile("ERROR: (.*) Imports are incorrectly sorted")
replacement = "ERROR: {0} Imports are incorrectly sorted"
returncode = 0
for chunk in grouper(file_list, 100):
packed_args = check_fix_args + tuple(chunk)
output = isort_cmd(*packed_args, fail_on_error=False, output=str, error=str)
returncode |= isort_cmd.returncode
rewrite_and_print_output(output, args, pat, replacement)
print_tool_result("isort", returncode)
return returncode
@tool("black")
def run_black(black_cmd, file_list, args):
check_fix_args = () if args.fix else ("--check", "--diff", "--color")
pat = re.compile("would reformat +(.*)")
replacement = "would reformat {0}"
returncode = 0
output = ""
# run in chunks of 100 at a time to avoid line length limit
# filename parameter in config *does not work* for this reliably
for chunk in grouper(file_list, 100):
packed_args = check_fix_args + tuple(chunk)
output = black_cmd(*packed_args, fail_on_error=False, output=str, error=str)
returncode |= black_cmd.returncode
rewrite_and_print_output(output, args, pat, replacement)
print_tool_result("black", returncode)
return returncode
def style(parser, args):
# save initial working directory for relativizing paths later
global initial_working_dir
initial_working_dir = os.getcwd()
file_list = args.files
if file_list:
def prefix_relative(path):
return os.path.relpath(
os.path.abspath(os.path.realpath(path)), spack.paths.prefix
)
file_list = [prefix_relative(p) for p in file_list]
returncode = 0
with working_dir(spack.paths.prefix):
if not file_list:
file_list = changed_files(args.base, args.untracked, args.all)
print_style_header(file_list, args)
# run tools in order defined in tool_order
returncode = 0
for tool_name in tool_order:
if getattr(args, tool_name):
run_function, required = tools[tool_name]
print_tool_header(tool_name)
cmd = which(tool_name, required=required)
if not cmd:
color.cprint(" @y{%s not in PATH, skipped}" % tool_name)
continue
returncode |= run_function(cmd, file_list, args)
if returncode == 0:
tty.msg(color.colorize("@*{spack style checks were clean}"))
else:
tty.error(color.colorize("@*{spack style found errors}"))
return returncode
| [
1,
529,
276,
1112,
420,
29958,
4378,
29899,
6310,
29914,
1028,
547,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29941,
29899,
29906,
29900,
29906,
29896,
19520,
22469,
5514,
3086,
14223,
29892,
365,
12182,
322,
916,
13,
29937,
1706,
547,
8010,
10682,
414,
29889,
2823,
278,
2246,
29899,
5563,
315,
4590,
29979,
22789,
3912,
934,
363,
4902,
29889,
13,
29937,
13,
29937,
10937,
29928,
29990,
29899,
29931,
293,
1947,
29899,
12889,
29901,
313,
17396,
1829,
29899,
29906,
29889,
29900,
6323,
341,
1806,
29897,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
13,
5215,
1852,
5510,
13,
5215,
2897,
13,
5215,
337,
13,
5215,
10876,
13,
13,
5215,
301,
3083,
29880,
29889,
4422,
29889,
4349,
408,
260,
1017,
13,
5215,
301,
3083,
29880,
29889,
4422,
29889,
4349,
29889,
2780,
408,
2927,
13,
3166,
301,
3083,
29880,
29889,
4422,
29889,
5325,
973,
1053,
1985,
29918,
3972,
13,
13,
5215,
805,
547,
29889,
24772,
13,
3166,
805,
547,
29889,
4422,
29889,
4258,
9246,
1053,
607,
13,
13,
361,
10876,
29889,
3259,
29918,
3888,
529,
313,
29941,
29892,
29871,
29900,
1125,
13,
1678,
515,
4256,
8504,
1053,
5951,
666,
29918,
5426,
342,
29871,
396,
2420,
29885,
13,
13,
1678,
14319,
29918,
5426,
342,
353,
5951,
666,
29918,
5426,
342,
13,
2870,
29901,
13,
1678,
515,
4256,
8504,
1053,
14319,
29918,
5426,
342,
29871,
396,
2420,
29885,
13,
13,
13,
8216,
353,
376,
3389,
29879,
2752,
775,
3114,
12747,
373,
805,
547,
29908,
13,
2042,
353,
376,
6734,
29908,
13,
5563,
353,
376,
5426,
29908,
13,
13,
13,
1753,
867,
283,
546,
29898,
1524,
519,
29892,
302,
29892,
5445,
1767,
29922,
8516,
1125,
13,
1678,
376,
28916,
848,
964,
4343,
29899,
2848,
521,
18801,
470,
10930,
29908,
13,
1678,
396,
867,
283,
546,
877,
19658,
24405,
29954,
742,
29871,
29941,
29892,
525,
29916,
1495,
6660,
16417,
5012,
29943,
402,
4419,
29908,
13,
1678,
6389,
353,
518,
1524,
29898,
1524,
519,
4638,
334,
302,
13,
1678,
363,
2318,
297,
14319,
29918,
5426,
342,
10456,
5085,
29892,
5445,
1767,
29922,
5589,
1767,
1125,
13,
4706,
7709,
4175,
29898,
8516,
29892,
2318,
29897,
13,
13,
13,
29937,
29901,
3884,
988,
805,
547,
3114,
4687,
29892,
363,
14215,
5281,
10898,
13,
11228,
29918,
22899,
29918,
3972,
353,
6213,
13,
13,
29937,
29901,
2391,
310,
17525,
304,
19060,
515,
12747,
29889,
13,
735,
2325,
29918,
11851,
3842,
353,
518,
1028,
547,
29889,
24772,
29889,
23176,
29918,
2084,
29962,
13,
13,
29937,
29901,
1797,
297,
607,
8492,
881,
367,
1065,
29889,
17422,
446,
29947,
338,
1833,
577,
393,
372,
508,
13,
29937,
29901,
3765,
29899,
3198,
278,
2582,
310,
916,
8492,
313,
361,
29892,
321,
29889,
29887,
1696,
1192,
5878,
471,
4944,
29897,
13,
10154,
29918,
2098,
353,
6796,
275,
441,
613,
376,
1357,
2272,
613,
376,
8517,
613,
376,
29888,
433,
446,
29947,
3108,
13,
13,
29937,
29901,
8492,
591,
1065,
297,
805,
547,
3114,
13,
8504,
353,
6571,
13,
13,
13,
1753,
338,
29918,
5113,
29898,
29888,
1125,
13,
1678,
9995,
8809,
1979,
17422,
446,
29947,
881,
2050,
263,
934,
408,
263,
7136,
934,
470,
263,
3577,
29889,
13,
13,
1678,
1334,
1065,
17422,
446,
29947,
411,
1422,
15283,
363,
278,
7136,
322,
363,
13,
1678,
9741,
29892,
1951,
591,
2758,
421,
3166,
805,
547,
1053,
334,
29952,
322,
11293,
292,
13149,
1338,
13,
1678,
964,
9741,
29889,
13,
1678,
9995,
13,
1678,
736,
285,
29889,
27382,
2541,
703,
1707,
29914,
1028,
547,
29914,
276,
1066,
29914,
1159,
470,
376,
2640,
29914,
12631,
29914,
19057,
29908,
297,
285,
13,
13,
13,
29937,
29901,
10200,
1061,
363,
4417,
8492,
304,
278,
1051,
13,
1990,
5780,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
3734,
29922,
8824,
1125,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
12403,
353,
3734,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
2090,
1125,
13,
4706,
8492,
29961,
1311,
29889,
978,
29962,
353,
313,
7692,
29892,
1583,
29889,
12403,
29897,
13,
4706,
736,
2090,
13,
13,
13,
1753,
3939,
29918,
5325,
29898,
3188,
29922,
8516,
29892,
443,
11294,
287,
29922,
5574,
29892,
599,
29918,
5325,
29922,
8824,
1125,
13,
1678,
9995,
2577,
1051,
310,
3939,
2066,
297,
278,
1706,
547,
9810,
1213,
15945,
13,
13,
1678,
6315,
353,
607,
703,
5559,
613,
3734,
29922,
5574,
29897,
13,
13,
1678,
396,
402,
13054,
7466,
29918,
25416,
29918,
25866,
338,
731,
304,
278,
2967,
5443,
363,
8206,
2009,
8820,
13,
1678,
565,
2967,
338,
6213,
29901,
13,
4706,
2967,
353,
2897,
29889,
21813,
29889,
657,
703,
29954,
13054,
7466,
29918,
25416,
29918,
25866,
613,
376,
4888,
1159,
13,
13,
1678,
3464,
353,
29850,
29900,
29913,
856,
1642,
4830,
29898,
3188,
29897,
13,
13,
1678,
6315,
29918,
5085,
353,
518,
13,
4706,
396,
3462,
3939,
2066,
19355,
1951,
5443,
292,
1283,
310,
2693,
13,
4706,
6796,
12765,
613,
376,
489,
978,
29899,
6194,
613,
376,
489,
12765,
29899,
4572,
29922,
2477,
21055,
613,
3464,
1402,
13,
4706,
396,
3462,
3939,
2066,
393,
505,
1063,
380,
4063,
541,
451,
3447,
19355,
13,
4706,
6796,
12765,
613,
376,
489,
978,
29899,
6194,
613,
376,
489,
12765,
29899,
4572,
29922,
2477,
21055,
613,
376,
489,
29883,
3791,
12436,
13,
4706,
396,
3462,
3939,
2066,
393,
526,
443,
303,
4063,
13,
4706,
6796,
12765,
613,
376,
489,
978,
29899,
6194,
613,
376,
489,
12765,
29899,
4572,
29922,
2477,
21055,
12436,
13,
1678,
4514,
13,
13,
1678,
396,
3462,
716,
2066,
393,
526,
443,
11294,
287,
13,
1678,
565,
443,
11294,
287,
29901,
13,
4706,
6315,
29918,
5085,
29889,
4397,
29898,
3366,
3137,
29899,
5325,
613,
376,
489,
735,
2325,
29899,
15770,
613,
376,
489,
1228,
20068,
13,
13,
1678,
396,
788,
4129,
565,
278,
1404,
4433,
363,
372,
13,
1678,
565,
599,
29918,
5325,
29901,
13,
4706,
6315,
29918,
5085,
29889,
4397,
29898,
3366,
3137,
29899,
5325,
613,
376,
489,
735,
2325,
29899,
15770,
20068,
13,
13,
1678,
429,
27722,
353,
518,
359,
29889,
2084,
29889,
6370,
2084,
29898,
29888,
29897,
363,
285,
297,
19060,
29918,
11851,
3842,
29962,
13,
1678,
3939,
353,
731,
580,
13,
13,
1678,
363,
1852,
29918,
1761,
297,
6315,
29918,
5085,
29901,
13,
4706,
2066,
353,
6315,
10456,
1191,
29918,
1761,
29892,
1962,
29922,
710,
467,
5451,
14182,
29876,
1159,
13,
13,
4706,
363,
285,
297,
2066,
29901,
13,
9651,
396,
18076,
487,
1661,
29899,
11980,
2066,
13,
9651,
565,
451,
313,
29888,
29889,
1975,
2541,
17350,
2272,
1159,
470,
285,
1275,
376,
2109,
29914,
1028,
547,
29908,
1125,
13,
18884,
6773,
13,
13,
9651,
396,
18076,
487,
2066,
297,
278,
19060,
14354,
13,
9651,
565,
738,
29898,
359,
29889,
2084,
29889,
6370,
2084,
29898,
29888,
467,
27382,
2541,
29898,
29872,
29897,
363,
321,
297,
429,
27722,
1125,
13,
18884,
6773,
13,
13,
9651,
3939,
29889,
1202,
29898,
29888,
29897,
13,
13,
1678,
736,
12705,
29898,
15033,
29897,
13,
13,
13,
1753,
6230,
29918,
16680,
29898,
1491,
16680,
1125,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29890,
613,
13,
4706,
376,
489,
3188,
613,
13,
4706,
3158,
543,
8899,
613,
13,
4706,
2322,
29922,
8516,
29892,
13,
4706,
1371,
543,
2622,
2967,
5443,
363,
6314,
292,
1051,
310,
9120,
2066,
613,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29874,
613,
13,
4706,
376,
489,
497,
613,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
1371,
543,
3198,
599,
2066,
29892,
451,
925,
3939,
2066,
613,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29878,
613,
13,
4706,
376,
489,
4632,
29899,
22925,
613,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
2322,
29922,
8824,
29892,
13,
4706,
1371,
543,
2158,
3876,
29899,
22925,
10898,
313,
4381,
29901,
274,
9970,
29899,
22925,
19123,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29965,
613,
13,
4706,
376,
489,
1217,
29899,
1657,
22282,
287,
613,
13,
4706,
2731,
543,
1657,
22282,
287,
613,
13,
4706,
3158,
543,
8899,
29918,
4541,
613,
13,
4706,
2322,
29922,
5574,
29892,
13,
4706,
1371,
543,
735,
2325,
443,
11294,
287,
2066,
515,
12747,
613,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
11663,
29888,
613,
13,
4706,
376,
489,
5878,
613,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
2322,
29922,
8824,
29892,
13,
4706,
1371,
543,
4830,
6336,
565,
1950,
313,
29872,
29889,
29887,
1696,
411,
338,
441,
29892,
4628,
19123,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
275,
441,
613,
13,
4706,
2731,
543,
275,
441,
613,
13,
4706,
3158,
543,
8899,
29918,
4541,
613,
13,
4706,
1371,
543,
1867,
451,
1065,
338,
441,
313,
4381,
29901,
1065,
338,
441,
565,
3625,
19123,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
29888,
433,
446,
29947,
613,
13,
4706,
2731,
543,
29888,
433,
446,
29947,
613,
13,
4706,
3158,
543,
8899,
29918,
4541,
613,
13,
4706,
1371,
543,
1867,
451,
1065,
17422,
446,
29947,
313,
4381,
29901,
1065,
17422,
446,
29947,
470,
4418,
19123,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
1217,
29899,
1357,
2272,
613,
13,
4706,
2731,
543,
1357,
2272,
613,
13,
4706,
3158,
543,
8899,
29918,
4541,
613,
13,
4706,
1371,
543,
1867,
451,
1065,
590,
2272,
313,
4381,
29901,
1065,
590,
2272,
565,
3625,
19123,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
8517,
613,
13,
4706,
2731,
543,
8517,
613,
13,
4706,
3158,
543,
8899,
29918,
3009,
613,
13,
4706,
1371,
543,
3389,
4628,
565,
3625,
313,
4381,
29901,
14383,
4628,
19123,
13,
1678,
1723,
13,
1678,
1014,
16680,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
5325,
613,
302,
5085,
29922,
1191,
5510,
29889,
1525,
29032,
8032,
29892,
1371,
543,
14940,
2066,
304,
1423,
29908,
13,
1678,
1723,
13,
13,
13,
1753,
274,
9970,
29918,
22925,
29898,
2084,
1125,
13,
1678,
9995,
4300,
9632,
10944,
29899,
22925,
2224,
304,
1857,
1985,
3884,
29899,
22925,
1213,
15945,
13,
1678,
736,
2897,
29889,
2084,
29889,
2674,
2084,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1028,
547,
29889,
24772,
29889,
13506,
29892,
2224,
511,
2847,
29918,
22899,
29918,
3972,
29897,
13,
13,
13,
1753,
10683,
29918,
392,
29918,
2158,
29918,
4905,
29898,
13,
1678,
1962,
29892,
6389,
29892,
337,
29918,
5415,
29922,
276,
29889,
12198,
29898,
29878,
29908,
29985,
11891,
29974,
1125,
4197,
29900,
29899,
29929,
10062,
1125,
4968,
16920,
29922,
29878,
29908,
29912,
29900,
6177,
29912,
29896,
29913,
6160,
13,
1125,
13,
1678,
9995,
23174,
2123,
649,
411,
529,
1445,
23917,
29966,
1220,
23917,
3402,
304,
3390,
2224,
6389,
15945,
29908,
13,
1678,
396,
1596,
2582,
6198,
304,
1857,
1985,
3884,
13,
1678,
822,
14240,
29898,
4352,
1125,
13,
4706,
736,
16920,
29889,
4830,
29898,
13,
9651,
274,
9970,
29918,
22925,
29898,
4352,
29889,
2972,
29898,
29896,
8243,
334,
1761,
29898,
4352,
29889,
13155,
580,
29961,
29896,
29901,
2314,
13,
4706,
1723,
13,
13,
1678,
363,
1196,
297,
1962,
29889,
5451,
14182,
29876,
29908,
1125,
13,
4706,
565,
451,
1196,
29901,
13,
9651,
6773,
13,
4706,
565,
451,
6389,
29889,
4632,
29918,
22925,
322,
337,
29918,
5415,
29901,
13,
9651,
1196,
353,
337,
29918,
5415,
29889,
1491,
29898,
21652,
29892,
1196,
29897,
13,
4706,
1596,
703,
29871,
376,
718,
1196,
29897,
13,
13,
13,
1753,
1596,
29918,
3293,
29918,
6672,
29898,
1445,
29918,
1761,
29892,
6389,
1125,
13,
1678,
8492,
353,
518,
10154,
363,
5780,
297,
5780,
29918,
2098,
565,
679,
5552,
29898,
5085,
29892,
5780,
4638,
13,
1678,
260,
1017,
29889,
7645,
703,
27795,
3114,
12747,
373,
805,
547,
29901,
613,
376,
8391,
29901,
376,
718,
9162,
11393,
7122,
29898,
8504,
876,
13,
13,
1678,
396,
14240,
9120,
10898,
304,
274,
9970,
29918,
22925,
565,
4312,
13,
1678,
10898,
353,
518,
9507,
29889,
17010,
580,
363,
10422,
297,
934,
29918,
1761,
29962,
13,
1678,
565,
451,
6389,
29889,
4632,
29918,
22925,
29901,
13,
4706,
10898,
353,
518,
29883,
9970,
29918,
22925,
29898,
9507,
29897,
363,
10422,
297,
10898,
29962,
13,
13,
1678,
260,
1017,
29889,
7645,
703,
2111,
2164,
2066,
29901,
613,
334,
24772,
29897,
13,
1678,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
13,
1753,
1596,
29918,
10154,
29918,
6672,
29898,
10154,
1125,
13,
1678,
10876,
29889,
25393,
29889,
23126,
580,
13,
1678,
260,
1017,
29889,
7645,
703,
27795,
1273,
29879,
12747,
29908,
1273,
5780,
29897,
13,
1678,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
13,
1753,
1596,
29918,
10154,
29918,
2914,
29898,
10154,
29892,
736,
401,
1125,
13,
1678,
565,
736,
401,
1275,
29871,
29900,
29901,
13,
4706,
2927,
29889,
29883,
2158,
703,
29871,
732,
29887,
18255,
29879,
12747,
892,
5941,
5038,
1273,
5780,
29897,
13,
1678,
1683,
29901,
13,
4706,
2927,
29889,
29883,
2158,
703,
29871,
732,
29878,
18255,
29879,
1476,
4436,
5038,
1273,
5780,
29897,
13,
13,
13,
29992,
10154,
703,
29888,
433,
446,
29947,
613,
3734,
29922,
5574,
29897,
13,
1753,
1065,
29918,
29888,
433,
446,
29947,
29898,
29888,
433,
446,
29947,
29918,
9006,
29892,
934,
29918,
1761,
29892,
6389,
1125,
13,
1678,
736,
401,
353,
29871,
29900,
13,
1678,
1962,
353,
5124,
13,
1678,
396,
1065,
297,
521,
18801,
310,
29871,
29896,
29900,
29900,
472,
263,
931,
304,
4772,
1196,
3309,
4046,
13,
1678,
396,
10422,
3443,
297,
2295,
334,
13221,
451,
664,
29930,
363,
445,
12536,
2197,
13,
1678,
363,
19875,
297,
867,
283,
546,
29898,
1445,
29918,
1761,
29892,
29871,
29896,
29900,
29900,
1125,
13,
13,
4706,
1962,
353,
17422,
446,
29947,
29918,
9006,
29898,
13,
9651,
396,
671,
869,
29888,
433,
446,
29947,
27063,
304,
664,
2820,
6494,
297,
17422,
446,
29947,
701,
5461,
13,
9651,
396,
9773,
29899,
2917,
338,
17262,
565,
22974,
2917,
29952,
338,
9479,
9904,
13,
9651,
396,
1074,
29901,
2045,
597,
5559,
8205,
29889,
510,
29914,
2272,
29883,
25621,
29914,
29888,
433,
446,
29947,
24028,
29914,
12175,
29914,
29946,
29945,
29945,
13,
9651,
396,
376,
489,
2917,
21098,
29888,
433,
446,
29947,
613,
13,
9651,
334,
29812,
29892,
13,
9651,
4418,
29918,
265,
29918,
2704,
29922,
8824,
29892,
13,
9651,
1962,
29922,
710,
13,
4706,
1723,
13,
4706,
736,
401,
891,
29922,
17422,
446,
29947,
29918,
9006,
29889,
2457,
401,
13,
13,
4706,
10683,
29918,
392,
29918,
2158,
29918,
4905,
29898,
4905,
29892,
6389,
29897,
13,
13,
1678,
1596,
29918,
10154,
29918,
2914,
703,
29888,
433,
446,
29947,
613,
736,
401,
29897,
13,
1678,
736,
736,
401,
13,
13,
13,
29992,
10154,
703,
1357,
2272,
1159,
13,
1753,
1065,
29918,
1357,
2272,
29898,
1357,
2272,
29918,
9006,
29892,
934,
29918,
1761,
29892,
6389,
1125,
13,
1678,
286,
2272,
29918,
5085,
353,
6796,
489,
5113,
613,
376,
1028,
547,
613,
376,
489,
5113,
613,
376,
645,
12938,
613,
376,
489,
4294,
29899,
2704,
29899,
18137,
3108,
13,
1678,
396,
451,
3447,
29892,
817,
916,
11217,
304,
9025,
445,
13,
1678,
396,
565,
738,
4197,
275,
29918,
5113,
29898,
29888,
29897,
363,
285,
297,
934,
29918,
1761,
29962,
1125,
13,
1678,
396,
268,
286,
2272,
29918,
5085,
29889,
21843,
29898,
3366,
489,
5113,
613,
376,
8318,
20068,
13,
13,
1678,
1962,
353,
590,
2272,
29918,
9006,
10456,
1526,
29891,
29918,
5085,
29892,
4418,
29918,
265,
29918,
2704,
29922,
8824,
29892,
1962,
29922,
710,
29897,
13,
1678,
736,
401,
353,
590,
2272,
29918,
9006,
29889,
2457,
401,
13,
13,
1678,
10683,
29918,
392,
29918,
2158,
29918,
4905,
29898,
4905,
29892,
6389,
29897,
13,
13,
1678,
1596,
29918,
10154,
29918,
2914,
703,
1357,
2272,
613,
736,
401,
29897,
13,
1678,
736,
736,
401,
13,
13,
13,
29992,
10154,
703,
275,
441,
1159,
13,
1753,
1065,
29918,
275,
441,
29898,
275,
441,
29918,
9006,
29892,
934,
29918,
1761,
29892,
6389,
1125,
13,
1678,
1423,
29918,
5878,
29918,
5085,
353,
3861,
565,
6389,
29889,
5878,
1683,
4852,
489,
3198,
613,
376,
489,
12765,
1159,
13,
13,
1678,
2373,
353,
337,
29889,
12198,
703,
11432,
29901,
313,
5575,
29897,
1954,
4011,
526,
29676,
12705,
1159,
13,
1678,
16920,
353,
376,
11432,
29901,
426,
29900,
29913,
1954,
4011,
526,
29676,
12705,
29908,
13,
1678,
736,
401,
353,
29871,
29900,
13,
1678,
363,
19875,
297,
867,
283,
546,
29898,
1445,
29918,
1761,
29892,
29871,
29896,
29900,
29900,
1125,
13,
4706,
4870,
287,
29918,
5085,
353,
1423,
29918,
5878,
29918,
5085,
718,
18761,
29898,
29812,
29897,
13,
4706,
1962,
353,
338,
441,
29918,
9006,
10456,
4058,
287,
29918,
5085,
29892,
4418,
29918,
265,
29918,
2704,
29922,
8824,
29892,
1962,
29922,
710,
29892,
1059,
29922,
710,
29897,
13,
4706,
736,
401,
891,
29922,
338,
441,
29918,
9006,
29889,
2457,
401,
13,
13,
4706,
10683,
29918,
392,
29918,
2158,
29918,
4905,
29898,
4905,
29892,
6389,
29892,
2373,
29892,
16920,
29897,
13,
13,
1678,
1596,
29918,
10154,
29918,
2914,
703,
275,
441,
613,
736,
401,
29897,
13,
1678,
736,
736,
401,
13,
13,
13,
29992,
10154,
703,
8517,
1159,
13,
1753,
1065,
29918,
8517,
29898,
8517,
29918,
9006,
29892,
934,
29918,
1761,
29892,
6389,
1125,
13,
1678,
1423,
29918,
5878,
29918,
5085,
353,
3861,
565,
6389,
29889,
5878,
1683,
4852,
489,
3198,
613,
376,
489,
12765,
613,
376,
489,
2780,
1159,
13,
13,
1678,
2373,
353,
337,
29889,
12198,
703,
29893,
483,
337,
4830,
718,
28104,
25760,
13,
1678,
16920,
353,
376,
29893,
483,
337,
4830,
426,
29900,
5038,
13,
1678,
736,
401,
353,
29871,
29900,
13,
1678,
1962,
353,
5124,
13,
1678,
396,
1065,
297,
521,
18801,
310,
29871,
29896,
29900,
29900,
472,
263,
931,
304,
4772,
1196,
3309,
4046,
13,
1678,
396,
10422,
3443,
297,
2295,
334,
13221,
451,
664,
29930,
363,
445,
12536,
2197,
13,
1678,
363,
19875,
297,
867,
283,
546,
29898,
1445,
29918,
1761,
29892,
29871,
29896,
29900,
29900,
1125,
13,
4706,
4870,
287,
29918,
5085,
353,
1423,
29918,
5878,
29918,
5085,
718,
18761,
29898,
29812,
29897,
13,
4706,
1962,
353,
4628,
29918,
9006,
10456,
4058,
287,
29918,
5085,
29892,
4418,
29918,
265,
29918,
2704,
29922,
8824,
29892,
1962,
29922,
710,
29892,
1059,
29922,
710,
29897,
13,
4706,
736,
401,
891,
29922,
4628,
29918,
9006,
29889,
2457,
401,
13,
13,
4706,
10683,
29918,
392,
29918,
2158,
29918,
4905,
29898,
4905,
29892,
6389,
29892,
2373,
29892,
16920,
29897,
13,
13,
1678,
1596,
29918,
10154,
29918,
2914,
703,
8517,
613,
736,
401,
29897,
13,
1678,
736,
736,
401,
13,
13,
13,
1753,
3114,
29898,
16680,
29892,
6389,
1125,
13,
1678,
396,
4078,
2847,
1985,
3884,
363,
14215,
5281,
10898,
2678,
13,
1678,
5534,
2847,
29918,
22899,
29918,
3972,
13,
1678,
2847,
29918,
22899,
29918,
3972,
353,
2897,
29889,
657,
29883,
9970,
580,
13,
13,
1678,
934,
29918,
1761,
353,
6389,
29889,
5325,
13,
1678,
565,
934,
29918,
1761,
29901,
13,
13,
4706,
822,
10944,
29918,
22925,
29898,
2084,
1125,
13,
9651,
736,
2897,
29889,
2084,
29889,
2674,
2084,
29898,
13,
18884,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
6370,
2084,
29898,
2084,
8243,
805,
547,
29889,
24772,
29889,
13506,
13,
9651,
1723,
13,
13,
4706,
934,
29918,
1761,
353,
518,
13506,
29918,
22925,
29898,
29886,
29897,
363,
282,
297,
934,
29918,
1761,
29962,
13,
13,
1678,
736,
401,
353,
29871,
29900,
13,
1678,
411,
1985,
29918,
3972,
29898,
1028,
547,
29889,
24772,
29889,
13506,
1125,
13,
4706,
565,
451,
934,
29918,
1761,
29901,
13,
9651,
934,
29918,
1761,
353,
3939,
29918,
5325,
29898,
5085,
29889,
3188,
29892,
6389,
29889,
1657,
22282,
287,
29892,
6389,
29889,
497,
29897,
13,
4706,
1596,
29918,
3293,
29918,
6672,
29898,
1445,
29918,
1761,
29892,
6389,
29897,
13,
13,
4706,
396,
1065,
8492,
297,
1797,
3342,
297,
5780,
29918,
2098,
13,
4706,
736,
401,
353,
29871,
29900,
13,
4706,
363,
5780,
29918,
978,
297,
5780,
29918,
2098,
29901,
13,
9651,
565,
679,
5552,
29898,
5085,
29892,
5780,
29918,
978,
1125,
13,
18884,
1065,
29918,
2220,
29892,
3734,
353,
8492,
29961,
10154,
29918,
978,
29962,
13,
18884,
1596,
29918,
10154,
29918,
6672,
29898,
10154,
29918,
978,
29897,
13,
13,
18884,
9920,
353,
607,
29898,
10154,
29918,
978,
29892,
3734,
29922,
12403,
29897,
13,
18884,
565,
451,
9920,
29901,
13,
462,
1678,
2927,
29889,
29883,
2158,
703,
29871,
732,
29891,
18255,
29879,
451,
297,
23611,
29892,
14993,
2986,
5038,
1273,
5780,
29918,
978,
29897,
13,
462,
1678,
6773,
13,
13,
18884,
736,
401,
891,
29922,
1065,
29918,
2220,
29898,
9006,
29892,
934,
29918,
1761,
29892,
6389,
29897,
13,
13,
1678,
565,
736,
401,
1275,
29871,
29900,
29901,
13,
4706,
260,
1017,
29889,
7645,
29898,
2780,
29889,
2780,
675,
29475,
19740,
1028,
547,
3114,
12747,
892,
5941,
5038,
876,
13,
1678,
1683,
29901,
13,
4706,
260,
1017,
29889,
2704,
29898,
2780,
29889,
2780,
675,
29475,
19740,
1028,
547,
3114,
1476,
4436,
5038,
876,
13,
13,
1678,
736,
736,
401,
13,
2
] |
PLC/PlcValidator.py | dangxuanvuong98/pineapples_harvester | 0 | 64164 | '''
File này gồm 2 hàm kiểm tra tọa độ trước khi gửi qua serial
'''
# kiểm tra tọa độ có hợp lệ không
def plc1CoordinateValidator(raw_x, raw_y, raw_z):
#y = int(raw_y)-59-21, -59 (mép ngoài) là khoảng cách từ camera đến khung, 21 từ khung đến trục thân xilanh trục y
#231 khoảng cách hai mép trong, 59 từ cam đến mép trong, 23 từ mép trong đến cánh tay
y = 275 - int(raw_y) # chieu truc X cua camera# doi tu toa do cam sang toa do khung PLC1 #80
#x = 100-20, 100 là giới hạn một nửa khoảng thu hoạch (mép trong), 20 thân xylanh đến khung theo trục x
#14 từ cánh tay đến mép trong
x = 87 + int(raw_x) # chieu truc Y cua camera # doi tu toa do cam sang toa do khung PLC1 #184
if y < 0 and abs(y) <= 5:
y = 0
if y > 180 and y < 210 : #gán giới hạn trên trục Y
y = 185
if y > 43 and y < 58 : #gán giới hạn dưới1 trục Y
y = 51
if y >=58 and y < 65 : # gán giới hạn dưới2 trục Y
y = 55
if x <=10 : # gán giới hạn dưới trục X
x = 3
if y > 170 and x < 30: # gán giới hạn quả ngoài cùng hàng 1( gần cammera nhất)
y = 185
x = 5
if y > 145 and y<= 166 and x <= 18: # giới hạn quả ngoài cùng hàng 2
y = 145
x = 5
if int(raw_z) < 70 :
z = 3
if int(raw_z) >= 70 and int(raw_z) <= 80 :
z = 4
if int(raw_z) > 80:
z = 5
if 51 <= y <= 185 and 0 <= x <= 87:
# Nếu nằm trong tầm cắt trả về tọa độ
return {'x': x, 'y': y, 'z': z}
# Không nằm trong tầm cắt thì không trả về gì
return None
# kiểm tra tọa độ có hợp lệ không
def plc2CoordinateValidator(raw_x, raw_y, raw_z):
#y = int(raw_y)-59-21, -59 (mép ngoài) là khoảng cách từ camera đến khung, 21 từ khung đến trục thân xilanh trục y
#231 khoảng cách hai mép trong, 59 từ cam đến mép trong, 23 từ mép trong đến cánh tay
y = 275 - int(raw_y) # chieu truc X cua camera# doi tu toa do cam sang toa do khung PLC1 #80
#x = 100-20, 100 là giới hạn một nửa khoảng thu hoạch (mép trong), 20 thân xylanh đến khung theo trục x
#14 từ cánh tay đến mép trong
x = 87 - int(raw_x) # chieu truc Y cua camera # doi tu toa do cam sang toa do khung PLC1 #184
if y < 0 and abs(y) <= 5:
y = 0
if y > 180 and y < 210 : #gán giới hạn trên trục Y
y = 185
if y > 43 and y < 58 : #gán giới hạn dưới1 trục Y
y = 51
if y >=58 and y < 65 : # gán giới hạn dưới2 trục Y
y = 55
if x <=10 : # gán giới hạn dưới trục X
x = 3
if y > 170 and x < 30: # gán giới hạn quả ngoài cùng hàng 1( gần cammera nhất)
y = 185
x = 5
if y > 145 and y<= 166 and x <= 18: # giới hạn quả ngoài cùng hàng 2
y = 145
x = 5
if int(raw_z) < 70 :
z = 3
if int(raw_z) >= 70 and int(raw_z) <= 80 :
z = 4
if int(raw_z) > 80:
z = 5
if 51 <= y <= 185 and 0 <= x <= 75:
# Nếu nằm trong tầm cắt trả về tọa độ
return {'x': x, 'y': y, 'z': z}
# Không nằm trong tầm cắt thì không trả về gì
return None | [
1,
14550,
13,
2283,
302,
30001,
29891,
330,
30926,
29885,
29871,
29906,
298,
30001,
29885,
8506,
31957,
29885,
1020,
260,
30975,
29874,
29871,
30128,
30902,
534,
30416,
31280,
29883,
413,
2918,
330,
228,
190,
176,
29875,
439,
29874,
7797,
13,
12008,
13,
29937,
8506,
31957,
29885,
1020,
260,
30975,
29874,
29871,
30128,
30902,
28810,
298,
31645,
29886,
301,
30529,
413,
29882,
30069,
865,
13,
1753,
715,
29883,
29896,
7967,
16065,
24204,
29898,
1610,
29918,
29916,
29892,
10650,
29918,
29891,
29892,
10650,
29918,
29920,
1125,
13,
1678,
396,
29891,
353,
938,
29898,
1610,
29918,
29891,
6817,
29945,
29929,
29899,
29906,
29896,
29892,
448,
29945,
29929,
313,
29885,
6430,
302,
1484,
30001,
29875,
29897,
18916,
413,
1251,
30643,
865,
274,
18549,
260,
228,
190,
174,
10656,
29871,
30128,
30717,
29876,
413,
18808,
29892,
29871,
29906,
29896,
260,
228,
190,
174,
413,
18808,
29871,
30128,
30717,
29876,
534,
31620,
29883,
266,
10031,
921,
309,
27731,
534,
31620,
29883,
343,
13,
1678,
396,
29906,
29941,
29896,
413,
1251,
30643,
865,
274,
18549,
447,
29875,
286,
6430,
534,
549,
29892,
29871,
29945,
29929,
260,
228,
190,
174,
3949,
29871,
30128,
30717,
29876,
286,
6430,
534,
549,
29892,
29871,
29906,
29941,
260,
228,
190,
174,
286,
6430,
534,
549,
29871,
30128,
30717,
29876,
274,
1715,
29882,
260,
388,
13,
1678,
343,
353,
29871,
29906,
29955,
29945,
29871,
448,
938,
29898,
1610,
29918,
29891,
29897,
1678,
396,
521,
9532,
534,
1682,
1060,
2723,
29874,
10656,
29937,
13102,
5291,
304,
29874,
437,
3949,
13625,
304,
29874,
437,
413,
18808,
349,
12182,
29896,
396,
29947,
29900,
13,
1678,
396,
29916,
353,
29871,
29896,
29900,
29900,
29899,
29906,
29900,
29892,
29871,
29896,
29900,
29900,
18916,
4005,
31280,
29875,
298,
30540,
29876,
286,
30902,
29873,
302,
228,
190,
176,
29874,
413,
1251,
30643,
865,
266,
29884,
5089,
30540,
305,
313,
29885,
6430,
534,
549,
511,
29871,
29906,
29900,
266,
10031,
921,
2904,
27731,
29871,
30128,
30717,
29876,
413,
18808,
278,
29877,
534,
31620,
29883,
921,
13,
1678,
396,
29896,
29946,
260,
228,
190,
174,
274,
1715,
29882,
260,
388,
29871,
30128,
30717,
29876,
286,
6430,
534,
549,
13,
1678,
921,
353,
29871,
29947,
29955,
718,
938,
29898,
1610,
29918,
29916,
29897,
259,
396,
521,
9532,
534,
1682,
612,
2723,
29874,
10656,
396,
13102,
5291,
304,
29874,
437,
3949,
13625,
304,
29874,
437,
413,
18808,
349,
12182,
29896,
396,
29896,
29947,
29946,
13,
1678,
565,
343,
529,
29871,
29900,
322,
6425,
29898,
29891,
29897,
5277,
29871,
29945,
29901,
13,
4706,
343,
353,
29871,
29900,
13,
1678,
565,
343,
1405,
29871,
29896,
29947,
29900,
322,
343,
529,
29871,
29906,
29896,
29900,
584,
396,
29887,
1715,
4005,
31280,
29875,
298,
30540,
29876,
534,
5512,
534,
31620,
29883,
612,
13,
4706,
343,
353,
29871,
29896,
29947,
29945,
13,
1678,
565,
343,
1405,
29871,
29946,
29941,
322,
343,
529,
29871,
29945,
29947,
584,
259,
396,
29887,
1715,
4005,
31280,
29875,
298,
30540,
29876,
270,
30416,
31280,
29875,
29896,
534,
31620,
29883,
612,
13,
4706,
343,
353,
29871,
29945,
29896,
13,
1678,
565,
343,
6736,
29945,
29947,
322,
343,
529,
29871,
29953,
29945,
584,
259,
396,
330,
1715,
4005,
31280,
29875,
298,
30540,
29876,
270,
30416,
31280,
29875,
29906,
534,
31620,
29883,
612,
13,
4706,
343,
353,
29871,
29945,
29945,
13,
1678,
565,
921,
5277,
29896,
29900,
29871,
584,
396,
330,
1715,
4005,
31280,
29875,
298,
30540,
29876,
270,
30416,
31280,
29875,
534,
31620,
29883,
1060,
13,
4706,
921,
353,
29871,
29941,
13,
1678,
565,
343,
1405,
29871,
29896,
29955,
29900,
322,
921,
529,
29871,
29941,
29900,
29901,
396,
330,
1715,
4005,
31280,
29875,
298,
30540,
29876,
439,
30643,
302,
1484,
30001,
29875,
274,
30071,
865,
298,
30001,
865,
29871,
29896,
29898,
330,
30884,
29876,
3949,
1050,
29874,
302,
29882,
31145,
29873,
29897,
13,
4706,
343,
353,
29871,
29896,
29947,
29945,
13,
4706,
921,
353,
29871,
29945,
13,
1678,
565,
343,
1405,
29871,
29896,
29946,
29945,
322,
343,
14065,
29871,
29896,
29953,
29953,
322,
921,
5277,
29871,
29896,
29947,
29901,
396,
4005,
31280,
29875,
298,
30540,
29876,
439,
30643,
302,
1484,
30001,
29875,
274,
30071,
865,
298,
30001,
865,
29871,
29906,
13,
4706,
343,
353,
29871,
29896,
29946,
29945,
13,
4706,
921,
353,
29871,
29945,
13,
1678,
565,
938,
29898,
1610,
29918,
29920,
29897,
529,
29871,
29955,
29900,
584,
13,
4706,
503,
353,
29871,
29941,
13,
1678,
565,
938,
29898,
1610,
29918,
29920,
29897,
6736,
29871,
29955,
29900,
322,
938,
29898,
1610,
29918,
29920,
29897,
5277,
29871,
29947,
29900,
584,
13,
4706,
503,
353,
29871,
29946,
13,
1678,
565,
938,
29898,
1610,
29918,
29920,
29897,
1405,
29871,
29947,
29900,
29901,
13,
4706,
503,
353,
29871,
29945,
13,
1678,
565,
29871,
29945,
29896,
5277,
343,
5277,
29871,
29896,
29947,
29945,
322,
259,
29900,
5277,
921,
5277,
29871,
29947,
29955,
29901,
13,
4706,
396,
405,
30717,
29884,
302,
228,
189,
180,
29885,
534,
549,
260,
30884,
29885,
274,
31160,
29873,
534,
30643,
325,
31343,
260,
30975,
29874,
29871,
30128,
30902,
13,
4706,
736,
11117,
29916,
2396,
921,
29892,
525,
29891,
2396,
343,
29892,
525,
29920,
2396,
503,
29913,
13,
1678,
396,
12217,
30069,
865,
302,
228,
189,
180,
29885,
534,
549,
260,
30884,
29885,
274,
31160,
29873,
266,
30097,
413,
29882,
30069,
865,
534,
30643,
325,
31343,
330,
30097,
13,
1678,
736,
6213,
13,
13,
29937,
8506,
31957,
29885,
1020,
260,
30975,
29874,
29871,
30128,
30902,
28810,
298,
31645,
29886,
301,
30529,
413,
29882,
30069,
865,
13,
1753,
715,
29883,
29906,
7967,
16065,
24204,
29898,
1610,
29918,
29916,
29892,
10650,
29918,
29891,
29892,
10650,
29918,
29920,
1125,
13,
1678,
396,
29891,
353,
938,
29898,
1610,
29918,
29891,
6817,
29945,
29929,
29899,
29906,
29896,
29892,
448,
29945,
29929,
313,
29885,
6430,
302,
1484,
30001,
29875,
29897,
18916,
413,
1251,
30643,
865,
274,
18549,
260,
228,
190,
174,
10656,
29871,
30128,
30717,
29876,
413,
18808,
29892,
29871,
29906,
29896,
260,
228,
190,
174,
413,
18808,
29871,
30128,
30717,
29876,
534,
31620,
29883,
266,
10031,
921,
309,
27731,
534,
31620,
29883,
343,
13,
1678,
396,
29906,
29941,
29896,
413,
1251,
30643,
865,
274,
18549,
447,
29875,
286,
6430,
534,
549,
29892,
29871,
29945,
29929,
260,
228,
190,
174,
3949,
29871,
30128,
30717,
29876,
286,
6430,
534,
549,
29892,
29871,
29906,
29941,
260,
228,
190,
174,
286,
6430,
534,
549,
29871,
30128,
30717,
29876,
274,
1715,
29882,
260,
388,
13,
1678,
343,
353,
29871,
29906,
29955,
29945,
29871,
448,
938,
29898,
1610,
29918,
29891,
29897,
1678,
396,
521,
9532,
534,
1682,
1060,
2723,
29874,
10656,
29937,
13102,
5291,
304,
29874,
437,
3949,
13625,
304,
29874,
437,
413,
18808,
349,
12182,
29896,
396,
29947,
29900,
13,
1678,
396,
29916,
353,
29871,
29896,
29900,
29900,
29899,
29906,
29900,
29892,
29871,
29896,
29900,
29900,
18916,
4005,
31280,
29875,
298,
30540,
29876,
286,
30902,
29873,
302,
228,
190,
176,
29874,
413,
1251,
30643,
865,
266,
29884,
5089,
30540,
305,
313,
29885,
6430,
534,
549,
511,
29871,
29906,
29900,
266,
10031,
921,
2904,
27731,
29871,
30128,
30717,
29876,
413,
18808,
278,
29877,
534,
31620,
29883,
921,
13,
1678,
396,
29896,
29946,
260,
228,
190,
174,
274,
1715,
29882,
260,
388,
29871,
30128,
30717,
29876,
286,
6430,
534,
549,
13,
1678,
921,
353,
29871,
29947,
29955,
448,
938,
29898,
1610,
29918,
29916,
29897,
259,
396,
521,
9532,
534,
1682,
612,
2723,
29874,
10656,
396,
13102,
5291,
304,
29874,
437,
3949,
13625,
304,
29874,
437,
413,
18808,
349,
12182,
29896,
396,
29896,
29947,
29946,
13,
1678,
565,
343,
529,
29871,
29900,
322,
6425,
29898,
29891,
29897,
5277,
29871,
29945,
29901,
13,
4706,
343,
353,
29871,
29900,
13,
1678,
565,
343,
1405,
29871,
29896,
29947,
29900,
322,
343,
529,
29871,
29906,
29896,
29900,
584,
396,
29887,
1715,
4005,
31280,
29875,
298,
30540,
29876,
534,
5512,
534,
31620,
29883,
612,
13,
4706,
343,
353,
29871,
29896,
29947,
29945,
13,
1678,
565,
343,
1405,
29871,
29946,
29941,
322,
343,
529,
29871,
29945,
29947,
584,
259,
396,
29887,
1715,
4005,
31280,
29875,
298,
30540,
29876,
270,
30416,
31280,
29875,
29896,
534,
31620,
29883,
612,
13,
4706,
343,
353,
29871,
29945,
29896,
13,
1678,
565,
343,
6736,
29945,
29947,
322,
343,
529,
29871,
29953,
29945,
584,
259,
396,
330,
1715,
4005,
31280,
29875,
298,
30540,
29876,
270,
30416,
31280,
29875,
29906,
534,
31620,
29883,
612,
13,
4706,
343,
353,
29871,
29945,
29945,
13,
1678,
565,
921,
5277,
29896,
29900,
29871,
584,
396,
330,
1715,
4005,
31280,
29875,
298,
30540,
29876,
270,
30416,
31280,
29875,
534,
31620,
29883,
1060,
13,
4706,
921,
353,
29871,
29941,
13,
1678,
565,
343,
1405,
29871,
29896,
29955,
29900,
322,
921,
529,
29871,
29941,
29900,
29901,
396,
330,
1715,
4005,
31280,
29875,
298,
30540,
29876,
439,
30643,
302,
1484,
30001,
29875,
274,
30071,
865,
298,
30001,
865,
29871,
29896,
29898,
330,
30884,
29876,
3949,
1050,
29874,
302,
29882,
31145,
29873,
29897,
13,
4706,
343,
353,
29871,
29896,
29947,
29945,
13,
4706,
921,
353,
29871,
29945,
13,
1678,
565,
343,
1405,
29871,
29896,
29946,
29945,
322,
343,
14065,
29871,
29896,
29953,
29953,
322,
921,
5277,
29871,
29896,
29947,
29901,
396,
4005,
31280,
29875,
298,
30540,
29876,
439,
30643,
302,
1484,
30001,
29875,
274,
30071,
865,
298,
30001,
865,
29871,
29906,
13,
4706,
343,
353,
29871,
29896,
29946,
29945,
13,
4706,
921,
353,
29871,
29945,
13,
1678,
565,
938,
29898,
1610,
29918,
29920,
29897,
529,
29871,
29955,
29900,
584,
13,
4706,
503,
353,
29871,
29941,
13,
1678,
565,
938,
29898,
1610,
29918,
29920,
29897,
6736,
29871,
29955,
29900,
322,
938,
29898,
1610,
29918,
29920,
29897,
5277,
29871,
29947,
29900,
584,
13,
4706,
503,
353,
29871,
29946,
13,
1678,
565,
938,
29898,
1610,
29918,
29920,
29897,
1405,
29871,
29947,
29900,
29901,
13,
4706,
503,
353,
29871,
29945,
13,
1678,
565,
29871,
29945,
29896,
5277,
343,
5277,
29871,
29896,
29947,
29945,
322,
259,
29900,
5277,
921,
5277,
29871,
29955,
29945,
29901,
13,
4706,
396,
405,
30717,
29884,
302,
228,
189,
180,
29885,
534,
549,
260,
30884,
29885,
274,
31160,
29873,
534,
30643,
325,
31343,
260,
30975,
29874,
29871,
30128,
30902,
13,
4706,
736,
11117,
29916,
2396,
921,
29892,
525,
29891,
2396,
343,
29892,
525,
29920,
2396,
503,
29913,
13,
1678,
396,
12217,
30069,
865,
302,
228,
189,
180,
29885,
534,
549,
260,
30884,
29885,
274,
31160,
29873,
266,
30097,
413,
29882,
30069,
865,
534,
30643,
325,
31343,
330,
30097,
13,
1678,
736,
6213,
2
] |
Algorithms/sway_discrete.py | Ginfung/sway | 0 | 58261 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2016, <NAME> <<EMAIL>>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# 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.
from __future__ import division
from Algorithms.sway_sampler import sway, cont_dominate
from gmpy2 import popcount, mpz
import random
def count1(decint):
return popcount(mpz(decint))
def split_products(pop, groupC=5):
rand = random.choice(pop)
center = count1(int(rand, 2))
workloads = list()
dists = list()
for p in pop:
wl = count1(int(p, 2))
dist = count1(wl ^ center)
workloads.append(wl)
dists.append(dist)
poptuple = [(p, i, j) for p, i, j in zip(pop, workloads, dists)]
# sort by the workloads
poptuple = sorted(poptuple, key=lambda i:i[1])
n = int(len(poptuple)/groupC)
groups = [poptuple[i*n:i*n+n] for i in range(groupC)]
west, east, westItems, eastItems = list(), list(), list(), list()
for g in groups:
k = sorted(g, key=lambda i:i[2])
# filling the answers
west.append(k[0][0])
east.append(k[-1][0])
westItems.extend(map(lambda i: i[0], k[:len(k)//2]))
eastItems.extend(map(lambda i: i[0], k[len(k)//2:]))
return west, east, westItems, eastItems
def comparing(part1, part2):
onewin = 0
twowin = 0
for i, j in zip(part1, part2):
if cont_dominate(i, j) > 0:
onewin += 1
else:
twowin += 1
return onewin >= twowin
def optimize(init_pop, eval_func):
import warnings
warnings.filterwarnings('ignore')
return sway(init_pop, eval_func, split_products, comparing) | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29953,
29892,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
325,
326,
29901,
731,
18696,
29922,
29946,
380,
29879,
29922,
29946,
2381,
29922,
29946,
7985,
3891,
15040,
12860,
29901,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
29871,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
29871,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
29871,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
29871,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
29871,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
13,
29937,
29871,
599,
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,
29871,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
29871,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
29871,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
29937,
29871,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
29937,
29871,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
13,
29937,
29871,
6093,
7791,
7818,
12982,
1525,
29889,
13,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
11545,
12404,
29889,
29879,
1582,
29918,
13445,
20069,
1053,
269,
1582,
29892,
640,
29918,
3129,
16976,
13,
3166,
330,
1526,
29891,
29906,
1053,
1835,
2798,
29892,
22326,
29920,
13,
5215,
4036,
13,
13,
13,
1753,
2302,
29896,
29898,
7099,
524,
1125,
13,
1678,
736,
1835,
2798,
29898,
1526,
29920,
29898,
7099,
524,
876,
13,
13,
13,
1753,
6219,
29918,
14456,
29898,
7323,
29892,
2318,
29907,
29922,
29945,
1125,
13,
1678,
20088,
353,
4036,
29889,
16957,
29898,
7323,
29897,
13,
1678,
4818,
353,
2302,
29896,
29898,
524,
29898,
9502,
29892,
29871,
29906,
876,
13,
13,
1678,
664,
18132,
353,
1051,
580,
13,
1678,
1320,
29879,
353,
1051,
580,
13,
1678,
363,
282,
297,
1835,
29901,
13,
4706,
281,
29880,
353,
2302,
29896,
29898,
524,
29898,
29886,
29892,
29871,
29906,
876,
13,
4706,
1320,
353,
2302,
29896,
29898,
29893,
29880,
6228,
4818,
29897,
13,
4706,
664,
18132,
29889,
4397,
29898,
29893,
29880,
29897,
13,
4706,
1320,
29879,
29889,
4397,
29898,
5721,
29897,
13,
13,
1678,
772,
415,
29884,
552,
353,
17288,
29886,
29892,
474,
29892,
432,
29897,
363,
282,
29892,
474,
29892,
432,
297,
14319,
29898,
7323,
29892,
664,
18132,
29892,
1320,
29879,
4638,
13,
13,
1678,
396,
2656,
491,
278,
664,
18132,
13,
1678,
772,
415,
29884,
552,
353,
12705,
29898,
1129,
415,
29884,
552,
29892,
1820,
29922,
2892,
474,
29901,
29875,
29961,
29896,
2314,
13,
13,
1678,
302,
353,
938,
29898,
2435,
29898,
1129,
415,
29884,
552,
6802,
2972,
29907,
29897,
13,
1678,
6471,
353,
518,
1129,
415,
29884,
552,
29961,
29875,
29930,
29876,
29901,
29875,
29930,
29876,
29974,
29876,
29962,
363,
474,
297,
3464,
29898,
2972,
29907,
4638,
13,
13,
1678,
5833,
29892,
9755,
29892,
5833,
6913,
29892,
9755,
6913,
353,
1051,
3285,
1051,
3285,
1051,
3285,
1051,
580,
13,
13,
1678,
363,
330,
297,
6471,
29901,
13,
4706,
413,
353,
12705,
29898,
29887,
29892,
1820,
29922,
2892,
474,
29901,
29875,
29961,
29906,
2314,
13,
13,
4706,
396,
27523,
278,
6089,
13,
4706,
5833,
29889,
4397,
29898,
29895,
29961,
29900,
3816,
29900,
2314,
13,
4706,
9755,
29889,
4397,
29898,
29895,
14352,
29896,
3816,
29900,
2314,
13,
4706,
5833,
6913,
29889,
21843,
29898,
1958,
29898,
2892,
474,
29901,
474,
29961,
29900,
1402,
413,
7503,
2435,
29898,
29895,
29897,
458,
29906,
12622,
13,
4706,
9755,
6913,
29889,
21843,
29898,
1958,
29898,
2892,
474,
29901,
474,
29961,
29900,
1402,
413,
29961,
2435,
29898,
29895,
29897,
458,
29906,
29901,
12622,
13,
13,
1678,
736,
5833,
29892,
9755,
29892,
5833,
6913,
29892,
9755,
6913,
13,
13,
13,
1753,
17420,
29898,
1595,
29896,
29892,
760,
29906,
1125,
13,
1678,
697,
5080,
353,
29871,
29900,
13,
1678,
3252,
340,
262,
353,
29871,
29900,
13,
13,
1678,
363,
474,
29892,
432,
297,
14319,
29898,
1595,
29896,
29892,
760,
29906,
1125,
13,
4706,
565,
640,
29918,
3129,
16976,
29898,
29875,
29892,
432,
29897,
1405,
29871,
29900,
29901,
13,
9651,
697,
5080,
4619,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
3252,
340,
262,
4619,
29871,
29896,
13,
13,
1678,
736,
697,
5080,
6736,
3252,
340,
262,
13,
13,
13,
1753,
24656,
29898,
2344,
29918,
7323,
29892,
19745,
29918,
9891,
1125,
13,
1678,
1053,
18116,
13,
1678,
18116,
29889,
4572,
25442,
886,
877,
17281,
1495,
13,
1678,
736,
269,
1582,
29898,
2344,
29918,
7323,
29892,
19745,
29918,
9891,
29892,
6219,
29918,
14456,
29892,
17420,
29897,
2
] |
2016/day01/day01-pt1.py | mcbor/advent_of_code_2016 | 1 | 167824 | #!/usr/bin/env python3
# Advent of Code 2016 - Day 1
# Using turtle graphics to find the location of Easter Bunny HQ.
# It's slow, but draws pretty maps.
import sys
import turtle
if len(sys.argv) < 2:
print("Usage: {} puzzle.txt".format(sys.argv[0]))
sys.exit(1)
with open(sys.argv[1]) as f:
# init turtle to face north
turtle.speed('fastest')
turtle.home()
turtle.setheading(90)
for line in f:
if line[0] == '#':
# skip comments
continue
steps = line.split()
for step in map(str.strip, line.split(',')):
if step[0] == 'R':
turtle.right(90)
elif step[0] == 'L':
turtle.left(90)
else:
print("don't know about", step[0])
sys.exit(1)
turtle.forward(int(step[1:]))
print(step + ": " + str(turtle.position()))
print("Stopped at {}, Distance: {}".format(str(turtle.position()), round(abs(turtle.xcor()) + abs(turtle.ycor()))))
input("Press any key to exit...") | [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
21255,
310,
5920,
29871,
29906,
29900,
29896,
29953,
448,
8373,
29871,
29896,
13,
29937,
5293,
260,
4227,
280,
18533,
304,
1284,
278,
4423,
310,
382,
1901,
27105,
1460,
379,
29984,
29889,
13,
29937,
739,
29915,
29879,
5232,
29892,
541,
4216,
29879,
5051,
11053,
29889,
13,
13,
5215,
10876,
13,
5215,
260,
4227,
280,
13,
13,
361,
7431,
29898,
9675,
29889,
19218,
29897,
529,
29871,
29906,
29901,
13,
1678,
1596,
703,
27573,
29901,
6571,
20285,
280,
29889,
3945,
1642,
4830,
29898,
9675,
29889,
19218,
29961,
29900,
12622,
13,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
2541,
1722,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
408,
285,
29901,
13,
1678,
396,
2069,
260,
4227,
280,
304,
3700,
6641,
13,
1678,
260,
4227,
280,
29889,
19322,
877,
11255,
342,
1495,
13,
1678,
260,
4227,
280,
29889,
5184,
580,
13,
1678,
260,
4227,
280,
29889,
842,
2813,
292,
29898,
29929,
29900,
29897,
13,
308,
13,
1678,
363,
1196,
297,
285,
29901,
13,
4706,
565,
1196,
29961,
29900,
29962,
1275,
16321,
2396,
13,
9651,
396,
14383,
6589,
13,
9651,
6773,
13,
4706,
6576,
353,
1196,
29889,
5451,
580,
13,
4706,
363,
4331,
297,
2910,
29898,
710,
29889,
17010,
29892,
1196,
29889,
5451,
29898,
3788,
22164,
13,
9651,
565,
4331,
29961,
29900,
29962,
1275,
525,
29934,
2396,
13,
18884,
260,
4227,
280,
29889,
1266,
29898,
29929,
29900,
29897,
13,
9651,
25342,
4331,
29961,
29900,
29962,
1275,
525,
29931,
2396,
13,
18884,
260,
4227,
280,
29889,
1563,
29898,
29929,
29900,
29897,
13,
9651,
1683,
29901,
13,
18884,
1596,
703,
9176,
29915,
29873,
1073,
1048,
613,
4331,
29961,
29900,
2314,
13,
18884,
10876,
29889,
13322,
29898,
29896,
29897,
13,
9651,
260,
4227,
280,
29889,
11333,
29898,
524,
29898,
10568,
29961,
29896,
29901,
12622,
13,
9651,
1596,
29898,
10568,
718,
29242,
376,
718,
851,
29898,
29873,
4227,
280,
29889,
3283,
22130,
13,
1678,
1596,
703,
20754,
2986,
472,
24335,
6652,
749,
29901,
6571,
1642,
4830,
29898,
710,
29898,
29873,
4227,
280,
29889,
3283,
25739,
4513,
29898,
6897,
29898,
29873,
4227,
280,
29889,
29916,
2616,
3101,
718,
6425,
29898,
29873,
4227,
280,
29889,
29891,
2616,
580,
13697,
13,
1678,
1881,
703,
10923,
738,
1820,
304,
6876,
856,
1159,
2
] |
tests/test_naivetrack_methods.py | erasmus-center-for-biomics/Nimbus | 4 | 79013 | #!/bin/env python
import StringIO
import unittest
import naivetrack
import naivetrack.utils
class TestNaivetrackSummaries(unittest.TestCase):
def setUp(self):
# we will use a global chromosome list
self.chromosome_list = []
self.file = StringIO.StringIO("""#
#
chr1\t2\tT\t2\t10\t50
\tG\t4\t20\tsample_1, forward
\tT\t6\t30\tsample_1, forward
chr1\t20000\tT\t3\t40\t130
\tA\t20\t60\tsample_1, forward
\tA\t10\t30\tsample_1, reverse
\tG\t10\t40\tsample_1, forward
""")
def runTest(self):
parser = naivetrack.TrackParser(chromosome_list=self.chromosome_list)
parser.register_handle(self.file)
parser.set_maximum_chromosome_size(500000)
entry = parser.next()
rval = naivetrack.utils.aggregate_allele_information(
entry, attributes=[
naivetrack.models.AlleleFactors["Sample"],
naivetrack.models.AlleleFactors["Allele"]
])
self.assertIn("sample_1", rval.keys())
self.assertIn("T", rval["sample_1"].keys())
self.assertIn("G", rval["sample_1"].keys())
self.assertIn("__qual__", rval["sample_1"]["T"].keys())
self.assertIn("__depth__", rval["sample_1"]["T"].keys())
self.assertIn("__n__", rval["sample_1"]["T"].keys())
self.assertIn("__qual__", rval["sample_1"]["G"].keys())
self.assertIn("__depth__", rval["sample_1"]["G"].keys())
self.assertIn("__n__", rval["sample_1"]["G"].keys())
self.assertEqual(rval["sample_1"]["T"]["__qual__"], 30)
self.assertEqual(rval["sample_1"]["G"]["__qual__"], 20)
self.assertEqual(rval["sample_1"]["T"]["__depth__"], 6)
self.assertEqual(rval["sample_1"]["G"]["__depth__"], 4)
self.assertEqual(rval["sample_1"]["T"]["__n__"], 1)
self.assertEqual(rval["sample_1"]["G"]["__n__"], 1)
summarize = naivetrack.SummarizeEntries()
rval = summarize(parser.next())
self.assertIn("A", rval.keys())
self.assertIn("G", rval.keys())
self.assertEqual(rval["A"]["sample_1"]["__quality__"], 90)
self.assertEqual(rval["A"]["sample_1"]["__depth__"], 30)
# print rval
def tearDown(self):
pass
| [
1,
18787,
2109,
29914,
6272,
3017,
13,
13,
5215,
1714,
5971,
13,
5215,
443,
27958,
13,
5215,
1055,
440,
300,
22282,
13,
5215,
1055,
440,
300,
22282,
29889,
13239,
13,
13,
13,
1990,
4321,
13695,
440,
300,
22282,
11139,
3034,
583,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
396,
591,
674,
671,
263,
5534,
25173,
359,
608,
1051,
13,
4706,
1583,
29889,
27433,
359,
608,
29918,
1761,
353,
5159,
13,
4706,
1583,
29889,
1445,
353,
1714,
5971,
29889,
1231,
5971,
703,
15945,
29937,
13,
29937,
13,
22495,
29896,
29905,
29873,
29906,
29905,
29873,
29911,
29905,
29873,
29906,
29905,
29873,
29896,
29900,
29905,
29873,
29945,
29900,
13,
29905,
29873,
29954,
29905,
29873,
29946,
29905,
29873,
29906,
29900,
29905,
1372,
981,
29918,
29896,
29892,
6375,
13,
29905,
29873,
29911,
29905,
29873,
29953,
29905,
29873,
29941,
29900,
29905,
1372,
981,
29918,
29896,
29892,
6375,
13,
22495,
29896,
29905,
29873,
29906,
29900,
29900,
29900,
29900,
29905,
29873,
29911,
29905,
29873,
29941,
29905,
29873,
29946,
29900,
29905,
29873,
29896,
29941,
29900,
13,
29905,
29873,
29909,
29905,
29873,
29906,
29900,
29905,
29873,
29953,
29900,
29905,
1372,
981,
29918,
29896,
29892,
6375,
13,
29905,
29873,
29909,
29905,
29873,
29896,
29900,
29905,
29873,
29941,
29900,
29905,
1372,
981,
29918,
29896,
29892,
11837,
13,
29905,
29873,
29954,
29905,
29873,
29896,
29900,
29905,
29873,
29946,
29900,
29905,
1372,
981,
29918,
29896,
29892,
6375,
13,
15945,
1159,
13,
13,
1678,
822,
1065,
3057,
29898,
1311,
1125,
13,
4706,
13812,
353,
1055,
440,
300,
22282,
29889,
17936,
11726,
29898,
27433,
359,
608,
29918,
1761,
29922,
1311,
29889,
27433,
359,
608,
29918,
1761,
29897,
13,
4706,
13812,
29889,
9573,
29918,
8411,
29898,
1311,
29889,
1445,
29897,
13,
4706,
13812,
29889,
842,
29918,
27525,
398,
29918,
27433,
359,
608,
29918,
2311,
29898,
29945,
29900,
29900,
29900,
29900,
29900,
29897,
13,
13,
4706,
6251,
353,
13812,
29889,
4622,
580,
13,
4706,
364,
791,
353,
1055,
440,
300,
22282,
29889,
13239,
29889,
26193,
403,
29918,
3498,
280,
29918,
19678,
29898,
13,
9651,
6251,
29892,
8393,
11759,
13,
18884,
1055,
440,
300,
22282,
29889,
9794,
29889,
2499,
280,
280,
20738,
943,
3366,
17708,
12436,
13,
18884,
1055,
440,
300,
22282,
29889,
9794,
29889,
2499,
280,
280,
20738,
943,
3366,
2499,
280,
280,
3108,
13,
462,
2314,
13,
13,
4706,
1583,
29889,
9294,
797,
703,
11249,
29918,
29896,
613,
364,
791,
29889,
8149,
3101,
13,
13,
4706,
1583,
29889,
9294,
797,
703,
29911,
613,
364,
791,
3366,
11249,
29918,
29896,
16862,
8149,
3101,
13,
4706,
1583,
29889,
9294,
797,
703,
29954,
613,
364,
791,
3366,
11249,
29918,
29896,
16862,
8149,
3101,
13,
13,
4706,
1583,
29889,
9294,
797,
703,
1649,
15380,
1649,
613,
364,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29911,
16862,
8149,
3101,
13,
4706,
1583,
29889,
9294,
797,
703,
1649,
19488,
1649,
613,
364,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29911,
16862,
8149,
3101,
13,
4706,
1583,
29889,
9294,
797,
703,
1649,
29876,
1649,
613,
364,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29911,
16862,
8149,
3101,
13,
13,
4706,
1583,
29889,
9294,
797,
703,
1649,
15380,
1649,
613,
364,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29954,
16862,
8149,
3101,
13,
4706,
1583,
29889,
9294,
797,
703,
1649,
19488,
1649,
613,
364,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29954,
16862,
8149,
3101,
13,
4706,
1583,
29889,
9294,
797,
703,
1649,
29876,
1649,
613,
364,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29954,
16862,
8149,
3101,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29911,
3108,
3366,
1649,
15380,
1649,
12436,
29871,
29941,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29954,
3108,
3366,
1649,
15380,
1649,
12436,
29871,
29906,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29911,
3108,
3366,
1649,
19488,
1649,
12436,
29871,
29953,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29954,
3108,
3366,
1649,
19488,
1649,
12436,
29871,
29946,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29911,
3108,
3366,
1649,
29876,
1649,
12436,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
11249,
29918,
29896,
3108,
3366,
29954,
3108,
3366,
1649,
29876,
1649,
12436,
29871,
29896,
29897,
13,
13,
4706,
19138,
675,
353,
1055,
440,
300,
22282,
29889,
11139,
3034,
675,
5292,
2722,
580,
13,
4706,
364,
791,
353,
19138,
675,
29898,
16680,
29889,
4622,
3101,
13,
4706,
1583,
29889,
9294,
797,
703,
29909,
613,
364,
791,
29889,
8149,
3101,
13,
4706,
1583,
29889,
9294,
797,
703,
29954,
613,
364,
791,
29889,
8149,
3101,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
29909,
3108,
3366,
11249,
29918,
29896,
3108,
3366,
1649,
29567,
1649,
12436,
29871,
29929,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29878,
791,
3366,
29909,
3108,
3366,
11249,
29918,
29896,
3108,
3366,
1649,
19488,
1649,
12436,
29871,
29941,
29900,
29897,
13,
4706,
396,
1596,
364,
791,
13,
13,
1678,
822,
734,
279,
6767,
29898,
1311,
1125,
13,
4706,
1209,
13,
13,
2
] |
util/sessions.py | MaiRachlevsky/Inspyre | 1 | 1618044 | def set_ret_path(session, path):
"""Set the return path in session `session` to `path`"""
session['ret_path'] = path
def clear_ret_path(session):
"""Clear return path in session `session` if it exists"""
if 'ret_path' in session:
del session['ret_path']
def use_ret_path(session):
"""Return and delete return path from session `session` if it exists"""
if 'ret_path' in session:
ret_path = session['ret_path']
del session['ret_path']
else:
ret_path = None
return ret_path
| [
1,
822,
731,
29918,
2267,
29918,
2084,
29898,
7924,
29892,
2224,
1125,
13,
1678,
9995,
2697,
278,
736,
2224,
297,
4867,
421,
7924,
29952,
304,
421,
2084,
29952,
15945,
29908,
13,
1678,
4867,
1839,
2267,
29918,
2084,
2033,
353,
2224,
13,
13,
13,
1753,
2821,
29918,
2267,
29918,
2084,
29898,
7924,
1125,
13,
1678,
9995,
18759,
736,
2224,
297,
4867,
421,
7924,
29952,
565,
372,
4864,
15945,
29908,
13,
1678,
565,
525,
2267,
29918,
2084,
29915,
297,
4867,
29901,
13,
4706,
628,
4867,
1839,
2267,
29918,
2084,
2033,
13,
13,
13,
1753,
671,
29918,
2267,
29918,
2084,
29898,
7924,
1125,
13,
1678,
9995,
11609,
322,
5217,
736,
2224,
515,
4867,
421,
7924,
29952,
565,
372,
4864,
15945,
29908,
13,
1678,
565,
525,
2267,
29918,
2084,
29915,
297,
4867,
29901,
13,
4706,
3240,
29918,
2084,
353,
4867,
1839,
2267,
29918,
2084,
2033,
13,
4706,
628,
4867,
1839,
2267,
29918,
2084,
2033,
13,
1678,
1683,
29901,
13,
4706,
3240,
29918,
2084,
353,
6213,
13,
1678,
736,
3240,
29918,
2084,
13,
13,
2
] |
homeassistant/components/watttime/sensor.py | DoctorU/core | 1 | 129733 | <gh_stars>1-10
"""Support for WattTime sensors."""
from __future__ import annotations
from typing import TYPE_CHECKING
from homeassistant.components.sensor import (
STATE_CLASS_MEASUREMENT,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_ATTRIBUTION,
ATTR_LATITUDE,
ATTR_LONGITUDE,
MASS_POUNDS,
PERCENTAGE,
)
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from homeassistant.helpers.update_coordinator import (
CoordinatorEntity,
DataUpdateCoordinator,
)
from .const import (
CONF_BALANCING_AUTHORITY,
CONF_BALANCING_AUTHORITY_ABBREV,
DATA_COORDINATOR,
DOMAIN,
)
ATTR_BALANCING_AUTHORITY = "balancing_authority"
DEFAULT_ATTRIBUTION = "Pickup data provided by WattTime"
SENSOR_TYPE_REALTIME_EMISSIONS_MOER = "moer"
SENSOR_TYPE_REALTIME_EMISSIONS_PERCENT = "percent"
REALTIME_EMISSIONS_SENSOR_DESCRIPTIONS = (
SensorEntityDescription(
key=SENSOR_TYPE_REALTIME_EMISSIONS_MOER,
name="Marginal Operating Emissions Rate",
icon="mdi:blur",
native_unit_of_measurement=f"{MASS_POUNDS} CO2/MWh",
state_class=STATE_CLASS_MEASUREMENT,
),
SensorEntityDescription(
key=SENSOR_TYPE_REALTIME_EMISSIONS_PERCENT,
name="Relative Marginal Emissions Intensity",
icon="mdi:blur",
native_unit_of_measurement=PERCENTAGE,
state_class=STATE_CLASS_MEASUREMENT,
),
)
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up WattTime sensors based on a config entry."""
coordinator = hass.data[DOMAIN][entry.entry_id][DATA_COORDINATOR]
async_add_entities(
[
RealtimeEmissionsSensor(coordinator, description)
for description in REALTIME_EMISSIONS_SENSOR_DESCRIPTIONS
if description.key in coordinator.data
]
)
class RealtimeEmissionsSensor(CoordinatorEntity, SensorEntity):
"""Define a realtime emissions sensor."""
def __init__(
self,
coordinator: DataUpdateCoordinator,
description: SensorEntityDescription,
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
if TYPE_CHECKING:
assert coordinator.config_entry
self._attr_extra_state_attributes = {
ATTR_ATTRIBUTION: DEFAULT_ATTRIBUTION,
ATTR_BALANCING_AUTHORITY: coordinator.config_entry.data[
CONF_BALANCING_AUTHORITY
],
ATTR_LATITUDE: coordinator.config_entry.data[ATTR_LATITUDE],
ATTR_LONGITUDE: coordinator.config_entry.data[ATTR_LONGITUDE],
}
self._attr_name = f"{description.name} ({coordinator.config_entry.data[CONF_BALANCING_AUTHORITY_ABBREV]})"
self._attr_unique_id = f"{coordinator.config_entry.entry_id}_{description.key}"
self.entity_description = description
@property
def native_value(self) -> StateType:
"""Return the value reported by the sensor."""
return self.coordinator.data[self.entity_description.key]
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
15945,
29908,
14039,
363,
399,
1131,
2481,
4771,
943,
1213,
15945,
13,
3166,
4770,
29888,
9130,
1649,
1053,
25495,
13,
13,
3166,
19229,
1053,
323,
6959,
29918,
3210,
16658,
4214,
13,
13,
3166,
3271,
465,
22137,
29889,
14036,
29889,
29879,
6073,
1053,
313,
13,
1678,
6850,
3040,
29918,
13875,
1799,
29918,
2303,
3289,
11499,
13780,
29892,
13,
1678,
317,
6073,
6691,
29892,
13,
1678,
317,
6073,
6691,
9868,
29892,
13,
29897,
13,
3166,
3271,
465,
22137,
29889,
2917,
29918,
26586,
1053,
12782,
9634,
13,
3166,
3271,
465,
22137,
29889,
3075,
1053,
313,
13,
1678,
15531,
5659,
29918,
1299,
29911,
3960,
29933,
2692,
2725,
29892,
13,
1678,
15531,
5659,
29918,
29931,
1299,
1806,
29965,
2287,
29892,
13,
1678,
15531,
5659,
29918,
29931,
20614,
1806,
29965,
2287,
29892,
13,
1678,
14861,
1799,
29918,
13152,
18783,
29903,
29892,
13,
1678,
349,
1001,
29907,
3919,
10461,
29892,
13,
29897,
13,
3166,
3271,
465,
22137,
29889,
3221,
1053,
8778,
7900,
22137,
13,
3166,
3271,
465,
22137,
29889,
3952,
6774,
29889,
10041,
29918,
12120,
1053,
3462,
5292,
1907,
10717,
13,
3166,
3271,
465,
22137,
29889,
3952,
6774,
29889,
1017,
15702,
1053,
4306,
1542,
13,
3166,
3271,
465,
22137,
29889,
3952,
6774,
29889,
5504,
29918,
1111,
4194,
1061,
1053,
313,
13,
1678,
3189,
4194,
1061,
6691,
29892,
13,
1678,
3630,
6422,
7967,
4194,
1061,
29892,
13,
29897,
13,
13,
3166,
869,
3075,
1053,
313,
13,
1678,
8707,
29943,
29918,
29933,
1964,
2190,
29907,
4214,
29918,
20656,
29950,
1955,
11937,
29892,
13,
1678,
8707,
29943,
29918,
29933,
1964,
2190,
29907,
4214,
29918,
20656,
29950,
1955,
11937,
29918,
2882,
29933,
1525,
29963,
29892,
13,
1678,
360,
8254,
29918,
3217,
25593,
1177,
1299,
1955,
29892,
13,
1678,
11662,
29032,
29892,
13,
29897,
13,
13,
1299,
5659,
29918,
29933,
1964,
2190,
29907,
4214,
29918,
20656,
29950,
1955,
11937,
353,
376,
5521,
19985,
29918,
8921,
537,
29908,
13,
13,
23397,
29918,
1299,
29911,
3960,
29933,
2692,
2725,
353,
376,
29925,
860,
786,
848,
4944,
491,
399,
1131,
2481,
29908,
13,
13,
29903,
1430,
29903,
1955,
29918,
11116,
29918,
1525,
1964,
15307,
29918,
29923,
10403,
13507,
29903,
29918,
6720,
1001,
353,
376,
4346,
261,
29908,
13,
29903,
1430,
29903,
1955,
29918,
11116,
29918,
1525,
1964,
15307,
29918,
29923,
10403,
13507,
29903,
29918,
13171,
29907,
3919,
353,
376,
25376,
29908,
13,
13,
13,
1525,
1964,
15307,
29918,
29923,
10403,
13507,
29903,
29918,
29903,
1430,
29903,
1955,
29918,
2287,
7187,
24290,
27946,
353,
313,
13,
1678,
317,
6073,
6691,
9868,
29898,
13,
4706,
1820,
29922,
29903,
1430,
29903,
1955,
29918,
11116,
29918,
1525,
1964,
15307,
29918,
29923,
10403,
13507,
29903,
29918,
6720,
1001,
29892,
13,
4706,
1024,
543,
29924,
1191,
979,
6607,
1218,
2812,
6847,
390,
403,
613,
13,
4706,
9849,
543,
3487,
29875,
29901,
2204,
332,
613,
13,
4706,
7531,
29918,
5441,
29918,
974,
29918,
26658,
358,
29922,
29888,
29908,
29912,
1529,
1799,
29918,
13152,
18783,
29903,
29913,
4810,
29906,
29914,
29924,
8809,
613,
13,
4706,
2106,
29918,
1990,
29922,
19713,
29918,
13875,
1799,
29918,
2303,
3289,
11499,
13780,
29892,
13,
1678,
10353,
13,
1678,
317,
6073,
6691,
9868,
29898,
13,
4706,
1820,
29922,
29903,
1430,
29903,
1955,
29918,
11116,
29918,
1525,
1964,
15307,
29918,
29923,
10403,
13507,
29903,
29918,
13171,
29907,
3919,
29892,
13,
4706,
1024,
543,
18278,
11649,
979,
2812,
6847,
3159,
575,
537,
613,
13,
4706,
9849,
543,
3487,
29875,
29901,
2204,
332,
613,
13,
4706,
7531,
29918,
5441,
29918,
974,
29918,
26658,
358,
29922,
13171,
29907,
3919,
10461,
29892,
13,
4706,
2106,
29918,
1990,
29922,
19713,
29918,
13875,
1799,
29918,
2303,
3289,
11499,
13780,
29892,
13,
1678,
10353,
13,
29897,
13,
13,
13,
12674,
822,
7465,
29918,
14669,
29918,
8269,
29898,
13,
1678,
298,
465,
29901,
8778,
7900,
22137,
29892,
6251,
29901,
12782,
9634,
29892,
7465,
29918,
1202,
29918,
296,
1907,
29901,
3462,
5292,
1907,
10717,
13,
29897,
1599,
6213,
29901,
13,
1678,
9995,
2697,
701,
399,
1131,
2481,
4771,
943,
2729,
373,
263,
2295,
6251,
1213,
15945,
13,
1678,
6615,
1061,
353,
298,
465,
29889,
1272,
29961,
3970,
29032,
3816,
8269,
29889,
8269,
29918,
333,
3816,
14573,
29918,
3217,
25593,
1177,
1299,
1955,
29962,
13,
1678,
7465,
29918,
1202,
29918,
296,
1907,
29898,
13,
4706,
518,
13,
9651,
830,
1997,
603,
6026,
6847,
29903,
6073,
29898,
1111,
4194,
1061,
29892,
6139,
29897,
13,
9651,
363,
6139,
297,
5195,
1964,
15307,
29918,
29923,
10403,
13507,
29903,
29918,
29903,
1430,
29903,
1955,
29918,
2287,
7187,
24290,
27946,
13,
9651,
565,
6139,
29889,
1989,
297,
6615,
1061,
29889,
1272,
13,
4706,
4514,
13,
1678,
1723,
13,
13,
13,
1990,
830,
1997,
603,
6026,
6847,
29903,
6073,
29898,
7967,
4194,
1061,
6691,
29892,
317,
6073,
6691,
1125,
13,
1678,
9995,
3206,
457,
263,
1855,
2230,
953,
6847,
23530,
1213,
15945,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
6615,
1061,
29901,
3630,
6422,
7967,
4194,
1061,
29892,
13,
4706,
6139,
29901,
317,
6073,
6691,
9868,
29892,
13,
1678,
1723,
1599,
6213,
29901,
13,
4706,
9995,
6644,
6646,
278,
23530,
1213,
15945,
13,
4706,
2428,
2141,
1649,
2344,
12035,
1111,
4194,
1061,
29897,
13,
13,
4706,
565,
323,
6959,
29918,
3210,
16658,
4214,
29901,
13,
9651,
4974,
6615,
1061,
29889,
2917,
29918,
8269,
13,
13,
4706,
1583,
3032,
5552,
29918,
17833,
29918,
3859,
29918,
15697,
353,
426,
13,
9651,
15531,
5659,
29918,
1299,
29911,
3960,
29933,
2692,
2725,
29901,
22236,
29918,
1299,
29911,
3960,
29933,
2692,
2725,
29892,
13,
9651,
15531,
5659,
29918,
29933,
1964,
2190,
29907,
4214,
29918,
20656,
29950,
1955,
11937,
29901,
6615,
1061,
29889,
2917,
29918,
8269,
29889,
1272,
29961,
13,
18884,
8707,
29943,
29918,
29933,
1964,
2190,
29907,
4214,
29918,
20656,
29950,
1955,
11937,
13,
9651,
21251,
13,
9651,
15531,
5659,
29918,
29931,
1299,
1806,
29965,
2287,
29901,
6615,
1061,
29889,
2917,
29918,
8269,
29889,
1272,
29961,
1299,
5659,
29918,
29931,
1299,
1806,
29965,
2287,
1402,
13,
9651,
15531,
5659,
29918,
29931,
20614,
1806,
29965,
2287,
29901,
6615,
1061,
29889,
2917,
29918,
8269,
29889,
1272,
29961,
1299,
5659,
29918,
29931,
20614,
1806,
29965,
2287,
1402,
13,
4706,
500,
13,
4706,
1583,
3032,
5552,
29918,
978,
353,
285,
29908,
29912,
8216,
29889,
978,
29913,
21313,
1111,
4194,
1061,
29889,
2917,
29918,
8269,
29889,
1272,
29961,
6007,
29943,
29918,
29933,
1964,
2190,
29907,
4214,
29918,
20656,
29950,
1955,
11937,
29918,
2882,
29933,
1525,
29963,
29962,
1800,
29908,
13,
4706,
1583,
3032,
5552,
29918,
13092,
29918,
333,
353,
285,
29908,
29912,
1111,
4194,
1061,
29889,
2917,
29918,
8269,
29889,
8269,
29918,
333,
3227,
8216,
29889,
1989,
5038,
13,
4706,
1583,
29889,
10041,
29918,
8216,
353,
6139,
13,
13,
1678,
732,
6799,
13,
1678,
822,
7531,
29918,
1767,
29898,
1311,
29897,
1599,
4306,
1542,
29901,
13,
4706,
9995,
11609,
278,
995,
8967,
491,
278,
23530,
1213,
15945,
13,
4706,
736,
1583,
29889,
1111,
4194,
1061,
29889,
1272,
29961,
1311,
29889,
10041,
29918,
8216,
29889,
1989,
29962,
13,
2
] |
myenv/lib/python2.7/site-packages/tests/tests.py | dkumarlinux/saleor | 0 | 82080 | """versatileimagefield tests."""
from __future__ import division
from __future__ import unicode_literals
from functools import reduce
import math
import operator
import os
from shutil import rmtree
from django import VERSION as DJANGO_VERSION
from django.conf import settings
from django.contrib.auth.models import User
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.core.files import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core import serializers
from django.template import Context
from django.template.loader import get_template
from django.test import Client, TestCase
from django.test.utils import override_settings
from django.utils._os import upath
from django.utils import six
from django.utils.six.moves import cPickle
from PIL import Image
from rest_framework.test import APIRequestFactory
from versatileimagefield.files import VersatileImageFileDescriptor
from versatileimagefield.datastructures.filteredimage import InvalidFilter
from versatileimagefield.datastructures.sizedimage import \
MalformedSizedImageKey, SizedImage
from versatileimagefield.datastructures.filteredimage import FilteredImage
from versatileimagefield.image_warmer import VersatileImageFieldWarmer
from versatileimagefield.registry import (
autodiscover,
versatileimagefield_registry,
AlreadyRegistered,
InvalidSizedImageSubclass,
InvalidFilteredImageSubclass,
NotRegistered,
UnallowedSizerName,
UnallowedFilterName
)
from versatileimagefield.settings import (
VERSATILEIMAGEFIELD_SIZED_DIRNAME,
VERSATILEIMAGEFIELD_FILTERED_DIRNAME,
VERSATILEIMAGEFIELD_PLACEHOLDER_DIRNAME
)
from versatileimagefield.utils import (
get_rendition_key_set,
InvalidSizeKey,
InvalidSizeKeySet
)
from versatileimagefield.validators import validate_ppoi_tuple
from versatileimagefield.versatileimagefield import CroppedImage, InvertImage
from .forms import (
VersatileImageTestModelForm,
VersatileImageWidgetTestModelForm,
VersatileImageTestModelFormDjango15
)
from .models import (
VersatileImageTestModel,
VersatileImageWidgetTestModel,
VersatileImageTestUploadDirectoryModel,
)
from .serializers import VersatileImageTestModelSerializer
ADMIN_URL = '/admin/tests/versatileimagewidgettestmodel/1/'
if DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] >= 9:
ADMIN_URL = '/admin/tests/versatileimagewidgettestmodel/1/change/'
class VersatileImageFieldBaseTestCase(TestCase):
"""Base test case for versatileimagefield."""
@classmethod
def tearDownClass(cls):
"""Delete files made by VersatileImageFields during tests."""
filtered_path = os.path.join(
settings.MEDIA_ROOT,
VERSATILEIMAGEFIELD_FILTERED_DIRNAME
)
sized_path = os.path.join(
settings.MEDIA_ROOT,
VERSATILEIMAGEFIELD_SIZED_DIRNAME
)
placeholder_path = os.path.join(
settings.MEDIA_ROOT,
VERSATILEIMAGEFIELD_PLACEHOLDER_DIRNAME
)
rmtree(filtered_path, ignore_errors=True)
rmtree(sized_path, ignore_errors=True)
rmtree(placeholder_path, ignore_errors=True)
def assert_VersatileImageField_deleted(self, field_instance):
"""Assert `field_instance` (VersatileImageField instance) deletes."""
img_url = field_instance.crop['100x100'].url
self.assertEqual(
cache.get(img_url),
None
)
field_instance.create_on_demand = True
field_instance.crop['100x100'].url
self.assertEqual(
cache.get(img_url),
1
)
print(field_instance.crop['100x100'].name)
self.assertTrue(
field_instance.field.storage.exists(
field_instance.crop['100x100'].name
)
)
print(field_instance.crop['100x100'].name)
field_instance.field.storage.delete(
field_instance.crop['100x100'].name
)
self.assertFalse(
field_instance.field.storage.exists(
field_instance.crop['100x100'].name
)
)
print(img_url)
cache.delete(img_url)
self.assertEqual(
cache.get(img_url),
None
)
class VersatileImageFieldTestCase(VersatileImageFieldBaseTestCase):
"""Main test case for versatileimagefield."""
fixtures = ['versatileimagefield']
def setUp(self):
"""Build test instances, create test client."""
self.jpg = VersatileImageTestModel.objects.get(img_type='jpg')
self.png = VersatileImageTestModel.objects.get(img_type='png')
self.gif = VersatileImageTestModel.objects.get(img_type='gif')
self.delete_test = VersatileImageTestModel.objects.get(
img_type='delete_test'
)
self.widget_test = VersatileImageWidgetTestModel.objects.get(pk=1)
password = '<PASSWORD>'
user = User.objects.create_user(
username='test',
email='<EMAIL>',
password=password
)
user.is_active = True
user.is_staff = True
user.is_superuser = True
user.save()
client = Client()
login = client.login(
username='test',
password=password
)
self.assertTrue(login)
self.user = user
self.client = client
@staticmethod
def imageEqual(image1, image2):
"""Return True if `image1` & `image2` are identical images."""
h1 = image1.histogram()
h2 = image2.histogram()
rms = math.sqrt(
reduce(
operator.add,
map(lambda a, b: (a - b) ** 2, h1, h2)
) // len(h1)
)
return rms == 0.0
def test_check_storage_paths(self):
"""Ensure storage paths are properly set."""
self.assertEqual(self.jpg.image.name, 'python-logo.jpg')
self.assertEqual(self.png.image.name, 'python-logo.png')
self.assertEqual(self.gif.image.name, 'python-logo.gif')
def test_thumbnail_resized_path(self):
"""Ensure thumbnail Sizer paths are set correctly."""
self.assertEqual(
self.jpg.image.thumbnail['100x100'].url,
'/media/__sized__/python-logo-thumbnail-100x100-70.jpg'
)
def test_crop_resized_path(self):
"""Ensure crop Sizer paths are set correctly."""
self.assertEqual(
self.jpg.image.crop['100x100'].url,
'/media/__sized__/python-logo-crop-c0-25__0-25-100x100-70.jpg'
)
self.assertEqual(
self.gif.image.crop['100x100'].url,
'/media/__sized__/python-logo-crop-c0-75__0-75-100x100.gif'
)
self.assertEqual(
self.png.image.crop['100x100'].url,
'/media/__sized__/python-logo-crop-c0-5__0-5-100x100.png'
)
def test_invert_filtered_path(self):
"""Ensure crop Sizer paths are set correctly."""
self.assertEqual(
self.jpg.image.filters.invert.url,
'/media/__filtered__/python-logo__invert__.jpg'
)
def test_InvalidFilter(self):
"""Ensure InvalidFilter raises."""
with self.assertRaises(InvalidFilter):
invalid_filter = self.jpg.image.filters.non_existant.url
del invalid_filter
def test_invert_plus_thumbnail_sizer_filtered_path(self):
"""Ensure crop Sizer paths are set correctly."""
self.assertEqual(
self.jpg.image.filters.invert.thumbnail['100x100'].url,
(
'/media/__sized__/__filtered__/python-logo__invert__'
'-thumbnail-100x100-70.jpg'
)
)
def test_placeholder_image(self):
"""Ensure placeholder images work as intended."""
self.jpg.optional_image.create_on_demand = True
self.assertEqual(
self.jpg.optional_image.url,
'/media/__placeholder__/placeholder.png'
)
self.assertEqual(
self.jpg.optional_image.crop['100x100'].url,
'/media/__sized__/__placeholder__/'
'placeholder-crop-c0-5__0-5-100x100.png'
)
self.assertEqual(
self.jpg.optional_image.thumbnail['100x100'].url,
'/media/__sized__/__placeholder__/'
'placeholder-thumbnail-100x100.png'
)
self.assertEqual(
self.jpg.optional_image.filters.invert.url,
'/media/__placeholder__/__filtered__/placeholder__invert__.png'
)
self.assertEqual(
self.jpg.optional_image_2.crop['100x100'].url,
'/media/__sized__/__placeholder__/on-storage-placeholder/'
'placeholder-crop-c0-5__0-5-100x100.png'
)
self.assertEqual(
self.jpg.optional_image_2.thumbnail['100x100'].url,
'/media/__sized__/__placeholder__/on-storage-placeholder/'
'placeholder-thumbnail-100x100.png'
)
self.assertEqual(
self.jpg.optional_image_2.filters.invert.url,
'/media/__placeholder__/on-storage-placeholder/__filtered__/'
'placeholder__invert__.png'
)
self.assertFalse(
self.jpg.optional_image.field.storage.size(
self.jpg.optional_image.name
) is 0
)
self.jpg.optional_image.create_on_demand = False
def test_setting_ppoi_values(self):
"""Ensure PPOI values are set correctly."""
jpg = VersatileImageTestModel.objects.get(img_type='jpg')
self.assertEqual(
jpg.image.ppoi,
(0.25, 0.25)
)
jpg.image.ppoi = (0.5, 0.5)
jpg.save()
self.assertEqual(
jpg.image.ppoi,
(0.5, 0.5)
)
jpg.image.ppoi = '0.25x0.25'
jpg.save()
self.assertEqual(
jpg.image.ppoi,
(0.25, 0.25)
)
with self.assertRaises(ValidationError):
versatileimagefield = VersatileImageTestModel.objects.get(
img_type='jpg'
).image
versatileimagefield.ppoi = (1.5, 2)
with self.assertRaises(ValidationError):
versatileimagefield = VersatileImageTestModel.objects.get(
img_type='jpg'
).image
versatileimagefield.ppoi = 'picklexcucumber'
def test_invalid_ppoi_tuple_validation(self):
"""Ensure validate_ppoi_tuple works as expected."""
self.assertFalse(
validate_ppoi_tuple((0, 1.5, 6))
)
def test_create_on_demand_boolean(self):
"""Ensure create_on_demand boolean is set appropriately."""
jpg = VersatileImageTestModel.objects.get(img_type='jpg')
self.assertFalse(jpg.image.create_on_demand)
jpg.image.create_on_demand = True
self.assertTrue(jpg.image.create_on_demand)
with self.assertRaises(ValueError):
jpg = VersatileImageTestModel.objects.get(img_type='jpg')
jpg.image.create_on_demand = 'pickle'
def test_create_on_demand_functionality(self):
"""Ensure create_on_demand functionality works as advertised."""
jpg = VersatileImageTestModel.objects.get(img_type='jpg')
self.assert_VersatileImageField_deleted(jpg.image)
def test_custom_upload_to_thumbnail_deleted(self):
"""Test custom upload_to deletion works."""
o = VersatileImageTestUploadDirectoryModel.objects.get()
field_instance = o.image
field_instance.create_on_demand = True
path = field_instance.crop['100x100'].name
self.assertTrue(
field_instance.field.storage.exists(path)
)
field_instance.delete_sized_images()
self.assertFalse(
field_instance.field.storage.exists(path)
)
def test_image_warmer(self):
"""Ensure VersatileImageFieldWarmer works as advertised."""
jpg_warmer = VersatileImageFieldWarmer(
instance_or_queryset=self.jpg,
rendition_key_set='test_set',
image_attr='image'
)
num_created, failed_to_create = jpg_warmer.warm()
self.assertEqual(num_created, 5)
all_imgs_warmer = VersatileImageFieldWarmer(
instance_or_queryset=VersatileImageTestModel.objects.exclude(
img_type='delete_test'
),
rendition_key_set=(
('test_thumb', 'thumbnail__100x100'),
('test_crop', 'crop__100x100'),
('test_invert', 'filters__invert__url'),
),
image_attr='image',
verbose=True
)
num_created, failed_to_create = all_imgs_warmer.warm()
with self.assertRaises(ValueError):
invalid_warmer = VersatileImageFieldWarmer(
instance_or_queryset=['invalid'],
rendition_key_set=(
('test_thumb', 'thumbnail__10x10'),
),
image_attr='image'
)
del invalid_warmer
def test_VersatileImageFieldSerializer_output(self):
"""Ensure VersatileImageFieldSerializer serializes correctly."""
factory = APIRequestFactory()
request = factory.get('/admin/')
serializer = VersatileImageTestModelSerializer(
self.jpg,
context={'request': request}
)
self.assertEqual(
serializer.data.get('image'),
{
'test_crop': (
'http://testserver/media/__sized__/python-logo-crop'
'-c0-25__0-25-100x100-70.jpg'
),
'test_invert_crop': (
'http://testserver/media/__sized__/__filtered__/'
'python-logo__invert__-crop-c0-25__0-25-100x100-70.jpg'
),
'test_invert_thumb': (
'http://testserver/media/__sized__/__filtered__/'
'python-logo__invert__-thumbnail-100x100-70.jpg'
),
'test_invert': (
'http://testserver/media/__filtered__/'
'python-logo__invert__.jpg'
),
'test_thumb': (
'http://testserver/media/__sized__/python-logo-thumbnail'
'-100x100-70.jpg'
)
}
)
self.assertEqual(
serializer.data.get('optional_image'),
{
'test_crop': (
'http://testserver/media/__sized__/__placeholder__/placeholder-crop'
'-c0-5__0-5-100x100.png'
),
'test_invert_crop': (
'http://testserver/media/__sized__/__placeholder__/__filtered__/placeholder__invert__'
'-crop-c0-5__0-5-100x100.png'
),
'test_invert_thumb': (
'http://testserver/media/__sized__/__placeholder__/__filtered__/placeholder__invert__'
'-thumbnail-100x100.png'
),
'test_invert': (
'http://testserver/media/__placeholder__/__filtered__/placeholder'
'__invert__.png'
),
'test_thumb': (
'http://testserver/media/__sized__/__placeholder__/placeholder-thumbnail'
'-100x100.png'
)
}
)
def test_widget_javascript(self):
"""Ensure VersatileImagePPOIClickWidget widget loads appropriately."""
response = self.client.get(
ADMIN_URL
)
self.assertEqual(response.status_code, 200)
if six.PY2:
response_content = str(response.content)
else:
response_content = str(response.content, encoding='utf-8')
# Test that javascript loads correctly
self.assertInHTML(
(
'<script type="text/javascript" '
'src="/static/versatileimagefield/js/versatileimagefield.js">'
'</script>'
),
response_content
)
# Test required field with PPOI
self.assertInHTML(
(
'<div class="image-wrap outer">'
' <div class="point-stage" id="image_0_point-stage"'
' data-image_preview_id="image_0_imagepreview">'
' <div class="ppoi-point" id="image_0_ppoi"></div>'
' </div>'
' <div class="image-wrap inner">'
' <img src="/media/__sized__/python-logo-thumbnail-300x300.png"'
' id="image_0_imagepreview"'
' data-hidden_field_id="id_image_1"'
' data-point_stage_id="image_0_point-stage"'
' data-ppoi_id="image_0_ppoi" class="sizedimage-preview"/>'
' </div>'
'</div>'
),
response_content
)
# Test required field no PPOI
self.assertInHTML(
(
'<a href="/media/python-logo.jpg">python-logo.jpg</a>'
),
response_content
)
# Test optional image no PPOI
self.assertInHTML(
(
'<div class="form-row field-optional_image">'
'<div>'
'<label for="id_optional_image">Optional image:</label>'
'Currently: <a href="/media/exif-orientation-examples/'
'Landscape_8.jpg">exif-orientation-examples/Landscape_8.jpg'
'</a> <input id="optional_image-clear_id" '
'name="optional_image-clear" type="checkbox" /> <label '
'for="optional_image-clear_id">Clear</label><br />Change: '
'<input id="id_optional_image" name="optional_image" '
'type="file" />'
'</div>'
'</div>'
),
response_content
)
# Test optional image with PPOI
self.assertInHTML(
(
'<div class="versatileimagefield">'
' <div class="sizedimage-mod initial">'
' <label class="versatileimagefield-label">Currently</label>'
' <a href="/media/exif-orientation-examples/Landscape_6.jpg">'
' exif-orientation-examples/Landscape_6.jpg</a>'
' </div>'
' <div class="sizedimage-mod clear">'
' <input id="optional_image_with_ppoi_0-clear_id"'
' name="optional_image_with_ppoi_0-clear" type="checkbox" />'
' <label class="versatileimagefield-label" for="optional_image_with_ppoi_0-clear_id">'
' Clear: </label>'
' </div>'
' <div class="sizedimage-mod preview">'
' <label class="versatileimagefield-label">'
' Primary Point of Interest</label>'
' <div class="image-wrap outer">'
' <div class="point-stage"'
' id="optional_image_with_ppoi_0_point-stage"'
' data-image_preview_id="optional_image_with_ppoi_0_imagepreview">'
' <div class="ppoi-point" id="optional_image_with_ppoi_0_ppoi"></div>'
' </div>'
' <div class="image-wrap inner">'
' <img src="/media/__sized__/exif-orientation-examples/'
'Landscape_6-thumbnail-300x300-70.jpg"'
' id="optional_image_with_ppoi_0_imagepreview"'
' data-hidden_field_id="id_optional_image_with_ppoi_1"'
' data-point_stage_id="optional_image_with_ppoi_0_point-stage"'
' data-ppoi_id="optional_image_with_ppoi_0_ppoi" class="sizedimage-preview"/>'
' </div>'
' </div>'
' </div>'
' <div class="sizedimage-mod new-upload">'
' <label class="versatileimagefield-label">Change</label>'
' <input class="file-chooser" id="id_optional_image_with_ppoi_0" '
'name="optional_image_with_ppoi_0" type="file" />'
' </div>'
' <input class="ppoi-input" id="id_optional_image_with_ppoi_1"'
' name="optional_image_with_ppoi_1" type="hidden" value="1.0x1.0" />'
'</div>'
),
response_content
)
self.assertTrue(
self.widget_test.image.field.storage.exists(
self.widget_test.image.thumbnail['300x300'].name
)
)
f = VersatileImageWidgetTestModelForm(
data={
'optional_image_with_ppoi_0': '',
'optional_image_with_ppoi_0-clear': 'on'
},
instance=self.widget_test
)
instance = f.save()
self.assertEqual(instance.optional_image_with_ppoi.name, '')
def test_VersatileImageFileDescriptor(self):
"""Ensure VersatileImageFileDescriptor works as intended."""
self.jpg.image = 'python-logo-2.jpg'
self.jpg.save()
self.assertEqual(
self.jpg.image.thumbnail['100x100'].url,
'/media/__sized__/python-logo-2-thumbnail-100x100-70.jpg'
)
self.jpg.image = 'python-logo.jpg'
self.jpg.save()
self.assertEqual(
self.jpg.image.thumbnail['100x100'].url,
'/media/__sized__/python-logo-thumbnail-100x100-70.jpg'
)
fieldfile_obj = self.jpg.image
del fieldfile_obj.field
self.jpg.image = fieldfile_obj
img_path = self.jpg.image.path
img_file = open(img_path, 'rb')
django_file = File(img_file)
self.jpg.image = django_file
with self.assertRaises(AttributeError):
x = VersatileImageFileDescriptor(self.jpg.image.name)
VersatileImageFileDescriptor.__get__(x)
def test_VersatileImageField_picklability(self):
"""Ensure VersatileImageField instances can be pickled/unpickled."""
cPickle.dump(
self.jpg,
open("pickletest.p", "wb")
)
jpg_unpickled = cPickle.load(
open("pickletest.p", "rb")
)
jpg_instance = jpg_unpickled
self.assertEqual(
jpg_instance.image.thumbnail['100x100'].url,
'/media/__sized__/python-logo-thumbnail-100x100-70.jpg'
)
pickled_state = self.jpg.image.__getstate__()
self.assertEqual(
pickled_state,
{
'_create_on_demand': False,
'_committed': True,
'_file': None,
'name': 'python-logo.jpg',
'closed': False
}
)
def test_VERSATILEIMAGEFIELD_RENDITION_KEY_SETS_setting(self):
"""Ensure VERSATILEIMAGEFIELD_RENDITION_KEY_SETS setting validates."""
with self.assertRaises(ImproperlyConfigured):
get_rendition_key_set('does_not_exist')
with self.assertRaises(InvalidSizeKeySet):
get_rendition_key_set('invalid_set')
with self.assertRaises(InvalidSizeKey):
get_rendition_key_set('invalid_size_key')
def __test_exif_orientation_rotate_180(self):
"""Ensure exif orientation==3 data processes properly."""
exif_3 = VersatileImageTestModel.objects.get(
img_type='exif_3'
)
exif_3.image.create_on_demand = True
exif_3_path = exif_3.image.thumbnail['100x100'].name
exif_3_img = exif_3.image.field.storage.open(
exif_3_path
)
exif_3_control = exif_3.image.field.storage.open(
'verify-against/exif-orientation-examples/'
'Landscape_3-thumbnail-100x100-70.jpg'
)
img = Image.open(exif_3_img)
control_img = Image.open(exif_3_control)
self.assertTrue(
self.imageEqual(
img,
control_img
)
)
def __test_exif_orientation_rotate_270(self):
"""Ensure exif orientation==6 data processes properly."""
exif_6 = VersatileImageTestModel.objects.get(
img_type='exif_6'
)
exif_6.image.create_on_demand = True
exif_6_img = exif_6.image.field.storage.open(
exif_6.image.thumbnail['100x100'].name
)
exif_6_control = exif_6.image.field.storage.open(
'verify-against/exif-orientation-examples/'
'Landscape_6-thumbnail-100x100-70.jpg'
)
self.assertTrue(
self.imageEqual(
Image.open(exif_6_img),
Image.open(exif_6_control)
)
)
def __test_exif_orientation_rotate_90(self):
"""Ensure exif orientation==8 data processes properly."""
exif_8 = VersatileImageTestModel.objects.get(
img_type='exif_8'
)
exif_8.image.create_on_demand = True
exif_8_img = exif_8.image.field.storage.open(
exif_8.image.thumbnail['100x100'].name
)
exif_8_control = exif_8.image.field.storage.open(
'verify-against/exif-orientation-examples/'
'Landscape_8-thumbnail-100x100-70.jpg'
)
self.assertTrue(
self.imageEqual(
Image.open(exif_8_img),
Image.open(exif_8_control)
)
)
def test_horizontal_and_vertical_crop(self):
"""Test horizontal and vertical crops with 'extreme' PPOI values."""
test_gif = VersatileImageTestModel.objects.get(
img_type='gif'
)
test_gif.image.create_on_demand = True
test_gif.image.ppoi = (0, 0)
# Vertical w/ PPOI == '0x0'
vertical_image_crop = test_gif.image.field.storage.open(
test_gif.image.crop['30x100'].name
)
vertical_image_crop_control = test_gif.image.field.storage.open(
'verify-against/python-logo-crop-c0__0-30x100.gif'
)
self.assertTrue(
self.imageEqual(
Image.open(vertical_image_crop),
Image.open(vertical_image_crop_control)
)
)
# Horizontal w/ PPOI == '0x0'
horiz_image_crop = test_gif.image.field.storage.open(
test_gif.image.crop['100x30'].name
)
horiz_image_crop_control = test_gif.image.field.storage.open(
'verify-against/python-logo-crop-c0__0-100x30.gif'
)
self.assertTrue(
self.imageEqual(
Image.open(horiz_image_crop),
Image.open(horiz_image_crop_control)
)
)
test_gif.image.ppoi = (1, 1)
# Vertical w/ PPOI == '1x1'
vertical_image_crop = test_gif.image.field.storage.open(
test_gif.image.crop['30x100'].name
)
vertical_image_crop_control = test_gif.image.field.storage.open(
'verify-against/python-logo-crop-c1__1-30x100.gif'
)
self.assertTrue(
self.imageEqual(
Image.open(vertical_image_crop),
Image.open(vertical_image_crop_control)
)
)
# Horizontal w/ PPOI == '1x1'
horiz_image_crop = test_gif.image.field.storage.open(
test_gif.image.crop['100x30'].name
)
horiz_image_crop_control = test_gif.image.field.storage.open(
'verify-against/python-logo-crop-c1__1-100x30.gif'
)
self.assertTrue(
self.imageEqual(
Image.open(horiz_image_crop),
Image.open(horiz_image_crop_control)
)
)
def test_DummyFilter(self):
"""Test placeholder image functionality for filters."""
test_png = VersatileImageTestModel.objects.get(
img_type='png'
)
test_png.optional_image.create_on_demand = True
test_png.optional_image.filters.invert.url
def test_crop_and_thumbnail_key_assignment(self):
"""Test placeholder image functionality for filters."""
with self.assertRaises(NotImplementedError):
jpg = VersatileImageTestModel.objects.get(img_type='jpg')
jpg.image.crop['100x100'] = None
with self.assertRaises(NotImplementedError):
jpg = VersatileImageTestModel.objects.get(img_type='jpg')
jpg.image.thumbnail['100x100'] = None
def test_MalformedSizedImageKey(self):
"""Test MalformedSizedImageKey exception."""
with self.assertRaises(MalformedSizedImageKey):
self.jpg.image.thumbnail['fooxbar']
def test_registration_exceptions(self):
"""Ensure all registration-related exceptions fire as expected."""
class A(object):
pass
with self.assertRaises(InvalidSizedImageSubclass):
versatileimagefield_registry.register_sizer('a', A)
with self.assertRaises(InvalidFilteredImageSubclass):
versatileimagefield_registry.register_filter('a', A)
with self.assertRaises(UnallowedSizerName):
versatileimagefield_registry.register_sizer('chunks', CroppedImage)
with self.assertRaises(UnallowedFilterName):
versatileimagefield_registry.register_filter('_poop', InvertImage)
with self.assertRaises(AlreadyRegistered):
versatileimagefield_registry.register_sizer('crop', CroppedImage)
with self.assertRaises(AlreadyRegistered):
versatileimagefield_registry.register_filter('invert', InvertImage)
with self.assertRaises(NotRegistered):
versatileimagefield_registry.unregister_sizer('poop')
with self.assertRaises(NotRegistered):
versatileimagefield_registry.unregister_filter('poop')
def test_unregister_methods(self):
"""Ensure versatileimagefield_registry unregister methods work."""
self.assertTrue(
'crop' in versatileimagefield_registry._sizedimage_registry
)
versatileimagefield_registry.unregister_sizer('crop')
self.assertFalse(
'crop' in versatileimagefield_registry._sizedimage_registry
)
self.assertTrue(
'invert' in versatileimagefield_registry._filter_registry
)
versatileimagefield_registry.unregister_filter('invert')
self.assertFalse(
'invert' in versatileimagefield_registry._filter_registry
)
def test_save_form_data(self):
"""Test VersatileImageField.save_form_data."""
with open(
os.path.join(
os.path.dirname(upath(__file__)),
"test.png"
),
'rb'
) as fp:
image_data = fp.read()
with open(
os.path.join(
os.path.dirname(upath(__file__)),
"test2.png"
),
'rb'
) as fp:
image_data2 = fp.read()
if DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] == 5:
form_class = VersatileImageTestModelFormDjango15
else:
form_class = VersatileImageTestModelForm
# Testing new uploads
f = form_class(
data={'img_type': 'xxx'},
files={
'image_0': SimpleUploadedFile('test.png', image_data),
'optional_image': SimpleUploadedFile(
'test2.png', image_data2
)
}
)
self.assertEqual(f.is_valid(), True)
self.assertEqual(type(f.cleaned_data['image'][0]), SimpleUploadedFile)
self.assertEqual(
type(f.cleaned_data['optional_image']), SimpleUploadedFile
)
instance = f.save()
self.assertEqual(instance.image.name.lstrip('./'), 'test.png')
self.assertEqual(
instance.optional_image.name.lstrip('./'),
'test2.png'
)
# Testing updating files / PPOI values
# Deleting optional_image file (since it'll be cleared with the
# next form)
instance.optional_image.delete()
f2 = form_class(
data={
'img_type': 'xxx',
'image_0': '',
'image_1': '0.25x0.25',
'optional_image-clear': 'on'
},
instance=instance
)
instance = f2.save()
self.assertEqual(instance.image.ppoi, (0.25, 0.25))
self.assertEqual(instance.optional_image.name, '')
instance.image.delete(save=False)
def test_ProcessedImage_subclass_exceptions(self):
"""Ensure ProcessedImage subclasses throw NotImplementedError."""
with self.assertRaises(NotImplementedError):
class SizedImageSubclass(SizedImage):
pass
SizedImageSubclass('', '', False)
with self.assertRaises(NotImplementedError):
class SizedImageSubclass(SizedImage):
filename_key = 'test'
x = SizedImageSubclass('', '', False)
x.process_image(image=None, image_format='JPEG', save_kwargs={},
width=100, height=100)
with self.assertRaises(NotImplementedError):
class FilteredImageSubclass(FilteredImage):
filename_key = 'test'
x = FilteredImageSubclass(
self.jpg.image.name,
self.jpg.image.field.storage,
False,
filename_key='foo'
)
x.process_image(image=None, image_format='JPEG', save_kwargs={})
@override_settings(
INSTALLED_APPS=('tests.test_autodiscover',)
)
def test_autodiscover(self):
"""Test autodiscover ImportError."""
self.assertRaises(
ImportError,
autodiscover
)
@override_settings(
VERSATILEIMAGEFIELD_USE_PLACEHOLDIT=True
)
def test_placeholdit(self):
"""Test placehold.it integration."""
jpg = VersatileImageTestModel.objects.get(img_type='jpg')
self.assertEqual(
jpg.optional_image_3.filters.invert.crop['400x400'].url,
'http://placehold.it/400x400'
)
def test_template_rendering(self):
"""Test template rendering of image."""
t = get_template("test-template.html")
c = Context({
'instance': self.jpg
})
rendered = t.render(c)
self.assertHTMLEqual(
rendered,
"""
<html>
<body>
<img id="image-crop" src="/media/__sized__/python-logo-crop-c0-25__0-25-400x400-70.jpg" />
<img id="image-thumbnail" src="/media/__sized__/python-logo-thumbnail-400x400-70.jpg" />
<img id="image-invert" src="/media/__filtered__/python-logo__invert__.jpg" />
<img id="image-invert-crop" src="/media/__sized__/__filtered__/python-logo__invert__-crop-c0-25__0-25-400x400-70.jpg" />
<img src="/media/__sized__/__placeholder__/placeholder-crop-c0-5__0-5-400x400.png" id="optional-image-crop"/>
</body>
</html>
"""
)
def test_field_serialization(self):
"""Ensure VersatileImageField and PPOIField serialize correctly."""
output = serializers.serialize(
'json',
VersatileImageTestModel.objects.filter(pk=1)
)
self.assertJSONEqual(
output,
[
{
"fields": {
"img_type": "png",
"ppoi": "0.5x0.5",
"width": 601,
"height": 203,
"image": "python-logo.png",
"optional_image_3": "",
"optional_image_2": "",
"optional_image": "python-logo.jpg"
},
"model": "tests.versatileimagetestmodel",
"pk": 1
}
]
)
def test_bound_form_data(self):
"""Ensure correct data displays after form validation errors."""
response = self.client.post(
ADMIN_URL,
{
'required_text_field': ''
},
follow=True
)
self.assertEqual(response.status_code, 200)
if six.PY2:
response_content = str(response.content)
else:
response_content = str(response.content, encoding='utf-8')
self.assertInHTML(
(
'<img src="/media/__sized__/python-logo-thumbnail-300x300.'
'png" id="image_0_imagepreview" data-hidden_field_id='
'"id_image_1" data-point_stage_id="image_0_point-stage" '
'data-ppoi_id="image_0_ppoi" class="sizedimage-preview"/>'
),
response_content
)
def test_individual_rendition_cache_clear(self):
"""Test that VersatileImageField can clear individual cache entries."""
expected_image_url = (
'/media/__sized__/delete-test/python-logo-delete-test-thumbnail-100x100-70.jpg'
)
self.assertEqual(
cache.get(expected_image_url),
None
)
img = self.delete_test
img.image.create_on_demand = True
img_url = img.image.thumbnail['100x100'].url
del img_url
self.assertEqual(
cache.get(expected_image_url),
1
)
img.image.thumbnail['100x100'].delete()
self.assertEqual(
cache.get(expected_image_url),
None
)
self.assertFalse(
img.image.field.storage.exists(
'__sized__/delete-test/python-logo-delete-test-thumbnail-100x100-70.jpg'
)
)
def test_rendition_delete(self):
"""Test rendition deletion."""
img = self.delete_test
self.assertFalse(
img.image.field.storage.exists(
'__sized__/delete-test/python-logo-delete-test-thumbnail-100x100-70.jpg'
)
)
img.image.create_on_demand = True
thumb_url = img.image.thumbnail['100x100'].url
self.assertEqual(
cache.get(thumb_url),
1
)
self.assertTrue(
img.image.field.storage.exists(
'__sized__/delete-test/python-logo-delete-test-thumbnail-100x100-70.jpg'
)
)
img.image.delete_all_created_images()
invert_url = img.image.filters.invert.url
self.assertEqual(
cache.get(invert_url),
1
)
self.assertTrue(
img.image.field.storage.exists(
'delete-test/__filtered__/python-logo-delete-test__invert__.jpg'
)
)
invert_and_thumb_url = img.image.filters.invert.thumbnail[
'100x100'
].url
self.assertEqual(
cache.get(invert_and_thumb_url),
1
)
self.assertTrue(
img.image.field.storage.exists(
'__sized__/delete-test/__filtered__/python-logo-delete-test__invert__'
'-thumbnail-100x100-70.jpg'
)
)
img.image.delete_all_created_images()
self.assertEqual(
cache.get(thumb_url),
None
)
self.assertFalse(
img.image.field.storage.exists(
'__sized__/delete-test/python-logo-delete-test-thumbnail-100x100-70.jpg'
)
)
self.assertEqual(
cache.get(invert_url),
None
)
self.assertFalse(
img.image.field.storage.exists(
'delete-test/__filtered__/python-logo-delete-test__invert__.jpg'
)
)
self.assertEqual(
cache.get(invert_and_thumb_url),
None
)
self.assertFalse(
img.image.field.storage.exists(
'__sized__/delete-test/__filtered__/python-logo-delete-test__invert__'
'-thumbnail-100x100-70.jpg'
)
)
| [
1,
9995,
874,
24285,
3027,
2671,
6987,
1213,
15945,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
3166,
2090,
312,
8789,
1053,
10032,
13,
5215,
5844,
13,
5215,
5455,
13,
5215,
2897,
13,
3166,
528,
4422,
1053,
364,
4378,
929,
13,
13,
3166,
9557,
1053,
478,
1001,
13381,
408,
23366,
2190,
17080,
29918,
16358,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9794,
1053,
4911,
13,
3166,
9557,
29889,
3221,
29889,
8173,
1053,
7090,
13,
3166,
9557,
29889,
3221,
29889,
11739,
29879,
1053,
1954,
771,
546,
368,
3991,
2955,
29892,
15758,
362,
2392,
13,
3166,
9557,
29889,
3221,
29889,
5325,
1053,
3497,
13,
3166,
9557,
29889,
3221,
29889,
5325,
29889,
9009,
287,
1445,
1053,
12545,
3373,
15638,
2283,
13,
3166,
9557,
29889,
3221,
1053,
7797,
19427,
13,
3166,
9557,
29889,
6886,
1053,
15228,
13,
3166,
9557,
29889,
6886,
29889,
12657,
1053,
679,
29918,
6886,
13,
3166,
9557,
29889,
1688,
1053,
12477,
29892,
4321,
8259,
13,
3166,
9557,
29889,
1688,
29889,
13239,
1053,
5712,
29918,
11027,
13,
3166,
9557,
29889,
13239,
3032,
359,
1053,
701,
493,
13,
3166,
9557,
29889,
13239,
1053,
4832,
13,
3166,
9557,
29889,
13239,
29889,
28319,
29889,
13529,
267,
1053,
274,
29925,
860,
280,
13,
13,
3166,
349,
6227,
1053,
7084,
13,
3166,
1791,
29918,
4468,
29889,
1688,
1053,
3450,
3089,
5126,
13,
13,
3166,
1224,
24285,
3027,
2671,
29889,
5325,
1053,
10138,
24285,
2940,
2283,
19124,
13,
3166,
1224,
24285,
3027,
2671,
29889,
4130,
7614,
5313,
1973,
29889,
4572,
287,
3027,
1053,
21403,
5072,
13,
3166,
1224,
24285,
3027,
2671,
29889,
4130,
7614,
5313,
1973,
29889,
29879,
1891,
3027,
1053,
320,
13,
1678,
3792,
15628,
29903,
1891,
2940,
2558,
29892,
317,
1891,
2940,
13,
3166,
1224,
24285,
3027,
2671,
29889,
4130,
7614,
5313,
1973,
29889,
4572,
287,
3027,
1053,
19916,
287,
2940,
13,
3166,
1224,
24285,
3027,
2671,
29889,
3027,
29918,
4495,
1050,
1053,
10138,
24285,
2940,
3073,
29956,
279,
1050,
13,
3166,
1224,
24285,
3027,
2671,
29889,
1727,
6020,
1053,
313,
13,
1678,
1120,
397,
10669,
957,
29892,
13,
1678,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29892,
13,
1678,
838,
2040,
15213,
287,
29892,
13,
1678,
21403,
29903,
1891,
2940,
4035,
1990,
29892,
13,
1678,
21403,
5072,
287,
2940,
4035,
1990,
29892,
13,
1678,
2216,
15213,
287,
29892,
13,
1678,
853,
24622,
29903,
3950,
1170,
29892,
13,
1678,
853,
24622,
5072,
1170,
13,
29897,
13,
3166,
1224,
24285,
3027,
2671,
29889,
11027,
1053,
313,
13,
1678,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
5425,
29999,
3352,
29918,
9464,
5813,
29892,
13,
1678,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
3738,
29931,
4945,
3352,
29918,
9464,
5813,
29892,
13,
1678,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
7390,
11538,
29950,
5607,
8032,
29918,
9464,
5813,
13,
29897,
13,
3166,
1224,
24285,
3027,
2671,
29889,
13239,
1053,
313,
13,
1678,
679,
29918,
28759,
654,
29918,
1989,
29918,
842,
29892,
13,
1678,
21403,
3505,
2558,
29892,
13,
1678,
21403,
3505,
2558,
2697,
13,
29897,
13,
3166,
1224,
24285,
3027,
2671,
29889,
3084,
4097,
1053,
12725,
29918,
407,
7768,
29918,
23583,
13,
3166,
1224,
24285,
3027,
2671,
29889,
874,
24285,
3027,
2671,
1053,
8764,
2986,
2940,
29892,
512,
1765,
2940,
13,
13,
3166,
869,
9514,
1053,
313,
13,
1678,
10138,
24285,
2940,
3057,
3195,
2500,
29892,
13,
1678,
10138,
24285,
2940,
8801,
3057,
3195,
2500,
29892,
13,
1678,
10138,
24285,
2940,
3057,
3195,
2500,
29928,
5364,
29896,
29945,
13,
29897,
13,
3166,
869,
9794,
1053,
313,
13,
1678,
10138,
24285,
2940,
3057,
3195,
29892,
13,
1678,
10138,
24285,
2940,
8801,
3057,
3195,
29892,
13,
1678,
10138,
24285,
2940,
3057,
17553,
9882,
3195,
29892,
13,
29897,
13,
3166,
869,
15550,
19427,
1053,
10138,
24285,
2940,
3057,
3195,
17679,
13,
13,
3035,
16173,
29918,
4219,
353,
8207,
6406,
29914,
21150,
29914,
874,
24285,
3027,
8030,
1688,
4299,
29914,
29896,
22208,
13,
361,
23366,
2190,
17080,
29918,
16358,
29961,
29900,
29962,
1275,
29871,
29896,
322,
23366,
2190,
17080,
29918,
16358,
29961,
29896,
29962,
6736,
29871,
29929,
29901,
13,
1678,
11033,
16173,
29918,
4219,
353,
8207,
6406,
29914,
21150,
29914,
874,
24285,
3027,
8030,
1688,
4299,
29914,
29896,
29914,
3167,
22208,
13,
13,
13,
1990,
10138,
24285,
2940,
3073,
5160,
3057,
8259,
29898,
3057,
8259,
1125,
13,
1678,
9995,
5160,
1243,
1206,
363,
1224,
24285,
3027,
2671,
1213,
15945,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
734,
279,
6767,
2385,
29898,
25932,
1125,
13,
4706,
9995,
12498,
2066,
1754,
491,
10138,
24285,
2940,
14256,
2645,
6987,
1213,
15945,
13,
4706,
22289,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
9651,
6055,
29889,
2303,
4571,
29909,
29918,
21289,
29892,
13,
9651,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
3738,
29931,
4945,
3352,
29918,
9464,
5813,
13,
4706,
1723,
13,
4706,
269,
1891,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
9651,
6055,
29889,
2303,
4571,
29909,
29918,
21289,
29892,
13,
9651,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
5425,
29999,
3352,
29918,
9464,
5813,
13,
4706,
1723,
13,
4706,
12983,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13,
9651,
6055,
29889,
2303,
4571,
29909,
29918,
21289,
29892,
13,
9651,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
7390,
11538,
29950,
5607,
8032,
29918,
9464,
5813,
13,
4706,
1723,
13,
4706,
364,
4378,
929,
29898,
4572,
287,
29918,
2084,
29892,
11455,
29918,
12523,
29922,
5574,
29897,
13,
4706,
364,
4378,
929,
29898,
29879,
1891,
29918,
2084,
29892,
11455,
29918,
12523,
29922,
5574,
29897,
13,
4706,
364,
4378,
929,
29898,
27074,
29918,
2084,
29892,
11455,
29918,
12523,
29922,
5574,
29897,
13,
13,
1678,
822,
4974,
29918,
29963,
414,
24285,
2940,
3073,
29918,
311,
22742,
29898,
1311,
29892,
1746,
29918,
8758,
1125,
13,
4706,
9995,
14697,
421,
2671,
29918,
8758,
29952,
313,
29963,
414,
24285,
2940,
3073,
2777,
29897,
7374,
267,
1213,
15945,
13,
4706,
10153,
29918,
2271,
353,
1746,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
2492,
29918,
2271,
511,
13,
9651,
6213,
13,
4706,
1723,
13,
4706,
1746,
29918,
8758,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
1746,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
2492,
29918,
2271,
511,
13,
632,
29896,
13,
4706,
1723,
13,
4706,
1596,
29898,
2671,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1746,
29918,
8758,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
1746,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
1596,
29898,
2671,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
29897,
13,
4706,
1746,
29918,
8758,
29889,
2671,
29889,
12925,
29889,
8143,
29898,
13,
9651,
1746,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
1746,
29918,
8758,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
1746,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
1596,
29898,
2492,
29918,
2271,
29897,
13,
4706,
7090,
29889,
8143,
29898,
2492,
29918,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
2492,
29918,
2271,
511,
13,
9651,
6213,
13,
4706,
1723,
13,
13,
13,
1990,
10138,
24285,
2940,
3073,
3057,
8259,
29898,
29963,
414,
24285,
2940,
3073,
5160,
3057,
8259,
1125,
13,
1678,
9995,
6330,
1243,
1206,
363,
1224,
24285,
3027,
2671,
1213,
15945,
13,
13,
1678,
5713,
486,
1973,
353,
6024,
874,
24285,
3027,
2671,
2033,
13,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
9995,
8893,
1243,
8871,
29892,
1653,
1243,
3132,
1213,
15945,
13,
4706,
1583,
29889,
6173,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
4706,
1583,
29889,
2732,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
2732,
1495,
13,
4706,
1583,
29889,
18660,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
18660,
1495,
13,
4706,
1583,
29889,
8143,
29918,
1688,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
9651,
10153,
29918,
1853,
2433,
8143,
29918,
1688,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
8030,
29918,
1688,
353,
10138,
24285,
2940,
8801,
3057,
3195,
29889,
12650,
29889,
657,
29898,
20571,
29922,
29896,
29897,
13,
4706,
4800,
353,
12801,
25711,
17013,
16299,
13,
4706,
1404,
353,
4911,
29889,
12650,
29889,
3258,
29918,
1792,
29898,
13,
9651,
8952,
2433,
1688,
742,
13,
9651,
4876,
2433,
29966,
26862,
6227,
29958,
742,
13,
9651,
4800,
29922,
5630,
13,
4706,
1723,
13,
4706,
1404,
29889,
275,
29918,
4925,
353,
5852,
13,
4706,
1404,
29889,
275,
29918,
303,
3470,
353,
5852,
13,
4706,
1404,
29889,
275,
29918,
9136,
1792,
353,
5852,
13,
4706,
1404,
29889,
7620,
580,
13,
4706,
3132,
353,
12477,
580,
13,
4706,
6464,
353,
3132,
29889,
7507,
29898,
13,
9651,
8952,
2433,
1688,
742,
13,
9651,
4800,
29922,
5630,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7507,
29897,
13,
4706,
1583,
29889,
1792,
353,
1404,
13,
4706,
1583,
29889,
4645,
353,
3132,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1967,
9843,
29898,
3027,
29896,
29892,
1967,
29906,
1125,
13,
4706,
9995,
11609,
5852,
565,
421,
3027,
29896,
29952,
669,
421,
3027,
29906,
29952,
526,
13557,
4558,
1213,
15945,
13,
4706,
298,
29896,
353,
1967,
29896,
29889,
29882,
391,
13342,
580,
13,
4706,
298,
29906,
353,
1967,
29906,
29889,
29882,
391,
13342,
580,
13,
4706,
364,
1516,
353,
5844,
29889,
3676,
29898,
13,
9651,
10032,
29898,
13,
18884,
5455,
29889,
1202,
29892,
13,
18884,
2910,
29898,
2892,
263,
29892,
289,
29901,
313,
29874,
448,
289,
29897,
3579,
29871,
29906,
29892,
298,
29896,
29892,
298,
29906,
29897,
13,
9651,
1723,
849,
7431,
29898,
29882,
29896,
29897,
13,
4706,
1723,
13,
4706,
736,
364,
1516,
1275,
29871,
29900,
29889,
29900,
13,
13,
1678,
822,
1243,
29918,
3198,
29918,
12925,
29918,
24772,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
8635,
10898,
526,
6284,
731,
1213,
15945,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
6173,
29889,
3027,
29889,
978,
29892,
525,
4691,
29899,
14569,
29889,
6173,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
2732,
29889,
3027,
29889,
978,
29892,
525,
4691,
29899,
14569,
29889,
2732,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
18660,
29889,
3027,
29889,
978,
29892,
525,
4691,
29899,
14569,
29889,
18660,
1495,
13,
13,
1678,
822,
1243,
29918,
386,
21145,
29918,
690,
1891,
29918,
2084,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
266,
21145,
317,
3950,
10898,
526,
731,
5149,
1213,
15945,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
29883,
1336,
29918,
690,
1891,
29918,
2084,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
274,
1336,
317,
3950,
10898,
526,
731,
5149,
1213,
15945,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
3027,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29906,
29945,
1649,
29900,
29899,
29906,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
18660,
29889,
3027,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29955,
29945,
1649,
29900,
29899,
29955,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
18660,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
2732,
29889,
3027,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29945,
1649,
29900,
29899,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
262,
1765,
29918,
4572,
287,
29918,
2084,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
274,
1336,
317,
3950,
10898,
526,
731,
5149,
1213,
15945,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
3027,
29889,
26705,
29889,
262,
1765,
29889,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
1649,
262,
1765,
26914,
6173,
29915,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
13919,
5072,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
21403,
5072,
1153,
4637,
1213,
15945,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
13919,
5072,
1125,
13,
9651,
8340,
29918,
4572,
353,
1583,
29889,
6173,
29889,
3027,
29889,
26705,
29889,
5464,
29918,
735,
22137,
29889,
2271,
13,
9651,
628,
8340,
29918,
4572,
13,
13,
1678,
822,
1243,
29918,
262,
1765,
29918,
11242,
29918,
386,
21145,
29918,
29879,
3950,
29918,
4572,
287,
29918,
2084,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
274,
1336,
317,
3950,
10898,
526,
731,
5149,
1213,
15945,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
3027,
29889,
26705,
29889,
262,
1765,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
313,
13,
18884,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
1649,
262,
1765,
1649,
29915,
13,
18884,
17411,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
27074,
29918,
3027,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
12983,
4558,
664,
408,
9146,
1213,
15945,
13,
4706,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
27074,
1649,
29914,
27074,
29889,
2732,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
22208,
13,
9651,
525,
27074,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29945,
1649,
29900,
29899,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
22208,
13,
9651,
525,
27074,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
26705,
29889,
262,
1765,
29889,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
27074,
1649,
29914,
1649,
4572,
287,
1649,
29914,
27074,
1649,
262,
1765,
26914,
2732,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29918,
29906,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
29914,
265,
29899,
12925,
29899,
27074,
22208,
13,
9651,
525,
27074,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29945,
1649,
29900,
29899,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29918,
29906,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
29914,
265,
29899,
12925,
29899,
27074,
22208,
13,
9651,
525,
27074,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29918,
29906,
29889,
26705,
29889,
262,
1765,
29889,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
27074,
1649,
29914,
265,
29899,
12925,
29899,
27074,
29914,
1649,
4572,
287,
1649,
22208,
13,
9651,
525,
27074,
1649,
262,
1765,
26914,
2732,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
2671,
29889,
12925,
29889,
2311,
29898,
13,
18884,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
978,
13,
9651,
1723,
338,
29871,
29900,
13,
4706,
1723,
13,
4706,
1583,
29889,
6173,
29889,
25253,
29918,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
7700,
13,
13,
1678,
822,
1243,
29918,
26740,
29918,
407,
7768,
29918,
5975,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
349,
13152,
29902,
1819,
526,
731,
5149,
1213,
15945,
13,
4706,
432,
4061,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
432,
4061,
29889,
3027,
29889,
407,
7768,
29892,
13,
9651,
313,
29900,
29889,
29906,
29945,
29892,
29871,
29900,
29889,
29906,
29945,
29897,
13,
4706,
1723,
13,
4706,
432,
4061,
29889,
3027,
29889,
407,
7768,
353,
313,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29945,
29897,
13,
4706,
432,
4061,
29889,
7620,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
432,
4061,
29889,
3027,
29889,
407,
7768,
29892,
13,
9651,
313,
29900,
29889,
29945,
29892,
29871,
29900,
29889,
29945,
29897,
13,
4706,
1723,
13,
4706,
432,
4061,
29889,
3027,
29889,
407,
7768,
353,
525,
29900,
29889,
29906,
29945,
29916,
29900,
29889,
29906,
29945,
29915,
13,
4706,
432,
4061,
29889,
7620,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
432,
4061,
29889,
3027,
29889,
407,
7768,
29892,
13,
9651,
313,
29900,
29889,
29906,
29945,
29892,
29871,
29900,
29889,
29906,
29945,
29897,
13,
4706,
1723,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
19448,
2392,
1125,
13,
9651,
1224,
24285,
3027,
2671,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
18884,
10153,
29918,
1853,
2433,
6173,
29915,
13,
9651,
13742,
3027,
13,
9651,
1224,
24285,
3027,
2671,
29889,
407,
7768,
353,
313,
29896,
29889,
29945,
29892,
29871,
29906,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
19448,
2392,
1125,
13,
9651,
1224,
24285,
3027,
2671,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
18884,
10153,
29918,
1853,
2433,
6173,
29915,
13,
9651,
13742,
3027,
13,
9651,
1224,
24285,
3027,
2671,
29889,
407,
7768,
353,
525,
23945,
2506,
29883,
1682,
2807,
29915,
13,
13,
1678,
822,
1243,
29918,
20965,
29918,
407,
7768,
29918,
23583,
29918,
18157,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
12725,
29918,
407,
7768,
29918,
23583,
1736,
408,
3806,
1213,
15945,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
12725,
29918,
407,
7768,
29918,
23583,
3552,
29900,
29892,
29871,
29896,
29889,
29945,
29892,
29871,
29953,
876,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
265,
29918,
2310,
392,
29918,
20054,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
1653,
29918,
265,
29918,
2310,
392,
7223,
338,
731,
7128,
2486,
1213,
15945,
13,
4706,
432,
4061,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
6173,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
29897,
13,
4706,
432,
4061,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
1583,
29889,
9294,
5574,
29898,
6173,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
1125,
13,
9651,
432,
4061,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
9651,
432,
4061,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
525,
23945,
280,
29915,
13,
13,
1678,
822,
1243,
29918,
3258,
29918,
265,
29918,
2310,
392,
29918,
2220,
2877,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
1653,
29918,
265,
29918,
2310,
392,
9863,
1736,
408,
18811,
3368,
1213,
15945,
13,
4706,
432,
4061,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
4706,
1583,
29889,
9294,
29918,
29963,
414,
24285,
2940,
3073,
29918,
311,
22742,
29898,
6173,
29889,
3027,
29897,
13,
13,
1678,
822,
1243,
29918,
6341,
29918,
9009,
29918,
517,
29918,
386,
21145,
29918,
311,
22742,
29898,
1311,
1125,
13,
4706,
9995,
3057,
2888,
6441,
29918,
517,
7374,
291,
1736,
1213,
15945,
13,
4706,
288,
353,
10138,
24285,
2940,
3057,
17553,
9882,
3195,
29889,
12650,
29889,
657,
580,
13,
4706,
1746,
29918,
8758,
353,
288,
29889,
3027,
13,
4706,
1746,
29918,
8758,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
2224,
353,
1746,
29918,
8758,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1746,
29918,
8758,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
2084,
29897,
13,
4706,
1723,
13,
4706,
1746,
29918,
8758,
29889,
8143,
29918,
29879,
1891,
29918,
8346,
580,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
1746,
29918,
8758,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
2084,
29897,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
3027,
29918,
4495,
1050,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
10138,
24285,
2940,
3073,
29956,
279,
1050,
1736,
408,
18811,
3368,
1213,
15945,
13,
4706,
432,
4061,
29918,
4495,
1050,
353,
10138,
24285,
2940,
3073,
29956,
279,
1050,
29898,
13,
9651,
2777,
29918,
272,
29918,
1972,
842,
29922,
1311,
29889,
6173,
29892,
13,
9651,
7697,
654,
29918,
1989,
29918,
842,
2433,
1688,
29918,
842,
742,
13,
9651,
1967,
29918,
5552,
2433,
3027,
29915,
13,
4706,
1723,
13,
4706,
954,
29918,
11600,
29892,
5229,
29918,
517,
29918,
3258,
353,
432,
4061,
29918,
4495,
1050,
29889,
29893,
2817,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1949,
29918,
11600,
29892,
29871,
29945,
29897,
13,
4706,
599,
29918,
2492,
29879,
29918,
4495,
1050,
353,
10138,
24285,
2940,
3073,
29956,
279,
1050,
29898,
13,
9651,
2777,
29918,
272,
29918,
1972,
842,
29922,
29963,
414,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
735,
2325,
29898,
13,
18884,
10153,
29918,
1853,
2433,
8143,
29918,
1688,
29915,
13,
9651,
10353,
13,
9651,
7697,
654,
29918,
1989,
29918,
842,
7607,
13,
18884,
6702,
1688,
29918,
386,
3774,
742,
525,
386,
21145,
1649,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
5477,
13,
18884,
6702,
1688,
29918,
29883,
1336,
742,
525,
29883,
1336,
1649,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
5477,
13,
18884,
6702,
1688,
29918,
262,
1765,
742,
525,
26705,
1649,
262,
1765,
1649,
2271,
5477,
13,
9651,
10353,
13,
9651,
1967,
29918,
5552,
2433,
3027,
742,
13,
9651,
26952,
29922,
5574,
13,
4706,
1723,
13,
4706,
954,
29918,
11600,
29892,
5229,
29918,
517,
29918,
3258,
353,
599,
29918,
2492,
29879,
29918,
4495,
1050,
29889,
29893,
2817,
580,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
1125,
13,
9651,
8340,
29918,
4495,
1050,
353,
10138,
24285,
2940,
3073,
29956,
279,
1050,
29898,
13,
18884,
2777,
29918,
272,
29918,
1972,
842,
29922,
1839,
20965,
7464,
13,
18884,
7697,
654,
29918,
1989,
29918,
842,
7607,
13,
462,
1678,
6702,
1688,
29918,
386,
3774,
742,
525,
386,
21145,
1649,
29896,
29900,
29916,
29896,
29900,
5477,
13,
18884,
10353,
13,
18884,
1967,
29918,
5552,
2433,
3027,
29915,
13,
9651,
1723,
13,
9651,
628,
8340,
29918,
4495,
1050,
13,
13,
1678,
822,
1243,
29918,
29963,
414,
24285,
2940,
3073,
17679,
29918,
4905,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
10138,
24285,
2940,
3073,
17679,
7797,
7093,
5149,
1213,
15945,
13,
4706,
12529,
353,
3450,
3089,
5126,
580,
13,
4706,
2009,
353,
12529,
29889,
657,
11219,
6406,
29914,
1495,
13,
4706,
7797,
3950,
353,
10138,
24285,
2940,
3057,
3195,
17679,
29898,
13,
9651,
1583,
29889,
6173,
29892,
13,
9651,
3030,
3790,
29915,
3827,
2396,
2009,
29913,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7797,
3950,
29889,
1272,
29889,
657,
877,
3027,
5477,
13,
9651,
426,
13,
18884,
525,
1688,
29918,
29883,
1336,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29915,
13,
462,
1678,
17411,
29883,
29900,
29899,
29906,
29945,
1649,
29900,
29899,
29906,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
262,
1765,
29918,
29883,
1336,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
4572,
287,
1649,
22208,
13,
462,
1678,
525,
4691,
29899,
14569,
1649,
262,
1765,
1649,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29906,
29945,
1649,
29900,
29899,
29906,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
262,
1765,
29918,
386,
3774,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
4572,
287,
1649,
22208,
13,
462,
1678,
525,
4691,
29899,
14569,
1649,
262,
1765,
1649,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
262,
1765,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
4572,
287,
1649,
22208,
13,
462,
1678,
525,
4691,
29899,
14569,
1649,
262,
1765,
26914,
6173,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
386,
3774,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
386,
21145,
29915,
13,
462,
1678,
17411,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
18884,
1723,
13,
9651,
500,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7797,
3950,
29889,
1272,
29889,
657,
877,
25253,
29918,
3027,
5477,
13,
9651,
426,
13,
18884,
525,
1688,
29918,
29883,
1336,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
29914,
27074,
29899,
29883,
1336,
29915,
13,
462,
1678,
17411,
29883,
29900,
29899,
29945,
1649,
29900,
29899,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
262,
1765,
29918,
29883,
1336,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
29914,
1649,
4572,
287,
1649,
29914,
27074,
1649,
262,
1765,
1649,
29915,
13,
462,
1678,
17411,
29883,
1336,
29899,
29883,
29900,
29899,
29945,
1649,
29900,
29899,
29945,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
262,
1765,
29918,
386,
3774,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
29914,
1649,
4572,
287,
1649,
29914,
27074,
1649,
262,
1765,
1649,
29915,
13,
462,
1678,
17411,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
262,
1765,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
27074,
1649,
29914,
1649,
4572,
287,
1649,
29914,
27074,
29915,
13,
462,
1678,
525,
1649,
262,
1765,
26914,
2732,
29915,
13,
18884,
10353,
13,
18884,
525,
1688,
29918,
386,
3774,
2396,
313,
13,
462,
1678,
525,
1124,
597,
1688,
2974,
29914,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
29914,
27074,
29899,
386,
21145,
29915,
13,
462,
1678,
17411,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29889,
2732,
29915,
13,
18884,
1723,
13,
9651,
500,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
8030,
29918,
7729,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
10138,
24285,
2940,
29925,
13152,
2965,
1406,
8801,
11109,
15376,
7128,
2486,
1213,
15945,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
657,
29898,
13,
9651,
11033,
16173,
29918,
4219,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29900,
29897,
13,
4706,
565,
4832,
29889,
20055,
29906,
29901,
13,
9651,
2933,
29918,
3051,
353,
851,
29898,
5327,
29889,
3051,
29897,
13,
4706,
1683,
29901,
13,
9651,
2933,
29918,
3051,
353,
851,
29898,
5327,
29889,
3051,
29892,
8025,
2433,
9420,
29899,
29947,
1495,
13,
4706,
396,
4321,
393,
3513,
15376,
5149,
13,
4706,
1583,
29889,
9294,
797,
7020,
29898,
13,
9651,
313,
13,
18884,
12801,
2154,
1134,
543,
726,
29914,
7729,
29908,
525,
13,
18884,
525,
4351,
13802,
7959,
29914,
874,
24285,
3027,
2671,
29914,
1315,
29914,
874,
24285,
3027,
2671,
29889,
1315,
1013,
29915,
13,
18884,
525,
829,
2154,
16299,
13,
9651,
10353,
13,
9651,
2933,
29918,
3051,
13,
4706,
1723,
13,
4706,
396,
4321,
3734,
1746,
411,
349,
13152,
29902,
13,
4706,
1583,
29889,
9294,
797,
7020,
29898,
13,
9651,
313,
13,
18884,
12801,
4563,
770,
543,
3027,
29899,
6312,
11420,
1013,
29915,
13,
18884,
525,
259,
529,
4563,
770,
543,
3149,
29899,
19190,
29908,
1178,
543,
3027,
29918,
29900,
29918,
3149,
29899,
19190,
29908,
29915,
13,
18884,
525,
308,
848,
29899,
3027,
29918,
25347,
29918,
333,
543,
3027,
29918,
29900,
29918,
3027,
25347,
1013,
29915,
13,
18884,
525,
4706,
529,
4563,
770,
543,
407,
7768,
29899,
3149,
29908,
1178,
543,
3027,
29918,
29900,
29918,
407,
7768,
5319,
4563,
16299,
13,
18884,
525,
1678,
1533,
4563,
16299,
13,
18884,
525,
1678,
529,
4563,
770,
543,
3027,
29899,
6312,
6426,
1013,
29915,
13,
18884,
525,
4706,
529,
2492,
4765,
13802,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
386,
21145,
29899,
29941,
29900,
29900,
29916,
29941,
29900,
29900,
29889,
2732,
29908,
29915,
13,
18884,
525,
632,
1178,
543,
3027,
29918,
29900,
29918,
3027,
25347,
29908,
29915,
13,
18884,
525,
632,
848,
29899,
10892,
29918,
2671,
29918,
333,
543,
333,
29918,
3027,
29918,
29896,
29908,
29915,
13,
18884,
525,
632,
848,
29899,
3149,
29918,
19190,
29918,
333,
543,
3027,
29918,
29900,
29918,
3149,
29899,
19190,
29908,
29915,
13,
18884,
525,
632,
848,
29899,
407,
7768,
29918,
333,
543,
3027,
29918,
29900,
29918,
407,
7768,
29908,
770,
543,
29879,
1891,
3027,
29899,
25347,
4681,
29915,
13,
18884,
525,
1678,
1533,
4563,
16299,
13,
18884,
525,
829,
4563,
16299,
13,
9651,
10353,
13,
9651,
2933,
29918,
3051,
13,
4706,
1723,
13,
4706,
396,
4321,
3734,
1746,
694,
349,
13152,
29902,
13,
4706,
1583,
29889,
9294,
797,
7020,
29898,
13,
9651,
313,
13,
18884,
12801,
29874,
2822,
13802,
9799,
29914,
4691,
29899,
14569,
29889,
6173,
1013,
4691,
29899,
14569,
29889,
6173,
829,
29874,
16299,
13,
9651,
10353,
13,
9651,
2933,
29918,
3051,
13,
4706,
1723,
13,
4706,
396,
4321,
13136,
1967,
694,
349,
13152,
29902,
13,
13,
4706,
1583,
29889,
9294,
797,
7020,
29898,
13,
9651,
313,
13,
18884,
12801,
4563,
770,
543,
689,
29899,
798,
1746,
29899,
25253,
29918,
3027,
1013,
29915,
13,
18884,
12801,
4563,
16299,
13,
18884,
12801,
1643,
363,
543,
333,
29918,
25253,
29918,
3027,
1013,
27636,
1967,
29901,
829,
1643,
16299,
13,
18884,
525,
7583,
368,
29901,
529,
29874,
2822,
13802,
9799,
29914,
735,
361,
29899,
20659,
29899,
19057,
22208,
13,
18884,
525,
29931,
4167,
5738,
29918,
29947,
29889,
6173,
1013,
735,
361,
29899,
20659,
29899,
19057,
29914,
29931,
4167,
5738,
29918,
29947,
29889,
6173,
29915,
13,
18884,
525,
829,
29874,
29958,
529,
2080,
1178,
543,
25253,
29918,
3027,
29899,
8551,
29918,
333,
29908,
525,
13,
18884,
525,
978,
543,
25253,
29918,
3027,
29899,
8551,
29908,
1134,
543,
12348,
29908,
2900,
529,
1643,
525,
13,
18884,
525,
1454,
543,
25253,
29918,
3027,
29899,
8551,
29918,
333,
1013,
18759,
829,
1643,
5299,
1182,
2900,
7277,
29901,
525,
13,
18884,
12801,
2080,
1178,
543,
333,
29918,
25253,
29918,
3027,
29908,
1024,
543,
25253,
29918,
3027,
29908,
525,
13,
18884,
525,
1853,
543,
1445,
29908,
2900,
29915,
13,
18884,
525,
829,
4563,
16299,
13,
18884,
525,
829,
4563,
16299,
13,
9651,
10353,
13,
9651,
2933,
29918,
3051,
13,
4706,
1723,
13,
4706,
396,
4321,
13136,
1967,
411,
349,
13152,
29902,
13,
4706,
1583,
29889,
9294,
797,
7020,
29898,
13,
9651,
313,
13,
18884,
12801,
4563,
770,
543,
874,
24285,
3027,
2671,
1013,
29915,
13,
18884,
525,
1678,
529,
4563,
770,
543,
29879,
1891,
3027,
29899,
1545,
2847,
1013,
29915,
13,
18884,
525,
4706,
529,
1643,
770,
543,
874,
24285,
3027,
2671,
29899,
1643,
1013,
7583,
368,
829,
1643,
16299,
13,
18884,
525,
4706,
529,
29874,
2822,
13802,
9799,
29914,
735,
361,
29899,
20659,
29899,
19057,
29914,
29931,
4167,
5738,
29918,
29953,
29889,
6173,
1013,
29915,
13,
18884,
525,
4706,
429,
361,
29899,
20659,
29899,
19057,
29914,
29931,
4167,
5738,
29918,
29953,
29889,
6173,
829,
29874,
16299,
13,
18884,
525,
1678,
1533,
4563,
16299,
13,
18884,
525,
1678,
529,
4563,
770,
543,
29879,
1891,
3027,
29899,
1545,
2821,
1013,
29915,
13,
18884,
525,
4706,
529,
2080,
1178,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29899,
8551,
29918,
333,
29908,
29915,
13,
18884,
525,
1669,
1024,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29899,
8551,
29908,
1134,
543,
12348,
29908,
2900,
29915,
13,
18884,
525,
4706,
529,
1643,
770,
543,
874,
24285,
3027,
2671,
29899,
1643,
29908,
363,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29899,
8551,
29918,
333,
1013,
29915,
13,
18884,
525,
4706,
17732,
29901,
1533,
1643,
16299,
13,
18884,
525,
1678,
1533,
4563,
16299,
13,
18884,
525,
1678,
529,
4563,
770,
543,
29879,
1891,
3027,
29899,
1545,
25267,
1013,
29915,
13,
18884,
525,
4706,
529,
1643,
770,
543,
874,
24285,
3027,
2671,
29899,
1643,
1013,
29915,
13,
18884,
525,
9651,
28267,
8984,
310,
23829,
829,
1643,
16299,
13,
18884,
525,
4706,
529,
4563,
770,
543,
3027,
29899,
6312,
11420,
1013,
29915,
13,
18884,
525,
9651,
529,
4563,
770,
543,
3149,
29899,
19190,
29908,
29915,
13,
18884,
525,
462,
1178,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29918,
3149,
29899,
19190,
29908,
29915,
13,
18884,
525,
462,
848,
29899,
3027,
29918,
25347,
29918,
333,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29918,
3027,
25347,
1013,
29915,
13,
18884,
525,
18884,
529,
4563,
770,
543,
407,
7768,
29899,
3149,
29908,
1178,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29918,
407,
7768,
5319,
4563,
16299,
13,
18884,
525,
9651,
1533,
4563,
16299,
13,
18884,
525,
9651,
529,
4563,
770,
543,
3027,
29899,
6312,
6426,
1013,
29915,
13,
18884,
525,
18884,
529,
2492,
4765,
13802,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
735,
361,
29899,
20659,
29899,
19057,
22208,
13,
18884,
525,
29931,
4167,
5738,
29918,
29953,
29899,
386,
21145,
29899,
29941,
29900,
29900,
29916,
29941,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29908,
29915,
13,
18884,
525,
462,
268,
1178,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29918,
3027,
25347,
29908,
29915,
13,
18884,
525,
462,
268,
848,
29899,
10892,
29918,
2671,
29918,
333,
543,
333,
29918,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29896,
29908,
29915,
13,
18884,
525,
462,
268,
848,
29899,
3149,
29918,
19190,
29918,
333,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29918,
3149,
29899,
19190,
29908,
29915,
13,
18884,
525,
462,
268,
848,
29899,
407,
7768,
29918,
333,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29918,
407,
7768,
29908,
770,
543,
29879,
1891,
3027,
29899,
25347,
4681,
29915,
13,
18884,
525,
9651,
1533,
4563,
16299,
13,
18884,
525,
4706,
1533,
4563,
16299,
13,
18884,
525,
1678,
1533,
4563,
16299,
13,
18884,
525,
1678,
529,
4563,
770,
543,
29879,
1891,
3027,
29899,
1545,
716,
29899,
9009,
1013,
29915,
13,
18884,
525,
4706,
529,
1643,
770,
543,
874,
24285,
3027,
2671,
29899,
1643,
1013,
7277,
829,
1643,
16299,
13,
18884,
525,
4706,
529,
2080,
770,
543,
1445,
29899,
1859,
22969,
29908,
1178,
543,
333,
29918,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29908,
525,
13,
18884,
525,
978,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29908,
1134,
543,
1445,
29908,
2900,
29915,
13,
18884,
525,
1678,
1533,
4563,
16299,
13,
18884,
525,
1678,
529,
2080,
770,
543,
407,
7768,
29899,
2080,
29908,
1178,
543,
333,
29918,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29896,
29908,
29915,
13,
18884,
525,
965,
1024,
543,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29896,
29908,
1134,
543,
10892,
29908,
995,
543,
29896,
29889,
29900,
29916,
29896,
29889,
29900,
29908,
2900,
29915,
13,
18884,
525,
829,
4563,
16299,
13,
9651,
10353,
13,
9651,
2933,
29918,
3051,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
8030,
29918,
1688,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
1583,
29889,
8030,
29918,
1688,
29889,
3027,
29889,
386,
21145,
1839,
29941,
29900,
29900,
29916,
29941,
29900,
29900,
13359,
978,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
285,
353,
10138,
24285,
2940,
8801,
3057,
3195,
2500,
29898,
13,
9651,
848,
3790,
13,
18884,
525,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
2396,
15516,
13,
18884,
525,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29918,
29900,
29899,
8551,
2396,
525,
265,
29915,
13,
9651,
2981,
13,
9651,
2777,
29922,
1311,
29889,
8030,
29918,
1688,
13,
4706,
1723,
13,
4706,
2777,
353,
285,
29889,
7620,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8758,
29889,
25253,
29918,
3027,
29918,
2541,
29918,
407,
7768,
29889,
978,
29892,
27255,
13,
13,
1678,
822,
1243,
29918,
29963,
414,
24285,
2940,
2283,
19124,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
10138,
24285,
2940,
2283,
19124,
1736,
408,
9146,
1213,
15945,
13,
4706,
1583,
29889,
6173,
29889,
3027,
353,
525,
4691,
29899,
14569,
29899,
29906,
29889,
6173,
29915,
13,
4706,
1583,
29889,
6173,
29889,
7620,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
29906,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
6173,
29889,
3027,
353,
525,
4691,
29899,
14569,
29889,
6173,
29915,
13,
4706,
1583,
29889,
6173,
29889,
7620,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1583,
29889,
6173,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
1746,
1445,
29918,
5415,
353,
1583,
29889,
6173,
29889,
3027,
13,
4706,
628,
1746,
1445,
29918,
5415,
29889,
2671,
13,
4706,
1583,
29889,
6173,
29889,
3027,
353,
1746,
1445,
29918,
5415,
13,
4706,
10153,
29918,
2084,
353,
1583,
29889,
6173,
29889,
3027,
29889,
2084,
13,
4706,
10153,
29918,
1445,
353,
1722,
29898,
2492,
29918,
2084,
29892,
525,
6050,
1495,
13,
4706,
9557,
29918,
1445,
353,
3497,
29898,
2492,
29918,
1445,
29897,
13,
4706,
1583,
29889,
6173,
29889,
3027,
353,
9557,
29918,
1445,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
6708,
2392,
1125,
13,
9651,
921,
353,
10138,
24285,
2940,
2283,
19124,
29898,
1311,
29889,
6173,
29889,
3027,
29889,
978,
29897,
13,
9651,
10138,
24285,
2940,
2283,
19124,
17255,
657,
12035,
29916,
29897,
13,
13,
1678,
822,
1243,
29918,
29963,
414,
24285,
2940,
3073,
29918,
23945,
29880,
3097,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
10138,
24285,
2940,
3073,
8871,
508,
367,
5839,
839,
29914,
348,
23945,
839,
1213,
15945,
13,
4706,
274,
29925,
860,
280,
29889,
15070,
29898,
13,
9651,
1583,
29889,
6173,
29892,
13,
9651,
1722,
703,
23945,
1026,
342,
29889,
29886,
613,
376,
29893,
29890,
1159,
13,
4706,
1723,
13,
4706,
432,
4061,
29918,
348,
23945,
839,
353,
274,
29925,
860,
280,
29889,
1359,
29898,
13,
9651,
1722,
703,
23945,
1026,
342,
29889,
29886,
613,
376,
6050,
1159,
13,
4706,
1723,
13,
4706,
432,
4061,
29918,
8758,
353,
432,
4061,
29918,
348,
23945,
839,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
432,
4061,
29918,
8758,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
29892,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
5839,
839,
29918,
3859,
353,
1583,
29889,
6173,
29889,
3027,
17255,
657,
3859,
1649,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
5839,
839,
29918,
3859,
29892,
13,
9651,
426,
13,
18884,
22868,
3258,
29918,
265,
29918,
2310,
392,
2396,
7700,
29892,
13,
18884,
22868,
2055,
4430,
2396,
5852,
29892,
13,
18884,
22868,
1445,
2396,
6213,
29892,
13,
18884,
525,
978,
2396,
525,
4691,
29899,
14569,
29889,
6173,
742,
13,
18884,
525,
15603,
2396,
7700,
13,
9651,
500,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
5348,
29903,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
29934,
11794,
22122,
29918,
10818,
29918,
1660,
9375,
29918,
26740,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
29934,
11794,
22122,
29918,
10818,
29918,
1660,
9375,
4444,
2854,
1078,
1213,
15945,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1888,
771,
546,
368,
3991,
2955,
1125,
13,
9651,
679,
29918,
28759,
654,
29918,
1989,
29918,
842,
877,
13221,
29918,
1333,
29918,
28997,
1495,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
13919,
3505,
2558,
2697,
1125,
13,
9651,
679,
29918,
28759,
654,
29918,
1989,
29918,
842,
877,
20965,
29918,
842,
1495,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
13919,
3505,
2558,
1125,
13,
9651,
679,
29918,
28759,
654,
29918,
1989,
29918,
842,
877,
20965,
29918,
2311,
29918,
1989,
1495,
13,
13,
1678,
822,
4770,
1688,
29918,
735,
361,
29918,
20659,
29918,
23361,
29918,
29896,
29947,
29900,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
429,
361,
19843,
1360,
29941,
848,
10174,
6284,
1213,
15945,
13,
4706,
429,
361,
29918,
29941,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
9651,
10153,
29918,
1853,
2433,
735,
361,
29918,
29941,
29915,
13,
4706,
1723,
13,
4706,
429,
361,
29918,
29941,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
429,
361,
29918,
29941,
29918,
2084,
353,
429,
361,
29918,
29941,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
4706,
429,
361,
29918,
29941,
29918,
2492,
353,
429,
361,
29918,
29941,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
429,
361,
29918,
29941,
29918,
2084,
13,
4706,
1723,
13,
4706,
429,
361,
29918,
29941,
29918,
6451,
353,
429,
361,
29918,
29941,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
525,
27902,
29899,
351,
475,
303,
29914,
735,
361,
29899,
20659,
29899,
19057,
22208,
13,
9651,
525,
29931,
4167,
5738,
29918,
29941,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
10153,
353,
7084,
29889,
3150,
29898,
735,
361,
29918,
29941,
29918,
2492,
29897,
13,
4706,
2761,
29918,
2492,
353,
7084,
29889,
3150,
29898,
735,
361,
29918,
29941,
29918,
6451,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
3027,
9843,
29898,
13,
18884,
10153,
29892,
13,
18884,
2761,
29918,
2492,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
4770,
1688,
29918,
735,
361,
29918,
20659,
29918,
23361,
29918,
29906,
29955,
29900,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
429,
361,
19843,
1360,
29953,
848,
10174,
6284,
1213,
15945,
13,
4706,
429,
361,
29918,
29953,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
9651,
10153,
29918,
1853,
2433,
735,
361,
29918,
29953,
29915,
13,
4706,
1723,
13,
4706,
429,
361,
29918,
29953,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
429,
361,
29918,
29953,
29918,
2492,
353,
429,
361,
29918,
29953,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
429,
361,
29918,
29953,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
4706,
1723,
13,
4706,
429,
361,
29918,
29953,
29918,
6451,
353,
429,
361,
29918,
29953,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
525,
27902,
29899,
351,
475,
303,
29914,
735,
361,
29899,
20659,
29899,
19057,
22208,
13,
9651,
525,
29931,
4167,
5738,
29918,
29953,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
3027,
9843,
29898,
13,
18884,
7084,
29889,
3150,
29898,
735,
361,
29918,
29953,
29918,
2492,
511,
13,
18884,
7084,
29889,
3150,
29898,
735,
361,
29918,
29953,
29918,
6451,
29897,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
4770,
1688,
29918,
735,
361,
29918,
20659,
29918,
23361,
29918,
29929,
29900,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
429,
361,
19843,
1360,
29947,
848,
10174,
6284,
1213,
15945,
13,
4706,
429,
361,
29918,
29947,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
9651,
10153,
29918,
1853,
2433,
735,
361,
29918,
29947,
29915,
13,
4706,
1723,
13,
4706,
429,
361,
29918,
29947,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
429,
361,
29918,
29947,
29918,
2492,
353,
429,
361,
29918,
29947,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
429,
361,
29918,
29947,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
4706,
1723,
13,
4706,
429,
361,
29918,
29947,
29918,
6451,
353,
429,
361,
29918,
29947,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
525,
27902,
29899,
351,
475,
303,
29914,
735,
361,
29899,
20659,
29899,
19057,
22208,
13,
9651,
525,
29931,
4167,
5738,
29918,
29947,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
3027,
9843,
29898,
13,
18884,
7084,
29889,
3150,
29898,
735,
361,
29918,
29947,
29918,
2492,
511,
13,
18884,
7084,
29889,
3150,
29898,
735,
361,
29918,
29947,
29918,
6451,
29897,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
22672,
29918,
392,
29918,
18575,
29918,
29883,
1336,
29898,
1311,
1125,
13,
4706,
9995,
3057,
14698,
322,
11408,
8182,
567,
411,
525,
1062,
10291,
29915,
349,
13152,
29902,
1819,
1213,
15945,
13,
4706,
1243,
29918,
18660,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
9651,
10153,
29918,
1853,
2433,
18660,
29915,
13,
4706,
1723,
13,
4706,
1243,
29918,
18660,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
1243,
29918,
18660,
29889,
3027,
29889,
407,
7768,
353,
313,
29900,
29892,
29871,
29900,
29897,
13,
4706,
396,
11198,
936,
281,
29914,
349,
13152,
29902,
1275,
525,
29900,
29916,
29900,
29915,
13,
4706,
11408,
29918,
3027,
29918,
29883,
1336,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
1243,
29918,
18660,
29889,
3027,
29889,
29883,
1336,
1839,
29941,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
4706,
1723,
13,
4706,
11408,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
525,
27902,
29899,
351,
475,
303,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29900,
1649,
29900,
29899,
29941,
29900,
29916,
29896,
29900,
29900,
29889,
18660,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
3027,
9843,
29898,
13,
18884,
7084,
29889,
3150,
29898,
18575,
29918,
3027,
29918,
29883,
1336,
511,
13,
18884,
7084,
29889,
3150,
29898,
18575,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
29897,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
396,
6912,
7731,
281,
29914,
349,
13152,
29902,
1275,
525,
29900,
29916,
29900,
29915,
13,
4706,
4029,
466,
29918,
3027,
29918,
29883,
1336,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
1243,
29918,
18660,
29889,
3027,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29941,
29900,
13359,
978,
13,
4706,
1723,
13,
4706,
4029,
466,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
525,
27902,
29899,
351,
475,
303,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29900,
1649,
29900,
29899,
29896,
29900,
29900,
29916,
29941,
29900,
29889,
18660,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
3027,
9843,
29898,
13,
18884,
7084,
29889,
3150,
29898,
2015,
466,
29918,
3027,
29918,
29883,
1336,
511,
13,
18884,
7084,
29889,
3150,
29898,
2015,
466,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
29897,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
4706,
1243,
29918,
18660,
29889,
3027,
29889,
407,
7768,
353,
313,
29896,
29892,
29871,
29896,
29897,
13,
4706,
396,
11198,
936,
281,
29914,
349,
13152,
29902,
1275,
525,
29896,
29916,
29896,
29915,
13,
4706,
11408,
29918,
3027,
29918,
29883,
1336,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
1243,
29918,
18660,
29889,
3027,
29889,
29883,
1336,
1839,
29941,
29900,
29916,
29896,
29900,
29900,
13359,
978,
13,
4706,
1723,
13,
4706,
11408,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
525,
27902,
29899,
351,
475,
303,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29896,
1649,
29896,
29899,
29941,
29900,
29916,
29896,
29900,
29900,
29889,
18660,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
3027,
9843,
29898,
13,
18884,
7084,
29889,
3150,
29898,
18575,
29918,
3027,
29918,
29883,
1336,
511,
13,
18884,
7084,
29889,
3150,
29898,
18575,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
29897,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
396,
6912,
7731,
281,
29914,
349,
13152,
29902,
1275,
525,
29896,
29916,
29896,
29915,
13,
4706,
4029,
466,
29918,
3027,
29918,
29883,
1336,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
1243,
29918,
18660,
29889,
3027,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29941,
29900,
13359,
978,
13,
4706,
1723,
13,
4706,
4029,
466,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
353,
1243,
29918,
18660,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
3150,
29898,
13,
9651,
525,
27902,
29899,
351,
475,
303,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29896,
1649,
29896,
29899,
29896,
29900,
29900,
29916,
29941,
29900,
29889,
18660,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
1583,
29889,
3027,
9843,
29898,
13,
18884,
7084,
29889,
3150,
29898,
2015,
466,
29918,
3027,
29918,
29883,
1336,
511,
13,
18884,
7084,
29889,
3150,
29898,
2015,
466,
29918,
3027,
29918,
29883,
1336,
29918,
6451,
29897,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
29928,
11770,
5072,
29898,
1311,
1125,
13,
4706,
9995,
3057,
12983,
1967,
9863,
363,
18094,
1213,
15945,
13,
4706,
1243,
29918,
2732,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
13,
9651,
10153,
29918,
1853,
2433,
2732,
29915,
13,
4706,
1723,
13,
4706,
1243,
29918,
2732,
29889,
25253,
29918,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
1243,
29918,
2732,
29889,
25253,
29918,
3027,
29889,
26705,
29889,
262,
1765,
29889,
2271,
13,
13,
1678,
822,
1243,
29918,
29883,
1336,
29918,
392,
29918,
386,
21145,
29918,
1989,
29918,
465,
10194,
29898,
1311,
1125,
13,
4706,
9995,
3057,
12983,
1967,
9863,
363,
18094,
1213,
15945,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3664,
1888,
2037,
287,
2392,
1125,
13,
9651,
432,
4061,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
9651,
432,
4061,
29889,
3027,
29889,
29883,
1336,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
2033,
353,
6213,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3664,
1888,
2037,
287,
2392,
1125,
13,
9651,
432,
4061,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
9651,
432,
4061,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
2033,
353,
6213,
13,
13,
1678,
822,
1243,
29918,
22995,
15628,
29903,
1891,
2940,
2558,
29898,
1311,
1125,
13,
4706,
9995,
3057,
3792,
15628,
29903,
1891,
2940,
2558,
3682,
1213,
15945,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
22995,
15628,
29903,
1891,
2940,
2558,
1125,
13,
9651,
1583,
29889,
6173,
29889,
3027,
29889,
386,
21145,
1839,
1181,
2251,
1646,
2033,
13,
13,
1678,
822,
1243,
29918,
1727,
8306,
29918,
11739,
29879,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
599,
22583,
29899,
12817,
15283,
3974,
408,
3806,
1213,
15945,
13,
4706,
770,
319,
29898,
3318,
1125,
13,
18884,
1209,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
13919,
29903,
1891,
2940,
4035,
1990,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
9573,
29918,
29879,
3950,
877,
29874,
742,
319,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
13919,
5072,
287,
2940,
4035,
1990,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
9573,
29918,
4572,
877,
29874,
742,
319,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2525,
24622,
29903,
3950,
1170,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
9573,
29918,
29879,
3950,
877,
305,
18801,
742,
8764,
2986,
2940,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2525,
24622,
5072,
1170,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
9573,
29918,
4572,
877,
29918,
1129,
459,
742,
512,
1765,
2940,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2499,
2040,
15213,
287,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
9573,
29918,
29879,
3950,
877,
29883,
1336,
742,
8764,
2986,
2940,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
2499,
2040,
15213,
287,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
9573,
29918,
4572,
877,
262,
1765,
742,
512,
1765,
2940,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3664,
15213,
287,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
348,
9573,
29918,
29879,
3950,
877,
1129,
459,
1495,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3664,
15213,
287,
1125,
13,
9651,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
348,
9573,
29918,
4572,
877,
1129,
459,
1495,
13,
13,
1678,
822,
1243,
29918,
348,
9573,
29918,
23515,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
443,
9573,
3519,
664,
1213,
15945,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
525,
29883,
1336,
29915,
297,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
3032,
29879,
1891,
3027,
29918,
1727,
6020,
13,
4706,
1723,
13,
4706,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
348,
9573,
29918,
29879,
3950,
877,
29883,
1336,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
525,
29883,
1336,
29915,
297,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
3032,
29879,
1891,
3027,
29918,
1727,
6020,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
525,
262,
1765,
29915,
297,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
3032,
4572,
29918,
1727,
6020,
13,
4706,
1723,
13,
4706,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
29889,
348,
9573,
29918,
4572,
877,
262,
1765,
1495,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
525,
262,
1765,
29915,
297,
1224,
24285,
3027,
2671,
29918,
1727,
6020,
3032,
4572,
29918,
1727,
6020,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
7620,
29918,
689,
29918,
1272,
29898,
1311,
1125,
13,
4706,
9995,
3057,
10138,
24285,
2940,
3073,
29889,
7620,
29918,
689,
29918,
1272,
1213,
15945,
13,
4706,
411,
1722,
29898,
13,
9651,
2897,
29889,
2084,
29889,
7122,
29898,
13,
18884,
2897,
29889,
2084,
29889,
25721,
29898,
786,
493,
22168,
1445,
1649,
8243,
13,
18884,
376,
1688,
29889,
2732,
29908,
13,
9651,
10353,
13,
9651,
525,
6050,
29915,
13,
4706,
1723,
408,
285,
29886,
29901,
13,
9651,
1967,
29918,
1272,
353,
285,
29886,
29889,
949,
580,
13,
4706,
411,
1722,
29898,
13,
9651,
2897,
29889,
2084,
29889,
7122,
29898,
13,
18884,
2897,
29889,
2084,
29889,
25721,
29898,
786,
493,
22168,
1445,
1649,
8243,
13,
18884,
376,
1688,
29906,
29889,
2732,
29908,
13,
9651,
10353,
13,
9651,
525,
6050,
29915,
13,
4706,
1723,
408,
285,
29886,
29901,
13,
9651,
1967,
29918,
1272,
29906,
353,
285,
29886,
29889,
949,
580,
13,
4706,
565,
23366,
2190,
17080,
29918,
16358,
29961,
29900,
29962,
1275,
29871,
29896,
322,
23366,
2190,
17080,
29918,
16358,
29961,
29896,
29962,
1275,
29871,
29945,
29901,
13,
9651,
883,
29918,
1990,
353,
10138,
24285,
2940,
3057,
3195,
2500,
29928,
5364,
29896,
29945,
13,
4706,
1683,
29901,
13,
9651,
883,
29918,
1990,
353,
10138,
24285,
2940,
3057,
3195,
2500,
13,
4706,
396,
4321,
292,
716,
6441,
29879,
13,
4706,
285,
353,
883,
29918,
1990,
29898,
13,
9651,
848,
3790,
29915,
2492,
29918,
1853,
2396,
525,
12353,
16675,
13,
9651,
2066,
3790,
13,
18884,
525,
3027,
29918,
29900,
2396,
12545,
3373,
15638,
2283,
877,
1688,
29889,
2732,
742,
1967,
29918,
1272,
511,
13,
18884,
525,
25253,
29918,
3027,
2396,
12545,
3373,
15638,
2283,
29898,
13,
462,
1678,
525,
1688,
29906,
29889,
2732,
742,
1967,
29918,
1272,
29906,
13,
18884,
1723,
13,
9651,
500,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29888,
29889,
275,
29918,
3084,
3285,
5852,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
1853,
29898,
29888,
29889,
14941,
287,
29918,
1272,
1839,
3027,
2033,
29961,
29900,
11724,
12545,
3373,
15638,
2283,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
1134,
29898,
29888,
29889,
14941,
287,
29918,
1272,
1839,
25253,
29918,
3027,
2033,
511,
12545,
3373,
15638,
2283,
13,
4706,
1723,
13,
4706,
2777,
353,
285,
29889,
7620,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8758,
29889,
3027,
29889,
978,
29889,
29880,
17010,
877,
6904,
5477,
525,
1688,
29889,
2732,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
2777,
29889,
25253,
29918,
3027,
29889,
978,
29889,
29880,
17010,
877,
6904,
5477,
13,
9651,
525,
1688,
29906,
29889,
2732,
29915,
13,
4706,
1723,
13,
4706,
396,
4321,
292,
13271,
2066,
847,
349,
13152,
29902,
1819,
13,
4706,
396,
897,
1026,
292,
13136,
29918,
3027,
934,
313,
16076,
372,
29915,
645,
367,
24639,
411,
278,
13,
4706,
396,
2446,
883,
29897,
13,
4706,
2777,
29889,
25253,
29918,
3027,
29889,
8143,
580,
13,
4706,
285,
29906,
353,
883,
29918,
1990,
29898,
13,
9651,
848,
3790,
13,
18884,
525,
2492,
29918,
1853,
2396,
525,
12353,
742,
13,
18884,
525,
3027,
29918,
29900,
2396,
15516,
13,
18884,
525,
3027,
29918,
29896,
2396,
525,
29900,
29889,
29906,
29945,
29916,
29900,
29889,
29906,
29945,
742,
13,
18884,
525,
25253,
29918,
3027,
29899,
8551,
2396,
525,
265,
29915,
13,
9651,
2981,
13,
9651,
2777,
29922,
8758,
13,
4706,
1723,
13,
4706,
2777,
353,
285,
29906,
29889,
7620,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8758,
29889,
3027,
29889,
407,
7768,
29892,
313,
29900,
29889,
29906,
29945,
29892,
29871,
29900,
29889,
29906,
29945,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8758,
29889,
25253,
29918,
3027,
29889,
978,
29892,
27255,
13,
4706,
2777,
29889,
3027,
29889,
8143,
29898,
7620,
29922,
8824,
29897,
13,
13,
1678,
822,
1243,
29918,
7032,
287,
2940,
29918,
1491,
1990,
29918,
11739,
29879,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
10554,
287,
2940,
1014,
13203,
3183,
2216,
1888,
2037,
287,
2392,
1213,
15945,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3664,
1888,
2037,
287,
2392,
1125,
13,
9651,
770,
317,
1891,
2940,
4035,
1990,
29898,
29903,
1891,
2940,
1125,
13,
18884,
1209,
13,
13,
9651,
317,
1891,
2940,
4035,
1990,
877,
742,
15516,
7700,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3664,
1888,
2037,
287,
2392,
1125,
13,
9651,
770,
317,
1891,
2940,
4035,
1990,
29898,
29903,
1891,
2940,
1125,
13,
18884,
10422,
29918,
1989,
353,
525,
1688,
29915,
13,
13,
9651,
921,
353,
317,
1891,
2940,
4035,
1990,
877,
742,
15516,
7700,
29897,
13,
9651,
921,
29889,
5014,
29918,
3027,
29898,
3027,
29922,
8516,
29892,
1967,
29918,
4830,
2433,
29967,
4162,
29954,
742,
4078,
29918,
19290,
3790,
1118,
13,
462,
9651,
2920,
29922,
29896,
29900,
29900,
29892,
3171,
29922,
29896,
29900,
29900,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3664,
1888,
2037,
287,
2392,
1125,
13,
9651,
770,
19916,
287,
2940,
4035,
1990,
29898,
5072,
287,
2940,
1125,
13,
18884,
10422,
29918,
1989,
353,
525,
1688,
29915,
13,
13,
9651,
921,
353,
19916,
287,
2940,
4035,
1990,
29898,
13,
18884,
1583,
29889,
6173,
29889,
3027,
29889,
978,
29892,
13,
18884,
1583,
29889,
6173,
29889,
3027,
29889,
2671,
29889,
12925,
29892,
13,
18884,
7700,
29892,
13,
18884,
10422,
29918,
1989,
2433,
5431,
29915,
13,
9651,
1723,
13,
9651,
921,
29889,
5014,
29918,
3027,
29898,
3027,
29922,
8516,
29892,
1967,
29918,
4830,
2433,
29967,
4162,
29954,
742,
4078,
29918,
19290,
3790,
1800,
13,
13,
1678,
732,
15752,
29918,
11027,
29898,
13,
4706,
2672,
1254,
1964,
20566,
29918,
3301,
7024,
29922,
877,
21150,
29889,
1688,
29918,
1300,
397,
10669,
957,
742,
29897,
13,
1678,
1723,
13,
1678,
822,
1243,
29918,
1300,
397,
10669,
957,
29898,
1311,
1125,
13,
4706,
9995,
3057,
1120,
397,
10669,
957,
16032,
2392,
1213,
15945,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
13,
9651,
16032,
2392,
29892,
13,
9651,
1120,
397,
10669,
957,
13,
4706,
1723,
13,
13,
1678,
732,
15752,
29918,
11027,
29898,
13,
4706,
478,
23598,
1299,
29902,
1307,
2382,
3738,
27286,
29918,
17171,
29918,
7390,
11538,
29950,
5607,
29928,
1806,
29922,
5574,
13,
1678,
1723,
13,
1678,
822,
1243,
29918,
6689,
8948,
277,
29898,
1311,
1125,
13,
4706,
9995,
3057,
2058,
8948,
29889,
277,
13465,
1213,
15945,
13,
4706,
432,
4061,
353,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
657,
29898,
2492,
29918,
1853,
2433,
6173,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
432,
4061,
29889,
25253,
29918,
3027,
29918,
29941,
29889,
26705,
29889,
262,
1765,
29889,
29883,
1336,
1839,
29946,
29900,
29900,
29916,
29946,
29900,
29900,
13359,
2271,
29892,
13,
9651,
525,
1124,
597,
6689,
8948,
29889,
277,
29914,
29946,
29900,
29900,
29916,
29946,
29900,
29900,
29915,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
6886,
29918,
9482,
292,
29898,
1311,
1125,
13,
4706,
9995,
3057,
4472,
15061,
310,
1967,
1213,
15945,
13,
4706,
260,
353,
679,
29918,
6886,
703,
1688,
29899,
6886,
29889,
1420,
1159,
13,
4706,
274,
353,
15228,
3319,
13,
9651,
525,
8758,
2396,
1583,
29889,
6173,
13,
4706,
5615,
13,
4706,
13751,
353,
260,
29889,
9482,
29898,
29883,
29897,
13,
4706,
1583,
29889,
9294,
3912,
29924,
1307,
15380,
29898,
13,
9651,
13751,
29892,
13,
9651,
9995,
13,
29966,
1420,
29958,
13,
29966,
2587,
29958,
13,
29966,
2492,
1178,
543,
3027,
29899,
29883,
1336,
29908,
4765,
13802,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29906,
29945,
1649,
29900,
29899,
29906,
29945,
29899,
29946,
29900,
29900,
29916,
29946,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29908,
2900,
13,
29966,
2492,
1178,
543,
3027,
29899,
386,
21145,
29908,
4765,
13802,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
386,
21145,
29899,
29946,
29900,
29900,
29916,
29946,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29908,
2900,
13,
29966,
2492,
1178,
543,
3027,
29899,
262,
1765,
29908,
4765,
13802,
9799,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
1649,
262,
1765,
26914,
6173,
29908,
2900,
13,
29966,
2492,
1178,
543,
3027,
29899,
262,
1765,
29899,
29883,
1336,
29908,
4765,
13802,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
1649,
262,
1765,
1649,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29906,
29945,
1649,
29900,
29899,
29906,
29945,
29899,
29946,
29900,
29900,
29916,
29946,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29908,
2900,
13,
29966,
2492,
4765,
13802,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
1649,
27074,
1649,
29914,
27074,
29899,
29883,
1336,
29899,
29883,
29900,
29899,
29945,
1649,
29900,
29899,
29945,
29899,
29946,
29900,
29900,
29916,
29946,
29900,
29900,
29889,
2732,
29908,
1178,
543,
25253,
29899,
3027,
29899,
29883,
1336,
4681,
13,
829,
2587,
29958,
13,
829,
1420,
29958,
13,
9651,
9995,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
2671,
29918,
15550,
2133,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
10138,
24285,
2940,
3073,
322,
349,
13152,
29902,
3073,
28755,
5149,
1213,
15945,
13,
4706,
1962,
353,
7797,
19427,
29889,
643,
6646,
29898,
13,
9651,
525,
3126,
742,
13,
9651,
10138,
24285,
2940,
3057,
3195,
29889,
12650,
29889,
4572,
29898,
20571,
29922,
29896,
29897,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
7249,
9843,
29898,
13,
9651,
1962,
29892,
13,
9651,
518,
13,
18884,
426,
13,
462,
1678,
376,
9621,
1115,
426,
13,
462,
4706,
376,
2492,
29918,
1853,
1115,
376,
2732,
613,
13,
462,
4706,
376,
407,
7768,
1115,
376,
29900,
29889,
29945,
29916,
29900,
29889,
29945,
613,
13,
462,
4706,
376,
2103,
1115,
29871,
29953,
29900,
29896,
29892,
13,
462,
4706,
376,
3545,
1115,
29871,
29906,
29900,
29941,
29892,
13,
462,
4706,
376,
3027,
1115,
376,
4691,
29899,
14569,
29889,
2732,
613,
13,
462,
4706,
376,
25253,
29918,
3027,
29918,
29941,
1115,
12633,
13,
462,
4706,
376,
25253,
29918,
3027,
29918,
29906,
1115,
12633,
13,
462,
4706,
376,
25253,
29918,
3027,
1115,
376,
4691,
29899,
14569,
29889,
6173,
29908,
13,
462,
1678,
2981,
13,
462,
1678,
376,
4299,
1115,
376,
21150,
29889,
874,
24285,
326,
26084,
342,
4299,
613,
13,
462,
1678,
376,
20571,
1115,
29871,
29896,
13,
18884,
500,
13,
9651,
4514,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
9917,
29918,
689,
29918,
1272,
29898,
1311,
1125,
13,
4706,
9995,
29923,
1983,
545,
1959,
848,
14423,
1156,
883,
8845,
4436,
1213,
15945,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
2490,
29898,
13,
9651,
11033,
16173,
29918,
4219,
29892,
13,
9651,
426,
13,
18884,
525,
12403,
29918,
726,
29918,
2671,
2396,
6629,
13,
9651,
2981,
13,
9651,
1101,
29922,
5574,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
29871,
29906,
29900,
29900,
29897,
13,
4706,
565,
4832,
29889,
20055,
29906,
29901,
13,
9651,
2933,
29918,
3051,
353,
851,
29898,
5327,
29889,
3051,
29897,
13,
4706,
1683,
29901,
13,
9651,
2933,
29918,
3051,
353,
851,
29898,
5327,
29889,
3051,
29892,
8025,
2433,
9420,
29899,
29947,
1495,
13,
4706,
1583,
29889,
9294,
797,
7020,
29898,
13,
9651,
313,
13,
18884,
12801,
2492,
4765,
13802,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
4691,
29899,
14569,
29899,
386,
21145,
29899,
29941,
29900,
29900,
29916,
29941,
29900,
29900,
6169,
13,
18884,
525,
2732,
29908,
1178,
543,
3027,
29918,
29900,
29918,
3027,
25347,
29908,
848,
29899,
10892,
29918,
2671,
29918,
333,
2433,
13,
18884,
18793,
333,
29918,
3027,
29918,
29896,
29908,
848,
29899,
3149,
29918,
19190,
29918,
333,
543,
3027,
29918,
29900,
29918,
3149,
29899,
19190,
29908,
525,
13,
18884,
525,
1272,
29899,
407,
7768,
29918,
333,
543,
3027,
29918,
29900,
29918,
407,
7768,
29908,
770,
543,
29879,
1891,
3027,
29899,
25347,
4681,
29915,
13,
9651,
10353,
13,
9651,
2933,
29918,
3051,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
513,
23352,
29918,
28759,
654,
29918,
8173,
29918,
8551,
29898,
1311,
1125,
13,
4706,
9995,
3057,
393,
10138,
24285,
2940,
3073,
508,
2821,
5375,
7090,
9976,
1213,
15945,
13,
4706,
3806,
29918,
3027,
29918,
2271,
353,
313,
13,
9651,
8207,
9799,
29914,
1649,
29879,
1891,
1649,
29914,
8143,
29899,
1688,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
9684,
29918,
3027,
29918,
2271,
511,
13,
9651,
6213,
13,
4706,
1723,
13,
4706,
10153,
353,
1583,
29889,
8143,
29918,
1688,
13,
4706,
10153,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
4706,
10153,
29918,
2271,
353,
10153,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
13,
4706,
628,
10153,
29918,
2271,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
9684,
29918,
3027,
29918,
2271,
511,
13,
632,
29896,
13,
4706,
1723,
13,
4706,
10153,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
8143,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
9684,
29918,
3027,
29918,
2271,
511,
13,
9651,
6213,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
1649,
29879,
1891,
1649,
29914,
8143,
29899,
1688,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
1678,
822,
1243,
29918,
28759,
654,
29918,
8143,
29898,
1311,
1125,
13,
4706,
9995,
3057,
7697,
654,
7374,
291,
1213,
15945,
13,
4706,
10153,
353,
1583,
29889,
8143,
29918,
1688,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
1649,
29879,
1891,
1649,
29914,
8143,
29899,
1688,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
10153,
29889,
3027,
29889,
3258,
29918,
265,
29918,
2310,
392,
353,
5852,
13,
13,
4706,
28968,
29918,
2271,
353,
10153,
29889,
3027,
29889,
386,
21145,
1839,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
13359,
2271,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
386,
3774,
29918,
2271,
511,
13,
632,
29896,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
1649,
29879,
1891,
1649,
29914,
8143,
29899,
1688,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
10153,
29889,
3027,
29889,
8143,
29918,
497,
29918,
11600,
29918,
8346,
580,
13,
4706,
21292,
29918,
2271,
353,
10153,
29889,
3027,
29889,
26705,
29889,
262,
1765,
29889,
2271,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
262,
1765,
29918,
2271,
511,
13,
632,
29896,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
8143,
29899,
1688,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
1649,
262,
1765,
26914,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
4706,
21292,
29918,
392,
29918,
386,
3774,
29918,
2271,
353,
10153,
29889,
3027,
29889,
26705,
29889,
262,
1765,
29889,
386,
21145,
29961,
13,
9651,
525,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29915,
13,
308,
1822,
2271,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
262,
1765,
29918,
392,
29918,
386,
3774,
29918,
2271,
511,
13,
632,
29896,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
5574,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
1649,
29879,
1891,
1649,
29914,
8143,
29899,
1688,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
1649,
262,
1765,
1649,
29915,
13,
18884,
17411,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
4706,
10153,
29889,
3027,
29889,
8143,
29918,
497,
29918,
11600,
29918,
8346,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
386,
3774,
29918,
2271,
511,
13,
9651,
6213,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
1649,
29879,
1891,
1649,
29914,
8143,
29899,
1688,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
29899,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
262,
1765,
29918,
2271,
511,
13,
9651,
6213,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
8143,
29899,
1688,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
1649,
262,
1765,
26914,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
13,
9651,
7090,
29889,
657,
29898,
262,
1765,
29918,
392,
29918,
386,
3774,
29918,
2271,
511,
13,
9651,
6213,
13,
4706,
1723,
13,
4706,
1583,
29889,
9294,
8824,
29898,
13,
9651,
10153,
29889,
3027,
29889,
2671,
29889,
12925,
29889,
9933,
29898,
13,
18884,
525,
1649,
29879,
1891,
1649,
29914,
8143,
29899,
1688,
29914,
1649,
4572,
287,
1649,
29914,
4691,
29899,
14569,
29899,
8143,
29899,
1688,
1649,
262,
1765,
1649,
29915,
13,
18884,
17411,
386,
21145,
29899,
29896,
29900,
29900,
29916,
29896,
29900,
29900,
29899,
29955,
29900,
29889,
6173,
29915,
13,
9651,
1723,
13,
4706,
1723,
13,
2
] |
BitTornado/ConnChoice.py | weedy/BitTornado | 0 | 80142 | <filename>BitTornado/ConnChoice.py
connChoices = (
{'name': 'automatic',
'rate': {'min': 0, 'max': 5000, 'def': 0},
'conn': {'min': 0, 'max': 100, 'def': 0},
'automatic': 1},
{'name': 'unlimited',
'rate': {'min': 0, 'max': 5000, 'def': 0, 'div': 50},
'conn': {'min': 4, 'max': 100, 'def': 4}},
{'name': 'dialup/isdn',
'rate': {'min': 3, 'max': 8, 'def': 5},
'conn': {'min': 2, 'max': 3, 'def': 2},
'initiate': 12},
{'name': 'dsl/cable slow',
'rate': {'min': 10, 'max': 48, 'def': 13},
'conn': {'min': 4, 'max': 20, 'def': 4}},
{'name': 'dsl/cable fast',
'rate': {'min': 20, 'max': 100, 'def': 40},
'conn': {'min': 4, 'max': 30, 'def': 6}},
{'name': 'T1',
'rate': {'min': 100, 'max': 300, 'def': 150},
'conn': {'min': 4, 'max': 40, 'def': 10}},
{'name': 'T3+',
'rate': {'min': 400, 'max': 2000, 'def': 500},
'conn': {'min': 4, 'max': 100, 'def': 20}},
{'name': 'seeder',
'rate': {'min': 0, 'max': 5000, 'def': 0, 'div': 50},
'conn': {'min': 1, 'max': 100, 'def': 1}},
{'name': 'SUPER-SEED', 'super-seed': 1}
)
connChoiceList = map(lambda x: x['name'], connChoices)
| [
1,
529,
9507,
29958,
21591,
29911,
1398,
912,
29914,
1168,
29876,
29620,
29889,
2272,
13,
13082,
15954,
1575,
353,
313,
13,
1678,
11117,
978,
2396,
525,
17405,
2454,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29900,
29892,
525,
3317,
2396,
29871,
29945,
29900,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29900,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29900,
29892,
525,
3317,
2396,
29871,
29896,
29900,
29900,
29892,
29871,
525,
1753,
2396,
29871,
29900,
1118,
13,
268,
525,
17405,
2454,
2396,
29871,
29896,
1118,
13,
1678,
11117,
978,
2396,
525,
348,
29044,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29900,
29892,
525,
3317,
2396,
29871,
29945,
29900,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29900,
29892,
525,
4563,
2396,
29871,
29945,
29900,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29946,
29892,
525,
3317,
2396,
29871,
29896,
29900,
29900,
29892,
29871,
525,
1753,
2396,
29871,
29946,
11656,
13,
1678,
11117,
978,
2396,
525,
29881,
616,
786,
29914,
275,
5200,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29941,
29892,
259,
525,
3317,
2396,
1678,
29947,
29892,
525,
1753,
2396,
259,
29945,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29906,
29892,
525,
3317,
2396,
259,
29941,
29892,
525,
1753,
2396,
29871,
29906,
1118,
13,
268,
525,
2344,
29347,
2396,
29871,
29896,
29906,
1118,
13,
1678,
11117,
978,
2396,
525,
29881,
2536,
29914,
29883,
519,
5232,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29896,
29900,
29892,
29871,
525,
3317,
2396,
259,
29946,
29947,
29892,
525,
1753,
2396,
29871,
29896,
29941,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29946,
29892,
525,
3317,
2396,
29871,
29906,
29900,
29892,
525,
1753,
2396,
29871,
29946,
11656,
13,
1678,
11117,
978,
2396,
525,
29881,
2536,
29914,
29883,
519,
5172,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29906,
29900,
29892,
29871,
525,
3317,
2396,
29871,
29896,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29946,
29900,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29946,
29892,
525,
3317,
2396,
29871,
29941,
29900,
29892,
525,
1753,
2396,
29871,
29953,
11656,
13,
1678,
11117,
978,
2396,
525,
29911,
29896,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29896,
29900,
29900,
29892,
525,
3317,
2396,
29871,
29941,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29896,
29945,
29900,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29946,
29892,
525,
3317,
2396,
29871,
29946,
29900,
29892,
525,
1753,
2396,
29871,
29896,
29900,
11656,
13,
1678,
11117,
978,
2396,
525,
29911,
29941,
29974,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29946,
29900,
29900,
29892,
525,
3317,
2396,
29871,
29906,
29900,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29945,
29900,
29900,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29946,
29892,
525,
3317,
2396,
29871,
29896,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29906,
29900,
11656,
13,
1678,
11117,
978,
2396,
525,
344,
2447,
742,
13,
268,
525,
10492,
2396,
11117,
1195,
2396,
29871,
29900,
29892,
525,
3317,
2396,
29871,
29945,
29900,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29900,
29892,
525,
4563,
2396,
29871,
29945,
29900,
1118,
13,
268,
525,
13082,
2396,
11117,
1195,
2396,
29871,
29896,
29892,
525,
3317,
2396,
29871,
29896,
29900,
29900,
29892,
525,
1753,
2396,
29871,
29896,
11656,
13,
1678,
11117,
978,
2396,
525,
29903,
4897,
1001,
29899,
1660,
3352,
742,
525,
9136,
29899,
26776,
2396,
29871,
29896,
29913,
13,
29897,
13,
13,
13082,
29620,
1293,
353,
2910,
29898,
2892,
921,
29901,
921,
1839,
978,
7464,
11009,
15954,
1575,
29897,
13,
2
] |
opwen_email_server/constants/sync.py | kulado/mailserver | 15 | 148628 | from typing_extensions import Final # noqa: F401
EMAILS_FILE = 'emails.jsonl' # type: Final
USERS_FILE = 'zzusers.jsonl' # type: Final
| [
1,
515,
19229,
29918,
24299,
1053,
9550,
29871,
396,
694,
25621,
29901,
383,
29946,
29900,
29896,
13,
13,
26862,
6227,
29903,
29918,
7724,
353,
525,
331,
2234,
29889,
3126,
29880,
29915,
29871,
396,
1134,
29901,
9550,
13,
11889,
29903,
29918,
7724,
353,
525,
5617,
7193,
29889,
3126,
29880,
29915,
29871,
396,
1134,
29901,
9550,
13,
2
] |
api/routes/upload/input.py | atsuchiy11/api-fastapi-video | 0 | 139114 | from boto3.dynamodb.conditions import Key, Attr
from api.util import get_today_string
def query():
"""input get upload status from DynamoDB"""
return dict(
IndexName="GSI-1-SK",
KeyConditionExpression=Key("indexKey").eq("Status"),
# FilterExpression=Attr("SK").begins_with("2021-12-16"),
FilterExpression=Attr("SK").begins_with(get_today_string()),
ScanIndexForward=False,
)
def put_item(status, created_at):
"""input post upload status to DynamoDB"""
# なんでidがuriなのか。。
return dict(
id=status.uri,
PK=status.uri,
SK=created_at,
indexKey="Status",
name=status.name,
filename=status.filename,
createdAt=created_at,
createdUser=status.user,
status=status.status,
)
def update_item(status):
"""input put upload status to DynamoDB"""
return dict(
Key={"PK": status.uri, "SK": status.timestamp},
UpdateExpression="SET #status=:status",
# status is reserved
ExpressionAttributeNames={"#status": "status"},
ExpressionAttributeValues={":status": status.status},
)
# {
# "uri": "string",
# "timestamp": "2021-12-17 11:46:39",
# "status": "アップロード中"
# }
| [
1,
515,
289,
3747,
29941,
29889,
29881,
2926,
10396,
29889,
1116,
2187,
1053,
7670,
29892,
2180,
509,
13,
3166,
7882,
29889,
4422,
1053,
679,
29918,
27765,
29918,
1807,
13,
13,
13,
1753,
2346,
7295,
13,
1678,
9995,
2080,
679,
6441,
4660,
515,
22554,
29877,
4051,
15945,
29908,
13,
13,
1678,
736,
9657,
29898,
13,
4706,
11374,
1170,
543,
29954,
5425,
29899,
29896,
29899,
16033,
613,
13,
4706,
7670,
25255,
10960,
29922,
2558,
703,
2248,
2558,
2564,
1837,
703,
5709,
4968,
13,
4706,
396,
19916,
10960,
29922,
25098,
703,
16033,
2564,
463,
29879,
29918,
2541,
703,
29906,
29900,
29906,
29896,
29899,
29896,
29906,
29899,
29896,
29953,
4968,
13,
4706,
19916,
10960,
29922,
25098,
703,
16033,
2564,
463,
29879,
29918,
2541,
29898,
657,
29918,
27765,
29918,
1807,
25739,
13,
4706,
2522,
273,
3220,
2831,
1328,
29922,
8824,
29892,
13,
1678,
1723,
13,
13,
13,
1753,
1925,
29918,
667,
29898,
4882,
29892,
2825,
29918,
271,
1125,
13,
1678,
9995,
2080,
1400,
6441,
4660,
304,
22554,
29877,
4051,
15945,
29908,
13,
13,
1678,
396,
29871,
30371,
30389,
30499,
333,
30458,
5338,
30371,
30199,
30412,
30267,
30267,
13,
13,
1678,
736,
9657,
29898,
13,
4706,
1178,
29922,
4882,
29889,
5338,
29892,
13,
4706,
24457,
29922,
4882,
29889,
5338,
29892,
13,
4706,
18581,
29922,
11600,
29918,
271,
29892,
13,
4706,
2380,
2558,
543,
5709,
613,
13,
4706,
1024,
29922,
4882,
29889,
978,
29892,
13,
4706,
10422,
29922,
4882,
29889,
9507,
29892,
13,
4706,
2825,
4178,
29922,
11600,
29918,
271,
29892,
13,
4706,
2825,
2659,
29922,
4882,
29889,
1792,
29892,
13,
4706,
4660,
29922,
4882,
29889,
4882,
29892,
13,
1678,
1723,
13,
13,
13,
1753,
2767,
29918,
667,
29898,
4882,
1125,
13,
1678,
9995,
2080,
1925,
6441,
4660,
304,
22554,
29877,
4051,
15945,
29908,
13,
13,
1678,
736,
9657,
29898,
13,
4706,
7670,
3790,
29908,
21738,
1115,
4660,
29889,
5338,
29892,
376,
16033,
1115,
4660,
29889,
16394,
1118,
13,
4706,
10318,
10960,
543,
10490,
396,
4882,
29922,
29901,
4882,
613,
13,
4706,
396,
4660,
338,
21676,
13,
4706,
21444,
6708,
8659,
3790,
29908,
29937,
4882,
1115,
376,
4882,
10758,
13,
4706,
21444,
6708,
9065,
3790,
1115,
4882,
1115,
4660,
29889,
4882,
1118,
13,
1678,
1723,
13,
13,
13,
29937,
426,
13,
29937,
259,
376,
5338,
1115,
376,
1807,
613,
13,
29937,
259,
376,
16394,
1115,
376,
29906,
29900,
29906,
29896,
29899,
29896,
29906,
29899,
29896,
29955,
29871,
29896,
29896,
29901,
29946,
29953,
29901,
29941,
29929,
613,
13,
29937,
259,
376,
4882,
1115,
376,
30310,
30317,
30605,
30378,
30185,
30335,
30275,
29908,
13,
29937,
500,
13,
2
] |
image-editor/data_editor/image/image_view.py | flegac/deep-experiments | 0 | 43012 | <reponame>flegac/deep-experiments
import tkinter as tk
import rx.operators as ops
from PIL import ImageTk, Image
from rx.subject import Subject
from data_editor.image.view_controller import ViewController
from data_toolbox.data.data_source import DataSource
from data_toolbox.image.buffer_factory import ImageFactory
class ImageView(tk.Frame):
MAX_REDRAW_PER_SEC = 1000
def __init__(self, master: tk.Widget, width: int = 600, height: int = 400):
tk.Frame.__init__(self, master)
self._source_change_bus = Subject()
self._source_change_bus.pipe(
ops.throttle_first(1. / ImageView.MAX_REDRAW_PER_SEC),
# ops.debounce(1. / ImageView.MAX_REDRAW_PER_SEC),
).subscribe(on_next=lambda _: self._redraw(_))
# canvas creation
self.canvas = tk.Canvas(self, width=width, height=height)
self.canvas.pack(expand=True, fill="both")
# image
self.data = None
self.image_id = None
self.viewport_controller = ViewController(self.canvas, self.set_source)
# Bind events to the Canvas
self.canvas.bind('<Configure>', lambda _: self._redraw(None))
for k, v in self.viewport_controller.bindings().items():
self.canvas.bind(k, v)
def mouse_image_coords(self):
return self.viewport_controller.mouse_image_coords()
def reset_viewport(self):
self.viewport_controller.viewport.zoom_factor = 0
self.viewport_controller.viewport.x = 0
self.viewport_controller.viewport.y = 0
def set_source(self, source: DataSource = None):
self._source_change_bus.on_next(source)
def _redraw(self, source: DataSource = None):
if source is not None:
self.data = source.get_data()
if self.image_id:
self.canvas.delete(self.image_id)
if self.data is None:
return
data = self.viewport_controller.viewport.apply(self.data)
self.canvas.image = ImageTk.PhotoImage(image=Image.fromarray(data))
self.image_id = self.canvas.create_image((0, 0), anchor=tk.NW, image=self.canvas.image)
self.canvas.lower(self.image_id) # set it into background
if __name__ == '__main__':
root = tk.Tk()
editor = ImageView(root)
editor.set_source(ImageFactory.random)
editor.pack(fill='both', expand=True)
root.mainloop()
| [
1,
529,
276,
1112,
420,
29958,
29888,
1397,
562,
29914,
24535,
29899,
735,
546,
7862,
13,
5215,
18883,
1639,
408,
18883,
13,
13,
5215,
364,
29916,
29889,
3372,
4097,
408,
288,
567,
13,
3166,
349,
6227,
1053,
7084,
29911,
29895,
29892,
7084,
13,
3166,
364,
29916,
29889,
16009,
1053,
3323,
622,
13,
13,
3166,
848,
29918,
15204,
29889,
3027,
29889,
1493,
29918,
8299,
1053,
4533,
2956,
13,
3166,
848,
29918,
10154,
1884,
29889,
1272,
29889,
1272,
29918,
4993,
1053,
3630,
4435,
13,
3166,
848,
29918,
10154,
1884,
29889,
3027,
29889,
9040,
29918,
14399,
1053,
7084,
5126,
13,
13,
13,
1990,
7084,
1043,
29898,
11178,
29889,
4308,
1125,
13,
1678,
18134,
29918,
19386,
4717,
29956,
29918,
13171,
29918,
1660,
29907,
353,
29871,
29896,
29900,
29900,
29900,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5835,
29901,
18883,
29889,
8801,
29892,
2920,
29901,
938,
353,
29871,
29953,
29900,
29900,
29892,
3171,
29901,
938,
353,
29871,
29946,
29900,
29900,
1125,
13,
4706,
18883,
29889,
4308,
17255,
2344,
12035,
1311,
29892,
5835,
29897,
13,
4706,
1583,
3032,
4993,
29918,
3167,
29918,
8262,
353,
3323,
622,
580,
13,
4706,
1583,
3032,
4993,
29918,
3167,
29918,
8262,
29889,
17760,
29898,
13,
9651,
288,
567,
29889,
386,
26970,
280,
29918,
4102,
29898,
29896,
29889,
847,
7084,
1043,
29889,
12648,
29918,
19386,
4717,
29956,
29918,
13171,
29918,
1660,
29907,
511,
13,
9651,
396,
288,
567,
29889,
16529,
21543,
29898,
29896,
29889,
847,
7084,
1043,
29889,
12648,
29918,
19386,
4717,
29956,
29918,
13171,
29918,
1660,
29907,
511,
13,
4706,
13742,
19496,
29898,
265,
29918,
4622,
29922,
2892,
903,
29901,
1583,
3032,
1127,
1610,
7373,
876,
13,
13,
4706,
396,
10508,
11265,
13,
4706,
1583,
29889,
15257,
353,
18883,
29889,
21960,
29898,
1311,
29892,
2920,
29922,
2103,
29892,
3171,
29922,
3545,
29897,
13,
4706,
1583,
29889,
15257,
29889,
4058,
29898,
18837,
29922,
5574,
29892,
5445,
543,
20313,
1159,
13,
13,
4706,
396,
1967,
13,
4706,
1583,
29889,
1272,
353,
6213,
13,
4706,
1583,
29889,
3027,
29918,
333,
353,
6213,
13,
13,
4706,
1583,
29889,
1493,
637,
29918,
8299,
353,
4533,
2956,
29898,
1311,
29889,
15257,
29892,
1583,
29889,
842,
29918,
4993,
29897,
13,
13,
4706,
396,
29672,
4959,
304,
278,
1815,
4428,
13,
4706,
1583,
29889,
15257,
29889,
5355,
877,
29966,
3991,
545,
29958,
742,
14013,
903,
29901,
1583,
3032,
1127,
1610,
29898,
8516,
876,
13,
4706,
363,
413,
29892,
325,
297,
1583,
29889,
1493,
637,
29918,
8299,
29889,
5355,
886,
2141,
7076,
7295,
13,
9651,
1583,
29889,
15257,
29889,
5355,
29898,
29895,
29892,
325,
29897,
13,
13,
1678,
822,
9495,
29918,
3027,
29918,
1111,
4339,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
1493,
637,
29918,
8299,
29889,
15769,
29918,
3027,
29918,
1111,
4339,
580,
13,
13,
1678,
822,
10092,
29918,
1493,
637,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1493,
637,
29918,
8299,
29889,
1493,
637,
29889,
2502,
290,
29918,
19790,
353,
29871,
29900,
13,
4706,
1583,
29889,
1493,
637,
29918,
8299,
29889,
1493,
637,
29889,
29916,
353,
29871,
29900,
13,
4706,
1583,
29889,
1493,
637,
29918,
8299,
29889,
1493,
637,
29889,
29891,
353,
29871,
29900,
13,
13,
1678,
822,
731,
29918,
4993,
29898,
1311,
29892,
2752,
29901,
3630,
4435,
353,
6213,
1125,
13,
4706,
1583,
3032,
4993,
29918,
3167,
29918,
8262,
29889,
265,
29918,
4622,
29898,
4993,
29897,
13,
13,
1678,
822,
903,
1127,
1610,
29898,
1311,
29892,
2752,
29901,
3630,
4435,
353,
6213,
1125,
13,
4706,
565,
2752,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
1272,
353,
2752,
29889,
657,
29918,
1272,
580,
13,
4706,
565,
1583,
29889,
3027,
29918,
333,
29901,
13,
9651,
1583,
29889,
15257,
29889,
8143,
29898,
1311,
29889,
3027,
29918,
333,
29897,
13,
4706,
565,
1583,
29889,
1272,
338,
6213,
29901,
13,
9651,
736,
13,
13,
4706,
848,
353,
1583,
29889,
1493,
637,
29918,
8299,
29889,
1493,
637,
29889,
7302,
29898,
1311,
29889,
1272,
29897,
13,
13,
4706,
1583,
29889,
15257,
29889,
3027,
353,
7084,
29911,
29895,
29889,
25971,
2940,
29898,
3027,
29922,
2940,
29889,
3166,
2378,
29898,
1272,
876,
13,
4706,
1583,
29889,
3027,
29918,
333,
353,
1583,
29889,
15257,
29889,
3258,
29918,
3027,
3552,
29900,
29892,
29871,
29900,
511,
17360,
29922,
11178,
29889,
29940,
29956,
29892,
1967,
29922,
1311,
29889,
15257,
29889,
3027,
29897,
13,
4706,
1583,
29889,
15257,
29889,
13609,
29898,
1311,
29889,
3027,
29918,
333,
29897,
29871,
396,
731,
372,
964,
3239,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
3876,
353,
18883,
29889,
29911,
29895,
580,
13,
1678,
6920,
353,
7084,
1043,
29898,
4632,
29897,
13,
1678,
6920,
29889,
842,
29918,
4993,
29898,
2940,
5126,
29889,
8172,
29897,
13,
1678,
6920,
29889,
4058,
29898,
5589,
2433,
20313,
742,
7985,
29922,
5574,
29897,
13,
1678,
3876,
29889,
3396,
7888,
580,
13,
2
] |
tests/master/test_master.py | bk-mtg/piwheels | 0 | 12606 | <reponame>bk-mtg/piwheels
# The piwheels project
# Copyright (c) 2017 <NAME> <https://github.com/bennuttall>
# Copyright (c) 2017 <NAME> <<EMAIL>>
#
# 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 copyright holder nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
import os
from unittest import mock
from threading import Thread
import pytest
from conftest import find_message
from piwheels import __version__, protocols, transport
from piwheels.master import main, const
@pytest.fixture()
def mock_pypi(request):
with mock.patch('xmlrpc.client.ServerProxy') as proxy:
proxy().changelog_since_serial.return_value = []
yield proxy
@pytest.fixture()
def mock_signal(request):
with mock.patch('signal.signal') as signal:
yield signal
@pytest.fixture()
def mock_context(request, zmq_context):
with mock.patch('piwheels.transport.Context') as ctx_mock:
# Pass thru calls to Context.socket, but ignore everything else (in
# particular, destroy and term calls as we want the testing context to
# stick around)
ctx_mock().socket.side_effect = zmq_context.socket
yield ctx_mock
@pytest.fixture()
def master_thread(request, mock_pypi, mock_context, mock_systemd, mock_signal,
tmpdir, db_url, db, with_schema):
main_thread = None
def _master_thread(args=None):
nonlocal main_thread
if args is None:
args = []
main_thread = Thread(daemon=True, target=main, args=([
'--dsn', db_url,
'--output-path', str(tmpdir.join('output')),
'--status-queue', 'ipc://' + str(tmpdir.join('status-queue')),
'--control-queue', 'ipc://' + str(tmpdir.join('control-queue')),
'--slave-queue', 'ipc://' + str(tmpdir.join('slave-queue')),
'--file-queue', 'ipc://' + str(tmpdir.join('file-queue')),
'--import-queue', 'ipc://' + str(tmpdir.join('import-queue')),
'--log-queue', 'ipc://' + str(tmpdir.join('log-queue')),
] + list(args),))
return main_thread
yield _master_thread
if main_thread is not None and main_thread.is_alive():
with mock_context().socket(
transport.PUSH, protocol=reversed(protocols.master_control)) as control:
control.connect('ipc://' + str(tmpdir.join('control-queue')))
control.send_msg('QUIT')
main_thread.join(10)
assert not main_thread.is_alive()
@pytest.fixture()
def master_control(request, tmpdir, mock_context):
control = mock_context().socket(
transport.PUSH, protocol=reversed(protocols.master_control))
control.connect('ipc://' + str(tmpdir.join('control-queue')))
yield control
control.close()
def test_help(capsys):
with pytest.raises(SystemExit):
main(['--help'])
out, err = capsys.readouterr()
assert out.startswith('usage:')
assert '--pypi-xmlrpc' in out
def test_version(capsys):
with pytest.raises(SystemExit):
main(['--version'])
out, err = capsys.readouterr()
assert out.strip() == __version__
def test_no_root(caplog):
with mock.patch('os.geteuid') as geteuid:
geteuid.return_value = 0
assert main([]) != 0
assert find_message(caplog.records,
message='Master must not be run as root')
def test_quit_control(mock_systemd, master_thread, master_control):
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
master_control.send_msg('QUIT')
thread.join(10)
assert not thread.is_alive()
def test_system_exit(mock_systemd, master_thread, caplog):
with mock.patch('piwheels.master.PiWheelsMaster.main_loop') as main_loop:
main_loop.side_effect = SystemExit(1)
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
thread.join(10)
assert not thread.is_alive()
assert find_message(caplog.records, message='shutting down on SIGTERM')
def test_system_ctrl_c(mock_systemd, master_thread, caplog):
with mock.patch('piwheels.master.PiWheelsMaster.main_loop') as main_loop:
main_loop.side_effect = KeyboardInterrupt()
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
thread.join(10)
assert not thread.is_alive()
assert find_message(caplog.records, message='shutting down on Ctrl+C')
def test_bad_control(mock_systemd, master_thread, master_control, caplog):
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
master_control.send(b'FOO')
master_control.send_msg('QUIT')
thread.join(10)
assert not thread.is_alive()
assert find_message(caplog.records, message='unable to deserialize data')
def test_status_passthru(tmpdir, mock_context, mock_systemd, master_thread):
with mock_context().socket(transport.PUSH, protocol=protocols.monitor_stats) as int_status, \
mock_context().socket(transport.SUB, protocol=reversed(protocols.monitor_stats)) as ext_status:
ext_status.connect('ipc://' + str(tmpdir.join('status-queue')))
ext_status.subscribe('')
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
# Wait for the first statistics message (from BigBrother) to get the
# SUB queue working
msg, data = ext_status.recv_msg()
assert msg == 'STATS'
data['builds_count'] = 12345
int_status.connect(const.INT_STATUS_QUEUE)
int_status.send_msg('STATS', data)
# Try several times to read the passed-thru message; other messages
# (like stats from BigBrother) will be sent to ext-status too
for i in range(3):
msg, copy = ext_status.recv_msg()
if msg == 'STATS':
assert copy == data
break
else:
assert False, "Didn't see modified STATS passed-thru"
def test_kill_control(mock_systemd, master_thread, master_control):
with mock.patch('piwheels.master.SlaveDriver.kill_slave') as kill_slave:
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
master_control.send_msg('KILL', 1)
master_control.send_msg('QUIT')
thread.join(10)
assert not thread.is_alive()
assert kill_slave.call_args == mock.call(1)
def test_pause_resume(mock_systemd, master_thread, master_control, caplog):
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
master_control.send_msg('PAUSE')
master_control.send_msg('RESUME')
master_control.send_msg('QUIT')
thread.join(10)
assert not thread.is_alive()
assert find_message(caplog.records, message='pausing operations')
assert find_message(caplog.records, message='resuming operations')
def test_new_monitor(mock_systemd, master_thread, master_control, caplog):
with mock.patch('piwheels.master.SlaveDriver.list_slaves') as list_slaves:
thread = master_thread()
thread.start()
assert mock_systemd._ready.wait(10)
master_control.send_msg('HELLO')
master_control.send_msg('QUIT')
thread.join(10)
assert not thread.is_alive()
assert find_message(caplog.records,
message='sending status to new monitor')
assert list_slaves.call_args == mock.call()
def test_debug(mock_systemd, master_thread, master_control, caplog):
thread = master_thread(args=['--debug', 'master.the_scribe',
'--debug', 'master.the_architect'])
thread.start()
assert mock_systemd._ready.wait(10)
master_control.send_msg('QUIT')
thread.join(10)
assert not thread.is_alive()
assert find_message(caplog.records, name='master.the_scribe',
levelname='DEBUG', message='<< QUIT None')
assert find_message(caplog.records, name='master.the_architect',
levelname='DEBUG', message='<< QUIT None')
| [
1,
529,
276,
1112,
420,
29958,
29890,
29895,
29899,
4378,
29887,
29914,
1631,
29893,
354,
1379,
13,
29937,
450,
2930,
29893,
354,
1379,
2060,
13,
29937,
259,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29955,
529,
5813,
29958,
529,
991,
597,
3292,
29889,
510,
29914,
1785,
29876,
4774,
497,
29958,
13,
29937,
259,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29955,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13,
29937,
4367,
391,
3224,
322,
671,
297,
2752,
322,
7581,
7190,
29892,
411,
470,
1728,
13,
29937,
21733,
29892,
526,
21905,
4944,
393,
278,
1494,
5855,
526,
1539,
29901,
13,
29937,
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,
3509,
1266,
19464,
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,
13,
29937,
3446,
3235,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
6770,
6093,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
5300,
8707,
29911,
3960,
29933,
2692,
24125,
376,
3289,
8519,
29908,
13,
29937,
5300,
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,
13,
29937,
306,
3580,
5265,
3352,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
5300,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
13,
29937,
319,
1525,
28657,
13875,
8890,
29928,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
6323,
8707,
29911,
3960,
29933,
2692,
24125,
20700,
13,
29937,
17705,
6181,
15842,
13764,
29979,
22471,
26282,
29892,
2672,
4571,
26282,
29892,
2672,
29907,
1367,
3919,
1964,
29892,
317,
4162,
8426,
1964,
29892,
8528,
29923,
3580,
29931,
19926,
29892,
6323,
13,
29937,
8707,
1660,
13356,
3919,
25758,
21330,
1529,
1692,
29903,
313,
1177,
6154,
15789,
4214,
29892,
350,
2692,
6058,
27848,
3352,
7495,
29892,
13756,
29907,
11499,
13780,
8079,
13,
29937,
27092,
1254,
1806,
26027,
21947,
29949,
8452,
6323,
26996,
29963,
2965,
2890,
29936,
11247,
1799,
8079,
501,
1660,
29892,
360,
8254,
29892,
6323,
13756,
29943,
1806,
29903,
29936,
6323,
350,
3308,
8895,
1799,
13,
29937,
2672,
4945,
29934,
4897,
29911,
2725,
29897,
29832,
8851,
5348,
12766,
17171,
29928,
5300,
6732,
13764,
29979,
6093,
18929,
8079,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13,
29937,
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,
6323,
438,
29911,
4448,
22119,
1660,
29897,
13,
29937,
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,
11033,
18118,
1660,
29928,
8079,
6093,
13,
29937,
21521,
1799,
8979,
6227,
11937,
8079,
20134,
3210,
21330,
1529,
1692,
29889,
13,
13,
13,
5215,
2897,
13,
3166,
443,
27958,
1053,
11187,
13,
3166,
3244,
292,
1053,
10480,
13,
13,
5215,
11451,
1688,
13,
13,
3166,
378,
615,
342,
1053,
1284,
29918,
4906,
13,
3166,
2930,
29893,
354,
1379,
1053,
4770,
3259,
1649,
29892,
9608,
29879,
29892,
8608,
13,
3166,
2930,
29893,
354,
1379,
29889,
6207,
1053,
1667,
29892,
1040,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
11187,
29918,
29886,
1478,
29875,
29898,
3827,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
3134,
29878,
6739,
29889,
4645,
29889,
6004,
14048,
1495,
408,
10166,
29901,
13,
4706,
10166,
2141,
305,
9477,
468,
29918,
16076,
29918,
15550,
29889,
2457,
29918,
1767,
353,
5159,
13,
4706,
7709,
10166,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
11187,
29918,
25436,
29898,
3827,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
25436,
29889,
25436,
1495,
408,
7182,
29901,
13,
4706,
7709,
7182,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
11187,
29918,
4703,
29898,
3827,
29892,
12162,
29939,
29918,
4703,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
1631,
29893,
354,
1379,
29889,
27882,
29889,
2677,
1495,
408,
12893,
29918,
17640,
29901,
13,
4706,
396,
6978,
266,
582,
5717,
304,
15228,
29889,
11514,
29892,
541,
11455,
4129,
1683,
313,
262,
13,
4706,
396,
3153,
29892,
8174,
322,
1840,
5717,
408,
591,
864,
278,
6724,
3030,
304,
13,
4706,
396,
12070,
2820,
29897,
13,
4706,
12893,
29918,
17640,
2141,
11514,
29889,
2975,
29918,
15987,
353,
12162,
29939,
29918,
4703,
29889,
11514,
13,
4706,
7709,
12893,
29918,
17640,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
5835,
29918,
7097,
29898,
3827,
29892,
11187,
29918,
29886,
1478,
29875,
29892,
11187,
29918,
4703,
29892,
11187,
29918,
5205,
29881,
29892,
11187,
29918,
25436,
29892,
13,
462,
29871,
13128,
3972,
29892,
4833,
29918,
2271,
29892,
4833,
29892,
411,
29918,
11010,
1125,
13,
1678,
1667,
29918,
7097,
353,
6213,
13,
1678,
822,
903,
6207,
29918,
7097,
29898,
5085,
29922,
8516,
1125,
13,
4706,
1661,
2997,
1667,
29918,
7097,
13,
4706,
565,
6389,
338,
6213,
29901,
13,
9651,
6389,
353,
5159,
13,
4706,
1667,
29918,
7097,
353,
10480,
29898,
1388,
9857,
29922,
5574,
29892,
3646,
29922,
3396,
29892,
6389,
29922,
4197,
13,
9651,
525,
489,
6289,
29876,
742,
4833,
29918,
2271,
29892,
13,
9651,
525,
489,
4905,
29899,
2084,
742,
851,
29898,
7050,
3972,
29889,
7122,
877,
4905,
1495,
511,
13,
9651,
525,
489,
4882,
29899,
9990,
742,
29871,
525,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
4882,
29899,
9990,
1495,
511,
13,
9651,
525,
489,
6451,
29899,
9990,
742,
525,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
6451,
29899,
9990,
1495,
511,
13,
9651,
525,
489,
29879,
18398,
29899,
9990,
742,
259,
525,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
29879,
18398,
29899,
9990,
1495,
511,
13,
9651,
525,
489,
1445,
29899,
9990,
742,
1678,
525,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
1445,
29899,
9990,
1495,
511,
13,
9651,
525,
489,
5215,
29899,
9990,
742,
29871,
525,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
5215,
29899,
9990,
1495,
511,
13,
9651,
525,
489,
1188,
29899,
9990,
742,
268,
525,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
1188,
29899,
9990,
1495,
511,
13,
4706,
4514,
718,
1051,
29898,
5085,
511,
876,
13,
4706,
736,
1667,
29918,
7097,
13,
1678,
7709,
903,
6207,
29918,
7097,
13,
1678,
565,
1667,
29918,
7097,
338,
451,
6213,
322,
1667,
29918,
7097,
29889,
275,
29918,
284,
573,
7295,
13,
4706,
411,
11187,
29918,
4703,
2141,
11514,
29898,
13,
18884,
8608,
29889,
29925,
3308,
29950,
29892,
9608,
29922,
276,
874,
287,
29898,
20464,
29879,
29889,
6207,
29918,
6451,
876,
408,
2761,
29901,
13,
9651,
2761,
29889,
6915,
877,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
6451,
29899,
9990,
29915,
4961,
13,
9651,
2761,
29889,
6717,
29918,
7645,
877,
13356,
1806,
1495,
13,
4706,
1667,
29918,
7097,
29889,
7122,
29898,
29896,
29900,
29897,
13,
4706,
4974,
451,
1667,
29918,
7097,
29889,
275,
29918,
284,
573,
580,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
5835,
29918,
6451,
29898,
3827,
29892,
13128,
3972,
29892,
11187,
29918,
4703,
1125,
13,
1678,
2761,
353,
11187,
29918,
4703,
2141,
11514,
29898,
13,
4706,
8608,
29889,
29925,
3308,
29950,
29892,
9608,
29922,
276,
874,
287,
29898,
20464,
29879,
29889,
6207,
29918,
6451,
876,
13,
1678,
2761,
29889,
6915,
877,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
6451,
29899,
9990,
29915,
4961,
13,
1678,
7709,
2761,
13,
1678,
2761,
29889,
5358,
580,
13,
13,
13,
1753,
1243,
29918,
8477,
29898,
29883,
2547,
952,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
3924,
24365,
1125,
13,
4706,
1667,
18959,
489,
8477,
11287,
13,
1678,
714,
29892,
4589,
353,
2117,
9675,
29889,
949,
5561,
29878,
580,
13,
1678,
4974,
714,
29889,
27382,
2541,
877,
21125,
29901,
1495,
13,
1678,
4974,
525,
489,
29886,
1478,
29875,
29899,
3134,
29878,
6739,
29915,
297,
714,
13,
13,
13,
1753,
1243,
29918,
3259,
29898,
29883,
2547,
952,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
3924,
24365,
1125,
13,
4706,
1667,
18959,
489,
3259,
11287,
13,
1678,
714,
29892,
4589,
353,
2117,
9675,
29889,
949,
5561,
29878,
580,
13,
1678,
4974,
714,
29889,
17010,
580,
1275,
4770,
3259,
1649,
13,
13,
13,
1753,
1243,
29918,
1217,
29918,
4632,
29898,
5030,
1188,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
359,
29889,
657,
29872,
5416,
1495,
408,
679,
29872,
5416,
29901,
13,
4706,
679,
29872,
5416,
29889,
2457,
29918,
1767,
353,
29871,
29900,
13,
4706,
4974,
1667,
4197,
2314,
2804,
29871,
29900,
13,
4706,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
13,
462,
9651,
2643,
2433,
19203,
1818,
451,
367,
1065,
408,
3876,
1495,
13,
13,
13,
1753,
1243,
29918,
28358,
29918,
6451,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
5835,
29918,
6451,
1125,
13,
1678,
3244,
353,
5835,
29918,
7097,
580,
13,
1678,
3244,
29889,
2962,
580,
13,
1678,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
1678,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
13356,
1806,
1495,
13,
1678,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
1678,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
13,
13,
1753,
1243,
29918,
5205,
29918,
13322,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
2117,
1188,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
1631,
29893,
354,
1379,
29889,
6207,
29889,
12197,
29956,
354,
1379,
19203,
29889,
3396,
29918,
7888,
1495,
408,
1667,
29918,
7888,
29901,
13,
4706,
1667,
29918,
7888,
29889,
2975,
29918,
15987,
353,
2184,
24365,
29898,
29896,
29897,
13,
4706,
3244,
353,
5835,
29918,
7097,
580,
13,
4706,
3244,
29889,
2962,
580,
13,
4706,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
4706,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
4706,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
1678,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
2643,
2433,
845,
329,
1259,
1623,
373,
317,
6259,
4945,
29924,
1495,
13,
13,
13,
1753,
1243,
29918,
5205,
29918,
24220,
29918,
29883,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
2117,
1188,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
1631,
29893,
354,
1379,
29889,
6207,
29889,
12197,
29956,
354,
1379,
19203,
29889,
3396,
29918,
7888,
1495,
408,
1667,
29918,
7888,
29901,
13,
4706,
1667,
29918,
7888,
29889,
2975,
29918,
15987,
353,
7670,
3377,
4074,
6685,
580,
13,
4706,
3244,
353,
5835,
29918,
7097,
580,
13,
4706,
3244,
29889,
2962,
580,
13,
4706,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
4706,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
4706,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
1678,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
2643,
2433,
845,
329,
1259,
1623,
373,
315,
11742,
29974,
29907,
1495,
13,
13,
13,
1753,
1243,
29918,
12313,
29918,
6451,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
5835,
29918,
6451,
29892,
2117,
1188,
1125,
13,
1678,
3244,
353,
5835,
29918,
7097,
580,
13,
1678,
3244,
29889,
2962,
580,
13,
1678,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
1678,
5835,
29918,
6451,
29889,
6717,
29898,
29890,
29915,
5800,
29949,
1495,
13,
1678,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
13356,
1806,
1495,
13,
1678,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
1678,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
1678,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
2643,
2433,
348,
519,
304,
16964,
6646,
848,
1495,
13,
13,
13,
1753,
1243,
29918,
4882,
29918,
18182,
303,
29882,
582,
29898,
7050,
3972,
29892,
11187,
29918,
4703,
29892,
11187,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
1125,
13,
1678,
411,
11187,
29918,
4703,
2141,
11514,
29898,
27882,
29889,
29925,
3308,
29950,
29892,
9608,
29922,
20464,
29879,
29889,
3712,
2105,
29918,
16202,
29897,
408,
938,
29918,
4882,
29892,
320,
13,
9651,
11187,
29918,
4703,
2141,
11514,
29898,
27882,
29889,
20633,
29892,
9608,
29922,
276,
874,
287,
29898,
20464,
29879,
29889,
3712,
2105,
29918,
16202,
876,
408,
1294,
29918,
4882,
29901,
13,
4706,
1294,
29918,
4882,
29889,
6915,
877,
666,
29883,
597,
29915,
718,
851,
29898,
7050,
3972,
29889,
7122,
877,
4882,
29899,
9990,
29915,
4961,
13,
4706,
1294,
29918,
4882,
29889,
19496,
877,
1495,
13,
4706,
3244,
353,
5835,
29918,
7097,
580,
13,
4706,
3244,
29889,
2962,
580,
13,
4706,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
4706,
396,
20340,
363,
278,
937,
13964,
2643,
313,
3166,
7997,
29857,
721,
29897,
304,
679,
278,
13,
4706,
396,
27092,
9521,
1985,
13,
4706,
10191,
29892,
848,
353,
1294,
29918,
4882,
29889,
3757,
29894,
29918,
7645,
580,
13,
4706,
4974,
10191,
1275,
525,
17816,
29903,
29915,
13,
4706,
848,
1839,
4282,
29879,
29918,
2798,
2033,
353,
29871,
29896,
29906,
29941,
29946,
29945,
13,
4706,
938,
29918,
4882,
29889,
6915,
29898,
3075,
29889,
10192,
29918,
27047,
29918,
11144,
4462,
29897,
13,
4706,
938,
29918,
4882,
29889,
6717,
29918,
7645,
877,
17816,
29903,
742,
848,
29897,
13,
4706,
396,
3967,
3196,
3064,
304,
1303,
278,
4502,
29899,
386,
582,
2643,
29936,
916,
7191,
13,
4706,
396,
313,
4561,
22663,
515,
7997,
29857,
721,
29897,
674,
367,
2665,
304,
1294,
29899,
4882,
2086,
13,
4706,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
9651,
10191,
29892,
3509,
353,
1294,
29918,
4882,
29889,
3757,
29894,
29918,
7645,
580,
13,
9651,
565,
10191,
1275,
525,
17816,
29903,
2396,
13,
18884,
4974,
3509,
1275,
848,
13,
18884,
2867,
13,
4706,
1683,
29901,
13,
9651,
4974,
7700,
29892,
376,
9260,
29876,
29915,
29873,
1074,
9120,
6850,
1299,
29903,
4502,
29899,
386,
582,
29908,
13,
13,
13,
1753,
1243,
29918,
21174,
29918,
6451,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
5835,
29918,
6451,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
1631,
29893,
354,
1379,
29889,
6207,
29889,
29903,
18398,
12376,
29889,
21174,
29918,
29879,
18398,
1495,
408,
12088,
29918,
29879,
18398,
29901,
13,
4706,
3244,
353,
5835,
29918,
7097,
580,
13,
4706,
3244,
29889,
2962,
580,
13,
4706,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
4706,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
29968,
24071,
742,
29871,
29896,
29897,
13,
4706,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
13356,
1806,
1495,
13,
4706,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
4706,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
4706,
4974,
12088,
29918,
29879,
18398,
29889,
4804,
29918,
5085,
1275,
11187,
29889,
4804,
29898,
29896,
29897,
13,
13,
13,
1753,
1243,
29918,
29886,
1071,
29918,
690,
2017,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
5835,
29918,
6451,
29892,
2117,
1188,
1125,
13,
1678,
3244,
353,
5835,
29918,
7097,
580,
13,
1678,
3244,
29889,
2962,
580,
13,
1678,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
1678,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
7228,
17171,
1495,
13,
1678,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
1525,
14605,
2303,
1495,
13,
1678,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
13356,
1806,
1495,
13,
1678,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
1678,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
1678,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
2643,
2433,
29886,
1485,
292,
6931,
1495,
13,
1678,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
2643,
2433,
690,
9929,
6931,
1495,
13,
13,
13,
1753,
1243,
29918,
1482,
29918,
3712,
2105,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
5835,
29918,
6451,
29892,
2117,
1188,
1125,
13,
1678,
411,
11187,
29889,
5041,
877,
1631,
29893,
354,
1379,
29889,
6207,
29889,
29903,
18398,
12376,
29889,
1761,
29918,
29879,
433,
1960,
1495,
408,
1051,
29918,
29879,
433,
1960,
29901,
13,
4706,
3244,
353,
5835,
29918,
7097,
580,
13,
4706,
3244,
29889,
2962,
580,
13,
4706,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
4706,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
9606,
2208,
29949,
1495,
13,
4706,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
13356,
1806,
1495,
13,
4706,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
4706,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
4706,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
13,
462,
9651,
2643,
2433,
29879,
2548,
4660,
304,
716,
11819,
1495,
13,
4706,
4974,
1051,
29918,
29879,
433,
1960,
29889,
4804,
29918,
5085,
1275,
11187,
29889,
4804,
580,
13,
13,
13,
1753,
1243,
29918,
8382,
29898,
17640,
29918,
5205,
29881,
29892,
5835,
29918,
7097,
29892,
5835,
29918,
6451,
29892,
2117,
1188,
1125,
13,
1678,
3244,
353,
5835,
29918,
7097,
29898,
5085,
29922,
1839,
489,
8382,
742,
525,
6207,
29889,
1552,
29918,
13086,
742,
13,
462,
462,
525,
489,
8382,
742,
525,
6207,
29889,
1552,
29918,
1279,
4496,
11287,
13,
1678,
3244,
29889,
2962,
580,
13,
1678,
4974,
11187,
29918,
5205,
29881,
3032,
2040,
29889,
10685,
29898,
29896,
29900,
29897,
13,
1678,
5835,
29918,
6451,
29889,
6717,
29918,
7645,
877,
13356,
1806,
1495,
13,
1678,
3244,
29889,
7122,
29898,
29896,
29900,
29897,
13,
1678,
4974,
451,
3244,
29889,
275,
29918,
284,
573,
580,
13,
1678,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
1024,
2433,
6207,
29889,
1552,
29918,
13086,
742,
13,
462,
4706,
3233,
978,
2433,
18525,
742,
2643,
2433,
9314,
660,
29965,
1806,
6213,
1495,
13,
1678,
4974,
1284,
29918,
4906,
29898,
5030,
1188,
29889,
3757,
4339,
29892,
1024,
2433,
6207,
29889,
1552,
29918,
1279,
4496,
742,
13,
462,
4706,
3233,
978,
2433,
18525,
742,
2643,
2433,
9314,
660,
29965,
1806,
6213,
1495,
13,
2
] |
main.py | i-m-pulse/export-google-drive-files | 0 | 74146 | <reponame>i-m-pulse/export-google-drive-files<filename>main.py
from gdrive import gdrive
from config import Config
#Instantiate an object
foo = gdrive(Config)
## Authenticating
# Get inital code to access token
code = foo.getCode()
#Access the access_token and refresh_token
foo.writeToken(code)
# Get fileid for your file
src_filename = 'your Google Drive filename Google Spreadsheet'
file_id = foo.getFileId(src_filename)
# Download the file to your local folder
dst_filename = 'test.csv'
dst_mimetype = 'text/csv'
foo.downloadFile(file_id, dst_mimetype, dst_filename)
| [
1,
529,
276,
1112,
420,
29958,
29875,
29899,
29885,
29899,
29886,
19994,
29914,
15843,
29899,
3608,
29899,
21594,
29899,
5325,
29966,
9507,
29958,
3396,
29889,
2272,
13,
3166,
330,
21594,
1053,
330,
21594,
30004,
13,
3166,
2295,
1053,
12782,
30004,
13,
30004,
13,
29937,
3379,
3656,
403,
385,
1203,
30004,
13,
5431,
353,
330,
21594,
29898,
3991,
8443,
13,
30004,
13,
2277,
13189,
4173,
1218,
30004,
13,
30004,
13,
29937,
3617,
2069,
284,
775,
304,
2130,
5993,
30004,
13,
401,
353,
7953,
29889,
657,
3399,
26471,
13,
29937,
6638,
278,
2130,
29918,
6979,
322,
11086,
29918,
6979,
30004,
13,
5431,
29889,
3539,
6066,
29898,
401,
8443,
13,
30004,
13,
29937,
3617,
934,
333,
363,
596,
934,
30004,
13,
4351,
29918,
9507,
353,
525,
8066,
5087,
22850,
10422,
5087,
1706,
27844,
29915,
30004,
13,
1445,
29918,
333,
353,
7953,
29889,
657,
2283,
1204,
29898,
4351,
29918,
9507,
8443,
13,
30004,
13,
29937,
25553,
278,
934,
304,
596,
1887,
4138,
30004,
13,
22992,
29918,
9507,
353,
525,
1688,
29889,
7638,
29915,
30004,
13,
22992,
29918,
29885,
17528,
668,
353,
525,
726,
29914,
7638,
29915,
30004,
13,
5431,
29889,
10382,
2283,
29898,
1445,
29918,
333,
29892,
29743,
29918,
29885,
17528,
668,
29892,
29743,
29918,
9507,
8443,
13,
2
] |
backend/kesaseteli/applications/services.py | iivoraitahila/yjdh | 0 | 138733 | <reponame>iivoraitahila/yjdh<gh_stars>0
from applications.models import Application, SummerVoucher
def update_summer_vouchers_using_api_data(
summer_vouchers_data: list, instance: Application
) -> None:
existing_summer_voucher_ids = []
for summer_voucher_data in summer_vouchers_data:
summer_voucher_id = summer_voucher_data.pop("id", None)
if summer_voucher_id:
# Update all SummerVouchers that had a provided id
SummerVoucher.objects.filter(id=summer_voucher_id).update(
**summer_voucher_data
)
else:
# Create new SummerVouchers that did not provide an id
summer_voucher = SummerVoucher.objects.create(
application=instance, **summer_voucher_data
)
summer_voucher_id = summer_voucher.id
existing_summer_voucher_ids.append(summer_voucher_id)
# Delete all SummerVouchers that were not part of the provided ids
SummerVoucher.objects.filter(application=instance).exclude(
id__in=existing_summer_voucher_ids
).delete()
| [
1,
529,
276,
1112,
420,
29958,
29875,
440,
272,
1249,
801,
4233,
29914,
17472,
12744,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
8324,
29889,
9794,
1053,
8427,
29892,
13329,
29963,
3222,
261,
13,
13,
13,
1753,
2767,
29918,
2083,
1050,
29918,
29894,
3222,
414,
29918,
4746,
29918,
2754,
29918,
1272,
29898,
13,
1678,
11801,
29918,
29894,
3222,
414,
29918,
1272,
29901,
1051,
29892,
2777,
29901,
8427,
13,
29897,
1599,
6213,
29901,
13,
1678,
5923,
29918,
2083,
1050,
29918,
29894,
3222,
261,
29918,
4841,
353,
5159,
13,
13,
1678,
363,
11801,
29918,
29894,
3222,
261,
29918,
1272,
297,
11801,
29918,
29894,
3222,
414,
29918,
1272,
29901,
13,
4706,
11801,
29918,
29894,
3222,
261,
29918,
333,
353,
11801,
29918,
29894,
3222,
261,
29918,
1272,
29889,
7323,
703,
333,
613,
6213,
29897,
13,
4706,
565,
11801,
29918,
29894,
3222,
261,
29918,
333,
29901,
13,
9651,
396,
10318,
599,
13329,
29963,
3222,
414,
393,
750,
263,
4944,
1178,
13,
9651,
13329,
29963,
3222,
261,
29889,
12650,
29889,
4572,
29898,
333,
29922,
2083,
1050,
29918,
29894,
3222,
261,
29918,
333,
467,
5504,
29898,
13,
18884,
3579,
2083,
1050,
29918,
29894,
3222,
261,
29918,
1272,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
396,
6204,
716,
13329,
29963,
3222,
414,
393,
1258,
451,
3867,
385,
1178,
13,
9651,
11801,
29918,
29894,
3222,
261,
353,
13329,
29963,
3222,
261,
29889,
12650,
29889,
3258,
29898,
13,
18884,
2280,
29922,
8758,
29892,
3579,
2083,
1050,
29918,
29894,
3222,
261,
29918,
1272,
13,
9651,
1723,
13,
9651,
11801,
29918,
29894,
3222,
261,
29918,
333,
353,
11801,
29918,
29894,
3222,
261,
29889,
333,
13,
4706,
5923,
29918,
2083,
1050,
29918,
29894,
3222,
261,
29918,
4841,
29889,
4397,
29898,
2083,
1050,
29918,
29894,
3222,
261,
29918,
333,
29897,
13,
13,
1678,
396,
21267,
599,
13329,
29963,
3222,
414,
393,
892,
451,
760,
310,
278,
4944,
18999,
13,
1678,
13329,
29963,
3222,
261,
29889,
12650,
29889,
4572,
29898,
6214,
29922,
8758,
467,
735,
2325,
29898,
13,
4706,
1178,
1649,
262,
29922,
735,
15423,
29918,
2083,
1050,
29918,
29894,
3222,
261,
29918,
4841,
13,
1678,
13742,
8143,
580,
13,
2
] |
latex/parser.py | omnidan/python-latex | 7 | 103724 | <reponame>omnidan/python-latex
from __future__ import print_function
__author__ = '<NAME>'
__copyright__ = "Copyright 2013, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "BSD"
__version__ = "0.1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Prototype"
from .document import LatexDocument
from .lines import LatexCommand, LatexText, LatexComment, LatexMacro, LatexEnvironmentMacro
from .environment import LatexEnvironment
import re
class LatexParser:
def __parseDocument(self, tex):
""" Parse a latex document and return the header and content buffer in a tuple """
header_buffer = [] # buffer for the header lines
content_buffer = [] # buffer for the content lines
header = True # are we still parsing the header?
# run through all lines
for line in [line for line in tex.split('\n') if True]:
# document started, that means we are no longer in the header
if "\\begin{document}" in line:
header = False
elif "\\end{document}" in line:
header = True
else:
if header:
header_buffer.append(line)
else:
content_buffer.append(line)
return header_buffer, content_buffer
# noinspection PyUnusedLocal
def __matchTeXMacro(self, line, prefix="", suffix=""):
""" Some regex magic to parse TeX macros """
# TODO: macros can occupy multiple lines, add support for this
cmd = None
opt = None
argc = None
p = re.match(r'\\newcommand\{(.*)}\[(.*)]\{(.*)}', line, re.M | re.I)
if p is None:
# match without additional [] arguments
p = re.match(r'\\newcommand\{(.*)}\{(.*)}', line, re.M | re.I)
if p is None:
# invalid macro
return False
else:
cmd = p.group(1)
opt = p.group(2)
else:
cmd = p.group(1)
try:
argc = int(p.group(2))
except ValueError:
return False
opt = p.group(3)
if cmd is None:
# couldn't parse, invalid latex macro
return False
elif opt is None:
# couldn't parse, invalid latex macro
return False
else:
# regex is a finite state machine, it can't match nested commands
# TODO: rewrite this to work for macros
if "{" in cmd:
real_cmd = cmd.split("{")
cmd = real_cmd[0]
opt = "{".join(real_cmd[1:]) + "{" + opt
cmd = cmd.replace(" ", "") # remove whitespace from the command
if cmd[-1] == "*":
cmd = ''.join(cmd[:-1])
asterisk = True
else:
asterisk = False
if not argc:
argc = 0
return LatexMacro(cmd, opt, argc, prefix, suffix)
# noinspection PyUnusedLocal
def __matchTeXEnvironmentMacro(self, line, prefix="", suffix=""):
""" Some regex magic to parse TeX macros """
# TODO: macros can occupy multiple lines, add support for this
cmd = None
opt = None
argc = None
adopt = None
p = re.match(r'\\newenvironment\{(.*)}\[(.*)]\{(.*)}\{(.*)}', line, re.M | re.I)
if p is None:
# match without additional [] arguments
p = re.match(r'\\newenvironment\{(.*)}\{(.*)}\{(.*)}', line, re.M | re.I)
if p is None:
# invalid macro
return False
else:
cmd = p.group(1)
opt = p.group(2)
adopt = p.group(3)
else:
cmd = p.group(1)
try:
argc = int(p.group(2))
except ValueError:
return False
opt = p.group(3)
adopt = p.group(4)
if cmd is None:
# couldn't parse, invalid latex macro
return False
elif opt is None:
# couldn't parse, invalid latex macro
return False
elif adopt is None:
# couldn't parse, invalid latex macro
return False
else:
# regex is a finite state machine, it can't match nested commands
# TODO: rewrite this to work for macros
if "{" in cmd:
real_cmd = cmd.split("{")
cmd = real_cmd[0]
opt = "{".join(real_cmd[1:]) + "{" + opt
cmd = cmd.replace(" ", "") # remove whitespace from the command
if cmd[-1] == "*":
cmd = ''.join(cmd[:-1])
asterisk = True
else:
asterisk = False
if not argc:
argc = 0
return LatexEnvironmentMacro(cmd, opt, adopt, argc, prefix, suffix)
# noinspection PyUnusedLocal
def __matchTeX(self, line, prefix="", suffix=""):
""" Some regex magic to parse TeX commands """
cmd = None
opt = None
adopt = None
# TODO: add support for multiple arguments
p = re.match(r'\\(.*)\[(.*)\]\{(.*)}', line, re.M | re.I)
if p is None:
# match without additional [] arguments
p = re.match(r'\\(.*)\{(.*)}', line, re.M | re.I)
if p is None:
# match without any arguments
p = re.match(r'\\(.*)', line, re.M | re.I)
cmd = p.group(1)
else:
cmd = p.group(1)
opt = p.group(2)
else:
cmd = p.group(1)
adopt = p.group(2)
opt = p.group(3)
if cmd is None:
# couldn't parse, invalid latex command
return False
else:
# regex is a finite state machine, it can't match nested commands
if "{" in cmd:
real_cmd = cmd.split("{")
cmd = real_cmd[0]
opt = "{".join(real_cmd[1:]) + "{" + opt
cmd = cmd.replace(" ", "") # remove whitespace from the command
if cmd[-1] == "*":
cmd = ''.join(cmd[:-1])
asterisk = True
else:
asterisk = False
return LatexCommand(cmd, opt, adopt, asterisk, prefix, suffix)
def appendline(self, line):
if self.__current_environment:
self.__current_environment.addLine(line)
else:
self.__parse_buffer.append(line)
def __parse(self, tex, keep_empty_lines=False, do_not_concat_text=False):
self.__parse_buffer = []
for line in tex:
# firstly, strip the line to remove whitespace
nonstripped = line
line = line.strip()
if nonstripped == line or line == "":
prefix = ""
suffix = ""
else:
prefix, suffix = nonstripped.split(line)
# check if the line is empty
if line == "":
if keep_empty_lines:
self.appendline(LatexText(nonstripped))
self.__last_line = self.__parse_buffer[-1]
else:
# now check if command, comment or text
if line[0] == '\\':
# this is a latex command, parse it as such
latex_command = self.__matchTeX(line, prefix, suffix)
if latex_command is False:
import sys
print("WARNING: Couldn't parse LaTeX command: " + line, file=sys.stderr)
else:
if latex_command.command_name == "newcommand":
# this is a LatexMacro, not a LatexCommand
latex_macro = self.__matchTeXMacro(line, prefix, suffix)
self.appendline(latex_macro)
elif latex_command.command_name == "newenvironment":
# this is a LatexEnvironmentMacro, not a LatexCommand
latex_macro = self.__matchTeXEnvironmentMacro(line, prefix, suffix)
self.appendline(latex_macro)
elif latex_command.command_name == "begin":
# this is a LatexEnvironment, not a LatexCommand
latex_environment = LatexEnvironment(latex_command.command_options)
self.appendline(latex_environment)
self.__current_environment = self.__parse_buffer[-1]
elif latex_command.command_name == "end":
# this is the end of a LatexEnvironment, not a LatexCommand
# TODO: environments inside environments do not work yet
self.__current_environment = None
else:
latex_command.parseOptions()
self.appendline(latex_command)
elif line[0] == "%":
# remove first character from line and create the LatexComment object
comment = "".join(line[1:]).strip()
if not do_not_concat_text and isinstance(self.__last_line, LatexComment):
# last line was a LatexComment too, append to this object
self.__last_line.append(comment)
else:
# create new LatexComment object
self.appendline(LatexComment(comment, self.__ld.comment_prefix,
self.__ld.comment_append_prefix,
self.__ld.comment_append_suffix,
prefix=prefix, suffix=suffix))
else:
# this is a normal text line
if not do_not_concat_text and isinstance(self.__last_line, LatexText):
# last line was a LatexText too, append to this object
self.__last_line.append(line)
else:
# create new LatexText object
self.appendline(LatexText(line, self.__ld.text_append_prefix, self.__ld.text_append_suffix,
prefix=prefix, suffix=suffix))
self.__last_line = self.__parse_buffer[-1]
return self.__parse_buffer
def getResult(self):
return self.__ld
def __init__(self, tex, obj=None, keep_empty_lines=False, do_not_concat_text=False):
# init last_line variable
self.__last_line = None
self.__current_environment = None
self.__parse_buffer = []
# parse document into header and content buffer
header, content = self.__parseDocument(tex)
# parse buffers into objects
if obj is None:
obj = LatexDocument()
self.__ld = obj
self.__ld.setHeader(self.__parse(header, keep_empty_lines, do_not_concat_text))
self.__ld.setContent(self.__parse(content, keep_empty_lines, do_not_concat_text)) | [
1,
529,
276,
1112,
420,
29958,
290,
29876,
29219,
29914,
4691,
29899,
25694,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
1649,
8921,
1649,
353,
12801,
5813,
16299,
13,
1649,
8552,
1266,
1649,
353,
376,
11882,
1266,
29871,
29906,
29900,
29896,
29941,
29892,
529,
5813,
11903,
13,
1649,
11944,
1169,
1649,
353,
6796,
29966,
5813,
29958,
3108,
13,
13,
1649,
506,
1947,
1649,
353,
376,
29933,
7230,
29908,
13,
1649,
3259,
1649,
353,
376,
29900,
29889,
29896,
29889,
29900,
29908,
13,
1649,
29885,
2365,
4008,
1649,
353,
9872,
5813,
11903,
13,
1649,
5269,
1649,
353,
9872,
26862,
6227,
11903,
13,
1649,
4882,
1649,
353,
376,
1184,
10414,
29908,
13,
13,
3166,
869,
3225,
1053,
23089,
29916,
6268,
13,
3166,
869,
9012,
1053,
23089,
29916,
6255,
29892,
23089,
29916,
1626,
29892,
23089,
29916,
20001,
29892,
23089,
29916,
15735,
307,
29892,
23089,
29916,
18649,
15735,
307,
13,
3166,
869,
20944,
1053,
23089,
29916,
18649,
13,
5215,
337,
13,
13,
13,
1990,
23089,
29916,
11726,
29901,
13,
1678,
822,
4770,
5510,
6268,
29898,
1311,
29892,
19696,
1125,
13,
4706,
9995,
20969,
263,
5683,
29916,
1842,
322,
736,
278,
4839,
322,
2793,
6835,
297,
263,
18761,
9995,
13,
4706,
4839,
29918,
9040,
353,
5159,
29871,
396,
6835,
363,
278,
4839,
3454,
13,
4706,
2793,
29918,
9040,
353,
5159,
29871,
396,
6835,
363,
278,
2793,
3454,
13,
4706,
4839,
353,
5852,
29871,
396,
526,
591,
1603,
13755,
278,
4839,
29973,
13,
4706,
396,
1065,
1549,
599,
3454,
13,
4706,
363,
1196,
297,
518,
1220,
363,
1196,
297,
19696,
29889,
5451,
28909,
29876,
1495,
565,
5852,
5387,
13,
9651,
396,
1842,
4687,
29892,
393,
2794,
591,
526,
694,
5520,
297,
278,
4839,
13,
9651,
565,
376,
1966,
463,
29912,
3225,
5038,
297,
1196,
29901,
13,
18884,
4839,
353,
7700,
13,
9651,
25342,
376,
1966,
355,
29912,
3225,
5038,
297,
1196,
29901,
13,
18884,
4839,
353,
5852,
13,
9651,
1683,
29901,
13,
18884,
565,
4839,
29901,
13,
462,
1678,
4839,
29918,
9040,
29889,
4397,
29898,
1220,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
2793,
29918,
9040,
29889,
4397,
29898,
1220,
29897,
13,
4706,
736,
4839,
29918,
9040,
29892,
2793,
29918,
9040,
13,
13,
1678,
396,
694,
1144,
27988,
10772,
2525,
3880,
7717,
13,
1678,
822,
4770,
4352,
16644,
15735,
307,
29898,
1311,
29892,
1196,
29892,
10944,
543,
613,
25557,
13776,
1125,
13,
4706,
9995,
3834,
6528,
15709,
304,
6088,
1920,
29990,
5825,
1883,
9995,
13,
4706,
396,
14402,
29901,
5825,
1883,
508,
6919,
29891,
2999,
3454,
29892,
788,
2304,
363,
445,
13,
4706,
9920,
353,
6213,
13,
4706,
3523,
353,
6213,
13,
4706,
1852,
29883,
353,
6213,
13,
4706,
282,
353,
337,
29889,
4352,
29898,
29878,
29915,
1966,
22978,
29905,
8001,
5575,
11383,
15625,
5575,
4638,
29905,
8001,
5575,
2915,
742,
1196,
29892,
337,
29889,
29924,
891,
337,
29889,
29902,
29897,
13,
4706,
565,
282,
338,
6213,
29901,
13,
9651,
396,
1993,
1728,
5684,
5159,
6273,
13,
9651,
282,
353,
337,
29889,
4352,
29898,
29878,
29915,
1966,
22978,
29905,
8001,
5575,
11383,
8001,
5575,
2915,
742,
1196,
29892,
337,
29889,
29924,
891,
337,
29889,
29902,
29897,
13,
9651,
565,
282,
338,
6213,
29901,
13,
18884,
396,
8340,
11758,
13,
18884,
736,
7700,
13,
9651,
1683,
29901,
13,
18884,
9920,
353,
282,
29889,
2972,
29898,
29896,
29897,
13,
18884,
3523,
353,
282,
29889,
2972,
29898,
29906,
29897,
13,
4706,
1683,
29901,
13,
9651,
9920,
353,
282,
29889,
2972,
29898,
29896,
29897,
13,
9651,
1018,
29901,
13,
18884,
1852,
29883,
353,
938,
29898,
29886,
29889,
2972,
29898,
29906,
876,
13,
9651,
5174,
7865,
2392,
29901,
13,
18884,
736,
7700,
13,
9651,
3523,
353,
282,
29889,
2972,
29898,
29941,
29897,
13,
4706,
565,
9920,
338,
6213,
29901,
13,
9651,
396,
8496,
29915,
29873,
6088,
29892,
8340,
5683,
29916,
11758,
13,
9651,
736,
7700,
13,
4706,
25342,
3523,
338,
6213,
29901,
13,
9651,
396,
8496,
29915,
29873,
6088,
29892,
8340,
5683,
29916,
11758,
13,
9651,
736,
7700,
13,
4706,
1683,
29901,
13,
9651,
396,
6528,
338,
263,
8093,
2106,
4933,
29892,
372,
508,
29915,
29873,
1993,
9322,
8260,
13,
9651,
396,
14402,
29901,
10683,
445,
304,
664,
363,
5825,
1883,
13,
9651,
565,
376,
6377,
297,
9920,
29901,
13,
18884,
1855,
29918,
9006,
353,
9920,
29889,
5451,
703,
29912,
1159,
13,
18884,
9920,
353,
1855,
29918,
9006,
29961,
29900,
29962,
13,
18884,
3523,
353,
29850,
1642,
7122,
29898,
6370,
29918,
9006,
29961,
29896,
29901,
2314,
718,
376,
6377,
718,
3523,
13,
9651,
9920,
353,
9920,
29889,
6506,
703,
9162,
20569,
29871,
396,
3349,
24358,
515,
278,
1899,
13,
9651,
565,
9920,
14352,
29896,
29962,
1275,
26345,
1115,
13,
18884,
9920,
353,
525,
4286,
7122,
29898,
9006,
7503,
29899,
29896,
2314,
13,
18884,
263,
2475,
3873,
353,
5852,
13,
9651,
1683,
29901,
13,
18884,
263,
2475,
3873,
353,
7700,
13,
9651,
565,
451,
1852,
29883,
29901,
13,
18884,
1852,
29883,
353,
29871,
29900,
13,
9651,
736,
23089,
29916,
15735,
307,
29898,
9006,
29892,
3523,
29892,
1852,
29883,
29892,
10944,
29892,
25557,
29897,
13,
13,
1678,
396,
694,
1144,
27988,
10772,
2525,
3880,
7717,
13,
1678,
822,
4770,
4352,
16644,
18649,
15735,
307,
29898,
1311,
29892,
1196,
29892,
10944,
543,
613,
25557,
13776,
1125,
13,
4706,
9995,
3834,
6528,
15709,
304,
6088,
1920,
29990,
5825,
1883,
9995,
13,
4706,
396,
14402,
29901,
5825,
1883,
508,
6919,
29891,
2999,
3454,
29892,
788,
2304,
363,
445,
13,
4706,
9920,
353,
6213,
13,
4706,
3523,
353,
6213,
13,
4706,
1852,
29883,
353,
6213,
13,
4706,
9332,
353,
6213,
13,
4706,
282,
353,
337,
29889,
4352,
29898,
29878,
29915,
1966,
1482,
20944,
29905,
8001,
5575,
11383,
15625,
5575,
4638,
29905,
8001,
5575,
11383,
8001,
5575,
2915,
742,
1196,
29892,
337,
29889,
29924,
891,
337,
29889,
29902,
29897,
13,
4706,
565,
282,
338,
6213,
29901,
13,
9651,
396,
1993,
1728,
5684,
5159,
6273,
13,
9651,
282,
353,
337,
29889,
4352,
29898,
29878,
29915,
1966,
1482,
20944,
29905,
8001,
5575,
11383,
8001,
5575,
11383,
8001,
5575,
2915,
742,
1196,
29892,
337,
29889,
29924,
891,
337,
29889,
29902,
29897,
13,
9651,
565,
282,
338,
6213,
29901,
13,
18884,
396,
8340,
11758,
13,
18884,
736,
7700,
13,
9651,
1683,
29901,
13,
18884,
9920,
353,
282,
29889,
2972,
29898,
29896,
29897,
13,
18884,
3523,
353,
282,
29889,
2972,
29898,
29906,
29897,
13,
18884,
9332,
353,
282,
29889,
2972,
29898,
29941,
29897,
13,
4706,
1683,
29901,
13,
9651,
9920,
353,
282,
29889,
2972,
29898,
29896,
29897,
13,
9651,
1018,
29901,
13,
18884,
1852,
29883,
353,
938,
29898,
29886,
29889,
2972,
29898,
29906,
876,
13,
9651,
5174,
7865,
2392,
29901,
13,
18884,
736,
7700,
13,
9651,
3523,
353,
282,
29889,
2972,
29898,
29941,
29897,
13,
9651,
9332,
353,
282,
29889,
2972,
29898,
29946,
29897,
13,
4706,
565,
9920,
338,
6213,
29901,
13,
9651,
396,
8496,
29915,
29873,
6088,
29892,
8340,
5683,
29916,
11758,
13,
9651,
736,
7700,
13,
4706,
25342,
3523,
338,
6213,
29901,
13,
9651,
396,
8496,
29915,
29873,
6088,
29892,
8340,
5683,
29916,
11758,
13,
9651,
736,
7700,
13,
4706,
25342,
9332,
338,
6213,
29901,
13,
9651,
396,
8496,
29915,
29873,
6088,
29892,
8340,
5683,
29916,
11758,
13,
9651,
736,
7700,
13,
4706,
1683,
29901,
13,
9651,
396,
6528,
338,
263,
8093,
2106,
4933,
29892,
372,
508,
29915,
29873,
1993,
9322,
8260,
13,
9651,
396,
14402,
29901,
10683,
445,
304,
664,
363,
5825,
1883,
13,
9651,
565,
376,
6377,
297,
9920,
29901,
13,
18884,
1855,
29918,
9006,
353,
9920,
29889,
5451,
703,
29912,
1159,
13,
18884,
9920,
353,
1855,
29918,
9006,
29961,
29900,
29962,
13,
18884,
3523,
353,
29850,
1642,
7122,
29898,
6370,
29918,
9006,
29961,
29896,
29901,
2314,
718,
376,
6377,
718,
3523,
13,
9651,
9920,
353,
9920,
29889,
6506,
703,
9162,
20569,
29871,
396,
3349,
24358,
515,
278,
1899,
13,
9651,
565,
9920,
14352,
29896,
29962,
1275,
26345,
1115,
13,
18884,
9920,
353,
525,
4286,
7122,
29898,
9006,
7503,
29899,
29896,
2314,
13,
18884,
263,
2475,
3873,
353,
5852,
13,
9651,
1683,
29901,
13,
18884,
263,
2475,
3873,
353,
7700,
13,
9651,
565,
451,
1852,
29883,
29901,
13,
18884,
1852,
29883,
353,
29871,
29900,
13,
9651,
736,
23089,
29916,
18649,
15735,
307,
29898,
9006,
29892,
3523,
29892,
9332,
29892,
1852,
29883,
29892,
10944,
29892,
25557,
29897,
13,
13,
1678,
396,
694,
1144,
27988,
10772,
2525,
3880,
7717,
13,
1678,
822,
4770,
4352,
16644,
29898,
1311,
29892,
1196,
29892,
10944,
543,
613,
25557,
13776,
1125,
13,
4706,
9995,
3834,
6528,
15709,
304,
6088,
1920,
29990,
8260,
9995,
13,
4706,
9920,
353,
6213,
13,
4706,
3523,
353,
6213,
13,
4706,
9332,
353,
6213,
13,
4706,
396,
14402,
29901,
788,
2304,
363,
2999,
6273,
13,
4706,
282,
353,
337,
29889,
4352,
29898,
29878,
29915,
1966,
28104,
2144,
15625,
5575,
2144,
10725,
8001,
5575,
2915,
742,
1196,
29892,
337,
29889,
29924,
891,
337,
29889,
29902,
29897,
13,
4706,
565,
282,
338,
6213,
29901,
13,
9651,
396,
1993,
1728,
5684,
5159,
6273,
13,
9651,
282,
353,
337,
29889,
4352,
29898,
29878,
29915,
1966,
28104,
2144,
8001,
5575,
2915,
742,
1196,
29892,
337,
29889,
29924,
891,
337,
29889,
29902,
29897,
13,
9651,
565,
282,
338,
6213,
29901,
13,
18884,
396,
1993,
1728,
738,
6273,
13,
18884,
282,
353,
337,
29889,
4352,
29898,
29878,
29915,
1966,
28104,
29897,
742,
1196,
29892,
337,
29889,
29924,
891,
337,
29889,
29902,
29897,
13,
18884,
9920,
353,
282,
29889,
2972,
29898,
29896,
29897,
13,
9651,
1683,
29901,
13,
18884,
9920,
353,
282,
29889,
2972,
29898,
29896,
29897,
13,
18884,
3523,
353,
282,
29889,
2972,
29898,
29906,
29897,
13,
4706,
1683,
29901,
13,
9651,
9920,
353,
282,
29889,
2972,
29898,
29896,
29897,
13,
9651,
9332,
353,
282,
29889,
2972,
29898,
29906,
29897,
13,
9651,
3523,
353,
282,
29889,
2972,
29898,
29941,
29897,
13,
4706,
565,
9920,
338,
6213,
29901,
13,
9651,
396,
8496,
29915,
29873,
6088,
29892,
8340,
5683,
29916,
1899,
13,
9651,
736,
7700,
13,
4706,
1683,
29901,
13,
9651,
396,
6528,
338,
263,
8093,
2106,
4933,
29892,
372,
508,
29915,
29873,
1993,
9322,
8260,
13,
9651,
565,
376,
6377,
297,
9920,
29901,
13,
18884,
1855,
29918,
9006,
353,
9920,
29889,
5451,
703,
29912,
1159,
13,
18884,
9920,
353,
1855,
29918,
9006,
29961,
29900,
29962,
13,
18884,
3523,
353,
29850,
1642,
7122,
29898,
6370,
29918,
9006,
29961,
29896,
29901,
2314,
718,
376,
6377,
718,
3523,
13,
9651,
9920,
353,
9920,
29889,
6506,
703,
9162,
20569,
29871,
396,
3349,
24358,
515,
278,
1899,
13,
9651,
565,
9920,
14352,
29896,
29962,
1275,
26345,
1115,
13,
18884,
9920,
353,
525,
4286,
7122,
29898,
9006,
7503,
29899,
29896,
2314,
13,
18884,
263,
2475,
3873,
353,
5852,
13,
9651,
1683,
29901,
13,
18884,
263,
2475,
3873,
353,
7700,
13,
9651,
736,
23089,
29916,
6255,
29898,
9006,
29892,
3523,
29892,
9332,
29892,
263,
2475,
3873,
29892,
10944,
29892,
25557,
29897,
13,
13,
1678,
822,
9773,
1220,
29898,
1311,
29892,
1196,
1125,
13,
4706,
565,
1583,
17255,
3784,
29918,
20944,
29901,
13,
9651,
1583,
17255,
3784,
29918,
20944,
29889,
1202,
3542,
29898,
1220,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
17255,
5510,
29918,
9040,
29889,
4397,
29898,
1220,
29897,
13,
13,
1678,
822,
4770,
5510,
29898,
1311,
29892,
19696,
29892,
3013,
29918,
6310,
29918,
9012,
29922,
8824,
29892,
437,
29918,
1333,
29918,
17685,
29918,
726,
29922,
8824,
1125,
13,
4706,
1583,
17255,
5510,
29918,
9040,
353,
5159,
13,
4706,
363,
1196,
297,
19696,
29901,
13,
9651,
396,
937,
368,
29892,
17820,
278,
1196,
304,
3349,
24358,
13,
9651,
1661,
303,
374,
2986,
353,
1196,
13,
9651,
1196,
353,
1196,
29889,
17010,
580,
13,
9651,
565,
1661,
303,
374,
2986,
1275,
1196,
470,
1196,
1275,
376,
1115,
13,
18884,
10944,
353,
5124,
13,
18884,
25557,
353,
5124,
13,
9651,
1683,
29901,
13,
18884,
10944,
29892,
25557,
353,
1661,
303,
374,
2986,
29889,
5451,
29898,
1220,
29897,
13,
9651,
396,
1423,
565,
278,
1196,
338,
4069,
13,
9651,
565,
1196,
1275,
376,
1115,
13,
18884,
565,
3013,
29918,
6310,
29918,
9012,
29901,
13,
462,
1678,
1583,
29889,
4397,
1220,
29898,
29931,
403,
29916,
1626,
29898,
5464,
303,
374,
2986,
876,
13,
462,
1678,
1583,
17255,
4230,
29918,
1220,
353,
1583,
17255,
5510,
29918,
9040,
14352,
29896,
29962,
13,
9651,
1683,
29901,
13,
18884,
396,
1286,
1423,
565,
1899,
29892,
3440,
470,
1426,
13,
18884,
565,
1196,
29961,
29900,
29962,
1275,
525,
1966,
2396,
13,
462,
1678,
396,
445,
338,
263,
5683,
29916,
1899,
29892,
6088,
372,
408,
1316,
13,
462,
1678,
5683,
29916,
29918,
6519,
353,
1583,
17255,
4352,
16644,
29898,
1220,
29892,
10944,
29892,
25557,
29897,
13,
462,
1678,
565,
5683,
29916,
29918,
6519,
338,
7700,
29901,
13,
462,
4706,
1053,
10876,
13,
462,
4706,
1596,
703,
29956,
25614,
29901,
6527,
29876,
29915,
29873,
6088,
29186,
1899,
29901,
376,
718,
1196,
29892,
934,
29922,
9675,
29889,
303,
20405,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
565,
5683,
29916,
29918,
6519,
29889,
6519,
29918,
978,
1275,
376,
22978,
1115,
13,
462,
9651,
396,
445,
338,
263,
23089,
29916,
15735,
307,
29892,
451,
263,
23089,
29916,
6255,
13,
462,
9651,
5683,
29916,
29918,
25254,
353,
1583,
17255,
4352,
16644,
15735,
307,
29898,
1220,
29892,
10944,
29892,
25557,
29897,
13,
462,
9651,
1583,
29889,
4397,
1220,
29898,
25694,
29918,
25254,
29897,
13,
462,
4706,
25342,
5683,
29916,
29918,
6519,
29889,
6519,
29918,
978,
1275,
376,
1482,
20944,
1115,
13,
462,
9651,
396,
445,
338,
263,
23089,
29916,
18649,
15735,
307,
29892,
451,
263,
23089,
29916,
6255,
13,
462,
9651,
5683,
29916,
29918,
25254,
353,
1583,
17255,
4352,
16644,
18649,
15735,
307,
29898,
1220,
29892,
10944,
29892,
25557,
29897,
13,
462,
9651,
1583,
29889,
4397,
1220,
29898,
25694,
29918,
25254,
29897,
13,
462,
4706,
25342,
5683,
29916,
29918,
6519,
29889,
6519,
29918,
978,
1275,
376,
463,
1115,
13,
462,
9651,
396,
445,
338,
263,
23089,
29916,
18649,
29892,
451,
263,
23089,
29916,
6255,
13,
462,
9651,
5683,
29916,
29918,
20944,
353,
23089,
29916,
18649,
29898,
25694,
29918,
6519,
29889,
6519,
29918,
6768,
29897,
13,
462,
9651,
1583,
29889,
4397,
1220,
29898,
25694,
29918,
20944,
29897,
13,
462,
9651,
1583,
17255,
3784,
29918,
20944,
353,
1583,
17255,
5510,
29918,
9040,
14352,
29896,
29962,
13,
462,
4706,
25342,
5683,
29916,
29918,
6519,
29889,
6519,
29918,
978,
1275,
376,
355,
1115,
13,
462,
9651,
396,
445,
338,
278,
1095,
310,
263,
23089,
29916,
18649,
29892,
451,
263,
23089,
29916,
6255,
13,
462,
9651,
396,
14402,
29901,
23136,
2768,
23136,
437,
451,
664,
3447,
13,
462,
9651,
1583,
17255,
3784,
29918,
20944,
353,
6213,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
5683,
29916,
29918,
6519,
29889,
5510,
5856,
580,
13,
462,
9651,
1583,
29889,
4397,
1220,
29898,
25694,
29918,
6519,
29897,
13,
18884,
25342,
1196,
29961,
29900,
29962,
1275,
11860,
1115,
13,
462,
1678,
396,
3349,
937,
2931,
515,
1196,
322,
1653,
278,
23089,
29916,
20001,
1203,
13,
462,
1678,
3440,
353,
376,
1642,
7122,
29898,
1220,
29961,
29896,
29901,
14664,
17010,
580,
13,
462,
1678,
565,
451,
437,
29918,
1333,
29918,
17685,
29918,
726,
322,
338,
8758,
29898,
1311,
17255,
4230,
29918,
1220,
29892,
23089,
29916,
20001,
1125,
13,
462,
4706,
396,
1833,
1196,
471,
263,
23089,
29916,
20001,
2086,
29892,
9773,
304,
445,
1203,
13,
462,
4706,
1583,
17255,
4230,
29918,
1220,
29889,
4397,
29898,
9342,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
396,
1653,
716,
23089,
29916,
20001,
1203,
13,
462,
4706,
1583,
29889,
4397,
1220,
29898,
29931,
403,
29916,
20001,
29898,
9342,
29892,
1583,
17255,
430,
29889,
9342,
29918,
13506,
29892,
13,
462,
462,
462,
308,
1583,
17255,
430,
29889,
9342,
29918,
4397,
29918,
13506,
29892,
13,
462,
462,
462,
308,
1583,
17255,
430,
29889,
9342,
29918,
4397,
29918,
2146,
600,
861,
29892,
13,
462,
462,
462,
308,
10944,
29922,
13506,
29892,
25557,
29922,
2146,
600,
861,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
396,
445,
338,
263,
4226,
1426,
1196,
13,
462,
1678,
565,
451,
437,
29918,
1333,
29918,
17685,
29918,
726,
322,
338,
8758,
29898,
1311,
17255,
4230,
29918,
1220,
29892,
23089,
29916,
1626,
1125,
13,
462,
4706,
396,
1833,
1196,
471,
263,
23089,
29916,
1626,
2086,
29892,
9773,
304,
445,
1203,
13,
462,
4706,
1583,
17255,
4230,
29918,
1220,
29889,
4397,
29898,
1220,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
396,
1653,
716,
23089,
29916,
1626,
1203,
13,
462,
4706,
1583,
29889,
4397,
1220,
29898,
29931,
403,
29916,
1626,
29898,
1220,
29892,
1583,
17255,
430,
29889,
726,
29918,
4397,
29918,
13506,
29892,
1583,
17255,
430,
29889,
726,
29918,
4397,
29918,
2146,
600,
861,
29892,
13,
462,
462,
462,
418,
10944,
29922,
13506,
29892,
25557,
29922,
2146,
600,
861,
876,
13,
18884,
1583,
17255,
4230,
29918,
1220,
353,
1583,
17255,
5510,
29918,
9040,
14352,
29896,
29962,
13,
4706,
736,
1583,
17255,
5510,
29918,
9040,
13,
13,
1678,
822,
679,
3591,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
430,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
19696,
29892,
5446,
29922,
8516,
29892,
3013,
29918,
6310,
29918,
9012,
29922,
8824,
29892,
437,
29918,
1333,
29918,
17685,
29918,
726,
29922,
8824,
1125,
13,
4706,
396,
2069,
1833,
29918,
1220,
2286,
13,
4706,
1583,
17255,
4230,
29918,
1220,
353,
6213,
13,
4706,
1583,
17255,
3784,
29918,
20944,
353,
6213,
13,
4706,
1583,
17255,
5510,
29918,
9040,
353,
5159,
13,
13,
4706,
396,
6088,
1842,
964,
4839,
322,
2793,
6835,
13,
4706,
4839,
29892,
2793,
353,
1583,
17255,
5510,
6268,
29898,
4776,
29897,
13,
13,
4706,
396,
6088,
20487,
414,
964,
3618,
13,
4706,
565,
5446,
338,
6213,
29901,
13,
9651,
5446,
353,
23089,
29916,
6268,
580,
13,
4706,
1583,
17255,
430,
353,
5446,
13,
4706,
1583,
17255,
430,
29889,
842,
7850,
29898,
1311,
17255,
5510,
29898,
6672,
29892,
3013,
29918,
6310,
29918,
9012,
29892,
437,
29918,
1333,
29918,
17685,
29918,
726,
876,
13,
4706,
1583,
17255,
430,
29889,
842,
3916,
29898,
1311,
17255,
5510,
29898,
3051,
29892,
3013,
29918,
6310,
29918,
9012,
29892,
437,
29918,
1333,
29918,
17685,
29918,
726,
876,
2
] |
skills/alexa_handler/connector.py | oserikov/dream | 34 | 125434 | <gh_stars>10-100
#!/usr/bin/env python
import time
import asyncio
import logging
from typing import Callable, Dict
import sentry_sdk
from os import getenv
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
logger = logging.getLogger(__name__)
sentry_sdk.init(getenv("SENTRY_DSN"))
class AlexaHandlerConnector:
async def send(self, payload: Dict, callback: Callable):
try:
st_time = time.time()
text = payload["payload"]["sentences"][0]
assert "/alexa_" in text
cands = ["alexa handler: command logged"]
confs = [1.0]
attrs = [{}]
total_time = time.time() - st_time
logger.info(f"alexa_handler_skill exec time: {total_time:.3f}s")
asyncio.create_task(callback(task_id=payload["task_id"], response=[cands, confs, attrs]))
except Exception as e:
logger.exception(e)
sentry_sdk.capture_exception(e)
asyncio.create_task(callback(task_id=payload["task_id"], response=e))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
931,
13,
5215,
408,
948,
3934,
13,
5215,
12183,
13,
3166,
19229,
1053,
8251,
519,
29892,
360,
919,
13,
5215,
2665,
719,
29918,
15348,
13,
3166,
2897,
1053,
679,
6272,
13,
13,
13,
21027,
29889,
16121,
3991,
29898,
4830,
543,
29995,
29898,
294,
312,
603,
29897,
29879,
448,
1273,
29898,
978,
29897,
29879,
448,
1273,
29898,
5563,
978,
29897,
29879,
448,
1273,
29898,
4906,
29897,
29879,
613,
3233,
29922,
21027,
29889,
11690,
29897,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
29879,
8269,
29918,
15348,
29889,
2344,
29898,
657,
6272,
703,
29903,
3919,
13207,
29918,
8452,
29940,
5783,
13,
13,
13,
1990,
4827,
29874,
4598,
20971,
2801,
29901,
13,
1678,
7465,
822,
3638,
29898,
1311,
29892,
20092,
29901,
360,
919,
29892,
6939,
29901,
8251,
519,
1125,
13,
4706,
1018,
29901,
13,
9651,
380,
29918,
2230,
353,
931,
29889,
2230,
580,
13,
9651,
1426,
353,
20092,
3366,
23813,
3108,
3366,
18616,
2063,
3108,
29961,
29900,
29962,
13,
9651,
4974,
5591,
744,
17367,
27508,
297,
1426,
13,
13,
9651,
274,
4167,
353,
6796,
744,
17367,
7834,
29901,
1899,
13817,
3108,
13,
9651,
1970,
29879,
353,
518,
29896,
29889,
29900,
29962,
13,
9651,
12421,
29879,
353,
15974,
6525,
13,
13,
9651,
3001,
29918,
2230,
353,
931,
29889,
2230,
580,
448,
380,
29918,
2230,
13,
9651,
17927,
29889,
3888,
29898,
29888,
29908,
744,
17367,
29918,
13789,
29918,
808,
453,
2279,
931,
29901,
426,
7827,
29918,
2230,
29901,
29889,
29941,
29888,
29913,
29879,
1159,
13,
9651,
408,
948,
3934,
29889,
3258,
29918,
7662,
29898,
14035,
29898,
7662,
29918,
333,
29922,
23813,
3366,
7662,
29918,
333,
12436,
2933,
11759,
29883,
4167,
29892,
1970,
29879,
29892,
12421,
29879,
12622,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
17927,
29889,
11739,
29898,
29872,
29897,
13,
9651,
2665,
719,
29918,
15348,
29889,
17885,
545,
29918,
11739,
29898,
29872,
29897,
13,
9651,
408,
948,
3934,
29889,
3258,
29918,
7662,
29898,
14035,
29898,
7662,
29918,
333,
29922,
23813,
3366,
7662,
29918,
333,
12436,
2933,
29922,
29872,
876,
13,
2
] |
experiment/exp/00_data_traversal/run.py | neonkitchen/disent | 0 | 79927 | <filename>experiment/exp/00_data_traversal/run.py<gh_stars>0
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
# MIT License
#
# Copyright (c) 2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
import os
from typing import Union
import numpy as np
from matplotlib import pyplot as plt
import experiment.exp.util as H
from disent.data.groundtruth import Cars3dData
from disent.data.groundtruth import DSpritesData
from disent.data.groundtruth import GroundTruthData
from disent.data.groundtruth import Shapes3dData
from disent.data.groundtruth import SmallNorbData
from disent.data.groundtruth import XYSquaresData
from disent.dataset.groundtruth import GroundTruthDataset
from disent.util import TempNumpySeed
# ========================================================================= #
# core #
# ========================================================================= #
def plot_dataset_traversals(
gt_data: Union[GroundTruthData, GroundTruthDataset],
f_idxs=None,
num_cols=8,
base_factors=None,
add_random_traversal=True,
pad=8,
bg_color=127,
border=False,
rel_path=None,
save=True,
seed=777,
plt_scale=4.5,
offset=0.75
):
if not isinstance(gt_data, GroundTruthDataset):
gt_data = GroundTruthDataset(gt_data)
f_idxs = H.get_factor_idxs(gt_data, f_idxs)
# get traversal grid
row_labels = [gt_data.factor_names[i] for i in f_idxs]
grid = H.dataset_traversal_tasks(
gt_data=gt_data,
tasks='grid',
data_mode='raw',
factor_names=f_idxs,
num=num_cols,
seed=seed,
base_factors=base_factors,
traverse_mode='interval',
pad=pad,
bg_color=bg_color,
border=border,
)
# add random traversal
if add_random_traversal:
with TempNumpySeed(seed):
row_labels = ['random'] + row_labels
grid = np.concatenate([
gt_data.dataset_sample_batch(num_samples=num_cols, mode='raw')[None, ...],
grid
])
# add missing channel
if grid.ndim == 4:
grid = grid[..., None].repeat(3, axis=-1)
assert grid.ndim == 5
# make figure
h, w, _, _, c = grid.shape
assert c == 3
fig, axs = H.plt_subplots_imshow(grid, row_labels=row_labels, subplot_padding=0.5, figsize=(offset + (1/2.54)*w*plt_scale, (1/2.54)*h*plt_scale))
# save figure
if save and (rel_path is not None):
plt.savefig(H.make_rel_path_add_ext(rel_path, ext='.png'))
plt.show()
# done!
return fig, axs
# ========================================================================= #
# entrypoint #
# ========================================================================= #
if __name__ == '__main__':
# matplotlib style
plt.style.use(os.path.join(os.path.dirname(__file__), '../gadfly.mplstyle'))
# options
all_squares = True
add_random_traversal = True
num_cols = 7
# save image
for i in ([1, 2, 3, 4, 5, 6, 7, 8] if all_squares else [1, 8]):
plot_dataset_traversals(
XYSquaresData(grid_spacing=i, max_placements=8, no_warnings=True),
rel_path=f'plots/xy-squares-traversal-spacing{i}',
seed=7, add_random_traversal=add_random_traversal, num_cols=num_cols
)
plot_dataset_traversals(
Shapes3dData(),
rel_path=f'plots/shapes3d-traversal',
seed=47, add_random_traversal=add_random_traversal, num_cols=num_cols
)
plot_dataset_traversals(
DSpritesData(),
rel_path=f'plots/dsprites-traversal',
seed=47, add_random_traversal=add_random_traversal, num_cols=num_cols
)
plot_dataset_traversals(
SmallNorbData(),
rel_path=f'plots/smallnorb-traversal',
seed=47, add_random_traversal=add_random_traversal, num_cols=num_cols
)
plot_dataset_traversals(
Cars3dData(),
rel_path=f'plots/cars3d-traversal',
seed=47, add_random_traversal=add_random_traversal, num_cols=num_cols
)
# ========================================================================= #
# END #
# ========================================================================= #
| [
1,
529,
9507,
29958,
735,
15362,
29914,
4548,
29914,
29900,
29900,
29918,
1272,
29918,
3018,
874,
284,
29914,
3389,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
29871,
3695,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
13,
29937,
29871,
341,
1806,
19245,
13,
29937,
13,
29937,
29871,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29896,
529,
5813,
29958,
13,
29937,
13,
29937,
29871,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
29871,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
29871,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
29871,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
29871,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
29871,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
29871,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
13,
29937,
29871,
599,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
29871,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
29871,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
29871,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
29871,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
29937,
29871,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
29937,
29871,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
29937,
29871,
7791,
7818,
12982,
1525,
29889,
13,
29937,
29871,
3695,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
29922,
30022,
13,
13,
5215,
2897,
13,
3166,
19229,
1053,
7761,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
22889,
1053,
11451,
5317,
408,
14770,
13,
13,
5215,
7639,
29889,
4548,
29889,
4422,
408,
379,
13,
3166,
766,
296,
29889,
1272,
29889,
2057,
509,
2806,
1053,
315,
1503,
29941,
29881,
1469,
13,
3166,
766,
296,
29889,
1272,
29889,
2057,
509,
2806,
1053,
360,
29903,
558,
3246,
1469,
13,
3166,
766,
296,
29889,
1272,
29889,
2057,
509,
2806,
1053,
1632,
618,
2308,
2806,
1469,
13,
3166,
766,
296,
29889,
1272,
29889,
2057,
509,
2806,
1053,
1383,
11603,
29941,
29881,
1469,
13,
3166,
766,
296,
29889,
1272,
29889,
2057,
509,
2806,
1053,
18285,
29940,
11831,
1469,
13,
3166,
766,
296,
29889,
1272,
29889,
2057,
509,
2806,
1053,
1060,
21554,
339,
5114,
1469,
13,
3166,
766,
296,
29889,
24713,
29889,
2057,
509,
2806,
1053,
1632,
618,
2308,
2806,
16390,
24541,
13,
3166,
766,
296,
29889,
4422,
1053,
21121,
8009,
2272,
2008,
287,
13,
13,
13,
29937,
1275,
9166,
9166,
9166,
9166,
2751,
25512,
396,
13,
29937,
7136,
462,
462,
462,
462,
418,
396,
13,
29937,
1275,
9166,
9166,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
1753,
6492,
29918,
24713,
29918,
3018,
874,
1338,
29898,
13,
1678,
330,
29873,
29918,
1272,
29901,
7761,
29961,
3338,
618,
2308,
2806,
1469,
29892,
1632,
618,
2308,
2806,
16390,
24541,
1402,
13,
1678,
285,
29918,
333,
10351,
29922,
8516,
29892,
13,
1678,
954,
29918,
22724,
29922,
29947,
29892,
13,
1678,
2967,
29918,
17028,
943,
29922,
8516,
29892,
13,
1678,
788,
29918,
8172,
29918,
3018,
874,
284,
29922,
5574,
29892,
13,
1678,
17132,
29922,
29947,
29892,
13,
1678,
25989,
29918,
2780,
29922,
29896,
29906,
29955,
29892,
13,
1678,
5139,
29922,
8824,
29892,
13,
1678,
1104,
29918,
2084,
29922,
8516,
29892,
13,
1678,
4078,
29922,
5574,
29892,
13,
1678,
16717,
29922,
29955,
29955,
29955,
29892,
13,
1678,
14770,
29918,
7052,
29922,
29946,
29889,
29945,
29892,
13,
1678,
9210,
29922,
29900,
29889,
29955,
29945,
13,
1125,
13,
1678,
565,
451,
338,
8758,
29898,
4141,
29918,
1272,
29892,
1632,
618,
2308,
2806,
16390,
24541,
1125,
13,
4706,
330,
29873,
29918,
1272,
353,
1632,
618,
2308,
2806,
16390,
24541,
29898,
4141,
29918,
1272,
29897,
13,
1678,
285,
29918,
333,
10351,
353,
379,
29889,
657,
29918,
19790,
29918,
333,
10351,
29898,
4141,
29918,
1272,
29892,
285,
29918,
333,
10351,
29897,
13,
1678,
396,
679,
13310,
284,
6856,
13,
1678,
1948,
29918,
21134,
353,
518,
4141,
29918,
1272,
29889,
19790,
29918,
7039,
29961,
29875,
29962,
363,
474,
297,
285,
29918,
333,
10351,
29962,
13,
1678,
6856,
353,
379,
29889,
24713,
29918,
3018,
874,
284,
29918,
20673,
29898,
13,
4706,
330,
29873,
29918,
1272,
29922,
4141,
29918,
1272,
29892,
13,
4706,
9595,
2433,
7720,
742,
13,
4706,
848,
29918,
8513,
2433,
1610,
742,
13,
4706,
7329,
29918,
7039,
29922,
29888,
29918,
333,
10351,
29892,
13,
4706,
954,
29922,
1949,
29918,
22724,
29892,
13,
4706,
16717,
29922,
26776,
29892,
13,
4706,
2967,
29918,
17028,
943,
29922,
3188,
29918,
17028,
943,
29892,
13,
4706,
29370,
29918,
8513,
2433,
19207,
742,
13,
4706,
17132,
29922,
8305,
29892,
13,
4706,
25989,
29918,
2780,
29922,
16264,
29918,
2780,
29892,
13,
4706,
5139,
29922,
11466,
29892,
13,
1678,
1723,
13,
1678,
396,
788,
4036,
13310,
284,
13,
1678,
565,
788,
29918,
8172,
29918,
3018,
874,
284,
29901,
13,
4706,
411,
21121,
8009,
2272,
2008,
287,
29898,
26776,
1125,
13,
9651,
1948,
29918,
21134,
353,
6024,
8172,
2033,
718,
1948,
29918,
21134,
13,
9651,
6856,
353,
7442,
29889,
535,
29883,
2579,
403,
4197,
13,
18884,
330,
29873,
29918,
1272,
29889,
24713,
29918,
11249,
29918,
16175,
29898,
1949,
29918,
27736,
29922,
1949,
29918,
22724,
29892,
4464,
2433,
1610,
29861,
8516,
29892,
2023,
1402,
13,
18884,
6856,
13,
632,
2314,
13,
1678,
396,
788,
4567,
8242,
13,
1678,
565,
6856,
29889,
299,
326,
1275,
29871,
29946,
29901,
13,
4706,
6856,
353,
6856,
29961,
16361,
6213,
1822,
14358,
29898,
29941,
29892,
9685,
10457,
29896,
29897,
13,
1678,
4974,
6856,
29889,
299,
326,
1275,
29871,
29945,
13,
1678,
396,
1207,
4377,
13,
1678,
298,
29892,
281,
29892,
17117,
17117,
274,
353,
6856,
29889,
12181,
13,
1678,
4974,
274,
1275,
29871,
29941,
13,
1678,
2537,
29892,
4853,
29879,
353,
379,
29889,
572,
29873,
29918,
1491,
26762,
29918,
326,
4294,
29898,
7720,
29892,
1948,
29918,
21134,
29922,
798,
29918,
21134,
29892,
1014,
5317,
29918,
12791,
29922,
29900,
29889,
29945,
29892,
2537,
2311,
7607,
10289,
718,
313,
29896,
29914,
29906,
29889,
29945,
29946,
11877,
29893,
29930,
572,
29873,
29918,
7052,
29892,
313,
29896,
29914,
29906,
29889,
29945,
29946,
11877,
29882,
29930,
572,
29873,
29918,
7052,
876,
13,
1678,
396,
4078,
4377,
13,
1678,
565,
4078,
322,
313,
2674,
29918,
2084,
338,
451,
6213,
1125,
13,
4706,
14770,
29889,
7620,
1003,
29898,
29950,
29889,
5675,
29918,
2674,
29918,
2084,
29918,
1202,
29918,
1062,
29898,
2674,
29918,
2084,
29892,
1294,
2433,
29889,
2732,
8785,
13,
1678,
14770,
29889,
4294,
580,
13,
1678,
396,
2309,
29991,
13,
1678,
736,
2537,
29892,
4853,
29879,
13,
13,
13,
29937,
1275,
9166,
9166,
9166,
9166,
2751,
25512,
396,
13,
29937,
6251,
3149,
462,
462,
462,
18884,
396,
13,
29937,
1275,
9166,
9166,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
396,
22889,
3114,
13,
1678,
14770,
29889,
3293,
29889,
1509,
29898,
359,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
525,
6995,
29887,
328,
17652,
29889,
29885,
572,
3293,
8785,
13,
13,
1678,
396,
3987,
13,
1678,
599,
29918,
26613,
5114,
353,
5852,
13,
1678,
788,
29918,
8172,
29918,
3018,
874,
284,
353,
5852,
13,
1678,
954,
29918,
22724,
353,
29871,
29955,
13,
13,
1678,
396,
4078,
1967,
13,
1678,
363,
474,
297,
9310,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29892,
29871,
29955,
29892,
29871,
29947,
29962,
565,
599,
29918,
26613,
5114,
1683,
518,
29896,
29892,
29871,
29947,
29962,
1125,
13,
4706,
6492,
29918,
24713,
29918,
3018,
874,
1338,
29898,
13,
9651,
1060,
21554,
339,
5114,
1469,
29898,
7720,
29918,
1028,
9390,
29922,
29875,
29892,
4236,
29918,
29886,
4620,
4110,
29922,
29947,
29892,
694,
29918,
25442,
886,
29922,
5574,
511,
13,
9651,
1104,
29918,
2084,
29922,
29888,
29915,
26762,
29914,
3594,
29899,
26613,
5114,
29899,
3018,
874,
284,
29899,
1028,
9390,
29912,
29875,
29913,
742,
13,
9651,
16717,
29922,
29955,
29892,
788,
29918,
8172,
29918,
3018,
874,
284,
29922,
1202,
29918,
8172,
29918,
3018,
874,
284,
29892,
954,
29918,
22724,
29922,
1949,
29918,
22724,
13,
4706,
1723,
13,
13,
1678,
6492,
29918,
24713,
29918,
3018,
874,
1338,
29898,
13,
4706,
1383,
11603,
29941,
29881,
1469,
3285,
13,
4706,
1104,
29918,
2084,
29922,
29888,
29915,
26762,
29914,
845,
11603,
29941,
29881,
29899,
3018,
874,
284,
742,
13,
4706,
16717,
29922,
29946,
29955,
29892,
788,
29918,
8172,
29918,
3018,
874,
284,
29922,
1202,
29918,
8172,
29918,
3018,
874,
284,
29892,
954,
29918,
22724,
29922,
1949,
29918,
22724,
13,
1678,
1723,
13,
13,
1678,
6492,
29918,
24713,
29918,
3018,
874,
1338,
29898,
13,
4706,
360,
29903,
558,
3246,
1469,
3285,
13,
4706,
1104,
29918,
2084,
29922,
29888,
29915,
26762,
29914,
6289,
558,
3246,
29899,
3018,
874,
284,
742,
13,
4706,
16717,
29922,
29946,
29955,
29892,
788,
29918,
8172,
29918,
3018,
874,
284,
29922,
1202,
29918,
8172,
29918,
3018,
874,
284,
29892,
954,
29918,
22724,
29922,
1949,
29918,
22724,
13,
1678,
1723,
13,
13,
1678,
6492,
29918,
24713,
29918,
3018,
874,
1338,
29898,
13,
4706,
18285,
29940,
11831,
1469,
3285,
13,
4706,
1104,
29918,
2084,
29922,
29888,
29915,
26762,
29914,
9278,
29876,
11831,
29899,
3018,
874,
284,
742,
13,
4706,
16717,
29922,
29946,
29955,
29892,
788,
29918,
8172,
29918,
3018,
874,
284,
29922,
1202,
29918,
8172,
29918,
3018,
874,
284,
29892,
954,
29918,
22724,
29922,
1949,
29918,
22724,
13,
1678,
1723,
13,
13,
1678,
6492,
29918,
24713,
29918,
3018,
874,
1338,
29898,
13,
4706,
315,
1503,
29941,
29881,
1469,
3285,
13,
4706,
1104,
29918,
2084,
29922,
29888,
29915,
26762,
29914,
29883,
1503,
29941,
29881,
29899,
3018,
874,
284,
742,
13,
4706,
16717,
29922,
29946,
29955,
29892,
788,
29918,
8172,
29918,
3018,
874,
284,
29922,
1202,
29918,
8172,
29918,
3018,
874,
284,
29892,
954,
29918,
22724,
29922,
1949,
29918,
22724,
13,
1678,
1723,
13,
13,
13,
29937,
1275,
9166,
9166,
9166,
9166,
2751,
25512,
396,
13,
29937,
11056,
462,
462,
462,
462,
539,
396,
13,
29937,
1275,
9166,
9166,
9166,
9166,
2751,
25512,
396,
13,
13,
13,
2
] |
docs/podstawy/przyklady/ocenyfun.py | damiankarol7/python101 | 44 | 26441 | <filename>docs/podstawy/przyklady/ocenyfun.py
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Moduł ocenyfun zawiera funkcje wykorzystywane w pliku 05_oceny_03.py
"""
import math # zaimportuj moduł matematyczny
def drukuj(co, kom="Sekwencja zawiera: "):
print(kom)
for i in co:
print(i, end=" ")
def srednia(oceny):
suma = sum(oceny)
return suma / float(len(oceny))
def mediana(oceny):
"""
Jeżeli ilość ocen jest parzysta, medianą jest średnia arytmetyczna
dwóch środkowych ocen. Jesli ilość jest nieparzysta mediana równa
się elementowi środkowemu ouporządkowanej rosnąco listy ocen.
"""
oceny.sort()
if len(oceny) % 2 == 0: # parzysta ilość ocen
half = int(len(oceny) / 2)
# można tak:
# return float(oceny[half-1]+oceny[half]) / 2.0
# albo tak:
return float(sum(oceny[half - 1:half + 1])) / 2.0
else: # nieparzysta ilość ocen
return oceny[len(oceny) / 2]
def wariancja(oceny, srednia):
"""
Wariancja to suma kwadratów różnicy każdej oceny i średniej
podzielona przez ilość ocen:
sigma = (o1-s)+(o2-s)+...+(on-s) / n, gdzie:
o1, o2, ..., on - kolejne oceny,
s - średnia ocen,
n - liczba ocen.
"""
sigma = 0.0
for ocena in oceny:
sigma += (ocena - srednia)**2
return sigma / len(oceny)
def odchylenie(oceny, srednia): # pierwiastek kwadratowy z wariancji
w = wariancja(oceny, srednia)
return math.sqrt(w)
| [
1,
529,
9507,
29958,
2640,
29914,
15334,
14665,
29891,
29914,
558,
1537,
6321,
3714,
29914,
542,
15274,
7692,
29889,
2272,
13,
29937,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
15945,
29908,
13,
1678,
3382,
29884,
30006,
288,
10278,
29891,
7692,
15098,
8311,
25357,
1324,
5018,
13123,
25759,
5693,
1662,
281,
282,
492,
2120,
29871,
29900,
29945,
29918,
542,
15274,
29918,
29900,
29941,
29889,
2272,
13,
15945,
29908,
13,
13,
5215,
5844,
29871,
396,
4022,
5215,
8016,
878,
29884,
30006,
1775,
4579,
6955,
1460,
13,
13,
13,
1753,
5883,
2120,
29926,
29898,
1111,
29892,
4677,
543,
29903,
1416,
29893,
3977,
1764,
15098,
8311,
29901,
376,
1125,
13,
1678,
1596,
29898,
7218,
29897,
13,
1678,
363,
474,
297,
1302,
29901,
13,
4706,
1596,
29898,
29875,
29892,
1095,
543,
16521,
13,
13,
13,
1753,
269,
1127,
3915,
29898,
542,
15274,
1125,
13,
1678,
2533,
29874,
353,
2533,
29898,
542,
15274,
29897,
13,
1678,
736,
2533,
29874,
847,
5785,
29898,
2435,
29898,
542,
15274,
876,
13,
13,
13,
1753,
1612,
3857,
29898,
542,
15274,
1125,
13,
1678,
9995,
13,
1678,
2581,
30042,
5037,
980,
29877,
6598,
288,
10278,
6771,
610,
25759,
29874,
29892,
19194,
30025,
6771,
6192,
1127,
3915,
564,
3637,
2527,
6955,
1056,
13,
1678,
11988,
29980,
305,
6192,
5964,
7000,
3376,
288,
10278,
29889,
8524,
492,
980,
29877,
6598,
29871,
6771,
4930,
862,
25759,
29874,
1612,
3857,
364,
2165,
1056,
13,
1678,
3701,
1543,
13447,
6192,
5964,
7000,
24425,
29871,
1132,
272,
17527,
7000,
1662,
29926,
14652,
12486,
1111,
1051,
29891,
288,
10278,
29889,
13,
1678,
9995,
13,
1678,
288,
10278,
29891,
29889,
6605,
580,
13,
1678,
565,
7431,
29898,
542,
15274,
29897,
1273,
29871,
29906,
1275,
29871,
29900,
29901,
29871,
396,
610,
25759,
29874,
980,
29877,
6598,
288,
10278,
13,
4706,
4203,
353,
938,
29898,
2435,
29898,
542,
15274,
29897,
847,
29871,
29906,
29897,
13,
4706,
396,
27941,
1056,
1850,
29901,
13,
4706,
396,
736,
5785,
29898,
542,
15274,
29961,
24498,
29899,
29896,
10062,
542,
15274,
29961,
24498,
2314,
847,
29871,
29906,
29889,
29900,
13,
4706,
396,
394,
833,
1850,
29901,
13,
4706,
736,
5785,
29898,
2083,
29898,
542,
15274,
29961,
24498,
448,
29871,
29896,
29901,
24498,
718,
29871,
29896,
12622,
847,
29871,
29906,
29889,
29900,
13,
1678,
1683,
29901,
29871,
396,
4930,
862,
25759,
29874,
980,
29877,
6598,
288,
10278,
13,
4706,
736,
288,
10278,
29891,
29961,
2435,
29898,
542,
15274,
29897,
847,
29871,
29906,
29962,
13,
13,
13,
1753,
1370,
713,
29883,
1764,
29898,
542,
15274,
29892,
269,
1127,
3915,
1125,
13,
1678,
9995,
13,
1678,
3362,
713,
29883,
1764,
304,
2533,
29874,
9049,
16181,
2165,
28801,
29876,
4245,
13560,
30042,
311,
29926,
288,
10278,
29891,
474,
6192,
1127,
12532,
13,
1678,
2532,
17894,
2681,
7559,
980,
29877,
6598,
288,
10278,
29901,
13,
1678,
269,
2934,
353,
313,
29877,
29896,
29899,
29879,
7240,
29898,
29877,
29906,
29899,
29879,
7240,
856,
17108,
265,
29899,
29879,
29897,
847,
302,
29892,
23104,
29901,
13,
1678,
288,
29896,
29892,
288,
29906,
29892,
2023,
29892,
373,
448,
20236,
484,
288,
10278,
29891,
29892,
13,
1678,
269,
448,
6192,
1127,
3915,
288,
10278,
29892,
13,
1678,
302,
448,
23022,
2291,
288,
10278,
29889,
13,
1678,
9995,
13,
1678,
269,
2934,
353,
29871,
29900,
29889,
29900,
13,
1678,
363,
12954,
2386,
297,
288,
10278,
29891,
29901,
13,
4706,
269,
2934,
4619,
313,
542,
2386,
448,
269,
1127,
3915,
29897,
1068,
29906,
13,
1678,
736,
269,
2934,
847,
7431,
29898,
542,
15274,
29897,
13,
13,
13,
1753,
2413,
23766,
2435,
347,
29898,
542,
15274,
29892,
269,
1127,
3915,
1125,
29871,
396,
26657,
3173,
12681,
9049,
16181,
8268,
503,
1370,
713,
17624,
13,
1678,
281,
353,
1370,
713,
29883,
1764,
29898,
542,
15274,
29892,
269,
1127,
3915,
29897,
13,
1678,
736,
5844,
29889,
3676,
29898,
29893,
29897,
13,
2
] |
old/unitesting.py | jverbraeken/dtw-test | 0 | 92946 | <filename>old/unitesting.py
#! /usr/bin/env python
import sys
sys.path.append("..")
sys.path.append(".")
import time
import dtw
from data.syntheticdata import *
ok = True
print "Please wait a few minutes..."
n=10
querydataset = [randomwalk(n) for i in range(100)]
trainingdataset = [randomwalk(n) for i in range(1000)]
reducdim = 10
for reducdim in [10,5]:
for c in [0,1,2]:
rtree=dtw.TimeSeriesTree("mytmpfile.bin",c,reducdim)
for x in trainingdataset:
rtree.add(x)
for i in range(len(trainingdataset)):
readcopy = rtree.readTimeSeries(i)
for j in range(n):
if(abs(readcopy[j]-trainingdataset[i][j])>0.00001):
print "possible bug!"
break
for x in querydataset:
treesolution = rtree.getNearestNeighborCost(x,rtree.NAIVE)
golden = dtw.LB_Keogh(x,c)
golden2 = dtw.LB_Improved(x,c)
golden3 = dtw.DimReducedLB_Keogh(x,c,reducdim)
for z in trainingdataset:
golden.test(z)
golden2.test(z)
golden3.test(z)
if((treesolution <> golden.getLowestCost()) or (treesolution <> golden2.getLowestCost()) or (treesolution <> golden3.getLowestCost())) :
print treesolution, golden.getLowestCost(),golden2.getLowestCost(),golden3.getLowestCost()
print "BUG!!!"
ok = False
break
rtree.close()
rtree=dtw.TimeSeriesTree("mytmpfile.bin")
for x in trainingdataset:
rtree.add(x)
for i in range(len(trainingdataset)):
readcopy = rtree.readTimeSeries(i)
for j in range(n):
if(abs(readcopy[j]-trainingdataset[i][j])>0.00001):
print "possible bug!"
break
rtree.close()
for c in [0,1,2]:
print c
lb1 = [dtw.LB_Keogh(x,c) for x in querydataset]
lb2 = [dtw.LB_Improved(x,c) for x in querydataset]
for x in trainingdataset:
for i in range(len(lb1)):
lb1[i].test(x)
lb2[i].test(x)
if(lb1[i].getLowestCost()<>lb2[i].getLowestCost()):
print "Possible BUG = ", lb1[i].getLowestCost(),lb2[i].getLowestCost()
ok = False
break
if(ok):
print "your code checks out"
else:
print "you appear to have a bug" | [
1,
529,
9507,
29958,
1025,
29914,
5441,
342,
292,
29889,
2272,
13,
29937,
29991,
847,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
10876,
13,
9675,
29889,
2084,
29889,
4397,
703,
636,
1159,
13,
9675,
29889,
2084,
29889,
4397,
17350,
1159,
13,
5215,
931,
13,
5215,
270,
7516,
13,
3166,
848,
29889,
19274,
386,
7492,
1272,
1053,
334,
29871,
13,
13,
554,
353,
5852,
13,
13,
2158,
376,
12148,
4480,
263,
2846,
6233,
17794,
13,
29876,
29922,
29896,
29900,
13,
1972,
24713,
353,
518,
8172,
20919,
29898,
29876,
29897,
29871,
363,
474,
297,
3464,
29898,
29896,
29900,
29900,
4638,
13,
26495,
24713,
353,
518,
8172,
20919,
29898,
29876,
29897,
29871,
363,
474,
297,
3464,
29898,
29896,
29900,
29900,
29900,
4638,
13,
13,
9313,
2252,
326,
353,
29871,
29896,
29900,
13,
1454,
3724,
2252,
326,
297,
518,
29896,
29900,
29892,
29945,
5387,
13,
363,
274,
297,
518,
29900,
29892,
29896,
29892,
29906,
5387,
13,
12,
2273,
929,
29922,
6008,
29893,
29889,
2481,
19204,
9643,
703,
1357,
7050,
1445,
29889,
2109,
613,
29883,
29892,
9313,
2252,
326,
29897,
13,
12,
1454,
921,
297,
6694,
24713,
29901,
13,
12,
29871,
364,
8336,
29889,
1202,
29898,
29916,
29897,
13,
12,
1454,
474,
297,
3464,
29898,
2435,
29898,
26495,
24713,
22164,
13,
12,
29871,
1303,
8552,
353,
364,
8336,
29889,
949,
2481,
19204,
29898,
29875,
29897,
13,
12,
29871,
363,
432,
297,
3464,
29898,
29876,
1125,
13,
12,
1678,
565,
29898,
6897,
29898,
949,
8552,
29961,
29926,
29962,
29899,
26495,
24713,
29961,
29875,
3816,
29926,
2314,
29958,
29900,
29889,
29900,
29900,
29900,
29900,
29896,
1125,
13,
12,
418,
1596,
376,
27338,
6494,
3850,
13,
12,
418,
2867,
13,
12,
1454,
921,
297,
2346,
24713,
29901,
13,
12,
29871,
10697,
324,
918,
353,
364,
8336,
29889,
657,
29940,
799,
342,
8139,
1141,
4089,
25733,
29898,
29916,
29892,
2273,
929,
29889,
3521,
18474,
29897,
13,
12,
29871,
22843,
353,
270,
7516,
29889,
29931,
29933,
29918,
9598,
468,
29882,
29898,
29916,
29892,
29883,
29897,
13,
12,
29871,
22843,
29906,
353,
270,
7516,
29889,
29931,
29933,
29918,
1888,
771,
1490,
29898,
29916,
29892,
29883,
29897,
13,
12,
29871,
22843,
29941,
353,
270,
7516,
29889,
16142,
29934,
6085,
1133,
29931,
29933,
29918,
9598,
468,
29882,
29898,
29916,
29892,
29883,
29892,
9313,
2252,
326,
29897,
13,
12,
29871,
363,
503,
297,
6694,
24713,
29901,
13,
12,
1678,
22843,
29889,
1688,
29898,
29920,
29897,
13,
12,
1678,
22843,
29906,
29889,
1688,
29898,
29920,
29897,
13,
12,
1678,
22843,
29941,
29889,
1688,
29898,
29920,
29897,
13,
12,
29871,
565,
3552,
28737,
324,
918,
15271,
22843,
29889,
657,
29931,
340,
342,
25733,
3101,
470,
313,
28737,
324,
918,
15271,
22843,
29906,
29889,
657,
29931,
340,
342,
25733,
3101,
470,
313,
28737,
324,
918,
15271,
22843,
29941,
29889,
657,
29931,
340,
342,
25733,
22130,
584,
29871,
13,
12,
1678,
1596,
10697,
324,
918,
29892,
22843,
29889,
657,
29931,
340,
342,
25733,
3285,
29887,
1025,
264,
29906,
29889,
657,
29931,
340,
342,
25733,
3285,
29887,
1025,
264,
29941,
29889,
657,
29931,
340,
342,
25733,
580,
13,
12,
1678,
1596,
376,
11578,
6824,
3850,
13,
12,
1678,
3431,
353,
7700,
13,
12,
1678,
2867,
13,
12,
2273,
929,
29889,
5358,
580,
13,
2273,
929,
29922,
6008,
29893,
29889,
2481,
19204,
9643,
703,
1357,
7050,
1445,
29889,
2109,
1159,
13,
1454,
921,
297,
6694,
24713,
29901,
13,
12,
29871,
364,
8336,
29889,
1202,
29898,
29916,
29897,
13,
1454,
474,
297,
3464,
29898,
2435,
29898,
26495,
24713,
22164,
13,
12,
29871,
1303,
8552,
353,
364,
8336,
29889,
949,
2481,
19204,
29898,
29875,
29897,
13,
12,
29871,
363,
432,
297,
3464,
29898,
29876,
1125,
13,
12,
1678,
565,
29898,
6897,
29898,
949,
8552,
29961,
29926,
29962,
29899,
26495,
24713,
29961,
29875,
3816,
29926,
2314,
29958,
29900,
29889,
29900,
29900,
29900,
29900,
29896,
1125,
13,
12,
418,
1596,
376,
27338,
6494,
3850,
13,
12,
418,
2867,
13,
2273,
929,
29889,
5358,
580,
13,
13,
1454,
274,
297,
518,
29900,
29892,
29896,
29892,
29906,
5387,
13,
29871,
1596,
274,
13,
29871,
27981,
29896,
29871,
353,
518,
6008,
29893,
29889,
29931,
29933,
29918,
9598,
468,
29882,
29898,
29916,
29892,
29883,
29897,
29871,
363,
921,
297,
2346,
24713,
29962,
13,
29871,
27981,
29906,
29871,
353,
518,
6008,
29893,
29889,
29931,
29933,
29918,
1888,
771,
1490,
29898,
29916,
29892,
29883,
29897,
29871,
363,
921,
297,
2346,
24713,
29962,
13,
29871,
363,
921,
297,
6694,
24713,
29901,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
27728,
29896,
22164,
13,
268,
27981,
29896,
29961,
29875,
1822,
1688,
29898,
29916,
29897,
13,
268,
27981,
29906,
29961,
29875,
1822,
1688,
29898,
29916,
29897,
13,
268,
565,
29898,
27728,
29896,
29961,
29875,
1822,
657,
29931,
340,
342,
25733,
580,
25299,
27728,
29906,
29961,
29875,
1822,
657,
29931,
340,
342,
25733,
580,
1125,
13,
418,
1596,
376,
9135,
1687,
350,
23338,
353,
9162,
27981,
29896,
29961,
29875,
1822,
657,
29931,
340,
342,
25733,
3285,
27728,
29906,
29961,
29875,
1822,
657,
29931,
340,
342,
25733,
580,
13,
418,
3431,
353,
7700,
13,
418,
2867,
13,
361,
29898,
554,
1125,
13,
29871,
1596,
376,
8066,
775,
12747,
714,
29908,
13,
2870,
29901,
13,
29871,
1596,
376,
6293,
2615,
304,
505,
263,
6494,
29908,
2
] |
bili_kits/api/user.py | LonelySteve/Bili-Kits | 0 | 49295 | <gh_stars>0
from . import _BASE_WEB_INTERFACE,_BASE_API_BILIBILI_COM_X,_BASE_API_BILIBILI_COM,_BASE_API_BILIBILI_COM_X_V2
CARD="%s/card" % _BASE_WEB_INTERFACE
NAV="%s/nav" % _BASE_WEB_INTERFACE
RELATION_STAT="%s/relation/stat" % _BASE_API_BILIBILI_COM_X
FAV_FOLDER="%s/fav/folder" % _BASE_API_BILIBILI_COM_X_V2 | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
869,
1053,
903,
25416,
29918,
8851,
29933,
29918,
23845,
29943,
11538,
29892,
29918,
25416,
29918,
8787,
29918,
12809,
5265,
12809,
5265,
29918,
19795,
29918,
29990,
29892,
29918,
25416,
29918,
8787,
29918,
12809,
5265,
12809,
5265,
29918,
19795,
29892,
29918,
25416,
29918,
8787,
29918,
12809,
5265,
12809,
5265,
29918,
19795,
29918,
29990,
29918,
29963,
29906,
13,
13,
29907,
17011,
543,
29995,
29879,
29914,
7543,
29908,
1273,
903,
25416,
29918,
8851,
29933,
29918,
23845,
29943,
11538,
13,
3521,
29963,
543,
29995,
29879,
29914,
6654,
29908,
1273,
903,
25416,
29918,
8851,
29933,
29918,
23845,
29943,
11538,
13,
1525,
29931,
8098,
29918,
17816,
543,
29995,
29879,
29914,
23445,
29914,
6112,
29908,
1273,
903,
25416,
29918,
8787,
29918,
12809,
5265,
12809,
5265,
29918,
19795,
29918,
29990,
13,
4519,
29963,
29918,
29943,
5607,
8032,
543,
29995,
29879,
29914,
29888,
485,
29914,
12083,
29908,
1273,
903,
25416,
29918,
8787,
29918,
12809,
5265,
12809,
5265,
29918,
19795,
29918,
29990,
29918,
29963,
29906,
2
] |
src/perceptron.py | clark3493/machine_learning | 0 | 1604953 | <reponame>clark3493/machine_learning
import numpy as np
class Perceptron(object):
def __init__(self,
eta=0.01,
n_iter=50,
random_state=1):
self.eta = eta
"""
Learning rate (between 0.0 and 1.0)
:type eta: float
"""
self.n_iter = n_iter
"""
Number of passes over the training dataset.
:type n_iter: int
"""
self.random_state = random_state
"""
Random number generator seed for random weight initialization
:type random_state: int
"""
def fit(self, X, y):
"""
Fit training data to target values
:param X: Training vectors with n_samples of n_features
:type X: np.array, shape=[n_samples, n_features]
:param y: Target values
:type y: np.array, shape=[n_samples]
:return: self
:rtype: object
"""
rgen = np.random.RandomState(self.random_state)
self._weights = rgen.normal(loc=0.0, scale=0.01, size=1 + X.shape[1])
self.errors = []
for _ in range(self.n_iter):
errors = 0
for xi, target in zip(X, y):
update = self.eta * (target - self.predict(xi))
self._weights[1:] += update * xi
self._weights[0] += update # bias unit
errors += int(update != 0.0)
self.errors.append(errors)
return self
def net_input(self, X):
"""
Calculate net input
"""
return np.dot(X, self._weights[1:]) + self._weights[0]
def predict(self, X):
"""
Return class label after unit step
"""
return np.where(self.net_input(X) >= 0.0, 1, -1) | [
1,
529,
276,
1112,
420,
29958,
695,
935,
29941,
29946,
29929,
29941,
29914,
23523,
29918,
21891,
13,
5215,
12655,
408,
7442,
13,
13,
13,
1990,
2431,
1547,
1617,
29898,
3318,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
13,
462,
634,
29874,
29922,
29900,
29889,
29900,
29896,
29892,
13,
462,
302,
29918,
1524,
29922,
29945,
29900,
29892,
13,
462,
4036,
29918,
3859,
29922,
29896,
1125,
13,
4706,
1583,
29889,
1187,
353,
634,
29874,
13,
4706,
9995,
13,
4706,
29257,
6554,
313,
14811,
29871,
29900,
29889,
29900,
322,
29871,
29896,
29889,
29900,
29897,
13,
4706,
584,
1853,
634,
29874,
29901,
5785,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
29876,
29918,
1524,
353,
302,
29918,
1524,
13,
4706,
9995,
13,
4706,
9681,
310,
14517,
975,
278,
6694,
8783,
29889,
13,
4706,
584,
1853,
302,
29918,
1524,
29901,
938,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
8172,
29918,
3859,
353,
4036,
29918,
3859,
13,
4706,
9995,
13,
4706,
16968,
1353,
15299,
16717,
363,
4036,
7688,
17865,
13,
4706,
584,
1853,
4036,
29918,
3859,
29901,
938,
13,
4706,
9995,
13,
13,
1678,
822,
6216,
29898,
1311,
29892,
1060,
29892,
343,
1125,
13,
4706,
9995,
13,
4706,
383,
277,
6694,
848,
304,
3646,
1819,
13,
4706,
584,
3207,
1060,
29901,
26101,
12047,
411,
302,
29918,
27736,
310,
302,
29918,
22100,
13,
4706,
584,
1853,
1060,
29901,
7442,
29889,
2378,
29892,
8267,
11759,
29876,
29918,
27736,
29892,
302,
29918,
22100,
29962,
13,
4706,
584,
3207,
343,
29901,
17157,
1819,
13,
4706,
584,
1853,
343,
29901,
7442,
29889,
2378,
29892,
8267,
11759,
29876,
29918,
27736,
29962,
13,
4706,
584,
2457,
29901,
1583,
13,
4706,
584,
29878,
1853,
29901,
1203,
13,
4706,
9995,
13,
4706,
364,
1885,
353,
7442,
29889,
8172,
29889,
17875,
2792,
29898,
1311,
29889,
8172,
29918,
3859,
29897,
13,
4706,
1583,
3032,
705,
5861,
353,
364,
1885,
29889,
8945,
29898,
2029,
29922,
29900,
29889,
29900,
29892,
6287,
29922,
29900,
29889,
29900,
29896,
29892,
2159,
29922,
29896,
718,
1060,
29889,
12181,
29961,
29896,
2314,
13,
13,
4706,
1583,
29889,
12523,
353,
5159,
13,
13,
4706,
363,
903,
297,
3464,
29898,
1311,
29889,
29876,
29918,
1524,
1125,
13,
9651,
4436,
353,
29871,
29900,
13,
9651,
363,
921,
29875,
29892,
3646,
297,
14319,
29898,
29990,
29892,
343,
1125,
13,
18884,
2767,
353,
1583,
29889,
1187,
334,
313,
5182,
448,
1583,
29889,
27711,
29898,
5389,
876,
13,
18884,
1583,
3032,
705,
5861,
29961,
29896,
17531,
4619,
2767,
334,
921,
29875,
13,
18884,
1583,
3032,
705,
5861,
29961,
29900,
29962,
4619,
2767,
396,
24003,
5190,
13,
18884,
4436,
4619,
938,
29898,
5504,
2804,
29871,
29900,
29889,
29900,
29897,
13,
9651,
1583,
29889,
12523,
29889,
4397,
29898,
12523,
29897,
13,
4706,
736,
1583,
13,
13,
1678,
822,
7787,
29918,
2080,
29898,
1311,
29892,
1060,
1125,
13,
4706,
9995,
13,
4706,
20535,
403,
7787,
1881,
13,
4706,
9995,
13,
4706,
736,
7442,
29889,
6333,
29898,
29990,
29892,
1583,
3032,
705,
5861,
29961,
29896,
29901,
2314,
718,
1583,
3032,
705,
5861,
29961,
29900,
29962,
13,
13,
1678,
822,
8500,
29898,
1311,
29892,
1060,
1125,
13,
4706,
9995,
13,
4706,
7106,
770,
3858,
1156,
5190,
4331,
13,
4706,
9995,
13,
4706,
736,
7442,
29889,
3062,
29898,
1311,
29889,
1212,
29918,
2080,
29898,
29990,
29897,
6736,
29871,
29900,
29889,
29900,
29892,
29871,
29896,
29892,
448,
29896,
29897,
2
] |
lndtap/common/middlewares.py | kgritesh/lightening-tap | 0 | 175908 | # -*- coding: utf-8 -*-
import logging
from lndtap.config import config
from lndtap.lnrpc.client import Client
async def context_middleware(request):
cert = await config.read_lnd_cert()
macaroon = await config.read_macaroon() if config.LND_MACROON_ENABLED else None
request["context"] = {
"config": config,
"lnrpc": Client(config.LND_NODE, cert, macaroon=macaroon),
"logger": logging.getLogger("lndtap.request"),
}
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
5215,
12183,
13,
13,
3166,
301,
299,
29873,
481,
29889,
2917,
1053,
2295,
13,
3166,
301,
299,
29873,
481,
29889,
3083,
29878,
6739,
29889,
4645,
1053,
12477,
13,
13,
13,
12674,
822,
3030,
29918,
17662,
2519,
29898,
3827,
1125,
13,
1678,
2284,
353,
7272,
2295,
29889,
949,
29918,
29880,
299,
29918,
6327,
580,
13,
1678,
5825,
279,
6150,
353,
7272,
2295,
29889,
949,
29918,
8628,
279,
6150,
580,
565,
2295,
29889,
29931,
2797,
29918,
1529,
29907,
1672,
1164,
29918,
1430,
6181,
29928,
1683,
6213,
13,
13,
1678,
2009,
3366,
4703,
3108,
353,
426,
13,
4706,
376,
2917,
1115,
2295,
29892,
13,
4706,
376,
3083,
29878,
6739,
1115,
12477,
29898,
2917,
29889,
29931,
2797,
29918,
6632,
2287,
29892,
2284,
29892,
5825,
279,
6150,
29922,
8628,
279,
6150,
511,
13,
4706,
376,
21707,
1115,
12183,
29889,
657,
16363,
703,
29880,
299,
29873,
481,
29889,
3827,
4968,
13,
1678,
500,
13,
2
] |
tests/unit/roottree/data/create_sample_chain.py | shane-breeze/AlphaTwirl | 0 | 125987 | <filename>tests/unit/roottree/data/create_sample_chain.py
#!/usr/bin/env python
# <NAME> <<EMAIL>>
import array
import ROOT
##__________________________________________________________________||
def main():
file_name = 'sample_chain_01.root'
content_list = [
[10, 20, 30],
[24, 5]
]
create_file(file_name, content_list)
file_name = 'sample_chain_02.root'
content_list = [
[3, 10],
[5, 8, 32, 15, 2],
[22, 11],
]
create_file(file_name, content_list)
file_name = 'sample_chain_03.root'
content_list = [
[2, 7],
[10, 100],
]
create_file(file_name, content_list)
def create_file(name, contents):
f = ROOT.TFile(name, 'recreate')
t = ROOT.TTree('tree', 'sample tree')
max_nvar = 128;
nvar = array.array('i', [0])
var = array.array('i', max_nvar*[0])
t.Branch('nvar', nvar, 'nvar/I')
t.Branch('var', var, 'var[nvar]/I')
for c in contents:
nvar[0] = len(c)
for i, v in enumerate(c):
var[i] = v
t.Fill()
t.Write()
##__________________________________________________________________||
if __name__ == '__main__':
main()
##__________________________________________________________________||
| [
1,
529,
9507,
29958,
21150,
29914,
5441,
29914,
307,
1501,
929,
29914,
1272,
29914,
3258,
29918,
11249,
29918,
14153,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
13,
5215,
1409,
13,
5215,
16641,
2891,
13,
13,
2277,
27097,
27097,
27097,
27097,
1649,
8876,
13,
1753,
1667,
7295,
13,
13,
1678,
934,
29918,
978,
353,
525,
11249,
29918,
14153,
29918,
29900,
29896,
29889,
4632,
29915,
13,
1678,
2793,
29918,
1761,
353,
518,
13,
4706,
518,
29896,
29900,
29892,
29871,
29906,
29900,
29892,
29871,
29941,
29900,
1402,
13,
4706,
518,
29906,
29946,
29892,
29871,
29945,
29962,
13,
1678,
4514,
13,
1678,
1653,
29918,
1445,
29898,
1445,
29918,
978,
29892,
2793,
29918,
1761,
29897,
13,
13,
1678,
934,
29918,
978,
353,
525,
11249,
29918,
14153,
29918,
29900,
29906,
29889,
4632,
29915,
13,
1678,
2793,
29918,
1761,
353,
518,
13,
4706,
518,
29941,
29892,
29871,
29896,
29900,
1402,
13,
4706,
518,
29945,
29892,
29871,
29947,
29892,
29871,
29941,
29906,
29892,
29871,
29896,
29945,
29892,
29871,
29906,
1402,
13,
4706,
518,
29906,
29906,
29892,
29871,
29896,
29896,
1402,
13,
1678,
4514,
13,
1678,
1653,
29918,
1445,
29898,
1445,
29918,
978,
29892,
2793,
29918,
1761,
29897,
13,
13,
1678,
934,
29918,
978,
353,
525,
11249,
29918,
14153,
29918,
29900,
29941,
29889,
4632,
29915,
13,
1678,
2793,
29918,
1761,
353,
518,
13,
4706,
518,
29906,
29892,
29871,
29955,
1402,
13,
4706,
518,
29896,
29900,
29892,
29871,
29896,
29900,
29900,
1402,
13,
1678,
4514,
13,
1678,
1653,
29918,
1445,
29898,
1445,
29918,
978,
29892,
2793,
29918,
1761,
29897,
13,
13,
1753,
1653,
29918,
1445,
29898,
978,
29892,
8118,
1125,
13,
13,
1678,
285,
353,
16641,
2891,
29889,
29911,
2283,
29898,
978,
29892,
525,
276,
3258,
1495,
13,
1678,
260,
353,
16641,
2891,
29889,
29911,
9643,
877,
8336,
742,
525,
11249,
5447,
1495,
13,
13,
1678,
4236,
29918,
29876,
1707,
353,
29871,
29896,
29906,
29947,
29936,
13,
1678,
302,
1707,
353,
1409,
29889,
2378,
877,
29875,
742,
518,
29900,
2314,
13,
1678,
722,
353,
1409,
29889,
2378,
877,
29875,
742,
4236,
29918,
29876,
1707,
29930,
29961,
29900,
2314,
13,
13,
1678,
260,
29889,
29933,
4014,
877,
29876,
1707,
742,
302,
1707,
29892,
525,
29876,
1707,
29914,
29902,
1495,
13,
1678,
260,
29889,
29933,
4014,
877,
1707,
742,
722,
29892,
525,
1707,
29961,
29876,
1707,
16261,
29902,
1495,
13,
13,
1678,
363,
274,
297,
8118,
29901,
13,
4706,
302,
1707,
29961,
29900,
29962,
353,
7431,
29898,
29883,
29897,
13,
4706,
363,
474,
29892,
325,
297,
26985,
29898,
29883,
1125,
13,
9651,
722,
29961,
29875,
29962,
353,
325,
13,
4706,
260,
29889,
20876,
580,
13,
13,
1678,
260,
29889,
6113,
580,
13,
13,
2277,
27097,
27097,
27097,
27097,
1649,
8876,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
13,
2277,
27097,
27097,
27097,
27097,
1649,
8876,
13,
2
] |
googlecode-issues-exporter/generate_user_map.py | ballschin52/support-tools | 41 | 14533 | <filename>googlecode-issues-exporter/generate_user_map.py
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tool for generating a user mapping from Google Code user to BitBucket user.
"""
import argparse
import json
import sys
import issues
class OptionalMap(dict):
"""Dictionary that returns the key for missing items. """
def __missing__(self, key):
"""Implements the dict interface. """
return key
def addIfNotPresent(users, user):
"""Adds a user if it is not already set."""
if user not in users:
users[user] = user
def _CreateUsersDict(issue_data, project_name):
"""Extract users from list of issues into a dict.
Args:
issue_data: Issue data
project_name: The name of the project being exported.
Returns:
Dict of users associated with a list of issues
"""
users = {}
for issue in issue_data:
googlecode_issue = issues.GoogleCodeIssue(
issue, project_name, OptionalMap())
reporting_user = googlecode_issue.GetAuthor()
addIfNotPresent(users, reporting_user)
assignee_user = googlecode_issue.GetOwner()
addIfNotPresent(users, assignee_user)
googlecode_comments = googlecode_issue.GetComments()
for comment in googlecode_comments:
googlecode_comment = issues.GoogleCodeComment(googlecode_issue, comment)
commenting_user = googlecode_comment.GetAuthor()
addIfNotPresent(users, commenting_user)
return {
"users": users
}
def Generate(issue_file_path, project_name):
"""Generates a user map for the specified issues. """
issue_data = None
user_file = open(issue_file_path)
user_data = json.load(user_file)
user_projects = user_data["projects"]
for project in user_projects:
if project_name in project["name"]:
issue_data = project["issues"]["items"]
break
if issue_data is None:
raise issues.ProjectNotFoundError(
"Project %s not found" % project_name)
users = _CreateUsersDict(issue_data, project_name)
with open("users.json", "w") as users_file:
user_json = json.dumps(users, sort_keys=True, indent=4,
separators=(",", ": "), ensure_ascii=False)
users_file.write(unicode(user_json))
print "\nCreated file users.json.\n"
def main(args):
"""The main function.
Args:
args: The command line arguments.
Raises:
issues.ProjectNotFoundError: The user passed in an invalid project name.
"""
parser = argparse.ArgumentParser()
parser.add_argument("--issue_file_path", required=True,
help="The path to the file containing the issues from"
"Google Code.")
parser.add_argument("--project_name", required=True,
help="The name of the Google Code project you wish to"
"export")
parsed_args, _ = parser.parse_known_args(args)
Generate(parsed_args.issue_file_path, parsed_args.project_name)
if __name__ == "__main__":
main(sys.argv)
| [
1,
529,
9507,
29958,
3608,
401,
29899,
12175,
29899,
735,
18505,
29914,
17158,
29918,
1792,
29918,
1958,
29889,
2272,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29946,
5087,
9266,
29889,
2178,
26863,
2538,
9841,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
13,
15945,
29908,
12229,
363,
14655,
263,
1404,
10417,
515,
5087,
5920,
1404,
304,
18531,
29933,
2707,
300,
1404,
29889,
13,
15945,
29908,
13,
13,
5215,
1852,
5510,
13,
5215,
4390,
13,
5215,
10876,
13,
13,
5215,
5626,
13,
13,
13,
1990,
28379,
3388,
29898,
8977,
1125,
13,
29871,
9995,
11513,
393,
3639,
278,
1820,
363,
4567,
4452,
29889,
9995,
13,
13,
29871,
822,
4770,
27259,
12035,
1311,
29892,
1820,
1125,
13,
1678,
9995,
1888,
9711,
278,
9657,
5067,
29889,
9995,
13,
1678,
736,
1820,
13,
13,
13,
1753,
788,
3644,
3664,
13504,
296,
29898,
7193,
29892,
1404,
1125,
13,
29871,
9995,
2528,
29879,
263,
1404,
565,
372,
338,
451,
2307,
731,
1213,
15945,
13,
29871,
565,
1404,
451,
297,
4160,
29901,
13,
1678,
4160,
29961,
1792,
29962,
353,
1404,
13,
13,
13,
1753,
903,
4391,
5959,
21533,
29898,
15118,
29918,
1272,
29892,
2060,
29918,
978,
1125,
13,
29871,
9995,
5647,
1461,
4160,
515,
1051,
310,
5626,
964,
263,
9657,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
2228,
29918,
1272,
29901,
26246,
848,
13,
1678,
2060,
29918,
978,
29901,
450,
1024,
310,
278,
2060,
1641,
5609,
287,
29889,
13,
13,
29871,
16969,
29901,
13,
1678,
360,
919,
310,
4160,
6942,
411,
263,
1051,
310,
5626,
13,
29871,
9995,
13,
29871,
4160,
353,
6571,
13,
29871,
363,
2228,
297,
2228,
29918,
1272,
29901,
13,
1678,
5386,
401,
29918,
15118,
353,
5626,
29889,
14207,
3399,
29902,
893,
434,
29898,
13,
4706,
2228,
29892,
2060,
29918,
978,
29892,
28379,
3388,
3101,
13,
13,
1678,
23415,
29918,
1792,
353,
5386,
401,
29918,
15118,
29889,
2577,
13720,
580,
13,
1678,
788,
3644,
3664,
13504,
296,
29898,
7193,
29892,
23415,
29918,
1792,
29897,
13,
13,
1678,
1223,
4895,
29872,
29918,
1792,
353,
5386,
401,
29918,
15118,
29889,
2577,
28213,
580,
13,
1678,
788,
3644,
3664,
13504,
296,
29898,
7193,
29892,
1223,
4895,
29872,
29918,
1792,
29897,
13,
13,
1678,
5386,
401,
29918,
21032,
353,
5386,
401,
29918,
15118,
29889,
2577,
1523,
1860,
580,
13,
1678,
363,
3440,
297,
5386,
401,
29918,
21032,
29901,
13,
418,
5386,
401,
29918,
9342,
353,
5626,
29889,
14207,
3399,
20001,
29898,
3608,
401,
29918,
15118,
29892,
3440,
29897,
13,
418,
3440,
292,
29918,
1792,
353,
5386,
401,
29918,
9342,
29889,
2577,
13720,
580,
13,
418,
788,
3644,
3664,
13504,
296,
29898,
7193,
29892,
3440,
292,
29918,
1792,
29897,
13,
13,
29871,
736,
426,
13,
418,
376,
7193,
1115,
4160,
13,
29871,
500,
13,
13,
13,
1753,
3251,
403,
29898,
15118,
29918,
1445,
29918,
2084,
29892,
2060,
29918,
978,
1125,
13,
29871,
9995,
5631,
1078,
263,
1404,
2910,
363,
278,
6790,
5626,
29889,
9995,
13,
29871,
2228,
29918,
1272,
353,
6213,
13,
13,
29871,
1404,
29918,
1445,
353,
1722,
29898,
15118,
29918,
1445,
29918,
2084,
29897,
13,
29871,
1404,
29918,
1272,
353,
4390,
29889,
1359,
29898,
1792,
29918,
1445,
29897,
13,
29871,
1404,
29918,
16418,
353,
1404,
29918,
1272,
3366,
16418,
3108,
13,
13,
29871,
363,
2060,
297,
1404,
29918,
16418,
29901,
13,
1678,
565,
2060,
29918,
978,
297,
2060,
3366,
978,
3108,
29901,
13,
418,
2228,
29918,
1272,
353,
2060,
3366,
12175,
3108,
3366,
7076,
3108,
13,
418,
2867,
13,
13,
29871,
565,
2228,
29918,
1272,
338,
6213,
29901,
13,
1678,
12020,
5626,
29889,
7653,
17413,
2392,
29898,
13,
4706,
376,
7653,
1273,
29879,
451,
1476,
29908,
1273,
2060,
29918,
978,
29897,
13,
13,
29871,
4160,
353,
903,
4391,
5959,
21533,
29898,
15118,
29918,
1272,
29892,
2060,
29918,
978,
29897,
13,
13,
29871,
411,
1722,
703,
7193,
29889,
3126,
613,
376,
29893,
1159,
408,
4160,
29918,
1445,
29901,
13,
1678,
1404,
29918,
3126,
353,
4390,
29889,
29881,
17204,
29898,
7193,
29892,
2656,
29918,
8149,
29922,
5574,
29892,
29536,
29922,
29946,
29892,
13,
462,
965,
2903,
4097,
7607,
613,
613,
29242,
376,
511,
9801,
29918,
294,
18869,
29922,
8824,
29897,
13,
1678,
4160,
29918,
1445,
29889,
3539,
29898,
2523,
356,
29898,
1792,
29918,
3126,
876,
13,
1678,
1596,
6634,
29876,
20399,
934,
4160,
29889,
3126,
7790,
29876,
29908,
13,
13,
13,
1753,
1667,
29898,
5085,
1125,
13,
29871,
9995,
1576,
1667,
740,
29889,
13,
13,
29871,
826,
3174,
29901,
13,
1678,
6389,
29901,
450,
1899,
1196,
6273,
29889,
13,
13,
29871,
390,
1759,
267,
29901,
13,
1678,
5626,
29889,
7653,
17413,
2392,
29901,
450,
1404,
4502,
297,
385,
8340,
2060,
1024,
29889,
13,
29871,
9995,
13,
29871,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
29871,
13812,
29889,
1202,
29918,
23516,
703,
489,
15118,
29918,
1445,
29918,
2084,
613,
3734,
29922,
5574,
29892,
13,
462,
418,
1371,
543,
1576,
2224,
304,
278,
934,
6943,
278,
5626,
515,
29908,
13,
462,
418,
376,
14207,
5920,
23157,
13,
29871,
13812,
29889,
1202,
29918,
23516,
703,
489,
4836,
29918,
978,
613,
3734,
29922,
5574,
29892,
13,
462,
418,
1371,
543,
1576,
1024,
310,
278,
5087,
5920,
2060,
366,
6398,
304,
29908,
13,
462,
418,
376,
15843,
1159,
13,
29871,
21213,
29918,
5085,
29892,
903,
353,
13812,
29889,
5510,
29918,
5203,
29918,
5085,
29898,
5085,
29897,
13,
13,
29871,
3251,
403,
29898,
862,
8485,
29918,
5085,
29889,
15118,
29918,
1445,
29918,
2084,
29892,
21213,
29918,
5085,
29889,
4836,
29918,
978,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
29871,
1667,
29898,
9675,
29889,
19218,
29897,
13,
2
] |
src/single_pendulum.py | dpopchev/Computation_python | 0 | 20917 | #!/usr/bin/env python3
# do not hesitate to debug
import pdb
# python computation modules and visualization
import numpy as np
import sympy as sy
import scipy as sp
import matplotlib.pyplot as plt
from sympy import Q as syQ
sy.init_printing(use_latex=True,forecolor="White")
def Lyapunov_stability_test_linear(ev):
''' test if a linear homogeneous system with constant coefficients is stable
in the sense of Lyapunov by checking the theorem conditions against the
provided eigenvalues
source https://www.math24.net/stability-theory-basic-concepts/
TODO taking into account eigenvalue multiplicity '''
# the criteria result will be saved here
r = None
# system is asymptotically stable if only if
# all eigenvalues have negative real parts
r = 'asymptotically stable' if ( not r
and all(sy.ask(syQ.negative(sy.re(_))) for _ in ev) ) else None
# system is stable if and only if
# all eigenvalues have nonpositive real parts
# TODO incorporate algebraic and geometric multiplicity criteria
r = 'stable' if ( not r
and all(sy.ask(syQ.nonpositive(sy.re(_))) for _ in ev) ) else None
# system is unstable if
# at least one eigenvalue has positive real part
# TODO incorporate algebraic and geometric multiplicity criteria
r = 'unstable' if ( not r
and any(sy.ask(syQ.positive(sy.re(_))) for _ in ev) ) else None
return r
def Lyapunov_stability_test_nonlinear(ev):
''' test if the fixed point of a nonlinear structure stable system
is stable, unstable, critical or impossible to determine using Lyapunov
criteria of first order and thus other methods are needed
TODO tests are only applicable for structurally stable systems, i.e.
with purely imaginary eigenvalues are not taken into account
source https://www.math24.net/stability-first-approximation/ '''
# the criteria result will be saved here
r = None
# system is asymptotically stable if only if
# all eigenvalues have negative real parts
r = 'asymptotically stable' if ( not r
and all(sy.ask(syQ.negative(sy.re(_))) for _ in ev) ) else None
# system is unstable if
# at least one eigenvalue has positive real part
r = 'unstable' if ( not r
and any(sy.ask(syQ.positive(sy.re(_))) for _ in ev) ) else None
# if all eigenvalues have non-positive real parts,
# and there is at least one eigenvalue with zero real part
# then fixed point can be stable or unstable and other methods should be
# used, thus mark the point critical
r = 'critical' if ( not r
and all(sy.ask(Q.nonpositive(sy.re(_))) for _ in ev)
and any(sy.re(_) == 0 for _ in ev)
) else None
return r if r else 'not decided'
def RouthHurwitz_Criterion(p):
''' return principal minors of Hurwitz matrix as sympy polynomials, which if
all are positive it is sufficient condition for asymptotic stability
NOTE: if all n-1 principal minors are positive, and nth minor is zero,
the system is at the boundary of stability, with two cases:
a_n = 0 -- one of the root is zero and system is on the boundary of
aperiodic stability
n-1 minor is zero -- there are two complex conjugate imaginary roots and
the system is at boundary of oscillatory stability
source https://www.math24.net/routh-hurwitz-criterion/ '''
# initial key and index pair needed to create Hurwitz matrix via sympy banded
# each entry is of the type [ dictionary key, coefficient slice ]
idxs = [ [ 1, 0 ] ]
# generate next key by decrementing with 1
genKey = lambda _: _ - 1
# generate next index by incrementing with 1 if key was nonnegative
# or with 2 if key is negative
genSlice = lambda _, __: __ + 1 if _ >= 0 else __ + 2
# fill the rest pairs w.r.t. the polynomial degree - 1, as we already have
# one entry
for _ in range(p.degree() - 1):
key = genKey(idxs[-1][0])
idxs.append( [ key, genSlice(key, idxs[-1][1] ) ] )
# create the matrix itself
H = sy.banded({ k: p.all_coeffs()[v:] for k, v in idxs })
return [ H[:_, :_].det() if _ > 0 else p.LC() for _ in range(0, p.degree()+1) ]
# define independent variable
t = sy.symbols('t', real=True)
# define dependent variables individually and pact them in an variable
theta, omega = sy.symbols(r'\theta, \omega', real = True)
Y = theta, omega
# define free parameters of they system and pack them in a variable
g, L = sy.symbols('g, L', positive = True)
parms = g, L
# create rhs as sympy expressions
theta_dt = omega
omega_dt = -(g/L)*sy.sin(theta)
rhs = {}
rhs['sympy'] = sy.Matrix([theta_dt, omega_dt])
# convert the sympy matrix function to numpy function with usual signature
rhs['numpy'] = sy.lambdify((t, Y, *parms), rhs['sympy'], 'numpy')
# create Jacobian matrix as sympy expression
J = {}
J['sympy'] = rhs['sympy'].jacobian(Y)
# convert the sympy Jacobian expression to numpy function with usual signature
J['numpy'] = sy.lambdify((t, Y, *parms), J['sympy'])
# calculate rhs fixed points
fixed_points = sy.solve(rhs['sympy'], Y)
# substitute each fixed point in the Jacobian
# and calculate the eigenvalues
J_fixed = {}
for i, fp in enumerate(fixed_points):
J_subs = J['sympy'].subs( [(y, v) for y, v in zip(Y, fp)])
#J_eigenvals = J_subs.eigenvals(multiple=True)
J_eigenvals = J_subs.eigenvals()
# save the fixed point results in more details
# most importantly the eigenvalues and their corresponding multiplicity
J_fixed[i] = {
'fixed point': fp,
'subs': J_subs,
'eigenvalues': list(J_eigenvals.keys()),
'multiplicity': list(J_eigenvals.values())
}
def plot_phase_portrait(ax, rhs, section, args=(), n_points=25):
''' plot section of phase space of a field defined via its rhs '''
# create section grid
x_grid, y_grid = np.meshgrid(
np.linspace( section[0][0], section[0][1], n_points ),
np.linspace( section[1][0], section[1][1], n_points )
)
# calculate rhs on the grid
xx, yy = rhs(None, ( x_grid, y_grid ), *args)
# compute vector norms and make line width proportional to them
# i.e. greater the vector length, the thicker the line
# TODO not sure why rhs returns different shape
vector_norms = np.sqrt(xx[0]**2 + yy[0]**2)
lw = 0.25 + 3*vector_norms/vector_norms.max()
# plot the phase portrait
ax.streamplot(
x_grid, y_grid,
xx[0], yy[0],
linewidth = lw,
arrowsize = 1.2,
density = 1
)
return ax
def plot_main():
fig, ax = plt.subplots()
ax = plot_phase_portrait(
ax,
rhs['numpy'],
(
( -np.pi, np.pi ),
( -2*np.pi, 2*np.pi)
),
args = ( 5, 1 ),
)
if __name__ == '__main__':
plot_main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
437,
451,
19066,
10388,
304,
4744,
13,
5215,
282,
2585,
13,
13,
29937,
3017,
16287,
10585,
322,
7604,
2133,
13,
5215,
12655,
408,
7442,
13,
5215,
5016,
2272,
408,
9878,
13,
5215,
4560,
2272,
408,
805,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
3166,
5016,
2272,
1053,
660,
408,
9878,
29984,
13,
13,
29879,
29891,
29889,
2344,
29918,
2158,
292,
29898,
1509,
29918,
25694,
29922,
5574,
29892,
1079,
2780,
543,
21823,
1159,
13,
13,
1753,
8626,
481,
348,
586,
29918,
303,
3097,
29918,
1688,
29918,
10660,
29898,
5750,
1125,
13,
1678,
14550,
1243,
565,
263,
5608,
3632,
23724,
1788,
411,
4868,
16127,
338,
13714,
13,
1678,
297,
278,
4060,
310,
8626,
481,
348,
586,
491,
8454,
278,
9185,
5855,
2750,
278,
13,
1678,
4944,
25973,
13,
1678,
2752,
2045,
597,
1636,
29889,
755,
29906,
29946,
29889,
1212,
29914,
303,
3097,
29899,
14138,
29899,
16121,
29899,
535,
1547,
29879,
29914,
13,
1678,
14402,
5622,
964,
3633,
7388,
1767,
6674,
17024,
14550,
13,
13,
1678,
396,
278,
16614,
1121,
674,
367,
7160,
1244,
13,
1678,
364,
353,
6213,
13,
13,
1678,
396,
1788,
338,
22784,
327,
1711,
13714,
565,
871,
565,
13,
1678,
396,
599,
25973,
505,
8178,
1855,
5633,
13,
1678,
364,
353,
525,
294,
962,
415,
327,
1711,
13714,
29915,
565,
313,
451,
364,
13,
9651,
322,
29871,
599,
29898,
29879,
29891,
29889,
1278,
29898,
29879,
29891,
29984,
29889,
22198,
29898,
29879,
29891,
29889,
276,
7373,
4961,
363,
903,
297,
3415,
29897,
1723,
1683,
6213,
13,
13,
1678,
396,
1788,
338,
13714,
565,
322,
871,
565,
13,
1678,
396,
599,
25973,
505,
1661,
1066,
3321,
1855,
5633,
13,
1678,
396,
14402,
11039,
403,
21531,
322,
26224,
6674,
17024,
16614,
13,
1678,
364,
353,
525,
13844,
29915,
565,
313,
451,
364,
13,
9651,
322,
599,
29898,
29879,
29891,
29889,
1278,
29898,
29879,
29891,
29984,
29889,
5464,
1066,
3321,
29898,
29879,
29891,
29889,
276,
7373,
4961,
363,
903,
297,
3415,
29897,
1723,
1683,
6213,
13,
13,
1678,
396,
1788,
338,
443,
13844,
565,
13,
1678,
396,
472,
3203,
697,
7388,
1767,
756,
6374,
1855,
760,
13,
1678,
396,
14402,
11039,
403,
21531,
322,
26224,
6674,
17024,
16614,
13,
1678,
364,
353,
525,
6465,
519,
29915,
565,
313,
451,
364,
13,
9651,
322,
738,
29898,
29879,
29891,
29889,
1278,
29898,
29879,
29891,
29984,
29889,
1066,
3321,
29898,
29879,
29891,
29889,
276,
7373,
4961,
363,
903,
297,
3415,
29897,
1723,
1683,
6213,
13,
13,
1678,
736,
364,
13,
13,
1753,
8626,
481,
348,
586,
29918,
303,
3097,
29918,
1688,
29918,
5464,
10660,
29898,
5750,
1125,
13,
1678,
14550,
1243,
565,
278,
4343,
1298,
310,
263,
1661,
10660,
3829,
13714,
1788,
13,
1678,
338,
13714,
29892,
443,
13844,
29892,
12187,
470,
9301,
304,
8161,
773,
8626,
481,
348,
586,
13,
1678,
16614,
310,
937,
1797,
322,
4550,
916,
3519,
526,
4312,
13,
1678,
14402,
6987,
526,
871,
22903,
363,
2281,
332,
635,
13714,
6757,
29892,
474,
29889,
29872,
29889,
13,
1678,
411,
24837,
6382,
3821,
25973,
526,
451,
4586,
964,
3633,
13,
1678,
2752,
2045,
597,
1636,
29889,
755,
29906,
29946,
29889,
1212,
29914,
303,
3097,
29899,
4102,
29899,
9961,
2657,
362,
29914,
14550,
13,
13,
1678,
396,
278,
16614,
1121,
674,
367,
7160,
1244,
13,
1678,
364,
353,
6213,
13,
13,
1678,
396,
1788,
338,
22784,
327,
1711,
13714,
565,
871,
565,
13,
1678,
396,
599,
25973,
505,
8178,
1855,
5633,
13,
1678,
364,
353,
525,
294,
962,
415,
327,
1711,
13714,
29915,
565,
313,
451,
364,
13,
9651,
322,
29871,
599,
29898,
29879,
29891,
29889,
1278,
29898,
29879,
29891,
29984,
29889,
22198,
29898,
29879,
29891,
29889,
276,
7373,
4961,
363,
903,
297,
3415,
29897,
1723,
1683,
6213,
13,
13,
1678,
396,
1788,
338,
443,
13844,
565,
13,
1678,
396,
472,
3203,
697,
7388,
1767,
756,
6374,
1855,
760,
13,
1678,
364,
353,
525,
6465,
519,
29915,
565,
313,
451,
364,
13,
9651,
322,
738,
29898,
29879,
29891,
29889,
1278,
29898,
29879,
29891,
29984,
29889,
1066,
3321,
29898,
29879,
29891,
29889,
276,
7373,
4961,
363,
903,
297,
3415,
29897,
1723,
1683,
6213,
13,
13,
1678,
396,
565,
599,
25973,
505,
1661,
29899,
1066,
3321,
1855,
5633,
29892,
13,
1678,
396,
322,
727,
338,
472,
3203,
697,
7388,
1767,
411,
5225,
1855,
760,
13,
1678,
396,
769,
4343,
1298,
508,
367,
13714,
470,
443,
13844,
322,
916,
3519,
881,
367,
13,
1678,
396,
1304,
29892,
4550,
2791,
278,
1298,
12187,
13,
1678,
364,
353,
525,
9695,
936,
29915,
565,
313,
451,
364,
13,
9651,
322,
599,
29898,
29879,
29891,
29889,
1278,
29898,
29984,
29889,
5464,
1066,
3321,
29898,
29879,
29891,
29889,
276,
7373,
4961,
363,
903,
297,
3415,
29897,
13,
9651,
322,
738,
29898,
29879,
29891,
29889,
276,
7373,
29897,
1275,
29871,
29900,
363,
903,
297,
3415,
29897,
13,
9651,
1723,
1683,
6213,
13,
13,
1678,
736,
364,
565,
364,
1683,
525,
1333,
8459,
29915,
13,
13,
1753,
390,
2438,
29950,
332,
25709,
29918,
29907,
5385,
291,
29898,
29886,
1125,
13,
1678,
14550,
736,
5882,
1375,
943,
310,
22220,
25709,
4636,
408,
5016,
2272,
24655,
29892,
607,
565,
13,
1678,
599,
526,
6374,
372,
338,
8002,
4195,
363,
22784,
13574,
25806,
13,
1678,
6058,
29923,
29901,
565,
599,
302,
29899,
29896,
5882,
1375,
943,
526,
6374,
29892,
322,
302,
386,
9461,
338,
5225,
29892,
13,
1678,
278,
1788,
338,
472,
278,
10452,
310,
25806,
29892,
411,
1023,
4251,
29901,
13,
4706,
263,
29918,
29876,
353,
29871,
29900,
1192,
697,
310,
278,
3876,
338,
5225,
322,
1788,
338,
373,
278,
10452,
310,
13,
4706,
263,
19145,
293,
25806,
13,
4706,
302,
29899,
29896,
9461,
338,
5225,
1192,
727,
526,
1023,
4280,
25482,
403,
6382,
3821,
16778,
322,
13,
4706,
278,
1788,
338,
472,
10452,
310,
21519,
7606,
25806,
13,
1678,
2752,
2045,
597,
1636,
29889,
755,
29906,
29946,
29889,
1212,
29914,
29878,
2438,
29899,
29882,
332,
25709,
29899,
29883,
5385,
291,
29914,
14550,
13,
13,
1678,
396,
2847,
1820,
322,
2380,
5101,
4312,
304,
1653,
22220,
25709,
4636,
3025,
5016,
2272,
3719,
287,
13,
1678,
396,
1269,
6251,
338,
310,
278,
1134,
518,
8600,
1820,
29892,
10825,
22780,
4514,
13,
1678,
1178,
10351,
353,
518,
518,
29871,
29896,
29892,
29871,
29900,
4514,
4514,
13,
13,
1678,
396,
5706,
2446,
1820,
491,
9263,
358,
292,
411,
29871,
29896,
13,
1678,
2531,
2558,
353,
14013,
903,
29901,
903,
448,
29871,
29896,
13,
13,
1678,
396,
5706,
2446,
2380,
491,
11924,
292,
411,
29871,
29896,
565,
1820,
471,
1661,
22198,
13,
1678,
396,
470,
411,
29871,
29906,
565,
1820,
338,
8178,
13,
1678,
2531,
29903,
5897,
353,
14013,
17117,
4770,
29901,
4770,
718,
29871,
29896,
565,
903,
6736,
29871,
29900,
1683,
4770,
718,
29871,
29906,
13,
13,
1678,
396,
5445,
278,
1791,
11000,
281,
29889,
29878,
29889,
29873,
29889,
278,
10159,
7426,
448,
29871,
29896,
29892,
408,
591,
2307,
505,
13,
1678,
396,
697,
6251,
13,
1678,
363,
903,
297,
3464,
29898,
29886,
29889,
12163,
929,
580,
448,
29871,
29896,
1125,
13,
4706,
1820,
353,
2531,
2558,
29898,
333,
10351,
14352,
29896,
3816,
29900,
2314,
13,
4706,
1178,
10351,
29889,
4397,
29898,
518,
1820,
29892,
2531,
29903,
5897,
29898,
1989,
29892,
1178,
10351,
14352,
29896,
3816,
29896,
29962,
1723,
4514,
1723,
13,
13,
1678,
396,
1653,
278,
4636,
3528,
13,
1678,
379,
353,
9878,
29889,
4980,
287,
3319,
413,
29901,
282,
29889,
497,
29918,
1111,
12352,
29879,
580,
29961,
29894,
17531,
363,
413,
29892,
325,
297,
1178,
10351,
5615,
13,
13,
1678,
736,
518,
379,
7503,
3383,
584,
29918,
1822,
4801,
580,
565,
903,
1405,
29871,
29900,
1683,
282,
29889,
12182,
580,
363,
903,
297,
3464,
29898,
29900,
29892,
282,
29889,
12163,
929,
580,
29974,
29896,
29897,
4514,
13,
13,
29937,
4529,
7417,
2286,
13,
29873,
353,
9878,
29889,
18098,
29879,
877,
29873,
742,
1855,
29922,
5574,
29897,
13,
13,
29937,
4529,
14278,
3651,
29689,
322,
282,
627,
963,
297,
385,
2286,
13,
3416,
29892,
2703,
2442,
353,
9878,
29889,
18098,
29879,
29898,
29878,
12764,
3416,
29892,
320,
4787,
742,
1855,
353,
5852,
29897,
13,
29979,
353,
278,
941,
29892,
2703,
2442,
13,
13,
29937,
4529,
3889,
4128,
310,
896,
1788,
322,
4870,
963,
297,
263,
2286,
13,
29887,
29892,
365,
353,
29871,
9878,
29889,
18098,
29879,
877,
29887,
29892,
365,
742,
6374,
353,
5852,
29897,
13,
862,
1516,
353,
330,
29892,
365,
13,
13,
29937,
1653,
29365,
408,
5016,
2272,
12241,
13,
3416,
29918,
6008,
353,
2703,
2442,
13,
4787,
29918,
6008,
353,
19691,
29887,
29914,
29931,
11877,
29879,
29891,
29889,
5223,
29898,
3416,
29897,
13,
29878,
9499,
353,
6571,
13,
29878,
9499,
1839,
11967,
2272,
2033,
353,
9878,
29889,
14609,
4197,
3416,
29918,
6008,
29892,
2703,
2442,
29918,
6008,
2314,
13,
13,
29937,
3588,
278,
5016,
2272,
4636,
740,
304,
12655,
740,
411,
9670,
12608,
13,
29878,
9499,
1839,
23749,
2033,
353,
9878,
29889,
29880,
1117,
29881,
1598,
3552,
29873,
29892,
612,
29892,
334,
862,
1516,
511,
29365,
1839,
11967,
2272,
7464,
525,
23749,
1495,
13,
13,
29937,
1653,
10968,
713,
4636,
408,
5016,
2272,
4603,
13,
29967,
353,
6571,
13,
29967,
1839,
11967,
2272,
2033,
353,
29365,
1839,
11967,
2272,
13359,
29926,
562,
711,
713,
29898,
29979,
29897,
13,
13,
29937,
3588,
278,
5016,
2272,
10968,
713,
4603,
304,
12655,
740,
411,
9670,
12608,
13,
29967,
1839,
23749,
2033,
353,
9878,
29889,
29880,
1117,
29881,
1598,
3552,
29873,
29892,
612,
29892,
334,
862,
1516,
511,
435,
1839,
11967,
2272,
11287,
13,
13,
29937,
8147,
29365,
4343,
3291,
13,
20227,
29918,
9748,
353,
9878,
29889,
2929,
345,
29898,
29878,
9499,
1839,
11967,
2272,
7464,
612,
29897,
13,
13,
29937,
23764,
1269,
4343,
1298,
297,
278,
10968,
713,
13,
29937,
322,
8147,
278,
25973,
13,
29967,
29918,
20227,
353,
6571,
13,
1454,
474,
29892,
285,
29886,
297,
26985,
29898,
20227,
29918,
9748,
1125,
13,
13,
1678,
435,
29918,
1491,
29879,
353,
435,
1839,
11967,
2272,
13359,
1491,
29879,
29898,
17288,
29891,
29892,
325,
29897,
363,
343,
29892,
325,
297,
14319,
29898,
29979,
29892,
285,
29886,
29897,
2314,
13,
13,
1678,
396,
29967,
29918,
29872,
2101,
791,
29879,
353,
435,
29918,
1491,
29879,
29889,
29872,
2101,
791,
29879,
29898,
20787,
29922,
5574,
29897,
13,
1678,
435,
29918,
29872,
2101,
791,
29879,
353,
435,
29918,
1491,
29879,
29889,
29872,
2101,
791,
29879,
580,
13,
13,
1678,
396,
4078,
278,
4343,
1298,
2582,
297,
901,
4902,
13,
1678,
396,
1556,
4100,
368,
278,
25973,
322,
1009,
6590,
6674,
17024,
13,
1678,
435,
29918,
20227,
29961,
29875,
29962,
353,
426,
13,
9651,
525,
20227,
1298,
2396,
285,
29886,
29892,
13,
9651,
525,
1491,
29879,
2396,
435,
29918,
1491,
29879,
29892,
13,
9651,
525,
29872,
2101,
5975,
2396,
1051,
29898,
29967,
29918,
29872,
2101,
791,
29879,
29889,
8149,
25739,
13,
9651,
525,
18056,
17024,
2396,
1051,
29898,
29967,
29918,
29872,
2101,
791,
29879,
29889,
5975,
3101,
13,
9651,
500,
13,
13,
1753,
6492,
29918,
21646,
29918,
637,
8356,
29898,
1165,
29892,
29365,
29892,
4004,
29892,
6389,
29922,
3285,
302,
29918,
9748,
29922,
29906,
29945,
1125,
13,
1678,
14550,
6492,
4004,
310,
8576,
2913,
310,
263,
1746,
3342,
3025,
967,
29365,
14550,
13,
13,
1678,
396,
1653,
4004,
6856,
13,
1678,
921,
29918,
7720,
29892,
343,
29918,
7720,
353,
7442,
29889,
4467,
29882,
7720,
29898,
13,
9651,
7442,
29889,
1915,
3493,
29898,
4004,
29961,
29900,
3816,
29900,
1402,
4004,
29961,
29900,
3816,
29896,
1402,
302,
29918,
9748,
10353,
13,
9651,
7442,
29889,
1915,
3493,
29898,
4004,
29961,
29896,
3816,
29900,
1402,
4004,
29961,
29896,
3816,
29896,
1402,
302,
29918,
9748,
1723,
13,
9651,
1723,
13,
13,
1678,
396,
8147,
29365,
373,
278,
6856,
13,
1678,
15473,
29892,
343,
29891,
353,
29365,
29898,
8516,
29892,
313,
921,
29918,
7720,
29892,
343,
29918,
7720,
10353,
334,
5085,
29897,
13,
13,
1678,
396,
10272,
4608,
6056,
29879,
322,
1207,
1196,
2920,
29839,
304,
963,
13,
1678,
396,
474,
29889,
29872,
29889,
7621,
278,
4608,
3309,
29892,
278,
266,
6541,
278,
1196,
13,
1678,
396,
14402,
451,
1854,
2020,
29365,
3639,
1422,
8267,
13,
1678,
4608,
29918,
12324,
29879,
353,
7442,
29889,
3676,
29898,
4419,
29961,
29900,
29962,
1068,
29906,
718,
343,
29891,
29961,
29900,
29962,
1068,
29906,
29897,
13,
1678,
301,
29893,
353,
29871,
29900,
29889,
29906,
29945,
718,
29871,
29941,
29930,
8111,
29918,
12324,
29879,
29914,
8111,
29918,
12324,
29879,
29889,
3317,
580,
13,
13,
1678,
396,
6492,
278,
8576,
21760,
13,
1678,
4853,
29889,
5461,
5317,
29898,
13,
9651,
921,
29918,
7720,
29892,
343,
29918,
7720,
29892,
13,
9651,
15473,
29961,
29900,
1402,
343,
29891,
29961,
29900,
1402,
13,
9651,
1196,
2103,
353,
301,
29893,
29892,
13,
9651,
16578,
2311,
353,
29871,
29896,
29889,
29906,
29892,
13,
9651,
9027,
353,
29871,
29896,
13,
9651,
1723,
13,
13,
1678,
736,
4853,
13,
13,
1753,
6492,
29918,
3396,
7295,
13,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
580,
13,
13,
1678,
4853,
353,
6492,
29918,
21646,
29918,
637,
8356,
29898,
13,
9651,
4853,
29892,
13,
9651,
29365,
1839,
23749,
7464,
13,
9651,
313,
13,
18884,
313,
448,
9302,
29889,
1631,
29892,
7442,
29889,
1631,
10353,
13,
18884,
313,
448,
29906,
29930,
9302,
29889,
1631,
29892,
29871,
29906,
29930,
9302,
29889,
1631,
29897,
13,
18884,
10353,
13,
9651,
6389,
353,
313,
29871,
29945,
29892,
29871,
29896,
10353,
13,
9651,
1723,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
13,
1678,
6492,
29918,
3396,
580,
13,
2
] |
lecture09/btree/fingersearchtree.py | vaibhavminde/Deep-Learning-MITOCW | 12 | 174199 | """
Augmented B-Tree: Insertion
---------------------------
This folder contains an implementation of an augmented B-tree.
For this implementation, the tree only stores data in its leaf
nodes. Each node also has level-set pointers defined here which
access the left and right siblings of each node (or None if they do not exist).
Each node also has a min/max key which store the minimum and maximum values
stored in the node or its children if it's not a leaf.
This implementation is optimized for finger-searching, i.e. finding a particular
value starting at a given node
"""
from remove import BTreeDeleteNode as BTreeNode
class FingerSearchBTree(object):
"""
B-tree class using the augmented nodes
that satisfy the finger-search property
"""
def __init__(self, T, t):
self.type = T
self.root = None
self.t = t
def _type_check(self, key):
"""
Type check if the a key is the right type
for the tree
"""
if not isinstance(key, self.type):
raise TypeError(
'{} is not the correct type'.format(key))
def search(self, key):
"""
Search the B-tree for the node
containing a provided key
"""
self._type_check(key)
if self.root is None:
return None
return self.root.search(key)
def insert(self, key):
"""
Insert a provided key into the tree
"""
self._type_check(key)
if self.root is None:
self.root = BTreeNode(self.t)
self.root = self.root.insert(key)
def remove(self, key):
"""
Remove a key from the tree
"""
self._type_check(key)
if self.root is None:
raise KeyError(
'key {} is not in B-tree'.format(key))
self.root = self.root.remove(key)
def traverse(self):
"""
Traverse the tree and return the values inorder
"""
if self.root is None:
return ''
return self.root.traverse()
def finger_search(self, src, dst):
"""
Search for a node, dst, from a key or from a provided node
This tree obeys the finger-search property, meaning
that this takes no more than O(log(abs(rank(src) - rank(dst))))
"""
if isinstance(src, self.type):
src = self.search(src)
if src is None:
raise KeyError(
'{} is not in B-tree'.format(src))
if not isinstance(src, BTreeNode):
raise TypeError(
'Unexcepted 1st argument to finger_search')
if src.min <= dst and dst <= src.max:
return src.search(dst)
if dst < src.min:
src = src.left
elif dst > src.max:
src = src.right
src = src.parent
if src is None:
return None
return self.finger_search(src, dst)
| [
1,
9995,
13,
29909,
688,
358,
287,
350,
29899,
9643,
29901,
24505,
291,
13,
2683,
1378,
5634,
13,
4013,
4138,
3743,
385,
5314,
310,
385,
18765,
287,
350,
29899,
8336,
29889,
13,
2831,
445,
5314,
29892,
278,
5447,
871,
14422,
848,
297,
967,
20447,
13,
18010,
29889,
7806,
2943,
884,
756,
3233,
29899,
842,
12589,
3342,
1244,
607,
13,
5943,
278,
2175,
322,
1492,
27767,
18964,
310,
1269,
2943,
313,
272,
6213,
565,
896,
437,
451,
1863,
467,
13,
9760,
2943,
884,
756,
263,
1375,
29914,
3317,
1820,
607,
3787,
278,
9212,
322,
7472,
1819,
13,
303,
4395,
297,
278,
2943,
470,
967,
4344,
565,
372,
29915,
29879,
451,
263,
20447,
29889,
13,
13,
4013,
5314,
338,
27545,
363,
19917,
29899,
4478,
292,
29892,
474,
29889,
29872,
29889,
9138,
263,
3153,
13,
1767,
6257,
472,
263,
2183,
2943,
13,
13,
15945,
29908,
13,
13,
13,
3166,
3349,
1053,
350,
9643,
12498,
4247,
408,
350,
9643,
4247,
13,
13,
13,
1990,
383,
5621,
7974,
29933,
9643,
29898,
3318,
1125,
13,
29871,
9995,
13,
29871,
350,
29899,
8336,
770,
773,
278,
18765,
287,
7573,
13,
29871,
393,
15523,
278,
19917,
29899,
4478,
2875,
13,
13,
29871,
9995,
13,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
323,
29892,
260,
1125,
13,
1678,
1583,
29889,
1853,
353,
323,
13,
1678,
1583,
29889,
4632,
353,
6213,
13,
1678,
1583,
29889,
29873,
353,
260,
13,
13,
29871,
822,
903,
1853,
29918,
3198,
29898,
1311,
29892,
1820,
1125,
13,
1678,
9995,
13,
1678,
5167,
1423,
565,
278,
263,
1820,
338,
278,
1492,
1134,
13,
1678,
363,
278,
5447,
13,
13,
1678,
9995,
13,
1678,
565,
451,
338,
8758,
29898,
1989,
29892,
1583,
29889,
1853,
1125,
13,
418,
12020,
20948,
29898,
13,
4706,
525,
8875,
338,
451,
278,
1959,
1134,
4286,
4830,
29898,
1989,
876,
13,
13,
29871,
822,
2740,
29898,
1311,
29892,
1820,
1125,
13,
1678,
9995,
13,
1678,
11856,
278,
350,
29899,
8336,
363,
278,
2943,
13,
1678,
6943,
263,
4944,
1820,
13,
13,
1678,
9995,
13,
1678,
1583,
3032,
1853,
29918,
3198,
29898,
1989,
29897,
13,
1678,
565,
1583,
29889,
4632,
338,
6213,
29901,
13,
418,
736,
6213,
13,
1678,
736,
1583,
29889,
4632,
29889,
4478,
29898,
1989,
29897,
13,
13,
29871,
822,
4635,
29898,
1311,
29892,
1820,
1125,
13,
1678,
9995,
13,
1678,
24505,
263,
4944,
1820,
964,
278,
5447,
13,
13,
1678,
9995,
13,
1678,
1583,
3032,
1853,
29918,
3198,
29898,
1989,
29897,
13,
1678,
565,
1583,
29889,
4632,
338,
6213,
29901,
13,
418,
1583,
29889,
4632,
353,
350,
9643,
4247,
29898,
1311,
29889,
29873,
29897,
13,
1678,
1583,
29889,
4632,
353,
1583,
29889,
4632,
29889,
7851,
29898,
1989,
29897,
13,
13,
29871,
822,
3349,
29898,
1311,
29892,
1820,
1125,
13,
1678,
9995,
13,
1678,
15154,
263,
1820,
515,
278,
5447,
13,
13,
1678,
9995,
13,
1678,
1583,
3032,
1853,
29918,
3198,
29898,
1989,
29897,
13,
1678,
565,
1583,
29889,
4632,
338,
6213,
29901,
13,
418,
12020,
7670,
2392,
29898,
13,
3986,
525,
1989,
6571,
338,
451,
297,
350,
29899,
8336,
4286,
4830,
29898,
1989,
876,
13,
1678,
1583,
29889,
4632,
353,
1583,
29889,
4632,
29889,
5992,
29898,
1989,
29897,
13,
13,
29871,
822,
29370,
29898,
1311,
1125,
13,
1678,
9995,
13,
1678,
3201,
3901,
278,
5447,
322,
736,
278,
1819,
297,
2098,
13,
13,
1678,
9995,
13,
1678,
565,
1583,
29889,
4632,
338,
6213,
29901,
13,
418,
736,
6629,
13,
1678,
736,
1583,
29889,
4632,
29889,
3018,
3901,
580,
13,
13,
29871,
822,
19917,
29918,
4478,
29898,
1311,
29892,
4765,
29892,
29743,
1125,
13,
1678,
9995,
13,
1678,
11856,
363,
263,
2943,
29892,
29743,
29892,
515,
263,
1820,
470,
515,
263,
4944,
2943,
13,
13,
1678,
910,
5447,
704,
29872,
952,
278,
19917,
29899,
4478,
2875,
29892,
6593,
13,
1678,
393,
445,
4893,
694,
901,
1135,
438,
29898,
1188,
29898,
6897,
29898,
10003,
29898,
4351,
29897,
448,
7115,
29898,
22992,
13697,
13,
13,
1678,
9995,
13,
1678,
565,
338,
8758,
29898,
4351,
29892,
1583,
29889,
1853,
1125,
13,
418,
4765,
353,
1583,
29889,
4478,
29898,
4351,
29897,
13,
418,
565,
4765,
338,
6213,
29901,
13,
4706,
12020,
7670,
2392,
29898,
13,
3986,
525,
8875,
338,
451,
297,
350,
29899,
8336,
4286,
4830,
29898,
4351,
876,
13,
1678,
565,
451,
338,
8758,
29898,
4351,
29892,
350,
9643,
4247,
1125,
13,
418,
12020,
20948,
29898,
13,
4706,
525,
29965,
13996,
1547,
287,
29871,
29896,
303,
2980,
304,
19917,
29918,
4478,
1495,
13,
1678,
565,
4765,
29889,
1195,
5277,
29743,
322,
29743,
5277,
4765,
29889,
3317,
29901,
13,
418,
736,
4765,
29889,
4478,
29898,
22992,
29897,
13,
1678,
565,
29743,
529,
4765,
29889,
1195,
29901,
13,
418,
4765,
353,
4765,
29889,
1563,
13,
1678,
25342,
29743,
1405,
4765,
29889,
3317,
29901,
13,
418,
4765,
353,
4765,
29889,
1266,
13,
1678,
4765,
353,
4765,
29889,
3560,
13,
1678,
565,
4765,
338,
6213,
29901,
13,
418,
736,
6213,
13,
1678,
736,
1583,
29889,
29888,
5621,
29918,
4478,
29898,
4351,
29892,
29743,
29897,
13,
2
] |
babysploit/wpseku/lib/printer.py | kevinsegal/BabySploit | 0 | 47317 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# WPSeku - Wordpress Security Scanner
# by <NAME> (m4ll0k)
from lib.colors import *
def decode(string):
return string.encode('utf-8')
def plus(string):
print("{}[ + ]{} {}{}{}".format(
GREEN%1,RESET,GREEN%0,string,RESET))
def test(string):
print("{}[ * ]{} {}{}{}".format(
BLUE%1,RESET,WHITE%0,string,RESET))
def warn(string):
print("{}[ ! ]{} {}{}{}".format(
RED%1,RESET,RED%0,string,RESET))
def info(string):
print("{}[ i ]{} {}{}{}".format(
YELLOW%1,RESET,YELLOW%0,string,RESET))
def normal(string):
print("{}{}{}".format(WHITE%1,string,RESET))
def more(string):
print(" {}|{} {}{}{}".format(
WHITE%0,RESET,WHITE%1,string,RESET))
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
13,
29937,
399,
7024,
1416,
29884,
448,
10803,
2139,
14223,
23412,
29871,
13,
29937,
491,
529,
5813,
29958,
313,
29885,
29946,
645,
29900,
29895,
29897,
13,
13,
3166,
4303,
29889,
27703,
1053,
334,
13,
13,
13,
1753,
21822,
29898,
1807,
1125,
13,
12,
2457,
1347,
29889,
12508,
877,
9420,
29899,
29947,
1495,
13,
13,
1753,
2298,
29898,
1807,
1125,
13,
12,
2158,
703,
29912,
4400,
718,
29871,
3199,
29913,
426,
1157,
1157,
29913,
1642,
4830,
29898,
13,
12,
12,
29954,
1525,
1430,
29995,
29896,
29892,
1525,
10490,
29892,
29954,
1525,
1430,
29995,
29900,
29892,
1807,
29892,
1525,
10490,
876,
13,
13,
1753,
1243,
29898,
1807,
1125,
13,
12,
2158,
703,
29912,
4400,
334,
29871,
3199,
29913,
426,
1157,
1157,
29913,
1642,
4830,
29898,
13,
12,
12,
13367,
4462,
29995,
29896,
29892,
1525,
10490,
29892,
25039,
9094,
29995,
29900,
29892,
1807,
29892,
1525,
10490,
876,
13,
13,
1753,
29383,
29898,
1807,
1125,
13,
12,
2158,
703,
29912,
4400,
1738,
29871,
3199,
29913,
426,
1157,
1157,
29913,
1642,
4830,
29898,
13,
12,
12,
19386,
29995,
29896,
29892,
1525,
10490,
29892,
19386,
29995,
29900,
29892,
1807,
29892,
1525,
10490,
876,
13,
13,
1753,
5235,
29898,
1807,
1125,
13,
12,
2158,
703,
29912,
4400,
474,
29871,
3199,
29913,
426,
1157,
1157,
29913,
1642,
4830,
29898,
13,
12,
12,
29979,
29923,
2208,
9806,
29995,
29896,
29892,
1525,
10490,
29892,
29979,
29923,
2208,
9806,
29995,
29900,
29892,
1807,
29892,
1525,
10490,
876,
13,
13,
1753,
4226,
29898,
1807,
1125,
13,
12,
2158,
703,
29912,
1157,
1157,
29913,
1642,
4830,
29898,
25039,
9094,
29995,
29896,
29892,
1807,
29892,
1525,
10490,
876,
13,
13,
1753,
901,
29898,
1807,
1125,
13,
12,
2158,
703,
29871,
6571,
29989,
8875,
259,
426,
1157,
1157,
29913,
1642,
4830,
29898,
13,
12,
12,
25039,
9094,
29995,
29900,
29892,
1525,
10490,
29892,
25039,
9094,
29995,
29896,
29892,
1807,
29892,
1525,
10490,
876,
13,
2
] |
tellurium/optimization/__init__.py | stanleygu/tellurium | 0 | 170718 | <filename>tellurium/optimization/__init__.py
from DiffEvolution import DiffEvolution
| [
1,
529,
9507,
29958,
29873,
514,
332,
1974,
29914,
20640,
2133,
29914,
1649,
2344,
26914,
2272,
13,
3166,
360,
2593,
29923,
4068,
1053,
360,
2593,
29923,
4068,
13,
2
] |
LeetCode/Python3/BinaryTree/331. Verify Preorder Serialization of a Binary Tree.py | WatsonWangZh/CodingPractice | 11 | 158407 | <gh_stars>10-100
# One way to serialize a binary tree is to use pre-order traversal.
# When we encounter a non-null node, we record the node's value. If it is a null node,
# we record using a sentinel value such as #.
# _9_
# / \
# 3 2
# / \ / \
# 4 1 # 6
# / \ / \ / \
# # # # # # #
# For example, the above binary tree can be serialized to the string "9,3,4,#,#,1,#,#,2,#,6,#,#",
# where # represents a null node.
# Given a string of comma separated values, verify whether it is a correct
# preorder traversal serialization of a binary tree. Find an algorithm without
# reconstructing the tree.
# Each comma separated value in the string must be either an integer
# or a character '#' representing null pointer.
# You may assume that the input format is always valid,
# for example it could never contain two consecutive commas such as "1,,3".
# Example 1:
# Input: "9,3,4,#,#,1,#,#,2,#,6,#,#"
# Output: true
# Example 2:
# Input: "1,#"
# Output: false
# Example 3:
# Input: "9,#,#,1"
# Output: false
class Solution(object):
def isValidSerialization(self, preorder):
"""
:type preorder: str
:rtype: bool
"""
# M1. 出度入度之差
# 入度等于出度
# 根节点:0个入度,2个出度;其他非空结点:1个入度,2个出度;空节点:1个入度,0个出度。
# 应保证出度-入度始终≥0,且最终差值为0。
# 遍历到每个结点时,因为入度为1,所以diff -= 1(考虑头结点,diff初始化为1)。
# 如果非空,因为出度为2,所以diff += 2。
diff = 1
preorder = preorder.split(',')
for x in preorder:
diff -= 1
if diff < 0:
return False
if x != '#':
diff += 2
return diff == 0
# M2. 栈
'''
不断的砍掉叶子节点,最后看能不能全部砍掉。
遇到x # #的时候,就把它变为 #
“9,3,4,#,#,1,#,#,2,#,6,#,#” 为例
模拟过程:
9,3,4,#,# => 9,3,# 继续读
9,3,#,1,#,# => 9,3,#,# => 9,# 继续读
9,#2,#,6,#,# => 9,#,2,#,# => 9,#,# => #
'''
preorder = preorder.split(',')
stack = []
for x in preorder:
stack.append(x)
while len(stack) >= 3 and stack[-2:] == ['#','#'] and stack[-3] != '#':
stack[-3:] = '#'
return stack == ['#']
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
29937,
3118,
982,
304,
28755,
263,
7581,
5447,
338,
304,
671,
758,
29899,
2098,
13310,
284,
29889,
29871,
13,
29937,
1932,
591,
11735,
263,
1661,
29899,
4304,
2943,
29892,
591,
2407,
278,
2943,
29915,
29879,
995,
29889,
960,
372,
338,
263,
1870,
2943,
29892,
29871,
13,
29937,
591,
2407,
773,
263,
2665,
262,
295,
995,
1316,
408,
396,
29889,
13,
29937,
418,
903,
29929,
29918,
13,
29937,
268,
847,
259,
320,
13,
29937,
268,
29941,
418,
29906,
13,
29937,
259,
847,
320,
259,
847,
320,
13,
29937,
259,
29946,
1678,
29896,
29871,
396,
259,
29953,
13,
29937,
847,
320,
847,
320,
259,
847,
320,
13,
29937,
396,
396,
396,
396,
259,
396,
396,
13,
29937,
1152,
1342,
29892,
278,
2038,
7581,
5447,
508,
367,
7797,
1891,
304,
278,
1347,
376,
29929,
29892,
29941,
29892,
29946,
29892,
6552,
6552,
29896,
29892,
6552,
6552,
29906,
29892,
6552,
29953,
29892,
6552,
29937,
613,
29871,
13,
29937,
988,
396,
11524,
263,
1870,
2943,
29889,
13,
29937,
11221,
263,
1347,
310,
16694,
13055,
1819,
29892,
11539,
3692,
372,
338,
263,
1959,
29871,
13,
29937,
758,
2098,
13310,
284,
7797,
2133,
310,
263,
7581,
5447,
29889,
10987,
385,
5687,
1728,
29871,
13,
29937,
337,
11433,
292,
278,
5447,
29889,
13,
29937,
7806,
16694,
13055,
995,
297,
278,
1347,
1818,
367,
2845,
385,
6043,
29871,
13,
29937,
470,
263,
2931,
16321,
29915,
15783,
1870,
4879,
29889,
13,
29937,
887,
1122,
5251,
393,
278,
1881,
3402,
338,
2337,
2854,
29892,
29871,
13,
29937,
363,
1342,
372,
1033,
2360,
1712,
1023,
18942,
844,
294,
1316,
408,
376,
29896,
12985,
29941,
1642,
13,
13,
29937,
8741,
29871,
29896,
29901,
13,
29937,
10567,
29901,
376,
29929,
29892,
29941,
29892,
29946,
29892,
6552,
6552,
29896,
29892,
6552,
6552,
29906,
29892,
6552,
29953,
29892,
6552,
29937,
29908,
13,
29937,
10604,
29901,
1565,
13,
13,
29937,
8741,
29871,
29906,
29901,
13,
29937,
10567,
29901,
376,
29896,
29892,
29937,
29908,
13,
29937,
10604,
29901,
2089,
13,
13,
29937,
8741,
29871,
29941,
29901,
13,
29937,
10567,
29901,
376,
29929,
29892,
6552,
6552,
29896,
29908,
13,
29937,
10604,
29901,
2089,
13,
13,
1990,
24380,
29898,
3318,
1125,
13,
1678,
822,
338,
7211,
9125,
2133,
29898,
1311,
29892,
758,
2098,
1125,
13,
4706,
9995,
13,
4706,
584,
1853,
758,
2098,
29901,
851,
13,
4706,
584,
29878,
1853,
29901,
6120,
13,
4706,
9995,
13,
4706,
396,
341,
29896,
29889,
29871,
30544,
30898,
30752,
30898,
30577,
232,
186,
177,
29871,
13,
4706,
396,
29871,
30752,
30898,
31184,
30909,
30544,
30898,
13,
4706,
396,
29871,
31393,
31669,
30940,
30383,
29900,
30502,
30752,
30898,
30214,
29906,
30502,
30544,
30898,
31608,
31149,
31221,
31838,
30816,
31320,
30940,
30383,
29896,
30502,
30752,
30898,
30214,
29906,
30502,
30544,
30898,
31608,
30816,
31669,
30940,
30383,
29896,
30502,
30752,
30898,
30214,
29900,
30502,
30544,
30898,
30267,
13,
4706,
396,
29871,
31370,
30982,
235,
178,
132,
30544,
30898,
29899,
30752,
30898,
31020,
234,
190,
139,
30386,
29900,
30214,
231,
187,
151,
30878,
234,
190,
139,
232,
186,
177,
30959,
30573,
29900,
30267,
13,
4706,
396,
29871,
236,
132,
144,
232,
145,
137,
30780,
31951,
30502,
31320,
30940,
30594,
30214,
31570,
30573,
30752,
30898,
30573,
29896,
30214,
30744,
30651,
12765,
22361,
29871,
29896,
30419,
235,
131,
134,
235,
156,
148,
31584,
31320,
30940,
30214,
12765,
31120,
31020,
30705,
30573,
29896,
30409,
30267,
13,
4706,
396,
29871,
30847,
30801,
31838,
30816,
30214,
31570,
30573,
30544,
30898,
30573,
29906,
30214,
30744,
30651,
12765,
4619,
29871,
29906,
30267,
13,
13,
4706,
2923,
353,
29871,
29896,
13,
4706,
758,
2098,
353,
758,
2098,
29889,
5451,
29317,
1495,
13,
4706,
363,
921,
297,
758,
2098,
29901,
13,
9651,
2923,
22361,
29871,
29896,
13,
9651,
565,
2923,
529,
29871,
29900,
29901,
13,
18884,
736,
7700,
13,
9651,
565,
921,
2804,
16321,
2396,
13,
18884,
2923,
4619,
29871,
29906,
13,
4706,
736,
2923,
1275,
29871,
29900,
13,
13,
4706,
396,
341,
29906,
29889,
29871,
233,
163,
139,
13,
4706,
14550,
13,
308,
30413,
31683,
30210,
234,
163,
144,
233,
145,
140,
232,
146,
185,
30319,
31669,
30940,
30214,
30878,
30822,
31811,
30815,
30413,
30815,
30753,
30636,
234,
163,
144,
233,
145,
140,
30267,
13,
308,
236,
132,
138,
30780,
29916,
396,
396,
30210,
30594,
31974,
30214,
31238,
233,
141,
141,
232,
177,
134,
31462,
30573,
396,
13,
4706,
1346,
29929,
29892,
29941,
29892,
29946,
29892,
6552,
6552,
29896,
29892,
6552,
6552,
29906,
29892,
6552,
29953,
29892,
6552,
29937,
30024,
29871,
30573,
31507,
13,
308,
31382,
233,
142,
162,
31138,
31101,
30383,
13,
308,
29929,
29892,
29941,
29892,
29946,
29892,
6552,
29937,
1149,
29871,
29929,
29892,
29941,
29892,
29937,
29871,
234,
190,
170,
234,
190,
176,
235,
178,
190,
13,
308,
29929,
29892,
29941,
29892,
6552,
29896,
29892,
6552,
29937,
1149,
29871,
29929,
29892,
29941,
29892,
6552,
29937,
1149,
29871,
29929,
29892,
29937,
29871,
234,
190,
170,
234,
190,
176,
235,
178,
190,
13,
308,
29929,
29892,
29937,
29906,
29892,
6552,
29953,
29892,
6552,
29937,
1149,
29871,
29929,
29892,
6552,
29906,
29892,
6552,
29937,
1149,
29871,
29929,
29892,
6552,
29937,
1149,
396,
29871,
13,
4706,
14550,
13,
4706,
758,
2098,
353,
758,
2098,
29889,
5451,
29317,
1495,
13,
4706,
5096,
353,
5159,
13,
4706,
363,
921,
297,
758,
2098,
29901,
13,
9651,
5096,
29889,
4397,
29898,
29916,
29897,
13,
9651,
1550,
7431,
29898,
1429,
29897,
6736,
29871,
29941,
322,
5096,
14352,
29906,
17531,
1275,
6024,
29937,
3788,
29937,
2033,
322,
5096,
14352,
29941,
29962,
2804,
16321,
2396,
13,
18884,
5096,
14352,
29941,
17531,
353,
16321,
29915,
13,
4706,
736,
5096,
1275,
6024,
29937,
2033,
13,
2
] |
src/typeDefs/lineFlowSumm.py | nagasudhirpulla/wrldc_scada_mumbai_dashboard | 0 | 14051 | <filename>src/typeDefs/lineFlowSumm.py
from typing import TypedDict
class ILineFlowSumm(TypedDict):
inst: dict
maxFlow: dict
maxTime: dict
| [
1,
529,
9507,
29958,
4351,
29914,
1853,
3206,
29879,
29914,
1220,
17907,
11139,
29885,
29889,
2272,
13,
3166,
19229,
1053,
14213,
287,
21533,
13,
13,
13,
1990,
306,
3542,
17907,
11139,
29885,
29898,
24933,
287,
21533,
1125,
13,
1678,
832,
29901,
9657,
13,
1678,
4236,
17907,
29901,
9657,
13,
1678,
4236,
2481,
29901,
9657,
13,
2
] |
blipy/Postmasters/__AI.py | liviaalmeida/blipy | 0 | 1611827 | from blipy.Http import Postmaster
INTENTS = '/intentions'
class AIPostmaster(Postmaster):
def __init__(self, authorization):
super().__init__(authorization, 'ai')
def getIntent(self, intentId):
return super().Get(f'{INTENTS}/{intentId}?deep=true')
def getIntents(self):
return super().GetAll(f'{INTENTS}')
def getEntity(self, entityId):
return super().Get(f'/entities/{entityId}')
| [
1,
515,
289,
492,
2272,
29889,
5506,
1053,
4918,
6207,
13,
13,
10192,
3919,
29903,
353,
8207,
14029,
1080,
29915,
13,
13,
1990,
319,
5690,
520,
6207,
29898,
6747,
6207,
1125,
13,
12,
1753,
4770,
2344,
12035,
1311,
29892,
28733,
1125,
13,
12,
12,
9136,
2141,
1649,
2344,
12035,
8921,
2133,
29892,
525,
1794,
1495,
13,
12,
13,
12,
1753,
679,
10286,
29898,
1311,
29892,
7609,
1204,
1125,
13,
12,
12,
2457,
2428,
2141,
2577,
29898,
29888,
29915,
29912,
10192,
3919,
29903,
6822,
29912,
14029,
1204,
29913,
29973,
24535,
29922,
3009,
1495,
13,
13,
12,
1753,
679,
2928,
1237,
29898,
1311,
1125,
13,
12,
12,
2457,
2428,
2141,
2577,
3596,
29898,
29888,
29915,
29912,
10192,
3919,
29903,
29913,
1495,
13,
13,
12,
1753,
679,
6691,
29898,
1311,
29892,
7855,
1204,
1125,
13,
12,
12,
2457,
2428,
2141,
2577,
29898,
29888,
29915,
29914,
296,
1907,
19248,
10041,
1204,
29913,
1495,
13,
2
] |
tests/sms/integration/test_reschedule_and_update_cases.py | infobip-community/infobip-api-python-sdk | 0 | 174403 | from pytest_cases import parametrize
from tests.conftest import get_expected_put_headers
from tests.sms.conftest import (
GenerateRescheduleSMSMessagesFactory,
GenerateUpdateScheduledSMSMessagesStatusFactory,
get_reschedule_sms_messages_query_parameters,
get_scheduled_sms_messages_response,
get_sms_request_error_response,
get_update_scheduled_sms_messages_status_response,
)
ENDPOINT_TEST_ARGUMENTS = {
"reschedule_sms_messages": {
"endpoint": "/sms/1/bulks",
"http_method": "PUT",
"expected_headers": get_expected_put_headers(),
"expected_path_parameters": None,
"expected_query_parameters": "bulkId=35122736310703571952",
"expected_json": GenerateRescheduleSMSMessagesFactory,
"request_query_parameters": get_reschedule_sms_messages_query_parameters(),
"method_name": "reschedule_sms_messages",
},
"update_scheduled_sms_messages_status": {
"endpoint": "/sms/1/bulks/status",
"http_method": "PUT",
"expected_headers": get_expected_put_headers(),
"expected_path_parameters": None,
"expected_query_parameters": "bulkId=35122736310703571952",
"expected_json": GenerateUpdateScheduledSMSMessagesStatusFactory,
"request_query_parameters": get_reschedule_sms_messages_query_parameters(),
"method_name": "update_scheduled_sms_messages_status",
},
}
@parametrize(
endpoint_type=ENDPOINT_TEST_ARGUMENTS.keys(),
responses=(
[200, get_scheduled_sms_messages_response],
[400, get_sms_request_error_response],
),
)
def case__supported_status(endpoint_type, responses):
status_code = responses[0]
response_content = responses[1]
if endpoint_type == "update_scheduled_sms_messages_status" and responses[0] == 200:
response_content = get_update_scheduled_sms_messages_status_response
return (
status_code,
response_content(),
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["endpoint"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["http_method"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_headers"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_path_parameters"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_query_parameters"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_json"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["request_query_parameters"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["method_name"],
)
@parametrize(endpoint_type=ENDPOINT_TEST_ARGUMENTS.keys())
def case__unsupported_status(endpoint_type):
return (
201,
get_sms_request_error_response(),
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["endpoint"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["http_method"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_headers"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_path_parameters"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_query_parameters"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["expected_json"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["request_query_parameters"],
ENDPOINT_TEST_ARGUMENTS[endpoint_type]["method_name"],
)
| [
1,
515,
11451,
1688,
29918,
11436,
1053,
25011,
374,
911,
13,
13,
3166,
6987,
29889,
535,
615,
342,
1053,
679,
29918,
9684,
29918,
649,
29918,
13662,
13,
3166,
6987,
29889,
29879,
1516,
29889,
535,
615,
342,
1053,
313,
13,
1678,
3251,
403,
1666,
305,
11272,
29903,
4345,
25510,
5126,
29892,
13,
1678,
3251,
403,
6422,
4504,
14989,
29903,
4345,
25510,
5709,
5126,
29892,
13,
1678,
679,
29918,
690,
305,
11272,
29918,
29879,
1516,
29918,
19158,
29918,
1972,
29918,
16744,
29892,
13,
1678,
679,
29918,
816,
14989,
29918,
29879,
1516,
29918,
19158,
29918,
5327,
29892,
13,
1678,
679,
29918,
29879,
1516,
29918,
3827,
29918,
2704,
29918,
5327,
29892,
13,
1678,
679,
29918,
5504,
29918,
816,
14989,
29918,
29879,
1516,
29918,
19158,
29918,
4882,
29918,
5327,
29892,
13,
29897,
13,
13,
1430,
11191,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
353,
426,
13,
1678,
376,
690,
305,
11272,
29918,
29879,
1516,
29918,
19158,
1115,
426,
13,
4706,
376,
29734,
1115,
5591,
29879,
1516,
29914,
29896,
29914,
8645,
2039,
613,
13,
4706,
376,
1124,
29918,
5696,
1115,
376,
12336,
613,
13,
4706,
376,
9684,
29918,
13662,
1115,
679,
29918,
9684,
29918,
649,
29918,
13662,
3285,
13,
4706,
376,
9684,
29918,
2084,
29918,
16744,
1115,
6213,
29892,
13,
4706,
376,
9684,
29918,
1972,
29918,
16744,
1115,
376,
8645,
29895,
1204,
29922,
29941,
29945,
29896,
29906,
29906,
29955,
29941,
29953,
29941,
29896,
29900,
29955,
29900,
29941,
29945,
29955,
29896,
29929,
29945,
29906,
613,
13,
4706,
376,
9684,
29918,
3126,
1115,
3251,
403,
1666,
305,
11272,
29903,
4345,
25510,
5126,
29892,
13,
4706,
376,
3827,
29918,
1972,
29918,
16744,
1115,
679,
29918,
690,
305,
11272,
29918,
29879,
1516,
29918,
19158,
29918,
1972,
29918,
16744,
3285,
13,
4706,
376,
5696,
29918,
978,
1115,
376,
690,
305,
11272,
29918,
29879,
1516,
29918,
19158,
613,
13,
1678,
2981,
13,
1678,
376,
5504,
29918,
816,
14989,
29918,
29879,
1516,
29918,
19158,
29918,
4882,
1115,
426,
13,
4706,
376,
29734,
1115,
5591,
29879,
1516,
29914,
29896,
29914,
8645,
2039,
29914,
4882,
613,
13,
4706,
376,
1124,
29918,
5696,
1115,
376,
12336,
613,
13,
4706,
376,
9684,
29918,
13662,
1115,
679,
29918,
9684,
29918,
649,
29918,
13662,
3285,
13,
4706,
376,
9684,
29918,
2084,
29918,
16744,
1115,
6213,
29892,
13,
4706,
376,
9684,
29918,
1972,
29918,
16744,
1115,
376,
8645,
29895,
1204,
29922,
29941,
29945,
29896,
29906,
29906,
29955,
29941,
29953,
29941,
29896,
29900,
29955,
29900,
29941,
29945,
29955,
29896,
29929,
29945,
29906,
613,
13,
4706,
376,
9684,
29918,
3126,
1115,
3251,
403,
6422,
4504,
14989,
29903,
4345,
25510,
5709,
5126,
29892,
13,
4706,
376,
3827,
29918,
1972,
29918,
16744,
1115,
679,
29918,
690,
305,
11272,
29918,
29879,
1516,
29918,
19158,
29918,
1972,
29918,
16744,
3285,
13,
4706,
376,
5696,
29918,
978,
1115,
376,
5504,
29918,
816,
14989,
29918,
29879,
1516,
29918,
19158,
29918,
4882,
613,
13,
1678,
2981,
13,
29913,
13,
13,
13,
29992,
3207,
300,
374,
911,
29898,
13,
1678,
16248,
29918,
1853,
29922,
1430,
11191,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29889,
8149,
3285,
13,
1678,
20890,
7607,
13,
4706,
518,
29906,
29900,
29900,
29892,
679,
29918,
816,
14989,
29918,
29879,
1516,
29918,
19158,
29918,
5327,
1402,
13,
4706,
518,
29946,
29900,
29900,
29892,
679,
29918,
29879,
1516,
29918,
3827,
29918,
2704,
29918,
5327,
1402,
13,
1678,
10353,
13,
29897,
13,
1753,
1206,
1649,
23765,
29918,
4882,
29898,
29734,
29918,
1853,
29892,
20890,
1125,
13,
1678,
4660,
29918,
401,
353,
20890,
29961,
29900,
29962,
13,
1678,
2933,
29918,
3051,
353,
20890,
29961,
29896,
29962,
13,
13,
1678,
565,
16248,
29918,
1853,
1275,
376,
5504,
29918,
816,
14989,
29918,
29879,
1516,
29918,
19158,
29918,
4882,
29908,
322,
20890,
29961,
29900,
29962,
1275,
29871,
29906,
29900,
29900,
29901,
13,
4706,
2933,
29918,
3051,
353,
679,
29918,
5504,
29918,
816,
14989,
29918,
29879,
1516,
29918,
19158,
29918,
4882,
29918,
5327,
13,
13,
1678,
736,
313,
13,
4706,
4660,
29918,
401,
29892,
13,
4706,
2933,
29918,
3051,
3285,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
29734,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
1124,
29918,
5696,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
13662,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
2084,
29918,
16744,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
1972,
29918,
16744,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
3126,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
3827,
29918,
1972,
29918,
16744,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
5696,
29918,
978,
12436,
13,
1678,
1723,
13,
13,
13,
29992,
3207,
300,
374,
911,
29898,
29734,
29918,
1853,
29922,
1430,
11191,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29889,
8149,
3101,
13,
1753,
1206,
1649,
348,
23765,
29918,
4882,
29898,
29734,
29918,
1853,
1125,
13,
1678,
736,
313,
13,
308,
29906,
29900,
29896,
29892,
13,
4706,
679,
29918,
29879,
1516,
29918,
3827,
29918,
2704,
29918,
5327,
3285,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
29734,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
1124,
29918,
5696,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
13662,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
2084,
29918,
16744,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
1972,
29918,
16744,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
9684,
29918,
3126,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
3827,
29918,
1972,
29918,
16744,
12436,
13,
4706,
11056,
29925,
6992,
29911,
29918,
18267,
29918,
1718,
29954,
5005,
3919,
29903,
29961,
29734,
29918,
1853,
29962,
3366,
5696,
29918,
978,
12436,
13,
1678,
1723,
13,
2
] |
app/controller/admin/journal_entry_controller.py | JunFuruya/Ratsnake | 0 | 72819 | # -*- coding: UTF-8 -*-
from app.controller.base_controller import BaseController
from app.validator.journal_entry_validator import JournalEntryValidator
from app.service.journal_entry_service import JournalEntryService
from app.entity.journal_entry_entity import JournalEntryEntity
'''
Journal Entry Controller Controller Module
'''
class JournalEntryController(BaseController):
def __init__(self, request):
super().__init__(request)
self.set_page_info('仕分元帳', '入出金明細を登録します。', '')
self.__user_id = self.get_login_user()
self.__service = JournalEntryService()
self.__validator = JournalEntryValidator()
pass
def index(self):
limit = self.get_param('limit', 10)
offset = self.get_param('offset', 0)
# session をクリアする
self.set_session('journal_entry_id', '')
self.set_session('account_title_id', '')
self.set_session('journal_entry_transaction_date', '')
self.set_session('journal_entry_note', '')
return self.view('./template/admin/journal-entries/list.html', self.__service.getList(self.__user_id, limit, offset))
def create(self):
return self.view('./template/admin/journal-entries/create.html', JournalEntryEntity())
def detail(self, journal_entry_id):
# TODO validation
self.set_session('journal_entry_id', language_id)
return self.view('./template/admin/journal-entries/detail.html', self.__service.get(self.__user_id, journal_entry_id))
def edit(self, journal_entry_id):
language_id = self.get_session('journal_entry_id')
# TODO validation
return self.view('./template/admin/journal-entries/edit.html', self.__service.get(self.__user_id, journal_entry_id))
def confirm(self):
journal_entry_id = self.get_session('journal_entry_id')
account_title_id = self.get_session('account_title_id')
journal_entry_transaction_date = self.get_param('journal_entry_transaction_date')
journal_entry_note = self.get_param('journal_entry_note')
error_messages = self.__validator.get_error_messages(account_title_id, journal_entry_transaction_date, journal_entry_note)
if(len(error_messages) == 0):
self.set_session('journal_entry_id', '')
self.set_session('account_title_id', '')
self.set_session('journal_entry_transaction_date', '')
self.set_session('journal_entry_note', '')
template = './template/admin/journal-entries/confirm.html'
else:
template = './template/admin/journal-entries/create.html'
# TODO Factory Class
entity = JournalEntryEntity()
entity.set_journal_entry_id(journal_entry_id)
entity.set_account_title_id(account_title_id)
entity.set_journal_entry_transaction_date(journal_entry_transaction_date)
entity.set_journal_entry_note(journal_entry_note)
entity.set_error_message(error_messages)
return self.view(template, entity)
def insert(self):
journal_entry_name = self.get_session('journal_entry_name')
# TODO validation
# session をクリアする
self.set_session('journal_entry_id', '')
self.set_session('account_title_id', '')
self.set_session('journal_entry_transaction_date', '')
self.set_session('journal_entry_note', '')
return self.view('./template/admin/journal-entries/complete.html', self.__service.create(self.__user_id, account_title_id, journal_entry_transaction_date, journal_entry_note))
def update(self):
journal_entry_id = self.get_session('journal_entry_id')
account_title_id = self.get_session('account_title_id')
journal_entry_transaction_date = self.get_session('journal_entry_transaction_date')
journal_entry_note = self.get_session('journal_entry_note')
# session をクリアする
self.set_session('journal_entry_id', '')
self.set_session('account_title_id', '')
self.set_session('journal_entry_transaction_date', '')
self.set_session('journal_entry_note', '')
entity = JournalEntryEntity()
entity.set_language_id(self.__service.update(journal_entry_id, self.__user_id, account_title_id, journal_entry_transaction_date, journal_entry_note))
return self.view('./template/admin/journal-entries/complete.html', entity)
def delete(self):
journal_entry_id = self.get_param('journal_entry_id')
# session をクリアする
self.set_session('journal_entry_id', '')
self.set_session('account_title_id', '')
self.set_session('journal_entry_transaction_date', '')
self.set_session('journal_entry_note', '')
entity = JournalEntryEntity()
entity.set_journal_entry_id(self.__service.delete(journal_entry_id, self.__user_id))
return self.view('./template/admin/journal-entries/complete.html', entity) | [
1,
396,
448,
29930,
29899,
14137,
29901,
18351,
29899,
29947,
448,
29930,
29899,
13,
13,
3166,
623,
29889,
8299,
29889,
3188,
29918,
8299,
1053,
7399,
2956,
13,
3166,
623,
29889,
3084,
1061,
29889,
29926,
4659,
29918,
8269,
29918,
3084,
1061,
1053,
8237,
9634,
24204,
13,
3166,
623,
29889,
5509,
29889,
29926,
4659,
29918,
8269,
29918,
5509,
1053,
8237,
9634,
3170,
13,
3166,
623,
29889,
10041,
29889,
29926,
4659,
29918,
8269,
29918,
10041,
1053,
8237,
9634,
6691,
13,
13,
12008,
13,
29967,
4659,
28236,
15830,
15830,
15591,
13,
12008,
13,
1990,
8237,
9634,
2956,
29898,
5160,
2956,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2009,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
3827,
29897,
13,
4706,
1583,
29889,
842,
29918,
3488,
29918,
3888,
877,
231,
190,
152,
30748,
30824,
232,
187,
182,
742,
525,
30752,
30544,
30659,
30592,
234,
183,
179,
30396,
31451,
236,
143,
181,
30326,
30441,
30427,
30267,
742,
27255,
13,
4706,
1583,
17255,
1792,
29918,
333,
353,
1583,
29889,
657,
29918,
7507,
29918,
1792,
580,
13,
4706,
1583,
17255,
5509,
353,
8237,
9634,
3170,
580,
13,
4706,
1583,
17255,
3084,
1061,
353,
8237,
9634,
24204,
580,
13,
4706,
1209,
13,
13,
1678,
822,
2380,
29898,
1311,
1125,
13,
4706,
4046,
353,
1583,
29889,
657,
29918,
3207,
877,
13400,
742,
29871,
29896,
29900,
29897,
13,
4706,
9210,
353,
1583,
29889,
657,
29918,
3207,
877,
10289,
742,
29871,
29900,
29897,
13,
13,
4706,
396,
4867,
29871,
30396,
30305,
30303,
30310,
30427,
30332,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
10149,
29918,
3257,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
6812,
742,
27255,
13,
308,
13,
4706,
736,
1583,
29889,
1493,
877,
6904,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
1761,
29889,
1420,
742,
1583,
17255,
5509,
29889,
657,
1293,
29898,
1311,
17255,
1792,
29918,
333,
29892,
4046,
29892,
9210,
876,
13,
268,
13,
1678,
822,
1653,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
1493,
877,
6904,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
3258,
29889,
1420,
742,
8237,
9634,
6691,
3101,
13,
13,
1678,
822,
9493,
29898,
1311,
29892,
8955,
29918,
8269,
29918,
333,
1125,
13,
4706,
396,
14402,
8845,
13,
308,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
742,
4086,
29918,
333,
29897,
13,
308,
13,
4706,
736,
1583,
29889,
1493,
877,
6904,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
16432,
29889,
1420,
742,
1583,
17255,
5509,
29889,
657,
29898,
1311,
17255,
1792,
29918,
333,
29892,
8955,
29918,
8269,
29918,
333,
876,
13,
13,
1678,
822,
3863,
29898,
1311,
29892,
8955,
29918,
8269,
29918,
333,
1125,
13,
4706,
4086,
29918,
333,
353,
1583,
29889,
657,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
1495,
13,
4706,
396,
14402,
8845,
308,
13,
4706,
736,
1583,
29889,
1493,
877,
6904,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
5628,
29889,
1420,
742,
1583,
17255,
5509,
29889,
657,
29898,
1311,
17255,
1792,
29918,
333,
29892,
8955,
29918,
8269,
29918,
333,
876,
13,
268,
13,
1678,
822,
9659,
29898,
1311,
1125,
13,
4706,
8955,
29918,
8269,
29918,
333,
353,
1583,
29889,
657,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
1495,
13,
4706,
3633,
29918,
3257,
29918,
333,
353,
1583,
29889,
657,
29918,
7924,
877,
10149,
29918,
3257,
29918,
333,
1495,
13,
4706,
8955,
29918,
8269,
29918,
20736,
29918,
1256,
353,
1583,
29889,
657,
29918,
3207,
877,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
1495,
13,
4706,
8955,
29918,
8269,
29918,
6812,
353,
1583,
29889,
657,
29918,
3207,
877,
29926,
4659,
29918,
8269,
29918,
6812,
1495,
13,
13,
4706,
1059,
29918,
19158,
353,
1583,
17255,
3084,
1061,
29889,
657,
29918,
2704,
29918,
19158,
29898,
10149,
29918,
3257,
29918,
333,
29892,
8955,
29918,
8269,
29918,
20736,
29918,
1256,
29892,
8955,
29918,
8269,
29918,
6812,
29897,
13,
4706,
565,
29898,
2435,
29898,
2704,
29918,
19158,
29897,
1275,
29871,
29900,
1125,
13,
9651,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
742,
27255,
13,
9651,
1583,
29889,
842,
29918,
7924,
877,
10149,
29918,
3257,
29918,
333,
742,
27255,
13,
9651,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
742,
27255,
13,
9651,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
6812,
742,
27255,
13,
13,
9651,
4472,
353,
19283,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
26897,
29889,
1420,
29915,
13,
4706,
1683,
29901,
13,
9651,
4472,
353,
19283,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
3258,
29889,
1420,
29915,
13,
308,
13,
4706,
396,
14402,
27561,
4134,
13,
4706,
7855,
353,
8237,
9634,
6691,
580,
13,
4706,
7855,
29889,
842,
29918,
29926,
4659,
29918,
8269,
29918,
333,
29898,
29926,
4659,
29918,
8269,
29918,
333,
29897,
13,
4706,
7855,
29889,
842,
29918,
10149,
29918,
3257,
29918,
333,
29898,
10149,
29918,
3257,
29918,
333,
29897,
13,
4706,
7855,
29889,
842,
29918,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
29898,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
29897,
13,
4706,
7855,
29889,
842,
29918,
29926,
4659,
29918,
8269,
29918,
6812,
29898,
29926,
4659,
29918,
8269,
29918,
6812,
29897,
13,
4706,
7855,
29889,
842,
29918,
2704,
29918,
4906,
29898,
2704,
29918,
19158,
29897,
13,
4706,
736,
1583,
29889,
1493,
29898,
6886,
29892,
7855,
29897,
13,
13,
1678,
822,
4635,
29898,
1311,
1125,
13,
4706,
8955,
29918,
8269,
29918,
978,
353,
1583,
29889,
657,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
978,
1495,
13,
308,
13,
4706,
396,
14402,
8845,
13,
308,
13,
4706,
396,
4867,
29871,
30396,
30305,
30303,
30310,
30427,
30332,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
10149,
29918,
3257,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
6812,
742,
27255,
13,
13,
4706,
736,
1583,
29889,
1493,
877,
6904,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
8835,
29889,
1420,
742,
1583,
17255,
5509,
29889,
3258,
29898,
1311,
17255,
1792,
29918,
333,
29892,
3633,
29918,
3257,
29918,
333,
29892,
8955,
29918,
8269,
29918,
20736,
29918,
1256,
29892,
8955,
29918,
8269,
29918,
6812,
876,
13,
13,
1678,
822,
2767,
29898,
1311,
1125,
13,
4706,
8955,
29918,
8269,
29918,
333,
353,
1583,
29889,
657,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
1495,
13,
4706,
3633,
29918,
3257,
29918,
333,
353,
1583,
29889,
657,
29918,
7924,
877,
10149,
29918,
3257,
29918,
333,
1495,
13,
4706,
8955,
29918,
8269,
29918,
20736,
29918,
1256,
353,
1583,
29889,
657,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
1495,
13,
4706,
8955,
29918,
8269,
29918,
6812,
353,
1583,
29889,
657,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
6812,
1495,
13,
308,
13,
4706,
396,
4867,
29871,
30396,
30305,
30303,
30310,
30427,
30332,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
10149,
29918,
3257,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
6812,
742,
27255,
13,
13,
4706,
7855,
353,
8237,
9634,
6691,
580,
13,
4706,
7855,
29889,
842,
29918,
11675,
29918,
333,
29898,
1311,
17255,
5509,
29889,
5504,
29898,
29926,
4659,
29918,
8269,
29918,
333,
29892,
1583,
17255,
1792,
29918,
333,
29892,
3633,
29918,
3257,
29918,
333,
29892,
8955,
29918,
8269,
29918,
20736,
29918,
1256,
29892,
8955,
29918,
8269,
29918,
6812,
876,
13,
4706,
736,
1583,
29889,
1493,
877,
6904,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
8835,
29889,
1420,
742,
7855,
29897,
13,
268,
13,
1678,
822,
5217,
29898,
1311,
1125,
13,
4706,
8955,
29918,
8269,
29918,
333,
353,
1583,
29889,
657,
29918,
3207,
877,
29926,
4659,
29918,
8269,
29918,
333,
1495,
13,
13,
4706,
396,
4867,
29871,
30396,
30305,
30303,
30310,
30427,
30332,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
10149,
29918,
3257,
29918,
333,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
20736,
29918,
1256,
742,
27255,
13,
4706,
1583,
29889,
842,
29918,
7924,
877,
29926,
4659,
29918,
8269,
29918,
6812,
742,
27255,
13,
13,
4706,
7855,
353,
8237,
9634,
6691,
580,
13,
4706,
7855,
29889,
842,
29918,
29926,
4659,
29918,
8269,
29918,
333,
29898,
1311,
17255,
5509,
29889,
8143,
29898,
29926,
4659,
29918,
8269,
29918,
333,
29892,
1583,
17255,
1792,
29918,
333,
876,
13,
4706,
736,
1583,
29889,
1493,
877,
6904,
6886,
29914,
6406,
29914,
29926,
4659,
29899,
26586,
29914,
8835,
29889,
1420,
742,
7855,
29897,
2
] |
polymorphic/polymorphic_model.py | fusionbox/django_polymorphic | 0 | 77114 | # -*- coding: utf-8 -*-
"""
Seamless Polymorphic Inheritance for Django Models
==================================================
Please see README.rst and DOCS.rst for further information.
Or on the Web:
http://chrisglass.github.com/django_polymorphic/
http://github.com/chrisglass/django_polymorphic
Copyright:
This code and affiliated files are (C) by <NAME> and individual contributors.
Please see LICENSE and AUTHORS for more information.
"""
from __future__ import absolute_import
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.utils import six
from .base import PolymorphicModelBase
from .manager import PolymorphicManager
from .query_translate import translate_polymorphic_Q_object
###################################################################################
### PolymorphicModel
class PolymorphicModel(six.with_metaclass(PolymorphicModelBase, models.Model)):
"""
Abstract base class that provides polymorphic behaviour
for any model directly or indirectly derived from it.
For usage instructions & examples please see documentation.
PolymorphicModel declares one field for internal use (polymorphic_ctype)
and provides a polymorphic manager as the default manager
(and as 'objects').
PolymorphicModel overrides the save() and __init__ methods.
If your derived class overrides any of these methods as well, then you need
to take care that you correctly call the method of the superclass, like:
super(YourClass,self).save(*args,**kwargs)
"""
# for PolymorphicModelBase, so it can tell which models are polymorphic and which are not (duck typing)
polymorphic_model_marker = True
# for PolymorphicQuery, True => an overloaded __repr__ with nicer multi-line output is used by PolymorphicQuery
polymorphic_query_multiline_output = False
class Meta:
abstract = True
# avoid ContentType related field accessor clash (an error emitted by model validation)
polymorphic_ctype = models.ForeignKey(ContentType, null=True, editable=False,
related_name='polymorphic_%(app_label)s.%(class)s_set')
# some applications want to know the name of the fields that are added to its models
polymorphic_internal_model_fields = ['polymorphic_ctype']
# Note that Django 1.5 removes these managers because the model is abstract.
# They are pretended to be there by the metaclass in PolymorphicModelBase.get_inherited_managers()
objects = PolymorphicManager()
base_objects = models.Manager()
@classmethod
def translate_polymorphic_Q_object(self_class, q):
return translate_polymorphic_Q_object(self_class, q)
def pre_save_polymorphic(self):
"""Normally not needed.
This function may be called manually in special use-cases. When the object
is saved for the first time, we store its real class in polymorphic_ctype.
When the object later is retrieved by PolymorphicQuerySet, it uses this
field to figure out the real class of this object
(used by PolymorphicQuerySet._get_real_instances)
"""
if not self.polymorphic_ctype_id:
self.polymorphic_ctype = ContentType.objects.get_for_model(self, for_concrete_model=False)
def save(self, *args, **kwargs):
"""Overridden model save function which supports the polymorphism
functionality (through pre_save_polymorphic)."""
self.pre_save_polymorphic()
return super(PolymorphicModel, self).save(*args, **kwargs)
def get_real_instance_class(self):
"""
Normally not needed.
If a non-polymorphic manager (like base_objects) has been used to
retrieve objects, then the real class/type of these objects may be
determined using this method.
"""
# the following line would be the easiest way to do this, but it produces sql queries
# return self.polymorphic_ctype.model_class()
# so we use the following version, which uses the CopntentType manager cache.
# Note that model_class() can return None for stale content types;
# when the content type record still exists but no longer refers to an existing model.
try:
return ContentType.objects.get_for_id(self.polymorphic_ctype_id).model_class()
except AttributeError:
# Django <1.6 workaround
return None
def get_real_concrete_instance_class_id(self):
model_class = self.get_real_instance_class()
if model_class is None:
return None
return ContentType.objects.get_for_model(model_class, for_concrete_model=True).pk
def get_real_concrete_instance_class(self):
model_class = self.get_real_instance_class()
if model_class is None:
return None
return ContentType.objects.get_for_model(model_class, for_concrete_model=True).model_class()
def get_real_instance(self):
"""Normally not needed.
If a non-polymorphic manager (like base_objects) has been used to
retrieve objects, then the complete object with it's real class/type
and all fields may be retrieved with this method.
Each method call executes one db query (if necessary)."""
real_model = self.get_real_instance_class()
if real_model == self.__class__:
return self
return real_model.objects.get(pk=self.pk)
def __init__(self, * args, ** kwargs):
"""Replace Django's inheritance accessor member functions for our model
(self.__class__) with our own versions.
We monkey patch them until a patch can be added to Django
(which would probably be very small and make all of this obsolete).
If we have inheritance of the form ModelA -> ModelB ->ModelC then
Django creates accessors like this:
- ModelA: modelb
- ModelB: modela_ptr, modelb, modelc
- ModelC: modela_ptr, modelb, modelb_ptr, modelc
These accessors allow Django (and everyone else) to travel up and down
the inheritance tree for the db object at hand.
The original Django accessors use our polymorphic manager.
But they should not. So we replace them with our own accessors that use
our appropriate base_objects manager.
"""
super(PolymorphicModel, self).__init__(*args, ** kwargs)
if self.__class__.polymorphic_super_sub_accessors_replaced:
return
self.__class__.polymorphic_super_sub_accessors_replaced = True
def create_accessor_function_for_model(model, accessor_name):
def accessor_function(self):
attr = model.base_objects.get(pk=self.pk)
return attr
return accessor_function
subclasses_and_superclasses_accessors = self._get_inheritance_relation_fields_and_models()
from django.db.models.fields.related import SingleRelatedObjectDescriptor, ReverseSingleRelatedObjectDescriptor
for name, model in subclasses_and_superclasses_accessors.items():
orig_accessor = getattr(self.__class__, name, None)
if type(orig_accessor) in [SingleRelatedObjectDescriptor, ReverseSingleRelatedObjectDescriptor]:
#print >>sys.stderr, '---------- replacing', name, orig_accessor, '->', model
setattr(self.__class__, name, property(create_accessor_function_for_model(model, name)))
def _get_inheritance_relation_fields_and_models(self):
"""helper function for __init__:
determine names of all Django inheritance accessor member functions for type(self)"""
def add_model(model, as_ptr, result):
name = model.__name__.lower()
if as_ptr:
name += '_ptr'
result[name] = model
def add_model_if_regular(model, as_ptr, result):
if (issubclass(model, models.Model)
and model != models.Model
and model != self.__class__
and model != PolymorphicModel):
add_model(model, as_ptr, result)
def add_all_super_models(model, result):
add_model_if_regular(model, True, result)
for b in model.__bases__:
add_all_super_models(b, result)
def add_all_sub_models(model, result):
for b in model.__subclasses__():
add_model_if_regular(b, False, result)
result = {}
add_all_super_models(self.__class__, result)
add_all_sub_models(self.__class__, result)
return result
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
2008,
314,
2222,
2043,
962,
5676,
293,
512,
27069,
749,
363,
15337,
3382,
1379,
13,
9166,
9166,
9166,
1360,
13,
13,
12148,
1074,
5195,
3035,
2303,
29889,
29878,
303,
322,
11662,
9295,
29889,
29878,
303,
363,
4340,
2472,
29889,
13,
13,
2816,
373,
278,
2563,
29901,
13,
1124,
597,
305,
3780,
29050,
29889,
3292,
29889,
510,
29914,
14095,
29918,
3733,
962,
5676,
293,
29914,
13,
1124,
597,
3292,
29889,
510,
29914,
305,
3780,
29050,
29914,
14095,
29918,
3733,
962,
5676,
293,
13,
13,
11882,
1266,
29901,
13,
4013,
775,
322,
23736,
630,
2066,
526,
313,
29907,
29897,
491,
529,
5813,
29958,
322,
5375,
17737,
29560,
29889,
13,
12148,
1074,
365,
2965,
1430,
1660,
322,
26524,
29950,
24125,
363,
901,
2472,
29889,
13,
15945,
29908,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
9557,
29889,
21570,
29889,
3051,
8768,
29889,
9794,
1053,
10576,
1542,
13,
3166,
9557,
29889,
13239,
1053,
4832,
13,
13,
3166,
869,
3188,
1053,
2043,
962,
5676,
293,
3195,
5160,
13,
3166,
869,
12847,
1053,
2043,
962,
5676,
293,
3260,
13,
3166,
869,
1972,
29918,
21652,
1053,
14240,
29918,
3733,
962,
5676,
293,
29918,
29984,
29918,
3318,
13,
13,
13,
13383,
13383,
13383,
13383,
13383,
2277,
29937,
13,
2277,
29937,
2043,
962,
5676,
293,
3195,
13,
13,
1990,
2043,
962,
5676,
293,
3195,
29898,
28319,
29889,
2541,
29918,
2527,
562,
605,
29898,
7713,
962,
5676,
293,
3195,
5160,
29892,
4733,
29889,
3195,
22164,
13,
1678,
9995,
13,
1678,
25513,
2967,
770,
393,
8128,
24324,
5676,
293,
10468,
13,
1678,
363,
738,
1904,
4153,
470,
26377,
368,
10723,
515,
372,
29889,
13,
13,
1678,
1152,
8744,
11994,
669,
6455,
3113,
1074,
5106,
29889,
13,
13,
1678,
2043,
962,
5676,
293,
3195,
4845,
5114,
697,
1746,
363,
7463,
671,
313,
3733,
962,
5676,
293,
29918,
312,
668,
29897,
13,
1678,
322,
8128,
263,
24324,
5676,
293,
8455,
408,
278,
2322,
8455,
13,
1678,
313,
392,
408,
525,
12650,
2824,
13,
13,
1678,
2043,
962,
5676,
293,
3195,
975,
24040,
278,
4078,
580,
322,
4770,
2344,
1649,
3519,
29889,
13,
13,
1678,
960,
596,
10723,
770,
975,
24040,
738,
310,
1438,
3519,
408,
1532,
29892,
769,
366,
817,
13,
1678,
304,
2125,
2562,
393,
366,
5149,
1246,
278,
1158,
310,
278,
2428,
1990,
29892,
763,
29901,
13,
13,
4706,
2428,
29898,
10858,
2385,
29892,
1311,
467,
7620,
10456,
5085,
29892,
1068,
19290,
29897,
13,
1678,
9995,
13,
13,
1678,
396,
363,
2043,
962,
5676,
293,
3195,
5160,
29892,
577,
372,
508,
2649,
607,
4733,
526,
24324,
5676,
293,
322,
607,
526,
451,
313,
700,
384,
19229,
29897,
13,
1678,
24324,
5676,
293,
29918,
4299,
29918,
22976,
353,
5852,
13,
13,
1678,
396,
363,
2043,
962,
5676,
293,
3010,
29892,
5852,
1149,
385,
975,
15638,
4770,
276,
558,
1649,
411,
16588,
261,
2473,
29899,
1220,
1962,
338,
1304,
491,
2043,
962,
5676,
293,
3010,
13,
1678,
24324,
5676,
293,
29918,
1972,
29918,
4713,
309,
457,
29918,
4905,
353,
7700,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
9846,
353,
5852,
13,
13,
1678,
396,
4772,
10576,
1542,
4475,
1746,
2130,
272,
1067,
1161,
313,
273,
1059,
953,
4430,
491,
1904,
8845,
29897,
13,
1678,
24324,
5676,
293,
29918,
312,
668,
353,
4733,
29889,
27755,
2558,
29898,
3916,
1542,
29892,
1870,
29922,
5574,
29892,
3863,
519,
29922,
8824,
29892,
13,
462,
18884,
4475,
29918,
978,
2433,
3733,
962,
5676,
293,
29918,
29995,
29898,
932,
29918,
1643,
29897,
29879,
29889,
29995,
29898,
1990,
29897,
29879,
29918,
842,
1495,
13,
13,
1678,
396,
777,
8324,
864,
304,
1073,
278,
1024,
310,
278,
4235,
393,
526,
2715,
304,
967,
4733,
13,
1678,
24324,
5676,
293,
29918,
7564,
29918,
4299,
29918,
9621,
353,
6024,
3733,
962,
5676,
293,
29918,
312,
668,
2033,
13,
13,
1678,
396,
3940,
393,
15337,
29871,
29896,
29889,
29945,
25388,
1438,
767,
18150,
1363,
278,
1904,
338,
9846,
29889,
13,
1678,
396,
2688,
526,
14794,
2760,
304,
367,
727,
491,
278,
1539,
562,
605,
297,
2043,
962,
5676,
293,
3195,
5160,
29889,
657,
29918,
262,
2276,
1573,
29918,
1171,
18150,
580,
13,
1678,
3618,
353,
2043,
962,
5676,
293,
3260,
580,
13,
1678,
2967,
29918,
12650,
353,
4733,
29889,
3260,
580,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
14240,
29918,
3733,
962,
5676,
293,
29918,
29984,
29918,
3318,
29898,
1311,
29918,
1990,
29892,
3855,
1125,
13,
4706,
736,
14240,
29918,
3733,
962,
5676,
293,
29918,
29984,
29918,
3318,
29898,
1311,
29918,
1990,
29892,
3855,
29897,
13,
13,
1678,
822,
758,
29918,
7620,
29918,
3733,
962,
5676,
293,
29898,
1311,
1125,
13,
4706,
9995,
29940,
555,
635,
451,
4312,
29889,
13,
4706,
910,
740,
1122,
367,
2000,
7522,
297,
4266,
671,
29899,
11436,
29889,
1932,
278,
1203,
13,
4706,
338,
7160,
363,
278,
937,
931,
29892,
591,
3787,
967,
1855,
770,
297,
24324,
5676,
293,
29918,
312,
668,
29889,
13,
4706,
1932,
278,
1203,
2678,
338,
27387,
491,
2043,
962,
5676,
293,
3010,
2697,
29892,
372,
3913,
445,
13,
4706,
1746,
304,
4377,
714,
278,
1855,
770,
310,
445,
1203,
13,
4706,
313,
3880,
491,
2043,
962,
5676,
293,
3010,
2697,
3032,
657,
29918,
6370,
29918,
2611,
2925,
29897,
13,
4706,
9995,
13,
4706,
565,
451,
1583,
29889,
3733,
962,
5676,
293,
29918,
312,
668,
29918,
333,
29901,
13,
9651,
1583,
29889,
3733,
962,
5676,
293,
29918,
312,
668,
353,
10576,
1542,
29889,
12650,
29889,
657,
29918,
1454,
29918,
4299,
29898,
1311,
29892,
363,
29918,
535,
9084,
29918,
4299,
29922,
8824,
29897,
13,
13,
1678,
822,
4078,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
9995,
3563,
2429,
1145,
1904,
4078,
740,
607,
11286,
278,
24324,
28611,
13,
4706,
9863,
313,
20678,
758,
29918,
7620,
29918,
3733,
962,
5676,
293,
467,
15945,
29908,
13,
4706,
1583,
29889,
1457,
29918,
7620,
29918,
3733,
962,
5676,
293,
580,
13,
4706,
736,
2428,
29898,
7713,
962,
5676,
293,
3195,
29892,
1583,
467,
7620,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
822,
679,
29918,
6370,
29918,
8758,
29918,
1990,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
5655,
635,
451,
4312,
29889,
13,
4706,
960,
263,
1661,
29899,
3733,
962,
5676,
293,
8455,
313,
4561,
2967,
29918,
12650,
29897,
756,
1063,
1304,
304,
13,
4706,
10563,
3618,
29892,
769,
278,
1855,
770,
29914,
1853,
310,
1438,
3618,
1122,
367,
13,
4706,
10087,
773,
445,
1158,
29889,
13,
4706,
9995,
13,
4706,
396,
278,
1494,
1196,
723,
367,
278,
19075,
982,
304,
437,
445,
29892,
541,
372,
13880,
4576,
9365,
13,
4706,
396,
736,
1583,
29889,
3733,
962,
5676,
293,
29918,
312,
668,
29889,
4299,
29918,
1990,
580,
13,
4706,
396,
577,
591,
671,
278,
1494,
1873,
29892,
607,
3913,
278,
10061,
593,
296,
1542,
8455,
7090,
29889,
13,
4706,
396,
3940,
393,
1904,
29918,
1990,
580,
508,
736,
6213,
363,
380,
744,
2793,
4072,
29936,
13,
4706,
396,
746,
278,
2793,
1134,
2407,
1603,
4864,
541,
694,
5520,
14637,
304,
385,
5923,
1904,
29889,
13,
4706,
1018,
29901,
13,
9651,
736,
10576,
1542,
29889,
12650,
29889,
657,
29918,
1454,
29918,
333,
29898,
1311,
29889,
3733,
962,
5676,
293,
29918,
312,
668,
29918,
333,
467,
4299,
29918,
1990,
580,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
396,
15337,
529,
29896,
29889,
29953,
14725,
13,
9651,
736,
6213,
13,
13,
1678,
822,
679,
29918,
6370,
29918,
535,
9084,
29918,
8758,
29918,
1990,
29918,
333,
29898,
1311,
1125,
13,
4706,
1904,
29918,
1990,
353,
1583,
29889,
657,
29918,
6370,
29918,
8758,
29918,
1990,
580,
13,
4706,
565,
1904,
29918,
1990,
338,
6213,
29901,
13,
9651,
736,
6213,
13,
4706,
736,
10576,
1542,
29889,
12650,
29889,
657,
29918,
1454,
29918,
4299,
29898,
4299,
29918,
1990,
29892,
363,
29918,
535,
9084,
29918,
4299,
29922,
5574,
467,
20571,
13,
13,
1678,
822,
679,
29918,
6370,
29918,
535,
9084,
29918,
8758,
29918,
1990,
29898,
1311,
1125,
13,
4706,
1904,
29918,
1990,
353,
1583,
29889,
657,
29918,
6370,
29918,
8758,
29918,
1990,
580,
13,
4706,
565,
1904,
29918,
1990,
338,
6213,
29901,
13,
9651,
736,
6213,
13,
4706,
736,
10576,
1542,
29889,
12650,
29889,
657,
29918,
1454,
29918,
4299,
29898,
4299,
29918,
1990,
29892,
363,
29918,
535,
9084,
29918,
4299,
29922,
5574,
467,
4299,
29918,
1990,
580,
13,
13,
1678,
822,
679,
29918,
6370,
29918,
8758,
29898,
1311,
1125,
13,
4706,
9995,
29940,
555,
635,
451,
4312,
29889,
13,
4706,
960,
263,
1661,
29899,
3733,
962,
5676,
293,
8455,
313,
4561,
2967,
29918,
12650,
29897,
756,
1063,
1304,
304,
13,
4706,
10563,
3618,
29892,
769,
278,
4866,
1203,
411,
372,
29915,
29879,
1855,
770,
29914,
1853,
13,
4706,
322,
599,
4235,
1122,
367,
27387,
411,
445,
1158,
29889,
13,
4706,
7806,
1158,
1246,
24138,
697,
4833,
2346,
313,
361,
5181,
467,
15945,
29908,
13,
4706,
1855,
29918,
4299,
353,
1583,
29889,
657,
29918,
6370,
29918,
8758,
29918,
1990,
580,
13,
4706,
565,
1855,
29918,
4299,
1275,
1583,
17255,
1990,
1649,
29901,
13,
9651,
736,
1583,
13,
4706,
736,
1855,
29918,
4299,
29889,
12650,
29889,
657,
29898,
20571,
29922,
1311,
29889,
20571,
29897,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
6389,
29892,
3579,
9049,
5085,
1125,
13,
4706,
9995,
20083,
15337,
29915,
29879,
20328,
2130,
272,
4509,
3168,
363,
1749,
1904,
13,
4706,
313,
1311,
17255,
1990,
1649,
29897,
411,
1749,
1914,
6910,
29889,
13,
4706,
1334,
1601,
1989,
13261,
963,
2745,
263,
13261,
508,
367,
2715,
304,
15337,
13,
4706,
313,
4716,
723,
3117,
367,
1407,
2319,
322,
1207,
599,
310,
445,
704,
2170,
371,
467,
13,
13,
4706,
960,
591,
505,
20328,
310,
278,
883,
8125,
29909,
1599,
8125,
29933,
1599,
3195,
29907,
769,
13,
4706,
15337,
10017,
2130,
943,
763,
445,
29901,
13,
4706,
448,
8125,
29909,
29901,
1904,
29890,
13,
4706,
448,
8125,
29933,
29901,
1904,
29874,
29918,
7414,
29892,
1904,
29890,
29892,
1904,
29883,
13,
4706,
448,
8125,
29907,
29901,
1904,
29874,
29918,
7414,
29892,
1904,
29890,
29892,
1904,
29890,
29918,
7414,
29892,
1904,
29883,
13,
13,
4706,
4525,
2130,
943,
2758,
15337,
313,
392,
14332,
1683,
29897,
304,
9850,
701,
322,
1623,
13,
4706,
278,
20328,
5447,
363,
278,
4833,
1203,
472,
1361,
29889,
13,
13,
4706,
450,
2441,
15337,
2130,
943,
671,
1749,
24324,
5676,
293,
8455,
29889,
13,
4706,
1205,
896,
881,
451,
29889,
1105,
591,
5191,
963,
411,
1749,
1914,
2130,
943,
393,
671,
13,
4706,
1749,
8210,
2967,
29918,
12650,
8455,
29889,
13,
4706,
9995,
13,
4706,
2428,
29898,
7713,
962,
5676,
293,
3195,
29892,
1583,
467,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
9049,
5085,
29897,
13,
13,
4706,
565,
1583,
17255,
1990,
26914,
3733,
962,
5676,
293,
29918,
9136,
29918,
1491,
29918,
5943,
943,
29918,
3445,
433,
1133,
29901,
13,
9651,
736,
13,
4706,
1583,
17255,
1990,
26914,
3733,
962,
5676,
293,
29918,
9136,
29918,
1491,
29918,
5943,
943,
29918,
3445,
433,
1133,
353,
5852,
13,
13,
4706,
822,
1653,
29918,
5943,
272,
29918,
2220,
29918,
1454,
29918,
4299,
29898,
4299,
29892,
2130,
272,
29918,
978,
1125,
13,
9651,
822,
2130,
272,
29918,
2220,
29898,
1311,
1125,
13,
18884,
12421,
353,
1904,
29889,
3188,
29918,
12650,
29889,
657,
29898,
20571,
29922,
1311,
29889,
20571,
29897,
13,
18884,
736,
12421,
13,
9651,
736,
2130,
272,
29918,
2220,
13,
13,
4706,
1014,
13203,
29918,
392,
29918,
9136,
13203,
29918,
5943,
943,
353,
1583,
3032,
657,
29918,
262,
27069,
749,
29918,
23445,
29918,
9621,
29918,
392,
29918,
9794,
580,
13,
13,
4706,
515,
9557,
29889,
2585,
29889,
9794,
29889,
9621,
29889,
12817,
1053,
16740,
9662,
630,
2061,
19124,
29892,
830,
3901,
15771,
9662,
630,
2061,
19124,
13,
4706,
363,
1024,
29892,
1904,
297,
1014,
13203,
29918,
392,
29918,
9136,
13203,
29918,
5943,
943,
29889,
7076,
7295,
13,
9651,
1677,
29918,
5943,
272,
353,
679,
5552,
29898,
1311,
17255,
1990,
1649,
29892,
1024,
29892,
6213,
29897,
13,
9651,
565,
1134,
29898,
12683,
29918,
5943,
272,
29897,
297,
518,
15771,
9662,
630,
2061,
19124,
29892,
830,
3901,
15771,
9662,
630,
2061,
19124,
5387,
13,
18884,
396,
2158,
5099,
9675,
29889,
303,
20405,
29892,
525,
28400,
15270,
742,
1024,
29892,
1677,
29918,
5943,
272,
29892,
525,
976,
742,
1904,
13,
18884,
731,
5552,
29898,
1311,
17255,
1990,
1649,
29892,
1024,
29892,
2875,
29898,
3258,
29918,
5943,
272,
29918,
2220,
29918,
1454,
29918,
4299,
29898,
4299,
29892,
1024,
4961,
13,
13,
1678,
822,
903,
657,
29918,
262,
27069,
749,
29918,
23445,
29918,
9621,
29918,
392,
29918,
9794,
29898,
1311,
1125,
13,
4706,
9995,
20907,
740,
363,
4770,
2344,
1649,
29901,
13,
4706,
8161,
2983,
310,
599,
15337,
20328,
2130,
272,
4509,
3168,
363,
1134,
29898,
1311,
5513,
15945,
13,
13,
4706,
822,
788,
29918,
4299,
29898,
4299,
29892,
408,
29918,
7414,
29892,
1121,
1125,
13,
9651,
1024,
353,
1904,
17255,
978,
26914,
13609,
580,
13,
9651,
565,
408,
29918,
7414,
29901,
13,
18884,
1024,
4619,
22868,
7414,
29915,
13,
9651,
1121,
29961,
978,
29962,
353,
1904,
13,
13,
4706,
822,
788,
29918,
4299,
29918,
361,
29918,
15227,
29898,
4299,
29892,
408,
29918,
7414,
29892,
1121,
1125,
13,
9651,
565,
313,
790,
431,
1990,
29898,
4299,
29892,
4733,
29889,
3195,
29897,
13,
18884,
322,
1904,
2804,
4733,
29889,
3195,
13,
18884,
322,
1904,
2804,
1583,
17255,
1990,
1649,
13,
18884,
322,
1904,
2804,
2043,
962,
5676,
293,
3195,
1125,
13,
18884,
788,
29918,
4299,
29898,
4299,
29892,
408,
29918,
7414,
29892,
1121,
29897,
13,
13,
4706,
822,
788,
29918,
497,
29918,
9136,
29918,
9794,
29898,
4299,
29892,
1121,
1125,
13,
9651,
788,
29918,
4299,
29918,
361,
29918,
15227,
29898,
4299,
29892,
5852,
29892,
1121,
29897,
13,
9651,
363,
289,
297,
1904,
17255,
29890,
2129,
1649,
29901,
13,
18884,
788,
29918,
497,
29918,
9136,
29918,
9794,
29898,
29890,
29892,
1121,
29897,
13,
13,
4706,
822,
788,
29918,
497,
29918,
1491,
29918,
9794,
29898,
4299,
29892,
1121,
1125,
13,
9651,
363,
289,
297,
1904,
17255,
1491,
13203,
1649,
7295,
13,
18884,
788,
29918,
4299,
29918,
361,
29918,
15227,
29898,
29890,
29892,
7700,
29892,
1121,
29897,
13,
13,
4706,
1121,
353,
6571,
13,
4706,
788,
29918,
497,
29918,
9136,
29918,
9794,
29898,
1311,
17255,
1990,
1649,
29892,
1121,
29897,
13,
4706,
788,
29918,
497,
29918,
1491,
29918,
9794,
29898,
1311,
17255,
1990,
1649,
29892,
1121,
29897,
13,
4706,
736,
1121,
13,
2
] |
sbpl_perception/src/scripts/tools/fat_dataset/lib/pair_matching/data_pair.py | Tacha-S/perception | 17 | 52628 | <reponame>Tacha-S/perception<gh_stars>10-100
# --------------------------------------------------------
# Deep Iterative Matching Network
# Licensed under The Apache-2.0 License [see LICENSE for details]
# Written by <NAME>, <NAME>
# --------------------------------------------------------
from __future__ import print_function, division
import numpy as np
import lib.utils.image as image
from lib.utils.image import (
get_pair_depth,
get_pair_image,
get_pair_flow,
get_point_cloud_model,
get_point_cloud_observed,
get_gt_observed_depth,
get_pair_mask,
my_tensor_vstack,
)
from lib.pair_matching.RT_transform import calc_RT_delta
def get_data_pair_test_batch(pairdb, config):
"""
return a dict of train batch
:param segdb: ['image', 'flipped']
:param config: the config setting
:return: data, label, im_info
"""
im_observed, im_rendered, scale_ind_list = get_pair_image(pairdb, config, "test")
if config.network.INPUT_DEPTH:
depth_observed, depth_rendered = get_pair_depth(
pairdb, config, scale_ind_list, "test"
)
if config.network.INPUT_MASK:
mask_observed, _, mask_rendered = get_pair_mask(
pairdb, config, scale_ind_list, "test"
)
im_info = [
np.array([pairdb[i]["height"], pairdb[i]["width"]], dtype=np.float32)
for i in range(len(pairdb))
]
num_pair = len(pairdb)
for i in range(num_pair):
class_index_tensor = [[] for i in range(num_pair)]
class_index_tensor[i] = np.array(
config.dataset.class_name.index(pairdb[i]["gt_class"])
).reshape(1)
class_index_array = my_tensor_vstack(class_index_tensor)
data = []
for i in range(len(pairdb)):
cur_batch = {
"image_observed": im_observed[i],
"image_rendered": im_rendered[i],
"src_pose": np.array(pairdb[i]["pose_rendered"]).reshape((1, 3, 4)),
"class_index": class_index_array,
}
if config.network.INPUT_DEPTH:
cur_batch["depth_observed"] = depth_observed[i]
cur_batch["depth_rendered"] = depth_rendered[i]
if config.network.INPUT_MASK:
cur_batch["mask_observed"] = mask_observed[i]
cur_batch["mask_rendered"] = mask_rendered[i]
data.append(cur_batch)
label = {}
return data, label, im_info
def update_data_batch(config, data_batch, update_package):
import mxnet.ndarray as nd
for ctx_idx, data in enumerate(data_batch.data):
package = update_package[ctx_idx]
for blob_idx, blob in enumerate(data):
blob_name = data_batch.provide_data[ctx_idx][blob_idx][0]
blob_shape = data_batch.provide_data[ctx_idx][blob_idx][1]
if blob_name not in package:
continue
update_data = package[blob_name]
if blob_name.startswith("image"):
target_size = min(blob_shape[2:])
max_size = max(blob_shape[2:])
image_update, _ = image.resize(update_data, target_size, max_size)
image_update = image.transform(image_update, config.network.PIXEL_MEANS)
image_update = nd.array(image_update)
data_batch.data[ctx_idx][blob_idx] = image_update
elif blob_name.startswith("src_pose"):
src_pose_update = nd.array(update_data[np.newaxis, :, :])
data_batch.data[ctx_idx][blob_idx] = src_pose_update
elif blob_name.startswith("depth"):
target_size = min(blob_shape[2:])
max_size = max(blob_shape[2:])
depth_update, _ = image.resize(update_data, target_size, max_size)
depth_update = nd.array(depth_update[np.newaxis, np.newaxis, :, :])
data_batch.data[ctx_idx][blob_idx] = depth_update
elif blob_name.startswith("mask_observed"):
if config.TEST.UPDATE_MASK == "box_rendered":
update_data = np.copy(package["mask_rendered"])
mask_observed = np.zeros(update_data.shape)
x_max = np.max(update_data, 0)
y_max = np.max(update_data, 1)
nz_x = np.nonzero(x_max)[0]
nz_y = np.nonzero(y_max)[0]
x_start = np.min(nz_x)
x_end = np.max(nz_x)
y_start = np.min(nz_y)
y_end = np.max(nz_y)
mask_observed[y_start:y_end, x_start:x_end] = 1.0 # rectangle
elif config.TEST.UPDATE_MASK == "box_observed":
mask_observed = np.zeros(update_data.shape)
x_max = np.max(update_data, 0)
y_max = np.max(update_data, 1)
nz_x = np.nonzero(x_max)[0]
nz_y = np.nonzero(y_max)[0]
if len(nz_x) == 0 or len(nz_y) == 0:
raise Exception("no point valid in mask_observed")
x_start = np.min(nz_x)
x_end = np.max(nz_x)
y_start = np.min(nz_y)
y_end = np.max(nz_y)
mask_observed[y_start:y_end, x_start:x_end] = 1.0 # rectangle
else:
mask_observed = update_data
mask_update = nd.array(mask_observed[np.newaxis, np.newaxis, :, :])
data_batch.data[ctx_idx][blob_idx] = mask_update
elif blob_name.startswith("mask_rendered"):
mask_update = nd.array(update_data[np.newaxis, np.newaxis, :, :])
data_batch.data[ctx_idx][blob_idx] = mask_update
else:
raise Exception("NOT_IMPLEMENTED")
return data_batch
point_clound_dict = []
def get_data_pair_train_batch(pairdb, config):
"""
return a dict of train batch
:param pairdb: ['image_observed', 'image_rendered', 'height', 'width',
'depth_observed', 'depth_rendered', 'pose_observed', 'pose_rendered',
'flipped']
:param config: ['INTRINSIC_MATRIX', 'DEPTH_FACTOR', ...]
:return: data: ['image_observed', 'image_rendered', 'depth_observed', 'depth_rendered']
label: ['flow', 'flow_weights'(RT)]
"""
num_pair = len(pairdb)
random_k = np.random.randint(18)
im_observed, im_rendered, scale_ind_list = get_pair_image(
pairdb, config, phase="train", random_k=random_k
)
depth_gt_observed = get_gt_observed_depth(
pairdb, config, scale_ind_list, random_k=random_k
)
if config.network.INPUT_DEPTH:
depth_observed, depth_rendered = get_pair_depth(
pairdb, config, scale_ind_list, phase="train", random_k=random_k
)
if config.network.PRED_MASK or config.network.INPUT_MASK:
mask_observed, mask_gt_observed, mask_rendered = get_pair_mask(
pairdb, config, scale_ind_list, phase="train", random_k=random_k
)
im_observed_array = my_tensor_vstack(im_observed)
im_rendered_array = my_tensor_vstack(im_rendered)
depth_gt_observed_array = my_tensor_vstack(depth_gt_observed)
if config.network.INPUT_DEPTH:
depth_observed_array = my_tensor_vstack(depth_observed)
depth_rendered_array = my_tensor_vstack(depth_rendered)
if config.network.INPUT_MASK or config.network.PRED_MASK:
mask_observed_array = my_tensor_vstack(mask_observed)
mask_gt_observed_array = my_tensor_vstack(mask_gt_observed)
mask_rendered_array = my_tensor_vstack(mask_rendered)
if config.network.PRED_FLOW:
flow_i2r, flow_i2r_weights, X_rendered_tensor, X_observed_tensor = get_pair_flow(
pairdb, config, scale_ind_list, phase="train", random_k=random_k
)
flow_i2r_array = my_tensor_vstack(flow_i2r)
flow_i2r_weights_array = my_tensor_vstack(flow_i2r_weights)
if config.train_iter.SE3_PM_LOSS:
X_obj, X_obj_weights = get_point_cloud_model(config, pairdb)
X_obj_array = my_tensor_vstack(X_obj)
X_obj_weights_array = my_tensor_vstack(X_obj_weights)
# SE3
rot_i2r_tensor = [[] for i in range(num_pair)]
trans_i2r_tensor = [[] for i in range(num_pair)]
src_pose_tensor = [[] for i in range(num_pair)]
tgt_pose_tensor = [[] for i in range(num_pair)]
tgt_points_tensor = [[] for i in range(num_pair)]
for i in range(num_pair):
rot_i2r, trans_i2r = calc_RT_delta(
pairdb[i]["pose_rendered"],
pairdb[i]["pose_observed"],
config.dataset.trans_means,
config.dataset.trans_stds,
config.network.ROT_COORD,
config.network.ROT_TYPE,
)
rot_i2r_tensor[i] = np.array(rot_i2r).reshape((1, -1))
trans_i2r_tensor[i] = np.array(trans_i2r).reshape((1, -1))
src_pose_tensor[i] = np.array(pairdb[i]["pose_rendered"]).reshape((1, 3, 4))
tgt_pose_tensor[i] = np.array(pairdb[i]["pose_observed"]).reshape((1, 3, 4))
if config.train_iter.SE3_PM_LOSS:
tgt_points = get_point_cloud_observed(
config,
X_obj_array[i],
pose_observed=np.array(pairdb[i]["pose_observed"]),
)
tgt_points_tensor[i] = np.expand_dims(tgt_points, axis=0) # (1, 3, 3000)
rot_i2r_array = my_tensor_vstack(rot_i2r_tensor)
trans_i2r_array = my_tensor_vstack(trans_i2r_tensor)
src_pose_array = my_tensor_vstack(src_pose_tensor) # before refinment
tgt_pose_array = my_tensor_vstack(tgt_pose_tensor) # refinement target
tgt_points_array = my_tensor_vstack(tgt_points_tensor)
for i in range(num_pair):
class_index_tensor = [[] for i in range(num_pair)]
class_index_tensor[i] = np.array(
config.dataset.class_name.index(pairdb[i]["gt_class"])
).reshape(num_pair)
class_index_array = my_tensor_vstack(class_index_tensor)
data = {
"image_observed": im_observed_array,
"image_rendered": im_rendered_array,
"depth_gt_observed": depth_gt_observed_array,
"class_index": class_index_array,
"src_pose": src_pose_array,
"tgt_pose": tgt_pose_array,
}
if config.network.INPUT_DEPTH:
data["depth_observed"] = depth_observed_array
data["depth_rendered"] = depth_rendered_array
if config.network.INPUT_MASK:
data["mask_observed"] = mask_observed_array
data["mask_rendered"] = mask_rendered_array
label = {"rot": rot_i2r_array, "trans": trans_i2r_array}
if config.network.PRED_MASK:
label["mask_gt_observed"] = mask_gt_observed_array
if config.network.PRED_FLOW:
label["flow"] = flow_i2r_array
label["flow_weights"] = flow_i2r_weights_array
if config.train_iter.SE3_PM_LOSS:
label["point_cloud_model"] = X_obj_array
label["point_cloud_weights"] = X_obj_weights_array
label["point_cloud_observed"] = tgt_points_array
return {"data": data, "label": label}
| [
1,
529,
276,
1112,
420,
29958,
29911,
496,
29874,
29899,
29903,
29914,
546,
1441,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
29937,
448,
2683,
2683,
2683,
26589,
13,
29937,
21784,
20504,
1230,
14514,
292,
8527,
13,
29937,
10413,
21144,
1090,
450,
13380,
29899,
29906,
29889,
29900,
19245,
518,
4149,
365,
2965,
1430,
1660,
363,
4902,
29962,
13,
29937,
16849,
841,
491,
529,
5813,
10202,
529,
5813,
29958,
13,
29937,
448,
2683,
2683,
2683,
26589,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
29892,
8542,
13,
5215,
12655,
408,
7442,
13,
5215,
4303,
29889,
13239,
29889,
3027,
408,
1967,
13,
3166,
4303,
29889,
13239,
29889,
3027,
1053,
313,
13,
1678,
679,
29918,
18784,
29918,
19488,
29892,
13,
1678,
679,
29918,
18784,
29918,
3027,
29892,
13,
1678,
679,
29918,
18784,
29918,
1731,
29892,
13,
1678,
679,
29918,
3149,
29918,
9274,
29918,
4299,
29892,
13,
1678,
679,
29918,
3149,
29918,
9274,
29918,
711,
643,
1490,
29892,
13,
1678,
679,
29918,
4141,
29918,
711,
643,
1490,
29918,
19488,
29892,
13,
1678,
679,
29918,
18784,
29918,
13168,
29892,
13,
1678,
590,
29918,
20158,
29918,
29894,
1429,
29892,
13,
29897,
13,
3166,
4303,
29889,
18784,
29918,
4352,
292,
29889,
13079,
29918,
9067,
1053,
22235,
29918,
13079,
29918,
4181,
13,
13,
13,
1753,
679,
29918,
1272,
29918,
18784,
29918,
1688,
29918,
16175,
29898,
18784,
2585,
29892,
2295,
1125,
13,
1678,
9995,
13,
1678,
736,
263,
9657,
310,
7945,
9853,
13,
1678,
584,
3207,
2377,
2585,
29901,
6024,
3027,
742,
525,
20157,
2986,
2033,
13,
1678,
584,
3207,
2295,
29901,
278,
2295,
4444,
13,
1678,
584,
2457,
29901,
848,
29892,
3858,
29892,
527,
29918,
3888,
13,
1678,
9995,
13,
1678,
527,
29918,
711,
643,
1490,
29892,
527,
29918,
9482,
287,
29892,
6287,
29918,
513,
29918,
1761,
353,
679,
29918,
18784,
29918,
3027,
29898,
18784,
2585,
29892,
2295,
29892,
376,
1688,
1159,
13,
1678,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
2287,
29925,
4690,
29901,
13,
4706,
10809,
29918,
711,
643,
1490,
29892,
10809,
29918,
9482,
287,
353,
679,
29918,
18784,
29918,
19488,
29898,
13,
9651,
5101,
2585,
29892,
2295,
29892,
6287,
29918,
513,
29918,
1761,
29892,
376,
1688,
29908,
13,
4706,
1723,
13,
1678,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
1529,
16033,
29901,
13,
4706,
11105,
29918,
711,
643,
1490,
29892,
17117,
11105,
29918,
9482,
287,
353,
679,
29918,
18784,
29918,
13168,
29898,
13,
9651,
5101,
2585,
29892,
2295,
29892,
6287,
29918,
513,
29918,
1761,
29892,
376,
1688,
29908,
13,
4706,
1723,
13,
13,
1678,
527,
29918,
3888,
353,
518,
13,
4706,
7442,
29889,
2378,
4197,
18784,
2585,
29961,
29875,
29962,
3366,
3545,
12436,
5101,
2585,
29961,
29875,
29962,
3366,
2103,
3108,
1402,
26688,
29922,
9302,
29889,
7411,
29941,
29906,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
18784,
2585,
876,
13,
1678,
4514,
13,
13,
1678,
954,
29918,
18784,
353,
7431,
29898,
18784,
2585,
29897,
13,
1678,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
1125,
13,
4706,
770,
29918,
2248,
29918,
20158,
353,
518,
2636,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
4638,
13,
4706,
770,
29918,
2248,
29918,
20158,
29961,
29875,
29962,
353,
7442,
29889,
2378,
29898,
13,
9651,
2295,
29889,
24713,
29889,
1990,
29918,
978,
29889,
2248,
29898,
18784,
2585,
29961,
29875,
29962,
3366,
4141,
29918,
1990,
20068,
13,
4706,
13742,
690,
14443,
29898,
29896,
29897,
13,
4706,
770,
29918,
2248,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
1990,
29918,
2248,
29918,
20158,
29897,
13,
13,
1678,
848,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
18784,
2585,
22164,
13,
4706,
3151,
29918,
16175,
353,
426,
13,
9651,
376,
3027,
29918,
711,
643,
1490,
1115,
527,
29918,
711,
643,
1490,
29961,
29875,
1402,
13,
9651,
376,
3027,
29918,
9482,
287,
1115,
527,
29918,
9482,
287,
29961,
29875,
1402,
13,
9651,
376,
4351,
29918,
4220,
1115,
7442,
29889,
2378,
29898,
18784,
2585,
29961,
29875,
29962,
3366,
4220,
29918,
9482,
287,
3108,
467,
690,
14443,
3552,
29896,
29892,
29871,
29941,
29892,
29871,
29946,
8243,
13,
9651,
376,
1990,
29918,
2248,
1115,
770,
29918,
2248,
29918,
2378,
29892,
13,
4706,
500,
13,
13,
4706,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
2287,
29925,
4690,
29901,
13,
9651,
3151,
29918,
16175,
3366,
19488,
29918,
711,
643,
1490,
3108,
353,
10809,
29918,
711,
643,
1490,
29961,
29875,
29962,
13,
9651,
3151,
29918,
16175,
3366,
19488,
29918,
9482,
287,
3108,
353,
10809,
29918,
9482,
287,
29961,
29875,
29962,
13,
13,
4706,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
1529,
16033,
29901,
13,
9651,
3151,
29918,
16175,
3366,
13168,
29918,
711,
643,
1490,
3108,
353,
11105,
29918,
711,
643,
1490,
29961,
29875,
29962,
13,
9651,
3151,
29918,
16175,
3366,
13168,
29918,
9482,
287,
3108,
353,
11105,
29918,
9482,
287,
29961,
29875,
29962,
13,
13,
4706,
848,
29889,
4397,
29898,
2764,
29918,
16175,
29897,
13,
1678,
3858,
353,
6571,
13,
13,
1678,
736,
848,
29892,
3858,
29892,
527,
29918,
3888,
13,
13,
13,
1753,
2767,
29918,
1272,
29918,
16175,
29898,
2917,
29892,
848,
29918,
16175,
29892,
2767,
29918,
5113,
1125,
13,
1678,
1053,
286,
29916,
1212,
29889,
299,
2378,
408,
29871,
299,
13,
13,
1678,
363,
12893,
29918,
13140,
29892,
848,
297,
26985,
29898,
1272,
29918,
16175,
29889,
1272,
1125,
13,
4706,
3577,
353,
2767,
29918,
5113,
29961,
13073,
29918,
13140,
29962,
13,
4706,
363,
23755,
29918,
13140,
29892,
23755,
297,
26985,
29898,
1272,
1125,
13,
9651,
23755,
29918,
978,
353,
848,
29918,
16175,
29889,
16123,
680,
29918,
1272,
29961,
13073,
29918,
13140,
3816,
10054,
29918,
13140,
3816,
29900,
29962,
13,
9651,
23755,
29918,
12181,
353,
848,
29918,
16175,
29889,
16123,
680,
29918,
1272,
29961,
13073,
29918,
13140,
3816,
10054,
29918,
13140,
3816,
29896,
29962,
13,
9651,
565,
23755,
29918,
978,
451,
297,
3577,
29901,
13,
18884,
6773,
13,
9651,
2767,
29918,
1272,
353,
3577,
29961,
10054,
29918,
978,
29962,
13,
9651,
565,
23755,
29918,
978,
29889,
27382,
2541,
703,
3027,
29908,
1125,
13,
18884,
3646,
29918,
2311,
353,
1375,
29898,
10054,
29918,
12181,
29961,
29906,
29901,
2314,
13,
18884,
4236,
29918,
2311,
353,
4236,
29898,
10054,
29918,
12181,
29961,
29906,
29901,
2314,
13,
18884,
1967,
29918,
5504,
29892,
903,
353,
1967,
29889,
21476,
29898,
5504,
29918,
1272,
29892,
3646,
29918,
2311,
29892,
4236,
29918,
2311,
29897,
13,
18884,
1967,
29918,
5504,
353,
1967,
29889,
9067,
29898,
3027,
29918,
5504,
29892,
2295,
29889,
11618,
29889,
2227,
29990,
6670,
29918,
2303,
2190,
29903,
29897,
13,
18884,
1967,
29918,
5504,
353,
29871,
299,
29889,
2378,
29898,
3027,
29918,
5504,
29897,
13,
18884,
848,
29918,
16175,
29889,
1272,
29961,
13073,
29918,
13140,
3816,
10054,
29918,
13140,
29962,
353,
1967,
29918,
5504,
13,
9651,
25342,
23755,
29918,
978,
29889,
27382,
2541,
703,
4351,
29918,
4220,
29908,
1125,
13,
18884,
4765,
29918,
4220,
29918,
5504,
353,
29871,
299,
29889,
2378,
29898,
5504,
29918,
1272,
29961,
9302,
29889,
1482,
8990,
29892,
584,
29892,
584,
2314,
13,
18884,
848,
29918,
16175,
29889,
1272,
29961,
13073,
29918,
13140,
3816,
10054,
29918,
13140,
29962,
353,
4765,
29918,
4220,
29918,
5504,
13,
9651,
25342,
23755,
29918,
978,
29889,
27382,
2541,
703,
19488,
29908,
1125,
13,
18884,
3646,
29918,
2311,
353,
1375,
29898,
10054,
29918,
12181,
29961,
29906,
29901,
2314,
13,
18884,
4236,
29918,
2311,
353,
4236,
29898,
10054,
29918,
12181,
29961,
29906,
29901,
2314,
13,
18884,
10809,
29918,
5504,
29892,
903,
353,
1967,
29889,
21476,
29898,
5504,
29918,
1272,
29892,
3646,
29918,
2311,
29892,
4236,
29918,
2311,
29897,
13,
18884,
10809,
29918,
5504,
353,
29871,
299,
29889,
2378,
29898,
19488,
29918,
5504,
29961,
9302,
29889,
1482,
8990,
29892,
7442,
29889,
1482,
8990,
29892,
584,
29892,
584,
2314,
13,
18884,
848,
29918,
16175,
29889,
1272,
29961,
13073,
29918,
13140,
3816,
10054,
29918,
13140,
29962,
353,
10809,
29918,
5504,
13,
9651,
25342,
23755,
29918,
978,
29889,
27382,
2541,
703,
13168,
29918,
711,
643,
1490,
29908,
1125,
13,
18884,
565,
2295,
29889,
18267,
29889,
14474,
29918,
1529,
16033,
1275,
376,
1884,
29918,
9482,
287,
1115,
13,
462,
1678,
2767,
29918,
1272,
353,
7442,
29889,
8552,
29898,
5113,
3366,
13168,
29918,
9482,
287,
20068,
13,
462,
1678,
11105,
29918,
711,
643,
1490,
353,
7442,
29889,
3298,
359,
29898,
5504,
29918,
1272,
29889,
12181,
29897,
13,
462,
1678,
921,
29918,
3317,
353,
7442,
29889,
3317,
29898,
5504,
29918,
1272,
29892,
29871,
29900,
29897,
13,
462,
1678,
343,
29918,
3317,
353,
7442,
29889,
3317,
29898,
5504,
29918,
1272,
29892,
29871,
29896,
29897,
13,
462,
1678,
302,
29920,
29918,
29916,
353,
7442,
29889,
5464,
9171,
29898,
29916,
29918,
3317,
9601,
29900,
29962,
13,
462,
1678,
302,
29920,
29918,
29891,
353,
7442,
29889,
5464,
9171,
29898,
29891,
29918,
3317,
9601,
29900,
29962,
13,
462,
1678,
921,
29918,
2962,
353,
7442,
29889,
1195,
29898,
29876,
29920,
29918,
29916,
29897,
13,
462,
1678,
921,
29918,
355,
353,
7442,
29889,
3317,
29898,
29876,
29920,
29918,
29916,
29897,
13,
462,
1678,
343,
29918,
2962,
353,
7442,
29889,
1195,
29898,
29876,
29920,
29918,
29891,
29897,
13,
462,
1678,
343,
29918,
355,
353,
7442,
29889,
3317,
29898,
29876,
29920,
29918,
29891,
29897,
13,
462,
1678,
11105,
29918,
711,
643,
1490,
29961,
29891,
29918,
2962,
29901,
29891,
29918,
355,
29892,
921,
29918,
2962,
29901,
29916,
29918,
355,
29962,
353,
29871,
29896,
29889,
29900,
29871,
396,
16701,
13,
18884,
25342,
2295,
29889,
18267,
29889,
14474,
29918,
1529,
16033,
1275,
376,
1884,
29918,
711,
643,
1490,
1115,
13,
462,
1678,
11105,
29918,
711,
643,
1490,
353,
7442,
29889,
3298,
359,
29898,
5504,
29918,
1272,
29889,
12181,
29897,
13,
462,
1678,
921,
29918,
3317,
353,
7442,
29889,
3317,
29898,
5504,
29918,
1272,
29892,
29871,
29900,
29897,
13,
462,
1678,
343,
29918,
3317,
353,
7442,
29889,
3317,
29898,
5504,
29918,
1272,
29892,
29871,
29896,
29897,
13,
462,
1678,
302,
29920,
29918,
29916,
353,
7442,
29889,
5464,
9171,
29898,
29916,
29918,
3317,
9601,
29900,
29962,
13,
462,
1678,
302,
29920,
29918,
29891,
353,
7442,
29889,
5464,
9171,
29898,
29891,
29918,
3317,
9601,
29900,
29962,
13,
462,
1678,
565,
7431,
29898,
29876,
29920,
29918,
29916,
29897,
1275,
29871,
29900,
470,
7431,
29898,
29876,
29920,
29918,
29891,
29897,
1275,
29871,
29900,
29901,
13,
462,
4706,
12020,
8960,
703,
1217,
1298,
2854,
297,
11105,
29918,
711,
643,
1490,
1159,
13,
13,
462,
1678,
921,
29918,
2962,
353,
7442,
29889,
1195,
29898,
29876,
29920,
29918,
29916,
29897,
13,
462,
1678,
921,
29918,
355,
353,
7442,
29889,
3317,
29898,
29876,
29920,
29918,
29916,
29897,
13,
462,
1678,
343,
29918,
2962,
353,
7442,
29889,
1195,
29898,
29876,
29920,
29918,
29891,
29897,
13,
462,
1678,
343,
29918,
355,
353,
7442,
29889,
3317,
29898,
29876,
29920,
29918,
29891,
29897,
13,
462,
1678,
11105,
29918,
711,
643,
1490,
29961,
29891,
29918,
2962,
29901,
29891,
29918,
355,
29892,
921,
29918,
2962,
29901,
29916,
29918,
355,
29962,
353,
29871,
29896,
29889,
29900,
29871,
396,
16701,
13,
18884,
1683,
29901,
13,
462,
1678,
11105,
29918,
711,
643,
1490,
353,
2767,
29918,
1272,
13,
18884,
11105,
29918,
5504,
353,
29871,
299,
29889,
2378,
29898,
13168,
29918,
711,
643,
1490,
29961,
9302,
29889,
1482,
8990,
29892,
7442,
29889,
1482,
8990,
29892,
584,
29892,
584,
2314,
13,
18884,
848,
29918,
16175,
29889,
1272,
29961,
13073,
29918,
13140,
3816,
10054,
29918,
13140,
29962,
353,
11105,
29918,
5504,
13,
9651,
25342,
23755,
29918,
978,
29889,
27382,
2541,
703,
13168,
29918,
9482,
287,
29908,
1125,
13,
18884,
11105,
29918,
5504,
353,
29871,
299,
29889,
2378,
29898,
5504,
29918,
1272,
29961,
9302,
29889,
1482,
8990,
29892,
7442,
29889,
1482,
8990,
29892,
584,
29892,
584,
2314,
13,
18884,
848,
29918,
16175,
29889,
1272,
29961,
13073,
29918,
13140,
3816,
10054,
29918,
13140,
29962,
353,
11105,
29918,
5504,
13,
9651,
1683,
29901,
13,
18884,
12020,
8960,
703,
12256,
29918,
29902,
3580,
1307,
13780,
3352,
1159,
13,
1678,
736,
848,
29918,
16175,
13,
13,
13,
3149,
29918,
695,
618,
29918,
8977,
353,
5159,
13,
13,
13,
1753,
679,
29918,
1272,
29918,
18784,
29918,
14968,
29918,
16175,
29898,
18784,
2585,
29892,
2295,
1125,
13,
1678,
9995,
13,
1678,
736,
263,
9657,
310,
7945,
9853,
13,
1678,
584,
3207,
5101,
2585,
29901,
6024,
3027,
29918,
711,
643,
1490,
742,
525,
3027,
29918,
9482,
287,
742,
525,
3545,
742,
525,
2103,
742,
13,
462,
1678,
525,
19488,
29918,
711,
643,
1490,
742,
525,
19488,
29918,
9482,
287,
742,
525,
4220,
29918,
711,
643,
1490,
742,
525,
4220,
29918,
9482,
287,
742,
13,
462,
1678,
525,
20157,
2986,
2033,
13,
1678,
584,
3207,
2295,
29901,
6024,
1177,
5659,
1177,
29903,
2965,
29918,
29924,
1299,
3960,
29990,
742,
525,
2287,
29925,
4690,
29918,
4519,
1783,
1955,
742,
2023,
29962,
13,
1678,
584,
2457,
29901,
848,
29901,
6024,
3027,
29918,
711,
643,
1490,
742,
525,
3027,
29918,
9482,
287,
742,
525,
19488,
29918,
711,
643,
1490,
742,
525,
19488,
29918,
9482,
287,
2033,
13,
632,
3858,
29901,
6024,
1731,
742,
525,
1731,
29918,
705,
5861,
12215,
13079,
4638,
13,
1678,
9995,
13,
1678,
954,
29918,
18784,
353,
7431,
29898,
18784,
2585,
29897,
13,
1678,
4036,
29918,
29895,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29896,
29947,
29897,
13,
1678,
527,
29918,
711,
643,
1490,
29892,
527,
29918,
9482,
287,
29892,
6287,
29918,
513,
29918,
1761,
353,
679,
29918,
18784,
29918,
3027,
29898,
13,
4706,
5101,
2585,
29892,
2295,
29892,
8576,
543,
14968,
613,
4036,
29918,
29895,
29922,
8172,
29918,
29895,
13,
1678,
1723,
13,
1678,
10809,
29918,
4141,
29918,
711,
643,
1490,
353,
679,
29918,
4141,
29918,
711,
643,
1490,
29918,
19488,
29898,
13,
4706,
5101,
2585,
29892,
2295,
29892,
6287,
29918,
513,
29918,
1761,
29892,
4036,
29918,
29895,
29922,
8172,
29918,
29895,
13,
1678,
1723,
13,
1678,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
2287,
29925,
4690,
29901,
13,
4706,
10809,
29918,
711,
643,
1490,
29892,
10809,
29918,
9482,
287,
353,
679,
29918,
18784,
29918,
19488,
29898,
13,
9651,
5101,
2585,
29892,
2295,
29892,
6287,
29918,
513,
29918,
1761,
29892,
8576,
543,
14968,
613,
4036,
29918,
29895,
29922,
8172,
29918,
29895,
13,
4706,
1723,
13,
1678,
565,
2295,
29889,
11618,
29889,
15094,
29928,
29918,
1529,
16033,
470,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
1529,
16033,
29901,
13,
4706,
11105,
29918,
711,
643,
1490,
29892,
11105,
29918,
4141,
29918,
711,
643,
1490,
29892,
11105,
29918,
9482,
287,
353,
679,
29918,
18784,
29918,
13168,
29898,
13,
9651,
5101,
2585,
29892,
2295,
29892,
6287,
29918,
513,
29918,
1761,
29892,
8576,
543,
14968,
613,
4036,
29918,
29895,
29922,
8172,
29918,
29895,
13,
4706,
1723,
13,
1678,
527,
29918,
711,
643,
1490,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
326,
29918,
711,
643,
1490,
29897,
13,
1678,
527,
29918,
9482,
287,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
326,
29918,
9482,
287,
29897,
13,
13,
1678,
10809,
29918,
4141,
29918,
711,
643,
1490,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
19488,
29918,
4141,
29918,
711,
643,
1490,
29897,
13,
1678,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
2287,
29925,
4690,
29901,
13,
4706,
10809,
29918,
711,
643,
1490,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
19488,
29918,
711,
643,
1490,
29897,
13,
4706,
10809,
29918,
9482,
287,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
19488,
29918,
9482,
287,
29897,
13,
1678,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
1529,
16033,
470,
2295,
29889,
11618,
29889,
15094,
29928,
29918,
1529,
16033,
29901,
13,
4706,
11105,
29918,
711,
643,
1490,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
13168,
29918,
711,
643,
1490,
29897,
13,
4706,
11105,
29918,
4141,
29918,
711,
643,
1490,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
13168,
29918,
4141,
29918,
711,
643,
1490,
29897,
13,
4706,
11105,
29918,
9482,
287,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
13168,
29918,
9482,
287,
29897,
13,
13,
1678,
565,
2295,
29889,
11618,
29889,
15094,
29928,
29918,
29943,
27998,
29901,
13,
4706,
4972,
29918,
29875,
29906,
29878,
29892,
4972,
29918,
29875,
29906,
29878,
29918,
705,
5861,
29892,
1060,
29918,
9482,
287,
29918,
20158,
29892,
1060,
29918,
711,
643,
1490,
29918,
20158,
353,
679,
29918,
18784,
29918,
1731,
29898,
13,
9651,
5101,
2585,
29892,
2295,
29892,
6287,
29918,
513,
29918,
1761,
29892,
8576,
543,
14968,
613,
4036,
29918,
29895,
29922,
8172,
29918,
29895,
13,
4706,
1723,
13,
4706,
4972,
29918,
29875,
29906,
29878,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
1731,
29918,
29875,
29906,
29878,
29897,
13,
4706,
4972,
29918,
29875,
29906,
29878,
29918,
705,
5861,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
1731,
29918,
29875,
29906,
29878,
29918,
705,
5861,
29897,
13,
13,
1678,
565,
2295,
29889,
14968,
29918,
1524,
29889,
1660,
29941,
29918,
13427,
29918,
3927,
1799,
29901,
13,
4706,
1060,
29918,
5415,
29892,
1060,
29918,
5415,
29918,
705,
5861,
353,
679,
29918,
3149,
29918,
9274,
29918,
4299,
29898,
2917,
29892,
5101,
2585,
29897,
13,
4706,
1060,
29918,
5415,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
29990,
29918,
5415,
29897,
13,
4706,
1060,
29918,
5415,
29918,
705,
5861,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
29990,
29918,
5415,
29918,
705,
5861,
29897,
13,
13,
1678,
396,
3725,
29941,
13,
1678,
5731,
29918,
29875,
29906,
29878,
29918,
20158,
353,
518,
2636,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
4638,
13,
1678,
1301,
29918,
29875,
29906,
29878,
29918,
20158,
353,
518,
2636,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
4638,
13,
1678,
4765,
29918,
4220,
29918,
20158,
353,
518,
2636,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
4638,
13,
1678,
260,
4141,
29918,
4220,
29918,
20158,
353,
518,
2636,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
4638,
13,
1678,
260,
4141,
29918,
9748,
29918,
20158,
353,
518,
2636,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
4638,
13,
1678,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
1125,
13,
4706,
5731,
29918,
29875,
29906,
29878,
29892,
1301,
29918,
29875,
29906,
29878,
353,
22235,
29918,
13079,
29918,
4181,
29898,
13,
9651,
5101,
2585,
29961,
29875,
29962,
3366,
4220,
29918,
9482,
287,
12436,
13,
9651,
5101,
2585,
29961,
29875,
29962,
3366,
4220,
29918,
711,
643,
1490,
12436,
13,
9651,
2295,
29889,
24713,
29889,
3286,
29918,
1004,
550,
29892,
13,
9651,
2295,
29889,
24713,
29889,
3286,
29918,
4172,
29879,
29892,
13,
9651,
2295,
29889,
11618,
29889,
1672,
29911,
29918,
3217,
25593,
29892,
13,
9651,
2295,
29889,
11618,
29889,
1672,
29911,
29918,
11116,
29892,
13,
4706,
1723,
13,
13,
4706,
5731,
29918,
29875,
29906,
29878,
29918,
20158,
29961,
29875,
29962,
353,
7442,
29889,
2378,
29898,
5450,
29918,
29875,
29906,
29878,
467,
690,
14443,
3552,
29896,
29892,
448,
29896,
876,
13,
4706,
1301,
29918,
29875,
29906,
29878,
29918,
20158,
29961,
29875,
29962,
353,
7442,
29889,
2378,
29898,
3286,
29918,
29875,
29906,
29878,
467,
690,
14443,
3552,
29896,
29892,
448,
29896,
876,
13,
4706,
4765,
29918,
4220,
29918,
20158,
29961,
29875,
29962,
353,
7442,
29889,
2378,
29898,
18784,
2585,
29961,
29875,
29962,
3366,
4220,
29918,
9482,
287,
3108,
467,
690,
14443,
3552,
29896,
29892,
29871,
29941,
29892,
29871,
29946,
876,
13,
4706,
260,
4141,
29918,
4220,
29918,
20158,
29961,
29875,
29962,
353,
7442,
29889,
2378,
29898,
18784,
2585,
29961,
29875,
29962,
3366,
4220,
29918,
711,
643,
1490,
3108,
467,
690,
14443,
3552,
29896,
29892,
29871,
29941,
29892,
29871,
29946,
876,
13,
4706,
565,
2295,
29889,
14968,
29918,
1524,
29889,
1660,
29941,
29918,
13427,
29918,
3927,
1799,
29901,
13,
9651,
260,
4141,
29918,
9748,
353,
679,
29918,
3149,
29918,
9274,
29918,
711,
643,
1490,
29898,
13,
18884,
2295,
29892,
13,
18884,
1060,
29918,
5415,
29918,
2378,
29961,
29875,
1402,
13,
18884,
18593,
29918,
711,
643,
1490,
29922,
9302,
29889,
2378,
29898,
18784,
2585,
29961,
29875,
29962,
3366,
4220,
29918,
711,
643,
1490,
3108,
511,
13,
9651,
1723,
13,
9651,
260,
4141,
29918,
9748,
29918,
20158,
29961,
29875,
29962,
353,
7442,
29889,
18837,
29918,
6229,
29879,
29898,
29873,
4141,
29918,
9748,
29892,
9685,
29922,
29900,
29897,
29871,
396,
313,
29896,
29892,
29871,
29941,
29892,
29871,
29941,
29900,
29900,
29900,
29897,
13,
13,
1678,
5731,
29918,
29875,
29906,
29878,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
5450,
29918,
29875,
29906,
29878,
29918,
20158,
29897,
13,
1678,
1301,
29918,
29875,
29906,
29878,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
3286,
29918,
29875,
29906,
29878,
29918,
20158,
29897,
13,
1678,
4765,
29918,
4220,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
4351,
29918,
4220,
29918,
20158,
29897,
29871,
396,
1434,
2143,
262,
358,
13,
1678,
260,
4141,
29918,
4220,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
29873,
4141,
29918,
4220,
29918,
20158,
29897,
29871,
396,
2143,
262,
882,
3646,
13,
1678,
260,
4141,
29918,
9748,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
29873,
4141,
29918,
9748,
29918,
20158,
29897,
13,
13,
1678,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
1125,
13,
4706,
770,
29918,
2248,
29918,
20158,
353,
518,
2636,
363,
474,
297,
3464,
29898,
1949,
29918,
18784,
4638,
13,
4706,
770,
29918,
2248,
29918,
20158,
29961,
29875,
29962,
353,
7442,
29889,
2378,
29898,
13,
9651,
2295,
29889,
24713,
29889,
1990,
29918,
978,
29889,
2248,
29898,
18784,
2585,
29961,
29875,
29962,
3366,
4141,
29918,
1990,
20068,
13,
4706,
13742,
690,
14443,
29898,
1949,
29918,
18784,
29897,
13,
4706,
770,
29918,
2248,
29918,
2378,
353,
590,
29918,
20158,
29918,
29894,
1429,
29898,
1990,
29918,
2248,
29918,
20158,
29897,
13,
1678,
848,
353,
426,
13,
4706,
376,
3027,
29918,
711,
643,
1490,
1115,
527,
29918,
711,
643,
1490,
29918,
2378,
29892,
13,
4706,
376,
3027,
29918,
9482,
287,
1115,
527,
29918,
9482,
287,
29918,
2378,
29892,
13,
4706,
376,
19488,
29918,
4141,
29918,
711,
643,
1490,
1115,
10809,
29918,
4141,
29918,
711,
643,
1490,
29918,
2378,
29892,
13,
4706,
376,
1990,
29918,
2248,
1115,
770,
29918,
2248,
29918,
2378,
29892,
13,
4706,
376,
4351,
29918,
4220,
1115,
4765,
29918,
4220,
29918,
2378,
29892,
13,
4706,
376,
29873,
4141,
29918,
4220,
1115,
260,
4141,
29918,
4220,
29918,
2378,
29892,
13,
1678,
500,
13,
13,
1678,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
2287,
29925,
4690,
29901,
13,
4706,
848,
3366,
19488,
29918,
711,
643,
1490,
3108,
353,
10809,
29918,
711,
643,
1490,
29918,
2378,
13,
4706,
848,
3366,
19488,
29918,
9482,
287,
3108,
353,
10809,
29918,
9482,
287,
29918,
2378,
13,
13,
1678,
565,
2295,
29889,
11618,
29889,
1177,
12336,
29918,
1529,
16033,
29901,
13,
4706,
848,
3366,
13168,
29918,
711,
643,
1490,
3108,
353,
11105,
29918,
711,
643,
1490,
29918,
2378,
13,
4706,
848,
3366,
13168,
29918,
9482,
287,
3108,
353,
11105,
29918,
9482,
287,
29918,
2378,
13,
13,
1678,
3858,
353,
8853,
5450,
1115,
5731,
29918,
29875,
29906,
29878,
29918,
2378,
29892,
376,
3286,
1115,
1301,
29918,
29875,
29906,
29878,
29918,
2378,
29913,
13,
13,
1678,
565,
2295,
29889,
11618,
29889,
15094,
29928,
29918,
1529,
16033,
29901,
13,
4706,
3858,
3366,
13168,
29918,
4141,
29918,
711,
643,
1490,
3108,
353,
11105,
29918,
4141,
29918,
711,
643,
1490,
29918,
2378,
13,
13,
1678,
565,
2295,
29889,
11618,
29889,
15094,
29928,
29918,
29943,
27998,
29901,
13,
4706,
3858,
3366,
1731,
3108,
353,
4972,
29918,
29875,
29906,
29878,
29918,
2378,
13,
4706,
3858,
3366,
1731,
29918,
705,
5861,
3108,
353,
4972,
29918,
29875,
29906,
29878,
29918,
705,
5861,
29918,
2378,
13,
13,
1678,
565,
2295,
29889,
14968,
29918,
1524,
29889,
1660,
29941,
29918,
13427,
29918,
3927,
1799,
29901,
13,
4706,
3858,
3366,
3149,
29918,
9274,
29918,
4299,
3108,
353,
1060,
29918,
5415,
29918,
2378,
13,
4706,
3858,
3366,
3149,
29918,
9274,
29918,
705,
5861,
3108,
353,
1060,
29918,
5415,
29918,
705,
5861,
29918,
2378,
13,
4706,
3858,
3366,
3149,
29918,
9274,
29918,
711,
643,
1490,
3108,
353,
260,
4141,
29918,
9748,
29918,
2378,
13,
13,
1678,
736,
8853,
1272,
1115,
848,
29892,
376,
1643,
1115,
3858,
29913,
13,
2
] |
Codewars/8kyu/return-negative/Python/test.py | RevansChen/online-judge | 7 | 138749 | # Python - 3.6.0
Test.assert_equals(make_negative(42), -42)
| [
1,
396,
5132,
448,
29871,
29941,
29889,
29953,
29889,
29900,
13,
13,
3057,
29889,
9294,
29918,
10954,
29898,
5675,
29918,
22198,
29898,
29946,
29906,
511,
448,
29946,
29906,
29897,
13,
2
] |
src/natural/preprocess.py | snemvalts/line-chart-captioning | 0 | 92317 | <gh_stars>0
from os import listdir
from os.path import isfile, join
import csv
import pathlib
import re
from shutil import copyfile
broken_images = ["50", "71", "85", "95", "115", "159",
"237", "298", "345", "354", "455", "475", "510", "517",
"554", "609", "700", "748", "750", "815", "845", "868",
"875", "911", "928", "1016", "1054", "1058", "1213", "1281",
"1317", "1326", "1406", "1527", "1553", "1563", "1683", "1690",
"1736", "1801", "1884", "1885", "1929", "1939", "2041", "2046",
"2077", "2098", "2159", "2191", "2246", "2295", "2312", "2318",
"2331", "2562", "2572", "2639", "2648", "2657", "2707", "2780",
"2788", "2824", "2859", "2920", "3026", "3178", "3282", "3342",
"3354", "3357", "3366", "3493", "3520", "3582", "3583", "3598",
"3636", "3975", "4048", "4078", "4154", "4165", "4169", "4182",
"4340", "4365", "4434", "4447", "4469", "4478", "4499", "4511",
"4544", "4549", "4585", "4619", "4828", "4912", "4913", "4938",
"5013", "5052", "5055", "5070", "5097", "5098", "5106", "5111",
"5324", "5360", "5406", "5408", "5411", "5548", "5608", "5706",
"5732", "5761", "5790", "5872", "5897", "5951", "5979", "6013",
"6062", "6069", "6097", "6100", "6203", "6272", "6274", "6324",
"6343", "6430", "6541", "6564", "6568", "6617", "6623", "6668",
"6683", "6756"]
USE_TRAIN = True
# only year based are line graphs, same definition in chart2text
def is_line_graph(data):
return data[0][0].lower() == "year"
dataset_folder = "data/charttotext/"
data_folder = join(dataset_folder, "data")
captions_folder = join(dataset_folder, "captions")
data_files = [f for f in listdir(data_folder) if isfile(join(data_folder, f))]
caption_files = [f for f in listdir(captions_folder) if isfile(join(captions_folder, f))]
data_caption_pairing = {}
print("reading data files...")
for data_file_name in data_files:
data_file_path = join(data_folder, data_file_name)
data_number = data_file_name.split(".csv")[0]
with open(data_file_path, 'r') as data_file:
data_file_reader = csv.reader(data_file)
data = list(data_file_reader)
if(is_line_graph(data) and data_number not in broken_images):
data_caption_pairing[data_number] = [data]
# add captions to same dict,
for caption_file_name in caption_files:
caption_number = caption_file_name.split(".txt")[0]
if(caption_number in data_caption_pairing):
caption_file_path = join(captions_folder, caption_file_name)
with open(caption_file_path, 'r') as caption_file:
caption = "".join(caption_file.readlines()).rstrip()
data_caption_pairing[caption_number].append(caption)
# every data should have a caption
assert all(map(lambda pair: len(pair) == 2, data_caption_pairing.values()))
pathlib.Path("data/processed_natural/images").mkdir(parents=True, exist_ok=True)
def clean_table_data(table_data):
new_table_data = []
for row in table_data:
year = int(re.sub("[^0-9]", "", row[0]))
data = float(re.sub("[^0-9\.]", "", row[1]))
new_table_data.append([year, data])
return new_table_data
keys_and_captions = []
for key in list(data_caption_pairing.keys()):
raw_data = data_caption_pairing[key][0]
caption = data_caption_pairing[key][1]
keys_and_captions.append([key, caption])
copyfile(f"{dataset_folder}/matplot/{key}.png", f"data/processed_natural/images/{key}.png")
with open("data/processed_natural/captions.csv", mode="w") as captions_file:
captions_writer = csv.writer(captions_file)
captions_writer.writerow(['number', 'caption'])
captions_writer.writerows(keys_and_captions) | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
2897,
1053,
1051,
3972,
13,
3166,
2897,
29889,
2084,
1053,
338,
1445,
29892,
5988,
13,
5215,
11799,
13,
5215,
2224,
1982,
13,
5215,
337,
13,
3166,
528,
4422,
1053,
3509,
1445,
13,
13,
13,
6729,
1717,
29918,
8346,
353,
6796,
29945,
29900,
613,
376,
29955,
29896,
613,
376,
29947,
29945,
613,
376,
29929,
29945,
613,
376,
29896,
29896,
29945,
613,
376,
29896,
29945,
29929,
613,
13,
29908,
29906,
29941,
29955,
613,
376,
29906,
29929,
29947,
613,
376,
29941,
29946,
29945,
613,
376,
29941,
29945,
29946,
613,
376,
29946,
29945,
29945,
613,
376,
29946,
29955,
29945,
613,
376,
29945,
29896,
29900,
613,
376,
29945,
29896,
29955,
613,
13,
29908,
29945,
29945,
29946,
613,
376,
29953,
29900,
29929,
613,
376,
29955,
29900,
29900,
613,
376,
29955,
29946,
29947,
613,
376,
29955,
29945,
29900,
613,
376,
29947,
29896,
29945,
613,
376,
29947,
29946,
29945,
613,
376,
29947,
29953,
29947,
613,
13,
29908,
29947,
29955,
29945,
613,
376,
29929,
29896,
29896,
613,
376,
29929,
29906,
29947,
613,
376,
29896,
29900,
29896,
29953,
613,
376,
29896,
29900,
29945,
29946,
613,
376,
29896,
29900,
29945,
29947,
613,
376,
29896,
29906,
29896,
29941,
613,
376,
29896,
29906,
29947,
29896,
613,
13,
29908,
29896,
29941,
29896,
29955,
613,
376,
29896,
29941,
29906,
29953,
613,
376,
29896,
29946,
29900,
29953,
613,
376,
29896,
29945,
29906,
29955,
613,
376,
29896,
29945,
29945,
29941,
613,
376,
29896,
29945,
29953,
29941,
613,
376,
29896,
29953,
29947,
29941,
613,
376,
29896,
29953,
29929,
29900,
613,
13,
29908,
29896,
29955,
29941,
29953,
613,
376,
29896,
29947,
29900,
29896,
613,
376,
29896,
29947,
29947,
29946,
613,
376,
29896,
29947,
29947,
29945,
613,
376,
29896,
29929,
29906,
29929,
613,
376,
29896,
29929,
29941,
29929,
613,
376,
29906,
29900,
29946,
29896,
613,
376,
29906,
29900,
29946,
29953,
613,
13,
29908,
29906,
29900,
29955,
29955,
613,
376,
29906,
29900,
29929,
29947,
613,
376,
29906,
29896,
29945,
29929,
613,
376,
29906,
29896,
29929,
29896,
613,
376,
29906,
29906,
29946,
29953,
613,
376,
29906,
29906,
29929,
29945,
613,
376,
29906,
29941,
29896,
29906,
613,
376,
29906,
29941,
29896,
29947,
613,
13,
29908,
29906,
29941,
29941,
29896,
613,
376,
29906,
29945,
29953,
29906,
613,
376,
29906,
29945,
29955,
29906,
613,
376,
29906,
29953,
29941,
29929,
613,
376,
29906,
29953,
29946,
29947,
613,
376,
29906,
29953,
29945,
29955,
613,
376,
29906,
29955,
29900,
29955,
613,
376,
29906,
29955,
29947,
29900,
613,
13,
29908,
29906,
29955,
29947,
29947,
613,
376,
29906,
29947,
29906,
29946,
613,
376,
29906,
29947,
29945,
29929,
613,
376,
29906,
29929,
29906,
29900,
613,
376,
29941,
29900,
29906,
29953,
613,
376,
29941,
29896,
29955,
29947,
613,
376,
29941,
29906,
29947,
29906,
613,
376,
29941,
29941,
29946,
29906,
613,
29871,
13,
29908,
29941,
29941,
29945,
29946,
613,
376,
29941,
29941,
29945,
29955,
613,
376,
29941,
29941,
29953,
29953,
613,
376,
29941,
29946,
29929,
29941,
613,
376,
29941,
29945,
29906,
29900,
613,
376,
29941,
29945,
29947,
29906,
613,
376,
29941,
29945,
29947,
29941,
613,
376,
29941,
29945,
29929,
29947,
613,
13,
29908,
29941,
29953,
29941,
29953,
613,
376,
29941,
29929,
29955,
29945,
613,
376,
29946,
29900,
29946,
29947,
613,
376,
29946,
29900,
29955,
29947,
613,
376,
29946,
29896,
29945,
29946,
613,
376,
29946,
29896,
29953,
29945,
613,
376,
29946,
29896,
29953,
29929,
613,
376,
29946,
29896,
29947,
29906,
613,
29871,
13,
29908,
29946,
29941,
29946,
29900,
613,
376,
29946,
29941,
29953,
29945,
613,
376,
29946,
29946,
29941,
29946,
613,
376,
29946,
29946,
29946,
29955,
613,
376,
29946,
29946,
29953,
29929,
613,
376,
29946,
29946,
29955,
29947,
613,
376,
29946,
29946,
29929,
29929,
613,
376,
29946,
29945,
29896,
29896,
613,
13,
29908,
29946,
29945,
29946,
29946,
613,
376,
29946,
29945,
29946,
29929,
613,
376,
29946,
29945,
29947,
29945,
613,
376,
29946,
29953,
29896,
29929,
613,
376,
29946,
29947,
29906,
29947,
613,
376,
29946,
29929,
29896,
29906,
613,
376,
29946,
29929,
29896,
29941,
613,
376,
29946,
29929,
29941,
29947,
613,
13,
29908,
29945,
29900,
29896,
29941,
613,
376,
29945,
29900,
29945,
29906,
613,
376,
29945,
29900,
29945,
29945,
613,
376,
29945,
29900,
29955,
29900,
613,
376,
29945,
29900,
29929,
29955,
613,
376,
29945,
29900,
29929,
29947,
613,
376,
29945,
29896,
29900,
29953,
613,
376,
29945,
29896,
29896,
29896,
613,
13,
29908,
29945,
29941,
29906,
29946,
613,
376,
29945,
29941,
29953,
29900,
613,
376,
29945,
29946,
29900,
29953,
613,
376,
29945,
29946,
29900,
29947,
613,
376,
29945,
29946,
29896,
29896,
613,
376,
29945,
29945,
29946,
29947,
613,
376,
29945,
29953,
29900,
29947,
613,
376,
29945,
29955,
29900,
29953,
613,
13,
29908,
29945,
29955,
29941,
29906,
613,
376,
29945,
29955,
29953,
29896,
613,
376,
29945,
29955,
29929,
29900,
613,
376,
29945,
29947,
29955,
29906,
613,
376,
29945,
29947,
29929,
29955,
613,
376,
29945,
29929,
29945,
29896,
613,
376,
29945,
29929,
29955,
29929,
613,
376,
29953,
29900,
29896,
29941,
613,
13,
29908,
29953,
29900,
29953,
29906,
613,
376,
29953,
29900,
29953,
29929,
613,
376,
29953,
29900,
29929,
29955,
613,
376,
29953,
29896,
29900,
29900,
613,
376,
29953,
29906,
29900,
29941,
613,
376,
29953,
29906,
29955,
29906,
613,
376,
29953,
29906,
29955,
29946,
613,
376,
29953,
29941,
29906,
29946,
613,
13,
29908,
29953,
29941,
29946,
29941,
613,
376,
29953,
29946,
29941,
29900,
613,
376,
29953,
29945,
29946,
29896,
613,
376,
29953,
29945,
29953,
29946,
613,
376,
29953,
29945,
29953,
29947,
613,
376,
29953,
29953,
29896,
29955,
613,
376,
29953,
29953,
29906,
29941,
613,
376,
29953,
29953,
29953,
29947,
613,
29871,
13,
29908,
29953,
29953,
29947,
29941,
613,
376,
29953,
29955,
29945,
29953,
3108,
13,
13,
17171,
29918,
29911,
4717,
1177,
353,
5852,
13,
13,
29937,
871,
1629,
2729,
526,
1196,
18445,
29892,
1021,
5023,
297,
8727,
29906,
726,
13,
1753,
338,
29918,
1220,
29918,
4262,
29898,
1272,
1125,
13,
1678,
736,
848,
29961,
29900,
3816,
29900,
1822,
13609,
580,
1275,
376,
6360,
29908,
13,
13,
24713,
29918,
12083,
353,
376,
1272,
29914,
15425,
29873,
866,
486,
12975,
13,
1272,
29918,
12083,
353,
5988,
29898,
24713,
29918,
12083,
29892,
376,
1272,
1159,
13,
1113,
1980,
29918,
12083,
353,
5988,
29898,
24713,
29918,
12083,
29892,
376,
1113,
1980,
1159,
13,
13,
13,
13,
1272,
29918,
5325,
353,
518,
29888,
363,
285,
297,
1051,
3972,
29898,
1272,
29918,
12083,
29897,
565,
338,
1445,
29898,
7122,
29898,
1272,
29918,
12083,
29892,
285,
28166,
13,
6671,
29918,
5325,
353,
518,
29888,
363,
285,
297,
1051,
3972,
29898,
1113,
1980,
29918,
12083,
29897,
565,
338,
1445,
29898,
7122,
29898,
1113,
1980,
29918,
12083,
29892,
285,
28166,
13,
13,
13,
1272,
29918,
6671,
29918,
18784,
292,
353,
6571,
13,
13,
2158,
703,
19715,
848,
2066,
856,
1159,
13,
1454,
848,
29918,
1445,
29918,
978,
297,
848,
29918,
5325,
29901,
13,
1678,
848,
29918,
1445,
29918,
2084,
353,
5988,
29898,
1272,
29918,
12083,
29892,
848,
29918,
1445,
29918,
978,
29897,
13,
1678,
848,
29918,
4537,
353,
848,
29918,
1445,
29918,
978,
29889,
5451,
17350,
7638,
1159,
29961,
29900,
29962,
13,
13,
1678,
411,
1722,
29898,
1272,
29918,
1445,
29918,
2084,
29892,
525,
29878,
1495,
408,
848,
29918,
1445,
29901,
13,
4706,
848,
29918,
1445,
29918,
16950,
353,
11799,
29889,
16950,
29898,
1272,
29918,
1445,
29897,
13,
4706,
848,
353,
1051,
29898,
1272,
29918,
1445,
29918,
16950,
29897,
13,
4706,
565,
29898,
275,
29918,
1220,
29918,
4262,
29898,
1272,
29897,
322,
848,
29918,
4537,
451,
297,
9391,
29918,
8346,
1125,
13,
9651,
848,
29918,
6671,
29918,
18784,
292,
29961,
1272,
29918,
4537,
29962,
353,
518,
1272,
29962,
13,
13,
13,
29937,
788,
5777,
1980,
304,
1021,
9657,
29892,
29871,
13,
1454,
5777,
683,
29918,
1445,
29918,
978,
297,
5777,
683,
29918,
5325,
29901,
13,
1678,
5777,
683,
29918,
4537,
353,
5777,
683,
29918,
1445,
29918,
978,
29889,
5451,
17350,
3945,
1159,
29961,
29900,
29962,
13,
1678,
565,
29898,
6671,
29918,
4537,
297,
848,
29918,
6671,
29918,
18784,
292,
1125,
13,
4706,
5777,
683,
29918,
1445,
29918,
2084,
353,
5988,
29898,
1113,
1980,
29918,
12083,
29892,
5777,
683,
29918,
1445,
29918,
978,
29897,
13,
4706,
411,
1722,
29898,
6671,
29918,
1445,
29918,
2084,
29892,
525,
29878,
1495,
408,
5777,
683,
29918,
1445,
29901,
13,
9651,
5777,
683,
353,
376,
1642,
7122,
29898,
6671,
29918,
1445,
29889,
949,
9012,
16655,
29878,
17010,
580,
13,
9651,
848,
29918,
6671,
29918,
18784,
292,
29961,
6671,
29918,
4537,
1822,
4397,
29898,
6671,
29897,
13,
13,
29937,
1432,
848,
881,
505,
263,
5777,
683,
13,
9294,
599,
29898,
1958,
29898,
2892,
5101,
29901,
7431,
29898,
18784,
29897,
1275,
29871,
29906,
29892,
848,
29918,
6671,
29918,
18784,
292,
29889,
5975,
22130,
13,
13,
13,
13,
2084,
1982,
29889,
2605,
703,
1272,
29914,
5014,
287,
29918,
25047,
29914,
8346,
2564,
11256,
3972,
29898,
862,
1237,
29922,
5574,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
13,
13,
13,
1753,
5941,
29918,
2371,
29918,
1272,
29898,
2371,
29918,
1272,
1125,
13,
1678,
716,
29918,
2371,
29918,
1272,
353,
5159,
13,
13,
1678,
363,
1948,
297,
1591,
29918,
1272,
29901,
13,
4706,
1629,
353,
938,
29898,
276,
29889,
1491,
703,
22896,
29900,
29899,
29929,
29962,
613,
12633,
1948,
29961,
29900,
12622,
13,
4706,
848,
353,
5785,
29898,
276,
29889,
1491,
703,
22896,
29900,
29899,
29929,
29905,
5586,
613,
12633,
1948,
29961,
29896,
12622,
13,
4706,
716,
29918,
2371,
29918,
1272,
29889,
4397,
4197,
6360,
29892,
848,
2314,
13,
13,
1678,
736,
716,
29918,
2371,
29918,
1272,
13,
13,
13,
8149,
29918,
392,
29918,
1113,
1980,
353,
5159,
13,
13,
1454,
1820,
297,
1051,
29898,
1272,
29918,
6671,
29918,
18784,
292,
29889,
8149,
580,
1125,
13,
1678,
10650,
29918,
1272,
353,
848,
29918,
6671,
29918,
18784,
292,
29961,
1989,
3816,
29900,
29962,
13,
1678,
5777,
683,
353,
848,
29918,
6671,
29918,
18784,
292,
29961,
1989,
3816,
29896,
29962,
13,
1678,
6611,
29918,
392,
29918,
1113,
1980,
29889,
4397,
4197,
1989,
29892,
5777,
683,
2314,
13,
1678,
3509,
1445,
29898,
29888,
29908,
29912,
24713,
29918,
12083,
6822,
2922,
5317,
19248,
1989,
1836,
2732,
613,
285,
29908,
1272,
29914,
5014,
287,
29918,
25047,
29914,
8346,
19248,
1989,
1836,
2732,
1159,
13,
13,
13,
2541,
1722,
703,
1272,
29914,
5014,
287,
29918,
25047,
29914,
1113,
1980,
29889,
7638,
613,
4464,
543,
29893,
1159,
408,
5777,
1980,
29918,
1445,
29901,
13,
1678,
5777,
1980,
29918,
13236,
353,
11799,
29889,
13236,
29898,
1113,
1980,
29918,
1445,
29897,
13,
13,
1678,
5777,
1980,
29918,
13236,
29889,
13236,
340,
18959,
4537,
742,
525,
6671,
11287,
13,
1678,
5777,
1980,
29918,
13236,
29889,
13236,
1242,
29898,
8149,
29918,
392,
29918,
1113,
1980,
29897,
2
] |
Algorithm.Python/stubs/QuantConnect/Indicators/__CandlestickPatterns_1.py | gaoxiaojun/Lean | 2 | 41933 | from .__CandlestickPatterns_2 import *
import typing
import QuantConnect.Indicators.CandlestickPatterns
import datetime
class DojiStar(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Doji Star candlestick pattern indicator
DojiStar(name: str)
DojiStar()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.DojiStar:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.DojiStar:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.DojiStar:
pass
IsReady: bool
class DragonflyDoji(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Dragonfly Doji candlestick pattern indicator
DragonflyDoji(name: str)
DragonflyDoji()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.DragonflyDoji:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.DragonflyDoji:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.DragonflyDoji:
pass
IsReady: bool
class Engulfing(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Engulfing candlestick pattern
Engulfing(name: str)
Engulfing()
"""
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.Engulfing:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.Engulfing:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.Engulfing:
pass
IsReady: bool
class EveningDojiStar(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Evening Doji Star candlestick pattern
EveningDojiStar(name: str, penetration: Decimal)
EveningDojiStar(penetration: Decimal)
EveningDojiStar()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str, penetration: float) -> QuantConnect.Indicators.CandlestickPatterns.EveningDojiStar:
pass
@typing.overload
def __init__(self, penetration: float) -> QuantConnect.Indicators.CandlestickPatterns.EveningDojiStar:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.EveningDojiStar:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.EveningDojiStar:
pass
IsReady: bool
class EveningStar(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Evening Star candlestick pattern
EveningStar(name: str, penetration: Decimal)
EveningStar(penetration: Decimal)
EveningStar()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str, penetration: float) -> QuantConnect.Indicators.CandlestickPatterns.EveningStar:
pass
@typing.overload
def __init__(self, penetration: float) -> QuantConnect.Indicators.CandlestickPatterns.EveningStar:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.EveningStar:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.EveningStar:
pass
IsReady: bool
class GapSideBySideWhite(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Up/Down-gap side-by-side white lines candlestick pattern
GapSideBySideWhite(name: str)
GapSideBySideWhite()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.GapSideBySideWhite:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.GapSideBySideWhite:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.GapSideBySideWhite:
pass
IsReady: bool
class GravestoneDoji(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Gravestone Doji candlestick pattern indicator
GravestoneDoji(name: str)
GravestoneDoji()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.GravestoneDoji:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.GravestoneDoji:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.GravestoneDoji:
pass
IsReady: bool
class Hammer(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Hammer candlestick pattern indicator
Hammer(name: str)
Hammer()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.Hammer:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.Hammer:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.Hammer:
pass
IsReady: bool
class HangingMan(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Hanging Man candlestick pattern indicator
HangingMan(name: str)
HangingMan()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.HangingMan:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.HangingMan:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.HangingMan:
pass
IsReady: bool
class Harami(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Harami candlestick pattern indicator
Harami(name: str)
Harami()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.Harami:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.Harami:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.Harami:
pass
IsReady: bool
class HaramiCross(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Harami Cross candlestick pattern indicator
HaramiCross(name: str)
HaramiCross()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.HaramiCross:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.HaramiCross:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.HaramiCross:
pass
IsReady: bool
class HighWaveCandle(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
High-Wave Candle candlestick pattern indicator
HighWaveCandle(name: str)
HighWaveCandle()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.HighWaveCandle:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.HighWaveCandle:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.HighWaveCandle:
pass
IsReady: bool
class Hikkake(QuantConnect.Indicators.CandlestickPatterns.CandlestickPattern, System.IComparable, QuantConnect.Indicators.IIndicator[IBaseDataBar], QuantConnect.Indicators.IIndicator, System.IComparable[IIndicator[IBaseDataBar]]):
"""
Hikkake candlestick pattern
Hikkake(name: str)
Hikkake()
"""
def Reset(self) -> None:
pass
@typing.overload
def __init__(self, name: str) -> QuantConnect.Indicators.CandlestickPatterns.Hikkake:
pass
@typing.overload
def __init__(self) -> QuantConnect.Indicators.CandlestickPatterns.Hikkake:
pass
def __init__(self, *args) -> QuantConnect.Indicators.CandlestickPatterns.Hikkake:
pass
IsReady: bool
| [
1,
515,
869,
1649,
29907,
392,
29880,
342,
860,
17144,
29879,
29918,
29906,
1053,
334,
13,
5215,
19229,
13,
5215,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
13,
5215,
12865,
13,
13,
13,
13,
1990,
1938,
2397,
16213,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
1938,
2397,
7828,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
1938,
2397,
16213,
29898,
978,
29901,
851,
29897,
13,
1678,
1938,
2397,
16213,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
6132,
2397,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
6132,
2397,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
6132,
2397,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
24339,
17652,
6132,
2397,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
24339,
17652,
1938,
2397,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
24339,
17652,
6132,
2397,
29898,
978,
29901,
851,
29897,
13,
1678,
24339,
17652,
6132,
2397,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
23978,
265,
17652,
6132,
2397,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
23978,
265,
17652,
6132,
2397,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
23978,
265,
17652,
6132,
2397,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
2201,
16302,
292,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
2201,
16302,
292,
23794,
29880,
342,
860,
4766,
13,
268,
13,
1678,
2201,
16302,
292,
29898,
978,
29901,
851,
29897,
13,
1678,
2201,
16302,
292,
580,
13,
1678,
9995,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
8100,
16302,
292,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
8100,
16302,
292,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
8100,
16302,
292,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
7753,
292,
6132,
2397,
16213,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
7753,
292,
1938,
2397,
7828,
23794,
29880,
342,
860,
4766,
13,
268,
13,
1678,
7753,
292,
6132,
2397,
16213,
29898,
978,
29901,
851,
29892,
6584,
18184,
362,
29901,
3826,
3039,
29897,
13,
1678,
7753,
292,
6132,
2397,
16213,
29898,
2238,
18184,
362,
29901,
3826,
3039,
29897,
13,
1678,
7753,
292,
6132,
2397,
16213,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29892,
6584,
18184,
362,
29901,
5785,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
6132,
2397,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6584,
18184,
362,
29901,
5785,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
6132,
2397,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
6132,
2397,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
6132,
2397,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
7753,
292,
16213,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
7753,
292,
7828,
23794,
29880,
342,
860,
4766,
13,
268,
13,
1678,
7753,
292,
16213,
29898,
978,
29901,
851,
29892,
6584,
18184,
362,
29901,
3826,
3039,
29897,
13,
1678,
7753,
292,
16213,
29898,
2238,
18184,
362,
29901,
3826,
3039,
29897,
13,
1678,
7753,
292,
16213,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29892,
6584,
18184,
362,
29901,
5785,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
6584,
18184,
362,
29901,
5785,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29923,
854,
292,
16213,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
402,
481,
23908,
2059,
23908,
21823,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
5020,
29914,
6767,
29899,
29887,
481,
2625,
29899,
1609,
29899,
2975,
4796,
3454,
23794,
29880,
342,
860,
4766,
13,
268,
13,
1678,
402,
481,
23908,
2059,
23908,
21823,
29898,
978,
29901,
851,
29897,
13,
1678,
402,
481,
23908,
2059,
23908,
21823,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29954,
481,
23908,
2059,
23908,
21823,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29954,
481,
23908,
2059,
23908,
21823,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29954,
481,
23908,
2059,
23908,
21823,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
4989,
10147,
650,
6132,
2397,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
4989,
10147,
650,
1938,
2397,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
4989,
10147,
650,
6132,
2397,
29898,
978,
29901,
851,
29897,
13,
1678,
4989,
10147,
650,
6132,
2397,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29954,
5705,
27744,
6132,
2397,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29954,
5705,
27744,
6132,
2397,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29954,
5705,
27744,
6132,
2397,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
7904,
1050,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
7904,
1050,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
7904,
1050,
29898,
978,
29901,
851,
29897,
13,
1678,
7904,
1050,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
28527,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
28527,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
28527,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
379,
9776,
2517,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
379,
9776,
2315,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
379,
9776,
2517,
29898,
978,
29901,
851,
29897,
13,
1678,
379,
9776,
2517,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
9776,
2517,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
9776,
2517,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
9776,
2517,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
3536,
4479,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
3536,
4479,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
3536,
4479,
29898,
978,
29901,
851,
29897,
13,
1678,
3536,
4479,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
21972,
4479,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
21972,
4479,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
21972,
4479,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
3536,
4479,
29907,
2124,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
3536,
4479,
11189,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
3536,
4479,
29907,
2124,
29898,
978,
29901,
851,
29897,
13,
1678,
3536,
4479,
29907,
2124,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
21972,
4479,
29907,
2124,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
21972,
4479,
29907,
2124,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
21972,
4479,
29907,
2124,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
5057,
29956,
1351,
29907,
392,
280,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
5057,
29899,
29956,
1351,
28433,
280,
23794,
29880,
342,
860,
4766,
27717,
13,
268,
13,
1678,
5057,
29956,
1351,
29907,
392,
280,
29898,
978,
29901,
851,
29897,
13,
1678,
5057,
29956,
1351,
29907,
392,
280,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
16382,
29956,
1351,
29907,
392,
280,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
16382,
29956,
1351,
29907,
392,
280,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
16382,
29956,
1351,
29907,
392,
280,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
13,
13,
13,
1990,
379,
25882,
1296,
29898,
22930,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29907,
392,
29880,
342,
860,
17144,
29892,
2184,
29889,
29902,
1523,
862,
519,
29892,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
1402,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29902,
28013,
29892,
2184,
29889,
29902,
1523,
862,
519,
29961,
29902,
28013,
29961,
29902,
5160,
1469,
4297,
5262,
1125,
13,
1678,
9995,
13,
1678,
379,
25882,
1296,
23794,
29880,
342,
860,
4766,
13,
268,
13,
1678,
379,
25882,
1296,
29898,
978,
29901,
851,
29897,
13,
1678,
379,
25882,
1296,
580,
13,
1678,
9995,
13,
1678,
822,
2538,
300,
29898,
1311,
29897,
1599,
6213,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29901,
851,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
25882,
1296,
29901,
13,
4706,
1209,
13,
13,
1678,
732,
1017,
15702,
29889,
957,
1359,
13,
1678,
822,
4770,
2344,
12035,
1311,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
25882,
1296,
29901,
13,
4706,
1209,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29897,
1599,
22746,
17918,
29889,
2568,
293,
4097,
29889,
29907,
392,
29880,
342,
860,
17144,
29879,
29889,
29950,
25882,
1296,
29901,
13,
4706,
1209,
13,
13,
1678,
1317,
28181,
29901,
6120,
13,
2
] |
dependency/libgit/pygit2-0.21.4/pygit2/blame.py | RangHo/pini-engine | 0 | 140483 | # -*- coding: utf-8 -*-
#
# Copyright 2010-2014 The pygit2 contributors
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2,
# as published by the Free Software Foundation.
#
# In addition to the permissions in the GNU General Public License,
# the authors give you unlimited permission to link the compiled
# version of this file into combinations with other programs,
# and to distribute those combinations without any restriction
# coming from the use of this file. (The General Public License
# restrictions do apply in other respects; for example, they cover
# modification of the file, and distribution when not linked into
# a combined executable.)
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
# Import from the future
from __future__ import absolute_import, unicode_literals
# Import from pygit2
from .errors import check_error
from .ffi import ffi, C
from .utils import to_bytes, is_string, to_str
from _pygit2 import Signature, Oid
def wrap_signature(csig):
if not csig:
return None
return Signature(ffi.string(csig.name).decode('utf-8'),
ffi.string(csig.email).decode('utf-8'),
csig.when.time, csig.when.offset, 'utf-8')
class BlameHunk(object):
@classmethod
def _from_c(cls, blame, ptr):
hunk = cls.__new__(cls)
hunk._blame = blame
hunk._hunk = ptr
return hunk
@property
def lines_in_hunk(self):
"""Number of lines"""
return self._hunk.lines_in_hunk
@property
def boundary(self):
"""Tracked to a boundary commit"""
# Casting directly to bool via cffi does not seem to work
return int(ffi.cast('int', self._hunk.boundary)) != 0
@property
def final_start_line_number(self):
"""Final start line number"""
return self._hunk.final_start_line_number
@property
def final_committer(self):
"""Final committer"""
return wrap_signature(self._hunk.final_signature)
@property
def final_commit_id(self):
return Oid(raw=bytes(ffi.buffer(ffi.addressof(self._hunk, 'final_commit_id'))[:]))
@property
def orig_start_line_number(self):
"""Origin start line number"""
return self._hunk.orig_start_line_number
@property
def orig_committer(self):
"""Original committer"""
return wrap_signature(self._hunk.orig_signature)
@property
def orig_commit_id(self):
return Oid(raw=bytes(ffi.buffer(ffi.addressof(self._hunk, 'orig_commit_id'))[:]))
@property
def orig_path(self):
"""Original path"""
path = self._hunk.orig_path
if not path:
return None
return ffi.string(path).decode()
class Blame(object):
@classmethod
def _from_c(cls, repo, ptr):
blame = cls.__new__(cls)
blame._repo = repo
blame._blame = ptr
return blame
def __del__(self):
C.git_blame_free(self._blame)
def __len__(self):
return C.git_blame_get_hunk_count(self._blame)
def __getitem__(self, index):
chunk = C.git_blame_get_hunk_byindex(self._blame, index)
if not chunk:
raise IndexError
return BlameHunk._from_c(self, chunk)
def for_line(self, line_no):
"""for_line(line_no) -> BlameHunk
Returns the blame hunk data for a given line given its number
in the current Blame.
Arguments:
line_no
Line number, starts at 1.
"""
if line_no < 0:
raise IndexError
chunk = C.git_blame_get_hunk_byline(self._blame, line_no)
if not chunk:
raise IndexError
return BlameHunk._from_c(self, chunk)
class BlameIterator(object):
def __init__(self, blame):
self._count = len(blame)
self._index = 0
self._blame = blame
def __next__(self):
if self._index >= self._count:
raise StopIteration
hunk = self._blame[self._blame]
self._index += 1
return hunk
def next(self):
return self.__next__()
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29900,
29899,
29906,
29900,
29896,
29946,
450,
19484,
277,
29906,
17737,
29560,
13,
29937,
13,
29937,
910,
934,
338,
3889,
7047,
29936,
366,
508,
2654,
391,
2666,
372,
322,
29914,
272,
6623,
13,
29937,
372,
1090,
278,
4958,
310,
278,
15143,
4593,
5236,
19245,
29892,
1873,
29871,
29906,
29892,
13,
29937,
408,
6369,
491,
278,
12362,
18540,
10606,
29889,
13,
29937,
13,
29937,
512,
6124,
304,
278,
11239,
297,
278,
15143,
4593,
5236,
19245,
29892,
13,
29937,
278,
15717,
2367,
366,
443,
29044,
10751,
304,
1544,
278,
13126,
13,
29937,
1873,
310,
445,
934,
964,
18240,
411,
916,
11104,
29892,
13,
29937,
322,
304,
1320,
2666,
1906,
18240,
1728,
738,
24345,
13,
29937,
6421,
515,
278,
671,
310,
445,
934,
29889,
29871,
313,
1576,
4593,
5236,
19245,
13,
29937,
25091,
437,
3394,
297,
916,
3390,
29879,
29936,
363,
1342,
29892,
896,
4612,
13,
29937,
21733,
310,
278,
934,
29892,
322,
4978,
746,
451,
9024,
964,
13,
29937,
263,
12420,
16813,
1846,
13,
29937,
13,
29937,
910,
934,
338,
13235,
297,
278,
4966,
393,
372,
674,
367,
5407,
29892,
541,
13,
29937,
399,
1806,
8187,
2692,
13764,
29979,
399,
1718,
29934,
13566,
29979,
29936,
1728,
1584,
278,
2411,
2957,
1370,
21867,
29891,
310,
13,
29937,
341,
1001,
3210,
13566,
2882,
6227,
11937,
470,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
29889,
29871,
2823,
278,
15143,
13,
29937,
4593,
5236,
19245,
363,
901,
4902,
29889,
13,
29937,
13,
29937,
887,
881,
505,
4520,
263,
3509,
310,
278,
15143,
4593,
5236,
19245,
13,
29937,
3412,
411,
445,
1824,
29936,
1074,
278,
934,
315,
4590,
29979,
4214,
29889,
29871,
960,
451,
29892,
2436,
304,
13,
29937,
278,
12362,
18540,
10606,
29892,
29871,
29945,
29896,
21504,
7103,
29892,
29008,
386,
383,
10102,
29892,
13,
29937,
12115,
29892,
14861,
29871,
29900,
29906,
29896,
29896,
29900,
29899,
29896,
29941,
29900,
29896,
29892,
8278,
29889,
13,
13,
29937,
16032,
515,
278,
5434,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
29892,
29104,
29918,
20889,
1338,
13,
13,
29937,
16032,
515,
19484,
277,
29906,
13,
3166,
869,
12523,
1053,
1423,
29918,
2704,
13,
3166,
869,
600,
29875,
1053,
285,
7241,
29892,
315,
13,
3166,
869,
13239,
1053,
304,
29918,
13193,
29892,
338,
29918,
1807,
29892,
304,
29918,
710,
13,
3166,
903,
2272,
5559,
29906,
1053,
9954,
1535,
29892,
438,
333,
13,
13,
1753,
12244,
29918,
4530,
1535,
29898,
2395,
335,
1125,
13,
1678,
565,
451,
5939,
335,
29901,
13,
4706,
736,
6213,
13,
13,
1678,
736,
9954,
1535,
29898,
600,
29875,
29889,
1807,
29898,
2395,
335,
29889,
978,
467,
13808,
877,
9420,
29899,
29947,
5477,
13,
462,
268,
285,
7241,
29889,
1807,
29898,
2395,
335,
29889,
5269,
467,
13808,
877,
9420,
29899,
29947,
5477,
13,
462,
268,
5939,
335,
29889,
8256,
29889,
2230,
29892,
5939,
335,
29889,
8256,
29889,
10289,
29892,
525,
9420,
29899,
29947,
1495,
13,
13,
1990,
3164,
420,
29950,
2960,
29898,
3318,
1125,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
903,
3166,
29918,
29883,
29898,
25932,
29892,
1999,
420,
29892,
23246,
1125,
13,
4706,
298,
2960,
353,
1067,
29879,
17255,
1482,
12035,
25932,
29897,
13,
4706,
298,
2960,
3032,
2204,
420,
353,
1999,
420,
13,
4706,
298,
2960,
3032,
29882,
2960,
353,
23246,
13,
4706,
736,
298,
2960,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3454,
29918,
262,
29918,
29882,
2960,
29898,
1311,
1125,
13,
4706,
9995,
4557,
310,
3454,
15945,
29908,
13,
4706,
736,
1583,
3032,
29882,
2960,
29889,
9012,
29918,
262,
29918,
29882,
2960,
13,
13,
1678,
732,
6799,
13,
1678,
822,
10452,
29898,
1311,
1125,
13,
4706,
9995,
17936,
287,
304,
263,
10452,
9063,
15945,
29908,
13,
4706,
396,
4834,
292,
4153,
304,
6120,
3025,
274,
600,
29875,
947,
451,
2833,
304,
664,
13,
4706,
736,
938,
29898,
600,
29875,
29889,
4384,
877,
524,
742,
1583,
3032,
29882,
2960,
29889,
9917,
653,
876,
2804,
29871,
29900,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2186,
29918,
2962,
29918,
1220,
29918,
4537,
29898,
1311,
1125,
13,
4706,
9995,
15790,
1369,
1196,
1353,
15945,
29908,
13,
4706,
736,
1583,
3032,
29882,
2960,
29889,
8394,
29918,
2962,
29918,
1220,
29918,
4537,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2186,
29918,
2055,
5171,
29898,
1311,
1125,
13,
4706,
9995,
15790,
844,
5171,
15945,
29908,
13,
4706,
736,
12244,
29918,
4530,
1535,
29898,
1311,
3032,
29882,
2960,
29889,
8394,
29918,
4530,
1535,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2186,
29918,
15060,
29918,
333,
29898,
1311,
1125,
13,
4706,
736,
438,
333,
29898,
1610,
29922,
13193,
29898,
600,
29875,
29889,
9040,
29898,
600,
29875,
29889,
7328,
974,
29898,
1311,
3032,
29882,
2960,
29892,
525,
8394,
29918,
15060,
29918,
333,
8785,
7503,
12622,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1677,
29918,
2962,
29918,
1220,
29918,
4537,
29898,
1311,
1125,
13,
4706,
9995,
23182,
1369,
1196,
1353,
15945,
29908,
13,
4706,
736,
1583,
3032,
29882,
2960,
29889,
12683,
29918,
2962,
29918,
1220,
29918,
4537,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1677,
29918,
2055,
5171,
29898,
1311,
1125,
13,
4706,
9995,
26036,
844,
5171,
15945,
29908,
13,
4706,
736,
12244,
29918,
4530,
1535,
29898,
1311,
3032,
29882,
2960,
29889,
12683,
29918,
4530,
1535,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1677,
29918,
15060,
29918,
333,
29898,
1311,
1125,
13,
4706,
736,
438,
333,
29898,
1610,
29922,
13193,
29898,
600,
29875,
29889,
9040,
29898,
600,
29875,
29889,
7328,
974,
29898,
1311,
3032,
29882,
2960,
29892,
525,
12683,
29918,
15060,
29918,
333,
8785,
7503,
12622,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1677,
29918,
2084,
29898,
1311,
1125,
13,
4706,
9995,
26036,
2224,
15945,
29908,
13,
4706,
2224,
353,
1583,
3032,
29882,
2960,
29889,
12683,
29918,
2084,
13,
4706,
565,
451,
2224,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
736,
285,
7241,
29889,
1807,
29898,
2084,
467,
13808,
580,
13,
13,
13,
1990,
3164,
420,
29898,
3318,
1125,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
903,
3166,
29918,
29883,
29898,
25932,
29892,
13761,
29892,
23246,
1125,
13,
4706,
1999,
420,
353,
1067,
29879,
17255,
1482,
12035,
25932,
29897,
13,
4706,
1999,
420,
3032,
20095,
353,
13761,
13,
4706,
1999,
420,
3032,
2204,
420,
353,
23246,
13,
4706,
736,
1999,
420,
13,
13,
1678,
822,
4770,
6144,
12035,
1311,
1125,
13,
4706,
315,
29889,
5559,
29918,
2204,
420,
29918,
9021,
29898,
1311,
3032,
2204,
420,
29897,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
315,
29889,
5559,
29918,
2204,
420,
29918,
657,
29918,
29882,
2960,
29918,
2798,
29898,
1311,
3032,
2204,
420,
29897,
13,
13,
1678,
822,
4770,
657,
667,
12035,
1311,
29892,
2380,
1125,
13,
4706,
19875,
353,
315,
29889,
5559,
29918,
2204,
420,
29918,
657,
29918,
29882,
2960,
29918,
1609,
2248,
29898,
1311,
3032,
2204,
420,
29892,
2380,
29897,
13,
4706,
565,
451,
19875,
29901,
13,
9651,
12020,
11374,
2392,
13,
13,
4706,
736,
3164,
420,
29950,
2960,
3032,
3166,
29918,
29883,
29898,
1311,
29892,
19875,
29897,
13,
13,
1678,
822,
363,
29918,
1220,
29898,
1311,
29892,
1196,
29918,
1217,
1125,
13,
4706,
9995,
1454,
29918,
1220,
29898,
1220,
29918,
1217,
29897,
1599,
3164,
420,
29950,
2960,
13,
13,
4706,
16969,
278,
1999,
420,
298,
2960,
848,
363,
263,
2183,
1196,
2183,
967,
1353,
13,
4706,
297,
278,
1857,
3164,
420,
29889,
13,
13,
4706,
11842,
9331,
29901,
13,
13,
4706,
1196,
29918,
1217,
13,
9651,
7407,
1353,
29892,
8665,
472,
29871,
29896,
29889,
13,
4706,
9995,
13,
4706,
565,
1196,
29918,
1217,
529,
29871,
29900,
29901,
13,
9651,
12020,
11374,
2392,
13,
13,
4706,
19875,
353,
315,
29889,
5559,
29918,
2204,
420,
29918,
657,
29918,
29882,
2960,
29918,
1609,
1220,
29898,
1311,
3032,
2204,
420,
29892,
1196,
29918,
1217,
29897,
13,
4706,
565,
451,
19875,
29901,
13,
9651,
12020,
11374,
2392,
13,
13,
4706,
736,
3164,
420,
29950,
2960,
3032,
3166,
29918,
29883,
29898,
1311,
29892,
19875,
29897,
13,
13,
13,
1990,
3164,
420,
20277,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1999,
420,
1125,
13,
4706,
1583,
3032,
2798,
353,
7431,
29898,
2204,
420,
29897,
13,
4706,
1583,
3032,
2248,
353,
29871,
29900,
13,
4706,
1583,
3032,
2204,
420,
353,
1999,
420,
13,
13,
1678,
822,
4770,
4622,
12035,
1311,
1125,
13,
4706,
565,
1583,
3032,
2248,
6736,
1583,
3032,
2798,
29901,
13,
9651,
12020,
22303,
13463,
362,
13,
13,
4706,
298,
2960,
353,
1583,
3032,
2204,
420,
29961,
1311,
3032,
2204,
420,
29962,
13,
4706,
1583,
3032,
2248,
4619,
29871,
29896,
13,
13,
4706,
736,
298,
2960,
13,
13,
1678,
822,
2446,
29898,
1311,
1125,
13,
4706,
736,
1583,
17255,
4622,
1649,
580,
13,
2
] |
examples/context_eddystone_beacon.py | ddunmire/python-bleson | 103 | 116460 | #!/usr/bin/env python3
import sys
from time import sleep
from bleson import get_provider, EddystoneBeacon
# Get the wait time from the first script argument or default it to 10 seconds
WAIT_TIME = int(sys.argv[1]) if len(sys.argv)>1 else 10
with EddystoneBeacon(get_provider().get_adapter(), 'https://www.bluetooth.com/'):
sleep(WAIT_TIME)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
5215,
10876,
13,
3166,
931,
1053,
8709,
13,
3166,
289,
793,
265,
1053,
679,
29918,
18121,
29892,
20861,
858,
650,
3629,
23074,
13,
13,
29937,
3617,
278,
4480,
931,
515,
278,
937,
2471,
2980,
470,
2322,
372,
304,
29871,
29896,
29900,
6923,
13,
12982,
1806,
29918,
15307,
353,
938,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
565,
7431,
29898,
9675,
29889,
19218,
15410,
29896,
1683,
29871,
29896,
29900,
13,
13,
2541,
20861,
858,
650,
3629,
23074,
29898,
657,
29918,
18121,
2141,
657,
29918,
21412,
3285,
525,
991,
597,
1636,
29889,
2204,
20930,
29889,
510,
22208,
1125,
13,
1678,
8709,
29898,
12982,
1806,
29918,
15307,
29897,
13,
2
] |
pytorchrl/agent/env/env_wrappers.py | PyTorchRL/pytorchrl | 20 | 53119 | import gym
from gym.spaces.box import Box
class TransposeImagesIfRequired(gym.ObservationWrapper):
"""
When environment observations are images, this wrapper transposes
the axis. It is useful when the images have shape (W,H,C), as they can be
transposed "on the fly" to (C,W,H) for PyTorch convolutions to be applied.
Parameters
----------
env : gym.Env
Original Gym environment, previous to applying the wrapper.
op : list
New axis ordering.
"""
def __init__(self, env=None, op=[2, 0, 1]):
"""Transpose observation space for images"""
super(TransposeImagesIfRequired, self).__init__(env)
self.op = op
if isinstance(self.observation_space, gym.spaces.Box) and \
len(self.observation_space.shape) == 3:
obs_shape = self.observation_space.shape
self.observation_space = Box(
self.observation_space.low[0, 0, 0],
self.observation_space.high[0, 0, 0],
[obs_shape[self.op[0]], obs_shape[self.op[1]], obs_shape[self.op[2]]],
dtype=self.observation_space.dtype)
elif isinstance(self.observation_space, gym.spaces.Dict):
for k in self.observation_space.spaces:
if isinstance(self.observation_space[k], gym.spaces.Box) and \
len(self.observation_space[k].shape) == 3:
obs_shape = self.observation_space[k].shape
self.observation_space[k] = Box(
self.observation_space[k].low[0, 0, 0],
self.observation_space[k].high[0, 0, 0],
[obs_shape[self.op[0]], obs_shape[self.op[1]], obs_shape[self.op[2]]],
dtype=self.observation_space.dtype)
def observation(self, ob):
"""Transpose observation"""
if isinstance(ob, dict):
for k in ob:
if len(ob[k].shape) == 3:
ob[k] = ob[k].transpose(self.op[0], self.op[1], self.op[2])
else:
if len(ob.shape) == 3:
ob = ob.transpose(self.op[0], self.op[1], self.op[2])
return ob | [
1,
1053,
330,
962,
13,
3166,
330,
962,
29889,
22854,
29889,
1884,
1053,
11773,
13,
13,
13,
1990,
4103,
4220,
20163,
3644,
19347,
29898,
29887,
962,
29889,
6039,
2140,
362,
15646,
1125,
13,
1678,
9995,
13,
1678,
1932,
5177,
13917,
526,
4558,
29892,
445,
14476,
1301,
10590,
13,
1678,
278,
9685,
29889,
739,
338,
5407,
746,
278,
4558,
505,
8267,
313,
29956,
29892,
29950,
29892,
29907,
511,
408,
896,
508,
367,
13,
1678,
1301,
4752,
376,
265,
278,
11340,
29908,
304,
313,
29907,
29892,
29956,
29892,
29950,
29897,
363,
10772,
29911,
25350,
26851,
29879,
304,
367,
7436,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
8829,
584,
330,
962,
29889,
21745,
13,
4706,
8533,
402,
962,
5177,
29892,
3517,
304,
15399,
278,
14476,
29889,
13,
1678,
1015,
584,
1051,
13,
4706,
1570,
9685,
20520,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8829,
29922,
8516,
29892,
1015,
11759,
29906,
29892,
29871,
29900,
29892,
29871,
29896,
29962,
1125,
13,
4706,
9995,
4300,
4220,
15500,
2913,
363,
4558,
15945,
29908,
13,
4706,
2428,
29898,
4300,
4220,
20163,
3644,
19347,
29892,
1583,
467,
1649,
2344,
12035,
6272,
29897,
13,
13,
4706,
1583,
29889,
459,
353,
1015,
13,
13,
4706,
565,
338,
8758,
29898,
1311,
29889,
26739,
362,
29918,
3493,
29892,
330,
962,
29889,
22854,
29889,
3313,
29897,
322,
320,
13,
18884,
7431,
29898,
1311,
29889,
26739,
362,
29918,
3493,
29889,
12181,
29897,
1275,
29871,
29941,
29901,
13,
9651,
20881,
29918,
12181,
353,
1583,
29889,
26739,
362,
29918,
3493,
29889,
12181,
13,
9651,
1583,
29889,
26739,
362,
29918,
3493,
353,
11773,
29898,
13,
18884,
1583,
29889,
26739,
362,
29918,
3493,
29889,
677,
29961,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
18884,
1583,
29889,
26739,
362,
29918,
3493,
29889,
9812,
29961,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
18884,
518,
26290,
29918,
12181,
29961,
1311,
29889,
459,
29961,
29900,
20526,
20881,
29918,
12181,
29961,
1311,
29889,
459,
29961,
29896,
20526,
20881,
29918,
12181,
29961,
1311,
29889,
459,
29961,
29906,
5262,
1402,
13,
18884,
26688,
29922,
1311,
29889,
26739,
362,
29918,
3493,
29889,
29881,
1853,
29897,
13,
13,
4706,
25342,
338,
8758,
29898,
1311,
29889,
26739,
362,
29918,
3493,
29892,
330,
962,
29889,
22854,
29889,
21533,
1125,
13,
9651,
363,
413,
297,
1583,
29889,
26739,
362,
29918,
3493,
29889,
22854,
29901,
13,
18884,
565,
338,
8758,
29898,
1311,
29889,
26739,
362,
29918,
3493,
29961,
29895,
1402,
330,
962,
29889,
22854,
29889,
3313,
29897,
322,
320,
13,
462,
4706,
7431,
29898,
1311,
29889,
26739,
362,
29918,
3493,
29961,
29895,
1822,
12181,
29897,
1275,
29871,
29941,
29901,
13,
462,
1678,
20881,
29918,
12181,
353,
1583,
29889,
26739,
362,
29918,
3493,
29961,
29895,
1822,
12181,
13,
462,
1678,
1583,
29889,
26739,
362,
29918,
3493,
29961,
29895,
29962,
353,
11773,
29898,
13,
462,
4706,
1583,
29889,
26739,
362,
29918,
3493,
29961,
29895,
1822,
677,
29961,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
4706,
1583,
29889,
26739,
362,
29918,
3493,
29961,
29895,
1822,
9812,
29961,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
1402,
13,
462,
4706,
518,
26290,
29918,
12181,
29961,
1311,
29889,
459,
29961,
29900,
20526,
20881,
29918,
12181,
29961,
1311,
29889,
459,
29961,
29896,
20526,
20881,
29918,
12181,
29961,
1311,
29889,
459,
29961,
29906,
5262,
1402,
13,
462,
4706,
26688,
29922,
1311,
29889,
26739,
362,
29918,
3493,
29889,
29881,
1853,
29897,
13,
13,
1678,
822,
15500,
29898,
1311,
29892,
704,
1125,
13,
4706,
9995,
4300,
4220,
15500,
15945,
29908,
13,
13,
4706,
565,
338,
8758,
29898,
711,
29892,
9657,
1125,
13,
9651,
363,
413,
297,
704,
29901,
13,
18884,
565,
7431,
29898,
711,
29961,
29895,
1822,
12181,
29897,
1275,
29871,
29941,
29901,
13,
462,
1678,
704,
29961,
29895,
29962,
353,
704,
29961,
29895,
1822,
3286,
4220,
29898,
1311,
29889,
459,
29961,
29900,
1402,
1583,
29889,
459,
29961,
29896,
1402,
1583,
29889,
459,
29961,
29906,
2314,
13,
4706,
1683,
29901,
13,
9651,
565,
7431,
29898,
711,
29889,
12181,
29897,
1275,
29871,
29941,
29901,
13,
18884,
704,
353,
704,
29889,
3286,
4220,
29898,
1311,
29889,
459,
29961,
29900,
1402,
1583,
29889,
459,
29961,
29896,
1402,
1583,
29889,
459,
29961,
29906,
2314,
13,
13,
4706,
736,
704,
2
] |
Ex25.py | CarlosDouradoPGR/PythonBR-EstruturasDecs | 0 | 21429 | print('Interrogando um suspeito: ')
pg1 = str(input("Telefonou para a vítma?(S/N)\n").upper().strip())
pg2 = str(input('Esteve no local do crime?(S/N)\n').upper().strip())
pg3 = str(input('Mora perto da vítma?(S/N)\n').upper().strip())
pg4 = str(input('Devia para a vítma?(S/N)\n').upper().strip())
pg5 = str(input('Já trabalhou com a vítma?(S/N\n').upper().strip())
lst = [pg1, pg2, pg3, pg4, pg5].count('S')
if 3 > lst >= 2 :
print('Suspeita')
elif lst == 3 or lst == 4:
print('Cúmplice')
elif lst == 5:
print('Assassino')
else:
print('Inocente')
| [
1,
1596,
877,
4074,
9102,
1743,
1922,
2858,
412,
2049,
29901,
25710,
13,
4061,
29896,
353,
851,
29898,
2080,
703,
29911,
6146,
18753,
283,
1702,
263,
325,
2468,
655,
26889,
29903,
29914,
29940,
2144,
29876,
2564,
21064,
2141,
17010,
3101,
13,
4061,
29906,
353,
851,
29898,
2080,
877,
29923,
1655,
345,
694,
1887,
437,
17268,
26889,
29903,
29914,
29940,
2144,
29876,
2824,
21064,
2141,
17010,
3101,
13,
4061,
29941,
353,
851,
29898,
2080,
877,
29924,
2207,
639,
517,
1146,
325,
2468,
655,
26889,
29903,
29914,
29940,
2144,
29876,
2824,
21064,
2141,
17010,
3101,
13,
4061,
29946,
353,
851,
29898,
2080,
877,
2772,
6071,
1702,
263,
325,
2468,
655,
26889,
29903,
29914,
29940,
2144,
29876,
2824,
21064,
2141,
17010,
3101,
13,
4061,
29945,
353,
851,
29898,
2080,
877,
29967,
29976,
19739,
10774,
419,
263,
325,
2468,
655,
26889,
29903,
29914,
29940,
29905,
29876,
2824,
21064,
2141,
17010,
3101,
13,
20155,
353,
518,
4061,
29896,
29892,
23822,
29906,
29892,
23822,
29941,
29892,
23822,
29946,
29892,
23822,
29945,
1822,
2798,
877,
29903,
1495,
13,
13,
361,
29871,
29941,
1405,
24471,
6736,
29871,
29906,
584,
13,
1678,
1596,
877,
29903,
375,
412,
2028,
1495,
13,
23681,
24471,
1275,
29871,
29941,
470,
24471,
1275,
29871,
29946,
29901,
13,
1678,
1596,
877,
29907,
30030,
1526,
5897,
1495,
13,
23681,
24471,
1275,
29871,
29945,
29901,
13,
1678,
1596,
877,
7900,
465,
1789,
1495,
13,
2870,
29901,
13,
1678,
1596,
877,
797,
542,
2016,
1495,
13,
13,
2
] |
examples/python/00-list-devices.py | vishal-prgmr/tiscamera | 0 | 13564 | #!/usr/bin/env python3
# Copyright 2017 The Imaging Source Europe GmbH
#
# 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.
#
# This example will show you how to list information about the available devices
#
import sys
import gi
gi.require_version("Tcam", "0.1")
gi.require_version("Gst", "1.0")
from gi.repository import Tcam, Gst
def list_devices():
"""
Print information about all available devices
"""
source = Gst.ElementFactory.make("tcambin")
serials = source.get_device_serials()
for single_serial in serials:
# This returns someting like:
# (True,
# name='DFK Z12GP031',
# identifier='The Imaging Source Europe GmbH-11410533',
# connection_type='aravis')
# The identifier is the name given by the backend
# The connection_type identifies the backend that is used.
# Currently 'aravis', 'v4l2', 'libusb' and 'unknown' exist
(return_value, model,
identifier, connection_type) = source.get_device_info(single_serial)
# return value would be False when a non-existant serial is used
# since we are iterating get_device_serials this should not happen
if return_value:
print("Model: {} Serial: {} Type: {}".format(model,
single_serial,
connection_type))
if __name__ == "__main__":
Gst.init(sys.argv) # init gstreamer
list_devices()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29955,
450,
1954,
6751,
7562,
4092,
18156,
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,
13,
29937,
13,
29937,
910,
1342,
674,
1510,
366,
920,
304,
1051,
2472,
1048,
278,
3625,
9224,
13,
29937,
13,
13,
5215,
10876,
13,
5215,
4005,
13,
13,
3146,
29889,
12277,
29918,
3259,
703,
29911,
11108,
613,
376,
29900,
29889,
29896,
1159,
13,
3146,
29889,
12277,
29918,
3259,
703,
29954,
303,
613,
376,
29896,
29889,
29900,
1159,
13,
13,
3166,
4005,
29889,
19033,
1053,
323,
11108,
29892,
402,
303,
13,
13,
13,
1753,
1051,
29918,
3359,
1575,
7295,
13,
1678,
9995,
13,
1678,
13905,
2472,
1048,
599,
29871,
3625,
9224,
13,
1678,
9995,
13,
1678,
2752,
353,
402,
303,
29889,
2642,
5126,
29889,
5675,
703,
14246,
1117,
262,
1159,
13,
13,
1678,
7797,
29879,
353,
2752,
29889,
657,
29918,
10141,
29918,
15550,
29879,
580,
13,
13,
1678,
363,
2323,
29918,
15550,
297,
7797,
29879,
29901,
13,
13,
4706,
396,
910,
3639,
5895,
292,
763,
29901,
13,
4706,
396,
313,
5574,
29892,
13,
4706,
396,
29871,
1024,
2433,
4037,
29968,
796,
29896,
29906,
19903,
29900,
29941,
29896,
742,
13,
4706,
396,
29871,
15882,
2433,
1576,
1954,
6751,
7562,
4092,
18156,
29899,
29896,
29896,
29946,
29896,
29900,
29945,
29941,
29941,
742,
13,
4706,
396,
29871,
3957,
29918,
1853,
2433,
279,
485,
275,
1495,
13,
4706,
396,
450,
15882,
338,
278,
1024,
2183,
491,
278,
14998,
13,
4706,
396,
450,
3957,
29918,
1853,
2893,
11057,
278,
14998,
393,
338,
1304,
29889,
13,
4706,
396,
268,
15447,
525,
279,
485,
275,
742,
525,
29894,
29946,
29880,
29906,
742,
525,
1982,
28685,
29915,
322,
525,
26690,
29915,
1863,
13,
4706,
313,
2457,
29918,
1767,
29892,
1904,
29892,
13,
308,
15882,
29892,
3957,
29918,
1853,
29897,
353,
2752,
29889,
657,
29918,
10141,
29918,
3888,
29898,
14369,
29918,
15550,
29897,
13,
13,
4706,
396,
736,
995,
723,
367,
7700,
746,
263,
1661,
29899,
735,
22137,
7797,
338,
1304,
13,
4706,
396,
1951,
591,
526,
4256,
1218,
679,
29918,
10141,
29918,
15550,
29879,
445,
881,
451,
3799,
13,
4706,
565,
736,
29918,
1767,
29901,
13,
13,
9651,
1596,
703,
3195,
29901,
6571,
18896,
29901,
6571,
5167,
29901,
6571,
1642,
4830,
29898,
4299,
29892,
13,
462,
462,
462,
308,
2323,
29918,
15550,
29892,
13,
462,
462,
462,
308,
3957,
29918,
1853,
876,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
13,
1678,
402,
303,
29889,
2344,
29898,
9675,
29889,
19218,
29897,
29871,
396,
2069,
330,
5461,
261,
13,
1678,
1051,
29918,
3359,
1575,
580,
13,
2
] |
edg/SchematicStubGenerator.py | tengisd/PolymorphicBlocks | 0 | 1601803 | <gh_stars>0
from typing import List, Tuple, Dict, Set
from edg_core import TransformUtil
from electronics_model import Netlist
import zlib # for a deterministic hash
import os
def _schematic_instantiation(name: str, type_name: str) -> str:
return f"""
$Sheet
S 0 0 0 0
U {name}
F0 "{name}" 0
F1 "{type_name}.sch" 0
$EndSheet
"""
def _schematic_contents(children: List[Tuple[str, str]]) -> str: # name -> type
child_strs = '\n\n'.join([_schematic_instantiation(name, type_name) for name, type_name in children])
return f"""
EESchema Schematic File Version 2
EELAYER 25 0
EELAYER END
{child_strs}
$EndSCHEMATC
"""
def write_schematic_stubs(netlist: Netlist, target_dir: str, top_target_name: str):
block_contents: Dict[TransformUtil.Path, List[TransformUtil.Path]] = {} # block name -> list of internal blocks
for path, block_type in netlist.types.items():
if path.blocks:
parent_blocks = path.blocks[:-1]
parent_path = TransformUtil.Path(parent_blocks, (), (), ())
block_contents.setdefault(parent_path, []).append(path)
block_contents = {path: sorted(contents) for path, contents in block_contents.items()}
block_types: Dict[TransformUtil.Path, Tuple[str, int]] = {} # block name -> block type, hash of children
def get_block_type(path: TransformUtil.Path) -> Tuple[str, int]:
if path in block_types:
return block_types[path]
if path not in block_contents:
return "", 0 # leaf block
content_types = [(subblock.blocks[-1], get_block_type(subblock)) for subblock in block_contents[path]
if not subblock.blocks[-1].startswith('(bridge)') and
not subblock.blocks[-1].startswith('(adapter)')]
content_str = str.encode(str(content_types))
block_types[path] = netlist.types[path], zlib.adler32(content_str) # TODO maybe use pickle
return block_types[path]
seen_types: Set[Tuple[str, int]] = set()
def to_type_str(type_name: str, hash: int) -> str:
return (type_name + ('_%08X' % hash)).replace('.', '_')
for path, contents in block_contents.items():
block_type_tup = get_block_type(path)
if block_type_tup in seen_types:
continue
seen_types.add(block_type_tup)
if not path.blocks:
sch_name = top_target_name
else:
sch_name = to_type_str(*block_type_tup)
children = [(subblock_path.blocks[-1], to_type_str(*get_block_type(subblock_path))) for subblock_path in contents
if subblock_path in block_types]
with open(os.path.join(target_dir, f'{sch_name}.sch'), 'w') as sch_file:
sch_file.write(_schematic_contents(children))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
19229,
1053,
2391,
29892,
12603,
552,
29892,
360,
919,
29892,
3789,
13,
3166,
1226,
29887,
29918,
3221,
1053,
4103,
689,
7270,
13,
3166,
11966,
1199,
29918,
4299,
1053,
12670,
1761,
13,
5215,
503,
1982,
29871,
396,
363,
263,
11806,
4695,
6608,
13,
5215,
2897,
13,
13,
13,
1753,
903,
816,
19217,
29918,
2611,
3656,
362,
29898,
978,
29901,
851,
29892,
1134,
29918,
978,
29901,
851,
29897,
1599,
851,
29901,
13,
29871,
736,
285,
15945,
29908,
13,
29938,
10654,
13,
29903,
29871,
29900,
29871,
29900,
29871,
29900,
29871,
29900,
29871,
13,
29965,
426,
978,
29913,
13,
29943,
29900,
29850,
978,
5038,
29871,
29900,
13,
29943,
29896,
29850,
1853,
29918,
978,
1836,
816,
29908,
29871,
29900,
13,
29938,
5044,
10654,
13,
15945,
29908,
13,
13,
13,
1753,
903,
816,
19217,
29918,
10853,
29898,
11991,
29901,
2391,
29961,
23215,
552,
29961,
710,
29892,
851,
24960,
1599,
851,
29901,
29871,
396,
1024,
1599,
1134,
13,
29871,
2278,
29918,
710,
29879,
353,
11297,
29876,
29905,
29876,
4286,
7122,
4197,
29918,
816,
19217,
29918,
2611,
3656,
362,
29898,
978,
29892,
1134,
29918,
978,
29897,
363,
1024,
29892,
1134,
29918,
978,
297,
4344,
2314,
13,
13,
29871,
736,
285,
15945,
29908,
13,
29923,
2890,
305,
2603,
1102,
19217,
3497,
10079,
29871,
29906,
13,
17896,
18799,
1001,
29871,
29906,
29945,
29871,
29900,
13,
17896,
18799,
1001,
11056,
13,
13,
29912,
5145,
29918,
710,
29879,
29913,
13,
13,
29938,
5044,
29903,
3210,
12665,
1299,
29907,
13,
15945,
29908,
13,
13,
1753,
2436,
29918,
816,
19217,
29918,
303,
23954,
29898,
1212,
1761,
29901,
12670,
1761,
29892,
3646,
29918,
3972,
29901,
851,
29892,
2246,
29918,
5182,
29918,
978,
29901,
851,
1125,
13,
29871,
2908,
29918,
10853,
29901,
360,
919,
29961,
13372,
7270,
29889,
2605,
29892,
2391,
29961,
13372,
7270,
29889,
2605,
5262,
353,
6571,
29871,
396,
2908,
1024,
1599,
1051,
310,
7463,
10930,
13,
29871,
363,
2224,
29892,
2908,
29918,
1853,
297,
7787,
1761,
29889,
8768,
29889,
7076,
7295,
13,
1678,
565,
2224,
29889,
1271,
29879,
29901,
13,
418,
3847,
29918,
1271,
29879,
353,
2224,
29889,
1271,
29879,
7503,
29899,
29896,
29962,
13,
418,
3847,
29918,
2084,
353,
4103,
689,
7270,
29889,
2605,
29898,
3560,
29918,
1271,
29879,
29892,
313,
511,
313,
511,
313,
876,
13,
418,
2908,
29918,
10853,
29889,
842,
4381,
29898,
3560,
29918,
2084,
29892,
5159,
467,
4397,
29898,
2084,
29897,
13,
29871,
2908,
29918,
10853,
353,
426,
2084,
29901,
12705,
29898,
10853,
29897,
363,
2224,
29892,
8118,
297,
2908,
29918,
10853,
29889,
7076,
28296,
13,
13,
29871,
2908,
29918,
8768,
29901,
360,
919,
29961,
13372,
7270,
29889,
2605,
29892,
12603,
552,
29961,
710,
29892,
938,
5262,
353,
6571,
29871,
396,
2908,
1024,
1599,
2908,
1134,
29892,
6608,
310,
4344,
13,
29871,
822,
679,
29918,
1271,
29918,
1853,
29898,
2084,
29901,
4103,
689,
7270,
29889,
2605,
29897,
1599,
12603,
552,
29961,
710,
29892,
938,
5387,
13,
1678,
565,
2224,
297,
2908,
29918,
8768,
29901,
13,
418,
736,
2908,
29918,
8768,
29961,
2084,
29962,
13,
1678,
565,
2224,
451,
297,
2908,
29918,
10853,
29901,
13,
418,
736,
12633,
29871,
29900,
29871,
396,
20447,
2908,
13,
1678,
2793,
29918,
8768,
353,
17288,
1491,
1271,
29889,
1271,
29879,
14352,
29896,
1402,
679,
29918,
1271,
29918,
1853,
29898,
1491,
1271,
876,
363,
1014,
1271,
297,
2908,
29918,
10853,
29961,
2084,
29962,
13,
462,
268,
565,
451,
1014,
1271,
29889,
1271,
29879,
14352,
29896,
1822,
27382,
2541,
877,
29898,
18419,
29897,
1495,
322,
13,
462,
268,
451,
1014,
1271,
29889,
1271,
29879,
14352,
29896,
1822,
27382,
2541,
877,
29898,
21412,
29897,
1495,
29962,
13,
1678,
2793,
29918,
710,
353,
851,
29889,
12508,
29898,
710,
29898,
3051,
29918,
8768,
876,
13,
1678,
2908,
29918,
8768,
29961,
2084,
29962,
353,
7787,
1761,
29889,
8768,
29961,
2084,
1402,
503,
1982,
29889,
328,
1358,
29941,
29906,
29898,
3051,
29918,
710,
29897,
29871,
396,
14402,
5505,
671,
5839,
280,
13,
1678,
736,
2908,
29918,
8768,
29961,
2084,
29962,
13,
13,
29871,
3595,
29918,
8768,
29901,
3789,
29961,
23215,
552,
29961,
710,
29892,
938,
5262,
353,
731,
580,
13,
29871,
822,
304,
29918,
1853,
29918,
710,
29898,
1853,
29918,
978,
29901,
851,
29892,
6608,
29901,
938,
29897,
1599,
851,
29901,
13,
1678,
736,
313,
1853,
29918,
978,
718,
6702,
29918,
29995,
29900,
29947,
29990,
29915,
1273,
6608,
8106,
6506,
12839,
742,
22868,
1495,
13,
13,
29871,
363,
2224,
29892,
8118,
297,
2908,
29918,
10853,
29889,
7076,
7295,
13,
1678,
2908,
29918,
1853,
29918,
29873,
786,
353,
679,
29918,
1271,
29918,
1853,
29898,
2084,
29897,
13,
1678,
565,
2908,
29918,
1853,
29918,
29873,
786,
297,
3595,
29918,
8768,
29901,
13,
418,
6773,
13,
1678,
3595,
29918,
8768,
29889,
1202,
29898,
1271,
29918,
1853,
29918,
29873,
786,
29897,
13,
13,
1678,
565,
451,
2224,
29889,
1271,
29879,
29901,
13,
418,
1364,
29918,
978,
353,
2246,
29918,
5182,
29918,
978,
13,
1678,
1683,
29901,
13,
418,
1364,
29918,
978,
353,
304,
29918,
1853,
29918,
710,
10456,
1271,
29918,
1853,
29918,
29873,
786,
29897,
13,
13,
1678,
4344,
353,
17288,
1491,
1271,
29918,
2084,
29889,
1271,
29879,
14352,
29896,
1402,
304,
29918,
1853,
29918,
710,
10456,
657,
29918,
1271,
29918,
1853,
29898,
1491,
1271,
29918,
2084,
4961,
363,
1014,
1271,
29918,
2084,
297,
8118,
13,
18884,
565,
1014,
1271,
29918,
2084,
297,
2908,
29918,
8768,
29962,
13,
13,
1678,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
5182,
29918,
3972,
29892,
285,
29915,
29912,
816,
29918,
978,
1836,
816,
5477,
525,
29893,
1495,
408,
1364,
29918,
1445,
29901,
13,
418,
1364,
29918,
1445,
29889,
3539,
7373,
816,
19217,
29918,
10853,
29898,
11991,
876,
13,
2
] |
setup.py | practicalci/nuitka-setuptools | 0 | 116487 | import os
import sys
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme:
long_description = readme.read()
install_requires = ['nuitka>=0.6<0.7', ]
PY2 = sys.version_info[0] == 2
if PY2:
install_requires.append('pathlib2')
setup(
name='nuitka_setuptools2',
version='3.0.0',
py_modules=['nuitka_setuptools'],
description='Extension to setuptools to run your package through nuitka to '
'produce compiled, faster, obfuscated binary modules.',
long_description=long_description,
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/practicalci/nuitka-setuptools',
include_package_data=True,
install_requires=install_requires,
)
| [
1,
1053,
2897,
13,
5215,
10876,
13,
3166,
731,
21245,
8789,
1053,
6230,
13,
13,
2541,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
525,
16310,
2303,
29889,
29878,
303,
8785,
408,
1303,
1004,
29901,
13,
1678,
1472,
29918,
8216,
353,
1303,
1004,
29889,
949,
580,
13,
13,
6252,
29918,
276,
339,
2658,
353,
6024,
29876,
3121,
1335,
18572,
29900,
29889,
29953,
29966,
29900,
29889,
29955,
742,
4514,
13,
13,
20055,
29906,
353,
10876,
29889,
3259,
29918,
3888,
29961,
29900,
29962,
1275,
29871,
29906,
13,
361,
349,
29979,
29906,
29901,
13,
1678,
2601,
29918,
276,
339,
2658,
29889,
4397,
877,
2084,
1982,
29906,
1495,
13,
13,
13,
14669,
29898,
13,
1678,
1024,
2433,
29876,
3121,
1335,
29918,
842,
21245,
8789,
29906,
742,
13,
1678,
1873,
2433,
29941,
29889,
29900,
29889,
29900,
742,
13,
1678,
11451,
29918,
7576,
29922,
1839,
29876,
3121,
1335,
29918,
842,
21245,
8789,
7464,
13,
1678,
6139,
2433,
17657,
304,
731,
21245,
8789,
304,
1065,
596,
3577,
1549,
26245,
1335,
304,
525,
13,
18884,
525,
5498,
346,
13126,
29892,
8473,
29892,
704,
29888,
22142,
630,
7581,
10585,
29889,
742,
13,
1678,
1472,
29918,
8216,
29922,
5426,
29918,
8216,
29892,
13,
1678,
4148,
2433,
29966,
5813,
29958,
742,
13,
1678,
4148,
29918,
5269,
2433,
29966,
26862,
6227,
29958,
742,
13,
1678,
3142,
2433,
991,
597,
3292,
29889,
510,
29914,
29886,
1461,
936,
455,
29914,
29876,
3121,
1335,
29899,
842,
21245,
8789,
742,
13,
1678,
3160,
29918,
5113,
29918,
1272,
29922,
5574,
29892,
13,
1678,
2601,
29918,
276,
339,
2658,
29922,
6252,
29918,
276,
339,
2658,
29892,
13,
29897,
13,
2
] |
holoviews/tests/plotting/bokeh/test_geomplot.py | TheoMathurin/holoviews | 864 | 66576 | from unittest import SkipTest
from holoviews.core import NdOverlay
from holoviews.core.util import pd
from holoviews.element import Segments
from .test_plot import TestBokehPlot, bokeh_renderer
try:
from bokeh.models import FactorRange
except:
pass
class TestSegmentPlot(TestBokehPlot):
def test_segments_color_selection_nonselection(self):
opts = dict(color='green', selection_color='red', nonselection_color='blue')
segments = Segments([(i, i*2, i*3, i*4, i*5, chr(65+i)) for i in range(10)],
vdims=['a', 'b']).opts(**opts)
plot = bokeh_renderer.get_plot(segments)
glyph_renderer = plot.handles['glyph_renderer']
self.assertEqual(glyph_renderer.glyph.line_color, 'green')
self.assertEqual(glyph_renderer.selection_glyph.line_color, 'red')
self.assertEqual(glyph_renderer.nonselection_glyph.line_color, 'blue')
def test_segments_alpha_selection_nonselection(self):
opts = dict(alpha=0.8, selection_alpha=1.0, nonselection_alpha=0.2)
segments = Segments([(i, i*2, i*3, i*4, i*5, chr(65+i)) for i in range(10)],
vdims=['a', 'b']).opts(**opts)
plot = bokeh_renderer.get_plot(segments)
glyph_renderer = plot.handles['glyph_renderer']
self.assertEqual(glyph_renderer.glyph.line_alpha, 0.8)
self.assertEqual(glyph_renderer.selection_glyph.line_alpha, 1)
self.assertEqual(glyph_renderer.nonselection_glyph.line_alpha, 0.2)
def test_segments_overlay_hover(self):
obj = NdOverlay({
i: Segments((range(31), range(31),range(1, 32), range(31)))
for i in range(5)
}, kdims=['Test']).opts({'Segments': {'tools': ['hover']}})
tooltips = [
('Test', '@{Test}'),
('x0', '@{x0}'),
('y0', '@{y0}'),
('x1', '@{x1}'),
('y1', '@{y1}')
]
self._test_hover_info(obj, tooltips)
def test_segments_overlay_datetime_hover(self):
if pd is None:
raise SkipTest("Test requires pandas")
obj = NdOverlay({
i: Segments((
list(pd.date_range('2016-01-01', '2016-01-31')),
range(31),
pd.date_range('2016-01-02', '2016-02-01'),
range(31)
))
for i in range(5)
}, kdims=['Test']).opts({'Segments': {'tools': ['hover']}})
tooltips = [
('Test', '@{Test}'),
('x0', '@{x0}{%F %T}'),
('y0', '@{y0}'),
('x1', '@{x1}{%F %T}'),
('y1', '@{y1}')
]
formatters = {'@{x0}': "datetime", '@{x1}': "datetime"}
self._test_hover_info(obj, tooltips, formatters=formatters)
def test_segments_categorical_xaxis(self):
segments = Segments((['A', 'B', 'C'], [1, 2, 3], ['A', 'B', 'C'], [4, 5, 6]))
plot = bokeh_renderer.get_plot(segments)
x_range = plot.handles['x_range']
self.assertIsInstance(x_range, FactorRange)
self.assertEqual(x_range.factors, ['A', 'B', 'C'])
def test_segments_categorical_yaxis(self):
segments = Segments(([1, 2, 3], ['A', 'B', 'C'], [4, 5, 6], ['A', 'B', 'C']))
plot = bokeh_renderer.get_plot(segments)
y_range = plot.handles['y_range']
self.assertIsInstance(y_range, FactorRange)
self.assertEqual(y_range.factors, ['A', 'B', 'C'])
def test_segments_categorical_yaxis_invert_axes(self):
segments = Segments(([1, 2, 3], ['A', 'B', 'C'], [4, 5, 6], ['A', 'B', 'C']))
plot = bokeh_renderer.get_plot(segments)
y_range = plot.handles['y_range']
self.assertIsInstance(y_range, FactorRange)
self.assertEqual(y_range.factors, ['A', 'B', 'C'])
def test_segments_overlay_categorical_yaxis(self):
segments = Segments(([1, 2, 3], ['A', 'B', 'C'], [4, 5, 6], ['A', 'B', 'C']))
segments2 = Segments(([1, 2, 3], ['B', 'C', 'D'], [4, 5, 6], ['B', 'C', 'D']))
plot = bokeh_renderer.get_plot(segments*segments2)
y_range = plot.handles['y_range']
self.assertIsInstance(y_range, FactorRange)
self.assertEqual(y_range.factors, ['A', 'B', 'C', 'D'])
def test_segments_overlay_categorical_yaxis_invert_axis(self):
segments = Segments(([1, 2, 3], ['A', 'B', 'C'], [4, 5, 6], ['A', 'B', 'C'])).opts(invert_yaxis=True)
segments2 = Segments(([1, 2, 3], ['B', 'C', 'D'], [4, 5, 6], ['B', 'C', 'D']))
plot = bokeh_renderer.get_plot(segments*segments2)
y_range = plot.handles['y_range']
self.assertIsInstance(y_range, FactorRange)
self.assertEqual(y_range.factors, ['A', 'B', 'C', 'D'][::-1])
def test_segments_overlay_categorical_yaxis_invert_axes(self):
segments = Segments(([1, 2, 3], ['A', 'B', 'C'], [4, 5, 6], ['A', 'B', 'C'])).opts(invert_axes=True)
segments2 = Segments(([1, 2, 3], ['B', 'C', 'D'], [4, 5, 6], ['B', 'C', 'D']))
plot = bokeh_renderer.get_plot(segments*segments2)
x_range = plot.handles['x_range']
self.assertIsInstance(x_range, FactorRange)
self.assertEqual(x_range.factors, ['A', 'B', 'C', 'D'])
| [
1,
515,
443,
27958,
1053,
4971,
666,
3057,
13,
13,
3166,
8753,
586,
646,
29879,
29889,
3221,
1053,
405,
29881,
3563,
8387,
13,
3166,
8753,
586,
646,
29879,
29889,
3221,
29889,
4422,
1053,
10518,
13,
3166,
8753,
586,
646,
29879,
29889,
5029,
1053,
6667,
1860,
13,
13,
3166,
869,
1688,
29918,
5317,
1053,
4321,
29933,
6946,
29882,
20867,
29892,
1045,
446,
29882,
29918,
9482,
261,
13,
13,
2202,
29901,
13,
1678,
515,
1045,
446,
29882,
29889,
9794,
1053,
383,
7168,
6069,
13,
19499,
29901,
13,
1678,
1209,
13,
13,
13,
1990,
4321,
17669,
358,
20867,
29898,
3057,
29933,
6946,
29882,
20867,
1125,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
2780,
29918,
21731,
29918,
5464,
21731,
29898,
1311,
1125,
13,
4706,
29111,
353,
9657,
29898,
2780,
2433,
12692,
742,
9262,
29918,
2780,
2433,
1127,
742,
1661,
21731,
29918,
2780,
2433,
9539,
1495,
13,
4706,
24611,
353,
6667,
1860,
4197,
29898,
29875,
29892,
474,
29930,
29906,
29892,
474,
29930,
29941,
29892,
474,
29930,
29946,
29892,
474,
29930,
29945,
29892,
18460,
29898,
29953,
29945,
29974,
29875,
876,
363,
474,
297,
3464,
29898,
29896,
29900,
29897,
1402,
13,
462,
9651,
325,
6229,
29879,
29922,
1839,
29874,
742,
525,
29890,
2033,
467,
25707,
29898,
1068,
25707,
29897,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29897,
13,
4706,
330,
27026,
29918,
9482,
261,
353,
6492,
29889,
3179,
793,
1839,
16808,
561,
29918,
9482,
261,
2033,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16808,
561,
29918,
9482,
261,
29889,
16808,
561,
29889,
1220,
29918,
2780,
29892,
525,
12692,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16808,
561,
29918,
9482,
261,
29889,
21731,
29918,
16808,
561,
29889,
1220,
29918,
2780,
29892,
525,
1127,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16808,
561,
29918,
9482,
261,
29889,
5464,
21731,
29918,
16808,
561,
29889,
1220,
29918,
2780,
29892,
525,
9539,
1495,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
2312,
29918,
21731,
29918,
5464,
21731,
29898,
1311,
1125,
13,
4706,
29111,
353,
9657,
29898,
2312,
29922,
29900,
29889,
29947,
29892,
9262,
29918,
2312,
29922,
29896,
29889,
29900,
29892,
1661,
21731,
29918,
2312,
29922,
29900,
29889,
29906,
29897,
13,
4706,
24611,
353,
6667,
1860,
4197,
29898,
29875,
29892,
474,
29930,
29906,
29892,
474,
29930,
29941,
29892,
474,
29930,
29946,
29892,
474,
29930,
29945,
29892,
18460,
29898,
29953,
29945,
29974,
29875,
876,
363,
474,
297,
3464,
29898,
29896,
29900,
29897,
1402,
13,
462,
9651,
325,
6229,
29879,
29922,
1839,
29874,
742,
525,
29890,
2033,
467,
25707,
29898,
1068,
25707,
29897,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29897,
13,
4706,
330,
27026,
29918,
9482,
261,
353,
6492,
29889,
3179,
793,
1839,
16808,
561,
29918,
9482,
261,
2033,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16808,
561,
29918,
9482,
261,
29889,
16808,
561,
29889,
1220,
29918,
2312,
29892,
29871,
29900,
29889,
29947,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16808,
561,
29918,
9482,
261,
29889,
21731,
29918,
16808,
561,
29889,
1220,
29918,
2312,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16808,
561,
29918,
9482,
261,
29889,
5464,
21731,
29918,
16808,
561,
29889,
1220,
29918,
2312,
29892,
29871,
29900,
29889,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
957,
8387,
29918,
13194,
29898,
1311,
1125,
13,
4706,
5446,
353,
405,
29881,
3563,
8387,
3319,
13,
9651,
474,
29901,
6667,
1860,
3552,
3881,
29898,
29941,
29896,
511,
3464,
29898,
29941,
29896,
511,
3881,
29898,
29896,
29892,
29871,
29941,
29906,
511,
3464,
29898,
29941,
29896,
4961,
13,
9651,
363,
474,
297,
3464,
29898,
29945,
29897,
13,
4706,
2981,
413,
6229,
29879,
29922,
1839,
3057,
2033,
467,
25707,
3319,
29915,
17669,
1860,
2396,
11117,
8504,
2396,
6024,
13194,
2033,
24289,
13,
4706,
5780,
2034,
567,
353,
518,
13,
9651,
6702,
3057,
742,
18803,
29912,
3057,
29913,
5477,
13,
9651,
6702,
29916,
29900,
742,
18803,
29912,
29916,
29900,
29913,
5477,
13,
9651,
6702,
29891,
29900,
742,
18803,
29912,
29891,
29900,
29913,
5477,
13,
9651,
6702,
29916,
29896,
742,
18803,
29912,
29916,
29896,
29913,
5477,
13,
9651,
6702,
29891,
29896,
742,
18803,
29912,
29891,
29896,
29913,
1495,
13,
4706,
4514,
13,
4706,
1583,
3032,
1688,
29918,
13194,
29918,
3888,
29898,
5415,
29892,
5780,
2034,
567,
29897,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
957,
8387,
29918,
12673,
29918,
13194,
29898,
1311,
1125,
13,
4706,
565,
10518,
338,
6213,
29901,
13,
9651,
12020,
4971,
666,
3057,
703,
3057,
6858,
11701,
1159,
13,
4706,
5446,
353,
405,
29881,
3563,
8387,
3319,
13,
9651,
474,
29901,
6667,
1860,
3552,
13,
18884,
1051,
29898,
15926,
29889,
1256,
29918,
3881,
877,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29900,
29896,
742,
525,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29941,
29896,
1495,
511,
13,
18884,
3464,
29898,
29941,
29896,
511,
13,
18884,
10518,
29889,
1256,
29918,
3881,
877,
29906,
29900,
29896,
29953,
29899,
29900,
29896,
29899,
29900,
29906,
742,
525,
29906,
29900,
29896,
29953,
29899,
29900,
29906,
29899,
29900,
29896,
5477,
13,
18884,
3464,
29898,
29941,
29896,
29897,
13,
632,
876,
13,
9651,
363,
474,
297,
3464,
29898,
29945,
29897,
13,
4706,
2981,
413,
6229,
29879,
29922,
1839,
3057,
2033,
467,
25707,
3319,
29915,
17669,
1860,
2396,
11117,
8504,
2396,
6024,
13194,
2033,
24289,
13,
4706,
5780,
2034,
567,
353,
518,
13,
9651,
6702,
3057,
742,
18803,
29912,
3057,
29913,
5477,
13,
9651,
6702,
29916,
29900,
742,
18803,
29912,
29916,
29900,
1157,
29995,
29943,
1273,
29911,
29913,
5477,
13,
9651,
6702,
29891,
29900,
742,
18803,
29912,
29891,
29900,
29913,
5477,
13,
9651,
6702,
29916,
29896,
742,
18803,
29912,
29916,
29896,
1157,
29995,
29943,
1273,
29911,
29913,
5477,
13,
9651,
6702,
29891,
29896,
742,
18803,
29912,
29891,
29896,
29913,
1495,
13,
4706,
4514,
13,
4706,
3402,
2153,
353,
11117,
28312,
29916,
29900,
29913,
2396,
376,
12673,
613,
18803,
29912,
29916,
29896,
29913,
2396,
376,
12673,
9092,
13,
4706,
1583,
3032,
1688,
29918,
13194,
29918,
3888,
29898,
5415,
29892,
5780,
2034,
567,
29892,
3402,
2153,
29922,
4830,
2153,
29897,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
29883,
20440,
936,
29918,
29916,
8990,
29898,
1311,
1125,
13,
4706,
24611,
353,
6667,
1860,
3552,
1839,
29909,
742,
525,
29933,
742,
525,
29907,
7464,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
12622,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29897,
13,
4706,
921,
29918,
3881,
353,
6492,
29889,
3179,
793,
1839,
29916,
29918,
3881,
2033,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29916,
29918,
3881,
29892,
383,
7168,
6069,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29916,
29918,
3881,
29889,
17028,
943,
29892,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
11287,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
29883,
20440,
936,
29918,
29891,
8990,
29898,
1311,
1125,
13,
4706,
24611,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
25901,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29897,
13,
4706,
343,
29918,
3881,
353,
6492,
29889,
3179,
793,
1839,
29891,
29918,
3881,
2033,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29891,
29918,
3881,
29892,
383,
7168,
6069,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29891,
29918,
3881,
29889,
17028,
943,
29892,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
11287,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
29883,
20440,
936,
29918,
29891,
8990,
29918,
262,
1765,
29918,
1165,
267,
29898,
1311,
1125,
13,
4706,
24611,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
25901,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29897,
13,
4706,
343,
29918,
3881,
353,
6492,
29889,
3179,
793,
1839,
29891,
29918,
3881,
2033,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29891,
29918,
3881,
29892,
383,
7168,
6069,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29891,
29918,
3881,
29889,
17028,
943,
29892,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
11287,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
957,
8387,
29918,
29883,
20440,
936,
29918,
29891,
8990,
29898,
1311,
1125,
13,
4706,
24611,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
25901,
13,
4706,
24611,
29906,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29933,
742,
525,
29907,
742,
525,
29928,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29933,
742,
525,
29907,
742,
525,
29928,
25901,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29930,
10199,
1860,
29906,
29897,
13,
4706,
343,
29918,
3881,
353,
6492,
29889,
3179,
793,
1839,
29891,
29918,
3881,
2033,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29891,
29918,
3881,
29892,
383,
7168,
6069,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29891,
29918,
3881,
29889,
17028,
943,
29892,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
742,
525,
29928,
11287,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
957,
8387,
29918,
29883,
20440,
936,
29918,
29891,
8990,
29918,
262,
1765,
29918,
8990,
29898,
1311,
1125,
13,
4706,
24611,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
2033,
8106,
25707,
29898,
262,
1765,
29918,
29891,
8990,
29922,
5574,
29897,
13,
4706,
24611,
29906,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29933,
742,
525,
29907,
742,
525,
29928,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29933,
742,
525,
29907,
742,
525,
29928,
25901,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29930,
10199,
1860,
29906,
29897,
13,
4706,
343,
29918,
3881,
353,
6492,
29889,
3179,
793,
1839,
29891,
29918,
3881,
2033,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29891,
29918,
3881,
29892,
383,
7168,
6069,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29891,
29918,
3881,
29889,
17028,
943,
29892,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
742,
525,
29928,
2033,
29961,
1057,
29899,
29896,
2314,
13,
13,
1678,
822,
1243,
29918,
10199,
1860,
29918,
957,
8387,
29918,
29883,
20440,
936,
29918,
29891,
8990,
29918,
262,
1765,
29918,
1165,
267,
29898,
1311,
1125,
13,
4706,
24611,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
2033,
8106,
25707,
29898,
262,
1765,
29918,
1165,
267,
29922,
5574,
29897,
13,
4706,
24611,
29906,
353,
6667,
1860,
3552,
29961,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
6024,
29933,
742,
525,
29907,
742,
525,
29928,
7464,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
1402,
6024,
29933,
742,
525,
29907,
742,
525,
29928,
25901,
13,
4706,
6492,
353,
1045,
446,
29882,
29918,
9482,
261,
29889,
657,
29918,
5317,
29898,
10199,
1860,
29930,
10199,
1860,
29906,
29897,
13,
4706,
921,
29918,
3881,
353,
6492,
29889,
3179,
793,
1839,
29916,
29918,
3881,
2033,
13,
4706,
1583,
29889,
9294,
3624,
4998,
29898,
29916,
29918,
3881,
29892,
383,
7168,
6069,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29916,
29918,
3881,
29889,
17028,
943,
29892,
6024,
29909,
742,
525,
29933,
742,
525,
29907,
742,
525,
29928,
11287,
13,
2
] |
Ch_0_RandomWalker.py | LeeDaeil/NaturalCode | 0 | 98905 | """
Title : Random Walker 구현
"""
# import Part ----------------------------------------------------------------------------------------------------------
import numpy as np
from random import randint
import sys
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
# ----------------------------------------------------------------------------------------------------------------------
class MainWin(QWidget):
def __init__(self):
super(MainWin, self).__init__(parent=None)
self.setGeometry(100, 100, 500, 500)
self.walk_history = [[int(self.width()/2), int(self.height()/2)]] # (x, y)
timer = QTimer(self)
timer.setInterval(30)
timer.timeout.connect(self.walk)
timer.start()
def paintEvent(self, QPaintEvent):
qp = QPainter(self)
qp.save()
qp.setPen(Qt.NoPen)
qp.setBrush(QBrush(Qt.blue))
for (x, y) in self.walk_history:
qp.drawEllipse(x, y, 5, 5)
qp.restore()
def walk(self):
self.update()
old_x = self.walk_history[-1][0]
old_y = self.walk_history[-1][1]
direct = randint(1, 4)
if direct == 1:
old_x += 1
elif direct == 2:
old_x -= 1
elif direct == 3:
old_y += 1
elif direct == 4:
old_y -= 1
self.walk_history.append([old_x, old_y])
if __name__ == '__main__':
app = QApplication(sys.argv)
w = MainWin()
w.show()
sys.exit(app.exec_())
| [
1,
9995,
13,
7030,
584,
16968,
19512,
29871,
31231,
31680,
13,
13,
15945,
29908,
13,
29937,
1053,
3455,
448,
2683,
2683,
2683,
2683,
2683,
2683,
1378,
29899,
13,
5215,
12655,
408,
7442,
13,
3166,
4036,
1053,
20088,
524,
13,
5215,
10876,
13,
3166,
10772,
17303,
29945,
29889,
17303,
28707,
1053,
334,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
334,
13,
3166,
10772,
17303,
29945,
29889,
17303,
9203,
1053,
334,
13,
29937,
448,
2683,
2683,
2683,
2683,
2683,
2683,
2683,
23648,
13,
13,
13,
1990,
4241,
17734,
29898,
29984,
8801,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
29898,
6330,
17734,
29892,
1583,
467,
1649,
2344,
12035,
3560,
29922,
8516,
29897,
13,
4706,
1583,
29889,
842,
7999,
7843,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29945,
29900,
29900,
29892,
29871,
29945,
29900,
29900,
29897,
13,
13,
4706,
1583,
29889,
20919,
29918,
18434,
353,
5519,
524,
29898,
1311,
29889,
2103,
580,
29914,
29906,
511,
938,
29898,
1311,
29889,
3545,
580,
29914,
29906,
4638,
29962,
29871,
396,
313,
29916,
29892,
343,
29897,
13,
13,
4706,
12237,
353,
660,
14745,
29898,
1311,
29897,
13,
4706,
12237,
29889,
842,
12506,
29898,
29941,
29900,
29897,
13,
4706,
12237,
29889,
15619,
29889,
6915,
29898,
1311,
29889,
20919,
29897,
13,
4706,
12237,
29889,
2962,
580,
13,
13,
1678,
822,
10675,
2624,
29898,
1311,
29892,
660,
28939,
2624,
1125,
13,
4706,
3855,
29886,
353,
660,
29925,
475,
357,
29898,
1311,
29897,
13,
4706,
3855,
29886,
29889,
7620,
580,
13,
13,
4706,
3855,
29886,
29889,
842,
29925,
264,
29898,
17303,
29889,
3782,
29925,
264,
29897,
13,
4706,
3855,
29886,
29889,
842,
27680,
29898,
29984,
27680,
29898,
17303,
29889,
9539,
876,
13,
4706,
363,
313,
29916,
29892,
343,
29897,
297,
1583,
29889,
20919,
29918,
18434,
29901,
13,
9651,
3855,
29886,
29889,
4012,
6489,
5843,
29898,
29916,
29892,
343,
29892,
29871,
29945,
29892,
29871,
29945,
29897,
13,
13,
4706,
3855,
29886,
29889,
5060,
487,
580,
13,
13,
1678,
822,
6686,
29898,
1311,
1125,
13,
4706,
1583,
29889,
5504,
580,
13,
4706,
2030,
29918,
29916,
353,
1583,
29889,
20919,
29918,
18434,
14352,
29896,
3816,
29900,
29962,
13,
4706,
2030,
29918,
29891,
353,
1583,
29889,
20919,
29918,
18434,
14352,
29896,
3816,
29896,
29962,
13,
13,
4706,
1513,
353,
20088,
524,
29898,
29896,
29892,
29871,
29946,
29897,
13,
4706,
565,
1513,
1275,
29871,
29896,
29901,
13,
9651,
2030,
29918,
29916,
4619,
29871,
29896,
13,
4706,
25342,
1513,
1275,
29871,
29906,
29901,
13,
9651,
2030,
29918,
29916,
22361,
29871,
29896,
13,
4706,
25342,
1513,
1275,
29871,
29941,
29901,
13,
9651,
2030,
29918,
29891,
4619,
29871,
29896,
13,
4706,
25342,
1513,
1275,
29871,
29946,
29901,
13,
9651,
2030,
29918,
29891,
22361,
29871,
29896,
13,
13,
4706,
1583,
29889,
20919,
29918,
18434,
29889,
4397,
4197,
1025,
29918,
29916,
29892,
2030,
29918,
29891,
2314,
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,
1678,
281,
353,
4241,
17734,
580,
13,
1678,
281,
29889,
4294,
580,
13,
1678,
10876,
29889,
13322,
29898,
932,
29889,
4258,
29918,
3101,
13,
2
] |
script.py | LionKettyUD/video-subtitle-merger | 0 | 149358 | from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
class Script(object):
START_TEXT = """
Hey {}
I am Telegram Most Powerful Subtitle Muxer Bot
I can Mux Any Srt or Txt File in File or Video
Use Help Command to Know How to Use me
Made With 💕 By @Tellybots_4u
"""
HELP_TEXT = """
Recommended
➠ Use Hardmux If You Have More Time
Recommended
➠ Use Softmux To add Subtitle Fastly in It
Softmux
➠ Send /softmux to add Subtitle Softly in it
HardMux
➠ Send /hardmux to add Subtitle hardly in it
Made With 💕 By @Tellybots_4u
"""
ABOUT_TEXT = """
**🤖 Bot :** Sub-Muxer\n
**👲 Developer :** [Tellybots_4u](https://telegram.me/tellybots_4u)\n
**👥 Channel :** [Tellybots_4u](https://telegram.me/tellybots_4u)\n
**❄️ Credits :** Everyone in this journey\n
**🍴 Source :** [Click here](https://t.me/tellybots_digital)\n
**📝 Language :** [Python3](https://python.org)\n
**📚 Library :** [Pyrogram v1.2.0](https://pyrogram.org)\n
**🌟 Server :** [Heroku](https://heroku.com)\n
"""
START_BUTTONS = InlineKeyboardMarkup(
[[
InlineKeyboardButton('🤖 Update Channel', url='https://telegram.me/tellybots_4u'),
InlineKeyboardButton('💬 Support Group', url='https://telegram.me/tellybots_support')
],[
InlineKeyboardButton('❔ Help', callback_data='help'),
InlineKeyboardButton('⛔ Close', callback_data='close')
]]
)
HELP_BUTTONS = InlineKeyboardMarkup(
[[
InlineKeyboardButton('🏡 Home', callback_data='home'),
InlineKeyboardButton('👲 About', callback_data='about'),
InlineKeyboardButton('⛔ Close', callback_data='close')
]]
)
ABOUT_BUTTONS = InlineKeyboardMarkup(
[[
InlineKeyboardButton('🏡 Home', callback_data='home'),
InlineKeyboardButton('❔ Help', callback_data='help'),
InlineKeyboardButton('⛔ Close', callback_data='close')
]]
)
| [
1,
515,
11451,
307,
1393,
29889,
8768,
1053,
512,
1220,
2558,
3377,
9802,
786,
29892,
512,
1220,
2558,
3377,
3125,
13,
13,
1990,
14415,
29898,
3318,
1125,
13,
13,
13,
13,
1678,
6850,
8322,
29918,
16975,
353,
9995,
13,
29950,
1032,
6571,
29871,
13,
13,
29902,
626,
9699,
1393,
7849,
9206,
1319,
3323,
3257,
341,
1314,
261,
11273,
13,
13,
29902,
508,
341,
1314,
3139,
317,
2273,
470,
323,
486,
3497,
297,
3497,
470,
13987,
13,
13,
11403,
22305,
10516,
304,
19320,
1128,
304,
4803,
592,
13,
13,
29924,
1943,
2973,
29871,
243,
162,
149,
152,
2648,
732,
29911,
14112,
29890,
1862,
29918,
29946,
29884,
13,
15945,
29908,
13,
1678,
379,
6670,
29925,
29918,
16975,
353,
9995,
13,
1123,
2055,
2760,
13,
229,
161,
163,
4803,
10999,
29885,
1314,
960,
887,
6975,
5853,
5974,
13,
13,
1123,
2055,
2760,
13,
229,
161,
163,
4803,
1105,
615,
29885,
1314,
1763,
788,
3323,
3257,
23786,
368,
297,
739,
13,
13,
6295,
615,
29885,
1314,
13,
229,
161,
163,
15076,
847,
2695,
29885,
1314,
304,
788,
3323,
3257,
1105,
615,
368,
297,
372,
13,
13,
29950,
538,
29924,
1314,
13,
229,
161,
163,
15076,
847,
6800,
29885,
1314,
304,
788,
3323,
3257,
15155,
297,
372,
29871,
13,
13,
29924,
1943,
2973,
29871,
243,
162,
149,
152,
2648,
732,
29911,
14112,
29890,
1862,
29918,
29946,
29884,
13,
15945,
29908,
13,
1678,
319,
8456,
2692,
29918,
16975,
353,
9995,
13,
3579,
243,
162,
167,
153,
11273,
584,
1068,
3323,
29899,
29924,
1314,
261,
29905,
29876,
13,
3579,
243,
162,
148,
181,
10682,
261,
584,
1068,
518,
29911,
14112,
29890,
1862,
29918,
29946,
29884,
850,
991,
597,
15494,
1393,
29889,
1004,
29914,
29873,
14112,
29890,
1862,
29918,
29946,
29884,
2144,
29876,
13,
3579,
243,
162,
148,
168,
17368,
584,
1068,
518,
29911,
14112,
29890,
1862,
29918,
29946,
29884,
850,
991,
597,
15494,
1393,
29889,
1004,
29914,
29873,
14112,
29890,
1862,
29918,
29946,
29884,
2144,
29876,
13,
3579,
229,
160,
135,
30598,
24596,
1169,
584,
1068,
7569,
650,
297,
445,
16342,
29905,
29876,
13,
3579,
243,
162,
144,
183,
7562,
584,
1068,
518,
4164,
1244,
850,
991,
597,
29873,
29889,
1004,
29914,
29873,
14112,
29890,
1862,
29918,
7501,
2410,
2144,
29876,
13,
3579,
243,
162,
150,
160,
17088,
584,
1068,
518,
11980,
29941,
850,
991,
597,
4691,
29889,
990,
2144,
29876,
13,
3579,
243,
162,
150,
157,
9538,
584,
1068,
518,
19737,
307,
1393,
325,
29896,
29889,
29906,
29889,
29900,
850,
991,
597,
2272,
307,
1393,
29889,
990,
2144,
29876,
13,
3579,
243,
162,
143,
162,
5656,
584,
1068,
518,
18650,
9154,
850,
991,
597,
2276,
9154,
29889,
510,
2144,
29876,
13,
15945,
29908,
13,
1678,
6850,
8322,
29918,
29933,
2692,
29911,
1164,
29903,
353,
512,
1220,
2558,
3377,
9802,
786,
29898,
13,
4706,
5519,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
243,
162,
167,
153,
10318,
17368,
742,
3142,
2433,
991,
597,
15494,
1393,
29889,
1004,
29914,
29873,
14112,
29890,
1862,
29918,
29946,
29884,
5477,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
243,
162,
149,
175,
18601,
6431,
742,
3142,
2433,
991,
597,
15494,
1393,
29889,
1004,
29914,
29873,
14112,
29890,
1862,
29918,
5924,
1495,
13,
308,
16272,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
229,
160,
151,
22305,
742,
6939,
29918,
1272,
2433,
8477,
5477,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
229,
158,
151,
23186,
742,
6939,
29918,
1272,
2433,
5358,
1495,
13,
4706,
29588,
13,
1678,
1723,
13,
1678,
379,
6670,
29925,
29918,
29933,
2692,
29911,
1164,
29903,
353,
512,
1220,
2558,
3377,
9802,
786,
29898,
13,
4706,
5519,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
243,
162,
146,
164,
8778,
742,
6939,
29918,
1272,
2433,
5184,
5477,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
243,
162,
148,
181,
13611,
742,
6939,
29918,
1272,
2433,
12717,
5477,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
229,
158,
151,
23186,
742,
6939,
29918,
1272,
2433,
5358,
1495,
13,
4706,
29588,
13,
1678,
1723,
13,
1678,
319,
8456,
2692,
29918,
29933,
2692,
29911,
1164,
29903,
353,
512,
1220,
2558,
3377,
9802,
786,
29898,
13,
4706,
5519,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
243,
162,
146,
164,
8778,
742,
6939,
29918,
1272,
2433,
5184,
5477,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
229,
160,
151,
22305,
742,
6939,
29918,
1272,
2433,
8477,
5477,
13,
4706,
512,
1220,
2558,
3377,
3125,
877,
229,
158,
151,
23186,
742,
6939,
29918,
1272,
2433,
5358,
1495,
13,
4706,
29588,
13,
1678,
1723,
13,
2
] |
sts/train.py | LostCow/KLUE | 18 | 9237 | <filename>sts/train.py
import argparse
import numpy as np
import os
import torch
from transformers import AutoTokenizer, AutoConfig, Trainer, TrainingArguments
from model import RobertaForStsRegression
from dataset import KlueStsWithSentenceMaskDataset
from utils import read_json, seed_everything
from metric import compute_metrics
def main(args):
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
config = AutoConfig.from_pretrained(args.model_name_or_path)
config.num_labels = args.num_labels
tokenizer = AutoTokenizer.from_pretrained(args.model_name_or_path)
train_file_path = os.path.join(args.data_dir, args.train_filename)
valid_file_path = os.path.join(args.data_dir, args.valid_filename)
train_json = read_json(train_file_path)
valid_json = read_json(valid_file_path)
train_dataset = KlueStsWithSentenceMaskDataset(train_json, tokenizer, 510)
valid_dataset = KlueStsWithSentenceMaskDataset(train_json, tokenizer, 510)
model = RobertaForStsRegression.from_pretrained(
args.model_name_or_path, config=config
)
model.to(device)
training_args = TrainingArguments(
output_dir=args.model_dir,
save_total_limit=args.save_total_limit,
save_steps=args.save_steps,
num_train_epochs=args.num_train_epochs,
learning_rate=args.learning_rate,
per_device_train_batch_size=args.batch_size,
per_device_eval_batch_size=64,
gradient_accumulation_steps=args.gradient_accumulation_steps,
weight_decay=args.weight_decay,
logging_dir="./logs",
logging_steps=args.save_steps,
evaluation_strategy=args.evaluation_strategy,
metric_for_best_model="pearsonr",
fp16=True,
fp16_opt_level="O1",
eval_steps=args.save_steps,
load_best_model_at_end=True,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=train_dataset,
eval_dataset=valid_dataset,
compute_metrics=compute_metrics,
)
trainer.train()
model.save_pretrained(args.model_dir)
tokenizer.save_pretrained(args.model_dir)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
# data_arg
parser.add_argument("--data_dir", type=str, default="./data")
parser.add_argument("--model_dir", type=str, default="./model")
parser.add_argument("--output_dir", type=str, default="./output")
parser.add_argument("--model_name_or_path", type=str, default="klue/roberta-large")
parser.add_argument(
"--train_filename", type=str, default="klue-sts-v1.1_train.json"
)
parser.add_argument("--valid_filename", type=str, default="klue-sts-v1.1_dev.json")
# train_arg
parser.add_argument("--num_labels", type=int, default=1)
parser.add_argument("--seed", type=int, default=15)
parser.add_argument("--num_train_epochs", type=int, default=5)
parser.add_argument("--batch_size", type=int, default=64)
parser.add_argument("--learning_rate", type=float, default=5e-5)
parser.add_argument("--gradient_accumulation_steps", type=int, default=1)
parser.add_argument("--weight_decay", type=float, default=0.01)
# eval_arg
parser.add_argument("--evaluation_strategy", type=str, default="steps")
parser.add_argument("--save_steps", type=int, default=250)
parser.add_argument("--eval_steps", type=int, default=250)
parser.add_argument("--save_total_limit", type=int, default=2)
args = parser.parse_args()
main(args)
| [
1,
529,
9507,
29958,
303,
29879,
29914,
14968,
29889,
2272,
13,
5215,
1852,
5510,
13,
5215,
12655,
408,
7442,
13,
13,
5215,
2897,
13,
5215,
4842,
305,
13,
3166,
4327,
414,
1053,
11133,
6066,
3950,
29892,
11133,
3991,
29892,
3201,
4983,
29892,
26101,
26915,
13,
13,
3166,
1904,
1053,
1528,
19954,
2831,
855,
29879,
4597,
23881,
13,
3166,
8783,
1053,
12043,
434,
855,
29879,
3047,
29903,
296,
663,
19832,
16390,
24541,
13,
3166,
3667,
29879,
1053,
1303,
29918,
3126,
29892,
16717,
29918,
17991,
1918,
13,
3166,
12714,
1053,
10272,
29918,
2527,
10817,
13,
13,
13,
1753,
1667,
29898,
5085,
1125,
13,
1678,
4742,
353,
4842,
305,
29889,
10141,
703,
29883,
6191,
29901,
29900,
29908,
565,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
1683,
376,
21970,
1159,
13,
1678,
2295,
353,
11133,
3991,
29889,
3166,
29918,
1457,
3018,
1312,
29898,
5085,
29889,
4299,
29918,
978,
29918,
272,
29918,
2084,
29897,
13,
1678,
2295,
29889,
1949,
29918,
21134,
353,
6389,
29889,
1949,
29918,
21134,
13,
1678,
5993,
3950,
353,
11133,
6066,
3950,
29889,
3166,
29918,
1457,
3018,
1312,
29898,
5085,
29889,
4299,
29918,
978,
29918,
272,
29918,
2084,
29897,
13,
13,
1678,
7945,
29918,
1445,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
1272,
29918,
3972,
29892,
6389,
29889,
14968,
29918,
9507,
29897,
13,
1678,
2854,
29918,
1445,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
1272,
29918,
3972,
29892,
6389,
29889,
3084,
29918,
9507,
29897,
13,
13,
1678,
7945,
29918,
3126,
353,
1303,
29918,
3126,
29898,
14968,
29918,
1445,
29918,
2084,
29897,
13,
1678,
2854,
29918,
3126,
353,
1303,
29918,
3126,
29898,
3084,
29918,
1445,
29918,
2084,
29897,
13,
13,
1678,
7945,
29918,
24713,
353,
12043,
434,
855,
29879,
3047,
29903,
296,
663,
19832,
16390,
24541,
29898,
14968,
29918,
3126,
29892,
5993,
3950,
29892,
29871,
29945,
29896,
29900,
29897,
13,
1678,
2854,
29918,
24713,
353,
12043,
434,
855,
29879,
3047,
29903,
296,
663,
19832,
16390,
24541,
29898,
14968,
29918,
3126,
29892,
5993,
3950,
29892,
29871,
29945,
29896,
29900,
29897,
13,
13,
1678,
1904,
353,
1528,
19954,
2831,
855,
29879,
4597,
23881,
29889,
3166,
29918,
1457,
3018,
1312,
29898,
13,
4706,
6389,
29889,
4299,
29918,
978,
29918,
272,
29918,
2084,
29892,
2295,
29922,
2917,
13,
1678,
1723,
13,
1678,
1904,
29889,
517,
29898,
10141,
29897,
13,
13,
1678,
6694,
29918,
5085,
353,
26101,
26915,
29898,
13,
4706,
1962,
29918,
3972,
29922,
5085,
29889,
4299,
29918,
3972,
29892,
13,
4706,
4078,
29918,
7827,
29918,
13400,
29922,
5085,
29889,
7620,
29918,
7827,
29918,
13400,
29892,
13,
4706,
4078,
29918,
24530,
29922,
5085,
29889,
7620,
29918,
24530,
29892,
13,
4706,
954,
29918,
14968,
29918,
1022,
2878,
29879,
29922,
5085,
29889,
1949,
29918,
14968,
29918,
1022,
2878,
29879,
29892,
13,
4706,
6509,
29918,
10492,
29922,
5085,
29889,
21891,
29918,
10492,
29892,
13,
4706,
639,
29918,
10141,
29918,
14968,
29918,
16175,
29918,
2311,
29922,
5085,
29889,
16175,
29918,
2311,
29892,
13,
4706,
639,
29918,
10141,
29918,
14513,
29918,
16175,
29918,
2311,
29922,
29953,
29946,
29892,
13,
4706,
16030,
29918,
5753,
398,
2785,
29918,
24530,
29922,
5085,
29889,
24970,
29918,
5753,
398,
2785,
29918,
24530,
29892,
13,
4706,
7688,
29918,
7099,
388,
29922,
5085,
29889,
7915,
29918,
7099,
388,
29892,
13,
4706,
12183,
29918,
3972,
543,
6904,
20756,
613,
13,
4706,
12183,
29918,
24530,
29922,
5085,
29889,
7620,
29918,
24530,
29892,
13,
4706,
17983,
29918,
710,
8963,
29922,
5085,
29889,
24219,
362,
29918,
710,
8963,
29892,
13,
4706,
12714,
29918,
1454,
29918,
13318,
29918,
4299,
543,
412,
279,
1100,
29878,
613,
13,
4706,
285,
29886,
29896,
29953,
29922,
5574,
29892,
13,
4706,
285,
29886,
29896,
29953,
29918,
3670,
29918,
5563,
543,
29949,
29896,
613,
13,
4706,
19745,
29918,
24530,
29922,
5085,
29889,
7620,
29918,
24530,
29892,
13,
4706,
2254,
29918,
13318,
29918,
4299,
29918,
271,
29918,
355,
29922,
5574,
29892,
13,
1678,
1723,
13,
13,
1678,
1020,
4983,
353,
3201,
4983,
29898,
13,
4706,
1904,
29922,
4299,
29892,
13,
4706,
6389,
29922,
26495,
29918,
5085,
29892,
13,
4706,
7945,
29918,
24713,
29922,
14968,
29918,
24713,
29892,
13,
4706,
19745,
29918,
24713,
29922,
3084,
29918,
24713,
29892,
13,
4706,
10272,
29918,
2527,
10817,
29922,
26017,
29918,
2527,
10817,
29892,
13,
1678,
1723,
13,
1678,
1020,
4983,
29889,
14968,
580,
13,
1678,
1904,
29889,
7620,
29918,
1457,
3018,
1312,
29898,
5085,
29889,
4299,
29918,
3972,
29897,
13,
1678,
5993,
3950,
29889,
7620,
29918,
1457,
3018,
1312,
29898,
5085,
29889,
4299,
29918,
3972,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
396,
848,
29918,
1191,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1272,
29918,
3972,
613,
1134,
29922,
710,
29892,
2322,
543,
6904,
1272,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
4299,
29918,
3972,
613,
1134,
29922,
710,
29892,
2322,
543,
6904,
4299,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
4905,
29918,
3972,
613,
1134,
29922,
710,
29892,
2322,
543,
6904,
4905,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
4299,
29918,
978,
29918,
272,
29918,
2084,
613,
1134,
29922,
710,
29892,
2322,
543,
6321,
434,
29914,
307,
19954,
29899,
16961,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
29898,
13,
4706,
376,
489,
14968,
29918,
9507,
613,
1134,
29922,
710,
29892,
2322,
543,
6321,
434,
29899,
303,
29879,
29899,
29894,
29896,
29889,
29896,
29918,
14968,
29889,
3126,
29908,
13,
1678,
1723,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
3084,
29918,
9507,
613,
1134,
29922,
710,
29892,
2322,
543,
6321,
434,
29899,
303,
29879,
29899,
29894,
29896,
29889,
29896,
29918,
3359,
29889,
3126,
1159,
13,
13,
1678,
396,
7945,
29918,
1191,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1949,
29918,
21134,
613,
1134,
29922,
524,
29892,
2322,
29922,
29896,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
26776,
613,
1134,
29922,
524,
29892,
2322,
29922,
29896,
29945,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1949,
29918,
14968,
29918,
1022,
2878,
29879,
613,
1134,
29922,
524,
29892,
2322,
29922,
29945,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
16175,
29918,
2311,
613,
1134,
29922,
524,
29892,
2322,
29922,
29953,
29946,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
21891,
29918,
10492,
613,
1134,
29922,
7411,
29892,
2322,
29922,
29945,
29872,
29899,
29945,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
24970,
29918,
5753,
398,
2785,
29918,
24530,
613,
1134,
29922,
524,
29892,
2322,
29922,
29896,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
7915,
29918,
7099,
388,
613,
1134,
29922,
7411,
29892,
2322,
29922,
29900,
29889,
29900,
29896,
29897,
13,
13,
1678,
396,
19745,
29918,
1191,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
24219,
362,
29918,
710,
8963,
613,
1134,
29922,
710,
29892,
2322,
543,
24530,
1159,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
7620,
29918,
24530,
613,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29945,
29900,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
14513,
29918,
24530,
613,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29945,
29900,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
7620,
29918,
7827,
29918,
13400,
613,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29897,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
1667,
29898,
5085,
29897,
13,
2
] |
markupwiki/views.py | jamesturk/django-markupwiki | 1 | 141036 | from difflib import HtmlDiff
from django.shortcuts import get_object_or_404, render_to_response, redirect
from django.http import HttpResponseForbidden
from django.conf import settings
from django.views.decorators.http import require_POST
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib import messages
from django.http import Http404
from django.template import RequestContext
from django.utils.functional import wraps
from markupwiki.models import Article, ArticleVersion, PUBLIC, DELETED, LOCKED
from markupwiki.forms import ArticleForm, StaffModerationForm, ArticleRenameForm
CREATE_MISSING_ARTICLE = getattr(settings,
'MARKUPWIKI_CREATE_MISSING_ARTICLES', True)
EDITOR_TEST_FUNC = getattr(settings, 'MARKUPWIKI_EDITOR_TEST_FUNC',
lambda u: u.is_authenticated())
MODERATOR_TEST_FUNC = getattr(settings, 'MARKUPWIKI_MODERATOR_TEST_FUNC',
lambda u: u.is_staff)
def title_check(view):
def new_view(request, title, *args, **kwargs):
newtitle = title.replace(' ', '_')
if newtitle != title:
return redirect(request.path.replace(title, newtitle),
permanent=True)
else:
return view(request, title, *args, **kwargs)
return wraps(view)(new_view)
@title_check
def view_article(request, title, n=None):
''' view an article (or a specific revision of an article)
if n is specified will show nth revision, otherwise latest will be shown
if the article does not exist the user will be redirected to the edit page
Context:
article - ``Article`` instance
version - ``ArticleVersion`` to display
mod_form - ``StaffModerationForm`` instance present if user is staff
rename_form - ``ArticleRenameForm`` instance present if user is staff
Template:
article.html - default template used
'''
try:
article = Article.objects.get(title=title)
except Article.DoesNotExist:
if CREATE_MISSING_ARTICLE:
return redirect('edit_article', title)
else:
raise Http404()
if article.redirect_to_id:
return redirect(article.redirect_to)
if n:
version = article.versions.get(number=n)
else:
version = article.versions.latest()
version.is_latest = True
# set editable flag on article
article.editable = article.is_editable_by_user(request.user)
context = {'article':article, 'version': version}
if request.user.is_staff:
context['mod_form'] = StaffModerationForm(instance=article)
context['rename_form'] = ArticleRenameForm()
return render_to_response('markupwiki/article.html', context,
context_instance=RequestContext(request))
@title_check
@user_passes_test(EDITOR_TEST_FUNC)
def edit_article(request, title):
''' edit (or create) an article
Context:
title - title of article being edited
article - article being edited (potentially None)
form - form to edit article
Templates:
edit_article.html - Default template for editing the article.
locked_article.html - Template shown if editing is locked.
'''
try:
article = Article.objects.get(title=title)
except Article.DoesNotExist:
article = None
# check for staff lock
if article and not article.is_editable_by_user(request.user):
return HttpResponseForbidden('not authorized to edit')
if request.method == 'GET':
# either get an empty ArticleForm or one based on latest version
if article:
if not article.get_write_lock(request.user):
# set message and redirect
messages.info(request, 'Someone else is currently editing this page, please wait and try again.')
return redirect(article)
version = article.versions.latest()
form = ArticleForm(data={'body':version.body,
'body_markup_type':version.body_markup_type})
else:
form = ArticleForm()
elif request.method == 'POST':
form = ArticleForm(request.POST)
user = None if request.user.is_anonymous() else request.user
if form.is_valid():
if not article:
# if article doesn't exist create it and start num at 0
article = Article.objects.create(title=title,
creator=user)
num = 0
else:
if not article.get_write_lock(request.user):
# set message and redirect
messages.error(request, 'Your session timed out and someone else is now editing this page.')
return redirect(article)
# otherwise get latest num
num = article.versions.latest().number + 1
# create a new version attached to article specified in name
version = form.save(False)
version.article = article
version.author = user
version.number = num
version.save()
article.get_write_lock(user or request, release=True)
# redirect to view article on save
return redirect(article)
return render_to_response('markupwiki/edit_article.html',
{'title':title, 'article':article, 'form': form},
context_instance=RequestContext(request))
@require_POST
@user_passes_test(MODERATOR_TEST_FUNC)
@title_check
def article_status(request, title):
''' POST-only view to update article status (staff-only)
'''
article = get_object_or_404(Article, title=title)
article.status = int(request.POST['status'])
article.save()
return redirect(article)
@require_POST
@user_passes_test(MODERATOR_TEST_FUNC)
@title_check
def revert(request, title):
''' POST-only view to revert article to a specific revision
'''
article = get_object_or_404(Article, title=title)
revision_id = int(request.POST['revision'])
revision = get_object_or_404(article.versions, number=revision_id)
ArticleVersion.objects.create(article=article, author=request.user,
number=article.versions.latest().number,
comment='reverted to r%s' % revision_id,
body=revision.body)
return redirect(article)
@require_POST
@user_passes_test(MODERATOR_TEST_FUNC)
@title_check
def rename(request, title):
''' POST-only view to rename article '''
article = get_object_or_404(Article, title=title)
new_title = request.POST['new_title']
article.title = new_title.replace(' ', '_')
article.save()
new_article = Article.objects.create(title=title, creator=request.user,
redirect_to=article)
return redirect(article)
@title_check
def article_history(request, title):
article = get_object_or_404(Article, title=title)
versions = article.versions.filter(removed=False)
return render_to_response('markupwiki/history.html',
{'article':article, 'versions':versions},
context_instance=RequestContext(request))
@title_check
def article_diff(request, title):
article = get_object_or_404(Article, title=title)
from_id = int(request.GET['from'])
to_id = int(request.GET['to'])
from_version = article.versions.get(number=from_id)
to_version = article.versions.get(number=to_id)
differ = HtmlDiff()
from_body = from_version.body.raw.split('\n')
to_body = to_version.body.raw.split('\n')
table = differ.make_table(from_body, to_body)
return render_to_response('markupwiki/article_diff.html',
{'article': article, 'table':table,
'from': from_id, 'to':to_id},
context_instance=RequestContext(request))
| [
1,
515,
2923,
1982,
1053,
24726,
26023,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29892,
4050,
29918,
517,
29918,
5327,
29892,
6684,
13,
3166,
9557,
29889,
1124,
1053,
9056,
5103,
2831,
29890,
4215,
13,
3166,
9557,
29889,
5527,
1053,
6055,
13,
3166,
9557,
29889,
7406,
29889,
19557,
4097,
29889,
1124,
1053,
1996,
29918,
5438,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
19557,
4097,
1053,
6464,
29918,
12403,
29892,
1404,
29918,
3364,
267,
29918,
1688,
13,
3166,
9557,
29889,
21570,
1053,
7191,
13,
3166,
9557,
29889,
1124,
1053,
9056,
29946,
29900,
29946,
13,
3166,
9557,
29889,
6886,
1053,
10729,
2677,
13,
3166,
9557,
29889,
13239,
29889,
2220,
284,
1053,
11463,
567,
13,
3166,
24986,
4594,
29889,
9794,
1053,
21746,
29892,
21746,
6594,
29892,
349,
7466,
27888,
29892,
5012,
1307,
29911,
3352,
29892,
11247,
7077,
3352,
13,
3166,
24986,
4594,
29889,
9514,
1053,
21746,
2500,
29892,
15351,
2111,
261,
362,
2500,
29892,
21746,
29934,
3871,
2500,
13,
13,
27045,
29918,
10403,
1799,
4214,
29918,
8322,
2965,
1307,
353,
679,
5552,
29898,
11027,
29892,
13,
462,
462,
525,
1529,
29934,
29968,
4897,
22119,
29968,
29902,
29918,
27045,
29918,
10403,
1799,
4214,
29918,
8322,
2965,
17101,
742,
5852,
29897,
13,
13,
12378,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
353,
679,
5552,
29898,
11027,
29892,
525,
1529,
29934,
29968,
4897,
22119,
29968,
29902,
29918,
12378,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
742,
13,
462,
965,
14013,
318,
29901,
318,
29889,
275,
29918,
27218,
630,
3101,
13,
6720,
8032,
1299,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
353,
679,
5552,
29898,
11027,
29892,
525,
1529,
29934,
29968,
4897,
22119,
29968,
29902,
29918,
6720,
8032,
1299,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
742,
13,
462,
795,
14013,
318,
29901,
318,
29889,
275,
29918,
303,
3470,
29897,
13,
13,
1753,
3611,
29918,
3198,
29898,
1493,
1125,
13,
1678,
822,
716,
29918,
1493,
29898,
3827,
29892,
3611,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
716,
3257,
353,
3611,
29889,
6506,
877,
13420,
22868,
1495,
13,
4706,
565,
716,
3257,
2804,
3611,
29901,
13,
9651,
736,
6684,
29898,
3827,
29889,
2084,
29889,
6506,
29898,
3257,
29892,
716,
3257,
511,
13,
462,
9651,
17667,
29922,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
1776,
29898,
3827,
29892,
3611,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
1678,
736,
11463,
567,
29898,
1493,
5033,
1482,
29918,
1493,
29897,
13,
13,
29992,
3257,
29918,
3198,
13,
1753,
1776,
29918,
7914,
29898,
3827,
29892,
3611,
29892,
302,
29922,
8516,
1125,
13,
1678,
14550,
1776,
385,
4274,
313,
272,
263,
2702,
26554,
310,
385,
4274,
29897,
13,
13,
1678,
565,
302,
338,
6790,
674,
1510,
302,
386,
26554,
29892,
6467,
9281,
674,
367,
4318,
13,
13,
1678,
565,
278,
4274,
947,
451,
1863,
278,
1404,
674,
367,
6684,
287,
304,
278,
3863,
1813,
13,
13,
1678,
15228,
29901,
13,
4706,
4274,
268,
448,
4954,
9986,
2512,
16159,
2777,
13,
4706,
1873,
268,
448,
4954,
9986,
2512,
6594,
16159,
304,
2479,
13,
4706,
878,
29918,
689,
1678,
448,
4954,
855,
3470,
2111,
261,
362,
2500,
16159,
2777,
2198,
565,
1404,
338,
13925,
13,
4706,
19508,
29918,
689,
448,
4954,
9986,
2512,
29934,
3871,
2500,
16159,
2777,
2198,
565,
1404,
338,
13925,
13,
13,
1678,
25663,
29901,
13,
4706,
4274,
29889,
1420,
448,
2322,
4472,
1304,
13,
1678,
14550,
13,
13,
1678,
1018,
29901,
13,
4706,
4274,
353,
21746,
29889,
12650,
29889,
657,
29898,
3257,
29922,
3257,
29897,
13,
1678,
5174,
21746,
29889,
25125,
3664,
1252,
391,
29901,
13,
4706,
565,
14602,
29918,
10403,
1799,
4214,
29918,
8322,
2965,
1307,
29901,
13,
9651,
736,
6684,
877,
5628,
29918,
7914,
742,
3611,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
9056,
29946,
29900,
29946,
580,
13,
13,
1678,
565,
4274,
29889,
17886,
29918,
517,
29918,
333,
29901,
13,
4706,
736,
6684,
29898,
7914,
29889,
17886,
29918,
517,
29897,
13,
13,
1678,
565,
302,
29901,
13,
4706,
1873,
353,
4274,
29889,
26100,
29889,
657,
29898,
4537,
29922,
29876,
29897,
13,
1678,
1683,
29901,
13,
4706,
1873,
353,
4274,
29889,
26100,
29889,
12333,
580,
13,
4706,
1873,
29889,
275,
29918,
12333,
353,
5852,
13,
13,
1678,
396,
731,
3863,
519,
7353,
373,
4274,
13,
1678,
4274,
29889,
5628,
519,
353,
4274,
29889,
275,
29918,
5628,
519,
29918,
1609,
29918,
1792,
29898,
3827,
29889,
1792,
29897,
13,
13,
1678,
3030,
353,
11117,
7914,
2396,
7914,
29892,
525,
3259,
2396,
1873,
29913,
13,
13,
1678,
565,
2009,
29889,
1792,
29889,
275,
29918,
303,
3470,
29901,
13,
4706,
3030,
1839,
1545,
29918,
689,
2033,
353,
15351,
2111,
261,
362,
2500,
29898,
8758,
29922,
7914,
29897,
13,
4706,
3030,
1839,
1267,
420,
29918,
689,
2033,
353,
21746,
29934,
3871,
2500,
580,
13,
13,
1678,
736,
4050,
29918,
517,
29918,
5327,
877,
3502,
786,
4594,
29914,
7914,
29889,
1420,
742,
3030,
29892,
13,
462,
795,
3030,
29918,
8758,
29922,
3089,
2677,
29898,
3827,
876,
13,
13,
29992,
3257,
29918,
3198,
13,
29992,
1792,
29918,
3364,
267,
29918,
1688,
29898,
12378,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
29897,
13,
1753,
3863,
29918,
7914,
29898,
3827,
29892,
3611,
1125,
13,
1678,
14550,
3863,
313,
272,
1653,
29897,
385,
4274,
13,
13,
4706,
15228,
29901,
13,
9651,
3611,
448,
3611,
310,
4274,
1641,
8788,
13,
9651,
4274,
448,
4274,
1641,
8788,
313,
17765,
9247,
6213,
29897,
13,
9651,
883,
448,
883,
304,
3863,
4274,
13,
13,
4706,
6789,
9884,
29901,
13,
9651,
3863,
29918,
7914,
29889,
1420,
448,
13109,
4472,
363,
16278,
278,
4274,
29889,
13,
9651,
22822,
29918,
7914,
29889,
1420,
448,
25663,
4318,
565,
16278,
338,
22822,
29889,
13,
1678,
14550,
13,
1678,
1018,
29901,
13,
4706,
4274,
353,
21746,
29889,
12650,
29889,
657,
29898,
3257,
29922,
3257,
29897,
13,
1678,
5174,
21746,
29889,
25125,
3664,
1252,
391,
29901,
13,
4706,
4274,
353,
6213,
13,
13,
1678,
396,
1423,
363,
13925,
7714,
13,
1678,
565,
4274,
322,
451,
4274,
29889,
275,
29918,
5628,
519,
29918,
1609,
29918,
1792,
29898,
3827,
29889,
1792,
1125,
13,
4706,
736,
9056,
5103,
2831,
29890,
4215,
877,
1333,
4148,
1891,
304,
3863,
1495,
13,
13,
1678,
565,
2009,
29889,
5696,
1275,
525,
7194,
2396,
13,
4706,
396,
2845,
679,
385,
4069,
21746,
2500,
470,
697,
2729,
373,
9281,
1873,
13,
4706,
565,
4274,
29901,
13,
13,
9651,
565,
451,
4274,
29889,
657,
29918,
3539,
29918,
908,
29898,
3827,
29889,
1792,
1125,
13,
18884,
396,
731,
2643,
322,
6684,
13,
18884,
7191,
29889,
3888,
29898,
3827,
29892,
525,
9526,
650,
1683,
338,
5279,
16278,
445,
1813,
29892,
3113,
4480,
322,
1018,
1449,
29889,
1495,
13,
18884,
736,
6684,
29898,
7914,
29897,
13,
13,
9651,
1873,
353,
4274,
29889,
26100,
29889,
12333,
580,
13,
9651,
883,
353,
21746,
2500,
29898,
1272,
3790,
29915,
2587,
2396,
3259,
29889,
2587,
29892,
13,
462,
1669,
525,
2587,
29918,
3502,
786,
29918,
1853,
2396,
3259,
29889,
2587,
29918,
3502,
786,
29918,
1853,
1800,
13,
4706,
1683,
29901,
13,
9651,
883,
353,
21746,
2500,
580,
13,
1678,
25342,
2009,
29889,
5696,
1275,
525,
5438,
2396,
13,
4706,
883,
353,
21746,
2500,
29898,
3827,
29889,
5438,
29897,
13,
4706,
1404,
353,
6213,
565,
2009,
29889,
1792,
29889,
275,
29918,
25772,
580,
1683,
2009,
29889,
1792,
13,
308,
13,
4706,
565,
883,
29889,
275,
29918,
3084,
7295,
13,
9651,
565,
451,
4274,
29901,
13,
18884,
396,
565,
4274,
1838,
29915,
29873,
1863,
1653,
372,
322,
1369,
954,
472,
29871,
29900,
13,
18884,
4274,
353,
21746,
29889,
12650,
29889,
3258,
29898,
3257,
29922,
3257,
29892,
13,
462,
462,
462,
907,
1061,
29922,
1792,
29897,
13,
18884,
954,
353,
29871,
29900,
13,
9651,
1683,
29901,
13,
18884,
565,
451,
4274,
29889,
657,
29918,
3539,
29918,
908,
29898,
3827,
29889,
1792,
1125,
13,
462,
1678,
396,
731,
2643,
322,
6684,
13,
462,
1678,
7191,
29889,
2704,
29898,
3827,
29892,
525,
10858,
4867,
5335,
287,
714,
322,
4856,
1683,
338,
1286,
16278,
445,
1813,
29889,
1495,
13,
462,
1678,
736,
6684,
29898,
7914,
29897,
13,
13,
18884,
396,
6467,
679,
9281,
954,
13,
18884,
954,
353,
4274,
29889,
26100,
29889,
12333,
2141,
4537,
718,
29871,
29896,
13,
13,
9651,
396,
1653,
263,
716,
1873,
10959,
304,
4274,
6790,
297,
1024,
13,
9651,
1873,
353,
883,
29889,
7620,
29898,
8824,
29897,
13,
9651,
1873,
29889,
7914,
353,
4274,
13,
9651,
1873,
29889,
8921,
353,
1404,
13,
9651,
1873,
29889,
4537,
353,
954,
13,
9651,
1873,
29889,
7620,
580,
13,
13,
9651,
4274,
29889,
657,
29918,
3539,
29918,
908,
29898,
1792,
470,
2009,
29892,
6507,
29922,
5574,
29897,
13,
13,
9651,
396,
6684,
304,
1776,
4274,
373,
4078,
13,
9651,
736,
6684,
29898,
7914,
29897,
13,
13,
1678,
736,
4050,
29918,
517,
29918,
5327,
877,
3502,
786,
4594,
29914,
5628,
29918,
7914,
29889,
1420,
742,
13,
462,
795,
11117,
3257,
2396,
3257,
29892,
525,
7914,
2396,
7914,
29892,
525,
689,
2396,
883,
1118,
13,
462,
795,
3030,
29918,
8758,
29922,
3089,
2677,
29898,
3827,
876,
13,
13,
13,
29992,
12277,
29918,
5438,
13,
29992,
1792,
29918,
3364,
267,
29918,
1688,
29898,
6720,
8032,
1299,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
29897,
13,
29992,
3257,
29918,
3198,
13,
1753,
4274,
29918,
4882,
29898,
3827,
29892,
3611,
1125,
13,
1678,
14550,
11971,
29899,
6194,
1776,
304,
2767,
4274,
4660,
313,
303,
3470,
29899,
6194,
29897,
13,
1678,
14550,
13,
1678,
4274,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
9986,
2512,
29892,
3611,
29922,
3257,
29897,
13,
1678,
4274,
29889,
4882,
353,
938,
29898,
3827,
29889,
5438,
1839,
4882,
11287,
13,
1678,
4274,
29889,
7620,
580,
13,
13,
1678,
736,
6684,
29898,
7914,
29897,
13,
13,
29992,
12277,
29918,
5438,
13,
29992,
1792,
29918,
3364,
267,
29918,
1688,
29898,
6720,
8032,
1299,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
29897,
13,
29992,
3257,
29918,
3198,
13,
1753,
29538,
29898,
3827,
29892,
3611,
1125,
13,
1678,
14550,
11971,
29899,
6194,
1776,
304,
29538,
4274,
304,
263,
2702,
26554,
13,
1678,
14550,
13,
1678,
4274,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
9986,
2512,
29892,
3611,
29922,
3257,
29897,
13,
1678,
26554,
29918,
333,
353,
938,
29898,
3827,
29889,
5438,
1839,
276,
4924,
11287,
13,
1678,
26554,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
7914,
29889,
26100,
29892,
1353,
29922,
276,
4924,
29918,
333,
29897,
13,
1678,
21746,
6594,
29889,
12650,
29889,
3258,
29898,
7914,
29922,
7914,
29892,
4148,
29922,
3827,
29889,
1792,
29892,
13,
462,
462,
29871,
1353,
29922,
7914,
29889,
26100,
29889,
12333,
2141,
4537,
29892,
13,
462,
462,
29871,
3440,
2433,
276,
1765,
287,
304,
364,
29995,
29879,
29915,
1273,
26554,
29918,
333,
29892,
13,
462,
462,
29871,
3573,
29922,
276,
4924,
29889,
2587,
29897,
13,
13,
1678,
736,
6684,
29898,
7914,
29897,
13,
13,
29992,
12277,
29918,
5438,
13,
29992,
1792,
29918,
3364,
267,
29918,
1688,
29898,
6720,
8032,
1299,
1955,
29918,
18267,
29918,
29943,
3904,
29907,
29897,
13,
29992,
3257,
29918,
3198,
13,
1753,
19508,
29898,
3827,
29892,
3611,
1125,
13,
1678,
14550,
11971,
29899,
6194,
1776,
304,
19508,
4274,
14550,
13,
1678,
4274,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
9986,
2512,
29892,
3611,
29922,
3257,
29897,
13,
1678,
716,
29918,
3257,
353,
2009,
29889,
5438,
1839,
1482,
29918,
3257,
2033,
13,
1678,
4274,
29889,
3257,
353,
716,
29918,
3257,
29889,
6506,
877,
13420,
22868,
1495,
13,
1678,
4274,
29889,
7620,
580,
13,
1678,
716,
29918,
7914,
353,
21746,
29889,
12650,
29889,
3258,
29898,
3257,
29922,
3257,
29892,
907,
1061,
29922,
3827,
29889,
1792,
29892,
13,
462,
462,
308,
6684,
29918,
517,
29922,
7914,
29897,
13,
1678,
736,
6684,
29898,
7914,
29897,
13,
13,
29992,
3257,
29918,
3198,
13,
1753,
4274,
29918,
18434,
29898,
3827,
29892,
3611,
1125,
13,
1678,
4274,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
9986,
2512,
29892,
3611,
29922,
3257,
29897,
13,
1678,
6910,
353,
4274,
29889,
26100,
29889,
4572,
29898,
1745,
8238,
29922,
8824,
29897,
13,
1678,
736,
4050,
29918,
517,
29918,
5327,
877,
3502,
786,
4594,
29914,
18434,
29889,
1420,
742,
13,
462,
795,
11117,
7914,
2396,
7914,
29892,
525,
26100,
2396,
26100,
1118,
13,
462,
795,
3030,
29918,
8758,
29922,
3089,
2677,
29898,
3827,
876,
13,
13,
29992,
3257,
29918,
3198,
13,
1753,
4274,
29918,
12765,
29898,
3827,
29892,
3611,
1125,
13,
1678,
4274,
353,
679,
29918,
3318,
29918,
272,
29918,
29946,
29900,
29946,
29898,
9986,
2512,
29892,
3611,
29922,
3257,
29897,
13,
1678,
515,
29918,
333,
353,
938,
29898,
3827,
29889,
7194,
1839,
3166,
11287,
13,
1678,
304,
29918,
333,
353,
938,
29898,
3827,
29889,
7194,
1839,
517,
11287,
13,
1678,
515,
29918,
3259,
353,
4274,
29889,
26100,
29889,
657,
29898,
4537,
29922,
3166,
29918,
333,
29897,
13,
1678,
304,
29918,
3259,
353,
4274,
29889,
26100,
29889,
657,
29898,
4537,
29922,
517,
29918,
333,
29897,
13,
1678,
1163,
353,
24726,
26023,
580,
13,
1678,
515,
29918,
2587,
353,
515,
29918,
3259,
29889,
2587,
29889,
1610,
29889,
5451,
28909,
29876,
1495,
13,
1678,
304,
29918,
2587,
353,
304,
29918,
3259,
29889,
2587,
29889,
1610,
29889,
5451,
28909,
29876,
1495,
13,
1678,
1591,
353,
1163,
29889,
5675,
29918,
2371,
29898,
3166,
29918,
2587,
29892,
304,
29918,
2587,
29897,
13,
1678,
736,
4050,
29918,
517,
29918,
5327,
877,
3502,
786,
4594,
29914,
7914,
29918,
12765,
29889,
1420,
742,
13,
462,
795,
11117,
7914,
2396,
4274,
29892,
525,
2371,
2396,
2371,
29892,
13,
462,
1669,
525,
3166,
2396,
515,
29918,
333,
29892,
525,
517,
2396,
517,
29918,
333,
1118,
13,
462,
795,
3030,
29918,
8758,
29922,
3089,
2677,
29898,
3827,
876,
13,
2
] |
pykasso/abrechnung.py | pekh/pykasso | 0 | 67297 | <gh_stars>0
from collections import defaultdict
from dataclasses import dataclass
from datetime import date, datetime
from decimal import Decimal
from typing import Dict, List
@dataclass(eq=True, frozen=True)
class Mitglied:
name: str
vorname: str
anrede: str = 'Hallo'
strasse: str = ''
plz: str = ''
ort: str = ''
land: str = ''
email: str = ''
@dataclass
class AbrechnungsPosition:
datum: date
text: str
wert: Decimal
@dataclass
class Abrechnung:
mitglied: Mitglied
positionen: List[AbrechnungsPosition]
# evtl könnte das Iterator-Protokoll implementiert werden, um über die
# Positionen zu iterieren
@property
def betrag(self):
return sum([pos.wert for pos in self.positionen])
def abrechnungen_aus_transaktionen(transaktionen: List[Dict[str, str]]) -> List[Abrechnung]:
positionen = defaultdict(list)
for transaktion in transaktionen:
vorname, name = transaktion['Account Name'].split(':')[-1].split(' ')
positionen[Mitglied(name, vorname)].append(
AbrechnungsPosition(
datum=datetime.strptime(transaktion['Date'], '%d.%m.%Y').date(),
text=transaktion['Description'],
wert=Decimal(transaktion['Amount Num.'].replace(',', '.')),
)
)
result = []
for mitglied, a_positionen in positionen.items():
result.append(
Abrechnung(mitglied, positionen=sorted(a_positionen, key=lambda x: x.datum))
)
return result
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
13,
3166,
16250,
1053,
2322,
8977,
13,
3166,
848,
13203,
1053,
848,
1990,
13,
3166,
12865,
1053,
2635,
29892,
12865,
13,
3166,
13677,
1053,
3826,
3039,
13,
3166,
19229,
1053,
360,
919,
29892,
2391,
13,
13,
13,
29992,
1272,
1990,
29898,
1837,
29922,
5574,
29892,
14671,
2256,
29922,
5574,
29897,
13,
1990,
12704,
29901,
13,
1678,
1024,
29901,
851,
13,
1678,
3764,
978,
29901,
851,
13,
1678,
385,
276,
311,
29901,
851,
353,
525,
29950,
26177,
29915,
13,
1678,
851,
5793,
29901,
851,
353,
6629,
13,
1678,
715,
29920,
29901,
851,
353,
6629,
13,
1678,
20289,
29901,
851,
353,
6629,
13,
1678,
2982,
29901,
851,
353,
6629,
13,
1678,
4876,
29901,
851,
353,
6629,
13,
13,
13,
29992,
1272,
1990,
13,
1990,
319,
1030,
3049,
3085,
8003,
29901,
13,
1678,
1418,
398,
29901,
2635,
13,
1678,
1426,
29901,
851,
13,
1678,
281,
814,
29901,
3826,
3039,
13,
13,
13,
29992,
1272,
1990,
13,
1990,
319,
1030,
3049,
686,
29901,
13,
1678,
1380,
29887,
2957,
29901,
12704,
13,
1678,
2602,
264,
29901,
2391,
29961,
29909,
1030,
3049,
3085,
8003,
29962,
13,
13,
1678,
396,
3415,
15206,
9487,
29876,
371,
1697,
20504,
1061,
29899,
1184,
17082,
3028,
2334,
3722,
3678,
29892,
1922,
2939,
762,
13,
1678,
396,
20627,
264,
1729,
4256,
7884,
13,
1678,
732,
6799,
13,
1678,
822,
1010,
1431,
29898,
1311,
1125,
13,
4706,
736,
2533,
4197,
1066,
29889,
16347,
363,
926,
297,
1583,
29889,
3283,
264,
2314,
13,
13,
13,
1753,
633,
276,
3049,
2469,
29918,
1485,
29918,
3286,
5867,
17725,
29898,
3286,
5867,
17725,
29901,
2391,
29961,
21533,
29961,
710,
29892,
851,
24960,
1599,
2391,
29961,
29909,
1030,
3049,
686,
5387,
13,
1678,
2602,
264,
353,
2322,
8977,
29898,
1761,
29897,
13,
1678,
363,
1301,
5867,
291,
297,
1301,
5867,
17725,
29901,
13,
4706,
3764,
978,
29892,
1024,
353,
1301,
5867,
291,
1839,
10601,
4408,
13359,
5451,
877,
29901,
1495,
14352,
29896,
1822,
5451,
877,
25710,
13,
4706,
2602,
264,
29961,
29924,
277,
29887,
2957,
29898,
978,
29892,
3764,
978,
29897,
1822,
4397,
29898,
13,
9651,
319,
1030,
3049,
3085,
8003,
29898,
13,
18884,
1418,
398,
29922,
12673,
29889,
710,
415,
603,
29898,
3286,
5867,
291,
1839,
2539,
7464,
14210,
29881,
29889,
29995,
29885,
29889,
29995,
29979,
2824,
1256,
3285,
13,
18884,
1426,
29922,
3286,
5867,
291,
1839,
9868,
7464,
13,
18884,
281,
814,
29922,
23307,
29898,
3286,
5867,
291,
1839,
18087,
11848,
6169,
1822,
6506,
29317,
742,
15300,
1495,
511,
13,
18884,
1723,
13,
9651,
1723,
13,
13,
1678,
1121,
353,
5159,
13,
1678,
363,
1380,
29887,
2957,
29892,
263,
29918,
3283,
264,
297,
2602,
264,
29889,
7076,
7295,
13,
4706,
1121,
29889,
4397,
29898,
13,
9651,
319,
1030,
3049,
686,
29898,
2415,
29887,
2957,
29892,
2602,
264,
29922,
24582,
29898,
29874,
29918,
3283,
264,
29892,
1820,
29922,
2892,
921,
29901,
921,
29889,
4130,
398,
876,
13,
9651,
1723,
13,
13,
1678,
736,
1121,
13,
2
] |
marginal_finder/__init__.py | pjamesjoyce/marginal-finder | 0 | 191712 | <gh_stars>0
from .market_finder import * | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
869,
28549,
29918,
2886,
261,
1053,
334,
2
] |
drawIns.py | Tesla2fox/rescuePathPlanning | 0 | 188701 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 11 21:43:14 2018
@author: robot
"""
import plotly.plotly as py
import plotly.graph_objs as go
import plotly
import random
import numpy as np
import copy as cp
import copy
import readCfg.read_cfg as rd
from IPython.display import HTML,display
import colorlover as cl
import math
#import read_cfg
class Pnt:
def __init__(self,x=0,y=0):
self.x = x
self.y = y
def pnt2dict(self):
dic = dict(x = x,y= y)
return dic
def display(self):
print('x = ',self.x,'y = ',self.y)
class Circle:
def __init__(self,pnt = Pnt(),rad = 0):
self.x = pnt.x
self.y = pnt.y
self.rad = rad
self.x0 = self.x - self.rad
self.y0 = self.y - self.rad
self.x1 = self.x + self.rad
self.y1 = self.y + self.rad
def circle2dict(self):
dic = dict()
dic['type'] = 'circle'
dic['xref'] = 'x'
dic['yref'] = 'y'
dic['x0'] = self.x0
dic['y0'] = self.y0
dic['x1'] = self.x1
dic['y1'] = self.y1
dic['line'] = dict(color = 'rgba(50, 171, 96, 1)')
return dic
class Line:
def __init__(self,pnt0 =Pnt(),pnt1=Pnt()):
self.x0 = pnt0.x
self.y0 = pnt0.y
self.x1 = pnt1.x
self.y1 = pnt1.y
def line2dict(self):
dic= dict()
dic['type']='line'
dic['x0'] =self.x0
dic['y0'] =self.y0
dic['x1'] =self.x1
dic['y1'] =self.y1
dic['line'] = dict(color = 'rgb(128, 0, 128)')
return dic
class Rect:
def __init__(self,pnt =Pnt(),width =0,height =0):
self.x0 = pnt.x
self.y0 = pnt.y
self.x1 = self.x0 + width
self.y1 = self.y0 + height
def rect2dict(self):
dic = dict()
dic['type']='rect'
dic['x0'] = self.x0
dic['y0'] = self.y0
dic['x1'] = self.x1
dic['y1'] = self.y1
dic['line'] = dict(color = 'rgb(128, 0, 128)')
return dic
def getLevelColor(level):
strcolor = 'rgba('
for i in range(3):
strcolor = strcolor + str(level*50)+','
strcolor = strcolor + str(1/level) +')'
return strcolor
colorLst = ['white','black']
class Env:
def __init__(self, mat = np.zeros((2,2))):
self.mat = mat
self.shapeLst = []
self.drawData = []
self.annotations = []
self.proLevNum = 0
def addgrid(self):
g_color = 'blue'
row = len(self.mat)
for i in range(row):
for j in range(len(self.mat[i])):
pnt = Pnt(i,j)
rect = Rect(pnt,1,1)
rectDic = rect.rect2dict()
rectDic['line']['color'] = g_color
rectDic['line']['width'] = 0.5
# rectDic['opacity'] = 1/(int(self.mat[i][j])+1)
# rectDic['fillcolor'] = colorLst[int(self.mat[i][j])]
if(int(self.mat[i][j])==1):
rectDic['fillcolor'] = 'black'
# if(int(self.mat[i][j])==0):
# rectDic['fillcolor'] = colorLst[int(self.mat[i][j])]
# getLevelColor(mat[i][j])
self.shapeLst.append(copy.deepcopy(rectDic))
print(len(self.shapeLst))
def addProGrid(self,proLevLst = []):
line_color = 'red'
ind = 0
row = len(self.mat)
bupu = cl.scales['9']['seq']['YlGnBu']
bupuNum = cl.interp(bupu,500)
bupuUnit = math.floor(500/4)
for i in range(row):
for j in range(len(self.mat[i])):
pnt = Pnt(i,j)
rect = Rect(pnt,1,1)
rectDic = rect.rect2dict()
rectDic['line']['color'] = line_color
rectDic['line']['width'] = 0.5
if int(proLevLst[ind]) == 0:
rectDic['fillcolor'] = 'black'
else:
rectDic['fillcolor'] = bupuNum[int((proLevLst[ind] - 1) *bupuUnit)]
rectDic['opacity'] = 0.7
ind += 1
self.shapeLst.append(copy.deepcopy(rectDic))
def addRobotStartPnt(self,lst= []):
for i in range(len(lst[0])):
lst[0][i] = lst[0][i] + 0.5
lst[1][i] = lst[1][i] + 0.5
startTrace = go.Scatter(x =[lst[0][i]], y = [lst[1][i]],mode ='markers',marker = dict(symbol = 'cross-dot',size = 20),
name =
# 'start')
'Robot_'+ str(i+1))
self.drawData.append(startTrace)
def drawPic(self,name ='env',fileType = True):
layout = dict()
layout['shapes'] = self.shapeLst
layout['xaxis'] = {'range':[0,len(self.mat[0])]}
layout['yaxis'] = {'range':[0,len(self.mat)]}
layout['xaxis'] = dict(
autorange=True,
showgrid=False,
zeroline=False,
showline=False,
autotick=True,
ticks='',
showticklabels = False)
layout['yaxis'] = dict(
scaleanchor = "x",
autorange=True,
showgrid=False,
zeroline=False,
showline=False,
autotick=True,
ticks='',
showticklabels = False)
layout['font'] = dict(
family='sans-serif',
size=25,
color='#000'
)
layout['legend'] = dict(font=dict(
family='sans-serif',
size=25,
color='#000'
))
layout['autosize'] = False
layout['height'] = 1000
layout['width']= 1000
layout['annotations'] = self.annotations
# print(layout)
fig = dict(data = self.drawData ,layout = layout)
if(fileType):
plotly.offline.plot(fig,filename = name + '.html',validate=False)
else:
py.image.save_as(fig,filename = name+'.jpeg')
def drawIns(cfgFileName = '5_20_20_80_Outdoor_Cfg.txt',drawType = 1,
fileName = 'nothing',
fileType = False ):
py.sign_in('tesla_fox', 'HOTRQ3nIOdYUUszDIfgN')
# conFileDir = './/data//'
# degNameCfg = conFileDir + cfgFileName
readCfg = rd.Read_Cfg(cfgFileName)
data = []
readCfg.get('row',data)
row = int(data.pop())
readCfg.get('col',data)
col = int(data.pop())
mat = np.zeros((row,col))
obRowLst = []
obColLst = []
readCfg.get('obRow',obRowLst)
readCfg.get('obCol',obColLst)
for i in range(len(obRowLst)):
obRow = int(obRowLst[i])
obCol = int(obColLst[i])
mat[obRow][obCol] = 1
robRowLst = []
robColLst = []
readCfg.get('robRow',robRowLst)
readCfg.get('robCol',robColLst)
proLevLst = []
readCfg.get('proLevGrid',proLevLst)
env = Env(mat)
env.proLevNum = int(readCfg.getSingleVal('proLevNum'))
# proMat = np.zeros((row,col),dtype = int)
#case 1 draw Environment
if(drawType == 1):
# env.addgrid()
env.addProGrid(proLevLst = proLevLst)
robLst = []
robLst.append(robRowLst)
robLst.append(robColLst)
env.addRobotStartPnt(robLst)
cfgFileName = cfgFileName.split('data//')[1]
cfgFileName = cfgFileName.split('.dat')[0]
env.drawPic('./png/env_'+cfgFileName,fileType)
#case 2 draw Environment with edges
if __name__ == '__main__':
drawIns( cfgFileName = './/data//1_20_20_50_Cfg.dat',fileType = True)
pass
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
20399,
373,
2598,
8378,
29871,
29896,
29896,
29871,
29906,
29896,
29901,
29946,
29941,
29901,
29896,
29946,
29871,
29906,
29900,
29896,
29947,
13,
13,
29992,
8921,
29901,
19964,
13,
15945,
29908,
13,
13,
5215,
6492,
368,
29889,
5317,
368,
408,
11451,
13,
5215,
6492,
368,
29889,
4262,
29918,
711,
1315,
408,
748,
13,
5215,
6492,
368,
13,
5215,
4036,
13,
5215,
12655,
408,
7442,
13,
5215,
3509,
408,
21447,
13,
5215,
3509,
13,
5215,
1303,
29907,
16434,
29889,
949,
29918,
16859,
408,
364,
29881,
13,
3166,
5641,
1656,
29889,
4990,
1053,
4544,
29892,
4990,
29871,
13,
5215,
2927,
417,
369,
408,
1067,
13,
5215,
5844,
13,
29937,
5215,
1303,
29918,
16859,
29871,
13,
13,
13,
1990,
349,
593,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
29916,
29922,
29900,
29892,
29891,
29922,
29900,
1125,
13,
4706,
1583,
29889,
29916,
353,
921,
13,
4706,
1583,
29889,
29891,
353,
343,
13,
1678,
822,
282,
593,
29906,
8977,
29898,
1311,
1125,
13,
4706,
12124,
353,
9657,
29898,
29916,
353,
921,
29892,
29891,
29922,
343,
29897,
13,
4706,
736,
12124,
13,
1678,
822,
2479,
29898,
1311,
1125,
13,
4706,
1596,
877,
29916,
353,
13420,
1311,
29889,
29916,
5501,
29891,
353,
13420,
1311,
29889,
29891,
29897,
13,
13,
1990,
27927,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
29886,
593,
353,
349,
593,
3285,
3665,
353,
29871,
29900,
1125,
13,
4706,
1583,
29889,
29916,
353,
282,
593,
29889,
29916,
13,
4706,
1583,
29889,
29891,
353,
282,
593,
29889,
29891,
13,
4706,
1583,
29889,
3665,
353,
2971,
13,
4706,
1583,
29889,
29916,
29900,
353,
1583,
29889,
29916,
29871,
448,
1583,
29889,
3665,
13,
4706,
1583,
29889,
29891,
29900,
353,
1583,
29889,
29891,
29871,
448,
1583,
29889,
3665,
13,
4706,
1583,
29889,
29916,
29896,
353,
1583,
29889,
29916,
29871,
718,
1583,
29889,
3665,
13,
4706,
1583,
29889,
29891,
29896,
353,
1583,
29889,
29891,
29871,
718,
1583,
29889,
3665,
13,
1678,
822,
8607,
29906,
8977,
29898,
1311,
1125,
13,
4706,
12124,
353,
9657,
580,
13,
4706,
12124,
1839,
1853,
2033,
353,
525,
16622,
29915,
13,
4706,
12124,
1839,
29916,
999,
2033,
353,
525,
29916,
29915,
13,
4706,
12124,
1839,
29891,
999,
2033,
353,
525,
29891,
29915,
13,
4706,
12124,
1839,
29916,
29900,
2033,
353,
1583,
29889,
29916,
29900,
13,
4706,
12124,
1839,
29891,
29900,
2033,
353,
1583,
29889,
29891,
29900,
13,
4706,
12124,
1839,
29916,
29896,
2033,
353,
1583,
29889,
29916,
29896,
13,
4706,
12124,
1839,
29891,
29896,
2033,
353,
1583,
29889,
29891,
29896,
308,
13,
4706,
12124,
1839,
1220,
2033,
353,
9657,
29898,
2780,
353,
525,
11007,
2291,
29898,
29945,
29900,
29892,
29871,
29896,
29955,
29896,
29892,
29871,
29929,
29953,
29892,
29871,
29896,
29897,
1495,
13,
4706,
736,
12124,
13,
1990,
7407,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
29886,
593,
29900,
353,
29925,
593,
3285,
29886,
593,
29896,
29922,
29925,
593,
580,
1125,
13,
4706,
1583,
29889,
29916,
29900,
353,
282,
593,
29900,
29889,
29916,
13,
4706,
1583,
29889,
29891,
29900,
353,
282,
593,
29900,
29889,
29891,
13,
4706,
1583,
29889,
29916,
29896,
353,
282,
593,
29896,
29889,
29916,
13,
4706,
1583,
29889,
29891,
29896,
353,
282,
593,
29896,
29889,
29891,
13,
1678,
822,
1196,
29906,
8977,
29898,
1311,
1125,
13,
4706,
12124,
29922,
9657,
580,
13,
4706,
12124,
1839,
1853,
2033,
2433,
1220,
29915,
13,
4706,
12124,
1839,
29916,
29900,
2033,
353,
1311,
29889,
29916,
29900,
13,
4706,
12124,
1839,
29891,
29900,
2033,
353,
1311,
29889,
29891,
29900,
13,
4706,
12124,
1839,
29916,
29896,
2033,
353,
1311,
29889,
29916,
29896,
13,
4706,
12124,
1839,
29891,
29896,
2033,
353,
1311,
29889,
29891,
29896,
13,
4706,
12124,
1839,
1220,
2033,
353,
9657,
29898,
2780,
353,
525,
23973,
29898,
29896,
29906,
29947,
29892,
29871,
29900,
29892,
29871,
29896,
29906,
29947,
29897,
1495,
13,
4706,
736,
12124,
13,
1990,
22914,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
29886,
593,
353,
29925,
593,
3285,
2103,
353,
29900,
29892,
3545,
353,
29900,
1125,
13,
4706,
1583,
29889,
29916,
29900,
353,
282,
593,
29889,
29916,
13,
4706,
1583,
29889,
29891,
29900,
353,
282,
593,
29889,
29891,
13,
4706,
1583,
29889,
29916,
29896,
353,
1583,
29889,
29916,
29900,
718,
2920,
13,
4706,
1583,
29889,
29891,
29896,
353,
1583,
29889,
29891,
29900,
718,
3171,
13,
1678,
822,
7705,
29906,
8977,
29898,
1311,
1125,
13,
4706,
12124,
353,
9657,
580,
13,
4706,
12124,
1839,
1853,
2033,
2433,
1621,
29915,
13,
4706,
12124,
1839,
29916,
29900,
2033,
353,
1583,
29889,
29916,
29900,
13,
4706,
12124,
1839,
29891,
29900,
2033,
353,
1583,
29889,
29891,
29900,
13,
4706,
12124,
1839,
29916,
29896,
2033,
353,
1583,
29889,
29916,
29896,
13,
4706,
12124,
1839,
29891,
29896,
2033,
353,
1583,
29889,
29891,
29896,
13,
4706,
12124,
1839,
1220,
2033,
353,
9657,
29898,
2780,
353,
525,
23973,
29898,
29896,
29906,
29947,
29892,
29871,
29900,
29892,
29871,
29896,
29906,
29947,
29897,
1495,
13,
4706,
736,
12124,
13,
13,
1753,
679,
10108,
3306,
29898,
5563,
1125,
13,
1678,
851,
2780,
353,
525,
11007,
2291,
877,
13,
1678,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
4706,
851,
2780,
353,
851,
2780,
718,
851,
29898,
5563,
29930,
29945,
29900,
7240,
3788,
13,
1678,
851,
2780,
353,
851,
2780,
718,
851,
29898,
29896,
29914,
5563,
29897,
718,
1495,
29915,
13,
1678,
736,
851,
2780,
268,
13,
13,
2780,
29931,
303,
353,
6024,
10921,
3788,
8517,
2033,
13,
13,
1990,
1174,
29894,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1775,
353,
7442,
29889,
3298,
359,
3552,
29906,
29892,
29906,
876,
1125,
13,
4706,
1583,
29889,
2922,
353,
1775,
13,
4706,
1583,
29889,
12181,
29931,
303,
353,
5159,
13,
4706,
1583,
29889,
4012,
1469,
353,
5159,
13,
4706,
1583,
29889,
6735,
800,
353,
5159,
13,
4706,
1583,
29889,
771,
3226,
29894,
8009,
353,
29871,
29900,
13,
1678,
822,
788,
7720,
29898,
1311,
1125,
308,
13,
4706,
330,
29918,
2780,
353,
525,
9539,
29915,
13,
4706,
1948,
353,
7431,
29898,
1311,
29889,
2922,
29897,
308,
13,
4706,
363,
474,
297,
3464,
29898,
798,
1125,
13,
9651,
363,
432,
297,
3464,
29898,
2435,
29898,
1311,
29889,
2922,
29961,
29875,
12622,
29901,
13,
18884,
282,
593,
353,
349,
593,
29898,
29875,
29892,
29926,
29897,
13,
18884,
7705,
353,
22914,
29898,
29886,
593,
29892,
29896,
29892,
29896,
29897,
13,
18884,
7705,
29928,
293,
353,
7705,
29889,
1621,
29906,
8977,
580,
13,
18884,
7705,
29928,
293,
1839,
1220,
16215,
2780,
2033,
353,
330,
29918,
2780,
13,
18884,
7705,
29928,
293,
1839,
1220,
16215,
2103,
2033,
353,
29871,
29900,
29889,
29945,
13,
29937,
18884,
7705,
29928,
293,
1839,
28193,
2033,
353,
259,
29896,
14571,
524,
29898,
1311,
29889,
2922,
29961,
29875,
3816,
29926,
2314,
29974,
29896,
29897,
462,
13,
29937,
18884,
7705,
29928,
293,
1839,
5589,
2780,
2033,
353,
2927,
29931,
303,
29961,
524,
29898,
1311,
29889,
2922,
29961,
29875,
3816,
29926,
2314,
29962,
13,
18884,
565,
29898,
524,
29898,
1311,
29889,
2922,
29961,
29875,
3816,
29926,
2314,
1360,
29896,
1125,
13,
462,
1678,
7705,
29928,
293,
1839,
5589,
2780,
2033,
353,
525,
8517,
29915,
462,
13,
29937,
18884,
565,
29898,
524,
29898,
1311,
29889,
2922,
29961,
29875,
3816,
29926,
2314,
1360,
29900,
1125,
13,
29937,
462,
1678,
7705,
29928,
293,
1839,
5589,
2780,
2033,
353,
2927,
29931,
303,
29961,
524,
29898,
1311,
29889,
2922,
29961,
29875,
3816,
29926,
2314,
29962,
13,
29937,
18884,
679,
10108,
3306,
29898,
2922,
29961,
29875,
3816,
29926,
2314,
13,
18884,
1583,
29889,
12181,
29931,
303,
29889,
4397,
29898,
8552,
29889,
24535,
8552,
29898,
1621,
29928,
293,
876,
13,
4706,
1596,
29898,
2435,
29898,
1311,
29889,
12181,
29931,
303,
876,
13,
1678,
822,
788,
1184,
5756,
29898,
1311,
29892,
771,
3226,
29894,
29931,
303,
353,
5159,
1125,
13,
4706,
1196,
29918,
2780,
353,
525,
1127,
29915,
13,
4706,
1399,
353,
29871,
29900,
29871,
13,
4706,
1948,
353,
7431,
29898,
1311,
29889,
2922,
29897,
308,
13,
4706,
289,
786,
29884,
353,
1067,
29889,
19529,
267,
1839,
29929,
16215,
11762,
16215,
29979,
29880,
29954,
29876,
3727,
2033,
308,
13,
4706,
289,
786,
29884,
8009,
353,
1067,
29889,
1639,
29886,
29898,
29890,
786,
29884,
29892,
29945,
29900,
29900,
29897,
13,
4706,
289,
786,
29884,
8325,
29871,
353,
5844,
29889,
14939,
29898,
29945,
29900,
29900,
29914,
29946,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
798,
1125,
13,
9651,
363,
432,
297,
3464,
29898,
2435,
29898,
1311,
29889,
2922,
29961,
29875,
12622,
29901,
13,
18884,
282,
593,
353,
349,
593,
29898,
29875,
29892,
29926,
29897,
13,
18884,
7705,
353,
22914,
29898,
29886,
593,
29892,
29896,
29892,
29896,
29897,
13,
18884,
7705,
29928,
293,
353,
7705,
29889,
1621,
29906,
8977,
580,
13,
18884,
7705,
29928,
293,
1839,
1220,
16215,
2780,
2033,
353,
1196,
29918,
2780,
13,
18884,
7705,
29928,
293,
1839,
1220,
16215,
2103,
2033,
353,
29871,
29900,
29889,
29945,
13,
18884,
565,
938,
29898,
771,
3226,
29894,
29931,
303,
29961,
513,
2314,
1275,
29871,
29900,
29901,
13,
462,
1678,
7705,
29928,
293,
1839,
5589,
2780,
2033,
353,
525,
8517,
29915,
13,
18884,
1683,
29901,
13,
462,
1678,
7705,
29928,
293,
1839,
5589,
2780,
2033,
353,
289,
786,
29884,
8009,
29961,
524,
3552,
771,
3226,
29894,
29931,
303,
29961,
513,
29962,
448,
29871,
29896,
29897,
334,
29890,
786,
29884,
8325,
4638,
13,
462,
1678,
7705,
29928,
293,
1839,
28193,
2033,
353,
259,
29900,
29889,
29955,
13,
18884,
1399,
29871,
4619,
29871,
29896,
13,
18884,
1583,
29889,
12181,
29931,
303,
29889,
4397,
29898,
8552,
29889,
24535,
8552,
29898,
1621,
29928,
293,
876,
13,
1678,
822,
788,
21860,
327,
4763,
29925,
593,
29898,
1311,
29892,
20155,
29922,
5159,
1125,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
20155,
29961,
29900,
12622,
29901,
13,
9651,
24471,
29961,
29900,
3816,
29875,
29962,
353,
24471,
29961,
29900,
3816,
29875,
29962,
718,
29871,
29900,
29889,
29945,
13,
9651,
24471,
29961,
29896,
3816,
29875,
29962,
353,
24471,
29961,
29896,
3816,
29875,
29962,
718,
29871,
29900,
29889,
29945,
13,
9651,
1369,
11591,
353,
748,
29889,
4421,
2620,
29898,
29916,
353,
29961,
20155,
29961,
29900,
3816,
29875,
20526,
343,
353,
518,
20155,
29961,
29896,
3816,
29875,
20526,
8513,
353,
29915,
3502,
414,
742,
22976,
353,
9657,
29898,
18098,
353,
525,
19128,
29899,
6333,
742,
2311,
353,
29871,
29906,
29900,
511,
13,
462,
462,
1678,
1024,
353,
29871,
13,
29937,
462,
462,
1678,
525,
2962,
1495,
13,
462,
462,
1678,
525,
21860,
327,
29918,
18717,
851,
29898,
29875,
29974,
29896,
876,
13,
9651,
1583,
29889,
4012,
1469,
29889,
4397,
29898,
2962,
11591,
29897,
13,
462,
13,
1678,
822,
4216,
29925,
293,
29898,
1311,
29892,
978,
353,
29915,
6272,
742,
1445,
1542,
353,
5852,
1125,
13,
4706,
5912,
353,
9657,
580,
13,
4706,
5912,
1839,
845,
11603,
2033,
353,
1583,
29889,
12181,
29931,
303,
13,
4706,
5912,
1839,
29916,
8990,
2033,
353,
11117,
3881,
2396,
29961,
29900,
29892,
2435,
29898,
1311,
29889,
2922,
29961,
29900,
2314,
12258,
13,
4706,
5912,
1839,
29891,
8990,
2033,
353,
11117,
3881,
2396,
29961,
29900,
29892,
2435,
29898,
1311,
29889,
2922,
4638,
29913,
13,
4706,
5912,
1839,
29916,
8990,
2033,
353,
9657,
29898,
13,
4706,
8478,
927,
29922,
5574,
29892,
13,
4706,
1510,
7720,
29922,
8824,
29892,
13,
4706,
503,
261,
26496,
29922,
8824,
29892,
13,
4706,
1510,
1220,
29922,
8824,
29892,
13,
4706,
1120,
327,
860,
29922,
5574,
29892,
13,
4706,
260,
7358,
2433,
742,
13,
4706,
1510,
24667,
21134,
353,
7700,
29897,
13,
4706,
5912,
1839,
29891,
8990,
2033,
353,
9657,
29898,
13,
4706,
6287,
25367,
353,
376,
29916,
613,
13,
4706,
8478,
927,
29922,
5574,
29892,
13,
4706,
1510,
7720,
29922,
8824,
29892,
13,
4706,
503,
261,
26496,
29922,
8824,
29892,
13,
4706,
1510,
1220,
29922,
8824,
29892,
13,
4706,
1120,
327,
860,
29922,
5574,
29892,
13,
4706,
260,
7358,
2433,
742,
13,
4706,
1510,
24667,
21134,
353,
7700,
29897,
13,
4706,
5912,
1839,
5657,
2033,
353,
9657,
29898,
13,
9651,
3942,
2433,
29879,
550,
29899,
643,
361,
742,
13,
9651,
2159,
29922,
29906,
29945,
29892,
13,
9651,
2927,
2433,
29937,
29900,
29900,
29900,
29915,
13,
4706,
1723,
13,
4706,
5912,
1839,
26172,
2033,
353,
259,
9657,
29898,
5657,
29922,
8977,
29898,
13,
9651,
3942,
2433,
29879,
550,
29899,
643,
361,
742,
13,
9651,
2159,
29922,
29906,
29945,
29892,
13,
9651,
2927,
2433,
29937,
29900,
29900,
29900,
29915,
13,
308,
876,
13,
4706,
5912,
1839,
1300,
359,
675,
2033,
353,
7700,
13,
4706,
5912,
1839,
3545,
2033,
353,
29871,
29896,
29900,
29900,
29900,
13,
4706,
5912,
1839,
2103,
2033,
29922,
29871,
29896,
29900,
29900,
29900,
13,
4706,
5912,
1839,
6735,
800,
2033,
353,
1583,
29889,
6735,
800,
13,
29937,
4706,
1596,
29898,
2680,
29897,
13,
4706,
2537,
353,
9657,
29898,
1272,
353,
1583,
29889,
4012,
1469,
1919,
2680,
353,
5912,
29897,
13,
4706,
565,
29898,
1445,
1542,
1125,
13,
9651,
6492,
368,
29889,
2696,
1220,
29889,
5317,
29898,
1003,
29892,
9507,
353,
1024,
718,
15300,
1420,
742,
15480,
29922,
8824,
29897,
13,
4706,
1683,
29901,
13,
9651,
11451,
29889,
3027,
29889,
7620,
29918,
294,
29898,
1003,
29892,
9507,
353,
1024,
29974,
4286,
26568,
1495,
13,
268,
13,
308,
13,
1753,
4216,
797,
29879,
29898,
16859,
17020,
353,
525,
29945,
29918,
29906,
29900,
29918,
29906,
29900,
29918,
29947,
29900,
29918,
3744,
17433,
29918,
29907,
16434,
29889,
3945,
742,
4012,
1542,
353,
29871,
29896,
29892,
13,
9651,
29729,
353,
525,
28450,
742,
13,
9651,
934,
1542,
353,
7700,
29871,
1125,
13,
1678,
11451,
29889,
4530,
29918,
262,
877,
2167,
433,
29918,
8944,
742,
525,
29950,
2891,
29934,
29984,
29941,
29876,
5971,
29881,
29979,
29965,
29965,
3616,
29928,
3644,
29887,
29940,
1495,
13,
29937,
1678,
378,
2283,
9170,
353,
15300,
458,
1272,
458,
29915,
13,
29937,
1678,
3587,
1170,
29907,
16434,
353,
378,
2283,
9170,
718,
274,
16434,
17020,
13,
308,
13,
1678,
1303,
29907,
16434,
353,
364,
29881,
29889,
6359,
29918,
29907,
16434,
29898,
16859,
17020,
29897,
13,
268,
13,
1678,
848,
353,
5159,
13,
1678,
1303,
29907,
16434,
29889,
657,
877,
798,
742,
1272,
29897,
13,
1678,
1948,
353,
938,
29898,
1272,
29889,
7323,
3101,
13,
13,
1678,
1303,
29907,
16434,
29889,
657,
877,
1054,
742,
1272,
29897,
13,
1678,
784,
353,
938,
29898,
1272,
29889,
7323,
3101,
13,
308,
13,
1678,
1775,
353,
7442,
29889,
3298,
359,
3552,
798,
29892,
1054,
876,
13,
268,
13,
1678,
704,
4301,
29931,
303,
353,
5159,
13,
1678,
704,
1625,
29931,
303,
353,
5159,
13,
1678,
1303,
29907,
16434,
29889,
657,
877,
711,
4301,
742,
711,
4301,
29931,
303,
29897,
13,
1678,
1303,
29907,
16434,
29889,
657,
877,
711,
1625,
742,
711,
1625,
29931,
303,
29897,
13,
268,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
711,
4301,
29931,
303,
22164,
13,
4706,
704,
4301,
353,
938,
29898,
711,
4301,
29931,
303,
29961,
29875,
2314,
13,
4706,
704,
1625,
353,
938,
29898,
711,
1625,
29931,
303,
29961,
29875,
2314,
13,
4706,
1775,
29961,
711,
4301,
3816,
711,
1625,
29962,
353,
29871,
29896,
29871,
13,
13,
13,
1678,
10832,
4301,
29931,
303,
353,
5159,
13,
1678,
10832,
1625,
29931,
303,
353,
5159,
13,
1678,
1303,
29907,
16434,
29889,
657,
877,
13716,
4301,
742,
13716,
4301,
29931,
303,
29897,
13,
1678,
1303,
29907,
16434,
29889,
657,
877,
13716,
1625,
742,
13716,
1625,
29931,
303,
29897,
13,
268,
13,
1678,
410,
3226,
29894,
29931,
303,
353,
5159,
13,
1678,
1303,
29907,
16434,
29889,
657,
877,
771,
3226,
29894,
5756,
742,
771,
3226,
29894,
29931,
303,
29897,
13,
1678,
8829,
353,
1174,
29894,
29898,
2922,
29897,
13,
13,
1678,
8829,
29889,
771,
3226,
29894,
8009,
353,
938,
29898,
949,
29907,
16434,
29889,
657,
15771,
1440,
877,
771,
3226,
29894,
8009,
8785,
13,
29937,
1678,
410,
9782,
29871,
353,
7442,
29889,
3298,
359,
3552,
798,
29892,
1054,
511,
29881,
1853,
353,
938,
29897,
13,
268,
13,
308,
13,
1678,
396,
4878,
29871,
29896,
4216,
16738,
13,
1678,
565,
29898,
4012,
1542,
1275,
29871,
29896,
1125,
13,
29937,
4706,
8829,
29889,
1202,
7720,
580,
13,
4706,
8829,
29889,
1202,
1184,
5756,
29898,
771,
3226,
29894,
29931,
303,
353,
410,
3226,
29894,
29931,
303,
29897,
13,
4706,
10832,
29931,
303,
353,
5159,
13,
4706,
10832,
29931,
303,
29889,
4397,
29898,
13716,
4301,
29931,
303,
29897,
13,
4706,
10832,
29931,
303,
29889,
4397,
29898,
13716,
1625,
29931,
303,
29897,
13,
4706,
8829,
29889,
1202,
21860,
327,
4763,
29925,
593,
29898,
13716,
29931,
303,
29897,
13,
4706,
274,
16434,
17020,
29871,
353,
274,
16434,
17020,
29889,
5451,
877,
1272,
458,
29861,
29896,
29962,
13,
4706,
274,
16434,
17020,
29871,
353,
274,
16434,
17020,
29889,
5451,
12839,
4130,
29861,
29900,
29962,
13,
4706,
8829,
29889,
4012,
29925,
293,
877,
6904,
2732,
29914,
6272,
29918,
18717,
16859,
17020,
29892,
1445,
1542,
29897,
13,
268,
13,
1678,
396,
4878,
29871,
29906,
4216,
16738,
411,
12770,
308,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4216,
797,
29879,
29898,
274,
16434,
17020,
353,
15300,
458,
1272,
458,
29896,
29918,
29906,
29900,
29918,
29906,
29900,
29918,
29945,
29900,
29918,
29907,
16434,
29889,
4130,
742,
1445,
1542,
353,
5852,
29897,
13,
1678,
1209,
13,
2
] |
docs/getFields.py | bhavin-vadgama/bibtex | 4 | 1617849 | <reponame>bhavin-vadgama/bibtex
"""
{
"created_on": "16 Sep 2018, Sun",
"scrap_url": "http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#article"
}
"""
import json
import requests
from bs4 import BeautifulSoup
def get_fields(s):
fields = s.strip().strip('.') # "Required fields: author, title, note"
fields = fields.split(':')[1]
fields = fields.strip().strip('.')
fields = [entry_type.strip() for entry_type in fields.split(',')]
return fields
def main():
url = "http://bib-it.sourceforge.net/help/fieldsAndEntryTypes.php#article"
res = requests.get(url)
print(res.status_code)
text = res.text
soup = BeautifulSoup(text, "html.parser")
tables = soup.find_all('table')
table2 = tables[2]
# print(len(tables))
# print(tables)
table2_contents = table2.contents
table2_contents = table2_contents[1:len(table2_contents)-1] # Remove '\n', ' ' from front and end respectively.
# print(table2_contents)
fields = {}
for table2_content in table2_contents:
tr_contents = table2_content.contents;
# [<td><a name="year"></a>
# <a href="#TOP" title="up">year</a></td>, <td> <p class="def">The year of publication or, for an unpublished work, the year it was written. </p><p class="desc">Generally, it should consist of four numerals, such as 1984, although the standard styles can handle any year whose last four nonpunctuation characters are numerals, such as "about 1984".</p>
# </td>]
# print(tr_contents);
# print(type(tr_contents[0])) # <class 'bs4.element.Tag'>
field = tr_contents[0].text; # tr_contents[0].string => None
print(field);
td_contents = tr_contents[1].contents; # All p elements
print(td_contents)
my_note = td_contents[2].string;
if not my_note:
note = ''
else:
note = my_note;
print("...", td_contents)
my_description = td_contents[1].string
if not my_description:
description = '';
else:
description = my_description;
fields[field.strip()] = {
"description": description.strip(),
"note": note.strip(),
};
print(json.dumps(fields, indent=4))
# START
main()
"""
{
"address": {
"description": "",
"note": ""
},
"annote": {
"description": "",
"note": ""
}
}
"""
| [
1,
529,
276,
1112,
420,
29958,
29890,
8708,
262,
29899,
29894,
328,
29887,
3304,
29914,
18508,
4776,
13,
15945,
29908,
13,
29912,
13,
12,
29908,
11600,
29918,
265,
1115,
376,
29896,
29953,
29639,
29871,
29906,
29900,
29896,
29947,
29892,
8991,
613,
13,
12,
29908,
1557,
2390,
29918,
2271,
1115,
376,
1124,
597,
18508,
29899,
277,
29889,
28315,
29889,
1212,
29914,
8477,
29914,
9621,
2855,
9634,
10562,
29889,
1961,
29937,
7914,
29908,
13,
29913,
13,
15945,
29908,
13,
13,
5215,
4390,
13,
5215,
7274,
13,
3166,
24512,
29946,
1053,
25685,
29903,
1132,
13,
13,
1753,
679,
29918,
9621,
29898,
29879,
1125,
13,
12,
9621,
353,
269,
29889,
17010,
2141,
17010,
12839,
1495,
396,
376,
19347,
4235,
29901,
4148,
29892,
3611,
29892,
4443,
29908,
13,
12,
9621,
353,
4235,
29889,
5451,
877,
29901,
29861,
29896,
29962,
13,
12,
9621,
353,
4235,
29889,
17010,
2141,
17010,
12839,
1495,
13,
12,
9621,
353,
518,
8269,
29918,
1853,
29889,
17010,
580,
363,
6251,
29918,
1853,
297,
4235,
29889,
5451,
29317,
1495,
29962,
13,
13,
12,
2457,
4235,
13,
13,
1753,
1667,
7295,
13,
1678,
3142,
353,
376,
1124,
597,
18508,
29899,
277,
29889,
28315,
29889,
1212,
29914,
8477,
29914,
9621,
2855,
9634,
10562,
29889,
1961,
29937,
7914,
29908,
13,
1678,
620,
353,
7274,
29889,
657,
29898,
2271,
29897,
13,
13,
1678,
1596,
29898,
690,
29889,
4882,
29918,
401,
29897,
13,
1678,
1426,
353,
620,
29889,
726,
13,
13,
1678,
22300,
353,
25685,
29903,
1132,
29898,
726,
29892,
376,
1420,
29889,
16680,
1159,
13,
1678,
6131,
353,
22300,
29889,
2886,
29918,
497,
877,
2371,
1495,
13,
1678,
1591,
29906,
353,
6131,
29961,
29906,
29962,
13,
13,
1678,
396,
1596,
29898,
2435,
29898,
24051,
876,
13,
13,
1678,
396,
1596,
29898,
24051,
29897,
13,
1678,
1591,
29906,
29918,
10853,
353,
1591,
29906,
29889,
10853,
13,
1678,
1591,
29906,
29918,
10853,
353,
1591,
29906,
29918,
10853,
29961,
29896,
29901,
2435,
29898,
2371,
29906,
29918,
10853,
6817,
29896,
29962,
396,
15154,
11297,
29876,
742,
525,
525,
515,
4565,
322,
1095,
8307,
29889,
13,
13,
1678,
396,
1596,
29898,
2371,
29906,
29918,
10853,
29897,
13,
1678,
4235,
353,
6571,
13,
1678,
363,
1591,
29906,
29918,
3051,
297,
1591,
29906,
29918,
10853,
29901,
13,
4706,
534,
29918,
10853,
353,
1591,
29906,
29918,
3051,
29889,
10853,
29936,
13,
4706,
396,
518,
29966,
1594,
5299,
29874,
1024,
543,
6360,
5319,
29874,
29958,
13,
4706,
396,
529,
29874,
2822,
9880,
29911,
4590,
29908,
3611,
543,
786,
1013,
6360,
829,
29874,
2565,
1594,
10202,
529,
1594,
29958,
529,
29886,
770,
543,
1753,
1013,
1576,
1629,
310,
17745,
470,
29892,
363,
385,
443,
5467,
3726,
664,
29892,
278,
1629,
372,
471,
3971,
29889,
1533,
29886,
5299,
29886,
770,
543,
14273,
1013,
5631,
635,
29892,
372,
881,
5718,
310,
3023,
4825,
1338,
29892,
1316,
408,
29871,
29896,
29929,
29947,
29946,
29892,
5998,
278,
3918,
11949,
508,
4386,
738,
1629,
5069,
1833,
3023,
1661,
29886,
18049,
29884,
362,
4890,
526,
4825,
1338,
29892,
1316,
408,
376,
12717,
29871,
29896,
29929,
29947,
29946,
1642,
829,
29886,
29958,
13,
4706,
396,
1533,
1594,
29958,
29962,
13,
13,
4706,
396,
1596,
29898,
509,
29918,
10853,
416,
13,
4706,
396,
1596,
29898,
1853,
29898,
509,
29918,
10853,
29961,
29900,
12622,
396,
529,
1990,
525,
5824,
29946,
29889,
5029,
29889,
8176,
11041,
13,
4706,
1746,
353,
534,
29918,
10853,
29961,
29900,
1822,
726,
29936,
396,
29871,
534,
29918,
10853,
29961,
29900,
1822,
1807,
1149,
6213,
13,
4706,
1596,
29898,
2671,
416,
13,
13,
4706,
22599,
29918,
10853,
353,
534,
29918,
10853,
29961,
29896,
1822,
10853,
29936,
396,
2178,
282,
3161,
13,
4706,
1596,
29898,
1594,
29918,
10853,
29897,
13,
13,
4706,
590,
29918,
6812,
353,
22599,
29918,
10853,
29961,
29906,
1822,
1807,
29936,
13,
4706,
565,
451,
590,
29918,
6812,
29901,
13,
9651,
4443,
353,
6629,
13,
4706,
1683,
29901,
13,
9651,
4443,
353,
590,
29918,
6812,
29936,
13,
13,
4706,
1596,
703,
856,
613,
22599,
29918,
10853,
29897,
13,
13,
4706,
590,
29918,
8216,
353,
22599,
29918,
10853,
29961,
29896,
1822,
1807,
13,
13,
4706,
565,
451,
590,
29918,
8216,
29901,
13,
9651,
6139,
353,
18231,
13,
4706,
1683,
29901,
13,
9651,
6139,
353,
590,
29918,
8216,
29936,
13,
13,
4706,
4235,
29961,
2671,
29889,
17010,
580,
29962,
353,
426,
13,
9651,
376,
8216,
1115,
6139,
29889,
17010,
3285,
13,
9651,
376,
6812,
1115,
4443,
29889,
17010,
3285,
13,
4706,
3980,
13,
13,
1678,
1596,
29898,
3126,
29889,
29881,
17204,
29898,
9621,
29892,
29536,
29922,
29946,
876,
13,
13,
29937,
6850,
8322,
13,
3396,
580,
13,
13,
13,
15945,
29908,
13,
1678,
426,
13,
4706,
376,
7328,
1115,
426,
13,
9651,
376,
8216,
1115,
12633,
13,
9651,
376,
6812,
1115,
5124,
13,
4706,
2981,
13,
4706,
376,
812,
866,
1115,
426,
13,
9651,
376,
8216,
1115,
12633,
13,
9651,
376,
6812,
1115,
5124,
13,
4706,
500,
13,
1678,
500,
13,
15945,
29908,
13,
2
] |
lorasim/loraDirP3.py | LoRa-mesh-TEAM-SODAQ/LoRaMeshSIM | 0 | 137923 | <reponame>LoRa-mesh-TEAM-SODAQ/LoRaMeshSIM<filename>lorasim/loraDirP3.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
LoRaSim 0.2.1: simulate collisions in LoRa
Copyright © 2016 <NAME> <<EMAIL>> and <NAME> <<EMAIL>>
This work is licensed under the Creative Commons Attribution 4.0
International License. To view a copy of this license,
visit http://creativecommons.org/licenses/by/4.0/.
Do LoRa Low-Power Wide-Area Networks Scale? <NAME>, <NAME>, <NAME>
and <NAME>, MSWiM '16, http://dx.doi.org/10.1145/2988287.2989163
$Date: 2017-05-12 19:16:16 +0100 (Fri, 12 May 2017) $
$Revision: 334 $
"""
"""
SYNOPSIS:
./loraDir.py <nodes> <avgsend> <experiment> <simtime> [collision]
DESCRIPTION:
nodes
number of nodes to simulate
avgsend
average sending interval in milliseconds
experiment
experiment is an integer that determines with what radio settings the
simulation is run. All nodes are configured with a fixed transmit power
and a single transmit frequency, unless stated otherwise.
0 use the settings with the the slowest datarate (SF12, BW125, CR4/8).
1 similair to experiment 0, but use a random choice of 3 transmit
frequencies.
2 use the settings with the fastest data rate (SF6, BW500, CR4/5).
3 optimise the setting per node based on the distance to the gateway.
4 use the settings as defined in LoRaWAN (SF12, BW125, CR4/5).
5 similair to experiment 3, but also optimises the transmit power.
simtime
total running time in milliseconds
collision
set to 1 to enable the full collision check, 0 to use a simplified check.
With the simplified check, two messages collide when they arrive at the
same time, on the same frequency and spreading factor. The full collision
check considers the 'capture effect', whereby a collision of one or the
OUTPUT
The result of every simulation run will be appended to a file named expX.dat,
whereby X is the experiment number. The file contains a space separated table
of values for nodes, collisions, transmissions and total energy spent. The
data file can be easily plotted using e.g. gnuplot.
"""
import simpy
import random
import numpy as np
import math
import sys
import matplotlib.pyplot as plt
import os
# turn on/off graphics
graphics = 1
# do the full collision check
full_collision = True
# experiments:
# 0: packet with longest airtime, aloha-style experiment
# 0: one with 3 frequencies, 1 with 1 frequency
# 2: with shortest packets, still aloha-style
# 3: with shortest possible packets depending on distance
# this is an array with measured values for sensitivity
# see paper, Table 3
sf7 = np.array([7,-126.5,-124.25,-120.75])
sf8 = np.array([8,-127.25,-126.75,-124.0])
sf9 = np.array([9,-131.25,-128.25,-127.5])
sf10 = np.array([10,-132.75,-130.25,-128.75])
sf11 = np.array([11,-134.5,-132.75,-128.75])
sf12 = np.array([12,-133.25,-132.25,-132.25])
#
# check for collisions at base station
# Note: called before a packet (or rather node) is inserted into the list
def checkcollision(packet):
col = 0 # flag needed since there might be several collisions for packet
processing = 0
for i in range(0,len(packetsAtBS)):
if packetsAtBS[i].packet.processed == 1:
processing = processing + 1
if (processing > maxBSReceives):
print("too long:", len(packetsAtBS))
packet.processed = 0
else:
packet.processed = 1
if packetsAtBS:
print("CHECK node {} (sf:{} bw:{} freq:{:.6e}) others: {}".format(
packet.nodeid, packet.sf, packet.bw, packet.freq,
len(packetsAtBS)))
for other in packetsAtBS:
if other.nodeid != packet.nodeid:
print(">> node {} (sf:{} bw:{} freq:{:.6e})".format(
other.nodeid, other.packet.sf, other.packet.bw, other.packet.freq))
# simple collision
if frequencyCollision(packet, other.packet) \
and sfCollision(packet, other.packet):
if full_collision:
if timingCollision(packet, other.packet):
# check who collides in the power domain
c = powerCollision(packet, other.packet)
# mark all the collided packets
# either this one, the other one, or both
for p in c:
p.collided = 1
if p == packet:
col = 1
else:
# no timing collision, all fine
pass
else:
packet.collided = 1
other.packet.collided = 1 # other also got lost, if it wasn't lost already
col = 1
return col
return 0
#
# frequencyCollision, conditions
#
# |f1-f2| <= 120 kHz if f1 or f2 has bw 500
# |f1-f2| <= 60 kHz if f1 or f2 has bw 250
# |f1-f2| <= 30 kHz if f1 or f2 has bw 125
def frequencyCollision(p1,p2):
if (abs(p1.freq-p2.freq)<=120 and (p1.bw==500 or p2.freq==500)):
print("frequency coll 500")
return True
elif (abs(p1.freq-p2.freq)<=60 and (p1.bw==250 or p2.freq==250)):
print("frequency coll 250")
return True
else:
if (abs(p1.freq-p2.freq)<=30):
print("frequency coll 125")
return True
#else:
print("no frequency coll")
return False
def sfCollision(p1, p2):
if p1.sf == p2.sf:
print("collision sf node {} and node {}".format(p1.nodeid, p2.nodeid))
# p2 may have been lost too, will be marked by other checks
return True
print("no sf collision")
return False
def powerCollision(p1, p2):
powerThreshold = 6 # dB
print("pwr: node {0.nodeid} {0.rssi:3.2f} dBm node {1.nodeid} {1.rssi:3.2f} dBm; diff {2:3.2f} dBm".format(p1, p2, round(p1.rssi - p2.rssi,2)))
if abs(p1.rssi - p2.rssi) < powerThreshold:
print("collision pwr both node {} and node {}".format(p1.nodeid, p2.nodeid))
# packets are too close to each other, both collide
# return both packets as casualties
return (p1, p2)
elif p1.rssi - p2.rssi < powerThreshold:
# p2 overpowered p1, return p1 as casualty
print("collision pwr node {} overpowered node {}".format(p2.nodeid, p1.nodeid))
return (p1,)
print("p1 wins, p2 lost")
# p2 was the weaker packet, return it as a casualty
return (p2,)
def timingCollision(p1, p2):
# assuming p1 is the freshly arrived packet and this is the last check
# we've already determined that p1 is a weak packet, so the only
# way we can win is by being late enough (only the first n - 5 preamble symbols overlap)
# assuming 8 preamble symbols
Npream = 8
# we can lose at most (Npream - 5) * Tsym of our preamble
Tpreamb = 2**p1.sf/(1.0*p1.bw) * (Npream - 5)
# check whether p2 ends in p1's critical section
p2_end = p2.addTime + p2.rectime
p1_cs = env.now + Tpreamb
print("collision timing node {} ({},{},{}) node {} ({},{})".format(
p1.nodeid, env.now - env.now, p1_cs - env.now, p1.rectime,
p2.nodeid, p2.addTime - env.now, p2_end - env.now
))
if p1_cs < p2_end:
# p1 collided with p2 and lost
print("not late enough")
return True
print("saved by the preamble")
return False
# this function computes the airtime of a packet
# according to LoraDesignGuide_STD.pdf
#
def airtime(sf,cr,pl,bw):
H = 0 # implicit header disabled (H=0) or not (H=1)
DE = 0 # low data rate optimization enabled (=1) or not (=0)
Npream = 8 # number of preamble symbol (12.25 from Utz paper)
if bw == 125 and sf in [11, 12]:
# low data rate optimization mandated for BW125 with SF11 and SF12
DE = 1
if sf == 6:
# can only have implicit header with SF6
H = 1
Tsym = (2.0**sf)/bw
Tpream = (Npream + 4.25)*Tsym
print("sf", sf, " cr", cr, "pl", pl, "bw", bw)
payloadSymbNB = 8 + max(math.ceil((8.0*pl-4.0*sf+28+16-20*H)/(4.0*(sf-2*DE)))*(cr+4),0)
Tpayload = payloadSymbNB * Tsym
return Tpream + Tpayload
#
# this function creates a node
#
class myNode():
def __init__(self, nodeid, bs, period, packetlen):
self.nodeid = nodeid
self.period = period
self.bs = bs
self.x = 0
self.y = 0
# this is very complex prodecure for placing nodes
# and ensure minimum distance between each pair of nodes
found = 0
rounds = 0
global nodes
#i = 150
"""
if len(nodes) > 0:
for index, n in enumerate(nodes):
self.x = 100 + i
self.y = 100 + i
i= i + 100
print("node x: ", self.x)
else:
print("first node")
self.x = 100
self.y = 100
found = 1
"""
while (found == 0 and rounds < 100):
a = random.random()
b = random.random()
if b<a:
a,b = b,a
posx = b*maxDist*math.cos(2*math.pi*a/b)+bsx
posy = b*maxDist*math.sin(2*math.pi*a/b)+bsy
if len(nodes) > 0:
for index, n in enumerate(nodes):
dist = np.sqrt(((abs(n.x-posx))**2)+((abs(n.y-posy))**2))
if dist >= 10:
found = 1
self.x = posx
self.y = posy
else:
rounds = rounds + 1
if rounds == 100:
print("could not place new node, giving up")
exit(-1)
else:
print("first node")
self.x = posx
self.y = posy
found = 1
self.dist = np.sqrt((self.x-bsx)*(self.x-bsx)+(self.y-bsy)*(self.y-bsy))
print(('node %d' %nodeid, "x", self.x, "y", self.y, "dist: ", self.dist))
self.packet = myPacket(self.nodeid, packetlen, self.dist)
self.sent = 0
# graphics for node
global graphics
if (graphics == 1):
global ax
ax.add_artist(plt.Circle((self.x, self.y), 2, fill=True, color='blue'))
#
# this function creates a packet (associated with a node)
# it also sets all parameters, currently random
#
class myPacket():
def __init__(self, nodeid, plen, distance):
global experiment
global Ptx
global gamma
global d0
global var
global Lpld0
global GL
self.nodeid = nodeid
self.txpow = Ptx
# randomize configuration values
self.sf = random.randint(6,12)
self.cr = random.randint(1,4)
self.bw = random.choice([125, 250, 500])
# for certain experiments override these
if experiment==1 or experiment == 0:
self.sf = 12
self.cr = 4
self.bw = 125
# for certain experiments override these
if experiment==2:
self.sf = 6
self.cr = 1
self.bw = 500
# lorawan
if experiment == 4:
self.sf = 12
self.cr = 1
self.bw = 125
# for experiment 3 find the best setting
# OBS, some hardcoded values
Prx = self.txpow ## zero path loss by default
# log-shadow
Lpl = Lpld0 + 10*gamma*math.log10(distance/d0)
print("Lpl:", Lpl)
Prx = self.txpow - GL - Lpl
if (experiment == 3) or (experiment == 5):
minairtime = 9999
minsf = 0
minbw = 0
print("Prx:", Prx)
for i in range(0,6):
for j in range(1,4):
if (sensi[i,j] < Prx):
self.sf = int(sensi[i,0])
if j==1:
self.bw = 125
elif j==2:
self.bw = 250
else:
self.bw=500
at = airtime(self.sf, 1, plen, self.bw)
if at < minairtime:
minairtime = at
minsf = self.sf
minbw = self.bw
minsensi = sensi[i, j]
if (minairtime == 9999):
print("does not reach base station")
exit(-1)
print("best sf:", minsf, " best bw: ", minbw, "best airtime:", minairtime)
self.rectime = minairtime
self.sf = minsf
self.bw = minbw
self.cr = 1
if experiment == 5:
# reduce the txpower if there's room left
self.txpow = max(2, self.txpow - math.floor(Prx - minsensi))
Prx = self.txpow - GL - Lpl
print('minsesi {} best txpow {}'.format(minsensi, self.txpow))
# transmission range, needs update XXX
self.transRange = 150
self.pl = plen
self.symTime = (2.0**self.sf)/self.bw
self.arriveTime = 0
self.rssi = Prx
# frequencies: lower bound + number of 61 Hz steps
self.freq = 860000000 + random.randint(0,2622950)
# for certain experiments override these and
# choose some random frequences
if experiment == 1:
self.freq = random.choice([860000000, 864000000, 868000000])
else:
self.freq = 860000000
print("frequency" ,self.freq, "symTime ", self.symTime)
print("bw", self.bw, "sf", self.sf, "cr", self.cr, "rssi", self.rssi)
self.rectime = airtime(self.sf,self.cr,self.pl,self.bw)
print("rectime node ", self.nodeid, " ", self.rectime)
# denote if packet is collided
self.collided = 0
self.processed = 0
#
# main discrete event loop, runs for each node
# a global list of packet being processed at the gateway
# is maintained
#
def transmit(env,node):
while True:
yield env.timeout(random.expovariate(1.0/float(node.period)))
# time sending and receiving
# packet arrives -> add to base station
node.sent = node.sent + 1
if (node in packetsAtBS):
print("ERROR: packet already in")
else:
sensitivity = sensi[node.packet.sf - 7, [125,250,500].index(node.packet.bw) + 1]
if node.packet.rssi < sensitivity:
print("node {}: packet will be lost".format(node.nodeid))
node.packet.lost = True
else:
node.packet.lost = False
# adding packet if no collision
if (checkcollision(node.packet)==1):
node.packet.collided = 1
else:
node.packet.collided = 0
packetsAtBS.append(node)
node.packet.addTime = env.now
yield env.timeout(node.packet.rectime)
if node.packet.lost:
global nrLost
nrLost += 1
if node.packet.collided == 1:
global nrCollisions
nrCollisions = nrCollisions +1
if node.packet.collided == 0 and not node.packet.lost:
global nrReceived
nrReceived = nrReceived + 1
if node.packet.processed == 1:
global nrProcessed
nrProcessed = nrProcessed + 1
# complete packet has been received by base station
# can remove it
if (node in packetsAtBS):
packetsAtBS.remove(node)
# reset the packet
node.packet.collided = 0
node.packet.processed = 0
node.packet.lost = False
#
# "main" program
#
# get arguments
if len(sys.argv) >= 5:
nrNodes = int(sys.argv[1])
avgSendTime = int(sys.argv[2])
experiment = int(sys.argv[3])
simtime = int(sys.argv[4])
if len(sys.argv) > 5:
full_collision = bool(int(sys.argv[5]))
print("Nodes:", nrNodes)
print("AvgSendTime (exp. distributed):",avgSendTime)
print("Experiment: ", experiment)
print("Simtime: ", simtime)
print("Full Collision: ", full_collision)
else:
print("usage: ./loraDir <nodes> <avgsend> <experiment> <simtime> [collision]")
print("experiment 0 and 1 use 1 frequency only")
exit(-1)
# global stuff
#Rnd = random.seed(12345)
nodes = []
packetsAtBS = []
env = simpy.Environment()
# maximum number of packets the BS can receive at the same time
maxBSReceives = 8
# max distance: 300m in city, 3000 m outside (5 km Utz experiment)
# also more unit-disc like according to Utz
bsId = 1
nrCollisions = 0
nrReceived = 0
nrProcessed = 0
nrLost = 0
Ptx = 14
gamma = 2.08
d0 = 40.0
var = 0 # variance ignored for now
Lpld0 = 127.41
GL = 0
sensi = np.array([sf7,sf8,sf9,sf10,sf11,sf12])
if experiment in [0,1,4]:
minsensi = sensi[5,2] # 5th row is SF12, 2nd column is BW125
elif experiment == 2:
minsensi = -112.0 # no experiments, so value from datasheet
elif experiment in [3,5]:
minsensi = np.amin(sensi) ## Experiment 3 can use any setting, so take minimum
Lpl = Ptx - minsensi
print("amin", minsensi, "Lpl", Lpl)
maxDist = d0*(math.e**((Lpl-Lpld0)/(10.0*gamma)))
print("maxDist:", maxDist)
# base station placement
bsx = maxDist+10
bsy = maxDist+10
xmax = bsx + maxDist + 20
ymax = bsy + maxDist + 20
# prepare graphics and add sink
if (graphics == 1):
plt.ion()
plt.figure()
ax = plt.gcf().gca()
# XXX should be base station position
ax.add_artist(plt.Circle((bsx, bsy), 3, fill=True, color='green'))
ax.add_artist(plt.Circle((bsx, bsy), maxDist, fill=False, color='green'))
for i in range(0,nrNodes):
# myNode takes period (in ms), base station id packetlen (in Bytes)
# 1000000 = 16 min
node = myNode(i,bsId, avgSendTime,20)
nodes.append(node)
env.process(transmit(env,node))
#prepare show
if (graphics == 1):
plt.xlim([0, xmax])
plt.ylim([0, ymax])
plt.draw()
plt.show()
# start simulation
env.run(until=simtime)
# print stats and save into file
print("nrCollisions ", nrCollisions)
# compute energy
# Transmit consumption in mA from -2 to +17 dBm
TX = [22, 22, 22, 23, # RFO/PA0: -2..1
24, 24, 24, 25, 25, 25, 25, 26, 31, 32, 34, 35, 44, # PA_BOOST/PA1: 2..14
82, 85, 90, # PA_BOOST/PA1: 15..17
105, 115, 125] # PA_BOOST/PA1+PA2: 18..20
# mA = 90 # current draw for TX = 17 dBm
V = 3.0 # voltage XXX
sent = sum(n.sent for n in nodes)
energy = sum(node.packet.rectime * TX[int(node.packet.txpow)+2] * V * node.sent for node in nodes) / 1e6
print("energy (in J): ", energy)
print("sent packets: ", sent)
print("collisions: ", nrCollisions)
print("received packets: ", nrReceived)
print("processed packets: ", nrProcessed)
print("lost packets: ", nrLost)
# data extraction rate
der = (sent-nrCollisions)/float(sent)
print("DER:", der)
der = (nrReceived)/float(sent)
print("DER method 2:", der)
# this can be done to keep graphics visible
#if (graphics == 1):
# input('Press Enter to continue ...')
# save experiment data into a dat file that can be read by e.g. gnuplot
# name of file would be: exp0.dat for experiment 0
fname = "exp" + str(experiment) + ".dat"
print(fname)
if os.path.isfile(fname):
res = "\n" + str(nrNodes) + " " + str(nrCollisions) + " " + str(sent) + " " + str(energy)
else:
res = "#nrNodes nrCollisions nrTransmissions OverallEnergy\n" + str(nrNodes) + " " + str(nrCollisions) + " " + str(sent) + " " + str(energy)
with open(fname, "a") as myfile:
myfile.write(res)
myfile.close()
# with open('nodes.txt','w') as nfile:
# for n in nodes:
# nfile.write("{} {} {}\n".format(n.x, n.y, n.nodeid))
# with open('basestation.txt', 'w') as bfile:
# bfile.write("{} {} {}\n".format(bsx, bsy, 0))
| [
1,
529,
276,
1112,
420,
29958,
3410,
29934,
29874,
29899,
4467,
29882,
29899,
4330,
5194,
29899,
6156,
7698,
29984,
29914,
3410,
29934,
29874,
29924,
12094,
5425,
29924,
29966,
9507,
29958,
5095,
294,
326,
29914,
29880,
2207,
9170,
29925,
29941,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29906,
30004,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
15945,
19451,
13,
4309,
29934,
29874,
8942,
29871,
29900,
29889,
29906,
29889,
29896,
29901,
29611,
5321,
12112,
297,
4309,
29934,
29874,
30004,
13,
14187,
1266,
29871,
30211,
29871,
29906,
29900,
29896,
29953,
529,
5813,
29958,
3532,
26862,
6227,
6778,
322,
529,
5813,
29958,
3532,
26862,
6227,
29958,
3238,
13,
30004,
13,
910,
664,
338,
7794,
21144,
1090,
278,
26635,
3468,
6212,
3224,
29871,
29946,
29889,
29900,
30004,
13,
4623,
19245,
29889,
1763,
1776,
263,
3509,
310,
445,
19405,
11167,
13,
6493,
1732,
597,
1037,
1230,
22382,
29889,
990,
29914,
506,
11259,
29914,
1609,
29914,
29946,
29889,
29900,
6294,
30004,
13,
30004,
13,
1938,
4309,
29934,
29874,
17511,
29899,
21472,
399,
680,
29899,
13799,
8527,
29879,
2522,
744,
29973,
529,
5813,
10202,
529,
5813,
10202,
529,
5813,
3238,
13,
322,
529,
5813,
10202,
10888,
29956,
29875,
29924,
525,
29896,
29953,
29892,
1732,
597,
8235,
29889,
1867,
29875,
29889,
990,
29914,
29896,
29900,
29889,
29896,
29896,
29946,
29945,
29914,
29906,
29929,
29947,
29947,
29906,
29947,
29955,
29889,
29906,
29929,
29947,
29929,
29896,
29953,
29941,
30004,
13,
30004,
13,
395,
2539,
29901,
29871,
29906,
29900,
29896,
29955,
29899,
29900,
29945,
29899,
29896,
29906,
29871,
29896,
29929,
29901,
29896,
29953,
29901,
29896,
29953,
718,
29900,
29896,
29900,
29900,
313,
27034,
29892,
29871,
29896,
29906,
2610,
29871,
29906,
29900,
29896,
29955,
29897,
395,
30004,
13,
395,
1123,
4924,
29901,
29871,
29941,
29941,
29946,
395,
30004,
13,
15945,
19451,
13,
30004,
13,
15945,
19451,
13,
28962,
29940,
4590,
29903,
3235,
29901,
30004,
13,
259,
11431,
29880,
2207,
9170,
29889,
2272,
529,
18010,
29958,
529,
485,
3174,
355,
29958,
529,
735,
15362,
29958,
529,
3601,
2230,
29958,
518,
22017,
2459,
29962,
30004,
13,
23050,
24290,
2725,
29901,
30004,
13,
1678,
7573,
30004,
13,
4706,
1353,
310,
7573,
304,
29611,
30004,
13,
1678,
1029,
3174,
355,
30004,
13,
4706,
6588,
9348,
7292,
297,
3533,
21462,
30004,
13,
1678,
7639,
30004,
13,
4706,
7639,
338,
385,
6043,
393,
3683,
1475,
411,
825,
7155,
6055,
278,
30004,
13,
4706,
17402,
338,
1065,
29889,
2178,
7573,
526,
13252,
411,
263,
4343,
22649,
3081,
30004,
13,
4706,
322,
263,
2323,
22649,
10868,
29892,
6521,
8703,
6467,
22993,
13,
308,
29900,
259,
671,
278,
6055,
411,
278,
278,
5232,
342,
1418,
279,
403,
313,
20322,
29896,
29906,
29892,
350,
29956,
29896,
29906,
29945,
29892,
15600,
29946,
29914,
29947,
467,
30004,
13,
308,
29896,
259,
1027,
309,
1466,
304,
7639,
29871,
29900,
29892,
541,
671,
263,
4036,
7348,
310,
29871,
29941,
22649,
30004,
13,
9651,
29511,
22993,
13,
308,
29906,
259,
671,
278,
6055,
411,
278,
5172,
342,
848,
6554,
313,
20322,
29953,
29892,
350,
29956,
29945,
29900,
29900,
29892,
15600,
29946,
29914,
29945,
467,
30004,
13,
308,
29941,
259,
5994,
895,
278,
4444,
639,
2943,
2729,
373,
278,
5418,
304,
278,
28646,
22993,
13,
308,
29946,
259,
671,
278,
6055,
408,
3342,
297,
4309,
29934,
29874,
29956,
2190,
313,
20322,
29896,
29906,
29892,
350,
29956,
29896,
29906,
29945,
29892,
15600,
29946,
29914,
29945,
467,
30004,
13,
308,
29945,
259,
1027,
309,
1466,
304,
7639,
29871,
29941,
29892,
541,
884,
5994,
4637,
278,
22649,
3081,
22993,
13,
1678,
1027,
2230,
30004,
13,
4706,
3001,
2734,
931,
297,
3533,
21462,
30004,
13,
1678,
22369,
30004,
13,
4706,
731,
304,
29871,
29896,
304,
9025,
278,
2989,
22369,
1423,
29892,
29871,
29900,
304,
671,
263,
20875,
1423,
22993,
13,
4706,
2973,
278,
20875,
1423,
29892,
1023,
7191,
784,
7459,
746,
896,
18331,
472,
278,
30004,
13,
4706,
1021,
931,
29892,
373,
278,
1021,
10868,
322,
9677,
292,
7329,
29889,
450,
2989,
22369,
30004,
13,
4706,
1423,
1136,
11376,
278,
525,
17885,
545,
2779,
742,
988,
1609,
263,
22369,
310,
697,
470,
278,
30004,
13,
19474,
12336,
30004,
13,
1678,
450,
1121,
310,
1432,
17402,
1065,
674,
367,
623,
2760,
304,
263,
934,
4257,
1518,
29990,
29889,
4130,
11167,
13,
1678,
988,
1609,
1060,
338,
278,
7639,
1353,
29889,
450,
934,
3743,
263,
2913,
13055,
1591,
30004,
13,
1678,
310,
1819,
363,
7573,
29892,
5321,
12112,
29892,
18750,
6847,
322,
3001,
5864,
10398,
29889,
450,
30004,
13,
1678,
848,
934,
508,
367,
5948,
715,
15048,
773,
321,
29889,
29887,
29889,
330,
3433,
5317,
22993,
13,
15945,
19451,
13,
30004,
13,
5215,
1027,
2272,
30004,
13,
5215,
4036,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
5844,
30004,
13,
5215,
10876,
30004,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
30004,
13,
5215,
2897,
30004,
13,
30004,
13,
29937,
2507,
373,
29914,
2696,
18533,
30004,
13,
6420,
353,
29871,
29896,
30004,
13,
30004,
13,
29937,
437,
278,
2989,
22369,
1423,
30004,
13,
8159,
29918,
22017,
2459,
353,
5852,
30004,
13,
30004,
13,
29937,
15729,
29901,
30004,
13,
29937,
29871,
29900,
29901,
18203,
411,
27217,
4799,
2230,
29892,
394,
1148,
29874,
29899,
3293,
7639,
30004,
13,
29937,
29871,
29900,
29901,
697,
411,
29871,
29941,
29511,
29892,
29871,
29896,
411,
29871,
29896,
10868,
30004,
13,
29937,
29871,
29906,
29901,
411,
3273,
342,
23912,
29892,
1603,
394,
1148,
29874,
29899,
3293,
30004,
13,
29937,
29871,
29941,
29901,
411,
3273,
342,
1950,
23912,
8679,
373,
5418,
30004,
13,
30004,
13,
29937,
445,
338,
385,
1409,
411,
17005,
1819,
363,
4771,
24858,
30004,
13,
29937,
1074,
5650,
29892,
6137,
29871,
29941,
30004,
13,
4668,
29955,
353,
7442,
29889,
2378,
4197,
29955,
6653,
29896,
29906,
29953,
29889,
29945,
6653,
29896,
29906,
29946,
29889,
29906,
29945,
6653,
29896,
29906,
29900,
29889,
29955,
29945,
2314,
30004,
13,
4668,
29947,
353,
7442,
29889,
2378,
4197,
29947,
6653,
29896,
29906,
29955,
29889,
29906,
29945,
6653,
29896,
29906,
29953,
29889,
29955,
29945,
6653,
29896,
29906,
29946,
29889,
29900,
2314,
30004,
13,
4668,
29929,
353,
7442,
29889,
2378,
4197,
29929,
6653,
29896,
29941,
29896,
29889,
29906,
29945,
6653,
29896,
29906,
29947,
29889,
29906,
29945,
6653,
29896,
29906,
29955,
29889,
29945,
2314,
30004,
13,
4668,
29896,
29900,
353,
7442,
29889,
2378,
4197,
29896,
29900,
6653,
29896,
29941,
29906,
29889,
29955,
29945,
6653,
29896,
29941,
29900,
29889,
29906,
29945,
6653,
29896,
29906,
29947,
29889,
29955,
29945,
2314,
30004,
13,
4668,
29896,
29896,
353,
7442,
29889,
2378,
4197,
29896,
29896,
6653,
29896,
29941,
29946,
29889,
29945,
6653,
29896,
29941,
29906,
29889,
29955,
29945,
6653,
29896,
29906,
29947,
29889,
29955,
29945,
2314,
30004,
13,
4668,
29896,
29906,
353,
7442,
29889,
2378,
4197,
29896,
29906,
6653,
29896,
29941,
29941,
29889,
29906,
29945,
6653,
29896,
29941,
29906,
29889,
29906,
29945,
6653,
29896,
29941,
29906,
29889,
29906,
29945,
2314,
30004,
13,
30004,
13,
29937,
30004,
13,
29937,
1423,
363,
5321,
12112,
472,
2967,
5073,
30004,
13,
29937,
3940,
29901,
2000,
1434,
263,
18203,
313,
272,
3265,
2943,
29897,
338,
15478,
964,
278,
1051,
30004,
13,
1753,
1423,
22017,
2459,
29898,
4058,
300,
1125,
30004,
13,
1678,
784,
353,
29871,
29900,
396,
7353,
4312,
1951,
727,
1795,
367,
3196,
5321,
12112,
363,
18203,
30004,
13,
1678,
9068,
353,
29871,
29900,
30004,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
2435,
29898,
4058,
1691,
4178,
9851,
22164,
30004,
13,
4706,
565,
23912,
4178,
9851,
29961,
29875,
1822,
4058,
300,
29889,
5014,
287,
1275,
29871,
29896,
29901,
30004,
13,
9651,
9068,
353,
9068,
718,
29871,
29896,
30004,
13,
1678,
565,
313,
19170,
1405,
4236,
9851,
10380,
3145,
1125,
30004,
13,
4706,
1596,
703,
517,
29877,
1472,
29901,
613,
7431,
29898,
4058,
1691,
4178,
9851,
876,
30004,
13,
4706,
18203,
29889,
5014,
287,
353,
29871,
29900,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
18203,
29889,
5014,
287,
353,
29871,
29896,
30004,
13,
30004,
13,
1678,
565,
23912,
4178,
9851,
29901,
30004,
13,
4706,
1596,
703,
3210,
16658,
2943,
6571,
313,
4668,
29901,
8875,
289,
29893,
29901,
8875,
3005,
29939,
29901,
25641,
29889,
29953,
29872,
1800,
4045,
29901,
6571,
1642,
4830,
29898,
30004,
13,
632,
18203,
29889,
3177,
333,
29892,
18203,
29889,
4668,
29892,
18203,
29889,
29890,
29893,
29892,
18203,
29889,
29888,
7971,
11167,
13,
632,
7431,
29898,
4058,
1691,
4178,
9851,
4961,
30004,
13,
4706,
363,
916,
297,
23912,
4178,
9851,
29901,
30004,
13,
9651,
565,
916,
29889,
3177,
333,
2804,
18203,
29889,
3177,
333,
29901,
30004,
13,
1669,
1596,
703,
6778,
2943,
6571,
313,
4668,
29901,
8875,
289,
29893,
29901,
8875,
3005,
29939,
29901,
25641,
29889,
29953,
29872,
1800,
1642,
4830,
29898,
30004,
13,
462,
259,
916,
29889,
3177,
333,
29892,
916,
29889,
4058,
300,
29889,
4668,
29892,
916,
29889,
4058,
300,
29889,
29890,
29893,
29892,
916,
29889,
4058,
300,
29889,
29888,
7971,
876,
30004,
13,
1669,
396,
2560,
22369,
30004,
13,
1669,
565,
10868,
28377,
2459,
29898,
4058,
300,
29892,
916,
29889,
4058,
300,
29897,
320,
30004,
13,
462,
259,
322,
18668,
28377,
2459,
29898,
4058,
300,
29892,
916,
29889,
4058,
300,
1125,
30004,
13,
462,
259,
565,
2989,
29918,
22017,
2459,
29901,
30004,
13,
462,
539,
565,
28750,
28377,
2459,
29898,
4058,
300,
29892,
916,
29889,
4058,
300,
1125,
30004,
13,
462,
965,
396,
1423,
1058,
5321,
2247,
297,
278,
3081,
5354,
30004,
13,
462,
965,
274,
353,
3081,
28377,
2459,
29898,
4058,
300,
29892,
916,
29889,
4058,
300,
8443,
13,
462,
965,
396,
2791,
599,
278,
5321,
2618,
23912,
30004,
13,
462,
965,
396,
2845,
445,
697,
29892,
278,
916,
697,
29892,
470,
1716,
30004,
13,
462,
965,
363,
282,
297,
274,
29901,
30004,
13,
462,
1669,
282,
29889,
22017,
2618,
353,
29871,
29896,
30004,
13,
462,
1669,
565,
282,
1275,
18203,
29901,
30004,
13,
462,
462,
259,
784,
353,
29871,
29896,
30004,
13,
462,
539,
1683,
29901,
30004,
13,
462,
965,
396,
694,
28750,
22369,
29892,
599,
2691,
30004,
13,
462,
965,
1209,
30004,
13,
462,
259,
1683,
29901,
30004,
13,
462,
539,
18203,
29889,
22017,
2618,
353,
29871,
29896,
30004,
13,
462,
539,
916,
29889,
4058,
300,
29889,
22017,
2618,
353,
29871,
29896,
29871,
396,
916,
884,
2355,
5714,
29892,
565,
372,
9007,
29915,
29873,
5714,
2307,
30004,
13,
462,
539,
784,
353,
29871,
29896,
30004,
13,
4706,
736,
784,
30004,
13,
1678,
736,
29871,
29900,
30004,
13,
30004,
13,
29937,
30004,
13,
29937,
10868,
28377,
2459,
29892,
5855,
30004,
13,
29937,
30004,
13,
29937,
4706,
891,
29888,
29896,
29899,
29888,
29906,
29989,
5277,
29871,
29896,
29906,
29900,
413,
12661,
565,
285,
29896,
470,
285,
29906,
756,
289,
29893,
29871,
29945,
29900,
29900,
30004,
13,
29937,
4706,
891,
29888,
29896,
29899,
29888,
29906,
29989,
5277,
29871,
29953,
29900,
413,
12661,
565,
285,
29896,
470,
285,
29906,
756,
289,
29893,
29871,
29906,
29945,
29900,
30004,
13,
29937,
4706,
891,
29888,
29896,
29899,
29888,
29906,
29989,
5277,
29871,
29941,
29900,
413,
12661,
565,
285,
29896,
470,
285,
29906,
756,
289,
29893,
29871,
29896,
29906,
29945,
30004,
13,
1753,
10868,
28377,
2459,
29898,
29886,
29896,
29892,
29886,
29906,
1125,
30004,
13,
1678,
565,
313,
6897,
29898,
29886,
29896,
29889,
29888,
7971,
29899,
29886,
29906,
29889,
29888,
7971,
29897,
14065,
29896,
29906,
29900,
322,
313,
29886,
29896,
29889,
29890,
29893,
1360,
29945,
29900,
29900,
470,
282,
29906,
29889,
29888,
7971,
1360,
29945,
29900,
29900,
22164,
30004,
13,
4706,
1596,
703,
10745,
23860,
5321,
29871,
29945,
29900,
29900,
1159,
30004,
13,
4706,
736,
5852,
30004,
13,
1678,
25342,
313,
6897,
29898,
29886,
29896,
29889,
29888,
7971,
29899,
29886,
29906,
29889,
29888,
7971,
29897,
14065,
29953,
29900,
322,
313,
29886,
29896,
29889,
29890,
29893,
1360,
29906,
29945,
29900,
470,
282,
29906,
29889,
29888,
7971,
1360,
29906,
29945,
29900,
22164,
30004,
13,
4706,
1596,
703,
10745,
23860,
5321,
29871,
29906,
29945,
29900,
1159,
30004,
13,
4706,
736,
5852,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
565,
313,
6897,
29898,
29886,
29896,
29889,
29888,
7971,
29899,
29886,
29906,
29889,
29888,
7971,
29897,
14065,
29941,
29900,
1125,
30004,
13,
9651,
1596,
703,
10745,
23860,
5321,
29871,
29896,
29906,
29945,
1159,
30004,
13,
9651,
736,
5852,
30004,
13,
4706,
396,
2870,
29901,
30004,
13,
1678,
1596,
703,
1217,
10868,
5321,
1159,
30004,
13,
1678,
736,
7700,
30004,
13,
30004,
13,
1753,
18668,
28377,
2459,
29898,
29886,
29896,
29892,
282,
29906,
1125,
30004,
13,
1678,
565,
282,
29896,
29889,
4668,
1275,
282,
29906,
29889,
4668,
29901,
30004,
13,
4706,
1596,
703,
22017,
2459,
18668,
2943,
6571,
322,
2943,
6571,
1642,
4830,
29898,
29886,
29896,
29889,
3177,
333,
29892,
282,
29906,
29889,
3177,
333,
876,
30004,
13,
4706,
396,
282,
29906,
1122,
505,
1063,
5714,
2086,
29892,
674,
367,
10902,
491,
916,
12747,
30004,
13,
4706,
736,
5852,
30004,
13,
1678,
1596,
703,
1217,
18668,
22369,
1159,
30004,
13,
1678,
736,
7700,
30004,
13,
30004,
13,
1753,
3081,
28377,
2459,
29898,
29886,
29896,
29892,
282,
29906,
1125,
30004,
13,
1678,
3081,
1349,
12268,
353,
29871,
29953,
396,
270,
29933,
30004,
13,
1678,
1596,
703,
29886,
15866,
29901,
2943,
426,
29900,
29889,
3177,
333,
29913,
426,
29900,
29889,
29878,
893,
29875,
29901,
29941,
29889,
29906,
29888,
29913,
270,
29933,
29885,
2943,
426,
29896,
29889,
3177,
333,
29913,
426,
29896,
29889,
29878,
893,
29875,
29901,
29941,
29889,
29906,
29888,
29913,
270,
29933,
29885,
29936,
2923,
426,
29906,
29901,
29941,
29889,
29906,
29888,
29913,
270,
29933,
29885,
1642,
4830,
29898,
29886,
29896,
29892,
282,
29906,
29892,
4513,
29898,
29886,
29896,
29889,
29878,
893,
29875,
448,
282,
29906,
29889,
29878,
893,
29875,
29892,
29906,
4961,
30004,
13,
1678,
565,
6425,
29898,
29886,
29896,
29889,
29878,
893,
29875,
448,
282,
29906,
29889,
29878,
893,
29875,
29897,
529,
3081,
1349,
12268,
29901,
30004,
13,
4706,
1596,
703,
22017,
2459,
282,
15866,
1716,
2943,
6571,
322,
2943,
6571,
1642,
4830,
29898,
29886,
29896,
29889,
3177,
333,
29892,
282,
29906,
29889,
3177,
333,
876,
30004,
13,
4706,
396,
23912,
526,
2086,
3802,
304,
1269,
916,
29892,
1716,
784,
7459,
30004,
13,
4706,
396,
736,
1716,
23912,
408,
3209,
950,
2938,
30004,
13,
4706,
736,
313,
29886,
29896,
29892,
282,
29906,
8443,
13,
1678,
25342,
282,
29896,
29889,
29878,
893,
29875,
448,
282,
29906,
29889,
29878,
893,
29875,
529,
3081,
1349,
12268,
29901,
30004,
13,
4706,
396,
282,
29906,
975,
13519,
287,
282,
29896,
29892,
736,
282,
29896,
408,
3209,
950,
1017,
30004,
13,
4706,
1596,
703,
22017,
2459,
282,
15866,
2943,
6571,
975,
13519,
287,
2943,
6571,
1642,
4830,
29898,
29886,
29906,
29889,
3177,
333,
29892,
282,
29896,
29889,
3177,
333,
876,
30004,
13,
4706,
736,
313,
29886,
29896,
29892,
8443,
13,
1678,
1596,
703,
29886,
29896,
21614,
29892,
282,
29906,
5714,
1159,
30004,
13,
1678,
396,
282,
29906,
471,
278,
591,
5790,
18203,
29892,
736,
372,
408,
263,
3209,
950,
1017,
30004,
13,
1678,
736,
313,
29886,
29906,
29892,
8443,
13,
30004,
13,
1753,
28750,
28377,
2459,
29898,
29886,
29896,
29892,
282,
29906,
1125,
30004,
13,
1678,
396,
10241,
282,
29896,
338,
278,
10849,
368,
11977,
18203,
322,
445,
338,
278,
1833,
1423,
30004,
13,
1678,
396,
591,
29915,
345,
2307,
10087,
393,
282,
29896,
338,
263,
8062,
18203,
29892,
577,
278,
871,
30004,
13,
1678,
396,
982,
591,
508,
5401,
338,
491,
1641,
5683,
3307,
313,
6194,
278,
937,
302,
448,
29871,
29945,
758,
314,
569,
15072,
25457,
8443,
13,
30004,
13,
1678,
396,
10241,
29871,
29947,
758,
314,
569,
15072,
30004,
13,
1678,
405,
1457,
314,
353,
29871,
29947,
30004,
13,
30004,
13,
1678,
396,
591,
508,
14074,
472,
1556,
313,
29940,
1457,
314,
448,
29871,
29945,
29897,
334,
323,
11967,
310,
1749,
758,
314,
569,
30004,
13,
1678,
323,
1457,
1117,
353,
29871,
29906,
1068,
29886,
29896,
29889,
4668,
14571,
29896,
29889,
29900,
29930,
29886,
29896,
29889,
29890,
29893,
29897,
334,
313,
29940,
1457,
314,
448,
29871,
29945,
8443,
13,
30004,
13,
1678,
396,
1423,
3692,
282,
29906,
10614,
297,
282,
29896,
29915,
29879,
12187,
4004,
30004,
13,
1678,
282,
29906,
29918,
355,
353,
282,
29906,
29889,
1202,
2481,
718,
282,
29906,
29889,
1621,
603,
30004,
13,
1678,
282,
29896,
29918,
2395,
353,
8829,
29889,
3707,
718,
323,
1457,
1117,
30004,
13,
1678,
1596,
703,
22017,
2459,
28750,
2943,
6571,
21313,
29087,
29087,
1800,
2943,
6571,
21313,
29087,
1800,
1642,
4830,
29898,
30004,
13,
4706,
282,
29896,
29889,
3177,
333,
29892,
8829,
29889,
3707,
448,
8829,
29889,
3707,
29892,
282,
29896,
29918,
2395,
448,
8829,
29889,
3707,
29892,
282,
29896,
29889,
1621,
603,
11167,
13,
4706,
282,
29906,
29889,
3177,
333,
29892,
282,
29906,
29889,
1202,
2481,
448,
8829,
29889,
3707,
29892,
282,
29906,
29918,
355,
448,
8829,
29889,
3707,
30004,
13,
268,
876,
30004,
13,
1678,
565,
282,
29896,
29918,
2395,
529,
282,
29906,
29918,
355,
29901,
30004,
13,
4706,
396,
282,
29896,
5321,
2618,
411,
282,
29906,
322,
5714,
30004,
13,
4706,
1596,
703,
1333,
5683,
3307,
1159,
30004,
13,
4706,
736,
5852,
30004,
13,
1678,
1596,
703,
17314,
491,
278,
758,
314,
569,
1159,
30004,
13,
1678,
736,
7700,
30004,
13,
30004,
13,
29937,
445,
740,
2912,
267,
278,
4799,
2230,
310,
263,
18203,
30004,
13,
29937,
5034,
304,
365,
2207,
4002,
647,
9485,
680,
29918,
1254,
29928,
29889,
5140,
30004,
13,
29937,
30004,
13,
1753,
4799,
2230,
29898,
4668,
29892,
7283,
29892,
572,
29892,
29890,
29893,
1125,
30004,
13,
1678,
379,
353,
29871,
29900,
4706,
396,
12235,
4839,
12708,
313,
29950,
29922,
29900,
29897,
470,
451,
313,
29950,
29922,
29896,
8443,
13,
1678,
5012,
353,
29871,
29900,
539,
396,
4482,
848,
6554,
13883,
9615,
11070,
29896,
29897,
470,
451,
11070,
29900,
8443,
13,
1678,
405,
1457,
314,
353,
29871,
29947,
259,
396,
1353,
310,
758,
314,
569,
5829,
313,
29896,
29906,
29889,
29906,
29945,
29871,
515,
14950,
29920,
5650,
8443,
13,
30004,
13,
1678,
565,
289,
29893,
1275,
29871,
29896,
29906,
29945,
322,
18668,
297,
518,
29896,
29896,
29892,
29871,
29896,
29906,
5387,
30004,
13,
4706,
396,
4482,
848,
6554,
13883,
9619,
630,
363,
350,
29956,
29896,
29906,
29945,
411,
28768,
29896,
29896,
322,
28768,
29896,
29906,
30004,
13,
4706,
5012,
353,
29871,
29896,
30004,
13,
1678,
565,
18668,
1275,
29871,
29953,
29901,
30004,
13,
4706,
396,
508,
871,
505,
12235,
4839,
411,
28768,
29953,
30004,
13,
4706,
379,
353,
29871,
29896,
30004,
13,
30004,
13,
1678,
323,
11967,
353,
313,
29906,
29889,
29900,
1068,
4668,
6802,
29890,
29893,
30004,
13,
1678,
323,
1457,
314,
353,
313,
29940,
1457,
314,
718,
29871,
29946,
29889,
29906,
29945,
11877,
29911,
11967,
30004,
13,
1678,
1596,
703,
4668,
613,
18668,
29892,
376,
2181,
613,
2181,
29892,
376,
572,
613,
715,
29892,
376,
29890,
29893,
613,
289,
29893,
8443,
13,
1678,
20092,
25548,
29890,
23189,
353,
29871,
29947,
718,
4236,
29898,
755,
29889,
27696,
3552,
29947,
29889,
29900,
29930,
572,
29899,
29946,
29889,
29900,
29930,
4668,
29974,
29906,
29947,
29974,
29896,
29953,
29899,
29906,
29900,
29930,
29950,
6802,
29898,
29946,
29889,
29900,
16395,
4668,
29899,
29906,
29930,
2287,
4961,
16395,
7283,
29974,
29946,
511,
29900,
8443,
13,
1678,
323,
23813,
353,
20092,
25548,
29890,
23189,
334,
323,
11967,
30004,
13,
1678,
736,
323,
1457,
314,
718,
323,
23813,
30004,
13,
30004,
13,
29937,
30004,
13,
29937,
445,
740,
10017,
263,
2943,
30004,
13,
29937,
30004,
13,
1990,
590,
4247,
7295,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2943,
333,
29892,
24512,
29892,
3785,
29892,
18203,
2435,
1125,
30004,
13,
4706,
1583,
29889,
3177,
333,
353,
2943,
333,
30004,
13,
4706,
1583,
29889,
19145,
353,
3785,
30004,
13,
4706,
1583,
29889,
5824,
353,
24512,
30004,
13,
4706,
1583,
29889,
29916,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
29891,
353,
29871,
29900,
30004,
13,
30004,
13,
4706,
396,
445,
338,
1407,
4280,
410,
7099,
545,
363,
24421,
7573,
30004,
13,
4706,
396,
322,
9801,
9212,
5418,
1546,
1269,
5101,
310,
7573,
30004,
13,
4706,
1476,
353,
29871,
29900,
30004,
13,
4706,
364,
3885,
353,
29871,
29900,
30004,
13,
30004,
13,
4706,
5534,
7573,
30004,
13,
4706,
396,
29875,
353,
29871,
29896,
29945,
29900,
30004,
13,
30004,
13,
4706,
9995,
30004,
13,
4706,
565,
7431,
29898,
18010,
29897,
1405,
29871,
29900,
29901,
30004,
13,
18884,
363,
2380,
29892,
302,
297,
26985,
29898,
18010,
1125,
30004,
13,
462,
1678,
1583,
29889,
29916,
353,
29871,
29896,
29900,
29900,
718,
474,
30004,
13,
462,
1678,
1583,
29889,
29891,
353,
29871,
29896,
29900,
29900,
718,
474,
30004,
13,
462,
1678,
474,
29922,
474,
718,
29871,
29896,
29900,
29900,
30004,
13,
462,
1678,
1596,
703,
3177,
921,
29901,
9162,
1583,
29889,
29916,
8443,
13,
4706,
1683,
29901,
30004,
13,
18884,
1596,
703,
4102,
2943,
1159,
30004,
13,
18884,
1583,
29889,
29916,
353,
29871,
29896,
29900,
29900,
30004,
13,
18884,
1583,
29889,
29891,
353,
29871,
29896,
29900,
29900,
30004,
13,
18884,
1476,
353,
29871,
29896,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
1550,
313,
11940,
1275,
29871,
29900,
322,
364,
3885,
529,
29871,
29896,
29900,
29900,
1125,
30004,
13,
9651,
263,
353,
4036,
29889,
8172,
26471,
13,
9651,
289,
353,
4036,
29889,
8172,
26471,
13,
9651,
565,
289,
29966,
29874,
29901,
30004,
13,
18884,
263,
29892,
29890,
353,
289,
29892,
29874,
30004,
13,
9651,
926,
29916,
353,
289,
29930,
3317,
13398,
29930,
755,
29889,
3944,
29898,
29906,
29930,
755,
29889,
1631,
29930,
29874,
29914,
29890,
7240,
5824,
29916,
30004,
13,
9651,
926,
29891,
353,
289,
29930,
3317,
13398,
29930,
755,
29889,
5223,
29898,
29906,
29930,
755,
29889,
1631,
29930,
29874,
29914,
29890,
7240,
5824,
29891,
30004,
13,
9651,
565,
7431,
29898,
18010,
29897,
1405,
29871,
29900,
29901,
30004,
13,
18884,
363,
2380,
29892,
302,
297,
26985,
29898,
18010,
1125,
30004,
13,
462,
1678,
1320,
353,
7442,
29889,
3676,
3552,
29898,
6897,
29898,
29876,
29889,
29916,
29899,
1066,
29916,
876,
1068,
29906,
7240,
3552,
6897,
29898,
29876,
29889,
29891,
29899,
1066,
29891,
876,
1068,
29906,
876,
30004,
13,
462,
1678,
565,
1320,
6736,
29871,
29896,
29900,
29901,
30004,
13,
462,
4706,
1476,
353,
29871,
29896,
30004,
13,
462,
4706,
1583,
29889,
29916,
353,
926,
29916,
30004,
13,
462,
4706,
1583,
29889,
29891,
353,
926,
29891,
30004,
13,
462,
1678,
1683,
29901,
30004,
13,
462,
4706,
364,
3885,
353,
364,
3885,
718,
29871,
29896,
30004,
13,
462,
4706,
565,
364,
3885,
1275,
29871,
29896,
29900,
29900,
29901,
30004,
13,
462,
9651,
1596,
703,
26680,
451,
2058,
716,
2943,
29892,
6820,
701,
1159,
30004,
13,
462,
9651,
6876,
6278,
29896,
8443,
13,
9651,
1683,
29901,
30004,
13,
18884,
1596,
703,
4102,
2943,
1159,
30004,
13,
18884,
1583,
29889,
29916,
353,
926,
29916,
30004,
13,
18884,
1583,
29889,
29891,
353,
926,
29891,
30004,
13,
18884,
1476,
353,
29871,
29896,
30004,
13,
30004,
13,
4706,
1583,
29889,
5721,
353,
7442,
29889,
3676,
3552,
1311,
29889,
29916,
29899,
5824,
29916,
11877,
29898,
1311,
29889,
29916,
29899,
5824,
29916,
7240,
29898,
1311,
29889,
29891,
29899,
5824,
29891,
11877,
29898,
1311,
29889,
29891,
29899,
5824,
29891,
876,
30004,
13,
4706,
1596,
29898,
877,
3177,
1273,
29881,
29915,
1273,
3177,
333,
29892,
376,
29916,
613,
1583,
29889,
29916,
29892,
376,
29891,
613,
1583,
29889,
29891,
29892,
376,
5721,
29901,
9162,
1583,
29889,
5721,
876,
30004,
13,
30004,
13,
4706,
1583,
29889,
4058,
300,
353,
590,
16638,
300,
29898,
1311,
29889,
3177,
333,
29892,
18203,
2435,
29892,
1583,
29889,
5721,
8443,
13,
4706,
1583,
29889,
18616,
353,
29871,
29900,
30004,
13,
30004,
13,
4706,
396,
18533,
363,
2943,
30004,
13,
4706,
5534,
18533,
30004,
13,
4706,
565,
313,
6420,
1275,
29871,
29896,
1125,
30004,
13,
9651,
5534,
4853,
30004,
13,
9651,
4853,
29889,
1202,
29918,
442,
391,
29898,
572,
29873,
29889,
23495,
280,
3552,
1311,
29889,
29916,
29892,
1583,
29889,
29891,
511,
29871,
29906,
29892,
5445,
29922,
5574,
29892,
2927,
2433,
9539,
8785,
30004,
13,
30004,
13,
29937,
30004,
13,
29937,
445,
740,
10017,
263,
18203,
313,
21264,
630,
411,
263,
2943,
8443,
13,
29937,
372,
884,
6166,
599,
4128,
29892,
5279,
4036,
30004,
13,
29937,
30004,
13,
1990,
590,
16638,
300,
7295,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2943,
333,
29892,
715,
264,
29892,
5418,
1125,
30004,
13,
4706,
5534,
7639,
30004,
13,
4706,
5534,
349,
7508,
30004,
13,
4706,
5534,
330,
2735,
30004,
13,
4706,
5534,
270,
29900,
30004,
13,
4706,
5534,
722,
30004,
13,
4706,
5534,
365,
29886,
430,
29900,
30004,
13,
4706,
5534,
12729,
30004,
13,
30004,
13,
4706,
1583,
29889,
3177,
333,
353,
2943,
333,
30004,
13,
4706,
1583,
29889,
7508,
12248,
353,
349,
7508,
30004,
13,
30004,
13,
4706,
396,
4036,
675,
5285,
1819,
30004,
13,
4706,
1583,
29889,
4668,
353,
4036,
29889,
9502,
524,
29898,
29953,
29892,
29896,
29906,
8443,
13,
4706,
1583,
29889,
7283,
353,
4036,
29889,
9502,
524,
29898,
29896,
29892,
29946,
8443,
13,
4706,
1583,
29889,
29890,
29893,
353,
4036,
29889,
16957,
4197,
29896,
29906,
29945,
29892,
29871,
29906,
29945,
29900,
29892,
29871,
29945,
29900,
29900,
2314,
30004,
13,
30004,
13,
4706,
396,
363,
3058,
15729,
5712,
1438,
30004,
13,
4706,
565,
7639,
1360,
29896,
470,
7639,
1275,
29871,
29900,
29901,
30004,
13,
9651,
1583,
29889,
4668,
353,
29871,
29896,
29906,
30004,
13,
9651,
1583,
29889,
7283,
353,
29871,
29946,
30004,
13,
9651,
1583,
29889,
29890,
29893,
353,
29871,
29896,
29906,
29945,
30004,
13,
30004,
13,
4706,
396,
363,
3058,
15729,
5712,
1438,
30004,
13,
4706,
565,
7639,
1360,
29906,
29901,
30004,
13,
9651,
1583,
29889,
4668,
353,
29871,
29953,
30004,
13,
9651,
1583,
29889,
7283,
353,
29871,
29896,
30004,
13,
9651,
1583,
29889,
29890,
29893,
353,
29871,
29945,
29900,
29900,
30004,
13,
4706,
396,
301,
272,
1450,
273,
30004,
13,
4706,
565,
7639,
1275,
29871,
29946,
29901,
30004,
13,
9651,
1583,
29889,
4668,
353,
29871,
29896,
29906,
30004,
13,
9651,
1583,
29889,
7283,
353,
29871,
29896,
30004,
13,
9651,
1583,
29889,
29890,
29893,
353,
29871,
29896,
29906,
29945,
30004,
13,
30004,
13,
30004,
13,
4706,
396,
363,
7639,
29871,
29941,
1284,
278,
1900,
4444,
30004,
13,
4706,
396,
438,
9851,
29892,
777,
2898,
29659,
1819,
30004,
13,
4706,
1588,
29916,
353,
1583,
29889,
7508,
12248,
29871,
444,
5225,
2224,
6410,
491,
2322,
30004,
13,
30004,
13,
4706,
396,
1480,
29899,
17505,
30004,
13,
4706,
365,
572,
353,
365,
29886,
430,
29900,
718,
29871,
29896,
29900,
29930,
4283,
29930,
755,
29889,
1188,
29896,
29900,
29898,
19244,
29914,
29881,
29900,
8443,
13,
4706,
1596,
703,
29931,
572,
29901,
613,
365,
572,
8443,
13,
4706,
1588,
29916,
353,
1583,
29889,
7508,
12248,
448,
12729,
448,
365,
572,
30004,
13,
30004,
13,
4706,
565,
313,
735,
15362,
1275,
29871,
29941,
29897,
470,
313,
735,
15362,
1275,
29871,
29945,
1125,
30004,
13,
9651,
286,
1099,
381,
2230,
353,
29871,
29929,
29929,
29929,
29929,
30004,
13,
9651,
286,
1144,
29888,
353,
29871,
29900,
30004,
13,
9651,
1375,
29890,
29893,
353,
29871,
29900,
30004,
13,
30004,
13,
9651,
1596,
703,
4040,
29916,
29901,
613,
1588,
29916,
8443,
13,
30004,
13,
9651,
363,
474,
297,
3464,
29898,
29900,
29892,
29953,
1125,
30004,
13,
18884,
363,
432,
297,
3464,
29898,
29896,
29892,
29946,
1125,
30004,
13,
462,
1678,
565,
313,
23149,
29875,
29961,
29875,
29892,
29926,
29962,
529,
1588,
29916,
1125,
30004,
13,
462,
4706,
1583,
29889,
4668,
353,
938,
29898,
23149,
29875,
29961,
29875,
29892,
29900,
2314,
30004,
13,
462,
4706,
565,
432,
1360,
29896,
29901,
30004,
13,
462,
9651,
1583,
29889,
29890,
29893,
353,
29871,
29896,
29906,
29945,
30004,
13,
462,
4706,
25342,
432,
1360,
29906,
29901,
30004,
13,
462,
9651,
1583,
29889,
29890,
29893,
353,
29871,
29906,
29945,
29900,
30004,
13,
462,
4706,
1683,
29901,
30004,
13,
462,
9651,
1583,
29889,
29890,
29893,
29922,
29945,
29900,
29900,
30004,
13,
462,
4706,
472,
353,
4799,
2230,
29898,
1311,
29889,
4668,
29892,
29871,
29896,
29892,
715,
264,
29892,
1583,
29889,
29890,
29893,
8443,
13,
462,
4706,
565,
472,
529,
286,
1099,
381,
2230,
29901,
30004,
13,
462,
9651,
286,
1099,
381,
2230,
353,
472,
30004,
13,
462,
9651,
286,
1144,
29888,
353,
1583,
29889,
4668,
30004,
13,
462,
9651,
1375,
29890,
29893,
353,
1583,
29889,
29890,
29893,
30004,
13,
462,
9651,
286,
1144,
575,
29875,
353,
4771,
29875,
29961,
29875,
29892,
432,
29962,
30004,
13,
9651,
565,
313,
13257,
381,
2230,
1275,
29871,
29929,
29929,
29929,
29929,
1125,
30004,
13,
18884,
1596,
703,
13221,
451,
6159,
2967,
5073,
1159,
30004,
13,
18884,
6876,
6278,
29896,
8443,
13,
9651,
1596,
703,
13318,
18668,
29901,
613,
286,
1144,
29888,
29892,
376,
1900,
289,
29893,
29901,
9162,
1375,
29890,
29893,
29892,
376,
13318,
4799,
2230,
29901,
613,
286,
1099,
381,
2230,
8443,
13,
9651,
1583,
29889,
1621,
603,
353,
286,
1099,
381,
2230,
30004,
13,
9651,
1583,
29889,
4668,
353,
286,
1144,
29888,
30004,
13,
9651,
1583,
29889,
29890,
29893,
353,
1375,
29890,
29893,
30004,
13,
9651,
1583,
29889,
7283,
353,
29871,
29896,
30004,
13,
30004,
13,
9651,
565,
7639,
1275,
29871,
29945,
29901,
30004,
13,
18884,
396,
10032,
278,
25568,
13519,
565,
727,
29915,
29879,
5716,
2175,
30004,
13,
18884,
1583,
29889,
7508,
12248,
353,
4236,
29898,
29906,
29892,
1583,
29889,
7508,
12248,
448,
5844,
29889,
14939,
29898,
4040,
29916,
448,
286,
1144,
575,
29875,
876,
30004,
13,
18884,
1588,
29916,
353,
1583,
29889,
7508,
12248,
448,
12729,
448,
365,
572,
30004,
13,
18884,
1596,
877,
29885,
1144,
10100,
6571,
1900,
25568,
12248,
6571,
4286,
4830,
29898,
29885,
1144,
575,
29875,
29892,
1583,
29889,
7508,
12248,
876,
30004,
13,
30004,
13,
4706,
396,
22713,
3464,
29892,
4225,
2767,
22615,
30004,
13,
4706,
1583,
29889,
3286,
6069,
353,
29871,
29896,
29945,
29900,
30004,
13,
4706,
1583,
29889,
572,
353,
715,
264,
30004,
13,
4706,
1583,
29889,
11967,
2481,
353,
313,
29906,
29889,
29900,
1068,
1311,
29889,
4668,
6802,
1311,
29889,
29890,
29893,
30004,
13,
4706,
1583,
29889,
279,
4401,
2481,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
29878,
893,
29875,
353,
1588,
29916,
30004,
13,
4706,
396,
29511,
29901,
5224,
3216,
718,
1353,
310,
29871,
29953,
29896,
379,
29920,
6576,
30004,
13,
4706,
1583,
29889,
29888,
7971,
353,
29871,
29947,
29953,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
718,
4036,
29889,
9502,
524,
29898,
29900,
29892,
29906,
29953,
29906,
29906,
29929,
29945,
29900,
8443,
13,
30004,
13,
4706,
396,
363,
3058,
15729,
5712,
1438,
322,
30004,
13,
4706,
396,
6755,
777,
4036,
5204,
2063,
30004,
13,
4706,
565,
7639,
1275,
29871,
29896,
29901,
30004,
13,
9651,
1583,
29889,
29888,
7971,
353,
4036,
29889,
16957,
4197,
29947,
29953,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
29947,
29953,
29946,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
29947,
29953,
29947,
29900,
29900,
29900,
29900,
29900,
29900,
2314,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
1583,
29889,
29888,
7971,
353,
29871,
29947,
29953,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
30004,
13,
30004,
13,
4706,
1596,
703,
10745,
23860,
29908,
1919,
1311,
29889,
29888,
7971,
29892,
376,
11967,
2481,
9162,
1583,
29889,
11967,
2481,
8443,
13,
4706,
1596,
703,
29890,
29893,
613,
1583,
29889,
29890,
29893,
29892,
376,
4668,
613,
1583,
29889,
4668,
29892,
376,
7283,
613,
1583,
29889,
7283,
29892,
376,
29878,
893,
29875,
613,
1583,
29889,
29878,
893,
29875,
8443,
13,
4706,
1583,
29889,
1621,
603,
353,
4799,
2230,
29898,
1311,
29889,
4668,
29892,
1311,
29889,
7283,
29892,
1311,
29889,
572,
29892,
1311,
29889,
29890,
29893,
8443,
13,
4706,
1596,
703,
1621,
603,
2943,
9162,
1583,
29889,
3177,
333,
29892,
376,
29871,
9162,
1583,
29889,
1621,
603,
8443,
13,
4706,
396,
13530,
565,
18203,
338,
5321,
2618,
30004,
13,
4706,
1583,
29889,
22017,
2618,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
5014,
287,
353,
29871,
29900,
30004,
13,
30004,
13,
29937,
30004,
13,
29937,
1667,
19554,
1741,
2425,
29892,
6057,
363,
1269,
2943,
30004,
13,
29937,
263,
5534,
1051,
310,
18203,
1641,
19356,
472,
278,
28646,
30004,
13,
29937,
338,
19949,
30004,
13,
29937,
30004,
13,
1753,
22649,
29898,
6272,
29892,
3177,
1125,
30004,
13,
1678,
1550,
5852,
29901,
30004,
13,
4706,
7709,
8829,
29889,
15619,
29898,
8172,
29889,
4548,
586,
1306,
403,
29898,
29896,
29889,
29900,
29914,
7411,
29898,
3177,
29889,
19145,
4961,
30004,
13,
30004,
13,
4706,
396,
931,
9348,
322,
13442,
30004,
13,
4706,
396,
18203,
6974,
267,
1599,
788,
304,
2967,
5073,
30004,
13,
30004,
13,
4706,
2943,
29889,
18616,
353,
2943,
29889,
18616,
718,
29871,
29896,
30004,
13,
4706,
565,
313,
3177,
297,
23912,
4178,
9851,
1125,
30004,
13,
9651,
1596,
703,
11432,
29901,
18203,
2307,
297,
1159,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
4771,
24858,
353,
4771,
29875,
29961,
3177,
29889,
4058,
300,
29889,
4668,
448,
29871,
29955,
29892,
518,
29896,
29906,
29945,
29892,
29906,
29945,
29900,
29892,
29945,
29900,
29900,
1822,
2248,
29898,
3177,
29889,
4058,
300,
29889,
29890,
29893,
29897,
718,
29871,
29896,
29962,
30004,
13,
9651,
565,
2943,
29889,
4058,
300,
29889,
29878,
893,
29875,
529,
4771,
24858,
29901,
30004,
13,
18884,
1596,
703,
3177,
426,
6177,
18203,
674,
367,
5714,
1642,
4830,
29898,
3177,
29889,
3177,
333,
876,
30004,
13,
18884,
2943,
29889,
4058,
300,
29889,
18767,
353,
5852,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
2943,
29889,
4058,
300,
29889,
18767,
353,
7700,
30004,
13,
18884,
396,
4417,
18203,
565,
694,
22369,
30004,
13,
18884,
565,
313,
3198,
22017,
2459,
29898,
3177,
29889,
4058,
300,
29897,
1360,
29896,
1125,
30004,
13,
462,
1678,
2943,
29889,
4058,
300,
29889,
22017,
2618,
353,
29871,
29896,
30004,
13,
18884,
1683,
29901,
30004,
13,
462,
1678,
2943,
29889,
4058,
300,
29889,
22017,
2618,
353,
29871,
29900,
30004,
13,
18884,
23912,
4178,
9851,
29889,
4397,
29898,
3177,
8443,
13,
18884,
2943,
29889,
4058,
300,
29889,
1202,
2481,
353,
8829,
29889,
3707,
30004,
13,
30004,
13,
4706,
7709,
8829,
29889,
15619,
29898,
3177,
29889,
4058,
300,
29889,
1621,
603,
8443,
13,
30004,
13,
4706,
565,
2943,
29889,
4058,
300,
29889,
18767,
29901,
30004,
13,
9651,
5534,
17114,
29931,
520,
30004,
13,
9651,
17114,
29931,
520,
4619,
29871,
29896,
30004,
13,
4706,
565,
2943,
29889,
4058,
300,
29889,
22017,
2618,
1275,
29871,
29896,
29901,
30004,
13,
9651,
5534,
17114,
28377,
12112,
30004,
13,
9651,
17114,
28377,
12112,
353,
17114,
28377,
12112,
718,
29896,
30004,
13,
4706,
565,
2943,
29889,
4058,
300,
29889,
22017,
2618,
1275,
29871,
29900,
322,
451,
2943,
29889,
4058,
300,
29889,
18767,
29901,
30004,
13,
9651,
5534,
17114,
29816,
30004,
13,
9651,
17114,
29816,
353,
17114,
29816,
718,
29871,
29896,
30004,
13,
4706,
565,
2943,
29889,
4058,
300,
29889,
5014,
287,
1275,
29871,
29896,
29901,
30004,
13,
9651,
5534,
17114,
7032,
287,
30004,
13,
9651,
17114,
7032,
287,
353,
17114,
7032,
287,
718,
29871,
29896,
30004,
13,
30004,
13,
4706,
396,
4866,
18203,
756,
1063,
4520,
491,
2967,
5073,
30004,
13,
4706,
396,
508,
3349,
372,
30004,
13,
4706,
565,
313,
3177,
297,
23912,
4178,
9851,
1125,
30004,
13,
9651,
23912,
4178,
9851,
29889,
5992,
29898,
3177,
8443,
13,
9651,
396,
10092,
278,
18203,
30004,
13,
4706,
2943,
29889,
4058,
300,
29889,
22017,
2618,
353,
29871,
29900,
30004,
13,
4706,
2943,
29889,
4058,
300,
29889,
5014,
287,
353,
29871,
29900,
30004,
13,
4706,
2943,
29889,
4058,
300,
29889,
18767,
353,
7700,
30004,
13,
30004,
13,
29937,
30004,
13,
29937,
376,
3396,
29908,
1824,
30004,
13,
29937,
30004,
13,
30004,
13,
29937,
679,
6273,
30004,
13,
361,
7431,
29898,
9675,
29889,
19218,
29897,
6736,
29871,
29945,
29901,
30004,
13,
1678,
17114,
20284,
353,
938,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
30004,
13,
1678,
1029,
29887,
12600,
2481,
353,
938,
29898,
9675,
29889,
19218,
29961,
29906,
2314,
30004,
13,
1678,
7639,
353,
938,
29898,
9675,
29889,
19218,
29961,
29941,
2314,
30004,
13,
1678,
1027,
2230,
353,
938,
29898,
9675,
29889,
19218,
29961,
29946,
2314,
30004,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
1405,
29871,
29945,
29901,
30004,
13,
4706,
2989,
29918,
22017,
2459,
353,
6120,
29898,
524,
29898,
9675,
29889,
19218,
29961,
29945,
12622,
30004,
13,
1678,
1596,
703,
20284,
29901,
613,
17114,
20284,
8443,
13,
1678,
1596,
703,
12810,
29887,
12600,
2481,
313,
4548,
29889,
13235,
1125,
613,
485,
29887,
12600,
2481,
8443,
13,
1678,
1596,
703,
1252,
15362,
29901,
9162,
7639,
8443,
13,
1678,
1596,
703,
8942,
2230,
29901,
9162,
1027,
2230,
8443,
13,
1678,
1596,
703,
13658,
13435,
2459,
29901,
9162,
2989,
29918,
22017,
2459,
8443,
13,
2870,
29901,
30004,
13,
1678,
1596,
703,
21125,
29901,
11431,
29880,
2207,
9170,
529,
18010,
29958,
529,
485,
3174,
355,
29958,
529,
735,
15362,
29958,
529,
3601,
2230,
29958,
518,
22017,
2459,
29962,
1159,
30004,
13,
1678,
1596,
703,
735,
15362,
29871,
29900,
322,
29871,
29896,
671,
29871,
29896,
10868,
871,
1159,
30004,
13,
1678,
6876,
6278,
29896,
8443,
13,
30004,
13,
30004,
13,
29937,
5534,
6433,
30004,
13,
29937,
29934,
299,
353,
4036,
29889,
26776,
29898,
29896,
29906,
29941,
29946,
29945,
8443,
13,
18010,
353,
5159,
30004,
13,
4058,
1691,
4178,
9851,
353,
5159,
30004,
13,
6272,
353,
1027,
2272,
29889,
18649,
26471,
13,
30004,
13,
29937,
7472,
1353,
310,
23912,
278,
350,
29903,
508,
7150,
472,
278,
1021,
931,
30004,
13,
3317,
9851,
10380,
3145,
353,
29871,
29947,
30004,
13,
30004,
13,
30004,
13,
29937,
4236,
5418,
29901,
29871,
29941,
29900,
29900,
29885,
297,
4272,
29892,
29871,
29941,
29900,
29900,
29900,
286,
5377,
313,
29945,
2383,
14950,
29920,
7639,
8443,
13,
29937,
884,
901,
5190,
29899,
2218,
29883,
763,
5034,
304,
14950,
29920,
30004,
13,
5824,
1204,
353,
29871,
29896,
30004,
13,
22230,
28377,
12112,
353,
29871,
29900,
30004,
13,
22230,
29816,
353,
29871,
29900,
30004,
13,
22230,
7032,
287,
353,
29871,
29900,
30004,
13,
22230,
29931,
520,
353,
29871,
29900,
30004,
13,
30004,
13,
29925,
7508,
353,
29871,
29896,
29946,
30004,
13,
4283,
353,
29871,
29906,
29889,
29900,
29947,
30004,
13,
29881,
29900,
353,
29871,
29946,
29900,
29889,
29900,
30004,
13,
1707,
353,
29871,
29900,
965,
396,
20162,
17262,
363,
1286,
30004,
13,
29931,
29886,
430,
29900,
353,
29871,
29896,
29906,
29955,
29889,
29946,
29896,
30004,
13,
7239,
353,
29871,
29900,
30004,
13,
30004,
13,
23149,
29875,
353,
7442,
29889,
2378,
4197,
4668,
29955,
29892,
4668,
29947,
29892,
4668,
29929,
29892,
4668,
29896,
29900,
29892,
4668,
29896,
29896,
29892,
4668,
29896,
29906,
2314,
30004,
13,
361,
7639,
297,
518,
29900,
29892,
29896,
29892,
29946,
5387,
30004,
13,
1678,
286,
1144,
575,
29875,
353,
4771,
29875,
29961,
29945,
29892,
29906,
29962,
29871,
396,
29871,
29945,
386,
1948,
338,
28768,
29896,
29906,
29892,
29871,
29906,
299,
1897,
338,
350,
29956,
29896,
29906,
29945,
30004,
13,
23681,
7639,
1275,
29871,
29906,
29901,
30004,
13,
1678,
286,
1144,
575,
29875,
353,
448,
29896,
29896,
29906,
29889,
29900,
259,
396,
694,
15729,
29892,
577,
995,
515,
6155,
4155,
30004,
13,
23681,
7639,
297,
518,
29941,
29892,
29945,
5387,
30004,
13,
1678,
286,
1144,
575,
29875,
353,
7442,
29889,
9103,
29898,
23149,
29875,
29897,
444,
1222,
15362,
29871,
29941,
508,
671,
738,
4444,
29892,
577,
2125,
9212,
30004,
13,
29931,
572,
353,
349,
7508,
448,
286,
1144,
575,
29875,
30004,
13,
2158,
703,
9103,
613,
286,
1144,
575,
29875,
29892,
376,
29931,
572,
613,
365,
572,
8443,
13,
3317,
13398,
353,
270,
29900,
16395,
755,
29889,
29872,
1068,
3552,
29931,
572,
29899,
29931,
29886,
430,
29900,
6802,
29898,
29896,
29900,
29889,
29900,
29930,
4283,
4961,
30004,
13,
2158,
703,
3317,
13398,
29901,
613,
4236,
13398,
8443,
13,
30004,
13,
29937,
2967,
5073,
2174,
13561,
30004,
13,
5824,
29916,
353,
4236,
13398,
29974,
29896,
29900,
30004,
13,
5824,
29891,
353,
4236,
13398,
29974,
29896,
29900,
30004,
13,
29916,
3317,
353,
24512,
29916,
718,
4236,
13398,
718,
29871,
29906,
29900,
30004,
13,
29891,
3317,
353,
24512,
29891,
718,
4236,
13398,
718,
29871,
29906,
29900,
30004,
13,
30004,
13,
29937,
19012,
18533,
322,
788,
28169,
30004,
13,
361,
313,
6420,
1275,
29871,
29896,
1125,
30004,
13,
1678,
14770,
29889,
291,
26471,
13,
1678,
14770,
29889,
4532,
26471,
13,
1678,
4853,
353,
14770,
29889,
29887,
6854,
2141,
29887,
1113,
26471,
13,
1678,
396,
22615,
881,
367,
2967,
5073,
2602,
30004,
13,
1678,
4853,
29889,
1202,
29918,
442,
391,
29898,
572,
29873,
29889,
23495,
280,
3552,
5824,
29916,
29892,
24512,
29891,
511,
29871,
29941,
29892,
5445,
29922,
5574,
29892,
2927,
2433,
12692,
8785,
30004,
13,
1678,
4853,
29889,
1202,
29918,
442,
391,
29898,
572,
29873,
29889,
23495,
280,
3552,
5824,
29916,
29892,
24512,
29891,
511,
4236,
13398,
29892,
5445,
29922,
8824,
29892,
2927,
2433,
12692,
8785,
30004,
13,
30004,
13,
30004,
13,
1454,
474,
297,
3464,
29898,
29900,
29892,
22230,
20284,
1125,
30004,
13,
1678,
396,
590,
4247,
4893,
3785,
313,
262,
10887,
511,
2967,
5073,
1178,
18203,
2435,
313,
262,
2648,
2167,
8443,
13,
1678,
396,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
353,
29871,
29896,
29953,
1375,
30004,
13,
1678,
2943,
353,
590,
4247,
29898,
29875,
29892,
5824,
1204,
29892,
1029,
29887,
12600,
2481,
29892,
29906,
29900,
8443,
13,
1678,
7573,
29889,
4397,
29898,
3177,
8443,
13,
1678,
8829,
29889,
5014,
29898,
3286,
2415,
29898,
6272,
29892,
3177,
876,
30004,
13,
30004,
13,
29937,
19125,
1510,
30004,
13,
361,
313,
6420,
1275,
29871,
29896,
1125,
30004,
13,
1678,
14770,
29889,
29916,
2576,
4197,
29900,
29892,
921,
3317,
2314,
30004,
13,
1678,
14770,
29889,
29891,
2576,
4197,
29900,
29892,
343,
3317,
2314,
30004,
13,
1678,
14770,
29889,
4012,
26471,
13,
1678,
14770,
29889,
4294,
26471,
13,
30004,
13,
29937,
1369,
17402,
30004,
13,
6272,
29889,
3389,
29898,
29305,
29922,
3601,
2230,
8443,
13,
30004,
13,
29937,
1596,
22663,
322,
4078,
964,
934,
30004,
13,
2158,
703,
22230,
28377,
12112,
9162,
17114,
28377,
12112,
8443,
13,
30004,
13,
29937,
10272,
5864,
30004,
13,
29937,
4103,
2415,
27430,
297,
286,
29909,
515,
448,
29906,
304,
718,
29896,
29955,
270,
29933,
29885,
30004,
13,
28627,
353,
518,
29906,
29906,
29892,
29871,
29906,
29906,
29892,
29871,
29906,
29906,
29892,
29871,
29906,
29941,
29892,
462,
462,
418,
396,
390,
5800,
29914,
7228,
29900,
29901,
448,
29906,
636,
29896,
30004,
13,
539,
29906,
29946,
29892,
29871,
29906,
29946,
29892,
29871,
29906,
29946,
29892,
29871,
29906,
29945,
29892,
29871,
29906,
29945,
29892,
29871,
29906,
29945,
29892,
29871,
29906,
29945,
29892,
29871,
29906,
29953,
29892,
29871,
29941,
29896,
29892,
29871,
29941,
29906,
29892,
29871,
29941,
29946,
29892,
29871,
29941,
29945,
29892,
29871,
29946,
29946,
29892,
29871,
396,
17687,
29918,
8456,
3718,
29914,
7228,
29896,
29901,
29871,
29906,
636,
29896,
29946,
30004,
13,
539,
29947,
29906,
29892,
29871,
29947,
29945,
29892,
29871,
29929,
29900,
29892,
462,
462,
3986,
396,
17687,
29918,
8456,
3718,
29914,
7228,
29896,
29901,
29871,
29896,
29945,
636,
29896,
29955,
30004,
13,
539,
29896,
29900,
29945,
29892,
29871,
29896,
29896,
29945,
29892,
29871,
29896,
29906,
29945,
29962,
462,
462,
539,
396,
17687,
29918,
8456,
3718,
29914,
7228,
29896,
29974,
7228,
29906,
29901,
29871,
29896,
29947,
636,
29906,
29900,
30004,
13,
29937,
286,
29909,
353,
29871,
29929,
29900,
1678,
396,
1857,
4216,
363,
323,
29990,
353,
29871,
29896,
29955,
270,
29933,
29885,
30004,
13,
29963,
353,
29871,
29941,
29889,
29900,
268,
396,
11749,
22615,
30004,
13,
18616,
353,
2533,
29898,
29876,
29889,
18616,
363,
302,
297,
7573,
8443,
13,
27548,
353,
2533,
29898,
3177,
29889,
4058,
300,
29889,
1621,
603,
334,
323,
29990,
29961,
524,
29898,
3177,
29889,
4058,
300,
29889,
7508,
12248,
7240,
29906,
29962,
334,
478,
334,
2943,
29889,
18616,
363,
2943,
297,
7573,
29897,
847,
29871,
29896,
29872,
29953,
30004,
13,
30004,
13,
2158,
703,
27548,
313,
262,
435,
1125,
9162,
5864,
8443,
13,
2158,
703,
18616,
23912,
29901,
9162,
2665,
8443,
13,
2158,
703,
22017,
12112,
29901,
9162,
17114,
28377,
12112,
8443,
13,
2158,
703,
13556,
2347,
23912,
29901,
9162,
17114,
29816,
8443,
13,
2158,
703,
5014,
287,
23912,
29901,
9162,
17114,
7032,
287,
8443,
13,
2158,
703,
18767,
23912,
29901,
9162,
17114,
29931,
520,
8443,
13,
30004,
13,
29937,
848,
4805,
428,
6554,
30004,
13,
672,
353,
313,
18616,
29899,
22230,
28377,
12112,
6802,
7411,
29898,
18616,
8443,
13,
2158,
703,
8032,
29901,
613,
589,
8443,
13,
672,
353,
313,
22230,
29816,
6802,
7411,
29898,
18616,
8443,
13,
2158,
703,
8032,
1158,
29871,
29906,
29901,
613,
589,
8443,
13,
30004,
13,
29937,
445,
508,
367,
2309,
304,
3013,
18533,
7962,
30004,
13,
29937,
361,
313,
6420,
1275,
29871,
29896,
1125,
30004,
13,
396,
259,
1881,
877,
10923,
9041,
304,
6773,
2023,
1495,
30004,
13,
30004,
13,
29937,
4078,
7639,
848,
964,
263,
1418,
934,
393,
508,
367,
1303,
491,
321,
29889,
29887,
29889,
330,
3433,
5317,
30004,
13,
29937,
1024,
310,
934,
723,
367,
29901,
29871,
1518,
29900,
29889,
4130,
363,
7639,
29871,
29900,
30004,
13,
29888,
978,
353,
376,
4548,
29908,
718,
851,
29898,
735,
15362,
29897,
718,
11393,
4130,
19451,
13,
2158,
29898,
29888,
978,
8443,
13,
361,
2897,
29889,
2084,
29889,
275,
1445,
29898,
29888,
978,
1125,
30004,
13,
1678,
620,
353,
6634,
29876,
29908,
718,
851,
29898,
22230,
20284,
29897,
718,
376,
376,
718,
851,
29898,
22230,
28377,
12112,
29897,
718,
376,
376,
29871,
718,
851,
29898,
18616,
29897,
718,
376,
376,
718,
851,
29898,
27548,
8443,
13,
2870,
29901,
30004,
13,
1678,
620,
353,
12305,
22230,
20284,
17114,
28377,
12112,
17114,
4300,
29885,
6847,
6811,
497,
29923,
1089,
1927,
29905,
29876,
29908,
718,
851,
29898,
22230,
20284,
29897,
718,
376,
376,
718,
851,
29898,
22230,
28377,
12112,
29897,
718,
376,
376,
29871,
718,
851,
29898,
18616,
29897,
718,
376,
376,
718,
851,
29898,
27548,
8443,
13,
2541,
1722,
29898,
29888,
978,
29892,
376,
29874,
1159,
408,
590,
1445,
29901,
30004,
13,
1678,
590,
1445,
29889,
3539,
29898,
690,
8443,
13,
1357,
1445,
29889,
5358,
26471,
13,
30004,
13,
29937,
411,
1722,
877,
18010,
29889,
3945,
3788,
29893,
1495,
408,
302,
1445,
29901,
30004,
13,
29937,
268,
363,
302,
297,
7573,
29901,
30004,
13,
29937,
308,
302,
1445,
29889,
3539,
703,
8875,
6571,
426,
1012,
29876,
1642,
4830,
29898,
29876,
29889,
29916,
29892,
302,
29889,
29891,
29892,
302,
29889,
3177,
333,
876,
30004,
13,
29937,
411,
1722,
877,
6500,
342,
362,
29889,
3945,
742,
525,
29893,
1495,
408,
289,
1445,
29901,
30004,
13,
29937,
268,
289,
1445,
29889,
3539,
703,
8875,
6571,
426,
1012,
29876,
1642,
4830,
29898,
5824,
29916,
29892,
24512,
29891,
29892,
29871,
29900,
876,
30004,
13,
2
] |
cc_backend_lib/models/prediction.py | prio-data/cc_backend_lib | 0 | 1610586 |
import datetime
from typing import List,Dict,Union,Any, Optional
from pydantic import BaseModel
from geojson_pydantic import features
from . import scales
class PredictionProperties(BaseModel):
intensity: int
confidence: int
author: int
country: int
date: datetime.date
casualties: scales.CasualtyRange
class PredictionFeature(features.Feature):
class Meta:
QUERY_ORDER = ["id","shape","values","author_id","country_id","date"]
properties: Dict[str,Union[int,float,scales.CasualtyRange,datetime.date,str]] #PredictionProperties
@classmethod
def from_row(cls,id,shape,values,author_id,country_id,date,*_,**__):
return cls(
geometry = shape["geometry"],
properties = {
"intensity": values["intensity"],
"confidence": values["confidence"],
"author": author_id,
"country": country_id,
"date": date,
"casualties": scales.scaled(date,values["intensity"])
},
id=id
)
class PredFeatureCollection(features.FeatureCollection):
features: List[PredictionFeature]
@classmethod
def from_response(cls,rows):
return cls(
features = [PredictionFeature.from_row(**dict(r)) for r in rows]
)
class CountryProperties(BaseModel):
gwno: int
name: str
iso2c: str
class CountryFeature(features.Feature):
class Meta:
QUERY_ORDER = ["gwno","name","iso2c","shape"]
properties: CountryProperties
@classmethod
def from_row(cls,gwno,name,iso2c,shape):
return cls(
geometry = shape,
properties = CountryProperties(
gwno = gwno,
name = name,
iso2c = iso2c
)
)
class NonAnswer(BaseModel):
class Meta:
QUERY_ORDER = ["country_id","author_id","date"]
gwno: int
author: int
date: datetime.date
@classmethod
def from_row(cls,gwno,author,date):
return cls(
gwno = gwno,
author = author,
date = date
)
class QuarterlyData(BaseModel):
year: int
quarter: int
data: List[Any]
class PredictionsSummary(BaseModel):
confidence: float
intensity: float
accuracy: Optional[float]
coverage: Optional[float]
gwno: Optional[int]
@property
def evaluated(self):
return self.accuracy is not None and self.coverage is not None
class QuarterlyPredictionSummary(QuarterlyData):
data: List[PredictionsSummary]
| [
1,
29871,
13,
5215,
12865,
13,
3166,
19229,
1053,
2391,
29892,
21533,
29892,
19986,
29892,
10773,
29892,
28379,
13,
3166,
282,
2941,
7716,
1053,
7399,
3195,
13,
3166,
1737,
29877,
3126,
29918,
2272,
29881,
7716,
1053,
5680,
13,
3166,
869,
1053,
23431,
13,
13,
1990,
21099,
2463,
11857,
29898,
5160,
3195,
1125,
13,
1678,
26171,
29901,
938,
13,
1678,
16420,
29901,
938,
13,
1678,
4148,
29901,
938,
13,
1678,
4234,
29901,
938,
13,
1678,
2635,
29901,
12865,
29889,
1256,
13,
1678,
3209,
950,
2938,
29901,
23431,
29889,
29907,
294,
950,
1017,
6069,
13,
13,
1990,
21099,
2463,
19132,
29898,
22100,
29889,
19132,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
660,
29965,
24422,
29918,
22364,
353,
6796,
333,
3284,
12181,
3284,
5975,
3284,
8921,
29918,
333,
3284,
13509,
29918,
333,
3284,
1256,
3108,
13,
1678,
4426,
29901,
360,
919,
29961,
710,
29892,
19986,
29961,
524,
29892,
7411,
29892,
19529,
267,
29889,
29907,
294,
950,
1017,
6069,
29892,
12673,
29889,
1256,
29892,
710,
5262,
396,
23084,
2463,
11857,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
798,
29898,
25932,
29892,
333,
29892,
12181,
29892,
5975,
29892,
8921,
29918,
333,
29892,
13509,
29918,
333,
29892,
1256,
29892,
29930,
3383,
1068,
1649,
1125,
13,
4706,
736,
1067,
29879,
29898,
13,
9651,
16303,
353,
8267,
3366,
19156,
12436,
13,
9651,
4426,
353,
426,
13,
462,
1678,
376,
524,
575,
537,
1115,
1819,
3366,
524,
575,
537,
12436,
13,
462,
1678,
376,
5527,
5084,
1115,
1819,
3366,
5527,
5084,
12436,
13,
462,
1678,
376,
8921,
1115,
4148,
29918,
333,
29892,
13,
462,
1678,
376,
13509,
1115,
4234,
29918,
333,
29892,
13,
462,
1678,
376,
1256,
1115,
2635,
29892,
13,
462,
1678,
376,
9398,
950,
2938,
1115,
23431,
29889,
7052,
29881,
29898,
1256,
29892,
5975,
3366,
524,
575,
537,
20068,
13,
18884,
2981,
13,
9651,
1178,
29922,
333,
13,
4706,
1723,
13,
13,
1990,
21099,
19132,
7196,
29898,
22100,
29889,
19132,
7196,
1125,
13,
1678,
5680,
29901,
2391,
29961,
23084,
2463,
19132,
29962,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
5327,
29898,
25932,
29892,
5727,
1125,
13,
4706,
736,
1067,
29879,
29898,
13,
18884,
5680,
353,
518,
23084,
2463,
19132,
29889,
3166,
29918,
798,
29898,
1068,
8977,
29898,
29878,
876,
363,
364,
297,
4206,
29962,
13,
9651,
1723,
13,
13,
1990,
15456,
11857,
29898,
5160,
3195,
1125,
13,
1678,
330,
29893,
1217,
29901,
938,
13,
1678,
1024,
29901,
851,
13,
1678,
338,
29877,
29906,
29883,
29901,
851,
13,
13,
1990,
15456,
19132,
29898,
22100,
29889,
19132,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
660,
29965,
24422,
29918,
22364,
353,
6796,
29887,
29893,
1217,
3284,
978,
3284,
10718,
29906,
29883,
3284,
12181,
3108,
13,
13,
1678,
4426,
29901,
15456,
11857,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
798,
29898,
25932,
29892,
29887,
29893,
1217,
29892,
978,
29892,
10718,
29906,
29883,
29892,
12181,
1125,
13,
4706,
736,
1067,
29879,
29898,
13,
18884,
16303,
353,
8267,
29892,
13,
18884,
4426,
353,
15456,
11857,
29898,
13,
462,
4706,
330,
29893,
1217,
353,
330,
29893,
1217,
29892,
13,
462,
4706,
1024,
353,
1024,
29892,
13,
462,
4706,
338,
29877,
29906,
29883,
353,
338,
29877,
29906,
29883,
13,
462,
1678,
1723,
13,
18884,
1723,
13,
13,
1990,
10050,
22550,
29898,
5160,
3195,
1125,
13,
1678,
770,
20553,
29901,
13,
4706,
660,
29965,
24422,
29918,
22364,
353,
6796,
13509,
29918,
333,
3284,
8921,
29918,
333,
3284,
1256,
3108,
13,
13,
1678,
330,
29893,
1217,
29901,
938,
13,
1678,
4148,
29901,
938,
13,
1678,
2635,
29901,
12865,
29889,
1256,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
515,
29918,
798,
29898,
25932,
29892,
29887,
29893,
1217,
29892,
8921,
29892,
1256,
1125,
13,
4706,
736,
1067,
29879,
29898,
13,
18884,
330,
29893,
1217,
353,
330,
29893,
1217,
29892,
13,
18884,
4148,
353,
4148,
29892,
13,
18884,
2635,
353,
2635,
13,
13,
9651,
1723,
13,
13,
1990,
751,
4254,
368,
1469,
29898,
5160,
3195,
1125,
13,
1678,
1629,
29901,
938,
13,
1678,
12616,
29901,
938,
13,
1678,
848,
29901,
2391,
29961,
10773,
29962,
13,
13,
1990,
21099,
919,
1080,
26289,
29898,
5160,
3195,
1125,
13,
1678,
16420,
29901,
5785,
13,
1678,
26171,
29901,
5785,
13,
1678,
13600,
29901,
28379,
29961,
7411,
29962,
13,
1678,
23746,
29901,
28379,
29961,
7411,
29962,
13,
1678,
330,
29893,
1217,
29901,
28379,
29961,
524,
29962,
13,
1678,
732,
6799,
13,
1678,
822,
19030,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
562,
2764,
4135,
338,
451,
6213,
322,
1583,
29889,
11911,
482,
338,
451,
6213,
13,
13,
1990,
751,
4254,
368,
23084,
2463,
26289,
29898,
2182,
4254,
368,
1469,
1125,
13,
1678,
848,
29901,
2391,
29961,
23084,
919,
1080,
26289,
29962,
13,
2
] |
setup.py | ebinzacharias/ads_COVID-19 | 0 | 81180 | <filename>setup.py
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='An applied Data Science project on anaylzing the COVID-19 data.',
author='<NAME>',
license='MIT',
)
| [
1,
529,
9507,
29958,
14669,
29889,
2272,
13,
3166,
731,
21245,
8789,
1053,
1284,
29918,
8318,
29892,
6230,
13,
13,
14669,
29898,
13,
1678,
1024,
2433,
4351,
742,
13,
1678,
9741,
29922,
2886,
29918,
8318,
3285,
13,
1678,
1873,
2433,
29900,
29889,
29896,
29889,
29900,
742,
13,
1678,
6139,
2433,
2744,
7436,
3630,
9327,
2060,
373,
385,
388,
29880,
19583,
278,
19937,
29899,
29896,
29929,
848,
29889,
742,
13,
1678,
4148,
2433,
29966,
5813,
29958,
742,
13,
1678,
19405,
2433,
26349,
742,
13,
29897,
13,
2
] |
corpora_toolbox/utils/io.py | laurahzdz/corpora_toolbox | 0 | 21792 | import codecs
import os
# Function to save a string into a file
def save_string_in_file(string_text, file_name):
with codecs.open(file_name, "w", "utf-8") as f:
f.write(string_text)
f.close()
# Function to read all files in a dir with a specific extension
def read_files_in_dir_ext(dir_route, extension):
files = os.listdir(dir_route)
files_ext = [file for file in files if file.endswith(extension)]
return files_ext
# Function to read a file into a string
def read_file_in_string(file_name):
file_in_string = ""
with codecs.open(file_name, "r", "utf-8") as f:
file_in_string = f.read()
f.close()
return file_in_string
# Function to create a directory
def create_directory(directory):
if not os.path.exists(directory):
os.makedirs(directory)
return
| [
1,
1053,
775,
2395,
13,
5215,
2897,
13,
13,
29937,
6680,
304,
4078,
263,
1347,
964,
263,
934,
13,
1753,
4078,
29918,
1807,
29918,
262,
29918,
1445,
29898,
1807,
29918,
726,
29892,
934,
29918,
978,
1125,
13,
1678,
411,
775,
2395,
29889,
3150,
29898,
1445,
29918,
978,
29892,
376,
29893,
613,
376,
9420,
29899,
29947,
1159,
408,
285,
29901,
13,
4706,
285,
29889,
3539,
29898,
1807,
29918,
726,
29897,
13,
4706,
285,
29889,
5358,
580,
13,
13,
29937,
6680,
304,
1303,
599,
2066,
297,
263,
4516,
411,
263,
2702,
6081,
13,
1753,
1303,
29918,
5325,
29918,
262,
29918,
3972,
29918,
1062,
29898,
3972,
29918,
13134,
29892,
6081,
1125,
13,
13,
1678,
2066,
353,
2897,
29889,
1761,
3972,
29898,
3972,
29918,
13134,
29897,
13,
1678,
2066,
29918,
1062,
353,
518,
1445,
363,
934,
297,
2066,
565,
934,
29889,
1975,
2541,
29898,
17588,
4638,
13,
1678,
736,
2066,
29918,
1062,
13,
13,
13,
29937,
6680,
304,
1303,
263,
934,
964,
263,
1347,
13,
1753,
1303,
29918,
1445,
29918,
262,
29918,
1807,
29898,
1445,
29918,
978,
1125,
13,
1678,
934,
29918,
262,
29918,
1807,
353,
5124,
13,
13,
1678,
411,
775,
2395,
29889,
3150,
29898,
1445,
29918,
978,
29892,
376,
29878,
613,
376,
9420,
29899,
29947,
1159,
408,
285,
29901,
13,
4706,
934,
29918,
262,
29918,
1807,
353,
285,
29889,
949,
580,
13,
4706,
285,
29889,
5358,
580,
13,
13,
1678,
736,
934,
29918,
262,
29918,
1807,
13,
13,
29937,
6680,
304,
1653,
263,
3884,
13,
1753,
1653,
29918,
12322,
29898,
12322,
1125,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
12322,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
12322,
29897,
13,
1678,
736,
13,
2
] |
minidump/streams/CommentStreamA.py | lucasg/minidump | 1 | 144016 | <reponame>lucasg/minidump
#!/usr/bin/env python3
#
# Author:
# <NAME> (@skelsec)
#
class CommentStreamA:
def __init__(self):
self.data = None
@staticmethod
def parse(dir, buff):
csa = CommentStreamA()
buff.seek(dir.Location.Rva)
csa.data = buff.read(dir.Location.DataSize).decode()
return csa
def __str__(self):
return 'CommentA: %s' % self.data | [
1,
529,
276,
1112,
420,
29958,
29880,
1682,
294,
29887,
29914,
1195,
333,
3427,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
13,
29937,
13361,
29901,
13,
29937,
29871,
529,
5813,
29958,
20164,
808,
2870,
29883,
29897,
13,
29937,
13,
1990,
461,
3835,
29909,
29901,
13,
12,
1753,
4770,
2344,
12035,
1311,
1125,
13,
12,
12,
1311,
29889,
1272,
353,
6213,
13,
12,
13,
12,
29992,
7959,
5696,
13,
12,
1753,
6088,
29898,
3972,
29892,
20487,
1125,
13,
12,
12,
2395,
29874,
353,
461,
3835,
29909,
580,
13,
12,
12,
28040,
29889,
344,
1416,
29898,
3972,
29889,
6508,
29889,
29934,
1564,
29897,
13,
12,
12,
2395,
29874,
29889,
1272,
353,
20487,
29889,
949,
29898,
3972,
29889,
6508,
29889,
1469,
3505,
467,
13808,
580,
13,
12,
12,
2457,
274,
4977,
13,
12,
13,
12,
1753,
4770,
710,
12035,
1311,
1125,
13,
12,
12,
2457,
525,
20001,
29909,
29901,
1273,
29879,
29915,
1273,
1583,
29889,
1272,
2
] |
Section_7/word_count_repo/src/word_count.py | PacktPublishing/Software-Engineering-with-Python-3.x | 1 | 37378 | from project_utils import dict_to_file, get_word_count
if __name__ == "__main__":
inp_filename = 'sample.txt'
out_filename = 'count.csv'
print("Reading file ", inp_filename)
word_dict = get_word_count(inp_filename)
print("Output from get_word_count is")
print(word_dict)
print("Writing to file named", out_filename)
dict_to_file(word_dict, out_filename)
print("Done processing!")
| [
1,
515,
2060,
29918,
13239,
1053,
9657,
29918,
517,
29918,
1445,
29892,
679,
29918,
1742,
29918,
2798,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
12,
13,
1678,
297,
29886,
29918,
9507,
353,
525,
11249,
29889,
3945,
29915,
13,
268,
13,
1678,
714,
29918,
9507,
353,
525,
2798,
29889,
7638,
29915,
13,
13,
1678,
1596,
703,
6359,
292,
934,
9162,
297,
29886,
29918,
9507,
29897,
13,
13,
1678,
1734,
29918,
8977,
353,
679,
29918,
1742,
29918,
2798,
29898,
262,
29886,
29918,
9507,
29897,
13,
13,
1678,
1596,
703,
6466,
515,
679,
29918,
1742,
29918,
2798,
338,
1159,
13,
1678,
1596,
29898,
1742,
29918,
8977,
29897,
13,
13,
1678,
1596,
703,
29956,
768,
292,
304,
934,
4257,
613,
714,
29918,
9507,
29897,
13,
13,
1678,
9657,
29918,
517,
29918,
1445,
29898,
1742,
29918,
8977,
29892,
714,
29918,
9507,
29897,
13,
13,
1678,
1596,
703,
25632,
9068,
29991,
1159,
13,
2
] |
PythonTestCase/run.py | TarsCloud/TarsDemo | 7 | 185586 | #!/usr/bin/python3
# coding: utf-8
from Projects.PHP import PHPServant
from Projects.GoLang import GoLangServant
from Projects.NodeJs import NodeJsServant
from Projects.Java import JavaServant
from Projects.Cpp import CppServant
import threading as td
import time
import optparse
import sys
import importlib
importlib.reload(sys)
# get web url and user token from runtime parameters
def get_web_url_and_token():
usage = "python %prog -u/--url <the url of framework web> -n/--nodeip <the ip of your application node> -t/--target <the target application to test>"
parser = optparse.OptionParser(usage=usage)
parser.add_option('-u', '--url', dest='url', type='string', help='the url of framework web', default='')
parser.add_option('-n', '--nodeip', dest='nodeip', type='string', help='the ip of your application node')
options, _ = parser.parse_args()
if options.url is None:
parser.print_help()
exit(1)
if options.nodeip is None:
parser.print_help()
exit(1)
return options.url, options.nodeip
# publish and test servants in multi-threading
def publish_and_test_servants():
# publish
php_testcase = td.Thread(target=php_serv.deploy_publish_and_test, args=())
php_testcase.start()
golang_testcase = td.Thread(target=golang_serv.deploy_publish_and_test, args=())
golang_testcase.start()
nodejs_testcase = td.Thread(target=nodejs_serv.deploy_publish_and_test, args=())
nodejs_testcase.start()
java_testcase = td.Thread(target=java_serv.deploy_publish_and_test, args=())
java_testcase.start()
cpp_testcase = td.Thread(target=cpp_serv.deploy_publish_and_test, args=())
cpp_testcase.start()
# wait
php_testcase.join()
golang_testcase.join()
nodejs_testcase.join()
java_testcase.join()
cpp_testcase.join()
# get runtime parameters
url, nodeip = get_web_url_and_token()
# initialize languages test cases
php_serv = PHPServant(url, nodeip)
golang_serv = GoLangServant(url, nodeip)
nodejs_serv = NodeJsServant(url, nodeip)
java_serv = JavaServant(url, nodeip)
cpp_serv = CppServant(url, nodeip)
t1 = time.time()
if __name__ == '__main__':
print("=====================================Publishing And Testing======================================")
# deploy servant
publish = td.Thread(target=publish_and_test_servants)
publish.start()
publish.join()
# report
print("============================================Reporting============================================")
php_serv.report()
golang_serv.report()
nodejs_serv.report()
java_serv.report()
cpp_serv.report()
failed_total = 0
failed_total += len(php_serv.failed_tests)
failed_total += len(golang_serv.failed_tests)
failed_total += len(nodejs_serv.failed_tests)
failed_total += len(java_serv.failed_tests)
failed_total += len(cpp_serv.failed_tests)
t2 = time.time()
duration = t2 - t1
print("Duration: {0} seconds".format(duration))
if failed_total > 0:
exit(255)
exit(0)
| [
1,
18787,
4855,
29914,
2109,
29914,
4691,
29941,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
13,
3166,
8010,
29879,
29889,
17130,
1053,
5048,
6889,
424,
13,
3166,
8010,
29879,
29889,
8120,
29931,
574,
1053,
2921,
29931,
574,
6889,
424,
13,
3166,
8010,
29879,
29889,
4247,
25498,
1053,
9071,
25498,
6889,
424,
13,
3166,
8010,
29879,
29889,
8404,
1053,
3355,
6889,
424,
13,
3166,
8010,
29879,
29889,
29907,
407,
1053,
315,
407,
6889,
424,
13,
5215,
3244,
292,
408,
22599,
13,
5215,
931,
13,
5215,
3523,
5510,
13,
5215,
10876,
13,
5215,
1053,
1982,
13,
13,
5215,
1982,
29889,
28120,
29898,
9675,
29897,
13,
13,
29937,
679,
1856,
3142,
322,
1404,
5993,
515,
10073,
4128,
13,
1753,
679,
29918,
2676,
29918,
2271,
29918,
392,
29918,
6979,
7295,
13,
1678,
8744,
353,
376,
4691,
1273,
29097,
448,
29884,
29914,
489,
2271,
529,
1552,
3142,
310,
6890,
1856,
29958,
448,
29876,
29914,
489,
3177,
666,
529,
1552,
10377,
310,
596,
2280,
2943,
29958,
448,
29873,
29914,
489,
5182,
529,
1552,
3646,
2280,
304,
1243,
11903,
13,
1678,
13812,
353,
3523,
5510,
29889,
8375,
11726,
29898,
21125,
29922,
21125,
29897,
13,
1678,
13812,
29889,
1202,
29918,
3385,
877,
29899,
29884,
742,
525,
489,
2271,
742,
2731,
2433,
2271,
742,
1134,
2433,
1807,
742,
1371,
2433,
1552,
3142,
310,
6890,
1856,
742,
2322,
2433,
1495,
13,
1678,
13812,
29889,
1202,
29918,
3385,
877,
29899,
29876,
742,
525,
489,
3177,
666,
742,
2731,
2433,
3177,
666,
742,
1134,
2433,
1807,
742,
1371,
2433,
1552,
10377,
310,
596,
2280,
2943,
1495,
13,
1678,
3987,
29892,
903,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
565,
3987,
29889,
2271,
338,
6213,
29901,
13,
4706,
13812,
29889,
2158,
29918,
8477,
580,
13,
4706,
6876,
29898,
29896,
29897,
13,
1678,
565,
3987,
29889,
3177,
666,
338,
6213,
29901,
13,
4706,
13812,
29889,
2158,
29918,
8477,
580,
13,
4706,
6876,
29898,
29896,
29897,
13,
1678,
736,
3987,
29889,
2271,
29892,
3987,
29889,
3177,
666,
13,
13,
13,
29937,
9805,
322,
1243,
26202,
297,
2473,
29899,
7097,
292,
13,
1753,
9805,
29918,
392,
29918,
1688,
29918,
2140,
1934,
7295,
13,
1678,
396,
9805,
13,
1678,
3989,
29918,
1688,
4878,
353,
22599,
29889,
4899,
29898,
5182,
29922,
1961,
29918,
2140,
29889,
16519,
29918,
23679,
29918,
392,
29918,
1688,
29892,
6389,
29922,
3101,
13,
1678,
3989,
29918,
1688,
4878,
29889,
2962,
580,
13,
13,
1678,
15192,
574,
29918,
1688,
4878,
353,
22599,
29889,
4899,
29898,
5182,
29922,
29887,
324,
574,
29918,
2140,
29889,
16519,
29918,
23679,
29918,
392,
29918,
1688,
29892,
6389,
29922,
3101,
13,
1678,
15192,
574,
29918,
1688,
4878,
29889,
2962,
580,
13,
13,
1678,
2943,
1315,
29918,
1688,
4878,
353,
22599,
29889,
4899,
29898,
5182,
29922,
3177,
1315,
29918,
2140,
29889,
16519,
29918,
23679,
29918,
392,
29918,
1688,
29892,
6389,
29922,
3101,
13,
1678,
2943,
1315,
29918,
1688,
4878,
29889,
2962,
580,
13,
13,
1678,
2115,
29918,
1688,
4878,
353,
22599,
29889,
4899,
29898,
5182,
29922,
1645,
29918,
2140,
29889,
16519,
29918,
23679,
29918,
392,
29918,
1688,
29892,
6389,
29922,
3101,
13,
1678,
2115,
29918,
1688,
4878,
29889,
2962,
580,
13,
13,
1678,
274,
407,
29918,
1688,
4878,
353,
22599,
29889,
4899,
29898,
5182,
29922,
8223,
29918,
2140,
29889,
16519,
29918,
23679,
29918,
392,
29918,
1688,
29892,
6389,
29922,
3101,
13,
1678,
274,
407,
29918,
1688,
4878,
29889,
2962,
580,
13,
13,
1678,
396,
4480,
13,
1678,
3989,
29918,
1688,
4878,
29889,
7122,
580,
13,
1678,
15192,
574,
29918,
1688,
4878,
29889,
7122,
580,
13,
1678,
2943,
1315,
29918,
1688,
4878,
29889,
7122,
580,
13,
1678,
2115,
29918,
1688,
4878,
29889,
7122,
580,
13,
1678,
274,
407,
29918,
1688,
4878,
29889,
7122,
580,
13,
13,
13,
29937,
679,
10073,
4128,
13,
2271,
29892,
2943,
666,
353,
679,
29918,
2676,
29918,
2271,
29918,
392,
29918,
6979,
580,
13,
13,
29937,
11905,
10276,
1243,
4251,
13,
1961,
29918,
2140,
353,
5048,
6889,
424,
29898,
2271,
29892,
2943,
666,
29897,
13,
29887,
324,
574,
29918,
2140,
353,
2921,
29931,
574,
6889,
424,
29898,
2271,
29892,
2943,
666,
29897,
13,
3177,
1315,
29918,
2140,
353,
9071,
25498,
6889,
424,
29898,
2271,
29892,
2943,
666,
29897,
13,
1645,
29918,
2140,
353,
3355,
6889,
424,
29898,
2271,
29892,
2943,
666,
29897,
13,
8223,
29918,
2140,
353,
315,
407,
6889,
424,
29898,
2271,
29892,
2943,
666,
29897,
13,
13,
29873,
29896,
353,
931,
29889,
2230,
580,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1596,
703,
9166,
9166,
2751,
29922,
21076,
1674,
292,
1126,
4321,
292,
9166,
9166,
2751,
26359,
29897,
13,
1678,
396,
7246,
21649,
13,
1678,
9805,
353,
22599,
29889,
4899,
29898,
5182,
29922,
23679,
29918,
392,
29918,
1688,
29918,
2140,
1934,
29897,
13,
1678,
9805,
29889,
2962,
580,
13,
1678,
9805,
29889,
7122,
580,
13,
13,
1678,
396,
3461,
13,
1678,
1596,
703,
9166,
9166,
4936,
2751,
13020,
292,
9166,
9166,
4936,
25512,
543,
29897,
13,
1678,
3989,
29918,
2140,
29889,
12276,
580,
13,
1678,
15192,
574,
29918,
2140,
29889,
12276,
580,
13,
1678,
2943,
1315,
29918,
2140,
29889,
12276,
580,
13,
1678,
2115,
29918,
2140,
29889,
12276,
580,
13,
1678,
274,
407,
29918,
2140,
29889,
12276,
580,
13,
13,
1678,
5229,
29918,
7827,
353,
29871,
29900,
13,
1678,
5229,
29918,
7827,
4619,
7431,
29898,
1961,
29918,
2140,
29889,
26061,
29918,
21150,
29897,
13,
1678,
5229,
29918,
7827,
4619,
7431,
29898,
29887,
324,
574,
29918,
2140,
29889,
26061,
29918,
21150,
29897,
13,
1678,
5229,
29918,
7827,
4619,
7431,
29898,
3177,
1315,
29918,
2140,
29889,
26061,
29918,
21150,
29897,
13,
1678,
5229,
29918,
7827,
4619,
7431,
29898,
1645,
29918,
2140,
29889,
26061,
29918,
21150,
29897,
13,
1678,
5229,
29918,
7827,
4619,
7431,
29898,
8223,
29918,
2140,
29889,
26061,
29918,
21150,
29897,
13,
13,
1678,
260,
29906,
353,
931,
29889,
2230,
580,
13,
1678,
14385,
353,
260,
29906,
448,
260,
29896,
13,
1678,
1596,
703,
18984,
29901,
426,
29900,
29913,
6923,
1642,
4830,
29898,
19708,
876,
13,
13,
1678,
565,
5229,
29918,
7827,
1405,
29871,
29900,
29901,
13,
4706,
6876,
29898,
29906,
29945,
29945,
29897,
13,
13,
1678,
6876,
29898,
29900,
29897,
13,
2
] |
release/scripts/presets/camera/Samsung_Galaxy_S4.py | rbabari/blender | 365 | 50315 | <reponame>rbabari/blender
import bpy
bpy.context.camera.sensor_width = 4.8
bpy.context.camera.sensor_height = 3.6
bpy.context.camera.lens = 4.20
bpy.context.camera.sensor_fit = 'HORIZONTAL'
| [
1,
529,
276,
1112,
420,
29958,
6050,
370,
1306,
29914,
2204,
1581,
13,
5215,
289,
2272,
13,
29890,
2272,
29889,
4703,
29889,
26065,
29889,
29879,
6073,
29918,
2103,
353,
29871,
29946,
29889,
29947,
13,
29890,
2272,
29889,
4703,
29889,
26065,
29889,
29879,
6073,
29918,
3545,
353,
29871,
29941,
29889,
29953,
13,
29890,
2272,
29889,
4703,
29889,
26065,
29889,
29880,
575,
353,
29871,
29946,
29889,
29906,
29900,
13,
29890,
2272,
29889,
4703,
29889,
26065,
29889,
29879,
6073,
29918,
9202,
353,
525,
29950,
1955,
26664,
1164,
29911,
1964,
29915,
13,
2
] |
rec/urls.py | danielpine/tankonline | 0 | 99311 | <filename>rec/urls.py
# -*-coding:utf-8 -*-
from . import testdb
from . import views
from django.urls import path
from django.conf.urls import url
urlpatterns = [
path('', views.index, name='index'),
url(r'^websocket/', views.websocket_test),
url(r'^tank/', views.tank),
url(r'^snake/', views.snake),
] | [
1,
529,
9507,
29958,
3757,
29914,
26045,
29889,
2272,
13,
29937,
448,
29930,
29899,
29883,
3689,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
3166,
869,
1053,
1243,
2585,
13,
3166,
869,
1053,
8386,
13,
3166,
9557,
29889,
26045,
1053,
2224,
13,
3166,
9557,
29889,
5527,
29889,
26045,
1053,
3142,
13,
13,
2271,
11037,
29879,
353,
518,
13,
1678,
2224,
877,
742,
8386,
29889,
2248,
29892,
1024,
2433,
2248,
5477,
13,
1678,
3142,
29898,
29878,
29915,
29985,
2676,
11514,
29914,
742,
8386,
29889,
2676,
11514,
29918,
1688,
511,
13,
1678,
3142,
29898,
29878,
29915,
29985,
29873,
804,
29914,
742,
8386,
29889,
29873,
804,
511,
13,
1678,
3142,
29898,
29878,
29915,
29985,
29879,
21040,
29914,
742,
8386,
29889,
29879,
21040,
511,
13,
29962,
2
] |
webexteamssdk/api/messages.py | coreGreenberet/webexteamssdk | 0 | 129093 | <filename>webexteamssdk/api/messages.py<gh_stars>0
# -*- coding: utf-8 -*-
"""Webex Teams Messages API wrapper.
Copyright (c) 2016-2019 Cisco and/or its affiliates.
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.
"""
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
from builtins import *
from past.builtins import basestring
from requests_toolbelt import MultipartEncoder
from webexteamssdk.models.cards import AdaptiveCard
from ..generator_containers import generator_container
from ..restsession import RestSession
from ..utils import (
check_type, dict_from_items_with_values, is_local_file, is_web_url,
make_attachment, open_local_file,
)
API_ENDPOINT = 'messages'
OBJECT_TYPE = 'message'
class MessagesAPI(object):
"""Webex Teams Messages API.
Wraps the Webex Teams Messages API and exposes the API as native Python
methods that return native Python objects.
"""
def __init__(self, session, object_factory):
"""Init a new MessagesAPI object with the provided RestSession.
Args:
session(RestSession): The RESTful session object to be used for
API calls to the Webex Teams service.
Raises:
TypeError: If the parameter types are incorrect.
"""
check_type(session, RestSession)
super(MessagesAPI, self).__init__()
self._session = session
self._object_factory = object_factory
@generator_container
def list(self, roomId, mentionedPeople=None, before=None,
beforeMessage=None, max=None, **request_parameters):
"""Lists messages in a room.
Each message will include content attachments if present.
The list API sorts the messages in descending order by creation date.
This method supports Webex Teams's implementation of RFC5988 Web
Linking to provide pagination support. It returns a generator
container that incrementally yields all messages returned by the
query. The generator will automatically request additional 'pages' of
responses from Webex as needed until all responses have been returned.
The container makes the generator safe for reuse. A new API call will
be made, using the same parameters that were specified when the
generator was created, every time a new iterator is requested from the
container.
Args:
roomId(basestring): List messages for a room, by ID.
mentionedPeople(basestring): List messages where the caller is
mentioned by specifying "me" or the caller `personId`.
before(basestring): List messages sent before a date and time, in
ISO8601 format.
beforeMessage(basestring): List messages sent before a message,
by ID.
max(int): Limit the maximum number of items returned from the Webex
Teams service per request.
**request_parameters: Additional request parameters (provides
support for parameters that may be added in the future).
Returns:
GeneratorContainer: A GeneratorContainer which, when iterated,
yields the messages returned by the Webex Teams query.
Raises:
TypeError: If the parameter types are incorrect.
ApiError: If the Webex Teams cloud returns an error.
"""
check_type(roomId, basestring)
check_type(mentionedPeople, basestring, optional=True)
check_type(before, basestring, optional=True)
check_type(beforeMessage, basestring, optional=True)
check_type(max, int, optional=True)
params = dict_from_items_with_values(
request_parameters,
roomId=roomId,
mentionedPeople=mentionedPeople,
before=before,
beforeMessage=beforeMessage,
max=max,
)
# API request - get items
items = self._session.get_items(API_ENDPOINT, params=params)
# Yield message objects created from the returned items JSON objects
for item in items:
yield self._object_factory(OBJECT_TYPE, item)
def create(self, roomId=None, toPersonId=None, toPersonEmail=None,
text=None, markdown=None, files=None, attachments=None,
**request_parameters):
"""Post a message to a room.
The files parameter is a list, which accepts multiple values to allow
for future expansion, but currently only one file may be included with
the message.
Args:
roomId(basestring): The room ID.
toPersonId(basestring): The ID of the recipient when sending a
private 1:1 message.
toPersonEmail(basestring): The email address of the recipient when
sending a private 1:1 message.
text(basestring): The message, in plain text. If `markdown` is
specified this parameter may be optionally used to provide
alternate text for UI clients that do not support rich text.
markdown(basestring): The message, in markdown format.
files(list): A list of public URL(s) or local path(s) to files to
be posted into the room. Only one file is allowed per message.
attachments(list): Content attachments to attach to the message.
See the Cards Guide for more information.
**request_parameters: Additional request parameters (provides
support for parameters that may be added in the future).
Returns:
Message: A Message object with the details of the created message.
Raises:
TypeError: If the parameter types are incorrect.
ApiError: If the Webex Teams cloud returns an error.
ValueError: If the files parameter is a list of length > 1, or if
the string in the list (the only element in the list) does not
contain a valid URL or path to a local file.
"""
check_type(roomId, basestring, optional=True)
check_type(toPersonId, basestring, optional=True)
check_type(toPersonEmail, basestring, optional=True)
check_type(text, basestring, optional=True)
check_type(markdown, basestring, optional=True)
check_type(files, list, optional=True)
check_type(attachments, list, optional=True)
if files:
if len(files) > 1:
raise ValueError("The `files` parameter should be a list with "
"exactly one (1) item. The files parameter "
"is a list, which accepts multiple values to "
"allow for future expansion, but currently "
"only one file may be included with the "
"message.")
check_type(files[0], basestring)
else:
files = None
# Process and serialize attachments
if attachments:
for item, attachment in enumerate(attachments):
check_type(attachment, (dict, AdaptiveCard))
if isinstance(attachments, AdaptiveCard):
attachments[item] = make_attachment(attachment)
post_data = dict_from_items_with_values(
request_parameters,
roomId=roomId,
toPersonId=toPersonId,
toPersonEmail=toPersonEmail,
text=text,
markdown=markdown,
files=files,
attachments=attachments,
)
# API request
if not files or is_web_url(files[0]):
# Standard JSON post
json_data = self._session.post(API_ENDPOINT, json=post_data)
elif is_local_file(files[0]):
# Multipart MIME post
try:
post_data['files'] = open_local_file(files[0])
multipart_data = MultipartEncoder(post_data)
headers = {'Content-type': multipart_data.content_type}
json_data = self._session.post(API_ENDPOINT,
headers=headers,
data=multipart_data)
finally:
post_data['files'].file_object.close()
else:
raise ValueError("The `files` parameter does not contain a vaild "
"URL or path to a local file.")
# Return a message object created from the response JSON data
return self._object_factory(OBJECT_TYPE, json_data)
def get(self, messageId):
"""Get the details of a message, by ID.
Args:
messageId(basestring): The ID of the message to be retrieved.
Returns:
Message: A Message object with the details of the requested
message.
Raises:
TypeError: If the parameter types are incorrect.
ApiError: If the Webex Teams cloud returns an error.
"""
check_type(messageId, basestring)
# API request
json_data = self._session.get(API_ENDPOINT + '/' + messageId)
# Return a message object created from the response JSON data
return self._object_factory(OBJECT_TYPE, json_data)
def delete(self, messageId):
"""Delete a message.
Args:
messageId(basestring): The ID of the message to be deleted.
Raises:
TypeError: If the parameter types are incorrect.
ApiError: If the Webex Teams cloud returns an error.
"""
check_type(messageId, basestring)
# API request
self._session.delete(API_ENDPOINT + '/' + messageId)
| [
1,
529,
9507,
29958,
2676,
735,
14318,
893,
8181,
29914,
2754,
29914,
19158,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
3609,
735,
23570,
11946,
1179,
3450,
14476,
29889,
13,
13,
11882,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29953,
29899,
29906,
29900,
29896,
29929,
315,
275,
1111,
322,
29914,
272,
967,
23736,
1078,
29889,
13,
13,
27293,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
974,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
262,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
517,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
9708,
583,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29888,
595,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
13,
1576,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
9708,
583,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
13,
28350,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29902,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29943,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
20656,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
5265,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
12015,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
6156,
7818,
12982,
1525,
29889,
13,
15945,
29908,
13,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
313,
13,
1678,
8380,
29918,
5215,
29892,
13,
1678,
8542,
29892,
13,
1678,
1596,
29918,
2220,
29892,
13,
1678,
29104,
29918,
20889,
1338,
29892,
13,
29897,
13,
13,
3166,
4240,
1144,
1053,
334,
13,
13,
3166,
4940,
29889,
16145,
1144,
1053,
2362,
342,
5393,
13,
3166,
7274,
29918,
10154,
29890,
2152,
1053,
9683,
27494,
8566,
6119,
13,
13,
3166,
1856,
735,
14318,
893,
8181,
29889,
9794,
29889,
28160,
1053,
23255,
415,
573,
13200,
13,
3166,
6317,
27959,
29918,
1285,
475,
414,
1053,
15299,
29918,
7611,
13,
3166,
6317,
5060,
7924,
1053,
11654,
7317,
13,
3166,
6317,
13239,
1053,
313,
13,
1678,
1423,
29918,
1853,
29892,
9657,
29918,
3166,
29918,
7076,
29918,
2541,
29918,
5975,
29892,
338,
29918,
2997,
29918,
1445,
29892,
338,
29918,
2676,
29918,
2271,
29892,
13,
1678,
1207,
29918,
14930,
358,
29892,
1722,
29918,
2997,
29918,
1445,
29892,
13,
29897,
13,
13,
13,
8787,
29918,
1430,
11191,
6992,
29911,
353,
525,
19158,
29915,
13,
14824,
17637,
29918,
11116,
353,
525,
4906,
29915,
13,
13,
13,
1990,
11946,
1179,
8787,
29898,
3318,
1125,
13,
1678,
9995,
3609,
735,
23570,
11946,
1179,
3450,
29889,
13,
13,
1678,
399,
336,
567,
278,
2563,
735,
23570,
11946,
1179,
3450,
322,
429,
10590,
278,
3450,
408,
7531,
5132,
13,
1678,
3519,
393,
736,
7531,
5132,
3618,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4867,
29892,
1203,
29918,
14399,
1125,
13,
4706,
9995,
6644,
263,
716,
11946,
1179,
8787,
1203,
411,
278,
4944,
11654,
7317,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
4867,
29898,
15078,
7317,
1125,
450,
16759,
1319,
4867,
1203,
304,
367,
1304,
363,
13,
18884,
3450,
5717,
304,
278,
2563,
735,
23570,
2669,
29889,
13,
13,
4706,
390,
1759,
267,
29901,
13,
9651,
20948,
29901,
960,
278,
3443,
4072,
526,
10240,
29889,
13,
13,
4706,
9995,
13,
4706,
1423,
29918,
1853,
29898,
7924,
29892,
11654,
7317,
29897,
13,
4706,
2428,
29898,
25510,
8787,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
3032,
7924,
353,
4867,
13,
4706,
1583,
3032,
3318,
29918,
14399,
353,
1203,
29918,
14399,
13,
13,
1678,
732,
27959,
29918,
7611,
13,
1678,
822,
1051,
29898,
1311,
29892,
5716,
1204,
29892,
5276,
15666,
1991,
29922,
8516,
29892,
1434,
29922,
8516,
29892,
13,
632,
1434,
3728,
29922,
8516,
29892,
4236,
29922,
8516,
29892,
3579,
3827,
29918,
16744,
1125,
13,
4706,
9995,
1293,
29879,
7191,
297,
263,
5716,
29889,
13,
13,
4706,
7806,
2643,
674,
3160,
2793,
10641,
1860,
565,
2198,
29889,
13,
13,
4706,
450,
1051,
3450,
23551,
278,
7191,
297,
5153,
2548,
1797,
491,
11265,
2635,
29889,
13,
13,
4706,
910,
1158,
11286,
2563,
735,
23570,
29915,
29879,
5314,
310,
390,
8610,
29945,
29929,
29947,
29947,
2563,
13,
4706,
6645,
292,
304,
3867,
10203,
3381,
2304,
29889,
29871,
739,
3639,
263,
15299,
13,
4706,
5639,
393,
11924,
635,
17498,
599,
7191,
4133,
491,
278,
13,
4706,
2346,
29889,
29871,
450,
15299,
674,
6336,
2009,
5684,
525,
12292,
29915,
310,
13,
4706,
20890,
515,
2563,
735,
408,
4312,
2745,
599,
20890,
505,
1063,
4133,
29889,
13,
4706,
450,
5639,
3732,
278,
15299,
9109,
363,
24270,
29889,
29871,
319,
716,
3450,
1246,
674,
13,
4706,
367,
1754,
29892,
773,
278,
1021,
4128,
393,
892,
6790,
746,
278,
13,
4706,
15299,
471,
2825,
29892,
1432,
931,
263,
716,
20380,
338,
13877,
515,
278,
13,
4706,
5639,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
5716,
1204,
29898,
6500,
342,
5393,
1125,
2391,
7191,
363,
263,
5716,
29892,
491,
3553,
29889,
13,
9651,
5276,
15666,
1991,
29898,
6500,
342,
5393,
1125,
2391,
7191,
988,
278,
24959,
338,
13,
18884,
5276,
491,
22146,
376,
1004,
29908,
470,
278,
24959,
421,
10532,
1204,
1412,
13,
9651,
1434,
29898,
6500,
342,
5393,
1125,
2391,
7191,
2665,
1434,
263,
2635,
322,
931,
29892,
297,
13,
18884,
17723,
29947,
29953,
29900,
29896,
3402,
29889,
13,
9651,
1434,
3728,
29898,
6500,
342,
5393,
1125,
2391,
7191,
2665,
1434,
263,
2643,
29892,
13,
18884,
491,
3553,
29889,
13,
9651,
4236,
29898,
524,
1125,
9628,
277,
278,
7472,
1353,
310,
4452,
4133,
515,
278,
2563,
735,
13,
18884,
23570,
2669,
639,
2009,
29889,
13,
9651,
3579,
3827,
29918,
16744,
29901,
3462,
3245,
2009,
4128,
313,
16123,
2247,
13,
18884,
2304,
363,
4128,
393,
1122,
367,
2715,
297,
278,
5434,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
3251,
1061,
7895,
29901,
319,
3251,
1061,
7895,
607,
29892,
746,
4256,
630,
29892,
13,
9651,
17498,
278,
7191,
4133,
491,
278,
2563,
735,
23570,
2346,
29889,
13,
13,
4706,
390,
1759,
267,
29901,
13,
9651,
20948,
29901,
960,
278,
3443,
4072,
526,
10240,
29889,
13,
9651,
29749,
2392,
29901,
960,
278,
2563,
735,
23570,
9570,
3639,
385,
1059,
29889,
13,
13,
4706,
9995,
13,
4706,
1423,
29918,
1853,
29898,
8345,
1204,
29892,
2362,
342,
5393,
29897,
13,
4706,
1423,
29918,
1853,
29898,
358,
28487,
15666,
1991,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
11083,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
11083,
3728,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
3317,
29892,
938,
29892,
13136,
29922,
5574,
29897,
13,
13,
4706,
8636,
353,
9657,
29918,
3166,
29918,
7076,
29918,
2541,
29918,
5975,
29898,
13,
9651,
2009,
29918,
16744,
29892,
13,
9651,
5716,
1204,
29922,
8345,
1204,
29892,
13,
9651,
5276,
15666,
1991,
29922,
358,
28487,
15666,
1991,
29892,
13,
9651,
1434,
29922,
11083,
29892,
13,
9651,
1434,
3728,
29922,
11083,
3728,
29892,
13,
9651,
4236,
29922,
3317,
29892,
13,
4706,
1723,
13,
13,
4706,
396,
3450,
2009,
448,
679,
4452,
13,
4706,
4452,
353,
1583,
3032,
7924,
29889,
657,
29918,
7076,
29898,
8787,
29918,
1430,
11191,
6992,
29911,
29892,
8636,
29922,
7529,
29897,
13,
13,
4706,
396,
612,
969,
2643,
3618,
2825,
515,
278,
4133,
4452,
4663,
3618,
13,
4706,
363,
2944,
297,
4452,
29901,
13,
9651,
7709,
1583,
3032,
3318,
29918,
14399,
29898,
14824,
17637,
29918,
11116,
29892,
2944,
29897,
13,
13,
1678,
822,
1653,
29898,
1311,
29892,
5716,
1204,
29922,
8516,
29892,
304,
7435,
1204,
29922,
8516,
29892,
304,
7435,
9823,
29922,
8516,
29892,
13,
1669,
1426,
29922,
8516,
29892,
2791,
3204,
29922,
8516,
29892,
2066,
29922,
8516,
29892,
10641,
1860,
29922,
8516,
29892,
13,
1669,
3579,
3827,
29918,
16744,
1125,
13,
4706,
9995,
6747,
263,
2643,
304,
263,
5716,
29889,
13,
13,
4706,
450,
2066,
3443,
338,
263,
1051,
29892,
607,
21486,
2999,
1819,
304,
2758,
13,
4706,
363,
5434,
13184,
29892,
541,
5279,
871,
697,
934,
1122,
367,
5134,
411,
13,
4706,
278,
2643,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
5716,
1204,
29898,
6500,
342,
5393,
1125,
450,
5716,
3553,
29889,
13,
9651,
304,
7435,
1204,
29898,
6500,
342,
5393,
1125,
450,
3553,
310,
278,
23957,
993,
746,
9348,
263,
13,
18884,
2024,
29871,
29896,
29901,
29896,
2643,
29889,
13,
9651,
304,
7435,
9823,
29898,
6500,
342,
5393,
1125,
450,
4876,
3211,
310,
278,
23957,
993,
746,
13,
18884,
9348,
263,
2024,
29871,
29896,
29901,
29896,
2643,
29889,
13,
9651,
1426,
29898,
6500,
342,
5393,
1125,
450,
2643,
29892,
297,
8656,
1426,
29889,
960,
421,
3502,
3204,
29952,
338,
13,
18884,
6790,
445,
3443,
1122,
367,
2984,
635,
1304,
304,
3867,
13,
18884,
25010,
1426,
363,
3740,
13154,
393,
437,
451,
2304,
8261,
1426,
29889,
13,
9651,
2791,
3204,
29898,
6500,
342,
5393,
1125,
450,
2643,
29892,
297,
2791,
3204,
3402,
29889,
13,
9651,
2066,
29898,
1761,
1125,
319,
1051,
310,
970,
3988,
29898,
29879,
29897,
470,
1887,
2224,
29898,
29879,
29897,
304,
2066,
304,
13,
18884,
367,
8059,
964,
278,
5716,
29889,
9333,
697,
934,
338,
6068,
639,
2643,
29889,
13,
9651,
10641,
1860,
29898,
1761,
1125,
10576,
10641,
1860,
304,
10641,
304,
278,
2643,
29889,
13,
18884,
2823,
278,
315,
3163,
16886,
363,
901,
2472,
29889,
13,
9651,
3579,
3827,
29918,
16744,
29901,
3462,
3245,
2009,
4128,
313,
16123,
2247,
13,
18884,
2304,
363,
4128,
393,
1122,
367,
2715,
297,
278,
5434,
467,
13,
13,
4706,
16969,
29901,
13,
9651,
7777,
29901,
319,
7777,
1203,
411,
278,
4902,
310,
278,
2825,
2643,
29889,
13,
13,
4706,
390,
1759,
267,
29901,
13,
9651,
20948,
29901,
960,
278,
3443,
4072,
526,
10240,
29889,
13,
9651,
29749,
2392,
29901,
960,
278,
2563,
735,
23570,
9570,
3639,
385,
1059,
29889,
13,
9651,
7865,
2392,
29901,
960,
278,
2066,
3443,
338,
263,
1051,
310,
3309,
1405,
29871,
29896,
29892,
470,
565,
13,
18884,
278,
1347,
297,
278,
1051,
313,
1552,
871,
1543,
297,
278,
1051,
29897,
947,
451,
13,
18884,
1712,
263,
2854,
3988,
470,
2224,
304,
263,
1887,
934,
29889,
13,
13,
4706,
9995,
13,
4706,
1423,
29918,
1853,
29898,
8345,
1204,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
517,
7435,
1204,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
517,
7435,
9823,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
726,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
3502,
3204,
29892,
2362,
342,
5393,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
5325,
29892,
1051,
29892,
13136,
29922,
5574,
29897,
13,
4706,
1423,
29918,
1853,
29898,
14930,
1860,
29892,
1051,
29892,
13136,
29922,
5574,
29897,
13,
13,
4706,
565,
2066,
29901,
13,
9651,
565,
7431,
29898,
5325,
29897,
1405,
29871,
29896,
29901,
13,
18884,
12020,
7865,
2392,
703,
1576,
421,
5325,
29952,
3443,
881,
367,
263,
1051,
411,
376,
13,
462,
462,
376,
735,
23617,
697,
313,
29896,
29897,
2944,
29889,
450,
2066,
3443,
376,
13,
462,
462,
376,
275,
263,
1051,
29892,
607,
21486,
2999,
1819,
304,
376,
13,
462,
462,
376,
9536,
363,
5434,
13184,
29892,
541,
5279,
376,
13,
462,
462,
376,
6194,
697,
934,
1122,
367,
5134,
411,
278,
376,
13,
462,
462,
376,
4906,
23157,
13,
9651,
1423,
29918,
1853,
29898,
5325,
29961,
29900,
1402,
2362,
342,
5393,
29897,
13,
4706,
1683,
29901,
13,
9651,
2066,
353,
6213,
13,
13,
4706,
396,
10554,
322,
28755,
10641,
1860,
13,
4706,
565,
10641,
1860,
29901,
13,
9651,
363,
2944,
29892,
26305,
297,
26985,
29898,
14930,
1860,
1125,
13,
18884,
1423,
29918,
1853,
29898,
14930,
358,
29892,
313,
8977,
29892,
23255,
415,
573,
13200,
876,
13,
13,
18884,
565,
338,
8758,
29898,
14930,
1860,
29892,
23255,
415,
573,
13200,
1125,
13,
462,
1678,
10641,
1860,
29961,
667,
29962,
353,
1207,
29918,
14930,
358,
29898,
14930,
358,
29897,
13,
13,
4706,
1400,
29918,
1272,
353,
9657,
29918,
3166,
29918,
7076,
29918,
2541,
29918,
5975,
29898,
13,
9651,
2009,
29918,
16744,
29892,
13,
9651,
5716,
1204,
29922,
8345,
1204,
29892,
13,
9651,
304,
7435,
1204,
29922,
517,
7435,
1204,
29892,
13,
9651,
304,
7435,
9823,
29922,
517,
7435,
9823,
29892,
13,
9651,
1426,
29922,
726,
29892,
13,
9651,
2791,
3204,
29922,
3502,
3204,
29892,
13,
9651,
2066,
29922,
5325,
29892,
13,
9651,
10641,
1860,
29922,
14930,
1860,
29892,
13,
4706,
1723,
13,
13,
4706,
396,
3450,
2009,
13,
4706,
565,
451,
2066,
470,
338,
29918,
2676,
29918,
2271,
29898,
5325,
29961,
29900,
29962,
1125,
13,
9651,
396,
10117,
4663,
1400,
13,
9651,
4390,
29918,
1272,
353,
1583,
3032,
7924,
29889,
2490,
29898,
8787,
29918,
1430,
11191,
6992,
29911,
29892,
4390,
29922,
2490,
29918,
1272,
29897,
13,
13,
4706,
25342,
338,
29918,
2997,
29918,
1445,
29898,
5325,
29961,
29900,
29962,
1125,
13,
9651,
396,
9683,
27494,
341,
8890,
1400,
13,
9651,
1018,
29901,
13,
18884,
1400,
29918,
1272,
1839,
5325,
2033,
353,
1722,
29918,
2997,
29918,
1445,
29898,
5325,
29961,
29900,
2314,
13,
18884,
6674,
442,
29918,
1272,
353,
9683,
27494,
8566,
6119,
29898,
2490,
29918,
1272,
29897,
13,
18884,
9066,
353,
11117,
3916,
29899,
1853,
2396,
6674,
442,
29918,
1272,
29889,
3051,
29918,
1853,
29913,
13,
18884,
4390,
29918,
1272,
353,
1583,
3032,
7924,
29889,
2490,
29898,
8787,
29918,
1430,
11191,
6992,
29911,
29892,
13,
462,
462,
1669,
9066,
29922,
13662,
29892,
13,
462,
462,
1669,
848,
29922,
18056,
442,
29918,
1272,
29897,
13,
9651,
7146,
29901,
13,
18884,
1400,
29918,
1272,
1839,
5325,
13359,
1445,
29918,
3318,
29889,
5358,
580,
13,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
703,
1576,
421,
5325,
29952,
3443,
947,
451,
1712,
263,
325,
737,
29881,
376,
13,
462,
632,
376,
4219,
470,
2224,
304,
263,
1887,
934,
23157,
13,
13,
4706,
396,
7106,
263,
2643,
1203,
2825,
515,
278,
2933,
4663,
848,
13,
4706,
736,
1583,
3032,
3318,
29918,
14399,
29898,
14824,
17637,
29918,
11116,
29892,
4390,
29918,
1272,
29897,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
2643,
1204,
1125,
13,
4706,
9995,
2577,
278,
4902,
310,
263,
2643,
29892,
491,
3553,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2643,
1204,
29898,
6500,
342,
5393,
1125,
450,
3553,
310,
278,
2643,
304,
367,
27387,
29889,
13,
13,
4706,
16969,
29901,
13,
9651,
7777,
29901,
319,
7777,
1203,
411,
278,
4902,
310,
278,
13877,
13,
9651,
2643,
29889,
13,
13,
4706,
390,
1759,
267,
29901,
13,
9651,
20948,
29901,
960,
278,
3443,
4072,
526,
10240,
29889,
13,
9651,
29749,
2392,
29901,
960,
278,
2563,
735,
23570,
9570,
3639,
385,
1059,
29889,
13,
13,
4706,
9995,
13,
4706,
1423,
29918,
1853,
29898,
4906,
1204,
29892,
2362,
342,
5393,
29897,
13,
13,
4706,
396,
3450,
2009,
13,
4706,
4390,
29918,
1272,
353,
1583,
3032,
7924,
29889,
657,
29898,
8787,
29918,
1430,
11191,
6992,
29911,
718,
8207,
29915,
718,
2643,
1204,
29897,
13,
13,
4706,
396,
7106,
263,
2643,
1203,
2825,
515,
278,
2933,
4663,
848,
13,
4706,
736,
1583,
3032,
3318,
29918,
14399,
29898,
14824,
17637,
29918,
11116,
29892,
4390,
29918,
1272,
29897,
13,
13,
1678,
822,
5217,
29898,
1311,
29892,
2643,
1204,
1125,
13,
4706,
9995,
12498,
263,
2643,
29889,
13,
13,
4706,
826,
3174,
29901,
13,
9651,
2643,
1204,
29898,
6500,
342,
5393,
1125,
450,
3553,
310,
278,
2643,
304,
367,
11132,
29889,
13,
13,
4706,
390,
1759,
267,
29901,
13,
9651,
20948,
29901,
960,
278,
3443,
4072,
526,
10240,
29889,
13,
9651,
29749,
2392,
29901,
960,
278,
2563,
735,
23570,
9570,
3639,
385,
1059,
29889,
13,
13,
4706,
9995,
13,
4706,
1423,
29918,
1853,
29898,
4906,
1204,
29892,
2362,
342,
5393,
29897,
13,
13,
4706,
396,
3450,
2009,
13,
4706,
1583,
3032,
7924,
29889,
8143,
29898,
8787,
29918,
1430,
11191,
6992,
29911,
718,
8207,
29915,
718,
2643,
1204,
29897,
13,
2
] |
getPrices.py | divir94/News-Analytics | 0 | 1600518 | <filename>getPrices.py
'''
Created on Jun 2, 2014
@author: vidurjoshi
'''
from pandas.io import parsers
from datetime import datetime
def make_url(ticker_symbol,start_date, end_date):
print ticker_symbol
base_url = "http://ichart.finance.yahoo.com/table.csv?s="
a = start_date
b = end_date
dt_url = '%s&a=%d&b=%d&c=%d&d=%d&e=%d&f=%d&g=d&ignore=.csv'% (ticker_symbol, a.month-1, a.day, a.year, b.month-1, b.day,b.year)
return base_url + dt_url
def getPrices(symb, openD, closeD):
url = make_url(symb,openD, closeD)
print url
e = parsers.read_csv(url)
print e
getPrices("GOOG", datetime(2000,1,1), datetime(2012,1,1)) | [
1,
529,
9507,
29958,
657,
4040,
1575,
29889,
2272,
13,
12008,
13,
20399,
373,
8378,
29871,
29906,
29892,
29871,
29906,
29900,
29896,
29946,
13,
13,
29992,
8921,
29901,
7840,
332,
14736,
2918,
13,
12008,
13,
13,
13,
3166,
11701,
29889,
601,
1053,
610,
4253,
13,
3166,
12865,
1053,
12865,
13,
13,
13,
13,
1753,
1207,
29918,
2271,
29898,
29873,
6541,
29918,
18098,
29892,
2962,
29918,
1256,
29892,
1095,
29918,
1256,
1125,
13,
1678,
1596,
260,
6541,
29918,
18098,
13,
1678,
2967,
29918,
2271,
353,
376,
1124,
597,
436,
442,
29889,
4951,
749,
29889,
29891,
26779,
29889,
510,
29914,
2371,
29889,
7638,
29973,
29879,
543,
13,
1678,
263,
353,
1369,
29918,
1256,
13,
1678,
289,
353,
1095,
29918,
1256,
13,
1678,
11636,
29918,
2271,
353,
14210,
29879,
29987,
29874,
16328,
29881,
29987,
29890,
16328,
29881,
29987,
29883,
16328,
29881,
29987,
29881,
16328,
29881,
29987,
29872,
16328,
29881,
29987,
29888,
16328,
29881,
29987,
29887,
29922,
29881,
29987,
17281,
21098,
7638,
29915,
29995,
313,
29873,
6541,
29918,
18098,
29892,
263,
29889,
10874,
29899,
29896,
29892,
263,
29889,
3250,
29892,
263,
29889,
6360,
29892,
289,
29889,
10874,
29899,
29896,
29892,
289,
29889,
3250,
29892,
29890,
29889,
6360,
29897,
13,
1678,
736,
2967,
29918,
2271,
718,
11636,
29918,
2271,
13,
13,
13,
1753,
679,
4040,
1575,
29898,
11967,
29890,
29892,
1722,
29928,
29892,
3802,
29928,
1125,
13,
1678,
3142,
353,
1207,
29918,
2271,
29898,
11967,
29890,
29892,
3150,
29928,
29892,
3802,
29928,
29897,
13,
1678,
1596,
3142,
13,
1678,
321,
353,
610,
4253,
29889,
949,
29918,
7638,
29898,
2271,
29897,
13,
1678,
1596,
321,
13,
13,
657,
4040,
1575,
703,
17080,
29949,
29954,
613,
12865,
29898,
29906,
29900,
29900,
29900,
29892,
29896,
29892,
29896,
511,
12865,
29898,
29906,
29900,
29896,
29906,
29892,
29896,
29892,
29896,
876,
2
] |
src/compas_ui/objects/networkobject.py | BlockResearchGroup/compas_ui | 0 | 25292 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from functools import reduce
from operator import mul
from compas.geometry import Point
from compas.geometry import Scale
from compas.geometry import Translation
from compas.geometry import Rotation
from compas.geometry import transform_points
from .object import Object
class NetworkObject(Object):
"""Class for representing COMPAS networkes in Rhino.
Attributes
----------
anchor : int
The node of the network that is anchored to the location of the object.
location : :class:`compas.geometry.Point`
The location of the object.
Default is the origin of the world coordinate system.
scale : float
A uniform scaling factor for the object in the scene.
The scale is applied relative to the location of the object in the scene.
rotation : list[float]
The rotation angles around the 3 axis of the coordinate system
with the origin placed at the location of the object in the scene.
node_xyz : dict[int, list[float]]
The view coordinates of the network object.
"""
SETTINGS = {
'color.nodes': (255, 255, 255),
'color.edges': (0, 0, 0),
'show.nodes': True,
'show.edges': True,
'show.nodelabels': False,
'show.edgelabels': False,
}
def __init__(self, *args, **kwargs):
super(NetworkObject, self).__init__(*args, **kwargs)
self._anchor = None
self._location = None
self._scale = None
self._rotation = None
@property
def network(self):
return self.item
@network.setter
def network(self, network):
self.item = network
@property
def anchor(self):
return self._anchor
@anchor.setter
def anchor(self, node):
if self.network.has_node(node):
self._anchor = node
@property
def location(self):
if not self._location:
self._location = Point(0, 0, 0)
return self._location
@location.setter
def location(self, location):
self._location = Point(*location)
@property
def scale(self):
if not self._scale:
self._scale = 1.0
return self._scale
@scale.setter
def scale(self, scale):
self._scale = scale
@property
def rotation(self):
if not self._rotation:
self._rotation = [0, 0, 0]
return self._rotation
@rotation.setter
def rotation(self, rotation):
self._rotation = rotation
@property
def node_xyz(self):
origin = Point(0, 0, 0)
nodes = list(self.network.nodes())
xyz = self.network.nodes_attributes(['x', 'y', 'z'], keys=nodes)
stack = []
if self.scale != 1.0:
S = Scale.from_factors([self.scale] * 3)
stack.append(S)
if self.rotation != [0, 0, 0]:
R = Rotation.from_euler_angles(self.rotation)
stack.append(R)
if self.location != origin:
if self.anchor is not None:
xyz = self.network.node_attributes(self.anchor, 'xyz')
point = Point(* xyz)
T1 = Translation.from_vector(origin - point)
stack.insert(0, T1)
T2 = Translation.from_vector(self.location)
stack.append(T2)
if stack:
X = reduce(mul, stack[::-1])
xyz = transform_points(xyz, X)
return dict(zip(nodes, xyz))
def select_nodes(self):
raise NotImplementedError
def select_edges(self):
raise NotImplementedError
def modify_nodes(self, nodes, names=None):
raise NotImplementedError
def modify_edges(self, edges, names=None):
raise NotImplementedError
def move_node(self, node):
raise NotImplementedError
def move_edge(self, edge):
raise NotImplementedError
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
13,
3166,
2090,
312,
8789,
1053,
10032,
13,
3166,
5455,
1053,
15065,
13,
13,
3166,
752,
294,
29889,
19156,
1053,
8984,
13,
3166,
752,
294,
29889,
19156,
1053,
2522,
744,
13,
3166,
752,
294,
29889,
19156,
1053,
4103,
18411,
13,
3166,
752,
294,
29889,
19156,
1053,
9664,
362,
13,
3166,
752,
294,
29889,
19156,
1053,
4327,
29918,
9748,
13,
13,
3166,
869,
3318,
1053,
4669,
13,
13,
13,
1990,
8527,
2061,
29898,
2061,
1125,
13,
1678,
9995,
2385,
363,
15783,
4810,
3580,
3289,
3564,
267,
297,
7861,
1789,
29889,
13,
13,
1678,
6212,
5026,
13,
1678,
448,
1378,
29899,
13,
1678,
17360,
584,
938,
13,
4706,
450,
2943,
310,
278,
3564,
393,
338,
23791,
4395,
304,
278,
4423,
310,
278,
1203,
29889,
13,
1678,
4423,
584,
584,
1990,
18078,
2388,
294,
29889,
19156,
29889,
5228,
29952,
13,
4706,
450,
4423,
310,
278,
1203,
29889,
13,
4706,
13109,
338,
278,
3978,
310,
278,
3186,
14821,
1788,
29889,
13,
1678,
6287,
584,
5785,
13,
4706,
319,
9090,
21640,
7329,
363,
278,
1203,
297,
278,
9088,
29889,
13,
4706,
450,
6287,
338,
7436,
6198,
304,
278,
4423,
310,
278,
1203,
297,
278,
9088,
29889,
13,
1678,
13733,
584,
1051,
29961,
7411,
29962,
13,
4706,
450,
13733,
23619,
2820,
278,
29871,
29941,
9685,
310,
278,
14821,
1788,
13,
4706,
411,
278,
3978,
7180,
472,
278,
4423,
310,
278,
1203,
297,
278,
9088,
29889,
13,
1678,
2943,
29918,
20230,
584,
9657,
29961,
524,
29892,
1051,
29961,
7411,
5262,
13,
4706,
450,
1776,
10350,
310,
278,
3564,
1203,
29889,
13,
13,
1678,
9995,
13,
13,
1678,
11368,
29911,
4214,
29903,
353,
426,
13,
4706,
525,
2780,
29889,
18010,
2396,
313,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29906,
29945,
29945,
511,
13,
4706,
525,
2780,
29889,
287,
2710,
2396,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
511,
13,
4706,
525,
4294,
29889,
18010,
2396,
5852,
29892,
13,
4706,
525,
4294,
29889,
287,
2710,
2396,
5852,
29892,
13,
4706,
525,
4294,
29889,
29876,
27224,
1107,
29879,
2396,
7700,
29892,
13,
4706,
525,
4294,
29889,
287,
7467,
1107,
29879,
2396,
7700,
29892,
13,
1678,
500,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2428,
29898,
13724,
2061,
29892,
1583,
467,
1649,
2344,
1649,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
1583,
3032,
25367,
353,
6213,
13,
4706,
1583,
3032,
5479,
353,
6213,
13,
4706,
1583,
3032,
7052,
353,
6213,
13,
4706,
1583,
3032,
5450,
362,
353,
6213,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3564,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
667,
13,
13,
1678,
732,
11618,
29889,
842,
357,
13,
1678,
822,
3564,
29898,
1311,
29892,
3564,
1125,
13,
4706,
1583,
29889,
667,
353,
3564,
13,
13,
1678,
732,
6799,
13,
1678,
822,
17360,
29898,
1311,
1125,
13,
4706,
736,
1583,
3032,
25367,
13,
13,
1678,
732,
25367,
29889,
842,
357,
13,
1678,
822,
17360,
29898,
1311,
29892,
2943,
1125,
13,
4706,
565,
1583,
29889,
11618,
29889,
5349,
29918,
3177,
29898,
3177,
1125,
13,
9651,
1583,
3032,
25367,
353,
2943,
13,
13,
1678,
732,
6799,
13,
1678,
822,
4423,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
3032,
5479,
29901,
13,
9651,
1583,
3032,
5479,
353,
8984,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
4706,
736,
1583,
3032,
5479,
13,
13,
1678,
732,
5479,
29889,
842,
357,
13,
1678,
822,
4423,
29898,
1311,
29892,
4423,
1125,
13,
4706,
1583,
3032,
5479,
353,
8984,
10456,
5479,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
6287,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
3032,
7052,
29901,
13,
9651,
1583,
3032,
7052,
353,
29871,
29896,
29889,
29900,
13,
4706,
736,
1583,
3032,
7052,
13,
13,
1678,
732,
7052,
29889,
842,
357,
13,
1678,
822,
6287,
29898,
1311,
29892,
6287,
1125,
13,
4706,
1583,
3032,
7052,
353,
6287,
13,
13,
1678,
732,
6799,
13,
1678,
822,
13733,
29898,
1311,
1125,
13,
4706,
565,
451,
1583,
3032,
5450,
362,
29901,
13,
9651,
1583,
3032,
5450,
362,
353,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
4706,
736,
1583,
3032,
5450,
362,
13,
13,
1678,
732,
5450,
362,
29889,
842,
357,
13,
1678,
822,
13733,
29898,
1311,
29892,
13733,
1125,
13,
4706,
1583,
3032,
5450,
362,
353,
13733,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2943,
29918,
20230,
29898,
1311,
1125,
13,
4706,
3978,
353,
8984,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29897,
13,
4706,
7573,
353,
1051,
29898,
1311,
29889,
11618,
29889,
18010,
3101,
13,
4706,
921,
12339,
353,
1583,
29889,
11618,
29889,
18010,
29918,
15697,
18959,
29916,
742,
525,
29891,
742,
525,
29920,
7464,
6611,
29922,
18010,
29897,
13,
13,
4706,
5096,
353,
5159,
13,
4706,
565,
1583,
29889,
7052,
2804,
29871,
29896,
29889,
29900,
29901,
13,
9651,
317,
353,
2522,
744,
29889,
3166,
29918,
17028,
943,
4197,
1311,
29889,
7052,
29962,
334,
29871,
29941,
29897,
13,
9651,
5096,
29889,
4397,
29898,
29903,
29897,
13,
4706,
565,
1583,
29889,
5450,
362,
2804,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
5387,
13,
9651,
390,
353,
9664,
362,
29889,
3166,
29918,
29872,
8584,
29918,
19536,
29898,
1311,
29889,
5450,
362,
29897,
13,
9651,
5096,
29889,
4397,
29898,
29934,
29897,
13,
4706,
565,
1583,
29889,
5479,
2804,
3978,
29901,
13,
9651,
565,
1583,
29889,
25367,
338,
451,
6213,
29901,
13,
18884,
921,
12339,
353,
1583,
29889,
11618,
29889,
3177,
29918,
15697,
29898,
1311,
29889,
25367,
29892,
525,
20230,
1495,
13,
18884,
1298,
353,
8984,
10456,
921,
12339,
29897,
13,
18884,
323,
29896,
353,
4103,
18411,
29889,
3166,
29918,
8111,
29898,
12574,
448,
1298,
29897,
13,
18884,
5096,
29889,
7851,
29898,
29900,
29892,
323,
29896,
29897,
13,
9651,
323,
29906,
353,
4103,
18411,
29889,
3166,
29918,
8111,
29898,
1311,
29889,
5479,
29897,
13,
9651,
5096,
29889,
4397,
29898,
29911,
29906,
29897,
13,
4706,
565,
5096,
29901,
13,
9651,
1060,
353,
10032,
29898,
16109,
29892,
5096,
29961,
1057,
29899,
29896,
2314,
13,
9651,
921,
12339,
353,
4327,
29918,
9748,
29898,
20230,
29892,
1060,
29897,
13,
4706,
736,
9657,
29898,
7554,
29898,
18010,
29892,
921,
12339,
876,
13,
13,
1678,
822,
1831,
29918,
18010,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
1831,
29918,
287,
2710,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
6623,
29918,
18010,
29898,
1311,
29892,
7573,
29892,
2983,
29922,
8516,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
6623,
29918,
287,
2710,
29898,
1311,
29892,
12770,
29892,
2983,
29922,
8516,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
4337,
29918,
3177,
29898,
1311,
29892,
2943,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
4337,
29918,
12864,
29898,
1311,
29892,
7636,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
2
] |
teamcat_service/doraemon/business/testjob/codecommitlogservice.py | zhangyin2088/Teamcat | 6 | 1617958 | #coding=utf-8
#encoding=utf-8
'''
Created on 2014-12-17
@author: Devuser
'''
from dataaccess.testjob.dal_testjob import DAL_TestJob
from dataaccess.testjob.dal_testproject import DAL_TestProject
from dataaccess.testjob.dal_testsubmition import DAL_TestSubmition
from gatesidelib.svnhelper import SvnHelper
from gatesidelib.githelper import GitHelper
from doraemon.testjob.datamodels.scminfo import SCMInfo
from dataaccess.common.dal_dictvalue import DAL_DictValue
from dataaccess.testjob.dal_codecommitlog import DAL_CodeCommitLog
from doraemon.testjob.models import CodeCommitLog
from gatesidelib.common.simplelogger import SimpleLogger
from gatesidelib.filehelper import FileHelper
from gatesidelib.common.commonhelper import CommonHelper
import time,datetime
import os
class CodeCommitLogService(object):
'''
代码提交日志服务
'''
@staticmethod
def update_commit_log(testjobid):
testjob= DAL_TestJob.gettestjob(testjobid)
if int(testjob.TJProgress)==100 and (testjob.TJCodeLines==0):
SimpleLogger.logger.info("start to get commit log for job:"+ str(testjobid))
CodeCommitLogService.update_svn_commit_log(testjob.TJSubmitionID)
CodeCommitLogService.update_git_commit_log(testjob.TJSubmitionID)
CodeCommitLogService.update_tesjob_codelines(testjobid)
SimpleLogger.logger.info("finished to get commit log for job:"+ str(testjobid))
@staticmethod
def update_tesjob_codelines(testjobid):
SimpleLogger.logger.info("start to update codelines for job:"+ str(testjobid))
testjob= DAL_TestJob.gettestjob(testjobid)
codeCommitLogs=DAL_CodeCommitLog.get_commitlogs_by_submitionid(testjob.TJSubmitionID)
codeLines=0
for codeCommitLog in codeCommitLogs:
if not CodeCommitLogService.is_codecomite_expire(codeCommitLog.CCLCommiteDate):
tempcodelines=int(codeCommitLog.CCLNewCodeLines)
if tempcodelines>30000:
codeLines=codeLines+tempcodelines*0.1
elif tempcodelines<=30000 and tempcodelines>10000:
codeLines=codeLines+tempcodelines*0.2
else:
codeLines=codeLines+tempcodelines
testjob.TJCodeLines=codeLines
DAL_TestJob.updatetestjob(testjob)
SimpleLogger.logger.info("finished to update codelines for job:"+ str(testjobid))
@staticmethod
def is_codecomite_expire(codecommitdate):
if codecommitdate:
commitdate_string=codecommitdate.split('+')[0].strip() #获取+号前的部分时间字符串
try:
commitdate_time=time.strptime(commitdate_string,'%a %b %d %H:%M:%S %Y') #git log 提交日期转化成time格式
except Exception as ex:
commitdate_time=time.strptime(commitdate_string,'%Y-%m-%d %H:%M:%S') #git log 提交日期转化成time格式
commitdate=datetime.date(commitdate_time.tm_year,commitdate_time.tm_mon,commitdate_time.tm_mday) #转化成日期格式
intervals=(datetime.date.today()-commitdate).days
if intervals>90:
SimpleLogger.logger.info("code submit date expire")
return True
else:
return False
@staticmethod
def get_commit_log(submitionid):
pass
@staticmethod
def update_svn_commit_log(submitionid):
SimpleLogger.logger.info("start to process svn commit log for submition:"+ str(submitionid))
testsubmition=DAL_TestSubmition.gettestsubmition(submitionid)
if testsubmition.TPSCodeVersion!=None and testsubmition.TPSCodeVersion.isdigit():
log_file_path=CodeCommitLogService.save_svn_commit_log(testsubmition)
CodeCommitLogService.save_svn_commitlog_2DB(log_file_path, testsubmition)
FileHelper.delete_file(log_file_path)
SimpleLogger.logger.info("finished to process svn commit log for submition:"+ str(submitionid))
@staticmethod
def update_git_commit_log(submitionid):
SimpleLogger.logger.info("start to process git commit log for submition:"+ str(submitionid))
testsubmition=DAL_TestSubmition.gettestsubmition(submitionid)
if testsubmition.TPSCodeVersion!=None and not testsubmition.TPSCodeVersion.isdigit():
CodeCommitLogService.clone_git_project(testsubmition)
# CodeCommitLogService.pull_git_project(testsubmition)
log_file_path=CodeCommitLogService.save_git_commit_log(testsubmition)
SimpleLogger.logger.info(log_file_path)
CodeCommitLogService.save_git_commitlog_2DB(log_file_path, testsubmition)
FileHelper.delete_file(log_file_path)
@staticmethod
def save_svn_commitlog_2DB(logfilepath,testsubmition):
SimpleLogger.logger.info("start to save svn info to db for submition:"+ str(testsubmition.id))
SimpleLogger.logger.info("logfilepaht"+logfilepath)
if os.path.isfile(logfilepath):
SimpleLogger.logger.info("logfile exits")
commitlog=open(logfilepath,'r')
last_commitnumber=CodeCommitLogService.get_lastest_svncommit_number(testsubmition.TPSProductName,testsubmition.id)
SimpleLogger.logger.info(last_commitnumber)
linesets=list()
for line in commitlog:
templine=str(line)
try:
if len(linesets) and templine.startswith('----'):
SimpleLogger.logger.info(templine)
code_commit_log= CodeCommitLogService.init_svncommitlog(linesets,last_commitnumber,testsubmition)
if DAL_CodeCommitLog.get_commitlog_by_commitnumber(code_commit_log.CCLCommiteNumber):
SimpleLogger.logger.info(code_commit_log.CCLCommiteNumber)
pass
else:
if code_commit_log.CCLCommiteNumber==testsubmition.TPSCodeVersion:
SimpleLogger.logger.info(code_commit_log.CCLCommiteNumber)
DAL_CodeCommitLog.save_commitlog(code_commit_log)
break;
else:
SimpleLogger.logger.info("no exits version")
DAL_CodeCommitLog.save_commitlog(code_commit_log)
last_commitnumber=code_commit_log.CCLCommiteNumber
linesets=list()
linesets.append(templine)
else:
linesets.append(templine)
except Exception as ex:
SimpleLogger.logger.error(ex)
continue
SimpleLogger.logger.info("finished to save svn info to db for submition:"+ str(testsubmition.id))
@staticmethod
def save_git_commitlog_2DB(logfilepath,testsubmition):
linesets=CodeCommitLogService.process_git_commitlog(logfilepath)
linesets.reverse()
last_commitnumber=CodeCommitLogService.get_lastest_gitcommit_number(testsubmition.TPSProductName,testsubmition.id)
if last_commitnumber=="0":
last_commitnumber=""
for linelist in linesets:
try:
code_commit_log= CodeCommitLogService.init_gitcommitlog(linelist, last_commitnumber, testsubmition)
if DAL_CodeCommitLog.get_commitlog_by_commitnumber(code_commit_log.CCLCommiteNumber): # 已经存在的条目不再写入
pass
else:
if code_commit_log.CCLCommiteNumber==testsubmition.TPSCodeVersion:
DAL_CodeCommitLog.save_commitlog(code_commit_log)
break;
else:
SimpleLogger.logger.info("no exists commit version:"+code_commit_log.CCLCommiteNumber)
DAL_CodeCommitLog.save_commitlog(code_commit_log)
last_commitnumber=code_commit_log.CCLCommiteNumber
except Exception as ex:
SimpleLogger.logger.error(ex)
continue
@staticmethod
def init_gitcommitlog(linelist,startrevision,testsubmition):
code_commit_log=CodeCommitLog()
code_commit_log=CodeCommitLogService.extract_gitcommitlog(linelist, code_commit_log)
commitloglines=[linelist[i] for i in range(len(linelist)) if i>3]
code_commit_log.CCLCommiteLog=str(commitloglines).decode('gb2312')[0:10000]
codelinecounts=CodeCommitLogService.get_git_line_counts(testsubmition,startrevision,code_commit_log.CCLCommiteNumber)
code_commit_log.CCLNewCodeLines=int(codelinecounts[0])
code_commit_log.CCLDeletedCodeLines=int(codelinecounts[1])
code_commit_log.CCLProductID=testsubmition.TPSProductName
code_commit_log.CCLProductVersion=testsubmition.TPSProductVersion
code_commit_log.CCLSubmitionID=testsubmition.id
return code_commit_log
@staticmethod
def process_git_commitlog(logfilepath):
if os.path.isfile(logfilepath):
commitlog=open(logfilepath,'r')
templinesets=list()
linesets=list()
for line in commitlog:
templine=str(line)
try:
if len(templinesets) and templine.startswith('commit'):
linesets.append(templinesets)
templinesets=list()
templinesets.append(templine)
else:
templinesets.append(templine)
except Exception as ex:
SimpleLogger.logger.error(ex)
continue
return linesets
@staticmethod
def init_svncommitlog(linelist,startrevision,testsubmition):
code_commit_log=CodeCommitLog()
code_commit_log=CodeCommitLogService.extract_svncommitlog(linelist[1],code_commit_log)
commitloglines=[linelist[i] for i in range(len(linelist)) if i>1]
code_commit_log.CCLCommiteLog=str(commitloglines).decode('gb2312')[0:10000]
code_commit_log.CCLNewCodeLines=int(CodeCommitLogService.get_svn_line_counts(testsubmition,startrevision,code_commit_log.CCLCommiteNumber,True))
code_commit_log.CCLDeletedCodeLines=int(CodeCommitLogService.get_svn_line_counts(testsubmition,startrevision,code_commit_log.CCLCommiteNumber,False))
code_commit_log.CCLProductID=testsubmition.TPSProductName
code_commit_log.CCLProductVersion=testsubmition.TPSProductVersion
code_commit_log.CCLSubmitionID=testsubmition.id
return code_commit_log
@staticmethod
def extract_svncommitlog(line,code_commit_log):
logInfos=line.split('|')
if len(logInfos):
code_commit_log.CCLCommiteNumber=logInfos[0].replace('r','').strip()
code_commit_log.CCLCommitor=logInfos[1].strip()
code_commit_log.CCLCommiteDate=str(logInfos[2].strip()).decode("gb2312")
return code_commit_log
@staticmethod
def extract_gitcommitlog(linesets,code_commit_log):
for line in linesets:
if str(line).startswith("commit"):
code_commit_log.CCLCommiteNumber=line.replace('commit','').strip()
if str(line).startswith("Author"):
code_commit_log.CCLCommitor=line.replace('Author:','').strip()
if str(line).startswith("Date"):
code_commit_log.CCLCommiteDate=line.replace('Date:','').strip()
return code_commit_log
@staticmethod
def save_svn_commit_log(testsubmition):
SimpleLogger.logger.info("start to save svn commit log for submition:"+ str(testsubmition.id))
scm_info=CodeCommitLogService.get_svn_scminfo(testsubmition.TPSProductName)
scm_local_file_path=scm_info.localdir+str(time.time())+".log"
svn_helper=SvnHelper(testsubmition.TPSCodeUrl,scm_info.scmuser,scm_info.scmpassword,scm_local_file_path)
last_commit_number=CodeCommitLogService.get_lastest_svncommit_number(testsubmition.TPSProductName,testsubmition.id)
if last_commit_number!='0':
last_commit_number=str(int(last_commit_number)+1)
svn_helper.save_commitlog(last_commit_number,testsubmition.TPSCodeVersion)
SimpleLogger.logger.info("finished to save svn commit log for submition:"+ str(testsubmition.id))
return scm_local_file_path
@staticmethod
def save_git_commit_log(testsubmition):
scm_info=CodeCommitLogService.get_git_scminfo(testsubmition.TPSProductName)
scm_local_file_path=scm_info.localdir+CommonHelper.get_slash()+str(time.time())+".log"
git_url=CodeCommitLogService.generate_git_url(testsubmition.TPSCodeUrl,scm_info.scmuser,scm_info.scmpassword)
git_helper=GitHelper(git_url,scm_info.localdir+CommonHelper.get_slash()+".git",scm_local_file_path)
# if CodeCommitLogService.has_gitlog_indb(testsubmition.TPSProductName,testsubmition.id):
# git_helper.save_commitlog("-200")
# else:
git_helper.save_commitlog("")
return scm_local_file_path
@staticmethod
def generate_git_url(sourceurl,username,password):
sourceurllist=sourceurl.split("//")
return sourceurllist[0]+"//"+username+":"+password+"@"+sourceurllist[1]
@staticmethod
def clone_git_project(testsubmition):
SimpleLogger.logger.info("start to clone git project for submition:"+ str(testsubmition.id))
scm_info=CodeCommitLogService.get_git_scminfo(testsubmition.TPSProductName)
scm_local_file_path=scm_info.localdir+str(time.time())+".log"
codeurlinfo=CodeCommitLogService.get_codeurlinfo(testsubmition.TPSCodeUrl)
git_url=CodeCommitLogService.generate_git_url(codeurlinfo[0],scm_info.scmuser,scm_info.scmpassword)
git_helper=GitHelper(git_url,scm_info.localdir,scm_local_file_path)
git_helper.clone_project(codeurlinfo[1])
FileHelper.delete_file(scm_local_file_path)
SimpleLogger.logger.info("finished to clone git project for submition:"+ str(testsubmition.id))
@staticmethod
def pull_git_project(testsubmition):
SimpleLogger.logger.info("start to pull git project for submition:"+ str(testsubmition.id))
scm_info=CodeCommitLogService.get_git_scminfo(testsubmition.TPSProductName)
scm_local_file_path=scm_info.localdir+str(time.time())+".log"
git_url=CodeCommitLogService.generate_git_url(testsubmition.TPSCodeUrl,scm_info.scmuser,scm_info.scmpassword)
git_helper=GitHelper(git_url+" master",scm_info.localdir+CommonHelper.get_slash()+".git",scm_local_file_path)
git_helper.pull_project()
FileHelper.delete_file(scm_local_file_path)
@staticmethod
def get_svn_line_counts(testsubmition,startrevison,endrevison,is_newcode):
scm_info=CodeCommitLogService.get_svn_scminfo(testsubmition.TPSProductName)
scm_local_file_path=scm_info.localdir+str(time.time())+".log"
svn_helper=SvnHelper(testsubmition.TPSCodeUrl,scm_info.scmuser,scm_info.scmpassword,scm_local_file_path)
if is_newcode:
codeline_counts=svn_helper.get_newcode_lines(startrevison,endrevison)
else:
codeline_counts=svn_helper.get_deletecode_lines(startrevison,endrevison)
FileHelper.delete_file(scm_local_file_path)
return codeline_counts
@staticmethod
def get_git_line_counts(testsubmition,startrevison,endrevison):
scm_info=CodeCommitLogService.get_git_scminfo(testsubmition.TPSProductName)
scm_local_file_path=scm_info.localdir+CommonHelper.get_slash()+str(time.time())+".log"
git_helper=GitHelper("",scm_info.localdir+CommonHelper.get_slash()+".git",scm_local_file_path)
codeline_counts= git_helper.get_changecode_lines(startrevison, endrevison)
FileHelper.delete_file(scm_local_file_path)
return codeline_counts
@staticmethod
def has_gitlog_indb(productid,submitionid):
commitLogSets=DAL_CodeCommitLog.get_commitlog_by_productid(productid)
target_submition=DAL_TestSubmition.gettestsubmition(submitionid)
result=False
for commitlog in commitLogSets:
tempSubmition=DAL_TestSubmition.gettestsubmition(commitlog.CCLSubmitionID)
if tempSubmition.TPSPlatform==target_submition.TPSPlatform:
result=True
break
return result
@staticmethod
def get_lastest_gitcommit_number(productid,submitionid):
commitLogSets=DAL_CodeCommitLog.get_commitlog_by_productid(productid)
target_submition=DAL_TestSubmition.gettestsubmition(submitionid)
result='0'
for commitlog in commitLogSets:
tempSubmition=DAL_TestSubmition.gettestsubmition(commitlog.CCLSubmitionID)
if tempSubmition.TPSPlatform==target_submition.TPSPlatform:
if not commitlog.CCLCommiteNumber.isdigit():
result=commitlog.CCLCommiteNumber
break
return result
@staticmethod
def get_lastest_svncommit_number(productid,submitionid):
commitLogSets=DAL_CodeCommitLog.get_commitlog_by_productid(productid)
target_submition=DAL_TestSubmition.gettestsubmition(submitionid)
result='0'
for commitlog in commitLogSets:
tempSubmition=DAL_TestSubmition.gettestsubmition(commitlog.CCLSubmitionID)
if tempSubmition.TPSPlatform==target_submition.TPSPlatform:
if commitlog.CCLCommiteNumber.isdigit():
result=commitlog.CCLCommiteNumber
break
return result
@staticmethod
def get_svn_scminfo(productnameid):
return CodeCommitLogService.get_scminfo(productnameid,'SvnUser','SvnPassword','SvnCodeRoot')
@staticmethod
def get_git_scminfo(productnameid):
return CodeCommitLogService.get_scminfo(productnameid,'GitUser','GitPassword','GitCodeRoot')
@staticmethod
def get_scminfo(productnameid,user_dicdataname,password_dicdataname,coderoot_dicdataname):
scm_user=str(DAL_DictValue.getdatavaluebydataname("SCMInfo",user_dicdataname).DicDataDesc)
scm_password=str(DAL_DictValue.getdatavaluebydataname("SCMInfo",password_dicdataname).DicDataDesc)
scm_desc=str(DAL_TestProject.get_testproject(productnameid).TPKEY)
scm_coderoot=str(DAL_DictValue.getdatavaluebydataname("SCMInfo",coderoot_dicdataname).DicDataDesc)
scm_info=SCMInfo(scm_user,scm_password,scm_coderoot+CommonHelper.get_slash()+scm_desc)
return scm_info
@staticmethod
def get_codeurlinfo(sourceurl):
print(sourceurl)
result=list()
if sourceurl:
urlinfos=sourceurl.split(":")
result.append(urlinfos[0]+":"+urlinfos[1].strip())
if len(urlinfos)<3:
result.append('master')
else:
startindex=urlinfos[2].rindex('/')
branch=str(urlinfos[2])[startindex+1:]
result.append(branch)
return result
| [
1,
396,
29883,
3689,
29922,
9420,
29899,
29947,
13,
29937,
22331,
29922,
9420,
29899,
29947,
13,
12008,
13,
20399,
373,
29871,
29906,
29900,
29896,
29946,
29899,
29896,
29906,
29899,
29896,
29955,
13,
13,
29992,
8921,
29901,
9481,
1792,
13,
12008,
13,
3166,
848,
5943,
29889,
1688,
9057,
29889,
12293,
29918,
1688,
9057,
1053,
360,
1964,
29918,
3057,
11947,
13,
3166,
848,
5943,
29889,
1688,
9057,
29889,
12293,
29918,
1688,
4836,
1053,
360,
1964,
29918,
3057,
7653,
13,
3166,
848,
5943,
29889,
1688,
9057,
29889,
12293,
29918,
1688,
1491,
29885,
654,
1053,
360,
1964,
29918,
3057,
4035,
29885,
654,
13,
3166,
29341,
10652,
747,
29889,
27517,
20907,
1053,
15012,
29876,
10739,
13,
3166,
29341,
10652,
747,
29889,
29887,
389,
295,
546,
1053,
11786,
10739,
13,
3166,
270,
2207,
9857,
29889,
1688,
9057,
29889,
4130,
314,
397,
1379,
29889,
1557,
1195,
1181,
1053,
12314,
29924,
3401,
13,
3166,
848,
5943,
29889,
9435,
29889,
12293,
29918,
8977,
1767,
1053,
360,
1964,
29918,
21533,
1917,
13,
3166,
848,
5943,
29889,
1688,
9057,
29889,
12293,
29918,
401,
15060,
1188,
1053,
360,
1964,
29918,
3399,
1523,
2415,
3403,
13,
3166,
270,
2207,
9857,
29889,
1688,
9057,
29889,
9794,
1053,
5920,
1523,
2415,
3403,
13,
3166,
29341,
10652,
747,
29889,
9435,
29889,
12857,
21707,
1053,
12545,
16363,
13,
3166,
29341,
10652,
747,
29889,
1445,
20907,
1053,
3497,
10739,
13,
3166,
29341,
10652,
747,
29889,
9435,
29889,
9435,
20907,
1053,
13103,
10739,
13,
5215,
931,
29892,
12673,
13,
5215,
2897,
13,
13,
13,
1990,
5920,
1523,
2415,
3403,
3170,
29898,
3318,
1125,
13,
1678,
14550,
13,
18884,
30690,
31183,
31302,
31398,
30325,
31096,
31520,
31358,
13,
1678,
14550,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2767,
29918,
15060,
29918,
1188,
29898,
1688,
9057,
333,
1125,
13,
4706,
1243,
9057,
29922,
360,
1964,
29918,
3057,
11947,
29889,
657,
1688,
9057,
29898,
1688,
9057,
333,
29897,
13,
4706,
565,
938,
29898,
1688,
9057,
29889,
29911,
29967,
14470,
29897,
1360,
29896,
29900,
29900,
322,
313,
1688,
9057,
29889,
29911,
29967,
3399,
20261,
1360,
29900,
1125,
13,
9651,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
679,
9063,
1480,
363,
4982,
6160,
29974,
851,
29898,
1688,
9057,
333,
876,
13,
9651,
5920,
1523,
2415,
3403,
3170,
29889,
5504,
29918,
27517,
29918,
15060,
29918,
1188,
29898,
1688,
9057,
29889,
29911,
29967,
4035,
29885,
654,
1367,
29897,
13,
9651,
5920,
1523,
2415,
3403,
3170,
29889,
5504,
29918,
5559,
29918,
15060,
29918,
1188,
29898,
1688,
9057,
29889,
29911,
29967,
4035,
29885,
654,
1367,
29897,
13,
9651,
5920,
1523,
2415,
3403,
3170,
29889,
5504,
29918,
2167,
9057,
29918,
19284,
24210,
29898,
1688,
9057,
333,
29897,
13,
9651,
12545,
16363,
29889,
21707,
29889,
3888,
703,
4951,
3276,
304,
679,
9063,
1480,
363,
4982,
6160,
29974,
851,
29898,
1688,
9057,
333,
876,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2767,
29918,
2167,
9057,
29918,
19284,
24210,
29898,
1688,
9057,
333,
1125,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
2767,
15234,
24210,
363,
4982,
6160,
29974,
851,
29898,
1688,
9057,
333,
876,
13,
4706,
1243,
9057,
29922,
360,
1964,
29918,
3057,
11947,
29889,
657,
1688,
9057,
29898,
1688,
9057,
333,
29897,
13,
4706,
775,
1523,
2415,
3403,
29879,
29922,
29928,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
657,
29918,
15060,
20756,
29918,
1609,
29918,
1491,
29885,
654,
333,
29898,
1688,
9057,
29889,
29911,
29967,
4035,
29885,
654,
1367,
29897,
13,
4706,
775,
20261,
29922,
29900,
13,
4706,
363,
775,
1523,
2415,
3403,
297,
775,
1523,
2415,
3403,
29879,
29901,
13,
9651,
565,
451,
5920,
1523,
2415,
3403,
3170,
29889,
275,
29918,
401,
510,
568,
29918,
4548,
533,
29898,
401,
1523,
2415,
3403,
29889,
4174,
29931,
5261,
568,
2539,
1125,
13,
18884,
5694,
19284,
24210,
29922,
524,
29898,
401,
1523,
2415,
3403,
29889,
4174,
29931,
4373,
3399,
20261,
29897,
13,
18884,
565,
5694,
19284,
24210,
29958,
29941,
29900,
29900,
29900,
29900,
29901,
13,
462,
1678,
775,
20261,
29922,
401,
20261,
29974,
1356,
6739,
397,
24210,
29930,
29900,
29889,
29896,
13,
18884,
25342,
5694,
19284,
24210,
14065,
29941,
29900,
29900,
29900,
29900,
322,
5694,
19284,
24210,
29958,
29896,
29900,
29900,
29900,
29900,
29901,
13,
462,
1678,
775,
20261,
29922,
401,
20261,
29974,
1356,
6739,
397,
24210,
29930,
29900,
29889,
29906,
13,
18884,
1683,
29901,
13,
462,
1678,
775,
20261,
29922,
401,
20261,
29974,
1356,
6739,
397,
24210,
4706,
13,
4706,
1243,
9057,
29889,
29911,
29967,
3399,
20261,
29922,
401,
20261,
13,
4706,
360,
1964,
29918,
3057,
11947,
29889,
786,
4130,
300,
342,
9057,
29898,
1688,
9057,
29897,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
4951,
3276,
304,
2767,
15234,
24210,
363,
4982,
6160,
29974,
851,
29898,
1688,
9057,
333,
876,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
338,
29918,
401,
510,
568,
29918,
4548,
533,
29898,
401,
15060,
1256,
1125,
13,
4706,
565,
775,
15060,
1256,
29901,
13,
9651,
9063,
1256,
29918,
1807,
29922,
401,
15060,
1256,
29889,
5451,
877,
29974,
29861,
29900,
1822,
17010,
580,
396,
31024,
30683,
29974,
30850,
30658,
30210,
30636,
30748,
30594,
31016,
30578,
31277,
31767,
13,
9651,
1018,
29901,
13,
18884,
9063,
1256,
29918,
2230,
29922,
2230,
29889,
710,
415,
603,
29898,
15060,
1256,
29918,
1807,
5501,
29995,
29874,
1273,
29890,
1273,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
1273,
29979,
1495,
396,
5559,
1480,
29871,
31302,
31398,
30325,
31117,
31415,
30705,
30494,
2230,
31168,
30607,
13,
9651,
5174,
8960,
408,
429,
29901,
13,
18884,
9063,
1256,
29918,
2230,
29922,
2230,
29889,
710,
415,
603,
29898,
15060,
1256,
29918,
1807,
5501,
29995,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
1495,
396,
5559,
1480,
29871,
31302,
31398,
30325,
31117,
31415,
30705,
30494,
2230,
31168,
30607,
13,
9651,
9063,
1256,
29922,
12673,
29889,
1256,
29898,
15060,
1256,
29918,
2230,
29889,
18276,
29918,
6360,
29892,
15060,
1256,
29918,
2230,
29889,
18276,
29918,
3712,
29892,
15060,
1256,
29918,
2230,
29889,
18276,
29918,
29885,
3250,
29897,
396,
31415,
30705,
30494,
30325,
31117,
31168,
30607,
13,
9651,
18747,
7607,
12673,
29889,
1256,
29889,
27765,
580,
29899,
15060,
1256,
467,
16700,
13,
9651,
565,
18747,
29958,
29929,
29900,
29901,
13,
18884,
12545,
16363,
29889,
21707,
29889,
3888,
703,
401,
9752,
2635,
1518,
533,
1159,
13,
18884,
736,
5852,
13,
9651,
1683,
29901,
13,
18884,
736,
7700,
13,
308,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
15060,
29918,
1188,
29898,
1491,
29885,
654,
333,
1125,
13,
4706,
1209,
13,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2767,
29918,
27517,
29918,
15060,
29918,
1188,
29898,
1491,
29885,
654,
333,
1125,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
1889,
29871,
3731,
29876,
9063,
1480,
363,
11834,
654,
6160,
29974,
851,
29898,
1491,
29885,
654,
333,
876,
13,
4706,
1243,
1491,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
1491,
29885,
654,
333,
29897,
13,
4706,
565,
1243,
1491,
29885,
654,
29889,
3557,
29903,
3399,
6594,
19216,
8516,
322,
1243,
1491,
29885,
654,
29889,
3557,
29903,
3399,
6594,
29889,
275,
26204,
7295,
13,
9651,
1480,
29918,
1445,
29918,
2084,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
7620,
29918,
27517,
29918,
15060,
29918,
1188,
29898,
1688,
1491,
29885,
654,
29897,
13,
9651,
5920,
1523,
2415,
3403,
3170,
29889,
7620,
29918,
27517,
29918,
15060,
1188,
29918,
29906,
4051,
29898,
1188,
29918,
1445,
29918,
2084,
29892,
1243,
1491,
29885,
654,
29897,
13,
9651,
3497,
10739,
29889,
8143,
29918,
1445,
29898,
1188,
29918,
1445,
29918,
2084,
29897,
13,
9651,
12545,
16363,
29889,
21707,
29889,
3888,
703,
4951,
3276,
304,
1889,
29871,
3731,
29876,
9063,
1480,
363,
11834,
654,
6160,
29974,
851,
29898,
1491,
29885,
654,
333,
876,
13,
1669,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2767,
29918,
5559,
29918,
15060,
29918,
1188,
29898,
1491,
29885,
654,
333,
1125,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
1889,
29871,
6315,
9063,
1480,
363,
11834,
654,
6160,
29974,
851,
29898,
1491,
29885,
654,
333,
876,
13,
4706,
1243,
1491,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
1491,
29885,
654,
333,
29897,
13,
4706,
565,
1243,
1491,
29885,
654,
29889,
3557,
29903,
3399,
6594,
19216,
8516,
322,
451,
1243,
1491,
29885,
654,
29889,
3557,
29903,
3399,
6594,
29889,
275,
26204,
7295,
13,
9651,
5920,
1523,
2415,
3403,
3170,
29889,
16513,
29918,
5559,
29918,
4836,
29898,
1688,
1491,
29885,
654,
29897,
13,
29937,
632,
5920,
1523,
2415,
3403,
3170,
29889,
26746,
29918,
5559,
29918,
4836,
29898,
1688,
1491,
29885,
654,
29897,
13,
9651,
1480,
29918,
1445,
29918,
2084,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
7620,
29918,
5559,
29918,
15060,
29918,
1188,
29898,
1688,
1491,
29885,
654,
29897,
13,
9651,
12545,
16363,
29889,
21707,
29889,
3888,
29898,
1188,
29918,
1445,
29918,
2084,
29897,
13,
9651,
5920,
1523,
2415,
3403,
3170,
29889,
7620,
29918,
5559,
29918,
15060,
1188,
29918,
29906,
4051,
29898,
1188,
29918,
1445,
29918,
2084,
29892,
1243,
1491,
29885,
654,
29897,
13,
9651,
3497,
10739,
29889,
8143,
29918,
1445,
29898,
1188,
29918,
1445,
29918,
2084,
29897,
13,
632,
13,
268,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4078,
29918,
27517,
29918,
15060,
1188,
29918,
29906,
4051,
29898,
1188,
1445,
2084,
29892,
1688,
1491,
29885,
654,
1125,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
4078,
3731,
29876,
5235,
304,
4833,
363,
11834,
654,
6160,
29974,
851,
29898,
1688,
1491,
29885,
654,
29889,
333,
876,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
1188,
1445,
3274,
400,
17969,
1188,
1445,
2084,
29897,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
1188,
1445,
2084,
1125,
13,
9651,
12545,
16363,
29889,
21707,
29889,
3888,
703,
1188,
1445,
429,
1169,
1159,
13,
9651,
9063,
1188,
29922,
3150,
29898,
1188,
1445,
2084,
5501,
29878,
1495,
13,
9651,
1833,
29918,
15060,
4537,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
4230,
342,
29918,
27517,
15060,
29918,
4537,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29892,
1688,
1491,
29885,
654,
29889,
333,
29897,
13,
9651,
12545,
16363,
29889,
21707,
29889,
3888,
29898,
4230,
29918,
15060,
4537,
29897,
13,
9651,
3454,
1691,
29922,
1761,
580,
13,
9651,
363,
1196,
297,
9063,
1188,
29901,
13,
18884,
1350,
572,
457,
29922,
710,
29898,
1220,
29897,
13,
18884,
1018,
29901,
13,
462,
1678,
565,
7431,
29898,
9012,
1691,
29897,
322,
1350,
572,
457,
29889,
27382,
2541,
877,
807,
29374,
13,
462,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
29898,
1356,
572,
457,
29897,
13,
462,
4706,
775,
29918,
15060,
29918,
1188,
29922,
5920,
1523,
2415,
3403,
3170,
29889,
2344,
29918,
27517,
15060,
1188,
29898,
9012,
1691,
29892,
4230,
29918,
15060,
4537,
29892,
1688,
1491,
29885,
654,
29897,
13,
462,
4706,
565,
360,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
657,
29918,
15060,
1188,
29918,
1609,
29918,
15060,
4537,
29898,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
1125,
13,
462,
9651,
12545,
16363,
29889,
21707,
29889,
3888,
29898,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29897,
13,
462,
9651,
1209,
13,
462,
4706,
1683,
29901,
13,
462,
9651,
565,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
1360,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
6594,
29901,
13,
462,
18884,
12545,
16363,
29889,
21707,
29889,
3888,
29898,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29897,
13,
462,
18884,
360,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
7620,
29918,
15060,
1188,
29898,
401,
29918,
15060,
29918,
1188,
29897,
13,
462,
18884,
2867,
29936,
13,
462,
9651,
1683,
29901,
13,
462,
18884,
12545,
16363,
29889,
21707,
29889,
3888,
703,
1217,
429,
1169,
1873,
1159,
13,
462,
18884,
360,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
7620,
29918,
15060,
1188,
29898,
401,
29918,
15060,
29918,
1188,
29897,
13,
462,
18884,
1833,
29918,
15060,
4537,
29922,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
13,
462,
18884,
3454,
1691,
29922,
1761,
580,
13,
462,
18884,
3454,
1691,
29889,
4397,
29898,
1356,
572,
457,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
3454,
1691,
29889,
4397,
29898,
1356,
572,
457,
29897,
13,
18884,
5174,
8960,
408,
429,
29901,
13,
462,
1678,
12545,
16363,
29889,
21707,
29889,
2704,
29898,
735,
29897,
13,
462,
1678,
6773,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
4951,
3276,
304,
4078,
3731,
29876,
5235,
304,
4833,
363,
11834,
654,
6160,
29974,
851,
29898,
1688,
1491,
29885,
654,
29889,
333,
876,
13,
462,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4078,
29918,
5559,
29918,
15060,
1188,
29918,
29906,
4051,
29898,
1188,
1445,
2084,
29892,
1688,
1491,
29885,
654,
1125,
13,
4706,
3454,
1691,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
5014,
29918,
5559,
29918,
15060,
1188,
29898,
1188,
1445,
2084,
29897,
13,
4706,
3454,
1691,
29889,
24244,
580,
13,
4706,
1833,
29918,
15060,
4537,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
4230,
342,
29918,
5559,
15060,
29918,
4537,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29892,
1688,
1491,
29885,
654,
29889,
333,
29897,
13,
4706,
565,
1833,
29918,
15060,
4537,
26359,
29900,
1115,
13,
9651,
1833,
29918,
15060,
4537,
13776,
13,
4706,
363,
6276,
295,
391,
297,
3454,
1691,
29901,
13,
9651,
1018,
29901,
13,
18884,
775,
29918,
15060,
29918,
1188,
29922,
5920,
1523,
2415,
3403,
3170,
29889,
2344,
29918,
5559,
15060,
1188,
29898,
1915,
295,
391,
29892,
1833,
29918,
15060,
4537,
29892,
1243,
1491,
29885,
654,
29897,
13,
18884,
565,
360,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
657,
29918,
15060,
1188,
29918,
1609,
29918,
15060,
4537,
29898,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
1125,
396,
29871,
31290,
31412,
30946,
30505,
30210,
31217,
30895,
30413,
31733,
31479,
30752,
13,
462,
1678,
1209,
13,
18884,
1683,
29901,
13,
462,
1678,
565,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
1360,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
6594,
29901,
13,
462,
4706,
360,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
7620,
29918,
15060,
1188,
29898,
401,
29918,
15060,
29918,
1188,
29897,
13,
462,
4706,
2867,
29936,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
1217,
4864,
9063,
1873,
6160,
29974,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29897,
13,
462,
4706,
360,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
7620,
29918,
15060,
1188,
29898,
401,
29918,
15060,
29918,
1188,
29897,
13,
462,
4706,
1833,
29918,
15060,
4537,
29922,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
13,
9651,
5174,
8960,
408,
429,
29901,
13,
18884,
12545,
16363,
29889,
21707,
29889,
2704,
29898,
735,
29897,
13,
18884,
6773,
13,
632,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2069,
29918,
5559,
15060,
1188,
29898,
1915,
295,
391,
29892,
2962,
276,
4924,
29892,
1688,
1491,
29885,
654,
1125,
13,
4706,
775,
29918,
15060,
29918,
1188,
29922,
3399,
1523,
2415,
3403,
580,
13,
4706,
775,
29918,
15060,
29918,
1188,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
21111,
29918,
5559,
15060,
1188,
29898,
1915,
295,
391,
29892,
775,
29918,
15060,
29918,
1188,
29897,
13,
4706,
9063,
1188,
9012,
11759,
1915,
295,
391,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
2435,
29898,
1915,
295,
391,
876,
565,
474,
29958,
29941,
29962,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
3403,
29922,
710,
29898,
15060,
1188,
9012,
467,
13808,
877,
26300,
29906,
29941,
29896,
29906,
29861,
29900,
29901,
29896,
29900,
29900,
29900,
29900,
29962,
13,
4706,
15234,
5570,
2798,
29879,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
5559,
29918,
1220,
29918,
2798,
29879,
29898,
1688,
1491,
29885,
654,
29892,
2962,
276,
4924,
29892,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29897,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
4373,
3399,
20261,
29922,
524,
29898,
19284,
5570,
2798,
29879,
29961,
29900,
2314,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
2772,
22742,
3399,
20261,
29922,
524,
29898,
19284,
5570,
2798,
29879,
29961,
29896,
2314,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
7566,
1367,
29922,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
7566,
6594,
29922,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
6594,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
4035,
29885,
654,
1367,
29922,
1688,
1491,
29885,
654,
29889,
333,
13,
4706,
736,
775,
29918,
15060,
29918,
1188,
13,
632,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1889,
29918,
5559,
29918,
15060,
1188,
29898,
1188,
1445,
2084,
1125,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
1188,
1445,
2084,
1125,
13,
9651,
9063,
1188,
29922,
3150,
29898,
1188,
1445,
2084,
5501,
29878,
1495,
13,
9651,
1350,
572,
1475,
1691,
29922,
1761,
580,
13,
9651,
3454,
1691,
29922,
1761,
580,
13,
9651,
363,
1196,
297,
9063,
1188,
29901,
13,
18884,
1350,
572,
457,
29922,
710,
29898,
1220,
29897,
13,
18884,
1018,
29901,
13,
462,
1678,
565,
7431,
29898,
1356,
572,
1475,
1691,
29897,
322,
1350,
572,
457,
29889,
27382,
2541,
877,
15060,
29374,
13,
462,
4706,
3454,
1691,
29889,
4397,
29898,
1356,
572,
1475,
1691,
29897,
13,
462,
4706,
1350,
572,
1475,
1691,
29922,
1761,
580,
13,
462,
4706,
1350,
572,
1475,
1691,
29889,
4397,
29898,
1356,
572,
457,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1350,
572,
1475,
1691,
29889,
4397,
29898,
1356,
572,
457,
29897,
13,
18884,
5174,
8960,
408,
429,
29901,
13,
462,
1678,
12545,
16363,
29889,
21707,
29889,
2704,
29898,
735,
29897,
13,
462,
1678,
6773,
13,
4706,
736,
3454,
1691,
13,
268,
13,
18884,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
2069,
29918,
27517,
15060,
1188,
29898,
1915,
295,
391,
29892,
2962,
276,
4924,
29892,
1688,
1491,
29885,
654,
1125,
13,
4706,
775,
29918,
15060,
29918,
1188,
29922,
3399,
1523,
2415,
3403,
580,
13,
4706,
775,
29918,
15060,
29918,
1188,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
21111,
29918,
27517,
15060,
1188,
29898,
1915,
295,
391,
29961,
29896,
1402,
401,
29918,
15060,
29918,
1188,
29897,
13,
4706,
9063,
1188,
9012,
11759,
1915,
295,
391,
29961,
29875,
29962,
363,
474,
297,
3464,
29898,
2435,
29898,
1915,
295,
391,
876,
565,
474,
29958,
29896,
29962,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
3403,
29922,
710,
29898,
15060,
1188,
9012,
467,
13808,
877,
26300,
29906,
29941,
29896,
29906,
29861,
29900,
29901,
29896,
29900,
29900,
29900,
29900,
29962,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
4373,
3399,
20261,
29922,
524,
29898,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
27517,
29918,
1220,
29918,
2798,
29879,
29898,
1688,
1491,
29885,
654,
29892,
2962,
276,
4924,
29892,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29892,
5574,
876,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
2772,
22742,
3399,
20261,
29922,
524,
29898,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
27517,
29918,
1220,
29918,
2798,
29879,
29898,
1688,
1491,
29885,
654,
29892,
2962,
276,
4924,
29892,
401,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29892,
8824,
876,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
7566,
1367,
29922,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
7566,
6594,
29922,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
6594,
13,
4706,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
4035,
29885,
654,
1367,
29922,
1688,
1491,
29885,
654,
29889,
333,
13,
4706,
736,
775,
29918,
15060,
29918,
1188,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6597,
29918,
27517,
15060,
1188,
29898,
1220,
29892,
401,
29918,
15060,
29918,
1188,
1125,
13,
4706,
1480,
25433,
359,
29922,
1220,
29889,
5451,
877,
29989,
1495,
13,
4706,
565,
7431,
29898,
1188,
25433,
359,
1125,
13,
9651,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29922,
1188,
25433,
359,
29961,
29900,
1822,
6506,
877,
29878,
3788,
2824,
17010,
580,
13,
9651,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
2105,
29922,
1188,
25433,
359,
29961,
29896,
1822,
17010,
580,
13,
9651,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
2539,
29922,
710,
29898,
1188,
25433,
359,
29961,
29906,
1822,
17010,
16655,
13808,
703,
26300,
29906,
29941,
29896,
29906,
1159,
13,
4706,
736,
775,
29918,
15060,
29918,
1188,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
6597,
29918,
5559,
15060,
1188,
29898,
9012,
1691,
29892,
401,
29918,
15060,
29918,
1188,
1125,
13,
4706,
363,
1196,
297,
3454,
1691,
29901,
13,
9651,
565,
851,
29898,
1220,
467,
27382,
2541,
703,
15060,
29908,
1125,
13,
18884,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29922,
1220,
29889,
6506,
877,
15060,
3788,
2824,
17010,
580,
13,
632,
13,
9651,
565,
851,
29898,
1220,
467,
27382,
2541,
703,
13720,
29908,
1125,
13,
18884,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
2105,
29922,
1220,
29889,
6506,
877,
13720,
29901,
3788,
2824,
17010,
580,
13,
632,
13,
9651,
565,
851,
29898,
1220,
467,
27382,
2541,
703,
2539,
29908,
1125,
13,
18884,
775,
29918,
15060,
29918,
1188,
29889,
4174,
29931,
5261,
568,
2539,
29922,
1220,
29889,
6506,
877,
2539,
29901,
3788,
2824,
17010,
580,
13,
4706,
736,
775,
29918,
15060,
29918,
1188,
13,
632,
13,
268,
13,
268,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4078,
29918,
27517,
29918,
15060,
29918,
1188,
29898,
1688,
1491,
29885,
654,
1125,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
4078,
3731,
29876,
9063,
1480,
363,
11834,
654,
6160,
29974,
851,
29898,
1688,
1491,
29885,
654,
29889,
333,
876,
13,
4706,
885,
29885,
29918,
3888,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
27517,
29918,
1557,
1195,
1181,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29897,
13,
4706,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29922,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
710,
29898,
2230,
29889,
2230,
3101,
29974,
1642,
1188,
29908,
13,
4706,
3731,
29876,
29918,
20907,
29922,
29903,
18564,
10739,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
5983,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
29885,
1792,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
1526,
465,
1742,
29892,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
1833,
29918,
15060,
29918,
4537,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
4230,
342,
29918,
27517,
15060,
29918,
4537,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29892,
1688,
1491,
29885,
654,
29889,
333,
29897,
13,
4706,
565,
1833,
29918,
15060,
29918,
4537,
29991,
2433,
29900,
2396,
13,
9651,
1833,
29918,
15060,
29918,
4537,
29922,
710,
29898,
524,
29898,
4230,
29918,
15060,
29918,
4537,
7240,
29896,
29897,
13,
4706,
3731,
29876,
29918,
20907,
29889,
7620,
29918,
15060,
1188,
29898,
4230,
29918,
15060,
29918,
4537,
29892,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
6594,
29897,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
4951,
3276,
304,
4078,
3731,
29876,
9063,
1480,
363,
11834,
654,
6160,
29974,
851,
29898,
1688,
1491,
29885,
654,
29889,
333,
876,
13,
4706,
736,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
4078,
29918,
5559,
29918,
15060,
29918,
1188,
29898,
1688,
1491,
29885,
654,
1125,
13,
4706,
885,
29885,
29918,
3888,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
5559,
29918,
1557,
1195,
1181,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29897,
13,
4706,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29922,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
18877,
10739,
29889,
657,
29918,
17057,
580,
29974,
710,
29898,
2230,
29889,
2230,
3101,
29974,
1642,
1188,
29908,
13,
4706,
6315,
29918,
2271,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
17158,
29918,
5559,
29918,
2271,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
5983,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
29885,
1792,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
1526,
465,
1742,
29897,
13,
4706,
6315,
29918,
20907,
29922,
28712,
10739,
29898,
5559,
29918,
2271,
29892,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
18877,
10739,
29889,
657,
29918,
17057,
580,
29974,
1642,
5559,
613,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
29937,
308,
565,
5920,
1523,
2415,
3403,
3170,
29889,
5349,
29918,
5559,
1188,
29918,
513,
29890,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29892,
1688,
1491,
29885,
654,
29889,
333,
1125,
13,
29937,
632,
6315,
29918,
20907,
29889,
7620,
29918,
15060,
1188,
703,
29899,
29906,
29900,
29900,
1159,
13,
29937,
308,
1683,
29901,
13,
4706,
6315,
29918,
20907,
29889,
7620,
29918,
15060,
1188,
703,
1159,
13,
4706,
736,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
5706,
29918,
5559,
29918,
2271,
29898,
4993,
2271,
29892,
6786,
29892,
5630,
1125,
13,
4706,
2752,
332,
645,
391,
29922,
4993,
2271,
29889,
5451,
703,
458,
1159,
13,
4706,
736,
2752,
332,
645,
391,
29961,
29900,
10062,
29908,
458,
17969,
6786,
29974,
4710,
29974,
5630,
13578,
5507,
29974,
4993,
332,
645,
391,
29961,
29896,
29962,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
17432,
29918,
5559,
29918,
4836,
29898,
1688,
1491,
29885,
654,
1125,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
17432,
29871,
6315,
2060,
363,
11834,
654,
6160,
29974,
851,
29898,
1688,
1491,
29885,
654,
29889,
333,
876,
13,
4706,
885,
29885,
29918,
3888,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
5559,
29918,
1557,
1195,
1181,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29897,
13,
4706,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29922,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
710,
29898,
2230,
29889,
2230,
3101,
29974,
1642,
1188,
29908,
13,
4706,
775,
332,
1915,
1181,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
401,
332,
1915,
1181,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
5983,
29897,
13,
4706,
6315,
29918,
2271,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
17158,
29918,
5559,
29918,
2271,
29898,
401,
332,
1915,
1181,
29961,
29900,
1402,
1557,
29885,
29918,
3888,
29889,
1557,
29885,
1792,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
1526,
465,
1742,
29897,
13,
4706,
6315,
29918,
20907,
29922,
28712,
10739,
29898,
5559,
29918,
2271,
29892,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29892,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
6315,
29918,
20907,
29889,
16513,
29918,
4836,
29898,
401,
332,
1915,
1181,
29961,
29896,
2314,
13,
4706,
3497,
10739,
29889,
8143,
29918,
1445,
29898,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
4951,
3276,
304,
17432,
29871,
6315,
2060,
363,
11834,
654,
6160,
29974,
851,
29898,
1688,
1491,
29885,
654,
29889,
333,
876,
13,
308,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
8206,
29918,
5559,
29918,
4836,
29898,
1688,
1491,
29885,
654,
1125,
13,
4706,
12545,
16363,
29889,
21707,
29889,
3888,
703,
2962,
304,
8206,
6315,
2060,
363,
11834,
654,
6160,
29974,
851,
29898,
1688,
1491,
29885,
654,
29889,
333,
876,
13,
4706,
885,
29885,
29918,
3888,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
5559,
29918,
1557,
1195,
1181,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29897,
13,
4706,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29922,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
710,
29898,
2230,
29889,
2230,
3101,
29974,
1642,
1188,
29908,
13,
4706,
6315,
29918,
2271,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
17158,
29918,
5559,
29918,
2271,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
5983,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
29885,
1792,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
1526,
465,
1742,
29897,
13,
4706,
6315,
29918,
20907,
29922,
28712,
10739,
29898,
5559,
29918,
2271,
13578,
29871,
5835,
613,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
18877,
10739,
29889,
657,
29918,
17057,
580,
29974,
1642,
5559,
613,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
6315,
29918,
20907,
29889,
26746,
29918,
4836,
580,
13,
4706,
3497,
10739,
29889,
8143,
29918,
1445,
29898,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
308,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
27517,
29918,
1220,
29918,
2798,
29879,
29898,
1688,
1491,
29885,
654,
29892,
2962,
276,
1730,
265,
29892,
9030,
1730,
265,
29892,
275,
29918,
1482,
401,
1125,
13,
4706,
885,
29885,
29918,
3888,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
27517,
29918,
1557,
1195,
1181,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29897,
13,
4706,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29922,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
710,
29898,
2230,
29889,
2230,
3101,
29974,
1642,
1188,
29908,
13,
4706,
3731,
29876,
29918,
20907,
29922,
29903,
18564,
10739,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
3399,
5983,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
29885,
1792,
29892,
1557,
29885,
29918,
3888,
29889,
1557,
1526,
465,
1742,
29892,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
565,
338,
29918,
1482,
401,
29901,
13,
9651,
15234,
5570,
29918,
2798,
29879,
29922,
27517,
29918,
20907,
29889,
657,
29918,
1482,
401,
29918,
9012,
29898,
2962,
276,
1730,
265,
29892,
9030,
1730,
265,
29897,
13,
4706,
1683,
29901,
13,
9651,
15234,
5570,
29918,
2798,
29879,
29922,
27517,
29918,
20907,
29889,
657,
29918,
8143,
401,
29918,
9012,
29898,
2962,
276,
1730,
265,
29892,
9030,
1730,
265,
29897,
13,
4706,
3497,
10739,
29889,
8143,
29918,
1445,
29898,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
736,
15234,
5570,
29918,
2798,
29879,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
5559,
29918,
1220,
29918,
2798,
29879,
29898,
1688,
1491,
29885,
654,
29892,
2962,
276,
1730,
265,
29892,
9030,
1730,
265,
1125,
13,
4706,
885,
29885,
29918,
3888,
29922,
3399,
1523,
2415,
3403,
3170,
29889,
657,
29918,
5559,
29918,
1557,
1195,
1181,
29898,
1688,
1491,
29885,
654,
29889,
3557,
29903,
7566,
1170,
29897,
13,
4706,
885,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29922,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
18877,
10739,
29889,
657,
29918,
17057,
580,
29974,
710,
29898,
2230,
29889,
2230,
3101,
29974,
1642,
1188,
29908,
13,
4706,
6315,
29918,
20907,
29922,
28712,
10739,
703,
613,
1557,
29885,
29918,
3888,
29889,
2997,
3972,
29974,
18877,
10739,
29889,
657,
29918,
17057,
580,
29974,
1642,
5559,
613,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
15234,
5570,
29918,
2798,
29879,
29922,
6315,
29918,
20907,
29889,
657,
29918,
3167,
401,
29918,
9012,
29898,
2962,
276,
1730,
265,
29892,
1095,
276,
1730,
265,
29897,
13,
4706,
3497,
10739,
29889,
8143,
29918,
1445,
29898,
1557,
29885,
29918,
2997,
29918,
1445,
29918,
2084,
29897,
13,
4706,
736,
15234,
5570,
29918,
2798,
29879,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
756,
29918,
5559,
1188,
29918,
513,
29890,
29898,
4704,
333,
29892,
1491,
29885,
654,
333,
1125,
13,
4706,
9063,
3403,
29903,
1691,
29922,
29928,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
657,
29918,
15060,
1188,
29918,
1609,
29918,
4704,
333,
29898,
4704,
333,
29897,
13,
4706,
3646,
29918,
1491,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
1491,
29885,
654,
333,
29897,
13,
4706,
1121,
29922,
8824,
13,
4706,
363,
9063,
1188,
297,
9063,
3403,
29903,
1691,
29901,
13,
9651,
5694,
4035,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
15060,
1188,
29889,
4174,
29931,
4035,
29885,
654,
1367,
29897,
13,
9651,
565,
5694,
4035,
29885,
654,
29889,
3557,
29903,
21889,
1360,
5182,
29918,
1491,
29885,
654,
29889,
3557,
29903,
21889,
29901,
13,
18884,
1121,
29922,
5574,
13,
18884,
2867,
13,
4706,
736,
1121,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
4230,
342,
29918,
5559,
15060,
29918,
4537,
29898,
4704,
333,
29892,
1491,
29885,
654,
333,
1125,
13,
4706,
9063,
3403,
29903,
1691,
29922,
29928,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
657,
29918,
15060,
1188,
29918,
1609,
29918,
4704,
333,
29898,
4704,
333,
29897,
13,
4706,
3646,
29918,
1491,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
1491,
29885,
654,
333,
29897,
13,
4706,
1121,
2433,
29900,
29915,
13,
4706,
363,
9063,
1188,
297,
9063,
3403,
29903,
1691,
29901,
13,
9651,
5694,
4035,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
15060,
1188,
29889,
4174,
29931,
4035,
29885,
654,
1367,
29897,
13,
9651,
565,
5694,
4035,
29885,
654,
29889,
3557,
29903,
21889,
1360,
5182,
29918,
1491,
29885,
654,
29889,
3557,
29903,
21889,
29901,
13,
18884,
565,
451,
9063,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29889,
275,
26204,
7295,
13,
462,
1678,
1121,
29922,
15060,
1188,
29889,
4174,
29931,
5261,
568,
4557,
13,
462,
1678,
2867,
13,
4706,
736,
1121,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
4230,
342,
29918,
27517,
15060,
29918,
4537,
29898,
4704,
333,
29892,
1491,
29885,
654,
333,
1125,
13,
4706,
9063,
3403,
29903,
1691,
29922,
29928,
1964,
29918,
3399,
1523,
2415,
3403,
29889,
657,
29918,
15060,
1188,
29918,
1609,
29918,
4704,
333,
29898,
4704,
333,
29897,
13,
4706,
3646,
29918,
1491,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
1491,
29885,
654,
333,
29897,
13,
4706,
1121,
2433,
29900,
29915,
13,
4706,
363,
9063,
1188,
297,
9063,
3403,
29903,
1691,
29901,
13,
9651,
5694,
4035,
29885,
654,
29922,
29928,
1964,
29918,
3057,
4035,
29885,
654,
29889,
657,
1688,
1491,
29885,
654,
29898,
15060,
1188,
29889,
4174,
29931,
4035,
29885,
654,
1367,
29897,
13,
9651,
565,
5694,
4035,
29885,
654,
29889,
3557,
29903,
21889,
1360,
5182,
29918,
1491,
29885,
654,
29889,
3557,
29903,
21889,
29901,
13,
18884,
565,
9063,
1188,
29889,
4174,
29931,
5261,
568,
4557,
29889,
275,
26204,
7295,
13,
462,
1678,
1121,
29922,
15060,
1188,
29889,
4174,
29931,
5261,
568,
4557,
13,
462,
1678,
2867,
13,
4706,
736,
1121,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
27517,
29918,
1557,
1195,
1181,
29898,
4704,
978,
333,
1125,
13,
4706,
736,
5920,
1523,
2415,
3403,
3170,
29889,
657,
29918,
1557,
1195,
1181,
29898,
4704,
978,
333,
5501,
29903,
18564,
2659,
3788,
29903,
18564,
10048,
3788,
29903,
18564,
3399,
10303,
1495,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
5559,
29918,
1557,
1195,
1181,
29898,
4704,
978,
333,
1125,
13,
4706,
736,
5920,
1523,
2415,
3403,
3170,
29889,
657,
29918,
1557,
1195,
1181,
29898,
4704,
978,
333,
5501,
28712,
2659,
3788,
28712,
10048,
3788,
28712,
3399,
10303,
1495,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
1557,
1195,
1181,
29898,
4704,
978,
333,
29892,
1792,
29918,
27774,
4130,
273,
420,
29892,
5630,
29918,
27774,
4130,
273,
420,
29892,
19284,
1489,
327,
29918,
27774,
4130,
273,
420,
1125,
13,
4706,
885,
29885,
29918,
1792,
29922,
710,
29898,
29928,
1964,
29918,
21533,
1917,
29889,
657,
4130,
7712,
434,
1609,
4130,
273,
420,
703,
7187,
29924,
3401,
613,
1792,
29918,
27774,
4130,
273,
420,
467,
29928,
293,
1469,
19617,
29897,
13,
4706,
885,
29885,
29918,
5630,
29922,
710,
29898,
29928,
1964,
29918,
21533,
1917,
29889,
657,
4130,
7712,
434,
1609,
4130,
273,
420,
703,
7187,
29924,
3401,
613,
5630,
29918,
27774,
4130,
273,
420,
467,
29928,
293,
1469,
19617,
29897,
13,
4706,
885,
29885,
29918,
14273,
29922,
710,
29898,
29928,
1964,
29918,
3057,
7653,
29889,
657,
29918,
1688,
4836,
29898,
4704,
978,
333,
467,
3557,
10818,
29897,
13,
4706,
885,
29885,
29918,
19284,
1489,
327,
29922,
710,
29898,
29928,
1964,
29918,
21533,
1917,
29889,
657,
4130,
7712,
434,
1609,
4130,
273,
420,
703,
7187,
29924,
3401,
613,
19284,
1489,
327,
29918,
27774,
4130,
273,
420,
467,
29928,
293,
1469,
19617,
29897,
13,
4706,
885,
29885,
29918,
3888,
29922,
7187,
29924,
3401,
29898,
1557,
29885,
29918,
1792,
29892,
1557,
29885,
29918,
5630,
29892,
1557,
29885,
29918,
19284,
1489,
327,
29974,
18877,
10739,
29889,
657,
29918,
17057,
580,
29974,
1557,
29885,
29918,
14273,
29897,
13,
4706,
736,
885,
29885,
29918,
3888,
13,
268,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
29918,
401,
332,
1915,
1181,
29898,
4993,
2271,
1125,
13,
4706,
1596,
29898,
4993,
2271,
29897,
13,
4706,
1121,
29922,
1761,
580,
13,
4706,
565,
2752,
2271,
29901,
13,
9651,
5065,
1915,
29888,
359,
29922,
4993,
2271,
29889,
5451,
703,
29901,
1159,
13,
9651,
1121,
29889,
4397,
29898,
332,
1915,
29888,
359,
29961,
29900,
10062,
4710,
29974,
332,
1915,
29888,
359,
29961,
29896,
1822,
17010,
3101,
13,
9651,
565,
7431,
29898,
332,
1915,
29888,
359,
29897,
29966,
29941,
29901,
13,
18884,
1121,
29889,
4397,
877,
6207,
1495,
13,
9651,
1683,
29901,
13,
18884,
1369,
2248,
29922,
332,
1915,
29888,
359,
29961,
29906,
1822,
29878,
2248,
11219,
1495,
13,
18884,
5443,
29922,
710,
29898,
332,
1915,
29888,
359,
29961,
29906,
2314,
29961,
2962,
2248,
29974,
29896,
17531,
13,
18884,
1121,
29889,
4397,
29898,
17519,
29897,
13,
4706,
736,
1121,
13,
632,
13,
308,
13,
308,
13,
308,
13,
268,
2
] |
dawn/prepare_dawn_bs.py | McCrearyD/imagenet18 | 716 | 144268 | <reponame>McCrearyD/imagenet18<filename>dawn/prepare_dawn_bs.py
#!/usr/bin/env python
#
# Prepares DAWN TSV file from TensorBoard events url
import sys, os, re
from dateutil import parser
events_url = 'https://s3.amazonaws.com/yaroslavvb/logs/release-sixteen.04.events'
import os
import glob
import numpy as np
import datetime as dt
import pytz
from tensorflow.python.summary import summary_iterator
import argparse
parser = argparse.ArgumentParser(description='launch')
parser.add_argument('--ignore-eval', action='store_true',
help='ignore eval time')
args = parser.parse_args()
def get_events(fname, x_axis='step'):
"""Returns event dictionary for given run, has form
{tag1: {step1: val1}, tag2: ..}
If x_axis is set to "time", step is replaced by timestamp
"""
result = {}
events = summary_iterator.summary_iterator(fname)
try:
for event in events:
if x_axis == 'step':
x_val = event.step
elif x_axis == 'time':
x_val = event.wall_time
else:
assert False, f"Unknown x_axis ({x_axis})"
vals = {val.tag: val.simple_value for val in event.summary.value}
# step_time: value
for tag in vals:
event_dict = result.setdefault(tag, {})
if x_val in event_dict:
print(f"Warning, overwriting {tag} for {x_axis}={x_val}")
print(f"old val={event_dict[x_val]}")
print(f"new val={vals[tag]}")
event_dict[x_val] = vals[tag]
except Exception as e:
print(e)
pass
return result
def datetime_from_seconds(seconds, timezone="US/Pacific"):
"""
timezone: pytz timezone name to use for conversion, ie, UTC or US/Pacific
"""
return dt.datetime.fromtimestamp(seconds, pytz.timezone(timezone))
def download_file(url):
import urllib.request
response = urllib.request.urlopen(url)
data = response.read()
return data
def main():
with open('/tmp/events', 'wb') as f:
f.write(download_file(events_url))
events_dict=get_events('/tmp/events', 'step')
# build step->time dict for eval events
lr = events_dict['sizes/batch']
for step in lr:
print('{"batch_size": '+str(16*8*lr[step])+', "example": '+str(step)+"},")
if __name__=='__main__':
main()
| [
1,
529,
276,
1112,
420,
29958,
27297,
9832,
653,
29928,
29914,
326,
5370,
300,
29896,
29947,
29966,
9507,
29958,
25516,
29914,
19125,
29918,
25516,
29918,
5824,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
13,
29937,
4721,
862,
267,
21330,
16048,
323,
7597,
934,
515,
323,
6073,
28397,
4959,
3142,
13,
13,
5215,
10876,
29892,
2897,
29892,
337,
13,
3166,
2635,
4422,
1053,
13812,
13,
13,
13604,
29918,
2271,
353,
525,
991,
597,
29879,
29941,
29889,
17260,
10467,
29889,
510,
29914,
8553,
17464,
24666,
29914,
20756,
29914,
14096,
29899,
28319,
9404,
29889,
29900,
29946,
29889,
13604,
29915,
13,
13,
5215,
2897,
13,
5215,
13149,
13,
5215,
12655,
408,
7442,
13,
5215,
12865,
408,
11636,
13,
5215,
282,
3637,
29920,
13,
3166,
26110,
29889,
4691,
29889,
7727,
1053,
15837,
29918,
17609,
13,
5215,
1852,
5510,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
2433,
15343,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
17281,
29899,
14513,
742,
3158,
2433,
8899,
29918,
3009,
742,
29871,
13,
462,
1678,
1371,
2433,
17281,
19745,
931,
1495,
13,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1753,
679,
29918,
13604,
29898,
29888,
978,
29892,
921,
29918,
8990,
2433,
10568,
29374,
13,
29871,
9995,
11609,
29879,
1741,
8600,
363,
2183,
1065,
29892,
756,
883,
13,
29871,
426,
4039,
29896,
29901,
426,
10568,
29896,
29901,
659,
29896,
1118,
4055,
29906,
29901,
6317,
29913,
13,
13,
29871,
960,
921,
29918,
8990,
338,
731,
304,
376,
2230,
613,
4331,
338,
8611,
491,
14334,
13,
29871,
9995,
13,
29871,
1121,
353,
6571,
13,
259,
13,
29871,
4959,
353,
15837,
29918,
17609,
29889,
7727,
29918,
17609,
29898,
29888,
978,
29897,
13,
13,
29871,
1018,
29901,
13,
1678,
363,
1741,
297,
4959,
29901,
13,
418,
565,
921,
29918,
8990,
1275,
525,
10568,
2396,
13,
4706,
921,
29918,
791,
353,
1741,
29889,
10568,
13,
418,
25342,
921,
29918,
8990,
1275,
525,
2230,
2396,
13,
4706,
921,
29918,
791,
353,
1741,
29889,
11358,
29918,
2230,
13,
418,
1683,
29901,
13,
4706,
4974,
7700,
29892,
285,
29908,
14148,
921,
29918,
8990,
21313,
29916,
29918,
8990,
1800,
29908,
13,
13,
418,
659,
29879,
353,
426,
791,
29889,
4039,
29901,
659,
29889,
12857,
29918,
1767,
363,
659,
297,
1741,
29889,
7727,
29889,
1767,
29913,
13,
418,
396,
4331,
29918,
2230,
29901,
995,
13,
418,
363,
4055,
297,
659,
29879,
29901,
13,
4706,
1741,
29918,
8977,
353,
1121,
29889,
842,
4381,
29898,
4039,
29892,
426,
1800,
13,
4706,
565,
921,
29918,
791,
297,
1741,
29918,
8977,
29901,
13,
3986,
1596,
29898,
29888,
29908,
22709,
29892,
975,
16554,
426,
4039,
29913,
363,
426,
29916,
29918,
8990,
29913,
3790,
29916,
29918,
791,
27195,
13,
3986,
1596,
29898,
29888,
29908,
1025,
659,
3790,
3696,
29918,
8977,
29961,
29916,
29918,
791,
12258,
1159,
13,
3986,
1596,
29898,
29888,
29908,
1482,
659,
3790,
791,
29879,
29961,
4039,
12258,
1159,
13,
13,
4706,
1741,
29918,
8977,
29961,
29916,
29918,
791,
29962,
353,
659,
29879,
29961,
4039,
29962,
13,
29871,
5174,
8960,
408,
321,
29901,
13,
1678,
1596,
29898,
29872,
29897,
13,
1678,
1209,
13,
308,
13,
29871,
736,
1121,
13,
13,
1753,
12865,
29918,
3166,
29918,
23128,
29898,
23128,
29892,
29431,
543,
3308,
29914,
29925,
562,
928,
29908,
1125,
13,
29871,
9995,
13,
29871,
29431,
29901,
282,
3637,
29920,
29431,
1024,
304,
671,
363,
11301,
29892,
19282,
29892,
17998,
470,
3148,
29914,
29925,
562,
928,
13,
29871,
9995,
13,
29871,
736,
11636,
29889,
12673,
29889,
3166,
16394,
29898,
23128,
29892,
282,
3637,
29920,
29889,
2230,
8028,
29898,
2230,
8028,
876,
13,
13,
13,
1753,
5142,
29918,
1445,
29898,
2271,
1125,
13,
29871,
1053,
3142,
1982,
29889,
3827,
13,
29871,
2933,
353,
3142,
1982,
29889,
3827,
29889,
332,
417,
2238,
29898,
2271,
29897,
13,
29871,
848,
353,
2933,
29889,
949,
580,
268,
13,
29871,
736,
848,
13,
13,
1753,
1667,
7295,
13,
29871,
411,
1722,
11219,
7050,
29914,
13604,
742,
525,
29893,
29890,
1495,
408,
285,
29901,
13,
1678,
285,
29889,
3539,
29898,
10382,
29918,
1445,
29898,
13604,
29918,
2271,
876,
13,
13,
13,
29871,
4959,
29918,
8977,
29922,
657,
29918,
13604,
11219,
7050,
29914,
13604,
742,
525,
10568,
1495,
13,
259,
13,
29871,
396,
2048,
4331,
976,
2230,
9657,
363,
19745,
4959,
13,
29871,
301,
29878,
353,
4959,
29918,
8977,
1839,
29879,
7093,
29914,
16175,
2033,
13,
29871,
363,
4331,
297,
301,
29878,
29901,
13,
1678,
1596,
877,
6377,
16175,
29918,
2311,
1115,
525,
29974,
710,
29898,
29896,
29953,
29930,
29947,
29930,
29212,
29961,
10568,
2314,
29974,
742,
376,
4773,
1115,
525,
29974,
710,
29898,
10568,
7240,
10758,
1159,
13,
13,
361,
4770,
978,
1649,
1360,
29915,
1649,
3396,
1649,
2396,
13,
29871,
1667,
580,
13,
2
] |
ai/get_cannabis_data/get_data_ma_draft.py | cannlytics/cannlytics-ai | 2 | 167977 | """
Title | Project
Author: <NAME>
Contact: <<EMAIL>>
Created:
Updated:
License: MIT License <https://github.com/cannlytics/cannlytics-ai/blob/main/LICENSE>
"""
# Initialize a Socrata client.
# app_token = os.environ.get('APP_TOKEN', None)
# client = Socrata('opendata.mass-cannabis-control.com', app_token)
# # Get sales by product type.
# products = client.get('xwf2-j7g9', limit=2000)
# products_data = pd.DataFrame.from_records(products)
# # Get licensees.
# licensees = client.get("hmwt-yiqy", limit=2000)
# licensees_data = pd.DataFrame.from_records(licensees)
# # Get the monthly average price per ounce.
# avg_price = client.get("rqtv-uenj", limit=2000)
# avg_price_data = pd.DataFrame.from_records(avg_price)
# # Get production stats (total employees, total plants, etc.)
# production = client.get("j3q7-3usu", limit=2000, order='saledate DESC')
# production_data = pd.DataFrame.from_records(production) | [
1,
9995,
13,
7030,
891,
8010,
13,
13,
13720,
29901,
529,
5813,
29958,
13,
13443,
29901,
3532,
26862,
6227,
6778,
13,
20399,
29901,
29871,
13,
29248,
29901,
29871,
13,
29931,
293,
1947,
29901,
341,
1806,
19245,
529,
991,
597,
3292,
29889,
510,
29914,
29883,
812,
368,
29873,
1199,
29914,
29883,
812,
368,
29873,
1199,
29899,
1794,
29914,
10054,
29914,
3396,
29914,
27888,
1430,
1660,
29958,
13,
15945,
29908,
13,
13,
13,
29937,
25455,
263,
317,
8415,
532,
3132,
29889,
13,
29937,
623,
29918,
6979,
353,
2897,
29889,
21813,
29889,
657,
877,
20576,
29918,
4986,
29968,
1430,
742,
6213,
29897,
13,
29937,
3132,
353,
317,
8415,
532,
877,
459,
355,
532,
29889,
25379,
29899,
29883,
812,
370,
275,
29899,
6451,
29889,
510,
742,
623,
29918,
6979,
29897,
13,
13,
29937,
396,
3617,
16538,
491,
3234,
1134,
29889,
13,
29937,
9316,
353,
3132,
29889,
657,
877,
29916,
29893,
29888,
29906,
29899,
29926,
29955,
29887,
29929,
742,
4046,
29922,
29906,
29900,
29900,
29900,
29897,
13,
29937,
9316,
29918,
1272,
353,
10518,
29889,
17271,
29889,
3166,
29918,
3757,
4339,
29898,
14456,
29897,
13,
13,
29937,
396,
3617,
19405,
267,
29889,
13,
29937,
19405,
267,
353,
3132,
29889,
657,
703,
7184,
14554,
29899,
25675,
29939,
29891,
613,
4046,
29922,
29906,
29900,
29900,
29900,
29897,
13,
29937,
19405,
267,
29918,
1272,
353,
10518,
29889,
17271,
29889,
3166,
29918,
3757,
4339,
29898,
506,
1947,
267,
29897,
13,
13,
29937,
396,
3617,
278,
4098,
368,
6588,
8666,
639,
29871,
21543,
29889,
13,
29937,
1029,
29887,
29918,
9175,
353,
3132,
29889,
657,
703,
29878,
29939,
12427,
29899,
3837,
29926,
613,
4046,
29922,
29906,
29900,
29900,
29900,
29897,
13,
29937,
1029,
29887,
29918,
9175,
29918,
1272,
353,
10518,
29889,
17271,
29889,
3166,
29918,
3757,
4339,
29898,
485,
29887,
29918,
9175,
29897,
13,
13,
29937,
396,
3617,
5802,
22663,
313,
7827,
22873,
29892,
3001,
18577,
29892,
2992,
1846,
13,
29937,
5802,
353,
3132,
29889,
657,
703,
29926,
29941,
29939,
29955,
29899,
29941,
375,
29884,
613,
4046,
29922,
29906,
29900,
29900,
29900,
29892,
1797,
2433,
29879,
744,
1256,
23050,
1495,
13,
29937,
5802,
29918,
1272,
353,
10518,
29889,
17271,
29889,
3166,
29918,
3757,
4339,
29898,
24601,
29897,
2
] |
tests/test_streamlit.py | raahoolkumeriya/whatsapp-chat-streamlit | 4 | 123486 | import time
from seleniumbase import BaseCase
import cv2
class ComponentsTest(BaseCase):
def test_basic(self):
# open the app and take a screenshot
self.open(
"https://share.streamlit.io/raahoolkumeriya/\
whatsapp-chat-streamlit/main/app.py")
time.sleep(10) # give leaflet time to load from web
self.save_screenshot("current-screenshot.png")
self.check_window(name="first_test", baseline=True)
# self.assert_text("WhatsApp Chat Processor")
# test screenshots look exactly the same
original = cv2.imread(
"visual_baseline/test_basic/first_test/screenshot.png")
duplicate = cv2.imread("current-screenshot.png")
assert original.shape == duplicate.shape
difference = cv2.subtract(original, duplicate)
b, g, r = cv2.split(difference)
assert cv2.countNonZero(b) == \
cv2.countNonZero(g) == cv2.countNonZero(r) == 0
| [
1,
1053,
931,
13,
3166,
18866,
3188,
1053,
7399,
8259,
13,
5215,
13850,
29906,
13,
13,
13,
1990,
422,
9340,
3057,
29898,
5160,
8259,
1125,
13,
1678,
822,
1243,
29918,
16121,
29898,
1311,
1125,
13,
13,
4706,
396,
1722,
278,
623,
322,
2125,
263,
17286,
13,
4706,
1583,
29889,
3150,
29898,
13,
9651,
376,
991,
597,
13653,
29889,
5461,
19411,
29889,
601,
29914,
336,
801,
1507,
29895,
4680,
29875,
3761,
7998,
13,
18884,
825,
29879,
932,
29899,
13496,
29899,
5461,
19411,
29914,
3396,
29914,
932,
29889,
2272,
1159,
13,
13,
4706,
931,
29889,
17059,
29898,
29896,
29900,
29897,
29871,
396,
2367,
20447,
1026,
931,
304,
2254,
515,
1856,
13,
4706,
1583,
29889,
7620,
29918,
29879,
24546,
8711,
703,
3784,
29899,
29879,
24546,
8711,
29889,
2732,
1159,
13,
13,
4706,
1583,
29889,
3198,
29918,
7165,
29898,
978,
543,
4102,
29918,
1688,
613,
2362,
5570,
29922,
5574,
29897,
13,
13,
4706,
396,
1583,
29889,
9294,
29918,
726,
703,
8809,
1446,
2052,
678,
271,
10554,
272,
1159,
13,
13,
4706,
396,
1243,
11844,
29882,
1862,
1106,
3721,
278,
1021,
13,
4706,
2441,
353,
13850,
29906,
29889,
326,
949,
29898,
13,
9651,
376,
20119,
29918,
6500,
5570,
29914,
1688,
29918,
16121,
29914,
4102,
29918,
1688,
29914,
29879,
24546,
8711,
29889,
2732,
1159,
13,
4706,
7929,
353,
13850,
29906,
29889,
326,
949,
703,
3784,
29899,
29879,
24546,
8711,
29889,
2732,
1159,
13,
13,
4706,
4974,
2441,
29889,
12181,
1275,
7929,
29889,
12181,
13,
13,
4706,
4328,
353,
13850,
29906,
29889,
1491,
29873,
1461,
29898,
13492,
29892,
7929,
29897,
13,
4706,
289,
29892,
330,
29892,
364,
353,
13850,
29906,
29889,
5451,
29898,
29881,
17678,
29897,
13,
4706,
4974,
13850,
29906,
29889,
2798,
12283,
24214,
29898,
29890,
29897,
1275,
320,
13,
9651,
13850,
29906,
29889,
2798,
12283,
24214,
29898,
29887,
29897,
1275,
13850,
29906,
29889,
2798,
12283,
24214,
29898,
29878,
29897,
1275,
29871,
29900,
13,
2
] |
surround/django/context_cache.py | sniegu/django-surround | 1 | 50505 | from functools import wraps
from contextlib import contextmanager
from threading import local
thread_local = local()
from surround.django.logging import setupModuleLogger
setupModuleLogger(globals())
class LocalCacheBackend(object):
def __init__(self):
self.backend = {}
def get(self, key):
return self.backend.get(key, None)
def set(self, key, value):
self.backend[key] = value
def cached(func):
name = func.__module__ + '.' + func.__name__
def _get_key(args, kwargs):
return name + ':a:' + ','.join(map(str, args)) + ':kw:' + ','.join(['%s=%s' % (k, v) for k, v in kwargs.items()])
@wraps(func)
def wrapped(*args, **kwargs):
current = get_active()
if current is None:
return func(*args, **kwargs)
key = _get_key(args, kwargs)
cached_value = current.get(key)
if cached_value is not None:
return cached_value
result = func(*args, **kwargs)
current.set(key, result)
return result
def _force(value, args=[], kwargs={}):
key = _get_key(args, kwargs)
current = get_active()
if current is None:
raise Exception('forcing context cache value outside context')
current.set(key, value)
wrapped._force = _force
wrapped._get_key = _get_key
return wrapped
@contextmanager
def make_active(current):
old = getattr(thread_local, 'backend', None)
thread_local.backend = current
try:
yield current
finally:
if old is not None:
thread_local.backend = old
else:
del thread_local.backend
def wrap_with_current(func):
current = get_active()
@wraps(func)
def wrapped(*args, **kwargs):
with make_active(current):
return func(*args, **kwargs)
return wrapped
def wrap_with_activate(func):
@wraps(func)
def wrapped(*args, **kwargs):
with activate():
return func(*args, **kwargs)
return wrapped
def wrap_with_assure_active(func):
@wraps(func)
def wrapped(*args, **kwargs):
with assure_active():
return func(*args, **kwargs)
return wrapped
def activate():
return make_active(LocalCacheBackend())
@contextmanager
def assure_active():
current = get_active()
if current is not None:
yield
else:
with activate():
yield
def deactivate():
return make_active(None)
def get_active():
return getattr(thread_local, 'backend', None)
| [
1,
515,
2090,
312,
8789,
1053,
11463,
567,
13,
3166,
3030,
1982,
1053,
3030,
12847,
13,
3166,
3244,
292,
1053,
1887,
13,
13,
7097,
29918,
2997,
353,
1887,
580,
13,
13,
3166,
8388,
618,
29889,
14095,
29889,
21027,
1053,
6230,
7355,
16363,
13,
14669,
7355,
16363,
29898,
23705,
1338,
3101,
13,
13,
1990,
9959,
10408,
5841,
355,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
27852,
353,
6571,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
1820,
1125,
13,
4706,
736,
1583,
29889,
27852,
29889,
657,
29898,
1989,
29892,
6213,
29897,
13,
13,
1678,
822,
731,
29898,
1311,
29892,
1820,
29892,
995,
1125,
13,
4706,
1583,
29889,
27852,
29961,
1989,
29962,
353,
995,
13,
13,
13,
1753,
22152,
29898,
9891,
1125,
13,
1678,
1024,
353,
3653,
17255,
5453,
1649,
718,
525,
6169,
718,
3653,
17255,
978,
1649,
13,
13,
1678,
822,
903,
657,
29918,
1989,
29898,
5085,
29892,
9049,
5085,
1125,
13,
4706,
736,
1024,
718,
525,
29901,
29874,
11283,
718,
13420,
4286,
7122,
29898,
1958,
29898,
710,
29892,
6389,
876,
718,
525,
29901,
11022,
11283,
718,
13420,
4286,
7122,
18959,
29995,
29879,
16328,
29879,
29915,
1273,
313,
29895,
29892,
325,
29897,
363,
413,
29892,
325,
297,
9049,
5085,
29889,
7076,
580,
2314,
13,
13,
1678,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
21021,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1857,
353,
679,
29918,
4925,
580,
13,
4706,
565,
1857,
338,
6213,
29901,
13,
9651,
736,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
1820,
353,
903,
657,
29918,
1989,
29898,
5085,
29892,
9049,
5085,
29897,
13,
13,
4706,
22152,
29918,
1767,
353,
1857,
29889,
657,
29898,
1989,
29897,
13,
4706,
565,
22152,
29918,
1767,
338,
451,
6213,
29901,
13,
9651,
736,
22152,
29918,
1767,
13,
13,
4706,
1121,
353,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
4706,
1857,
29889,
842,
29898,
1989,
29892,
1121,
29897,
13,
4706,
736,
1121,
13,
13,
1678,
822,
903,
10118,
29898,
1767,
29892,
6389,
11759,
1402,
9049,
5085,
3790,
29913,
1125,
13,
4706,
1820,
353,
903,
657,
29918,
1989,
29898,
5085,
29892,
9049,
5085,
29897,
13,
4706,
1857,
353,
679,
29918,
4925,
580,
13,
4706,
565,
1857,
338,
6213,
29901,
13,
9651,
12020,
8960,
877,
1454,
3277,
3030,
7090,
995,
5377,
3030,
1495,
13,
13,
4706,
1857,
29889,
842,
29898,
1989,
29892,
995,
29897,
13,
13,
1678,
21021,
3032,
10118,
353,
903,
10118,
13,
1678,
21021,
3032,
657,
29918,
1989,
353,
903,
657,
29918,
1989,
13,
13,
1678,
736,
21021,
13,
13,
13,
29992,
4703,
12847,
13,
1753,
1207,
29918,
4925,
29898,
3784,
1125,
13,
1678,
2030,
353,
679,
5552,
29898,
7097,
29918,
2997,
29892,
525,
27852,
742,
6213,
29897,
13,
1678,
3244,
29918,
2997,
29889,
27852,
353,
1857,
13,
1678,
1018,
29901,
13,
4706,
7709,
1857,
13,
1678,
7146,
29901,
13,
4706,
565,
2030,
338,
451,
6213,
29901,
13,
9651,
3244,
29918,
2997,
29889,
27852,
353,
2030,
13,
4706,
1683,
29901,
13,
9651,
628,
3244,
29918,
2997,
29889,
27852,
13,
13,
13,
1753,
12244,
29918,
2541,
29918,
3784,
29898,
9891,
1125,
13,
13,
1678,
1857,
353,
679,
29918,
4925,
580,
13,
13,
1678,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
21021,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
411,
1207,
29918,
4925,
29898,
3784,
1125,
13,
9651,
736,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
736,
21021,
13,
13,
13,
1753,
12244,
29918,
2541,
29918,
11236,
403,
29898,
9891,
1125,
13,
13,
1678,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
21021,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
411,
5039,
403,
7295,
13,
9651,
736,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
736,
21021,
13,
13,
13,
1753,
12244,
29918,
2541,
29918,
465,
545,
29918,
4925,
29898,
9891,
1125,
13,
13,
1678,
732,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
21021,
10456,
5085,
29892,
3579,
19290,
1125,
13,
4706,
411,
1223,
545,
29918,
4925,
7295,
13,
9651,
736,
3653,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
736,
21021,
13,
13,
13,
1753,
5039,
403,
7295,
13,
1678,
736,
1207,
29918,
4925,
29898,
7717,
10408,
5841,
355,
3101,
13,
13,
29992,
4703,
12847,
13,
1753,
1223,
545,
29918,
4925,
7295,
13,
1678,
1857,
353,
679,
29918,
4925,
580,
13,
1678,
565,
1857,
338,
451,
6213,
29901,
13,
4706,
7709,
13,
1678,
1683,
29901,
13,
4706,
411,
5039,
403,
7295,
13,
9651,
7709,
13,
13,
1753,
316,
11236,
403,
7295,
13,
1678,
736,
1207,
29918,
4925,
29898,
8516,
29897,
13,
13,
1753,
679,
29918,
4925,
7295,
13,
1678,
736,
679,
5552,
29898,
7097,
29918,
2997,
29892,
525,
27852,
742,
6213,
29897,
13,
13,
2
] |
Source/Tools/BindTool/writer.py | ssinai1/rbfx | 441 | 28841 | <filename>Source/Tools/BindTool/writer.py<gh_stars>100-1000
class InterfaceWriter(object):
def __init__(self, output_path):
self._output_path_template = output_path + '/_{key}_{subsystem}.i'
self._fp = {
'pre': {},
'post': {},
}
def _write(self, key, subsystem, text):
subsystem = subsystem.lower()
fp = self._fp[key].get(subsystem)
if fp is None:
self._fp[key][subsystem] = fp = open(self._output_path_template.format(key=key, subsystem=subsystem), 'w+')
fp.write(text)
fp.write('\n')
def write_pre(self, subsystem, text):
self._write('pre', subsystem, text)
def write_post(self, subsystem, text):
self._write('post', subsystem, text)
def close(self):
for fp_map in self._fp.values():
for fp in fp_map.values():
fp.close()
| [
1,
529,
9507,
29958,
4435,
29914,
24183,
29914,
15708,
12229,
29914,
13236,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
13,
1990,
25796,
10507,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1962,
29918,
2084,
1125,
13,
4706,
1583,
3032,
4905,
29918,
2084,
29918,
6886,
353,
1962,
29918,
2084,
718,
8207,
648,
1989,
3227,
1491,
5205,
1836,
29875,
29915,
13,
4706,
1583,
3032,
18091,
353,
426,
13,
9651,
525,
1457,
2396,
24335,
13,
9651,
525,
2490,
2396,
24335,
13,
4706,
500,
13,
13,
1678,
822,
903,
3539,
29898,
1311,
29892,
1820,
29892,
1014,
5205,
29892,
1426,
1125,
13,
4706,
1014,
5205,
353,
1014,
5205,
29889,
13609,
580,
13,
4706,
285,
29886,
353,
1583,
3032,
18091,
29961,
1989,
1822,
657,
29898,
1491,
5205,
29897,
13,
4706,
565,
285,
29886,
338,
6213,
29901,
13,
9651,
1583,
3032,
18091,
29961,
1989,
3816,
1491,
5205,
29962,
353,
285,
29886,
353,
1722,
29898,
1311,
3032,
4905,
29918,
2084,
29918,
6886,
29889,
4830,
29898,
1989,
29922,
1989,
29892,
1014,
5205,
29922,
1491,
5205,
511,
525,
29893,
29974,
1495,
13,
4706,
285,
29886,
29889,
3539,
29898,
726,
29897,
13,
4706,
285,
29886,
29889,
3539,
28909,
29876,
1495,
13,
13,
1678,
822,
2436,
29918,
1457,
29898,
1311,
29892,
1014,
5205,
29892,
1426,
1125,
13,
4706,
1583,
3032,
3539,
877,
1457,
742,
1014,
5205,
29892,
1426,
29897,
13,
13,
1678,
822,
2436,
29918,
2490,
29898,
1311,
29892,
1014,
5205,
29892,
1426,
1125,
13,
4706,
1583,
3032,
3539,
877,
2490,
742,
1014,
5205,
29892,
1426,
29897,
13,
13,
1678,
822,
3802,
29898,
1311,
1125,
13,
4706,
363,
285,
29886,
29918,
1958,
297,
1583,
3032,
18091,
29889,
5975,
7295,
13,
9651,
363,
285,
29886,
297,
285,
29886,
29918,
1958,
29889,
5975,
7295,
13,
18884,
285,
29886,
29889,
5358,
580,
13,
2
] |
formats/Empty_Tokens.py | jimbro1000/cas2bas | 2 | 199557 | from formats.Utility import invert_dictionary
KEYWORD = 0
FUNCTION = 1
MAXIMUM_KEYWORD = 0x80
MAXIMUM_FUNCTION = 0x80
MAXIMUM_TOKEN_LENGTH = 7
FUNCTION_OFFSET = 0xff00
EXPECTING_LINE_NUMBER = 1
EXPECTING_INITIAL_WHITE_SPACE = 2
EXPECTING_TOKEN = 3
EXPECTING_LITERAL_OR_WHITE_SPACE = 4
EXPECTING_STRING_LITERAL = 5
EXPECTING_LITERAL_TO_EOL = 6
CLOSE_LINE = 7
MATCH_NEXT_SINGLE_CHARACTER = 5
MATCH_NUMERIC_CHARACTER = 4
MATCH_RESERVED_CHARACTER = 3
MATCH_TOKEN = 2
NO_MATCH = 1
TAB = "\t"
EOL = "\n"
CR = "\r"
SPACE = " "
STRING_DELIMITER = '"'
COLON = ":"
SEMICOLON = ";"
COMMA = ","
STRING_IDENTIFIER = "$"
OPEN_BRACKET = "("
CLOSE_BRACKET = ")"
class EmptyToken(object):
keyword_token_dictionary = {}
function_token_dictionary = {}
reserved_literals = [
SPACE,
STRING_DELIMITER,
COLON,
CR,
EOL,
SEMICOLON,
COMMA
]
def __init__(self):
self.state = KEYWORD
self.max_keyword = MAXIMUM_KEYWORD
self.max_function = MAXIMUM_FUNCTION
self.name = "Empty tokens"
self.keyword_dictionary = invert_dictionary(
self.keyword_token_dictionary)
self.function_dictionary = invert_dictionary(
self.function_token_dictionary)
def convert(self, byte):
"""Translates a byte to a string. Ascii characters are literal,
values over 127 are tokens or token sequences.
Not all token values are valid."""
if byte < 128:
return chr(byte)
if self.state == FUNCTION:
if byte <= self.max_function:
function = self.function_token_dictionary.get(byte)
self.state = KEYWORD
return function
else:
return "invalid function token"
if byte == 255:
if self.max_function > 0:
self.state = FUNCTION
return ""
else:
return "invalid extension token"
if byte <= self.max_keyword:
return self.keyword_token_dictionary.get(byte)
else:
return "invalid keyword token"
def match(self, sample):
valid = False
token = sample
if self.keyword_dictionary.get(sample) is not None:
valid = True
token = self.keyword_dictionary.get(sample)
if not valid and self.function_dictionary.get(sample) is not None:
valid = True
token = FUNCTION_OFFSET + self.function_dictionary.get(sample)
return valid, token
def is_reserved(self, sample):
result = False
reserved = None
for item in self.reserved_literals:
if item == sample:
result = True
reserved = item
return result, reserved
@staticmethod
def is_numeric(sample):
return "0" <= sample <= "9"
@staticmethod
def word_to_bytes(word):
msb = (word & 0xff00) >> 8
lsb = word & 0xff
return msb, lsb
def parse_line(self, plain):
""" parse_line "assumes" that the plain input is a correctly
constructed basic program statement """
def process_line(char, line_number):
if self.is_numeric(char):
line_number += char
return 1, line_number
return 0, line_number
def process_white_space(char):
if char == SPACE or char == TAB:
return 1
else:
return 0
def append_to_stream(value, stream):
if type(value) == str:
value = ord(value)
if value > 0xff:
msb, lsb = self.word_to_bytes(value)
stream.append(msb)
stream.append(lsb)
else:
stream.append(value)
return stream
def build_token(char, sample):
is_reserved = False
numeric = self.is_numeric(char)
any_reserved, not_used = self.is_reserved(char)
sample += char
if sample == char:
is_reserved = any_reserved
valid, test_key = self.match(sample)
single_valid, single_key = self.match(char)
if numeric:
return MATCH_NUMERIC_CHARACTER, sample, None
if is_reserved:
return MATCH_RESERVED_CHARACTER, sample, None
elif valid:
return MATCH_TOKEN, sample, test_key
elif single_valid:
return MATCH_NEXT_SINGLE_CHARACTER, sample[:-1], single_key
elif any_reserved:
return MATCH_NEXT_SINGLE_CHARACTER, sample[:-1], char
else:
return NO_MATCH, sample, None
plain_array = list(plain)
state = EXPECTING_LINE_NUMBER
line = ""
statement = []
token = ""
result = 0
loop = len(plain_array) > 0
next_char = plain_array.pop(0)
while loop:
if state == EXPECTING_LINE_NUMBER:
outcome, line = process_line(next_char, line)
if outcome == 0:
state = EXPECTING_INITIAL_WHITE_SPACE
else:
next_char = plain_array.pop(0)
elif state == EXPECTING_INITIAL_WHITE_SPACE:
outcome = process_white_space(next_char)
if outcome == 0:
state = EXPECTING_TOKEN
else:
next_char = plain_array.pop(0)
elif state == EXPECTING_TOKEN:
outcome, token, key = build_token(next_char, token)
if outcome == MATCH_NEXT_SINGLE_CHARACTER:
while len(token) > 0:
statement = append_to_stream(
token[0], statement
)
token = token[1:]
if key == EOL or key == CR:
state = CLOSE_LINE
elif key == COLON:
statement = append_to_stream(key, statement)
token = ""
next_char = plain_array.pop(0)
elif key == STRING_DELIMITER:
state = EXPECTING_STRING_LITERAL
statement = append_to_stream(key, statement)
token = ""
next_char = plain_array.pop(0)
elif key == SEMICOLON \
or key == COMMA:
statement = append_to_stream(key, statement)
token = ""
next_char = plain_array.pop(0)
else:
statement = append_to_stream(key, statement)
token = ""
next_char = plain_array.pop(0)
elif outcome == MATCH_NUMERIC_CHARACTER:
while len(token) > 0:
statement = append_to_stream(
token[0], statement
)
token = token[1:]
token = ""
next_char = plain_array.pop(0)
elif outcome == MATCH_RESERVED_CHARACTER:
if token == COLON \
or token == SEMICOLON \
or token == COMMA:
statement = append_to_stream(token, statement)
token = ""
next_char = plain_array.pop(0)
elif token == EOL or token == CR:
state = CLOSE_LINE
elif token == SPACE:
statement = append_to_stream(token, statement)
next_char = plain_array.pop(0)
token = ""
elif token == STRING_DELIMITER:
statement = append_to_stream(token, statement)
next_char = plain_array.pop(0)
token = ""
state = EXPECTING_STRING_LITERAL
elif outcome == MATCH_TOKEN:
state = EXPECTING_TOKEN
if token == "ELSE":
if statement[-1:][0] != ord(COLON):
statement = append_to_stream(COLON, statement)
elif token == "REM":
state = EXPECTING_LITERAL_TO_EOL
elif token == "'":
state = EXPECTING_LITERAL_TO_EOL
elif token == "DATA":
state = EXPECTING_LITERAL_TO_EOL
token = ""
statement = append_to_stream(key, statement)
next_char = plain_array.pop(0)
elif outcome == NO_MATCH:
if next_char == STRING_IDENTIFIER \
or next_char == OPEN_BRACKET \
or next_char == CLOSE_BRACKET:
while len(token) > 0:
statement = append_to_stream(
token[0], statement
)
token = token[1:]
token = ""
next_char = plain_array.pop(0)
elif state == EXPECTING_LITERAL_OR_WHITE_SPACE:
reserved, token = self.is_reserved(next_char)
if reserved:
if token == EOL:
state = CLOSE_LINE
elif token == CR:
next_char = plain_array.pop(0)
elif token == ":":
statement = append_to_stream(token, statement)
state = EXPECTING_TOKEN
next_char = plain_array.pop(0)
token = ""
elif token == '"':
statement = append_to_stream(token, statement)
state = EXPECTING_STRING_LITERAL
next_char = plain_array.pop(0)
else:
statement = append_to_stream(next_char, statement)
next_char = plain_array.pop(0)
elif state == EXPECTING_STRING_LITERAL:
reserved, token = self.is_reserved(next_char)
if token == EOL or token == CR:
statement = append_to_stream(0, statement)
loop = False
result = -1
elif token == STRING_DELIMITER:
statement = append_to_stream(token, statement)
state = EXPECTING_TOKEN
token = ""
next_char = plain_array.pop(0)
else:
statement = append_to_stream(next_char, statement)
next_char = plain_array.pop(0)
elif state == EXPECTING_LITERAL_TO_EOL:
if next_char == EOL:
state = CLOSE_LINE
elif next_char == CR:
next_char = plain_array.pop(0)
else:
statement = append_to_stream(next_char, statement)
next_char = plain_array.pop(0)
elif state == CLOSE_LINE:
statement = append_to_stream(0, statement)
loop = False
result = 0
return result, line, statement
def parse_program(self, program, load_address):
def extract_line(plain_text):
next_eol = plain_text.find(EOL)
if next_eol == -1:
if len(plain_text) > 0:
next_line = plain_text + EOL
else:
next_line = ""
remaining = ""
else:
next_line = plain_text[:next_eol + 1]
remaining = plain_text[next_eol + 1:]
return next_line, remaining
result = 0
loop = len(program) > 0
stream = []
load_address += 1
while loop:
sample, program = extract_line(program)
if len(sample) > 0:
result, line_number, line_bytes = self.parse_line(sample)
if result == 0:
load_address += 4 + len(line_bytes)
msb, lsb = self.word_to_bytes(load_address)
stream += [msb, lsb]
msb, lsb = self.word_to_bytes(int(line_number))
stream += [msb, lsb]
stream += line_bytes
loop = result == 0 and len(program) > 0
stream += [0, 0]
return result, bytearray(stream)
| [
1,
515,
21971,
29889,
7270,
537,
1053,
21292,
29918,
27126,
13,
13,
10818,
17013,
353,
29871,
29900,
13,
29943,
28700,
353,
29871,
29896,
13,
12648,
7833,
5005,
29918,
10818,
17013,
353,
29871,
29900,
29916,
29947,
29900,
13,
12648,
7833,
5005,
29918,
29943,
28700,
353,
29871,
29900,
29916,
29947,
29900,
13,
12648,
7833,
5005,
29918,
4986,
29968,
1430,
29918,
19433,
353,
29871,
29955,
13,
29943,
28700,
29918,
27681,
10490,
353,
29871,
29900,
29916,
600,
29900,
29900,
13,
5746,
4162,
1783,
4214,
29918,
18521,
29918,
23207,
353,
29871,
29896,
13,
5746,
4162,
1783,
4214,
29918,
26019,
25758,
29918,
25039,
9094,
29918,
5550,
11538,
353,
29871,
29906,
13,
5746,
4162,
1783,
4214,
29918,
4986,
29968,
1430,
353,
29871,
29941,
13,
5746,
4162,
1783,
4214,
29918,
29931,
1806,
1001,
1964,
29918,
1955,
29918,
25039,
9094,
29918,
5550,
11538,
353,
29871,
29946,
13,
5746,
4162,
1783,
4214,
29918,
20785,
29918,
29931,
1806,
1001,
1964,
353,
29871,
29945,
13,
5746,
4162,
1783,
4214,
29918,
29931,
1806,
1001,
1964,
29918,
4986,
29918,
29923,
5607,
353,
29871,
29953,
13,
29907,
3927,
1660,
29918,
18521,
353,
29871,
29955,
13,
29924,
14789,
29918,
29940,
12194,
29918,
29903,
4214,
1307,
29918,
11282,
17923,
1001,
353,
29871,
29945,
13,
29924,
14789,
29918,
13967,
1001,
2965,
29918,
11282,
17923,
1001,
353,
29871,
29946,
13,
29924,
14789,
29918,
1525,
6304,
29963,
3352,
29918,
11282,
17923,
1001,
353,
29871,
29941,
13,
29924,
14789,
29918,
4986,
29968,
1430,
353,
29871,
29906,
13,
6632,
29918,
29924,
14789,
353,
29871,
29896,
13,
29911,
2882,
353,
6634,
29873,
29908,
13,
29923,
5607,
353,
6634,
29876,
29908,
13,
11341,
353,
6634,
29878,
29908,
13,
5550,
11538,
353,
376,
376,
13,
20785,
29918,
2287,
5265,
26349,
1001,
353,
18793,
29915,
13,
15032,
1164,
353,
376,
6160,
13,
1660,
29924,
2965,
5607,
1164,
353,
12159,
29908,
13,
19795,
1529,
353,
28796,
13,
20785,
29918,
1367,
3919,
29902,
3738,
1001,
353,
3908,
29908,
13,
4590,
1430,
29918,
15176,
11375,
2544,
353,
376,
703,
13,
29907,
3927,
1660,
29918,
15176,
11375,
2544,
353,
376,
5513,
13,
13,
13,
1990,
2812,
2349,
6066,
29898,
3318,
1125,
13,
1678,
13553,
29918,
6979,
29918,
27126,
353,
6571,
13,
13,
1678,
740,
29918,
6979,
29918,
27126,
353,
6571,
13,
13,
1678,
21676,
29918,
20889,
1338,
353,
518,
13,
4706,
10937,
11538,
29892,
13,
4706,
29486,
4214,
29918,
2287,
5265,
26349,
1001,
29892,
13,
4706,
23958,
1164,
29892,
13,
4706,
15600,
29892,
13,
4706,
382,
5607,
29892,
13,
4706,
3725,
29924,
2965,
5607,
1164,
29892,
13,
4706,
23353,
1529,
13,
1678,
4514,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
3859,
353,
14636,
17013,
13,
4706,
1583,
29889,
3317,
29918,
26766,
353,
18134,
7833,
5005,
29918,
10818,
17013,
13,
4706,
1583,
29889,
3317,
29918,
2220,
353,
18134,
7833,
5005,
29918,
29943,
28700,
13,
4706,
1583,
29889,
978,
353,
376,
8915,
18897,
29908,
13,
4706,
1583,
29889,
26766,
29918,
27126,
353,
21292,
29918,
27126,
29898,
13,
9651,
1583,
29889,
26766,
29918,
6979,
29918,
27126,
29897,
13,
4706,
1583,
29889,
2220,
29918,
27126,
353,
21292,
29918,
27126,
29898,
13,
9651,
1583,
29889,
2220,
29918,
6979,
29918,
27126,
29897,
13,
13,
1678,
822,
3588,
29898,
1311,
29892,
7023,
1125,
13,
4706,
9995,
4300,
29880,
1078,
263,
7023,
304,
263,
1347,
29889,
1094,
18869,
4890,
526,
16333,
29892,
13,
4706,
1819,
975,
29871,
29896,
29906,
29955,
526,
18897,
470,
5993,
15602,
29889,
13,
4706,
2216,
599,
5993,
1819,
526,
2854,
1213,
15945,
13,
4706,
565,
7023,
529,
29871,
29896,
29906,
29947,
29901,
13,
9651,
736,
18460,
29898,
10389,
29897,
13,
4706,
565,
1583,
29889,
3859,
1275,
383,
28700,
29901,
13,
9651,
565,
7023,
5277,
1583,
29889,
3317,
29918,
2220,
29901,
13,
18884,
740,
353,
1583,
29889,
2220,
29918,
6979,
29918,
27126,
29889,
657,
29898,
10389,
29897,
13,
18884,
1583,
29889,
3859,
353,
14636,
17013,
13,
18884,
736,
740,
13,
9651,
1683,
29901,
13,
18884,
736,
376,
20965,
740,
5993,
29908,
13,
4706,
565,
7023,
1275,
29871,
29906,
29945,
29945,
29901,
13,
9651,
565,
1583,
29889,
3317,
29918,
2220,
1405,
29871,
29900,
29901,
13,
18884,
1583,
29889,
3859,
353,
383,
28700,
13,
18884,
736,
5124,
13,
9651,
1683,
29901,
13,
18884,
736,
376,
20965,
6081,
5993,
29908,
13,
4706,
565,
7023,
5277,
1583,
29889,
3317,
29918,
26766,
29901,
13,
9651,
736,
1583,
29889,
26766,
29918,
6979,
29918,
27126,
29889,
657,
29898,
10389,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
376,
20965,
13553,
5993,
29908,
13,
13,
1678,
822,
1993,
29898,
1311,
29892,
4559,
1125,
13,
4706,
2854,
353,
7700,
13,
4706,
5993,
353,
4559,
13,
4706,
565,
1583,
29889,
26766,
29918,
27126,
29889,
657,
29898,
11249,
29897,
338,
451,
6213,
29901,
13,
9651,
2854,
353,
5852,
13,
9651,
5993,
353,
1583,
29889,
26766,
29918,
27126,
29889,
657,
29898,
11249,
29897,
13,
4706,
565,
451,
2854,
322,
1583,
29889,
2220,
29918,
27126,
29889,
657,
29898,
11249,
29897,
338,
451,
6213,
29901,
13,
9651,
2854,
353,
5852,
13,
9651,
5993,
353,
383,
28700,
29918,
27681,
10490,
718,
1583,
29889,
2220,
29918,
27126,
29889,
657,
29898,
11249,
29897,
13,
4706,
736,
2854,
29892,
5993,
13,
13,
1678,
822,
338,
29918,
690,
9841,
29898,
1311,
29892,
4559,
1125,
13,
4706,
1121,
353,
7700,
13,
4706,
21676,
353,
6213,
13,
4706,
363,
2944,
297,
1583,
29889,
690,
9841,
29918,
20889,
1338,
29901,
13,
9651,
565,
2944,
1275,
4559,
29901,
13,
18884,
1121,
353,
5852,
13,
18884,
21676,
353,
2944,
13,
4706,
736,
1121,
29892,
21676,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
338,
29918,
21574,
29898,
11249,
1125,
13,
4706,
736,
376,
29900,
29908,
5277,
4559,
5277,
376,
29929,
29908,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1734,
29918,
517,
29918,
13193,
29898,
1742,
1125,
13,
4706,
10887,
29890,
353,
313,
1742,
669,
29871,
29900,
29916,
600,
29900,
29900,
29897,
5099,
29871,
29947,
13,
4706,
19375,
29890,
353,
1734,
669,
29871,
29900,
29916,
600,
13,
4706,
736,
10887,
29890,
29892,
19375,
29890,
13,
13,
1678,
822,
6088,
29918,
1220,
29898,
1311,
29892,
8656,
1125,
13,
4706,
9995,
6088,
29918,
1220,
376,
465,
9351,
29908,
393,
278,
8656,
1881,
338,
263,
5149,
13,
4706,
13319,
6996,
1824,
3229,
9995,
13,
13,
4706,
822,
1889,
29918,
1220,
29898,
3090,
29892,
1196,
29918,
4537,
1125,
13,
9651,
565,
1583,
29889,
275,
29918,
21574,
29898,
3090,
1125,
13,
18884,
1196,
29918,
4537,
4619,
1373,
13,
18884,
736,
29871,
29896,
29892,
1196,
29918,
4537,
13,
9651,
736,
29871,
29900,
29892,
1196,
29918,
4537,
13,
13,
4706,
822,
1889,
29918,
10921,
29918,
3493,
29898,
3090,
1125,
13,
9651,
565,
1373,
1275,
10937,
11538,
470,
1373,
1275,
323,
2882,
29901,
13,
18884,
736,
29871,
29896,
13,
9651,
1683,
29901,
13,
18884,
736,
29871,
29900,
13,
13,
4706,
822,
9773,
29918,
517,
29918,
5461,
29898,
1767,
29892,
4840,
1125,
13,
9651,
565,
1134,
29898,
1767,
29897,
1275,
851,
29901,
13,
18884,
995,
353,
4356,
29898,
1767,
29897,
13,
9651,
565,
995,
1405,
29871,
29900,
29916,
600,
29901,
13,
18884,
10887,
29890,
29892,
19375,
29890,
353,
1583,
29889,
1742,
29918,
517,
29918,
13193,
29898,
1767,
29897,
13,
18884,
4840,
29889,
4397,
29898,
1516,
29890,
29897,
13,
18884,
4840,
29889,
4397,
29898,
3137,
29890,
29897,
13,
9651,
1683,
29901,
13,
18884,
4840,
29889,
4397,
29898,
1767,
29897,
13,
9651,
736,
4840,
13,
13,
4706,
822,
2048,
29918,
6979,
29898,
3090,
29892,
4559,
1125,
13,
9651,
338,
29918,
690,
9841,
353,
7700,
13,
9651,
16985,
353,
1583,
29889,
275,
29918,
21574,
29898,
3090,
29897,
13,
9651,
738,
29918,
690,
9841,
29892,
451,
29918,
3880,
353,
1583,
29889,
275,
29918,
690,
9841,
29898,
3090,
29897,
13,
9651,
4559,
4619,
1373,
13,
9651,
565,
4559,
1275,
1373,
29901,
13,
18884,
338,
29918,
690,
9841,
353,
738,
29918,
690,
9841,
13,
9651,
2854,
29892,
1243,
29918,
1989,
353,
1583,
29889,
4352,
29898,
11249,
29897,
13,
9651,
2323,
29918,
3084,
29892,
2323,
29918,
1989,
353,
1583,
29889,
4352,
29898,
3090,
29897,
13,
9651,
565,
16985,
29901,
13,
18884,
736,
341,
14789,
29918,
13967,
1001,
2965,
29918,
11282,
17923,
1001,
29892,
4559,
29892,
6213,
13,
9651,
565,
338,
29918,
690,
9841,
29901,
13,
18884,
736,
341,
14789,
29918,
1525,
6304,
29963,
3352,
29918,
11282,
17923,
1001,
29892,
4559,
29892,
6213,
13,
9651,
25342,
2854,
29901,
13,
18884,
736,
341,
14789,
29918,
4986,
29968,
1430,
29892,
4559,
29892,
1243,
29918,
1989,
13,
9651,
25342,
2323,
29918,
3084,
29901,
13,
18884,
736,
341,
14789,
29918,
29940,
12194,
29918,
29903,
4214,
1307,
29918,
11282,
17923,
1001,
29892,
4559,
7503,
29899,
29896,
1402,
2323,
29918,
1989,
13,
9651,
25342,
738,
29918,
690,
9841,
29901,
13,
18884,
736,
341,
14789,
29918,
29940,
12194,
29918,
29903,
4214,
1307,
29918,
11282,
17923,
1001,
29892,
4559,
7503,
29899,
29896,
1402,
1373,
13,
9651,
1683,
29901,
13,
18884,
736,
11698,
29918,
29924,
14789,
29892,
4559,
29892,
6213,
13,
13,
4706,
8656,
29918,
2378,
353,
1051,
29898,
24595,
29897,
13,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
18521,
29918,
23207,
13,
4706,
1196,
353,
5124,
13,
4706,
3229,
353,
5159,
13,
4706,
5993,
353,
5124,
13,
13,
4706,
1121,
353,
29871,
29900,
13,
4706,
2425,
353,
7431,
29898,
24595,
29918,
2378,
29897,
1405,
29871,
29900,
13,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
4706,
1550,
2425,
29901,
13,
9651,
565,
2106,
1275,
8528,
4162,
1783,
4214,
29918,
18521,
29918,
23207,
29901,
13,
18884,
21957,
29892,
1196,
353,
1889,
29918,
1220,
29898,
4622,
29918,
3090,
29892,
1196,
29897,
13,
18884,
565,
21957,
1275,
29871,
29900,
29901,
13,
462,
1678,
2106,
353,
8528,
4162,
1783,
4214,
29918,
26019,
25758,
29918,
25039,
9094,
29918,
5550,
11538,
13,
18884,
1683,
29901,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
9651,
25342,
2106,
1275,
8528,
4162,
1783,
4214,
29918,
26019,
25758,
29918,
25039,
9094,
29918,
5550,
11538,
29901,
13,
18884,
21957,
353,
1889,
29918,
10921,
29918,
3493,
29898,
4622,
29918,
3090,
29897,
13,
18884,
565,
21957,
1275,
29871,
29900,
29901,
13,
462,
1678,
2106,
353,
8528,
4162,
1783,
4214,
29918,
4986,
29968,
1430,
13,
18884,
1683,
29901,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
9651,
25342,
2106,
1275,
8528,
4162,
1783,
4214,
29918,
4986,
29968,
1430,
29901,
13,
18884,
21957,
29892,
5993,
29892,
1820,
353,
2048,
29918,
6979,
29898,
4622,
29918,
3090,
29892,
5993,
29897,
13,
18884,
565,
21957,
1275,
341,
14789,
29918,
29940,
12194,
29918,
29903,
4214,
1307,
29918,
11282,
17923,
1001,
29901,
13,
462,
1678,
1550,
7431,
29898,
6979,
29897,
1405,
29871,
29900,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
13,
462,
9651,
5993,
29961,
29900,
1402,
3229,
13,
462,
4706,
1723,
13,
462,
4706,
5993,
353,
5993,
29961,
29896,
17531,
13,
462,
1678,
565,
1820,
1275,
382,
5607,
470,
1820,
1275,
15600,
29901,
13,
462,
4706,
2106,
353,
315,
3927,
1660,
29918,
18521,
13,
462,
1678,
25342,
1820,
1275,
23958,
1164,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
1989,
29892,
3229,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
1678,
25342,
1820,
1275,
29486,
4214,
29918,
2287,
5265,
26349,
1001,
29901,
13,
462,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
20785,
29918,
29931,
1806,
1001,
1964,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
1989,
29892,
3229,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
1678,
25342,
1820,
1275,
3725,
29924,
2965,
5607,
1164,
320,
13,
462,
9651,
470,
1820,
1275,
23353,
1529,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
1989,
29892,
3229,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
1989,
29892,
3229,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
18884,
25342,
21957,
1275,
341,
14789,
29918,
13967,
1001,
2965,
29918,
11282,
17923,
1001,
29901,
13,
462,
1678,
1550,
7431,
29898,
6979,
29897,
1405,
29871,
29900,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
13,
462,
9651,
5993,
29961,
29900,
1402,
3229,
13,
462,
4706,
1723,
13,
462,
4706,
5993,
353,
5993,
29961,
29896,
17531,
13,
462,
1678,
5993,
353,
5124,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
18884,
25342,
21957,
1275,
341,
14789,
29918,
1525,
6304,
29963,
3352,
29918,
11282,
17923,
1001,
29901,
13,
462,
1678,
565,
5993,
1275,
23958,
1164,
320,
13,
462,
9651,
470,
5993,
1275,
3725,
29924,
2965,
5607,
1164,
320,
13,
462,
9651,
470,
5993,
1275,
23353,
1529,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
6979,
29892,
3229,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
1678,
25342,
5993,
1275,
382,
5607,
470,
5993,
1275,
15600,
29901,
13,
462,
4706,
2106,
353,
315,
3927,
1660,
29918,
18521,
13,
462,
1678,
25342,
5993,
1275,
10937,
11538,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
6979,
29892,
3229,
29897,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
1678,
25342,
5993,
1275,
29486,
4214,
29918,
2287,
5265,
26349,
1001,
29901,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
6979,
29892,
3229,
29897,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
20785,
29918,
29931,
1806,
1001,
1964,
13,
18884,
25342,
21957,
1275,
341,
14789,
29918,
4986,
29968,
1430,
29901,
13,
462,
1678,
2106,
353,
8528,
4162,
1783,
4214,
29918,
4986,
29968,
1430,
13,
462,
1678,
565,
5993,
1275,
376,
6670,
1660,
1115,
13,
462,
4706,
565,
3229,
14352,
29896,
29901,
3816,
29900,
29962,
2804,
4356,
29898,
15032,
1164,
1125,
13,
462,
9651,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
15032,
1164,
29892,
3229,
29897,
13,
462,
1678,
25342,
5993,
1275,
376,
1525,
29924,
1115,
13,
462,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
29931,
1806,
1001,
1964,
29918,
4986,
29918,
29923,
5607,
13,
462,
1678,
25342,
5993,
1275,
13577,
1115,
13,
462,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
29931,
1806,
1001,
1964,
29918,
4986,
29918,
29923,
5607,
13,
462,
1678,
25342,
5993,
1275,
376,
14573,
1115,
13,
462,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
29931,
1806,
1001,
1964,
29918,
4986,
29918,
29923,
5607,
13,
462,
1678,
5993,
353,
5124,
13,
462,
1678,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
1989,
29892,
3229,
29897,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
18884,
25342,
21957,
1275,
11698,
29918,
29924,
14789,
29901,
13,
462,
1678,
565,
2446,
29918,
3090,
1275,
29486,
4214,
29918,
1367,
3919,
29902,
3738,
1001,
320,
13,
462,
9651,
470,
2446,
29918,
3090,
1275,
6418,
1430,
29918,
15176,
11375,
2544,
320,
13,
462,
9651,
470,
2446,
29918,
3090,
1275,
315,
3927,
1660,
29918,
15176,
11375,
2544,
29901,
13,
462,
4706,
1550,
7431,
29898,
6979,
29897,
1405,
29871,
29900,
29901,
13,
462,
9651,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
13,
462,
18884,
5993,
29961,
29900,
1402,
3229,
13,
462,
9651,
1723,
13,
462,
9651,
5993,
353,
5993,
29961,
29896,
17531,
13,
462,
4706,
5993,
353,
5124,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
9651,
25342,
2106,
1275,
8528,
4162,
1783,
4214,
29918,
29931,
1806,
1001,
1964,
29918,
1955,
29918,
25039,
9094,
29918,
5550,
11538,
29901,
13,
18884,
21676,
29892,
5993,
353,
1583,
29889,
275,
29918,
690,
9841,
29898,
4622,
29918,
3090,
29897,
13,
18884,
565,
21676,
29901,
13,
462,
1678,
565,
5993,
1275,
382,
5607,
29901,
13,
462,
4706,
2106,
353,
315,
3927,
1660,
29918,
18521,
13,
462,
1678,
25342,
5993,
1275,
15600,
29901,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
1678,
25342,
5993,
1275,
29242,
1115,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
6979,
29892,
3229,
29897,
13,
462,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
4986,
29968,
1430,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
462,
4706,
5993,
353,
5124,
13,
462,
1678,
25342,
5993,
1275,
18793,
2396,
13,
462,
4706,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
6979,
29892,
3229,
29897,
13,
462,
4706,
2106,
353,
8528,
4162,
1783,
4214,
29918,
20785,
29918,
29931,
1806,
1001,
1964,
13,
462,
4706,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
4622,
29918,
3090,
29892,
3229,
29897,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
9651,
25342,
2106,
1275,
8528,
4162,
1783,
4214,
29918,
20785,
29918,
29931,
1806,
1001,
1964,
29901,
13,
18884,
21676,
29892,
5993,
353,
1583,
29889,
275,
29918,
690,
9841,
29898,
4622,
29918,
3090,
29897,
13,
18884,
565,
5993,
1275,
382,
5607,
470,
5993,
1275,
15600,
29901,
13,
462,
1678,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
29900,
29892,
3229,
29897,
13,
462,
1678,
2425,
353,
7700,
13,
462,
1678,
1121,
353,
448,
29896,
13,
18884,
25342,
5993,
1275,
29486,
4214,
29918,
2287,
5265,
26349,
1001,
29901,
13,
462,
1678,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
6979,
29892,
3229,
29897,
13,
462,
1678,
2106,
353,
8528,
4162,
1783,
4214,
29918,
4986,
29968,
1430,
13,
462,
1678,
5993,
353,
5124,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
4622,
29918,
3090,
29892,
3229,
29897,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
9651,
25342,
2106,
1275,
8528,
4162,
1783,
4214,
29918,
29931,
1806,
1001,
1964,
29918,
4986,
29918,
29923,
5607,
29901,
13,
18884,
565,
2446,
29918,
3090,
1275,
382,
5607,
29901,
13,
462,
1678,
2106,
353,
315,
3927,
1660,
29918,
18521,
13,
18884,
25342,
2446,
29918,
3090,
1275,
15600,
29901,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
4622,
29918,
3090,
29892,
3229,
29897,
13,
462,
1678,
2446,
29918,
3090,
353,
8656,
29918,
2378,
29889,
7323,
29898,
29900,
29897,
13,
9651,
25342,
2106,
1275,
315,
3927,
1660,
29918,
18521,
29901,
13,
18884,
3229,
353,
9773,
29918,
517,
29918,
5461,
29898,
29900,
29892,
3229,
29897,
13,
18884,
2425,
353,
7700,
13,
18884,
1121,
353,
29871,
29900,
13,
4706,
736,
1121,
29892,
1196,
29892,
3229,
13,
13,
1678,
822,
6088,
29918,
8860,
29898,
1311,
29892,
1824,
29892,
2254,
29918,
7328,
1125,
13,
13,
4706,
822,
6597,
29918,
1220,
29898,
24595,
29918,
726,
1125,
13,
9651,
2446,
29918,
29872,
324,
353,
8656,
29918,
726,
29889,
2886,
29898,
29923,
5607,
29897,
13,
9651,
565,
2446,
29918,
29872,
324,
1275,
448,
29896,
29901,
13,
18884,
565,
7431,
29898,
24595,
29918,
726,
29897,
1405,
29871,
29900,
29901,
13,
462,
1678,
2446,
29918,
1220,
353,
8656,
29918,
726,
718,
382,
5607,
13,
18884,
1683,
29901,
13,
462,
1678,
2446,
29918,
1220,
353,
5124,
13,
18884,
9886,
353,
5124,
13,
9651,
1683,
29901,
13,
18884,
2446,
29918,
1220,
353,
8656,
29918,
726,
7503,
4622,
29918,
29872,
324,
718,
29871,
29896,
29962,
13,
18884,
9886,
353,
8656,
29918,
726,
29961,
4622,
29918,
29872,
324,
718,
29871,
29896,
17531,
13,
9651,
736,
2446,
29918,
1220,
29892,
9886,
13,
13,
4706,
1121,
353,
29871,
29900,
13,
4706,
2425,
353,
7431,
29898,
8860,
29897,
1405,
29871,
29900,
13,
4706,
4840,
353,
5159,
13,
4706,
2254,
29918,
7328,
4619,
29871,
29896,
13,
4706,
1550,
2425,
29901,
13,
9651,
4559,
29892,
1824,
353,
6597,
29918,
1220,
29898,
8860,
29897,
13,
9651,
565,
7431,
29898,
11249,
29897,
1405,
29871,
29900,
29901,
13,
18884,
1121,
29892,
1196,
29918,
4537,
29892,
1196,
29918,
13193,
353,
1583,
29889,
5510,
29918,
1220,
29898,
11249,
29897,
13,
18884,
565,
1121,
1275,
29871,
29900,
29901,
13,
462,
1678,
2254,
29918,
7328,
4619,
29871,
29946,
718,
7431,
29898,
1220,
29918,
13193,
29897,
13,
462,
1678,
10887,
29890,
29892,
19375,
29890,
353,
1583,
29889,
1742,
29918,
517,
29918,
13193,
29898,
1359,
29918,
7328,
29897,
13,
462,
1678,
4840,
4619,
518,
1516,
29890,
29892,
19375,
29890,
29962,
13,
462,
1678,
10887,
29890,
29892,
19375,
29890,
353,
1583,
29889,
1742,
29918,
517,
29918,
13193,
29898,
524,
29898,
1220,
29918,
4537,
876,
13,
462,
1678,
4840,
4619,
518,
1516,
29890,
29892,
19375,
29890,
29962,
13,
462,
1678,
4840,
4619,
1196,
29918,
13193,
13,
9651,
2425,
353,
1121,
1275,
29871,
29900,
322,
7431,
29898,
8860,
29897,
1405,
29871,
29900,
13,
4706,
4840,
4619,
518,
29900,
29892,
29871,
29900,
29962,
13,
4706,
736,
1121,
29892,
7023,
2378,
29898,
5461,
29897,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.