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
|
---|---|---|---|---|---|
pt/003/python/main.py | franciscogomes2020/exercises | 0 | 1610057 | # Crie um programa que leia dois números e mostre a soma entre eles.
| [
1,
396,
315,
2546,
1922,
16914,
712,
454,
423,
19760,
12158,
359,
321,
1556,
276,
263,
1047,
29874,
2637,
560,
267,
29889,
13,
13,
2
] |
export_onnx_group_norm.py | lachinov/brats2019 | 42 | 42224 | <reponame>lachinov/brats2019
import argparse
import torch.onnx
import os
from collections import OrderedDict
from torch.onnx.symbolic_registry import register_op
from torch.onnx.symbolic_helper import parse_args
from model import UNet
parser = argparse.ArgumentParser(description="PyTorch SegTHOR")
parser.add_argument("--name", default="test", type=str, help="experiment name")
parser.add_argument("--models_path", default="./models", type=str, help="path to models folder")
parser.add_argument("--input_size", default=(128, 128, 128), help="Input image size", nargs="+", type=int)
@parse_args('v', 'i', 'v', 'v', 'f', 'i')
def group_norm_symbolic(g, input, num_groups, weight, bias, eps, cudnn_enabled):
return g.op("ExperimentalDetectronGroupNorm", input, weight, bias, num_groups_i=num_groups, eps_f=eps)
def main():
opt = parser.parse_args()
print(torch.__version__)
print(opt)
enc_layers = [1,2,2,4]
dec_layers = [1,1,1,1]
number_of_channels=[int(8*2**i) for i in range(1,1+len(enc_layers))]#[16,32,64,128]
model = UNet(depth=len(enc_layers), encoder_layers=enc_layers, decoder_layers=dec_layers, number_of_channels=number_of_channels, number_of_outputs=3)
s = torch.load(os.path.join(opt.models_path, opt.name, opt.name+'best_model.pth'), map_location='cpu')
new_state_dict = OrderedDict()
for k, v in s['model'].state_dict().items():
name = k[7:] # remove 'module' word in the beginning of keys.
new_state_dict[name] = v
model.load_state_dict(new_state_dict)
model.eval()
x = torch.randn(1, 4, opt.input_size[0], opt.input_size[1], opt.input_size[2], requires_grad=True)
register_op("group_norm", group_norm_symbolic, "", 10)
torch_out = torch.onnx.export(model, # model being run
[x,], # model input (or a tuple for multiple inputs)
os.path.join(opt.models_path, opt.name, opt.name+".onnx"), # where to save the model (can be a file or file-like object)
export_params=True,
verbose=True, # store the trained parameter weights inside the model file
opset_version=10
)
if __name__ == "__main__":
main()
| [
1,
529,
276,
1112,
420,
29958,
22617,
262,
586,
29914,
1182,
1446,
29906,
29900,
29896,
29929,
13,
5215,
1852,
5510,
30004,
13,
5215,
4842,
305,
29889,
3409,
29916,
30004,
13,
5215,
2897,
30004,
13,
3166,
16250,
1053,
8170,
287,
21533,
30004,
13,
3166,
4842,
305,
29889,
3409,
29916,
29889,
18098,
293,
29918,
1727,
6020,
1053,
6036,
29918,
459,
30004,
13,
3166,
4842,
305,
29889,
3409,
29916,
29889,
18098,
293,
29918,
20907,
1053,
6088,
29918,
5085,
30004,
13,
3166,
1904,
1053,
501,
6779,
30004,
13,
30004,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
543,
19737,
29911,
25350,
6667,
4690,
1955,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
978,
613,
2322,
543,
1688,
613,
1134,
29922,
710,
29892,
1371,
543,
735,
15362,
1024,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
9794,
29918,
2084,
613,
2322,
543,
6904,
9794,
613,
1134,
29922,
710,
29892,
1371,
543,
2084,
304,
4733,
4138,
1159,
30004,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
2080,
29918,
2311,
613,
2322,
7607,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
511,
1371,
543,
4290,
1967,
2159,
613,
302,
5085,
543,
29974,
613,
1134,
29922,
524,
8443,
13,
30004,
13,
29992,
5510,
29918,
5085,
877,
29894,
742,
525,
29875,
742,
525,
29894,
742,
525,
29894,
742,
525,
29888,
742,
525,
29875,
1495,
30004,
13,
1753,
2318,
29918,
12324,
29918,
18098,
293,
29898,
29887,
29892,
1881,
29892,
954,
29918,
13155,
29892,
7688,
29892,
24003,
29892,
321,
567,
29892,
274,
566,
15755,
29918,
17590,
1125,
30004,
13,
1678,
736,
330,
29889,
459,
703,
1252,
27910,
6362,
522,
1617,
4782,
29940,
555,
613,
1881,
29892,
7688,
29892,
24003,
29892,
954,
29918,
13155,
29918,
29875,
29922,
1949,
29918,
13155,
29892,
321,
567,
29918,
29888,
29922,
8961,
8443,
13,
30004,
13,
1753,
1667,
7295,
30004,
13,
1678,
3523,
353,
13812,
29889,
5510,
29918,
5085,
26471,
13,
1678,
1596,
29898,
7345,
305,
17255,
3259,
1649,
8443,
13,
1678,
1596,
29898,
3670,
8443,
13,
30004,
13,
1678,
2094,
29918,
29277,
353,
518,
29896,
29892,
29906,
29892,
29906,
29892,
29946,
29962,
30004,
13,
1678,
1602,
29918,
29277,
353,
518,
29896,
29892,
29896,
29892,
29896,
29892,
29896,
29962,
30004,
13,
1678,
1353,
29918,
974,
29918,
305,
12629,
11759,
524,
29898,
29947,
29930,
29906,
1068,
29875,
29897,
363,
474,
297,
3464,
29898,
29896,
29892,
29896,
29974,
2435,
29898,
3977,
29918,
29277,
28166,
29937,
29961,
29896,
29953,
29892,
29941,
29906,
29892,
29953,
29946,
29892,
29896,
29906,
29947,
29962,
30004,
13,
1678,
1904,
353,
501,
6779,
29898,
19488,
29922,
2435,
29898,
3977,
29918,
29277,
511,
2094,
6119,
29918,
29277,
29922,
3977,
29918,
29277,
29892,
1602,
6119,
29918,
29277,
29922,
7099,
29918,
29277,
29892,
1353,
29918,
974,
29918,
305,
12629,
29922,
4537,
29918,
974,
29918,
305,
12629,
29892,
1353,
29918,
974,
29918,
4905,
29879,
29922,
29941,
8443,
13,
1678,
269,
353,
4842,
305,
29889,
1359,
29898,
359,
29889,
2084,
29889,
7122,
29898,
3670,
29889,
9794,
29918,
2084,
29892,
3523,
29889,
978,
29892,
3523,
29889,
978,
23097,
13318,
29918,
4299,
29889,
29886,
386,
5477,
2910,
29918,
5479,
2433,
21970,
1495,
30004,
13,
1678,
716,
29918,
3859,
29918,
8977,
353,
8170,
287,
21533,
26471,
13,
1678,
363,
413,
29892,
325,
297,
269,
1839,
4299,
13359,
3859,
29918,
8977,
2141,
7076,
7295,
30004,
13,
4706,
1024,
353,
413,
29961,
29955,
17531,
396,
3349,
525,
5453,
29915,
1734,
297,
278,
6763,
310,
6611,
22993,
13,
4706,
716,
29918,
3859,
29918,
8977,
29961,
978,
29962,
353,
325,
30004,
13,
1678,
1904,
29889,
1359,
29918,
3859,
29918,
8977,
29898,
1482,
29918,
3859,
29918,
8977,
8443,
13,
1678,
1904,
29889,
14513,
26471,
13,
1678,
6756,
13,
1678,
921,
353,
4842,
305,
29889,
9502,
29876,
29898,
29896,
29892,
29871,
29946,
29892,
3523,
29889,
2080,
29918,
2311,
29961,
29900,
1402,
3523,
29889,
2080,
29918,
2311,
29961,
29896,
1402,
3523,
29889,
2080,
29918,
2311,
29961,
29906,
1402,
6858,
29918,
5105,
29922,
5574,
8443,
13,
30004,
13,
1678,
6036,
29918,
459,
703,
2972,
29918,
12324,
613,
2318,
29918,
12324,
29918,
18098,
293,
29892,
12633,
29871,
29896,
29900,
8443,
13,
30004,
13,
1678,
4842,
305,
29918,
449,
353,
4842,
305,
29889,
3409,
29916,
29889,
15843,
29898,
4299,
29892,
29871,
396,
1904,
1641,
1065,
30004,
13,
462,
462,
29871,
518,
29916,
29892,
1402,
29871,
396,
1904,
1881,
313,
272,
263,
18761,
363,
2999,
10970,
8443,
13,
462,
462,
29871,
2897,
29889,
2084,
29889,
7122,
29898,
3670,
29889,
9794,
29918,
2084,
29892,
3523,
29889,
978,
29892,
3523,
29889,
978,
29974,
1642,
3409,
29916,
4968,
29871,
396,
988,
304,
4078,
278,
1904,
313,
3068,
367,
263,
934,
470,
934,
29899,
4561,
1203,
8443,
13,
462,
462,
29871,
5609,
29918,
7529,
29922,
5574,
11167,
13,
462,
462,
29871,
26952,
29922,
5574,
29892,
29871,
396,
3787,
278,
16370,
3443,
18177,
2768,
278,
1904,
934,
30004,
13,
462,
462,
29871,
288,
567,
300,
29918,
3259,
29922,
29896,
29900,
30004,
13,
462,
462,
29871,
1723,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
1678,
1667,
26471,
13,
30004,
13,
30004,
13,
2
] |
src/test/resources/scripts/infinity.py | zella/pyass | 1 | 1616437 | <filename>src/test/resources/scripts/infinity.py
import time
while True:
sleep(1)
print('hello', flush = True)
| [
1,
529,
9507,
29958,
4351,
29914,
1688,
29914,
13237,
29914,
16713,
29914,
262,
4951,
537,
29889,
2272,
13,
5215,
931,
13,
13,
8000,
5852,
29901,
13,
1678,
8709,
29898,
29896,
29897,
13,
1678,
1596,
877,
12199,
742,
28371,
353,
5852,
29897,
13,
2
] |
pyfr/util.py | DengSonic/PyFR | 1 | 153258 | <filename>pyfr/util.py
# -*- coding: utf-8 -*-
from contextlib import contextmanager
from ctypes import c_void_p
import functools as ft
import hashlib
import itertools as it
import os
import pickle
import shutil
from pyfr.ctypesutil import get_libc_function
class memoize(object):
def __init__(self, func):
self.func = func
def __get__(self, instance, owner):
return self.func if instance is None else ft.partial(self, instance)
def __call__(self, *args, **kwargs):
instance = args[0]
try:
cache = instance._memoize_cache
except AttributeError:
cache = instance._memoize_cache = {}
key = (self.func, pickle.dumps(args[1:]), pickle.dumps(kwargs))
try:
res = cache[key]
except KeyError:
res = cache[key] = self.func(*args, **kwargs)
return res
class proxylist(list):
def __getattr__(self, attr):
return proxylist(getattr(x, attr) for x in self)
def __setattr__(self, attr, val):
for x in self:
setattr(x, attr, val)
def __delattr__(self, attr):
for x in self:
delattr(x, attr)
def __call__(self, *args, **kwargs):
return proxylist(x(*args, **kwargs) for x in self)
class silence(object):
def __init__(self, stdout=os.devnull, stderr=os.devnull):
self.outfiles = stdout, stderr
self.combine = (stdout == stderr)
# Acquire a handle to fflush from libc
self.libc_fflush = get_libc_function('fflush')
self.libc_fflush.argtypes = [c_void_p]
def __enter__(self):
import sys
self.sys = sys
# Flush
sys.__stdout__.flush()
sys.__stderr__.flush()
# Save
self.saved_streams = [sys.__stdout__, sys.__stderr__]
self.fds = [s.fileno() for s in self.saved_streams]
self.saved_fds = [os.dup(f) for f in self.fds]
# Open the redirects
if self.combine:
self.new_streams = [open(self.outfiles[0], 'wb', 0)]*2
else:
self.new_streams = [open(f, 'wb', 0) for f in self.outfiles]
self.new_fds = [s.fileno() for s in self.new_streams]
# Replace
os.dup2(self.new_fds[0], self.fds[0])
os.dup2(self.new_fds[1], self.fds[1])
def __exit__(self, *args):
sys = self.sys
# Flush
self.libc_fflush(None)
# Restore
os.dup2(self.saved_fds[0], self.fds[0])
os.dup2(self.saved_fds[1], self.fds[1])
sys.stdout, sys.stderr = self.saved_streams
# Clean up
self.new_streams[0].close()
self.new_streams[1].close()
os.close(self.saved_fds[0])
os.close(self.saved_fds[1])
@contextmanager
def setenv(**kwargs):
_env = os.environ.copy()
os.environ.update(kwargs)
try:
yield
finally:
os.environ.clear()
os.environ.update(_env)
@contextmanager
def chdir(dirname):
cdir = os.getcwd()
try:
if dirname:
os.chdir(dirname)
yield
finally:
os.chdir(cdir)
class lazyprop(object):
def __init__(self, fn):
self.fn = fn
def __get__(self, instance, owner):
if instance is None:
return None
value = self.fn(instance)
setattr(instance, self.fn.__name__, value)
return value
def subclasses(cls, just_leaf=False):
sc = cls.__subclasses__()
ssc = [g for s in sc for g in subclasses(s, just_leaf)]
return [s for s in sc if not just_leaf or not s.__subclasses__()] + ssc
def subclass_where(cls, **kwargs):
for s in subclasses(cls):
for k, v in kwargs.items():
if not hasattr(s, k) or getattr(s, k) != v:
break
else:
return s
attrs = ', '.join('{0} = {1}'.format(k, v) for k, v in kwargs.items())
raise KeyError('No subclasses of {0} with attrs == ({1})'
.format(cls.__name__, attrs))
def ndrange(*args):
return it.product(*map(range, args))
def digest(*args, hash='sha256'):
return getattr(hashlib, hash)(pickle.dumps(args)).hexdigest()
def rm(path):
if os.path.isfile(path) or os.path.islink(path):
os.remove(path)
else:
shutil.rmtree(path)
def mv(src, dst):
shutil.move(src, dst)
def match_paired_paren(delim, n=5):
open, close = delim
ocset = '[^{1}{0}]'.format(open, close)
lft = r'{0}*?(?:\{1}'.format(ocset, open)
mid = r'{0}*?'.format(ocset)
rgt = r'\{1}{0}*?)*?'.format(ocset, close)
return lft*n + mid + rgt*n
| [
1,
529,
9507,
29958,
2272,
1341,
29914,
4422,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
3166,
3030,
1982,
1053,
3030,
12847,
13,
3166,
274,
8768,
1053,
274,
29918,
5405,
29918,
29886,
13,
5215,
2090,
312,
8789,
408,
11791,
13,
5215,
6608,
1982,
13,
5215,
4256,
8504,
408,
372,
13,
5215,
2897,
13,
5215,
5839,
280,
13,
5215,
528,
4422,
13,
13,
3166,
11451,
1341,
29889,
312,
7384,
4422,
1053,
679,
29918,
1982,
29883,
29918,
2220,
13,
13,
13,
1990,
2626,
29877,
675,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3653,
1125,
13,
4706,
1583,
29889,
9891,
353,
3653,
13,
13,
1678,
822,
4770,
657,
12035,
1311,
29892,
2777,
29892,
12271,
1125,
13,
4706,
736,
1583,
29889,
9891,
565,
2777,
338,
6213,
1683,
11791,
29889,
3846,
29898,
1311,
29892,
2777,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
2777,
353,
6389,
29961,
29900,
29962,
13,
13,
4706,
1018,
29901,
13,
9651,
7090,
353,
2777,
3032,
6954,
29877,
675,
29918,
8173,
13,
4706,
5174,
23833,
2392,
29901,
13,
9651,
7090,
353,
2777,
3032,
6954,
29877,
675,
29918,
8173,
353,
6571,
13,
13,
4706,
1820,
353,
313,
1311,
29889,
9891,
29892,
5839,
280,
29889,
29881,
17204,
29898,
5085,
29961,
29896,
29901,
11724,
5839,
280,
29889,
29881,
17204,
29898,
19290,
876,
13,
13,
4706,
1018,
29901,
13,
9651,
620,
353,
7090,
29961,
1989,
29962,
13,
4706,
5174,
7670,
2392,
29901,
13,
9651,
620,
353,
7090,
29961,
1989,
29962,
353,
1583,
29889,
9891,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
4706,
736,
620,
13,
13,
13,
1990,
10166,
1761,
29898,
1761,
1125,
13,
1678,
822,
4770,
657,
5552,
12035,
1311,
29892,
12421,
1125,
13,
4706,
736,
10166,
1761,
29898,
657,
5552,
29898,
29916,
29892,
12421,
29897,
363,
921,
297,
1583,
29897,
13,
13,
1678,
822,
4770,
842,
5552,
12035,
1311,
29892,
12421,
29892,
659,
1125,
13,
4706,
363,
921,
297,
1583,
29901,
13,
9651,
731,
5552,
29898,
29916,
29892,
12421,
29892,
659,
29897,
13,
13,
1678,
822,
4770,
6144,
5552,
12035,
1311,
29892,
12421,
1125,
13,
4706,
363,
921,
297,
1583,
29901,
13,
9651,
628,
5552,
29898,
29916,
29892,
12421,
29897,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
736,
10166,
1761,
29898,
29916,
10456,
5085,
29892,
3579,
19290,
29897,
363,
921,
297,
1583,
29897,
13,
13,
13,
1990,
15142,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
27591,
29922,
359,
29889,
3359,
4304,
29892,
380,
20405,
29922,
359,
29889,
3359,
4304,
1125,
13,
4706,
1583,
29889,
449,
5325,
353,
27591,
29892,
380,
20405,
13,
4706,
1583,
29889,
17743,
457,
353,
313,
25393,
1275,
380,
20405,
29897,
13,
13,
4706,
396,
7255,
1548,
263,
4386,
304,
285,
23126,
515,
4303,
29883,
13,
4706,
1583,
29889,
1982,
29883,
29918,
600,
29880,
1878,
353,
679,
29918,
1982,
29883,
29918,
2220,
877,
600,
29880,
1878,
1495,
13,
4706,
1583,
29889,
1982,
29883,
29918,
600,
29880,
1878,
29889,
1191,
8768,
353,
518,
29883,
29918,
5405,
29918,
29886,
29962,
13,
13,
1678,
822,
4770,
5893,
12035,
1311,
1125,
13,
4706,
1053,
10876,
13,
4706,
1583,
29889,
9675,
353,
10876,
13,
13,
4706,
396,
2379,
1878,
13,
4706,
10876,
17255,
25393,
26914,
23126,
580,
13,
4706,
10876,
17255,
303,
20405,
26914,
23126,
580,
13,
13,
4706,
396,
16913,
13,
4706,
1583,
29889,
17314,
29918,
5461,
29879,
353,
518,
9675,
17255,
25393,
1649,
29892,
10876,
17255,
303,
20405,
1649,
29962,
13,
4706,
1583,
29889,
29888,
6289,
353,
518,
29879,
29889,
1777,
8154,
580,
363,
269,
297,
1583,
29889,
17314,
29918,
5461,
29879,
29962,
13,
4706,
1583,
29889,
17314,
29918,
29888,
6289,
353,
518,
359,
29889,
20908,
29898,
29888,
29897,
363,
285,
297,
1583,
29889,
29888,
6289,
29962,
13,
13,
4706,
396,
4673,
278,
28937,
13,
4706,
565,
1583,
29889,
17743,
457,
29901,
13,
9651,
1583,
29889,
1482,
29918,
5461,
29879,
353,
518,
3150,
29898,
1311,
29889,
449,
5325,
29961,
29900,
1402,
525,
29893,
29890,
742,
29871,
29900,
4638,
29930,
29906,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
1482,
29918,
5461,
29879,
353,
518,
3150,
29898,
29888,
29892,
525,
29893,
29890,
742,
29871,
29900,
29897,
363,
285,
297,
1583,
29889,
449,
5325,
29962,
13,
13,
4706,
1583,
29889,
1482,
29918,
29888,
6289,
353,
518,
29879,
29889,
1777,
8154,
580,
363,
269,
297,
1583,
29889,
1482,
29918,
5461,
29879,
29962,
13,
13,
4706,
396,
22108,
13,
4706,
2897,
29889,
20908,
29906,
29898,
1311,
29889,
1482,
29918,
29888,
6289,
29961,
29900,
1402,
1583,
29889,
29888,
6289,
29961,
29900,
2314,
13,
4706,
2897,
29889,
20908,
29906,
29898,
1311,
29889,
1482,
29918,
29888,
6289,
29961,
29896,
1402,
1583,
29889,
29888,
6289,
29961,
29896,
2314,
13,
13,
1678,
822,
4770,
13322,
12035,
1311,
29892,
334,
5085,
1125,
13,
4706,
10876,
353,
1583,
29889,
9675,
13,
13,
4706,
396,
2379,
1878,
13,
4706,
1583,
29889,
1982,
29883,
29918,
600,
29880,
1878,
29898,
8516,
29897,
13,
13,
4706,
396,
11654,
487,
13,
4706,
2897,
29889,
20908,
29906,
29898,
1311,
29889,
17314,
29918,
29888,
6289,
29961,
29900,
1402,
1583,
29889,
29888,
6289,
29961,
29900,
2314,
13,
4706,
2897,
29889,
20908,
29906,
29898,
1311,
29889,
17314,
29918,
29888,
6289,
29961,
29896,
1402,
1583,
29889,
29888,
6289,
29961,
29896,
2314,
13,
13,
4706,
10876,
29889,
25393,
29892,
10876,
29889,
303,
20405,
353,
1583,
29889,
17314,
29918,
5461,
29879,
13,
13,
4706,
396,
315,
14044,
701,
13,
4706,
1583,
29889,
1482,
29918,
5461,
29879,
29961,
29900,
1822,
5358,
580,
13,
4706,
1583,
29889,
1482,
29918,
5461,
29879,
29961,
29896,
1822,
5358,
580,
13,
13,
4706,
2897,
29889,
5358,
29898,
1311,
29889,
17314,
29918,
29888,
6289,
29961,
29900,
2314,
13,
4706,
2897,
29889,
5358,
29898,
1311,
29889,
17314,
29918,
29888,
6289,
29961,
29896,
2314,
13,
13,
13,
29992,
4703,
12847,
13,
1753,
731,
6272,
29898,
1068,
19290,
1125,
13,
1678,
903,
6272,
353,
2897,
29889,
21813,
29889,
8552,
580,
13,
1678,
2897,
29889,
21813,
29889,
5504,
29898,
19290,
29897,
13,
13,
1678,
1018,
29901,
13,
4706,
7709,
13,
1678,
7146,
29901,
13,
4706,
2897,
29889,
21813,
29889,
8551,
580,
13,
4706,
2897,
29889,
21813,
29889,
5504,
7373,
6272,
29897,
13,
13,
13,
29992,
4703,
12847,
13,
1753,
521,
3972,
29898,
25721,
1125,
13,
1678,
274,
3972,
353,
2897,
29889,
657,
29883,
9970,
580,
13,
13,
1678,
1018,
29901,
13,
4706,
565,
4516,
978,
29901,
13,
9651,
2897,
29889,
305,
3972,
29898,
25721,
29897,
13,
4706,
7709,
13,
1678,
7146,
29901,
13,
4706,
2897,
29889,
305,
3972,
29898,
2252,
381,
29897,
13,
13,
13,
1990,
17366,
7728,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7876,
1125,
13,
4706,
1583,
29889,
9144,
353,
7876,
13,
13,
1678,
822,
4770,
657,
12035,
1311,
29892,
2777,
29892,
12271,
1125,
13,
4706,
565,
2777,
338,
6213,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
995,
353,
1583,
29889,
9144,
29898,
8758,
29897,
13,
4706,
731,
5552,
29898,
8758,
29892,
1583,
29889,
9144,
17255,
978,
1649,
29892,
995,
29897,
13,
13,
4706,
736,
995,
13,
13,
13,
1753,
1014,
13203,
29898,
25932,
29892,
925,
29918,
29500,
29922,
8824,
1125,
13,
1678,
885,
353,
1067,
29879,
17255,
1491,
13203,
1649,
580,
13,
1678,
269,
1557,
353,
518,
29887,
363,
269,
297,
885,
363,
330,
297,
1014,
13203,
29898,
29879,
29892,
925,
29918,
29500,
4638,
13,
13,
1678,
736,
518,
29879,
363,
269,
297,
885,
565,
451,
925,
29918,
29500,
470,
451,
269,
17255,
1491,
13203,
1649,
580,
29962,
718,
269,
1557,
13,
13,
13,
1753,
19481,
29918,
3062,
29898,
25932,
29892,
3579,
19290,
1125,
13,
1678,
363,
269,
297,
1014,
13203,
29898,
25932,
1125,
13,
4706,
363,
413,
29892,
325,
297,
9049,
5085,
29889,
7076,
7295,
13,
9651,
565,
451,
756,
5552,
29898,
29879,
29892,
413,
29897,
470,
679,
5552,
29898,
29879,
29892,
413,
29897,
2804,
325,
29901,
13,
18884,
2867,
13,
4706,
1683,
29901,
13,
9651,
736,
269,
13,
13,
1678,
12421,
29879,
353,
13420,
15300,
7122,
877,
29912,
29900,
29913,
353,
426,
29896,
29913,
4286,
4830,
29898,
29895,
29892,
325,
29897,
363,
413,
29892,
325,
297,
9049,
5085,
29889,
7076,
3101,
13,
1678,
12020,
7670,
2392,
877,
3782,
1014,
13203,
310,
426,
29900,
29913,
411,
12421,
29879,
1275,
21313,
29896,
1800,
29915,
13,
462,
259,
869,
4830,
29898,
25932,
17255,
978,
1649,
29892,
12421,
29879,
876,
13,
13,
13,
1753,
29871,
299,
3881,
10456,
5085,
1125,
13,
1678,
736,
372,
29889,
4704,
10456,
1958,
29898,
3881,
29892,
6389,
876,
13,
13,
13,
1753,
4697,
342,
10456,
5085,
29892,
6608,
2433,
17051,
29906,
29945,
29953,
29374,
13,
1678,
736,
679,
5552,
29898,
8568,
1982,
29892,
6608,
5033,
23945,
280,
29889,
29881,
17204,
29898,
5085,
8106,
20970,
7501,
342,
580,
13,
13,
13,
1753,
20241,
29898,
2084,
1125,
13,
1678,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
2084,
29897,
470,
2897,
29889,
2084,
29889,
275,
2324,
29898,
2084,
1125,
13,
4706,
2897,
29889,
5992,
29898,
2084,
29897,
13,
1678,
1683,
29901,
13,
4706,
528,
4422,
29889,
1758,
8336,
29898,
2084,
29897,
13,
13,
13,
1753,
28241,
29898,
4351,
29892,
29743,
1125,
13,
1678,
528,
4422,
29889,
11631,
29898,
4351,
29892,
29743,
29897,
13,
13,
13,
1753,
1993,
29918,
3274,
2859,
29918,
862,
264,
29898,
6144,
326,
29892,
302,
29922,
29945,
1125,
13,
1678,
1722,
29892,
3802,
353,
628,
326,
13,
1678,
12954,
842,
353,
525,
29961,
998,
29896,
1157,
29900,
6525,
4286,
4830,
29898,
3150,
29892,
3802,
29897,
13,
13,
1678,
301,
615,
353,
364,
29915,
29912,
29900,
29913,
29930,
29973,
10780,
3583,
29912,
29896,
29913,
4286,
4830,
29898,
542,
842,
29892,
1722,
29897,
13,
1678,
7145,
353,
364,
29915,
29912,
29900,
29913,
29930,
29973,
4286,
4830,
29898,
542,
842,
29897,
13,
1678,
364,
4141,
353,
364,
29915,
10045,
29896,
1157,
29900,
29913,
29930,
7897,
29930,
29973,
4286,
4830,
29898,
542,
842,
29892,
3802,
29897,
13,
13,
1678,
736,
301,
615,
29930,
29876,
718,
7145,
718,
364,
4141,
29930,
29876,
13,
2
] |
postpatch.py | mr-ma/basic-self-checksumming | 1 | 573 | <reponame>mr-ma/basic-self-checksumming
import argparse
import os
import r2pipe
import struct
import mmap
import base64
from shutil import copyfile
import pprint
pp = pprint.PrettyPrinter(indent=4)
def precompute_hash(r2, offset, size):
print('Precomputing hash')
h = 0
print("r2 command to get the function body in base64:\np6e {}@{}".format(size, offset))
b64_func = r2.cmd("p6e {}@{}".format(size, offset))
func_bytes = bytearray(base64.b64decode(b64_func))
for b in func_bytes:
h = h ^ b
print('Precomuted hash:', hex(h))
return h
def patch_binary(mm, search_value, patch_value):
print("search value:{} patch value:{}".format(search_value, patch_value))
flag = "<I" # little-endian unsigned int
search_bytes = struct.pack(flag, search_value)
address = mm.find(search_bytes)
if address == -1:
mm.seek(0)
address = mm.find(search_bytes)
mm.seek(address, os.SEEK_SET)
patch_bytes = struct.pack(flag, patch_value)
mm.write(patch_bytes)
def get_protected_function_info(r2, function):
# find addresses and sizes of all functions
r2.cmd("aa")
r2.cmd("aac")
function_list = r2.cmdj("aflj")
# print(function_list)
funcs = {}
for func in function_list:
attr = {'size': func['size'], 'offset': func['offset']}
funcs[func['name']] = attr
# Basic search for mangled names
if function == 'main':
# main function is entry0 in the binary
function = 'entry0'
print("Cannot precompute the expected hash for the main function, why is that?")
exit(1)
match = 0
mangledName = ""
for name, attr in funcs.items():
# sometimes r2 prepends sym. to function names
if function in name:
mangledName = name
match += 1
if match != 1:
print("Failed to safely find function in the binary!")
pp.pprint(funcs)
exit(1)
return funcs[mangledName]
def main():
parser = argparse.ArgumentParser(
description='Postpatch protected C program.')
parser.add_argument('-b', action="store", dest="binary",
help="program.out protected program binary", required=True)
parser.add_argument('-f', action="store", dest="function",
help="protected function name", required=True)
parser.add_argument('-p', nargs="+", dest="placeholders",
help="list of used placeholders in the exact order of function, size, expected hash", required=True)
results = parser.parse_args()
print("python protect program", results)
r2 = r2pipe.open(results.binary)
funcInfo = get_protected_function_info(r2, results.function)
funcOffset = funcInfo["offset"]
funcSize = funcInfo["size"]
funcExpectedHash = precompute_hash(r2, funcOffset, funcSize)
print("funcOffset:{} funcSize:{} funcExpectedHash:{}".format(
funcOffset, funcSize, funcExpectedHash))
binaryFile, _ = os.path.splitext(results.binary)
patchedBinary = "{}-patched.out".format(binaryFile)
copyfile(results.binary, patchedBinary)
with open(patchedBinary, 'r+b') as binary:
mm = mmap.mmap(binary.fileno(), 0)
patch_binary(mm, int(results.placeholders[0]), int(funcSize))
patch_binary(mm, int(results.placeholders[1]), int(funcExpectedHash))
print("Successfully stored patched binary {}".format(patchedBinary))
status = os.system(
"chmod +x {}".format(patchedBinary))
if status != 0:
print("Error in setting permission, try:\n sudo chmod +x {}".format(patchedBinary))
exit(1)
if __name__ == '__main__':
main()
| [
1,
529,
276,
1112,
420,
29958,
29885,
29878,
29899,
655,
29914,
16121,
29899,
1311,
29899,
3198,
2083,
4056,
13,
5215,
1852,
5510,
13,
5215,
2897,
13,
5215,
364,
29906,
17760,
13,
5215,
2281,
13,
5215,
286,
1958,
13,
5215,
2967,
29953,
29946,
13,
3166,
528,
4422,
1053,
3509,
1445,
13,
5215,
282,
2158,
13,
407,
353,
282,
2158,
29889,
6572,
4349,
4040,
1639,
29898,
12860,
29922,
29946,
29897,
13,
13,
13,
1753,
758,
26017,
29918,
8568,
29898,
29878,
29906,
29892,
9210,
29892,
2159,
1125,
13,
1678,
1596,
877,
6572,
12097,
292,
6608,
1495,
13,
1678,
298,
353,
29871,
29900,
13,
1678,
1596,
703,
29878,
29906,
1899,
304,
679,
278,
740,
3573,
297,
2967,
29953,
29946,
3583,
9302,
29953,
29872,
6571,
29992,
8875,
1642,
4830,
29898,
2311,
29892,
9210,
876,
13,
1678,
289,
29953,
29946,
29918,
9891,
353,
364,
29906,
29889,
9006,
703,
29886,
29953,
29872,
6571,
29992,
8875,
1642,
4830,
29898,
2311,
29892,
9210,
876,
13,
1678,
3653,
29918,
13193,
353,
7023,
2378,
29898,
3188,
29953,
29946,
29889,
29890,
29953,
29946,
13808,
29898,
29890,
29953,
29946,
29918,
9891,
876,
13,
1678,
363,
289,
297,
3653,
29918,
13193,
29901,
13,
4706,
298,
353,
298,
6228,
289,
13,
1678,
1596,
877,
6572,
510,
3860,
6608,
29901,
742,
15090,
29898,
29882,
876,
13,
1678,
736,
298,
13,
13,
13,
1753,
13261,
29918,
19541,
29898,
4317,
29892,
2740,
29918,
1767,
29892,
13261,
29918,
1767,
1125,
13,
1678,
1596,
703,
4478,
995,
29901,
8875,
13261,
995,
29901,
8875,
1642,
4830,
29898,
4478,
29918,
1767,
29892,
13261,
29918,
1767,
876,
13,
1678,
7353,
353,
9872,
29902,
29908,
29871,
396,
2217,
29899,
355,
713,
12780,
938,
13,
1678,
2740,
29918,
13193,
353,
2281,
29889,
4058,
29898,
15581,
29892,
2740,
29918,
1767,
29897,
13,
1678,
3211,
353,
5654,
29889,
2886,
29898,
4478,
29918,
13193,
29897,
13,
1678,
565,
3211,
1275,
448,
29896,
29901,
13,
4706,
5654,
29889,
344,
1416,
29898,
29900,
29897,
13,
4706,
3211,
353,
5654,
29889,
2886,
29898,
4478,
29918,
13193,
29897,
13,
1678,
5654,
29889,
344,
1416,
29898,
7328,
29892,
2897,
29889,
22048,
29968,
29918,
10490,
29897,
13,
1678,
13261,
29918,
13193,
353,
2281,
29889,
4058,
29898,
15581,
29892,
13261,
29918,
1767,
29897,
13,
1678,
5654,
29889,
3539,
29898,
5041,
29918,
13193,
29897,
13,
13,
13,
1753,
679,
29918,
24681,
29918,
2220,
29918,
3888,
29898,
29878,
29906,
29892,
740,
1125,
13,
1678,
396,
1284,
14157,
322,
15786,
310,
599,
3168,
13,
1678,
364,
29906,
29889,
9006,
703,
7340,
1159,
13,
1678,
364,
29906,
29889,
9006,
703,
29874,
562,
1159,
13,
1678,
740,
29918,
1761,
353,
364,
29906,
29889,
9006,
29926,
703,
29874,
1579,
29926,
1159,
13,
1678,
396,
1596,
29898,
2220,
29918,
1761,
29897,
13,
1678,
2090,
2395,
353,
6571,
13,
1678,
363,
3653,
297,
740,
29918,
1761,
29901,
13,
4706,
12421,
353,
11117,
2311,
2396,
3653,
1839,
2311,
7464,
525,
10289,
2396,
3653,
1839,
10289,
2033,
29913,
13,
4706,
2090,
2395,
29961,
9891,
1839,
978,
2033,
29962,
353,
12421,
13,
13,
1678,
396,
19219,
2740,
363,
25016,
839,
2983,
13,
1678,
565,
740,
1275,
525,
3396,
2396,
13,
4706,
396,
1667,
740,
338,
6251,
29900,
297,
278,
7581,
13,
4706,
740,
353,
525,
8269,
29900,
29915,
13,
4706,
1596,
703,
29089,
758,
26017,
278,
3806,
6608,
363,
278,
1667,
740,
29892,
2020,
338,
393,
29973,
1159,
13,
4706,
6876,
29898,
29896,
29897,
13,
1678,
1993,
353,
29871,
29900,
13,
1678,
25016,
839,
1170,
353,
5124,
13,
1678,
363,
1024,
29892,
12421,
297,
2090,
2395,
29889,
7076,
7295,
13,
4706,
396,
6041,
364,
29906,
8273,
1975,
5016,
29889,
304,
740,
2983,
13,
4706,
565,
740,
297,
1024,
29901,
13,
9651,
25016,
839,
1170,
353,
1024,
13,
9651,
1993,
4619,
29871,
29896,
13,
1678,
565,
1993,
2804,
29871,
29896,
29901,
13,
4706,
1596,
703,
17776,
304,
23511,
1284,
740,
297,
278,
7581,
29991,
1159,
13,
4706,
6499,
29889,
407,
29878,
524,
29898,
7692,
2395,
29897,
13,
4706,
6876,
29898,
29896,
29897,
13,
1678,
736,
2090,
2395,
29961,
29885,
574,
839,
1170,
29962,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
29898,
13,
4706,
6139,
2433,
6747,
5041,
6364,
315,
1824,
29889,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29890,
742,
3158,
543,
8899,
613,
2731,
543,
19541,
613,
13,
462,
4706,
1371,
543,
8860,
29889,
449,
6364,
1824,
7581,
613,
3734,
29922,
5574,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29888,
742,
3158,
543,
8899,
613,
2731,
543,
2220,
613,
13,
462,
4706,
1371,
543,
24681,
740,
1024,
613,
3734,
29922,
5574,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29886,
742,
302,
5085,
543,
29974,
613,
2731,
543,
6689,
8948,
414,
613,
13,
462,
4706,
1371,
543,
1761,
310,
1304,
2058,
8948,
414,
297,
278,
2684,
1797,
310,
740,
29892,
2159,
29892,
3806,
6608,
613,
3734,
29922,
5574,
29897,
13,
1678,
2582,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
1596,
703,
4691,
12566,
1824,
613,
2582,
29897,
13,
1678,
364,
29906,
353,
364,
29906,
17760,
29889,
3150,
29898,
9902,
29889,
19541,
29897,
13,
1678,
3653,
3401,
353,
679,
29918,
24681,
29918,
2220,
29918,
3888,
29898,
29878,
29906,
29892,
2582,
29889,
2220,
29897,
13,
1678,
3653,
10302,
353,
3653,
3401,
3366,
10289,
3108,
13,
1678,
3653,
3505,
353,
3653,
3401,
3366,
2311,
3108,
13,
1678,
3653,
1252,
6021,
10438,
353,
758,
26017,
29918,
8568,
29898,
29878,
29906,
29892,
3653,
10302,
29892,
3653,
3505,
29897,
13,
13,
1678,
1596,
703,
9891,
10302,
29901,
8875,
3653,
3505,
29901,
8875,
3653,
1252,
6021,
10438,
29901,
8875,
1642,
4830,
29898,
13,
4706,
3653,
10302,
29892,
3653,
3505,
29892,
3653,
1252,
6021,
10438,
876,
13,
1678,
7581,
2283,
29892,
903,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
9902,
29889,
19541,
29897,
13,
1678,
13261,
287,
25196,
353,
29850,
7402,
5041,
287,
29889,
449,
1642,
4830,
29898,
19541,
2283,
29897,
13,
1678,
3509,
1445,
29898,
9902,
29889,
19541,
29892,
13261,
287,
25196,
29897,
13,
1678,
411,
1722,
29898,
5041,
287,
25196,
29892,
525,
29878,
29974,
29890,
1495,
408,
7581,
29901,
13,
4706,
5654,
353,
286,
1958,
29889,
29885,
1958,
29898,
19541,
29889,
1777,
8154,
3285,
29871,
29900,
29897,
13,
4706,
13261,
29918,
19541,
29898,
4317,
29892,
938,
29898,
9902,
29889,
6689,
8948,
414,
29961,
29900,
11724,
938,
29898,
9891,
3505,
876,
13,
4706,
13261,
29918,
19541,
29898,
4317,
29892,
938,
29898,
9902,
29889,
6689,
8948,
414,
29961,
29896,
11724,
938,
29898,
9891,
1252,
6021,
10438,
876,
13,
1678,
1596,
703,
14191,
3730,
6087,
13261,
287,
7581,
6571,
1642,
4830,
29898,
5041,
287,
25196,
876,
13,
1678,
4660,
353,
2897,
29889,
5205,
29898,
13,
4706,
376,
305,
1545,
718,
29916,
6571,
1642,
4830,
29898,
5041,
287,
25196,
876,
13,
1678,
565,
4660,
2804,
29871,
29900,
29901,
13,
4706,
1596,
703,
2392,
297,
4444,
10751,
29892,
1018,
3583,
29876,
9196,
521,
1545,
718,
29916,
6571,
1642,
4830,
29898,
5041,
287,
25196,
876,
13,
4706,
6876,
29898,
29896,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
learning_journal/security.py | han8909227/pyramid-learning-journal | 0 | 52407 | <filename>learning_journal/security.py
"""Configure and hold all pertinent security information for the app."""
import os
from pyramid.authentication import AuthTktAuthenticationPolicy
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.security import Authenticated
from pyramid.security import Allow
from passlib.apps import custom_app_context as pwd_context
from pyramid.session import SignedCookieSessionFactory # <-- include this
class MyRoot(object):
"""My root class."""
def __init__(self, request):
"""Init auth class."""
self.request = request
__acl__ = [
(Allow, Authenticated, 'secret'),
]
def is_authenticated(username, password):
"""Check if the user's username and password are good."""
if username == os.environ.get('AUTH_USERNAME', ''):
if pwd_context.verify(password, os.environ.get('AUTH_PASSWORD', '')):
return True
return False
def includeme(config):
"""."""
# set up authentication
auth_secret = os.environ.get('AUTH_SECRET', '')
authn_policy = AuthTktAuthenticationPolicy(
secret=auth_secret,
hashalg='sha512'
)
config.set_authentication_policy(authn_policy)
# set up authorization
authz_policy = ACLAuthorizationPolicy()
config.set_authorization_policy(authz_policy)
# config.set_default_permission('secret')
# if i want every view by default to be behind a login wall
config.set_root_factory(MyRoot)
# set up CSRF token to prevent CSRF attack
session_secret = os.environ.get('SESSION_SECRET', '')
session_factory = SignedCookieSessionFactory(session_secret)
config.set_session_factory(session_factory)
config.set_default_csrf_options(require_csrf=True)
| [
1,
529,
9507,
29958,
21891,
29918,
29926,
4659,
29914,
8926,
29889,
2272,
13,
15945,
29908,
3991,
545,
322,
4808,
599,
13499,
8946,
6993,
2472,
363,
278,
623,
1213,
15945,
13,
5215,
2897,
13,
3166,
11451,
2572,
333,
29889,
23055,
1053,
13189,
29911,
1193,
16746,
15644,
13,
3166,
11451,
2572,
333,
29889,
8921,
2133,
1053,
319,
13875,
329,
2015,
2133,
15644,
13,
3166,
11451,
2572,
333,
29889,
8926,
1053,
13189,
4173,
630,
13,
3166,
11451,
2572,
333,
29889,
8926,
1053,
29408,
13,
3166,
1209,
1982,
29889,
13371,
1053,
2888,
29918,
932,
29918,
4703,
408,
282,
9970,
29918,
4703,
13,
3166,
11451,
2572,
333,
29889,
7924,
1053,
9954,
287,
24914,
7317,
5126,
29871,
396,
529,
489,
3160,
445,
13,
13,
13,
1990,
1619,
10303,
29898,
3318,
1125,
13,
1678,
9995,
3421,
3876,
770,
1213,
15945,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2009,
1125,
13,
4706,
9995,
6644,
4817,
770,
1213,
15945,
13,
4706,
1583,
29889,
3827,
353,
2009,
13,
13,
1678,
4770,
562,
29880,
1649,
353,
518,
13,
4706,
313,
15930,
29892,
13189,
4173,
630,
29892,
525,
19024,
5477,
13,
1678,
4514,
13,
13,
13,
1753,
338,
29918,
27218,
630,
29898,
6786,
29892,
4800,
1125,
13,
1678,
9995,
5596,
565,
278,
1404,
29915,
29879,
8952,
322,
4800,
526,
1781,
1213,
15945,
13,
1678,
565,
8952,
1275,
2897,
29889,
21813,
29889,
657,
877,
20656,
29950,
29918,
11889,
5813,
742,
6629,
1125,
13,
4706,
565,
282,
9970,
29918,
4703,
29889,
27902,
29898,
5630,
29892,
2897,
29889,
21813,
29889,
657,
877,
20656,
29950,
29918,
25711,
17013,
742,
6629,
22164,
13,
9651,
736,
5852,
13,
1678,
736,
7700,
13,
13,
13,
1753,
3160,
1004,
29898,
2917,
1125,
13,
1678,
9995,
1213,
15945,
13,
1678,
396,
731,
701,
10760,
13,
1678,
4817,
29918,
19024,
353,
2897,
29889,
21813,
29889,
657,
877,
20656,
29950,
29918,
1660,
22245,
29911,
742,
27255,
13,
1678,
1120,
3123,
29918,
22197,
353,
13189,
29911,
1193,
16746,
15644,
29898,
13,
4706,
7035,
29922,
5150,
29918,
19024,
29892,
13,
4706,
756,
4077,
29887,
2433,
17051,
29945,
29896,
29906,
29915,
13,
1678,
1723,
13,
1678,
2295,
29889,
842,
29918,
23055,
29918,
22197,
29898,
1300,
3123,
29918,
22197,
29897,
13,
13,
1678,
396,
731,
701,
28733,
13,
1678,
4817,
29920,
29918,
22197,
353,
319,
13875,
329,
2015,
2133,
15644,
580,
13,
1678,
2295,
29889,
842,
29918,
8921,
2133,
29918,
22197,
29898,
5150,
29920,
29918,
22197,
29897,
13,
1678,
396,
2295,
29889,
842,
29918,
4381,
29918,
16074,
877,
19024,
1495,
13,
1678,
396,
565,
474,
864,
1432,
1776,
491,
2322,
304,
367,
5742,
263,
6464,
10090,
13,
1678,
2295,
29889,
842,
29918,
4632,
29918,
14399,
29898,
3421,
10303,
29897,
13,
13,
1678,
396,
731,
701,
315,
14098,
29943,
5993,
304,
5557,
315,
14098,
29943,
5337,
13,
1678,
4867,
29918,
19024,
353,
2897,
29889,
21813,
29889,
657,
877,
17493,
29918,
1660,
22245,
29911,
742,
27255,
13,
1678,
4867,
29918,
14399,
353,
9954,
287,
24914,
7317,
5126,
29898,
7924,
29918,
19024,
29897,
13,
1678,
2295,
29889,
842,
29918,
7924,
29918,
14399,
29898,
7924,
29918,
14399,
29897,
13,
1678,
2295,
29889,
842,
29918,
4381,
29918,
2395,
9600,
29918,
6768,
29898,
12277,
29918,
2395,
9600,
29922,
5574,
29897,
13,
2
] |
backend/main/models.py | hadi-f90/futurecoder | 0 | 111657 | from django.contrib.auth.models import AbstractUser
from django.db import models
from main.text import page_slugs_list, pages
from jsonfield import JSONField
class PagesProgress(dict):
"""Supplies the first step name as the default for missing pages"""
def __missing__(self, key):
result = {"step_name": pages[key].step_names[0]}
self[key] = result
return result
class User(AbstractUser):
page_slug = models.CharField(default=page_slugs_list[0], max_length=128)
json = JSONField(default={"pages_progress": {}})
developer_mode = models.BooleanField(default=False)
@property
def pages_progress(self):
"""
Returns a PagesProgress dict which fills in default values.
Ensures the result is directly in the json field so changes
are written back to the database.
"""
result = self.json["pages_progress"]
if not isinstance(result, PagesProgress):
result = self.json["pages_progress"] = PagesProgress(result)
return result
class ListEmail(models.Model):
email = models.EmailField()
class CodeEntry(models.Model):
timestamp = models.DateTimeField(auto_now=True)
input = models.TextField()
output = models.TextField(null=True)
source = models.CharField(max_length=32)
user = models.ForeignKey(User, on_delete=models.SET_NULL, related_name='code_entries', null=True)
page_slug = models.CharField(max_length=128)
step_name = models.CharField(max_length=128)
| [
1,
515,
9557,
29889,
21570,
29889,
5150,
29889,
9794,
1053,
25513,
2659,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
13,
3166,
1667,
29889,
726,
1053,
1813,
29918,
2536,
16926,
29918,
1761,
29892,
6515,
13,
3166,
4390,
2671,
1053,
4663,
3073,
13,
13,
13,
1990,
349,
1179,
14470,
29898,
8977,
1125,
13,
1678,
9995,
20182,
3687,
278,
937,
4331,
1024,
408,
278,
2322,
363,
4567,
6515,
15945,
29908,
13,
1678,
822,
4770,
27259,
12035,
1311,
29892,
1820,
1125,
13,
4706,
1121,
353,
8853,
10568,
29918,
978,
1115,
6515,
29961,
1989,
1822,
10568,
29918,
7039,
29961,
29900,
12258,
13,
4706,
1583,
29961,
1989,
29962,
353,
1121,
13,
4706,
736,
1121,
13,
13,
13,
1990,
4911,
29898,
9118,
2659,
1125,
13,
1678,
1813,
29918,
29517,
353,
4733,
29889,
27890,
29898,
4381,
29922,
3488,
29918,
2536,
16926,
29918,
1761,
29961,
29900,
1402,
4236,
29918,
2848,
29922,
29896,
29906,
29947,
29897,
13,
1678,
4390,
353,
4663,
3073,
29898,
4381,
3790,
29908,
12292,
29918,
18035,
1115,
426,
24289,
13,
1678,
13897,
29918,
8513,
353,
4733,
29889,
18146,
3073,
29898,
4381,
29922,
8824,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
6515,
29918,
18035,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
16969,
263,
349,
1179,
14470,
9657,
607,
27793,
297,
2322,
1819,
29889,
13,
4706,
22521,
1973,
278,
1121,
338,
4153,
297,
278,
4390,
1746,
577,
3620,
13,
4706,
526,
3971,
1250,
304,
278,
2566,
29889,
13,
4706,
9995,
13,
4706,
1121,
353,
1583,
29889,
3126,
3366,
12292,
29918,
18035,
3108,
13,
4706,
565,
451,
338,
8758,
29898,
2914,
29892,
349,
1179,
14470,
1125,
13,
9651,
1121,
353,
1583,
29889,
3126,
3366,
12292,
29918,
18035,
3108,
353,
349,
1179,
14470,
29898,
2914,
29897,
13,
4706,
736,
1121,
13,
13,
13,
1990,
2391,
9823,
29898,
9794,
29889,
3195,
1125,
13,
1678,
4876,
353,
4733,
29889,
9823,
3073,
580,
13,
13,
13,
1990,
5920,
9634,
29898,
9794,
29889,
3195,
1125,
13,
1678,
14334,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29922,
5574,
29897,
13,
1678,
1881,
353,
4733,
29889,
15778,
580,
13,
1678,
1962,
353,
4733,
29889,
15778,
29898,
4304,
29922,
5574,
29897,
13,
1678,
2752,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29941,
29906,
29897,
13,
1678,
1404,
353,
4733,
29889,
27755,
2558,
29898,
2659,
29892,
373,
29918,
8143,
29922,
9794,
29889,
10490,
29918,
10074,
29892,
4475,
29918,
978,
2433,
401,
29918,
26586,
742,
1870,
29922,
5574,
29897,
13,
1678,
1813,
29918,
29517,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29906,
29947,
29897,
13,
1678,
4331,
29918,
978,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29896,
29906,
29947,
29897,
13,
2
] |
pytoolkit/applications/__init__.py | ak110/pytoolk | 26 | 24210 | """Kerasの各種モデル。"""
# pylint: skip-file
# flake8: noqa
from . import darknet53, efficientnet, xception
| [
1,
9995,
29968,
18464,
30199,
232,
147,
135,
234,
171,
177,
30761,
30597,
30258,
30267,
15945,
29908,
13,
29937,
282,
2904,
524,
29901,
14383,
29899,
1445,
13,
29937,
17422,
446,
29947,
29901,
694,
25621,
13,
13,
3166,
869,
1053,
6501,
1212,
29945,
29941,
29892,
8543,
1212,
29892,
921,
1441,
13,
2
] |
pys/testing.py | nahian-147/my_codes | 0 | 89255 | <reponame>nahian-147/my_codes
import subprocess
p = int(subprocess.check_output(["./testing","5"]).decode())
print(p*p)
| [
1,
529,
276,
1112,
420,
29958,
8723,
713,
29899,
29896,
29946,
29955,
29914,
1357,
29918,
18137,
13,
5215,
1014,
5014,
30004,
13,
30004,
13,
29886,
353,
938,
29898,
1491,
5014,
29889,
3198,
29918,
4905,
4197,
1642,
29914,
13424,
3284,
29945,
3108,
467,
13808,
3101,
30004,
13,
30004,
13,
2158,
29898,
29886,
29930,
29886,
8443,
13,
2
] |
Netmiko/GetInts.py | NetworkNick-US/PythonScripts | 0 | 60907 | import netmiko
import LogUtility
class CiscoBase:
def __init__(self, hostname, ip, device_type=None, username=None, password=<PASSWORD>):
self.hostname = hostname
self.connection_data = {
'ip': ip,
'device_type': device_type,
'username': username,
'password': password
}
def login(self):
return netmiko.ConnectHandler(**self.connection_data)
class CiscoRTR(CiscoBase):
def populate_interface_list(self):
connect = self.login()
sh_ip_int_brief = connect.send_command("show ip int brief", use_textfsm=True)
self.interface_list = []
for interface in sh_ip_int_brief:
self.interface_list.append(interface['intf'])
CoreRTR = CiscoRTR("Core1", "192.168.255.254", "cisco-ios", "localAdmin", "SuperSecure123!!")
CoreRTR.populate_interface_list()
ints = CoreRTR.interface_list
print(ints)
logList = LogUtility.NetworkLogger("interfaces.txt")
logList.log(str(ints))
| [
1,
1053,
7787,
29885,
10349,
13,
5215,
4522,
7270,
537,
13,
13,
13,
1990,
315,
275,
1111,
5160,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3495,
978,
29892,
10377,
29892,
4742,
29918,
1853,
29922,
8516,
29892,
8952,
29922,
8516,
29892,
4800,
29922,
29966,
25711,
17013,
29958,
1125,
13,
4706,
1583,
29889,
28988,
353,
3495,
978,
13,
4706,
1583,
29889,
9965,
29918,
1272,
353,
426,
13,
9651,
525,
666,
2396,
10377,
29892,
13,
9651,
525,
10141,
29918,
1853,
2396,
4742,
29918,
1853,
29892,
13,
9651,
525,
6786,
2396,
8952,
29892,
13,
9651,
525,
5630,
2396,
4800,
13,
4706,
500,
13,
13,
1678,
822,
6464,
29898,
1311,
1125,
13,
4706,
736,
7787,
29885,
10349,
29889,
17918,
4598,
29898,
1068,
1311,
29889,
9965,
29918,
1272,
29897,
13,
13,
13,
1990,
315,
275,
1111,
29934,
5659,
29898,
29907,
275,
1111,
5160,
1125,
13,
13,
1678,
822,
19450,
29918,
13248,
29918,
1761,
29898,
1311,
1125,
13,
4706,
4511,
353,
1583,
29889,
7507,
580,
13,
4706,
528,
29918,
666,
29918,
524,
29918,
1182,
2575,
353,
4511,
29889,
6717,
29918,
6519,
703,
4294,
10377,
938,
11473,
613,
671,
29918,
726,
29888,
3844,
29922,
5574,
29897,
13,
4706,
1583,
29889,
13248,
29918,
1761,
353,
5159,
13,
4706,
363,
5067,
297,
528,
29918,
666,
29918,
524,
29918,
1182,
2575,
29901,
13,
9651,
1583,
29889,
13248,
29918,
1761,
29889,
4397,
29898,
13248,
1839,
524,
29888,
11287,
13,
13,
13,
9203,
29934,
5659,
353,
315,
275,
1111,
29934,
5659,
703,
9203,
29896,
613,
376,
29896,
29929,
29906,
29889,
29896,
29953,
29947,
29889,
29906,
29945,
29945,
29889,
29906,
29945,
29946,
613,
376,
3476,
1111,
29899,
2363,
613,
376,
2997,
12754,
613,
376,
19111,
7898,
545,
29896,
29906,
29941,
6824,
1159,
13,
9203,
29934,
5659,
29889,
7323,
5987,
29918,
13248,
29918,
1761,
580,
13,
9466,
353,
10239,
29934,
5659,
29889,
13248,
29918,
1761,
13,
2158,
29898,
9466,
29897,
13,
1188,
1293,
353,
4522,
7270,
537,
29889,
13724,
16363,
703,
1639,
8726,
29889,
3945,
1159,
13,
1188,
1293,
29889,
1188,
29898,
710,
29898,
9466,
876,
13,
2
] |
exceptions/ServiceExceptions.py | sachinraina112/flask_app | 0 | 156469 | <gh_stars>0
from enum import Enum
class ExceptionMessages(Enum):
@property
def code(self):
return self.value[0]
@property
def message(self):
return self.value[1]
PREDICT_JOB_FAIL = (10001, "Error occurred in prediction job")
VALIDATE_JOB_FAIL = (10002, "Error occurred in validation job")
DATA_FETCH_ERROR = (10003, "Error in fetching report")
ERROR_IN_WRITING_DATA = (10004, "Error in writing data into report")
ERROR_IN_LOADING_MODULE = (10005, "Error in loading module")
DATA_NOT_PRESENT = (10006, "Data not present")
ERROR_READING_CONFIG = (10007, "Error while reading app-config file, make sure app-config file exists with model_params property")
URL_REQUIRED_FOR_REQUEST = (10008, "URL should not empty")
class ServiceException(Exception):
def __init__(self, ex: ExceptionMessages=None, message: str=None, code: int=None):
if ex is not None:
self.message = ex.message
self.code = ex.code or 100
else:
self.message = message
self.code = code
super().__init__(self.message)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
14115,
1053,
1174,
398,
13,
13,
1990,
8960,
25510,
29898,
16854,
1125,
13,
13,
1678,
732,
6799,
13,
1678,
822,
775,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
1767,
29961,
29900,
29962,
13,
13,
1678,
732,
6799,
13,
1678,
822,
2643,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
1767,
29961,
29896,
29962,
13,
13,
1678,
349,
1525,
4571,
1783,
29918,
29967,
14824,
29918,
4519,
6227,
353,
313,
29896,
29900,
29900,
29900,
29896,
29892,
376,
2392,
10761,
297,
18988,
4982,
1159,
13,
1678,
12599,
1367,
3040,
29918,
29967,
14824,
29918,
4519,
6227,
353,
313,
29896,
29900,
29900,
29900,
29906,
29892,
376,
2392,
10761,
297,
8845,
4982,
1159,
13,
1678,
360,
8254,
29918,
29943,
2544,
3210,
29918,
11432,
353,
313,
29896,
29900,
29900,
29900,
29941,
29892,
376,
2392,
297,
6699,
292,
3461,
1159,
13,
1678,
14431,
29918,
1177,
29918,
9980,
1806,
4214,
29918,
14573,
353,
313,
29896,
29900,
29900,
29900,
29946,
29892,
376,
2392,
297,
5007,
848,
964,
3461,
1159,
13,
1678,
14431,
29918,
1177,
29918,
29428,
4214,
29918,
6720,
14849,
1307,
353,
313,
29896,
29900,
29900,
29900,
29945,
29892,
376,
2392,
297,
8363,
3883,
1159,
13,
1678,
360,
8254,
29918,
12256,
29918,
15094,
29903,
3919,
353,
313,
29896,
29900,
29900,
29900,
29953,
29892,
376,
1469,
451,
2198,
1159,
13,
1678,
14431,
29918,
16310,
4214,
29918,
25903,
353,
313,
29896,
29900,
29900,
29900,
29955,
29892,
376,
2392,
1550,
5183,
623,
29899,
2917,
934,
29892,
1207,
1854,
623,
29899,
2917,
934,
4864,
411,
1904,
29918,
7529,
2875,
1159,
13,
1678,
3988,
29918,
1525,
29984,
3120,
19386,
29918,
22051,
29918,
16244,
353,
313,
29896,
29900,
29900,
29900,
29947,
29892,
376,
4219,
881,
451,
4069,
1159,
13,
13,
13,
1990,
6692,
2451,
29898,
2451,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
429,
29901,
8960,
25510,
29922,
8516,
29892,
2643,
29901,
851,
29922,
8516,
29892,
775,
29901,
938,
29922,
8516,
1125,
13,
4706,
565,
429,
338,
451,
6213,
29901,
13,
9651,
1583,
29889,
4906,
353,
429,
29889,
4906,
13,
9651,
1583,
29889,
401,
353,
429,
29889,
401,
470,
29871,
29896,
29900,
29900,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
4906,
353,
2643,
13,
9651,
1583,
29889,
401,
353,
775,
13,
4706,
2428,
2141,
1649,
2344,
12035,
1311,
29889,
4906,
29897,
13,
2
] |
dali/core/framework/types.py | seetaresearch/Dragon | 81 | 158161 | <reponame>seetaresearch/Dragon
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ------------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy
try:
from nvidia.dali import types as dali_types
# ConstantWrapper
Constant = dali_types.Constant
ScalarConstant = dali_types.ScalarConstant
# DALIDataType
BOOL = dali_types.BOOL
FLOAT = dali_types.FLOAT
FLOAT16 = dali_types.FLOAT16
FLOAT32 = dali_types.FLOAT
FLOAT64 = dali_types.FLOAT64
INT8 = dali_types.INT8
INT16 = dali_types.INT16
INT32 = dali_types.INT32
INT64 = dali_types.INT64
STRING = dali_types.STRING
UINT8 = dali_types.UINT8
UINT16 = dali_types.UINT16
UINT32 = dali_types.UINT32
UINT64 = dali_types.UINT64
# DALIImageType
BGR = dali_types.BGR
RGB = dali_types.RGB
# DALIInterpType
INTERP_CUBIC = dali_types.INTERP_CUBIC
INTERP_GAUSSIAN = dali_types.INTERP_GAUSSIAN
INTERP_LANCZOS3 = dali_types.INTERP_LANCZOS3
INTERP_LINEAR = dali_types.INTERP_LINEAR
INTERP_NN = dali_types.INTERP_NN
INTERP_TRIANGULAR = dali_types.INTERP_TRIANGULAR
# PipelineAPIType
PIPELINE_API_BASIC = dali_types.PipelineAPIType.BASIC
PIPELINE_API_ITERATOR = dali_types.PipelineAPIType.ITERATOR
PIPELINE_API_SCHEDULED = dali_types.PipelineAPIType.SCHEDULED
# TensorLayout
NCHW = dali_types.NCHW
NHWC = dali_types.NHWC
except ImportError:
dali_types = None
NO_DALI = -1
# ConstantWrapper
Constant = NO_DALI
ScalarConstant = NO_DALI
# DALIDataType
BOOL = NO_DALI
FLOAT = NO_DALI
FLOAT16 = NO_DALI
FLOAT32 = NO_DALI
FLOAT64 = NO_DALI
INT8 = NO_DALI
INT16 = NO_DALI
INT32 = NO_DALI
INT64 = NO_DALI
STRING = NO_DALI
UINT8 = NO_DALI
UINT16 = NO_DALI
UINT32 = NO_DALI
UINT64 = NO_DALI
# DALIImageType
BGR = NO_DALI
RGB = NO_DALI
# DALIInterpType
INTERP_CUBIC = NO_DALI
INTERP_GAUSSIAN = NO_DALI
INTERP_LANCZOS3 = NO_DALI
INTERP_LINEAR = NO_DALI
INTERP_NN = NO_DALI
INTERP_TRIANGULAR = NO_DALI
# PipelineAPIType
PIPELINE_API_BASIC = NO_DALI
PIPELINE_API_ITERATOR = NO_DALI
PIPELINE_API_SCHEDULED = NO_DALI
# TensorLayout
NCHW = NO_DALI
NHWC = NO_DALI
def np_dtype(dali_dtype):
"""Convert the dali dtype into the numpy format."""
return numpy.dtype(dali_dtype)
| [
1,
529,
276,
1112,
420,
29958,
344,
300,
5114,
2842,
29914,
23978,
265,
13,
29937,
448,
2683,
2683,
2683,
1378,
5634,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29896,
29955,
29899,
6338,
29892,
922,
1187,
29911,
5309,
29892,
3189,
1696,
29931,
1594,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
350,
7230,
29871,
29906,
29899,
20216,
1509,
19245,
29889,
13,
29937,
887,
881,
505,
4520,
263,
3509,
310,
278,
350,
7230,
29871,
29906,
29899,
20216,
1509,
19245,
13,
29937,
3412,
411,
278,
7047,
29889,
960,
451,
29892,
2823,
29892,
13,
29937,
13,
29937,
268,
529,
991,
597,
22156,
1167,
29889,
990,
29914,
506,
11259,
29914,
29933,
7230,
29899,
29906,
29899,
20216,
1509,
29958,
13,
29937,
13,
29937,
448,
2683,
2683,
2683,
1378,
5634,
13,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
13,
5215,
12655,
13,
2202,
29901,
13,
1678,
515,
302,
28584,
29889,
29881,
2606,
1053,
4072,
408,
270,
2606,
29918,
8768,
13,
13,
1678,
396,
28601,
15646,
13,
1678,
28601,
353,
270,
2606,
29918,
8768,
29889,
12075,
424,
13,
1678,
317,
1052,
279,
12075,
424,
353,
270,
2606,
29918,
8768,
29889,
29636,
279,
12075,
424,
13,
13,
1678,
396,
360,
1964,
1367,
532,
1542,
13,
1678,
16437,
5607,
353,
270,
2606,
29918,
8768,
29889,
28443,
13,
1678,
383,
3927,
1299,
353,
270,
2606,
29918,
8768,
29889,
29943,
3927,
1299,
13,
1678,
383,
3927,
1299,
29896,
29953,
353,
270,
2606,
29918,
8768,
29889,
29943,
3927,
1299,
29896,
29953,
13,
1678,
383,
3927,
1299,
29941,
29906,
353,
270,
2606,
29918,
8768,
29889,
29943,
3927,
1299,
13,
1678,
383,
3927,
1299,
29953,
29946,
353,
270,
2606,
29918,
8768,
29889,
29943,
3927,
1299,
29953,
29946,
13,
1678,
19578,
29947,
353,
270,
2606,
29918,
8768,
29889,
10192,
29947,
13,
1678,
19578,
29896,
29953,
353,
270,
2606,
29918,
8768,
29889,
10192,
29896,
29953,
13,
1678,
19578,
29941,
29906,
353,
270,
2606,
29918,
8768,
29889,
10192,
29941,
29906,
13,
1678,
19578,
29953,
29946,
353,
270,
2606,
29918,
8768,
29889,
10192,
29953,
29946,
13,
1678,
29486,
4214,
353,
270,
2606,
29918,
8768,
29889,
20785,
13,
1678,
501,
10192,
29947,
353,
270,
2606,
29918,
8768,
29889,
29965,
10192,
29947,
13,
1678,
501,
10192,
29896,
29953,
353,
270,
2606,
29918,
8768,
29889,
29965,
10192,
29896,
29953,
13,
1678,
501,
10192,
29941,
29906,
353,
270,
2606,
29918,
8768,
29889,
29965,
10192,
29941,
29906,
13,
1678,
501,
10192,
29953,
29946,
353,
270,
2606,
29918,
8768,
29889,
29965,
10192,
29953,
29946,
13,
13,
1678,
396,
360,
1964,
29902,
2940,
1542,
13,
1678,
350,
14345,
353,
270,
2606,
29918,
8768,
29889,
29933,
14345,
13,
1678,
390,
7210,
353,
270,
2606,
29918,
8768,
29889,
28212,
13,
13,
1678,
396,
360,
1964,
29902,
4074,
29886,
1542,
13,
1678,
2672,
4945,
29925,
29918,
29907,
7466,
2965,
353,
270,
2606,
29918,
8768,
29889,
23845,
29925,
29918,
29907,
7466,
2965,
13,
1678,
2672,
4945,
29925,
29918,
12739,
29965,
1799,
29902,
2190,
353,
270,
2606,
29918,
8768,
29889,
23845,
29925,
29918,
12739,
29965,
1799,
29902,
2190,
13,
1678,
2672,
4945,
29925,
29918,
29931,
2190,
29907,
29999,
3267,
29941,
353,
270,
2606,
29918,
8768,
29889,
23845,
29925,
29918,
29931,
2190,
29907,
29999,
3267,
29941,
13,
1678,
2672,
4945,
29925,
29918,
18521,
1718,
353,
270,
2606,
29918,
8768,
29889,
23845,
29925,
29918,
18521,
1718,
13,
1678,
2672,
4945,
29925,
29918,
10262,
353,
270,
2606,
29918,
8768,
29889,
23845,
29925,
29918,
10262,
13,
1678,
2672,
4945,
29925,
29918,
29911,
3960,
19453,
13309,
1718,
353,
270,
2606,
29918,
8768,
29889,
23845,
29925,
29918,
29911,
3960,
19453,
13309,
1718,
13,
13,
1678,
396,
349,
23828,
8787,
1542,
13,
1678,
349,
29902,
4162,
18521,
29918,
8787,
29918,
29933,
3289,
2965,
353,
270,
2606,
29918,
8768,
29889,
29925,
23828,
8787,
1542,
29889,
29933,
3289,
2965,
13,
1678,
349,
29902,
4162,
18521,
29918,
8787,
29918,
1806,
1001,
1299,
1955,
353,
270,
2606,
29918,
8768,
29889,
29925,
23828,
8787,
1542,
29889,
1806,
1001,
1299,
1955,
13,
1678,
349,
29902,
4162,
18521,
29918,
8787,
29918,
29903,
3210,
3352,
29965,
20566,
353,
270,
2606,
29918,
8768,
29889,
29925,
23828,
8787,
1542,
29889,
29903,
3210,
3352,
29965,
20566,
13,
13,
1678,
396,
323,
6073,
3453,
13,
1678,
405,
3210,
29956,
353,
270,
2606,
29918,
8768,
29889,
29940,
3210,
29956,
13,
1678,
405,
29950,
29956,
29907,
353,
270,
2606,
29918,
8768,
29889,
29940,
29950,
29956,
29907,
13,
13,
19499,
16032,
2392,
29901,
13,
13,
1678,
270,
2606,
29918,
8768,
353,
6213,
13,
1678,
11698,
29918,
29928,
1964,
29902,
353,
448,
29896,
13,
13,
1678,
396,
28601,
15646,
13,
1678,
28601,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
317,
1052,
279,
12075,
424,
353,
11698,
29918,
29928,
1964,
29902,
13,
13,
1678,
396,
360,
1964,
1367,
532,
1542,
13,
1678,
16437,
5607,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
383,
3927,
1299,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
383,
3927,
1299,
29896,
29953,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
383,
3927,
1299,
29941,
29906,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
383,
3927,
1299,
29953,
29946,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
19578,
29947,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
19578,
29896,
29953,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
19578,
29941,
29906,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
19578,
29953,
29946,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
29486,
4214,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
501,
10192,
29947,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
501,
10192,
29896,
29953,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
501,
10192,
29941,
29906,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
501,
10192,
29953,
29946,
353,
11698,
29918,
29928,
1964,
29902,
13,
13,
1678,
396,
360,
1964,
29902,
2940,
1542,
13,
1678,
350,
14345,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
390,
7210,
353,
11698,
29918,
29928,
1964,
29902,
13,
13,
1678,
396,
360,
1964,
29902,
4074,
29886,
1542,
13,
1678,
2672,
4945,
29925,
29918,
29907,
7466,
2965,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
2672,
4945,
29925,
29918,
12739,
29965,
1799,
29902,
2190,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
2672,
4945,
29925,
29918,
29931,
2190,
29907,
29999,
3267,
29941,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
2672,
4945,
29925,
29918,
18521,
1718,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
2672,
4945,
29925,
29918,
10262,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
2672,
4945,
29925,
29918,
29911,
3960,
19453,
13309,
1718,
353,
11698,
29918,
29928,
1964,
29902,
13,
13,
1678,
396,
349,
23828,
8787,
1542,
13,
1678,
349,
29902,
4162,
18521,
29918,
8787,
29918,
29933,
3289,
2965,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
349,
29902,
4162,
18521,
29918,
8787,
29918,
1806,
1001,
1299,
1955,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
349,
29902,
4162,
18521,
29918,
8787,
29918,
29903,
3210,
3352,
29965,
20566,
353,
11698,
29918,
29928,
1964,
29902,
13,
13,
1678,
396,
323,
6073,
3453,
13,
1678,
405,
3210,
29956,
353,
11698,
29918,
29928,
1964,
29902,
13,
1678,
405,
29950,
29956,
29907,
353,
11698,
29918,
29928,
1964,
29902,
13,
13,
13,
1753,
7442,
29918,
29881,
1853,
29898,
29881,
2606,
29918,
29881,
1853,
1125,
13,
1678,
9995,
18455,
278,
270,
2606,
26688,
964,
278,
12655,
3402,
1213,
15945,
13,
1678,
736,
12655,
29889,
29881,
1853,
29898,
29881,
2606,
29918,
29881,
1853,
29897,
13,
2
] |
ExpenseTracker/grocery/models.py | lennyAiko/LifeExpenses | 0 | 1606139 | <gh_stars>0
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
PROGRESS = (
('In progress', 'In progress'),
('Completed', 'Completed')
)
class List(models.Model):
user = models.ForeignKey(User,
on_delete=models.CASCADE,
null=True,
related_name='list')
name = models.CharField(max_length=70,
null=True)
status = models.CharField(choices=PROGRESS,
null=True,
max_length=12,
default="In progress")
date_created = models.DateTimeField(auto_now_add=True)
date_updated = models.DateTimeField(auto_now=True)
def __str__(self):
return f"{self.name}"
class Meta:
ordering = ['-date_created']
verbose_name = 'Shopping List'
verbose_name_plural = 'Shopping Lists'
@property
def total_list(self, value=0):
items = self.item.all()
for i in items:
value += i.total_item
return value
class Item(models.Model):
name = models.CharField(max_length=70,
null=True)
price = models.DecimalField(max_digits=7,
decimal_places=2,
default=0.00,
null=True)
quantity = models.IntegerField(default=1,
null=True)
list = models.ForeignKey(List,
on_delete=models.CASCADE,
null=True,
related_name='item')
date_created = models.DateTimeField(auto_now_add=True)
date_updated = models.DateTimeField(auto_now=True)
def __str__(self):
return f"{self.name}"
class Meta:
ordering = ['-date_created']
verbose_name = 'Shopping Item'
verbose_name_plural = 'Shopping Items'
@property
def total_item(self):
return self.price * self.quantity
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
9557,
29889,
2585,
1053,
4733,
13,
3166,
9557,
29889,
21570,
29889,
5150,
29889,
9794,
1053,
4911,
13,
13,
29937,
6204,
596,
4733,
1244,
29889,
13,
13,
13,
8618,
29954,
26785,
353,
313,
13,
1678,
6702,
797,
6728,
742,
525,
797,
6728,
5477,
13,
1678,
6702,
26010,
742,
525,
26010,
1495,
13,
29897,
13,
13,
13,
1990,
2391,
29898,
9794,
29889,
3195,
1125,
13,
1678,
1404,
353,
4733,
29889,
27755,
2558,
29898,
2659,
29892,
13,
462,
632,
373,
29918,
8143,
29922,
9794,
29889,
29907,
3289,
5454,
2287,
29892,
13,
462,
632,
1870,
29922,
5574,
29892,
13,
462,
632,
4475,
29918,
978,
2433,
1761,
1495,
13,
1678,
1024,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29955,
29900,
29892,
13,
462,
9651,
1870,
29922,
5574,
29897,
13,
1678,
4660,
353,
4733,
29889,
27890,
29898,
1859,
1575,
29922,
8618,
29954,
26785,
29892,
13,
462,
795,
1870,
29922,
5574,
29892,
13,
462,
795,
4236,
29918,
2848,
29922,
29896,
29906,
29892,
13,
462,
795,
2322,
543,
797,
6728,
1159,
13,
1678,
2635,
29918,
11600,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
13,
1678,
2635,
29918,
21402,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
285,
29908,
29912,
1311,
29889,
978,
5038,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
20520,
353,
6024,
29899,
1256,
29918,
11600,
2033,
13,
4706,
26952,
29918,
978,
353,
525,
29903,
1251,
3262,
2391,
29915,
13,
4706,
26952,
29918,
978,
29918,
572,
3631,
353,
525,
29903,
1251,
3262,
2391,
29879,
29915,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3001,
29918,
1761,
29898,
1311,
29892,
995,
29922,
29900,
1125,
13,
4706,
4452,
353,
1583,
29889,
667,
29889,
497,
580,
13,
4706,
363,
474,
297,
4452,
29901,
13,
9651,
995,
4619,
474,
29889,
7827,
29918,
667,
13,
4706,
736,
995,
13,
13,
13,
1990,
10976,
29898,
9794,
29889,
3195,
1125,
13,
1678,
1024,
353,
4733,
29889,
27890,
29898,
3317,
29918,
2848,
29922,
29955,
29900,
29892,
13,
462,
9651,
1870,
29922,
5574,
29897,
13,
1678,
8666,
353,
4733,
29889,
23307,
3073,
29898,
3317,
29918,
7501,
1169,
29922,
29955,
29892,
13,
462,
18884,
13677,
29918,
29886,
6048,
29922,
29906,
29892,
13,
462,
18884,
2322,
29922,
29900,
29889,
29900,
29900,
29892,
13,
462,
18884,
1870,
29922,
5574,
29897,
13,
1678,
14728,
353,
4733,
29889,
7798,
3073,
29898,
4381,
29922,
29896,
29892,
13,
462,
462,
259,
1870,
29922,
5574,
29897,
13,
1678,
1051,
353,
4733,
29889,
27755,
2558,
29898,
1293,
29892,
13,
462,
632,
373,
29918,
8143,
29922,
9794,
29889,
29907,
3289,
5454,
2287,
29892,
13,
462,
632,
1870,
29922,
5574,
29892,
13,
462,
632,
4475,
29918,
978,
2433,
667,
1495,
13,
1678,
2635,
29918,
11600,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29918,
1202,
29922,
5574,
29897,
13,
1678,
2635,
29918,
21402,
353,
4733,
29889,
11384,
3073,
29898,
6921,
29918,
3707,
29922,
5574,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
285,
29908,
29912,
1311,
29889,
978,
5038,
13,
13,
1678,
770,
20553,
29901,
13,
4706,
20520,
353,
6024,
29899,
1256,
29918,
11600,
2033,
13,
4706,
26952,
29918,
978,
353,
525,
29903,
1251,
3262,
10976,
29915,
13,
4706,
26952,
29918,
978,
29918,
572,
3631,
353,
525,
29903,
1251,
3262,
25085,
29915,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3001,
29918,
667,
29898,
1311,
1125,
13,
4706,
736,
1583,
29889,
9175,
334,
1583,
29889,
22640,
13,
2
] |
tests/models/test_inv_resourcegroup.py | prorevizor/noc | 84 | 68810 | # ----------------------------------------------------------------------
# inv.ResourceGroup tests
# ----------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# NOC modules
from noc.inv.models.resourcegroup import ResourceGroup
def test_clean_leagacy_id():
left = ResourceGroup._get_collection().find_one({"_legacy_id": {"$exists": True}})
assert left is None, "_legacy_id field has been left by migration"
| [
1,
396,
448,
2683,
2683,
2683,
2683,
23648,
13,
29937,
2437,
29889,
6848,
4782,
6987,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
29937,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29900,
29955,
29899,
29906,
29900,
29896,
29947,
450,
11698,
29907,
8010,
13,
29937,
2823,
365,
2965,
1430,
1660,
363,
4902,
13,
29937,
448,
2683,
2683,
2683,
2683,
23648,
13,
13,
29937,
11698,
29907,
10585,
13,
3166,
302,
542,
29889,
11569,
29889,
9794,
29889,
10314,
2972,
1053,
18981,
4782,
13,
13,
13,
1753,
1243,
29918,
14941,
29918,
280,
351,
4135,
29918,
333,
7295,
13,
1678,
2175,
353,
18981,
4782,
3032,
657,
29918,
10855,
2141,
2886,
29918,
650,
3319,
29908,
29918,
1397,
4135,
29918,
333,
1115,
8853,
29938,
9933,
1115,
5852,
24289,
13,
1678,
4974,
2175,
338,
6213,
29892,
11119,
1397,
4135,
29918,
333,
1746,
756,
1063,
2175,
491,
20332,
29908,
13,
2
] |
qa_tool/tests/test_relevancy_score.py | pg-irc/pathways-backend | 12 | 105485 | import datetime
from test_plus.test import TestCase
from qa_tool.tests.helpers import RelevancyScoreBuilder, AlgorithmBuilder, SearchLocationBuilder
from rest_framework import status
from rest_framework.authtoken.models import Token
from rest_framework.test import APIClient
from human_services.services_at_location.tests.helpers import ServiceAtLocationBuilder
from newcomers_guide.tests.helpers import create_topic
from common.testhelpers.random_test_values import an_integer, a_string
class GETRelevancyScoreTests(TestCase):
def setUp(self):
self.user = self.make_user()
self.token = Token.objects.create(user=self.user)
self.APIClient = APIClient()
self.data = {
'value': an_integer(),
'algorithm': AlgorithmBuilder().create().id,
'search_location': SearchLocationBuilder().create().id,
'service_at_location': ServiceAtLocationBuilder().create().id,
'topic': create_topic(a_string()).id,
}
def test_can_get_one_entity_unauthenticated(self):
score_value = an_integer()
score = RelevancyScoreBuilder(self.user).with_value(score_value).create()
url = '/qa/v1/relevancyscores/{0}/'.format(score.pk)
response = self.APIClient.get(url)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['value'], score_value)
def test_can_get_entities_unauthenticated(self):
RelevancyScoreBuilder(self.user).create()
RelevancyScoreBuilder(self.user).create()
url = '/qa/v1/relevancyscores/'
response = self.APIClient.get(url)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(len(response.json()), 2)
def test_cannot_get_non_existent_entity_unauthenticated(self):
url = '/qa/v1/relevancyscores/0/'
response = self.APIClient.get(url)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
class DELETERelevancyScoreTests(TestCase):
def setUp(self):
self.user = self.make_user()
self.token = Token.objects.create(user=self.user)
self.APIClient = APIClient()
self.data = {
'value': an_integer(),
'algorithm': AlgorithmBuilder().create().id,
'search_location': SearchLocationBuilder().create().id,
'service_at_location': ServiceAtLocationBuilder().create().id,
'topic': create_topic(a_string()).id,
}
def test_can_delete(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
score = RelevancyScoreBuilder(self.user).create()
url = '/qa/v1/relevancyscores/{0}/'.format(score.pk)
response = self.APIClient.delete(url)
self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT)
def test_cannot_delete_unauthenticated(self):
score = RelevancyScoreBuilder(self.user).create()
url = '/qa/v1/relevancyscores/{0}/'.format(score.pk)
response = self.APIClient.delete(url)
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
def test_cannot_delete_non_existent_entity(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/0/'
response = self.APIClient.delete(url)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
class PUTRelevancyScoreTests(TestCase):
def setUp(self):
self.user = self.make_user()
self.new_user = self.make_user(username='testuser2')
self.token = Token.objects.create(user=self.user)
self.APIClient = APIClient()
self.sample_score = RelevancyScoreBuilder(self.user).create()
self.data = {
'value': an_integer(),
'algorithm': AlgorithmBuilder().create().id,
'search_location': SearchLocationBuilder().create().id,
'service_at_location': ServiceAtLocationBuilder().create().id,
'topic': create_topic(a_string()).id,
}
def test_can_put_value(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
new_value = an_integer()
self.data['value'] = new_value
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['value'], new_value)
def test_can_put_algorithm(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
new_algorithm = AlgorithmBuilder().create()
self.data['algorithm'] = new_algorithm.id
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['algorithm'], new_algorithm.id)
def test_can_put_search_location(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
new_search_location = SearchLocationBuilder().create()
self.data['search_location'] = new_search_location.id
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['search_location'], new_search_location.id)
def test_can_put_service_at_location(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
new_service_at_location = ServiceAtLocationBuilder().create()
self.data['service_at_location'] = new_service_at_location.id
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['service_at_location'], new_service_at_location.id)
def test_can_put_topic(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
new_topic = create_topic(a_string())
self.data['topic'] = new_topic.id
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['topic'], new_topic.id)
def test_put_response_has_new_time_stamp(self):
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
recreated_time = datetime.datetime.strptime(response.json()['time_stamp'], '%Y-%m-%dT%H:%M:%S.%fZ')
self.assertLessEqual(recreated_time, datetime.datetime.now())
self.assertGreaterEqual(recreated_time + datetime.timedelta(seconds=1), datetime.datetime.now())
def test_can_put_with_different_credential(self):
new_token = Token.objects.create(user=self.new_user)
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + new_token.key)
new_value = an_integer()
self.data['value'] = new_value
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.json()['user'], self.new_user.id)
self.assertEqual(response.json()['value'], new_value)
def test_cannot_put_id(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
new_id = an_integer()
self.data['id'] = new_id
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.json(), 'id of relevancyscore is immutable')
def test_cannot_put_user(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
self.data['user'] = self.new_user.id
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(response.json(), 'user_id of relevancyscore is immutable')
def test_cannot_put_unauthenticated(self):
url = '/qa/v1/relevancyscores/{0}/'.format(self.sample_score.pk)
self.data['value'] = an_integer()
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
def test_cannot_put_non_existent_entity(self):
url = '/qa/v1/relevancyscores/0/'
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
response = self.APIClient.put(url, self.data)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
class POSTRelevancyScoreTests(TestCase):
def setUp(self):
self.user = self.make_user()
self.token = Token.objects.create(user=self.user)
self.APIClient = APIClient()
self.score_value = an_integer()
self.data_without_algorithm_in_body = {
'value': self.score_value,
'search_location': SearchLocationBuilder().create().id,
'service_at_location': ServiceAtLocationBuilder().create().id,
'topic': create_topic('test').id,
}
self.data_with_algorithm_in_body = {
'value': self.score_value,
'algorithm': AlgorithmBuilder().create().id,
'search_location': SearchLocationBuilder().create().id,
'service_at_location': ServiceAtLocationBuilder().create().id,
'topic': create_topic(a_string()).id,
}
def test_can_post_with_algorithm_in_body_not_in_url_short_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, data=self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.json()['value'], self.score_value)
def test_can_post_with_algorithm_in_url_not_in_body_long_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
algorithm = AlgorithmBuilder().create()
url = '/qa/v1/algorithms/{0}/relevancyscores/'.format(algorithm.pk)
response = self.APIClient.post(url, data=self.data_without_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.json()['value'], self.score_value)
def test_post_response_has_correct_algorithm(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.json()['algorithm'], self.data_with_algorithm_in_body['algorithm'])
def test_post_response_has_correct_search_location(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.json()['search_location'], self.data_with_algorithm_in_body['search_location'])
def test_post_response_has_correct_service_at_location(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.json()['service_at_location'],
self.data_with_algorithm_in_body['service_at_location'])
def test_post_response_has_correct_topic(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.json()['topic'], self.data_with_algorithm_in_body['topic'])
def test_post_response_has_correct_user(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.json()['user'], self.user.id)
def test_post_response_has_accurate_time_stamp(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
recreated_time = datetime.datetime.strptime(response.json()['time_stamp'], '%Y-%m-%dT%H:%M:%S.%fZ')
self.assertLessEqual(recreated_time, datetime.datetime.now())
self.assertGreaterEqual(recreated_time + datetime.timedelta(seconds=1), datetime.datetime.now())
def test_cannot_post_unauthenticated(self):
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, data=self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
def test_cannot_post_with_invalid_algorithm_in_url_valid_algorithm_in_body_long_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/algorithms/0/relevancyscores/'
response = self.APIClient.post(url, data=self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_cannot_post_without_algorithm_in_body_or_url_short_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, data=self.data_without_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_cannot_post_with_invalid_algorithm_in_url_missing_algorithm_in_body_long_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
url = '/qa/v1/algorithms/0/relevancyscores/'
response = self.APIClient.post(url, data=self.data_without_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_cannot_post_with_algorithm_in_body_and_url_short_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
algorithm_id = self.data_with_algorithm_in_body['algorithm']
url = '/qa/v1/relevancyscores/{0}/'.format(algorithm_id)
response = self.APIClient.post(url, data=self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
def test_cannot_post_with_algorithm_in_body_and_url_long_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
algorithm_id = self.data_with_algorithm_in_body['algorithm']
url = '/qa/v1/algorithms/{0}/relevancyscores/'.format(algorithm_id)
response = self.APIClient.post(url, data=self.data_with_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
def test_cannot_post_with_algorithm_in_url_not_in_body_short_url(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
algorithm_id = AlgorithmBuilder().create().id
url = '/qa/v1/relevancyscores/{0}/'.format(algorithm_id)
response = self.APIClient.post(url, data=self.data_without_algorithm_in_body)
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
def test_cannot_post_when_missing_fields(self):
self.APIClient.credentials(HTTP_AUTHORIZATION='Token ' + self.token.key)
bad_data = {
'value': an_integer(),
'algorithm': AlgorithmBuilder().create().id,
# 'search_location': missing search_location
'service_at_location': ServiceAtLocationBuilder().create().id,
'topic': create_topic(a_string()).id,
}
url = '/qa/v1/relevancyscores/'
response = self.APIClient.post(url, bad_data)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
| [
1,
1053,
12865,
13,
3166,
1243,
29918,
11242,
29889,
1688,
1053,
4321,
8259,
13,
3166,
3855,
29874,
29918,
10154,
29889,
21150,
29889,
3952,
6774,
1053,
830,
2608,
6906,
20097,
5627,
29892,
29068,
5627,
29892,
11856,
6508,
5627,
13,
3166,
1791,
29918,
4468,
1053,
4660,
13,
3166,
1791,
29918,
4468,
29889,
1300,
400,
4476,
29889,
9794,
1053,
25159,
13,
3166,
1791,
29918,
4468,
29889,
1688,
1053,
3450,
4032,
13,
3166,
5199,
29918,
9916,
29889,
9916,
29918,
271,
29918,
5479,
29889,
21150,
29889,
3952,
6774,
1053,
6692,
4178,
6508,
5627,
13,
3166,
716,
510,
414,
29918,
13075,
29889,
21150,
29889,
3952,
6774,
1053,
1653,
29918,
13010,
13,
3166,
3619,
29889,
1688,
3952,
6774,
29889,
8172,
29918,
1688,
29918,
5975,
1053,
385,
29918,
16031,
29892,
263,
29918,
1807,
13,
13,
13,
1990,
12354,
1123,
2608,
6906,
20097,
24376,
29898,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1792,
353,
1583,
29889,
5675,
29918,
1792,
580,
13,
4706,
1583,
29889,
6979,
353,
25159,
29889,
12650,
29889,
3258,
29898,
1792,
29922,
1311,
29889,
1792,
29897,
13,
4706,
1583,
29889,
8787,
4032,
353,
3450,
4032,
580,
13,
4706,
1583,
29889,
1272,
353,
426,
13,
9651,
525,
1767,
2396,
385,
29918,
16031,
3285,
13,
9651,
525,
20567,
2396,
29068,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
4478,
29918,
5479,
2396,
11856,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
5509,
29918,
271,
29918,
5479,
2396,
6692,
4178,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
13010,
2396,
1653,
29918,
13010,
29898,
29874,
29918,
1807,
16655,
333,
29892,
13,
4706,
500,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
657,
29918,
650,
29918,
10041,
29918,
348,
27218,
630,
29898,
1311,
1125,
13,
4706,
8158,
29918,
1767,
353,
385,
29918,
16031,
580,
13,
4706,
8158,
353,
830,
2608,
6906,
20097,
5627,
29898,
1311,
29889,
1792,
467,
2541,
29918,
1767,
29898,
13628,
29918,
1767,
467,
3258,
580,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
1767,
7464,
8158,
29918,
1767,
29897,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
657,
29918,
296,
1907,
29918,
348,
27218,
630,
29898,
1311,
1125,
13,
4706,
830,
2608,
6906,
20097,
5627,
29898,
1311,
29889,
1792,
467,
3258,
580,
13,
4706,
830,
2608,
6906,
20097,
5627,
29898,
1311,
29889,
1792,
467,
3258,
580,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
5327,
29889,
3126,
25739,
29871,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
657,
29918,
5464,
29918,
735,
9696,
29918,
10041,
29918,
348,
27218,
630,
29898,
1311,
1125,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
29914,
29900,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29946,
29918,
12256,
29918,
5800,
18783,
29897,
13,
13,
13,
1990,
5012,
1307,
4945,
29872,
2608,
6906,
20097,
24376,
29898,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1792,
353,
1583,
29889,
5675,
29918,
1792,
580,
13,
4706,
1583,
29889,
6979,
353,
25159,
29889,
12650,
29889,
3258,
29898,
1792,
29922,
1311,
29889,
1792,
29897,
13,
4706,
1583,
29889,
8787,
4032,
353,
3450,
4032,
580,
13,
4706,
1583,
29889,
1272,
353,
426,
13,
9651,
525,
1767,
2396,
385,
29918,
16031,
3285,
13,
9651,
525,
20567,
2396,
29068,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
4478,
29918,
5479,
2396,
11856,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
5509,
29918,
271,
29918,
5479,
2396,
6692,
4178,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
13010,
2396,
1653,
29918,
13010,
29898,
29874,
29918,
1807,
16655,
333,
29892,
13,
4706,
500,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
8143,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
8158,
353,
830,
2608,
6906,
20097,
5627,
29898,
1311,
29889,
1792,
467,
3258,
580,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
8143,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29946,
29918,
6632,
29918,
22412,
3919,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
8143,
29918,
348,
27218,
630,
29898,
1311,
1125,
13,
4706,
8158,
353,
830,
2608,
6906,
20097,
5627,
29898,
1311,
29889,
1792,
467,
3258,
580,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
8143,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29896,
29918,
29965,
3521,
2692,
29950,
1955,
26664,
3352,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
8143,
29918,
5464,
29918,
735,
9696,
29918,
10041,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
29914,
29900,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
8143,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29946,
29918,
12256,
29918,
5800,
18783,
29897,
13,
13,
13,
1990,
349,
2692,
1123,
2608,
6906,
20097,
24376,
29898,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1792,
353,
1583,
29889,
5675,
29918,
1792,
580,
13,
4706,
1583,
29889,
1482,
29918,
1792,
353,
1583,
29889,
5675,
29918,
1792,
29898,
6786,
2433,
1688,
1792,
29906,
1495,
13,
4706,
1583,
29889,
6979,
353,
25159,
29889,
12650,
29889,
3258,
29898,
1792,
29922,
1311,
29889,
1792,
29897,
13,
4706,
1583,
29889,
8787,
4032,
353,
3450,
4032,
580,
13,
4706,
1583,
29889,
11249,
29918,
13628,
353,
830,
2608,
6906,
20097,
5627,
29898,
1311,
29889,
1792,
467,
3258,
580,
13,
4706,
1583,
29889,
1272,
353,
426,
13,
9651,
525,
1767,
2396,
385,
29918,
16031,
3285,
13,
9651,
525,
20567,
2396,
29068,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
4478,
29918,
5479,
2396,
11856,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
5509,
29918,
271,
29918,
5479,
2396,
6692,
4178,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
13010,
2396,
1653,
29918,
13010,
29898,
29874,
29918,
1807,
16655,
333,
29892,
13,
4706,
500,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
649,
29918,
1767,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
716,
29918,
1767,
353,
385,
29918,
16031,
580,
13,
4706,
1583,
29889,
1272,
1839,
1767,
2033,
353,
716,
29918,
1767,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
1767,
7464,
716,
29918,
1767,
29897,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
649,
29918,
20567,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
716,
29918,
20567,
353,
29068,
5627,
2141,
3258,
580,
13,
4706,
1583,
29889,
1272,
1839,
20567,
2033,
353,
716,
29918,
20567,
29889,
333,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
20567,
7464,
716,
29918,
20567,
29889,
333,
29897,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
649,
29918,
4478,
29918,
5479,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
716,
29918,
4478,
29918,
5479,
353,
11856,
6508,
5627,
2141,
3258,
580,
13,
4706,
1583,
29889,
1272,
1839,
4478,
29918,
5479,
2033,
353,
716,
29918,
4478,
29918,
5479,
29889,
333,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
4478,
29918,
5479,
7464,
716,
29918,
4478,
29918,
5479,
29889,
333,
29897,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
649,
29918,
5509,
29918,
271,
29918,
5479,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
716,
29918,
5509,
29918,
271,
29918,
5479,
353,
6692,
4178,
6508,
5627,
2141,
3258,
580,
13,
4706,
1583,
29889,
1272,
1839,
5509,
29918,
271,
29918,
5479,
2033,
353,
716,
29918,
5509,
29918,
271,
29918,
5479,
29889,
333,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
5509,
29918,
271,
29918,
5479,
7464,
716,
29918,
5509,
29918,
271,
29918,
5479,
29889,
333,
29897,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
649,
29918,
13010,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
716,
29918,
13010,
353,
1653,
29918,
13010,
29898,
29874,
29918,
1807,
3101,
13,
4706,
1583,
29889,
1272,
1839,
13010,
2033,
353,
716,
29918,
13010,
29889,
333,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
13010,
7464,
716,
29918,
13010,
29889,
333,
29897,
13,
13,
1678,
822,
1243,
29918,
649,
29918,
5327,
29918,
5349,
29918,
1482,
29918,
2230,
29918,
303,
1160,
29898,
1311,
1125,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
337,
11600,
29918,
2230,
353,
12865,
29889,
12673,
29889,
710,
415,
603,
29898,
5327,
29889,
3126,
580,
1839,
2230,
29918,
303,
1160,
7464,
14210,
29979,
19222,
29885,
19222,
29881,
29911,
29995,
29950,
16664,
29924,
16664,
29903,
29889,
29995,
29888,
29999,
1495,
13,
4706,
1583,
29889,
9294,
29931,
404,
9843,
29898,
276,
11600,
29918,
2230,
29892,
12865,
29889,
12673,
29889,
3707,
3101,
13,
4706,
1583,
29889,
9294,
25120,
1008,
9843,
29898,
276,
11600,
29918,
2230,
718,
12865,
29889,
9346,
287,
2554,
29898,
23128,
29922,
29896,
511,
12865,
29889,
12673,
29889,
3707,
3101,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
649,
29918,
2541,
29918,
29881,
15622,
29918,
11944,
2556,
29898,
1311,
1125,
13,
4706,
716,
29918,
6979,
353,
25159,
29889,
12650,
29889,
3258,
29898,
1792,
29922,
1311,
29889,
1482,
29918,
1792,
29897,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
716,
29918,
6979,
29889,
1989,
29897,
13,
4706,
716,
29918,
1767,
353,
385,
29918,
16031,
580,
13,
4706,
1583,
29889,
1272,
1839,
1767,
2033,
353,
716,
29918,
1767,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29900,
29918,
8949,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
1792,
7464,
1583,
29889,
1482,
29918,
1792,
29889,
333,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
1767,
7464,
716,
29918,
1767,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
649,
29918,
333,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
716,
29918,
333,
353,
385,
29918,
16031,
580,
13,
4706,
1583,
29889,
1272,
1839,
333,
2033,
353,
716,
29918,
333,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29900,
29918,
29933,
3035,
29918,
16244,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
3285,
525,
333,
310,
29527,
4564,
952,
3221,
338,
5198,
9246,
1495,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
649,
29918,
1792,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
1583,
29889,
1272,
1839,
1792,
2033,
353,
1583,
29889,
1482,
29918,
1792,
29889,
333,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29900,
29918,
29933,
3035,
29918,
16244,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
3285,
525,
1792,
29918,
333,
310,
29527,
4564,
952,
3221,
338,
5198,
9246,
1495,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
649,
29918,
348,
27218,
630,
29898,
1311,
1125,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
1311,
29889,
11249,
29918,
13628,
29889,
20571,
29897,
13,
4706,
1583,
29889,
1272,
1839,
1767,
2033,
353,
385,
29918,
16031,
580,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29896,
29918,
29965,
3521,
2692,
29950,
1955,
26664,
3352,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
649,
29918,
5464,
29918,
735,
9696,
29918,
10041,
29898,
1311,
1125,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
29914,
29900,
22208,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
649,
29898,
2271,
29892,
1583,
29889,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29946,
29918,
12256,
29918,
5800,
18783,
29897,
13,
13,
13,
1990,
11971,
1123,
2608,
6906,
20097,
24376,
29898,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1792,
353,
1583,
29889,
5675,
29918,
1792,
580,
13,
4706,
1583,
29889,
6979,
353,
25159,
29889,
12650,
29889,
3258,
29898,
1792,
29922,
1311,
29889,
1792,
29897,
13,
4706,
1583,
29889,
8787,
4032,
353,
3450,
4032,
580,
13,
4706,
1583,
29889,
13628,
29918,
1767,
353,
385,
29918,
16031,
580,
13,
4706,
1583,
29889,
1272,
29918,
14037,
29918,
20567,
29918,
262,
29918,
2587,
353,
426,
13,
9651,
525,
1767,
2396,
1583,
29889,
13628,
29918,
1767,
29892,
13,
9651,
525,
4478,
29918,
5479,
2396,
11856,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
5509,
29918,
271,
29918,
5479,
2396,
6692,
4178,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
13010,
2396,
1653,
29918,
13010,
877,
1688,
2824,
333,
29892,
13,
4706,
500,
13,
4706,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
353,
426,
13,
9651,
525,
1767,
2396,
1583,
29889,
13628,
29918,
1767,
29892,
13,
9651,
525,
20567,
2396,
29068,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
4478,
29918,
5479,
2396,
11856,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
5509,
29918,
271,
29918,
5479,
2396,
6692,
4178,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
13010,
2396,
1653,
29918,
13010,
29898,
29874,
29918,
1807,
16655,
333,
29892,
13,
4706,
500,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
2490,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29918,
1333,
29918,
262,
29918,
2271,
29918,
12759,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
1767,
7464,
1583,
29889,
13628,
29918,
1767,
29897,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
2490,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2271,
29918,
1333,
29918,
262,
29918,
2587,
29918,
5426,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
5687,
353,
29068,
5627,
2141,
3258,
580,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
9564,
12404,
19248,
29900,
6822,
276,
2608,
4564,
952,
29883,
2361,
29914,
4286,
4830,
29898,
20567,
29889,
20571,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
14037,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
1767,
7464,
1583,
29889,
13628,
29918,
1767,
29897,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
5327,
29918,
5349,
29918,
15728,
29918,
20567,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
20567,
7464,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
1839,
20567,
11287,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
5327,
29918,
5349,
29918,
15728,
29918,
4478,
29918,
5479,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
4478,
29918,
5479,
7464,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
1839,
4478,
29918,
5479,
11287,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
5327,
29918,
5349,
29918,
15728,
29918,
5509,
29918,
271,
29918,
5479,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
5509,
29918,
271,
29918,
5479,
7464,
13,
462,
308,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
1839,
5509,
29918,
271,
29918,
5479,
11287,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
5327,
29918,
5349,
29918,
15728,
29918,
13010,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
13010,
7464,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
1839,
13010,
11287,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
5327,
29918,
5349,
29918,
15728,
29918,
1792,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
3126,
580,
1839,
1792,
7464,
1583,
29889,
1792,
29889,
333,
29897,
13,
13,
1678,
822,
1243,
29918,
2490,
29918,
5327,
29918,
5349,
29918,
562,
2764,
403,
29918,
2230,
29918,
303,
1160,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29906,
29900,
29896,
29918,
27045,
29928,
29897,
13,
4706,
337,
11600,
29918,
2230,
353,
12865,
29889,
12673,
29889,
710,
415,
603,
29898,
5327,
29889,
3126,
580,
1839,
2230,
29918,
303,
1160,
7464,
14210,
29979,
19222,
29885,
19222,
29881,
29911,
29995,
29950,
16664,
29924,
16664,
29903,
29889,
29995,
29888,
29999,
1495,
13,
4706,
1583,
29889,
9294,
29931,
404,
9843,
29898,
276,
11600,
29918,
2230,
29892,
12865,
29889,
12673,
29889,
3707,
3101,
13,
4706,
1583,
29889,
9294,
25120,
1008,
9843,
29898,
276,
11600,
29918,
2230,
718,
12865,
29889,
9346,
287,
2554,
29898,
23128,
29922,
29896,
511,
12865,
29889,
12673,
29889,
3707,
3101,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
348,
27218,
630,
29898,
1311,
1125,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29896,
29918,
29965,
3521,
2692,
29950,
1955,
26664,
3352,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
2541,
29918,
20965,
29918,
20567,
29918,
262,
29918,
2271,
29918,
3084,
29918,
20567,
29918,
262,
29918,
2587,
29918,
5426,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
9564,
12404,
29914,
29900,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29900,
29918,
29933,
3035,
29918,
16244,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
14037,
29918,
20567,
29918,
262,
29918,
2587,
29918,
272,
29918,
2271,
29918,
12759,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
14037,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29900,
29918,
29933,
3035,
29918,
16244,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
2541,
29918,
20965,
29918,
20567,
29918,
262,
29918,
2271,
29918,
27259,
29918,
20567,
29918,
262,
29918,
2587,
29918,
5426,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
9564,
12404,
29914,
29900,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
14037,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29900,
29918,
29933,
3035,
29918,
16244,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29918,
392,
29918,
2271,
29918,
12759,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
5687,
29918,
333,
353,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
1839,
20567,
2033,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
20567,
29918,
333,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29945,
29918,
2303,
4690,
13668,
29918,
12256,
29918,
1964,
27998,
3352,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29918,
392,
29918,
2271,
29918,
5426,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
5687,
29918,
333,
353,
1583,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
1839,
20567,
2033,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
9564,
12404,
19248,
29900,
6822,
276,
2608,
4564,
952,
29883,
2361,
29914,
4286,
4830,
29898,
20567,
29918,
333,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29900,
29918,
29933,
3035,
29918,
16244,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
2541,
29918,
20567,
29918,
262,
29918,
2271,
29918,
1333,
29918,
262,
29918,
2587,
29918,
12759,
29918,
2271,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
5687,
29918,
333,
353,
29068,
5627,
2141,
3258,
2141,
333,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
19248,
29900,
6822,
4286,
4830,
29898,
20567,
29918,
333,
29897,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
848,
29922,
1311,
29889,
1272,
29918,
14037,
29918,
20567,
29918,
262,
29918,
2587,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29945,
29918,
2303,
4690,
13668,
29918,
12256,
29918,
1964,
27998,
3352,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
6735,
29918,
2490,
29918,
8256,
29918,
27259,
29918,
9621,
29898,
1311,
1125,
13,
4706,
1583,
29889,
8787,
4032,
29889,
11944,
9409,
29898,
10493,
29918,
20656,
29950,
1955,
26664,
8098,
2433,
6066,
525,
718,
1583,
29889,
6979,
29889,
1989,
29897,
13,
4706,
4319,
29918,
1272,
353,
426,
13,
9651,
525,
1767,
2396,
385,
29918,
16031,
3285,
13,
9651,
525,
20567,
2396,
29068,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
396,
525,
4478,
29918,
5479,
2396,
4567,
2740,
29918,
5479,
13,
9651,
525,
5509,
29918,
271,
29918,
5479,
2396,
6692,
4178,
6508,
5627,
2141,
3258,
2141,
333,
29892,
13,
9651,
525,
13010,
2396,
1653,
29918,
13010,
29898,
29874,
29918,
1807,
16655,
333,
29892,
13,
4706,
500,
13,
4706,
3142,
353,
8207,
25621,
29914,
29894,
29896,
29914,
276,
2608,
4564,
952,
29883,
2361,
22208,
13,
4706,
2933,
353,
1583,
29889,
8787,
4032,
29889,
2490,
29898,
2271,
29892,
4319,
29918,
1272,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5327,
29889,
4882,
29918,
401,
29892,
4660,
29889,
10493,
29918,
29946,
29900,
29900,
29918,
29933,
3035,
29918,
16244,
29897,
13,
2
] |
days/month/day5_20.py | sanjaylokula/100dayspython | 0 | 70636 | # Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def removeElements(self, head: ListNode, val: int) -> ListNode:
dummy = ListNode(-1)
dummy.next = head
def t(d):
if d.next:
if d.next.val == val:
d.next = d.next.next
t(d)
else:
t(d.next)
t(dummy)
return dummy.next
if __name__=="__main__":
output=Solution().removeElements([1,2,6,3,4,5,6],6)
print(output) | [
1,
396,
21940,
363,
1809,
368,
29899,
2324,
287,
1051,
29889,
13,
1990,
2391,
4247,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
659,
29922,
29900,
29892,
2446,
29922,
8516,
1125,
13,
4706,
1583,
29889,
791,
353,
659,
13,
4706,
1583,
29889,
4622,
353,
2446,
13,
1990,
24380,
29901,
13,
1678,
822,
3349,
18868,
29898,
1311,
29892,
2343,
29901,
2391,
4247,
29892,
659,
29901,
938,
29897,
1599,
2391,
4247,
29901,
13,
4706,
20254,
353,
2391,
4247,
6278,
29896,
29897,
13,
4706,
20254,
29889,
4622,
353,
2343,
13,
13,
4706,
822,
260,
29898,
29881,
1125,
13,
9651,
565,
270,
29889,
4622,
29901,
13,
18884,
565,
270,
29889,
4622,
29889,
791,
1275,
659,
29901,
13,
462,
1678,
270,
29889,
4622,
353,
270,
29889,
4622,
29889,
4622,
13,
462,
1678,
260,
29898,
29881,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
260,
29898,
29881,
29889,
4622,
29897,
13,
13,
4706,
260,
29898,
29881,
11770,
29897,
13,
4706,
736,
20254,
29889,
4622,
13,
13,
13,
361,
4770,
978,
1649,
26359,
1649,
3396,
1649,
1115,
13,
1678,
1962,
29922,
13296,
918,
2141,
5992,
18868,
4197,
29896,
29892,
29906,
29892,
29953,
29892,
29941,
29892,
29946,
29892,
29945,
29892,
29953,
1402,
29953,
29897,
13,
1678,
1596,
29898,
4905,
29897,
2
] |
adafruit_rsa/common.py | sommersoft/Adafruit_CircuitPython_RSA | 0 | 1608976 | # -*- coding: utf-8 -*-
#
# Copyright 2011 <NAME> <<EMAIL>>
#
# 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
#
# https://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.
"""Common functionality shared by several modules."""
# pylint: disable=invalid-name
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_RSA.git"
def bit_length(int_type):
"""Return the number of bits necessary to represent an integer in binary,
excluding the sign and leading zeros"""
length = 0
while int_type:
int_type >>= 1
length += 1
return length
class NotRelativePrimeError(ValueError):
"""Raises if provided a and b not relatively prime."""
def __init__(self, a, b, d, msg=None):
super(NotRelativePrimeError, self).__init__(
msg or "%d and %d are not relatively prime, divider=%i" % (a, b, d)
)
self.a = a
self.b = b
self.d = d
def bit_size(num):
"""
Number of bits needed to represent a integer excluding any prefix
0 bits.
Usage::
>>> bit_size(1023)
10
>>> bit_size(1024)
11
>>> bit_size(1025)
11
:param num:
Integer value. If num is 0, returns 0. Only the absolute value of the
number is considered. Therefore, signed integers will be abs(num)
before the number's bit length is determined.
:returns:
Returns the number of bits in the integer.
"""
try:
return bit_length(num)
except AttributeError:
raise TypeError("bit_size(num) only supports integers, not %r" % type(num))
def byte_size(number):
"""
Returns the number of bytes required to hold a specific long number.
The number of bytes is rounded up.
Usage::
>>> byte_size(1 << 1023)
128
>>> byte_size((1 << 1024) - 1)
128
>>> byte_size(1 << 1024)
129
:param number:
An unsigned integer
:returns:
The number of bytes required to hold a specific long number.
"""
if number == 0:
return 1
return ceil_div(bit_size(number), 8)
def ceil_div(num, div):
"""
Returns the ceiling function of a division between `num` and `div`.
Usage::
>>> ceil_div(100, 7)
15
>>> ceil_div(100, 10)
10
>>> ceil_div(1, 4)
1
:param num: Division's numerator, a number
:param div: Division's divisor, a number
:return: Rounded up result of the division between the parameters.
"""
quanta, mod = divmod(num, div)
if mod:
quanta += 1
return quanta
def extended_gcd(a, b):
"""Returns a tuple (r, i, j) such that r = gcd(a, b) = ia + jb
"""
# r = gcd(a,b) i = multiplicitive inverse of a mod b
# or j = multiplicitive inverse of b mod a
# Neg return values for i or j are made positive mod b or a respectively
# Iterateive Version is faster and uses much less stack space
x = 0
y = 1
lx = 1
ly = 0
oa = a # Remember original a/b to remove
ob = b # negative values from return results
while b != 0:
q = a // b
(a, b) = (b, a % b)
(x, lx) = ((lx - (q * x)), x)
(y, ly) = ((ly - (q * y)), y)
if lx < 0:
lx += ob # If neg wrap modulo orignal b
if ly < 0:
ly += oa # If neg wrap modulo orignal a
return a, lx, ly # Return only positive values
def inverse(x, n):
"""Returns the inverse of x % n under multiplication, a.k.a x^-1 (mod n)
>>> inverse(7, 4)
3
>>> (inverse(143, 4) * 143) % 4
1
"""
(divider, inv, _) = extended_gcd(x, n)
if divider != 1:
raise NotRelativePrimeError(x, n, divider)
return inv
def crt(a_values, modulo_values):
"""Chinese Remainder Theorem.
Calculates x such that x = a[i] (mod m[i]) for each i.
:param a_values: the a-values of the above equation
:param modulo_values: the m-values of the above equation
:returns: x such that x = a[i] (mod m[i]) for each i
>>> crt([2, 3], [3, 5])
8
>>> crt([2, 3, 2], [3, 5, 7])
23
>>> crt([2, 3, 0], [7, 11, 15])
135
"""
m = 1
x = 0
for modulo in modulo_values:
m *= modulo
for (m_i, a_i) in zip(modulo_values, a_values):
M_i = m // m_i
inv = inverse(M_i, m_i)
x = (x + a_i * M_i * inv) % m
return x
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
13,
29937,
29871,
14187,
1266,
29871,
29906,
29900,
29896,
29896,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
29937,
13,
29937,
29871,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
29871,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
29871,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
2045,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
29871,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
29871,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
29871,
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,
29871,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
29871,
27028,
1090,
278,
19245,
29889,
13,
15945,
29908,
18877,
9863,
7258,
491,
3196,
10585,
1213,
15945,
13,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
13,
1649,
3259,
1649,
353,
376,
29900,
29889,
29900,
29889,
29900,
29899,
6921,
29889,
29900,
29908,
13,
1649,
20095,
1649,
353,
376,
991,
597,
3292,
29889,
510,
29914,
1114,
29888,
9216,
29914,
29909,
1388,
29888,
9216,
29918,
23495,
3121,
11980,
29918,
29934,
8132,
29889,
5559,
29908,
13,
13,
13,
1753,
2586,
29918,
2848,
29898,
524,
29918,
1853,
1125,
13,
1678,
9995,
11609,
278,
1353,
310,
9978,
5181,
304,
2755,
385,
6043,
297,
7581,
29892,
13,
1678,
429,
22368,
278,
1804,
322,
8236,
24786,
15945,
29908,
13,
1678,
3309,
353,
29871,
29900,
13,
1678,
1550,
938,
29918,
1853,
29901,
13,
4706,
938,
29918,
1853,
5099,
29922,
29871,
29896,
13,
4706,
3309,
4619,
29871,
29896,
13,
1678,
736,
3309,
13,
13,
13,
1990,
2216,
18278,
4040,
603,
2392,
29898,
1917,
2392,
1125,
13,
1678,
9995,
29934,
1759,
267,
565,
4944,
263,
322,
289,
451,
13774,
6019,
1213,
15945,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
263,
29892,
289,
29892,
270,
29892,
10191,
29922,
8516,
1125,
13,
4706,
2428,
29898,
3664,
18278,
4040,
603,
2392,
29892,
1583,
467,
1649,
2344,
12035,
13,
9651,
10191,
470,
11860,
29881,
322,
1273,
29881,
526,
451,
13774,
6019,
29892,
1933,
1241,
16328,
29875,
29908,
1273,
313,
29874,
29892,
289,
29892,
270,
29897,
13,
4706,
1723,
13,
4706,
1583,
29889,
29874,
353,
263,
13,
4706,
1583,
29889,
29890,
353,
289,
13,
4706,
1583,
29889,
29881,
353,
270,
13,
13,
13,
1753,
2586,
29918,
2311,
29898,
1949,
1125,
13,
1678,
9995,
13,
1678,
9681,
310,
9978,
4312,
304,
2755,
263,
6043,
429,
22368,
738,
10944,
13,
268,
29900,
9978,
29889,
13,
13,
1678,
10783,
482,
1057,
13,
13,
4706,
8653,
2586,
29918,
2311,
29898,
29896,
29900,
29906,
29941,
29897,
13,
308,
29896,
29900,
13,
4706,
8653,
2586,
29918,
2311,
29898,
29896,
29900,
29906,
29946,
29897,
13,
308,
29896,
29896,
13,
4706,
8653,
2586,
29918,
2311,
29898,
29896,
29900,
29906,
29945,
29897,
13,
308,
29896,
29896,
13,
13,
1678,
584,
3207,
954,
29901,
13,
4706,
8102,
995,
29889,
960,
954,
338,
29871,
29900,
29892,
3639,
29871,
29900,
29889,
9333,
278,
8380,
995,
310,
278,
13,
4706,
1353,
338,
5545,
29889,
7857,
29892,
8794,
11920,
674,
367,
6425,
29898,
1949,
29897,
13,
4706,
1434,
278,
1353,
29915,
29879,
2586,
3309,
338,
10087,
29889,
13,
1678,
584,
18280,
29901,
13,
4706,
16969,
278,
1353,
310,
9978,
297,
278,
6043,
29889,
13,
1678,
9995,
13,
13,
1678,
1018,
29901,
13,
4706,
736,
2586,
29918,
2848,
29898,
1949,
29897,
13,
1678,
5174,
23833,
2392,
29901,
13,
4706,
12020,
20948,
703,
2966,
29918,
2311,
29898,
1949,
29897,
871,
11286,
11920,
29892,
451,
1273,
29878,
29908,
1273,
1134,
29898,
1949,
876,
13,
13,
13,
1753,
7023,
29918,
2311,
29898,
4537,
1125,
13,
1678,
9995,
13,
1678,
16969,
278,
1353,
310,
6262,
3734,
304,
4808,
263,
2702,
1472,
1353,
29889,
13,
13,
1678,
450,
1353,
310,
6262,
338,
28240,
701,
29889,
13,
13,
1678,
10783,
482,
1057,
13,
13,
4706,
8653,
7023,
29918,
2311,
29898,
29896,
3532,
29871,
29896,
29900,
29906,
29941,
29897,
13,
308,
29896,
29906,
29947,
13,
4706,
8653,
7023,
29918,
2311,
3552,
29896,
3532,
29871,
29896,
29900,
29906,
29946,
29897,
448,
29871,
29896,
29897,
13,
308,
29896,
29906,
29947,
13,
4706,
8653,
7023,
29918,
2311,
29898,
29896,
3532,
29871,
29896,
29900,
29906,
29946,
29897,
13,
308,
29896,
29906,
29929,
13,
13,
1678,
584,
3207,
1353,
29901,
13,
4706,
530,
12780,
6043,
13,
1678,
584,
18280,
29901,
13,
4706,
450,
1353,
310,
6262,
3734,
304,
4808,
263,
2702,
1472,
1353,
29889,
13,
1678,
9995,
13,
1678,
565,
1353,
1275,
29871,
29900,
29901,
13,
4706,
736,
29871,
29896,
13,
1678,
736,
2257,
309,
29918,
4563,
29898,
2966,
29918,
2311,
29898,
4537,
511,
29871,
29947,
29897,
13,
13,
13,
1753,
2257,
309,
29918,
4563,
29898,
1949,
29892,
1933,
1125,
13,
1678,
9995,
13,
1678,
16969,
278,
2257,
6504,
740,
310,
263,
8542,
1546,
421,
1949,
29952,
322,
421,
4563,
1412,
13,
13,
1678,
10783,
482,
1057,
13,
13,
4706,
8653,
2257,
309,
29918,
4563,
29898,
29896,
29900,
29900,
29892,
29871,
29955,
29897,
13,
308,
29896,
29945,
13,
4706,
8653,
2257,
309,
29918,
4563,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29897,
13,
308,
29896,
29900,
13,
4706,
8653,
2257,
309,
29918,
4563,
29898,
29896,
29892,
29871,
29946,
29897,
13,
308,
29896,
13,
13,
1678,
584,
3207,
954,
29901,
7946,
29915,
29879,
4825,
1061,
29892,
263,
1353,
13,
1678,
584,
3207,
1933,
29901,
7946,
29915,
29879,
8572,
272,
29892,
263,
1353,
13,
13,
1678,
584,
2457,
29901,
390,
7261,
701,
1121,
310,
278,
8542,
1546,
278,
4128,
29889,
13,
1678,
9995,
13,
1678,
4323,
29874,
29892,
878,
353,
1933,
1545,
29898,
1949,
29892,
1933,
29897,
13,
1678,
565,
878,
29901,
13,
4706,
4323,
29874,
4619,
29871,
29896,
13,
1678,
736,
4323,
29874,
13,
13,
13,
1753,
10410,
29918,
29887,
2252,
29898,
29874,
29892,
289,
1125,
13,
1678,
9995,
11609,
29879,
263,
18761,
313,
29878,
29892,
474,
29892,
432,
29897,
1316,
393,
364,
353,
330,
2252,
29898,
29874,
29892,
289,
29897,
353,
29871,
423,
718,
432,
29890,
13,
1678,
9995,
13,
1678,
396,
364,
353,
330,
2252,
29898,
29874,
29892,
29890,
29897,
474,
353,
6674,
506,
3321,
16402,
310,
263,
878,
289,
13,
1678,
396,
418,
470,
418,
432,
353,
6674,
506,
3321,
16402,
310,
289,
878,
263,
13,
1678,
396,
12610,
736,
1819,
363,
474,
470,
432,
526,
1754,
6374,
878,
289,
470,
263,
8307,
13,
1678,
396,
20504,
403,
573,
10079,
338,
8473,
322,
3913,
1568,
3109,
5096,
2913,
13,
1678,
921,
353,
29871,
29900,
13,
1678,
343,
353,
29871,
29896,
13,
1678,
301,
29916,
353,
29871,
29896,
13,
1678,
21261,
353,
29871,
29900,
13,
1678,
288,
29874,
353,
263,
29871,
396,
22738,
2441,
263,
29914,
29890,
304,
3349,
13,
1678,
704,
353,
289,
29871,
396,
8178,
1819,
515,
736,
2582,
13,
1678,
1550,
289,
2804,
29871,
29900,
29901,
13,
4706,
3855,
353,
263,
849,
289,
13,
4706,
313,
29874,
29892,
289,
29897,
353,
313,
29890,
29892,
263,
1273,
289,
29897,
13,
4706,
313,
29916,
29892,
301,
29916,
29897,
353,
5135,
29880,
29916,
448,
313,
29939,
334,
921,
8243,
921,
29897,
13,
4706,
313,
29891,
29892,
21261,
29897,
353,
5135,
368,
448,
313,
29939,
334,
343,
8243,
343,
29897,
13,
1678,
565,
301,
29916,
529,
29871,
29900,
29901,
13,
4706,
301,
29916,
4619,
704,
29871,
396,
960,
3480,
12244,
878,
7207,
470,
647,
284,
289,
13,
1678,
565,
21261,
529,
29871,
29900,
29901,
13,
4706,
21261,
4619,
288,
29874,
29871,
396,
960,
3480,
12244,
878,
7207,
470,
647,
284,
263,
13,
1678,
736,
263,
29892,
301,
29916,
29892,
21261,
29871,
396,
7106,
871,
6374,
1819,
13,
13,
13,
1753,
16402,
29898,
29916,
29892,
302,
1125,
13,
1678,
9995,
11609,
29879,
278,
16402,
310,
921,
1273,
302,
1090,
21666,
29892,
263,
29889,
29895,
29889,
29874,
921,
21583,
29896,
313,
1545,
302,
29897,
13,
13,
1678,
8653,
16402,
29898,
29955,
29892,
29871,
29946,
29897,
13,
268,
29941,
13,
1678,
8653,
313,
262,
3901,
29898,
29896,
29946,
29941,
29892,
29871,
29946,
29897,
334,
29871,
29896,
29946,
29941,
29897,
1273,
29871,
29946,
13,
268,
29896,
13,
1678,
9995,
13,
13,
1678,
313,
4563,
1241,
29892,
2437,
29892,
24459,
353,
10410,
29918,
29887,
2252,
29898,
29916,
29892,
302,
29897,
13,
13,
1678,
565,
1933,
1241,
2804,
29871,
29896,
29901,
13,
4706,
12020,
2216,
18278,
4040,
603,
2392,
29898,
29916,
29892,
302,
29892,
1933,
1241,
29897,
13,
13,
1678,
736,
2437,
13,
13,
13,
1753,
2181,
29873,
29898,
29874,
29918,
5975,
29892,
878,
7207,
29918,
5975,
1125,
13,
1678,
9995,
1451,
8233,
5240,
475,
672,
10244,
29889,
13,
13,
1678,
20535,
1078,
921,
1316,
393,
921,
353,
263,
29961,
29875,
29962,
313,
1545,
286,
29961,
29875,
2314,
363,
1269,
474,
29889,
13,
13,
1678,
584,
3207,
263,
29918,
5975,
29901,
278,
263,
29899,
5975,
310,
278,
2038,
6306,
13,
1678,
584,
3207,
878,
7207,
29918,
5975,
29901,
278,
286,
29899,
5975,
310,
278,
2038,
6306,
13,
1678,
584,
18280,
29901,
921,
1316,
393,
921,
353,
263,
29961,
29875,
29962,
313,
1545,
286,
29961,
29875,
2314,
363,
1269,
474,
13,
13,
13,
1678,
8653,
2181,
29873,
4197,
29906,
29892,
29871,
29941,
1402,
518,
29941,
29892,
29871,
29945,
2314,
13,
268,
29947,
13,
13,
1678,
8653,
2181,
29873,
4197,
29906,
29892,
29871,
29941,
29892,
29871,
29906,
1402,
518,
29941,
29892,
29871,
29945,
29892,
29871,
29955,
2314,
13,
268,
29906,
29941,
13,
13,
1678,
8653,
2181,
29873,
4197,
29906,
29892,
29871,
29941,
29892,
29871,
29900,
1402,
518,
29955,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29945,
2314,
13,
268,
29896,
29941,
29945,
13,
1678,
9995,
13,
13,
1678,
286,
353,
29871,
29896,
13,
1678,
921,
353,
29871,
29900,
13,
13,
1678,
363,
878,
7207,
297,
878,
7207,
29918,
5975,
29901,
13,
4706,
286,
334,
29922,
878,
7207,
13,
13,
1678,
363,
313,
29885,
29918,
29875,
29892,
263,
29918,
29875,
29897,
297,
14319,
29898,
1545,
7207,
29918,
5975,
29892,
263,
29918,
5975,
1125,
13,
4706,
341,
29918,
29875,
353,
286,
849,
286,
29918,
29875,
13,
4706,
2437,
353,
16402,
29898,
29924,
29918,
29875,
29892,
286,
29918,
29875,
29897,
13,
13,
4706,
921,
353,
313,
29916,
718,
263,
29918,
29875,
334,
341,
29918,
29875,
334,
2437,
29897,
1273,
286,
13,
13,
1678,
736,
921,
13,
2
] |
src/features/build_features.py | JL1829/EmployeeSalaryPrediction | 0 | 63234 | """
Author: <NAME>
Date: 6th/July/2020
Copyright: <NAME>, 2020
email: <EMAIL>
website: https://johdev.com
"""
import numpy as np
import pandas as pd
class FeatureGenerator(object):
"""A feature engineering generator to create additional feature to DataFrame
Group by each label encoded column, compute the:
* mean
* max
* min
* Standard Deviation
* median
of label column
Parameter
-------------
data: object, a dataset object created by `preprocessing.py`
Method
-------------
add_group_stats(self):
group by each label encoded column, and compute the Grouped Statitics.
fill any NaN value with 0
Return: grouped by statitics DataFrame merged with original DataFrame.
Example
-------------
>>> feature_engineering = True
>>> if feature_engineering:
FeatureGenerator(data).add_group_stats()
"""
def __init__(self, data:object):
"""initializes class and creates groupby object for data"""
self.data = data
self.cat_cols = data.cat_cols
self.groups = data.train_df.groupby(self.cat_cols)
def add_group_stats(self):
"""adds group statistics to data stored in data object"""
group_stats_df = self._get_group_stats()
group_stats_df.reset_index(inplace=True)
# merge derived columns to original df
self.data.train_df = self._merge_new_cols(self.data.train_df, group_stats_df, self.cat_cols, fillna=True)
self.data.test_df = self._merge_new_cols(self.data.test_df, group_stats_df, self.cat_cols, fillna=True)
# update column list
group_stats_cols = ['group_mean_salary', 'group_max_salary', 'group_min_salary', 'group_std_salary', 'group_median_salary']
self._extend_col_lists(self.data, cat_cols=group_stats_cols)
def _get_group_stats(self):
"""calculate group statistics"""
target_col = self.data.target_col
group_stats_df = pd.DataFrame({'group_mean_salary': self.groups[target_col].mean()})
group_stats_df['group_max_salary'] = self.groups[target_col].max()
group_stats_df['group_min_salary'] = self.groups[target_col].min()
group_stats_df['group_std_salary'] = self.groups[target_col].std()
group_stats_df['group_median_salary'] = self.groups[target_col].median()
return group_stats_df
def _merge_new_cols(self, df, new_cols_df, keys, fillna=False):
"""Merges engineered features with original df"""
DataFrame = pd.merge(df, new_cols_df, on=keys, how='left')
if fillna:
DataFrame.fillna(0, inplace=True)
return DataFrame
def _extend_col_lists(self, data, cat_cols=[], num_cols=[]):
"""addes engineered features cols to data cols lists"""
data.num_cols.extend(num_cols)
data.cat_cols.extend(cat_cols)
data.feature_cols.extend(num_cols + cat_cols)
| [
1,
9995,
13,
13720,
29901,
529,
5813,
29958,
13,
2539,
29901,
29871,
29953,
386,
29914,
29967,
11850,
29914,
29906,
29900,
29906,
29900,
1678,
13,
11882,
1266,
29901,
529,
5813,
10202,
29871,
29906,
29900,
29906,
29900,
13,
5269,
29901,
529,
26862,
6227,
29958,
13,
22942,
29901,
2045,
597,
29926,
1148,
3359,
29889,
510,
13,
15945,
29908,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
13,
1990,
5169,
1535,
21575,
29898,
3318,
1125,
13,
1678,
9995,
29909,
4682,
21639,
15299,
304,
1653,
5684,
4682,
304,
3630,
4308,
13,
268,
13,
1678,
6431,
491,
1269,
3858,
18511,
1897,
29892,
10272,
278,
29901,
13,
4706,
334,
2099,
13,
4706,
334,
4236,
13,
4706,
334,
1375,
13,
4706,
334,
10117,
897,
14641,
13,
4706,
334,
19194,
13,
4706,
310,
3858,
1897,
13,
268,
13,
1678,
24953,
13,
1678,
448,
9072,
13,
1678,
848,
29901,
1203,
29892,
263,
8783,
1203,
2825,
491,
421,
1457,
19170,
29889,
2272,
29952,
13,
268,
13,
13,
1678,
8108,
13,
1678,
448,
9072,
13,
1678,
788,
29918,
2972,
29918,
16202,
29898,
1311,
1125,
13,
4706,
2318,
491,
1269,
3858,
18511,
1897,
29892,
322,
10272,
278,
6431,
287,
6666,
277,
1199,
29889,
29871,
13,
4706,
5445,
738,
18780,
995,
411,
29871,
29900,
13,
13,
4706,
7106,
29901,
27831,
491,
1002,
277,
1199,
3630,
4308,
19412,
411,
2441,
3630,
4308,
29889,
13,
268,
13,
13,
1678,
8741,
13,
1678,
448,
9072,
13,
1678,
8653,
4682,
29918,
10599,
3241,
353,
5852,
13,
1678,
8653,
565,
4682,
29918,
10599,
3241,
29901,
13,
9651,
5169,
1535,
21575,
29898,
1272,
467,
1202,
29918,
2972,
29918,
16202,
580,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
848,
29901,
3318,
1125,
13,
4706,
9995,
11228,
7093,
770,
322,
10017,
2318,
1609,
1203,
363,
848,
15945,
29908,
13,
4706,
1583,
29889,
1272,
353,
848,
13,
4706,
1583,
29889,
4117,
29918,
22724,
353,
848,
29889,
4117,
29918,
22724,
13,
4706,
1583,
29889,
13155,
353,
848,
29889,
14968,
29918,
2176,
29889,
27789,
29898,
1311,
29889,
4117,
29918,
22724,
29897,
13,
268,
13,
1678,
822,
788,
29918,
2972,
29918,
16202,
29898,
1311,
1125,
13,
4706,
9995,
1202,
29879,
2318,
13964,
304,
848,
6087,
297,
848,
1203,
15945,
29908,
13,
4706,
2318,
29918,
16202,
29918,
2176,
353,
1583,
3032,
657,
29918,
2972,
29918,
16202,
580,
13,
4706,
2318,
29918,
16202,
29918,
2176,
29889,
12071,
29918,
2248,
29898,
262,
6689,
29922,
5574,
29897,
13,
13,
4706,
396,
10366,
10723,
4341,
304,
2441,
4489,
13,
4706,
1583,
29889,
1272,
29889,
14968,
29918,
2176,
353,
1583,
3032,
14634,
29918,
1482,
29918,
22724,
29898,
1311,
29889,
1272,
29889,
14968,
29918,
2176,
29892,
2318,
29918,
16202,
29918,
2176,
29892,
1583,
29889,
4117,
29918,
22724,
29892,
5445,
1056,
29922,
5574,
29897,
13,
4706,
1583,
29889,
1272,
29889,
1688,
29918,
2176,
353,
1583,
3032,
14634,
29918,
1482,
29918,
22724,
29898,
1311,
29889,
1272,
29889,
1688,
29918,
2176,
29892,
2318,
29918,
16202,
29918,
2176,
29892,
1583,
29889,
4117,
29918,
22724,
29892,
5445,
1056,
29922,
5574,
29897,
13,
13,
4706,
396,
2767,
1897,
1051,
13,
4706,
2318,
29918,
16202,
29918,
22724,
353,
6024,
2972,
29918,
12676,
29918,
19585,
653,
742,
525,
2972,
29918,
3317,
29918,
19585,
653,
742,
525,
2972,
29918,
1195,
29918,
19585,
653,
742,
525,
2972,
29918,
4172,
29918,
19585,
653,
742,
525,
2972,
29918,
2168,
713,
29918,
19585,
653,
2033,
13,
4706,
1583,
3032,
21843,
29918,
1054,
29918,
21513,
29898,
1311,
29889,
1272,
29892,
6635,
29918,
22724,
29922,
2972,
29918,
16202,
29918,
22724,
29897,
13,
268,
13,
1678,
822,
903,
657,
29918,
2972,
29918,
16202,
29898,
1311,
1125,
13,
4706,
9995,
15807,
403,
2318,
13964,
15945,
29908,
13,
4706,
3646,
29918,
1054,
353,
1583,
29889,
1272,
29889,
5182,
29918,
1054,
13,
4706,
2318,
29918,
16202,
29918,
2176,
353,
10518,
29889,
17271,
3319,
29915,
2972,
29918,
12676,
29918,
19585,
653,
2396,
1583,
29889,
13155,
29961,
5182,
29918,
1054,
1822,
12676,
580,
1800,
13,
4706,
2318,
29918,
16202,
29918,
2176,
1839,
2972,
29918,
3317,
29918,
19585,
653,
2033,
353,
1583,
29889,
13155,
29961,
5182,
29918,
1054,
1822,
3317,
580,
13,
4706,
2318,
29918,
16202,
29918,
2176,
1839,
2972,
29918,
1195,
29918,
19585,
653,
2033,
353,
1583,
29889,
13155,
29961,
5182,
29918,
1054,
1822,
1195,
580,
13,
4706,
2318,
29918,
16202,
29918,
2176,
1839,
2972,
29918,
4172,
29918,
19585,
653,
2033,
353,
1583,
29889,
13155,
29961,
5182,
29918,
1054,
1822,
4172,
580,
13,
4706,
2318,
29918,
16202,
29918,
2176,
1839,
2972,
29918,
2168,
713,
29918,
19585,
653,
2033,
353,
1583,
29889,
13155,
29961,
5182,
29918,
1054,
1822,
2168,
713,
580,
13,
13,
4706,
736,
2318,
29918,
16202,
29918,
2176,
13,
268,
13,
1678,
822,
903,
14634,
29918,
1482,
29918,
22724,
29898,
1311,
29892,
4489,
29892,
716,
29918,
22724,
29918,
2176,
29892,
6611,
29892,
5445,
1056,
29922,
8824,
1125,
13,
4706,
9995,
15836,
2710,
6012,
14561,
5680,
411,
2441,
4489,
15945,
29908,
13,
4706,
3630,
4308,
353,
10518,
29889,
14634,
29898,
2176,
29892,
716,
29918,
22724,
29918,
2176,
29892,
373,
29922,
8149,
29892,
920,
2433,
1563,
1495,
13,
4706,
565,
5445,
1056,
29901,
13,
9651,
3630,
4308,
29889,
5589,
1056,
29898,
29900,
29892,
297,
6689,
29922,
5574,
29897,
13,
308,
13,
4706,
736,
3630,
4308,
13,
268,
13,
1678,
822,
903,
21843,
29918,
1054,
29918,
21513,
29898,
1311,
29892,
848,
29892,
6635,
29918,
22724,
11759,
1402,
954,
29918,
22724,
29922,
2636,
1125,
13,
4706,
9995,
1202,
267,
6012,
14561,
5680,
28730,
304,
848,
28730,
8857,
15945,
29908,
13,
4706,
848,
29889,
1949,
29918,
22724,
29889,
21843,
29898,
1949,
29918,
22724,
29897,
13,
4706,
848,
29889,
4117,
29918,
22724,
29889,
21843,
29898,
4117,
29918,
22724,
29897,
13,
4706,
848,
29889,
14394,
29918,
22724,
29889,
21843,
29898,
1949,
29918,
22724,
718,
6635,
29918,
22724,
29897,
13,
2
] |
code/twostones.py | kkirigaya/Kattis | 1 | 124502 | <filename>code/twostones.py
n = int(input())
print("Alice" if n%2 == 1 else "Bob")
| [
1,
529,
9507,
29958,
401,
29914,
7516,
520,
2873,
29889,
2272,
13,
29876,
353,
938,
29898,
2080,
3101,
13,
13,
2158,
703,
29909,
5897,
29908,
565,
302,
29995,
29906,
1275,
29871,
29896,
1683,
376,
29362,
1159,
13,
2
] |
backend/env_collection/env_creator.py | MU-Software/dodoco | 6 | 47912 | import json
import pathlib
import traceback
import typing
def get_traceback_msg(err):
return ''.join(traceback.format_exception(
etype=type(err),
value=err,
tb=err.__traceback__))
def json_to_envfiles(output_file: pathlib.Path):
try:
output_name: str = output_file.stem
input_env_file_content: str = output_file.read_text()
input_env: dict[str, typing.Union[str, dict[str, str]]] = json.loads(input_env_file_content)
template_launch_json_file: typing.Optional[pathlib.Path] = pathlib.Path('template/launch.json')
if not template_launch_json_file.exists():
print('There\'s no launch.json template file for VS Code.\n'
'Place file on template/launch.json')
template_launch_json_file = None
else:
template_launch_json_file_content: dict[str, object] = json.loads(template_launch_json_file.read_text())
output_docker_file: pathlib.Path = pathlib.Path(output_name+'.env')
output_bash_file: pathlib.Path = pathlib.Path(output_name+'.sh')
output_ps_file: pathlib.Path = pathlib.Path(output_name+'.ps1')
output_launch_json_file: pathlib.Path = pathlib.Path('../.vscode/launch.json')
if output_docker_file.exists():
output_docker_file.unlink()
if output_bash_file.exists():
output_bash_file.unlink()
if output_ps_file.exists():
output_ps_file.unlink()
if template_launch_json_file is not None:
if not output_launch_json_file.parent.exists():
output_launch_json_file.parent.mkdir()
if output_launch_json_file.exists():
output_launch_json_file.unlink()
with output_docker_file.open('w') as docker_fp,\
output_bash_file.open('w') as bash_fp,\
output_ps_file.open('w') as ps_fp:
# Add Shebang
bash_fp.write('#!/usr/bin/env bash\n')
ps_fp.write('#!/usr/bin/env pwsh\n')
for env_name, env_value in input_env.items():
if env_name.startswith('__comment'):
comment_line = f'# {env_value}\n'
docker_fp.write(comment_line)
bash_fp.write(comment_line)
ps_fp.write(comment_line)
continue
elif env_name.startswith('__line_break'):
docker_fp.write('\n')
bash_fp.write('\n')
ps_fp.write('\n')
continue
docker_line = f'{env_name}='
bash_line = f'export {env_name}='
ps_line = f'$env:{env_name}='
if type(env_value) == dict:
bash_line += f'"{env_value["bash"]}"\n'
ps_line += f'"{env_value["powershell"]}"\n'
docker_line += f'"{env_value["vscode_launch"].format(**input_env)}"\n'
else:
bash_line += f'"{env_value}"\n'
ps_line += f'"{env_value}"\n'
docker_line += f'"{env_value}"\n'
docker_fp.write(docker_line)
bash_fp.write(bash_line)
ps_fp.write(ps_line)
if template_launch_json_file is not None:
with output_launch_json_file.open('w') as launch_json_fp:
launch_json_env = dict()
for k, v in input_env.items():
if k.startswith('__comment') or k.startswith('__line_break'):
continue
elif type(v) == str:
launch_json_env[k] = v
else:
launch_json_env[k] = v['vscode_launch'].format(**input_env)
template_launch_json_file_content['configurations'][0]['env'] = launch_json_env
launch_json_fp.write(json.dumps(template_launch_json_file_content, indent=4))
except Exception as e:
print('Exception raised!')
print(get_traceback_msg(e))
if __name__ == '__main__':
import os
import sys
if len(sys.argv) > 1:
target_file = pathlib.Path(sys.argv[1]).absolute()
if not target_file.exists():
print(target_file.as_posix())
# Ignore just now. We'll retry this after changing paths
target_file = None
else:
print('Need to specify target environment variables collection file(.json)')
os._exit(1)
os.chdir(pathlib.Path(__file__).parents[0])
if target_file is None:
target_file = pathlib.Path(sys.argv[1]).absolute()
if not target_file.exists():
raise FileNotFoundError()
json_to_envfiles(target_file)
| [
1,
1053,
4390,
13,
5215,
2224,
1982,
13,
5215,
9637,
1627,
13,
5215,
19229,
13,
13,
13,
1753,
679,
29918,
15003,
1627,
29918,
7645,
29898,
3127,
1125,
13,
1678,
736,
525,
4286,
7122,
29898,
15003,
1627,
29889,
4830,
29918,
11739,
29898,
13,
462,
259,
634,
668,
29922,
1853,
29898,
3127,
511,
13,
462,
259,
995,
29922,
3127,
29892,
13,
462,
259,
260,
29890,
29922,
3127,
17255,
15003,
1627,
1649,
876,
13,
13,
13,
1753,
4390,
29918,
517,
29918,
6272,
5325,
29898,
4905,
29918,
1445,
29901,
2224,
1982,
29889,
2605,
1125,
13,
1678,
1018,
29901,
13,
4706,
1962,
29918,
978,
29901,
851,
353,
1962,
29918,
1445,
29889,
303,
331,
13,
13,
4706,
1881,
29918,
6272,
29918,
1445,
29918,
3051,
29901,
851,
353,
1962,
29918,
1445,
29889,
949,
29918,
726,
580,
13,
4706,
1881,
29918,
6272,
29901,
9657,
29961,
710,
29892,
19229,
29889,
19986,
29961,
710,
29892,
9657,
29961,
710,
29892,
851,
5262,
29962,
353,
4390,
29889,
18132,
29898,
2080,
29918,
6272,
29918,
1445,
29918,
3051,
29897,
13,
13,
4706,
4472,
29918,
15343,
29918,
3126,
29918,
1445,
29901,
19229,
29889,
27636,
29961,
2084,
1982,
29889,
2605,
29962,
353,
2224,
1982,
29889,
2605,
877,
6886,
29914,
15343,
29889,
3126,
1495,
13,
4706,
565,
451,
4472,
29918,
15343,
29918,
3126,
29918,
1445,
29889,
9933,
7295,
13,
9651,
1596,
877,
8439,
20333,
29879,
694,
6826,
29889,
3126,
4472,
934,
363,
12221,
5920,
7790,
29876,
29915,
13,
462,
29871,
525,
22150,
934,
373,
4472,
29914,
15343,
29889,
3126,
1495,
13,
9651,
4472,
29918,
15343,
29918,
3126,
29918,
1445,
353,
6213,
13,
4706,
1683,
29901,
13,
9651,
4472,
29918,
15343,
29918,
3126,
29918,
1445,
29918,
3051,
29901,
9657,
29961,
710,
29892,
1203,
29962,
353,
4390,
29889,
18132,
29898,
6886,
29918,
15343,
29918,
3126,
29918,
1445,
29889,
949,
29918,
726,
3101,
13,
13,
4706,
1962,
29918,
14695,
29918,
1445,
29901,
2224,
1982,
29889,
2605,
353,
2224,
1982,
29889,
2605,
29898,
4905,
29918,
978,
29974,
4286,
6272,
1495,
13,
4706,
1962,
29918,
13067,
29918,
1445,
29901,
2224,
1982,
29889,
2605,
353,
2224,
1982,
29889,
2605,
29898,
4905,
29918,
978,
29974,
4286,
845,
1495,
13,
4706,
1962,
29918,
567,
29918,
1445,
29901,
2224,
1982,
29889,
2605,
353,
2224,
1982,
29889,
2605,
29898,
4905,
29918,
978,
29974,
4286,
567,
29896,
1495,
13,
4706,
1962,
29918,
15343,
29918,
3126,
29918,
1445,
29901,
2224,
1982,
29889,
2605,
353,
2224,
1982,
29889,
2605,
877,
636,
6294,
4270,
401,
29914,
15343,
29889,
3126,
1495,
13,
13,
4706,
565,
1962,
29918,
14695,
29918,
1445,
29889,
9933,
7295,
13,
9651,
1962,
29918,
14695,
29918,
1445,
29889,
348,
2324,
580,
13,
13,
4706,
565,
1962,
29918,
13067,
29918,
1445,
29889,
9933,
7295,
13,
9651,
1962,
29918,
13067,
29918,
1445,
29889,
348,
2324,
580,
13,
13,
4706,
565,
1962,
29918,
567,
29918,
1445,
29889,
9933,
7295,
13,
9651,
1962,
29918,
567,
29918,
1445,
29889,
348,
2324,
580,
13,
13,
4706,
565,
4472,
29918,
15343,
29918,
3126,
29918,
1445,
338,
451,
6213,
29901,
13,
9651,
565,
451,
1962,
29918,
15343,
29918,
3126,
29918,
1445,
29889,
3560,
29889,
9933,
7295,
13,
18884,
1962,
29918,
15343,
29918,
3126,
29918,
1445,
29889,
3560,
29889,
11256,
3972,
580,
13,
9651,
565,
1962,
29918,
15343,
29918,
3126,
29918,
1445,
29889,
9933,
7295,
13,
18884,
1962,
29918,
15343,
29918,
3126,
29918,
1445,
29889,
348,
2324,
580,
13,
13,
4706,
411,
1962,
29918,
14695,
29918,
1445,
29889,
3150,
877,
29893,
1495,
408,
10346,
29918,
18091,
2053,
13,
632,
1962,
29918,
13067,
29918,
1445,
29889,
3150,
877,
29893,
1495,
408,
10891,
29918,
18091,
2053,
13,
632,
1962,
29918,
567,
29918,
1445,
29889,
3150,
877,
29893,
1495,
408,
6529,
29918,
18091,
29901,
13,
13,
9651,
396,
3462,
2296,
29890,
574,
13,
9651,
10891,
29918,
18091,
29889,
3539,
14237,
14708,
4855,
29914,
2109,
29914,
6272,
10891,
29905,
29876,
1495,
13,
9651,
6529,
29918,
18091,
29889,
3539,
14237,
14708,
4855,
29914,
2109,
29914,
6272,
282,
29893,
845,
29905,
29876,
1495,
13,
13,
9651,
363,
8829,
29918,
978,
29892,
8829,
29918,
1767,
297,
1881,
29918,
6272,
29889,
7076,
7295,
13,
18884,
565,
8829,
29918,
978,
29889,
27382,
2541,
877,
1649,
9342,
29374,
13,
462,
1678,
3440,
29918,
1220,
353,
285,
29915,
29937,
426,
6272,
29918,
1767,
1012,
29876,
29915,
13,
462,
1678,
10346,
29918,
18091,
29889,
3539,
29898,
9342,
29918,
1220,
29897,
13,
462,
1678,
10891,
29918,
18091,
29889,
3539,
29898,
9342,
29918,
1220,
29897,
13,
462,
1678,
6529,
29918,
18091,
29889,
3539,
29898,
9342,
29918,
1220,
29897,
13,
462,
1678,
6773,
13,
18884,
25342,
8829,
29918,
978,
29889,
27382,
2541,
877,
1649,
1220,
29918,
8690,
29374,
13,
462,
1678,
10346,
29918,
18091,
29889,
3539,
28909,
29876,
1495,
13,
462,
1678,
10891,
29918,
18091,
29889,
3539,
28909,
29876,
1495,
13,
462,
1678,
6529,
29918,
18091,
29889,
3539,
28909,
29876,
1495,
13,
462,
1678,
6773,
13,
13,
18884,
10346,
29918,
1220,
353,
285,
29915,
29912,
6272,
29918,
978,
29913,
2433,
13,
18884,
10891,
29918,
1220,
353,
285,
29915,
15843,
426,
6272,
29918,
978,
29913,
2433,
13,
18884,
6529,
29918,
1220,
353,
285,
13090,
6272,
26254,
6272,
29918,
978,
29913,
2433,
13,
13,
18884,
565,
1134,
29898,
6272,
29918,
1767,
29897,
1275,
9657,
29901,
13,
462,
1678,
10891,
29918,
1220,
4619,
285,
11838,
29912,
6272,
29918,
1767,
3366,
13067,
3108,
5038,
29905,
29876,
29915,
13,
462,
1678,
6529,
29918,
1220,
4619,
285,
11838,
29912,
6272,
29918,
1767,
3366,
12248,
27456,
3108,
5038,
29905,
29876,
29915,
13,
462,
1678,
10346,
29918,
1220,
4619,
285,
11838,
29912,
6272,
29918,
1767,
3366,
4270,
401,
29918,
15343,
16862,
4830,
29898,
1068,
2080,
29918,
6272,
2915,
26732,
29876,
29915,
13,
18884,
1683,
29901,
13,
462,
1678,
10891,
29918,
1220,
4619,
285,
11838,
29912,
6272,
29918,
1767,
5038,
29905,
29876,
29915,
13,
462,
1678,
6529,
29918,
1220,
4619,
285,
11838,
29912,
6272,
29918,
1767,
5038,
29905,
29876,
29915,
13,
462,
1678,
10346,
29918,
1220,
4619,
285,
11838,
29912,
6272,
29918,
1767,
5038,
29905,
29876,
29915,
13,
13,
18884,
10346,
29918,
18091,
29889,
3539,
29898,
14695,
29918,
1220,
29897,
13,
18884,
10891,
29918,
18091,
29889,
3539,
29898,
13067,
29918,
1220,
29897,
13,
18884,
6529,
29918,
18091,
29889,
3539,
29898,
567,
29918,
1220,
29897,
13,
13,
4706,
565,
4472,
29918,
15343,
29918,
3126,
29918,
1445,
338,
451,
6213,
29901,
13,
9651,
411,
1962,
29918,
15343,
29918,
3126,
29918,
1445,
29889,
3150,
877,
29893,
1495,
408,
6826,
29918,
3126,
29918,
18091,
29901,
13,
18884,
6826,
29918,
3126,
29918,
6272,
353,
9657,
580,
13,
18884,
363,
413,
29892,
325,
297,
1881,
29918,
6272,
29889,
7076,
7295,
13,
462,
1678,
565,
413,
29889,
27382,
2541,
877,
1649,
9342,
1495,
470,
413,
29889,
27382,
2541,
877,
1649,
1220,
29918,
8690,
29374,
13,
462,
4706,
6773,
13,
462,
1678,
25342,
1134,
29898,
29894,
29897,
1275,
851,
29901,
13,
462,
4706,
6826,
29918,
3126,
29918,
6272,
29961,
29895,
29962,
353,
325,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
6826,
29918,
3126,
29918,
6272,
29961,
29895,
29962,
353,
325,
1839,
4270,
401,
29918,
15343,
13359,
4830,
29898,
1068,
2080,
29918,
6272,
29897,
13,
13,
18884,
4472,
29918,
15343,
29918,
3126,
29918,
1445,
29918,
3051,
1839,
2917,
332,
800,
2033,
29961,
29900,
22322,
6272,
2033,
353,
6826,
29918,
3126,
29918,
6272,
13,
18884,
6826,
29918,
3126,
29918,
18091,
29889,
3539,
29898,
3126,
29889,
29881,
17204,
29898,
6886,
29918,
15343,
29918,
3126,
29918,
1445,
29918,
3051,
29892,
29536,
29922,
29946,
876,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
1596,
877,
2451,
10425,
29991,
1495,
13,
4706,
1596,
29898,
657,
29918,
15003,
1627,
29918,
7645,
29898,
29872,
876,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1053,
2897,
13,
1678,
1053,
10876,
13,
1678,
565,
7431,
29898,
9675,
29889,
19218,
29897,
1405,
29871,
29896,
29901,
13,
4706,
3646,
29918,
1445,
353,
2224,
1982,
29889,
2605,
29898,
9675,
29889,
19218,
29961,
29896,
14664,
23552,
580,
13,
4706,
565,
451,
3646,
29918,
1445,
29889,
9933,
7295,
13,
9651,
1596,
29898,
5182,
29918,
1445,
29889,
294,
29918,
1066,
861,
3101,
13,
9651,
396,
18076,
487,
925,
1286,
29889,
1334,
29915,
645,
337,
2202,
445,
1156,
6480,
10898,
13,
9651,
3646,
29918,
1445,
353,
6213,
13,
1678,
1683,
29901,
13,
4706,
1596,
877,
8139,
287,
304,
6084,
3646,
5177,
3651,
4333,
934,
11891,
3126,
29897,
1495,
13,
4706,
2897,
3032,
13322,
29898,
29896,
29897,
13,
13,
1678,
2897,
29889,
305,
3972,
29898,
2084,
1982,
29889,
2605,
22168,
1445,
1649,
467,
862,
1237,
29961,
29900,
2314,
13,
13,
1678,
565,
3646,
29918,
1445,
338,
6213,
29901,
13,
4706,
3646,
29918,
1445,
353,
2224,
1982,
29889,
2605,
29898,
9675,
29889,
19218,
29961,
29896,
14664,
23552,
580,
13,
4706,
565,
451,
3646,
29918,
1445,
29889,
9933,
7295,
13,
9651,
12020,
3497,
17413,
2392,
580,
13,
13,
1678,
4390,
29918,
517,
29918,
6272,
5325,
29898,
5182,
29918,
1445,
29897,
13,
2
] |
data/evaluate_detections.py | Jacqueline121/RetinaNet_pytorch | 1 | 1605425 | <reponame>Jacqueline121/RetinaNet_pytorch
import os
import pickle
import numpy as np
from data.VOC_eval import voc_eval
from config.config import cfg
dataset_dir = os.path.join(os.path.dirname(__file__), 'dataset')
def load_image_set_index(image_set):
image_set_file = os.path.join(dataset_dir, cfg.DATASET_NAME, 'ImageSets', image_set + '.txt')
assert os.path.exists(image_set_file), \
'Path does not exist: {}'.format(image_set_file)
with open(image_set_file) as f:
image_index = [(x.split(' ')[0]).split('.')[0] for x in f.readlines()]
return image_index
def get_results_file_template(image_set):
filename = 'comp4' + '_det_' + image_set + '_{:s}.txt'
filedir = os.path.join(dataset_dir, cfg.DATASET_NAME, 'Results')
if not os.path.exists(filedir):
os.makedirs(filedir)
path = os.path.join(filedir, filename)
return path
def write_results_file(all_boxes):
image_index = load_image_set_index('test') # get val image index(id)
for cls_ind, cls in enumerate(cfg.CLASSES):
print('Writing {} results file'.format(cls))
filename = get_results_file_template('test').format(cls)
with open(filename, 'wt') as f:
for im_ind, index in enumerate(image_index):
dets = all_boxes[cls_ind][im_ind]
if dets == []:
continue
for k in range(dets.shape[0]):
f.write('{:s} {:.3f} {:.1f} {:.1f} {:.1f} {:.1f}\n'.
format(index, dets[k, -1],
dets[k, 0] + 1, dets[k, 1] + 1,
dets[k, 2] + 1, dets[k, 3] + 1))
def do_python_eval(output_dir, use_07_metric):
anno_path = os.path.join(dataset_dir, cfg.DATASET_NAME, 'Annotations', '{:s}.xml')
imageset_file = os.path.join(dataset_dir, cfg.DATASET_NAME, 'ImageSets', 'test.txt')
cache_dir = os.path.join(dataset_dir, cfg.DATASET_NAME, 'Cache')
aps = []
if not os.path.isdir(output_dir):
os.mkdir(output_dir)
for i, cls in enumerate(cfg.CLASSES):
file_name = get_results_file_template('test').format(cls)
rec, prec, ap = voc_eval(
anno_path=anno_path,
imageset_file=imageset_file,
cache_dir=cache_dir,
class_name=cls,
det_path=file_name,
ious_thresh=0.5,
use_07_metric=use_07_metric)
aps += [ap]
print('AP for {} = {:.4f}'.format(cls, ap))
with open(os.path.join(output_dir, cls + '_pr.pkl'), 'wb') as f:
pickle.dump({'rec': rec, 'prec': prec, 'ap': ap}, f)
print('Mean AP = {:.4f}'.format(np.mean(aps)))
print('~~~~~~~~')
print('Results:')
for ap in aps:
print('{:.3f}'.format(ap))
print('{:.3f}'.format(np.mean(aps)))
print('~~~~~~~~')
print('')
print('--------------------------------------------------------------')
print('Results computed with the **unofficial** Python eval code.')
print('Results should be very close to the official MATLAB eval code.')
print('Recompute with `./tools/reval.py --matlab ...` for your paper.')
print('-- Thanks, The Management')
print('--------------------------------------------------------------')
def evaluate_detections(all_boxes, output_dir):
write_results_file(all_boxes)
do_python_eval(output_dir, True)
| [
1,
529,
276,
1112,
420,
29958,
24288,
339,
5570,
29896,
29906,
29896,
29914,
8015,
1099,
6779,
29918,
2272,
7345,
305,
13,
5215,
2897,
13,
5215,
5839,
280,
13,
5215,
12655,
408,
7442,
13,
3166,
848,
29889,
29963,
20166,
29918,
14513,
1053,
7931,
29918,
14513,
13,
3166,
2295,
29889,
2917,
1053,
274,
16434,
13,
13,
24713,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
511,
525,
24713,
1495,
13,
13,
13,
1753,
2254,
29918,
3027,
29918,
842,
29918,
2248,
29898,
3027,
29918,
842,
1125,
13,
1678,
1967,
29918,
842,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
24713,
29918,
3972,
29892,
274,
16434,
29889,
25832,
8127,
29911,
29918,
5813,
29892,
525,
2940,
29903,
1691,
742,
29871,
1967,
29918,
842,
718,
15300,
3945,
1495,
13,
1678,
4974,
2897,
29889,
2084,
29889,
9933,
29898,
3027,
29918,
842,
29918,
1445,
511,
320,
13,
4706,
525,
2605,
947,
451,
1863,
29901,
6571,
4286,
4830,
29898,
3027,
29918,
842,
29918,
1445,
29897,
13,
1678,
411,
1722,
29898,
3027,
29918,
842,
29918,
1445,
29897,
408,
285,
29901,
13,
4706,
1967,
29918,
2248,
353,
17288,
29916,
29889,
5451,
877,
525,
9601,
29900,
14664,
5451,
12839,
29861,
29900,
29962,
363,
921,
297,
285,
29889,
949,
9012,
580,
29962,
13,
1678,
736,
1967,
29918,
2248,
13,
13,
13,
1753,
679,
29918,
9902,
29918,
1445,
29918,
6886,
29898,
3027,
29918,
842,
1125,
13,
1678,
10422,
353,
525,
2388,
29946,
29915,
718,
22868,
4801,
29918,
29915,
718,
1967,
29918,
842,
718,
525,
648,
29901,
29879,
1836,
3945,
29915,
13,
1678,
934,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
24713,
29918,
3972,
29892,
274,
16434,
29889,
25832,
8127,
29911,
29918,
5813,
29892,
525,
12191,
1495,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
1445,
3972,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
1445,
3972,
29897,
13,
1678,
2224,
353,
2897,
29889,
2084,
29889,
7122,
29898,
1445,
3972,
29892,
10422,
29897,
13,
1678,
736,
2224,
13,
13,
13,
1753,
2436,
29918,
9902,
29918,
1445,
29898,
497,
29918,
1884,
267,
1125,
13,
1678,
1967,
29918,
2248,
353,
2254,
29918,
3027,
29918,
842,
29918,
2248,
877,
1688,
1495,
29871,
396,
679,
659,
1967,
2380,
29898,
333,
29897,
13,
1678,
363,
1067,
29879,
29918,
513,
29892,
1067,
29879,
297,
26985,
29898,
16859,
29889,
6154,
3289,
1660,
29903,
1125,
13,
4706,
1596,
877,
29956,
768,
292,
6571,
2582,
934,
4286,
4830,
29898,
25932,
876,
13,
4706,
10422,
353,
679,
29918,
9902,
29918,
1445,
29918,
6886,
877,
1688,
2824,
4830,
29898,
25932,
29897,
13,
4706,
411,
1722,
29898,
9507,
29892,
525,
14554,
1495,
408,
285,
29901,
13,
9651,
363,
527,
29918,
513,
29892,
2380,
297,
26985,
29898,
3027,
29918,
2248,
1125,
13,
18884,
1439,
29879,
353,
599,
29918,
1884,
267,
29961,
25932,
29918,
513,
3816,
326,
29918,
513,
29962,
13,
18884,
565,
1439,
29879,
1275,
5159,
29901,
13,
462,
1678,
6773,
13,
18884,
363,
413,
297,
3464,
29898,
29881,
1691,
29889,
12181,
29961,
29900,
29962,
1125,
13,
462,
1678,
285,
29889,
3539,
877,
25641,
29879,
29913,
12365,
29889,
29941,
29888,
29913,
12365,
29889,
29896,
29888,
29913,
12365,
29889,
29896,
29888,
29913,
12365,
29889,
29896,
29888,
29913,
12365,
29889,
29896,
29888,
1012,
29876,
4286,
13,
462,
9651,
3402,
29898,
2248,
29892,
1439,
29879,
29961,
29895,
29892,
448,
29896,
1402,
13,
462,
462,
259,
1439,
29879,
29961,
29895,
29892,
29871,
29900,
29962,
718,
29871,
29896,
29892,
1439,
29879,
29961,
29895,
29892,
29871,
29896,
29962,
718,
29871,
29896,
29892,
13,
462,
462,
259,
1439,
29879,
29961,
29895,
29892,
29871,
29906,
29962,
718,
29871,
29896,
29892,
1439,
29879,
29961,
29895,
29892,
29871,
29941,
29962,
718,
29871,
29896,
876,
13,
13,
13,
1753,
437,
29918,
4691,
29918,
14513,
29898,
4905,
29918,
3972,
29892,
671,
29918,
29900,
29955,
29918,
16414,
1125,
13,
1678,
12327,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
24713,
29918,
3972,
29892,
274,
16434,
29889,
25832,
8127,
29911,
29918,
5813,
29892,
525,
2744,
1333,
800,
742,
22372,
29901,
29879,
1836,
3134,
1495,
13,
1678,
4558,
300,
29918,
1445,
353,
2897,
29889,
2084,
29889,
7122,
29898,
24713,
29918,
3972,
29892,
274,
16434,
29889,
25832,
8127,
29911,
29918,
5813,
29892,
525,
2940,
29903,
1691,
742,
525,
1688,
29889,
3945,
1495,
13,
1678,
7090,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
24713,
29918,
3972,
29892,
274,
16434,
29889,
25832,
8127,
29911,
29918,
5813,
29892,
525,
10408,
1495,
13,
1678,
263,
567,
353,
5159,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
4905,
29918,
3972,
1125,
13,
4706,
2897,
29889,
11256,
3972,
29898,
4905,
29918,
3972,
29897,
13,
13,
1678,
363,
474,
29892,
1067,
29879,
297,
26985,
29898,
16859,
29889,
6154,
3289,
1660,
29903,
1125,
13,
4706,
934,
29918,
978,
353,
679,
29918,
9902,
29918,
1445,
29918,
6886,
877,
1688,
2824,
4830,
29898,
25932,
29897,
13,
4706,
1162,
29892,
8303,
29892,
3095,
353,
7931,
29918,
14513,
29898,
13,
9651,
12327,
29918,
2084,
29922,
7665,
29918,
2084,
29892,
13,
9651,
4558,
300,
29918,
1445,
29922,
8346,
300,
29918,
1445,
29892,
13,
9651,
7090,
29918,
3972,
29922,
8173,
29918,
3972,
29892,
13,
9651,
770,
29918,
978,
29922,
25932,
29892,
13,
9651,
1439,
29918,
2084,
29922,
1445,
29918,
978,
29892,
13,
9651,
474,
681,
29918,
386,
3781,
29922,
29900,
29889,
29945,
29892,
13,
9651,
671,
29918,
29900,
29955,
29918,
16414,
29922,
1509,
29918,
29900,
29955,
29918,
16414,
29897,
13,
4706,
263,
567,
4619,
518,
481,
29962,
13,
4706,
1596,
877,
3301,
363,
6571,
353,
12365,
29889,
29946,
29888,
29913,
4286,
4830,
29898,
25932,
29892,
3095,
876,
13,
4706,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
1067,
29879,
718,
22868,
558,
29889,
29886,
6321,
5477,
525,
29893,
29890,
1495,
408,
285,
29901,
13,
9651,
5839,
280,
29889,
15070,
3319,
29915,
3757,
2396,
1162,
29892,
525,
17990,
2396,
8303,
29892,
525,
481,
2396,
3095,
1118,
285,
29897,
13,
13,
1678,
1596,
877,
6816,
273,
12279,
353,
12365,
29889,
29946,
29888,
29913,
4286,
4830,
29898,
9302,
29889,
12676,
29898,
2547,
4961,
13,
1678,
1596,
877,
26594,
1495,
13,
1678,
1596,
877,
12191,
29901,
1495,
13,
1678,
363,
3095,
297,
263,
567,
29901,
13,
4706,
1596,
877,
25641,
29889,
29941,
29888,
29913,
4286,
4830,
29898,
481,
876,
13,
1678,
1596,
877,
25641,
29889,
29941,
29888,
29913,
4286,
4830,
29898,
9302,
29889,
12676,
29898,
2547,
4961,
13,
1678,
1596,
877,
26594,
1495,
13,
1678,
1596,
877,
1495,
13,
1678,
1596,
877,
2683,
2683,
2683,
9072,
489,
1495,
13,
1678,
1596,
877,
12191,
15712,
411,
278,
3579,
9447,
7880,
1068,
5132,
19745,
775,
29889,
1495,
13,
1678,
1596,
877,
12191,
881,
367,
1407,
3802,
304,
278,
6221,
341,
1299,
24461,
19745,
775,
29889,
1495,
13,
1678,
1596,
877,
1123,
26017,
411,
5050,
29914,
8504,
29914,
276,
791,
29889,
2272,
1192,
2922,
8205,
2023,
29952,
363,
596,
5650,
29889,
1495,
13,
1678,
1596,
877,
489,
1834,
29892,
450,
15057,
1495,
13,
1678,
1596,
877,
2683,
2683,
2683,
9072,
489,
1495,
13,
13,
13,
1753,
14707,
29918,
29881,
2650,
1953,
29898,
497,
29918,
1884,
267,
29892,
1962,
29918,
3972,
1125,
13,
1678,
2436,
29918,
9902,
29918,
1445,
29898,
497,
29918,
1884,
267,
29897,
13,
1678,
437,
29918,
4691,
29918,
14513,
29898,
4905,
29918,
3972,
29892,
5852,
29897,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
2
] |
clearScreen.py | BlueDragon022/Fruit-Machine | 0 | 114922 | <gh_stars>0
import os
import platform
#Function to clear the screen
def clearScreen():
#This goes through different os's and uses the correct command to clear the terminal/console
if platform.system() == "Windows":
os.system("cls")
elif platform.system() == "Linux":
os.system("clear")
elif platform.system() == "Darwin": #MacOS
os.system("clear")
else:
os.system("clear")
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
2897,
13,
5215,
7481,
13,
13,
29937,
6678,
304,
2821,
278,
4315,
13,
1753,
2821,
11357,
7295,
13,
12,
29937,
4013,
5771,
1549,
1422,
2897,
29915,
29879,
322,
3913,
278,
1959,
1899,
304,
2821,
278,
8638,
29914,
11058,
13,
12,
361,
7481,
29889,
5205,
580,
1275,
376,
7685,
1115,
13,
12,
12,
359,
29889,
5205,
703,
25932,
1159,
13,
12,
23681,
7481,
29889,
5205,
580,
1275,
376,
24085,
1115,
13,
12,
12,
359,
29889,
5205,
703,
8551,
1159,
13,
12,
23681,
7481,
29889,
5205,
580,
1275,
376,
29928,
279,
5080,
1115,
396,
15735,
3267,
13,
12,
12,
359,
29889,
5205,
703,
8551,
1159,
13,
12,
2870,
29901,
13,
12,
12,
359,
29889,
5205,
703,
8551,
1159,
13,
2
] |
ch05_GUI/tkhello2.py | Nickhool/core-python | 1 | 168668 | <gh_stars>1-10
__Author__ = "noduez"
'''Button控件演示'''
import tkinter as tk
top = tk.Tk()
quit = tk.Button(top, text='Hello World!',
command=top.quit)
quit.pack()
tk.mainloop() | [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
1649,
13720,
1649,
353,
376,
29876,
397,
24448,
29908,
13,
12008,
3125,
31617,
30631,
233,
191,
151,
30858,
12008,
13,
13,
5215,
18883,
1639,
408,
18883,
13,
13,
3332,
353,
18883,
29889,
29911,
29895,
580,
13,
28358,
353,
18883,
29889,
3125,
29898,
3332,
29892,
1426,
2433,
10994,
2787,
29991,
742,
13,
462,
1899,
29922,
3332,
29889,
28358,
29897,
13,
28358,
29889,
4058,
580,
13,
11178,
29889,
3396,
7888,
580,
2
] |
apostello/migrations/0007_auto_20160315_1213.py | LaudateCorpus1/apostello | 69 | 27234 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-15 12:13
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("apostello", "0006_userprofile_show_tour")]
operations = [
migrations.AddField(model_name="userprofile", name="can_archive", field=models.BooleanField(default=True)),
migrations.AlterField(
model_name="recipient",
name="first_name",
field=models.CharField(
db_index=True,
max_length=16,
validators=[
django.core.validators.RegexValidator(
"^[\\s\\w@?£!1$\"¥#è?¤é%ù&ì\\ò(Ç)*:Ø+;ÄäøÆ,<LÖlöæ\\-=ÑñÅß.>ÜüåÉ/§à¡¿']+$",
message="You can only use GSM characters.",
)
],
verbose_name="First Name",
),
),
migrations.AlterField(
model_name="recipient",
name="last_name",
field=models.CharField(
db_index=True,
max_length=40,
validators=[
django.core.validators.RegexValidator(
"^[\\s\\w@?£!1$\"¥#è?¤é%ù&ì\\ò(Ç)*:Ø+;ÄäøÆ,<LÖlöæ\\-=ÑñÅß.>ÜüåÉ/§à¡¿']+$",
message="You can only use GSM characters.",
)
],
verbose_name="Last Name",
),
),
]
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
29937,
3251,
630,
491,
15337,
29871,
29896,
29889,
29929,
29889,
29946,
373,
29871,
29906,
29900,
29896,
29953,
29899,
29900,
29941,
29899,
29896,
29945,
29871,
29896,
29906,
29901,
29896,
29941,
13,
3166,
4770,
29888,
9130,
1649,
1053,
29104,
29918,
20889,
1338,
13,
13,
5215,
9557,
29889,
3221,
29889,
3084,
4097,
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,
481,
520,
3156,
613,
376,
29900,
29900,
29900,
29953,
29918,
1792,
10185,
29918,
4294,
29918,
29873,
473,
13531,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2528,
3073,
29898,
4299,
29918,
978,
543,
1792,
10185,
613,
1024,
543,
3068,
29918,
10867,
613,
1746,
29922,
9794,
29889,
18146,
3073,
29898,
4381,
29922,
5574,
8243,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
543,
4361,
29886,
993,
613,
13,
9651,
1024,
543,
4102,
29918,
978,
613,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
13,
18884,
4833,
29918,
2248,
29922,
5574,
29892,
13,
18884,
4236,
29918,
2848,
29922,
29896,
29953,
29892,
13,
18884,
2854,
4097,
11759,
13,
462,
1678,
9557,
29889,
3221,
29889,
3084,
4097,
29889,
4597,
735,
24204,
29898,
13,
462,
4706,
13898,
29961,
1966,
29879,
1966,
29893,
29992,
29973,
30155,
29991,
29896,
4535,
29908,
30563,
29937,
30000,
29973,
30435,
29948,
29995,
30071,
29987,
30097,
1966,
30059,
29898,
30219,
11877,
29901,
30222,
29974,
29936,
30125,
29986,
30077,
30232,
29892,
29966,
29931,
30094,
27575,
30078,
1966,
29899,
29922,
30334,
30046,
30129,
30034,
29889,
29958,
30104,
29993,
30020,
30062,
29914,
30152,
30001,
30180,
30158,
2033,
24035,
613,
13,
462,
4706,
2643,
543,
3492,
508,
871,
671,
402,
17061,
4890,
19602,
13,
462,
1678,
1723,
13,
18884,
21251,
13,
18884,
26952,
29918,
978,
543,
6730,
4408,
613,
13,
9651,
10353,
13,
4706,
10353,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
543,
4361,
29886,
993,
613,
13,
9651,
1024,
543,
4230,
29918,
978,
613,
13,
9651,
1746,
29922,
9794,
29889,
27890,
29898,
13,
18884,
4833,
29918,
2248,
29922,
5574,
29892,
13,
18884,
4236,
29918,
2848,
29922,
29946,
29900,
29892,
13,
18884,
2854,
4097,
11759,
13,
462,
1678,
9557,
29889,
3221,
29889,
3084,
4097,
29889,
4597,
735,
24204,
29898,
13,
462,
4706,
13898,
29961,
1966,
29879,
1966,
29893,
29992,
29973,
30155,
29991,
29896,
4535,
29908,
30563,
29937,
30000,
29973,
30435,
29948,
29995,
30071,
29987,
30097,
1966,
30059,
29898,
30219,
11877,
29901,
30222,
29974,
29936,
30125,
29986,
30077,
30232,
29892,
29966,
29931,
30094,
27575,
30078,
1966,
29899,
29922,
30334,
30046,
30129,
30034,
29889,
29958,
30104,
29993,
30020,
30062,
29914,
30152,
30001,
30180,
30158,
2033,
24035,
613,
13,
462,
4706,
2643,
543,
3492,
508,
871,
671,
402,
17061,
4890,
19602,
13,
462,
1678,
1723,
13,
18884,
21251,
13,
18884,
26952,
29918,
978,
543,
8897,
4408,
613,
13,
9651,
10353,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
src/amuse/community/rebound/interface.py | aatrani/amuse | 0 | 65689 | from amuse.community import *
from amuse.community.interface.gd import GravitationalDynamicsInterface
from amuse.community.interface.gd import GravitationalDynamics
from amuse.community.interface.gd import SinglePointGravityFieldInterface
from amuse.community.interface.gd import GravityFieldCode
class ReboundInterface(CodeInterface,
LiteratureReferencesMixIn,
GravitationalDynamicsInterface,
StoppingConditionInterface,
#SinglePointGravityFieldInterface
):
"""
REBOUND - An open-source multi-purpose N-body code
.. [#] <NAME>., <NAME>., *Astronomy and Astrophysics* , **Volume 537**, A128 (2012)
For different integrators, cite:
... IAS15: <NAME>., <NAME>., *MNRAS* , **Volume 446**, Issue 2, p.1424-1437 (2015)
... WHFast: <NAME>., <NAME>., *MNRAS* , **Volume 452**, Issue 1, p.376-388 (2015)
... Hermes: <NAME>., et al., in prep.
... SEI: <NAME>., <NAME>., *MNRAS* , **Volume 415**, Issue 4, p.3168-3176 (2011)
... JANUS: <NAME>., <NAME>., *arXiv* , 1704.07715 (2017)
"""
include_headers = ['worker_code.h', 'stopcond.h']
__so_module__ = 'rebound_cython'
def __init__(self, **options):
CodeInterface.__init__(self, name_of_the_worker="rebound_worker",
**options)
LiteratureReferencesMixIn.__init__(self)
@legacy_function
def new_particle():
"""
Define a new particle in the stellar dynamics code. The particle is initialized with the provided
mass, radius, position and velocity. This function returns an index that can be used to refer
to this particle.
"""
function = LegacyFunctionSpecification()
function.can_handle_array = True
function.addParameter('index_of_the_particle', dtype='int32', direction=function.OUT, description =
"""
An index assigned to the newly created particle.
This index is supposed to be a local index for the code
(and not valid in other instances of the code or in other codes)
"""
)
function.addParameter('mass', dtype='float64', direction=function.IN, description = "The mass of the particle")
function.addParameter('x', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
function.addParameter('y', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
function.addParameter('z', dtype='float64', direction=function.IN, description = "The initial position vector of the particle")
function.addParameter('vx', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
function.addParameter('vy', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
function.addParameter('vz', dtype='float64', direction=function.IN, description = "The initial velocity vector of the particle")
function.addParameter('radius', dtype='float64', direction=function.IN, description = "The radius of the particle", default = 0)
function.addParameter('subset', dtype='int32', direction=function.IN, description = "The subset index of the particle (defaults to 0, use new_subset for higher indices)", default = 0)
function.result_type = 'int32'
function.result_doc = """ 0 - OK
particle was created and added to the model
-1 - ERROR
particle could not be created"""
return function
def delete_particle(self, index_of_the_particle, code_index=0):
return self._delete_particle(index_of_the_particle, code_index)
@legacy_function
def _delete_particle():
"""
Delete a particle.
"""
function = LegacyFunctionSpecification()
function.can_handle_array = True
function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN, description ="Index of the particle")
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
function.result_doc = """ 0 - OK
particle was deleted
-1 - ERROR
particle not deleted"""
return function
@legacy_function
def _set_integrator():
function = LegacyFunctionSpecification()
function.addParameter('integrator_name', dtype='i', direction=function.IN)
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
function.can_handle_array = False
return function
@legacy_function
def _get_integrator():
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('integrator_name', dtype='i', direction=function.OUT)
function.result_type = 'int32'
function.can_handle_array = False
return function
INTEGRATORS = {"ias15": 0, "whfast": 1, "sei": 2, "leapfrog": 4, "hermes": 5, "whfast-helio": 6, "none": 7, "janus": 8}
def set_integrator(self, name, code_index = 0 ):
return self._set_integrator(self.INTEGRATORS[name], code_index)
def get_integrator(self, code_index = 0):
value, error = self._get_integrator(code_index)
for key, index in self.INTEGRATORS.items():
if value == index:
return key
return "none"
@legacy_function
def _set_solver():
function = LegacyFunctionSpecification()
function.addParameter('solver_name', dtype='i', direction=function.IN)
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
function.can_handle_array = False
return function
@legacy_function
def _get_solver():
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('solver_name', dtype='i', direction=function.OUT)
function.result_type = 'int32'
function.can_handle_array = False
return function
SOLVERS = {"none": 0, "basic": 1, "compensated": 2, "tree": 3}
def set_solver(self, name, code_index = 0 ):
return self._set_solver(self.SOLVERS[name], code_index)
def get_solver(self, code_index = 0):
value, error = self._get_solver(code_index)
for key, index in self.SOLVERS.items():
if value == index:
return key
return "none"
@legacy_function
def get_opening_angle2():
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('opening_angle2', dtype='float64', direction=function.OUT,
description = "theta, the opening angle for building the tree: between 0 and 1")
function.result_type = 'int32'
return function
@legacy_function
def set_opening_angle2():
function = LegacyFunctionSpecification()
function.addParameter('opening_angle2', dtype='float64', direction=function.IN,
description = "theta, the opening angle for building the tree: between 0 and 1")
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
return function
@legacy_function
def get_eps2():
function = LegacyFunctionSpecification()
"""
Get epsilon^2, a softening parameter for gravitational potentials with point particles.
"""
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('epsilon_squared', dtype='float64', direction=function.OUT,
description = "epsilon^2, a softening parameter for gravitational potentials with point particles",
unit = nbody_system.length * nbody_system.length)
function.result_type = 'int32'
function.result_doc = """
0 - OK
the parameter was retrieved
-1 - ERROR
could not retrieve parameter
"""
return function
@legacy_function
def set_eps2():
"""
Set epsilon^2, a softening parameter for gravitational potentials with point particles.
"""
function = LegacyFunctionSpecification()
function.addParameter('epsilon_squared', dtype='float64', direction=function.IN,
description = "epsilon^2, a softening parameter for gravitational potentials with point particles",
unit = nbody_system.length * nbody_system.length)
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
function.result_doc = """
0 - OK
the parameter was set
-1 - ERROR
could not set parameter
"""
return function
@legacy_function
def _set_boundary():
function = LegacyFunctionSpecification()
function.addParameter('boundary_name', dtype='i', direction=function.IN)
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
function.can_handle_array = False
return function
@legacy_function
def _get_boundary():
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('boundary_name', dtype='i', direction=function.OUT)
function.result_type = 'int32'
function.can_handle_array = False
return function
BOUNDARIES = {"none": 0, "open": 1, "periodic": 2, "shear": 3}
def set_boundary(self, name, code_index = 0 ):
return self._set_boundary(self.BOUNDARIES[name], code_index)
def get_boundary(self, code_index = 0):
value, error = self._get_boundary(code_index)
for key, index in self.BOUNDARIES.items():
if value == index:
return key
return "none"
@legacy_function
def get_boundary_size():
function = LegacyFunctionSpecification()
"""
Get the size of the boundaries.
"""
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('boundary_size', dtype='float64', direction=function.OUT,
description = "boundary size",
unit = nbody_system.length)
function.result_type = 'int32'
function.result_doc = """
0 - OK
the parameter was retrieved
-1 - ERROR
could not retrieve parameter
"""
return function
@legacy_function
def set_boundary_size():
"""
Set size of the boundaries.
"""
function = LegacyFunctionSpecification()
function.addParameter('boundary_size', dtype='float64', direction=function.IN,
description = "boundary size",
unit = nbody_system.length)
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
function.result_doc = """
0 - OK
the parameter was set
-1 - ERROR
could not set parameter
"""
return function
@legacy_function
def set_time_step():
"""
Update timestep.
"""
function = LegacyFunctionSpecification()
function.addParameter('timestep', dtype='float64', direction=function.IN,
description = "timestep")
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.result_type = 'int32'
function.result_doc = """
0 - OK
timestep was changed
"""
return function
@legacy_function
def get_potential_energy():
"""
Retrieve the current potential energy of the model
"""
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('potential_energy', dtype='float64', direction=function.OUT,
description = "The potential energy of the model")
function.result_type = 'int32'
function.result_doc = """
0 - OK
Current value of the potential energy was set
-1 - ERROR
Kinetic potential could not be provided
"""
return function
@legacy_function
def get_kinetic_energy():
"""
Retrieve the current kinetic energy of the model
"""
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('kinetic_energy', dtype='float64', direction=function.OUT,
description = "The kinetic energy of the model")
function.result_type = 'int32'
function.result_doc = """
0 - OK
Current value of the kinetic energy was set
-1 - ERROR
Kinetic energy could not be provided
"""
return function
@legacy_function
def evolve_model():
"""
Evolve the model until the given time, or until a stopping condition is set.
"""
function = LegacyFunctionSpecification()
function.addParameter('time', dtype='float64', direction=function.IN,
description = "Model time to evolve the code to. The model will be "
"evolved until this time is reached exactly or just after.")
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound (default -1, evolve all systems)", default = -1)
function.result_type = 'int32'
return function
@legacy_function
def get_time():
"""
Retrieve the model time. This time should be close to the end time specified
in the evolve code. Or, when a collision was detected, it will be the
model time of the collision.
"""
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('time', dtype='float64', direction=function.OUT,
description = "The current model time")
function.result_type = 'int32'
function.result_doc = """
0 - OK
Current value of the time was retrieved
-1 - ERROR
The code does not have support for querying the time
"""
return function
@legacy_function
def get_time_step():
"""
Retrieve the model timestep.
"""
function = LegacyFunctionSpecification()
function.addParameter('code_index', dtype='int32', direction=function.IN, description = "Index of the code in rebound", default = 0)
function.addParameter('time_step', dtype='float64', direction=function.OUT,
description = "The current model timestep")
function.result_type = 'int32'
function.result_doc = """
0 - OK
Current value of the time step was retrieved
-1 - ERROR
The code does not have support for querying the time
"""
return function
@legacy_function
def new_subset():
"""
Create a new particle subset (and corresponding code). This subset will evolve seperately from others.
"""
function = LegacyFunctionSpecification()
function.can_handle_array = True
function.addParameter('index_of_the_subset', dtype='int32', direction=function.OUT, description =
"""
An index assigned to the newly created subset
"""
)
function.addParameter('time_offset', dtype='float64', direction=function.IN, description = "Time of the system (defaults to the current model time)", default = -1)
function.result_type = 'int32'
function.result_doc = """ 0 - OK
code was created
-1 - ERROR
code could not be created"""
return function
@legacy_function
def get_state():
"""
Retrieve the current state of a particle. The *minimal* information of a stellar
dynamics particle (mass, radius, position and velocity) is returned.
"""
function = LegacyFunctionSpecification()
function.can_handle_array = True
function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN,
description = "Index of the particle to get the state from. This index must have been returned by an earlier call to :meth:`new_particle`")
function.addParameter('mass', dtype='float64', direction=function.OUT, description = "The current mass of the particle")
function.addParameter('x', dtype='float64', direction=function.OUT, description = "The current position vector of the particle")
function.addParameter('y', dtype='float64', direction=function.OUT, description = "The current position vector of the particle")
function.addParameter('z', dtype='float64', direction=function.OUT, description = "The current position vector of the particle")
function.addParameter('vx', dtype='float64', direction=function.OUT, description = "The current velocity vector of the particle")
function.addParameter('vy', dtype='float64', direction=function.OUT, description = "The current velocity vector of the particle")
function.addParameter('vz', dtype='float64', direction=function.OUT, description = "The current velocity vector of the particle")
function.addParameter('radius', dtype='float64', direction=function.OUT, description = "The current radius of the particle")
function.addParameter('subset', dtype='int32', direction=function.OUT, description = "The current subset of the particle")
function.result_type = 'int32'
function.result_doc = """
0 - OK
particle was removed from the model
-1 - ERROR
particle could not be found
"""
return function
@legacy_function
def get_subset():
"""
Retrieve the subset index of a particle.
"""
function = LegacyFunctionSpecification()
function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN,
description = "Index of the particle to get the subset of. This index must have been returned by an earlier call to :meth:`new_particle`")
function.addParameter('subset', dtype='int32', direction=function.OUT, description = "The current subset of the particle")
function.result_type = 'int32'
function.can_handle_array = True
function.result_doc = """
0 - OK
particle was found in the model and the information was retreived
-1 - ERROR
particle could not be found
"""
return function
@legacy_function
def stop_subset():
"""
Stop a subset code
"""
function = LegacyFunctionSpecification()
function.can_handle_array = True
function.addParameter('index_of_the_subset', dtype='int32', direction=function.IN, description =
"""
An index assigned to an existing subset
"""
)
function.result_type = 'int32'
function.result_doc = """ 0 - OK
subset evolving was stopped
-1 - ERROR
subset evolving was already stopped"""
return function
@legacy_function
def set_subset():
"""
Retrieve the subset index of a particle.
"""
function = LegacyFunctionSpecification()
function.addParameter('index_of_the_particle', dtype='int32', direction=function.IN,
description = "Index of the particle to get the subset of. This index must have been returned by an earlier call to :meth:`new_particle`")
function.addParameter('subset', dtype='int32', direction=function.IN, description = "The new subset of the particle, as this is actually read only this will fail if changed!")
function.result_type = 'int32'
function.can_handle_array = True
function.result_doc = """
0 - OK
particle was found in the model and the information was retreived
-1 - ERROR
particle could not be found
"""
return function
class Rebound(GravitationalDynamics, GravityFieldCode):
__interface__ = ReboundInterface
def __init__(self, convert_nbody = None, **options):
self.stopping_conditions = StoppingConditions(self)
legacy_interface = self.__interface__(**options)
self.legacy_doc = legacy_interface.__doc__
GravitationalDynamics.__init__(
self,
legacy_interface,
convert_nbody,
**options
)
def define_state(self, handler):
GravitationalDynamics.define_state(self, handler)
#GravityFieldCode.define_state(self, handler)
self.stopping_conditions.define_state(handler)
handler.add_method('EDIT', 'new_subset')
handler.add_method('RUN', 'new_subset')
def define_parameters(self, handler):
self.stopping_conditions.define_parameters(handler)
GravitationalDynamics.define_parameters(self, handler)
handler.add_method_parameter(
"get_time_step",
"set_time_step",
"timestep",
"constant timestep for iteration",
default_value = 0.0001 | nbody_system.time
)
handler.add_method_parameter(
"get_integrator",
"set_integrator",
"integrator",
"name of the integrator to use ({0})".format(sorted(self.INTEGRATORS.keys())),
default_value = "ias15"
)
handler.add_method_parameter(
"get_solver",
"set_solver",
"solver",
"name of the gravity solver to use ({0})".format(sorted(self.SOLVERS.keys())),
default_value = "compensated"
)
handler.add_method_parameter(
"get_eps2",
"set_eps2",
"epsilon_squared",
"smoothing parameter for gravity calculations",
default_value = 0.0 | nbody_system.length * nbody_system.length
)
handler.add_method_parameter(
"get_opening_angle2",
"set_opening_angle2",
"opening_angle2",
"opening angle, theta, for building the tree in case of tree solver: between 0 and 1",
default_value = 0.5
)
handler.add_method_parameter(
"get_boundary",
"set_boundary",
"boundary",
"name of the boundary type to use ({0}) (required for tree solver)".format(sorted(self.BOUNDARIES.keys())),
default_value = "none"
)
handler.add_method_parameter(
"get_boundary_size",
"set_boundary_size",
"boundary_size",
"size of the boundaries, if the type is not none",
default_value = 1.0 | nbody_system.length
)
def define_methods(self, handler):
GravitationalDynamics.define_methods(self, handler)
handler.add_method(
"new_particle",
(
nbody_system.mass,
nbody_system.length,
nbody_system.length,
nbody_system.length,
nbody_system.speed,
nbody_system.speed,
nbody_system.speed,
nbody_system.length,
handler.NO_UNIT,
),
(
handler.INDEX,
handler.ERROR_CODE,
)
)
handler.add_method(
"get_potential_energy",
(handler.INDEX,),
(nbody_system.mass * nbody_system.length ** 2 * nbody_system.time ** -2, handler.ERROR_CODE,)
)
handler.add_method(
"get_kinetic_energy",
(handler.INDEX,),
(nbody_system.mass * nbody_system.length ** 2 * nbody_system.time ** -2, handler.ERROR_CODE,)
)
handler.add_method(
'evolve_model',
(
nbody_system.time,
handler.INDEX
),
(
handler.ERROR_CODE,
)
)
handler.add_method(
'get_time',
(handler.INDEX,),
(nbody_system.time, handler.ERROR_CODE,)
)
handler.add_method(
"get_time_step",
(handler.INDEX,),
(nbody_system.time, handler.ERROR_CODE,)
)
handler.add_method(
"set_time_step",
(nbody_system.time, handler.INDEX,),
(handler.ERROR_CODE,)
)
handler.add_method(
"get_state",
(
handler.NO_UNIT,
),
(
nbody_system.mass,
nbody_system.length,
nbody_system.length,
nbody_system.length,
nbody_system.speed,
nbody_system.speed,
nbody_system.speed,
nbody_system.length,
handler.NO_UNIT,
handler.ERROR_CODE
)
)
handler.add_method(
"get_subset",
(
handler.NO_UNIT,
),
(
handler.NO_UNIT,
handler.ERROR_CODE
)
)
handler.add_method(
"set_subset",
(
handler.NO_UNIT,
handler.NO_UNIT,
),
(
handler.ERROR_CODE,
)
)
handler.add_method(
'new_subset',
(
nbody_system.time,
),
(
handler.INDEX,
handler.ERROR_CODE,
)
)
self.stopping_conditions.define_methods(handler)
def define_particle_sets(self, handler):
GravitationalDynamics.define_particle_sets(self, handler)
self.stopping_conditions.define_particle_set(handler)
handler.add_getter('particles', 'get_subset')
handler.add_setter('particles', 'set_subset')
| [
1,
515,
626,
1509,
29889,
23834,
1053,
334,
13,
3166,
626,
1509,
29889,
23834,
29889,
13248,
29889,
29887,
29881,
1053,
4989,
29894,
277,
1288,
29928,
2926,
1199,
10448,
13,
3166,
626,
1509,
29889,
23834,
29889,
13248,
29889,
29887,
29881,
1053,
4989,
29894,
277,
1288,
29928,
2926,
1199,
13,
3166,
626,
1509,
29889,
23834,
29889,
13248,
29889,
29887,
29881,
1053,
16740,
5228,
29954,
5705,
537,
3073,
10448,
13,
3166,
626,
1509,
29889,
23834,
29889,
13248,
29889,
29887,
29881,
1053,
4989,
17037,
3073,
3399,
13,
13,
1990,
12936,
618,
10448,
29898,
3399,
10448,
29892,
13,
462,
539,
5449,
1535,
1123,
10662,
29924,
861,
797,
29892,
13,
462,
539,
4989,
29894,
277,
1288,
29928,
2926,
1199,
10448,
29892,
13,
462,
539,
6639,
3262,
25255,
10448,
29892,
13,
462,
539,
396,
15771,
5228,
29954,
5705,
537,
3073,
10448,
13,
268,
1125,
13,
1678,
9995,
13,
1678,
5195,
8456,
18783,
448,
530,
1722,
29899,
4993,
2473,
29899,
15503,
4220,
405,
29899,
2587,
775,
13,
268,
13,
1678,
6317,
518,
29937,
29962,
529,
5813,
29958,
1696,
529,
5813,
29958,
1696,
334,
29909,
13854,
29891,
322,
10186,
307,
25105,
29930,
1919,
3579,
24679,
29871,
29945,
29941,
29955,
1068,
29892,
319,
29896,
29906,
29947,
313,
29906,
29900,
29896,
29906,
29897,
13,
268,
13,
1678,
1152,
1422,
3990,
4097,
29892,
274,
568,
29901,
13,
1678,
2023,
306,
3289,
29896,
29945,
29901,
29871,
529,
5813,
29958,
1696,
529,
5813,
29958,
1696,
334,
29924,
16514,
3289,
29930,
1919,
3579,
24679,
29871,
29946,
29946,
29953,
1068,
29892,
26246,
29871,
29906,
29892,
282,
29889,
29896,
29946,
29906,
29946,
29899,
29896,
29946,
29941,
29955,
313,
29906,
29900,
29896,
29945,
29897,
13,
1678,
2023,
12317,
29943,
579,
29901,
529,
5813,
29958,
1696,
529,
5813,
29958,
1696,
334,
29924,
16514,
3289,
29930,
1919,
3579,
24679,
29871,
29946,
29945,
29906,
1068,
29892,
26246,
29871,
29896,
29892,
282,
29889,
29941,
29955,
29953,
29899,
29941,
29947,
29947,
313,
29906,
29900,
29896,
29945,
29897,
13,
1678,
2023,
10515,
267,
29901,
529,
5813,
29958,
1696,
634,
394,
1696,
297,
8273,
29889,
13,
1678,
2023,
3725,
29902,
29901,
1678,
529,
5813,
29958,
1696,
529,
5813,
29958,
1696,
334,
29924,
16514,
3289,
29930,
1919,
3579,
24679,
29871,
29946,
29896,
29945,
1068,
29892,
26246,
29871,
29946,
29892,
282,
29889,
29941,
29896,
29953,
29947,
29899,
29941,
29896,
29955,
29953,
313,
29906,
29900,
29896,
29896,
29897,
13,
1678,
2023,
435,
2190,
3308,
29901,
29871,
529,
5813,
29958,
1696,
529,
5813,
29958,
1696,
334,
279,
29990,
440,
29930,
1919,
29871,
29896,
29955,
29900,
29946,
29889,
29900,
29955,
29955,
29896,
29945,
313,
29906,
29900,
29896,
29955,
29897,
13,
308,
13,
1678,
9995,
13,
1678,
3160,
29918,
13662,
353,
6024,
24602,
29918,
401,
29889,
29882,
742,
525,
9847,
1116,
29889,
29882,
2033,
13,
1678,
4770,
578,
29918,
5453,
1649,
353,
525,
276,
9917,
29918,
1270,
386,
265,
29915,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3579,
6768,
1125,
13,
4706,
5920,
10448,
17255,
2344,
12035,
1311,
29892,
1024,
29918,
974,
29918,
1552,
29918,
24602,
543,
276,
9917,
29918,
24602,
613,
13,
462,
462,
3579,
6768,
29897,
13,
4706,
5449,
1535,
1123,
10662,
29924,
861,
797,
17255,
2344,
12035,
1311,
29897,
13,
308,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
716,
29918,
1595,
2512,
7295,
13,
4706,
9995,
13,
4706,
22402,
263,
716,
16445,
297,
278,
14781,
279,
19753,
775,
29889,
450,
16445,
338,
16601,
411,
278,
4944,
13,
4706,
4158,
29892,
11855,
29892,
2602,
322,
12885,
29889,
910,
740,
3639,
385,
2380,
393,
508,
367,
1304,
304,
2737,
13,
4706,
304,
445,
16445,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
5852,
13,
4706,
740,
29889,
1202,
9329,
877,
2248,
29918,
974,
29918,
1552,
29918,
1595,
2512,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
13,
9651,
9995,
13,
9651,
530,
2380,
9859,
304,
278,
15141,
2825,
16445,
29889,
13,
9651,
910,
2380,
338,
7424,
304,
367,
263,
1887,
2380,
363,
278,
775,
13,
9651,
313,
392,
451,
2854,
297,
916,
8871,
310,
278,
775,
470,
297,
916,
11561,
29897,
13,
9651,
9995,
13,
9651,
1723,
13,
13,
4706,
740,
29889,
1202,
9329,
877,
25379,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
4158,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29916,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
2847,
2602,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29891,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
2847,
2602,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29920,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
2847,
2602,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29894,
29916,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
2847,
12885,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
13308,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
2847,
12885,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29894,
29920,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
2847,
12885,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
13471,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
11855,
310,
278,
16445,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
6484,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
11306,
2380,
310,
278,
16445,
313,
4381,
29879,
304,
29871,
29900,
29892,
671,
716,
29918,
6484,
363,
6133,
16285,
19123,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
29871,
29900,
448,
9280,
13,
9651,
16445,
471,
2825,
322,
2715,
304,
278,
1904,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
16445,
1033,
451,
367,
2825,
15945,
29908,
13,
4706,
736,
740,
13,
308,
13,
1678,
822,
5217,
29918,
1595,
2512,
29898,
1311,
29892,
2380,
29918,
974,
29918,
1552,
29918,
1595,
2512,
29892,
775,
29918,
2248,
29922,
29900,
1125,
13,
4706,
736,
1583,
3032,
8143,
29918,
1595,
2512,
29898,
2248,
29918,
974,
29918,
1552,
29918,
1595,
2512,
29892,
775,
29918,
2248,
29897,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
903,
8143,
29918,
1595,
2512,
7295,
13,
4706,
9995,
13,
4706,
21267,
263,
16445,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
5852,
13,
4706,
740,
29889,
1202,
9329,
877,
2248,
29918,
974,
29918,
1552,
29918,
1595,
2512,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
29465,
3220,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
29871,
29900,
448,
9280,
13,
9651,
16445,
471,
11132,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
16445,
451,
11132,
15945,
29908,
13,
4706,
736,
740,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
903,
842,
29918,
14146,
1061,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
539,
13,
4706,
740,
29889,
1202,
9329,
877,
14146,
1061,
29918,
978,
742,
26688,
2433,
29875,
742,
5305,
29922,
2220,
29889,
1177,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
7700,
13,
4706,
736,
740,
259,
13,
308,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
903,
657,
29918,
14146,
1061,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
539,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
14146,
1061,
29918,
978,
742,
26688,
2433,
29875,
742,
5305,
29922,
2220,
29889,
12015,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
7700,
13,
4706,
736,
740,
259,
13,
268,
13,
13,
1678,
2672,
4330,
14345,
1299,
24125,
353,
8853,
3173,
29896,
29945,
1115,
29871,
29900,
29892,
376,
1332,
11255,
1115,
29871,
29896,
29892,
376,
344,
29875,
1115,
29871,
29906,
29892,
376,
280,
481,
29888,
9102,
1115,
29871,
29946,
29892,
376,
29882,
837,
267,
1115,
29871,
29945,
29892,
376,
1332,
11255,
29899,
3952,
601,
1115,
29871,
29953,
29892,
376,
9290,
1115,
29871,
29955,
29892,
376,
8931,
375,
1115,
29871,
29947,
29913,
13,
1678,
822,
731,
29918,
14146,
1061,
29898,
1311,
29892,
1024,
29892,
775,
29918,
2248,
353,
29871,
29900,
29871,
1125,
13,
4706,
736,
1583,
3032,
842,
29918,
14146,
1061,
29898,
1311,
29889,
1177,
4330,
14345,
1299,
24125,
29961,
978,
1402,
775,
29918,
2248,
29897,
13,
268,
13,
1678,
822,
679,
29918,
14146,
1061,
29898,
1311,
29892,
775,
29918,
2248,
353,
29871,
29900,
1125,
13,
4706,
995,
29892,
1059,
353,
1583,
3032,
657,
29918,
14146,
1061,
29898,
401,
29918,
2248,
29897,
13,
4706,
363,
1820,
29892,
2380,
297,
1583,
29889,
1177,
4330,
14345,
1299,
24125,
29889,
7076,
7295,
13,
9651,
565,
995,
1275,
2380,
29901,
13,
18884,
736,
1820,
13,
4706,
736,
376,
9290,
29908,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
903,
842,
29918,
2929,
369,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
539,
13,
4706,
740,
29889,
1202,
9329,
877,
2929,
369,
29918,
978,
742,
26688,
2433,
29875,
742,
5305,
29922,
2220,
29889,
1177,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
7700,
13,
4706,
736,
740,
259,
13,
308,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
903,
657,
29918,
2929,
369,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
539,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
2929,
369,
29918,
978,
742,
26688,
2433,
29875,
742,
5305,
29922,
2220,
29889,
12015,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
7700,
13,
4706,
736,
740,
259,
13,
268,
13,
13,
1678,
317,
5607,
5348,
29903,
353,
8853,
9290,
1115,
29871,
29900,
29892,
376,
16121,
1115,
29871,
29896,
29892,
376,
2388,
575,
630,
1115,
29871,
29906,
29892,
376,
8336,
1115,
29871,
29941,
29913,
13,
1678,
822,
731,
29918,
2929,
369,
29898,
1311,
29892,
1024,
29892,
775,
29918,
2248,
353,
29871,
29900,
29871,
1125,
13,
4706,
736,
1583,
3032,
842,
29918,
2929,
369,
29898,
1311,
29889,
29903,
5607,
5348,
29903,
29961,
978,
1402,
775,
29918,
2248,
29897,
13,
268,
13,
1678,
822,
679,
29918,
2929,
369,
29898,
1311,
29892,
775,
29918,
2248,
353,
29871,
29900,
1125,
13,
4706,
995,
29892,
1059,
353,
1583,
3032,
657,
29918,
2929,
369,
29898,
401,
29918,
2248,
29897,
13,
4706,
363,
1820,
29892,
2380,
297,
1583,
29889,
29903,
5607,
5348,
29903,
29889,
7076,
7295,
13,
9651,
565,
995,
1275,
2380,
29901,
13,
18884,
736,
1820,
13,
4706,
736,
376,
9290,
29908,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
3150,
292,
29918,
2521,
29906,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
3150,
292,
29918,
2521,
29906,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
13,
18884,
6139,
353,
376,
3416,
29892,
278,
8718,
10696,
363,
5214,
278,
5447,
29901,
1546,
29871,
29900,
322,
29871,
29896,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
736,
740,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
731,
29918,
3150,
292,
29918,
2521,
29906,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
3150,
292,
29918,
2521,
29906,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
18884,
6139,
353,
376,
3416,
29892,
278,
8718,
10696,
363,
5214,
278,
5447,
29901,
1546,
29871,
29900,
322,
29871,
29896,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
736,
740,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
8961,
29906,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
9995,
13,
4706,
3617,
321,
3232,
29985,
29906,
29892,
263,
4964,
8333,
3443,
363,
26618,
1288,
7037,
29879,
411,
1298,
17105,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
5463,
29918,
26613,
1965,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
13,
9651,
6139,
353,
376,
5463,
29985,
29906,
29892,
263,
4964,
8333,
3443,
363,
26618,
1288,
7037,
29879,
411,
1298,
17105,
613,
13,
9651,
5190,
353,
302,
2587,
29918,
5205,
29889,
2848,
334,
302,
2587,
29918,
5205,
29889,
2848,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
278,
3443,
471,
27387,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
1033,
451,
10563,
3443,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
731,
29918,
8961,
29906,
7295,
13,
4706,
9995,
13,
4706,
3789,
321,
3232,
29985,
29906,
29892,
263,
4964,
8333,
3443,
363,
26618,
1288,
7037,
29879,
411,
1298,
17105,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
5463,
29918,
26613,
1965,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
9651,
6139,
353,
376,
5463,
29985,
29906,
29892,
263,
4964,
8333,
3443,
363,
26618,
1288,
7037,
29879,
411,
1298,
17105,
613,
13,
9651,
5190,
353,
302,
2587,
29918,
5205,
29889,
2848,
334,
302,
2587,
29918,
5205,
29889,
2848,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
278,
3443,
471,
731,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
1033,
451,
731,
3443,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
903,
842,
29918,
9917,
653,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
539,
13,
4706,
740,
29889,
1202,
9329,
877,
9917,
653,
29918,
978,
742,
26688,
2433,
29875,
742,
5305,
29922,
2220,
29889,
1177,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
7700,
13,
4706,
736,
740,
259,
13,
308,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
903,
657,
29918,
9917,
653,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
539,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
9917,
653,
29918,
978,
742,
26688,
2433,
29875,
742,
5305,
29922,
2220,
29889,
12015,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
7700,
13,
4706,
736,
740,
259,
13,
268,
13,
13,
1678,
16437,
18783,
1718,
29059,
353,
8853,
9290,
1115,
29871,
29900,
29892,
376,
3150,
1115,
29871,
29896,
29892,
376,
19145,
293,
1115,
29871,
29906,
29892,
376,
11360,
279,
1115,
29871,
29941,
29913,
13,
1678,
822,
731,
29918,
9917,
653,
29898,
1311,
29892,
1024,
29892,
775,
29918,
2248,
353,
29871,
29900,
29871,
1125,
13,
4706,
736,
1583,
3032,
842,
29918,
9917,
653,
29898,
1311,
29889,
8456,
18783,
1718,
29059,
29961,
978,
1402,
775,
29918,
2248,
29897,
13,
268,
13,
1678,
822,
679,
29918,
9917,
653,
29898,
1311,
29892,
775,
29918,
2248,
353,
29871,
29900,
1125,
13,
4706,
995,
29892,
1059,
353,
1583,
3032,
657,
29918,
9917,
653,
29898,
401,
29918,
2248,
29897,
13,
4706,
363,
1820,
29892,
2380,
297,
1583,
29889,
8456,
18783,
1718,
29059,
29889,
7076,
7295,
13,
9651,
565,
995,
1275,
2380,
29901,
13,
18884,
736,
1820,
13,
4706,
736,
376,
9290,
29908,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
9917,
653,
29918,
2311,
7295,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
9995,
13,
4706,
3617,
278,
2159,
310,
278,
24371,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
9917,
653,
29918,
2311,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
13,
9651,
6139,
353,
376,
9917,
653,
2159,
613,
13,
9651,
5190,
353,
302,
2587,
29918,
5205,
29889,
2848,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
278,
3443,
471,
27387,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
1033,
451,
10563,
3443,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
731,
29918,
9917,
653,
29918,
2311,
7295,
13,
4706,
9995,
13,
4706,
3789,
2159,
310,
278,
24371,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
9917,
653,
29918,
2311,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
9651,
6139,
353,
376,
9917,
653,
2159,
613,
13,
9651,
5190,
353,
302,
2587,
29918,
5205,
29889,
2848,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
278,
3443,
471,
731,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
1033,
451,
731,
3443,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
13,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
731,
29918,
2230,
29918,
10568,
7295,
13,
4706,
9995,
13,
4706,
10318,
5335,
342,
1022,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
9346,
342,
1022,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
9651,
6139,
353,
376,
9346,
342,
1022,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
5335,
342,
1022,
471,
3939,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
17765,
2556,
29918,
27548,
7295,
13,
4706,
9995,
13,
4706,
4649,
29878,
2418,
278,
1857,
7037,
5864,
310,
278,
1904,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
17765,
2556,
29918,
27548,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
13,
9651,
6139,
353,
376,
1576,
7037,
5864,
310,
278,
1904,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
9626,
995,
310,
278,
7037,
5864,
471,
731,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
20311,
7492,
7037,
1033,
451,
367,
4944,
13,
4706,
9995,
13,
4706,
736,
740,
13,
308,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
9089,
7492,
29918,
27548,
7295,
13,
4706,
9995,
13,
4706,
4649,
29878,
2418,
278,
1857,
19015,
7492,
5864,
310,
278,
1904,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
9089,
7492,
29918,
27548,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
13,
9651,
6139,
353,
376,
1576,
19015,
7492,
5864,
310,
278,
1904,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
9626,
995,
310,
278,
19015,
7492,
5864,
471,
731,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
20311,
7492,
5864,
1033,
451,
367,
4944,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
15220,
345,
29918,
4299,
7295,
13,
4706,
9995,
13,
4706,
382,
1555,
345,
278,
1904,
2745,
278,
2183,
931,
29892,
470,
2745,
263,
25480,
4195,
338,
731,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
2230,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
9651,
6139,
353,
376,
3195,
931,
304,
15220,
345,
278,
775,
304,
29889,
450,
1904,
674,
367,
376,
13,
18884,
376,
29872,
1555,
1490,
2745,
445,
931,
338,
7450,
3721,
470,
925,
1156,
23157,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
313,
4381,
448,
29896,
29892,
15220,
345,
599,
6757,
19123,
2322,
353,
448,
29896,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
736,
740,
13,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
2230,
7295,
13,
4706,
9995,
13,
4706,
4649,
29878,
2418,
278,
1904,
931,
29889,
910,
931,
881,
367,
3802,
304,
278,
1095,
931,
6790,
13,
4706,
297,
278,
15220,
345,
775,
29889,
1394,
29892,
746,
263,
22369,
471,
17809,
29892,
372,
674,
367,
278,
13,
4706,
1904,
931,
310,
278,
22369,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
2230,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
13,
9651,
6139,
353,
376,
1576,
1857,
1904,
931,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
9626,
995,
310,
278,
931,
471,
27387,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
450,
775,
947,
451,
505,
2304,
363,
2346,
292,
278,
931,
13,
4706,
9995,
13,
4706,
736,
740,
13,
308,
13,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
2230,
29918,
10568,
7295,
13,
4706,
9995,
13,
4706,
4649,
29878,
2418,
278,
1904,
5335,
342,
1022,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
401,
29918,
2248,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
3220,
310,
278,
775,
297,
337,
9917,
613,
2322,
353,
29871,
29900,
29897,
13,
4706,
740,
29889,
1202,
9329,
877,
2230,
29918,
10568,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
13,
9651,
6139,
353,
376,
1576,
1857,
1904,
5335,
342,
1022,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
9626,
995,
310,
278,
931,
4331,
471,
27387,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
450,
775,
947,
451,
505,
2304,
363,
2346,
292,
278,
931,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
716,
29918,
6484,
7295,
13,
4706,
9995,
13,
4706,
6204,
263,
716,
16445,
11306,
313,
392,
6590,
775,
467,
910,
11306,
674,
15220,
345,
409,
546,
2486,
515,
4045,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
5852,
13,
4706,
740,
29889,
1202,
9329,
877,
2248,
29918,
974,
29918,
1552,
29918,
6484,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
13,
9651,
9995,
13,
9651,
530,
2380,
9859,
304,
278,
15141,
2825,
11306,
13,
9651,
9995,
13,
9651,
1723,
13,
13,
4706,
740,
29889,
1202,
9329,
877,
2230,
29918,
10289,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
2481,
310,
278,
1788,
313,
4381,
29879,
304,
278,
1857,
1904,
931,
19123,
2322,
353,
448,
29896,
29897,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
29871,
29900,
448,
9280,
13,
9651,
775,
471,
2825,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
775,
1033,
451,
367,
2825,
15945,
29908,
13,
4706,
736,
740,
13,
308,
13,
308,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
3859,
7295,
13,
4706,
9995,
13,
4706,
4649,
29878,
2418,
278,
1857,
2106,
310,
263,
16445,
29889,
450,
334,
1195,
3039,
29930,
2472,
310,
263,
14781,
279,
13,
4706,
19753,
16445,
313,
25379,
29892,
11855,
29892,
2602,
322,
12885,
29897,
338,
4133,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
5852,
13,
4706,
740,
29889,
1202,
9329,
877,
2248,
29918,
974,
29918,
1552,
29918,
1595,
2512,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
9651,
6139,
353,
376,
3220,
310,
278,
16445,
304,
679,
278,
2106,
515,
29889,
910,
2380,
1818,
505,
1063,
4133,
491,
385,
8859,
1246,
304,
584,
29885,
621,
18078,
1482,
29918,
1595,
2512,
29952,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
25379,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
4158,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29916,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
2602,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29891,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
2602,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29920,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
2602,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29894,
29916,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
12885,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
13308,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
12885,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
29894,
29920,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
12885,
4608,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
13471,
742,
26688,
2433,
7411,
29953,
29946,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
11855,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
6484,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
11306,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
16445,
471,
6206,
515,
278,
1904,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
16445,
1033,
451,
367,
1476,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
679,
29918,
6484,
7295,
13,
4706,
9995,
13,
4706,
4649,
29878,
2418,
278,
11306,
2380,
310,
263,
16445,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
2248,
29918,
974,
29918,
1552,
29918,
1595,
2512,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
9651,
6139,
353,
376,
3220,
310,
278,
16445,
304,
679,
278,
11306,
310,
29889,
910,
2380,
1818,
505,
1063,
4133,
491,
385,
8859,
1246,
304,
584,
29885,
621,
18078,
1482,
29918,
1595,
2512,
29952,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
6484,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
12015,
29892,
6139,
353,
376,
1576,
1857,
11306,
310,
278,
16445,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
5852,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
16445,
471,
1476,
297,
278,
1904,
322,
278,
2472,
471,
22162,
2347,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
16445,
1033,
451,
367,
1476,
13,
4706,
9995,
13,
4706,
736,
740,
13,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
5040,
29918,
6484,
7295,
13,
4706,
9995,
13,
4706,
22303,
263,
11306,
775,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
5852,
13,
4706,
740,
29889,
1202,
9329,
877,
2248,
29918,
974,
29918,
1552,
29918,
6484,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
13,
9651,
9995,
13,
9651,
530,
2380,
9859,
304,
385,
5923,
11306,
13,
9651,
9995,
13,
9651,
1723,
13,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
29871,
29900,
448,
9280,
13,
9651,
11306,
15220,
1747,
471,
11084,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
11306,
15220,
1747,
471,
2307,
11084,
15945,
29908,
13,
4706,
736,
740,
13,
308,
13,
308,
13,
13,
1678,
732,
1397,
4135,
29918,
2220,
13,
1678,
822,
731,
29918,
6484,
7295,
13,
4706,
9995,
13,
4706,
4649,
29878,
2418,
278,
11306,
2380,
310,
263,
16445,
29889,
13,
4706,
9995,
13,
4706,
740,
353,
5682,
4135,
6678,
10299,
2450,
580,
13,
4706,
740,
29889,
1202,
9329,
877,
2248,
29918,
974,
29918,
1552,
29918,
1595,
2512,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
13,
9651,
6139,
353,
376,
3220,
310,
278,
16445,
304,
679,
278,
11306,
310,
29889,
910,
2380,
1818,
505,
1063,
4133,
491,
385,
8859,
1246,
304,
584,
29885,
621,
18078,
1482,
29918,
1595,
2512,
29952,
1159,
13,
4706,
740,
29889,
1202,
9329,
877,
6484,
742,
26688,
2433,
524,
29941,
29906,
742,
5305,
29922,
2220,
29889,
1177,
29892,
6139,
353,
376,
1576,
716,
11306,
310,
278,
16445,
29892,
408,
445,
338,
2869,
1303,
871,
445,
674,
4418,
565,
3939,
29991,
1159,
13,
4706,
740,
29889,
2914,
29918,
1853,
353,
525,
524,
29941,
29906,
29915,
13,
4706,
740,
29889,
3068,
29918,
8411,
29918,
2378,
353,
5852,
13,
4706,
740,
29889,
2914,
29918,
1514,
353,
9995,
13,
308,
29900,
448,
9280,
13,
9651,
16445,
471,
1476,
297,
278,
1904,
322,
278,
2472,
471,
22162,
2347,
13,
4706,
448,
29896,
448,
14431,
13,
9651,
16445,
1033,
451,
367,
1476,
13,
4706,
9995,
13,
4706,
736,
740,
13,
268,
13,
13,
13,
1990,
12936,
618,
29898,
29954,
5705,
277,
1288,
29928,
2926,
1199,
29892,
4989,
17037,
3073,
3399,
1125,
13,
13,
1678,
4770,
13248,
1649,
353,
12936,
618,
10448,
13,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3588,
29918,
29876,
2587,
353,
6213,
29892,
3579,
6768,
1125,
13,
4706,
1583,
29889,
7864,
3262,
29918,
1116,
2187,
353,
6639,
3262,
10983,
2187,
29898,
1311,
29897,
13,
13,
4706,
25000,
29918,
13248,
353,
1583,
17255,
13248,
12035,
1068,
6768,
29897,
13,
4706,
1583,
29889,
1397,
4135,
29918,
1514,
353,
25000,
29918,
13248,
17255,
1514,
1649,
13,
13,
4706,
4989,
29894,
277,
1288,
29928,
2926,
1199,
17255,
2344,
12035,
13,
9651,
1583,
29892,
13,
9651,
25000,
29918,
13248,
29892,
13,
9651,
3588,
29918,
29876,
2587,
29892,
13,
9651,
3579,
6768,
13,
4706,
1723,
13,
13,
268,
13,
1678,
822,
4529,
29918,
3859,
29898,
1311,
29892,
7834,
1125,
13,
4706,
4989,
29894,
277,
1288,
29928,
2926,
1199,
29889,
7922,
29918,
3859,
29898,
1311,
29892,
7834,
29897,
13,
4706,
396,
29954,
5705,
537,
3073,
3399,
29889,
7922,
29918,
3859,
29898,
1311,
29892,
7834,
29897,
13,
4706,
1583,
29889,
7864,
3262,
29918,
1116,
2187,
29889,
7922,
29918,
3859,
29898,
13789,
29897,
13,
308,
13,
4706,
7834,
29889,
1202,
29918,
5696,
877,
12378,
742,
525,
1482,
29918,
6484,
1495,
13,
4706,
7834,
29889,
1202,
29918,
5696,
877,
29934,
3904,
742,
525,
1482,
29918,
6484,
1495,
13,
308,
13,
13,
13,
1678,
822,
4529,
29918,
16744,
29898,
1311,
29892,
7834,
1125,
13,
4706,
1583,
29889,
7864,
3262,
29918,
1116,
2187,
29889,
7922,
29918,
16744,
29898,
13789,
29897,
13,
4706,
4989,
29894,
277,
1288,
29928,
2926,
1199,
29889,
7922,
29918,
16744,
29898,
1311,
29892,
7834,
29897,
13,
308,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29918,
15501,
29898,
13,
9651,
376,
657,
29918,
2230,
29918,
10568,
613,
13,
9651,
376,
842,
29918,
2230,
29918,
10568,
613,
13,
9651,
376,
9346,
342,
1022,
613,
13,
9651,
376,
23362,
5335,
342,
1022,
363,
12541,
613,
29871,
13,
9651,
2322,
29918,
1767,
353,
29871,
29900,
29889,
29900,
29900,
29900,
29896,
891,
302,
2587,
29918,
5205,
29889,
2230,
13,
4706,
1723,
13,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29918,
15501,
29898,
13,
9651,
376,
657,
29918,
14146,
1061,
613,
13,
9651,
376,
842,
29918,
14146,
1061,
613,
13,
9651,
376,
14146,
1061,
613,
13,
9651,
376,
978,
310,
278,
3990,
1061,
304,
671,
21313,
29900,
1800,
1642,
4830,
29898,
24582,
29898,
1311,
29889,
1177,
4330,
14345,
1299,
24125,
29889,
8149,
3101,
511,
29871,
13,
9651,
2322,
29918,
1767,
353,
376,
3173,
29896,
29945,
29908,
13,
4706,
1723,
13,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29918,
15501,
29898,
13,
9651,
376,
657,
29918,
2929,
369,
613,
13,
9651,
376,
842,
29918,
2929,
369,
613,
13,
9651,
376,
2929,
369,
613,
13,
9651,
376,
978,
310,
278,
20953,
899,
369,
304,
671,
21313,
29900,
1800,
1642,
4830,
29898,
24582,
29898,
1311,
29889,
29903,
5607,
5348,
29903,
29889,
8149,
3101,
511,
29871,
13,
9651,
2322,
29918,
1767,
353,
376,
2388,
575,
630,
29908,
13,
4706,
1723,
13,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29918,
15501,
29898,
13,
9651,
376,
657,
29918,
8961,
29906,
613,
13,
9651,
376,
842,
29918,
8961,
29906,
613,
13,
9651,
376,
5463,
29918,
26613,
1965,
613,
13,
9651,
376,
3844,
29877,
6046,
3443,
363,
20953,
17203,
613,
29871,
13,
9651,
2322,
29918,
1767,
353,
29871,
29900,
29889,
29900,
891,
302,
2587,
29918,
5205,
29889,
2848,
334,
302,
2587,
29918,
5205,
29889,
2848,
13,
4706,
1723,
13,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29918,
15501,
29898,
13,
9651,
376,
657,
29918,
3150,
292,
29918,
2521,
29906,
613,
13,
9651,
376,
842,
29918,
3150,
292,
29918,
2521,
29906,
613,
13,
9651,
376,
3150,
292,
29918,
2521,
29906,
613,
13,
9651,
376,
3150,
292,
10696,
29892,
278,
941,
29892,
363,
5214,
278,
5447,
297,
1206,
310,
5447,
899,
369,
29901,
1546,
29871,
29900,
322,
29871,
29896,
613,
29871,
13,
9651,
2322,
29918,
1767,
353,
29871,
29900,
29889,
29945,
13,
4706,
1723,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29918,
15501,
29898,
13,
9651,
376,
657,
29918,
9917,
653,
613,
13,
9651,
376,
842,
29918,
9917,
653,
613,
13,
9651,
376,
9917,
653,
613,
13,
9651,
376,
978,
310,
278,
10452,
1134,
304,
671,
21313,
29900,
1800,
313,
12403,
363,
5447,
899,
369,
29897,
1642,
4830,
29898,
24582,
29898,
1311,
29889,
8456,
18783,
1718,
29059,
29889,
8149,
3101,
511,
29871,
13,
9651,
2322,
29918,
1767,
353,
376,
9290,
29908,
13,
4706,
1723,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29918,
15501,
29898,
13,
9651,
376,
657,
29918,
9917,
653,
29918,
2311,
613,
13,
9651,
376,
842,
29918,
9917,
653,
29918,
2311,
613,
13,
9651,
376,
9917,
653,
29918,
2311,
613,
13,
9651,
376,
2311,
310,
278,
24371,
29892,
565,
278,
1134,
338,
451,
5642,
613,
29871,
13,
9651,
2322,
29918,
1767,
353,
29871,
29896,
29889,
29900,
891,
302,
2587,
29918,
5205,
29889,
2848,
13,
4706,
1723,
13,
13,
13,
13,
1678,
822,
4529,
29918,
23515,
29898,
1311,
29892,
7834,
1125,
13,
4706,
4989,
29894,
277,
1288,
29928,
2926,
1199,
29889,
7922,
29918,
23515,
29898,
1311,
29892,
7834,
29897,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
1482,
29918,
1595,
2512,
613,
13,
9651,
313,
13,
18884,
302,
2587,
29918,
5205,
29889,
25379,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
19322,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
19322,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
19322,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
7834,
29889,
6632,
29918,
3904,
1806,
29892,
13,
9651,
10353,
13,
9651,
313,
13,
18884,
7834,
29889,
27992,
29892,
13,
18884,
7834,
29889,
11432,
29918,
16524,
29892,
13,
9651,
1723,
13,
4706,
1723,
462,
462,
462,
462,
259,
13,
308,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
657,
29918,
17765,
2556,
29918,
27548,
613,
13,
9651,
313,
13789,
29889,
27992,
29892,
511,
13,
9651,
313,
29876,
2587,
29918,
5205,
29889,
25379,
334,
302,
2587,
29918,
5205,
29889,
2848,
3579,
29871,
29906,
29871,
334,
302,
2587,
29918,
5205,
29889,
2230,
3579,
448,
29906,
29892,
7834,
29889,
11432,
29918,
16524,
29892,
29897,
13,
4706,
1723,
13,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
657,
29918,
9089,
7492,
29918,
27548,
613,
13,
9651,
313,
13789,
29889,
27992,
29892,
511,
13,
9651,
313,
29876,
2587,
29918,
5205,
29889,
25379,
334,
302,
2587,
29918,
5205,
29889,
2848,
3579,
29871,
29906,
29871,
334,
302,
2587,
29918,
5205,
29889,
2230,
3579,
448,
29906,
29892,
7834,
29889,
11432,
29918,
16524,
29892,
29897,
13,
4706,
1723,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
525,
29872,
1555,
345,
29918,
4299,
742,
13,
9651,
313,
13,
18884,
302,
2587,
29918,
5205,
29889,
2230,
29892,
13,
18884,
7834,
29889,
27992,
13,
9651,
10353,
13,
9651,
313,
13,
18884,
7834,
29889,
11432,
29918,
16524,
29892,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
525,
657,
29918,
2230,
742,
13,
9651,
313,
13789,
29889,
27992,
29892,
511,
13,
9651,
313,
29876,
2587,
29918,
5205,
29889,
2230,
29892,
7834,
29889,
11432,
29918,
16524,
29892,
29897,
13,
4706,
1723,
13,
308,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
657,
29918,
2230,
29918,
10568,
613,
13,
9651,
313,
13789,
29889,
27992,
29892,
511,
13,
9651,
313,
29876,
2587,
29918,
5205,
29889,
2230,
29892,
7834,
29889,
11432,
29918,
16524,
29892,
29897,
13,
4706,
1723,
13,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
842,
29918,
2230,
29918,
10568,
613,
13,
9651,
313,
29876,
2587,
29918,
5205,
29889,
2230,
29892,
7834,
29889,
27992,
29892,
511,
13,
9651,
313,
13789,
29889,
11432,
29918,
16524,
29892,
29897,
13,
4706,
1723,
13,
308,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
657,
29918,
3859,
613,
13,
9651,
313,
13,
18884,
7834,
29889,
6632,
29918,
3904,
1806,
29892,
13,
9651,
10353,
13,
9651,
313,
13,
18884,
302,
2587,
29918,
5205,
29889,
25379,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
19322,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
19322,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
19322,
29892,
13,
18884,
302,
2587,
29918,
5205,
29889,
2848,
29892,
13,
18884,
7834,
29889,
6632,
29918,
3904,
1806,
29892,
13,
18884,
7834,
29889,
11432,
29918,
16524,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
657,
29918,
6484,
613,
13,
9651,
313,
13,
18884,
7834,
29889,
6632,
29918,
3904,
1806,
29892,
13,
9651,
10353,
13,
9651,
313,
13,
18884,
7834,
29889,
6632,
29918,
3904,
1806,
29892,
13,
18884,
7834,
29889,
11432,
29918,
16524,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
376,
842,
29918,
6484,
613,
13,
9651,
313,
13,
18884,
7834,
29889,
6632,
29918,
3904,
1806,
29892,
13,
18884,
7834,
29889,
6632,
29918,
3904,
1806,
29892,
13,
9651,
10353,
13,
9651,
313,
13,
462,
13,
18884,
7834,
29889,
11432,
29918,
16524,
29892,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
7834,
29889,
1202,
29918,
5696,
29898,
13,
9651,
525,
1482,
29918,
6484,
742,
13,
9651,
313,
13,
18884,
302,
2587,
29918,
5205,
29889,
2230,
29892,
13,
9651,
10353,
13,
9651,
313,
13,
18884,
7834,
29889,
27992,
29892,
13,
18884,
7834,
29889,
11432,
29918,
16524,
29892,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
1583,
29889,
7864,
3262,
29918,
1116,
2187,
29889,
7922,
29918,
23515,
29898,
13789,
29897,
13,
268,
13,
13,
13,
1678,
822,
4529,
29918,
1595,
2512,
29918,
7224,
29898,
1311,
29892,
7834,
1125,
13,
4706,
4989,
29894,
277,
1288,
29928,
2926,
1199,
29889,
7922,
29918,
1595,
2512,
29918,
7224,
29898,
1311,
29892,
7834,
29897,
13,
308,
13,
4706,
1583,
29889,
7864,
3262,
29918,
1116,
2187,
29889,
7922,
29918,
1595,
2512,
29918,
842,
29898,
13789,
29897,
13,
308,
13,
4706,
7834,
29889,
1202,
29918,
657,
357,
877,
1595,
4027,
742,
525,
657,
29918,
6484,
1495,
13,
4706,
7834,
29889,
1202,
29918,
842,
357,
877,
1595,
4027,
742,
525,
842,
29918,
6484,
1495,
13,
13,
2
] |
ports/esp32/modules/linefinder.py | AITT-VN/micropython | 0 | 135717 | from setting import *
from machine import Pin
S1_IN_S2_OUT = const(0)
S1_OUT_S2_IN = const(1)
S1_OUT_S2_OUT = const(2)
S1_IN_S2_IN = const(3)
class LineFinder:
def __init__(self):
pass
def _reset_port(self, port):
if port < 0 or port > 5:
print('Port not supported')
self.port = port
self.left_pin = Pin(PORTS_DIGITAL[port][0], mode=Pin.IN, pull=None)
self.right_pin = Pin(PORTS_DIGITAL[port][1], mode=Pin.IN, pull=None)
def read(self, port):
if port != self.port:
self._reset_port(port)
if self.left_pin.value() and not self.right_pin.value():
# detect line on left side
return S1_IN_S2_OUT
elif not self.left_pin.value() and self.right_pin.value():
# detect line on right side
return S1_OUT_S2_IN
elif not self.left_pin.value() and not self.right_pin.value():
# detect line on none side
return S1_OUT_S2_OUT
elif self.left_pin.value() and self.right_pin.value():
# detect line on both side
return S1_IN_S2_IN
else:
# detect error
return -1
line_finder = LineFinder() | [
1,
515,
4444,
1053,
334,
13,
3166,
4933,
1053,
17434,
13,
13,
29903,
29896,
29918,
1177,
29918,
29903,
29906,
29918,
12015,
353,
1040,
29898,
29900,
29897,
13,
29903,
29896,
29918,
12015,
29918,
29903,
29906,
29918,
1177,
353,
1040,
29898,
29896,
29897,
13,
29903,
29896,
29918,
12015,
29918,
29903,
29906,
29918,
12015,
353,
1040,
29898,
29906,
29897,
13,
29903,
29896,
29918,
1177,
29918,
29903,
29906,
29918,
1177,
353,
1040,
29898,
29941,
29897,
13,
13,
1990,
7407,
29943,
4995,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
903,
12071,
29918,
637,
29898,
1311,
29892,
2011,
1125,
13,
4706,
565,
2011,
529,
29871,
29900,
470,
2011,
1405,
29871,
29945,
29901,
13,
9651,
1596,
877,
2290,
451,
6969,
1495,
13,
4706,
1583,
29889,
637,
353,
2011,
13,
4706,
1583,
29889,
1563,
29918,
12687,
353,
17434,
29898,
15082,
29903,
29918,
4571,
29954,
1806,
1964,
29961,
637,
3816,
29900,
1402,
4464,
29922,
29925,
262,
29889,
1177,
29892,
8206,
29922,
8516,
29897,
13,
4706,
1583,
29889,
1266,
29918,
12687,
353,
17434,
29898,
15082,
29903,
29918,
4571,
29954,
1806,
1964,
29961,
637,
3816,
29896,
1402,
4464,
29922,
29925,
262,
29889,
1177,
29892,
8206,
29922,
8516,
29897,
13,
13,
1678,
822,
1303,
29898,
1311,
29892,
2011,
1125,
13,
4706,
565,
2011,
2804,
1583,
29889,
637,
29901,
13,
9651,
1583,
3032,
12071,
29918,
637,
29898,
637,
29897,
13,
13,
4706,
565,
1583,
29889,
1563,
29918,
12687,
29889,
1767,
580,
322,
451,
1583,
29889,
1266,
29918,
12687,
29889,
1767,
7295,
13,
9651,
396,
6459,
1196,
373,
2175,
2625,
13,
9651,
736,
317,
29896,
29918,
1177,
29918,
29903,
29906,
29918,
12015,
13,
4706,
25342,
451,
1583,
29889,
1563,
29918,
12687,
29889,
1767,
580,
322,
1583,
29889,
1266,
29918,
12687,
29889,
1767,
7295,
13,
9651,
396,
6459,
1196,
373,
1492,
2625,
13,
9651,
736,
317,
29896,
29918,
12015,
29918,
29903,
29906,
29918,
1177,
13,
4706,
25342,
451,
1583,
29889,
1563,
29918,
12687,
29889,
1767,
580,
322,
451,
1583,
29889,
1266,
29918,
12687,
29889,
1767,
7295,
13,
9651,
396,
6459,
1196,
373,
5642,
2625,
13,
9651,
736,
317,
29896,
29918,
12015,
29918,
29903,
29906,
29918,
12015,
13,
4706,
25342,
1583,
29889,
1563,
29918,
12687,
29889,
1767,
580,
322,
1583,
29889,
1266,
29918,
12687,
29889,
1767,
7295,
13,
9651,
396,
6459,
1196,
373,
1716,
2625,
13,
9651,
736,
317,
29896,
29918,
1177,
29918,
29903,
29906,
29918,
1177,
13,
4706,
1683,
29901,
13,
9651,
396,
6459,
1059,
13,
9651,
736,
448,
29896,
13,
13,
1220,
29918,
2886,
261,
353,
7407,
29943,
4995,
580,
2
] |
python/python_challenge/31/31.py | yunyu2019/blog | 0 | 92475 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# @Date : 2016-05-23 18:29:57
# @Author : Yunyu2019 (<EMAIL>)
# @Link : http://www.pythonchallenge.com/pc/ring/grandpa.html
#user:'kohsamui'
#password:'<PASSWORD>'
import Image
import requests
"""
req=requests.get('http://www.pythonchallenge.com/pc/rock/mandelbrot.gif',auth=('kohsamui','thailand'))
fp=open('mandelbrot.gif','wb')
fp.write(req.content)
fp.close()
"""
imgbase = Image.open('mandelbrot.gif')
img = imgbase.copy()
w,h=imgbase.size
left = 0.34
top = 0.57+0.027
width = 0.036
height = 0.027
nums = 128
diff = []
for j in range(h):
for i in range(w):
point0 = complex(left + i*width/w, top - (1+j)*height/h)
point = 0+0j
for k in range(nums):
point = point **2 + point0
if point.imag**2+point.real**2>4:
break
img.putpixel((i,j),k)
s=imgbase.getpixel((i,j))
if k!=s:
diff.append(k - s)
img.save('output.png')
img2 = Image.new('1',(23,73))
data=[i<0 for i in diff]
img2.putdata(data)
img2.save('output1.png')
#Arecibo message | [
1,
18787,
4855,
29914,
2109,
29914,
4691,
30004,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
29937,
732,
2539,
1678,
584,
29871,
29906,
29900,
29896,
29953,
29899,
29900,
29945,
29899,
29906,
29941,
29871,
29896,
29947,
29901,
29906,
29929,
29901,
29945,
29955,
30004,
13,
29937,
732,
13720,
29871,
584,
612,
348,
29891,
29884,
29906,
29900,
29896,
29929,
313,
29966,
26862,
6227,
29958,
8443,
13,
29937,
732,
6595,
1678,
584,
1732,
597,
1636,
29889,
4691,
305,
11768,
29889,
510,
29914,
6739,
29914,
5393,
29914,
27857,
3274,
29889,
1420,
30004,
13,
29937,
1792,
11283,
29895,
1148,
13445,
1481,
29915,
30004,
13,
29937,
5630,
11283,
29966,
25711,
17013,
16299,
30004,
13,
30004,
13,
5215,
7084,
30004,
13,
5215,
7274,
30004,
13,
30004,
13,
15945,
19451,
13,
7971,
29922,
24830,
29889,
657,
877,
1124,
597,
1636,
29889,
4691,
305,
11768,
29889,
510,
29914,
6739,
29914,
20821,
29914,
29885,
392,
295,
29890,
5450,
29889,
18660,
742,
5150,
29922,
877,
29895,
1148,
13445,
1481,
3788,
386,
26517,
8785,
30004,
13,
18091,
29922,
3150,
877,
29885,
392,
295,
29890,
5450,
29889,
18660,
3788,
29893,
29890,
1495,
30004,
13,
18091,
29889,
3539,
29898,
7971,
29889,
3051,
8443,
13,
18091,
29889,
5358,
26471,
13,
15945,
19451,
13,
30004,
13,
2492,
3188,
353,
7084,
29889,
3150,
877,
29885,
392,
295,
29890,
5450,
29889,
18660,
1495,
30004,
13,
2492,
353,
10153,
3188,
29889,
8552,
26471,
13,
29893,
29892,
29882,
29922,
2492,
3188,
29889,
2311,
30004,
13,
1563,
353,
29871,
29900,
29889,
29941,
29946,
30004,
13,
3332,
353,
29871,
29900,
29889,
29945,
29955,
29974,
29900,
29889,
29900,
29906,
29955,
30004,
13,
2103,
353,
29871,
29900,
29889,
29900,
29941,
29953,
30004,
13,
3545,
353,
29871,
29900,
29889,
29900,
29906,
29955,
30004,
13,
1949,
29879,
353,
29871,
29896,
29906,
29947,
30004,
13,
12765,
353,
5159,
30004,
13,
1454,
432,
297,
3464,
29898,
29882,
1125,
30004,
13,
1678,
363,
474,
297,
3464,
29898,
29893,
1125,
30004,
13,
4706,
1298,
29900,
353,
4280,
29898,
1563,
718,
474,
29930,
2103,
29914,
29893,
29892,
2246,
448,
313,
29896,
29974,
29926,
11877,
3545,
29914,
29882,
8443,
13,
4706,
1298,
353,
29871,
29900,
29974,
29900,
29926,
6756,
13,
4706,
363,
413,
297,
3464,
29898,
1949,
29879,
1125,
30004,
13,
9651,
1298,
353,
1298,
3579,
29906,
718,
1298,
29900,
30004,
13,
9651,
565,
1298,
29889,
326,
351,
1068,
29906,
29974,
3149,
29889,
6370,
1068,
29906,
29958,
29946,
29901,
30004,
13,
18884,
2867,
30004,
13,
4706,
10153,
29889,
649,
29886,
15711,
3552,
29875,
29892,
29926,
511,
29895,
8443,
13,
4706,
269,
29922,
2492,
3188,
29889,
657,
29886,
15711,
3552,
29875,
29892,
29926,
876,
30004,
13,
4706,
565,
413,
19216,
29879,
29901,
30004,
13,
9651,
2923,
29889,
4397,
29898,
29895,
448,
269,
8443,
13,
2492,
29889,
7620,
877,
4905,
29889,
2732,
1495,
30004,
13,
2492,
29906,
353,
7084,
29889,
1482,
877,
29896,
742,
29898,
29906,
29941,
29892,
29955,
29941,
876,
30004,
13,
1272,
11759,
29875,
29966,
29900,
363,
474,
297,
2923,
29962,
30004,
13,
2492,
29906,
29889,
649,
1272,
29898,
1272,
8443,
13,
2492,
29906,
29889,
7620,
877,
4905,
29896,
29889,
2732,
1495,
30004,
13,
29937,
29909,
4361,
833,
2643,
2
] |
app/__init__.py | jimmybutton/moviedb | 0 | 2989 | from flask import Flask
from config import Config
from sqlalchemy import MetaData
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
from flask_moment import Moment
from flask_misaka import Misaka
from flask_bootstrap import Bootstrap
import os
import logging
from logging.handlers import RotatingFileHandler
from elasticsearch import Elasticsearch
convention = {
"ix": 'ix_%(column_0_label)s',
"uq": "uq_%(table_name)s_%(column_0_name)s",
"ck": "ck_%(table_name)s_%(constraint_name)s",
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
"pk": "pk_%(table_name)s"
}
metadata = MetaData(naming_convention=convention)
db = SQLAlchemy(metadata=metadata)
migrate = Migrate()
login = LoginManager()
login.login_view = "auth.login"
moment = Moment()
md = Misaka()
bootstrap = Bootstrap()
def create_app(config_class=Config):
app = Flask(__name__)
app.config.from_object(Config)
db.init_app(app)
with app.app_context():
if db.engine.url.drivername == 'sqlite':
migrate.init_app(app, db, render_as_batch=True)
else:
migrate.init_app(app, db)
# migrate.init_app(app, db)
login.init_app(app)
moment.init_app(app)
md.init_app(app)
bootstrap.init_app(app)
from app.errors import bp as errors_bp
app.register_blueprint(errors_bp)
from app.auth import bp as auth_bp
app.register_blueprint(auth_bp, url_prefix='/auth')
from app.main import bp as main_bp
app.register_blueprint(main_bp)
from app.cli import bp as cli_bp
app.register_blueprint(cli_bp)
app.elasticsearch = Elasticsearch([app.config['ELASTICSEARCH_URL']]) \
if app.config['ELASTICSEARCH_URL'] else None
from app import models
if not app.debug and not app.testing:
if not os.path.exists("logs"):
os.mkdir("logs")
file_handler = RotatingFileHandler(
"logs/moviedb.log", maxBytes=10240, backupCount=10
)
file_handler.setFormatter(
logging.Formatter(
"%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]"
)
)
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)
app.logger.setLevel(logging.INFO)
app.logger.info("Moviedb startup")
return app
| [
1,
515,
29784,
1053,
2379,
1278,
13,
3166,
2295,
1053,
12782,
13,
3166,
4576,
284,
305,
6764,
1053,
20553,
1469,
13,
3166,
29784,
29918,
2850,
284,
305,
6764,
1053,
3758,
2499,
305,
6764,
13,
3166,
29784,
29918,
26983,
403,
1053,
341,
4481,
403,
13,
3166,
29784,
29918,
7507,
1053,
19130,
3260,
13,
3166,
29784,
29918,
29885,
2932,
1053,
341,
2932,
13,
3166,
29784,
29918,
26737,
8245,
1053,
20929,
8245,
13,
3166,
29784,
29918,
8704,
1053,
25746,
13,
5215,
2897,
13,
5215,
12183,
13,
3166,
12183,
29889,
3179,
9306,
1053,
9664,
1218,
2283,
4598,
13,
3166,
560,
20291,
1053,
1260,
20291,
13,
13,
535,
7316,
353,
426,
13,
1678,
376,
861,
1115,
525,
861,
29918,
29995,
29898,
4914,
29918,
29900,
29918,
1643,
29897,
29879,
742,
13,
1678,
376,
29884,
29939,
1115,
376,
29884,
29939,
29918,
29995,
29898,
2371,
29918,
978,
29897,
29879,
29918,
29995,
29898,
4914,
29918,
29900,
29918,
978,
29897,
29879,
613,
13,
1678,
376,
384,
1115,
376,
384,
29918,
29995,
29898,
2371,
29918,
978,
29897,
29879,
29918,
29995,
29898,
13646,
29918,
978,
29897,
29879,
613,
13,
1678,
376,
29888,
29895,
1115,
376,
29888,
29895,
29918,
29995,
29898,
2371,
29918,
978,
29897,
29879,
29918,
29995,
29898,
4914,
29918,
29900,
29918,
978,
29897,
29879,
29918,
29995,
29898,
276,
14373,
29918,
2371,
29918,
978,
29897,
29879,
613,
13,
1678,
376,
20571,
1115,
376,
20571,
29918,
29995,
29898,
2371,
29918,
978,
29897,
29879,
29908,
13,
29913,
13,
13,
19635,
353,
20553,
1469,
29898,
8588,
292,
29918,
535,
7316,
29922,
535,
7316,
29897,
13,
13,
2585,
353,
3758,
2499,
305,
6764,
29898,
19635,
29922,
19635,
29897,
13,
26983,
403,
353,
341,
4481,
403,
580,
13,
7507,
353,
19130,
3260,
580,
13,
7507,
29889,
7507,
29918,
1493,
353,
376,
5150,
29889,
7507,
29908,
13,
29885,
2932,
353,
341,
2932,
580,
13,
3487,
353,
20929,
8245,
580,
13,
8704,
353,
25746,
580,
13,
13,
1753,
1653,
29918,
932,
29898,
2917,
29918,
1990,
29922,
3991,
1125,
13,
1678,
623,
353,
2379,
1278,
22168,
978,
1649,
29897,
13,
1678,
623,
29889,
2917,
29889,
3166,
29918,
3318,
29898,
3991,
29897,
13,
13,
1678,
4833,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
411,
623,
29889,
932,
29918,
4703,
7295,
13,
4706,
565,
4833,
29889,
10599,
29889,
2271,
29889,
9465,
978,
1275,
525,
22793,
2396,
13,
9651,
9725,
403,
29889,
2344,
29918,
932,
29898,
932,
29892,
4833,
29892,
4050,
29918,
294,
29918,
16175,
29922,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
9725,
403,
29889,
2344,
29918,
932,
29898,
932,
29892,
4833,
29897,
13,
1678,
396,
9725,
403,
29889,
2344,
29918,
932,
29898,
932,
29892,
4833,
29897,
13,
1678,
6464,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
3256,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
22821,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
1678,
16087,
29889,
2344,
29918,
932,
29898,
932,
29897,
13,
13,
1678,
515,
623,
29889,
12523,
1053,
289,
29886,
408,
4436,
29918,
25288,
13,
1678,
623,
29889,
9573,
29918,
9539,
2158,
29898,
12523,
29918,
25288,
29897,
13,
13,
1678,
515,
623,
29889,
5150,
1053,
289,
29886,
408,
4817,
29918,
25288,
13,
1678,
623,
29889,
9573,
29918,
9539,
2158,
29898,
5150,
29918,
25288,
29892,
3142,
29918,
13506,
2433,
29914,
5150,
1495,
13,
13,
1678,
515,
623,
29889,
3396,
1053,
289,
29886,
408,
1667,
29918,
25288,
13,
1678,
623,
29889,
9573,
29918,
9539,
2158,
29898,
3396,
29918,
25288,
29897,
13,
13,
1678,
515,
623,
29889,
11303,
1053,
289,
29886,
408,
9335,
29918,
25288,
13,
1678,
623,
29889,
9573,
29918,
9539,
2158,
29898,
11303,
29918,
25288,
29897,
13,
13,
1678,
623,
29889,
295,
20291,
353,
1260,
20291,
4197,
932,
29889,
2917,
1839,
29923,
4375,
1254,
2965,
1660,
1718,
3210,
29918,
4219,
2033,
2314,
320,
13,
4706,
565,
623,
29889,
2917,
1839,
29923,
4375,
1254,
2965,
1660,
1718,
3210,
29918,
4219,
2033,
1683,
6213,
13,
13,
1678,
515,
623,
1053,
4733,
13,
13,
1678,
565,
451,
623,
29889,
8382,
322,
451,
623,
29889,
13424,
29901,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
703,
20756,
29908,
1125,
13,
9651,
2897,
29889,
11256,
3972,
703,
20756,
1159,
13,
4706,
934,
29918,
13789,
353,
9664,
1218,
2283,
4598,
29898,
13,
9651,
376,
20756,
29914,
13529,
1000,
29890,
29889,
1188,
613,
4236,
11207,
29922,
29896,
29900,
29906,
29946,
29900,
29892,
16199,
3981,
29922,
29896,
29900,
13,
4706,
1723,
13,
4706,
934,
29918,
13789,
29889,
842,
18522,
29898,
13,
9651,
12183,
29889,
18522,
29898,
13,
18884,
11860,
29898,
294,
312,
603,
29897,
29879,
1273,
29898,
5563,
978,
29897,
29879,
29901,
1273,
29898,
4906,
29897,
29879,
518,
262,
1273,
29898,
2084,
978,
29897,
29879,
16664,
29898,
1915,
8154,
29897,
29881,
18017,
13,
9651,
1723,
13,
4706,
1723,
13,
4706,
934,
29918,
13789,
29889,
842,
10108,
29898,
21027,
29889,
11690,
29897,
13,
4706,
623,
29889,
21707,
29889,
1202,
4598,
29898,
1445,
29918,
13789,
29897,
13,
13,
4706,
623,
29889,
21707,
29889,
842,
10108,
29898,
21027,
29889,
11690,
29897,
13,
4706,
623,
29889,
21707,
29889,
3888,
703,
29924,
586,
1000,
29890,
20234,
1159,
13,
268,
13,
1678,
736,
623,
13,
2
] |
run.py | mcarans/hdx-scraper-unesco | 0 | 66563 | <reponame>mcarans/hdx-scraper-unesco<filename>run.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Top level script. Calls other functions that generate datasets that this script then creates in HDX.
"""
import logging
from os.path import join, expanduser
from timeit import default_timer
from hdx.hdx_configuration import Configuration
from hdx.utilities.downloader import Download
from hdx.utilities.path import temp_dir
from unesco import generate_dataset_and_showcase, get_countriesdata, get_endpoints_metadata
from hdx.facades.simple import facade
logger = logging.getLogger(__name__)
lookup = 'hdx-scraper-unesco'
def main():
"""Generate dataset and create it in HDX"""
base_url = Configuration.read()['base_url']
with temp_dir('UNESCO') as folder:
with Download(extra_params_yaml=join(expanduser('~'), '.extraparams.yml'), extra_params_lookup=lookup) as downloader:
endpoints = Configuration.read()['endpoints']
endpoints_metadata = get_endpoints_metadata(base_url, downloader, endpoints)
countriesdata = get_countriesdata(base_url, downloader)
logger.info('Number of datasets to upload: %d' % len(countriesdata))
for countrydata in countriesdata:
for dataset, showcase in generate_dataset_and_showcase(downloader, countrydata, endpoints_metadata, folder=folder, merge_resources=True, single_dataset=False): # TODO: fix folder
if dataset:
dataset.update_from_yaml()
start = default_timer()
dataset.create_in_hdx(remove_additional_resources=True, hxl_update=False)
print("total time = %d" % (default_timer() - start))
resources = dataset.get_resources()
resource_ids = [x['id'] for x in sorted(resources, key=lambda x: x['name'], reverse=False)]
dataset.reorder_resources(resource_ids, hxl_update=False)
showcase.create_in_hdx()
showcase.add_dataset(dataset)
if __name__ == '__main__':
facade(main, user_agent_config_yaml=join(expanduser('~'), '.useragents.yml'), user_agent_lookup=lookup, project_config_yaml=join('config', 'project_configuration.yml'))
| [
1,
529,
276,
1112,
420,
29958,
29885,
4287,
550,
29914,
29882,
8235,
29899,
1557,
336,
546,
29899,
7844,
1111,
29966,
9507,
29958,
3389,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
7031,
3233,
2471,
29889,
315,
4293,
916,
3168,
393,
5706,
20035,
393,
445,
2471,
769,
10017,
297,
18435,
29990,
29889,
13,
13,
15945,
29908,
13,
5215,
12183,
13,
3166,
2897,
29889,
2084,
1053,
5988,
29892,
7985,
1792,
13,
3166,
931,
277,
1053,
2322,
29918,
20404,
13,
13,
3166,
298,
8235,
29889,
29882,
8235,
29918,
13305,
1053,
20999,
13,
3166,
298,
8235,
29889,
4422,
1907,
29889,
10382,
261,
1053,
25553,
13,
3166,
298,
8235,
29889,
4422,
1907,
29889,
2084,
1053,
5694,
29918,
3972,
13,
13,
3166,
443,
267,
1111,
1053,
5706,
29918,
24713,
29918,
392,
29918,
4294,
4878,
29892,
679,
29918,
2798,
2722,
1272,
29892,
679,
29918,
355,
9748,
29918,
19635,
13,
13,
3166,
298,
8235,
29889,
17470,
3076,
29889,
12857,
1053,
4024,
1943,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
20401,
353,
525,
29882,
8235,
29899,
1557,
336,
546,
29899,
7844,
1111,
29915,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
9995,
5631,
403,
8783,
322,
1653,
372,
297,
18435,
29990,
15945,
29908,
13,
13,
1678,
2967,
29918,
2271,
353,
20999,
29889,
949,
580,
1839,
3188,
29918,
2271,
2033,
13,
1678,
411,
5694,
29918,
3972,
877,
3904,
2890,
3217,
1495,
408,
4138,
29901,
13,
4706,
411,
25553,
29898,
17833,
29918,
7529,
29918,
25162,
29922,
7122,
29898,
18837,
1792,
877,
30022,
5477,
15300,
17833,
7529,
29889,
21053,
5477,
4805,
29918,
7529,
29918,
20401,
29922,
20401,
29897,
408,
5142,
261,
29901,
13,
9651,
1095,
9748,
353,
20999,
29889,
949,
580,
1839,
355,
9748,
2033,
13,
9651,
1095,
9748,
29918,
19635,
353,
679,
29918,
355,
9748,
29918,
19635,
29898,
3188,
29918,
2271,
29892,
5142,
261,
29892,
1095,
9748,
29897,
13,
9651,
10916,
1272,
353,
679,
29918,
2798,
2722,
1272,
29898,
3188,
29918,
2271,
29892,
5142,
261,
29897,
13,
13,
9651,
17927,
29889,
3888,
877,
4557,
310,
20035,
304,
6441,
29901,
1273,
29881,
29915,
1273,
7431,
29898,
2798,
2722,
1272,
876,
13,
13,
9651,
363,
4234,
1272,
297,
10916,
1272,
29901,
13,
18884,
363,
8783,
29892,
1510,
4878,
297,
5706,
29918,
24713,
29918,
392,
29918,
4294,
4878,
29898,
10382,
261,
29892,
4234,
1272,
29892,
1095,
9748,
29918,
19635,
29892,
4138,
29922,
12083,
29892,
10366,
29918,
13237,
29922,
5574,
29892,
2323,
29918,
24713,
29922,
8824,
1125,
396,
14402,
29901,
2329,
4138,
13,
462,
1678,
565,
8783,
29901,
13,
462,
4706,
8783,
29889,
5504,
29918,
3166,
29918,
25162,
580,
13,
462,
4706,
1369,
353,
2322,
29918,
20404,
580,
13,
462,
4706,
8783,
29889,
3258,
29918,
262,
29918,
29882,
8235,
29898,
5992,
29918,
1202,
3245,
29918,
13237,
29922,
5574,
29892,
298,
15524,
29918,
5504,
29922,
8824,
29897,
13,
462,
4706,
1596,
703,
7827,
931,
353,
1273,
29881,
29908,
1273,
313,
4381,
29918,
20404,
580,
448,
1369,
876,
13,
462,
4706,
7788,
353,
8783,
29889,
657,
29918,
13237,
580,
13,
462,
4706,
6503,
29918,
4841,
353,
518,
29916,
1839,
333,
2033,
363,
921,
297,
12705,
29898,
13237,
29892,
1820,
29922,
2892,
921,
29901,
921,
1839,
978,
7464,
11837,
29922,
8824,
4638,
13,
462,
4706,
8783,
29889,
276,
2098,
29918,
13237,
29898,
10314,
29918,
4841,
29892,
298,
15524,
29918,
5504,
29922,
8824,
29897,
13,
462,
4706,
1510,
4878,
29889,
3258,
29918,
262,
29918,
29882,
8235,
580,
13,
462,
4706,
1510,
4878,
29889,
1202,
29918,
24713,
29898,
24713,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4024,
1943,
29898,
3396,
29892,
1404,
29918,
14748,
29918,
2917,
29918,
25162,
29922,
7122,
29898,
18837,
1792,
877,
30022,
5477,
15300,
1792,
351,
1237,
29889,
21053,
5477,
1404,
29918,
14748,
29918,
20401,
29922,
20401,
29892,
2060,
29918,
2917,
29918,
25162,
29922,
7122,
877,
2917,
742,
525,
4836,
29918,
13305,
29889,
21053,
8785,
13,
13,
2
] |
dist/assets/rename.py | shubham-shinde/Apstract_poker | 0 | 57870 | <filename>dist/assets/rename.py<gh_stars>0
# Pythono3 code to rename multiple
# files in a directory or folder
# importing os module
import os
# Function to rename multiple files
def main():
i = 0
for filename in os.listdir("Cards"):
# dst ="Hostel" + str(i) + ".jpg"
src ='Cards/'+ filename
dst ='Cards/'+ filename[6: ]
print(src)
# rename() function will
# rename all the files
os.rename(src, dst)
i += 1
# Driver Code
if __name__ == '__main__':
# Calling main() function
main() | [
1,
529,
9507,
29958,
5721,
29914,
16596,
29914,
1267,
420,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
5132,
29877,
29941,
775,
304,
19508,
2999,
259,
13,
29937,
2066,
297,
263,
3884,
470,
4138,
29871,
13,
259,
13,
29937,
28348,
2897,
3883,
29871,
13,
5215,
2897,
29871,
13,
259,
13,
29937,
6680,
304,
19508,
2999,
2066,
29871,
13,
1753,
1667,
7295,
29871,
13,
1678,
474,
353,
29871,
29900,
13,
539,
13,
1678,
363,
10422,
297,
2897,
29889,
1761,
3972,
703,
29907,
3163,
29908,
1125,
29871,
13,
4706,
396,
29743,
29465,
8514,
295,
29908,
718,
851,
29898,
29875,
29897,
718,
11393,
6173,
29908,
13,
4706,
4765,
353,
29915,
29907,
3163,
29914,
18717,
10422,
29871,
13,
4706,
29743,
353,
29915,
29907,
3163,
29914,
18717,
10422,
29961,
29953,
29901,
4514,
29871,
13,
4706,
1596,
29898,
4351,
29897,
13,
4706,
396,
19508,
580,
740,
674,
29871,
13,
4706,
396,
19508,
599,
278,
2066,
29871,
13,
4706,
2897,
29889,
1267,
420,
29898,
4351,
29892,
29743,
29897,
29871,
13,
4706,
474,
4619,
29871,
29896,
13,
259,
13,
29937,
26391,
5920,
29871,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
29871,
13,
539,
13,
1678,
396,
8251,
292,
1667,
580,
740,
29871,
13,
1678,
1667,
580,
29871,
2
] |
ckanext/ckanext-basiccharts/ckanext/basiccharts/tests/test_view.py | cascaoSDC/ckan | 0 | 142337 | <filename>ckanext/ckanext-basiccharts/ckanext/basiccharts/tests/test_view.py
import os
import inspect
import mock
import nose.tools
import pylons.config as config
import ckan.plugins as p
import ckanext.basiccharts
class TestBaseChart(object):
@classmethod
def setup_class(cls):
cls.plugin = ckanext.basiccharts.plugin.BaseChart()
@nose.tools.raises(p.PluginNotFoundException)
def test_plugin_cant_be_loaded(self):
p.load('basechart')
def test_chart_type(self):
assert self.plugin.CHART_TYPE == 'base', '"CHART_TYPE" should be "base"'
def test_group_by_is_required(self):
assert self.plugin.GROUP_BY_IS_REQUIRED == False, '"GROUP_BY_IS_REQUIRED" should be false'
def test_plugin_templates_path_is_added_to_config(self):
filename = inspect.getfile(inspect.currentframe())
path = os.path.dirname(filename)
templates_path = os.path.abspath(path + "/../theme/templates")
assert templates_path in config['extra_template_paths'], templates_path
def test_can_view_only_if_datastore_is_active(self):
active_datastore_data_dict = {
'resource': { 'datastore_active': True }
}
inactive_datastore_data_dict = {
'resource': { 'datastore_active': False }
}
assert self.plugin.can_view(active_datastore_data_dict)
assert not self.plugin.can_view(inactive_datastore_data_dict)
def test_schema_exists(self):
schema = self.plugin.info()['schema']
assert schema is not None, 'Plugin should define schema'
def test_schema_has_y_axis(self):
schema = self.plugin.info()['schema']
assert schema.get('y_axis') is not None, 'Schema should define "y_axis"'
def test_schema_y_axis_is_required(self):
schema = self.plugin.info()['schema']
not_empty = p.toolkit.get_validator('not_empty')
assert not_empty in schema['y_axis'], '"y_axis" should be required'
def test_schema_has_group_by(self):
schema = self.plugin.info()['schema']
assert schema.get('group_by') is not None, 'Schema should define "group_by"'
def test_schema_group_by_doesnt_validate_if_group_by_isnt_required(self):
original_value = self.plugin.GROUP_BY_IS_REQUIRED
self.plugin.GROUP_BY_IS_REQUIRED = False
schema = self.plugin.info()['schema']
self.plugin.GROUP_BY_IS_REQUIRED = original_value
ignore_missing = p.toolkit.get_validator('ignore_missing')
assert ignore_missing in schema['group_by'], '"group_by" should ignore missing'
def test_schema_group_by_is_required_if_group_by_is_required(self):
original_value = self.plugin.GROUP_BY_IS_REQUIRED
self.plugin.GROUP_BY_IS_REQUIRED = True
schema = self.plugin.info()['schema']
self.plugin.GROUP_BY_IS_REQUIRED = original_value
not_empty = p.toolkit.get_validator('not_empty')
assert not_empty in schema['group_by'], '"group_by" should be required'
def test_schema_has_show_legends(self):
schema = self.plugin.info()['schema']
assert schema.get('show_legends') is not None, 'Schema should define "show_legends"'
def test_schema_show_legends_doesnt_validate(self):
schema = self.plugin.info()['schema']
ignore_missing = p.toolkit.get_validator('ignore_missing')
assert ignore_missing in schema['show_legends'], '"show_legends" should ignore missing'
def test_plugin_isnt_iframed(self):
iframed = self.plugin.info().get('iframed', True)
assert not iframed, 'Plugin should not be iframed'
def test_plugin_is_filterable(self):
filterable = self.plugin.info().get('filterable', False)
assert filterable, 'Plugin should be filterable'
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_resource(self, _):
resource = {
'id': 'resource_id',
'other_attribute': 'value'
}
template_variables = self._setup_template_variables(resource)
assert 'resource' in template_variables
assert template_variables['resource'] == resource
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_resource_view(self, _):
resource_view = {
'id': 'resource_id',
'other_attribute': 'value'
}
template_variables = \
self._setup_template_variables(resource_view=resource_view)
assert 'resource_view' in template_variables
assert template_variables['resource_view'] == resource_view
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_show_legends_as_true_if_it_was_defined(self, _):
template_variables = self._setup_template_variables(resource_view={'show_legends': 'True'})
show_legends = template_variables['resource_view']['show_legends']
assert show_legends is True, show_legends
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_show_legends_as_false_if_it_was_undefined(self, _):
template_variables = self._setup_template_variables(resource_view={})
show_legends = template_variables['resource_view']['show_legends']
assert show_legends is False, show_legends
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_fields_without_the_id(self, get_action):
fields = [
{'id': '_id', 'type': 'int4'},
{'id': 'price', 'type': 'numeric'},
]
expected_fields = [{'value': 'price'}]
get_action.return_value.return_value = {
'fields': fields,
'records': {}
}
template_variables = self._setup_template_variables()
returned_fields = template_variables.get('fields')
assert returned_fields is not None
assert returned_fields == expected_fields
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_chart_type(self, _):
template_variables = self._setup_template_variables()
assert 'chart_type' in template_variables
assert template_variables['chart_type'] == self.plugin.CHART_TYPE
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_defines_group_by_is_required_correctly(self, _):
template_variables = self._setup_template_variables()
assert 'group_by_is_required' in template_variables
assert template_variables['group_by_is_required'] == self.plugin.GROUP_BY_IS_REQUIRED
def _setup_template_variables(self, resource={'id': 'id'}, resource_view={}):
context = {}
data_dict = {
'resource': resource,
'resource_view': resource_view
}
return self.plugin.setup_template_variables(context, data_dict)
class TestLineChart(TestBaseChart):
@classmethod
def setup_class(cls):
p.load('linechart')
cls.plugin = p.get_plugin('linechart')
@classmethod
def teardown_class(cls):
p.unload('linechart')
def test_schema_has_x_axis(self):
schema = self.plugin.info()['schema']
assert schema.get('x_axis') is not None, 'Schema should define "x_axis"'
def test_schema_x_axis_is_required(self):
schema = self.plugin.info()['schema']
not_empty = p.toolkit.get_validator('not_empty')
assert not_empty in schema['x_axis'], '"x_axis" should be required'
def test_chart_type(self):
assert self.plugin.CHART_TYPE == 'lines', '"CHART_TYPE" should be "lines"'
class TestBarChart(TestLineChart):
@classmethod
def setup_class(cls):
p.load('barchart')
cls.plugin = p.get_plugin('barchart')
@classmethod
def teardown_class(cls):
p.unload('barchart')
def test_schema_has_horizontal(self):
schema = self.plugin.info()['schema']
assert schema.get('horizontal') is not None, 'Schema should define "horizontal"'
def test_schema_horizontal_doesnt_validate(self):
schema = self.plugin.info()['schema']
ignore_missing = p.toolkit.get_validator('ignore_missing')
assert ignore_missing in schema['horizontal'], '"horizontal" should ignore missing'
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_horizontal_as_true_if_it_was_defined(self, _):
template_variables = self._setup_template_variables(resource_view={'horizontal': 'True'})
horizontal = template_variables['resource_view']['horizontal']
assert horizontal is True, horizontal
@mock.patch('ckan.plugins.toolkit.get_action')
def test_setup_template_variables_adds_horizontal_as_false_if_it_was_undefined(self, _):
template_variables = self._setup_template_variables(resource_view={})
horizontal = template_variables['resource_view']['horizontal']
assert horizontal is False, horizontal
def test_chart_type(self):
assert self.plugin.CHART_TYPE == 'bars', '"CHART_TYPE" should be "bars"'
class TestPieChart(TestBaseChart):
@classmethod
def setup_class(cls):
p.load('piechart')
cls.plugin = p.get_plugin('piechart')
@classmethod
def teardown_class(cls):
p.unload('piechart')
def test_chart_type(self):
assert self.plugin.CHART_TYPE == 'pie', '"CHART_TYPE" should be "pie"'
def test_group_by_is_required(self):
assert self.plugin.GROUP_BY_IS_REQUIRED == True, '"GROUP_BY_IS_REQUIRED" should be true'
| [
1,
529,
9507,
29958,
384,
273,
1062,
29914,
384,
273,
1062,
29899,
16121,
18366,
29914,
384,
273,
1062,
29914,
16121,
18366,
29914,
21150,
29914,
1688,
29918,
1493,
29889,
2272,
13,
5215,
2897,
13,
5215,
16096,
13,
5215,
11187,
13,
5215,
26414,
29889,
8504,
13,
5215,
282,
2904,
787,
29889,
2917,
408,
2295,
13,
13,
5215,
274,
11052,
29889,
12800,
408,
282,
13,
13,
5215,
274,
11052,
1062,
29889,
16121,
18366,
13,
13,
13,
1990,
4321,
5160,
14732,
29898,
3318,
1125,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
6230,
29918,
1990,
29898,
25932,
1125,
13,
4706,
1067,
29879,
29889,
8582,
353,
274,
11052,
1062,
29889,
16121,
18366,
29889,
8582,
29889,
5160,
14732,
580,
13,
13,
1678,
732,
29876,
852,
29889,
8504,
29889,
336,
4637,
29898,
29886,
29889,
16288,
17413,
2451,
29897,
13,
1678,
822,
1243,
29918,
8582,
29918,
29883,
424,
29918,
915,
29918,
15638,
29898,
1311,
1125,
13,
4706,
282,
29889,
1359,
877,
3188,
15425,
1495,
13,
13,
1678,
822,
1243,
29918,
15425,
29918,
1853,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
8582,
29889,
3210,
8322,
29918,
11116,
1275,
525,
3188,
742,
18793,
3210,
8322,
29918,
11116,
29908,
881,
367,
376,
3188,
29908,
29915,
13,
13,
1678,
822,
1243,
29918,
2972,
29918,
1609,
29918,
275,
29918,
12403,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
1275,
7700,
29892,
18793,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
29908,
881,
367,
2089,
29915,
13,
13,
1678,
822,
1243,
29918,
8582,
29918,
20943,
29918,
2084,
29918,
275,
29918,
23959,
29918,
517,
29918,
2917,
29898,
1311,
1125,
13,
4706,
10422,
353,
16096,
29889,
657,
1445,
29898,
1144,
1103,
29889,
3784,
2557,
3101,
13,
4706,
2224,
353,
2897,
29889,
2084,
29889,
25721,
29898,
9507,
29897,
13,
4706,
17475,
29918,
2084,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
2084,
718,
5591,
6995,
18193,
29914,
20943,
1159,
13,
13,
4706,
4974,
17475,
29918,
2084,
297,
2295,
1839,
17833,
29918,
6886,
29918,
24772,
7464,
17475,
29918,
2084,
13,
13,
1678,
822,
1243,
29918,
3068,
29918,
1493,
29918,
6194,
29918,
361,
29918,
4130,
579,
487,
29918,
275,
29918,
4925,
29898,
1311,
1125,
13,
4706,
6136,
29918,
4130,
579,
487,
29918,
1272,
29918,
8977,
353,
426,
13,
9651,
525,
10314,
2396,
426,
525,
4130,
579,
487,
29918,
4925,
2396,
5852,
500,
13,
4706,
500,
13,
4706,
297,
4925,
29918,
4130,
579,
487,
29918,
1272,
29918,
8977,
353,
426,
13,
9651,
525,
10314,
2396,
426,
525,
4130,
579,
487,
29918,
4925,
2396,
7700,
500,
13,
4706,
500,
13,
4706,
4974,
1583,
29889,
8582,
29889,
3068,
29918,
1493,
29898,
4925,
29918,
4130,
579,
487,
29918,
1272,
29918,
8977,
29897,
13,
4706,
4974,
451,
1583,
29889,
8582,
29889,
3068,
29918,
1493,
29898,
262,
4925,
29918,
4130,
579,
487,
29918,
1272,
29918,
8977,
29897,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
9933,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
4974,
10938,
338,
451,
6213,
29892,
525,
16288,
881,
4529,
10938,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
5349,
29918,
29891,
29918,
8990,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
4974,
10938,
29889,
657,
877,
29891,
29918,
8990,
1495,
338,
451,
6213,
29892,
525,
12763,
881,
4529,
376,
29891,
29918,
8990,
29908,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
29891,
29918,
8990,
29918,
275,
29918,
12403,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
451,
29918,
6310,
353,
282,
29889,
10154,
7354,
29889,
657,
29918,
3084,
1061,
877,
1333,
29918,
6310,
1495,
13,
4706,
4974,
451,
29918,
6310,
297,
10938,
1839,
29891,
29918,
8990,
7464,
18793,
29891,
29918,
8990,
29908,
881,
367,
3734,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
5349,
29918,
2972,
29918,
1609,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
4974,
10938,
29889,
657,
877,
2972,
29918,
1609,
1495,
338,
451,
6213,
29892,
525,
12763,
881,
4529,
376,
2972,
29918,
1609,
29908,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
2972,
29918,
1609,
29918,
13221,
593,
29918,
15480,
29918,
361,
29918,
2972,
29918,
1609,
29918,
275,
593,
29918,
12403,
29898,
1311,
1125,
13,
4706,
2441,
29918,
1767,
353,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
13,
4706,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
353,
7700,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
353,
2441,
29918,
1767,
13,
4706,
11455,
29918,
27259,
353,
282,
29889,
10154,
7354,
29889,
657,
29918,
3084,
1061,
877,
17281,
29918,
27259,
1495,
13,
4706,
4974,
11455,
29918,
27259,
297,
10938,
1839,
2972,
29918,
1609,
7464,
18793,
2972,
29918,
1609,
29908,
881,
11455,
4567,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
2972,
29918,
1609,
29918,
275,
29918,
12403,
29918,
361,
29918,
2972,
29918,
1609,
29918,
275,
29918,
12403,
29898,
1311,
1125,
13,
4706,
2441,
29918,
1767,
353,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
13,
4706,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
353,
5852,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
353,
2441,
29918,
1767,
13,
4706,
451,
29918,
6310,
353,
282,
29889,
10154,
7354,
29889,
657,
29918,
3084,
1061,
877,
1333,
29918,
6310,
1495,
13,
4706,
4974,
451,
29918,
6310,
297,
10938,
1839,
2972,
29918,
1609,
7464,
18793,
2972,
29918,
1609,
29908,
881,
367,
3734,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
5349,
29918,
4294,
29918,
1397,
1975,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
4974,
10938,
29889,
657,
877,
4294,
29918,
1397,
1975,
1495,
338,
451,
6213,
29892,
525,
12763,
881,
4529,
376,
4294,
29918,
1397,
1975,
29908,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
4294,
29918,
1397,
1975,
29918,
13221,
593,
29918,
15480,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
11455,
29918,
27259,
353,
282,
29889,
10154,
7354,
29889,
657,
29918,
3084,
1061,
877,
17281,
29918,
27259,
1495,
13,
4706,
4974,
11455,
29918,
27259,
297,
10938,
1839,
4294,
29918,
1397,
1975,
7464,
18793,
4294,
29918,
1397,
1975,
29908,
881,
11455,
4567,
29915,
13,
13,
1678,
822,
1243,
29918,
8582,
29918,
275,
593,
29918,
361,
2572,
287,
29898,
1311,
1125,
13,
4706,
565,
2572,
287,
353,
1583,
29889,
8582,
29889,
3888,
2141,
657,
877,
361,
2572,
287,
742,
5852,
29897,
13,
4706,
4974,
451,
565,
2572,
287,
29892,
525,
16288,
881,
451,
367,
565,
2572,
287,
29915,
13,
13,
1678,
822,
1243,
29918,
8582,
29918,
275,
29918,
4572,
519,
29898,
1311,
1125,
13,
4706,
4175,
519,
353,
1583,
29889,
8582,
29889,
3888,
2141,
657,
877,
4572,
519,
742,
7700,
29897,
13,
4706,
4974,
4175,
519,
29892,
525,
16288,
881,
367,
4175,
519,
29915,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
10314,
29898,
1311,
29892,
903,
1125,
13,
4706,
6503,
353,
426,
13,
3986,
525,
333,
2396,
525,
10314,
29918,
333,
742,
13,
3986,
525,
1228,
29918,
12715,
2396,
525,
1767,
29915,
13,
4706,
500,
13,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
29898,
10314,
29897,
13,
13,
4706,
4974,
525,
10314,
29915,
297,
4472,
29918,
20897,
13,
4706,
4974,
4472,
29918,
20897,
1839,
10314,
2033,
1275,
6503,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
10314,
29918,
1493,
29898,
1311,
29892,
903,
1125,
13,
4706,
6503,
29918,
1493,
353,
426,
13,
3986,
525,
333,
2396,
525,
10314,
29918,
333,
742,
13,
3986,
525,
1228,
29918,
12715,
2396,
525,
1767,
29915,
13,
4706,
500,
13,
13,
4706,
4472,
29918,
20897,
353,
320,
13,
3986,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
29898,
10314,
29918,
1493,
29922,
10314,
29918,
1493,
29897,
13,
13,
4706,
4974,
525,
10314,
29918,
1493,
29915,
297,
4472,
29918,
20897,
13,
4706,
4974,
4472,
29918,
20897,
1839,
10314,
29918,
1493,
2033,
1275,
6503,
29918,
1493,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
4294,
29918,
1397,
1975,
29918,
294,
29918,
3009,
29918,
361,
29918,
277,
29918,
11102,
29918,
12119,
29898,
1311,
29892,
903,
1125,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
29898,
10314,
29918,
1493,
3790,
29915,
4294,
29918,
1397,
1975,
2396,
525,
5574,
29915,
1800,
13,
13,
4706,
1510,
29918,
1397,
1975,
353,
4472,
29918,
20897,
1839,
10314,
29918,
1493,
16215,
4294,
29918,
1397,
1975,
2033,
13,
4706,
4974,
1510,
29918,
1397,
1975,
338,
5852,
29892,
1510,
29918,
1397,
1975,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
4294,
29918,
1397,
1975,
29918,
294,
29918,
4541,
29918,
361,
29918,
277,
29918,
11102,
29918,
15955,
29898,
1311,
29892,
903,
1125,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
29898,
10314,
29918,
1493,
3790,
1800,
13,
13,
4706,
1510,
29918,
1397,
1975,
353,
4472,
29918,
20897,
1839,
10314,
29918,
1493,
16215,
4294,
29918,
1397,
1975,
2033,
13,
4706,
4974,
1510,
29918,
1397,
1975,
338,
7700,
29892,
1510,
29918,
1397,
1975,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
9621,
29918,
14037,
29918,
1552,
29918,
333,
29898,
1311,
29892,
679,
29918,
2467,
1125,
13,
4706,
4235,
353,
518,
13,
3986,
11117,
333,
2396,
22868,
333,
742,
525,
1853,
2396,
525,
524,
29946,
16675,
13,
3986,
11117,
333,
2396,
525,
9175,
742,
525,
1853,
2396,
525,
21574,
16675,
13,
4706,
4514,
13,
4706,
3806,
29918,
9621,
353,
518,
10998,
1767,
2396,
525,
9175,
29915,
6525,
13,
13,
4706,
679,
29918,
2467,
29889,
2457,
29918,
1767,
29889,
2457,
29918,
1767,
353,
426,
13,
3986,
525,
9621,
2396,
4235,
29892,
13,
3986,
525,
3757,
4339,
2396,
6571,
13,
4706,
500,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
580,
13,
13,
4706,
4133,
29918,
9621,
353,
4472,
29918,
20897,
29889,
657,
877,
9621,
1495,
13,
4706,
4974,
4133,
29918,
9621,
338,
451,
6213,
13,
4706,
4974,
4133,
29918,
9621,
1275,
3806,
29918,
9621,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
15425,
29918,
1853,
29898,
1311,
29892,
903,
1125,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
580,
13,
4706,
4974,
525,
15425,
29918,
1853,
29915,
297,
4472,
29918,
20897,
13,
4706,
4974,
4472,
29918,
20897,
1839,
15425,
29918,
1853,
2033,
1275,
1583,
29889,
8582,
29889,
3210,
8322,
29918,
11116,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1753,
1475,
29918,
2972,
29918,
1609,
29918,
275,
29918,
12403,
29918,
15728,
368,
29898,
1311,
29892,
903,
1125,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
580,
13,
4706,
4974,
525,
2972,
29918,
1609,
29918,
275,
29918,
12403,
29915,
297,
4472,
29918,
20897,
13,
4706,
4974,
4472,
29918,
20897,
1839,
2972,
29918,
1609,
29918,
275,
29918,
12403,
2033,
1275,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
13,
13,
1678,
822,
903,
14669,
29918,
6886,
29918,
20897,
29898,
1311,
29892,
6503,
3790,
29915,
333,
2396,
525,
333,
16675,
6503,
29918,
1493,
3790,
29913,
1125,
13,
4706,
3030,
353,
6571,
13,
4706,
848,
29918,
8977,
353,
426,
13,
9651,
525,
10314,
2396,
6503,
29892,
13,
9651,
525,
10314,
29918,
1493,
2396,
6503,
29918,
1493,
13,
4706,
500,
13,
4706,
736,
1583,
29889,
8582,
29889,
14669,
29918,
6886,
29918,
20897,
29898,
4703,
29892,
848,
29918,
8977,
29897,
13,
13,
13,
1990,
4321,
3542,
14732,
29898,
3057,
5160,
14732,
1125,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
6230,
29918,
1990,
29898,
25932,
1125,
13,
4706,
282,
29889,
1359,
877,
1220,
15425,
1495,
13,
4706,
1067,
29879,
29889,
8582,
353,
282,
29889,
657,
29918,
8582,
877,
1220,
15425,
1495,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
734,
538,
776,
29918,
1990,
29898,
25932,
1125,
13,
4706,
282,
29889,
348,
1359,
877,
1220,
15425,
1495,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
5349,
29918,
29916,
29918,
8990,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
4974,
10938,
29889,
657,
877,
29916,
29918,
8990,
1495,
338,
451,
6213,
29892,
525,
12763,
881,
4529,
376,
29916,
29918,
8990,
29908,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
29916,
29918,
8990,
29918,
275,
29918,
12403,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
451,
29918,
6310,
353,
282,
29889,
10154,
7354,
29889,
657,
29918,
3084,
1061,
877,
1333,
29918,
6310,
1495,
13,
4706,
4974,
451,
29918,
6310,
297,
10938,
1839,
29916,
29918,
8990,
7464,
18793,
29916,
29918,
8990,
29908,
881,
367,
3734,
29915,
13,
13,
1678,
822,
1243,
29918,
15425,
29918,
1853,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
8582,
29889,
3210,
8322,
29918,
11116,
1275,
525,
9012,
742,
18793,
3210,
8322,
29918,
11116,
29908,
881,
367,
376,
9012,
29908,
29915,
13,
13,
13,
1990,
4321,
4297,
14732,
29898,
3057,
3542,
14732,
1125,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
6230,
29918,
1990,
29898,
25932,
1125,
13,
4706,
282,
29889,
1359,
877,
29890,
1279,
442,
1495,
13,
4706,
1067,
29879,
29889,
8582,
353,
282,
29889,
657,
29918,
8582,
877,
29890,
1279,
442,
1495,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
734,
538,
776,
29918,
1990,
29898,
25932,
1125,
13,
4706,
282,
29889,
348,
1359,
877,
29890,
1279,
442,
1495,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
5349,
29918,
22672,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
4974,
10938,
29889,
657,
877,
22672,
1495,
338,
451,
6213,
29892,
525,
12763,
881,
4529,
376,
22672,
29908,
29915,
13,
13,
1678,
822,
1243,
29918,
11010,
29918,
22672,
29918,
13221,
593,
29918,
15480,
29898,
1311,
1125,
13,
4706,
10938,
353,
1583,
29889,
8582,
29889,
3888,
580,
1839,
11010,
2033,
13,
4706,
11455,
29918,
27259,
353,
282,
29889,
10154,
7354,
29889,
657,
29918,
3084,
1061,
877,
17281,
29918,
27259,
1495,
13,
4706,
4974,
11455,
29918,
27259,
297,
10938,
1839,
22672,
7464,
18793,
22672,
29908,
881,
11455,
4567,
29915,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
22672,
29918,
294,
29918,
3009,
29918,
361,
29918,
277,
29918,
11102,
29918,
12119,
29898,
1311,
29892,
903,
1125,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
29898,
10314,
29918,
1493,
3790,
29915,
22672,
2396,
525,
5574,
29915,
1800,
13,
13,
4706,
14698,
353,
4472,
29918,
20897,
1839,
10314,
29918,
1493,
16215,
22672,
2033,
13,
4706,
4974,
14698,
338,
5852,
29892,
14698,
13,
13,
1678,
732,
17640,
29889,
5041,
877,
384,
273,
29889,
12800,
29889,
10154,
7354,
29889,
657,
29918,
2467,
1495,
13,
1678,
822,
1243,
29918,
14669,
29918,
6886,
29918,
20897,
29918,
1202,
29879,
29918,
22672,
29918,
294,
29918,
4541,
29918,
361,
29918,
277,
29918,
11102,
29918,
15955,
29898,
1311,
29892,
903,
1125,
13,
4706,
4472,
29918,
20897,
353,
1583,
3032,
14669,
29918,
6886,
29918,
20897,
29898,
10314,
29918,
1493,
3790,
1800,
13,
13,
4706,
14698,
353,
4472,
29918,
20897,
1839,
10314,
29918,
1493,
16215,
22672,
2033,
13,
4706,
4974,
14698,
338,
7700,
29892,
14698,
13,
13,
1678,
822,
1243,
29918,
15425,
29918,
1853,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
8582,
29889,
3210,
8322,
29918,
11116,
1275,
525,
28408,
742,
18793,
3210,
8322,
29918,
11116,
29908,
881,
367,
376,
28408,
29908,
29915,
13,
13,
13,
1990,
4321,
29925,
347,
14732,
29898,
3057,
5160,
14732,
1125,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
6230,
29918,
1990,
29898,
25932,
1125,
13,
4706,
282,
29889,
1359,
877,
12343,
15425,
1495,
13,
4706,
1067,
29879,
29889,
8582,
353,
282,
29889,
657,
29918,
8582,
877,
12343,
15425,
1495,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
734,
538,
776,
29918,
1990,
29898,
25932,
1125,
13,
4706,
282,
29889,
348,
1359,
877,
12343,
15425,
1495,
13,
13,
1678,
822,
1243,
29918,
15425,
29918,
1853,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
8582,
29889,
3210,
8322,
29918,
11116,
1275,
525,
12343,
742,
18793,
3210,
8322,
29918,
11116,
29908,
881,
367,
376,
12343,
29908,
29915,
13,
13,
1678,
822,
1243,
29918,
2972,
29918,
1609,
29918,
275,
29918,
12403,
29898,
1311,
1125,
13,
4706,
4974,
1583,
29889,
8582,
29889,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
1275,
5852,
29892,
18793,
26284,
29918,
22716,
29918,
3235,
29918,
1525,
29984,
3120,
19386,
29908,
881,
367,
1565,
29915,
13,
2
] |
at/abc119/a.py | xsthunder/a | 1 | 103439 | <filename>at/abc119/a.py
s = input()
y, m, d = map(int, s.split('/'))
f = False
(
Heisei,
TBD,
)= (
'Heisei',
'TBD',
)
if y < 2019:
print(Heisei)
elif y == 2019:
if(m < 4):
print(Heisei)
elif m == 4:
if(d <= 30):
print(Heisei)
else :
print(TBD)
else :
print(TBD)
else :
print(TBD)
| [
1,
529,
9507,
29958,
271,
29914,
10736,
29896,
29896,
29929,
29914,
29874,
29889,
2272,
13,
29879,
353,
1881,
580,
13,
29891,
29892,
286,
29892,
270,
353,
2910,
29898,
524,
29892,
269,
29889,
5451,
11219,
8785,
13,
29888,
353,
7700,
13,
29898,
13,
1678,
940,
895,
29875,
29892,
13,
1678,
323,
29121,
29892,
13,
3892,
313,
13,
1678,
525,
3868,
895,
29875,
742,
13,
1678,
525,
24895,
29928,
742,
13,
29897,
13,
361,
343,
529,
29871,
29906,
29900,
29896,
29929,
29901,
13,
1678,
1596,
29898,
3868,
895,
29875,
29897,
13,
23681,
343,
1275,
29871,
29906,
29900,
29896,
29929,
29901,
13,
1678,
565,
29898,
29885,
529,
29871,
29946,
1125,
13,
4706,
1596,
29898,
3868,
895,
29875,
29897,
13,
1678,
25342,
286,
1275,
29871,
29946,
29901,
13,
4706,
565,
29898,
29881,
5277,
29871,
29941,
29900,
1125,
13,
9651,
1596,
29898,
3868,
895,
29875,
29897,
13,
4706,
1683,
584,
13,
9651,
1596,
29898,
24895,
29928,
29897,
13,
1678,
1683,
584,
13,
4706,
1596,
29898,
24895,
29928,
29897,
13,
2870,
584,
13,
1678,
1596,
29898,
24895,
29928,
29897,
13,
2
] |
snypy/core/rest/permissions.py | snypy/snypy-backend | 0 | 154911 | <reponame>snypy/snypy-backend
from rest_framework.permissions import DjangoModelPermissions
class BaseModelPermissions(DjangoModelPermissions):
perms_map = {
"GET": ["%(app_label)s.view_%(model_name)s"],
"OPTIONS": [],
"HEAD": [],
"POST": ["%(app_label)s.add_%(model_name)s"],
"PUT": ["%(app_label)s.change_%(model_name)s"],
"PATCH": ["%(app_label)s.change_%(model_name)s"],
"DELETE": ["%(app_label)s.delete_%(model_name)s"],
}
def has_object_permission(self, request, view, obj):
has_permission = super().has_permission(request, view)
if has_permission and view.action == "retrieve":
return self._queryset(view).viewable().filter(pk=obj.pk).exists()
if has_permission and view.action == "update":
return self._queryset(view).editable().filter(pk=obj.pk).exists()
if has_permission and view.action == "partial_update":
return self._queryset(view).editable().filter(pk=obj.pk).exists()
if has_permission and view.action == "destroy":
return self._queryset(view).deletable().filter(pk=obj.pk).exists()
return False
| [
1,
529,
276,
1112,
420,
29958,
29879,
1460,
2272,
29914,
29879,
1460,
2272,
29899,
27852,
13,
3166,
1791,
29918,
4468,
29889,
17858,
6847,
1053,
15337,
3195,
15737,
6847,
13,
13,
13,
1990,
7399,
3195,
15737,
6847,
29898,
29928,
5364,
3195,
15737,
6847,
1125,
13,
1678,
639,
1516,
29918,
1958,
353,
426,
13,
4706,
376,
7194,
1115,
6796,
29995,
29898,
932,
29918,
1643,
29897,
29879,
29889,
1493,
29918,
29995,
29898,
4299,
29918,
978,
29897,
29879,
12436,
13,
4706,
376,
14094,
27946,
1115,
19997,
13,
4706,
376,
23252,
1115,
19997,
13,
4706,
376,
5438,
1115,
6796,
29995,
29898,
932,
29918,
1643,
29897,
29879,
29889,
1202,
29918,
29995,
29898,
4299,
29918,
978,
29897,
29879,
12436,
13,
4706,
376,
12336,
1115,
6796,
29995,
29898,
932,
29918,
1643,
29897,
29879,
29889,
3167,
29918,
29995,
29898,
4299,
29918,
978,
29897,
29879,
12436,
13,
4706,
376,
29925,
14789,
1115,
6796,
29995,
29898,
932,
29918,
1643,
29897,
29879,
29889,
3167,
29918,
29995,
29898,
4299,
29918,
978,
29897,
29879,
12436,
13,
4706,
376,
2287,
18476,
1115,
6796,
29995,
29898,
932,
29918,
1643,
29897,
29879,
29889,
8143,
29918,
29995,
29898,
4299,
29918,
978,
29897,
29879,
12436,
13,
1678,
500,
13,
13,
1678,
822,
756,
29918,
3318,
29918,
16074,
29898,
1311,
29892,
2009,
29892,
1776,
29892,
5446,
1125,
13,
4706,
756,
29918,
16074,
353,
2428,
2141,
5349,
29918,
16074,
29898,
3827,
29892,
1776,
29897,
13,
13,
4706,
565,
756,
29918,
16074,
322,
1776,
29889,
2467,
1275,
376,
276,
509,
2418,
1115,
13,
9651,
736,
1583,
3032,
1972,
842,
29898,
1493,
467,
1493,
519,
2141,
4572,
29898,
20571,
29922,
5415,
29889,
20571,
467,
9933,
580,
13,
13,
4706,
565,
756,
29918,
16074,
322,
1776,
29889,
2467,
1275,
376,
5504,
1115,
13,
9651,
736,
1583,
3032,
1972,
842,
29898,
1493,
467,
5628,
519,
2141,
4572,
29898,
20571,
29922,
5415,
29889,
20571,
467,
9933,
580,
13,
13,
4706,
565,
756,
29918,
16074,
322,
1776,
29889,
2467,
1275,
376,
3846,
29918,
5504,
1115,
13,
9651,
736,
1583,
3032,
1972,
842,
29898,
1493,
467,
5628,
519,
2141,
4572,
29898,
20571,
29922,
5415,
29889,
20571,
467,
9933,
580,
13,
13,
4706,
565,
756,
29918,
16074,
322,
1776,
29889,
2467,
1275,
376,
20524,
1115,
13,
9651,
736,
1583,
3032,
1972,
842,
29898,
1493,
467,
311,
1026,
519,
2141,
4572,
29898,
20571,
29922,
5415,
29889,
20571,
467,
9933,
580,
13,
13,
4706,
736,
7700,
13,
2
] |
insertion_sort.py | undersonrs/PYTHON_Projetos | 0 | 171752 | <reponame>undersonrs/PYTHON_Projetos<filename>insertion_sort.py
def insertion_sort(v):
for i in range (1, len(v)):
x = v[i]
j = i-1
while j>=0 and x< v[j]:
v[j+1] = v[j]
j -= 1
v[j+1] = x
print()
b = [8,3,9,2,1,10,7,5,4,6]
print(b)
print()
a = insertion_sort(b)
print()
a = b
print(a)
print()
| [
1,
529,
276,
1112,
420,
29958,
870,
1330,
2288,
29914,
20055,
4690,
1164,
29918,
1184,
4026,
359,
29966,
9507,
29958,
7851,
291,
29918,
6605,
29889,
2272,
13,
1753,
4635,
291,
29918,
6605,
29898,
29894,
1125,
13,
1678,
363,
474,
297,
3464,
313,
29896,
29892,
7431,
29898,
29894,
22164,
13,
4706,
921,
353,
325,
29961,
29875,
29962,
13,
4706,
432,
353,
474,
29899,
29896,
13,
4706,
1550,
432,
18572,
29900,
322,
921,
29966,
325,
29961,
29926,
5387,
13,
9651,
325,
29961,
29926,
29974,
29896,
29962,
353,
325,
29961,
29926,
29962,
13,
9651,
432,
22361,
29871,
29896,
13,
9651,
325,
29961,
29926,
29974,
29896,
29962,
353,
921,
13,
13,
632,
13,
2158,
580,
13,
29890,
353,
518,
29947,
29892,
29941,
29892,
29929,
29892,
29906,
29892,
29896,
29892,
29896,
29900,
29892,
29955,
29892,
29945,
29892,
29946,
29892,
29953,
29962,
13,
2158,
29898,
29890,
29897,
13,
2158,
580,
13,
29874,
353,
4635,
291,
29918,
6605,
29898,
29890,
29897,
13,
2158,
580,
13,
29874,
353,
289,
13,
2158,
29898,
29874,
29897,
13,
2158,
580,
13,
13,
13,
2
] |
Numbers/from e to the nth digit/e.py | Shetty073/Solutions-for-Mega-Project-List | 0 | 120257 | from math import e
def pi_dec(n):
if n > 15 or n < 1:
print("\nPlease provide a valid number in range of 1 to 15...")
else:
print(f"E = {str(e)[0:n+2]}")
pi_dec(n=int(input("\nUp to how many decimal places do you want the value of 'e'? \n> "))) | [
1,
515,
5844,
1053,
321,
30004,
13,
30004,
13,
1753,
2930,
29918,
7099,
29898,
29876,
1125,
30004,
13,
12,
361,
302,
1405,
29871,
29896,
29945,
470,
302,
529,
29871,
29896,
29901,
30004,
13,
12,
12,
2158,
14182,
29876,
12148,
3867,
263,
2854,
1353,
297,
3464,
310,
29871,
29896,
304,
29871,
29896,
29945,
856,
1159,
30004,
13,
12,
2870,
29901,
30004,
13,
12,
12,
2158,
29898,
29888,
29908,
29923,
353,
426,
710,
29898,
29872,
9601,
29900,
29901,
29876,
29974,
29906,
12258,
1159,
30004,
13,
30004,
13,
1631,
29918,
7099,
29898,
29876,
29922,
524,
29898,
2080,
14182,
29876,
3373,
304,
920,
1784,
13677,
7600,
437,
366,
864,
278,
995,
310,
525,
29872,
29915,
29973,
320,
29876,
29958,
376,
4961,
2
] |
project/starter_code/student_utils.py | nihaagarwalla/nd320-c1-emr-data-starter | 0 | 6935 | <reponame>nihaagarwalla/nd320-c1-emr-data-starter<filename>project/starter_code/student_utils.py
import pandas as pd
import numpy as np
import os
import tensorflow as tf
import functools
####### STUDENTS FILL THIS OUT ######
#Question 3
def reduce_dimension_ndc(df, ndc_df):
'''
df: pandas dataframe, input dataset
ndc_df: pandas dataframe, drug code dataset used for mapping in generic names
return:
df: pandas dataframe, output dataframe with joined generic drug name
'''
ndc_df["Non-proprietary Name"]= ndc_df["Non-proprietary Name"].str.replace("Hcl", "Hydrochloride")
ndc_df["Non-proprietary Name"]= ndc_df["Non-proprietary Name"].str.replace(" And ", "-")
ndc_df["Non-proprietary Name"]= (ndc_df["Non-proprietary Name"].str.strip()).str.upper()
# ndc_df["Dosage Form"]= ndc_df["Dosage Form"].str.replace("Tablet, Film Coated", "TABLET")
# ndc_df["Dosage Form"]= ndc_df["Dosage Form"].str.replace("Tablet, Coated", "TABLET")
# ndc_df["Dosage Form"]= ndc_df["Dosage Form"].str.replace("Tablet, Film Coated, Extended Release", "Tablet Extended Release")
# ndc_df["Dosage Form"]= ndc_df["Dosage Form"].str.replace("Tablet, Extended Release", "Tablet Extended Release")
# ndc_df["Dosage Form"]= ndc_df["Dosage Form"].str.replace("For Suspension, Extended Release", "For Suspension Extended Release")
# ndc_df["Dosage Form"]= ndc_df["Dosage Form"].str.replace("Powder, Metered", "Powder Metered")
# ndc_df["Dosage Form"]= (ndc_df["Dosage Form"].str.strip()).str.upper()
# ndc_df["generic_drug_name"]= ndc_df["Non-proprietary Name"]+"_"+ndc_df["Dosage Form"]
ndc_df["generic_drug_name"]= ndc_df["Non-proprietary Name"]
df_reduce_dimension = pd.merge(df, ndc_df, on=['ndc_code'], how='inner')
df_reduce_dimension['LABEL'] = 0
reduce_dim_df= df_reduce_dimension.drop(columns=['Proprietary Name', 'Non-proprietary Name', 'Dosage Form', 'Route Name', 'Company Name', 'Product Type'])
return reduce_dim_df
#Question 4
def select_first_encounter(df):
'''
df: pandas dataframe, dataframe with all encounters
return:
- first_encounter_df: pandas dataframe, dataframe with only the first encounter for a given patient
'''
first_encounter_df = df.sort_values('encounter_id').groupby('patient_nbr').first()
first_encounter_df = first_encounter_df.reset_index()
return first_encounter_df
#Question 6
def patient_dataset_splitter(df, key='patient_nbr'):
'''
df: pandas dataframe, input dataset that will be split
patient_key: string, column that is the patient id
return:
- train: pandas dataframe,
- validation: pandas dataframe,
- test: pandas dataframe,
'''
df = df.iloc[np.random.permutation(len(df))]
unique_values = df[key].unique()
total_values = len(unique_values)
train_size = round(total_values * (1 - 0.4 ))
train = df[df[key].isin(unique_values[:train_size])].reset_index(drop=True)
left_size = len(unique_values[train_size:])
validation_size = round(left_size*0.5)
validation = df[df[key].isin(unique_values[train_size:train_size+validation_size])].reset_index(drop=True)
test = df[df[key].isin(unique_values[validation_size+train_size:])].reset_index(drop=True)
return train, validation, test
#Question 7
def create_tf_categorical_feature_cols(categorical_col_list,
vocab_dir='./diabetes_vocab/'):
'''
categorical_col_list: list, categorical field list that will be transformed with TF feature column
vocab_dir: string, the path where the vocabulary text files are located
return:
output_tf_list: list of TF feature columns
'''
output_tf_list = []
for c in categorical_col_list:
vocab_file_path = os.path.join(vocab_dir, c + "_vocab.txt")
'''
Which TF function allows you to read from a text file and create a categorical feature
You can use a pattern like this below...
tf_categorical_feature_column = tf.feature_column.......
'''
tf_categorical_feature_column = tf.feature_column.categorical_column_with_vocabulary_file(
key=c, vocabulary_file = vocab_file_path, num_oov_buckets=1)
one_hot_origin_feature = tf.feature_column.indicator_column(tf_categorical_feature_column)
output_tf_list.append(one_hot_origin_feature)
return output_tf_list
#Question 8
def normalize_numeric_with_zscore(col, mean, std):
'''
This function can be used in conjunction with the tf feature column for normalization
'''
return (col - mean)/std
def create_tf_numeric_feature(col, MEAN, STD, default_value=0):
'''
col: string, input numerical column name
MEAN: the mean for the column in the training data
STD: the standard deviation for the column in the training data
default_value: the value that will be used for imputing the field
return:
tf_numeric_feature: tf feature column representation of the input field
'''
normalizer = functools.partial(normalize_numeric_with_zscore, mean=MEAN, std=STD)
tf_numeric_feature= tf.feature_column.numeric_column(
key=col, default_value = default_value, normalizer_fn=normalizer, dtype=tf.float64)
return tf_numeric_feature
#Question 9
def get_mean_std_from_preds(diabetes_yhat):
'''
diabetes_yhat: TF Probability prediction object
'''
m = diabetes_yhat.mean()
s = diabetes_yhat.stddev()
return m, s
# Question 10
def get_student_binary_prediction(df, col):
'''
df: pandas dataframe prediction output dataframe
col: str, probability mean prediction field
return:
student_binary_prediction: pandas dataframe converting input to flattened numpy array and binary labels
def convert_to_binary(df, pred_field, actual_field):
df['score'] = df[pred_field].apply(lambda x: 1 if x>=25 else 0 )
df['label_value'] = df[actual_field].apply(lambda x: 1 if x>=25 else 0)
return df
binary_df = convert_to_binary(model_output_df, 'pred', 'actual_value')
binary_df.head()
'''
return student_binary_prediction
| [
1,
529,
276,
1112,
420,
29958,
1240,
2350,
28641,
29893,
9864,
29914,
299,
29941,
29906,
29900,
29899,
29883,
29896,
29899,
331,
29878,
29899,
1272,
29899,
303,
4254,
29966,
9507,
29958,
4836,
29914,
303,
4254,
29918,
401,
29914,
18945,
29918,
13239,
29889,
2272,
13,
5215,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
5215,
2897,
13,
5215,
26110,
408,
15886,
13,
5215,
2090,
312,
8789,
13,
13,
4136,
2277,
29937,
6850,
15789,
3919,
29903,
9338,
2208,
3446,
3235,
19474,
16101,
29937,
13,
29937,
16492,
29871,
29941,
13,
1753,
10032,
29918,
6229,
2673,
29918,
299,
29883,
29898,
2176,
29892,
29871,
299,
29883,
29918,
2176,
1125,
13,
1678,
14550,
13,
1678,
4489,
29901,
11701,
12205,
29892,
1881,
8783,
13,
268,
299,
29883,
29918,
2176,
29901,
11701,
12205,
29892,
15721,
775,
8783,
1304,
363,
10417,
297,
10035,
2983,
13,
1678,
736,
29901,
13,
4706,
4489,
29901,
11701,
12205,
29892,
1962,
12205,
411,
8772,
10035,
15721,
1024,
13,
268,
14550,
259,
13,
268,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
16862,
710,
29889,
6506,
703,
29950,
695,
613,
376,
29950,
11279,
305,
5095,
680,
1159,
13,
268,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
16862,
710,
29889,
6506,
703,
1126,
9162,
11663,
1159,
29871,
13,
268,
13,
268,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
3108,
29922,
313,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
16862,
710,
29889,
17010,
16655,
710,
29889,
21064,
580,
13,
268,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
16862,
710,
29889,
6506,
703,
3562,
29873,
29892,
4643,
3189,
630,
613,
376,
21009,
29911,
1159,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
16862,
710,
29889,
6506,
703,
3562,
29873,
29892,
3189,
630,
613,
376,
21009,
29911,
1159,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
16862,
710,
29889,
6506,
703,
3562,
29873,
29892,
4643,
3189,
630,
29892,
7338,
2760,
23708,
613,
376,
3562,
29873,
7338,
2760,
23708,
1159,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
16862,
710,
29889,
6506,
703,
3562,
29873,
29892,
7338,
2760,
23708,
613,
376,
3562,
29873,
7338,
2760,
23708,
1159,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
16862,
710,
29889,
6506,
703,
2831,
9511,
29886,
2673,
29892,
7338,
2760,
23708,
613,
376,
2831,
9511,
29886,
2673,
7338,
2760,
23708,
1159,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
16862,
710,
29889,
6506,
703,
29925,
340,
672,
29892,
19333,
287,
613,
376,
29925,
340,
672,
19333,
287,
1159,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
29922,
313,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
16862,
710,
29889,
17010,
16655,
710,
29889,
21064,
580,
13,
29937,
418,
299,
29883,
29918,
2176,
3366,
19206,
29918,
29881,
11124,
29918,
978,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
3108,
13578,
29918,
17969,
299,
29883,
29918,
2176,
3366,
29928,
359,
482,
3812,
3108,
13,
268,
299,
29883,
29918,
2176,
3366,
19206,
29918,
29881,
11124,
29918,
978,
3108,
29922,
29871,
299,
29883,
29918,
2176,
3366,
12283,
29899,
7728,
374,
300,
653,
4408,
3108,
13,
1678,
4489,
29918,
17469,
29918,
6229,
2673,
353,
10518,
29889,
14634,
29898,
2176,
29892,
29871,
299,
29883,
29918,
2176,
29892,
373,
29922,
1839,
299,
29883,
29918,
401,
7464,
920,
2433,
3993,
1495,
13,
1678,
4489,
29918,
17469,
29918,
6229,
2673,
1839,
24461,
6670,
2033,
353,
29871,
29900,
13,
1678,
10032,
29918,
6229,
29918,
2176,
29922,
4489,
29918,
17469,
29918,
6229,
2673,
29889,
8865,
29898,
13099,
29922,
1839,
20420,
374,
300,
653,
4408,
742,
525,
12283,
29899,
7728,
374,
300,
653,
4408,
742,
525,
29928,
359,
482,
3812,
742,
525,
12085,
4408,
742,
525,
21410,
4408,
742,
525,
7566,
5167,
11287,
13,
268,
13,
1678,
736,
10032,
29918,
6229,
29918,
2176,
29871,
13,
13,
13,
29937,
16492,
29871,
29946,
13,
1753,
1831,
29918,
4102,
29918,
3977,
5336,
29898,
2176,
1125,
13,
1678,
14550,
13,
1678,
4489,
29901,
11701,
12205,
29892,
12205,
411,
599,
2094,
1309,
2153,
13,
1678,
736,
29901,
13,
4706,
448,
937,
29918,
3977,
5336,
29918,
2176,
29901,
11701,
12205,
29892,
12205,
411,
871,
278,
937,
11735,
363,
263,
2183,
16500,
13,
1678,
14550,
13,
268,
13,
1678,
937,
29918,
3977,
5336,
29918,
2176,
353,
4489,
29889,
6605,
29918,
5975,
877,
3977,
5336,
29918,
333,
2824,
27789,
877,
5031,
993,
29918,
29876,
1182,
2824,
4102,
580,
13,
1678,
937,
29918,
3977,
5336,
29918,
2176,
353,
937,
29918,
3977,
5336,
29918,
2176,
29889,
12071,
29918,
2248,
580,
13,
1678,
736,
937,
29918,
3977,
5336,
29918,
2176,
13,
29871,
13,
13,
13,
29937,
16492,
29871,
29953,
13,
1753,
16500,
29918,
24713,
29918,
5451,
357,
29898,
2176,
29892,
1820,
2433,
5031,
993,
29918,
29876,
1182,
29374,
13,
1678,
14550,
13,
1678,
4489,
29901,
11701,
12205,
29892,
1881,
8783,
393,
674,
367,
6219,
13,
1678,
16500,
29918,
1989,
29901,
1347,
29892,
1897,
393,
338,
278,
16500,
1178,
13,
13,
1678,
736,
29901,
13,
268,
448,
7945,
29901,
11701,
12205,
29892,
13,
268,
448,
8845,
29901,
11701,
12205,
29892,
13,
268,
448,
1243,
29901,
11701,
12205,
29892,
13,
1678,
14550,
13,
1678,
4489,
353,
4489,
29889,
309,
542,
29961,
9302,
29889,
8172,
29889,
546,
6149,
362,
29898,
2435,
29898,
2176,
28166,
13,
1678,
5412,
29918,
5975,
353,
4489,
29961,
1989,
1822,
13092,
580,
13,
1678,
3001,
29918,
5975,
353,
7431,
29898,
13092,
29918,
5975,
29897,
13,
1678,
7945,
29918,
2311,
353,
4513,
29898,
7827,
29918,
5975,
334,
313,
29896,
448,
29871,
29900,
29889,
29946,
29871,
876,
13,
1678,
7945,
353,
4489,
29961,
2176,
29961,
1989,
1822,
275,
262,
29898,
13092,
29918,
5975,
7503,
14968,
29918,
2311,
2314,
1822,
12071,
29918,
2248,
29898,
8865,
29922,
5574,
29897,
13,
1678,
2175,
29918,
2311,
353,
7431,
29898,
13092,
29918,
5975,
29961,
14968,
29918,
2311,
29901,
2314,
13,
1678,
8845,
29918,
2311,
353,
4513,
29898,
1563,
29918,
2311,
29930,
29900,
29889,
29945,
29897,
13,
13,
1678,
8845,
353,
4489,
29961,
2176,
29961,
1989,
1822,
275,
262,
29898,
13092,
29918,
5975,
29961,
14968,
29918,
2311,
29901,
14968,
29918,
2311,
29974,
18157,
29918,
2311,
2314,
1822,
12071,
29918,
2248,
29898,
8865,
29922,
5574,
29897,
29871,
13,
1678,
1243,
353,
4489,
29961,
2176,
29961,
1989,
1822,
275,
262,
29898,
13092,
29918,
5975,
29961,
18157,
29918,
2311,
29974,
14968,
29918,
2311,
29901,
2314,
1822,
12071,
29918,
2248,
29898,
8865,
29922,
5574,
29897,
29871,
13,
1678,
736,
7945,
29892,
8845,
29892,
1243,
13,
13,
29937,
16492,
29871,
29955,
13,
13,
1753,
1653,
29918,
13264,
29918,
29883,
20440,
936,
29918,
14394,
29918,
22724,
29898,
29883,
20440,
936,
29918,
1054,
29918,
1761,
29892,
13,
462,
795,
7931,
370,
29918,
3972,
2433,
6904,
6051,
370,
10778,
29918,
29894,
542,
370,
22208,
1125,
13,
1678,
14550,
13,
1678,
11608,
936,
29918,
1054,
29918,
1761,
29901,
1051,
29892,
11608,
936,
1746,
1051,
393,
674,
367,
27615,
411,
323,
29943,
4682,
1897,
13,
1678,
7931,
370,
29918,
3972,
29901,
1347,
29892,
278,
2224,
988,
278,
7931,
370,
352,
653,
1426,
2066,
526,
5982,
13,
1678,
736,
29901,
13,
4706,
1962,
29918,
13264,
29918,
1761,
29901,
1051,
310,
323,
29943,
4682,
4341,
13,
1678,
14550,
13,
1678,
1962,
29918,
13264,
29918,
1761,
353,
5159,
13,
1678,
363,
274,
297,
11608,
936,
29918,
1054,
29918,
1761,
29901,
13,
4706,
7931,
370,
29918,
1445,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
29894,
542,
370,
29918,
3972,
29892,
29871,
274,
718,
11119,
29894,
542,
370,
29889,
3945,
1159,
13,
4706,
14550,
13,
4706,
8449,
323,
29943,
740,
6511,
366,
304,
1303,
515,
263,
1426,
934,
322,
1653,
263,
11608,
936,
4682,
13,
4706,
887,
508,
671,
263,
4766,
763,
445,
2400,
856,
13,
4706,
15886,
29918,
29883,
20440,
936,
29918,
14394,
29918,
4914,
353,
15886,
29889,
14394,
29918,
4914,
3045,
856,
13,
13,
4706,
14550,
13,
4706,
15886,
29918,
29883,
20440,
936,
29918,
14394,
29918,
4914,
353,
15886,
29889,
14394,
29918,
4914,
29889,
29883,
20440,
936,
29918,
4914,
29918,
2541,
29918,
29894,
542,
370,
352,
653,
29918,
1445,
29898,
13,
9651,
1820,
29922,
29883,
29892,
7931,
370,
352,
653,
29918,
1445,
353,
7931,
370,
29918,
1445,
29918,
2084,
29892,
954,
29918,
29877,
586,
29918,
2423,
9737,
29922,
29896,
29897,
13,
4706,
697,
29918,
8711,
29918,
12574,
29918,
14394,
353,
15886,
29889,
14394,
29918,
4914,
29889,
513,
20485,
29918,
4914,
29898,
13264,
29918,
29883,
20440,
936,
29918,
14394,
29918,
4914,
29897,
268,
13,
4706,
1962,
29918,
13264,
29918,
1761,
29889,
4397,
29898,
650,
29918,
8711,
29918,
12574,
29918,
14394,
29897,
13,
1678,
736,
1962,
29918,
13264,
29918,
1761,
13,
13,
29937,
16492,
29871,
29947,
13,
1753,
4226,
675,
29918,
21574,
29918,
2541,
29918,
29920,
13628,
29898,
1054,
29892,
2099,
29892,
3659,
1125,
13,
1678,
14550,
13,
1678,
910,
740,
508,
367,
1304,
297,
9589,
651,
411,
278,
15886,
4682,
1897,
363,
4226,
2133,
13,
1678,
14550,
13,
1678,
736,
313,
1054,
448,
2099,
6802,
4172,
13,
13,
13,
13,
1753,
1653,
29918,
13264,
29918,
21574,
29918,
14394,
29898,
1054,
29892,
22986,
2190,
29892,
6850,
29928,
29892,
2322,
29918,
1767,
29922,
29900,
1125,
13,
1678,
14550,
13,
1678,
784,
29901,
1347,
29892,
1881,
16259,
1897,
1024,
13,
1678,
22986,
2190,
29901,
278,
2099,
363,
278,
1897,
297,
278,
6694,
848,
13,
1678,
6850,
29928,
29901,
278,
3918,
29522,
363,
278,
1897,
297,
278,
6694,
848,
13,
1678,
2322,
29918,
1767,
29901,
278,
995,
393,
674,
367,
1304,
363,
527,
649,
292,
278,
1746,
13,
13,
1678,
736,
29901,
13,
4706,
15886,
29918,
21574,
29918,
14394,
29901,
15886,
4682,
1897,
8954,
310,
278,
1881,
1746,
13,
1678,
14550,
13,
1678,
4226,
3950,
353,
2090,
312,
8789,
29889,
3846,
29898,
8945,
675,
29918,
21574,
29918,
2541,
29918,
29920,
13628,
29892,
2099,
29922,
2303,
2190,
29892,
3659,
29922,
1254,
29928,
29897,
13,
1678,
15886,
29918,
21574,
29918,
14394,
29922,
15886,
29889,
14394,
29918,
4914,
29889,
21574,
29918,
4914,
29898,
13,
1678,
1820,
29922,
1054,
29892,
2322,
29918,
1767,
353,
2322,
29918,
1767,
29892,
4226,
3950,
29918,
9144,
29922,
8945,
3950,
29892,
26688,
29922,
13264,
29889,
7411,
29953,
29946,
29897,
13,
1678,
736,
15886,
29918,
21574,
29918,
14394,
13,
13,
29937,
16492,
29871,
29929,
13,
1753,
679,
29918,
12676,
29918,
4172,
29918,
3166,
29918,
11965,
29879,
29898,
6051,
370,
10778,
29918,
29891,
2455,
1125,
13,
1678,
14550,
13,
1678,
652,
370,
10778,
29918,
29891,
2455,
29901,
323,
29943,
1019,
29890,
3097,
18988,
1203,
13,
1678,
14550,
13,
1678,
286,
353,
652,
370,
10778,
29918,
29891,
2455,
29889,
12676,
580,
13,
1678,
269,
353,
652,
370,
10778,
29918,
29891,
2455,
29889,
4172,
3359,
580,
13,
1678,
736,
286,
29892,
269,
13,
13,
29937,
894,
29871,
29896,
29900,
13,
1753,
679,
29918,
18945,
29918,
19541,
29918,
11965,
2463,
29898,
2176,
29892,
784,
1125,
13,
1678,
14550,
13,
1678,
4489,
29901,
11701,
12205,
18988,
1962,
12205,
13,
1678,
784,
29901,
851,
29892,
29871,
6976,
2099,
18988,
1746,
13,
1678,
736,
29901,
13,
4706,
8368,
29918,
19541,
29918,
11965,
2463,
29901,
11701,
12205,
17415,
1881,
304,
1652,
8606,
287,
12655,
1409,
322,
7581,
11073,
13,
268,
13,
1678,
822,
3588,
29918,
517,
29918,
19541,
29898,
2176,
29892,
4450,
29918,
2671,
29892,
3935,
29918,
2671,
1125,
13,
1678,
4489,
1839,
13628,
2033,
353,
4489,
29961,
11965,
29918,
2671,
1822,
7302,
29898,
2892,
921,
29901,
29871,
29896,
565,
921,
18572,
29906,
29945,
1683,
29871,
29900,
1723,
13,
1678,
4489,
1839,
1643,
29918,
1767,
2033,
353,
4489,
29961,
19304,
29918,
2671,
1822,
7302,
29898,
2892,
921,
29901,
29871,
29896,
565,
921,
18572,
29906,
29945,
1683,
29871,
29900,
29897,
13,
268,
13,
1678,
736,
4489,
13,
1678,
7581,
29918,
2176,
353,
3588,
29918,
517,
29918,
19541,
29898,
4299,
29918,
4905,
29918,
2176,
29892,
525,
11965,
742,
525,
19304,
29918,
1767,
1495,
13,
19541,
29918,
2176,
29889,
2813,
580,
13,
268,
13,
1678,
14550,
13,
1678,
736,
8368,
29918,
19541,
29918,
11965,
2463,
13,
2
] |
autofit/graphical/factor_graphs/factor.py | vishalbelsare/PyAutoFit | 0 | 72424 | <filename>autofit/graphical/factor_graphs/factor.py<gh_stars>0
from abc import ABC
from functools import lru_cache
from inspect import getfullargspec
from itertools import chain, repeat
from typing import \
(
Tuple, Dict, Union, Set, Callable, List
)
import numpy as np
from autofit.graphical.factor_graphs.abstract import \
(
AbstractNode, FactorValue
)
from autofit.graphical.utils import \
(
aggregate, Axis, cached_property
)
from autofit.mapper.variable import Variable
class AbstractFactor(AbstractNode, ABC):
def __init__(
self,
name="",
**kwargs: Variable,
):
super().__init__(**kwargs)
self._name = name or f"factor_{self.id}"
self._deterministic_variables = set()
@property
def deterministic_variables(self) -> Set[Variable]:
return self._deterministic_variables
@property
def name(self) -> str:
return self._name
def __mul__(self, other):
"""
When two factors are multiplied together this creates a graph
"""
from autofit.graphical.factor_graphs.graph import FactorGraph
return FactorGraph([self]) * other
@property
def variables(self) -> Set[Variable]:
"""
Dictionary mapping the names of variables to those variables
"""
return set(self._kwargs.values())
@property
def _kwargs_dims(self) -> Dict[str, int]:
"""
The number of plates for each keyword argument variable
"""
return {
key: len(value)
for key, value
in self._kwargs.items()
}
@cached_property
def _variable_plates(self) -> Dict[str, np.ndarray]:
"""
Maps the name of each variable to the indices of its plates
within this node
"""
return {
variable: self._match_plates(
variable.plates
)
for variable
in self.all_variables
}
@property
def n_deterministic(self) -> int:
"""
How many deterministic variables are there associated with this node?
"""
return len(self._deterministic_variables)
def __hash__(self):
return hash((type(self), self.id))
def _resolve_args(
self,
**kwargs: np.ndarray
) -> dict:
"""
Transforms in the input arguments to match the arguments
specified for the factor.
Parameters
----------
args
kwargs
Returns
-------
"""
return {n: kwargs[v.name] for n, v in self._kwargs.items()}
class Factor(AbstractFactor):
"""
A node in a graph representing a factor with analytic evaluation
of its Jacobian
Parameters
----------
factor
the function being wrapped, must accept calls through keyword
argument
name: optional, str
the name of the factor, if not passed then uses the name
of the function passed
vectorised: optional, bool
if true the factor will call the function directly over multiple
inputs. If false the factor will call the function iteratively
over each argument.
is_scalar: optional, bool
if true the factor returns a scalar value. Note if multiple arguments
are passed then a vector will still be returned
kwargs: Variables
Variables for each keyword argument for the function
Methods
-------
__call__({x: x0}, axis=axis)
calls the factor, the passed input must be a dictionary with
where the keys are the Variable objects that the function takes
as input. The Variable keys only have to match the _names_
of the variables of the function.
`axis` controls the shape of the output if the variables and factor have
plates associated with them, when axis=False then no reduction is performed,
otherwise it is equivalent to calling np.sum(log_val, axis=axis) on the
returned value
returns a FactorValue object which behaves like an np.ndarray
func_jacobian({x: x0}, variables=(x,), axis=axis)
calls the factor and returns it value and the jacobian of its value
with respect to the `variables` passed. if variables is None then
it returns the jacobian with respect to all variables.
returns fval, {x: d fval / dx}
"""
def __init__(
self,
factor: Callable,
name="",
vectorised=False,
is_scalar=False,
**kwargs: Variable
):
"""
A node in a graph representing a factor
Parameters
----------
factor
A wrapper around some callable
args
Variables representing positional arguments for the function
kwargs
Variables representing keyword arguments for the function
"""
self.vectorised = vectorised
self.is_scalar = is_scalar
self._set_factor(factor)
args = getfullargspec(self._factor).args
kwargs = {
**kwargs,
**{
arg: Variable(arg)
for arg
in args
if arg not in kwargs and arg != "self"
}
}
super().__init__(
**kwargs,
name=name or factor.__name__
)
def _set_factor(self, factor):
self._factor = factor
self._has_exact_projection = getattr(
factor, 'has_exact_projection', None)
self._calc_exact_projection = getattr(
factor, 'calc_exact_projection', None)
self._calc_exact_update = getattr(
factor, 'calc_exact_update', None)
def has_exact_projection(self, mean_field) -> bool:
if self._has_exact_projection:
return self._has_exact_projection(
**self.resolve_variable_dict(mean_field))
else:
return False
def calc_exact_projection(self, mean_field) -> 'MeanField':
if self._calc_exact_projection:
from autofit.graphical.mean_field import MeanField
projection = self._calc_exact_projection(
**self.resolve_variable_dict(mean_field))
return MeanField({
self._kwargs[v]: dist for v, dist in projection.items()
})
else:
return NotImplementedError
def calc_exact_update(self, mean_field) -> 'MeanField':
if self._calc_exact_update:
from autofit.graphical.mean_field import MeanField
projection = self._calc_exact_update(
**self.resolve_variable_dict(mean_field))
return MeanField({
self._kwargs[v]: dist for v, dist in projection.items()
})
else:
return NotImplementedError
def safe_exact_update(self, mean_field) -> Tuple[bool, 'MeanField']:
if self._has_exact_projection:
from autofit.graphical.mean_field import MeanField
_mean_field = self.resolve_variable_dict(mean_field)
if self._has_exact_projection(**_mean_field):
projection = self._calc_exact_update(**_mean_field)
return True, MeanField({
self._kwargs[v]: dist for v, dist in projection.items()
})
return False, mean_field
def __hash__(self) -> int:
# TODO: might this break factor repetition somewhere?
return hash(self._factor)
def _reshape_factor(
self, factor_val, values
):
shift, shape = self._function_shape(**values)
if self.is_scalar:
if shift:
return np.sum(
factor_val, axis=np.arange(1, np.ndim(factor_val)))
return np.sum(factor_val)
return np.reshape(factor_val, shape)
def _function_shape(
self,
**kwargs: np.ndarray) -> Tuple[int, ...]:
"""
Calculates the expected function shape based on the variables
"""
var_shapes = {
k: np.shape(x) for k, x in kwargs.items()}
return self._var_shape(**var_shapes)
@lru_cache()
def _var_shape(self, **kwargs: Tuple[int, ...]) -> Tuple[int, ...]:
"""This is called by _function_shape
caches result so that does not have to be recalculated each call
lru_cache caches f(x=1, y=2) to f(y=2, x=1), but in this case
it should be find as the order of kwargs is set by self._kwargs
which should be stable
"""
var_shapes = {self._kwargs[k]: v for k, v in kwargs.items()}
var_dims_diffs = {
v: len(s) - v.ndim
for v, s in var_shapes.items()
}
"""
If all the passed variables have an extra dimension then
we assume we're evaluating multiple instances of the function at the
same time
otherwise an error is raised
"""
if set(var_dims_diffs.values()) == {1}:
# Check if we're passing multiple values e.g. for sampling
shift = 1
elif set(var_dims_diffs.values()) == {0}:
shift = 0
else:
raise ValueError("dimensions of passed inputs do not match")
"""
Updating shape of output array to match input arrays
singleton dimensions are always assumed to match as in
standard array broadcasting
e.g. (1, 2, 3) == (3, 2, 1)
"""
shape = np.ones(self.ndim + shift, dtype=int)
for v, vs in var_shapes.items():
ind = self._variable_plates[v] + shift
vshape = vs[shift:]
if shift:
ind = np.r_[0, ind]
vshape = (vs[0],) + vshape
if shape.size:
if not (
np.equal(shape[ind], 1) |
np.equal(shape[ind], vshape) |
np.equal(vshape, 1)).all():
raise AssertionError(
"Shapes do not match"
)
shape[ind] = np.maximum(shape[ind], vshape)
return shift, tuple(shape)
def _call_factor(
self,
**kwargs: np.ndarray
) -> np.ndarray:
"""
Call the underlying function
Parameters
----------
args
Positional arguments for the function
kwargs
Keyword arguments for the function
Returns
-------
Value returned by the factor
"""
# kws = self._resolve_args(
# **kwargs
# )
if self.vectorised:
return self._factor(**kwargs)
"""Some factors may not be vectorised to broadcast over
multiple inputs
this method checks whether multiple input values have been
passed, and if so automatically loops over the inputs.
If any of the inputs have initial dimension one, it repeats
that value to match the length of the other inputs
If the other inputs do not match then it raises ValueError
"""
kwargs_dims = {k: np.ndim(a) for k, a in kwargs.items()}
# Check dimensions of inputs directly match plates
direct_call = (
all(dim == kwargs_dims[k] for k, dim in self._kwargs_dims.items()))
if direct_call:
return self._factor(**kwargs)
# Check dimensions of inputs match plates + 1
vectorised = (
all(dim + 1 == kwargs_dims[k]
for k, dim in self._kwargs_dims.items()))
if not vectorised:
raise ValueError(
"input dimensions do not match required dims"
f"input: **kwargs={kwargs_dims}"
f"required: "
f"**kwargs={self._kwargs_dims}")
kw_lens = {k: len(a) for k, a in kwargs.items()}
# checking 1st dimensions match
sizes = set(kw_lens.values())
dim0 = max(sizes)
if sizes.difference({1, dim0}):
raise ValueError(
f"size mismatch first dimensions passed: {sizes}")
iter_kws = {
k: iter(a) if kw_lens[k] == dim0 else iter(repeat(a[0]))
for k, a in kwargs.items()}
# iterator to generate keyword arguments
def gen_kwargs():
for _ in range(dim0):
yield {
k: next(a) for k, a in iter_kws.items()}
# TODO this loop can also be parallelised for increased performance
res = np.array([
self._factor(**kws)
for kws in gen_kwargs()])
return res
def __call__(
self,
variable_dict: Dict[
Variable,
Union[
np.ndarray,
float,
List[float]
]
],
axis: Axis = False,
) -> FactorValue:
"""
Call the underlying factor
Parameters
----------
args
Positional arguments for the factor
kwargs
Keyword arguments for the factor
Returns
-------
Object encapsulating the result of the function call
"""
kwargs = self.resolve_variable_dict(variable_dict)
val = self._call_factor(**kwargs)
val = aggregate(self._reshape_factor(val, kwargs), axis)
return FactorValue(val, {})
def broadcast_variable(
self,
variable: str,
value: np.ndarray
) -> np.ndarray:
"""
broadcasts the value of a variable to match the specific shape
of the factor
if the number of dimensions passed of the variable is 1
greater than the dimensions of the variable then it's assumed
that that dimension corresponds to multiple samples of that variable
"""
return self._broadcast(
self._variable_plates[variable],
value
)
def collapse(
self,
variable: str,
value: np.ndarray,
agg_func=np.sum
) -> np.ndarray:
"""
broadcasts `value` to match the specific shape of the factor,
where `value` has the shape of the factor
if the number of dimensions passed of the variable is 1
greater than the dimensions of the variable then it's assumed
that that dimension corresponds to multiple samples of that variable
"""
ndim = np.ndim(value)
shift = ndim - self.ndim
assert shift in {0, 1}
inds = self._variable_plates[variable] + shift
dropaxes = tuple(np.setdiff1d(
np.arange(shift, ndim), inds))
# to ensured axes of returned array is in the correct order
moved = np.moveaxis(value, inds, np.sort(inds))
return agg_func(moved, axis=dropaxes)
def __eq__(self, other: Union["Factor", Variable]):
"""
If set equal to a variable that variable is taken to be deterministic and
so a DeterministicFactorNode is generated.
"""
if isinstance(other, Factor):
if isinstance(other, type(self)):
return (
(self._factor == other._factor)
and (frozenset(self._kwargs.items())
== frozenset(other._kwargs.items()))
and (frozenset(self.variables)
== frozenset(other.variables))
and (frozenset(self.deterministic_variables)
== frozenset(self.deterministic_variables)))
else:
return False
return DeterministicFactor(
self._factor,
other,
name=self.name,
**self._kwargs
)
def __repr__(self) -> str:
args = ", ".join(chain(
map("{0[0]}={0[1]}".format, self._kwargs.items())))
return f"Factor({self.name}, {args})"
class DeterministicFactor(Factor):
"""
A deterministic factor is used to convert a function f(g(x)) to f(y)g(x) (integrating over y wit
a delta function) so that it can be represented in a factor graph.
Parameters
----------
factor
The original factor to which the deterministic factor is associated
variable
The deterministic variable that is returned by the factor, so
to represent the case f(g(x)), we would define,
```
>>> x = Variable('x')
>>> y = Variable('y')
>>> g_ = Factor(g, x) == y
>>> f_ = Factor(f, y)
```
Alternatively g could be directly defined,
```
>>> g_ = DeterministicFactor(g, y, x=x)
```
kwargs
Variables for the original factor
"""
def __init__(
self,
factor: Callable,
variable: Variable,
*args: Variable,
name: str = '',
**kwargs: Variable
):
"""
A deterministic factor is used to convert a function f(g(x)) to f(y)g(x) (integrating over y wit
a delta function) so that it can be represented in a factor graph.
Parameters
----------
factor
The original factor to which the deterministic factor is associated
variable
The deterministic factor used
args
Variables for the original factor
kwargs
Variables for the original factor
"""
super().__init__(
factor,
*args,
name=name or factor.__name__,
**kwargs
)
self._deterministic_variables = {
variable
}
def __call__(
self,
variable_dict: Dict[Variable, np.ndarray],
axis: Axis = False,
# **kwargs: np.ndarray
) -> FactorValue:
"""
Call this factor with a set of arguments
Parameters
----------
args
Positional arguments for the underlying factor
kwargs
Keyword arguments for the underlying factor
Returns
-------
An object encapsulating the value for the factor
"""
kwargs = self.resolve_variable_dict(variable_dict)
res = self._call_factor(**kwargs)
shift, shape = self._function_shape(**kwargs)
plate_dim = dict(zip(self.plates, shape[shift:]))
det_shapes = {
v: shape[:shift] + tuple(
plate_dim[p] for p in v.plates)
for v in self.deterministic_variables
}
if not (isinstance(res, tuple) or self.n_deterministic > 1):
res = res,
log_val = (
0. if (shape == () or axis is None) else
aggregate(np.zeros(tuple(1 for _ in shape)), axis))
det_vals = {
k: np.reshape(val, det_shapes[k])
if det_shapes[k]
else val
for k, val
in zip(self._deterministic_variables, res)
}
return FactorValue(log_val, det_vals)
def __repr__(self) -> str:
factor_str = super().__repr__()
var_str = ", ".join(sorted(variable.name for variable in self._deterministic_variables))
return f"({factor_str} == ({var_str}))"
| [
1,
529,
9507,
29958,
1300,
974,
277,
29914,
4262,
936,
29914,
19790,
29918,
4262,
29879,
29914,
19790,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
25638,
1053,
16417,
13,
3166,
2090,
312,
8789,
1053,
301,
582,
29918,
8173,
13,
3166,
16096,
1053,
679,
8159,
5085,
3135,
13,
3166,
4256,
8504,
1053,
9704,
29892,
12312,
13,
3166,
19229,
1053,
320,
13,
1678,
313,
13,
1678,
12603,
552,
29892,
360,
919,
29892,
7761,
29892,
3789,
29892,
8251,
519,
29892,
2391,
13,
29897,
13,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
1120,
974,
277,
29889,
4262,
936,
29889,
19790,
29918,
4262,
29879,
29889,
16595,
1053,
320,
13,
1678,
313,
13,
1678,
25513,
4247,
29892,
383,
7168,
1917,
13,
29897,
13,
3166,
1120,
974,
277,
29889,
4262,
936,
29889,
13239,
1053,
320,
13,
1678,
313,
13,
1678,
20431,
29892,
319,
11497,
29892,
22152,
29918,
6799,
13,
29897,
13,
3166,
1120,
974,
277,
29889,
655,
2496,
29889,
11918,
1053,
28736,
13,
13,
13,
1990,
25513,
29943,
7168,
29898,
9118,
4247,
29892,
16417,
1125,
13,
1678,
822,
4770,
2344,
12035,
13,
9651,
1583,
29892,
13,
9651,
1024,
543,
613,
13,
9651,
3579,
19290,
29901,
28736,
29892,
13,
268,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
1068,
19290,
29897,
13,
4706,
1583,
3032,
978,
353,
1024,
470,
285,
29908,
19790,
648,
1311,
29889,
333,
5038,
13,
4706,
1583,
3032,
4801,
837,
262,
4695,
29918,
20897,
353,
731,
580,
13,
13,
1678,
732,
6799,
13,
1678,
822,
11806,
4695,
29918,
20897,
29898,
1311,
29897,
1599,
3789,
29961,
16174,
5387,
13,
4706,
736,
1583,
3032,
4801,
837,
262,
4695,
29918,
20897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
1024,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
3032,
978,
13,
13,
1678,
822,
4770,
16109,
12035,
1311,
29892,
916,
1125,
13,
4706,
9995,
13,
4706,
1932,
1023,
13879,
526,
6674,
2957,
4208,
445,
10017,
263,
3983,
13,
4706,
9995,
13,
4706,
515,
1120,
974,
277,
29889,
4262,
936,
29889,
19790,
29918,
4262,
29879,
29889,
4262,
1053,
383,
7168,
9527,
13,
4706,
736,
383,
7168,
9527,
4197,
1311,
2314,
334,
916,
13,
13,
1678,
732,
6799,
13,
1678,
822,
3651,
29898,
1311,
29897,
1599,
3789,
29961,
16174,
5387,
13,
4706,
9995,
13,
4706,
13343,
10417,
278,
2983,
310,
3651,
304,
1906,
3651,
13,
4706,
9995,
13,
4706,
736,
731,
29898,
1311,
3032,
19290,
29889,
5975,
3101,
13,
13,
1678,
732,
6799,
13,
1678,
822,
903,
19290,
29918,
6229,
29879,
29898,
1311,
29897,
1599,
360,
919,
29961,
710,
29892,
938,
5387,
13,
4706,
9995,
13,
4706,
450,
1353,
310,
715,
1078,
363,
1269,
13553,
2980,
2286,
13,
4706,
9995,
13,
4706,
736,
426,
13,
9651,
1820,
29901,
7431,
29898,
1767,
29897,
13,
9651,
363,
1820,
29892,
995,
13,
9651,
297,
1583,
3032,
19290,
29889,
7076,
580,
13,
4706,
500,
13,
13,
1678,
732,
29883,
3791,
29918,
6799,
13,
1678,
822,
903,
11918,
29918,
9884,
29898,
1311,
29897,
1599,
360,
919,
29961,
710,
29892,
7442,
29889,
299,
2378,
5387,
13,
4706,
9995,
13,
4706,
25846,
278,
1024,
310,
1269,
2286,
304,
278,
16285,
310,
967,
715,
1078,
13,
4706,
2629,
445,
2943,
13,
4706,
9995,
13,
4706,
736,
426,
13,
9651,
2286,
29901,
1583,
3032,
4352,
29918,
9884,
29898,
13,
18884,
2286,
29889,
9884,
13,
9651,
1723,
13,
9651,
363,
2286,
13,
9651,
297,
1583,
29889,
497,
29918,
20897,
13,
4706,
500,
13,
13,
1678,
732,
6799,
13,
1678,
822,
302,
29918,
4801,
837,
262,
4695,
29898,
1311,
29897,
1599,
938,
29901,
13,
4706,
9995,
13,
4706,
1128,
1784,
11806,
4695,
3651,
526,
727,
6942,
411,
445,
2943,
29973,
13,
4706,
9995,
13,
4706,
736,
7431,
29898,
1311,
3032,
4801,
837,
262,
4695,
29918,
20897,
29897,
13,
13,
1678,
822,
4770,
8568,
12035,
1311,
1125,
13,
4706,
736,
6608,
3552,
1853,
29898,
1311,
511,
1583,
29889,
333,
876,
13,
13,
1678,
822,
903,
17863,
29918,
5085,
29898,
13,
9651,
1583,
29892,
13,
9651,
3579,
19290,
29901,
7442,
29889,
299,
2378,
13,
1678,
1723,
1599,
9657,
29901,
13,
4706,
9995,
13,
4706,
4103,
9514,
297,
278,
1881,
6273,
304,
1993,
278,
6273,
13,
4706,
6790,
363,
278,
7329,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
6389,
13,
4706,
9049,
5085,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
13,
4706,
9995,
13,
4706,
736,
426,
29876,
29901,
9049,
5085,
29961,
29894,
29889,
978,
29962,
363,
302,
29892,
325,
297,
1583,
3032,
19290,
29889,
7076,
28296,
13,
13,
13,
1990,
383,
7168,
29898,
9118,
29943,
7168,
1125,
13,
1678,
9995,
13,
1678,
319,
2943,
297,
263,
3983,
15783,
263,
7329,
411,
16114,
293,
17983,
29871,
13,
1678,
310,
967,
10968,
713,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
7329,
13,
4706,
278,
740,
1641,
21021,
29892,
1818,
3544,
5717,
1549,
13553,
29871,
13,
4706,
2980,
13,
13,
1678,
1024,
29901,
13136,
29892,
851,
13,
4706,
278,
1024,
310,
278,
7329,
29892,
565,
451,
4502,
769,
3913,
278,
1024,
13,
4706,
310,
278,
740,
4502,
13,
13,
1678,
4608,
3368,
29901,
13136,
29892,
6120,
13,
4706,
565,
1565,
278,
7329,
674,
1246,
278,
740,
4153,
975,
2999,
13,
4706,
10970,
29889,
960,
2089,
278,
7329,
674,
1246,
278,
740,
4256,
6703,
13,
4706,
975,
1269,
2980,
29889,
13,
13,
1678,
338,
29918,
19529,
279,
29901,
13136,
29892,
6120,
13,
4706,
565,
1565,
278,
7329,
3639,
263,
17336,
995,
29889,
3940,
565,
2999,
6273,
13,
4706,
526,
4502,
769,
263,
4608,
674,
1603,
367,
4133,
13,
308,
13,
1678,
9049,
5085,
29901,
9586,
1849,
13,
4706,
9586,
1849,
363,
1269,
13553,
2980,
363,
278,
740,
13,
13,
1678,
8108,
29879,
13,
1678,
448,
22158,
13,
1678,
4770,
4804,
1649,
3319,
29916,
29901,
921,
29900,
1118,
9685,
29922,
8990,
29897,
13,
4706,
5717,
278,
7329,
29892,
278,
4502,
1881,
1818,
367,
263,
8600,
411,
13,
4706,
988,
278,
6611,
526,
278,
28736,
3618,
393,
278,
740,
4893,
13,
4706,
408,
1881,
29889,
450,
28736,
6611,
871,
505,
304,
1993,
278,
903,
7039,
29918,
13,
4706,
310,
278,
3651,
310,
278,
740,
29889,
259,
13,
13,
4706,
421,
8990,
29952,
11761,
278,
8267,
310,
278,
1962,
565,
278,
3651,
322,
7329,
505,
13,
4706,
715,
1078,
6942,
411,
963,
29892,
746,
9685,
29922,
8824,
769,
694,
20376,
338,
8560,
29892,
13,
4706,
6467,
372,
338,
7126,
304,
5432,
7442,
29889,
2083,
29898,
1188,
29918,
791,
29892,
9685,
29922,
8990,
29897,
373,
278,
13,
4706,
4133,
995,
13,
308,
13,
4706,
3639,
263,
383,
7168,
1917,
1203,
607,
4010,
267,
763,
385,
7442,
29889,
299,
2378,
13,
308,
13,
13,
1678,
3653,
29918,
29926,
562,
711,
713,
3319,
29916,
29901,
921,
29900,
1118,
3651,
7607,
29916,
29892,
511,
9685,
29922,
8990,
29897,
13,
4706,
5717,
278,
7329,
322,
3639,
372,
995,
322,
278,
432,
562,
711,
713,
310,
967,
995,
13,
4706,
411,
3390,
304,
278,
421,
20897,
29952,
4502,
29889,
565,
3651,
338,
6213,
769,
13,
4706,
372,
3639,
278,
432,
562,
711,
713,
411,
3390,
304,
599,
3651,
29889,
13,
13,
4706,
3639,
285,
791,
29892,
426,
29916,
29901,
270,
285,
791,
847,
15414,
29913,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
9651,
1583,
29892,
13,
9651,
7329,
29901,
8251,
519,
29892,
13,
9651,
1024,
543,
613,
13,
9651,
4608,
3368,
29922,
8824,
29892,
13,
9651,
338,
29918,
19529,
279,
29922,
8824,
29892,
13,
9651,
3579,
19290,
29901,
28736,
13,
268,
1125,
13,
4706,
9995,
13,
4706,
319,
2943,
297,
263,
3983,
15783,
263,
7329,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
7329,
13,
9651,
319,
14476,
2820,
777,
1246,
519,
13,
4706,
6389,
13,
9651,
9586,
1849,
15783,
2602,
284,
6273,
363,
278,
740,
13,
4706,
9049,
5085,
13,
9651,
9586,
1849,
15783,
13553,
6273,
363,
278,
740,
13,
4706,
9995,
13,
4706,
1583,
29889,
8111,
3368,
353,
4608,
3368,
13,
4706,
1583,
29889,
275,
29918,
19529,
279,
353,
338,
29918,
19529,
279,
13,
4706,
1583,
3032,
842,
29918,
19790,
29898,
19790,
29897,
13,
13,
4706,
6389,
353,
679,
8159,
5085,
3135,
29898,
1311,
3032,
19790,
467,
5085,
13,
4706,
9049,
5085,
353,
426,
13,
9651,
3579,
19290,
29892,
13,
9651,
3579,
29912,
13,
18884,
1852,
29901,
28736,
29898,
1191,
29897,
13,
18884,
363,
1852,
13,
18884,
297,
6389,
13,
18884,
565,
1852,
451,
297,
9049,
5085,
322,
1852,
2804,
376,
1311,
29908,
13,
9651,
500,
13,
4706,
500,
13,
13,
4706,
2428,
2141,
1649,
2344,
12035,
13,
9651,
3579,
19290,
29892,
13,
9651,
1024,
29922,
978,
470,
7329,
17255,
978,
1649,
13,
4706,
1723,
13,
13,
1678,
822,
903,
842,
29918,
19790,
29898,
1311,
29892,
7329,
1125,
13,
4706,
1583,
3032,
19790,
353,
7329,
13,
4706,
1583,
3032,
5349,
29918,
735,
627,
29918,
771,
6929,
353,
679,
5552,
29898,
13,
9651,
7329,
29892,
525,
5349,
29918,
735,
627,
29918,
771,
6929,
742,
6213,
29897,
13,
4706,
1583,
3032,
28667,
29918,
735,
627,
29918,
771,
6929,
353,
679,
5552,
29898,
13,
9651,
7329,
29892,
525,
28667,
29918,
735,
627,
29918,
771,
6929,
742,
6213,
29897,
13,
4706,
1583,
3032,
28667,
29918,
735,
627,
29918,
5504,
353,
679,
5552,
29898,
13,
9651,
7329,
29892,
525,
28667,
29918,
735,
627,
29918,
5504,
742,
6213,
29897,
13,
13,
1678,
822,
756,
29918,
735,
627,
29918,
771,
6929,
29898,
1311,
29892,
2099,
29918,
2671,
29897,
1599,
6120,
29901,
13,
4706,
565,
1583,
3032,
5349,
29918,
735,
627,
29918,
771,
6929,
29901,
13,
9651,
736,
1583,
3032,
5349,
29918,
735,
627,
29918,
771,
6929,
29898,
13,
18884,
3579,
1311,
29889,
17863,
29918,
11918,
29918,
8977,
29898,
12676,
29918,
2671,
876,
13,
4706,
1683,
29901,
13,
9651,
736,
7700,
13,
13,
1678,
822,
22235,
29918,
735,
627,
29918,
771,
6929,
29898,
1311,
29892,
2099,
29918,
2671,
29897,
1599,
525,
6816,
273,
3073,
2396,
13,
4706,
565,
1583,
3032,
28667,
29918,
735,
627,
29918,
771,
6929,
29901,
13,
9651,
515,
1120,
974,
277,
29889,
4262,
936,
29889,
12676,
29918,
2671,
1053,
16316,
3073,
13,
9651,
18246,
353,
1583,
3032,
28667,
29918,
735,
627,
29918,
771,
6929,
29898,
13,
18884,
3579,
1311,
29889,
17863,
29918,
11918,
29918,
8977,
29898,
12676,
29918,
2671,
876,
13,
9651,
736,
16316,
3073,
3319,
13,
18884,
1583,
3032,
19290,
29961,
29894,
5387,
1320,
363,
325,
29892,
1320,
297,
18246,
29889,
7076,
580,
13,
9651,
5615,
13,
4706,
1683,
29901,
13,
9651,
736,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
22235,
29918,
735,
627,
29918,
5504,
29898,
1311,
29892,
2099,
29918,
2671,
29897,
1599,
525,
6816,
273,
3073,
2396,
13,
4706,
565,
1583,
3032,
28667,
29918,
735,
627,
29918,
5504,
29901,
13,
9651,
515,
1120,
974,
277,
29889,
4262,
936,
29889,
12676,
29918,
2671,
1053,
16316,
3073,
13,
9651,
18246,
353,
1583,
3032,
28667,
29918,
735,
627,
29918,
5504,
29898,
13,
18884,
3579,
1311,
29889,
17863,
29918,
11918,
29918,
8977,
29898,
12676,
29918,
2671,
876,
13,
9651,
736,
16316,
3073,
3319,
13,
18884,
1583,
3032,
19290,
29961,
29894,
5387,
1320,
363,
325,
29892,
1320,
297,
18246,
29889,
7076,
580,
13,
9651,
5615,
13,
4706,
1683,
29901,
13,
9651,
736,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
822,
9109,
29918,
735,
627,
29918,
5504,
29898,
1311,
29892,
2099,
29918,
2671,
29897,
1599,
12603,
552,
29961,
11227,
29892,
525,
6816,
273,
3073,
2033,
29901,
13,
4706,
565,
1583,
3032,
5349,
29918,
735,
627,
29918,
771,
6929,
29901,
13,
9651,
515,
1120,
974,
277,
29889,
4262,
936,
29889,
12676,
29918,
2671,
1053,
16316,
3073,
13,
9651,
903,
12676,
29918,
2671,
353,
1583,
29889,
17863,
29918,
11918,
29918,
8977,
29898,
12676,
29918,
2671,
29897,
13,
9651,
565,
1583,
3032,
5349,
29918,
735,
627,
29918,
771,
6929,
29898,
1068,
29918,
12676,
29918,
2671,
1125,
13,
18884,
18246,
353,
1583,
3032,
28667,
29918,
735,
627,
29918,
5504,
29898,
1068,
29918,
12676,
29918,
2671,
29897,
13,
18884,
736,
5852,
29892,
16316,
3073,
3319,
13,
462,
1678,
1583,
3032,
19290,
29961,
29894,
5387,
1320,
363,
325,
29892,
1320,
297,
18246,
29889,
7076,
580,
13,
18884,
5615,
13,
13,
4706,
736,
7700,
29892,
2099,
29918,
2671,
13,
13,
1678,
822,
4770,
8568,
12035,
1311,
29897,
1599,
938,
29901,
13,
4706,
396,
14402,
29901,
1795,
445,
2867,
7329,
21159,
654,
9051,
29973,
13,
4706,
736,
6608,
29898,
1311,
3032,
19790,
29897,
13,
13,
1678,
822,
903,
690,
14443,
29918,
19790,
29898,
13,
9651,
1583,
29892,
7329,
29918,
791,
29892,
1819,
13,
268,
1125,
13,
4706,
9500,
29892,
8267,
353,
1583,
3032,
2220,
29918,
12181,
29898,
1068,
5975,
29897,
13,
4706,
565,
1583,
29889,
275,
29918,
19529,
279,
29901,
13,
9651,
565,
9500,
29901,
13,
18884,
736,
7442,
29889,
2083,
29898,
13,
462,
1678,
7329,
29918,
791,
29892,
9685,
29922,
9302,
29889,
279,
927,
29898,
29896,
29892,
7442,
29889,
299,
326,
29898,
19790,
29918,
791,
4961,
13,
9651,
736,
7442,
29889,
2083,
29898,
19790,
29918,
791,
29897,
13,
4706,
736,
7442,
29889,
690,
14443,
29898,
19790,
29918,
791,
29892,
8267,
29897,
13,
13,
1678,
822,
903,
2220,
29918,
12181,
29898,
13,
9651,
1583,
29892,
13,
9651,
3579,
19290,
29901,
7442,
29889,
299,
2378,
29897,
1599,
12603,
552,
29961,
524,
29892,
2023,
5387,
13,
4706,
9995,
13,
4706,
20535,
1078,
278,
3806,
740,
8267,
2729,
373,
278,
3651,
13,
4706,
9995,
13,
4706,
722,
29918,
845,
11603,
353,
426,
13,
9651,
413,
29901,
7442,
29889,
12181,
29898,
29916,
29897,
363,
413,
29892,
921,
297,
9049,
5085,
29889,
7076,
28296,
13,
4706,
736,
1583,
3032,
1707,
29918,
12181,
29898,
1068,
1707,
29918,
845,
11603,
29897,
13,
13,
1678,
732,
29880,
582,
29918,
8173,
580,
13,
1678,
822,
903,
1707,
29918,
12181,
29898,
1311,
29892,
3579,
19290,
29901,
12603,
552,
29961,
524,
29892,
2023,
2314,
1599,
12603,
552,
29961,
524,
29892,
2023,
5387,
13,
4706,
9995,
4013,
338,
2000,
491,
903,
2220,
29918,
12181,
13,
308,
13,
4706,
274,
14520,
1121,
577,
393,
947,
451,
505,
304,
367,
337,
15807,
630,
1269,
1246,
13,
308,
13,
4706,
301,
582,
29918,
8173,
274,
14520,
285,
29898,
29916,
29922,
29896,
29892,
343,
29922,
29906,
29897,
304,
285,
29898,
29891,
29922,
29906,
29892,
921,
29922,
29896,
511,
541,
297,
445,
1206,
13,
4706,
372,
881,
367,
1284,
408,
278,
1797,
310,
9049,
5085,
338,
731,
491,
1583,
3032,
19290,
13,
4706,
607,
881,
367,
13714,
13,
4706,
9995,
13,
4706,
722,
29918,
845,
11603,
353,
426,
1311,
3032,
19290,
29961,
29895,
5387,
325,
363,
413,
29892,
325,
297,
9049,
5085,
29889,
7076,
28296,
13,
4706,
722,
29918,
6229,
29879,
29918,
12765,
29879,
353,
426,
13,
9651,
325,
29901,
7431,
29898,
29879,
29897,
448,
325,
29889,
299,
326,
13,
9651,
363,
325,
29892,
269,
297,
722,
29918,
845,
11603,
29889,
7076,
580,
13,
4706,
500,
13,
4706,
9995,
13,
4706,
960,
599,
278,
4502,
3651,
505,
385,
4805,
9927,
769,
29871,
13,
4706,
591,
5251,
591,
29915,
276,
6161,
1218,
2999,
8871,
310,
278,
740,
472,
278,
29871,
13,
4706,
1021,
931,
13,
13,
4706,
6467,
385,
1059,
338,
10425,
13,
4706,
9995,
13,
4706,
565,
731,
29898,
1707,
29918,
6229,
29879,
29918,
12765,
29879,
29889,
5975,
3101,
1275,
426,
29896,
6177,
13,
9651,
396,
5399,
565,
591,
29915,
276,
6819,
2999,
1819,
321,
29889,
29887,
29889,
363,
23460,
13,
9651,
9500,
353,
29871,
29896,
13,
4706,
25342,
731,
29898,
1707,
29918,
6229,
29879,
29918,
12765,
29879,
29889,
5975,
3101,
1275,
426,
29900,
6177,
13,
9651,
9500,
353,
29871,
29900,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
703,
6229,
5580,
310,
4502,
10970,
437,
451,
1993,
1159,
13,
13,
4706,
9995,
13,
4706,
5020,
26747,
8267,
310,
1962,
1409,
304,
1993,
1881,
7049,
13,
13,
4706,
27130,
13391,
526,
2337,
12023,
304,
1993,
408,
297,
13,
4706,
3918,
1409,
12672,
292,
13,
13,
4706,
321,
29889,
29887,
29889,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29897,
1275,
313,
29941,
29892,
29871,
29906,
29892,
29871,
29896,
29897,
13,
4706,
9995,
13,
4706,
8267,
353,
7442,
29889,
2873,
29898,
1311,
29889,
299,
326,
718,
9500,
29892,
26688,
29922,
524,
29897,
13,
4706,
363,
325,
29892,
7186,
297,
722,
29918,
845,
11603,
29889,
7076,
7295,
13,
9651,
1399,
353,
1583,
3032,
11918,
29918,
9884,
29961,
29894,
29962,
718,
9500,
13,
9651,
325,
12181,
353,
7186,
29961,
10889,
17531,
13,
9651,
565,
9500,
29901,
13,
18884,
1399,
353,
7442,
29889,
29878,
29918,
29961,
29900,
29892,
1399,
29962,
13,
18884,
325,
12181,
353,
313,
4270,
29961,
29900,
1402,
29897,
718,
325,
12181,
13,
13,
9651,
565,
8267,
29889,
2311,
29901,
13,
18884,
565,
451,
313,
13,
462,
4706,
7442,
29889,
11745,
29898,
12181,
29961,
513,
1402,
29871,
29896,
29897,
891,
13,
462,
4706,
7442,
29889,
11745,
29898,
12181,
29961,
513,
1402,
325,
12181,
29897,
891,
13,
462,
4706,
7442,
29889,
11745,
29898,
29894,
12181,
29892,
29871,
29896,
8106,
497,
7295,
13,
462,
1678,
12020,
16499,
291,
2392,
29898,
13,
462,
4706,
376,
2713,
11603,
437,
451,
1993,
29908,
13,
462,
1678,
1723,
13,
18884,
8267,
29961,
513,
29962,
353,
7442,
29889,
27525,
398,
29898,
12181,
29961,
513,
1402,
325,
12181,
29897,
13,
13,
4706,
736,
9500,
29892,
18761,
29898,
12181,
29897,
13,
13,
1678,
822,
903,
4804,
29918,
19790,
29898,
13,
9651,
1583,
29892,
13,
9651,
3579,
19290,
29901,
7442,
29889,
299,
2378,
13,
1678,
1723,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
8251,
278,
14407,
740,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
6389,
13,
9651,
10321,
3245,
6273,
363,
278,
740,
13,
4706,
9049,
5085,
13,
9651,
7670,
1742,
6273,
363,
278,
740,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
7865,
4133,
491,
278,
7329,
13,
4706,
9995,
13,
4706,
396,
413,
5652,
353,
1583,
3032,
17863,
29918,
5085,
29898,
13,
4706,
396,
268,
3579,
19290,
13,
4706,
396,
1723,
13,
13,
4706,
565,
1583,
29889,
8111,
3368,
29901,
13,
9651,
736,
1583,
3032,
19790,
29898,
1068,
19290,
29897,
13,
13,
4706,
9995,
9526,
13879,
1122,
451,
367,
4608,
3368,
304,
12672,
975,
13,
4706,
2999,
10970,
13,
13,
4706,
445,
1158,
12747,
3692,
2999,
1881,
1819,
505,
1063,
13,
4706,
4502,
29892,
322,
565,
577,
6336,
12104,
975,
278,
10970,
29889,
13,
4706,
960,
738,
310,
278,
10970,
505,
2847,
9927,
697,
29892,
372,
5565,
1446,
13,
4706,
393,
995,
304,
1993,
278,
3309,
310,
278,
916,
10970,
13,
13,
4706,
960,
278,
916,
10970,
437,
451,
1993,
769,
372,
1153,
4637,
7865,
2392,
13,
4706,
9995,
13,
4706,
9049,
5085,
29918,
6229,
29879,
353,
426,
29895,
29901,
7442,
29889,
299,
326,
29898,
29874,
29897,
363,
413,
29892,
263,
297,
9049,
5085,
29889,
7076,
28296,
13,
4706,
396,
5399,
13391,
310,
10970,
4153,
1993,
715,
1078,
13,
4706,
1513,
29918,
4804,
353,
313,
13,
9651,
599,
29898,
6229,
1275,
9049,
5085,
29918,
6229,
29879,
29961,
29895,
29962,
363,
413,
29892,
3964,
297,
1583,
3032,
19290,
29918,
6229,
29879,
29889,
7076,
22130,
13,
4706,
565,
1513,
29918,
4804,
29901,
13,
9651,
736,
1583,
3032,
19790,
29898,
1068,
19290,
29897,
13,
13,
4706,
396,
5399,
13391,
310,
10970,
1993,
715,
1078,
718,
29871,
29896,
13,
4706,
4608,
3368,
353,
313,
13,
9651,
599,
29898,
6229,
718,
29871,
29896,
1275,
9049,
5085,
29918,
6229,
29879,
29961,
29895,
29962,
13,
18884,
363,
413,
29892,
3964,
297,
1583,
3032,
19290,
29918,
6229,
29879,
29889,
7076,
22130,
13,
13,
4706,
565,
451,
4608,
3368,
29901,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
376,
2080,
13391,
437,
451,
1993,
3734,
3964,
29879,
29908,
13,
18884,
285,
29908,
2080,
29901,
3579,
19290,
3790,
19290,
29918,
6229,
29879,
5038,
13,
18884,
285,
29908,
12403,
29901,
376,
13,
18884,
285,
29908,
1068,
19290,
3790,
1311,
3032,
19290,
29918,
6229,
29879,
27195,
13,
13,
4706,
9049,
29918,
29880,
575,
353,
426,
29895,
29901,
7431,
29898,
29874,
29897,
363,
413,
29892,
263,
297,
9049,
5085,
29889,
7076,
28296,
13,
13,
4706,
396,
8454,
29871,
29896,
303,
13391,
1993,
13,
4706,
15786,
353,
731,
29898,
11022,
29918,
29880,
575,
29889,
5975,
3101,
13,
4706,
3964,
29900,
353,
4236,
29898,
29879,
7093,
29897,
13,
4706,
565,
15786,
29889,
29881,
17678,
3319,
29896,
29892,
3964,
29900,
29913,
1125,
13,
9651,
12020,
7865,
2392,
29898,
13,
18884,
285,
29908,
2311,
29635,
937,
13391,
4502,
29901,
426,
29879,
7093,
27195,
13,
13,
4706,
4256,
29918,
29895,
5652,
353,
426,
13,
9651,
413,
29901,
4256,
29898,
29874,
29897,
565,
9049,
29918,
29880,
575,
29961,
29895,
29962,
1275,
3964,
29900,
1683,
4256,
29898,
14358,
29898,
29874,
29961,
29900,
12622,
13,
9651,
363,
413,
29892,
263,
297,
9049,
5085,
29889,
7076,
28296,
13,
13,
4706,
396,
20380,
304,
5706,
13553,
6273,
13,
4706,
822,
2531,
29918,
19290,
7295,
13,
9651,
363,
903,
297,
3464,
29898,
6229,
29900,
1125,
13,
18884,
7709,
426,
13,
462,
1678,
413,
29901,
2446,
29898,
29874,
29897,
363,
413,
29892,
263,
297,
4256,
29918,
29895,
5652,
29889,
7076,
28296,
13,
13,
4706,
396,
14402,
445,
2425,
508,
884,
367,
8943,
3368,
363,
11664,
4180,
13,
4706,
620,
353,
7442,
29889,
2378,
4197,
13,
9651,
1583,
3032,
19790,
29898,
1068,
29895,
5652,
29897,
13,
9651,
363,
413,
5652,
297,
2531,
29918,
19290,
580,
2314,
13,
13,
4706,
736,
620,
13,
13,
1678,
822,
4770,
4804,
12035,
13,
9651,
1583,
29892,
13,
9651,
2286,
29918,
8977,
29901,
360,
919,
29961,
13,
18884,
28736,
29892,
13,
18884,
7761,
29961,
13,
462,
1678,
7442,
29889,
299,
2378,
29892,
13,
462,
1678,
5785,
29892,
13,
462,
1678,
2391,
29961,
7411,
29962,
13,
18884,
4514,
13,
9651,
21251,
13,
9651,
9685,
29901,
319,
11497,
353,
7700,
29892,
13,
1678,
1723,
1599,
383,
7168,
1917,
29901,
13,
4706,
9995,
13,
4706,
8251,
278,
14407,
7329,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
6389,
13,
9651,
10321,
3245,
6273,
363,
278,
7329,
13,
4706,
9049,
5085,
13,
9651,
7670,
1742,
6273,
363,
278,
7329,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
4669,
2094,
2547,
18099,
278,
1121,
310,
278,
740,
1246,
13,
4706,
9995,
13,
4706,
9049,
5085,
353,
1583,
29889,
17863,
29918,
11918,
29918,
8977,
29898,
11918,
29918,
8977,
29897,
13,
4706,
659,
353,
1583,
3032,
4804,
29918,
19790,
29898,
1068,
19290,
29897,
13,
4706,
659,
353,
20431,
29898,
1311,
3032,
690,
14443,
29918,
19790,
29898,
791,
29892,
9049,
5085,
511,
9685,
29897,
13,
4706,
736,
383,
7168,
1917,
29898,
791,
29892,
426,
1800,
13,
13,
1678,
822,
12672,
29918,
11918,
29898,
13,
9651,
1583,
29892,
13,
9651,
2286,
29901,
851,
29892,
13,
9651,
995,
29901,
7442,
29889,
299,
2378,
13,
1678,
1723,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
12672,
29879,
278,
995,
310,
263,
2286,
304,
1993,
278,
2702,
8267,
13,
4706,
310,
278,
7329,
13,
13,
4706,
565,
278,
1353,
310,
13391,
4502,
310,
278,
2286,
338,
29871,
29896,
13,
4706,
7621,
1135,
278,
13391,
310,
278,
2286,
769,
372,
29915,
29879,
12023,
13,
4706,
393,
393,
9927,
16161,
304,
2999,
11916,
310,
393,
2286,
13,
4706,
9995,
13,
4706,
736,
1583,
3032,
6729,
328,
4384,
29898,
13,
9651,
1583,
3032,
11918,
29918,
9884,
29961,
11918,
1402,
13,
9651,
995,
13,
4706,
1723,
13,
13,
1678,
822,
24382,
29898,
13,
9651,
1583,
29892,
13,
9651,
2286,
29901,
851,
29892,
13,
9651,
995,
29901,
7442,
29889,
299,
2378,
29892,
13,
9651,
946,
29887,
29918,
9891,
29922,
9302,
29889,
2083,
13,
1678,
1723,
1599,
7442,
29889,
299,
2378,
29901,
13,
4706,
9995,
13,
4706,
12672,
29879,
421,
1767,
29952,
304,
1993,
278,
2702,
8267,
310,
278,
7329,
29892,
13,
4706,
988,
421,
1767,
29952,
756,
278,
8267,
310,
278,
7329,
13,
13,
4706,
565,
278,
1353,
310,
13391,
4502,
310,
278,
2286,
338,
29871,
29896,
13,
4706,
7621,
1135,
278,
13391,
310,
278,
2286,
769,
372,
29915,
29879,
12023,
13,
4706,
393,
393,
9927,
16161,
304,
2999,
11916,
310,
393,
2286,
13,
4706,
9995,
13,
308,
299,
326,
353,
7442,
29889,
299,
326,
29898,
1767,
29897,
13,
4706,
9500,
353,
29871,
299,
326,
448,
1583,
29889,
299,
326,
13,
4706,
4974,
9500,
297,
426,
29900,
29892,
29871,
29896,
29913,
13,
4706,
1399,
29879,
353,
1583,
3032,
11918,
29918,
9884,
29961,
11918,
29962,
718,
9500,
13,
4706,
5768,
1165,
267,
353,
18761,
29898,
9302,
29889,
842,
12765,
29896,
29881,
29898,
13,
9651,
7442,
29889,
279,
927,
29898,
10889,
29892,
29871,
299,
326,
511,
1399,
29879,
876,
13,
13,
4706,
396,
304,
5662,
2955,
27815,
310,
4133,
1409,
338,
297,
278,
1959,
1797,
13,
4706,
6153,
353,
7442,
29889,
11631,
8990,
29898,
1767,
29892,
1399,
29879,
29892,
7442,
29889,
6605,
29898,
12772,
876,
13,
4706,
736,
946,
29887,
29918,
9891,
29898,
29885,
8238,
29892,
9685,
29922,
8865,
1165,
267,
29897,
13,
13,
1678,
822,
4770,
1837,
12035,
1311,
29892,
916,
29901,
7761,
3366,
29943,
7168,
613,
28736,
29962,
1125,
13,
4706,
9995,
13,
4706,
960,
731,
5186,
304,
263,
2286,
393,
2286,
338,
4586,
304,
367,
11806,
4695,
322,
13,
4706,
577,
263,
5953,
837,
262,
4695,
29943,
7168,
4247,
338,
5759,
29889,
13,
4706,
9995,
13,
4706,
565,
338,
8758,
29898,
1228,
29892,
383,
7168,
1125,
13,
9651,
565,
338,
8758,
29898,
1228,
29892,
1134,
29898,
1311,
22164,
13,
18884,
736,
313,
13,
462,
4706,
313,
1311,
3032,
19790,
1275,
916,
3032,
19790,
29897,
13,
462,
4706,
322,
313,
29888,
16997,
575,
300,
29898,
1311,
3032,
19290,
29889,
7076,
3101,
13,
462,
632,
1275,
14671,
29920,
575,
300,
29898,
1228,
3032,
19290,
29889,
7076,
22130,
13,
462,
4706,
322,
313,
29888,
16997,
575,
300,
29898,
1311,
29889,
20897,
29897,
13,
462,
632,
1275,
14671,
29920,
575,
300,
29898,
1228,
29889,
20897,
876,
13,
462,
4706,
322,
313,
29888,
16997,
575,
300,
29898,
1311,
29889,
4801,
837,
262,
4695,
29918,
20897,
29897,
13,
462,
632,
1275,
14671,
29920,
575,
300,
29898,
1311,
29889,
4801,
837,
262,
4695,
29918,
20897,
4961,
13,
9651,
1683,
29901,
13,
18884,
736,
7700,
13,
13,
4706,
736,
5953,
837,
262,
4695,
29943,
7168,
29898,
13,
9651,
1583,
3032,
19790,
29892,
13,
9651,
916,
29892,
13,
9651,
1024,
29922,
1311,
29889,
978,
29892,
29871,
13,
9651,
3579,
1311,
3032,
19290,
13,
4706,
1723,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
29897,
1599,
851,
29901,
13,
4706,
6389,
353,
9162,
11393,
7122,
29898,
14153,
29898,
13,
9651,
2910,
703,
29912,
29900,
29961,
29900,
12258,
3790,
29900,
29961,
29896,
12258,
1642,
4830,
29892,
1583,
3032,
19290,
29889,
7076,
580,
4961,
13,
4706,
736,
285,
29908,
29943,
7168,
3319,
1311,
29889,
978,
1118,
426,
5085,
1800,
29908,
13,
13,
13,
1990,
5953,
837,
262,
4695,
29943,
7168,
29898,
29943,
7168,
1125,
13,
1678,
9995,
13,
1678,
319,
11806,
4695,
7329,
338,
1304,
304,
3588,
263,
740,
285,
29898,
29887,
29898,
29916,
876,
304,
285,
29898,
29891,
29897,
29887,
29898,
29916,
29897,
313,
14146,
1218,
975,
343,
12309,
13,
1678,
263,
19471,
740,
29897,
577,
393,
372,
508,
367,
9875,
297,
263,
7329,
3983,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
7329,
13,
4706,
450,
2441,
7329,
304,
607,
278,
11806,
4695,
7329,
338,
6942,
13,
1678,
2286,
13,
4706,
450,
11806,
4695,
2286,
393,
338,
4133,
491,
278,
7329,
29892,
577,
29871,
13,
4706,
304,
2755,
278,
1206,
285,
29898,
29887,
29898,
29916,
8243,
591,
723,
4529,
29892,
13,
13,
4706,
7521,
13,
4706,
8653,
921,
353,
28736,
877,
29916,
1495,
13,
4706,
8653,
343,
353,
28736,
877,
29891,
1495,
13,
4706,
8653,
330,
29918,
353,
383,
7168,
29898,
29887,
29892,
921,
29897,
1275,
343,
13,
4706,
8653,
285,
29918,
353,
383,
7168,
29898,
29888,
29892,
343,
29897,
13,
4706,
7521,
13,
4706,
20360,
330,
1033,
367,
4153,
3342,
29892,
13,
4706,
7521,
13,
4706,
8653,
330,
29918,
353,
5953,
837,
262,
4695,
29943,
7168,
29898,
29887,
29892,
343,
29892,
921,
29922,
29916,
29897,
13,
4706,
7521,
13,
308,
13,
1678,
9049,
5085,
13,
4706,
9586,
1849,
363,
278,
2441,
7329,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
9651,
1583,
29892,
13,
9651,
7329,
29901,
8251,
519,
29892,
13,
9651,
2286,
29901,
28736,
29892,
13,
9651,
334,
5085,
29901,
28736,
29892,
13,
9651,
1024,
29901,
851,
353,
15516,
29871,
13,
9651,
3579,
19290,
29901,
28736,
13,
268,
1125,
13,
4706,
9995,
13,
4706,
319,
11806,
4695,
7329,
338,
1304,
304,
3588,
263,
740,
285,
29898,
29887,
29898,
29916,
876,
304,
285,
29898,
29891,
29897,
29887,
29898,
29916,
29897,
313,
14146,
1218,
975,
343,
12309,
13,
4706,
263,
19471,
740,
29897,
577,
393,
372,
508,
367,
9875,
297,
263,
7329,
3983,
29889,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
7329,
13,
9651,
450,
2441,
7329,
304,
607,
278,
11806,
4695,
7329,
338,
6942,
13,
4706,
2286,
13,
9651,
450,
11806,
4695,
7329,
1304,
13,
4706,
6389,
13,
9651,
9586,
1849,
363,
278,
2441,
7329,
13,
4706,
9049,
5085,
13,
9651,
9586,
1849,
363,
278,
2441,
7329,
13,
4706,
9995,
13,
4706,
2428,
2141,
1649,
2344,
12035,
13,
9651,
7329,
29892,
13,
9651,
334,
5085,
29892,
13,
9651,
1024,
29922,
978,
470,
7329,
17255,
978,
1649,
29892,
29871,
13,
9651,
3579,
19290,
13,
4706,
1723,
13,
4706,
1583,
3032,
4801,
837,
262,
4695,
29918,
20897,
353,
426,
13,
9651,
2286,
13,
4706,
500,
13,
13,
1678,
822,
4770,
4804,
12035,
13,
9651,
1583,
29892,
13,
9651,
2286,
29918,
8977,
29901,
360,
919,
29961,
16174,
29892,
7442,
29889,
299,
2378,
1402,
13,
9651,
9685,
29901,
319,
11497,
353,
7700,
29892,
13,
9651,
396,
3579,
19290,
29901,
7442,
29889,
299,
2378,
13,
1678,
1723,
1599,
383,
7168,
1917,
29901,
13,
4706,
9995,
13,
4706,
8251,
445,
7329,
411,
263,
731,
310,
6273,
13,
13,
4706,
12662,
2699,
13,
4706,
448,
1378,
29899,
13,
4706,
6389,
13,
9651,
10321,
3245,
6273,
363,
278,
14407,
7329,
13,
4706,
9049,
5085,
13,
9651,
7670,
1742,
6273,
363,
278,
14407,
7329,
13,
13,
4706,
16969,
13,
4706,
448,
22158,
13,
4706,
530,
1203,
2094,
2547,
18099,
278,
995,
363,
278,
7329,
13,
4706,
9995,
13,
4706,
9049,
5085,
353,
1583,
29889,
17863,
29918,
11918,
29918,
8977,
29898,
11918,
29918,
8977,
29897,
13,
4706,
620,
353,
1583,
3032,
4804,
29918,
19790,
29898,
1068,
19290,
29897,
13,
4706,
9500,
29892,
8267,
353,
1583,
3032,
2220,
29918,
12181,
29898,
1068,
19290,
29897,
13,
4706,
15284,
29918,
6229,
353,
9657,
29898,
7554,
29898,
1311,
29889,
9884,
29892,
8267,
29961,
10889,
29901,
12622,
13,
13,
4706,
1439,
29918,
845,
11603,
353,
426,
13,
9651,
325,
29901,
8267,
7503,
10889,
29962,
718,
18761,
29898,
13,
18884,
15284,
29918,
6229,
29961,
29886,
29962,
363,
282,
297,
325,
29889,
9884,
29897,
13,
9651,
363,
325,
297,
1583,
29889,
4801,
837,
262,
4695,
29918,
20897,
13,
4706,
500,
13,
13,
4706,
565,
451,
313,
275,
8758,
29898,
690,
29892,
18761,
29897,
470,
1583,
29889,
29876,
29918,
4801,
837,
262,
4695,
1405,
29871,
29896,
1125,
13,
9651,
620,
353,
620,
29892,
13,
13,
4706,
1480,
29918,
791,
353,
313,
13,
632,
29900,
29889,
565,
313,
12181,
1275,
3861,
470,
9685,
338,
6213,
29897,
1683,
13,
9651,
20431,
29898,
9302,
29889,
3298,
359,
29898,
23583,
29898,
29896,
363,
903,
297,
8267,
8243,
9685,
876,
13,
4706,
1439,
29918,
791,
29879,
353,
426,
13,
9651,
413,
29901,
7442,
29889,
690,
14443,
29898,
791,
29892,
1439,
29918,
845,
11603,
29961,
29895,
2314,
13,
9651,
565,
1439,
29918,
845,
11603,
29961,
29895,
29962,
13,
9651,
1683,
659,
13,
9651,
363,
413,
29892,
659,
13,
9651,
297,
14319,
29898,
1311,
3032,
4801,
837,
262,
4695,
29918,
20897,
29892,
620,
29897,
13,
4706,
500,
13,
4706,
736,
383,
7168,
1917,
29898,
1188,
29918,
791,
29892,
1439,
29918,
791,
29879,
29897,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
29897,
1599,
851,
29901,
13,
4706,
7329,
29918,
710,
353,
2428,
2141,
1649,
276,
558,
1649,
580,
13,
4706,
722,
29918,
710,
353,
9162,
11393,
7122,
29898,
24582,
29898,
11918,
29889,
978,
363,
2286,
297,
1583,
3032,
4801,
837,
262,
4695,
29918,
20897,
876,
13,
4706,
736,
285,
29908,
3319,
19790,
29918,
710,
29913,
1275,
21313,
1707,
29918,
710,
20073,
29908,
13,
2
] |
third_party/gsutil/third_party/protorpc/protorpc/google_imports.py | ravitejavalluri/catapult | 76 | 156574 | <reponame>ravitejavalluri/catapult
"""Dynamically decide from where to import other SDK modules.
All other protorpc code should import other SDK modules from
this module. If necessary, add new imports here (in both places).
"""
__author__ = '<EMAIL> (<NAME>)'
# pylint: disable=g-import-not-at-top
# pylint: disable=unused-import
try:
from google.net.proto import ProtocolBuffer
except ImportError:
pass
| [
1,
529,
276,
1112,
420,
29958,
5705,
568,
9494,
497,
5338,
29914,
4117,
481,
499,
13,
15945,
29908,
29928,
2926,
1711,
11097,
515,
988,
304,
1053,
916,
12967,
10585,
29889,
13,
13,
3596,
916,
410,
7345,
6739,
775,
881,
1053,
916,
12967,
10585,
515,
13,
1366,
3883,
29889,
960,
5181,
29892,
788,
716,
24802,
1244,
313,
262,
1716,
7600,
467,
13,
15945,
29908,
13,
13,
1649,
8921,
1649,
353,
12801,
26862,
6227,
29958,
313,
29966,
5813,
12948,
29915,
13,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
29887,
29899,
5215,
29899,
1333,
29899,
271,
29899,
3332,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
348,
3880,
29899,
5215,
13,
13,
2202,
29901,
13,
29871,
515,
5386,
29889,
1212,
29889,
17529,
1053,
1019,
5770,
7701,
13,
19499,
16032,
2392,
29901,
13,
29871,
1209,
13,
2
] |
tests/api/base.py | davidlmorton/webapp-skeleton | 0 | 128436 | from pprint import pprint
from webapp.api.wsgi import app
import abc
import json
import requests
import unittest
__all__ = ['BaseAPITest']
def get_endpoint_name(url):
with app.test_request_context(url) as request_ctx:
url_rule = request_ctx.request.url_rule
if url_rule is None:
return 'Unknown Endpoint'
else:
return url_rule.endpoint.split('.')[-1]
class BaseAPITest(unittest.TestCase):
__metaclass__ = abc.ABCMeta
session = requests.Session()
session.verify = True
def get(self, url, **kwargs):
response = self.deserialize_response(self.session.get(url, **kwargs))
self.print_response(response, **kwargs)
return response
def patch(self, url, data, **kwargs):
response = self.deserialize_response(
self.session.patch(url,
headers={'content-type': 'application/json'},
data=json.dumps(data),
**kwargs))
self.print_response(response)
return response
def post(self, url, data, **kwargs):
response = self.deserialize_response(
self.session.post(url,
allow_redirects=False,
headers={'content-type': 'application/json'},
data=json.dumps(data), **kwargs))
self.print_response(response, **kwargs)
return response
def put(self, url, data, **kwargs):
response = self.deserialize_response(
self.session.put(url,
allow_redirects=False,
headers={'content-type': 'application/json'},
data=json.dumps(data), **kwargs))
self.print_response(response, **kwargs)
return response
def delete(self, url, **kwargs):
response = self.deserialize_response(
self.session.delete(url,
allow_redirects=False,
**kwargs))
self.print_response(response, **kwargs)
return response
@staticmethod
def print_response(response, auth=None, **kwargs):
pad = '==========================='
dpad = pad.replace('=', '-')
request = response.request
print("\n#===================================================" + pad)
print("# %s %s %s" % (response.status_code,
request.method, get_endpoint_name(request.url)))
print("# Url: %s" % request.url)
print("#---------------------------------------------------" + dpad)
if 'Authorization' in request.headers:
print("# Authorization: %s" % request.headers['Authorization'])
if auth:
print("# BasicAuth: USER=%s PASS=%s" % auth)
if request.body:
print("#----------[ Request ]------------------------------" + dpad)
pprint(json.loads(request.body))
print("#----------[ Response: %s ]------------------------" %
response.status_code + dpad)
pprint(response.DATA)
@staticmethod
def deserialize_response(response):
response.DATA = response.json()
return response
| [
1,
515,
282,
2158,
1053,
282,
2158,
13,
3166,
1856,
932,
29889,
2754,
29889,
5652,
3146,
1053,
623,
13,
5215,
25638,
13,
5215,
4390,
13,
5215,
7274,
13,
5215,
443,
27958,
13,
13,
1649,
497,
1649,
353,
6024,
5160,
3301,
1806,
342,
2033,
13,
13,
13,
1753,
679,
29918,
29734,
29918,
978,
29898,
2271,
1125,
13,
1678,
411,
623,
29889,
1688,
29918,
3827,
29918,
4703,
29898,
2271,
29897,
408,
2009,
29918,
13073,
29901,
13,
4706,
3142,
29918,
7491,
353,
2009,
29918,
13073,
29889,
3827,
29889,
2271,
29918,
7491,
13,
13,
1678,
565,
3142,
29918,
7491,
338,
6213,
29901,
13,
4706,
736,
525,
14148,
2796,
3149,
29915,
13,
1678,
1683,
29901,
13,
4706,
736,
3142,
29918,
7491,
29889,
29734,
29889,
5451,
12839,
1495,
14352,
29896,
29962,
13,
13,
13,
1990,
7399,
3301,
1806,
342,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
4770,
2527,
562,
605,
1649,
353,
25638,
29889,
19658,
19346,
13,
1678,
4867,
353,
7274,
29889,
7317,
580,
13,
1678,
4867,
29889,
27902,
353,
5852,
13,
13,
1678,
822,
679,
29898,
1311,
29892,
3142,
29892,
3579,
19290,
1125,
13,
4706,
2933,
353,
1583,
29889,
2783,
261,
6646,
29918,
5327,
29898,
1311,
29889,
7924,
29889,
657,
29898,
2271,
29892,
3579,
19290,
876,
13,
4706,
1583,
29889,
2158,
29918,
5327,
29898,
5327,
29892,
3579,
19290,
29897,
13,
4706,
736,
2933,
13,
13,
1678,
822,
13261,
29898,
1311,
29892,
3142,
29892,
848,
29892,
3579,
19290,
1125,
13,
4706,
2933,
353,
1583,
29889,
2783,
261,
6646,
29918,
5327,
29898,
13,
9651,
1583,
29889,
7924,
29889,
5041,
29898,
2271,
29892,
13,
18884,
9066,
3790,
29915,
3051,
29899,
1853,
2396,
525,
6214,
29914,
3126,
16675,
13,
18884,
848,
29922,
3126,
29889,
29881,
17204,
29898,
1272,
511,
13,
18884,
3579,
19290,
876,
13,
4706,
1583,
29889,
2158,
29918,
5327,
29898,
5327,
29897,
13,
4706,
736,
2933,
13,
13,
1678,
822,
1400,
29898,
1311,
29892,
3142,
29892,
848,
29892,
3579,
19290,
1125,
13,
4706,
2933,
353,
1583,
29889,
2783,
261,
6646,
29918,
5327,
29898,
13,
9651,
1583,
29889,
7924,
29889,
2490,
29898,
2271,
29892,
13,
462,
1678,
2758,
29918,
17886,
29879,
29922,
8824,
29892,
13,
462,
1678,
9066,
3790,
29915,
3051,
29899,
1853,
2396,
525,
6214,
29914,
3126,
16675,
13,
462,
1678,
848,
29922,
3126,
29889,
29881,
17204,
29898,
1272,
511,
3579,
19290,
876,
13,
4706,
1583,
29889,
2158,
29918,
5327,
29898,
5327,
29892,
3579,
19290,
29897,
13,
4706,
736,
2933,
13,
13,
1678,
822,
1925,
29898,
1311,
29892,
3142,
29892,
848,
29892,
3579,
19290,
1125,
13,
4706,
2933,
353,
1583,
29889,
2783,
261,
6646,
29918,
5327,
29898,
13,
9651,
1583,
29889,
7924,
29889,
649,
29898,
2271,
29892,
13,
18884,
2758,
29918,
17886,
29879,
29922,
8824,
29892,
13,
18884,
9066,
3790,
29915,
3051,
29899,
1853,
2396,
525,
6214,
29914,
3126,
16675,
13,
18884,
848,
29922,
3126,
29889,
29881,
17204,
29898,
1272,
511,
3579,
19290,
876,
13,
4706,
1583,
29889,
2158,
29918,
5327,
29898,
5327,
29892,
3579,
19290,
29897,
13,
4706,
736,
2933,
13,
13,
1678,
822,
5217,
29898,
1311,
29892,
3142,
29892,
3579,
19290,
1125,
13,
4706,
2933,
353,
1583,
29889,
2783,
261,
6646,
29918,
5327,
29898,
13,
18884,
1583,
29889,
7924,
29889,
8143,
29898,
2271,
29892,
13,
462,
1678,
2758,
29918,
17886,
29879,
29922,
8824,
29892,
13,
462,
1678,
3579,
19290,
876,
13,
4706,
1583,
29889,
2158,
29918,
5327,
29898,
5327,
29892,
3579,
19290,
29897,
13,
4706,
736,
2933,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
1596,
29918,
5327,
29898,
5327,
29892,
4817,
29922,
8516,
29892,
3579,
19290,
1125,
13,
4706,
17132,
353,
525,
9166,
4936,
1360,
2433,
13,
4706,
270,
8305,
353,
17132,
29889,
6506,
877,
29922,
742,
17411,
1495,
13,
4706,
2009,
353,
2933,
29889,
3827,
13,
4706,
1596,
14182,
29876,
29937,
9166,
9166,
9166,
1360,
543,
718,
17132,
29897,
13,
4706,
1596,
14822,
1273,
29879,
1273,
29879,
1273,
29879,
29908,
1273,
313,
5327,
29889,
4882,
29918,
401,
29892,
13,
462,
1678,
2009,
29889,
5696,
29892,
679,
29918,
29734,
29918,
978,
29898,
3827,
29889,
2271,
4961,
13,
4706,
1596,
14822,
501,
2096,
29901,
1273,
29879,
29908,
1273,
2009,
29889,
2271,
29897,
13,
4706,
1596,
14822,
2683,
2683,
2683,
5634,
29908,
718,
270,
8305,
29897,
13,
4706,
565,
525,
25471,
29915,
297,
2009,
29889,
13662,
29901,
13,
9651,
1596,
14822,
13361,
2133,
29901,
1273,
29879,
29908,
1273,
2009,
29889,
13662,
1839,
25471,
11287,
13,
4706,
565,
4817,
29901,
13,
9651,
1596,
14822,
19219,
6444,
29901,
3148,
1001,
16328,
29879,
17687,
1799,
16328,
29879,
29908,
1273,
4817,
29897,
13,
4706,
565,
2009,
29889,
2587,
29901,
13,
9651,
1596,
14822,
28400,
29961,
10729,
4514,
2683,
9072,
13869,
718,
270,
8305,
29897,
13,
9651,
282,
2158,
29898,
3126,
29889,
18132,
29898,
3827,
29889,
2587,
876,
13,
4706,
1596,
14822,
28400,
29961,
13291,
29901,
1273,
29879,
4514,
2683,
1378,
29908,
1273,
13,
18884,
2933,
29889,
4882,
29918,
401,
718,
270,
8305,
29897,
13,
4706,
282,
2158,
29898,
5327,
29889,
14573,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
16964,
6646,
29918,
5327,
29898,
5327,
1125,
13,
4706,
2933,
29889,
14573,
353,
2933,
29889,
3126,
580,
13,
4706,
736,
2933,
13,
2
] |
bst.py | kentsommer/bst-amortized-analysis | 0 | 95159 | import random
from tabulate import tabulate
class Node:
# Parent pointer used for easier in-order traversal function
def __init__(self, value, parent=None):
self.value = value
self.left = None
self.right = None
self.parent = parent
class BST:
def __init__(self):
self.root = None
# Standard BST insert implementation
def insert(self, value):
if self.root is None:
self.root = Node(value)
current = self.root
while current:
if value == current.value:
return
elif value < current.value:
if current.left:
current = current.left
else:
current.left = Node(value, current)
return
else:
if current.right:
current = current.right
else:
current.right = Node(value, current)
return
# Select random number N between 50:100 for use as tree size.
# Sample N unique random numbers between 0:10,000
# For each i'th unique number insert value into tree.
def gen_random_tree(self):
num_nodes = random.randint(50, 100)
unique_list = random.sample(range(0,10000), num_nodes)
for i in range(0, num_nodes):
self.insert(unique_list[i])
# If current node has left child
# Set current to left child
# Continue until no more left children
def findmostleft(node, stepcount=0):
stepcount = stepcount
current = node
while True:
if current.left != None:
current = current.left
stepcount += 1
continue
break
return current, stepcount
# If the current node has a right child, return leftmost child of right child.
# Else, continue going up parent pointers until parent.left equals current
# Return parent
def findnext(node):
stepcount = 0
if node.right != None:
return findmostleft(node.right, 1)
else:
parent = node.parent
stepcount += 1
while parent != None:
if parent.left == node:
break
node = parent
parent = node.parent
stepcount += 1
return parent, stepcount
# Get first node by calling findmostleft on root
# Make N-1 calls to findnext (where N is the size of the tree)
def inorder(node):
stepcount = 0
first = findmostleft(node)
stepcount += first[1]
current = first[0]
for x in range(1, bst_size(node)):
next = findnext(current)
stepcount += next[1]
current = next[0]
return stepcount
def bst_size(root, count=0):
if root is None:
return count
return bst_size(root.left, bst_size(root.right, count + 1))
# Main function to allow for quick comparison and testing
# Generates 50 random trees and displays actual steps, estimated steps, and size of tree
if __name__ == '__main__':
table = []
for i in range(1, 51):
cTree = BST()
cTree.gen_random_tree()
count = inorder(cTree.root)
size = bst_size(cTree.root)
table.append(["Tree " + str(i), str(size), str(count), str(2 * (size-1))])
print tabulate(table, headers=["Tree Number", "Number of Nodes", "Number of Steps", "2(N-1)"])
| [
1,
1053,
4036,
13,
3166,
4434,
5987,
1053,
4434,
5987,
13,
13,
13,
1990,
9071,
29901,
13,
1678,
396,
22280,
4879,
1304,
363,
6775,
297,
29899,
2098,
13310,
284,
740,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
995,
29892,
3847,
29922,
8516,
1125,
13,
4706,
1583,
29889,
1767,
353,
995,
13,
4706,
1583,
29889,
1563,
353,
6213,
13,
4706,
1583,
29889,
1266,
353,
6213,
13,
4706,
1583,
29889,
3560,
353,
3847,
13,
13,
13,
1990,
350,
1254,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
4632,
353,
6213,
13,
13,
1678,
396,
10117,
350,
1254,
4635,
5314,
13,
1678,
822,
4635,
29898,
1311,
29892,
995,
1125,
13,
4706,
565,
1583,
29889,
4632,
338,
6213,
29901,
13,
9651,
1583,
29889,
4632,
353,
9071,
29898,
1767,
29897,
13,
4706,
1857,
353,
1583,
29889,
4632,
13,
4706,
1550,
1857,
29901,
13,
9651,
565,
995,
1275,
1857,
29889,
1767,
29901,
13,
18884,
736,
13,
9651,
25342,
995,
529,
1857,
29889,
1767,
29901,
13,
18884,
565,
1857,
29889,
1563,
29901,
13,
462,
1678,
1857,
353,
1857,
29889,
1563,
13,
18884,
1683,
29901,
13,
462,
1678,
1857,
29889,
1563,
353,
9071,
29898,
1767,
29892,
1857,
29897,
13,
462,
1678,
736,
13,
9651,
1683,
29901,
13,
18884,
565,
1857,
29889,
1266,
29901,
13,
462,
1678,
1857,
353,
1857,
29889,
1266,
13,
18884,
1683,
29901,
13,
462,
1678,
1857,
29889,
1266,
353,
9071,
29898,
1767,
29892,
1857,
29897,
13,
462,
1678,
736,
13,
13,
1678,
396,
7605,
4036,
1353,
405,
1546,
29871,
29945,
29900,
29901,
29896,
29900,
29900,
363,
671,
408,
5447,
2159,
29889,
13,
1678,
396,
21029,
405,
5412,
4036,
3694,
1546,
29871,
29900,
29901,
29896,
29900,
29892,
29900,
29900,
29900,
13,
1678,
396,
1152,
1269,
474,
29915,
386,
5412,
1353,
4635,
995,
964,
5447,
29889,
13,
1678,
822,
2531,
29918,
8172,
29918,
8336,
29898,
1311,
1125,
13,
4706,
954,
29918,
18010,
353,
4036,
29889,
9502,
524,
29898,
29945,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
4706,
5412,
29918,
1761,
353,
4036,
29889,
11249,
29898,
3881,
29898,
29900,
29892,
29896,
29900,
29900,
29900,
29900,
511,
954,
29918,
18010,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
29900,
29892,
954,
29918,
18010,
1125,
13,
9651,
1583,
29889,
7851,
29898,
13092,
29918,
1761,
29961,
29875,
2314,
13,
13,
13,
29937,
960,
1857,
2943,
756,
2175,
2278,
13,
29937,
3789,
1857,
304,
2175,
2278,
13,
29937,
2866,
14150,
2745,
694,
901,
2175,
4344,
13,
1753,
1284,
3242,
1563,
29898,
3177,
29892,
4331,
2798,
29922,
29900,
1125,
13,
1678,
4331,
2798,
353,
4331,
2798,
13,
1678,
1857,
353,
2943,
13,
1678,
1550,
5852,
29901,
13,
4706,
565,
1857,
29889,
1563,
2804,
6213,
29901,
13,
9651,
1857,
353,
1857,
29889,
1563,
13,
9651,
4331,
2798,
4619,
29871,
29896,
13,
9651,
6773,
13,
4706,
2867,
13,
1678,
736,
1857,
29892,
4331,
2798,
13,
13,
13,
29937,
960,
278,
1857,
2943,
756,
263,
1492,
2278,
29892,
736,
2175,
3242,
2278,
310,
1492,
2278,
29889,
13,
29937,
15785,
29892,
6773,
2675,
701,
3847,
12589,
2745,
3847,
29889,
1563,
15743,
1857,
13,
29937,
7106,
3847,
13,
1753,
1284,
4622,
29898,
3177,
1125,
13,
1678,
4331,
2798,
353,
29871,
29900,
13,
1678,
565,
2943,
29889,
1266,
2804,
6213,
29901,
13,
4706,
736,
1284,
3242,
1563,
29898,
3177,
29889,
1266,
29892,
29871,
29896,
29897,
13,
1678,
1683,
29901,
13,
4706,
3847,
353,
2943,
29889,
3560,
13,
4706,
4331,
2798,
4619,
29871,
29896,
13,
4706,
1550,
3847,
2804,
6213,
29901,
13,
9651,
565,
3847,
29889,
1563,
1275,
2943,
29901,
13,
18884,
2867,
13,
9651,
2943,
353,
3847,
13,
9651,
3847,
353,
2943,
29889,
3560,
13,
9651,
4331,
2798,
4619,
29871,
29896,
13,
4706,
736,
3847,
29892,
4331,
2798,
13,
13,
13,
29937,
3617,
937,
2943,
491,
5432,
1284,
3242,
1563,
373,
3876,
13,
29937,
8561,
405,
29899,
29896,
5717,
304,
1284,
4622,
313,
3062,
405,
338,
278,
2159,
310,
278,
5447,
29897,
13,
1753,
297,
2098,
29898,
3177,
1125,
13,
1678,
4331,
2798,
353,
29871,
29900,
13,
1678,
937,
353,
1284,
3242,
1563,
29898,
3177,
29897,
13,
1678,
4331,
2798,
4619,
937,
29961,
29896,
29962,
13,
1678,
1857,
353,
937,
29961,
29900,
29962,
13,
1678,
363,
921,
297,
3464,
29898,
29896,
29892,
289,
303,
29918,
2311,
29898,
3177,
22164,
13,
4706,
2446,
353,
1284,
4622,
29898,
3784,
29897,
13,
4706,
4331,
2798,
4619,
2446,
29961,
29896,
29962,
13,
4706,
1857,
353,
2446,
29961,
29900,
29962,
13,
1678,
736,
4331,
2798,
13,
13,
13,
1753,
289,
303,
29918,
2311,
29898,
4632,
29892,
2302,
29922,
29900,
1125,
13,
1678,
565,
3876,
338,
6213,
29901,
13,
4706,
736,
2302,
13,
1678,
736,
289,
303,
29918,
2311,
29898,
4632,
29889,
1563,
29892,
289,
303,
29918,
2311,
29898,
4632,
29889,
1266,
29892,
2302,
718,
29871,
29896,
876,
13,
13,
13,
29937,
4241,
740,
304,
2758,
363,
4996,
10230,
322,
6724,
13,
29937,
3251,
1078,
29871,
29945,
29900,
4036,
10697,
322,
14423,
3935,
6576,
29892,
15899,
6576,
29892,
322,
2159,
310,
5447,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1591,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
29871,
29945,
29896,
1125,
13,
4706,
274,
9643,
353,
350,
1254,
580,
13,
4706,
274,
9643,
29889,
1885,
29918,
8172,
29918,
8336,
580,
13,
4706,
2302,
353,
297,
2098,
29898,
29883,
9643,
29889,
4632,
29897,
13,
4706,
2159,
353,
289,
303,
29918,
2311,
29898,
29883,
9643,
29889,
4632,
29897,
13,
4706,
1591,
29889,
4397,
29898,
3366,
9643,
376,
718,
851,
29898,
29875,
511,
851,
29898,
2311,
511,
851,
29898,
2798,
511,
851,
29898,
29906,
334,
313,
2311,
29899,
29896,
876,
2314,
13,
1678,
1596,
4434,
5987,
29898,
2371,
29892,
9066,
29922,
3366,
9643,
9681,
613,
376,
4557,
310,
405,
2631,
613,
376,
4557,
310,
2443,
567,
613,
376,
29906,
29898,
29940,
29899,
29896,
5513,
2314,
13,
2
] |
coPrime.py | prateekgulati/numberTheory | 0 | 179520 | <reponame>prateekgulati/numberTheory
__author__ = 'Prateek'
from sympy import gcd
def coPrime(n):
num = set()
for i in range(1, n):
if (gcd(i, n) == 1):
num.add(i)
return num
#if __author__ == 'Prateek':
# print coPrime(8)
| [
1,
529,
276,
1112,
420,
29958,
558,
403,
1416,
29887,
352,
2219,
29914,
4537,
1576,
706,
13,
1649,
8921,
1649,
353,
525,
4040,
403,
1416,
29915,
13,
3166,
5016,
2272,
1053,
330,
2252,
13,
13,
13,
1753,
1302,
4040,
603,
29898,
29876,
1125,
13,
1678,
954,
353,
731,
580,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
302,
1125,
13,
4706,
565,
313,
29887,
2252,
29898,
29875,
29892,
302,
29897,
1275,
29871,
29896,
1125,
13,
9651,
954,
29889,
1202,
29898,
29875,
29897,
13,
1678,
736,
954,
13,
13,
13,
29937,
361,
4770,
8921,
1649,
1275,
525,
4040,
403,
1416,
2396,
13,
29937,
1678,
1596,
1302,
4040,
603,
29898,
29947,
29897,
13,
2
] |
stanford/sms-tools/lectures/02-DFT/plots-code/idft.py | phunc20/dsp | 1 | 4979 | import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../../../software/models/')
import dftModel as DFT
import math
k0 = 8.5
N = 64
w = np.ones(N)
x = np.cos(2*np.pi*k0/N*np.arange(-N/2,N/2))
mX, pX = DFT.dftAnal(x, w, N)
y = DFT.dftSynth(mX, pX, N)
plt.figure(1, figsize=(9.5, 5))
plt.subplot(311)
plt.title('positive freq. magnitude spectrum in dB: mX')
plt.plot(np.arange(mX.size), mX, 'r', lw=1.5)
plt.axis([0,mX.size, min(mX), max(mX)+1])
plt.subplot(312)
plt.title('positive freq. phase spectrum: pX')
plt.plot(np.arange(pX.size), pX, 'c', lw=1.5)
plt.axis([0, pX.size,-np.pi,np.pi])
plt.subplot(313)
plt.title('inverse spectrum: IDFT(X)')
plt.plot(np.arange(-N/2, N/2), y,'b', lw=1.5)
plt.axis([-N/2,N/2-1,min(y), max(y)])
plt.tight_layout()
plt.savefig('idft.png')
plt.show()
| [
1,
1053,
22889,
29889,
2272,
5317,
408,
14770,
13,
5215,
12655,
408,
7442,
13,
5215,
10876,
13,
13,
9675,
29889,
2084,
29889,
4397,
877,
21546,
6995,
20415,
29914,
9794,
29914,
1495,
13,
5215,
270,
615,
3195,
408,
360,
7818,
13,
5215,
5844,
13,
13,
29895,
29900,
353,
29871,
29947,
29889,
29945,
13,
29940,
353,
29871,
29953,
29946,
13,
29893,
353,
7442,
29889,
2873,
29898,
29940,
29897,
13,
29916,
353,
7442,
29889,
3944,
29898,
29906,
29930,
9302,
29889,
1631,
29930,
29895,
29900,
29914,
29940,
29930,
9302,
29889,
279,
927,
6278,
29940,
29914,
29906,
29892,
29940,
29914,
29906,
876,
13,
29885,
29990,
29892,
282,
29990,
353,
360,
7818,
29889,
29881,
615,
21067,
29898,
29916,
29892,
281,
29892,
405,
29897,
13,
29891,
353,
360,
7818,
29889,
29881,
615,
29216,
386,
29898,
29885,
29990,
29892,
282,
29990,
29892,
405,
29897,
13,
13,
572,
29873,
29889,
4532,
29898,
29896,
29892,
2537,
2311,
7607,
29929,
29889,
29945,
29892,
29871,
29945,
876,
13,
572,
29873,
29889,
1491,
5317,
29898,
29941,
29896,
29896,
29897,
13,
572,
29873,
29889,
3257,
877,
1066,
3321,
3005,
29939,
29889,
18497,
18272,
297,
270,
29933,
29901,
286,
29990,
1495,
13,
572,
29873,
29889,
5317,
29898,
9302,
29889,
279,
927,
29898,
29885,
29990,
29889,
2311,
511,
286,
29990,
29892,
525,
29878,
742,
301,
29893,
29922,
29896,
29889,
29945,
29897,
13,
572,
29873,
29889,
8990,
4197,
29900,
29892,
29885,
29990,
29889,
2311,
29892,
1375,
29898,
29885,
29990,
511,
4236,
29898,
29885,
29990,
7240,
29896,
2314,
13,
13,
572,
29873,
29889,
1491,
5317,
29898,
29941,
29896,
29906,
29897,
13,
572,
29873,
29889,
3257,
877,
1066,
3321,
3005,
29939,
29889,
8576,
18272,
29901,
282,
29990,
1495,
13,
572,
29873,
29889,
5317,
29898,
9302,
29889,
279,
927,
29898,
29886,
29990,
29889,
2311,
511,
282,
29990,
29892,
525,
29883,
742,
301,
29893,
29922,
29896,
29889,
29945,
29897,
13,
572,
29873,
29889,
8990,
4197,
29900,
29892,
282,
29990,
29889,
2311,
6653,
9302,
29889,
1631,
29892,
9302,
29889,
1631,
2314,
13,
13,
572,
29873,
29889,
1491,
5317,
29898,
29941,
29896,
29941,
29897,
13,
572,
29873,
29889,
3257,
877,
262,
3901,
18272,
29901,
3553,
7818,
29898,
29990,
29897,
1495,
13,
572,
29873,
29889,
5317,
29898,
9302,
29889,
279,
927,
6278,
29940,
29914,
29906,
29892,
405,
29914,
29906,
511,
343,
5501,
29890,
742,
301,
29893,
29922,
29896,
29889,
29945,
29897,
13,
572,
29873,
29889,
8990,
4197,
29899,
29940,
29914,
29906,
29892,
29940,
29914,
29906,
29899,
29896,
29892,
1195,
29898,
29891,
511,
4236,
29898,
29891,
29897,
2314,
13,
13,
572,
29873,
29889,
29873,
523,
29918,
2680,
580,
13,
572,
29873,
29889,
7620,
1003,
877,
333,
615,
29889,
2732,
1495,
13,
572,
29873,
29889,
4294,
580,
13,
2
] |
smart_alarm_clock/news_api.py | kfb19/Smart-Alarm-Clock | 0 | 50518 | <gh_stars>0
"""this module collects current news headlines from the API"""
import logging
import requests
from extract_json import get_key
from extract_json import get_location
from extract_json import get_urls
logging.basicConfig(filename='pysys.log',level=logging.INFO, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
BASE_URL = get_urls("news")
API_KEY = get_key("news")
COUNTRY = get_location("country")
COMPLETE_URL = BASE_URL + "country=" + COUNTRY + "&apiKey=" + API_KEY
response = requests.get(COMPLETE_URL)
def get_news() -> list:
"""this function gets the current news information using an API"""
logging.info("Articles returned by get_news()")
news_dict = response.json()
articles = news_dict["articles"]
news_articles = []
for article in articles:
news_articles.append({'name':article['title'], 'url':article['url']})
return news_articles
def check_news_version() -> bool:
"""this function checks for the correct setup of the API"""
try:
news_dict = response.json()
return True
except:
return False
if __name__ == '__main__':
logging.info("News API Module Tested")
print(get_news())#tests the function
print(check_news_version())#tests the function
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
1366,
3883,
6314,
29879,
1857,
9763,
2343,
9012,
515,
278,
3450,
15945,
19451,
13,
30004,
13,
5215,
12183,
30004,
13,
5215,
7274,
30004,
13,
3166,
6597,
29918,
3126,
1053,
679,
29918,
1989,
30004,
13,
3166,
6597,
29918,
3126,
1053,
679,
29918,
5479,
30004,
13,
3166,
6597,
29918,
3126,
1053,
679,
29918,
26045,
30004,
13,
30004,
13,
21027,
29889,
16121,
3991,
29898,
9507,
2433,
29886,
952,
952,
29889,
1188,
742,
5563,
29922,
21027,
29889,
11690,
29892,
3402,
2433,
29995,
29898,
294,
312,
603,
29897,
29879,
1273,
29898,
5563,
978,
6817,
29947,
29879,
1273,
29898,
4906,
29897,
29879,
742,
2635,
23479,
2433,
29995,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
1495,
30004,
13,
25416,
29918,
4219,
353,
679,
29918,
26045,
703,
15753,
1159,
30004,
13,
8787,
29918,
10818,
353,
679,
29918,
1989,
703,
15753,
1159,
30004,
13,
3217,
3904,
5659,
29979,
353,
679,
29918,
5479,
703,
13509,
1159,
30004,
13,
21514,
18476,
29918,
4219,
353,
350,
8127,
29918,
4219,
718,
376,
13509,
543,
718,
4810,
3904,
5659,
29979,
718,
376,
29987,
2754,
2558,
543,
718,
3450,
29918,
10818,
30004,
13,
5327,
353,
7274,
29889,
657,
29898,
21514,
18476,
29918,
4219,
8443,
13,
30004,
13,
1753,
679,
29918,
15753,
580,
1599,
1051,
29901,
30004,
13,
1678,
9995,
1366,
740,
4947,
278,
1857,
9763,
2472,
773,
385,
3450,
15945,
19451,
13,
1678,
12183,
29889,
3888,
703,
9986,
4027,
4133,
491,
679,
29918,
15753,
580,
1159,
30004,
13,
1678,
9763,
29918,
8977,
353,
2933,
29889,
3126,
26471,
13,
1678,
7456,
353,
9763,
29918,
8977,
3366,
18569,
3108,
30004,
13,
1678,
9763,
29918,
18569,
353,
5159,
30004,
13,
1678,
363,
4274,
297,
7456,
29901,
30004,
13,
4706,
9763,
29918,
18569,
29889,
4397,
3319,
29915,
978,
2396,
7914,
1839,
3257,
7464,
525,
2271,
2396,
7914,
1839,
2271,
2033,
1800,
30004,
13,
1678,
736,
9763,
29918,
18569,
30004,
13,
30004,
13,
1753,
1423,
29918,
15753,
29918,
3259,
580,
1599,
6120,
29901,
30004,
13,
1678,
9995,
1366,
740,
12747,
363,
278,
1959,
6230,
310,
278,
3450,
15945,
19451,
13,
1678,
1018,
29901,
30004,
13,
4706,
9763,
29918,
8977,
353,
2933,
29889,
3126,
26471,
13,
4706,
736,
5852,
30004,
13,
1678,
5174,
29901,
30004,
13,
4706,
736,
7700,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
30004,
13,
1678,
12183,
29889,
3888,
703,
29328,
3450,
15591,
323,
2868,
1159,
30004,
13,
1678,
1596,
29898,
657,
29918,
15753,
3101,
29937,
21150,
278,
740,
30004,
13,
1678,
1596,
29898,
3198,
29918,
15753,
29918,
3259,
3101,
29937,
21150,
278,
740,
30004,
13,
2
] |
opteryx/utils/__init__.py | mabel-dev/mabel-sql | 1 | 144235 | <filename>opteryx/utils/__init__.py
from functools import lru_cache
@lru_cache(1)
def is_running_from_ipython():
"""
True when running in Jupyter
"""
try:
from IPython import get_ipython # type:ignore
return get_ipython() is not None
except:
return False
def safe_field_name(field_name):
"""strip all the non-alphanums from a field name"""
import re
pattern = re.compile(r"[^a-zA-Z0-9\_\-]+")
return pattern.sub("", field_name)
| [
1,
529,
9507,
29958,
19959,
29891,
29916,
29914,
13239,
29914,
1649,
2344,
26914,
2272,
13,
3166,
2090,
312,
8789,
1053,
301,
582,
29918,
8173,
13,
13,
13,
29992,
29880,
582,
29918,
8173,
29898,
29896,
29897,
13,
1753,
338,
29918,
21094,
29918,
3166,
29918,
666,
1656,
7295,
13,
1678,
9995,
13,
1678,
5852,
746,
2734,
297,
27441,
25547,
13,
1678,
9995,
13,
1678,
1018,
29901,
13,
4706,
515,
5641,
1656,
1053,
679,
29918,
666,
1656,
29871,
396,
1134,
29901,
17281,
13,
13,
4706,
736,
679,
29918,
666,
1656,
580,
338,
451,
6213,
13,
1678,
5174,
29901,
13,
4706,
736,
7700,
13,
13,
13,
1753,
9109,
29918,
2671,
29918,
978,
29898,
2671,
29918,
978,
1125,
13,
1678,
9995,
17010,
599,
278,
1661,
29899,
284,
16711,
6762,
515,
263,
1746,
1024,
15945,
29908,
13,
1678,
1053,
337,
13,
13,
1678,
4766,
353,
337,
29889,
12198,
29898,
29878,
29908,
22896,
29874,
29899,
25265,
29899,
29999,
29900,
29899,
29929,
29905,
3187,
29899,
10062,
1159,
13,
1678,
736,
4766,
29889,
1491,
703,
613,
1746,
29918,
978,
29897,
13,
2
] |
fixture/application.py | turovod/Python_Addressbook_New_Test_By_Charm | 0 | 144488 | from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from fixture.contact import ContactHelper
from fixture.group import GroupHelper
from fixture.session import SessionHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
# launch from IDE
# self.driver = webdriver.Firefox(executable_path="../Drivers/geckodriver.exe")
# launch from console
self.driver = webdriver.Firefox(executable_path=self.adapted_url_to_webdriver("Drivers\geckodriver.exe"))
elif browser == "chrome":
self.driver = webdriver.Chrome(executable_path=self.adapted_url_to_webdriver("Drivers\chromedriver.exe"))
elif browser == "edge":
self.driver = webdriver.Edge(executable_path=self.adapted_url_to_webdriver("Drivers\msedgedriver.exe"))
else:
raise ValueError(f"Unrecognised browser {browser}")
# self.driver.implicitly_wait(1) # waiting in seconds
# self.base_url = "http://localhost/addressbook/"
self.base_url = base_url
self.session = SessionHelper(self)
self.group = GroupHelper(self)
self.contact = ContactHelper(self)
self.base_url = base_url
def is_valid(self):
try:
self.driver.current_url
return True
except:
return False
def destroy(self):
self.driver.quit()
def open_home_page(self):
driver = self.driver
driver.get(self.base_url)
def is_element_present(self, how, what):
try:
self.driver.find_element(by=how, value=what)
except NoSuchElementException as e:
return False
return True
def adapted_url_to_webdriver(self, local_driver_url):
wd_url = __file__
wd_url = wd_url.strip("fixture\\application.py")
wd_url = "\\".join([wd_url, local_driver_url])
return wd_url | [
1,
515,
18866,
1053,
1856,
9465,
13,
3166,
18866,
29889,
9435,
29889,
11739,
29879,
1053,
1939,
29903,
987,
2642,
2451,
13,
3166,
5713,
15546,
29889,
12346,
1053,
22387,
10739,
13,
3166,
5713,
15546,
29889,
2972,
1053,
6431,
10739,
13,
3166,
5713,
15546,
29889,
7924,
1053,
16441,
10739,
13,
13,
13,
1990,
8427,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4714,
29892,
2967,
29918,
2271,
1125,
13,
4706,
565,
4714,
1275,
376,
8696,
8944,
1115,
13,
9651,
396,
6826,
515,
15004,
13,
9651,
396,
1583,
29889,
9465,
353,
1856,
9465,
29889,
18654,
8944,
29898,
4258,
9246,
29918,
2084,
543,
6995,
29928,
374,
874,
29914,
479,
384,
397,
3511,
29889,
8097,
1159,
13,
9651,
396,
6826,
515,
2991,
13,
9651,
1583,
29889,
9465,
353,
1856,
9465,
29889,
18654,
8944,
29898,
4258,
9246,
29918,
2084,
29922,
1311,
29889,
1114,
415,
287,
29918,
2271,
29918,
517,
29918,
29813,
703,
29928,
374,
874,
29905,
479,
384,
397,
3511,
29889,
8097,
5783,
13,
4706,
25342,
4714,
1275,
376,
18114,
1115,
13,
9651,
1583,
29889,
9465,
353,
1856,
9465,
29889,
1451,
4871,
29898,
4258,
9246,
29918,
2084,
29922,
1311,
29889,
1114,
415,
287,
29918,
2271,
29918,
517,
29918,
29813,
703,
29928,
374,
874,
29905,
27433,
287,
3511,
29889,
8097,
5783,
13,
4706,
25342,
4714,
1275,
376,
12864,
1115,
13,
9651,
1583,
29889,
9465,
353,
1856,
9465,
29889,
23894,
29898,
4258,
9246,
29918,
2084,
29922,
1311,
29889,
1114,
415,
287,
29918,
2271,
29918,
517,
29918,
29813,
703,
29928,
374,
874,
29905,
1516,
287,
3192,
3511,
29889,
8097,
5783,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
29898,
29888,
29908,
2525,
29423,
3368,
4714,
426,
15965,
27195,
13,
4706,
396,
1583,
29889,
9465,
29889,
6574,
4019,
368,
29918,
10685,
29898,
29896,
29897,
396,
10534,
297,
6923,
13,
4706,
396,
1583,
29889,
3188,
29918,
2271,
353,
376,
1124,
597,
7640,
29914,
7328,
2909,
12975,
13,
4706,
1583,
29889,
3188,
29918,
2271,
353,
2967,
29918,
2271,
13,
4706,
1583,
29889,
7924,
353,
16441,
10739,
29898,
1311,
29897,
13,
4706,
1583,
29889,
2972,
353,
6431,
10739,
29898,
1311,
29897,
13,
4706,
1583,
29889,
12346,
353,
22387,
10739,
29898,
1311,
29897,
13,
4706,
1583,
29889,
3188,
29918,
2271,
353,
2967,
29918,
2271,
13,
13,
1678,
822,
338,
29918,
3084,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
9465,
29889,
3784,
29918,
2271,
13,
9651,
736,
5852,
13,
4706,
5174,
29901,
13,
9651,
736,
7700,
13,
13,
1678,
822,
8174,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9465,
29889,
28358,
580,
13,
13,
1678,
822,
1722,
29918,
5184,
29918,
3488,
29898,
1311,
1125,
13,
4706,
7156,
353,
1583,
29889,
9465,
13,
4706,
7156,
29889,
657,
29898,
1311,
29889,
3188,
29918,
2271,
29897,
13,
13,
1678,
822,
338,
29918,
5029,
29918,
6338,
29898,
1311,
29892,
920,
29892,
825,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
9465,
29889,
2886,
29918,
5029,
29898,
1609,
29922,
3525,
29892,
995,
29922,
5816,
29897,
13,
4706,
5174,
1939,
29903,
987,
2642,
2451,
408,
321,
29901,
13,
9651,
736,
7700,
13,
4706,
736,
5852,
13,
13,
1678,
822,
23430,
29918,
2271,
29918,
517,
29918,
29813,
29898,
1311,
29892,
1887,
29918,
9465,
29918,
2271,
1125,
13,
4706,
281,
29881,
29918,
2271,
353,
4770,
1445,
1649,
13,
4706,
281,
29881,
29918,
2271,
353,
281,
29881,
29918,
2271,
29889,
17010,
703,
7241,
15546,
1966,
6214,
29889,
2272,
1159,
13,
4706,
281,
29881,
29918,
2271,
353,
376,
1966,
1642,
7122,
4197,
9970,
29918,
2271,
29892,
1887,
29918,
9465,
29918,
2271,
2314,
13,
4706,
736,
281,
29881,
29918,
2271,
2
] |
tests/test_higherorder.py | hsadeghidw/dimod | 0 | 129221 | <reponame>hsadeghidw/dimod
# Copyright 2018 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import itertools
import unittest
import dimod
from dimod import make_quadratic, poly_energy, poly_energies
class TestMakeQuadratic(unittest.TestCase):
def test__spin_prod(self):
bqm = dimod.higherorder.utils._spin_product(['a', 'b', 'p', 'aux'])
for v in ['a', 'b', 'p', 'aux']:
self.assertIn(v, bqm.variables)
self.assertEqual(len(bqm), 4) # has an auxiliary variable
seen = set()
samples = dimod.ExactSolver().sample(bqm)
for sample, energy in samples.data(['sample', 'energy']):
if energy == 0:
self.assertEqual(sample['a'] * sample['b'], sample['p'])
seen.add((sample['a'], sample['b'], sample['p']))
if sample['a'] * sample['b'] != sample['p']:
self.assertGreaterEqual(energy, 1) # gap 1
self.assertEqual(seen, {(-1, -1, +1),
(-1, +1, -1),
(+1, -1, -1),
(+1, +1, +1)})
def test__binary_prod(self):
variables = ['a', 'b', 'p']
bqm = dimod.higherorder.utils._binary_product(variables)
for v in variables:
self.assertIn(v, bqm.variables)
self.assertEqual(len(bqm), 3)
seen = set()
samples = dimod.ExactSolver().sample(bqm)
for sample, energy in samples.data(['sample', 'energy']):
if energy == 0:
self.assertEqual(sample['a'] * sample['b'], sample['p'])
seen.add((sample['a'], sample['b'], sample['p']))
if sample['a'] * sample['b'] != sample['p']:
self.assertGreaterEqual(energy, 1) # gap 1
self.assertEqual(seen, {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 1)})
def test_empty(self):
bqm = make_quadratic({}, 1.0, dimod.SPIN)
self.assertEqual(bqm, dimod.BinaryQuadraticModel.empty(dimod.SPIN))
def test_no_higher_order(self):
poly = {(0, 1): -1, (1, 2): 1}
bqm = make_quadratic(poly, 1.0, dimod.SPIN)
variables = set().union(*poly)
aux_variables = tuple(set(bqm.linear) - variables)
variables = tuple(variables)
for config in itertools.product((-1, 1), repeat=len(variables)):
sample = dict(zip(variables, config))
energy = poly_energy(sample, poly)
reduced_energies = []
for aux_config in itertools.product((-1, 1),
repeat=len(aux_variables)):
aux_sample = dict(zip(aux_variables, aux_config))
aux_sample.update(sample)
reduced_energies.append(bqm.energy(aux_sample))
self.assertAlmostEqual(energy, min(reduced_energies))
def test_simple(self):
poly = {(0, 1, 2): -1}
bqm = make_quadratic(poly, 5.0, dimod.SPIN)
variables = set().union(*poly)
aux_variables = tuple(set(bqm.linear) - variables)
variables = tuple(variables)
self.assertTrue(aux_variables)
for config in itertools.product((-1, 1), repeat=len(variables)):
sample = dict(zip(variables, config))
energy = poly_energy(sample, poly)
reduced_energies = []
for aux_config in itertools.product((-1, 1),
repeat=len(aux_variables)):
aux_sample = dict(zip(aux_variables, aux_config))
aux_sample.update(sample)
reduced_energies.append(bqm.energy(aux_sample))
self.assertAlmostEqual(energy, min(reduced_energies))
def test_several_terms(self):
poly = {(0, 1, 2): -1, (1, 2, 3): 1, (0, 2, 3): .5,
(0,): .4,
(): .5}
bqm = make_quadratic(poly, 5.0,
bqm=dimod.BinaryQuadraticModel.empty(dimod.SPIN))
variables = set().union(*poly)
aux_variables = tuple(set(bqm.linear) - variables)
variables = tuple(variables)
self.assertTrue(aux_variables)
for config in itertools.product((-1, 1), repeat=len(variables)):
sample = dict(zip(variables, config))
energy = poly_energy(sample, poly)
reduced_energies = []
for aux_config in itertools.product((-1, 1),
repeat=len(aux_variables)):
aux_sample = dict(zip(aux_variables, aux_config))
aux_sample.update(sample)
reduced_energies.append(bqm.energy(aux_sample))
self.assertAlmostEqual(energy, min(reduced_energies))
def test_bug(self):
# from a bug report
# https://support.dwavesys.com/hc/en-us/community/posts/360035719954-dimod-make-quadratic-returns-error
H = {(0, 1, 0, 1): -4.61898,
(0, 1, 1, 0): 4.61898,
(0, 2, 0, 2): -5.18353,
(0, 2, 2, 0): 5.18353,
(1, 0, 0, 1): 4.61898,
(1, 0, 1, 0): -4.61898,
(1, 2, 2, 1): 4.97017,
(2, 0, 0, 2): 5.18353,
(2, 0, 2, 0): -5.18353,
(2, 1, 1, 2): 4.97017,
}
bqm = make_quadratic(H, 1, 'BINARY')
# should be no aux variables
self.assertEqual(set(bqm.variables), {0, 1, 2})
def test_another(self):
J = {(0, 1, 2): -1, (0, 1, 3): -1, (2, 3, 0): 1, (3, 2, 0): -1}
h = {0: 0, 1: 0, 2: 0, 3: 0}
off = .5
poly = J.copy()
poly.update({(v,): bias for v, bias in h.items()})
poly[()] = off
bqm = make_quadratic(J, 5.0,
bqm=dimod.BinaryQuadraticModel.from_ising(h, {},
off))
variables = set(h).union(*J)
aux_variables = tuple(set(bqm.linear) - variables)
variables = tuple(variables)
self.assertTrue(aux_variables)
for config in itertools.product((-1, 1), repeat=len(variables)):
sample = dict(zip(variables, config))
energy = poly_energy(sample, poly)
reduced_energies = []
for aux_config in itertools.product((-1, 1),
repeat=len(aux_variables)):
aux_sample = dict(zip(aux_variables, aux_config))
aux_sample.update(sample)
reduced_energies.append(bqm.energy(aux_sample))
self.assertAlmostEqual(energy, min(reduced_energies))
def test_vartype(self):
poly = {(0, 1, 2): 10, (0, 1): 5} # make sure (0, 1) is most common
self.assertEqual(dimod.make_quadratic(poly, 1.0, 'SPIN'),
dimod.make_quadratic(poly, 1.0, dimod.SPIN))
self.assertEqual(dimod.make_quadratic(poly, 1.0, 'BINARY'),
dimod.make_quadratic(poly, 1.0, dimod.BINARY))
def test_quad_to_linear(self):
J = {(0, 1): -1, (0, 1, 2): 1, (0, 1, 3): 1}
h = {}
off = .5
poly = J.copy()
poly.update({(v,): bias for v, bias in h.items()})
poly[()] = off
bqm = make_quadratic(J, 10.0,
bqm=dimod.BinaryQuadraticModel.from_ising(h, {},
off))
variables = set(h).union(*J)
aux_variables = tuple(set(bqm.linear) - variables)
variables = tuple(variables)
self.assertTrue(aux_variables)
for config in itertools.product((-1, 1), repeat=len(variables)):
sample = dict(zip(variables, config))
energy = poly_energy(sample, poly)
reduced_energies = []
for aux_config in itertools.product((-1, 1),
repeat=len(aux_variables)):
aux_sample = dict(zip(aux_variables, aux_config))
aux_sample.update(sample)
reduced_energies.append(bqm.energy(aux_sample))
self.assertAlmostEqual(energy, min(reduced_energies))
def test_linear_and_offset(self):
poly = {(0,): .5, tuple(): 1.3}
bqm = dimod.make_quadratic(poly, 10.0, dimod.BINARY)
self.assertEqual(bqm, dimod.BinaryQuadraticModel({0: .5}, {}, 1.3,
dimod.BINARY))
def test_binary_polynomial(self):
HUBO = {(0, 1, 2): .5, (0, 1): 1.3, (2, 4, 1): -1, (3, 2): -1}
bqm = make_quadratic(HUBO, 1000.0, dimod.BINARY)
variables = set().union(*HUBO)
aux_variables = tuple(set(bqm.linear) - variables)
variables = tuple(variables)
self.assertTrue(aux_variables)
for config in itertools.product((0, 1), repeat=len(variables)):
sample = dict(zip(variables, config))
energy = poly_energy(sample, HUBO)
reduced_energies = []
for aux_config in itertools.product((0, 1),
repeat=len(aux_variables)):
aux_sample = dict(zip(aux_variables, aux_config))
aux_sample.update(sample)
reduced_energies.append(bqm.energy(aux_sample))
self.assertAlmostEqual(energy, min(reduced_energies))
def test_poly_energies(self):
linear = {0: 1.0, 1: 1.0}
j = {(0, 1, 2): 0.5}
poly = dimod.BinaryPolynomial.from_hising(linear, j)
samples = [[1, 1, -1], [1, -1, 1], [1, 1, 1], [-1, 1, -1]]
en = poly_energies(samples, poly)
self.assertListEqual(list(en), [1.5, -0.5, 2.5, 0.5])
en = poly_energy(samples[0], poly)
self.assertAlmostEqual(en, 1.5)
with self.assertRaises(ValueError):
poly_energy(samples, poly)
poly = {('a',): 1.0, ('b',): 1.0, ('a', 'b', 'c'): 0.5}
samples = [{'a': 1, 'b': 1, 'c': -1},
{'a': 1, 'b': -1, 'c': 1},
{'a': 1, 'b': 1, 'c': 1},
{'a': -1, 'b': 1, 'c': -1}]
en = poly_energies(samples, poly)
self.assertListEqual(list(en), [1.5, -0.5, 2.5, 0.5])
en = poly_energy(samples[0], poly)
self.assertAlmostEqual(en, 1.5)
with self.assertRaises(ValueError):
poly_energy(samples, poly)
| [
1,
529,
276,
1112,
420,
29958,
9499,
1943,
12443,
333,
29893,
29914,
6229,
397,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29947,
360,
29899,
29956,
1351,
23985,
9266,
29889,
13,
29937,
13,
29937,
1678,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
13,
29937,
1678,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
13,
29937,
1678,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
4706,
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,
13,
29937,
1678,
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,
1678,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
1678,
27028,
1090,
278,
19245,
29889,
13,
13,
5215,
4256,
8504,
13,
5215,
443,
27958,
13,
13,
5215,
3964,
397,
13,
3166,
3964,
397,
1053,
1207,
29918,
3425,
29878,
2454,
29892,
15680,
29918,
27548,
29892,
15680,
29918,
759,
29887,
583,
13,
13,
13,
1990,
4321,
9984,
2182,
7887,
2454,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
1649,
1028,
262,
29918,
10633,
29898,
1311,
1125,
13,
13,
4706,
289,
29939,
29885,
353,
3964,
397,
29889,
9812,
261,
2098,
29889,
13239,
3032,
1028,
262,
29918,
4704,
18959,
29874,
742,
525,
29890,
742,
525,
29886,
742,
525,
2993,
11287,
13,
13,
4706,
363,
325,
297,
6024,
29874,
742,
525,
29890,
742,
525,
29886,
742,
525,
2993,
2033,
29901,
13,
9651,
1583,
29889,
9294,
797,
29898,
29894,
29892,
289,
29939,
29885,
29889,
20897,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
29890,
29939,
29885,
511,
29871,
29946,
29897,
29871,
396,
756,
385,
29587,
653,
2286,
13,
13,
4706,
3595,
353,
731,
580,
13,
4706,
11916,
353,
3964,
397,
29889,
1252,
627,
13296,
369,
2141,
11249,
29898,
29890,
29939,
29885,
29897,
13,
4706,
363,
4559,
29892,
5864,
297,
11916,
29889,
1272,
18959,
11249,
742,
525,
27548,
2033,
1125,
13,
9651,
565,
5864,
1275,
29871,
29900,
29901,
13,
18884,
1583,
29889,
9294,
9843,
29898,
11249,
1839,
29874,
2033,
334,
4559,
1839,
29890,
7464,
4559,
1839,
29886,
11287,
13,
18884,
3595,
29889,
1202,
3552,
11249,
1839,
29874,
7464,
4559,
1839,
29890,
7464,
4559,
1839,
29886,
25901,
13,
9651,
565,
4559,
1839,
29874,
2033,
334,
4559,
1839,
29890,
2033,
2804,
4559,
1839,
29886,
2033,
29901,
13,
18884,
1583,
29889,
9294,
25120,
1008,
9843,
29898,
27548,
29892,
29871,
29896,
29897,
29871,
396,
17261,
29871,
29896,
13,
4706,
1583,
29889,
9294,
9843,
29898,
28026,
29892,
426,
6278,
29896,
29892,
448,
29896,
29892,
718,
29896,
511,
13,
462,
18884,
8521,
29896,
29892,
718,
29896,
29892,
448,
29896,
511,
13,
462,
18884,
20532,
29896,
29892,
448,
29896,
29892,
448,
29896,
511,
13,
462,
18884,
20532,
29896,
29892,
718,
29896,
29892,
718,
29896,
26972,
13,
13,
1678,
822,
1243,
1649,
19541,
29918,
10633,
29898,
1311,
1125,
13,
13,
4706,
3651,
353,
6024,
29874,
742,
525,
29890,
742,
525,
29886,
2033,
13,
13,
4706,
289,
29939,
29885,
353,
3964,
397,
29889,
9812,
261,
2098,
29889,
13239,
3032,
19541,
29918,
4704,
29898,
20897,
29897,
13,
13,
4706,
363,
325,
297,
3651,
29901,
13,
9651,
1583,
29889,
9294,
797,
29898,
29894,
29892,
289,
29939,
29885,
29889,
20897,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
29890,
29939,
29885,
511,
29871,
29941,
29897,
13,
13,
4706,
3595,
353,
731,
580,
13,
4706,
11916,
353,
3964,
397,
29889,
1252,
627,
13296,
369,
2141,
11249,
29898,
29890,
29939,
29885,
29897,
13,
4706,
363,
4559,
29892,
5864,
297,
11916,
29889,
1272,
18959,
11249,
742,
525,
27548,
2033,
1125,
13,
9651,
565,
5864,
1275,
29871,
29900,
29901,
13,
18884,
1583,
29889,
9294,
9843,
29898,
11249,
1839,
29874,
2033,
334,
4559,
1839,
29890,
7464,
4559,
1839,
29886,
11287,
13,
18884,
3595,
29889,
1202,
3552,
11249,
1839,
29874,
7464,
4559,
1839,
29890,
7464,
4559,
1839,
29886,
25901,
13,
9651,
565,
4559,
1839,
29874,
2033,
334,
4559,
1839,
29890,
2033,
2804,
4559,
1839,
29886,
2033,
29901,
13,
18884,
1583,
29889,
9294,
25120,
1008,
9843,
29898,
27548,
29892,
29871,
29896,
29897,
29871,
396,
17261,
29871,
29896,
13,
4706,
1583,
29889,
9294,
9843,
29898,
28026,
29892,
426,
29898,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
511,
313,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
511,
313,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
511,
313,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
26972,
13,
13,
1678,
822,
1243,
29918,
6310,
29898,
1311,
1125,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
3319,
1118,
29871,
29896,
29889,
29900,
29892,
3964,
397,
29889,
5550,
1177,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29939,
29885,
29892,
3964,
397,
29889,
25196,
2182,
7887,
2454,
3195,
29889,
6310,
29898,
6229,
397,
29889,
5550,
1177,
876,
13,
13,
1678,
822,
1243,
29918,
1217,
29918,
9812,
261,
29918,
2098,
29898,
1311,
1125,
13,
4706,
15680,
353,
426,
29898,
29900,
29892,
29871,
29896,
1125,
448,
29896,
29892,
313,
29896,
29892,
29871,
29906,
1125,
29871,
29896,
29913,
13,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29896,
29889,
29900,
29892,
3964,
397,
29889,
5550,
1177,
29897,
13,
13,
4706,
3651,
353,
731,
2141,
13094,
10456,
22678,
29897,
13,
4706,
3479,
29918,
20897,
353,
18761,
29898,
842,
29898,
29890,
29939,
29885,
29889,
10660,
29897,
448,
3651,
29897,
13,
4706,
3651,
353,
18761,
29898,
20897,
29897,
13,
4706,
363,
2295,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
12312,
29922,
2435,
29898,
20897,
22164,
13,
9651,
4559,
353,
9657,
29898,
7554,
29898,
20897,
29892,
2295,
876,
13,
13,
9651,
5864,
353,
15680,
29918,
27548,
29898,
11249,
29892,
15680,
29897,
13,
13,
9651,
12212,
29918,
759,
29887,
583,
353,
5159,
13,
9651,
363,
3479,
29918,
2917,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
13,
462,
462,
18884,
12312,
29922,
2435,
29898,
2993,
29918,
20897,
22164,
13,
18884,
3479,
29918,
11249,
353,
9657,
29898,
7554,
29898,
2993,
29918,
20897,
29892,
3479,
29918,
2917,
876,
13,
18884,
3479,
29918,
11249,
29889,
5504,
29898,
11249,
29897,
13,
18884,
12212,
29918,
759,
29887,
583,
29889,
4397,
29898,
29890,
29939,
29885,
29889,
27548,
29898,
2993,
29918,
11249,
876,
13,
13,
9651,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
27548,
29892,
1375,
29898,
9313,
1133,
29918,
759,
29887,
583,
876,
13,
13,
1678,
822,
1243,
29918,
12857,
29898,
1311,
1125,
13,
4706,
15680,
353,
426,
29898,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
448,
29896,
29913,
13,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29945,
29889,
29900,
29892,
3964,
397,
29889,
5550,
1177,
29897,
13,
13,
4706,
3651,
353,
731,
2141,
13094,
10456,
22678,
29897,
13,
4706,
3479,
29918,
20897,
353,
18761,
29898,
842,
29898,
29890,
29939,
29885,
29889,
10660,
29897,
448,
3651,
29897,
13,
4706,
3651,
353,
18761,
29898,
20897,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2993,
29918,
20897,
29897,
13,
4706,
363,
2295,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
12312,
29922,
2435,
29898,
20897,
22164,
13,
9651,
4559,
353,
9657,
29898,
7554,
29898,
20897,
29892,
2295,
876,
13,
13,
9651,
5864,
353,
15680,
29918,
27548,
29898,
11249,
29892,
15680,
29897,
13,
13,
9651,
12212,
29918,
759,
29887,
583,
353,
5159,
13,
9651,
363,
3479,
29918,
2917,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
13,
462,
462,
18884,
12312,
29922,
2435,
29898,
2993,
29918,
20897,
22164,
13,
18884,
3479,
29918,
11249,
353,
9657,
29898,
7554,
29898,
2993,
29918,
20897,
29892,
3479,
29918,
2917,
876,
13,
18884,
3479,
29918,
11249,
29889,
5504,
29898,
11249,
29897,
13,
18884,
12212,
29918,
759,
29887,
583,
29889,
4397,
29898,
29890,
29939,
29885,
29889,
27548,
29898,
2993,
29918,
11249,
876,
13,
13,
9651,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
27548,
29892,
1375,
29898,
9313,
1133,
29918,
759,
29887,
583,
876,
13,
13,
1678,
822,
1243,
29918,
344,
369,
284,
29918,
357,
1516,
29898,
1311,
1125,
13,
4706,
15680,
353,
426,
29898,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
448,
29896,
29892,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1125,
29871,
29896,
29892,
313,
29900,
29892,
29871,
29906,
29892,
29871,
29941,
1125,
869,
29945,
29892,
13,
18884,
313,
29900,
29892,
1125,
869,
29946,
29892,
13,
18884,
313,
1125,
869,
29945,
29913,
13,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29945,
29889,
29900,
29892,
13,
462,
632,
289,
29939,
29885,
29922,
6229,
397,
29889,
25196,
2182,
7887,
2454,
3195,
29889,
6310,
29898,
6229,
397,
29889,
5550,
1177,
876,
13,
13,
4706,
3651,
353,
731,
2141,
13094,
10456,
22678,
29897,
13,
4706,
3479,
29918,
20897,
353,
18761,
29898,
842,
29898,
29890,
29939,
29885,
29889,
10660,
29897,
448,
3651,
29897,
13,
4706,
3651,
353,
18761,
29898,
20897,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2993,
29918,
20897,
29897,
13,
4706,
363,
2295,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
12312,
29922,
2435,
29898,
20897,
22164,
13,
9651,
4559,
353,
9657,
29898,
7554,
29898,
20897,
29892,
2295,
876,
13,
13,
9651,
5864,
353,
15680,
29918,
27548,
29898,
11249,
29892,
15680,
29897,
13,
13,
9651,
12212,
29918,
759,
29887,
583,
353,
5159,
13,
9651,
363,
3479,
29918,
2917,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
13,
462,
462,
18884,
12312,
29922,
2435,
29898,
2993,
29918,
20897,
22164,
13,
18884,
3479,
29918,
11249,
353,
9657,
29898,
7554,
29898,
2993,
29918,
20897,
29892,
3479,
29918,
2917,
876,
13,
18884,
3479,
29918,
11249,
29889,
5504,
29898,
11249,
29897,
13,
18884,
12212,
29918,
759,
29887,
583,
29889,
4397,
29898,
29890,
29939,
29885,
29889,
27548,
29898,
2993,
29918,
11249,
876,
13,
13,
9651,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
27548,
29892,
1375,
29898,
9313,
1133,
29918,
759,
29887,
583,
876,
13,
13,
1678,
822,
1243,
29918,
6152,
29898,
1311,
1125,
13,
4706,
396,
515,
263,
6494,
3461,
29871,
13,
4706,
396,
2045,
597,
5924,
29889,
28012,
5989,
952,
29889,
510,
29914,
29882,
29883,
29914,
264,
29899,
375,
29914,
23834,
29914,
14080,
29914,
29941,
29953,
29900,
29900,
29941,
29945,
29955,
29896,
29929,
29929,
29945,
29946,
29899,
6229,
397,
29899,
5675,
29899,
3425,
29878,
2454,
29899,
18280,
29899,
2704,
13,
4706,
379,
353,
426,
29898,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
1125,
448,
29946,
29889,
29953,
29896,
29947,
29929,
29947,
29892,
13,
632,
313,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
1125,
29871,
29946,
29889,
29953,
29896,
29947,
29929,
29947,
29892,
13,
632,
313,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
29892,
29871,
29906,
1125,
448,
29945,
29889,
29896,
29947,
29941,
29945,
29941,
29892,
13,
632,
313,
29900,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29900,
1125,
29871,
29945,
29889,
29896,
29947,
29941,
29945,
29941,
29892,
13,
632,
313,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
1125,
29871,
29946,
29889,
29953,
29896,
29947,
29929,
29947,
29892,
13,
632,
313,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
1125,
448,
29946,
29889,
29953,
29896,
29947,
29929,
29947,
29892,
13,
632,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
29871,
29896,
1125,
29871,
29946,
29889,
29929,
29955,
29900,
29896,
29955,
29892,
13,
632,
313,
29906,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
1125,
29871,
29945,
29889,
29896,
29947,
29941,
29945,
29941,
29892,
13,
632,
313,
29906,
29892,
29871,
29900,
29892,
29871,
29906,
29892,
29871,
29900,
1125,
448,
29945,
29889,
29896,
29947,
29941,
29945,
29941,
29892,
13,
632,
313,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
29871,
29946,
29889,
29929,
29955,
29900,
29896,
29955,
29892,
13,
632,
500,
13,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
29898,
29950,
29892,
29871,
29896,
29892,
525,
29933,
1177,
19926,
1495,
13,
13,
4706,
396,
881,
367,
694,
3479,
3651,
13,
4706,
1583,
29889,
9294,
9843,
29898,
842,
29898,
29890,
29939,
29885,
29889,
20897,
511,
426,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1800,
13,
13,
1678,
822,
1243,
29918,
23327,
29898,
1311,
1125,
13,
4706,
435,
353,
426,
29898,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
448,
29896,
29892,
313,
29900,
29892,
29871,
29896,
29892,
29871,
29941,
1125,
448,
29896,
29892,
313,
29906,
29892,
29871,
29941,
29892,
29871,
29900,
1125,
29871,
29896,
29892,
313,
29941,
29892,
29871,
29906,
29892,
29871,
29900,
1125,
448,
29896,
29913,
13,
4706,
298,
353,
426,
29900,
29901,
29871,
29900,
29892,
29871,
29896,
29901,
29871,
29900,
29892,
29871,
29906,
29901,
29871,
29900,
29892,
29871,
29941,
29901,
29871,
29900,
29913,
13,
4706,
1283,
353,
869,
29945,
13,
13,
4706,
15680,
353,
435,
29889,
8552,
580,
13,
4706,
15680,
29889,
5504,
3319,
29898,
29894,
29892,
1125,
24003,
363,
325,
29892,
24003,
297,
298,
29889,
7076,
580,
1800,
13,
4706,
15680,
29961,
580,
29962,
353,
1283,
13,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
29898,
29967,
29892,
29871,
29945,
29889,
29900,
29892,
13,
462,
632,
289,
29939,
29885,
29922,
6229,
397,
29889,
25196,
2182,
7887,
2454,
3195,
29889,
3166,
29918,
5921,
29898,
29882,
29892,
24335,
13,
462,
462,
462,
462,
539,
1283,
876,
13,
13,
4706,
3651,
353,
731,
29898,
29882,
467,
13094,
10456,
29967,
29897,
13,
4706,
3479,
29918,
20897,
353,
18761,
29898,
842,
29898,
29890,
29939,
29885,
29889,
10660,
29897,
448,
3651,
29897,
13,
4706,
3651,
353,
18761,
29898,
20897,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2993,
29918,
20897,
29897,
13,
4706,
363,
2295,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
12312,
29922,
2435,
29898,
20897,
22164,
13,
9651,
4559,
353,
9657,
29898,
7554,
29898,
20897,
29892,
2295,
876,
13,
13,
9651,
5864,
353,
15680,
29918,
27548,
29898,
11249,
29892,
15680,
29897,
13,
13,
9651,
12212,
29918,
759,
29887,
583,
353,
5159,
13,
9651,
363,
3479,
29918,
2917,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
13,
462,
462,
18884,
12312,
29922,
2435,
29898,
2993,
29918,
20897,
22164,
13,
18884,
3479,
29918,
11249,
353,
9657,
29898,
7554,
29898,
2993,
29918,
20897,
29892,
3479,
29918,
2917,
876,
13,
18884,
3479,
29918,
11249,
29889,
5504,
29898,
11249,
29897,
13,
18884,
12212,
29918,
759,
29887,
583,
29889,
4397,
29898,
29890,
29939,
29885,
29889,
27548,
29898,
2993,
29918,
11249,
876,
13,
13,
9651,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
27548,
29892,
1375,
29898,
9313,
1133,
29918,
759,
29887,
583,
876,
13,
13,
1678,
822,
1243,
29918,
29894,
442,
668,
29898,
1311,
1125,
13,
4706,
15680,
353,
426,
29898,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
29871,
29896,
29900,
29892,
313,
29900,
29892,
29871,
29896,
1125,
29871,
29945,
29913,
29871,
396,
1207,
1854,
313,
29900,
29892,
29871,
29896,
29897,
338,
1556,
3619,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6229,
397,
29889,
5675,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29896,
29889,
29900,
29892,
525,
5550,
1177,
5477,
13,
462,
308,
3964,
397,
29889,
5675,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29896,
29889,
29900,
29892,
3964,
397,
29889,
5550,
1177,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
6229,
397,
29889,
5675,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29896,
29889,
29900,
29892,
525,
29933,
1177,
19926,
5477,
13,
462,
308,
3964,
397,
29889,
5675,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29896,
29889,
29900,
29892,
3964,
397,
29889,
29933,
1177,
19926,
876,
13,
13,
1678,
822,
1243,
29918,
3425,
29918,
517,
29918,
10660,
29898,
1311,
1125,
13,
4706,
435,
353,
426,
29898,
29900,
29892,
29871,
29896,
1125,
448,
29896,
29892,
313,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
29871,
29896,
29892,
313,
29900,
29892,
29871,
29896,
29892,
29871,
29941,
1125,
29871,
29896,
29913,
13,
4706,
298,
353,
6571,
13,
4706,
1283,
353,
869,
29945,
13,
13,
4706,
15680,
353,
435,
29889,
8552,
580,
13,
4706,
15680,
29889,
5504,
3319,
29898,
29894,
29892,
1125,
24003,
363,
325,
29892,
24003,
297,
298,
29889,
7076,
580,
1800,
13,
4706,
15680,
29961,
580,
29962,
353,
1283,
13,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
29898,
29967,
29892,
29871,
29896,
29900,
29889,
29900,
29892,
13,
462,
632,
289,
29939,
29885,
29922,
6229,
397,
29889,
25196,
2182,
7887,
2454,
3195,
29889,
3166,
29918,
5921,
29898,
29882,
29892,
24335,
13,
462,
462,
462,
462,
539,
1283,
876,
13,
13,
4706,
3651,
353,
731,
29898,
29882,
467,
13094,
10456,
29967,
29897,
13,
4706,
3479,
29918,
20897,
353,
18761,
29898,
842,
29898,
29890,
29939,
29885,
29889,
10660,
29897,
448,
3651,
29897,
13,
4706,
3651,
353,
18761,
29898,
20897,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2993,
29918,
20897,
29897,
13,
4706,
363,
2295,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
12312,
29922,
2435,
29898,
20897,
22164,
13,
9651,
4559,
353,
9657,
29898,
7554,
29898,
20897,
29892,
2295,
876,
13,
13,
9651,
5864,
353,
15680,
29918,
27548,
29898,
11249,
29892,
15680,
29897,
13,
13,
9651,
12212,
29918,
759,
29887,
583,
353,
5159,
13,
9651,
363,
3479,
29918,
2917,
297,
4256,
8504,
29889,
4704,
3552,
29899,
29896,
29892,
29871,
29896,
511,
13,
462,
462,
18884,
12312,
29922,
2435,
29898,
2993,
29918,
20897,
22164,
13,
18884,
3479,
29918,
11249,
353,
9657,
29898,
7554,
29898,
2993,
29918,
20897,
29892,
3479,
29918,
2917,
876,
13,
18884,
3479,
29918,
11249,
29889,
5504,
29898,
11249,
29897,
13,
18884,
12212,
29918,
759,
29887,
583,
29889,
4397,
29898,
29890,
29939,
29885,
29889,
27548,
29898,
2993,
29918,
11249,
876,
13,
13,
9651,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
27548,
29892,
1375,
29898,
9313,
1133,
29918,
759,
29887,
583,
876,
13,
13,
1678,
822,
1243,
29918,
10660,
29918,
392,
29918,
10289,
29898,
1311,
1125,
13,
13,
4706,
15680,
353,
426,
29898,
29900,
29892,
1125,
869,
29945,
29892,
18761,
7295,
29871,
29896,
29889,
29941,
29913,
13,
13,
4706,
289,
29939,
29885,
353,
3964,
397,
29889,
5675,
29918,
3425,
29878,
2454,
29898,
22678,
29892,
29871,
29896,
29900,
29889,
29900,
29892,
3964,
397,
29889,
29933,
1177,
19926,
29897,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29939,
29885,
29892,
3964,
397,
29889,
25196,
2182,
7887,
2454,
3195,
3319,
29900,
29901,
869,
29945,
1118,
24335,
29871,
29896,
29889,
29941,
29892,
13,
462,
462,
462,
308,
3964,
397,
29889,
29933,
1177,
19926,
876,
13,
13,
1678,
822,
1243,
29918,
19541,
29918,
3733,
9222,
29898,
1311,
1125,
13,
13,
4706,
379,
7466,
29949,
353,
426,
29898,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
869,
29945,
29892,
313,
29900,
29892,
29871,
29896,
1125,
29871,
29896,
29889,
29941,
29892,
313,
29906,
29892,
29871,
29946,
29892,
29871,
29896,
1125,
448,
29896,
29892,
313,
29941,
29892,
29871,
29906,
1125,
448,
29896,
29913,
13,
13,
4706,
289,
29939,
29885,
353,
1207,
29918,
3425,
29878,
2454,
29898,
29950,
7466,
29949,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29900,
29892,
3964,
397,
29889,
29933,
1177,
19926,
29897,
13,
13,
4706,
3651,
353,
731,
2141,
13094,
10456,
29950,
7466,
29949,
29897,
13,
4706,
3479,
29918,
20897,
353,
18761,
29898,
842,
29898,
29890,
29939,
29885,
29889,
10660,
29897,
448,
3651,
29897,
13,
4706,
3651,
353,
18761,
29898,
20897,
29897,
13,
4706,
1583,
29889,
9294,
5574,
29898,
2993,
29918,
20897,
29897,
13,
4706,
363,
2295,
297,
4256,
8504,
29889,
4704,
3552,
29900,
29892,
29871,
29896,
511,
12312,
29922,
2435,
29898,
20897,
22164,
13,
9651,
4559,
353,
9657,
29898,
7554,
29898,
20897,
29892,
2295,
876,
13,
13,
9651,
5864,
353,
15680,
29918,
27548,
29898,
11249,
29892,
379,
7466,
29949,
29897,
13,
13,
9651,
12212,
29918,
759,
29887,
583,
353,
5159,
13,
9651,
363,
3479,
29918,
2917,
297,
4256,
8504,
29889,
4704,
3552,
29900,
29892,
29871,
29896,
511,
13,
462,
462,
18884,
12312,
29922,
2435,
29898,
2993,
29918,
20897,
22164,
13,
18884,
3479,
29918,
11249,
353,
9657,
29898,
7554,
29898,
2993,
29918,
20897,
29892,
3479,
29918,
2917,
876,
13,
18884,
3479,
29918,
11249,
29889,
5504,
29898,
11249,
29897,
13,
18884,
12212,
29918,
759,
29887,
583,
29889,
4397,
29898,
29890,
29939,
29885,
29889,
27548,
29898,
2993,
29918,
11249,
876,
13,
13,
9651,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
27548,
29892,
1375,
29898,
9313,
1133,
29918,
759,
29887,
583,
876,
13,
13,
1678,
822,
1243,
29918,
22678,
29918,
759,
29887,
583,
29898,
1311,
1125,
13,
4706,
5608,
353,
426,
29900,
29901,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29901,
29871,
29896,
29889,
29900,
29913,
13,
4706,
432,
353,
426,
29898,
29900,
29892,
29871,
29896,
29892,
29871,
29906,
1125,
29871,
29900,
29889,
29945,
29913,
13,
4706,
15680,
353,
3964,
397,
29889,
25196,
7713,
9222,
29889,
3166,
29918,
29882,
5921,
29898,
10660,
29892,
432,
29897,
13,
4706,
11916,
353,
5519,
29896,
29892,
29871,
29896,
29892,
448,
29896,
1402,
518,
29896,
29892,
448,
29896,
29892,
29871,
29896,
1402,
518,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
1402,
21069,
29896,
29892,
29871,
29896,
29892,
448,
29896,
5262,
13,
13,
4706,
427,
353,
15680,
29918,
759,
29887,
583,
29898,
27736,
29892,
15680,
29897,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
1761,
29898,
264,
511,
518,
29896,
29889,
29945,
29892,
448,
29900,
29889,
29945,
29892,
29871,
29906,
29889,
29945,
29892,
29871,
29900,
29889,
29945,
2314,
13,
13,
4706,
427,
353,
15680,
29918,
27548,
29898,
27736,
29961,
29900,
1402,
15680,
29897,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
264,
29892,
29871,
29896,
29889,
29945,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
1125,
13,
9651,
15680,
29918,
27548,
29898,
27736,
29892,
15680,
29897,
13,
13,
4706,
15680,
353,
426,
877,
29874,
742,
1125,
29871,
29896,
29889,
29900,
29892,
6702,
29890,
742,
1125,
29871,
29896,
29889,
29900,
29892,
6702,
29874,
742,
525,
29890,
742,
525,
29883,
29374,
29871,
29900,
29889,
29945,
29913,
13,
4706,
11916,
353,
518,
10998,
29874,
2396,
29871,
29896,
29892,
525,
29890,
2396,
29871,
29896,
29892,
525,
29883,
2396,
448,
29896,
1118,
13,
462,
259,
11117,
29874,
2396,
29871,
29896,
29892,
525,
29890,
2396,
448,
29896,
29892,
525,
29883,
2396,
29871,
29896,
1118,
13,
462,
259,
11117,
29874,
2396,
29871,
29896,
29892,
525,
29890,
2396,
29871,
29896,
29892,
525,
29883,
2396,
29871,
29896,
1118,
13,
462,
259,
11117,
29874,
2396,
448,
29896,
29892,
525,
29890,
2396,
29871,
29896,
29892,
525,
29883,
2396,
448,
29896,
6525,
13,
4706,
427,
353,
15680,
29918,
759,
29887,
583,
29898,
27736,
29892,
15680,
29897,
13,
4706,
1583,
29889,
9294,
1293,
9843,
29898,
1761,
29898,
264,
511,
518,
29896,
29889,
29945,
29892,
448,
29900,
29889,
29945,
29892,
29871,
29906,
29889,
29945,
29892,
29871,
29900,
29889,
29945,
2314,
13,
13,
4706,
427,
353,
15680,
29918,
27548,
29898,
27736,
29961,
29900,
1402,
15680,
29897,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
264,
29892,
29871,
29896,
29889,
29945,
29897,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
1125,
13,
9651,
15680,
29918,
27548,
29898,
27736,
29892,
15680,
29897,
13,
2
] |
src/python-bakeoff/setup_shared.py | dhermes/de-casteljau-bakeoff | 0 | 111570 | # 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
#
# https://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.
# NOTE: This file is copied (rather than symlinked) since a symlink **outside**
# of the package tree won't get copied during a ``pip install``.
import os
import pathlib
import subprocess
import sys
import numpy as np
import setuptools
FORTRAN_LIBRARY_PREFIX = "libraries: ="
GFORTRAN_MISSING_LIBS = """\
``gfortran`` default library path not found via:
$ gfortran -print-search-dirs
{}"""
GFORTRAN_BAD_PATH = "``gfortran`` library path {} is not a directory."
def gfortran_search_path():
"""Get the library directory paths for ``gfortran``.
Looks for ``libraries: =`` in the output of ``gfortran -print-search-dirs``
and then parses the paths. If this fails for any reason, this method will
print an error and return ``library_dirs``.
Returns:
List[str]: The library directories for ``gfortran``.
"""
cmd = ("gfortran", "-print-search-dirs")
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return_code = process.wait()
# Bail out if the command failed.
if return_code != 0:
return []
cmd_output = process.stdout.read().decode("utf-8")
# Find single line starting with ``libraries: ``.
search_lines = cmd_output.strip().split("\n")
library_lines = [
line[len(FORTRAN_LIBRARY_PREFIX) :]
for line in search_lines
if line.startswith(FORTRAN_LIBRARY_PREFIX)
]
if len(library_lines) != 1:
msg = GFORTRAN_MISSING_LIBS.format(cmd_output)
print(msg, file=sys.stderr)
return []
# Go through each library in the ``libraries: = ...`` line.
library_line = library_lines[0]
accepted = set()
for part in library_line.split(os.pathsep):
full_path = os.path.abspath(part.strip())
if os.path.isdir(full_path):
accepted.add(full_path)
else:
# Ignore anything that isn't a directory.
msg = GFORTRAN_BAD_PATH.format(full_path)
print(msg, file=sys.stderr)
return sorted(accepted)
def get_extra_objects(here):
return (
os.path.join(here, "object_files", "types.o"),
os.path.join(here, "object_files", "forall_.o"),
os.path.join(here, "object_files", "do_.o"),
os.path.join(here, "object_files", "spread_.o"),
os.path.join(here, "object_files", "serial_.o"),
os.path.join(here, "object_files", "vs_algorithm.o"),
)
def extension_modules(here, name):
extra_objects = get_extra_objects(here)
missing = [path for path in extra_objects if not os.path.isfile(path)]
if missing:
parts = ["Missing object file(s):"]
parts.extend(f"- {path}" for path in missing)
parts.extend(
[
"",
f"here: {here}",
f"__file__: {__file__}",
"",
"files in `here`:",
]
)
files_here = pathlib.Path(here).glob("*")
parts.extend(f"- {path}" for path in files_here)
msg = "\n".join(parts)
raise RuntimeError(msg)
extension = setuptools.Extension(
f"{name}._binary",
[os.path.join(name, "_binary.c")],
extra_objects=extra_objects,
include_dirs=[np.get_include()],
libraries=["gfortran"],
library_dirs=gfortran_search_path(),
)
return [extension]
def do_setup(here, name):
ext_modules = extension_modules(here, name)
setuptools.setup(
name=name,
packages=[name],
install_requires=["numpy"],
ext_modules=ext_modules,
)
| [
1,
396,
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,
2045,
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,
6058,
29923,
29901,
910,
934,
338,
13746,
313,
29878,
1624,
1135,
9878,
828,
682,
287,
29897,
1951,
263,
9878,
828,
682,
3579,
449,
2975,
1068,
13,
29937,
539,
310,
278,
3577,
5447,
2113,
29915,
29873,
679,
13746,
2645,
263,
4954,
13096,
2601,
29952,
1412,
13,
13,
5215,
2897,
13,
5215,
2224,
1982,
13,
5215,
1014,
5014,
13,
5215,
10876,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
731,
21245,
8789,
13,
13,
13,
22051,
26813,
29918,
5265,
15176,
19926,
29918,
15094,
25634,
353,
376,
492,
8464,
29901,
29465,
13,
29954,
22051,
26813,
29918,
10403,
1799,
4214,
29918,
5265,
9851,
353,
9995,
29905,
13,
16159,
29887,
3921,
661,
16159,
2322,
3489,
2224,
451,
1476,
3025,
29901,
13,
13,
29938,
330,
3921,
661,
448,
2158,
29899,
4478,
29899,
3972,
29879,
13,
29912,
5038,
15945,
13,
29954,
22051,
26813,
29918,
29933,
3035,
29918,
10145,
353,
376,
16159,
29887,
3921,
661,
16159,
3489,
2224,
6571,
338,
451,
263,
3884,
1213,
13,
13,
13,
1753,
330,
3921,
661,
29918,
4478,
29918,
2084,
7295,
13,
1678,
9995,
2577,
278,
3489,
3884,
10898,
363,
4954,
29887,
3921,
661,
29952,
1412,
13,
13,
1678,
19887,
363,
4954,
492,
8464,
29901,
353,
16159,
297,
278,
1962,
310,
4954,
29887,
3921,
661,
448,
2158,
29899,
4478,
29899,
3972,
29879,
16159,
13,
1678,
322,
769,
610,
29879,
267,
278,
10898,
29889,
960,
445,
8465,
363,
738,
2769,
29892,
445,
1158,
674,
13,
1678,
1596,
385,
1059,
322,
736,
4954,
5258,
29918,
3972,
29879,
29952,
1412,
13,
13,
1678,
16969,
29901,
13,
4706,
2391,
29961,
710,
5387,
450,
3489,
17525,
363,
4954,
29887,
3921,
661,
29952,
1412,
13,
1678,
9995,
13,
1678,
9920,
353,
4852,
29887,
3921,
661,
613,
11663,
2158,
29899,
4478,
29899,
3972,
29879,
1159,
13,
1678,
1889,
353,
1014,
5014,
29889,
29925,
3150,
29898,
9006,
29892,
27591,
29922,
1491,
5014,
29889,
2227,
4162,
29897,
13,
1678,
736,
29918,
401,
353,
1889,
29889,
10685,
580,
13,
1678,
396,
350,
737,
714,
565,
278,
1899,
5229,
29889,
13,
1678,
565,
736,
29918,
401,
2804,
29871,
29900,
29901,
13,
4706,
736,
5159,
13,
13,
1678,
9920,
29918,
4905,
353,
1889,
29889,
25393,
29889,
949,
2141,
13808,
703,
9420,
29899,
29947,
1159,
13,
1678,
396,
10987,
2323,
1196,
6257,
411,
4954,
492,
8464,
29901,
421,
1412,
13,
1678,
2740,
29918,
9012,
353,
9920,
29918,
4905,
29889,
17010,
2141,
5451,
14182,
29876,
1159,
13,
1678,
3489,
29918,
9012,
353,
518,
13,
4706,
1196,
29961,
2435,
29898,
22051,
26813,
29918,
5265,
15176,
19926,
29918,
15094,
25634,
29897,
584,
29962,
13,
4706,
363,
1196,
297,
2740,
29918,
9012,
13,
4706,
565,
1196,
29889,
27382,
2541,
29898,
22051,
26813,
29918,
5265,
15176,
19926,
29918,
15094,
25634,
29897,
13,
1678,
4514,
13,
1678,
565,
7431,
29898,
5258,
29918,
9012,
29897,
2804,
29871,
29896,
29901,
13,
4706,
10191,
353,
402,
22051,
26813,
29918,
10403,
1799,
4214,
29918,
5265,
9851,
29889,
4830,
29898,
9006,
29918,
4905,
29897,
13,
4706,
1596,
29898,
7645,
29892,
934,
29922,
9675,
29889,
303,
20405,
29897,
13,
4706,
736,
5159,
13,
13,
1678,
396,
2921,
1549,
1269,
3489,
297,
278,
4954,
492,
8464,
29901,
353,
2023,
16159,
1196,
29889,
13,
1678,
3489,
29918,
1220,
353,
3489,
29918,
9012,
29961,
29900,
29962,
13,
1678,
9259,
353,
731,
580,
13,
1678,
363,
760,
297,
3489,
29918,
1220,
29889,
5451,
29898,
359,
29889,
2084,
19570,
1125,
13,
4706,
2989,
29918,
2084,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
1595,
29889,
17010,
3101,
13,
4706,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
8159,
29918,
2084,
1125,
13,
9651,
9259,
29889,
1202,
29898,
8159,
29918,
2084,
29897,
13,
4706,
1683,
29901,
13,
9651,
396,
18076,
487,
3099,
393,
3508,
29915,
29873,
263,
3884,
29889,
13,
9651,
10191,
353,
402,
22051,
26813,
29918,
29933,
3035,
29918,
10145,
29889,
4830,
29898,
8159,
29918,
2084,
29897,
13,
9651,
1596,
29898,
7645,
29892,
934,
29922,
9675,
29889,
303,
20405,
29897,
13,
13,
1678,
736,
12705,
29898,
16044,
287,
29897,
13,
13,
13,
1753,
679,
29918,
17833,
29918,
12650,
29898,
4150,
1125,
13,
1678,
736,
313,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
4150,
29892,
376,
3318,
29918,
5325,
613,
376,
8768,
29889,
29877,
4968,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
4150,
29892,
376,
3318,
29918,
5325,
613,
376,
10956,
5396,
29877,
4968,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
4150,
29892,
376,
3318,
29918,
5325,
613,
376,
1867,
5396,
29877,
4968,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
4150,
29892,
376,
3318,
29918,
5325,
613,
376,
1028,
949,
5396,
29877,
4968,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
4150,
29892,
376,
3318,
29918,
5325,
613,
376,
15550,
5396,
29877,
4968,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
4150,
29892,
376,
3318,
29918,
5325,
613,
376,
4270,
29918,
20567,
29889,
29877,
4968,
13,
1678,
1723,
13,
13,
13,
1753,
6081,
29918,
7576,
29898,
4150,
29892,
1024,
1125,
13,
1678,
4805,
29918,
12650,
353,
679,
29918,
17833,
29918,
12650,
29898,
4150,
29897,
13,
1678,
4567,
353,
518,
2084,
363,
2224,
297,
4805,
29918,
12650,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
2084,
4638,
13,
1678,
565,
4567,
29901,
13,
4706,
5633,
353,
6796,
18552,
292,
1203,
934,
29898,
29879,
1125,
3108,
13,
4706,
5633,
29889,
21843,
29898,
29888,
29908,
29899,
426,
2084,
5038,
363,
2224,
297,
4567,
29897,
13,
4706,
5633,
29889,
21843,
29898,
13,
9651,
518,
13,
18884,
12633,
13,
18884,
285,
29908,
4150,
29901,
426,
4150,
17671,
13,
18884,
285,
29908,
1649,
1445,
1649,
29901,
426,
1649,
1445,
1649,
17671,
13,
18884,
12633,
13,
18884,
376,
5325,
297,
421,
4150,
6998,
613,
13,
9651,
4514,
13,
4706,
1723,
13,
4706,
2066,
29918,
4150,
353,
2224,
1982,
29889,
2605,
29898,
4150,
467,
23705,
703,
29930,
1159,
13,
4706,
5633,
29889,
21843,
29898,
29888,
29908,
29899,
426,
2084,
5038,
363,
2224,
297,
2066,
29918,
4150,
29897,
13,
13,
4706,
10191,
353,
6634,
29876,
1642,
7122,
29898,
20895,
29897,
13,
4706,
12020,
24875,
2392,
29898,
7645,
29897,
13,
13,
1678,
6081,
353,
731,
21245,
8789,
29889,
17657,
29898,
13,
4706,
285,
29908,
29912,
978,
1836,
29918,
19541,
613,
13,
4706,
518,
359,
29889,
2084,
29889,
7122,
29898,
978,
29892,
11119,
19541,
29889,
29883,
1159,
1402,
13,
4706,
4805,
29918,
12650,
29922,
17833,
29918,
12650,
29892,
13,
4706,
3160,
29918,
3972,
29879,
11759,
9302,
29889,
657,
29918,
2856,
580,
1402,
13,
4706,
9562,
29922,
3366,
29887,
3921,
661,
12436,
13,
4706,
3489,
29918,
3972,
29879,
29922,
29887,
3921,
661,
29918,
4478,
29918,
2084,
3285,
13,
1678,
1723,
13,
1678,
736,
518,
17588,
29962,
13,
13,
13,
1753,
437,
29918,
14669,
29898,
4150,
29892,
1024,
1125,
13,
1678,
1294,
29918,
7576,
353,
6081,
29918,
7576,
29898,
4150,
29892,
1024,
29897,
13,
1678,
731,
21245,
8789,
29889,
14669,
29898,
13,
4706,
1024,
29922,
978,
29892,
13,
4706,
9741,
11759,
978,
1402,
13,
4706,
2601,
29918,
276,
339,
2658,
29922,
3366,
23749,
12436,
13,
4706,
1294,
29918,
7576,
29922,
1062,
29918,
7576,
29892,
13,
1678,
1723,
13,
2
] |
conftest.py | BodenmillerGroup/readimc | 0 | 152409 | <filename>conftest.py
import pytest
import requests
import shutil
from pathlib import Path
from typing import Generator
from readimc import MCDFile, TXTFile
_imc_test_data_asset_url = (
"https://github.com/BodenmillerGroup/TestData"
"/releases/download/v1.0.7/210308_ImcTestData_raw.tar.gz"
)
_imc_test_data_raw_dir = "datasets/210308_ImcTestData/raw"
_imc_test_data_mcd_file = "20210305_NE_mockData1/20210305_NE_mockData1.mcd"
_imc_test_data_txt_file = (
"20210305_NE_mockData1/20210305_NE_mockData1_ROI_001_1.txt"
)
def _download_and_extract_asset(tmp_dir_path: Path, asset_url: str):
asset_file_path = tmp_dir_path / "asset.tar.gz"
response = requests.get(asset_url, stream=True)
if response.status_code == 200:
with asset_file_path.open(mode="wb") as f:
f.write(response.raw.read())
shutil.unpack_archive(asset_file_path, tmp_dir_path)
@pytest.fixture(scope="session")
def imc_test_data_raw_path(tmp_path_factory) -> Generator[Path, None, None]:
tmp_dir_path = tmp_path_factory.mktemp("raw")
_download_and_extract_asset(tmp_dir_path, _imc_test_data_asset_url)
yield tmp_dir_path / Path(_imc_test_data_raw_dir)
shutil.rmtree(tmp_dir_path)
@pytest.fixture
def imc_test_data_mcd_file(
imc_test_data_raw_path: Path,
) -> Generator[MCDFile, None, None]:
path = imc_test_data_raw_path / Path(_imc_test_data_mcd_file)
with MCDFile(path) as f:
yield f
@pytest.fixture
def imc_test_data_txt_file(
imc_test_data_raw_path: Path,
) -> Generator[TXTFile, None, None]:
path = imc_test_data_raw_path / Path(_imc_test_data_txt_file)
with TXTFile(path) as f:
yield f
| [
1,
529,
9507,
29958,
535,
615,
342,
29889,
2272,
13,
5215,
11451,
1688,
13,
5215,
7274,
13,
5215,
528,
4422,
13,
13,
3166,
2224,
1982,
1053,
10802,
13,
3166,
19229,
1053,
3251,
1061,
13,
13,
3166,
1303,
326,
29883,
1053,
341,
6530,
2283,
29892,
323,
12188,
2283,
13,
13,
13,
29918,
326,
29883,
29918,
1688,
29918,
1272,
29918,
24129,
29918,
2271,
353,
313,
13,
1678,
376,
991,
597,
3292,
29889,
510,
29914,
29933,
13183,
29885,
5495,
4782,
29914,
3057,
1469,
29908,
13,
1678,
5591,
276,
17836,
29914,
10382,
29914,
29894,
29896,
29889,
29900,
29889,
29955,
29914,
29906,
29896,
29900,
29941,
29900,
29947,
29918,
1888,
29883,
3057,
1469,
29918,
1610,
29889,
12637,
29889,
18828,
29908,
13,
29897,
13,
29918,
326,
29883,
29918,
1688,
29918,
1272,
29918,
1610,
29918,
3972,
353,
376,
14538,
1691,
29914,
29906,
29896,
29900,
29941,
29900,
29947,
29918,
1888,
29883,
3057,
1469,
29914,
1610,
29908,
13,
29918,
326,
29883,
29918,
1688,
29918,
1272,
29918,
29885,
2252,
29918,
1445,
353,
376,
29906,
29900,
29906,
29896,
29900,
29941,
29900,
29945,
29918,
8186,
29918,
17640,
1469,
29896,
29914,
29906,
29900,
29906,
29896,
29900,
29941,
29900,
29945,
29918,
8186,
29918,
17640,
1469,
29896,
29889,
29885,
2252,
29908,
13,
29918,
326,
29883,
29918,
1688,
29918,
1272,
29918,
3945,
29918,
1445,
353,
313,
13,
1678,
376,
29906,
29900,
29906,
29896,
29900,
29941,
29900,
29945,
29918,
8186,
29918,
17640,
1469,
29896,
29914,
29906,
29900,
29906,
29896,
29900,
29941,
29900,
29945,
29918,
8186,
29918,
17640,
1469,
29896,
29918,
1672,
29902,
29918,
29900,
29900,
29896,
29918,
29896,
29889,
3945,
29908,
13,
29897,
13,
13,
13,
1753,
903,
10382,
29918,
392,
29918,
21111,
29918,
24129,
29898,
7050,
29918,
3972,
29918,
2084,
29901,
10802,
29892,
24342,
29918,
2271,
29901,
851,
1125,
13,
1678,
24342,
29918,
1445,
29918,
2084,
353,
13128,
29918,
3972,
29918,
2084,
847,
376,
24129,
29889,
12637,
29889,
18828,
29908,
13,
1678,
2933,
353,
7274,
29889,
657,
29898,
24129,
29918,
2271,
29892,
4840,
29922,
5574,
29897,
13,
1678,
565,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
29901,
13,
4706,
411,
24342,
29918,
1445,
29918,
2084,
29889,
3150,
29898,
8513,
543,
29893,
29890,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
29898,
5327,
29889,
1610,
29889,
949,
3101,
13,
1678,
528,
4422,
29889,
348,
4058,
29918,
10867,
29898,
24129,
29918,
1445,
29918,
2084,
29892,
13128,
29918,
3972,
29918,
2084,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
29898,
6078,
543,
7924,
1159,
13,
1753,
527,
29883,
29918,
1688,
29918,
1272,
29918,
1610,
29918,
2084,
29898,
7050,
29918,
2084,
29918,
14399,
29897,
1599,
3251,
1061,
29961,
2605,
29892,
6213,
29892,
6213,
5387,
13,
1678,
13128,
29918,
3972,
29918,
2084,
353,
13128,
29918,
2084,
29918,
14399,
29889,
29885,
1193,
3451,
703,
1610,
1159,
13,
1678,
903,
10382,
29918,
392,
29918,
21111,
29918,
24129,
29898,
7050,
29918,
3972,
29918,
2084,
29892,
903,
326,
29883,
29918,
1688,
29918,
1272,
29918,
24129,
29918,
2271,
29897,
13,
1678,
7709,
13128,
29918,
3972,
29918,
2084,
847,
10802,
7373,
326,
29883,
29918,
1688,
29918,
1272,
29918,
1610,
29918,
3972,
29897,
13,
1678,
528,
4422,
29889,
1758,
8336,
29898,
7050,
29918,
3972,
29918,
2084,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
13,
1753,
527,
29883,
29918,
1688,
29918,
1272,
29918,
29885,
2252,
29918,
1445,
29898,
13,
1678,
527,
29883,
29918,
1688,
29918,
1272,
29918,
1610,
29918,
2084,
29901,
10802,
29892,
13,
29897,
1599,
3251,
1061,
29961,
29924,
6530,
2283,
29892,
6213,
29892,
6213,
5387,
13,
1678,
2224,
353,
527,
29883,
29918,
1688,
29918,
1272,
29918,
1610,
29918,
2084,
847,
10802,
7373,
326,
29883,
29918,
1688,
29918,
1272,
29918,
29885,
2252,
29918,
1445,
29897,
13,
1678,
411,
341,
6530,
2283,
29898,
2084,
29897,
408,
285,
29901,
13,
4706,
7709,
285,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
13,
1753,
527,
29883,
29918,
1688,
29918,
1272,
29918,
3945,
29918,
1445,
29898,
13,
1678,
527,
29883,
29918,
1688,
29918,
1272,
29918,
1610,
29918,
2084,
29901,
10802,
29892,
13,
29897,
1599,
3251,
1061,
29961,
29911,
12188,
2283,
29892,
6213,
29892,
6213,
5387,
13,
1678,
2224,
353,
527,
29883,
29918,
1688,
29918,
1272,
29918,
1610,
29918,
2084,
847,
10802,
7373,
326,
29883,
29918,
1688,
29918,
1272,
29918,
3945,
29918,
1445,
29897,
13,
1678,
411,
323,
12188,
2283,
29898,
2084,
29897,
408,
285,
29901,
13,
4706,
7709,
285,
13,
2
] |
Dynamic Programming/32_chef_monocarp.py | Szymon-Budziak/ASD_exercises_solutions | 7 | 139903 | <gh_stars>1-10
# <NAME> has just put n dishes into an oven. He knows that the i-th dish has its optimal
# cooking time equal to ti minutes. At any positive integer minute T Monocarp can put no more than
# one dish out of the oven. If the i-th dish is put out at some minute T, then its unpleasant value
# is |T − t[i]| — the absolute difference between T and t[i]. Once the dish is out of the oven, it
# can't go back in. Monocarp should put all the dishes out of the oven. What is the minimum total
# unpleasant value Monocarp can obtain?
from math import inf
def chef_monocarp(n, T):
T.sort()
DP = [[inf] * (2 * n + 1) for _ in range(n + 1)]
for i in range(2 * n + 1):
DP[0][i] = 0
for i in range(1, n + 1):
for j in range(1, 2 * n + 1):
DP[i][j] = min(DP[i][j - 1], DP[i - 1][j - 1] + abs(T[i - 1] - j))
return DP[-1][-1]
n = 12
T = [4, 11, 12, 4, 10, 12, 9, 3, 4, 11, 10, 10]
print(chef_monocarp(n, T))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
529,
5813,
29958,
756,
925,
1925,
302,
270,
17006,
964,
385,
288,
854,
29889,
940,
9906,
393,
278,
474,
29899,
386,
270,
728,
756,
967,
14413,
13,
29937,
7984,
292,
931,
5186,
304,
19538,
6233,
29889,
2180,
738,
6374,
6043,
11015,
323,
2598,
542,
6834,
508,
1925,
694,
901,
1135,
13,
29937,
697,
270,
728,
714,
310,
278,
288,
854,
29889,
960,
278,
474,
29899,
386,
270,
728,
338,
1925,
714,
472,
777,
11015,
323,
29892,
769,
967,
443,
552,
13186,
995,
13,
29937,
338,
891,
29911,
13935,
260,
29961,
29875,
29962,
29989,
813,
278,
8380,
4328,
1546,
323,
322,
260,
29961,
29875,
1822,
9038,
278,
270,
728,
338,
714,
310,
278,
288,
854,
29892,
372,
13,
29937,
508,
29915,
29873,
748,
1250,
297,
29889,
2598,
542,
6834,
881,
1925,
599,
278,
270,
17006,
714,
310,
278,
288,
854,
29889,
1724,
338,
278,
9212,
3001,
13,
29937,
443,
552,
13186,
995,
2598,
542,
6834,
508,
4017,
29973,
13,
3166,
5844,
1053,
3041,
13,
13,
13,
1753,
14547,
29918,
3712,
542,
6834,
29898,
29876,
29892,
323,
1125,
13,
1678,
323,
29889,
6605,
580,
13,
1678,
360,
29925,
353,
5519,
7192,
29962,
334,
313,
29906,
334,
302,
718,
29871,
29896,
29897,
363,
903,
297,
3464,
29898,
29876,
718,
29871,
29896,
4638,
13,
1678,
363,
474,
297,
3464,
29898,
29906,
334,
302,
718,
29871,
29896,
1125,
13,
4706,
360,
29925,
29961,
29900,
3816,
29875,
29962,
353,
29871,
29900,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
302,
718,
29871,
29896,
1125,
13,
4706,
363,
432,
297,
3464,
29898,
29896,
29892,
29871,
29906,
334,
302,
718,
29871,
29896,
1125,
13,
9651,
360,
29925,
29961,
29875,
3816,
29926,
29962,
353,
1375,
29898,
11191,
29961,
29875,
3816,
29926,
448,
29871,
29896,
1402,
360,
29925,
29961,
29875,
448,
29871,
29896,
3816,
29926,
448,
29871,
29896,
29962,
718,
6425,
29898,
29911,
29961,
29875,
448,
29871,
29896,
29962,
448,
432,
876,
13,
1678,
736,
360,
29925,
14352,
29896,
3816,
29899,
29896,
29962,
13,
13,
13,
29876,
353,
29871,
29896,
29906,
13,
29911,
353,
518,
29946,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29946,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29906,
29892,
29871,
29929,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29900,
29962,
13,
2158,
29898,
1173,
29888,
29918,
3712,
542,
6834,
29898,
29876,
29892,
323,
876,
13,
2
] |
gallery/mode/photo_manager.py | bob-chen/gallery | 0 | 49667 | <filename>gallery/mode/photo_manager.py
# -*- coding: utf-8 -*-
'''
Created on Mar 19, 2015
@author: Bob.Chen
'''
import sys
import urllib2
import time
from PIL import Image
from constant import PHOTO_DATA_ROOT
from common import Logger, RandomID, getPhotoUrl, getPhotoPath
from error_api import Err
from gallery.models import Photo
from StringIO import StringIO
class PhotoManager(object):
@staticmethod
def addPhoto(content, title = "", comment = "", isUrl=False):
Logger.LogParameters(funcname = sys._getframe().f_code.co_name, func_vars = vars(), module = "PhotoManager")
try:
imageName = RandomID.gen()
if not isUrl:
fileObj = StringIO(content.read())
else:
#url = "http://www.didao8.com:8080/static/44/thumb/nvLcHMu1JS3mepZPkQBqriG4ANthz2s5.jpg"
fileObj = StringIO(urllib2.urlopen(content).read())
img = Image.open(fileObj)
width, height = img.size
fileName = "%s%s%s" % (imageName, ".", img.format)
filePath = (PHOTO_DATA_ROOT + "%s") % fileName
img.save(filePath)
photo = Photo(title=title, comment=comment, datetime = time.time(),
imageName=fileName, width = width, height = height)
photo.save()
return Err.genOK(photo.id)
except Exception, ex:
print ex
Logger.SaveLogDebug(ex, level=Logger.LEVEL_ERROR, module = "PhotoManager")
return Err.genErr(Err.ERR_ADD_PHOTO_FAIL)
@staticmethod
def getPhotos(page=1, prePage=5):
Logger.LogParameters(funcname = sys._getframe().f_code.co_name, func_vars = vars(), module = "PhotoManager")
try:
photos = []
intPage = int(page)
intPrePage = int(prePage)
photoItems = Photo.objects.all()[(intPage-1)*intPrePage:intPage*intPrePage]
attrList = ["id", "title", "comment", "datetime", "width", "height", "imageName"]
for item in photoItems:
photo = {key:getattr(item, key) for key in attrList}
photo["imageUrl"] = getPhotoUrl(item.imageName)
photos.append(photo)
return Err.genOK(photos)
except Exception, ex:
print ex
Logger.SaveLogDebug(ex, level=Logger.LEVEL_ERROR, module = "PhotoManager")
return Err.genErr(Err.ERR_GET_PHOTO_LIST_FAIL)
@staticmethod
def getPhoto(imageName, pointX=0, pointY=0, needWidth=0):
'''
Return a StringIO obj, use StringIO.getvalue() to get the content
'''
Logger.LogParameters(funcname = sys._getframe().f_code.co_name, func_vars = vars(), module = "PhotoManager")
try:
imagePath = getPhotoPath(imageName)
needWidth, pointX, pointY = int(needWidth), int(pointX), int(pointY)
im = Image.open(imagePath)
width, height = im.size
imgFormat = im.format
scale = float(height)/width
box = (0, 0, width, height)
if needWidth > 0 and pointX < width and pointY < height:
if needWidth + pointX > width:
needWidth = width - pointX
needHeight = needWidth * scale
if needHeight + pointY > height:
needHeight = height - pointY
needWidth = needHeight / scale
if needHeight < 1:
needHeight = 1
if needWidth < 1:
needWidth = 1
print needHeight, needWidth
#print needWidth, needHeight, scale
box = (pointX, pointY, int(pointX + needWidth), int(pointY + needHeight))
region = im.crop(box)
container = StringIO()
region.save(container, imgFormat)
return Err.genOK([container, imgFormat])
except Exception, ex:
print ex
Logger.SaveLogDebug(ex, level=Logger.LEVEL_ERROR, module = "PhotoManager")
return Err.genErr(Err.ERR_GET_PHOTO_DATA_FAIL)
| [
1,
529,
9507,
29958,
29887,
23365,
29914,
8513,
29914,
21596,
29918,
12847,
29889,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
12008,
13,
20399,
373,
1085,
29871,
29896,
29929,
29892,
29871,
29906,
29900,
29896,
29945,
13,
13,
29992,
8921,
29901,
7991,
29889,
1451,
264,
13,
12008,
13,
5215,
10876,
13,
5215,
3142,
1982,
29906,
13,
5215,
931,
13,
3166,
349,
6227,
1053,
7084,
13,
3166,
4868,
1053,
349,
29950,
2891,
29949,
29918,
14573,
29918,
21289,
13,
3166,
3619,
1053,
28468,
29892,
16968,
1367,
29892,
679,
25971,
5983,
29892,
679,
25971,
2605,
13,
3166,
1059,
29918,
2754,
1053,
25361,
13,
3166,
23363,
29889,
9794,
1053,
1963,
3747,
13,
3166,
1714,
5971,
1053,
1714,
5971,
13,
13,
13,
1990,
1963,
3747,
3260,
29898,
3318,
1125,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
788,
25971,
29898,
3051,
29892,
3611,
353,
12633,
3440,
353,
12633,
338,
5983,
29922,
8824,
1125,
13,
4706,
28468,
29889,
3403,
11507,
29898,
9891,
978,
353,
10876,
3032,
657,
2557,
2141,
29888,
29918,
401,
29889,
1111,
29918,
978,
29892,
3653,
29918,
16908,
353,
24987,
3285,
3883,
353,
376,
25971,
3260,
1159,
13,
4706,
1018,
29901,
13,
9651,
1967,
1170,
353,
16968,
1367,
29889,
1885,
580,
13,
632,
13,
9651,
565,
451,
338,
5983,
29901,
13,
18884,
934,
9930,
353,
1714,
5971,
29898,
3051,
29889,
949,
3101,
13,
9651,
1683,
29901,
13,
18884,
396,
2271,
353,
376,
1124,
597,
1636,
29889,
29881,
1458,
29877,
29947,
29889,
510,
29901,
29947,
29900,
29947,
29900,
29914,
7959,
29914,
29946,
29946,
29914,
386,
3774,
29914,
29876,
29894,
29931,
29883,
29950,
29924,
29884,
29896,
8700,
29941,
1004,
29886,
29999,
29925,
29895,
29984,
29933,
29939,
374,
29954,
29946,
2190,
386,
29920,
29906,
29879,
29945,
29889,
6173,
29908,
13,
18884,
934,
9930,
353,
1714,
5971,
29898,
2271,
1982,
29906,
29889,
332,
417,
2238,
29898,
3051,
467,
949,
3101,
13,
462,
13,
9651,
10153,
353,
7084,
29889,
3150,
29898,
1445,
9930,
29897,
13,
9651,
2920,
29892,
3171,
353,
10153,
29889,
2311,
13,
9651,
29729,
353,
11860,
29879,
29995,
29879,
29995,
29879,
29908,
1273,
313,
3027,
1170,
29892,
11393,
613,
10153,
29889,
4830,
29897,
13,
9651,
934,
2605,
353,
313,
19689,
2891,
29949,
29918,
14573,
29918,
21289,
718,
11860,
29879,
1159,
1273,
29729,
13,
9651,
10153,
29889,
7620,
29898,
1445,
2605,
29897,
13,
632,
13,
9651,
15373,
353,
1963,
3747,
29898,
3257,
29922,
3257,
29892,
3440,
29922,
9342,
29892,
12865,
353,
931,
29889,
2230,
3285,
13,
462,
3986,
1967,
1170,
29922,
28926,
29892,
2920,
353,
2920,
29892,
3171,
353,
3171,
29897,
13,
9651,
15373,
29889,
7620,
580,
13,
632,
13,
9651,
736,
25361,
29889,
1885,
8949,
29898,
21596,
29889,
333,
29897,
13,
4706,
5174,
8960,
29892,
429,
29901,
13,
9651,
1596,
429,
13,
9651,
28468,
29889,
11371,
3403,
11862,
29898,
735,
29892,
3233,
29922,
16363,
29889,
1307,
29963,
6670,
29918,
11432,
29892,
3883,
353,
376,
25971,
3260,
1159,
13,
9651,
736,
25361,
29889,
1885,
19212,
29898,
19212,
29889,
21662,
29918,
17744,
29918,
19689,
2891,
29949,
29918,
4519,
6227,
29897,
13,
632,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
4819,
15788,
29898,
3488,
29922,
29896,
29892,
758,
5074,
29922,
29945,
1125,
13,
4706,
28468,
29889,
3403,
11507,
29898,
9891,
978,
353,
10876,
3032,
657,
2557,
2141,
29888,
29918,
401,
29889,
1111,
29918,
978,
29892,
3653,
29918,
16908,
353,
24987,
3285,
3883,
353,
376,
25971,
3260,
1159,
13,
4706,
1018,
29901,
13,
9651,
20612,
353,
5159,
13,
9651,
938,
5074,
353,
938,
29898,
3488,
29897,
13,
9651,
938,
6572,
5074,
353,
938,
29898,
1457,
5074,
29897,
13,
632,
13,
9651,
15373,
6913,
353,
1963,
3747,
29889,
12650,
29889,
497,
580,
15625,
524,
5074,
29899,
29896,
11877,
524,
6572,
5074,
29901,
524,
5074,
29930,
524,
6572,
5074,
29962,
13,
632,
13,
9651,
12421,
1293,
353,
6796,
333,
613,
376,
3257,
613,
376,
9342,
613,
376,
12673,
613,
376,
2103,
613,
376,
3545,
613,
376,
3027,
1170,
3108,
13,
9651,
363,
2944,
297,
15373,
6913,
29901,
13,
18884,
15373,
353,
426,
1989,
29901,
657,
5552,
29898,
667,
29892,
1820,
29897,
363,
1820,
297,
12421,
1293,
29913,
13,
18884,
15373,
3366,
3027,
5983,
3108,
353,
679,
25971,
5983,
29898,
667,
29889,
3027,
1170,
29897,
13,
18884,
20612,
29889,
4397,
29898,
21596,
29897,
13,
462,
13,
9651,
736,
25361,
29889,
1885,
8949,
29898,
561,
15788,
29897,
13,
4706,
5174,
8960,
29892,
429,
29901,
13,
9651,
1596,
429,
13,
9651,
28468,
29889,
11371,
3403,
11862,
29898,
735,
29892,
3233,
29922,
16363,
29889,
1307,
29963,
6670,
29918,
11432,
29892,
3883,
353,
376,
25971,
3260,
1159,
13,
9651,
736,
25361,
29889,
1885,
19212,
29898,
19212,
29889,
21662,
29918,
7194,
29918,
19689,
2891,
29949,
29918,
24360,
29918,
4519,
6227,
29897,
13,
13,
308,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
679,
25971,
29898,
3027,
1170,
29892,
1298,
29990,
29922,
29900,
29892,
1298,
29979,
29922,
29900,
29892,
817,
6110,
29922,
29900,
1125,
13,
4706,
14550,
13,
4706,
7106,
263,
1714,
5971,
5446,
29892,
671,
1714,
5971,
29889,
657,
1767,
580,
304,
679,
278,
2793,
13,
4706,
14550,
13,
4706,
28468,
29889,
3403,
11507,
29898,
9891,
978,
353,
10876,
3032,
657,
2557,
2141,
29888,
29918,
401,
29889,
1111,
29918,
978,
29892,
3653,
29918,
16908,
353,
24987,
3285,
3883,
353,
376,
25971,
3260,
1159,
13,
4706,
1018,
29901,
13,
9651,
1967,
2605,
353,
679,
25971,
2605,
29898,
3027,
1170,
29897,
13,
9651,
817,
6110,
29892,
1298,
29990,
29892,
1298,
29979,
353,
938,
29898,
26180,
6110,
511,
938,
29898,
3149,
29990,
511,
938,
29898,
3149,
29979,
29897,
13,
632,
13,
9651,
527,
353,
7084,
29889,
3150,
29898,
3027,
2605,
29897,
13,
9651,
2920,
29892,
3171,
353,
527,
29889,
2311,
13,
9651,
10153,
5809,
353,
527,
29889,
4830,
13,
9651,
6287,
353,
5785,
29898,
3545,
6802,
2103,
13,
9651,
3800,
353,
313,
29900,
29892,
29871,
29900,
29892,
2920,
29892,
3171,
29897,
13,
632,
13,
9651,
565,
817,
6110,
1405,
29871,
29900,
322,
1298,
29990,
529,
2920,
322,
1298,
29979,
529,
3171,
29901,
13,
18884,
565,
817,
6110,
718,
1298,
29990,
1405,
2920,
29901,
13,
462,
1678,
817,
6110,
353,
2920,
448,
1298,
29990,
13,
18884,
817,
7011,
353,
817,
6110,
334,
6287,
13,
18884,
565,
817,
7011,
718,
1298,
29979,
1405,
3171,
29901,
13,
462,
1678,
817,
7011,
353,
3171,
448,
1298,
29979,
13,
462,
1678,
817,
6110,
353,
817,
7011,
847,
6287,
13,
308,
13,
18884,
565,
817,
7011,
529,
29871,
29896,
29901,
13,
462,
1678,
817,
7011,
353,
29871,
29896,
13,
18884,
565,
817,
6110,
529,
29871,
29896,
29901,
13,
462,
1678,
817,
6110,
353,
29871,
29896,
13,
18884,
1596,
817,
7011,
29892,
817,
6110,
268,
13,
18884,
396,
2158,
817,
6110,
29892,
817,
7011,
29892,
6287,
13,
18884,
3800,
353,
313,
3149,
29990,
29892,
1298,
29979,
29892,
938,
29898,
3149,
29990,
718,
817,
6110,
511,
938,
29898,
3149,
29979,
718,
817,
7011,
876,
13,
632,
13,
9651,
5120,
353,
527,
29889,
29883,
1336,
29898,
1884,
29897,
13,
9651,
5639,
353,
1714,
5971,
580,
13,
9651,
5120,
29889,
7620,
29898,
7611,
29892,
10153,
5809,
29897,
13,
632,
13,
9651,
736,
25361,
29889,
1885,
8949,
4197,
7611,
29892,
10153,
5809,
2314,
13,
4706,
5174,
8960,
29892,
429,
29901,
13,
9651,
1596,
429,
13,
9651,
28468,
29889,
11371,
3403,
11862,
29898,
735,
29892,
3233,
29922,
16363,
29889,
1307,
29963,
6670,
29918,
11432,
29892,
3883,
353,
376,
25971,
3260,
1159,
13,
9651,
736,
25361,
29889,
1885,
19212,
29898,
19212,
29889,
21662,
29918,
7194,
29918,
19689,
2891,
29949,
29918,
14573,
29918,
4519,
6227,
29897,
13,
308,
13,
632,
13,
632,
13,
632,
13,
308,
13,
308,
13,
308,
13,
308,
13,
308,
13,
268,
13,
462,
13,
308,
13,
308,
13,
308,
13,
308,
2
] |
core/verify-installation/selenium.py | bfosterscripps/utilities | 0 | 101684 | <filename>core/verify-installation/selenium.py
# Author: <NAME>
# Date: 20150821
# Purpose:
# test to see if selenium for python is installed
import sys
try:
# attempt to import relevant selenium pieces
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
except ImportError:
# exit with status of 1 to indicate there was an import error
sys.exit(1)
else:
# exit with a status of 0 to indicate all is well
sys.exit(0)
| [
1,
529,
9507,
29958,
3221,
29914,
27902,
29899,
6252,
362,
29914,
27373,
29889,
2272,
13,
29937,
13361,
29901,
529,
5813,
29958,
13,
29937,
4712,
29901,
29871,
29906,
29900,
29896,
29945,
29900,
29947,
29906,
29896,
13,
29937,
15247,
4220,
29901,
13,
29937,
259,
1243,
304,
1074,
565,
18866,
363,
3017,
338,
5130,
13,
13,
5215,
10876,
13,
13,
2202,
29901,
13,
1678,
396,
4218,
304,
1053,
8018,
18866,
12785,
13,
1678,
515,
18866,
1053,
1856,
9465,
13,
1678,
515,
18866,
29889,
9435,
29889,
11739,
29879,
1053,
5974,
449,
2451,
13,
1678,
515,
18866,
29889,
29813,
29889,
5924,
29889,
1481,
1053,
2563,
12376,
15716,
396,
3625,
1951,
29871,
29906,
29889,
29946,
29889,
29900,
13,
1678,
515,
18866,
29889,
29813,
29889,
5924,
1053,
3806,
29918,
1116,
2187,
408,
17522,
396,
3625,
1951,
29871,
29906,
29889,
29906,
29953,
29889,
29900,
13,
19499,
16032,
2392,
29901,
13,
1678,
396,
6876,
411,
4660,
310,
29871,
29896,
304,
12266,
727,
471,
385,
1053,
1059,
13,
1678,
10876,
29889,
13322,
29898,
29896,
29897,
13,
2870,
29901,
13,
1678,
396,
6876,
411,
263,
4660,
310,
29871,
29900,
304,
12266,
599,
338,
1532,
13,
1678,
10876,
29889,
13322,
29898,
29900,
29897,
13,
2
] |
Data/__init__.py | himammz/GpTest | 1 | 48326 | __all__ = ['Database'] | [
1,
4770,
497,
1649,
353,
6024,
9112,
2033,
2
] |
plotDiff_log.py | kmoskovtsev/Electrons-on-Helium-Scripts | 0 | 14311 | from __future__ import division
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import gsd
import gsd.fl
import numpy as np
import os
import sys
import datetime
import time
import pickle
from shutil import copyfile
import inspect
import md_tools27 as md_tools
from multiprocessing import Pool
"""
This script plots diffusion vs Gamma in log(D)-log(Gamma) or log(D)-gamma format. The data from a .dat file is used, must be precalculated by plotDiff_pG_parallel.py.
Arguments: --cmfree, --cmfixed for the free-moving center of mass regime, and v_cm subtracted respectively.
--sf <fubfolder>: subfolder to process (e.g. p32)
--NP <number>: number of subprocesses to use for parallelization. Very efficient acceleration by a factor of <number>.
"""
#Use LaTex for text
from matplotlib import rc
rc('font',**{'family':'serif','serif':['Computer Modern Roman']})
rc('text', usetex=True)
def read_log(path):
coulomb_status = ''
with open(path + '/log.txt', 'r') as f:
for i, line in enumerate(f.readlines()):
if i == 0:
timestamp = line.rstrip()
if line[:10] == '# Periodic':
words = line.split(' ')
p = int(words[9])
A = float(words[6])
if line[:4] == '# a ':
words = line.split(' ')
repeat_x = int(words[6])
repeat_y = int(words[9])
Np = 2*repeat_x*repeat_y
if line[:7] == '# Gamma':
words = line.split(' ')
dt = float(words[9])
if line[:9] == '# Coulomb':
words = line.split(' ')
coulomb_status = words[-1]
if line[:9] == '# N_therm':
words = line.split(' ')
snap_period = int(float(words[5]))
# T_gamma = 31.8265130646
if line[:9] == '# T_gamma':
words = line.split(' ')
T_gamma = float(words[3])
return {'timestamp': timestamp,'A':A, 'p':p, 'Np': Np, 'coulomb_status':coulomb_status, 'snap_period':snap_period,\
'dt':dt, 'T_gamma':T_gamma}
def OLS(x, y):
'''OLS: x must be a vertical two-dimensional array'''
X = np.hstack((np.reshape(np.ones(x.shape[0]), (-1,1)), x))#.transpose()
Xpr = X.transpose()
beta = np.dot(np.dot(np.linalg.inv(np.dot(Xpr, X)), Xpr), y)
#Estimate errors
sigma_sq = np.dot(y - np.dot(X, beta), y - np.dot(X, beta))/(len(y) - 1.)
sigma_beta_sq = sigma_sq*np.linalg.inv(np.dot(Xpr, X))
return beta, sigma_beta_sq # = [f_0, df/d(A^2)]
def diffusion_from_transport_gsd(folder_path, f_name, center_fixed = True, useframes = -1):
"""
Diffusion constant D is calculated from 4Dt = <(r(t) - r(0))^2>, or 2D_x*t = <(x(t) - x(0))^2>.
The average is calculated over all particles and over different time origins.
Time origins go from 0 to n_frames/2, and t goes from 0 to n_frames/2. This way,
the data are always within the trajectory.
center_fixed = True: eliminate oveall motion of center of mass
return D_x, D_y
D_x, D_y diffusion for x- and y-coordinates;
"""
params = read_log(folder_path)
if folder_path[-1] != '/':
folder_path = folder_path + '/'
with gsd.fl.GSDFile(folder_path + f_name, 'rb') as f:
n_frames = f.nframes
box = f.read_chunk(frame=0, name='configuration/box')
half_frames = int(n_frames/2) - 1 #sligtly less than half to avoid out of bound i
if useframes < 1 or useframes > half_frames:
useframes = half_frames
t_step = f.read_chunk(frame=0, name='configuration/step')
n_p = f.read_chunk(frame=0, name='particles/N')
x_sq_av = np.zeros(useframes)
y_sq_av = np.zeros(useframes)
for t_origin in range(n_frames - useframes - 1):
pos_0 = f.read_chunk(frame=t_origin, name='particles/position')
mean_pos_0 = np.mean(pos_0, axis = 0)
pos = pos_0
pos_raw = pos_0
for j_frame in range(useframes):
pos_m1 = pos
pos_m1_raw = pos_raw
pos_raw = f.read_chunk(frame=j_frame + t_origin, name='particles/position') - pos_0
pos = md_tools.correct_jumps(pos_raw, pos_m1, pos_m1_raw, box[0], box[1])
if center_fixed:
pos -= np.mean(pos, axis = 0) - mean_pos_0 #correct for center of mass movement
x_sq_av[j_frame] += np.mean(pos[:,0]**2)
y_sq_av[j_frame] += np.mean(pos[:,1]**2)
x_sq_av /= (n_frames - useframes - 1)
y_sq_av /= (n_frames - useframes - 1)
# OLS estimate for beta_x[0] + beta_x[1]*t = <|x_i(t) - x_i(0)|^2>
a = np.ones((useframes, 2)) # matrix a = ones(half_frames) | (0; dt; 2dt; 3dt; ...)
a[:,1] = params['snap_period']*params['dt']*np.cumsum(np.ones(useframes), axis = 0) - params['dt']
b_cutoff = int(useframes/10) #cutoff to get only linear part of x_sq_av, makes results a bit more clean
beta_x = np.linalg.lstsq(a[b_cutoff:, :], x_sq_av[b_cutoff:], rcond=-1)
beta_y = np.linalg.lstsq(a[b_cutoff:, :], y_sq_av[b_cutoff:], rcond=-1)
fig, ax = plt.subplots(1,1, figsize=(7,5))
ax.scatter(a[:,1], x_sq_av, label='$\\langle x^2\\rangle$')
ax.scatter(a[:,1], y_sq_av, label='$\\langle y^2\\rangle$')
ax.legend(loc=7)
ax.set_xlabel('$t$')
ax.set_ylabel('$\\langle r_i^2 \\rangle$')
if center_fixed:
center_fixed_str = 'cm_fixed'
else:
center_fixed_str = 'cm_free'
fig.savefig(folder_path + 'r2_diff_' + f_name +'_' + center_fixed_str + '.png')
plt.close('all')
D_x = beta_x[0][1]/2
D_y = beta_y[0][1]/2
print('D_x = {}'.format(D_x))
print('D_y = {}'.format(D_y))
return (D_x, D_y)
def diffusion_helper(arg_dict):
return diffusion_from_transport_gsd(arg_dict['sf'], arg_dict['fname'], center_fixed=arg_dict['center_fixed'], useframes = arg_dict['useframes'])
def Teff_from_gsd(args):
fpath = args['sf'] + '/' + args['fname']
with gsd.fl.GSDFile(fpath, 'rb') as f:
n_frames = f.nframes
N = f.read_chunk(frame=0, name='particles/N')
v = np.zeros((n_frames, int(N), 2))
for t in range(n_frames):
v_t = f.read_chunk(frame=t, name='particles/velocity')
v[t, :, 0] = v_t[:,0]
v[t, :, 1] = v_t[:,1]
#v_cm = np.mean(v, axis=1)
#mean_v_cmx = np.mean(v_cm[:,0])
#print("mean v_cm = {}".format(mean_v_cmx))
#sigma_v_cmx = np.sqrt(np.mean((v_cm[:,0] - mean_v_cmx)**2))/np.sqrt(n_frames)
#print("error = {}".format(sigma_v_cmx))
#mean_v_cmy = np.mean(v_cm[:,1])
#print("mean v_cm_y = {}".format(mean_v_cmy))
#sigma_v_cmy = np.sqrt(np.mean((v_cm[:,1] - mean_v_cmy)**2))/np.sqrt(n_frames)
#print("error_y = {}".format(sigma_v_cmy))
#v_rel = np.swapaxes(v, 0,1) - v_cm
v_swap = np.swapaxes(v, 0,1)
#T_eff = 0.5*np.mean(v_rel[:,:,0]**2 + v_rel[:,:,1]**2, axis = 0)
T_eff = 0.5*np.mean(v_swap[:,:,0]**2 + v_swap[:,:,1]**2, axis = 0)
print('T_eff = {}'.format(np.mean(T_eff)))
return np.mean(T_eff)
def print_help():
print('This script plots diffusion vs Gamma for data taken in diffusion measurements.')
print('===========================================================')
print('Usage: python plotDiff_pG.py diffusion_data/a32x32_* [--options]')
print('This will process all folders that match mobility_data/a32x32_*')
print('===========================================================')
print('Options:')
print('\t--cmfixed will subtract the displacement of the center of mass in diffusion calculation (default behavior)')
print('\t--cmfree will NOT subtract the displacement of the center of mass in diffusion calculation (default behavior)')
print('\t--showtext will print text info on the plots')
print('\t--NP N - will use N parallel processes in the calculations')
print('\t--sf [subfolder] - will only process the specified subfolder in all folders')
print('\t--help or -h will print this help')
## =======================================================================
# Units
unit_M = 9.10938356e-31 # kg, electron mass
unit_D = 1e-6 # m, micron
unit_E = 1.38064852e-23 # m^2*kg/s^2
unit_t = np.sqrt(unit_M*unit_D**2/unit_E) # = 2.568638150515e-10 s
epsilon_0 = 8.854187817e-12 # F/m = C^2/(J*m), vacuum permittivity
hbar = 1.0545726e-27/(unit_E*1e7)/unit_t
m_e = 9.10938356e-31/unit_M
unit_Q = np.sqrt(unit_E*1e7*unit_D*1e2) # Coulombs
unit_Qe = unit_Q/4.8032068e-10 # e, unit charge in units of elementary charge e
e_charge = 1/unit_Qe # electron charge in units of unit_Q
curr_fname = inspect.getfile(inspect.currentframe())
curr_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
##=======================================================================
# Make a list of folders we want to process
cm_fixed = True #default that can be changed by --cmfree
cm_fixed_str = 'cm_fixed'
show_text = False
Nproc = 1
selected_subfolders = []
folder_list = []
for i in range(len(sys.argv)):
if os.path.isdir(sys.argv[i]):
folder_list.append(sys.argv[i])
elif sys.argv[i] == '--sf':
try:
selected_subfolders.append(sys.argv[i+1])
except:
raise RuntimeError('Could not recognize the value of --sf. argv={}'.format(argv))
elif sys.argv[i] == '--showtext':
show_text = True
elif sys.argv[i] == '--GC':
gamma_c = float(sys.argv[i+1])
elif sys.argv[i] == '--help' or sys.argv[i] == '-h':
print_help()
exit()
try:
print('Gamma_c = {}'.format(gamma_c))
except:
raise RuntimeError('Gamma_c not specified. Use --GC argument.')
print('Selected subfolders: {}'.format(selected_subfolders))
# Make a list of subfolders p### in each folders
subfolder_lists = []
for folder in folder_list:
sf_list = []
for item in os.walk(folder):
# subfolder name and contained files
sf_list.append((item[0], item[2]))
sf_list = sf_list[1:]
subfolder_lists.append(sf_list)
##=======================================================================
for ifold, folder in enumerate(folder_list):
print('==========================================================')
print(folder)
print('==========================================================')
# Keep only selected subfolders in the list is there is selection
if len(selected_subfolders) > 0:
sf_lists_to_go = []
for isf, sf in enumerate(subfolder_lists[ifold]):
sf_words = sf[0].split('/')
if sf_words[-1] in selected_subfolders:
sf_lists_to_go.append(sf)
else:
sf_lists_to_go = subfolder_lists[ifold]
for isf, sf in enumerate(sf_lists_to_go):
sf_words = sf[0].split('/')
print(sf_words[-1])
if sf_words[-1][0] != 'p':
raise ValueError("Expected subfolder name to start with `p`, in {}".format(fname))
log_data = read_log(sf[0])
folder_name = folder.split('/')[-1]
if sf[0][-1] == '/':
sf[0] = sf[0][:-1]
sf_name = sf[0].split('/')[-1]
#Read Dx Dy vs Gamma from the .dat file
#DxDy_data = {'Dx_arr':Dx_arr, 'Dy_arr':Dy_arr, 'Dx_arr_gauss': Dx_arr*cm2s_convert, 'Dy_arr_gauss':Dy_arr*cm2s_convert, \
# 'gamma_arr':gamma_arr, 'gamma_eff_arr':gamma_eff_arr}
cm_fixed_str = 'cm_fixed'
with open(sf[0] + '/DxDy_data_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.dat', 'r') as ff:
DxDy_data = pickle.load(ff)
Dx_arr = DxDy_data['Dx_arr']
Dy_arr = DxDy_data['Dy_arr']
gamma_eff_arr = DxDy_data['gamma_eff_arr']
# Remove points where gamma > gamma_c
clip_ind = np.where(gamma_eff_arr < gamma_c)[0]
Dx_arr_clip = Dx_arr[clip_ind]
Dy_arr_clip = Dy_arr[clip_ind]
gamma_arr_clip = gamma_eff_arr[clip_ind]
print('Dx_arr = {}'.format(Dx_arr_clip))
print('Dy_arr = {}'.format(Dy_arr_clip))
## ======================================================================
## Plot Dx,Dy vs effective G (calculated from data rather then read from the log)
# in Gaussian units
labelfont = 28
tickfont = labelfont - 4
legendfont = labelfont - 4
cm2s_convert = unit_D**2/unit_t*1e4
fig, ax1 = plt.subplots(1,1, figsize=(7,6))
scatter1 = ax1.scatter(gamma_arr_clip, np.log(Dx_arr_clip*cm2s_convert), label='$D_\\perp$', color = 'green', marker='o')
ax1.set_xlabel('$\\Gamma$', fontsize=labelfont)
ax1.set_ylabel('$\\log(D/D_0)$', fontsize=labelfont)
scatter2 = ax1.scatter(gamma_arr_clip, np.log(Dy_arr_clip*cm2s_convert), label='$D_\\parallel$', color = 'red', marker='s')
#ax1.set_xlim([np.min(gamma_eff_arr) - 2, np.max(gamma_eff_arr) + 2])
ax1.legend(loc=1, fontsize=legendfont)
ax1.tick_params(labelsize= tickfont)
ax1.locator_params(nbins=6, axis='y')
formatter = mticker.ScalarFormatter(useMathText=True)
formatter.set_powerlimits((-3,2))
ax1.yaxis.set_major_formatter(formatter)
#Place text
if show_text:
text_list = ['$\\Gamma_c = {:.1f}$'.format(gamma_c)]
y_lim = ax1.get_ylim()
x_lim = ax1.get_xlim()
h = y_lim[1] - y_lim[0]
w = x_lim[1] - x_lim[0]
text_x = x_lim[0] + 0.5*w
text_y = y_lim[1] - 0.05*h
if type(text_list) == list:
n_str = len(text_list)
for i_fig in range(n_str):
ax1.text(text_x, text_y - 0.05*h*i_fig, text_list[i_fig])
elif type(text_list) == str:
ax1.text(text_x, text_y, text_list)
else:
raise TypeError('text_list must be a list of strings or a string')
#fig.patch.set_alpha(alpha=1)
plt.tight_layout()
fig.savefig(folder + '/' + 'DxDy_G_log_' + sf_name + '_' + folder_name + '_{:.2f}'.format(gamma_c) + '.pdf')
#fig.savefig(sf[0] + '/' + 'DxDy_Geff_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.png')
#fig.savefig(sf[0] + '/' + 'DxDy_Geff_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.eps')
#fig.savefig(sf[0] + '/' + 'DxDy_Geff_' + cm_fixed_str + '_' + sf_name + '_' + folder_name + '.pdf')
plt.close('all')
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
8542,
30004,
13,
5215,
22889,
408,
286,
572,
30004,
13,
29885,
572,
29889,
1509,
877,
29909,
1505,
1495,
30004,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
30004,
13,
5215,
22889,
29889,
29873,
6541,
408,
286,
29873,
6541,
30004,
13,
5215,
330,
4928,
30004,
13,
5215,
330,
4928,
29889,
1579,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
2897,
30004,
13,
5215,
10876,
30004,
13,
5215,
12865,
30004,
13,
5215,
931,
30004,
13,
5215,
5839,
280,
30004,
13,
3166,
528,
4422,
1053,
3509,
1445,
30004,
13,
5215,
16096,
30004,
13,
5215,
22821,
29918,
8504,
29906,
29955,
408,
22821,
29918,
8504,
30004,
13,
3166,
6674,
307,
985,
292,
1053,
28625,
30004,
13,
30004,
13,
15945,
19451,
13,
4013,
2471,
24580,
23253,
7186,
402,
2735,
297,
1480,
29898,
29928,
6817,
1188,
29898,
6642,
29897,
470,
1480,
29898,
29928,
6817,
4283,
3402,
29889,
450,
848,
515,
263,
869,
4130,
934,
338,
1304,
29892,
1818,
367,
758,
15807,
630,
491,
6492,
26023,
29918,
29886,
29954,
29918,
23482,
29889,
2272,
22993,
13,
26915,
29901,
1192,
4912,
9021,
29892,
1192,
4912,
20227,
363,
278,
3889,
29899,
13529,
292,
4818,
310,
4158,
22384,
29892,
322,
325,
29918,
4912,
23197,
287,
8307,
22993,
13,
489,
4668,
529,
29888,
431,
12083,
23917,
1014,
12083,
304,
1889,
313,
29872,
29889,
29887,
29889,
282,
29941,
29906,
8443,
13,
489,
25500,
529,
4537,
23917,
1353,
310,
1014,
5014,
267,
304,
671,
363,
8943,
2133,
29889,
18064,
8543,
28178,
491,
263,
7329,
310,
529,
4537,
15513,
30004,
13,
15945,
19451,
13,
30004,
13,
29937,
11403,
997,
26887,
363,
1426,
30004,
13,
3166,
22889,
1053,
364,
29883,
30004,
13,
2214,
877,
5657,
742,
1068,
10998,
11922,
22099,
643,
361,
3788,
643,
361,
2396,
1839,
20606,
261,
14624,
5917,
2033,
1800,
30004,
13,
2214,
877,
726,
742,
502,
300,
735,
29922,
5574,
8443,
13,
30004,
13,
1753,
1303,
29918,
1188,
29898,
2084,
1125,
30004,
13,
1678,
3581,
29880,
3424,
29918,
4882,
353,
6629,
30004,
13,
1678,
411,
1722,
29898,
2084,
718,
8207,
1188,
29889,
3945,
742,
525,
29878,
1495,
408,
285,
29901,
30004,
13,
4706,
363,
474,
29892,
1196,
297,
26985,
29898,
29888,
29889,
949,
9012,
580,
1125,
30004,
13,
9651,
565,
474,
1275,
29871,
29900,
29901,
30004,
13,
18884,
14334,
353,
1196,
29889,
29878,
17010,
26471,
13,
9651,
565,
1196,
7503,
29896,
29900,
29962,
1275,
16321,
29498,
293,
2396,
30004,
13,
18884,
3838,
353,
1196,
29889,
5451,
877,
525,
8443,
13,
18884,
282,
353,
938,
29898,
9303,
29961,
29929,
2314,
30004,
13,
18884,
319,
353,
5785,
29898,
9303,
29961,
29953,
2314,
30004,
13,
9651,
565,
1196,
7503,
29946,
29962,
1275,
16321,
263,
525,
29901,
30004,
13,
18884,
3838,
353,
1196,
29889,
5451,
877,
525,
8443,
13,
18884,
12312,
29918,
29916,
353,
938,
29898,
9303,
29961,
29953,
2314,
30004,
13,
18884,
12312,
29918,
29891,
353,
938,
29898,
9303,
29961,
29929,
2314,
30004,
13,
18884,
405,
29886,
353,
29871,
29906,
29930,
14358,
29918,
29916,
29930,
14358,
29918,
29891,
30004,
13,
9651,
565,
1196,
7503,
29955,
29962,
1275,
16321,
402,
2735,
2396,
30004,
13,
18884,
3838,
353,
1196,
29889,
5451,
877,
525,
8443,
13,
18884,
11636,
353,
5785,
29898,
9303,
29961,
29929,
2314,
30004,
13,
9651,
565,
1196,
7503,
29929,
29962,
1275,
16321,
315,
5059,
3424,
2396,
30004,
13,
18884,
3838,
353,
1196,
29889,
5451,
877,
525,
8443,
13,
18884,
3581,
29880,
3424,
29918,
4882,
353,
3838,
14352,
29896,
29962,
30004,
13,
9651,
565,
1196,
7503,
29929,
29962,
1275,
16321,
405,
29918,
721,
29885,
2396,
30004,
13,
18884,
3838,
353,
1196,
29889,
5451,
877,
525,
8443,
13,
18884,
15101,
29918,
19145,
353,
938,
29898,
7411,
29898,
9303,
29961,
29945,
12622,
30004,
13,
9651,
396,
323,
29918,
4283,
353,
29871,
29941,
29896,
29889,
29947,
29906,
29953,
29945,
29896,
29941,
29900,
29953,
29946,
29953,
30004,
13,
9651,
565,
1196,
7503,
29929,
29962,
1275,
16321,
323,
29918,
4283,
2396,
30004,
13,
18884,
3838,
353,
1196,
29889,
5451,
877,
525,
8443,
13,
18884,
323,
29918,
4283,
353,
5785,
29898,
9303,
29961,
29941,
2314,
30004,
13,
1678,
736,
11117,
16394,
2396,
14334,
5501,
29909,
2396,
29909,
29892,
525,
29886,
2396,
29886,
29892,
525,
29940,
29886,
2396,
405,
29886,
29892,
525,
29883,
5059,
3424,
29918,
4882,
2396,
29883,
5059,
3424,
29918,
4882,
29892,
525,
29879,
8971,
29918,
19145,
2396,
29879,
8971,
29918,
19145,
2053,
30004,
13,
9651,
525,
6008,
2396,
6008,
29892,
525,
29911,
29918,
4283,
2396,
29911,
29918,
4283,
8117,
13,
30004,
13,
1753,
438,
8547,
29898,
29916,
29892,
343,
1125,
30004,
13,
1678,
14550,
5607,
29903,
29901,
921,
1818,
367,
263,
11408,
1023,
29899,
12531,
1409,
12008,
30004,
13,
1678,
1060,
353,
7442,
29889,
29882,
1429,
3552,
9302,
29889,
690,
14443,
29898,
9302,
29889,
2873,
29898,
29916,
29889,
12181,
29961,
29900,
11724,
8521,
29896,
29892,
29896,
8243,
921,
876,
29937,
29889,
3286,
4220,
26471,
13,
1678,
1060,
558,
353,
1060,
29889,
3286,
4220,
26471,
13,
1678,
21762,
353,
7442,
29889,
6333,
29898,
9302,
29889,
6333,
29898,
9302,
29889,
29880,
979,
29887,
29889,
11569,
29898,
9302,
29889,
6333,
29898,
29990,
558,
29892,
1060,
8243,
1060,
558,
511,
343,
8443,
13,
1678,
396,
12787,
6490,
4436,
30004,
13,
1678,
269,
2934,
29918,
3044,
353,
7442,
29889,
6333,
29898,
29891,
448,
7442,
29889,
6333,
29898,
29990,
29892,
21762,
511,
343,
448,
7442,
29889,
6333,
29898,
29990,
29892,
21762,
876,
14571,
2435,
29898,
29891,
29897,
448,
29871,
29896,
1846,
30004,
13,
1678,
269,
2934,
29918,
3571,
29918,
3044,
353,
269,
2934,
29918,
3044,
29930,
9302,
29889,
29880,
979,
29887,
29889,
11569,
29898,
9302,
29889,
6333,
29898,
29990,
558,
29892,
1060,
876,
30004,
13,
1678,
736,
21762,
29892,
269,
2934,
29918,
3571,
29918,
3044,
396,
353,
518,
29888,
29918,
29900,
29892,
4489,
29914,
29881,
29898,
29909,
29985,
29906,
4638,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
1753,
23253,
29918,
3166,
29918,
27882,
29918,
3174,
29881,
29898,
12083,
29918,
2084,
29892,
285,
29918,
978,
29892,
4818,
29918,
20227,
353,
5852,
29892,
671,
19935,
353,
448,
29896,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
6756,
13,
1678,
360,
2593,
3958,
4868,
360,
338,
12833,
515,
29871,
29946,
29928,
29873,
353,
529,
29898,
29878,
29898,
29873,
29897,
448,
364,
29898,
29900,
876,
29985,
29906,
10202,
470,
29871,
29906,
29928,
29918,
29916,
29930,
29873,
353,
529,
29898,
29916,
29898,
29873,
29897,
448,
921,
29898,
29900,
876,
29985,
29906,
15513,
30004,
13,
1678,
450,
6588,
338,
12833,
975,
599,
17105,
322,
975,
1422,
931,
1677,
1144,
22993,
13,
1678,
5974,
1677,
1144,
748,
515,
29871,
29900,
304,
302,
29918,
19935,
29914,
29906,
29892,
322,
260,
5771,
515,
29871,
29900,
304,
302,
29918,
19935,
29914,
29906,
29889,
910,
982,
11167,
13,
1678,
278,
848,
526,
2337,
2629,
278,
23324,
706,
22993,
13,
462,
462,
462,
462,
1678,
6756,
13,
1678,
4818,
29918,
20227,
353,
5852,
29901,
27399,
288,
345,
497,
10884,
310,
4818,
310,
4158,
30004,
13,
1678,
736,
360,
29918,
29916,
29892,
360,
29918,
29891,
30004,
13,
1678,
360,
29918,
29916,
29892,
360,
29918,
29891,
23253,
363,
921,
29899,
322,
343,
29899,
1111,
24266,
2104,
13,
1678,
9995,
30004,
13,
1678,
8636,
353,
1303,
29918,
1188,
29898,
12083,
29918,
2084,
8443,
13,
1678,
565,
4138,
29918,
2084,
14352,
29896,
29962,
2804,
8207,
2396,
30004,
13,
4706,
4138,
29918,
2084,
353,
4138,
29918,
2084,
718,
8207,
29915,
30004,
13,
1678,
411,
330,
4928,
29889,
1579,
29889,
29954,
7230,
2283,
29898,
12083,
29918,
2084,
718,
285,
29918,
978,
29892,
525,
6050,
1495,
408,
285,
29901,
30004,
13,
4706,
302,
29918,
19935,
353,
285,
29889,
29876,
19935,
30004,
13,
4706,
3800,
353,
285,
29889,
949,
29918,
29812,
29898,
2557,
29922,
29900,
29892,
1024,
2433,
13305,
29914,
1884,
1495,
30004,
13,
4706,
4203,
29918,
19935,
353,
938,
29898,
29876,
29918,
19935,
29914,
29906,
29897,
448,
29871,
29896,
396,
2536,
5523,
368,
3109,
1135,
4203,
304,
4772,
714,
310,
3216,
474,
30004,
13,
4706,
565,
671,
19935,
529,
29871,
29896,
470,
671,
19935,
1405,
4203,
29918,
19935,
29901,
30004,
13,
9651,
671,
19935,
353,
4203,
29918,
19935,
30004,
13,
4706,
260,
29918,
10568,
353,
285,
29889,
949,
29918,
29812,
29898,
2557,
29922,
29900,
29892,
1024,
2433,
13305,
29914,
10568,
1495,
30004,
13,
4706,
302,
29918,
29886,
353,
285,
29889,
949,
29918,
29812,
29898,
2557,
29922,
29900,
29892,
1024,
2433,
1595,
4027,
29914,
29940,
1495,
30004,
13,
4706,
921,
29918,
3044,
29918,
485,
353,
7442,
29889,
3298,
359,
29898,
1509,
19935,
8443,
13,
4706,
343,
29918,
3044,
29918,
485,
353,
7442,
29889,
3298,
359,
29898,
1509,
19935,
8443,
13,
4706,
363,
260,
29918,
12574,
297,
3464,
29898,
29876,
29918,
19935,
448,
671,
19935,
448,
29871,
29896,
1125,
30004,
13,
9651,
926,
29918,
29900,
353,
285,
29889,
949,
29918,
29812,
29898,
2557,
29922,
29873,
29918,
12574,
29892,
1024,
2433,
1595,
4027,
29914,
3283,
1495,
30004,
13,
9651,
2099,
29918,
1066,
29918,
29900,
353,
7442,
29889,
12676,
29898,
1066,
29918,
29900,
29892,
9685,
353,
29871,
29900,
8443,
13,
9651,
926,
353,
926,
29918,
29900,
30004,
13,
9651,
926,
29918,
1610,
353,
926,
29918,
29900,
30004,
13,
9651,
363,
432,
29918,
2557,
297,
3464,
29898,
1509,
19935,
1125,
30004,
13,
18884,
926,
29918,
29885,
29896,
353,
926,
30004,
13,
18884,
926,
29918,
29885,
29896,
29918,
1610,
353,
926,
29918,
1610,
30004,
13,
18884,
926,
29918,
1610,
353,
285,
29889,
949,
29918,
29812,
29898,
2557,
29922,
29926,
29918,
2557,
718,
260,
29918,
12574,
29892,
1024,
2433,
1595,
4027,
29914,
3283,
1495,
448,
926,
29918,
29900,
30004,
13,
18884,
926,
353,
22821,
29918,
8504,
29889,
15728,
29918,
29926,
17204,
29898,
1066,
29918,
1610,
29892,
926,
29918,
29885,
29896,
29892,
926,
29918,
29885,
29896,
29918,
1610,
29892,
3800,
29961,
29900,
1402,
3800,
29961,
29896,
2314,
30004,
13,
18884,
565,
4818,
29918,
20227,
29901,
30004,
13,
462,
1678,
926,
22361,
7442,
29889,
12676,
29898,
1066,
29892,
9685,
353,
29871,
29900,
29897,
448,
2099,
29918,
1066,
29918,
29900,
396,
15728,
363,
4818,
310,
4158,
10298,
30004,
13,
18884,
921,
29918,
3044,
29918,
485,
29961,
29926,
29918,
2557,
29962,
4619,
7442,
29889,
12676,
29898,
1066,
7503,
29892,
29900,
29962,
1068,
29906,
8443,
13,
18884,
343,
29918,
3044,
29918,
485,
29961,
29926,
29918,
2557,
29962,
4619,
7442,
29889,
12676,
29898,
1066,
7503,
29892,
29896,
29962,
1068,
29906,
8443,
13,
1678,
921,
29918,
3044,
29918,
485,
847,
29922,
313,
29876,
29918,
19935,
448,
671,
19935,
448,
29871,
29896,
8443,
13,
1678,
343,
29918,
3044,
29918,
485,
847,
29922,
313,
29876,
29918,
19935,
448,
671,
19935,
448,
29871,
29896,
8443,
13,
1678,
396,
438,
8547,
12678,
363,
21762,
29918,
29916,
29961,
29900,
29962,
718,
21762,
29918,
29916,
29961,
29896,
14178,
29873,
353,
529,
29989,
29916,
29918,
29875,
29898,
29873,
29897,
448,
921,
29918,
29875,
29898,
29900,
10531,
29985,
29906,
3238,
13,
1678,
263,
353,
7442,
29889,
2873,
3552,
1509,
19935,
29892,
29871,
29906,
876,
396,
4636,
263,
353,
6743,
29898,
24498,
29918,
19935,
29897,
891,
313,
29900,
29936,
11636,
29936,
29871,
29906,
6008,
29936,
29871,
29941,
6008,
29936,
2023,
8443,
13,
1678,
263,
7503,
29892,
29896,
29962,
353,
8636,
1839,
29879,
8971,
29918,
19145,
2033,
29930,
7529,
1839,
6008,
2033,
29930,
9302,
29889,
29883,
398,
2083,
29898,
9302,
29889,
2873,
29898,
1509,
19935,
511,
9685,
353,
29871,
29900,
29897,
448,
8636,
1839,
6008,
2033,
30004,
13,
1678,
289,
29918,
7582,
2696,
353,
938,
29898,
1509,
19935,
29914,
29896,
29900,
29897,
396,
7582,
2696,
304,
679,
871,
5608,
760,
310,
921,
29918,
3044,
29918,
485,
29892,
3732,
2582,
263,
2586,
901,
5941,
30004,
13,
1678,
21762,
29918,
29916,
353,
7442,
29889,
29880,
979,
29887,
29889,
20155,
3044,
29898,
29874,
29961,
29890,
29918,
7582,
2696,
29901,
29892,
584,
1402,
921,
29918,
3044,
29918,
485,
29961,
29890,
29918,
7582,
2696,
29901,
1402,
364,
1116,
10457,
29896,
8443,
13,
1678,
21762,
29918,
29891,
353,
7442,
29889,
29880,
979,
29887,
29889,
20155,
3044,
29898,
29874,
29961,
29890,
29918,
7582,
2696,
29901,
29892,
584,
1402,
343,
29918,
3044,
29918,
485,
29961,
29890,
29918,
7582,
2696,
29901,
1402,
364,
1116,
10457,
29896,
8443,
13,
1678,
6756,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
29898,
29896,
29892,
29896,
29892,
2537,
2311,
7607,
29955,
29892,
29945,
876,
30004,
13,
1678,
4853,
29889,
1557,
2620,
29898,
29874,
7503,
29892,
29896,
1402,
921,
29918,
3044,
29918,
485,
29892,
3858,
2433,
29938,
1966,
6990,
921,
29985,
29906,
1966,
5854,
29938,
1495,
30004,
13,
1678,
4853,
29889,
1557,
2620,
29898,
29874,
7503,
29892,
29896,
1402,
343,
29918,
3044,
29918,
485,
29892,
3858,
2433,
29938,
1966,
6990,
343,
29985,
29906,
1966,
5854,
29938,
1495,
30004,
13,
1678,
4853,
29889,
26172,
29898,
2029,
29922,
29955,
8443,
13,
1678,
4853,
29889,
842,
29918,
29916,
1643,
877,
29938,
29873,
29938,
1495,
30004,
13,
1678,
4853,
29889,
842,
29918,
29891,
1643,
877,
29938,
1966,
6990,
364,
29918,
29875,
29985,
29906,
2474,
5854,
29938,
1495,
30004,
13,
1678,
565,
4818,
29918,
20227,
29901,
30004,
13,
4706,
4818,
29918,
20227,
29918,
710,
353,
525,
4912,
29918,
20227,
29915,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
4818,
29918,
20227,
29918,
710,
353,
525,
4912,
29918,
9021,
29915,
30004,
13,
1678,
2537,
29889,
7620,
1003,
29898,
12083,
29918,
2084,
718,
525,
29878,
29906,
29918,
12765,
29918,
29915,
718,
285,
29918,
978,
718,
15972,
29915,
718,
4818,
29918,
20227,
29918,
710,
718,
15300,
2732,
1495,
30004,
13,
1678,
14770,
29889,
5358,
877,
497,
1495,
30004,
13,
1678,
360,
29918,
29916,
353,
21762,
29918,
29916,
29961,
29900,
3816,
29896,
16261,
29906,
30004,
13,
1678,
360,
29918,
29891,
353,
21762,
29918,
29891,
29961,
29900,
3816,
29896,
16261,
29906,
30004,
13,
1678,
1596,
877,
29928,
29918,
29916,
353,
6571,
4286,
4830,
29898,
29928,
29918,
29916,
876,
30004,
13,
1678,
1596,
877,
29928,
29918,
29891,
353,
6571,
4286,
4830,
29898,
29928,
29918,
29891,
876,
30004,
13,
1678,
736,
313,
29928,
29918,
29916,
29892,
360,
29918,
29891,
8443,
13,
30004,
13,
30004,
13,
1753,
23253,
29918,
20907,
29898,
1191,
29918,
8977,
1125,
30004,
13,
1678,
736,
23253,
29918,
3166,
29918,
27882,
29918,
3174,
29881,
29898,
1191,
29918,
8977,
1839,
4668,
7464,
1852,
29918,
8977,
1839,
29888,
978,
7464,
4818,
29918,
20227,
29922,
1191,
29918,
8977,
1839,
5064,
29918,
20227,
7464,
671,
19935,
353,
1852,
29918,
8977,
1839,
1509,
19935,
2033,
8443,
13,
30004,
13,
30004,
13,
1753,
1920,
600,
29918,
3166,
29918,
3174,
29881,
29898,
5085,
1125,
30004,
13,
1678,
285,
2084,
353,
6389,
1839,
4668,
2033,
718,
8207,
29915,
718,
6389,
1839,
29888,
978,
2033,
30004,
13,
1678,
411,
330,
4928,
29889,
1579,
29889,
29954,
7230,
2283,
29898,
29888,
2084,
29892,
525,
6050,
1495,
408,
285,
29901,
30004,
13,
4706,
302,
29918,
19935,
353,
285,
29889,
29876,
19935,
30004,
13,
4706,
405,
353,
285,
29889,
949,
29918,
29812,
29898,
2557,
29922,
29900,
29892,
1024,
2433,
1595,
4027,
29914,
29940,
1495,
30004,
13,
4706,
325,
353,
7442,
29889,
3298,
359,
3552,
29876,
29918,
19935,
29892,
938,
29898,
29940,
511,
29871,
29906,
876,
30004,
13,
4706,
363,
260,
297,
3464,
29898,
29876,
29918,
19935,
1125,
30004,
13,
9651,
325,
29918,
29873,
353,
285,
29889,
949,
29918,
29812,
29898,
2557,
29922,
29873,
29892,
1024,
2433,
1595,
4027,
29914,
955,
25245,
1495,
30004,
13,
9651,
325,
29961,
29873,
29892,
584,
29892,
29871,
29900,
29962,
353,
325,
29918,
29873,
7503,
29892,
29900,
29962,
30004,
13,
9651,
325,
29961,
29873,
29892,
584,
29892,
29871,
29896,
29962,
353,
325,
29918,
29873,
7503,
29892,
29896,
29962,
30004,
13,
30004,
13,
1678,
396,
29894,
29918,
4912,
353,
7442,
29889,
12676,
29898,
29894,
29892,
9685,
29922,
29896,
8443,
13,
1678,
396,
12676,
29918,
29894,
29918,
4912,
29916,
353,
7442,
29889,
12676,
29898,
29894,
29918,
4912,
7503,
29892,
29900,
2314,
30004,
13,
1678,
396,
2158,
703,
12676,
325,
29918,
4912,
353,
6571,
1642,
4830,
29898,
12676,
29918,
29894,
29918,
4912,
29916,
876,
30004,
13,
1678,
396,
3754,
29918,
29894,
29918,
4912,
29916,
353,
7442,
29889,
3676,
29898,
9302,
29889,
12676,
3552,
29894,
29918,
4912,
7503,
29892,
29900,
29962,
448,
2099,
29918,
29894,
29918,
4912,
29916,
29897,
1068,
29906,
876,
29914,
9302,
29889,
3676,
29898,
29876,
29918,
19935,
8443,
13,
1678,
396,
2158,
703,
2704,
353,
6571,
1642,
4830,
29898,
3754,
29918,
29894,
29918,
4912,
29916,
876,
30004,
13,
1678,
396,
12676,
29918,
29894,
29918,
29883,
1357,
353,
7442,
29889,
12676,
29898,
29894,
29918,
4912,
7503,
29892,
29896,
2314,
30004,
13,
1678,
396,
2158,
703,
12676,
325,
29918,
4912,
29918,
29891,
353,
6571,
1642,
4830,
29898,
12676,
29918,
29894,
29918,
29883,
1357,
876,
30004,
13,
1678,
396,
3754,
29918,
29894,
29918,
29883,
1357,
353,
7442,
29889,
3676,
29898,
9302,
29889,
12676,
3552,
29894,
29918,
4912,
7503,
29892,
29896,
29962,
448,
2099,
29918,
29894,
29918,
29883,
1357,
29897,
1068,
29906,
876,
29914,
9302,
29889,
3676,
29898,
29876,
29918,
19935,
8443,
13,
1678,
396,
2158,
703,
2704,
29918,
29891,
353,
6571,
1642,
4830,
29898,
3754,
29918,
29894,
29918,
29883,
1357,
876,
30004,
13,
1678,
396,
29894,
29918,
2674,
353,
7442,
29889,
26276,
1165,
267,
29898,
29894,
29892,
29871,
29900,
29892,
29896,
29897,
448,
325,
29918,
4912,
30004,
13,
1678,
325,
29918,
26276,
353,
7442,
29889,
26276,
1165,
267,
29898,
29894,
29892,
29871,
29900,
29892,
29896,
8443,
13,
1678,
396,
29911,
29918,
12352,
353,
29871,
29900,
29889,
29945,
29930,
9302,
29889,
12676,
29898,
29894,
29918,
2674,
7503,
29892,
29901,
29892,
29900,
29962,
1068,
29906,
718,
325,
29918,
2674,
7503,
29892,
29901,
29892,
29896,
29962,
1068,
29906,
29892,
9685,
353,
29871,
29900,
8443,
13,
1678,
323,
29918,
12352,
353,
29871,
29900,
29889,
29945,
29930,
9302,
29889,
12676,
29898,
29894,
29918,
26276,
7503,
29892,
29901,
29892,
29900,
29962,
1068,
29906,
718,
325,
29918,
26276,
7503,
29892,
29901,
29892,
29896,
29962,
1068,
29906,
29892,
9685,
353,
29871,
29900,
8443,
13,
1678,
1596,
877,
29911,
29918,
12352,
353,
6571,
4286,
4830,
29898,
9302,
29889,
12676,
29898,
29911,
29918,
12352,
4961,
30004,
13,
1678,
736,
7442,
29889,
12676,
29898,
29911,
29918,
12352,
8443,
13,
30004,
13,
1753,
1596,
29918,
8477,
7295,
30004,
13,
1678,
1596,
877,
4013,
2471,
24580,
23253,
7186,
402,
2735,
363,
848,
4586,
297,
23253,
20398,
29889,
1495,
30004,
13,
1678,
1596,
877,
9166,
9166,
9166,
4936,
25512,
1495,
30004,
13,
1678,
1596,
877,
27573,
29901,
3017,
6492,
26023,
29918,
29886,
29954,
29889,
2272,
23253,
29918,
1272,
29914,
29874,
29941,
29906,
29916,
29941,
29906,
24563,
518,
489,
6768,
29962,
1495,
30004,
13,
1678,
1596,
877,
4013,
674,
1889,
599,
16495,
393,
1993,
22458,
1793,
29918,
1272,
29914,
29874,
29941,
29906,
29916,
29941,
29906,
24563,
1495,
30004,
13,
1678,
1596,
877,
9166,
9166,
9166,
4936,
25512,
1495,
30004,
13,
1678,
1596,
877,
5856,
29901,
1495,
30004,
13,
1678,
1596,
28909,
29873,
489,
4912,
20227,
674,
23197,
278,
12272,
9552,
310,
278,
4818,
310,
4158,
297,
23253,
13944,
313,
4381,
6030,
29897,
1495,
30004,
13,
1678,
1596,
28909,
29873,
489,
4912,
9021,
674,
6058,
23197,
278,
12272,
9552,
310,
278,
4818,
310,
4158,
297,
23253,
13944,
313,
4381,
6030,
29897,
1495,
30004,
13,
1678,
1596,
28909,
29873,
489,
4294,
726,
674,
1596,
1426,
5235,
373,
278,
24580,
1495,
30004,
13,
1678,
1596,
28909,
29873,
489,
25500,
405,
448,
674,
671,
405,
8943,
10174,
297,
278,
17203,
1495,
30004,
13,
1678,
1596,
28909,
29873,
489,
4668,
518,
1491,
12083,
29962,
448,
674,
871,
1889,
278,
6790,
1014,
12083,
297,
599,
16495,
1495,
30004,
13,
1678,
1596,
28909,
29873,
489,
8477,
470,
448,
29882,
674,
1596,
445,
1371,
1495,
30004,
13,
30004,
13,
30004,
13,
2277,
1275,
9166,
9166,
9166,
9166,
2751,
29922,
30004,
13,
29937,
28386,
30004,
13,
5441,
29918,
29924,
353,
29871,
29929,
29889,
29896,
29900,
29929,
29941,
29947,
29941,
29945,
29953,
29872,
29899,
29941,
29896,
396,
12118,
29892,
11966,
4158,
30004,
13,
5441,
29918,
29928,
353,
29871,
29896,
29872,
29899,
29953,
396,
286,
29892,
20710,
1617,
30004,
13,
5441,
29918,
29923,
353,
29871,
29896,
29889,
29941,
29947,
29900,
29953,
29946,
29947,
29945,
29906,
29872,
29899,
29906,
29941,
396,
286,
29985,
29906,
29930,
9415,
29914,
29879,
29985,
29906,
30004,
13,
5441,
29918,
29873,
353,
7442,
29889,
3676,
29898,
5441,
29918,
29924,
29930,
5441,
29918,
29928,
1068,
29906,
29914,
5441,
29918,
29923,
29897,
396,
353,
29871,
29906,
29889,
29945,
29953,
29947,
29953,
29941,
29947,
29896,
29945,
29900,
29945,
29896,
29945,
29872,
29899,
29896,
29900,
269,
30004,
13,
5463,
29918,
29900,
353,
29871,
29947,
29889,
29947,
29945,
29946,
29896,
29947,
29955,
29947,
29896,
29955,
29872,
29899,
29896,
29906,
396,
383,
29914,
29885,
353,
315,
29985,
29906,
14571,
29967,
29930,
29885,
511,
11757,
29884,
398,
3635,
986,
2068,
30004,
13,
26620,
353,
29871,
29896,
29889,
29900,
29945,
29946,
29945,
29955,
29906,
29953,
29872,
29899,
29906,
29955,
14571,
5441,
29918,
29923,
29930,
29896,
29872,
29955,
6802,
5441,
29918,
29873,
30004,
13,
29885,
29918,
29872,
353,
29871,
29929,
29889,
29896,
29900,
29929,
29941,
29947,
29941,
29945,
29953,
29872,
29899,
29941,
29896,
29914,
5441,
29918,
29924,
30004,
13,
5441,
29918,
29984,
353,
7442,
29889,
3676,
29898,
5441,
29918,
29923,
29930,
29896,
29872,
29955,
29930,
5441,
29918,
29928,
29930,
29896,
29872,
29906,
29897,
396,
315,
5059,
3424,
29879,
30004,
13,
5441,
29918,
29984,
29872,
353,
5190,
29918,
29984,
29914,
29946,
29889,
29947,
29900,
29941,
29906,
29900,
29953,
29947,
29872,
29899,
29896,
29900,
396,
321,
29892,
5190,
8323,
297,
10340,
310,
22470,
8323,
321,
30004,
13,
29872,
29918,
23367,
353,
29871,
29896,
29914,
5441,
29918,
29984,
29872,
396,
11966,
8323,
297,
10340,
310,
5190,
29918,
29984,
30004,
13,
30004,
13,
30004,
13,
30004,
13,
21962,
29918,
29888,
978,
353,
16096,
29889,
657,
1445,
29898,
1144,
1103,
29889,
3784,
2557,
3101,
30004,
13,
21962,
29918,
2084,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
370,
1028,
493,
29898,
1144,
1103,
29889,
657,
1445,
29898,
1144,
1103,
29889,
3784,
2557,
580,
4961,
30004,
13,
30004,
13,
2277,
9166,
9166,
9166,
9166,
2751,
25512,
30004,
13,
29937,
8561,
263,
1051,
310,
16495,
591,
864,
304,
1889,
30004,
13,
4912,
29918,
20227,
353,
5852,
396,
4381,
393,
508,
367,
3939,
491,
1192,
4912,
9021,
30004,
13,
4912,
29918,
20227,
29918,
710,
353,
525,
4912,
29918,
20227,
29915,
30004,
13,
4294,
29918,
726,
353,
7700,
30004,
13,
29940,
15439,
353,
29871,
29896,
30004,
13,
8391,
29918,
1491,
8771,
414,
353,
5159,
30004,
13,
12083,
29918,
1761,
353,
5159,
30004,
13,
1454,
474,
297,
3464,
29898,
2435,
29898,
9675,
29889,
19218,
22164,
30004,
13,
1678,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
9675,
29889,
19218,
29961,
29875,
29962,
1125,
30004,
13,
4706,
4138,
29918,
1761,
29889,
4397,
29898,
9675,
29889,
19218,
29961,
29875,
2314,
30004,
13,
1678,
25342,
10876,
29889,
19218,
29961,
29875,
29962,
1275,
525,
489,
4668,
2396,
30004,
13,
4706,
1018,
29901,
30004,
13,
9651,
4629,
29918,
1491,
8771,
414,
29889,
4397,
29898,
9675,
29889,
19218,
29961,
29875,
29974,
29896,
2314,
30004,
13,
4706,
5174,
29901,
30004,
13,
9651,
12020,
24875,
2392,
877,
23323,
451,
18720,
278,
995,
310,
1192,
4668,
29889,
1852,
29894,
3790,
29913,
4286,
4830,
29898,
19218,
876,
30004,
13,
1678,
25342,
10876,
29889,
19218,
29961,
29875,
29962,
1275,
525,
489,
4294,
726,
2396,
30004,
13,
4706,
1510,
29918,
726,
353,
5852,
30004,
13,
1678,
25342,
10876,
29889,
19218,
29961,
29875,
29962,
1275,
525,
489,
8766,
2396,
30004,
13,
4706,
330,
2735,
29918,
29883,
353,
5785,
29898,
9675,
29889,
19218,
29961,
29875,
29974,
29896,
2314,
30004,
13,
1678,
25342,
10876,
29889,
19218,
29961,
29875,
29962,
1275,
525,
489,
8477,
29915,
470,
10876,
29889,
19218,
29961,
29875,
29962,
1275,
17411,
29882,
2396,
30004,
13,
4706,
1596,
29918,
8477,
26471,
13,
4706,
6876,
26471,
13,
30004,
13,
2202,
29901,
30004,
13,
1678,
1596,
877,
6642,
29918,
29883,
353,
6571,
4286,
4830,
29898,
4283,
29918,
29883,
876,
30004,
13,
19499,
29901,
30004,
13,
1678,
12020,
24875,
2392,
877,
6642,
29918,
29883,
451,
6790,
29889,
4803,
1192,
8766,
2980,
29889,
1495,
30004,
13,
30004,
13,
2158,
877,
8592,
1014,
8771,
414,
29901,
6571,
4286,
4830,
29898,
8391,
29918,
1491,
8771,
414,
876,
30004,
13,
29937,
8561,
263,
1051,
310,
1014,
8771,
414,
282,
2277,
29937,
297,
1269,
16495,
30004,
13,
1491,
12083,
29918,
21513,
353,
5159,
30004,
13,
1454,
4138,
297,
4138,
29918,
1761,
29901,
30004,
13,
1678,
18668,
29918,
1761,
353,
5159,
30004,
13,
1678,
363,
2944,
297,
2897,
29889,
20919,
29898,
12083,
1125,
30004,
13,
4706,
396,
1014,
12083,
1024,
322,
11122,
2066,
30004,
13,
4706,
18668,
29918,
1761,
29889,
4397,
3552,
667,
29961,
29900,
1402,
2944,
29961,
29906,
12622,
30004,
13,
1678,
18668,
29918,
1761,
353,
18668,
29918,
1761,
29961,
29896,
17531,
30004,
13,
1678,
1014,
12083,
29918,
21513,
29889,
4397,
29898,
4668,
29918,
1761,
8443,
13,
30004,
13,
30004,
13,
2277,
9166,
9166,
9166,
9166,
2751,
25512,
30004,
13,
1454,
565,
1025,
29892,
4138,
297,
26985,
29898,
12083,
29918,
1761,
1125,
30004,
13,
1678,
1596,
877,
9166,
9166,
9166,
4936,
1360,
1495,
30004,
13,
1678,
1596,
29898,
12083,
8443,
13,
1678,
1596,
877,
9166,
9166,
9166,
4936,
1360,
1495,
30004,
13,
1678,
396,
19152,
871,
4629,
1014,
8771,
414,
297,
278,
1051,
338,
727,
338,
9262,
30004,
13,
1678,
565,
7431,
29898,
8391,
29918,
1491,
8771,
414,
29897,
1405,
29871,
29900,
29901,
30004,
13,
4706,
18668,
29918,
21513,
29918,
517,
29918,
1484,
353,
5159,
30004,
13,
4706,
363,
338,
29888,
29892,
18668,
297,
26985,
29898,
1491,
12083,
29918,
21513,
29961,
361,
1025,
29962,
1125,
30004,
13,
9651,
18668,
29918,
9303,
353,
18668,
29961,
29900,
1822,
5451,
11219,
1495,
30004,
13,
9651,
565,
18668,
29918,
9303,
14352,
29896,
29962,
297,
4629,
29918,
1491,
8771,
414,
29901,
30004,
13,
18884,
18668,
29918,
21513,
29918,
517,
29918,
1484,
29889,
4397,
29898,
4668,
8443,
13,
1678,
1683,
29901,
30004,
13,
4706,
18668,
29918,
21513,
29918,
517,
29918,
1484,
353,
1014,
12083,
29918,
21513,
29961,
361,
1025,
29962,
30004,
13,
30004,
13,
1678,
363,
338,
29888,
29892,
18668,
297,
26985,
29898,
4668,
29918,
21513,
29918,
517,
29918,
1484,
1125,
30004,
13,
4706,
18668,
29918,
9303,
353,
18668,
29961,
29900,
1822,
5451,
11219,
1495,
30004,
13,
4706,
1596,
29898,
4668,
29918,
9303,
14352,
29896,
2314,
30004,
13,
4706,
565,
18668,
29918,
9303,
14352,
29896,
3816,
29900,
29962,
2804,
525,
29886,
2396,
30004,
13,
9651,
12020,
7865,
2392,
703,
1252,
6021,
1014,
12083,
1024,
304,
1369,
411,
421,
29886,
1673,
297,
6571,
1642,
4830,
29898,
29888,
978,
876,
30004,
13,
4706,
1480,
29918,
1272,
353,
1303,
29918,
1188,
29898,
4668,
29961,
29900,
2314,
30004,
13,
4706,
6756,
13,
4706,
4138,
29918,
978,
353,
4138,
29889,
5451,
11219,
1495,
14352,
29896,
29962,
30004,
13,
4706,
565,
18668,
29961,
29900,
3816,
29899,
29896,
29962,
1275,
8207,
2396,
30004,
13,
9651,
18668,
29961,
29900,
29962,
353,
18668,
29961,
29900,
3816,
13018,
29896,
29962,
30004,
13,
4706,
18668,
29918,
978,
353,
18668,
29961,
29900,
1822,
5451,
11219,
1495,
14352,
29896,
29962,
30004,
13,
4706,
6756,
13,
4706,
396,
6359,
360,
29916,
24526,
7186,
402,
2735,
515,
278,
869,
4130,
934,
30004,
13,
4706,
396,
29928,
29916,
29928,
29891,
29918,
1272,
353,
11117,
29928,
29916,
29918,
2749,
2396,
29928,
29916,
29918,
2749,
29892,
525,
29928,
29891,
29918,
2749,
2396,
29928,
29891,
29918,
2749,
29892,
525,
29928,
29916,
29918,
2749,
29918,
29887,
11214,
2396,
360,
29916,
29918,
2749,
29930,
4912,
29906,
29879,
29918,
13441,
29892,
525,
29928,
29891,
29918,
2749,
29918,
29887,
11214,
2396,
29928,
29891,
29918,
2749,
29930,
4912,
29906,
29879,
29918,
13441,
29892,
320,
30004,
13,
4706,
396,
9651,
525,
4283,
29918,
2749,
2396,
4283,
29918,
2749,
29892,
525,
4283,
29918,
12352,
29918,
2749,
2396,
4283,
29918,
12352,
29918,
2749,
8117,
13,
4706,
7477,
29918,
20227,
29918,
710,
353,
525,
4912,
29918,
20227,
29915,
30004,
13,
4706,
411,
1722,
29898,
4668,
29961,
29900,
29962,
718,
8207,
29928,
29916,
29928,
29891,
29918,
1272,
29918,
29915,
718,
7477,
29918,
20227,
29918,
710,
718,
22868,
29915,
718,
18668,
29918,
978,
718,
22868,
29915,
718,
4138,
29918,
978,
718,
15300,
4130,
742,
525,
29878,
1495,
408,
14336,
29901,
30004,
13,
9651,
360,
29916,
29928,
29891,
29918,
1272,
353,
5839,
280,
29889,
1359,
29898,
600,
8443,
13,
4706,
360,
29916,
29918,
2749,
353,
360,
29916,
29928,
29891,
29918,
1272,
1839,
29928,
29916,
29918,
2749,
2033,
30004,
13,
4706,
24526,
29918,
2749,
353,
360,
29916,
29928,
29891,
29918,
1272,
1839,
29928,
29891,
29918,
2749,
2033,
30004,
13,
4706,
330,
2735,
29918,
12352,
29918,
2749,
353,
360,
29916,
29928,
29891,
29918,
1272,
1839,
4283,
29918,
12352,
29918,
2749,
2033,
30004,
13,
4706,
396,
15154,
3291,
988,
330,
2735,
1405,
330,
2735,
29918,
29883,
30004,
13,
4706,
20102,
29918,
513,
353,
7442,
29889,
3062,
29898,
4283,
29918,
12352,
29918,
2749,
529,
330,
2735,
29918,
29883,
9601,
29900,
29962,
30004,
13,
4706,
360,
29916,
29918,
2749,
29918,
24049,
353,
360,
29916,
29918,
2749,
29961,
24049,
29918,
513,
29962,
30004,
13,
4706,
24526,
29918,
2749,
29918,
24049,
353,
24526,
29918,
2749,
29961,
24049,
29918,
513,
29962,
30004,
13,
4706,
330,
2735,
29918,
2749,
29918,
24049,
353,
330,
2735,
29918,
12352,
29918,
2749,
29961,
24049,
29918,
513,
29962,
30004,
13,
30004,
13,
4706,
1596,
877,
29928,
29916,
29918,
2749,
353,
6571,
4286,
4830,
29898,
29928,
29916,
29918,
2749,
29918,
24049,
876,
30004,
13,
4706,
1596,
877,
29928,
29891,
29918,
2749,
353,
6571,
4286,
4830,
29898,
29928,
29891,
29918,
2749,
29918,
24049,
876,
30004,
13,
4706,
444,
1275,
9166,
9166,
9166,
9166,
2751,
30004,
13,
4706,
444,
18399,
360,
29916,
29892,
29928,
29891,
7186,
11828,
402,
313,
15807,
630,
515,
848,
3265,
769,
1303,
515,
278,
1480,
8443,
13,
4706,
396,
297,
22477,
10340,
30004,
13,
462,
1678,
6756,
13,
4706,
9775,
761,
609,
353,
29871,
29906,
29947,
30004,
13,
4706,
16892,
5657,
353,
9775,
761,
609,
448,
29871,
29946,
30004,
13,
4706,
15983,
5657,
353,
9775,
761,
609,
448,
29871,
29946,
30004,
13,
4706,
7477,
29906,
29879,
29918,
13441,
353,
5190,
29918,
29928,
1068,
29906,
29914,
5441,
29918,
29873,
29930,
29896,
29872,
29946,
30004,
13,
4706,
2537,
29892,
4853,
29896,
29871,
353,
14770,
29889,
1491,
26762,
29898,
29896,
29892,
29896,
29892,
2537,
2311,
7607,
29955,
29892,
29953,
876,
30004,
13,
4706,
14801,
29896,
353,
4853,
29896,
29889,
1557,
2620,
29898,
4283,
29918,
2749,
29918,
24049,
29892,
7442,
29889,
1188,
29898,
29928,
29916,
29918,
2749,
29918,
24049,
29930,
4912,
29906,
29879,
29918,
13441,
511,
3858,
2433,
29938,
29928,
29918,
1966,
24598,
29938,
742,
2927,
353,
525,
12692,
742,
17456,
2433,
29877,
1495,
30004,
13,
4706,
4853,
29896,
29889,
842,
29918,
29916,
1643,
877,
29938,
1966,
6642,
29938,
742,
4079,
2311,
29922,
8205,
761,
609,
8443,
13,
4706,
4853,
29896,
29889,
842,
29918,
29891,
1643,
877,
29938,
1966,
1188,
29898,
29928,
29914,
29928,
29918,
29900,
1262,
742,
4079,
2311,
29922,
8205,
761,
609,
8443,
13,
4706,
14801,
29906,
353,
4853,
29896,
29889,
1557,
2620,
29898,
4283,
29918,
2749,
29918,
24049,
29892,
7442,
29889,
1188,
29898,
29928,
29891,
29918,
2749,
29918,
24049,
29930,
4912,
29906,
29879,
29918,
13441,
511,
3858,
2433,
29938,
29928,
29918,
1966,
23482,
29938,
742,
2927,
353,
525,
1127,
742,
17456,
2433,
29879,
1495,
30004,
13,
4706,
396,
1165,
29896,
29889,
842,
29918,
29916,
2576,
4197,
9302,
29889,
1195,
29898,
4283,
29918,
12352,
29918,
2749,
29897,
448,
29871,
29906,
29892,
7442,
29889,
3317,
29898,
4283,
29918,
12352,
29918,
2749,
29897,
718,
29871,
29906,
2314,
30004,
13,
4706,
4853,
29896,
29889,
26172,
29898,
2029,
29922,
29896,
29892,
4079,
2311,
29922,
26172,
5657,
8443,
13,
4706,
6756,
13,
4706,
4853,
29896,
29889,
24667,
29918,
7529,
29898,
1643,
2311,
29922,
16892,
5657,
8443,
13,
4706,
4853,
29896,
29889,
2029,
1061,
29918,
7529,
29898,
9877,
1144,
29922,
29953,
29892,
9685,
2433,
29891,
1495,
30004,
13,
30004,
13,
4706,
883,
2620,
353,
286,
29873,
6541,
29889,
29636,
279,
18522,
29898,
1509,
11309,
1626,
29922,
5574,
8443,
13,
4706,
883,
2620,
29889,
842,
29918,
13519,
12514,
3552,
29899,
29941,
29892,
29906,
876,
30004,
13,
4706,
4853,
29896,
29889,
29891,
8990,
29889,
842,
29918,
21355,
29918,
689,
2620,
29898,
689,
2620,
8443,
13,
4706,
6756,
13,
4706,
396,
22150,
1426,
30004,
13,
4706,
565,
1510,
29918,
726,
29901,
30004,
13,
9651,
1426,
29918,
1761,
353,
6024,
29938,
1966,
6642,
29918,
29883,
353,
12365,
29889,
29896,
29888,
1042,
4286,
4830,
29898,
4283,
29918,
29883,
4638,
30004,
13,
9651,
343,
29918,
2576,
353,
4853,
29896,
29889,
657,
29918,
29891,
2576,
26471,
13,
9651,
921,
29918,
2576,
353,
4853,
29896,
29889,
657,
29918,
29916,
2576,
26471,
13,
9651,
298,
353,
343,
29918,
2576,
29961,
29896,
29962,
448,
343,
29918,
2576,
29961,
29900,
29962,
30004,
13,
9651,
281,
353,
921,
29918,
2576,
29961,
29896,
29962,
448,
921,
29918,
2576,
29961,
29900,
29962,
30004,
13,
9651,
1426,
29918,
29916,
353,
921,
29918,
2576,
29961,
29900,
29962,
718,
29871,
29900,
29889,
29945,
29930,
29893,
30004,
13,
9651,
1426,
29918,
29891,
353,
343,
29918,
2576,
29961,
29896,
29962,
448,
29871,
29900,
29889,
29900,
29945,
29930,
29882,
30004,
13,
9651,
565,
1134,
29898,
726,
29918,
1761,
29897,
1275,
1051,
29901,
6756,
13,
18884,
302,
29918,
710,
353,
7431,
29898,
726,
29918,
1761,
8443,
13,
18884,
363,
474,
29918,
1003,
297,
3464,
29898,
29876,
29918,
710,
1125,
30004,
13,
462,
1678,
4853,
29896,
29889,
726,
29898,
726,
29918,
29916,
29892,
1426,
29918,
29891,
448,
29871,
29900,
29889,
29900,
29945,
29930,
29882,
29930,
29875,
29918,
1003,
29892,
1426,
29918,
1761,
29961,
29875,
29918,
1003,
2314,
30004,
13,
9651,
25342,
1134,
29898,
726,
29918,
1761,
29897,
1275,
851,
29901,
30004,
13,
18884,
4853,
29896,
29889,
726,
29898,
726,
29918,
29916,
29892,
1426,
29918,
29891,
29892,
1426,
29918,
1761,
8443,
13,
9651,
1683,
29901,
30004,
13,
18884,
12020,
20948,
877,
726,
29918,
1761,
1818,
367,
263,
1051,
310,
6031,
470,
263,
1347,
1495,
30004,
13,
30004,
13,
4706,
6756,
13,
4706,
6756,
13,
4706,
6756,
13,
4706,
396,
1003,
29889,
5041,
29889,
842,
29918,
2312,
29898,
2312,
29922,
29896,
8443,
13,
4706,
14770,
29889,
29873,
523,
29918,
2680,
26471,
13,
4706,
2537,
29889,
7620,
1003,
29898,
12083,
718,
8207,
29915,
718,
525,
29928,
29916,
29928,
29891,
29918,
29954,
29918,
1188,
29918,
29915,
718,
18668,
29918,
978,
718,
22868,
29915,
718,
4138,
29918,
978,
29871,
718,
525,
648,
29901,
29889,
29906,
29888,
29913,
4286,
4830,
29898,
4283,
29918,
29883,
29897,
718,
15300,
5140,
1495,
30004,
13,
4706,
396,
1003,
29889,
7620,
1003,
29898,
4668,
29961,
29900,
29962,
718,
8207,
29915,
718,
525,
29928,
29916,
29928,
29891,
29918,
7999,
600,
29918,
29915,
718,
7477,
29918,
20227,
29918,
710,
718,
22868,
29915,
718,
18668,
29918,
978,
718,
22868,
29915,
718,
4138,
29918,
978,
29871,
718,
15300,
2732,
1495,
30004,
13,
4706,
396,
1003,
29889,
7620,
1003,
29898,
4668,
29961,
29900,
29962,
718,
8207,
29915,
718,
525,
29928,
29916,
29928,
29891,
29918,
7999,
600,
29918,
29915,
718,
7477,
29918,
20227,
29918,
710,
718,
22868,
29915,
718,
18668,
29918,
978,
718,
22868,
29915,
718,
4138,
29918,
978,
29871,
718,
15300,
8961,
1495,
30004,
13,
4706,
396,
1003,
29889,
7620,
1003,
29898,
4668,
29961,
29900,
29962,
718,
8207,
29915,
718,
525,
29928,
29916,
29928,
29891,
29918,
7999,
600,
29918,
29915,
718,
7477,
29918,
20227,
29918,
710,
718,
22868,
29915,
718,
18668,
29918,
978,
718,
22868,
29915,
718,
4138,
29918,
978,
29871,
718,
15300,
5140,
1495,
30004,
13,
4706,
14770,
29889,
5358,
877,
497,
1495,
30004,
13,
4706,
6756,
13,
30004,
13,
30004,
13,
30004,
13,
2
] |
Week 8_activity/controller/__init__.py | Kenny-WilliamsStockdale/PythonPlay | 0 | 104926 | __all__ = ["DES"]
| [
1,
4770,
497,
1649,
353,
6796,
2287,
29903,
3108,
30004,
13,
2
] |
rpython/translator/platform/posix.py | wdv4758h/mu-client-pypy | 0 | 4850 | """Base support for POSIX-like platforms."""
import py, os, sys
from rpython.translator.platform import Platform, log, _run_subprocess
import rpython
rpydir = str(py.path.local(rpython.__file__).join('..'))
class BasePosix(Platform):
exe_ext = ''
make_cmd = 'make'
relevant_environ = ('CPATH', 'LIBRARY_PATH', 'C_INCLUDE_PATH')
DEFAULT_CC = 'gcc'
rpath_flags = ['-Wl,-rpath=\'$$ORIGIN/\'']
def __init__(self, cc=None):
self.cc = cc or os.environ.get('CC', self.DEFAULT_CC)
def _libs(self, libraries):
return ['-l%s' % lib for lib in libraries]
def _libdirs(self, library_dirs):
assert '' not in library_dirs
return ['-L%s' % ldir for ldir in library_dirs]
def _includedirs(self, include_dirs):
assert '' not in include_dirs
return ['-I%s' % idir for idir in include_dirs]
def _linkfiles(self, link_files):
return list(link_files)
def _compile_c_file(self, cc, cfile, compile_args):
oname = self._make_o_file(cfile, ext='o')
args = ['-c'] + compile_args + [str(cfile), '-o', str(oname)]
self._execute_c_compiler(cc, args, oname,
cwd=str(cfile.dirpath()))
return oname
def _link_args_from_eci(self, eci, standalone):
return Platform._link_args_from_eci(self, eci, standalone)
def _exportsymbols_link_flags(self):
if (self.cc == 'mingw32' or (self.cc== 'gcc' and os.name=='nt')
or sys.platform == 'cygwin'):
return ["-Wl,--export-all-symbols"]
return ["-Wl,--export-dynamic"]
def _link(self, cc, ofiles, link_args, standalone, exe_name):
args = [str(ofile) for ofile in ofiles] + link_args
args += ['-o', str(exe_name)]
if not standalone:
args = self._args_for_shared(args)
self._execute_c_compiler(cc, args, exe_name,
cwd=str(exe_name.dirpath()))
return exe_name
def _pkg_config(self, lib, opt, default, check_result_dir=False):
try:
ret, out, err = _run_subprocess("pkg-config", [lib, opt])
except OSError, e:
err = str(e)
ret = 1
if ret:
result = default
else:
# strip compiler flags
result = [entry[2:] for entry in out.split()]
#
if not result:
pass # if pkg-config explicitly returned nothing, then
# we assume it means no options are needed
elif check_result_dir:
# check that at least one of the results is a valid dir
for check in result:
if os.path.isdir(check):
break
else:
if ret:
msg = ("running 'pkg-config %s %s' failed:\n%s\n"
"and the default %r is not a valid directory" % (
lib, opt, err.rstrip(), default))
else:
msg = ("'pkg-config %s %s' returned no valid directory:\n"
"%s\n%s" % (lib, opt, out.rstrip(), err.rstrip()))
raise ValueError(msg)
return result
def get_rpath_flags(self, rel_libdirs):
# needed for cross-compilation i.e. ARM
return self.rpath_flags + ['-Wl,-rpath-link=\'%s\'' % ldir
for ldir in rel_libdirs]
def get_shared_only_compile_flags(self):
return tuple(self.shared_only) + ('-fvisibility=hidden',)
def gen_makefile(self, cfiles, eci, exe_name=None, path=None,
shared=False, headers_to_precompile=[],
no_precompile_cfiles = [], icon=None):
cfiles = self._all_cfiles(cfiles, eci)
if path is None:
path = cfiles[0].dirpath()
rpypath = py.path.local(rpydir)
if exe_name is None:
exe_name = cfiles[0].new(ext=self.exe_ext)
else:
exe_name = exe_name.new(ext=self.exe_ext)
linkflags = list(self.link_flags)
if shared:
linkflags = self._args_for_shared(linkflags)
linkflags += self._exportsymbols_link_flags()
if shared:
libname = exe_name.new(ext='').basename
target_name = 'lib' + exe_name.new(ext=self.so_ext).basename
else:
target_name = exe_name.basename
if shared:
cflags = tuple(self.cflags) + self.get_shared_only_compile_flags()
else:
cflags = tuple(self.cflags) + tuple(self.standalone_only)
m = GnuMakefile(path)
m.exe_name = path.join(exe_name.basename)
m.eci = eci
def rpyrel(fpath):
lpath = py.path.local(fpath)
rel = lpath.relto(rpypath)
if rel:
return os.path.join('$(RPYDIR)', rel)
# Hack: also relativize from the path '$RPYDIR/..'.
# Otherwise, when translating pypy, we get the paths in
# pypy/module/* that are kept as absolute, which makes the
# whole purpose of $RPYDIR rather pointless.
rel = lpath.relto(rpypath.join('..'))
if rel:
return os.path.join('$(RPYDIR)', '..', rel)
m_dir = m.makefile_dir
if m_dir == lpath:
return '.'
if m_dir.dirpath() == lpath:
return '..'
return fpath
rel_cfiles = [m.pathrel(cfile) for cfile in cfiles]
rel_ofiles = [rel_cfile[:rel_cfile.rfind('.')]+'.o' for rel_cfile in rel_cfiles]
m.cfiles = rel_cfiles
rel_includedirs = [rpyrel(incldir) for incldir in
self.preprocess_include_dirs(eci.include_dirs)]
rel_libdirs = [rpyrel(libdir) for libdir in
self.preprocess_library_dirs(eci.library_dirs)]
m.comment('automatically generated makefile')
definitions = [
('RPYDIR', '"%s"' % rpydir),
('TARGET', target_name),
('DEFAULT_TARGET', exe_name.basename),
('SOURCES', rel_cfiles),
('OBJECTS', rel_ofiles),
('LIBS', self._libs(eci.libraries) + list(self.extra_libs)),
('LIBDIRS', self._libdirs(rel_libdirs)),
('INCLUDEDIRS', self._includedirs(rel_includedirs)),
('CFLAGS', cflags),
('CFLAGSEXTRA', list(eci.compile_extra)),
('LDFLAGS', linkflags),
('LDFLAGS_LINK', list(self.link_flags)),
('LDFLAGSEXTRA', list(eci.link_extra)),
('CC', self.cc),
('CC_LINK', eci.use_cpp_linker and 'g++' or '$(CC)'),
('LINKFILES', eci.link_files),
('RPATH_FLAGS', self.get_rpath_flags(rel_libdirs)),
]
for args in definitions:
m.definition(*args)
rules = [
('all', '$(DEFAULT_TARGET)', []),
('$(TARGET)', '$(OBJECTS)', '$(CC_LINK) $(LDFLAGSEXTRA) -o $@ $(OBJECTS) $(LIBDIRS) $(LIBS) $(LINKFILES) $(LDFLAGS)'),
('%.o', '%.c', '$(CC) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'),
('%.o', '%.s', '$(CC) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'),
('%.o', '%.cxx', '$(CXX) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'),
]
for rule in rules:
m.rule(*rule)
if shared:
m.definition('SHARED_IMPORT_LIB', libname),
m.definition('PYPY_MAIN_FUNCTION', "pypy_main_startup")
m.rule('main.c', '',
'echo "'
'int $(PYPY_MAIN_FUNCTION)(int, char*[]); '
'int main(int argc, char* argv[]) '
'{ return $(PYPY_MAIN_FUNCTION)(argc, argv); }" > $@')
m.rule('$(DEFAULT_TARGET)', ['$(TARGET)', 'main.o'],
'$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) -o $@ $(RPATH_FLAGS)')
return m
def execute_makefile(self, path_to_makefile, extra_opts=[]):
if isinstance(path_to_makefile, GnuMakefile):
path = path_to_makefile.makefile_dir
else:
path = path_to_makefile
log.execute('make %s in %s' % (" ".join(extra_opts), path))
returncode, stdout, stderr = _run_subprocess(
self.make_cmd, ['-C', str(path)] + extra_opts)
self._handle_error(returncode, stdout, stderr, path.join('make'))
class Definition(object):
def __init__(self, name, value):
self.name = name
self.value = value
def write(self, f):
def write_list(prefix, lst):
lst = lst or ['']
for i, fn in enumerate(lst):
fn = fn.replace('\\', '\\\\')
print >> f, prefix, fn,
if i < len(lst)-1:
print >> f, '\\'
else:
print >> f
prefix = ' ' * len(prefix)
name, value = self.name, self.value
if isinstance(value, str):
f.write('%s = %s\n' % (name, value.replace('\\', '\\\\')))
else:
write_list('%s =' % (name,), value)
f.write('\n')
class Rule(object):
def __init__(self, target, deps, body):
self.target = target
self.deps = deps
self.body = body
def write(self, f):
target, deps, body = self.target, self.deps, self.body
if isinstance(deps, str):
dep_s = deps
else:
dep_s = ' '.join(deps)
f.write('%s: %s\n' % (target, dep_s))
if isinstance(body, str):
f.write('\t%s\n' % body)
elif body:
f.write('\t%s\n' % '\n\t'.join(body))
f.write('\n')
class Comment(object):
def __init__(self, body):
self.body = body
def write(self, f):
f.write('# %s\n' % (self.body,))
class GnuMakefile(object):
def __init__(self, path=None):
self.defs = {}
self.lines = []
self.makefile_dir = py.path.local(path)
def pathrel(self, fpath):
if fpath.dirpath() == self.makefile_dir:
return fpath.basename
elif fpath.dirpath().dirpath() == self.makefile_dir.dirpath():
assert fpath.relto(self.makefile_dir.dirpath()), (
"%r should be relative to %r" % (
fpath, self.makefile_dir.dirpath()))
path = '../' + fpath.relto(self.makefile_dir.dirpath())
return path.replace('\\', '/')
else:
return str(fpath)
def definition(self, name, value):
defs = self.defs
defn = Definition(name, value)
if name in defs:
self.lines[defs[name]] = defn
else:
defs[name] = len(self.lines)
self.lines.append(defn)
def rule(self, target, deps, body):
self.lines.append(Rule(target, deps, body))
def comment(self, body):
self.lines.append(Comment(body))
def write(self, out=None):
if out is None:
f = self.makefile_dir.join('Makefile').open('w')
else:
f = out
for line in self.lines:
line.write(f)
f.flush()
if out is None:
f.close()
| [
1,
9995,
5160,
2304,
363,
349,
3267,
6415,
29899,
4561,
21796,
1213,
15945,
13,
13,
5215,
11451,
29892,
2897,
29892,
10876,
13,
13,
3166,
364,
4691,
29889,
3286,
29880,
1061,
29889,
12120,
1053,
28096,
29892,
1480,
29892,
903,
3389,
29918,
1491,
5014,
13,
13,
5215,
364,
4691,
13,
29878,
2272,
3972,
353,
851,
29898,
2272,
29889,
2084,
29889,
2997,
29898,
29878,
4691,
17255,
1445,
1649,
467,
7122,
877,
636,
8785,
13,
13,
1990,
7399,
9135,
861,
29898,
21889,
1125,
13,
1678,
429,
29872,
29918,
1062,
353,
6629,
13,
1678,
1207,
29918,
9006,
353,
525,
5675,
29915,
13,
13,
1678,
8018,
29918,
21813,
353,
6702,
6271,
7534,
742,
525,
5265,
15176,
19926,
29918,
10145,
742,
525,
29907,
29918,
1177,
6154,
29965,
2287,
29918,
10145,
1495,
13,
13,
1678,
22236,
29918,
4174,
353,
525,
19644,
29915,
13,
1678,
364,
2084,
29918,
15764,
353,
6024,
29899,
29956,
29880,
6653,
29878,
2084,
2013,
29915,
3997,
1955,
6259,
1177,
7998,
29915,
2033,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
21759,
29922,
8516,
1125,
13,
4706,
1583,
29889,
617,
353,
21759,
470,
2897,
29889,
21813,
29889,
657,
877,
4174,
742,
1583,
29889,
23397,
29918,
4174,
29897,
13,
13,
1678,
822,
903,
10254,
29898,
1311,
29892,
9562,
1125,
13,
4706,
736,
6024,
29899,
29880,
29995,
29879,
29915,
1273,
4303,
363,
4303,
297,
9562,
29962,
13,
13,
1678,
822,
903,
1982,
3972,
29879,
29898,
1311,
29892,
3489,
29918,
3972,
29879,
1125,
13,
4706,
4974,
6629,
451,
297,
3489,
29918,
3972,
29879,
13,
4706,
736,
6024,
29899,
29931,
29995,
29879,
29915,
1273,
301,
3972,
363,
301,
3972,
297,
3489,
29918,
3972,
29879,
29962,
13,
13,
1678,
822,
903,
11707,
287,
12935,
29898,
1311,
29892,
3160,
29918,
3972,
29879,
1125,
13,
4706,
4974,
6629,
451,
297,
3160,
29918,
3972,
29879,
13,
4706,
736,
6024,
29899,
29902,
29995,
29879,
29915,
1273,
1178,
381,
363,
1178,
381,
297,
3160,
29918,
3972,
29879,
29962,
13,
13,
1678,
822,
903,
2324,
5325,
29898,
1311,
29892,
1544,
29918,
5325,
1125,
13,
4706,
736,
1051,
29898,
2324,
29918,
5325,
29897,
13,
13,
1678,
822,
903,
12198,
29918,
29883,
29918,
1445,
29898,
1311,
29892,
21759,
29892,
274,
1445,
29892,
6633,
29918,
5085,
1125,
13,
4706,
373,
420,
353,
1583,
3032,
5675,
29918,
29877,
29918,
1445,
29898,
29883,
1445,
29892,
1294,
2433,
29877,
1495,
13,
4706,
6389,
353,
6024,
29899,
29883,
2033,
718,
6633,
29918,
5085,
718,
518,
710,
29898,
29883,
1445,
511,
17411,
29877,
742,
851,
29898,
265,
420,
4638,
13,
4706,
1583,
3032,
7978,
29918,
29883,
29918,
21789,
29898,
617,
29892,
6389,
29892,
373,
420,
29892,
13,
462,
462,
274,
9970,
29922,
710,
29898,
29883,
1445,
29889,
3972,
2084,
22130,
13,
4706,
736,
373,
420,
13,
13,
1678,
822,
903,
2324,
29918,
5085,
29918,
3166,
29918,
29872,
455,
29898,
1311,
29892,
321,
455,
29892,
2317,
18785,
1125,
13,
4706,
736,
28096,
3032,
2324,
29918,
5085,
29918,
3166,
29918,
29872,
455,
29898,
1311,
29892,
321,
455,
29892,
2317,
18785,
29897,
13,
13,
1678,
822,
903,
26500,
2789,
29879,
29918,
2324,
29918,
15764,
29898,
1311,
1125,
13,
4706,
565,
313,
1311,
29889,
617,
1275,
525,
4056,
29893,
29941,
29906,
29915,
470,
313,
1311,
29889,
617,
1360,
525,
19644,
29915,
322,
2897,
29889,
978,
1360,
29915,
593,
1495,
13,
18884,
470,
10876,
29889,
12120,
1275,
525,
1270,
29887,
5080,
29374,
13,
9651,
736,
6796,
29899,
29956,
29880,
7839,
15843,
29899,
497,
29899,
18098,
29879,
3108,
13,
4706,
736,
6796,
29899,
29956,
29880,
7839,
15843,
29899,
16626,
3108,
13,
13,
1678,
822,
903,
2324,
29898,
1311,
29892,
21759,
29892,
310,
5475,
29892,
1544,
29918,
5085,
29892,
2317,
18785,
29892,
429,
29872,
29918,
978,
1125,
13,
4706,
6389,
353,
518,
710,
29898,
974,
488,
29897,
363,
310,
488,
297,
310,
5475,
29962,
718,
1544,
29918,
5085,
13,
4706,
6389,
4619,
6024,
29899,
29877,
742,
851,
29898,
8097,
29918,
978,
4638,
13,
4706,
565,
451,
2317,
18785,
29901,
13,
9651,
6389,
353,
1583,
3032,
5085,
29918,
1454,
29918,
12366,
29898,
5085,
29897,
13,
4706,
1583,
3032,
7978,
29918,
29883,
29918,
21789,
29898,
617,
29892,
6389,
29892,
429,
29872,
29918,
978,
29892,
13,
462,
462,
274,
9970,
29922,
710,
29898,
8097,
29918,
978,
29889,
3972,
2084,
22130,
13,
4706,
736,
429,
29872,
29918,
978,
13,
13,
1678,
822,
903,
15865,
29918,
2917,
29898,
1311,
29892,
4303,
29892,
3523,
29892,
2322,
29892,
1423,
29918,
2914,
29918,
3972,
29922,
8824,
1125,
13,
4706,
1018,
29901,
13,
9651,
3240,
29892,
714,
29892,
4589,
353,
903,
3389,
29918,
1491,
5014,
703,
15865,
29899,
2917,
613,
518,
1982,
29892,
3523,
2314,
13,
4706,
5174,
438,
29173,
29892,
321,
29901,
13,
9651,
4589,
353,
851,
29898,
29872,
29897,
13,
9651,
3240,
353,
29871,
29896,
13,
4706,
565,
3240,
29901,
13,
9651,
1121,
353,
2322,
13,
4706,
1683,
29901,
13,
9651,
396,
17820,
6516,
13449,
13,
9651,
1121,
353,
518,
8269,
29961,
29906,
17531,
363,
6251,
297,
714,
29889,
5451,
580,
29962,
13,
4706,
396,
13,
4706,
565,
451,
1121,
29901,
13,
9651,
1209,
396,
565,
282,
9415,
29899,
2917,
9479,
4133,
3078,
29892,
769,
13,
462,
396,
591,
5251,
372,
2794,
694,
3987,
526,
4312,
13,
4706,
25342,
1423,
29918,
2914,
29918,
3972,
29901,
13,
9651,
396,
1423,
393,
472,
3203,
697,
310,
278,
2582,
338,
263,
2854,
4516,
13,
9651,
363,
1423,
297,
1121,
29901,
13,
18884,
565,
2897,
29889,
2084,
29889,
275,
3972,
29898,
3198,
1125,
13,
462,
1678,
2867,
13,
9651,
1683,
29901,
13,
18884,
565,
3240,
29901,
13,
462,
1678,
10191,
353,
4852,
21094,
525,
15865,
29899,
2917,
1273,
29879,
1273,
29879,
29915,
5229,
3583,
29876,
29995,
29879,
29905,
29876,
29908,
13,
462,
965,
376,
392,
278,
2322,
1273,
29878,
338,
451,
263,
2854,
3884,
29908,
1273,
313,
13,
462,
4706,
4303,
29892,
3523,
29892,
4589,
29889,
29878,
17010,
3285,
2322,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
10191,
353,
4852,
29915,
15865,
29899,
2917,
1273,
29879,
1273,
29879,
29915,
4133,
694,
2854,
3884,
3583,
29876,
29908,
13,
462,
965,
11860,
29879,
29905,
29876,
29995,
29879,
29908,
1273,
313,
1982,
29892,
3523,
29892,
714,
29889,
29878,
17010,
3285,
4589,
29889,
29878,
17010,
22130,
13,
18884,
12020,
7865,
2392,
29898,
7645,
29897,
13,
4706,
736,
1121,
13,
13,
1678,
822,
679,
29918,
29878,
2084,
29918,
15764,
29898,
1311,
29892,
1104,
29918,
1982,
3972,
29879,
1125,
13,
4706,
396,
4312,
363,
4891,
29899,
2388,
8634,
474,
29889,
29872,
29889,
9033,
29924,
13,
4706,
736,
1583,
29889,
29878,
2084,
29918,
15764,
718,
6024,
29899,
29956,
29880,
6653,
29878,
2084,
29899,
2324,
2013,
29915,
29995,
29879,
29905,
4907,
1273,
301,
3972,
13,
462,
462,
1678,
363,
301,
3972,
297,
1104,
29918,
1982,
3972,
29879,
29962,
13,
13,
1678,
822,
679,
29918,
12366,
29918,
6194,
29918,
12198,
29918,
15764,
29898,
1311,
1125,
13,
4706,
736,
18761,
29898,
1311,
29889,
12366,
29918,
6194,
29897,
718,
6702,
29899,
29888,
28814,
29922,
10892,
742,
29897,
13,
13,
1678,
822,
2531,
29918,
5675,
1445,
29898,
1311,
29892,
274,
5325,
29892,
321,
455,
29892,
429,
29872,
29918,
978,
29922,
8516,
29892,
2224,
29922,
8516,
29892,
13,
462,
268,
7258,
29922,
8824,
29892,
9066,
29918,
517,
29918,
1457,
12198,
11759,
1402,
13,
462,
268,
694,
29918,
1457,
12198,
29918,
29883,
5325,
353,
19997,
9849,
29922,
8516,
1125,
13,
4706,
274,
5325,
353,
1583,
3032,
497,
29918,
29883,
5325,
29898,
29883,
5325,
29892,
321,
455,
29897,
13,
13,
4706,
565,
2224,
338,
6213,
29901,
13,
9651,
2224,
353,
274,
5325,
29961,
29900,
1822,
3972,
2084,
580,
13,
13,
4706,
364,
29886,
1478,
493,
353,
11451,
29889,
2084,
29889,
2997,
29898,
29878,
2272,
3972,
29897,
13,
13,
4706,
565,
429,
29872,
29918,
978,
338,
6213,
29901,
13,
9651,
429,
29872,
29918,
978,
353,
274,
5325,
29961,
29900,
1822,
1482,
29898,
1062,
29922,
1311,
29889,
8097,
29918,
1062,
29897,
13,
4706,
1683,
29901,
13,
9651,
429,
29872,
29918,
978,
353,
429,
29872,
29918,
978,
29889,
1482,
29898,
1062,
29922,
1311,
29889,
8097,
29918,
1062,
29897,
13,
13,
4706,
1544,
15764,
353,
1051,
29898,
1311,
29889,
2324,
29918,
15764,
29897,
13,
4706,
565,
7258,
29901,
13,
9651,
1544,
15764,
353,
1583,
3032,
5085,
29918,
1454,
29918,
12366,
29898,
2324,
15764,
29897,
13,
13,
4706,
1544,
15764,
4619,
1583,
3032,
26500,
2789,
29879,
29918,
2324,
29918,
15764,
580,
13,
13,
4706,
565,
7258,
29901,
13,
9651,
4303,
978,
353,
429,
29872,
29918,
978,
29889,
1482,
29898,
1062,
2433,
2824,
6500,
3871,
13,
9651,
3646,
29918,
978,
353,
525,
1982,
29915,
718,
429,
29872,
29918,
978,
29889,
1482,
29898,
1062,
29922,
1311,
29889,
578,
29918,
1062,
467,
6500,
3871,
13,
4706,
1683,
29901,
13,
9651,
3646,
29918,
978,
353,
429,
29872,
29918,
978,
29889,
6500,
3871,
13,
13,
4706,
565,
7258,
29901,
13,
9651,
274,
15764,
353,
18761,
29898,
1311,
29889,
29883,
15764,
29897,
718,
1583,
29889,
657,
29918,
12366,
29918,
6194,
29918,
12198,
29918,
15764,
580,
13,
4706,
1683,
29901,
13,
9651,
274,
15764,
353,
18761,
29898,
1311,
29889,
29883,
15764,
29897,
718,
18761,
29898,
1311,
29889,
1689,
18785,
29918,
6194,
29897,
13,
13,
4706,
286,
353,
402,
3433,
9984,
1445,
29898,
2084,
29897,
13,
4706,
286,
29889,
8097,
29918,
978,
353,
2224,
29889,
7122,
29898,
8097,
29918,
978,
29889,
6500,
3871,
29897,
13,
4706,
286,
29889,
29872,
455,
353,
321,
455,
13,
13,
4706,
822,
364,
2272,
2674,
29898,
29888,
2084,
1125,
13,
9651,
301,
2084,
353,
11451,
29889,
2084,
29889,
2997,
29898,
29888,
2084,
29897,
13,
9651,
1104,
353,
301,
2084,
29889,
2674,
517,
29898,
19080,
1478,
493,
29897,
13,
9651,
565,
1104,
29901,
13,
18884,
736,
2897,
29889,
2084,
29889,
7122,
877,
12330,
29934,
20055,
9464,
29897,
742,
1104,
29897,
13,
9651,
396,
379,
547,
29901,
884,
14215,
675,
515,
278,
2224,
14180,
29934,
20055,
9464,
29914,
636,
4286,
13,
9651,
396,
13466,
29892,
746,
5578,
1218,
282,
1478,
29891,
29892,
591,
679,
278,
10898,
297,
13,
9651,
396,
282,
1478,
29891,
29914,
5453,
5515,
393,
526,
8126,
408,
8380,
29892,
607,
3732,
278,
13,
9651,
396,
3353,
6437,
310,
395,
29934,
20055,
9464,
3265,
1298,
2222,
29889,
13,
9651,
1104,
353,
301,
2084,
29889,
2674,
517,
29898,
19080,
1478,
493,
29889,
7122,
877,
636,
8785,
13,
9651,
565,
1104,
29901,
13,
18884,
736,
2897,
29889,
2084,
29889,
7122,
877,
12330,
29934,
20055,
9464,
29897,
742,
525,
636,
742,
1104,
29897,
13,
9651,
286,
29918,
3972,
353,
286,
29889,
5675,
1445,
29918,
3972,
13,
9651,
565,
286,
29918,
3972,
1275,
301,
2084,
29901,
13,
18884,
736,
525,
6169,
13,
9651,
565,
286,
29918,
3972,
29889,
3972,
2084,
580,
1275,
301,
2084,
29901,
13,
18884,
736,
525,
636,
29915,
13,
9651,
736,
285,
2084,
13,
13,
4706,
1104,
29918,
29883,
5325,
353,
518,
29885,
29889,
2084,
2674,
29898,
29883,
1445,
29897,
363,
274,
1445,
297,
274,
5325,
29962,
13,
4706,
1104,
29918,
974,
5475,
353,
518,
2674,
29918,
29883,
1445,
7503,
2674,
29918,
29883,
1445,
29889,
29878,
2886,
12839,
1495,
10062,
4286,
29877,
29915,
363,
1104,
29918,
29883,
1445,
297,
1104,
29918,
29883,
5325,
29962,
13,
4706,
286,
29889,
29883,
5325,
353,
1104,
29918,
29883,
5325,
13,
13,
4706,
1104,
29918,
11707,
287,
12935,
353,
518,
29878,
2272,
2674,
29898,
3742,
430,
381,
29897,
363,
5528,
430,
381,
297,
13,
462,
965,
1583,
29889,
1457,
5014,
29918,
2856,
29918,
3972,
29879,
29898,
29872,
455,
29889,
2856,
29918,
3972,
29879,
4638,
13,
4706,
1104,
29918,
1982,
3972,
29879,
353,
518,
29878,
2272,
2674,
29898,
1982,
3972,
29897,
363,
4303,
3972,
297,
13,
462,
539,
1583,
29889,
1457,
5014,
29918,
5258,
29918,
3972,
29879,
29898,
29872,
455,
29889,
5258,
29918,
3972,
29879,
4638,
13,
13,
4706,
286,
29889,
9342,
877,
17405,
19574,
5759,
1207,
1445,
1495,
13,
4706,
15848,
353,
518,
13,
9651,
6702,
29934,
20055,
9464,
742,
18793,
29995,
29879,
29908,
29915,
1273,
364,
2272,
3972,
511,
13,
9651,
6702,
29911,
1718,
7194,
742,
3646,
29918,
978,
511,
13,
9651,
6702,
23397,
29918,
29911,
1718,
7194,
742,
429,
29872,
29918,
978,
29889,
6500,
3871,
511,
13,
9651,
6702,
27839,
27266,
742,
1104,
29918,
29883,
5325,
511,
13,
9651,
6702,
14824,
17637,
29903,
742,
1104,
29918,
974,
5475,
511,
13,
9651,
6702,
5265,
9851,
742,
1583,
3032,
10254,
29898,
29872,
455,
29889,
492,
8464,
29897,
718,
1051,
29898,
1311,
29889,
17833,
29918,
10254,
8243,
13,
9651,
6702,
5265,
29933,
9464,
29903,
742,
1583,
3032,
1982,
3972,
29879,
29898,
2674,
29918,
1982,
3972,
29879,
8243,
13,
9651,
6702,
1177,
6154,
29965,
2287,
9464,
29903,
742,
1583,
3032,
11707,
287,
12935,
29898,
2674,
29918,
11707,
287,
12935,
8243,
13,
9651,
6702,
9207,
4375,
10749,
742,
274,
15764,
511,
13,
9651,
6702,
9207,
4375,
29954,
1660,
12188,
4717,
742,
1051,
29898,
29872,
455,
29889,
12198,
29918,
17833,
8243,
13,
9651,
6702,
29931,
4037,
4375,
10749,
742,
1544,
15764,
511,
13,
9651,
6702,
29931,
4037,
4375,
10749,
29918,
23714,
29968,
742,
1051,
29898,
1311,
29889,
2324,
29918,
15764,
8243,
13,
9651,
6702,
29931,
4037,
4375,
29954,
1660,
12188,
4717,
742,
1051,
29898,
29872,
455,
29889,
2324,
29918,
17833,
8243,
13,
9651,
6702,
4174,
742,
1583,
29889,
617,
511,
13,
9651,
6702,
4174,
29918,
23714,
29968,
742,
321,
455,
29889,
1509,
29918,
8223,
29918,
2324,
261,
322,
525,
29887,
1817,
29915,
470,
525,
12330,
4174,
29897,
5477,
13,
9651,
6702,
23714,
29968,
24483,
742,
321,
455,
29889,
2324,
29918,
5325,
511,
13,
9651,
6702,
29934,
10145,
29918,
18823,
10749,
742,
1583,
29889,
657,
29918,
29878,
2084,
29918,
15764,
29898,
2674,
29918,
1982,
3972,
29879,
8243,
13,
9651,
4514,
13,
4706,
363,
6389,
297,
15848,
29901,
13,
9651,
286,
29889,
16553,
10456,
5085,
29897,
13,
13,
4706,
6865,
353,
518,
13,
9651,
6702,
497,
742,
525,
12330,
23397,
29918,
29911,
1718,
7194,
29897,
742,
5159,
511,
13,
9651,
6702,
12330,
29911,
1718,
7194,
29897,
742,
525,
12330,
14824,
17637,
29903,
29897,
742,
525,
12330,
4174,
29918,
23714,
29968,
29897,
2427,
29931,
4037,
4375,
29954,
1660,
12188,
4717,
29897,
448,
29877,
395,
29992,
2427,
14824,
17637,
29903,
29897,
2427,
5265,
29933,
9464,
29903,
29897,
2427,
5265,
9851,
29897,
2427,
23714,
29968,
24483,
29897,
2427,
29931,
4037,
4375,
10749,
29897,
5477,
13,
9651,
6702,
15543,
29877,
742,
14210,
29889,
29883,
742,
525,
12330,
4174,
29897,
2427,
9207,
4375,
10749,
29897,
2427,
9207,
4375,
29954,
1660,
12188,
4717,
29897,
448,
29877,
395,
29992,
448,
29883,
395,
29966,
2427,
1177,
6154,
29965,
2287,
9464,
29903,
29897,
5477,
13,
9651,
6702,
15543,
29877,
742,
14210,
29889,
29879,
742,
525,
12330,
4174,
29897,
2427,
9207,
4375,
10749,
29897,
2427,
9207,
4375,
29954,
1660,
12188,
4717,
29897,
448,
29877,
395,
29992,
448,
29883,
395,
29966,
2427,
1177,
6154,
29965,
2287,
9464,
29903,
29897,
5477,
13,
9651,
6702,
15543,
29877,
742,
14210,
29889,
29883,
4419,
742,
525,
12330,
29907,
6247,
29897,
2427,
9207,
4375,
10749,
29897,
2427,
9207,
4375,
29954,
1660,
12188,
4717,
29897,
448,
29877,
395,
29992,
448,
29883,
395,
29966,
2427,
1177,
6154,
29965,
2287,
9464,
29903,
29897,
5477,
13,
9651,
4514,
13,
13,
4706,
363,
5751,
297,
6865,
29901,
13,
9651,
286,
29889,
7491,
10456,
7491,
29897,
13,
13,
4706,
565,
7258,
29901,
13,
9651,
286,
29889,
16553,
877,
23498,
19386,
29918,
29902,
3580,
8476,
29918,
5265,
29933,
742,
4303,
978,
511,
13,
9651,
286,
29889,
16553,
877,
20055,
20055,
29918,
29032,
29918,
29943,
28700,
742,
376,
29886,
1478,
29891,
29918,
3396,
29918,
2962,
786,
1159,
13,
9651,
286,
29889,
7491,
877,
3396,
29889,
29883,
742,
15516,
13,
462,
259,
525,
8057,
13577,
13,
462,
259,
525,
524,
2427,
20055,
20055,
29918,
29032,
29918,
29943,
28700,
5033,
524,
29892,
1373,
29930,
2636,
416,
525,
13,
462,
259,
525,
524,
1667,
29898,
524,
1852,
29883,
29892,
1373,
29930,
1852,
29894,
23076,
525,
13,
462,
259,
22372,
736,
2427,
20055,
20055,
29918,
29032,
29918,
29943,
28700,
5033,
1191,
29883,
29892,
1852,
29894,
416,
500,
29908,
1405,
395,
29992,
1495,
13,
9651,
286,
29889,
7491,
877,
12330,
23397,
29918,
29911,
1718,
7194,
29897,
742,
6024,
12330,
29911,
1718,
7194,
29897,
742,
525,
3396,
29889,
29877,
7464,
13,
462,
259,
525,
12330,
4174,
29918,
23714,
29968,
29897,
2427,
29931,
4037,
4375,
10749,
29918,
23714,
29968,
29897,
1667,
29889,
29877,
448,
29931,
29889,
448,
29880,
12330,
23498,
19386,
29918,
29902,
3580,
8476,
29918,
5265,
29933,
29897,
448,
29877,
395,
29992,
2427,
29934,
10145,
29918,
18823,
10749,
29897,
1495,
13,
13,
4706,
736,
286,
13,
13,
1678,
822,
6222,
29918,
5675,
1445,
29898,
1311,
29892,
2224,
29918,
517,
29918,
5675,
1445,
29892,
4805,
29918,
25707,
29922,
2636,
1125,
13,
4706,
565,
338,
8758,
29898,
2084,
29918,
517,
29918,
5675,
1445,
29892,
402,
3433,
9984,
1445,
1125,
13,
9651,
2224,
353,
2224,
29918,
517,
29918,
5675,
1445,
29889,
5675,
1445,
29918,
3972,
13,
4706,
1683,
29901,
13,
9651,
2224,
353,
2224,
29918,
517,
29918,
5675,
1445,
13,
4706,
1480,
29889,
7978,
877,
5675,
1273,
29879,
297,
1273,
29879,
29915,
1273,
4852,
11393,
7122,
29898,
17833,
29918,
25707,
511,
2224,
876,
13,
4706,
736,
401,
29892,
27591,
29892,
380,
20405,
353,
903,
3389,
29918,
1491,
5014,
29898,
13,
9651,
1583,
29889,
5675,
29918,
9006,
29892,
6024,
29899,
29907,
742,
851,
29898,
2084,
4638,
718,
4805,
29918,
25707,
29897,
13,
4706,
1583,
3032,
8411,
29918,
2704,
29898,
2457,
401,
29892,
27591,
29892,
380,
20405,
29892,
2224,
29889,
7122,
877,
5675,
8785,
13,
13,
1990,
21940,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1024,
29892,
995,
1125,
13,
4706,
1583,
29889,
978,
353,
1024,
13,
4706,
1583,
29889,
1767,
353,
995,
13,
13,
1678,
822,
2436,
29898,
1311,
29892,
285,
1125,
13,
4706,
822,
2436,
29918,
1761,
29898,
13506,
29892,
24471,
1125,
13,
9651,
24471,
353,
24471,
470,
6024,
2033,
13,
9651,
363,
474,
29892,
7876,
297,
26985,
29898,
20155,
1125,
13,
18884,
7876,
353,
7876,
29889,
6506,
877,
1966,
742,
525,
1966,
1966,
1495,
13,
18884,
1596,
5099,
285,
29892,
10944,
29892,
7876,
29892,
13,
18884,
565,
474,
529,
7431,
29898,
20155,
6817,
29896,
29901,
13,
462,
1678,
1596,
5099,
285,
29892,
525,
1966,
29915,
13,
18884,
1683,
29901,
13,
462,
1678,
1596,
5099,
285,
13,
18884,
10944,
353,
525,
525,
334,
7431,
29898,
13506,
29897,
13,
4706,
1024,
29892,
995,
353,
1583,
29889,
978,
29892,
1583,
29889,
1767,
13,
4706,
565,
338,
8758,
29898,
1767,
29892,
851,
1125,
13,
9651,
285,
29889,
3539,
877,
29995,
29879,
353,
1273,
29879,
29905,
29876,
29915,
1273,
313,
978,
29892,
995,
29889,
6506,
877,
1966,
742,
525,
1966,
1966,
29915,
4961,
13,
4706,
1683,
29901,
13,
9651,
2436,
29918,
1761,
877,
29995,
29879,
353,
29915,
1273,
313,
978,
29892,
511,
995,
29897,
13,
4706,
285,
29889,
3539,
28909,
29876,
1495,
13,
13,
1990,
27308,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3646,
29892,
316,
567,
29892,
3573,
1125,
13,
4706,
1583,
29889,
5182,
353,
3646,
13,
4706,
1583,
29889,
311,
567,
259,
353,
316,
567,
13,
4706,
1583,
29889,
2587,
259,
353,
3573,
13,
13,
1678,
822,
2436,
29898,
1311,
29892,
285,
1125,
13,
4706,
3646,
29892,
316,
567,
29892,
3573,
353,
1583,
29889,
5182,
29892,
1583,
29889,
311,
567,
29892,
1583,
29889,
2587,
13,
4706,
565,
338,
8758,
29898,
311,
567,
29892,
851,
1125,
13,
9651,
1401,
29918,
29879,
353,
316,
567,
13,
4706,
1683,
29901,
13,
9651,
1401,
29918,
29879,
353,
525,
15300,
7122,
29898,
311,
567,
29897,
13,
4706,
285,
29889,
3539,
877,
29995,
29879,
29901,
1273,
29879,
29905,
29876,
29915,
1273,
313,
5182,
29892,
1401,
29918,
29879,
876,
13,
4706,
565,
338,
8758,
29898,
2587,
29892,
851,
1125,
13,
9651,
285,
29889,
3539,
28909,
29873,
29995,
29879,
29905,
29876,
29915,
1273,
3573,
29897,
13,
4706,
25342,
3573,
29901,
13,
9651,
285,
29889,
3539,
28909,
29873,
29995,
29879,
29905,
29876,
29915,
1273,
11297,
29876,
29905,
29873,
4286,
7122,
29898,
2587,
876,
13,
4706,
285,
29889,
3539,
28909,
29876,
1495,
13,
13,
1990,
461,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3573,
1125,
13,
4706,
1583,
29889,
2587,
353,
3573,
13,
13,
1678,
822,
2436,
29898,
1311,
29892,
285,
1125,
13,
4706,
285,
29889,
3539,
14237,
1273,
29879,
29905,
29876,
29915,
1273,
313,
1311,
29889,
2587,
29892,
876,
13,
13,
1990,
402,
3433,
9984,
1445,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2224,
29922,
8516,
1125,
13,
4706,
1583,
29889,
1753,
29879,
353,
6571,
13,
4706,
1583,
29889,
9012,
353,
5159,
13,
4706,
1583,
29889,
5675,
1445,
29918,
3972,
353,
11451,
29889,
2084,
29889,
2997,
29898,
2084,
29897,
13,
13,
1678,
822,
2224,
2674,
29898,
1311,
29892,
285,
2084,
1125,
13,
4706,
565,
285,
2084,
29889,
3972,
2084,
580,
1275,
1583,
29889,
5675,
1445,
29918,
3972,
29901,
13,
9651,
736,
285,
2084,
29889,
6500,
3871,
13,
4706,
25342,
285,
2084,
29889,
3972,
2084,
2141,
3972,
2084,
580,
1275,
1583,
29889,
5675,
1445,
29918,
3972,
29889,
3972,
2084,
7295,
13,
9651,
4974,
285,
2084,
29889,
2674,
517,
29898,
1311,
29889,
5675,
1445,
29918,
3972,
29889,
3972,
2084,
25739,
313,
13,
18884,
11860,
29878,
881,
367,
6198,
304,
1273,
29878,
29908,
1273,
313,
13,
462,
1678,
285,
2084,
29892,
1583,
29889,
5675,
1445,
29918,
3972,
29889,
3972,
2084,
22130,
13,
9651,
2224,
353,
525,
6995,
29915,
718,
285,
2084,
29889,
2674,
517,
29898,
1311,
29889,
5675,
1445,
29918,
3972,
29889,
3972,
2084,
3101,
13,
9651,
736,
2224,
29889,
6506,
877,
1966,
742,
8207,
1495,
13,
4706,
1683,
29901,
13,
9651,
736,
851,
29898,
29888,
2084,
29897,
13,
13,
1678,
822,
5023,
29898,
1311,
29892,
1024,
29892,
995,
1125,
13,
4706,
822,
29879,
353,
1583,
29889,
1753,
29879,
13,
4706,
822,
29876,
353,
21940,
29898,
978,
29892,
995,
29897,
13,
4706,
565,
1024,
297,
822,
29879,
29901,
13,
9651,
1583,
29889,
9012,
29961,
1753,
29879,
29961,
978,
5262,
353,
822,
29876,
13,
4706,
1683,
29901,
13,
9651,
822,
29879,
29961,
978,
29962,
353,
7431,
29898,
1311,
29889,
9012,
29897,
13,
9651,
1583,
29889,
9012,
29889,
4397,
29898,
12262,
29897,
13,
13,
1678,
822,
5751,
29898,
1311,
29892,
3646,
29892,
316,
567,
29892,
3573,
1125,
13,
4706,
1583,
29889,
9012,
29889,
4397,
29898,
10740,
29898,
5182,
29892,
316,
567,
29892,
3573,
876,
13,
13,
1678,
822,
3440,
29898,
1311,
29892,
3573,
1125,
13,
4706,
1583,
29889,
9012,
29889,
4397,
29898,
20001,
29898,
2587,
876,
13,
13,
1678,
822,
2436,
29898,
1311,
29892,
714,
29922,
8516,
1125,
13,
4706,
565,
714,
338,
6213,
29901,
13,
9651,
285,
353,
1583,
29889,
5675,
1445,
29918,
3972,
29889,
7122,
877,
9984,
1445,
2824,
3150,
877,
29893,
1495,
13,
4706,
1683,
29901,
13,
9651,
285,
353,
714,
13,
4706,
363,
1196,
297,
1583,
29889,
9012,
29901,
13,
9651,
1196,
29889,
3539,
29898,
29888,
29897,
13,
4706,
285,
29889,
23126,
580,
13,
4706,
565,
714,
338,
6213,
29901,
13,
9651,
285,
29889,
5358,
580,
13,
2
] |
src/cobald/daemon/runners/trio_runner.py | thoto/cobald | 7 | 51972 | import trio
from functools import partial
from .base_runner import BaseRunner
from .async_tools import raise_return, AsyncExecution
class TrioRunner(BaseRunner):
"""Runner for coroutines with :py:mod:`trio`"""
flavour = trio
def __init__(self):
self._nursery = None
super().__init__()
def register_payload(self, payload):
super().register_payload(partial(raise_return, payload))
def run_payload(self, payload):
execution = AsyncExecution(payload)
super().register_payload(execution.coroutine)
return execution.wait()
def _run(self):
return trio.run(self._await_all)
async def _await_all(self):
"""Async component of _run"""
delay = 0.0
# we run a top-level nursery that automatically reaps/cancels for us
async with trio.open_nursery() as nursery:
while self.running.is_set():
await self._start_payloads(nursery=nursery)
await trio.sleep(delay)
delay = min(delay + 0.1, 1.0)
# cancel the scope to cancel all payloads
nursery.cancel_scope.cancel()
async def _start_payloads(self, nursery):
"""Start all queued payloads"""
with self._lock:
for coroutine in self._payloads:
nursery.start_soon(coroutine)
self._payloads.clear()
await trio.sleep(0)
| [
1,
1053,
3367,
29877,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
13,
13,
3166,
869,
3188,
29918,
27492,
1053,
7399,
16802,
13,
3166,
869,
12674,
29918,
8504,
1053,
12020,
29918,
2457,
29892,
20688,
20418,
13,
13,
13,
1990,
323,
5378,
16802,
29898,
5160,
16802,
1125,
13,
1678,
9995,
16802,
363,
1034,
449,
1475,
411,
584,
2272,
29901,
1545,
18078,
3626,
29877,
29952,
15945,
29908,
13,
13,
1678,
21054,
473,
353,
3367,
29877,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
29876,
332,
643,
29891,
353,
6213,
13,
4706,
2428,
2141,
1649,
2344,
1649,
580,
13,
13,
1678,
822,
6036,
29918,
23813,
29898,
1311,
29892,
20092,
1125,
13,
4706,
2428,
2141,
9573,
29918,
23813,
29898,
3846,
29898,
22692,
29918,
2457,
29892,
20092,
876,
13,
13,
1678,
822,
1065,
29918,
23813,
29898,
1311,
29892,
20092,
1125,
13,
4706,
8225,
353,
20688,
20418,
29898,
23813,
29897,
13,
4706,
2428,
2141,
9573,
29918,
23813,
29898,
22256,
29889,
2616,
449,
457,
29897,
13,
4706,
736,
8225,
29889,
10685,
580,
13,
13,
1678,
822,
903,
3389,
29898,
1311,
1125,
13,
4706,
736,
3367,
29877,
29889,
3389,
29898,
1311,
3032,
20675,
29918,
497,
29897,
13,
13,
1678,
7465,
822,
903,
20675,
29918,
497,
29898,
1311,
1125,
13,
4706,
9995,
8123,
4163,
310,
903,
3389,
15945,
29908,
13,
4706,
9055,
353,
29871,
29900,
29889,
29900,
13,
4706,
396,
591,
1065,
263,
2246,
29899,
5563,
5595,
643,
29891,
393,
6336,
337,
2547,
29914,
3068,
29883,
1379,
363,
502,
13,
4706,
7465,
411,
3367,
29877,
29889,
3150,
29918,
29876,
332,
643,
29891,
580,
408,
5595,
643,
29891,
29901,
13,
9651,
1550,
1583,
29889,
21094,
29889,
275,
29918,
842,
7295,
13,
18884,
7272,
1583,
3032,
2962,
29918,
10472,
18132,
29898,
29876,
332,
643,
29891,
29922,
29876,
332,
643,
29891,
29897,
13,
18884,
7272,
3367,
29877,
29889,
17059,
29898,
18829,
29897,
13,
18884,
9055,
353,
1375,
29898,
18829,
718,
29871,
29900,
29889,
29896,
29892,
29871,
29896,
29889,
29900,
29897,
13,
9651,
396,
12611,
278,
6874,
304,
12611,
599,
5146,
18132,
13,
9651,
5595,
643,
29891,
29889,
20713,
29918,
6078,
29889,
20713,
580,
13,
13,
1678,
7465,
822,
903,
2962,
29918,
10472,
18132,
29898,
1311,
29892,
5595,
643,
29891,
1125,
13,
4706,
9995,
4763,
599,
712,
6742,
5146,
18132,
15945,
29908,
13,
4706,
411,
1583,
3032,
908,
29901,
13,
9651,
363,
1034,
449,
457,
297,
1583,
3032,
10472,
18132,
29901,
13,
18884,
5595,
643,
29891,
29889,
2962,
29918,
578,
265,
29898,
2616,
449,
457,
29897,
13,
9651,
1583,
3032,
10472,
18132,
29889,
8551,
580,
13,
4706,
7272,
3367,
29877,
29889,
17059,
29898,
29900,
29897,
13,
2
] |
test/validators/test_string_validator.py | jmmease/ipyplotly | 8 | 145114 | import pytest
from ipyplotly.basevalidators import StringValidator
import numpy as np
# Fixtures
# --------
@pytest.fixture()
def validator():
return StringValidator('prop', 'parent')
@pytest.fixture()
def validator_values():
return StringValidator('prop', 'parent', values=['foo', 'BAR', ''])
@pytest.fixture()
def validator_no_blanks():
return StringValidator('prop', 'parent', no_blank=True)
@pytest.fixture
def validator_aok():
return StringValidator('prop', 'parent', array_ok=True)
@pytest.fixture
def validator_aok_values():
return StringValidator('prop', 'parent', values=['foo', 'BAR', '', 'baz'], array_ok=True)
@pytest.fixture()
def validator_no_blanks_aok():
return StringValidator('prop', 'parent', no_blank=True, array_ok=True)
# Array not ok
# ------------
# ### Acceptance ###
@pytest.mark.parametrize('val',
['bar', 'HELLO!!!', 'world!@#$%^&*()', ''])
def test_acceptance(val, validator: StringValidator):
assert validator.validate_coerce(val) == val
# ### Rejection by value ###
@pytest.mark.parametrize('val',
[(), [], [1, 2, 3], set(), np.nan, np.pi])
def test_rejection(val, validator: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator.validate_coerce(val)
assert 'Invalid value' in str(validation_failure.value)
# Valid values
# ------------
@pytest.mark.parametrize('val',
['foo', 'BAR', ''])
def test_acceptance_values(val, validator_values: StringValidator):
assert validator_values.validate_coerce(val) == val
@pytest.mark.parametrize('val',
['FOO', 'bar', 'other', '1234'])
def test_rejection_values(val, validator_values: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_values.validate_coerce(val)
assert 'Invalid value'.format(val=val) in str(validation_failure.value)
assert "['foo', 'BAR', '']" in str(validation_failure.value)
# ### No blanks ###
@pytest.mark.parametrize('val',
['bar', 'HELLO!!!', 'world!@#$%^&*()'])
def test_acceptance_no_blanks(val, validator_no_blanks: StringValidator):
assert validator_no_blanks.validate_coerce(val) == val
@pytest.mark.parametrize('val',
[''])
def test_rejection_no_blanks(val, validator_no_blanks: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_no_blanks.validate_coerce(val)
assert 'A non-empty string' in str(validation_failure.value)
# Array ok
# --------
# ### Acceptance ###
@pytest.mark.parametrize('val',
['foo', 'BAR', '', 'baz'])
def test_acceptance_aok_scalars(val, validator_aok: StringValidator):
assert validator_aok.validate_coerce(val) == val
@pytest.mark.parametrize('val',
['foo', ['foo'], np.array(['BAR', ''], dtype='object'), ['baz', 'baz', 'baz']])
def test_acceptance_aok_list(val, validator_aok: StringValidator):
coerce_val = validator_aok.validate_coerce(val)
if isinstance(val, (list, np.ndarray)):
assert np.array_equal(coerce_val, np.array(val, dtype=coerce_val.dtype))
else:
assert coerce_val == val
# ### Rejection by type ###
@pytest.mark.parametrize('val',
[['foo', ()], ['foo', 3, 4], [3, 2, 1]])
def test_rejection_aok(val, validator_aok: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_aok.validate_coerce(val)
assert 'Invalid element(s)' in str(validation_failure.value)
# ### Rejection by value ###
@pytest.mark.parametrize('val',
[['foo', 'bar'], ['3', '4'], ['BAR', 'BAR', 'hello!']])
def test_rejection_aok_values(val, validator_aok_values: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_aok_values.validate_coerce(val)
assert 'Invalid element(s)' in str(validation_failure.value)
# ### No blanks ###
@pytest.mark.parametrize('val',
['123', ['bar', 'HELLO!!!'], ['world!@#$%^&*()']])
def test_acceptance_no_blanks_aok(val, validator_no_blanks_aok: StringValidator):
coerce_val = validator_no_blanks_aok.validate_coerce(val)
if isinstance(val, (list, np.ndarray)):
assert np.array_equal(coerce_val, np.array(val, dtype=coerce_val.dtype))
else:
assert coerce_val == val
@pytest.mark.parametrize('val',
['', ['foo', 'bar', ''], ['']])
def test_rejection_no_blanks_aok(val, validator_no_blanks_aok: StringValidator):
with pytest.raises(ValueError) as validation_failure:
validator_no_blanks_aok.validate_coerce(val)
assert 'A non-empty string' in str(validation_failure.value)
| [
1,
1053,
11451,
1688,
13,
3166,
474,
2272,
5317,
368,
29889,
3188,
3084,
4097,
1053,
1714,
24204,
13,
5215,
12655,
408,
7442,
13,
13,
13,
29937,
383,
29875,
486,
1973,
13,
29937,
448,
26589,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
2854,
1061,
7295,
13,
1678,
736,
1714,
24204,
877,
7728,
742,
525,
3560,
1495,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
2854,
1061,
29918,
5975,
7295,
13,
1678,
736,
1714,
24204,
877,
7728,
742,
525,
3560,
742,
1819,
29922,
1839,
5431,
742,
525,
29933,
1718,
742,
525,
11287,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
7295,
13,
1678,
736,
1714,
24204,
877,
7728,
742,
525,
3560,
742,
694,
29918,
19465,
29922,
5574,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
13,
1753,
2854,
1061,
29918,
29874,
554,
7295,
13,
1678,
736,
1714,
24204,
877,
7728,
742,
525,
3560,
742,
1409,
29918,
554,
29922,
5574,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
13,
1753,
2854,
1061,
29918,
29874,
554,
29918,
5975,
7295,
13,
1678,
736,
1714,
24204,
877,
7728,
742,
525,
3560,
742,
1819,
29922,
1839,
5431,
742,
525,
29933,
1718,
742,
15516,
525,
27975,
7464,
1409,
29918,
554,
29922,
5574,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
7241,
15546,
580,
13,
1753,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29918,
29874,
554,
7295,
13,
1678,
736,
1714,
24204,
877,
7728,
742,
525,
3560,
742,
694,
29918,
19465,
29922,
5574,
29892,
1409,
29918,
554,
29922,
5574,
29897,
13,
13,
13,
29937,
4398,
451,
3431,
13,
29937,
448,
1378,
5634,
13,
29937,
835,
29848,
749,
835,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
1646,
742,
525,
9606,
2208,
29949,
21004,
742,
525,
11526,
29991,
29992,
29937,
29938,
29995,
29985,
29987,
29930,
580,
742,
525,
11287,
13,
1753,
1243,
29918,
16044,
749,
29898,
791,
29892,
2854,
1061,
29901,
1714,
24204,
1125,
13,
1678,
4974,
2854,
1061,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
1275,
659,
13,
13,
13,
29937,
835,
830,
6929,
491,
995,
835,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
518,
3285,
19997,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
731,
3285,
7442,
29889,
13707,
29892,
7442,
29889,
1631,
2314,
13,
1753,
1243,
29918,
276,
6929,
29898,
791,
29892,
2854,
1061,
29901,
1714,
24204,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
29897,
408,
8845,
29918,
14057,
545,
29901,
13,
4706,
2854,
1061,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
13,
1678,
4974,
525,
13919,
995,
29915,
297,
851,
29898,
18157,
29918,
14057,
545,
29889,
1767,
29897,
13,
13,
13,
29937,
15758,
1819,
13,
29937,
448,
1378,
5634,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
5431,
742,
525,
29933,
1718,
742,
525,
11287,
13,
1753,
1243,
29918,
16044,
749,
29918,
5975,
29898,
791,
29892,
2854,
1061,
29918,
5975,
29901,
1714,
24204,
1125,
13,
1678,
4974,
2854,
1061,
29918,
5975,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
1275,
659,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
5800,
29949,
742,
525,
1646,
742,
525,
1228,
742,
525,
29896,
29906,
29941,
29946,
11287,
13,
1753,
1243,
29918,
276,
6929,
29918,
5975,
29898,
791,
29892,
2854,
1061,
29918,
5975,
29901,
1714,
24204,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
29897,
408,
8845,
29918,
14057,
545,
29901,
13,
4706,
2854,
1061,
29918,
5975,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
13,
1678,
4974,
525,
13919,
995,
4286,
4830,
29898,
791,
29922,
791,
29897,
297,
851,
29898,
18157,
29918,
14057,
545,
29889,
1767,
29897,
13,
1678,
4974,
376,
1839,
5431,
742,
525,
29933,
1718,
742,
525,
2033,
29908,
297,
851,
29898,
18157,
29918,
14057,
545,
29889,
1767,
29897,
13,
13,
13,
29937,
835,
1939,
1999,
1331,
835,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
1646,
742,
525,
9606,
2208,
29949,
21004,
742,
525,
11526,
29991,
29992,
29937,
29938,
29995,
29985,
29987,
29930,
580,
11287,
13,
1753,
1243,
29918,
16044,
749,
29918,
1217,
29918,
2204,
1331,
29898,
791,
29892,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29901,
1714,
24204,
1125,
13,
1678,
4974,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
1275,
659,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
11287,
13,
1753,
1243,
29918,
276,
6929,
29918,
1217,
29918,
2204,
1331,
29898,
791,
29892,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29901,
1714,
24204,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
29897,
408,
8845,
29918,
14057,
545,
29901,
13,
4706,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
13,
1678,
4974,
525,
29909,
1661,
29899,
6310,
1347,
29915,
297,
851,
29898,
18157,
29918,
14057,
545,
29889,
1767,
29897,
13,
13,
13,
29937,
4398,
3431,
13,
29937,
448,
26589,
13,
29937,
835,
29848,
749,
835,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
5431,
742,
525,
29933,
1718,
742,
15516,
525,
27975,
11287,
13,
1753,
1243,
29918,
16044,
749,
29918,
29874,
554,
29918,
19529,
1503,
29898,
791,
29892,
2854,
1061,
29918,
29874,
554,
29901,
1714,
24204,
1125,
13,
1678,
4974,
2854,
1061,
29918,
29874,
554,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
1275,
659,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
5431,
742,
6024,
5431,
7464,
7442,
29889,
2378,
18959,
29933,
1718,
742,
6629,
1402,
26688,
2433,
3318,
5477,
6024,
27975,
742,
525,
27975,
742,
525,
27975,
2033,
2314,
13,
1753,
1243,
29918,
16044,
749,
29918,
29874,
554,
29918,
1761,
29898,
791,
29892,
2854,
1061,
29918,
29874,
554,
29901,
1714,
24204,
1125,
13,
1678,
1302,
261,
346,
29918,
791,
353,
2854,
1061,
29918,
29874,
554,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
1678,
565,
338,
8758,
29898,
791,
29892,
313,
1761,
29892,
7442,
29889,
299,
2378,
22164,
13,
4706,
4974,
7442,
29889,
2378,
29918,
11745,
29898,
1111,
261,
346,
29918,
791,
29892,
7442,
29889,
2378,
29898,
791,
29892,
26688,
29922,
1111,
261,
346,
29918,
791,
29889,
29881,
1853,
876,
13,
1678,
1683,
29901,
13,
4706,
4974,
1302,
261,
346,
29918,
791,
1275,
659,
13,
13,
13,
29937,
835,
830,
6929,
491,
1134,
835,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
518,
1839,
5431,
742,
3861,
1402,
6024,
5431,
742,
29871,
29941,
29892,
29871,
29946,
1402,
518,
29941,
29892,
29871,
29906,
29892,
29871,
29896,
24960,
13,
1753,
1243,
29918,
276,
6929,
29918,
29874,
554,
29898,
791,
29892,
2854,
1061,
29918,
29874,
554,
29901,
1714,
24204,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
29897,
408,
8845,
29918,
14057,
545,
29901,
13,
4706,
2854,
1061,
29918,
29874,
554,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
13,
1678,
4974,
525,
13919,
1543,
29898,
29879,
16029,
297,
851,
29898,
18157,
29918,
14057,
545,
29889,
1767,
29897,
13,
13,
13,
29937,
835,
830,
6929,
491,
995,
835,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
518,
1839,
5431,
742,
525,
1646,
7464,
6024,
29941,
742,
525,
29946,
7464,
6024,
29933,
1718,
742,
525,
29933,
1718,
742,
525,
12199,
29991,
2033,
2314,
13,
1753,
1243,
29918,
276,
6929,
29918,
29874,
554,
29918,
5975,
29898,
791,
29892,
2854,
1061,
29918,
29874,
554,
29918,
5975,
29901,
1714,
24204,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
29897,
408,
8845,
29918,
14057,
545,
29901,
13,
4706,
2854,
1061,
29918,
29874,
554,
29918,
5975,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
13,
1678,
4974,
525,
13919,
1543,
29898,
29879,
16029,
297,
851,
29898,
18157,
29918,
14057,
545,
29889,
1767,
29897,
13,
13,
13,
29937,
835,
1939,
1999,
1331,
835,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
29896,
29906,
29941,
742,
6024,
1646,
742,
525,
9606,
2208,
29949,
21004,
7464,
6024,
11526,
29991,
29992,
29937,
29938,
29995,
29985,
29987,
29930,
580,
2033,
2314,
13,
1753,
1243,
29918,
16044,
749,
29918,
1217,
29918,
2204,
1331,
29918,
29874,
554,
29898,
791,
29892,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29918,
29874,
554,
29901,
1714,
24204,
1125,
13,
1678,
1302,
261,
346,
29918,
791,
353,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29918,
29874,
554,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
1678,
565,
338,
8758,
29898,
791,
29892,
313,
1761,
29892,
7442,
29889,
299,
2378,
22164,
13,
4706,
4974,
7442,
29889,
2378,
29918,
11745,
29898,
1111,
261,
346,
29918,
791,
29892,
7442,
29889,
2378,
29898,
791,
29892,
26688,
29922,
1111,
261,
346,
29918,
791,
29889,
29881,
1853,
876,
13,
1678,
1683,
29901,
13,
4706,
4974,
1302,
261,
346,
29918,
791,
1275,
659,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
791,
742,
13,
462,
308,
6024,
742,
6024,
5431,
742,
525,
1646,
742,
6629,
1402,
6024,
2033,
2314,
13,
1753,
1243,
29918,
276,
6929,
29918,
1217,
29918,
2204,
1331,
29918,
29874,
554,
29898,
791,
29892,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29918,
29874,
554,
29901,
1714,
24204,
1125,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
1917,
2392,
29897,
408,
8845,
29918,
14057,
545,
29901,
13,
4706,
2854,
1061,
29918,
1217,
29918,
2204,
1331,
29918,
29874,
554,
29889,
15480,
29918,
1111,
261,
346,
29898,
791,
29897,
13,
13,
1678,
4974,
525,
29909,
1661,
29899,
6310,
1347,
29915,
297,
851,
29898,
18157,
29918,
14057,
545,
29889,
1767,
29897,
13,
13,
2
] |
envi/archs/msp430/__init__.py | vEpiphyte/vivisect | 1 | 98744 | <filename>envi/archs/msp430/__init__.py
"""
msp430 module
"""
############
# Author: <NAME>
# Started: 05/23/2009
#
import envi
from envi.archs.msp430.regs import *
from envi.archs.msp430.disasm import *
from envi.archs.msp430.const import *
class Msp430Module(envi.ArchitectureModule):
def __init__(self):
envi.ArchitectureModule.__init__(self, "msp430", maxinst=4)
self._arch_dis = Msp430Disasm()
def archGetRegCtx(self):
return Msp430RegisterContext()
def archGetNopInstr(self):
return '\x03\x43' # NOP is emulated with: MOV #0, R3
def archGetRegisterGroups(self):
groups = envi.ArchitectureModule.archGetRegisterGroups(self)
general= ('general', registers, )
groups.append(general)
return groups
def getPointerSize(self):
return 2
def pointerString(self, va):
return '0x{:04x}'.format(va)
def archParseOpcode(self, bytes, offset=0, va=0):
return self._arch_dis.disasm(bytes, offset, va)
def getEmulator(self):
return Msp430Emulator()
def getArchDefaultCall(self):
return 'msp430call'
# NOTE: This one must be after the definition of Msp430Module
from envi.archs.msp430.emu import *
| [
1,
529,
9507,
29958,
264,
1403,
29914,
1279,
29879,
29914,
29885,
1028,
29946,
29941,
29900,
29914,
1649,
2344,
26914,
2272,
13,
15945,
29908,
13,
29885,
1028,
29946,
29941,
29900,
3883,
13,
15945,
29908,
13,
13,
7346,
4136,
13,
29937,
13361,
29901,
529,
5813,
29958,
13,
29937,
7370,
287,
29901,
29871,
29900,
29945,
29914,
29906,
29941,
29914,
29906,
29900,
29900,
29929,
13,
29937,
29871,
13,
13,
5215,
21061,
13,
13,
3166,
21061,
29889,
1279,
29879,
29889,
29885,
1028,
29946,
29941,
29900,
29889,
1727,
29879,
1053,
334,
13,
3166,
21061,
29889,
1279,
29879,
29889,
29885,
1028,
29946,
29941,
29900,
29889,
2218,
11625,
1053,
334,
13,
3166,
21061,
29889,
1279,
29879,
29889,
29885,
1028,
29946,
29941,
29900,
29889,
3075,
1053,
334,
13,
13,
1990,
341,
1028,
29946,
29941,
29900,
7355,
29898,
264,
1403,
29889,
13197,
14819,
7355,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
21061,
29889,
13197,
14819,
7355,
17255,
2344,
12035,
1311,
29892,
376,
29885,
1028,
29946,
29941,
29900,
613,
4236,
2611,
29922,
29946,
29897,
13,
4706,
1583,
3032,
1279,
29918,
2218,
353,
341,
1028,
29946,
29941,
29900,
4205,
11625,
580,
13,
13,
1678,
822,
3190,
2577,
4597,
29907,
7508,
29898,
1311,
1125,
13,
4706,
736,
341,
1028,
29946,
29941,
29900,
15213,
2677,
580,
13,
13,
1678,
822,
3190,
2577,
29940,
459,
797,
710,
29898,
1311,
1125,
13,
4706,
736,
11297,
29916,
29900,
29941,
29905,
29916,
29946,
29941,
29915,
396,
405,
4590,
338,
953,
7964,
411,
29901,
16999,
29963,
396,
29900,
29892,
390,
29941,
13,
13,
1678,
822,
3190,
2577,
15213,
24020,
29898,
1311,
1125,
13,
4706,
6471,
353,
21061,
29889,
13197,
14819,
7355,
29889,
1279,
2577,
15213,
24020,
29898,
1311,
29897,
13,
4706,
2498,
29922,
6702,
17492,
742,
28975,
29892,
1723,
13,
4706,
6471,
29889,
4397,
29898,
17492,
29897,
13,
4706,
736,
6471,
13,
13,
1678,
822,
679,
14516,
3505,
29898,
1311,
1125,
13,
4706,
736,
29871,
29906,
13,
13,
1678,
822,
4879,
1231,
29898,
1311,
29892,
2947,
1125,
13,
4706,
736,
525,
29900,
29916,
25641,
29900,
29946,
29916,
29913,
4286,
4830,
29898,
1564,
29897,
13,
13,
1678,
822,
3190,
12914,
11746,
401,
29898,
1311,
29892,
6262,
29892,
9210,
29922,
29900,
29892,
2947,
29922,
29900,
1125,
13,
4706,
736,
1583,
3032,
1279,
29918,
2218,
29889,
2218,
11625,
29898,
13193,
29892,
9210,
29892,
2947,
29897,
13,
13,
1678,
822,
679,
6026,
9183,
29898,
1311,
1125,
13,
4706,
736,
341,
1028,
29946,
29941,
29900,
6026,
9183,
580,
13,
13,
1678,
822,
679,
13197,
4592,
5594,
29898,
1311,
1125,
13,
4706,
736,
525,
29885,
1028,
29946,
29941,
29900,
4804,
29915,
13,
13,
29937,
6058,
29923,
29901,
910,
697,
1818,
367,
1156,
278,
5023,
310,
341,
1028,
29946,
29941,
29900,
7355,
13,
3166,
21061,
29889,
1279,
29879,
29889,
29885,
1028,
29946,
29941,
29900,
29889,
24425,
1053,
334,
13,
2
] |
method/pruning_googlenet.py | Nuctech-AI/LBS_pruning | 6 | 49687 | <reponame>Nuctech-AI/LBS_pruning
import torch.nn as nn
import torch
import copy
import numpy as np
import collections
def pruning_grad_densent_layer(namex,layer,index=None,groups_y=None,re_num=None):
if isinstance(layer, nn.Conv2d):
if index is not None:
layer.weight.data = layer.weight.data[:, index]
layer.in_channels = index.shape[0]
weight = layer.weight.data
a = np.linspace(0, weight.shape[0]-1, num=weight.shape[0])
if re_num is None:
dsa=a
else:
dsa_ori=re_num
dsa=np.setdiff1d(a,dsa_ori)
dsa.sort()
layer.weight.data = layer.weight.data[dsa]
if layer.bias is not None:
layer.bias.data = layer.bias.data[dsa]
layer.out_channels = dsa.shape[0]
return layer, dsa
elif isinstance(layer, nn.BatchNorm2d):
if layer.weight is not None:
layer.weight.data=layer.weight.data[index]
if layer.bias is not None:
layer.bias.data=layer.bias.data[index]
layer.running_mean.data = layer.running_mean.data[index]
layer.running_var.data = layer.running_var.data[index]
layer.num_features = index.shape[0]
return layer, index
elif isinstance(layer, torch.nn.Linear):
layer.weight.data = layer.weight.data[:, index]
layer.in_features = index.shape[0]
return layer,index
else:
print(layer)
def get_ori_shape(model):
ori_shape = collections.OrderedDict()
for name, layer in model.named_modules():
if isinstance(layer, torch.nn.Conv2d) or isinstance(layer, torch.nn.BatchNorm2d) or isinstance(layer,torch.nn.Linear):
namex = name + '.weight'
if layer.weight is not None:
ori_shape[namex] = layer.weight.data.shape[0]
else:
ori_shape[namex] = layer.running_mean.data.shape[0]
return ori_shape
def get_ori_channels(model):
channels = collections.OrderedDict()
for name, layer in model.named_modules():
if isinstance(layer, torch.nn.Conv2d) or isinstance(layer,torch.nn.Linear):
namex = name + '.weight'
channels[namex] = layer.weight.data.shape[1]
return channels
def pruning_googlenet_grad(model,config_prune=None,re_ind=None):
ori_shape = get_ori_shape(model)
ori_channels=get_ori_channels(model)
index=None
layer_index = collections.OrderedDict()
ori_model=copy.deepcopy(model)
#ori_model.cuda()
concat_fig=config_prune['concat']
layer_list = list(model.state_dict().keys())
for name, m in model.named_modules():
if isinstance(m, torch.nn.Conv2d):
ne=name+'.weight'
if ne not in re_ind:
#print(ne)
re_ind[ne]=None
offset=collections.OrderedDict()
for index_i,i in enumerate(concat_fig):
if index_i==0:
continue
for index_j,j in enumerate(i):
offset[j]=concat_fig[index_i-1]
for name_cnv,name_x in offset.items():
for ll,each_x in enumerate(name_x):
if 'branch3x3' in each_x:
name_x[ll]=name_x[ll][:-8]+'3'+name_x[ll][-7:]
if 'branch5x5' in each_x:
name_x[ll] =name_x[ll][:-8]+'6'+name_x[ll][-7:]
cov_index=collections.OrderedDict()
for name_cnv, name_x in offset.items():
offset1=0
cov_index1=None
for ll, each_x in enumerate(name_x):
if ll==0:
offset1=0
cov_index1=copy.deepcopy(re_ind[each_x])
else:
offset1=offset1+ori_shape[name_x[ll-1]]
if re_ind[each_x] is None:
continue
if cov_index1 is None:
cov_index1=copy.deepcopy(re_ind[each_x])+offset1
else:
cov_index1=np.hstack((cov_index1,(re_ind[each_x]+offset1)))
if cov_index1 is not None:
cov_index1.sort()
cov_index[name_cnv]=cov_index1
index = None
for name,layer in model.named_modules():
if isinstance(layer,torch.nn.Conv2d) or isinstance(layer,torch.nn.BatchNorm2d) or isinstance(layer,torch.nn.Linear):
namex = name + '.weight'
#print(namex)
if isinstance(layer,torch.nn.Conv2d):
#ori_shape[namex]=layer.weight.data.shape[0]
if namex in cov_index:
a = np.linspace(0, ori_channels[namex] - 1, num=ori_channels[namex])
if cov_index[namex] is not None:
index = np.setdiff1d(a, cov_index[namex])
else:
index=a
layer, index = pruning_grad_densent_layer(namex, layer, index,re_num=re_ind[namex])
layer_index[namex]=index
elif isinstance(layer,torch.nn.BatchNorm2d):
layer,index=pruning_grad_densent_layer(namex,layer,index)
layer_index[namex]=index
elif isinstance(layer,torch.nn.Linear):
#ori_shape[namex] = layer.weight.data.shape[0]
if namex in cov_index:
a = np.linspace(0, ori_channels[namex] - 1, num=ori_channels[namex])
if cov_index[namex] is not None:
index = np.setdiff1d(a, cov_index[namex])
else:
index=a
layer,index=pruning_grad_densent_layer(namex,layer,index)
layer_index[namex]=index
else:
continue
else:
continue
return model | [
1,
529,
276,
1112,
420,
29958,
29940,
5313,
5309,
29899,
23869,
29914,
29931,
9851,
29918,
558,
27964,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
13,
5215,
3509,
13,
5215,
12655,
408,
7442,
13,
5215,
16250,
13,
1753,
544,
27964,
29918,
5105,
29918,
21518,
296,
29918,
13148,
29898,
978,
29916,
29892,
13148,
29892,
2248,
29922,
8516,
29892,
13155,
29918,
29891,
29922,
8516,
29892,
276,
29918,
1949,
29922,
8516,
1125,
13,
1678,
565,
338,
8758,
29898,
13148,
29892,
302,
29876,
29889,
1168,
29894,
29906,
29881,
1125,
13,
4706,
565,
2380,
338,
451,
6213,
29901,
13,
9651,
7546,
29889,
7915,
29889,
1272,
353,
7546,
29889,
7915,
29889,
1272,
7503,
29892,
2380,
29962,
13,
9651,
7546,
29889,
262,
29918,
305,
12629,
353,
2380,
29889,
12181,
29961,
29900,
29962,
13,
4706,
7688,
353,
7546,
29889,
7915,
29889,
1272,
13,
4706,
263,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
7688,
29889,
12181,
29961,
29900,
29962,
29899,
29896,
29892,
954,
29922,
7915,
29889,
12181,
29961,
29900,
2314,
13,
4706,
565,
337,
29918,
1949,
338,
6213,
29901,
13,
9651,
270,
4977,
29922,
29874,
13,
4706,
1683,
29901,
13,
9651,
270,
4977,
29918,
4170,
29922,
276,
29918,
1949,
13,
9651,
270,
4977,
29922,
9302,
29889,
842,
12765,
29896,
29881,
29898,
29874,
29892,
29881,
4977,
29918,
4170,
29897,
13,
4706,
270,
4977,
29889,
6605,
580,
13,
4706,
7546,
29889,
7915,
29889,
1272,
353,
7546,
29889,
7915,
29889,
1272,
29961,
29881,
4977,
29962,
13,
4706,
565,
7546,
29889,
29890,
3173,
338,
451,
6213,
29901,
13,
9651,
7546,
29889,
29890,
3173,
29889,
1272,
353,
7546,
29889,
29890,
3173,
29889,
1272,
29961,
29881,
4977,
29962,
13,
4706,
7546,
29889,
449,
29918,
305,
12629,
353,
270,
4977,
29889,
12181,
29961,
29900,
29962,
13,
4706,
736,
7546,
29892,
270,
4977,
13,
1678,
25342,
338,
8758,
29898,
13148,
29892,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
1125,
13,
4706,
565,
7546,
29889,
7915,
338,
451,
6213,
29901,
13,
9651,
7546,
29889,
7915,
29889,
1272,
29922,
13148,
29889,
7915,
29889,
1272,
29961,
2248,
29962,
13,
4706,
565,
7546,
29889,
29890,
3173,
338,
451,
6213,
29901,
13,
9651,
7546,
29889,
29890,
3173,
29889,
1272,
29922,
13148,
29889,
29890,
3173,
29889,
1272,
29961,
2248,
29962,
13,
4706,
7546,
29889,
21094,
29918,
12676,
29889,
1272,
353,
7546,
29889,
21094,
29918,
12676,
29889,
1272,
29961,
2248,
29962,
13,
4706,
7546,
29889,
21094,
29918,
1707,
29889,
1272,
353,
7546,
29889,
21094,
29918,
1707,
29889,
1272,
29961,
2248,
29962,
13,
4706,
7546,
29889,
1949,
29918,
22100,
353,
2380,
29889,
12181,
29961,
29900,
29962,
13,
4706,
736,
7546,
29892,
2380,
13,
1678,
25342,
338,
8758,
29898,
13148,
29892,
4842,
305,
29889,
15755,
29889,
12697,
1125,
13,
4706,
7546,
29889,
7915,
29889,
1272,
353,
7546,
29889,
7915,
29889,
1272,
7503,
29892,
2380,
29962,
13,
4706,
7546,
29889,
262,
29918,
22100,
353,
2380,
29889,
12181,
29961,
29900,
29962,
13,
4706,
736,
7546,
29892,
2248,
13,
1678,
1683,
29901,
13,
4706,
1596,
29898,
13148,
29897,
13,
13,
1753,
679,
29918,
4170,
29918,
12181,
29898,
4299,
1125,
13,
1678,
470,
29875,
29918,
12181,
353,
16250,
29889,
7514,
287,
21533,
580,
13,
1678,
363,
1024,
29892,
7546,
297,
1904,
29889,
17514,
29918,
7576,
7295,
13,
4706,
565,
338,
8758,
29898,
13148,
29892,
4842,
305,
29889,
15755,
29889,
1168,
29894,
29906,
29881,
29897,
470,
338,
8758,
29898,
13148,
29892,
4842,
305,
29889,
15755,
29889,
23145,
29940,
555,
29906,
29881,
29897,
470,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
12697,
1125,
13,
9651,
1024,
29916,
353,
1024,
718,
15300,
7915,
29915,
13,
9651,
565,
7546,
29889,
7915,
338,
451,
6213,
29901,
13,
18884,
470,
29875,
29918,
12181,
29961,
978,
29916,
29962,
353,
7546,
29889,
7915,
29889,
1272,
29889,
12181,
29961,
29900,
29962,
13,
9651,
1683,
29901,
13,
18884,
470,
29875,
29918,
12181,
29961,
978,
29916,
29962,
353,
7546,
29889,
21094,
29918,
12676,
29889,
1272,
29889,
12181,
29961,
29900,
29962,
13,
1678,
736,
470,
29875,
29918,
12181,
13,
1753,
679,
29918,
4170,
29918,
305,
12629,
29898,
4299,
1125,
13,
1678,
18196,
353,
16250,
29889,
7514,
287,
21533,
580,
13,
1678,
363,
1024,
29892,
7546,
297,
1904,
29889,
17514,
29918,
7576,
7295,
13,
4706,
565,
338,
8758,
29898,
13148,
29892,
4842,
305,
29889,
15755,
29889,
1168,
29894,
29906,
29881,
29897,
470,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
12697,
1125,
13,
9651,
1024,
29916,
353,
1024,
718,
15300,
7915,
29915,
13,
9651,
18196,
29961,
978,
29916,
29962,
353,
7546,
29889,
7915,
29889,
1272,
29889,
12181,
29961,
29896,
29962,
13,
1678,
736,
18196,
13,
1753,
544,
27964,
29918,
1484,
468,
2435,
300,
29918,
5105,
29898,
4299,
29892,
2917,
29918,
558,
1540,
29922,
8516,
29892,
276,
29918,
513,
29922,
8516,
1125,
13,
13,
1678,
470,
29875,
29918,
12181,
353,
679,
29918,
4170,
29918,
12181,
29898,
4299,
29897,
13,
1678,
470,
29875,
29918,
305,
12629,
29922,
657,
29918,
4170,
29918,
305,
12629,
29898,
4299,
29897,
13,
1678,
2380,
29922,
8516,
13,
1678,
7546,
29918,
2248,
353,
16250,
29889,
7514,
287,
21533,
580,
13,
1678,
470,
29875,
29918,
4299,
29922,
8552,
29889,
24535,
8552,
29898,
4299,
29897,
13,
1678,
396,
4170,
29918,
4299,
29889,
29883,
6191,
580,
13,
1678,
3022,
271,
29918,
1003,
29922,
2917,
29918,
558,
1540,
1839,
17685,
2033,
13,
13,
1678,
7546,
29918,
1761,
353,
1051,
29898,
4299,
29889,
3859,
29918,
8977,
2141,
8149,
3101,
13,
1678,
363,
1024,
29892,
286,
297,
1904,
29889,
17514,
29918,
7576,
7295,
13,
4706,
565,
338,
8758,
29898,
29885,
29892,
4842,
305,
29889,
15755,
29889,
1168,
29894,
29906,
29881,
1125,
13,
9651,
452,
29922,
978,
29974,
4286,
7915,
29915,
13,
9651,
565,
452,
451,
297,
337,
29918,
513,
29901,
13,
18884,
396,
2158,
29898,
484,
29897,
13,
18884,
337,
29918,
513,
29961,
484,
13192,
8516,
13,
13,
1678,
9210,
29922,
29027,
29889,
7514,
287,
21533,
580,
13,
1678,
363,
2380,
29918,
29875,
29892,
29875,
297,
26985,
29898,
17685,
29918,
1003,
1125,
13,
4706,
565,
2380,
29918,
29875,
1360,
29900,
29901,
13,
9651,
6773,
13,
4706,
363,
2380,
29918,
29926,
29892,
29926,
297,
26985,
29898,
29875,
1125,
13,
9651,
9210,
29961,
29926,
13192,
17685,
29918,
1003,
29961,
2248,
29918,
29875,
29899,
29896,
29962,
13,
1678,
363,
1024,
29918,
18038,
29894,
29892,
978,
29918,
29916,
297,
9210,
29889,
7076,
7295,
13,
4706,
363,
11148,
29892,
4204,
29918,
29916,
297,
26985,
29898,
978,
29918,
29916,
1125,
13,
9651,
565,
525,
17519,
29941,
29916,
29941,
29915,
297,
1269,
29918,
29916,
29901,
13,
18884,
1024,
29918,
29916,
29961,
645,
13192,
978,
29918,
29916,
29961,
645,
3816,
13018,
29947,
10062,
29915,
29941,
18717,
978,
29918,
29916,
29961,
645,
3816,
29899,
29955,
17531,
13,
9651,
565,
525,
17519,
29945,
29916,
29945,
29915,
297,
1269,
29918,
29916,
29901,
13,
18884,
1024,
29918,
29916,
29961,
645,
29962,
353,
978,
29918,
29916,
29961,
645,
3816,
13018,
29947,
10062,
29915,
29953,
18717,
978,
29918,
29916,
29961,
645,
3816,
29899,
29955,
17531,
13,
13,
1678,
18838,
29918,
2248,
29922,
29027,
29889,
7514,
287,
21533,
580,
13,
1678,
363,
1024,
29918,
18038,
29894,
29892,
1024,
29918,
29916,
297,
9210,
29889,
7076,
7295,
13,
4706,
9210,
29896,
29922,
29900,
13,
4706,
18838,
29918,
2248,
29896,
29922,
8516,
13,
4706,
363,
11148,
29892,
1269,
29918,
29916,
297,
26985,
29898,
978,
29918,
29916,
1125,
13,
9651,
565,
11148,
1360,
29900,
29901,
13,
18884,
9210,
29896,
29922,
29900,
13,
18884,
18838,
29918,
2248,
29896,
29922,
8552,
29889,
24535,
8552,
29898,
276,
29918,
513,
29961,
4204,
29918,
29916,
2314,
13,
9651,
1683,
29901,
13,
18884,
9210,
29896,
29922,
10289,
29896,
29974,
4170,
29918,
12181,
29961,
978,
29918,
29916,
29961,
645,
29899,
29896,
5262,
13,
18884,
565,
337,
29918,
513,
29961,
4204,
29918,
29916,
29962,
338,
6213,
29901,
13,
462,
1678,
6773,
13,
18884,
565,
18838,
29918,
2248,
29896,
338,
6213,
29901,
13,
462,
1678,
18838,
29918,
2248,
29896,
29922,
8552,
29889,
24535,
8552,
29898,
276,
29918,
513,
29961,
4204,
29918,
29916,
2314,
29974,
10289,
29896,
13,
18884,
1683,
29901,
13,
462,
1678,
18838,
29918,
2248,
29896,
29922,
9302,
29889,
29882,
1429,
3552,
24542,
29918,
2248,
29896,
22657,
276,
29918,
513,
29961,
4204,
29918,
29916,
10062,
10289,
29896,
4961,
13,
4706,
565,
18838,
29918,
2248,
29896,
338,
451,
29871,
6213,
29901,
13,
9651,
18838,
29918,
2248,
29896,
29889,
6605,
580,
13,
4706,
18838,
29918,
2248,
29961,
978,
29918,
18038,
29894,
13192,
24542,
29918,
2248,
29896,
13,
13,
13,
1678,
2380,
353,
6213,
13,
1678,
363,
1024,
29892,
13148,
297,
1904,
29889,
17514,
29918,
7576,
7295,
13,
4706,
565,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
1168,
29894,
29906,
29881,
29897,
470,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
23145,
29940,
555,
29906,
29881,
29897,
470,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
12697,
1125,
13,
9651,
1024,
29916,
353,
1024,
718,
15300,
7915,
29915,
13,
9651,
396,
2158,
29898,
978,
29916,
29897,
13,
9651,
565,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
1168,
29894,
29906,
29881,
1125,
13,
18884,
396,
4170,
29918,
12181,
29961,
978,
29916,
13192,
13148,
29889,
7915,
29889,
1272,
29889,
12181,
29961,
29900,
29962,
13,
18884,
565,
1024,
29916,
297,
18838,
29918,
2248,
29901,
13,
462,
1678,
263,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
470,
29875,
29918,
305,
12629,
29961,
978,
29916,
29962,
448,
29871,
29896,
29892,
954,
29922,
4170,
29918,
305,
12629,
29961,
978,
29916,
2314,
13,
462,
1678,
565,
18838,
29918,
2248,
29961,
978,
29916,
29962,
338,
451,
6213,
29901,
13,
462,
4706,
2380,
353,
7442,
29889,
842,
12765,
29896,
29881,
29898,
29874,
29892,
18838,
29918,
2248,
29961,
978,
29916,
2314,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
2380,
29922,
29874,
13,
18884,
7546,
29892,
2380,
353,
544,
27964,
29918,
5105,
29918,
21518,
296,
29918,
13148,
29898,
978,
29916,
29892,
7546,
29892,
2380,
29892,
276,
29918,
1949,
29922,
276,
29918,
513,
29961,
978,
29916,
2314,
13,
18884,
7546,
29918,
2248,
29961,
978,
29916,
13192,
2248,
13,
9651,
25342,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
23145,
29940,
555,
29906,
29881,
1125,
13,
18884,
7546,
29892,
2248,
29922,
558,
27964,
29918,
5105,
29918,
21518,
296,
29918,
13148,
29898,
978,
29916,
29892,
13148,
29892,
2248,
29897,
13,
18884,
7546,
29918,
2248,
29961,
978,
29916,
13192,
2248,
13,
9651,
25342,
338,
8758,
29898,
13148,
29892,
7345,
305,
29889,
15755,
29889,
12697,
1125,
13,
18884,
396,
4170,
29918,
12181,
29961,
978,
29916,
29962,
353,
7546,
29889,
7915,
29889,
1272,
29889,
12181,
29961,
29900,
29962,
13,
18884,
565,
1024,
29916,
297,
18838,
29918,
2248,
29901,
13,
462,
1678,
263,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
470,
29875,
29918,
305,
12629,
29961,
978,
29916,
29962,
448,
29871,
29896,
29892,
954,
29922,
4170,
29918,
305,
12629,
29961,
978,
29916,
2314,
13,
462,
1678,
565,
18838,
29918,
2248,
29961,
978,
29916,
29962,
338,
451,
6213,
29901,
13,
462,
4706,
2380,
353,
7442,
29889,
842,
12765,
29896,
29881,
29898,
29874,
29892,
18838,
29918,
2248,
29961,
978,
29916,
2314,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
2380,
29922,
29874,
13,
18884,
7546,
29892,
2248,
29922,
558,
27964,
29918,
5105,
29918,
21518,
296,
29918,
13148,
29898,
978,
29916,
29892,
13148,
29892,
2248,
29897,
13,
18884,
7546,
29918,
2248,
29961,
978,
29916,
13192,
2248,
13,
9651,
1683,
29901,
13,
18884,
6773,
13,
4706,
1683,
29901,
13,
9651,
6773,
13,
1678,
736,
1904,
2
] |
tests/test_anonymous.py | psentinelli/filebrowser-safe | 25 | 180710 | from django.test import TestCase
from django.urls import reverse
class FilebrowserAnonymousTestCase(TestCase):
def test_browse(self):
url = reverse("fb_browse")
response = self.client.get(url)
self.assertEqual(302, response.status_code)
self.assertEqual("/admin/login/?next=" + url, response.url)
def test_mkdir(self):
url = reverse("fb_browse")
response = self.client.get(url)
self.assertEqual(302, response.status_code)
self.assertEqual("/admin/login/?next=" + url, response.url)
def test_rename(self):
url = reverse("fb_rename")
response = self.client.get(url)
self.assertEqual(302, response.status_code)
self.assertEqual("/admin/login/?next=" + url, response.url)
def test_delete(self):
url = reverse("fb_delete")
response = self.client.get(url)
self.assertEqual(302, response.status_code)
self.assertEqual("/admin/login/?next=" + url, response.url)
def test_upload(self):
url = reverse("fb_upload")
response = self.client.get(url)
self.assertEqual(302, response.status_code)
self.assertEqual("/admin/login/?next=" + url, response.url)
def test_do_upload(self):
url = reverse("fb_do_upload")
response = self.client.get(url)
self.assertEqual(302, response.status_code)
self.assertEqual("/admin/login/?next=" + url, response.url)
| [
1,
515,
9557,
29889,
1688,
1053,
4321,
8259,
13,
3166,
9557,
29889,
26045,
1053,
11837,
13,
13,
13,
1990,
3497,
15965,
2744,
11428,
3057,
8259,
29898,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
23721,
344,
29898,
1311,
1125,
13,
4706,
3142,
353,
11837,
703,
14943,
29918,
23721,
344,
1159,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29900,
29906,
29892,
2933,
29889,
4882,
29918,
401,
29897,
13,
4706,
1583,
29889,
9294,
9843,
11974,
6406,
29914,
7507,
13401,
4622,
543,
718,
3142,
29892,
2933,
29889,
2271,
29897,
13,
13,
1678,
822,
1243,
29918,
11256,
3972,
29898,
1311,
1125,
13,
4706,
3142,
353,
11837,
703,
14943,
29918,
23721,
344,
1159,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29900,
29906,
29892,
2933,
29889,
4882,
29918,
401,
29897,
13,
4706,
1583,
29889,
9294,
9843,
11974,
6406,
29914,
7507,
13401,
4622,
543,
718,
3142,
29892,
2933,
29889,
2271,
29897,
13,
13,
1678,
822,
1243,
29918,
1267,
420,
29898,
1311,
1125,
13,
4706,
3142,
353,
11837,
703,
14943,
29918,
1267,
420,
1159,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29900,
29906,
29892,
2933,
29889,
4882,
29918,
401,
29897,
13,
4706,
1583,
29889,
9294,
9843,
11974,
6406,
29914,
7507,
13401,
4622,
543,
718,
3142,
29892,
2933,
29889,
2271,
29897,
13,
13,
1678,
822,
1243,
29918,
8143,
29898,
1311,
1125,
13,
4706,
3142,
353,
11837,
703,
14943,
29918,
8143,
1159,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29900,
29906,
29892,
2933,
29889,
4882,
29918,
401,
29897,
13,
4706,
1583,
29889,
9294,
9843,
11974,
6406,
29914,
7507,
13401,
4622,
543,
718,
3142,
29892,
2933,
29889,
2271,
29897,
13,
13,
1678,
822,
1243,
29918,
9009,
29898,
1311,
1125,
13,
4706,
3142,
353,
11837,
703,
14943,
29918,
9009,
1159,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29900,
29906,
29892,
2933,
29889,
4882,
29918,
401,
29897,
13,
4706,
1583,
29889,
9294,
9843,
11974,
6406,
29914,
7507,
13401,
4622,
543,
718,
3142,
29892,
2933,
29889,
2271,
29897,
13,
13,
1678,
822,
1243,
29918,
1867,
29918,
9009,
29898,
1311,
1125,
13,
4706,
3142,
353,
11837,
703,
14943,
29918,
1867,
29918,
9009,
1159,
13,
4706,
2933,
353,
1583,
29889,
4645,
29889,
657,
29898,
2271,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29941,
29900,
29906,
29892,
2933,
29889,
4882,
29918,
401,
29897,
13,
4706,
1583,
29889,
9294,
9843,
11974,
6406,
29914,
7507,
13401,
4622,
543,
718,
3142,
29892,
2933,
29889,
2271,
29897,
13,
2
] |
GdbPublisherNode.py | larics/gdb_ros_publisher | 10 | 106503 | import rospy
from rospy.msg import AnyMsg
class GdbPublisher(object):
def __init__(self, topic, msgtype, queue_size = 1):
self.topic = topic
self.msgtype = msgtype
# Construct publisher lazily, since we don't know whether to latch or not yet.
self.publisher = None
self.queue_size = queue_size
def publish(self, serialized_message, latch):
message = AnyMsg()
message.deserialize(serialized_message)
if self.publisher == None:
self.publisher = rospy.Publisher(self.topic, self.msgtype, queue_size=self.queue_size, latch = latch)
self.publisher.publish(message)
class GdbPublisherDictionary(dict):
def __init__(self, publishers = None):
super(GdbPublisherDictionary, self).__init__()
if(publishers != None):
self.insert(publishers)
def insert(self, publishers):
try:
iterator = iter(publishers)
for publisher in publishers:
self[publisher.topic] = publisher
except TypeError:
# add the single publisher that we received
self[publishers.topic] = publishers
def publish(self, topic, serialized_message, latch):
publisher = self.get(topic, None)
if publisher != None:
publisher.publish(serialized_message, latch)
return True
return False
class GdbMessageBreakpoint(gdb.Breakpoint):
# the default context extractors
default_serialized_message_extractor = lambda self: gdb.selected_frame().read_var('m')
default_topic_extractor = lambda self: str(gdb.selected_frame().read_var('this').dereference()\
['name_']['_M_dataplus']['_M_p'].string())
default_latched_extractor = lambda self: str(gdb.selected_frame().read_var('this').dereference()\
['latch_'])
def __init__(self, location, context_extractor = lambda: {}):
super(GdbMessageBreakpoint, self).__init__(location, internal = True)
self.context_extractor = context_extractor
self.silent = True
def stop(self):
if(not hasattr(self, 'enclosing_node')):
raise Exception('Missing node reference')
context = self.context_extractor()
if 'serialized_variable' not in context:
context['serialized_variable'] = self.default_serialized_message_extractor()
if 'topic' not in context:
context['topic'] = self.default_topic_extractor()
if 'latch' not in context:
context['latch'] = self.default_latched_extractor()
self.enclosing_node.handle_message(**context)
return False
class GdbPublisherNode(object):
def __init__ (self, publisher_dictionary, breakpoints, log_publisher = False, log_publisher_state = False):
self.ros_handle = rospy.init_node('gdb_publisher')
self.publisher_dictionary = publisher_dictionary
self.breakpoints = []
self.add_breakpoints(breakpoints)
self.log_publisher = log_publisher
self.log_publisher_state = log_publisher_state
self.enabled_states_saved = False
print "Initialized ROS publisher."
def add_breakpoint(self, breakpoint):
breakpoint.enclosing_node = self
self.breakpoints.append(breakpoint)
def add_breakpoints(self, breakpoints):
try:
iterator = iter(breakpoints)
for breakpoint in breakpoints:
self.add_breakpoint(breakpoint)
except TypeError:
self.add_breakpoint(breakpoint)
def handle_message(self, serialized_variable, topic, latch):
if topic[0] == '/':
topic = topic[1:]
if topic not in self.publisher_dictionary:
if self.log_publisher:
print "didn't publish message in {}".format(topic)
# don't bother with executing the rest since we are not publishing this message
return
message_start = serialized_variable['message_start']
# in ros/serialization.h, serializeMessage(), num_bytes = len + 4
serialized_length = serialized_variable['num_bytes'] - 4
serialized_message = self.convert_serialized_to_python(message_start, serialized_length)
self.publisher_dictionary.publish(topic, serialized_message, latch)
if self.log_publisher:
print 'published {}, {}'.format(topic, serialized_length)
def enable_breakpoints(self, print_notice = True):
for b in self.breakpoints:
b.enabled = True
if print_notice:
print "Enabled ROS publisher."
def disable_breakpoints(self, print_notice = True):
for b in self.breakpoints:
b.enabled = False
if print_notice:
print "Disabled ROS publisher."
def save_state_and_disable_ros_publisher(self):
if self.enabled_states_saved == True:
raise Exception('This should not have happened, ROS publisher state has already been saved')
self.breakpoint_enabled_states = [ b.enabled for b in self.breakpoints ]
self.enabled_states_saved = True
self.disable_breakpoints(False)
if self.breakpoint_enabled_states[0] and self.log_publisher_state:
print "Temporarily disabled ROS publisher."
def restore_ros_publisher_state(self):
if self.enabled_states_saved == True:
for b in zip(self.breakpoints, self.breakpoint_enabled_states):
b[0].enabled = b[1]
if self.breakpoint_enabled_states[0] and self.log_publisher_state:
print "Re-enabled ROS publisher."
self.enabled_states_saved = False
@staticmethod
def convert_serialized_to_python(c_array, length):
return ''.join([chr(c_array[char]) for char in range(length)])
| [
1,
1053,
696,
1028,
29891,
13,
3166,
696,
1028,
29891,
29889,
7645,
1053,
3139,
16190,
13,
13,
1990,
402,
2585,
21076,
1674,
261,
29898,
3318,
1125,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
11261,
29892,
10191,
1853,
29892,
9521,
29918,
2311,
353,
29871,
29896,
1125,
13,
1678,
1583,
29889,
13010,
353,
11261,
13,
1678,
1583,
29889,
7645,
1853,
353,
10191,
1853,
13,
1678,
396,
1281,
4984,
9805,
261,
425,
29920,
2354,
29892,
1951,
591,
1016,
29915,
29873,
1073,
3692,
304,
301,
905,
470,
451,
3447,
29889,
13,
1678,
1583,
29889,
23679,
261,
353,
6213,
13,
1678,
1583,
29889,
9990,
29918,
2311,
353,
9521,
29918,
2311,
13,
13,
29871,
822,
9805,
29898,
1311,
29892,
7797,
1891,
29918,
4906,
29892,
301,
905,
1125,
13,
1678,
2643,
353,
3139,
16190,
580,
13,
1678,
2643,
29889,
2783,
261,
6646,
29898,
15550,
1891,
29918,
4906,
29897,
13,
1678,
565,
1583,
29889,
23679,
261,
1275,
6213,
29901,
13,
418,
1583,
29889,
23679,
261,
353,
696,
1028,
29891,
29889,
21076,
1674,
261,
29898,
1311,
29889,
13010,
29892,
1583,
29889,
7645,
1853,
29892,
9521,
29918,
2311,
29922,
1311,
29889,
9990,
29918,
2311,
29892,
301,
905,
353,
301,
905,
29897,
13,
1678,
1583,
29889,
23679,
261,
29889,
23679,
29898,
4906,
29897,
13,
13,
1990,
402,
2585,
21076,
1674,
261,
11513,
29898,
8977,
1125,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
9805,
414,
353,
6213,
1125,
13,
1678,
2428,
29898,
29954,
2585,
21076,
1674,
261,
11513,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
1678,
565,
29898,
23679,
414,
2804,
6213,
1125,
13,
418,
1583,
29889,
7851,
29898,
23679,
414,
29897,
13,
13,
29871,
822,
4635,
29898,
1311,
29892,
9805,
414,
1125,
13,
1678,
1018,
29901,
13,
418,
20380,
353,
4256,
29898,
23679,
414,
29897,
13,
418,
363,
9805,
261,
297,
9805,
414,
29901,
13,
4706,
1583,
29961,
23679,
261,
29889,
13010,
29962,
353,
9805,
261,
13,
1678,
5174,
20948,
29901,
13,
418,
396,
788,
278,
2323,
9805,
261,
393,
591,
4520,
13,
418,
1583,
29961,
23679,
414,
29889,
13010,
29962,
353,
9805,
414,
13,
13,
29871,
822,
9805,
29898,
1311,
29892,
11261,
29892,
7797,
1891,
29918,
4906,
29892,
301,
905,
1125,
13,
1678,
9805,
261,
353,
1583,
29889,
657,
29898,
13010,
29892,
6213,
29897,
13,
13,
1678,
565,
9805,
261,
2804,
6213,
29901,
13,
418,
9805,
261,
29889,
23679,
29898,
15550,
1891,
29918,
4906,
29892,
301,
905,
29897,
13,
418,
736,
5852,
13,
13,
1678,
736,
7700,
13,
13,
1990,
402,
2585,
3728,
20130,
557,
3149,
29898,
29887,
2585,
29889,
20130,
557,
3149,
1125,
13,
29871,
396,
278,
2322,
3030,
6597,
943,
13,
29871,
2322,
29918,
15550,
1891,
29918,
4906,
29918,
21111,
272,
353,
14013,
1583,
29901,
330,
2585,
29889,
8391,
29918,
2557,
2141,
949,
29918,
1707,
877,
29885,
1495,
13,
29871,
2322,
29918,
13010,
29918,
21111,
272,
353,
14013,
1583,
29901,
851,
29898,
29887,
2585,
29889,
8391,
29918,
2557,
2141,
949,
29918,
1707,
877,
1366,
2824,
29881,
406,
1659,
580,
29905,
13,
1678,
6024,
978,
29918,
16215,
29918,
29924,
29918,
4130,
481,
12160,
16215,
29918,
29924,
29918,
29886,
13359,
1807,
3101,
13,
29871,
2322,
29918,
29880,
905,
287,
29918,
21111,
272,
353,
14013,
1583,
29901,
851,
29898,
29887,
2585,
29889,
8391,
29918,
2557,
2141,
949,
29918,
1707,
877,
1366,
2824,
29881,
406,
1659,
580,
29905,
13,
1678,
6024,
29880,
905,
29918,
11287,
13,
13,
29871,
822,
4770,
2344,
12035,
1311,
29892,
4423,
29892,
3030,
29918,
21111,
272,
353,
14013,
29901,
6571,
1125,
13,
1678,
2428,
29898,
29954,
2585,
3728,
20130,
557,
3149,
29892,
1583,
467,
1649,
2344,
12035,
5479,
29892,
7463,
353,
5852,
29897,
13,
1678,
1583,
29889,
4703,
29918,
21111,
272,
353,
3030,
29918,
21111,
272,
13,
1678,
1583,
29889,
25590,
296,
353,
5852,
13,
13,
29871,
822,
5040,
29898,
1311,
1125,
13,
1678,
565,
29898,
1333,
756,
5552,
29898,
1311,
29892,
525,
264,
11291,
292,
29918,
3177,
8785,
29901,
13,
418,
12020,
8960,
877,
18552,
292,
2943,
3407,
1495,
13,
13,
1678,
3030,
353,
1583,
29889,
4703,
29918,
21111,
272,
580,
13,
1678,
565,
525,
15550,
1891,
29918,
11918,
29915,
451,
297,
3030,
29901,
13,
418,
3030,
1839,
15550,
1891,
29918,
11918,
2033,
353,
1583,
29889,
4381,
29918,
15550,
1891,
29918,
4906,
29918,
21111,
272,
580,
13,
1678,
565,
525,
13010,
29915,
451,
297,
3030,
29901,
13,
418,
3030,
1839,
13010,
2033,
353,
1583,
29889,
4381,
29918,
13010,
29918,
21111,
272,
580,
13,
1678,
565,
525,
29880,
905,
29915,
451,
297,
3030,
29901,
13,
418,
3030,
1839,
29880,
905,
2033,
353,
1583,
29889,
4381,
29918,
29880,
905,
287,
29918,
21111,
272,
580,
13,
13,
1678,
1583,
29889,
264,
11291,
292,
29918,
3177,
29889,
8411,
29918,
4906,
29898,
1068,
4703,
29897,
13,
1678,
736,
7700,
13,
13,
1990,
402,
2585,
21076,
1674,
261,
4247,
29898,
3318,
1125,
13,
29871,
822,
4770,
2344,
1649,
313,
1311,
29892,
9805,
261,
29918,
27126,
29892,
2867,
9748,
29892,
1480,
29918,
23679,
261,
353,
7700,
29892,
1480,
29918,
23679,
261,
29918,
3859,
353,
7700,
1125,
13,
1678,
1583,
29889,
1883,
29918,
8411,
353,
696,
1028,
29891,
29889,
2344,
29918,
3177,
877,
29887,
2585,
29918,
23679,
261,
1495,
13,
1678,
1583,
29889,
23679,
261,
29918,
27126,
353,
9805,
261,
29918,
27126,
13,
1678,
1583,
29889,
8690,
9748,
353,
5159,
13,
1678,
1583,
29889,
1202,
29918,
8690,
9748,
29898,
8690,
9748,
29897,
13,
1678,
1583,
29889,
1188,
29918,
23679,
261,
353,
1480,
29918,
23679,
261,
13,
1678,
1583,
29889,
1188,
29918,
23679,
261,
29918,
3859,
353,
1480,
29918,
23679,
261,
29918,
3859,
13,
1678,
1583,
29889,
17590,
29918,
28631,
29918,
17314,
353,
7700,
13,
13,
1678,
1596,
376,
15514,
1891,
390,
3267,
9805,
261,
1213,
13,
13,
29871,
822,
788,
29918,
8690,
3149,
29898,
1311,
29892,
2867,
3149,
1125,
13,
1678,
2867,
3149,
29889,
264,
11291,
292,
29918,
3177,
353,
1583,
13,
1678,
1583,
29889,
8690,
9748,
29889,
4397,
29898,
8690,
3149,
29897,
13,
13,
29871,
822,
788,
29918,
8690,
9748,
29898,
1311,
29892,
2867,
9748,
1125,
13,
1678,
1018,
29901,
13,
418,
20380,
353,
4256,
29898,
8690,
9748,
29897,
13,
418,
363,
2867,
3149,
297,
2867,
9748,
29901,
13,
4706,
1583,
29889,
1202,
29918,
8690,
3149,
29898,
8690,
3149,
29897,
13,
1678,
5174,
20948,
29901,
13,
4706,
1583,
29889,
1202,
29918,
8690,
3149,
29898,
8690,
3149,
29897,
13,
13,
29871,
822,
4386,
29918,
4906,
29898,
1311,
29892,
7797,
1891,
29918,
11918,
29892,
11261,
29892,
301,
905,
1125,
13,
1678,
565,
11261,
29961,
29900,
29962,
1275,
8207,
2396,
13,
418,
11261,
353,
11261,
29961,
29896,
17531,
13,
13,
1678,
565,
11261,
451,
297,
1583,
29889,
23679,
261,
29918,
27126,
29901,
13,
418,
565,
1583,
29889,
1188,
29918,
23679,
261,
29901,
13,
4706,
1596,
376,
18361,
29876,
29915,
29873,
9805,
2643,
297,
6571,
1642,
4830,
29898,
13010,
29897,
13,
418,
396,
1016,
29915,
29873,
24738,
411,
14012,
278,
1791,
1951,
591,
526,
451,
27256,
445,
2643,
13,
418,
736,
13,
13,
1678,
2643,
29918,
2962,
353,
7797,
1891,
29918,
11918,
1839,
4906,
29918,
2962,
2033,
13,
13,
1678,
396,
297,
14652,
29914,
15550,
2133,
29889,
29882,
29892,
28755,
3728,
3285,
954,
29918,
13193,
353,
7431,
718,
29871,
29946,
13,
1678,
7797,
1891,
29918,
2848,
353,
7797,
1891,
29918,
11918,
1839,
1949,
29918,
13193,
2033,
448,
29871,
29946,
13,
1678,
7797,
1891,
29918,
4906,
353,
1583,
29889,
13441,
29918,
15550,
1891,
29918,
517,
29918,
4691,
29898,
4906,
29918,
2962,
29892,
7797,
1891,
29918,
2848,
29897,
13,
13,
1678,
1583,
29889,
23679,
261,
29918,
27126,
29889,
23679,
29898,
13010,
29892,
7797,
1891,
29918,
4906,
29892,
301,
905,
29897,
13,
1678,
565,
1583,
29889,
1188,
29918,
23679,
261,
29901,
13,
418,
1596,
525,
5467,
3726,
24335,
6571,
4286,
4830,
29898,
13010,
29892,
7797,
1891,
29918,
2848,
29897,
13,
13,
29871,
822,
9025,
29918,
8690,
9748,
29898,
1311,
29892,
1596,
29918,
1333,
625,
353,
5852,
1125,
13,
1678,
363,
289,
297,
1583,
29889,
8690,
9748,
29901,
13,
418,
289,
29889,
17590,
353,
5852,
13,
1678,
565,
1596,
29918,
1333,
625,
29901,
13,
418,
1596,
376,
10861,
390,
3267,
9805,
261,
1213,
13,
13,
29871,
822,
11262,
29918,
8690,
9748,
29898,
1311,
29892,
1596,
29918,
1333,
625,
353,
5852,
1125,
13,
1678,
363,
289,
297,
1583,
29889,
8690,
9748,
29901,
13,
418,
289,
29889,
17590,
353,
7700,
13,
1678,
565,
1596,
29918,
1333,
625,
29901,
13,
418,
1596,
376,
4205,
3606,
390,
3267,
9805,
261,
1213,
13,
13,
29871,
822,
4078,
29918,
3859,
29918,
392,
29918,
20472,
29918,
1883,
29918,
23679,
261,
29898,
1311,
1125,
13,
1678,
565,
1583,
29889,
17590,
29918,
28631,
29918,
17314,
1275,
5852,
29901,
13,
418,
12020,
8960,
877,
4013,
881,
451,
505,
9559,
29892,
390,
3267,
9805,
261,
2106,
756,
2307,
1063,
7160,
1495,
13,
1678,
1583,
29889,
8690,
3149,
29918,
17590,
29918,
28631,
353,
518,
289,
29889,
17590,
363,
289,
297,
1583,
29889,
8690,
9748,
4514,
13,
1678,
1583,
29889,
17590,
29918,
28631,
29918,
17314,
353,
5852,
13,
1678,
1583,
29889,
20472,
29918,
8690,
9748,
29898,
8824,
29897,
13,
1678,
565,
1583,
29889,
8690,
3149,
29918,
17590,
29918,
28631,
29961,
29900,
29962,
322,
1583,
29889,
1188,
29918,
23679,
261,
29918,
3859,
29901,
13,
418,
1596,
376,
5776,
1971,
6275,
12708,
390,
3267,
9805,
261,
1213,
13,
13,
29871,
822,
17749,
29918,
1883,
29918,
23679,
261,
29918,
3859,
29898,
1311,
1125,
13,
1678,
565,
1583,
29889,
17590,
29918,
28631,
29918,
17314,
1275,
5852,
29901,
13,
418,
363,
289,
297,
14319,
29898,
1311,
29889,
8690,
9748,
29892,
1583,
29889,
8690,
3149,
29918,
17590,
29918,
28631,
1125,
13,
4706,
289,
29961,
29900,
1822,
17590,
353,
289,
29961,
29896,
29962,
13,
418,
565,
1583,
29889,
8690,
3149,
29918,
17590,
29918,
28631,
29961,
29900,
29962,
322,
1583,
29889,
1188,
29918,
23679,
261,
29918,
3859,
29901,
13,
4706,
1596,
376,
1123,
29899,
17590,
390,
3267,
9805,
261,
1213,
13,
1678,
1583,
29889,
17590,
29918,
28631,
29918,
17314,
353,
7700,
13,
13,
29871,
732,
7959,
5696,
13,
29871,
822,
3588,
29918,
15550,
1891,
29918,
517,
29918,
4691,
29898,
29883,
29918,
2378,
29892,
3309,
1125,
13,
1678,
736,
525,
4286,
7122,
4197,
22495,
29898,
29883,
29918,
2378,
29961,
3090,
2314,
363,
1373,
297,
3464,
29898,
2848,
29897,
2314,
13,
2
] |
scripts/pulp_test.py | rajiv256/cs531_proj_2 | 0 | 27582 | import pulp as pl
def create_affine_expression(coeffs, var_names):
assert len(coeffs) == len(var_names)
n = len(coeffs)
X = [pl.LpVariable(var_names[i]) for i in range(n)]
affine = pl.LpAffineExpression([(X[i], coeffs[i]) for i in range(n)])
return affine
def create_constraint(coeffs, var_names, sense, rhs):
"""Creates a constraint based on the args
Args:
coeffs: coefficients of the constraints
vars: Names of the vars
sense: +1, 0, -1 based on >=, ==, <= respectively. Or we can use pl.LpConstraintLE
rhs: numerical value of the rhs
Returns:
"""
assert len(coeffs) == len(var_names)
lhs = create_affine_expression(coeffs, var_names)
constr = pl.LpConstraint(lhs, sense=sense, rhs=rhs)
return constr
def test_affine_expression(coeffs=[1, 2, 3], var_names=['x_0', 'x_1', 'x_2']):
print(f'coeffs: {coeffs} | var_names: {var_names}')
affine = create_affine_expression(coeffs, var_names)
print(affine)
def test_constraint(coeffs=[1, 2, 3], var_names=['x_0', 'x_1', 'x_2'], sense=pl.LpConstraintLE, rhs=1):
print(f'coeffs: {coeffs} | var_names: {var_names} | sense: {sense} | rhs: {rhs}')
constraint = create_constraint(coeffs, var_names, sense, rhs)
print(constraint)
def test_0(solver_type):
model = pl.LpProblem("Example", pl.LpMaximize)
print(solver_type)
solver = pl.getSolver(solver_type)
_var = pl.LpVariable('a', 0, 1)
_var2 = pl.LpVariable('a2', 0, 2)
model += _var + _var2 <= 3
model += _var + _var2
x = _var + _var2
status = model.solve(solver)
print(pl.value(_var), pl.value(_var2))
print(pl.value(x))
return status
if __name__ == "__main__":
# Get the available solvers
av = pl.listSolvers(onlyAvailable=True)
print(av)
# Take the first available solver
status = test_0(av[0])
print(status)
test_affine_expression()
test_constraint()
| [
1,
1053,
9505,
29886,
408,
715,
13,
13,
13,
1753,
1653,
29918,
3470,
457,
29918,
17471,
29898,
1111,
12352,
29879,
29892,
722,
29918,
7039,
1125,
13,
1678,
4974,
7431,
29898,
1111,
12352,
29879,
29897,
1275,
7431,
29898,
1707,
29918,
7039,
29897,
13,
1678,
302,
353,
7431,
29898,
1111,
12352,
29879,
29897,
13,
1678,
1060,
353,
518,
572,
29889,
29931,
29886,
16174,
29898,
1707,
29918,
7039,
29961,
29875,
2314,
363,
474,
297,
3464,
29898,
29876,
4638,
13,
1678,
2756,
457,
353,
715,
29889,
29931,
29886,
27867,
457,
10960,
4197,
29898,
29990,
29961,
29875,
1402,
1302,
12352,
29879,
29961,
29875,
2314,
363,
474,
297,
3464,
29898,
29876,
29897,
2314,
13,
1678,
736,
2756,
457,
13,
13,
13,
1753,
1653,
29918,
13646,
29898,
1111,
12352,
29879,
29892,
722,
29918,
7039,
29892,
4060,
29892,
29365,
1125,
13,
1678,
9995,
9832,
1078,
263,
7276,
2729,
373,
278,
6389,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
1302,
12352,
29879,
29901,
16127,
310,
278,
11938,
13,
4706,
24987,
29901,
14706,
310,
278,
24987,
13,
4706,
4060,
29901,
718,
29896,
29892,
29871,
29900,
29892,
448,
29896,
2729,
373,
6736,
29892,
1275,
29892,
5277,
8307,
29889,
1394,
591,
508,
671,
715,
29889,
29931,
29886,
21529,
1307,
13,
4706,
29365,
29901,
16259,
995,
310,
278,
29365,
13,
13,
1678,
16969,
29901,
13,
13,
1678,
9995,
13,
1678,
4974,
7431,
29898,
1111,
12352,
29879,
29897,
1275,
7431,
29898,
1707,
29918,
7039,
29897,
13,
1678,
301,
9499,
353,
1653,
29918,
3470,
457,
29918,
17471,
29898,
1111,
12352,
29879,
29892,
722,
29918,
7039,
29897,
13,
1678,
378,
710,
353,
715,
29889,
29931,
29886,
21529,
29898,
29880,
9499,
29892,
4060,
29922,
29879,
1947,
29892,
29365,
29922,
29878,
9499,
29897,
13,
1678,
736,
378,
710,
13,
13,
13,
1753,
1243,
29918,
3470,
457,
29918,
17471,
29898,
1111,
12352,
29879,
11759,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
722,
29918,
7039,
29922,
1839,
29916,
29918,
29900,
742,
525,
29916,
29918,
29896,
742,
525,
29916,
29918,
29906,
2033,
1125,
13,
1678,
1596,
29898,
29888,
29915,
1111,
12352,
29879,
29901,
426,
1111,
12352,
29879,
29913,
891,
722,
29918,
7039,
29901,
426,
1707,
29918,
7039,
29913,
1495,
13,
1678,
2756,
457,
353,
1653,
29918,
3470,
457,
29918,
17471,
29898,
1111,
12352,
29879,
29892,
722,
29918,
7039,
29897,
13,
1678,
1596,
29898,
3470,
457,
29897,
13,
13,
13,
1753,
1243,
29918,
13646,
29898,
1111,
12352,
29879,
11759,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
1402,
722,
29918,
7039,
29922,
1839,
29916,
29918,
29900,
742,
525,
29916,
29918,
29896,
742,
525,
29916,
29918,
29906,
7464,
4060,
29922,
572,
29889,
29931,
29886,
21529,
1307,
29892,
29365,
29922,
29896,
1125,
13,
1678,
1596,
29898,
29888,
29915,
1111,
12352,
29879,
29901,
426,
1111,
12352,
29879,
29913,
891,
722,
29918,
7039,
29901,
426,
1707,
29918,
7039,
29913,
891,
4060,
29901,
426,
29879,
1947,
29913,
891,
29365,
29901,
426,
29878,
9499,
29913,
1495,
13,
1678,
7276,
353,
1653,
29918,
13646,
29898,
1111,
12352,
29879,
29892,
722,
29918,
7039,
29892,
4060,
29892,
29365,
29897,
13,
1678,
1596,
29898,
13646,
29897,
13,
13,
13,
1753,
1243,
29918,
29900,
29898,
2929,
369,
29918,
1853,
1125,
13,
1678,
1904,
353,
715,
29889,
29931,
29886,
26604,
703,
14023,
613,
715,
29889,
29931,
29886,
7976,
326,
675,
29897,
13,
1678,
1596,
29898,
2929,
369,
29918,
1853,
29897,
13,
1678,
899,
369,
353,
715,
29889,
657,
13296,
369,
29898,
2929,
369,
29918,
1853,
29897,
13,
1678,
903,
1707,
353,
715,
29889,
29931,
29886,
16174,
877,
29874,
742,
29871,
29900,
29892,
29871,
29896,
29897,
13,
1678,
903,
1707,
29906,
353,
715,
29889,
29931,
29886,
16174,
877,
29874,
29906,
742,
29871,
29900,
29892,
29871,
29906,
29897,
13,
1678,
1904,
4619,
903,
1707,
718,
903,
1707,
29906,
5277,
29871,
29941,
13,
1678,
1904,
4619,
903,
1707,
718,
903,
1707,
29906,
13,
1678,
921,
353,
903,
1707,
718,
903,
1707,
29906,
13,
1678,
4660,
353,
1904,
29889,
2929,
345,
29898,
2929,
369,
29897,
13,
1678,
1596,
29898,
572,
29889,
1767,
7373,
1707,
511,
715,
29889,
1767,
7373,
1707,
29906,
876,
13,
1678,
1596,
29898,
572,
29889,
1767,
29898,
29916,
876,
13,
1678,
736,
4660,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
396,
3617,
278,
3625,
899,
874,
13,
1678,
1029,
353,
715,
29889,
1761,
13296,
874,
29898,
6194,
27635,
29922,
5574,
29897,
13,
1678,
1596,
29898,
485,
29897,
13,
13,
1678,
396,
11190,
278,
937,
3625,
899,
369,
13,
1678,
4660,
353,
1243,
29918,
29900,
29898,
485,
29961,
29900,
2314,
13,
1678,
1596,
29898,
4882,
29897,
13,
13,
1678,
1243,
29918,
3470,
457,
29918,
17471,
580,
13,
13,
1678,
1243,
29918,
13646,
580,
13,
2
] |
tests/contrib/epidemiology/test_seir.py | johannespitz/pyro | 0 | 88734 | # Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
import pyro.distributions as dist
from pyro.contrib.epidemiology import OverdispersedSEIRModel, SimpleSEIRModel
@pytest.mark.parametrize("duration", [3, 7])
@pytest.mark.parametrize("forecast", [0, 7])
@pytest.mark.parametrize("options", [
{},
{"dct": 1.},
{"num_quant_bins": 8},
], ids=str)
def test_simple_smoke(duration, forecast, options):
population = 100
incubation_time = 2.0
recovery_time = 7.0
# Generate data.
model = SimpleSEIRModel(population, incubation_time, recovery_time,
[None] * duration)
for attempt in range(100):
data = model.generate({"R0": 1.5, "rho": 0.5})["obs"]
if data.sum():
break
assert data.sum() > 0, "failed to generate positive data"
# Infer.
model = SimpleSEIRModel(population, incubation_time, recovery_time, data)
num_samples = 5
model.fit(warmup_steps=2, num_samples=num_samples, max_tree_depth=2,
**options)
# Predict and forecast.
samples = model.predict(forecast=forecast)
assert samples["S"].shape == (num_samples, duration + forecast)
assert samples["E"].shape == (num_samples, duration + forecast)
assert samples["I"].shape == (num_samples, duration + forecast)
@pytest.mark.parametrize("duration", [3, 7])
@pytest.mark.parametrize("forecast", [0, 7])
@pytest.mark.parametrize("options", [
{},
{"dct": 1.},
{"num_quant_bins": 8},
], ids=str)
def test_overdispersed_smoke(duration, forecast, options):
population = 100
incubation_time = 2.0
recovery_time = 7.0
# Generate data.
model = OverdispersedSEIRModel(
population, incubation_time, recovery_time, [None] * duration)
for attempt in range(100):
data = model.generate({"R0": 1.5, "rho": 0.5, "k": 1.0})["obs"]
if data.sum():
break
assert data.sum() > 0, "failed to generate positive data"
# Infer.
model = OverdispersedSEIRModel(
population, incubation_time, recovery_time, data)
num_samples = 5
model.fit(warmup_steps=2, num_samples=num_samples, max_tree_depth=2,
**options)
# Predict and forecast.
samples = model.predict(forecast=forecast)
assert samples["S"].shape == (num_samples, duration + forecast)
assert samples["E"].shape == (num_samples, duration + forecast)
assert samples["I"].shape == (num_samples, duration + forecast)
@pytest.mark.parametrize("duration", [3, 7])
@pytest.mark.parametrize("forecast", [0, 7])
def test_coalescent_likelihood_smoke(duration, forecast):
population = 100
incubation_time = 2.0
recovery_time = 7.0
# Generate data.
model = OverdispersedSEIRModel(
population, incubation_time, recovery_time, [None] * duration)
for attempt in range(100):
data = model.generate({"R0": 1.5, "rho": 0.5, "k": 1.0})["obs"]
if data.sum():
break
assert data.sum() > 0, "failed to generate positive data"
leaf_times = torch.rand(5).pow(0.5) * duration
coal_times = dist.CoalescentTimes(leaf_times).sample()
coal_times = coal_times[..., torch.randperm(coal_times.size(-1))]
# Infer.
model = OverdispersedSEIRModel(
population, incubation_time, recovery_time, data,
leaf_times=leaf_times, coal_times=coal_times)
num_samples = 5
model.fit(warmup_steps=2, num_samples=num_samples, max_tree_depth=2)
# Predict and forecast.
samples = model.predict(forecast=forecast)
assert samples["S"].shape == (num_samples, duration + forecast)
assert samples["E"].shape == (num_samples, duration + forecast)
assert samples["I"].shape == (num_samples, duration + forecast)
| [
1,
396,
14187,
1266,
2866,
1091,
29560,
304,
278,
10772,
307,
2060,
29889,
13,
29937,
10937,
29928,
29990,
29899,
29931,
293,
1947,
29899,
12889,
29901,
13380,
29899,
29906,
29889,
29900,
13,
13,
5215,
11451,
1688,
13,
5215,
4842,
305,
13,
13,
5215,
11451,
307,
29889,
27691,
29879,
408,
1320,
13,
3166,
11451,
307,
29889,
21570,
29889,
1022,
680,
2460,
3002,
1053,
6811,
2218,
6774,
287,
1660,
8193,
3195,
29892,
12545,
1660,
8193,
3195,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
19708,
613,
518,
29941,
29892,
29871,
29955,
2314,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
1079,
4384,
613,
518,
29900,
29892,
29871,
29955,
2314,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
6768,
613,
518,
13,
1678,
24335,
13,
1678,
8853,
29881,
312,
1115,
29871,
29896,
29889,
1118,
13,
1678,
8853,
1949,
29918,
12150,
29918,
29890,
1144,
1115,
29871,
29947,
1118,
13,
1402,
18999,
29922,
710,
29897,
13,
1753,
1243,
29918,
12857,
29918,
3844,
6946,
29898,
19708,
29892,
29821,
579,
29892,
3987,
1125,
13,
1678,
4665,
353,
29871,
29896,
29900,
29900,
13,
1678,
5528,
431,
362,
29918,
2230,
353,
29871,
29906,
29889,
29900,
13,
1678,
24205,
29918,
2230,
353,
29871,
29955,
29889,
29900,
13,
13,
1678,
396,
3251,
403,
848,
29889,
13,
1678,
1904,
353,
12545,
1660,
8193,
3195,
29898,
7323,
2785,
29892,
5528,
431,
362,
29918,
2230,
29892,
24205,
29918,
2230,
29892,
13,
462,
9651,
518,
8516,
29962,
334,
14385,
29897,
13,
1678,
363,
4218,
297,
3464,
29898,
29896,
29900,
29900,
1125,
13,
4706,
848,
353,
1904,
29889,
17158,
3319,
29908,
29934,
29900,
1115,
29871,
29896,
29889,
29945,
29892,
376,
4650,
1115,
29871,
29900,
29889,
29945,
1800,
3366,
26290,
3108,
13,
4706,
565,
848,
29889,
2083,
7295,
13,
9651,
2867,
13,
1678,
4974,
848,
29889,
2083,
580,
1405,
29871,
29900,
29892,
376,
26061,
304,
5706,
6374,
848,
29908,
13,
13,
1678,
396,
512,
571,
29889,
13,
1678,
1904,
353,
12545,
1660,
8193,
3195,
29898,
7323,
2785,
29892,
5528,
431,
362,
29918,
2230,
29892,
24205,
29918,
2230,
29892,
848,
29897,
13,
1678,
954,
29918,
27736,
353,
29871,
29945,
13,
1678,
1904,
29889,
9202,
29898,
29893,
2817,
786,
29918,
24530,
29922,
29906,
29892,
954,
29918,
27736,
29922,
1949,
29918,
27736,
29892,
4236,
29918,
8336,
29918,
19488,
29922,
29906,
29892,
13,
795,
3579,
6768,
29897,
13,
13,
1678,
396,
21099,
919,
322,
29821,
579,
29889,
13,
1678,
11916,
353,
1904,
29889,
27711,
29898,
1079,
4384,
29922,
1079,
4384,
29897,
13,
1678,
4974,
11916,
3366,
29903,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
1678,
4974,
11916,
3366,
29923,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
1678,
4974,
11916,
3366,
29902,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
19708,
613,
518,
29941,
29892,
29871,
29955,
2314,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
1079,
4384,
613,
518,
29900,
29892,
29871,
29955,
2314,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
6768,
613,
518,
13,
1678,
24335,
13,
1678,
8853,
29881,
312,
1115,
29871,
29896,
29889,
1118,
13,
1678,
8853,
1949,
29918,
12150,
29918,
29890,
1144,
1115,
29871,
29947,
1118,
13,
1402,
18999,
29922,
710,
29897,
13,
1753,
1243,
29918,
957,
2218,
6774,
287,
29918,
3844,
6946,
29898,
19708,
29892,
29821,
579,
29892,
3987,
1125,
13,
1678,
4665,
353,
29871,
29896,
29900,
29900,
13,
1678,
5528,
431,
362,
29918,
2230,
353,
29871,
29906,
29889,
29900,
13,
1678,
24205,
29918,
2230,
353,
29871,
29955,
29889,
29900,
13,
13,
1678,
396,
3251,
403,
848,
29889,
13,
1678,
1904,
353,
6811,
2218,
6774,
287,
1660,
8193,
3195,
29898,
13,
4706,
4665,
29892,
5528,
431,
362,
29918,
2230,
29892,
24205,
29918,
2230,
29892,
518,
8516,
29962,
334,
14385,
29897,
13,
1678,
363,
4218,
297,
3464,
29898,
29896,
29900,
29900,
1125,
13,
4706,
848,
353,
1904,
29889,
17158,
3319,
29908,
29934,
29900,
1115,
29871,
29896,
29889,
29945,
29892,
376,
4650,
1115,
29871,
29900,
29889,
29945,
29892,
376,
29895,
1115,
29871,
29896,
29889,
29900,
1800,
3366,
26290,
3108,
13,
4706,
565,
848,
29889,
2083,
7295,
13,
9651,
2867,
13,
1678,
4974,
848,
29889,
2083,
580,
1405,
29871,
29900,
29892,
376,
26061,
304,
5706,
6374,
848,
29908,
13,
13,
1678,
396,
512,
571,
29889,
13,
1678,
1904,
353,
6811,
2218,
6774,
287,
1660,
8193,
3195,
29898,
13,
4706,
4665,
29892,
5528,
431,
362,
29918,
2230,
29892,
24205,
29918,
2230,
29892,
848,
29897,
13,
1678,
954,
29918,
27736,
353,
29871,
29945,
13,
1678,
1904,
29889,
9202,
29898,
29893,
2817,
786,
29918,
24530,
29922,
29906,
29892,
954,
29918,
27736,
29922,
1949,
29918,
27736,
29892,
4236,
29918,
8336,
29918,
19488,
29922,
29906,
29892,
13,
795,
3579,
6768,
29897,
13,
13,
1678,
396,
21099,
919,
322,
29821,
579,
29889,
13,
1678,
11916,
353,
1904,
29889,
27711,
29898,
1079,
4384,
29922,
1079,
4384,
29897,
13,
1678,
4974,
11916,
3366,
29903,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
1678,
4974,
11916,
3366,
29923,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
1678,
4974,
11916,
3366,
29902,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
19708,
613,
518,
29941,
29892,
29871,
29955,
2314,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
1079,
4384,
613,
518,
29900,
29892,
29871,
29955,
2314,
13,
1753,
1243,
29918,
1111,
2122,
1760,
29918,
5081,
22342,
29918,
3844,
6946,
29898,
19708,
29892,
29821,
579,
1125,
13,
1678,
4665,
353,
29871,
29896,
29900,
29900,
13,
1678,
5528,
431,
362,
29918,
2230,
353,
29871,
29906,
29889,
29900,
13,
1678,
24205,
29918,
2230,
353,
29871,
29955,
29889,
29900,
13,
13,
1678,
396,
3251,
403,
848,
29889,
13,
1678,
1904,
353,
6811,
2218,
6774,
287,
1660,
8193,
3195,
29898,
13,
4706,
4665,
29892,
5528,
431,
362,
29918,
2230,
29892,
24205,
29918,
2230,
29892,
518,
8516,
29962,
334,
14385,
29897,
13,
1678,
363,
4218,
297,
3464,
29898,
29896,
29900,
29900,
1125,
13,
4706,
848,
353,
1904,
29889,
17158,
3319,
29908,
29934,
29900,
1115,
29871,
29896,
29889,
29945,
29892,
376,
4650,
1115,
29871,
29900,
29889,
29945,
29892,
376,
29895,
1115,
29871,
29896,
29889,
29900,
1800,
3366,
26290,
3108,
13,
4706,
565,
848,
29889,
2083,
7295,
13,
9651,
2867,
13,
1678,
4974,
848,
29889,
2083,
580,
1405,
29871,
29900,
29892,
376,
26061,
304,
5706,
6374,
848,
29908,
13,
1678,
20447,
29918,
3706,
353,
4842,
305,
29889,
9502,
29898,
29945,
467,
12248,
29898,
29900,
29889,
29945,
29897,
334,
14385,
13,
1678,
17148,
29918,
3706,
353,
1320,
29889,
7967,
2122,
1760,
29164,
29898,
29500,
29918,
3706,
467,
11249,
580,
13,
1678,
17148,
29918,
3706,
353,
17148,
29918,
3706,
29961,
16361,
4842,
305,
29889,
9502,
17858,
29898,
1111,
284,
29918,
3706,
29889,
2311,
6278,
29896,
28166,
13,
13,
1678,
396,
512,
571,
29889,
13,
1678,
1904,
353,
6811,
2218,
6774,
287,
1660,
8193,
3195,
29898,
13,
4706,
4665,
29892,
5528,
431,
362,
29918,
2230,
29892,
24205,
29918,
2230,
29892,
848,
29892,
13,
4706,
20447,
29918,
3706,
29922,
29500,
29918,
3706,
29892,
17148,
29918,
3706,
29922,
1111,
284,
29918,
3706,
29897,
13,
1678,
954,
29918,
27736,
353,
29871,
29945,
13,
1678,
1904,
29889,
9202,
29898,
29893,
2817,
786,
29918,
24530,
29922,
29906,
29892,
954,
29918,
27736,
29922,
1949,
29918,
27736,
29892,
4236,
29918,
8336,
29918,
19488,
29922,
29906,
29897,
13,
13,
1678,
396,
21099,
919,
322,
29821,
579,
29889,
13,
1678,
11916,
353,
1904,
29889,
27711,
29898,
1079,
4384,
29922,
1079,
4384,
29897,
13,
1678,
4974,
11916,
3366,
29903,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
1678,
4974,
11916,
3366,
29923,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
1678,
4974,
11916,
3366,
29902,
16862,
12181,
1275,
313,
1949,
29918,
27736,
29892,
14385,
718,
29821,
579,
29897,
13,
2
] |
psy/utils/__init__.py | Alias-Alan/pypsy | 169 | 173869 | from psy.utils.probs import inverse_logistic, get_log_beta_pd, get_log_lognormal_pd, get_log_normal_pd, get_nodes_weights, \
r4beta
from psy.utils.tools import cached_property
from psy.utils.randoms import gen_item_bank
| [
1,
515,
6529,
29891,
29889,
13239,
29889,
771,
5824,
1053,
16402,
29918,
1188,
4695,
29892,
679,
29918,
1188,
29918,
3571,
29918,
15926,
29892,
679,
29918,
1188,
29918,
1188,
8945,
29918,
15926,
29892,
679,
29918,
1188,
29918,
8945,
29918,
15926,
29892,
679,
29918,
18010,
29918,
705,
5861,
29892,
320,
13,
1678,
364,
29946,
3571,
13,
3166,
6529,
29891,
29889,
13239,
29889,
8504,
1053,
22152,
29918,
6799,
13,
3166,
6529,
29891,
29889,
13239,
29889,
8172,
29879,
1053,
2531,
29918,
667,
29918,
9157,
13,
2
] |
python/lib/Lib/site-packages/django/views/static.py | truthiswill/intellij-community | 2 | 91201 | <reponame>truthiswill/intellij-community<filename>python/lib/Lib/site-packages/django/views/static.py
"""
Views and functions for serving static files. These are only to be used
during development, and SHOULD NOT be used in a production setting.
"""
import mimetypes
import os
import posixpath
import re
import stat
import urllib
import warnings
from email.Utils import parsedate_tz, mktime_tz
from django.template import loader
from django.http import Http404, HttpResponse, HttpResponseRedirect, HttpResponseNotModified
from django.template import Template, Context, TemplateDoesNotExist
from django.utils.http import http_date
from django.contrib.staticfiles.views import (directory_index,
was_modified_since, serve as staticfiles_serve)
def serve(request, path, document_root=None, show_indexes=False, insecure=False):
"""
Serve static files below a given point in the directory structure.
To use, put a URL pattern such as::
(r'^(?P<path>.*)$', 'django.views.static.serve', {'document_root' : '/path/to/my/files/'})
in your URLconf. You must provide the ``document_root`` param. You may
also set ``show_indexes`` to ``True`` if you'd like to serve a basic index
of the directory. This index view will use the template hardcoded below,
but if you'd like to override it, you can create a template called
``static/directory_index.html``.
"""
warnings.warn("The view at `django.views.static.serve` is deprecated; "
"use the path `django.contrib.staticfiles.views.serve` "
"instead.", PendingDeprecationWarning)
return staticfiles_serve(request, path, document_root, show_indexes, insecure)
| [
1,
529,
276,
1112,
420,
29958,
509,
2806,
275,
14043,
29914,
28820,
29899,
23834,
29966,
9507,
29958,
4691,
29914,
1982,
29914,
14868,
29914,
2746,
29899,
8318,
29914,
14095,
29914,
7406,
29914,
7959,
29889,
2272,
13,
15945,
29908,
13,
23825,
322,
3168,
363,
16330,
2294,
2066,
29889,
4525,
526,
871,
304,
367,
1304,
13,
29881,
3864,
5849,
29892,
322,
317,
8187,
29965,
10249,
6058,
367,
1304,
297,
263,
5802,
4444,
29889,
13,
15945,
29908,
13,
13,
5215,
286,
17528,
7384,
13,
5215,
2897,
13,
5215,
926,
861,
2084,
13,
5215,
337,
13,
5215,
1002,
13,
5215,
3142,
1982,
13,
5215,
18116,
13,
3166,
4876,
29889,
12177,
1053,
21213,
403,
29918,
17559,
29892,
286,
1193,
603,
29918,
17559,
13,
13,
3166,
9557,
29889,
6886,
1053,
23466,
13,
3166,
9557,
29889,
1124,
1053,
9056,
29946,
29900,
29946,
29892,
9056,
5103,
29892,
9056,
5103,
24735,
29892,
9056,
5103,
3664,
2111,
2164,
13,
3166,
9557,
29889,
6886,
1053,
25663,
29892,
15228,
29892,
25663,
25125,
3664,
1252,
391,
13,
3166,
9557,
29889,
13239,
29889,
1124,
1053,
1732,
29918,
1256,
13,
13,
3166,
9557,
29889,
21570,
29889,
7959,
5325,
29889,
7406,
1053,
313,
12322,
29918,
2248,
29892,
13,
1678,
471,
29918,
1545,
2164,
29918,
16076,
29892,
9080,
408,
2294,
5325,
29918,
16349,
29897,
13,
13,
13,
1753,
9080,
29898,
3827,
29892,
2224,
29892,
1842,
29918,
4632,
29922,
8516,
29892,
1510,
29918,
2248,
267,
29922,
8824,
29892,
297,
24216,
29922,
8824,
1125,
13,
1678,
9995,
13,
1678,
1816,
345,
2294,
2066,
2400,
263,
2183,
1298,
297,
278,
3884,
3829,
29889,
13,
13,
1678,
1763,
671,
29892,
1925,
263,
3988,
4766,
1316,
408,
1057,
13,
13,
4706,
313,
29878,
29915,
29985,
10780,
29925,
29966,
2084,
29958,
5575,
1262,
742,
525,
14095,
29889,
7406,
29889,
7959,
29889,
16349,
742,
11117,
3225,
29918,
4632,
29915,
584,
8207,
2084,
29914,
517,
29914,
1357,
29914,
5325,
22208,
1800,
13,
13,
1678,
297,
596,
3988,
5527,
29889,
887,
1818,
3867,
278,
4954,
3225,
29918,
4632,
16159,
1828,
29889,
887,
1122,
13,
1678,
884,
731,
4954,
4294,
29918,
2248,
267,
16159,
304,
4954,
5574,
16159,
565,
366,
29915,
29881,
763,
304,
9080,
263,
6996,
2380,
13,
1678,
310,
278,
3884,
29889,
29871,
910,
2380,
1776,
674,
671,
278,
4472,
2898,
29659,
2400,
29892,
13,
1678,
541,
565,
366,
29915,
29881,
763,
304,
5712,
372,
29892,
366,
508,
1653,
263,
4472,
2000,
13,
1678,
4954,
7959,
29914,
12322,
29918,
2248,
29889,
1420,
29952,
1412,
13,
1678,
9995,
13,
1678,
18116,
29889,
25442,
703,
1576,
1776,
472,
421,
14095,
29889,
7406,
29889,
7959,
29889,
16349,
29952,
338,
18164,
29936,
376,
13,
462,
29871,
376,
1509,
278,
2224,
421,
14095,
29889,
21570,
29889,
7959,
5325,
29889,
7406,
29889,
16349,
29952,
376,
13,
462,
29871,
376,
2611,
1479,
19602,
349,
2548,
8498,
3757,
362,
22709,
29897,
13,
1678,
736,
2294,
5325,
29918,
16349,
29898,
3827,
29892,
2224,
29892,
1842,
29918,
4632,
29892,
1510,
29918,
2248,
267,
29892,
297,
24216,
29897,
13,
2
] |
PyWeiboSpy/spy.py | veikai/PyWeiboSpy | 1 | 73824 | from .exceptions import LoginError
import base64
import binascii
import json
import math
import random
import re
import requests
import rsa
import time
SPY_HEADERS = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Connection": "keep-alive",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40 "
}
SPY_LOGIN_DATA = {
"entry": "weibo",
"gateway": 1,
"from": "",
"savestate": 7,
"qrcode_flag": False,
"useticket": 1,
"pagerefer": "",
"vsnf": 1,
"service": "miniblog",
"pwencode": "rsa2",
"sr": "1920*1080",
"encoding": "UTF-8",
"prelt": 43,
"url": "https://weibo.com/ajaxlogin.php?framelogin=1&callback=parent.sinaSSOController.feedBackUrlCallBack",
"returntype": "META"
}
class WeiboSpy:
def __init__(self):
self.prelogin_url = "https://login.sina.com.cn/sso/prelogin.php?entry=weibo&callback=sinaSSOController" \
".preloginCallBack&su={}&rsakt=mod&checkpin=1&client=ssologin.js(v1.4.19)&_={} "
self.login_url = "https://login.sina.com.cn/sso/login.php?client=ssologin.js(v1.4.19)"
self.pin_url = "https://login.sina.com.cn/cgi/pin.php?r={}&s=0&p={}"
self.post_blog_url = "https://weibo.com/aj/mblog/add?ajwvr=6&__rnd={}"
self.login_data = SPY_LOGIN_DATA
self.__session = requests.Session()
self.headers = SPY_HEADERS
def login(self, username: str, password: str):
su = base64.b64encode(username.encode("utf8")).decode("utf8")
self.login_data["su"] = su
resp = self.__session.get(self.prelogin_url.format(su, int(time.time() * 1000)), headers=self.headers)
if resp.status_code != 200:
raise LoginError(f"prelogin status code: {resp.status_code}")
resp_str = resp.content.decode("utf8")[len("sinaSSOController.preloginCallBack("):-1]
prelogin_data = json.loads(resp_str)
self.login_data["nonce"] = prelogin_data["nonce"]
self.login_data["rsakv"] = prelogin_data["rsakv"]
self.login_data["servertime"] = prelogin_data["servertime"]
self.login_data["pcid"] = prelogin_data["pcid"]
rsa_publickey = int(prelogin_data["pubkey"], 16)
key = rsa.PublicKey(rsa_publickey, 65537)
data = f"{prelogin_data['servertime']}\t{prelogin_data['nonce']}\n{password}".encode("utf8")
sp = binascii.b2a_hex(rsa.encrypt(data, key)).decode("utf8")
self.login_data["sp"] = sp
resp = self.__session.get(
self.pin_url.format(math.floor(random.random() * 100000000), prelogin_data["pcid"]), headers=self.headers)
if resp.status_code != 200:
raise LoginError(f"pin status code: {resp.status_code}")
with open("pin.png", "wb") as wf:
wf.write(resp.content)
door = input("请输入验证码:")
self.login_data["door"] = door
resp = self.__session.post(self.login_url, data=self.login_data, headers=self.headers)
pa = r'location\.replace\([\'"](.*?)[\'"]\)'
redirect_url = re.findall(pa, resp.content.decode("GBK"))[0]
resp = self.__session.get(redirect_url, headers=self.headers)
pa = r'setCrossDomainUrlList\((.*?)\)'
redirect_str = re.findall(pa, resp.content.decode("GBK"))[0]
redirect_json = json.loads(redirect_str)
redirect_url = f"{redirect_json['arrURL'][0]}&callback=sinaSSOController.doCrossDomainCallBack&scriptId" \
f"=ssoscript0&client=ssologin.js(v1.4.19)&_={int(time.time()*1000)}"
resp = self.__session.get(redirect_url, headers=self.headers)
print(resp.text)
def __upload_image(self, image_path):
with open(image_path, "rb") as rf:
image_data = base64.b64encode(rf.read())
my_headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Connection": "keep-alive",
"Content-Length": str(len(image_data)),
"Content-Type": "multipart/form-data",
"Host": "picupload.weibo.com",
"Origin": "https://weibo.com",
"Referer": "https://weibo.com/u/7459826781/home",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40"
}
post_data = {
"b64_data": image_data
}
url = "http://picupload.service.weibo.com/interface/pic_upload.php?ori=1&mime=image%2Fjpeg&data=base64&url=0&markpos=1&logo=&nick=0&marks=1&app=miniblog"
resp = self.__session.post(url, data=post_data, headers=my_headers)
print(resp.text)
def post_blog(self, text: str):
my_headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Connection": "keep-alive",
"Content-Length": "600",
"Content-Type": "application/x-www-form-urlencoded",
"Origin": "http://www.weibo.com",
"Referer": "http://www.weibo.com/u/7459826781/home?wvr=5",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 Safari/537.36 Edg/84.0.522.40",
"X-Requested-With": "XMLHttpRequest"
}
url = f"http://www.weibo.com/aj/mblog/add?ajwvr=6&__rnd={int(time.time() * 1000)}"
post_data = {
"location": "v6_content_home",
"text": text,
"appkey": "",
"stype_type": 1,
"pic_id": "0088QFINgy1ggwavrqa7ij31c00u0keo|0088QFINgy1ggwavrk6ctj31z40u0e81"
"|0088QFINgy1ggwavriwj5j31c00u0qjv|0088QFINgy1ggwavreljhj31hc0u0tm8"
"|0088QFINgy1ggwavuqkacj31hc0u04qz|0088QFINgy1ggwavt15zij31hc0u0b2a"
"|0088QFINgy1ggwavtezjbj31hc0u0hdw|0088QFINgy1ggwavsm519j31hc0u04qp"
"|0088QFINgy1ggwavsearjj31z40u0h12",
"tid": "",
"pdetail": "",
"mid": "",
"isReEdit": False,
"rank": 0,
"rankid": "",
"module": "stissue",
"pub_source": "main_",
"updata_img_num": 9,
"pub_type": "dialog",
"isPri": 0,
"_t": 0
}
resp = self.__session.post(url, data=post_data, headers=my_headers) | [
1,
515,
869,
11739,
29879,
1053,
19130,
2392,
13,
5215,
2967,
29953,
29946,
13,
5215,
9016,
294,
18869,
13,
5215,
4390,
13,
5215,
5844,
13,
5215,
4036,
13,
5215,
337,
13,
5215,
7274,
13,
5215,
364,
4977,
13,
5215,
931,
13,
13,
13,
5550,
29979,
29918,
23252,
23598,
353,
426,
13,
1678,
376,
23965,
1115,
376,
3877,
29930,
613,
13,
1678,
376,
23965,
29899,
14934,
1115,
376,
29887,
7554,
29892,
822,
9632,
29892,
1506,
613,
13,
1678,
376,
23965,
29899,
21233,
1115,
376,
17599,
29899,
13778,
29892,
17599,
29936,
29939,
29922,
29900,
29889,
29929,
29892,
264,
29936,
29939,
29922,
29900,
29889,
29947,
29892,
264,
29899,
7210,
29936,
29939,
29922,
29900,
29889,
29955,
29892,
264,
29899,
3308,
29936,
29939,
29922,
29900,
29889,
29953,
613,
13,
1678,
376,
5350,
1115,
376,
17462,
29899,
284,
573,
613,
13,
1678,
376,
2659,
29899,
19661,
1115,
376,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
7685,
405,
29911,
29871,
29896,
29900,
29889,
29900,
29936,
8892,
29953,
29946,
29936,
921,
29953,
29946,
29897,
12113,
3609,
13117,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
376,
13,
462,
29871,
376,
1451,
4871,
29914,
29947,
29946,
29889,
29900,
29889,
29946,
29896,
29946,
29955,
29889,
29947,
29929,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
2155,
29887,
29914,
29947,
29946,
29889,
29900,
29889,
29945,
29906,
29906,
29889,
29946,
29900,
376,
13,
29913,
13,
5550,
29979,
29918,
14480,
1177,
29918,
14573,
353,
426,
13,
1678,
376,
8269,
1115,
376,
705,
747,
29877,
613,
13,
1678,
376,
17062,
1582,
1115,
29871,
29896,
29892,
13,
1678,
376,
3166,
1115,
12633,
13,
1678,
376,
29879,
485,
342,
403,
1115,
29871,
29955,
29892,
13,
1678,
376,
29939,
29878,
401,
29918,
15581,
1115,
7700,
29892,
13,
1678,
376,
11616,
8522,
1115,
29871,
29896,
29892,
13,
1678,
376,
13573,
406,
571,
1115,
12633,
13,
1678,
376,
4270,
29876,
29888,
1115,
29871,
29896,
29892,
13,
1678,
376,
5509,
1115,
376,
1195,
747,
1188,
613,
13,
1678,
376,
29886,
29893,
12508,
1115,
376,
2288,
29874,
29906,
613,
13,
1678,
376,
21935,
1115,
376,
29896,
29929,
29906,
29900,
29930,
29896,
29900,
29947,
29900,
613,
13,
1678,
376,
22331,
1115,
376,
10496,
29899,
29947,
613,
13,
1678,
376,
1457,
1896,
1115,
29871,
29946,
29941,
29892,
13,
1678,
376,
2271,
1115,
376,
991,
597,
705,
747,
29877,
29889,
510,
29914,
6538,
7507,
29889,
1961,
29973,
22328,
295,
468,
262,
29922,
29896,
29987,
14035,
29922,
3560,
29889,
29879,
1099,
1799,
29949,
2956,
29889,
18798,
5841,
5983,
5594,
5841,
613,
13,
1678,
376,
2267,
332,
593,
668,
1115,
376,
2303,
6040,
29908,
13,
29913,
13,
13,
13,
1990,
1334,
747,
29877,
29903,
2272,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
1457,
7507,
29918,
2271,
353,
376,
991,
597,
7507,
29889,
29879,
1099,
29889,
510,
29889,
18038,
29914,
29879,
578,
29914,
1457,
7507,
29889,
1961,
29973,
8269,
29922,
705,
747,
29877,
29987,
14035,
29922,
29879,
1099,
1799,
29949,
2956,
29908,
320,
13,
462,
9651,
11393,
1457,
7507,
5594,
5841,
29987,
2146,
3790,
15704,
2288,
5867,
29922,
1545,
29987,
3198,
12687,
29922,
29896,
29987,
4645,
29922,
893,
1189,
262,
29889,
1315,
29898,
29894,
29896,
29889,
29946,
29889,
29896,
29929,
26927,
29918,
3790,
29913,
376,
13,
4706,
1583,
29889,
7507,
29918,
2271,
353,
376,
991,
597,
7507,
29889,
29879,
1099,
29889,
510,
29889,
18038,
29914,
29879,
578,
29914,
7507,
29889,
1961,
29973,
4645,
29922,
893,
1189,
262,
29889,
1315,
29898,
29894,
29896,
29889,
29946,
29889,
29896,
29929,
5513,
13,
4706,
1583,
29889,
12687,
29918,
2271,
353,
376,
991,
597,
7507,
29889,
29879,
1099,
29889,
510,
29889,
18038,
29914,
20006,
29914,
12687,
29889,
1961,
29973,
29878,
3790,
15704,
29879,
29922,
29900,
29987,
29886,
3790,
5038,
13,
4706,
1583,
29889,
2490,
29918,
7312,
29918,
2271,
353,
376,
991,
597,
705,
747,
29877,
29889,
510,
29914,
1175,
29914,
29885,
7312,
29914,
1202,
29973,
1175,
29893,
13416,
29922,
29953,
29987,
1649,
29878,
299,
3790,
5038,
13,
4706,
1583,
29889,
7507,
29918,
1272,
353,
10937,
29979,
29918,
14480,
1177,
29918,
14573,
13,
4706,
1583,
17255,
7924,
353,
7274,
29889,
7317,
580,
13,
4706,
1583,
29889,
13662,
353,
10937,
29979,
29918,
23252,
23598,
13,
13,
1678,
822,
6464,
29898,
1311,
29892,
8952,
29901,
851,
29892,
4800,
29901,
851,
1125,
13,
4706,
480,
353,
2967,
29953,
29946,
29889,
29890,
29953,
29946,
12508,
29898,
6786,
29889,
12508,
703,
9420,
29947,
1159,
467,
13808,
703,
9420,
29947,
1159,
13,
4706,
1583,
29889,
7507,
29918,
1272,
3366,
2146,
3108,
353,
480,
13,
4706,
4613,
353,
1583,
17255,
7924,
29889,
657,
29898,
1311,
29889,
1457,
7507,
29918,
2271,
29889,
4830,
29898,
2146,
29892,
938,
29898,
2230,
29889,
2230,
580,
334,
29871,
29896,
29900,
29900,
29900,
8243,
9066,
29922,
1311,
29889,
13662,
29897,
13,
4706,
565,
4613,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
29901,
13,
9651,
12020,
19130,
2392,
29898,
29888,
29908,
1457,
7507,
4660,
775,
29901,
426,
13713,
29889,
4882,
29918,
401,
27195,
13,
4706,
4613,
29918,
710,
353,
4613,
29889,
3051,
29889,
13808,
703,
9420,
29947,
1159,
29961,
2435,
703,
29879,
1099,
1799,
29949,
2956,
29889,
1457,
7507,
5594,
5841,
703,
1125,
29899,
29896,
29962,
13,
4706,
758,
7507,
29918,
1272,
353,
4390,
29889,
18132,
29898,
13713,
29918,
710,
29897,
13,
4706,
1583,
29889,
7507,
29918,
1272,
3366,
5464,
346,
3108,
353,
758,
7507,
29918,
1272,
3366,
5464,
346,
3108,
13,
4706,
1583,
29889,
7507,
29918,
1272,
3366,
2288,
557,
29894,
3108,
353,
758,
7507,
29918,
1272,
3366,
2288,
557,
29894,
3108,
13,
4706,
1583,
29889,
7507,
29918,
1272,
3366,
643,
1765,
603,
3108,
353,
758,
7507,
29918,
1272,
3366,
643,
1765,
603,
3108,
13,
4706,
1583,
29889,
7507,
29918,
1272,
3366,
6739,
333,
3108,
353,
758,
7507,
29918,
1272,
3366,
6739,
333,
3108,
13,
4706,
364,
4977,
29918,
3597,
1989,
353,
938,
29898,
1457,
7507,
29918,
1272,
3366,
5467,
1989,
12436,
29871,
29896,
29953,
29897,
13,
4706,
1820,
353,
364,
4977,
29889,
19858,
2558,
29898,
2288,
29874,
29918,
3597,
1989,
29892,
29871,
29953,
29945,
29945,
29941,
29955,
29897,
13,
4706,
848,
353,
285,
29908,
29912,
1457,
7507,
29918,
1272,
1839,
643,
1765,
603,
2033,
1012,
29873,
29912,
1457,
7507,
29918,
1272,
1839,
5464,
346,
2033,
1012,
29876,
29912,
5630,
29913,
1642,
12508,
703,
9420,
29947,
1159,
13,
4706,
805,
353,
9016,
294,
18869,
29889,
29890,
29906,
29874,
29918,
20970,
29898,
2288,
29874,
29889,
3977,
4641,
29898,
1272,
29892,
1820,
8106,
13808,
703,
9420,
29947,
1159,
13,
4706,
1583,
29889,
7507,
29918,
1272,
3366,
1028,
3108,
353,
805,
13,
4706,
4613,
353,
1583,
17255,
7924,
29889,
657,
29898,
13,
9651,
1583,
29889,
12687,
29918,
2271,
29889,
4830,
29898,
755,
29889,
14939,
29898,
8172,
29889,
8172,
580,
334,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
511,
758,
7507,
29918,
1272,
3366,
6739,
333,
3108,
511,
9066,
29922,
1311,
29889,
13662,
29897,
13,
4706,
565,
4613,
29889,
4882,
29918,
401,
2804,
29871,
29906,
29900,
29900,
29901,
13,
9651,
12020,
19130,
2392,
29898,
29888,
29908,
12687,
4660,
775,
29901,
426,
13713,
29889,
4882,
29918,
401,
27195,
13,
4706,
411,
1722,
703,
12687,
29889,
2732,
613,
376,
29893,
29890,
1159,
408,
281,
29888,
29901,
13,
9651,
281,
29888,
29889,
3539,
29898,
13713,
29889,
3051,
29897,
13,
4706,
3050,
353,
1881,
703,
31088,
31573,
30752,
236,
173,
143,
235,
178,
132,
31183,
29901,
1159,
13,
4706,
1583,
29889,
7507,
29918,
1272,
3366,
17433,
3108,
353,
3050,
13,
4706,
4613,
353,
1583,
17255,
7924,
29889,
2490,
29898,
1311,
29889,
7507,
29918,
2271,
29892,
848,
29922,
1311,
29889,
7507,
29918,
1272,
29892,
9066,
29922,
1311,
29889,
13662,
29897,
13,
4706,
3300,
353,
364,
29915,
5479,
23301,
6506,
29905,
4197,
29905,
11838,
850,
5575,
7897,
7110,
29915,
3108,
7244,
29915,
13,
4706,
6684,
29918,
2271,
353,
337,
29889,
2886,
497,
29898,
3274,
29892,
4613,
29889,
3051,
29889,
13808,
703,
7210,
29968,
5783,
29961,
29900,
29962,
13,
4706,
4613,
353,
1583,
17255,
7924,
29889,
657,
29898,
17886,
29918,
2271,
29892,
9066,
29922,
1311,
29889,
13662,
29897,
13,
4706,
3300,
353,
364,
29915,
842,
29907,
2124,
15951,
5983,
1293,
29905,
3552,
5575,
29973,
2144,
16029,
13,
4706,
6684,
29918,
710,
353,
337,
29889,
2886,
497,
29898,
3274,
29892,
4613,
29889,
3051,
29889,
13808,
703,
7210,
29968,
5783,
29961,
29900,
29962,
13,
4706,
6684,
29918,
3126,
353,
4390,
29889,
18132,
29898,
17886,
29918,
710,
29897,
13,
4706,
6684,
29918,
2271,
353,
285,
29908,
29912,
17886,
29918,
3126,
1839,
2749,
4219,
2033,
29961,
29900,
12258,
29987,
14035,
29922,
29879,
1099,
1799,
29949,
2956,
29889,
1867,
29907,
2124,
15951,
5594,
5841,
29987,
2154,
1204,
29908,
320,
13,
462,
539,
285,
29908,
29922,
893,
359,
924,
29900,
29987,
4645,
29922,
893,
1189,
262,
29889,
1315,
29898,
29894,
29896,
29889,
29946,
29889,
29896,
29929,
26927,
29918,
3790,
524,
29898,
2230,
29889,
2230,
580,
29930,
29896,
29900,
29900,
29900,
2915,
29908,
13,
4706,
4613,
353,
1583,
17255,
7924,
29889,
657,
29898,
17886,
29918,
2271,
29892,
9066,
29922,
1311,
29889,
13662,
29897,
13,
4706,
1596,
29898,
13713,
29889,
726,
29897,
13,
13,
1678,
822,
4770,
9009,
29918,
3027,
29898,
1311,
29892,
1967,
29918,
2084,
1125,
13,
4706,
411,
1722,
29898,
3027,
29918,
2084,
29892,
376,
6050,
1159,
408,
364,
29888,
29901,
13,
9651,
1967,
29918,
1272,
353,
2967,
29953,
29946,
29889,
29890,
29953,
29946,
12508,
29898,
9600,
29889,
949,
3101,
13,
4706,
590,
29918,
13662,
353,
426,
13,
9651,
376,
23965,
1115,
965,
376,
3877,
29930,
613,
13,
9651,
376,
23965,
29899,
14934,
1115,
29871,
376,
29887,
7554,
29892,
822,
9632,
613,
13,
9651,
376,
23965,
29899,
21233,
1115,
29871,
376,
17599,
29899,
13778,
29892,
17599,
29936,
29939,
29922,
29900,
29889,
29929,
29892,
264,
29936,
29939,
29922,
29900,
29889,
29947,
29892,
264,
29899,
7210,
29936,
29939,
29922,
29900,
29889,
29955,
29892,
264,
29899,
3308,
29936,
29939,
29922,
29900,
29889,
29953,
613,
13,
9651,
376,
5350,
1115,
539,
376,
17462,
29899,
284,
573,
613,
13,
9651,
376,
3916,
29899,
6513,
1115,
259,
851,
29898,
2435,
29898,
3027,
29918,
1272,
8243,
13,
9651,
376,
3916,
29899,
1542,
1115,
268,
376,
18056,
442,
29914,
689,
29899,
1272,
613,
13,
9651,
376,
8514,
1115,
632,
376,
16447,
9009,
29889,
705,
747,
29877,
29889,
510,
613,
13,
9651,
376,
23182,
1115,
965,
376,
991,
597,
705,
747,
29877,
29889,
510,
613,
13,
9651,
376,
1123,
571,
261,
1115,
3986,
376,
991,
597,
705,
747,
29877,
29889,
510,
29914,
29884,
29914,
29955,
29946,
29945,
29929,
29947,
29906,
29953,
29955,
29947,
29896,
29914,
5184,
613,
13,
9651,
376,
2659,
29899,
19661,
1115,
539,
376,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
7685,
405,
29911,
29871,
29896,
29900,
29889,
29900,
29936,
8892,
29953,
29946,
29936,
921,
29953,
29946,
29897,
12113,
3609,
13117,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
376,
13,
462,
18884,
376,
1451,
4871,
29914,
29947,
29946,
29889,
29900,
29889,
29946,
29896,
29946,
29955,
29889,
29947,
29929,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
2155,
29887,
29914,
29947,
29946,
29889,
29900,
29889,
29945,
29906,
29906,
29889,
29946,
29900,
29908,
13,
4706,
500,
13,
4706,
1400,
29918,
1272,
353,
426,
13,
9651,
376,
29890,
29953,
29946,
29918,
1272,
1115,
1967,
29918,
1272,
13,
4706,
500,
13,
4706,
3142,
353,
376,
1124,
597,
16447,
9009,
29889,
5509,
29889,
705,
747,
29877,
29889,
510,
29914,
13248,
29914,
16447,
29918,
9009,
29889,
1961,
29973,
4170,
29922,
29896,
29987,
29885,
603,
29922,
3027,
29995,
29906,
29943,
26568,
29987,
1272,
29922,
3188,
29953,
29946,
29987,
2271,
29922,
29900,
29987,
3502,
1066,
29922,
29896,
29987,
14569,
29332,
19254,
29922,
29900,
29987,
22848,
29922,
29896,
29987,
932,
29922,
1195,
747,
1188,
29908,
13,
4706,
4613,
353,
1583,
17255,
7924,
29889,
2490,
29898,
2271,
29892,
848,
29922,
2490,
29918,
1272,
29892,
9066,
29922,
1357,
29918,
13662,
29897,
13,
4706,
1596,
29898,
13713,
29889,
726,
29897,
13,
13,
1678,
822,
1400,
29918,
7312,
29898,
1311,
29892,
1426,
29901,
851,
1125,
13,
4706,
590,
29918,
13662,
353,
426,
13,
9651,
376,
23965,
1115,
376,
3877,
29930,
613,
13,
9651,
376,
23965,
29899,
14934,
1115,
376,
29887,
7554,
29892,
822,
9632,
613,
13,
9651,
376,
23965,
29899,
21233,
1115,
376,
17599,
29899,
13778,
29892,
17599,
29936,
29939,
29922,
29900,
29889,
29929,
29892,
264,
29936,
29939,
29922,
29900,
29889,
29947,
29892,
264,
29899,
7210,
29936,
29939,
29922,
29900,
29889,
29955,
29892,
264,
29899,
3308,
29936,
29939,
29922,
29900,
29889,
29953,
613,
13,
9651,
376,
5350,
1115,
376,
17462,
29899,
284,
573,
613,
13,
9651,
376,
3916,
29899,
6513,
1115,
376,
29953,
29900,
29900,
613,
13,
9651,
376,
3916,
29899,
1542,
1115,
376,
6214,
29914,
29916,
29899,
1636,
29899,
689,
29899,
2271,
26716,
613,
13,
9651,
376,
23182,
1115,
376,
1124,
597,
1636,
29889,
705,
747,
29877,
29889,
510,
613,
13,
9651,
376,
1123,
571,
261,
1115,
376,
1124,
597,
1636,
29889,
705,
747,
29877,
29889,
510,
29914,
29884,
29914,
29955,
29946,
29945,
29929,
29947,
29906,
29953,
29955,
29947,
29896,
29914,
5184,
29973,
29893,
13416,
29922,
29945,
613,
13,
9651,
376,
2659,
29899,
19661,
1115,
376,
29924,
2112,
2911,
29914,
29945,
29889,
29900,
313,
7685,
405,
29911,
29871,
29896,
29900,
29889,
29900,
29936,
8892,
29953,
29946,
29936,
921,
29953,
29946,
29897,
12113,
3609,
13117,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
313,
29968,
7020,
29892,
763,
1879,
27604,
29897,
10228,
29914,
29947,
29946,
29889,
29900,
29889,
29946,
29896,
29946,
29955,
29889,
29947,
29929,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
2155,
29887,
29914,
29947,
29946,
29889,
29900,
29889,
29945,
29906,
29906,
29889,
29946,
29900,
613,
13,
9651,
376,
29990,
29899,
3089,
287,
29899,
3047,
1115,
376,
9165,
26021,
29908,
13,
4706,
500,
13,
4706,
3142,
353,
285,
29908,
1124,
597,
1636,
29889,
705,
747,
29877,
29889,
510,
29914,
1175,
29914,
29885,
7312,
29914,
1202,
29973,
1175,
29893,
13416,
29922,
29953,
29987,
1649,
29878,
299,
3790,
524,
29898,
2230,
29889,
2230,
580,
334,
29871,
29896,
29900,
29900,
29900,
2915,
29908,
13,
4706,
1400,
29918,
1272,
353,
426,
13,
9651,
376,
5479,
1115,
376,
29894,
29953,
29918,
3051,
29918,
5184,
613,
13,
9651,
376,
726,
1115,
1426,
29892,
13,
9651,
376,
932,
1989,
1115,
12633,
13,
9651,
376,
303,
668,
29918,
1853,
1115,
29871,
29896,
29892,
13,
9651,
376,
16447,
29918,
333,
1115,
376,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
29878,
25621,
29955,
823,
29941,
29896,
29883,
29900,
29900,
29884,
29900,
446,
29877,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
29878,
29895,
29953,
312,
29926,
29941,
29896,
29920,
29946,
29900,
29884,
29900,
29872,
29947,
29896,
29908,
13,
462,
418,
376,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
374,
29893,
29926,
29945,
29926,
29941,
29896,
29883,
29900,
29900,
29884,
29900,
29939,
29926,
29894,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
2674,
29926,
29882,
29926,
29941,
29896,
29882,
29883,
29900,
29884,
29900,
18276,
29947,
29908,
13,
462,
418,
376,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
29884,
29939,
29895,
562,
29926,
29941,
29896,
29882,
29883,
29900,
29884,
29900,
29946,
29939,
29920,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
29873,
29896,
29945,
29920,
823,
29941,
29896,
29882,
29883,
29900,
29884,
29900,
29890,
29906,
29874,
29908,
13,
462,
418,
376,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
371,
29920,
16761,
29926,
29941,
29896,
29882,
29883,
29900,
29884,
29900,
16440,
29893,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
3844,
29945,
29896,
29929,
29926,
29941,
29896,
29882,
29883,
29900,
29884,
29900,
29946,
29939,
29886,
29908,
13,
462,
418,
376,
29989,
29900,
29900,
29947,
29947,
29984,
29943,
1177,
1927,
29896,
1505,
29893,
485,
344,
279,
29926,
29926,
29941,
29896,
29920,
29946,
29900,
29884,
29900,
29882,
29896,
29906,
613,
13,
9651,
376,
17681,
1115,
12633,
13,
9651,
376,
29886,
16432,
1115,
12633,
13,
9651,
376,
6563,
1115,
12633,
13,
9651,
376,
275,
1123,
6103,
1115,
7700,
29892,
13,
9651,
376,
10003,
1115,
29871,
29900,
29892,
13,
9651,
376,
10003,
333,
1115,
12633,
13,
9651,
376,
5453,
1115,
376,
303,
15118,
613,
13,
9651,
376,
5467,
29918,
4993,
1115,
376,
3396,
29918,
613,
13,
9651,
376,
786,
1272,
29918,
2492,
29918,
1949,
1115,
29871,
29929,
29892,
13,
9651,
376,
5467,
29918,
1853,
1115,
376,
15901,
613,
13,
9651,
376,
275,
29925,
374,
1115,
29871,
29900,
29892,
13,
9651,
11119,
29873,
1115,
29871,
29900,
13,
4706,
500,
13,
4706,
4613,
353,
1583,
17255,
7924,
29889,
2490,
29898,
2271,
29892,
848,
29922,
2490,
29918,
1272,
29892,
9066,
29922,
1357,
29918,
13662,
29897,
2
] |
yolov3/coco_metric.py | LiuChiachi/hapi | 92 | 142116 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import json
from pycocotools.cocoeval import COCOeval
from pycocotools.coco import COCO
import logging
FORMAT = '%(asctime)s-%(levelname)s: %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
logger = logging.getLogger(__name__)
__all__ = ['COCOMetric']
OUTFILE = './bbox.json'
# COCOMetric behavior is different from Metric defined in high
# level API, COCOMetric will and con only accumulate on the epoch
# end, so we impliment COCOMetric as not a high level API Metric
class COCOMetric():
"""
Metrci for MS-COCO dataset, only support update with batch
size as 1.
Args:
anno_path(str): path to COCO annotation json file
with_background(bool): whether load category id with
background as 0, default True
"""
def __init__(self, anno_path, with_background=True, **kwargs):
self.anno_path = anno_path
self.with_background = with_background
self.bbox_results = []
self.coco_gt = COCO(anno_path)
cat_ids = self.coco_gt.getCatIds()
self.clsid2catid = dict({
i + int(with_background): catid
for i, catid in enumerate(cat_ids)
})
def update(self, img_id, bboxes):
assert img_id.shape[0] == 1, \
"COCOMetric can only update with batch size = 1"
if bboxes.shape[1] != 6:
# no bbox detected in this batch
return
img_id = int(img_id)
for i in range(bboxes.shape[0]):
dt = bboxes[i, :]
clsid, score, xmin, ymin, xmax, ymax = dt.tolist()
catid = (self.clsid2catid[int(clsid)])
w = xmax - xmin + 1
h = ymax - ymin + 1
bbox = [xmin, ymin, w, h]
coco_res = {
'image_id': img_id,
'category_id': catid,
'bbox': bbox,
'score': score
}
self.bbox_results.append(coco_res)
def reset(self):
self.bbox_results = []
def accumulate(self):
if len(self.bbox_results) == 0:
logger.warning("The number of valid bbox detected is zero.\n \
Please use reasonable model and check input data.\n \
stop COCOMetric accumulate!")
return [0.0]
with open(OUTFILE, 'w') as f:
json.dump(self.bbox_results, f)
map_stats = self.cocoapi_eval(OUTFILE, 'bbox', coco_gt=self.coco_gt)
# flush coco evaluation result
sys.stdout.flush()
self.result = map_stats[0]
return [self.result]
def cocoapi_eval(self, jsonfile, style, coco_gt=None, anno_file=None):
assert coco_gt != None or anno_file != None
if coco_gt == None:
coco_gt = COCO(anno_file)
logger.info("Start evaluate...")
coco_dt = coco_gt.loadRes(jsonfile)
coco_eval = COCOeval(coco_gt, coco_dt, style)
coco_eval.evaluate()
coco_eval.accumulate()
coco_eval.summarize()
return coco_eval.stats
| [
1,
396,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29900,
349,
22352,
29925,
22352,
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,
268,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29937,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
29937,
2823,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
29937,
27028,
1090,
278,
19245,
29889,
13,
13,
5215,
10876,
13,
5215,
4390,
13,
3166,
282,
11078,
542,
327,
8789,
29889,
29883,
6235,
14513,
1053,
4810,
3217,
14513,
13,
3166,
282,
11078,
542,
327,
8789,
29889,
29883,
6235,
1053,
4810,
3217,
13,
13,
5215,
12183,
13,
19094,
1299,
353,
14210,
29898,
294,
312,
603,
29897,
29879,
19222,
29898,
5563,
978,
29897,
29879,
29901,
1273,
29898,
4906,
29897,
29879,
29915,
13,
21027,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
11690,
29892,
3402,
29922,
19094,
1299,
29897,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
1649,
497,
1649,
353,
6024,
3217,
3217,
10095,
2200,
2033,
13,
13,
12015,
7724,
353,
19283,
29890,
1884,
29889,
3126,
29915,
13,
13,
13,
29937,
4810,
3217,
10095,
2200,
6030,
338,
1422,
515,
4737,
2200,
3342,
297,
1880,
13,
29937,
3233,
3450,
29892,
4810,
3217,
10095,
2200,
674,
322,
378,
871,
18414,
5987,
373,
278,
21502,
305,
13,
29937,
1095,
29892,
577,
591,
13374,
2073,
4810,
3217,
10095,
2200,
408,
451,
263,
1880,
3233,
3450,
4737,
2200,
13,
1990,
4810,
3217,
10095,
2200,
7295,
13,
1678,
9995,
13,
1678,
4737,
29878,
455,
363,
10888,
29899,
3217,
3217,
8783,
29892,
871,
2304,
2767,
411,
9853,
13,
1678,
2159,
408,
29871,
29896,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
4706,
12327,
29918,
2084,
29898,
710,
1125,
2224,
304,
4810,
3217,
17195,
4390,
934,
13,
4706,
411,
29918,
7042,
29898,
11227,
1125,
3692,
2254,
7663,
1178,
411,
13,
462,
1669,
3239,
408,
29871,
29900,
29892,
2322,
5852,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
12327,
29918,
2084,
29892,
411,
29918,
7042,
29922,
5574,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
7665,
29918,
2084,
353,
12327,
29918,
2084,
13,
4706,
1583,
29889,
2541,
29918,
7042,
353,
411,
29918,
7042,
13,
4706,
1583,
29889,
29890,
1884,
29918,
9902,
353,
5159,
13,
13,
4706,
1583,
29889,
29883,
6235,
29918,
4141,
353,
4810,
3217,
29898,
7665,
29918,
2084,
29897,
13,
4706,
6635,
29918,
4841,
353,
1583,
29889,
29883,
6235,
29918,
4141,
29889,
657,
9694,
21943,
580,
13,
4706,
1583,
29889,
25932,
333,
29906,
4117,
333,
353,
9657,
3319,
13,
9651,
474,
718,
938,
29898,
2541,
29918,
7042,
1125,
6635,
333,
13,
9651,
363,
474,
29892,
6635,
333,
297,
26985,
29898,
4117,
29918,
4841,
29897,
13,
4706,
5615,
13,
13,
1678,
822,
2767,
29898,
1311,
29892,
10153,
29918,
333,
29892,
289,
1884,
267,
1125,
13,
4706,
4974,
10153,
29918,
333,
29889,
12181,
29961,
29900,
29962,
1275,
29871,
29896,
29892,
320,
13,
9651,
376,
3217,
3217,
10095,
2200,
508,
871,
2767,
411,
9853,
2159,
353,
29871,
29896,
29908,
13,
4706,
565,
289,
1884,
267,
29889,
12181,
29961,
29896,
29962,
2804,
29871,
29953,
29901,
13,
9651,
396,
694,
289,
1884,
17809,
297,
445,
9853,
13,
9651,
736,
13,
13,
4706,
10153,
29918,
333,
353,
938,
29898,
2492,
29918,
333,
29897,
13,
4706,
363,
474,
297,
3464,
29898,
29890,
1884,
267,
29889,
12181,
29961,
29900,
29962,
1125,
13,
9651,
11636,
353,
289,
1884,
267,
29961,
29875,
29892,
584,
29962,
13,
9651,
1067,
29879,
333,
29892,
8158,
29892,
921,
1195,
29892,
343,
1195,
29892,
921,
3317,
29892,
343,
3317,
353,
11636,
29889,
25027,
391,
580,
13,
9651,
6635,
333,
353,
313,
1311,
29889,
25932,
333,
29906,
4117,
333,
29961,
524,
29898,
25932,
333,
29897,
2314,
13,
13,
9651,
281,
353,
921,
3317,
448,
921,
1195,
718,
29871,
29896,
13,
9651,
298,
353,
343,
3317,
448,
343,
1195,
718,
29871,
29896,
13,
9651,
289,
1884,
353,
518,
29916,
1195,
29892,
343,
1195,
29892,
281,
29892,
298,
29962,
13,
9651,
274,
6235,
29918,
690,
353,
426,
13,
18884,
525,
3027,
29918,
333,
2396,
10153,
29918,
333,
29892,
13,
18884,
525,
7320,
29918,
333,
2396,
6635,
333,
29892,
13,
18884,
525,
29890,
1884,
2396,
289,
1884,
29892,
13,
18884,
525,
13628,
2396,
8158,
13,
9651,
500,
13,
9651,
1583,
29889,
29890,
1884,
29918,
9902,
29889,
4397,
29898,
29883,
6235,
29918,
690,
29897,
13,
13,
1678,
822,
10092,
29898,
1311,
1125,
13,
4706,
1583,
29889,
29890,
1884,
29918,
9902,
353,
5159,
13,
13,
1678,
822,
18414,
5987,
29898,
1311,
1125,
13,
4706,
565,
7431,
29898,
1311,
29889,
29890,
1884,
29918,
9902,
29897,
1275,
29871,
29900,
29901,
13,
9651,
17927,
29889,
27392,
703,
1576,
1353,
310,
2854,
289,
1884,
17809,
338,
5225,
7790,
29876,
320,
13,
462,
1678,
3529,
671,
15590,
1904,
322,
1423,
1881,
848,
7790,
29876,
320,
13,
462,
1678,
5040,
4810,
3217,
10095,
2200,
18414,
5987,
29991,
1159,
13,
9651,
736,
518,
29900,
29889,
29900,
29962,
13,
4706,
411,
1722,
29898,
12015,
7724,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
9651,
4390,
29889,
15070,
29898,
1311,
29889,
29890,
1884,
29918,
9902,
29892,
285,
29897,
13,
13,
4706,
2910,
29918,
16202,
353,
1583,
29889,
29883,
6235,
2754,
29918,
14513,
29898,
12015,
7724,
29892,
525,
29890,
1884,
742,
274,
6235,
29918,
4141,
29922,
1311,
29889,
29883,
6235,
29918,
4141,
29897,
13,
4706,
396,
28371,
274,
6235,
17983,
1121,
13,
4706,
10876,
29889,
25393,
29889,
23126,
580,
13,
4706,
1583,
29889,
2914,
353,
2910,
29918,
16202,
29961,
29900,
29962,
13,
4706,
736,
518,
1311,
29889,
2914,
29962,
13,
13,
1678,
822,
274,
6235,
2754,
29918,
14513,
29898,
1311,
29892,
4390,
1445,
29892,
3114,
29892,
274,
6235,
29918,
4141,
29922,
8516,
29892,
12327,
29918,
1445,
29922,
8516,
1125,
13,
4706,
4974,
274,
6235,
29918,
4141,
2804,
6213,
470,
12327,
29918,
1445,
2804,
6213,
13,
13,
4706,
565,
274,
6235,
29918,
4141,
1275,
6213,
29901,
13,
9651,
274,
6235,
29918,
4141,
353,
4810,
3217,
29898,
7665,
29918,
1445,
29897,
13,
4706,
17927,
29889,
3888,
703,
4763,
14707,
856,
1159,
13,
4706,
274,
6235,
29918,
6008,
353,
274,
6235,
29918,
4141,
29889,
1359,
1666,
29898,
3126,
1445,
29897,
13,
4706,
274,
6235,
29918,
14513,
353,
4810,
3217,
14513,
29898,
29883,
6235,
29918,
4141,
29892,
274,
6235,
29918,
6008,
29892,
3114,
29897,
13,
4706,
274,
6235,
29918,
14513,
29889,
24219,
403,
580,
13,
4706,
274,
6235,
29918,
14513,
29889,
5753,
398,
5987,
580,
13,
4706,
274,
6235,
29918,
14513,
29889,
2083,
3034,
675,
580,
13,
4706,
736,
274,
6235,
29918,
14513,
29889,
16202,
13,
2
] |
a2ml/api/utils/decorators.py | augerai/a2ml | 30 | 175086 | def error_handler(decorated):
def wrapper(self, *args, **kwargs):
try:
return decorated(self, *args, **kwargs)
except Exception as exc:
if self.ctx.debug:
import traceback
traceback.print_exc()
if "ServiceException" in str(type(exc)):
exc = Exception(exc.message)
self.ctx.log(str(exc))
if not hasattr(self.ctx, 'not_reraise_exceptions')\
or not self.ctx.not_reraise_exceptions:
raise
return wrapper
def authenticated(decorated):
def wrapper(self, *args, **kwargs):
self.credentials.verify()
return decorated(self, *args, **kwargs)
return wrapper
| [
1,
822,
1059,
29918,
13789,
29898,
19557,
630,
1125,
13,
1678,
822,
14476,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1018,
29901,
13,
9651,
736,
10200,
630,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
4706,
5174,
8960,
408,
5566,
29901,
13,
9651,
565,
1583,
29889,
13073,
29889,
8382,
29901,
13,
18884,
1053,
9637,
1627,
13,
18884,
9637,
1627,
29889,
2158,
29918,
735,
29883,
580,
13,
13,
9651,
565,
376,
3170,
2451,
29908,
297,
851,
29898,
1853,
29898,
735,
29883,
22164,
13,
18884,
5566,
353,
8960,
29898,
735,
29883,
29889,
4906,
29897,
13,
462,
13,
9651,
1583,
29889,
13073,
29889,
1188,
29898,
710,
29898,
735,
29883,
876,
13,
9651,
565,
451,
756,
5552,
29898,
1311,
29889,
13073,
29892,
525,
1333,
29918,
13941,
895,
29918,
11739,
29879,
1495,
29905,
13,
1669,
470,
451,
1583,
29889,
13073,
29889,
1333,
29918,
13941,
895,
29918,
11739,
29879,
29901,
13,
18884,
12020,
13,
462,
13,
1678,
736,
14476,
13,
13,
13,
1753,
15585,
630,
29898,
19557,
630,
1125,
13,
1678,
822,
14476,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
1583,
29889,
11944,
9409,
29889,
27902,
580,
13,
4706,
736,
10200,
630,
29898,
1311,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
1678,
736,
14476,
13,
2
] |
gputools/core/oclmultireduction.py | gmazzamuto/gputools | 89 | 9208 | <reponame>gmazzamuto/gputools
"""
an adaptation of pyopencl's reduction kernel for weighted avarages
like sum(a*b)
<EMAIL>
"""
from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import zip
import pyopencl as cl
from pyopencl.tools import (
context_dependent_memoize,
dtype_to_ctype, KernelTemplateBase,
_process_code_for_macro)
import numpy as np
from gputools import get_device
import sys
# {{{ kernel source
KERNEL = r"""//CL//
<%
inds = range(len(map_exprs))
%>
#define GROUP_SIZE ${group_size}
% for i,m in enumerate(map_exprs):
#define READ_AND_MAP_${i}(i) (${m})
% endfor
#define REDUCE(a, b) (${reduce_expr})
% if double_support:
#if __OPENCL_C_VERSION__ < 120
#pragma OPENCL EXTENSION cl_khr_fp64: enable
#endif
#define PYOPENCL_DEFINE_CDOUBLE
% endif
#include <pyopencl-complex.h>
${preamble}
typedef ${out_type} out_type;
__kernel void ${name}(
% for i in inds:
__global out_type *out__base_${i},
% endfor
long out__offset, ${arguments},
unsigned int seq_count, unsigned int n)
{
% for i in inds:
__global out_type *out_${i} = (__global out_type *) (
(__global char *) out__base_${i} + out__offset);
% endfor
${arg_prep}
% for i in inds:
__local out_type ldata_${i}[GROUP_SIZE];
out_type acc_${i} = ${neutral};
% endfor
unsigned int lid = get_local_id(0);
unsigned int i = get_group_id(0)*GROUP_SIZE*seq_count + lid;
//printf("seq: %d\tlid = %d\ti=%d\n",seq_count,lid,i);
for (unsigned s = 0; s < seq_count; ++s)
{
if (i >= n)
break;
% for i in inds:
acc_${i} = REDUCE(acc_${i}, READ_AND_MAP_${i}(i));
% endfor
i += GROUP_SIZE;
}
% for i in inds:
ldata_${i}[lid] = acc_${i};
% endfor
<%
cur_size = group_size
%>
% while cur_size > 1:
barrier(CLK_LOCAL_MEM_FENCE);
<%
new_size = cur_size // 2
assert new_size * 2 == cur_size
%>
if (lid < ${new_size})
{
% for i in inds:
ldata_${i}[lid] = REDUCE(
ldata_${i}[lid],
ldata_${i}[lid + ${new_size}]);
% endfor
}
<% cur_size = new_size %>
% endwhile
if (lid == 0) {
% for i in inds:
out_${i}[get_group_id(0)] = ldata_${i}[0];
% endfor
//printf("result: %.4f\n",out_0[get_group_id(0)] );
}
}
"""
def _get_reduction_source(
ctx, out_type, out_type_size,
neutral, reduce_expr, map_exprs, parsed_args,
name="reduce_kernel", preamble="", arg_prep="",
device=None, max_group_size=None):
if device is not None:
devices = [device]
else:
devices = ctx.devices
# {{{ compute group size
def get_dev_group_size(device):
# dirty fix for the RV770 boards
max_work_group_size = device.max_work_group_size
if "RV770" in device.name:
max_work_group_size = 64
# compute lmem limit
from pytools import div_ceil
lmem_wg_size = div_ceil(max_work_group_size, out_type_size)
result = min(max_work_group_size, lmem_wg_size)
# round down to power of 2
from pyopencl.tools import bitlog2
return 2**bitlog2(result)
group_size = min(get_dev_group_size(dev) for dev in devices)
if max_group_size is not None:
group_size = min(max_group_size, group_size)
# }}}
from mako.template import Template
from pytools import all
from pyopencl.characterize import has_double_support
src = str(Template(KERNEL).render(
out_type=out_type,
arguments=", ".join(arg.declarator() for arg in parsed_args),
group_size=group_size,
neutral=neutral,
reduce_expr=_process_code_for_macro(reduce_expr),
map_exprs=[_process_code_for_macro(m) for m in map_exprs],
name=name,
preamble=preamble,
arg_prep=arg_prep,
double_support=all(has_double_support(dev) for dev in devices),
))
# sys.exit()
from pytools import Record
class ReductionInfo(Record):
pass
return ReductionInfo(
context=ctx,
source=src,
group_size=group_size)
def get_reduction_kernel(stage,
ctx, dtype_out,
neutral, reduce_expr, arguments=None,
name="reduce_kernel", preamble="",
map_exprs = None,
device=None, options=[], max_group_size=None):
if map_exprs is None:
raise ValueError("map_exprs has to be given!")
for i, m in enumerate(map_exprs):
if m is None:
if stage==2:
map_exprs[i] = "pyopencl_reduction_inp_%i[i]"%i
else:
map_exprs[i] = "in[i]"
from pyopencl.tools import (
parse_arg_list, get_arg_list_scalar_arg_dtypes,
get_arg_offset_adjuster_code, VectorArg)
arg_prep = ""
if stage==1 and arguments is not None:
arguments = parse_arg_list(arguments, with_offset=True)
arg_prep = get_arg_offset_adjuster_code(arguments)
if stage==2 and arguments is not None:
arguments = parse_arg_list(arguments)
arguments = (
[VectorArg(dtype_out, "pyopencl_reduction_inp_%i"%i) for i in range(len(map_exprs))]
+arguments)
inf = _get_reduction_source(
ctx, dtype_to_ctype(dtype_out), dtype_out.itemsize,
neutral, reduce_expr, map_exprs, arguments,
name, preamble, arg_prep, device, max_group_size)
inf.program = cl.Program(ctx, inf.source)
inf.program.build(options)
inf.kernel = getattr(inf.program, name)
inf.arg_types = arguments
inf.kernel.set_scalar_arg_dtypes(
[None, ]*len(map_exprs)+[np.int64]
+get_arg_list_scalar_arg_dtypes(inf.arg_types)
+[np.uint32]*2)
return inf
# }}}
# {{{ main reduction kernel
class OCLMultiReductionKernel:
"""
simultanous reduction of a weighted sum of severalbuffers
example:
k = OCLMultiReduction(np.float32,
neutral="0",reduce_expr="a+b",
map_exprs = ["x[i]", "x[i]*y[i]"],
arguments="__global float *x,__global float *y")
k(a,b, out1 = out1, out2 = out2)
"""
def __init__(self, dtype_out,
neutral, reduce_expr, arguments=None,
map_exprs=[None],
name="reduce_kernel", options=[], preamble=""):
ctx = get_device().context
dtype_out = self.dtype_out = np.dtype(dtype_out)
max_group_size = None
trip_count = 0
self.n_exprs = len(map_exprs)
assert self.n_exprs>0
while True:
self.stage_1_inf = get_reduction_kernel(1, ctx,
dtype_out,
neutral, reduce_expr, arguments,
name=name+"_stage1", options=options, preamble=preamble,
map_exprs=map_exprs,
max_group_size=max_group_size)
kernel_max_wg_size = self.stage_1_inf.kernel.get_work_group_info(
cl.kernel_work_group_info.WORK_GROUP_SIZE,
ctx.devices[0])
if self.stage_1_inf.group_size<=kernel_max_wg_size:
break
else:
max_group_size = kernel_max_wg_size
trip_count += 1
assert trip_count<=2
self.stage_2_inf = get_reduction_kernel(2, ctx,
dtype_out,
neutral, reduce_expr, arguments=arguments,
name=name+"_stage2", options=options,
map_exprs = [None]*self.n_exprs,
preamble=preamble,
max_group_size=max_group_size)
from pytools import any
from pyopencl.tools import VectorArg
assert any(
isinstance(arg_tp, VectorArg)
for arg_tp in self.stage_1_inf.arg_types), \
"ReductionKernel can only be used with functions " \
"that have at least one vector argument"
def __call__(self, *args, **kwargs):
MAX_GROUP_COUNT = 1024 # noqa
SMALL_SEQ_COUNT = 4 # noqa
from pyopencl.array import empty
stage_inf = self.stage_1_inf
queue = kwargs.pop("queue", None)
wait_for = kwargs.pop("wait_for", None)
return_event = kwargs.pop("return_event", False)
outs = kwargs.pop("outs", [None]*self.n_exprs)
if kwargs:
raise TypeError("invalid keyword argument to reduction kernel")
stage1_args = args
while True:
invocation_args = []
vectors = []
from pyopencl.tools import VectorArg
for arg, arg_tp in zip(args, stage_inf.arg_types):
if isinstance(arg_tp, VectorArg):
if not arg.flags.forc:
raise RuntimeError("ReductionKernel cannot "
"deal with non-contiguous arrays")
vectors.append(arg)
invocation_args.append(arg.base_data)
if arg_tp.with_offset:
invocation_args.append(arg.offset)
else:
invocation_args.append(arg)
repr_vec = vectors[0]
sz = repr_vec.size
if queue is not None:
use_queue = queue
else:
use_queue = repr_vec.queue
if sz<=stage_inf.group_size*SMALL_SEQ_COUNT*MAX_GROUP_COUNT:
total_group_size = SMALL_SEQ_COUNT*stage_inf.group_size
group_count = (sz+total_group_size-1)//total_group_size
seq_count = SMALL_SEQ_COUNT
else:
group_count = MAX_GROUP_COUNT
macrogroup_size = group_count*stage_inf.group_size
seq_count = (sz+macrogroup_size-1)//macrogroup_size
if group_count==1:
results = [empty(use_queue,
(), self.dtype_out,
allocator=repr_vec.allocator) if out is None else out for out in outs]
else:
results = [empty(use_queue,
(group_count,), self.dtype_out,
allocator=repr_vec.allocator) for out in outs]
last_evt = stage_inf.kernel(
use_queue,
(group_count*stage_inf.group_size,),
(stage_inf.group_size,),
*([r.base_data for r in results]+[results[0].offset,]
+invocation_args+[seq_count, sz]),
**dict(wait_for=wait_for))
wait_for = [last_evt]
#print "ooooo ", group_count, len(args)
if group_count==1:
if return_event:
return results, last_evt
else:
return results
else:
stage_inf = self.stage_2_inf
args = tuple(results)+stage1_args
#args = (results[0],)+stage1_args
if __name__=='__main__':
from gputools import OCLArray, OCLReductionKernel
k1 = OCLReductionKernel(np.float32,
neutral="0", reduce_expr="a+b",
map_expr="x[i]",
arguments="__global float *x")
k2 = OCLMultiReductionKernel(np.float32,
neutral="0", reduce_expr="a+b",
map_exprs=["y[i]*x[i]","x[i]"],
arguments="__global float *x, __global float *y")
N = 512
a = OCLArray.from_array(np.ones((N,N),np.float32))
b = OCLArray.from_array(2.*np.ones((N,N),np.float32))
o1 = OCLArray.empty((),np.float32)
o2 = OCLArray.empty((),np.float32)
from time import time
t = time()
for _ in range(400):
k1(a)
k1(b)
k1(a).get()
k1(b).get()
print(time()-t)
t = time()
#print k2(a,b, outs = [o1,o2])
for _ in range(400):
k2(a[0],b[0], outs = [o1,o2])
o1.get()
print(time()-t)
# open("kern_new_1.txt","w").write(("%s"%k2.stage_1_inf).replace("\\n","\n"))
# open("kern_new_2.txt","w").write(("%s"%k2.stage_2_inf).replace("\\n","\n"))
| [
1,
529,
276,
1112,
420,
29958,
29887,
655,
5617,
314,
3066,
29914,
29887,
649,
8789,
13,
15945,
29908,
13,
273,
28206,
310,
11451,
3150,
695,
29915,
29879,
20376,
8466,
363,
7688,
287,
1029,
279,
1179,
13,
13,
4561,
2533,
29898,
29874,
29930,
29890,
29897,
13,
13,
29966,
26862,
6227,
29958,
13,
13,
15945,
29908,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
29892,
29104,
29918,
20889,
1338,
29892,
8380,
29918,
5215,
29892,
8542,
13,
3166,
4832,
29889,
13529,
267,
1053,
14319,
13,
13,
5215,
11451,
3150,
695,
408,
1067,
13,
3166,
11451,
3150,
695,
29889,
8504,
1053,
313,
13,
1678,
3030,
29918,
18980,
29918,
6954,
29877,
675,
29892,
13,
1678,
26688,
29918,
517,
29918,
312,
668,
29892,
476,
5851,
6733,
5160,
29892,
13,
1678,
903,
5014,
29918,
401,
29918,
1454,
29918,
25254,
29897,
13,
5215,
12655,
408,
7442,
13,
3166,
330,
649,
8789,
1053,
679,
29918,
10141,
13,
13,
13,
5215,
10876,
13,
13,
13,
29937,
426,
6224,
8466,
2752,
13,
13,
29968,
1001,
29940,
6670,
353,
364,
15945,
29908,
458,
6154,
458,
13,
13,
1678,
20577,
13,
1678,
1399,
29879,
353,
3464,
29898,
2435,
29898,
1958,
29918,
13338,
29879,
876,
13,
1678,
6580,
13,
1678,
396,
7922,
15345,
29918,
14226,
6435,
2972,
29918,
2311,
29913,
13,
1678,
1273,
363,
474,
29892,
29885,
297,
26985,
29898,
1958,
29918,
13338,
29879,
1125,
13,
1678,
396,
7922,
5195,
3035,
29918,
9468,
29918,
23827,
29918,
5303,
29875,
2119,
29875,
29897,
3255,
29912,
29885,
1800,
13,
1678,
1273,
1095,
1454,
13,
13,
1678,
396,
7922,
390,
3352,
29965,
4741,
29898,
29874,
29892,
289,
29897,
3255,
29912,
17469,
29918,
13338,
1800,
13,
1678,
1273,
565,
3765,
29918,
5924,
29901,
13,
4706,
396,
361,
4770,
4590,
1430,
6154,
29918,
29907,
29918,
16358,
1649,
529,
29871,
29896,
29906,
29900,
13,
4706,
396,
28436,
6418,
1430,
6154,
8528,
29911,
1430,
13381,
1067,
29918,
29895,
1092,
29918,
18091,
29953,
29946,
29901,
9025,
13,
4706,
396,
15224,
13,
4706,
396,
7922,
349,
29979,
4590,
1430,
6154,
29918,
24405,
8895,
29918,
29907,
3970,
7466,
1307,
13,
1678,
1273,
1095,
361,
13,
1678,
396,
2856,
529,
2272,
3150,
695,
29899,
19676,
29889,
29882,
29958,
13,
1678,
6435,
1457,
314,
569,
29913,
13,
1678,
21787,
6435,
449,
29918,
1853,
29913,
714,
29918,
1853,
29936,
13,
1678,
4770,
17460,
1780,
6435,
978,
2119,
13,
1678,
1273,
363,
474,
297,
1399,
29879,
29901,
13,
418,
4770,
10945,
714,
29918,
1853,
334,
449,
1649,
3188,
29918,
5303,
29875,
1118,
13,
1678,
1273,
1095,
1454,
13,
418,
1472,
714,
1649,
10289,
29892,
6435,
25699,
1118,
13,
418,
12780,
938,
19359,
29918,
2798,
29892,
12780,
938,
302,
29897,
13,
1678,
426,
13,
13,
4706,
1273,
363,
474,
297,
1399,
29879,
29901,
13,
9651,
4770,
10945,
714,
29918,
1853,
334,
449,
29918,
5303,
29875,
29913,
353,
313,
1649,
10945,
714,
29918,
1853,
4748,
313,
13,
9651,
313,
1649,
10945,
1373,
4748,
714,
1649,
3188,
29918,
5303,
29875,
29913,
718,
714,
1649,
10289,
416,
13,
4706,
1273,
1095,
1454,
13,
13,
4706,
6435,
1191,
29918,
15287,
29913,
13,
13,
4706,
1273,
363,
474,
297,
1399,
29879,
29901,
13,
4706,
4770,
2997,
714,
29918,
1853,
301,
1272,
29918,
5303,
29875,
4400,
26284,
29918,
14226,
1385,
13,
4706,
714,
29918,
1853,
1035,
29918,
5303,
29875,
29913,
353,
6435,
17821,
1705,
3400,
13,
4706,
1273,
1095,
1454,
13,
13,
13,
4706,
12780,
938,
17343,
353,
679,
29918,
2997,
29918,
333,
29898,
29900,
416,
13,
4706,
12780,
938,
474,
353,
679,
29918,
2972,
29918,
333,
29898,
29900,
11877,
26284,
29918,
14226,
29930,
11762,
29918,
2798,
718,
17343,
29936,
13,
13,
4706,
849,
8124,
703,
11762,
29901,
1273,
29881,
29905,
15206,
333,
353,
1273,
29881,
29905,
2034,
16328,
29881,
29905,
29876,
613,
11762,
29918,
2798,
29892,
29880,
333,
29892,
29875,
416,
13,
13,
13,
4706,
363,
313,
15395,
269,
353,
29871,
29900,
29936,
269,
529,
19359,
29918,
2798,
29936,
8445,
29879,
29897,
13,
4706,
426,
13,
3986,
565,
313,
29875,
6736,
302,
29897,
13,
9651,
2867,
29936,
13,
13,
4706,
1273,
363,
474,
297,
1399,
29879,
29901,
13,
3986,
1035,
29918,
5303,
29875,
29913,
353,
390,
3352,
29965,
4741,
29898,
5753,
29918,
5303,
29875,
1118,
5195,
3035,
29918,
9468,
29918,
23827,
29918,
5303,
29875,
2119,
29875,
2483,
13,
4706,
1273,
1095,
1454,
13,
13,
3986,
474,
4619,
15345,
29918,
14226,
29936,
13,
4706,
500,
13,
13,
4706,
1273,
363,
474,
297,
1399,
29879,
29901,
13,
3986,
301,
1272,
29918,
5303,
29875,
4400,
29880,
333,
29962,
353,
1035,
29918,
5303,
29875,
3400,
13,
4706,
1273,
1095,
1454,
13,
13,
13,
4706,
20577,
13,
3986,
3151,
29918,
2311,
353,
2318,
29918,
2311,
13,
4706,
6580,
13,
4706,
1273,
1550,
3151,
29918,
2311,
1405,
29871,
29896,
29901,
13,
9651,
2594,
4336,
29898,
6154,
29968,
29918,
16652,
1964,
29918,
2303,
29924,
29918,
29943,
1430,
4741,
416,
13,
9651,
20577,
13,
9651,
716,
29918,
2311,
353,
3151,
29918,
2311,
849,
29871,
29906,
13,
9651,
4974,
716,
29918,
2311,
334,
29871,
29906,
1275,
3151,
29918,
2311,
13,
9651,
6580,
13,
9651,
565,
313,
29880,
333,
529,
6435,
1482,
29918,
2311,
1800,
13,
9651,
426,
13,
13,
18884,
1273,
363,
474,
297,
1399,
29879,
29901,
13,
13,
462,
29871,
301,
1272,
29918,
5303,
29875,
4400,
29880,
333,
29962,
353,
390,
3352,
29965,
4741,
29898,
13,
462,
29871,
301,
1272,
29918,
5303,
29875,
4400,
29880,
333,
1402,
13,
462,
29871,
301,
1272,
29918,
5303,
29875,
4400,
29880,
333,
718,
6435,
1482,
29918,
2311,
29913,
5691,
13,
13,
18884,
1273,
1095,
1454,
13,
13,
9651,
500,
13,
9651,
20577,
3151,
29918,
2311,
353,
716,
29918,
2311,
6580,
13,
4706,
1273,
1095,
8000,
13,
4706,
565,
313,
29880,
333,
1275,
29871,
29900,
29897,
426,
13,
13,
965,
1273,
363,
474,
297,
1399,
29879,
29901,
13,
18884,
714,
29918,
5303,
29875,
4400,
657,
29918,
2972,
29918,
333,
29898,
29900,
4638,
353,
301,
1272,
29918,
5303,
29875,
4400,
29900,
1385,
13,
13,
9651,
1273,
1095,
1454,
13,
13,
9651,
849,
8124,
703,
2914,
29901,
18695,
29946,
29888,
29905,
29876,
613,
449,
29918,
29900,
29961,
657,
29918,
2972,
29918,
333,
29898,
29900,
4638,
3482,
13,
13,
9651,
500,
13,
1678,
500,
13,
15945,
29908,
13,
13,
13,
13,
1753,
903,
657,
29918,
9313,
428,
29918,
4993,
29898,
13,
4706,
12893,
29892,
714,
29918,
1853,
29892,
714,
29918,
1853,
29918,
2311,
29892,
13,
4706,
21104,
29892,
10032,
29918,
13338,
29892,
2910,
29918,
13338,
29879,
29892,
21213,
29918,
5085,
29892,
13,
4706,
1024,
543,
17469,
29918,
17460,
613,
758,
314,
569,
543,
613,
1852,
29918,
15287,
543,
613,
13,
4706,
4742,
29922,
8516,
29892,
4236,
29918,
2972,
29918,
2311,
29922,
8516,
1125,
13,
13,
13,
1678,
565,
4742,
338,
451,
6213,
29901,
13,
4706,
9224,
353,
518,
10141,
29962,
13,
1678,
1683,
29901,
13,
4706,
9224,
353,
12893,
29889,
3359,
1575,
13,
13,
1678,
396,
426,
6224,
10272,
2318,
2159,
13,
13,
1678,
822,
679,
29918,
3359,
29918,
2972,
29918,
2311,
29898,
10141,
1125,
13,
4706,
396,
26616,
2329,
363,
278,
390,
29963,
29955,
29955,
29900,
1045,
3163,
13,
4706,
4236,
29918,
1287,
29918,
2972,
29918,
2311,
353,
4742,
29889,
3317,
29918,
1287,
29918,
2972,
29918,
2311,
13,
4706,
565,
376,
29934,
29963,
29955,
29955,
29900,
29908,
297,
4742,
29889,
978,
29901,
13,
9651,
4236,
29918,
1287,
29918,
2972,
29918,
2311,
353,
29871,
29953,
29946,
13,
13,
4706,
396,
10272,
301,
6954,
4046,
13,
4706,
515,
11451,
8504,
1053,
1933,
29918,
27696,
13,
4706,
301,
6954,
29918,
29893,
29887,
29918,
2311,
353,
1933,
29918,
27696,
29898,
3317,
29918,
1287,
29918,
2972,
29918,
2311,
29892,
714,
29918,
1853,
29918,
2311,
29897,
13,
4706,
1121,
353,
1375,
29898,
3317,
29918,
1287,
29918,
2972,
29918,
2311,
29892,
301,
6954,
29918,
29893,
29887,
29918,
2311,
29897,
13,
13,
4706,
396,
4513,
1623,
304,
3081,
310,
29871,
29906,
13,
4706,
515,
11451,
3150,
695,
29889,
8504,
1053,
2586,
1188,
29906,
13,
4706,
736,
29871,
29906,
1068,
2966,
1188,
29906,
29898,
2914,
29897,
13,
13,
1678,
2318,
29918,
2311,
353,
1375,
29898,
657,
29918,
3359,
29918,
2972,
29918,
2311,
29898,
3359,
29897,
363,
2906,
297,
9224,
29897,
13,
13,
13,
13,
1678,
565,
4236,
29918,
2972,
29918,
2311,
338,
451,
6213,
29901,
13,
4706,
2318,
29918,
2311,
353,
1375,
29898,
3317,
29918,
2972,
29918,
2311,
29892,
2318,
29918,
2311,
29897,
13,
13,
1678,
396,
500,
930,
13,
13,
13,
1678,
515,
2136,
29877,
29889,
6886,
1053,
25663,
13,
1678,
515,
11451,
8504,
1053,
599,
13,
1678,
515,
11451,
3150,
695,
29889,
18609,
675,
1053,
756,
29918,
8896,
29918,
5924,
13,
1678,
4765,
353,
851,
29898,
6733,
29898,
29968,
1001,
29940,
6670,
467,
9482,
29898,
13,
4706,
714,
29918,
1853,
29922,
449,
29918,
1853,
29892,
13,
4706,
6273,
543,
29892,
11393,
7122,
29898,
1191,
29889,
311,
16544,
1061,
580,
363,
1852,
297,
21213,
29918,
5085,
511,
13,
4706,
2318,
29918,
2311,
29922,
2972,
29918,
2311,
29892,
13,
4706,
21104,
29922,
17821,
1705,
29892,
13,
4706,
10032,
29918,
13338,
29922,
29918,
5014,
29918,
401,
29918,
1454,
29918,
25254,
29898,
17469,
29918,
13338,
511,
13,
4706,
2910,
29918,
13338,
29879,
11759,
29918,
5014,
29918,
401,
29918,
1454,
29918,
25254,
29898,
29885,
29897,
363,
286,
297,
2910,
29918,
13338,
29879,
1402,
13,
4706,
1024,
29922,
978,
29892,
13,
4706,
758,
314,
569,
29922,
1457,
314,
569,
29892,
13,
4706,
1852,
29918,
15287,
29922,
1191,
29918,
15287,
29892,
13,
4706,
3765,
29918,
5924,
29922,
497,
29898,
5349,
29918,
8896,
29918,
5924,
29898,
3359,
29897,
363,
2906,
297,
9224,
511,
13,
268,
876,
13,
13,
13,
13,
1678,
396,
1678,
10876,
29889,
13322,
580,
13,
13,
1678,
515,
11451,
8504,
1053,
14164,
13,
13,
1678,
770,
4367,
29884,
428,
3401,
29898,
9182,
1125,
13,
4706,
1209,
13,
13,
1678,
736,
4367,
29884,
428,
3401,
29898,
13,
4706,
3030,
29922,
13073,
29892,
13,
4706,
2752,
29922,
4351,
29892,
13,
4706,
2318,
29918,
2311,
29922,
2972,
29918,
2311,
29897,
13,
13,
13,
1753,
679,
29918,
9313,
428,
29918,
17460,
29898,
19190,
29892,
13,
462,
308,
12893,
29892,
26688,
29918,
449,
29892,
13,
462,
308,
21104,
29892,
10032,
29918,
13338,
29892,
6273,
29922,
8516,
29892,
13,
462,
308,
1024,
543,
17469,
29918,
17460,
613,
758,
314,
569,
543,
613,
13,
462,
308,
2910,
29918,
13338,
29879,
353,
6213,
29892,
13,
462,
308,
4742,
29922,
8516,
29892,
3987,
11759,
1402,
4236,
29918,
2972,
29918,
2311,
29922,
8516,
1125,
13,
13,
1678,
565,
2910,
29918,
13338,
29879,
338,
6213,
29901,
13,
4706,
12020,
7865,
2392,
703,
1958,
29918,
13338,
29879,
756,
304,
367,
2183,
29991,
1159,
13,
13,
1678,
363,
474,
29892,
286,
297,
26985,
29898,
1958,
29918,
13338,
29879,
1125,
13,
4706,
565,
286,
338,
6213,
29901,
13,
9651,
565,
7408,
1360,
29906,
29901,
13,
18884,
2910,
29918,
13338,
29879,
29961,
29875,
29962,
353,
376,
2272,
3150,
695,
29918,
9313,
428,
29918,
262,
29886,
29918,
29995,
29875,
29961,
29875,
18017,
29995,
29875,
13,
9651,
1683,
29901,
13,
18884,
2910,
29918,
13338,
29879,
29961,
29875,
29962,
353,
376,
262,
29961,
29875,
18017,
13,
13,
13,
1678,
515,
11451,
3150,
695,
29889,
8504,
1053,
313,
13,
4706,
6088,
29918,
1191,
29918,
1761,
29892,
679,
29918,
1191,
29918,
1761,
29918,
19529,
279,
29918,
1191,
29918,
29881,
8768,
29892,
13,
4706,
679,
29918,
1191,
29918,
10289,
29918,
328,
5143,
261,
29918,
401,
29892,
16510,
8559,
29897,
13,
13,
1678,
1852,
29918,
15287,
353,
5124,
13,
1678,
565,
7408,
1360,
29896,
322,
6273,
338,
451,
6213,
29901,
13,
4706,
6273,
353,
6088,
29918,
1191,
29918,
1761,
29898,
25699,
29892,
411,
29918,
10289,
29922,
5574,
29897,
13,
4706,
1852,
29918,
15287,
353,
679,
29918,
1191,
29918,
10289,
29918,
328,
5143,
261,
29918,
401,
29898,
25699,
29897,
13,
13,
1678,
565,
7408,
1360,
29906,
322,
6273,
338,
451,
6213,
29901,
13,
4706,
6273,
353,
6088,
29918,
1191,
29918,
1761,
29898,
25699,
29897,
13,
4706,
6273,
353,
313,
13,
9651,
518,
12877,
8559,
29898,
29881,
1853,
29918,
449,
29892,
376,
2272,
3150,
695,
29918,
9313,
428,
29918,
262,
29886,
29918,
29995,
29875,
29908,
29995,
29875,
29897,
363,
474,
297,
3464,
29898,
2435,
29898,
1958,
29918,
13338,
29879,
28166,
13,
9651,
718,
25699,
29897,
13,
13,
13,
1678,
3041,
353,
903,
657,
29918,
9313,
428,
29918,
4993,
29898,
13,
4706,
12893,
29892,
26688,
29918,
517,
29918,
312,
668,
29898,
29881,
1853,
29918,
449,
511,
26688,
29918,
449,
29889,
667,
2311,
29892,
13,
4706,
21104,
29892,
10032,
29918,
13338,
29892,
2910,
29918,
13338,
29879,
29892,
6273,
29892,
13,
4706,
1024,
29892,
758,
314,
569,
29892,
1852,
29918,
15287,
29892,
4742,
29892,
4236,
29918,
2972,
29918,
2311,
29897,
13,
13,
1678,
3041,
29889,
8860,
353,
1067,
29889,
9283,
29898,
13073,
29892,
3041,
29889,
4993,
29897,
13,
1678,
3041,
29889,
8860,
29889,
4282,
29898,
6768,
29897,
13,
1678,
3041,
29889,
17460,
353,
679,
5552,
29898,
7192,
29889,
8860,
29892,
1024,
29897,
13,
13,
1678,
3041,
29889,
1191,
29918,
8768,
353,
6273,
13,
13,
1678,
3041,
29889,
17460,
29889,
842,
29918,
19529,
279,
29918,
1191,
29918,
29881,
8768,
29898,
13,
4706,
518,
8516,
29892,
4514,
29930,
2435,
29898,
1958,
29918,
13338,
29879,
7240,
29961,
9302,
29889,
524,
29953,
29946,
29962,
13,
4706,
718,
657,
29918,
1191,
29918,
1761,
29918,
19529,
279,
29918,
1191,
29918,
29881,
8768,
29898,
7192,
29889,
1191,
29918,
8768,
29897,
13,
4706,
718,
29961,
9302,
29889,
13470,
29941,
29906,
14178,
29906,
29897,
13,
13,
13,
1678,
736,
3041,
13,
13,
13,
29937,
500,
930,
13,
13,
13,
29937,
426,
6224,
1667,
20376,
8466,
13,
13,
1990,
438,
6154,
15329,
29934,
6085,
428,
29968,
5851,
29901,
13,
1678,
9995,
13,
1678,
15030,
273,
681,
20376,
310,
263,
7688,
287,
2533,
310,
3196,
28040,
414,
13,
13,
1678,
1342,
29901,
13,
13,
4706,
413,
353,
438,
6154,
15329,
29934,
6085,
428,
29898,
9302,
29889,
7411,
29941,
29906,
29892,
13,
18884,
21104,
543,
29900,
613,
17469,
29918,
13338,
543,
29874,
29974,
29890,
613,
13,
18884,
2910,
29918,
13338,
29879,
353,
6796,
29916,
29961,
29875,
29962,
613,
376,
29916,
29961,
29875,
14178,
29891,
29961,
29875,
29962,
12436,
13,
18884,
6273,
543,
1649,
10945,
5785,
334,
29916,
29892,
1649,
10945,
5785,
334,
29891,
1159,
13,
13,
4706,
413,
29898,
29874,
29892,
29890,
29892,
714,
29896,
353,
714,
29896,
29892,
714,
29906,
353,
714,
29906,
29897,
13,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
26688,
29918,
449,
29892,
13,
462,
21104,
29892,
10032,
29918,
13338,
29892,
6273,
29922,
8516,
29892,
13,
462,
2910,
29918,
13338,
29879,
11759,
8516,
1402,
13,
462,
1024,
543,
17469,
29918,
17460,
613,
3987,
11759,
1402,
758,
314,
569,
13776,
1125,
13,
13,
4706,
12893,
353,
679,
29918,
10141,
2141,
4703,
13,
4706,
26688,
29918,
449,
353,
1583,
29889,
29881,
1853,
29918,
449,
353,
7442,
29889,
29881,
1853,
29898,
29881,
1853,
29918,
449,
29897,
13,
13,
4706,
4236,
29918,
2972,
29918,
2311,
353,
6213,
13,
4706,
17487,
29918,
2798,
353,
29871,
29900,
13,
13,
4706,
1583,
29889,
29876,
29918,
13338,
29879,
353,
7431,
29898,
1958,
29918,
13338,
29879,
29897,
13,
4706,
4974,
1583,
29889,
29876,
29918,
13338,
29879,
29958,
29900,
13,
13,
4706,
1550,
5852,
29901,
13,
9651,
1583,
29889,
19190,
29918,
29896,
29918,
7192,
353,
679,
29918,
9313,
428,
29918,
17460,
29898,
29896,
29892,
12893,
29892,
13,
462,
462,
462,
1678,
26688,
29918,
449,
29892,
13,
462,
462,
462,
1678,
21104,
29892,
10032,
29918,
13338,
29892,
6273,
29892,
13,
462,
462,
462,
1678,
1024,
29922,
978,
13578,
29918,
19190,
29896,
613,
3987,
29922,
6768,
29892,
758,
314,
569,
29922,
1457,
314,
569,
29892,
13,
462,
462,
462,
1678,
2910,
29918,
13338,
29879,
29922,
1958,
29918,
13338,
29879,
29892,
13,
462,
462,
462,
1678,
4236,
29918,
2972,
29918,
2311,
29922,
3317,
29918,
2972,
29918,
2311,
29897,
13,
13,
13,
9651,
8466,
29918,
3317,
29918,
29893,
29887,
29918,
2311,
353,
1583,
29889,
19190,
29918,
29896,
29918,
7192,
29889,
17460,
29889,
657,
29918,
1287,
29918,
2972,
29918,
3888,
29898,
13,
18884,
1067,
29889,
17460,
29918,
1287,
29918,
2972,
29918,
3888,
29889,
11686,
29968,
29918,
26284,
29918,
14226,
29892,
13,
18884,
12893,
29889,
3359,
1575,
29961,
29900,
2314,
13,
13,
9651,
565,
1583,
29889,
19190,
29918,
29896,
29918,
7192,
29889,
2972,
29918,
2311,
14065,
17460,
29918,
3317,
29918,
29893,
29887,
29918,
2311,
29901,
13,
18884,
2867,
13,
9651,
1683,
29901,
13,
18884,
4236,
29918,
2972,
29918,
2311,
353,
8466,
29918,
3317,
29918,
29893,
29887,
29918,
2311,
13,
13,
9651,
17487,
29918,
2798,
4619,
29871,
29896,
13,
9651,
4974,
17487,
29918,
2798,
14065,
29906,
13,
13,
4706,
1583,
29889,
19190,
29918,
29906,
29918,
7192,
353,
679,
29918,
9313,
428,
29918,
17460,
29898,
29906,
29892,
12893,
29892,
13,
462,
18884,
26688,
29918,
449,
29892,
13,
462,
18884,
21104,
29892,
10032,
29918,
13338,
29892,
6273,
29922,
25699,
29892,
13,
462,
18884,
1024,
29922,
978,
13578,
29918,
19190,
29906,
613,
3987,
29922,
6768,
29892,
13,
462,
18884,
2910,
29918,
13338,
29879,
353,
518,
8516,
14178,
1311,
29889,
29876,
29918,
13338,
29879,
29892,
13,
462,
18884,
758,
314,
569,
29922,
1457,
314,
569,
29892,
13,
462,
18884,
4236,
29918,
2972,
29918,
2311,
29922,
3317,
29918,
2972,
29918,
2311,
29897,
13,
13,
4706,
515,
11451,
8504,
1053,
738,
13,
4706,
515,
11451,
3150,
695,
29889,
8504,
1053,
16510,
8559,
13,
4706,
4974,
738,
29898,
13,
9651,
338,
8758,
29898,
1191,
29918,
9392,
29892,
16510,
8559,
29897,
13,
9651,
363,
1852,
29918,
9392,
297,
1583,
29889,
19190,
29918,
29896,
29918,
7192,
29889,
1191,
29918,
8768,
511,
320,
13,
9651,
376,
29934,
6085,
428,
29968,
5851,
508,
871,
367,
1304,
411,
3168,
376,
320,
13,
9651,
376,
5747,
505,
472,
3203,
697,
4608,
2980,
29908,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
334,
5085,
29892,
3579,
19290,
1125,
13,
4706,
18134,
29918,
26284,
29918,
18736,
353,
29871,
29896,
29900,
29906,
29946,
29871,
396,
694,
25621,
13,
4706,
317,
1529,
2208,
29918,
1660,
29984,
29918,
18736,
353,
29871,
29946,
29871,
396,
694,
25621,
13,
13,
4706,
515,
11451,
3150,
695,
29889,
2378,
1053,
4069,
13,
13,
4706,
7408,
29918,
7192,
353,
1583,
29889,
19190,
29918,
29896,
29918,
7192,
13,
13,
4706,
9521,
353,
9049,
5085,
29889,
7323,
703,
9990,
613,
6213,
29897,
13,
4706,
4480,
29918,
1454,
353,
9049,
5085,
29889,
7323,
703,
10685,
29918,
1454,
613,
6213,
29897,
13,
4706,
736,
29918,
3696,
353,
9049,
5085,
29889,
7323,
703,
2457,
29918,
3696,
613,
7700,
29897,
13,
13,
4706,
714,
29879,
353,
9049,
5085,
29889,
7323,
703,
17718,
613,
518,
8516,
14178,
1311,
29889,
29876,
29918,
13338,
29879,
29897,
13,
13,
13,
13,
4706,
565,
9049,
5085,
29901,
13,
9651,
12020,
20948,
703,
20965,
13553,
2980,
304,
20376,
8466,
1159,
13,
13,
4706,
7408,
29896,
29918,
5085,
353,
6389,
13,
13,
13,
4706,
1550,
5852,
29901,
13,
9651,
2437,
10610,
29918,
5085,
353,
5159,
13,
9651,
12047,
353,
5159,
13,
13,
9651,
515,
11451,
3150,
695,
29889,
8504,
1053,
16510,
8559,
13,
9651,
363,
1852,
29892,
1852,
29918,
9392,
297,
14319,
29898,
5085,
29892,
7408,
29918,
7192,
29889,
1191,
29918,
8768,
1125,
13,
18884,
565,
338,
8758,
29898,
1191,
29918,
9392,
29892,
16510,
8559,
1125,
13,
462,
1678,
565,
451,
1852,
29889,
15764,
29889,
1454,
29883,
29901,
13,
462,
4706,
12020,
24875,
2392,
703,
29934,
6085,
428,
29968,
5851,
2609,
376,
13,
462,
462,
965,
376,
311,
284,
411,
1661,
29899,
1285,
5526,
681,
7049,
1159,
13,
13,
462,
1678,
12047,
29889,
4397,
29898,
1191,
29897,
13,
462,
1678,
2437,
10610,
29918,
5085,
29889,
4397,
29898,
1191,
29889,
3188,
29918,
1272,
29897,
13,
462,
1678,
565,
1852,
29918,
9392,
29889,
2541,
29918,
10289,
29901,
13,
462,
4706,
2437,
10610,
29918,
5085,
29889,
4397,
29898,
1191,
29889,
10289,
29897,
13,
18884,
1683,
29901,
13,
462,
1678,
2437,
10610,
29918,
5085,
29889,
4397,
29898,
1191,
29897,
13,
13,
9651,
2062,
29918,
2003,
353,
12047,
29961,
29900,
29962,
13,
9651,
2268,
353,
2062,
29918,
2003,
29889,
2311,
13,
13,
13,
9651,
565,
9521,
338,
451,
6213,
29901,
13,
18884,
671,
29918,
9990,
353,
9521,
13,
9651,
1683,
29901,
13,
18884,
671,
29918,
9990,
353,
2062,
29918,
2003,
29889,
9990,
13,
13,
9651,
565,
2268,
14065,
19190,
29918,
7192,
29889,
2972,
29918,
2311,
29930,
29903,
1529,
2208,
29918,
1660,
29984,
29918,
18736,
29930,
12648,
29918,
26284,
29918,
18736,
29901,
13,
18884,
3001,
29918,
2972,
29918,
2311,
353,
317,
1529,
2208,
29918,
1660,
29984,
29918,
18736,
29930,
19190,
29918,
7192,
29889,
2972,
29918,
2311,
13,
18884,
2318,
29918,
2798,
353,
313,
3616,
29974,
7827,
29918,
2972,
29918,
2311,
29899,
29896,
29897,
458,
7827,
29918,
2972,
29918,
2311,
13,
18884,
19359,
29918,
2798,
353,
317,
1529,
2208,
29918,
1660,
29984,
29918,
18736,
13,
9651,
1683,
29901,
13,
18884,
2318,
29918,
2798,
353,
18134,
29918,
26284,
29918,
18736,
13,
18884,
11758,
2972,
29918,
2311,
353,
2318,
29918,
2798,
29930,
19190,
29918,
7192,
29889,
2972,
29918,
2311,
13,
18884,
19359,
29918,
2798,
353,
313,
3616,
29974,
25254,
2972,
29918,
2311,
29899,
29896,
29897,
458,
25254,
2972,
29918,
2311,
13,
13,
9651,
565,
2318,
29918,
2798,
1360,
29896,
29901,
13,
18884,
2582,
353,
518,
6310,
29898,
1509,
29918,
9990,
29892,
13,
462,
462,
313,
511,
1583,
29889,
29881,
1853,
29918,
449,
29892,
13,
462,
462,
6643,
1061,
29922,
276,
558,
29918,
2003,
29889,
15956,
1061,
29897,
565,
714,
338,
6213,
1683,
714,
363,
714,
297,
714,
29879,
29962,
13,
9651,
1683,
29901,
13,
18884,
2582,
353,
518,
6310,
29898,
1509,
29918,
9990,
29892,
13,
462,
462,
313,
2972,
29918,
2798,
29892,
511,
1583,
29889,
29881,
1853,
29918,
449,
29892,
13,
462,
462,
6643,
1061,
29922,
276,
558,
29918,
2003,
29889,
15956,
1061,
29897,
363,
714,
297,
714,
29879,
29962,
13,
13,
13,
13,
9651,
1833,
29918,
5750,
29873,
353,
7408,
29918,
7192,
29889,
17460,
29898,
13,
18884,
671,
29918,
9990,
29892,
13,
18884,
313,
2972,
29918,
2798,
29930,
19190,
29918,
7192,
29889,
2972,
29918,
2311,
29892,
511,
13,
18884,
313,
19190,
29918,
7192,
29889,
2972,
29918,
2311,
29892,
511,
13,
18884,
334,
4197,
29878,
29889,
3188,
29918,
1272,
363,
364,
297,
2582,
10062,
29961,
9902,
29961,
29900,
1822,
10289,
26073,
13,
462,
29871,
718,
11569,
10610,
29918,
5085,
29974,
29961,
11762,
29918,
2798,
29892,
2268,
11724,
13,
18884,
3579,
8977,
29898,
10685,
29918,
1454,
29922,
10685,
29918,
1454,
876,
13,
9651,
4480,
29918,
1454,
353,
518,
4230,
29918,
5750,
29873,
29962,
13,
13,
9651,
396,
2158,
376,
3634,
3634,
29877,
29871,
9162,
2318,
29918,
2798,
29892,
7431,
29898,
5085,
29897,
13,
13,
9651,
565,
2318,
29918,
2798,
1360,
29896,
29901,
13,
18884,
565,
736,
29918,
3696,
29901,
13,
462,
1678,
736,
2582,
29892,
1833,
29918,
5750,
29873,
13,
18884,
1683,
29901,
13,
462,
1678,
736,
2582,
13,
9651,
1683,
29901,
13,
18884,
7408,
29918,
7192,
353,
1583,
29889,
19190,
29918,
29906,
29918,
7192,
13,
18884,
6389,
353,
18761,
29898,
9902,
7240,
19190,
29896,
29918,
5085,
13,
18884,
396,
5085,
353,
313,
9902,
29961,
29900,
1402,
7240,
19190,
29896,
29918,
5085,
13,
13,
13,
361,
4770,
978,
1649,
1360,
29915,
1649,
3396,
1649,
2396,
13,
1678,
515,
330,
649,
8789,
1053,
438,
6154,
2588,
29892,
438,
6154,
29934,
6085,
428,
29968,
5851,
13,
13,
1678,
413,
29896,
353,
438,
6154,
29934,
6085,
428,
29968,
5851,
29898,
9302,
29889,
7411,
29941,
29906,
29892,
13,
462,
632,
21104,
543,
29900,
613,
10032,
29918,
13338,
543,
29874,
29974,
29890,
613,
13,
462,
632,
2910,
29918,
13338,
543,
29916,
29961,
29875,
29962,
613,
13,
462,
632,
6273,
543,
1649,
10945,
5785,
334,
29916,
1159,
13,
13,
1678,
413,
29906,
353,
438,
6154,
15329,
29934,
6085,
428,
29968,
5851,
29898,
9302,
29889,
7411,
29941,
29906,
29892,
13,
462,
462,
21104,
543,
29900,
613,
10032,
29918,
13338,
543,
29874,
29974,
29890,
613,
13,
462,
462,
2910,
29918,
13338,
29879,
29922,
3366,
29891,
29961,
29875,
14178,
29916,
29961,
29875,
29962,
3284,
29916,
29961,
29875,
29962,
12436,
13,
462,
462,
6273,
543,
1649,
10945,
5785,
334,
29916,
29892,
4770,
10945,
5785,
334,
29891,
1159,
13,
13,
1678,
405,
353,
29871,
29945,
29896,
29906,
13,
1678,
263,
353,
438,
6154,
2588,
29889,
3166,
29918,
2378,
29898,
9302,
29889,
2873,
3552,
29940,
29892,
29940,
511,
9302,
29889,
7411,
29941,
29906,
876,
13,
1678,
289,
353,
438,
6154,
2588,
29889,
3166,
29918,
2378,
29898,
29906,
5575,
9302,
29889,
2873,
3552,
29940,
29892,
29940,
511,
9302,
29889,
7411,
29941,
29906,
876,
13,
13,
13,
1678,
288,
29896,
353,
438,
6154,
2588,
29889,
6310,
29898,
3285,
9302,
29889,
7411,
29941,
29906,
29897,
13,
1678,
288,
29906,
353,
438,
6154,
2588,
29889,
6310,
29898,
3285,
9302,
29889,
7411,
29941,
29906,
29897,
13,
13,
13,
1678,
515,
931,
1053,
931,
13,
1678,
260,
353,
931,
580,
13,
1678,
363,
903,
297,
3464,
29898,
29946,
29900,
29900,
1125,
13,
4706,
413,
29896,
29898,
29874,
29897,
13,
4706,
413,
29896,
29898,
29890,
29897,
13,
13,
1678,
413,
29896,
29898,
29874,
467,
657,
580,
13,
1678,
413,
29896,
29898,
29890,
467,
657,
580,
13,
1678,
1596,
29898,
2230,
580,
29899,
29873,
29897,
13,
13,
13,
1678,
260,
353,
931,
580,
13,
1678,
396,
2158,
413,
29906,
29898,
29874,
29892,
29890,
29892,
714,
29879,
353,
518,
29877,
29896,
29892,
29877,
29906,
2314,
13,
1678,
363,
903,
297,
3464,
29898,
29946,
29900,
29900,
1125,
13,
4706,
413,
29906,
29898,
29874,
29961,
29900,
1402,
29890,
29961,
29900,
1402,
714,
29879,
353,
518,
29877,
29896,
29892,
29877,
29906,
2314,
13,
13,
1678,
288,
29896,
29889,
657,
580,
13,
1678,
1596,
29898,
2230,
580,
29899,
29873,
29897,
13,
13,
13,
1678,
396,
1722,
703,
22178,
29918,
1482,
29918,
29896,
29889,
3945,
3284,
29893,
2564,
3539,
29898,
11702,
29879,
29908,
29995,
29895,
29906,
29889,
19190,
29918,
29896,
29918,
7192,
467,
6506,
703,
1966,
29876,
3284,
29905,
29876,
5783,
13,
1678,
396,
1722,
703,
22178,
29918,
1482,
29918,
29906,
29889,
3945,
3284,
29893,
2564,
3539,
29898,
11702,
29879,
29908,
29995,
29895,
29906,
29889,
19190,
29918,
29906,
29918,
7192,
467,
6506,
703,
1966,
29876,
3284,
29905,
29876,
5783,
13,
2
] |
Final Class Test/Final Exam - Boundary Detection .py | Ciaran-OBrien/Image-Processing | 2 | 52430 | <reponame>Ciaran-OBrien/Image-Processing
# coding: utf-8
# In[2]:
# Author: <NAME>
# Lecture: Jane Courtney
# Submitted: 13/12/18
# This code is in response to CA Class Test: Boundary Detection
# N.B. This code orignated as a Jupyter file, thus relavent code and lineNumbers remain
# Boiler plate imports
import os
import numpy as np
import cv2
from matplotlib import pyplot as plt
import easygui
import imutils
import math
import operator
# # Setup
#
# Import all the necessary boiler plate code; import statements, header text.
# Obtain important data; Flesh detection in different colour spaces. As the assignment was regrading skin colours, I needed to research what
# colour space and thresholding parameters were necessary here. For this, I took the given image of the skin mole, and used a colour picker tool,
# like Photoshop's colour picker tool, in order to obtain the RGB colours of the skin. I took 10 sample across the image and took an average of
# these values.
# Once I had the RGB vales, I used colorizer.org in order to obtain the HSV values for my chosen skin colour. The algorithm these values were used
# in will be discussed below, along with the code used afterwards.
#
# # Requirements:
#
# - Convert the image to an appropriate colour space;
# - Enhance the image to maximise the contrast between the mole and the skin;
# - Create a binary mask of the mole from the image using thresholding or edge detection;
# - Use morphology to clean up this mask;
# - Extract the contours in the binary image;
# - Sort the contours by area to find the largest;
# - Draw this contour on the original image as a thick red line;
#
# # Method:
#
# My method included 3 steps:
#
# 1. Masking
# 2. Morphological operation
# 3. FindContours
#
# ## 1. Masking:
#
# As mentioned in my setup, I knew that I was dealing with skin colours, so decided to make use of the HSV colour space. Using the values researched
# form above, min_HSV = [20, 70, 0] and max_HSV = [120, 200, 255], I was able to create a binary mask by using the inRange() fnx.
# The inRange() fnx take two parameters, the min and max values for your colour threshold. When we pass in the HSV image, the fnx filters out any
# other colours outside the parameter ranges, and returns a binary mask of the chosen range.This mask was returned from the getHSVMask fxn().
# I did look at trying to use the YCrCb range, as that has proven useful in research for skin thresholding. However, the results I obtained from HSV
# masking we satisfactory. Further work on the mask is shown below.
#
# ## 2. Morphological operation:
#
# The resulting mask from getHSVMask() fnx needed some cleaning up. For this, I made use of OpenCV's morphological operations. These operations
# alter the structure of a binary image, in our case a binary mask. I made use of two operations, closing and opening, with kernel sizes of (7,7)
# and (3,3) respectively.
# Closing is a Dilation followed by an Erosion operation. Here missing holes in the mask, as per the result of getHSVMask(), are filled in relative
# to the background, black.
# Opening an erosion followed by a dilation operation. Here background noise is removed relative to the kernel neighbours. The method implemented
# in the background here is when at least one kernel neighbour has a value of 1, then the pixel element being compared as the central pixel of the
# kernel, is set to a value of 1.
#
# ## 3. FindContours :
#
# The final step in my method concluded with finding the contours of the binary mask, and using a contour to draw a red line around the found mole.
# Firstly I made use of OpenCV's findContour() fnx with three parameters, the binary mask, the contour retrieval mode, and the contour approximation
# method.
# The Binary mask has been defined as per the previous two steps in my method.
# The contour retrieval mode is defined by a set of 5 modes as per OpenCV RetrievalModes documentation. I chose to use the RETR_LIST mode as it
# simply retrieves all the available contours and can be easily accessed just like a regular list. This will be useful, as I am required to sort
# the contours too.
# The contour approximation mode is defined by a set of 5 modes as per OpenCV ContourApproximationModes documentation. I chose to use the
# CHAIN_APPROX_SIMPLE mode as it attempts to filter out false positive contours by compressing horizontal, vertical, and diagonal segments and
# leaves only their end points. However CHAIN_APPROX_NONE, which simply returns all contours found, returns the same number of contours, so either
# mode works.
#
# As the contours are returned as a list, I can easily perform the required task of sorting them according to area size. I did this through the use
# of python's sorted fnx, which takes the list, the sorting key, and order as parameter.
# The lists has been defined as the contours lits earlier
# The sorting key, I use the area of the contours themselves, using cv2.contourArea.
# The order, I set the reversOrder to True, so simply the first element in the list is the largest contours, therefore the contour of the mole.
#
# # Testing:
#
# ## Error checking:
# Error checking occurs when we try to convert an image into HSV. As we can only safely say if an image has 2/3 channels, I built the error
# checking based around that. If the user selects a 2 channle input, an error will be raised.
#
# ## Image Testing:
# Of the two images provided, my current method unfortunately works with one of the images. This is due to the fine tunig required for the
# getMorphologyMask() fnx. Hower, I have added an extra image found online that works with my method.
#
#
# In[533]:
# Converting the Colour image into the HSV range
# The HSV range is more usefull than RGB, as it allows for capturing colours of diffrent Brightness and Saturation
def getHSVImage(colourImage):
try:
if(len(colourImage.shape) == 2):
raise Exception("Potential Gray Image passed. Not allowed!")
elif(len(colourImage.shape) == 3):
return cv2.cvtColor(colourImage.copy(), cv2.COLOR_BGR2HSV)
else:
raise Exception("Unsupported Image")
except Exception as error:
print("An error has occured\n",error)
# In[532]:
def getHSVMask(HSVimage):
min_HSV = np.array([20, 70, 0], dtype=np.uint8)
max_HSV = np.array([120, 190, 255], dtype=np.uint8)
skinMask = cv2.inRange(HSVimage, min_HSV, max_HSV)
return skinMask
# In[283]:
def getYCrCbMask(image):
converted = cv2.cvtColor(image, cv2.COLOR_BGR2YCrCb)
min_YCrCb = np.array([0,133,77],dtype=np.uint8)
max_YCrCb = np.array([255,173,127],dtype=np.uint8)
skinMask = cv2.inRange(converted, min_YCrCb, max_YCrCb)
skinMask[skinMask < 128] = 0
skinMask[skinMask >= 128] = 1
return skinMask
# In[513]:
def getMorphologyMask(hsvMask):
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (7, 7))
mask = cv2.morphologyEx(hsvMask, cv2.MORPH_CLOSE, kernel)
kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5, 5))
mask = cv2.morphologyEx(hsvMask, cv2.MORPH_OPEN, kernel, iterations=2)
return mask
# In[577]:
# Finding contours for the thresholded image
def getDrawContourImage(morphMask,originalImage):
copy = originalImage.copy()
_, contours, _ = cv2.findContours(morphMask, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)
cntsSorted = sorted(contours, key=lambda x: cv2.contourArea(x))
cnt = sorted(contours, key=cv2.contourArea, reverse=True)
cv2.drawContours(copy,cnt[1],-1,(255,0,0),6)
if(cnt[1][0][0][0] > 200):
foundLargeContour = True
else:foundLargeContour = False
return copy,foundLargeContour
# In[580]:
# Inform the user if they should get the mole looked at or not
def plotInformation(foundMole):
if foundMole:
return "Better get that checked out !"
else:
return "Sure looks grand !"
# In[578]:
moleImage = plt.imread("mole.jpg")
moleImage2 = plt.imread("mole2.jpg")
skinCancerImage = plt.imread("skincancer.jpg")
# In[585]:
hsvImage = getHSVImage(moleImage)
hsvMask = getHSVMask(hsvImage)
morphMask = getMorphologyMask(hsvMask)
drawnImage,foundMole = getDrawContourImage(morphMask,moleImage)
plt.suptitle(plotInformation(foundMole))
plt.imshow(drawnImage)
plt.show()
# In[538]:
import unittest
class TestNotebook(unittest.TestCase):
def test_nonGrayImageReturned(self):
grayColourImage = cv2.cvtColor(moleImage,cv2.COLOR_BGR2GRAY)
try:
getHSVImage(grayColourImage)
except Exception:
pass
unittest.main(argv=[''], verbosity=2, exit=False)
| [
1,
529,
276,
1112,
420,
29958,
29907,
4447,
273,
29899,
14824,
19112,
29914,
2940,
29899,
7032,
292,
13,
13,
29937,
14137,
29901,
23616,
29899,
29947,
13,
13,
29937,
512,
29961,
29906,
5387,
13,
13,
13,
29937,
13361,
29901,
529,
5813,
29958,
13,
29937,
365,
522,
545,
29901,
10447,
9245,
3801,
13,
29937,
3323,
29885,
4430,
29901,
29871,
29896,
29941,
29914,
29896,
29906,
29914,
29896,
29947,
13,
29937,
910,
775,
338,
297,
2933,
304,
12766,
4134,
4321,
29901,
350,
618,
653,
360,
2650,
428,
13,
29937,
405,
29889,
29933,
29889,
910,
775,
470,
647,
630,
408,
263,
27441,
25547,
934,
29892,
4550,
10208,
794,
775,
322,
1196,
29478,
3933,
29871,
13,
13,
29937,
1952,
3955,
15284,
24802,
29871,
13,
5215,
2897,
13,
5215,
12655,
408,
7442,
13,
5215,
13850,
29906,
13,
3166,
22889,
1053,
11451,
5317,
408,
14770,
13,
5215,
4780,
23569,
13,
5215,
527,
13239,
13,
5215,
5844,
13,
5215,
5455,
13,
13,
13,
29937,
396,
3789,
786,
13,
29937,
29871,
13,
29937,
16032,
599,
278,
5181,
1045,
3955,
15284,
775,
29936,
1053,
9506,
29892,
4839,
1426,
29889,
13,
29937,
4250,
2408,
4100,
848,
29936,
383,
23854,
15326,
297,
1422,
12384,
8162,
29889,
1094,
278,
12827,
471,
337,
5105,
292,
19309,
28061,
29892,
306,
4312,
304,
5925,
825,
29871,
13,
29937,
12384,
2913,
322,
16897,
292,
4128,
892,
5181,
1244,
29889,
1152,
445,
29892,
306,
3614,
278,
2183,
1967,
310,
278,
19309,
13206,
29892,
322,
1304,
263,
12384,
5839,
261,
5780,
29892,
29871,
13,
29937,
763,
19040,
10578,
459,
29915,
29879,
12384,
5839,
261,
5780,
29892,
297,
1797,
304,
4017,
278,
390,
7210,
28061,
310,
278,
19309,
29889,
306,
3614,
29871,
29896,
29900,
4559,
4822,
278,
1967,
322,
3614,
385,
6588,
310,
29871,
13,
29937,
1438,
1819,
29889,
29871,
13,
29937,
9038,
306,
750,
278,
390,
7210,
659,
267,
29892,
306,
1304,
2927,
3950,
29889,
990,
297,
1797,
304,
4017,
278,
379,
7597,
1819,
363,
590,
10434,
19309,
12384,
29889,
450,
5687,
1438,
1819,
892,
1304,
29871,
13,
29937,
297,
674,
367,
15648,
2400,
29892,
3412,
411,
278,
775,
1304,
12335,
29889,
13,
29937,
29871,
13,
29937,
396,
830,
1548,
1860,
29901,
13,
29937,
29871,
13,
29937,
448,
14806,
278,
1967,
304,
385,
8210,
12384,
2913,
29936,
13,
29937,
448,
1174,
29882,
749,
278,
1967,
304,
5256,
895,
278,
12814,
1546,
278,
13206,
322,
278,
19309,
29936,
13,
29937,
448,
6204,
263,
7581,
11105,
310,
278,
13206,
515,
278,
1967,
773,
16897,
292,
470,
7636,
15326,
29936,
13,
29937,
448,
4803,
18131,
3002,
304,
5941,
701,
445,
11105,
29936,
13,
29937,
448,
7338,
1461,
278,
640,
2470,
297,
278,
7581,
1967,
29936,
13,
29937,
448,
20025,
278,
640,
2470,
491,
4038,
304,
1284,
278,
10150,
29936,
13,
29937,
448,
18492,
445,
640,
473,
373,
278,
2441,
1967,
408,
263,
12003,
2654,
1196,
29936,
13,
29937,
29871,
13,
29937,
396,
8108,
29901,
13,
29937,
29871,
13,
29937,
1619,
1158,
5134,
29871,
29941,
6576,
29901,
13,
29937,
29871,
13,
29937,
29871,
29896,
29889,
341,
1278,
292,
13,
29937,
29871,
29906,
29889,
3879,
561,
5996,
5858,
13,
29937,
29871,
29941,
29889,
10987,
1323,
2470,
13,
29937,
29871,
13,
29937,
444,
29871,
29896,
29889,
341,
1278,
292,
29901,
13,
29937,
29871,
13,
29937,
1094,
5276,
297,
590,
6230,
29892,
306,
6363,
393,
306,
471,
16743,
411,
19309,
28061,
29892,
577,
8459,
304,
1207,
671,
310,
278,
379,
7597,
12384,
2913,
29889,
5293,
278,
1819,
5925,
287,
29871,
13,
29937,
883,
2038,
29892,
29871,
1375,
29918,
29950,
7597,
353,
518,
29906,
29900,
29892,
29871,
29955,
29900,
29892,
29871,
29900,
29962,
322,
4236,
29918,
29950,
7597,
353,
518,
29896,
29906,
29900,
29892,
29871,
29906,
29900,
29900,
29892,
29871,
29906,
29945,
29945,
1402,
306,
471,
2221,
304,
1653,
263,
7581,
11105,
491,
773,
278,
297,
6069,
580,
7876,
29916,
29889,
29871,
13,
29937,
450,
297,
6069,
580,
7876,
29916,
2125,
1023,
4128,
29892,
278,
1375,
322,
4236,
1819,
363,
596,
12384,
16897,
29889,
1932,
591,
1209,
297,
278,
379,
7597,
1967,
29892,
278,
7876,
29916,
18094,
714,
738,
29871,
13,
29937,
916,
28061,
5377,
278,
3443,
20238,
29892,
322,
3639,
263,
7581,
11105,
310,
278,
10434,
3464,
29889,
4013,
11105,
471,
4133,
515,
278,
679,
29950,
7597,
19832,
285,
29916,
29876,
2141,
29871,
13,
29937,
306,
1258,
1106,
472,
1811,
304,
671,
278,
612,
20647,
29907,
29890,
3464,
29892,
408,
393,
756,
16413,
5407,
297,
5925,
363,
19309,
16897,
292,
29889,
2398,
29892,
278,
2582,
306,
7625,
515,
379,
7597,
29871,
13,
29937,
11105,
292,
591,
5119,
3832,
29889,
8725,
664,
373,
278,
11105,
338,
4318,
2400,
29889,
13,
29937,
29871,
13,
29937,
444,
29871,
29906,
29889,
3879,
561,
5996,
5858,
29901,
13,
29937,
29871,
13,
29937,
450,
9819,
11105,
515,
679,
29950,
7597,
19832,
580,
7876,
29916,
4312,
777,
5941,
292,
701,
29889,
1152,
445,
29892,
306,
1754,
671,
310,
4673,
15633,
29915,
29879,
18131,
5996,
6931,
29889,
4525,
6931,
29871,
13,
29937,
10551,
278,
3829,
310,
263,
7581,
1967,
29892,
297,
1749,
1206,
263,
7581,
11105,
29889,
306,
1754,
671,
310,
1023,
6931,
29892,
14382,
322,
8718,
29892,
411,
8466,
15786,
310,
313,
29955,
29892,
29955,
29897,
29871,
13,
29937,
322,
313,
29941,
29892,
29941,
29897,
8307,
29889,
13,
29937,
2233,
14556,
338,
263,
360,
8634,
5643,
491,
385,
382,
1883,
291,
5858,
29889,
2266,
4567,
26532,
297,
278,
11105,
29892,
408,
639,
278,
1121,
310,
679,
29950,
7597,
19832,
3285,
526,
10423,
297,
6198,
29871,
13,
29937,
304,
278,
3239,
29892,
4628,
29889,
13,
29937,
4673,
292,
385,
604,
359,
291,
5643,
491,
263,
270,
8634,
5858,
29889,
2266,
3239,
11462,
338,
6206,
6198,
304,
278,
8466,
22092,
2470,
29889,
450,
1158,
8762,
29871,
13,
29937,
297,
278,
3239,
1244,
338,
746,
472,
3203,
697,
8466,
17647,
756,
263,
995,
310,
29871,
29896,
29892,
769,
278,
15526,
1543,
1641,
9401,
408,
278,
6555,
15526,
310,
278,
29871,
13,
29937,
8466,
29892,
338,
731,
304,
263,
995,
310,
29871,
29896,
29889,
13,
29937,
29871,
13,
29937,
444,
29871,
29941,
29889,
10987,
1323,
2470,
584,
13,
29937,
29871,
13,
29937,
450,
2186,
4331,
297,
590,
1158,
22834,
411,
9138,
278,
640,
2470,
310,
278,
7581,
11105,
29892,
322,
773,
263,
640,
473,
304,
4216,
263,
2654,
1196,
2820,
278,
1476,
13206,
29889,
13,
29937,
3824,
368,
306,
1754,
671,
310,
4673,
15633,
29915,
29879,
1284,
1323,
473,
580,
7876,
29916,
411,
2211,
4128,
29892,
278,
7581,
11105,
29892,
278,
640,
473,
5663,
16837,
4464,
29892,
322,
278,
640,
473,
16845,
29871,
13,
29937,
1158,
29889,
13,
29937,
450,
29479,
11105,
756,
1063,
3342,
408,
639,
278,
3517,
1023,
6576,
297,
590,
1158,
29889,
13,
29937,
450,
640,
473,
5663,
16837,
4464,
338,
3342,
491,
263,
731,
310,
29871,
29945,
18893,
408,
639,
4673,
15633,
19338,
791,
2111,
267,
5106,
29889,
306,
12784,
304,
671,
278,
28081,
29934,
29918,
24360,
4464,
408,
372,
29871,
13,
29937,
3763,
5663,
17180,
599,
278,
3625,
640,
2470,
322,
508,
367,
5948,
20592,
925,
763,
263,
4943,
1051,
29889,
910,
674,
367,
5407,
29892,
408,
306,
626,
3734,
304,
2656,
29871,
13,
29937,
278,
640,
2470,
2086,
29889,
13,
29937,
450,
640,
473,
16845,
4464,
338,
3342,
491,
263,
731,
310,
29871,
29945,
18893,
408,
639,
4673,
15633,
2866,
473,
2052,
307,
2657,
362,
2111,
267,
5106,
29889,
306,
12784,
304,
671,
278,
29871,
13,
29937,
5868,
29909,
1177,
29918,
3301,
8618,
29990,
29918,
5425,
3580,
1307,
4464,
408,
372,
14734,
304,
4175,
714,
2089,
6374,
640,
2470,
491,
27122,
292,
14698,
29892,
11408,
29892,
322,
19640,
24611,
322,
29871,
13,
29937,
11308,
871,
1009,
1095,
3291,
29889,
2398,
5868,
29909,
1177,
29918,
3301,
8618,
29990,
29918,
29940,
12413,
29892,
607,
3763,
3639,
599,
640,
2470,
1476,
29892,
3639,
278,
1021,
1353,
310,
640,
2470,
29892,
577,
2845,
29871,
13,
29937,
4464,
1736,
29889,
13,
29937,
29871,
13,
29937,
1094,
278,
640,
2470,
526,
4133,
408,
263,
1051,
29892,
306,
508,
5948,
2189,
278,
3734,
3414,
310,
16548,
963,
5034,
304,
4038,
2159,
29889,
306,
1258,
445,
1549,
278,
671,
29871,
13,
29937,
310,
3017,
29915,
29879,
12705,
7876,
29916,
29892,
607,
4893,
278,
1051,
29892,
278,
16548,
1820,
29892,
322,
1797,
408,
3443,
29889,
13,
29937,
450,
8857,
756,
1063,
3342,
408,
278,
640,
2470,
301,
1169,
8859,
13,
29937,
450,
16548,
1820,
29892,
306,
671,
278,
4038,
310,
278,
640,
2470,
6053,
29892,
773,
13850,
29906,
29889,
1285,
473,
13799,
29889,
13,
29937,
450,
1797,
29892,
306,
731,
278,
18764,
7514,
304,
5852,
29892,
577,
3763,
278,
937,
1543,
297,
278,
1051,
338,
278,
10150,
640,
2470,
29892,
5480,
278,
640,
473,
310,
278,
13206,
29889,
13,
29937,
29871,
13,
29937,
396,
4321,
292,
29901,
13,
29937,
29871,
13,
29937,
444,
4829,
8454,
29901,
29871,
13,
29937,
4829,
8454,
10008,
746,
591,
1018,
304,
3588,
385,
1967,
964,
379,
7597,
29889,
1094,
591,
508,
871,
23511,
1827,
565,
385,
1967,
756,
29871,
29906,
29914,
29941,
18196,
29892,
306,
4240,
278,
1059,
29871,
13,
29937,
8454,
2729,
2820,
393,
29889,
960,
278,
1404,
27778,
263,
29871,
29906,
521,
812,
280,
1881,
29892,
385,
1059,
674,
367,
10425,
29889,
29871,
13,
29937,
29871,
13,
29937,
444,
7084,
4321,
292,
29901,
29871,
13,
29937,
4587,
278,
1023,
4558,
4944,
29892,
590,
1857,
1158,
15428,
1736,
411,
697,
310,
278,
4558,
29889,
910,
338,
2861,
304,
278,
2691,
18515,
335,
3734,
363,
278,
29871,
13,
29937,
679,
29924,
5676,
3002,
19832,
580,
7876,
29916,
29889,
1128,
261,
29892,
306,
505,
2715,
385,
4805,
1967,
1476,
7395,
393,
1736,
411,
590,
1158,
29889,
13,
29937,
29871,
13,
29937,
29871,
13,
13,
29937,
512,
29961,
29945,
29941,
29941,
5387,
13,
13,
13,
29937,
1281,
369,
1259,
278,
1530,
473,
1967,
964,
278,
379,
7597,
3464,
13,
29937,
450,
379,
7597,
3464,
338,
901,
671,
8159,
1135,
390,
7210,
29892,
408,
372,
6511,
363,
4332,
3864,
28061,
310,
958,
27380,
29258,
2264,
322,
317,
1337,
362,
13,
1753,
679,
29950,
7597,
2940,
29898,
1054,
473,
2940,
1125,
13,
1678,
1018,
29901,
29871,
13,
4706,
565,
29898,
2435,
29898,
1054,
473,
2940,
29889,
12181,
29897,
1275,
29871,
29906,
1125,
13,
9651,
12020,
8960,
703,
29925,
327,
2556,
18956,
7084,
4502,
29889,
2216,
6068,
29991,
1159,
13,
4706,
25342,
29898,
2435,
29898,
1054,
473,
2940,
29889,
12181,
29897,
1275,
29871,
29941,
1125,
13,
9651,
736,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
1054,
473,
2940,
29889,
8552,
3285,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29950,
7597,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
8960,
703,
25807,
29884,
3016,
287,
7084,
1159,
13,
1678,
5174,
8960,
408,
1059,
29901,
13,
4706,
1596,
703,
2744,
1059,
756,
2179,
2955,
29905,
29876,
613,
2704,
29897,
13,
13,
13,
29937,
512,
29961,
29945,
29941,
29906,
5387,
13,
13,
13,
1753,
679,
29950,
7597,
19832,
29898,
29950,
7597,
3027,
1125,
13,
259,
1375,
29918,
29950,
7597,
353,
7442,
29889,
2378,
4197,
29906,
29900,
29892,
29871,
29955,
29900,
29892,
29871,
29900,
1402,
26688,
29922,
9302,
29889,
13470,
29947,
29897,
13,
259,
4236,
29918,
29950,
7597,
353,
7442,
29889,
2378,
4197,
29896,
29906,
29900,
29892,
29871,
29896,
29929,
29900,
29892,
29871,
29906,
29945,
29945,
1402,
26688,
29922,
9302,
29889,
13470,
29947,
29897,
13,
259,
19309,
19832,
353,
13850,
29906,
29889,
262,
6069,
29898,
29950,
7597,
3027,
29892,
1375,
29918,
29950,
7597,
29892,
4236,
29918,
29950,
7597,
29897,
13,
259,
736,
19309,
19832,
13,
13,
13,
29937,
512,
29961,
29906,
29947,
29941,
5387,
13,
13,
13,
1753,
679,
29979,
20647,
29907,
29890,
19832,
29898,
3027,
1125,
13,
1678,
11543,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
3027,
29892,
13850,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29979,
20647,
29907,
29890,
29897,
13,
1678,
1375,
29918,
29979,
20647,
29907,
29890,
353,
7442,
29889,
2378,
4197,
29900,
29892,
29896,
29941,
29941,
29892,
29955,
29955,
1402,
29881,
1853,
29922,
9302,
29889,
13470,
29947,
29897,
13,
1678,
4236,
29918,
29979,
20647,
29907,
29890,
353,
7442,
29889,
2378,
4197,
29906,
29945,
29945,
29892,
29896,
29955,
29941,
29892,
29896,
29906,
29955,
1402,
29881,
1853,
29922,
9302,
29889,
13470,
29947,
29897,
13,
1678,
19309,
19832,
353,
13850,
29906,
29889,
262,
6069,
29898,
13441,
287,
29892,
1375,
29918,
29979,
20647,
29907,
29890,
29892,
4236,
29918,
29979,
20647,
29907,
29890,
29897,
13,
1678,
19309,
19832,
29961,
808,
262,
19832,
529,
29871,
29896,
29906,
29947,
29962,
353,
29871,
29900,
13,
1678,
19309,
19832,
29961,
808,
262,
19832,
6736,
29871,
29896,
29906,
29947,
29962,
353,
29871,
29896,
13,
1678,
736,
19309,
19832,
13,
13,
13,
29937,
512,
29961,
29945,
29896,
29941,
5387,
13,
13,
13,
1753,
679,
29924,
5676,
3002,
19832,
29898,
29882,
4501,
19832,
1125,
13,
1678,
8466,
353,
13850,
29906,
29889,
657,
19560,
3864,
2642,
29898,
11023,
29906,
29889,
29924,
1955,
19689,
29918,
29923,
2208,
5690,
1660,
29892,
313,
29955,
29892,
29871,
29955,
876,
13,
1678,
11105,
353,
13850,
29906,
29889,
29885,
5676,
3002,
1252,
29898,
29882,
4501,
19832,
29892,
13850,
29906,
29889,
29924,
1955,
19689,
29918,
29907,
3927,
1660,
29892,
8466,
29897,
13,
1678,
8466,
353,
13850,
29906,
29889,
657,
19560,
3864,
2642,
29898,
11023,
29906,
29889,
29924,
1955,
19689,
29918,
29923,
2208,
5690,
1660,
29892,
313,
29945,
29892,
29871,
29945,
876,
13,
1678,
11105,
353,
13850,
29906,
29889,
29885,
5676,
3002,
1252,
29898,
29882,
4501,
19832,
29892,
13850,
29906,
29889,
29924,
1955,
19689,
29918,
4590,
1430,
29892,
8466,
29892,
24372,
29922,
29906,
29897,
13,
1678,
736,
11105,
13,
13,
13,
29937,
512,
29961,
29945,
29955,
29955,
5387,
13,
13,
29937,
383,
4015,
640,
2470,
363,
278,
16897,
287,
1967,
13,
1753,
679,
8537,
1323,
473,
2940,
29898,
29885,
5676,
19832,
29892,
13492,
2940,
1125,
13,
1678,
3509,
353,
2441,
2940,
29889,
8552,
580,
13,
1678,
17117,
640,
2470,
29892,
903,
353,
13850,
29906,
29889,
2886,
1323,
2470,
29898,
29885,
5676,
19832,
29892,
13850,
29906,
29889,
1525,
5659,
29918,
24360,
29892,
13850,
29906,
29889,
3210,
29909,
1177,
29918,
3301,
8618,
29990,
29918,
5425,
3580,
1307,
29897,
13,
1678,
274,
593,
29879,
13685,
287,
353,
12705,
29898,
1285,
2470,
29892,
1820,
29922,
2892,
921,
29901,
13850,
29906,
29889,
1285,
473,
13799,
29898,
29916,
876,
13,
1678,
274,
593,
353,
12705,
29898,
1285,
2470,
29892,
1820,
29922,
11023,
29906,
29889,
1285,
473,
13799,
29892,
11837,
29922,
5574,
29897,
13,
1678,
13850,
29906,
29889,
4012,
1323,
2470,
29898,
8552,
29892,
20047,
29961,
29896,
1402,
29899,
29896,
22657,
29906,
29945,
29945,
29892,
29900,
29892,
29900,
511,
29953,
29897,
13,
1678,
565,
29898,
20047,
29961,
29896,
3816,
29900,
3816,
29900,
3816,
29900,
29962,
1405,
29871,
29906,
29900,
29900,
1125,
13,
4706,
1476,
24105,
479,
1323,
473,
353,
5852,
13,
1678,
1683,
29901,
11940,
24105,
479,
1323,
473,
353,
7700,
13,
1678,
736,
3509,
29892,
11940,
24105,
479,
1323,
473,
13,
13,
13,
29937,
512,
29961,
29945,
29947,
29900,
5387,
13,
13,
29937,
15162,
278,
1404,
565,
896,
881,
679,
278,
13206,
5148,
472,
470,
451,
13,
1753,
6492,
20350,
29898,
11940,
29924,
1772,
1125,
13,
1678,
565,
1476,
29924,
1772,
29901,
13,
4706,
736,
376,
29933,
19036,
679,
393,
7120,
714,
1738,
29908,
13,
1678,
1683,
29901,
13,
4706,
736,
376,
29903,
545,
3430,
4595,
1738,
29908,
13,
13,
13,
29937,
512,
29961,
29945,
29955,
29947,
5387,
13,
13,
13,
29885,
1772,
2940,
353,
14770,
29889,
326,
949,
703,
29885,
1772,
29889,
6173,
1159,
13,
29885,
1772,
2940,
29906,
353,
14770,
29889,
326,
949,
703,
29885,
1772,
29906,
29889,
6173,
1159,
13,
808,
262,
6028,
2265,
2940,
353,
14770,
29889,
326,
949,
703,
808,
262,
3068,
2265,
29889,
6173,
1159,
13,
13,
29937,
512,
29961,
29945,
29947,
29945,
5387,
13,
13,
13,
29882,
4501,
2940,
353,
679,
29950,
7597,
2940,
29898,
29885,
1772,
2940,
29897,
13,
29882,
4501,
19832,
353,
679,
29950,
7597,
19832,
29898,
29882,
4501,
2940,
29897,
13,
29885,
5676,
19832,
353,
679,
29924,
5676,
3002,
19832,
29898,
29882,
4501,
19832,
29897,
13,
19811,
1233,
2940,
29892,
11940,
29924,
1772,
353,
679,
8537,
1323,
473,
2940,
29898,
29885,
5676,
19832,
29892,
29885,
1772,
2940,
29897,
13,
572,
29873,
29889,
2146,
415,
1740,
29898,
5317,
20350,
29898,
11940,
29924,
1772,
876,
13,
572,
29873,
29889,
326,
4294,
29898,
19811,
1233,
2940,
29897,
13,
572,
29873,
29889,
4294,
580,
13,
13,
13,
29937,
512,
29961,
29945,
29941,
29947,
5387,
13,
13,
13,
5215,
443,
27958,
13,
13,
1990,
4321,
3664,
19273,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
5464,
29954,
764,
2940,
11609,
287,
29898,
1311,
1125,
13,
4706,
16749,
1625,
473,
2940,
353,
13850,
29906,
29889,
11023,
29873,
3306,
29898,
29885,
1772,
2940,
29892,
11023,
29906,
29889,
15032,
1955,
29918,
29933,
14345,
29906,
29954,
22800,
29897,
13,
4706,
1018,
29901,
13,
9651,
679,
29950,
7597,
2940,
29898,
21012,
1625,
473,
2940,
29897,
13,
4706,
5174,
8960,
29901,
13,
9651,
1209,
13,
308,
13,
348,
27958,
29889,
3396,
29898,
19218,
29922,
1839,
7464,
9750,
359,
537,
29922,
29906,
29892,
6876,
29922,
8824,
29897,
13,
13,
2
] |
Assignment 5/assignment52.py | ziaridoy20/Data-Science-with-Python-and-R | 0 | 115862 | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import poisson
from scipy.stats import uniform
from scipy.stats import norm
# Data
data = np.array([0.3120639, 0.5550930, 0.2493114, 0.9785842])
# Grid.
mus = np.linspace(0, 1, num=100)
sigmas = np.linspace(0, 1, num=100)
x = []
y = []
z = []
# Grid and computation of the posterior.
for mu in mus:
for sigma in sigmas:
posterior = np.prod(norm.pdf(x=data, loc=mu, scale=sigma)) * uniform.pdf(mu, 0, 1) * uniform.pdf(sigma, 0, 1)
x.append(mu)
y.append(sigma)
z.append(posterior)
# Plot using colors.
plt.scatter(x, y, c=z)
plt.show()
| [
1,
1053,
12655,
408,
7442,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
3166,
4560,
2272,
29889,
16202,
1053,
772,
17387,
13,
3166,
4560,
2272,
29889,
16202,
1053,
9090,
13,
3166,
4560,
2272,
29889,
16202,
1053,
6056,
13,
13,
29937,
3630,
13,
1272,
353,
7442,
29889,
2378,
4197,
29900,
29889,
29941,
29896,
29906,
29900,
29953,
29941,
29929,
29892,
29871,
29900,
29889,
29945,
29945,
29945,
29900,
29929,
29941,
29900,
29892,
29871,
29900,
29889,
29906,
29946,
29929,
29941,
29896,
29896,
29946,
29892,
29871,
29900,
29889,
29929,
29955,
29947,
29945,
29947,
29946,
29906,
2314,
13,
13,
29937,
11657,
29889,
13,
8366,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
29871,
29896,
29892,
954,
29922,
29896,
29900,
29900,
29897,
13,
18816,
8247,
353,
7442,
29889,
1915,
3493,
29898,
29900,
29892,
29871,
29896,
29892,
954,
29922,
29896,
29900,
29900,
29897,
13,
13,
29916,
353,
5159,
13,
29891,
353,
5159,
13,
29920,
353,
5159,
13,
13,
29937,
11657,
322,
16287,
310,
278,
13446,
29889,
13,
1454,
3887,
297,
2301,
29901,
13,
1678,
363,
269,
2934,
297,
4365,
8247,
29901,
13,
4706,
13446,
353,
7442,
29889,
10633,
29898,
12324,
29889,
5140,
29898,
29916,
29922,
1272,
29892,
1180,
29922,
2589,
29892,
6287,
29922,
3754,
876,
334,
9090,
29889,
5140,
29898,
2589,
29892,
29871,
29900,
29892,
29871,
29896,
29897,
334,
9090,
29889,
5140,
29898,
3754,
29892,
29871,
29900,
29892,
29871,
29896,
29897,
13,
13,
4706,
921,
29889,
4397,
29898,
2589,
29897,
13,
4706,
343,
29889,
4397,
29898,
3754,
29897,
13,
4706,
503,
29889,
4397,
29898,
2490,
261,
1611,
29897,
13,
13,
29937,
18399,
773,
11955,
29889,
13,
572,
29873,
29889,
1557,
2620,
29898,
29916,
29892,
343,
29892,
274,
29922,
29920,
29897,
13,
572,
29873,
29889,
4294,
580,
13,
2
] |
solutions/1362-Closest-Divisors/1362.py | leetcode-notebook/wonz | 12 | 78818 | <reponame>leetcode-notebook/wonz<gh_stars>10-100
import math
from typing import List
class Solution:
def closestDivisors(self, num: int) -> List[int]:
num1, num2 = num + 1, num + 2
ans1 = self.crack(num1)
ans2 = self.crack(num2)
res = []
if abs(ans1 - int(num1 / ans1)) < abs(ans2 - int(num2 / ans2)): # int
res.append(ans1)
res.append(int(num1 / ans1))
return res
else:
res.append(ans2)
res.append(int(num2 / ans2))
return res
# calculate factor
def crack(self, integer):
factor1, factor2 = 1, integer
for i in range(1, int(math.sqrt(integer)) + 1): # range: [1, sqrt(x) + 1)
if int(integer / i) == integer / i: # i is factor
if integer / i - i < factor2 - factor1:
factor1, factor2 = i, integer / i
return factor1
if __name__ == "__main__":
num = 123
print(Solution().closestDivisors(num)) | [
1,
529,
276,
1112,
420,
29958,
280,
300,
401,
29899,
1333,
19273,
29914,
12620,
29920,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
5844,
13,
3166,
19229,
1053,
2391,
13,
13,
1990,
24380,
29901,
13,
1678,
822,
21438,
12596,
275,
943,
29898,
1311,
29892,
954,
29901,
938,
29897,
1599,
2391,
29961,
524,
5387,
13,
4706,
954,
29896,
29892,
954,
29906,
353,
954,
718,
29871,
29896,
29892,
954,
718,
29871,
29906,
13,
4706,
6063,
29896,
353,
1583,
29889,
29883,
22282,
29898,
1949,
29896,
29897,
13,
4706,
6063,
29906,
353,
1583,
29889,
29883,
22282,
29898,
1949,
29906,
29897,
13,
4706,
620,
353,
5159,
13,
4706,
565,
6425,
29898,
550,
29896,
448,
938,
29898,
1949,
29896,
847,
6063,
29896,
876,
529,
6425,
29898,
550,
29906,
448,
938,
29898,
1949,
29906,
847,
6063,
29906,
22164,
29871,
396,
938,
13,
9651,
620,
29889,
4397,
29898,
550,
29896,
29897,
13,
9651,
620,
29889,
4397,
29898,
524,
29898,
1949,
29896,
847,
6063,
29896,
876,
13,
9651,
736,
620,
13,
4706,
1683,
29901,
13,
9651,
620,
29889,
4397,
29898,
550,
29906,
29897,
13,
9651,
620,
29889,
4397,
29898,
524,
29898,
1949,
29906,
847,
6063,
29906,
876,
13,
9651,
736,
620,
13,
268,
13,
1678,
396,
8147,
7329,
13,
1678,
822,
26755,
29898,
1311,
29892,
6043,
1125,
13,
4706,
7329,
29896,
29892,
7329,
29906,
353,
29871,
29896,
29892,
6043,
13,
4706,
363,
474,
297,
3464,
29898,
29896,
29892,
938,
29898,
755,
29889,
3676,
29898,
16031,
876,
718,
29871,
29896,
1125,
29871,
396,
3464,
29901,
518,
29896,
29892,
18074,
2273,
29898,
29916,
29897,
718,
29871,
29896,
29897,
13,
9651,
565,
938,
29898,
16031,
847,
474,
29897,
1275,
6043,
847,
474,
29901,
29871,
396,
474,
338,
7329,
13,
18884,
565,
6043,
847,
474,
448,
474,
529,
7329,
29906,
448,
7329,
29896,
29901,
13,
462,
1678,
7329,
29896,
29892,
7329,
29906,
353,
474,
29892,
6043,
847,
474,
13,
4706,
736,
7329,
29896,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
954,
353,
29871,
29896,
29906,
29941,
13,
1678,
1596,
29898,
13296,
918,
2141,
11291,
342,
12596,
275,
943,
29898,
1949,
876,
2
] |
Configuration/StandardSequences/python/Eras.py | AndrissP/cmssw | 0 | 129214 | from __future__ import print_function
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.Config import ModifierChain,Modifier
class Eras (object):
"""
Dummy container for all the cms.Modifier instances that config fragments
can use to selectively configure depending on what scenario is active.
"""
def __init__(self):
allEras=['Run1_pA',
'Run1_peripheralPbPb',
'Run2_50ns',
'Run2_50ns_HIPM',
'Run2_25ns',
'Run2_25ns_HIPM',
'Run2_25ns_peripheralPbPb',
'Run2_HI',
'Run2_2016',
'Run2_2016_HIPM',
'Run2_2016_trackingLowPU',
'Run2_2016_pA',
'Run2_2017',
'Run2_2017_FastSim', #new modifier for Phase1 FastSim, skips the muon GEM sequence
'Run2_2017_trackingRun2',
'Run2_2017_trackingLowPU',
'Run2_2017_pp_on_XeXe',
'Run2_2017_ppRef',
'Run2_2018',
'Run2_2018_FastSim', #new modifier for Phase1 FastSim, skips the muon GEM sequence
'Run2_2018_pp_on_AA',
'Run2_2018_pp_on_AA_noHCALmitigation',
'Run2_2018_highBetaStar',
'Run3',
'Phase2',
'Phase2_timing',
'Phase2_timing_layer',
'Phase2_timing_layer_tile',
'Phase2_timing_layer_bar',
'Phase2C4',
'Phase2C4_timing',
'Phase2C6',
'Phase2C6_timing',
'Phase2C4_timing_layer_bar',
'Phase2C8',
'Phase2C8_timing',
'Phase2C8_timing_layer_bar',
]
internalUseMods = ['run2_common', 'run2_25ns_specific',
'run2_50ns_specific', 'run2_HI_specific',
'stage1L1Trigger', 'fastSim',
'peripheralPbPb', 'pA_2016',
'run2_HE_2017', 'stage2L1Trigger', 'stage2L1Trigger_2017',
'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018',
'run3_HB', 'run3_common',
'phase1Pixel', 'run3_GEM', 'run2_GEM_2017',
'run2_CSC_2018',
'phase2_common', 'phase2_tracker',
'phase2_hgcal', 'phase2_muon', 'phase2_timing', 'phase2_hgcalV9', 'phase2_hfnose', 'phase2_hgcalV10',
'phase2_timing_layer','phase2_timing_layer_tile','phase2_timing_layer_bar','phase2_hcal',
'trackingLowPU', 'trackingPhase1', 'ctpps_2016', 'trackingPhase2PU140','highBetaStar_2018',
'tracker_apv_vfp30_2016', 'pf_badHcalMitigation', 'run2_miniAOD_80XLegacy','run2_miniAOD_94XFall17', 'run2_nanoAOD_92X',
'run2_nanoAOD_94XMiniAODv1', 'run2_nanoAOD_94XMiniAODv2', 'run2_nanoAOD_94X2016',
'run2_miniAOD_devel', 'run2_nanoAOD_102Xv1', 'run2_nanoAOD_106Xv1', 'run2_nanoAOD_106Xv2', 'run2_nanoAOD_devel',
'run2_tau_ul_2016', 'run2_tau_ul_2018',
'hcalHardcodeConditions', 'hcalSkipPacker',
'run2_HLTconditions_2016','run2_HLTconditions_2017','run2_HLTconditions_2018',
'bParking']
internalUseModChains = ['run2_2017_noTrackingModifier']
self.pythonCfgLines = {}
for e in allEras:
eObj=getattr(__import__('Configuration.Eras.Era_'+e+'_cff',globals(),locals(),[e],0),e)
self.addEra(e,eObj)
self.pythonCfgLines[e] = 'from Configuration.Eras.Era_'+e+'_cff import '+e
for e in internalUseMods:
eObj=getattr(__import__('Configuration.Eras.Modifier_'+e+'_cff',globals(),locals(),[e],0),e)
self.addEra(e,eObj)
self.pythonCfgLines[e] = 'from Configuration.Eras.Modifier_'+e+'_cff import '+e
for e in internalUseModChains:
eObj=getattr(__import__('Configuration.Eras.ModifierChain_'+e+'_cff',globals(),locals(),[e],0),e)
self.addEra(e,eObj)
self.pythonCfgLines[e] = 'from Configuration.Eras.ModifierChain_'+e+'_cff import '+e
def addEra(self,name,obj):
setattr(self,name,obj)
def inspectModifier(self,m,details):
print(' ',m.__dict__ ['_Modifier__processModifiers'])
def inspectEra(self,e,details):
print('\nEra:',e)
print(' isChosen:',getattr(self,e)._isChosen())
if details: print(' Modifiers:')
nmod=0
for value in getattr(self,e).__dict__['_ModifierChain__chain']:
if isinstance(value, Modifier):
nmod=nmod+1
if details: self.inspectModifier(value,details)
print(' ',nmod,'modifiers defined')
def inspect(self,name=None,onlyChosen=False,details=True):
if name==None:
print('Inspecting the known eras', end=' ')
if onlyChosen: print(' (all active)')
else: print('(all eras defined)')
else:
print('Inspecting the '+name+' era', end=' ')
allEras=[]
for key, value in self.__dict__.items():
if isinstance(value, ModifierChain): allEras.append(key)
for e in allEras:
if name is not None and name==e:
self.inspectEra(e,details)
if name is None:
if not onlyChosen or getattr(self,e).isChosen():
self.inspectEra(e,details)
eras=Eras()
#eras.inspect()
| [
1,
515,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
5215,
383,
29956,
9203,
29889,
9329,
2697,
29889,
3991,
408,
274,
1516,
13,
3166,
29871,
383,
29956,
9203,
29889,
9329,
2697,
29889,
3991,
1053,
3382,
3709,
14688,
29892,
2111,
3709,
13,
13,
1990,
1425,
294,
313,
3318,
1125,
13,
1678,
9995,
13,
1678,
360,
11770,
5639,
363,
599,
278,
274,
1516,
29889,
2111,
3709,
8871,
393,
2295,
22370,
13,
1678,
508,
671,
304,
1831,
3598,
10822,
8679,
373,
825,
10483,
338,
6136,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
599,
2110,
294,
29922,
1839,
6558,
29896,
29918,
29886,
29909,
742,
13,
462,
525,
6558,
29896,
29918,
546,
29875,
8096,
284,
29925,
29890,
29925,
29890,
742,
13,
462,
525,
6558,
29906,
29918,
29945,
29900,
1983,
742,
13,
462,
525,
6558,
29906,
29918,
29945,
29900,
1983,
29918,
29950,
5690,
29924,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29945,
1983,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29945,
1983,
29918,
29950,
5690,
29924,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29945,
1983,
29918,
546,
29875,
8096,
284,
29925,
29890,
29925,
29890,
742,
13,
462,
525,
6558,
29906,
29918,
17628,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29953,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29953,
29918,
29950,
5690,
29924,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29953,
29918,
11294,
292,
29931,
340,
7056,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29953,
29918,
29886,
29909,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29955,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29955,
29918,
29943,
579,
8942,
742,
396,
1482,
878,
3709,
363,
1963,
559,
29896,
23786,
8942,
29892,
14993,
567,
278,
3887,
265,
402,
12665,
5665,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29955,
29918,
11294,
292,
6558,
29906,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29955,
29918,
11294,
292,
29931,
340,
7056,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29955,
29918,
407,
29918,
265,
29918,
29990,
29872,
29990,
29872,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29955,
29918,
407,
5620,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29947,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29947,
29918,
29943,
579,
8942,
742,
396,
1482,
878,
3709,
363,
1963,
559,
29896,
23786,
8942,
29892,
14993,
567,
278,
3887,
265,
402,
12665,
5665,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29947,
29918,
407,
29918,
265,
29918,
6344,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29947,
29918,
407,
29918,
265,
29918,
6344,
29918,
1217,
19127,
1964,
2415,
335,
362,
742,
13,
462,
525,
6558,
29906,
29918,
29906,
29900,
29896,
29947,
29918,
9812,
29933,
1187,
16213,
742,
13,
462,
525,
6558,
29941,
742,
13,
462,
525,
4819,
559,
29906,
742,
13,
462,
525,
4819,
559,
29906,
29918,
9346,
292,
742,
13,
462,
525,
4819,
559,
29906,
29918,
9346,
292,
29918,
13148,
742,
13,
462,
525,
4819,
559,
29906,
29918,
9346,
292,
29918,
13148,
29918,
29873,
488,
742,
13,
462,
525,
4819,
559,
29906,
29918,
9346,
292,
29918,
13148,
29918,
1646,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29946,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29946,
29918,
9346,
292,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29953,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29953,
29918,
9346,
292,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29946,
29918,
9346,
292,
29918,
13148,
29918,
1646,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29947,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29947,
29918,
9346,
292,
742,
13,
462,
525,
4819,
559,
29906,
29907,
29947,
29918,
9346,
292,
29918,
13148,
29918,
1646,
742,
13,
4706,
4514,
13,
13,
4706,
7463,
11403,
2111,
29879,
353,
6024,
3389,
29906,
29918,
9435,
742,
525,
3389,
29906,
29918,
29906,
29945,
1983,
29918,
14940,
742,
13,
462,
965,
525,
3389,
29906,
29918,
29945,
29900,
1983,
29918,
14940,
742,
525,
3389,
29906,
29918,
17628,
29918,
14940,
742,
13,
462,
965,
525,
19190,
29896,
29931,
29896,
20211,
742,
525,
11255,
8942,
742,
13,
462,
965,
525,
546,
29875,
8096,
284,
29925,
29890,
29925,
29890,
742,
525,
29886,
29909,
29918,
29906,
29900,
29896,
29953,
742,
13,
462,
965,
525,
3389,
29906,
29918,
9606,
29918,
29906,
29900,
29896,
29955,
742,
525,
19190,
29906,
29931,
29896,
20211,
742,
525,
19190,
29906,
29931,
29896,
20211,
29918,
29906,
29900,
29896,
29955,
742,
13,
462,
965,
525,
3389,
29906,
29918,
29950,
29943,
29918,
29906,
29900,
29896,
29955,
742,
525,
3389,
29906,
29918,
19127,
1964,
29918,
29906,
29900,
29896,
29955,
742,
525,
3389,
29906,
29918,
9606,
20334,
29896,
29918,
29906,
29900,
29896,
29955,
742,
525,
3389,
29906,
29918,
29950,
29933,
29918,
29906,
29900,
29896,
29947,
3788,
3389,
29906,
29918,
9606,
29918,
29906,
29900,
29896,
29947,
742,
29871,
13,
462,
965,
525,
3389,
29941,
29918,
29950,
29933,
742,
525,
3389,
29941,
29918,
9435,
742,
13,
462,
965,
525,
21646,
29896,
29637,
742,
525,
3389,
29941,
29918,
1692,
29924,
742,
525,
3389,
29906,
29918,
1692,
29924,
29918,
29906,
29900,
29896,
29955,
742,
13,
462,
965,
525,
3389,
29906,
29918,
29907,
7187,
29918,
29906,
29900,
29896,
29947,
742,
13,
462,
965,
525,
21646,
29906,
29918,
9435,
742,
525,
21646,
29906,
29918,
3018,
4937,
742,
13,
462,
965,
525,
21646,
29906,
29918,
29882,
29887,
1052,
742,
525,
21646,
29906,
29918,
2589,
265,
742,
525,
21646,
29906,
29918,
9346,
292,
742,
525,
21646,
29906,
29918,
29882,
29887,
1052,
29963,
29929,
742,
525,
21646,
29906,
29918,
29882,
9144,
852,
742,
525,
21646,
29906,
29918,
29882,
29887,
1052,
29963,
29896,
29900,
742,
13,
462,
965,
525,
21646,
29906,
29918,
9346,
292,
29918,
13148,
3788,
21646,
29906,
29918,
9346,
292,
29918,
13148,
29918,
29873,
488,
3788,
21646,
29906,
29918,
9346,
292,
29918,
13148,
29918,
1646,
3788,
21646,
29906,
29918,
29882,
1052,
742,
13,
462,
965,
525,
11294,
292,
29931,
340,
7056,
742,
525,
11294,
292,
4819,
559,
29896,
742,
525,
312,
407,
29879,
29918,
29906,
29900,
29896,
29953,
742,
525,
11294,
292,
4819,
559,
29906,
7056,
29896,
29946,
29900,
3788,
9812,
29933,
1187,
16213,
29918,
29906,
29900,
29896,
29947,
742,
13,
462,
965,
525,
3018,
4937,
29918,
481,
29894,
29918,
29894,
18091,
29941,
29900,
29918,
29906,
29900,
29896,
29953,
742,
525,
7810,
29918,
12313,
29950,
1052,
29924,
277,
335,
362,
742,
525,
3389,
29906,
29918,
1195,
29875,
29909,
13668,
29918,
29947,
29900,
29990,
22988,
4135,
3788,
3389,
29906,
29918,
1195,
29875,
29909,
13668,
29918,
29929,
29946,
29990,
29943,
497,
29896,
29955,
742,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
29929,
29906,
29990,
742,
13,
462,
965,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
29929,
29946,
29990,
29924,
2172,
29909,
13668,
29894,
29896,
742,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
29929,
29946,
29990,
29924,
2172,
29909,
13668,
29894,
29906,
742,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
29929,
29946,
29990,
29906,
29900,
29896,
29953,
742,
13,
462,
965,
525,
3389,
29906,
29918,
1195,
29875,
29909,
13668,
29918,
311,
955,
742,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
29896,
29900,
29906,
29990,
29894,
29896,
742,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
29896,
29900,
29953,
29990,
29894,
29896,
742,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
29896,
29900,
29953,
29990,
29894,
29906,
742,
525,
3389,
29906,
29918,
29876,
1562,
29909,
13668,
29918,
311,
955,
742,
29871,
13,
462,
965,
525,
3389,
29906,
29918,
4722,
29918,
352,
29918,
29906,
29900,
29896,
29953,
742,
525,
3389,
29906,
29918,
4722,
29918,
352,
29918,
29906,
29900,
29896,
29947,
742,
13,
462,
965,
525,
29882,
1052,
29950,
538,
401,
10983,
2187,
742,
525,
29882,
1052,
15797,
666,
16638,
261,
742,
13,
462,
965,
525,
3389,
29906,
29918,
29950,
5850,
1116,
2187,
29918,
29906,
29900,
29896,
29953,
3788,
3389,
29906,
29918,
29950,
5850,
1116,
2187,
29918,
29906,
29900,
29896,
29955,
3788,
3389,
29906,
29918,
29950,
5850,
1116,
2187,
29918,
29906,
29900,
29896,
29947,
742,
13,
462,
965,
525,
29890,
29925,
935,
292,
2033,
13,
4706,
7463,
11403,
2111,
1451,
2708,
353,
6024,
3389,
29906,
29918,
29906,
29900,
29896,
29955,
29918,
1217,
17936,
292,
2111,
3709,
2033,
13,
13,
4706,
1583,
29889,
4691,
29907,
16434,
20261,
353,
6571,
13,
13,
4706,
363,
321,
297,
599,
2110,
294,
29901,
13,
9651,
321,
9930,
29922,
657,
5552,
22168,
5215,
1649,
877,
8614,
29889,
2110,
294,
29889,
29923,
336,
29918,
18717,
29872,
29974,
15972,
29883,
600,
742,
23705,
1338,
3285,
2997,
29879,
3285,
29961,
29872,
1402,
29900,
511,
29872,
29897,
13,
9651,
1583,
29889,
1202,
29923,
336,
29898,
29872,
29892,
29872,
9930,
29897,
13,
9651,
1583,
29889,
4691,
29907,
16434,
20261,
29961,
29872,
29962,
353,
525,
3166,
20999,
29889,
2110,
294,
29889,
29923,
336,
29918,
18717,
29872,
29974,
15972,
29883,
600,
1053,
525,
29974,
29872,
13,
13,
4706,
363,
321,
297,
7463,
11403,
2111,
29879,
29901,
13,
9651,
321,
9930,
29922,
657,
5552,
22168,
5215,
1649,
877,
8614,
29889,
2110,
294,
29889,
2111,
3709,
29918,
18717,
29872,
29974,
15972,
29883,
600,
742,
23705,
1338,
3285,
2997,
29879,
3285,
29961,
29872,
1402,
29900,
511,
29872,
29897,
13,
9651,
1583,
29889,
1202,
29923,
336,
29898,
29872,
29892,
29872,
9930,
29897,
13,
9651,
1583,
29889,
4691,
29907,
16434,
20261,
29961,
29872,
29962,
353,
525,
3166,
20999,
29889,
2110,
294,
29889,
2111,
3709,
29918,
18717,
29872,
29974,
15972,
29883,
600,
1053,
525,
29974,
29872,
13,
13,
4706,
363,
321,
297,
7463,
11403,
2111,
1451,
2708,
29901,
13,
9651,
321,
9930,
29922,
657,
5552,
22168,
5215,
1649,
877,
8614,
29889,
2110,
294,
29889,
2111,
3709,
14688,
29918,
18717,
29872,
29974,
15972,
29883,
600,
742,
23705,
1338,
3285,
2997,
29879,
3285,
29961,
29872,
1402,
29900,
511,
29872,
29897,
13,
9651,
1583,
29889,
1202,
29923,
336,
29898,
29872,
29892,
29872,
9930,
29897,
13,
9651,
1583,
29889,
4691,
29907,
16434,
20261,
29961,
29872,
29962,
353,
525,
3166,
20999,
29889,
2110,
294,
29889,
2111,
3709,
14688,
29918,
18717,
29872,
29974,
15972,
29883,
600,
1053,
525,
29974,
29872,
13,
13,
13,
1678,
822,
788,
29923,
336,
29898,
1311,
29892,
978,
29892,
5415,
1125,
13,
4706,
731,
5552,
29898,
1311,
29892,
978,
29892,
5415,
29897,
13,
13,
1678,
822,
16096,
2111,
3709,
29898,
1311,
29892,
29885,
29892,
14144,
1125,
13,
4706,
1596,
877,
418,
13420,
29885,
17255,
8977,
1649,
6024,
29918,
2111,
3709,
1649,
5014,
2111,
14903,
11287,
13,
13,
1678,
822,
16096,
29923,
336,
29898,
1311,
29892,
29872,
29892,
14144,
1125,
13,
4706,
1596,
28909,
29876,
29923,
336,
29901,
742,
29872,
29897,
13,
4706,
1596,
877,
259,
338,
1451,
7749,
29901,
742,
657,
5552,
29898,
1311,
29892,
29872,
467,
29918,
275,
1451,
7749,
3101,
13,
4706,
565,
4902,
29901,
1596,
877,
259,
3382,
14903,
29901,
1495,
13,
4706,
302,
1545,
29922,
29900,
13,
4706,
363,
995,
297,
679,
5552,
29898,
1311,
29892,
29872,
467,
1649,
8977,
1649,
1839,
29918,
2111,
3709,
14688,
1649,
14153,
2033,
29901,
13,
9651,
565,
338,
8758,
29898,
1767,
29892,
3382,
3709,
1125,
13,
18884,
302,
1545,
29922,
29876,
1545,
29974,
29896,
13,
18884,
565,
4902,
29901,
1583,
29889,
1144,
1103,
2111,
3709,
29898,
1767,
29892,
14144,
29897,
13,
4706,
1596,
877,
259,
13420,
29876,
1545,
5501,
1545,
14903,
3342,
1495,
13,
13,
1678,
822,
16096,
29898,
1311,
29892,
978,
29922,
8516,
29892,
6194,
1451,
7749,
29922,
8824,
29892,
14144,
29922,
5574,
1125,
13,
4706,
565,
1024,
1360,
8516,
29901,
13,
9651,
1596,
877,
797,
21494,
292,
278,
2998,
604,
294,
742,
1095,
2433,
25710,
13,
9651,
565,
871,
1451,
7749,
29901,
1596,
877,
313,
497,
6136,
29897,
1495,
13,
9651,
1683,
29901,
1596,
877,
29898,
497,
604,
294,
3342,
29897,
1495,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
797,
21494,
292,
278,
525,
29974,
978,
23097,
3152,
742,
1095,
2433,
25710,
13,
13,
4706,
599,
2110,
294,
29922,
2636,
13,
4706,
363,
1820,
29892,
995,
297,
1583,
17255,
8977,
26914,
7076,
7295,
13,
9651,
565,
338,
8758,
29898,
1767,
29892,
3382,
3709,
14688,
1125,
599,
2110,
294,
29889,
4397,
29898,
1989,
29897,
13,
13,
4706,
363,
321,
297,
599,
2110,
294,
29901,
13,
9651,
565,
1024,
338,
451,
6213,
322,
1024,
1360,
29872,
29901,
13,
18884,
1583,
29889,
1144,
1103,
29923,
336,
29898,
29872,
29892,
14144,
29897,
13,
9651,
565,
1024,
338,
6213,
29901,
13,
18884,
565,
451,
871,
1451,
7749,
470,
679,
5552,
29898,
1311,
29892,
29872,
467,
275,
1451,
7749,
7295,
13,
462,
1678,
1583,
29889,
1144,
1103,
29923,
336,
29898,
29872,
29892,
14144,
29897,
13,
13,
18464,
29922,
2110,
294,
580,
13,
13,
13,
29937,
18464,
29889,
1144,
1103,
580,
13,
2
] |
toga/genetic_algorithm/mutate/float.py | JPLMLIA/TOGA | 0 | 40993 | <gh_stars>0
"""
Author: <NAME>
Date : 1/23/19
Brief :
Notes :
Copyright 2019 California Institute of Technology. ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
"""
import numpy as np
import random
from toga.genetic_algorithm.genetype import Mutator
from toga.genetic_algorithm.mutate.genemutate import GeneMutate
class FloatGene(GeneMutate):
def __init__(self, dictionary=None, parents=None, mutator=Mutator.Crossover, mutator_params={}):
self.dictionary = dictionary
self.parents = parents
self.mutator_params = mutator_params if mutator_params is not None else {}
self.percentage = self.mutator_params.get('percentage') if self.mutator_params.get(
'percentage') is not None else 1.0
self.frequency = self.mutator_params.get('frequency')
super().__init__(dictionary, parents, mutator)
def mutate(self):
"""
:return:
"""
return super().mutate()
def crossover(self):
"""
:return:
"""
if self.parents:
value = np.random.choice([x for x in self.parents], size=1, replace=False).tolist()[0]
return float(value)
else:
return self.random()
def random(self):
"""
:return:
"""
values = self.dictionary.get('range')
val = np.random.uniform(min(values), max(values))
return float(val)
def gaussian_step(self):
"""
:return:
"""
if self.parents:
parent = self.parents[0]
original = parent
values = self.dictionary.get('range')
scale = np.abs((max(values) - min(values)))
new_var = np.random.normal(loc=original, scale=scale/4)
new_var = max(min(values), new_var)
new_var = min(max(values), new_var)
return float(new_var)
else:
return self.random()
def gaussian_random(self):
"""
:return:
"""
values = self.dictionary.get('range')
dist = np.arange(min(values), max(values))
return float(min(max(values), max(min(values), random.gauss(np.mean(dist), sigma=3))))
def scaled(self):
values = self.dictionary.get('range')
return float(((max(values) - min(values)) * self.percentage) + min(values))
def minimum(self):
values = self.dictionary.get('range')
return min(values)
def maximum(self):
values = self.dictionary.get('range')
return max(values)
if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
15945,
29908,
13,
13720,
29901,
529,
5813,
29958,
13,
13,
2539,
29871,
584,
29871,
29896,
29914,
29906,
29941,
29914,
29896,
29929,
13,
13,
29933,
2546,
29888,
584,
13,
13,
3664,
267,
584,
13,
13,
11882,
1266,
29871,
29906,
29900,
29896,
29929,
8046,
8907,
310,
17968,
29889,
29871,
15149,
390,
22530,
29903,
390,
2890,
1001,
29963,
3352,
29889,
13,
29965,
29889,
29903,
29889,
10354,
1706,
787,
272,
3527,
24084,
3192,
29889,
13,
15945,
29908,
13,
5215,
12655,
408,
7442,
13,
5215,
4036,
13,
3166,
304,
3249,
29889,
1885,
7492,
29918,
20567,
29889,
1885,
300,
668,
1053,
20749,
1061,
13,
3166,
304,
3249,
29889,
1885,
7492,
29918,
20567,
29889,
6149,
403,
29889,
1885,
331,
329,
403,
1053,
15350,
29924,
329,
403,
13,
13,
13,
1990,
27842,
29954,
1600,
29898,
29954,
1600,
29924,
329,
403,
1125,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
29871,
8600,
29922,
8516,
29892,
11825,
29922,
8516,
29892,
5478,
1061,
29922,
29924,
329,
1061,
29889,
29907,
1883,
578,
369,
29892,
5478,
1061,
29918,
7529,
3790,
29913,
1125,
13,
4706,
1583,
29889,
27126,
353,
8600,
13,
4706,
1583,
29889,
862,
1237,
353,
11825,
13,
4706,
1583,
29889,
6149,
1061,
29918,
7529,
353,
5478,
1061,
29918,
7529,
565,
5478,
1061,
29918,
7529,
338,
451,
6213,
1683,
6571,
13,
4706,
1583,
29889,
25376,
482,
353,
1583,
29889,
6149,
1061,
29918,
7529,
29889,
657,
877,
25376,
482,
1495,
565,
1583,
29889,
6149,
1061,
29918,
7529,
29889,
657,
29898,
13,
9651,
525,
25376,
482,
1495,
338,
451,
6213,
1683,
29871,
29896,
29889,
29900,
13,
4706,
1583,
29889,
10745,
23860,
353,
1583,
29889,
6149,
1061,
29918,
7529,
29889,
657,
877,
10745,
23860,
1495,
13,
4706,
2428,
2141,
1649,
2344,
12035,
27126,
29892,
11825,
29892,
5478,
1061,
29897,
13,
13,
1678,
822,
5478,
403,
29898,
1311,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
736,
2428,
2141,
6149,
403,
580,
13,
13,
1678,
822,
274,
1883,
578,
369,
29898,
1311,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
13,
4706,
565,
1583,
29889,
862,
1237,
29901,
13,
9651,
995,
353,
7442,
29889,
8172,
29889,
16957,
4197,
29916,
363,
921,
297,
1583,
29889,
862,
1237,
1402,
2159,
29922,
29896,
29892,
5191,
29922,
8824,
467,
25027,
391,
580,
29961,
29900,
29962,
13,
9651,
736,
5785,
29898,
1767,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
8172,
580,
13,
13,
1678,
822,
4036,
29898,
1311,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
1819,
353,
1583,
29889,
27126,
29889,
657,
877,
3881,
1495,
13,
4706,
659,
353,
7442,
29889,
8172,
29889,
29590,
29898,
1195,
29898,
5975,
511,
4236,
29898,
5975,
876,
13,
4706,
736,
5785,
29898,
791,
29897,
13,
13,
1678,
822,
330,
17019,
29918,
10568,
29898,
1311,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
565,
1583,
29889,
862,
1237,
29901,
13,
9651,
3847,
353,
1583,
29889,
862,
1237,
29961,
29900,
29962,
13,
9651,
2441,
353,
3847,
13,
9651,
1819,
353,
1583,
29889,
27126,
29889,
657,
877,
3881,
1495,
13,
13,
9651,
6287,
353,
7442,
29889,
6897,
3552,
3317,
29898,
5975,
29897,
448,
1375,
29898,
5975,
4961,
13,
9651,
716,
29918,
1707,
353,
7442,
29889,
8172,
29889,
8945,
29898,
2029,
29922,
13492,
29892,
6287,
29922,
7052,
29914,
29946,
29897,
13,
9651,
716,
29918,
1707,
353,
4236,
29898,
1195,
29898,
5975,
511,
716,
29918,
1707,
29897,
13,
9651,
716,
29918,
1707,
353,
1375,
29898,
3317,
29898,
5975,
511,
716,
29918,
1707,
29897,
13,
9651,
736,
5785,
29898,
1482,
29918,
1707,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
1583,
29889,
8172,
580,
13,
13,
1678,
822,
330,
17019,
29918,
8172,
29898,
1311,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
4706,
1819,
353,
1583,
29889,
27126,
29889,
657,
877,
3881,
1495,
13,
4706,
1320,
353,
7442,
29889,
279,
927,
29898,
1195,
29898,
5975,
511,
4236,
29898,
5975,
876,
13,
4706,
736,
5785,
29898,
1195,
29898,
3317,
29898,
5975,
511,
4236,
29898,
1195,
29898,
5975,
511,
4036,
29889,
29887,
11214,
29898,
9302,
29889,
12676,
29898,
5721,
511,
269,
2934,
29922,
29941,
13697,
13,
13,
1678,
822,
6287,
29881,
29898,
1311,
1125,
13,
4706,
1819,
353,
1583,
29889,
27126,
29889,
657,
877,
3881,
1495,
13,
4706,
736,
5785,
3552,
29898,
3317,
29898,
5975,
29897,
448,
1375,
29898,
5975,
876,
334,
1583,
29889,
25376,
482,
29897,
718,
1375,
29898,
5975,
876,
13,
13,
1678,
822,
9212,
29898,
1311,
1125,
13,
4706,
1819,
353,
1583,
29889,
27126,
29889,
657,
877,
3881,
1495,
13,
4706,
736,
1375,
29898,
5975,
29897,
13,
13,
1678,
822,
7472,
29898,
1311,
1125,
13,
4706,
1819,
353,
1583,
29889,
27126,
29889,
657,
877,
3881,
1495,
13,
4706,
736,
4236,
29898,
5975,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1053,
437,
312,
342,
13,
13,
1678,
437,
312,
342,
29889,
1688,
1545,
29898,
3385,
15764,
29922,
1867,
312,
342,
29889,
29923,
2208,
5690,
29903,
3235,
891,
437,
312,
342,
29889,
29940,
1955,
1529,
5265,
10721,
29918,
25039,
1806,
2890,
29925,
11538,
29897,
13,
2
] |
util/file_processing.py | Valzavator/YouTubeTrendingVideosAnalysis | 2 | 153272 | import pandas as pd
import os
import time
from processing_tool.data_preprocessing import prepare_feature_for_csv
from util.args import Args
def get_data_from_file(file_path: str) -> list:
with open(file_path) as file:
lines = [line.strip() for line in file]
return lines
def write_to_file(output_dir, file_name, data):
if output_dir is None:
raise NotADirectoryError('Invalid output directory name!')
if not os.path.exists(output_dir):
os.makedirs(output_dir)
with open(os.path.join(output_dir, file_name), "w+",
encoding='utf-8') as file:
for row in data:
file.write(f"{row}\n")
def get_videos_data_from_csv(*files) -> list:
data_frames = []
for file in files:
try:
if file is not None:
data_frames.append(pd.read_csv(file))
except FileNotFoundError as e:
print(e.strerror)
if len(data_frames) == 0:
return []
videos_data = pd.concat(data_frames).to_dict('records')
return videos_data
def save_videos_data_into_csv(
videos_data: list,
file_name=f"{time.strftime('%d-%m-%y_%H.%M.%S')}_videos.csv",
output_dir=Args.raw_data_dir()):
if videos_data is None:
raise ValueError('Videos data can`t be None!')
csv_data = [','.join(videos_data[0].keys())]
for video in videos_data:
if video is None:
continue
csv_data.append(','.join([prepare_feature_for_csv(val) for val in video.values()]))
write_to_file(
output_dir,
file_name,
csv_data)
| [
1,
1053,
11701,
408,
10518,
13,
5215,
2897,
13,
5215,
931,
13,
3166,
9068,
29918,
10154,
29889,
1272,
29918,
1457,
19170,
1053,
19012,
29918,
14394,
29918,
1454,
29918,
7638,
13,
13,
3166,
3667,
29889,
5085,
1053,
826,
3174,
13,
13,
13,
1753,
679,
29918,
1272,
29918,
3166,
29918,
1445,
29898,
1445,
29918,
2084,
29901,
851,
29897,
1599,
1051,
29901,
13,
1678,
411,
1722,
29898,
1445,
29918,
2084,
29897,
408,
934,
29901,
13,
4706,
3454,
353,
518,
1220,
29889,
17010,
580,
363,
1196,
297,
934,
29962,
13,
13,
1678,
736,
3454,
13,
13,
13,
1753,
2436,
29918,
517,
29918,
1445,
29898,
4905,
29918,
3972,
29892,
934,
29918,
978,
29892,
848,
1125,
13,
1678,
565,
1962,
29918,
3972,
338,
6213,
29901,
13,
4706,
12020,
2216,
3035,
5554,
2392,
877,
13919,
1962,
3884,
1024,
29991,
1495,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
4905,
29918,
3972,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
4905,
29918,
3972,
29897,
13,
13,
1678,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
4905,
29918,
3972,
29892,
934,
29918,
978,
511,
376,
29893,
29974,
613,
13,
795,
8025,
2433,
9420,
29899,
29947,
1495,
408,
934,
29901,
13,
4706,
363,
1948,
297,
848,
29901,
13,
9651,
934,
29889,
3539,
29898,
29888,
29908,
29912,
798,
1012,
29876,
1159,
13,
13,
13,
1753,
679,
29918,
29894,
7958,
29918,
1272,
29918,
3166,
29918,
7638,
10456,
5325,
29897,
1599,
1051,
29901,
13,
1678,
848,
29918,
19935,
353,
5159,
13,
13,
1678,
363,
934,
297,
2066,
29901,
13,
4706,
1018,
29901,
13,
9651,
565,
934,
338,
451,
6213,
29901,
13,
18884,
848,
29918,
19935,
29889,
4397,
29898,
15926,
29889,
949,
29918,
7638,
29898,
1445,
876,
13,
4706,
5174,
3497,
17413,
2392,
408,
321,
29901,
13,
9651,
1596,
29898,
29872,
29889,
710,
2704,
29897,
13,
13,
1678,
565,
7431,
29898,
1272,
29918,
19935,
29897,
1275,
29871,
29900,
29901,
13,
4706,
736,
5159,
13,
13,
1678,
19707,
29918,
1272,
353,
10518,
29889,
17685,
29898,
1272,
29918,
19935,
467,
517,
29918,
8977,
877,
3757,
4339,
1495,
13,
13,
1678,
736,
19707,
29918,
1272,
13,
13,
13,
1753,
4078,
29918,
29894,
7958,
29918,
1272,
29918,
8941,
29918,
7638,
29898,
13,
4706,
19707,
29918,
1272,
29901,
1051,
29892,
13,
4706,
934,
29918,
978,
29922,
29888,
29908,
29912,
2230,
29889,
710,
615,
603,
877,
29995,
29881,
19222,
29885,
19222,
29891,
29918,
29995,
29950,
29889,
29995,
29924,
29889,
29995,
29903,
1495,
2403,
29894,
7958,
29889,
7638,
613,
13,
4706,
1962,
29918,
3972,
29922,
7883,
29889,
1610,
29918,
1272,
29918,
3972,
580,
1125,
13,
1678,
565,
19707,
29918,
1272,
338,
6213,
29901,
13,
4706,
12020,
7865,
2392,
877,
29963,
7958,
848,
508,
29952,
29873,
367,
6213,
29991,
1495,
13,
13,
1678,
11799,
29918,
1272,
353,
518,
3788,
29889,
7122,
29898,
29894,
7958,
29918,
1272,
29961,
29900,
1822,
8149,
3101,
29962,
13,
13,
1678,
363,
4863,
297,
19707,
29918,
1272,
29901,
13,
4706,
565,
4863,
338,
6213,
29901,
13,
9651,
6773,
13,
13,
4706,
11799,
29918,
1272,
29889,
4397,
29898,
3788,
29889,
7122,
4197,
19125,
29918,
14394,
29918,
1454,
29918,
7638,
29898,
791,
29897,
363,
659,
297,
4863,
29889,
5975,
580,
12622,
13,
13,
1678,
2436,
29918,
517,
29918,
1445,
29898,
13,
4706,
1962,
29918,
3972,
29892,
13,
4706,
934,
29918,
978,
29892,
13,
4706,
11799,
29918,
1272,
29897,
13,
13,
13,
2
] |
q5.py | fairoz-ahmed/Python_Practice | 0 | 29755 | class Input_data():
def __init__(self):
self.s=''
def getString(self):
self.s = input()
def printString(self):
print(self.s.upper())
strobj=Input_data()
strobj.getString()
strobj.printString() | [
1,
770,
10567,
29918,
1272,
7295,
30004,
13,
12,
1753,
4770,
2344,
12035,
1311,
1125,
30004,
13,
12,
12,
1311,
29889,
29879,
2433,
29915,
30004,
13,
12,
1753,
679,
1231,
29898,
1311,
1125,
30004,
13,
12,
12,
1311,
29889,
29879,
353,
1881,
26471,
13,
12,
1753,
1596,
1231,
29898,
1311,
1125,
30004,
13,
12,
12,
2158,
29898,
1311,
29889,
29879,
29889,
21064,
3101,
30004,
13,
303,
13716,
29926,
29922,
4290,
29918,
1272,
26471,
13,
303,
13716,
29926,
29889,
13719,
26471,
13,
303,
13716,
29926,
29889,
2158,
1231,
580,
2
] |
odoo/base-addons/website_event/__manifest__.py | LucasBorges-Santos/docker-odoo | 0 | 74582 | # -*- coding: utf-8 -*-
{
'name': 'Events',
'category': 'Website/Website',
'sequence': 166,
'summary': 'Publish events, sell tickets',
'website': 'https://www.odoo.com/page/events',
'description': "",
'depends': ['website', 'website_partner', 'website_mail', 'event'],
'data': [
'data/event_data.xml',
'views/res_config_settings_views.xml',
'views/event_snippets.xml',
'views/event_templates.xml',
'views/event_views.xml',
'security/ir.model.access.csv',
'security/event_security.xml',
],
'demo': [
'data/event_demo.xml'
],
'application': True,
'license': 'LGPL-3',
}
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29912,
13,
1678,
525,
978,
2396,
525,
13634,
742,
13,
1678,
525,
7320,
2396,
525,
3609,
2746,
29914,
3609,
2746,
742,
13,
1678,
525,
16506,
2396,
29871,
29896,
29953,
29953,
29892,
13,
1678,
525,
7727,
2396,
525,
21076,
1674,
4959,
29892,
19417,
16892,
1691,
742,
13,
1678,
525,
22942,
2396,
525,
991,
597,
1636,
29889,
397,
3634,
29889,
510,
29914,
3488,
29914,
13604,
742,
13,
1678,
525,
8216,
2396,
12633,
13,
1678,
525,
2716,
1975,
2396,
6024,
22942,
742,
525,
22942,
29918,
1595,
1089,
742,
525,
22942,
29918,
2549,
742,
525,
3696,
7464,
13,
1678,
525,
1272,
2396,
518,
13,
4706,
525,
1272,
29914,
3696,
29918,
1272,
29889,
3134,
742,
13,
4706,
525,
7406,
29914,
690,
29918,
2917,
29918,
11027,
29918,
7406,
29889,
3134,
742,
13,
4706,
525,
7406,
29914,
3696,
29918,
29879,
1240,
27421,
29889,
3134,
742,
13,
4706,
525,
7406,
29914,
3696,
29918,
20943,
29889,
3134,
742,
13,
4706,
525,
7406,
29914,
3696,
29918,
7406,
29889,
3134,
742,
13,
4706,
525,
8926,
29914,
381,
29889,
4299,
29889,
5943,
29889,
7638,
742,
13,
4706,
525,
8926,
29914,
3696,
29918,
8926,
29889,
3134,
742,
13,
1678,
21251,
13,
1678,
525,
17482,
2396,
518,
13,
4706,
525,
1272,
29914,
3696,
29918,
17482,
29889,
3134,
29915,
13,
1678,
21251,
13,
1678,
525,
6214,
2396,
5852,
29892,
13,
1678,
525,
506,
1947,
2396,
525,
29931,
29954,
7390,
29899,
29941,
742,
13,
29913,
13,
2
] |
bacpypes/link/station.py | cbergmiller/bacpypes | 1 | 96162 |
import struct
from .address import Address
__all__ = ['LocalStation', 'RemoteStation']
class LocalStation(Address):
"""
LocalStation
"""
def __init__(self, addr):
self.addrType = Address.localStationAddr
self.addrNet = None
if isinstance(addr, int):
if (addr < 0) or (addr >= 256):
raise ValueError('address out of range')
self.addrAddr = struct.pack('B', addr)
self.addrLen = 1
elif isinstance(addr, (bytes, bytearray)):
self.addrAddr = bytes(addr)
self.addrLen = len(addr)
else:
raise TypeError('integer, bytes or bytearray required')
class RemoteStation(Address):
"""
RemoteStation
"""
def __init__(self, net, addr):
if not isinstance(net, int):
raise TypeError('integer network required')
if (net < 0) or (net >= 65535):
raise ValueError('network out of range')
self.addrType = Address.remoteStationAddr
self.addrNet = net
if isinstance(addr, int):
if (addr < 0) or (addr >= 256):
raise ValueError('address out of range')
self.addrAddr = struct.pack('B', addr)
self.addrLen = 1
elif isinstance(addr, (bytes, bytearray)):
self.addrAddr = bytes(addr)
self.addrLen = len(addr)
else:
raise TypeError('integer, bytes or bytearray required') | [
1,
29871,
13,
5215,
2281,
13,
3166,
869,
7328,
1053,
16428,
13,
13,
1649,
497,
1649,
353,
6024,
7717,
22814,
742,
525,
20224,
22814,
2033,
13,
13,
13,
1990,
9959,
22814,
29898,
7061,
1125,
13,
1678,
9995,
13,
1678,
9959,
22814,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
28915,
1125,
13,
4706,
1583,
29889,
10030,
1542,
353,
16428,
29889,
2997,
22814,
2528,
29878,
13,
4706,
1583,
29889,
10030,
6779,
353,
6213,
13,
4706,
565,
338,
8758,
29898,
10030,
29892,
938,
1125,
13,
9651,
565,
313,
10030,
529,
29871,
29900,
29897,
470,
313,
10030,
6736,
29871,
29906,
29945,
29953,
1125,
13,
18884,
12020,
7865,
2392,
877,
7328,
714,
310,
3464,
1495,
13,
9651,
1583,
29889,
10030,
2528,
29878,
353,
2281,
29889,
4058,
877,
29933,
742,
28915,
29897,
13,
9651,
1583,
29889,
10030,
21515,
353,
29871,
29896,
13,
4706,
25342,
338,
8758,
29898,
10030,
29892,
313,
13193,
29892,
7023,
2378,
22164,
13,
9651,
1583,
29889,
10030,
2528,
29878,
353,
6262,
29898,
10030,
29897,
13,
9651,
1583,
29889,
10030,
21515,
353,
7431,
29898,
10030,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
20948,
877,
16031,
29892,
6262,
470,
7023,
2378,
3734,
1495,
13,
13,
13,
1990,
5240,
866,
22814,
29898,
7061,
1125,
13,
1678,
9995,
13,
1678,
5240,
866,
22814,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7787,
29892,
28915,
1125,
13,
4706,
565,
451,
338,
8758,
29898,
1212,
29892,
938,
1125,
13,
9651,
12020,
20948,
877,
16031,
3564,
3734,
1495,
13,
4706,
565,
313,
1212,
529,
29871,
29900,
29897,
470,
313,
1212,
6736,
29871,
29953,
29945,
29945,
29941,
29945,
1125,
13,
9651,
12020,
7865,
2392,
877,
11618,
714,
310,
3464,
1495,
13,
4706,
1583,
29889,
10030,
1542,
353,
16428,
29889,
16674,
22814,
2528,
29878,
13,
4706,
1583,
29889,
10030,
6779,
353,
7787,
13,
4706,
565,
338,
8758,
29898,
10030,
29892,
938,
1125,
13,
9651,
565,
313,
10030,
529,
29871,
29900,
29897,
470,
313,
10030,
6736,
29871,
29906,
29945,
29953,
1125,
13,
18884,
12020,
7865,
2392,
877,
7328,
714,
310,
3464,
1495,
13,
9651,
1583,
29889,
10030,
2528,
29878,
353,
2281,
29889,
4058,
877,
29933,
742,
28915,
29897,
13,
9651,
1583,
29889,
10030,
21515,
353,
29871,
29896,
13,
4706,
25342,
338,
8758,
29898,
10030,
29892,
313,
13193,
29892,
7023,
2378,
22164,
13,
9651,
1583,
29889,
10030,
2528,
29878,
353,
6262,
29898,
10030,
29897,
13,
9651,
1583,
29889,
10030,
21515,
353,
7431,
29898,
10030,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
20948,
877,
16031,
29892,
6262,
470,
7023,
2378,
3734,
1495,
2
] |
tests/test_superconductor_losses.py | tamasorosz/TrafoCalc | 0 | 97837 | from unittest import TestCase
from src.superconductor_losses import parallel_loss, perp_loss, norris_equation, cryostat_losses, cryo_surface, \
thermal_incomes, cooler_cost, sc_load_loss, magnusson_ac_loss
from math import pi
class TestLosses(TestCase):
def test_losses(self):
# BSCCO cable from Magnussons' paper
# f = 50.0
# c = 0.75
# bp = 0.033
# Ac = 0.31 * 4.29 * 1e-6
bpar = 66.0 * 1e-3 # T
# parallel losses
# 0.133 W/m in 10.1109/TASC.2003.813123 but this value seems ok
self.assertAlmostEqual(parallel_loss(50, bpar), 0.177, 3)
# perpendicular losses
self.assertAlmostEqual(perp_loss(50, 68. * 1e-3), 2.009, 3)
# norris equation
self.assertAlmostEqual(norris_equation(50, 50, 115.), 0.0047, 4)
def test_sc_transformer_losses(self):
# Th example is coming from DOI: 10.1109/TASC.2003.813123
# BSCCO cable from Magnussons' paper
# f = 50.0
# c = 0.75
# bp = 0.033
# Ac = 0.31 * 4.29 * 1e-6
bpar = 0.066 # T
bperp = 0.068 # T
self.assertAlmostEqual(parallel_loss(50, bpar), 0.179, 2)
self.assertAlmostEqual(perp_loss(50, bperp), 2.009, 2) # 1.960
# magnusson-formula based loss - 2 W/m
self.assertAlmostEqual(magnusson_ac_loss(bpar, bperp, 50, 25), 2.125, 2)
def test_45kVA_transformer_loss(self):
"""
Source: DOI: 10.1109/TASC.2005.869712
45 kVA transformer
:return:
"""
# The maximum axial and radial fields 30 mT, 23.7 mT
bax = 30. * 1e-3
brad = 23.7 * 1e-3
i1 = 18.75 # A
i2 = 281.25 # A
ac = magnusson_ac_loss(bax, brad, 50, 18.75)
self.assertAlmostEqual(ac, 0.279, 2)
# hv length - 14 turns, 13 pancakes
l_hv = 14 * 13 * (365 + 375.5) / 2 * 3.14 * 1e-3 # m
l_lv = 210 * (286 + 304.5) / 2 * 3.14 * 1e-3 # m
l = l_lv + l_hv
self.assertAlmostEqual(ac * l, 113.5, 1)
def test_losses_second_case_small_field(self):
bpar = 20.0 * 1e-3 # mT
# parallel losses
self.assertAlmostEqual(parallel_loss(50, bpar), 0.0535, 3)
# perpendicular losses
self.assertAlmostEqual(perp_loss(50, 20. * 1e-3), 0.1625, 1)
def test_cryostat_losses(self):
r_in = 0.5 / pi
r_ou = 1.0 / pi
h = 1.0
a_cs = cryo_surface(r_in, r_ou, h) # [m2]
P_cryo = cryostat_losses(a_cs)
P_thermal = thermal_incomes(100, 100)
sc_ll = sc_load_loss(100, 100, 100)
self.assertAlmostEqual(a_cs, 3.238, 2)
# self.assertAlmostEqual(P_cryo, 0.029537, 2)
self.assertAlmostEqual(P_thermal, 54, 1)
self.assertAlmostEqual(sc_ll, 5400, 1)
# tco = modified_tco_evaluation(1, 1, 1, 0, 0, 1, 0)
# self.assertAlmostEqual(tco, 3439.615, 1)
def test_cooler_cost(self):
p_loss_1 = 100. # W
p_loss_2 = 1000. # W
c1 = cooler_cost(p_loss_1)
c2 = cooler_cost(p_loss_2)
self.assertAlmostEqual(c1, 24984.95, 1)
self.assertAlmostEqual(c2, 92827.91, 1)
| [
1,
515,
443,
27958,
1053,
4321,
8259,
13,
3166,
4765,
29889,
9136,
535,
2199,
272,
29918,
6758,
267,
1053,
8943,
29918,
6758,
29892,
639,
29886,
29918,
6758,
29892,
3643,
3780,
29918,
2573,
29892,
10901,
520,
271,
29918,
6758,
267,
29892,
10901,
29877,
29918,
7610,
2161,
29892,
320,
13,
1678,
26963,
29918,
262,
26807,
29892,
12528,
261,
29918,
18253,
29892,
885,
29918,
1359,
29918,
6758,
29892,
9119,
375,
1100,
29918,
562,
29918,
6758,
13,
13,
3166,
5844,
1053,
2930,
13,
13,
13,
1990,
4321,
29931,
2209,
267,
29898,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
6758,
267,
29898,
1311,
1125,
13,
4706,
396,
350,
7187,
3217,
21387,
515,
19975,
1558,
787,
29915,
5650,
13,
4706,
396,
285,
353,
29871,
29945,
29900,
29889,
29900,
13,
4706,
396,
274,
353,
29871,
29900,
29889,
29955,
29945,
13,
4706,
396,
289,
29886,
353,
29871,
29900,
29889,
29900,
29941,
29941,
13,
4706,
396,
7255,
353,
29871,
29900,
29889,
29941,
29896,
334,
29871,
29946,
29889,
29906,
29929,
334,
29871,
29896,
29872,
29899,
29953,
13,
13,
4706,
289,
862,
353,
29871,
29953,
29953,
29889,
29900,
334,
29871,
29896,
29872,
29899,
29941,
29871,
396,
323,
13,
13,
4706,
396,
8943,
28495,
13,
4706,
396,
29871,
29900,
29889,
29896,
29941,
29941,
399,
29914,
29885,
297,
29871,
29896,
29900,
29889,
29896,
29896,
29900,
29929,
29914,
29911,
28599,
29889,
29906,
29900,
29900,
29941,
29889,
29947,
29896,
29941,
29896,
29906,
29941,
541,
445,
29871,
995,
2444,
3431,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
23482,
29918,
6758,
29898,
29945,
29900,
29892,
289,
862,
511,
29871,
29900,
29889,
29896,
29955,
29955,
29892,
29871,
29941,
29897,
13,
4706,
396,
639,
14081,
16311,
28495,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
24598,
29918,
6758,
29898,
29945,
29900,
29892,
29871,
29953,
29947,
29889,
334,
29871,
29896,
29872,
29899,
29941,
511,
29871,
29906,
29889,
29900,
29900,
29929,
29892,
29871,
29941,
29897,
13,
4706,
396,
3643,
3780,
6306,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
15459,
3780,
29918,
2573,
29898,
29945,
29900,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29896,
29945,
9774,
29871,
29900,
29889,
29900,
29900,
29946,
29955,
29892,
29871,
29946,
29897,
13,
13,
1678,
822,
1243,
29918,
1557,
29918,
9067,
261,
29918,
6758,
267,
29898,
1311,
1125,
13,
4706,
396,
498,
1342,
338,
6421,
515,
11662,
29902,
29901,
29871,
29896,
29900,
29889,
29896,
29896,
29900,
29929,
29914,
29911,
28599,
29889,
29906,
29900,
29900,
29941,
29889,
29947,
29896,
29941,
29896,
29906,
29941,
13,
4706,
396,
350,
7187,
3217,
21387,
515,
19975,
1558,
787,
29915,
5650,
13,
4706,
396,
285,
353,
29871,
29945,
29900,
29889,
29900,
13,
4706,
396,
274,
353,
29871,
29900,
29889,
29955,
29945,
13,
4706,
396,
289,
29886,
353,
29871,
29900,
29889,
29900,
29941,
29941,
13,
4706,
396,
7255,
353,
29871,
29900,
29889,
29941,
29896,
334,
29871,
29946,
29889,
29906,
29929,
334,
29871,
29896,
29872,
29899,
29953,
13,
13,
4706,
289,
862,
353,
29871,
29900,
29889,
29900,
29953,
29953,
29871,
396,
323,
13,
4706,
289,
24598,
353,
29871,
29900,
29889,
29900,
29953,
29947,
29871,
396,
323,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
23482,
29918,
6758,
29898,
29945,
29900,
29892,
289,
862,
511,
29871,
29900,
29889,
29896,
29955,
29929,
29892,
29871,
29906,
29897,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
24598,
29918,
6758,
29898,
29945,
29900,
29892,
289,
24598,
511,
29871,
29906,
29889,
29900,
29900,
29929,
29892,
29871,
29906,
29897,
29871,
396,
29871,
29896,
29889,
29929,
29953,
29900,
13,
13,
4706,
396,
9119,
375,
1100,
29899,
689,
2497,
2729,
6410,
448,
29871,
29906,
399,
29914,
29885,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
29885,
4211,
375,
1100,
29918,
562,
29918,
6758,
29898,
29890,
862,
29892,
289,
24598,
29892,
29871,
29945,
29900,
29892,
29871,
29906,
29945,
511,
29871,
29906,
29889,
29896,
29906,
29945,
29892,
29871,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
29946,
29945,
29895,
20449,
29918,
9067,
261,
29918,
6758,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
7562,
29901,
11662,
29902,
29901,
29871,
29896,
29900,
29889,
29896,
29896,
29900,
29929,
29914,
29911,
28599,
29889,
29906,
29900,
29900,
29945,
29889,
29947,
29953,
29929,
29955,
29896,
29906,
13,
308,
29946,
29945,
413,
20449,
4327,
261,
13,
4706,
584,
2457,
29901,
13,
4706,
9995,
13,
13,
4706,
396,
450,
7472,
4853,
616,
322,
28373,
4235,
29871,
29941,
29900,
286,
29911,
29892,
29871,
29906,
29941,
29889,
29955,
286,
29911,
13,
4706,
289,
1165,
353,
29871,
29941,
29900,
29889,
334,
29871,
29896,
29872,
29899,
29941,
13,
4706,
1506,
328,
353,
29871,
29906,
29941,
29889,
29955,
334,
29871,
29896,
29872,
29899,
29941,
13,
4706,
474,
29896,
353,
29871,
29896,
29947,
29889,
29955,
29945,
29871,
396,
319,
13,
4706,
474,
29906,
353,
29871,
29906,
29947,
29896,
29889,
29906,
29945,
29871,
396,
319,
13,
13,
4706,
1274,
353,
9119,
375,
1100,
29918,
562,
29918,
6758,
29898,
29890,
1165,
29892,
1506,
328,
29892,
29871,
29945,
29900,
29892,
29871,
29896,
29947,
29889,
29955,
29945,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
562,
29892,
29871,
29900,
29889,
29906,
29955,
29929,
29892,
29871,
29906,
29897,
13,
13,
4706,
396,
298,
29894,
3309,
448,
29871,
29896,
29946,
12169,
29892,
29871,
29896,
29941,
282,
4564,
6926,
13,
4706,
301,
29918,
29882,
29894,
353,
29871,
29896,
29946,
334,
29871,
29896,
29941,
334,
313,
29941,
29953,
29945,
718,
29871,
29941,
29955,
29945,
29889,
29945,
29897,
847,
29871,
29906,
334,
29871,
29941,
29889,
29896,
29946,
334,
29871,
29896,
29872,
29899,
29941,
29871,
396,
286,
13,
4706,
301,
29918,
28463,
353,
29871,
29906,
29896,
29900,
334,
313,
29906,
29947,
29953,
718,
29871,
29941,
29900,
29946,
29889,
29945,
29897,
847,
29871,
29906,
334,
29871,
29941,
29889,
29896,
29946,
334,
29871,
29896,
29872,
29899,
29941,
29871,
396,
286,
13,
13,
4706,
301,
353,
301,
29918,
28463,
718,
301,
29918,
29882,
29894,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
562,
334,
301,
29892,
29871,
29896,
29896,
29941,
29889,
29945,
29892,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
6758,
267,
29918,
7496,
29918,
4878,
29918,
9278,
29918,
2671,
29898,
1311,
1125,
13,
4706,
289,
862,
353,
29871,
29906,
29900,
29889,
29900,
334,
29871,
29896,
29872,
29899,
29941,
29871,
396,
286,
29911,
13,
13,
4706,
396,
8943,
28495,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
23482,
29918,
6758,
29898,
29945,
29900,
29892,
289,
862,
511,
29871,
29900,
29889,
29900,
29945,
29941,
29945,
29892,
29871,
29941,
29897,
13,
4706,
396,
639,
14081,
16311,
28495,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
24598,
29918,
6758,
29898,
29945,
29900,
29892,
29871,
29906,
29900,
29889,
334,
29871,
29896,
29872,
29899,
29941,
511,
29871,
29900,
29889,
29896,
29953,
29906,
29945,
29892,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
29883,
719,
520,
271,
29918,
6758,
267,
29898,
1311,
1125,
13,
4706,
364,
29918,
262,
353,
29871,
29900,
29889,
29945,
847,
2930,
13,
4706,
364,
29918,
283,
353,
29871,
29896,
29889,
29900,
847,
2930,
13,
4706,
298,
353,
29871,
29896,
29889,
29900,
13,
4706,
263,
29918,
2395,
353,
10901,
29877,
29918,
7610,
2161,
29898,
29878,
29918,
262,
29892,
364,
29918,
283,
29892,
298,
29897,
29871,
396,
518,
29885,
29906,
29962,
13,
4706,
349,
29918,
29883,
719,
29877,
353,
10901,
520,
271,
29918,
6758,
267,
29898,
29874,
29918,
2395,
29897,
13,
4706,
349,
29918,
721,
5156,
353,
26963,
29918,
262,
26807,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
13,
4706,
885,
29918,
645,
353,
885,
29918,
1359,
29918,
6758,
29898,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
29874,
29918,
2395,
29892,
29871,
29941,
29889,
29906,
29941,
29947,
29892,
29871,
29906,
29897,
13,
4706,
396,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
29925,
29918,
29883,
719,
29877,
29892,
29871,
29900,
29889,
29900,
29906,
29929,
29945,
29941,
29955,
29892,
29871,
29906,
29897,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
29925,
29918,
721,
5156,
29892,
29871,
29945,
29946,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
1557,
29918,
645,
29892,
29871,
29945,
29946,
29900,
29900,
29892,
29871,
29896,
29897,
13,
4706,
396,
260,
1111,
353,
9120,
29918,
29873,
1111,
29918,
24219,
362,
29898,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29900,
29897,
13,
4706,
396,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
29873,
1111,
29892,
29871,
29941,
29946,
29941,
29929,
29889,
29953,
29896,
29945,
29892,
29871,
29896,
29897,
13,
13,
1678,
822,
1243,
29918,
1111,
324,
261,
29918,
18253,
29898,
1311,
1125,
13,
4706,
282,
29918,
6758,
29918,
29896,
353,
29871,
29896,
29900,
29900,
29889,
29871,
396,
399,
13,
4706,
282,
29918,
6758,
29918,
29906,
353,
29871,
29896,
29900,
29900,
29900,
29889,
29871,
396,
399,
13,
13,
4706,
274,
29896,
353,
12528,
261,
29918,
18253,
29898,
29886,
29918,
6758,
29918,
29896,
29897,
13,
4706,
274,
29906,
353,
12528,
261,
29918,
18253,
29898,
29886,
29918,
6758,
29918,
29906,
29897,
13,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
29883,
29896,
29892,
29871,
29906,
29946,
29929,
29947,
29946,
29889,
29929,
29945,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
2499,
3242,
9843,
29898,
29883,
29906,
29892,
29871,
29929,
29906,
29947,
29906,
29955,
29889,
29929,
29896,
29892,
29871,
29896,
29897,
13,
2
] |
psp/gcp_utils.py | amckenna41/DCBLSTM_PSP | 1 | 32285 | <gh_stars>1-10
################################################################################
######## Google Cloud Platform Utilities ########
################################################################################
#Importing required libraries and dependancies
import numpy as np
import pandas as pd
import os
import glob
import subprocess
from google.cloud import storage, exceptions
from googleapiclient import errors
from googleapiclient import discovery
from google.cloud import pubsub_v1
from google.oauth2 import service_account
from oauth2client.client import GoogleCredentials
import tensorflow as tf
from tensorflow.keras.utils import plot_model
import pickle
import json
from subprocess import Popen, PIPE
try:
from _globals import *
except:
from . _globals import *
#initialise storage bucket object
BUCKET = None
def initialise_bucket(bucket):
"""
Description:
Initialise GCP storage bucket and client.
Args:
:bucket (str): name of GCP Storage bucket.
Returns:
None
"""
global BUCKET
storage_client = storage.Client()
bucketName = bucket.replace('gs://','')
bucket = storage_client.get_bucket(bucketName)
BUCKET = bucket
def save_history(history, model_output_folder):
"""
Description:
Save and upload model history to GCP Storage.
Args:
:history (dict): model history.
:model_output_folder (str): output folder where all models assets and results are stored.
Returns:
None
"""
#open history pickle file for writing
try:
f = open('history.pckl', 'wb')
pickle.dump(history.history, f)
f.close()
except pickle.UnpicklingError as e:
print('Error', e)
except (AttributeError, EOFError, ImportError, IndexError) as e:
print(traceback.format_exc(e))
except Exception as e:
print(traceback.format_exc(e))
print('Error creating history pickle.')
#create history blob path
blob_path = os.path.join(model_output_folder, 'history.pckl')
#upload history to bucket
upload_file(blob_path,'history.pckl')
def upload_directory(local_path, gcs_folder_path):
"""
Description:
Upload directory recursively to GCP Storage.
Args:
:local_path (str): local path to directory.
:gcs_folder_path (str): blob folder path on GCP.
Returns:
None
Reference:
https://stackoverflow.com/questions/25599503/how-to-upload-folder-on-google-cloud-storage-using-python-api
"""
if not (os.path.isdir(local_path)):
raise OSError('Path to local directory not found.')
#recursively iterate through directory, uploading each file individually to GCP bucket.
for local_file in glob.glob(local_path + '/**'):
if not os.path.isfile(local_file):
upload_directory(local_file, gcs_folder_path + "/" + os.path.basename(local_file))
else:
remote_path = os.path.join(gcs_folder_path, local_file[1 + len(local_path):])
upload_file(remote_path, local_file)
def upload_file(blob_path, filepath):
"""
Description:
Upload blob to bucket.
Args:
:blob_path (str): path of blob object in bucket.
:filepath (str): local filepath of object.
Returns:
None
"""
#initialise blob in bucket
blob = BUCKET.blob(blob_path)
#upload blob to specified bucket
try:
blob.upload_from_filename(filepath)
except Exception as e:
print("Error uploading blob {} to storage bucket {} .".format(blob_path, e.message))
def download_file(blob_path, filepath):
"""
Description:
Download blob object from GCP Storage bucket to local dir.
Args:
:blob_path (str): path of blob object in bucket.
:filepath (str): local filepath for downloaded blob.
Returns:
None
"""
#initialise blob in bucket
blob = BUCKET.blob(blob_path)
#download blob from GCP Storage bucket to local filepath
try:
blob.download_to_filename(filepath)
print('Blob {} downloaded to {}.'.format(blob_path, filepath))
except Exception as e:
print("Error downloading blob {} from storage bucket {}.".format(blob_path, e.message))
def get_job_hyperparmeters(project_id, job_name):
"""
Description:
Output results from hyperparameter tuning process to csv.
Args:
:project_id (str): name of GCP project.
:job_name (str): name of GCP Ai-Platform job.
Returns:
:df (pandas DataFrame): dataframe of hyperparameters and their associated results from training.
"""
#get GCP credentials for making request
job_id = '{}/jobs/{}'.format(project_id, job_name)
credentials = GoogleCredentials.get_application_default()
ml = discovery.build('ml', 'v1', credentials=credentials)
#make request to hyperparameter job using Google API Client
try:
request = ml.projects().jobs().get(name=job_id).execute()
if request['state'] != "SUCCEEDED": #check that job has completed
print('Hyperparameter tuning job not completed.')
return
except errors.HttpError as err:
print('Error getting job details')
print(err._get_reason())
col = []
row = []
#set the columns of the dataframe to the hyperparameter variables
for column in request['trainingOutput']['trials'][0]['hyperparameters']:
col.append(column)
#for each successful trial, append each hyperparameter metric to the row array
for cols in col:
for trial in range(0, len(request['trainingOutput']['trials'])):
#check hyperparameter has SUCCEEDED
if request['trainingOutput']['trials'][trial]['state'] == "SUCCEEDED":
row.append(request['trainingOutput']['trials'][trial]['hyperparameters'][cols])
#transform row list into a numpy array
row_np = np.asarray(row)
num_params = len(request['trainingOutput']['trials'][0]['hyperparameters'])
#horizontally split numpy array into each of the different columns
row_np = np.split(row_np, num_params)
#create dataframe from hyperparameter metrics
df = pd.DataFrame(row_np)
#transpose dataframe
df = df.T
#set columns of dataframe to metric names
df.columns = col
#append evaluation score and trial ID to dataframe
eval_score = []
trial_id = []
for trial in range(0, len(request['trainingOutput']['trials'])):
eval_score.append(request['trainingOutput']['trials'][trial]['finalMetric']['objectiveValue'])
trial_id.append(request['trainingOutput']['trials'][trial]['trialId'])
df['eval_score'] = eval_score
df['trial_id'] = trial_id
#sort dataframe by the evaluation score
df.sort_values('eval_score')
#put evaluation score and trial ID to beginning of dataframe columns
eval = df['eval_score']
df.drop(labels=['eval_score'], axis=1,inplace = True)
df.insert(0, 'eval_score', eval)
trial_id = df['trial_id']
df.drop(labels=['trial_id'], axis=1,inplace = True)
df.insert(0, 'trial_id', trial_id)
#export dataframe to a csv
df_filename = job_name + "_hyperparameter_tuning"
df.to_csv(df_file_name, encoding='utf-8', index=False)
#upload csv to GCP Storage
blob_path = job_name + ".csv"
upload_file(blob_path,df_filename)
return df
def list_bucket_objects():
"""
Description:
List all objects in bucket.
Args:
None
Returns:
None
"""
#use Google Storage API to get and print all objects in bucket
try:
blobs = storage_client.list_blobs(BUCKET_NAME) #global BUCKET_NAME variable
except Exception as e:
print("Error listing blobs from {} bucket: {}".format(BUCKET_NAME, e.message))
#print bucket blobs
for blob in blobs:
print(blob.name)
def delete_blob(blob_name):
"""
Description:
Delete blob from GCP storage bucket.
Args:
:blob_name (str): name of blob to delete.
Returns:
None
"""
#get blob from bucket using GCP storage API
blob = BUCKET.blob(blob_name)
#delete blob
try:
blob.delete()
print("Blob {} deleted from {} bucket.".format(blob_name, BUCKET_NAME))
except Exception as e:
print("Error deleting blob {} from {} bucket: {}.".format(blob_name, BUCKET_NAME, e.message))
def get_model_output(job_name):
"""
Description:
Output results from metrics captured when training model. Output to CSV.
Args:
:job_name (str): name of AI Platform training job.
Returns:
None
"""
#local filepath and GCP blob name
model_output_csv_blob = os.path.join(job_name, 'output_results.csv')
#converting model_output dictionary to pandas Dataframe
model_output_df = pd.DataFrame(model_output, index=[0])
#exporting Dataframe to CSV
model_output_df.to_csv('output_results.csv',index=False)
#uploading blob to cloud storage
upload_file(os.path.join(job_name, 'output_results.csv'),'output_results.csv')
return model_output_df
def visualise_model(model, save_folder):
"""
Description:
Visualise Keras TF model, including its layers, connections and data types.
Args:
:model (Keras.model): Keras model to visualise.
:save_folder (str): filepath for model directory to store model img in.
Returns:
None
"""
plot_model(model, to_file=os.path.join(save_folder,'model.png'),
show_shapes=True, show_dtype=True)
def get_trainable_parameters(model):
"""
Description:
Calculate the number of trainable and non-trainable parameters in Keras model.
Args:
:model (Keras.model): Keras model to calculate parameters for.
Returns:
:trainable_params (int): number of trainable parameters.
:non_trainable_params (int): number of non-trainable parameters.
:total_params (int): total number of trainable + non-trainable parameters.
"""
trainable_params = count_params(model.trainable_weights)
non_trainable_params = count_params(model.non_trainable_weights)
total_params = trainable_params + non_trainable_params
return trainable_params, non_trainable_params, total_params
def append_all_output(output_results_df, all_results="all_results.csv"):
"""
Description:
Append training results/parameters of current job to CSV containing
results/parameters of all previous jobs.
Args:
:all_results (str): filepath to csv containing results of previous jobs.
:all_results (str): filepath to csv containing results of current job.
Returns:
None
"""
#check if results file exists in bucket, if so then download locally
if (BUCKET.blob(all_results).exists()):
download_file(all_results, all_results)
else:
return
#read csv results file
all_results_df = pd.read_csv(all_results)
#append results of current training job to all_results file
all_results_df = all_results_df.append(output_results_df)
#export results to csv
all_results_df.to_csv(all_results, index=False)
#upload updated results file to bucket
upload_file(all_results, all_results)
def parse_json_arch(arch_json):
"""
Description:
Parse model architecture JSON.
Args:
:arch_json (str): filepath to model json.
Returns:
None
"""
pass
def get_job_status(job_name):
"""
Description:
Get training status of GCP Ai-Platform training job.
Args:
:job_name (str): name of training job.
Returns:
:status (str): training status of job.
:err_message (str): error message of job.
"""
# job_logs = subprocess.check_output(["gcloud", "ai-platform","jobs","describe",job_name])
job_logs = subprocess.Popen(["gcloud", "ai-platform","jobs","describe",job_name], stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = job_logs.communicate(b"input data that is passed to subprocess' stdin")
#parse job status from command-line output
status=""
for item in (output.decode('UTF-8')).split("\n"):
if ("state:" in item):
status = item.strip()
status = (status[status.find(':')+1:]).strip()
#parse error message from command-line output
err_message=""
if (status=="FAILED"):
for item in (output.decode('UTF-8')).split("\n"):
if ("errorMessage:" in item):
err_message = item.strip()
#get err_message down to etag
return status, err_message
def setup_tpu():
"""
Description:
Initialize TPU for training.
Args:
None
Returns:
:strategy (TPUStrategy): TPU training strategy object.
References:
[1]: https://www.tensorflow.org/guide/tpu
[2]: https://cloud.google.com/tpu/docs/tpus
"""
resolver = tf.distribute.cluster_resolver.TPUClusterResolver()
tf.config.experimental_connect_to_cluster(resolver)
tf.tpu.experimental.initialize_tpu_system(resolver)
strategy = tf.distribute.experimental.TPUStrategy(resolver)
return strategy
class StepDecay():
"""
Description:
Step Decay Learning rate scheduler.
Args:
:initAlpha (float): initial learning rate (default=0.0005).
:factor (float): drop factor (default=0.8).
:dropEvery (int): number of epochs learning rate is dropped (default=40).
Returns:
Result from step decay function.
"""
def __init__(self, initAlpha=0.0005, factor=0.8, dropEvery=40):
self.initAlpha = initAlpha
self.factor = factor
self.dropEvery = dropEvery
def __call__(self, epoch):
exp = np.floor((epoch + 1) / self.dropEvery)
alpha = self.initAlpha * (self.factor ** exp)
return float(alpha)
class ExponentialDecay():
"""
Description:
Exponential Decay Learning rate scheduler.
Args:
:initAlpha (float): initial learning rate (default=0.0005).
:k (float): power/exponent of the exponential (default=0.8).
Returns:
Result from exponential decay function.
"""
def __init__(self, initAlpha=0.0005, k=0.8):
self.initAlpha = initAlpha
self.k = k
def __call__(self, epoch):
return (self.initAlpha * math.exp(-k*epoch))
class TimedBased():
"""
Description:
Timed based Decay Learning rate scheduler.
Args:
:initAlpha (float): initial learning rate (default=0.0005).
:epochs (int): number of epochs.
Returns:
Result from timed based decay function.
"""
def __init__(self, initAlpha=0.01, epochs=100):
self.initAlpha = initAlpha
self.epochs = epochs
decay = self.initAlpha / self.epochs
def __call__(self, lr, epochs):
decay = self.initAlpha / self.epochs
return ((lr *1) / (1 + decay * self.epochs))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
13383,
13383,
13383,
13383,
13383,
13,
7346,
18884,
5087,
14293,
28096,
22310,
1907,
462,
835,
4136,
29937,
13,
13383,
13383,
13383,
13383,
13383,
13,
13,
29937,
17518,
292,
3734,
9562,
322,
8839,
273,
2478,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
2897,
13,
5215,
13149,
13,
5215,
1014,
5014,
13,
3166,
5386,
29889,
9274,
1053,
8635,
29892,
15283,
13,
3166,
5386,
481,
293,
1593,
1053,
4436,
13,
3166,
5386,
481,
293,
1593,
1053,
20699,
13,
3166,
5386,
29889,
9274,
1053,
2529,
1491,
29918,
29894,
29896,
13,
3166,
5386,
29889,
23106,
29906,
1053,
2669,
29918,
10149,
13,
3166,
288,
5150,
29906,
4645,
29889,
4645,
1053,
5087,
28037,
13,
5215,
26110,
408,
15886,
13,
3166,
26110,
29889,
3946,
294,
29889,
13239,
1053,
6492,
29918,
4299,
13,
5215,
5839,
280,
13,
5215,
4390,
13,
3166,
1014,
5014,
1053,
349,
3150,
29892,
349,
29902,
4162,
13,
2202,
29901,
13,
1678,
515,
903,
23705,
1338,
1053,
334,
13,
19499,
29901,
13,
1678,
515,
869,
903,
23705,
1338,
1053,
334,
13,
13,
29937,
11228,
895,
8635,
20968,
1203,
13,
7838,
7077,
2544,
353,
6213,
13,
13,
1753,
2847,
895,
29918,
21454,
29898,
21454,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
17250,
895,
402,
6271,
8635,
20968,
322,
3132,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
21454,
313,
710,
1125,
1024,
310,
402,
6271,
26162,
20968,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
5534,
350,
29965,
7077,
2544,
13,
1678,
8635,
29918,
4645,
353,
8635,
29889,
4032,
580,
13,
1678,
20968,
1170,
353,
20968,
29889,
6506,
877,
3174,
597,
3788,
1495,
13,
1678,
20968,
353,
8635,
29918,
4645,
29889,
657,
29918,
21454,
29898,
21454,
1170,
29897,
13,
1678,
350,
29965,
7077,
2544,
353,
20968,
13,
13,
1753,
4078,
29918,
18434,
29898,
18434,
29892,
1904,
29918,
4905,
29918,
12083,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
16913,
322,
6441,
1904,
4955,
304,
402,
6271,
26162,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
18434,
313,
8977,
1125,
1904,
4955,
29889,
13,
4706,
584,
4299,
29918,
4905,
29918,
12083,
313,
710,
1125,
1962,
4138,
988,
599,
4733,
21608,
322,
2582,
526,
6087,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
396,
3150,
4955,
5839,
280,
934,
363,
5007,
13,
1678,
1018,
29901,
13,
4706,
285,
353,
1722,
877,
18434,
29889,
29886,
384,
29880,
742,
525,
29893,
29890,
1495,
13,
4706,
5839,
280,
29889,
15070,
29898,
18434,
29889,
18434,
29892,
285,
29897,
13,
4706,
285,
29889,
5358,
580,
13,
1678,
5174,
5839,
280,
29889,
2525,
23945,
1847,
2392,
408,
321,
29901,
13,
4706,
1596,
877,
2392,
742,
321,
29897,
13,
1678,
5174,
313,
6708,
2392,
29892,
29871,
382,
9800,
2392,
29892,
16032,
2392,
29892,
11374,
2392,
29897,
408,
321,
29901,
13,
4706,
1596,
29898,
15003,
1627,
29889,
4830,
29918,
735,
29883,
29898,
29872,
876,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
1596,
29898,
15003,
1627,
29889,
4830,
29918,
735,
29883,
29898,
29872,
876,
13,
4706,
1596,
877,
2392,
4969,
4955,
5839,
280,
29889,
1495,
13,
13,
1678,
396,
3258,
4955,
23755,
2224,
13,
1678,
23755,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
4299,
29918,
4905,
29918,
12083,
29892,
525,
18434,
29889,
29886,
384,
29880,
1495,
13,
13,
1678,
396,
9009,
4955,
304,
20968,
13,
1678,
6441,
29918,
1445,
29898,
10054,
29918,
2084,
5501,
18434,
29889,
29886,
384,
29880,
1495,
13,
13,
1753,
6441,
29918,
12322,
29898,
2997,
29918,
2084,
29892,
330,
2395,
29918,
12083,
29918,
2084,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
5020,
1359,
3884,
8304,
3598,
304,
402,
6271,
26162,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
2997,
29918,
2084,
313,
710,
1125,
1887,
2224,
304,
3884,
29889,
13,
4706,
584,
29887,
2395,
29918,
12083,
29918,
2084,
313,
710,
1125,
23755,
4138,
2224,
373,
402,
6271,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
12105,
29901,
13,
4706,
2045,
597,
2417,
29889,
510,
29914,
2619,
29914,
29906,
29945,
29945,
29929,
29929,
29945,
29900,
29941,
29914,
3525,
29899,
517,
29899,
9009,
29899,
12083,
29899,
265,
29899,
3608,
29899,
9274,
29899,
12925,
29899,
4746,
29899,
4691,
29899,
2754,
13,
1678,
9995,
13,
1678,
565,
451,
313,
359,
29889,
2084,
29889,
275,
3972,
29898,
2997,
29918,
2084,
22164,
13,
4706,
12020,
438,
29173,
877,
2605,
304,
1887,
3884,
451,
1476,
29889,
1495,
13,
13,
1678,
396,
3757,
1295,
3598,
13649,
1549,
3884,
29892,
6441,
292,
1269,
934,
29689,
304,
402,
6271,
20968,
29889,
13,
1678,
363,
1887,
29918,
1445,
297,
13149,
29889,
23705,
29898,
2997,
29918,
2084,
718,
525,
7918,
29374,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
2997,
29918,
1445,
1125,
13,
965,
6441,
29918,
12322,
29898,
2997,
29918,
1445,
29892,
330,
2395,
29918,
12083,
29918,
2084,
718,
5591,
29908,
718,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
2997,
29918,
1445,
876,
13,
4706,
1683,
29901,
13,
965,
7592,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
29887,
2395,
29918,
12083,
29918,
2084,
29892,
1887,
29918,
1445,
29961,
29896,
718,
7431,
29898,
2997,
29918,
2084,
1125,
2314,
13,
965,
6441,
29918,
1445,
29898,
16674,
29918,
2084,
29892,
1887,
29918,
1445,
29897,
13,
13,
1753,
6441,
29918,
1445,
29898,
10054,
29918,
2084,
29892,
934,
2084,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
5020,
1359,
23755,
304,
20968,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
10054,
29918,
2084,
313,
710,
1125,
2224,
310,
23755,
1203,
297,
20968,
29889,
13,
4706,
584,
1445,
2084,
313,
710,
1125,
1887,
934,
2084,
310,
1203,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
396,
11228,
895,
23755,
297,
20968,
13,
1678,
23755,
353,
350,
29965,
7077,
2544,
29889,
10054,
29898,
10054,
29918,
2084,
29897,
13,
13,
1678,
396,
9009,
23755,
304,
6790,
20968,
13,
1678,
1018,
29901,
13,
4706,
23755,
29889,
9009,
29918,
3166,
29918,
9507,
29898,
1445,
2084,
29897,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
1596,
703,
2392,
6441,
292,
23755,
6571,
304,
8635,
20968,
6571,
869,
1642,
4830,
29898,
10054,
29918,
2084,
29892,
321,
29889,
4906,
876,
13,
13,
1753,
5142,
29918,
1445,
29898,
10054,
29918,
2084,
29892,
934,
2084,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
25553,
23755,
1203,
515,
402,
6271,
26162,
20968,
304,
1887,
4516,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
10054,
29918,
2084,
313,
710,
1125,
2224,
310,
23755,
1203,
297,
20968,
29889,
13,
4706,
584,
1445,
2084,
313,
710,
1125,
1887,
934,
2084,
363,
16532,
23755,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
396,
11228,
895,
23755,
297,
20968,
13,
1678,
23755,
353,
350,
29965,
7077,
2544,
29889,
10054,
29898,
10054,
29918,
2084,
29897,
13,
13,
1678,
396,
10382,
23755,
515,
402,
6271,
26162,
20968,
304,
1887,
934,
2084,
13,
1678,
1018,
29901,
13,
4706,
23755,
29889,
10382,
29918,
517,
29918,
9507,
29898,
1445,
2084,
29897,
13,
4706,
1596,
877,
29933,
2127,
6571,
16532,
304,
426,
1836,
4286,
4830,
29898,
10054,
29918,
2084,
29892,
934,
2084,
876,
13,
1678,
5174,
29871,
8960,
408,
321,
29901,
13,
4706,
1596,
703,
2392,
28536,
23755,
6571,
515,
8635,
20968,
6571,
1213,
29889,
4830,
29898,
10054,
29918,
2084,
29892,
321,
29889,
4906,
876,
13,
13,
1753,
679,
29918,
9057,
29918,
24947,
862,
2527,
414,
29898,
4836,
29918,
333,
29892,
4982,
29918,
978,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
10604,
2582,
515,
11266,
15501,
18515,
292,
1889,
304,
11799,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
4836,
29918,
333,
313,
710,
1125,
1024,
310,
402,
6271,
2060,
29889,
13,
4706,
584,
9057,
29918,
978,
313,
710,
1125,
1024,
310,
402,
6271,
319,
29875,
29899,
21889,
4982,
29889,
13,
1678,
16969,
29901,
13,
4706,
584,
2176,
313,
15112,
3630,
4308,
1125,
12205,
310,
11266,
16744,
322,
1009,
6942,
2582,
515,
6694,
29889,
13,
1678,
9995,
13,
1678,
396,
657,
402,
6271,
16140,
363,
3907,
2009,
13,
1678,
4982,
29918,
333,
353,
22372,
6822,
9057,
29879,
29914,
8875,
4286,
4830,
29898,
4836,
29918,
333,
29892,
4982,
29918,
978,
29897,
13,
1678,
16140,
353,
5087,
28037,
29889,
657,
29918,
6214,
29918,
4381,
580,
13,
1678,
286,
29880,
353,
20699,
29889,
4282,
877,
828,
742,
525,
29894,
29896,
742,
16140,
29922,
11944,
9409,
29897,
13,
13,
1678,
396,
5675,
2009,
304,
11266,
15501,
4982,
773,
5087,
3450,
12477,
13,
1678,
1018,
29901,
13,
4706,
2009,
353,
286,
29880,
29889,
16418,
2141,
9057,
29879,
2141,
657,
29898,
978,
29922,
9057,
29918,
333,
467,
7978,
580,
13,
4706,
565,
2009,
1839,
3859,
2033,
2804,
376,
14605,
4174,
17896,
2287,
29928,
1115,
268,
396,
3198,
393,
4982,
756,
8676,
13,
9651,
1596,
877,
26322,
546,
15501,
18515,
292,
4982,
451,
8676,
29889,
1495,
13,
9651,
736,
13,
1678,
5174,
4436,
29889,
5506,
2392,
408,
4589,
29901,
13,
4706,
1596,
877,
2392,
2805,
4982,
4902,
1495,
13,
4706,
1596,
29898,
3127,
3032,
657,
29918,
23147,
3101,
13,
13,
1678,
784,
353,
5159,
13,
1678,
1948,
353,
5159,
13,
13,
1678,
396,
842,
278,
4341,
310,
278,
12205,
304,
278,
11266,
15501,
3651,
13,
1678,
363,
1897,
297,
2009,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
29961,
29900,
22322,
24947,
16744,
2033,
29901,
13,
4706,
784,
29889,
4397,
29898,
4914,
29897,
13,
13,
1678,
396,
1454,
1269,
9150,
14260,
29892,
9773,
1269,
11266,
15501,
12714,
304,
278,
1948,
1409,
13,
1678,
363,
28730,
297,
784,
29901,
13,
4706,
363,
14260,
297,
3464,
29898,
29900,
29892,
7431,
29898,
3827,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
22164,
13,
3986,
396,
3198,
11266,
15501,
756,
20134,
4174,
17896,
2287,
29928,
13,
3986,
565,
2009,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
29961,
3626,
284,
22322,
3859,
2033,
1275,
376,
14605,
4174,
17896,
2287,
29928,
1115,
13,
632,
1948,
29889,
4397,
29898,
3827,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
29961,
3626,
284,
22322,
24947,
16744,
2033,
29961,
22724,
2314,
13,
13,
1678,
396,
9067,
1948,
1051,
964,
263,
12655,
1409,
13,
1678,
1948,
29918,
9302,
353,
7442,
29889,
294,
2378,
29898,
798,
29897,
13,
1678,
954,
29918,
7529,
353,
7431,
29898,
3827,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
29961,
29900,
22322,
24947,
16744,
11287,
13,
13,
1678,
396,
2015,
6753,
635,
6219,
12655,
1409,
964,
1269,
310,
278,
1422,
4341,
13,
1678,
1948,
29918,
9302,
353,
7442,
29889,
5451,
29898,
798,
29918,
9302,
29892,
954,
29918,
7529,
29897,
13,
1678,
396,
3258,
12205,
515,
11266,
15501,
21556,
13,
1678,
4489,
353,
10518,
29889,
17271,
29898,
798,
29918,
9302,
29897,
13,
1678,
396,
3286,
4220,
12205,
13,
1678,
4489,
353,
4489,
29889,
29911,
13,
1678,
396,
842,
4341,
310,
12205,
304,
12714,
2983,
13,
1678,
4489,
29889,
13099,
353,
784,
13,
13,
1678,
396,
4397,
17983,
8158,
322,
14260,
3553,
304,
12205,
13,
1678,
19745,
29918,
13628,
353,
5159,
13,
1678,
14260,
29918,
333,
353,
5159,
13,
1678,
363,
14260,
297,
3464,
29898,
29900,
29892,
7431,
29898,
3827,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
22164,
13,
539,
19745,
29918,
13628,
29889,
4397,
29898,
3827,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
29961,
3626,
284,
22322,
8394,
10095,
2200,
16215,
3318,
573,
1917,
11287,
13,
539,
14260,
29918,
333,
29889,
4397,
29898,
3827,
1839,
26495,
6466,
16215,
3626,
1338,
2033,
29961,
3626,
284,
22322,
3626,
284,
1204,
11287,
13,
13,
1678,
4489,
1839,
14513,
29918,
13628,
2033,
353,
19745,
29918,
13628,
13,
1678,
4489,
1839,
3626,
284,
29918,
333,
2033,
353,
14260,
29918,
333,
13,
1678,
396,
6605,
12205,
491,
278,
17983,
8158,
13,
1678,
4489,
29889,
6605,
29918,
5975,
877,
14513,
29918,
13628,
1495,
13,
13,
1678,
396,
649,
17983,
8158,
322,
14260,
3553,
304,
6763,
310,
12205,
4341,
13,
1678,
19745,
353,
4489,
1839,
14513,
29918,
13628,
2033,
13,
1678,
4489,
29889,
8865,
29898,
21134,
29922,
1839,
14513,
29918,
13628,
7464,
9685,
29922,
29896,
29892,
262,
6689,
353,
5852,
29897,
13,
1678,
4489,
29889,
7851,
29898,
29900,
29892,
525,
14513,
29918,
13628,
742,
19745,
29897,
13,
13,
1678,
14260,
29918,
333,
353,
4489,
1839,
3626,
284,
29918,
333,
2033,
13,
1678,
4489,
29889,
8865,
29898,
21134,
29922,
1839,
3626,
284,
29918,
333,
7464,
9685,
29922,
29896,
29892,
262,
6689,
353,
5852,
29897,
13,
1678,
4489,
29889,
7851,
29898,
29900,
29892,
525,
3626,
284,
29918,
333,
742,
14260,
29918,
333,
29897,
13,
13,
1678,
396,
15843,
12205,
304,
263,
11799,
13,
1678,
4489,
29918,
9507,
353,
4982,
29918,
978,
718,
11119,
24947,
15501,
29918,
29873,
27964,
29908,
13,
1678,
4489,
29889,
517,
29918,
7638,
29898,
2176,
29918,
1445,
29918,
978,
29892,
8025,
2433,
9420,
29899,
29947,
742,
2380,
29922,
8824,
29897,
13,
13,
1678,
396,
9009,
11799,
304,
402,
6271,
26162,
13,
1678,
23755,
29918,
2084,
353,
4982,
29918,
978,
718,
11393,
7638,
29908,
13,
1678,
6441,
29918,
1445,
29898,
10054,
29918,
2084,
29892,
2176,
29918,
9507,
29897,
13,
13,
1678,
736,
4489,
13,
13,
1753,
1051,
29918,
21454,
29918,
12650,
7295,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
2391,
599,
3618,
297,
20968,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
6213,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
396,
1509,
5087,
26162,
3450,
304,
679,
322,
1596,
599,
3618,
297,
20968,
13,
1678,
1018,
29901,
13,
4706,
23755,
29879,
353,
8635,
29918,
4645,
29889,
1761,
29918,
10054,
29879,
29898,
7838,
7077,
2544,
29918,
5813,
29897,
29871,
396,
10945,
350,
29965,
7077,
2544,
29918,
5813,
2286,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
1596,
703,
2392,
18028,
23755,
29879,
515,
6571,
20968,
29901,
6571,
1642,
4830,
29898,
7838,
7077,
2544,
29918,
5813,
29892,
321,
29889,
4906,
876,
13,
13,
1678,
396,
2158,
20968,
23755,
29879,
13,
1678,
363,
23755,
297,
23755,
29879,
29901,
13,
4706,
1596,
29898,
10054,
29889,
978,
29897,
13,
13,
1753,
5217,
29918,
10054,
29898,
10054,
29918,
978,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
21267,
23755,
515,
402,
6271,
8635,
20968,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
10054,
29918,
978,
313,
710,
1125,
1024,
310,
23755,
304,
5217,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
396,
657,
23755,
515,
20968,
773,
402,
6271,
8635,
3450,
13,
1678,
23755,
353,
350,
29965,
7077,
2544,
29889,
10054,
29898,
10054,
29918,
978,
29897,
13,
13,
1678,
396,
8143,
23755,
13,
1678,
1018,
29901,
13,
4706,
23755,
29889,
8143,
580,
13,
4706,
1596,
703,
29933,
2127,
6571,
11132,
515,
6571,
20968,
1213,
29889,
4830,
29898,
10054,
29918,
978,
29892,
350,
29965,
7077,
2544,
29918,
5813,
876,
13,
1678,
5174,
8960,
408,
321,
29901,
13,
4706,
1596,
703,
2392,
21228,
23755,
6571,
515,
6571,
20968,
29901,
6571,
1213,
29889,
4830,
29898,
10054,
29918,
978,
29892,
350,
29965,
7077,
2544,
29918,
5813,
29892,
321,
29889,
4906,
876,
13,
13,
1753,
679,
29918,
4299,
29918,
4905,
29898,
9057,
29918,
978,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
10604,
2582,
515,
21556,
15468,
746,
6694,
1904,
29889,
10604,
304,
16874,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
9057,
29918,
978,
313,
710,
1125,
1024,
310,
319,
29902,
28096,
6694,
4982,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
396,
2997,
934,
2084,
322,
402,
6271,
23755,
1024,
13,
1678,
1904,
29918,
4905,
29918,
7638,
29918,
10054,
353,
2897,
29889,
2084,
29889,
7122,
29898,
9057,
29918,
978,
29892,
525,
4905,
29918,
9902,
29889,
7638,
1495,
13,
13,
1678,
396,
535,
369,
1259,
1904,
29918,
4905,
8600,
304,
11701,
3630,
2557,
13,
1678,
1904,
29918,
4905,
29918,
2176,
353,
10518,
29889,
17271,
29898,
4299,
29918,
4905,
29892,
2380,
11759,
29900,
2314,
13,
13,
1678,
396,
15843,
292,
3630,
2557,
304,
16874,
13,
1678,
1904,
29918,
4905,
29918,
2176,
29889,
517,
29918,
7638,
877,
4905,
29918,
9902,
29889,
7638,
742,
2248,
29922,
8824,
29897,
13,
13,
1678,
396,
9009,
292,
23755,
304,
9570,
8635,
13,
1678,
6441,
29918,
1445,
29898,
359,
29889,
2084,
29889,
7122,
29898,
9057,
29918,
978,
29892,
525,
4905,
29918,
9902,
29889,
7638,
5477,
29915,
4905,
29918,
9902,
29889,
7638,
1495,
13,
13,
1678,
736,
1904,
29918,
4905,
29918,
2176,
13,
13,
1753,
7604,
895,
29918,
4299,
29898,
4299,
29892,
4078,
29918,
12083,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
9249,
895,
12693,
294,
323,
29943,
1904,
29892,
3704,
967,
15359,
29892,
12368,
322,
848,
4072,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
4299,
313,
29968,
18464,
29889,
4299,
1125,
12693,
294,
1904,
304,
7604,
895,
29889,
13,
4706,
584,
7620,
29918,
12083,
313,
710,
1125,
934,
2084,
363,
1904,
3884,
304,
3787,
1904,
10153,
297,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
6492,
29918,
4299,
29898,
4299,
29892,
304,
29918,
1445,
29922,
359,
29889,
2084,
29889,
7122,
29898,
7620,
29918,
12083,
5501,
4299,
29889,
2732,
5477,
13,
4706,
1510,
29918,
845,
11603,
29922,
5574,
29892,
1510,
29918,
29881,
1853,
29922,
5574,
29897,
13,
13,
1753,
679,
29918,
14968,
519,
29918,
16744,
29898,
4299,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
20535,
403,
278,
1353,
310,
7945,
519,
322,
1661,
29899,
14968,
519,
4128,
297,
12693,
294,
1904,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
4299,
313,
29968,
18464,
29889,
4299,
1125,
12693,
294,
1904,
304,
8147,
4128,
363,
29889,
13,
1678,
16969,
29901,
13,
4706,
584,
14968,
519,
29918,
7529,
313,
524,
1125,
1353,
310,
7945,
519,
4128,
29889,
13,
4706,
584,
5464,
29918,
14968,
519,
29918,
7529,
313,
524,
1125,
1353,
310,
1661,
29899,
14968,
519,
4128,
29889,
13,
4706,
584,
7827,
29918,
7529,
313,
524,
1125,
3001,
1353,
310,
7945,
519,
718,
1661,
29899,
14968,
519,
4128,
29889,
13,
1678,
9995,
13,
1678,
7945,
519,
29918,
7529,
353,
2302,
29918,
7529,
29898,
4299,
29889,
14968,
519,
29918,
705,
5861,
29897,
13,
1678,
1661,
29918,
14968,
519,
29918,
7529,
353,
2302,
29918,
7529,
29898,
4299,
29889,
5464,
29918,
14968,
519,
29918,
705,
5861,
29897,
13,
1678,
3001,
29918,
7529,
353,
7945,
519,
29918,
7529,
718,
1661,
29918,
14968,
519,
29918,
7529,
13,
13,
1678,
736,
7945,
519,
29918,
7529,
29892,
1661,
29918,
14968,
519,
29918,
7529,
29892,
3001,
29918,
7529,
13,
13,
1753,
9773,
29918,
497,
29918,
4905,
29898,
4905,
29918,
9902,
29918,
2176,
29892,
599,
29918,
9902,
543,
497,
29918,
9902,
29889,
7638,
29908,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
22871,
6694,
2582,
29914,
16744,
310,
1857,
4982,
304,
16874,
6943,
13,
4706,
2582,
29914,
16744,
310,
599,
3517,
17643,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
497,
29918,
9902,
313,
710,
1125,
934,
2084,
304,
11799,
6943,
2582,
310,
3517,
17643,
29889,
13,
4706,
584,
497,
29918,
9902,
313,
710,
1125,
934,
2084,
304,
11799,
6943,
2582,
310,
1857,
4982,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
396,
3198,
565,
2582,
934,
4864,
297,
20968,
29892,
565,
577,
769,
5142,
12430,
13,
1678,
565,
313,
7838,
7077,
2544,
29889,
10054,
29898,
497,
29918,
9902,
467,
9933,
580,
1125,
13,
4706,
5142,
29918,
1445,
29898,
497,
29918,
9902,
29892,
599,
29918,
9902,
29897,
13,
1678,
1683,
29901,
13,
4706,
736,
13,
13,
1678,
396,
949,
11799,
2582,
934,
13,
1678,
599,
29918,
9902,
29918,
2176,
353,
10518,
29889,
949,
29918,
7638,
29898,
497,
29918,
9902,
29897,
13,
1678,
396,
4397,
2582,
310,
1857,
6694,
4982,
304,
599,
29918,
9902,
934,
13,
1678,
599,
29918,
9902,
29918,
2176,
353,
599,
29918,
9902,
29918,
2176,
29889,
4397,
29898,
4905,
29918,
9902,
29918,
2176,
29897,
13,
1678,
396,
15843,
2582,
304,
11799,
13,
1678,
599,
29918,
9902,
29918,
2176,
29889,
517,
29918,
7638,
29898,
497,
29918,
9902,
29892,
2380,
29922,
8824,
29897,
13,
13,
1678,
396,
9009,
4784,
2582,
934,
304,
20968,
13,
1678,
6441,
29918,
1445,
29898,
497,
29918,
9902,
29892,
599,
29918,
9902,
29897,
13,
13,
1753,
6088,
29918,
3126,
29918,
1279,
29898,
1279,
29918,
3126,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
20969,
1904,
11258,
4663,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
1279,
29918,
3126,
313,
710,
1125,
934,
2084,
304,
1904,
4390,
29889,
13,
1678,
16969,
29901,
13,
4706,
6213,
13,
1678,
9995,
13,
1678,
1209,
13,
13,
1753,
679,
29918,
9057,
29918,
4882,
29898,
9057,
29918,
978,
1125,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
3617,
6694,
4660,
310,
402,
6271,
319,
29875,
29899,
21889,
6694,
4982,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
9057,
29918,
978,
313,
710,
1125,
1024,
310,
6694,
4982,
29889,
13,
1678,
16969,
29901,
13,
4706,
584,
4882,
313,
710,
1125,
6694,
4660,
310,
4982,
29889,
13,
4706,
584,
3127,
29918,
4906,
313,
710,
1125,
1059,
2643,
310,
4982,
29889,
13,
1678,
9995,
13,
1678,
396,
4982,
29918,
20756,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
3366,
29887,
9274,
613,
376,
1794,
29899,
12120,
3284,
9057,
29879,
3284,
2783,
29581,
613,
9057,
29918,
978,
2314,
13,
1678,
4982,
29918,
20756,
353,
1014,
5014,
29889,
29925,
3150,
29898,
3366,
29887,
9274,
613,
376,
1794,
29899,
12120,
3284,
9057,
29879,
3284,
2783,
29581,
613,
9057,
29918,
978,
1402,
3659,
262,
29922,
2227,
4162,
29892,
27591,
29922,
2227,
4162,
29892,
380,
20405,
29922,
2227,
4162,
29897,
13,
13,
1678,
1962,
29892,
4589,
353,
4982,
29918,
20756,
29889,
27820,
403,
29898,
29890,
29908,
2080,
848,
393,
338,
4502,
304,
1014,
5014,
29915,
3659,
262,
1159,
13,
13,
1678,
396,
5510,
4982,
4660,
515,
1899,
29899,
1220,
1962,
13,
1678,
4660,
13776,
13,
1678,
363,
2944,
297,
313,
4905,
29889,
13808,
877,
10496,
29899,
29947,
1495,
467,
5451,
14182,
29876,
29908,
1125,
13,
4706,
565,
4852,
3859,
6160,
297,
2944,
1125,
13,
9651,
4660,
353,
2944,
29889,
17010,
580,
13,
9651,
4660,
353,
313,
4882,
29961,
4882,
29889,
2886,
877,
29901,
1495,
29974,
29896,
29901,
14664,
17010,
580,
13,
13,
1678,
396,
5510,
1059,
2643,
515,
1899,
29899,
1220,
1962,
13,
1678,
4589,
29918,
4906,
13776,
13,
1678,
565,
313,
4882,
26359,
4519,
29902,
20566,
29908,
1125,
13,
4706,
363,
2944,
297,
313,
4905,
29889,
13808,
877,
10496,
29899,
29947,
1495,
467,
5451,
14182,
29876,
29908,
1125,
13,
9651,
565,
4852,
2704,
3728,
6160,
297,
2944,
1125,
13,
18884,
4589,
29918,
4906,
353,
2944,
29889,
17010,
580,
13,
13,
1678,
396,
657,
4589,
29918,
4906,
1623,
304,
634,
351,
13,
1678,
736,
4660,
29892,
4589,
29918,
4906,
13,
13,
1753,
6230,
29918,
29873,
3746,
7295,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
25455,
323,
7056,
363,
6694,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
6213,
13,
1678,
16969,
29901,
13,
4706,
584,
710,
8963,
313,
3557,
3308,
509,
8963,
1125,
323,
7056,
6694,
13705,
1203,
29889,
13,
1678,
28318,
29901,
13,
4706,
518,
29896,
5387,
2045,
597,
1636,
29889,
29056,
29889,
990,
29914,
13075,
29914,
29873,
3746,
13,
4706,
518,
29906,
5387,
2045,
597,
9274,
29889,
3608,
29889,
510,
29914,
29873,
3746,
29914,
2640,
29914,
9392,
375,
13,
1678,
9995,
13,
1678,
3770,
369,
353,
15886,
29889,
5721,
2666,
29889,
19594,
29918,
9778,
369,
29889,
3557,
29965,
6821,
5402,
19648,
580,
13,
1678,
15886,
29889,
2917,
29889,
735,
27910,
29918,
6915,
29918,
517,
29918,
19594,
29898,
9778,
369,
29897,
13,
1678,
15886,
29889,
29873,
3746,
29889,
735,
27910,
29889,
24926,
29918,
29873,
3746,
29918,
5205,
29898,
9778,
369,
29897,
13,
1678,
13705,
353,
15886,
29889,
5721,
2666,
29889,
735,
27910,
29889,
3557,
3308,
509,
8963,
29898,
9778,
369,
29897,
13,
13,
1678,
736,
13705,
13,
13,
1990,
16696,
6185,
388,
7295,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
16696,
3826,
388,
29257,
6554,
1364,
14952,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
2344,
28630,
313,
7411,
1125,
2847,
6509,
6554,
313,
4381,
29922,
29900,
29889,
29900,
29900,
29900,
29945,
467,
13,
4706,
584,
19790,
313,
7411,
1125,
5768,
7329,
313,
4381,
29922,
29900,
29889,
29947,
467,
13,
4706,
584,
8865,
26526,
313,
524,
1125,
1353,
310,
21502,
12168,
6509,
6554,
338,
13700,
313,
4381,
29922,
29946,
29900,
467,
13,
1678,
16969,
29901,
13,
4706,
7867,
515,
4331,
20228,
740,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2069,
28630,
29922,
29900,
29889,
29900,
29900,
29900,
29945,
29892,
7329,
29922,
29900,
29889,
29947,
29892,
5768,
26526,
29922,
29946,
29900,
1125,
13,
4706,
1583,
29889,
2344,
28630,
353,
2069,
28630,
13,
4706,
1583,
29889,
19790,
353,
7329,
13,
4706,
1583,
29889,
8865,
26526,
353,
5768,
26526,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
21502,
305,
1125,
13,
4706,
1518,
353,
7442,
29889,
14939,
3552,
1022,
2878,
718,
29871,
29896,
29897,
847,
1583,
29889,
8865,
26526,
29897,
13,
4706,
15595,
353,
1583,
29889,
2344,
28630,
334,
313,
1311,
29889,
19790,
3579,
1518,
29897,
13,
4706,
736,
5785,
29898,
2312,
29897,
13,
13,
1990,
1222,
1112,
2556,
6185,
388,
7295,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
1222,
1112,
2556,
3826,
388,
29257,
6554,
1364,
14952,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
2344,
28630,
313,
7411,
1125,
2847,
6509,
6554,
313,
4381,
29922,
29900,
29889,
29900,
29900,
29900,
29945,
467,
13,
4706,
584,
29895,
313,
7411,
1125,
3081,
29914,
735,
3296,
310,
278,
25658,
313,
4381,
29922,
29900,
29889,
29947,
467,
13,
1678,
16969,
29901,
13,
4706,
7867,
515,
25658,
20228,
740,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2069,
28630,
29922,
29900,
29889,
29900,
29900,
29900,
29945,
29892,
413,
29922,
29900,
29889,
29947,
1125,
13,
4706,
1583,
29889,
2344,
28630,
353,
2069,
28630,
13,
4706,
1583,
29889,
29895,
353,
413,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
21502,
305,
1125,
13,
4706,
736,
313,
1311,
29889,
2344,
28630,
334,
5844,
29889,
4548,
6278,
29895,
29930,
1022,
2878,
876,
13,
13,
1990,
7870,
287,
29933,
1463,
7295,
13,
1678,
9995,
13,
1678,
12953,
29901,
13,
4706,
7870,
287,
2729,
3826,
388,
29257,
6554,
1364,
14952,
29889,
13,
1678,
826,
3174,
29901,
13,
4706,
584,
2344,
28630,
313,
7411,
1125,
2847,
6509,
6554,
313,
4381,
29922,
29900,
29889,
29900,
29900,
29900,
29945,
467,
13,
4706,
584,
1022,
2878,
29879,
313,
524,
1125,
1353,
310,
21502,
12168,
29889,
13,
1678,
16969,
29901,
13,
4706,
7867,
515,
5335,
287,
2729,
20228,
740,
29889,
13,
1678,
9995,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2069,
28630,
29922,
29900,
29889,
29900,
29896,
29892,
21502,
12168,
29922,
29896,
29900,
29900,
1125,
13,
4706,
1583,
29889,
2344,
28630,
353,
2069,
28630,
13,
4706,
1583,
29889,
1022,
2878,
29879,
353,
21502,
12168,
13,
4706,
20228,
353,
1583,
29889,
2344,
28630,
847,
1583,
29889,
1022,
2878,
29879,
13,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
301,
29878,
29892,
21502,
12168,
1125,
13,
4706,
20228,
353,
1583,
29889,
2344,
28630,
847,
1583,
29889,
1022,
2878,
29879,
13,
4706,
736,
5135,
29212,
334,
29896,
29897,
847,
313,
29896,
718,
20228,
334,
1583,
29889,
1022,
2878,
29879,
876,
13,
2
] |
research/02_TrafficSignClassification/02_CarNDTrafficSignClassifier/source/path/run.py | LewisCollum/frostAV | 5 | 32638 | import os
from datetime import datetime
directory = "../runs"
current = os.path.join(directory, ".current")
class Run:
def __init__(self, runName):
run = os.path.join(directory, runName)
self.model = os.path.join(run, "model.h5")
self.log = os.path.join(run, "log.csv")
self.accuracy = os.path.join(run, "accuracy.png")
self.modelDiagram = os.path.join(run, "model.png")
self.modelSummary = os.path.join(run, "modelSummary")
def make():
runName = f"{datetime.now():%m-%d_%H%M}"
newRun = os.path.join(directory, runName)
os.mkdir(newRun)
with open(current, 'w') as f:
f.write(runName)
def loadFromName(runName):
return Run(runName)
def loadCurrent():
with open(current) as f:
return loadFromName(f.readline())
def has(path):
return os.path.isfile(path)
| [
1,
1053,
2897,
13,
3166,
12865,
1053,
12865,
13,
13,
12322,
353,
376,
6995,
3389,
29879,
29908,
13,
3784,
353,
2897,
29889,
2084,
29889,
7122,
29898,
12322,
29892,
11393,
3784,
1159,
13,
13,
1990,
7525,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1065,
1170,
1125,
13,
4706,
1065,
353,
2897,
29889,
2084,
29889,
7122,
29898,
12322,
29892,
1065,
1170,
29897,
13,
4706,
1583,
29889,
4299,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3389,
29892,
376,
4299,
29889,
29882,
29945,
1159,
13,
4706,
1583,
29889,
1188,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3389,
29892,
376,
1188,
29889,
7638,
1159,
13,
4706,
1583,
29889,
562,
2764,
4135,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3389,
29892,
376,
562,
2764,
4135,
29889,
2732,
1159,
13,
4706,
1583,
29889,
4299,
12130,
14442,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3389,
29892,
376,
4299,
29889,
2732,
1159,
13,
4706,
1583,
29889,
4299,
26289,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3389,
29892,
376,
4299,
26289,
1159,
13,
13,
1753,
1207,
7295,
13,
1678,
1065,
1170,
353,
285,
29908,
29912,
12673,
29889,
3707,
7295,
29995,
29885,
19222,
29881,
29918,
29995,
29950,
29995,
29924,
5038,
13,
1678,
716,
6558,
353,
2897,
29889,
2084,
29889,
7122,
29898,
12322,
29892,
1065,
1170,
29897,
13,
1678,
2897,
29889,
11256,
3972,
29898,
1482,
6558,
29897,
13,
1678,
411,
1722,
29898,
3784,
29892,
525,
29893,
1495,
408,
285,
29901,
13,
4706,
285,
29889,
3539,
29898,
3389,
1170,
29897,
13,
268,
13,
1753,
2254,
4591,
1170,
29898,
3389,
1170,
1125,
13,
1678,
736,
7525,
29898,
3389,
1170,
29897,
13,
13,
1753,
2254,
7583,
7295,
13,
1678,
411,
1722,
29898,
3784,
29897,
408,
285,
29901,
13,
4706,
736,
2254,
4591,
1170,
29898,
29888,
29889,
949,
1220,
3101,
13,
13,
1753,
756,
29898,
2084,
1125,
13,
1678,
736,
2897,
29889,
2084,
29889,
275,
1445,
29898,
2084,
29897,
13,
2
] |
vgazer/version/custom_checker/lua.py | edomin/vgazer | 2 | 161879 | <reponame>edomin/vgazer<filename>vgazer/version/custom_checker/lua.py
import requests
from bs4 import BeautifulSoup
from vgazer.version.utils import GetVersionFromFilename
def Check(auth, mirrors):
response = requests.get("http://www.lua.org/download.html")
html = response.content
parsedHtml = BeautifulSoup(html, "html.parser")
links = parsedHtml.find_all("a")
for link in links:
if "ftp/lua-" in link["href"]:
return GetVersionFromFilename(link["href"])
| [
1,
529,
276,
1112,
420,
29958,
287,
5817,
29914,
29894,
29887,
834,
261,
29966,
9507,
29958,
29894,
29887,
834,
261,
29914,
3259,
29914,
6341,
29918,
3198,
261,
29914,
29448,
29889,
2272,
13,
5215,
7274,
13,
3166,
24512,
29946,
1053,
25685,
29903,
1132,
13,
13,
3166,
325,
29887,
834,
261,
29889,
3259,
29889,
13239,
1053,
3617,
6594,
4591,
3434,
3871,
13,
13,
1753,
5399,
29898,
5150,
29892,
19571,
29879,
1125,
13,
1678,
2933,
353,
7274,
29889,
657,
703,
1124,
597,
1636,
29889,
29448,
29889,
990,
29914,
10382,
29889,
1420,
1159,
13,
1678,
3472,
353,
2933,
29889,
3051,
13,
1678,
21213,
10922,
353,
25685,
29903,
1132,
29898,
1420,
29892,
376,
1420,
29889,
16680,
1159,
13,
13,
1678,
2988,
353,
21213,
10922,
29889,
2886,
29918,
497,
703,
29874,
1159,
13,
1678,
363,
1544,
297,
2988,
29901,
13,
4706,
565,
376,
23102,
29914,
29448,
29899,
29908,
297,
1544,
3366,
12653,
3108,
29901,
13,
9651,
736,
3617,
6594,
4591,
3434,
3871,
29898,
2324,
3366,
12653,
20068,
13,
2
] |
EPMA Microsegregation Processing Grid.py | smo216/EPMA-Microsegregation-Processing | 0 | 168566 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 27 15:04:09 2019
@author: EMG
EPMA Microsegregation Analysis
"""
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn import metrics
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# curve-fit() function imported from scipy
from scipy.optimize import curve_fit
import statsmodels.api as sm
from matplotlib.pyplot import figure
import math
# %% Import EPMA data
""" Paste Filename Here"""
filename='10_1_19 DataBase W Mo Ti disabled new filament _Un 29 Duraloy M10 CCnew Mn.xlsx'
#filename='10_1_19 DataBase W Mo Ti disabled new filament _Un 33 Duraloy M10 DTA.xlsx'
#filename='9_27_19 DataBase W Ti disabled_Un 25 MT418 DTA Grid.xlsx'
#filename='9_24_19 DataBase W Ti disabled_Un 20 418 DTA Linetrace Core.xlsx'
#filename='10_1_19 DataBase W Mo Ti disabled new filament _Un 32 HP-2 DTA.xlsx'
data = pd.read_excel(filename)
data.head
[Len,Wid]=data.shape
data.info
data.describe()
# %% Pull EPMA data
Total=data['Elemental Totals']
Si=data['Si Elemental Percents']
Cr=data["Cr Elemental Percents"]
Fe=data["Fe Elemental Percents"]
Ni=data["Ni Elemental Percents"]
W=data["W Elemental Percents"]
Nb=data["Nb Elemental Percents"]
Mo=data["Mo Elemental Percents"]
Mn=data["Mn Elemental Percents"]
Ti=data["Ti Elemental Percents"]
#data['Total'] = data.sum(axis=1)-distance
#Total=data.sum(axis=1)-distance #totals the composition
# errprs
Si_er=data['Si Percent Errors']
Cr_er=data["Cr Percent Errors"]
Fe_er=data["Fe Percent Errors"]
Ni_er=data["Ni Percent Errors"]
W_er=data["W Percent Errors"]
Nb_er=data["Nb Percent Errors"]
Mo_er=data["Mo Percent Errors"]
Mn_er=data["Mn Percent Errors"]
Ti_er=data["Ti Percent Errors"]
# %%Lets get Plotting
# make subplots?
plt.scatter(Fe,Si,label="Si")
plt.scatter(Fe,Cr,label="Cr")
#plt.plot(Fe,Fe,label="Fe")
plt.scatter(Fe,Ni,label="Ni")
#plt.scatter(Fe,W,label="W")
plt.scatter(Fe,Nb,label="Nb")
#plt.scatter(Fe,Mo,label="Mo")
plt.scatter(Fe,W,label="Mn")
#plt.plot(Fe,Ti,label="Ti")
#
#
#plt.xlabel('Distance (um)')
plt.xlabel('Concentration Fe (wt.%)')
#
plt.ylabel('Concentration (wt.%)')
#
plt.title("Concentration of Elements")
#
plt.legend()
#plt.xlim(30,35)
#plt.ylim(0,40)
#
plt.show()
# %%Lets get Plotting Function of Cr
# make subplots?
plt.scatter(Cr,Si,label="Si")
plt.scatter(Cr,Fe,label="Fe")
#plt.plot(Fe,Fe,label="Fe")
plt.scatter(Cr,Ni,label="Ni")
#plt.scatter(Fe,W,label="W")
plt.scatter(Cr,Nb,label="Nb")
#plt.scatter(Fe,Mo,label="Mo")
plt.scatter(Cr,W,label="Mn")
#plt.plot(Fe,Ti,label="Ti")
#
#
#plt.xlabel('Distance (um)')
plt.xlabel('Concentration Cr (wt.%)')
#
plt.ylabel('Concentration (wt.%)')
#
plt.title("Concentration of Elements")
#
plt.legend()
#plt.xlim(30,35)
#plt.ylim(0,40)
#
plt.show()
# %% Subplots
fig, axs = plt.subplots(6, sharex=True)
fig.suptitle('Concentration wt% as a function of Fe')
axs[0].scatter(Fe,Si)
#axs[0].set_title('Si')
axs[1].scatter(Fe,Cr)
#axs[1].set_title('Cr')
axs[2].scatter(Fe,Ni)
axs[3].scatter(Fe,Nb)
axs[4].scatter(Fe,Mo)
axs[5].scatter(Fe,Mn)
#plt.legend()
#plt.xlim(30,35)
#plt.ylim(0,40)
# %% Filter for Carbides
totalwtcarbide = 95 #max comp for filtering for carbides
M7_filter = (data['Elemental Totals']<totalwtcarbide) & (data["Cr Elemental Percents"] > 70)
M7_comp=data[M7_filter]
AM7_comp=M7_comp.loc[:,"Si Elemental Percents":"V Elemental Percents"].mean(axis=0)
print(AM7_comp)
#M7_comp1=M7_comp.loc['Element Totals':'V Elemental Percents']#.mean(axis=1)
#print(M7_comp1)
MC_filter = (data['Elemental Totals']<totalwtcarbide) & (data["Nb Elemental Percents"] > 80)
MC_comp=data[MC_filter]
AMC_comp=MC_comp.loc[:,"Si Elemental Percents":"V Elemental Percents"].mean(axis=0)
print(AMC_comp)
Avg_comp=data.loc[:,"Si Elemental Percents":"V Elemental Percents"].mean(axis=0)
print(Avg_comp)
# %% WIRS
#filter dataset to remove interdendritic regions
totalwtlow=97 #threshold for filtering interdendritic regions may need to be tweaked
totalwthigh=103
crmax=26
nbmax=1
nimin=30
nimax=36.5
""" This value will influence the kline"""
maxfs=1#0.96#0.899#82.19485515/100 HP-2 #0.96 for M10 #0.899 for HP
max_filter = (data['Elemental Totals']>totalwtlow) & (data["Cr Elemental Percents"] < crmax) & (data["Nb Elemental Percents"] < nbmax) & (data['Elemental Totals']<totalwthigh) & (data["Ni Elemental Percents"] > nimin) & (data["Ni Elemental Percents"] < nimax)
primary_y=data#[max_filter]
#print(primary_y)
#plt.plot(primary_y['Relative Microns'],primary_y[' "Si Elemental Percents"'],label="Si")
#plt.plot(primary_y['Relative Microns'],primary_y["Cr Elemental Percents"],label="Cr")
#plt.show()
#for negatively segregating elements
primary_y['Si_bar']=(primary_y['Si Elemental Percents'] - primary_y['Si Elemental Percents'].min())/primary_y['Si Percent Errors']
primary_y['Cr_bar']=(primary_y["Cr Elemental Percents"] - primary_y["Cr Elemental Percents"].min())/primary_y["Cr Percent Errors"]
primary_y['Ni_bar']=(primary_y["Ni Elemental Percents"] - primary_y["Ni Elemental Percents"].min())/primary_y["Ni Percent Errors"] #if Ni negatively segregates
primary_y['Nb_bar']=(primary_y["Nb Elemental Percents"] - primary_y["Nb Elemental Percents"].min())/primary_y["Nb Percent Errors"]
#primary_y['Mo_bar']=(primary_y["Mo Elemental Percents"] - primary_y["Mo Elemental Percents"].min())/primary_y["Mo Percent Errors"]
primary_y['Mn_bar']=(primary_y["Mn Elemental Percents"] - primary_y["Mn Elemental Percents"].min())/primary_y["Mn Percent Errors"]
#W_bar=(primary_y["W Elemental Percents"] - primary_y["W Elemental Percents"].min())/primary_y["W Percent Errors"]
#for positively segregating elements
primary_y['Fe_bar']=(primary_y["Fe Elemental Percents"].max() - primary_y["Fe Elemental Percents"])/primary_y["Fe Percent Errors"]
#primary_y['Ni_bar']=(primary_y["Ni Elemental Percents"].max() - primary_y["Ni Elemental Percents"])/primary_y["Ni Percent Errors"]
#Ti_bar=(primary_y["Ti Elemental Percents"].max() - primary_y["Ti Elemental Percents"])/primary_y["Ti Percent Errors"]
#Aggregate Values into a new dataframe
#Cbar=pd.DataFrame(data=[Si_bar,Cr_bar,Fe_bar,Ni_bar,W_bar,Nb_bar,Mo_bar,Ti_bar]).T
#Cbar.columns=['Sibar', 'Crbar', 'Febar', 'Nibar', 'Wbar', 'Nbbar', 'Mobar', 'Tibar']
#Cbar=pd.DataFrame(data=[Si_bar,Cr_bar,Fe_bar,Ni_bar,Nb_bar,Mo_bar]).T
#Cbar.columns=['Sibar', 'Crbar', 'Febar', 'Nibar', 'Nbbar', 'Mobar']
#primary_y['Avgbar'] = primary_y[['Si_bar', 'Cr_bar', 'Fe_bar', 'Ni_bar', 'Nb_bar', 'Mo_bar', 'Mn_bar']].mean(axis=1)
primary_y['Avgbar'] = primary_y[['Si_bar', 'Cr_bar', 'Fe_bar', 'Ni_bar', 'Nb_bar', 'Mn_bar']].mean(axis=1)
#print(primary_y)
#sort according to Cbar min to max
primary_y_sort=primary_y.sort_values(by=['Avgbar'])
#print(primary_y_sort)
primary_y_sort['Rank'] = primary_y_sort['Avgbar'].rank(ascending = 1)
#print(primary_y_sort)
primary_y_sort['Fsolid']=(primary_y_sort['Rank'] - 0.5)/primary_y_sort['Rank'].max()*maxfs
#print(primary_y_sort['Fsolid'])
f_solid=primary_y_sort['Fsolid']
# %%Lets get Plotting
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Si Elemental Percents'],label="Si")
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Cr Elemental Percents'],label="Cr")
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Fe Elemental Percents'],label="Fe")
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Ni Elemental Percents'],label="Ni")
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Nb Elemental Percents'],label="Nb")
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mo Elemental Percents'],label="Mo")
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mn Elemental Percents'],label="Mn")
#plt.plot(Csort['Fsolid'],Csort['Fe'],label="Fe")
#plt.plot(Csort['Fsolid'],Csort['Ni'],label="Ni")
##plt.plot(Csort['Fsolid'],Csort['W'],label="W")
#plt.plot(Csort['Fsolid'],Csort['Nb'],label="Nb")
#plt.plot(Csort['Fsolid'],Csort['Mo'],label="Mo")
#plt.plot(Csort['Fsolid'],Csort['Ti'],label="Ti")
plt.xlabel('Fraction Solid')
plt.ylabel('Concentration (wt.%)')
plt.title("Concentration of Elements")
#plt.legend()
#loc='best'
plt.show()
# %% Calculate k from Core
#Nominal Composition
C0={'Si':1.929,'Cr':24.571,'Fe':37.695,'Ni':33.206,'Nb':1.28,'Mn':0.837,'Mo':0.07} #M10
#C0={'Si':1.14,'Cr':25.2,'Fe':36.66,'Ni':35,'Nb':0.418,'Mn':0.899,'Mo':0.06} #HP-2
#C0={'Si':1.929,'Cr':24.571,'Fe':37.695,'Ni':33.206,'Nb':1.28,'Mn':0.837,'Mo':0.07}
acore=10 #points to average from start of sorted data
#pull C0 estimates from grid
C0Si=data['Si Elemental Percents'].mean()
C0Cr=data["Cr Elemental Percents"].mean()
C0Fe=data["Fe Elemental Percents"].mean()
C0Ni=primary_y_sort["Ni Elemental Percents"].mean()
C0W=data["W Elemental Percents"].mean()
C0Nb=data["Nb Elemental Percents"].mean()
#C0Mo=data["Mo Elemental Percents"].mean()
C0Mn=data["Mn Elemental Percents"].mean()
C0Ti=data["Ti Elemental Percents"].mean()
#Average of the first 6 points to solidify to the total average composition
KSi=primary_y_sort['Si Elemental Percents'].iloc[0:acore].mean(axis=0) / C0Si
#primary_y_sort['Si Elemental Percents'].iloc[0:5].mean(axis=0)
print(KSi)
KSic0=primary_y_sort['Si Elemental Percents'].iloc[0:acore].mean(axis=0) / C0['Si']
#primary_y_sort['Si Elemental Percents'].iloc[0:5].mean(axis=0)
print(KSic0)
KCr=primary_y_sort['Cr Elemental Percents'].iloc[0:acore].mean(axis=0) / C0Cr
print(KCr)
KCrc0=primary_y_sort['Cr Elemental Percents'].iloc[0:acore].mean(axis=0) / C0['Cr']
print(KCrc0)
KFe=primary_y_sort['Fe Elemental Percents'].iloc[0:acore].mean(axis=0) / C0Fe
print(KFe)
KFec0=primary_y_sort['Fe Elemental Percents'].iloc[0:acore].mean(axis=0) / C0['Fe']
print(KFec0)
KNi=primary_y_sort['Ni Elemental Percents'].iloc[0:acore].mean(axis=0) / C0Ni
print(KNi)
KNic0=primary_y_sort['Ni Elemental Percents'].iloc[0:acore].mean(axis=0) / C0['Ni']
print(KNic0)
#KW=primary_y_sort['W Elemental Percents'].iloc[0:5].mean(axis=0) / data["W Elemental Percents"].mean()
KNb=primary_y_sort['Nb Elemental Percents'].iloc[0:acore].mean(axis=0) / C0Nb
print(KNb)
KNbc0=primary_y_sort['Nb Elemental Percents'].iloc[0:acore].mean(axis=0) / C0['Nb']
print(KNbc0)
#KMo=primary_y_sort['Mo Elemental Percents'].iloc[0:acore].mean(axis=0) / C0Mo
#print(KMo)
#KMoc0=primary_y_sort['Mo Elemental Percents'].iloc[0:acore].mean(axis=0) / C0['Mo']
#print(KMoc0)
KMn=primary_y_sort['Mn Elemental Percents'].iloc[0:acore].mean(axis=0) / C0Mn
print(KMn)
KMnc0=primary_y_sort['Mn Elemental Percents'].iloc[0:acore].mean(axis=0) / C0['Mn']
print(KMnc0)
#KTi=primary_y_sort['Ti Elemental Percents'].iloc[0:5].mean(axis=0) / data["Ti Elemental Percents"].mean()
# %% Calc from Curve
#CsSi=primary_y_sort['Si Elemental Percents'].div(C0['Si'])
#print(CsSi)
#lnCsSi=CsSi.div(C0['Si'])
#print(lnCsSi)
#lnCsNi=np.log(primary_y_sort['Ni Elemental Percents'].div(C0['Ni']))
lnCsSi=np.log(primary_y_sort['Si Elemental Percents'].div(data["Si Elemental Percents"].mean()))
lnCsCr=np.log(primary_y_sort['Cr Elemental Percents'].div(data["Cr Elemental Percents"].mean()))
lnCsFe=np.log(primary_y_sort['Fe Elemental Percents'].div(data["Fe Elemental Percents"].mean()))
lnCsNi=np.log(primary_y_sort['Ni Elemental Percents'].div(data["Ni Elemental Percents"].mean()))
lnCsNb=np.log(primary_y_sort['Nb Elemental Percents'].div(data["Nb Elemental Percents"].mean()))
#lnCsMo=np.log(primary_y_sort['Mo Elemental Percents'].div(data["Mo Elemental Percents"].mean()))
lnCsMn=np.log(primary_y_sort['Mn Elemental Percents'].div(data["Mn Elemental Percents"].mean()))
lnFL=np.log(1-primary_y_sort['Fsolid'])
FL=1-primary_y_sort['Fsolid']
FS=primary_y_sort['Fsolid']
#loglog(lnFL,lnCsSi)
plt.plot(lnFL,lnCsNi,label="Ni")
plt.xlabel('Ln(Fraction Liquid)')
plt.ylabel('Ln(Cs/C0)')
plt.title("Concentration of Elements")
plt.show()
def test(F,a,b):
# return math.log(a)+(1-a)*F+b
return (a-1)*np.log(1-F)+(b)
Siparam, Siparam_cov = curve_fit(test, FS, lnCsSi)
Crparam, Crparam_cov = curve_fit(test, FS, lnCsCr)
Feparam, Feparam_cov = curve_fit(test, FS, lnCsFe)
Niparam, Niparam_cov = curve_fit(test, FS, lnCsNi)
Nbparam, Nbparam_cov = curve_fit(test, FS, lnCsNb)
#Moparam, Moparam_cov = curve_fit(test, FS, lnCsMo)
Mnparam, Mnparam_cov = curve_fit(test, FS, lnCsMn)
print("Sine funcion coefficients:")
print(Niparam)
print("Covariance of coefficients:")
print(Niparam_cov)
# ans stores the new y-data according to
# the coefficients given by curve-fit() function
ansCr = test(FS,Crparam[0],Crparam[1])#((Crparam[0]-1)*lnFL+Crparam[1])
ansSi = ((Siparam[0]-1)*lnFL+Siparam[1])
ansNi = ((Niparam[0]-1)*lnFL+Niparam[1])
ansFe = ((Feparam[0]-1)*lnFL+Feparam[1])
ansNb = ((Nbparam[0]-1)*lnFL+Nbparam[1])
#ansMo = ((Moparam[0]-1)*lnFL+Moparam[1])
ansMn = ((Mnparam[0]-1)*lnFL+Mnparam[1])
'''Below 4 lines can be un-commented for plotting results
using matplotlib as shown in the first example. '''
plt.plot(lnFL, lnCsCr, 'o', color ='red', label ="data")
plt.plot(lnFL, ansCr, '--', color ='blue', label ="optimized data")
plt.legend()
plt.title("Cr")
plt.xlabel('Ln(Fraction Solid)')
plt.ylabel('Ln(Cs/C0)')
plt.show()
plt.plot(lnFL, lnCsSi, 'o', color ='red', label ="data")
plt.plot(lnFL, ansSi, '--', color ='blue', label ="optimized data")
plt.legend()
plt.title("Si")
plt.xlabel('Ln(Fraction Solid)')
plt.ylabel('Ln(Cs/C0)')
plt.show()
plt.plot(lnFL, lnCsNi, 'o', color ='red', label ="data")
plt.plot(lnFL, ansNi, '--', color ='blue', label ="optimized data")
plt.legend()
plt.title("Ni")
plt.xlabel('Ln(Fraction Solid)')
plt.ylabel('Ln(Cs/C0)')
plt.show()
plt.plot(lnFL, lnCsNb, 'o', color ='red', label ="data")
plt.plot(lnFL, ansNb, '--', color ='blue', label ="optimized data")
plt.legend()
plt.title("Nb")
plt.xlabel('Ln(Fraction Solid)')
plt.ylabel('Ln(Cs/C0)')
plt.show()
plt.plot(lnFL, lnCsFe, 'o', color ='red', label ="data")
plt.plot(lnFL, ansFe, '--', color ='blue', label ="optimized data")
plt.legend()
plt.title("Fe")
plt.xlabel('Ln(Fraction Solid)')
plt.ylabel('Ln(Cs/C0)')
plt.show()
#define new k values
#K["Si"]=??
KSi_line=Siparam[0] #abs(1-Siparam[0])
print(KSi_line)
KCr_line=Crparam[0] #abs(Crparam[0]-2) #Crparam[0]
print(KCr_line)
KFe_line=Feparam[0] #klineFe=abs(Feparam[0]-2)
print(KFe_line)
KNi_line=Niparam[0] #abs(Niparam[0]-2) #Niparam[0]
print(KNi_line)
KNb_line=Nbparam[0] #abs(Nbparam[0]-2) #Nbparam[0]
print(KNb_line)
#KMo_line=Moparam[0] #abs(Moparam[0]-2) #Moparam[0]
#print(KMo_line)
KMn_line=Mnparam[0] #abs(Mnparam[0]-2) #Mnparam[0]
print(KMn_line)
# %%K fit with linear regression
X=lnFL
X=sm.add_constant(X)
Simodel=sm.OLS(lnCsSi,X).fit()
Simodel.summary()
klSi=1-0.3637
print(klSi)
Crmodel=sm.OLS(lnCsCr,X).fit()
Crmodel.summary()
Nbmodel=sm.OLS(lnCsNb,X).fit()
Nbmodel.summary()
Mnmodel=sm.OLS(lnCsMn,X).fit()
Mnmodel.summary()
Nimodel=sm.OLS(lnCsNi,X).fit()
Nimodel.summary()
Femodel=sm.OLS(lnCsFe,X).fit()
Femodel.summary()
# %% Scheil Calculation
def scheil(k,Cnom,fs):
return k*Cnom*(1-fs)**(k-1)
#from dendrite core k values
NEQ_Si=scheil(KSi,C0Si,f_solid)
NEQ_Cr=scheil(KCr,C0Cr,f_solid)
NEQ_Fe=scheil(KFe,C0Fe,f_solid)
NEQ_Ni=scheil(KNi,C0Ni,f_solid)
NEQ_Mn=scheil(KMn,C0Mn,f_solid)
NEQ_Nb=scheil(KNb,C0Nb,f_solid)
#NEQ_Mo=scheil(KMo,C0Mo,f_solid)
# %% Equlibrium Calculation
def equil(k,Cnom,fs):
return k*Cnom/((1-fs)+k*fs)
EQ_Si=equil(KSi,C0Si,f_solid)
EQ_Cr=equil(KCr,C0Cr,f_solid)
EQ_Fe=equil(KFe,C0Fe,f_solid)
EQ_Ni=equil(KNi,C0Ni,f_solid)
EQ_Mn=equil(KMn,C0Mn,f_solid)
EQ_Nb=equil(KNb,C0Nb,f_solid)
#EQ_Mo=equil(KMo,C0Mo,f_solid)
# %% <NAME> Calculation-work in progress
def BF(k,Cnom,fs,alpha):
return k*Cnom*(1-(1-2*alpha*k)*fs)**((k-1)/(1-2*alpha*k))
# %% Plot solidification path
figure(num=None, figsize=(6, 4), dpi=100, facecolor='w', edgecolor='k')
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Si Elemental Percents'],label="Si", color='blue')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Cr Elemental Percents'],label="Cr", color='green')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Fe Elemental Percents'],label="Fe", color='red')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Ni Elemental Percents'],label="Ni", color='magenta')
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Nb Elemental Percents'],label="Nb", color='cyan')
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mo Elemental Percents'],label="Mo")
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mn Elemental Percents'],label="Mn", color='black')
#plt.plot(primary_y_sort['Fsolid'],NEQ_Si,label="NESi", color='blue')
plt.plot(primary_y_sort['Fsolid'],NEQ_Cr,label="NECr", color='green')
plt.plot(primary_y_sort['Fsolid'],NEQ_Fe,label="NEFe", color='red')
plt.plot(primary_y_sort['Fsolid'],NEQ_Ni,label="NENi", color='magenta')
#plt.plot(primary_y_sort['Fsolid'],NEQ_Nb,label="NENb", color='cyan')
#plt.plot(primary_y_sort['Fsolid'],NEQ_Mo,label="NEMo")
#plt.plot(primary_y_sort['Fsolid'],NEQ_Mn,label="NEMn", color='black')
#plt.plot(primary_y_sort['Fsolid'],EQ_Si,label="ESi", color='blue', linestyle='dashed')
plt.plot(primary_y_sort['Fsolid'],EQ_Cr,label="ECr", color='green', linestyle='dashed')
plt.plot(primary_y_sort['Fsolid'],EQ_Fe,label="EFe", color='red', linestyle='dashed')
plt.plot(primary_y_sort['Fsolid'],EQ_Ni,label="ENi", color='magenta', linestyle='dashed')
#plt.plot(primary_y_sort['Fsolid'],EQ_Nb,label="ENb", color='cyan', linestyle='dashed')
#plt.plot(primary_y_sort['Fsolid'],EQ_Mo,label="EMo")
#plt.plot(primary_y_sort['Fsolid'],EQ_Mn,label="EMn", color='black', linestyle='dashed')
plt.xlabel('Fraction Solid')
plt.ylabel('Concentration (wt.%)')
#plt.title("Solidification Path Solidification")
plt.xlim(0,1.0)
plt.ylim(20,45)
#plt.legend()
#loc='best'
plt.show()
# %% Plot solidification path Major Elements
figure(num=None, figsize=(6, 4), dpi=100, facecolor='w', edgecolor='k')
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Si Elemental Percents'],label="Si", color='blue')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Cr Elemental Percents'],label="Cr", color='green')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Fe Elemental Percents'],label="Fe", color='red')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Ni Elemental Percents'],label="Ni", color='magenta')
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Nb Elemental Percents'],label="Nb", color='cyan')
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mo Elemental Percents'],label="Mo")
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mn Elemental Percents'],label="Mn", color='black')
#plt.plot(primary_y_sort['Fsolid'],NEQ_Si,label="NESi", color='blue')
plt.plot(primary_y_sort['Fsolid'],NEQ_Cr,label="NECr", color='green')
plt.plot(primary_y_sort['Fsolid'],NEQ_Fe,label="NEFe", color='red')
plt.plot(primary_y_sort['Fsolid'],NEQ_Ni,label="NENi", color='magenta')
#plt.plot(primary_y_sort['Fsolid'],NEQ_Nb,label="NENb", color='cyan')
#plt.plot(primary_y_sort['Fsolid'],NEQ_Mo,label="NEMo")
#plt.plot(primary_y_sort['Fsolid'],NEQ_Mn,label="NEMn", color='black')
#plt.plot(primary_y_sort['Fsolid'],EQ_Si,label="ESi", color='blue', linestyle='dashed')
plt.plot(primary_y_sort['Fsolid'],EQ_Cr,label="ECr", color='green', linestyle='dashed')
plt.plot(primary_y_sort['Fsolid'],EQ_Fe,label="EFe", color='red', linestyle='dashed')
plt.plot(primary_y_sort['Fsolid'],EQ_Ni,label="ENi", color='magenta', linestyle='dashed')
#plt.plot(primary_y_sort['Fsolid'],EQ_Nb,label="ENb", color='cyan', linestyle='dashed')
#plt.plot(primary_y_sort['Fsolid'],EQ_Mo,label="EMo")
#plt.plot(primary_y_sort['Fsolid'],EQ_Mn,label="EMn", color='black', linestyle='dashed')
plt.xlabel('Fraction Solid')
plt.ylabel('Concentration (wt.%)')
#plt.title("Solidification Path Solidification")
plt.xlim(0,1.0)
plt.ylim(20,45)
#plt.legend()
#loc='best'
plt.show()
# %% Minor Elements
figure(num=None, figsize=(6, 4), dpi=100, facecolor='w', edgecolor='k')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Si Elemental Percents'],label="Si", color='blue')
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Nb Elemental Percents'],label="Nb", color='cyan')
#plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mo Elemental Percents'],label="Mo")
plt.plot(primary_y_sort['Fsolid'],primary_y_sort['Mn Elemental Percents'],label="Mn", color='black')
plt.plot(primary_y_sort['Fsolid'],NEQ_Si,label="NESi", color='blue')
plt.plot(primary_y_sort['Fsolid'],NEQ_Nb,label="NENb", color='cyan')
#plt.plot(primary_y_sort['Fsolid'],NEQ_Mo,label="NEMo")
plt.plot(primary_y_sort['Fsolid'],NEQ_Mn,label="NEMn", color='black')
plt.plot(primary_y_sort['Fsolid'],EQ_Si,label="ESi", color='blue', linestyle='dashed')
plt.plot(primary_y_sort['Fsolid'],EQ_Nb,label="ENb", color='cyan', linestyle='dashed')
#plt.plot(primary_y_sort['Fsolid'],EQ_Mo,label="EMo")
plt.plot(primary_y_sort['Fsolid'],EQ_Mn,label="EMn", color='black', linestyle='dashed')
plt.xlabel('Fraction Solid')
plt.ylabel('Concentration (wt.%)')
#plt.title("Solidification Path Solidification")
plt.xlim(0,1.0)
#plt.ylim(20,45)
#plt.legend()
#loc='best'
plt.show()
# %% ??????
#print(primary_y_sort['Si Elemental Percents'])
#print(lnCs)
#C=data['C']
#Nb=data['Nb']
#Si=data['Si']
#Ti=data['Ti']
#W=data['W']
#F_Y_MC=data['Fraction Y E1']
#F_MC=data['Fraction MC E1']
#F_Y_M7=data['Fraction Y E2']
#F_M7=data['Fraction M7C3 E2']
#
##print(F_Y_MC)
##print(F_MC)
##print(F_Y_M7)
##print(F_M7)
#
##set x and y
#y=F_MC
#X=Si
#X = sm.add_constant(X) ## let's add an intercept (beta_0) to our model
#
#
## To get statistics of the dataset
## Note the difference in argument order
#model = sm.OLS(y, X).fit()
#predictions = model.predict(X) # make the predictions by the model
#
## Print out the statistics
#model.summary()
# %% Output table?
from prettytable import PrettyTable
x = PrettyTable()
x.field_names = ["City name", "Area", "Population", "Annual Rainfall"]
#['Si', 'Cr', 'Fe', 'Ni', 'Nb', 'Mn']
x.add_row(["Adelaide", 1295, 1158259, 600.5])
x.add_row(["Brisbane", 5905, 1857594, 1146.4])
x.add_row(["Darwin", 112, 120900, 1714.7])
x.add_row(["Hobart", 1357, 205556, 619.5])
x.add_row(["Sydney", 2058, 4336374, 1214.8])
x.add_row(["Melbourne", 1566, 3806092, 646.9])
x.add_row(["Perth", 5386, 1554769, 869.4])
print(x)
# %% Bar Charts
# libraries
import numpy as np
import matplotlib.pyplot as plt
# set width of bar
barWidth = 0.25
# set height of bar
bars1 = [KSi, KCr, KFe, KNi, KNb, KMn]
bars2 = [KSic0, KCrc0, KFec0, KNic0, KNbc0, KMnc0]
bars3 = [KSi_line, KCr_line, KFe_line, KNi_line, KNb_line, KMn_line]
# Set position of bar on X axis
r1 = np.arange(len(bars1))
r2 = [x + barWidth for x in r1]
r3 = [x + barWidth for x in r2]
# Make the plot
plt.bar(r1, bars1, color='#7f6d5f', width=barWidth, edgecolor='white', label='Kmean')
plt.bar(r2, bars2, color='#557f2d', width=barWidth, edgecolor='white', label='KC0')
plt.bar(r3, bars3, color='#2d7f5e', width=barWidth, edgecolor='white', label='K_line')
# Add xticks on the middle of the group bars
plt.xlabel('Element', fontweight='bold')
plt.ylabel('Partition Coefficient (k)', fontweight='bold')
plt.xticks([r + barWidth for r in range(len(bars1))], ['Si', 'Cr', 'Fe', 'Ni', 'Nb', 'Mn'])
plt.axhline(1, color="black")#.plot(["Si","Mn"], [1,1], "k--")
# Create legend & Show graphic
plt.ylim(0,1.2)
plt.legend()
plt.show()
#plt.savefig('M10 DTA K-values.png')
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
30004,
13,
15945,
19451,
13,
20399,
373,
11169,
29639,
29871,
29906,
29955,
29871,
29896,
29945,
29901,
29900,
29946,
29901,
29900,
29929,
29871,
29906,
29900,
29896,
29929,
30004,
13,
30004,
13,
29992,
8921,
29901,
27295,
29954,
30004,
13,
15488,
1529,
20140,
344,
7642,
362,
24352,
30004,
13,
15945,
19451,
13,
30004,
13,
3166,
2071,
19668,
29889,
4299,
29918,
21731,
1053,
7945,
29918,
1688,
29918,
5451,
6756,
13,
3166,
2071,
19668,
29889,
10660,
29918,
4299,
1053,
22985,
4597,
23881,
30004,
13,
3166,
2071,
19668,
1053,
21556,
30004,
13,
5215,
409,
370,
1398,
408,
269,
1983,
30004,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
11701,
408,
10518,
30004,
13,
29937,
11672,
29899,
9202,
580,
740,
19673,
515,
4560,
2272,
6756,
13,
3166,
4560,
2272,
29889,
20640,
675,
1053,
11672,
29918,
9202,
6756,
13,
5215,
22663,
9794,
29889,
2754,
408,
1560,
30004,
13,
3166,
22889,
29889,
2272,
5317,
1053,
4377,
30004,
13,
5215,
5844,
30004,
13,
29937,
17806,
16032,
16502,
1529,
848,
30004,
13,
15945,
29908,
349,
4350,
2514,
3871,
2266,
15945,
19451,
13,
9507,
2433,
29896,
29900,
29918,
29896,
29918,
29896,
29929,
3630,
5160,
399,
4546,
18439,
12708,
716,
977,
1166,
903,
2525,
1678,
29906,
29929,
29871,
360,
3631,
12602,
341,
29896,
29900,
19178,
1482,
341,
29876,
29889,
20267,
29916,
29915,
30004,
13,
29937,
9507,
2433,
29896,
29900,
29918,
29896,
29918,
29896,
29929,
3630,
5160,
399,
4546,
18439,
12708,
716,
977,
1166,
903,
2525,
1678,
29941,
29941,
29871,
360,
3631,
12602,
341,
29896,
29900,
360,
6040,
29889,
20267,
29916,
29915,
30004,
13,
29937,
9507,
2433,
29929,
29918,
29906,
29955,
29918,
29896,
29929,
3630,
5160,
399,
18439,
12708,
29918,
2525,
1678,
29906,
29945,
29871,
341,
29911,
29946,
29896,
29947,
360,
6040,
11657,
29889,
20267,
29916,
29915,
30004,
13,
29937,
9507,
2433,
29929,
29918,
29906,
29946,
29918,
29896,
29929,
3630,
5160,
399,
18439,
12708,
29918,
2525,
1678,
29906,
29900,
259,
29946,
29896,
29947,
360,
6040,
4342,
300,
25525,
10239,
29889,
20267,
29916,
29915,
30004,
13,
29937,
9507,
2433,
29896,
29900,
29918,
29896,
29918,
29896,
29929,
3630,
5160,
399,
4546,
18439,
12708,
716,
977,
1166,
903,
2525,
1678,
29941,
29906,
29871,
379,
29925,
29899,
29906,
360,
6040,
29889,
20267,
29916,
29915,
30004,
13,
1272,
353,
10518,
29889,
949,
29918,
24633,
29898,
9507,
8443,
13,
1272,
29889,
2813,
30004,
13,
29961,
21515,
29892,
29956,
333,
13192,
1272,
29889,
12181,
30004,
13,
1272,
29889,
3888,
30004,
13,
1272,
29889,
2783,
29581,
26471,
13,
30004,
13,
30004,
13,
29937,
17806,
349,
913,
16502,
1529,
848,
30004,
13,
11536,
29922,
1272,
1839,
2642,
284,
19013,
1338,
2033,
30004,
13,
25598,
29922,
1272,
1839,
25598,
10619,
284,
2431,
29883,
1237,
2033,
30004,
13,
20647,
29922,
1272,
3366,
20647,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
8263,
29922,
1272,
3366,
8263,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
29940,
29875,
29922,
1272,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
29956,
29922,
1272,
3366,
29956,
29871,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
29940,
29890,
29922,
1272,
3366,
29940,
29890,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
22638,
29922,
1272,
3366,
22638,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
29924,
29876,
29922,
1272,
3366,
29924,
29876,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
29911,
29875,
29922,
1272,
3366,
29911,
29875,
10619,
284,
2431,
29883,
1237,
3108,
30004,
13,
29937,
1272,
1839,
11536,
2033,
353,
848,
29889,
2083,
29898,
8990,
29922,
29896,
6817,
19244,
30004,
13,
29937,
11536,
29922,
1272,
29889,
2083,
29898,
8990,
29922,
29896,
6817,
19244,
396,
4260,
1338,
278,
15259,
30004,
13,
30004,
13,
29937,
4589,
558,
29879,
30004,
13,
25598,
29918,
261,
29922,
1272,
1839,
25598,
2431,
1760,
4829,
29879,
2033,
30004,
13,
20647,
29918,
261,
29922,
1272,
3366,
20647,
2431,
1760,
4829,
29879,
3108,
30004,
13,
8263,
29918,
261,
29922,
1272,
3366,
8263,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29940,
29875,
29918,
261,
29922,
1272,
3366,
29940,
29875,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29956,
29918,
261,
29922,
1272,
3366,
29956,
29871,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29940,
29890,
29918,
261,
29922,
1272,
3366,
29940,
29890,
2431,
1760,
4829,
29879,
3108,
30004,
13,
22638,
29918,
261,
29922,
1272,
3366,
22638,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29924,
29876,
29918,
261,
29922,
1272,
3366,
29924,
29876,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29911,
29875,
29918,
261,
29922,
1272,
3366,
29911,
29875,
2431,
1760,
4829,
29879,
3108,
30004,
13,
30004,
13,
29937,
17806,
29931,
1691,
679,
18399,
1259,
30004,
13,
29937,
1207,
1014,
26762,
29973,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
25598,
29892,
1643,
543,
25598,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
20647,
29892,
1643,
543,
20647,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
8263,
29892,
8263,
29892,
1643,
543,
8263,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
29940,
29875,
29892,
1643,
543,
29940,
29875,
1159,
30004,
13,
29937,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
29956,
29892,
1643,
543,
29956,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
29940,
29890,
29892,
1643,
543,
29940,
29890,
1159,
30004,
13,
29937,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
22638,
29892,
1643,
543,
22638,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
29956,
29892,
1643,
543,
29924,
29876,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
8263,
29892,
29911,
29875,
29892,
1643,
543,
29911,
29875,
1159,
30004,
13,
29937,
30004,
13,
29937,
30004,
13,
29937,
572,
29873,
29889,
29916,
1643,
877,
27469,
313,
398,
29897,
1495,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
1168,
1760,
29878,
362,
5169,
313,
14554,
29889,
10997,
1495,
30004,
13,
29937,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
1168,
1760,
29878,
362,
313,
14554,
29889,
10997,
1495,
30004,
13,
29937,
30004,
13,
572,
29873,
29889,
3257,
703,
1168,
1760,
29878,
362,
310,
10619,
29879,
1159,
30004,
13,
29937,
30004,
13,
572,
29873,
29889,
26172,
26471,
13,
29937,
572,
29873,
29889,
29916,
2576,
29898,
29941,
29900,
29892,
29941,
29945,
8443,
13,
29937,
572,
29873,
29889,
29891,
2576,
29898,
29900,
29892,
29946,
29900,
8443,
13,
29937,
30004,
13,
572,
29873,
29889,
4294,
26471,
13,
29937,
17806,
29931,
1691,
679,
18399,
1259,
6680,
310,
6781,
30004,
13,
29937,
1207,
1014,
26762,
29973,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
20647,
29892,
25598,
29892,
1643,
543,
25598,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
20647,
29892,
8263,
29892,
1643,
543,
8263,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
8263,
29892,
8263,
29892,
1643,
543,
8263,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
20647,
29892,
29940,
29875,
29892,
1643,
543,
29940,
29875,
1159,
30004,
13,
29937,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
29956,
29892,
1643,
543,
29956,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
20647,
29892,
29940,
29890,
29892,
1643,
543,
29940,
29890,
1159,
30004,
13,
29937,
572,
29873,
29889,
1557,
2620,
29898,
8263,
29892,
22638,
29892,
1643,
543,
22638,
1159,
30004,
13,
572,
29873,
29889,
1557,
2620,
29898,
20647,
29892,
29956,
29892,
1643,
543,
29924,
29876,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
8263,
29892,
29911,
29875,
29892,
1643,
543,
29911,
29875,
1159,
30004,
13,
29937,
30004,
13,
29937,
30004,
13,
29937,
572,
29873,
29889,
29916,
1643,
877,
27469,
313,
398,
29897,
1495,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
1168,
1760,
29878,
362,
6781,
313,
14554,
29889,
10997,
1495,
30004,
13,
29937,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
1168,
1760,
29878,
362,
313,
14554,
29889,
10997,
1495,
30004,
13,
29937,
30004,
13,
572,
29873,
29889,
3257,
703,
1168,
1760,
29878,
362,
310,
10619,
29879,
1159,
30004,
13,
29937,
30004,
13,
572,
29873,
29889,
26172,
26471,
13,
29937,
572,
29873,
29889,
29916,
2576,
29898,
29941,
29900,
29892,
29941,
29945,
8443,
13,
29937,
572,
29873,
29889,
29891,
2576,
29898,
29900,
29892,
29946,
29900,
8443,
13,
29937,
30004,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
30004,
13,
29937,
17806,
3323,
26762,
30004,
13,
30004,
13,
1003,
29892,
4853,
29879,
353,
14770,
29889,
1491,
26762,
29898,
29953,
29892,
6232,
29916,
29922,
5574,
8443,
13,
1003,
29889,
2146,
415,
1740,
877,
1168,
1760,
29878,
362,
281,
29873,
29995,
408,
263,
740,
310,
5169,
1495,
30004,
13,
1165,
29879,
29961,
29900,
1822,
1557,
2620,
29898,
8263,
29892,
25598,
8443,
13,
29937,
1165,
29879,
29961,
29900,
1822,
842,
29918,
3257,
877,
25598,
1495,
30004,
13,
1165,
29879,
29961,
29896,
1822,
1557,
2620,
29898,
8263,
29892,
20647,
8443,
13,
29937,
1165,
29879,
29961,
29896,
1822,
842,
29918,
3257,
877,
20647,
1495,
30004,
13,
1165,
29879,
29961,
29906,
1822,
1557,
2620,
29898,
8263,
29892,
29940,
29875,
8443,
13,
1165,
29879,
29961,
29941,
1822,
1557,
2620,
29898,
8263,
29892,
29940,
29890,
8443,
13,
1165,
29879,
29961,
29946,
1822,
1557,
2620,
29898,
8263,
29892,
22638,
8443,
13,
1165,
29879,
29961,
29945,
1822,
1557,
2620,
29898,
8263,
29892,
29924,
29876,
8443,
13,
29937,
572,
29873,
29889,
26172,
26471,
13,
29937,
572,
29873,
29889,
29916,
2576,
29898,
29941,
29900,
29892,
29941,
29945,
8443,
13,
29937,
572,
29873,
29889,
29891,
2576,
29898,
29900,
29892,
29946,
29900,
8443,
13,
30004,
13,
29937,
17806,
19916,
363,
1704,
29890,
2247,
30004,
13,
7827,
14554,
4287,
29890,
680,
353,
29871,
29929,
29945,
396,
3317,
752,
363,
21166,
363,
1559,
29890,
2247,
30004,
13,
29924,
29955,
29918,
4572,
353,
313,
1272,
1839,
2642,
284,
19013,
1338,
2033,
29966,
7827,
14554,
4287,
29890,
680,
29897,
669,
313,
1272,
3366,
20647,
10619,
284,
2431,
29883,
1237,
3108,
1405,
29871,
29955,
29900,
8443,
13,
29924,
29955,
29918,
2388,
29922,
1272,
29961,
29924,
29955,
29918,
4572,
29962,
30004,
13,
5194,
29955,
29918,
2388,
29922,
29924,
29955,
29918,
2388,
29889,
2029,
7503,
1699,
25598,
10619,
284,
2431,
29883,
1237,
4710,
29963,
29871,
10619,
284,
2431,
29883,
1237,
16862,
12676,
29898,
8990,
29922,
29900,
8443,
13,
2158,
29898,
5194,
29955,
29918,
2388,
8443,
13,
30004,
13,
29937,
29924,
29955,
29918,
2388,
29896,
29922,
29924,
29955,
29918,
2388,
29889,
2029,
1839,
2642,
19013,
1338,
22099,
29963,
10619,
284,
2431,
29883,
1237,
2033,
29937,
29889,
12676,
29898,
8990,
29922,
29896,
8443,
13,
29937,
2158,
29898,
29924,
29955,
29918,
2388,
29896,
8443,
13,
30004,
13,
30004,
13,
12513,
29918,
4572,
353,
313,
1272,
1839,
2642,
284,
19013,
1338,
2033,
29966,
7827,
14554,
4287,
29890,
680,
29897,
669,
313,
1272,
3366,
29940,
29890,
10619,
284,
2431,
29883,
1237,
3108,
1405,
29871,
29947,
29900,
8443,
13,
12513,
29918,
2388,
29922,
1272,
29961,
12513,
29918,
4572,
29962,
30004,
13,
5194,
29907,
29918,
2388,
29922,
12513,
29918,
2388,
29889,
2029,
7503,
1699,
25598,
10619,
284,
2431,
29883,
1237,
4710,
29963,
29871,
10619,
284,
2431,
29883,
1237,
16862,
12676,
29898,
8990,
29922,
29900,
8443,
13,
2158,
29898,
5194,
29907,
29918,
2388,
8443,
13,
30004,
13,
12810,
29887,
29918,
2388,
29922,
1272,
29889,
2029,
7503,
1699,
25598,
10619,
284,
2431,
29883,
1237,
4710,
29963,
29871,
10619,
284,
2431,
29883,
1237,
16862,
12676,
29898,
8990,
29922,
29900,
8443,
13,
2158,
29898,
12810,
29887,
29918,
2388,
8443,
13,
29937,
17806,
399,
8193,
29903,
30004,
13,
29937,
4572,
8783,
304,
3349,
1006,
29881,
355,
768,
293,
12786,
30004,
13,
7827,
14554,
677,
29922,
29929,
29955,
396,
386,
12268,
363,
21166,
1006,
29881,
355,
768,
293,
12786,
1122,
817,
304,
367,
7780,
12535,
30004,
13,
7827,
29893,
386,
1141,
29922,
29896,
29900,
29941,
30004,
13,
7283,
3317,
29922,
29906,
29953,
30004,
13,
9877,
3317,
29922,
29896,
30004,
13,
29876,
8332,
29922,
29941,
29900,
30004,
13,
16135,
1165,
29922,
29941,
29953,
29889,
29945,
30004,
13,
30004,
13,
15945,
29908,
910,
995,
674,
9949,
278,
413,
1220,
15945,
19451,
13,
3317,
5847,
29922,
29896,
29937,
29900,
29889,
29929,
29953,
29937,
29900,
29889,
29947,
29929,
29929,
29937,
29947,
29906,
29889,
29896,
29929,
29946,
29947,
29945,
29945,
29896,
29945,
29914,
29896,
29900,
29900,
379,
29925,
29899,
29906,
396,
29900,
29889,
29929,
29953,
363,
341,
29896,
29900,
396,
29900,
29889,
29947,
29929,
29929,
363,
379,
29925,
30004,
13,
30004,
13,
30004,
13,
3317,
29918,
4572,
353,
313,
1272,
1839,
2642,
284,
19013,
1338,
2033,
29958,
7827,
14554,
677,
29897,
669,
313,
1272,
3366,
20647,
10619,
284,
2431,
29883,
1237,
3108,
529,
2181,
3317,
29897,
669,
313,
1272,
3366,
29940,
29890,
10619,
284,
2431,
29883,
1237,
3108,
529,
302,
29890,
3317,
29897,
669,
313,
1272,
1839,
2642,
284,
19013,
1338,
2033,
29966,
7827,
29893,
386,
1141,
29897,
669,
313,
1272,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
3108,
1405,
302,
8332,
29897,
669,
313,
1272,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
3108,
529,
21930,
1165,
8443,
13,
16072,
29918,
29891,
29922,
1272,
29937,
29961,
3317,
29918,
4572,
29962,
30004,
13,
29937,
2158,
29898,
16072,
29918,
29891,
8443,
13,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
1839,
18278,
20279,
12628,
7464,
16072,
29918,
29891,
1839,
3986,
376,
25598,
10619,
284,
2431,
29883,
1237,
29908,
7464,
1643,
543,
25598,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
1839,
18278,
20279,
12628,
7464,
16072,
29918,
29891,
3366,
20647,
10619,
284,
2431,
29883,
1237,
12436,
1643,
543,
20647,
1159,
30004,
13,
29937,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
29937,
1454,
3480,
6703,
2377,
1727,
1218,
3161,
30004,
13,
16072,
29918,
29891,
1839,
25598,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
1839,
25598,
10619,
284,
2431,
29883,
1237,
2033,
448,
7601,
29918,
29891,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
1195,
3101,
29914,
16072,
29918,
29891,
1839,
25598,
2431,
1760,
4829,
29879,
2033,
30004,
13,
16072,
29918,
29891,
1839,
20647,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
3366,
20647,
10619,
284,
2431,
29883,
1237,
3108,
448,
7601,
29918,
29891,
3366,
20647,
10619,
284,
2431,
29883,
1237,
16862,
1195,
3101,
29914,
16072,
29918,
29891,
3366,
20647,
2431,
1760,
4829,
29879,
3108,
30004,
13,
16072,
29918,
29891,
1839,
29940,
29875,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
3108,
448,
7601,
29918,
29891,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
16862,
1195,
3101,
29914,
16072,
29918,
29891,
3366,
29940,
29875,
2431,
1760,
4829,
29879,
3108,
396,
361,
15981,
3480,
6703,
2377,
1727,
1078,
30004,
13,
16072,
29918,
29891,
1839,
29940,
29890,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
3366,
29940,
29890,
10619,
284,
2431,
29883,
1237,
3108,
448,
7601,
29918,
29891,
3366,
29940,
29890,
10619,
284,
2431,
29883,
1237,
16862,
1195,
3101,
29914,
16072,
29918,
29891,
3366,
29940,
29890,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29937,
16072,
29918,
29891,
1839,
22638,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
3366,
22638,
10619,
284,
2431,
29883,
1237,
3108,
448,
7601,
29918,
29891,
3366,
22638,
10619,
284,
2431,
29883,
1237,
16862,
1195,
3101,
29914,
16072,
29918,
29891,
3366,
22638,
2431,
1760,
4829,
29879,
3108,
30004,
13,
16072,
29918,
29891,
1839,
29924,
29876,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
3366,
29924,
29876,
10619,
284,
2431,
29883,
1237,
3108,
448,
7601,
29918,
29891,
3366,
29924,
29876,
10619,
284,
2431,
29883,
1237,
16862,
1195,
3101,
29914,
16072,
29918,
29891,
3366,
29924,
29876,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29937,
29956,
29918,
1646,
7607,
16072,
29918,
29891,
3366,
29956,
29871,
10619,
284,
2431,
29883,
1237,
3108,
448,
7601,
29918,
29891,
3366,
29956,
29871,
10619,
284,
2431,
29883,
1237,
16862,
1195,
3101,
29914,
16072,
29918,
29891,
3366,
29956,
29871,
2431,
1760,
4829,
29879,
3108,
30004,
13,
30004,
13,
30004,
13,
29937,
1454,
13686,
3598,
2377,
1727,
1218,
3161,
30004,
13,
16072,
29918,
29891,
1839,
8263,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
3366,
8263,
10619,
284,
2431,
29883,
1237,
16862,
3317,
580,
448,
7601,
29918,
29891,
3366,
8263,
10619,
284,
2431,
29883,
1237,
20068,
29914,
16072,
29918,
29891,
3366,
8263,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29937,
16072,
29918,
29891,
1839,
29940,
29875,
29918,
1646,
2033,
7607,
16072,
29918,
29891,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
16862,
3317,
580,
448,
7601,
29918,
29891,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
20068,
29914,
16072,
29918,
29891,
3366,
29940,
29875,
2431,
1760,
4829,
29879,
3108,
30004,
13,
29937,
29911,
29875,
29918,
1646,
7607,
16072,
29918,
29891,
3366,
29911,
29875,
10619,
284,
2431,
29883,
1237,
16862,
3317,
580,
448,
7601,
29918,
29891,
3366,
29911,
29875,
10619,
284,
2431,
29883,
1237,
20068,
29914,
16072,
29918,
29891,
3366,
29911,
29875,
2431,
1760,
4829,
29879,
3108,
30004,
13,
30004,
13,
29937,
29909,
26127,
403,
2630,
1041,
964,
263,
716,
12205,
30004,
13,
29937,
29907,
1646,
29922,
15926,
29889,
17271,
29898,
1272,
11759,
25598,
29918,
1646,
29892,
20647,
29918,
1646,
29892,
8263,
29918,
1646,
29892,
29940,
29875,
29918,
1646,
29892,
29956,
29918,
1646,
29892,
29940,
29890,
29918,
1646,
29892,
22638,
29918,
1646,
29892,
29911,
29875,
29918,
1646,
14664,
29911,
30004,
13,
29937,
29907,
1646,
29889,
13099,
29922,
1839,
29903,
747,
279,
742,
525,
20647,
1646,
742,
525,
29943,
774,
279,
742,
525,
29940,
747,
279,
742,
525,
29956,
1646,
742,
525,
29940,
1327,
279,
742,
525,
29924,
22872,
742,
525,
29911,
747,
279,
2033,
30004,
13,
29937,
29907,
1646,
29922,
15926,
29889,
17271,
29898,
1272,
11759,
25598,
29918,
1646,
29892,
20647,
29918,
1646,
29892,
8263,
29918,
1646,
29892,
29940,
29875,
29918,
1646,
29892,
29940,
29890,
29918,
1646,
29892,
22638,
29918,
1646,
14664,
29911,
30004,
13,
29937,
29907,
1646,
29889,
13099,
29922,
1839,
29903,
747,
279,
742,
525,
20647,
1646,
742,
525,
29943,
774,
279,
742,
525,
29940,
747,
279,
742,
525,
29940,
1327,
279,
742,
525,
29924,
22872,
2033,
30004,
13,
29937,
16072,
29918,
29891,
1839,
12810,
29887,
1646,
2033,
353,
7601,
29918,
29891,
29961,
1839,
25598,
29918,
1646,
742,
525,
20647,
29918,
1646,
742,
525,
8263,
29918,
1646,
742,
525,
29940,
29875,
29918,
1646,
742,
525,
29940,
29890,
29918,
1646,
742,
525,
22638,
29918,
1646,
742,
525,
29924,
29876,
29918,
1646,
2033,
1822,
12676,
29898,
8990,
29922,
29896,
8443,
13,
16072,
29918,
29891,
1839,
12810,
29887,
1646,
2033,
353,
7601,
29918,
29891,
29961,
1839,
25598,
29918,
1646,
742,
525,
20647,
29918,
1646,
742,
525,
8263,
29918,
1646,
742,
525,
29940,
29875,
29918,
1646,
742,
525,
29940,
29890,
29918,
1646,
742,
525,
29924,
29876,
29918,
1646,
2033,
1822,
12676,
29898,
8990,
29922,
29896,
8443,
13,
29937,
2158,
29898,
16072,
29918,
29891,
8443,
13,
30004,
13,
29937,
6605,
5034,
304,
315,
1646,
1375,
304,
4236,
30004,
13,
16072,
29918,
29891,
29918,
6605,
29922,
16072,
29918,
29891,
29889,
6605,
29918,
5975,
29898,
1609,
29922,
1839,
12810,
29887,
1646,
2033,
8443,
13,
29937,
2158,
29898,
16072,
29918,
29891,
29918,
6605,
8443,
13,
16072,
29918,
29891,
29918,
6605,
1839,
29934,
804,
2033,
353,
7601,
29918,
29891,
29918,
6605,
1839,
12810,
29887,
1646,
13359,
10003,
29898,
6151,
2548,
353,
29871,
29896,
8443,
13,
29937,
2158,
29898,
16072,
29918,
29891,
29918,
6605,
8443,
13,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
2033,
7607,
16072,
29918,
29891,
29918,
6605,
1839,
29934,
804,
2033,
448,
29871,
29900,
29889,
29945,
6802,
16072,
29918,
29891,
29918,
6605,
1839,
29934,
804,
13359,
3317,
580,
29930,
3317,
5847,
30004,
13,
29937,
2158,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
2033,
8443,
13,
29888,
29918,
2929,
333,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
2033,
30004,
13,
30004,
13,
29937,
17806,
29931,
1691,
679,
18399,
1259,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
25598,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
20647,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
20647,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
8263,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
8263,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29875,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29940,
29875,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29890,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29940,
29890,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
22638,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
22638,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29924,
29876,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29924,
29876,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
29907,
6605,
1839,
29943,
2929,
333,
7464,
29907,
6605,
1839,
8263,
7464,
1643,
543,
8263,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
29907,
6605,
1839,
29943,
2929,
333,
7464,
29907,
6605,
1839,
29940,
29875,
7464,
1643,
543,
29940,
29875,
1159,
30004,
13,
2277,
572,
29873,
29889,
5317,
29898,
29907,
6605,
1839,
29943,
2929,
333,
7464,
29907,
6605,
1839,
29956,
7464,
1643,
543,
29956,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
29907,
6605,
1839,
29943,
2929,
333,
7464,
29907,
6605,
1839,
29940,
29890,
7464,
1643,
543,
29940,
29890,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
29907,
6605,
1839,
29943,
2929,
333,
7464,
29907,
6605,
1839,
22638,
7464,
1643,
543,
22638,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
29907,
6605,
1839,
29943,
2929,
333,
7464,
29907,
6605,
1839,
29911,
29875,
7464,
1643,
543,
29911,
29875,
1159,
30004,
13,
30004,
13,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29943,
13857,
4956,
333,
1495,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
1168,
1760,
29878,
362,
313,
14554,
29889,
10997,
1495,
30004,
13,
572,
29873,
29889,
3257,
703,
1168,
1760,
29878,
362,
310,
10619,
29879,
1159,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
26172,
26471,
13,
29937,
2029,
2433,
13318,
29915,
30004,
13,
30004,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
29937,
17806,
20535,
403,
413,
515,
10239,
30004,
13,
29937,
29940,
290,
979,
422,
3283,
30004,
13,
29907,
29900,
3790,
29915,
25598,
2396,
29896,
29889,
29929,
29906,
29929,
5501,
20647,
2396,
29906,
29946,
29889,
29945,
29955,
29896,
5501,
8263,
2396,
29941,
29955,
29889,
29953,
29929,
29945,
5501,
29940,
29875,
2396,
29941,
29941,
29889,
29906,
29900,
29953,
5501,
29940,
29890,
2396,
29896,
29889,
29906,
29947,
5501,
29924,
29876,
2396,
29900,
29889,
29947,
29941,
29955,
5501,
22638,
2396,
29900,
29889,
29900,
29955,
29913,
396,
29924,
29896,
29900,
30004,
13,
29937,
29907,
29900,
3790,
29915,
25598,
2396,
29896,
29889,
29896,
29946,
5501,
20647,
2396,
29906,
29945,
29889,
29906,
5501,
8263,
2396,
29941,
29953,
29889,
29953,
29953,
5501,
29940,
29875,
2396,
29941,
29945,
5501,
29940,
29890,
2396,
29900,
29889,
29946,
29896,
29947,
5501,
29924,
29876,
2396,
29900,
29889,
29947,
29929,
29929,
5501,
22638,
2396,
29900,
29889,
29900,
29953,
29913,
396,
3954,
29899,
29906,
30004,
13,
29937,
29907,
29900,
3790,
29915,
25598,
2396,
29896,
29889,
29929,
29906,
29929,
5501,
20647,
2396,
29906,
29946,
29889,
29945,
29955,
29896,
5501,
8263,
2396,
29941,
29955,
29889,
29953,
29929,
29945,
5501,
29940,
29875,
2396,
29941,
29941,
29889,
29906,
29900,
29953,
5501,
29940,
29890,
2396,
29896,
29889,
29906,
29947,
5501,
29924,
29876,
2396,
29900,
29889,
29947,
29941,
29955,
5501,
22638,
2396,
29900,
29889,
29900,
29955,
8117,
13,
30004,
13,
562,
487,
29922,
29896,
29900,
396,
9748,
304,
6588,
515,
1369,
310,
12705,
848,
30004,
13,
30004,
13,
29937,
26746,
315,
29900,
21875,
515,
6856,
30004,
13,
29907,
29900,
25598,
29922,
1272,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
12676,
26471,
13,
29907,
29900,
20647,
29922,
1272,
3366,
20647,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29907,
29900,
8263,
29922,
1272,
3366,
8263,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29907,
29900,
29940,
29875,
29922,
16072,
29918,
29891,
29918,
6605,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29907,
29900,
29956,
29922,
1272,
3366,
29956,
29871,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29907,
29900,
29940,
29890,
29922,
1272,
3366,
29940,
29890,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29937,
29907,
29900,
22638,
29922,
1272,
3366,
22638,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29907,
29900,
29924,
29876,
29922,
1272,
3366,
29924,
29876,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29907,
29900,
29911,
29875,
29922,
1272,
3366,
29911,
29875,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
30004,
13,
29937,
29909,
19698,
310,
278,
937,
29871,
29953,
3291,
304,
7773,
1598,
304,
278,
3001,
6588,
15259,
30004,
13,
17557,
29875,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
25598,
30004,
13,
29937,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
29945,
1822,
12676,
29898,
8990,
29922,
29900,
8443,
13,
2158,
29898,
17557,
29875,
8443,
13,
17557,
293,
29900,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
1839,
25598,
2033,
30004,
13,
29937,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
29945,
1822,
12676,
29898,
8990,
29922,
29900,
8443,
13,
2158,
29898,
17557,
293,
29900,
8443,
13,
30004,
13,
29968,
20647,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
20647,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
20647,
30004,
13,
2158,
29898,
29968,
20647,
8443,
13,
29968,
29907,
2214,
29900,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
20647,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
1839,
20647,
2033,
30004,
13,
2158,
29898,
29968,
29907,
2214,
29900,
8443,
13,
30004,
13,
29968,
8263,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
8263,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
8263,
30004,
13,
2158,
29898,
29968,
8263,
8443,
13,
29968,
29943,
687,
29900,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
8263,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
1839,
8263,
2033,
30004,
13,
2158,
29898,
29968,
29943,
687,
29900,
8443,
13,
30004,
13,
29968,
29940,
29875,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29875,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
29940,
29875,
30004,
13,
2158,
29898,
29968,
29940,
29875,
8443,
13,
29968,
29940,
293,
29900,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29875,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
1839,
29940,
29875,
2033,
30004,
13,
2158,
29898,
29968,
29940,
293,
29900,
8443,
13,
30004,
13,
30004,
13,
29937,
29968,
29956,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29956,
29871,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
29945,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
848,
3366,
29956,
29871,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
29968,
29940,
29890,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29890,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
29940,
29890,
30004,
13,
2158,
29898,
29968,
29940,
29890,
8443,
13,
29968,
29940,
12328,
29900,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29890,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
1839,
29940,
29890,
2033,
30004,
13,
2158,
29898,
29968,
29940,
12328,
29900,
8443,
13,
30004,
13,
29937,
29968,
22638,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
22638,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
22638,
30004,
13,
29937,
2158,
29898,
29968,
22638,
8443,
13,
29937,
29968,
29924,
542,
29900,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
22638,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
1839,
22638,
2033,
30004,
13,
29937,
2158,
29898,
29968,
29924,
542,
29900,
8443,
13,
30004,
13,
29968,
29924,
29876,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29924,
29876,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
29924,
29876,
30004,
13,
2158,
29898,
29968,
29924,
29876,
8443,
13,
29968,
29924,
17608,
29900,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29924,
29876,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
562,
487,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
315,
29900,
1839,
29924,
29876,
2033,
30004,
13,
2158,
29898,
29968,
29924,
17608,
29900,
8443,
13,
30004,
13,
29937,
29968,
29911,
29875,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29911,
29875,
10619,
284,
2431,
29883,
1237,
13359,
309,
542,
29961,
29900,
29901,
29945,
1822,
12676,
29898,
8990,
29922,
29900,
29897,
847,
848,
3366,
29911,
29875,
10619,
284,
2431,
29883,
1237,
16862,
12676,
26471,
13,
30004,
13,
29937,
17806,
3037,
29883,
515,
10837,
345,
30004,
13,
30004,
13,
29937,
29907,
29879,
25598,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
29907,
29900,
1839,
25598,
2033,
8443,
13,
29937,
2158,
29898,
29907,
29879,
25598,
8443,
13,
29937,
3083,
29907,
29879,
25598,
29922,
29907,
29879,
25598,
29889,
4563,
29898,
29907,
29900,
1839,
25598,
2033,
8443,
13,
29937,
2158,
29898,
3083,
29907,
29879,
25598,
8443,
13,
30004,
13,
29937,
3083,
29907,
29879,
29940,
29875,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29875,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
29907,
29900,
1839,
29940,
29875,
25901,
30004,
13,
3083,
29907,
29879,
25598,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
1272,
3366,
25598,
10619,
284,
2431,
29883,
1237,
16862,
12676,
22130,
30004,
13,
3083,
29907,
29879,
20647,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
20647,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
1272,
3366,
20647,
10619,
284,
2431,
29883,
1237,
16862,
12676,
22130,
30004,
13,
3083,
29907,
29879,
8263,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
8263,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
1272,
3366,
8263,
10619,
284,
2431,
29883,
1237,
16862,
12676,
22130,
30004,
13,
3083,
29907,
29879,
29940,
29875,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29875,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
1272,
3366,
29940,
29875,
10619,
284,
2431,
29883,
1237,
16862,
12676,
22130,
30004,
13,
3083,
29907,
29879,
29940,
29890,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29890,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
1272,
3366,
29940,
29890,
10619,
284,
2431,
29883,
1237,
16862,
12676,
22130,
30004,
13,
29937,
3083,
29907,
29879,
22638,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
22638,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
1272,
3366,
22638,
10619,
284,
2431,
29883,
1237,
16862,
12676,
22130,
30004,
13,
3083,
29907,
29879,
29924,
29876,
29922,
9302,
29889,
1188,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29924,
29876,
10619,
284,
2431,
29883,
1237,
13359,
4563,
29898,
1272,
3366,
29924,
29876,
10619,
284,
2431,
29883,
1237,
16862,
12676,
22130,
30004,
13,
30004,
13,
3083,
10536,
29922,
9302,
29889,
1188,
29898,
29896,
29899,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
2033,
8443,
13,
10536,
29922,
29896,
29899,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
2033,
30004,
13,
9998,
29922,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
2033,
30004,
13,
30004,
13,
29937,
1188,
1188,
29898,
3083,
10536,
29892,
3083,
29907,
29879,
25598,
8443,
13,
30004,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
3083,
29907,
29879,
29940,
29875,
29892,
1643,
543,
29940,
29875,
1159,
30004,
13,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29931,
29876,
29898,
29943,
13857,
2718,
339,
333,
29897,
1495,
30004,
13,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
29931,
29876,
29898,
29907,
29879,
29914,
29907,
29900,
29897,
1495,
30004,
13,
30004,
13,
572,
29873,
29889,
3257,
703,
1168,
1760,
29878,
362,
310,
10619,
29879,
1159,
30004,
13,
30004,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
1753,
1243,
29898,
29943,
29892,
29874,
29892,
29890,
1125,
6756,
13,
29937,
1678,
736,
5844,
29889,
1188,
29898,
29874,
7240,
29898,
29896,
29899,
29874,
11877,
29943,
29974,
29890,
30004,
13,
1678,
736,
313,
29874,
29899,
29896,
11877,
9302,
29889,
1188,
29898,
29896,
29899,
29943,
7240,
29898,
29890,
8443,
13,
29903,
666,
11269,
29892,
317,
666,
11269,
29918,
24542,
353,
11672,
29918,
9202,
29898,
1688,
29892,
383,
29903,
29892,
301,
29876,
29907,
29879,
25598,
29897,
6756,
13,
20647,
3207,
29892,
6781,
3207,
29918,
24542,
353,
11672,
29918,
9202,
29898,
1688,
29892,
383,
29903,
29892,
301,
29876,
29907,
29879,
20647,
29897,
6756,
13,
8263,
3207,
29892,
5169,
3207,
29918,
24542,
353,
11672,
29918,
9202,
29898,
1688,
29892,
383,
29903,
29892,
301,
29876,
29907,
29879,
8263,
29897,
6756,
13,
29940,
666,
11269,
29892,
405,
666,
11269,
29918,
24542,
353,
11672,
29918,
9202,
29898,
1688,
29892,
383,
29903,
29892,
301,
29876,
29907,
29879,
29940,
29875,
29897,
6756,
13,
29940,
29890,
3207,
29892,
405,
29890,
3207,
29918,
24542,
353,
11672,
29918,
9202,
29898,
1688,
29892,
383,
29903,
29892,
301,
29876,
29907,
29879,
29940,
29890,
29897,
6756,
13,
29937,
29924,
459,
11269,
29892,
341,
459,
11269,
29918,
24542,
353,
11672,
29918,
9202,
29898,
1688,
29892,
383,
29903,
29892,
301,
29876,
29907,
29879,
22638,
29897,
6756,
13,
29924,
29876,
3207,
29892,
341,
29876,
3207,
29918,
24542,
353,
11672,
29918,
9202,
29898,
1688,
29892,
383,
29903,
29892,
301,
29876,
29907,
29879,
29924,
29876,
29897,
259,
6756,
13,
30004,
13,
29871,
6756,
13,
2158,
703,
29903,
457,
21802,
16127,
29901,
1159,
6756,
13,
2158,
29898,
29940,
666,
11269,
29897,
6756,
13,
2158,
703,
29907,
586,
279,
8837,
310,
16127,
29901,
1159,
6756,
13,
2158,
29898,
29940,
666,
11269,
29918,
24542,
29897,
6756,
13,
30004,
13,
29937,
6063,
14422,
278,
716,
343,
29899,
1272,
5034,
304,
29871,
6756,
13,
29937,
278,
16127,
2183,
491,
11672,
29899,
9202,
580,
740,
6756,
13,
550,
20647,
353,
1243,
29898,
9998,
29892,
20647,
3207,
29961,
29900,
1402,
20647,
3207,
29961,
29896,
2314,
29937,
3552,
20647,
3207,
29961,
29900,
29962,
29899,
29896,
11877,
3083,
10536,
29974,
20647,
3207,
29961,
29896,
2314,
6756,
13,
550,
25598,
353,
5135,
29903,
666,
11269,
29961,
29900,
29962,
29899,
29896,
11877,
3083,
10536,
29974,
29903,
666,
11269,
29961,
29896,
2314,
30004,
13,
550,
29940,
29875,
353,
5135,
29940,
666,
11269,
29961,
29900,
29962,
29899,
29896,
11877,
3083,
10536,
29974,
29940,
666,
11269,
29961,
29896,
2314,
6756,
13,
550,
8263,
353,
5135,
8263,
3207,
29961,
29900,
29962,
29899,
29896,
11877,
3083,
10536,
29974,
8263,
3207,
29961,
29896,
2314,
6756,
13,
550,
29940,
29890,
353,
5135,
29940,
29890,
3207,
29961,
29900,
29962,
29899,
29896,
11877,
3083,
10536,
29974,
29940,
29890,
3207,
29961,
29896,
2314,
30004,
13,
29937,
550,
22638,
353,
5135,
29924,
459,
11269,
29961,
29900,
29962,
29899,
29896,
11877,
3083,
10536,
29974,
29924,
459,
11269,
29961,
29896,
2314,
6756,
13,
550,
29924,
29876,
353,
5135,
29924,
29876,
3207,
29961,
29900,
29962,
29899,
29896,
11877,
3083,
10536,
29974,
29924,
29876,
3207,
29961,
29896,
2314,
259,
6756,
13,
12008,
21140,
340,
29871,
29946,
3454,
508,
367,
443,
29899,
9342,
287,
363,
6492,
1259,
2582,
29871,
6756,
13,
4746,
22889,
408,
4318,
297,
278,
937,
1342,
29889,
14550,
30004,
13,
29871,
6756,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
301,
29876,
29907,
29879,
20647,
29892,
525,
29877,
742,
2927,
353,
29915,
1127,
742,
3858,
29465,
1272,
1159,
6756,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
6063,
20647,
29892,
525,
489,
742,
2927,
353,
29915,
9539,
742,
3858,
29465,
20640,
1891,
848,
1159,
6756,
13,
572,
29873,
29889,
26172,
26471,
13,
572,
29873,
29889,
3257,
703,
20647,
1159,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29931,
29876,
29898,
29943,
13857,
4956,
333,
29897,
1495,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
29931,
29876,
29898,
29907,
29879,
29914,
29907,
29900,
29897,
1495,
6756,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
301,
29876,
29907,
29879,
25598,
29892,
525,
29877,
742,
2927,
353,
29915,
1127,
742,
3858,
29465,
1272,
1159,
6756,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
6063,
25598,
29892,
525,
489,
742,
2927,
353,
29915,
9539,
742,
3858,
29465,
20640,
1891,
848,
1159,
6756,
13,
572,
29873,
29889,
26172,
580,
6756,
13,
572,
29873,
29889,
3257,
703,
25598,
1159,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29931,
29876,
29898,
29943,
13857,
4956,
333,
29897,
1495,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
29931,
29876,
29898,
29907,
29879,
29914,
29907,
29900,
29897,
1495,
6756,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
301,
29876,
29907,
29879,
29940,
29875,
29892,
525,
29877,
742,
2927,
353,
29915,
1127,
742,
3858,
29465,
1272,
1159,
6756,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
6063,
29940,
29875,
29892,
525,
489,
742,
2927,
353,
29915,
9539,
742,
3858,
29465,
20640,
1891,
848,
1159,
6756,
13,
572,
29873,
29889,
26172,
580,
6756,
13,
572,
29873,
29889,
3257,
703,
29940,
29875,
1159,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29931,
29876,
29898,
29943,
13857,
4956,
333,
29897,
1495,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
29931,
29876,
29898,
29907,
29879,
29914,
29907,
29900,
29897,
1495,
6756,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
301,
29876,
29907,
29879,
29940,
29890,
29892,
525,
29877,
742,
2927,
353,
29915,
1127,
742,
3858,
29465,
1272,
1159,
6756,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
6063,
29940,
29890,
29892,
525,
489,
742,
2927,
353,
29915,
9539,
742,
3858,
29465,
20640,
1891,
848,
1159,
6756,
13,
572,
29873,
29889,
26172,
580,
6756,
13,
572,
29873,
29889,
3257,
703,
29940,
29890,
1159,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29931,
29876,
29898,
29943,
13857,
4956,
333,
29897,
1495,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
29931,
29876,
29898,
29907,
29879,
29914,
29907,
29900,
29897,
1495,
6756,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
301,
29876,
29907,
29879,
8263,
29892,
525,
29877,
742,
2927,
353,
29915,
1127,
742,
3858,
29465,
1272,
1159,
6756,
13,
572,
29873,
29889,
5317,
29898,
3083,
10536,
29892,
6063,
8263,
29892,
525,
489,
742,
2927,
353,
29915,
9539,
742,
3858,
29465,
20640,
1891,
848,
1159,
6756,
13,
572,
29873,
29889,
26172,
580,
6756,
13,
572,
29873,
29889,
3257,
703,
8263,
1159,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29931,
29876,
29898,
29943,
13857,
4956,
333,
29897,
1495,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
29931,
29876,
29898,
29907,
29879,
29914,
29907,
29900,
29897,
1495,
6756,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
29937,
7922,
716,
413,
1819,
30004,
13,
29937,
29968,
3366,
25598,
3108,
29922,
8773,
30004,
13,
17557,
29875,
29918,
1220,
29922,
29903,
666,
11269,
29961,
29900,
29962,
396,
6897,
29898,
29896,
29899,
29903,
666,
11269,
29961,
29900,
2314,
30004,
13,
2158,
29898,
17557,
29875,
29918,
1220,
8443,
13,
29968,
20647,
29918,
1220,
29922,
20647,
3207,
29961,
29900,
29962,
396,
6897,
29898,
20647,
3207,
29961,
29900,
29962,
29899,
29906,
29897,
396,
20647,
3207,
29961,
29900,
29962,
30004,
13,
2158,
29898,
29968,
20647,
29918,
1220,
8443,
13,
29968,
8263,
29918,
1220,
29922,
8263,
3207,
29961,
29900,
29962,
396,
29895,
1220,
8263,
29922,
6897,
29898,
8263,
3207,
29961,
29900,
29962,
29899,
29906,
8443,
13,
2158,
29898,
29968,
8263,
29918,
1220,
29897,
6756,
13,
29968,
29940,
29875,
29918,
1220,
29922,
29940,
666,
11269,
29961,
29900,
29962,
396,
6897,
29898,
29940,
666,
11269,
29961,
29900,
29962,
29899,
29906,
29897,
396,
29940,
666,
11269,
29961,
29900,
29962,
30004,
13,
2158,
29898,
29968,
29940,
29875,
29918,
1220,
8443,
13,
29968,
29940,
29890,
29918,
1220,
29922,
29940,
29890,
3207,
29961,
29900,
29962,
396,
6897,
29898,
29940,
29890,
3207,
29961,
29900,
29962,
29899,
29906,
29897,
396,
29940,
29890,
3207,
29961,
29900,
29962,
30004,
13,
2158,
29898,
29968,
29940,
29890,
29918,
1220,
8443,
13,
29937,
29968,
22638,
29918,
1220,
29922,
29924,
459,
11269,
29961,
29900,
29962,
396,
6897,
29898,
29924,
459,
11269,
29961,
29900,
29962,
29899,
29906,
29897,
396,
29924,
459,
11269,
29961,
29900,
29962,
30004,
13,
29937,
2158,
29898,
29968,
22638,
29918,
1220,
8443,
13,
29968,
29924,
29876,
29918,
1220,
29922,
29924,
29876,
3207,
29961,
29900,
29962,
396,
6897,
29898,
29924,
29876,
3207,
29961,
29900,
29962,
29899,
29906,
29897,
396,
29924,
29876,
3207,
29961,
29900,
29962,
30004,
13,
2158,
29898,
29968,
29924,
29876,
29918,
1220,
8443,
13,
29937,
17806,
29968,
6216,
411,
5608,
17855,
30004,
13,
29990,
29922,
3083,
10536,
30004,
13,
29990,
29922,
3844,
29889,
1202,
29918,
23362,
29898,
29990,
8443,
13,
8942,
27224,
29922,
3844,
29889,
5607,
29903,
29898,
3083,
29907,
29879,
25598,
29892,
29990,
467,
9202,
26471,
13,
8942,
27224,
29889,
7727,
26471,
13,
6321,
25598,
29922,
29896,
29899,
29900,
29889,
29941,
29953,
29941,
29955,
30004,
13,
2158,
29898,
6321,
25598,
8443,
13,
20647,
4299,
29922,
3844,
29889,
5607,
29903,
29898,
3083,
29907,
29879,
20647,
29892,
29990,
467,
9202,
26471,
13,
20647,
4299,
29889,
7727,
26471,
13,
29940,
29890,
4299,
29922,
3844,
29889,
5607,
29903,
29898,
3083,
29907,
29879,
29940,
29890,
29892,
29990,
467,
9202,
26471,
13,
29940,
29890,
4299,
29889,
7727,
26471,
13,
29924,
29876,
4299,
29922,
3844,
29889,
5607,
29903,
29898,
3083,
29907,
29879,
29924,
29876,
29892,
29990,
467,
9202,
26471,
13,
29924,
29876,
4299,
29889,
7727,
26471,
13,
29940,
326,
27224,
29922,
3844,
29889,
5607,
29903,
29898,
3083,
29907,
29879,
29940,
29875,
29892,
29990,
467,
9202,
26471,
13,
29940,
326,
27224,
29889,
7727,
26471,
13,
29943,
331,
27224,
29922,
3844,
29889,
5607,
29903,
29898,
3083,
29907,
29879,
8263,
29892,
29990,
467,
9202,
26471,
13,
29943,
331,
27224,
29889,
7727,
26471,
13,
29937,
17806,
1102,
23270,
20535,
362,
30004,
13,
1753,
21014,
309,
29898,
29895,
29892,
29907,
11522,
29892,
5847,
1125,
30004,
13,
539,
736,
413,
29930,
29907,
11522,
16395,
29896,
29899,
5847,
29897,
1068,
29898,
29895,
29899,
29896,
8443,
13,
29937,
3166,
270,
355,
1377,
7136,
413,
1819,
30004,
13,
8186,
29984,
29918,
25598,
29922,
5955,
309,
29898,
17557,
29875,
29892,
29907,
29900,
25598,
29892,
29888,
29918,
2929,
333,
8443,
13,
8186,
29984,
29918,
20647,
29922,
5955,
309,
29898,
29968,
20647,
29892,
29907,
29900,
20647,
29892,
29888,
29918,
2929,
333,
8443,
13,
8186,
29984,
29918,
8263,
29922,
5955,
309,
29898,
29968,
8263,
29892,
29907,
29900,
8263,
29892,
29888,
29918,
2929,
333,
8443,
13,
8186,
29984,
29918,
29940,
29875,
29922,
5955,
309,
29898,
29968,
29940,
29875,
29892,
29907,
29900,
29940,
29875,
29892,
29888,
29918,
2929,
333,
8443,
13,
8186,
29984,
29918,
29924,
29876,
29922,
5955,
309,
29898,
29968,
29924,
29876,
29892,
29907,
29900,
29924,
29876,
29892,
29888,
29918,
2929,
333,
8443,
13,
8186,
29984,
29918,
29940,
29890,
29922,
5955,
309,
29898,
29968,
29940,
29890,
29892,
29907,
29900,
29940,
29890,
29892,
29888,
29918,
2929,
333,
8443,
13,
29937,
8186,
29984,
29918,
22638,
29922,
5955,
309,
29898,
29968,
22638,
29892,
29907,
29900,
22638,
29892,
29888,
29918,
2929,
333,
8443,
13,
30004,
13,
29937,
17806,
11243,
1982,
16241,
20535,
362,
30004,
13,
1753,
1592,
309,
29898,
29895,
29892,
29907,
11522,
29892,
5847,
1125,
30004,
13,
539,
736,
413,
29930,
29907,
11522,
29914,
3552,
29896,
29899,
5847,
7240,
29895,
29930,
5847,
8443,
13,
30004,
13,
28879,
29918,
25598,
29922,
1686,
309,
29898,
17557,
29875,
29892,
29907,
29900,
25598,
29892,
29888,
29918,
2929,
333,
8443,
13,
28879,
29918,
20647,
29922,
1686,
309,
29898,
29968,
20647,
29892,
29907,
29900,
20647,
29892,
29888,
29918,
2929,
333,
8443,
13,
28879,
29918,
8263,
29922,
1686,
309,
29898,
29968,
8263,
29892,
29907,
29900,
8263,
29892,
29888,
29918,
2929,
333,
8443,
13,
28879,
29918,
29940,
29875,
29922,
1686,
309,
29898,
29968,
29940,
29875,
29892,
29907,
29900,
29940,
29875,
29892,
29888,
29918,
2929,
333,
8443,
13,
28879,
29918,
29924,
29876,
29922,
1686,
309,
29898,
29968,
29924,
29876,
29892,
29907,
29900,
29924,
29876,
29892,
29888,
29918,
2929,
333,
8443,
13,
28879,
29918,
29940,
29890,
29922,
1686,
309,
29898,
29968,
29940,
29890,
29892,
29907,
29900,
29940,
29890,
29892,
29888,
29918,
2929,
333,
8443,
13,
29937,
28879,
29918,
22638,
29922,
1686,
309,
29898,
29968,
22638,
29892,
29907,
29900,
22638,
29892,
29888,
29918,
2929,
333,
8443,
13,
30004,
13,
29937,
17806,
529,
5813,
29958,
20535,
362,
29899,
1287,
297,
6728,
30004,
13,
1753,
350,
29943,
29898,
29895,
29892,
29907,
11522,
29892,
5847,
29892,
2312,
1125,
30004,
13,
539,
736,
413,
29930,
29907,
11522,
16395,
29896,
17722,
29896,
29899,
29906,
29930,
2312,
29930,
29895,
11877,
5847,
29897,
1068,
3552,
29895,
29899,
29896,
6802,
29898,
29896,
29899,
29906,
29930,
2312,
29930,
29895,
876,
30004,
13,
259,
6756,
13,
29937,
17806,
18399,
7773,
2450,
2224,
268,
6756,
13,
4532,
29898,
1949,
29922,
8516,
29892,
2537,
2311,
7607,
29953,
29892,
29871,
29946,
511,
270,
1631,
29922,
29896,
29900,
29900,
29892,
3700,
2780,
2433,
29893,
742,
7636,
2780,
2433,
29895,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
25598,
613,
2927,
2433,
9539,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
20647,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
20647,
613,
2927,
2433,
12692,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
8263,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
8263,
613,
2927,
2433,
1127,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29875,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29940,
29875,
613,
2927,
2433,
11082,
6381,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29890,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29940,
29890,
613,
2927,
2433,
1270,
273,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
22638,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
22638,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29924,
29876,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29924,
29876,
613,
2927,
2433,
8517,
1495,
30004,
13,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
25598,
29892,
1643,
543,
29940,
2890,
29875,
613,
2927,
2433,
9539,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
20647,
29892,
1643,
543,
8186,
20647,
613,
2927,
2433,
12692,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
8263,
29892,
1643,
543,
8186,
8263,
613,
2927,
2433,
1127,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29940,
29875,
29892,
1643,
543,
29940,
1430,
29875,
613,
2927,
2433,
11082,
6381,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29940,
29890,
29892,
1643,
543,
29940,
1430,
29890,
613,
2927,
2433,
1270,
273,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
22638,
29892,
1643,
543,
8186,
22638,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29924,
29876,
29892,
1643,
543,
8186,
29924,
29876,
613,
2927,
2433,
8517,
1495,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
25598,
29892,
1643,
543,
2890,
29875,
613,
2927,
2433,
9539,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
20647,
29892,
1643,
543,
11206,
29878,
613,
2927,
2433,
12692,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
8263,
29892,
1643,
543,
29923,
8263,
613,
2927,
2433,
1127,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29940,
29875,
29892,
1643,
543,
1430,
29875,
613,
2927,
2433,
11082,
6381,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29940,
29890,
29892,
1643,
543,
1430,
29890,
613,
2927,
2433,
1270,
273,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
22638,
29892,
1643,
543,
12665,
29877,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29924,
29876,
29892,
1643,
543,
12665,
29876,
613,
2927,
2433,
8517,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
30004,
13,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29943,
13857,
4956,
333,
1495,
30004,
13,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
1168,
1760,
29878,
362,
313,
14554,
29889,
10997,
1495,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
3257,
703,
13296,
333,
2450,
10802,
4956,
333,
2450,
1159,
30004,
13,
572,
29873,
29889,
29916,
2576,
29898,
29900,
29892,
29896,
29889,
29900,
8443,
13,
572,
29873,
29889,
29891,
2576,
29898,
29906,
29900,
29892,
29946,
29945,
8443,
13,
29937,
572,
29873,
29889,
26172,
26471,
13,
29937,
2029,
2433,
13318,
29915,
30004,
13,
30004,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
29937,
17806,
18399,
7773,
2450,
2224,
268,
11019,
10619,
29879,
30004,
13,
4532,
29898,
1949,
29922,
8516,
29892,
2537,
2311,
7607,
29953,
29892,
29871,
29946,
511,
270,
1631,
29922,
29896,
29900,
29900,
29892,
3700,
2780,
2433,
29893,
742,
7636,
2780,
2433,
29895,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
25598,
613,
2927,
2433,
9539,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
20647,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
20647,
613,
2927,
2433,
12692,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
8263,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
8263,
613,
2927,
2433,
1127,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29875,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29940,
29875,
613,
2927,
2433,
11082,
6381,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29890,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29940,
29890,
613,
2927,
2433,
1270,
273,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
22638,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
22638,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29924,
29876,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29924,
29876,
613,
2927,
2433,
8517,
1495,
30004,
13,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
25598,
29892,
1643,
543,
29940,
2890,
29875,
613,
2927,
2433,
9539,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
20647,
29892,
1643,
543,
8186,
20647,
613,
2927,
2433,
12692,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
8263,
29892,
1643,
543,
8186,
8263,
613,
2927,
2433,
1127,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29940,
29875,
29892,
1643,
543,
29940,
1430,
29875,
613,
2927,
2433,
11082,
6381,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29940,
29890,
29892,
1643,
543,
29940,
1430,
29890,
613,
2927,
2433,
1270,
273,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
22638,
29892,
1643,
543,
8186,
22638,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29924,
29876,
29892,
1643,
543,
8186,
29924,
29876,
613,
2927,
2433,
8517,
1495,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
25598,
29892,
1643,
543,
2890,
29875,
613,
2927,
2433,
9539,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
20647,
29892,
1643,
543,
11206,
29878,
613,
2927,
2433,
12692,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
8263,
29892,
1643,
543,
29923,
8263,
613,
2927,
2433,
1127,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29940,
29875,
29892,
1643,
543,
1430,
29875,
613,
2927,
2433,
11082,
6381,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29940,
29890,
29892,
1643,
543,
1430,
29890,
613,
2927,
2433,
1270,
273,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
22638,
29892,
1643,
543,
12665,
29877,
1159,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29924,
29876,
29892,
1643,
543,
12665,
29876,
613,
2927,
2433,
8517,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
30004,
13,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29943,
13857,
4956,
333,
1495,
30004,
13,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
1168,
1760,
29878,
362,
313,
14554,
29889,
10997,
1495,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
3257,
703,
13296,
333,
2450,
10802,
4956,
333,
2450,
1159,
30004,
13,
572,
29873,
29889,
29916,
2576,
29898,
29900,
29892,
29896,
29889,
29900,
8443,
13,
572,
29873,
29889,
29891,
2576,
29898,
29906,
29900,
29892,
29946,
29945,
8443,
13,
29937,
572,
29873,
29889,
26172,
26471,
13,
29937,
2029,
2433,
13318,
29915,
30004,
13,
30004,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
29937,
17806,
21987,
10619,
29879,
30004,
13,
4532,
29898,
1949,
29922,
8516,
29892,
2537,
2311,
7607,
29953,
29892,
29871,
29946,
511,
270,
1631,
29922,
29896,
29900,
29900,
29892,
3700,
2780,
2433,
29893,
742,
7636,
2780,
2433,
29895,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
25598,
613,
2927,
2433,
9539,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29940,
29890,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29940,
29890,
613,
2927,
2433,
1270,
273,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
22638,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
22638,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
16072,
29918,
29891,
29918,
6605,
1839,
29924,
29876,
10619,
284,
2431,
29883,
1237,
7464,
1643,
543,
29924,
29876,
613,
2927,
2433,
8517,
1495,
30004,
13,
30004,
13,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
25598,
29892,
1643,
543,
29940,
2890,
29875,
613,
2927,
2433,
9539,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29940,
29890,
29892,
1643,
543,
29940,
1430,
29890,
613,
2927,
2433,
1270,
273,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
22638,
29892,
1643,
543,
8186,
22638,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
8186,
29984,
29918,
29924,
29876,
29892,
1643,
543,
8186,
29924,
29876,
613,
2927,
2433,
8517,
1495,
30004,
13,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
25598,
29892,
1643,
543,
2890,
29875,
613,
2927,
2433,
9539,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29940,
29890,
29892,
1643,
543,
1430,
29890,
613,
2927,
2433,
1270,
273,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
29937,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
22638,
29892,
1643,
543,
12665,
29877,
1159,
30004,
13,
572,
29873,
29889,
5317,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
29943,
2929,
333,
7464,
28879,
29918,
29924,
29876,
29892,
1643,
543,
12665,
29876,
613,
2927,
2433,
8517,
742,
6276,
342,
1508,
2433,
14592,
287,
1495,
30004,
13,
30004,
13,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
29943,
13857,
4956,
333,
1495,
30004,
13,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
1168,
1760,
29878,
362,
313,
14554,
29889,
10997,
1495,
30004,
13,
30004,
13,
29937,
572,
29873,
29889,
3257,
703,
13296,
333,
2450,
10802,
4956,
333,
2450,
1159,
30004,
13,
572,
29873,
29889,
29916,
2576,
29898,
29900,
29892,
29896,
29889,
29900,
8443,
13,
29937,
572,
29873,
29889,
29891,
2576,
29898,
29906,
29900,
29892,
29946,
29945,
8443,
13,
29937,
572,
29873,
29889,
26172,
26471,
13,
29937,
2029,
2433,
13318,
29915,
30004,
13,
30004,
13,
572,
29873,
29889,
4294,
26471,
13,
30004,
13,
30004,
13,
29937,
17806,
1577,
8773,
28772,
30004,
13,
29937,
2158,
29898,
16072,
29918,
29891,
29918,
6605,
1839,
25598,
10619,
284,
2431,
29883,
1237,
2033,
8443,
13,
29937,
2158,
29898,
3083,
29907,
29879,
8443,
13,
29937,
29907,
29922,
1272,
1839,
29907,
2033,
30004,
13,
29937,
29940,
29890,
29922,
1272,
1839,
29940,
29890,
2033,
30004,
13,
29937,
25598,
29922,
1272,
1839,
25598,
2033,
30004,
13,
29937,
29911,
29875,
29922,
1272,
1839,
29911,
29875,
2033,
30004,
13,
29937,
29956,
29922,
1272,
1839,
29956,
2033,
30004,
13,
29937,
29943,
29918,
29979,
29918,
12513,
29922,
1272,
1839,
29943,
13857,
612,
382,
29896,
2033,
30004,
13,
29937,
29943,
29918,
12513,
29922,
1272,
1839,
29943,
13857,
21271,
382,
29896,
2033,
30004,
13,
29937,
29943,
29918,
29979,
29918,
29924,
29955,
29922,
1272,
1839,
29943,
13857,
612,
382,
29906,
2033,
30004,
13,
29937,
29943,
29918,
29924,
29955,
29922,
1272,
1839,
29943,
13857,
341,
29955,
29907,
29941,
382,
29906,
2033,
30004,
13,
29937,
30004,
13,
2277,
2158,
29898,
29943,
29918,
29979,
29918,
12513,
8443,
13,
2277,
2158,
29898,
29943,
29918,
12513,
8443,
13,
2277,
2158,
29898,
29943,
29918,
29979,
29918,
29924,
29955,
8443,
13,
2277,
2158,
29898,
29943,
29918,
29924,
29955,
8443,
13,
29937,
30004,
13,
2277,
842,
921,
322,
343,
30004,
13,
29937,
29891,
29922,
29943,
29918,
12513,
30004,
13,
29937,
29990,
29922,
25598,
30004,
13,
29937,
29990,
353,
1560,
29889,
1202,
29918,
23362,
29898,
29990,
29897,
444,
1235,
29915,
29879,
788,
385,
23404,
313,
3571,
29918,
29900,
29897,
304,
1749,
1904,
30004,
13,
29937,
30004,
13,
29937,
30004,
13,
2277,
1763,
679,
13964,
310,
278,
8783,
30004,
13,
2277,
3940,
278,
4328,
297,
2980,
1797,
30004,
13,
29937,
4299,
353,
1560,
29889,
5607,
29903,
29898,
29891,
29892,
1060,
467,
9202,
26471,
13,
29937,
27711,
1080,
353,
1904,
29889,
27711,
29898,
29990,
29897,
396,
1207,
278,
27303,
491,
278,
1904,
30004,
13,
29937,
30004,
13,
2277,
13905,
714,
278,
13964,
30004,
13,
29937,
4299,
29889,
7727,
26471,
13,
29937,
17806,
10604,
1591,
29973,
30004,
13,
3166,
5051,
2371,
1053,
4721,
4349,
3562,
30004,
13,
1678,
6756,
13,
29916,
353,
4721,
4349,
3562,
26471,
13,
30004,
13,
29916,
29889,
2671,
29918,
7039,
353,
6796,
16885,
1024,
613,
376,
13799,
613,
376,
12310,
2785,
613,
376,
2744,
29876,
950,
21431,
11950,
3108,
30004,
13,
29937,
1839,
25598,
742,
525,
20647,
742,
525,
8263,
742,
525,
29940,
29875,
742,
525,
29940,
29890,
742,
525,
29924,
29876,
2033,
30004,
13,
29916,
29889,
1202,
29918,
798,
29898,
3366,
3253,
3100,
680,
613,
29871,
29896,
29906,
29929,
29945,
29892,
29871,
29896,
29896,
29945,
29947,
29906,
29945,
29929,
29892,
29871,
29953,
29900,
29900,
29889,
29945,
2314,
30004,
13,
29916,
29889,
1202,
29918,
798,
29898,
3366,
29933,
3780,
29890,
1662,
613,
29871,
29945,
29929,
29900,
29945,
29892,
29871,
29896,
29947,
29945,
29955,
29945,
29929,
29946,
29892,
29871,
29896,
29896,
29946,
29953,
29889,
29946,
2314,
30004,
13,
29916,
29889,
1202,
29918,
798,
29898,
3366,
29928,
279,
5080,
613,
29871,
29896,
29896,
29906,
29892,
29871,
29896,
29906,
29900,
29929,
29900,
29900,
29892,
29871,
29896,
29955,
29896,
29946,
29889,
29955,
2314,
30004,
13,
29916,
29889,
1202,
29918,
798,
29898,
3366,
29950,
711,
442,
613,
29871,
29896,
29941,
29945,
29955,
29892,
29871,
29906,
29900,
29945,
29945,
29945,
29953,
29892,
29871,
29953,
29896,
29929,
29889,
29945,
2314,
30004,
13,
29916,
29889,
1202,
29918,
798,
29898,
3366,
29903,
2941,
3801,
613,
29871,
29906,
29900,
29945,
29947,
29892,
29871,
29946,
29941,
29941,
29953,
29941,
29955,
29946,
29892,
29871,
29896,
29906,
29896,
29946,
29889,
29947,
2314,
30004,
13,
29916,
29889,
1202,
29918,
798,
29898,
3366,
29924,
295,
17418,
613,
29871,
29896,
29945,
29953,
29953,
29892,
29871,
29941,
29947,
29900,
29953,
29900,
29929,
29906,
29892,
29871,
29953,
29946,
29953,
29889,
29929,
2314,
30004,
13,
29916,
29889,
1202,
29918,
798,
29898,
3366,
5894,
386,
613,
29871,
29945,
29941,
29947,
29953,
29892,
29871,
29896,
29945,
29945,
29946,
29955,
29953,
29929,
29892,
29871,
29947,
29953,
29929,
29889,
29946,
2314,
30004,
13,
30004,
13,
2158,
29898,
29916,
8443,
13,
29937,
17806,
2261,
678,
5708,
30004,
13,
29937,
9562,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
30004,
13,
6756,
13,
29937,
731,
2920,
310,
2594,
30004,
13,
1646,
6110,
353,
29871,
29900,
29889,
29906,
29945,
30004,
13,
6756,
13,
29937,
731,
3171,
310,
2594,
30004,
13,
28408,
29896,
353,
518,
17557,
29875,
29892,
476,
20647,
29892,
476,
8263,
29892,
476,
29940,
29875,
29892,
476,
29940,
29890,
29892,
476,
29924,
29876,
29962,
30004,
13,
28408,
29906,
353,
518,
17557,
293,
29900,
29892,
476,
29907,
2214,
29900,
29892,
476,
29943,
687,
29900,
29892,
476,
29940,
293,
29900,
29892,
476,
29940,
12328,
29900,
29892,
476,
29924,
17608,
29900,
29962,
30004,
13,
28408,
29941,
353,
518,
17557,
29875,
29918,
1220,
29892,
476,
20647,
29918,
1220,
29892,
476,
8263,
29918,
1220,
29892,
476,
29940,
29875,
29918,
1220,
29892,
476,
29940,
29890,
29918,
1220,
29892,
476,
29924,
29876,
29918,
1220,
29962,
30004,
13,
6756,
13,
29937,
3789,
2602,
310,
2594,
373,
1060,
9685,
30004,
13,
29878,
29896,
353,
7442,
29889,
279,
927,
29898,
2435,
29898,
28408,
29896,
876,
30004,
13,
29878,
29906,
353,
518,
29916,
718,
2594,
6110,
363,
921,
297,
364,
29896,
29962,
30004,
13,
29878,
29941,
353,
518,
29916,
718,
2594,
6110,
363,
921,
297,
364,
29906,
29962,
30004,
13,
6756,
13,
29937,
8561,
278,
6492,
30004,
13,
572,
29873,
29889,
1646,
29898,
29878,
29896,
29892,
22306,
29896,
29892,
2927,
2433,
29937,
29955,
29888,
29953,
29881,
29945,
29888,
742,
2920,
29922,
1646,
6110,
29892,
7636,
2780,
2433,
10921,
742,
3858,
2433,
29968,
12676,
1495,
30004,
13,
572,
29873,
29889,
1646,
29898,
29878,
29906,
29892,
22306,
29906,
29892,
2927,
2433,
29937,
29945,
29945,
29955,
29888,
29906,
29881,
742,
2920,
29922,
1646,
6110,
29892,
7636,
2780,
2433,
10921,
742,
3858,
2433,
29968,
29907,
29900,
1495,
30004,
13,
572,
29873,
29889,
1646,
29898,
29878,
29941,
29892,
22306,
29941,
29892,
2927,
2433,
29937,
29906,
29881,
29955,
29888,
29945,
29872,
742,
2920,
29922,
1646,
6110,
29892,
7636,
2780,
2433,
10921,
742,
3858,
2433,
29968,
29918,
1220,
1495,
30004,
13,
6756,
13,
29937,
3462,
29871,
486,
7358,
373,
278,
7256,
310,
278,
2318,
22306,
30004,
13,
572,
29873,
29889,
29916,
1643,
877,
2642,
742,
4079,
7915,
2433,
8934,
1495,
30004,
13,
572,
29873,
29889,
29891,
1643,
877,
7439,
654,
3189,
8462,
313,
29895,
29897,
742,
4079,
7915,
2433,
8934,
1495,
30004,
13,
572,
29873,
29889,
486,
7358,
4197,
29878,
718,
2594,
6110,
363,
364,
297,
3464,
29898,
2435,
29898,
28408,
29896,
876,
1402,
6024,
25598,
742,
525,
20647,
742,
525,
8263,
742,
525,
29940,
29875,
742,
525,
29940,
29890,
742,
525,
29924,
29876,
2033,
8443,
13,
572,
29873,
29889,
1165,
7760,
29898,
29896,
29892,
2927,
543,
8517,
1159,
29937,
29889,
5317,
29898,
3366,
25598,
3284,
29924,
29876,
12436,
518,
29896,
29892,
29896,
1402,
376,
29895,
489,
1159,
30004,
13,
29937,
6204,
15983,
669,
7704,
3983,
293,
30004,
13,
572,
29873,
29889,
29891,
2576,
29898,
29900,
29892,
29896,
29889,
29906,
8443,
13,
572,
29873,
29889,
26172,
26471,
13,
572,
29873,
29889,
4294,
26471,
13,
29937,
572,
29873,
29889,
7620,
1003,
877,
29924,
29896,
29900,
360,
6040,
476,
29899,
5975,
29889,
2732,
1495,
30004,
13,
2
] |
orix/tests/test_neoeuler.py | JoonatanL/orix | 1 | 1601308 | import pytest
import numpy as np
from orix.vector.neo_euler import Rodrigues, Homochoric
from orix.quaternion.rotation import Rotation
""" Rodrigues """
@pytest.mark.parametrize(
"rotation, expected",
[
(Rotation([1, 0, 0, 0]), [0, 0, 0]),
(Rotation([0.9239, 0.2209, 0.2209, 0.2209]), [0.2391, 0.2391, 0.2391]),
],
)
def test_from_rotation(rotation, expected):
rodrigues = Rodrigues.from_rotation(rotation)
assert np.allclose(rodrigues.data, expected, atol=1e-4)
@pytest.mark.parametrize(
"rodrigues, expected", [(Rodrigues([0.2391, 0.2391, 0.2391]), np.pi / 4),]
)
def test_angle(rodrigues, expected):
angle = rodrigues.angle
assert np.allclose(angle.data, expected, atol=1e-3)
""" Homochoric"""
@pytest.mark.parametrize(
"rotation", [Rotation([1, 0, 0, 0]), Rotation([0.9239, 0.2209, 0.2209, 0.2209])]
)
def test_Homochoric_from_rotation(rotation):
h = Homochoric.from_rotation(rotation)
return None
@pytest.mark.parametrize(
"rotation", [Rotation([1, 0, 0, 0]), Rotation([0.9239, 0.2209, 0.2209, 0.2209])]
)
@pytest.mark.xfail(strict=True, reason=AttributeError)
def test_Homochoric_angle(rotation):
h = Homochoric.from_rotation(rotation)
h.angle
| [
1,
1053,
11451,
1688,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
470,
861,
29889,
8111,
29889,
11496,
29918,
29872,
8584,
1053,
7733,
8966,
1041,
29892,
15089,
2878,
272,
293,
13,
3166,
470,
861,
29889,
339,
25744,
291,
29889,
5450,
362,
1053,
9664,
362,
13,
13,
13,
15945,
29908,
7733,
8966,
1041,
9995,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
5450,
362,
29892,
3806,
613,
13,
1678,
518,
13,
4706,
313,
21281,
362,
4197,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
11724,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
11724,
13,
4706,
313,
21281,
362,
4197,
29900,
29889,
29929,
29906,
29941,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
11724,
518,
29900,
29889,
29906,
29941,
29929,
29896,
29892,
29871,
29900,
29889,
29906,
29941,
29929,
29896,
29892,
29871,
29900,
29889,
29906,
29941,
29929,
29896,
11724,
13,
1678,
21251,
13,
29897,
13,
1753,
1243,
29918,
3166,
29918,
5450,
362,
29898,
5450,
362,
29892,
3806,
1125,
13,
1678,
696,
7707,
335,
1041,
353,
7733,
8966,
1041,
29889,
3166,
29918,
5450,
362,
29898,
5450,
362,
29897,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
5964,
8966,
1041,
29889,
1272,
29892,
3806,
29892,
472,
324,
29922,
29896,
29872,
29899,
29946,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
5964,
8966,
1041,
29892,
3806,
613,
17288,
29934,
397,
8966,
1041,
4197,
29900,
29889,
29906,
29941,
29929,
29896,
29892,
29871,
29900,
29889,
29906,
29941,
29929,
29896,
29892,
29871,
29900,
29889,
29906,
29941,
29929,
29896,
11724,
7442,
29889,
1631,
847,
29871,
29946,
511,
29962,
13,
29897,
13,
1753,
1243,
29918,
2521,
29898,
5964,
8966,
1041,
29892,
3806,
1125,
13,
1678,
10696,
353,
696,
7707,
335,
1041,
29889,
2521,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
2521,
29889,
1272,
29892,
3806,
29892,
472,
324,
29922,
29896,
29872,
29899,
29941,
29897,
13,
13,
13,
15945,
29908,
15089,
2878,
272,
293,
15945,
29908,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
5450,
362,
613,
518,
21281,
362,
4197,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
11724,
9664,
362,
4197,
29900,
29889,
29929,
29906,
29941,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
2314,
29962,
13,
29897,
13,
1753,
1243,
29918,
24259,
2878,
272,
293,
29918,
3166,
29918,
5450,
362,
29898,
5450,
362,
1125,
13,
1678,
298,
353,
15089,
2878,
272,
293,
29889,
3166,
29918,
5450,
362,
29898,
5450,
362,
29897,
13,
1678,
736,
6213,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
29898,
13,
1678,
376,
5450,
362,
613,
518,
21281,
362,
4197,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
11724,
9664,
362,
4197,
29900,
29889,
29929,
29906,
29941,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
29892,
29871,
29900,
29889,
29906,
29906,
29900,
29929,
2314,
29962,
13,
29897,
13,
29992,
2272,
1688,
29889,
3502,
29889,
29916,
14057,
29898,
710,
919,
29922,
5574,
29892,
2769,
29922,
6708,
2392,
29897,
13,
1753,
1243,
29918,
24259,
2878,
272,
293,
29918,
2521,
29898,
5450,
362,
1125,
13,
1678,
298,
353,
15089,
2878,
272,
293,
29889,
3166,
29918,
5450,
362,
29898,
5450,
362,
29897,
13,
1678,
298,
29889,
2521,
13,
2
] |
testServer.py | SIshikawa1106/tcp-communication | 0 | 59246 | import tcp
import random
class ServerData(object):
def __init__(self):
self._data = ""
def receive(self, data):
print("input data = {}".format(data))
self._data = data
def send(self):
data = self._data + "{}".format(random.randint(0, 10))
print("make data = {}".format(data))
return data
server_data = ServerData()
server = tcp.TcpServer("localhost", 999,
server_data.receive,
server_data.send,
send_first=False
)
server.daemon = True
server.start()
import time
time.sleep(100)
server.exit() | [
1,
1053,
22729,
13,
5215,
4036,
13,
13,
1990,
5656,
1469,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
3032,
1272,
353,
5124,
13,
1678,
822,
7150,
29898,
1311,
29892,
848,
1125,
13,
13,
4706,
1596,
703,
2080,
848,
353,
6571,
1642,
4830,
29898,
1272,
876,
13,
13,
4706,
1583,
3032,
1272,
353,
848,
13,
13,
1678,
822,
3638,
29898,
1311,
1125,
13,
4706,
848,
353,
1583,
3032,
1272,
718,
376,
8875,
1642,
4830,
29898,
8172,
29889,
9502,
524,
29898,
29900,
29892,
29871,
29896,
29900,
876,
13,
4706,
1596,
703,
5675,
848,
353,
6571,
1642,
4830,
29898,
1272,
876,
13,
4706,
736,
848,
13,
13,
13,
2974,
29918,
1272,
353,
5656,
1469,
580,
13,
2974,
353,
22729,
29889,
29911,
6814,
6004,
703,
7640,
613,
29871,
29929,
29929,
29929,
29892,
13,
462,
539,
1923,
29918,
1272,
29889,
13556,
573,
29892,
13,
462,
539,
1923,
29918,
1272,
29889,
6717,
29892,
13,
462,
539,
3638,
29918,
4102,
29922,
8824,
13,
462,
539,
1723,
13,
13,
2974,
29889,
1388,
9857,
353,
5852,
13,
2974,
29889,
2962,
580,
13,
13,
5215,
931,
13,
13,
2230,
29889,
17059,
29898,
29896,
29900,
29900,
29897,
13,
2974,
29889,
13322,
580,
2
] |
demos/09-sqlite/orm-peewee/source/models/__init__.py | sk-dwtoulouse/python-initiation-training | 1 | 1604667 | from .person import Person
__all__ = ["Person"]
| [
1,
515,
869,
10532,
1053,
5196,
13,
13,
1649,
497,
1649,
353,
6796,
7435,
3108,
13,
2
] |
test/unit/test_unpack.py | timmartin/skulpt | 2,671 | 113939 | # Unpack tests from CPython converted from doctest to unittest
import unittest
class UnpackTest(unittest.TestCase):
def test_basic(self):
t = (1, 2, 3)
a, b, c = t
self.assertEqual(a, 1)
self.assertEqual(b, 2)
self.assertEqual(c, 3)
l = [4, 5, 6]
a, b, c = l
self.assertEqual(a, 4)
self.assertEqual(b, 5)
self.assertEqual(c, 6)
a, b, c = 7, 8, 9
self.assertEqual(a, 7)
self.assertEqual(b, 8)
self.assertEqual(c, 9)
s = 'one'
a, b, c = s
self.assertEqual(a, 'o')
self.assertEqual(b, 'n')
self.assertEqual(c, 'e')
def test_single(self):
st = (99,)
sl = [100]
a, = st
self.assertEqual(a, 99)
b, = sl
self.assertEqual(b, 100)
def test_non_sequence(self):
def unpack():
a, b, c = 7
# Currently has incorrect message
self.assertRaises(TypeError, unpack)
def test_wrong_size(self):
def tup_too_big():
t = (1, 2, 3)
a, b = t
def list_too_big():
l = [4, 5, 6]
a, b = l
def tup_too_small():
t = (1, 2, 3)
a, b, c, d = t
def list_too_small():
l = [4, 5, 6]
a, b, c, d = l
self.assertRaises(ValueError, tup_too_big)
self.assertRaises(ValueError, list_too_big)
self.assertRaises(ValueError, tup_too_small)
self.assertRaises(ValueError, list_too_small)
def test_class(self):
class Seq:
def __getitem__(self, i):
if i >= 0 and i < 3: return i
raise IndexError
a, b, c = Seq()
self.assertEqual(a, 0)
self.assertEqual(b, 1)
self.assertEqual(c, 2)
def test_class_fail(self):
class Seq:
def __getitem__(self, i):
if i >= 0 and i < 3: return i
raise IndexError
def too_small():
a, b, c, d = Seq()
def too_big():
a, b = Seq()
self.assertRaises(ValueError, too_small)
self.assertRaises(ValueError, too_big)
def test_bad_class(self):
class BadSeq:
def __getitem__(self, i):
if i >=0 and i < 3:
return i
elif i ==3:
raise NameError
else:
raise IndexError
def raise_bad_error1():
a, b, c, d, e = BadSeq()
def raise_bad_error2():
a, b, c = BadSeq()
self.assertRaises(NameError, raise_bad_error1)
self.assertRaises(NameError, raise_bad_error2)
if __name__ == "__main__":
unittest.main()
| [
1,
396,
853,
4058,
6987,
515,
315,
11980,
11543,
515,
437,
312,
342,
304,
443,
27958,
13,
13,
5215,
443,
27958,
13,
13,
1990,
853,
4058,
3057,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
16121,
29898,
1311,
1125,
13,
4706,
260,
353,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29897,
13,
4706,
263,
29892,
289,
29892,
274,
353,
260,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29874,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29892,
29871,
29906,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29883,
29892,
29871,
29941,
29897,
13,
13,
4706,
301,
353,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29962,
13,
4706,
263,
29892,
289,
29892,
274,
353,
301,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29874,
29892,
29871,
29946,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29892,
29871,
29945,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29883,
29892,
29871,
29953,
29897,
13,
13,
4706,
263,
29892,
289,
29892,
274,
353,
29871,
29955,
29892,
29871,
29947,
29892,
29871,
29929,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29874,
29892,
29871,
29955,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29892,
29871,
29947,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29883,
29892,
29871,
29929,
29897,
13,
13,
4706,
269,
353,
525,
650,
29915,
13,
4706,
263,
29892,
289,
29892,
274,
353,
269,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29874,
29892,
525,
29877,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29892,
525,
29876,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29883,
29892,
525,
29872,
1495,
13,
13,
1678,
822,
1243,
29918,
14369,
29898,
1311,
1125,
13,
4706,
380,
353,
313,
29929,
29929,
29892,
29897,
13,
4706,
2243,
353,
518,
29896,
29900,
29900,
29962,
13,
13,
4706,
263,
29892,
353,
380,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29874,
29892,
29871,
29929,
29929,
29897,
13,
13,
4706,
289,
29892,
353,
2243,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29892,
29871,
29896,
29900,
29900,
29897,
13,
308,
13,
1678,
822,
1243,
29918,
5464,
29918,
16506,
29898,
1311,
1125,
13,
4706,
822,
443,
4058,
7295,
13,
9651,
263,
29892,
289,
29892,
274,
353,
29871,
29955,
13,
4706,
396,
15447,
756,
10240,
2643,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1542,
2392,
29892,
443,
4058,
29897,
13,
13,
1678,
822,
1243,
29918,
15866,
549,
29918,
2311,
29898,
1311,
1125,
13,
4706,
822,
260,
786,
29918,
517,
29877,
29918,
3752,
7295,
13,
9651,
260,
353,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29897,
13,
9651,
263,
29892,
289,
353,
260,
13,
4706,
822,
1051,
29918,
517,
29877,
29918,
3752,
7295,
13,
9651,
301,
353,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29962,
13,
9651,
263,
29892,
289,
353,
301,
13,
4706,
822,
260,
786,
29918,
517,
29877,
29918,
9278,
7295,
13,
9651,
260,
353,
313,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29897,
13,
9651,
263,
29892,
289,
29892,
274,
29892,
270,
353,
260,
13,
4706,
822,
1051,
29918,
517,
29877,
29918,
9278,
7295,
13,
9651,
301,
353,
518,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
29962,
13,
9651,
263,
29892,
289,
29892,
274,
29892,
270,
353,
301,
13,
632,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
29892,
260,
786,
29918,
517,
29877,
29918,
3752,
29897,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
29892,
1051,
29918,
517,
29877,
29918,
3752,
29897,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
29892,
260,
786,
29918,
517,
29877,
29918,
9278,
29897,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
29892,
1051,
29918,
517,
29877,
29918,
9278,
29897,
13,
13,
1678,
822,
1243,
29918,
1990,
29898,
1311,
1125,
13,
4706,
770,
25981,
29901,
13,
9651,
822,
4770,
657,
667,
12035,
1311,
29892,
474,
1125,
13,
18884,
565,
474,
6736,
29871,
29900,
322,
474,
529,
29871,
29941,
29901,
736,
474,
13,
18884,
12020,
11374,
2392,
13,
13,
4706,
263,
29892,
289,
29892,
274,
353,
25981,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29874,
29892,
29871,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29890,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29883,
29892,
29871,
29906,
29897,
13,
13,
1678,
822,
1243,
29918,
1990,
29918,
14057,
29898,
1311,
1125,
13,
4706,
770,
25981,
29901,
13,
9651,
822,
4770,
657,
667,
12035,
1311,
29892,
474,
1125,
13,
18884,
565,
474,
6736,
29871,
29900,
322,
474,
529,
29871,
29941,
29901,
736,
474,
13,
18884,
12020,
11374,
2392,
13,
13,
4706,
822,
2086,
29918,
9278,
7295,
13,
9651,
263,
29892,
289,
29892,
274,
29892,
270,
353,
25981,
580,
13,
4706,
822,
2086,
29918,
3752,
7295,
13,
9651,
263,
29892,
289,
353,
25981,
580,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
29892,
2086,
29918,
9278,
29897,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
29892,
2086,
29918,
3752,
29897,
13,
13,
1678,
822,
1243,
29918,
12313,
29918,
1990,
29898,
1311,
1125,
13,
4706,
770,
9178,
23718,
29901,
13,
9651,
822,
4770,
657,
667,
12035,
1311,
29892,
474,
1125,
13,
18884,
565,
474,
6736,
29900,
322,
474,
529,
29871,
29941,
29901,
13,
462,
1678,
736,
474,
13,
18884,
25342,
474,
1275,
29941,
29901,
13,
462,
1678,
12020,
4408,
2392,
13,
18884,
1683,
29901,
13,
462,
1678,
12020,
11374,
2392,
13,
13,
4706,
822,
12020,
29918,
12313,
29918,
2704,
29896,
7295,
13,
9651,
263,
29892,
289,
29892,
274,
29892,
270,
29892,
321,
353,
9178,
23718,
580,
13,
13,
4706,
822,
12020,
29918,
12313,
29918,
2704,
29906,
7295,
13,
9651,
263,
29892,
289,
29892,
274,
353,
9178,
23718,
580,
13,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1170,
2392,
29892,
12020,
29918,
12313,
29918,
2704,
29896,
29897,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1170,
2392,
29892,
12020,
29918,
12313,
29918,
2704,
29906,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
venv/Lib/site-packages/h5py/tests/test_h5p.py | Westlanderz/AI-Plat1 | 1 | 1611052 | <reponame>Westlanderz/AI-Plat1
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 <NAME> and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
import unittest as ut
from h5py import h5p, h5f, version
from .common import TestCase
class TestLibver(TestCase):
"""
Feature: Setting/getting lib ver bounds
"""
def test_libver(self):
""" Test libver bounds set/get """
plist = h5p.create(h5p.FILE_ACCESS)
plist.set_libver_bounds(h5f.LIBVER_EARLIEST, h5f.LIBVER_LATEST)
self.assertEqual((h5f.LIBVER_EARLIEST, h5f.LIBVER_LATEST),
plist.get_libver_bounds())
@ut.skipIf(version.hdf5_version_tuple < (1, 10, 2),
'Requires HDF5 1.10.2 or later')
def test_libver_v18(self):
""" Test libver bounds set/get for H5F_LIBVER_V18"""
plist = h5p.create(h5p.FILE_ACCESS)
plist.set_libver_bounds(h5f.LIBVER_EARLIEST, h5f.LIBVER_V18)
self.assertEqual((h5f.LIBVER_EARLIEST, h5f.LIBVER_V18),
plist.get_libver_bounds())
@ut.skipIf(version.hdf5_version_tuple < (1, 10, 2),
'Requires HDF5 1.10.2 or later')
def test_libver_v110(self):
""" Test libver bounds set/get for H5F_LIBVER_V110"""
plist = h5p.create(h5p.FILE_ACCESS)
plist.set_libver_bounds(h5f.LIBVER_V18, h5f.LIBVER_V110)
self.assertEqual((h5f.LIBVER_V18, h5f.LIBVER_V110),
plist.get_libver_bounds())
@ut.skipIf(version.hdf5_version_tuple < (1, 11, 4),
'Requires HDF5 1.11.4 or later')
def test_libver_v112(self):
""" Test libver bounds set/get for H5F_LIBVER_V112"""
plist = h5p.create(h5p.FILE_ACCESS)
plist.set_libver_bounds(h5f.LIBVER_V18, h5f.LIBVER_V112)
self.assertEqual((h5f.LIBVER_V18, h5f.LIBVER_V112),
plist.get_libver_bounds())
class TestDA(TestCase):
'''
Feature: setting/getting chunk cache size on a dataset access property list
'''
def test_chunk_cache(self):
'''test get/set chunk cache '''
dalist = h5p.create(h5p.DATASET_ACCESS)
nslots = 10000 # 40kb hash table
nbytes = 1000000 # 1MB cache size
w0 = .5 # even blend of eviction strategy
dalist.set_chunk_cache(nslots, nbytes, w0)
self.assertEqual((nslots, nbytes, w0),
dalist.get_chunk_cache())
class TestFA(TestCase):
'''
Feature: setting/getting mdc config on a file access property list
'''
def test_mdc_config(self):
'''test get/set mdc config '''
falist = h5p.create(h5p.FILE_ACCESS)
config = falist.get_mdc_config()
falist.set_mdc_config(config)
def test_set_alignment(self):
'''test get/set chunk cache '''
falist = h5p.create(h5p.FILE_ACCESS)
threshold = 10 * 1024 # threshold of 10kiB
alignment = 1024 * 1024 # threshold of 1kiB
falist.set_alignment(threshold, alignment)
self.assertEqual((threshold, alignment),
falist.get_alignment())
@ut.skipUnless(
version.hdf5_version_tuple >= (1, 12, 1) or
(version.hdf5_version_tuple[:2] == (1, 10) and version.hdf5_version_tuple[2] >= 7),
'Requires HDF5 1.12.1 or later or 1.10.x >= 1.10.7')
def test_set_file_locking(self):
'''test get/set file locking'''
falist = h5p.create(h5p.FILE_ACCESS)
use_file_locking = False
ignore_when_disabled = False
falist.set_file_locking(use_file_locking, ignore_when_disabled)
self.assertEqual((use_file_locking, ignore_when_disabled),
falist.get_file_locking())
class TestPL(TestCase):
def test_obj_track_times(self):
"""
tests if the object track times set/get
"""
# test for groups
gcid = h5p.create(h5p.GROUP_CREATE)
gcid.set_obj_track_times(False)
self.assertEqual(False, gcid.get_obj_track_times())
gcid.set_obj_track_times(True)
self.assertEqual(True, gcid.get_obj_track_times())
# test for datasets
dcid = h5p.create(h5p.DATASET_CREATE)
dcid.set_obj_track_times(False)
self.assertEqual(False, dcid.get_obj_track_times())
dcid.set_obj_track_times(True)
self.assertEqual(True, dcid.get_obj_track_times())
# test for generic objects
ocid = h5p.create(h5p.OBJECT_CREATE)
ocid.set_obj_track_times(False)
self.assertEqual(False, ocid.get_obj_track_times())
ocid.set_obj_track_times(True)
self.assertEqual(True, ocid.get_obj_track_times())
def test_link_creation_tracking(self):
"""
tests the link creation order set/get
"""
gcid = h5p.create(h5p.GROUP_CREATE)
gcid.set_link_creation_order(0)
self.assertEqual(0, gcid.get_link_creation_order())
flags = h5p.CRT_ORDER_TRACKED | h5p.CRT_ORDER_INDEXED
gcid.set_link_creation_order(flags)
self.assertEqual(flags, gcid.get_link_creation_order())
# test for file creation
fcpl = h5p.create(h5p.FILE_CREATE)
fcpl.set_link_creation_order(flags)
self.assertEqual(flags, fcpl.get_link_creation_order())
def test_attr_phase_change(self):
"""
test the attribute phase change
"""
cid = h5p.create(h5p.OBJECT_CREATE)
# test default value
ret = cid.get_attr_phase_change()
self.assertEqual((8,6), ret)
# max_compact must < 65536 (64kb)
with self.assertRaises(ValueError):
cid.set_attr_phase_change(65536, 6)
# Using dense attributes storage to avoid 64kb size limitation
# for a single attribute in compact attribute storage.
cid.set_attr_phase_change(0, 0)
self.assertEqual((0,0), cid.get_attr_phase_change())
| [
1,
529,
276,
1112,
420,
29958,
16128,
1049,
261,
29920,
29914,
23869,
29899,
3247,
271,
29896,
13,
29937,
910,
934,
338,
760,
310,
298,
29945,
2272,
29892,
263,
5132,
5067,
304,
278,
379,
4037,
29945,
3489,
22993,
13,
29937,
30004,
13,
29937,
1732,
597,
1636,
29889,
29882,
29945,
2272,
29889,
990,
30004,
13,
29937,
30004,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29900,
29947,
29899,
29906,
29900,
29896,
29941,
529,
5813,
29958,
322,
17737,
29560,
30004,
13,
29937,
30004,
13,
29937,
19245,
29901,
29871,
10117,
29871,
29941,
29899,
16398,
1509,
350,
7230,
29936,
1074,
376,
506,
1947,
29889,
3945,
29908,
363,
2989,
19405,
4958,
30004,
13,
29937,
965,
322,
17737,
3406,
17327,
22993,
13,
30004,
13,
5215,
443,
27958,
408,
3477,
30004,
13,
30004,
13,
3166,
298,
29945,
2272,
1053,
298,
29945,
29886,
29892,
298,
29945,
29888,
29892,
1873,
30004,
13,
30004,
13,
3166,
869,
9435,
1053,
4321,
8259,
30004,
13,
30004,
13,
30004,
13,
1990,
4321,
14868,
369,
29898,
3057,
8259,
1125,
30004,
13,
30004,
13,
1678,
9995,
30004,
13,
4706,
5169,
1535,
29901,
21605,
29914,
29264,
4303,
1147,
13451,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
822,
1243,
29918,
1982,
369,
29898,
1311,
1125,
30004,
13,
4706,
9995,
4321,
4303,
369,
13451,
731,
29914,
657,
9995,
30004,
13,
4706,
715,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
2477,
23524,
8443,
13,
4706,
715,
391,
29889,
842,
29918,
1982,
369,
29918,
23687,
29898,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
26441,
5265,
29923,
1254,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29931,
3040,
1254,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
26441,
5265,
29923,
1254,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29931,
3040,
1254,
511,
30004,
13,
462,
308,
715,
391,
29889,
657,
29918,
1982,
369,
29918,
23687,
3101,
30004,
13,
30004,
13,
1678,
732,
329,
29889,
11014,
3644,
29898,
3259,
29889,
29882,
2176,
29945,
29918,
3259,
29918,
23583,
529,
313,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
511,
30004,
13,
1669,
525,
1123,
339,
2658,
379,
4037,
29945,
29871,
29896,
29889,
29896,
29900,
29889,
29906,
470,
2678,
1495,
30004,
13,
1678,
822,
1243,
29918,
1982,
369,
29918,
29894,
29896,
29947,
29898,
1311,
1125,
30004,
13,
4706,
9995,
4321,
4303,
369,
13451,
731,
29914,
657,
363,
379,
29945,
29943,
29918,
5265,
29933,
5348,
29918,
29963,
29896,
29947,
15945,
19451,
13,
4706,
715,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
2477,
23524,
8443,
13,
4706,
715,
391,
29889,
842,
29918,
1982,
369,
29918,
23687,
29898,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
26441,
5265,
29923,
1254,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29947,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
26441,
5265,
29923,
1254,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29947,
511,
30004,
13,
462,
308,
715,
391,
29889,
657,
29918,
1982,
369,
29918,
23687,
3101,
30004,
13,
30004,
13,
1678,
732,
329,
29889,
11014,
3644,
29898,
3259,
29889,
29882,
2176,
29945,
29918,
3259,
29918,
23583,
529,
313,
29896,
29892,
29871,
29896,
29900,
29892,
29871,
29906,
511,
30004,
13,
1669,
525,
1123,
339,
2658,
379,
4037,
29945,
29871,
29896,
29889,
29896,
29900,
29889,
29906,
470,
2678,
1495,
30004,
13,
1678,
822,
1243,
29918,
1982,
369,
29918,
29894,
29896,
29896,
29900,
29898,
1311,
1125,
30004,
13,
4706,
9995,
4321,
4303,
369,
13451,
731,
29914,
657,
363,
379,
29945,
29943,
29918,
5265,
29933,
5348,
29918,
29963,
29896,
29896,
29900,
15945,
19451,
13,
4706,
715,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
2477,
23524,
8443,
13,
4706,
715,
391,
29889,
842,
29918,
1982,
369,
29918,
23687,
29898,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29947,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29896,
29900,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29947,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29896,
29900,
511,
30004,
13,
462,
308,
715,
391,
29889,
657,
29918,
1982,
369,
29918,
23687,
3101,
30004,
13,
30004,
13,
1678,
732,
329,
29889,
11014,
3644,
29898,
3259,
29889,
29882,
2176,
29945,
29918,
3259,
29918,
23583,
529,
313,
29896,
29892,
29871,
29896,
29896,
29892,
29871,
29946,
511,
30004,
13,
1669,
525,
1123,
339,
2658,
379,
4037,
29945,
29871,
29896,
29889,
29896,
29896,
29889,
29946,
470,
2678,
1495,
30004,
13,
1678,
822,
1243,
29918,
1982,
369,
29918,
29894,
29896,
29896,
29906,
29898,
1311,
1125,
30004,
13,
4706,
9995,
4321,
4303,
369,
13451,
731,
29914,
657,
363,
379,
29945,
29943,
29918,
5265,
29933,
5348,
29918,
29963,
29896,
29896,
29906,
15945,
19451,
13,
4706,
715,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
2477,
23524,
8443,
13,
4706,
715,
391,
29889,
842,
29918,
1982,
369,
29918,
23687,
29898,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29947,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29896,
29906,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29882,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29947,
29892,
298,
29945,
29888,
29889,
5265,
29933,
5348,
29918,
29963,
29896,
29896,
29906,
511,
30004,
13,
462,
308,
715,
391,
29889,
657,
29918,
1982,
369,
29918,
23687,
3101,
30004,
13,
30004,
13,
1990,
4321,
7698,
29898,
3057,
8259,
1125,
30004,
13,
1678,
14550,
30004,
13,
1678,
5169,
1535,
29901,
4444,
29914,
29264,
19875,
7090,
2159,
373,
263,
8783,
2130,
2875,
1051,
30004,
13,
1678,
14550,
30004,
13,
1678,
822,
1243,
29918,
29812,
29918,
8173,
29898,
1311,
1125,
30004,
13,
4706,
14550,
1688,
679,
29914,
842,
19875,
7090,
14550,
30004,
13,
4706,
2959,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
25832,
8127,
29911,
29918,
2477,
23524,
8443,
13,
4706,
302,
2536,
1862,
353,
29871,
29896,
29900,
29900,
29900,
29900,
29871,
396,
29871,
29946,
29900,
21066,
6608,
1591,
30004,
13,
4706,
302,
13193,
353,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29871,
396,
29871,
29896,
9486,
7090,
2159,
30004,
13,
4706,
281,
29900,
353,
869,
29945,
29871,
396,
1584,
1999,
355,
310,
3415,
2463,
13705,
30004,
13,
30004,
13,
4706,
2959,
391,
29889,
842,
29918,
29812,
29918,
8173,
29898,
1983,
29880,
1862,
29892,
302,
13193,
29892,
281,
29900,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
1983,
29880,
1862,
29892,
302,
13193,
29892,
281,
29900,
511,
30004,
13,
462,
308,
2959,
391,
29889,
657,
29918,
29812,
29918,
8173,
3101,
30004,
13,
30004,
13,
30004,
13,
1990,
4321,
4519,
29898,
3057,
8259,
1125,
30004,
13,
1678,
14550,
30004,
13,
1678,
5169,
1535,
29901,
4444,
29914,
29264,
286,
13891,
2295,
373,
263,
934,
2130,
2875,
1051,
30004,
13,
1678,
14550,
30004,
13,
1678,
822,
1243,
29918,
3487,
29883,
29918,
2917,
29898,
1311,
1125,
30004,
13,
4706,
14550,
1688,
679,
29914,
842,
286,
13891,
2295,
14550,
30004,
13,
4706,
11092,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
2477,
23524,
8443,
13,
30004,
13,
4706,
2295,
353,
11092,
391,
29889,
657,
29918,
3487,
29883,
29918,
2917,
26471,
13,
4706,
11092,
391,
29889,
842,
29918,
3487,
29883,
29918,
2917,
29898,
2917,
8443,
13,
30004,
13,
1678,
822,
1243,
29918,
842,
29918,
2520,
358,
29898,
1311,
1125,
30004,
13,
4706,
14550,
1688,
679,
29914,
842,
19875,
7090,
14550,
30004,
13,
4706,
11092,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
2477,
23524,
8443,
13,
4706,
16897,
353,
29871,
29896,
29900,
334,
29871,
29896,
29900,
29906,
29946,
29871,
396,
16897,
310,
29871,
29896,
29900,
1984,
29933,
30004,
13,
4706,
22239,
353,
29871,
29896,
29900,
29906,
29946,
334,
29871,
29896,
29900,
29906,
29946,
29871,
396,
16897,
310,
29871,
29896,
1984,
29933,
30004,
13,
30004,
13,
4706,
11092,
391,
29889,
842,
29918,
2520,
358,
29898,
386,
12268,
29892,
22239,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
386,
12268,
29892,
22239,
511,
30004,
13,
462,
308,
11092,
391,
29889,
657,
29918,
2520,
358,
3101,
30004,
13,
30004,
13,
1678,
732,
329,
29889,
11014,
2525,
2222,
29898,
30004,
13,
4706,
1873,
29889,
29882,
2176,
29945,
29918,
3259,
29918,
23583,
6736,
313,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29897,
470,
30004,
13,
4706,
313,
3259,
29889,
29882,
2176,
29945,
29918,
3259,
29918,
23583,
7503,
29906,
29962,
1275,
313,
29896,
29892,
29871,
29896,
29900,
29897,
322,
1873,
29889,
29882,
2176,
29945,
29918,
3259,
29918,
23583,
29961,
29906,
29962,
6736,
29871,
29955,
511,
30004,
13,
4706,
525,
1123,
339,
2658,
379,
4037,
29945,
29871,
29896,
29889,
29896,
29906,
29889,
29896,
470,
2678,
470,
29871,
29896,
29889,
29896,
29900,
29889,
29916,
6736,
29871,
29896,
29889,
29896,
29900,
29889,
29955,
1495,
30004,
13,
1678,
822,
1243,
29918,
842,
29918,
1445,
29918,
908,
292,
29898,
1311,
1125,
30004,
13,
4706,
14550,
1688,
679,
29914,
842,
934,
7714,
292,
12008,
30004,
13,
4706,
11092,
391,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
2477,
23524,
8443,
13,
4706,
671,
29918,
1445,
29918,
908,
292,
353,
7700,
30004,
13,
4706,
11455,
29918,
8256,
29918,
18279,
353,
7700,
30004,
13,
30004,
13,
4706,
11092,
391,
29889,
842,
29918,
1445,
29918,
908,
292,
29898,
1509,
29918,
1445,
29918,
908,
292,
29892,
11455,
29918,
8256,
29918,
18279,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
1509,
29918,
1445,
29918,
908,
292,
29892,
11455,
29918,
8256,
29918,
18279,
511,
30004,
13,
462,
308,
11092,
391,
29889,
657,
29918,
1445,
29918,
908,
292,
3101,
30004,
13,
30004,
13,
30004,
13,
1990,
4321,
7390,
29898,
3057,
8259,
1125,
30004,
13,
1678,
822,
1243,
29918,
5415,
29918,
11294,
29918,
3706,
29898,
1311,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
6987,
565,
278,
1203,
5702,
3064,
29871,
731,
29914,
657,
30004,
13,
4706,
9995,
30004,
13,
4706,
396,
1243,
363,
6471,
30004,
13,
4706,
330,
25232,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
26284,
29918,
27045,
8443,
13,
4706,
330,
25232,
29889,
842,
29918,
5415,
29918,
11294,
29918,
3706,
29898,
8824,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8824,
29892,
330,
25232,
29889,
657,
29918,
5415,
29918,
11294,
29918,
3706,
3101,
30004,
13,
30004,
13,
4706,
330,
25232,
29889,
842,
29918,
5415,
29918,
11294,
29918,
3706,
29898,
5574,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5574,
29892,
330,
25232,
29889,
657,
29918,
5415,
29918,
11294,
29918,
3706,
3101,
30004,
13,
4706,
396,
1243,
363,
20035,
30004,
13,
4706,
270,
25232,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
25832,
8127,
29911,
29918,
27045,
8443,
13,
4706,
270,
25232,
29889,
842,
29918,
5415,
29918,
11294,
29918,
3706,
29898,
8824,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8824,
29892,
270,
25232,
29889,
657,
29918,
5415,
29918,
11294,
29918,
3706,
3101,
30004,
13,
30004,
13,
4706,
270,
25232,
29889,
842,
29918,
5415,
29918,
11294,
29918,
3706,
29898,
5574,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5574,
29892,
270,
25232,
29889,
657,
29918,
5415,
29918,
11294,
29918,
3706,
3101,
30004,
13,
30004,
13,
4706,
396,
1243,
363,
10035,
3618,
30004,
13,
4706,
12954,
333,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
14824,
17637,
29918,
27045,
8443,
13,
4706,
12954,
333,
29889,
842,
29918,
5415,
29918,
11294,
29918,
3706,
29898,
8824,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
8824,
29892,
12954,
333,
29889,
657,
29918,
5415,
29918,
11294,
29918,
3706,
3101,
30004,
13,
30004,
13,
4706,
12954,
333,
29889,
842,
29918,
5415,
29918,
11294,
29918,
3706,
29898,
5574,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
5574,
29892,
12954,
333,
29889,
657,
29918,
5415,
29918,
11294,
29918,
3706,
3101,
30004,
13,
30004,
13,
1678,
822,
1243,
29918,
2324,
29918,
1037,
362,
29918,
11294,
292,
29898,
1311,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
6987,
278,
1544,
11265,
1797,
731,
29914,
657,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
330,
25232,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
26284,
29918,
27045,
8443,
13,
4706,
330,
25232,
29889,
842,
29918,
2324,
29918,
1037,
362,
29918,
2098,
29898,
29900,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
29900,
29892,
330,
25232,
29889,
657,
29918,
2324,
29918,
1037,
362,
29918,
2098,
3101,
30004,
13,
30004,
13,
4706,
13449,
353,
298,
29945,
29886,
29889,
11341,
29911,
29918,
22364,
29918,
5659,
11375,
3352,
891,
298,
29945,
29886,
29889,
11341,
29911,
29918,
22364,
29918,
27992,
3352,
30004,
13,
4706,
330,
25232,
29889,
842,
29918,
2324,
29918,
1037,
362,
29918,
2098,
29898,
15764,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
15764,
29892,
330,
25232,
29889,
657,
29918,
2324,
29918,
1037,
362,
29918,
2098,
3101,
30004,
13,
30004,
13,
4706,
396,
1243,
363,
934,
11265,
30004,
13,
4706,
285,
29883,
572,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
7724,
29918,
27045,
8443,
13,
4706,
285,
29883,
572,
29889,
842,
29918,
2324,
29918,
1037,
362,
29918,
2098,
29898,
15764,
8443,
13,
4706,
1583,
29889,
9294,
9843,
29898,
15764,
29892,
285,
29883,
572,
29889,
657,
29918,
2324,
29918,
1037,
362,
29918,
2098,
3101,
30004,
13,
30004,
13,
1678,
822,
1243,
29918,
5552,
29918,
21646,
29918,
3167,
29898,
1311,
1125,
30004,
13,
4706,
9995,
30004,
13,
4706,
1243,
278,
5352,
8576,
1735,
30004,
13,
4706,
9995,
30004,
13,
30004,
13,
4706,
274,
333,
353,
298,
29945,
29886,
29889,
3258,
29898,
29882,
29945,
29886,
29889,
14824,
17637,
29918,
27045,
8443,
13,
4706,
396,
1243,
2322,
995,
30004,
13,
4706,
3240,
353,
274,
333,
29889,
657,
29918,
5552,
29918,
21646,
29918,
3167,
26471,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29947,
29892,
29953,
511,
3240,
8443,
13,
30004,
13,
4706,
396,
4236,
29918,
2388,
627,
1818,
529,
29871,
29953,
29945,
29945,
29941,
29953,
313,
29953,
29946,
21066,
8443,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1917,
2392,
1125,
30004,
13,
9651,
274,
333,
29889,
842,
29918,
5552,
29918,
21646,
29918,
3167,
29898,
29953,
29945,
29945,
29941,
29953,
29892,
29871,
29953,
8443,
13,
30004,
13,
4706,
396,
5293,
20619,
8393,
8635,
304,
4772,
29871,
29953,
29946,
21066,
2159,
29485,
30004,
13,
4706,
396,
363,
263,
2323,
5352,
297,
11071,
5352,
8635,
22993,
13,
4706,
274,
333,
29889,
842,
29918,
5552,
29918,
21646,
29918,
3167,
29898,
29900,
29892,
29871,
29900,
8443,
13,
4706,
1583,
29889,
9294,
9843,
3552,
29900,
29892,
29900,
511,
274,
333,
29889,
657,
29918,
5552,
29918,
21646,
29918,
3167,
3101,
30004,
13,
2
] |
weichi.py | AlekseySP/Project-102 | 0 | 65544 | <filename>weichi.py
# Load and initialize Modules here
import pygame
import random
pygame.init()
# Window Information
displayw = 700
displayh = 700
screen = pygame.display.set_mode((displayw,displayh))
surface = pygame.display.get_surface()
W,H = size = surface.get_width(), surface.get_height()
# Clock
windowclock = pygame.time.Clock()
# Load other things such as images and sound files here
#tileset = pygame.image.load("tileset.png").convert_alpha()
# Use convert_alpha() for images with transparency
# Main Class
class MainRun(object):
def __init__(self, width, height):
self.w = width
self.h = height
self.board_size = 19
self.WHITE = (255,255,255)
self.BLACK = (0,0,0)
self.GRAY = (128, 128, 128)
self.BROWN = (139, 69, 19)
self.TEAL = (0,128,128)
self.RED = (255, 0 , 0)
self.side = self.w
if self.h < self.w:
self.side = self.h
self.step = self.side/41
self.z = self.step*2
self.b_step = (self.side - (self.step+self.z)*2) / (self.board_size - 1)
self.coord_list = {}
self.move_history = []
self.accupied_dots = []
self.Main()
def draw_board(self):
r1 = pygame.Rect((self.step, self.step, self.side-self.step*2, self.side-self.step*2))
pygame.draw.rect(screen, self.GRAY, r1, 3)
x1 = self.step + self.z
y1 = self.step + self.z
x2 = self.side - (self.step+self.z)
y2 = self.side - (self.step + self.z)
# coord_list = {}
for v in range(self.board_size):
pygame.draw.line(screen, self.GRAY, [x1, y1], [x1, y2], 1)
self.coord_list[str(v)] = [x1]
x1 += self.b_step
#coord_list[str(board_size)] = [x1]
x1 = self.step + self.z
for h in range(self.board_size):
pygame.draw.line(screen, self.GRAY, [x1, y1], [x2, y1], 1)
self.coord_list[str(h)].append(y1)
y1 += self.b_step
pygame.draw.circle(screen, self.GRAY, self.coord_list["3"], 5)
pygame.draw.circle(screen, self.GRAY, self.coord_list["9"], 5)
pygame.draw.circle(screen, self.GRAY, self.coord_list["15"], 5)
pygame.draw.circle(screen, self.GRAY, [self.coord_list["3"][0], self.coord_list["15"][1]], 5)
pygame.draw.circle(screen, self.GRAY, [self.coord_list["15"][0], self.coord_list["3"][1]], 5)
def make_move(self):
color = random.random()
rx = self.coord_list[str(random.randrange(self.board_size))][0]
ry = self.coord_list[str(random.randrange(self.board_size))][1]
coords = [rx, ry]
if coords in self.accupied_dots:
pass
else:
if color >= 0.5:
col = self.WHITE
else:
col = self.BLACK
self.accupied_dots.append([rx, ry])
self.move_history.append([col, [rx, ry]])
def draw_moves(self):
if self.accupied_dots:
for i in self.move_history:
pygame.draw.circle(screen, i[0], i[1], self.b_step*0.45)
pygame.draw.circle(screen, self.GRAY, i[1], self.b_step*0.45, 1)
def Main(self):
#Put all variables up here
stopped = False
while stopped == False:
screen.fill(self.BLACK) #Tuple for filling display... Current is white
self.draw_board()
#Event Tasking
#Add all your event tasking things here
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
elif event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
self.make_move()
elif event.type == pygame.KEYDOWN:
stopped = True
#Add things like player updates here
# self.make_move()
self.draw_moves()
#Also things like score updates or drawing additional items
# Remember things on top get done first so they will update in the order yours is set at
# Remember to update your clock and display at the end
pygame.display.update()
windowclock.tick(20)
# If you need to reset variables here
# This includes things like score resets
# After your main loop throw in extra things such as a main menu or a pause menu
# Make sure you throw them in your main loop somewhere where they can be activated by the user
# All player classes and object classes should be made outside of the main class and called inside the class
#The end of your code should look something like this
if __name__ == "__main__":
MainRun(W, H) | [
1,
529,
9507,
29958,
705,
18544,
29889,
2272,
13,
29937,
16012,
322,
11905,
3382,
2540,
1244,
13,
5215,
22028,
13,
5215,
4036,
13,
2272,
11802,
29889,
2344,
580,
13,
13,
29937,
18379,
10343,
13,
13,
4990,
29893,
353,
29871,
29955,
29900,
29900,
13,
4990,
29882,
353,
29871,
29955,
29900,
29900,
13,
13,
10525,
353,
22028,
29889,
4990,
29889,
842,
29918,
8513,
3552,
4990,
29893,
29892,
4990,
29882,
876,
13,
7610,
2161,
353,
22028,
29889,
4990,
29889,
657,
29918,
7610,
2161,
580,
29871,
13,
29956,
29892,
29950,
353,
2159,
353,
7101,
29889,
657,
29918,
2103,
3285,
7101,
29889,
657,
29918,
3545,
580,
13,
13,
29937,
315,
908,
13,
7165,
13058,
353,
22028,
29889,
2230,
29889,
29907,
908,
580,
13,
13,
29937,
16012,
916,
2712,
1316,
408,
4558,
322,
6047,
2066,
1244,
13,
29937,
1376,
267,
300,
353,
22028,
29889,
3027,
29889,
1359,
703,
1376,
267,
300,
29889,
2732,
2564,
13441,
29918,
2312,
580,
13,
29937,
4803,
3588,
29918,
2312,
580,
363,
4558,
411,
1301,
862,
3819,
13,
13,
29937,
4241,
4134,
13,
1990,
4241,
6558,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2920,
29892,
3171,
1125,
13,
4706,
1583,
29889,
29893,
353,
2920,
13,
4706,
1583,
29889,
29882,
353,
3171,
13,
4706,
1583,
29889,
3377,
29918,
2311,
353,
29871,
29896,
29929,
13,
4706,
1583,
29889,
25039,
9094,
353,
313,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29897,
13,
4706,
1583,
29889,
13367,
11375,
353,
313,
29900,
29892,
29900,
29892,
29900,
29897,
13,
4706,
1583,
29889,
29954,
22800,
353,
313,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
29892,
29871,
29896,
29906,
29947,
29897,
13,
4706,
1583,
29889,
29933,
1672,
16048,
353,
313,
29896,
29941,
29929,
29892,
29871,
29953,
29929,
29892,
29871,
29896,
29929,
29897,
13,
4706,
1583,
29889,
4330,
1964,
353,
313,
29900,
29892,
29896,
29906,
29947,
29892,
29896,
29906,
29947,
29897,
13,
4706,
1583,
29889,
19386,
353,
313,
29906,
29945,
29945,
29892,
29871,
29900,
1919,
29871,
29900,
29897,
13,
4706,
1583,
29889,
2975,
353,
1583,
29889,
29893,
13,
4706,
565,
1583,
29889,
29882,
529,
1583,
29889,
29893,
29901,
13,
9651,
1583,
29889,
2975,
353,
1583,
29889,
29882,
13,
4706,
1583,
29889,
10568,
353,
1583,
29889,
2975,
29914,
29946,
29896,
13,
4706,
1583,
29889,
29920,
353,
1583,
29889,
10568,
29930,
29906,
13,
4706,
1583,
29889,
29890,
29918,
10568,
353,
313,
1311,
29889,
2975,
448,
313,
1311,
29889,
10568,
29974,
1311,
29889,
29920,
11877,
29906,
29897,
847,
313,
1311,
29889,
3377,
29918,
2311,
448,
29871,
29896,
29897,
13,
4706,
1583,
29889,
1111,
536,
29918,
1761,
353,
6571,
13,
4706,
1583,
29889,
11631,
29918,
18434,
353,
5159,
13,
4706,
1583,
29889,
562,
5231,
1000,
29918,
7778,
353,
5159,
13,
4706,
1583,
29889,
6330,
580,
13,
13,
13,
1678,
822,
4216,
29918,
3377,
29898,
1311,
1125,
13,
4706,
364,
29896,
353,
22028,
29889,
7364,
3552,
1311,
29889,
10568,
29892,
1583,
29889,
10568,
29892,
1583,
29889,
2975,
29899,
1311,
29889,
10568,
29930,
29906,
29892,
1583,
29889,
2975,
29899,
1311,
29889,
10568,
29930,
29906,
876,
13,
4706,
22028,
29889,
4012,
29889,
1621,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
364,
29896,
29892,
29871,
29941,
29897,
13,
4706,
921,
29896,
353,
1583,
29889,
10568,
718,
1583,
29889,
29920,
13,
4706,
343,
29896,
353,
1583,
29889,
10568,
718,
1583,
29889,
29920,
13,
4706,
921,
29906,
353,
1583,
29889,
2975,
448,
313,
1311,
29889,
10568,
29974,
1311,
29889,
29920,
29897,
13,
4706,
343,
29906,
353,
1583,
29889,
2975,
448,
313,
1311,
29889,
10568,
718,
1583,
29889,
29920,
29897,
13,
4706,
396,
29311,
29918,
1761,
353,
6571,
13,
308,
13,
4706,
363,
325,
297,
3464,
29898,
1311,
29889,
3377,
29918,
2311,
1125,
13,
9651,
22028,
29889,
4012,
29889,
1220,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
518,
29916,
29896,
29892,
343,
29896,
1402,
518,
29916,
29896,
29892,
343,
29906,
1402,
29871,
29896,
29897,
13,
9651,
1583,
29889,
1111,
536,
29918,
1761,
29961,
710,
29898,
29894,
4638,
353,
518,
29916,
29896,
29962,
13,
9651,
921,
29896,
4619,
1583,
29889,
29890,
29918,
10568,
13,
308,
13,
4706,
396,
1111,
536,
29918,
1761,
29961,
710,
29898,
3377,
29918,
2311,
4638,
353,
518,
29916,
29896,
29962,
13,
4706,
921,
29896,
353,
1583,
29889,
10568,
718,
1583,
29889,
29920,
13,
308,
13,
4706,
363,
298,
297,
3464,
29898,
1311,
29889,
3377,
29918,
2311,
1125,
13,
9651,
22028,
29889,
4012,
29889,
1220,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
518,
29916,
29896,
29892,
343,
29896,
1402,
518,
29916,
29906,
29892,
343,
29896,
1402,
29871,
29896,
29897,
13,
9651,
1583,
29889,
1111,
536,
29918,
1761,
29961,
710,
29898,
29882,
29897,
1822,
4397,
29898,
29891,
29896,
29897,
13,
9651,
343,
29896,
4619,
1583,
29889,
29890,
29918,
10568,
13,
632,
13,
4706,
22028,
29889,
4012,
29889,
16622,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
1583,
29889,
1111,
536,
29918,
1761,
3366,
29941,
12436,
29871,
29945,
29897,
13,
4706,
22028,
29889,
4012,
29889,
16622,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
1583,
29889,
1111,
536,
29918,
1761,
3366,
29929,
12436,
29871,
29945,
29897,
13,
4706,
22028,
29889,
4012,
29889,
16622,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
1583,
29889,
1111,
536,
29918,
1761,
3366,
29896,
29945,
12436,
29871,
29945,
29897,
13,
4706,
22028,
29889,
4012,
29889,
16622,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
518,
1311,
29889,
1111,
536,
29918,
1761,
3366,
29941,
3108,
29961,
29900,
1402,
1583,
29889,
1111,
536,
29918,
1761,
3366,
29896,
29945,
3108,
29961,
29896,
20526,
29871,
29945,
29897,
13,
4706,
22028,
29889,
4012,
29889,
16622,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
518,
1311,
29889,
1111,
536,
29918,
1761,
3366,
29896,
29945,
3108,
29961,
29900,
1402,
1583,
29889,
1111,
536,
29918,
1761,
3366,
29941,
3108,
29961,
29896,
20526,
29871,
29945,
29897,
13,
632,
13,
13,
1678,
822,
1207,
29918,
11631,
29898,
1311,
1125,
13,
4706,
2927,
353,
4036,
29889,
8172,
580,
13,
4706,
364,
29916,
353,
1583,
29889,
1111,
536,
29918,
1761,
29961,
710,
29898,
8172,
29889,
9502,
3881,
29898,
1311,
29889,
3377,
29918,
2311,
876,
3816,
29900,
29962,
13,
4706,
24721,
353,
1583,
29889,
1111,
536,
29918,
1761,
29961,
710,
29898,
8172,
29889,
9502,
3881,
29898,
1311,
29889,
3377,
29918,
2311,
876,
3816,
29896,
29962,
13,
4706,
1302,
4339,
353,
518,
17697,
29892,
24721,
29962,
13,
4706,
565,
1302,
4339,
297,
1583,
29889,
562,
5231,
1000,
29918,
7778,
29901,
13,
9651,
1209,
13,
4706,
1683,
29901,
13,
9651,
565,
2927,
6736,
29871,
29900,
29889,
29945,
29901,
13,
18884,
784,
353,
1583,
29889,
25039,
9094,
13,
9651,
1683,
29901,
13,
18884,
784,
353,
1583,
29889,
13367,
11375,
13,
9651,
1583,
29889,
562,
5231,
1000,
29918,
7778,
29889,
4397,
4197,
17697,
29892,
24721,
2314,
13,
9651,
1583,
29889,
11631,
29918,
18434,
29889,
4397,
4197,
1054,
29892,
518,
17697,
29892,
24721,
24960,
13,
13,
1678,
822,
4216,
29918,
13529,
267,
29898,
1311,
1125,
13,
4706,
565,
1583,
29889,
562,
5231,
1000,
29918,
7778,
29901,
13,
9651,
363,
474,
297,
1583,
29889,
11631,
29918,
18434,
29901,
13,
18884,
22028,
29889,
4012,
29889,
16622,
29898,
10525,
29892,
474,
29961,
29900,
1402,
474,
29961,
29896,
1402,
1583,
29889,
29890,
29918,
10568,
29930,
29900,
29889,
29946,
29945,
29897,
13,
18884,
22028,
29889,
4012,
29889,
16622,
29898,
10525,
29892,
1583,
29889,
29954,
22800,
29892,
474,
29961,
29896,
1402,
1583,
29889,
29890,
29918,
10568,
29930,
29900,
29889,
29946,
29945,
29892,
29871,
29896,
29897,
13,
13,
1678,
822,
4241,
29898,
1311,
1125,
13,
4706,
396,
22908,
599,
3651,
701,
1244,
13,
4706,
11084,
353,
7700,
13,
13,
4706,
1550,
11084,
1275,
7700,
29901,
13,
9651,
4315,
29889,
5589,
29898,
1311,
29889,
13367,
11375,
29897,
396,
23215,
552,
363,
27523,
2479,
856,
9626,
338,
4796,
13,
9651,
1583,
29889,
4012,
29918,
3377,
580,
13,
13,
9651,
396,
2624,
9330,
292,
13,
9651,
396,
2528,
599,
596,
1741,
3414,
292,
2712,
1244,
13,
9651,
363,
1741,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
18884,
565,
1741,
29889,
1853,
1275,
22028,
29889,
13356,
1806,
29901,
13,
462,
1678,
22028,
29889,
28358,
580,
13,
462,
1678,
23283,
580,
13,
18884,
25342,
1741,
29889,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
3970,
16048,
29901,
13,
462,
1678,
565,
1741,
29889,
3092,
1275,
29871,
29896,
29901,
13,
462,
4706,
1583,
29889,
5675,
29918,
11631,
580,
13,
18884,
25342,
1741,
29889,
1853,
1275,
22028,
29889,
10818,
3970,
16048,
29901,
13,
462,
1678,
11084,
353,
5852,
13,
13,
13,
9651,
396,
2528,
2712,
763,
4847,
11217,
1244,
13,
9651,
396,
1583,
29889,
5675,
29918,
11631,
580,
13,
9651,
1583,
29889,
4012,
29918,
13529,
267,
580,
13,
9651,
396,
17351,
2712,
763,
8158,
11217,
470,
11580,
5684,
4452,
13,
9651,
396,
22738,
2712,
373,
2246,
679,
2309,
937,
577,
896,
674,
2767,
297,
278,
1797,
15850,
338,
731,
472,
13,
13,
9651,
396,
22738,
304,
2767,
596,
12006,
322,
2479,
472,
278,
1095,
13,
9651,
22028,
29889,
4990,
29889,
5504,
580,
13,
9651,
3474,
13058,
29889,
24667,
29898,
29906,
29900,
29897,
13,
13,
4706,
396,
960,
366,
817,
304,
10092,
3651,
1244,
13,
4706,
396,
910,
7805,
2712,
763,
8158,
620,
1691,
13,
13,
1678,
396,
2860,
596,
1667,
2425,
3183,
297,
4805,
2712,
1316,
408,
263,
1667,
6143,
470,
263,
19957,
6143,
13,
1678,
396,
8561,
1854,
366,
3183,
963,
297,
596,
1667,
2425,
9051,
988,
896,
508,
367,
5039,
630,
491,
278,
1404,
13,
13,
29937,
2178,
4847,
4413,
322,
1203,
4413,
881,
367,
1754,
5377,
310,
278,
1667,
770,
322,
2000,
2768,
278,
770,
13,
29937,
1576,
1095,
310,
596,
775,
881,
1106,
1554,
763,
445,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
12,
6330,
6558,
29898,
29956,
29892,
379,
29897,
2
] |
DiretoryBrute.py | Moleey/DiretoryBrute.py | 1 | 47123 | from os import system
from requests import get
from pyfiglet import figlet_format
from colored import fore, back, style, attr
attr(0)
print(back.BLACK)
print(fore.BLUE_VIOLET + style.BOLD)
system("clear")
print(figlet_format("DIRETORY BRUTE\nBY MOLEEY", width=58, justify="center", font="smslant"))
site = input("Link Do Site: ")
txt = open("wordlist.txt", "r")
line = txt.readlines()
for diretory in line:
req = get(site+diretory)
status = req.status_code
if status != 404:
print(f"URL: {site+diretory} Status: {status}")
| [
1,
515,
2897,
1053,
1788,
13,
3166,
7274,
1053,
679,
13,
3166,
11451,
1003,
1026,
1053,
2537,
1026,
29918,
4830,
13,
3166,
28684,
1053,
26839,
29892,
1250,
29892,
3114,
29892,
12421,
13,
5552,
29898,
29900,
29897,
13,
2158,
29898,
1627,
29889,
13367,
11375,
29897,
13,
2158,
29898,
1079,
29889,
13367,
4462,
29918,
29963,
5971,
1307,
29911,
718,
3114,
29889,
29933,
5607,
29928,
29897,
13,
5205,
703,
8551,
1159,
13,
13,
2158,
29898,
1003,
1026,
29918,
4830,
703,
4571,
1525,
29911,
18929,
25185,
26027,
29905,
29876,
22716,
16999,
1307,
13282,
613,
2920,
29922,
29945,
29947,
29892,
26922,
543,
5064,
613,
4079,
543,
29879,
1516,
27493,
5783,
13,
13,
2746,
353,
1881,
703,
6595,
1938,
10781,
29901,
16521,
13,
3945,
353,
1722,
703,
1742,
1761,
29889,
3945,
613,
376,
29878,
1159,
13,
1220,
353,
13872,
29889,
949,
9012,
580,
13,
13,
1454,
2970,
29873,
706,
297,
1196,
29901,
13,
12,
7971,
353,
679,
29898,
2746,
29974,
20146,
29873,
706,
29897,
13,
12,
4882,
353,
12428,
29889,
4882,
29918,
401,
13,
12,
13,
12,
361,
4660,
2804,
29871,
29946,
29900,
29946,
29901,
13,
12,
12,
2158,
29898,
29888,
29908,
4219,
29901,
426,
2746,
29974,
20146,
29873,
706,
29913,
16034,
29901,
426,
4882,
27195,
13,
2
] |
backend/app/literature/schemas/cross_reference_schemas.py | alliance-genome/agr_literature_service | 0 | 14651 | from typing import List, Optional
from pydantic import BaseModel
from pydantic import validator
class CrossReferenceSchemaRelated(BaseModel):
curie: str
pages: Optional[List[str]] = None
is_obsolete: Optional[bool] = None
@validator('curie')
def name_must_contain_space(cls, v):
if v.count(":") != 1 and not v.startswith("DOI:"):
raise ValueError('must contain a single colon')
return v
class Config():
orm_mode = True
extra = "forbid"
schema_extra = {
"example": {
"curie": "MOD:curie",
"pages": [
"reference"
]
}
}
class CrossReferenceSchemaPost(CrossReferenceSchemaRelated):
resource_curie: Optional[str] = None
reference_curie: Optional[str] = None
class Config():
orm_mod = True
extra = "forbid"
schema_extra = {
"example": {
"curie": "MOD:curie",
"pages": [
"reference"
],
"reference_curie": "AGR:AGRReference<number>"
}
}
class CrossReferencePageSchemaShow(BaseModel):
name: Optional[str] = None
url: Optional[str] = None
class Config():
orm_mode = True
extra = "forbid"
class CrossReferenceSchemaShow(BaseModel):
curie: str
url: Optional[str] = None
pages: Optional[List[CrossReferencePageSchemaShow]] = None
is_obsolete: bool
class CrossReferenceSchema(BaseModel):
curie: str
pages: Optional[List[CrossReferencePageSchemaShow]] = None
url: Optional[str] = None
is_obsolete: Optional[bool] = False
resource_curie: Optional[str] = None
reference_curie: Optional[str] = None
author_ids: Optional[List[int]] = None
editor_ids: Optional[List[int]] = None
class Config():
orm_mode = True
extra = "forbid"
class CrossReferenceSchemaUpdate(BaseModel):
pages: Optional[List[str]] = None
resource_curie: Optional[str] = None
reference_curie: Optional[str] = None
is_obsolete: Optional[bool] = None
class Config():
orm_mode = True
extra = "forbid"
| [
1,
515,
19229,
1053,
2391,
29892,
28379,
13,
13,
3166,
282,
2941,
7716,
1053,
7399,
3195,
13,
3166,
282,
2941,
7716,
1053,
2854,
1061,
13,
13,
13,
1990,
11189,
7422,
12763,
9662,
630,
29898,
5160,
3195,
1125,
13,
1678,
3151,
347,
29901,
851,
13,
1678,
6515,
29901,
28379,
29961,
1293,
29961,
710,
5262,
353,
6213,
13,
1678,
338,
29918,
711,
2170,
371,
29901,
28379,
29961,
11227,
29962,
353,
6213,
13,
13,
1678,
732,
3084,
1061,
877,
2764,
347,
1495,
13,
1678,
822,
1024,
29918,
21969,
29918,
1285,
475,
29918,
3493,
29898,
25932,
29892,
325,
1125,
13,
4706,
565,
325,
29889,
2798,
703,
29901,
1159,
2804,
29871,
29896,
322,
451,
325,
29889,
27382,
2541,
703,
3970,
29902,
6160,
1125,
13,
9651,
12020,
7865,
2392,
877,
21969,
1712,
263,
2323,
8104,
1495,
13,
4706,
736,
325,
13,
13,
1678,
770,
12782,
7295,
13,
4706,
470,
29885,
29918,
8513,
353,
5852,
13,
4706,
4805,
353,
376,
1454,
23883,
29908,
13,
4706,
10938,
29918,
17833,
353,
426,
13,
9651,
376,
4773,
1115,
426,
13,
18884,
376,
2764,
347,
1115,
376,
6720,
29928,
29901,
2764,
347,
613,
13,
18884,
376,
12292,
1115,
518,
13,
462,
1678,
376,
5679,
29908,
13,
18884,
4514,
13,
9651,
500,
13,
4706,
500,
13,
13,
13,
1990,
11189,
7422,
12763,
6747,
29898,
29907,
2124,
7422,
12763,
9662,
630,
1125,
13,
1678,
6503,
29918,
2764,
347,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
3407,
29918,
2764,
347,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
13,
1678,
770,
12782,
7295,
13,
4706,
470,
29885,
29918,
1545,
353,
5852,
13,
4706,
4805,
353,
376,
1454,
23883,
29908,
13,
4706,
10938,
29918,
17833,
353,
426,
13,
9651,
376,
4773,
1115,
426,
13,
18884,
376,
2764,
347,
1115,
376,
6720,
29928,
29901,
2764,
347,
613,
13,
18884,
376,
12292,
1115,
518,
13,
462,
1678,
376,
5679,
29908,
13,
18884,
21251,
13,
18884,
376,
5679,
29918,
2764,
347,
1115,
376,
10051,
29934,
29901,
10051,
29934,
7422,
29966,
4537,
11903,
13,
9651,
500,
13,
4706,
500,
13,
13,
13,
1990,
11189,
7422,
5074,
12763,
8964,
29898,
5160,
3195,
1125,
13,
1678,
1024,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
3142,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
13,
1678,
770,
12782,
7295,
13,
4706,
470,
29885,
29918,
8513,
353,
5852,
13,
4706,
4805,
353,
376,
1454,
23883,
29908,
13,
13,
13,
1990,
11189,
7422,
12763,
8964,
29898,
5160,
3195,
1125,
13,
1678,
3151,
347,
29901,
851,
13,
1678,
3142,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
6515,
29901,
28379,
29961,
1293,
29961,
29907,
2124,
7422,
5074,
12763,
8964,
5262,
353,
6213,
13,
1678,
338,
29918,
711,
2170,
371,
29901,
6120,
13,
13,
13,
1990,
11189,
7422,
12763,
29898,
5160,
3195,
1125,
13,
1678,
3151,
347,
29901,
851,
13,
1678,
6515,
29901,
28379,
29961,
1293,
29961,
29907,
2124,
7422,
5074,
12763,
8964,
5262,
353,
6213,
13,
1678,
3142,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
338,
29918,
711,
2170,
371,
29901,
28379,
29961,
11227,
29962,
353,
7700,
13,
13,
1678,
6503,
29918,
2764,
347,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
3407,
29918,
2764,
347,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
13,
1678,
4148,
29918,
4841,
29901,
28379,
29961,
1293,
29961,
524,
5262,
353,
6213,
13,
1678,
6920,
29918,
4841,
29901,
28379,
29961,
1293,
29961,
524,
5262,
353,
6213,
13,
13,
1678,
770,
12782,
7295,
13,
4706,
470,
29885,
29918,
8513,
353,
5852,
13,
4706,
4805,
353,
376,
1454,
23883,
29908,
13,
13,
13,
1990,
11189,
7422,
12763,
6422,
29898,
5160,
3195,
1125,
13,
1678,
6515,
29901,
28379,
29961,
1293,
29961,
710,
5262,
353,
6213,
13,
1678,
6503,
29918,
2764,
347,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
3407,
29918,
2764,
347,
29901,
28379,
29961,
710,
29962,
353,
6213,
13,
1678,
338,
29918,
711,
2170,
371,
29901,
28379,
29961,
11227,
29962,
353,
6213,
13,
13,
1678,
770,
12782,
7295,
13,
4706,
470,
29885,
29918,
8513,
353,
5852,
13,
4706,
4805,
353,
376,
1454,
23883,
29908,
13,
2
] |
attic/_targetdatacli.py | KSchopmeyer/smipyping | 0 | 166193 | <filename>attic/_targetdatacli.py
# (C) Copyright 2017 Inova Development 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.
"""
Argparse CLi for the temporary target script.
TODO: Remove this completely
"""
import os
import sys as _sys
import csv
import argparse as _argparse
from ._cliutils import SmartFormatter as _SmartFormatter
from ._targetdata import TargetsData
from .config import DEFAULT_CONFIG_FILE
from ._configfile import read_config
__all__ = ['ProcessTargetDataCli']
class ProcessTargetDataCli(object):
"""
This class is part of the cli for Target data.
It creates the argparse list
and parses input in two separate functions.
TODO: This should probably be in the cli itself but we are trying to
create test tools for the cli so put here.
Also split into separate functions to allow testing each.
"""
def __init__(self, prog):
argparser = _argparse.ArgumentParser(
prog=prog,
description='Manage Target data',
formatter_class=_SmartFormatter,
usage="""targetdata <command> [<args>]
The commands are:
display Display entries in the Targets data repository
disable Disable an record in the table
fields list the fields in the target data repostiory
record Display the record for a particular target_id
disabled list all records disabled (i.e. ScanEnabled = False)
""")
# a = RunTargetData()
# subcommands = a.__dict__.keys()
argparser.add_argument(
'command', metavar='cmd', help='Subcommand to run')
argparser.add_argument(
'-f', '--config_file', metavar='CONFIG_FILE',
default=DEFAULT_CONFIG_FILE,
help=('Configuration file to use for config information. '
'Default=%s' % DEFAULT_CONFIG_FILE))
argparser.add_argument(
'-v', '--verbose', action='store_true', default=False)
argparser.add_argument(
'-d', '--dbtype', choices=('csv', 'sql'), default=csv,
help='Choice of database type')
args = argparser.parse_args(_sys.argv[1:2])
if not hasattr(self, args.command):
print('Unrecognized command %s ' % args.command)
argparser.print_help()
exit(1)
DBTYPE = 'csv'
db_config = read_config(args.config_file, DBTYPE)
db_config['directory'] = os.path.dirname(args.config_file)
target_data = TargetsData.factory(db_config, args, DBTYPE)
# use dispatch pattern to invoke method with same name
getattr(self, args.command)(target_data)
def display(self, target_data):
"""
Function to display table data.
gets the arguments for the display and display the Table data.
"""
disp_parser = _argparse.ArgumentParser(
description='Display target data repository')
disp_parser.add_argument('-s', '--sort',
default='IP',
help='Sort by field')
# now that we're inside a subcommand, ignore the first
# TWO argvs, ie the command and the subcommand
disp_parser.parse_args(_sys.argv[2:])
print('keys %s' % list(target_data.table_format_dict))
print('\n')
target_data.display_all()
def disable(self, target_data):
"""Function to mark a particular targetdata record disabled."""
disable_parser = _argparse.ArgumentParser(
description='Disable record in the repository')
# prefixing the argument with -- means it's optional
disable_parser.add_argument(
'Id',
help='Set or reset the disable flag for the defined record ')
# prefixing the argument with -- means it's optional
disable_parser.add_argument(
'-f', '--file',
default='targetdata_example.csv',
help='Filename to display')
disable_parser.add_argument(
'-l', '--list',
action='store_true', default=False,
help='List all the disabled entries')
disable_parser.add_argument(
'-e', '--enable',
action='store_true', default=False,
help='Set the disable flag to enable the '
'record rather than disable it')
# now that we're inside a subcommand, ignore the first
# TWO argvs, ie the command and the subcommand
args = disable_parser.parse_args(_sys.argv[2:])
host_record = target_data.get_target(args.Id)
# TODO add test to see if already in correct state
if host_record is not None:
host_record['EnableScan'] = False if args.enable is True else True
target_data.write_updated()
else:
print('Id %s invalid or not in table' % args.Id)
if args.list is True:
target_data.display_disabled()
def disabled(self, target_data):
# ~ disp_parser = _argparse.ArgumentParser(
# ~ description='Display disabled')
# ~ # prefixing the argument with -- means it's optional
# ~ disp_parser.add_argument('-f', '--file',
# ~ default='targetdata_example.csv',
# ~ help='Filename to display')
# ~ args = disp_parser.parse_args(_sys.argv[2:])
target_data.display_disabled()
def fields(self, target_data):
"""Display the fields in the targetdata file."""
# prefixing the argument with -- means it's optional
print('\n'.join(target_data.get_field_list()))
def find(self, target_data):
parser = _argparse.ArgumentParser(
description='Find a particular host')
parser.add_argument('server',
help='Server IP address to find')
parser.add_argument('-f', '--file',
default='targetdata_example.csv',
help='Filename to display')
args = parser.parse_args(_sys.argv[2:])
record = target_data.get_target(args.server)
# TODO separate get record from display record .
if record is None:
print('%s not found' % args.server)
else:
print('%s found\n%s' % (args.server, record))
def record(self, target_data):
"""
Parse an input cli for hosts.
"""
parser = _argparse.ArgumentParser(
description='List info on single record_id')
# prefixing the argument with -- means it's optional
parser.add_argument('record_id', type=int,
help='Record Id from the database. Integers')
parser.add_argument('-f', '--file',
default='targetdata_example.csv',
help='Filename to display')
args = parser.parse_args(_sys.argv[2:])
record_id = "%2.2s" % args.record_id
# TODO get host ids from table
record = target_data.get_target(record_id)
# TODO separate get record from display record .
if record is None:
print('Record %s not found in Targets data.' % record_id)
else:
max_len = 0
for key in record:
if max_len < len(key):
max_len = len(key)
for key in record:
print('%*s : %s' % (max_len, key, record[key]))
| [
1,
529,
9507,
29958,
1131,
293,
19891,
5182,
1272,
11303,
29889,
2272,
13,
29937,
313,
29907,
29897,
14187,
1266,
29871,
29906,
29900,
29896,
29955,
512,
4273,
14650,
9266,
29889,
13,
29937,
2178,
26863,
2538,
9841,
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,
1678,
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,
13,
8559,
5510,
17332,
29875,
363,
278,
13201,
3646,
2471,
29889,
13,
13,
4986,
3970,
29901,
15154,
445,
6446,
13,
15945,
29908,
13,
5215,
2897,
13,
5215,
10876,
408,
903,
9675,
13,
5215,
11799,
13,
5215,
1852,
5510,
408,
903,
1191,
5510,
13,
13,
3166,
869,
29918,
11303,
13239,
1053,
4116,
442,
18522,
408,
903,
12636,
442,
18522,
13,
3166,
869,
29918,
5182,
1272,
1053,
17157,
29879,
1469,
13,
3166,
869,
2917,
1053,
22236,
29918,
25903,
29918,
7724,
13,
3166,
869,
29918,
2917,
1445,
1053,
1303,
29918,
2917,
13,
13,
1649,
497,
1649,
353,
6024,
7032,
8667,
1469,
29907,
492,
2033,
13,
13,
13,
1990,
10554,
8667,
1469,
29907,
492,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
910,
770,
338,
760,
310,
278,
9335,
363,
17157,
848,
29889,
13,
13,
1678,
739,
10017,
278,
1852,
5510,
1051,
13,
1678,
322,
610,
29879,
267,
1881,
297,
1023,
5004,
3168,
29889,
13,
1678,
14402,
29901,
910,
881,
3117,
367,
297,
278,
9335,
3528,
541,
591,
526,
1811,
304,
13,
1678,
1653,
1243,
8492,
363,
278,
9335,
577,
1925,
1244,
29889,
13,
1678,
3115,
6219,
964,
5004,
3168,
304,
2758,
6724,
1269,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
410,
29887,
1125,
13,
4706,
1852,
16680,
353,
903,
1191,
5510,
29889,
15730,
11726,
29898,
13,
9651,
410,
29887,
29922,
29097,
29892,
13,
9651,
6139,
2433,
2517,
482,
17157,
848,
742,
13,
9651,
883,
2620,
29918,
1990,
29922,
29918,
12636,
442,
18522,
29892,
13,
9651,
8744,
13776,
29908,
5182,
1272,
529,
6519,
29958,
518,
29966,
5085,
29958,
29962,
13,
1576,
8260,
526,
29901,
13,
259,
2479,
268,
17440,
9976,
297,
278,
17157,
29879,
848,
9810,
13,
259,
11262,
268,
3295,
519,
385,
2407,
29871,
297,
278,
1591,
13,
259,
4235,
418,
1051,
278,
4235,
297,
278,
3646,
848,
1634,
16098,
706,
13,
259,
2407,
418,
17440,
278,
2407,
363,
263,
3153,
3646,
29918,
333,
13,
259,
12708,
1678,
1051,
599,
6475,
12708,
313,
29875,
29889,
29872,
29889,
2522,
273,
10861,
353,
7700,
29897,
13,
15945,
1159,
13,
4706,
396,
263,
353,
7525,
8667,
1469,
580,
13,
4706,
396,
1014,
26381,
353,
263,
17255,
8977,
26914,
8149,
580,
13,
4706,
1852,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
525,
6519,
742,
1539,
485,
279,
2433,
9006,
742,
1371,
2433,
4035,
6519,
304,
1065,
1495,
13,
13,
4706,
1852,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
17411,
29888,
742,
525,
489,
2917,
29918,
1445,
742,
1539,
485,
279,
2433,
25903,
29918,
7724,
742,
13,
9651,
2322,
29922,
23397,
29918,
25903,
29918,
7724,
29892,
13,
9651,
1371,
29922,
877,
8614,
934,
304,
671,
363,
2295,
2472,
29889,
525,
13,
462,
29871,
525,
4592,
16328,
29879,
29915,
1273,
22236,
29918,
25903,
29918,
7724,
876,
13,
4706,
1852,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
17411,
29894,
742,
525,
489,
369,
15828,
742,
3158,
2433,
8899,
29918,
3009,
742,
2322,
29922,
8824,
29897,
13,
13,
4706,
1852,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
17411,
29881,
742,
525,
489,
2585,
1853,
742,
19995,
29922,
877,
7638,
742,
525,
2850,
5477,
2322,
29922,
7638,
29892,
13,
9651,
1371,
2433,
29620,
310,
2566,
1134,
1495,
13,
13,
4706,
6389,
353,
1852,
16680,
29889,
5510,
29918,
5085,
7373,
9675,
29889,
19218,
29961,
29896,
29901,
29906,
2314,
13,
4706,
565,
451,
756,
5552,
29898,
1311,
29892,
6389,
29889,
6519,
1125,
13,
9651,
1596,
877,
2525,
29423,
1891,
1899,
1273,
29879,
525,
1273,
6389,
29889,
6519,
29897,
13,
9651,
1852,
16680,
29889,
2158,
29918,
8477,
580,
13,
9651,
6876,
29898,
29896,
29897,
13,
13,
4706,
6535,
11116,
353,
525,
7638,
29915,
13,
13,
4706,
4833,
29918,
2917,
353,
1303,
29918,
2917,
29898,
5085,
29889,
2917,
29918,
1445,
29892,
6535,
11116,
29897,
13,
4706,
4833,
29918,
2917,
1839,
12322,
2033,
353,
2897,
29889,
2084,
29889,
25721,
29898,
5085,
29889,
2917,
29918,
1445,
29897,
13,
4706,
3646,
29918,
1272,
353,
17157,
29879,
1469,
29889,
14399,
29898,
2585,
29918,
2917,
29892,
6389,
29892,
6535,
11116,
29897,
13,
13,
4706,
396,
671,
13916,
4766,
304,
15928,
1158,
411,
1021,
1024,
13,
4706,
679,
5552,
29898,
1311,
29892,
6389,
29889,
6519,
5033,
5182,
29918,
1272,
29897,
13,
13,
1678,
822,
2479,
29898,
1311,
29892,
3646,
29918,
1272,
1125,
13,
4706,
9995,
13,
4706,
6680,
304,
2479,
1591,
848,
29889,
13,
13,
4706,
4947,
278,
6273,
363,
278,
2479,
322,
2479,
278,
29871,
6137,
848,
29889,
13,
4706,
9995,
13,
4706,
12272,
29918,
16680,
353,
903,
1191,
5510,
29889,
15730,
11726,
29898,
13,
9651,
6139,
2433,
9323,
3646,
848,
9810,
1495,
13,
13,
4706,
12272,
29918,
16680,
29889,
1202,
29918,
23516,
877,
29899,
29879,
742,
525,
489,
6605,
742,
13,
462,
462,
2322,
2433,
5690,
742,
13,
462,
462,
1371,
2433,
13685,
491,
1746,
1495,
13,
13,
4706,
396,
1286,
393,
591,
29915,
276,
2768,
263,
1014,
6519,
29892,
11455,
278,
937,
13,
4706,
396,
323,
29956,
29949,
1852,
4270,
29892,
19282,
278,
1899,
322,
278,
1014,
6519,
13,
4706,
12272,
29918,
16680,
29889,
5510,
29918,
5085,
7373,
9675,
29889,
19218,
29961,
29906,
29901,
2314,
13,
13,
4706,
1596,
877,
8149,
1273,
29879,
29915,
1273,
1051,
29898,
5182,
29918,
1272,
29889,
2371,
29918,
4830,
29918,
8977,
876,
13,
13,
4706,
1596,
28909,
29876,
1495,
13,
4706,
3646,
29918,
1272,
29889,
4990,
29918,
497,
580,
13,
13,
1678,
822,
11262,
29898,
1311,
29892,
3646,
29918,
1272,
1125,
13,
4706,
9995,
6678,
304,
2791,
263,
3153,
3646,
1272,
2407,
12708,
1213,
15945,
13,
4706,
11262,
29918,
16680,
353,
903,
1191,
5510,
29889,
15730,
11726,
29898,
13,
9651,
6139,
2433,
4205,
519,
2407,
29871,
297,
278,
9810,
1495,
13,
4706,
396,
10944,
292,
278,
2980,
411,
1192,
2794,
372,
29915,
29879,
13136,
13,
4706,
11262,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
525,
1204,
742,
13,
9651,
1371,
2433,
2697,
470,
10092,
278,
11262,
7353,
363,
278,
3342,
2407,
25710,
13,
13,
4706,
396,
10944,
292,
278,
2980,
411,
1192,
2794,
372,
29915,
29879,
13136,
13,
4706,
11262,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
17411,
29888,
742,
525,
489,
1445,
742,
13,
9651,
2322,
2433,
5182,
1272,
29918,
4773,
29889,
7638,
742,
13,
9651,
1371,
2433,
3434,
3871,
304,
2479,
1495,
13,
13,
4706,
11262,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
17411,
29880,
742,
525,
489,
1761,
742,
13,
9651,
3158,
2433,
8899,
29918,
3009,
742,
2322,
29922,
8824,
29892,
13,
9651,
1371,
2433,
1293,
599,
278,
12708,
9976,
1495,
13,
13,
4706,
11262,
29918,
16680,
29889,
1202,
29918,
23516,
29898,
13,
9651,
17411,
29872,
742,
525,
489,
12007,
742,
13,
9651,
3158,
2433,
8899,
29918,
3009,
742,
2322,
29922,
8824,
29892,
13,
9651,
1371,
2433,
2697,
278,
11262,
7353,
304,
9025,
278,
525,
13,
462,
525,
11651,
29871,
3265,
1135,
11262,
372,
1495,
13,
13,
4706,
396,
1286,
393,
591,
29915,
276,
2768,
263,
1014,
6519,
29892,
11455,
278,
937,
13,
4706,
396,
323,
29956,
29949,
1852,
4270,
29892,
19282,
278,
1899,
322,
278,
1014,
6519,
13,
4706,
6389,
353,
11262,
29918,
16680,
29889,
5510,
29918,
5085,
7373,
9675,
29889,
19218,
29961,
29906,
29901,
2314,
13,
13,
4706,
3495,
29918,
11651,
353,
3646,
29918,
1272,
29889,
657,
29918,
5182,
29898,
5085,
29889,
1204,
29897,
13,
13,
4706,
396,
14402,
788,
1243,
304,
1074,
565,
2307,
297,
1959,
2106,
13,
13,
4706,
565,
3495,
29918,
11651,
338,
451,
6213,
29901,
13,
9651,
3495,
29918,
11651,
1839,
20701,
29083,
2033,
353,
7700,
565,
6389,
29889,
12007,
338,
5852,
1683,
5852,
13,
9651,
3646,
29918,
1272,
29889,
3539,
29918,
21402,
580,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
1204,
1273,
29879,
8340,
470,
451,
297,
1591,
29915,
1273,
6389,
29889,
1204,
29897,
13,
13,
4706,
565,
6389,
29889,
1761,
338,
5852,
29901,
13,
9651,
3646,
29918,
1272,
29889,
4990,
29918,
18279,
580,
13,
13,
1678,
822,
12708,
29898,
1311,
29892,
3646,
29918,
1272,
1125,
13,
4706,
396,
3695,
12272,
29918,
16680,
353,
903,
1191,
5510,
29889,
15730,
11726,
29898,
13,
9651,
396,
3695,
6139,
2433,
9323,
12708,
1495,
13,
4706,
396,
3695,
396,
10944,
292,
278,
2980,
411,
1192,
2794,
372,
29915,
29879,
13136,
13,
4706,
396,
3695,
12272,
29918,
16680,
29889,
1202,
29918,
23516,
877,
29899,
29888,
742,
525,
489,
1445,
742,
13,
462,
18884,
396,
3695,
2322,
2433,
5182,
1272,
29918,
4773,
29889,
7638,
742,
13,
462,
18884,
396,
3695,
1371,
2433,
3434,
3871,
304,
2479,
1495,
13,
4706,
396,
3695,
6389,
353,
12272,
29918,
16680,
29889,
5510,
29918,
5085,
7373,
9675,
29889,
19218,
29961,
29906,
29901,
2314,
13,
4706,
3646,
29918,
1272,
29889,
4990,
29918,
18279,
580,
13,
13,
1678,
822,
4235,
29898,
1311,
29892,
3646,
29918,
1272,
1125,
13,
4706,
9995,
9323,
278,
4235,
297,
278,
3646,
1272,
934,
1213,
15945,
13,
4706,
396,
10944,
292,
278,
2980,
411,
1192,
2794,
372,
29915,
29879,
13136,
13,
13,
4706,
1596,
28909,
29876,
4286,
7122,
29898,
5182,
29918,
1272,
29889,
657,
29918,
2671,
29918,
1761,
22130,
13,
13,
1678,
822,
1284,
29898,
1311,
29892,
3646,
29918,
1272,
1125,
13,
4706,
13812,
353,
903,
1191,
5510,
29889,
15730,
11726,
29898,
13,
9651,
6139,
2433,
12542,
263,
3153,
3495,
1495,
13,
4706,
13812,
29889,
1202,
29918,
23516,
877,
2974,
742,
13,
462,
9651,
1371,
2433,
6004,
5641,
3211,
304,
1284,
1495,
13,
4706,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29888,
742,
525,
489,
1445,
742,
13,
462,
9651,
2322,
2433,
5182,
1272,
29918,
4773,
29889,
7638,
742,
13,
462,
9651,
1371,
2433,
3434,
3871,
304,
2479,
1495,
13,
4706,
6389,
353,
13812,
29889,
5510,
29918,
5085,
7373,
9675,
29889,
19218,
29961,
29906,
29901,
2314,
13,
4706,
2407,
353,
3646,
29918,
1272,
29889,
657,
29918,
5182,
29898,
5085,
29889,
2974,
29897,
13,
13,
4706,
396,
14402,
5004,
679,
2407,
29871,
515,
2479,
2407,
869,
13,
4706,
565,
2407,
338,
6213,
29901,
13,
9651,
1596,
877,
29995,
29879,
451,
1476,
29915,
1273,
6389,
29889,
2974,
29897,
13,
4706,
1683,
29901,
13,
9651,
1596,
877,
29995,
29879,
1476,
29905,
29876,
29995,
29879,
29915,
1273,
313,
5085,
29889,
2974,
29892,
2407,
876,
13,
13,
1678,
822,
2407,
29898,
1311,
29892,
3646,
29918,
1272,
1125,
13,
4706,
9995,
13,
4706,
20969,
385,
1881,
9335,
363,
18982,
29889,
13,
4706,
9995,
13,
4706,
13812,
353,
903,
1191,
5510,
29889,
15730,
11726,
29898,
13,
9651,
6139,
2433,
1293,
5235,
373,
2323,
2407,
29918,
333,
1495,
13,
4706,
396,
10944,
292,
278,
2980,
411,
1192,
2794,
372,
29915,
29879,
13136,
13,
4706,
13812,
29889,
1202,
29918,
23516,
877,
11651,
29918,
333,
742,
1134,
29922,
524,
29892,
13,
462,
9651,
1371,
2433,
9182,
5163,
515,
278,
2566,
29889,
512,
371,
5743,
1495,
13,
4706,
13812,
29889,
1202,
29918,
23516,
877,
29899,
29888,
742,
525,
489,
1445,
742,
13,
462,
9651,
2322,
2433,
5182,
1272,
29918,
4773,
29889,
7638,
742,
13,
462,
9651,
1371,
2433,
3434,
3871,
304,
2479,
1495,
13,
4706,
6389,
353,
13812,
29889,
5510,
29918,
5085,
7373,
9675,
29889,
19218,
29961,
29906,
29901,
2314,
13,
13,
4706,
2407,
29918,
333,
353,
11860,
29906,
29889,
29906,
29879,
29908,
1273,
6389,
29889,
11651,
29918,
333,
13,
4706,
396,
14402,
679,
3495,
18999,
515,
1591,
13,
4706,
2407,
353,
3646,
29918,
1272,
29889,
657,
29918,
5182,
29898,
11651,
29918,
333,
29897,
13,
4706,
396,
14402,
5004,
679,
2407,
29871,
515,
2479,
2407,
869,
13,
4706,
565,
2407,
338,
6213,
29901,
13,
9651,
1596,
877,
9182,
1273,
29879,
451,
1476,
297,
17157,
29879,
848,
6169,
1273,
2407,
29918,
333,
29897,
13,
4706,
1683,
29901,
13,
9651,
4236,
29918,
2435,
353,
29871,
29900,
13,
9651,
363,
1820,
297,
2407,
29901,
13,
18884,
565,
4236,
29918,
2435,
529,
7431,
29898,
1989,
1125,
13,
462,
1678,
4236,
29918,
2435,
353,
7431,
29898,
1989,
29897,
13,
9651,
363,
1820,
297,
2407,
29901,
13,
18884,
1596,
877,
29995,
29930,
29879,
584,
1273,
29879,
29915,
1273,
313,
3317,
29918,
2435,
29892,
1820,
29892,
2407,
29961,
1989,
12622,
13,
2
] |
loadlib.py | mit-dci/litloadtest | 0 | 49041 | <reponame>mit-dci/litloadtest<gh_stars>0
import time
import random
import testlib
def square_pos(size, x, y):
return size * (y % size) + (x % size)
# Makes a big grid of nodes, all connected to their neighbors.
def make_grid_env(size):
print('Making grid env of size', size)
env = testlib.TestEnv(size ** 2)
for l in env.lits:
l.rpc.SetFee(Fee=5, CoinType=testlib.REGTEST_COINTYPE)
a = l.make_new_addr()
res = env.bitcoind.rpc.sendtoaddress(a, 10)
print('Funded', a, 'with', res)
env.generate_block()
for x in range(size):
for y in range(size):
pos = square_pos(size, x, y)
litat = env.lits[pos]
print(pos, ':', x, y, '->', str(litat.get_balance_info()))
if x > 0:
litl = env.lits[square_pos(size, x - 1, y)] # l = left
litat.connect_to_peer(litl)
litat.open_channel(litl, 100000000, 200000)
env.generate_block()
if y > 0:
litu = env.lits[square_pos(size, x, y - 1)] # u = up
litat.connect_to_peer(litu)
litat.open_channel(litu, 100000000, 200000)
env.generate_block()
env.generate_block(count=5)
return env
def random_node_pair(env):
x = random.randint(0, len(env.lits) - 1)
y = random.randint(0, len(env.lits) - 2)
if y >= x:
y += 1
return env.lits[x], env.lits[y]
| [
1,
529,
276,
1112,
420,
29958,
2415,
29899,
29881,
455,
29914,
19411,
1359,
1688,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
931,
13,
5215,
4036,
13,
13,
5215,
1243,
1982,
13,
13,
1753,
6862,
29918,
1066,
29898,
2311,
29892,
921,
29892,
343,
1125,
13,
1678,
736,
2159,
334,
313,
29891,
1273,
2159,
29897,
718,
313,
29916,
1273,
2159,
29897,
13,
13,
29937,
341,
6926,
263,
4802,
6856,
310,
7573,
29892,
599,
6631,
304,
1009,
22092,
943,
29889,
13,
1753,
1207,
29918,
7720,
29918,
6272,
29898,
2311,
1125,
13,
1678,
1596,
877,
29924,
5086,
6856,
8829,
310,
2159,
742,
2159,
29897,
13,
1678,
8829,
353,
1243,
1982,
29889,
3057,
21745,
29898,
2311,
3579,
29871,
29906,
29897,
13,
1678,
363,
301,
297,
8829,
29889,
29880,
1169,
29901,
13,
4706,
301,
29889,
29878,
6739,
29889,
2697,
29943,
3905,
29898,
29943,
3905,
29922,
29945,
29892,
3189,
262,
1542,
29922,
1688,
1982,
29889,
18166,
18267,
29918,
3217,
10192,
6959,
29897,
13,
4706,
263,
353,
301,
29889,
5675,
29918,
1482,
29918,
10030,
580,
13,
4706,
620,
353,
8829,
29889,
2966,
1111,
513,
29889,
29878,
6739,
29889,
6717,
517,
7328,
29898,
29874,
29892,
29871,
29896,
29900,
29897,
13,
4706,
1596,
877,
29943,
870,
287,
742,
263,
29892,
525,
2541,
742,
620,
29897,
13,
1678,
8829,
29889,
17158,
29918,
1271,
580,
13,
1678,
363,
921,
297,
3464,
29898,
2311,
1125,
13,
4706,
363,
343,
297,
3464,
29898,
2311,
1125,
13,
9651,
926,
353,
6862,
29918,
1066,
29898,
2311,
29892,
921,
29892,
343,
29897,
13,
9651,
301,
7366,
353,
8829,
29889,
29880,
1169,
29961,
1066,
29962,
13,
9651,
1596,
29898,
1066,
29892,
525,
29901,
742,
921,
29892,
343,
29892,
525,
976,
742,
851,
29898,
29880,
7366,
29889,
657,
29918,
5521,
749,
29918,
3888,
22130,
13,
9651,
565,
921,
1405,
29871,
29900,
29901,
13,
18884,
11872,
29880,
353,
8829,
29889,
29880,
1169,
29961,
17619,
29918,
1066,
29898,
2311,
29892,
921,
448,
29871,
29896,
29892,
343,
4638,
396,
301,
353,
2175,
13,
18884,
301,
7366,
29889,
6915,
29918,
517,
29918,
412,
261,
29898,
19411,
29880,
29897,
13,
18884,
301,
7366,
29889,
3150,
29918,
12719,
29898,
19411,
29880,
29892,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
29900,
29900,
29900,
29897,
13,
18884,
8829,
29889,
17158,
29918,
1271,
580,
13,
9651,
565,
343,
1405,
29871,
29900,
29901,
13,
18884,
301,
1981,
353,
8829,
29889,
29880,
1169,
29961,
17619,
29918,
1066,
29898,
2311,
29892,
921,
29892,
343,
448,
29871,
29896,
4638,
396,
318,
353,
701,
13,
18884,
301,
7366,
29889,
6915,
29918,
517,
29918,
412,
261,
29898,
29880,
1981,
29897,
13,
18884,
301,
7366,
29889,
3150,
29918,
12719,
29898,
29880,
1981,
29892,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
29900,
29900,
29900,
29897,
13,
18884,
8829,
29889,
17158,
29918,
1271,
580,
13,
1678,
8829,
29889,
17158,
29918,
1271,
29898,
2798,
29922,
29945,
29897,
13,
1678,
736,
8829,
13,
13,
1753,
4036,
29918,
3177,
29918,
18784,
29898,
6272,
1125,
13,
1678,
921,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
6272,
29889,
29880,
1169,
29897,
448,
29871,
29896,
29897,
13,
1678,
343,
353,
4036,
29889,
9502,
524,
29898,
29900,
29892,
7431,
29898,
6272,
29889,
29880,
1169,
29897,
448,
29871,
29906,
29897,
13,
1678,
565,
343,
6736,
921,
29901,
13,
4706,
343,
4619,
29871,
29896,
13,
1678,
736,
8829,
29889,
29880,
1169,
29961,
29916,
1402,
8829,
29889,
29880,
1169,
29961,
29891,
29962,
13,
2
] |
sunpy/map/sources/yohkoh.py | fluxtransport/sunpy | 0 | 1608553 | """Yohkoh SXT Map subclass definitions"""
__author__ = "<NAME>"
__email__ = "<EMAIL>"
import numpy as np
from astropy.visualization import PowerStretch
from astropy.visualization.mpl_normalize import ImageNormalize
from sunpy.map import GenericMap
from sunpy.map.sources.source_type import source_stretch
from sunpy.sun import constants
__all__ = ['SXTMap']
class SXTMap(GenericMap):
"""Yohkoh SXT Image Map
The Yohkoh Soft X-ray Telescope (SXT) the full solar disk
(42 x 42 arcminutes)in the 0.25 - 4.0 keV range.
It consists of a glancing incidence mirror and a CCD sensor and
used thin metallic filters to acquire images in restricted
portions of its energy range. SXT could resolve features down to 2.5
arcseconds. Information about the temperature and density of the plasma
emitting the observed x-rays was obtained by comparing images acquired with
the different filters. Images could be obtained every 2 to 8 seconds.
Smaller images with a single filter could be obtained as frequently as
once every 0.5 seconds.
Yohkoh was launched on 30 August 1991 and ceased operations on
14 December 2001.
References
----------
* `Yohkoh Mission Page <http://solar.physics.montana.edu/sxt/>`_
* `Fits header reference <http://proba2.oma.be/data/SWAP/level0>`_
* `Yohkoh Analysis Guide <http://ylstone.physics.montana.edu/ylegacy/yag.html>`_
"""
def __init__(self, data, header, **kwargs):
GenericMap.__init__(self, data, header, **kwargs)
self.meta['detector'] = "SXT"
self.meta['telescop'] = "Yohkoh"
self.plot_settings['cmap'] = 'yohkohsxt' + self.measurement[0:2].lower()
self.plot_settings['norm'] = ImageNormalize(
stretch=source_stretch(self.meta, PowerStretch(0.5)), clip=False)
# 2012/12/19 - the SXT headers do not have a value of the distance from
# the spacecraft to the center of the Sun. The FITS keyword 'DSUN_OBS'
# appears to refer to the observed diameter of the Sun. Until such
# time as that is calculated and properly included in the file, we will
# use simple trigonometry to calculate the distance of the center of
# the Sun from the spacecraft. Note that the small angle approximation
# is used, and the solar radius stored in SXT FITS files is in arcseconds.
self.meta['dsun_apparent'] = self.meta.get('dsun_apparent', constants.au)
if 'solar_r' in self.meta:
self.meta['dsun_apparent'] = constants.radius/(np.deg2rad(self.meta['solar_r']/3600.0))
@property
def dsun(self):
""" For Yohkoh Maps, dsun_obs is not always defined. Uses approximation
defined above it is not defined."""
return self.meta.get('dsun_obs', self.meta['dsun_apparent'])
@property
def measurement(self):
"""
Returns the type of data observed.
"""
s = self.meta.get('wavelnth', '')
if s == 'Al.1':
s = 'Al01'
elif s.lower() == 'open':
s = 'white-light'
return s
@classmethod
def is_datasource_for(cls, data, header, **kwargs):
"""Determines if header corresponds to an SXT image"""
return header.get('instrume') == 'SXT'
| [
1,
9995,
29979,
1148,
29895,
1148,
317,
12188,
7315,
19481,
15848,
15945,
29908,
13,
13,
1649,
8921,
1649,
353,
9872,
5813,
11903,
13,
1649,
5269,
1649,
353,
9872,
26862,
6227,
11903,
13,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
8717,
14441,
29889,
20119,
2133,
1053,
9206,
855,
10301,
13,
3166,
8717,
14441,
29889,
20119,
2133,
29889,
29885,
572,
29918,
8945,
675,
1053,
7084,
19077,
675,
13,
13,
3166,
6575,
2272,
29889,
1958,
1053,
3251,
293,
3388,
13,
3166,
6575,
2272,
29889,
1958,
29889,
29879,
2863,
29889,
4993,
29918,
1853,
1053,
2752,
29918,
303,
10301,
13,
3166,
6575,
2272,
29889,
11445,
1053,
17727,
13,
13,
1649,
497,
1649,
353,
6024,
29903,
12188,
3388,
2033,
13,
13,
13,
1990,
317,
12188,
3388,
29898,
15809,
3388,
1125,
13,
1678,
9995,
29979,
1148,
29895,
1148,
317,
12188,
7084,
7315,
13,
13,
1678,
450,
612,
1148,
29895,
1148,
1105,
615,
1060,
29899,
764,
323,
5830,
4338,
313,
29903,
12188,
29897,
278,
2989,
21635,
8086,
13,
1678,
313,
29946,
29906,
921,
29871,
29946,
29906,
15232,
1195,
2667,
29897,
262,
278,
29871,
29900,
29889,
29906,
29945,
448,
29871,
29946,
29889,
29900,
1589,
29963,
3464,
29889,
13,
1678,
739,
11624,
310,
263,
3144,
19985,
5528,
5084,
19571,
322,
263,
315,
6530,
23530,
322,
13,
1678,
1304,
16835,
1539,
497,
293,
18094,
304,
1274,
1548,
4558,
297,
22078,
13,
1678,
2011,
1080,
310,
967,
5864,
3464,
29889,
317,
12188,
1033,
8814,
5680,
1623,
304,
29871,
29906,
29889,
29945,
13,
1678,
15232,
23128,
29889,
10343,
1048,
278,
10430,
322,
9027,
310,
278,
715,
25392,
13,
1678,
953,
5367,
278,
8900,
921,
29899,
764,
29879,
471,
7625,
491,
17420,
4558,
16692,
411,
13,
1678,
278,
1422,
18094,
29889,
1954,
1179,
1033,
367,
7625,
1432,
29871,
29906,
304,
29871,
29947,
6923,
29889,
13,
1678,
4116,
12572,
4558,
411,
263,
2323,
4175,
1033,
367,
7625,
408,
13672,
408,
13,
1678,
2748,
1432,
29871,
29900,
29889,
29945,
6923,
29889,
13,
13,
1678,
612,
1148,
29895,
1148,
471,
15241,
373,
29871,
29941,
29900,
3111,
29871,
29896,
29929,
29929,
29896,
322,
24886,
6931,
373,
13,
268,
29896,
29946,
5846,
29871,
29906,
29900,
29900,
29896,
29889,
13,
13,
1678,
28318,
13,
1678,
448,
1378,
29899,
13,
1678,
334,
421,
29979,
1148,
29895,
1148,
18971,
9305,
529,
1124,
597,
2929,
279,
29889,
25105,
29889,
14132,
1648,
29889,
6085,
29914,
29879,
486,
3779,
29952,
29918,
13,
1678,
334,
421,
29943,
1169,
4839,
3407,
529,
1124,
597,
771,
2291,
29906,
29889,
4125,
29889,
915,
29914,
1272,
29914,
23066,
3301,
29914,
5563,
29900,
13885,
29918,
13,
1678,
334,
421,
29979,
1148,
29895,
1148,
24352,
16886,
529,
1124,
597,
2904,
12734,
29889,
25105,
29889,
14132,
1648,
29889,
6085,
29914,
29891,
1397,
4135,
29914,
29891,
351,
29889,
1420,
13885,
29918,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
848,
29892,
4839,
29892,
3579,
19290,
1125,
13,
13,
4706,
3251,
293,
3388,
17255,
2344,
12035,
1311,
29892,
848,
29892,
4839,
29892,
3579,
19290,
29897,
13,
13,
4706,
1583,
29889,
7299,
1839,
4801,
3019,
2033,
353,
376,
29903,
12188,
29908,
13,
4706,
1583,
29889,
7299,
1839,
29873,
5830,
9708,
2033,
353,
376,
29979,
1148,
29895,
1148,
29908,
13,
4706,
1583,
29889,
5317,
29918,
11027,
1839,
29883,
1958,
2033,
353,
525,
29891,
1148,
29895,
1148,
29879,
486,
29915,
718,
1583,
29889,
26658,
358,
29961,
29900,
29901,
29906,
1822,
13609,
580,
13,
4706,
1583,
29889,
5317,
29918,
11027,
1839,
12324,
2033,
353,
7084,
19077,
675,
29898,
13,
9651,
16116,
29922,
4993,
29918,
303,
10301,
29898,
1311,
29889,
7299,
29892,
9206,
855,
10301,
29898,
29900,
29889,
29945,
8243,
20102,
29922,
8824,
29897,
13,
13,
4706,
396,
29871,
29906,
29900,
29896,
29906,
29914,
29896,
29906,
29914,
29896,
29929,
448,
278,
317,
12188,
9066,
437,
451,
505,
263,
995,
310,
278,
5418,
515,
13,
4706,
396,
278,
2913,
17293,
304,
278,
4818,
310,
278,
8991,
29889,
29871,
450,
383,
1806,
29903,
13553,
525,
8452,
3904,
29918,
29949,
9851,
29915,
13,
4706,
396,
5692,
304,
2737,
304,
278,
8900,
24235,
310,
278,
8991,
29889,
29871,
28609,
1316,
13,
4706,
396,
931,
408,
393,
338,
12833,
322,
6284,
5134,
297,
278,
934,
29892,
591,
674,
13,
4706,
396,
671,
2560,
16222,
265,
7843,
304,
8147,
278,
5418,
310,
278,
4818,
310,
13,
4706,
396,
278,
8991,
515,
278,
2913,
17293,
29889,
29871,
3940,
393,
278,
2319,
10696,
16845,
13,
4706,
396,
338,
1304,
29892,
322,
278,
21635,
11855,
6087,
297,
317,
12188,
383,
1806,
29903,
2066,
338,
297,
15232,
23128,
29889,
13,
4706,
1583,
29889,
7299,
1839,
6289,
348,
29918,
932,
279,
296,
2033,
353,
1583,
29889,
7299,
29889,
657,
877,
6289,
348,
29918,
932,
279,
296,
742,
17727,
29889,
585,
29897,
13,
4706,
565,
525,
2929,
279,
29918,
29878,
29915,
297,
1583,
29889,
7299,
29901,
13,
9651,
1583,
29889,
7299,
1839,
6289,
348,
29918,
932,
279,
296,
2033,
353,
17727,
29889,
13471,
14571,
9302,
29889,
12163,
29906,
3665,
29898,
1311,
29889,
7299,
1839,
2929,
279,
29918,
29878,
2033,
29914,
29941,
29953,
29900,
29900,
29889,
29900,
876,
13,
13,
1678,
732,
6799,
13,
1678,
822,
270,
11445,
29898,
1311,
1125,
13,
4706,
9995,
1152,
612,
1148,
29895,
1148,
25846,
29892,
270,
11445,
29918,
26290,
338,
451,
2337,
3342,
29889,
10783,
267,
16845,
13,
4706,
3342,
2038,
372,
338,
451,
3342,
1213,
15945,
13,
4706,
736,
1583,
29889,
7299,
29889,
657,
877,
6289,
348,
29918,
26290,
742,
1583,
29889,
7299,
1839,
6289,
348,
29918,
932,
279,
296,
11287,
13,
13,
1678,
732,
6799,
13,
1678,
822,
20039,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
16969,
278,
1134,
310,
848,
8900,
29889,
13,
4706,
9995,
13,
4706,
269,
353,
1583,
29889,
7299,
29889,
657,
877,
29893,
485,
3478,
386,
742,
27255,
13,
4706,
565,
269,
1275,
525,
2499,
29889,
29896,
2396,
13,
9651,
269,
353,
525,
2499,
29900,
29896,
29915,
13,
4706,
25342,
269,
29889,
13609,
580,
1275,
525,
3150,
2396,
13,
9651,
269,
353,
525,
10921,
29899,
4366,
29915,
13,
4706,
736,
269,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
338,
29918,
14538,
1167,
29918,
1454,
29898,
25932,
29892,
848,
29892,
4839,
29892,
3579,
19290,
1125,
13,
4706,
9995,
6362,
837,
1475,
565,
4839,
16161,
304,
385,
317,
12188,
1967,
15945,
29908,
13,
4706,
736,
4839,
29889,
657,
877,
262,
710,
2017,
1495,
1275,
525,
29903,
12188,
29915,
13,
2
] |
Vini/Image/views.py | deeppudasaini/vini | 1 | 1610608 | <reponame>deeppudasaini/vini
from django.shortcuts import render
from django.http import JsonResponse
from .models import Image
from rest_framework.decorators import api_view
from rest_framework.response import Response
from .serializers import ImageSerializer
@api_view(["GET"])
def ImageList(request):
images = Image.objects.all()
serializer = ImageSerializer(images, many=True)
return Response(serializer.data)
@api_view(["GET"])
def ImageDetails(request, pk):
images = Image.objects.filter(id=pk)
serializer = ImageSerializer(images, many=True)
return Response(serializer.data)
@api_view(["POST"])
def ImageAdd(request):
serializer = ImageSerializer(data=request.data)
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
@api_view(["POST"])
def ImageUpdate(request, pk):
updatingImage = Image.objects.get(id=pk)
serializer = ImageSerializer(instance=updatingImage, data=request.data)
if serializer.is_valid():
serializer.save()
return Response(serializer.data)
@api_view(["DELETE"])
def ImageDelete(request, pk):
deletingImage = Image.objects.get(id=pk)
deletingImage.delete()
return Response("Image Deleted")
| [
1,
529,
276,
1112,
420,
29958,
311,
29872,
407,
566,
294,
475,
29875,
29914,
29894,
2172,
13,
3166,
9557,
29889,
12759,
7582,
29879,
1053,
4050,
13,
3166,
9557,
29889,
1124,
1053,
14355,
5103,
13,
3166,
869,
9794,
1053,
7084,
13,
3166,
1791,
29918,
4468,
29889,
19557,
4097,
1053,
7882,
29918,
1493,
13,
3166,
1791,
29918,
4468,
29889,
5327,
1053,
13291,
13,
3166,
869,
15550,
19427,
1053,
7084,
17679,
13,
13,
13,
29992,
2754,
29918,
1493,
29898,
3366,
7194,
20068,
13,
1753,
7084,
1293,
29898,
3827,
1125,
13,
1678,
4558,
353,
7084,
29889,
12650,
29889,
497,
580,
13,
1678,
7797,
3950,
353,
7084,
17679,
29898,
8346,
29892,
1784,
29922,
5574,
29897,
13,
1678,
736,
13291,
29898,
15550,
3950,
29889,
1272,
29897,
13,
13,
13,
29992,
2754,
29918,
1493,
29898,
3366,
7194,
20068,
13,
1753,
7084,
10602,
29898,
3827,
29892,
282,
29895,
1125,
13,
1678,
4558,
353,
7084,
29889,
12650,
29889,
4572,
29898,
333,
29922,
20571,
29897,
13,
1678,
7797,
3950,
353,
7084,
17679,
29898,
8346,
29892,
1784,
29922,
5574,
29897,
13,
1678,
736,
13291,
29898,
15550,
3950,
29889,
1272,
29897,
13,
13,
13,
29992,
2754,
29918,
1493,
29898,
3366,
5438,
20068,
13,
1753,
7084,
2528,
29898,
3827,
1125,
13,
13,
1678,
7797,
3950,
353,
7084,
17679,
29898,
1272,
29922,
3827,
29889,
1272,
29897,
13,
1678,
565,
7797,
3950,
29889,
275,
29918,
3084,
7295,
13,
4706,
7797,
3950,
29889,
7620,
580,
13,
1678,
736,
13291,
29898,
15550,
3950,
29889,
1272,
29897,
13,
13,
13,
29992,
2754,
29918,
1493,
29898,
3366,
5438,
20068,
13,
1753,
7084,
6422,
29898,
3827,
29892,
282,
29895,
1125,
13,
1678,
13271,
2940,
353,
7084,
29889,
12650,
29889,
657,
29898,
333,
29922,
20571,
29897,
13,
1678,
7797,
3950,
353,
7084,
17679,
29898,
8758,
29922,
786,
26747,
2940,
29892,
848,
29922,
3827,
29889,
1272,
29897,
13,
1678,
565,
7797,
3950,
29889,
275,
29918,
3084,
7295,
13,
13,
4706,
7797,
3950,
29889,
7620,
580,
13,
1678,
736,
13291,
29898,
15550,
3950,
29889,
1272,
29897,
13,
13,
13,
29992,
2754,
29918,
1493,
29898,
3366,
2287,
18476,
20068,
13,
1753,
7084,
12498,
29898,
3827,
29892,
282,
29895,
1125,
13,
1678,
21228,
2940,
353,
7084,
29889,
12650,
29889,
657,
29898,
333,
29922,
20571,
29897,
13,
1678,
21228,
2940,
29889,
8143,
580,
13,
13,
1678,
736,
13291,
703,
2940,
897,
22742,
1159,
13,
2
] |
slackchannel2pdf/locales.py | ErikKalkoken/slackchannel2pdf | 52 | 3128 | import datetime as dt
import logging
from babel import Locale, UnknownLocaleError
from babel.dates import format_datetime, format_time, format_date
import pytz
from tzlocal import get_localzone
from . import settings
logger = logging.getLogger(__name__)
class LocaleHelper:
"""Helpers for converting date & time according to current locale and timezone"""
def __init__(
self,
my_locale: Locale = None,
my_tz: pytz.BaseTzInfo = None,
author_info: dict = None,
) -> None:
"""
Args:
- my_locale: Primary locale to use
- my_tz: Primary timezone to use
- author_info: locale and timezone to use from this Slack response
if my_locale and/or my_tz are not given
"""
self._locale = self._determine_locale(my_locale, author_info)
self._timezone = self._determine_timezone(my_tz, author_info)
@staticmethod
def _determine_locale(my_locale: Locale = None, author_info: dict = None) -> Locale:
if my_locale:
if not isinstance(my_locale, Locale):
raise TypeError("my_locale must be a babel Locale object")
else:
if author_info:
try:
my_locale = Locale.parse(author_info["locale"], sep="-")
except UnknownLocaleError:
logger.warning("Could not use locale info from Slack")
my_locale = Locale.default()
else:
my_locale = Locale.default()
if not my_locale:
my_locale = Locale.parse(settings.FALLBACK_LOCALE)
return my_locale
@staticmethod
def _determine_timezone(
my_tz: pytz.BaseTzInfo = None, author_info: dict = None
) -> pytz.BaseTzInfo:
if my_tz:
if not isinstance(my_tz, pytz.BaseTzInfo):
raise TypeError("my_tz must be of type pytz")
else:
if author_info:
try:
my_tz = pytz.timezone(author_info["tz"])
except pytz.exceptions.UnknownTimeZoneError:
logger.warning("Could not use timezone info from Slack")
my_tz = get_localzone()
else:
my_tz = get_localzone()
if not my_tz:
my_tz = pytz.UTC
return my_tz
@property
def locale(self) -> Locale:
return self._locale
@property
def timezone(self) -> pytz.BaseTzInfo:
return self._timezone
def format_date_full_str(self, my_datetime: dt.datetime) -> str:
return format_date(my_datetime, format="full", locale=self.locale)
def format_datetime_str(self, my_datetime: dt.datetime) -> str:
"""returns formated datetime string for given dt using locale"""
return format_datetime(my_datetime, format="short", locale=self.locale)
def get_datetime_formatted_str(self, ts: int) -> str:
"""return given timestamp as formated datetime string using locale"""
my_datetime = self.get_datetime_from_ts(ts)
return format_datetime(my_datetime, format="short", locale=self.locale)
def get_time_formatted_str(self, ts: int) -> str:
"""return given timestamp as formated datetime string using locale"""
my_datetime = self.get_datetime_from_ts(ts)
return format_time(my_datetime, format="short", locale=self.locale)
def get_datetime_from_ts(self, ts: int) -> dt.datetime:
"""returns datetime object of a unix timestamp with local timezone"""
my_datetime = dt.datetime.fromtimestamp(float(ts), pytz.UTC)
return my_datetime.astimezone(self.timezone)
| [
1,
1053,
12865,
408,
11636,
13,
5215,
12183,
13,
13,
3166,
289,
1107,
1053,
5976,
744,
29892,
853,
5203,
3524,
744,
2392,
13,
3166,
289,
1107,
29889,
15190,
1053,
3402,
29918,
12673,
29892,
3402,
29918,
2230,
29892,
3402,
29918,
1256,
13,
5215,
282,
3637,
29920,
13,
3166,
260,
29920,
2997,
1053,
679,
29918,
2997,
8028,
13,
13,
3166,
869,
1053,
6055,
13,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
5976,
744,
10739,
29901,
13,
1678,
9995,
7658,
6774,
363,
17415,
2635,
669,
931,
5034,
304,
1857,
15068,
322,
29431,
15945,
29908,
13,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
590,
29918,
23337,
29901,
5976,
744,
353,
6213,
29892,
13,
4706,
590,
29918,
17559,
29901,
282,
3637,
29920,
29889,
5160,
29911,
29920,
3401,
353,
6213,
29892,
13,
4706,
4148,
29918,
3888,
29901,
9657,
353,
6213,
29892,
13,
1678,
1723,
1599,
6213,
29901,
13,
4706,
9995,
13,
4706,
826,
3174,
29901,
13,
4706,
448,
590,
29918,
23337,
29901,
28267,
15068,
304,
671,
13,
4706,
448,
590,
29918,
17559,
29901,
28267,
29431,
304,
671,
13,
4706,
448,
4148,
29918,
3888,
29901,
15068,
322,
29431,
304,
671,
515,
445,
317,
2364,
2933,
13,
4706,
565,
590,
29918,
23337,
322,
29914,
272,
590,
29918,
17559,
526,
451,
2183,
13,
4706,
9995,
13,
4706,
1583,
3032,
23337,
353,
1583,
3032,
4801,
837,
457,
29918,
23337,
29898,
1357,
29918,
23337,
29892,
4148,
29918,
3888,
29897,
13,
4706,
1583,
3032,
2230,
8028,
353,
1583,
3032,
4801,
837,
457,
29918,
2230,
8028,
29898,
1357,
29918,
17559,
29892,
4148,
29918,
3888,
29897,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
4801,
837,
457,
29918,
23337,
29898,
1357,
29918,
23337,
29901,
5976,
744,
353,
6213,
29892,
4148,
29918,
3888,
29901,
9657,
353,
6213,
29897,
1599,
5976,
744,
29901,
13,
4706,
565,
590,
29918,
23337,
29901,
13,
9651,
565,
451,
338,
8758,
29898,
1357,
29918,
23337,
29892,
5976,
744,
1125,
13,
18884,
12020,
20948,
703,
1357,
29918,
23337,
1818,
367,
263,
289,
1107,
5976,
744,
1203,
1159,
13,
4706,
1683,
29901,
13,
9651,
565,
4148,
29918,
3888,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
590,
29918,
23337,
353,
5976,
744,
29889,
5510,
29898,
8921,
29918,
3888,
3366,
23337,
12436,
16345,
543,
29899,
1159,
13,
18884,
5174,
853,
5203,
3524,
744,
2392,
29901,
13,
462,
1678,
17927,
29889,
27392,
703,
23323,
451,
671,
15068,
5235,
515,
317,
2364,
1159,
13,
462,
1678,
590,
29918,
23337,
353,
5976,
744,
29889,
4381,
580,
13,
9651,
1683,
29901,
13,
18884,
590,
29918,
23337,
353,
5976,
744,
29889,
4381,
580,
13,
4706,
565,
451,
590,
29918,
23337,
29901,
13,
9651,
590,
29918,
23337,
353,
5976,
744,
29889,
5510,
29898,
11027,
29889,
29943,
9818,
29933,
11375,
29918,
3927,
5454,
1307,
29897,
13,
4706,
736,
590,
29918,
23337,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
903,
4801,
837,
457,
29918,
2230,
8028,
29898,
13,
4706,
590,
29918,
17559,
29901,
282,
3637,
29920,
29889,
5160,
29911,
29920,
3401,
353,
6213,
29892,
4148,
29918,
3888,
29901,
9657,
353,
6213,
13,
1678,
1723,
1599,
282,
3637,
29920,
29889,
5160,
29911,
29920,
3401,
29901,
13,
4706,
565,
590,
29918,
17559,
29901,
13,
9651,
565,
451,
338,
8758,
29898,
1357,
29918,
17559,
29892,
282,
3637,
29920,
29889,
5160,
29911,
29920,
3401,
1125,
13,
18884,
12020,
20948,
703,
1357,
29918,
17559,
1818,
367,
310,
1134,
282,
3637,
29920,
1159,
13,
4706,
1683,
29901,
13,
9651,
565,
4148,
29918,
3888,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
590,
29918,
17559,
353,
282,
3637,
29920,
29889,
2230,
8028,
29898,
8921,
29918,
3888,
3366,
17559,
20068,
13,
18884,
5174,
282,
3637,
29920,
29889,
11739,
29879,
29889,
14148,
2481,
18482,
2392,
29901,
13,
462,
1678,
17927,
29889,
27392,
703,
23323,
451,
671,
29431,
5235,
515,
317,
2364,
1159,
13,
462,
1678,
590,
29918,
17559,
353,
679,
29918,
2997,
8028,
580,
13,
9651,
1683,
29901,
13,
18884,
590,
29918,
17559,
353,
679,
29918,
2997,
8028,
580,
13,
4706,
565,
451,
590,
29918,
17559,
29901,
13,
9651,
590,
29918,
17559,
353,
282,
3637,
29920,
29889,
26913,
13,
4706,
736,
590,
29918,
17559,
13,
13,
1678,
732,
6799,
13,
1678,
822,
15068,
29898,
1311,
29897,
1599,
5976,
744,
29901,
13,
4706,
736,
1583,
3032,
23337,
13,
13,
1678,
732,
6799,
13,
1678,
822,
29431,
29898,
1311,
29897,
1599,
282,
3637,
29920,
29889,
5160,
29911,
29920,
3401,
29901,
13,
4706,
736,
1583,
3032,
2230,
8028,
13,
13,
1678,
822,
3402,
29918,
1256,
29918,
8159,
29918,
710,
29898,
1311,
29892,
590,
29918,
12673,
29901,
11636,
29889,
12673,
29897,
1599,
851,
29901,
13,
4706,
736,
3402,
29918,
1256,
29898,
1357,
29918,
12673,
29892,
3402,
543,
8159,
613,
15068,
29922,
1311,
29889,
23337,
29897,
13,
13,
1678,
822,
3402,
29918,
12673,
29918,
710,
29898,
1311,
29892,
590,
29918,
12673,
29901,
11636,
29889,
12673,
29897,
1599,
851,
29901,
13,
4706,
9995,
18280,
883,
630,
12865,
1347,
363,
2183,
11636,
773,
15068,
15945,
29908,
13,
4706,
736,
3402,
29918,
12673,
29898,
1357,
29918,
12673,
29892,
3402,
543,
12759,
613,
15068,
29922,
1311,
29889,
23337,
29897,
13,
13,
1678,
822,
679,
29918,
12673,
29918,
689,
19667,
29918,
710,
29898,
1311,
29892,
18696,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
2457,
2183,
14334,
408,
883,
630,
12865,
1347,
773,
15068,
15945,
29908,
13,
4706,
590,
29918,
12673,
353,
1583,
29889,
657,
29918,
12673,
29918,
3166,
29918,
1372,
29898,
1372,
29897,
13,
4706,
736,
3402,
29918,
12673,
29898,
1357,
29918,
12673,
29892,
3402,
543,
12759,
613,
15068,
29922,
1311,
29889,
23337,
29897,
13,
13,
1678,
822,
679,
29918,
2230,
29918,
689,
19667,
29918,
710,
29898,
1311,
29892,
18696,
29901,
938,
29897,
1599,
851,
29901,
13,
4706,
9995,
2457,
2183,
14334,
408,
883,
630,
12865,
1347,
773,
15068,
15945,
29908,
13,
4706,
590,
29918,
12673,
353,
1583,
29889,
657,
29918,
12673,
29918,
3166,
29918,
1372,
29898,
1372,
29897,
13,
4706,
736,
3402,
29918,
2230,
29898,
1357,
29918,
12673,
29892,
3402,
543,
12759,
613,
15068,
29922,
1311,
29889,
23337,
29897,
13,
13,
1678,
822,
679,
29918,
12673,
29918,
3166,
29918,
1372,
29898,
1311,
29892,
18696,
29901,
938,
29897,
1599,
11636,
29889,
12673,
29901,
13,
4706,
9995,
18280,
12865,
1203,
310,
263,
28167,
14334,
411,
1887,
29431,
15945,
29908,
13,
4706,
590,
29918,
12673,
353,
11636,
29889,
12673,
29889,
3166,
16394,
29898,
7411,
29898,
1372,
511,
282,
3637,
29920,
29889,
26913,
29897,
13,
4706,
736,
590,
29918,
12673,
29889,
579,
603,
8028,
29898,
1311,
29889,
2230,
8028,
29897,
13,
2
] |
Wattpad download.py | jbzdarkid/Random | 1 | 70267 | <filename>Wattpad download.py
import urllib2, re
output = '\n\n'
url = '76273009-wereling-wounded-on-hold-prologue'
page = 1
title = None
while(True):
text = urllib2.urlopen('http://www.wattpad.com/'+url+'/page/'+str(page)).read()
new_title = re.search('<title>(.*?)</title>', text).group(1)
if new_title == title: # Reached page limit
page = 1
next_url = re.search('<a class="on-navigate next-up.*?href="(.*?)"', text)
if next_url is None:
break
url = next_url.group(1)
output += '\n\n\t'+title+'\n'
continue
else: # New page
print new_title, len(text)
page += 1
title = new_title
for i in range(len(text)):
if text[i:i+7] == '<p data':
i += 48
while (text[i:i+4] != '</p>'):
output += text[i]
i += 1
output += '\n'
f = open('out.txt', 'wb')
f.write(output)
f.close() | [
1,
529,
9507,
29958,
29956,
1131,
8305,
5142,
29889,
2272,
13,
5215,
3142,
1982,
29906,
29892,
337,
13,
4905,
353,
11297,
29876,
29905,
29876,
29915,
13,
2271,
353,
525,
29955,
29953,
29906,
29955,
29941,
29900,
29900,
29929,
29899,
556,
14067,
29899,
29893,
7261,
29899,
265,
29899,
8948,
29899,
771,
1188,
434,
29915,
13,
3488,
353,
29871,
29896,
13,
3257,
353,
6213,
13,
8000,
29898,
5574,
1125,
13,
12,
726,
353,
3142,
1982,
29906,
29889,
332,
417,
2238,
877,
1124,
597,
1636,
29889,
29893,
1131,
8305,
29889,
510,
29914,
18717,
2271,
23097,
29914,
3488,
29914,
18717,
710,
29898,
3488,
8106,
949,
580,
13,
12,
1482,
29918,
3257,
353,
337,
29889,
4478,
877,
29966,
3257,
5961,
5575,
7897,
829,
3257,
29958,
742,
1426,
467,
2972,
29898,
29896,
29897,
13,
12,
361,
716,
29918,
3257,
1275,
3611,
29901,
396,
830,
3791,
1813,
4046,
13,
12,
12,
3488,
353,
29871,
29896,
13,
12,
12,
4622,
29918,
2271,
353,
337,
29889,
4478,
877,
29966,
29874,
770,
543,
265,
29899,
29876,
3723,
403,
2446,
29899,
786,
5575,
29973,
12653,
543,
28104,
29973,
5513,
742,
1426,
29897,
13,
12,
12,
361,
2446,
29918,
2271,
338,
6213,
29901,
13,
12,
12,
12,
8690,
13,
12,
12,
2271,
353,
2446,
29918,
2271,
29889,
2972,
29898,
29896,
29897,
13,
12,
12,
4905,
4619,
11297,
29876,
29905,
29876,
29905,
29873,
18717,
3257,
29974,
12764,
29876,
29915,
13,
12,
12,
19878,
13,
12,
2870,
29901,
396,
1570,
1813,
13,
12,
12,
2158,
716,
29918,
3257,
29892,
7431,
29898,
726,
29897,
13,
12,
12,
3488,
4619,
29871,
29896,
13,
12,
12,
3257,
353,
716,
29918,
3257,
13,
12,
13,
12,
1454,
474,
297,
3464,
29898,
2435,
29898,
726,
22164,
13,
12,
12,
361,
1426,
29961,
29875,
29901,
29875,
29974,
29955,
29962,
1275,
12801,
29886,
848,
2396,
13,
12,
12,
12,
29875,
4619,
29871,
29946,
29947,
13,
12,
12,
12,
8000,
313,
726,
29961,
29875,
29901,
29875,
29974,
29946,
29962,
2804,
525,
829,
29886,
16299,
1125,
13,
12,
12,
12,
12,
4905,
4619,
1426,
29961,
29875,
29962,
13,
12,
12,
12,
12,
29875,
4619,
29871,
29896,
13,
12,
12,
12,
4905,
4619,
11297,
29876,
29915,
13,
29888,
353,
1722,
877,
449,
29889,
3945,
742,
525,
29893,
29890,
1495,
13,
29888,
29889,
3539,
29898,
4905,
29897,
13,
29888,
29889,
5358,
580,
2
] |
engine.py | anazalea/zestlife | 0 | 161254 | <gh_stars>0
from entities.environment import GameEnvironment
class Engine():
def draw_background():
"""draw any non-interactive object"""
pass
def tick(e: GameEnvironment):
"""Update the state every entity in the game"""
for o in e.game_objects:
o.update()
o.move()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
16212,
29889,
20944,
1053,
8448,
18649,
13,
13,
13,
1990,
10863,
7295,
13,
13,
1678,
822,
4216,
29918,
7042,
7295,
13,
4706,
9995,
4012,
738,
1661,
29899,
1639,
4925,
1203,
15945,
29908,
13,
4706,
1209,
13,
13,
13,
1678,
822,
16892,
29898,
29872,
29901,
8448,
18649,
1125,
13,
4706,
9995,
6422,
278,
2106,
1432,
7855,
297,
278,
3748,
15945,
29908,
13,
4706,
363,
288,
297,
321,
29889,
11802,
29918,
12650,
29901,
13,
9651,
288,
29889,
5504,
580,
13,
9651,
288,
29889,
11631,
580,
13,
2
] |
wsnsims/tocs/energy.py | king4arabs/wsnsims2 | 2 | 174779 | <reponame>king4arabs/wsnsims2
import itertools
import numpy as np
from wsnsims.core.data import segment_volume
class ToCSEnergyModelError(Exception):
pass
class ToCSEnergyModel(object):
def __init__(self, simulation_data, environment):
"""
:param simulation_data:
:type simulation_data: tocs.tocs_sim.TOCS
:param environment:
:type environment: core.environment.Environment
"""
self.sim = simulation_data
self.env = environment
self._ids_to_clusters = {}
self._ids_to_movement_energy = {}
self._ids_to_comms_energy = {}
def cluster_data_volume(self, cluster_id, intercluster_only=False):
"""
:param cluster_id:
:param intercluster_only:
:return:
:rtype: pq.bit
"""
cluster = self._find_cluster(cluster_id)
if not intercluster_only:
# Handle the intra-cluster data volume
segment_pairs = itertools.permutations(cluster.segments, 2)
internal_volume = np.sum(
[segment_volume(s, d, self.env) for s, d in segment_pairs])
else:
internal_volume = 0
# Handle the inter-cluster data volume
external_segments = list(
set(self.sim.segments) - set(cluster.segments))
# Outgoing data ...
segment_pairs = list(
itertools.product(cluster.segments, external_segments))
# Incoming data ...
segment_pairs += list(
itertools.product(external_segments, cluster.segments))
external_volume = np.sum(
[segment_volume(s, d, self.env) for s, d in segment_pairs])
total_volume = internal_volume + external_volume
return total_volume
def centroid_data_volume(self, cluster_id):
"""
:param cluster_id:
:return:
:rtype: pq.bit
"""
centroid = self._find_cluster(cluster_id)
# Handle the intra-centroid data volume
segment_pairs = itertools.permutations(centroid.segments, 2)
volume = np.sum(
[segment_volume(s, d, self.env) for s, d in segment_pairs])
cluster_pairs = list()
# Handle the incoming volume from each cluster
for cluster in self.sim.clusters:
other_clusters = list(self.sim.clusters)
for other_cluster in other_clusters:
# Cluster -> Other Cluster
cluster_pairs.append((cluster, other_cluster))
# Other Cluster -> Cluster
cluster_pairs.append((other_cluster, cluster))
for src_cluster, dst_cluster in cluster_pairs:
src_segments = src_cluster.segments
dst_segments = dst_cluster.segments
segment_pairs = itertools.product(src_segments, dst_segments)
volume += np.sum(
[segment_volume(s, d, self.env) for s, d in segment_pairs])
return volume
def total_comms_energy(self, cluster_id):
if cluster_id in self._ids_to_comms_energy:
return self._ids_to_comms_energy[cluster_id]
if cluster_id == self.sim.centroid.cluster_id:
data_volume = self.centroid_data_volume(cluster_id)
else:
data_volume = self.cluster_data_volume(cluster_id)
energy = data_volume * self.env.comms_cost
self._ids_to_comms_energy[cluster_id] = energy
return energy
def _find_cluster(self, cluster_id):
"""
:param cluster_id:
:return:
:rtype: tocs.cluster.ToCSCluster
"""
if cluster_id in self._ids_to_clusters:
return self._ids_to_clusters[cluster_id]
found_cluster = None
for clust in self.sim.clusters + [self.sim.centroid]:
if clust.cluster_id == cluster_id:
found_cluster = clust
break
if not found_cluster:
raise ToCSEnergyModelError(
"Could not find cluster {}".format(cluster_id))
self._ids_to_clusters[cluster_id] = found_cluster
return found_cluster
def total_movement_energy(self, cluster_id):
"""
Return the amount of energy required to complete a single tour of the
specified cluster.
:param cluster_id: The numeric identifier of the cluster.
:return: The amount of energy required.
:rtype: pq.J
"""
if cluster_id in self._ids_to_movement_energy:
return self._ids_to_movement_energy[cluster_id]
current_cluster = self._find_cluster(cluster_id)
energy = current_cluster.tour_length * self.env.move_cost
self._ids_to_movement_energy[cluster_id] = energy
return energy
def total_energy(self, cluster_id):
"""
Get the sum of communication and movement energy for the given cluster.
:param cluster_id:
:return:
:rtype: pq.J
"""
energy = self.total_comms_energy(cluster_id)
energy += self.total_movement_energy(cluster_id)
return energy
| [
1,
529,
276,
1112,
420,
29958,
9292,
29946,
279,
6897,
29914,
5652,
1983,
9893,
29906,
13,
5215,
4256,
8504,
13,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
16904,
1983,
9893,
29889,
3221,
29889,
1272,
1053,
10768,
29918,
24623,
13,
13,
13,
1990,
1763,
29907,
1660,
1089,
1927,
3195,
2392,
29898,
2451,
1125,
13,
1678,
1209,
13,
13,
13,
1990,
1763,
29907,
1660,
1089,
1927,
3195,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
17402,
29918,
1272,
29892,
5177,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
3207,
17402,
29918,
1272,
29901,
13,
4706,
584,
1853,
17402,
29918,
1272,
29901,
304,
2395,
29889,
517,
2395,
29918,
3601,
29889,
4986,
9295,
13,
4706,
584,
3207,
5177,
29901,
13,
4706,
584,
1853,
5177,
29901,
7136,
29889,
20944,
29889,
18649,
13,
4706,
9995,
13,
13,
4706,
1583,
29889,
3601,
353,
17402,
29918,
1272,
13,
4706,
1583,
29889,
6272,
353,
5177,
13,
13,
4706,
1583,
3032,
4841,
29918,
517,
29918,
695,
504,
414,
353,
6571,
13,
4706,
1583,
3032,
4841,
29918,
517,
29918,
13529,
882,
29918,
27548,
353,
6571,
13,
4706,
1583,
3032,
4841,
29918,
517,
29918,
510,
1516,
29918,
27548,
353,
6571,
13,
13,
1678,
822,
9867,
29918,
1272,
29918,
24623,
29898,
1311,
29892,
9867,
29918,
333,
29892,
1006,
19594,
29918,
6194,
29922,
8824,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
3207,
9867,
29918,
333,
29901,
13,
4706,
584,
3207,
1006,
19594,
29918,
6194,
29901,
13,
4706,
584,
2457,
29901,
13,
4706,
584,
29878,
1853,
29901,
282,
29939,
29889,
2966,
13,
4706,
9995,
13,
13,
4706,
9867,
353,
1583,
3032,
2886,
29918,
19594,
29898,
19594,
29918,
333,
29897,
13,
13,
4706,
565,
451,
1006,
19594,
29918,
6194,
29901,
13,
9651,
396,
29273,
278,
938,
336,
29899,
19594,
848,
7977,
13,
9651,
10768,
29918,
29886,
7121,
353,
4256,
8504,
29889,
546,
6149,
800,
29898,
19594,
29889,
10199,
1860,
29892,
29871,
29906,
29897,
13,
9651,
7463,
29918,
24623,
353,
7442,
29889,
2083,
29898,
13,
18884,
518,
28192,
29918,
24623,
29898,
29879,
29892,
270,
29892,
1583,
29889,
6272,
29897,
363,
269,
29892,
270,
297,
10768,
29918,
29886,
7121,
2314,
13,
4706,
1683,
29901,
13,
9651,
7463,
29918,
24623,
353,
29871,
29900,
13,
13,
4706,
396,
29273,
278,
1006,
29899,
19594,
848,
7977,
13,
13,
4706,
7029,
29918,
10199,
1860,
353,
1051,
29898,
13,
9651,
731,
29898,
1311,
29889,
3601,
29889,
10199,
1860,
29897,
448,
731,
29898,
19594,
29889,
10199,
1860,
876,
13,
4706,
396,
4451,
17696,
848,
2023,
13,
4706,
10768,
29918,
29886,
7121,
353,
1051,
29898,
13,
9651,
4256,
8504,
29889,
4704,
29898,
19594,
29889,
10199,
1860,
29892,
7029,
29918,
10199,
1860,
876,
13,
13,
4706,
396,
512,
11506,
848,
2023,
13,
4706,
10768,
29918,
29886,
7121,
4619,
1051,
29898,
13,
9651,
4256,
8504,
29889,
4704,
29898,
23176,
29918,
10199,
1860,
29892,
9867,
29889,
10199,
1860,
876,
13,
4706,
7029,
29918,
24623,
353,
7442,
29889,
2083,
29898,
13,
9651,
518,
28192,
29918,
24623,
29898,
29879,
29892,
270,
29892,
1583,
29889,
6272,
29897,
363,
269,
29892,
270,
297,
10768,
29918,
29886,
7121,
2314,
13,
13,
4706,
3001,
29918,
24623,
353,
7463,
29918,
24623,
718,
7029,
29918,
24623,
13,
4706,
736,
3001,
29918,
24623,
13,
13,
1678,
822,
1644,
1007,
29918,
1272,
29918,
24623,
29898,
1311,
29892,
9867,
29918,
333,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
3207,
9867,
29918,
333,
29901,
13,
4706,
584,
2457,
29901,
13,
4706,
584,
29878,
1853,
29901,
282,
29939,
29889,
2966,
13,
4706,
9995,
13,
13,
4706,
1644,
1007,
353,
1583,
3032,
2886,
29918,
19594,
29898,
19594,
29918,
333,
29897,
13,
13,
4706,
396,
29273,
278,
938,
336,
29899,
1760,
1007,
848,
7977,
13,
4706,
10768,
29918,
29886,
7121,
353,
4256,
8504,
29889,
546,
6149,
800,
29898,
1760,
1007,
29889,
10199,
1860,
29892,
29871,
29906,
29897,
13,
4706,
7977,
353,
7442,
29889,
2083,
29898,
13,
9651,
518,
28192,
29918,
24623,
29898,
29879,
29892,
270,
29892,
1583,
29889,
6272,
29897,
363,
269,
29892,
270,
297,
10768,
29918,
29886,
7121,
2314,
13,
13,
4706,
9867,
29918,
29886,
7121,
353,
1051,
580,
13,
4706,
396,
29273,
278,
23235,
7977,
515,
1269,
9867,
13,
4706,
363,
9867,
297,
1583,
29889,
3601,
29889,
695,
504,
414,
29901,
13,
13,
9651,
916,
29918,
695,
504,
414,
353,
1051,
29898,
1311,
29889,
3601,
29889,
695,
504,
414,
29897,
13,
9651,
363,
916,
29918,
19594,
297,
916,
29918,
695,
504,
414,
29901,
13,
18884,
396,
2233,
5402,
1599,
5901,
2233,
5402,
13,
18884,
9867,
29918,
29886,
7121,
29889,
4397,
3552,
19594,
29892,
916,
29918,
19594,
876,
13,
13,
18884,
396,
5901,
2233,
5402,
1599,
2233,
5402,
13,
18884,
9867,
29918,
29886,
7121,
29889,
4397,
3552,
1228,
29918,
19594,
29892,
9867,
876,
13,
13,
4706,
363,
4765,
29918,
19594,
29892,
29743,
29918,
19594,
297,
9867,
29918,
29886,
7121,
29901,
13,
9651,
4765,
29918,
10199,
1860,
353,
4765,
29918,
19594,
29889,
10199,
1860,
13,
9651,
29743,
29918,
10199,
1860,
353,
29743,
29918,
19594,
29889,
10199,
1860,
13,
13,
9651,
10768,
29918,
29886,
7121,
353,
4256,
8504,
29889,
4704,
29898,
4351,
29918,
10199,
1860,
29892,
29743,
29918,
10199,
1860,
29897,
13,
9651,
7977,
4619,
7442,
29889,
2083,
29898,
13,
18884,
518,
28192,
29918,
24623,
29898,
29879,
29892,
270,
29892,
1583,
29889,
6272,
29897,
363,
269,
29892,
270,
297,
10768,
29918,
29886,
7121,
2314,
13,
13,
4706,
736,
7977,
13,
13,
1678,
822,
3001,
29918,
510,
1516,
29918,
27548,
29898,
1311,
29892,
9867,
29918,
333,
1125,
13,
13,
4706,
565,
9867,
29918,
333,
297,
1583,
3032,
4841,
29918,
517,
29918,
510,
1516,
29918,
27548,
29901,
13,
9651,
736,
1583,
3032,
4841,
29918,
517,
29918,
510,
1516,
29918,
27548,
29961,
19594,
29918,
333,
29962,
13,
13,
4706,
565,
9867,
29918,
333,
1275,
1583,
29889,
3601,
29889,
1760,
1007,
29889,
19594,
29918,
333,
29901,
13,
9651,
848,
29918,
24623,
353,
1583,
29889,
1760,
1007,
29918,
1272,
29918,
24623,
29898,
19594,
29918,
333,
29897,
13,
4706,
1683,
29901,
13,
9651,
848,
29918,
24623,
353,
1583,
29889,
19594,
29918,
1272,
29918,
24623,
29898,
19594,
29918,
333,
29897,
13,
13,
4706,
5864,
353,
848,
29918,
24623,
334,
1583,
29889,
6272,
29889,
510,
1516,
29918,
18253,
13,
4706,
1583,
3032,
4841,
29918,
517,
29918,
510,
1516,
29918,
27548,
29961,
19594,
29918,
333,
29962,
353,
5864,
13,
13,
4706,
736,
5864,
13,
13,
1678,
822,
903,
2886,
29918,
19594,
29898,
1311,
29892,
9867,
29918,
333,
1125,
13,
4706,
9995,
13,
13,
4706,
584,
3207,
9867,
29918,
333,
29901,
13,
4706,
584,
2457,
29901,
13,
4706,
584,
29878,
1853,
29901,
304,
2395,
29889,
19594,
29889,
1762,
9295,
6821,
5402,
13,
4706,
9995,
13,
4706,
565,
9867,
29918,
333,
297,
1583,
3032,
4841,
29918,
517,
29918,
695,
504,
414,
29901,
13,
9651,
736,
1583,
3032,
4841,
29918,
517,
29918,
695,
504,
414,
29961,
19594,
29918,
333,
29962,
13,
13,
4706,
1476,
29918,
19594,
353,
6213,
13,
4706,
363,
16993,
297,
1583,
29889,
3601,
29889,
695,
504,
414,
718,
518,
1311,
29889,
3601,
29889,
1760,
1007,
5387,
13,
9651,
565,
16993,
29889,
19594,
29918,
333,
1275,
9867,
29918,
333,
29901,
13,
18884,
1476,
29918,
19594,
353,
16993,
13,
18884,
2867,
13,
13,
4706,
565,
451,
1476,
29918,
19594,
29901,
13,
9651,
12020,
1763,
29907,
1660,
1089,
1927,
3195,
2392,
29898,
13,
18884,
376,
23323,
451,
1284,
9867,
6571,
1642,
4830,
29898,
19594,
29918,
333,
876,
13,
13,
4706,
1583,
3032,
4841,
29918,
517,
29918,
695,
504,
414,
29961,
19594,
29918,
333,
29962,
353,
1476,
29918,
19594,
13,
4706,
736,
1476,
29918,
19594,
13,
13,
1678,
822,
3001,
29918,
13529,
882,
29918,
27548,
29898,
1311,
29892,
9867,
29918,
333,
1125,
13,
4706,
9995,
13,
4706,
7106,
278,
5253,
310,
5864,
3734,
304,
4866,
263,
2323,
6282,
310,
278,
13,
4706,
6790,
9867,
29889,
13,
13,
4706,
584,
3207,
9867,
29918,
333,
29901,
450,
16985,
15882,
310,
278,
9867,
29889,
13,
13,
4706,
584,
2457,
29901,
450,
5253,
310,
5864,
3734,
29889,
13,
4706,
584,
29878,
1853,
29901,
282,
29939,
29889,
29967,
13,
4706,
9995,
13,
13,
4706,
565,
9867,
29918,
333,
297,
1583,
3032,
4841,
29918,
517,
29918,
13529,
882,
29918,
27548,
29901,
13,
9651,
736,
1583,
3032,
4841,
29918,
517,
29918,
13529,
882,
29918,
27548,
29961,
19594,
29918,
333,
29962,
13,
13,
4706,
1857,
29918,
19594,
353,
1583,
3032,
2886,
29918,
19594,
29898,
19594,
29918,
333,
29897,
13,
4706,
5864,
353,
1857,
29918,
19594,
29889,
29873,
473,
29918,
2848,
334,
1583,
29889,
6272,
29889,
11631,
29918,
18253,
13,
4706,
1583,
3032,
4841,
29918,
517,
29918,
13529,
882,
29918,
27548,
29961,
19594,
29918,
333,
29962,
353,
5864,
13,
4706,
736,
5864,
13,
13,
1678,
822,
3001,
29918,
27548,
29898,
1311,
29892,
9867,
29918,
333,
1125,
13,
4706,
9995,
13,
4706,
3617,
278,
2533,
310,
12084,
322,
10298,
5864,
363,
278,
2183,
9867,
29889,
13,
13,
4706,
584,
3207,
9867,
29918,
333,
29901,
13,
4706,
584,
2457,
29901,
13,
4706,
584,
29878,
1853,
29901,
282,
29939,
29889,
29967,
13,
4706,
9995,
13,
13,
4706,
5864,
353,
1583,
29889,
7827,
29918,
510,
1516,
29918,
27548,
29898,
19594,
29918,
333,
29897,
13,
4706,
5864,
4619,
1583,
29889,
7827,
29918,
13529,
882,
29918,
27548,
29898,
19594,
29918,
333,
29897,
13,
4706,
736,
5864,
13,
2
] |
horo_M5/ap_httpd_constel.py | kcfkwok2003/m5_star_navigator | 0 | 148420 | <filename>horo_M5/ap_httpd_constel.py<gh_stars>0
# ap_httpd_constel.py
version="1.0"
from color import *
import time
import gc
from httpd_util import *
from g_stars_1 import ct
USE_THREAD = False
def main(vs):
global var_store
var_store=vs
start_httpd()
def start_httpd():
global var_store
horo_main = var_store['horo_main']
tft = var_store['tft']
info = horo_main.info
apname = info['apname']
ip = info['ip']
tft.fill_rect(20,100,200,100,NAVY)
tft.rect(20,100,200,100,LIME)
tft.text(apname, 25,110, color=WHITE)
tft.text(ip, 25,120,color=WHITE)
tft.text('starting httpd constel',25,130,color=WHITE)
if USE_THREAD:
import _thread
_thread.start_new_thread(_httpd,())
else:
_httpd()
HTML_CONSTELS="""
<html>
<head><title>Constellations</title></head>
<body>
<h2>Select Constellation</h2>
<form action="/constels" method="get">
<table>
<tr><td>%(constels)s</td></tr>
<tr>
<td>
<input type="Submit" value="submit"
</td>
</tr>
</table>
</form>
<br>
<br>
<br>
<a href="/">Refresh</a>
<br>
</body>
</html>
"""
HTML_CONSTEL="""
<html>
<head><title>Constellation</title></head>
<body>
<h2>Constellation</h2>
<table>
<tr><td>%(ct)s</td></tr>
<tr>
<td>
%(tbs)s
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
<br>
<br>
<br>
<a href="/">Refresh</a>
<br>
</body>
</html>
"""
def add_select(dictx):
global ct
ct_keys = list(ct.keys())
ct_keys.sort()
cts='<select name="ct">'
for item in ct_keys:
cts+='<option value="%s">%s</option>' % (item,item)
cts+="</select>"
dictx['constels']=cts
return dictx
def add_table(dictx):
global ct
ctx = dictx['ct']
stars = ct[ctx]['stars']
tb ='<table border="1"><tr><th>star</th><th>RA</th><th>Dec</th></tr>'
for stx in stars:
ra, dec = stars[stx]
tb+="<tr><td>%s</td><td>%s</td><td>%s</td></tr>" % (stx,ra,dec)
tb +='</table><br>'
lines = ct[ctx]['lines']
max_len=0
for line in lines:
if len(line) > max_len:
max_len = len(line)
tb +='<table border="1"><tr><th></th>'
for i in range(max_len):
tb +='<th>S%d</th>' % i
tb+='<th><form action="/constels" method="get"><input type="hidden" name="ct" value="%s"><input type="Submit" value="render"></form></th>' % ctx
tb+="</tr>"
lx=0
for line in lines:
tb+="<tr><td>L%d</td>" % lx
for i in range(max_len):
if i < len(line):
tb +="<td>%s</td>" % line[i]
else:
tb +="<td></td>"
tb+='<td><form action="/ln" method="get"><input type="hidden" name="ct" value="%s"><input type="hidden" name="ln" value="%s"><input type="Submit" value="render"></form></tr>' % (ctx,lx)
lx +=1
tb+="</table>"
dictx['tbs']=tb
return dictx
def draw_ct(ctx):
global var_store, ct, tft
tft = var_store['tft']
stars = ct[ctx]['stars']
lines = ct[ctx]['lines']
min_max = [128,64,0,-90] # xmin, ymin, xmax, ymax
plines=[]
for line in lines:
plines.append([])
for stx in line:
ra, dec = stars[stx]
chk_min_max(ra,dec,min_max)
plines[-1].append((ra,dec))
if min_max[2] - min_max[0] >20:
# it seems wrap around in 24hr, retry
plines =[]
min_max=[128,64,0,-90] # xmin,ymin,xmax,ymax
for line in lines:
plines.append([])
for starx in line:
ra,dec=stars[starx]
if ra <10:
ra+=24 # fix wrap around value
chk_min_max(ra,dec,min_max)
plines[-1].append((ra,dec))
tft.fill_rect(0,0,128,64, NAVY)
tft.rect(0,0,128,64,LIME)
for points in plines:
tft_plot_line(points,min_max)
def draw_ct_line(ctx, ix):
global tft, var_store, ct
tft = var_store['tft']
stars = ct[ctx]['stars']
lines = ct[ctx]['lines']
min_max=[128,64,0,-90] # xmin,ymin,xmax,ymax
plines=[]
for line in lines:
plines.append([])
for starx in line:
ra,dec = stars[starx]
chk_min_max(ra,dec,min_max)
plines[-1].append((ra,dec))
if min_max[2] - min_max[0] >20:
# it seems wrap around in 24hr, retry
plines=[]
min_max=[128,64,0,-90] # xmin,ymin,xmax,ymax
for line in lines:
plines.append([])
for starx in line:
ra,dec=stars[starx]
if ra <10:
ra+=24 # fix wrap around value
chk_min_max(ra,dec,min_max)
plines[-1].append((ra,dec))
tft.fill_rect(0,0,128,64, NAVY)
tft.rect(0,0,128,64,LIME)
tft_plot_line(plines[ix],min_max)
def chk_min_max(x,y,min_max):
if x< min_max[0]:
min_max[0]=x
if y< min_max[1]:
min_max[1]=y
if x > min_max[2]:
min_max[2]=x
if y > min_max[3]:
min_max[3]=y
def tft_plot_line(points,min_max):
global tft
#scale to 2 pixel for 1 deg
XSCALE=15 * 2 # 1hr=15 deg
YSCALE= 2
xr=min_max[0] * XSCALE
yr=min_max[1] * YSCALE
xrng = min_max[2] *XSCALE - xr
yrng = min_max[3] *YSCALE - yr
print('xrng %s yrng:%s' % (xrng,yrng))
XOFS=int((128 - xrng)/2)
YOFS=int((64-yrng)/2)
xp = 128 -int(points[0][0] * XSCALE -xr + XOFS)
yp = 64 -int(points[0][1] * YSCALE -yr + YOFS)
tft_plot_star(xp,yp)
for x,y in points[1:]:
xv = 128 -int(x * XSCALE - xr + XOFS)
yv = 64 - int(y * YSCALE - yr + YOFS)
tft.line(xp,yp,xv,yv,BLUE)
tft_plot_star(xv,yv)
xp=xv
yp=yv
def tft_plot_star(x,y):
global tft
tft.pixel(x-1,y,WHITE)
tft.pixel(x, y-1,WHITE)
tft.pixel(x+1,y,WHITE)
tft.pixel(x, y+1,WHITE)
def _httpd():
global var_store
import socket
addr = socket.getaddrinfo('0.0.0.0',80)[0][-1]
s=socket.socket()
s.bind(addr)
s.listen(1)
print('listening on',addr)
tft = var_store['tft']
tft.text('httpd constel listening',25,130,color=WHITE)
while True:
conn,addr = s.accept()
print("connected from",addr)
req = conn.recv(1024)
print("content=%s" % str(req))
if req==b'':
continue
if req[:4]==b'GET ':
pos = req.find(b' HTTP/')
cmd = req[4:pos]
res = handle_cmd(cmd)
if type(res)==type(()):
resp=res[1]
conn.send(resp)
conn.close()
continue
if res is not None:
resp="""<html><body>Result: %s<br><br><a href="/">Home</a></body></html>""" % res
conn.send(resp)
conn.close()
continue
dictx={}
dictx = add_select(dictx)
resp = HTML_CONSTELS % dictx
conn.send(resp)
conn.close()
def handle_c_constels(parms):
print('set constels %s' % str(parms))
dictx = get_html_parms(parms)
dictx = add_table(dictx)
resp = HTML_CONSTEL % dictx
draw_ct(dictx['ct'])
return ('OK',resp)
def handle_c_ln(parms):
print('set constel %s' % str(parms))
dictx = get_html_parms(parms)
dictx = add_table(dictx)
resp = HTML_CONSTEL % dictx
ix = int(dictx['ln'])
draw_ct_line(dictx['ct'], ix)
return ('OK',resp)
def handle_cmd(cmd):
print('cmd:%s' % str(cmd))
pos=cmd.find(b'?')
cmdx = cmd[:pos]
if cmdx==b'/constels':
return handle_c_constels(cmd[pos+1:])
if cmdx==b'/ln':
return handle_c_ln(cmd[pos+1:])
return None
| [
1,
529,
9507,
29958,
2015,
29877,
29918,
29924,
29945,
29914,
481,
29918,
1124,
29881,
29918,
3075,
295,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
3095,
29918,
1124,
29881,
29918,
3075,
295,
29889,
2272,
30004,
13,
3259,
543,
29896,
29889,
29900,
19451,
13,
30004,
13,
3166,
2927,
1053,
334,
30004,
13,
5215,
931,
30004,
13,
5215,
330,
29883,
30004,
13,
3166,
1732,
29881,
29918,
4422,
1053,
334,
30004,
13,
3166,
330,
29918,
303,
1503,
29918,
29896,
1053,
274,
29873,
30004,
13,
30004,
13,
17171,
29918,
4690,
16310,
353,
7700,
30004,
13,
30004,
13,
1753,
1667,
29898,
4270,
1125,
30004,
13,
1678,
5534,
722,
29918,
8899,
30004,
13,
1678,
722,
29918,
8899,
29922,
4270,
30004,
13,
1678,
1369,
29918,
1124,
29881,
26471,
13,
30004,
13,
1753,
1369,
29918,
1124,
29881,
7295,
30004,
13,
1678,
5534,
722,
29918,
8899,
30004,
13,
1678,
4029,
29877,
29918,
3396,
353,
722,
29918,
8899,
1839,
2015,
29877,
29918,
3396,
2033,
30004,
13,
1678,
260,
615,
353,
722,
29918,
8899,
1839,
29873,
615,
2033,
30004,
13,
1678,
5235,
353,
4029,
29877,
29918,
3396,
29889,
3888,
30004,
13,
1678,
3095,
978,
353,
5235,
1839,
481,
978,
2033,
30004,
13,
1678,
10377,
353,
5235,
1839,
666,
2033,
30004,
13,
1678,
260,
615,
29889,
5589,
29918,
1621,
29898,
29906,
29900,
29892,
29896,
29900,
29900,
29892,
29906,
29900,
29900,
29892,
29896,
29900,
29900,
29892,
3521,
29963,
29979,
8443,
13,
1678,
260,
615,
29889,
1621,
29898,
29906,
29900,
29892,
29896,
29900,
29900,
29892,
29906,
29900,
29900,
29892,
29896,
29900,
29900,
29892,
5265,
2303,
8443,
13,
1678,
260,
615,
29889,
726,
29898,
481,
978,
29892,
29871,
29906,
29945,
29892,
29896,
29896,
29900,
29892,
2927,
29922,
25039,
9094,
8443,
13,
1678,
260,
615,
29889,
726,
29898,
666,
29892,
29871,
29906,
29945,
29892,
29896,
29906,
29900,
29892,
2780,
29922,
25039,
9094,
8443,
13,
1678,
260,
615,
29889,
726,
877,
2962,
292,
1732,
29881,
1040,
295,
742,
29906,
29945,
29892,
29896,
29941,
29900,
29892,
2780,
29922,
25039,
9094,
8443,
13,
1678,
565,
501,
1660,
29918,
4690,
16310,
29901,
30004,
13,
4706,
1053,
903,
7097,
30004,
13,
4706,
903,
7097,
29889,
2962,
29918,
1482,
29918,
7097,
7373,
1124,
29881,
29892,
3101,
30004,
13,
1678,
1683,
29901,
30004,
13,
4706,
903,
1124,
29881,
26471,
13,
30004,
13,
7020,
29918,
6007,
1254,
6670,
29903,
13776,
19451,
13,
1678,
529,
1420,
3238,
13,
1678,
529,
2813,
5299,
3257,
29958,
1168,
6236,
800,
829,
3257,
2565,
2813,
3238,
13,
1678,
529,
2587,
3238,
13,
1678,
529,
29882,
29906,
29958,
3549,
5798,
514,
362,
829,
29882,
29906,
3238,
13,
1678,
529,
689,
3158,
13802,
3075,
1379,
29908,
1158,
543,
657,
10175,
13,
1678,
529,
2371,
3238,
13,
1678,
529,
509,
5299,
1594,
29958,
29995,
29898,
3075,
1379,
29897,
29879,
829,
1594,
2565,
509,
3238,
13,
1678,
529,
509,
3238,
13,
1678,
529,
1594,
3238,
13,
1678,
529,
2080,
1134,
543,
16228,
29908,
995,
543,
7892,
19451,
13,
1678,
1533,
1594,
3238,
13,
1678,
1533,
509,
3238,
13,
1678,
1533,
2371,
3238,
13,
1678,
1533,
689,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
529,
29874,
2822,
13802,
1013,
27132,
829,
29874,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
1533,
2587,
3238,
13,
1678,
1533,
1420,
3238,
13,
15945,
19451,
13,
30004,
13,
7020,
29918,
6007,
1254,
6670,
13776,
19451,
13,
1678,
529,
1420,
3238,
13,
1678,
529,
2813,
5299,
3257,
29958,
1168,
6236,
362,
829,
3257,
2565,
2813,
3238,
13,
1678,
529,
2587,
3238,
13,
1678,
529,
29882,
29906,
29958,
1168,
6236,
362,
829,
29882,
29906,
3238,
13,
1678,
529,
2371,
3238,
13,
1678,
529,
509,
5299,
1594,
29958,
29995,
29898,
312,
29897,
29879,
829,
1594,
2565,
509,
3238,
13,
1678,
529,
509,
3238,
13,
1678,
529,
1594,
3238,
13,
29995,
29898,
29873,
5824,
29897,
29879,
30004,
13,
1678,
1533,
1594,
3238,
13,
1678,
1533,
509,
3238,
13,
1678,
529,
509,
3238,
13,
1678,
529,
1594,
3238,
13,
1678,
1533,
1594,
3238,
13,
1678,
1533,
509,
3238,
13,
1678,
1533,
2371,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
529,
29874,
2822,
13802,
1013,
27132,
829,
29874,
3238,
13,
1678,
529,
1182,
3238,
13,
1678,
1533,
2587,
3238,
13,
1678,
1533,
1420,
3238,
13,
15945,
19451,
13,
30004,
13,
1753,
788,
29918,
2622,
29898,
8977,
29916,
1125,
30004,
13,
1678,
5534,
274,
29873,
30004,
13,
1678,
274,
29873,
29918,
8149,
353,
1051,
29898,
312,
29889,
8149,
3101,
30004,
13,
1678,
274,
29873,
29918,
8149,
29889,
6605,
26471,
13,
1678,
274,
1372,
2433,
29966,
2622,
1024,
543,
312,
1013,
29915,
30004,
13,
1678,
363,
2944,
297,
274,
29873,
29918,
8149,
29901,
30004,
13,
4706,
274,
1372,
29974,
2433,
29966,
3385,
995,
543,
29995,
29879,
1013,
29995,
29879,
829,
3385,
16299,
1273,
313,
667,
29892,
667,
8443,
13,
1678,
274,
1372,
29974,
543,
829,
2622,
11903,
30004,
13,
1678,
9657,
29916,
1839,
3075,
1379,
2033,
29922,
312,
29879,
30004,
13,
1678,
736,
9657,
29916,
30004,
13,
30004,
13,
1753,
788,
29918,
2371,
29898,
8977,
29916,
1125,
30004,
13,
1678,
5534,
274,
29873,
30004,
13,
1678,
12893,
353,
9657,
29916,
1839,
312,
2033,
30004,
13,
1678,
10819,
353,
274,
29873,
29961,
13073,
22322,
303,
1503,
2033,
30004,
13,
1678,
260,
29890,
353,
29915,
29966,
2371,
5139,
543,
29896,
3254,
509,
5299,
386,
29958,
8508,
829,
386,
5299,
386,
29958,
4717,
829,
386,
5299,
386,
29958,
6185,
829,
386,
2565,
509,
16299,
30004,
13,
1678,
363,
380,
29916,
297,
10819,
29901,
30004,
13,
4706,
1153,
29892,
1602,
353,
10819,
29961,
303,
29916,
29962,
30004,
13,
4706,
260,
29890,
29974,
543,
29966,
509,
5299,
1594,
29958,
29995,
29879,
829,
1594,
5299,
1594,
29958,
29995,
29879,
829,
1594,
5299,
1594,
29958,
29995,
29879,
829,
1594,
2565,
509,
11903,
1273,
313,
303,
29916,
29892,
336,
29892,
7099,
8443,
13,
1678,
260,
29890,
718,
2433,
829,
2371,
5299,
1182,
16299,
30004,
13,
1678,
3454,
353,
274,
29873,
29961,
13073,
22322,
9012,
2033,
30004,
13,
1678,
4236,
29918,
2435,
29922,
29900,
30004,
13,
1678,
363,
1196,
297,
3454,
29901,
30004,
13,
4706,
565,
7431,
29898,
1220,
29897,
1405,
4236,
29918,
2435,
29901,
30004,
13,
9651,
4236,
29918,
2435,
353,
7431,
29898,
1220,
8443,
13,
1678,
260,
29890,
718,
2433,
29966,
2371,
5139,
543,
29896,
3254,
509,
5299,
386,
2565,
386,
16299,
30004,
13,
1678,
363,
474,
297,
3464,
29898,
3317,
29918,
2435,
1125,
30004,
13,
4706,
260,
29890,
718,
2433,
29966,
386,
29958,
29903,
29995,
29881,
829,
386,
16299,
1273,
474,
30004,
13,
1678,
260,
29890,
29974,
2433,
29966,
386,
5299,
689,
3158,
13802,
3075,
1379,
29908,
1158,
543,
657,
3254,
2080,
1134,
543,
10892,
29908,
1024,
543,
312,
29908,
995,
543,
29995,
29879,
3254,
2080,
1134,
543,
16228,
29908,
995,
543,
9482,
5319,
689,
2565,
386,
16299,
1273,
12893,
30004,
13,
1678,
260,
29890,
29974,
543,
829,
509,
11903,
30004,
13,
1678,
301,
29916,
29922,
29900,
30004,
13,
1678,
363,
1196,
297,
3454,
29901,
30004,
13,
4706,
260,
29890,
29974,
543,
29966,
509,
5299,
1594,
29958,
29931,
29995,
29881,
829,
1594,
11903,
1273,
301,
29916,
30004,
13,
4706,
363,
474,
297,
3464,
29898,
3317,
29918,
2435,
1125,
30004,
13,
9651,
565,
474,
529,
7431,
29898,
1220,
1125,
30004,
13,
18884,
260,
29890,
718,
543,
29966,
1594,
29958,
29995,
29879,
829,
1594,
11903,
1273,
1196,
29961,
29875,
29962,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
260,
29890,
718,
543,
29966,
1594,
2565,
1594,
11903,
30004,
13,
4706,
260,
29890,
29974,
2433,
29966,
1594,
5299,
689,
3158,
13802,
3083,
29908,
1158,
543,
657,
3254,
2080,
1134,
543,
10892,
29908,
1024,
543,
312,
29908,
995,
543,
29995,
29879,
3254,
2080,
1134,
543,
10892,
29908,
1024,
543,
3083,
29908,
995,
543,
29995,
29879,
3254,
2080,
1134,
543,
16228,
29908,
995,
543,
9482,
5319,
689,
2565,
509,
16299,
1273,
313,
13073,
29892,
29880,
29916,
8443,
13,
4706,
301,
29916,
4619,
29896,
30004,
13,
1678,
260,
29890,
29974,
543,
829,
2371,
11903,
30004,
13,
1678,
9657,
29916,
1839,
29873,
5824,
2033,
29922,
22625,
30004,
13,
1678,
736,
9657,
29916,
30004,
13,
30004,
13,
1753,
4216,
29918,
312,
29898,
13073,
1125,
30004,
13,
1678,
5534,
722,
29918,
8899,
29892,
274,
29873,
29892,
260,
615,
30004,
13,
1678,
260,
615,
353,
722,
29918,
8899,
1839,
29873,
615,
2033,
30004,
13,
1678,
10819,
353,
274,
29873,
29961,
13073,
22322,
303,
1503,
2033,
30004,
13,
1678,
3454,
353,
274,
29873,
29961,
13073,
22322,
9012,
2033,
30004,
13,
1678,
1375,
29918,
3317,
353,
518,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
29900,
6653,
29929,
29900,
29962,
396,
921,
1195,
29892,
343,
1195,
29892,
921,
3317,
29892,
343,
3317,
30004,
13,
1678,
715,
1475,
29922,
2636,
30004,
13,
1678,
363,
1196,
297,
3454,
29901,
30004,
13,
4706,
715,
1475,
29889,
4397,
4197,
2314,
30004,
13,
4706,
363,
380,
29916,
297,
1196,
29901,
30004,
13,
9651,
1153,
29892,
1602,
353,
10819,
29961,
303,
29916,
29962,
30004,
13,
9651,
521,
29895,
29918,
1195,
29918,
3317,
29898,
336,
29892,
7099,
29892,
1195,
29918,
3317,
8443,
13,
9651,
715,
1475,
14352,
29896,
1822,
4397,
3552,
336,
29892,
7099,
876,
30004,
13,
1678,
565,
1375,
29918,
3317,
29961,
29906,
29962,
448,
1375,
29918,
3317,
29961,
29900,
29962,
1405,
29906,
29900,
29901,
30004,
13,
4706,
396,
372,
2444,
12244,
2820,
297,
29871,
29906,
29946,
1092,
29892,
337,
2202,
30004,
13,
4706,
715,
1475,
353,
2636,
30004,
13,
4706,
1375,
29918,
3317,
11759,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
29900,
6653,
29929,
29900,
29962,
396,
921,
1195,
29892,
962,
262,
29892,
29916,
3317,
29892,
29891,
3317,
30004,
13,
4706,
363,
1196,
297,
3454,
29901,
30004,
13,
9651,
715,
1475,
29889,
4397,
4197,
2314,
30004,
13,
9651,
363,
5810,
29916,
297,
1196,
29901,
30004,
13,
18884,
1153,
29892,
7099,
29922,
303,
1503,
29961,
8508,
29916,
29962,
30004,
13,
18884,
565,
1153,
529,
29896,
29900,
29901,
30004,
13,
462,
1678,
1153,
23661,
29906,
29946,
29871,
396,
2329,
12244,
2820,
995,
30004,
13,
462,
1678,
521,
29895,
29918,
1195,
29918,
3317,
29898,
336,
29892,
7099,
29892,
1195,
29918,
3317,
8443,
13,
462,
1678,
715,
1475,
14352,
29896,
1822,
4397,
3552,
336,
29892,
7099,
876,
30004,
13,
1678,
260,
615,
29889,
5589,
29918,
1621,
29898,
29900,
29892,
29900,
29892,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
405,
7520,
29979,
8443,
13,
1678,
260,
615,
29889,
1621,
29898,
29900,
29892,
29900,
29892,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
5265,
2303,
8443,
13,
1678,
363,
3291,
297,
715,
1475,
29901,
30004,
13,
4706,
260,
615,
29918,
5317,
29918,
1220,
29898,
9748,
29892,
1195,
29918,
3317,
8443,
13,
30004,
13,
1753,
4216,
29918,
312,
29918,
1220,
29898,
13073,
29892,
474,
29916,
1125,
30004,
13,
1678,
5534,
260,
615,
29892,
722,
29918,
8899,
29892,
274,
29873,
30004,
13,
1678,
260,
615,
353,
722,
29918,
8899,
1839,
29873,
615,
2033,
30004,
13,
1678,
10819,
353,
274,
29873,
29961,
13073,
22322,
303,
1503,
2033,
30004,
13,
1678,
3454,
353,
274,
29873,
29961,
13073,
22322,
9012,
2033,
1678,
6756,
13,
1678,
1375,
29918,
3317,
11759,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
29900,
6653,
29929,
29900,
29962,
396,
921,
1195,
29892,
962,
262,
29892,
29916,
3317,
29892,
29891,
3317,
30004,
13,
1678,
715,
1475,
29922,
2636,
30004,
13,
1678,
363,
1196,
297,
3454,
29901,
30004,
13,
4706,
715,
1475,
29889,
4397,
4197,
2314,
30004,
13,
4706,
363,
5810,
29916,
297,
1196,
29901,
30004,
13,
9651,
1153,
29892,
7099,
353,
10819,
29961,
8508,
29916,
29962,
30004,
13,
9651,
521,
29895,
29918,
1195,
29918,
3317,
29898,
336,
29892,
7099,
29892,
1195,
29918,
3317,
8443,
13,
9651,
715,
1475,
14352,
29896,
1822,
4397,
3552,
336,
29892,
7099,
876,
30004,
13,
1678,
565,
1375,
29918,
3317,
29961,
29906,
29962,
448,
1375,
29918,
3317,
29961,
29900,
29962,
1405,
29906,
29900,
29901,
30004,
13,
4706,
396,
372,
2444,
12244,
2820,
297,
29871,
29906,
29946,
1092,
29892,
337,
2202,
30004,
13,
4706,
715,
1475,
29922,
2636,
30004,
13,
4706,
1375,
29918,
3317,
11759,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
29900,
6653,
29929,
29900,
29962,
396,
921,
1195,
29892,
962,
262,
29892,
29916,
3317,
29892,
29891,
3317,
30004,
13,
4706,
363,
1196,
297,
3454,
29901,
30004,
13,
9651,
715,
1475,
29889,
4397,
4197,
2314,
30004,
13,
9651,
363,
5810,
29916,
297,
1196,
29901,
30004,
13,
18884,
1153,
29892,
7099,
29922,
303,
1503,
29961,
8508,
29916,
29962,
30004,
13,
18884,
565,
1153,
529,
29896,
29900,
29901,
30004,
13,
462,
1678,
1153,
23661,
29906,
29946,
29871,
396,
2329,
12244,
2820,
995,
30004,
13,
462,
1678,
521,
29895,
29918,
1195,
29918,
3317,
29898,
336,
29892,
7099,
29892,
1195,
29918,
3317,
8443,
13,
462,
1678,
715,
1475,
14352,
29896,
1822,
4397,
3552,
336,
29892,
7099,
876,
30004,
13,
1678,
260,
615,
29889,
5589,
29918,
1621,
29898,
29900,
29892,
29900,
29892,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
405,
7520,
29979,
8443,
13,
1678,
260,
615,
29889,
1621,
29898,
29900,
29892,
29900,
29892,
29896,
29906,
29947,
29892,
29953,
29946,
29892,
5265,
2303,
29897,
462,
1678,
6756,
13,
1678,
260,
615,
29918,
5317,
29918,
1220,
29898,
572,
1475,
29961,
861,
1402,
1195,
29918,
3317,
8443,
13,
30004,
13,
1753,
521,
29895,
29918,
1195,
29918,
3317,
29898,
29916,
29892,
29891,
29892,
1195,
29918,
3317,
1125,
30004,
13,
1678,
565,
921,
29966,
1375,
29918,
3317,
29961,
29900,
5387,
30004,
13,
4706,
1375,
29918,
3317,
29961,
29900,
13192,
29916,
30004,
13,
1678,
565,
343,
29966,
1375,
29918,
3317,
29961,
29896,
5387,
30004,
13,
4706,
1375,
29918,
3317,
29961,
29896,
13192,
29891,
30004,
13,
1678,
565,
921,
1405,
1375,
29918,
3317,
29961,
29906,
5387,
30004,
13,
4706,
1375,
29918,
3317,
29961,
29906,
13192,
29916,
30004,
13,
1678,
565,
343,
1405,
1375,
29918,
3317,
29961,
29941,
5387,
30004,
13,
4706,
1375,
29918,
3317,
29961,
29941,
13192,
29891,
30004,
13,
30004,
13,
1753,
260,
615,
29918,
5317,
29918,
1220,
29898,
9748,
29892,
1195,
29918,
3317,
1125,
30004,
13,
1678,
5534,
260,
615,
30004,
13,
1678,
396,
7052,
304,
29871,
29906,
15526,
363,
29871,
29896,
3587,
30004,
13,
1678,
1060,
29903,
5454,
1307,
29922,
29896,
29945,
334,
29871,
29906,
29871,
396,
29871,
29896,
1092,
29922,
29896,
29945,
3587,
30004,
13,
1678,
612,
29903,
5454,
1307,
29922,
29871,
29906,
30004,
13,
1678,
921,
29878,
29922,
1195,
29918,
3317,
29961,
29900,
29962,
334,
1060,
29903,
5454,
1307,
30004,
13,
1678,
343,
29878,
29922,
1195,
29918,
3317,
29961,
29896,
29962,
334,
612,
29903,
5454,
1307,
30004,
13,
1678,
921,
29878,
865,
353,
1375,
29918,
3317,
29961,
29906,
29962,
334,
29990,
29903,
5454,
1307,
448,
921,
29878,
30004,
13,
1678,
343,
29878,
865,
353,
1375,
29918,
3317,
29961,
29941,
29962,
334,
21554,
5454,
1307,
448,
343,
29878,
30004,
13,
1678,
1596,
877,
29916,
29878,
865,
1273,
29879,
343,
29878,
865,
16664,
29879,
29915,
1273,
313,
29916,
29878,
865,
29892,
4316,
865,
876,
30004,
13,
1678,
1060,
9800,
29903,
29922,
524,
3552,
29896,
29906,
29947,
448,
921,
29878,
865,
6802,
29906,
8443,
13,
1678,
612,
9800,
29903,
29922,
524,
3552,
29953,
29946,
29899,
4316,
865,
6802,
29906,
8443,
13,
1678,
921,
29886,
353,
29871,
29896,
29906,
29947,
448,
524,
29898,
9748,
29961,
29900,
3816,
29900,
29962,
334,
1060,
29903,
5454,
1307,
448,
29916,
29878,
718,
1060,
9800,
29903,
8443,
13,
1678,
343,
29886,
353,
29871,
29953,
29946,
448,
524,
29898,
9748,
29961,
29900,
3816,
29896,
29962,
334,
612,
29903,
5454,
1307,
448,
4316,
718,
612,
9800,
29903,
8443,
13,
1678,
260,
615,
29918,
5317,
29918,
8508,
29898,
26330,
29892,
1478,
8443,
13,
1678,
363,
921,
29892,
29891,
297,
3291,
29961,
29896,
29901,
5387,
30004,
13,
4706,
921,
29894,
353,
29871,
29896,
29906,
29947,
448,
524,
29898,
29916,
334,
1060,
29903,
5454,
1307,
448,
921,
29878,
718,
1060,
9800,
29903,
8443,
13,
4706,
343,
29894,
353,
29871,
29953,
29946,
448,
938,
29898,
29891,
334,
612,
29903,
5454,
1307,
448,
343,
29878,
718,
612,
9800,
29903,
8443,
13,
4706,
260,
615,
29889,
1220,
29898,
26330,
29892,
1478,
29892,
29916,
29894,
29892,
29891,
29894,
29892,
13367,
4462,
8443,
13,
4706,
260,
615,
29918,
5317,
29918,
8508,
29898,
29916,
29894,
29892,
29891,
29894,
8443,
13,
4706,
921,
29886,
29922,
29916,
29894,
30004,
13,
4706,
343,
29886,
29922,
29891,
29894,
30004,
13,
30004,
13,
1753,
260,
615,
29918,
5317,
29918,
8508,
29898,
29916,
29892,
29891,
1125,
30004,
13,
1678,
5534,
260,
615,
30004,
13,
1678,
260,
615,
29889,
29886,
15711,
29898,
29916,
29899,
29896,
29892,
29891,
29892,
25039,
9094,
8443,
13,
1678,
260,
615,
29889,
29886,
15711,
29898,
29916,
29892,
343,
29899,
29896,
29892,
25039,
9094,
8443,
13,
1678,
260,
615,
29889,
29886,
15711,
29898,
29916,
29974,
29896,
29892,
29891,
29892,
25039,
9094,
8443,
13,
1678,
260,
615,
29889,
29886,
15711,
29898,
29916,
29892,
343,
29974,
29896,
29892,
25039,
9094,
8443,
13,
30004,
13,
1678,
6756,
13,
1753,
903,
1124,
29881,
7295,
30004,
13,
1678,
5534,
722,
29918,
8899,
30004,
13,
30004,
13,
1678,
1053,
9909,
30004,
13,
1678,
28915,
353,
9909,
29889,
657,
10030,
3888,
877,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
742,
29947,
29900,
9601,
29900,
3816,
29899,
29896,
29962,
30004,
13,
1678,
269,
29922,
11514,
29889,
11514,
26471,
13,
1678,
269,
29889,
5355,
29898,
10030,
8443,
13,
1678,
269,
29889,
20631,
29898,
29896,
8443,
13,
1678,
1596,
877,
1761,
8333,
373,
742,
10030,
8443,
13,
1678,
260,
615,
353,
722,
29918,
8899,
1839,
29873,
615,
2033,
30004,
13,
1678,
260,
615,
29889,
726,
877,
1124,
29881,
1040,
295,
19866,
742,
29906,
29945,
29892,
29896,
29941,
29900,
29892,
2780,
29922,
25039,
9094,
8443,
13,
1678,
1550,
5852,
29901,
30004,
13,
4706,
11009,
29892,
10030,
353,
269,
29889,
16044,
26471,
13,
4706,
1596,
703,
18045,
515,
613,
10030,
8443,
13,
4706,
12428,
353,
11009,
29889,
3757,
29894,
29898,
29896,
29900,
29906,
29946,
8443,
13,
4706,
1596,
703,
3051,
16328,
29879,
29908,
1273,
851,
29898,
7971,
876,
30004,
13,
4706,
565,
12428,
1360,
29890,
29915,
2396,
30004,
13,
9651,
6773,
30004,
13,
4706,
565,
12428,
7503,
29946,
29962,
1360,
29890,
29915,
7194,
525,
29901,
30004,
13,
9651,
926,
353,
12428,
29889,
2886,
29898,
29890,
29915,
7331,
29914,
1495,
30004,
13,
9651,
9920,
353,
12428,
29961,
29946,
29901,
1066,
29962,
30004,
13,
9651,
620,
353,
4386,
29918,
9006,
29898,
9006,
8443,
13,
9651,
565,
1134,
29898,
690,
29897,
1360,
1853,
14885,
1125,
30004,
13,
18884,
4613,
29922,
690,
29961,
29896,
29962,
30004,
13,
18884,
11009,
29889,
6717,
29898,
13713,
8443,
13,
18884,
11009,
29889,
5358,
26471,
13,
18884,
6773,
30004,
13,
9651,
565,
620,
338,
451,
6213,
29901,
30004,
13,
30004,
13,
18884,
4613,
13776,
29908,
29966,
1420,
5299,
2587,
29958,
3591,
29901,
1273,
29879,
29966,
1182,
5299,
1182,
5299,
29874,
2822,
13802,
1013,
11184,
829,
29874,
2565,
2587,
2565,
1420,
11903,
15945,
1273,
620,
30004,
13,
18884,
11009,
29889,
6717,
29898,
13713,
8443,
13,
18884,
11009,
29889,
5358,
26471,
13,
18884,
6773,
30004,
13,
30004,
13,
4706,
9657,
29916,
3790,
8117,
13,
4706,
9657,
29916,
353,
788,
29918,
2622,
29898,
8977,
29916,
8443,
13,
4706,
4613,
353,
4544,
29918,
6007,
1254,
6670,
29903,
1273,
9657,
29916,
30004,
13,
4706,
11009,
29889,
6717,
29898,
13713,
8443,
13,
4706,
11009,
29889,
5358,
26471,
13,
30004,
13,
1753,
4386,
29918,
29883,
29918,
3075,
1379,
29898,
862,
1516,
1125,
30004,
13,
1678,
1596,
877,
842,
1040,
1379,
1273,
29879,
29915,
1273,
851,
29898,
862,
1516,
876,
30004,
13,
1678,
9657,
29916,
353,
679,
29918,
1420,
29918,
862,
1516,
29898,
862,
1516,
8443,
13,
1678,
9657,
29916,
353,
788,
29918,
2371,
29898,
8977,
29916,
8443,
13,
1678,
4613,
353,
4544,
29918,
6007,
1254,
6670,
1273,
9657,
29916,
30004,
13,
1678,
4216,
29918,
312,
29898,
8977,
29916,
1839,
312,
2033,
8443,
13,
1678,
736,
6702,
8949,
742,
13713,
8443,
13,
30004,
13,
1753,
4386,
29918,
29883,
29918,
3083,
29898,
862,
1516,
1125,
30004,
13,
1678,
1596,
877,
842,
1040,
295,
1273,
29879,
29915,
1273,
851,
29898,
862,
1516,
876,
30004,
13,
1678,
9657,
29916,
353,
679,
29918,
1420,
29918,
862,
1516,
29898,
862,
1516,
8443,
13,
1678,
9657,
29916,
353,
788,
29918,
2371,
29898,
8977,
29916,
8443,
13,
1678,
4613,
353,
4544,
29918,
6007,
1254,
6670,
1273,
9657,
29916,
30004,
13,
1678,
474,
29916,
353,
938,
29898,
8977,
29916,
1839,
3083,
2033,
8443,
13,
1678,
4216,
29918,
312,
29918,
1220,
29898,
8977,
29916,
1839,
312,
7464,
474,
29916,
8443,
13,
1678,
736,
6702,
8949,
742,
13713,
8443,
13,
30004,
13,
1753,
4386,
29918,
9006,
29898,
9006,
1125,
30004,
13,
1678,
1596,
877,
9006,
16664,
29879,
29915,
1273,
851,
29898,
9006,
876,
30004,
13,
1678,
926,
29922,
9006,
29889,
2886,
29898,
29890,
29915,
29973,
1495,
30004,
13,
1678,
9920,
29916,
353,
9920,
7503,
1066,
29962,
30004,
13,
1678,
565,
9920,
29916,
1360,
29890,
29915,
29914,
3075,
1379,
2396,
30004,
13,
4706,
736,
4386,
29918,
29883,
29918,
3075,
1379,
29898,
9006,
29961,
1066,
29974,
29896,
29901,
2314,
30004,
13,
1678,
565,
9920,
29916,
1360,
29890,
29915,
29914,
3083,
2396,
30004,
13,
4706,
736,
4386,
29918,
29883,
29918,
3083,
29898,
9006,
29961,
1066,
29974,
29896,
29901,
2314,
1678,
6756,
13,
1678,
736,
6213,
30004,
13,
30004,
13,
30004,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.