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
|
---|---|---|---|---|---|
regform/apps.py | elishaking/django-form | 0 | 151678 | from django.apps import AppConfig
class RegformConfig(AppConfig):
name = 'regform'
| [
1,
515,
9557,
29889,
13371,
1053,
2401,
3991,
13,
13,
13,
1990,
2169,
689,
3991,
29898,
2052,
3991,
1125,
13,
1678,
1024,
353,
525,
1727,
689,
29915,
13,
2
] |
env/lib/python3.6/site-packages/gunicorn/workers/base.py | anthowen/duplify | 7 | 1610655 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from datetime import datetime
import os
from random import randint
import signal
from ssl import SSLError
import sys
import time
import traceback
from gunicorn import six
from gunicorn import util
from gunicorn.workers.workertmp import WorkerTmp
from gunicorn.reloader import reloader_engines
from gunicorn.http.errors import (
InvalidHeader, InvalidHeaderName, InvalidRequestLine, InvalidRequestMethod,
InvalidHTTPVersion, LimitRequestLine, LimitRequestHeaders,
)
from gunicorn.http.errors import InvalidProxyLine, ForbiddenProxyRequest
from gunicorn.http.wsgi import default_environ, Response
from gunicorn.six import MAXSIZE
class Worker(object):
SIGNALS = [getattr(signal, "SIG%s" % x)
for x in "ABRT HUP QUIT INT TERM USR1 USR2 WINCH CHLD".split()]
PIPE = []
def __init__(self, age, ppid, sockets, app, timeout, cfg, log):
"""\
This is called pre-fork so it shouldn't do anything to the
current process. If there's a need to make process wide
changes you'll want to do that in ``self.init_process()``.
"""
self.age = age
self.pid = "[booting]"
self.ppid = ppid
self.sockets = sockets
self.app = app
self.timeout = timeout
self.cfg = cfg
self.booted = False
self.aborted = False
self.reloader = None
self.nr = 0
jitter = randint(0, cfg.max_requests_jitter)
self.max_requests = cfg.max_requests + jitter or MAXSIZE
self.alive = True
self.log = log
self.tmp = WorkerTmp(cfg)
def __str__(self):
return "<Worker %s>" % self.pid
def notify(self):
"""\
Your worker subclass must arrange to have this method called
once every ``self.timeout`` seconds. If you fail in accomplishing
this task, the master process will murder your workers.
"""
self.tmp.notify()
def run(self):
"""\
This is the mainloop of a worker process. You should override
this method in a subclass to provide the intended behaviour
for your particular evil schemes.
"""
raise NotImplementedError()
def init_process(self):
"""\
If you override this method in a subclass, the last statement
in the function should be to call this method with
super(MyWorkerClass, self).init_process() so that the ``run()``
loop is initiated.
"""
# set environment' variables
if self.cfg.env:
for k, v in self.cfg.env.items():
os.environ[k] = v
util.set_owner_process(self.cfg.uid, self.cfg.gid,
initgroups=self.cfg.initgroups)
# Reseed the random number generator
util.seed()
# For waking ourselves up
self.PIPE = os.pipe()
for p in self.PIPE:
util.set_non_blocking(p)
util.close_on_exec(p)
# Prevent fd inheritance
[util.close_on_exec(s) for s in self.sockets]
util.close_on_exec(self.tmp.fileno())
self.wait_fds = self.sockets + [self.PIPE[0]]
self.log.close_on_exec()
self.init_signals()
# start the reloader
if self.cfg.reload:
def changed(fname):
self.log.info("Worker reloading: %s modified", fname)
self.alive = False
self.cfg.worker_int(self)
time.sleep(0.1)
sys.exit(0)
reloader_cls = reloader_engines[self.cfg.reload_engine]
self.reloader = reloader_cls(callback=changed)
self.reloader.start()
self.load_wsgi()
self.cfg.post_worker_init(self)
# Enter main run loop
self.booted = True
self.run()
def load_wsgi(self):
try:
self.wsgi = self.app.wsgi()
except SyntaxError as e:
if self.cfg.reload == 'off':
raise
self.log.exception(e)
# fix from PR #1228
# storing the traceback into exc_tb will create a circular reference.
# per https://docs.python.org/2/library/sys.html#sys.exc_info warning,
# delete the traceback after use.
try:
exc_type, exc_val, exc_tb = sys.exc_info()
self.reloader.add_extra_file(exc_val.filename)
tb_string = six.StringIO()
traceback.print_tb(exc_tb, file=tb_string)
self.wsgi = util.make_fail_app(tb_string.getvalue())
finally:
del exc_tb
def init_signals(self):
# reset signaling
[signal.signal(s, signal.SIG_DFL) for s in self.SIGNALS]
# init new signaling
signal.signal(signal.SIGQUIT, self.handle_quit)
signal.signal(signal.SIGTERM, self.handle_exit)
signal.signal(signal.SIGINT, self.handle_quit)
signal.signal(signal.SIGWINCH, self.handle_winch)
signal.signal(signal.SIGUSR1, self.handle_usr1)
signal.signal(signal.SIGABRT, self.handle_abort)
# Don't let SIGTERM and SIGUSR1 disturb active requests
# by interrupting system calls
if hasattr(signal, 'siginterrupt'): # python >= 2.6
signal.siginterrupt(signal.SIGTERM, False)
signal.siginterrupt(signal.SIGUSR1, False)
if hasattr(signal, 'set_wakeup_fd'):
signal.set_wakeup_fd(self.PIPE[1])
def handle_usr1(self, sig, frame):
self.log.reopen_files()
def handle_exit(self, sig, frame):
self.alive = False
def handle_quit(self, sig, frame):
self.alive = False
# worker_int callback
self.cfg.worker_int(self)
time.sleep(0.1)
sys.exit(0)
def handle_abort(self, sig, frame):
self.alive = False
self.cfg.worker_abort(self)
sys.exit(1)
def handle_error(self, req, client, addr, exc):
request_start = datetime.now()
addr = addr or ('', -1) # unix socket case
if isinstance(exc, (InvalidRequestLine, InvalidRequestMethod,
InvalidHTTPVersion, InvalidHeader, InvalidHeaderName,
LimitRequestLine, LimitRequestHeaders,
InvalidProxyLine, ForbiddenProxyRequest,
SSLError)):
status_int = 400
reason = "Bad Request"
if isinstance(exc, InvalidRequestLine):
mesg = "Invalid Request Line '%s'" % str(exc)
elif isinstance(exc, InvalidRequestMethod):
mesg = "Invalid Method '%s'" % str(exc)
elif isinstance(exc, InvalidHTTPVersion):
mesg = "Invalid HTTP Version '%s'" % str(exc)
elif isinstance(exc, (InvalidHeaderName, InvalidHeader,)):
mesg = "%s" % str(exc)
if not req and hasattr(exc, "req"):
req = exc.req # for access log
elif isinstance(exc, LimitRequestLine):
mesg = "%s" % str(exc)
elif isinstance(exc, LimitRequestHeaders):
mesg = "Error parsing headers: '%s'" % str(exc)
elif isinstance(exc, InvalidProxyLine):
mesg = "'%s'" % str(exc)
elif isinstance(exc, ForbiddenProxyRequest):
reason = "Forbidden"
mesg = "Request forbidden"
status_int = 403
elif isinstance(exc, SSLError):
reason = "Forbidden"
mesg = "'%s'" % str(exc)
status_int = 403
msg = "Invalid request from ip={ip}: {error}"
self.log.debug(msg.format(ip=addr[0], error=str(exc)))
else:
if hasattr(req, "uri"):
self.log.exception("Error handling request %s", req.uri)
status_int = 500
reason = "Internal Server Error"
mesg = ""
if req is not None:
request_time = datetime.now() - request_start
environ = default_environ(req, client, self.cfg)
environ['REMOTE_ADDR'] = addr[0]
environ['REMOTE_PORT'] = str(addr[1])
resp = Response(req, client, self.cfg)
resp.status = "%s %s" % (status_int, reason)
resp.response_length = len(mesg)
self.log.access(resp, req, environ, request_time)
try:
util.write_error(client, status_int, reason, mesg)
except:
self.log.debug("Failed to send error message.")
def handle_winch(self, sig, fname):
# Ignore SIGWINCH in worker. Fixes a crash on OpenBSD.
self.log.debug("worker: SIGWINCH ignored.")
| [
1,
396,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
13,
29937,
13,
29937,
910,
934,
338,
760,
310,
330,
2523,
1398,
5492,
1090,
278,
341,
1806,
19405,
29889,
13,
29937,
2823,
278,
6058,
12107,
363,
901,
2472,
29889,
13,
13,
3166,
12865,
1053,
12865,
13,
5215,
2897,
13,
3166,
4036,
1053,
20088,
524,
13,
5215,
7182,
13,
3166,
24250,
1053,
5886,
1307,
24616,
13,
5215,
10876,
13,
5215,
931,
13,
5215,
9637,
1627,
13,
13,
3166,
330,
2523,
1398,
1053,
4832,
13,
3166,
330,
2523,
1398,
1053,
3667,
13,
3166,
330,
2523,
1398,
29889,
1287,
414,
29889,
1287,
814,
1526,
1053,
5244,
261,
29911,
1526,
13,
3166,
330,
2523,
1398,
29889,
276,
12657,
1053,
337,
12657,
29918,
996,
1475,
13,
3166,
330,
2523,
1398,
29889,
1124,
29889,
12523,
1053,
313,
13,
1678,
21403,
7850,
29892,
21403,
7850,
1170,
29892,
21403,
3089,
3542,
29892,
21403,
3089,
4062,
29892,
13,
1678,
21403,
10493,
6594,
29892,
9628,
277,
3089,
3542,
29892,
9628,
277,
3089,
18163,
29892,
13,
29897,
13,
3166,
330,
2523,
1398,
29889,
1124,
29889,
12523,
1053,
21403,
14048,
3542,
29892,
1152,
29890,
4215,
14048,
3089,
13,
3166,
330,
2523,
1398,
29889,
1124,
29889,
5652,
3146,
1053,
2322,
29918,
21813,
29892,
13291,
13,
3166,
330,
2523,
1398,
29889,
28319,
1053,
18134,
14226,
13,
13,
13,
1990,
5244,
261,
29898,
3318,
1125,
13,
13,
1678,
317,
17298,
1964,
29903,
353,
518,
657,
5552,
29898,
25436,
29892,
376,
5425,
29954,
29995,
29879,
29908,
1273,
921,
29897,
13,
9651,
363,
921,
297,
376,
2882,
13079,
379,
4897,
660,
29965,
1806,
19578,
323,
1001,
29924,
3148,
29934,
29896,
3148,
29934,
29906,
399,
1177,
3210,
5868,
10249,
1642,
5451,
580,
29962,
13,
13,
1678,
349,
29902,
4162,
353,
5159,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
5046,
29892,
282,
5935,
29892,
577,
9737,
29892,
623,
29892,
11815,
29892,
274,
16434,
29892,
1480,
1125,
13,
4706,
9995,
29905,
13,
4706,
910,
338,
2000,
758,
29899,
29888,
548,
577,
372,
9273,
29915,
29873,
437,
3099,
304,
278,
13,
4706,
1857,
1889,
29889,
960,
727,
29915,
29879,
263,
817,
304,
1207,
1889,
9377,
13,
4706,
3620,
366,
29915,
645,
864,
304,
437,
393,
297,
4954,
1311,
29889,
2344,
29918,
5014,
2555,
1412,
13,
4706,
9995,
13,
4706,
1583,
29889,
482,
353,
5046,
13,
4706,
1583,
29889,
5935,
353,
14704,
4777,
292,
18017,
13,
4706,
1583,
29889,
407,
333,
353,
282,
5935,
13,
4706,
1583,
29889,
578,
9737,
353,
577,
9737,
13,
4706,
1583,
29889,
932,
353,
623,
13,
4706,
1583,
29889,
15619,
353,
11815,
13,
4706,
1583,
29889,
16859,
353,
274,
16434,
13,
4706,
1583,
29889,
4777,
287,
353,
7700,
13,
4706,
1583,
29889,
370,
18054,
353,
7700,
13,
4706,
1583,
29889,
276,
12657,
353,
6213,
13,
13,
4706,
1583,
29889,
22230,
353,
29871,
29900,
13,
4706,
432,
5171,
353,
20088,
524,
29898,
29900,
29892,
274,
16434,
29889,
3317,
29918,
24830,
29918,
29926,
5171,
29897,
13,
4706,
1583,
29889,
3317,
29918,
24830,
353,
274,
16434,
29889,
3317,
29918,
24830,
718,
432,
5171,
470,
18134,
14226,
13,
4706,
1583,
29889,
284,
573,
353,
5852,
13,
4706,
1583,
29889,
1188,
353,
1480,
13,
4706,
1583,
29889,
7050,
353,
5244,
261,
29911,
1526,
29898,
16859,
29897,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
9872,
16164,
1273,
29879,
11903,
1273,
1583,
29889,
5935,
13,
13,
1678,
822,
26051,
29898,
1311,
1125,
13,
4706,
9995,
29905,
13,
4706,
3575,
15645,
19481,
1818,
564,
3881,
304,
505,
445,
1158,
2000,
13,
4706,
2748,
1432,
4954,
1311,
29889,
15619,
16159,
6923,
29889,
960,
366,
4418,
297,
12709,
292,
13,
4706,
445,
3414,
29892,
278,
5835,
1889,
674,
13406,
596,
17162,
29889,
13,
4706,
9995,
13,
4706,
1583,
29889,
7050,
29889,
25140,
580,
13,
13,
1678,
822,
1065,
29898,
1311,
1125,
13,
4706,
9995,
29905,
13,
4706,
910,
338,
278,
1667,
7888,
310,
263,
15645,
1889,
29889,
887,
881,
5712,
13,
4706,
445,
1158,
297,
263,
19481,
304,
3867,
278,
9146,
10468,
13,
4706,
363,
596,
3153,
16126,
27715,
29889,
13,
4706,
9995,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
580,
13,
13,
1678,
822,
2069,
29918,
5014,
29898,
1311,
1125,
13,
4706,
9995,
29905,
13,
4706,
960,
366,
5712,
445,
1158,
297,
263,
19481,
29892,
278,
1833,
3229,
13,
4706,
297,
278,
740,
881,
367,
304,
1246,
445,
1158,
411,
13,
4706,
2428,
29898,
3421,
16164,
2385,
29892,
1583,
467,
2344,
29918,
5014,
580,
577,
393,
278,
4954,
3389,
2555,
29952,
13,
4706,
2425,
338,
14511,
630,
29889,
13,
4706,
9995,
13,
13,
4706,
396,
731,
5177,
29915,
3651,
13,
4706,
565,
1583,
29889,
16859,
29889,
6272,
29901,
13,
9651,
363,
413,
29892,
325,
297,
1583,
29889,
16859,
29889,
6272,
29889,
7076,
7295,
13,
18884,
2897,
29889,
21813,
29961,
29895,
29962,
353,
325,
13,
13,
4706,
3667,
29889,
842,
29918,
20348,
29918,
5014,
29898,
1311,
29889,
16859,
29889,
5416,
29892,
1583,
29889,
16859,
29889,
29887,
333,
29892,
13,
462,
1669,
2069,
13155,
29922,
1311,
29889,
16859,
29889,
2344,
13155,
29897,
13,
13,
4706,
396,
390,
968,
287,
278,
4036,
1353,
15299,
13,
4706,
3667,
29889,
26776,
580,
13,
13,
4706,
396,
1152,
281,
5086,
20278,
701,
13,
4706,
1583,
29889,
2227,
4162,
353,
2897,
29889,
17760,
580,
13,
4706,
363,
282,
297,
1583,
29889,
2227,
4162,
29901,
13,
9651,
3667,
29889,
842,
29918,
5464,
29918,
1271,
292,
29898,
29886,
29897,
13,
9651,
3667,
29889,
5358,
29918,
265,
29918,
4258,
29898,
29886,
29897,
13,
13,
4706,
396,
4721,
794,
285,
29881,
20328,
13,
4706,
518,
4422,
29889,
5358,
29918,
265,
29918,
4258,
29898,
29879,
29897,
363,
269,
297,
1583,
29889,
578,
9737,
29962,
13,
4706,
3667,
29889,
5358,
29918,
265,
29918,
4258,
29898,
1311,
29889,
7050,
29889,
1777,
8154,
3101,
13,
13,
4706,
1583,
29889,
10685,
29918,
29888,
6289,
353,
1583,
29889,
578,
9737,
718,
518,
1311,
29889,
2227,
4162,
29961,
29900,
5262,
13,
13,
4706,
1583,
29889,
1188,
29889,
5358,
29918,
265,
29918,
4258,
580,
13,
13,
4706,
1583,
29889,
2344,
29918,
4530,
1338,
580,
13,
13,
4706,
396,
1369,
278,
337,
12657,
13,
4706,
565,
1583,
29889,
16859,
29889,
28120,
29901,
13,
9651,
822,
3939,
29898,
29888,
978,
1125,
13,
18884,
1583,
29889,
1188,
29889,
3888,
703,
16164,
337,
13234,
29901,
1273,
29879,
9120,
613,
285,
978,
29897,
13,
18884,
1583,
29889,
284,
573,
353,
7700,
13,
18884,
1583,
29889,
16859,
29889,
24602,
29918,
524,
29898,
1311,
29897,
13,
18884,
931,
29889,
17059,
29898,
29900,
29889,
29896,
29897,
13,
18884,
10876,
29889,
13322,
29898,
29900,
29897,
13,
13,
9651,
337,
12657,
29918,
25932,
353,
337,
12657,
29918,
996,
1475,
29961,
1311,
29889,
16859,
29889,
28120,
29918,
10599,
29962,
13,
9651,
1583,
29889,
276,
12657,
353,
337,
12657,
29918,
25932,
29898,
14035,
29922,
15033,
29897,
13,
9651,
1583,
29889,
276,
12657,
29889,
2962,
580,
13,
13,
4706,
1583,
29889,
1359,
29918,
5652,
3146,
580,
13,
4706,
1583,
29889,
16859,
29889,
2490,
29918,
24602,
29918,
2344,
29898,
1311,
29897,
13,
13,
4706,
396,
9041,
1667,
1065,
2425,
13,
4706,
1583,
29889,
4777,
287,
353,
5852,
13,
4706,
1583,
29889,
3389,
580,
13,
13,
1678,
822,
2254,
29918,
5652,
3146,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
1583,
29889,
5652,
3146,
353,
1583,
29889,
932,
29889,
5652,
3146,
580,
13,
4706,
5174,
21306,
2392,
408,
321,
29901,
13,
9651,
565,
1583,
29889,
16859,
29889,
28120,
1275,
525,
2696,
2396,
13,
18884,
12020,
13,
13,
9651,
1583,
29889,
1188,
29889,
11739,
29898,
29872,
29897,
13,
13,
9651,
396,
2329,
515,
12089,
396,
29896,
29906,
29906,
29947,
13,
9651,
396,
15446,
278,
9637,
1627,
964,
5566,
29918,
22625,
674,
1653,
263,
19308,
3407,
29889,
13,
9651,
396,
639,
2045,
597,
2640,
29889,
4691,
29889,
990,
29914,
29906,
29914,
5258,
29914,
9675,
29889,
1420,
29937,
9675,
29889,
735,
29883,
29918,
3888,
9177,
29892,
13,
9651,
396,
5217,
278,
9637,
1627,
1156,
671,
29889,
13,
9651,
1018,
29901,
13,
18884,
5566,
29918,
1853,
29892,
5566,
29918,
791,
29892,
5566,
29918,
22625,
353,
10876,
29889,
735,
29883,
29918,
3888,
580,
13,
18884,
1583,
29889,
276,
12657,
29889,
1202,
29918,
17833,
29918,
1445,
29898,
735,
29883,
29918,
791,
29889,
9507,
29897,
13,
13,
18884,
260,
29890,
29918,
1807,
353,
4832,
29889,
1231,
5971,
580,
13,
18884,
9637,
1627,
29889,
2158,
29918,
22625,
29898,
735,
29883,
29918,
22625,
29892,
934,
29922,
22625,
29918,
1807,
29897,
13,
18884,
1583,
29889,
5652,
3146,
353,
3667,
29889,
5675,
29918,
14057,
29918,
932,
29898,
22625,
29918,
1807,
29889,
657,
1767,
3101,
13,
9651,
7146,
29901,
13,
18884,
628,
5566,
29918,
22625,
13,
13,
1678,
822,
2069,
29918,
4530,
1338,
29898,
1311,
1125,
13,
4706,
396,
10092,
7182,
292,
13,
4706,
518,
25436,
29889,
25436,
29898,
29879,
29892,
7182,
29889,
5425,
29954,
29918,
4037,
29931,
29897,
363,
269,
297,
1583,
29889,
5425,
20728,
1964,
29903,
29962,
13,
4706,
396,
2069,
716,
7182,
292,
13,
4706,
7182,
29889,
25436,
29898,
25436,
29889,
5425,
29954,
13356,
1806,
29892,
1583,
29889,
8411,
29918,
28358,
29897,
13,
4706,
7182,
29889,
25436,
29898,
25436,
29889,
5425,
29954,
4945,
29924,
29892,
1583,
29889,
8411,
29918,
13322,
29897,
13,
4706,
7182,
29889,
25436,
29898,
25436,
29889,
5425,
29954,
10192,
29892,
1583,
29889,
8411,
29918,
28358,
29897,
13,
4706,
7182,
29889,
25436,
29898,
25436,
29889,
5425,
29954,
25152,
3210,
29892,
1583,
29889,
8411,
29918,
5080,
305,
29897,
13,
4706,
7182,
29889,
25436,
29898,
25436,
29889,
5425,
29954,
3308,
29934,
29896,
29892,
1583,
29889,
8411,
29918,
4855,
29896,
29897,
13,
4706,
7182,
29889,
25436,
29898,
25436,
29889,
5425,
29954,
2882,
13079,
29892,
1583,
29889,
8411,
29918,
370,
441,
29897,
13,
13,
4706,
396,
3872,
29915,
29873,
1235,
317,
6259,
4945,
29924,
322,
317,
6259,
3308,
29934,
29896,
29543,
6136,
7274,
13,
4706,
396,
491,
23754,
292,
1788,
5717,
13,
4706,
565,
756,
5552,
29898,
25436,
29892,
525,
18816,
1639,
6685,
29374,
29871,
396,
3017,
6736,
29871,
29906,
29889,
29953,
13,
9651,
7182,
29889,
18816,
1639,
6685,
29898,
25436,
29889,
5425,
29954,
4945,
29924,
29892,
7700,
29897,
13,
9651,
7182,
29889,
18816,
1639,
6685,
29898,
25436,
29889,
5425,
29954,
3308,
29934,
29896,
29892,
7700,
29897,
13,
13,
4706,
565,
756,
5552,
29898,
25436,
29892,
525,
842,
29918,
29893,
1296,
786,
29918,
11512,
29374,
13,
9651,
7182,
29889,
842,
29918,
29893,
1296,
786,
29918,
11512,
29898,
1311,
29889,
2227,
4162,
29961,
29896,
2314,
13,
13,
1678,
822,
4386,
29918,
4855,
29896,
29898,
1311,
29892,
4365,
29892,
3515,
1125,
13,
4706,
1583,
29889,
1188,
29889,
276,
3150,
29918,
5325,
580,
13,
13,
1678,
822,
4386,
29918,
13322,
29898,
1311,
29892,
4365,
29892,
3515,
1125,
13,
4706,
1583,
29889,
284,
573,
353,
7700,
13,
13,
1678,
822,
4386,
29918,
28358,
29898,
1311,
29892,
4365,
29892,
3515,
1125,
13,
4706,
1583,
29889,
284,
573,
353,
7700,
13,
4706,
396,
15645,
29918,
524,
6939,
13,
4706,
1583,
29889,
16859,
29889,
24602,
29918,
524,
29898,
1311,
29897,
13,
4706,
931,
29889,
17059,
29898,
29900,
29889,
29896,
29897,
13,
4706,
10876,
29889,
13322,
29898,
29900,
29897,
13,
13,
1678,
822,
4386,
29918,
370,
441,
29898,
1311,
29892,
4365,
29892,
3515,
1125,
13,
4706,
1583,
29889,
284,
573,
353,
7700,
13,
4706,
1583,
29889,
16859,
29889,
24602,
29918,
370,
441,
29898,
1311,
29897,
13,
4706,
10876,
29889,
13322,
29898,
29896,
29897,
13,
13,
1678,
822,
4386,
29918,
2704,
29898,
1311,
29892,
12428,
29892,
3132,
29892,
28915,
29892,
5566,
1125,
13,
4706,
2009,
29918,
2962,
353,
12865,
29889,
3707,
580,
13,
4706,
28915,
353,
28915,
470,
6702,
742,
448,
29896,
29897,
29871,
396,
28167,
9909,
1206,
13,
4706,
565,
338,
8758,
29898,
735,
29883,
29892,
313,
13919,
3089,
3542,
29892,
21403,
3089,
4062,
29892,
13,
18884,
21403,
10493,
6594,
29892,
21403,
7850,
29892,
21403,
7850,
1170,
29892,
13,
18884,
9628,
277,
3089,
3542,
29892,
9628,
277,
3089,
18163,
29892,
13,
18884,
21403,
14048,
3542,
29892,
1152,
29890,
4215,
14048,
3089,
29892,
13,
18884,
5886,
1307,
24616,
22164,
13,
13,
9651,
4660,
29918,
524,
353,
29871,
29946,
29900,
29900,
13,
9651,
2769,
353,
376,
22050,
10729,
29908,
13,
13,
9651,
565,
338,
8758,
29898,
735,
29883,
29892,
21403,
3089,
3542,
1125,
13,
18884,
4883,
29887,
353,
376,
13919,
10729,
7407,
14210,
29879,
11838,
1273,
851,
29898,
735,
29883,
29897,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
21403,
3089,
4062,
1125,
13,
18884,
4883,
29887,
353,
376,
13919,
8108,
14210,
29879,
11838,
1273,
851,
29898,
735,
29883,
29897,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
21403,
10493,
6594,
1125,
13,
18884,
4883,
29887,
353,
376,
13919,
7331,
10079,
14210,
29879,
11838,
1273,
851,
29898,
735,
29883,
29897,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
313,
13919,
7850,
1170,
29892,
21403,
7850,
29892,
22164,
13,
18884,
4883,
29887,
353,
11860,
29879,
29908,
1273,
851,
29898,
735,
29883,
29897,
13,
18884,
565,
451,
12428,
322,
756,
5552,
29898,
735,
29883,
29892,
376,
7971,
29908,
1125,
13,
462,
1678,
12428,
353,
5566,
29889,
7971,
29871,
396,
363,
2130,
1480,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
9628,
277,
3089,
3542,
1125,
13,
18884,
4883,
29887,
353,
11860,
29879,
29908,
1273,
851,
29898,
735,
29883,
29897,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
9628,
277,
3089,
18163,
1125,
13,
18884,
4883,
29887,
353,
376,
2392,
13755,
9066,
29901,
14210,
29879,
11838,
1273,
851,
29898,
735,
29883,
29897,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
21403,
14048,
3542,
1125,
13,
18884,
4883,
29887,
353,
13577,
29995,
29879,
11838,
1273,
851,
29898,
735,
29883,
29897,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
1152,
29890,
4215,
14048,
3089,
1125,
13,
18884,
2769,
353,
376,
2831,
29890,
4215,
29908,
13,
18884,
4883,
29887,
353,
376,
3089,
19752,
4215,
29908,
13,
18884,
4660,
29918,
524,
353,
29871,
29946,
29900,
29941,
13,
9651,
25342,
338,
8758,
29898,
735,
29883,
29892,
5886,
1307,
24616,
1125,
13,
18884,
2769,
353,
376,
2831,
29890,
4215,
29908,
13,
18884,
4883,
29887,
353,
13577,
29995,
29879,
11838,
1273,
851,
29898,
735,
29883,
29897,
13,
18884,
4660,
29918,
524,
353,
29871,
29946,
29900,
29941,
13,
13,
9651,
10191,
353,
376,
13919,
2009,
515,
10377,
3790,
666,
6177,
426,
2704,
5038,
13,
9651,
1583,
29889,
1188,
29889,
8382,
29898,
7645,
29889,
4830,
29898,
666,
29922,
10030,
29961,
29900,
1402,
1059,
29922,
710,
29898,
735,
29883,
4961,
13,
4706,
1683,
29901,
13,
9651,
565,
756,
5552,
29898,
7971,
29892,
376,
5338,
29908,
1125,
13,
18884,
1583,
29889,
1188,
29889,
11739,
703,
2392,
11415,
2009,
1273,
29879,
613,
12428,
29889,
5338,
29897,
13,
9651,
4660,
29918,
524,
353,
29871,
29945,
29900,
29900,
13,
9651,
2769,
353,
376,
16491,
5656,
4829,
29908,
13,
9651,
4883,
29887,
353,
5124,
13,
13,
4706,
565,
12428,
338,
451,
6213,
29901,
13,
9651,
2009,
29918,
2230,
353,
12865,
29889,
3707,
580,
448,
2009,
29918,
2962,
13,
9651,
12471,
353,
2322,
29918,
21813,
29898,
7971,
29892,
3132,
29892,
1583,
29889,
16859,
29897,
13,
9651,
12471,
1839,
1525,
29924,
2891,
29923,
29918,
3035,
8353,
2033,
353,
28915,
29961,
29900,
29962,
13,
9651,
12471,
1839,
1525,
29924,
2891,
29923,
29918,
15082,
2033,
353,
851,
29898,
10030,
29961,
29896,
2314,
13,
9651,
4613,
353,
13291,
29898,
7971,
29892,
3132,
29892,
1583,
29889,
16859,
29897,
13,
9651,
4613,
29889,
4882,
353,
11860,
29879,
1273,
29879,
29908,
1273,
313,
4882,
29918,
524,
29892,
2769,
29897,
13,
9651,
4613,
29889,
5327,
29918,
2848,
353,
7431,
29898,
4467,
29887,
29897,
13,
9651,
1583,
29889,
1188,
29889,
5943,
29898,
13713,
29892,
12428,
29892,
12471,
29892,
2009,
29918,
2230,
29897,
13,
13,
4706,
1018,
29901,
13,
9651,
3667,
29889,
3539,
29918,
2704,
29898,
4645,
29892,
4660,
29918,
524,
29892,
2769,
29892,
4883,
29887,
29897,
13,
4706,
5174,
29901,
13,
9651,
1583,
29889,
1188,
29889,
8382,
703,
17776,
304,
3638,
1059,
2643,
23157,
13,
13,
1678,
822,
4386,
29918,
5080,
305,
29898,
1311,
29892,
4365,
29892,
285,
978,
1125,
13,
4706,
396,
18076,
487,
317,
6259,
25152,
3210,
297,
15645,
29889,
24778,
267,
263,
8095,
373,
4673,
29933,
7230,
29889,
13,
4706,
1583,
29889,
1188,
29889,
8382,
703,
24602,
29901,
317,
6259,
25152,
3210,
17262,
23157,
13,
2
] |
library/docker/docker.py | Kafkamorph/shutit | 0 | 46719 | <filename>library/docker/docker.py
#Copyright (C) 2014 OpenBet Limited
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is furnished
#to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
#FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
#COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
#IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
#CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from shutit_module import ShutItModule
class docker(ShutItModule):
def build(self,shutit):
shutit.send('echo deb http://archive.ubuntu.com/ubuntu precise universe > /etc/apt/sources.list.d/universe.list')
shutit.send('apt-get update -qq')
shutit.install('iptables')
shutit.install('ca-certificates')
shutit.install('lxc')
shutit.install('curl')
shutit.install('aufs-tools')
shutit.send('pushd /usr/bin')
shutit.send('curl https://get.docker.io/builds/Linux/x86_64/docker-latest > docker')
shutit.send('chmod +x docker')
wrapdocker = """cat > /usr/bin/wrapdocker << 'END'
#!/bin/bash
# First, make sure that cgroups are mounted correctly.
CGROUP=/sys/fs/cgroup
[ -d $CGROUP ] ||
mkdir $CGROUP
mountpoint -q $CGROUP ||
mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup $CGROUP || {
echo "Could not make a tmpfs mount. Did you use -privileged?"
exit 1
}
if [ -d /sys/kernel/security ] && ! mountpoint -q /sys/kernel/security
then
mount -t securityfs none /sys/kernel/security || {
echo "Could not mount /sys/kernel/security."
echo "AppArmor detection and -privileged mode might break."
}
fi
# Mount the cgroup hierarchies exactly as they are in the parent system.
for SUBSYS in $(cut -d: -f2 /proc/1/cgroup)
do
[ -d $CGROUP/$SUBSYS ] || mkdir $CGROUP/$SUBSYS
mountpoint -q $CGROUP/$SUBSYS ||
mount -n -t cgroup -o $SUBSYS cgroup $CGROUP/$SUBSYS
# The two following sections address a bug which manifests itself
# by a cryptic "lxc-start: no ns_cgroup option specified" when
# trying to start containers withina container.
# The bug seems to appear when the cgroup hierarchies are not
# mounted on the exact same directories in the host, and in the
# container.
# Named, control-less cgroups are mounted with "-o name=foo"
# (and appear as such under /proc/<pid>/cgroup) but are usually
# mounted on a directory named "foo" (without the "name=" prefix).
# Systemd and OpenRC (and possibly others) both create such a
# cgroup. To avoid the aforementioned bug, we symlink "foo" to
# "name=foo". This shouldn't have any adverse effect.
echo $SUBSYS | grep -q ^name= && {
NAME=$(echo $SUBSYS | sed s/^name=//)
ln -s $SUBSYS $CGROUP/$NAME
}
# Likewise, on at least one system, it has been reported that
# systemd would mount the CPU and CPU accounting controllers
# (respectively "cpu" and "cpuacct") with "-o cpuacct,cpu"
# but on a directory called "cpu,cpuacct" (note the inversion
# in the order of the groups). This tries to work around it.
[ $SUBSYS = cpuacct,cpu ] && ln -s $SUBSYS $CGROUP/cpu,cpuacct
done
# Note: as I write those lines, the LXC userland tools cannot setup
# a "sub-container" properly if the "devices" cgroup is not in its
# own hierarchy. Let's detect this and issue a warning.
grep -q :devices: /proc/1/cgroup ||
echo "WARNING: the 'devices' cgroup should be in its own hierarchy."
grep -qw devices /proc/1/cgroup ||
echo "WARNING: it looks like the 'devices' cgroup is not mounted."
# Now, close extraneous file descriptors.
pushd /proc/self/fd >/dev/null
for FD in *
do
case "$FD" in
# Keep stdin/stdout/stderr
[012])
;;
# Nuke everything else
*)
eval exec "$FD>&-"
;;
esac
done
popd >/dev/null
# If a pidfile is still around (for example after a container restart),
# delete it so that docker can start.
rm -rf /var/run/docker.pid
# If we were given a PORT environment variable, start as a simple daemon;
# otherwise, spawn a shell as well
if [ "$PORT" ]
then
exec docker -d -H 0.0.0.0:$PORT
else
docker -d &
exec bash
fi
END"""
shutit.send(wrapdocker)
shutit.send('chmod +x /usr/bin/wrapdocker')
start_docker = """cat > /root/start_docker.sh << 'END'
#!/bin/bash
/root/start_ssh_server.sh
docker -d &
/usr/bin/wrapdocker
echo "SSH Server up"
echo "Docker daemon running"
END"""
shutit.send(start_docker)
shutit.send('chmod +x /root/start_docker.sh')
shutit.send('popd')
return True
def is_installed(self,shutit):
config_dict = shutit.cfg
return False
def module():
return docker(
'shutit.tk.docker.docker', 0.396,
description='docker server (communicates with host\'s docker daemon)',
depends=['shutit.tk.setup', 'shutit.tk.ssh_server.ssh_server']
)
| [
1,
529,
9507,
29958,
5258,
29914,
14695,
29914,
14695,
29889,
2272,
13,
29937,
11882,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29946,
4673,
29933,
300,
28873,
13,
29937,
13,
29937,
27293,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
974,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
262,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
517,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
9708,
583,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
15252,
3276,
13,
29937,
517,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
1576,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
599,
13,
29937,
9708,
583,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
28350,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
29902,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
383,
1806,
8186,
1799,
13,
29937,
22051,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
26524,
29950,
24125,
6323,
13,
29937,
3217,
20055,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
13,
29937,
1177,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
19474,
8079,
6323,
2672,
13,
29937,
6007,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
7791,
7818,
12982,
1525,
29889,
13,
13,
3166,
12522,
277,
29918,
5453,
1053,
1383,
329,
3112,
7355,
13,
13,
1990,
10346,
29898,
2713,
329,
3112,
7355,
1125,
13,
13,
12,
1753,
2048,
29898,
1311,
29892,
845,
329,
277,
1125,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
8057,
2553,
1732,
597,
10867,
29889,
8767,
29889,
510,
29914,
8767,
18378,
19859,
1405,
847,
7070,
29914,
2156,
29914,
29879,
2863,
29889,
1761,
29889,
29881,
29914,
348,
12193,
29889,
1761,
1495,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
2156,
29899,
657,
2767,
448,
24349,
1495,
13,
12,
12,
845,
329,
277,
29889,
6252,
877,
21278,
1849,
1495,
13,
12,
12,
845,
329,
277,
29889,
6252,
877,
1113,
29899,
6327,
928,
1078,
1495,
13,
12,
12,
845,
329,
277,
29889,
6252,
877,
29880,
21791,
1495,
13,
12,
12,
845,
329,
277,
29889,
6252,
877,
18963,
1495,
13,
12,
12,
845,
329,
277,
29889,
6252,
877,
4987,
29879,
29899,
8504,
1495,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
5910,
29881,
847,
4855,
29914,
2109,
1495,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
18963,
2045,
597,
657,
29889,
14695,
29889,
601,
29914,
4282,
29879,
29914,
24085,
29914,
29916,
29947,
29953,
29918,
29953,
29946,
29914,
14695,
29899,
12333,
1405,
10346,
1495,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
305,
1545,
718,
29916,
10346,
1495,
13,
12,
12,
6312,
14695,
353,
9995,
4117,
1405,
847,
4855,
29914,
2109,
29914,
6312,
14695,
3532,
525,
11794,
29915,
13,
29937,
14708,
2109,
29914,
13067,
13,
13,
29937,
3824,
29892,
1207,
1854,
393,
274,
13155,
526,
19239,
5149,
29889,
13,
11135,
11419,
14327,
9675,
29914,
5847,
29914,
29883,
2972,
13,
13,
29961,
448,
29881,
395,
11135,
11419,
4514,
3830,
13,
11256,
3972,
395,
11135,
11419,
13,
13,
16476,
3149,
448,
29939,
395,
11135,
11419,
3830,
13,
16476,
448,
29876,
448,
29873,
13128,
5847,
448,
29877,
318,
333,
29922,
29900,
29892,
29887,
333,
29922,
29900,
29892,
8513,
29922,
29900,
29955,
29945,
29945,
274,
2972,
395,
11135,
11419,
3830,
426,
13,
8057,
376,
23323,
451,
1207,
263,
13128,
5847,
5766,
29889,
7440,
366,
671,
448,
22534,
488,
3192,
3026,
13,
13322,
29871,
29896,
13,
29913,
13,
13,
361,
518,
448,
29881,
847,
9675,
29914,
17460,
29914,
8926,
4514,
2607,
1738,
5766,
3149,
448,
29939,
847,
9675,
29914,
17460,
29914,
8926,
13,
6098,
13,
16476,
448,
29873,
6993,
5847,
5642,
847,
9675,
29914,
17460,
29914,
8926,
3830,
426,
13,
4706,
2916,
376,
23323,
451,
5766,
847,
9675,
29914,
17460,
29914,
8926,
1213,
13,
4706,
2916,
376,
2052,
1433,
12257,
15326,
322,
448,
22534,
488,
3192,
4464,
1795,
2867,
1213,
13,
1678,
500,
13,
7241,
13,
13,
29937,
8040,
278,
274,
2972,
6128,
1279,
583,
3721,
408,
896,
526,
297,
278,
3847,
1788,
29889,
13,
1454,
27092,
14816,
29903,
297,
2427,
7582,
448,
29881,
29901,
448,
29888,
29906,
847,
15439,
29914,
29896,
29914,
29883,
2972,
29897,
13,
1867,
13,
4706,
518,
448,
29881,
395,
11135,
11419,
13346,
20633,
14816,
29903,
4514,
3830,
29356,
395,
11135,
11419,
13346,
20633,
14816,
29903,
13,
4706,
5766,
3149,
448,
29939,
395,
11135,
11419,
13346,
20633,
14816,
29903,
3830,
13,
18884,
5766,
448,
29876,
448,
29873,
274,
2972,
448,
29877,
395,
20633,
14816,
29903,
274,
2972,
395,
11135,
11419,
13346,
20633,
14816,
29903,
13,
13,
4706,
396,
450,
1023,
1494,
13926,
3211,
263,
6494,
607,
10419,
29879,
3528,
13,
4706,
396,
491,
263,
24941,
293,
376,
29880,
21791,
29899,
2962,
29901,
694,
17534,
29918,
29883,
2972,
2984,
6790,
29908,
746,
13,
4706,
396,
1811,
304,
1369,
22637,
411,
1099,
5639,
29889,
13,
4706,
396,
450,
6494,
2444,
304,
2615,
746,
278,
274,
2972,
6128,
1279,
583,
526,
451,
13,
4706,
396,
19239,
373,
278,
2684,
1021,
17525,
297,
278,
3495,
29892,
322,
297,
278,
13,
4706,
396,
5639,
29889,
13,
13,
4706,
396,
405,
2795,
29892,
2761,
29899,
2222,
274,
13155,
526,
19239,
411,
11663,
29877,
1024,
29922,
5431,
29908,
13,
4706,
396,
313,
392,
2615,
408,
1316,
1090,
847,
15439,
29914,
29966,
5935,
20690,
29883,
2972,
29897,
541,
526,
5491,
13,
4706,
396,
19239,
373,
263,
3884,
4257,
376,
5431,
29908,
313,
14037,
278,
376,
978,
543,
10944,
467,
13,
4706,
396,
2184,
29881,
322,
4673,
10363,
313,
392,
10075,
4045,
29897,
1716,
1653,
1316,
263,
13,
4706,
396,
274,
2972,
29889,
1763,
4772,
278,
263,
1454,
882,
28487,
6494,
29892,
591,
9878,
828,
682,
376,
5431,
29908,
304,
13,
4706,
396,
376,
978,
29922,
5431,
1642,
910,
9273,
29915,
29873,
505,
738,
594,
3901,
2779,
29889,
13,
4706,
2916,
395,
20633,
14816,
29903,
891,
12680,
448,
29939,
6228,
978,
29922,
2607,
426,
13,
18884,
27085,
19758,
8057,
395,
20633,
14816,
29903,
891,
7048,
269,
29914,
29985,
978,
29922,
458,
29897,
13,
18884,
301,
29876,
448,
29879,
395,
20633,
14816,
29903,
395,
11135,
11419,
13346,
5813,
13,
4706,
500,
13,
13,
4706,
396,
8502,
3538,
29892,
373,
472,
3203,
697,
1788,
29892,
372,
756,
1063,
8967,
393,
13,
4706,
396,
1788,
29881,
723,
5766,
278,
10808,
322,
10808,
3633,
292,
21385,
13,
4706,
396,
313,
690,
1103,
3598,
376,
21970,
29908,
322,
376,
21970,
562,
312,
1159,
411,
11663,
29877,
26403,
562,
312,
29892,
21970,
29908,
13,
4706,
396,
541,
373,
263,
3884,
2000,
376,
21970,
29892,
21970,
562,
312,
29908,
313,
6812,
278,
297,
3259,
13,
4706,
396,
297,
278,
1797,
310,
278,
6471,
467,
910,
14335,
304,
664,
2820,
372,
29889,
13,
4706,
518,
395,
20633,
14816,
29903,
353,
26403,
562,
312,
29892,
21970,
4514,
2607,
301,
29876,
448,
29879,
395,
20633,
14816,
29903,
395,
11135,
11419,
29914,
21970,
29892,
21970,
562,
312,
13,
15091,
13,
13,
29937,
3940,
29901,
408,
306,
2436,
1906,
3454,
29892,
278,
365,
29990,
29907,
1404,
1049,
8492,
2609,
6230,
13,
29937,
263,
376,
1491,
29899,
7611,
29908,
6284,
565,
278,
376,
3359,
1575,
29908,
274,
2972,
338,
451,
297,
967,
13,
29937,
1914,
21277,
29889,
2803,
29915,
29879,
6459,
445,
322,
2228,
263,
9177,
29889,
13,
22385,
448,
29939,
584,
3359,
1575,
29901,
847,
15439,
29914,
29896,
29914,
29883,
2972,
3830,
13,
8057,
376,
29956,
25614,
29901,
278,
525,
3359,
1575,
29915,
274,
2972,
881,
367,
297,
967,
1914,
21277,
1213,
13,
22385,
448,
29939,
29893,
9224,
847,
15439,
29914,
29896,
29914,
29883,
2972,
3830,
13,
8057,
376,
29956,
25614,
29901,
372,
3430,
763,
278,
525,
3359,
1575,
29915,
274,
2972,
338,
451,
19239,
1213,
13,
13,
29937,
2567,
29892,
3802,
17541,
23584,
934,
29037,
943,
29889,
13,
5910,
29881,
847,
15439,
29914,
1311,
29914,
11512,
1405,
29914,
3359,
29914,
4304,
13,
1454,
383,
29928,
297,
334,
13,
1867,
13,
4878,
3908,
26453,
29908,
297,
13,
29937,
19152,
3659,
262,
29914,
25393,
29914,
303,
20405,
13,
29961,
29900,
29896,
29906,
2314,
13,
7859,
13,
29937,
12487,
446,
4129,
1683,
13,
7528,
13,
14513,
2279,
3908,
26453,
19250,
29899,
29908,
13,
7859,
13,
267,
562,
13,
15091,
13,
7323,
29881,
1405,
29914,
3359,
29914,
4304,
13,
13,
13,
29937,
960,
263,
23107,
1445,
338,
1603,
2820,
313,
1454,
1342,
1156,
263,
5639,
10715,
511,
13,
29937,
5217,
372,
577,
393,
10346,
508,
1369,
29889,
13,
1758,
448,
9600,
847,
1707,
29914,
3389,
29914,
14695,
29889,
5935,
13,
13,
29937,
960,
591,
892,
2183,
263,
349,
8476,
5177,
2286,
29892,
1369,
408,
263,
2560,
1146,
9857,
29936,
13,
29937,
6467,
29892,
29178,
263,
6473,
408,
1532,
13,
361,
518,
3908,
15082,
29908,
4514,
13,
6098,
13,
4258,
10346,
448,
29881,
448,
29950,
29871,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
17178,
15082,
13,
2870,
13,
13,
14695,
448,
29881,
669,
13,
4258,
10891,
13,
7241,
13,
11794,
15945,
29908,
13,
12,
12,
845,
329,
277,
29889,
6717,
29898,
6312,
14695,
29897,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
305,
1545,
718,
29916,
847,
4855,
29914,
2109,
29914,
6312,
14695,
1495,
13,
12,
12,
2962,
29918,
14695,
353,
9995,
4117,
1405,
847,
4632,
29914,
2962,
29918,
14695,
29889,
845,
3532,
525,
11794,
29915,
13,
29937,
14708,
2109,
29914,
13067,
13,
29914,
4632,
29914,
2962,
29918,
15269,
29918,
2974,
29889,
845,
13,
14695,
448,
29881,
669,
13,
29914,
4855,
29914,
2109,
29914,
6312,
14695,
13,
8057,
376,
1799,
29950,
5656,
701,
29908,
13,
8057,
376,
29928,
8658,
1146,
9857,
2734,
29908,
13,
11794,
15945,
29908,
13,
12,
12,
845,
329,
277,
29889,
6717,
29898,
2962,
29918,
14695,
29897,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
305,
1545,
718,
29916,
847,
4632,
29914,
2962,
29918,
14695,
29889,
845,
1495,
13,
12,
12,
845,
329,
277,
29889,
6717,
877,
7323,
29881,
1495,
13,
12,
12,
2457,
5852,
13,
13,
12,
1753,
338,
29918,
25537,
29898,
1311,
29892,
845,
329,
277,
1125,
13,
12,
12,
2917,
29918,
8977,
353,
12522,
277,
29889,
16859,
13,
12,
12,
2457,
7700,
13,
13,
13,
1753,
3883,
7295,
13,
12,
2457,
10346,
29898,
13,
12,
12,
29915,
845,
329,
277,
29889,
11178,
29889,
14695,
29889,
14695,
742,
29871,
29900,
29889,
29941,
29929,
29953,
29892,
13,
12,
12,
8216,
2433,
14695,
1923,
313,
27820,
1078,
411,
3495,
20333,
29879,
10346,
1146,
9857,
29897,
742,
13,
12,
12,
2716,
1975,
29922,
1839,
845,
329,
277,
29889,
11178,
29889,
14669,
742,
525,
845,
329,
277,
29889,
11178,
29889,
15269,
29918,
2974,
29889,
15269,
29918,
2974,
2033,
13,
12,
29897,
13,
13,
2
] |
mosqito/sound_level_meter/noct_spectrum/_nominal_frequency.py | MitchellAcoustics/MoSQITo | 1 | 197837 | from numpy import array
NOMINAL_OCTAVE_CENTER_FREQUENCIES = array(
[
31.5,
63.0,
125.0,
250.0,
500.0,
1000.0,
2000.0,
4000.0,
8000.0,
16000.0,
]
)
NOMINAL_THIRD_OCTAVE_CENTER_FREQUENCIES = array(
[
25.0,
31.5,
40.0,
50.0,
63.0,
80.0,
100.0,
125.0,
160.0,
200.0,
250.0,
315.0,
400.0,
500.0,
630.0,
800.0,
1000.0,
1250.0,
1600.0,
2000.0,
2500.0,
3150.0,
4000.0,
5000.0,
6300.0,
8000.0,
10000.0,
12500.0,
16000.0,
20000.0,
]
)
| [
1,
515,
12655,
1053,
1409,
13,
13,
29940,
6488,
1177,
1964,
29918,
29949,
1783,
7520,
29923,
29918,
29907,
3919,
1001,
29918,
29943,
1525,
13356,
1430,
8426,
2890,
353,
1409,
29898,
13,
1678,
518,
13,
308,
29941,
29896,
29889,
29945,
29892,
13,
308,
29953,
29941,
29889,
29900,
29892,
13,
308,
29896,
29906,
29945,
29889,
29900,
29892,
13,
308,
29906,
29945,
29900,
29889,
29900,
29892,
13,
308,
29945,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29906,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29946,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29947,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29953,
29900,
29900,
29900,
29889,
29900,
29892,
13,
1678,
4514,
13,
29897,
13,
13,
29940,
6488,
1177,
1964,
29918,
4690,
8193,
29928,
29918,
29949,
1783,
7520,
29923,
29918,
29907,
3919,
1001,
29918,
29943,
1525,
13356,
1430,
8426,
2890,
353,
1409,
29898,
13,
1678,
518,
13,
308,
29906,
29945,
29889,
29900,
29892,
13,
308,
29941,
29896,
29889,
29945,
29892,
13,
308,
29946,
29900,
29889,
29900,
29892,
13,
308,
29945,
29900,
29889,
29900,
29892,
13,
308,
29953,
29941,
29889,
29900,
29892,
13,
308,
29947,
29900,
29889,
29900,
29892,
13,
308,
29896,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29906,
29945,
29889,
29900,
29892,
13,
308,
29896,
29953,
29900,
29889,
29900,
29892,
13,
308,
29906,
29900,
29900,
29889,
29900,
29892,
13,
308,
29906,
29945,
29900,
29889,
29900,
29892,
13,
308,
29941,
29896,
29945,
29889,
29900,
29892,
13,
308,
29946,
29900,
29900,
29889,
29900,
29892,
13,
308,
29945,
29900,
29900,
29889,
29900,
29892,
13,
308,
29953,
29941,
29900,
29889,
29900,
29892,
13,
308,
29947,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29906,
29945,
29900,
29889,
29900,
29892,
13,
308,
29896,
29953,
29900,
29900,
29889,
29900,
29892,
13,
308,
29906,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29906,
29945,
29900,
29900,
29889,
29900,
29892,
13,
308,
29941,
29896,
29945,
29900,
29889,
29900,
29892,
13,
308,
29946,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29945,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29953,
29941,
29900,
29900,
29889,
29900,
29892,
13,
308,
29947,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29900,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29906,
29945,
29900,
29900,
29889,
29900,
29892,
13,
308,
29896,
29953,
29900,
29900,
29900,
29889,
29900,
29892,
13,
308,
29906,
29900,
29900,
29900,
29900,
29889,
29900,
29892,
13,
1678,
4514,
13,
29897,
13,
2
] |
chess/__main__.py | quadratic-bit/pygame-chess | 3 | 35477 | <filename>chess/__main__.py
from sys import exit
from typing import Optional, Final
import pygame
from rich.traceback import install
from chess.board import Chessboard, Move, PieceType, PieceColour
from chess.bot import ChessBot
from chess.const import GameState
from chess.utils import load_image, load_sound, load_font
install(show_locals=True)
def terminate() -> None:
pygame.quit()
exit(0)
def main():
# Game setup
# Pygame stuff
pygame.init()
SCREEN_W, SCREEN_H = SCREEN_SHAPE = 1200, 800 # type: Final
screen = pygame.display.set_mode(SCREEN_SHAPE)
pygame.display.set_caption("Chess")
# Colours
colour_bg = pygame.Color("#443742")
colour_contrast_bg = pygame.Color("#8D80AD")
# FPS handler
clock = pygame.time.Clock()
FPS = 60
# Creating a board using FEN
# Start position: rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
# Advanced: 1r1q3r/3b2bk/p5pp/2QB4/5p2/P5nP/1PP5/2KRR3 b - - 6 12
# Pawn promotion: 8/6P1/2Q5/4p3/3qP3/5Q2/1q3PK1/qk6 w - - 36 73
# Checkmate: 3rkbnr/1p1bp3/1q1p3p/p5p1/3n4/PPR2Q2/5PPP/6K1 w - - 1 2
fen_game_state = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
board = Chessboard.from_fen(fen_game_state)
# Sounds
sound_common = load_sound("common.ogg")
sound_check = load_sound("check.ogg")
# Fonts
font_header = load_font("ubuntumono/UbuntuMono-R.ttf", 90)
font_option = load_font("ubuntumono/UbuntuMono-B.ttf", 55)
# Defining variables to interact with player
grabbing: Optional[tuple[int, int]] = None
hovering = False
# Render Flag
last_move: Optional[Move] = None
# Defining game loop functions
def start_screen() -> None:
"""Start screen"""
nonlocal screen, font_header, font_option
bg_start_img = pygame.transform.scale(load_image('bg_start.png'), SCREEN_SHAPE)
title = font_header.render("Шахматы", True, pygame.Color("white"))
option = font_option.render("Нажмите любую клавишу...", True, pygame.Color("white"))
screen.blit(bg_start_img, (0, 0))
screen.blit(title, (420, 200))
screen.blit(option, (270, 650))
pygame.display.flip()
while True:
for event_ in pygame.event.get():
if event_.type == pygame.QUIT:
terminate()
elif event_.type == pygame.KEYDOWN or event_.type == pygame.MOUSEBUTTONDOWN:
return
clock.tick(FPS)
def choose_game_mode_screen() -> bool:
"""Game mode screen ( True if vs AI, False otherwise )"""
nonlocal screen
screen.fill(colour_bg)
pygame.draw.rect(screen, colour_contrast_bg, (300, 352, 600, 96))
pygame.draw.rect(screen, colour_contrast_bg, (340, 576, 520, 96))
button_vs_ai = font_header.render("Выберите режим игры", True, "white")
button_vs_player = font_option.render("Против компьютера", True, "black")
screen.blit(button_vs_ai, (170, 131))
screen.blit(button_vs_player, (400, 368))
screen.blit(font_option.render("Против игрока", True, "black"), (460, 593))
# Icons by Font Awesome!
# License: https://fontawesome.com/license/free
screen.blit(pygame.transform.scale(load_image('desktop-solid.png'), (80, 80)), (308, 360))
screen.blit(pygame.transform.scale(load_image('chess-solid.png'), (80, 80)), (348, 584))
pygame.display.flip()
button_rects = [pygame.Rect(300, 352, 600, 96), pygame.Rect(340, 576, 520, 96)]
def is_colliding(m_pos: tuple[int, int]) -> bool:
return any(map(lambda b: b.x < m_pos[0] < b.x + b.w and b.y < m_pos[1] < b.y + b.h, button_rects))
while True:
for event_ in pygame.event.get():
if event_.type == pygame.QUIT:
terminate()
elif event_.type == pygame.MOUSEBUTTONDOWN:
if is_colliding(event_.pos):
if button_rects[0].x < event_.pos[0] < button_rects[0].x + button_rects[0].w and \
button_rects[0].y < event_.pos[1] < button_rects[0].y + button_rects[0].h:
return True
return False
elif event_.type == pygame.MOUSEMOTION:
if is_colliding(event_.pos):
pygame.mouse.set_cursor(pygame.SYSTEM_CURSOR_HAND)
else:
pygame.mouse.set_cursor(pygame.SYSTEM_CURSOR_ARROW)
clock.tick(FPS)
def end_screen(state: GameState, board_state: tuple) -> None:
board.render(screen, last_move, game_info=board_state)
scaffold = pygame.Surface(SCREEN_SHAPE)
pygame.draw.rect(scaffold, pygame.Color("black"),
(0, 0, SCREEN_W, SCREEN_H))
scaffold.set_alpha(0)
screen.blit(scaffold, (0, 0))
end_font = load_font("ubuntumono/UbuntuMono-R.ttf", 90)
end_font_colour = pygame.Color("white")
mate = end_font.render(
"Мат!"
if state == GameState.Checkmate
else "Пат!", True, end_font_colour)
score = end_font.render(
"0-1"
if board.active_colour == PieceColour.White
else "1-0", True, end_font_colour)
bg = pygame.Surface((600, 400))
bg.fill(pygame.Color("black"))
bg.set_alpha(180)
mate.set_alpha(255)
score.set_alpha(255)
mate_rect = mate.get_rect()
bg_rect = bg.get_rect()
score_rect = score.get_rect()
mdx = (bg_rect.w - mate_rect.w) // 2
mdy = (bg_rect.h - mate_rect.h) // 3
sdx = (bg_rect.w - score_rect.w) // 2
sdy = (bg_rect.h - score_rect.h) // 1.5
screen.blit(bg, (300, 200))
screen.blit(mate, (300 + mdx, 200 + mdy))
screen.blit(score, (300 + sdx, 200 + sdy))
pygame.display.flip()
pygame.mouse.set_cursor(pygame.SYSTEM_CURSOR_ARROW)
while True:
for e in pygame.event.get():
if e.type == pygame.QUIT:
terminate()
elif e.type == pygame.KEYDOWN or e.type == pygame.MOUSEBUTTONDOWN:
return
def toggle_state(board_state: tuple) -> bool:
"""Check and toggle game state (for endgames especially)"""
state = board.toggle_state()
if state == GameState.Continue:
return False
else:
end_screen(state, board_state)
return True
def game_loop(vs_ai: bool) -> None:
"""Main game loop"""
nonlocal grabbing, hovering, last_move
# My linter can't handle unsigned variables like these
bot = last_move_uncaught = None
if vs_ai:
# Initialising the AI
bot = ChessBot()
# Bot Flag
last_move_uncaught = False
# Toggle flag
board_info: Optional[tuple] = None
# Initial rendering
board.render(screen)
pygame.display.flip()
# Starting main loop
while True:
for event in pygame.event.get():
# Quitting game
if event.type == pygame.QUIT:
terminate()
# LMB while hovering above a piece (grab a piece)
if event.type == pygame.MOUSEBUTTONDOWN and \
event.button == pygame.BUTTON_LEFT and hovering:
# Find grabbed piece
grabbing = (event.pos[0] // 100, event.pos[1] // 100)
if board.at(*grabbing).Colour != board.active_colour:
# Wrong colour!
grabbing = None
else:
# Render a board with that grabbed piece being grabbed
board.render(screen, last_move, grabbing, event.pos,
game_info=board_info)
pygame.display.flip()
# Releasing LMB
elif event.type == pygame.MOUSEBUTTONUP and \
event.button == pygame.BUTTON_LEFT:
# Get position where player dropped the piece
released = (event.pos[0] // 100, event.pos[1] // 100)
if pygame.mouse.get_focused() and grabbing is not None and \
released != grabbing and event.pos[0] <= 800 and \
event.pos[1] <= 800:
# Trying to make move
x, y = grabbing[0] + grabbing[1] * 8, \
released[0] + released[1] * 8
move = Move(x, y, board.at(*released))
# If we can make move -> let the bot make the next one
move = board.can_make(move)
if move is not None:
board.make_move(move)
if board.king_is_safe(board.passive_colour):
sound_common.play()
else:
sound_check.play()
last_move = move
last_move_uncaught = True
if toggle_state(board_info):
return
# Stop grabbing
grabbing = None
# Rendering board after releasing piece
board.render(screen, last_move, game_info=board_info)
pygame.display.flip()
if vs_ai and last_move_uncaught is not None and bot is not None:
# Bot's turn
if last_move is not None and last_move_uncaught:
last_move, board_info = bot.get_move(board, last_move)
board.make_move(last_move)
if board.king_is_safe(board.passive_colour):
sound_common.play()
else:
sound_check.play()
if toggle_state(board_info):
return
# Updating flag
last_move_uncaught = False
# Rendering board after bot's turn
board.render(screen, last_move, game_info=board_info)
pygame.display.flip()
# Handling mouse and cursor
if pygame.mouse.get_focused():
pos = pygame.mouse.get_pos()
# Changing cursor state
if board.at(pos[0] // 100, pos[1] // 100).Type != PieceType.Empty:
pygame.mouse.set_cursor(pygame.SYSTEM_CURSOR_HAND)
hovering = True
else:
pygame.mouse.set_cursor(pygame.SYSTEM_CURSOR_ARROW)
hovering = False
# Rendering board and a hovering piece
if grabbing:
board.render(screen, last_move, grabbing, pos,
game_info=board_info)
pygame.display.flip()
else:
# Mouse is out of window -> stop grabbing
grabbing = None
board.render(screen, last_move, game_info=board_info)
pygame.display.flip()
hovering = False
clock.tick(FPS)
# Starting the game
start_screen()
while True:
# Main loop
game_loop(choose_game_mode_screen())
# Resetting the board
board = Chessboard.from_fen(fen_game_state)
if __name__ == "__main__":
main()
| [
1,
529,
9507,
29958,
305,
404,
29914,
1649,
3396,
26914,
2272,
13,
3166,
10876,
1053,
6876,
13,
3166,
19229,
1053,
28379,
29892,
9550,
13,
13,
5215,
22028,
13,
3166,
8261,
29889,
15003,
1627,
1053,
2601,
13,
13,
3166,
521,
404,
29889,
3377,
1053,
678,
404,
3377,
29892,
25249,
29892,
26005,
346,
1542,
29892,
26005,
346,
1625,
473,
13,
3166,
521,
404,
29889,
7451,
1053,
678,
404,
29933,
327,
13,
3166,
521,
404,
29889,
3075,
1053,
8448,
2792,
13,
3166,
521,
404,
29889,
13239,
1053,
2254,
29918,
3027,
29892,
2254,
29918,
29802,
29892,
2254,
29918,
5657,
13,
13,
6252,
29898,
4294,
29918,
2997,
29879,
29922,
5574,
29897,
13,
13,
13,
1753,
29504,
580,
1599,
6213,
29901,
13,
1678,
22028,
29889,
28358,
580,
13,
1678,
6876,
29898,
29900,
29897,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
396,
8448,
6230,
13,
13,
1678,
396,
349,
4790,
420,
6433,
13,
1678,
22028,
29889,
2344,
580,
13,
1678,
12314,
1525,
1430,
29918,
29956,
29892,
12314,
1525,
1430,
29918,
29950,
353,
12314,
1525,
1430,
29918,
7068,
3301,
29923,
353,
29871,
29896,
29906,
29900,
29900,
29892,
29871,
29947,
29900,
29900,
29871,
396,
1134,
29901,
9550,
13,
1678,
4315,
353,
22028,
29889,
4990,
29889,
842,
29918,
8513,
29898,
7187,
1525,
1430,
29918,
7068,
3301,
29923,
29897,
13,
1678,
22028,
29889,
4990,
29889,
842,
29918,
6671,
703,
1451,
404,
1159,
13,
1678,
396,
1530,
2470,
13,
1678,
12384,
29918,
16264,
353,
22028,
29889,
3306,
14822,
29946,
29946,
29941,
29955,
29946,
29906,
1159,
13,
1678,
12384,
29918,
9996,
579,
29918,
16264,
353,
22028,
29889,
3306,
14822,
29947,
29928,
29947,
29900,
3035,
1159,
13,
1678,
396,
383,
7024,
7834,
13,
1678,
12006,
353,
22028,
29889,
2230,
29889,
29907,
908,
580,
13,
1678,
383,
7024,
353,
29871,
29953,
29900,
13,
1678,
396,
26221,
263,
7613,
773,
383,
1430,
13,
1678,
396,
7370,
2602,
29901,
364,
9877,
29939,
29895,
11197,
29878,
29914,
407,
407,
407,
407,
29914,
29947,
29914,
29947,
29914,
29947,
29914,
29947,
29914,
18009,
18009,
18009,
18009,
29914,
29934,
23189,
29984,
26067,
16514,
281,
476,
29984,
29895,
29939,
448,
29871,
29900,
29871,
29896,
13,
1678,
396,
29287,
29901,
4706,
29896,
29878,
29896,
29939,
29941,
29878,
29914,
29941,
29890,
29906,
29890,
29895,
29914,
29886,
29945,
407,
29914,
29906,
29984,
29933,
29946,
29914,
29945,
29886,
29906,
29914,
29925,
29945,
29876,
29925,
29914,
29896,
18009,
29945,
29914,
29906,
29968,
29934,
29934,
29941,
289,
448,
448,
29871,
29953,
29871,
29896,
29906,
13,
1678,
396,
2621,
1233,
22360,
29901,
29871,
29947,
29914,
29953,
29925,
29896,
29914,
29906,
29984,
29945,
29914,
29946,
29886,
29941,
29914,
29941,
29939,
29925,
29941,
29914,
29945,
29984,
29906,
29914,
29896,
29939,
29941,
21738,
29896,
29914,
29939,
29895,
29953,
281,
448,
448,
29871,
29941,
29953,
29871,
29955,
29941,
13,
1678,
396,
5399,
25046,
29901,
539,
29941,
29878,
29895,
11197,
29878,
29914,
29896,
29886,
29896,
25288,
29941,
29914,
29896,
29939,
29896,
29886,
29941,
29886,
29914,
29886,
29945,
29886,
29896,
29914,
29941,
29876,
29946,
29914,
29925,
10593,
29906,
29984,
29906,
29914,
29945,
18009,
29925,
29914,
29953,
29968,
29896,
281,
448,
448,
29871,
29896,
29871,
29906,
13,
1678,
18371,
29918,
11802,
29918,
3859,
353,
376,
29878,
9877,
29939,
29895,
11197,
29878,
29914,
407,
407,
407,
407,
29914,
29947,
29914,
29947,
29914,
29947,
29914,
29947,
29914,
18009,
18009,
18009,
18009,
29914,
29934,
23189,
29984,
26067,
16514,
281,
476,
29984,
29895,
29939,
448,
29871,
29900,
29871,
29896,
29908,
13,
1678,
7613,
353,
678,
404,
3377,
29889,
3166,
29918,
11350,
29898,
11350,
29918,
11802,
29918,
3859,
29897,
13,
1678,
396,
317,
3885,
13,
1678,
6047,
29918,
9435,
353,
2254,
29918,
29802,
703,
9435,
29889,
468,
29887,
1159,
13,
1678,
6047,
29918,
3198,
353,
2254,
29918,
29802,
703,
3198,
29889,
468,
29887,
1159,
13,
1678,
396,
10928,
29879,
13,
1678,
4079,
29918,
6672,
353,
2254,
29918,
5657,
703,
431,
1657,
398,
3231,
29914,
29965,
6037,
29924,
3231,
29899,
29934,
29889,
698,
29888,
613,
29871,
29929,
29900,
29897,
13,
1678,
4079,
29918,
3385,
353,
2254,
29918,
5657,
703,
431,
1657,
398,
3231,
29914,
29965,
6037,
29924,
3231,
29899,
29933,
29889,
698,
29888,
613,
29871,
29945,
29945,
29897,
13,
1678,
396,
5282,
2827,
3651,
304,
16254,
411,
4847,
13,
1678,
2646,
1327,
292,
29901,
28379,
29961,
23583,
29961,
524,
29892,
938,
5262,
353,
6213,
13,
1678,
16758,
292,
353,
7700,
13,
1678,
396,
26000,
28697,
13,
1678,
1833,
29918,
11631,
29901,
28379,
29961,
16619,
29962,
353,
6213,
13,
13,
1678,
396,
5282,
2827,
3748,
2425,
3168,
13,
13,
1678,
822,
1369,
29918,
10525,
580,
1599,
6213,
29901,
13,
4706,
9995,
4763,
4315,
15945,
29908,
13,
4706,
1661,
2997,
4315,
29892,
4079,
29918,
6672,
29892,
4079,
29918,
3385,
13,
4706,
25989,
29918,
2962,
29918,
2492,
353,
22028,
29889,
9067,
29889,
7052,
29898,
1359,
29918,
3027,
877,
16264,
29918,
2962,
29889,
2732,
5477,
12314,
1525,
1430,
29918,
7068,
3301,
29923,
29897,
13,
4706,
3611,
353,
4079,
29918,
6672,
29889,
9482,
703,
30074,
29910,
29988,
1155,
3327,
613,
5852,
29892,
22028,
29889,
3306,
703,
10921,
5783,
13,
4706,
2984,
353,
4079,
29918,
3385,
29889,
9482,
703,
19193,
29998,
989,
730,
6331,
3378,
30005,
9955,
1221,
10360,
856,
613,
5852,
29892,
22028,
29889,
3306,
703,
10921,
5783,
13,
4706,
4315,
29889,
2204,
277,
29898,
16264,
29918,
2962,
29918,
2492,
29892,
313,
29900,
29892,
29871,
29900,
876,
13,
4706,
4315,
29889,
2204,
277,
29898,
3257,
29892,
313,
29946,
29906,
29900,
29892,
29871,
29906,
29900,
29900,
876,
13,
4706,
4315,
29889,
2204,
277,
29898,
3385,
29892,
313,
29906,
29955,
29900,
29892,
29871,
29953,
29945,
29900,
876,
13,
4706,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
4706,
1550,
5852,
29901,
13,
9651,
363,
1741,
29918,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
18884,
565,
1741,
5396,
1853,
1275,
22028,
29889,
13356,
1806,
29901,
13,
462,
1678,
29504,
580,
13,
18884,
25342,
1741,
5396,
1853,
1275,
22028,
29889,
10818,
3970,
16048,
470,
1741,
5396,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
3970,
16048,
29901,
13,
462,
1678,
736,
13,
9651,
12006,
29889,
24667,
29898,
29943,
7024,
29897,
13,
13,
1678,
822,
6755,
29918,
11802,
29918,
8513,
29918,
10525,
580,
1599,
6120,
29901,
13,
4706,
9995,
14199,
4464,
4315,
313,
5852,
565,
7186,
319,
29902,
29892,
7700,
6467,
1723,
15945,
29908,
13,
4706,
1661,
2997,
4315,
13,
4706,
4315,
29889,
5589,
29898,
1054,
473,
29918,
16264,
29897,
13,
4706,
22028,
29889,
4012,
29889,
1621,
29898,
10525,
29892,
12384,
29918,
9996,
579,
29918,
16264,
29892,
313,
29941,
29900,
29900,
29892,
29871,
29941,
29945,
29906,
29892,
29871,
29953,
29900,
29900,
29892,
29871,
29929,
29953,
876,
13,
4706,
22028,
29889,
4012,
29889,
1621,
29898,
10525,
29892,
12384,
29918,
9996,
579,
29918,
16264,
29892,
313,
29941,
29946,
29900,
29892,
29871,
29945,
29955,
29953,
29892,
29871,
29945,
29906,
29900,
29892,
29871,
29929,
29953,
876,
13,
4706,
2826,
29918,
4270,
29918,
1794,
353,
4079,
29918,
6672,
29889,
9482,
703,
30012,
29982,
3759,
23314,
16223,
29959,
10689,
3541,
613,
5852,
29892,
376,
10921,
1159,
13,
4706,
2826,
29918,
4270,
29918,
9106,
353,
4079,
29918,
3385,
29889,
9482,
703,
30013,
576,
3499,
16042,
9860,
6713,
613,
5852,
29892,
376,
8517,
1159,
13,
4706,
4315,
29889,
2204,
277,
29898,
3092,
29918,
4270,
29918,
1794,
29892,
313,
29896,
29955,
29900,
29892,
29871,
29896,
29941,
29896,
876,
13,
4706,
4315,
29889,
2204,
277,
29898,
3092,
29918,
4270,
29918,
9106,
29892,
313,
29946,
29900,
29900,
29892,
29871,
29941,
29953,
29947,
876,
13,
4706,
4315,
29889,
2204,
277,
29898,
5657,
29918,
3385,
29889,
9482,
703,
30013,
576,
3499,
10689,
576,
642,
613,
5852,
29892,
376,
8517,
4968,
313,
29946,
29953,
29900,
29892,
29871,
29945,
29929,
29941,
876,
13,
4706,
396,
306,
3200,
491,
10928,
22886,
14151,
29991,
13,
4706,
396,
19245,
29901,
2045,
597,
5657,
1450,
14151,
29889,
510,
29914,
506,
1947,
29914,
9021,
13,
4706,
4315,
29889,
2204,
277,
29898,
2272,
11802,
29889,
9067,
29889,
7052,
29898,
1359,
29918,
3027,
877,
20858,
29899,
2929,
333,
29889,
2732,
5477,
313,
29947,
29900,
29892,
29871,
29947,
29900,
8243,
313,
29941,
29900,
29947,
29892,
29871,
29941,
29953,
29900,
876,
13,
4706,
4315,
29889,
2204,
277,
29898,
2272,
11802,
29889,
9067,
29889,
7052,
29898,
1359,
29918,
3027,
877,
305,
404,
29899,
2929,
333,
29889,
2732,
5477,
313,
29947,
29900,
29892,
29871,
29947,
29900,
8243,
313,
29941,
29946,
29947,
29892,
29871,
29945,
29947,
29946,
876,
13,
4706,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
4706,
2826,
29918,
1621,
29879,
353,
518,
2272,
11802,
29889,
7364,
29898,
29941,
29900,
29900,
29892,
29871,
29941,
29945,
29906,
29892,
29871,
29953,
29900,
29900,
29892,
29871,
29929,
29953,
511,
22028,
29889,
7364,
29898,
29941,
29946,
29900,
29892,
29871,
29945,
29955,
29953,
29892,
29871,
29945,
29906,
29900,
29892,
29871,
29929,
29953,
4638,
13,
13,
4706,
822,
338,
29918,
22017,
4821,
29898,
29885,
29918,
1066,
29901,
18761,
29961,
524,
29892,
938,
2314,
1599,
6120,
29901,
13,
9651,
736,
738,
29898,
1958,
29898,
2892,
289,
29901,
289,
29889,
29916,
529,
286,
29918,
1066,
29961,
29900,
29962,
529,
289,
29889,
29916,
718,
289,
29889,
29893,
322,
289,
29889,
29891,
529,
286,
29918,
1066,
29961,
29896,
29962,
529,
289,
29889,
29891,
718,
289,
29889,
29882,
29892,
2826,
29918,
1621,
29879,
876,
13,
13,
4706,
1550,
5852,
29901,
13,
9651,
363,
1741,
29918,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
18884,
565,
1741,
5396,
1853,
1275,
22028,
29889,
13356,
1806,
29901,
13,
462,
1678,
29504,
580,
13,
18884,
25342,
1741,
5396,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
3970,
16048,
29901,
13,
462,
1678,
565,
338,
29918,
22017,
4821,
29898,
3696,
5396,
1066,
1125,
13,
462,
4706,
565,
2826,
29918,
1621,
29879,
29961,
29900,
1822,
29916,
529,
1741,
5396,
1066,
29961,
29900,
29962,
529,
2826,
29918,
1621,
29879,
29961,
29900,
1822,
29916,
718,
2826,
29918,
1621,
29879,
29961,
29900,
1822,
29893,
322,
320,
13,
462,
18884,
2826,
29918,
1621,
29879,
29961,
29900,
1822,
29891,
529,
1741,
5396,
1066,
29961,
29896,
29962,
529,
2826,
29918,
1621,
29879,
29961,
29900,
1822,
29891,
718,
2826,
29918,
1621,
29879,
29961,
29900,
1822,
29882,
29901,
13,
462,
9651,
736,
5852,
13,
462,
4706,
736,
7700,
13,
18884,
25342,
1741,
5396,
1853,
1275,
22028,
29889,
6720,
17171,
29924,
2891,
2725,
29901,
13,
462,
1678,
565,
338,
29918,
22017,
4821,
29898,
3696,
5396,
1066,
1125,
13,
462,
4706,
22028,
29889,
15769,
29889,
842,
29918,
18127,
29898,
2272,
11802,
29889,
14816,
1254,
12665,
29918,
22484,
29903,
1955,
29918,
29950,
9468,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
22028,
29889,
15769,
29889,
842,
29918,
18127,
29898,
2272,
11802,
29889,
14816,
1254,
12665,
29918,
22484,
29903,
1955,
29918,
1718,
25180,
29897,
13,
9651,
12006,
29889,
24667,
29898,
29943,
7024,
29897,
13,
13,
1678,
822,
1095,
29918,
10525,
29898,
3859,
29901,
8448,
2792,
29892,
7613,
29918,
3859,
29901,
18761,
29897,
1599,
6213,
29901,
13,
4706,
7613,
29889,
9482,
29898,
10525,
29892,
1833,
29918,
11631,
29892,
3748,
29918,
3888,
29922,
3377,
29918,
3859,
29897,
13,
4706,
885,
3470,
1025,
353,
22028,
29889,
18498,
2161,
29898,
7187,
1525,
1430,
29918,
7068,
3301,
29923,
29897,
13,
4706,
22028,
29889,
4012,
29889,
1621,
29898,
29879,
1113,
600,
1025,
29892,
22028,
29889,
3306,
703,
8517,
4968,
13,
462,
308,
313,
29900,
29892,
29871,
29900,
29892,
12314,
1525,
1430,
29918,
29956,
29892,
12314,
1525,
1430,
29918,
29950,
876,
13,
4706,
885,
3470,
1025,
29889,
842,
29918,
2312,
29898,
29900,
29897,
13,
4706,
4315,
29889,
2204,
277,
29898,
29879,
1113,
600,
1025,
29892,
313,
29900,
29892,
29871,
29900,
876,
13,
4706,
1095,
29918,
5657,
353,
2254,
29918,
5657,
703,
431,
1657,
398,
3231,
29914,
29965,
6037,
29924,
3231,
29899,
29934,
29889,
698,
29888,
613,
29871,
29929,
29900,
29897,
13,
4706,
1095,
29918,
5657,
29918,
1054,
473,
353,
22028,
29889,
3306,
703,
10921,
1159,
13,
4706,
15358,
353,
1095,
29918,
5657,
29889,
9482,
29898,
13,
9651,
376,
30017,
12174,
3850,
13,
9651,
565,
2106,
1275,
8448,
2792,
29889,
5596,
25046,
13,
9651,
1683,
376,
30013,
12174,
29991,
613,
5852,
29892,
1095,
29918,
5657,
29918,
1054,
473,
29897,
13,
4706,
8158,
353,
1095,
29918,
5657,
29889,
9482,
29898,
13,
9651,
376,
29900,
29899,
29896,
29908,
13,
9651,
565,
7613,
29889,
4925,
29918,
1054,
473,
1275,
26005,
346,
1625,
473,
29889,
21823,
13,
9651,
1683,
376,
29896,
29899,
29900,
613,
5852,
29892,
1095,
29918,
5657,
29918,
1054,
473,
29897,
13,
4706,
25989,
353,
22028,
29889,
18498,
2161,
3552,
29953,
29900,
29900,
29892,
29871,
29946,
29900,
29900,
876,
13,
4706,
25989,
29889,
5589,
29898,
2272,
11802,
29889,
3306,
703,
8517,
5783,
13,
4706,
25989,
29889,
842,
29918,
2312,
29898,
29896,
29947,
29900,
29897,
13,
4706,
15358,
29889,
842,
29918,
2312,
29898,
29906,
29945,
29945,
29897,
13,
4706,
8158,
29889,
842,
29918,
2312,
29898,
29906,
29945,
29945,
29897,
13,
4706,
15358,
29918,
1621,
353,
15358,
29889,
657,
29918,
1621,
580,
13,
4706,
25989,
29918,
1621,
353,
25989,
29889,
657,
29918,
1621,
580,
13,
4706,
8158,
29918,
1621,
353,
8158,
29889,
657,
29918,
1621,
580,
13,
4706,
286,
8235,
353,
313,
16264,
29918,
1621,
29889,
29893,
448,
15358,
29918,
1621,
29889,
29893,
29897,
849,
29871,
29906,
13,
4706,
286,
4518,
353,
313,
16264,
29918,
1621,
29889,
29882,
448,
15358,
29918,
1621,
29889,
29882,
29897,
849,
29871,
29941,
13,
4706,
269,
8235,
353,
313,
16264,
29918,
1621,
29889,
29893,
448,
8158,
29918,
1621,
29889,
29893,
29897,
849,
29871,
29906,
13,
4706,
269,
4518,
353,
313,
16264,
29918,
1621,
29889,
29882,
448,
8158,
29918,
1621,
29889,
29882,
29897,
849,
29871,
29896,
29889,
29945,
13,
4706,
4315,
29889,
2204,
277,
29898,
16264,
29892,
313,
29941,
29900,
29900,
29892,
29871,
29906,
29900,
29900,
876,
13,
4706,
4315,
29889,
2204,
277,
29898,
25046,
29892,
313,
29941,
29900,
29900,
718,
286,
8235,
29892,
29871,
29906,
29900,
29900,
718,
286,
4518,
876,
13,
4706,
4315,
29889,
2204,
277,
29898,
13628,
29892,
313,
29941,
29900,
29900,
718,
269,
8235,
29892,
29871,
29906,
29900,
29900,
718,
269,
4518,
876,
13,
4706,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
4706,
22028,
29889,
15769,
29889,
842,
29918,
18127,
29898,
2272,
11802,
29889,
14816,
1254,
12665,
29918,
22484,
29903,
1955,
29918,
1718,
25180,
29897,
13,
4706,
1550,
5852,
29901,
13,
9651,
363,
321,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
18884,
565,
321,
29889,
1853,
1275,
22028,
29889,
13356,
1806,
29901,
13,
462,
1678,
29504,
580,
13,
18884,
25342,
321,
29889,
1853,
1275,
22028,
29889,
10818,
3970,
16048,
470,
321,
29889,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
3970,
16048,
29901,
13,
462,
1678,
736,
13,
13,
1678,
822,
20429,
29918,
3859,
29898,
3377,
29918,
3859,
29901,
18761,
29897,
1599,
6120,
29901,
13,
4706,
9995,
5596,
322,
20429,
3748,
2106,
313,
1454,
1095,
29887,
1280,
7148,
5513,
15945,
13,
4706,
2106,
353,
7613,
29889,
13270,
29918,
3859,
580,
13,
4706,
565,
2106,
1275,
8448,
2792,
29889,
1323,
14150,
29901,
13,
9651,
736,
7700,
13,
4706,
1683,
29901,
13,
9651,
1095,
29918,
10525,
29898,
3859,
29892,
7613,
29918,
3859,
29897,
13,
9651,
736,
5852,
13,
13,
1678,
822,
3748,
29918,
7888,
29898,
4270,
29918,
1794,
29901,
6120,
29897,
1599,
6213,
29901,
13,
4706,
9995,
6330,
3748,
2425,
15945,
29908,
13,
4706,
1661,
2997,
2646,
1327,
292,
29892,
16758,
292,
29892,
1833,
29918,
11631,
13,
13,
4706,
396,
1619,
301,
1639,
508,
29915,
29873,
4386,
12780,
3651,
763,
1438,
13,
4706,
9225,
353,
1833,
29918,
11631,
29918,
4661,
6482,
353,
6213,
13,
4706,
565,
7186,
29918,
1794,
29901,
13,
9651,
396,
17250,
5921,
278,
319,
29902,
13,
9651,
9225,
353,
678,
404,
29933,
327,
580,
13,
9651,
396,
11273,
28697,
13,
9651,
1833,
29918,
11631,
29918,
4661,
6482,
353,
7700,
13,
4706,
396,
323,
9804,
7353,
13,
4706,
7613,
29918,
3888,
29901,
28379,
29961,
23583,
29962,
353,
6213,
13,
4706,
396,
17250,
15061,
13,
4706,
7613,
29889,
9482,
29898,
10525,
29897,
13,
4706,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
13,
4706,
396,
23748,
1667,
2425,
13,
4706,
1550,
5852,
29901,
13,
9651,
363,
1741,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
18884,
396,
751,
5367,
3748,
13,
18884,
565,
1741,
29889,
1853,
1275,
22028,
29889,
13356,
1806,
29901,
13,
462,
1678,
29504,
580,
13,
18884,
396,
365,
9486,
1550,
16758,
292,
2038,
263,
8424,
313,
3874,
29890,
263,
8424,
29897,
13,
18884,
565,
1741,
29889,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
3970,
16048,
322,
320,
13,
462,
4706,
1741,
29889,
3092,
1275,
22028,
29889,
29933,
2692,
29911,
1164,
29918,
28024,
322,
16758,
292,
29901,
13,
462,
1678,
396,
10987,
2646,
1327,
287,
8424,
13,
462,
1678,
2646,
1327,
292,
353,
313,
3696,
29889,
1066,
29961,
29900,
29962,
849,
29871,
29896,
29900,
29900,
29892,
1741,
29889,
1066,
29961,
29896,
29962,
849,
29871,
29896,
29900,
29900,
29897,
13,
462,
1678,
565,
7613,
29889,
271,
10456,
3874,
1327,
292,
467,
1625,
473,
2804,
7613,
29889,
4925,
29918,
1054,
473,
29901,
13,
462,
4706,
396,
399,
29373,
12384,
29991,
13,
462,
4706,
2646,
1327,
292,
353,
6213,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
396,
26000,
263,
7613,
411,
393,
2646,
1327,
287,
8424,
1641,
2646,
1327,
287,
13,
462,
4706,
7613,
29889,
9482,
29898,
10525,
29892,
1833,
29918,
11631,
29892,
2646,
1327,
292,
29892,
1741,
29889,
1066,
29892,
13,
462,
462,
268,
3748,
29918,
3888,
29922,
3377,
29918,
3888,
29897,
13,
462,
4706,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
18884,
396,
830,
280,
5832,
365,
9486,
13,
18884,
25342,
1741,
29889,
1853,
1275,
22028,
29889,
6720,
17171,
29933,
2692,
29911,
1164,
4897,
322,
320,
13,
462,
4706,
1741,
29889,
3092,
1275,
22028,
29889,
29933,
2692,
29911,
1164,
29918,
28024,
29901,
13,
462,
1678,
396,
3617,
2602,
988,
4847,
13700,
278,
8424,
13,
462,
1678,
5492,
353,
313,
3696,
29889,
1066,
29961,
29900,
29962,
849,
29871,
29896,
29900,
29900,
29892,
1741,
29889,
1066,
29961,
29896,
29962,
849,
29871,
29896,
29900,
29900,
29897,
13,
462,
1678,
565,
22028,
29889,
15769,
29889,
657,
29918,
29888,
542,
3880,
580,
322,
2646,
1327,
292,
338,
451,
6213,
322,
320,
13,
462,
9651,
5492,
2804,
2646,
1327,
292,
322,
1741,
29889,
1066,
29961,
29900,
29962,
5277,
29871,
29947,
29900,
29900,
322,
320,
13,
462,
9651,
1741,
29889,
1066,
29961,
29896,
29962,
5277,
29871,
29947,
29900,
29900,
29901,
13,
462,
4706,
396,
24428,
304,
1207,
4337,
13,
462,
4706,
921,
29892,
343,
353,
2646,
1327,
292,
29961,
29900,
29962,
718,
2646,
1327,
292,
29961,
29896,
29962,
334,
29871,
29947,
29892,
320,
13,
462,
1669,
5492,
29961,
29900,
29962,
718,
5492,
29961,
29896,
29962,
334,
29871,
29947,
13,
462,
4706,
4337,
353,
25249,
29898,
29916,
29892,
343,
29892,
7613,
29889,
271,
10456,
276,
4611,
876,
13,
462,
4706,
396,
960,
591,
508,
1207,
4337,
1599,
1235,
278,
9225,
1207,
278,
2446,
697,
13,
462,
4706,
4337,
353,
7613,
29889,
3068,
29918,
5675,
29898,
11631,
29897,
13,
462,
4706,
565,
4337,
338,
451,
6213,
29901,
13,
462,
9651,
7613,
29889,
5675,
29918,
11631,
29898,
11631,
29897,
13,
462,
9651,
565,
7613,
29889,
9292,
29918,
275,
29918,
11177,
29898,
3377,
29889,
3364,
573,
29918,
1054,
473,
1125,
13,
462,
18884,
6047,
29918,
9435,
29889,
1456,
580,
13,
462,
9651,
1683,
29901,
13,
462,
18884,
6047,
29918,
3198,
29889,
1456,
580,
13,
462,
9651,
1833,
29918,
11631,
353,
4337,
13,
462,
9651,
1833,
29918,
11631,
29918,
4661,
6482,
353,
5852,
13,
462,
9651,
565,
20429,
29918,
3859,
29898,
3377,
29918,
3888,
1125,
13,
462,
18884,
736,
13,
462,
1678,
396,
22303,
2646,
1327,
292,
13,
462,
1678,
2646,
1327,
292,
353,
6213,
13,
462,
1678,
396,
26000,
292,
7613,
1156,
337,
280,
5832,
8424,
13,
462,
1678,
7613,
29889,
9482,
29898,
10525,
29892,
1833,
29918,
11631,
29892,
3748,
29918,
3888,
29922,
3377,
29918,
3888,
29897,
13,
462,
1678,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
462,
1678,
565,
7186,
29918,
1794,
322,
1833,
29918,
11631,
29918,
4661,
6482,
338,
451,
6213,
322,
9225,
338,
451,
6213,
29901,
13,
462,
4706,
396,
11273,
29915,
29879,
2507,
13,
462,
4706,
565,
1833,
29918,
11631,
338,
451,
6213,
322,
1833,
29918,
11631,
29918,
4661,
6482,
29901,
13,
462,
9651,
1833,
29918,
11631,
29892,
7613,
29918,
3888,
353,
9225,
29889,
657,
29918,
11631,
29898,
3377,
29892,
1833,
29918,
11631,
29897,
13,
462,
9651,
7613,
29889,
5675,
29918,
11631,
29898,
4230,
29918,
11631,
29897,
13,
462,
9651,
565,
7613,
29889,
9292,
29918,
275,
29918,
11177,
29898,
3377,
29889,
3364,
573,
29918,
1054,
473,
1125,
13,
462,
18884,
6047,
29918,
9435,
29889,
1456,
580,
13,
462,
9651,
1683,
29901,
13,
462,
18884,
6047,
29918,
3198,
29889,
1456,
580,
13,
462,
9651,
565,
20429,
29918,
3859,
29898,
3377,
29918,
3888,
1125,
13,
462,
18884,
736,
13,
462,
9651,
396,
5020,
26747,
7353,
13,
462,
9651,
1833,
29918,
11631,
29918,
4661,
6482,
353,
7700,
13,
462,
9651,
396,
26000,
292,
7613,
1156,
9225,
29915,
29879,
2507,
13,
462,
9651,
7613,
29889,
9482,
29898,
10525,
29892,
1833,
29918,
11631,
29892,
3748,
29918,
3888,
29922,
3377,
29918,
3888,
29897,
13,
462,
9651,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
9651,
396,
5166,
1847,
9495,
322,
10677,
13,
9651,
565,
22028,
29889,
15769,
29889,
657,
29918,
29888,
542,
3880,
7295,
13,
18884,
926,
353,
22028,
29889,
15769,
29889,
657,
29918,
1066,
580,
13,
18884,
396,
678,
9776,
10677,
2106,
13,
18884,
565,
7613,
29889,
271,
29898,
1066,
29961,
29900,
29962,
849,
29871,
29896,
29900,
29900,
29892,
926,
29961,
29896,
29962,
849,
29871,
29896,
29900,
29900,
467,
1542,
2804,
26005,
346,
1542,
29889,
8915,
29901,
13,
462,
1678,
22028,
29889,
15769,
29889,
842,
29918,
18127,
29898,
2272,
11802,
29889,
14816,
1254,
12665,
29918,
22484,
29903,
1955,
29918,
29950,
9468,
29897,
13,
462,
1678,
16758,
292,
353,
5852,
13,
18884,
1683,
29901,
13,
462,
1678,
22028,
29889,
15769,
29889,
842,
29918,
18127,
29898,
2272,
11802,
29889,
14816,
1254,
12665,
29918,
22484,
29903,
1955,
29918,
1718,
25180,
29897,
13,
462,
1678,
16758,
292,
353,
7700,
13,
18884,
396,
26000,
292,
7613,
322,
263,
16758,
292,
8424,
13,
18884,
565,
2646,
1327,
292,
29901,
13,
462,
1678,
7613,
29889,
9482,
29898,
10525,
29892,
1833,
29918,
11631,
29892,
2646,
1327,
292,
29892,
926,
29892,
13,
462,
462,
3748,
29918,
3888,
29922,
3377,
29918,
3888,
29897,
13,
462,
1678,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
9651,
1683,
29901,
13,
18884,
396,
25992,
338,
714,
310,
3474,
1599,
5040,
2646,
1327,
292,
13,
18884,
2646,
1327,
292,
353,
6213,
13,
18884,
7613,
29889,
9482,
29898,
10525,
29892,
1833,
29918,
11631,
29892,
3748,
29918,
3888,
29922,
3377,
29918,
3888,
29897,
13,
18884,
22028,
29889,
4990,
29889,
29888,
3466,
580,
13,
18884,
16758,
292,
353,
7700,
13,
9651,
12006,
29889,
24667,
29898,
29943,
7024,
29897,
13,
13,
1678,
396,
23748,
278,
3748,
13,
1678,
1369,
29918,
10525,
580,
13,
1678,
1550,
5852,
29901,
13,
4706,
396,
4241,
2425,
13,
4706,
3748,
29918,
7888,
29898,
21803,
29918,
11802,
29918,
8513,
29918,
10525,
3101,
13,
4706,
396,
2538,
300,
1259,
278,
7613,
13,
4706,
7613,
353,
678,
404,
3377,
29889,
3166,
29918,
11350,
29898,
11350,
29918,
11802,
29918,
3859,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
test/agenda_test.py | chalothon/CLIPS_1 | 0 | 52297 | <gh_stars>0
import unittest
from clips import Environment, CLIPSError, Strategy, SalienceEvaluation
DEFTEMPLATE = """(deftemplate template-fact
(slot template-slot))
"""
DEFRULE = """(defrule MAIN::rule-name
(declare (salience 10))
(implied-fact implied-value)
=>
(assert (rule-fired)))
"""
DEFTEMPLATERULE = """(defrule MAIN::rule-name
(implied-fact implied-value)
(template-fact (template-slot template-value))
=>
(assert (rule-fired)))
"""
DEFOTHERRULE = """(defrule MAIN::other-rule-name
(declare (salience 20))
(implied-fact implied-value)
=>
(assert (rule-fired)))
"""
class TestAgenda(unittest.TestCase):
def setUp(self):
self.env = Environment()
self.env.build(DEFTEMPLATE)
self.env.build(DEFRULE)
def test_agenda_strategy(self):
"""Agenda strategy getting/setting."""
for strategy in Strategy:
self.env.strategy = strategy
self.assertEqual(self.env.strategy, strategy)
def test_agenda_salience_evaluation(self):
"""Agenda salience_evaluation getting/setting."""
for salience_evaluation in SalienceEvaluation:
self.env.salience_evaluation = salience_evaluation
self.assertEqual(
self.env.salience_evaluation, salience_evaluation)
def test_agenda_activation(self):
"""Agenda activation test."""
self.env.assert_string('(implied-fact implied-value)')
self.assertTrue(self.env.agenda_changed)
activation = tuple(self.env.activations())[0]
self.assertEqual(activation.name, 'rule-name')
self.assertEqual(activation.salience, 10)
self.assertEqual(str(activation), '10 rule-name: f-1')
self.assertEqual(repr(activation), 'Activation: 10 rule-name: f-1')
activation.delete()
self.assertFalse(activation in self.env.activations())
def test_agenda_run(self):
"""Agenda rules are fired on run."""
self.env.assert_string('(implied-fact implied-value)')
self.env.run()
fact_names = (f.template.name for f in self.env.facts())
self.assertTrue('rule-fired' in fact_names)
def test_agenda_activation_order(self):
"""Agenda activations order change if salience or strategy change."""
self.env.build(DEFOTHERRULE)
self.env.assert_string('(implied-fact implied-value)')
self.assertTrue(self.env.agenda_changed)
activations = tuple(self.env.activations())
self.assertEqual(tuple(a.name for a in activations),
(u'other-rule-name', u'rule-name'))
activations[1].salience = 30
self.assertFalse(self.env.agenda_changed)
self.env.reorder()
self.assertTrue(self.env.agenda_changed)
activations = tuple(self.env.activations())
self.assertEqual(tuple(a.name for a in activations),
(u'rule-name', u'other-rule-name'))
self.env.refresh()
self.assertTrue(self.env.agenda_changed)
self.env.clear()
activations = tuple(self.env.activations())
self.assertEqual(len(activations), 0)
class TestRules(unittest.TestCase):
def setUp(self):
self.env = Environment()
self.env.build(DEFTEMPLATE)
self.env.build(DEFTEMPLATERULE)
def test_rule_build(self):
"""Simple Rule build."""
rule = self.env.find_rule('rule-name')
self.assertTrue(rule in self.env.rules())
self.assertEqual(rule.module.name, 'MAIN')
self.assertTrue(rule.deletable)
self.assertEqual(str(rule), DEFTEMPLATERULE)
self.assertEqual(repr(rule), "Rule: %s" % DEFTEMPLATERULE)
self.assertFalse(rule.watch_firings)
rule.watch_firings = True
self.assertTrue(rule.watch_firings)
self.assertFalse(rule.watch_activations)
rule.watch_activations = True
self.assertTrue(rule.watch_activations)
rule.undefine()
with self.assertRaises(LookupError):
self.env.find_rule('rule-name')
with self.assertRaises(TypeError):
rule.name
def test_rule_matches(self):
"""Partial rule matches."""
rule = self.env.find_rule('rule-name')
self.env.assert_string('(implied-fact implied-value)')
self.assertEqual(rule.matches(), (1, 0, 0))
rule.undefine()
def test_rule_activation(self):
"""Rule activation."""
rule = self.env.find_rule('rule-name')
self.env.assert_string('(implied-fact implied-value)')
self.env.assert_string(
'(template-fact (template-slot template-value))')
self.assertEqual(rule.matches(), (2, 1, 1))
self.env.run()
rule.refresh()
fact_names = (f.template.name for f in self.env.facts())
self.assertTrue('rule-fired' in fact_names)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
443,
27958,
13,
13,
3166,
9335,
567,
1053,
16738,
29892,
24492,
29925,
29173,
29892,
3767,
8963,
29892,
317,
2606,
663,
29923,
4387,
362,
13,
13,
13,
24405,
4330,
3580,
29931,
3040,
353,
9995,
29898,
311,
615,
331,
2341,
4472,
29899,
17028,
13,
29871,
313,
2536,
327,
4472,
29899,
2536,
327,
876,
13,
15945,
29908,
13,
13,
2287,
15860,
29965,
1307,
353,
9995,
29898,
1753,
7491,
14861,
1177,
1057,
7491,
29899,
978,
13,
259,
313,
7099,
8663,
313,
29879,
2606,
663,
29871,
29896,
29900,
876,
13,
259,
313,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
13,
259,
1149,
13,
259,
313,
9294,
313,
7491,
29899,
29888,
2859,
4961,
13,
15945,
29908,
13,
13,
24405,
4330,
3580,
29931,
1299,
1001,
29965,
1307,
353,
9995,
29898,
1753,
7491,
14861,
1177,
1057,
7491,
29899,
978,
13,
259,
313,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
13,
259,
313,
6886,
29899,
17028,
313,
6886,
29899,
2536,
327,
4472,
29899,
1767,
876,
13,
259,
1149,
13,
259,
313,
9294,
313,
7491,
29899,
29888,
2859,
4961,
13,
15945,
29908,
13,
13,
24405,
2891,
4448,
28283,
1307,
353,
9995,
29898,
1753,
7491,
14861,
1177,
1057,
1228,
29899,
7491,
29899,
978,
13,
259,
313,
7099,
8663,
313,
29879,
2606,
663,
29871,
29906,
29900,
876,
13,
259,
313,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
13,
259,
1149,
13,
259,
313,
9294,
313,
7491,
29899,
29888,
2859,
4961,
13,
15945,
29908,
13,
13,
13,
1990,
4321,
14769,
8395,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
6272,
353,
16738,
580,
13,
4706,
1583,
29889,
6272,
29889,
4282,
29898,
24405,
4330,
3580,
29931,
3040,
29897,
13,
4706,
1583,
29889,
6272,
29889,
4282,
29898,
2287,
15860,
29965,
1307,
29897,
13,
13,
1678,
822,
1243,
29918,
351,
8395,
29918,
710,
8963,
29898,
1311,
1125,
13,
4706,
9995,
14769,
8395,
13705,
2805,
29914,
26740,
1213,
15945,
13,
4706,
363,
13705,
297,
3767,
8963,
29901,
13,
9651,
1583,
29889,
6272,
29889,
710,
8963,
353,
13705,
13,
9651,
1583,
29889,
9294,
9843,
29898,
1311,
29889,
6272,
29889,
710,
8963,
29892,
13705,
29897,
13,
13,
1678,
822,
1243,
29918,
351,
8395,
29918,
29879,
2606,
663,
29918,
24219,
362,
29898,
1311,
1125,
13,
4706,
9995,
14769,
8395,
269,
2606,
663,
29918,
24219,
362,
2805,
29914,
26740,
1213,
15945,
13,
4706,
363,
269,
2606,
663,
29918,
24219,
362,
297,
317,
2606,
663,
29923,
4387,
362,
29901,
13,
9651,
1583,
29889,
6272,
29889,
29879,
2606,
663,
29918,
24219,
362,
353,
269,
2606,
663,
29918,
24219,
362,
13,
9651,
1583,
29889,
9294,
9843,
29898,
13,
18884,
1583,
29889,
6272,
29889,
29879,
2606,
663,
29918,
24219,
362,
29892,
269,
2606,
663,
29918,
24219,
362,
29897,
13,
13,
1678,
822,
1243,
29918,
351,
8395,
29918,
11236,
362,
29898,
1311,
1125,
13,
4706,
9995,
14769,
8395,
26229,
1243,
1213,
15945,
13,
4706,
1583,
29889,
6272,
29889,
9294,
29918,
1807,
877,
29898,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
1495,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
6272,
29889,
351,
8395,
29918,
15033,
29897,
13,
13,
4706,
26229,
353,
18761,
29898,
1311,
29889,
6272,
29889,
11236,
800,
3101,
29961,
29900,
29962,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11236,
362,
29889,
978,
29892,
525,
7491,
29899,
978,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
11236,
362,
29889,
29879,
2606,
663,
29892,
29871,
29896,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
710,
29898,
11236,
362,
511,
525,
29896,
29900,
268,
5751,
29899,
978,
29901,
285,
29899,
29896,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
276,
558,
29898,
11236,
362,
511,
525,
21786,
362,
29901,
29871,
29896,
29900,
268,
5751,
29899,
978,
29901,
285,
29899,
29896,
1495,
13,
13,
4706,
26229,
29889,
8143,
580,
13,
13,
4706,
1583,
29889,
9294,
8824,
29898,
11236,
362,
297,
1583,
29889,
6272,
29889,
11236,
800,
3101,
13,
13,
1678,
822,
1243,
29918,
351,
8395,
29918,
3389,
29898,
1311,
1125,
13,
4706,
9995,
14769,
8395,
6865,
526,
17285,
373,
1065,
1213,
15945,
13,
4706,
1583,
29889,
6272,
29889,
9294,
29918,
1807,
877,
29898,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
1495,
13,
13,
4706,
1583,
29889,
6272,
29889,
3389,
580,
13,
13,
4706,
2114,
29918,
7039,
353,
313,
29888,
29889,
6886,
29889,
978,
363,
285,
297,
1583,
29889,
6272,
29889,
17028,
29879,
3101,
13,
4706,
1583,
29889,
9294,
5574,
877,
7491,
29899,
29888,
2859,
29915,
297,
2114,
29918,
7039,
29897,
13,
13,
1678,
822,
1243,
29918,
351,
8395,
29918,
11236,
362,
29918,
2098,
29898,
1311,
1125,
13,
4706,
9995,
14769,
8395,
5039,
800,
1797,
1735,
565,
269,
2606,
663,
470,
13705,
1735,
1213,
15945,
13,
4706,
1583,
29889,
6272,
29889,
4282,
29898,
24405,
2891,
4448,
28283,
1307,
29897,
13,
4706,
1583,
29889,
6272,
29889,
9294,
29918,
1807,
877,
29898,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
1495,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
6272,
29889,
351,
8395,
29918,
15033,
29897,
13,
13,
4706,
5039,
800,
353,
18761,
29898,
1311,
29889,
6272,
29889,
11236,
800,
3101,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
23583,
29898,
29874,
29889,
978,
363,
263,
297,
5039,
800,
511,
13,
462,
308,
313,
29884,
29915,
1228,
29899,
7491,
29899,
978,
742,
318,
29915,
7491,
29899,
978,
8785,
13,
13,
4706,
5039,
800,
29961,
29896,
1822,
29879,
2606,
663,
353,
29871,
29941,
29900,
13,
13,
4706,
1583,
29889,
9294,
8824,
29898,
1311,
29889,
6272,
29889,
351,
8395,
29918,
15033,
29897,
13,
13,
4706,
1583,
29889,
6272,
29889,
276,
2098,
580,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
6272,
29889,
351,
8395,
29918,
15033,
29897,
13,
13,
4706,
5039,
800,
353,
18761,
29898,
1311,
29889,
6272,
29889,
11236,
800,
3101,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
23583,
29898,
29874,
29889,
978,
363,
263,
297,
5039,
800,
511,
13,
462,
308,
313,
29884,
29915,
7491,
29899,
978,
742,
318,
29915,
1228,
29899,
7491,
29899,
978,
8785,
13,
13,
4706,
1583,
29889,
6272,
29889,
22379,
580,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
1311,
29889,
6272,
29889,
351,
8395,
29918,
15033,
29897,
13,
13,
4706,
1583,
29889,
6272,
29889,
8551,
580,
13,
13,
4706,
5039,
800,
353,
18761,
29898,
1311,
29889,
6272,
29889,
11236,
800,
3101,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2435,
29898,
11236,
800,
511,
29871,
29900,
29897,
13,
13,
13,
1990,
4321,
29934,
2540,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
1583,
29889,
6272,
353,
16738,
580,
13,
4706,
1583,
29889,
6272,
29889,
4282,
29898,
24405,
4330,
3580,
29931,
3040,
29897,
13,
4706,
1583,
29889,
6272,
29889,
4282,
29898,
24405,
4330,
3580,
29931,
1299,
1001,
29965,
1307,
29897,
13,
13,
1678,
822,
1243,
29918,
7491,
29918,
4282,
29898,
1311,
1125,
13,
4706,
9995,
15427,
27308,
2048,
1213,
15945,
13,
4706,
5751,
353,
1583,
29889,
6272,
29889,
2886,
29918,
7491,
877,
7491,
29899,
978,
1495,
13,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
297,
1583,
29889,
6272,
29889,
19238,
3101,
13,
4706,
1583,
29889,
9294,
9843,
29898,
7491,
29889,
5453,
29889,
978,
29892,
525,
29032,
1495,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
29889,
311,
1026,
519,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
710,
29898,
7491,
511,
5012,
29943,
4330,
3580,
29931,
1299,
1001,
29965,
1307,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
276,
558,
29898,
7491,
511,
376,
10740,
29901,
1273,
29879,
29908,
1273,
5012,
29943,
4330,
3580,
29931,
1299,
1001,
29965,
1307,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
7491,
29889,
12344,
29918,
28034,
886,
29897,
13,
4706,
5751,
29889,
12344,
29918,
28034,
886,
353,
5852,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
29889,
12344,
29918,
28034,
886,
29897,
13,
4706,
1583,
29889,
9294,
8824,
29898,
7491,
29889,
12344,
29918,
11236,
800,
29897,
13,
4706,
5751,
29889,
12344,
29918,
11236,
800,
353,
5852,
13,
4706,
1583,
29889,
9294,
5574,
29898,
7491,
29889,
12344,
29918,
11236,
800,
29897,
13,
13,
4706,
5751,
29889,
870,
1389,
457,
580,
13,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
14959,
786,
2392,
1125,
13,
9651,
1583,
29889,
6272,
29889,
2886,
29918,
7491,
877,
7491,
29899,
978,
1495,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
1542,
2392,
1125,
13,
9651,
5751,
29889,
978,
13,
13,
1678,
822,
1243,
29918,
7491,
29918,
20317,
29898,
1311,
1125,
13,
4706,
9995,
7439,
616,
5751,
7087,
1213,
15945,
13,
4706,
5751,
353,
1583,
29889,
6272,
29889,
2886,
29918,
7491,
877,
7491,
29899,
978,
1495,
13,
4706,
1583,
29889,
6272,
29889,
9294,
29918,
1807,
877,
29898,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
7491,
29889,
20317,
3285,
313,
29896,
29892,
29871,
29900,
29892,
29871,
29900,
876,
13,
13,
4706,
5751,
29889,
870,
1389,
457,
580,
13,
13,
1678,
822,
1243,
29918,
7491,
29918,
11236,
362,
29898,
1311,
1125,
13,
4706,
9995,
10740,
26229,
1213,
15945,
13,
4706,
5751,
353,
1583,
29889,
6272,
29889,
2886,
29918,
7491,
877,
7491,
29899,
978,
1495,
13,
4706,
1583,
29889,
6272,
29889,
9294,
29918,
1807,
877,
29898,
6574,
2957,
29899,
17028,
2411,
2957,
29899,
1767,
29897,
1495,
13,
4706,
1583,
29889,
6272,
29889,
9294,
29918,
1807,
29898,
13,
9651,
525,
29898,
6886,
29899,
17028,
313,
6886,
29899,
2536,
327,
4472,
29899,
1767,
876,
1495,
13,
13,
4706,
1583,
29889,
9294,
9843,
29898,
7491,
29889,
20317,
3285,
313,
29906,
29892,
29871,
29896,
29892,
29871,
29896,
876,
13,
4706,
1583,
29889,
6272,
29889,
3389,
580,
13,
4706,
5751,
29889,
22379,
580,
13,
13,
4706,
2114,
29918,
7039,
353,
313,
29888,
29889,
6886,
29889,
978,
363,
285,
297,
1583,
29889,
6272,
29889,
17028,
29879,
3101,
13,
4706,
1583,
29889,
9294,
5574,
877,
7491,
29899,
29888,
2859,
29915,
297,
2114,
29918,
7039,
29897,
13,
2
] |
demo.py | PAV-Laboratory/cryptoblotter | 1 | 34928 | #!/usr/bin/env python3
from cryptofeed import FeedHandler
from cryptofeed.defines import TRADES
from cryptoblotter.exchanges import CoinbaseBlotter
from cryptoblotter.trades import SequentialIntegerTradeCallback, ThreshCallback
from cryptoblotter.trades.constants import VOLUME
async def trades(trade):
print(trade)
if __name__ == "__main__":
fh = FeedHandler()
fh.add_feed(
CoinbaseBlotter(
symbols=["BTC-USD"],
channels=[TRADES],
callbacks={
TRADES: SequentialIntegerTradeCallback(
ThreshCallback(
trades,
thresh_attr=VOLUME,
thresh_value=1000,
window_seconds=60,
)
)
},
)
)
fh.run()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
3166,
24941,
974,
12613,
1053,
5169,
287,
4598,
13,
3166,
24941,
974,
12613,
29889,
1753,
1475,
1053,
323,
4717,
2287,
29903,
13,
13,
3166,
24941,
711,
8276,
357,
29889,
735,
25990,
1053,
3189,
262,
3188,
29933,
8276,
357,
13,
3166,
24941,
711,
8276,
357,
29889,
509,
3076,
1053,
922,
339,
2556,
7798,
5323,
311,
10717,
29892,
498,
3781,
10717,
13,
3166,
24941,
711,
8276,
357,
29889,
509,
3076,
29889,
3075,
1934,
1053,
478,
5607,
29965,
2303,
13,
13,
13,
12674,
822,
534,
3076,
29898,
3018,
311,
1125,
13,
1678,
1596,
29898,
3018,
311,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
285,
29882,
353,
5169,
287,
4598,
580,
13,
1678,
285,
29882,
29889,
1202,
29918,
18798,
29898,
13,
4706,
3189,
262,
3188,
29933,
8276,
357,
29898,
13,
9651,
15072,
29922,
3366,
29933,
9472,
29899,
3308,
29928,
12436,
13,
9651,
18196,
11759,
29911,
4717,
2287,
29903,
1402,
13,
9651,
6939,
29879,
3790,
13,
18884,
323,
4717,
2287,
29903,
29901,
922,
339,
2556,
7798,
5323,
311,
10717,
29898,
13,
462,
1678,
498,
3781,
10717,
29898,
13,
462,
4706,
534,
3076,
29892,
13,
462,
4706,
266,
3781,
29918,
5552,
29922,
29963,
5607,
29965,
2303,
29892,
13,
462,
4706,
266,
3781,
29918,
1767,
29922,
29896,
29900,
29900,
29900,
29892,
13,
462,
4706,
3474,
29918,
23128,
29922,
29953,
29900,
29892,
13,
462,
1678,
1723,
13,
18884,
1723,
13,
9651,
2981,
13,
4706,
1723,
13,
1678,
1723,
13,
1678,
285,
29882,
29889,
3389,
580,
13,
2
] |
scripts/python/download_os_images.py | rbrud/power-up | 0 | 134263 | #!/usr/bin/env python
# Copyright 2018 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import nested_scopes, generators, division, absolute_import, \
with_statement, print_function, unicode_literals
import argparse
import sys
import yaml
from orderedattrdict.yamlutils import AttrDictYAMLLoader
import os.path
import wget
import hashlib
import lib.logger as logger
from lib.config import Config
from lib.genesis import check_os_profile, get_os_images_path, GEN_PATH
from lib.exception import UserException
OS_IMAGES_URLS_FILENAME = 'os-image-urls.yml'
def _sha1sum(file_path):
sha1sum = hashlib.sha1()
with open(file_path, 'rb') as file_object:
for block in iter(lambda: file_object.read(sha1sum.block_size), b''):
sha1sum.update(block)
return sha1sum.hexdigest()
def download_os_images(config_path=None):
"""Download OS installation images"""
log = logger.getlogger()
os_images_path = get_os_images_path() + "/"
os_image_urls_yaml_path = os_images_path + OS_IMAGES_URLS_FILENAME
cfg = Config(config_path)
os_image_urls = yaml.load(open(os_image_urls_yaml_path),
Loader=AttrDictYAMLLoader).os_image_urls
for os_profile in cfg.yield_ntmpl_os_profile():
for os_image_url in os_image_urls:
if check_os_profile(os_profile) in os_image_url.name:
for image in os_image_url.images:
dest = os_images_path
if 'filename' in image:
dest += image.filename
else:
dest += image.url.split("/")[-1]
if not os.path.isfile(dest):
log.info('Downloading OS image: %s' % image.url)
wget.download(image.url, out=dest)
print('')
sys.stdout.flush()
log.info('Verifying OS image sha1sum: %s' % dest)
sha1sum = _sha1sum(dest)
if image.sha1sum != sha1sum:
msg = ('OS image sha1sum verification failed: %s' %
dest)
log.error(msg)
raise UserException(msg)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('config_path', default='config.yml',
help='Config file path. Absolute path or relative '
'to power-up/')
parser.add_argument('--print', '-p', dest='log_lvl_print',
help='print log level', default='info')
parser.add_argument('--file', '-f', dest='log_lvl_file',
help='file log level', default='info')
args = parser.parse_args()
if not os.path.isfile(args.config_path):
args.config_path = GEN_PATH + args.config_path
print('Using config path: {}'.format(args.config_path))
if not os.path.isfile(args.config_path):
sys.exit('{} does not exist'.format(args.config_path))
logger.create(args.log_lvl_print, args.log_lvl_file)
download_os_images(args.config_path)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29896,
29947,
27955,
2994,
29886,
29889,
13,
29937,
13,
29937,
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,
3166,
4770,
29888,
9130,
1649,
1053,
9322,
29918,
21785,
267,
29892,
1176,
4097,
29892,
8542,
29892,
8380,
29918,
5215,
29892,
320,
13,
1678,
411,
29918,
20788,
29892,
1596,
29918,
2220,
29892,
29104,
29918,
20889,
1338,
13,
13,
5215,
1852,
5510,
13,
5215,
10876,
13,
5215,
343,
8807,
13,
3166,
10372,
5552,
8977,
29889,
25162,
13239,
1053,
2180,
509,
21533,
29979,
23956,
10036,
13,
5215,
2897,
29889,
2084,
13,
5215,
281,
657,
13,
5215,
6608,
1982,
13,
13,
5215,
4303,
29889,
21707,
408,
17927,
13,
3166,
4303,
29889,
2917,
1053,
12782,
13,
3166,
4303,
29889,
1885,
6656,
1053,
1423,
29918,
359,
29918,
10185,
29892,
679,
29918,
359,
29918,
8346,
29918,
2084,
29892,
402,
1430,
29918,
10145,
13,
3166,
4303,
29889,
11739,
1053,
4911,
2451,
13,
13,
3267,
29918,
2382,
29903,
29918,
4219,
29903,
29918,
7724,
5813,
353,
525,
359,
29899,
3027,
29899,
26045,
29889,
21053,
29915,
13,
13,
13,
1753,
903,
17051,
29896,
2083,
29898,
1445,
29918,
2084,
1125,
13,
1678,
528,
29874,
29896,
2083,
353,
6608,
1982,
29889,
17051,
29896,
580,
13,
1678,
411,
1722,
29898,
1445,
29918,
2084,
29892,
525,
6050,
1495,
408,
934,
29918,
3318,
29901,
13,
4706,
363,
2908,
297,
4256,
29898,
2892,
29901,
934,
29918,
3318,
29889,
949,
29898,
17051,
29896,
2083,
29889,
1271,
29918,
2311,
511,
289,
4907,
1125,
13,
9651,
528,
29874,
29896,
2083,
29889,
5504,
29898,
1271,
29897,
13,
1678,
736,
528,
29874,
29896,
2083,
29889,
20970,
7501,
342,
580,
13,
13,
13,
1753,
5142,
29918,
359,
29918,
8346,
29898,
2917,
29918,
2084,
29922,
8516,
1125,
13,
1678,
9995,
22954,
6570,
11161,
4558,
15945,
29908,
13,
13,
1678,
1480,
353,
17927,
29889,
657,
21707,
580,
13,
1678,
2897,
29918,
8346,
29918,
2084,
353,
679,
29918,
359,
29918,
8346,
29918,
2084,
580,
718,
5591,
29908,
13,
1678,
2897,
29918,
3027,
29918,
26045,
29918,
25162,
29918,
2084,
353,
2897,
29918,
8346,
29918,
2084,
718,
6570,
29918,
2382,
29903,
29918,
4219,
29903,
29918,
7724,
5813,
13,
13,
1678,
274,
16434,
353,
12782,
29898,
2917,
29918,
2084,
29897,
13,
1678,
2897,
29918,
3027,
29918,
26045,
353,
343,
8807,
29889,
1359,
29898,
3150,
29898,
359,
29918,
3027,
29918,
26045,
29918,
25162,
29918,
2084,
511,
13,
462,
795,
4309,
1664,
29922,
25098,
21533,
29979,
23956,
10036,
467,
359,
29918,
3027,
29918,
26045,
13,
13,
1678,
363,
2897,
29918,
10185,
297,
274,
16434,
29889,
29891,
969,
29918,
593,
29885,
572,
29918,
359,
29918,
10185,
7295,
13,
4706,
363,
2897,
29918,
3027,
29918,
2271,
297,
2897,
29918,
3027,
29918,
26045,
29901,
13,
9651,
565,
1423,
29918,
359,
29918,
10185,
29898,
359,
29918,
10185,
29897,
297,
2897,
29918,
3027,
29918,
2271,
29889,
978,
29901,
13,
18884,
363,
1967,
297,
2897,
29918,
3027,
29918,
2271,
29889,
8346,
29901,
13,
462,
1678,
2731,
353,
2897,
29918,
8346,
29918,
2084,
13,
462,
1678,
565,
525,
9507,
29915,
297,
1967,
29901,
13,
462,
4706,
2731,
4619,
1967,
29889,
9507,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
2731,
4619,
1967,
29889,
2271,
29889,
5451,
11974,
1159,
14352,
29896,
29962,
13,
462,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
7854,
1125,
13,
462,
4706,
1480,
29889,
3888,
877,
6767,
13234,
6570,
1967,
29901,
1273,
29879,
29915,
1273,
1967,
29889,
2271,
29897,
13,
462,
4706,
281,
657,
29889,
10382,
29898,
3027,
29889,
2271,
29892,
714,
29922,
7854,
29897,
13,
462,
4706,
1596,
877,
1495,
13,
462,
4706,
10876,
29889,
25393,
29889,
23126,
580,
13,
462,
1678,
1480,
29889,
3888,
877,
6565,
9215,
6570,
1967,
528,
29874,
29896,
2083,
29901,
1273,
29879,
29915,
1273,
2731,
29897,
13,
462,
1678,
528,
29874,
29896,
2083,
353,
903,
17051,
29896,
2083,
29898,
7854,
29897,
13,
462,
1678,
565,
1967,
29889,
17051,
29896,
2083,
2804,
528,
29874,
29896,
2083,
29901,
13,
462,
4706,
10191,
353,
6702,
3267,
1967,
528,
29874,
29896,
2083,
1147,
2450,
5229,
29901,
1273,
29879,
29915,
1273,
13,
462,
1669,
2731,
29897,
13,
462,
4706,
1480,
29889,
2704,
29898,
7645,
29897,
13,
462,
4706,
12020,
4911,
2451,
29898,
7645,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
13812,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
2917,
29918,
2084,
742,
2322,
2433,
2917,
29889,
21053,
742,
13,
462,
4706,
1371,
2433,
3991,
934,
2224,
29889,
29871,
1976,
14977,
2224,
470,
6198,
525,
13,
462,
4706,
525,
517,
3081,
29899,
786,
29914,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
2158,
742,
17411,
29886,
742,
2731,
2433,
1188,
29918,
29880,
20901,
29918,
2158,
742,
13,
462,
4706,
1371,
2433,
2158,
1480,
3233,
742,
2322,
2433,
3888,
1495,
13,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
1445,
742,
17411,
29888,
742,
2731,
2433,
1188,
29918,
29880,
20901,
29918,
1445,
742,
13,
462,
4706,
1371,
2433,
1445,
1480,
3233,
742,
2322,
2433,
3888,
1495,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
5085,
29889,
2917,
29918,
2084,
1125,
13,
4706,
6389,
29889,
2917,
29918,
2084,
353,
402,
1430,
29918,
10145,
718,
6389,
29889,
2917,
29918,
2084,
13,
4706,
1596,
877,
15156,
2295,
2224,
29901,
6571,
4286,
4830,
29898,
5085,
29889,
2917,
29918,
2084,
876,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
5085,
29889,
2917,
29918,
2084,
1125,
13,
4706,
10876,
29889,
13322,
877,
8875,
947,
451,
1863,
4286,
4830,
29898,
5085,
29889,
2917,
29918,
2084,
876,
13,
13,
1678,
17927,
29889,
3258,
29898,
5085,
29889,
1188,
29918,
29880,
20901,
29918,
2158,
29892,
6389,
29889,
1188,
29918,
29880,
20901,
29918,
1445,
29897,
13,
1678,
5142,
29918,
359,
29918,
8346,
29898,
5085,
29889,
2917,
29918,
2084,
29897,
13,
2
] |
2/dogcat.py | JonahY/AE_NN_Cls | 3 | 86779 | <filename>2/dogcat.py
# coding=utf-8
import os
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.utils.data import Dataset
from torchvision import transforms, datasets, models
import shutil
# 随机种子设置
random_state = 42
np.random.seed(random_state)
# kaggle原始数据集地址
original_dataset_dir = r'D:\data\archive\training_set\training_set'
total_num = 4000
random_idx = np.array(range(total_num))
np.random.shuffle(random_idx)
# 待处理的数据集地址
base_dir = r'D:\data\archive\data2'
if not os.path.exists(base_dir):
os.mkdir(base_dir)
# 训练集、测试集的划分
sub_dirs = ['train', 'test']
animals = ['cats', 'dogs']
train_idx = random_idx[:int(total_num * 0.9)]
test_idx = random_idx[int(total_num * 0.9):]
numbers = [train_idx, test_idx]
for idx, sub_dir in enumerate(sub_dirs):
dir = os.path.join(base_dir, sub_dir)
if not os.path.exists(dir):
os.mkdir(dir)
for animal in animals:
animal_dir = os.path.join(dir, animal) #
if not os.path.exists(animal_dir):
os.mkdir(animal_dir)
fnames = [animal[:-1] + '.{}.jpg'.format(i+1) for i in numbers[idx]]
for fname in fnames:
src = os.path.join(original_dataset_dir, animal, fname)
dst = os.path.join(animal_dir, fname)
shutil.copyfile(src, dst)
# 验证训练集、验证集、测试集的划分的照片数目
print(animal_dir + ' total images : %d' % (len(os.listdir(animal_dir))))
| [
1,
529,
9507,
29958,
29906,
29914,
26169,
4117,
29889,
2272,
13,
29937,
14137,
29922,
9420,
29899,
29947,
13,
5215,
2897,
13,
5215,
12655,
408,
7442,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
5215,
4842,
305,
29889,
20640,
408,
5994,
13,
3166,
4842,
305,
29889,
1300,
468,
3665,
1053,
28736,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
13373,
24541,
13,
3166,
4842,
305,
4924,
1053,
4327,
29879,
29892,
20035,
29892,
4733,
13,
5215,
528,
4422,
13,
13,
13,
29937,
29871,
236,
157,
146,
31429,
31893,
30319,
30872,
30669,
13,
8172,
29918,
3859,
353,
29871,
29946,
29906,
13,
9302,
29889,
8172,
29889,
26776,
29898,
8172,
29918,
3859,
29897,
13,
13,
29937,
413,
351,
6234,
30667,
31020,
30354,
30763,
30893,
30533,
31702,
13,
13492,
29918,
24713,
29918,
3972,
353,
364,
29915,
29928,
3583,
1272,
29905,
10867,
29905,
26495,
29918,
842,
29905,
26495,
29918,
842,
29915,
13,
7827,
29918,
1949,
353,
29871,
29946,
29900,
29900,
29900,
13,
8172,
29918,
13140,
353,
7442,
29889,
2378,
29898,
3881,
29898,
7827,
29918,
1949,
876,
13,
9302,
29889,
8172,
29889,
845,
21897,
29898,
8172,
29918,
13140,
29897,
13,
13,
29937,
29871,
232,
193,
136,
31548,
30687,
30210,
30354,
30763,
30893,
30533,
31702,
13,
3188,
29918,
3972,
353,
364,
29915,
29928,
3583,
1272,
29905,
10867,
29905,
1272,
29906,
29915,
13,
361,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3188,
29918,
3972,
1125,
13,
1678,
2897,
29889,
11256,
3972,
29898,
3188,
29918,
3972,
29897,
13,
13,
29937,
29871,
235,
177,
176,
234,
190,
134,
30893,
30330,
31851,
31787,
30893,
30210,
232,
139,
149,
30748,
13,
1491,
29918,
3972,
29879,
353,
6024,
14968,
742,
525,
1688,
2033,
13,
11576,
1338,
353,
6024,
29883,
1446,
742,
525,
29881,
12099,
2033,
13,
14968,
29918,
13140,
353,
4036,
29918,
13140,
7503,
524,
29898,
7827,
29918,
1949,
334,
29871,
29900,
29889,
29929,
4638,
13,
1688,
29918,
13140,
353,
4036,
29918,
13140,
29961,
524,
29898,
7827,
29918,
1949,
334,
29871,
29900,
29889,
29929,
1125,
29962,
13,
20326,
353,
518,
14968,
29918,
13140,
29892,
1243,
29918,
13140,
29962,
13,
1454,
22645,
29892,
1014,
29918,
3972,
297,
26985,
29898,
1491,
29918,
3972,
29879,
1125,
13,
1678,
4516,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3188,
29918,
3972,
29892,
1014,
29918,
3972,
29897,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
3972,
1125,
13,
4706,
2897,
29889,
11256,
3972,
29898,
3972,
29897,
13,
1678,
363,
13019,
297,
15006,
29901,
13,
4706,
13019,
29918,
3972,
353,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29892,
13019,
29897,
29871,
396,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
273,
3039,
29918,
3972,
1125,
13,
9651,
2897,
29889,
11256,
3972,
29898,
273,
3039,
29918,
3972,
29897,
13,
4706,
285,
7039,
353,
518,
273,
3039,
7503,
29899,
29896,
29962,
718,
15300,
29912,
1836,
6173,
4286,
4830,
29898,
29875,
29974,
29896,
29897,
363,
474,
297,
3694,
29961,
13140,
5262,
13,
4706,
363,
285,
978,
297,
285,
7039,
29901,
13,
9651,
4765,
353,
2897,
29889,
2084,
29889,
7122,
29898,
13492,
29918,
24713,
29918,
3972,
29892,
13019,
29892,
285,
978,
29897,
13,
9651,
29743,
353,
2897,
29889,
2084,
29889,
7122,
29898,
273,
3039,
29918,
3972,
29892,
285,
978,
29897,
13,
9651,
528,
4422,
29889,
8552,
1445,
29898,
4351,
29892,
29743,
29897,
13,
13,
4706,
396,
29871,
236,
173,
143,
235,
178,
132,
235,
177,
176,
234,
190,
134,
30893,
30330,
236,
173,
143,
235,
178,
132,
30893,
30330,
31851,
31787,
30893,
30210,
232,
139,
149,
30748,
30210,
234,
136,
170,
31122,
30354,
30895,
13,
4706,
1596,
29898,
273,
3039,
29918,
3972,
718,
525,
3001,
4558,
584,
1273,
29881,
29915,
1273,
313,
2435,
29898,
359,
29889,
1761,
3972,
29898,
273,
3039,
29918,
3972,
13697,
13,
13,
2
] |
run_pipy.py | johnrcruzado/adatasets | 3 | 152927 | <filename>run_pipy.py
# pylint: disable=C0321,C0103,C0301,E1305,E1121,C0302,C0330,C0111,W0613,W0611,R1705
# -*- coding: utf-8 -*-
"""
Pypi Uploader
python pypi.py
1) Create the package in one folder
2)
A file called .pypirc that has to contain login credentials.
$ ~ YOURTEXTEDITOR ~/.pypirc
Open a file and paste this to in it:
In Github Secrets
[pypi]
username = _token_ #token is <PASSWORD>
password = <PASSWORD>
"""
import os,re, sys, subprocess
import os.path as op
curdir = op.abspath(op.curdir)
setup_file = op.join(curdir, 'setup.py')
class Version(object):
pattern = re.compile(r"(version\s*=\s*['\"]\s*(\d+)\s*\.\s*(\d+)\s*\.\s*(\d+)\s*['\"])")
def __init__(self, major, minor, patch):
self.major = major
self.minor = minor
self.patch = patch
def __str__(self):
return f'Version({self.stringify()})'
def __repr__(self):
return self.__str__()
def stringify(self):
return f'\'{self.major}.{self.minor}.{self.patch}\''
def new_version(self, orig):
return '='.join([orig.split('=')[0], self.stringify()])
@classmethod
def parse(cls, string):
re_result = re.findall(cls.pattern, string)
if len(re_result) == 0:
return Exception('Program was not able to parse version string, please check your setup.py file.')
return re_result[0][0], cls(*re_result[0][1:])
def get_current_githash():
import subprocess
label = subprocess.check_output(["git", "describe", "--always"]).strip();
label = label.decode('utf-8')
return label
def update_version(path, n=1):
content = open(path, 'r').read()
orig, version = Version.parse(content)
print (f'Current version: {version}')
version.minor = int(version.minor) + int(n)
import time
version.patch = int(time.time()*0.01) ### unique ID
# version.patch = get_current_githash()
print (f'New Version: {version}')
with open(path, 'w') as file:
file.write(content.replace(orig, version.new_version(orig)))
############################################################################################################
def git_commit(message):
if not ask(f'About to git commit {message}, are you sure: '):
exit()
os.system(f'git commit -am "{message}"')
if not ask('About to git push, are you sure: '):
exit()
os.system('git push')
def ask(question, ans='yes'):
return input(question).lower() == ans.lower()
def pypi_upload():
"""
It requires credential in .pypirc files
__token__
or in github SECRETS
"""
os.system('python setup.py sdist bdist_wheel')
### Github
os.system('twine upload --repository-url https://upload.pypi.org/legacy/ dist/* --username ${{ secrets.PYPI_USERNAME }} --password ${{ secrets.PYPI_PASSWORD }} --verbose ')
print("Upload files")
print("Deleting build files")
for item in os.listdir(op.abspath(op.join(setup_file, '..'))):
if item.endswith('.egg-info') or item in ['dist', 'build']:
os.system(f'rm -rf {item}')
############################################################################################################
def main(*args):
print ('Program Started')
update_version(setup_file, 1)
# git_commit(*sys.argv[1:3])
# pypi_upload()
print ('Upload success')
if __name__ == '__main__':
main()
#if len(sys.argv) == 1:
# print (f'Usage: python {sys.argv[0]} "commmit message"'); sys.exit()
#
#main(*sys.argv[1:3])
| [
1,
529,
9507,
29958,
3389,
29918,
13096,
29891,
29889,
2272,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
29907,
29900,
29941,
29906,
29896,
29892,
29907,
29900,
29896,
29900,
29941,
29892,
29907,
29900,
29941,
29900,
29896,
29892,
29923,
29896,
29941,
29900,
29945,
29892,
29923,
29896,
29896,
29906,
29896,
29892,
29907,
29900,
29941,
29900,
29906,
29892,
29907,
29900,
29941,
29941,
29900,
29892,
29907,
29900,
29896,
29896,
29896,
29892,
29956,
29900,
29953,
29896,
29941,
29892,
29956,
29900,
29953,
29896,
29896,
29892,
29934,
29896,
29955,
29900,
29945,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
29925,
1478,
29875,
5020,
12657,
13,
13,
4691,
282,
1478,
29875,
29889,
2272,
13,
13,
13,
29896,
29897,
6204,
278,
3577,
297,
697,
4138,
13,
13,
13,
29906,
29897,
13,
29909,
934,
2000,
869,
29886,
1478,
2076,
393,
756,
304,
1712,
6464,
16140,
29889,
13,
29871,
395,
3695,
612,
22970,
16975,
12378,
1955,
3695,
6294,
29886,
1478,
2076,
13,
29871,
4673,
263,
934,
322,
11417,
445,
304,
297,
372,
29901,
13,
29871,
512,
402,
2985,
5356,
27487,
13,
13,
29871,
518,
29886,
1478,
29875,
29962,
13,
29871,
8952,
353,
903,
6979,
29918,
1678,
396,
6979,
338,
529,
25711,
17013,
29958,
13,
29871,
4800,
353,
529,
25711,
17013,
29958,
13,
13,
13,
13,
13,
15945,
29908,
13,
5215,
2897,
29892,
276,
29892,
10876,
29892,
1014,
5014,
13,
5215,
2897,
29889,
2084,
408,
1015,
13,
13,
2764,
3972,
353,
1015,
29889,
370,
1028,
493,
29898,
459,
29889,
2764,
3972,
29897,
13,
14669,
29918,
1445,
353,
1015,
29889,
7122,
29898,
2764,
3972,
29892,
525,
14669,
29889,
2272,
1495,
13,
13,
13,
1990,
10079,
29898,
3318,
1125,
13,
1678,
4766,
353,
337,
29889,
12198,
29898,
29878,
29908,
29898,
3259,
29905,
29879,
29930,
2013,
29879,
29930,
1839,
29905,
3108,
29905,
29879,
29930,
1194,
29881,
29974,
2144,
29879,
17710,
7790,
29879,
29930,
1194,
29881,
29974,
2144,
29879,
17710,
7790,
29879,
29930,
1194,
29881,
29974,
2144,
29879,
29930,
1839,
5931,
2314,
1159,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4655,
29892,
9461,
29892,
13261,
1125,
13,
4706,
1583,
29889,
21355,
353,
4655,
13,
4706,
1583,
29889,
1195,
272,
353,
9461,
13,
4706,
1583,
29889,
5041,
353,
13261,
13,
13,
1678,
822,
4770,
710,
12035,
1311,
1125,
13,
4706,
736,
285,
29915,
6594,
3319,
1311,
29889,
22070,
580,
1800,
29915,
13,
13,
1678,
822,
4770,
276,
558,
12035,
1311,
1125,
13,
4706,
736,
1583,
17255,
710,
1649,
580,
13,
13,
1678,
822,
1347,
1598,
29898,
1311,
1125,
13,
4706,
736,
285,
12764,
29915,
29912,
1311,
29889,
21355,
1836,
29912,
1311,
29889,
1195,
272,
1836,
29912,
1311,
29889,
5041,
1012,
4907,
13,
13,
1678,
822,
716,
29918,
3259,
29898,
1311,
29892,
1677,
1125,
13,
4706,
736,
525,
2433,
29889,
7122,
4197,
12683,
29889,
5451,
877,
29922,
29861,
29900,
1402,
1583,
29889,
22070,
580,
2314,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
6088,
29898,
25932,
29892,
1347,
1125,
13,
4706,
337,
29918,
2914,
353,
337,
29889,
2886,
497,
29898,
25932,
29889,
11037,
29892,
1347,
29897,
13,
4706,
565,
7431,
29898,
276,
29918,
2914,
29897,
1275,
29871,
29900,
29901,
13,
9651,
736,
8960,
877,
9283,
471,
451,
2221,
304,
6088,
1873,
1347,
29892,
3113,
1423,
596,
6230,
29889,
2272,
934,
29889,
1495,
13,
13,
4706,
736,
337,
29918,
2914,
29961,
29900,
3816,
29900,
1402,
1067,
29879,
10456,
276,
29918,
2914,
29961,
29900,
3816,
29896,
29901,
2314,
13,
13,
13,
1753,
679,
29918,
3784,
29918,
29887,
389,
1161,
7295,
13,
259,
1053,
1014,
5014,
29871,
13,
259,
3858,
353,
1014,
5014,
29889,
3198,
29918,
4905,
29898,
3366,
5559,
613,
376,
2783,
29581,
613,
376,
489,
21936,
3108,
467,
17010,
890,
1678,
13,
259,
3858,
353,
3858,
29889,
13808,
877,
9420,
29899,
29947,
1495,
13,
259,
736,
3858,
13,
13,
13,
1753,
2767,
29918,
3259,
29898,
2084,
29892,
302,
29922,
29896,
1125,
13,
1678,
2793,
353,
1722,
29898,
2084,
29892,
525,
29878,
2824,
949,
580,
13,
268,
13,
1678,
1677,
29892,
1873,
353,
10079,
29889,
5510,
29898,
3051,
29897,
13,
1678,
1596,
313,
29888,
29915,
7583,
1873,
29901,
426,
3259,
29913,
1495,
13,
13,
1678,
1873,
29889,
1195,
272,
353,
938,
29898,
3259,
29889,
1195,
272,
29897,
718,
938,
29898,
29876,
29897,
13,
13,
1678,
1053,
931,
13,
1678,
1873,
29889,
5041,
353,
938,
29898,
2230,
29889,
2230,
580,
29930,
29900,
29889,
29900,
29896,
29897,
259,
835,
5412,
3553,
13,
1678,
396,
1873,
29889,
5041,
353,
679,
29918,
3784,
29918,
29887,
389,
1161,
580,
13,
13,
13,
1678,
1596,
313,
29888,
29915,
4373,
10079,
29901,
426,
3259,
29913,
1495,
13,
13,
1678,
411,
1722,
29898,
2084,
29892,
525,
29893,
1495,
408,
934,
29901,
13,
4706,
934,
29889,
3539,
29898,
3051,
29889,
6506,
29898,
12683,
29892,
1873,
29889,
1482,
29918,
3259,
29898,
12683,
4961,
13,
13,
13,
13,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
1753,
6315,
29918,
15060,
29898,
4906,
1125,
13,
1678,
565,
451,
2244,
29898,
29888,
29915,
28173,
304,
6315,
9063,
426,
4906,
1118,
526,
366,
1854,
29901,
525,
1125,
13,
4706,
6876,
580,
13,
13,
1678,
2897,
29889,
5205,
29898,
29888,
29915,
5559,
9063,
448,
314,
29850,
4906,
5038,
1495,
13,
268,
13,
1678,
565,
451,
2244,
877,
28173,
304,
6315,
5503,
29892,
526,
366,
1854,
29901,
525,
1125,
13,
4706,
6876,
580,
13,
13,
1678,
2897,
29889,
5205,
877,
5559,
5503,
1495,
13,
13,
1753,
2244,
29898,
12470,
29892,
6063,
2433,
3582,
29374,
13,
1678,
736,
1881,
29898,
12470,
467,
13609,
580,
1275,
6063,
29889,
13609,
580,
13,
13,
13,
1753,
282,
1478,
29875,
29918,
9009,
7295,
13,
1678,
9995,
13,
418,
739,
6858,
6625,
2556,
297,
869,
29886,
1478,
2076,
29871,
2066,
13,
418,
4770,
6979,
1649,
13,
418,
470,
297,
18546,
3725,
22245,
9375,
13,
13,
1678,
9995,
13,
1678,
2897,
29889,
5205,
877,
4691,
6230,
29889,
2272,
269,
5721,
289,
5721,
29918,
29893,
10552,
1495,
13,
13,
1678,
835,
402,
2985,
13,
1678,
2897,
29889,
5205,
877,
7516,
457,
6441,
1192,
19033,
29899,
2271,
2045,
597,
9009,
29889,
29886,
1478,
29875,
29889,
990,
29914,
1397,
4135,
29914,
1320,
5515,
29871,
1192,
6786,
395,
6224,
22183,
1372,
29889,
20055,
2227,
29918,
11889,
5813,
9156,
268,
1192,
5630,
395,
6224,
22183,
1372,
29889,
20055,
2227,
29918,
25711,
17013,
9156,
29871,
1192,
369,
15828,
25710,
13,
1678,
1596,
703,
17553,
2066,
1159,
13,
13,
1678,
1596,
703,
2772,
1026,
292,
2048,
2066,
1159,
13,
1678,
363,
2944,
297,
2897,
29889,
1761,
3972,
29898,
459,
29889,
370,
1028,
493,
29898,
459,
29889,
7122,
29898,
14669,
29918,
1445,
29892,
525,
636,
8785,
1125,
13,
4706,
565,
2944,
29889,
1975,
2541,
12839,
387,
29887,
29899,
3888,
1495,
470,
2944,
297,
6024,
5721,
742,
525,
4282,
2033,
29901,
13,
9651,
2897,
29889,
5205,
29898,
29888,
29915,
1758,
448,
9600,
426,
667,
29913,
1495,
13,
13,
13,
13383,
13383,
13383,
13383,
13383,
13383,
7346,
4136,
13,
1753,
1667,
10456,
5085,
1125,
13,
1678,
1596,
6702,
9283,
7370,
287,
1495,
13,
1678,
2767,
29918,
3259,
29898,
14669,
29918,
1445,
29892,
29871,
29896,
29897,
13,
1678,
396,
6315,
29918,
15060,
10456,
9675,
29889,
19218,
29961,
29896,
29901,
29941,
2314,
13,
1678,
396,
282,
1478,
29875,
29918,
9009,
580,
13,
1678,
1596,
6702,
17553,
2551,
1495,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
13,
1678,
396,
361,
7431,
29898,
9675,
29889,
19218,
29897,
1275,
29871,
29896,
29901,
13,
1678,
396,
1678,
1596,
313,
29888,
29915,
27573,
29901,
3017,
426,
9675,
29889,
19218,
29961,
29900,
12258,
376,
2055,
2415,
2643,
29908,
2157,
10876,
29889,
13322,
580,
13,
1678,
396,
13,
1678,
396,
3396,
10456,
9675,
29889,
19218,
29961,
29896,
29901,
29941,
2314,
13,
2
] |
app.py | Lunga001/pmg-cms-2 | 2 | 158501 | from pmg import app
from pmg.tasks import StartScheduler
from pmg.models.soundcloud_track import SoundcloudTrack
from flask_script import Server, Manager
from flask_migrate import MigrateCommand
app.debug = True
manager = Manager(app)
manager.add_command("runserver", Server(port=5000, threaded=True, host="0.0.0.0"))
manager.add_command("db", MigrateCommand)
manager.add_command("start_scheduler", StartScheduler)
@manager.command
def sync_soundcloud():
SoundcloudTrack.sync()
if __name__ == "__main__":
manager.run()
| [
1,
515,
26354,
29887,
1053,
623,
13,
3166,
26354,
29887,
29889,
20673,
1053,
7370,
4504,
14952,
13,
3166,
26354,
29887,
29889,
9794,
29889,
29802,
9274,
29918,
11294,
1053,
14976,
9274,
17936,
13,
3166,
29784,
29918,
2154,
1053,
5656,
29892,
15629,
13,
3166,
29784,
29918,
26983,
403,
1053,
341,
4481,
403,
6255,
13,
13,
932,
29889,
8382,
353,
5852,
13,
13,
12847,
353,
15629,
29898,
932,
29897,
13,
12847,
29889,
1202,
29918,
6519,
703,
3389,
2974,
613,
5656,
29898,
637,
29922,
29945,
29900,
29900,
29900,
29892,
3244,
287,
29922,
5574,
29892,
3495,
543,
29900,
29889,
29900,
29889,
29900,
29889,
29900,
5783,
13,
12847,
29889,
1202,
29918,
6519,
703,
2585,
613,
341,
4481,
403,
6255,
29897,
13,
12847,
29889,
1202,
29918,
6519,
703,
2962,
29918,
816,
14952,
613,
7370,
4504,
14952,
29897,
13,
13,
13,
29992,
12847,
29889,
6519,
13,
1753,
16523,
29918,
29802,
9274,
7295,
13,
1678,
14976,
9274,
17936,
29889,
16593,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
8455,
29889,
3389,
580,
13,
2
] |
project_e/dealers/forms.py | ElectricFleming/project-e | 0 | 94975 | <filename>project_e/dealers/forms.py<gh_stars>0
from django import forms
class DealerCreationForm(forms.Form):
name = forms.CharField()
address = forms.CharField() #Address
| [
1,
529,
9507,
29958,
4836,
29918,
29872,
29914,
311,
284,
414,
29914,
9514,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
3166,
9557,
1053,
7190,
13,
13,
1990,
897,
18362,
9832,
362,
2500,
29898,
9514,
29889,
2500,
1125,
13,
1678,
1024,
353,
7190,
29889,
27890,
580,
13,
1678,
3211,
353,
7190,
29889,
27890,
580,
396,
7061,
13,
2
] |
wok/core/base.py | atugushev/wok | 0 | 149702 | <gh_stars>0
import functools
import pathlib
import typing
import click
import pygit2
from . import context
def is_clean(repo: pygit2.Repository) -> bool:
return not any(
code
for code in repo.status().values()
if (
code
^ (code & pygit2.GIT_STATUS_WT_NEW)
^ (code & pygit2.GIT_STATUS_IGNORED)
)
)
def require_clean(func: typing.Callable) -> typing.Callable:
@functools.wraps(func)
def wrapper(
*args: typing.Any, ctx: context.Context, **kwargs: typing.Any
) -> typing.Any:
if not is_clean(repo=ctx.root_repo):
print(ctx.root_repo.status())
raise ValueError(ctx.root_repo.workdir)
for repo_conf in ctx.conf.repos:
repo = pygit2.Repository(str(repo_conf.path))
if not is_clean(repo=repo):
raise ValueError(repo.workdir)
return func(*args, ctx=ctx, **kwargs)
return wrapper
def switch(repo: pygit2.Repository, ref: pygit2.Reference) -> None:
stashed = False
if not is_clean(repo=repo):
repo.stash(stasher=repo.default_signature)
stashed = True
repo.checkout(refname=ref)
if stashed:
repo.stash_pop()
def commit(
repo: pygit2.Repository,
message: str,
pathspecs: typing.Optional[typing.List[typing.Union[str, pathlib.Path]]] = None,
) -> None:
if pathspecs is None:
pathspecs = []
pathspecs = [
(
str(
pathspec.relative_to(repo.workdir)
if pathspec.is_absolute()
else pathspec
)
if isinstance(pathspec, pathlib.Path)
else pathspec
)
for pathspec in pathspecs
]
repo.index.add_all(pathspecs=pathspecs)
repo.index.write()
tree = repo.index.write_tree()
try:
parent, ref = repo.resolve_refish(refish=repo.head.name)
except pygit2.GitError:
parents = []
ref_name = 'refs/heads/master'
else:
parents = [parent.oid]
ref_name = ref.name
repo.create_commit(
ref_name, repo.default_signature, repo.default_signature, message, tree, parents
)
def push(repo: pygit2.Repository, branch_name: str) -> None:
branch = repo.branches.local[branch_name]
if not branch.is_head():
raise ValueError(branch)
try:
remote = repo.remotes['origin']
except KeyError:
return
remote.push(specs=[f'{branch.name}'], callbacks=RemoteCallbacks())
upstream_branch = repo.branches.get(f'{remote.name}/{branch.shorthand}')
if upstream_branch is not None:
branch.upstream = upstream_branch
def sync(repo: pygit2.Repository, branch_name: str) -> None:
"""
Tries to update the `branch_name` branch of the `repo` repo to the latest
upstream branch state.
If the branch is up to date, does nothing.
If the branch can be fast-forwarded, resets to the upstream.
Otherwise, fails with an error.
"""
branch = repo.branches.local[branch_name]
if not branch.is_head():
raise ValueError(branch)
try:
remote = repo.remotes['origin']
except KeyError:
return
remote.fetch(callbacks=RemoteCallbacks())
upstream_branch = branch.upstream
if not upstream_branch:
return
merge_state, _ = repo.merge_analysis(upstream_branch.target, branch.name)
if merge_state & pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE:
return
if not (merge_state & pygit2.GIT_MERGE_ANALYSIS_FASTFORWARD):
raise ValueError(branch)
repo.reset(upstream_branch.target, pygit2.GIT_RESET_HARD)
repo.checkout(refname=branch)
def finish(repo: pygit2.Repository, branch_name: str, message: str) -> None:
master = repo.branches.local['master']
branch = repo.branches.local[branch_name]
if not branch.is_head():
raise ValueError(branch)
merge_squash(repo=repo, ours_branch=master, theirs_branch=branch, message=message)
repo.checkout(refname=master)
branch.delete()
def merge_squash(
repo: pygit2.Repository,
ours_branch: pygit2.Branch,
theirs_branch: pygit2.Branch,
message: str,
) -> None:
"""
Performs a merge of the `theirs_branch` into `ours_branch` sqaushing the commits
"""
merge_state, _ = repo.merge_analysis(theirs_branch.target, ours_branch.name)
if merge_state & pygit2.GIT_MERGE_ANALYSIS_UP_TO_DATE:
return
if not (merge_state & pygit2.GIT_MERGE_ANALYSIS_FASTFORWARD):
raise ValueError(theirs_branch)
index: pygit2.Index = repo.merge_trees(
ancestor=ours_branch, ours=ours_branch, theirs=theirs_branch
)
tree = index.write_tree(repo=repo)
repo.create_commit(
ours_branch.name,
repo.default_signature,
repo.default_signature,
message,
tree,
[ours_branch.target],
)
def tag(repo: pygit2.Repository, tag_name: str) -> None:
repo.references.create(name=f'refs/tags/{tag_name}', target=repo.head.target)
def clone(url: str, path: pathlib.Path, **kwargs: typing.Any) -> pygit2.Repository:
return pygit2.clone_repository(
url=url, path=str(path), callbacks=RemoteCallbacks(), **kwargs
)
class RemoteCallbacks(pygit2.RemoteCallbacks):
"""
Overrides the credentials callback.
"""
def credentials(
self, url: str, username_from_url: typing.Optional[str], allowed_types: int
) -> typing.Optional[
typing.Union[pygit2.Keypair, pygit2.UserPass, pygit2.Username]
]:
"""
If the remote server requires authentication, this function will be called and
its return value used for authentication.
"""
if allowed_types & pygit2.credentials.GIT_CREDTYPE_SSH_KEY:
return pygit2.KeypairFromAgent(username_from_url)
elif allowed_types & pygit2.credentials.GIT_CREDTYPE_USERPASS_PLAINTEXT:
username = username_from_url or click.prompt("Username")
password = click.prompt("Password", hide_input=True)
return pygit2.UserPass(username=username, password=password)
elif allowed_types & pygit2.credentials.GIT_CREDTYPE_USERNAME:
return pygit2.Username(username_from_url)
else:
return None
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
2090,
312,
8789,
13,
5215,
2224,
1982,
13,
5215,
19229,
13,
13,
5215,
2828,
13,
5215,
19484,
277,
29906,
13,
13,
3166,
869,
1053,
3030,
13,
13,
13,
1753,
338,
29918,
14941,
29898,
20095,
29901,
19484,
277,
29906,
29889,
11481,
29897,
1599,
6120,
29901,
13,
1678,
736,
451,
738,
29898,
13,
4706,
775,
13,
4706,
363,
775,
297,
13761,
29889,
4882,
2141,
5975,
580,
13,
4706,
565,
313,
13,
9651,
775,
13,
9651,
6228,
313,
401,
669,
19484,
277,
29906,
29889,
29954,
1806,
29918,
27047,
29918,
17755,
29918,
28577,
29897,
13,
9651,
6228,
313,
401,
669,
19484,
277,
29906,
29889,
29954,
1806,
29918,
27047,
29918,
6259,
6632,
19386,
29897,
13,
4706,
1723,
13,
1678,
1723,
13,
13,
13,
1753,
1996,
29918,
14941,
29898,
9891,
29901,
19229,
29889,
5594,
519,
29897,
1599,
19229,
29889,
5594,
519,
29901,
13,
1678,
732,
7692,
312,
8789,
29889,
29893,
336,
567,
29898,
9891,
29897,
13,
1678,
822,
14476,
29898,
13,
4706,
334,
5085,
29901,
19229,
29889,
10773,
29892,
12893,
29901,
3030,
29889,
2677,
29892,
3579,
19290,
29901,
19229,
29889,
10773,
13,
1678,
1723,
1599,
19229,
29889,
10773,
29901,
13,
13,
4706,
565,
451,
338,
29918,
14941,
29898,
20095,
29922,
13073,
29889,
4632,
29918,
20095,
1125,
13,
9651,
1596,
29898,
13073,
29889,
4632,
29918,
20095,
29889,
4882,
3101,
13,
9651,
12020,
7865,
2392,
29898,
13073,
29889,
4632,
29918,
20095,
29889,
1287,
3972,
29897,
13,
13,
4706,
363,
13761,
29918,
5527,
297,
12893,
29889,
5527,
29889,
276,
1066,
29901,
13,
9651,
13761,
353,
19484,
277,
29906,
29889,
11481,
29898,
710,
29898,
20095,
29918,
5527,
29889,
2084,
876,
13,
9651,
565,
451,
338,
29918,
14941,
29898,
20095,
29922,
20095,
1125,
13,
18884,
12020,
7865,
2392,
29898,
20095,
29889,
1287,
3972,
29897,
13,
13,
4706,
736,
3653,
10456,
5085,
29892,
12893,
29922,
13073,
29892,
3579,
19290,
29897,
13,
13,
1678,
736,
14476,
13,
13,
13,
1753,
4607,
29898,
20095,
29901,
19484,
277,
29906,
29889,
11481,
29892,
2143,
29901,
19484,
277,
29906,
29889,
7422,
29897,
1599,
6213,
29901,
13,
1678,
380,
25936,
353,
7700,
13,
1678,
565,
451,
338,
29918,
14941,
29898,
20095,
29922,
20095,
1125,
13,
4706,
13761,
29889,
303,
1161,
29898,
303,
1161,
261,
29922,
20095,
29889,
4381,
29918,
4530,
1535,
29897,
13,
4706,
380,
25936,
353,
5852,
13,
13,
1678,
13761,
29889,
3198,
449,
29898,
999,
978,
29922,
999,
29897,
13,
13,
1678,
565,
380,
25936,
29901,
13,
4706,
13761,
29889,
303,
1161,
29918,
7323,
580,
13,
13,
13,
1753,
9063,
29898,
13,
1678,
13761,
29901,
19484,
277,
29906,
29889,
11481,
29892,
13,
1678,
2643,
29901,
851,
29892,
13,
1678,
2224,
5965,
2395,
29901,
19229,
29889,
27636,
29961,
1017,
15702,
29889,
1293,
29961,
1017,
15702,
29889,
19986,
29961,
710,
29892,
2224,
1982,
29889,
2605,
5262,
29962,
353,
6213,
29892,
13,
29897,
1599,
6213,
29901,
13,
1678,
565,
2224,
5965,
2395,
338,
6213,
29901,
13,
4706,
2224,
5965,
2395,
353,
5159,
13,
13,
1678,
2224,
5965,
2395,
353,
518,
13,
4706,
313,
13,
9651,
851,
29898,
13,
18884,
2224,
6550,
29889,
22925,
29918,
517,
29898,
20095,
29889,
1287,
3972,
29897,
13,
18884,
565,
2224,
6550,
29889,
275,
29918,
23552,
580,
13,
18884,
1683,
2224,
6550,
13,
9651,
1723,
13,
9651,
565,
338,
8758,
29898,
2084,
6550,
29892,
2224,
1982,
29889,
2605,
29897,
13,
9651,
1683,
2224,
6550,
13,
4706,
1723,
13,
4706,
363,
2224,
6550,
297,
2224,
5965,
2395,
13,
1678,
4514,
13,
13,
1678,
13761,
29889,
2248,
29889,
1202,
29918,
497,
29898,
2084,
5965,
2395,
29922,
2084,
5965,
2395,
29897,
13,
1678,
13761,
29889,
2248,
29889,
3539,
580,
13,
1678,
5447,
353,
13761,
29889,
2248,
29889,
3539,
29918,
8336,
580,
13,
13,
1678,
1018,
29901,
13,
4706,
3847,
29892,
2143,
353,
13761,
29889,
17863,
29918,
999,
728,
29898,
999,
728,
29922,
20095,
29889,
2813,
29889,
978,
29897,
13,
1678,
5174,
19484,
277,
29906,
29889,
28712,
2392,
29901,
13,
4706,
11825,
353,
5159,
13,
4706,
2143,
29918,
978,
353,
525,
24539,
29914,
2813,
29879,
29914,
6207,
29915,
13,
1678,
1683,
29901,
13,
4706,
11825,
353,
518,
3560,
29889,
3398,
29962,
13,
4706,
2143,
29918,
978,
353,
2143,
29889,
978,
13,
13,
1678,
13761,
29889,
3258,
29918,
15060,
29898,
13,
4706,
2143,
29918,
978,
29892,
13761,
29889,
4381,
29918,
4530,
1535,
29892,
13761,
29889,
4381,
29918,
4530,
1535,
29892,
2643,
29892,
5447,
29892,
11825,
13,
1678,
1723,
13,
13,
13,
1753,
5503,
29898,
20095,
29901,
19484,
277,
29906,
29889,
11481,
29892,
5443,
29918,
978,
29901,
851,
29897,
1599,
6213,
29901,
13,
1678,
5443,
353,
13761,
29889,
17519,
267,
29889,
2997,
29961,
17519,
29918,
978,
29962,
13,
1678,
565,
451,
5443,
29889,
275,
29918,
2813,
7295,
13,
4706,
12020,
7865,
2392,
29898,
17519,
29897,
13,
13,
1678,
1018,
29901,
13,
4706,
7592,
353,
13761,
29889,
1745,
4769,
1839,
12574,
2033,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
736,
13,
13,
1678,
7592,
29889,
5910,
29898,
5965,
2395,
11759,
29888,
29915,
29912,
17519,
29889,
978,
29913,
7464,
6939,
29879,
29922,
20224,
10717,
29879,
3101,
13,
1678,
701,
5461,
29918,
17519,
353,
13761,
29889,
17519,
267,
29889,
657,
29898,
29888,
29915,
29912,
16674,
29889,
978,
6822,
29912,
17519,
29889,
845,
2072,
392,
29913,
1495,
13,
1678,
565,
701,
5461,
29918,
17519,
338,
451,
6213,
29901,
13,
4706,
5443,
29889,
786,
5461,
353,
701,
5461,
29918,
17519,
13,
13,
13,
1753,
16523,
29898,
20095,
29901,
19484,
277,
29906,
29889,
11481,
29892,
5443,
29918,
978,
29901,
851,
29897,
1599,
6213,
29901,
13,
1678,
9995,
13,
1678,
323,
2722,
304,
2767,
278,
421,
17519,
29918,
978,
29952,
5443,
310,
278,
421,
20095,
29952,
13761,
304,
278,
9281,
13,
1678,
701,
5461,
5443,
2106,
29889,
13,
1678,
960,
278,
5443,
338,
701,
304,
2635,
29892,
947,
3078,
29889,
13,
1678,
960,
278,
5443,
508,
367,
5172,
29899,
11333,
287,
29892,
620,
1691,
304,
278,
701,
5461,
29889,
13,
1678,
13466,
29892,
8465,
411,
385,
1059,
29889,
13,
1678,
9995,
13,
1678,
5443,
353,
13761,
29889,
17519,
267,
29889,
2997,
29961,
17519,
29918,
978,
29962,
13,
1678,
565,
451,
5443,
29889,
275,
29918,
2813,
7295,
13,
4706,
12020,
7865,
2392,
29898,
17519,
29897,
13,
13,
1678,
1018,
29901,
13,
4706,
7592,
353,
13761,
29889,
1745,
4769,
1839,
12574,
2033,
13,
1678,
5174,
7670,
2392,
29901,
13,
4706,
736,
13,
13,
1678,
7592,
29889,
9155,
29898,
14035,
29879,
29922,
20224,
10717,
29879,
3101,
13,
1678,
701,
5461,
29918,
17519,
353,
5443,
29889,
786,
5461,
13,
1678,
565,
451,
701,
5461,
29918,
17519,
29901,
13,
4706,
736,
13,
13,
1678,
10366,
29918,
3859,
29892,
903,
353,
13761,
29889,
14634,
29918,
15916,
29898,
786,
5461,
29918,
17519,
29889,
5182,
29892,
5443,
29889,
978,
29897,
13,
1678,
565,
10366,
29918,
3859,
669,
19484,
277,
29906,
29889,
29954,
1806,
29918,
29924,
1001,
1692,
29918,
2190,
1964,
21554,
3235,
29918,
4897,
29918,
4986,
29918,
6248,
29901,
13,
4706,
736,
13,
1678,
565,
451,
313,
14634,
29918,
3859,
669,
19484,
277,
29906,
29889,
29954,
1806,
29918,
29924,
1001,
1692,
29918,
2190,
1964,
21554,
3235,
29918,
4519,
1254,
22051,
29956,
17011,
1125,
13,
4706,
12020,
7865,
2392,
29898,
17519,
29897,
13,
13,
1678,
13761,
29889,
12071,
29898,
786,
5461,
29918,
17519,
29889,
5182,
29892,
19484,
277,
29906,
29889,
29954,
1806,
29918,
1525,
10490,
29918,
29950,
17011,
29897,
13,
1678,
13761,
29889,
3198,
449,
29898,
999,
978,
29922,
17519,
29897,
13,
13,
13,
1753,
8341,
29898,
20095,
29901,
19484,
277,
29906,
29889,
11481,
29892,
5443,
29918,
978,
29901,
851,
29892,
2643,
29901,
851,
29897,
1599,
6213,
29901,
13,
1678,
5835,
353,
13761,
29889,
17519,
267,
29889,
2997,
1839,
6207,
2033,
13,
1678,
5443,
353,
13761,
29889,
17519,
267,
29889,
2997,
29961,
17519,
29918,
978,
29962,
13,
1678,
565,
451,
5443,
29889,
275,
29918,
2813,
7295,
13,
4706,
12020,
7865,
2392,
29898,
17519,
29897,
13,
13,
1678,
10366,
29918,
26613,
1161,
29898,
20095,
29922,
20095,
29892,
1749,
29879,
29918,
17519,
29922,
6207,
29892,
1009,
29879,
29918,
17519,
29922,
17519,
29892,
2643,
29922,
4906,
29897,
13,
13,
1678,
13761,
29889,
3198,
449,
29898,
999,
978,
29922,
6207,
29897,
13,
1678,
5443,
29889,
8143,
580,
13,
13,
13,
1753,
10366,
29918,
26613,
1161,
29898,
13,
1678,
13761,
29901,
19484,
277,
29906,
29889,
11481,
29892,
13,
1678,
1749,
29879,
29918,
17519,
29901,
19484,
277,
29906,
29889,
29933,
4014,
29892,
13,
1678,
1009,
29879,
29918,
17519,
29901,
19484,
277,
29906,
29889,
29933,
4014,
29892,
13,
1678,
2643,
29901,
851,
29892,
13,
29897,
1599,
6213,
29901,
13,
1678,
9995,
13,
1678,
2431,
9514,
263,
10366,
310,
278,
421,
1552,
12935,
29918,
17519,
29952,
964,
421,
2470,
29918,
17519,
29952,
18074,
1485,
2790,
278,
25741,
13,
1678,
9995,
13,
1678,
10366,
29918,
3859,
29892,
903,
353,
13761,
29889,
14634,
29918,
15916,
29898,
1552,
12935,
29918,
17519,
29889,
5182,
29892,
1749,
29879,
29918,
17519,
29889,
978,
29897,
13,
1678,
565,
10366,
29918,
3859,
669,
19484,
277,
29906,
29889,
29954,
1806,
29918,
29924,
1001,
1692,
29918,
2190,
1964,
21554,
3235,
29918,
4897,
29918,
4986,
29918,
6248,
29901,
13,
4706,
736,
13,
1678,
565,
451,
313,
14634,
29918,
3859,
669,
19484,
277,
29906,
29889,
29954,
1806,
29918,
29924,
1001,
1692,
29918,
2190,
1964,
21554,
3235,
29918,
4519,
1254,
22051,
29956,
17011,
1125,
13,
4706,
12020,
7865,
2392,
29898,
1552,
12935,
29918,
17519,
29897,
13,
13,
1678,
2380,
29901,
19484,
277,
29906,
29889,
3220,
353,
13761,
29889,
14634,
29918,
28737,
29898,
13,
4706,
19525,
272,
29922,
2470,
29918,
17519,
29892,
1749,
29879,
29922,
2470,
29918,
17519,
29892,
1009,
29879,
29922,
1552,
12935,
29918,
17519,
13,
1678,
1723,
13,
1678,
5447,
353,
2380,
29889,
3539,
29918,
8336,
29898,
20095,
29922,
20095,
29897,
13,
1678,
13761,
29889,
3258,
29918,
15060,
29898,
13,
4706,
1749,
29879,
29918,
17519,
29889,
978,
29892,
13,
4706,
13761,
29889,
4381,
29918,
4530,
1535,
29892,
13,
4706,
13761,
29889,
4381,
29918,
4530,
1535,
29892,
13,
4706,
2643,
29892,
13,
4706,
5447,
29892,
13,
4706,
518,
2470,
29918,
17519,
29889,
5182,
1402,
13,
1678,
1723,
13,
13,
13,
1753,
4055,
29898,
20095,
29901,
19484,
277,
29906,
29889,
11481,
29892,
4055,
29918,
978,
29901,
851,
29897,
1599,
6213,
29901,
13,
1678,
13761,
29889,
276,
10662,
29889,
3258,
29898,
978,
29922,
29888,
29915,
24539,
29914,
11338,
19248,
4039,
29918,
978,
29913,
742,
3646,
29922,
20095,
29889,
2813,
29889,
5182,
29897,
13,
13,
13,
1753,
17432,
29898,
2271,
29901,
851,
29892,
2224,
29901,
2224,
1982,
29889,
2605,
29892,
3579,
19290,
29901,
19229,
29889,
10773,
29897,
1599,
19484,
277,
29906,
29889,
11481,
29901,
13,
1678,
736,
19484,
277,
29906,
29889,
16513,
29918,
19033,
29898,
13,
4706,
3142,
29922,
2271,
29892,
2224,
29922,
710,
29898,
2084,
511,
6939,
29879,
29922,
20224,
10717,
29879,
3285,
3579,
19290,
13,
1678,
1723,
13,
13,
13,
1990,
5240,
866,
10717,
29879,
29898,
2272,
5559,
29906,
29889,
20224,
10717,
29879,
1125,
13,
1678,
9995,
13,
1678,
6811,
24040,
278,
16140,
6939,
29889,
13,
1678,
9995,
13,
13,
1678,
822,
16140,
29898,
13,
4706,
1583,
29892,
3142,
29901,
851,
29892,
8952,
29918,
3166,
29918,
2271,
29901,
19229,
29889,
27636,
29961,
710,
1402,
6068,
29918,
8768,
29901,
938,
13,
1678,
1723,
1599,
19229,
29889,
27636,
29961,
13,
4706,
19229,
29889,
19986,
29961,
2272,
5559,
29906,
29889,
2558,
18784,
29892,
19484,
277,
29906,
29889,
2659,
7129,
29892,
19484,
277,
29906,
29889,
20249,
29962,
13,
1678,
4514,
29901,
13,
4706,
9995,
13,
4706,
960,
278,
7592,
1923,
6858,
10760,
29892,
445,
740,
674,
367,
2000,
322,
13,
4706,
967,
736,
995,
1304,
363,
10760,
29889,
13,
4706,
9995,
13,
4706,
565,
6068,
29918,
8768,
669,
19484,
277,
29906,
29889,
11944,
9409,
29889,
29954,
1806,
29918,
29907,
19386,
11116,
29918,
1799,
29950,
29918,
10818,
29901,
13,
9651,
736,
19484,
277,
29906,
29889,
2558,
18784,
4591,
19661,
29898,
6786,
29918,
3166,
29918,
2271,
29897,
13,
4706,
25342,
6068,
29918,
8768,
669,
19484,
277,
29906,
29889,
11944,
9409,
29889,
29954,
1806,
29918,
29907,
19386,
11116,
29918,
11889,
25711,
29918,
29925,
4375,
1177,
16975,
29901,
13,
9651,
8952,
353,
8952,
29918,
3166,
29918,
2271,
470,
2828,
29889,
14032,
415,
703,
20249,
1159,
13,
9651,
4800,
353,
2828,
29889,
14032,
415,
703,
10048,
613,
9563,
29918,
2080,
29922,
5574,
29897,
13,
9651,
736,
19484,
277,
29906,
29889,
2659,
7129,
29898,
6786,
29922,
6786,
29892,
4800,
29922,
5630,
29897,
13,
4706,
25342,
6068,
29918,
8768,
669,
19484,
277,
29906,
29889,
11944,
9409,
29889,
29954,
1806,
29918,
29907,
19386,
11116,
29918,
11889,
5813,
29901,
13,
9651,
736,
19484,
277,
29906,
29889,
20249,
29898,
6786,
29918,
3166,
29918,
2271,
29897,
13,
4706,
1683,
29901,
13,
9651,
736,
6213,
13,
2
] |
setup.py | SforAiDl/max | 5 | 66507 | <filename>setup.py
import codecs
import os
from setuptools import find_packages, setup
NAME = "Jeta"
DESCRIPTION = "A JAX based meta learning library"
with open("README.md", "r") as f:
LONG_DESCRIPTION = f.read()
PROJECT = os.path.abspath(os.path.dirname(__file__))
EXCLUDE = ()
VERSION = "0.1.0"
AUTHOR = "Society for Artificial Intelligence and Deep Learning"
EMAIL = "<EMAIL>"
LICENSE = "MIT"
REPO_URL = "https://github.com/SforAiDl/jeta"
PROJECT_URLS = {"Source": REPO_URL}
CLASSIFIERS = (
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
)
def read(*parts):
"""
returns contents of file
"""
with codecs.open(os.path.join(PROJECT, *parts), "rb", "utf-8") as file:
return file.read()
def get_requires(path):
"""
generates requirements from file path given as REQUIRE_PATH
"""
for line in read(path).splitlines():
line = line.strip()
if line and not line.startswith("#"):
yield line
INSTALL_REQUIRES = list(get_requires("requirements.txt"))
CONFIG = {
"name": NAME,
"description": DESCRIPTION,
"long_description": LONG_DESCRIPTION,
"long_description_content_type": "text/markdown",
"packages": find_packages(where=PROJECT, exclude=EXCLUDE),
"version": VERSION,
"author": AUTHOR,
"author_email": EMAIL,
"license": LICENSE,
"url": REPO_URL,
"project_urls": PROJECT_URLS,
"classifiers": CLASSIFIERS,
"install_requires": INSTALL_REQUIRES,
"python_requires": ">=3.6",
}
if __name__ == "__main__":
setup(**CONFIG)
| [
1,
529,
9507,
29958,
14669,
29889,
2272,
13,
5215,
775,
2395,
13,
5215,
2897,
13,
13,
3166,
731,
21245,
8789,
1053,
1284,
29918,
8318,
29892,
6230,
13,
13,
5813,
353,
376,
29967,
1187,
29908,
13,
2287,
7187,
24290,
2725,
353,
376,
29909,
435,
6604,
2729,
12700,
6509,
3489,
29908,
13,
13,
2541,
1722,
703,
16310,
2303,
29889,
3487,
613,
376,
29878,
1159,
408,
285,
29901,
13,
1678,
365,
20614,
29918,
2287,
7187,
24290,
2725,
353,
285,
29889,
949,
580,
13,
13,
8618,
17637,
353,
2897,
29889,
2084,
29889,
370,
1028,
493,
29898,
359,
29889,
2084,
29889,
25721,
22168,
1445,
1649,
876,
13,
5746,
6154,
29965,
2287,
353,
3861,
13,
16358,
353,
376,
29900,
29889,
29896,
29889,
29900,
29908,
13,
20656,
29950,
1955,
353,
376,
6295,
455,
3305,
363,
3012,
928,
616,
3159,
28286,
322,
21784,
29257,
29908,
13,
26862,
6227,
353,
9872,
26862,
6227,
11903,
13,
27888,
1430,
1660,
353,
376,
26349,
29908,
13,
1525,
13152,
29918,
4219,
353,
376,
991,
597,
3292,
29889,
510,
29914,
29903,
1454,
29909,
29875,
29928,
29880,
29914,
29926,
1187,
29908,
13,
8618,
17637,
29918,
4219,
29903,
353,
8853,
4435,
1115,
5195,
13152,
29918,
4219,
29913,
13,
13875,
1799,
29902,
3738,
23598,
353,
313,
13,
1678,
376,
9283,
4056,
17088,
4761,
5132,
4761,
29871,
29941,
613,
13,
1678,
376,
29931,
293,
1947,
4761,
438,
5425,
28268,
1490,
4761,
341,
1806,
19245,
613,
13,
1678,
376,
7094,
1218,
2184,
4761,
6570,
25266,
613,
13,
29897,
13,
13,
13,
1753,
1303,
10456,
20895,
1125,
13,
1678,
9995,
13,
1678,
3639,
8118,
310,
934,
13,
1678,
9995,
13,
1678,
411,
775,
2395,
29889,
3150,
29898,
359,
29889,
2084,
29889,
7122,
29898,
8618,
17637,
29892,
334,
20895,
511,
376,
6050,
613,
376,
9420,
29899,
29947,
1159,
408,
934,
29901,
13,
4706,
736,
934,
29889,
949,
580,
13,
13,
13,
1753,
679,
29918,
276,
339,
2658,
29898,
2084,
1125,
13,
1678,
9995,
13,
1678,
16785,
11780,
515,
934,
2224,
2183,
408,
5195,
29984,
3120,
1525,
29918,
10145,
13,
1678,
9995,
13,
1678,
363,
1196,
297,
1303,
29898,
2084,
467,
5451,
9012,
7295,
13,
4706,
1196,
353,
1196,
29889,
17010,
580,
13,
4706,
565,
1196,
322,
451,
1196,
29889,
27382,
2541,
14822,
29908,
1125,
13,
9651,
7709,
1196,
13,
13,
13,
25580,
9818,
29918,
1525,
29984,
3120,
15989,
353,
1051,
29898,
657,
29918,
276,
339,
2658,
703,
12277,
1860,
29889,
3945,
5783,
13,
13,
13,
25903,
353,
426,
13,
1678,
376,
978,
1115,
27085,
29892,
13,
1678,
376,
8216,
1115,
23050,
24290,
2725,
29892,
13,
1678,
376,
5426,
29918,
8216,
1115,
365,
20614,
29918,
2287,
7187,
24290,
2725,
29892,
13,
1678,
376,
5426,
29918,
8216,
29918,
3051,
29918,
1853,
1115,
376,
726,
29914,
3502,
3204,
613,
13,
1678,
376,
8318,
1115,
1284,
29918,
8318,
29898,
3062,
29922,
8618,
17637,
29892,
19060,
29922,
5746,
6154,
29965,
2287,
511,
13,
1678,
376,
3259,
1115,
478,
1001,
13381,
29892,
13,
1678,
376,
8921,
1115,
26524,
29950,
1955,
29892,
13,
1678,
376,
8921,
29918,
5269,
1115,
382,
1529,
6227,
29892,
13,
1678,
376,
506,
1947,
1115,
365,
2965,
1430,
1660,
29892,
13,
1678,
376,
2271,
1115,
5195,
13152,
29918,
4219,
29892,
13,
1678,
376,
4836,
29918,
26045,
1115,
13756,
17637,
29918,
4219,
29903,
29892,
13,
1678,
376,
1990,
14903,
1115,
315,
4375,
1799,
29902,
3738,
23598,
29892,
13,
1678,
376,
6252,
29918,
276,
339,
2658,
1115,
2672,
1254,
9818,
29918,
1525,
29984,
3120,
15989,
29892,
13,
1678,
376,
4691,
29918,
276,
339,
2658,
1115,
376,
18572,
29941,
29889,
29953,
613,
13,
29913,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
6230,
29898,
1068,
25903,
29897,
13,
2
] |
data_process.py | liliangbin/unet-match | 1 | 1603287 | # -*- coding:utf-8 -*-
import SimpleITK as sitk
import cv2
from keras.preprocessing.image import img_to_array, load_img
def to_hu(image):
MIN_BLOOD = -10
MAX_BLOOD = 400
print(MAX_BLOOD, "===", MIN_BLOOD)
image = (image - MIN_BLOOD) / (MAX_BLOOD - MIN_BLOOD)
image[image > 1] = 1.
image[image < 0] = 0.
return image
image = sitk.ReadImage("20001.dcm")
image_array = sitk.GetArrayFromImage(image) # z, y, x
print(image_array)
print(image_array.shape)
image_array = image_array.swapaxes(0, 2)
image_array = image_array.swapaxes(0, 1)
# 可以使用 transpose
# 维数变化
print("image_array==shape==>", image_array.shape)
image_array[image_array == -2000] = 0
# np.savetxt("test.txt", image_array)
image_array = to_hu(image_array)*2
image_array = image_array * 255
#image_array[image_array < 40] = 0
print(image_array[255][255])
print(image_array[160][160])
cv2.imwrite("info.png", image_array)
# np.savetxt("test2.txt", image_array * 255)
# images = np.squeeze(image_array)
#
# plt.imshow(images, cmap="gray")
# plt.axis("off")
# plt.savefig("test.png")
# plt.show()
print("image_array done")
img = load_img("20001_mask.png", color_mode="grayscale")
# img = img_to_array(img)
label = img_to_array(img)
print("label==shape ==", label.shape)
| [
1,
396,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
13,
5215,
12545,
1806,
29968,
408,
7845,
29895,
13,
5215,
13850,
29906,
13,
3166,
13023,
294,
29889,
1457,
19170,
29889,
3027,
1053,
10153,
29918,
517,
29918,
2378,
29892,
2254,
29918,
2492,
13,
13,
13,
1753,
304,
29918,
6905,
29898,
3027,
1125,
13,
1678,
341,
1177,
29918,
29933,
3927,
13668,
353,
448,
29896,
29900,
13,
1678,
18134,
29918,
29933,
3927,
13668,
353,
29871,
29946,
29900,
29900,
13,
1678,
1596,
29898,
12648,
29918,
29933,
3927,
13668,
29892,
376,
1360,
543,
29892,
341,
1177,
29918,
29933,
3927,
13668,
29897,
13,
1678,
1967,
353,
313,
3027,
448,
341,
1177,
29918,
29933,
3927,
13668,
29897,
847,
313,
12648,
29918,
29933,
3927,
13668,
448,
341,
1177,
29918,
29933,
3927,
13668,
29897,
13,
1678,
1967,
29961,
3027,
1405,
29871,
29896,
29962,
353,
29871,
29896,
29889,
13,
1678,
1967,
29961,
3027,
529,
29871,
29900,
29962,
353,
29871,
29900,
29889,
13,
1678,
736,
1967,
13,
13,
13,
3027,
353,
7845,
29895,
29889,
6359,
2940,
703,
29906,
29900,
29900,
29900,
29896,
29889,
29881,
4912,
1159,
13,
3027,
29918,
2378,
353,
7845,
29895,
29889,
2577,
2588,
4591,
2940,
29898,
3027,
29897,
29871,
396,
503,
29892,
343,
29892,
921,
13,
2158,
29898,
3027,
29918,
2378,
29897,
13,
2158,
29898,
3027,
29918,
2378,
29889,
12181,
29897,
13,
3027,
29918,
2378,
353,
1967,
29918,
2378,
29889,
26276,
1165,
267,
29898,
29900,
29892,
29871,
29906,
29897,
13,
3027,
29918,
2378,
353,
1967,
29918,
2378,
29889,
26276,
1165,
267,
29898,
29900,
29892,
29871,
29896,
29897,
13,
29937,
29871,
30682,
30651,
30785,
30406,
1301,
4220,
13,
29937,
29871,
234,
190,
183,
30354,
31462,
30705,
13,
2158,
703,
3027,
29918,
2378,
1360,
12181,
1360,
28341,
1967,
29918,
2378,
29889,
12181,
29897,
13,
3027,
29918,
2378,
29961,
3027,
29918,
2378,
1275,
448,
29906,
29900,
29900,
29900,
29962,
353,
29871,
29900,
13,
29937,
7442,
29889,
29879,
485,
300,
486,
703,
1688,
29889,
3945,
613,
1967,
29918,
2378,
29897,
13,
3027,
29918,
2378,
353,
304,
29918,
6905,
29898,
3027,
29918,
2378,
11877,
29906,
13,
3027,
29918,
2378,
353,
1967,
29918,
2378,
334,
29871,
29906,
29945,
29945,
13,
29937,
3027,
29918,
2378,
29961,
3027,
29918,
2378,
529,
29871,
29946,
29900,
29962,
353,
29871,
29900,
13,
2158,
29898,
3027,
29918,
2378,
29961,
29906,
29945,
29945,
3816,
29906,
29945,
29945,
2314,
13,
2158,
29898,
3027,
29918,
2378,
29961,
29896,
29953,
29900,
3816,
29896,
29953,
29900,
2314,
13,
11023,
29906,
29889,
326,
3539,
703,
3888,
29889,
2732,
613,
1967,
29918,
2378,
29897,
13,
29937,
7442,
29889,
29879,
485,
300,
486,
703,
1688,
29906,
29889,
3945,
613,
1967,
29918,
2378,
334,
29871,
29906,
29945,
29945,
29897,
13,
29937,
4558,
353,
7442,
29889,
29879,
802,
29872,
911,
29898,
3027,
29918,
2378,
29897,
13,
29937,
13,
29937,
14770,
29889,
326,
4294,
29898,
8346,
29892,
274,
1958,
543,
21012,
1159,
13,
29937,
14770,
29889,
8990,
703,
2696,
1159,
13,
29937,
14770,
29889,
7620,
1003,
703,
1688,
29889,
2732,
1159,
13,
13,
29937,
14770,
29889,
4294,
580,
13,
2158,
703,
3027,
29918,
2378,
2309,
1159,
13,
2492,
353,
2254,
29918,
2492,
703,
29906,
29900,
29900,
29900,
29896,
29918,
13168,
29889,
2732,
613,
2927,
29918,
8513,
543,
21012,
7052,
1159,
13,
29937,
10153,
353,
10153,
29918,
517,
29918,
2378,
29898,
2492,
29897,
13,
1643,
353,
10153,
29918,
517,
29918,
2378,
29898,
2492,
29897,
13,
2158,
703,
1643,
1360,
12181,
353,
543,
29892,
3858,
29889,
12181,
29897,
13,
2
] |
experiments/_play.py | Chen-Cai-OSU/GeometryofEmbedding | 2 | 85904 | import matplotlib
matplotlib.use('tkagg')
import os
import subprocess
import sys
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
import tensorflow as tf
from ampligraph.common.aux import rel_rank_stat, load_data, eigengap
from ampligraph.common.aux_play import get_model, viz_distm
from ampligraph.evaluation import evaluate_performance, mrr_score, hits_at_n_score
from sacred import Experiment
from sacred.observers import MongoObserver
import numpy as np
import warnings
from pymongo import MongoClient
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
tf.logging.set_verbosity(tf.logging.ERROR) # https://stackoverflow.com/questions/48608776/how-to-suppress-tensorflow-warning-displayed-in-result
parser = ArgumentParser("scoring", formatter_class=ArgumentDefaultsHelpFormatter, conflict_handler='resolve')
parser.add_argument("--depth", default=8, type=int, help='method')
parser.add_argument('--rb', action='store_true')
parser.add_argument('--verbose', action='store_true')
parser.add_argument('--fix_rel', action='store_true')
parser.add_argument("--viz", action='store_true')
parser.add_argument('--data', type = str, default='single_fam_tree')
parser.add_argument('--n_epoch', type=int, default=200)
parser.add_argument('--prob', type=float, default=0)
parser.add_argument("--seed", default=42, type=int, help='random seed')
parser.add_argument("--add", default=1, type=int, help='additional relation')
parser.add_argument("--extra_rel", default=30, type=int, help='extra relation')
parser.add_argument("--noise_rel", default=1, type=int, help='noise relation (half noise)')
parser.add_argument("--n_node", default=1000, type=int, help='n_nodes')
parser.add_argument("--model", default='ComplEx', type=str, help='model name')
parser.add_argument("--period", default=3, type=int, help='the period of relations')
client = MongoClient('localhost', 27017)
EXPERIMENT_NAME = 'KG_corrupt'
YOUR_CPU = None
DATABASE_NAME = 'KG_corrupt'
ex = Experiment(EXPERIMENT_NAME)
ex.observers.append(MongoObserver.create(url=YOUR_CPU, db_name=DATABASE_NAME))
warnings.filterwarnings("ignore", category=DeprecationWarning)
from ampligraph.common.aux import timefunction
# @timefunction
def topk_tails(model, hr=np.array(['101', '1']), top_k=5, print_f = False):
"""
:param model:
:param hr: h and r
:param top_k:
:return:
"""
# hr = np.array([['101', '1']])
hr = hr.reshape(1, 2)
C = np.array([np.append(hr, x) for x in list(model.ent_to_idx.keys())])
tmp = np.array(model.predict(C)).reshape(C.shape[0], 1) # np.array of shape (n,1)
df = pd.DataFrame(np.hstack([C, tmp]), columns=['head', 'relation', 'tail_', 'score'])
def filter_score(row):
if float(row.score) < 1e-4:
return 0
else:
return float(row.score)
df['score_filter'] = df.apply(filter_score, axis=1)
df = df.sort_values('score_filter', ascending=False, inplace=False)
if print_f:
print('Top %s solutions for query (%s, %s, ?)' % (top_k, hr[0, 0], hr[0, 1]))
print(df[:top_k])
print('-' * 50)
# print(df.tail_)
best_tails = list(df.tail_) # return the best tail
return int(best_tails[0]), int(best_tails[1])
def ranks_summary(ranks):
mrr = mrr_score(ranks)
hits_1, hits_3, hits_10, hits_20, hits_50 = hits_at_n_score(ranks, n=1), hits_at_n_score(ranks,
n=3), hits_at_n_score(
ranks, n=10), hits_at_n_score(ranks, n=20), hits_at_n_score(ranks, n=50)
print("MRR: %f, Hits@1: %f, Hits@3: %f, Hits@10: %f, Hits@20: %f, Hits@50: %f" % (
mrr, hits_1, hits_3, hits_10, hits_20, hits_50))
print('-' * 150)
def eval_corrution(model, filter, args, x, noise = 1, noise_loc = 't'):
corrupt_test = corrupt(x, period=args.n_node, noise=noise, corrput_location= noise_loc)
args_ = {'strict':False, 'model': model, 'filter_triples': filter, 'verbose': args.verbose, 'use_default_protocol': True}
ranks_corrupt = evaluate_performance(corrupt_test, **args_)
for i in range(10):
print('noise ' + str(noise) + ' at ' + noise_loc, corrupt_test[i], ranks_corrupt[2*i], ranks_corrupt[2*i+1])
ranks_summary(ranks_corrupt)
print('-'*150)
def corrupt(x, period = 1000, noise = 1, corrput_location = 'h'):
# array of shape (n, 3)
n, d = x.shape
assert d == 3
res = []
for i in range(n):
h, r, t = x[i]
if corrput_location == 't':
t = str((int(t) + noise)%period) # 1 is noise here
elif corrput_location == 'r':
# todo make sure no new relation is introduced
r = str((int(r) + noise)%period)
elif corrput_location == 'h':
h = str((int(h) + noise)%period)
else:
raise Exception('No such corruption location %s'%corrput_location)
res.append([h, r, t])
return np.array(res)
def traj_graph(lis1, lis2, name='', viz= False, lis1_only = False):
# lis = range(2, 20)
n = len(lis1)
assert len(lis1) == len(lis2)
edges = [(lis1[0], lis1[1])]
for i in range(1, n-1):
edge1 = (lis1[i], lis1[i + 1])
edges.append(edge1)
if not lis1_only:
edge2 = (lis1[i], lis2[i + 1])
edges.append(edge2)
g = nx.Graph()
g.add_edges_from(edges)
pos = nx.spring_layout(g)
# pos = nx.circular_layout(g)
nx.draw(g, pos, node_color='b', node_size=5, with_labels=True, width=1)
try:
os.makedirs('./img')
except FileExistsError:
pass
if viz: plt.show()
plt.savefig('./img/traj_graph' + name)
# lis1 = [2, 3, 4, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 35, 36, 37, 38, 39, 40, 41, 42]
# lis2 = [34, 74, 35, 89, 30, 14, 37, 15, 32, 40, 61, 0, 1, 16, 61, 25, 95, 88, 30, 31, 29, 79, 58, 68, 41, 64, 85, 36, 70, 68, 30, 14, 37, 15, 32, 40, 61, 0, 1, 16, 61, 25, 95, 88, 30, 31, 29, 79, 58, 68, 41, 64, 85, 36, 70, 68, 30, 14, 37, 15, 32, 40, 61, 0, 1, 16, 61, 25, 95, 88, 30, 31, 29, 79, 58, 68, 41, 64, 85, 36, 70, 68, 30, 14, 37, 15, 32, 40, 61, 0, 1, 16, 61, 25, 95, 88, 30, 31, 29, 79]
# traj_graph(lis1, lis2, name='', viz=True, lis1_only=True)
# sys.exit()
@ex.config
def get_config():
# unused params
depth = 8
rb = True
# param
verbose = True
data = 'single_fam_tree'
seed = 42
noise_rel = 8
n_node = 1000
model = 'ComplEx'
rels = '1 2 3 4 5 6 7 8 9 10 11 12'#'1 2 3 4 5 6 7 8 9 10 11 12' #'1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16'
# other param
period = 3
@ex.main
def main(model, n_node, noise_rel, seed, data, verbose, rels, period):
sys.argv = []
args = parser.parse_args()
args.model = model
args.n_node = n_node
args.noise_rel = noise_rel
args.seed = seed
args.data = data
args.verbose = verbose
args.rels = rels
args.period = period
print(args)
if args.data == 'single_fam_tree':
py_server = ['/home/cai.507/anaconda3/envs/ampligraph/bin/python']
py_local = ['~/anaconda3/bin/python']
tmp_command = ['../ampligraph/datasets/single_fam_tree.py',
'--seed', str(args.seed), '--add', str(args.add),
'--extra_rel', str(args.extra_rel),
'--noise_rel', str(args.noise_rel),
'--rels', str(args.rels),
'--n_node', str(args.n_node)]
command_server = py_server + tmp_command
command_local = py_local + tmp_command
else:
raise ('No such data %s'%args.data)
try:
print(command_server)
print(subprocess.check_output(command_server))
except FileNotFoundError:
print(command_local)
print(subprocess.check_output(command_local))
X, _ = load_data(args)
for key, val in X.items():
print(key, len(val),)
# get model
model = get_model(args)
# Fit the model on training and validation set
filter = np.concatenate((X['train'], X['valid'], X['test']))
print(model,'\n')
model.fit(X['train'], early_stopping=True,
early_stopping_params= \
{ 'x_valid': X['valid'], # validation set
'criteria': 'hits10', # Uses hits10 criteria for early stopping
'burn_in': 100, # early stopping kicks in after 100 epochs
'check_interval': 20, # validates every 20th epoch
'stop_interval': 5, # stops if 5 successive validation checks are bad.
'x_filter': filter, # Use filter for filtering out positives
'corruption_entities': 'all', # corrupt using all entities
'corrupt_side': 's+o' # corrupt subject and object (but not at once)
})
# Run the evaluation procedure on the test set (with filtering). Usually, we corrupt subject and object sides separately and compute ranks
# ranks = evaluate_performance(X['test'], model=model, filter_triples=filter, verbose=args.verbose, use_default_protocol=True) # corrupt subj and obj separately while evaluating
eval_corrution(model, filter, args, X['test'], noise=0, noise_loc='t')
eval_corrution(model, filter, args, X['test'], noise=1, noise_loc='t')
# eval_corrution(model, filter, args, X['test'], noise=1, noise_loc='h')
queries = []
best_tails, second_best_tails = [], []
step = 2
edges = []
for i in range(n_node):
query = [str(i), str(step)]
best_tail, second_tail = topk_tails(model, hr = np.array(query), top_k=3, print_f=True)
edge = (i, second_tail)
edges.append(edge)
print(edges)
g = nx.Graph()
g.add_edges_from(edges)
# pos = nx.spring_layout(g, seed=42)
pos = nx.circular_layout(g)
nx.draw(g, pos, node_color='b', node_size=5, with_labels=True, width=1)
name = './img/circular_layout_second/rel_' + str(step) + '_' + str(n_node) + '_' + str(rels) # TODO change circular layout
title = f'{n_node} nodes. Rels {rels}. relation step {step}'
plt.title(title)
plt.savefig(name)
sys.exit()
for i in range(n_step):
query = [str(h), str(step)]
print('iter %s: head %s'%(i, query[0]))
queries.append(query)
best_tail, second_best_tail = topk_tails(model, hr=np.array(query), top_k=5, print_f=False)
best_tails.append(best_tail)
second_best_tails.append(second_best_tail)
h = best_tail
print(best_tails)
print(second_best_tails)
traj_graph(best_tails, second_best_tails, name='_' + str(n_step))
if __name__ == "__main__":
# main('ComplEx', 1000, 1, 42, 'single_fam_tree', True)
ex.run_commandline() # SACRED: this allows you to run Sacred not only from your terminal,
| [
1,
1053,
22889,
13,
2922,
17357,
29889,
1509,
877,
11178,
16170,
1495,
13,
5215,
2897,
13,
5215,
1014,
5014,
13,
5215,
10876,
13,
3166,
1852,
5510,
1053,
23125,
11726,
29892,
23125,
24863,
29648,
18522,
13,
5215,
12183,
13,
21707,
353,
12183,
29889,
657,
16363,
22168,
978,
1649,
29897,
13,
21707,
29889,
842,
10108,
29898,
21027,
29889,
18525,
29897,
13,
13,
5215,
26110,
408,
15886,
13,
3166,
20563,
335,
1140,
29889,
9435,
29889,
2993,
1053,
1104,
29918,
10003,
29918,
6112,
29892,
2254,
29918,
1272,
29892,
15761,
996,
481,
13,
3166,
20563,
335,
1140,
29889,
9435,
29889,
2993,
29918,
1456,
1053,
679,
29918,
4299,
29892,
25294,
29918,
5721,
29885,
13,
3166,
20563,
335,
1140,
29889,
24219,
362,
1053,
14707,
29918,
546,
13390,
29892,
286,
21478,
29918,
13628,
29892,
19572,
29918,
271,
29918,
29876,
29918,
13628,
13,
13,
3166,
26546,
1053,
1222,
15362,
13,
3166,
26546,
29889,
711,
643,
874,
1053,
18294,
28066,
13,
5215,
12655,
408,
7442,
13,
5215,
18116,
13,
3166,
282,
962,
7443,
1053,
18294,
4032,
13,
5215,
11701,
408,
10518,
13,
5215,
3564,
29916,
408,
302,
29916,
13,
5215,
22889,
29889,
2272,
5317,
408,
14770,
13,
13,
359,
29889,
21813,
1839,
8969,
29918,
6271,
29925,
29918,
16173,
29918,
14480,
29918,
1307,
29963,
6670,
2033,
353,
525,
29941,
29915,
13,
13264,
29889,
21027,
29889,
842,
29918,
18248,
359,
537,
29898,
13264,
29889,
21027,
29889,
11432,
29897,
396,
2045,
597,
2417,
29889,
510,
29914,
2619,
29914,
29946,
29947,
29953,
29900,
29947,
29955,
29955,
29953,
29914,
3525,
29899,
517,
29899,
19303,
1253,
29899,
29056,
29899,
27392,
29899,
4990,
287,
29899,
262,
29899,
2914,
13,
13,
16680,
353,
23125,
11726,
703,
1557,
8253,
613,
883,
2620,
29918,
1990,
29922,
15730,
24863,
29648,
18522,
29892,
14529,
29918,
13789,
2433,
17863,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
19488,
613,
2322,
29922,
29947,
29892,
1134,
29922,
524,
29892,
1371,
2433,
5696,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
6050,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
369,
15828,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
5878,
29918,
2674,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
29894,
466,
613,
3158,
2433,
8899,
29918,
3009,
1495,
13,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
1272,
742,
1134,
353,
851,
29892,
2322,
2433,
14369,
29918,
29888,
314,
29918,
8336,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
29876,
29918,
1022,
2878,
742,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29900,
29900,
29897,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
22795,
742,
1134,
29922,
7411,
29892,
2322,
29922,
29900,
29897,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
26776,
613,
2322,
29922,
29946,
29906,
29892,
1134,
29922,
524,
29892,
1371,
2433,
8172,
16717,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
1202,
613,
2322,
29922,
29896,
29892,
1134,
29922,
524,
29892,
1371,
2433,
1202,
3245,
8220,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
17833,
29918,
2674,
613,
2322,
29922,
29941,
29900,
29892,
1134,
29922,
524,
29892,
1371,
2433,
17833,
8220,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
1217,
895,
29918,
2674,
613,
2322,
29922,
29896,
29892,
1134,
29922,
524,
29892,
1371,
2433,
1217,
895,
8220,
313,
24498,
11462,
29897,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
29876,
29918,
3177,
613,
2322,
29922,
29896,
29900,
29900,
29900,
29892,
1134,
29922,
524,
29892,
1371,
2433,
29876,
29918,
18010,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
4299,
613,
2322,
2433,
1523,
572,
1252,
742,
1134,
29922,
710,
29892,
1371,
2433,
4299,
1024,
1495,
13,
16680,
29889,
1202,
29918,
23516,
703,
489,
19145,
613,
2322,
29922,
29941,
29892,
1134,
29922,
524,
29892,
1371,
2433,
1552,
3785,
310,
5302,
1495,
13,
13,
4645,
353,
18294,
4032,
877,
7640,
742,
29871,
29906,
29955,
29900,
29896,
29955,
29897,
13,
5746,
13171,
7833,
3919,
29918,
5813,
353,
525,
29968,
29954,
29918,
2616,
6685,
29915,
13,
29979,
22970,
29918,
6271,
29965,
353,
6213,
13,
25832,
27982,
29918,
5813,
353,
525,
29968,
29954,
29918,
2616,
6685,
29915,
13,
735,
353,
1222,
15362,
29898,
5746,
13171,
7833,
3919,
29918,
5813,
29897,
13,
735,
29889,
711,
643,
874,
29889,
4397,
29898,
29924,
7443,
28066,
29889,
3258,
29898,
2271,
29922,
29979,
22970,
29918,
6271,
29965,
29892,
4833,
29918,
978,
29922,
25832,
27982,
29918,
5813,
876,
13,
25442,
886,
29889,
4572,
25442,
886,
703,
17281,
613,
7663,
29922,
8498,
3757,
362,
22709,
29897,
13,
3166,
20563,
335,
1140,
29889,
9435,
29889,
2993,
1053,
931,
2220,
13,
13,
29937,
732,
2230,
2220,
13,
1753,
2246,
29895,
29918,
29873,
2234,
29898,
4299,
29892,
22157,
29922,
9302,
29889,
2378,
18959,
29896,
29900,
29896,
742,
525,
29896,
2033,
511,
2246,
29918,
29895,
29922,
29945,
29892,
1596,
29918,
29888,
353,
7700,
1125,
13,
1678,
9995,
13,
1678,
584,
3207,
1904,
29901,
13,
1678,
584,
3207,
22157,
29901,
298,
322,
364,
13,
1678,
584,
3207,
2246,
29918,
29895,
29901,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
396,
22157,
353,
7442,
29889,
2378,
4197,
1839,
29896,
29900,
29896,
742,
525,
29896,
2033,
2314,
13,
1678,
22157,
353,
22157,
29889,
690,
14443,
29898,
29896,
29892,
29871,
29906,
29897,
13,
1678,
315,
353,
7442,
29889,
2378,
4197,
9302,
29889,
4397,
29898,
1092,
29892,
921,
29897,
363,
921,
297,
1051,
29898,
4299,
29889,
296,
29918,
517,
29918,
13140,
29889,
8149,
3101,
2314,
13,
1678,
13128,
353,
7442,
29889,
2378,
29898,
4299,
29889,
27711,
29898,
29907,
8106,
690,
14443,
29898,
29907,
29889,
12181,
29961,
29900,
1402,
29871,
29896,
29897,
396,
7442,
29889,
2378,
310,
8267,
313,
29876,
29892,
29896,
29897,
13,
1678,
4489,
353,
10518,
29889,
17271,
29898,
9302,
29889,
29882,
1429,
4197,
29907,
29892,
13128,
11724,
4341,
29922,
1839,
2813,
742,
525,
23445,
742,
525,
18237,
29918,
742,
525,
13628,
11287,
13,
13,
1678,
822,
4175,
29918,
13628,
29898,
798,
1125,
13,
4706,
565,
5785,
29898,
798,
29889,
13628,
29897,
529,
29871,
29896,
29872,
29899,
29946,
29901,
13,
9651,
736,
29871,
29900,
13,
4706,
1683,
29901,
13,
9651,
736,
5785,
29898,
798,
29889,
13628,
29897,
13,
13,
1678,
4489,
1839,
13628,
29918,
4572,
2033,
353,
4489,
29889,
7302,
29898,
4572,
29918,
13628,
29892,
9685,
29922,
29896,
29897,
13,
1678,
4489,
353,
4489,
29889,
6605,
29918,
5975,
877,
13628,
29918,
4572,
742,
12066,
2548,
29922,
8824,
29892,
297,
6689,
29922,
8824,
29897,
13,
13,
1678,
565,
1596,
29918,
29888,
29901,
13,
4706,
1596,
877,
7031,
1273,
29879,
6851,
363,
2346,
313,
29995,
29879,
29892,
1273,
29879,
29892,
1577,
16029,
1273,
313,
3332,
29918,
29895,
29892,
22157,
29961,
29900,
29892,
29871,
29900,
1402,
22157,
29961,
29900,
29892,
29871,
29896,
12622,
13,
4706,
1596,
29898,
2176,
7503,
3332,
29918,
29895,
2314,
13,
4706,
1596,
877,
29899,
29915,
334,
29871,
29945,
29900,
29897,
13,
13,
1678,
396,
1596,
29898,
2176,
29889,
18237,
19925,
13,
1678,
1900,
29918,
29873,
2234,
353,
1051,
29898,
2176,
29889,
18237,
19925,
396,
736,
278,
1900,
12464,
13,
13,
1678,
736,
938,
29898,
13318,
29918,
29873,
2234,
29961,
29900,
11724,
938,
29898,
13318,
29918,
29873,
2234,
29961,
29896,
2314,
13,
13,
1753,
27871,
29918,
7727,
29898,
661,
2039,
1125,
13,
1678,
286,
21478,
353,
286,
21478,
29918,
13628,
29898,
661,
2039,
29897,
13,
1678,
19572,
29918,
29896,
29892,
19572,
29918,
29941,
29892,
19572,
29918,
29896,
29900,
29892,
19572,
29918,
29906,
29900,
29892,
19572,
29918,
29945,
29900,
353,
19572,
29918,
271,
29918,
29876,
29918,
13628,
29898,
661,
2039,
29892,
302,
29922,
29896,
511,
19572,
29918,
271,
29918,
29876,
29918,
13628,
29898,
661,
2039,
29892,
13,
462,
462,
462,
462,
462,
632,
302,
29922,
29941,
511,
19572,
29918,
271,
29918,
29876,
29918,
13628,
29898,
13,
4706,
27871,
29892,
302,
29922,
29896,
29900,
511,
19572,
29918,
271,
29918,
29876,
29918,
13628,
29898,
661,
2039,
29892,
302,
29922,
29906,
29900,
511,
19572,
29918,
271,
29918,
29876,
29918,
13628,
29898,
661,
2039,
29892,
302,
29922,
29945,
29900,
29897,
13,
1678,
1596,
703,
21055,
29934,
29901,
1273,
29888,
29892,
379,
1169,
29992,
29896,
29901,
1273,
29888,
29892,
379,
1169,
29992,
29941,
29901,
1273,
29888,
29892,
379,
1169,
29992,
29896,
29900,
29901,
1273,
29888,
29892,
379,
1169,
29992,
29906,
29900,
29901,
1273,
29888,
29892,
379,
1169,
29992,
29945,
29900,
29901,
1273,
29888,
29908,
1273,
313,
13,
4706,
286,
21478,
29892,
19572,
29918,
29896,
29892,
19572,
29918,
29941,
29892,
19572,
29918,
29896,
29900,
29892,
19572,
29918,
29906,
29900,
29892,
19572,
29918,
29945,
29900,
876,
13,
1678,
1596,
877,
29899,
29915,
334,
29871,
29896,
29945,
29900,
29897,
13,
13,
1753,
19745,
29918,
29725,
918,
29898,
4299,
29892,
4175,
29892,
6389,
29892,
921,
29892,
11462,
353,
29871,
29896,
29892,
11462,
29918,
2029,
353,
525,
29873,
29374,
13,
1678,
1034,
6685,
29918,
1688,
353,
1034,
6685,
29898,
29916,
29892,
3785,
29922,
5085,
29889,
29876,
29918,
3177,
29892,
11462,
29922,
1217,
895,
29892,
27760,
649,
29918,
5479,
29922,
11462,
29918,
2029,
29897,
13,
1678,
6389,
29918,
353,
11117,
710,
919,
2396,
8824,
29892,
525,
4299,
2396,
1904,
29892,
525,
4572,
29918,
3626,
2701,
2396,
4175,
29892,
525,
369,
15828,
2396,
6389,
29889,
369,
15828,
29892,
525,
1509,
29918,
4381,
29918,
20464,
2396,
5852,
29913,
13,
1678,
27871,
29918,
2616,
6685,
353,
14707,
29918,
546,
13390,
29898,
2616,
6685,
29918,
1688,
29892,
3579,
5085,
19925,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29900,
1125,
13,
4706,
1596,
877,
1217,
895,
525,
718,
851,
29898,
1217,
895,
29897,
718,
525,
472,
525,
718,
11462,
29918,
2029,
29892,
1034,
6685,
29918,
1688,
29961,
29875,
1402,
27871,
29918,
2616,
6685,
29961,
29906,
29930,
29875,
1402,
27871,
29918,
2616,
6685,
29961,
29906,
29930,
29875,
29974,
29896,
2314,
13,
1678,
27871,
29918,
7727,
29898,
661,
2039,
29918,
2616,
6685,
29897,
13,
1678,
1596,
877,
29899,
29915,
29930,
29896,
29945,
29900,
29897,
13,
13,
1753,
1034,
6685,
29898,
29916,
29892,
3785,
353,
29871,
29896,
29900,
29900,
29900,
29892,
11462,
353,
29871,
29896,
29892,
27760,
649,
29918,
5479,
353,
525,
29882,
29374,
13,
1678,
396,
1409,
310,
8267,
313,
29876,
29892,
29871,
29941,
29897,
13,
1678,
302,
29892,
270,
353,
921,
29889,
12181,
13,
1678,
4974,
270,
1275,
29871,
29941,
13,
1678,
620,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
1125,
13,
4706,
298,
29892,
364,
29892,
260,
353,
921,
29961,
29875,
29962,
13,
13,
4706,
565,
27760,
649,
29918,
5479,
1275,
525,
29873,
2396,
13,
9651,
260,
353,
851,
3552,
524,
29898,
29873,
29897,
718,
11462,
29897,
29995,
19145,
29897,
29871,
396,
29871,
29896,
338,
11462,
1244,
13,
4706,
25342,
27760,
649,
29918,
5479,
1275,
525,
29878,
2396,
13,
9651,
396,
10481,
1207,
1854,
694,
716,
8220,
338,
9129,
13,
9651,
364,
353,
851,
3552,
524,
29898,
29878,
29897,
718,
11462,
29897,
29995,
19145,
29897,
13,
4706,
25342,
27760,
649,
29918,
5479,
1275,
525,
29882,
2396,
13,
9651,
298,
353,
851,
3552,
524,
29898,
29882,
29897,
718,
11462,
29897,
29995,
19145,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
8960,
877,
3782,
1316,
1034,
18953,
4423,
1273,
29879,
29915,
29995,
29725,
649,
29918,
5479,
29897,
13,
13,
4706,
620,
29889,
4397,
4197,
29882,
29892,
364,
29892,
260,
2314,
13,
1678,
736,
7442,
29889,
2378,
29898,
690,
29897,
13,
13,
1753,
1020,
29926,
29918,
4262,
29898,
23443,
29896,
29892,
301,
275,
29906,
29892,
1024,
2433,
742,
25294,
29922,
7700,
29892,
301,
275,
29896,
29918,
6194,
353,
7700,
1125,
13,
1678,
396,
301,
275,
353,
3464,
29898,
29906,
29892,
29871,
29906,
29900,
29897,
13,
1678,
302,
353,
7431,
29898,
23443,
29896,
29897,
13,
1678,
4974,
7431,
29898,
23443,
29896,
29897,
1275,
7431,
29898,
23443,
29906,
29897,
13,
1678,
12770,
353,
17288,
23443,
29896,
29961,
29900,
1402,
301,
275,
29896,
29961,
29896,
2314,
29962,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
302,
29899,
29896,
1125,
13,
4706,
7636,
29896,
353,
313,
23443,
29896,
29961,
29875,
1402,
301,
275,
29896,
29961,
29875,
718,
29871,
29896,
2314,
13,
4706,
12770,
29889,
4397,
29898,
12864,
29896,
29897,
13,
4706,
565,
451,
301,
275,
29896,
29918,
6194,
29901,
13,
9651,
7636,
29906,
353,
313,
23443,
29896,
29961,
29875,
1402,
301,
275,
29906,
29961,
29875,
718,
29871,
29896,
2314,
13,
9651,
12770,
29889,
4397,
29898,
12864,
29906,
29897,
13,
13,
1678,
330,
353,
302,
29916,
29889,
9527,
580,
13,
1678,
330,
29889,
1202,
29918,
287,
2710,
29918,
3166,
29898,
287,
2710,
29897,
13,
1678,
926,
353,
302,
29916,
29889,
4278,
29918,
2680,
29898,
29887,
29897,
13,
1678,
396,
926,
353,
302,
29916,
29889,
6034,
1070,
29918,
2680,
29898,
29887,
29897,
13,
1678,
302,
29916,
29889,
4012,
29898,
29887,
29892,
926,
29892,
2943,
29918,
2780,
2433,
29890,
742,
2943,
29918,
2311,
29922,
29945,
29892,
411,
29918,
21134,
29922,
5574,
29892,
2920,
29922,
29896,
29897,
13,
1678,
1018,
29901,
13,
4706,
2897,
29889,
29885,
12535,
12935,
877,
6904,
2492,
1495,
13,
1678,
5174,
3497,
24217,
2392,
29901,
13,
4706,
1209,
13,
1678,
565,
25294,
29901,
14770,
29889,
4294,
580,
13,
1678,
14770,
29889,
7620,
1003,
877,
6904,
2492,
29914,
3018,
29926,
29918,
4262,
29915,
718,
1024,
29897,
13,
13,
29937,
301,
275,
29896,
353,
518,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29900,
29892,
29871,
29945,
29896,
29892,
29871,
29945,
29906,
29892,
29871,
29945,
29941,
29892,
29871,
29945,
29946,
29892,
29871,
29945,
29945,
29892,
29871,
29945,
29953,
29892,
29871,
29945,
29955,
29892,
29871,
29945,
29947,
29892,
29871,
29945,
29929,
29892,
29871,
29953,
29900,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29941,
29955,
29892,
29871,
29941,
29947,
29892,
29871,
29941,
29929,
29892,
29871,
29946,
29900,
29892,
29871,
29946,
29896,
29892,
29871,
29946,
29906,
29892,
29871,
29946,
29941,
29892,
29871,
29946,
29946,
29892,
29871,
29946,
29945,
29892,
29871,
29946,
29953,
29892,
29871,
29946,
29955,
29892,
29871,
29946,
29947,
29892,
29871,
29946,
29929,
29892,
29871,
29945,
29900,
29892,
29871,
29945,
29896,
29892,
29871,
29945,
29906,
29892,
29871,
29945,
29941,
29892,
29871,
29945,
29946,
29892,
29871,
29945,
29945,
29892,
29871,
29945,
29953,
29892,
29871,
29945,
29955,
29892,
29871,
29945,
29947,
29892,
29871,
29945,
29929,
29892,
29871,
29953,
29900,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29941,
29955,
29892,
29871,
29941,
29947,
29892,
29871,
29941,
29929,
29892,
29871,
29946,
29900,
29892,
29871,
29946,
29896,
29892,
29871,
29946,
29906,
29892,
29871,
29946,
29941,
29892,
29871,
29946,
29946,
29892,
29871,
29946,
29945,
29892,
29871,
29946,
29953,
29892,
29871,
29946,
29955,
29892,
29871,
29946,
29947,
29892,
29871,
29946,
29929,
29892,
29871,
29945,
29900,
29892,
29871,
29945,
29896,
29892,
29871,
29945,
29906,
29892,
29871,
29945,
29941,
29892,
29871,
29945,
29946,
29892,
29871,
29945,
29945,
29892,
29871,
29945,
29953,
29892,
29871,
29945,
29955,
29892,
29871,
29945,
29947,
29892,
29871,
29945,
29929,
29892,
29871,
29953,
29900,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29941,
29955,
29892,
29871,
29941,
29947,
29892,
29871,
29941,
29929,
29892,
29871,
29946,
29900,
29892,
29871,
29946,
29896,
29892,
29871,
29946,
29906,
29892,
29871,
29946,
29941,
29892,
29871,
29946,
29946,
29892,
29871,
29946,
29945,
29892,
29871,
29946,
29953,
29892,
29871,
29946,
29955,
29892,
29871,
29946,
29947,
29892,
29871,
29946,
29929,
29892,
29871,
29945,
29900,
29892,
29871,
29945,
29896,
29892,
29871,
29945,
29906,
29892,
29871,
29945,
29941,
29892,
29871,
29945,
29946,
29892,
29871,
29945,
29945,
29892,
29871,
29945,
29953,
29892,
29871,
29945,
29955,
29892,
29871,
29945,
29947,
29892,
29871,
29945,
29929,
29892,
29871,
29953,
29900,
29892,
29871,
29941,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29941,
29955,
29892,
29871,
29941,
29947,
29892,
29871,
29941,
29929,
29892,
29871,
29946,
29900,
29892,
29871,
29946,
29896,
29892,
29871,
29946,
29906,
29962,
13,
29937,
301,
275,
29906,
353,
518,
29941,
29946,
29892,
29871,
29955,
29946,
29892,
29871,
29941,
29945,
29892,
29871,
29947,
29929,
29892,
29871,
29941,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29955,
29892,
29871,
29896,
29945,
29892,
29871,
29941,
29906,
29892,
29871,
29946,
29900,
29892,
29871,
29953,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29953,
29892,
29871,
29953,
29896,
29892,
29871,
29906,
29945,
29892,
29871,
29929,
29945,
29892,
29871,
29947,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29941,
29896,
29892,
29871,
29906,
29929,
29892,
29871,
29955,
29929,
29892,
29871,
29945,
29947,
29892,
29871,
29953,
29947,
29892,
29871,
29946,
29896,
29892,
29871,
29953,
29946,
29892,
29871,
29947,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29955,
29900,
29892,
29871,
29953,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29955,
29892,
29871,
29896,
29945,
29892,
29871,
29941,
29906,
29892,
29871,
29946,
29900,
29892,
29871,
29953,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29953,
29892,
29871,
29953,
29896,
29892,
29871,
29906,
29945,
29892,
29871,
29929,
29945,
29892,
29871,
29947,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29941,
29896,
29892,
29871,
29906,
29929,
29892,
29871,
29955,
29929,
29892,
29871,
29945,
29947,
29892,
29871,
29953,
29947,
29892,
29871,
29946,
29896,
29892,
29871,
29953,
29946,
29892,
29871,
29947,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29955,
29900,
29892,
29871,
29953,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29955,
29892,
29871,
29896,
29945,
29892,
29871,
29941,
29906,
29892,
29871,
29946,
29900,
29892,
29871,
29953,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29953,
29892,
29871,
29953,
29896,
29892,
29871,
29906,
29945,
29892,
29871,
29929,
29945,
29892,
29871,
29947,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29941,
29896,
29892,
29871,
29906,
29929,
29892,
29871,
29955,
29929,
29892,
29871,
29945,
29947,
29892,
29871,
29953,
29947,
29892,
29871,
29946,
29896,
29892,
29871,
29953,
29946,
29892,
29871,
29947,
29945,
29892,
29871,
29941,
29953,
29892,
29871,
29955,
29900,
29892,
29871,
29953,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29896,
29946,
29892,
29871,
29941,
29955,
29892,
29871,
29896,
29945,
29892,
29871,
29941,
29906,
29892,
29871,
29946,
29900,
29892,
29871,
29953,
29896,
29892,
29871,
29900,
29892,
29871,
29896,
29892,
29871,
29896,
29953,
29892,
29871,
29953,
29896,
29892,
29871,
29906,
29945,
29892,
29871,
29929,
29945,
29892,
29871,
29947,
29947,
29892,
29871,
29941,
29900,
29892,
29871,
29941,
29896,
29892,
29871,
29906,
29929,
29892,
29871,
29955,
29929,
29962,
13,
29937,
1020,
29926,
29918,
4262,
29898,
23443,
29896,
29892,
301,
275,
29906,
29892,
1024,
2433,
742,
25294,
29922,
5574,
29892,
301,
275,
29896,
29918,
6194,
29922,
5574,
29897,
13,
29937,
10876,
29889,
13322,
580,
13,
13,
29992,
735,
29889,
2917,
13,
1753,
679,
29918,
2917,
7295,
13,
1678,
396,
443,
3880,
8636,
13,
1678,
10809,
353,
29871,
29947,
13,
1678,
364,
29890,
353,
5852,
13,
13,
1678,
396,
1828,
13,
1678,
26952,
353,
5852,
13,
1678,
848,
353,
525,
14369,
29918,
29888,
314,
29918,
8336,
29915,
13,
1678,
16717,
353,
29871,
29946,
29906,
13,
1678,
11462,
29918,
2674,
353,
29871,
29947,
13,
1678,
302,
29918,
3177,
353,
29871,
29896,
29900,
29900,
29900,
13,
1678,
1904,
353,
525,
1523,
572,
1252,
29915,
13,
1678,
1104,
29879,
353,
525,
29896,
29871,
29906,
29871,
29941,
29871,
29946,
29871,
29945,
29871,
29953,
29871,
29955,
29871,
29947,
29871,
29929,
29871,
29896,
29900,
29871,
29896,
29896,
29871,
29896,
29906,
29915,
29937,
29915,
29896,
29871,
29906,
29871,
29941,
29871,
29946,
29871,
29945,
29871,
29953,
29871,
29955,
29871,
29947,
29871,
29929,
29871,
29896,
29900,
29871,
29896,
29896,
29871,
29896,
29906,
29915,
396,
29915,
29896,
29871,
29906,
29871,
29941,
29871,
29946,
29871,
29945,
29871,
29953,
29871,
29955,
29871,
29947,
29871,
29929,
29871,
29896,
29900,
29871,
29896,
29896,
29871,
29896,
29906,
29871,
29896,
29941,
29871,
29896,
29946,
29871,
29896,
29945,
29871,
29896,
29953,
29915,
13,
13,
1678,
396,
916,
1828,
13,
1678,
3785,
353,
29871,
29941,
13,
13,
29992,
735,
29889,
3396,
13,
1753,
1667,
29898,
4299,
29892,
302,
29918,
3177,
29892,
11462,
29918,
2674,
29892,
16717,
29892,
848,
29892,
26952,
29892,
1104,
29879,
29892,
3785,
1125,
13,
1678,
10876,
29889,
19218,
353,
5159,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
6389,
29889,
4299,
353,
1904,
13,
1678,
6389,
29889,
29876,
29918,
3177,
353,
302,
29918,
3177,
13,
1678,
6389,
29889,
1217,
895,
29918,
2674,
353,
11462,
29918,
2674,
13,
1678,
6389,
29889,
26776,
353,
16717,
13,
1678,
6389,
29889,
1272,
353,
848,
13,
1678,
6389,
29889,
369,
15828,
353,
26952,
13,
1678,
6389,
29889,
2674,
29879,
353,
1104,
29879,
13,
1678,
6389,
29889,
19145,
353,
3785,
13,
1678,
1596,
29898,
5085,
29897,
13,
13,
1678,
565,
6389,
29889,
1272,
1275,
525,
14369,
29918,
29888,
314,
29918,
8336,
2396,
13,
4706,
11451,
29918,
2974,
353,
6024,
29914,
5184,
29914,
1113,
29875,
29889,
29945,
29900,
29955,
29914,
1648,
18050,
29941,
29914,
264,
4270,
29914,
314,
572,
335,
1140,
29914,
2109,
29914,
4691,
2033,
13,
4706,
11451,
29918,
2997,
353,
6024,
20038,
1648,
18050,
29941,
29914,
2109,
29914,
4691,
2033,
13,
4706,
13128,
29918,
6519,
353,
6024,
6995,
314,
572,
335,
1140,
29914,
14538,
1691,
29914,
14369,
29918,
29888,
314,
29918,
8336,
29889,
2272,
742,
13,
462,
462,
539,
525,
489,
26776,
742,
851,
29898,
5085,
29889,
26776,
511,
525,
489,
1202,
742,
851,
29898,
5085,
29889,
1202,
511,
13,
462,
462,
539,
525,
489,
17833,
29918,
2674,
742,
851,
29898,
5085,
29889,
17833,
29918,
2674,
511,
13,
462,
462,
539,
525,
489,
1217,
895,
29918,
2674,
742,
851,
29898,
5085,
29889,
1217,
895,
29918,
2674,
511,
13,
462,
462,
539,
525,
489,
2674,
29879,
742,
851,
29898,
5085,
29889,
2674,
29879,
511,
13,
462,
462,
539,
525,
489,
29876,
29918,
3177,
742,
851,
29898,
5085,
29889,
29876,
29918,
3177,
4638,
13,
4706,
1899,
29918,
2974,
353,
11451,
29918,
2974,
718,
13128,
29918,
6519,
13,
4706,
1899,
29918,
2997,
353,
11451,
29918,
2997,
718,
13128,
29918,
6519,
13,
1678,
1683,
29901,
13,
4706,
12020,
6702,
3782,
1316,
848,
1273,
29879,
29915,
29995,
5085,
29889,
1272,
29897,
13,
13,
1678,
1018,
29901,
13,
4706,
1596,
29898,
6519,
29918,
2974,
29897,
13,
4706,
1596,
29898,
1491,
5014,
29889,
3198,
29918,
4905,
29898,
6519,
29918,
2974,
876,
13,
1678,
5174,
3497,
17413,
2392,
29901,
13,
4706,
1596,
29898,
6519,
29918,
2997,
29897,
13,
4706,
1596,
29898,
1491,
5014,
29889,
3198,
29918,
4905,
29898,
6519,
29918,
2997,
876,
13,
13,
1678,
1060,
29892,
903,
353,
2254,
29918,
1272,
29898,
5085,
29897,
13,
1678,
363,
1820,
29892,
659,
297,
1060,
29889,
7076,
7295,
13,
4706,
1596,
29898,
1989,
29892,
7431,
29898,
791,
511,
29897,
13,
13,
1678,
396,
679,
1904,
13,
1678,
1904,
353,
679,
29918,
4299,
29898,
5085,
29897,
13,
13,
1678,
396,
383,
277,
278,
1904,
373,
6694,
29871,
322,
8845,
731,
13,
1678,
4175,
353,
7442,
29889,
535,
29883,
2579,
403,
3552,
29990,
1839,
14968,
7464,
1060,
1839,
3084,
7464,
1060,
1839,
1688,
25901,
13,
1678,
1596,
29898,
4299,
5501,
29905,
29876,
1495,
13,
1678,
1904,
29889,
9202,
29898,
29990,
1839,
14968,
7464,
4688,
29918,
7864,
3262,
29922,
5574,
29892,
13,
795,
4688,
29918,
7864,
3262,
29918,
7529,
29922,
320,
13,
462,
29871,
426,
259,
525,
29916,
29918,
3084,
2396,
1060,
1839,
3084,
7464,
29871,
396,
8845,
731,
13,
462,
418,
525,
29883,
21977,
2396,
525,
29882,
1169,
29896,
29900,
742,
29871,
396,
10783,
267,
19572,
29896,
29900,
16614,
363,
4688,
25480,
13,
462,
418,
525,
18712,
29918,
262,
2396,
29871,
29896,
29900,
29900,
29892,
29871,
396,
4688,
25480,
413,
7358,
297,
1156,
29871,
29896,
29900,
29900,
21502,
12168,
13,
462,
418,
525,
3198,
29918,
19207,
2396,
29871,
29906,
29900,
29892,
29871,
396,
2854,
1078,
1432,
29871,
29906,
29900,
386,
21502,
305,
13,
462,
418,
525,
9847,
29918,
19207,
2396,
29871,
29945,
29892,
29871,
396,
17726,
565,
29871,
29945,
2551,
573,
8845,
12747,
526,
4319,
29889,
13,
462,
418,
525,
29916,
29918,
4572,
2396,
4175,
29892,
29871,
396,
4803,
4175,
363,
21166,
714,
13686,
3145,
13,
462,
418,
525,
2616,
18953,
29918,
296,
1907,
2396,
525,
497,
742,
29871,
396,
1034,
6685,
773,
599,
16212,
13,
462,
418,
525,
2616,
6685,
29918,
2975,
2396,
525,
29879,
29974,
29877,
29915,
29871,
396,
1034,
6685,
4967,
322,
1203,
313,
4187,
451,
472,
2748,
29897,
13,
462,
29871,
5615,
13,
13,
1678,
396,
7525,
278,
17983,
8792,
373,
278,
1243,
731,
313,
2541,
21166,
467,
26991,
29892,
591,
1034,
6685,
4967,
322,
1203,
11192,
16949,
322,
10272,
27871,
13,
1678,
396,
27871,
353,
14707,
29918,
546,
13390,
29898,
29990,
1839,
1688,
7464,
1904,
29922,
4299,
29892,
4175,
29918,
3626,
2701,
29922,
4572,
29892,
26952,
29922,
5085,
29889,
369,
15828,
29892,
671,
29918,
4381,
29918,
20464,
29922,
5574,
29897,
29871,
396,
1034,
6685,
1014,
29926,
322,
5446,
16949,
1550,
6161,
1218,
13,
1678,
19745,
29918,
29725,
918,
29898,
4299,
29892,
4175,
29892,
6389,
29892,
1060,
1839,
1688,
7464,
11462,
29922,
29900,
29892,
11462,
29918,
2029,
2433,
29873,
1495,
13,
1678,
19745,
29918,
29725,
918,
29898,
4299,
29892,
4175,
29892,
6389,
29892,
1060,
1839,
1688,
7464,
11462,
29922,
29896,
29892,
11462,
29918,
2029,
2433,
29873,
1495,
13,
1678,
396,
19745,
29918,
29725,
918,
29898,
4299,
29892,
4175,
29892,
6389,
29892,
1060,
1839,
1688,
7464,
11462,
29922,
29896,
29892,
11462,
29918,
2029,
2433,
29882,
1495,
13,
13,
1678,
9365,
353,
5159,
13,
1678,
1900,
29918,
29873,
2234,
29892,
1473,
29918,
13318,
29918,
29873,
2234,
353,
19997,
5159,
13,
1678,
4331,
353,
29871,
29906,
13,
13,
1678,
12770,
353,
5159,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
29918,
3177,
1125,
13,
4706,
2346,
353,
518,
710,
29898,
29875,
511,
851,
29898,
10568,
4638,
13,
4706,
1900,
29918,
18237,
29892,
1473,
29918,
18237,
353,
2246,
29895,
29918,
29873,
2234,
29898,
4299,
29892,
22157,
353,
7442,
29889,
2378,
29898,
1972,
511,
2246,
29918,
29895,
29922,
29941,
29892,
1596,
29918,
29888,
29922,
5574,
29897,
13,
4706,
7636,
353,
313,
29875,
29892,
1473,
29918,
18237,
29897,
13,
4706,
12770,
29889,
4397,
29898,
12864,
29897,
13,
1678,
1596,
29898,
287,
2710,
29897,
13,
1678,
330,
353,
302,
29916,
29889,
9527,
580,
13,
1678,
330,
29889,
1202,
29918,
287,
2710,
29918,
3166,
29898,
287,
2710,
29897,
13,
1678,
396,
926,
353,
302,
29916,
29889,
4278,
29918,
2680,
29898,
29887,
29892,
16717,
29922,
29946,
29906,
29897,
13,
1678,
926,
353,
302,
29916,
29889,
6034,
1070,
29918,
2680,
29898,
29887,
29897,
13,
1678,
302,
29916,
29889,
4012,
29898,
29887,
29892,
926,
29892,
2943,
29918,
2780,
2433,
29890,
742,
2943,
29918,
2311,
29922,
29945,
29892,
411,
29918,
21134,
29922,
5574,
29892,
2920,
29922,
29896,
29897,
13,
1678,
1024,
353,
19283,
2492,
29914,
6034,
1070,
29918,
2680,
29918,
7496,
29914,
2674,
29918,
29915,
718,
851,
29898,
10568,
29897,
718,
22868,
29915,
718,
851,
29898,
29876,
29918,
3177,
29897,
718,
22868,
29915,
718,
851,
29898,
2674,
29879,
29897,
396,
14402,
1735,
19308,
5912,
13,
1678,
3611,
353,
285,
29915,
29912,
29876,
29918,
3177,
29913,
7573,
29889,
390,
1379,
426,
2674,
29879,
1836,
8220,
4331,
426,
10568,
10162,
13,
1678,
14770,
29889,
3257,
29898,
3257,
29897,
13,
1678,
14770,
29889,
7620,
1003,
29898,
978,
29897,
13,
1678,
10876,
29889,
13322,
580,
13,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
29918,
10568,
1125,
13,
4706,
2346,
353,
518,
710,
29898,
29882,
511,
851,
29898,
10568,
4638,
13,
4706,
1596,
877,
1524,
1273,
29879,
29901,
2343,
1273,
29879,
29915,
29995,
29898,
29875,
29892,
2346,
29961,
29900,
12622,
13,
4706,
9365,
29889,
4397,
29898,
1972,
29897,
13,
4706,
1900,
29918,
18237,
29892,
1473,
29918,
13318,
29918,
18237,
353,
2246,
29895,
29918,
29873,
2234,
29898,
4299,
29892,
22157,
29922,
9302,
29889,
2378,
29898,
1972,
511,
2246,
29918,
29895,
29922,
29945,
29892,
1596,
29918,
29888,
29922,
8824,
29897,
13,
4706,
1900,
29918,
29873,
2234,
29889,
4397,
29898,
13318,
29918,
18237,
29897,
13,
4706,
1473,
29918,
13318,
29918,
29873,
2234,
29889,
4397,
29898,
7496,
29918,
13318,
29918,
18237,
29897,
13,
4706,
298,
353,
1900,
29918,
18237,
13,
13,
1678,
1596,
29898,
13318,
29918,
29873,
2234,
29897,
13,
1678,
1596,
29898,
7496,
29918,
13318,
29918,
29873,
2234,
29897,
13,
1678,
1020,
29926,
29918,
4262,
29898,
13318,
29918,
29873,
2234,
29892,
1473,
29918,
13318,
29918,
29873,
2234,
29892,
1024,
2433,
29918,
29915,
718,
851,
29898,
29876,
29918,
10568,
876,
13,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
396,
1667,
877,
1523,
572,
1252,
742,
29871,
29896,
29900,
29900,
29900,
29892,
29871,
29896,
29892,
29871,
29946,
29906,
29892,
525,
14369,
29918,
29888,
314,
29918,
8336,
742,
5852,
29897,
13,
1678,
429,
29889,
3389,
29918,
6519,
1220,
580,
29871,
396,
317,
2477,
19386,
29901,
445,
6511,
366,
304,
1065,
15573,
1127,
451,
871,
515,
596,
8638,
29892,
13,
2
] |
Challenges-5/delStartEven.py | chandrakant100/Python-Project | 0 | 84620 | # Challenge 3 : Write a function called delete_starting_evens() that has a parameter named lst.
# The function should remove elements from the front of lst until the front of the list is not even.
# The function should then return lst.
# Date : Sun 07 Jun 2020 07:21:17 AM IST
def delete_starting_evens(lst):
while len(lst) != 0 and lst[0] % 2 == 0:
del lst[0]
return lst
print(delete_starting_evens([4, 8, 10, 11, 12, 15]))
print(delete_starting_evens([4, 8, 10]))
| [
1,
396,
27211,
29871,
29941,
584,
14350,
263,
740,
2000,
5217,
29918,
2962,
292,
29918,
5750,
575,
580,
393,
756,
263,
3443,
4257,
24471,
29889,
13,
29937,
1669,
450,
740,
881,
3349,
3161,
515,
278,
4565,
310,
24471,
2745,
278,
4565,
310,
278,
1051,
338,
451,
1584,
29889,
29871,
13,
29937,
1669,
450,
740,
881,
769,
736,
24471,
29889,
13,
29937,
4712,
4706,
584,
8991,
29871,
29900,
29955,
8378,
29871,
29906,
29900,
29906,
29900,
29871,
29900,
29955,
29901,
29906,
29896,
29901,
29896,
29955,
13862,
306,
1254,
13,
13,
1753,
5217,
29918,
2962,
292,
29918,
5750,
575,
29898,
20155,
1125,
13,
29871,
1550,
7431,
29898,
20155,
29897,
2804,
29871,
29900,
322,
24471,
29961,
29900,
29962,
1273,
29871,
29906,
1275,
29871,
29900,
29901,
13,
1678,
628,
24471,
29961,
29900,
29962,
13,
29871,
736,
24471,
13,
13,
13,
2158,
29898,
8143,
29918,
2962,
292,
29918,
5750,
575,
4197,
29946,
29892,
29871,
29947,
29892,
29871,
29896,
29900,
29892,
29871,
29896,
29896,
29892,
29871,
29896,
29906,
29892,
29871,
29896,
29945,
12622,
13,
2158,
29898,
8143,
29918,
2962,
292,
29918,
5750,
575,
4197,
29946,
29892,
29871,
29947,
29892,
29871,
29896,
29900,
12622,
13,
2
] |
tests/unit/transformations/test_histedges.py | gnafit/gna | 5 | 109739 | #!/usr/bin/env python
from matplotlib import pyplot as P
import numpy as N
from load import ROOT as R
import gna.constructors as C
import pytest
@pytest.mark.parametrize('edges', [N.linspace(0.0, 10.0, 11), N.geomspace(0.1, 1000.0, 5)])
def test_histedges_v01(edges):
centers = 0.5*(edges[1:]+edges[:-1])
widths = edges[1:]-edges[:-1]
data = N.arange(edges.size-1)
hist = C.Histogram(edges, data)
h2e = R.HistEdges()
h2e.histedges.hist(hist.hist.hist)
out_edges = h2e.histedges.edges.data()
out_centers = h2e.histedges.centers.data()
out_widths = h2e.histedges.widths.data()
print( 'Input:' )
print( edges )
print( 'Output:' )
print( 'Edges', out_edges )
print( 'Centers', out_centers )
print( 'Widths', out_widths )
assert (edges==out_edges).all()
assert (centers==out_centers).all()
assert (widths==out_widths).all()
if __name__ == "__main__":
test_histedges()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
3166,
22889,
1053,
11451,
5317,
408,
349,
13,
5215,
12655,
408,
405,
13,
3166,
2254,
1053,
16641,
2891,
408,
390,
13,
5215,
330,
1056,
29889,
11433,
943,
408,
315,
13,
5215,
11451,
1688,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
877,
287,
2710,
742,
518,
29940,
29889,
1915,
3493,
29898,
29900,
29889,
29900,
29892,
29871,
29896,
29900,
29889,
29900,
29892,
29871,
29896,
29896,
511,
405,
29889,
479,
290,
3493,
29898,
29900,
29889,
29896,
29892,
29871,
29896,
29900,
29900,
29900,
29889,
29900,
29892,
29871,
29945,
29897,
2314,
13,
1753,
1243,
29918,
29882,
12652,
2710,
29918,
29894,
29900,
29896,
29898,
287,
2710,
1125,
13,
1678,
1644,
414,
353,
29871,
29900,
29889,
29945,
16395,
287,
2710,
29961,
29896,
29901,
10062,
287,
2710,
7503,
29899,
29896,
2314,
13,
1678,
2920,
29879,
29871,
353,
418,
12770,
29961,
29896,
17531,
29899,
287,
2710,
7503,
29899,
29896,
29962,
13,
1678,
848,
29871,
353,
405,
29889,
279,
927,
29898,
287,
2710,
29889,
2311,
29899,
29896,
29897,
13,
13,
1678,
9825,
353,
315,
29889,
29950,
391,
13342,
29898,
287,
2710,
29892,
848,
29897,
13,
1678,
298,
29906,
29872,
353,
390,
29889,
29950,
391,
3853,
2710,
580,
13,
1678,
298,
29906,
29872,
29889,
29882,
12652,
2710,
29889,
29882,
391,
29898,
29882,
391,
29889,
29882,
391,
29889,
29882,
391,
29897,
13,
13,
1678,
714,
29918,
287,
2710,
259,
353,
298,
29906,
29872,
29889,
29882,
12652,
2710,
29889,
287,
2710,
29889,
1272,
580,
13,
1678,
714,
29918,
1760,
414,
353,
298,
29906,
29872,
29889,
29882,
12652,
2710,
29889,
1760,
414,
29889,
1272,
580,
13,
1678,
714,
29918,
2103,
29879,
353,
298,
29906,
29872,
29889,
29882,
12652,
2710,
29889,
2103,
29879,
29889,
1272,
580,
13,
13,
1678,
1596,
29898,
525,
4290,
11283,
1723,
13,
1678,
1596,
29898,
12770,
1723,
13,
13,
1678,
1596,
29898,
525,
6466,
11283,
1723,
13,
1678,
1596,
29898,
525,
3853,
2710,
742,
714,
29918,
287,
2710,
1723,
13,
1678,
1596,
29898,
525,
23369,
414,
742,
714,
29918,
1760,
414,
1723,
13,
1678,
1596,
29898,
525,
6110,
29879,
742,
714,
29918,
2103,
29879,
1723,
13,
13,
1678,
4974,
313,
287,
2710,
1360,
449,
29918,
287,
2710,
467,
497,
580,
13,
1678,
4974,
313,
1760,
414,
1360,
449,
29918,
1760,
414,
467,
497,
580,
13,
1678,
4974,
313,
2103,
29879,
1360,
449,
29918,
2103,
29879,
467,
497,
580,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1243,
29918,
29882,
12652,
2710,
580,
13,
2
] |
FSWDF-Project/main.py | chrischism8063/Mongo-py | 0 | 192152 | # main entry to the system
from application import app
| [
1,
396,
1667,
6251,
304,
278,
1788,
13,
3166,
2280,
1053,
623,
13,
2
] |
setup.py | SteveLTN/iex-api-python | 0 | 12113 | <reponame>SteveLTN/iex-api-python<filename>setup.py
import setuptools
import glob
import os
required = [
"requests",
"pandas",
"arrow",
"socketIO-client-nexus"
]
setuptools.setup(name='iex-api-python',
version="0.0.5",
description='Fetch data from the IEX API',
long_description=open('README.md').read().strip(),
author='<NAME>',
author_email='<EMAIL>',
url='http://www.github.com/danielecook/iex-api-python',
packages=['iex'],
install_requires=required,
keywords=['finance', 'stock', 'market', 'market-data', 'IEX', 'API'],
license='MIT License',
zip_safe=False)
| [
1,
529,
276,
1112,
420,
29958,
7789,
345,
5850,
29940,
29914,
347,
29916,
29899,
2754,
29899,
4691,
29966,
9507,
29958,
14669,
29889,
2272,
13,
5215,
731,
21245,
8789,
13,
5215,
13149,
13,
5215,
2897,
13,
13,
12403,
353,
518,
13,
1678,
376,
24830,
613,
13,
1678,
376,
15112,
613,
13,
1678,
376,
2936,
613,
13,
1678,
376,
11514,
5971,
29899,
4645,
29899,
13996,
375,
29908,
13,
29962,
13,
13,
842,
21245,
8789,
29889,
14669,
29898,
978,
2433,
347,
29916,
29899,
2754,
29899,
4691,
742,
13,
462,
1873,
543,
29900,
29889,
29900,
29889,
29945,
613,
13,
462,
6139,
2433,
20927,
848,
515,
278,
306,
5746,
3450,
742,
13,
462,
1472,
29918,
8216,
29922,
3150,
877,
16310,
2303,
29889,
3487,
2824,
949,
2141,
17010,
3285,
13,
462,
4148,
2433,
29966,
5813,
29958,
742,
13,
462,
4148,
29918,
5269,
2433,
29966,
26862,
6227,
29958,
742,
13,
462,
3142,
2433,
1124,
597,
1636,
29889,
3292,
29889,
510,
29914,
29881,
6067,
280,
15108,
29914,
347,
29916,
29899,
2754,
29899,
4691,
742,
13,
462,
9741,
29922,
1839,
347,
29916,
7464,
13,
462,
2601,
29918,
276,
339,
2658,
29922,
12403,
29892,
13,
462,
29361,
29922,
1839,
4951,
749,
742,
525,
17712,
742,
525,
28549,
742,
525,
28549,
29899,
1272,
742,
525,
29902,
5746,
742,
525,
8787,
7464,
13,
462,
19405,
2433,
26349,
19245,
742,
13,
462,
14319,
29918,
11177,
29922,
8824,
29897,
13,
2
] |
practice/practice_1.1/binary_search.py | Electro98/aads | 7 | 106989 | """Шаблон бинарного поиска"""
def search(sequence, item):
"""Бинарный поиск"""
raise NotImplementedError()
| [
1,
9995,
30074,
29910,
29975,
25851,
5660,
19619,
1868,
733,
29917,
2494,
15945,
29908,
13,
13,
13,
1753,
2740,
29898,
16506,
29892,
2944,
1125,
13,
1678,
9995,
30031,
29917,
19619,
2370,
733,
29917,
6231,
15945,
29908,
13,
1678,
12020,
2216,
1888,
2037,
287,
2392,
580,
13,
2
] |
cloudmesh/shell/shellutil.py | JulienPalard/cloudmesh | 0 | 170554 | '''some useful functions while working with shell'''
from __future__ import print_function
from cloudmesh.user.cm_user import cm_user
import json
from cloudmesh_common.tables import array_dict_table_printer, dict_key_list_table_printer
from cloudmesh_base.util import banner
import csv
from cmd3.console import Console
import hostlist
from cloudmesh.cm_mongo import cm_mongo
from cloudmesh.util.naming import server_name_analyzer
ALLOWED_PRINT_FORMAT = ['table', 'json', 'csv']
def get_default_print_format(username):
'''
the funtion will try to find the default printing form from db_defaults
if db_defaults has no item 'shell_print_format', the function will
set 'shell_print_format' = table
'''
format_type = None
user_obj = cm_user()
userdata = user_obj.info(username)
try:
format_type = userdata['defaults']['shell_print_format']
except:
pass
if format_type in [None, 'none']:
userdata['defaults']['shell_print_format'] = "table"
user_obj.set_defaults(username, userdata['defaults'])
userdata = user_obj.info(username)
format_type = userdata['defaults']['shell_print_format']
return format_type
def shell_commands_dict_output(username,
d,
# choose format manually
print_format=None,
# choose table format if needed
table_format=None,
# more specific table arguments
# --------------------------
# for table format: "key_list"
indexed=False,
# --------------------------
firstheader=None,
header=None,
oneitem=False,
vertical_table=False,
title=None,
count=False):
'''
some shell commands output a dict or table, this function should be
called when commands are printing in such way.
if none of parameters json and table is given, the funtion will try
to find the default printing form from db_defaults
if db_defaults has no item 'shell_print_format', the function will
set 'shell_print_format' = table
param username:: user id
param d:: data to print
param print_format:: print format: table, json, csv
param table_format:: choose table format if needed, DESCRIPTIONS:
type1: key_list:
accept a dict in the form:
{key1: [list1],
key2: [list2],
.......
=>
| key1 | key2 |
| l
| i
| s
| t
acceptable args: indexed: provide index
param firstheader:: designed for table, provide a attribute name for the
first item of each row, since the dict doesn't provide
it
param header:: designed for table(and used to filter input dict), a list of lists,
provides column order, e.g.
[[a,b], [c, d], ...
where 'a' is the printing column name and 'b' is the attribute name
in the dict
if you don't want to change the header name but want to keep the
header order or filter the items to list, for each item in the list
you may provide a string or a list with one item instead of a list of
two items
param oneitem:: designed for table, normally the input dict should be in such
form:
{a: {...}, b:{...}}, where each subitem is a row
if there is only one item, input dict is the {...} of the subitem
above
param title: provide a title for the table
param count: provide count info at the end of the table
'''
format_type = None
if print_format:
format_type = print_format
else:
format_type = get_default_print_format(username)
if format_type not in ALLOWED_PRINT_FORMAT:
Console.error("wrong print format: {0}. (allowed print format: {1})".format(format_type,
", ".join(ALLOWED_PRINT_FORMAT)))
return False
headers = None
order = None
if header:
headers = []
order = []
for i in header:
if isinstance(i, basestring):
headers.append(i)
order.append(i)
elif isinstance(i, list):
if len(i) == 1:
headers.append(i[0])
order.append(i[0])
else:
headers.append(i[0])
order.append(i[1])
else:
print("ERROR: header info is not correct")
return False
# --------------------------------------------------------------------------
# filter the input dict
# --------------------------------------------------------------------------
if order:
new_d = {}
if oneitem:
for item in order:
if item in d:
new_d[item] = d[item]
else:
for i in d:
new_d[i] = {}
for item in order:
if item in d[i]:
new_d[i][item] = d[i][item]
d = new_d
# --------------------------------------------------------------------------
if format_type == "json":
if title:
banner(title)
print(json.dumps(d, indent=4))
elif format_type == "csv":
with open(".temp.csv", "wb") as f:
w = csv.DictWriter(f, d.keys())
w.writeheader()
w.writerow(d)
elif format_type == "table":
if table_format == "key_list":
print(dict_key_list_table_printer(d, indexed=indexed))
return
if title:
print("+" + "-" * (len(title) - 2) + "+")
print(title)
print_data = []
if oneitem:
print_data = [d]
else:
for k in sorted(d):
d[k][' '] = k
print_data.append(d[k])
if header:
if firstheader:
headers = [firstheader] + headers
order = [' '] + order
if vertical_table:
print(array_dict_table_printer(print_data,
order=order,
header=headers,
vertical=True))
else:
print(array_dict_table_printer(print_data, order=order, header=headers))
if count:
c = len(print_data)
sentence = "count: {0}".format(c)
print(sentence)
print("+" + "-" * (len(sentence) - 2) + "+")
def get_command_list_refresh_default_setting(username):
'''
value to define the default behaviour of command list, if True, then refresh
before list as default
'''
try:
user_obj = cm_user()
except:
Console.error("There is a problem with "
"cm_user object initialization")
return False
defaults_data = user_obj.info(username)['defaults']
if "shell_command_list_refresh_default_setting" not in defaults_data or \
defaults_data["shell_command_list_refresh_default_setting"] in [None, 'none']:
defaults_data["shell_command_list_refresh_default_setting"] = True
user_obj.set_defaults(username, defaults_data)
return defaults_data["shell_command_list_refresh_default_setting"]
else:
return defaults_data["shell_command_list_refresh_default_setting"]
def get_vms_look_for(username,
cloudname,
servername=None,
serverid=None,
groupname=None,
prefix=None,
hostls=None,
getAll=False,
refresh=False):
'''
work as a filter to find the VMs you are looking for. Input the seaching conditions,
and returns a list of server ids that meet the condition
you cannot provide servername and serverid at the same time
you cannot provide prefix and hostlist at the same time
param hostls:: e.g. sample[1-3,18] => ['sample1', 'sample2', 'sample3', 'sample18']
param refresh:: refresh before filtering
param getAll:: if True, the function consider all VMs are selected before filtering.
if False, then none are selected before filtering
'''
# GroupManagement automatically loads mongodb connection.
# To avoid creating db connection by import, we moved this import inside of
# the function. This way allows us to use GroupManagement class only in this
# function. Other functions in this file won't load db connection by import.
# <NAME> - 12/1/2014
from cloudmesh.experiment.group import GroupManagement
# input checking
if servername and serverid:
Console.error("you cannot provide servername and serverid at the same time")
return False
if prefix and hostls:
Console.error("you cannot provide prefix and hostlist at the same time")
return False
if hostls:
try:
hostls_list = hostlist.expand_hostlist(hostls)
except:
Console.error("please check your hostlist input, right format e.g. sample[1-9,18]")
return False
# get server data
try:
mongo = cm_mongo()
except:
Console.error("There is a problem with the mongo server")
return False
if refresh:
mongo.activate(cm_user_id=username, names=[cloudname])
mongo.refresh(cm_user_id=username,
names=[cloudname],
types=['servers'])
if groupname:
vms_in_group_list = []
GroupManage = GroupManagement(username)
groups_list = GroupManage.get_groups_names_list()
if groupname not in groups_list:
return []
else:
vms_in_group_list = GroupManage.list_items_of_group(groupname, _type="VM")["VM"]
servers_dict = mongo.servers(
clouds=[cloudname], cm_user_id=username)[cloudname]
# search for qualified vms for each critera
res_d = {}
if servername:
res_d['servername'] = []
if serverid:
res_d['serverid'] = []
if groupname:
res_d['groupname'] = []
if prefix:
res_d['prefix'] = []
if hostls:
res_d['hostls'] = []
if getAll:
res_d['getAll'] = []
for k, v in servers_dict.iteritems():
if servername and servername == v['name']:
res_d['servername'].append(k)
if serverid and serverid == k:
res_d['serverid'].append(k)
if groupname:
if v['name'] in vms_in_group_list:
res_d['groupname'].append(k)
if prefix:
nametemp = server_name_analyzer(v['name'])
if prefix and prefix == nametemp[0]:
res_d['prefix'].append(k)
if hostls and v['name'] in hostls_list:
res_d['hostls'].append(k)
if getAll and v['cm_cloud'] == cloudname:
res_d['getAll'].append(k)
# -------------------------
# intersect the results
ls = res_d.values()
l = len(ls)
if l == 0:
res = []
elif l == 1:
res = ls[0]
else:
res = ls[0]
del ls[0]
for i in ls:
res = set(res) & set(i)
res = list(res)
return res
| [
1,
14550,
5372,
5407,
3168,
1550,
1985,
411,
6473,
12008,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
3166,
9570,
4467,
29882,
29889,
1792,
29889,
4912,
29918,
1792,
1053,
7477,
29918,
1792,
13,
5215,
4390,
13,
3166,
9570,
4467,
29882,
29918,
9435,
29889,
24051,
1053,
1409,
29918,
8977,
29918,
2371,
29918,
558,
1639,
29892,
9657,
29918,
1989,
29918,
1761,
29918,
2371,
29918,
558,
1639,
13,
3166,
9570,
4467,
29882,
29918,
3188,
29889,
4422,
1053,
289,
7310,
13,
5215,
11799,
13,
3166,
9920,
29941,
29889,
11058,
1053,
9405,
13,
5215,
3495,
1761,
13,
3166,
9570,
4467,
29882,
29889,
4912,
29918,
29885,
7443,
1053,
7477,
29918,
29885,
7443,
13,
3166,
9570,
4467,
29882,
29889,
4422,
29889,
8588,
292,
1053,
1923,
29918,
978,
29918,
24209,
3298,
13,
13,
13,
1964,
27998,
3352,
29918,
10593,
10192,
29918,
19094,
1299,
353,
6024,
2371,
742,
525,
3126,
742,
525,
7638,
2033,
13,
13,
13,
1753,
679,
29918,
4381,
29918,
2158,
29918,
4830,
29898,
6786,
1125,
13,
1678,
14550,
13,
1678,
278,
285,
1657,
291,
674,
1018,
304,
1284,
278,
2322,
14010,
883,
515,
4833,
29918,
4381,
29879,
13,
1678,
565,
4833,
29918,
4381,
29879,
756,
694,
2944,
525,
15903,
29918,
2158,
29918,
4830,
742,
278,
740,
674,
13,
1678,
731,
525,
15903,
29918,
2158,
29918,
4830,
29915,
353,
1591,
13,
1678,
14550,
13,
1678,
3402,
29918,
1853,
353,
6213,
13,
1678,
1404,
29918,
5415,
353,
7477,
29918,
1792,
580,
13,
1678,
1404,
1272,
353,
1404,
29918,
5415,
29889,
3888,
29898,
6786,
29897,
13,
1678,
1018,
29901,
13,
4706,
3402,
29918,
1853,
353,
1404,
1272,
1839,
4381,
29879,
16215,
15903,
29918,
2158,
29918,
4830,
2033,
13,
1678,
5174,
29901,
13,
4706,
1209,
13,
1678,
565,
3402,
29918,
1853,
297,
518,
8516,
29892,
525,
9290,
2033,
29901,
13,
4706,
1404,
1272,
1839,
4381,
29879,
16215,
15903,
29918,
2158,
29918,
4830,
2033,
353,
376,
2371,
29908,
13,
4706,
1404,
29918,
5415,
29889,
842,
29918,
4381,
29879,
29898,
6786,
29892,
1404,
1272,
1839,
4381,
29879,
11287,
13,
4706,
1404,
1272,
353,
1404,
29918,
5415,
29889,
3888,
29898,
6786,
29897,
13,
4706,
3402,
29918,
1853,
353,
1404,
1272,
1839,
4381,
29879,
16215,
15903,
29918,
2158,
29918,
4830,
2033,
13,
1678,
736,
3402,
29918,
1853,
13,
13,
13,
1753,
6473,
29918,
26381,
29918,
8977,
29918,
4905,
29898,
6786,
29892,
13,
462,
1669,
270,
29892,
13,
462,
1669,
396,
6755,
3402,
7522,
13,
462,
1669,
1596,
29918,
4830,
29922,
8516,
29892,
13,
462,
1669,
396,
6755,
1591,
3402,
565,
4312,
13,
462,
1669,
1591,
29918,
4830,
29922,
8516,
29892,
13,
462,
1669,
396,
901,
2702,
1591,
6273,
13,
462,
1669,
396,
448,
2683,
1378,
29899,
13,
462,
1669,
396,
363,
1591,
3402,
29901,
376,
1989,
29918,
1761,
29908,
13,
462,
1669,
27541,
29922,
8824,
29892,
13,
462,
1669,
396,
448,
2683,
1378,
29899,
13,
462,
1669,
937,
6672,
29922,
8516,
29892,
13,
462,
1669,
4839,
29922,
8516,
29892,
13,
462,
1669,
697,
667,
29922,
8824,
29892,
13,
462,
1669,
11408,
29918,
2371,
29922,
8824,
29892,
13,
462,
1669,
3611,
29922,
8516,
29892,
13,
462,
1669,
2302,
29922,
8824,
1125,
13,
1678,
14550,
13,
1678,
777,
6473,
8260,
1962,
263,
9657,
470,
1591,
29892,
445,
740,
881,
367,
13,
1678,
2000,
746,
8260,
526,
14010,
297,
1316,
982,
29889,
13,
1678,
565,
5642,
310,
4128,
4390,
322,
1591,
338,
2183,
29892,
278,
285,
1657,
291,
674,
1018,
13,
1678,
304,
1284,
278,
2322,
14010,
883,
515,
4833,
29918,
4381,
29879,
13,
1678,
565,
4833,
29918,
4381,
29879,
756,
694,
2944,
525,
15903,
29918,
2158,
29918,
4830,
742,
278,
740,
674,
13,
1678,
731,
525,
15903,
29918,
2158,
29918,
4830,
29915,
353,
1591,
13,
268,
13,
1678,
1828,
8952,
1057,
1404,
1178,
13,
1678,
1828,
270,
1057,
848,
304,
1596,
13,
1678,
1828,
1596,
29918,
4830,
1057,
1596,
3402,
29901,
1591,
29892,
4390,
29892,
11799,
13,
268,
13,
1678,
1828,
1591,
29918,
4830,
1057,
6755,
1591,
3402,
565,
4312,
29892,
23050,
24290,
27946,
29901,
13,
268,
13,
1678,
1134,
29896,
29901,
1820,
29918,
1761,
29901,
29871,
13,
462,
268,
13,
1678,
3544,
263,
9657,
297,
278,
883,
29901,
13,
1678,
426,
1989,
29896,
29901,
518,
1761,
29896,
1402,
13,
268,
1820,
29906,
29901,
518,
1761,
29906,
1402,
13,
268,
13035,
856,
13,
268,
1149,
13,
268,
891,
1820,
29896,
891,
1820,
29906,
891,
13,
268,
891,
301,
13,
268,
891,
474,
13,
268,
891,
269,
13,
268,
891,
260,
13,
268,
13,
1678,
22691,
6389,
29901,
27541,
29901,
3867,
2380,
13,
268,
13,
1678,
1828,
937,
6672,
1057,
8688,
363,
1591,
29892,
3867,
263,
5352,
1024,
363,
278,
13,
462,
4706,
937,
2944,
310,
1269,
1948,
29892,
1951,
278,
9657,
1838,
29915,
29873,
3867,
13,
462,
4706,
372,
13,
1678,
1828,
4839,
1057,
8688,
363,
1591,
29898,
392,
1304,
304,
4175,
1881,
9657,
511,
263,
1051,
310,
8857,
29892,
29871,
13,
462,
259,
8128,
1897,
1797,
29892,
321,
29889,
29887,
29889,
13,
462,
259,
5519,
29874,
29892,
29890,
1402,
518,
29883,
29892,
270,
1402,
2023,
13,
462,
259,
988,
525,
29874,
29915,
338,
278,
14010,
1897,
1024,
322,
525,
29890,
29915,
338,
278,
5352,
1024,
13,
462,
259,
297,
278,
9657,
13,
462,
259,
565,
366,
1016,
29915,
29873,
864,
304,
1735,
278,
4839,
1024,
541,
864,
304,
3013,
278,
13,
462,
259,
4839,
1797,
470,
4175,
278,
4452,
304,
1051,
29892,
363,
1269,
2944,
297,
278,
1051,
13,
462,
259,
366,
1122,
3867,
263,
1347,
470,
263,
1051,
411,
697,
2944,
2012,
310,
263,
1051,
310,
29871,
13,
462,
259,
1023,
4452,
13,
1678,
1828,
697,
667,
1057,
8688,
363,
1591,
29892,
12891,
278,
1881,
9657,
881,
367,
297,
1316,
13,
462,
1678,
883,
29901,
13,
462,
1678,
426,
29874,
29901,
426,
856,
1118,
289,
26254,
856,
11656,
988,
1269,
1014,
667,
338,
263,
1948,
13,
462,
1678,
565,
727,
338,
871,
697,
2944,
29892,
1881,
9657,
338,
278,
426,
856,
29913,
310,
278,
1014,
667,
13,
462,
1678,
2038,
13,
1678,
1828,
3611,
29901,
3867,
263,
3611,
363,
278,
1591,
13,
1678,
1828,
2302,
29901,
3867,
2302,
5235,
472,
278,
1095,
310,
278,
1591,
13,
1678,
14550,
13,
1678,
3402,
29918,
1853,
353,
6213,
13,
1678,
565,
1596,
29918,
4830,
29901,
13,
4706,
3402,
29918,
1853,
353,
1596,
29918,
4830,
13,
1678,
1683,
29901,
13,
4706,
3402,
29918,
1853,
353,
679,
29918,
4381,
29918,
2158,
29918,
4830,
29898,
6786,
29897,
13,
13,
1678,
565,
3402,
29918,
1853,
451,
297,
15149,
9806,
3352,
29918,
10593,
10192,
29918,
19094,
1299,
29901,
13,
4706,
9405,
29889,
2704,
703,
15866,
549,
1596,
3402,
29901,
426,
29900,
1836,
313,
24622,
1596,
3402,
29901,
426,
29896,
1800,
1642,
4830,
29898,
4830,
29918,
1853,
29892,
13,
462,
462,
462,
462,
462,
1678,
9162,
11393,
7122,
29898,
1964,
27998,
3352,
29918,
10593,
10192,
29918,
19094,
1299,
4961,
13,
4706,
736,
7700,
13,
13,
1678,
9066,
353,
6213,
13,
1678,
1797,
353,
6213,
13,
1678,
565,
4839,
29901,
13,
4706,
9066,
353,
5159,
13,
4706,
1797,
353,
5159,
13,
4706,
363,
474,
297,
4839,
29901,
13,
9651,
565,
338,
8758,
29898,
29875,
29892,
2362,
342,
5393,
1125,
13,
18884,
9066,
29889,
4397,
29898,
29875,
29897,
13,
18884,
1797,
29889,
4397,
29898,
29875,
29897,
13,
9651,
25342,
338,
8758,
29898,
29875,
29892,
1051,
1125,
13,
18884,
565,
7431,
29898,
29875,
29897,
1275,
29871,
29896,
29901,
13,
462,
1678,
9066,
29889,
4397,
29898,
29875,
29961,
29900,
2314,
13,
462,
1678,
1797,
29889,
4397,
29898,
29875,
29961,
29900,
2314,
13,
18884,
1683,
29901,
13,
462,
1678,
9066,
29889,
4397,
29898,
29875,
29961,
29900,
2314,
13,
462,
1678,
1797,
29889,
4397,
29898,
29875,
29961,
29896,
2314,
13,
9651,
1683,
29901,
13,
18884,
1596,
703,
11432,
29901,
4839,
5235,
338,
451,
1959,
1159,
13,
18884,
736,
7700,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
4706,
13,
1678,
396,
4175,
278,
1881,
9657,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
29871,
13,
1678,
565,
1797,
29901,
13,
4706,
716,
29918,
29881,
353,
6571,
13,
4706,
565,
697,
667,
29901,
13,
9651,
363,
2944,
297,
1797,
29901,
13,
18884,
565,
2944,
297,
270,
29901,
13,
462,
1678,
716,
29918,
29881,
29961,
667,
29962,
353,
270,
29961,
667,
29962,
13,
4706,
1683,
29901,
13,
9651,
363,
474,
297,
270,
29901,
13,
18884,
716,
29918,
29881,
29961,
29875,
29962,
353,
6571,
13,
18884,
363,
2944,
297,
1797,
29901,
13,
462,
1678,
565,
2944,
297,
270,
29961,
29875,
5387,
13,
462,
4706,
716,
29918,
29881,
29961,
29875,
3816,
667,
29962,
353,
270,
29961,
29875,
3816,
667,
29962,
13,
4706,
270,
353,
716,
29918,
29881,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
1378,
29899,
29871,
13,
13,
1678,
565,
3402,
29918,
1853,
1275,
376,
3126,
1115,
13,
4706,
565,
3611,
29901,
13,
9651,
289,
7310,
29898,
3257,
29897,
13,
4706,
1596,
29898,
3126,
29889,
29881,
17204,
29898,
29881,
29892,
29536,
29922,
29946,
876,
13,
13,
1678,
25342,
3402,
29918,
1853,
1275,
376,
7638,
1115,
13,
4706,
411,
1722,
17350,
7382,
29889,
7638,
613,
376,
29893,
29890,
1159,
408,
285,
29901,
13,
9651,
281,
353,
11799,
29889,
21533,
10507,
29898,
29888,
29892,
270,
29889,
8149,
3101,
13,
9651,
281,
29889,
3539,
6672,
580,
13,
9651,
281,
29889,
13236,
340,
29898,
29881,
29897,
13,
13,
1678,
25342,
3402,
29918,
1853,
1275,
376,
2371,
1115,
13,
4706,
565,
1591,
29918,
4830,
1275,
376,
1989,
29918,
1761,
1115,
13,
9651,
1596,
29898,
8977,
29918,
1989,
29918,
1761,
29918,
2371,
29918,
558,
1639,
29898,
29881,
29892,
27541,
29922,
2248,
287,
876,
13,
9651,
736,
13,
13,
4706,
565,
3611,
29901,
13,
9651,
1596,
703,
13578,
718,
11663,
29908,
334,
313,
2435,
29898,
3257,
29897,
448,
29871,
29906,
29897,
718,
15691,
1159,
13,
9651,
1596,
29898,
3257,
29897,
13,
13,
4706,
1596,
29918,
1272,
353,
5159,
13,
4706,
565,
697,
667,
29901,
13,
9651,
1596,
29918,
1272,
353,
518,
29881,
29962,
13,
4706,
1683,
29901,
13,
9651,
363,
413,
297,
12705,
29898,
29881,
1125,
13,
18884,
270,
29961,
29895,
22322,
525,
29962,
353,
413,
13,
18884,
1596,
29918,
1272,
29889,
4397,
29898,
29881,
29961,
29895,
2314,
13,
9651,
565,
4839,
29901,
13,
18884,
565,
937,
6672,
29901,
13,
462,
1678,
9066,
353,
518,
4102,
6672,
29962,
718,
9066,
13,
18884,
1797,
353,
6024,
525,
29962,
718,
1797,
13,
13,
4706,
565,
11408,
29918,
2371,
29901,
13,
9651,
1596,
29898,
2378,
29918,
8977,
29918,
2371,
29918,
558,
1639,
29898,
2158,
29918,
1272,
29892,
13,
462,
462,
965,
1797,
29922,
2098,
29892,
13,
462,
462,
965,
4839,
29922,
13662,
29892,
13,
462,
462,
965,
11408,
29922,
5574,
876,
13,
4706,
1683,
29901,
13,
9651,
1596,
29898,
2378,
29918,
8977,
29918,
2371,
29918,
558,
1639,
29898,
2158,
29918,
1272,
29892,
1797,
29922,
2098,
29892,
4839,
29922,
13662,
876,
13,
13,
4706,
565,
2302,
29901,
13,
9651,
274,
353,
7431,
29898,
2158,
29918,
1272,
29897,
13,
9651,
10541,
353,
376,
2798,
29901,
426,
29900,
29913,
1642,
4830,
29898,
29883,
29897,
13,
9651,
1596,
29898,
18616,
663,
29897,
13,
9651,
1596,
703,
13578,
718,
11663,
29908,
334,
313,
2435,
29898,
18616,
663,
29897,
448,
29871,
29906,
29897,
718,
15691,
1159,
13,
13,
13,
1753,
679,
29918,
6519,
29918,
1761,
29918,
22379,
29918,
4381,
29918,
26740,
29898,
6786,
1125,
13,
1678,
14550,
13,
1678,
995,
304,
4529,
278,
2322,
10468,
310,
1899,
1051,
29892,
565,
5852,
29892,
769,
11086,
13,
1678,
1434,
1051,
408,
2322,
13,
1678,
14550,
13,
1678,
1018,
29901,
13,
4706,
1404,
29918,
5415,
353,
7477,
29918,
1792,
580,
13,
1678,
5174,
29901,
13,
4706,
9405,
29889,
2704,
703,
8439,
338,
263,
1108,
411,
376,
13,
462,
418,
376,
4912,
29918,
1792,
1203,
17865,
1159,
13,
4706,
736,
7700,
13,
1678,
21274,
29918,
1272,
353,
1404,
29918,
5415,
29889,
3888,
29898,
6786,
29897,
1839,
4381,
29879,
2033,
13,
1678,
565,
376,
15903,
29918,
6519,
29918,
1761,
29918,
22379,
29918,
4381,
29918,
26740,
29908,
451,
297,
21274,
29918,
1272,
470,
320,
13,
462,
1678,
21274,
29918,
1272,
3366,
15903,
29918,
6519,
29918,
1761,
29918,
22379,
29918,
4381,
29918,
26740,
3108,
297,
518,
8516,
29892,
525,
9290,
2033,
29901,
13,
4706,
21274,
29918,
1272,
3366,
15903,
29918,
6519,
29918,
1761,
29918,
22379,
29918,
4381,
29918,
26740,
3108,
353,
5852,
13,
4706,
1404,
29918,
5415,
29889,
842,
29918,
4381,
29879,
29898,
6786,
29892,
21274,
29918,
1272,
29897,
13,
4706,
736,
21274,
29918,
1272,
3366,
15903,
29918,
6519,
29918,
1761,
29918,
22379,
29918,
4381,
29918,
26740,
3108,
13,
1678,
1683,
29901,
13,
4706,
736,
21274,
29918,
1272,
3366,
15903,
29918,
6519,
29918,
1761,
29918,
22379,
29918,
4381,
29918,
26740,
3108,
13,
13,
13,
1753,
679,
29918,
29894,
1516,
29918,
6914,
29918,
1454,
29898,
6786,
29892,
13,
462,
268,
9570,
978,
29892,
13,
462,
268,
1923,
978,
29922,
8516,
29892,
13,
462,
268,
1923,
333,
29922,
8516,
29892,
13,
462,
268,
2318,
978,
29922,
8516,
29892,
13,
462,
268,
10944,
29922,
8516,
29892,
13,
462,
268,
3495,
3137,
29922,
8516,
29892,
13,
462,
268,
679,
3596,
29922,
8824,
29892,
13,
462,
268,
11086,
29922,
8824,
1125,
13,
1678,
14550,
13,
1678,
664,
408,
263,
4175,
304,
1284,
278,
11400,
29879,
366,
526,
3063,
363,
29889,
10567,
278,
409,
9733,
5855,
29892,
13,
1678,
322,
3639,
263,
1051,
310,
1923,
18999,
393,
5870,
278,
4195,
13,
268,
13,
1678,
366,
2609,
3867,
1923,
978,
322,
1923,
333,
472,
278,
1021,
931,
13,
1678,
366,
2609,
3867,
10944,
322,
3495,
1761,
472,
278,
1021,
931,
13,
1678,
1828,
3495,
3137,
1057,
321,
29889,
29887,
29889,
4559,
29961,
29896,
29899,
29941,
29892,
29896,
29947,
29962,
1149,
6024,
11249,
29896,
742,
525,
11249,
29906,
742,
525,
11249,
29941,
742,
525,
11249,
29896,
29947,
2033,
13,
1678,
1828,
11086,
1057,
11086,
1434,
21166,
13,
1678,
1828,
679,
3596,
1057,
565,
5852,
29892,
278,
740,
2050,
599,
11400,
29879,
526,
4629,
1434,
21166,
29889,
13,
462,
259,
565,
7700,
29892,
769,
5642,
526,
4629,
1434,
21166,
13,
1678,
14550,
13,
1678,
396,
6431,
27107,
6336,
15376,
23290,
3957,
29889,
13,
1678,
396,
1763,
4772,
4969,
4833,
3957,
491,
1053,
29892,
591,
6153,
445,
1053,
2768,
310,
13,
1678,
396,
278,
740,
29889,
910,
982,
6511,
502,
304,
671,
6431,
27107,
770,
871,
297,
445,
13,
1678,
396,
740,
29889,
5901,
3168,
297,
445,
934,
2113,
29915,
29873,
2254,
4833,
3957,
491,
1053,
29889,
13,
1678,
396,
529,
5813,
29958,
448,
29871,
29896,
29906,
29914,
29896,
29914,
29906,
29900,
29896,
29946,
13,
1678,
515,
9570,
4467,
29882,
29889,
735,
15362,
29889,
2972,
1053,
6431,
27107,
13,
1678,
396,
1881,
8454,
29871,
13,
1678,
565,
1923,
978,
322,
1923,
333,
29901,
13,
4706,
9405,
29889,
2704,
703,
6293,
2609,
3867,
1923,
978,
322,
1923,
333,
472,
278,
1021,
931,
1159,
13,
4706,
736,
7700,
13,
1678,
565,
10944,
322,
3495,
3137,
29901,
13,
4706,
9405,
29889,
2704,
703,
6293,
2609,
3867,
10944,
322,
3495,
1761,
472,
278,
1021,
931,
1159,
13,
4706,
736,
7700,
13,
1678,
565,
3495,
3137,
29901,
13,
4706,
1018,
29901,
13,
9651,
3495,
3137,
29918,
1761,
353,
3495,
1761,
29889,
18837,
29918,
3069,
1761,
29898,
3069,
3137,
29897,
13,
4706,
5174,
29901,
13,
9651,
9405,
29889,
2704,
703,
552,
559,
1423,
596,
3495,
1761,
1881,
29892,
1492,
3402,
321,
29889,
29887,
29889,
4559,
29961,
29896,
29899,
29929,
29892,
29896,
29947,
29962,
1159,
13,
9651,
736,
7700,
13,
13,
1678,
396,
679,
1923,
848,
13,
1678,
1018,
29901,
13,
4706,
19476,
353,
7477,
29918,
29885,
7443,
580,
13,
1678,
5174,
29901,
13,
4706,
9405,
29889,
2704,
703,
8439,
338,
263,
1108,
411,
278,
19476,
1923,
1159,
13,
4706,
736,
7700,
13,
13,
1678,
565,
11086,
29901,
13,
4706,
19476,
29889,
11236,
403,
29898,
4912,
29918,
1792,
29918,
333,
29922,
6786,
29892,
2983,
11759,
9274,
978,
2314,
13,
4706,
19476,
29889,
22379,
29898,
4912,
29918,
1792,
29918,
333,
29922,
6786,
29892,
13,
462,
418,
2983,
11759,
9274,
978,
1402,
13,
462,
418,
4072,
29922,
1839,
643,
874,
11287,
13,
13,
1678,
565,
2318,
978,
29901,
13,
4706,
325,
1516,
29918,
262,
29918,
2972,
29918,
1761,
353,
5159,
13,
4706,
6431,
2517,
482,
353,
6431,
27107,
29898,
6786,
29897,
13,
4706,
6471,
29918,
1761,
353,
6431,
2517,
482,
29889,
657,
29918,
13155,
29918,
7039,
29918,
1761,
580,
13,
4706,
565,
2318,
978,
451,
297,
6471,
29918,
1761,
29901,
13,
9651,
736,
5159,
13,
4706,
1683,
29901,
13,
9651,
325,
1516,
29918,
262,
29918,
2972,
29918,
1761,
353,
6431,
2517,
482,
29889,
1761,
29918,
7076,
29918,
974,
29918,
2972,
29898,
2972,
978,
29892,
903,
1853,
543,
9219,
1159,
3366,
9219,
3108,
13,
13,
1678,
12424,
29918,
8977,
353,
19476,
29889,
643,
874,
29898,
13,
4706,
27091,
11759,
9274,
978,
1402,
7477,
29918,
1792,
29918,
333,
29922,
6786,
9601,
9274,
978,
29962,
13,
13,
1678,
396,
2740,
363,
18698,
325,
1516,
363,
1269,
3994,
1572,
13,
1678,
620,
29918,
29881,
353,
6571,
13,
1678,
565,
1923,
978,
29901,
13,
4706,
620,
29918,
29881,
1839,
2974,
978,
2033,
353,
5159,
13,
1678,
565,
1923,
333,
29901,
13,
4706,
620,
29918,
29881,
1839,
2974,
333,
2033,
353,
5159,
13,
1678,
565,
2318,
978,
29901,
13,
4706,
620,
29918,
29881,
1839,
2972,
978,
2033,
353,
5159,
13,
1678,
565,
10944,
29901,
13,
4706,
620,
29918,
29881,
1839,
13506,
2033,
353,
5159,
13,
1678,
565,
3495,
3137,
29901,
13,
4706,
620,
29918,
29881,
1839,
3069,
3137,
2033,
353,
5159,
13,
1678,
565,
679,
3596,
29901,
13,
4706,
620,
29918,
29881,
1839,
657,
3596,
2033,
353,
5159,
13,
13,
1678,
363,
413,
29892,
325,
297,
12424,
29918,
8977,
29889,
1524,
7076,
7295,
13,
4706,
565,
1923,
978,
322,
1923,
978,
1275,
325,
1839,
978,
2033,
29901,
13,
9651,
620,
29918,
29881,
1839,
2974,
978,
13359,
4397,
29898,
29895,
29897,
13,
4706,
565,
1923,
333,
322,
1923,
333,
1275,
413,
29901,
13,
9651,
620,
29918,
29881,
1839,
2974,
333,
13359,
4397,
29898,
29895,
29897,
13,
4706,
565,
2318,
978,
29901,
13,
9651,
565,
325,
1839,
978,
2033,
297,
325,
1516,
29918,
262,
29918,
2972,
29918,
1761,
29901,
13,
18884,
620,
29918,
29881,
1839,
2972,
978,
13359,
4397,
29898,
29895,
29897,
13,
4706,
565,
10944,
29901,
13,
9651,
6869,
300,
3451,
353,
1923,
29918,
978,
29918,
24209,
3298,
29898,
29894,
1839,
978,
11287,
13,
4706,
565,
10944,
322,
10944,
1275,
6869,
300,
3451,
29961,
29900,
5387,
13,
9651,
620,
29918,
29881,
1839,
13506,
13359,
4397,
29898,
29895,
29897,
13,
4706,
565,
3495,
3137,
322,
325,
1839,
978,
2033,
297,
3495,
3137,
29918,
1761,
29901,
13,
9651,
620,
29918,
29881,
1839,
3069,
3137,
13359,
4397,
29898,
29895,
29897,
13,
4706,
565,
679,
3596,
322,
325,
1839,
4912,
29918,
9274,
2033,
1275,
9570,
978,
29901,
13,
9651,
620,
29918,
29881,
1839,
657,
3596,
13359,
4397,
29898,
29895,
29897,
13,
1678,
396,
448,
2683,
1378,
13,
1678,
396,
25869,
278,
2582,
13,
1678,
19375,
353,
620,
29918,
29881,
29889,
5975,
580,
13,
1678,
301,
353,
7431,
29898,
3137,
29897,
13,
1678,
565,
301,
1275,
29871,
29900,
29901,
13,
4706,
620,
353,
5159,
13,
1678,
25342,
301,
1275,
29871,
29896,
29901,
13,
4706,
620,
353,
19375,
29961,
29900,
29962,
13,
1678,
1683,
29901,
13,
4706,
620,
353,
19375,
29961,
29900,
29962,
13,
4706,
628,
19375,
29961,
29900,
29962,
13,
4706,
363,
474,
297,
19375,
29901,
13,
9651,
620,
353,
731,
29898,
690,
29897,
669,
731,
29898,
29875,
29897,
13,
4706,
620,
353,
1051,
29898,
690,
29897,
13,
13,
1678,
736,
620,
13,
268,
13,
2
] |
exercicio27.py | monabrisa/-infosatc-lp-avaliativo-01 | 0 | 106631 | <filename>exercicio27.py
hectares = float(input("Digite o valor da área em hectares: "))
metros = hectares * 10000
print("{} hectares são {} m²".format(hectares, metros)) | [
1,
529,
9507,
29958,
735,
6269,
11088,
29906,
29955,
29889,
2272,
13,
354,
312,
5114,
353,
5785,
29898,
2080,
703,
14991,
568,
288,
16497,
1146,
17335,
953,
28834,
5114,
29901,
376,
876,
13,
28204,
353,
28834,
5114,
334,
29871,
29896,
29900,
29900,
29900,
29900,
13,
2158,
703,
8875,
28834,
5114,
12777,
6571,
286,
30088,
1642,
4830,
29898,
354,
312,
5114,
29892,
24086,
876,
2
] |
sppas/sppas/src/anndata/hierarchy.py | mirfan899/MTTS | 0 | 181746 | <reponame>mirfan899/MTTS
# -*- coding: UTF-8 -*-
"""
..
---------------------------------------------------------------------
___ __ __ __ ___
/ | \ | \ | \ / the automatic
\__ |__/ |__/ |___| \__ annotation and
\ | | | | \ analysis
___/ | | | | ___/ of speech
http://www.sppas.org/
Use of this software is governed by the GNU Public License, version 3.
SPPAS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SPPAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SPPAS. If not, see <http://www.gnu.org/licenses/>.
This banner notice must not be removed.
---------------------------------------------------------------------
anndata.hierarchy.py
~~~~~~~~~~~~~~~~~~~~
"""
from collections import OrderedDict
from .anndataexc import AnnDataTypeError
from .anndataexc import HierarchyAlignmentError
from .anndataexc import HierarchyAssociationError
from .anndataexc import HierarchyParentTierError
from .anndataexc import HierarchyChildTierError
from .anndataexc import HierarchyAncestorTierError
# ----------------------------------------------------------------------------
class sppasHierarchy(object):
"""Generic representation of a hierarchy between tiers.
:author: <NAME>
:organization: Laboratoire Parole et Langage, Aix-en-Provence, France
:contact: <EMAIL>
:license: GPL, v3
:copyright: Copyright (C) 2011-2018 <NAME>
Two types of hierarchy are considered:
- TimeAssociation:
the points of a child tier are all equals to the points of
a reference tier, as for example:
| parent: Words | l' | âne | est | là |
| child: Lemmas | le | âne | être | là |
- TimeAlignment:
the points of a child tier are all included in the set of
points of a reference tier, as for example:
| parent: Phonemes | l | a | n | e | l | a |
| child: Words | l' | âne | est | là |
|
| parent: Phonemes | l | a | n | e | l | a |
| child: Syllables | l.a | n.e | l.a |
In that example, notice that there's no hierarchy link between
"Tokens" and "Syllables" and notice that "Phonemes" is the
grand-parent of "Lemmas".
And the following obvious rules are applied:
- A child can have ONLY ONE parent!
- A parent can have as many children as wanted.
- A hierarchy is a tree, not a graph.
Todo is to consider a time association that is not fully completed:
| parent: Tokens | l' | âne | euh | euh | est | là | @ |
| child: Lemmas | le | âne | | être | là |
"""
types = {"TimeAssociation", "TimeAlignment"}
def __init__(self):
"""Create a new sppasHierarchy instance."""
super(sppasHierarchy, self).__init__()
# key = child tier ; value = tuple(parent, link_type)
self.__hierarchy = OrderedDict()
# -----------------------------------------------------------------------
# Getters
# -----------------------------------------------------------------------
def get_parent(self, child_tier):
"""Return the parent tier for a given child tier.
:param child_tier: (sppasTier) The child tier to found
"""
if child_tier not in self.__hierarchy.keys():
return None
parent, link = self.__hierarchy[child_tier]
return parent
# -----------------------------------------------------------------------
def get_hierarchy_type(self, child_tier):
"""Return the hierarchy type between a child tier and its parent.
:returns: (str) one of the hierarchy type
"""
if child_tier not in self.__hierarchy.keys():
return ""
parent, link = self.__hierarchy[child_tier]
return link
# -----------------------------------------------------------------------
def get_children(self, parent_tier, link_type=None):
"""Return the list of children of a tier, for a given type.
:param parent_tier: (sppasTier) The child tier to found
:param link_type: (str) The type of hierarchy
:returns: List of tiers
"""
if link_type is not None:
if link_type not in sppasHierarchy.types:
raise AnnDataTypeError(link_type,
"TimeAssociation, TimeAlignment")
children = []
for child_tier in self.__hierarchy.keys():
parent, link = self.__hierarchy[child_tier]
if parent is parent_tier:
if link_type is None or link_type == link:
children.append(child_tier)
return children
# -----------------------------------------------------------------------
def get_ancestors(self, child_tier):
"""Return all the direct ancestors of a tier.
:param child_tier: (sppasTier)
:returns: List of tiers with parent, grand-parent, grand-grand-parent...
"""
if child_tier not in self.__hierarchy.keys():
return []
ancestors = []
parent = self.get_parent(child_tier)
while parent is not None:
ancestors.append(parent)
parent = self.get_parent(parent)
return ancestors
# -----------------------------------------------------------------------
# Validators
# -----------------------------------------------------------------------
@staticmethod
def validate_time_alignment(parent_tier, child_tier):
"""Validate a time alignment hierarchy link between 2 tiers.
:param parent_tier: (sppasTier) The parent tier
:param child_tier: (sppasTier) The child tier to be linked to parent
:raises: HierarchyAlignmentError
"""
if parent_tier.is_superset(child_tier) is False:
raise HierarchyAlignmentError(parent_tier.get_name(),
child_tier.get_name())
# -----------------------------------------------------------------------
@staticmethod
def validate_time_association(parent_tier, child_tier):
"""Validate a time association hierarchy link between 2 tiers.
:param parent_tier: (sppasTier) The parent tier
:param child_tier: (sppasTier) The child tier to be linked to the parent
:raises: HierarchyAssociationError
"""
if parent_tier.is_superset(child_tier) is False and \
child_tier.is_superset(parent_tier) is False:
raise HierarchyAssociationError(parent_tier.get_name(),
child_tier.get_name())
# -----------------------------------------------------------------------
def validate_link(self, link_type, parent_tier, child_tier):
"""Validate a hierarchy link between 2 tiers.
:param link_type: (constant) One of the hierarchy types
:param parent_tier: (sppasTier) The parent tier
:param child_tier: (sppasTier) The child tier to be linked to parent
:raises: AnnDataTypeError, HierarchyParentTierError, \
HierarchyChildTierError, HierarchyAncestorTierError, \
HierarchyAlignmentError, HierarchyAssociationError
"""
if link_type not in sppasHierarchy.types:
raise AnnDataTypeError(link_type, "TimeAssociation, TimeAlignment")
# A child has only one parent
if child_tier in self.__hierarchy.keys():
parent, link = self.__hierarchy[child_tier]
raise HierarchyParentTierError(child_tier.get_name(),
link,
parent.get_name())
# A tier can't be its own child/parent
if parent_tier == child_tier:
raise HierarchyChildTierError(child_tier.get_name())
# Check for TimeAlignment
if link_type == "TimeAlignment":
sppasHierarchy.validate_time_alignment(parent_tier,
child_tier)
# Check for TimeAssociation
if link_type == "TimeAssociation":
sppasHierarchy.validate_time_association(parent_tier,
child_tier)
# No circular hierarchy allowed.
ancestors = self.get_ancestors(parent_tier)
family = []
for ancestor in ancestors:
uncles = self.get_children(ancestor)
family.extend(uncles)
family.extend(ancestors)
if child_tier in family:
raise HierarchyAncestorTierError(child_tier.get_name(),
parent_tier.get_name())
# -----------------------------------------------------------------------
# Setters
# -----------------------------------------------------------------------
def add_link(self, link_type, parent_tier, child_tier):
"""Validate and add a hierarchy link between 2 tiers.
:param link_type: (constant) One of the hierarchy types
:param parent_tier: (sppasTier) The parent tier
:param child_tier: (sppasTier) The child tier to be linked to parent
"""
self.validate_link(link_type, parent_tier, child_tier)
self.__hierarchy[child_tier] = (parent_tier, link_type)
# -----------------------------------------------------------------------
def remove_child(self, child_tier):
"""Remove a hierarchy link between a parent and a child.
:param child_tier: (sppasTier) The tier linked to a reference
"""
if child_tier in self.__hierarchy.keys():
del self.__hierarchy[child_tier]
# -----------------------------------------------------------------------
def remove_parent(self, parent_tier):
"""Remove all hierarchy links between a parent and its children.
:param parent_tier: (sppasTier) The parent tier
"""
to_remove = []
for child_tier in self.__hierarchy.keys():
parent, link = self.__hierarchy[child_tier]
if parent is parent_tier:
to_remove.append(child_tier)
for child_tier in to_remove:
del self.__hierarchy[child_tier]
# -----------------------------------------------------------------------
def remove_tier(self, tier):
"""Remove all occurrences of a tier inside the hierarchy.
:param tier: (sppasTier) The tier to remove as parent or child.
"""
to_remove = []
for child in self.__hierarchy.keys():
parent, link = self.__hierarchy[child]
if parent is tier or child is tier:
to_remove.append(child)
for child_tier in to_remove:
del self.__hierarchy[child_tier]
# -----------------------------------------------------------------------
def copy(self):
"""Return a deep copy of the hierarchy."""
h = sppasHierarchy()
for child_tier in self.__hierarchy:
parent_tier = self.__hierarchy[child_tier][0]
link_type = self.__hierarchy[child_tier][1]
h.add_link(link_type, parent_tier, child_tier)
return h
# -----------------------------------------------------------------------
# Automatic hierarchy
# -----------------------------------------------------------------------
@staticmethod
def infer_hierarchy_type(tier1, tier2):
"""Test if tier1 can be a parent tier for tier2.
:returns: One of hierarchy types or an empty string
"""
if tier1.is_superset(tier2) is False:
return ""
if tier2.is_superset(tier1) is True:
return "TimeAssociation"
return "TimeAlignment"
# ------------------------------------------------------------------------
# Overloads
# ------------------------------------------------------------------------
def __len__(self):
return len(self.__hierarchy)
def __iter__(self):
for a in self.__hierarchy:
yield a
| [
1,
529,
276,
1112,
420,
29958,
11038,
12963,
29947,
29929,
29929,
29914,
11490,
9375,
13,
29937,
448,
29930,
29899,
14137,
29901,
18351,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
1678,
6317,
13,
4706,
448,
2683,
2683,
2683,
2683,
807,
13,
308,
903,
1649,
259,
4770,
1678,
4770,
1678,
4770,
1678,
903,
1649,
13,
4706,
847,
268,
891,
29871,
320,
29871,
891,
29871,
320,
29871,
891,
29871,
320,
29871,
847,
795,
278,
18428,
13,
4706,
320,
1649,
259,
891,
1649,
29914,
29871,
891,
1649,
29914,
29871,
891,
22359,
29989,
320,
1649,
632,
17195,
322,
13,
965,
320,
29871,
891,
268,
891,
268,
891,
259,
891,
1678,
320,
632,
7418,
13,
4706,
903,
1649,
29914,
29871,
891,
268,
891,
268,
891,
259,
891,
903,
1649,
29914,
795,
310,
12032,
13,
13,
4706,
1732,
597,
1636,
29889,
29879,
407,
294,
29889,
990,
29914,
13,
13,
4706,
4803,
310,
445,
7047,
338,
4095,
287,
491,
278,
15143,
5236,
19245,
29892,
1873,
29871,
29941,
29889,
13,
13,
4706,
10937,
29925,
3289,
338,
3889,
7047,
29901,
366,
508,
2654,
391,
2666,
372,
322,
29914,
272,
6623,
13,
4706,
372,
1090,
278,
4958,
310,
278,
15143,
4593,
5236,
19245,
408,
6369,
491,
13,
4706,
278,
12362,
18540,
10606,
29892,
2845,
1873,
29871,
29941,
310,
278,
19245,
29892,
470,
13,
4706,
313,
271,
596,
2984,
29897,
738,
2678,
1873,
29889,
13,
13,
4706,
10937,
29925,
3289,
338,
13235,
297,
278,
4966,
393,
372,
674,
367,
5407,
29892,
13,
4706,
541,
399,
1806,
8187,
2692,
13764,
29979,
399,
1718,
29934,
13566,
29979,
29936,
1728,
1584,
278,
2411,
2957,
1370,
21867,
29891,
310,
13,
4706,
341,
1001,
3210,
13566,
2882,
6227,
11937,
470,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
29889,
29871,
2823,
278,
13,
4706,
15143,
4593,
5236,
19245,
363,
901,
4902,
29889,
13,
13,
4706,
887,
881,
505,
4520,
263,
3509,
310,
278,
15143,
4593,
5236,
19245,
13,
4706,
3412,
411,
10937,
29925,
3289,
29889,
960,
451,
29892,
1074,
529,
1124,
597,
1636,
29889,
18713,
29889,
990,
29914,
506,
11259,
3779,
29889,
13,
13,
4706,
910,
289,
7310,
8369,
1818,
451,
367,
6206,
29889,
13,
13,
4706,
448,
2683,
2683,
2683,
2683,
807,
13,
13,
1678,
385,
299,
532,
29889,
29882,
631,
12040,
29889,
2272,
13,
1678,
3695,
26594,
26594,
7377,
30022,
13,
13,
15945,
29908,
13,
13,
3166,
16250,
1053,
8170,
287,
21533,
13,
13,
3166,
869,
273,
299,
532,
735,
29883,
1053,
8081,
1469,
1542,
2392,
13,
3166,
869,
273,
299,
532,
735,
29883,
1053,
12433,
12040,
14658,
2392,
13,
3166,
869,
273,
299,
532,
735,
29883,
1053,
12433,
12040,
29254,
362,
2392,
13,
3166,
869,
273,
299,
532,
735,
29883,
1053,
12433,
12040,
9780,
29911,
631,
2392,
13,
3166,
869,
273,
299,
532,
735,
29883,
1053,
12433,
12040,
5938,
29911,
631,
2392,
13,
3166,
869,
273,
299,
532,
735,
29883,
1053,
12433,
12040,
2744,
29883,
342,
272,
29911,
631,
2392,
13,
13,
29937,
448,
2683,
2683,
2683,
2683,
1378,
5634,
13,
13,
13,
1990,
269,
407,
294,
29950,
631,
12040,
29898,
3318,
1125,
13,
1678,
9995,
15809,
8954,
310,
263,
21277,
1546,
260,
4285,
29889,
13,
268,
13,
1678,
584,
8921,
29901,
539,
529,
5813,
29958,
13,
1678,
584,
6388,
2133,
29901,
16715,
20141,
1459,
1772,
634,
10476,
482,
29892,
319,
861,
29899,
264,
29899,
1184,
29894,
663,
29892,
3444,
13,
1678,
584,
12346,
29901,
418,
529,
26862,
6227,
29958,
13,
1678,
584,
506,
1947,
29901,
418,
402,
7390,
29892,
325,
29941,
13,
1678,
584,
8552,
1266,
29901,
1678,
14187,
1266,
313,
29907,
29897,
29871,
29906,
29900,
29896,
29896,
29899,
29906,
29900,
29896,
29947,
29871,
529,
5813,
29958,
13,
268,
13,
1678,
7803,
4072,
310,
21277,
526,
5545,
29901,
13,
13,
418,
448,
5974,
29254,
362,
29901,
13,
4706,
278,
3291,
310,
263,
2278,
26485,
526,
599,
15743,
304,
278,
3291,
310,
13,
4706,
263,
3407,
26485,
29892,
408,
363,
1342,
29901,
13,
13,
9651,
891,
3847,
29901,
29871,
399,
4339,
418,
891,
301,
29915,
891,
29871,
19406,
484,
29871,
891,
707,
891,
29871,
18916,
259,
891,
13,
9651,
891,
2278,
29901,
259,
8836,
8247,
268,
891,
454,
891,
29871,
19406,
484,
29871,
891,
7848,
891,
29871,
18916,
29871,
891,
13,
13,
418,
448,
5974,
14658,
29901,
13,
4706,
278,
3291,
310,
263,
2278,
26485,
526,
599,
5134,
297,
278,
731,
310,
13,
4706,
3291,
310,
263,
3407,
26485,
29892,
408,
363,
1342,
29901,
13,
13,
9651,
891,
3847,
29901,
1963,
265,
13826,
1678,
891,
301,
29871,
891,
263,
891,
302,
891,
29871,
321,
29871,
891,
301,
891,
263,
891,
13,
9651,
891,
2278,
29901,
29871,
399,
4339,
539,
891,
301,
29915,
891,
29871,
19406,
484,
29871,
891,
707,
891,
29871,
18916,
259,
891,
13,
9651,
891,
13,
9651,
891,
3847,
29901,
1963,
265,
13826,
1678,
891,
301,
29871,
891,
263,
891,
302,
891,
29871,
321,
29871,
891,
301,
891,
263,
891,
13,
9651,
891,
2278,
29901,
29871,
8713,
645,
1849,
259,
891,
259,
301,
29889,
29874,
29871,
891,
29871,
302,
29889,
29872,
1678,
891,
259,
301,
29889,
29874,
891,
13,
13,
1678,
512,
393,
1342,
29892,
8369,
393,
727,
29915,
29879,
694,
21277,
1544,
1546,
13,
1678,
376,
29911,
554,
575,
29908,
322,
376,
29903,
15114,
1849,
29908,
322,
8369,
393,
376,
4819,
265,
13826,
29908,
338,
278,
13,
1678,
4595,
29899,
3560,
310,
376,
29931,
331,
8247,
1642,
13,
13,
1678,
1126,
278,
1494,
6924,
6865,
526,
7436,
29901,
13,
13,
4706,
448,
319,
2278,
508,
505,
6732,
16786,
6732,
29923,
3847,
29991,
13,
4706,
448,
319,
3847,
508,
505,
408,
1784,
4344,
408,
5131,
29889,
13,
4706,
448,
319,
21277,
338,
263,
5447,
29892,
451,
263,
3983,
29889,
13,
13,
1678,
7561,
29877,
338,
304,
2050,
263,
931,
15477,
393,
338,
451,
8072,
8676,
29901,
13,
13,
9651,
891,
3847,
29901,
29871,
11890,
575,
268,
891,
301,
29915,
891,
29871,
19406,
484,
29871,
891,
11878,
29882,
891,
11878,
29882,
891,
707,
891,
29871,
18916,
259,
891,
732,
891,
13,
9651,
891,
2278,
29901,
259,
8836,
8247,
268,
891,
454,
891,
29871,
19406,
484,
29871,
891,
965,
891,
7848,
891,
29871,
18916,
29871,
891,
13,
13,
1678,
9995,
13,
1678,
4072,
353,
8853,
2481,
29254,
362,
613,
376,
2481,
14658,
9092,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
9995,
4391,
263,
716,
269,
407,
294,
29950,
631,
12040,
2777,
1213,
15945,
13,
4706,
2428,
29898,
29879,
407,
294,
29950,
631,
12040,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
13,
4706,
396,
1820,
353,
2278,
26485,
2056,
995,
353,
18761,
29898,
3560,
29892,
1544,
29918,
1853,
29897,
13,
4706,
1583,
17255,
29882,
631,
12040,
353,
8170,
287,
21533,
580,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
1678,
396,
3617,
2153,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
679,
29918,
3560,
29898,
1311,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
11609,
278,
3847,
26485,
363,
263,
2183,
2278,
26485,
29889,
13,
13,
4706,
584,
3207,
2278,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
2278,
26485,
304,
1476,
13,
13,
4706,
9995,
13,
4706,
565,
2278,
29918,
29873,
631,
451,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
736,
6213,
13,
13,
4706,
3847,
29892,
1544,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
4706,
736,
3847,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
679,
29918,
29882,
631,
12040,
29918,
1853,
29898,
1311,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
11609,
278,
21277,
1134,
1546,
263,
2278,
26485,
322,
967,
3847,
29889,
13,
13,
4706,
584,
18280,
29901,
313,
710,
29897,
697,
310,
278,
21277,
1134,
13,
13,
4706,
9995,
13,
4706,
565,
2278,
29918,
29873,
631,
451,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
736,
5124,
13,
13,
4706,
3847,
29892,
1544,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
4706,
736,
1544,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
679,
29918,
11991,
29898,
1311,
29892,
3847,
29918,
29873,
631,
29892,
1544,
29918,
1853,
29922,
8516,
1125,
13,
4706,
9995,
11609,
278,
1051,
310,
4344,
310,
263,
26485,
29892,
363,
263,
2183,
1134,
29889,
13,
13,
4706,
584,
3207,
3847,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
2278,
26485,
304,
1476,
13,
4706,
584,
3207,
1544,
29918,
1853,
29901,
313,
710,
29897,
450,
1134,
310,
21277,
13,
4706,
584,
18280,
29901,
2391,
310,
260,
4285,
13,
13,
4706,
9995,
13,
4706,
565,
1544,
29918,
1853,
338,
451,
6213,
29901,
13,
9651,
565,
1544,
29918,
1853,
451,
297,
269,
407,
294,
29950,
631,
12040,
29889,
8768,
29901,
13,
18884,
12020,
8081,
1469,
1542,
2392,
29898,
2324,
29918,
1853,
29892,
29871,
13,
462,
462,
539,
376,
2481,
29254,
362,
29892,
5974,
14658,
1159,
13,
13,
4706,
4344,
353,
5159,
13,
4706,
363,
2278,
29918,
29873,
631,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
3847,
29892,
1544,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
9651,
565,
3847,
338,
3847,
29918,
29873,
631,
29901,
13,
18884,
565,
1544,
29918,
1853,
338,
6213,
470,
1544,
29918,
1853,
1275,
1544,
29901,
13,
462,
1678,
4344,
29889,
4397,
29898,
5145,
29918,
29873,
631,
29897,
13,
13,
4706,
736,
4344,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
679,
29918,
4564,
342,
943,
29898,
1311,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
11609,
599,
278,
1513,
19525,
943,
310,
263,
26485,
29889,
13,
13,
4706,
584,
3207,
2278,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
13,
4706,
584,
18280,
29901,
2391,
310,
260,
4285,
411,
3847,
29892,
4595,
29899,
3560,
29892,
4595,
29899,
27857,
29899,
3560,
856,
13,
13,
4706,
9995,
13,
4706,
565,
2278,
29918,
29873,
631,
451,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
736,
5159,
13,
13,
4706,
19525,
943,
353,
5159,
13,
4706,
3847,
353,
1583,
29889,
657,
29918,
3560,
29898,
5145,
29918,
29873,
631,
29897,
13,
4706,
1550,
3847,
338,
451,
6213,
29901,
13,
9651,
19525,
943,
29889,
4397,
29898,
3560,
29897,
13,
9651,
3847,
353,
1583,
29889,
657,
29918,
3560,
29898,
3560,
29897,
13,
13,
4706,
736,
19525,
943,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
1678,
396,
15758,
4097,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
12725,
29918,
2230,
29918,
2520,
358,
29898,
3560,
29918,
29873,
631,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
7211,
403,
263,
931,
22239,
21277,
1544,
1546,
29871,
29906,
260,
4285,
29889,
13,
13,
4706,
584,
3207,
3847,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
3847,
26485,
13,
4706,
584,
3207,
2278,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
2278,
26485,
304,
367,
9024,
304,
3847,
13,
4706,
584,
336,
4637,
29901,
12433,
12040,
14658,
2392,
13,
13,
4706,
9995,
13,
4706,
565,
3847,
29918,
29873,
631,
29889,
275,
29918,
12587,
24197,
29898,
5145,
29918,
29873,
631,
29897,
338,
7700,
29901,
13,
9651,
12020,
12433,
12040,
14658,
2392,
29898,
3560,
29918,
29873,
631,
29889,
657,
29918,
978,
3285,
13,
462,
462,
3986,
2278,
29918,
29873,
631,
29889,
657,
29918,
978,
3101,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
12725,
29918,
2230,
29918,
21264,
362,
29898,
3560,
29918,
29873,
631,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
7211,
403,
263,
931,
15477,
21277,
1544,
1546,
29871,
29906,
260,
4285,
29889,
13,
13,
4706,
584,
3207,
3847,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
3847,
26485,
13,
4706,
584,
3207,
2278,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
2278,
26485,
304,
367,
9024,
304,
278,
3847,
13,
4706,
584,
336,
4637,
29901,
12433,
12040,
29254,
362,
2392,
13,
13,
4706,
9995,
13,
4706,
565,
3847,
29918,
29873,
631,
29889,
275,
29918,
12587,
24197,
29898,
5145,
29918,
29873,
631,
29897,
338,
7700,
322,
320,
13,
965,
2278,
29918,
29873,
631,
29889,
275,
29918,
12587,
24197,
29898,
3560,
29918,
29873,
631,
29897,
338,
7700,
29901,
13,
9651,
12020,
12433,
12040,
29254,
362,
2392,
29898,
3560,
29918,
29873,
631,
29889,
657,
29918,
978,
3285,
13,
462,
462,
9651,
2278,
29918,
29873,
631,
29889,
657,
29918,
978,
3101,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
12725,
29918,
2324,
29898,
1311,
29892,
1544,
29918,
1853,
29892,
3847,
29918,
29873,
631,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
7211,
403,
263,
21277,
1544,
1546,
29871,
29906,
260,
4285,
29889,
13,
13,
4706,
584,
3207,
1544,
29918,
1853,
29901,
313,
23362,
29897,
3118,
310,
278,
21277,
4072,
13,
4706,
584,
3207,
3847,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
3847,
26485,
13,
4706,
584,
3207,
2278,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
2278,
26485,
304,
367,
9024,
304,
3847,
13,
4706,
584,
336,
4637,
29901,
8081,
1469,
1542,
2392,
29892,
12433,
12040,
9780,
29911,
631,
2392,
29892,
320,
13,
4706,
12433,
12040,
5938,
29911,
631,
2392,
29892,
12433,
12040,
2744,
29883,
342,
272,
29911,
631,
2392,
29892,
320,
13,
4706,
12433,
12040,
14658,
2392,
29892,
12433,
12040,
29254,
362,
2392,
13,
13,
4706,
9995,
13,
4706,
565,
1544,
29918,
1853,
451,
297,
269,
407,
294,
29950,
631,
12040,
29889,
8768,
29901,
13,
9651,
12020,
8081,
1469,
1542,
2392,
29898,
2324,
29918,
1853,
29892,
376,
2481,
29254,
362,
29892,
5974,
14658,
1159,
13,
13,
4706,
396,
319,
2278,
756,
871,
697,
3847,
13,
4706,
565,
2278,
29918,
29873,
631,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
3847,
29892,
1544,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
9651,
12020,
12433,
12040,
9780,
29911,
631,
2392,
29898,
5145,
29918,
29873,
631,
29889,
657,
29918,
978,
3285,
13,
462,
462,
965,
1544,
29892,
13,
462,
462,
965,
3847,
29889,
657,
29918,
978,
3101,
13,
13,
4706,
396,
319,
26485,
508,
29915,
29873,
367,
967,
1914,
2278,
29914,
3560,
13,
4706,
565,
3847,
29918,
29873,
631,
1275,
2278,
29918,
29873,
631,
29901,
13,
9651,
12020,
12433,
12040,
5938,
29911,
631,
2392,
29898,
5145,
29918,
29873,
631,
29889,
657,
29918,
978,
3101,
13,
13,
4706,
396,
5399,
363,
5974,
14658,
13,
4706,
565,
1544,
29918,
1853,
1275,
376,
2481,
14658,
1115,
13,
9651,
269,
407,
294,
29950,
631,
12040,
29889,
15480,
29918,
2230,
29918,
2520,
358,
29898,
3560,
29918,
29873,
631,
29892,
13,
462,
462,
462,
259,
2278,
29918,
29873,
631,
29897,
13,
13,
4706,
396,
5399,
363,
5974,
29254,
362,
13,
4706,
565,
1544,
29918,
1853,
1275,
376,
2481,
29254,
362,
1115,
13,
9651,
269,
407,
294,
29950,
631,
12040,
29889,
15480,
29918,
2230,
29918,
21264,
362,
29898,
3560,
29918,
29873,
631,
29892,
13,
462,
462,
462,
268,
2278,
29918,
29873,
631,
29897,
13,
13,
4706,
396,
1939,
19308,
21277,
6068,
29889,
13,
4706,
19525,
943,
353,
1583,
29889,
657,
29918,
4564,
342,
943,
29898,
3560,
29918,
29873,
631,
29897,
13,
4706,
3942,
353,
5159,
13,
4706,
363,
19525,
272,
297,
19525,
943,
29901,
13,
9651,
443,
7799,
353,
1583,
29889,
657,
29918,
11991,
29898,
4564,
342,
272,
29897,
13,
9651,
3942,
29889,
21843,
29898,
348,
7799,
29897,
13,
4706,
3942,
29889,
21843,
29898,
4564,
342,
943,
29897,
13,
4706,
565,
2278,
29918,
29873,
631,
297,
3942,
29901,
13,
9651,
12020,
12433,
12040,
2744,
29883,
342,
272,
29911,
631,
2392,
29898,
5145,
29918,
29873,
631,
29889,
657,
29918,
978,
3285,
13,
462,
462,
632,
3847,
29918,
29873,
631,
29889,
657,
29918,
978,
3101,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
1678,
396,
3789,
2153,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
788,
29918,
2324,
29898,
1311,
29892,
1544,
29918,
1853,
29892,
3847,
29918,
29873,
631,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
7211,
403,
322,
788,
263,
21277,
1544,
1546,
29871,
29906,
260,
4285,
29889,
13,
13,
4706,
584,
3207,
1544,
29918,
1853,
29901,
313,
23362,
29897,
3118,
310,
278,
21277,
4072,
13,
4706,
584,
3207,
3847,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
3847,
26485,
13,
4706,
584,
3207,
2278,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
2278,
26485,
304,
367,
9024,
304,
3847,
13,
13,
4706,
9995,
13,
4706,
1583,
29889,
15480,
29918,
2324,
29898,
2324,
29918,
1853,
29892,
3847,
29918,
29873,
631,
29892,
2278,
29918,
29873,
631,
29897,
13,
4706,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
353,
313,
3560,
29918,
29873,
631,
29892,
1544,
29918,
1853,
29897,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
3349,
29918,
5145,
29898,
1311,
29892,
2278,
29918,
29873,
631,
1125,
13,
4706,
9995,
15941,
263,
21277,
1544,
1546,
263,
3847,
322,
263,
2278,
29889,
13,
13,
4706,
584,
3207,
2278,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
26485,
9024,
304,
263,
3407,
13,
13,
4706,
9995,
13,
4706,
565,
2278,
29918,
29873,
631,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
628,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
3349,
29918,
3560,
29898,
1311,
29892,
3847,
29918,
29873,
631,
1125,
13,
4706,
9995,
15941,
599,
21277,
2988,
1546,
263,
3847,
322,
967,
4344,
29889,
13,
13,
4706,
584,
3207,
3847,
29918,
29873,
631,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
3847,
26485,
13,
13,
4706,
9995,
13,
4706,
304,
29918,
5992,
353,
5159,
13,
4706,
363,
2278,
29918,
29873,
631,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
3847,
29892,
1544,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
9651,
565,
3847,
338,
3847,
29918,
29873,
631,
29901,
13,
18884,
304,
29918,
5992,
29889,
4397,
29898,
5145,
29918,
29873,
631,
29897,
13,
13,
4706,
363,
2278,
29918,
29873,
631,
297,
304,
29918,
5992,
29901,
13,
9651,
628,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
3349,
29918,
29873,
631,
29898,
1311,
29892,
26485,
1125,
13,
4706,
9995,
15941,
599,
13920,
2063,
310,
263,
26485,
2768,
278,
21277,
29889,
13,
13,
4706,
584,
3207,
26485,
29901,
313,
29879,
407,
294,
29911,
631,
29897,
450,
26485,
304,
3349,
408,
3847,
470,
2278,
29889,
13,
13,
4706,
9995,
13,
4706,
304,
29918,
5992,
353,
5159,
13,
4706,
363,
2278,
297,
1583,
17255,
29882,
631,
12040,
29889,
8149,
7295,
13,
9651,
3847,
29892,
1544,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29962,
13,
9651,
565,
3847,
338,
26485,
470,
2278,
338,
26485,
29901,
13,
18884,
304,
29918,
5992,
29889,
4397,
29898,
5145,
29897,
13,
13,
4706,
363,
2278,
29918,
29873,
631,
297,
304,
29918,
5992,
29901,
13,
9651,
628,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
29962,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
822,
3509,
29898,
1311,
1125,
13,
4706,
9995,
11609,
263,
6483,
3509,
310,
278,
21277,
1213,
15945,
13,
4706,
298,
353,
269,
407,
294,
29950,
631,
12040,
580,
13,
13,
4706,
363,
2278,
29918,
29873,
631,
297,
1583,
17255,
29882,
631,
12040,
29901,
13,
9651,
3847,
29918,
29873,
631,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
3816,
29900,
29962,
13,
9651,
1544,
29918,
1853,
353,
1583,
17255,
29882,
631,
12040,
29961,
5145,
29918,
29873,
631,
3816,
29896,
29962,
13,
9651,
298,
29889,
1202,
29918,
2324,
29898,
2324,
29918,
1853,
29892,
3847,
29918,
29873,
631,
29892,
2278,
29918,
29873,
631,
29897,
13,
13,
4706,
736,
298,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
1678,
396,
15854,
2454,
21277,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
22158,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
10115,
29918,
29882,
631,
12040,
29918,
1853,
29898,
29873,
631,
29896,
29892,
26485,
29906,
1125,
13,
4706,
9995,
3057,
565,
26485,
29896,
508,
367,
263,
3847,
26485,
363,
26485,
29906,
29889,
13,
13,
4706,
584,
18280,
29901,
3118,
310,
21277,
4072,
470,
385,
4069,
1347,
13,
13,
4706,
9995,
13,
4706,
565,
26485,
29896,
29889,
275,
29918,
12587,
24197,
29898,
29873,
631,
29906,
29897,
338,
7700,
29901,
13,
9651,
736,
5124,
13,
13,
4706,
565,
26485,
29906,
29889,
275,
29918,
12587,
24197,
29898,
29873,
631,
29896,
29897,
338,
5852,
29901,
13,
9651,
736,
376,
2481,
29254,
362,
29908,
13,
13,
4706,
736,
376,
2481,
14658,
29908,
13,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
26589,
13,
1678,
396,
6811,
18132,
13,
1678,
396,
448,
2683,
2683,
2683,
2683,
26589,
13,
13,
1678,
822,
4770,
2435,
12035,
1311,
1125,
13,
4706,
736,
7431,
29898,
1311,
17255,
29882,
631,
12040,
29897,
13,
13,
1678,
822,
4770,
1524,
12035,
1311,
1125,
13,
4706,
363,
263,
297,
1583,
17255,
29882,
631,
12040,
29901,
13,
9651,
7709,
263,
13,
2
] |
Training/MOOC Tensorflow 2.0/BeiDa/class1/p22_random.uniform.py | church06/Pythons | 177 | 116321 | import tensorflow as tf
f = tf.random.uniform([2, 2], minval=0, maxval=1)
print("f:", f)
| [
1,
1053,
26110,
408,
15886,
13,
13,
29888,
353,
15886,
29889,
8172,
29889,
29590,
4197,
29906,
29892,
29871,
29906,
1402,
1375,
791,
29922,
29900,
29892,
4236,
791,
29922,
29896,
29897,
13,
2158,
703,
29888,
29901,
613,
285,
29897,
13,
2
] |
practice.py | precognition2018/SimpleFaceAPI | 0 | 79009 | import tensorflow as tf
x = tf.placeholder(tf.float32, [None,3])
x_data = [[1,2,3],[4,5,6]]
w = tf.Variable(tf.random_normal([3,2]))
b = tf.Variable(tf.random_normal([2,1]))
expr = tf.matmul(x,w) + b
sess = tf.Session()
sess.run(tf.global_variables_initializer())
print(x_data)
print(sess.run(w))
print(sess.run(b))
| [
1,
1053,
26110,
408,
15886,
13,
13,
29916,
353,
15886,
29889,
27074,
29898,
13264,
29889,
7411,
29941,
29906,
29892,
518,
8516,
29892,
29941,
2314,
13,
13,
29916,
29918,
1272,
353,
5519,
29896,
29892,
29906,
29892,
29941,
16272,
29946,
29892,
29945,
29892,
29953,
5262,
13,
13,
29893,
353,
15886,
29889,
16174,
29898,
13264,
29889,
8172,
29918,
8945,
4197,
29941,
29892,
29906,
12622,
13,
29890,
353,
15886,
29889,
16174,
29898,
13264,
29889,
8172,
29918,
8945,
4197,
29906,
29892,
29896,
12622,
13,
13,
13338,
353,
15886,
29889,
2922,
16109,
29898,
29916,
29892,
29893,
29897,
718,
289,
13,
13,
29879,
404,
353,
15886,
29889,
7317,
580,
13,
29879,
404,
29889,
3389,
29898,
13264,
29889,
10945,
29918,
20897,
29918,
11228,
3950,
3101,
13,
13,
13,
2158,
29898,
29916,
29918,
1272,
29897,
13,
2158,
29898,
29879,
404,
29889,
3389,
29898,
29893,
876,
13,
2158,
29898,
29879,
404,
29889,
3389,
29898,
29890,
876,
13,
2
] |
kge/ui/ui_manager.py | Fredkiss3/kge | 4 | 59616 | from typing import Callable, Set, Union, Type
import kge.inputs.keys as Keys
from kge.core import events
# from kge.core.component_system import ComponentSystem
# from kge.ui.canvas_renderer import CanvasRenderer
from kge.core.system import System
from kge.utils.vector import Vector
from kge.ui.canvas import Canvas, Clear, ClickDown, ClickUp, Hover, CanvasEvent
from kge.utils.spatial_hash import Box
class UIManager(System):
"""
A system that dispatch events to canvas
FIXME : CANVAS SHOULD NOT BE AFFECTED BY ZOOM
"""
_stated = set() # type: Set[Canvas]
_searchSize = Vector.Unit() / 32
def __enter__(self):
pass
def on_key_down(self, ev: events.KeyDown, dispatch: Callable):
# TODO : SHOULD DO SOMETHIN' (?)
if ev.key is Keys.Up:
pass
elif ev.key is Keys.Down:
pass
def on_key_up(self):
# TODO : SHOULD DO SOMETHIN' (?)
pass
def dispatch(self, ev:Union[events.MouseMotion, events.MouseDown, events.MouseUp], e: Union[Type[ClickUp], Type[ClickDown], Type[Hover]]):
# FIXME : IS THIS PERFORMANT ?
self.clear_canvases()
canvases = ev.scene.spatial_hash.search(ev.position, self._searchSize, Canvas)
# For testing if canvas collide with mouse
box = Box(ev.position, self._searchSize)
# Clear all canvases
for canvas in canvases: # type: Canvas
cbox = Box(canvas.position, canvas.scale)
if box.overlaps(cbox) and canvas.visible:
canvas.dispatch(e(zone=box))
self._stated.add(canvas)
def on_mouse_motion(self, ev: events.MouseMotion, dispatch: Callable):
self.dispatch(ev, Hover)
def clear_canvases(self):
for c in self._stated:
c.dispatch(Clear())
self._stated = set()
def on_mouse_down(self, ev: events.MouseDown, dispatch: Callable):
self.dispatch(ev, ClickDown)
def on_mouse_up(self, ev: events.MouseUp, dispatch: Callable):
self.dispatch(ev, ClickUp)
| [
1,
515,
19229,
1053,
8251,
519,
29892,
3789,
29892,
7761,
29892,
5167,
30004,
13,
30004,
13,
5215,
413,
479,
29889,
2080,
29879,
29889,
8149,
408,
4813,
952,
30004,
13,
3166,
413,
479,
29889,
3221,
1053,
4959,
30004,
13,
29937,
515,
413,
479,
29889,
3221,
29889,
9700,
29918,
5205,
1053,
15924,
3924,
30004,
13,
29937,
515,
413,
479,
29889,
1481,
29889,
15257,
29918,
9482,
261,
1053,
1815,
4428,
21323,
30004,
13,
3166,
413,
479,
29889,
3221,
29889,
5205,
1053,
2184,
30004,
13,
3166,
413,
479,
29889,
13239,
29889,
8111,
1053,
16510,
30004,
13,
3166,
413,
479,
29889,
1481,
29889,
15257,
1053,
1815,
4428,
29892,
17732,
29892,
16297,
6767,
29892,
16297,
3373,
29892,
379,
957,
29892,
1815,
4428,
2624,
30004,
13,
3166,
413,
479,
29889,
13239,
29889,
1028,
15238,
29918,
8568,
1053,
11773,
30004,
13,
30004,
13,
30004,
13,
1990,
3740,
3260,
29898,
3924,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
319,
1788,
393,
13916,
4959,
304,
10508,
30004,
13,
1678,
383,
6415,
2303,
584,
315,
2190,
29963,
3289,
317,
8187,
29965,
10249,
6058,
20700,
319,
4198,
13845,
3352,
6770,
796,
29949,
6488,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
903,
303,
630,
353,
731,
580,
396,
1134,
29901,
3789,
29961,
21960,
29962,
30004,
13,
1678,
903,
4478,
3505,
353,
16510,
29889,
8325,
580,
847,
29871,
29941,
29906,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
4770,
5893,
12035,
1311,
1125,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
1678,
822,
373,
29918,
1989,
29918,
3204,
29898,
1311,
29892,
3415,
29901,
4959,
29889,
2558,
6767,
29892,
13916,
29901,
8251,
519,
1125,
30004,
13,
4706,
396,
14402,
584,
317,
8187,
29965,
10249,
11662,
7791,
2303,
4690,
1177,
29915,
313,
7897,
30004,
13,
4706,
565,
3415,
29889,
1989,
338,
4813,
952,
29889,
3373,
29901,
30004,
13,
9651,
1209,
30004,
13,
4706,
25342,
3415,
29889,
1989,
338,
4813,
952,
29889,
6767,
29901,
30004,
13,
9651,
1209,
30004,
13,
30004,
13,
1678,
822,
373,
29918,
1989,
29918,
786,
29898,
1311,
1125,
30004,
13,
4706,
396,
14402,
584,
317,
8187,
29965,
10249,
11662,
7791,
2303,
4690,
1177,
29915,
313,
7897,
30004,
13,
4706,
1209,
30004,
13,
30004,
13,
30004,
13,
1678,
822,
13916,
29898,
1311,
29892,
3415,
29901,
19986,
29961,
13604,
29889,
14346,
29924,
8194,
29892,
4959,
29889,
14346,
6767,
29892,
4959,
29889,
14346,
3373,
1402,
321,
29901,
7761,
29961,
1542,
29961,
4164,
3373,
1402,
5167,
29961,
4164,
6767,
1402,
5167,
29961,
29950,
957,
5262,
1125,
30004,
13,
4706,
396,
383,
6415,
2303,
584,
8519,
3446,
3235,
349,
1001,
22051,
1529,
20321,
1577,
30004,
13,
4706,
1583,
29889,
8551,
29918,
3068,
29894,
2129,
26471,
13,
30004,
13,
4706,
508,
29894,
2129,
353,
3415,
29889,
24645,
29889,
1028,
15238,
29918,
8568,
29889,
4478,
29898,
5750,
29889,
3283,
29892,
1583,
3032,
4478,
3505,
29892,
1815,
4428,
8443,
13,
30004,
13,
4706,
396,
1152,
6724,
565,
10508,
784,
7459,
411,
9495,
30004,
13,
4706,
3800,
353,
11773,
29898,
5750,
29889,
3283,
29892,
29871,
1583,
3032,
4478,
3505,
8443,
13,
30004,
13,
4706,
396,
17732,
599,
508,
29894,
2129,
30004,
13,
4706,
363,
10508,
297,
508,
29894,
2129,
29901,
29871,
396,
1134,
29901,
1815,
4428,
30004,
13,
9651,
274,
1884,
353,
11773,
29898,
15257,
29889,
3283,
29892,
10508,
29889,
7052,
8443,
13,
9651,
565,
3800,
29889,
957,
14128,
29898,
29883,
1884,
29897,
322,
10508,
29889,
12872,
29901,
30004,
13,
18884,
10508,
29889,
13369,
29898,
29872,
29898,
8028,
29922,
1884,
876,
30004,
13,
18884,
1583,
3032,
303,
630,
29889,
1202,
29898,
15257,
8443,
13,
30004,
13,
1678,
822,
373,
29918,
15769,
29918,
29885,
8194,
29898,
1311,
29892,
3415,
29901,
4959,
29889,
14346,
29924,
8194,
29892,
13916,
29901,
8251,
519,
1125,
30004,
13,
4706,
1583,
29889,
13369,
29898,
5750,
29892,
379,
957,
8443,
13,
30004,
13,
1678,
822,
2821,
29918,
3068,
29894,
2129,
29898,
1311,
1125,
30004,
13,
4706,
363,
274,
297,
1583,
3032,
303,
630,
29901,
30004,
13,
9651,
274,
29889,
13369,
29898,
18759,
3101,
30004,
13,
30004,
13,
4706,
1583,
3032,
303,
630,
353,
731,
26471,
13,
30004,
13,
1678,
822,
373,
29918,
15769,
29918,
3204,
29898,
1311,
29892,
3415,
29901,
4959,
29889,
14346,
6767,
29892,
13916,
29901,
8251,
519,
1125,
30004,
13,
4706,
1583,
29889,
13369,
29898,
5750,
29892,
16297,
6767,
8443,
13,
30004,
13,
1678,
822,
373,
29918,
15769,
29918,
786,
29898,
1311,
29892,
3415,
29901,
4959,
29889,
14346,
3373,
29892,
13916,
29901,
8251,
519,
1125,
30004,
13,
4706,
1583,
29889,
13369,
29898,
5750,
29892,
16297,
3373,
8443,
13,
2
] |
code/tools/prepare_instance.py | santomon/taskonomy | 789 | 45333 | import subprocess
import os
def download_task_model(task):
m_path = os.path.join('/home/ubuntu/s3', "model_log_final", task,
"logs/model.permanent-ckpt")
dirs, fname = os.path.split(m_path)
dst_dir = dirs.replace('/home/ubuntu/s3', "s3://taskonomy-unpacked-oregon")
tmp_path = "/home/ubuntu/temp/{}".format(task)
subprocess.call('mkdir -p {}'.format(tmp_path), shell=True)
tmp_fname = os.path.join(tmp_path, fname)
aws_cp_command = "aws s3 cp {}.data-00000-of-00001 {}".format(os.path.join(dst_dir, fname), tmp_path)
subprocess.call(aws_cp_command, shell=True)
aws_cp_command = "aws s3 cp {}.meta {}".format(os.path.join(dst_dir, fname), tmp_path)
subprocess.call(aws_cp_command, shell=True)
aws_cp_command = "aws s3 cp {}.index {}".format(os.path.join(dst_dir, fname), tmp_path)
subprocess.call(aws_cp_command, shell=True)
list_of_tasks = 'autoencoder curvature denoise edge2d edge3d \
keypoint2d keypoint3d colorization jigsaw \
reshade rgb2depth rgb2mist rgb2sfnorm \
room_layout segment25d segment2d vanishing_point_well_defined \
segmentsemantic_rb class_1000 class_places impainting_whole'
list_of_tasks = 'impainting_whole'
list_of_tasks = list_of_tasks.split()
for t in list_of_tasks:
download_task_model(t)
| [
1,
1053,
1014,
5014,
13,
5215,
2897,
13,
1753,
5142,
29918,
7662,
29918,
4299,
29898,
7662,
1125,
13,
1678,
286,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
11219,
5184,
29914,
8767,
29914,
29879,
29941,
742,
376,
4299,
29918,
1188,
29918,
8394,
613,
3414,
29892,
13,
462,
462,
268,
376,
20756,
29914,
4299,
29889,
546,
1171,
296,
29899,
384,
415,
1159,
29871,
13,
1678,
4516,
29879,
29892,
285,
978,
353,
2897,
29889,
2084,
29889,
5451,
29898,
29885,
29918,
2084,
29897,
13,
1678,
29743,
29918,
3972,
353,
4516,
29879,
29889,
6506,
11219,
5184,
29914,
8767,
29914,
29879,
29941,
742,
376,
29879,
29941,
597,
7662,
21926,
29899,
348,
4058,
287,
29899,
272,
387,
265,
1159,
13,
1678,
13128,
29918,
2084,
353,
5591,
5184,
29914,
8767,
29914,
7382,
29914,
8875,
1642,
4830,
29898,
7662,
29897,
13,
1678,
1014,
5014,
29889,
4804,
877,
11256,
3972,
448,
29886,
6571,
4286,
4830,
29898,
7050,
29918,
2084,
511,
6473,
29922,
5574,
29897,
13,
1678,
13128,
29918,
29888,
978,
353,
2897,
29889,
2084,
29889,
7122,
29898,
7050,
29918,
2084,
29892,
285,
978,
29897,
13,
1678,
25879,
29918,
6814,
29918,
6519,
353,
376,
10467,
269,
29941,
21447,
426,
1836,
1272,
29899,
29900,
29900,
29900,
29900,
29900,
29899,
974,
29899,
29900,
29900,
29900,
29900,
29896,
6571,
1642,
4830,
29898,
359,
29889,
2084,
29889,
7122,
29898,
22992,
29918,
3972,
29892,
285,
978,
511,
13128,
29918,
2084,
29897,
13,
1678,
1014,
5014,
29889,
4804,
29898,
10467,
29918,
6814,
29918,
6519,
29892,
6473,
29922,
5574,
29897,
13,
1678,
25879,
29918,
6814,
29918,
6519,
353,
376,
10467,
269,
29941,
21447,
426,
1836,
7299,
6571,
1642,
4830,
29898,
359,
29889,
2084,
29889,
7122,
29898,
22992,
29918,
3972,
29892,
285,
978,
511,
13128,
29918,
2084,
29897,
13,
1678,
1014,
5014,
29889,
4804,
29898,
10467,
29918,
6814,
29918,
6519,
29892,
6473,
29922,
5574,
29897,
13,
1678,
25879,
29918,
6814,
29918,
6519,
353,
376,
10467,
269,
29941,
21447,
426,
1836,
2248,
6571,
1642,
4830,
29898,
359,
29889,
2084,
29889,
7122,
29898,
22992,
29918,
3972,
29892,
285,
978,
511,
13128,
29918,
2084,
29897,
13,
1678,
1014,
5014,
29889,
4804,
29898,
10467,
29918,
6814,
29918,
6519,
29892,
6473,
29922,
5574,
29897,
13,
268,
13,
1761,
29918,
974,
29918,
20673,
353,
525,
6921,
3977,
6119,
27686,
1535,
972,
29877,
895,
7636,
29906,
29881,
7636,
29941,
29881,
320,
13,
1989,
3149,
29906,
29881,
1820,
3149,
29941,
29881,
2927,
2133,
432,
23379,
1450,
320,
13,
3781,
1943,
15552,
29890,
29906,
19488,
15552,
29890,
29906,
29885,
391,
15552,
29890,
29906,
4668,
12324,
320,
13,
8345,
29918,
2680,
10768,
29906,
29945,
29881,
10768,
29906,
29881,
1109,
14424,
29918,
3149,
29918,
5872,
29918,
12119,
320,
13,
10199,
1860,
331,
7716,
29918,
6050,
770,
29918,
29896,
29900,
29900,
29900,
770,
29918,
29886,
6048,
2411,
475,
1259,
29918,
15970,
280,
29915,
13,
1761,
29918,
974,
29918,
20673,
353,
525,
6574,
475,
1259,
29918,
15970,
280,
29915,
13,
1761,
29918,
974,
29918,
20673,
353,
1051,
29918,
974,
29918,
20673,
29889,
5451,
580,
13,
1454,
260,
297,
1051,
29918,
974,
29918,
20673,
29901,
13,
1678,
5142,
29918,
7662,
29918,
4299,
29898,
29873,
29897,
13,
2
] |
textprivacy/__init__.py | KennethEnevoldsen/DaAnonymization | 12 | 95417 | """Top-level package for TextAnonymization."""
__author__ = """<NAME>"""
__email__ = "<EMAIL>"
__version__ = "0.1.0"
from textprivacy import utils
from textprivacy.textanonymization import TextAnonymizer
from textprivacy.textpseudonymization import TextPseudonymizer
| [
1,
9995,
7031,
29899,
5563,
3577,
363,
3992,
2744,
4735,
2133,
1213,
15945,
13,
13,
1649,
8921,
1649,
353,
9995,
29966,
5813,
11903,
15945,
13,
1649,
5269,
1649,
353,
9872,
26862,
6227,
11903,
13,
1649,
3259,
1649,
353,
376,
29900,
29889,
29896,
29889,
29900,
29908,
13,
3166,
1426,
22534,
4135,
1053,
3667,
29879,
13,
3166,
1426,
22534,
4135,
29889,
726,
273,
4735,
2133,
1053,
3992,
2744,
4735,
3950,
13,
3166,
1426,
22534,
4135,
29889,
726,
27358,
566,
4735,
2133,
1053,
3992,
29925,
344,
566,
4735,
3950,
13,
2
] |
annotations.py | jtextor/immunet | 1 | 170518 | import json
import gzip
from pathlib import Path
# JSON KEYS
DATASET_ID_JSON_KEY = "ds_id"
DATASET_TYPE_JSON_KEY = "type"
SLIDE_ID_JSON_KEY = "slide_id"
TILE_ID_JSON_KEY = "tile_id"
ANNOT_TYPE_JSON_KEY = "type"
ANNOT_X_JSON_KEY = "x"
ANNOT_Y_JSON_KEY = "y"
ANNOT_POSITIVITY_JSON_KEY = "positivity"
SLIDES_JSON_KEY = "slides"
TILES_JSON_KEY = "tiles"
ANNOTATIONS_JSON_KEY = "annotations"
class Dataset:
def __init__(self, dict):
self.id = dict[DATASET_ID_JSON_KEY]
self.type = dict[DATASET_TYPE_JSON_KEY] if DATASET_TYPE_JSON_KEY in dict else None
self.slides = []
if SLIDES_JSON_KEY in dict:
slide_dicts = dict[SLIDES_JSON_KEY]
for slide_dict in slide_dicts:
self.add_slide(Slide(slide_dict))
def add_slide(self, slide):
slide.dataset_id = self.id
for tile in slide.tiles:
tile.dataset_id = self.id
self.slides.append(slide)
@property
def tiles(self):
_tiles = []
for slide in self.slides:
_tiles += slide.tiles
return _tiles
class Slide:
def __init__(self, dict):
self.id = dict[SLIDE_ID_JSON_KEY]
self.dataset_id = None
self.tiles = []
if TILES_JSON_KEY in dict:
tile_dicts = dict[TILES_JSON_KEY]
for tile_dict in tile_dicts:
self.add_tile(Tile(tile_dict))
def add_tile(self, tile):
tile.slice_id = self.id
self.tiles.append(tile)
class Tile:
def __init__(self, dict):
self.id = dict[TILE_ID_JSON_KEY]
self.dataset_id = None
self.slice_id = None
self.annotations = []
if ANNOTATIONS_JSON_KEY in dict:
self.annotations = dict[ANNOTATIONS_JSON_KEY]
def build_path(self, relative_path, file_name="components.tiff"):
if self.dataset_id is None or self.slice_id is None:
return None
return relative_path / self.dataset_id / self.slice_id / self.id / file_name
def load_tile_annotations(annotations_path):
with gzip.open(annotations_path) as f:
annotations = json.loads(f.read())
datasets = [Dataset(dataset_dict) for dataset_dict in annotations]
tiles = []
for dataset in datasets:
tiles += dataset.tiles
return tiles
| [
1,
1053,
4390,
13,
5215,
330,
7554,
13,
3166,
2224,
1982,
1053,
10802,
13,
13,
29937,
4663,
14636,
29903,
13,
25832,
8127,
29911,
29918,
1367,
29918,
7249,
29918,
10818,
353,
376,
6289,
29918,
333,
29908,
13,
25832,
8127,
29911,
29918,
11116,
29918,
7249,
29918,
10818,
353,
376,
1853,
29908,
13,
12750,
22027,
29918,
1367,
29918,
7249,
29918,
10818,
353,
376,
19265,
29918,
333,
29908,
13,
24301,
1307,
29918,
1367,
29918,
7249,
29918,
10818,
353,
376,
29873,
488,
29918,
333,
29908,
13,
2190,
12256,
29918,
11116,
29918,
7249,
29918,
10818,
353,
376,
1853,
29908,
13,
2190,
12256,
29918,
29990,
29918,
7249,
29918,
10818,
353,
376,
29916,
29908,
13,
2190,
12256,
29918,
29979,
29918,
7249,
29918,
10818,
353,
376,
29891,
29908,
13,
2190,
12256,
29918,
24815,
1806,
5667,
11937,
29918,
7249,
29918,
10818,
353,
376,
1066,
24858,
29908,
13,
12750,
1367,
2890,
29918,
7249,
29918,
10818,
353,
376,
2536,
2247,
29908,
13,
24301,
17101,
29918,
7249,
29918,
10818,
353,
376,
1376,
267,
29908,
13,
2190,
12256,
8098,
29903,
29918,
7249,
29918,
10818,
353,
376,
6735,
800,
29908,
13,
13,
13,
1990,
13373,
24541,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9657,
1125,
13,
4706,
1583,
29889,
333,
353,
9657,
29961,
25832,
8127,
29911,
29918,
1367,
29918,
7249,
29918,
10818,
29962,
13,
4706,
1583,
29889,
1853,
353,
9657,
29961,
25832,
8127,
29911,
29918,
11116,
29918,
7249,
29918,
10818,
29962,
565,
27640,
8127,
29911,
29918,
11116,
29918,
7249,
29918,
10818,
297,
9657,
1683,
6213,
13,
4706,
1583,
29889,
2536,
2247,
353,
5159,
13,
4706,
565,
27146,
1367,
2890,
29918,
7249,
29918,
10818,
297,
9657,
29901,
13,
9651,
20343,
29918,
8977,
29879,
353,
9657,
29961,
12750,
1367,
2890,
29918,
7249,
29918,
10818,
29962,
13,
9651,
363,
20343,
29918,
8977,
297,
20343,
29918,
8977,
29879,
29901,
13,
18884,
1583,
29889,
1202,
29918,
19265,
29898,
29903,
7459,
29898,
19265,
29918,
8977,
876,
13,
13,
1678,
822,
788,
29918,
19265,
29898,
1311,
29892,
20343,
1125,
13,
4706,
20343,
29889,
24713,
29918,
333,
353,
1583,
29889,
333,
13,
13,
4706,
363,
25900,
297,
20343,
29889,
1376,
267,
29901,
13,
9651,
25900,
29889,
24713,
29918,
333,
353,
1583,
29889,
333,
13,
13,
4706,
1583,
29889,
2536,
2247,
29889,
4397,
29898,
19265,
29897,
13,
13,
1678,
732,
6799,
13,
1678,
822,
260,
5475,
29898,
1311,
1125,
13,
4706,
903,
1376,
267,
353,
5159,
13,
4706,
363,
20343,
297,
1583,
29889,
2536,
2247,
29901,
13,
9651,
903,
1376,
267,
4619,
20343,
29889,
1376,
267,
13,
13,
4706,
736,
903,
1376,
267,
13,
13,
13,
1990,
317,
7459,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9657,
1125,
13,
4706,
1583,
29889,
333,
353,
9657,
29961,
12750,
22027,
29918,
1367,
29918,
7249,
29918,
10818,
29962,
13,
4706,
1583,
29889,
24713,
29918,
333,
353,
6213,
13,
4706,
1583,
29889,
1376,
267,
353,
5159,
13,
13,
4706,
565,
323,
29902,
17101,
29918,
7249,
29918,
10818,
297,
9657,
29901,
13,
9651,
25900,
29918,
8977,
29879,
353,
9657,
29961,
24301,
17101,
29918,
7249,
29918,
10818,
29962,
13,
9651,
363,
25900,
29918,
8977,
297,
25900,
29918,
8977,
29879,
29901,
13,
18884,
1583,
29889,
1202,
29918,
29873,
488,
29898,
29911,
488,
29898,
29873,
488,
29918,
8977,
876,
13,
13,
1678,
822,
788,
29918,
29873,
488,
29898,
1311,
29892,
25900,
1125,
13,
4706,
25900,
29889,
18337,
29918,
333,
353,
1583,
29889,
333,
13,
4706,
1583,
29889,
1376,
267,
29889,
4397,
29898,
29873,
488,
29897,
13,
13,
13,
1990,
323,
488,
29901,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
9657,
1125,
13,
4706,
1583,
29889,
333,
353,
9657,
29961,
24301,
1307,
29918,
1367,
29918,
7249,
29918,
10818,
29962,
13,
4706,
1583,
29889,
24713,
29918,
333,
353,
6213,
13,
4706,
1583,
29889,
18337,
29918,
333,
353,
6213,
13,
13,
4706,
1583,
29889,
6735,
800,
353,
5159,
13,
4706,
565,
319,
10262,
2891,
8098,
29903,
29918,
7249,
29918,
10818,
297,
9657,
29901,
13,
9651,
1583,
29889,
6735,
800,
353,
9657,
29961,
2190,
12256,
8098,
29903,
29918,
7249,
29918,
10818,
29962,
13,
13,
1678,
822,
2048,
29918,
2084,
29898,
1311,
29892,
6198,
29918,
2084,
29892,
934,
29918,
978,
543,
14036,
29889,
29873,
2593,
29908,
1125,
13,
4706,
565,
1583,
29889,
24713,
29918,
333,
338,
6213,
470,
1583,
29889,
18337,
29918,
333,
338,
6213,
29901,
13,
9651,
736,
6213,
13,
13,
4706,
736,
6198,
29918,
2084,
847,
1583,
29889,
24713,
29918,
333,
847,
1583,
29889,
18337,
29918,
333,
847,
1583,
29889,
333,
847,
934,
29918,
978,
13,
13,
13,
1753,
2254,
29918,
29873,
488,
29918,
6735,
800,
29898,
6735,
800,
29918,
2084,
1125,
13,
13,
1678,
411,
330,
7554,
29889,
3150,
29898,
6735,
800,
29918,
2084,
29897,
408,
285,
29901,
13,
4706,
25495,
353,
4390,
29889,
18132,
29898,
29888,
29889,
949,
3101,
13,
13,
1678,
20035,
353,
518,
16390,
24541,
29898,
24713,
29918,
8977,
29897,
363,
8783,
29918,
8977,
297,
25495,
29962,
13,
13,
1678,
260,
5475,
353,
5159,
13,
1678,
363,
8783,
297,
20035,
29901,
13,
4706,
260,
5475,
4619,
8783,
29889,
1376,
267,
13,
13,
1678,
736,
260,
5475,
13,
2
] |
ImageProcessingScripts/Image Contours Co-ordinates/image_contours_co-ordinates.py | sumitsoni0907/Awesome_Python_Scripts | 1 | 117357 | <reponame>sumitsoni0907/Awesome_Python_Scripts
# Image Contours Co-ordinates
# imported necessary library
import tkinter
from tkinter import *
import tkinter as tk
import tkinter.messagebox as mbox
from tkinter import ttk
from tkinter import filedialog
from PIL import ImageTk, Image
import cv2
import numpy as np
# Main Window & Configuration
window = tk.Tk() # created a tkinter gui window frame
window.title("Image Contours Co-ordinates") # title given is "DICTIONARY"
window.geometry('1000x700')
# top label
start1 = tk.Label(text = "Image Contours Co-ordinates", font=("Arial", 50), fg="magenta") # same way bg
start1.place(x = 50, y = 10)
def start_fun():
window.destroy()
# start button created
startb = Button(window, text="START",command=start_fun,font=("Arial", 25), bg = "orange", fg = "blue", borderwidth=3, relief="raised")
startb.place(x =155 , y =580 )
# image on the main window
path = "Images/front.jpg"
# Creates a Tkinter-compatible photo image, which can be used everywhere Tkinter expects an image object.
img1 = ImageTk.PhotoImage(Image.open(path))
# The Label widget is a standard Tkinter widget used to display a text or image on the screen.
panel = tk.Label(window, image = img1)
panel.place(x = 125, y = 120)
# function created for exiting
def exit_win():
if mbox.askokcancel("Exit", "Do you want to exit?"):
window.destroy()
# exit button created
exitb = Button(window, text="EXIT",command=exit_win,font=("Arial", 25), bg = "red", fg = "blue", borderwidth=3, relief="raised")
exitb.place(x =720 , y = 580 )
window.protocol("WM_DELETE_WINDOW", exit_win)
window.mainloop()
# Main Window & Configuration
window1 = tk.Tk() # created a tkinter gui window frame
window1.title("Image Contours Co-ordinates")
window1.geometry('1000x700')
# function to open file
def open_file():
global filename
filename = filedialog.askopenfilename(title="Select file")
# print(filename)
path_text.delete("1.0", "end")
path_text.insert(END, filename)
# function to show original video
def original_fun():
global filename
img = cv2.imread(filename, 1)
cv2.imshow("Original Image", img)
# function to show grayscale video
def contours_fun():
global filename
# Reading image
font = cv2.FONT_HERSHEY_TRIPLEX
img2 = cv2.imread(filename, cv2.IMREAD_COLOR)
# Reading same image in another variable and converting to gray scale.
img = cv2.imread(filename, cv2.IMREAD_GRAYSCALE)
# Converting image to a binary image ( black and white only image).
_, threshold = cv2.threshold(img, 110, 255, cv2.THRESH_BINARY)
# Detecting contours in image.
contours, _ = cv2.findContours(threshold, cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
# Going through every contours found in the image.
for cnt in contours:
approx = cv2.approxPolyDP(cnt, 0.009 * cv2.arcLength(cnt, True), True)
# draws boundary of contours.
cv2.drawContours(img2, [approx], 0, (0, 0, 255), 2)
# Used to flatted the array containing the co-ordinates of the vertices.
n = approx.ravel()
i = 0
for j in n:
if (i % 2 == 0):
x = n[i]
y = n[i + 1]
# String containing the co-ordinates.
string = str(x) + " " + str(y)
if (i == 0):
# text on topmost co-ordinate.
cv2.putText(img2, "TOP", (x, y),font, 0.5, (255, 0, 0))
else:
# text on remaining co-ordinates.
cv2.putText(img2, string, (x, y),font, 0.5, (0, 255, 0))
i = i + 1
# Showing the final image.
cv2.imshow('Image with Contours Co-ordinates', img2)
# Exiting the window if 'q' is pressed on the keyboard.
if cv2.waitKey(0) & 0xFF == ord('q'):
cv2.destroyAllWindows()
# top label
start1 = tk.Label(text = "Image Contours Co-ordinates", font=("Arial", 50), fg="magenta") # same way bg
start1.place(x =50, y = 10)
lbl1 = tk.Label(text="Select any image with\nobject & get contours co-ordinates", font=("Arial", 40),fg="green") # same way bg
lbl1.place(x=90, y=110)
lbl2 = tk.Label(text="Selected Image", font=("Arial", 30),fg="brown") # same way bg
lbl2.place(x=80, y=280)
path_text = tk.Text(window1, height=1, width=37, font=("Arial", 30), bg="light yellow", fg="orange",borderwidth=2, relief="solid")
path_text.place(x=80, y = 330)
# Select Button
selectb=Button(window1, text="SELECT",command=open_file, font=("Arial", 25), bg = "light green", fg = "blue")
selectb.place(x = 120, y = 580)
# original image Button
getb=Button(window1, text="ORIGINAL IMAGE",command=original_fun, font=("Arial", 25), bg = "orange", fg = "blue")
getb.place(x = 80, y = 450)
# contour Button
getb=Button(window1, text="CONTOURS CO-ORD.",command=contours_fun, font=("Arial", 25), bg = "orange", fg = "blue")
getb.place(x = 530, y = 450)
# function for exiting
def exit_win1():
if mbox.askokcancel("Exit", "Do you want to exit?"):
window1.destroy()
# Get Images Button
getb=Button(window1, text="EXIT",command=exit_win1, font=("Arial", 25), bg = "red", fg = "blue")
getb.place(x = 750, y = 580)
window1.protocol("WM_DELETE_WINDOW", exit_win1)
window1.mainloop()
| [
1,
529,
276,
1112,
420,
29958,
2083,
277,
1100,
29875,
29900,
29929,
29900,
29955,
29914,
29909,
29893,
14151,
29918,
11980,
29918,
4081,
29879,
13,
13,
29937,
7084,
2866,
2470,
3189,
29899,
24266,
13,
13,
29937,
19673,
5181,
3489,
13,
5215,
18883,
1639,
13,
3166,
18883,
1639,
1053,
334,
13,
5215,
18883,
1639,
408,
18883,
13,
5215,
18883,
1639,
29889,
4906,
1884,
408,
286,
1884,
13,
3166,
18883,
1639,
1053,
260,
11178,
13,
3166,
18883,
1639,
1053,
934,
15901,
13,
3166,
349,
6227,
1053,
7084,
29911,
29895,
29892,
7084,
13,
5215,
13850,
29906,
13,
5215,
12655,
408,
7442,
13,
13,
13,
29937,
4241,
18379,
669,
20999,
13,
7165,
353,
18883,
29889,
29911,
29895,
580,
396,
2825,
263,
18883,
1639,
1410,
29875,
3474,
3515,
13,
7165,
29889,
3257,
703,
2940,
2866,
2470,
3189,
29899,
24266,
1159,
396,
3611,
2183,
338,
376,
4571,
9838,
19926,
29908,
13,
7165,
29889,
19156,
877,
29896,
29900,
29900,
29900,
29916,
29955,
29900,
29900,
1495,
13,
13,
29937,
2246,
3858,
13,
2962,
29896,
353,
18883,
29889,
4775,
29898,
726,
353,
376,
2940,
2866,
2470,
3189,
29899,
24266,
613,
4079,
29922,
703,
29909,
9315,
613,
29871,
29945,
29900,
511,
285,
29887,
543,
11082,
6381,
1159,
396,
1021,
982,
25989,
13,
2962,
29896,
29889,
6689,
29898,
29916,
353,
29871,
29945,
29900,
29892,
343,
353,
29871,
29896,
29900,
29897,
13,
13,
1753,
1369,
29918,
7692,
7295,
13,
1678,
3474,
29889,
20524,
580,
13,
13,
29937,
1369,
2826,
2825,
13,
2962,
29890,
353,
11025,
29898,
7165,
29892,
1426,
543,
25826,
613,
6519,
29922,
2962,
29918,
7692,
29892,
5657,
29922,
703,
29909,
9315,
613,
29871,
29906,
29945,
511,
25989,
353,
376,
272,
927,
613,
285,
29887,
353,
376,
9539,
613,
5139,
2103,
29922,
29941,
29892,
18892,
543,
336,
3368,
1159,
13,
2962,
29890,
29889,
6689,
29898,
29916,
353,
29896,
29945,
29945,
1919,
343,
353,
29945,
29947,
29900,
1723,
13,
13,
29937,
1967,
373,
278,
1667,
3474,
13,
2084,
353,
376,
20163,
29914,
8862,
29889,
6173,
29908,
13,
29937,
6760,
1078,
263,
323,
29895,
1639,
29899,
23712,
15373,
1967,
29892,
607,
508,
367,
1304,
16978,
323,
29895,
1639,
23347,
385,
1967,
1203,
29889,
13,
2492,
29896,
353,
7084,
29911,
29895,
29889,
25971,
2940,
29898,
2940,
29889,
3150,
29898,
2084,
876,
13,
29937,
450,
15796,
11109,
338,
263,
3918,
323,
29895,
1639,
11109,
1304,
304,
2479,
263,
1426,
470,
1967,
373,
278,
4315,
29889,
13,
15119,
353,
18883,
29889,
4775,
29898,
7165,
29892,
1967,
353,
10153,
29896,
29897,
13,
15119,
29889,
6689,
29898,
29916,
353,
29871,
29896,
29906,
29945,
29892,
343,
353,
29871,
29896,
29906,
29900,
29897,
13,
13,
29937,
740,
2825,
363,
6876,
292,
13,
1753,
6876,
29918,
5080,
7295,
13,
1678,
565,
286,
1884,
29889,
1278,
554,
20713,
703,
24365,
613,
376,
6132,
366,
864,
304,
6876,
3026,
1125,
13,
4706,
3474,
29889,
20524,
580,
13,
13,
29937,
6876,
2826,
2825,
13,
13322,
29890,
353,
11025,
29898,
7165,
29892,
1426,
543,
5746,
1806,
613,
6519,
29922,
13322,
29918,
5080,
29892,
5657,
29922,
703,
29909,
9315,
613,
29871,
29906,
29945,
511,
25989,
353,
376,
1127,
613,
285,
29887,
353,
376,
9539,
613,
5139,
2103,
29922,
29941,
29892,
18892,
543,
336,
3368,
1159,
13,
13322,
29890,
29889,
6689,
29898,
29916,
353,
29955,
29906,
29900,
1919,
343,
353,
29871,
29945,
29947,
29900,
1723,
13,
7165,
29889,
20464,
703,
26735,
29918,
2287,
18476,
29918,
25152,
3970,
29956,
613,
6876,
29918,
5080,
29897,
13,
7165,
29889,
3396,
7888,
580,
13,
13,
29937,
4241,
18379,
669,
20999,
13,
7165,
29896,
353,
18883,
29889,
29911,
29895,
580,
396,
2825,
263,
18883,
1639,
1410,
29875,
3474,
3515,
13,
7165,
29896,
29889,
3257,
703,
2940,
2866,
2470,
3189,
29899,
24266,
1159,
13,
7165,
29896,
29889,
19156,
877,
29896,
29900,
29900,
29900,
29916,
29955,
29900,
29900,
1495,
13,
13,
29937,
740,
304,
1722,
934,
13,
1753,
1722,
29918,
1445,
7295,
13,
1678,
5534,
10422,
13,
1678,
10422,
353,
934,
15901,
29889,
1278,
3150,
9507,
29898,
3257,
543,
3549,
934,
1159,
13,
1678,
396,
1596,
29898,
9507,
29897,
13,
1678,
2224,
29918,
726,
29889,
8143,
703,
29896,
29889,
29900,
613,
376,
355,
1159,
13,
1678,
2224,
29918,
726,
29889,
7851,
29898,
11794,
29892,
10422,
29897,
13,
13,
29937,
740,
304,
1510,
2441,
4863,
13,
1753,
2441,
29918,
7692,
7295,
13,
1678,
5534,
10422,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
9507,
29892,
29871,
29896,
29897,
13,
1678,
13850,
29906,
29889,
326,
4294,
703,
26036,
7084,
613,
10153,
29897,
13,
13,
29937,
740,
304,
1510,
16749,
7052,
4863,
13,
1753,
640,
2470,
29918,
7692,
7295,
13,
1678,
5534,
10422,
13,
13,
1678,
396,
21439,
1967,
13,
1678,
4079,
353,
13850,
29906,
29889,
29943,
1164,
29911,
29918,
4448,
7068,
13282,
29918,
29911,
3960,
29925,
1307,
29990,
13,
1678,
10153,
29906,
353,
13850,
29906,
29889,
326,
949,
29898,
9507,
29892,
13850,
29906,
29889,
7833,
16310,
29918,
15032,
1955,
29897,
13,
1678,
396,
21439,
1021,
1967,
297,
1790,
2286,
322,
17415,
304,
16749,
6287,
29889,
13,
1678,
10153,
353,
13850,
29906,
29889,
326,
949,
29898,
9507,
29892,
13850,
29906,
29889,
7833,
16310,
29918,
29954,
4717,
21554,
5454,
1307,
29897,
13,
1678,
396,
1281,
369,
1259,
1967,
304,
263,
7581,
1967,
313,
4628,
322,
4796,
871,
1967,
467,
13,
1678,
17117,
16897,
353,
13850,
29906,
29889,
386,
12268,
29898,
2492,
29892,
29871,
29896,
29896,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
13850,
29906,
29889,
4690,
1525,
7068,
29918,
29933,
1177,
19926,
29897,
13,
1678,
396,
5953,
522,
292,
640,
2470,
297,
1967,
29889,
13,
1678,
640,
2470,
29892,
903,
353,
13850,
29906,
29889,
2886,
1323,
2470,
29898,
386,
12268,
29892,
13850,
29906,
29889,
1525,
5659,
29918,
29911,
21661,
29892,
11023,
29906,
29889,
3210,
29909,
1177,
29918,
3301,
8618,
29990,
29918,
5425,
3580,
1307,
29897,
13,
1678,
396,
2921,
292,
1549,
1432,
640,
2470,
1476,
297,
278,
1967,
29889,
13,
1678,
363,
274,
593,
297,
640,
2470,
29901,
13,
4706,
2134,
29916,
353,
13850,
29906,
29889,
14850,
7713,
29891,
11191,
29898,
20047,
29892,
29871,
29900,
29889,
29900,
29900,
29929,
334,
13850,
29906,
29889,
5666,
6513,
29898,
20047,
29892,
5852,
511,
5852,
29897,
13,
4706,
396,
4216,
29879,
10452,
310,
640,
2470,
29889,
13,
4706,
13850,
29906,
29889,
4012,
1323,
2470,
29898,
2492,
29906,
29892,
518,
14850,
1402,
29871,
29900,
29892,
313,
29900,
29892,
29871,
29900,
29892,
29871,
29906,
29945,
29945,
511,
29871,
29906,
29897,
13,
4706,
396,
501,
8485,
304,
1652,
19667,
278,
1409,
6943,
278,
1302,
29899,
24266,
310,
278,
13791,
29889,
13,
4706,
302,
353,
2134,
29916,
29889,
336,
955,
580,
13,
4706,
474,
353,
29871,
29900,
13,
4706,
363,
432,
297,
302,
29901,
13,
9651,
565,
313,
29875,
1273,
29871,
29906,
1275,
29871,
29900,
1125,
13,
18884,
921,
353,
302,
29961,
29875,
29962,
13,
18884,
343,
353,
302,
29961,
29875,
718,
29871,
29896,
29962,
13,
18884,
396,
1714,
6943,
278,
1302,
29899,
24266,
29889,
13,
18884,
1347,
353,
851,
29898,
29916,
29897,
718,
376,
376,
718,
851,
29898,
29891,
29897,
13,
18884,
565,
313,
29875,
1275,
29871,
29900,
1125,
13,
462,
1678,
396,
1426,
373,
2246,
3242,
1302,
29899,
16065,
29889,
13,
462,
1678,
13850,
29906,
29889,
649,
1626,
29898,
2492,
29906,
29892,
376,
29911,
4590,
613,
313,
29916,
29892,
343,
511,
5657,
29892,
29871,
29900,
29889,
29945,
29892,
313,
29906,
29945,
29945,
29892,
29871,
29900,
29892,
29871,
29900,
876,
13,
18884,
1683,
29901,
13,
462,
1678,
396,
1426,
373,
9886,
1302,
29899,
24266,
29889,
13,
462,
1678,
13850,
29906,
29889,
649,
1626,
29898,
2492,
29906,
29892,
1347,
29892,
313,
29916,
29892,
343,
511,
5657,
29892,
29871,
29900,
29889,
29945,
29892,
313,
29900,
29892,
29871,
29906,
29945,
29945,
29892,
29871,
29900,
876,
13,
9651,
474,
353,
474,
718,
29871,
29896,
13,
1678,
396,
7704,
292,
278,
2186,
1967,
29889,
13,
1678,
13850,
29906,
29889,
326,
4294,
877,
2940,
411,
2866,
2470,
3189,
29899,
24266,
742,
10153,
29906,
29897,
13,
13,
1678,
396,
1222,
11407,
278,
3474,
565,
525,
29939,
29915,
338,
15385,
373,
278,
12247,
29889,
13,
1678,
565,
13850,
29906,
29889,
10685,
2558,
29898,
29900,
29897,
669,
29871,
29900,
29916,
4198,
1275,
4356,
877,
29939,
29374,
13,
4706,
13850,
29906,
29889,
20524,
3596,
7685,
580,
13,
13,
13,
29937,
2246,
3858,
13,
2962,
29896,
353,
18883,
29889,
4775,
29898,
726,
353,
376,
2940,
2866,
2470,
3189,
29899,
24266,
613,
4079,
29922,
703,
29909,
9315,
613,
29871,
29945,
29900,
511,
285,
29887,
543,
11082,
6381,
1159,
396,
1021,
982,
25989,
13,
2962,
29896,
29889,
6689,
29898,
29916,
353,
29945,
29900,
29892,
343,
353,
29871,
29896,
29900,
29897,
13,
13,
26648,
29896,
353,
18883,
29889,
4775,
29898,
726,
543,
3549,
738,
1967,
411,
29905,
29876,
3318,
669,
679,
640,
2470,
1302,
29899,
24266,
613,
4079,
29922,
703,
29909,
9315,
613,
29871,
29946,
29900,
511,
16434,
543,
12692,
1159,
29871,
396,
1021,
982,
25989,
13,
26648,
29896,
29889,
6689,
29898,
29916,
29922,
29929,
29900,
29892,
343,
29922,
29896,
29896,
29900,
29897,
13,
13,
26648,
29906,
353,
18883,
29889,
4775,
29898,
726,
543,
8592,
7084,
613,
4079,
29922,
703,
29909,
9315,
613,
29871,
29941,
29900,
511,
16434,
543,
29890,
4708,
1159,
29871,
396,
1021,
982,
25989,
13,
26648,
29906,
29889,
6689,
29898,
29916,
29922,
29947,
29900,
29892,
343,
29922,
29906,
29947,
29900,
29897,
13,
13,
2084,
29918,
726,
353,
18883,
29889,
1626,
29898,
7165,
29896,
29892,
3171,
29922,
29896,
29892,
2920,
29922,
29941,
29955,
29892,
4079,
29922,
703,
29909,
9315,
613,
29871,
29941,
29900,
511,
25989,
543,
4366,
13328,
613,
285,
29887,
543,
272,
927,
613,
11466,
2103,
29922,
29906,
29892,
18892,
543,
2929,
333,
1159,
13,
2084,
29918,
726,
29889,
6689,
29898,
29916,
29922,
29947,
29900,
29892,
343,
353,
29871,
29941,
29941,
29900,
29897,
13,
13,
29937,
7605,
11025,
13,
2622,
29890,
29922,
3125,
29898,
7165,
29896,
29892,
1426,
543,
6404,
613,
6519,
29922,
3150,
29918,
1445,
29892,
29871,
4079,
29922,
703,
29909,
9315,
613,
29871,
29906,
29945,
511,
25989,
353,
376,
4366,
7933,
613,
285,
29887,
353,
376,
9539,
1159,
13,
2622,
29890,
29889,
6689,
29898,
29916,
353,
29871,
29896,
29906,
29900,
29892,
343,
353,
29871,
29945,
29947,
29900,
29897,
13,
13,
29937,
2441,
1967,
11025,
13,
657,
29890,
29922,
3125,
29898,
7165,
29896,
29892,
1426,
543,
1955,
6259,
1177,
1964,
306,
1529,
1692,
613,
6519,
29922,
13492,
29918,
7692,
29892,
29871,
4079,
29922,
703,
29909,
9315,
613,
29871,
29906,
29945,
511,
25989,
353,
376,
272,
927,
613,
285,
29887,
353,
376,
9539,
1159,
13,
657,
29890,
29889,
6689,
29898,
29916,
353,
29871,
29947,
29900,
29892,
343,
353,
29871,
29946,
29945,
29900,
29897,
13,
13,
29937,
640,
473,
11025,
13,
657,
29890,
29922,
3125,
29898,
7165,
29896,
29892,
1426,
543,
6007,
4986,
4574,
29903,
4810,
29899,
25593,
19602,
6519,
29922,
1285,
2470,
29918,
7692,
29892,
29871,
4079,
29922,
703,
29909,
9315,
613,
29871,
29906,
29945,
511,
25989,
353,
376,
272,
927,
613,
285,
29887,
353,
376,
9539,
1159,
13,
657,
29890,
29889,
6689,
29898,
29916,
353,
29871,
29945,
29941,
29900,
29892,
343,
353,
29871,
29946,
29945,
29900,
29897,
13,
13,
29937,
740,
363,
6876,
292,
13,
1753,
6876,
29918,
5080,
29896,
7295,
13,
1678,
565,
286,
1884,
29889,
1278,
554,
20713,
703,
24365,
613,
376,
6132,
366,
864,
304,
6876,
3026,
1125,
13,
4706,
3474,
29896,
29889,
20524,
580,
13,
13,
29937,
3617,
1954,
1179,
11025,
13,
657,
29890,
29922,
3125,
29898,
7165,
29896,
29892,
1426,
543,
5746,
1806,
613,
6519,
29922,
13322,
29918,
5080,
29896,
29892,
29871,
4079,
29922,
703,
29909,
9315,
613,
29871,
29906,
29945,
511,
25989,
353,
376,
1127,
613,
285,
29887,
353,
376,
9539,
1159,
13,
657,
29890,
29889,
6689,
29898,
29916,
353,
29871,
29955,
29945,
29900,
29892,
343,
353,
29871,
29945,
29947,
29900,
29897,
13,
13,
7165,
29896,
29889,
20464,
703,
26735,
29918,
2287,
18476,
29918,
25152,
3970,
29956,
613,
6876,
29918,
5080,
29896,
29897,
13,
7165,
29896,
29889,
3396,
7888,
580,
13,
13,
2
] |
appengine/cr-buildbucket/errors.py | mithro/chromium-infra | 0 | 91020 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
BUCKET_NAME_REGEX = re.compile(r'^[0-9a-z_\.\-/]{1,100}$')
class Error(Exception):
pass
class BuildNotFoundError(Error):
pass
class BuildIsCompletedError(Error):
"""Build is complete and cannot be changed."""
class InvalidInputError(Error):
"""Raised when service method argument value is invalid."""
class LeaseExpiredError(Error):
"""Raised when provided lease_key does not match the current one."""
def validate_bucket_name(bucket):
"""Raises InvalidInputError if bucket name is invalid."""
if not bucket:
raise InvalidInputError('Bucket not specified')
if not isinstance(bucket, basestring):
raise InvalidInputError(
'Bucket must be a string. It is %s.' % type(bucket).__name__)
if not BUCKET_NAME_REGEX.match(bucket):
raise InvalidInputError(
'Bucket name "%s" does not match regular expression %s' %
(bucket, BUCKET_NAME_REGEX.pattern))
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29896,
29946,
450,
678,
456,
1974,
13189,
943,
29889,
2178,
10462,
21676,
29889,
13,
29937,
4803,
310,
445,
2752,
775,
338,
4095,
287,
491,
263,
350,
7230,
29899,
3293,
19405,
393,
508,
367,
13,
29937,
1476,
297,
278,
365,
2965,
1430,
1660,
934,
29889,
13,
13,
5215,
337,
13,
13,
7838,
7077,
2544,
29918,
5813,
29918,
1525,
1692,
29990,
353,
337,
29889,
12198,
29898,
29878,
29915,
29985,
29961,
29900,
29899,
29929,
29874,
29899,
29920,
3187,
7790,
29899,
29914,
3199,
29896,
29892,
29896,
29900,
29900,
1042,
1495,
13,
13,
13,
1990,
4829,
29898,
2451,
1125,
13,
29871,
1209,
13,
13,
13,
1990,
8878,
17413,
2392,
29898,
2392,
1125,
13,
29871,
1209,
13,
13,
13,
1990,
8878,
3624,
26010,
2392,
29898,
2392,
1125,
13,
29871,
9995,
8893,
338,
4866,
322,
2609,
367,
3939,
1213,
15945,
13,
13,
13,
1990,
21403,
4290,
2392,
29898,
2392,
1125,
13,
29871,
9995,
29934,
1759,
287,
746,
2669,
1158,
2980,
995,
338,
8340,
1213,
15945,
13,
13,
13,
1990,
951,
559,
9544,
2859,
2392,
29898,
2392,
1125,
13,
29871,
9995,
29934,
1759,
287,
746,
4944,
454,
559,
29918,
1989,
947,
451,
1993,
278,
1857,
697,
1213,
15945,
13,
13,
13,
1753,
12725,
29918,
21454,
29918,
978,
29898,
21454,
1125,
13,
29871,
9995,
29934,
1759,
267,
21403,
4290,
2392,
565,
20968,
1024,
338,
8340,
1213,
15945,
13,
29871,
565,
451,
20968,
29901,
13,
1678,
12020,
21403,
4290,
2392,
877,
29933,
2707,
300,
451,
6790,
1495,
13,
29871,
565,
451,
338,
8758,
29898,
21454,
29892,
2362,
342,
5393,
1125,
13,
1678,
12020,
21403,
4290,
2392,
29898,
13,
418,
525,
29933,
2707,
300,
1818,
367,
263,
1347,
29889,
739,
338,
1273,
29879,
6169,
1273,
1134,
29898,
21454,
467,
1649,
978,
1649,
29897,
13,
29871,
565,
451,
350,
29965,
7077,
2544,
29918,
5813,
29918,
1525,
1692,
29990,
29889,
4352,
29898,
21454,
1125,
13,
1678,
12020,
21403,
4290,
2392,
29898,
13,
418,
525,
29933,
2707,
300,
1024,
11860,
29879,
29908,
947,
451,
1993,
4943,
4603,
1273,
29879,
29915,
1273,
13,
418,
313,
21454,
29892,
350,
29965,
7077,
2544,
29918,
5813,
29918,
1525,
1692,
29990,
29889,
11037,
876,
13,
2
] |
src/__init__.py | MishaCatskill/lykos | 0 | 73660 | <filename>src/__init__.py
import argparse
import datetime
import time
import botconfig
import src.settings as var
from src import logger
from src.logger import stream, stream_handler, debuglog, errlog, plog
from src import db
# Import the user-defined game modes
# These are not required, so failing to import it doesn't matter
# The file then imports our game modes
# Fall back to importing our game modes if theirs fail
# Do the same with roles
try:
import gamemodes # type: ignore
except ImportError:
import src.gamemodes
try:
import roles # type: ignore
roles.CUSTOM_ROLES_DEFINED
except (ImportError, AttributeError):
import src.roles
# Handle launch parameters
# Argument --debug means start in debug mode
# --verbose means to print a lot of stuff (when not in debug mode)
# --normal means to override the above and use nothing
# Settings can be defined in the config, but launch argumentss override it
debug_mode = False
verbose = False
normal = False
lagcheck = False
# Carry over settings from botconfig into settings.py
for setting, value in botconfig.__dict__.items():
if not setting.isupper():
continue # Not a setting
if setting == "DEBUG_MODE":
debug_mode = value
if setting == "VERBOSE_MODE":
verbose = value
if setting == "NORMAL_MODE":
normal = value
if not setting in var.__dict__.keys():
continue # Don't carry over config-only settings
# If we got that far, it's valid
setattr(var, setting, value)
parser = argparse.ArgumentParser()
parser.add_argument('--debug', action='store_true')
parser.add_argument('--verbose', action='store_true')
parser.add_argument('--normal', action='store_true')
parser.add_argument('--lagcheck', action='store_true')
args = parser.parse_args()
if args.debug: debug_mode = True
if args.verbose: verbose = True
if args.normal: normal = True
if args.lagcheck: lagcheck = True
botconfig.DEBUG_MODE = debug_mode if not normal else False
botconfig.VERBOSE_MODE = verbose if not normal else False
# vim: set sw=4 expandtab:
| [
1,
529,
9507,
29958,
4351,
29914,
1649,
2344,
26914,
2272,
13,
5215,
1852,
5510,
13,
5215,
12865,
13,
5215,
931,
13,
13,
5215,
9225,
2917,
13,
5215,
4765,
29889,
11027,
408,
722,
13,
3166,
4765,
1053,
17927,
13,
3166,
4765,
29889,
21707,
1053,
4840,
29892,
4840,
29918,
13789,
29892,
4744,
1188,
29892,
4589,
1188,
29892,
282,
1188,
13,
3166,
4765,
1053,
4833,
13,
13,
29937,
16032,
278,
1404,
29899,
12119,
3748,
18893,
13,
29937,
4525,
526,
451,
3734,
29892,
577,
17581,
304,
1053,
372,
1838,
29915,
29873,
4383,
13,
29937,
450,
934,
769,
24802,
1749,
3748,
18893,
13,
29937,
14053,
1250,
304,
28348,
1749,
3748,
18893,
565,
1009,
29879,
4418,
13,
29937,
1938,
278,
1021,
411,
16178,
13,
13,
2202,
29901,
13,
1678,
1053,
24988,
331,
2631,
396,
1134,
29901,
11455,
13,
19499,
16032,
2392,
29901,
13,
1678,
1053,
4765,
29889,
29887,
314,
331,
2631,
13,
13,
2202,
29901,
13,
1678,
1053,
16178,
396,
1134,
29901,
11455,
13,
1678,
16178,
29889,
29907,
17321,
6488,
29918,
1672,
17101,
29918,
24405,
1177,
3352,
13,
19499,
313,
17518,
2392,
29892,
23833,
2392,
1125,
13,
1678,
1053,
4765,
29889,
307,
793,
13,
13,
29937,
29273,
6826,
4128,
13,
13,
29937,
23125,
1192,
8382,
2794,
1369,
297,
4744,
4464,
13,
29937,
3986,
1192,
369,
15828,
2794,
304,
1596,
263,
3287,
310,
6433,
313,
8256,
451,
297,
4744,
4464,
29897,
13,
29937,
3986,
1192,
8945,
2794,
304,
5712,
278,
2038,
322,
671,
3078,
13,
29937,
19215,
508,
367,
3342,
297,
278,
2295,
29892,
541,
6826,
2980,
893,
5712,
372,
13,
13,
8382,
29918,
8513,
353,
7700,
13,
369,
15828,
353,
7700,
13,
8945,
353,
7700,
13,
3110,
3198,
353,
7700,
13,
13,
29937,
1704,
719,
975,
6055,
515,
9225,
2917,
964,
6055,
29889,
2272,
13,
13,
1454,
4444,
29892,
995,
297,
9225,
2917,
17255,
8977,
26914,
7076,
7295,
13,
1678,
565,
451,
4444,
29889,
275,
21064,
7295,
13,
4706,
6773,
396,
2216,
263,
4444,
13,
1678,
565,
4444,
1275,
376,
18525,
29918,
20387,
1115,
13,
4706,
4744,
29918,
8513,
353,
995,
13,
1678,
565,
4444,
1275,
376,
5348,
8456,
1660,
29918,
20387,
1115,
13,
4706,
26952,
353,
995,
13,
1678,
565,
4444,
1275,
376,
29940,
1955,
1529,
29931,
29918,
20387,
1115,
13,
4706,
4226,
353,
995,
13,
1678,
565,
451,
4444,
297,
722,
17255,
8977,
26914,
8149,
7295,
13,
4706,
6773,
396,
3872,
29915,
29873,
8677,
975,
2295,
29899,
6194,
6055,
13,
13,
1678,
396,
960,
591,
2355,
393,
2215,
29892,
372,
29915,
29879,
2854,
13,
1678,
731,
5552,
29898,
1707,
29892,
4444,
29892,
995,
29897,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
580,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
8382,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
369,
15828,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
8945,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
16680,
29889,
1202,
29918,
23516,
877,
489,
3110,
3198,
742,
3158,
2433,
8899,
29918,
3009,
1495,
13,
13,
5085,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
361,
6389,
29889,
8382,
29901,
4744,
29918,
8513,
353,
5852,
13,
361,
6389,
29889,
369,
15828,
29901,
26952,
353,
5852,
13,
361,
6389,
29889,
8945,
29901,
4226,
353,
5852,
13,
361,
6389,
29889,
3110,
3198,
29901,
11755,
3198,
353,
5852,
13,
13,
7451,
2917,
29889,
18525,
29918,
20387,
353,
4744,
29918,
8513,
565,
451,
4226,
1683,
7700,
13,
7451,
2917,
29889,
5348,
8456,
1660,
29918,
20387,
353,
26952,
565,
451,
4226,
1683,
7700,
13,
13,
29937,
325,
326,
29901,
731,
2381,
29922,
29946,
7985,
3891,
29901,
13,
2
] |
Searching and Sorting/playlist.py | mishrakeshav/CSES-Problem-Set | 0 | 37610 |
def solve():
n = int(input())
k = list(map(int,input().split()))
hashmap = dict()
j = 0
ans = 0
c = 0
for i in range(n):
if k[i] in hashmap and hashmap[k[i]] > 0:
while i > j and k[i] in hashmap and hashmap[k[i]] > 0:
hashmap[k[j]] -= 1
j += 1
c -= 1
hashmap[k[i]] = 1
c += 1
ans = max(ans,c)
print(ans)
if __name__ == '__main__':
solve() | [
1,
29871,
13,
1753,
4505,
7295,
13,
1678,
302,
353,
938,
29898,
2080,
3101,
13,
1678,
413,
353,
1051,
29898,
1958,
29898,
524,
29892,
2080,
2141,
5451,
22130,
13,
1678,
6608,
1958,
353,
9657,
580,
13,
1678,
432,
353,
29871,
29900,
13,
1678,
6063,
353,
29871,
29900,
29871,
13,
1678,
274,
353,
29871,
29900,
259,
13,
1678,
363,
474,
297,
3464,
29898,
29876,
1125,
13,
4706,
565,
413,
29961,
29875,
29962,
297,
6608,
1958,
322,
6608,
1958,
29961,
29895,
29961,
29875,
5262,
1405,
29871,
29900,
29901,
13,
9651,
1550,
474,
1405,
432,
322,
413,
29961,
29875,
29962,
297,
6608,
1958,
322,
6608,
1958,
29961,
29895,
29961,
29875,
5262,
1405,
29871,
29900,
29901,
13,
18884,
6608,
1958,
29961,
29895,
29961,
29926,
5262,
22361,
29871,
29896,
29871,
13,
18884,
432,
4619,
29871,
29896,
29871,
13,
18884,
274,
22361,
29871,
29896,
29871,
13,
4706,
6608,
1958,
29961,
29895,
29961,
29875,
5262,
353,
29871,
29896,
29871,
13,
4706,
274,
4619,
29871,
29896,
29871,
13,
4706,
6063,
353,
4236,
29898,
550,
29892,
29883,
29897,
13,
1678,
1596,
29898,
550,
29897,
13,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4505,
580,
2
] |
pada/assemble/__init__.py | eleveyuan/kada | 4 | 1603524 | # comment code to fix partially/circular import
# from pada.assemble.locates import url
# from pada.assemble.assembles import assemble
# from pada.assemble.pipes import pipe
#
#
# __all__ = ['url', 'assemble', 'pipe'] | [
1,
396,
3440,
775,
304,
2329,
22039,
29914,
6034,
1070,
1053,
13,
29937,
515,
282,
1114,
29889,
465,
6967,
29889,
2029,
1078,
1053,
3142,
13,
29937,
515,
282,
1114,
29889,
465,
6967,
29889,
465,
1590,
793,
1053,
24940,
13,
29937,
515,
282,
1114,
29889,
465,
6967,
29889,
13096,
267,
1053,
14282,
13,
29937,
13,
29937,
13,
29937,
4770,
497,
1649,
353,
6024,
2271,
742,
525,
465,
6967,
742,
525,
17760,
2033,
2
] |
source_optics/scanner/commits.py | heemayl/source_optics | 1 | 137172 | # Copyright 2018-2019 SourceOptics Project Contributors
#
# 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 fnmatch
import os
import re
from django.utils.dateparse import parse_datetime
from ..models import Author, Commit, File, FileChange
from . import commands
# we use git --log with a special one-line format string to capture certain fields
# we regex across those fields with a custom delimiter to make it easy to find them
DEL = '&DEL&>'
# Fields recorded (in order)
# commit hash %H
# author_name %an
# author_date %ad
# commit_date %cd
# author_email %ae
# subject %f
PRETTY_STRING = f"'{DEL}%H{DEL}%an{DEL}%ad{DEL}%cd{DEL}%ae{DEL}%f{DEL}'"
# the regex to match the string, which must watch the log format PRETTY_STRING
PARSER_RE_STRING = f"{DEL}(?P<commit>.*){DEL}(?P<author_name>.*){DEL}(?P<author_date>.*){DEL}(?P<commit_date>.*){DEL}(?P<author_email>.*){DEL}(?P<subject>.*){DEL}"
PARSER_RE = re.compile(PARSER_RE_STRING, re.VERBOSE)
FILES_HACK_REPO = None
FILES_HACK = dict()
# Regex for handling arbitrary file path renames;
# `(/)?`: First captured group that matches `/` optionally
# `(?:\{[^}=]+=>)`: non-captured group to match until `=>`
# `([^}]+)`: matches the portion upto next `}` (`\}`)
# In the replacement, only the captured groups are used.
FILE_PATH_RENAME_RE = re.compile(r'(/)?(?:\{[^}=]+=>)([^}]+)\}')
class Commits:
"""
This class clones a repository (git) using a provided URL and credential
and proceeds to execute git log on it to scan its data
"""
@classmethod
def get_file(cls, repo, path, filename):
"""
provide a lookup of File objects for repo/path/filename tuples to
prevent excessive database access. This cache is only kept around
for the current repository
"""
global FILES_HACK_REPO
global FILES_HACK
if FILES_HACK_REPO != repo.name:
FILES_HACK = dict()
FILES_HACK_REPO = repo.name
files = File.objects.filter(repo=repo).all()
for fobj in files:
assert fobj is not None
key = os.path.join(fobj.path, fobj.name)
FILES_HACK[key] = fobj
original = os.path.join(path, filename)
result = FILES_HACK[original]
assert result is not None
return result
@classmethod
def bulk_create(cls, total_commits, total_files, total_file_changes):
"""
we keep a list of the three types of objects and only create them periodically,
to prevent from doing too many database transactions. The batch size here is fairly
arbitrary.
"""
# by not ignoring conflicts, we can test whether our scanner "overwork" code is correct
# use -F to try a full test from scratch
if len(total_commits):
Commit.objects.bulk_create(total_commits, 100, ignore_conflicts=True)
del total_commits[:]
if len(total_files):
File.objects.bulk_create(total_files, 100, ignore_conflicts=True)
del total_files[:]
if len(total_file_changes):
FileChange.objects.bulk_create(total_file_changes, 100, ignore_conflicts=True)
del total_file_changes[:]
@classmethod
def process_commits(cls, repo, repo_dir, mode='Commit'):
"""
Uses git log to gather the commit data for a repository. This is run three times in three different
modes over the same git log output. See usage in processor.py.
"""
cmd_string = 'git rev-list --all --count'
commit_total = commands.execute_command(repo, cmd_string, log=False, timeout=600, chdir=repo_dir, capture=True)
try:
commit_total = int(commit_total)
except TypeError:
print("no commits yet")
return
cmd_string = ('git log --all --numstat --date=iso-strict-local --pretty=format:'
+ PRETTY_STRING)
last_commit = None
count = 0
total_commits = []
total_file_changes = []
total_files = []
global GLITCH_COUNT
def handler(line):
"""
this code processes every line from the output
"""
nonlocal last_commit
nonlocal count
if count % 200 == 0:
print("scanning (repo:%s) (mode:%s): %s/%s" % (repo, mode, count, commit_total))
if count % 2000 == 0:
cls.bulk_create(total_commits, total_files, total_file_changes)
if not line or line == "\n":
#print("F1")
return True # continue
elif line.startswith(DEL):
commit = cls.handle_diff_information(repo, line, mode)
if last_commit != commit:
count = count + 1
last_commit = commit
total_commits.append(commit)
return True
elif "does not have any commits yet" in line:
#print("skipping, no commits yet")
return False
else:
if mode != 'Commit':
assert last_commit is not None
cls.handle_file_information(repo, line, last_commit, mode, total_files, total_file_changes)
return True
commands.execute_command(repo, cmd_string, log=False, timeout=1200, chdir=repo_dir, handler=handler)
cls.bulk_create(total_commits, total_files, total_file_changes)
return True
@classmethod
def create_file(cls, full_path, commit, la, lr, binary, mode, total_files, total_file_changes):
"""
After we have recorded commits, this function creates either Files or FileChange objects
depending on what scanner pass we are running through.
"""
assert commit is not None
assert mode in [ 'File', 'FileChange' ]
fname = os.path.basename(full_path)
# find the extension
(_, ext) = os.path.splitext(full_path)
path = os.path.dirname(full_path)
if mode == 'File':
# update the global file object with the line counts
total_files.append(File(
repo=commit.repo,
path=path,
name=fname,
ext=ext,
binary=binary
))
# BOOKMARK
elif mode == 'FileChange':
file = cls.get_file(commit.repo, path, fname)
if file is None:
# this shouldn't happen, but if we get here the parser has a bug.
raise Exception("FATAL, MISSING FILE RECORD, SHOULDN'T BE HERE!")
total_file_changes.append(FileChange(
commit=commit,
lines_added=la,
lines_removed=lr,
file=file
))
@classmethod
def matches(self, needle, haystack, exact=False, trim_dot=False):
"""
This function is used by the source code filtering feature to see if a file path
matches an expression or not.
"""
# user input may be inconsistent about trailing slashes so be flexible
if haystack.endswith("/"):
haystack = haystack[:-1]
if needle.endswith("/"):
needle = needle[:-1]
if trim_dot:
# for extension checking, do not require the user input to be ".mp4" to mean "mp4"
haystack = haystack.replace(".","")
needle = needle.replace(".", "")
if "?" in needle or "*" in needle or "[" in needle:
# this looks like a fnmatch pattern
return fnmatch.fnmatch(haystack, needle)
elif exact:
# we are processing an extension, require an exact match
return haystack == needle
else:
# we are processing paths, not extensions, so just require it to start with the substring
return haystack.startswith(needle)
@classmethod
def has_matches(cls, needles, haystack, exact=False, trim_dot=False):
"""
tests whether a file pattern has any one of multiple matches
"""
for needle in needles:
if cls.matches(needle, haystack, exact=exact, trim_dot=trim_dot):
return True
return False
@classmethod
def has_no_matches(cls, needles, haystack, exact=False, trim_dot=False):
return not cls.has_matches(needles, haystack, exact=exact, trim_dot=trim_dot)
@classmethod
def repair_move_path(cls, path):
"""
handles details about moves in git log by fixing path elements like /{org=>com}/
to just log the file in the final path. This will possibly give users credit for
aspects of a move but this something we can explore later. Not sure if it does - MPD.
"""
return FILE_PATH_RENAME_RE.sub(r'\1\2', path)
@classmethod
def should_process_path(cls, repo, path):
"""
Repository configuration supports filtering based on path, to decide to index or not-index
certain files. This might be used to only index a 'src/' directory or otherwise not
index a directory called 'docs/', and is off by default. This function handles
a decision on whether to process a path.
"""
org = repo.organization
directory_allow = repo.scanner_directory_allow_list or org.scanner_directory_allow_list
directory_deny = repo.scanner_directory_deny_list or org.scanner_directory_deny_list
extension_allow = repo.scanner_extension_allow_list or org.scanner_extension_allow_list
extension_deny = repo.scanner_extension_deny_list or org.scanner_extension_deny_list
dirname = os.path.dirname(path)
split_ext = os.path.splitext(path)
extension = None
if len(split_ext) > 1:
extension = split_ext[-1]
if directory_allow:
directory_allow = directory_allow.split("\n")
if directory_deny:
directory_deny = directory_deny.split("\n")
if extension_allow:
extension_allow = extension_allow.split("\n")
if extension_deny:
extension_deny = extension_deny.split("\n")
if directory_allow and cls.has_no_matches(directory_allow, dirname):
return False
if directory_deny and cls.has_matches(directory_deny, dirname):
return False
if extension:
if extension_allow and cls.has_no_matches(extension_allow, extension, exact=True, trim_dot=True):
return False
if extension_deny and cls.has_matches(extension_deny, extension, exact=True, trim_dot=True):
return False
return True
@classmethod
def handle_file_information(cls, repo, line, last_commit, mode, total_files, total_file_changes):
"""
process the list of file changes in this commit
"""
tokens = line.split()
(added, removed, path) = (tokens[0], tokens[1], ''.join(tokens[2:]))
# binary files will have '-' in their field changes. Set these to 0
binary = False
if added == '-':
binary = True
added = 0
if removed == '-':
binary = True
removed = 0
# FIXME: when scanning one repo, the added string containted
try:
added = int(added)
removed = int(removed)
except:
# FIXME:
# I found one instance in one repo where the 'added' text returns "warning: inexact" and in this case
# we might as well keep going, we probably need to parse the line differently in this instance.
# example found in kubernetes/kubernetes on github. This reference is not an endorsement.
added = 0
removed = 0
path = cls.repair_move_path(path)
if not cls.should_process_path(repo, path):
return None
cls.create_file(path, last_commit, added, removed, binary, mode, total_files, total_file_changes)
@classmethod
def handle_diff_information(cls, repo, line, mode):
"""
process the amount of lines changed in this commit
"""
# FIXME: give all these fields names
match = PARSER_RE.match(line)
if not match:
raise Exception("DOESN'T MATCH? %s" % line)
data = match.groupdict()
if mode != 'Commit':
# running back through the logs to set up the file changes
commit = Commit.objects.get(sha=data['commit'])
return commit
email = data['author_email']
author, created = Author.objects.get_or_create(email=email)
commit_date = parse_datetime(data['commit_date'])
author_date = parse_datetime(data['author_date'])
# will pass on to bulk_create
return Commit(
sha=data['commit'],
subject=data['subject'],
repo=repo,
author=author,
author_date=author_date,
commit_date=commit_date
)
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29896,
29947,
29899,
29906,
29900,
29896,
29929,
7562,
20624,
1199,
8010,
2866,
1091,
29560,
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,
29937,
13,
13,
5215,
7876,
4352,
13,
5215,
2897,
13,
5215,
337,
13,
13,
3166,
9557,
29889,
13239,
29889,
1256,
5510,
1053,
6088,
29918,
12673,
13,
13,
3166,
6317,
9794,
1053,
13361,
29892,
1876,
277,
29892,
3497,
29892,
3497,
7277,
13,
3166,
869,
1053,
8260,
13,
13,
29937,
591,
671,
6315,
1192,
1188,
411,
263,
4266,
697,
29899,
1220,
3402,
1347,
304,
10446,
3058,
4235,
13,
29937,
591,
6528,
4822,
1906,
4235,
411,
263,
2888,
28552,
304,
1207,
372,
4780,
304,
1284,
963,
13,
13,
2287,
29931,
353,
525,
29987,
2287,
29931,
29987,
16299,
13,
13,
29937,
8989,
29879,
10478,
313,
262,
1797,
29897,
13,
29937,
9063,
6608,
1273,
29950,
13,
29937,
4148,
29918,
978,
1273,
273,
13,
29937,
4148,
29918,
1256,
1273,
328,
13,
29937,
9063,
29918,
1256,
1273,
2252,
13,
29937,
4148,
29918,
5269,
1273,
3660,
13,
29937,
4967,
1273,
29888,
13,
13,
15094,
29911,
15631,
29918,
20785,
353,
285,
29908,
29915,
29912,
2287,
29931,
10560,
29950,
29912,
2287,
29931,
10560,
273,
29912,
2287,
29931,
10560,
328,
29912,
2287,
29931,
10560,
2252,
29912,
2287,
29931,
10560,
3660,
29912,
2287,
29931,
10560,
29888,
29912,
2287,
29931,
10162,
29908,
13,
13,
29937,
278,
6528,
304,
1993,
278,
1347,
29892,
607,
1818,
6505,
278,
1480,
3402,
349,
1525,
29911,
15631,
29918,
20785,
13,
13,
16320,
6304,
29918,
1525,
29918,
20785,
353,
285,
29908,
29912,
2287,
29931,
2119,
29973,
29925,
29966,
15060,
29958,
5575,
2597,
2287,
29931,
2119,
29973,
29925,
29966,
8921,
29918,
978,
29958,
5575,
2597,
2287,
29931,
2119,
29973,
29925,
29966,
8921,
29918,
1256,
29958,
5575,
2597,
2287,
29931,
2119,
29973,
29925,
29966,
15060,
29918,
1256,
29958,
5575,
2597,
2287,
29931,
2119,
29973,
29925,
29966,
8921,
29918,
5269,
29958,
5575,
2597,
2287,
29931,
2119,
29973,
29925,
29966,
16009,
29958,
5575,
2597,
2287,
29931,
5038,
13,
13,
16320,
6304,
29918,
1525,
353,
337,
29889,
12198,
29898,
16320,
6304,
29918,
1525,
29918,
20785,
29892,
337,
29889,
5348,
8456,
1660,
29897,
13,
13,
24483,
29918,
29950,
11375,
29918,
1525,
13152,
353,
6213,
13,
24483,
29918,
29950,
11375,
353,
9657,
580,
13,
13,
29937,
25326,
363,
11415,
11472,
934,
2224,
4325,
1280,
29936,
13,
29937,
12270,
4551,
29973,
6998,
3824,
15468,
2318,
393,
7087,
7034,
29952,
2984,
635,
13,
29937,
421,
10780,
3583,
13970,
29985,
5369,
10062,
4261,
3569,
29901,
1661,
29899,
17885,
2955,
2318,
304,
1993,
2745,
421,
4261,
29952,
13,
29937,
421,
4197,
29985,
6525,
29974,
3569,
29901,
7087,
278,
11910,
318,
24070,
2446,
421,
10114,
6695,
18105,
6348,
13,
29937,
512,
278,
16920,
29892,
871,
278,
15468,
6471,
526,
1304,
29889,
13,
7724,
29918,
10145,
29918,
29934,
1430,
25797,
29918,
1525,
353,
337,
29889,
12198,
29898,
29878,
12215,
4551,
29973,
10780,
3583,
13970,
29985,
5369,
10062,
4261,
29897,
4197,
29985,
6525,
29974,
2144,
29913,
1495,
13,
13,
13,
1990,
1876,
1169,
29901,
13,
13,
1678,
9995,
13,
1678,
910,
770,
1067,
2873,
263,
9810,
313,
5559,
29897,
773,
263,
4944,
3988,
322,
6625,
2556,
13,
1678,
322,
8469,
29879,
304,
6222,
6315,
1480,
373,
372,
304,
12812,
967,
848,
13,
1678,
9995,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
679,
29918,
1445,
29898,
25932,
29892,
13761,
29892,
2224,
29892,
10422,
1125,
13,
13,
4706,
9995,
13,
4706,
3867,
263,
16280,
310,
3497,
3618,
363,
13761,
29914,
2084,
29914,
9507,
5291,
2701,
304,
13,
4706,
5557,
19163,
573,
2566,
2130,
29889,
910,
7090,
338,
871,
8126,
2820,
13,
4706,
363,
278,
1857,
9810,
13,
4706,
9995,
13,
13,
4706,
5534,
9338,
17101,
29918,
29950,
11375,
29918,
1525,
13152,
13,
4706,
5534,
9338,
17101,
29918,
29950,
11375,
13,
4706,
565,
9338,
17101,
29918,
29950,
11375,
29918,
1525,
13152,
2804,
13761,
29889,
978,
29901,
13,
9651,
9338,
17101,
29918,
29950,
11375,
353,
9657,
580,
13,
9651,
9338,
17101,
29918,
29950,
11375,
29918,
1525,
13152,
353,
13761,
29889,
978,
13,
9651,
2066,
353,
3497,
29889,
12650,
29889,
4572,
29898,
20095,
29922,
20095,
467,
497,
580,
13,
9651,
363,
285,
5415,
297,
2066,
29901,
13,
18884,
4974,
285,
5415,
338,
451,
6213,
13,
18884,
1820,
353,
2897,
29889,
2084,
29889,
7122,
29898,
29888,
5415,
29889,
2084,
29892,
285,
5415,
29889,
978,
29897,
13,
18884,
9338,
17101,
29918,
29950,
11375,
29961,
1989,
29962,
353,
285,
5415,
13,
13,
4706,
2441,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
10422,
29897,
13,
4706,
1121,
353,
9338,
17101,
29918,
29950,
11375,
29961,
13492,
29962,
13,
4706,
4974,
1121,
338,
451,
6213,
13,
4706,
736,
1121,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
21610,
29918,
3258,
29898,
25932,
29892,
3001,
29918,
2055,
1169,
29892,
3001,
29918,
5325,
29892,
3001,
29918,
1445,
29918,
25990,
1125,
13,
4706,
9995,
13,
4706,
591,
3013,
263,
1051,
310,
278,
2211,
4072,
310,
3618,
322,
871,
1653,
963,
3785,
1711,
29892,
13,
4706,
304,
5557,
515,
2599,
2086,
1784,
2566,
22160,
29889,
29871,
450,
9853,
2159,
1244,
338,
12558,
13,
4706,
11472,
29889,
13,
4706,
9995,
13,
13,
4706,
396,
491,
451,
5330,
8253,
28792,
29892,
591,
508,
1243,
3692,
1749,
885,
7310,
376,
957,
1287,
29908,
775,
338,
1959,
13,
4706,
396,
671,
448,
29943,
304,
1018,
263,
2989,
1243,
515,
22728,
13,
4706,
565,
7431,
29898,
7827,
29918,
2055,
1169,
1125,
13,
9651,
1876,
277,
29889,
12650,
29889,
8645,
29895,
29918,
3258,
29898,
7827,
29918,
2055,
1169,
29892,
29871,
29896,
29900,
29900,
29892,
11455,
29918,
5527,
506,
1372,
29922,
5574,
29897,
13,
9651,
628,
3001,
29918,
2055,
1169,
7503,
29962,
13,
4706,
565,
7431,
29898,
7827,
29918,
5325,
1125,
13,
9651,
3497,
29889,
12650,
29889,
8645,
29895,
29918,
3258,
29898,
7827,
29918,
5325,
29892,
29871,
29896,
29900,
29900,
29892,
11455,
29918,
5527,
506,
1372,
29922,
5574,
29897,
13,
9651,
628,
3001,
29918,
5325,
7503,
29962,
13,
4706,
565,
7431,
29898,
7827,
29918,
1445,
29918,
25990,
1125,
13,
9651,
3497,
7277,
29889,
12650,
29889,
8645,
29895,
29918,
3258,
29898,
7827,
29918,
1445,
29918,
25990,
29892,
29871,
29896,
29900,
29900,
29892,
11455,
29918,
5527,
506,
1372,
29922,
5574,
29897,
13,
9651,
628,
3001,
29918,
1445,
29918,
25990,
7503,
29962,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
1889,
29918,
2055,
1169,
29898,
25932,
29892,
13761,
29892,
13761,
29918,
3972,
29892,
4464,
2433,
1523,
2415,
29374,
13,
13,
4706,
9995,
13,
4706,
10783,
267,
6315,
1480,
304,
11705,
278,
9063,
848,
363,
263,
9810,
29889,
29871,
910,
338,
1065,
2211,
3064,
297,
2211,
1422,
13,
4706,
18893,
975,
278,
1021,
6315,
1480,
1962,
29889,
29871,
2823,
8744,
297,
21433,
29889,
2272,
29889,
13,
4706,
9995,
13,
13,
4706,
9920,
29918,
1807,
353,
525,
5559,
6664,
29899,
1761,
1192,
497,
1192,
2798,
29915,
13,
4706,
9063,
29918,
7827,
353,
8260,
29889,
7978,
29918,
6519,
29898,
20095,
29892,
9920,
29918,
1807,
29892,
1480,
29922,
8824,
29892,
11815,
29922,
29953,
29900,
29900,
29892,
521,
3972,
29922,
20095,
29918,
3972,
29892,
10446,
29922,
5574,
29897,
13,
13,
4706,
1018,
29901,
13,
9651,
9063,
29918,
7827,
353,
938,
29898,
15060,
29918,
7827,
29897,
13,
4706,
5174,
20948,
29901,
13,
9651,
1596,
703,
1217,
25741,
3447,
1159,
13,
9651,
736,
13,
13,
4706,
9920,
29918,
1807,
353,
6702,
5559,
1480,
1192,
497,
1192,
1949,
6112,
1192,
1256,
29922,
10718,
29899,
710,
919,
29899,
2997,
1192,
1457,
4349,
29922,
4830,
11283,
13,
462,
418,
718,
349,
1525,
29911,
15631,
29918,
20785,
29897,
13,
13,
13,
4706,
1833,
29918,
15060,
353,
6213,
13,
4706,
2302,
353,
29871,
29900,
13,
4706,
3001,
29918,
2055,
1169,
353,
5159,
13,
4706,
3001,
29918,
1445,
29918,
25990,
353,
5159,
13,
4706,
3001,
29918,
5325,
353,
5159,
13,
13,
4706,
5534,
12729,
1806,
3210,
29918,
18736,
13,
13,
4706,
822,
7834,
29898,
1220,
1125,
13,
9651,
9995,
13,
9651,
445,
775,
10174,
1432,
1196,
515,
278,
1962,
13,
9651,
9995,
13,
13,
9651,
1661,
2997,
1833,
29918,
15060,
13,
9651,
1661,
2997,
2302,
13,
13,
9651,
565,
2302,
1273,
29871,
29906,
29900,
29900,
1275,
29871,
29900,
29901,
13,
18884,
1596,
703,
1557,
9450,
313,
20095,
16664,
29879,
29897,
313,
8513,
16664,
29879,
1125,
1273,
29879,
22584,
29879,
29908,
1273,
313,
20095,
29892,
4464,
29892,
2302,
29892,
9063,
29918,
7827,
876,
13,
9651,
565,
2302,
1273,
29871,
29906,
29900,
29900,
29900,
1275,
29871,
29900,
29901,
13,
18884,
1067,
29879,
29889,
8645,
29895,
29918,
3258,
29898,
7827,
29918,
2055,
1169,
29892,
3001,
29918,
5325,
29892,
3001,
29918,
1445,
29918,
25990,
29897,
13,
13,
9651,
565,
451,
1196,
470,
1196,
1275,
6634,
29876,
1115,
13,
18884,
396,
2158,
703,
29943,
29896,
1159,
13,
18884,
736,
5852,
396,
6773,
13,
13,
13,
9651,
25342,
1196,
29889,
27382,
2541,
29898,
2287,
29931,
1125,
13,
13,
18884,
9063,
353,
1067,
29879,
29889,
8411,
29918,
12765,
29918,
19678,
29898,
20095,
29892,
1196,
29892,
4464,
29897,
13,
18884,
565,
1833,
29918,
15060,
2804,
9063,
29901,
13,
462,
1678,
2302,
353,
2302,
718,
29871,
29896,
13,
462,
1678,
1833,
29918,
15060,
353,
9063,
13,
462,
1678,
3001,
29918,
2055,
1169,
29889,
4397,
29898,
15060,
29897,
13,
18884,
736,
5852,
13,
13,
9651,
25342,
376,
13221,
451,
505,
738,
25741,
3447,
29908,
297,
1196,
29901,
13,
18884,
396,
2158,
703,
2574,
3262,
29892,
694,
25741,
3447,
1159,
13,
18884,
736,
7700,
13,
13,
9651,
1683,
29901,
13,
18884,
565,
4464,
2804,
525,
1523,
2415,
2396,
13,
462,
1678,
4974,
1833,
29918,
15060,
338,
451,
6213,
13,
462,
1678,
1067,
29879,
29889,
8411,
29918,
1445,
29918,
19678,
29898,
20095,
29892,
1196,
29892,
1833,
29918,
15060,
29892,
4464,
29892,
3001,
29918,
5325,
29892,
3001,
29918,
1445,
29918,
25990,
29897,
13,
18884,
736,
5852,
13,
13,
13,
4706,
8260,
29889,
7978,
29918,
6519,
29898,
20095,
29892,
9920,
29918,
1807,
29892,
1480,
29922,
8824,
29892,
11815,
29922,
29896,
29906,
29900,
29900,
29892,
521,
3972,
29922,
20095,
29918,
3972,
29892,
7834,
29922,
13789,
29897,
13,
4706,
1067,
29879,
29889,
8645,
29895,
29918,
3258,
29898,
7827,
29918,
2055,
1169,
29892,
3001,
29918,
5325,
29892,
3001,
29918,
1445,
29918,
25990,
29897,
13,
13,
4706,
736,
5852,
13,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
1653,
29918,
1445,
29898,
25932,
29892,
2989,
29918,
2084,
29892,
9063,
29892,
425,
29892,
301,
29878,
29892,
7581,
29892,
4464,
29892,
3001,
29918,
5325,
29892,
3001,
29918,
1445,
29918,
25990,
1125,
13,
4706,
9995,
13,
4706,
2860,
591,
505,
10478,
25741,
29892,
445,
740,
10017,
2845,
12745,
470,
3497,
7277,
3618,
13,
4706,
8679,
373,
825,
885,
7310,
1209,
591,
526,
2734,
1549,
29889,
13,
4706,
9995,
13,
13,
4706,
4974,
9063,
338,
451,
6213,
13,
4706,
4974,
4464,
297,
518,
525,
2283,
742,
525,
2283,
7277,
29915,
4514,
13,
13,
4706,
285,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
8159,
29918,
2084,
29897,
13,
13,
4706,
396,
1284,
278,
6081,
13,
4706,
313,
3383,
1294,
29897,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
8159,
29918,
2084,
29897,
13,
4706,
2224,
353,
2897,
29889,
2084,
29889,
25721,
29898,
8159,
29918,
2084,
29897,
13,
13,
4706,
565,
4464,
1275,
525,
2283,
2396,
13,
13,
9651,
396,
2767,
278,
5534,
934,
1203,
411,
278,
1196,
18139,
13,
13,
9651,
3001,
29918,
5325,
29889,
4397,
29898,
2283,
29898,
13,
18884,
13761,
29922,
15060,
29889,
20095,
29892,
13,
18884,
2224,
29922,
2084,
29892,
13,
18884,
1024,
29922,
29888,
978,
29892,
13,
18884,
1294,
29922,
1062,
29892,
13,
18884,
7581,
29922,
19541,
13,
632,
876,
13,
13,
9651,
396,
16437,
8949,
1529,
29934,
29968,
13,
13,
4706,
25342,
4464,
1275,
525,
2283,
7277,
2396,
13,
13,
9651,
934,
353,
1067,
29879,
29889,
657,
29918,
1445,
29898,
15060,
29889,
20095,
29892,
2224,
29892,
285,
978,
29897,
13,
13,
9651,
565,
934,
338,
6213,
29901,
13,
18884,
396,
445,
9273,
29915,
29873,
3799,
29892,
541,
565,
591,
679,
1244,
278,
13812,
756,
263,
6494,
29889,
13,
18884,
12020,
8960,
703,
29943,
1299,
1964,
29892,
341,
29902,
1799,
4214,
24080,
5195,
29907,
25593,
29892,
317,
8187,
29965,
10249,
29940,
29915,
29911,
20700,
379,
27267,
29991,
1159,
13,
13,
9651,
3001,
29918,
1445,
29918,
25990,
29889,
4397,
29898,
2283,
7277,
29898,
13,
462,
1678,
9063,
29922,
15060,
29892,
13,
462,
1678,
3454,
29918,
23959,
29922,
433,
29892,
13,
462,
1678,
3454,
29918,
1745,
8238,
29922,
29212,
29892,
13,
462,
1678,
934,
29922,
1445,
13,
632,
876,
13,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
7087,
29898,
1311,
29892,
817,
280,
29892,
14842,
1429,
29892,
2684,
29922,
8824,
29892,
17151,
29918,
6333,
29922,
8824,
1125,
13,
13,
4706,
9995,
13,
4706,
910,
740,
338,
1304,
491,
278,
2752,
775,
21166,
4682,
304,
1074,
565,
263,
934,
2224,
13,
4706,
7087,
385,
4603,
470,
451,
29889,
13,
4706,
9995,
13,
13,
4706,
396,
29871,
1404,
1881,
1122,
367,
22435,
9696,
1048,
25053,
24765,
267,
577,
367,
25706,
13,
4706,
565,
14842,
1429,
29889,
1975,
2541,
11974,
29908,
1125,
13,
9651,
14842,
1429,
353,
14842,
1429,
7503,
29899,
29896,
29962,
13,
4706,
565,
817,
280,
29889,
1975,
2541,
11974,
29908,
1125,
13,
9651,
817,
280,
353,
817,
280,
7503,
29899,
29896,
29962,
13,
13,
4706,
565,
17151,
29918,
6333,
29901,
13,
9651,
396,
363,
6081,
8454,
29892,
437,
451,
1996,
278,
1404,
1881,
304,
367,
11393,
1526,
29946,
29908,
304,
2099,
376,
1526,
29946,
29908,
13,
9651,
14842,
1429,
353,
14842,
1429,
29889,
6506,
17350,
3284,
1159,
13,
9651,
817,
280,
353,
817,
280,
29889,
6506,
17350,
613,
20569,
13,
13,
4706,
565,
376,
3026,
297,
817,
280,
470,
376,
20605,
297,
817,
280,
470,
376,
3366,
297,
817,
280,
29901,
13,
9651,
396,
445,
3430,
763,
263,
7876,
4352,
4766,
13,
9651,
736,
7876,
4352,
29889,
9144,
4352,
29898,
29882,
388,
1429,
29892,
817,
280,
29897,
13,
4706,
25342,
2684,
29901,
13,
9651,
396,
591,
526,
9068,
385,
6081,
29892,
1996,
385,
2684,
1993,
13,
13,
13,
9651,
736,
14842,
1429,
1275,
817,
280,
13,
4706,
1683,
29901,
13,
9651,
396,
591,
526,
9068,
10898,
29892,
451,
17752,
29892,
577,
925,
1996,
372,
304,
1369,
411,
278,
28228,
13,
9651,
736,
14842,
1429,
29889,
27382,
2541,
29898,
26180,
280,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
756,
29918,
20317,
29898,
25932,
29892,
817,
793,
29892,
14842,
1429,
29892,
2684,
29922,
8824,
29892,
17151,
29918,
6333,
29922,
8824,
1125,
13,
4706,
9995,
13,
4706,
6987,
3692,
263,
934,
4766,
756,
738,
697,
310,
2999,
7087,
13,
4706,
9995,
13,
13,
4706,
363,
817,
280,
297,
817,
793,
29901,
13,
9651,
565,
1067,
29879,
29889,
20317,
29898,
26180,
280,
29892,
14842,
1429,
29892,
2684,
29922,
735,
627,
29892,
17151,
29918,
6333,
29922,
15450,
29918,
6333,
1125,
13,
18884,
736,
5852,
13,
4706,
736,
7700,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
756,
29918,
1217,
29918,
20317,
29898,
25932,
29892,
817,
793,
29892,
14842,
1429,
29892,
2684,
29922,
8824,
29892,
17151,
29918,
6333,
29922,
8824,
1125,
13,
4706,
736,
451,
1067,
29879,
29889,
5349,
29918,
20317,
29898,
26180,
793,
29892,
14842,
1429,
29892,
2684,
29922,
735,
627,
29892,
17151,
29918,
6333,
29922,
15450,
29918,
6333,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
26032,
29918,
11631,
29918,
2084,
29898,
25932,
29892,
2224,
1125,
13,
4706,
9995,
13,
4706,
17766,
4902,
1048,
16229,
297,
6315,
1480,
491,
27826,
2224,
3161,
763,
847,
29912,
990,
4261,
510,
6822,
13,
4706,
304,
925,
1480,
278,
934,
297,
278,
2186,
2224,
29889,
910,
674,
10075,
2367,
4160,
16200,
363,
13,
4706,
21420,
310,
263,
4337,
541,
445,
1554,
591,
508,
26987,
2678,
29889,
2216,
1854,
565,
372,
947,
448,
16379,
29928,
29889,
13,
4706,
9995,
13,
4706,
736,
24080,
29918,
10145,
29918,
29934,
1430,
25797,
29918,
1525,
29889,
1491,
29898,
29878,
12764,
29896,
29905,
29906,
742,
2224,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
881,
29918,
5014,
29918,
2084,
29898,
25932,
29892,
13761,
29892,
2224,
1125,
13,
4706,
9995,
13,
4706,
830,
7036,
5285,
11286,
21166,
2729,
373,
2224,
29892,
304,
11097,
304,
2380,
470,
451,
29899,
2248,
13,
4706,
3058,
2066,
29889,
29871,
910,
1795,
367,
1304,
304,
871,
2380,
263,
525,
4351,
22208,
3884,
470,
6467,
451,
13,
4706,
2380,
263,
3884,
2000,
525,
2640,
29914,
742,
322,
338,
1283,
491,
2322,
29889,
29871,
910,
740,
17766,
13,
4706,
263,
10608,
373,
3692,
304,
1889,
263,
2224,
29889,
13,
4706,
9995,
13,
13,
4706,
1638,
353,
13761,
29889,
6388,
2133,
13,
4706,
3884,
29918,
9536,
353,
13761,
29889,
1557,
7310,
29918,
12322,
29918,
9536,
29918,
1761,
470,
1638,
29889,
1557,
7310,
29918,
12322,
29918,
9536,
29918,
1761,
13,
4706,
3884,
29918,
1145,
29891,
29871,
353,
13761,
29889,
1557,
7310,
29918,
12322,
29918,
1145,
29891,
29918,
1761,
470,
1638,
29889,
1557,
7310,
29918,
12322,
29918,
1145,
29891,
29918,
1761,
13,
13,
4706,
6081,
29918,
9536,
353,
13761,
29889,
1557,
7310,
29918,
17588,
29918,
9536,
29918,
1761,
470,
1638,
29889,
1557,
7310,
29918,
17588,
29918,
9536,
29918,
1761,
13,
4706,
6081,
29918,
1145,
29891,
353,
13761,
29889,
1557,
7310,
29918,
17588,
29918,
1145,
29891,
29918,
1761,
470,
1638,
29889,
1557,
7310,
29918,
17588,
29918,
1145,
29891,
29918,
1761,
13,
13,
4706,
4516,
978,
353,
2897,
29889,
2084,
29889,
25721,
29898,
2084,
29897,
13,
4706,
6219,
29918,
1062,
353,
2897,
29889,
2084,
29889,
23579,
568,
486,
29898,
2084,
29897,
13,
13,
4706,
6081,
353,
6213,
13,
4706,
565,
7431,
29898,
5451,
29918,
1062,
29897,
1405,
29871,
29896,
29901,
13,
9651,
6081,
353,
6219,
29918,
1062,
14352,
29896,
29962,
13,
13,
4706,
565,
3884,
29918,
9536,
29901,
13,
9651,
3884,
29918,
9536,
353,
3884,
29918,
9536,
29889,
5451,
14182,
29876,
1159,
13,
4706,
565,
3884,
29918,
1145,
29891,
29901,
13,
9651,
3884,
29918,
1145,
29891,
353,
3884,
29918,
1145,
29891,
29889,
5451,
14182,
29876,
1159,
13,
4706,
565,
6081,
29918,
9536,
29901,
13,
9651,
6081,
29918,
9536,
353,
6081,
29918,
9536,
29889,
5451,
14182,
29876,
1159,
13,
4706,
565,
6081,
29918,
1145,
29891,
29901,
13,
9651,
6081,
29918,
1145,
29891,
353,
6081,
29918,
1145,
29891,
29889,
5451,
14182,
29876,
1159,
13,
13,
13,
4706,
565,
3884,
29918,
9536,
322,
1067,
29879,
29889,
5349,
29918,
1217,
29918,
20317,
29898,
12322,
29918,
9536,
29892,
4516,
978,
1125,
13,
9651,
736,
7700,
13,
13,
4706,
565,
3884,
29918,
1145,
29891,
322,
1067,
29879,
29889,
5349,
29918,
20317,
29898,
12322,
29918,
1145,
29891,
29892,
4516,
978,
1125,
13,
9651,
736,
7700,
13,
13,
4706,
565,
6081,
29901,
13,
9651,
565,
6081,
29918,
9536,
322,
1067,
29879,
29889,
5349,
29918,
1217,
29918,
20317,
29898,
17588,
29918,
9536,
29892,
6081,
29892,
2684,
29922,
5574,
29892,
17151,
29918,
6333,
29922,
5574,
1125,
13,
18884,
736,
7700,
13,
13,
9651,
565,
6081,
29918,
1145,
29891,
322,
1067,
29879,
29889,
5349,
29918,
20317,
29898,
17588,
29918,
1145,
29891,
29892,
6081,
29892,
2684,
29922,
5574,
29892,
17151,
29918,
6333,
29922,
5574,
1125,
13,
18884,
736,
7700,
13,
13,
4706,
736,
5852,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
4386,
29918,
1445,
29918,
19678,
29898,
25932,
29892,
13761,
29892,
1196,
29892,
1833,
29918,
15060,
29892,
4464,
29892,
3001,
29918,
5325,
29892,
3001,
29918,
1445,
29918,
25990,
1125,
13,
13,
4706,
9995,
13,
4706,
1889,
278,
1051,
310,
934,
3620,
297,
445,
9063,
13,
4706,
9995,
13,
13,
4706,
18897,
353,
1196,
29889,
5451,
580,
13,
4706,
313,
23959,
29892,
6206,
29892,
2224,
29897,
353,
313,
517,
12360,
29961,
29900,
1402,
18897,
29961,
29896,
1402,
525,
4286,
7122,
29898,
517,
12360,
29961,
29906,
29901,
12622,
13,
13,
13,
4706,
396,
7581,
2066,
674,
505,
17411,
29915,
297,
1009,
1746,
3620,
29889,
3789,
1438,
304,
29871,
29900,
13,
4706,
7581,
353,
7700,
13,
4706,
565,
2715,
1275,
17411,
2396,
13,
9651,
7581,
353,
5852,
13,
9651,
2715,
353,
29871,
29900,
13,
4706,
565,
6206,
1275,
17411,
2396,
13,
9651,
7581,
353,
5852,
13,
9651,
6206,
353,
29871,
29900,
13,
13,
4706,
396,
383,
6415,
2303,
29901,
746,
885,
9450,
697,
13761,
29892,
278,
2715,
1347,
1712,
9446,
13,
13,
4706,
1018,
29901,
13,
9651,
2715,
353,
938,
29898,
23959,
29897,
13,
9651,
6206,
353,
938,
29898,
1745,
8238,
29897,
13,
4706,
5174,
29901,
13,
9651,
396,
383,
6415,
2303,
29901,
13,
9651,
396,
306,
1476,
697,
2777,
297,
697,
13761,
988,
278,
525,
23959,
29915,
1426,
3639,
376,
27392,
29901,
297,
735,
627,
29908,
322,
297,
445,
1206,
13,
9651,
396,
591,
1795,
408,
1532,
3013,
2675,
29892,
591,
3117,
817,
304,
6088,
278,
1196,
17587,
297,
445,
2777,
29889,
13,
9651,
396,
1342,
1476,
297,
413,
17547,
29914,
29895,
17547,
373,
18546,
29889,
910,
3407,
338,
451,
385,
1095,
943,
882,
29889,
13,
9651,
2715,
353,
29871,
29900,
13,
9651,
6206,
353,
29871,
29900,
13,
13,
4706,
2224,
353,
1067,
29879,
29889,
3445,
1466,
29918,
11631,
29918,
2084,
29898,
2084,
29897,
13,
13,
4706,
565,
451,
1067,
29879,
29889,
9344,
29918,
5014,
29918,
2084,
29898,
20095,
29892,
2224,
1125,
13,
9651,
736,
6213,
13,
13,
4706,
1067,
29879,
29889,
3258,
29918,
1445,
29898,
2084,
29892,
1833,
29918,
15060,
29892,
2715,
29892,
6206,
29892,
7581,
29892,
4464,
29892,
3001,
29918,
5325,
29892,
3001,
29918,
1445,
29918,
25990,
29897,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
4386,
29918,
12765,
29918,
19678,
29898,
25932,
29892,
13761,
29892,
1196,
29892,
4464,
1125,
13,
13,
4706,
9995,
13,
4706,
1889,
278,
5253,
310,
3454,
3939,
297,
445,
9063,
13,
4706,
9995,
13,
13,
13,
4706,
396,
383,
6415,
2303,
29901,
2367,
599,
1438,
4235,
2983,
13,
4706,
1993,
353,
349,
1718,
6304,
29918,
1525,
29889,
4352,
29898,
1220,
29897,
13,
4706,
565,
451,
1993,
29901,
13,
9651,
12020,
8960,
703,
3970,
2890,
29940,
29915,
29911,
341,
14789,
29973,
1273,
29879,
29908,
1273,
1196,
29897,
13,
13,
4706,
848,
353,
1993,
29889,
2972,
8977,
580,
13,
4706,
565,
4464,
2804,
525,
1523,
2415,
2396,
13,
9651,
396,
2734,
1250,
1549,
278,
10748,
304,
731,
701,
278,
934,
3620,
13,
9651,
9063,
353,
1876,
277,
29889,
12650,
29889,
657,
29898,
17051,
29922,
1272,
1839,
15060,
11287,
13,
9651,
736,
9063,
13,
13,
4706,
4876,
353,
848,
1839,
8921,
29918,
5269,
2033,
13,
13,
4706,
4148,
29892,
2825,
353,
13361,
29889,
12650,
29889,
657,
29918,
272,
29918,
3258,
29898,
5269,
29922,
5269,
29897,
13,
13,
4706,
9063,
29918,
1256,
353,
6088,
29918,
12673,
29898,
1272,
1839,
15060,
29918,
1256,
11287,
13,
4706,
4148,
29918,
1256,
353,
6088,
29918,
12673,
29898,
1272,
1839,
8921,
29918,
1256,
11287,
13,
13,
4706,
396,
674,
1209,
373,
304,
21610,
29918,
3258,
13,
4706,
736,
1876,
277,
29898,
13,
9651,
528,
29874,
29922,
1272,
1839,
15060,
7464,
13,
9651,
4967,
29922,
1272,
1839,
16009,
7464,
13,
9651,
13761,
29922,
20095,
29892,
13,
9651,
4148,
29922,
8921,
29892,
13,
9651,
4148,
29918,
1256,
29922,
8921,
29918,
1256,
29892,
13,
9651,
9063,
29918,
1256,
29922,
15060,
29918,
1256,
13,
4706,
1723,
13,
2
] |
tests/test_integration_features.py | daviesje/21cmFAST | 28 | 126268 | """
A set of large-scale tests which test code updates against previously-run "golden"
results.
The idea here is that any new updates (except for major versions) should be non-breaking;
firstly, they should not break the API, so that the tests should run without crashing without
being changed.
Secondly, the actual results of running the basic functions should remain the same for
the same input code, except for potential bug-fixes. In these cases, these tests should
pick these changes up. The test data should then be changed to reflect the new gold
standard, and if applicable, a new test should be written that reflects the previous
broken code.
Thirdly, it enforces that new features, where possible, are added in such a way as to
keep the default behaviour constant. That is, the tests here should *not* run the added
feature, and therefore should continue to produce the same test results regardless of
the new feature added. The new feature should be accompanied by its own tests, whether
in this or another test module. If a new feature *must* be included by default, then
it must be implemented in a new major version of the code, at which point the test data
is able to be updated.
Comparison tests here are meant to be as small as possible while attempting to form
a reasonable test: they should be of reduced data such as power spectra or global xHI
measurements, and they should be generated with small simulations.
"""
import pytest
import h5py
import logging
import matplotlib as mpl
import numpy as np
from py21cmfast import config, global_params
from . import produce_integration_test_data as prd
logger = logging.getLogger("21cmFAST")
logger.setLevel(logging.INFO)
options = list(prd.OPTIONS.keys())
options_pt = list(prd.OPTIONS_PT.keys())
options_halo = list(prd.OPTIONS_HALO.keys())
@pytest.mark.parametrize("name", options)
def test_power_spectra_coeval(name, module_direc, plt):
redshift, kwargs = prd.OPTIONS[name]
print(f"Options used for the test at z={redshift}: ", kwargs)
# First get pre-made data
with h5py.File(prd.get_filename("power_spectra", name), "r") as fl:
true_powers = {
"_".join(key.split("_")[1:]): value[...]
for key, value in fl["coeval"].items()
if key.startswith("power_")
}
# Now compute the Coeval object
with config.use(direc=module_direc, regenerate=False, write=True):
with global_params.use(zprime_step_factor=prd.DEFAULT_ZPRIME_STEP_FACTOR):
# Note that if zprime_step_factor is set in kwargs, it will over-ride this.
test_k, test_powers, _ = prd.produce_coeval_power_spectra(
redshift, **kwargs
)
if plt == mpl.pyplot:
make_coeval_comparison_plot(test_k, true_powers, test_powers, plt)
for key, value in true_powers.items():
print(f"Testing {key}")
assert np.sum(~np.isclose(value, test_powers[key], atol=0, rtol=1e-2)) < 10
np.testing.assert_allclose(value, test_powers[key], atol=0, rtol=1e-1)
@pytest.mark.parametrize("name", options)
def test_power_spectra_lightcone(name, module_direc, plt):
redshift, kwargs = prd.OPTIONS[name]
print(f"Options used for the test at z={redshift}: ", kwargs)
# First get pre-made data
with h5py.File(prd.get_filename("power_spectra", name), "r") as fl:
true_powers = {}
true_global = {}
for key in fl["lightcone"].keys():
if key.startswith("power_"):
true_powers["_".join(key.split("_")[1:])] = fl["lightcone"][key][...]
elif key.startswith("global_"):
true_global[key] = fl["lightcone"][key][...]
# Now compute the lightcone
with config.use(direc=module_direc, regenerate=False, write=True):
with global_params.use(zprime_step_factor=prd.DEFAULT_ZPRIME_STEP_FACTOR):
# Note that if zprime_step_factor is set in kwargs, it will over-ride this.
test_k, test_powers, lc = prd.produce_lc_power_spectra(redshift, **kwargs)
if plt == mpl.pyplot:
make_lightcone_comparison_plot(
test_k, lc.node_redshifts, true_powers, true_global, test_powers, lc, plt
)
for key, value in true_powers.items():
print(f"Testing {key}")
# Ensure all but 10 of the values is within 1%, and none of the values
# is outside 10%
assert np.sum(~np.isclose(value, test_powers[key], atol=0, rtol=1e-2)) < 10
assert np.allclose(value, test_powers[key], atol=0, rtol=1e-1)
for key, value in true_global.items():
print(f"Testing Global {key}")
assert np.allclose(value, getattr(lc, key), atol=0, rtol=1e-3)
def make_lightcone_comparison_plot(
k, z, true_powers, true_global, test_powers, lc, plt
):
n = len(true_global) + len(true_powers)
fig, ax = plt.subplots(2, n, figsize=(3 * n, 5))
for i, (key, val) in enumerate(true_powers.items()):
make_comparison_plot(
k, val, test_powers[key], ax[:, i], xlab="k", ylab=f"{key} Power"
)
for i, (key, val) in enumerate(true_global.items(), start=i + 1):
make_comparison_plot(
z, val, getattr(lc, key), ax[:, i], xlab="z", ylab=f"{key}"
)
def make_coeval_comparison_plot(k, true_powers, test_powers, plt):
fig, ax = plt.subplots(
2, len(true_powers), figsize=(3 * len(true_powers), 6), sharex=True
)
for i, (key, val) in enumerate(true_powers.items()):
make_comparison_plot(
k, val, test_powers[key], ax[:, i], xlab="k", ylab=f"{key} Power"
)
def make_comparison_plot(x, true, test, ax, logx=True, logy=True, xlab=None, ylab=None):
ax[0].plot(x, true, label="True")
ax[0].plot(x, test, label="Test")
if logx:
ax[0].set_xscale("log")
if logy:
ax[0].set_yscale("log")
if xlab:
ax[0].set_xlabel(xlab)
if ylab:
ax[0].set_ylabel(ylab)
ax[0].legend()
ax[1].plot(x, (test - true) / true)
ax[1].set_ylabel("Fractional Difference")
@pytest.mark.parametrize("name", options_pt)
def test_perturb_field_data(name):
redshift, kwargs = prd.OPTIONS_PT[name]
print("Options used for the test: ", kwargs)
# First get pre-made data
with h5py.File(prd.get_filename("perturb_field_data", name), "r") as f:
power_dens = f["power_dens"][...]
power_vel = f["power_vel"][...]
pdf_dens = f["pdf_dens"][...]
pdf_vel = f["pdf_vel"][...]
with global_params.use(zprime_step_factor=prd.DEFAULT_ZPRIME_STEP_FACTOR):
# Note that if zprime_step_factor is set in kwargs, it will over-ride this.
(
k_dens,
p_dens,
k_vel,
p_vel,
x_dens,
y_dens,
x_vel,
y_vel,
ic,
) = prd.produce_perturb_field_data(redshift, **kwargs)
assert np.allclose(power_dens, p_dens, atol=5e-3, rtol=1e-3)
assert np.allclose(power_vel, p_vel, atol=5e-3, rtol=1e-3)
assert np.allclose(pdf_dens, y_dens, atol=5e-3, rtol=1e-3)
assert np.allclose(pdf_vel, y_vel, atol=5e-3, rtol=1e-3)
@pytest.mark.parametrize("name", options_halo)
def test_halo_field_data(name):
redshift, kwargs = prd.OPTIONS_HALO[name]
print("Options used for the test: ", kwargs)
# First get pre-made data
with h5py.File(prd.get_filename("halo_field_data", name), "r") as f:
n_pt_halos = f["n_pt_halos"][...]
pt_halo_masses = f["pt_halo_masses"][...]
with global_params.use(zprime_step_factor=prd.DEFAULT_ZPRIME_STEP_FACTOR):
# Note that if zprime_step_factor is set in kwargs, it will over-ride this.
pt_halos = prd.produce_halo_field_data(redshift, **kwargs)
assert np.allclose(n_pt_halos, pt_halos.n_halos, atol=5e-3, rtol=1e-3)
assert np.allclose(
np.sum(pt_halo_masses), np.sum(pt_halos.halo_masses), atol=5e-3, rtol=1e-3
)
| [
1,
9995,
13,
29909,
731,
310,
2919,
29899,
7052,
6987,
607,
1243,
775,
11217,
2750,
9251,
29899,
3389,
376,
29887,
1025,
264,
29908,
13,
9902,
29889,
13,
13,
1576,
2969,
1244,
338,
393,
738,
716,
11217,
313,
19499,
363,
4655,
6910,
29897,
881,
367,
1661,
29899,
1030,
5086,
29936,
13,
4102,
368,
29892,
896,
881,
451,
2867,
278,
3450,
29892,
577,
393,
278,
6987,
881,
1065,
1728,
8095,
292,
1728,
13,
915,
292,
3939,
29889,
13,
11863,
368,
29892,
278,
3935,
2582,
310,
2734,
278,
6996,
3168,
881,
3933,
278,
1021,
363,
13,
1552,
1021,
1881,
775,
29892,
5174,
363,
7037,
6494,
29899,
5878,
267,
29889,
512,
1438,
4251,
29892,
1438,
6987,
881,
13,
23945,
1438,
3620,
701,
29889,
450,
1243,
848,
881,
769,
367,
3939,
304,
9432,
278,
716,
7684,
13,
15770,
29892,
322,
565,
22903,
29892,
263,
716,
1243,
881,
367,
3971,
393,
9432,
29879,
278,
3517,
13,
6729,
1717,
775,
29889,
13,
1349,
1823,
368,
29892,
372,
24555,
778,
393,
716,
5680,
29892,
988,
1950,
29892,
526,
2715,
297,
1316,
263,
982,
408,
304,
13,
17462,
278,
2322,
10468,
4868,
29889,
2193,
338,
29892,
278,
6987,
1244,
881,
334,
1333,
29930,
1065,
278,
2715,
13,
14394,
29892,
322,
5480,
881,
6773,
304,
7738,
278,
1021,
1243,
2582,
17126,
310,
13,
1552,
716,
4682,
2715,
29889,
450,
716,
4682,
881,
367,
21302,
491,
967,
1914,
6987,
29892,
3692,
13,
262,
445,
470,
1790,
1243,
3883,
29889,
960,
263,
716,
4682,
334,
21969,
29930,
367,
5134,
491,
2322,
29892,
769,
13,
277,
1818,
367,
8762,
297,
263,
716,
4655,
1873,
310,
278,
775,
29892,
472,
607,
1298,
278,
1243,
848,
13,
275,
2221,
304,
367,
4784,
29889,
13,
13,
1523,
20941,
6987,
1244,
526,
6839,
304,
367,
408,
2319,
408,
1950,
1550,
15661,
304,
883,
13,
29874,
15590,
1243,
29901,
896,
881,
367,
310,
12212,
848,
1316,
408,
3081,
6683,
336,
470,
5534,
921,
17628,
13,
26658,
1860,
29892,
322,
896,
881,
367,
5759,
411,
2319,
23876,
29889,
13,
15945,
29908,
13,
5215,
11451,
1688,
13,
13,
5215,
298,
29945,
2272,
13,
5215,
12183,
13,
5215,
22889,
408,
286,
572,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
11451,
29906,
29896,
4912,
11255,
1053,
2295,
29892,
5534,
29918,
7529,
13,
13,
3166,
869,
1053,
7738,
29918,
27925,
29918,
1688,
29918,
1272,
408,
544,
29881,
13,
13,
21707,
353,
12183,
29889,
657,
16363,
703,
29906,
29896,
4912,
4519,
1254,
1159,
13,
21707,
29889,
842,
10108,
29898,
21027,
29889,
11690,
29897,
13,
13,
13,
6768,
353,
1051,
29898,
558,
29881,
29889,
14094,
27946,
29889,
8149,
3101,
13,
6768,
29918,
415,
353,
1051,
29898,
558,
29881,
29889,
14094,
27946,
29918,
7982,
29889,
8149,
3101,
13,
6768,
29918,
4077,
29877,
353,
1051,
29898,
558,
29881,
29889,
14094,
27946,
29918,
29950,
1964,
29949,
29889,
8149,
3101,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
978,
613,
3987,
29897,
13,
1753,
1243,
29918,
13519,
29918,
21494,
336,
29918,
1111,
14513,
29898,
978,
29892,
3883,
29918,
20146,
29883,
29892,
14770,
1125,
13,
1678,
2654,
10889,
29892,
9049,
5085,
353,
544,
29881,
29889,
14094,
27946,
29961,
978,
29962,
13,
1678,
1596,
29898,
29888,
29908,
5856,
1304,
363,
278,
1243,
472,
503,
3790,
1127,
10889,
6177,
9162,
9049,
5085,
29897,
13,
13,
1678,
396,
3824,
679,
758,
29899,
26350,
848,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
558,
29881,
29889,
657,
29918,
9507,
703,
13519,
29918,
21494,
336,
613,
1024,
511,
376,
29878,
1159,
408,
1652,
29901,
13,
4706,
1565,
29918,
12248,
414,
353,
426,
13,
9651,
11119,
1642,
7122,
29898,
1989,
29889,
5451,
703,
29918,
1159,
29961,
29896,
17531,
1125,
995,
29961,
17361,
13,
9651,
363,
1820,
29892,
995,
297,
1652,
3366,
1111,
14513,
16862,
7076,
580,
13,
9651,
565,
1820,
29889,
27382,
2541,
703,
13519,
29918,
1159,
13,
4706,
500,
13,
13,
1678,
396,
2567,
10272,
278,
3189,
14513,
1203,
13,
1678,
411,
2295,
29889,
1509,
29898,
20146,
29883,
29922,
5453,
29918,
20146,
29883,
29892,
1072,
759,
403,
29922,
8824,
29892,
2436,
29922,
5574,
1125,
13,
4706,
411,
5534,
29918,
7529,
29889,
1509,
29898,
29920,
10080,
29918,
10568,
29918,
19790,
29922,
558,
29881,
29889,
23397,
29918,
29999,
29829,
2303,
29918,
1254,
15488,
29918,
4519,
1783,
1955,
1125,
13,
9651,
396,
3940,
393,
565,
503,
10080,
29918,
10568,
29918,
19790,
338,
731,
297,
9049,
5085,
29892,
372,
674,
975,
29899,
2426,
445,
29889,
13,
9651,
1243,
29918,
29895,
29892,
1243,
29918,
12248,
414,
29892,
903,
353,
544,
29881,
29889,
5498,
346,
29918,
1111,
14513,
29918,
13519,
29918,
21494,
336,
29898,
13,
18884,
2654,
10889,
29892,
3579,
19290,
13,
9651,
1723,
13,
13,
1678,
565,
14770,
1275,
286,
572,
29889,
2272,
5317,
29901,
13,
4706,
1207,
29918,
1111,
14513,
29918,
510,
20941,
29918,
5317,
29898,
1688,
29918,
29895,
29892,
1565,
29918,
12248,
414,
29892,
1243,
29918,
12248,
414,
29892,
14770,
29897,
13,
13,
1678,
363,
1820,
29892,
995,
297,
1565,
29918,
12248,
414,
29889,
7076,
7295,
13,
4706,
1596,
29898,
29888,
29908,
3057,
292,
426,
1989,
27195,
13,
4706,
4974,
7442,
29889,
2083,
29898,
30022,
9302,
29889,
275,
5358,
29898,
1767,
29892,
1243,
29918,
12248,
414,
29961,
1989,
1402,
472,
324,
29922,
29900,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29906,
876,
529,
29871,
29896,
29900,
13,
4706,
7442,
29889,
13424,
29889,
9294,
29918,
497,
5358,
29898,
1767,
29892,
1243,
29918,
12248,
414,
29961,
1989,
1402,
472,
324,
29922,
29900,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29896,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
978,
613,
3987,
29897,
13,
1753,
1243,
29918,
13519,
29918,
21494,
336,
29918,
4366,
535,
29872,
29898,
978,
29892,
3883,
29918,
20146,
29883,
29892,
14770,
1125,
13,
1678,
2654,
10889,
29892,
9049,
5085,
353,
544,
29881,
29889,
14094,
27946,
29961,
978,
29962,
13,
1678,
1596,
29898,
29888,
29908,
5856,
1304,
363,
278,
1243,
472,
503,
3790,
1127,
10889,
6177,
9162,
9049,
5085,
29897,
13,
13,
1678,
396,
3824,
679,
758,
29899,
26350,
848,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
558,
29881,
29889,
657,
29918,
9507,
703,
13519,
29918,
21494,
336,
613,
1024,
511,
376,
29878,
1159,
408,
1652,
29901,
13,
4706,
1565,
29918,
12248,
414,
353,
6571,
13,
4706,
1565,
29918,
10945,
353,
6571,
13,
4706,
363,
1820,
297,
1652,
3366,
4366,
535,
29872,
16862,
8149,
7295,
13,
9651,
565,
1820,
29889,
27382,
2541,
703,
13519,
27508,
1125,
13,
18884,
1565,
29918,
12248,
414,
3366,
29918,
1642,
7122,
29898,
1989,
29889,
5451,
703,
29918,
1159,
29961,
29896,
29901,
2314,
29962,
353,
1652,
3366,
4366,
535,
29872,
3108,
29961,
1989,
3816,
17361,
13,
9651,
25342,
1820,
29889,
27382,
2541,
703,
10945,
27508,
1125,
13,
18884,
1565,
29918,
10945,
29961,
1989,
29962,
353,
1652,
3366,
4366,
535,
29872,
3108,
29961,
1989,
3816,
17361,
13,
13,
1678,
396,
2567,
10272,
278,
3578,
535,
29872,
13,
1678,
411,
2295,
29889,
1509,
29898,
20146,
29883,
29922,
5453,
29918,
20146,
29883,
29892,
1072,
759,
403,
29922,
8824,
29892,
2436,
29922,
5574,
1125,
13,
4706,
411,
5534,
29918,
7529,
29889,
1509,
29898,
29920,
10080,
29918,
10568,
29918,
19790,
29922,
558,
29881,
29889,
23397,
29918,
29999,
29829,
2303,
29918,
1254,
15488,
29918,
4519,
1783,
1955,
1125,
13,
9651,
396,
3940,
393,
565,
503,
10080,
29918,
10568,
29918,
19790,
338,
731,
297,
9049,
5085,
29892,
372,
674,
975,
29899,
2426,
445,
29889,
13,
9651,
1243,
29918,
29895,
29892,
1243,
29918,
12248,
414,
29892,
301,
29883,
353,
544,
29881,
29889,
5498,
346,
29918,
29880,
29883,
29918,
13519,
29918,
21494,
336,
29898,
1127,
10889,
29892,
3579,
19290,
29897,
13,
13,
1678,
565,
14770,
1275,
286,
572,
29889,
2272,
5317,
29901,
13,
4706,
1207,
29918,
4366,
535,
29872,
29918,
510,
20941,
29918,
5317,
29898,
13,
9651,
1243,
29918,
29895,
29892,
301,
29883,
29889,
3177,
29918,
1127,
845,
17741,
29892,
1565,
29918,
12248,
414,
29892,
1565,
29918,
10945,
29892,
1243,
29918,
12248,
414,
29892,
301,
29883,
29892,
14770,
13,
4706,
1723,
13,
13,
1678,
363,
1820,
29892,
995,
297,
1565,
29918,
12248,
414,
29889,
7076,
7295,
13,
4706,
1596,
29898,
29888,
29908,
3057,
292,
426,
1989,
27195,
13,
4706,
396,
22521,
545,
599,
541,
29871,
29896,
29900,
310,
278,
1819,
338,
2629,
29871,
29896,
13667,
322,
5642,
310,
278,
1819,
13,
4706,
396,
338,
5377,
29871,
29896,
29900,
29995,
13,
4706,
4974,
7442,
29889,
2083,
29898,
30022,
9302,
29889,
275,
5358,
29898,
1767,
29892,
1243,
29918,
12248,
414,
29961,
1989,
1402,
472,
324,
29922,
29900,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29906,
876,
529,
29871,
29896,
29900,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
1767,
29892,
1243,
29918,
12248,
414,
29961,
1989,
1402,
472,
324,
29922,
29900,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29896,
29897,
13,
13,
1678,
363,
1820,
29892,
995,
297,
1565,
29918,
10945,
29889,
7076,
7295,
13,
4706,
1596,
29898,
29888,
29908,
3057,
292,
12002,
426,
1989,
27195,
13,
4706,
4974,
7442,
29889,
497,
5358,
29898,
1767,
29892,
679,
5552,
29898,
29880,
29883,
29892,
1820,
511,
472,
324,
29922,
29900,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29941,
29897,
13,
13,
13,
1753,
1207,
29918,
4366,
535,
29872,
29918,
510,
20941,
29918,
5317,
29898,
13,
1678,
413,
29892,
503,
29892,
1565,
29918,
12248,
414,
29892,
1565,
29918,
10945,
29892,
1243,
29918,
12248,
414,
29892,
301,
29883,
29892,
14770,
13,
1125,
13,
1678,
302,
353,
7431,
29898,
3009,
29918,
10945,
29897,
718,
7431,
29898,
3009,
29918,
12248,
414,
29897,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
29898,
29906,
29892,
302,
29892,
2537,
2311,
7607,
29941,
334,
302,
29892,
29871,
29945,
876,
13,
13,
1678,
363,
474,
29892,
313,
1989,
29892,
659,
29897,
297,
26985,
29898,
3009,
29918,
12248,
414,
29889,
7076,
580,
1125,
13,
4706,
1207,
29918,
510,
20941,
29918,
5317,
29898,
13,
9651,
413,
29892,
659,
29892,
1243,
29918,
12248,
414,
29961,
1989,
1402,
4853,
7503,
29892,
474,
1402,
921,
8205,
543,
29895,
613,
343,
8205,
29922,
29888,
29908,
29912,
1989,
29913,
9206,
29908,
13,
4706,
1723,
13,
13,
1678,
363,
474,
29892,
313,
1989,
29892,
659,
29897,
297,
26985,
29898,
3009,
29918,
10945,
29889,
7076,
3285,
1369,
29922,
29875,
718,
29871,
29896,
1125,
13,
4706,
1207,
29918,
510,
20941,
29918,
5317,
29898,
13,
9651,
503,
29892,
659,
29892,
679,
5552,
29898,
29880,
29883,
29892,
1820,
511,
4853,
7503,
29892,
474,
1402,
921,
8205,
543,
29920,
613,
343,
8205,
29922,
29888,
29908,
29912,
1989,
5038,
13,
4706,
1723,
13,
13,
13,
1753,
1207,
29918,
1111,
14513,
29918,
510,
20941,
29918,
5317,
29898,
29895,
29892,
1565,
29918,
12248,
414,
29892,
1243,
29918,
12248,
414,
29892,
14770,
1125,
13,
1678,
2537,
29892,
4853,
353,
14770,
29889,
1491,
26762,
29898,
13,
308,
29906,
29892,
7431,
29898,
3009,
29918,
12248,
414,
511,
2537,
2311,
7607,
29941,
334,
7431,
29898,
3009,
29918,
12248,
414,
511,
29871,
29953,
511,
6232,
29916,
29922,
5574,
13,
1678,
1723,
13,
13,
1678,
363,
474,
29892,
313,
1989,
29892,
659,
29897,
297,
26985,
29898,
3009,
29918,
12248,
414,
29889,
7076,
580,
1125,
13,
4706,
1207,
29918,
510,
20941,
29918,
5317,
29898,
13,
9651,
413,
29892,
659,
29892,
1243,
29918,
12248,
414,
29961,
1989,
1402,
4853,
7503,
29892,
474,
1402,
921,
8205,
543,
29895,
613,
343,
8205,
29922,
29888,
29908,
29912,
1989,
29913,
9206,
29908,
13,
4706,
1723,
13,
13,
13,
1753,
1207,
29918,
510,
20941,
29918,
5317,
29898,
29916,
29892,
1565,
29892,
1243,
29892,
4853,
29892,
1480,
29916,
29922,
5574,
29892,
1480,
29891,
29922,
5574,
29892,
921,
8205,
29922,
8516,
29892,
343,
8205,
29922,
8516,
1125,
13,
13,
1678,
4853,
29961,
29900,
1822,
5317,
29898,
29916,
29892,
1565,
29892,
3858,
543,
5574,
1159,
13,
1678,
4853,
29961,
29900,
1822,
5317,
29898,
29916,
29892,
1243,
29892,
3858,
543,
3057,
1159,
13,
1678,
565,
1480,
29916,
29901,
13,
4706,
4853,
29961,
29900,
1822,
842,
29918,
29916,
7052,
703,
1188,
1159,
13,
1678,
565,
1480,
29891,
29901,
13,
4706,
4853,
29961,
29900,
1822,
842,
29918,
952,
29883,
744,
703,
1188,
1159,
13,
1678,
565,
921,
8205,
29901,
13,
4706,
4853,
29961,
29900,
1822,
842,
29918,
29916,
1643,
29898,
29916,
8205,
29897,
13,
1678,
565,
343,
8205,
29901,
13,
4706,
4853,
29961,
29900,
1822,
842,
29918,
29891,
1643,
29898,
2904,
370,
29897,
13,
13,
1678,
4853,
29961,
29900,
1822,
26172,
580,
13,
13,
1678,
4853,
29961,
29896,
1822,
5317,
29898,
29916,
29892,
313,
1688,
448,
1565,
29897,
847,
1565,
29897,
13,
1678,
4853,
29961,
29896,
1822,
842,
29918,
29891,
1643,
703,
29943,
13857,
284,
360,
17678,
1159,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
978,
613,
3987,
29918,
415,
29897,
13,
1753,
1243,
29918,
10700,
9265,
29918,
2671,
29918,
1272,
29898,
978,
1125,
13,
1678,
2654,
10889,
29892,
9049,
5085,
353,
544,
29881,
29889,
14094,
27946,
29918,
7982,
29961,
978,
29962,
13,
1678,
1596,
703,
5856,
1304,
363,
278,
1243,
29901,
9162,
9049,
5085,
29897,
13,
13,
1678,
396,
3824,
679,
758,
29899,
26350,
848,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
558,
29881,
29889,
657,
29918,
9507,
703,
10700,
9265,
29918,
2671,
29918,
1272,
613,
1024,
511,
376,
29878,
1159,
408,
285,
29901,
13,
4706,
3081,
29918,
21518,
353,
285,
3366,
13519,
29918,
21518,
3108,
29961,
17361,
13,
4706,
3081,
29918,
955,
353,
285,
3366,
13519,
29918,
955,
3108,
29961,
17361,
13,
4706,
13552,
29918,
21518,
353,
285,
3366,
5140,
29918,
21518,
3108,
29961,
17361,
13,
4706,
13552,
29918,
955,
353,
285,
3366,
5140,
29918,
955,
3108,
29961,
17361,
13,
13,
1678,
411,
5534,
29918,
7529,
29889,
1509,
29898,
29920,
10080,
29918,
10568,
29918,
19790,
29922,
558,
29881,
29889,
23397,
29918,
29999,
29829,
2303,
29918,
1254,
15488,
29918,
4519,
1783,
1955,
1125,
13,
4706,
396,
3940,
393,
565,
503,
10080,
29918,
10568,
29918,
19790,
338,
731,
297,
9049,
5085,
29892,
372,
674,
975,
29899,
2426,
445,
29889,
13,
4706,
313,
13,
9651,
413,
29918,
21518,
29892,
13,
9651,
282,
29918,
21518,
29892,
13,
9651,
413,
29918,
955,
29892,
13,
9651,
282,
29918,
955,
29892,
13,
9651,
921,
29918,
21518,
29892,
13,
9651,
343,
29918,
21518,
29892,
13,
9651,
921,
29918,
955,
29892,
13,
9651,
343,
29918,
955,
29892,
13,
9651,
16077,
29892,
13,
4706,
1723,
353,
544,
29881,
29889,
5498,
346,
29918,
10700,
9265,
29918,
2671,
29918,
1272,
29898,
1127,
10889,
29892,
3579,
19290,
29897,
13,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
13519,
29918,
21518,
29892,
282,
29918,
21518,
29892,
472,
324,
29922,
29945,
29872,
29899,
29941,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29941,
29897,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
13519,
29918,
955,
29892,
282,
29918,
955,
29892,
472,
324,
29922,
29945,
29872,
29899,
29941,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29941,
29897,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
5140,
29918,
21518,
29892,
343,
29918,
21518,
29892,
472,
324,
29922,
29945,
29872,
29899,
29941,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29941,
29897,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
5140,
29918,
955,
29892,
343,
29918,
955,
29892,
472,
324,
29922,
29945,
29872,
29899,
29941,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29941,
29897,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
978,
613,
3987,
29918,
4077,
29877,
29897,
13,
1753,
1243,
29918,
4077,
29877,
29918,
2671,
29918,
1272,
29898,
978,
1125,
13,
1678,
2654,
10889,
29892,
9049,
5085,
353,
544,
29881,
29889,
14094,
27946,
29918,
29950,
1964,
29949,
29961,
978,
29962,
13,
1678,
1596,
703,
5856,
1304,
363,
278,
1243,
29901,
9162,
9049,
5085,
29897,
13,
13,
1678,
396,
3824,
679,
758,
29899,
26350,
848,
13,
1678,
411,
298,
29945,
2272,
29889,
2283,
29898,
558,
29881,
29889,
657,
29918,
9507,
703,
4077,
29877,
29918,
2671,
29918,
1272,
613,
1024,
511,
376,
29878,
1159,
408,
285,
29901,
13,
4706,
302,
29918,
415,
29918,
4077,
359,
353,
285,
3366,
29876,
29918,
415,
29918,
4077,
359,
3108,
29961,
17361,
13,
4706,
19592,
29918,
4077,
29877,
29918,
25379,
267,
353,
285,
3366,
415,
29918,
4077,
29877,
29918,
25379,
267,
3108,
29961,
17361,
13,
13,
1678,
411,
5534,
29918,
7529,
29889,
1509,
29898,
29920,
10080,
29918,
10568,
29918,
19790,
29922,
558,
29881,
29889,
23397,
29918,
29999,
29829,
2303,
29918,
1254,
15488,
29918,
4519,
1783,
1955,
1125,
13,
4706,
396,
3940,
393,
565,
503,
10080,
29918,
10568,
29918,
19790,
338,
731,
297,
9049,
5085,
29892,
372,
674,
975,
29899,
2426,
445,
29889,
13,
4706,
19592,
29918,
4077,
359,
353,
544,
29881,
29889,
5498,
346,
29918,
4077,
29877,
29918,
2671,
29918,
1272,
29898,
1127,
10889,
29892,
3579,
19290,
29897,
13,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
29876,
29918,
415,
29918,
4077,
359,
29892,
19592,
29918,
4077,
359,
29889,
29876,
29918,
4077,
359,
29892,
472,
324,
29922,
29945,
29872,
29899,
29941,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29941,
29897,
13,
1678,
4974,
7442,
29889,
497,
5358,
29898,
13,
4706,
7442,
29889,
2083,
29898,
415,
29918,
4077,
29877,
29918,
25379,
267,
511,
7442,
29889,
2083,
29898,
415,
29918,
4077,
359,
29889,
4077,
29877,
29918,
25379,
267,
511,
472,
324,
29922,
29945,
29872,
29899,
29941,
29892,
364,
25027,
29922,
29896,
29872,
29899,
29941,
13,
1678,
1723,
13,
2
] |
test/client/device/common/test_thread_base.py | redmic-project/device-oag-buoy-buoy-client | 0 | 107126 | <filename>test/client/device/common/test_thread_base.py
import unittest
from nose.tools import eq_
from buoy.client.device.common.base import BaseThread
from buoy.client.notification.client.common import NoticePriorityQueue
class TestThreadBase(unittest.TestCase):
def setUp(self):
queue_notice = NoticePriorityQueue()
self.thread = BaseThread(queue_notice=queue_notice)
def test_is_aliveReturnFalse_when_createThread(self):
eq_(self.thread.is_alive(), False)
def test_is_aliveReturnFalse_when_stopThread(self):
self.thread.active = True
self.thread.stop()
eq_(self.thread.is_alive(), False)
if __name__ == '__main__':
unittest.main()
| [
1,
529,
9507,
29958,
1688,
29914,
4645,
29914,
10141,
29914,
9435,
29914,
1688,
29918,
7097,
29918,
3188,
29889,
2272,
13,
5215,
443,
27958,
13,
13,
3166,
26414,
29889,
8504,
1053,
11594,
29918,
13,
13,
3166,
1321,
12602,
29889,
4645,
29889,
10141,
29889,
9435,
29889,
3188,
1053,
7399,
4899,
13,
3166,
1321,
12602,
29889,
4645,
29889,
24671,
29889,
4645,
29889,
9435,
1053,
16393,
29925,
21766,
10620,
13,
13,
13,
1990,
4321,
4899,
5160,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
1678,
822,
731,
3373,
29898,
1311,
1125,
13,
4706,
9521,
29918,
1333,
625,
353,
16393,
29925,
21766,
10620,
580,
13,
4706,
1583,
29889,
7097,
353,
7399,
4899,
29898,
9990,
29918,
1333,
625,
29922,
9990,
29918,
1333,
625,
29897,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
284,
573,
11609,
8824,
29918,
8256,
29918,
3258,
4899,
29898,
1311,
1125,
13,
4706,
11594,
23538,
1311,
29889,
7097,
29889,
275,
29918,
284,
573,
3285,
7700,
29897,
13,
13,
1678,
822,
1243,
29918,
275,
29918,
284,
573,
11609,
8824,
29918,
8256,
29918,
9847,
4899,
29898,
1311,
1125,
13,
4706,
1583,
29889,
7097,
29889,
4925,
353,
5852,
13,
13,
4706,
1583,
29889,
7097,
29889,
9847,
580,
13,
4706,
11594,
23538,
1311,
29889,
7097,
29889,
275,
29918,
284,
573,
3285,
7700,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
chap05/list0507.py | ytianjin/GitTest | 0 | 110822 | # 打印输出位的逻辑与运算的结果、逻辑或运算的结果、逻辑异或运算的结果以及取反的结果
a = int(input('正整数a:'))
b = int(input('正整数b:'))
w = int(input('表示位数:'))
f = '{{:0{}b}}'.format(w)
m = 2 ** w - 1 # w位都相当于二进制数的1
print('a = ' + f.format(a))
print('b = ' + f.format(b))
print('a & b = ' + f.format(a & b))
print('a | b = ' + f.format(a | b))
print('a ^ b = ' + f.format(a ^ b))
print('~a = ' + f.format(~a & m))
print('~b = ' + f.format(~b & m)) | [
1,
396,
29871,
31656,
232,
144,
179,
31573,
30544,
30956,
30210,
236,
131,
190,
235,
193,
148,
31267,
31894,
31565,
30210,
31320,
30801,
30330,
236,
131,
190,
235,
193,
148,
31391,
31894,
31565,
30210,
31320,
30801,
30330,
236,
131,
190,
235,
193,
148,
232,
191,
133,
31391,
31894,
31565,
30210,
31320,
30801,
30651,
31436,
30683,
31908,
30210,
31320,
30801,
30004,
13,
30004,
13,
29874,
353,
938,
29898,
2080,
877,
30724,
233,
152,
183,
30354,
29874,
30383,
8785,
6756,
13,
29890,
353,
938,
29898,
2080,
877,
30724,
233,
152,
183,
30354,
29890,
30383,
8785,
6756,
13,
29893,
353,
938,
29898,
2080,
877,
30746,
30858,
30956,
30354,
30383,
8785,
6756,
13,
30004,
13,
29888,
353,
525,
6224,
29901,
29900,
8875,
29890,
930,
4286,
4830,
29898,
29893,
29897,
6756,
13,
29885,
353,
29871,
29906,
3579,
281,
448,
29871,
29896,
539,
396,
281,
30956,
30769,
30990,
30948,
30909,
30685,
31174,
31072,
30354,
30210,
29896,
30004,
13,
30004,
13,
2158,
877,
29874,
353,
525,
718,
285,
29889,
4830,
29898,
29874,
876,
6756,
13,
2158,
877,
29890,
353,
525,
718,
285,
29889,
4830,
29898,
29890,
876,
6756,
13,
2158,
877,
29874,
669,
289,
353,
525,
718,
285,
29889,
4830,
29898,
29874,
669,
289,
876,
6756,
13,
2158,
877,
29874,
891,
289,
353,
525,
718,
285,
29889,
4830,
29898,
29874,
891,
289,
876,
6756,
13,
2158,
877,
29874,
6228,
289,
353,
525,
718,
285,
29889,
4830,
29898,
29874,
6228,
289,
876,
6756,
13,
2158,
877,
30022,
29874,
353,
525,
718,
285,
29889,
4830,
29898,
30022,
29874,
669,
286,
876,
6756,
13,
2158,
877,
30022,
29890,
353,
525,
718,
285,
29889,
4830,
29898,
30022,
29890,
669,
286,
876,
2
] |
src/firebolt/client/client.py | ptiurin/firebolt-python-sdk | 0 | 1617803 | <filename>src/firebolt/client/client.py
from typing import Any, Optional
from async_property import async_cached_property # type: ignore
from httpx import AsyncClient as HttpxAsyncClient
from httpx import Client as HttpxClient
from httpx import _types
from httpx import codes as HttpxCodes
from httpx._types import AuthTypes
from firebolt.client.auth import Auth
from firebolt.client.constants import DEFAULT_API_URL
from firebolt.common.exception import AccountNotFoundError
from firebolt.common.urls import ACCOUNT_BY_NAME_URL, ACCOUNT_URL
from firebolt.common.util import cached_property, fix_url_schema, mixin_for
FireboltClientMixinBase = mixin_for(HttpxClient) # type: Any
class FireboltClientMixin(FireboltClientMixinBase):
def __init__(
self,
*args: Any,
account_name: Optional[str] = None,
api_endpoint: str = DEFAULT_API_URL,
auth: AuthTypes = None,
**kwargs: Any,
):
self.account_name = account_name
self._api_endpoint = fix_url_schema(api_endpoint)
super().__init__(*args, auth=auth, **kwargs)
def _build_auth(self, auth: _types.AuthTypes) -> Optional[Auth]:
if auth is None or isinstance(auth, Auth):
return auth
elif isinstance(auth, tuple):
return Auth(
username=str(auth[0]),
password=str(auth[1]),
api_endpoint=self._api_endpoint,
)
else:
raise TypeError(f'Invalid "auth" argument: {auth!r}')
class Client(FireboltClientMixin, HttpxClient):
"""
An http client, based on httpx.Client, that handles the authentication
for Firebolt database.
Authentication can be passed through auth keyword as a tuple or as a
FireboltAuth instance
httpx.Client:
+ (HttpxClient.__doc__ or "")
"""
@cached_property
def account_id(self) -> str:
if self.account_name:
response = self.get(
url=ACCOUNT_BY_NAME_URL, params={"account_name": self.account_name}
)
if response.status_code == HttpxCodes.NOT_FOUND:
raise AccountNotFoundError(self.account_name)
# process all other status codes
response.raise_for_status()
return response.json()["account_id"]
else: # account_name isn't set, use the default account.
return self.get(url=ACCOUNT_URL).json()["account"]["id"]
class AsyncClient(FireboltClientMixin, HttpxAsyncClient):
"""
An http client, based on httpx.AsyncClient, that asyncronously handles
authentication for Firebolt database.
Authentication can be passed through auth keyword as a tuple or as a
FireboltAuth instance
httpx.AsyncClient:
+ (HttpxAsyncClient.__doc__ or "")
"""
@async_cached_property
async def account_id(self) -> str:
if self.account_name:
response = await self.get(
url=ACCOUNT_BY_NAME_URL, params={"account_name": self.account_name}
)
if response.status_code == HttpxCodes.NOT_FOUND:
raise AccountNotFoundError(self.account_name)
# process all other status codes
response.raise_for_status()
return response.json()["account_id"]
else: # account_name isn't set; use the default account.
return (await self.get(url=ACCOUNT_URL)).json()["account"]["id"]
| [
1,
529,
9507,
29958,
4351,
29914,
8696,
2095,
29873,
29914,
4645,
29914,
4645,
29889,
2272,
13,
3166,
19229,
1053,
3139,
29892,
28379,
13,
13,
3166,
7465,
29918,
6799,
1053,
7465,
29918,
29883,
3791,
29918,
6799,
29871,
396,
1134,
29901,
11455,
13,
3166,
1732,
29916,
1053,
20688,
4032,
408,
379,
698,
1756,
8123,
4032,
13,
3166,
1732,
29916,
1053,
12477,
408,
379,
698,
1756,
4032,
13,
3166,
1732,
29916,
1053,
903,
8768,
13,
3166,
1732,
29916,
1053,
11561,
408,
379,
698,
1756,
29907,
2631,
13,
3166,
1732,
29916,
3032,
8768,
1053,
13189,
10562,
13,
13,
3166,
3974,
2095,
29873,
29889,
4645,
29889,
5150,
1053,
13189,
13,
3166,
3974,
2095,
29873,
29889,
4645,
29889,
3075,
1934,
1053,
22236,
29918,
8787,
29918,
4219,
13,
3166,
3974,
2095,
29873,
29889,
9435,
29889,
11739,
1053,
16535,
17413,
2392,
13,
3166,
3974,
2095,
29873,
29889,
9435,
29889,
26045,
1053,
14614,
18736,
29918,
22716,
29918,
5813,
29918,
4219,
29892,
14614,
18736,
29918,
4219,
13,
3166,
3974,
2095,
29873,
29889,
9435,
29889,
4422,
1053,
22152,
29918,
6799,
29892,
2329,
29918,
2271,
29918,
11010,
29892,
6837,
262,
29918,
1454,
13,
13,
18654,
2095,
29873,
4032,
29924,
861,
262,
5160,
353,
6837,
262,
29918,
1454,
29898,
29950,
698,
1756,
4032,
29897,
29871,
396,
1134,
29901,
3139,
13,
13,
13,
1990,
6438,
2095,
29873,
4032,
29924,
861,
262,
29898,
18654,
2095,
29873,
4032,
29924,
861,
262,
5160,
1125,
13,
1678,
822,
4770,
2344,
12035,
13,
4706,
1583,
29892,
13,
4706,
334,
5085,
29901,
3139,
29892,
13,
4706,
3633,
29918,
978,
29901,
28379,
29961,
710,
29962,
353,
6213,
29892,
13,
4706,
7882,
29918,
29734,
29901,
851,
353,
22236,
29918,
8787,
29918,
4219,
29892,
13,
4706,
4817,
29901,
13189,
10562,
353,
6213,
29892,
13,
4706,
3579,
19290,
29901,
3139,
29892,
13,
268,
1125,
13,
4706,
1583,
29889,
10149,
29918,
978,
353,
3633,
29918,
978,
13,
4706,
1583,
3032,
2754,
29918,
29734,
353,
2329,
29918,
2271,
29918,
11010,
29898,
2754,
29918,
29734,
29897,
13,
4706,
2428,
2141,
1649,
2344,
1649,
10456,
5085,
29892,
4817,
29922,
5150,
29892,
3579,
19290,
29897,
13,
13,
1678,
822,
903,
4282,
29918,
5150,
29898,
1311,
29892,
4817,
29901,
903,
8768,
29889,
6444,
10562,
29897,
1599,
28379,
29961,
6444,
5387,
13,
4706,
565,
4817,
338,
6213,
470,
338,
8758,
29898,
5150,
29892,
13189,
1125,
13,
9651,
736,
4817,
13,
4706,
25342,
338,
8758,
29898,
5150,
29892,
18761,
1125,
13,
9651,
736,
13189,
29898,
13,
18884,
8952,
29922,
710,
29898,
5150,
29961,
29900,
11724,
13,
18884,
4800,
29922,
710,
29898,
5150,
29961,
29896,
11724,
13,
18884,
7882,
29918,
29734,
29922,
1311,
3032,
2754,
29918,
29734,
29892,
13,
9651,
1723,
13,
4706,
1683,
29901,
13,
9651,
12020,
20948,
29898,
29888,
29915,
13919,
376,
5150,
29908,
2980,
29901,
426,
5150,
29991,
29878,
29913,
1495,
13,
13,
13,
1990,
12477,
29898,
18654,
2095,
29873,
4032,
29924,
861,
262,
29892,
379,
698,
1756,
4032,
1125,
13,
13,
1678,
9995,
13,
1678,
530,
1732,
3132,
29892,
2729,
373,
1732,
29916,
29889,
4032,
29892,
393,
17766,
278,
10760,
13,
1678,
363,
6438,
2095,
29873,
2566,
29889,
13,
13,
1678,
27241,
508,
367,
4502,
1549,
4817,
13553,
408,
263,
18761,
470,
408,
263,
13,
1678,
6438,
2095,
29873,
6444,
2777,
13,
13,
1678,
1732,
29916,
29889,
4032,
29901,
13,
13,
1678,
718,
313,
29950,
698,
1756,
4032,
17255,
1514,
1649,
470,
20569,
13,
1678,
9995,
13,
13,
1678,
732,
29883,
3791,
29918,
6799,
13,
1678,
822,
3633,
29918,
333,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
565,
1583,
29889,
10149,
29918,
978,
29901,
13,
9651,
2933,
353,
1583,
29889,
657,
29898,
13,
18884,
3142,
29922,
2477,
18736,
29918,
22716,
29918,
5813,
29918,
4219,
29892,
8636,
3790,
29908,
10149,
29918,
978,
1115,
1583,
29889,
10149,
29918,
978,
29913,
13,
9651,
1723,
13,
9651,
565,
2933,
29889,
4882,
29918,
401,
1275,
379,
698,
1756,
29907,
2631,
29889,
12256,
29918,
5800,
18783,
29901,
13,
18884,
12020,
16535,
17413,
2392,
29898,
1311,
29889,
10149,
29918,
978,
29897,
13,
9651,
396,
1889,
599,
916,
4660,
11561,
13,
9651,
2933,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
9651,
736,
2933,
29889,
3126,
580,
3366,
10149,
29918,
333,
3108,
13,
4706,
1683,
29901,
29871,
396,
3633,
29918,
978,
3508,
29915,
29873,
731,
29892,
671,
278,
2322,
3633,
29889,
13,
9651,
736,
1583,
29889,
657,
29898,
2271,
29922,
2477,
18736,
29918,
4219,
467,
3126,
580,
3366,
10149,
3108,
3366,
333,
3108,
13,
13,
13,
1990,
20688,
4032,
29898,
18654,
2095,
29873,
4032,
29924,
861,
262,
29892,
379,
698,
1756,
8123,
4032,
1125,
13,
1678,
9995,
13,
1678,
530,
1732,
3132,
29892,
2729,
373,
1732,
29916,
29889,
8123,
4032,
29892,
393,
7465,
1617,
5794,
17766,
13,
1678,
10760,
363,
6438,
2095,
29873,
2566,
29889,
13,
13,
1678,
27241,
508,
367,
4502,
1549,
4817,
13553,
408,
263,
18761,
470,
408,
263,
13,
1678,
6438,
2095,
29873,
6444,
2777,
13,
13,
1678,
1732,
29916,
29889,
8123,
4032,
29901,
13,
13,
1678,
718,
313,
29950,
698,
1756,
8123,
4032,
17255,
1514,
1649,
470,
20569,
13,
1678,
9995,
13,
13,
1678,
732,
12674,
29918,
29883,
3791,
29918,
6799,
13,
1678,
7465,
822,
3633,
29918,
333,
29898,
1311,
29897,
1599,
851,
29901,
13,
4706,
565,
1583,
29889,
10149,
29918,
978,
29901,
13,
9651,
2933,
353,
7272,
1583,
29889,
657,
29898,
13,
18884,
3142,
29922,
2477,
18736,
29918,
22716,
29918,
5813,
29918,
4219,
29892,
8636,
3790,
29908,
10149,
29918,
978,
1115,
1583,
29889,
10149,
29918,
978,
29913,
13,
9651,
1723,
13,
9651,
565,
2933,
29889,
4882,
29918,
401,
1275,
379,
698,
1756,
29907,
2631,
29889,
12256,
29918,
5800,
18783,
29901,
13,
18884,
12020,
16535,
17413,
2392,
29898,
1311,
29889,
10149,
29918,
978,
29897,
13,
9651,
396,
1889,
599,
916,
4660,
11561,
13,
9651,
2933,
29889,
22692,
29918,
1454,
29918,
4882,
580,
13,
9651,
736,
2933,
29889,
3126,
580,
3366,
10149,
29918,
333,
3108,
13,
4706,
1683,
29901,
29871,
396,
3633,
29918,
978,
3508,
29915,
29873,
731,
29936,
671,
278,
2322,
3633,
29889,
13,
9651,
736,
313,
20675,
1583,
29889,
657,
29898,
2271,
29922,
2477,
18736,
29918,
4219,
8106,
3126,
580,
3366,
10149,
3108,
3366,
333,
3108,
13,
2
] |
attack/attacker.py | smallflyingpig/adversarial_attack_and_defense | 0 | 51726 | <filename>attack/attacker.py
import torch
from torch import nn
from abc import ABC, abstractmethod
class AdditiveAttacker(ABC):
def __init__(self, eps, data_min=-1, data_max=1):
self.eps = eps
self.data_min = data_min
self.data_max = data_max
@abstractmethod
def _get_perturbation(self, x, y=None):
pass
def generate(self, x, y=None):
delta = self._get_perturbation(x, y)
x = x + delta * self.eps
x[x<self.data_min] = self.data_min
x[x>self.data_max] = self.data_max
return x
| [
1,
529,
9507,
29958,
1131,
547,
29914,
1131,
28940,
29889,
2272,
13,
5215,
4842,
305,
13,
3166,
4842,
305,
1053,
302,
29876,
13,
3166,
25638,
1053,
16417,
29892,
9846,
5696,
13,
13,
1990,
3462,
3321,
4165,
28940,
29898,
19658,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
321,
567,
29892,
848,
29918,
1195,
10457,
29896,
29892,
848,
29918,
3317,
29922,
29896,
1125,
13,
4706,
1583,
29889,
8961,
353,
321,
567,
13,
4706,
1583,
29889,
1272,
29918,
1195,
353,
848,
29918,
1195,
13,
4706,
1583,
29889,
1272,
29918,
3317,
353,
848,
29918,
3317,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
903,
657,
29918,
10700,
9265,
362,
29898,
1311,
29892,
921,
29892,
343,
29922,
8516,
1125,
13,
4706,
1209,
13,
13,
1678,
822,
5706,
29898,
1311,
29892,
921,
29892,
343,
29922,
8516,
1125,
13,
4706,
19471,
353,
1583,
3032,
657,
29918,
10700,
9265,
362,
29898,
29916,
29892,
343,
29897,
13,
4706,
921,
353,
921,
718,
19471,
334,
1583,
29889,
8961,
13,
4706,
921,
29961,
29916,
29966,
1311,
29889,
1272,
29918,
1195,
29962,
353,
1583,
29889,
1272,
29918,
1195,
13,
4706,
921,
29961,
29916,
29958,
1311,
29889,
1272,
29918,
3317,
29962,
353,
1583,
29889,
1272,
29918,
3317,
13,
4706,
736,
921,
13,
13,
2
] |
app/src/main/python/doupai.py | One-PZ/lmgp | 0 | 174655 | # -*- coding:utf-8 -*-
import re
import json
import requests
"""
目标APP:逗拍
目标url:APP视频分享链接
爬取思路:
1. 通过APP里的分享获取视频url
2. 对https://v2.doupai.cc/topic/XXXXXX.json发送post请求,获取json数据
"""
class DouPai(object):
def __init__(self, url):
self.url = url
self.session = requests.Session()
def get_video(self):
try:
# 处理url,获取视频id
pattern = re.compile('(http[s]?://[^\s]+)', re.S)
deal_url = re.findall(pattern, self.url)[0]
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/85.0.4183.102 Safari/537.36",
"origin": "https://p.doupai.cc"
}
# 获取vid
vid = re.findall("topic/(.*?).html", deal_url, re.S)[0]
base_url = "https://v2.doupai.cc/topic/{}.json".format(vid)
result = self.session.get(url=base_url, headers=headers, timeout=10)
if result.status_code == 200:
try:
doc = result.json()
url = doc["data"]["videoUrl"]
title = doc["data"]["name"]
cover = doc["data"]["imageUrl"]
info = {
"title": title,
"cover": cover,
"video_url": url
}
return json.dumps(info, ensure_ascii=False)
except Exception as e:
return json.dumps({"info": "暂无相关数据,请检查相关数据:" + str(e)}, ensure_ascii=False)
else:
return json.dumps({"info": "暂无相关数据,请检查相关数据:"}, ensure_ascii=False)
except Exception as e:
return json.dumps({"info": "暂无相关数据,请检查相关数据:" + str(e)}, ensure_ascii=False)
if __name__ == '__main__':
dou_pai = DouPai("出国证 https://p.doupai.cc/#/topic/5fa20d8c8f71d10031f27abb.html")
print(dou_pai.get_video()) | [
1,
396,
448,
29930,
29899,
14137,
29901,
9420,
29899,
29947,
448,
29930,
29899,
13,
5215,
337,
13,
5215,
4390,
13,
5215,
7274,
13,
13,
15945,
29908,
13,
30895,
31062,
20576,
30383,
236,
131,
154,
233,
142,
144,
13,
30895,
31062,
2271,
30383,
20576,
31568,
236,
165,
148,
30748,
231,
189,
174,
236,
150,
193,
31092,
13,
234,
139,
175,
30683,
31579,
30874,
30383,
13,
268,
29896,
29889,
29871,
30768,
31138,
20576,
30755,
30210,
30748,
231,
189,
174,
31024,
30683,
31568,
236,
165,
148,
2271,
13,
268,
29906,
29889,
29871,
30783,
991,
597,
29894,
29906,
29889,
29881,
1132,
1794,
29889,
617,
29914,
13010,
29914,
19165,
6247,
29889,
3126,
30910,
31545,
2490,
31088,
31376,
30214,
31024,
30683,
3126,
30354,
30763,
13,
15945,
29908,
13,
13,
13,
1990,
19176,
29925,
1794,
29898,
3318,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
3142,
1125,
13,
4706,
1583,
29889,
2271,
353,
3142,
13,
4706,
1583,
29889,
7924,
353,
7274,
29889,
7317,
580,
13,
13,
1678,
822,
679,
29918,
9641,
29898,
1311,
1125,
13,
4706,
1018,
29901,
13,
9651,
396,
29871,
31548,
30687,
2271,
30214,
31024,
30683,
31568,
236,
165,
148,
333,
13,
9651,
4766,
353,
337,
29889,
12198,
877,
29898,
1124,
29961,
29879,
29962,
29973,
597,
29961,
3823,
29879,
10062,
29897,
742,
337,
29889,
29903,
29897,
13,
9651,
5376,
29918,
2271,
353,
337,
29889,
2886,
497,
29898,
11037,
29892,
1583,
29889,
2271,
9601,
29900,
29962,
13,
9651,
9066,
353,
426,
13,
18884,
376,
1792,
29899,
14748,
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,
795,
376,
1451,
4871,
29914,
29947,
29945,
29889,
29900,
29889,
29946,
29896,
29947,
29941,
29889,
29896,
29900,
29906,
24544,
29914,
29945,
29941,
29955,
29889,
29941,
29953,
613,
13,
18884,
376,
12574,
1115,
376,
991,
597,
29886,
29889,
29881,
1132,
1794,
29889,
617,
29908,
13,
9651,
500,
13,
9651,
396,
29871,
31024,
30683,
8590,
13,
9651,
7840,
353,
337,
29889,
2886,
497,
703,
13010,
14571,
5575,
29973,
467,
1420,
613,
5376,
29918,
2271,
29892,
337,
29889,
29903,
9601,
29900,
29962,
13,
9651,
2967,
29918,
2271,
353,
376,
991,
597,
29894,
29906,
29889,
29881,
1132,
1794,
29889,
617,
29914,
13010,
19248,
1836,
3126,
1642,
4830,
29898,
8590,
29897,
13,
9651,
1121,
353,
1583,
29889,
7924,
29889,
657,
29898,
2271,
29922,
3188,
29918,
2271,
29892,
9066,
29922,
13662,
29892,
11815,
29922,
29896,
29900,
29897,
13,
9651,
565,
1121,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
29901,
13,
18884,
1018,
29901,
13,
462,
1678,
1574,
353,
1121,
29889,
3126,
580,
13,
462,
1678,
3142,
353,
1574,
3366,
1272,
3108,
3366,
9641,
5983,
3108,
13,
462,
1678,
3611,
353,
1574,
3366,
1272,
3108,
3366,
978,
3108,
13,
462,
1678,
4612,
353,
1574,
3366,
1272,
3108,
3366,
3027,
5983,
3108,
13,
462,
1678,
5235,
353,
426,
13,
462,
4706,
376,
3257,
1115,
3611,
29892,
13,
462,
4706,
376,
11911,
1115,
4612,
29892,
13,
462,
4706,
376,
9641,
29918,
2271,
1115,
3142,
13,
462,
1678,
500,
13,
462,
1678,
736,
4390,
29889,
29881,
17204,
29898,
3888,
29892,
9801,
29918,
294,
18869,
29922,
8824,
29897,
13,
18884,
5174,
8960,
408,
321,
29901,
13,
462,
1678,
736,
4390,
29889,
29881,
17204,
3319,
29908,
3888,
1115,
376,
233,
157,
133,
31352,
30990,
31057,
30354,
30763,
30214,
31088,
233,
166,
131,
31213,
30990,
31057,
30354,
30763,
30383,
29908,
718,
851,
29898,
29872,
19230,
9801,
29918,
294,
18869,
29922,
8824,
29897,
13,
9651,
1683,
29901,
13,
18884,
736,
4390,
29889,
29881,
17204,
3319,
29908,
3888,
1115,
376,
233,
157,
133,
31352,
30990,
31057,
30354,
30763,
30214,
31088,
233,
166,
131,
31213,
30990,
31057,
30354,
30763,
30383,
10758,
9801,
29918,
294,
18869,
29922,
8824,
29897,
13,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
736,
4390,
29889,
29881,
17204,
3319,
29908,
3888,
1115,
376,
233,
157,
133,
31352,
30990,
31057,
30354,
30763,
30214,
31088,
233,
166,
131,
31213,
30990,
31057,
30354,
30763,
30383,
29908,
718,
851,
29898,
29872,
19230,
9801,
29918,
294,
18869,
29922,
8824,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4662,
29918,
29886,
1794,
353,
19176,
29925,
1794,
703,
30544,
30356,
235,
178,
132,
2045,
597,
29886,
29889,
29881,
1132,
1794,
29889,
617,
8484,
29914,
13010,
29914,
29945,
5444,
29906,
29900,
29881,
29947,
29883,
29947,
29888,
29955,
29896,
29881,
29896,
29900,
29900,
29941,
29896,
29888,
29906,
29955,
8846,
29889,
1420,
1159,
13,
1678,
1596,
29898,
29881,
283,
29918,
29886,
1794,
29889,
657,
29918,
9641,
3101,
2
] |
api-v2/config_helper.py | MikeChurvis/mikechurvis.github.io | 1 | 54113 | from django.core.exceptions import ImproperlyConfigured
def validate_settings(settings, required_settings: set[str]):
required_settings = {
'CONTACTFORM_NAME_MAX_LENGTH',
'CONTACTFORM_ORGANIZATION_MAX_LENGTH',
'CONTACTFORM_EMAIL_MAX_LENGTH',
'CONTACTFORM_EMAIL_REGULAR_EXPRESSION',
'CONTACTFORM_MESSAGE_MIN_LENGTH',
'CONTACTFORM_MESSAGE_MAX_LENGTH',
}
missing_settings = set(filter(lambda attr: not hasattr(settings, attr), required_settings))
if missing_settings:
raise ImproperlyConfigured(
'The following settings are required and are missing:\n{}'.format("\n".join(missing_settings))
)
| [
1,
515,
9557,
29889,
3221,
29889,
11739,
29879,
1053,
1954,
771,
546,
368,
3991,
2955,
13,
13,
13,
1753,
12725,
29918,
11027,
29898,
11027,
29892,
3734,
29918,
11027,
29901,
731,
29961,
710,
29962,
1125,
13,
1678,
3734,
29918,
11027,
353,
426,
13,
4706,
525,
6007,
6040,
1783,
19094,
29918,
5813,
29918,
12648,
29918,
19433,
742,
13,
4706,
525,
6007,
6040,
1783,
19094,
29918,
1955,
29954,
2190,
26664,
8098,
29918,
12648,
29918,
19433,
742,
13,
4706,
525,
6007,
6040,
1783,
19094,
29918,
26862,
6227,
29918,
12648,
29918,
19433,
742,
13,
4706,
525,
6007,
6040,
1783,
19094,
29918,
26862,
6227,
29918,
18166,
13309,
1718,
29918,
5746,
15094,
13507,
742,
13,
4706,
525,
6007,
6040,
1783,
19094,
29918,
2303,
1799,
10461,
29918,
16173,
29918,
19433,
742,
13,
4706,
525,
6007,
6040,
1783,
19094,
29918,
2303,
1799,
10461,
29918,
12648,
29918,
19433,
742,
13,
1678,
500,
13,
13,
1678,
4567,
29918,
11027,
353,
731,
29898,
4572,
29898,
2892,
12421,
29901,
451,
756,
5552,
29898,
11027,
29892,
12421,
511,
3734,
29918,
11027,
876,
13,
13,
1678,
565,
4567,
29918,
11027,
29901,
13,
4706,
12020,
1954,
771,
546,
368,
3991,
2955,
29898,
13,
9651,
525,
1576,
1494,
6055,
526,
3734,
322,
526,
4567,
3583,
29876,
8875,
4286,
4830,
14182,
29876,
1642,
7122,
29898,
27259,
29918,
11027,
876,
13,
4706,
1723,
13,
13,
2
] |
icon-downloader/isko.py | vpa1/vetrani-bez-jedu | 0 | 85629 | <gh_stars>0
import requests,psycopg2,logging
try:
aqdata=requests.get('http://portal.chmi.cz/files/portal/docs/uoco/web_generator/actual_hour_data_cze.json').json()
conn = psycopg2.connect(user = "wforecast_app", password = "<PASSWORD>",
host = "db",
port = "5432",
database = "wforecast")
curr = conn.cursor()
hour = aqdata["States"][0]["DateToUTC"]
for station in aqdata["States"][0]["Regions"][13]["Stations"]:
statcode = station["Code"]
for component in station["Components"]:
pollutant = component["Code"]
interval = component.get("Int")
val = component.get("Val")
if (val!=None and val!=''):
curr.execute("insert into isko.isko_data (observation_hour,station,pollutant,interval,val) VALUES(date_trunc('hour',%s::timestamp),%s,%s,%s,%s)",[hour,statcode,pollutant,interval,val.replace(' ','')])
conn.commit()
conn.close()
logging.info("ISKO download successful")
except(Exception):
logging.exception("Download failed with exception ") | [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
7274,
29892,
567,
29891,
9708,
29887,
29906,
29892,
21027,
13,
2202,
29901,
29871,
13,
1678,
263,
29939,
1272,
29922,
24830,
29889,
657,
877,
1124,
597,
25089,
29889,
305,
2460,
29889,
2067,
29914,
5325,
29914,
25089,
29914,
2640,
29914,
29884,
6235,
29914,
2676,
29918,
27959,
29914,
19304,
29918,
18721,
29918,
1272,
29918,
18562,
29889,
3126,
2824,
3126,
580,
13,
1678,
11009,
353,
6529,
29891,
9708,
29887,
29906,
29889,
6915,
29898,
1792,
353,
376,
29893,
1079,
4384,
29918,
932,
613,
4800,
353,
9872,
25711,
17013,
28341,
13,
462,
462,
795,
3495,
353,
376,
2585,
613,
13,
462,
462,
795,
2011,
353,
376,
29945,
29946,
29941,
29906,
613,
13,
462,
462,
795,
2566,
353,
376,
29893,
1079,
4384,
1159,
13,
462,
462,
632,
13,
13,
1678,
16256,
353,
11009,
29889,
18127,
580,
13,
1678,
7234,
353,
263,
29939,
1272,
3366,
855,
1078,
3108,
29961,
29900,
29962,
3366,
2539,
1762,
26913,
3108,
13,
1678,
363,
5073,
297,
263,
29939,
1272,
3366,
855,
1078,
3108,
29961,
29900,
29962,
3366,
4597,
1080,
3108,
29961,
29896,
29941,
29962,
3366,
855,
800,
3108,
29901,
13,
4706,
1002,
401,
353,
5073,
3366,
3399,
3108,
13,
4706,
363,
4163,
297,
5073,
3366,
25503,
3108,
29901,
29871,
13,
9651,
21180,
329,
424,
353,
4163,
3366,
3399,
3108,
13,
9651,
7292,
353,
4163,
29889,
657,
703,
2928,
1159,
13,
9651,
659,
353,
4163,
29889,
657,
703,
1440,
1159,
13,
9651,
565,
313,
791,
19216,
8516,
322,
659,
29991,
2433,
29374,
13,
18884,
16256,
29889,
7978,
703,
7851,
964,
338,
2901,
29889,
28783,
29918,
1272,
313,
26739,
362,
29918,
18721,
29892,
19569,
29892,
29886,
3028,
329,
424,
29892,
19207,
29892,
791,
29897,
15673,
29898,
1256,
29918,
509,
4661,
877,
18721,
742,
29995,
29879,
1057,
16394,
511,
29995,
29879,
24163,
29879,
24163,
29879,
24163,
29879,
19123,
29961,
18721,
29892,
6112,
401,
29892,
29886,
3028,
329,
424,
29892,
19207,
29892,
791,
29889,
6506,
877,
525,
5501,
1495,
2314,
13,
1678,
11009,
29889,
15060,
580,
632,
13,
1678,
11009,
29889,
5358,
580,
13,
1678,
12183,
29889,
3888,
703,
3235,
29968,
29949,
5142,
9150,
1159,
13,
19499,
29898,
2451,
1125,
13,
1678,
12183,
29889,
11739,
703,
22954,
5229,
411,
3682,
16521,
2
] |
tests/serializer.py | asellappen/python-junit-xml | 95 | 129029 | import codecs
import os
import tempfile
from xml.dom import minidom
from six import PY2
from junit_xml import to_xml_report_file, to_xml_report_string
def serialize_and_read(test_suites, to_file=False, prettyprint=False, encoding=None):
"""writes the test suite to an XML string and then re-reads it using minidom,
returning => (test suite element, list of test case elements)"""
try:
iter(test_suites)
except TypeError:
test_suites = [test_suites]
if to_file:
fd, filename = tempfile.mkstemp(text=True)
os.close(fd)
with codecs.open(filename, mode="w", encoding=encoding) as f:
to_xml_report_file(f, test_suites, prettyprint=prettyprint, encoding=encoding)
print("Serialized XML to temp file [%s]" % filename)
xmldoc = minidom.parse(filename)
os.remove(filename)
else:
xml_string = to_xml_report_string(test_suites, prettyprint=prettyprint, encoding=encoding)
if PY2:
assert isinstance(xml_string, unicode) # noqa: F821
print("Serialized XML to string:\n%s" % xml_string)
if encoding:
xml_string = xml_string.encode(encoding)
xmldoc = minidom.parseString(xml_string)
def remove_blanks(node):
for x in node.childNodes:
if x.nodeType == minidom.Node.TEXT_NODE:
if x.nodeValue:
x.nodeValue = x.nodeValue.strip()
elif x.nodeType == minidom.Node.ELEMENT_NODE:
remove_blanks(x)
remove_blanks(xmldoc)
xmldoc.normalize()
ret = []
suites = xmldoc.getElementsByTagName("testsuites")[0]
for suite in suites.getElementsByTagName("testsuite"):
cases = suite.getElementsByTagName("testcase")
ret.append((suite, cases))
return ret
| [
1,
1053,
775,
2395,
13,
5215,
2897,
13,
5215,
5694,
1445,
13,
3166,
4903,
29889,
3129,
1053,
1375,
333,
290,
13,
13,
3166,
4832,
1053,
349,
29979,
29906,
13,
13,
3166,
4707,
277,
29918,
3134,
1053,
304,
29918,
3134,
29918,
12276,
29918,
1445,
29892,
304,
29918,
3134,
29918,
12276,
29918,
1807,
13,
13,
13,
1753,
28755,
29918,
392,
29918,
949,
29898,
1688,
29918,
2146,
3246,
29892,
304,
29918,
1445,
29922,
8824,
29892,
5051,
2158,
29922,
8824,
29892,
8025,
29922,
8516,
1125,
13,
1678,
9995,
8231,
267,
278,
1243,
9460,
304,
385,
6560,
1347,
322,
769,
337,
29899,
949,
29879,
372,
773,
1375,
333,
290,
29892,
13,
539,
7863,
1149,
313,
1688,
9460,
1543,
29892,
1051,
310,
1243,
1206,
3161,
5513,
15945,
13,
1678,
1018,
29901,
13,
4706,
4256,
29898,
1688,
29918,
2146,
3246,
29897,
13,
1678,
5174,
20948,
29901,
13,
4706,
1243,
29918,
2146,
3246,
353,
518,
1688,
29918,
2146,
3246,
29962,
13,
13,
1678,
565,
304,
29918,
1445,
29901,
13,
4706,
285,
29881,
29892,
10422,
353,
5694,
1445,
29889,
11256,
303,
3451,
29898,
726,
29922,
5574,
29897,
13,
4706,
2897,
29889,
5358,
29898,
11512,
29897,
13,
4706,
411,
775,
2395,
29889,
3150,
29898,
9507,
29892,
4464,
543,
29893,
613,
8025,
29922,
22331,
29897,
408,
285,
29901,
13,
9651,
304,
29918,
3134,
29918,
12276,
29918,
1445,
29898,
29888,
29892,
1243,
29918,
2146,
3246,
29892,
5051,
2158,
29922,
1457,
4349,
2158,
29892,
8025,
29922,
22331,
29897,
13,
4706,
1596,
703,
9125,
1891,
6560,
304,
5694,
934,
518,
29995,
29879,
18017,
1273,
10422,
29897,
13,
4706,
921,
29885,
430,
542,
353,
1375,
333,
290,
29889,
5510,
29898,
9507,
29897,
13,
4706,
2897,
29889,
5992,
29898,
9507,
29897,
13,
1678,
1683,
29901,
13,
4706,
4903,
29918,
1807,
353,
304,
29918,
3134,
29918,
12276,
29918,
1807,
29898,
1688,
29918,
2146,
3246,
29892,
5051,
2158,
29922,
1457,
4349,
2158,
29892,
8025,
29922,
22331,
29897,
13,
4706,
565,
349,
29979,
29906,
29901,
13,
9651,
4974,
338,
8758,
29898,
3134,
29918,
1807,
29892,
29104,
29897,
29871,
396,
694,
25621,
29901,
383,
29947,
29906,
29896,
13,
4706,
1596,
703,
9125,
1891,
6560,
304,
1347,
3583,
29876,
29995,
29879,
29908,
1273,
4903,
29918,
1807,
29897,
13,
4706,
565,
8025,
29901,
13,
9651,
4903,
29918,
1807,
353,
4903,
29918,
1807,
29889,
12508,
29898,
22331,
29897,
13,
4706,
921,
29885,
430,
542,
353,
1375,
333,
290,
29889,
5510,
1231,
29898,
3134,
29918,
1807,
29897,
13,
13,
1678,
822,
3349,
29918,
2204,
1331,
29898,
3177,
1125,
13,
4706,
363,
921,
297,
2943,
29889,
5145,
20284,
29901,
13,
9651,
565,
921,
29889,
3177,
1542,
1275,
1375,
333,
290,
29889,
4247,
29889,
16975,
29918,
6632,
2287,
29901,
13,
18884,
565,
921,
29889,
3177,
1917,
29901,
13,
462,
1678,
921,
29889,
3177,
1917,
353,
921,
29889,
3177,
1917,
29889,
17010,
580,
13,
9651,
25342,
921,
29889,
3177,
1542,
1275,
1375,
333,
290,
29889,
4247,
29889,
29923,
1307,
13780,
29918,
6632,
2287,
29901,
13,
18884,
3349,
29918,
2204,
1331,
29898,
29916,
29897,
13,
13,
1678,
3349,
29918,
2204,
1331,
29898,
29916,
29885,
430,
542,
29897,
13,
1678,
921,
29885,
430,
542,
29889,
8945,
675,
580,
13,
13,
1678,
3240,
353,
5159,
13,
1678,
480,
3246,
353,
921,
29885,
430,
542,
29889,
22266,
29269,
703,
1688,
2146,
3246,
1159,
29961,
29900,
29962,
13,
1678,
363,
9460,
297,
480,
3246,
29889,
22266,
29269,
703,
1688,
13495,
29908,
1125,
13,
4706,
4251,
353,
9460,
29889,
22266,
29269,
703,
1688,
4878,
1159,
13,
4706,
3240,
29889,
4397,
3552,
13495,
29892,
4251,
876,
13,
1678,
736,
3240,
13,
2
] |
python_sample_app/publisher/publisher.py | open-edge-insights/eii-samples | 1 | 76455 | <gh_stars>1-10
# Copyright (c) 2020 Intel Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""EII Message Bus publisher example
"""
import time
import eii.msgbus as mb
import os
import json
from distutils.util import strtobool
import cfgmgr.config_manager as cfg
from util.util import Util
def start_publisher():
publisher = None
try:
ctx = cfg.ConfigMgr()
if ctx.get_num_publishers() == -1:
raise "No publisher instances found, exiting..."
pub_ctx = ctx.get_publisher_by_index(0)
msgbus_cfg = pub_ctx.get_msgbus_config()
print('[INFO] Initializing message bus context')
msgbus_pub = mb.MsgbusContext(msgbus_cfg)
topics = pub_ctx.get_topics()
print(f'[INFO] Initializing publisher for topic \'{topics[0]}\'')
publisher = msgbus_pub.new_publisher(topics[0])
app_cfg = ctx.get_app_config()
print(f'App Config is \'{app_cfg}\'')
print('[INFO] Running...')
while True:
blob = b'\x22' * 10
meta = {
'integer': 123,
'floating': 55.5,
'string': 'test',
'boolean': True,
'empty': None,
'obj': {'test': {'test2': 'hello'}, 'test3': 'world'},
'arr': ['test', 123]
}
publisher.publish((meta, blob,))
print(f'[INFO] Msg published by publisher : \'{meta}\'')
time.sleep(int(app_cfg["loop_interval"]))
except KeyboardInterrupt:
print('[INFO] Quitting...')
finally:
if publisher is not None:
publisher.close()
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
14187,
1266,
313,
29883,
29897,
29871,
29906,
29900,
29906,
29900,
18555,
15025,
29889,
13,
29937,
13,
29937,
20894,
2333,
338,
1244,
1609,
16896,
29892,
3889,
310,
8323,
29892,
304,
738,
2022,
4017,
292,
263,
3509,
13,
29937,
310,
445,
7047,
322,
6942,
5106,
2066,
313,
1552,
376,
6295,
14093,
4968,
304,
5376,
13,
29937,
297,
278,
18540,
1728,
24345,
29892,
3704,
1728,
29485,
278,
10462,
13,
29937,
304,
671,
29892,
3509,
29892,
6623,
29892,
10366,
29892,
9805,
29892,
1320,
2666,
29892,
269,
803,
1947,
29892,
322,
29914,
272,
19417,
13,
29937,
14591,
310,
278,
18540,
29892,
322,
304,
14257,
12407,
304,
6029,
278,
18540,
338,
13,
29937,
15252,
3276,
304,
437,
577,
29892,
4967,
304,
278,
1494,
5855,
29901,
13,
29937,
13,
29937,
450,
2038,
3509,
1266,
8369,
322,
445,
10751,
8369,
4091,
367,
5134,
297,
13,
29937,
599,
14591,
470,
23228,
2011,
1080,
310,
278,
18540,
29889,
13,
29937,
13,
29937,
6093,
7791,
7818,
12982,
1525,
8519,
13756,
13044,
3352,
376,
3289,
8519,
613,
399,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29979,
8079,
13764,
29979,
476,
22255,
29892,
8528,
15094,
1799,
6323,
13,
29937,
306,
3580,
5265,
3352,
29892,
2672,
6154,
15789,
4214,
350,
2692,
6058,
27848,
3352,
7495,
6093,
399,
1718,
29934,
13566,
29059,
8079,
341,
1001,
3210,
13566,
2882,
6227,
11937,
29892,
13,
29937,
383,
1806,
8186,
1799,
15842,
319,
349,
8322,
2965,
13309,
1718,
349,
4574,
13152,
1660,
5300,
405,
1164,
1177,
15860,
1177,
1692,
13780,
29889,
2672,
11698,
382,
29963,
3919,
24972,
9818,
6093,
13,
29937,
26524,
29950,
24125,
6323,
315,
4590,
29979,
22789,
3912,
379,
5607,
8032,
29903,
20700,
17705,
6181,
15842,
13764,
29979,
315,
4375,
7833,
29892,
21330,
1529,
1692,
29903,
6323,
438,
29911,
4448,
13,
29937,
17705,
2882,
6227,
11937,
29892,
12317,
2544,
4448,
2672,
13764,
319,
9838,
8079,
8707,
29911,
4717,
1783,
29892,
323,
8476,
6323,
438,
29911,
4448,
22119,
1660,
29892,
9033,
3235,
4214,
3895,
29892,
13,
29937,
19474,
8079,
6323,
2672,
8707,
8186,
9838,
22659,
6093,
7791,
7818,
12982,
1525,
6323,
6093,
501,
1660,
6323,
438,
29911,
4448,
5012,
1964,
4214,
29903,
2672,
6093,
13,
29937,
7791,
7818,
12982,
1525,
29889,
13,
15945,
29908,
29923,
2687,
7777,
8406,
9805,
261,
1342,
13,
15945,
29908,
13,
13,
5215,
931,
13,
5215,
321,
2236,
29889,
7645,
8262,
408,
286,
29890,
13,
5215,
2897,
13,
5215,
4390,
13,
3166,
1320,
13239,
29889,
4422,
1053,
851,
517,
11227,
13,
5215,
274,
16434,
29885,
629,
29889,
2917,
29918,
12847,
408,
274,
16434,
13,
3166,
3667,
29889,
4422,
1053,
22310,
13,
13,
13,
1753,
1369,
29918,
23679,
261,
7295,
13,
1678,
9805,
261,
353,
6213,
13,
13,
1678,
1018,
29901,
13,
4706,
12893,
353,
274,
16434,
29889,
3991,
29924,
629,
580,
13,
4706,
565,
12893,
29889,
657,
29918,
1949,
29918,
23679,
414,
580,
1275,
448,
29896,
29901,
13,
9651,
12020,
376,
3782,
9805,
261,
8871,
1476,
29892,
6876,
292,
17794,
13,
4706,
2529,
29918,
13073,
353,
12893,
29889,
657,
29918,
23679,
261,
29918,
1609,
29918,
2248,
29898,
29900,
29897,
13,
4706,
10191,
8262,
29918,
16859,
353,
2529,
29918,
13073,
29889,
657,
29918,
7645,
8262,
29918,
2917,
580,
13,
13,
4706,
1596,
877,
29961,
11690,
29962,
17250,
5281,
2643,
3593,
3030,
1495,
13,
4706,
10191,
8262,
29918,
5467,
353,
286,
29890,
29889,
16190,
8262,
2677,
29898,
7645,
8262,
29918,
16859,
29897,
13,
13,
4706,
23820,
353,
2529,
29918,
13073,
29889,
657,
29918,
3332,
1199,
580,
13,
4706,
1596,
29898,
29888,
29915,
29961,
11690,
29962,
17250,
5281,
9805,
261,
363,
11261,
320,
29915,
29912,
3332,
1199,
29961,
29900,
29962,
1012,
29915,
1495,
13,
4706,
9805,
261,
353,
10191,
8262,
29918,
5467,
29889,
1482,
29918,
23679,
261,
29898,
3332,
1199,
29961,
29900,
2314,
13,
13,
4706,
623,
29918,
16859,
353,
12893,
29889,
657,
29918,
932,
29918,
2917,
580,
13,
4706,
1596,
29898,
29888,
29915,
2052,
12782,
338,
29871,
320,
29915,
29912,
932,
29918,
16859,
1012,
29915,
1495,
13,
13,
4706,
1596,
877,
29961,
11690,
29962,
19509,
856,
1495,
13,
4706,
1550,
5852,
29901,
13,
9651,
23755,
353,
289,
12764,
29916,
29906,
29906,
29915,
334,
29871,
29896,
29900,
13,
9651,
12700,
353,
426,
13,
18884,
525,
16031,
2396,
29871,
29896,
29906,
29941,
29892,
13,
18884,
525,
29888,
417,
1218,
2396,
29871,
29945,
29945,
29889,
29945,
29892,
13,
18884,
525,
1807,
2396,
525,
1688,
742,
13,
18884,
525,
20054,
2396,
5852,
29892,
13,
18884,
525,
6310,
2396,
6213,
29892,
13,
18884,
525,
5415,
2396,
11117,
1688,
2396,
11117,
1688,
29906,
2396,
525,
12199,
16675,
525,
1688,
29941,
2396,
525,
11526,
16675,
13,
18884,
525,
2749,
2396,
6024,
1688,
742,
29871,
29896,
29906,
29941,
29962,
13,
9651,
500,
13,
13,
9651,
9805,
261,
29889,
23679,
3552,
7299,
29892,
23755,
29892,
876,
13,
9651,
1596,
29898,
29888,
29915,
29961,
11690,
29962,
28264,
6369,
491,
9805,
261,
584,
29871,
320,
29915,
29912,
7299,
1012,
29915,
1495,
13,
9651,
931,
29889,
17059,
29898,
524,
29898,
932,
29918,
16859,
3366,
7888,
29918,
19207,
3108,
876,
13,
1678,
5174,
7670,
3377,
4074,
6685,
29901,
13,
4706,
1596,
877,
29961,
11690,
29962,
751,
5367,
856,
1495,
13,
1678,
7146,
29901,
13,
4706,
565,
9805,
261,
338,
451,
6213,
29901,
13,
9651,
9805,
261,
29889,
5358,
580,
13,
2
] |
tests/test_users.py | benranderson/demo | 1 | 172274 | <reponame>benranderson/demo
import json
from tests.utils import add_user, recreate_db
class TestUsersList:
def test_add_user(self, client, test_db):
response = client.post(
"/users",
data=json.dumps({"username": "ben", "email": "<EMAIL>"}),
content_type="application/json",
)
assert response.status_code == 201
assert "<EMAIL> was added!" in response.json["message"]
assert "success" in response.json["status"]
def test_add_user_invalid_json(self, client, test_db):
resp = client.post(
"/users", data=json.dumps({}), content_type="application/json"
)
data = json.loads(resp.data.decode())
assert resp.status_code == 400
assert "Invalid payload." in data["message"]
assert "fail" in data["status"]
def test_add_user_invalid_json_keys(self, client, test_db):
resp = client.post(
"/users",
data=json.dumps({"email": "<EMAIL>"}),
content_type="application/json",
)
data = json.loads(resp.data.decode())
assert resp.status_code == 400
assert "Invalid payload." in data["message"]
assert "fail" in data["status"]
def test_add_user_duplicate_email(self, client, test_db):
client.post(
"/users",
data=json.dumps({"username": "ben", "email": "<EMAIL>"}),
content_type="application/json",
)
resp = client.post(
"/users",
data=json.dumps({"username": "ben", "email": "<EMAIL>"}),
content_type="application/json",
)
data = json.loads(resp.data.decode())
assert resp.status_code == 400
assert "Sorry. That email already exists." in data["message"]
assert "fail" in data["status"]
class TestUsers:
def test_single_user(self, client, test_db):
user = add_user("tom", "<EMAIL>")
resp = client.get(f"/users/{user.id}")
data = json.loads(resp.data.decode())
assert resp.status_code == 200
assert "tom" in data["data"]["username"]
assert "<EMAIL>" in data["data"]["email"]
assert "success" in data["status"]
def test_single_user_no_id(self, client, test_db):
resp = client.get("/users/blah")
data = json.loads(resp.data.decode())
assert resp.status_code == 404
assert "User does not exist" in data["message"]
assert "fail" in data["status"]
def test_single_user_incorrect_id(self, client, test_db):
resp = client.get("/users/999")
data = json.loads(resp.data.decode())
assert resp.status_code == 404
assert "User does not exist" in data["message"]
assert "fail" in data["status"]
def test_all_users(self, client, test_db):
recreate_db()
add_user("michael", "<EMAIL>")
add_user("fletcher", "<EMAIL>")
resp = client.get("/users")
data = json.loads(resp.data.decode())
assert resp.status_code == 200
assert len(data["data"]["users"]) == 2
assert "michael" in data["data"]["users"][0]["username"]
assert "<EMAIL>" in data["data"]["users"][0]["email"]
assert "fletcher" in data["data"]["users"][1]["username"]
assert "<EMAIL>" in data["data"]["users"][1]["email"]
assert "success" in data["status"]
def test_remove_user(self, client, test_db):
recreate_db()
user = add_user("user-to-be-removed", "<EMAIL>")
resp_one = client.get("/users")
data = json.loads(resp_one.data.decode())
assert resp_one.status_code == 200
assert len(data["data"]["users"]) == 1
resp_two = client.delete(f"/users/{user.id}")
data = json.loads(resp_two.data.decode())
assert resp_two.status_code == 200
assert "<EMAIL> was removed!" in data["message"]
assert "success" in data["status"]
resp_three = client.get("/users")
data = json.loads(resp_three.data.decode())
assert resp_three.status_code == 200
assert len(data["data"]["users"]) == 0
def test_remove_user_incorrect_id(self, client, test_db):
resp = client.delete("/users/999")
data = json.loads(resp.data.decode())
assert resp.status_code == 404
assert "User does not exist" in data["message"]
assert "fail" in data["status"]
def test_update_user(self, client, test_db):
user = add_user("user-to-be-updated", "<EMAIL>")
resp_one = client.put(
f"/users/{user.id}",
data=json.dumps({"username": "me", "email": "<EMAIL>"}),
content_type="application/json",
)
data = json.loads(resp_one.data.decode())
assert resp_one.status_code == 200
assert f"{user.id} was updated!" in data["message"]
assert "success" in data["status"]
resp_two = client.get(f"/users/{user.id}")
data = json.loads(resp_two.data.decode())
assert resp_two.status_code == 200
assert "me" in data["data"]["username"]
assert "<EMAIL>" in data["data"]["email"]
assert "success" in data["status"]
def test_update_user_invalid_json(self, client, test_db):
resp = client.put(
"/users/1", data=json.dumps({}), content_type="application/json"
)
data = json.loads(resp.data.decode())
assert resp.status_code == 400
assert "Invalid payload." in data["message"]
assert "fail" in data["status"]
def test_update_user_invalid_json_keys(self, client, test_db):
resp = client.put(
"/users/1",
data=json.dumps({"email": "<EMAIL>"}),
content_type="application/json",
)
data = json.loads(resp.data.decode())
assert resp.status_code == 400
assert "Invalid payload." in data["message"]
assert "fail" in data["status"]
def test_update_user_does_not_exist(self, client, test_db):
resp = client.put(
"/users/999",
data=json.dumps({"username": "me", "email": "<EMAIL>"}),
content_type="application/json",
)
data = json.loads(resp.data.decode())
assert resp.status_code == 404
assert "User does not exist" in data["message"]
assert "fail" in data["status"]
| [
1,
529,
276,
1112,
420,
29958,
1785,
9502,
1330,
29914,
17482,
13,
5215,
4390,
13,
13,
3166,
6987,
29889,
13239,
1053,
788,
29918,
1792,
29892,
337,
3258,
29918,
2585,
13,
13,
13,
1990,
4321,
5959,
1293,
29901,
13,
1678,
822,
1243,
29918,
1202,
29918,
1792,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
2933,
353,
3132,
29889,
2490,
29898,
13,
9651,
5591,
7193,
613,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
3319,
29908,
6786,
1115,
376,
1785,
613,
376,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
511,
13,
9651,
2793,
29918,
1853,
543,
6214,
29914,
3126,
613,
13,
4706,
1723,
13,
4706,
4974,
2933,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29896,
13,
4706,
4974,
9872,
26862,
6227,
29958,
471,
2715,
3850,
297,
2933,
29889,
3126,
3366,
4906,
3108,
13,
4706,
4974,
376,
8698,
29908,
297,
2933,
29889,
3126,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
1202,
29918,
1792,
29918,
20965,
29918,
3126,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
2490,
29898,
13,
9651,
5591,
7193,
613,
848,
29922,
3126,
29889,
29881,
17204,
3319,
9594,
2793,
29918,
1853,
543,
6214,
29914,
3126,
29908,
13,
4706,
1723,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29900,
13,
4706,
4974,
376,
13919,
20092,
1213,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
1202,
29918,
1792,
29918,
20965,
29918,
3126,
29918,
8149,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
2490,
29898,
13,
9651,
5591,
7193,
613,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
3319,
29908,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
511,
13,
9651,
2793,
29918,
1853,
543,
6214,
29914,
3126,
613,
13,
4706,
1723,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29900,
13,
4706,
4974,
376,
13919,
20092,
1213,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
1202,
29918,
1792,
29918,
20908,
5926,
29918,
5269,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
3132,
29889,
2490,
29898,
13,
9651,
5591,
7193,
613,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
3319,
29908,
6786,
1115,
376,
1785,
613,
376,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
511,
13,
9651,
2793,
29918,
1853,
543,
6214,
29914,
3126,
613,
13,
4706,
1723,
13,
4706,
4613,
353,
3132,
29889,
2490,
29898,
13,
9651,
5591,
7193,
613,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
3319,
29908,
6786,
1115,
376,
1785,
613,
376,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
511,
13,
9651,
2793,
29918,
1853,
543,
6214,
29914,
3126,
613,
13,
4706,
1723,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29900,
13,
4706,
4974,
376,
29903,
3818,
29889,
2193,
4876,
2307,
4864,
1213,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
13,
1990,
4321,
5959,
29901,
13,
1678,
822,
1243,
29918,
14369,
29918,
1792,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
1404,
353,
788,
29918,
1792,
703,
15135,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
4613,
353,
3132,
29889,
657,
29898,
29888,
23901,
7193,
19248,
1792,
29889,
333,
27195,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
4706,
4974,
376,
15135,
29908,
297,
848,
3366,
1272,
3108,
3366,
6786,
3108,
13,
4706,
4974,
9872,
26862,
6227,
11903,
297,
848,
3366,
1272,
3108,
3366,
5269,
3108,
13,
4706,
4974,
376,
8698,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
14369,
29918,
1792,
29918,
1217,
29918,
333,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
657,
11974,
7193,
29914,
29844,
1159,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29946,
13,
4706,
4974,
376,
2659,
947,
451,
1863,
29908,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
14369,
29918,
1792,
29918,
262,
15728,
29918,
333,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
657,
11974,
7193,
29914,
29929,
29929,
29929,
1159,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29946,
13,
4706,
4974,
376,
2659,
947,
451,
1863,
29908,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
497,
29918,
7193,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
337,
3258,
29918,
2585,
580,
13,
4706,
788,
29918,
1792,
703,
29885,
436,
4271,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
788,
29918,
1792,
703,
29888,
1026,
4630,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
4613,
353,
3132,
29889,
657,
11974,
7193,
1159,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
4706,
4974,
7431,
29898,
1272,
3366,
1272,
3108,
3366,
7193,
20068,
1275,
29871,
29906,
13,
4706,
4974,
376,
29885,
436,
4271,
29908,
297,
848,
3366,
1272,
3108,
3366,
7193,
3108,
29961,
29900,
29962,
3366,
6786,
3108,
13,
4706,
4974,
9872,
26862,
6227,
11903,
297,
848,
3366,
1272,
3108,
3366,
7193,
3108,
29961,
29900,
29962,
3366,
5269,
3108,
13,
4706,
4974,
376,
29888,
1026,
4630,
29908,
297,
848,
3366,
1272,
3108,
3366,
7193,
3108,
29961,
29896,
29962,
3366,
6786,
3108,
13,
4706,
4974,
9872,
26862,
6227,
11903,
297,
848,
3366,
1272,
3108,
3366,
7193,
3108,
29961,
29896,
29962,
3366,
5269,
3108,
13,
4706,
4974,
376,
8698,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
5992,
29918,
1792,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
337,
3258,
29918,
2585,
580,
13,
4706,
1404,
353,
788,
29918,
1792,
703,
1792,
29899,
517,
29899,
915,
29899,
1745,
8238,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
4613,
29918,
650,
353,
3132,
29889,
657,
11974,
7193,
1159,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29918,
650,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29918,
650,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
4706,
4974,
7431,
29898,
1272,
3366,
1272,
3108,
3366,
7193,
20068,
1275,
29871,
29896,
13,
4706,
4613,
29918,
10184,
353,
3132,
29889,
8143,
29898,
29888,
23901,
7193,
19248,
1792,
29889,
333,
27195,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29918,
10184,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29918,
10184,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
4706,
4974,
9872,
26862,
6227,
29958,
471,
6206,
3850,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
8698,
29908,
297,
848,
3366,
4882,
3108,
13,
4706,
4613,
29918,
17536,
353,
3132,
29889,
657,
11974,
7193,
1159,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29918,
17536,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29918,
17536,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
4706,
4974,
7431,
29898,
1272,
3366,
1272,
3108,
3366,
7193,
20068,
1275,
29871,
29900,
13,
13,
1678,
822,
1243,
29918,
5992,
29918,
1792,
29918,
262,
15728,
29918,
333,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
8143,
11974,
7193,
29914,
29929,
29929,
29929,
1159,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29946,
13,
4706,
4974,
376,
2659,
947,
451,
1863,
29908,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
1792,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
1404,
353,
788,
29918,
1792,
703,
1792,
29899,
517,
29899,
915,
29899,
21402,
613,
9872,
26862,
6227,
29958,
1159,
13,
4706,
4613,
29918,
650,
353,
3132,
29889,
649,
29898,
13,
9651,
285,
23901,
7193,
19248,
1792,
29889,
333,
17671,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
3319,
29908,
6786,
1115,
376,
1004,
613,
376,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
511,
13,
9651,
2793,
29918,
1853,
543,
6214,
29914,
3126,
613,
13,
4706,
1723,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29918,
650,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29918,
650,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
4706,
4974,
285,
29908,
29912,
1792,
29889,
333,
29913,
471,
4784,
3850,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
8698,
29908,
297,
848,
3366,
4882,
3108,
13,
4706,
4613,
29918,
10184,
353,
3132,
29889,
657,
29898,
29888,
23901,
7193,
19248,
1792,
29889,
333,
27195,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29918,
10184,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29918,
10184,
29889,
4882,
29918,
401,
1275,
29871,
29906,
29900,
29900,
13,
4706,
4974,
376,
1004,
29908,
297,
848,
3366,
1272,
3108,
3366,
6786,
3108,
13,
4706,
4974,
9872,
26862,
6227,
11903,
297,
848,
3366,
1272,
3108,
3366,
5269,
3108,
13,
4706,
4974,
376,
8698,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
1792,
29918,
20965,
29918,
3126,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
649,
29898,
13,
9651,
5591,
7193,
29914,
29896,
613,
848,
29922,
3126,
29889,
29881,
17204,
3319,
9594,
2793,
29918,
1853,
543,
6214,
29914,
3126,
29908,
13,
4706,
1723,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29900,
13,
4706,
4974,
376,
13919,
20092,
1213,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
1792,
29918,
20965,
29918,
3126,
29918,
8149,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
649,
29898,
13,
9651,
5591,
7193,
29914,
29896,
613,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
3319,
29908,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
511,
13,
9651,
2793,
29918,
1853,
543,
6214,
29914,
3126,
613,
13,
4706,
1723,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29900,
13,
4706,
4974,
376,
13919,
20092,
1213,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
13,
1678,
822,
1243,
29918,
5504,
29918,
1792,
29918,
13221,
29918,
1333,
29918,
28997,
29898,
1311,
29892,
3132,
29892,
1243,
29918,
2585,
1125,
13,
4706,
4613,
353,
3132,
29889,
649,
29898,
13,
9651,
5591,
7193,
29914,
29929,
29929,
29929,
613,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
3319,
29908,
6786,
1115,
376,
1004,
613,
376,
5269,
1115,
9872,
26862,
6227,
29958,
9092,
511,
13,
9651,
2793,
29918,
1853,
543,
6214,
29914,
3126,
613,
13,
4706,
1723,
13,
4706,
848,
353,
4390,
29889,
18132,
29898,
13713,
29889,
1272,
29889,
13808,
3101,
13,
4706,
4974,
4613,
29889,
4882,
29918,
401,
1275,
29871,
29946,
29900,
29946,
13,
4706,
4974,
376,
2659,
947,
451,
1863,
29908,
297,
848,
3366,
4906,
3108,
13,
4706,
4974,
376,
14057,
29908,
297,
848,
3366,
4882,
3108,
13,
2
] |
setup.py | okanlv/coco-caption | 11 | 1608187 | <gh_stars>10-100
import sys
import os
import subprocess
from setuptools import setup, find_packages
import get_stanford_models
get_stanford_models.main()
packages = [p for p in find_packages() if "pycocoevalcap" in p]
setup(
name="pycocoevalcap",
packages=packages,
package_dir={"pycocoevalcap": "pycocoevalcap"},
install_requires=['pycocotools'],
version="0.0",
zip_safe=False,
include_package_data=True,
)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29899,
29896,
29900,
29900,
13,
5215,
10876,
13,
5215,
2897,
13,
5215,
1014,
5014,
13,
3166,
731,
21245,
8789,
1053,
6230,
29892,
1284,
29918,
8318,
13,
5215,
679,
29918,
14411,
4006,
29918,
9794,
13,
13,
657,
29918,
14411,
4006,
29918,
9794,
29889,
3396,
580,
13,
13,
8318,
353,
518,
29886,
363,
282,
297,
1284,
29918,
8318,
580,
565,
376,
2272,
29883,
6235,
14513,
5030,
29908,
297,
282,
29962,
13,
13,
14669,
29898,
13,
1678,
1024,
543,
2272,
29883,
6235,
14513,
5030,
613,
13,
1678,
9741,
29922,
8318,
29892,
13,
1678,
3577,
29918,
3972,
3790,
29908,
2272,
29883,
6235,
14513,
5030,
1115,
376,
2272,
29883,
6235,
14513,
5030,
10758,
13,
1678,
2601,
29918,
276,
339,
2658,
29922,
1839,
2272,
29883,
542,
327,
8789,
7464,
13,
1678,
1873,
543,
29900,
29889,
29900,
613,
13,
1678,
14319,
29918,
11177,
29922,
8824,
29892,
13,
1678,
3160,
29918,
5113,
29918,
1272,
29922,
5574,
29892,
13,
29897,
13,
13,
2
] |
gans/models/gans/gan.py | tlatkowski/gans-2.0 | 78 | 176423 | from abc import ABC
from abc import abstractmethod
class GAN(ABC):
@property
@abstractmethod
def generators(self):
raise NotImplementedError
@property
@abstractmethod
def discriminators(self):
raise NotImplementedError
@abstractmethod
def predict(self, inputs):
raise NotImplementedError
| [
1,
515,
25638,
1053,
16417,
13,
13,
3166,
25638,
1053,
9846,
5696,
13,
13,
13,
1990,
402,
2190,
29898,
19658,
1125,
13,
13,
1678,
732,
6799,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
1176,
4097,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
732,
6799,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
2313,
20386,
4097,
29898,
1311,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
1678,
732,
16595,
5696,
13,
1678,
822,
8500,
29898,
1311,
29892,
10970,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
2
] |
tkinter_examples/draw_chess_board.py | DazEB2/SimplePyScripts | 117 | 9520 | <filename>tkinter_examples/draw_chess_board.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from tkinter import *
root = Tk()
root.title('Chess board')
canvas = Canvas(root, width=700, height=700, bg='#fff')
canvas.pack()
fill = '#fff'
outline = '#000'
size = 88
for i in range(8):
for j in range(8):
x1, y1, x2, y2 = i * size, j * size, i * size + size, j * size + size
canvas.create_rectangle(x1, y1, x2, y2, fill=fill, outline=outline)
fill, outline = outline, fill
fill, outline = outline, fill
root.mainloop()
| [
1,
529,
9507,
29958,
11178,
1639,
29918,
19057,
29914,
4012,
29918,
305,
404,
29918,
3377,
29889,
2272,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
1649,
8921,
1649,
353,
525,
666,
18184,
1161,
29915,
13,
13,
13,
3166,
18883,
1639,
1053,
334,
13,
13,
4632,
353,
323,
29895,
580,
13,
4632,
29889,
3257,
877,
1451,
404,
7613,
1495,
13,
13,
15257,
353,
1815,
4428,
29898,
4632,
29892,
2920,
29922,
29955,
29900,
29900,
29892,
3171,
29922,
29955,
29900,
29900,
29892,
25989,
2433,
29937,
18725,
1495,
13,
15257,
29889,
4058,
580,
13,
13,
5589,
353,
16321,
18725,
29915,
13,
449,
1220,
353,
16321,
29900,
29900,
29900,
29915,
13,
2311,
353,
29871,
29947,
29947,
13,
13,
1454,
474,
297,
3464,
29898,
29947,
1125,
13,
1678,
363,
432,
297,
3464,
29898,
29947,
1125,
13,
4706,
921,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
353,
474,
334,
2159,
29892,
432,
334,
2159,
29892,
474,
334,
2159,
718,
2159,
29892,
432,
334,
2159,
718,
2159,
13,
13,
4706,
10508,
29889,
3258,
29918,
1621,
2521,
29898,
29916,
29896,
29892,
343,
29896,
29892,
921,
29906,
29892,
343,
29906,
29892,
5445,
29922,
5589,
29892,
27887,
29922,
449,
1220,
29897,
13,
4706,
5445,
29892,
27887,
353,
27887,
29892,
5445,
13,
13,
1678,
5445,
29892,
27887,
353,
27887,
29892,
5445,
13,
13,
4632,
29889,
3396,
7888,
580,
13,
2
] |
restfulpy/tests/test_orderable_mixin.py | maryayi/restfulpy | 1 | 101749 | <reponame>maryayi/restfulpy
import unittest
from sqlalchemy import Unicode
from nanohttp import settings
from restfulpy.orm import DeclarativeBase, DBSession, Field, OrderableMixin
from restfulpy.testing import WebAppTestCase
from restfulpy.tests.helpers import MockupApplication
class OrderableCheckingModel(OrderableMixin, DeclarativeBase):
__tablename__ = 'orderable_checking_model'
title = Field(Unicode(50), primary_key=True)
class OrderableCheckingModelTestCase(WebAppTestCase):
application = MockupApplication('MockupApplication', None)
__configuration__ = '''
db:
url: sqlite:// # In memory DB
echo: false
'''
@classmethod
def configure_app(cls):
cls.application.configure(force=True)
settings.merge(cls.__configuration__)
def test_orderable_mixin(self):
for i in range(3):
# noinspection PyArgumentList
instance = OrderableCheckingModel(
title='test title %s' % i,
order=i
)
DBSession.add(instance)
DBSession.commit()
instances = OrderableCheckingModel.apply_default_sort().all()
self.assertEqual(instances[0].order, 0)
self.assertEqual(instances[2].order, 2)
if __name__ == '__main__': # pragma: no cover
unittest.main()
| [
1,
529,
276,
1112,
420,
29958,
5219,
388,
29875,
29914,
5060,
1319,
2272,
13,
5215,
443,
27958,
13,
13,
3166,
4576,
284,
305,
6764,
1053,
23862,
13,
3166,
302,
1562,
1124,
1053,
6055,
13,
13,
3166,
1791,
1319,
2272,
29889,
555,
1053,
3826,
4675,
1230,
5160,
29892,
6535,
7317,
29892,
8989,
29892,
8170,
519,
29924,
861,
262,
13,
3166,
1791,
1319,
2272,
29889,
13424,
1053,
2563,
2052,
3057,
8259,
13,
3166,
1791,
1319,
2272,
29889,
21150,
29889,
3952,
6774,
1053,
26297,
786,
4873,
13,
13,
13,
1990,
8170,
519,
5596,
292,
3195,
29898,
7514,
519,
29924,
861,
262,
29892,
3826,
4675,
1230,
5160,
1125,
13,
1678,
4770,
3891,
2435,
420,
1649,
353,
525,
2098,
519,
29918,
3198,
292,
29918,
4299,
29915,
13,
13,
1678,
3611,
353,
8989,
29898,
2525,
12858,
29898,
29945,
29900,
511,
7601,
29918,
1989,
29922,
5574,
29897,
13,
13,
13,
1990,
8170,
519,
5596,
292,
3195,
3057,
8259,
29898,
3609,
2052,
3057,
8259,
1125,
13,
1678,
2280,
353,
26297,
786,
4873,
877,
18680,
786,
4873,
742,
6213,
29897,
13,
1678,
4770,
13305,
1649,
353,
14550,
13,
1678,
4833,
29901,
13,
418,
3142,
29901,
21120,
597,
1678,
396,
512,
3370,
6535,
13,
418,
2916,
29901,
2089,
13,
1678,
14550,
13,
13,
1678,
732,
1990,
5696,
13,
1678,
822,
10822,
29918,
932,
29898,
25932,
1125,
13,
4706,
1067,
29879,
29889,
6214,
29889,
17591,
29898,
10118,
29922,
5574,
29897,
13,
4706,
6055,
29889,
14634,
29898,
25932,
17255,
13305,
1649,
29897,
13,
13,
1678,
822,
1243,
29918,
2098,
519,
29918,
28084,
262,
29898,
1311,
1125,
13,
13,
4706,
363,
474,
297,
3464,
29898,
29941,
1125,
13,
9651,
396,
694,
1144,
27988,
10772,
15730,
1293,
13,
9651,
2777,
353,
8170,
519,
5596,
292,
3195,
29898,
13,
18884,
3611,
2433,
1688,
3611,
1273,
29879,
29915,
1273,
474,
29892,
13,
18884,
1797,
29922,
29875,
13,
9651,
1723,
13,
9651,
6535,
7317,
29889,
1202,
29898,
8758,
29897,
13,
9651,
6535,
7317,
29889,
15060,
580,
13,
13,
4706,
8871,
353,
8170,
519,
5596,
292,
3195,
29889,
7302,
29918,
4381,
29918,
6605,
2141,
497,
580,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2611,
2925,
29961,
29900,
1822,
2098,
29892,
29871,
29900,
29897,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2611,
2925,
29961,
29906,
1822,
2098,
29892,
29871,
29906,
29897,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
29871,
396,
282,
23929,
29901,
694,
4612,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
tfidf.py | ezhouyang/class | 1 | 86191 | <reponame>ezhouyang/class
#coding:utf-8
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn import svm
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.decomposition import PCA
from sklearn.linear_model import SGDClassifier
from sklearn import cross_validation
import csv
from scipy import sparse
def read_file():
print "read_train"
f = open("train.tsv","U")
reader = csv.reader(f,delimiter='\t')
#用来存放训练集的文章
text_train = []
#用来存放训练集的标签
label = []
#用来存放测试集的文章
text_test = []
#用来存放urlid
urlid = []
extra_train = []
extra_test = []
g = lambda x : x.isalpha or x == ' '
a = 0
print "read train file begin"
for row in reader:
if a == 0:
a = a + 1
else:
#标签为最后一项
label.append(int(row[len(row)-1]))
#选择第二项作为训练文章
#text_train.append(row[2]+" "+row[0]+" "+row[3])
text_train.append(row[2]+" "+row[0])
#处理一下其他feature
#extra_train.append([float(i)/100.0 for i in row[5:len(row)-1]])
#extra_train.append([float(row[13]),float(row[6])/10.0,float(row[7])/10.0,float(row[8])/10.0,float(row[9])/10.0])
extra_train.append([float(row[7])])
f.close()
print "read test"
f = open("test.tsv","U")
reader = csv.reader(f,delimiter='\t')
a = 0
for row in reader:
if a == 0:
a = a + 1
else:
urlid.append(row[1])
#text_test.append(row[2]+" "+row[0]+" "+row[3])
text_test.append(row[2]+" "+row[0])
#extra_test.append([float(i)/100.0 for i in row[5:len(row)]])
#extra_test.append([float(row[13]),float(row[6])/10.0,float(row[7])/10.0,float(row[8])/10.0,float(row[9])/10.0])
extra_test.append([float(row[7])])
return text_train,label,text_test,urlid,extra_train,extra_test
def remain(answer):
"""
Arguments:
- `answer`:
"""
for i in range(len(answer)):
if answer[i] > 0.9725:
answer[i] = 1.0
return answer
if __name__ == "__main__":
train,label,test,urlid,extra_train1,extra_test1 = read_file()
print "train length",len(train)
print "test length",len(test)
vectorizer = TfidfVectorizer(sublinear_tf=True,min_df = 3,ngram_range=(1,2),smooth_idf=True,token_pattern=r'\w{1,}',use_idf=1,analyzer='word',strip_accents='unicode')
print "transform train to tf matrix"
print "transform test to tf matrix"
length_train = len(train)
x_all = train + test
x_all = vectorizer.fit_transform(x_all)
x = x_all[:length_train]
t = x_all[length_train:]
extra_train,extra_test = [],[]
print "读topic"
f1 = open("topic_train.txt")
for line in f1.readlines():
sp = line.split()
sp = [float(j) for j in sp]
extra_train.append(sp)
f2 = open("topic_test.txt")
for line in f2.readlines():
sp = line.split()
sp = [float(j) for j in sp]
extra_test.append(sp)
extra_train = np.array(extra_train)
extra_test = np.array(extra_test)
print "topic num",extra_train.shape
print "合并特征"
x = sparse.hstack((x,extra_train)).tocsr()
t = sparse.hstack((t,extra_test)).tocsr()
#x = sparse.hstack((x,extra_train1)).tocsr()
#t = sparse.hstack((t,extra_test1)).tocsr()
label = np.array(label)
clf = LogisticRegression(penalty='l1',C=30,tol=1e-9)
x = clf.fit_transform(x,label)
t = clf.transform(t)
print "x shape",x.shape
print "t.shape",t.shape
#clf = svm.SVC(kernel='sigmoid',degree=9,gamma=10)
#clf = svm.SVC(degree=9,gamma=0.001)
#clf = KNeighborsClassifier(n_neighbors=1)
#
#clf = SGDClassifier(loss="log",n_iter=300, penalty="l2",alpha=0.0003)
clf = LogisticRegression(penalty='l2',dual=True,fit_intercept=False,C=3.2,tol=1e-9,class_weight=None, random_state=None, intercept_scaling=1.0)
print "交叉验证"
print np.mean(cross_validation.cross_val_score(clf,x,label,cv=20,scoring='roc_auc'))
clf.fit(x,label)
#验一下自己的结果
print "训练自己",clf.score(x,label)
answer = clf.predict_proba(t)[:,1]
#answer = remain(answer)
f = open("hand_answer.csv","w")
f.write('urlid,label\n')
for i in xrange(len(test)):
f.write("%s,%s\n"%(urlid[i],answer[i]))
| [
1,
529,
276,
1112,
420,
29958,
6096,
10774,
29891,
574,
29914,
1990,
13,
29937,
29883,
3689,
29901,
9420,
29899,
29947,
13,
13,
5215,
12655,
408,
7442,
13,
3166,
2071,
19668,
29889,
14394,
29918,
1062,
13857,
29889,
726,
1053,
3917,
12877,
3950,
13,
3166,
2071,
19668,
29889,
14394,
29918,
1062,
13857,
29889,
726,
1053,
323,
29888,
333,
29888,
13372,
261,
13,
3166,
2071,
19668,
29889,
14394,
29918,
1062,
13857,
29889,
726,
1053,
323,
29888,
333,
29888,
12877,
3950,
13,
3166,
2071,
19668,
1053,
3731,
29885,
13,
3166,
2071,
19668,
29889,
484,
1141,
29890,
943,
1053,
476,
8139,
1141,
29890,
943,
2385,
3709,
13,
3166,
2071,
19668,
29889,
10660,
29918,
4299,
1053,
4522,
4695,
4597,
23881,
13,
3166,
2071,
19668,
29889,
311,
510,
3283,
1053,
349,
5454,
13,
3166,
2071,
19668,
29889,
10660,
29918,
4299,
1053,
317,
29954,
29928,
2385,
3709,
13,
3166,
2071,
19668,
1053,
4891,
29918,
18157,
13,
5215,
11799,
13,
3166,
4560,
2272,
1053,
29234,
13,
13,
1753,
1303,
29918,
1445,
7295,
13,
1678,
1596,
376,
949,
29918,
14968,
29908,
13,
1678,
285,
353,
1722,
703,
14968,
29889,
1372,
29894,
3284,
29965,
1159,
13,
1678,
9591,
353,
11799,
29889,
16950,
29898,
29888,
29892,
6144,
19657,
2433,
29905,
29873,
1495,
13,
1678,
396,
30406,
30805,
30946,
31182,
235,
177,
176,
234,
190,
134,
30893,
30210,
30333,
31374,
13,
1678,
1426,
29918,
14968,
353,
5159,
13,
1678,
396,
30406,
30805,
30946,
31182,
235,
177,
176,
234,
190,
134,
30893,
30210,
31062,
234,
176,
193,
13,
1678,
3858,
353,
5159,
13,
1678,
396,
30406,
30805,
30946,
31182,
31851,
31787,
30893,
30210,
30333,
31374,
13,
1678,
1426,
29918,
1688,
353,
5159,
13,
1678,
396,
30406,
30805,
30946,
31182,
2271,
333,
13,
1678,
3142,
333,
353,
5159,
13,
13,
1678,
4805,
29918,
14968,
353,
5159,
13,
1678,
4805,
29918,
1688,
353,
5159,
13,
13,
1678,
330,
353,
14013,
921,
584,
921,
29889,
275,
2312,
470,
921,
1275,
525,
525,
13,
268,
13,
1678,
263,
353,
29871,
29900,
13,
1678,
1596,
376,
949,
7945,
934,
3380,
29908,
13,
1678,
363,
1948,
297,
9591,
29901,
13,
4706,
565,
263,
1275,
29871,
29900,
29901,
13,
9651,
263,
353,
263,
718,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
396,
31062,
234,
176,
193,
30573,
30878,
30822,
30287,
31888,
13,
9651,
3858,
29889,
4397,
29898,
524,
29898,
798,
29961,
2435,
29898,
798,
6817,
29896,
12622,
13,
9651,
396,
31333,
233,
142,
172,
30622,
30685,
31888,
30732,
30573,
235,
177,
176,
234,
190,
134,
30333,
31374,
13,
9651,
396,
726,
29918,
14968,
29889,
4397,
29898,
798,
29961,
29906,
10062,
29908,
15691,
798,
29961,
29900,
10062,
29908,
15691,
798,
29961,
29941,
2314,
13,
9651,
1426,
29918,
14968,
29889,
4397,
29898,
798,
29961,
29906,
10062,
29908,
15691,
798,
29961,
29900,
2314,
13,
9651,
396,
31548,
30687,
30287,
30557,
31149,
31221,
14394,
13,
462,
13,
9651,
396,
17833,
29918,
14968,
29889,
4397,
4197,
7411,
29898,
29875,
6802,
29896,
29900,
29900,
29889,
29900,
363,
474,
297,
1948,
29961,
29945,
29901,
2435,
29898,
798,
6817,
29896,
24960,
13,
9651,
396,
17833,
29918,
14968,
29889,
4397,
4197,
7411,
29898,
798,
29961,
29896,
29941,
11724,
7411,
29898,
798,
29961,
29953,
2314,
29914,
29896,
29900,
29889,
29900,
29892,
7411,
29898,
798,
29961,
29955,
2314,
29914,
29896,
29900,
29889,
29900,
29892,
7411,
29898,
798,
29961,
29947,
2314,
29914,
29896,
29900,
29889,
29900,
29892,
7411,
29898,
798,
29961,
29929,
2314,
29914,
29896,
29900,
29889,
29900,
2314,
13,
9651,
4805,
29918,
14968,
29889,
4397,
4197,
7411,
29898,
798,
29961,
29955,
2314,
2314,
13,
13,
1678,
285,
29889,
5358,
580,
13,
1678,
1596,
376,
949,
1243,
29908,
13,
1678,
285,
353,
1722,
703,
1688,
29889,
1372,
29894,
3284,
29965,
1159,
13,
1678,
9591,
353,
11799,
29889,
16950,
29898,
29888,
29892,
6144,
19657,
2433,
29905,
29873,
1495,
13,
268,
13,
1678,
263,
353,
29871,
29900,
13,
1678,
363,
1948,
297,
9591,
29901,
13,
4706,
565,
263,
1275,
29871,
29900,
29901,
13,
9651,
263,
353,
263,
718,
29871,
29896,
13,
4706,
1683,
29901,
13,
9651,
3142,
333,
29889,
4397,
29898,
798,
29961,
29896,
2314,
13,
9651,
396,
726,
29918,
1688,
29889,
4397,
29898,
798,
29961,
29906,
10062,
29908,
15691,
798,
29961,
29900,
10062,
29908,
15691,
798,
29961,
29941,
2314,
13,
9651,
1426,
29918,
1688,
29889,
4397,
29898,
798,
29961,
29906,
10062,
29908,
15691,
798,
29961,
29900,
2314,
13,
13,
9651,
396,
17833,
29918,
1688,
29889,
4397,
4197,
7411,
29898,
29875,
6802,
29896,
29900,
29900,
29889,
29900,
363,
474,
297,
1948,
29961,
29945,
29901,
2435,
29898,
798,
4638,
2314,
13,
9651,
396,
17833,
29918,
1688,
29889,
4397,
4197,
7411,
29898,
798,
29961,
29896,
29941,
11724,
7411,
29898,
798,
29961,
29953,
2314,
29914,
29896,
29900,
29889,
29900,
29892,
7411,
29898,
798,
29961,
29955,
2314,
29914,
29896,
29900,
29889,
29900,
29892,
7411,
29898,
798,
29961,
29947,
2314,
29914,
29896,
29900,
29889,
29900,
29892,
7411,
29898,
798,
29961,
29929,
2314,
29914,
29896,
29900,
29889,
29900,
2314,
13,
9651,
4805,
29918,
1688,
29889,
4397,
4197,
7411,
29898,
798,
29961,
29955,
2314,
2314,
13,
13,
268,
13,
1678,
736,
1426,
29918,
14968,
29892,
1643,
29892,
726,
29918,
1688,
29892,
2271,
333,
29892,
17833,
29918,
14968,
29892,
17833,
29918,
1688,
13,
13,
1753,
3933,
29898,
12011,
1125,
13,
1678,
9995,
13,
268,
13,
1678,
11842,
9331,
29901,
13,
1678,
448,
421,
12011,
6998,
13,
1678,
9995,
13,
268,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
12011,
22164,
13,
4706,
565,
1234,
29961,
29875,
29962,
1405,
29871,
29900,
29889,
29929,
29955,
29906,
29945,
29901,
13,
9651,
1234,
29961,
29875,
29962,
353,
29871,
29896,
29889,
29900,
13,
1678,
736,
1234,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
7945,
29892,
1643,
29892,
1688,
29892,
2271,
333,
29892,
17833,
29918,
14968,
29896,
29892,
17833,
29918,
1688,
29896,
353,
1303,
29918,
1445,
580,
13,
1678,
1596,
376,
14968,
3309,
613,
2435,
29898,
14968,
29897,
13,
1678,
1596,
376,
1688,
3309,
613,
2435,
29898,
1688,
29897,
13,
1678,
4608,
3950,
353,
323,
29888,
333,
29888,
12877,
3950,
29898,
1491,
10660,
29918,
13264,
29922,
5574,
29892,
1195,
29918,
2176,
353,
29871,
29941,
29892,
29876,
1393,
29918,
3881,
7607,
29896,
29892,
29906,
511,
3844,
6983,
29918,
333,
29888,
29922,
5574,
29892,
6979,
29918,
11037,
29922,
29878,
12764,
29893,
29912,
29896,
29892,
29913,
742,
1509,
29918,
333,
29888,
29922,
29896,
29892,
24209,
3298,
2433,
1742,
742,
17010,
29918,
5753,
1237,
2433,
2523,
356,
1495,
13,
1678,
1596,
376,
9067,
7945,
304,
15886,
4636,
29908,
13,
1678,
1596,
376,
9067,
1243,
304,
15886,
4636,
29908,
13,
1678,
3309,
29918,
14968,
353,
7431,
29898,
14968,
29897,
13,
1678,
921,
29918,
497,
353,
7945,
718,
1243,
13,
1678,
921,
29918,
497,
353,
4608,
3950,
29889,
9202,
29918,
9067,
29898,
29916,
29918,
497,
29897,
13,
1678,
921,
353,
921,
29918,
497,
7503,
2848,
29918,
14968,
29962,
13,
1678,
260,
353,
921,
29918,
497,
29961,
2848,
29918,
14968,
17531,
13,
13,
1678,
4805,
29918,
14968,
29892,
17833,
29918,
1688,
353,
19997,
2636,
13,
13,
1678,
1596,
376,
235,
178,
190,
13010,
29908,
13,
1678,
285,
29896,
353,
1722,
703,
13010,
29918,
14968,
29889,
3945,
1159,
13,
1678,
363,
1196,
297,
285,
29896,
29889,
949,
9012,
7295,
13,
4706,
805,
353,
1196,
29889,
5451,
580,
13,
4706,
805,
353,
518,
7411,
29898,
29926,
29897,
363,
432,
297,
805,
29962,
13,
13,
4706,
4805,
29918,
14968,
29889,
4397,
29898,
1028,
29897,
13,
13,
1678,
285,
29906,
353,
1722,
703,
13010,
29918,
1688,
29889,
3945,
1159,
13,
1678,
363,
1196,
297,
285,
29906,
29889,
949,
9012,
7295,
13,
4706,
805,
353,
1196,
29889,
5451,
580,
13,
4706,
805,
353,
518,
7411,
29898,
29926,
29897,
363,
432,
297,
805,
29962,
13,
13,
4706,
4805,
29918,
1688,
29889,
4397,
29898,
1028,
29897,
13,
13,
1678,
4805,
29918,
14968,
353,
7442,
29889,
2378,
29898,
17833,
29918,
14968,
29897,
13,
1678,
4805,
29918,
1688,
29871,
353,
7442,
29889,
2378,
29898,
17833,
29918,
1688,
29897,
13,
1678,
1596,
376,
13010,
954,
613,
17833,
29918,
14968,
29889,
12181,
13,
13,
1678,
1596,
376,
30733,
31666,
31141,
232,
193,
132,
29908,
13,
1678,
921,
353,
29234,
29889,
29882,
1429,
3552,
29916,
29892,
17833,
29918,
14968,
8106,
517,
2395,
29878,
580,
13,
1678,
260,
353,
29234,
29889,
29882,
1429,
3552,
29873,
29892,
17833,
29918,
1688,
8106,
517,
2395,
29878,
580,
13,
1678,
396,
29916,
353,
29234,
29889,
29882,
1429,
3552,
29916,
29892,
17833,
29918,
14968,
29896,
8106,
517,
2395,
29878,
580,
13,
1678,
396,
29873,
353,
29234,
29889,
29882,
1429,
3552,
29873,
29892,
17833,
29918,
1688,
29896,
8106,
517,
2395,
29878,
580,
13,
13,
1678,
3858,
353,
7442,
29889,
2378,
29898,
1643,
29897,
13,
13,
1678,
1067,
29888,
353,
4522,
4695,
4597,
23881,
29898,
2238,
18745,
2433,
29880,
29896,
742,
29907,
29922,
29941,
29900,
29892,
25027,
29922,
29896,
29872,
29899,
29929,
29897,
13,
13,
1678,
921,
353,
1067,
29888,
29889,
9202,
29918,
9067,
29898,
29916,
29892,
1643,
29897,
13,
13,
1678,
260,
353,
1067,
29888,
29889,
9067,
29898,
29873,
29897,
13,
13,
1678,
1596,
376,
29916,
8267,
613,
29916,
29889,
12181,
13,
1678,
1596,
376,
29873,
29889,
12181,
613,
29873,
29889,
12181,
13,
268,
13,
1678,
396,
695,
29888,
353,
3731,
29885,
29889,
7597,
29907,
29898,
17460,
2433,
18816,
29885,
3398,
742,
12163,
929,
29922,
29929,
29892,
4283,
29922,
29896,
29900,
29897,
13,
1678,
396,
695,
29888,
353,
3731,
29885,
29889,
7597,
29907,
29898,
12163,
929,
29922,
29929,
29892,
4283,
29922,
29900,
29889,
29900,
29900,
29896,
29897,
13,
1678,
396,
695,
29888,
353,
476,
8139,
1141,
29890,
943,
2385,
3709,
29898,
29876,
29918,
484,
1141,
29890,
943,
29922,
29896,
29897,
13,
1678,
396,
13,
1678,
396,
695,
29888,
353,
317,
29954,
29928,
2385,
3709,
29898,
6758,
543,
1188,
613,
29876,
29918,
1524,
29922,
29941,
29900,
29900,
29892,
27368,
543,
29880,
29906,
613,
2312,
29922,
29900,
29889,
29900,
29900,
29900,
29941,
29897,
13,
1678,
1067,
29888,
353,
4522,
4695,
4597,
23881,
29898,
2238,
18745,
2433,
29880,
29906,
742,
700,
284,
29922,
5574,
29892,
9202,
29918,
1639,
1547,
29922,
8824,
29892,
29907,
29922,
29941,
29889,
29906,
29892,
25027,
29922,
29896,
29872,
29899,
29929,
29892,
1990,
29918,
7915,
29922,
8516,
29892,
4036,
29918,
3859,
29922,
8516,
29892,
23404,
29918,
19529,
292,
29922,
29896,
29889,
29900,
29897,
13,
1678,
1596,
376,
31398,
232,
146,
140,
236,
173,
143,
235,
178,
132,
29908,
13,
1678,
1596,
7442,
29889,
12676,
29898,
19128,
29918,
18157,
29889,
19128,
29918,
791,
29918,
13628,
29898,
695,
29888,
29892,
29916,
29892,
1643,
29892,
11023,
29922,
29906,
29900,
29892,
1557,
8253,
2433,
10198,
29918,
14766,
8785,
13,
1678,
1067,
29888,
29889,
9202,
29898,
29916,
29892,
1643,
29897,
13,
1678,
396,
236,
173,
143,
30287,
30557,
30688,
232,
186,
180,
30210,
31320,
30801,
13,
1678,
1596,
376,
235,
177,
176,
234,
190,
134,
30688,
232,
186,
180,
613,
695,
29888,
29889,
13628,
29898,
29916,
29892,
1643,
29897,
13,
1678,
1234,
353,
29871,
1067,
29888,
29889,
27711,
29918,
771,
2291,
29898,
29873,
29897,
7503,
29892,
29896,
29962,
13,
1678,
396,
12011,
353,
3933,
29898,
12011,
29897,
13,
268,
13,
1678,
285,
353,
1722,
703,
3179,
29918,
12011,
29889,
7638,
3284,
29893,
1159,
13,
1678,
285,
29889,
3539,
877,
2271,
333,
29892,
1643,
29905,
29876,
1495,
13,
13,
1678,
363,
474,
297,
921,
3881,
29898,
2435,
29898,
1688,
22164,
13,
4706,
285,
29889,
3539,
11702,
29879,
24163,
29879,
29905,
29876,
29908,
29995,
29898,
2271,
333,
29961,
29875,
1402,
12011,
29961,
29875,
12622,
13,
268,
13,
268,
13,
13,
2
] |
tweet-fanclub/handler.py | alexellis/faas-twitter-fanclub | 22 | 124312 | import requests
import json
import base64
import redis
import os
def handle(st):
# parse Github event
req = json.loads(st)
minutes = 1
minutes_val = os.getenv("cache-minutes")
if minutes_val != None:
minutes = int(minutes_val)
loginName = req["sender"]["login"]
try:
redis_client = redis.StrictRedis("redis")
redis_key = "tweet-" + loginName
cached = redis_client.get(redis_key)
if cached != None:
print(loginName + " attempted to trigger event again before cache expired. Extending cache timeout.")
redis_client.setex(redis_key, 60 * minutes, "1")
return
redis_client.setex(redis_key, 60 * minutes, "1")
except Exception:
print("Redis may be down or errored")
# download the avatar binary using getavatar function
r = requests.post("http://gateway:8080/function/get-avatar", json=req)
res = r.json()
# Figure out the correct extension for the avatar.
ext = ".jpg"
if res["contentType"] == "image/png":
ext = ".png"
# Take the encoded image and turn into binary bytes
imageData = base64.standard_b64decode(res["content"])
put_url = "http://minio-shim:8080/put/" + loginName + ext
# Store in the fan-club photo gallery
r1 = requests.post(put_url, data= imageData)
gazer = {}
gazer["login"] = loginName
gazer["filename"] = loginName + ext
r2 = requests.post("http://gateway:8080/function/tweetstargazer", json.dumps(gazer))
club_res = {}
club_res["put_url"] = put_url
club_res["tweet_result"] = r2.text
club_res["status"] = "success"
club_res["username"] = req["sender"]["login"]
club_res["bytes"] = len(imageData)
# Useful for logging, GitHub's invoker will receive this string
print(json.dumps(club_res))
| [
1,
1053,
7274,
13,
5215,
4390,
13,
5215,
2967,
29953,
29946,
13,
5215,
29825,
13,
5215,
2897,
13,
13,
1753,
4386,
29898,
303,
1125,
13,
1678,
396,
6088,
402,
2985,
1741,
13,
1678,
12428,
353,
4390,
29889,
18132,
29898,
303,
29897,
13,
13,
1678,
6233,
353,
29871,
29896,
13,
1678,
6233,
29918,
791,
353,
2897,
29889,
657,
6272,
703,
8173,
29899,
1195,
2667,
1159,
13,
1678,
565,
6233,
29918,
791,
2804,
6213,
29901,
13,
4706,
6233,
353,
938,
29898,
1195,
2667,
29918,
791,
29897,
13,
13,
1678,
6464,
1170,
353,
12428,
3366,
15452,
3108,
3366,
7507,
3108,
13,
13,
1678,
1018,
29901,
13,
4706,
29825,
29918,
4645,
353,
29825,
29889,
5015,
919,
9039,
275,
703,
1127,
275,
1159,
13,
4706,
29825,
29918,
1989,
353,
376,
29873,
16668,
29899,
29908,
718,
6464,
1170,
13,
13,
4706,
22152,
353,
29825,
29918,
4645,
29889,
657,
29898,
1127,
275,
29918,
1989,
29897,
13,
13,
4706,
565,
22152,
2804,
6213,
29901,
13,
9651,
1596,
29898,
7507,
1170,
718,
376,
16388,
304,
7135,
1741,
1449,
1434,
7090,
1518,
2859,
29889,
7338,
2548,
7090,
11815,
23157,
13,
9651,
29825,
29918,
4645,
29889,
842,
735,
29898,
1127,
275,
29918,
1989,
29892,
29871,
29953,
29900,
334,
6233,
29892,
376,
29896,
1159,
13,
9651,
736,
13,
13,
4706,
29825,
29918,
4645,
29889,
842,
735,
29898,
1127,
275,
29918,
1989,
29892,
29871,
29953,
29900,
334,
6233,
29892,
376,
29896,
1159,
13,
1678,
5174,
8960,
29901,
13,
4706,
1596,
703,
9039,
275,
1122,
367,
1623,
470,
1059,
287,
1159,
13,
13,
1678,
396,
5142,
278,
1029,
14873,
7581,
773,
679,
485,
14873,
740,
13,
1678,
364,
353,
7274,
29889,
2490,
703,
1124,
597,
17062,
1582,
29901,
29947,
29900,
29947,
29900,
29914,
2220,
29914,
657,
29899,
485,
14873,
613,
4390,
29922,
7971,
29897,
13,
13,
1678,
620,
353,
364,
29889,
3126,
580,
13,
13,
1678,
396,
11479,
714,
278,
1959,
6081,
363,
278,
1029,
14873,
29889,
13,
1678,
1294,
353,
11393,
6173,
29908,
13,
1678,
565,
620,
3366,
3051,
1542,
3108,
1275,
376,
3027,
29914,
2732,
1115,
13,
4706,
1294,
353,
11393,
2732,
29908,
13,
13,
1678,
396,
11190,
278,
18511,
1967,
322,
2507,
964,
7581,
6262,
13,
1678,
1967,
1469,
353,
2967,
29953,
29946,
29889,
15770,
29918,
29890,
29953,
29946,
13808,
29898,
690,
3366,
3051,
20068,
13,
1678,
1925,
29918,
2271,
353,
376,
1124,
597,
1195,
601,
29899,
845,
326,
29901,
29947,
29900,
29947,
29900,
29914,
649,
12975,
718,
6464,
1170,
718,
1294,
13,
1678,
396,
14491,
297,
278,
13524,
29899,
29066,
15373,
23363,
13,
1678,
364,
29896,
353,
7274,
29889,
2490,
29898,
649,
29918,
2271,
29892,
848,
29922,
1967,
1469,
29897,
13,
13,
1678,
12642,
261,
353,
6571,
13,
1678,
12642,
261,
3366,
7507,
3108,
353,
6464,
1170,
13,
1678,
12642,
261,
3366,
9507,
3108,
353,
6464,
1170,
718,
1294,
13,
13,
1678,
364,
29906,
353,
7274,
29889,
2490,
703,
1124,
597,
17062,
1582,
29901,
29947,
29900,
29947,
29900,
29914,
2220,
29914,
29873,
16668,
303,
1191,
834,
261,
613,
4390,
29889,
29881,
17204,
29898,
29887,
834,
261,
876,
13,
13,
1678,
4402,
29918,
690,
353,
6571,
13,
1678,
4402,
29918,
690,
3366,
649,
29918,
2271,
3108,
353,
1925,
29918,
2271,
13,
1678,
4402,
29918,
690,
3366,
29873,
16668,
29918,
2914,
3108,
353,
364,
29906,
29889,
726,
13,
1678,
4402,
29918,
690,
3366,
4882,
3108,
353,
376,
8698,
29908,
13,
1678,
4402,
29918,
690,
3366,
6786,
3108,
353,
12428,
3366,
15452,
3108,
3366,
7507,
3108,
13,
1678,
4402,
29918,
690,
3366,
13193,
3108,
353,
7431,
29898,
3027,
1469,
29897,
13,
13,
1678,
396,
4803,
1319,
363,
12183,
29892,
25492,
29915,
29879,
2437,
17933,
674,
7150,
445,
1347,
13,
1678,
1596,
29898,
3126,
29889,
29881,
17204,
29898,
29066,
29918,
690,
876,
13,
2
] |
class work/Jacob_ledbetter_102215_pygmaedemo/Jacob_ledbetter_102215_pygmaedemo.py | jll123567/freshmen-code | 0 | 173554 | #------------------------------------------
#press f5
#arows to move
#get hearts avoid green thing
#if you die try again
#good luck
#_______----------------------------
#import
import pygame
import random
import time
#init
pygame.init()
#surface size
display_width=1000
display_height=600
#color def
black= (0,0,0)
white=(255,255,255)
red=(255,0,0)
cyan=(65,255,243)
#more surface info
gameDisplay = pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('demo')
#clock
clock = pygame.time.Clock()
#the refrence imiges
faceImg = pygame.image.load('face.png')
hrtImg=pygame.image.load('hrt_sml.png')
badImg=pygame.image.load('bad.png')
#runing the elements
def bad(x,y):
gameDisplay.blit(badImg,(x,y))
def face(x,y):
gameDisplay.blit(faceImg,(x,y))
def heart(x,y):
gameDisplay.blit(hrtImg,(x,y))
#dif
def dif():
global hrt_count
if hrt_count==10:
bad(badx-100,bady+10)
def score(count):
font = pygame.font.SysFont('./fontp',32)
text= font.render(str(count),True,black)
gameDisplay.blit(text,(0,0))
#start pos
facex=(display_width*0.68)
facey=(display_height*0.4)
hrtx=(display_width*0.34)
hrty=facey
badx=random.randint(20,950)
bady=random.randint(20,550)
#hrtcounter
hrt_count=0
#the change vars
facex_change=0
facey_change=0
badx_chng=5
bady_chng=5
#crash var(old)
crashed = False
#game loop
while not crashed:
for event in pygame.event.get():
if event.type == pygame.QUIT:
crashed = True
quit()
#border fix
if facex > display_width:
facex -= 150
elif facex < 0:
facex += 150
elif facey > display_height:
facey -= 50
elif facey < 0:
facey += 50
#movement
if event.type == pygame.KEYDOWN:
if event.key==pygame.K_LEFT:
facex_change= -5
elif event.key==pygame.K_RIGHT:
facex_change=5
elif event.key==pygame.K_UP:
facey_change= -5
elif event.key==pygame.K_DOWN:
facey_change= 5
if event.type==pygame.KEYUP:
if event.key==pygame.K_RIGHT or event.key == pygame.K_LEFT:
facex_change=0
elif event.key==pygame.K_UP or event.key==pygame.K_DOWN:
facey_change=0
facex += facex_change
facey += facey_change
#dif change
dif()
#bad movement
if bady > 580:
bady_chng=bady_chng*-1
bady_chng-=1
elif bady < 20:
bady_chng=bady_chng**1
bady_chng+=1
elif badx > 980:
badx_chng=badx_chng*-1
badx_chng-=1
elif badx < 20:
badx_chng=badx_chng**1
badx_chng +=1
badx +=badx_chng
bady += bady_chng
#hrt colection
if facex >= hrtx - 50 and facex <= hrtx +50:
if facey >= hrty-50 and facey<=hrty+50:
hrt_count += 1
hrtx=random.randint(0,950)
hrty=random.randint(0,550)
#bad colision detection
if facex >= badx- 50 and facex <= badx +50:
if facey >= bady-50 and facey<=bady+50:
print('you ded')
print('score:',hrt_count)
time.sleep(2)
pygame.quit()
time.sleep(2
)
quit()
#background
gameDisplay.fill(cyan)
heart(hrtx,hrty)
face(facex,facey)
bad(badx,bady)
score(hrt_count)
#update
pygame.display.update()
clock.tick(30)
#quit
pygame.quit()
quit()
#complete!!!
| [
1,
396,
2683,
2683,
28400,
13,
13,
13,
13,
13,
13,
29937,
2139,
285,
29945,
13,
29937,
279,
1242,
304,
4337,
13,
29937,
657,
26490,
4772,
7933,
2655,
13,
29937,
361,
366,
762,
1018,
1449,
13,
29937,
16773,
9885,
13,
13,
13,
13,
29937,
7652,
22359,
2683,
9072,
13,
29937,
5215,
13,
5215,
22028,
13,
5215,
4036,
13,
5215,
931,
13,
29937,
2344,
13,
2272,
11802,
29889,
2344,
580,
13,
29937,
7610,
2161,
2159,
13,
4990,
29918,
2103,
29922,
29896,
29900,
29900,
29900,
13,
4990,
29918,
3545,
29922,
29953,
29900,
29900,
13,
29937,
2780,
822,
13,
8517,
29922,
313,
29900,
29892,
29900,
29892,
29900,
29897,
13,
10921,
7607,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29892,
29906,
29945,
29945,
29897,
13,
1127,
7607,
29906,
29945,
29945,
29892,
29900,
29892,
29900,
29897,
13,
1270,
273,
7607,
29953,
29945,
29892,
29906,
29945,
29945,
29892,
29906,
29946,
29941,
29897,
13,
29937,
5514,
7101,
5235,
13,
11802,
9323,
353,
22028,
29889,
4990,
29889,
842,
29918,
8513,
3552,
4990,
29918,
2103,
29892,
4990,
29918,
3545,
876,
13,
2272,
11802,
29889,
4990,
29889,
842,
29918,
6671,
877,
17482,
1495,
13,
29937,
13058,
13,
13058,
353,
22028,
29889,
2230,
29889,
29907,
908,
580,
13,
29937,
1552,
337,
1341,
663,
527,
13541,
13,
2161,
25518,
353,
22028,
29889,
3027,
29889,
1359,
877,
2161,
29889,
2732,
1495,
13,
1092,
29873,
25518,
29922,
2272,
11802,
29889,
3027,
29889,
1359,
877,
1092,
29873,
29918,
29879,
828,
29889,
2732,
1495,
13,
12313,
25518,
29922,
2272,
11802,
29889,
3027,
29889,
1359,
877,
12313,
29889,
2732,
1495,
13,
29937,
3389,
292,
278,
29871,
3161,
13,
1753,
4319,
29898,
29916,
29892,
29891,
1125,
13,
1678,
3748,
9323,
29889,
2204,
277,
29898,
12313,
25518,
22657,
29916,
29892,
29891,
876,
13,
1753,
3700,
29898,
29916,
29892,
29891,
1125,
13,
1678,
3748,
9323,
29889,
2204,
277,
29898,
2161,
25518,
22657,
29916,
29892,
29891,
876,
13,
1753,
5192,
29898,
29916,
29892,
29891,
1125,
13,
1678,
3748,
9323,
29889,
2204,
277,
29898,
1092,
29873,
25518,
22657,
29916,
29892,
29891,
876,
13,
1678,
396,
29881,
361,
13,
1753,
958,
7295,
13,
1678,
5534,
298,
2273,
29918,
2798,
13,
1678,
565,
298,
2273,
29918,
2798,
1360,
29896,
29900,
29901,
13,
4706,
4319,
29898,
12313,
29916,
29899,
29896,
29900,
29900,
29892,
29890,
3714,
29974,
29896,
29900,
29897,
13,
1753,
8158,
29898,
2798,
1125,
13,
1678,
4079,
353,
22028,
29889,
5657,
29889,
29903,
952,
9824,
877,
6904,
5657,
29886,
742,
29941,
29906,
29897,
13,
1678,
1426,
29922,
4079,
29889,
9482,
29898,
710,
29898,
2798,
511,
5574,
29892,
8517,
29897,
13,
1678,
3748,
9323,
29889,
2204,
277,
29898,
726,
22657,
29900,
29892,
29900,
876,
13,
29937,
2962,
926,
13,
2161,
29916,
7607,
4990,
29918,
2103,
29930,
29900,
29889,
29953,
29947,
29897,
13,
2161,
29891,
7607,
4990,
29918,
3545,
29930,
29900,
29889,
29946,
29897,
13,
1092,
7508,
7607,
4990,
29918,
2103,
29930,
29900,
29889,
29941,
29946,
29897,
13,
1092,
1017,
29922,
2161,
29891,
13,
12313,
29916,
29922,
8172,
29889,
9502,
524,
29898,
29906,
29900,
29892,
29929,
29945,
29900,
29897,
13,
29890,
3714,
29922,
8172,
29889,
9502,
524,
29898,
29906,
29900,
29892,
29945,
29945,
29900,
29897,
13,
29937,
1092,
29873,
11808,
13,
1092,
29873,
29918,
2798,
29922,
29900,
13,
29937,
1552,
1735,
24987,
13,
2161,
29916,
29918,
3167,
29922,
29900,
13,
2161,
29891,
29918,
3167,
29922,
29900,
13,
12313,
29916,
29918,
305,
865,
29922,
29945,
13,
29890,
3714,
29918,
305,
865,
29922,
29945,
13,
29937,
7283,
1161,
722,
29898,
1025,
29897,
13,
7283,
25936,
353,
7700,
13,
29937,
11802,
2425,
13,
8000,
451,
8095,
287,
29901,
13,
1678,
363,
1741,
297,
22028,
29889,
3696,
29889,
657,
7295,
13,
4706,
565,
1741,
29889,
1853,
1275,
22028,
29889,
13356,
1806,
29901,
13,
9651,
8095,
287,
353,
5852,
13,
9651,
23283,
580,
13,
632,
13,
4706,
396,
11466,
2329,
13,
4706,
565,
3700,
29916,
1405,
2479,
29918,
2103,
29901,
13,
18884,
3700,
29916,
22361,
29871,
29896,
29945,
29900,
13,
4706,
25342,
3700,
29916,
529,
29871,
29900,
29901,
13,
18884,
3700,
29916,
4619,
29871,
29896,
29945,
29900,
13,
4706,
25342,
3700,
29891,
1405,
2479,
29918,
3545,
29901,
13,
9651,
3700,
29891,
22361,
29871,
29945,
29900,
13,
4706,
25342,
3700,
29891,
529,
29871,
29900,
29901,
13,
9651,
3700,
29891,
4619,
29871,
29945,
29900,
13,
4706,
396,
13529,
882,
13,
4706,
565,
1741,
29889,
1853,
1275,
22028,
29889,
10818,
3970,
16048,
29901,
13,
9651,
565,
1741,
29889,
1989,
1360,
2272,
11802,
29889,
29968,
29918,
28024,
29901,
13,
18884,
3700,
29916,
29918,
3167,
29922,
448,
29945,
13,
9651,
25342,
1741,
29889,
1989,
1360,
2272,
11802,
29889,
29968,
29918,
22789,
3912,
29901,
13,
18884,
3700,
29916,
29918,
3167,
29922,
29945,
13,
9651,
25342,
1741,
29889,
1989,
1360,
2272,
11802,
29889,
29968,
29918,
4897,
29901,
13,
18884,
3700,
29891,
29918,
3167,
29922,
448,
29945,
13,
9651,
25342,
1741,
29889,
1989,
1360,
2272,
11802,
29889,
29968,
29918,
3970,
16048,
29901,
13,
18884,
3700,
29891,
29918,
3167,
29922,
29871,
29945,
13,
4706,
565,
1741,
29889,
1853,
1360,
2272,
11802,
29889,
10818,
4897,
29901,
13,
9651,
565,
1741,
29889,
1989,
1360,
2272,
11802,
29889,
29968,
29918,
22789,
3912,
470,
1741,
29889,
1989,
1275,
22028,
29889,
29968,
29918,
28024,
29901,
13,
18884,
3700,
29916,
29918,
3167,
29922,
29900,
13,
9651,
25342,
1741,
29889,
1989,
1360,
2272,
11802,
29889,
29968,
29918,
4897,
470,
1741,
29889,
1989,
1360,
2272,
11802,
29889,
29968,
29918,
3970,
16048,
29901,
13,
18884,
3700,
29891,
29918,
3167,
29922,
29900,
13,
1678,
3700,
29916,
4619,
3700,
29916,
29918,
3167,
13,
1678,
3700,
29891,
4619,
3700,
29891,
29918,
3167,
13,
1678,
396,
29881,
361,
1735,
13,
1678,
958,
580,
13,
1678,
396,
12313,
10298,
13,
1678,
565,
289,
3714,
1405,
29871,
29945,
29947,
29900,
29901,
13,
9651,
289,
3714,
29918,
305,
865,
29922,
29890,
3714,
29918,
305,
865,
29930,
29899,
29896,
13,
9651,
289,
3714,
29918,
305,
865,
29899,
29922,
29896,
13,
1678,
25342,
289,
3714,
529,
29871,
29906,
29900,
29901,
13,
9651,
289,
3714,
29918,
305,
865,
29922,
29890,
3714,
29918,
305,
865,
1068,
29896,
13,
9651,
289,
3714,
29918,
305,
865,
23661,
29896,
13,
1678,
25342,
4319,
29916,
1405,
29871,
29929,
29947,
29900,
29901,
13,
9651,
4319,
29916,
29918,
305,
865,
29922,
12313,
29916,
29918,
305,
865,
29930,
29899,
29896,
13,
9651,
4319,
29916,
29918,
305,
865,
29899,
29922,
29896,
13,
632,
13,
1678,
25342,
4319,
29916,
529,
29871,
29906,
29900,
29901,
13,
9651,
4319,
29916,
29918,
305,
865,
29922,
12313,
29916,
29918,
305,
865,
1068,
29896,
13,
9651,
4319,
29916,
29918,
305,
865,
4619,
29896,
13,
1678,
4319,
29916,
4619,
12313,
29916,
29918,
305,
865,
13,
1678,
289,
3714,
4619,
289,
3714,
29918,
305,
865,
13,
1678,
396,
1092,
29873,
1302,
1464,
13,
1678,
565,
3700,
29916,
6736,
298,
2273,
29916,
448,
29871,
29945,
29900,
322,
3700,
29916,
5277,
298,
2273,
29916,
718,
29945,
29900,
29901,
13,
4706,
565,
3700,
29891,
6736,
22157,
1017,
29899,
29945,
29900,
322,
3700,
29891,
14065,
1092,
1017,
29974,
29945,
29900,
29901,
13,
632,
298,
2273,
29918,
2798,
4619,
29871,
29896,
13,
632,
298,
2273,
29916,
29922,
8172,
29889,
9502,
524,
29898,
29900,
29892,
29929,
29945,
29900,
29897,
13,
632,
22157,
1017,
29922,
8172,
29889,
9502,
524,
29898,
29900,
29892,
29945,
29945,
29900,
29897,
13,
1678,
396,
12313,
784,
2459,
15326,
13,
1678,
565,
3700,
29916,
6736,
4319,
29916,
29899,
29871,
29945,
29900,
322,
3700,
29916,
5277,
4319,
29916,
718,
29945,
29900,
29901,
13,
4706,
565,
3700,
29891,
6736,
289,
3714,
29899,
29945,
29900,
322,
3700,
29891,
14065,
29890,
3714,
29974,
29945,
29900,
29901,
13,
9651,
1596,
877,
6293,
28262,
1495,
13,
9651,
1596,
877,
13628,
29901,
742,
1092,
29873,
29918,
2798,
29897,
13,
9651,
931,
29889,
17059,
29898,
29906,
29897,
13,
9651,
22028,
29889,
28358,
580,
13,
9651,
931,
29889,
17059,
29898,
29906,
13,
462,
539,
1723,
13,
9651,
23283,
580,
13,
4706,
396,
7042,
13,
1678,
3748,
9323,
29889,
5589,
29898,
1270,
273,
29897,
13,
1678,
5192,
29898,
1092,
7508,
29892,
1092,
1017,
29897,
13,
1678,
3700,
29898,
2161,
29916,
29892,
2161,
29891,
29897,
13,
1678,
4319,
29898,
12313,
29916,
29892,
29890,
3714,
29897,
13,
1678,
8158,
29898,
1092,
29873,
29918,
2798,
29897,
13,
268,
13,
1678,
396,
5504,
13,
1678,
22028,
29889,
4990,
29889,
5504,
580,
13,
1678,
12006,
29889,
24667,
29898,
29941,
29900,
29897,
13,
29937,
28358,
13,
268,
13,
2272,
11802,
29889,
28358,
580,
13,
28358,
580,
13,
29937,
8835,
21004,
13,
2
] |
matcher.py | timsliu/nimble-notifier | 0 | 125043 | <reponame>timsliu/nimble-notifier
# matcher.py
#
# This program opens the list of active users in each state and matches with
# the list of available sites
import os
import json
import util
from haversine import haversine, Unit
import copy
import defs
def users_this_tick(user_dict, tick):
'''filters a user dictionary for users that should be updated this tick
given the refresh period and random offset'''
# no tick indicates all users should be updated
if tick is None:
return list(user_dict.keys())
tick_list = []
# list of users to update this tick
for email in user_dict.keys():
user = user_dict[email]
# number of ticks between updates
update_freq_ticks = max(1, int(user["refresh_interval"]/defs.TICK_TIME))
# offset for which tick to update
rand_offset_wrapped = user["rand_offset"] % update_freq_ticks
if tick % update_freq_ticks == rand_offset_wrapped:
tick_list.append(email)
return tick_list
def match_state(user_data, loc_data, state, tick_list):
'''match the people in a state with the available locations
inputs: users - dictionary of users in a state
locs - dictionary of availble locations in a state
state - string state being matched
tick_list - list of emails to update this tick
output: list of users with nearby locations'''
match_list = []
# iterate through users, which are email addresses
for user in tick_list:
user_coor = util.zip_to_coors(user_data[user]["zip"])
matched_user = {}
matched_user["email"] = user
matched_user["avail"] = []
# for given user, search through all location looking for availability
for loc in loc_data:
distance = haversine(user_coor, loc["coordinates"], unit=Unit.MILES)
if distance < user_data[user]["search_radius"]:
matched_loc = copy.deepcopy(loc) # deep copy the location
matched_loc["distance"] = distance # set the distance
matched_user["avail"].append(matched_loc)
# availability found for this user
if len(matched_user["avail"]) > 0:
# last availability emailed to user
last_available = user_data[user]["last_avail"]
new_available = [loc["name"] for loc in matched_user["avail"]]
# only mark a match and update the lastest availability if the
# new list is not a subset of the last availability sent out
if not set(new_available).issubset(set(last_available)):
matched_user["state"] = state
matched_user["rand_offset"] = user_data[user]["rand_offset"]
# copy thread_id and msg_id from user_data to be used in
# sending the emails
if "thread_id" in user_data[user].keys():
matched_user["thread_id"] = user_data[user]["thread_id"]
matched_user["msg_id"] = user_data[user]["msg_id"]
else:
matched_user["thread_id"] = None
matched_user["msg_id"] = None
match_list.append(matched_user)
# record latest availability in the user dict saved to json
user_data[user]["last_avail"] = new_available
return match_list, user_data
def match_all(tick=None):
'''loop through all states, opening JSON and matching with the available
sites in that state
inputs: tick (optional) - integer index of the current tick; used to
determine which users to update
output: list of emails and nearby locations'''
all_matches = [] # list of all users w/ matches
user_files = os.listdir(os.path.join(os.getcwd(), "data/user"))
user_files = filter(lambda x: "_users.json" in x, user_files)
for state_user in user_files:
state = state_user[0:2] # parse the state abbreviation
# paths to the state location and state users
state_loc = os.path.join("data/location", "{}_location.json".format(state))
state_user_path = os.path.join("data/user", state_user)
# load data for users and locations in the state
with open(state_loc, "r") as f:
loc_data = json.load(f)
with open(state_user_path, "r") as f:
# open user file, find matches, and update last availability
user_dict = json.load(f)
# create list of users to update this tick
tick_list = users_this_tick(user_dict, tick)
# update list of all matches and dump the updated user data back
matches, user_dict = match_state(user_dict, loc_data, state, tick_list)
all_matches += matches
user_data = json.dumps(user_dict, indent=4)
with open(state_user_path, "w") as f:
f.write(user_data)
return all_matches
if __name__ == "__main__":
match_all()
| [
1,
529,
276,
1112,
420,
29958,
9346,
29879,
492,
29884,
29914,
16135,
569,
29899,
1333,
3709,
13,
29937,
1993,
261,
29889,
2272,
13,
29937,
13,
29937,
910,
1824,
13246,
278,
1051,
310,
6136,
4160,
297,
1269,
2106,
322,
7087,
411,
13,
29937,
278,
1051,
310,
3625,
11840,
13,
13,
5215,
2897,
13,
5215,
4390,
13,
5215,
3667,
13,
3166,
447,
874,
457,
1053,
447,
874,
457,
29892,
13223,
13,
5215,
3509,
13,
5215,
822,
29879,
13,
4706,
13,
1753,
4160,
29918,
1366,
29918,
24667,
29898,
1792,
29918,
8977,
29892,
16892,
1125,
13,
1678,
14550,
26705,
263,
1404,
8600,
363,
4160,
393,
881,
367,
4784,
445,
16892,
13,
1678,
2183,
278,
11086,
3785,
322,
4036,
9210,
12008,
29871,
13,
268,
13,
1678,
396,
694,
16892,
14088,
599,
4160,
881,
367,
4784,
13,
1678,
565,
16892,
338,
6213,
29901,
13,
4706,
736,
1051,
29898,
1792,
29918,
8977,
29889,
8149,
3101,
13,
13,
1678,
16892,
29918,
1761,
353,
5159,
29871,
13,
1678,
396,
1051,
310,
4160,
304,
2767,
445,
16892,
29871,
13,
1678,
363,
4876,
297,
1404,
29918,
8977,
29889,
8149,
7295,
13,
4706,
1404,
353,
1404,
29918,
8977,
29961,
5269,
29962,
13,
13,
4706,
396,
1353,
310,
260,
7358,
1546,
11217,
13,
4706,
2767,
29918,
29888,
7971,
29918,
29873,
7358,
353,
4236,
29898,
29896,
29892,
938,
29898,
1792,
3366,
22379,
29918,
19207,
3108,
29914,
1753,
29879,
29889,
29911,
2965,
29968,
29918,
15307,
876,
13,
4706,
396,
9210,
363,
607,
16892,
304,
2767,
29871,
13,
4706,
20088,
29918,
10289,
29918,
29893,
336,
2986,
353,
1404,
3366,
9502,
29918,
10289,
3108,
1273,
2767,
29918,
29888,
7971,
29918,
29873,
7358,
13,
13,
4706,
565,
16892,
1273,
2767,
29918,
29888,
7971,
29918,
29873,
7358,
1275,
20088,
29918,
10289,
29918,
29893,
336,
2986,
29901,
13,
9651,
16892,
29918,
1761,
29889,
4397,
29898,
5269,
29897,
13,
13,
1678,
736,
16892,
29918,
1761,
13,
13,
1753,
1993,
29918,
3859,
29898,
1792,
29918,
1272,
29892,
1180,
29918,
1272,
29892,
2106,
29892,
16892,
29918,
1761,
1125,
13,
1678,
14550,
4352,
278,
2305,
297,
263,
2106,
411,
278,
3625,
14354,
13,
1678,
10970,
29901,
4160,
448,
8600,
310,
4160,
297,
263,
2106,
13,
9651,
1180,
29879,
448,
8600,
310,
20847,
569,
14354,
297,
263,
2106,
13,
9651,
2106,
448,
1347,
2106,
1641,
19228,
13,
9651,
16892,
29918,
1761,
448,
1051,
310,
24609,
304,
2767,
445,
16892,
13,
1678,
1962,
29901,
1051,
310,
4160,
411,
20810,
14354,
12008,
13,
1678,
1993,
29918,
1761,
353,
5159,
13,
13,
1678,
396,
13649,
1549,
4160,
29892,
607,
526,
4876,
14157,
13,
1678,
363,
1404,
297,
16892,
29918,
1761,
29901,
13,
4706,
1404,
29918,
1111,
272,
353,
3667,
29889,
7554,
29918,
517,
29918,
1111,
943,
29898,
1792,
29918,
1272,
29961,
1792,
29962,
3366,
7554,
20068,
13,
4706,
19228,
29918,
1792,
353,
6571,
13,
4706,
19228,
29918,
1792,
3366,
5269,
3108,
353,
1404,
13,
4706,
19228,
29918,
1792,
3366,
485,
737,
3108,
353,
5159,
13,
13,
4706,
396,
363,
2183,
1404,
29892,
2740,
1549,
599,
4423,
3063,
363,
20847,
3097,
13,
4706,
363,
1180,
297,
1180,
29918,
1272,
29901,
13,
9651,
5418,
353,
447,
874,
457,
29898,
1792,
29918,
1111,
272,
29892,
1180,
3366,
1111,
24266,
12436,
5190,
29922,
8325,
29889,
10403,
17101,
29897,
13,
9651,
565,
5418,
529,
1404,
29918,
1272,
29961,
1792,
29962,
3366,
4478,
29918,
13471,
3108,
29901,
13,
18884,
19228,
29918,
2029,
353,
3509,
29889,
24535,
8552,
29898,
2029,
29897,
3986,
396,
6483,
3509,
278,
4423,
13,
18884,
19228,
29918,
2029,
3366,
19244,
3108,
353,
5418,
4706,
396,
731,
278,
5418,
13,
18884,
19228,
29918,
1792,
3366,
485,
737,
16862,
4397,
29898,
4352,
287,
29918,
2029,
29897,
13,
13,
4706,
396,
20847,
3097,
1476,
363,
445,
1404,
13,
4706,
565,
7431,
29898,
4352,
287,
29918,
1792,
3366,
485,
737,
20068,
1405,
29871,
29900,
29901,
13,
9651,
396,
1833,
20847,
3097,
321,
655,
2356,
304,
1404,
29871,
13,
9651,
1833,
29918,
16515,
353,
1404,
29918,
1272,
29961,
1792,
29962,
3366,
4230,
29918,
485,
737,
3108,
13,
9651,
716,
29918,
16515,
353,
518,
2029,
3366,
978,
3108,
363,
1180,
297,
19228,
29918,
1792,
3366,
485,
737,
3108,
29962,
13,
632,
13,
9651,
396,
871,
2791,
263,
1993,
322,
2767,
278,
1833,
342,
20847,
3097,
565,
278,
13,
9651,
396,
716,
1051,
338,
451,
263,
11306,
310,
278,
1833,
20847,
3097,
2665,
714,
13,
9651,
565,
451,
731,
29898,
1482,
29918,
16515,
467,
790,
431,
842,
29898,
842,
29898,
4230,
29918,
16515,
22164,
13,
18884,
19228,
29918,
1792,
3366,
3859,
3108,
353,
2106,
29871,
13,
18884,
19228,
29918,
1792,
3366,
9502,
29918,
10289,
3108,
353,
1404,
29918,
1272,
29961,
1792,
29962,
3366,
9502,
29918,
10289,
3108,
13,
18884,
396,
3509,
3244,
29918,
333,
322,
10191,
29918,
333,
515,
1404,
29918,
1272,
304,
367,
1304,
297,
13,
18884,
396,
9348,
278,
24609,
13,
18884,
565,
376,
7097,
29918,
333,
29908,
297,
1404,
29918,
1272,
29961,
1792,
1822,
8149,
7295,
13,
462,
1678,
19228,
29918,
1792,
3366,
7097,
29918,
333,
3108,
353,
1404,
29918,
1272,
29961,
1792,
29962,
3366,
7097,
29918,
333,
3108,
29871,
13,
462,
1678,
19228,
29918,
1792,
3366,
7645,
29918,
333,
3108,
353,
1404,
29918,
1272,
29961,
1792,
29962,
3366,
7645,
29918,
333,
3108,
13,
18884,
1683,
29901,
13,
462,
1678,
19228,
29918,
1792,
3366,
7097,
29918,
333,
3108,
353,
6213,
29871,
13,
462,
1678,
19228,
29918,
1792,
3366,
7645,
29918,
333,
3108,
353,
6213,
13,
18884,
1993,
29918,
1761,
29889,
4397,
29898,
4352,
287,
29918,
1792,
29897,
13,
462,
13,
18884,
396,
2407,
9281,
20847,
3097,
297,
278,
1404,
9657,
7160,
304,
4390,
13,
18884,
1404,
29918,
1272,
29961,
1792,
29962,
3366,
4230,
29918,
485,
737,
3108,
353,
716,
29918,
16515,
13,
13,
1678,
736,
1993,
29918,
1761,
29892,
1404,
29918,
1272,
13,
13,
1753,
1993,
29918,
497,
29898,
24667,
29922,
8516,
1125,
13,
1678,
14550,
7888,
1549,
599,
5922,
29892,
8718,
4663,
322,
9686,
411,
278,
3625,
13,
1678,
11840,
297,
393,
2106,
13,
13,
1678,
10970,
29901,
16892,
313,
25253,
29897,
448,
6043,
2380,
310,
278,
1857,
16892,
29936,
1304,
304,
13,
9651,
8161,
607,
4160,
304,
2767,
13,
1678,
1962,
29901,
1051,
310,
24609,
322,
20810,
14354,
12008,
13,
268,
13,
1678,
599,
29918,
20317,
353,
5159,
4706,
396,
1051,
310,
599,
4160,
281,
29914,
7087,
13,
1678,
1404,
29918,
5325,
353,
2897,
29889,
1761,
3972,
29898,
359,
29889,
2084,
29889,
7122,
29898,
359,
29889,
657,
29883,
9970,
3285,
376,
1272,
29914,
1792,
5783,
13,
1678,
1404,
29918,
5325,
353,
4175,
29898,
2892,
921,
29901,
11119,
7193,
29889,
3126,
29908,
297,
921,
29892,
1404,
29918,
5325,
29897,
13,
13,
1678,
363,
2106,
29918,
1792,
297,
1404,
29918,
5325,
29901,
13,
4706,
2106,
353,
2106,
29918,
1792,
29961,
29900,
29901,
29906,
29962,
418,
396,
6088,
278,
2106,
29759,
14641,
13,
4706,
13,
4706,
396,
10898,
304,
278,
2106,
4423,
322,
2106,
4160,
13,
4706,
2106,
29918,
2029,
353,
2897,
29889,
2084,
29889,
7122,
703,
1272,
29914,
5479,
613,
29850,
2403,
5479,
29889,
3126,
1642,
4830,
29898,
3859,
876,
13,
4706,
2106,
29918,
1792,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
703,
1272,
29914,
1792,
613,
2106,
29918,
1792,
29897,
13,
13,
4706,
396,
2254,
848,
363,
4160,
322,
14354,
297,
278,
2106,
13,
4706,
411,
1722,
29898,
3859,
29918,
2029,
29892,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
1180,
29918,
1272,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
13,
308,
13,
4706,
411,
1722,
29898,
3859,
29918,
1792,
29918,
2084,
29892,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
396,
1722,
1404,
934,
29892,
1284,
7087,
29892,
322,
2767,
1833,
20847,
3097,
29871,
13,
9651,
1404,
29918,
8977,
353,
4390,
29889,
1359,
29898,
29888,
29897,
13,
539,
13,
4706,
396,
1653,
1051,
310,
4160,
304,
2767,
445,
16892,
13,
4706,
16892,
29918,
1761,
353,
4160,
29918,
1366,
29918,
24667,
29898,
1792,
29918,
8977,
29892,
16892,
29897,
13,
308,
13,
4706,
396,
2767,
1051,
310,
599,
7087,
322,
16766,
278,
4784,
1404,
848,
1250,
13,
4706,
7087,
29892,
1404,
29918,
8977,
353,
1993,
29918,
3859,
29898,
1792,
29918,
8977,
29892,
1180,
29918,
1272,
29892,
2106,
29892,
16892,
29918,
1761,
29897,
13,
4706,
599,
29918,
20317,
4619,
7087,
13,
308,
13,
4706,
1404,
29918,
1272,
353,
4390,
29889,
29881,
17204,
29898,
1792,
29918,
8977,
29892,
29536,
29922,
29946,
29897,
13,
4706,
411,
1722,
29898,
3859,
29918,
1792,
29918,
2084,
29892,
376,
29893,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
3539,
29898,
1792,
29918,
1272,
29897,
13,
13,
1678,
736,
599,
29918,
20317,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1993,
29918,
497,
580,
13,
2
] |
HADOOP/SPOILER_mapper.py | Athan-asios/HADOOP-AND-SPARK-USAGE-FOR-BIG-DATA-ANALYSIS | 0 | 149240 | #!/usr/bin/env python3
# ref: http://open.blogs.nytimes.com/2014/07/10/emr-streaming-in-go/
import sys
import json
def main():
# loop through each line of stdin
for line in sys.stdin:
try:
# parse the incoming json
j = json.loads(line.strip())
# initialize output structure
output = dict()
# grab an identifier
output = j["authors"]
if(len(output) > 1):
#print(*output, sep = " 1\n", end = " ")
for i in range(len(output)):
#separator = " {}\n".format(i)
#print(output[i] + " => " + i)
print(output[i], end = "")
print(" {}\t1".format(i+1))
else:
print(*output, end = " 1\t1")
except Exception as e:
sys.stderr.write("unable to read log: %s" % e)
continue
try:
# generate json output
output_json = json.dumps(output)
#output_json = output
# write the key and json to stdout
#print("{}\n".format(output_json))
except Exception as e:
sys.stderr.write("unable to write mapper output: %s" % e)
continue
if __name__ == "__main__":
main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
29937,
2143,
29901,
1732,
597,
3150,
29889,
25762,
29889,
1460,
3706,
29889,
510,
29914,
29906,
29900,
29896,
29946,
29914,
29900,
29955,
29914,
29896,
29900,
29914,
331,
29878,
29899,
5461,
292,
29899,
262,
29899,
1484,
29914,
13,
13,
5215,
10876,
13,
5215,
4390,
13,
13,
1753,
1667,
7295,
13,
13,
1678,
396,
2425,
1549,
1269,
1196,
310,
3659,
262,
13,
1678,
363,
1196,
297,
10876,
29889,
4172,
262,
29901,
13,
4706,
1018,
29901,
13,
13,
9651,
396,
6088,
278,
23235,
4390,
13,
9651,
432,
353,
4390,
29889,
18132,
29898,
1220,
29889,
17010,
3101,
13,
13,
9651,
396,
11905,
1962,
3829,
13,
9651,
1962,
353,
9657,
580,
13,
13,
9651,
396,
17229,
385,
15882,
13,
9651,
1962,
353,
432,
3366,
5150,
943,
3108,
13,
9651,
565,
29898,
2435,
29898,
4905,
29897,
1405,
29871,
29896,
1125,
13,
18884,
396,
2158,
10456,
4905,
29892,
16345,
353,
376,
259,
29896,
29905,
29876,
613,
1095,
353,
376,
16521,
13,
18884,
363,
474,
297,
3464,
29898,
2435,
29898,
4905,
22164,
13,
462,
259,
396,
344,
17954,
353,
376,
29871,
426,
1012,
29876,
1642,
4830,
29898,
29875,
29897,
13,
462,
259,
396,
2158,
29898,
4905,
29961,
29875,
29962,
718,
376,
1149,
376,
718,
474,
29897,
13,
462,
259,
1596,
29898,
4905,
29961,
29875,
1402,
1095,
353,
20569,
13,
462,
259,
1596,
703,
29871,
426,
1012,
29873,
29896,
1642,
4830,
29898,
29875,
29974,
29896,
876,
13,
9651,
1683,
29901,
13,
18884,
1596,
10456,
4905,
29892,
1095,
353,
376,
259,
29896,
29905,
29873,
29896,
1159,
13,
13,
13,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
10876,
29889,
303,
20405,
29889,
3539,
703,
348,
519,
304,
1303,
1480,
29901,
1273,
29879,
29908,
1273,
321,
29897,
13,
9651,
6773,
13,
13,
13,
13,
13,
4706,
1018,
29901,
13,
13,
9651,
396,
5706,
4390,
1962,
13,
9651,
1962,
29918,
3126,
353,
4390,
29889,
29881,
17204,
29898,
4905,
29897,
13,
9651,
396,
4905,
29918,
3126,
353,
1962,
13,
9651,
396,
2436,
278,
1820,
322,
4390,
304,
27591,
13,
13,
9651,
396,
2158,
703,
29912,
1012,
29876,
1642,
4830,
29898,
4905,
29918,
3126,
876,
13,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
10876,
29889,
303,
20405,
29889,
3539,
703,
348,
519,
304,
2436,
611,
2496,
1962,
29901,
1273,
29879,
29908,
1273,
321,
29897,
13,
9651,
6773,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
4706,
1667,
580,
13,
2
] |
grr/client/client_plugins.py | ethicalhackeragnidhra/Grr | 1 | 134216 | #!/usr/bin/env python
"""Centralized import point for client plugins.
This acts as a centralized point for modules that need to be loaded for
the client components so that the client_startup.Init() function will find and
register them.
This also acts as a sensible single place to add deployment specific plugin
modules that have been customized for your deployment.
"""
import sys
# pylint: disable=g-import-not-at-top,unused-import,g-bad-import-order
# Load the os specific modules.
if sys.platform == "win32":
from grr.client import windows
elif sys.platform == "darwin":
from grr.client import osx
elif "linux" in sys.platform:
from grr.client import linux
from grr.client import client_actions
from grr.client import comms
from grr.client import local
from grr.client import vfs_handlers
from grr.lib import log
# pylint: enable=g-import-not-at-top,unused-import,g-bad-import-order
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
13,
15945,
29908,
23369,
1705,
1891,
1053,
1298,
363,
3132,
18224,
29889,
13,
13,
4013,
14741,
408,
263,
6555,
1891,
1298,
363,
10585,
393,
817,
304,
367,
7500,
363,
13,
1552,
3132,
7117,
577,
393,
278,
3132,
29918,
2962,
786,
29889,
6644,
580,
740,
674,
1284,
322,
13,
9573,
963,
29889,
13,
13,
4013,
884,
14741,
408,
263,
25182,
2323,
2058,
304,
788,
18209,
2702,
7079,
13,
7576,
393,
505,
1063,
2888,
1891,
363,
596,
18209,
29889,
13,
15945,
29908,
13,
5215,
10876,
13,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
29887,
29899,
5215,
29899,
1333,
29899,
271,
29899,
3332,
29892,
348,
3880,
29899,
5215,
29892,
29887,
29899,
12313,
29899,
5215,
29899,
2098,
13,
29937,
16012,
278,
2897,
2702,
10585,
29889,
13,
361,
10876,
29889,
12120,
1275,
376,
5080,
29941,
29906,
1115,
13,
29871,
515,
867,
29878,
29889,
4645,
1053,
5417,
13,
13,
23681,
10876,
29889,
12120,
1275,
376,
16702,
5080,
1115,
13,
29871,
515,
867,
29878,
29889,
4645,
1053,
2897,
29916,
13,
13,
23681,
376,
9389,
29908,
297,
10876,
29889,
12120,
29901,
13,
29871,
515,
867,
29878,
29889,
4645,
1053,
10542,
13,
13,
3166,
867,
29878,
29889,
4645,
1053,
3132,
29918,
7387,
13,
3166,
867,
29878,
29889,
4645,
1053,
844,
29879,
13,
3166,
867,
29878,
29889,
4645,
1053,
1887,
13,
3166,
867,
29878,
29889,
4645,
1053,
325,
5847,
29918,
3179,
9306,
13,
3166,
867,
29878,
29889,
1982,
1053,
1480,
13,
29937,
282,
2904,
524,
29901,
9025,
29922,
29887,
29899,
5215,
29899,
1333,
29899,
271,
29899,
3332,
29892,
348,
3880,
29899,
5215,
29892,
29887,
29899,
12313,
29899,
5215,
29899,
2098,
13,
2
] |
test.py | sasha42/c3lingo-stats | 2 | 35769 | #!/usr/bin/env python3
import unittest
from textwrap import dedent
from datetime import timedelta
from parse import parse_block, TranslationShift
class TestTranslationShift(unittest.TestCase):
def test_eq(self):
self.assertEqual(TranslationShift('name', 'lang'), TranslationShift('name', 'lang'))
self.assertNotEqual(TranslationShift('name', 'lang'), TranslationShift('anonther_name', 'lang'))
self.assertNotEqual(TranslationShift('name', 'lang'), TranslationShift('name', 'anonther_lang'))
class TestParseBlock(unittest.TestCase):
def test_simple(self):
result = parse_block(dedent("""
#1
[de] 11:00 +00:30, Adams
Opening Event
rufus, rixx
Fahrplan: https://fahrplan.events.ccc.de/congress/2018/Fahrplan/events/9985.html
Slides (if available): https://speakers.c3lingo.org/talks/15f4e5c5-40e1-4c73-8da0-4cc2a773ab13/
→ en: waffle, simplysaym, sirenensang
→ fr: informancer, ironic, yann0u
"""))
self.assertEqual(result.language, 'de')
self.assertEqual(result.room, 'Adams')
self.assertEqual(result.duration, timedelta(hours=0, minutes=30))
self.assertEqual(result.title, 'Opening Event')
self.assertEqual(result.speakers, ['rufus', 'rixx'])
self.assertEqual(result.fahrplan, 'https://fahrplan.events.ccc.de/congress/2018/Fahrplan/events/9985.html')
self.assertEqual(result.translation_shifts, [
TranslationShift('waffle', 'en', result),
TranslationShift('simplysaym', 'en', result),
TranslationShift('sirenensang', 'en', result),
TranslationShift('informancer', 'fr', result),
TranslationShift('ironic', 'fr', result),
TranslationShift('yann0u', 'fr', result),
])
def test_notes(self):
"""
Test that notes and parenthetical stuff inside the shift assignments is stripped out
as much as possible
"""
result = parse_block(dedent("""
#31
[de] 18:50 +01:00, Borg
"Das ist mir nicht erinnerlich." − Der NSU-Komplex heute
<NAME> (NSU-Watch)
Fahrplan: https://fahrplan.events.ccc.de/congress/2018/Fahrplan/events/9766.html
Slides (if available): https://speakers.c3lingo.org/talks/a12d17e9-3758-4fa0-b612-0c6ba22ea773/
→ en: tr1 (note), (foo) tr2
→ fr: tr3 – yay!
→ gsw: (reservation), (another one) , (never mind me)
"""))
self.assertEqual(result.translation_shifts, [
TranslationShift('tr1', 'en', result),
TranslationShift('tr2', 'en', result),
TranslationShift('tr3', 'fr', result),
])
def test_trailing_comma(self):
"""
Test that trailing commas don't cause trouble
"""
result = parse_block(dedent("""
#31
[de] 18:50 +01:00, Borg
"Das ist mir nicht erinnerlich." − Der NSU-Komplex heute
<NAME> (NSU-Watch)
Fahrplan: https://fahrplan.events.ccc.de/congress/2018/Fahrplan/events/9766.html
Slides (if available): https://speakers.c3lingo.org/talks/a12d17e9-3758-4fa0-b612-0c6ba22ea773/
→ en: tr1, tr2,
"""))
self.assertEqual(result.translation_shifts, [
TranslationShift('tr1', 'en', result),
TranslationShift('tr2', 'en', result),
])
if __name__ == '__main__':
unittest.main()
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
13,
5215,
443,
27958,
13,
3166,
1426,
6312,
1053,
28262,
296,
13,
3166,
12865,
1053,
5335,
287,
2554,
13,
3166,
6088,
1053,
6088,
29918,
1271,
29892,
4103,
18411,
29657,
13,
13,
1990,
4321,
4300,
18411,
29657,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
1837,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
9843,
29898,
4300,
18411,
29657,
877,
978,
742,
525,
3893,
5477,
4103,
18411,
29657,
877,
978,
742,
525,
3893,
8785,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
4300,
18411,
29657,
877,
978,
742,
525,
3893,
5477,
4103,
18411,
29657,
877,
19930,
721,
29918,
978,
742,
525,
3893,
8785,
13,
4706,
1583,
29889,
9294,
3664,
9843,
29898,
4300,
18411,
29657,
877,
978,
742,
525,
3893,
5477,
4103,
18411,
29657,
877,
978,
742,
525,
19930,
721,
29918,
3893,
8785,
13,
13,
1990,
4321,
12914,
7445,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
12857,
29898,
1311,
1125,
13,
4706,
1121,
353,
6088,
29918,
1271,
29898,
7176,
296,
703,
15945,
13,
4706,
396,
29896,
13,
4706,
518,
311,
29962,
29871,
29896,
29896,
29901,
29900,
29900,
718,
29900,
29900,
29901,
29941,
29900,
29892,
20359,
13,
4706,
4673,
292,
6864,
13,
4706,
364,
1137,
375,
29892,
364,
861,
29916,
13,
4706,
18205,
9018,
29901,
2045,
597,
18693,
9018,
29889,
13604,
29889,
26854,
29889,
311,
29914,
535,
3663,
29914,
29906,
29900,
29896,
29947,
29914,
29943,
5610,
9018,
29914,
13604,
29914,
29929,
29929,
29947,
29945,
29889,
1420,
13,
4706,
14866,
2247,
313,
361,
3625,
1125,
2045,
597,
5965,
21079,
29889,
29883,
29941,
1847,
29877,
29889,
990,
29914,
20411,
2039,
29914,
29896,
29945,
29888,
29946,
29872,
29945,
29883,
29945,
29899,
29946,
29900,
29872,
29896,
29899,
29946,
29883,
29955,
29941,
29899,
29947,
1388,
29900,
29899,
29946,
617,
29906,
29874,
29955,
29955,
29941,
370,
29896,
29941,
29914,
13,
4706,
10309,
427,
29901,
281,
3470,
280,
29892,
3763,
20834,
29885,
29892,
8889,
264,
575,
574,
13,
4706,
10309,
1424,
29901,
1871,
25856,
29892,
3805,
8927,
29892,
343,
812,
29900,
29884,
13,
4706,
5124,
5783,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
11675,
29892,
525,
311,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
8345,
29892,
525,
3253,
2232,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
19708,
29892,
5335,
287,
2554,
29898,
29882,
2470,
29922,
29900,
29892,
6233,
29922,
29941,
29900,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
3257,
29892,
525,
6585,
292,
6864,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
5965,
21079,
29892,
6024,
26822,
375,
742,
525,
2126,
29916,
11287,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
18693,
9018,
29892,
525,
991,
597,
18693,
9018,
29889,
13604,
29889,
26854,
29889,
311,
29914,
535,
3663,
29914,
29906,
29900,
29896,
29947,
29914,
29943,
5610,
9018,
29914,
13604,
29914,
29929,
29929,
29947,
29945,
29889,
1420,
1495,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
3286,
18411,
29918,
845,
17741,
29892,
518,
13,
9651,
4103,
18411,
29657,
877,
2766,
600,
280,
742,
525,
264,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
14739,
368,
20834,
29885,
742,
525,
264,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
29879,
381,
264,
575,
574,
742,
525,
264,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
262,
689,
25856,
742,
525,
1341,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
381,
8927,
742,
525,
1341,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
29891,
812,
29900,
29884,
742,
525,
1341,
742,
1121,
511,
13,
308,
2314,
13,
13,
1678,
822,
1243,
29918,
16953,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
393,
11486,
322,
3847,
9188,
936,
6433,
2768,
278,
9500,
3566,
1860,
338,
10076,
2986,
714,
13,
4706,
408,
1568,
408,
1950,
13,
4706,
9995,
13,
4706,
1121,
353,
6088,
29918,
1271,
29898,
7176,
296,
703,
15945,
13,
4706,
396,
29941,
29896,
13,
4706,
518,
311,
29962,
29871,
29896,
29947,
29901,
29945,
29900,
718,
29900,
29896,
29901,
29900,
29900,
29892,
20918,
13,
4706,
376,
29928,
294,
1752,
10078,
3072,
604,
3993,
1470,
1213,
13935,
2452,
3865,
29965,
29899,
29968,
290,
10709,
12843,
13,
4706,
529,
5813,
29958,
313,
3059,
29965,
29899,
24709,
29897,
13,
4706,
18205,
9018,
29901,
2045,
597,
18693,
9018,
29889,
13604,
29889,
26854,
29889,
311,
29914,
535,
3663,
29914,
29906,
29900,
29896,
29947,
29914,
29943,
5610,
9018,
29914,
13604,
29914,
29929,
29955,
29953,
29953,
29889,
1420,
13,
4706,
14866,
2247,
313,
361,
3625,
1125,
2045,
597,
5965,
21079,
29889,
29883,
29941,
1847,
29877,
29889,
990,
29914,
20411,
2039,
29914,
29874,
29896,
29906,
29881,
29896,
29955,
29872,
29929,
29899,
29941,
29955,
29945,
29947,
29899,
29946,
5444,
29900,
29899,
29890,
29953,
29896,
29906,
29899,
29900,
29883,
29953,
2291,
29906,
29906,
11248,
29955,
29955,
29941,
29914,
13,
4706,
10309,
427,
29901,
534,
29896,
313,
6812,
511,
313,
5431,
29897,
534,
29906,
13,
4706,
10309,
1424,
29901,
534,
29941,
785,
343,
388,
29991,
13,
4706,
10309,
330,
2774,
29901,
313,
690,
20525,
511,
313,
23327,
697,
29897,
1919,
313,
484,
369,
3458,
592,
29897,
13,
4706,
5124,
5783,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
3286,
18411,
29918,
845,
17741,
29892,
518,
13,
9651,
4103,
18411,
29657,
877,
509,
29896,
742,
525,
264,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
509,
29906,
742,
525,
264,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
509,
29941,
742,
525,
1341,
742,
1121,
511,
13,
308,
2314,
13,
13,
1678,
822,
1243,
29918,
3018,
6504,
29918,
510,
655,
29898,
1311,
1125,
13,
4706,
9995,
13,
4706,
4321,
393,
25053,
844,
294,
1016,
29915,
29873,
4556,
7458,
13,
4706,
9995,
13,
4706,
1121,
353,
6088,
29918,
1271,
29898,
7176,
296,
703,
15945,
13,
4706,
396,
29941,
29896,
13,
4706,
518,
311,
29962,
29871,
29896,
29947,
29901,
29945,
29900,
718,
29900,
29896,
29901,
29900,
29900,
29892,
20918,
13,
4706,
376,
29928,
294,
1752,
10078,
3072,
604,
3993,
1470,
1213,
13935,
2452,
3865,
29965,
29899,
29968,
290,
10709,
12843,
13,
4706,
529,
5813,
29958,
313,
3059,
29965,
29899,
24709,
29897,
13,
4706,
18205,
9018,
29901,
2045,
597,
18693,
9018,
29889,
13604,
29889,
26854,
29889,
311,
29914,
535,
3663,
29914,
29906,
29900,
29896,
29947,
29914,
29943,
5610,
9018,
29914,
13604,
29914,
29929,
29955,
29953,
29953,
29889,
1420,
13,
4706,
14866,
2247,
313,
361,
3625,
1125,
2045,
597,
5965,
21079,
29889,
29883,
29941,
1847,
29877,
29889,
990,
29914,
20411,
2039,
29914,
29874,
29896,
29906,
29881,
29896,
29955,
29872,
29929,
29899,
29941,
29955,
29945,
29947,
29899,
29946,
5444,
29900,
29899,
29890,
29953,
29896,
29906,
29899,
29900,
29883,
29953,
2291,
29906,
29906,
11248,
29955,
29955,
29941,
29914,
13,
4706,
10309,
427,
29901,
534,
29896,
29892,
534,
29906,
29892,
13,
4706,
5124,
5783,
13,
4706,
1583,
29889,
9294,
9843,
29898,
2914,
29889,
3286,
18411,
29918,
845,
17741,
29892,
518,
13,
9651,
4103,
18411,
29657,
877,
509,
29896,
742,
525,
264,
742,
1121,
511,
13,
9651,
4103,
18411,
29657,
877,
509,
29906,
742,
525,
264,
742,
1121,
511,
13,
308,
2314,
13,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
main.py | BL-Lac149597870/drugVQA | 0 | 18713 | <filename>main.py
'''
Author: QHGG
Date: 2021-02-27 13:42:43
LastEditTime: 2021-03-01 23:26:38
LastEditors: QHGG
Description:
FilePath: /drugVQA/main.py
'''
import torch
from sklearn import metrics
import warnings
warnings.filterwarnings("ignore")
torch.cuda.set_device(0)
print('cuda size == 1')
from trainAndTest import *
import time
def timeLable():
return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
def main():
"""
Parsing command line parameters, reading data, fitting and scoring a SEAL-CI model.
"""
losses,accs,testResults = train(trainArgs)
with open("logs/"+ timeLable() +"losses.txt", "w") as f:
f.writelines([str(log) + '\n' for log in losses])
with open("logs/"+ timeLable() +"accs.txt", "w") as f:
f.writelines([str(log) + '\n' for log in accs])
with open("logs/"+ timeLable() +"testResults.txt", "w") as f:
f.writelines([str(log) + '\n' for log in testResults])
if __name__ == "__main__":
main()
| [
1,
529,
9507,
29958,
3396,
29889,
2272,
13,
12008,
13,
13720,
29901,
660,
29950,
26788,
13,
2539,
29901,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29906,
29899,
29906,
29955,
29871,
29896,
29941,
29901,
29946,
29906,
29901,
29946,
29941,
13,
8897,
6103,
2481,
29901,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29941,
29899,
29900,
29896,
29871,
29906,
29941,
29901,
29906,
29953,
29901,
29941,
29947,
13,
8897,
6103,
943,
29901,
660,
29950,
26788,
13,
9868,
29901,
29871,
13,
2283,
2605,
29901,
847,
29881,
11124,
29963,
29984,
29909,
29914,
3396,
29889,
2272,
13,
12008,
13,
5215,
4842,
305,
13,
3166,
2071,
19668,
1053,
21556,
13,
5215,
18116,
13,
25442,
886,
29889,
4572,
25442,
886,
703,
17281,
1159,
13,
7345,
305,
29889,
29883,
6191,
29889,
842,
29918,
10141,
29898,
29900,
29897,
13,
2158,
877,
29883,
6191,
2159,
1275,
29871,
29896,
1495,
13,
3166,
7945,
2855,
3057,
1053,
334,
13,
5215,
931,
13,
1753,
931,
29931,
519,
7295,
13,
1678,
736,
29871,
931,
29889,
710,
615,
603,
11702,
29979,
19222,
29885,
19222,
29881,
1273,
29950,
16664,
29924,
16664,
29903,
613,
931,
29889,
2997,
2230,
3101,
13,
268,
13,
1753,
1667,
7295,
13,
1678,
9995,
13,
1678,
1459,
2976,
1899,
1196,
4128,
29892,
5183,
848,
29892,
28221,
322,
26654,
263,
3725,
1964,
29899,
8426,
1904,
29889,
13,
1678,
9995,
13,
1678,
28495,
29892,
562,
2395,
29892,
1688,
12191,
353,
7945,
29898,
14968,
7883,
29897,
13,
1678,
411,
1722,
703,
20756,
12975,
29974,
931,
29931,
519,
580,
718,
29908,
6758,
267,
29889,
3945,
613,
376,
29893,
1159,
408,
285,
29901,
13,
4706,
285,
29889,
8231,
24210,
4197,
710,
29898,
1188,
29897,
718,
11297,
29876,
29915,
363,
1480,
297,
28495,
2314,
13,
1678,
411,
1722,
703,
20756,
12975,
29974,
931,
29931,
519,
580,
718,
29908,
562,
2395,
29889,
3945,
613,
376,
29893,
1159,
408,
285,
29901,
13,
4706,
285,
29889,
8231,
24210,
4197,
710,
29898,
1188,
29897,
718,
11297,
29876,
29915,
363,
1480,
297,
1035,
29879,
2314,
13,
1678,
411,
1722,
703,
20756,
12975,
29974,
931,
29931,
519,
580,
718,
29908,
1688,
12191,
29889,
3945,
613,
376,
29893,
1159,
408,
285,
29901,
13,
4706,
285,
29889,
8231,
24210,
4197,
710,
29898,
1188,
29897,
718,
11297,
29876,
29915,
363,
1480,
297,
1243,
12191,
2314,
13,
268,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1667,
580,
13,
2
] |
Chapter08/qt08_winBkground01.py | csy1993/PythonQt | 0 | 178799 | <filename>Chapter08/qt08_winBkground01.py<gh_stars>0
# -*- coding: utf-8 -*-
'''
【简介】
界面背景图片设置
'''
import sys
from PyQt5.QtWidgets import QMainWindow , QApplication
app = QApplication(sys.argv)
win = QMainWindow()
win.setWindowTitle("界面背景图片设置")
win.resize(350, 250)
win.setObjectName("MainWindow")
win.setStyleSheet("#MainWindow{border-image:url(./images/python.jpg);}")
#win.setStyleSheet("#MainWindow{background-color: yellow}")
win.show()
sys.exit(app.exec_())
| [
1,
529,
9507,
29958,
1451,
3314,
29900,
29947,
29914,
17915,
29900,
29947,
29918,
5080,
29933,
29895,
2057,
29900,
29896,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29900,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
12008,
13,
268,
31478,
234,
177,
131,
31633,
31472,
13,
12,
29871,
30967,
30806,
235,
134,
143,
31495,
30861,
31122,
30872,
30669,
13,
268,
13,
12008,
13,
13,
5215,
10876,
13,
3166,
10772,
17303,
29945,
29889,
17303,
8801,
29879,
1053,
660,
6330,
5907,
1919,
660,
4873,
13,
13,
932,
353,
660,
4873,
29898,
9675,
29889,
19218,
29897,
13,
5080,
353,
660,
6330,
5907,
580,
13,
5080,
29889,
842,
5907,
7030,
703,
30967,
30806,
235,
134,
143,
31495,
30861,
31122,
30872,
30669,
1159,
29871,
13,
5080,
29889,
21476,
29898,
29941,
29945,
29900,
29892,
259,
29906,
29945,
29900,
29897,
259,
13,
5080,
29889,
842,
2061,
1170,
703,
6330,
5907,
1159,
13,
5080,
29889,
842,
5568,
10654,
14822,
6330,
5907,
29912,
11466,
29899,
3027,
29901,
2271,
29898,
6904,
8346,
29914,
4691,
29889,
6173,
416,
27195,
13,
29937,
5080,
29889,
842,
5568,
10654,
14822,
6330,
5907,
29912,
7042,
29899,
2780,
29901,
13328,
27195,
13,
5080,
29889,
4294,
580,
13,
9675,
29889,
13322,
29898,
932,
29889,
4258,
29918,
3101,
13,
13,
2
] |
igibson/metrics/agent.py | Nick-AhSen/iGibson | 0 | 8291 | import copy
import numpy as np
import pybullet as p
from igibson.metrics.metric_base import MetricBase
class BehaviorRobotMetric(MetricBase):
def __init__(self):
self.initialized = False
self.state_cache = {}
self.next_state_cache = {}
self.agent_pos = {part: [] for part in ["left_hand", "right_hand", "body"]}
self.agent_grasping = {part: [] for part in ["left_hand", "right_hand"]}
self.agent_local_pos = {part: [] for part in ["left_hand", "right_hand"]}
self.agent_reset = {part: [] for part in ["left_hand", "right_hand", "body"]}
self.delta_agent_work = {part: [] for part in ["left_hand", "right_hand", "body"]}
self.delta_agent_distance = {part: [] for part in ["left_hand", "right_hand", "body"]}
self.delta_agent_grasp_distance = {part: [] for part in ["left_hand", "right_hand"]}
self.clip = 0.2
def step_callback(self, igbhvr_act_inst, _):
robot = igbhvr_act_inst.simulator.robots[0]
agent_work = {part: 0 for part in ["left_hand", "right_hand", "body"]}
agent_distance = {part: 0 for part in ["left_hand", "right_hand", "body"]}
for part in ["left_hand", "right_hand", "body"]:
self.next_state_cache[part] = {
"position": np.array(p.getBasePositionAndOrientation(robot.parts[part].get_body_id())[0]),
}
if not self.initialized:
self.state_cache = copy.deepcopy(self.next_state_cache)
self.initialized = True
if robot.action[19] > 0 and robot.action[27] > 0:
self.agent_reset["left_hand"].append(True)
self.agent_reset["right_hand"].append(True)
self.agent_reset["body"].append(True)
if robot.action[19] > 0:
self.agent_reset["left_hand"].append(True)
self.agent_reset["right_hand"].append(False)
self.agent_reset["body"].append(True)
elif robot.action[27] > 0:
self.agent_reset["left_hand"].append(False)
self.agent_reset["right_hand"].append(True)
self.agent_reset["body"].append(True)
else:
self.agent_reset["left_hand"].append(False)
self.agent_reset["right_hand"].append(False)
self.agent_reset["body"].append(False)
for part in self.state_cache:
delta_pos = np.linalg.norm(self.next_state_cache[part]["position"] - self.state_cache[part]["position"])
self.agent_pos[part].append(list(self.state_cache[part]["position"]))
# Exclude agent teleports
delta_pos = np.clip(delta_pos, -self.clip, self.clip)
if robot.parts[part].movement_cid is None:
force = 0
work = 0
else:
force = p.getConstraintState(robot.parts[part].movement_cid)
work = np.abs((delta_pos * np.linalg.norm(force)))
distance = np.abs(delta_pos)
if part in ["left_hand", "right_hand"]:
self.agent_local_pos[part].append(list(robot.parts[part].get_local_position_orientation()[0]))
if part in ["left_hand", "right_hand"] and (
len(p.getContactPoints(robot.parts[part].get_body_id())) > 0
or robot.parts[part].object_in_hand is not None
):
self.delta_agent_grasp_distance[part].append(distance)
self.agent_grasping[part].append(True)
elif part in ["left_hand", "right_hand"]:
self.delta_agent_grasp_distance[part].append(0)
self.agent_grasping[part].append(False)
agent_work[part] = work
agent_distance[part] = distance
self.delta_agent_work[part].append(work)
self.delta_agent_distance[part].append(distance)
self.state_cache = copy.deepcopy(self.next_state_cache)
def gather_results(self):
return {
"agent_distance": {
"timestep": self.delta_agent_distance,
},
"grasp_distance": {
"timestep": self.delta_agent_grasp_distance,
},
"work": {
"timestep": self.delta_agent_work,
},
"pos": {
"timestep": self.agent_pos,
},
"local_pos": {
"timestep": self.agent_local_pos,
},
"grasping": {
"timestep": self.agent_grasping,
},
"reset": {
"timestep": self.agent_reset,
},
}
class FetchRobotMetric(MetricBase):
def __init__(self):
self.initialized = False
self.state_cache = {}
self.next_state_cache = {}
self.agent_pos = {part: [] for part in ["gripper", "body"]}
self.agent_grasping = {part: [] for part in ["gripper"]}
self.agent_local_pos = {part: [] for part in ["gripper"]}
self.delta_agent_distance = {part: [] for part in ["gripper", "body"]}
self.delta_agent_grasp_distance = {part: [] for part in ["gripper"]}
self.clip = 0.2
def step_callback(self, igbhvr_act_inst, _):
robot = igbhvr_act_inst.simulator.robots[0]
agent_distance = {part: 0 for part in self.agent_pos}
self.next_state_cache = {
"gripper": {"position": robot.get_end_effector_position()},
"body": {"position": robot.get_position()},
}
if not self.initialized:
self.state_cache = copy.deepcopy(self.next_state_cache)
self.initialized = True
self.agent_pos["body"].append(list(self.state_cache["body"]["position"]))
delta_pos = np.linalg.norm(
np.array(self.next_state_cache["body"]["position"]) - self.state_cache["body"]["position"]
)
distance = np.abs(delta_pos)
self.delta_agent_distance["body"].append(distance)
self.agent_pos["gripper"].append(list(self.state_cache["gripper"]["position"]))
delta_pos = np.linalg.norm(
self.next_state_cache["gripper"]["position"] - self.state_cache["gripper"]["position"]
)
gripper_distance = np.abs(delta_pos)
self.delta_agent_distance["gripper"].append(gripper_distance)
self.agent_local_pos["gripper"].append(list(robot.get_relative_eef_position()))
contacts = p.getContactPoints(bodyA=robot.robot_ids[0], linkIndexA=robot.eef_link_id)
if len(contacts) > 0:
self.delta_agent_grasp_distance["gripper"].append(gripper_distance)
self.agent_grasping["gripper"].append(True)
else:
self.delta_agent_grasp_distance["gripper"].append(0)
self.agent_grasping["gripper"].append(False)
self.state_cache = copy.deepcopy(self.next_state_cache)
def gather_results(self):
return {
"agent_distance": {
"timestep": self.delta_agent_distance,
},
"grasp_distance": {
"timestep": self.delta_agent_grasp_distance,
},
"pos": {
"timestep": self.agent_pos,
},
"local_pos": {
"timestep": self.agent_local_pos,
},
"grasping": {
"timestep": self.agent_grasping,
},
}
| [
1,
1053,
3509,
13,
13,
5215,
12655,
408,
7442,
13,
5215,
11451,
18850,
408,
282,
13,
13,
3166,
8919,
747,
1100,
29889,
2527,
10817,
29889,
16414,
29918,
3188,
1053,
4737,
2200,
5160,
13,
13,
13,
1990,
1522,
16300,
21860,
327,
10095,
2200,
29898,
10095,
2200,
5160,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
11228,
1891,
353,
7700,
13,
13,
4706,
1583,
29889,
3859,
29918,
8173,
353,
6571,
13,
4706,
1583,
29889,
4622,
29918,
3859,
29918,
8173,
353,
6571,
13,
13,
4706,
1583,
29889,
14748,
29918,
1066,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
613,
376,
2587,
3108,
29913,
13,
4706,
1583,
29889,
14748,
29918,
629,
4692,
292,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
3108,
29913,
13,
13,
4706,
1583,
29889,
14748,
29918,
2997,
29918,
1066,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
3108,
29913,
13,
13,
4706,
1583,
29889,
14748,
29918,
12071,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
613,
376,
2587,
3108,
29913,
13,
13,
4706,
1583,
29889,
4181,
29918,
14748,
29918,
1287,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
613,
376,
2587,
3108,
29913,
13,
4706,
1583,
29889,
4181,
29918,
14748,
29918,
19244,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
613,
376,
2587,
3108,
29913,
13,
4706,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
3108,
29913,
13,
13,
4706,
1583,
29889,
24049,
353,
29871,
29900,
29889,
29906,
13,
13,
1678,
822,
4331,
29918,
14035,
29898,
1311,
29892,
8919,
29890,
29882,
13416,
29918,
627,
29918,
2611,
29892,
903,
1125,
13,
4706,
19964,
353,
8919,
29890,
29882,
13416,
29918,
627,
29918,
2611,
29889,
3601,
9183,
29889,
13716,
1862,
29961,
29900,
29962,
13,
4706,
10823,
29918,
1287,
353,
426,
1595,
29901,
29871,
29900,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
613,
376,
2587,
3108,
29913,
13,
4706,
10823,
29918,
19244,
353,
426,
1595,
29901,
29871,
29900,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
613,
376,
2587,
3108,
29913,
13,
13,
4706,
363,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
613,
376,
2587,
3108,
29901,
13,
9651,
1583,
29889,
4622,
29918,
3859,
29918,
8173,
29961,
1595,
29962,
353,
426,
13,
18884,
376,
3283,
1115,
7442,
29889,
2378,
29898,
29886,
29889,
657,
5160,
8003,
2855,
25231,
29898,
307,
7451,
29889,
20895,
29961,
1595,
1822,
657,
29918,
2587,
29918,
333,
3101,
29961,
29900,
11724,
13,
9651,
500,
13,
13,
4706,
565,
451,
1583,
29889,
11228,
1891,
29901,
13,
9651,
1583,
29889,
3859,
29918,
8173,
353,
3509,
29889,
24535,
8552,
29898,
1311,
29889,
4622,
29918,
3859,
29918,
8173,
29897,
13,
9651,
1583,
29889,
11228,
1891,
353,
5852,
13,
13,
4706,
565,
19964,
29889,
2467,
29961,
29896,
29929,
29962,
1405,
29871,
29900,
322,
19964,
29889,
2467,
29961,
29906,
29955,
29962,
1405,
29871,
29900,
29901,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1563,
29918,
3179,
16862,
4397,
29898,
5574,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1266,
29918,
3179,
16862,
4397,
29898,
5574,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
2587,
16862,
4397,
29898,
5574,
29897,
13,
4706,
565,
19964,
29889,
2467,
29961,
29896,
29929,
29962,
1405,
29871,
29900,
29901,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1563,
29918,
3179,
16862,
4397,
29898,
5574,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1266,
29918,
3179,
16862,
4397,
29898,
8824,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
2587,
16862,
4397,
29898,
5574,
29897,
13,
4706,
25342,
19964,
29889,
2467,
29961,
29906,
29955,
29962,
1405,
29871,
29900,
29901,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1563,
29918,
3179,
16862,
4397,
29898,
8824,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1266,
29918,
3179,
16862,
4397,
29898,
5574,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
2587,
16862,
4397,
29898,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1563,
29918,
3179,
16862,
4397,
29898,
8824,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
1266,
29918,
3179,
16862,
4397,
29898,
8824,
29897,
13,
9651,
1583,
29889,
14748,
29918,
12071,
3366,
2587,
16862,
4397,
29898,
8824,
29897,
13,
13,
4706,
363,
760,
297,
1583,
29889,
3859,
29918,
8173,
29901,
13,
9651,
19471,
29918,
1066,
353,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
1311,
29889,
4622,
29918,
3859,
29918,
8173,
29961,
1595,
29962,
3366,
3283,
3108,
448,
1583,
29889,
3859,
29918,
8173,
29961,
1595,
29962,
3366,
3283,
20068,
13,
9651,
1583,
29889,
14748,
29918,
1066,
29961,
1595,
1822,
4397,
29898,
1761,
29898,
1311,
29889,
3859,
29918,
8173,
29961,
1595,
29962,
3366,
3283,
3108,
876,
13,
9651,
396,
1222,
2325,
10823,
4382,
4011,
13,
9651,
19471,
29918,
1066,
353,
7442,
29889,
24049,
29898,
4181,
29918,
1066,
29892,
448,
1311,
29889,
24049,
29892,
1583,
29889,
24049,
29897,
13,
9651,
565,
19964,
29889,
20895,
29961,
1595,
1822,
13529,
882,
29918,
25232,
338,
6213,
29901,
13,
18884,
4889,
353,
29871,
29900,
13,
18884,
664,
353,
29871,
29900,
13,
9651,
1683,
29901,
13,
18884,
4889,
353,
282,
29889,
657,
21529,
2792,
29898,
307,
7451,
29889,
20895,
29961,
1595,
1822,
13529,
882,
29918,
25232,
29897,
13,
18884,
664,
353,
7442,
29889,
6897,
3552,
4181,
29918,
1066,
334,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
10118,
4961,
13,
13,
9651,
5418,
353,
7442,
29889,
6897,
29898,
4181,
29918,
1066,
29897,
13,
9651,
565,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
3108,
29901,
13,
18884,
1583,
29889,
14748,
29918,
2997,
29918,
1066,
29961,
1595,
1822,
4397,
29898,
1761,
29898,
307,
7451,
29889,
20895,
29961,
1595,
1822,
657,
29918,
2997,
29918,
3283,
29918,
20659,
580,
29961,
29900,
12622,
13,
9651,
565,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
3108,
322,
313,
13,
18884,
7431,
29898,
29886,
29889,
657,
13443,
20325,
29898,
307,
7451,
29889,
20895,
29961,
1595,
1822,
657,
29918,
2587,
29918,
333,
22130,
1405,
29871,
29900,
13,
18884,
470,
19964,
29889,
20895,
29961,
1595,
1822,
3318,
29918,
262,
29918,
3179,
338,
451,
6213,
13,
632,
1125,
13,
18884,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
29961,
1595,
1822,
4397,
29898,
19244,
29897,
13,
18884,
1583,
29889,
14748,
29918,
629,
4692,
292,
29961,
1595,
1822,
4397,
29898,
5574,
29897,
13,
9651,
25342,
760,
297,
6796,
1563,
29918,
3179,
613,
376,
1266,
29918,
3179,
3108,
29901,
13,
18884,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
29961,
1595,
1822,
4397,
29898,
29900,
29897,
13,
18884,
1583,
29889,
14748,
29918,
629,
4692,
292,
29961,
1595,
1822,
4397,
29898,
8824,
29897,
13,
13,
9651,
10823,
29918,
1287,
29961,
1595,
29962,
353,
664,
13,
9651,
10823,
29918,
19244,
29961,
1595,
29962,
353,
5418,
13,
13,
9651,
1583,
29889,
4181,
29918,
14748,
29918,
1287,
29961,
1595,
1822,
4397,
29898,
1287,
29897,
13,
9651,
1583,
29889,
4181,
29918,
14748,
29918,
19244,
29961,
1595,
1822,
4397,
29898,
19244,
29897,
13,
13,
4706,
1583,
29889,
3859,
29918,
8173,
353,
3509,
29889,
24535,
8552,
29898,
1311,
29889,
4622,
29918,
3859,
29918,
8173,
29897,
13,
13,
1678,
822,
11705,
29918,
9902,
29898,
1311,
1125,
13,
4706,
736,
426,
13,
9651,
376,
14748,
29918,
19244,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
4181,
29918,
14748,
29918,
19244,
29892,
13,
9651,
2981,
13,
9651,
376,
629,
4692,
29918,
19244,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
29892,
13,
9651,
2981,
13,
9651,
376,
1287,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
4181,
29918,
14748,
29918,
1287,
29892,
13,
9651,
2981,
13,
9651,
376,
1066,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
14748,
29918,
1066,
29892,
13,
9651,
2981,
13,
9651,
376,
2997,
29918,
1066,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
14748,
29918,
2997,
29918,
1066,
29892,
13,
9651,
2981,
13,
9651,
376,
629,
4692,
292,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
14748,
29918,
629,
4692,
292,
29892,
13,
9651,
2981,
13,
9651,
376,
12071,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
14748,
29918,
12071,
29892,
13,
9651,
2981,
13,
4706,
500,
13,
13,
13,
1990,
383,
3486,
21860,
327,
10095,
2200,
29898,
10095,
2200,
5160,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
1583,
29889,
11228,
1891,
353,
7700,
13,
13,
4706,
1583,
29889,
3859,
29918,
8173,
353,
6571,
13,
4706,
1583,
29889,
4622,
29918,
3859,
29918,
8173,
353,
6571,
13,
13,
4706,
1583,
29889,
14748,
29918,
1066,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
29887,
374,
2496,
613,
376,
2587,
3108,
29913,
13,
4706,
1583,
29889,
14748,
29918,
629,
4692,
292,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
29887,
374,
2496,
3108,
29913,
13,
13,
4706,
1583,
29889,
14748,
29918,
2997,
29918,
1066,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
29887,
374,
2496,
3108,
29913,
13,
13,
4706,
1583,
29889,
4181,
29918,
14748,
29918,
19244,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
29887,
374,
2496,
613,
376,
2587,
3108,
29913,
13,
4706,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
353,
426,
1595,
29901,
5159,
363,
760,
297,
6796,
29887,
374,
2496,
3108,
29913,
13,
13,
4706,
1583,
29889,
24049,
353,
29871,
29900,
29889,
29906,
13,
13,
1678,
822,
4331,
29918,
14035,
29898,
1311,
29892,
8919,
29890,
29882,
13416,
29918,
627,
29918,
2611,
29892,
903,
1125,
13,
4706,
19964,
353,
8919,
29890,
29882,
13416,
29918,
627,
29918,
2611,
29889,
3601,
9183,
29889,
13716,
1862,
29961,
29900,
29962,
13,
4706,
10823,
29918,
19244,
353,
426,
1595,
29901,
29871,
29900,
363,
760,
297,
1583,
29889,
14748,
29918,
1066,
29913,
13,
13,
4706,
1583,
29889,
4622,
29918,
3859,
29918,
8173,
353,
426,
13,
9651,
376,
29887,
374,
2496,
1115,
8853,
3283,
1115,
19964,
29889,
657,
29918,
355,
29918,
12352,
3019,
29918,
3283,
580,
1118,
13,
9651,
376,
2587,
1115,
8853,
3283,
1115,
19964,
29889,
657,
29918,
3283,
580,
1118,
13,
4706,
500,
13,
13,
4706,
565,
451,
1583,
29889,
11228,
1891,
29901,
13,
9651,
1583,
29889,
3859,
29918,
8173,
353,
3509,
29889,
24535,
8552,
29898,
1311,
29889,
4622,
29918,
3859,
29918,
8173,
29897,
13,
9651,
1583,
29889,
11228,
1891,
353,
5852,
13,
13,
4706,
1583,
29889,
14748,
29918,
1066,
3366,
2587,
16862,
4397,
29898,
1761,
29898,
1311,
29889,
3859,
29918,
8173,
3366,
2587,
3108,
3366,
3283,
3108,
876,
13,
4706,
19471,
29918,
1066,
353,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
13,
9651,
7442,
29889,
2378,
29898,
1311,
29889,
4622,
29918,
3859,
29918,
8173,
3366,
2587,
3108,
3366,
3283,
20068,
448,
1583,
29889,
3859,
29918,
8173,
3366,
2587,
3108,
3366,
3283,
3108,
13,
4706,
1723,
13,
4706,
5418,
353,
7442,
29889,
6897,
29898,
4181,
29918,
1066,
29897,
13,
4706,
1583,
29889,
4181,
29918,
14748,
29918,
19244,
3366,
2587,
16862,
4397,
29898,
19244,
29897,
13,
13,
4706,
1583,
29889,
14748,
29918,
1066,
3366,
29887,
374,
2496,
16862,
4397,
29898,
1761,
29898,
1311,
29889,
3859,
29918,
8173,
3366,
29887,
374,
2496,
3108,
3366,
3283,
3108,
876,
13,
4706,
19471,
29918,
1066,
353,
7442,
29889,
29880,
979,
29887,
29889,
12324,
29898,
13,
9651,
1583,
29889,
4622,
29918,
3859,
29918,
8173,
3366,
29887,
374,
2496,
3108,
3366,
3283,
3108,
448,
1583,
29889,
3859,
29918,
8173,
3366,
29887,
374,
2496,
3108,
3366,
3283,
3108,
13,
4706,
1723,
13,
4706,
330,
374,
2496,
29918,
19244,
353,
7442,
29889,
6897,
29898,
4181,
29918,
1066,
29897,
13,
4706,
1583,
29889,
4181,
29918,
14748,
29918,
19244,
3366,
29887,
374,
2496,
16862,
4397,
29898,
29887,
374,
2496,
29918,
19244,
29897,
13,
13,
4706,
1583,
29889,
14748,
29918,
2997,
29918,
1066,
3366,
29887,
374,
2496,
16862,
4397,
29898,
1761,
29898,
307,
7451,
29889,
657,
29918,
22925,
29918,
29872,
1389,
29918,
3283,
22130,
13,
13,
4706,
25957,
353,
282,
29889,
657,
13443,
20325,
29898,
2587,
29909,
29922,
307,
7451,
29889,
307,
7451,
29918,
4841,
29961,
29900,
1402,
1544,
3220,
29909,
29922,
307,
7451,
29889,
29872,
1389,
29918,
2324,
29918,
333,
29897,
13,
4706,
565,
7431,
29898,
12346,
29879,
29897,
1405,
29871,
29900,
29901,
13,
9651,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
3366,
29887,
374,
2496,
16862,
4397,
29898,
29887,
374,
2496,
29918,
19244,
29897,
13,
9651,
1583,
29889,
14748,
29918,
629,
4692,
292,
3366,
29887,
374,
2496,
16862,
4397,
29898,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
3366,
29887,
374,
2496,
16862,
4397,
29898,
29900,
29897,
13,
9651,
1583,
29889,
14748,
29918,
629,
4692,
292,
3366,
29887,
374,
2496,
16862,
4397,
29898,
8824,
29897,
13,
13,
4706,
1583,
29889,
3859,
29918,
8173,
353,
3509,
29889,
24535,
8552,
29898,
1311,
29889,
4622,
29918,
3859,
29918,
8173,
29897,
13,
13,
1678,
822,
11705,
29918,
9902,
29898,
1311,
1125,
13,
4706,
736,
426,
13,
9651,
376,
14748,
29918,
19244,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
4181,
29918,
14748,
29918,
19244,
29892,
13,
9651,
2981,
13,
9651,
376,
629,
4692,
29918,
19244,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
4181,
29918,
14748,
29918,
629,
4692,
29918,
19244,
29892,
13,
9651,
2981,
13,
9651,
376,
1066,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
14748,
29918,
1066,
29892,
13,
9651,
2981,
13,
9651,
376,
2997,
29918,
1066,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
14748,
29918,
2997,
29918,
1066,
29892,
13,
9651,
2981,
13,
9651,
376,
629,
4692,
292,
1115,
426,
13,
18884,
376,
9346,
342,
1022,
1115,
1583,
29889,
14748,
29918,
629,
4692,
292,
29892,
13,
9651,
2981,
13,
4706,
500,
13,
2
] |
ProjectEuler.Problem.013.py | jihunroh/ProjectEuler-Python | 0 | 7323 | from ProjectEulerCommons.Base import *
numbers_list = """37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
74324986199524741059474233309513058123726617309629
91942213363574161572522430563301811072406154908250
23067588207539346171171980310421047513778063246676
89261670696623633820136378418383684178734361726757
28112879812849979408065481931592621691275889832738
44274228917432520321923589422876796487670272189318
47451445736001306439091167216856844588711603153276
70386486105843025439939619828917593665686757934951
62176457141856560629502157223196586755079324193331
64906352462741904929101432445813822663347944758178
92575867718337217661963751590579239728245598838407
58203565325359399008402633568948830189458628227828
80181199384826282014278194139940567587151170094390
35398664372827112653829987240784473053190104293586
86515506006295864861532075273371959191420517255829
71693888707715466499115593487603532921714970056938
54370070576826684624621495650076471787294438377604
53282654108756828443191190634694037855217779295145
36123272525000296071075082563815656710885258350721
45876576172410976447339110607218265236877223636045
17423706905851860660448207621209813287860733969412
81142660418086830619328460811191061556940512689692
51934325451728388641918047049293215058642563049483
62467221648435076201727918039944693004732956340691
15732444386908125794514089057706229429197107928209
55037687525678773091862540744969844508330393682126
18336384825330154686196124348767681297534375946515
80386287592878490201521685554828717201219257766954
78182833757993103614740356856449095527097864797581
16726320100436897842553539920931837441497806860984
48403098129077791799088218795327364475675590848030
87086987551392711854517078544161852424320693150332
59959406895756536782107074926966537676326235447210
69793950679652694742597709739166693763042633987085
41052684708299085211399427365734116182760315001271
65378607361501080857009149939512557028198746004375
35829035317434717326932123578154982629742552737307
94953759765105305946966067683156574377167401875275
88902802571733229619176668713819931811048770190271
25267680276078003013678680992525463401061632866526
36270218540497705585629946580636237993140746255962
24074486908231174977792365466257246923322810917141
91430288197103288597806669760892938638285025333403
34413065578016127815921815005561868836468420090470
23053081172816430487623791969842487255036638784583
11487696932154902810424020138335124462181441773470
63783299490636259666498587618221225225512486764533
67720186971698544312419572409913959008952310058822
95548255300263520781532296796249481641953868218774
76085327132285723110424803456124867697064507995236
37774242535411291684276865538926205024910326572967
23701913275725675285653248258265463092207058596522
29798860272258331913126375147341994889534765745501
18495701454879288984856827726077713721403798879715
38298203783031473527721580348144513491373226651381
34829543829199918180278916522431027392251122869539
40957953066405232632538044100059654939159879593635
29746152185502371307642255121183693803580388584903
41698116222072977186158236678424689157993532961922
62467957194401269043877107275048102390895523597457
23189706772547915061505504953922979530901129967519
86188088225875314529584099251203829009407770775672
11306739708304724483816533873502340845647058077308
82959174767140363198008187129011875491310547126581
97623331044818386269515456334926366572897563400500
42846280183517070527831839425882145521227251250327
55121603546981200581762165212827652751691296897789
32238195734329339946437501907836945765883352399886
75506164965184775180738168837861091527357929701337
62177842752192623401942399639168044983993173312731
32924185707147349566916674687634660915035914677504
99518671430235219628894890102423325116913619626622
73267460800591547471830798392868535206946944540724
76841822524674417161514036427982273348055556214818
97142617910342598647204516893989422179826088076852
87783646182799346313767754307809363333018982642090
10848802521674670883215120185883543223812876952786
71329612474782464538636993009049310363619763878039
62184073572399794223406235393808339651327408011116
66627891981488087797941876876144230030984490851411
60661826293682836764744779239180335110989069790714
85786944089552990653640447425576083659976645795096
66024396409905389607120198219976047599490197230297
64913982680032973156037120041377903785566085089252
16730939319872750275468906903707539413042652315011
94809377245048795150954100921645863754710598436791
78639167021187492431995700641917969777599028300699
15368713711936614952811305876380278410754449733078
40789923115535562561142322423255033685442488917353
44889911501440648020369068063960672322193204149535
41503128880339536053299340368006977710650566631954
81234880673210146739058568557934581403627822703280
82616570773948327592232845941706525094512325230608
22918802058777319719839450180888072429661980811197
77158542502016545090413245809786882778948721859617
72107838435069186155435662884062257473692284509516
20849603980134001723930671666823555245252804609722
53503534226472524250874054075591789781264330331690""".splitlines()
Answer(
str(sum([int(line) for line in numbers_list]))[0:10]
)
"""
------------------------------------------------
ProjectEuler.Problem.013.py
The Answer is: 5537376230
Time Elasped: 0.005984783172607422sec
------------------------------------------------
"""
| [
1,
515,
8010,
29923,
8584,
5261,
787,
29889,
5160,
1053,
334,
13,
13,
20326,
29918,
1761,
353,
9995,
29941,
29955,
29896,
29900,
29955,
29906,
29947,
29955,
29945,
29941,
29941,
29929,
29900,
29906,
29896,
29900,
29906,
29955,
29929,
29947,
29955,
29929,
29955,
29929,
29929,
29947,
29906,
29906,
29900,
29947,
29941,
29955,
29945,
29929,
29900,
29906,
29946,
29953,
29945,
29896,
29900,
29896,
29941,
29945,
29955,
29946,
29900,
29906,
29945,
29900,
13,
29946,
29953,
29941,
29955,
29953,
29929,
29941,
29955,
29953,
29955,
29955,
29946,
29929,
29900,
29900,
29900,
29929,
29955,
29896,
29906,
29953,
29946,
29947,
29896,
29906,
29946,
29947,
29929,
29953,
29929,
29955,
29900,
29900,
29955,
29947,
29900,
29945,
29900,
29946,
29896,
29955,
29900,
29896,
29947,
29906,
29953,
29900,
29945,
29941,
29947,
13,
29955,
29946,
29941,
29906,
29946,
29929,
29947,
29953,
29896,
29929,
29929,
29945,
29906,
29946,
29955,
29946,
29896,
29900,
29945,
29929,
29946,
29955,
29946,
29906,
29941,
29941,
29941,
29900,
29929,
29945,
29896,
29941,
29900,
29945,
29947,
29896,
29906,
29941,
29955,
29906,
29953,
29953,
29896,
29955,
29941,
29900,
29929,
29953,
29906,
29929,
13,
29929,
29896,
29929,
29946,
29906,
29906,
29896,
29941,
29941,
29953,
29941,
29945,
29955,
29946,
29896,
29953,
29896,
29945,
29955,
29906,
29945,
29906,
29906,
29946,
29941,
29900,
29945,
29953,
29941,
29941,
29900,
29896,
29947,
29896,
29896,
29900,
29955,
29906,
29946,
29900,
29953,
29896,
29945,
29946,
29929,
29900,
29947,
29906,
29945,
29900,
13,
29906,
29941,
29900,
29953,
29955,
29945,
29947,
29947,
29906,
29900,
29955,
29945,
29941,
29929,
29941,
29946,
29953,
29896,
29955,
29896,
29896,
29955,
29896,
29929,
29947,
29900,
29941,
29896,
29900,
29946,
29906,
29896,
29900,
29946,
29955,
29945,
29896,
29941,
29955,
29955,
29947,
29900,
29953,
29941,
29906,
29946,
29953,
29953,
29955,
29953,
13,
29947,
29929,
29906,
29953,
29896,
29953,
29955,
29900,
29953,
29929,
29953,
29953,
29906,
29941,
29953,
29941,
29941,
29947,
29906,
29900,
29896,
29941,
29953,
29941,
29955,
29947,
29946,
29896,
29947,
29941,
29947,
29941,
29953,
29947,
29946,
29896,
29955,
29947,
29955,
29941,
29946,
29941,
29953,
29896,
29955,
29906,
29953,
29955,
29945,
29955,
13,
29906,
29947,
29896,
29896,
29906,
29947,
29955,
29929,
29947,
29896,
29906,
29947,
29946,
29929,
29929,
29955,
29929,
29946,
29900,
29947,
29900,
29953,
29945,
29946,
29947,
29896,
29929,
29941,
29896,
29945,
29929,
29906,
29953,
29906,
29896,
29953,
29929,
29896,
29906,
29955,
29945,
29947,
29947,
29929,
29947,
29941,
29906,
29955,
29941,
29947,
13,
29946,
29946,
29906,
29955,
29946,
29906,
29906,
29947,
29929,
29896,
29955,
29946,
29941,
29906,
29945,
29906,
29900,
29941,
29906,
29896,
29929,
29906,
29941,
29945,
29947,
29929,
29946,
29906,
29906,
29947,
29955,
29953,
29955,
29929,
29953,
29946,
29947,
29955,
29953,
29955,
29900,
29906,
29955,
29906,
29896,
29947,
29929,
29941,
29896,
29947,
13,
29946,
29955,
29946,
29945,
29896,
29946,
29946,
29945,
29955,
29941,
29953,
29900,
29900,
29896,
29941,
29900,
29953,
29946,
29941,
29929,
29900,
29929,
29896,
29896,
29953,
29955,
29906,
29896,
29953,
29947,
29945,
29953,
29947,
29946,
29946,
29945,
29947,
29947,
29955,
29896,
29896,
29953,
29900,
29941,
29896,
29945,
29941,
29906,
29955,
29953,
13,
29955,
29900,
29941,
29947,
29953,
29946,
29947,
29953,
29896,
29900,
29945,
29947,
29946,
29941,
29900,
29906,
29945,
29946,
29941,
29929,
29929,
29941,
29929,
29953,
29896,
29929,
29947,
29906,
29947,
29929,
29896,
29955,
29945,
29929,
29941,
29953,
29953,
29945,
29953,
29947,
29953,
29955,
29945,
29955,
29929,
29941,
29946,
29929,
29945,
29896,
13,
29953,
29906,
29896,
29955,
29953,
29946,
29945,
29955,
29896,
29946,
29896,
29947,
29945,
29953,
29945,
29953,
29900,
29953,
29906,
29929,
29945,
29900,
29906,
29896,
29945,
29955,
29906,
29906,
29941,
29896,
29929,
29953,
29945,
29947,
29953,
29955,
29945,
29945,
29900,
29955,
29929,
29941,
29906,
29946,
29896,
29929,
29941,
29941,
29941,
29896,
13,
29953,
29946,
29929,
29900,
29953,
29941,
29945,
29906,
29946,
29953,
29906,
29955,
29946,
29896,
29929,
29900,
29946,
29929,
29906,
29929,
29896,
29900,
29896,
29946,
29941,
29906,
29946,
29946,
29945,
29947,
29896,
29941,
29947,
29906,
29906,
29953,
29953,
29941,
29941,
29946,
29955,
29929,
29946,
29946,
29955,
29945,
29947,
29896,
29955,
29947,
13,
29929,
29906,
29945,
29955,
29945,
29947,
29953,
29955,
29955,
29896,
29947,
29941,
29941,
29955,
29906,
29896,
29955,
29953,
29953,
29896,
29929,
29953,
29941,
29955,
29945,
29896,
29945,
29929,
29900,
29945,
29955,
29929,
29906,
29941,
29929,
29955,
29906,
29947,
29906,
29946,
29945,
29945,
29929,
29947,
29947,
29941,
29947,
29946,
29900,
29955,
13,
29945,
29947,
29906,
29900,
29941,
29945,
29953,
29945,
29941,
29906,
29945,
29941,
29945,
29929,
29941,
29929,
29929,
29900,
29900,
29947,
29946,
29900,
29906,
29953,
29941,
29941,
29945,
29953,
29947,
29929,
29946,
29947,
29947,
29941,
29900,
29896,
29947,
29929,
29946,
29945,
29947,
29953,
29906,
29947,
29906,
29906,
29955,
29947,
29906,
29947,
13,
29947,
29900,
29896,
29947,
29896,
29896,
29929,
29929,
29941,
29947,
29946,
29947,
29906,
29953,
29906,
29947,
29906,
29900,
29896,
29946,
29906,
29955,
29947,
29896,
29929,
29946,
29896,
29941,
29929,
29929,
29946,
29900,
29945,
29953,
29955,
29945,
29947,
29955,
29896,
29945,
29896,
29896,
29955,
29900,
29900,
29929,
29946,
29941,
29929,
29900,
13,
29941,
29945,
29941,
29929,
29947,
29953,
29953,
29946,
29941,
29955,
29906,
29947,
29906,
29955,
29896,
29896,
29906,
29953,
29945,
29941,
29947,
29906,
29929,
29929,
29947,
29955,
29906,
29946,
29900,
29955,
29947,
29946,
29946,
29955,
29941,
29900,
29945,
29941,
29896,
29929,
29900,
29896,
29900,
29946,
29906,
29929,
29941,
29945,
29947,
29953,
13,
29947,
29953,
29945,
29896,
29945,
29945,
29900,
29953,
29900,
29900,
29953,
29906,
29929,
29945,
29947,
29953,
29946,
29947,
29953,
29896,
29945,
29941,
29906,
29900,
29955,
29945,
29906,
29955,
29941,
29941,
29955,
29896,
29929,
29945,
29929,
29896,
29929,
29896,
29946,
29906,
29900,
29945,
29896,
29955,
29906,
29945,
29945,
29947,
29906,
29929,
13,
29955,
29896,
29953,
29929,
29941,
29947,
29947,
29947,
29955,
29900,
29955,
29955,
29896,
29945,
29946,
29953,
29953,
29946,
29929,
29929,
29896,
29896,
29945,
29945,
29929,
29941,
29946,
29947,
29955,
29953,
29900,
29941,
29945,
29941,
29906,
29929,
29906,
29896,
29955,
29896,
29946,
29929,
29955,
29900,
29900,
29945,
29953,
29929,
29941,
29947,
13,
29945,
29946,
29941,
29955,
29900,
29900,
29955,
29900,
29945,
29955,
29953,
29947,
29906,
29953,
29953,
29947,
29946,
29953,
29906,
29946,
29953,
29906,
29896,
29946,
29929,
29945,
29953,
29945,
29900,
29900,
29955,
29953,
29946,
29955,
29896,
29955,
29947,
29955,
29906,
29929,
29946,
29946,
29941,
29947,
29941,
29955,
29955,
29953,
29900,
29946,
13,
29945,
29941,
29906,
29947,
29906,
29953,
29945,
29946,
29896,
29900,
29947,
29955,
29945,
29953,
29947,
29906,
29947,
29946,
29946,
29941,
29896,
29929,
29896,
29896,
29929,
29900,
29953,
29941,
29946,
29953,
29929,
29946,
29900,
29941,
29955,
29947,
29945,
29945,
29906,
29896,
29955,
29955,
29955,
29929,
29906,
29929,
29945,
29896,
29946,
29945,
13,
29941,
29953,
29896,
29906,
29941,
29906,
29955,
29906,
29945,
29906,
29945,
29900,
29900,
29900,
29906,
29929,
29953,
29900,
29955,
29896,
29900,
29955,
29945,
29900,
29947,
29906,
29945,
29953,
29941,
29947,
29896,
29945,
29953,
29945,
29953,
29955,
29896,
29900,
29947,
29947,
29945,
29906,
29945,
29947,
29941,
29945,
29900,
29955,
29906,
29896,
13,
29946,
29945,
29947,
29955,
29953,
29945,
29955,
29953,
29896,
29955,
29906,
29946,
29896,
29900,
29929,
29955,
29953,
29946,
29946,
29955,
29941,
29941,
29929,
29896,
29896,
29900,
29953,
29900,
29955,
29906,
29896,
29947,
29906,
29953,
29945,
29906,
29941,
29953,
29947,
29955,
29955,
29906,
29906,
29941,
29953,
29941,
29953,
29900,
29946,
29945,
13,
29896,
29955,
29946,
29906,
29941,
29955,
29900,
29953,
29929,
29900,
29945,
29947,
29945,
29896,
29947,
29953,
29900,
29953,
29953,
29900,
29946,
29946,
29947,
29906,
29900,
29955,
29953,
29906,
29896,
29906,
29900,
29929,
29947,
29896,
29941,
29906,
29947,
29955,
29947,
29953,
29900,
29955,
29941,
29941,
29929,
29953,
29929,
29946,
29896,
29906,
13,
29947,
29896,
29896,
29946,
29906,
29953,
29953,
29900,
29946,
29896,
29947,
29900,
29947,
29953,
29947,
29941,
29900,
29953,
29896,
29929,
29941,
29906,
29947,
29946,
29953,
29900,
29947,
29896,
29896,
29896,
29929,
29896,
29900,
29953,
29896,
29945,
29945,
29953,
29929,
29946,
29900,
29945,
29896,
29906,
29953,
29947,
29929,
29953,
29929,
29906,
13,
29945,
29896,
29929,
29941,
29946,
29941,
29906,
29945,
29946,
29945,
29896,
29955,
29906,
29947,
29941,
29947,
29947,
29953,
29946,
29896,
29929,
29896,
29947,
29900,
29946,
29955,
29900,
29946,
29929,
29906,
29929,
29941,
29906,
29896,
29945,
29900,
29945,
29947,
29953,
29946,
29906,
29945,
29953,
29941,
29900,
29946,
29929,
29946,
29947,
29941,
13,
29953,
29906,
29946,
29953,
29955,
29906,
29906,
29896,
29953,
29946,
29947,
29946,
29941,
29945,
29900,
29955,
29953,
29906,
29900,
29896,
29955,
29906,
29955,
29929,
29896,
29947,
29900,
29941,
29929,
29929,
29946,
29946,
29953,
29929,
29941,
29900,
29900,
29946,
29955,
29941,
29906,
29929,
29945,
29953,
29941,
29946,
29900,
29953,
29929,
29896,
13,
29896,
29945,
29955,
29941,
29906,
29946,
29946,
29946,
29941,
29947,
29953,
29929,
29900,
29947,
29896,
29906,
29945,
29955,
29929,
29946,
29945,
29896,
29946,
29900,
29947,
29929,
29900,
29945,
29955,
29955,
29900,
29953,
29906,
29906,
29929,
29946,
29906,
29929,
29896,
29929,
29955,
29896,
29900,
29955,
29929,
29906,
29947,
29906,
29900,
29929,
13,
29945,
29945,
29900,
29941,
29955,
29953,
29947,
29955,
29945,
29906,
29945,
29953,
29955,
29947,
29955,
29955,
29941,
29900,
29929,
29896,
29947,
29953,
29906,
29945,
29946,
29900,
29955,
29946,
29946,
29929,
29953,
29929,
29947,
29946,
29946,
29945,
29900,
29947,
29941,
29941,
29900,
29941,
29929,
29941,
29953,
29947,
29906,
29896,
29906,
29953,
13,
29896,
29947,
29941,
29941,
29953,
29941,
29947,
29946,
29947,
29906,
29945,
29941,
29941,
29900,
29896,
29945,
29946,
29953,
29947,
29953,
29896,
29929,
29953,
29896,
29906,
29946,
29941,
29946,
29947,
29955,
29953,
29955,
29953,
29947,
29896,
29906,
29929,
29955,
29945,
29941,
29946,
29941,
29955,
29945,
29929,
29946,
29953,
29945,
29896,
29945,
13,
29947,
29900,
29941,
29947,
29953,
29906,
29947,
29955,
29945,
29929,
29906,
29947,
29955,
29947,
29946,
29929,
29900,
29906,
29900,
29896,
29945,
29906,
29896,
29953,
29947,
29945,
29945,
29945,
29946,
29947,
29906,
29947,
29955,
29896,
29955,
29906,
29900,
29896,
29906,
29896,
29929,
29906,
29945,
29955,
29955,
29953,
29953,
29929,
29945,
29946,
13,
29955,
29947,
29896,
29947,
29906,
29947,
29941,
29941,
29955,
29945,
29955,
29929,
29929,
29941,
29896,
29900,
29941,
29953,
29896,
29946,
29955,
29946,
29900,
29941,
29945,
29953,
29947,
29945,
29953,
29946,
29946,
29929,
29900,
29929,
29945,
29945,
29906,
29955,
29900,
29929,
29955,
29947,
29953,
29946,
29955,
29929,
29955,
29945,
29947,
29896,
13,
29896,
29953,
29955,
29906,
29953,
29941,
29906,
29900,
29896,
29900,
29900,
29946,
29941,
29953,
29947,
29929,
29955,
29947,
29946,
29906,
29945,
29945,
29941,
29945,
29941,
29929,
29929,
29906,
29900,
29929,
29941,
29896,
29947,
29941,
29955,
29946,
29946,
29896,
29946,
29929,
29955,
29947,
29900,
29953,
29947,
29953,
29900,
29929,
29947,
29946,
13,
29946,
29947,
29946,
29900,
29941,
29900,
29929,
29947,
29896,
29906,
29929,
29900,
29955,
29955,
29955,
29929,
29896,
29955,
29929,
29929,
29900,
29947,
29947,
29906,
29896,
29947,
29955,
29929,
29945,
29941,
29906,
29955,
29941,
29953,
29946,
29946,
29955,
29945,
29953,
29955,
29945,
29945,
29929,
29900,
29947,
29946,
29947,
29900,
29941,
29900,
13,
29947,
29955,
29900,
29947,
29953,
29929,
29947,
29955,
29945,
29945,
29896,
29941,
29929,
29906,
29955,
29896,
29896,
29947,
29945,
29946,
29945,
29896,
29955,
29900,
29955,
29947,
29945,
29946,
29946,
29896,
29953,
29896,
29947,
29945,
29906,
29946,
29906,
29946,
29941,
29906,
29900,
29953,
29929,
29941,
29896,
29945,
29900,
29941,
29941,
29906,
13,
29945,
29929,
29929,
29945,
29929,
29946,
29900,
29953,
29947,
29929,
29945,
29955,
29945,
29953,
29945,
29941,
29953,
29955,
29947,
29906,
29896,
29900,
29955,
29900,
29955,
29946,
29929,
29906,
29953,
29929,
29953,
29953,
29945,
29941,
29955,
29953,
29955,
29953,
29941,
29906,
29953,
29906,
29941,
29945,
29946,
29946,
29955,
29906,
29896,
29900,
13,
29953,
29929,
29955,
29929,
29941,
29929,
29945,
29900,
29953,
29955,
29929,
29953,
29945,
29906,
29953,
29929,
29946,
29955,
29946,
29906,
29945,
29929,
29955,
29955,
29900,
29929,
29955,
29941,
29929,
29896,
29953,
29953,
29953,
29929,
29941,
29955,
29953,
29941,
29900,
29946,
29906,
29953,
29941,
29941,
29929,
29947,
29955,
29900,
29947,
29945,
13,
29946,
29896,
29900,
29945,
29906,
29953,
29947,
29946,
29955,
29900,
29947,
29906,
29929,
29929,
29900,
29947,
29945,
29906,
29896,
29896,
29941,
29929,
29929,
29946,
29906,
29955,
29941,
29953,
29945,
29955,
29941,
29946,
29896,
29896,
29953,
29896,
29947,
29906,
29955,
29953,
29900,
29941,
29896,
29945,
29900,
29900,
29896,
29906,
29955,
29896,
13,
29953,
29945,
29941,
29955,
29947,
29953,
29900,
29955,
29941,
29953,
29896,
29945,
29900,
29896,
29900,
29947,
29900,
29947,
29945,
29955,
29900,
29900,
29929,
29896,
29946,
29929,
29929,
29941,
29929,
29945,
29896,
29906,
29945,
29945,
29955,
29900,
29906,
29947,
29896,
29929,
29947,
29955,
29946,
29953,
29900,
29900,
29946,
29941,
29955,
29945,
13,
29941,
29945,
29947,
29906,
29929,
29900,
29941,
29945,
29941,
29896,
29955,
29946,
29941,
29946,
29955,
29896,
29955,
29941,
29906,
29953,
29929,
29941,
29906,
29896,
29906,
29941,
29945,
29955,
29947,
29896,
29945,
29946,
29929,
29947,
29906,
29953,
29906,
29929,
29955,
29946,
29906,
29945,
29945,
29906,
29955,
29941,
29955,
29941,
29900,
29955,
13,
29929,
29946,
29929,
29945,
29941,
29955,
29945,
29929,
29955,
29953,
29945,
29896,
29900,
29945,
29941,
29900,
29945,
29929,
29946,
29953,
29929,
29953,
29953,
29900,
29953,
29955,
29953,
29947,
29941,
29896,
29945,
29953,
29945,
29955,
29946,
29941,
29955,
29955,
29896,
29953,
29955,
29946,
29900,
29896,
29947,
29955,
29945,
29906,
29955,
29945,
13,
29947,
29947,
29929,
29900,
29906,
29947,
29900,
29906,
29945,
29955,
29896,
29955,
29941,
29941,
29906,
29906,
29929,
29953,
29896,
29929,
29896,
29955,
29953,
29953,
29953,
29947,
29955,
29896,
29941,
29947,
29896,
29929,
29929,
29941,
29896,
29947,
29896,
29896,
29900,
29946,
29947,
29955,
29955,
29900,
29896,
29929,
29900,
29906,
29955,
29896,
13,
29906,
29945,
29906,
29953,
29955,
29953,
29947,
29900,
29906,
29955,
29953,
29900,
29955,
29947,
29900,
29900,
29941,
29900,
29896,
29941,
29953,
29955,
29947,
29953,
29947,
29900,
29929,
29929,
29906,
29945,
29906,
29945,
29946,
29953,
29941,
29946,
29900,
29896,
29900,
29953,
29896,
29953,
29941,
29906,
29947,
29953,
29953,
29945,
29906,
29953,
13,
29941,
29953,
29906,
29955,
29900,
29906,
29896,
29947,
29945,
29946,
29900,
29946,
29929,
29955,
29955,
29900,
29945,
29945,
29947,
29945,
29953,
29906,
29929,
29929,
29946,
29953,
29945,
29947,
29900,
29953,
29941,
29953,
29906,
29941,
29955,
29929,
29929,
29941,
29896,
29946,
29900,
29955,
29946,
29953,
29906,
29945,
29945,
29929,
29953,
29906,
13,
29906,
29946,
29900,
29955,
29946,
29946,
29947,
29953,
29929,
29900,
29947,
29906,
29941,
29896,
29896,
29955,
29946,
29929,
29955,
29955,
29955,
29929,
29906,
29941,
29953,
29945,
29946,
29953,
29953,
29906,
29945,
29955,
29906,
29946,
29953,
29929,
29906,
29941,
29941,
29906,
29906,
29947,
29896,
29900,
29929,
29896,
29955,
29896,
29946,
29896,
13,
29929,
29896,
29946,
29941,
29900,
29906,
29947,
29947,
29896,
29929,
29955,
29896,
29900,
29941,
29906,
29947,
29947,
29945,
29929,
29955,
29947,
29900,
29953,
29953,
29953,
29929,
29955,
29953,
29900,
29947,
29929,
29906,
29929,
29941,
29947,
29953,
29941,
29947,
29906,
29947,
29945,
29900,
29906,
29945,
29941,
29941,
29941,
29946,
29900,
29941,
13,
29941,
29946,
29946,
29896,
29941,
29900,
29953,
29945,
29945,
29955,
29947,
29900,
29896,
29953,
29896,
29906,
29955,
29947,
29896,
29945,
29929,
29906,
29896,
29947,
29896,
29945,
29900,
29900,
29945,
29945,
29953,
29896,
29947,
29953,
29947,
29947,
29941,
29953,
29946,
29953,
29947,
29946,
29906,
29900,
29900,
29929,
29900,
29946,
29955,
29900,
13,
29906,
29941,
29900,
29945,
29941,
29900,
29947,
29896,
29896,
29955,
29906,
29947,
29896,
29953,
29946,
29941,
29900,
29946,
29947,
29955,
29953,
29906,
29941,
29955,
29929,
29896,
29929,
29953,
29929,
29947,
29946,
29906,
29946,
29947,
29955,
29906,
29945,
29945,
29900,
29941,
29953,
29953,
29941,
29947,
29955,
29947,
29946,
29945,
29947,
29941,
13,
29896,
29896,
29946,
29947,
29955,
29953,
29929,
29953,
29929,
29941,
29906,
29896,
29945,
29946,
29929,
29900,
29906,
29947,
29896,
29900,
29946,
29906,
29946,
29900,
29906,
29900,
29896,
29941,
29947,
29941,
29941,
29945,
29896,
29906,
29946,
29946,
29953,
29906,
29896,
29947,
29896,
29946,
29946,
29896,
29955,
29955,
29941,
29946,
29955,
29900,
13,
29953,
29941,
29955,
29947,
29941,
29906,
29929,
29929,
29946,
29929,
29900,
29953,
29941,
29953,
29906,
29945,
29929,
29953,
29953,
29953,
29946,
29929,
29947,
29945,
29947,
29955,
29953,
29896,
29947,
29906,
29906,
29896,
29906,
29906,
29945,
29906,
29906,
29945,
29945,
29896,
29906,
29946,
29947,
29953,
29955,
29953,
29946,
29945,
29941,
29941,
13,
29953,
29955,
29955,
29906,
29900,
29896,
29947,
29953,
29929,
29955,
29896,
29953,
29929,
29947,
29945,
29946,
29946,
29941,
29896,
29906,
29946,
29896,
29929,
29945,
29955,
29906,
29946,
29900,
29929,
29929,
29896,
29941,
29929,
29945,
29929,
29900,
29900,
29947,
29929,
29945,
29906,
29941,
29896,
29900,
29900,
29945,
29947,
29947,
29906,
29906,
13,
29929,
29945,
29945,
29946,
29947,
29906,
29945,
29945,
29941,
29900,
29900,
29906,
29953,
29941,
29945,
29906,
29900,
29955,
29947,
29896,
29945,
29941,
29906,
29906,
29929,
29953,
29955,
29929,
29953,
29906,
29946,
29929,
29946,
29947,
29896,
29953,
29946,
29896,
29929,
29945,
29941,
29947,
29953,
29947,
29906,
29896,
29947,
29955,
29955,
29946,
13,
29955,
29953,
29900,
29947,
29945,
29941,
29906,
29955,
29896,
29941,
29906,
29906,
29947,
29945,
29955,
29906,
29941,
29896,
29896,
29900,
29946,
29906,
29946,
29947,
29900,
29941,
29946,
29945,
29953,
29896,
29906,
29946,
29947,
29953,
29955,
29953,
29929,
29955,
29900,
29953,
29946,
29945,
29900,
29955,
29929,
29929,
29945,
29906,
29941,
29953,
13,
29941,
29955,
29955,
29955,
29946,
29906,
29946,
29906,
29945,
29941,
29945,
29946,
29896,
29896,
29906,
29929,
29896,
29953,
29947,
29946,
29906,
29955,
29953,
29947,
29953,
29945,
29945,
29941,
29947,
29929,
29906,
29953,
29906,
29900,
29945,
29900,
29906,
29946,
29929,
29896,
29900,
29941,
29906,
29953,
29945,
29955,
29906,
29929,
29953,
29955,
13,
29906,
29941,
29955,
29900,
29896,
29929,
29896,
29941,
29906,
29955,
29945,
29955,
29906,
29945,
29953,
29955,
29945,
29906,
29947,
29945,
29953,
29945,
29941,
29906,
29946,
29947,
29906,
29945,
29947,
29906,
29953,
29945,
29946,
29953,
29941,
29900,
29929,
29906,
29906,
29900,
29955,
29900,
29945,
29947,
29945,
29929,
29953,
29945,
29906,
29906,
13,
29906,
29929,
29955,
29929,
29947,
29947,
29953,
29900,
29906,
29955,
29906,
29906,
29945,
29947,
29941,
29941,
29896,
29929,
29896,
29941,
29896,
29906,
29953,
29941,
29955,
29945,
29896,
29946,
29955,
29941,
29946,
29896,
29929,
29929,
29946,
29947,
29947,
29929,
29945,
29941,
29946,
29955,
29953,
29945,
29955,
29946,
29945,
29945,
29900,
29896,
13,
29896,
29947,
29946,
29929,
29945,
29955,
29900,
29896,
29946,
29945,
29946,
29947,
29955,
29929,
29906,
29947,
29947,
29929,
29947,
29946,
29947,
29945,
29953,
29947,
29906,
29955,
29955,
29906,
29953,
29900,
29955,
29955,
29955,
29896,
29941,
29955,
29906,
29896,
29946,
29900,
29941,
29955,
29929,
29947,
29947,
29955,
29929,
29955,
29896,
29945,
13,
29941,
29947,
29906,
29929,
29947,
29906,
29900,
29941,
29955,
29947,
29941,
29900,
29941,
29896,
29946,
29955,
29941,
29945,
29906,
29955,
29955,
29906,
29896,
29945,
29947,
29900,
29941,
29946,
29947,
29896,
29946,
29946,
29945,
29896,
29941,
29946,
29929,
29896,
29941,
29955,
29941,
29906,
29906,
29953,
29953,
29945,
29896,
29941,
29947,
29896,
13,
29941,
29946,
29947,
29906,
29929,
29945,
29946,
29941,
29947,
29906,
29929,
29896,
29929,
29929,
29929,
29896,
29947,
29896,
29947,
29900,
29906,
29955,
29947,
29929,
29896,
29953,
29945,
29906,
29906,
29946,
29941,
29896,
29900,
29906,
29955,
29941,
29929,
29906,
29906,
29945,
29896,
29896,
29906,
29906,
29947,
29953,
29929,
29945,
29941,
29929,
13,
29946,
29900,
29929,
29945,
29955,
29929,
29945,
29941,
29900,
29953,
29953,
29946,
29900,
29945,
29906,
29941,
29906,
29953,
29941,
29906,
29945,
29941,
29947,
29900,
29946,
29946,
29896,
29900,
29900,
29900,
29945,
29929,
29953,
29945,
29946,
29929,
29941,
29929,
29896,
29945,
29929,
29947,
29955,
29929,
29945,
29929,
29941,
29953,
29941,
29945,
13,
29906,
29929,
29955,
29946,
29953,
29896,
29945,
29906,
29896,
29947,
29945,
29945,
29900,
29906,
29941,
29955,
29896,
29941,
29900,
29955,
29953,
29946,
29906,
29906,
29945,
29945,
29896,
29906,
29896,
29896,
29947,
29941,
29953,
29929,
29941,
29947,
29900,
29941,
29945,
29947,
29900,
29941,
29947,
29947,
29945,
29947,
29946,
29929,
29900,
29941,
13,
29946,
29896,
29953,
29929,
29947,
29896,
29896,
29953,
29906,
29906,
29906,
29900,
29955,
29906,
29929,
29955,
29955,
29896,
29947,
29953,
29896,
29945,
29947,
29906,
29941,
29953,
29953,
29955,
29947,
29946,
29906,
29946,
29953,
29947,
29929,
29896,
29945,
29955,
29929,
29929,
29941,
29945,
29941,
29906,
29929,
29953,
29896,
29929,
29906,
29906,
13,
29953,
29906,
29946,
29953,
29955,
29929,
29945,
29955,
29896,
29929,
29946,
29946,
29900,
29896,
29906,
29953,
29929,
29900,
29946,
29941,
29947,
29955,
29955,
29896,
29900,
29955,
29906,
29955,
29945,
29900,
29946,
29947,
29896,
29900,
29906,
29941,
29929,
29900,
29947,
29929,
29945,
29945,
29906,
29941,
29945,
29929,
29955,
29946,
29945,
29955,
13,
29906,
29941,
29896,
29947,
29929,
29955,
29900,
29953,
29955,
29955,
29906,
29945,
29946,
29955,
29929,
29896,
29945,
29900,
29953,
29896,
29945,
29900,
29945,
29945,
29900,
29946,
29929,
29945,
29941,
29929,
29906,
29906,
29929,
29955,
29929,
29945,
29941,
29900,
29929,
29900,
29896,
29896,
29906,
29929,
29929,
29953,
29955,
29945,
29896,
29929,
13,
29947,
29953,
29896,
29947,
29947,
29900,
29947,
29947,
29906,
29906,
29945,
29947,
29955,
29945,
29941,
29896,
29946,
29945,
29906,
29929,
29945,
29947,
29946,
29900,
29929,
29929,
29906,
29945,
29896,
29906,
29900,
29941,
29947,
29906,
29929,
29900,
29900,
29929,
29946,
29900,
29955,
29955,
29955,
29900,
29955,
29955,
29945,
29953,
29955,
29906,
13,
29896,
29896,
29941,
29900,
29953,
29955,
29941,
29929,
29955,
29900,
29947,
29941,
29900,
29946,
29955,
29906,
29946,
29946,
29947,
29941,
29947,
29896,
29953,
29945,
29941,
29941,
29947,
29955,
29941,
29945,
29900,
29906,
29941,
29946,
29900,
29947,
29946,
29945,
29953,
29946,
29955,
29900,
29945,
29947,
29900,
29955,
29955,
29941,
29900,
29947,
13,
29947,
29906,
29929,
29945,
29929,
29896,
29955,
29946,
29955,
29953,
29955,
29896,
29946,
29900,
29941,
29953,
29941,
29896,
29929,
29947,
29900,
29900,
29947,
29896,
29947,
29955,
29896,
29906,
29929,
29900,
29896,
29896,
29947,
29955,
29945,
29946,
29929,
29896,
29941,
29896,
29900,
29945,
29946,
29955,
29896,
29906,
29953,
29945,
29947,
29896,
13,
29929,
29955,
29953,
29906,
29941,
29941,
29941,
29896,
29900,
29946,
29946,
29947,
29896,
29947,
29941,
29947,
29953,
29906,
29953,
29929,
29945,
29896,
29945,
29946,
29945,
29953,
29941,
29941,
29946,
29929,
29906,
29953,
29941,
29953,
29953,
29945,
29955,
29906,
29947,
29929,
29955,
29945,
29953,
29941,
29946,
29900,
29900,
29945,
29900,
29900,
13,
29946,
29906,
29947,
29946,
29953,
29906,
29947,
29900,
29896,
29947,
29941,
29945,
29896,
29955,
29900,
29955,
29900,
29945,
29906,
29955,
29947,
29941,
29896,
29947,
29941,
29929,
29946,
29906,
29945,
29947,
29947,
29906,
29896,
29946,
29945,
29945,
29906,
29896,
29906,
29906,
29955,
29906,
29945,
29896,
29906,
29945,
29900,
29941,
29906,
29955,
13,
29945,
29945,
29896,
29906,
29896,
29953,
29900,
29941,
29945,
29946,
29953,
29929,
29947,
29896,
29906,
29900,
29900,
29945,
29947,
29896,
29955,
29953,
29906,
29896,
29953,
29945,
29906,
29896,
29906,
29947,
29906,
29955,
29953,
29945,
29906,
29955,
29945,
29896,
29953,
29929,
29896,
29906,
29929,
29953,
29947,
29929,
29955,
29955,
29947,
29929,
13,
29941,
29906,
29906,
29941,
29947,
29896,
29929,
29945,
29955,
29941,
29946,
29941,
29906,
29929,
29941,
29941,
29929,
29929,
29946,
29953,
29946,
29941,
29955,
29945,
29900,
29896,
29929,
29900,
29955,
29947,
29941,
29953,
29929,
29946,
29945,
29955,
29953,
29945,
29947,
29947,
29941,
29941,
29945,
29906,
29941,
29929,
29929,
29947,
29947,
29953,
13,
29955,
29945,
29945,
29900,
29953,
29896,
29953,
29946,
29929,
29953,
29945,
29896,
29947,
29946,
29955,
29955,
29945,
29896,
29947,
29900,
29955,
29941,
29947,
29896,
29953,
29947,
29947,
29941,
29955,
29947,
29953,
29896,
29900,
29929,
29896,
29945,
29906,
29955,
29941,
29945,
29955,
29929,
29906,
29929,
29955,
29900,
29896,
29941,
29941,
29955,
13,
29953,
29906,
29896,
29955,
29955,
29947,
29946,
29906,
29955,
29945,
29906,
29896,
29929,
29906,
29953,
29906,
29941,
29946,
29900,
29896,
29929,
29946,
29906,
29941,
29929,
29929,
29953,
29941,
29929,
29896,
29953,
29947,
29900,
29946,
29946,
29929,
29947,
29941,
29929,
29929,
29941,
29896,
29955,
29941,
29941,
29896,
29906,
29955,
29941,
29896,
13,
29941,
29906,
29929,
29906,
29946,
29896,
29947,
29945,
29955,
29900,
29955,
29896,
29946,
29955,
29941,
29946,
29929,
29945,
29953,
29953,
29929,
29896,
29953,
29953,
29955,
29946,
29953,
29947,
29955,
29953,
29941,
29946,
29953,
29953,
29900,
29929,
29896,
29945,
29900,
29941,
29945,
29929,
29896,
29946,
29953,
29955,
29955,
29945,
29900,
29946,
13,
29929,
29929,
29945,
29896,
29947,
29953,
29955,
29896,
29946,
29941,
29900,
29906,
29941,
29945,
29906,
29896,
29929,
29953,
29906,
29947,
29947,
29929,
29946,
29947,
29929,
29900,
29896,
29900,
29906,
29946,
29906,
29941,
29941,
29906,
29945,
29896,
29896,
29953,
29929,
29896,
29941,
29953,
29896,
29929,
29953,
29906,
29953,
29953,
29906,
29906,
13,
29955,
29941,
29906,
29953,
29955,
29946,
29953,
29900,
29947,
29900,
29900,
29945,
29929,
29896,
29945,
29946,
29955,
29946,
29955,
29896,
29947,
29941,
29900,
29955,
29929,
29947,
29941,
29929,
29906,
29947,
29953,
29947,
29945,
29941,
29945,
29906,
29900,
29953,
29929,
29946,
29953,
29929,
29946,
29946,
29945,
29946,
29900,
29955,
29906,
29946,
13,
29955,
29953,
29947,
29946,
29896,
29947,
29906,
29906,
29945,
29906,
29946,
29953,
29955,
29946,
29946,
29896,
29955,
29896,
29953,
29896,
29945,
29896,
29946,
29900,
29941,
29953,
29946,
29906,
29955,
29929,
29947,
29906,
29906,
29955,
29941,
29941,
29946,
29947,
29900,
29945,
29945,
29945,
29945,
29953,
29906,
29896,
29946,
29947,
29896,
29947,
13,
29929,
29955,
29896,
29946,
29906,
29953,
29896,
29955,
29929,
29896,
29900,
29941,
29946,
29906,
29945,
29929,
29947,
29953,
29946,
29955,
29906,
29900,
29946,
29945,
29896,
29953,
29947,
29929,
29941,
29929,
29947,
29929,
29946,
29906,
29906,
29896,
29955,
29929,
29947,
29906,
29953,
29900,
29947,
29947,
29900,
29955,
29953,
29947,
29945,
29906,
13,
29947,
29955,
29955,
29947,
29941,
29953,
29946,
29953,
29896,
29947,
29906,
29955,
29929,
29929,
29941,
29946,
29953,
29941,
29896,
29941,
29955,
29953,
29955,
29955,
29945,
29946,
29941,
29900,
29955,
29947,
29900,
29929,
29941,
29953,
29941,
29941,
29941,
29941,
29900,
29896,
29947,
29929,
29947,
29906,
29953,
29946,
29906,
29900,
29929,
29900,
13,
29896,
29900,
29947,
29946,
29947,
29947,
29900,
29906,
29945,
29906,
29896,
29953,
29955,
29946,
29953,
29955,
29900,
29947,
29947,
29941,
29906,
29896,
29945,
29896,
29906,
29900,
29896,
29947,
29945,
29947,
29947,
29941,
29945,
29946,
29941,
29906,
29906,
29941,
29947,
29896,
29906,
29947,
29955,
29953,
29929,
29945,
29906,
29955,
29947,
29953,
13,
29955,
29896,
29941,
29906,
29929,
29953,
29896,
29906,
29946,
29955,
29946,
29955,
29947,
29906,
29946,
29953,
29946,
29945,
29941,
29947,
29953,
29941,
29953,
29929,
29929,
29941,
29900,
29900,
29929,
29900,
29946,
29929,
29941,
29896,
29900,
29941,
29953,
29941,
29953,
29896,
29929,
29955,
29953,
29941,
29947,
29955,
29947,
29900,
29941,
29929,
13,
29953,
29906,
29896,
29947,
29946,
29900,
29955,
29941,
29945,
29955,
29906,
29941,
29929,
29929,
29955,
29929,
29946,
29906,
29906,
29941,
29946,
29900,
29953,
29906,
29941,
29945,
29941,
29929,
29941,
29947,
29900,
29947,
29941,
29941,
29929,
29953,
29945,
29896,
29941,
29906,
29955,
29946,
29900,
29947,
29900,
29896,
29896,
29896,
29896,
29953,
13,
29953,
29953,
29953,
29906,
29955,
29947,
29929,
29896,
29929,
29947,
29896,
29946,
29947,
29947,
29900,
29947,
29955,
29955,
29929,
29955,
29929,
29946,
29896,
29947,
29955,
29953,
29947,
29955,
29953,
29896,
29946,
29946,
29906,
29941,
29900,
29900,
29941,
29900,
29929,
29947,
29946,
29946,
29929,
29900,
29947,
29945,
29896,
29946,
29896,
29896,
13,
29953,
29900,
29953,
29953,
29896,
29947,
29906,
29953,
29906,
29929,
29941,
29953,
29947,
29906,
29947,
29941,
29953,
29955,
29953,
29946,
29955,
29946,
29946,
29955,
29955,
29929,
29906,
29941,
29929,
29896,
29947,
29900,
29941,
29941,
29945,
29896,
29896,
29900,
29929,
29947,
29929,
29900,
29953,
29929,
29955,
29929,
29900,
29955,
29896,
29946,
13,
29947,
29945,
29955,
29947,
29953,
29929,
29946,
29946,
29900,
29947,
29929,
29945,
29945,
29906,
29929,
29929,
29900,
29953,
29945,
29941,
29953,
29946,
29900,
29946,
29946,
29955,
29946,
29906,
29945,
29945,
29955,
29953,
29900,
29947,
29941,
29953,
29945,
29929,
29929,
29955,
29953,
29953,
29946,
29945,
29955,
29929,
29945,
29900,
29929,
29953,
13,
29953,
29953,
29900,
29906,
29946,
29941,
29929,
29953,
29946,
29900,
29929,
29929,
29900,
29945,
29941,
29947,
29929,
29953,
29900,
29955,
29896,
29906,
29900,
29896,
29929,
29947,
29906,
29896,
29929,
29929,
29955,
29953,
29900,
29946,
29955,
29945,
29929,
29929,
29946,
29929,
29900,
29896,
29929,
29955,
29906,
29941,
29900,
29906,
29929,
29955,
13,
29953,
29946,
29929,
29896,
29941,
29929,
29947,
29906,
29953,
29947,
29900,
29900,
29941,
29906,
29929,
29955,
29941,
29896,
29945,
29953,
29900,
29941,
29955,
29896,
29906,
29900,
29900,
29946,
29896,
29941,
29955,
29955,
29929,
29900,
29941,
29955,
29947,
29945,
29945,
29953,
29953,
29900,
29947,
29945,
29900,
29947,
29929,
29906,
29945,
29906,
13,
29896,
29953,
29955,
29941,
29900,
29929,
29941,
29929,
29941,
29896,
29929,
29947,
29955,
29906,
29955,
29945,
29900,
29906,
29955,
29945,
29946,
29953,
29947,
29929,
29900,
29953,
29929,
29900,
29941,
29955,
29900,
29955,
29945,
29941,
29929,
29946,
29896,
29941,
29900,
29946,
29906,
29953,
29945,
29906,
29941,
29896,
29945,
29900,
29896,
29896,
13,
29929,
29946,
29947,
29900,
29929,
29941,
29955,
29955,
29906,
29946,
29945,
29900,
29946,
29947,
29955,
29929,
29945,
29896,
29945,
29900,
29929,
29945,
29946,
29896,
29900,
29900,
29929,
29906,
29896,
29953,
29946,
29945,
29947,
29953,
29941,
29955,
29945,
29946,
29955,
29896,
29900,
29945,
29929,
29947,
29946,
29941,
29953,
29955,
29929,
29896,
13,
29955,
29947,
29953,
29941,
29929,
29896,
29953,
29955,
29900,
29906,
29896,
29896,
29947,
29955,
29946,
29929,
29906,
29946,
29941,
29896,
29929,
29929,
29945,
29955,
29900,
29900,
29953,
29946,
29896,
29929,
29896,
29955,
29929,
29953,
29929,
29955,
29955,
29955,
29945,
29929,
29929,
29900,
29906,
29947,
29941,
29900,
29900,
29953,
29929,
29929,
13,
29896,
29945,
29941,
29953,
29947,
29955,
29896,
29941,
29955,
29896,
29896,
29929,
29941,
29953,
29953,
29896,
29946,
29929,
29945,
29906,
29947,
29896,
29896,
29941,
29900,
29945,
29947,
29955,
29953,
29941,
29947,
29900,
29906,
29955,
29947,
29946,
29896,
29900,
29955,
29945,
29946,
29946,
29946,
29929,
29955,
29941,
29941,
29900,
29955,
29947,
13,
29946,
29900,
29955,
29947,
29929,
29929,
29906,
29941,
29896,
29896,
29945,
29945,
29941,
29945,
29945,
29953,
29906,
29945,
29953,
29896,
29896,
29946,
29906,
29941,
29906,
29906,
29946,
29906,
29941,
29906,
29945,
29945,
29900,
29941,
29941,
29953,
29947,
29945,
29946,
29946,
29906,
29946,
29947,
29947,
29929,
29896,
29955,
29941,
29945,
29941,
13,
29946,
29946,
29947,
29947,
29929,
29929,
29896,
29896,
29945,
29900,
29896,
29946,
29946,
29900,
29953,
29946,
29947,
29900,
29906,
29900,
29941,
29953,
29929,
29900,
29953,
29947,
29900,
29953,
29941,
29929,
29953,
29900,
29953,
29955,
29906,
29941,
29906,
29906,
29896,
29929,
29941,
29906,
29900,
29946,
29896,
29946,
29929,
29945,
29941,
29945,
13,
29946,
29896,
29945,
29900,
29941,
29896,
29906,
29947,
29947,
29947,
29900,
29941,
29941,
29929,
29945,
29941,
29953,
29900,
29945,
29941,
29906,
29929,
29929,
29941,
29946,
29900,
29941,
29953,
29947,
29900,
29900,
29953,
29929,
29955,
29955,
29955,
29896,
29900,
29953,
29945,
29900,
29945,
29953,
29953,
29953,
29941,
29896,
29929,
29945,
29946,
13,
29947,
29896,
29906,
29941,
29946,
29947,
29947,
29900,
29953,
29955,
29941,
29906,
29896,
29900,
29896,
29946,
29953,
29955,
29941,
29929,
29900,
29945,
29947,
29945,
29953,
29947,
29945,
29945,
29955,
29929,
29941,
29946,
29945,
29947,
29896,
29946,
29900,
29941,
29953,
29906,
29955,
29947,
29906,
29906,
29955,
29900,
29941,
29906,
29947,
29900,
13,
29947,
29906,
29953,
29896,
29953,
29945,
29955,
29900,
29955,
29955,
29941,
29929,
29946,
29947,
29941,
29906,
29955,
29945,
29929,
29906,
29906,
29941,
29906,
29947,
29946,
29945,
29929,
29946,
29896,
29955,
29900,
29953,
29945,
29906,
29945,
29900,
29929,
29946,
29945,
29896,
29906,
29941,
29906,
29945,
29906,
29941,
29900,
29953,
29900,
29947,
13,
29906,
29906,
29929,
29896,
29947,
29947,
29900,
29906,
29900,
29945,
29947,
29955,
29955,
29955,
29941,
29896,
29929,
29955,
29896,
29929,
29947,
29941,
29929,
29946,
29945,
29900,
29896,
29947,
29900,
29947,
29947,
29947,
29900,
29955,
29906,
29946,
29906,
29929,
29953,
29953,
29896,
29929,
29947,
29900,
29947,
29896,
29896,
29896,
29929,
29955,
13,
29955,
29955,
29896,
29945,
29947,
29945,
29946,
29906,
29945,
29900,
29906,
29900,
29896,
29953,
29945,
29946,
29945,
29900,
29929,
29900,
29946,
29896,
29941,
29906,
29946,
29945,
29947,
29900,
29929,
29955,
29947,
29953,
29947,
29947,
29906,
29955,
29955,
29947,
29929,
29946,
29947,
29955,
29906,
29896,
29947,
29945,
29929,
29953,
29896,
29955,
13,
29955,
29906,
29896,
29900,
29955,
29947,
29941,
29947,
29946,
29941,
29945,
29900,
29953,
29929,
29896,
29947,
29953,
29896,
29945,
29945,
29946,
29941,
29945,
29953,
29953,
29906,
29947,
29947,
29946,
29900,
29953,
29906,
29906,
29945,
29955,
29946,
29955,
29941,
29953,
29929,
29906,
29906,
29947,
29946,
29945,
29900,
29929,
29945,
29896,
29953,
13,
29906,
29900,
29947,
29946,
29929,
29953,
29900,
29941,
29929,
29947,
29900,
29896,
29941,
29946,
29900,
29900,
29896,
29955,
29906,
29941,
29929,
29941,
29900,
29953,
29955,
29896,
29953,
29953,
29953,
29947,
29906,
29941,
29945,
29945,
29945,
29906,
29946,
29945,
29906,
29945,
29906,
29947,
29900,
29946,
29953,
29900,
29929,
29955,
29906,
29906,
13,
29945,
29941,
29945,
29900,
29941,
29945,
29941,
29946,
29906,
29906,
29953,
29946,
29955,
29906,
29945,
29906,
29946,
29906,
29945,
29900,
29947,
29955,
29946,
29900,
29945,
29946,
29900,
29955,
29945,
29945,
29929,
29896,
29955,
29947,
29929,
29955,
29947,
29896,
29906,
29953,
29946,
29941,
29941,
29900,
29941,
29941,
29896,
29953,
29929,
29900,
15945,
1642,
5451,
9012,
580,
13,
13,
22550,
29898,
13,
1678,
851,
29898,
2083,
4197,
524,
29898,
1220,
29897,
363,
1196,
297,
3694,
29918,
1761,
12622,
29961,
29900,
29901,
29896,
29900,
29962,
13,
29897,
13,
13,
15945,
29908,
13,
2683,
2683,
2683,
13,
259,
8010,
29923,
8584,
29889,
26604,
29889,
29900,
29896,
29941,
29889,
2272,
13,
259,
450,
673,
338,
29901,
29871,
29945,
29945,
29941,
29955,
29941,
29955,
29953,
29906,
29941,
29900,
13,
259,
5974,
1260,
4692,
287,
29901,
29871,
29900,
29889,
29900,
29900,
29945,
29929,
29947,
29946,
29955,
29947,
29941,
29896,
29955,
29906,
29953,
29900,
29955,
29946,
29906,
29906,
3471,
13,
2683,
2683,
2683,
13,
15945,
29908,
13,
2
] |
test/functional/test_framework/tachacoin.py | tachacoin/tachacoin | 0 | 129607 | from .address import *
from .script import *
from .mininode import *
from .util import *
from .tachacoinconfig import *
from .blocktools import *
from .key import *
from .segwit_addr import *
import io
def make_transaction(node, vin, vout):
tx = CTransaction()
tx.vin = vin
tx.vout = vout
tx.rehash()
unsigned_raw_tx = bytes_to_hex_str(tx.serialize_without_witness())
signed_raw_tx = node.signrawtransactionwithwallet(unsigned_raw_tx)['hex']
return signed_raw_tx
def make_vin(node, value):
addr = node.getnewaddress()
txid_hex = node.sendtoaddress(addr, value/COIN)
txid = int(txid_hex, 16)
node.generate(1)
raw_tx = node.decoderawtransaction(node.gettransaction(txid_hex)['hex'])
for vout_index, txout in enumerate(raw_tx['vout']):
if txout['scriptPubKey']['addresses'] == [addr]:
break
else:
assert False
return CTxIn(COutPoint(txid, vout_index), nSequence=0)
def make_op_create_output(node, value, version, gas_limit, gas_price, data):
scriptPubKey = CScript()
scriptPubKey += version
scriptPubKey += gas_limit
scriptPubKey += gas_price
scriptPubKey += data
scriptPubKey += OP_CREATE
return CTxOut(value, scriptPubKey)
def make_op_call_output(value, version, gas_limit, gas_price, data, contract):
scriptPubKey = CScript()
scriptPubKey += version
scriptPubKey += gas_limit
scriptPubKey += gas_price
scriptPubKey += data
scriptPubKey += contract
scriptPubKey += OP_CALL
return CTxOut(value, scriptPubKey)
def convert_btc_address_to_tachacoin(addr, main=False):
version, hsh, checksum = base58_to_byte(addr, 25)
if version == 111:
return keyhash_to_p2pkh(binascii.unhexlify(hsh), main)
if version == 196:
return scripthash_to_p2sh(binascii.unhexlify(hsh), main)
assert(False)
def convert_btc_bech32_address_to_tachacoin(addr, main=False):
hdr, data = bech32_decode(addr)
return bech32_encode('qcrt', data)
def p2pkh_to_hex_hash(address):
return str(base58_to_byte(address, 25)[1])[2:-1]
def hex_hash_to_p2pkh(hex_hash):
return keyhash_to_p2pkh(hex_str_to_bytes(hex_hash))
def assert_vin(tx, expected_vin):
assert_equal(len(tx['vin']), len(expected_vin))
matches = []
for expected in expected_vin:
for i in range(len(tx['vin'])):
if i not in matches and expected[0] == tx['vin'][i]['scriptSig']['asm']:
matches.append(i)
break
assert_equal(len(matches), len(expected_vin))
def assert_vout(tx, expected_vout):
assert_equal(len(tx['vout']), len(expected_vout))
matches = []
for expected in expected_vout:
for i in range(len(tx['vout'])):
if i not in matches and expected[0] == tx['vout'][i]['value'] and expected[1] == tx['vout'][i]['scriptPubKey']['type']:
matches.append(i)
break
assert_equal(len(matches), len(expected_vout))
def rpc_sign_transaction(node, tx):
ret = node.signrawtransactionwithwallet(bytes_to_hex_str(tx.serialize()))
assert(ret['complete'])
tx_signed_raw_hex = ret['hex']
f = io.BytesIO(hex_str_to_bytes(tx_signed_raw_hex))
tx_signed = CTransaction()
tx_signed.deserialize(f)
return tx_signed
def make_vin_from_unspent(node, unspents=None, value=2000000000000, address=None):
if not unspents:
unspents = node.listunspent()
for i in range(len(unspents)):
unspent = unspents[i]
if unspent['amount'] == value/COIN and (not address or address == unspent['address']):
unspents.pop(i)
return CTxIn(COutPoint(int(unspent['txid'], 16), unspent['vout']), nSequence=0)
return None
def read_evm_array(node, address, abi, ignore_nulls=True):
arr = []
index = 0
ret = node.callcontract(address, abi + hex(index)[2:].zfill(64))
while ret['executionResult']['excepted'] == 'None':
if int(ret['executionResult']['output'], 16) != 0 or not ignore_nulls:
arr.append(ret['executionResult']['output'])
index += 1
ret = node.callcontract(address, abi + hex(index)[2:].zfill(64))
return arr
class DGPState:
def __init__(self, node, contract_address):
self.last_state_assert_block_height = 0
self.node = node
self.contract_address = contract_address
self.param_count = 0
self.gov_keys = []
self.admin_keys = []
self.params_for_block = []
self.param_address_at_indices = []
self.required_votes = [0, 0, 0]
self.current_on_vote_statuses = [
[False, False, False],
[False, False, False],
[False, False]
]
self.current_on_vote_address_proposals = [
["0", "0", "0"],
["0", "0"]
]
self.abiAddAddressProposal = "bf5f1e83" #addAddressProposal(address,uint256)
self.abiRemoveAddressProposal = "4cc0e2bc" # removeAddressProposal(address,uint256)
self.abiChangeValueProposal = "19971cbd" # changeValueProposal(uint256,uint256)
self.abiAlreadyVoted = "e9944a81" # alreadyVoted(address,address[])
self.abiGetAddressesList = "850d9758" # getAddressesList(uint256)
self.abiGetArrayNonNullLength = "9b216626" # getArrayNonNullLenght(address[])
self.abiGetCurrentOnVoteAddressProposal = "0c83ebac" # getCurrentOnVoteAddressProposal(uint256,uint256)
self.abiGetCurrentOnVoteStatus = "5f302e8b" # getCurrentOnVoteStatus(uint256,uint256)
self.abiGetCurrentOnVoteValueProposal = "4364725c" # getCurrentOnVoteValueProposal(uint256)
self.abiGetCurrentOnVoteVotes = "f9f51401" # getCurrentOnVoteVotes(uint256,uint256)
self.abiGetParamAddressAtIndex = "15341747" # getParamAddressAtIndex(uint256)
self.abiGetParamCount = "27e35746" # getParamCount()
self.abiGetParamHeightAtIndex = "8a5a9d07" # getParamHeightAtIndex(uint256)
self.abiGetParamsForBlock = "f769ac48" # getParamsForBlock(uint256)
self.abiGetRequiredVotes = "1ec28e0f" # getRequiredVotes(uint256)
self.abiIsAdminKey = "<KEY>" # isAdminKey(address)
self.abiIsGovKey = "<KEY>" # isGovKey(address)
self.abiSetInitialAdmin = "6fb81cbb" # setInitialAdmin()
self.abiTallyAdminVotes = "bec171e5" # tallyAdminVotes(address[])
self.abiTallyGovVotes = "4afb4f11" # tallyGovVotes(address[])
self.abiGovKeys = "30a79873" # govKeys(uint256)
self.abiAdminKeys = "aff125f6" # adminKeys(uint256)
def send_set_initial_admin(self, sender):
self.node.sendtoaddress(sender, 1)
self.node.sendtocontract(self.contract_address, self.abiSetInitialAdmin, 0, 2000000, TACHACOIN_MIN_GAS_PRICE_STR, sender)
def send_add_address_proposal(self, proposal_address, type1, sender):
self.node.sendtoaddress(sender, 1)
self.node.sendtocontract(self.contract_address, self.abiAddAddressProposal + proposal_address.zfill(64) + hex(type1)[2:].zfill(64), 0, 2000000, TACHACOIN_MIN_GAS_PRICE_STR, sender)
def send_remove_address_proposal(self, proposal_address, type1, sender):
self.node.sendtoaddress(sender, 1)
self.node.sendtocontract(self.contract_address, self.abiRemoveAddressProposal + proposal_address.zfill(64) + hex(type1)[2:].zfill(64), 0, 2000000, TACHACOIN_MIN_GAS_PRICE_STR, sender)
def send_change_value_proposal(self, uint_proposal, type1, sender):
self.node.sendtoaddress(sender, 1)
self.node.sendtocontract(self.contract_address, self.abiChangeValueProposal + hex(uint_proposal)[2:].zfill(64) + hex(type1)[2:].zfill(64), 0, 2000000, TACHACOIN_MIN_GAS_PRICE_STR, sender)
def assert_state(self):
# This assertion is only to catch potential errors in the test code (if we forget to add a generate after an evm call)
assert(self.last_state_assert_block_height < self.node.getblockcount())
self.last_state_assert_block_height = self.node.getblockcount()
self._assert_param_count(self.param_count)
self._assert_gov_keys_equal(self.gov_keys)
self._assert_admin_keys_equal(self.admin_keys)
for block_height, param_for_block in self.params_for_block:
self._assert_params_for_block(block_height, param_for_block)
# Make sure that there are no subsequent params for blocks
if self.params_for_block:
ret = self.node.callcontract(self.contract_address, self.abiGetParamsForBlock + hex(0x2fff)[2:].zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), int(param_for_block, 16))
else:
ret = self.node.callcontract(self.contract_address, self.abiGetParamsForBlock + hex(0x2fff)[2:].zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), 0)
for index, param_address_at_index in enumerate(self.param_address_at_indices):
self._assert_param_address_at_index(index, param_address_at_index)
# Make sure that there are no subsequent params at the next index
if self.param_address_at_indices:
ret = self.node.callcontract(self.contract_address, self.abiGetParamAddressAtIndex + hex(index+1)[2:].zfill(64))
assert(ret['executionResult']['excepted'] != 'None')
else:
ret = self.node.callcontract(self.contract_address, self.abiGetParamAddressAtIndex + hex(0x0)[2:].zfill(64))
assert(ret['executionResult']['excepted'] != 'None')
for type1, required_votes in enumerate(self.required_votes):
self._assert_required_votes(type1, required_votes)
for type1, arr1 in enumerate(self.current_on_vote_statuses):
for type2, current_on_vote_status in enumerate(arr1):
self._assert_current_on_vote_status(type1, type2, current_on_vote_status)
for type1, arr1 in enumerate(self.current_on_vote_address_proposals):
for type2, current_on_vote_address_proposal in enumerate(arr1):
self._assert_current_on_vote_address_proposal(type1, type2, current_on_vote_address_proposal)
"""
function getRequiredVotes(uint _type) constant returns (uint val){
// type 0: adminVotesForParams
// type 1: govVotesForParams
// type 2: adminVotesForManagement
if(_type>2) throw; // invalid type
if(_type==0)return activeVotesRequired.adminVotesForParams;
if(_type==1)return activeVotesRequired.govVotesForParams;
if(_type==2)return activeVotesRequired.adminVotesForManagement;
}
"""
def _assert_required_votes(self, type1, expected_required_votes):
ret = self.node.callcontract(self.contract_address, self.abiGetRequiredVotes + str(type1).zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), expected_required_votes)
"""
function getCurrentOnVoteStatus(uint _type, uint _type2) constant returns (bool val){
// type 0: addAddress
// type 1: changeValue
// type 2: removeAddress
// type2 0: adminKey
// type2 1: govKey
// type2 2: paramsAddress
if(_type>2 || _type2>2) throw; // invalid type
if(_type==0)return currentProposals.keys[_type2].onVote;
if(_type==1)return currentProposals.uints[_type2].onVote;
if(_type==2)return currentProposals.removeKeys[_type2].onVote;
}
"""
def _assert_current_on_vote_status(self, type1, type2, expected_current_on_vote_status):
ret = self.node.callcontract(self.contract_address, self.abiGetCurrentOnVoteStatus + str(type1).zfill(64) + str(type2).zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), expected_current_on_vote_status)
"""
function getCurrentOnVoteAddressProposal(uint _type, uint _type2) constant returns (address val){
// type 0: addAddress
// type 1: removeAddress
// type2 0: adminKey
// type2 1: govKey
// type2 2: paramsAddress
if(_type>1 || _type2>2) throw; // invalid type
if(_type==0)return currentProposals.keys[_type2].proposal;
if(_type==1)return currentProposals.removeKeys[_type2].proposal;
}
"""
def _assert_current_on_vote_address_proposal(self, type1, type2, expected_address):
ret = self.node.callcontract(self.contract_address, self.abiGetCurrentOnVoteAddressProposal + hex(type1)[2:].zfill(64) + hex(type2)[2:].zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), int(expected_address, 16))
"""
function getCurrentOnVoteValueProposal(uint _type) constant returns (uint val){
// type 0: adminVotesForParams
// type 1: govVotesForParams
// type 2: adminVotesForManagement
if(_type>2) throw; // invalid type
return currentProposals.uints[_type].proposal;
}
"""
def _assert_current_on_vote_value_proposal(self, type1, expected_proposal):
ret = self.node.callcontract(self.contract_address, self.abiGetCurrentOnVoteValueProposal + hex(type1)[2:].zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), expected_proposal)
"""
function getParamsForBlock(uint _reqBlockHeight) constant returns (address paramsAddress){
uint i;
for(i=paramsHistory.length-1;i>0;i--){
if(paramsHistory[i].blockHeight<=_reqBlockHeight)return paramsHistory[i].paramsAddress;
}
if(paramsHistory[0].blockHeight<=_reqBlockHeight)return paramsHistory[0].paramsAddress;
return 0;
}
"""
def _assert_params_for_block(self, required_block_height, expected_param_address):
ret = self.node.callcontract(self.contract_address, self.abiGetParamsForBlock + hex(required_block_height)[2:].zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), int(expected_param_address, 16))
"""
function getParamAddressAtIndex(uint _paramIndex) constant returns (address paramsAddress){
return paramsHistory[_paramIndex].paramsAddress;
}
"""
def _assert_param_address_at_index(self, param_index, expected_param_address):
ret = self.node.callcontract(self.contract_address, self.abiGetParamAddressAtIndex + hex(param_index)[2:].zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), int(expected_param_address, 16))
"""
function getParamHeightAtIndex(uint _paramIndex) constant returns (uint paramsHeight){
return paramsHistory[_paramIndex].blockHeight;
}
"""
def _assert_param_block_height_at_index(self, param_index, expected_block_height):
ret = self.node.callcontract(self.contract_address, self.abiGetParamHeightAtIndex + hex(param_index)[2:].zfill(64))
assert_equal(int(ret['executionResult']['output'], 16), expected_block_height)
"""
function getParamCount() constant returns (uint paramsCount){
return paramsHistory.length;
}
"""
def _assert_param_count(self, expected_param_count):
ret = self.node.callcontract(self.contract_address, self.abiGetParamCount)
assert_equal(int(ret['executionResult']['output'], 16), expected_param_count)
def _assert_gov_keys_equal(self, expected_gov_keys):
real_gov_keys = read_evm_array(self.node, self.contract_address, self.abiGovKeys)
assert_equal(len(real_gov_keys), len(expected_gov_keys))
for real, expected in zip(real_gov_keys, expected_gov_keys):
assert_equal(int(real, 16), int(expected, 16))
def _assert_admin_keys_equal(self, expected_admin_keys):
real_admin_keys = read_evm_array(self.node, self.contract_address, self.abiAdminKeys)
assert_equal(len(real_admin_keys), len(expected_admin_keys))
for real, expected in zip(real_admin_keys, expected_admin_keys):
assert_equal(int(real, 16), int(expected, 16))
def collect_prevouts(node, amount=None, address=None):
blocks = []
for block_no in range(1, node.getblockcount()+1):
blocks.append(node.getblock(node.getblockhash(block_no)))
staking_prevouts = []
for unspent in node.listunspent():
for block in blocks:
if unspent['txid'] in block['tx']:
tx_block_time = block['time']
break
else:
assert(False)
if unspent['confirmations'] > COINBASE_MATURITY and (not amount or amount == unspent['amount']) and (not address or address == unspent['address']):
staking_prevouts.append((COutPoint(int(unspent['txid'], 16), unspent['vout']), int(unspent['amount']*COIN), tx_block_time))
return staking_prevouts
def create_unsigned_pos_block(node, staking_prevouts, nTime=None):
tip = node.getblock(node.getbestblockhash())
if not nTime:
current_time = int(time.time()) + 16
nTime = current_time & 0xfffffff0
parent_block_stake_modifier = int(tip['modifier'], 16)
coinbase = create_coinbase(tip['height']+1)
coinbase.vout[0].nValue = 0
coinbase.vout[0].scriptPubKey = b""
coinbase.rehash()
block = create_block(int(tip['hash'], 16), coinbase, nTime)
block.hashStateRoot = int(tip['hashStateRoot'], 16)
block.hashUTXORoot = int(tip['hashUTXORoot'], 16)
if not block.solve_stake(parent_block_stake_modifier, staking_prevouts):
return None
txout = node.gettxout(hex(block.prevoutStake.hash)[2:].zfill(64), block.prevoutStake.n)
# input value + block reward
out_value = int((float(str(txout['value'])) + INITIAL_BLOCK_REWARD) * COIN) // 2
# create a new private key used for block signing.
block_sig_key = ECKey()
block_sig_key.set(hash256(struct.pack('<I', 0)), False)
pubkey = block_sig_key.get_pubkey().get_bytes()
scriptPubKey = CScript([pubkey, OP_CHECKSIG])
stake_tx_unsigned = CTransaction()
stake_tx_unsigned.vin.append(CTxIn(block.prevoutStake))
stake_tx_unsigned.vout.append(CTxOut())
# Split the output value into two separate txs
stake_tx_unsigned.vout.append(CTxOut(int(out_value), scriptPubKey))
stake_tx_unsigned.vout.append(CTxOut(int(out_value), scriptPubKey))
stake_tx_signed_raw_hex = node.signrawtransactionwithwallet(bytes_to_hex_str(stake_tx_unsigned.serialize()))['hex']
f = io.BytesIO(hex_str_to_bytes(stake_tx_signed_raw_hex))
stake_tx_signed = CTransaction()
stake_tx_signed.deserialize(f)
block.vtx.append(stake_tx_signed)
block.hashMerkleRoot = block.calc_merkle_root()
return (block, block_sig_key)
def create_unsigned_mpos_block(node, staking_prevouts, nTime=None, block_fees=0):
mpos_block, block_sig_key = create_unsigned_pos_block(node, staking_prevouts, nTime)
tip = node.getblock(node.getbestblockhash())
# The block reward is constant for regtest
stake_per_participant = int(INITIAL_BLOCK_REWARD*COIN+block_fees) // MPOS_PARTICIPANTS
for i in range(MPOS_PARTICIPANTS-1):
partipant_block = node.getblock(node.getblockhash(tip['height']-500-i))
participant_tx = node.decoderawtransaction(node.gettransaction(partipant_block['tx'][1])['hex'])
participant_pubkey = hex_str_to_bytes(participant_tx['vout'][1]['scriptPubKey']['asm'].split(' ')[0])
mpos_block.vtx[1].vout.append(CTxOut(stake_per_participant, CScript([OP_DUP, OP_HASH160, hash160(participant_pubkey), OP_EQUALVERIFY, OP_CHECKSIG])))
# the input value
txout = node.gettxout(hex(mpos_block.prevoutStake.hash)[2:], mpos_block.prevoutStake.n)
# Reward per output
main_staker_reward = (int(float(str(txout['value']))*COIN) + stake_per_participant)
mpos_block.vtx[1].vout[1].nValue = main_staker_reward // 2
mpos_block.vtx[1].vout[2].nValue = main_staker_reward // 2
stake_tx_signed_raw_hex = node.signrawtransactionwithwallet(bytes_to_hex_str(mpos_block.vtx[1].serialize()))['hex']
f = io.BytesIO(hex_str_to_bytes(stake_tx_signed_raw_hex))
stake_tx_signed = CTransaction()
stake_tx_signed.deserialize(f)
mpos_block.vtx[1] = stake_tx_signed
mpos_block.hashMerkleRoot = mpos_block.calc_merkle_root()
return mpos_block, block_sig_key
# Generates 4490 - blockheight PoW blocks + 510 PoS blocks,
# i.e. block height afterwards will be 5000 and we will have valid MPoS participants.
def activate_mpos(node, use_cache=True):
if not node.getblockcount():
node.setmocktime(int(time.time()) - 1000000)
node.generatetoaddress(4490-node.getblockcount(), "qSrM9K6FMhZ29Vkp8Rdk8Jp66bbfpjFETq")
staking_prevouts = collect_prevouts(node, address="qSrM9K6FMhZ29Vkp8Rdk8Jp66bbfpjFETq")
for i in range(510):
time.sleep(0.05)
nTime = (node.getblock(node.getbestblockhash())['time']+45) & 0xfffffff0
node.setmocktime(nTime)
block, block_sig_key = create_unsigned_pos_block(node, staking_prevouts, nTime=nTime)
block.sign_block(block_sig_key)
block.rehash()
block_count = node.getblockcount()
assert_equal(node.submitblock(bytes_to_hex_str(block.serialize())), None)
assert_equal(node.getblockcount(), block_count+1)
# Remove the staking prevout so we don't accidently reuse it
for j in range(len(staking_prevouts)):
prevout = staking_prevouts[j]
if prevout[0].serialize() == block.prevoutStake.serialize():
staking_prevouts.pop(j)
break
| [
1,
515,
869,
7328,
1053,
334,
13,
3166,
869,
2154,
1053,
334,
13,
3166,
869,
1195,
262,
356,
1053,
334,
13,
3166,
869,
4422,
1053,
334,
13,
3166,
869,
29873,
496,
11216,
262,
2917,
1053,
334,
13,
3166,
869,
1271,
8504,
1053,
334,
13,
3166,
869,
1989,
1053,
334,
13,
3166,
869,
10199,
29893,
277,
29918,
10030,
1053,
334,
13,
5215,
12013,
13,
13,
1753,
1207,
29918,
20736,
29898,
3177,
29892,
13848,
29892,
325,
449,
1125,
13,
1678,
25568,
353,
315,
12460,
580,
13,
1678,
25568,
29889,
3845,
353,
13848,
13,
1678,
25568,
29889,
29894,
449,
353,
325,
449,
13,
1678,
25568,
29889,
276,
8568,
580,
13,
268,
13,
1678,
12780,
29918,
1610,
29918,
7508,
353,
6262,
29918,
517,
29918,
20970,
29918,
710,
29898,
7508,
29889,
643,
6646,
29918,
14037,
29918,
29893,
277,
2264,
3101,
13,
1678,
8794,
29918,
1610,
29918,
7508,
353,
2943,
29889,
4530,
1610,
20736,
2541,
14625,
1026,
29898,
15395,
29918,
1610,
29918,
7508,
29897,
1839,
20970,
2033,
13,
1678,
736,
8794,
29918,
1610,
29918,
7508,
13,
13,
1753,
1207,
29918,
3845,
29898,
3177,
29892,
995,
1125,
13,
1678,
28915,
353,
2943,
29889,
657,
1482,
7328,
580,
13,
1678,
25568,
333,
29918,
20970,
353,
2943,
29889,
6717,
517,
7328,
29898,
10030,
29892,
995,
29914,
3217,
1177,
29897,
13,
1678,
25568,
333,
353,
938,
29898,
7508,
333,
29918,
20970,
29892,
29871,
29896,
29953,
29897,
13,
1678,
2943,
29889,
17158,
29898,
29896,
29897,
13,
1678,
10650,
29918,
7508,
353,
2943,
29889,
7099,
6119,
1450,
20736,
29898,
3177,
29889,
657,
20736,
29898,
7508,
333,
29918,
20970,
29897,
1839,
20970,
11287,
13,
13,
1678,
363,
325,
449,
29918,
2248,
29892,
25568,
449,
297,
26985,
29898,
1610,
29918,
7508,
1839,
29894,
449,
2033,
1125,
13,
4706,
565,
25568,
449,
1839,
2154,
21076,
2558,
16215,
7328,
267,
2033,
1275,
518,
10030,
5387,
13,
9651,
2867,
13,
1678,
1683,
29901,
13,
4706,
4974,
7700,
13,
13,
1678,
736,
26637,
29916,
797,
29898,
3217,
329,
5228,
29898,
7508,
333,
29892,
325,
449,
29918,
2248,
511,
302,
20529,
29922,
29900,
29897,
13,
13,
1753,
1207,
29918,
459,
29918,
3258,
29918,
4905,
29898,
3177,
29892,
995,
29892,
1873,
29892,
10489,
29918,
13400,
29892,
10489,
29918,
9175,
29892,
848,
1125,
13,
1678,
2471,
21076,
2558,
353,
315,
4081,
580,
13,
1678,
2471,
21076,
2558,
4619,
1873,
13,
1678,
2471,
21076,
2558,
4619,
10489,
29918,
13400,
13,
1678,
2471,
21076,
2558,
4619,
10489,
29918,
9175,
13,
1678,
2471,
21076,
2558,
4619,
848,
13,
1678,
2471,
21076,
2558,
4619,
6418,
29918,
27045,
13,
1678,
736,
26637,
29916,
3744,
29898,
1767,
29892,
2471,
21076,
2558,
29897,
13,
13,
1753,
1207,
29918,
459,
29918,
4804,
29918,
4905,
29898,
1767,
29892,
1873,
29892,
10489,
29918,
13400,
29892,
10489,
29918,
9175,
29892,
848,
29892,
8078,
1125,
13,
1678,
2471,
21076,
2558,
353,
315,
4081,
580,
13,
1678,
2471,
21076,
2558,
4619,
1873,
13,
1678,
2471,
21076,
2558,
4619,
10489,
29918,
13400,
13,
1678,
2471,
21076,
2558,
4619,
10489,
29918,
9175,
13,
1678,
2471,
21076,
2558,
4619,
848,
13,
1678,
2471,
21076,
2558,
4619,
8078,
13,
1678,
2471,
21076,
2558,
4619,
6418,
29918,
29907,
9818,
13,
1678,
736,
26637,
29916,
3744,
29898,
1767,
29892,
2471,
21076,
2558,
29897,
13,
13,
1753,
3588,
29918,
3116,
29883,
29918,
7328,
29918,
517,
29918,
29873,
496,
11216,
262,
29898,
10030,
29892,
1667,
29922,
8824,
1125,
13,
1678,
1873,
29892,
298,
845,
29892,
1423,
2083,
353,
2967,
29945,
29947,
29918,
517,
29918,
10389,
29898,
10030,
29892,
29871,
29906,
29945,
29897,
13,
1678,
565,
1873,
1275,
29871,
29896,
29896,
29896,
29901,
13,
4706,
736,
1820,
8568,
29918,
517,
29918,
29886,
29906,
29886,
15339,
29898,
2109,
294,
18869,
29889,
348,
354,
15524,
1598,
29898,
29882,
845,
511,
1667,
29897,
13,
13,
1678,
565,
1873,
1275,
29871,
29896,
29929,
29953,
29901,
13,
4706,
736,
27438,
29886,
386,
1161,
29918,
517,
29918,
29886,
29906,
845,
29898,
2109,
294,
18869,
29889,
348,
354,
15524,
1598,
29898,
29882,
845,
511,
1667,
29897,
13,
1678,
4974,
29898,
8824,
29897,
13,
13,
1753,
3588,
29918,
3116,
29883,
29918,
915,
305,
29941,
29906,
29918,
7328,
29918,
517,
29918,
29873,
496,
11216,
262,
29898,
10030,
29892,
1667,
29922,
8824,
1125,
13,
1678,
298,
7707,
29892,
848,
353,
367,
305,
29941,
29906,
29918,
13808,
29898,
10030,
29897,
13,
1678,
736,
367,
305,
29941,
29906,
29918,
12508,
877,
29939,
29883,
2273,
742,
848,
29897,
13,
13,
13,
1753,
282,
29906,
29886,
15339,
29918,
517,
29918,
20970,
29918,
8568,
29898,
7328,
1125,
13,
1678,
736,
851,
29898,
3188,
29945,
29947,
29918,
517,
29918,
10389,
29898,
7328,
29892,
29871,
29906,
29945,
9601,
29896,
2314,
29961,
29906,
13018,
29896,
29962,
13,
13,
1753,
15090,
29918,
8568,
29918,
517,
29918,
29886,
29906,
29886,
15339,
29898,
20970,
29918,
8568,
1125,
13,
1678,
736,
1820,
8568,
29918,
517,
29918,
29886,
29906,
29886,
15339,
29898,
20970,
29918,
710,
29918,
517,
29918,
13193,
29898,
20970,
29918,
8568,
876,
268,
13,
13,
1753,
4974,
29918,
3845,
29898,
7508,
29892,
3806,
29918,
3845,
1125,
13,
1678,
4974,
29918,
11745,
29898,
2435,
29898,
7508,
1839,
3845,
2033,
511,
7431,
29898,
9684,
29918,
3845,
876,
13,
1678,
7087,
353,
5159,
13,
1678,
363,
3806,
297,
3806,
29918,
3845,
29901,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
7508,
1839,
3845,
2033,
22164,
13,
9651,
565,
474,
451,
297,
7087,
322,
3806,
29961,
29900,
29962,
1275,
25568,
1839,
3845,
2033,
29961,
29875,
22322,
2154,
29903,
335,
16215,
11625,
2033,
29901,
13,
18884,
7087,
29889,
4397,
29898,
29875,
29897,
13,
18884,
2867,
13,
1678,
4974,
29918,
11745,
29898,
2435,
29898,
20317,
511,
7431,
29898,
9684,
29918,
3845,
876,
13,
13,
1753,
4974,
29918,
29894,
449,
29898,
7508,
29892,
3806,
29918,
29894,
449,
1125,
13,
1678,
4974,
29918,
11745,
29898,
2435,
29898,
7508,
1839,
29894,
449,
2033,
511,
7431,
29898,
9684,
29918,
29894,
449,
876,
13,
1678,
7087,
353,
5159,
13,
1678,
363,
3806,
297,
3806,
29918,
29894,
449,
29901,
13,
4706,
363,
474,
297,
3464,
29898,
2435,
29898,
7508,
1839,
29894,
449,
2033,
22164,
13,
9651,
565,
474,
451,
297,
7087,
322,
3806,
29961,
29900,
29962,
1275,
25568,
1839,
29894,
449,
2033,
29961,
29875,
22322,
1767,
2033,
322,
3806,
29961,
29896,
29962,
1275,
25568,
1839,
29894,
449,
2033,
29961,
29875,
22322,
2154,
21076,
2558,
16215,
1853,
2033,
29901,
13,
18884,
7087,
29889,
4397,
29898,
29875,
29897,
13,
18884,
2867,
13,
1678,
4974,
29918,
11745,
29898,
2435,
29898,
20317,
511,
7431,
29898,
9684,
29918,
29894,
449,
876,
13,
13,
1753,
364,
6739,
29918,
4530,
29918,
20736,
29898,
3177,
29892,
25568,
1125,
13,
1678,
3240,
353,
2943,
29889,
4530,
1610,
20736,
2541,
14625,
1026,
29898,
13193,
29918,
517,
29918,
20970,
29918,
710,
29898,
7508,
29889,
643,
6646,
22130,
13,
1678,
4974,
29898,
2267,
1839,
8835,
11287,
13,
1678,
25568,
29918,
7433,
29918,
1610,
29918,
20970,
353,
3240,
1839,
20970,
2033,
13,
1678,
285,
353,
12013,
29889,
11207,
5971,
29898,
20970,
29918,
710,
29918,
517,
29918,
13193,
29898,
7508,
29918,
7433,
29918,
1610,
29918,
20970,
876,
13,
1678,
25568,
29918,
7433,
353,
315,
12460,
580,
13,
1678,
25568,
29918,
7433,
29889,
2783,
261,
6646,
29898,
29888,
29897,
13,
1678,
736,
25568,
29918,
7433,
13,
13,
1753,
1207,
29918,
3845,
29918,
3166,
29918,
348,
1028,
296,
29898,
3177,
29892,
443,
1028,
1237,
29922,
8516,
29892,
995,
29922,
29906,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
3211,
29922,
8516,
1125,
13,
1678,
565,
451,
443,
1028,
1237,
29901,
13,
4706,
443,
1028,
1237,
353,
2943,
29889,
1761,
348,
1028,
296,
580,
13,
1678,
363,
474,
297,
3464,
29898,
2435,
29898,
348,
1028,
1237,
22164,
13,
4706,
443,
1028,
296,
353,
443,
1028,
1237,
29961,
29875,
29962,
13,
4706,
565,
443,
1028,
296,
1839,
14506,
2033,
1275,
995,
29914,
3217,
1177,
322,
313,
1333,
3211,
470,
3211,
1275,
443,
1028,
296,
1839,
7328,
2033,
1125,
13,
9651,
443,
1028,
1237,
29889,
7323,
29898,
29875,
29897,
13,
9651,
736,
26637,
29916,
797,
29898,
3217,
329,
5228,
29898,
524,
29898,
348,
1028,
296,
1839,
7508,
333,
7464,
29871,
29896,
29953,
511,
443,
1028,
296,
1839,
29894,
449,
2033,
511,
302,
20529,
29922,
29900,
29897,
13,
1678,
736,
6213,
13,
13,
1753,
1303,
29918,
5750,
29885,
29918,
2378,
29898,
3177,
29892,
3211,
29892,
633,
29875,
29892,
11455,
29918,
4304,
29879,
29922,
5574,
1125,
13,
1678,
3948,
353,
5159,
13,
1678,
2380,
353,
29871,
29900,
13,
1678,
3240,
353,
2943,
29889,
4804,
1285,
1461,
29898,
7328,
29892,
633,
29875,
718,
15090,
29898,
2248,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
1678,
1550,
3240,
1839,
22256,
3591,
16215,
19499,
287,
2033,
1275,
525,
8516,
2396,
13,
4706,
565,
938,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
29897,
2804,
29871,
29900,
470,
451,
11455,
29918,
4304,
29879,
29901,
13,
9651,
3948,
29889,
4397,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
11287,
13,
4706,
2380,
4619,
29871,
29896,
13,
4706,
3240,
353,
2943,
29889,
4804,
1285,
1461,
29898,
7328,
29892,
633,
29875,
718,
15090,
29898,
2248,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
1678,
736,
3948,
13,
13,
1990,
360,
19903,
2792,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2943,
29892,
8078,
29918,
7328,
1125,
13,
4706,
1583,
29889,
4230,
29918,
3859,
29918,
9294,
29918,
1271,
29918,
3545,
353,
29871,
29900,
13,
4706,
1583,
29889,
3177,
353,
2943,
13,
4706,
1583,
29889,
1285,
1461,
29918,
7328,
353,
8078,
29918,
7328,
13,
4706,
1583,
29889,
3207,
29918,
2798,
353,
29871,
29900,
13,
4706,
1583,
29889,
13513,
29918,
8149,
353,
5159,
13,
4706,
1583,
29889,
6406,
29918,
8149,
353,
5159,
13,
4706,
1583,
29889,
7529,
29918,
1454,
29918,
1271,
353,
5159,
13,
4706,
1583,
29889,
3207,
29918,
7328,
29918,
271,
29918,
513,
1575,
353,
5159,
13,
4706,
1583,
29889,
12403,
29918,
29894,
4769,
353,
518,
29900,
29892,
29871,
29900,
29892,
29871,
29900,
29962,
13,
4706,
1583,
29889,
3784,
29918,
265,
29918,
15814,
29918,
4882,
267,
353,
518,
13,
9651,
518,
8824,
29892,
7700,
29892,
7700,
1402,
13,
9651,
518,
8824,
29892,
7700,
29892,
7700,
1402,
13,
9651,
518,
8824,
29892,
7700,
29962,
13,
4706,
4514,
13,
4706,
1583,
29889,
3784,
29918,
265,
29918,
15814,
29918,
7328,
29918,
771,
1066,
1338,
353,
518,
13,
9651,
6796,
29900,
613,
376,
29900,
613,
376,
29900,
12436,
13,
9651,
6796,
29900,
613,
376,
29900,
3108,
13,
4706,
4514,
13,
4706,
1583,
29889,
19266,
2528,
7061,
1184,
1066,
284,
353,
376,
1635,
29945,
29888,
29896,
29872,
29947,
29941,
29908,
396,
1202,
7061,
1184,
1066,
284,
29898,
7328,
29892,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
15941,
7061,
1184,
1066,
284,
353,
376,
29946,
617,
29900,
29872,
29906,
12328,
29908,
396,
3349,
7061,
1184,
1066,
284,
29898,
7328,
29892,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
7277,
1917,
1184,
1066,
284,
353,
376,
29896,
29929,
29929,
29955,
29896,
29883,
6448,
29908,
396,
1735,
1917,
1184,
1066,
284,
29898,
13470,
29906,
29945,
29953,
29892,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2499,
2040,
29963,
5715,
353,
376,
29872,
29929,
29929,
29946,
29946,
29874,
29947,
29896,
29908,
396,
2307,
29963,
5715,
29898,
7328,
29892,
7328,
23076,
13,
4706,
1583,
29889,
19266,
2577,
7061,
267,
1293,
353,
376,
29947,
29945,
29900,
29881,
29929,
29955,
29945,
29947,
29908,
396,
679,
7061,
267,
1293,
29898,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
2588,
12283,
7327,
6513,
353,
376,
29929,
29890,
29906,
29896,
29953,
29953,
29906,
29953,
29908,
396,
679,
2588,
12283,
7327,
29931,
996,
400,
29898,
7328,
23076,
13,
4706,
1583,
29889,
19266,
2577,
7583,
2951,
29963,
866,
7061,
1184,
1066,
284,
353,
376,
29900,
29883,
29947,
29941,
774,
562,
29908,
396,
679,
7583,
2951,
29963,
866,
7061,
1184,
1066,
284,
29898,
13470,
29906,
29945,
29953,
29892,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
7583,
2951,
29963,
866,
5709,
353,
376,
29945,
29888,
29941,
29900,
29906,
29872,
29947,
29890,
29908,
396,
679,
7583,
2951,
29963,
866,
5709,
29898,
13470,
29906,
29945,
29953,
29892,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
7583,
2951,
29963,
866,
1917,
1184,
1066,
284,
353,
376,
29946,
29941,
29953,
29946,
29955,
29906,
29945,
29883,
29908,
396,
679,
7583,
2951,
29963,
866,
1917,
1184,
1066,
284,
29898,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
7583,
2951,
29963,
866,
29963,
4769,
353,
376,
29888,
29929,
29888,
29945,
29896,
29946,
29900,
29896,
29908,
396,
679,
7583,
2951,
29963,
866,
29963,
4769,
29898,
13470,
29906,
29945,
29953,
29892,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
4736,
7061,
16686,
353,
376,
29896,
29945,
29941,
29946,
29896,
29955,
29946,
29955,
29908,
396,
679,
4736,
7061,
16686,
29898,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
4736,
3981,
353,
376,
29906,
29955,
29872,
29941,
29945,
29955,
29946,
29953,
29908,
396,
679,
4736,
3981,
580,
13,
4706,
1583,
29889,
19266,
2577,
4736,
7011,
16686,
353,
376,
29947,
29874,
29945,
29874,
29929,
29881,
29900,
29955,
29908,
396,
679,
4736,
7011,
16686,
29898,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
9629,
2831,
7445,
353,
376,
29888,
29955,
29953,
29929,
562,
29946,
29947,
29908,
396,
679,
9629,
2831,
7445,
29898,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
2577,
19347,
29963,
4769,
353,
376,
29896,
687,
29906,
29947,
29872,
29900,
29888,
29908,
396,
679,
19347,
29963,
4769,
29898,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
3624,
12754,
2558,
353,
9872,
10818,
11903,
396,
338,
12754,
2558,
29898,
7328,
29897,
13,
4706,
1583,
29889,
19266,
3624,
29954,
586,
2558,
353,
9872,
10818,
11903,
396,
338,
29954,
586,
2558,
29898,
7328,
29897,
13,
4706,
1583,
29889,
19266,
2697,
15514,
12754,
353,
376,
29953,
14943,
29947,
29896,
29883,
1327,
29908,
396,
731,
15514,
12754,
580,
13,
4706,
1583,
29889,
19266,
29911,
635,
12754,
29963,
4769,
353,
376,
19385,
29896,
29955,
29896,
29872,
29945,
29908,
396,
260,
635,
12754,
29963,
4769,
29898,
7328,
23076,
13,
4706,
1583,
29889,
19266,
29911,
635,
29954,
586,
29963,
4769,
353,
376,
29946,
2142,
29890,
29946,
29888,
29896,
29896,
29908,
396,
260,
635,
29954,
586,
29963,
4769,
29898,
7328,
23076,
13,
4706,
1583,
29889,
19266,
29954,
586,
15506,
353,
376,
29941,
29900,
29874,
29955,
29929,
29947,
29955,
29941,
29908,
396,
330,
586,
15506,
29898,
13470,
29906,
29945,
29953,
29897,
13,
4706,
1583,
29889,
19266,
12754,
15506,
353,
376,
3470,
29896,
29906,
29945,
29888,
29953,
29908,
396,
4113,
15506,
29898,
13470,
29906,
29945,
29953,
29897,
13,
13,
1678,
822,
3638,
29918,
842,
29918,
11228,
29918,
6406,
29898,
1311,
29892,
10004,
1125,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
7328,
29898,
15452,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2697,
15514,
12754,
29892,
29871,
29900,
29892,
29871,
29906,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
323,
2477,
29950,
2477,
6992,
29918,
16173,
29918,
29954,
3289,
29918,
10593,
12107,
29918,
10810,
29892,
10004,
29897,
13,
13,
1678,
822,
3638,
29918,
1202,
29918,
7328,
29918,
771,
1066,
284,
29898,
1311,
29892,
24963,
29918,
7328,
29892,
1134,
29896,
29892,
10004,
1125,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
7328,
29898,
15452,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2528,
7061,
1184,
1066,
284,
718,
24963,
29918,
7328,
29889,
29920,
5589,
29898,
29953,
29946,
29897,
718,
15090,
29898,
1853,
29896,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
511,
29871,
29900,
29892,
29871,
29906,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
323,
2477,
29950,
2477,
6992,
29918,
16173,
29918,
29954,
3289,
29918,
10593,
12107,
29918,
10810,
29892,
10004,
29897,
13,
13,
1678,
822,
3638,
29918,
5992,
29918,
7328,
29918,
771,
1066,
284,
29898,
1311,
29892,
24963,
29918,
7328,
29892,
1134,
29896,
29892,
10004,
1125,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
7328,
29898,
15452,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
15941,
7061,
1184,
1066,
284,
718,
24963,
29918,
7328,
29889,
29920,
5589,
29898,
29953,
29946,
29897,
718,
15090,
29898,
1853,
29896,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
511,
29871,
29900,
29892,
29871,
29906,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
323,
2477,
29950,
2477,
6992,
29918,
16173,
29918,
29954,
3289,
29918,
10593,
12107,
29918,
10810,
29892,
10004,
29897,
13,
13,
1678,
822,
3638,
29918,
3167,
29918,
1767,
29918,
771,
1066,
284,
29898,
1311,
29892,
13122,
29918,
771,
1066,
284,
29892,
1134,
29896,
29892,
10004,
1125,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
7328,
29898,
15452,
29892,
29871,
29896,
29897,
13,
4706,
1583,
29889,
3177,
29889,
6717,
517,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
7277,
1917,
1184,
1066,
284,
718,
15090,
29898,
13470,
29918,
771,
1066,
284,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
29897,
718,
15090,
29898,
1853,
29896,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
511,
29871,
29900,
29892,
29871,
29906,
29900,
29900,
29900,
29900,
29900,
29900,
29892,
323,
2477,
29950,
2477,
6992,
29918,
16173,
29918,
29954,
3289,
29918,
10593,
12107,
29918,
10810,
29892,
10004,
29897,
13,
13,
1678,
822,
4974,
29918,
3859,
29898,
1311,
1125,
13,
4706,
396,
910,
28306,
338,
871,
304,
4380,
7037,
4436,
297,
278,
1243,
775,
313,
361,
591,
9566,
304,
788,
263,
5706,
1156,
385,
3415,
29885,
1246,
29897,
13,
4706,
4974,
29898,
1311,
29889,
4230,
29918,
3859,
29918,
9294,
29918,
1271,
29918,
3545,
529,
1583,
29889,
3177,
29889,
657,
1271,
2798,
3101,
13,
4706,
1583,
29889,
4230,
29918,
3859,
29918,
9294,
29918,
1271,
29918,
3545,
353,
1583,
29889,
3177,
29889,
657,
1271,
2798,
580,
13,
13,
4706,
1583,
3032,
9294,
29918,
3207,
29918,
2798,
29898,
1311,
29889,
3207,
29918,
2798,
29897,
13,
4706,
1583,
3032,
9294,
29918,
13513,
29918,
8149,
29918,
11745,
29898,
1311,
29889,
13513,
29918,
8149,
29897,
13,
4706,
1583,
3032,
9294,
29918,
6406,
29918,
8149,
29918,
11745,
29898,
1311,
29889,
6406,
29918,
8149,
29897,
13,
4706,
363,
2908,
29918,
3545,
29892,
1828,
29918,
1454,
29918,
1271,
297,
1583,
29889,
7529,
29918,
1454,
29918,
1271,
29901,
13,
9651,
1583,
3032,
9294,
29918,
7529,
29918,
1454,
29918,
1271,
29898,
1271,
29918,
3545,
29892,
1828,
29918,
1454,
29918,
1271,
29897,
13,
4706,
396,
8561,
1854,
393,
727,
526,
694,
15352,
8636,
363,
10930,
13,
4706,
565,
1583,
29889,
7529,
29918,
1454,
29918,
1271,
29901,
13,
9651,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
9629,
2831,
7445,
718,
15090,
29898,
29900,
29916,
29906,
18725,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
9651,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
938,
29898,
3207,
29918,
1454,
29918,
1271,
29892,
29871,
29896,
29953,
876,
13,
4706,
1683,
29901,
13,
9651,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
9629,
2831,
7445,
718,
15090,
29898,
29900,
29916,
29906,
18725,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
9651,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
29871,
29900,
29897,
13,
13,
13,
4706,
363,
2380,
29892,
1828,
29918,
7328,
29918,
271,
29918,
2248,
297,
26985,
29898,
1311,
29889,
3207,
29918,
7328,
29918,
271,
29918,
513,
1575,
1125,
13,
9651,
1583,
3032,
9294,
29918,
3207,
29918,
7328,
29918,
271,
29918,
2248,
29898,
2248,
29892,
1828,
29918,
7328,
29918,
271,
29918,
2248,
29897,
13,
4706,
396,
8561,
1854,
393,
727,
526,
694,
15352,
8636,
472,
278,
2446,
2380,
13,
4706,
565,
1583,
29889,
3207,
29918,
7328,
29918,
271,
29918,
513,
1575,
29901,
13,
9651,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
4736,
7061,
16686,
718,
15090,
29898,
2248,
29974,
29896,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
9651,
4974,
29898,
2267,
1839,
22256,
3591,
16215,
19499,
287,
2033,
2804,
525,
8516,
1495,
13,
4706,
1683,
29901,
13,
9651,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
4736,
7061,
16686,
718,
15090,
29898,
29900,
29916,
29900,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
9651,
4974,
29898,
2267,
1839,
22256,
3591,
16215,
19499,
287,
2033,
2804,
525,
8516,
1495,
13,
13,
13,
4706,
363,
1134,
29896,
29892,
3734,
29918,
29894,
4769,
297,
26985,
29898,
1311,
29889,
12403,
29918,
29894,
4769,
1125,
13,
9651,
1583,
3032,
9294,
29918,
12403,
29918,
29894,
4769,
29898,
1853,
29896,
29892,
3734,
29918,
29894,
4769,
29897,
13,
4706,
363,
1134,
29896,
29892,
3948,
29896,
297,
26985,
29898,
1311,
29889,
3784,
29918,
265,
29918,
15814,
29918,
4882,
267,
1125,
13,
9651,
363,
1134,
29906,
29892,
1857,
29918,
265,
29918,
15814,
29918,
4882,
297,
26985,
29898,
2749,
29896,
1125,
13,
18884,
1583,
3032,
9294,
29918,
3784,
29918,
265,
29918,
15814,
29918,
4882,
29898,
1853,
29896,
29892,
1134,
29906,
29892,
1857,
29918,
265,
29918,
15814,
29918,
4882,
29897,
13,
4706,
363,
1134,
29896,
29892,
3948,
29896,
297,
26985,
29898,
1311,
29889,
3784,
29918,
265,
29918,
15814,
29918,
7328,
29918,
771,
1066,
1338,
1125,
13,
9651,
363,
1134,
29906,
29892,
1857,
29918,
265,
29918,
15814,
29918,
7328,
29918,
771,
1066,
284,
297,
26985,
29898,
2749,
29896,
1125,
13,
18884,
1583,
3032,
9294,
29918,
3784,
29918,
265,
29918,
15814,
29918,
7328,
29918,
771,
1066,
284,
29898,
1853,
29896,
29892,
1134,
29906,
29892,
1857,
29918,
265,
29918,
15814,
29918,
7328,
29918,
771,
1066,
284,
29897,
13,
462,
13,
1678,
9995,
13,
1678,
740,
679,
19347,
29963,
4769,
29898,
13470,
903,
1853,
29897,
4868,
3639,
313,
13470,
659,
2597,
13,
4706,
849,
1134,
29871,
29900,
29901,
4113,
29963,
4769,
2831,
9629,
13,
4706,
849,
1134,
29871,
29896,
29901,
330,
586,
29963,
4769,
2831,
9629,
13,
4706,
849,
1134,
29871,
29906,
29901,
4113,
29963,
4769,
2831,
27107,
13,
4706,
565,
7373,
1853,
29958,
29906,
29897,
3183,
29936,
849,
8340,
1134,
13,
4706,
565,
7373,
1853,
1360,
29900,
29897,
2457,
6136,
29963,
4769,
19347,
29889,
6406,
29963,
4769,
2831,
9629,
29936,
13,
4706,
565,
7373,
1853,
1360,
29896,
29897,
2457,
6136,
29963,
4769,
19347,
29889,
13513,
29963,
4769,
2831,
9629,
29936,
13,
4706,
565,
7373,
1853,
1360,
29906,
29897,
2457,
6136,
29963,
4769,
19347,
29889,
6406,
29963,
4769,
2831,
27107,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
12403,
29918,
29894,
4769,
29898,
1311,
29892,
1134,
29896,
29892,
3806,
29918,
12403,
29918,
29894,
4769,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
19347,
29963,
4769,
718,
851,
29898,
1853,
29896,
467,
29920,
5589,
29898,
29953,
29946,
876,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
3806,
29918,
12403,
29918,
29894,
4769,
29897,
13,
13,
1678,
9995,
13,
259,
740,
679,
7583,
2951,
29963,
866,
5709,
29898,
13470,
903,
1853,
29892,
13122,
903,
1853,
29906,
29897,
4868,
3639,
313,
11227,
659,
2597,
13,
4706,
849,
1134,
29871,
29900,
29901,
788,
7061,
13,
4706,
849,
1134,
29871,
29896,
29901,
1735,
1917,
13,
4706,
849,
1134,
29871,
29906,
29901,
3349,
7061,
268,
13,
13,
4706,
849,
1134,
29906,
29871,
29900,
29901,
4113,
2558,
13,
4706,
849,
1134,
29906,
29871,
29896,
29901,
330,
586,
2558,
13,
4706,
849,
1134,
29906,
29871,
29906,
29901,
8636,
7061,
13,
13,
4706,
565,
7373,
1853,
29958,
29906,
3830,
903,
1853,
29906,
29958,
29906,
29897,
3183,
29936,
849,
8340,
1134,
13,
4706,
565,
7373,
1853,
1360,
29900,
29897,
2457,
1857,
1184,
1066,
1338,
29889,
8149,
28513,
1853,
29906,
1822,
265,
29963,
866,
29936,
13,
4706,
565,
7373,
1853,
1360,
29896,
29897,
2457,
1857,
1184,
1066,
1338,
29889,
29884,
9466,
28513,
1853,
29906,
1822,
265,
29963,
866,
29936,
13,
4706,
565,
7373,
1853,
1360,
29906,
29897,
2457,
1857,
1184,
1066,
1338,
29889,
5992,
15506,
28513,
1853,
29906,
1822,
265,
29963,
866,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
3784,
29918,
265,
29918,
15814,
29918,
4882,
29898,
1311,
29892,
1134,
29896,
29892,
1134,
29906,
29892,
3806,
29918,
3784,
29918,
265,
29918,
15814,
29918,
4882,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
7583,
2951,
29963,
866,
5709,
718,
851,
29898,
1853,
29896,
467,
29920,
5589,
29898,
29953,
29946,
29897,
718,
851,
29898,
1853,
29906,
467,
29920,
5589,
29898,
29953,
29946,
876,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
3806,
29918,
3784,
29918,
265,
29918,
15814,
29918,
4882,
29897,
13,
13,
1678,
9995,
13,
1678,
740,
679,
7583,
2951,
29963,
866,
7061,
1184,
1066,
284,
29898,
13470,
903,
1853,
29892,
13122,
903,
1853,
29906,
29897,
4868,
3639,
313,
7328,
659,
2597,
13,
4706,
849,
1134,
29871,
29900,
29901,
788,
7061,
13,
4706,
849,
1134,
29871,
29896,
29901,
3349,
7061,
13,
13,
4706,
849,
1134,
29906,
29871,
29900,
29901,
4113,
2558,
13,
4706,
849,
1134,
29906,
29871,
29896,
29901,
330,
586,
2558,
13,
4706,
849,
1134,
29906,
29871,
29906,
29901,
8636,
7061,
13,
13,
4706,
565,
7373,
1853,
29958,
29896,
3830,
903,
1853,
29906,
29958,
29906,
29897,
3183,
29936,
849,
8340,
1134,
13,
4706,
565,
7373,
1853,
1360,
29900,
29897,
2457,
1857,
1184,
1066,
1338,
29889,
8149,
28513,
1853,
29906,
1822,
771,
1066,
284,
29936,
13,
4706,
565,
7373,
1853,
1360,
29896,
29897,
2457,
1857,
1184,
1066,
1338,
29889,
5992,
15506,
28513,
1853,
29906,
1822,
771,
1066,
284,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
3784,
29918,
265,
29918,
15814,
29918,
7328,
29918,
771,
1066,
284,
29898,
1311,
29892,
1134,
29896,
29892,
1134,
29906,
29892,
3806,
29918,
7328,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
7583,
2951,
29963,
866,
7061,
1184,
1066,
284,
718,
15090,
29898,
1853,
29896,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
29897,
718,
15090,
29898,
1853,
29906,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
938,
29898,
9684,
29918,
7328,
29892,
29871,
29896,
29953,
876,
13,
13,
1678,
9995,
13,
1678,
740,
679,
7583,
2951,
29963,
866,
1917,
1184,
1066,
284,
29898,
13470,
903,
1853,
29897,
4868,
3639,
313,
13470,
659,
2597,
13,
4706,
849,
1134,
29871,
29900,
29901,
4113,
29963,
4769,
2831,
9629,
13,
4706,
849,
1134,
29871,
29896,
29901,
330,
586,
29963,
4769,
2831,
9629,
13,
4706,
849,
1134,
29871,
29906,
29901,
4113,
29963,
4769,
2831,
27107,
13,
13,
4706,
565,
7373,
1853,
29958,
29906,
29897,
3183,
29936,
849,
8340,
1134,
13,
4706,
736,
1857,
1184,
1066,
1338,
29889,
29884,
9466,
28513,
1853,
1822,
771,
1066,
284,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
3784,
29918,
265,
29918,
15814,
29918,
1767,
29918,
771,
1066,
284,
29898,
1311,
29892,
1134,
29896,
29892,
3806,
29918,
771,
1066,
284,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
7583,
2951,
29963,
866,
1917,
1184,
1066,
284,
718,
15090,
29898,
1853,
29896,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
3806,
29918,
771,
1066,
284,
29897,
13,
13,
1678,
9995,
13,
1678,
740,
679,
9629,
2831,
7445,
29898,
13470,
903,
7971,
7445,
7011,
29897,
4868,
3639,
313,
7328,
8636,
7061,
2597,
13,
4706,
13122,
474,
29936,
13,
4706,
363,
29898,
29875,
29922,
7529,
20570,
29889,
2848,
29899,
29896,
29936,
29875,
29958,
29900,
29936,
29875,
489,
2597,
13,
9651,
565,
29898,
7529,
20570,
29961,
29875,
1822,
1271,
7011,
14065,
29918,
7971,
7445,
7011,
29897,
2457,
8636,
20570,
29961,
29875,
1822,
7529,
7061,
29936,
13,
4706,
500,
13,
4706,
565,
29898,
7529,
20570,
29961,
29900,
1822,
1271,
7011,
14065,
29918,
7971,
7445,
7011,
29897,
2457,
8636,
20570,
29961,
29900,
1822,
7529,
7061,
29936,
13,
4706,
736,
29871,
29900,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
7529,
29918,
1454,
29918,
1271,
29898,
1311,
29892,
3734,
29918,
1271,
29918,
3545,
29892,
3806,
29918,
3207,
29918,
7328,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
9629,
2831,
7445,
718,
15090,
29898,
12403,
29918,
1271,
29918,
3545,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
938,
29898,
9684,
29918,
3207,
29918,
7328,
29892,
29871,
29896,
29953,
876,
13,
13,
1678,
9995,
13,
1678,
740,
679,
4736,
7061,
16686,
29898,
13470,
903,
3207,
3220,
29897,
4868,
3639,
313,
7328,
8636,
7061,
2597,
13,
4706,
736,
8636,
20570,
28513,
3207,
3220,
1822,
7529,
7061,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
3207,
29918,
7328,
29918,
271,
29918,
2248,
29898,
1311,
29892,
1828,
29918,
2248,
29892,
3806,
29918,
3207,
29918,
7328,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
4736,
7061,
16686,
718,
15090,
29898,
3207,
29918,
2248,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
938,
29898,
9684,
29918,
3207,
29918,
7328,
29892,
29871,
29896,
29953,
876,
13,
13,
13,
1678,
9995,
13,
1678,
740,
679,
4736,
7011,
16686,
29898,
13470,
903,
3207,
3220,
29897,
4868,
3639,
313,
13470,
8636,
7011,
2597,
13,
4706,
736,
8636,
20570,
28513,
3207,
3220,
1822,
1271,
7011,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
3207,
29918,
1271,
29918,
3545,
29918,
271,
29918,
2248,
29898,
1311,
29892,
1828,
29918,
2248,
29892,
3806,
29918,
1271,
29918,
3545,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
4736,
7011,
16686,
718,
15090,
29898,
3207,
29918,
2248,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
876,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
3806,
29918,
1271,
29918,
3545,
29897,
13,
13,
1678,
9995,
13,
1678,
740,
679,
4736,
3981,
580,
4868,
3639,
313,
13470,
8636,
3981,
2597,
13,
4706,
736,
8636,
20570,
29889,
2848,
29936,
13,
1678,
500,
13,
1678,
9995,
13,
1678,
822,
903,
9294,
29918,
3207,
29918,
2798,
29898,
1311,
29892,
3806,
29918,
3207,
29918,
2798,
1125,
13,
4706,
3240,
353,
1583,
29889,
3177,
29889,
4804,
1285,
1461,
29898,
1311,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
2577,
4736,
3981,
29897,
13,
4706,
4974,
29918,
11745,
29898,
524,
29898,
2267,
1839,
22256,
3591,
16215,
4905,
7464,
29871,
29896,
29953,
511,
3806,
29918,
3207,
29918,
2798,
29897,
13,
13,
1678,
822,
903,
9294,
29918,
13513,
29918,
8149,
29918,
11745,
29898,
1311,
29892,
3806,
29918,
13513,
29918,
8149,
1125,
13,
4706,
1855,
29918,
13513,
29918,
8149,
353,
1303,
29918,
5750,
29885,
29918,
2378,
29898,
1311,
29889,
3177,
29892,
1583,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
29954,
586,
15506,
29897,
13,
4706,
4974,
29918,
11745,
29898,
2435,
29898,
6370,
29918,
13513,
29918,
8149,
511,
7431,
29898,
9684,
29918,
13513,
29918,
8149,
876,
13,
4706,
363,
1855,
29892,
3806,
297,
14319,
29898,
6370,
29918,
13513,
29918,
8149,
29892,
3806,
29918,
13513,
29918,
8149,
1125,
13,
9651,
4974,
29918,
11745,
29898,
524,
29898,
6370,
29892,
29871,
29896,
29953,
511,
938,
29898,
9684,
29892,
29871,
29896,
29953,
876,
13,
13,
1678,
822,
903,
9294,
29918,
6406,
29918,
8149,
29918,
11745,
29898,
1311,
29892,
3806,
29918,
6406,
29918,
8149,
1125,
13,
4706,
1855,
29918,
6406,
29918,
8149,
353,
1303,
29918,
5750,
29885,
29918,
2378,
29898,
1311,
29889,
3177,
29892,
1583,
29889,
1285,
1461,
29918,
7328,
29892,
1583,
29889,
19266,
12754,
15506,
29897,
13,
4706,
4974,
29918,
11745,
29898,
2435,
29898,
6370,
29918,
6406,
29918,
8149,
511,
7431,
29898,
9684,
29918,
6406,
29918,
8149,
876,
13,
4706,
363,
1855,
29892,
3806,
297,
14319,
29898,
6370,
29918,
6406,
29918,
8149,
29892,
3806,
29918,
6406,
29918,
8149,
1125,
13,
9651,
4974,
29918,
11745,
29898,
524,
29898,
6370,
29892,
29871,
29896,
29953,
511,
938,
29898,
9684,
29892,
29871,
29896,
29953,
876,
13,
13,
13,
1753,
6314,
29918,
16304,
17718,
29898,
3177,
29892,
5253,
29922,
8516,
29892,
3211,
29922,
8516,
1125,
13,
1678,
10930,
353,
5159,
13,
1678,
363,
2908,
29918,
1217,
297,
3464,
29898,
29896,
29892,
2943,
29889,
657,
1271,
2798,
580,
29974,
29896,
1125,
13,
4706,
10930,
29889,
4397,
29898,
3177,
29889,
657,
1271,
29898,
3177,
29889,
657,
1271,
8568,
29898,
1271,
29918,
1217,
4961,
13,
13,
13,
1678,
380,
5086,
29918,
16304,
17718,
353,
5159,
13,
1678,
363,
443,
1028,
296,
297,
2943,
29889,
1761,
348,
1028,
296,
7295,
13,
4706,
363,
2908,
297,
10930,
29901,
13,
9651,
565,
443,
1028,
296,
1839,
7508,
333,
2033,
297,
2908,
1839,
7508,
2033,
29901,
13,
18884,
25568,
29918,
1271,
29918,
2230,
353,
2908,
1839,
2230,
2033,
13,
18884,
2867,
13,
4706,
1683,
29901,
13,
9651,
4974,
29898,
8824,
29897,
13,
13,
4706,
565,
443,
1028,
296,
1839,
26897,
800,
2033,
1405,
4810,
1177,
25416,
29918,
29924,
1299,
4574,
11937,
322,
313,
1333,
5253,
470,
5253,
1275,
443,
1028,
296,
1839,
14506,
11287,
322,
313,
1333,
3211,
470,
3211,
1275,
443,
1028,
296,
1839,
7328,
2033,
1125,
13,
9651,
380,
5086,
29918,
16304,
17718,
29889,
4397,
3552,
3217,
329,
5228,
29898,
524,
29898,
348,
1028,
296,
1839,
7508,
333,
7464,
29871,
29896,
29953,
511,
443,
1028,
296,
1839,
29894,
449,
2033,
511,
938,
29898,
348,
1028,
296,
1839,
14506,
2033,
29930,
3217,
1177,
511,
25568,
29918,
1271,
29918,
2230,
876,
13,
1678,
736,
380,
5086,
29918,
16304,
17718,
13,
13,
13,
1753,
1653,
29918,
15395,
29918,
1066,
29918,
1271,
29898,
3177,
29892,
380,
5086,
29918,
16304,
17718,
29892,
302,
2481,
29922,
8516,
1125,
13,
1678,
6872,
353,
2943,
29889,
657,
1271,
29898,
3177,
29889,
657,
13318,
1271,
8568,
3101,
13,
1678,
565,
451,
302,
2481,
29901,
13,
4706,
1857,
29918,
2230,
353,
938,
29898,
2230,
29889,
2230,
3101,
718,
29871,
29896,
29953,
13,
4706,
302,
2481,
353,
1857,
29918,
2230,
669,
29871,
29900,
29916,
17156,
18725,
29900,
13,
13,
1678,
3847,
29918,
1271,
29918,
303,
1296,
29918,
26625,
353,
938,
29898,
12632,
1839,
26625,
7464,
29871,
29896,
29953,
29897,
13,
1678,
19480,
3188,
353,
1653,
29918,
1111,
262,
3188,
29898,
12632,
1839,
3545,
2033,
29974,
29896,
29897,
13,
1678,
19480,
3188,
29889,
29894,
449,
29961,
29900,
1822,
29876,
1917,
353,
29871,
29900,
13,
1678,
19480,
3188,
29889,
29894,
449,
29961,
29900,
1822,
2154,
21076,
2558,
353,
289,
15945,
13,
1678,
19480,
3188,
29889,
276,
8568,
580,
13,
1678,
2908,
353,
1653,
29918,
1271,
29898,
524,
29898,
12632,
1839,
8568,
7464,
29871,
29896,
29953,
511,
19480,
3188,
29892,
302,
2481,
29897,
13,
1678,
2908,
29889,
8568,
2792,
10303,
353,
938,
29898,
12632,
1839,
8568,
2792,
10303,
7464,
29871,
29896,
29953,
29897,
13,
1678,
2908,
29889,
8568,
2692,
29990,
1955,
3155,
353,
938,
29898,
12632,
1839,
8568,
2692,
29990,
1955,
3155,
7464,
29871,
29896,
29953,
29897,
13,
13,
1678,
565,
451,
2908,
29889,
2929,
345,
29918,
303,
1296,
29898,
3560,
29918,
1271,
29918,
303,
1296,
29918,
26625,
29892,
380,
5086,
29918,
16304,
17718,
1125,
13,
4706,
736,
6213,
13,
13,
1678,
25568,
449,
353,
2943,
29889,
657,
7508,
449,
29898,
20970,
29898,
1271,
29889,
16304,
449,
855,
1296,
29889,
8568,
9601,
29906,
29901,
1822,
29920,
5589,
29898,
29953,
29946,
511,
2908,
29889,
16304,
449,
855,
1296,
29889,
29876,
29897,
13,
1678,
396,
1881,
995,
718,
2908,
20751,
13,
1678,
714,
29918,
1767,
353,
938,
3552,
7411,
29898,
710,
29898,
7508,
449,
1839,
1767,
25901,
718,
2672,
1806,
25758,
29918,
29933,
21339,
29918,
1525,
29956,
17011,
29897,
334,
4810,
1177,
29897,
849,
29871,
29906,
13,
13,
1678,
396,
1653,
263,
716,
2024,
1820,
1304,
363,
2908,
26188,
29889,
13,
1678,
2908,
29918,
18816,
29918,
1989,
353,
17522,
2558,
580,
13,
1678,
2908,
29918,
18816,
29918,
1989,
29889,
842,
29898,
8568,
29906,
29945,
29953,
29898,
4984,
29889,
4058,
877,
29966,
29902,
742,
29871,
29900,
8243,
7700,
29897,
13,
1678,
2529,
1989,
353,
2908,
29918,
18816,
29918,
1989,
29889,
657,
29918,
5467,
1989,
2141,
657,
29918,
13193,
580,
13,
1678,
2471,
21076,
2558,
353,
315,
4081,
4197,
5467,
1989,
29892,
6418,
29918,
3210,
16658,
5425,
29954,
2314,
13,
1678,
380,
1296,
29918,
7508,
29918,
15395,
353,
315,
12460,
580,
13,
13,
1678,
380,
1296,
29918,
7508,
29918,
15395,
29889,
3845,
29889,
4397,
29898,
1783,
29916,
797,
29898,
1271,
29889,
16304,
449,
855,
1296,
876,
13,
1678,
380,
1296,
29918,
7508,
29918,
15395,
29889,
29894,
449,
29889,
4397,
29898,
1783,
29916,
3744,
3101,
13,
13,
1678,
396,
26178,
278,
1962,
995,
964,
1023,
5004,
260,
10351,
13,
1678,
380,
1296,
29918,
7508,
29918,
15395,
29889,
29894,
449,
29889,
4397,
29898,
1783,
29916,
3744,
29898,
524,
29898,
449,
29918,
1767,
511,
2471,
21076,
2558,
876,
13,
1678,
380,
1296,
29918,
7508,
29918,
15395,
29889,
29894,
449,
29889,
4397,
29898,
1783,
29916,
3744,
29898,
524,
29898,
449,
29918,
1767,
511,
2471,
21076,
2558,
876,
13,
13,
1678,
380,
1296,
29918,
7508,
29918,
7433,
29918,
1610,
29918,
20970,
353,
2943,
29889,
4530,
1610,
20736,
2541,
14625,
1026,
29898,
13193,
29918,
517,
29918,
20970,
29918,
710,
29898,
303,
1296,
29918,
7508,
29918,
15395,
29889,
643,
6646,
22130,
1839,
20970,
2033,
13,
1678,
285,
353,
12013,
29889,
11207,
5971,
29898,
20970,
29918,
710,
29918,
517,
29918,
13193,
29898,
303,
1296,
29918,
7508,
29918,
7433,
29918,
1610,
29918,
20970,
876,
13,
1678,
380,
1296,
29918,
7508,
29918,
7433,
353,
315,
12460,
580,
13,
1678,
380,
1296,
29918,
7508,
29918,
7433,
29889,
2783,
261,
6646,
29898,
29888,
29897,
13,
1678,
2908,
29889,
29894,
7508,
29889,
4397,
29898,
303,
1296,
29918,
7508,
29918,
7433,
29897,
13,
1678,
2908,
29889,
8568,
29924,
5968,
280,
10303,
353,
2908,
29889,
28667,
29918,
28150,
280,
29918,
4632,
580,
13,
1678,
736,
313,
1271,
29892,
2908,
29918,
18816,
29918,
1989,
29897,
13,
13,
13,
1753,
1653,
29918,
15395,
29918,
29885,
1066,
29918,
1271,
29898,
3177,
29892,
380,
5086,
29918,
16304,
17718,
29892,
302,
2481,
29922,
8516,
29892,
2908,
29918,
1725,
267,
29922,
29900,
1125,
13,
1678,
286,
1066,
29918,
1271,
29892,
2908,
29918,
18816,
29918,
1989,
353,
1653,
29918,
15395,
29918,
1066,
29918,
1271,
29898,
3177,
29892,
380,
5086,
29918,
16304,
17718,
29892,
302,
2481,
29897,
13,
1678,
6872,
353,
2943,
29889,
657,
1271,
29898,
3177,
29889,
657,
13318,
1271,
8568,
3101,
13,
13,
1678,
396,
450,
2908,
20751,
338,
4868,
363,
1072,
1688,
13,
1678,
380,
1296,
29918,
546,
29918,
1595,
12654,
424,
353,
938,
29898,
26019,
25758,
29918,
29933,
21339,
29918,
1525,
29956,
17011,
29930,
3217,
1177,
29974,
1271,
29918,
1725,
267,
29897,
849,
16379,
3267,
29918,
26092,
2965,
5690,
2190,
9375,
13,
13,
1678,
363,
474,
297,
3464,
29898,
3580,
3267,
29918,
26092,
2965,
5690,
2190,
9375,
29899,
29896,
1125,
13,
4706,
760,
666,
424,
29918,
1271,
353,
2943,
29889,
657,
1271,
29898,
3177,
29889,
657,
1271,
8568,
29898,
12632,
1839,
3545,
2033,
29899,
29945,
29900,
29900,
29899,
29875,
876,
13,
4706,
5221,
424,
29918,
7508,
353,
2943,
29889,
7099,
6119,
1450,
20736,
29898,
3177,
29889,
657,
20736,
29898,
1595,
666,
424,
29918,
1271,
1839,
7508,
2033,
29961,
29896,
2314,
1839,
20970,
11287,
13,
4706,
5221,
424,
29918,
5467,
1989,
353,
15090,
29918,
710,
29918,
517,
29918,
13193,
29898,
1595,
12654,
424,
29918,
7508,
1839,
29894,
449,
2033,
29961,
29896,
22322,
2154,
21076,
2558,
16215,
11625,
13359,
5451,
877,
525,
9601,
29900,
2314,
13,
4706,
286,
1066,
29918,
1271,
29889,
29894,
7508,
29961,
29896,
1822,
29894,
449,
29889,
4397,
29898,
1783,
29916,
3744,
29898,
303,
1296,
29918,
546,
29918,
1595,
12654,
424,
29892,
315,
4081,
4197,
4590,
29918,
29928,
4897,
29892,
6418,
29918,
29950,
24943,
29896,
29953,
29900,
29892,
6608,
29896,
29953,
29900,
29898,
1595,
12654,
424,
29918,
5467,
1989,
511,
6418,
29918,
29923,
13356,
1964,
5348,
6545,
29979,
29892,
6418,
29918,
3210,
16658,
5425,
29954,
29962,
4961,
13,
13,
1678,
396,
278,
1881,
995,
13,
1678,
25568,
449,
353,
2943,
29889,
657,
7508,
449,
29898,
20970,
29898,
29885,
1066,
29918,
1271,
29889,
16304,
449,
855,
1296,
29889,
8568,
9601,
29906,
29901,
1402,
286,
1066,
29918,
1271,
29889,
16304,
449,
855,
1296,
29889,
29876,
29897,
13,
13,
1678,
396,
390,
809,
538,
639,
1962,
13,
1678,
1667,
29918,
303,
5790,
29918,
276,
1328,
353,
313,
524,
29898,
7411,
29898,
710,
29898,
7508,
449,
1839,
1767,
25901,
29930,
3217,
1177,
29897,
718,
380,
1296,
29918,
546,
29918,
1595,
12654,
424,
29897,
13,
13,
1678,
286,
1066,
29918,
1271,
29889,
29894,
7508,
29961,
29896,
1822,
29894,
449,
29961,
29896,
1822,
29876,
1917,
353,
1667,
29918,
303,
5790,
29918,
276,
1328,
849,
29871,
29906,
13,
1678,
286,
1066,
29918,
1271,
29889,
29894,
7508,
29961,
29896,
1822,
29894,
449,
29961,
29906,
1822,
29876,
1917,
353,
1667,
29918,
303,
5790,
29918,
276,
1328,
849,
29871,
29906,
13,
13,
1678,
380,
1296,
29918,
7508,
29918,
7433,
29918,
1610,
29918,
20970,
353,
2943,
29889,
4530,
1610,
20736,
2541,
14625,
1026,
29898,
13193,
29918,
517,
29918,
20970,
29918,
710,
29898,
29885,
1066,
29918,
1271,
29889,
29894,
7508,
29961,
29896,
1822,
643,
6646,
22130,
1839,
20970,
2033,
13,
1678,
285,
353,
12013,
29889,
11207,
5971,
29898,
20970,
29918,
710,
29918,
517,
29918,
13193,
29898,
303,
1296,
29918,
7508,
29918,
7433,
29918,
1610,
29918,
20970,
876,
13,
1678,
380,
1296,
29918,
7508,
29918,
7433,
353,
315,
12460,
580,
13,
1678,
380,
1296,
29918,
7508,
29918,
7433,
29889,
2783,
261,
6646,
29898,
29888,
29897,
13,
1678,
286,
1066,
29918,
1271,
29889,
29894,
7508,
29961,
29896,
29962,
353,
380,
1296,
29918,
7508,
29918,
7433,
13,
1678,
286,
1066,
29918,
1271,
29889,
8568,
29924,
5968,
280,
10303,
353,
286,
1066,
29918,
1271,
29889,
28667,
29918,
28150,
280,
29918,
4632,
580,
13,
1678,
736,
286,
1066,
29918,
1271,
29892,
2908,
29918,
18816,
29918,
1989,
13,
13,
29937,
3251,
1078,
29871,
29946,
29946,
29929,
29900,
448,
2908,
3545,
3929,
29956,
10930,
718,
29871,
29945,
29896,
29900,
3929,
29903,
10930,
29892,
13,
29937,
474,
29889,
29872,
29889,
2908,
3171,
12335,
674,
367,
29871,
29945,
29900,
29900,
29900,
322,
591,
674,
505,
2854,
341,
9837,
29903,
27138,
29889,
13,
1753,
5039,
403,
29918,
29885,
1066,
29898,
3177,
29892,
671,
29918,
8173,
29922,
5574,
1125,
13,
1678,
565,
451,
2943,
29889,
657,
1271,
2798,
7295,
13,
4706,
2943,
29889,
842,
17640,
2230,
29898,
524,
29898,
2230,
29889,
2230,
3101,
448,
29871,
29896,
29900,
29900,
29900,
29900,
29900,
29900,
29897,
13,
1678,
2943,
29889,
4738,
271,
10896,
7328,
29898,
29946,
29946,
29929,
29900,
29899,
3177,
29889,
657,
1271,
2798,
3285,
376,
29939,
29903,
29878,
29924,
29929,
29968,
29953,
22192,
29882,
29999,
29906,
29929,
29963,
29895,
29886,
29947,
29934,
8181,
29947,
29967,
29886,
29953,
29953,
1327,
18091,
29926,
29943,
2544,
29939,
1159,
13,
1678,
380,
5086,
29918,
16304,
17718,
353,
6314,
29918,
16304,
17718,
29898,
3177,
29892,
3211,
543,
29939,
29903,
29878,
29924,
29929,
29968,
29953,
22192,
29882,
29999,
29906,
29929,
29963,
29895,
29886,
29947,
29934,
8181,
29947,
29967,
29886,
29953,
29953,
1327,
18091,
29926,
29943,
2544,
29939,
1159,
13,
13,
13,
1678,
363,
474,
297,
3464,
29898,
29945,
29896,
29900,
1125,
13,
4706,
931,
29889,
17059,
29898,
29900,
29889,
29900,
29945,
29897,
13,
4706,
302,
2481,
353,
313,
3177,
29889,
657,
1271,
29898,
3177,
29889,
657,
13318,
1271,
8568,
3101,
1839,
2230,
2033,
29974,
29946,
29945,
29897,
669,
29871,
29900,
29916,
17156,
18725,
29900,
13,
4706,
2943,
29889,
842,
17640,
2230,
29898,
29876,
2481,
29897,
13,
4706,
2908,
29892,
2908,
29918,
18816,
29918,
1989,
353,
1653,
29918,
15395,
29918,
1066,
29918,
1271,
29898,
3177,
29892,
380,
5086,
29918,
16304,
17718,
29892,
302,
2481,
29922,
29876,
2481,
29897,
13,
4706,
2908,
29889,
4530,
29918,
1271,
29898,
1271,
29918,
18816,
29918,
1989,
29897,
13,
4706,
2908,
29889,
276,
8568,
580,
13,
4706,
2908,
29918,
2798,
353,
2943,
29889,
657,
1271,
2798,
580,
13,
4706,
4974,
29918,
11745,
29898,
3177,
29889,
7892,
1271,
29898,
13193,
29918,
517,
29918,
20970,
29918,
710,
29898,
1271,
29889,
643,
6646,
3101,
511,
6213,
29897,
13,
4706,
4974,
29918,
11745,
29898,
3177,
29889,
657,
1271,
2798,
3285,
2908,
29918,
2798,
29974,
29896,
29897,
13,
13,
4706,
396,
15154,
278,
380,
5086,
12379,
449,
577,
591,
1016,
29915,
29873,
11423,
368,
24270,
372,
13,
4706,
363,
432,
297,
3464,
29898,
2435,
29898,
303,
5086,
29918,
16304,
17718,
22164,
13,
9651,
12379,
449,
353,
380,
5086,
29918,
16304,
17718,
29961,
29926,
29962,
13,
9651,
565,
12379,
449,
29961,
29900,
1822,
643,
6646,
580,
1275,
2908,
29889,
16304,
449,
855,
1296,
29889,
643,
6646,
7295,
13,
18884,
380,
5086,
29918,
16304,
17718,
29889,
7323,
29898,
29926,
29897,
13,
18884,
2867,
13,
2
] |
{{cookiecutter.project_slug}}/app/api/helpers/__init__.py | khanh41/fastapi-mongodb-base-project | 3 | 120680 | <reponame>khanh41/fastapi-mongodb-base-project
import ast
import os
import zipfile
import wget
def base_file_download(path_check, url_download):
if not os.path.isfile(path_check):
wget.download(url_download, path_check)
def base_zip_download(path_check, url_download):
if not os.path.isdir(path_check):
os.makedirs(path_check)
if len(os.listdir(path_check)) <= 0:
zip_path = wget.download(url_download, path_check + ".zip")
with zipfile.ZipFile(zip_path, "r") as f:
f.extractall(os.path.dirname(zip_path))
def base_zip_folder_download(path_check, url_download):
if not os.path.isdir(path_check):
zip_path = wget.download(url_download, path_check + ".zip")
with zipfile.ZipFile(zip_path, "r") as f:
f.extractall(os.path.dirname(zip_path))
def convert_string_to_list(coordinates_text: str):
coordinates_text = coordinates_text.replace(" ", "")
try:
return ast.literal_eval(coordinates_text)
except:
raise ValueError("coordinates_text is string of list, example: \"[[1,2,3,4],[1,2,3,4]]\"")
| [
1,
529,
276,
1112,
420,
29958,
29895,
5403,
29882,
29946,
29896,
29914,
11255,
2754,
29899,
23264,
29899,
3188,
29899,
4836,
13,
5215,
8717,
13,
5215,
2897,
13,
5215,
14319,
1445,
13,
13,
5215,
281,
657,
13,
13,
13,
1753,
2967,
29918,
1445,
29918,
10382,
29898,
2084,
29918,
3198,
29892,
3142,
29918,
10382,
1125,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
1445,
29898,
2084,
29918,
3198,
1125,
13,
4706,
281,
657,
29889,
10382,
29898,
2271,
29918,
10382,
29892,
2224,
29918,
3198,
29897,
13,
13,
13,
1753,
2967,
29918,
7554,
29918,
10382,
29898,
2084,
29918,
3198,
29892,
3142,
29918,
10382,
1125,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
2084,
29918,
3198,
1125,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
2084,
29918,
3198,
29897,
13,
1678,
565,
7431,
29898,
359,
29889,
1761,
3972,
29898,
2084,
29918,
3198,
876,
5277,
29871,
29900,
29901,
13,
4706,
14319,
29918,
2084,
353,
281,
657,
29889,
10382,
29898,
2271,
29918,
10382,
29892,
2224,
29918,
3198,
718,
11393,
7554,
1159,
13,
4706,
411,
14319,
1445,
29889,
26264,
2283,
29898,
7554,
29918,
2084,
29892,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
21111,
497,
29898,
359,
29889,
2084,
29889,
25721,
29898,
7554,
29918,
2084,
876,
13,
13,
13,
1753,
2967,
29918,
7554,
29918,
12083,
29918,
10382,
29898,
2084,
29918,
3198,
29892,
3142,
29918,
10382,
1125,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
275,
3972,
29898,
2084,
29918,
3198,
1125,
13,
4706,
14319,
29918,
2084,
353,
281,
657,
29889,
10382,
29898,
2271,
29918,
10382,
29892,
2224,
29918,
3198,
718,
11393,
7554,
1159,
13,
4706,
411,
14319,
1445,
29889,
26264,
2283,
29898,
7554,
29918,
2084,
29892,
376,
29878,
1159,
408,
285,
29901,
13,
9651,
285,
29889,
21111,
497,
29898,
359,
29889,
2084,
29889,
25721,
29898,
7554,
29918,
2084,
876,
13,
13,
13,
1753,
3588,
29918,
1807,
29918,
517,
29918,
1761,
29898,
1111,
24266,
29918,
726,
29901,
851,
1125,
13,
1678,
10350,
29918,
726,
353,
10350,
29918,
726,
29889,
6506,
703,
9162,
20569,
13,
1678,
1018,
29901,
13,
4706,
736,
8717,
29889,
20889,
284,
29918,
14513,
29898,
1111,
24266,
29918,
726,
29897,
13,
1678,
5174,
29901,
13,
4706,
12020,
7865,
2392,
703,
1111,
24266,
29918,
726,
338,
1347,
310,
1051,
29892,
1342,
29901,
13218,
8999,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
16272,
29896,
29892,
29906,
29892,
29941,
29892,
29946,
5262,
5931,
1159,
13,
2
] |
sensor/Csv_Manip.py | utagsa2021/GolfSwingAnalysis | 0 | 114354 | import csv
import numpy as np
import pandas as pd
# Removes first few rows of data that don't have actual sensor readings
def trim_csv(in_file_name, out_file_name):
with open(in_file_name, "r") as inp, open(out_file_name, "w") as out:
writer = csv.writer(out)
for row in csv.reader(inp):
if float(row[14]) != 0:
writer.writerow(row)
# Reads csv file into numpy array
def read_csv_data(file_name):
file_1 = pd.read_csv(file_name)
return file_1.values | [
1,
1053,
11799,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
13,
13,
29937,
5240,
586,
267,
937,
2846,
4206,
310,
848,
393,
1016,
29915,
29873,
505,
3935,
23530,
1303,
886,
13,
1753,
17151,
29918,
7638,
29898,
262,
29918,
1445,
29918,
978,
29892,
714,
29918,
1445,
29918,
978,
1125,
13,
13,
1678,
411,
1722,
29898,
262,
29918,
1445,
29918,
978,
29892,
376,
29878,
1159,
408,
297,
29886,
29892,
1722,
29898,
449,
29918,
1445,
29918,
978,
29892,
376,
29893,
1159,
408,
714,
29901,
13,
4706,
9227,
353,
11799,
29889,
13236,
29898,
449,
29897,
13,
4706,
363,
1948,
297,
11799,
29889,
16950,
29898,
262,
29886,
1125,
13,
9651,
565,
5785,
29898,
798,
29961,
29896,
29946,
2314,
2804,
29871,
29900,
29901,
13,
18884,
9227,
29889,
13236,
340,
29898,
798,
29897,
13,
13,
13,
29937,
7523,
29879,
11799,
934,
964,
12655,
1409,
13,
1753,
1303,
29918,
7638,
29918,
1272,
29898,
1445,
29918,
978,
1125,
13,
13,
1678,
934,
29918,
29896,
353,
10518,
29889,
949,
29918,
7638,
29898,
1445,
29918,
978,
29897,
13,
13,
1678,
736,
934,
29918,
29896,
29889,
5975,
2
] |
ambari-server/src/test/python/stacks/1.3.2/MAPREDUCE/test_mapreduce_client.py | vsosrc/ambari | 0 | 102084 | <reponame>vsosrc/ambari
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
'''
from mock.mock import MagicMock, call, patch
import tempfile
import tarfile
import contextlib
from stacks.utils.RMFTestCase import *
import os
origin_exists = os.path.exists
@patch.object(os.path, "exists", new=MagicMock(
side_effect=lambda *args: origin_exists(args[0])
if args[0][-2:] == "j2" else True))
class TestMapreduceClient(RMFTestCase):
def test_configure_default(self):
self.executeScript("1.3.2/services/MAPREDUCE/package/scripts/client.py",
classname = "Client",
command = "configure",
config_file="default.json"
)
self.assertResourceCalled('Directory', '/var/run/hadoop/mapred',
owner = 'mapred',
group = 'hadoop',
recursive = True,
)
self.assertResourceCalled('Directory', '/var/log/hadoop/mapred',
owner = 'mapred',
group = 'hadoop',
recursive = True,
)
self.assertResourceCalled('Directory', '/var/log/hadoop/mapred/userlogs',
mode = 01777,
recursive = True,
)
self.assertResourceCalled('Directory', '/hadoop/mapred',
owner = 'mapred',
recursive = True,
mode = 0755,
ignore_failures=True,
)
self.assertResourceCalled('Directory', '/hadoop/mapred1',
owner = 'mapred',
recursive = True,
mode = 0755,
ignore_failures=True,
)
self.assertResourceCalled('File', '/etc/hadoop/conf/mapred.exclude',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/mapred.include',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/taskcontroller.cfg',
content = Template('taskcontroller.cfg.j2'),
owner = 'hdfs',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/mapred-queue-acls.xml',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('XmlConfig', 'mapred-site.xml',
owner = 'mapred',
group = 'hadoop',
conf_dir = '/etc/hadoop/conf',
configurations = self.getConfig()['configurations']['mapred-site'],
configuration_attributes = self.getConfig()['configuration_attributes']['mapred-site']
)
self.assertResourceCalled('File', '/etc/hadoop/conf/fair-scheduler.xml',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/ssl-client.xml.example',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/ssl-server.xml.example',
owner = 'mapred',
group = 'hadoop',
)
self.assertNoMoreResources()
def test_configure_secured(self):
self.executeScript("1.3.2/services/MAPREDUCE/package/scripts/client.py",
classname = "Client",
command = "configure",
config_file="secured.json"
)
self.assertResourceCalled('Directory', '/var/run/hadoop/mapred',
owner = 'mapred',
group = 'hadoop',
recursive = True,
)
self.assertResourceCalled('Directory', '/var/log/hadoop/mapred',
owner = 'mapred',
group = 'hadoop',
recursive = True,
)
self.assertResourceCalled('Directory', '/var/log/hadoop/mapred/userlogs',
mode = 01777,
recursive = True,
)
self.assertResourceCalled('Directory', '/hadoop/mapred',
owner = 'mapred',
recursive = True,
mode = 0755,
ignore_failures=True,
)
self.assertResourceCalled('File', '/etc/hadoop/conf/mapred.exclude',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/mapred.include',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/usr/lib/hadoop/bin/task-controller',
owner = 'root',
group = 'hadoop',
mode = 06050,
)
self.assertResourceCalled('File', '/etc/hadoop/conf/taskcontroller.cfg',
content = Template('taskcontroller.cfg.j2'),
owner = 'root',
group = 'hadoop',
mode = 0644,
)
self.assertResourceCalled('File', '/etc/hadoop/conf/mapred-queue-acls.xml',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('XmlConfig', 'mapred-site.xml',
owner = 'mapred',
group = 'hadoop',
conf_dir = '/etc/hadoop/conf',
configurations = self.getConfig()['configurations']['mapred-site'],
configuration_attributes = self.getConfig()['configuration_attributes']['mapred-site']
)
self.assertResourceCalled('File', '/etc/hadoop/conf/fair-scheduler.xml',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/ssl-client.xml.example',
owner = 'mapred',
group = 'hadoop',
)
self.assertResourceCalled('File', '/etc/hadoop/conf/ssl-server.xml.example',
owner = 'mapred',
group = 'hadoop',
)
self.assertNoMoreResources()
@patch.object(tarfile,"open", new = MagicMock())
@patch.object(tempfile,"mkdtemp", new = MagicMock(return_value='/tmp/123'))
@patch.object(contextlib,"closing", new = MagicMock())
@patch("os.path.exists", new = MagicMock(return_value=True))
def test_generate_configs_default(self):
self.executeScript("1.3.2/services/MAPREDUCE/package/scripts/client.py",
classname = "Client",
command = "generate_configs",
config_file="default.json"
)
self.assertResourceCalled('Directory', '/tmp',
recursive = True,
)
self.assertResourceCalled('XmlConfig', 'core-site.xml',
conf_dir = '/tmp/123',
configuration_attributes = self.getConfig()['configuration_attributes']['core-site'],
configurations = self.getConfig()['configurations']['core-site'],
)
self.assertResourceCalled('XmlConfig', 'mapred-site.xml',
conf_dir = '/tmp/123',
configuration_attributes = self.getConfig()['configuration_attributes']['mapred-site'],
configurations = self.getConfig()['configurations']['mapred-site'],
)
self.assertResourceCalled('File', '/tmp/123/log4j.properties',
content = InlineTemplate("log4jproperties\nline2log4jproperties\nline2\nambari.jobhistory.database=jdbc:postgresql://c6401.ambari.apache.org/ambarirca\nambari.jobhistory.driver=org.postgresql.Driver\nambari.jobhistory.user=mapred\nambari.jobhistory.password=mapred\nambari.jobhistory.logger=${hadoop.root.logger}\n\nlog4j.appender.JHA=org.apache.ambari.log4j.hadoop.mapreduce.jobhistory.JobHistoryAppender\nlog4j.appender.JHA.database=jdbc:postgresql://c6401.ambari.apache.org/ambarirca\nlog4j.appender.JHA.driver=org.postgresql.Driver\nlog4j.appender.JHA.user=mapred\nlog4j.appender.JHA.password=<PASSWORD>.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=DEBUG,JHA\nlog4j.additivity.org.apache.hadoop.mapred.JobHistory$JobHistoryLogger=true\n\n"),
)
self.assertResourceCalled('Directory', '/tmp/123',
action = ['delete'],
)
self.assertNoMoreResources()
| [
1,
529,
276,
1112,
420,
29958,
4270,
359,
2214,
29914,
1117,
1306,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
13,
12008,
13,
29931,
293,
21144,
304,
278,
13380,
18540,
10606,
313,
3289,
29943,
29897,
1090,
697,
13,
272,
901,
17737,
3406,
19405,
8571,
4110,
29889,
29871,
2823,
278,
6058,
12107,
934,
13,
5721,
7541,
411,
445,
664,
363,
5684,
2472,
13,
1727,
20272,
3509,
1266,
27428,
29889,
29871,
450,
3339,
29943,
7794,
11259,
445,
934,
13,
517,
366,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
13,
29908,
29931,
293,
1947,
1496,
366,
1122,
451,
671,
445,
934,
5174,
297,
752,
13036,
13,
2541,
278,
19245,
29889,
29871,
887,
1122,
4017,
263,
3509,
310,
278,
19245,
472,
13,
13,
1678,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
13,
2525,
2222,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
5721,
7541,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
13,
29956,
1806,
8187,
2692,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
13,
13393,
278,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
13,
13400,
800,
1090,
278,
19245,
29889,
13,
12008,
13,
3166,
11187,
29889,
17640,
1053,
26494,
18680,
29892,
1246,
29892,
13261,
13,
5215,
5694,
1445,
13,
5215,
9913,
1445,
13,
5215,
3030,
1982,
13,
3166,
5096,
29879,
29889,
13239,
29889,
29934,
29924,
29943,
3057,
8259,
1053,
334,
13,
5215,
2897,
13,
13,
12574,
29918,
9933,
353,
2897,
29889,
2084,
29889,
9933,
13,
29992,
5041,
29889,
3318,
29898,
359,
29889,
2084,
29892,
376,
9933,
613,
716,
29922,
19095,
293,
18680,
29898,
13,
29871,
2625,
29918,
15987,
29922,
2892,
334,
5085,
29901,
3978,
29918,
9933,
29898,
5085,
29961,
29900,
2314,
13,
29871,
565,
6389,
29961,
29900,
3816,
29899,
29906,
17531,
1275,
376,
29926,
29906,
29908,
1683,
5852,
876,
13,
1990,
4321,
3388,
17469,
4032,
29898,
29934,
29924,
29943,
3057,
8259,
1125,
13,
13,
29871,
822,
1243,
29918,
17591,
29918,
4381,
29898,
1311,
1125,
13,
1678,
1583,
29889,
7978,
4081,
703,
29896,
29889,
29941,
29889,
29906,
29914,
9916,
29914,
1529,
15094,
14849,
4741,
29914,
5113,
29914,
16713,
29914,
4645,
29889,
2272,
613,
13,
462,
539,
770,
978,
353,
376,
4032,
613,
13,
462,
539,
1899,
353,
376,
17591,
613,
13,
462,
539,
2295,
29918,
1445,
543,
4381,
29889,
3126,
29908,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
1707,
29914,
3389,
29914,
22075,
29914,
1958,
1127,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
418,
16732,
353,
5852,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
1707,
29914,
1188,
29914,
22075,
29914,
1958,
1127,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
418,
16732,
353,
5852,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
1707,
29914,
1188,
29914,
22075,
29914,
1958,
1127,
29914,
1792,
20756,
742,
13,
418,
4464,
353,
29871,
29900,
29896,
29955,
29955,
29955,
29892,
13,
418,
16732,
353,
5852,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
22075,
29914,
1958,
1127,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
16732,
353,
5852,
29892,
13,
418,
4464,
353,
29871,
29900,
29955,
29945,
29945,
29892,
13,
418,
11455,
29918,
14057,
1973,
29922,
5574,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
22075,
29914,
1958,
1127,
29896,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
16732,
353,
5852,
29892,
13,
418,
4464,
353,
29871,
29900,
29955,
29945,
29945,
29892,
13,
418,
11455,
29918,
14057,
1973,
29922,
5574,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
1958,
1127,
29889,
735,
2325,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
1958,
1127,
29889,
2856,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
7662,
8299,
29889,
16859,
742,
13,
462,
795,
2793,
353,
25663,
877,
7662,
8299,
29889,
16859,
29889,
29926,
29906,
5477,
13,
462,
795,
12271,
353,
525,
29882,
29069,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
1958,
1127,
29899,
9990,
29899,
562,
3137,
29889,
3134,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
11089,
3991,
742,
525,
1958,
1127,
29899,
2746,
29889,
3134,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1970,
29918,
3972,
353,
8207,
7070,
29914,
22075,
29914,
5527,
742,
13,
462,
795,
22920,
353,
1583,
29889,
657,
3991,
580,
1839,
2917,
332,
800,
16215,
1958,
1127,
29899,
2746,
7464,
13,
462,
795,
5285,
29918,
15697,
353,
1583,
29889,
657,
3991,
580,
1839,
13305,
29918,
15697,
16215,
1958,
1127,
29899,
2746,
2033,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
29888,
1466,
29899,
816,
14952,
29889,
3134,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
16265,
29899,
4645,
29889,
3134,
29889,
4773,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
16265,
29899,
2974,
29889,
3134,
29889,
4773,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
3782,
20761,
13770,
580,
13,
13,
29871,
822,
1243,
29918,
17591,
29918,
3471,
2955,
29898,
1311,
1125,
13,
13,
1678,
1583,
29889,
7978,
4081,
703,
29896,
29889,
29941,
29889,
29906,
29914,
9916,
29914,
1529,
15094,
14849,
4741,
29914,
5113,
29914,
16713,
29914,
4645,
29889,
2272,
613,
13,
418,
770,
978,
353,
376,
4032,
613,
13,
418,
1899,
353,
376,
17591,
613,
13,
418,
2295,
29918,
1445,
543,
3471,
2955,
29889,
3126,
29908,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
1707,
29914,
3389,
29914,
22075,
29914,
1958,
1127,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
418,
16732,
353,
5852,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
1707,
29914,
1188,
29914,
22075,
29914,
1958,
1127,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
418,
16732,
353,
5852,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
1707,
29914,
1188,
29914,
22075,
29914,
1958,
1127,
29914,
1792,
20756,
742,
13,
418,
4464,
353,
29871,
29900,
29896,
29955,
29955,
29955,
29892,
13,
418,
16732,
353,
5852,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
22075,
29914,
1958,
1127,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
16732,
353,
5852,
29892,
13,
418,
4464,
353,
29871,
29900,
29955,
29945,
29945,
29892,
13,
418,
11455,
29918,
14057,
1973,
29922,
5574,
29892,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
1958,
1127,
29889,
735,
2325,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
1958,
1127,
29889,
2856,
742,
13,
418,
12271,
353,
525,
1958,
1127,
742,
13,
418,
2318,
353,
525,
22075,
742,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
4855,
29914,
1982,
29914,
22075,
29914,
2109,
29914,
7662,
29899,
8299,
742,
13,
462,
795,
12271,
353,
525,
4632,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
4464,
353,
29871,
29900,
29953,
29900,
29945,
29900,
29892,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
7662,
8299,
29889,
16859,
742,
13,
462,
795,
2793,
353,
25663,
877,
7662,
8299,
29889,
16859,
29889,
29926,
29906,
5477,
13,
462,
795,
12271,
353,
525,
4632,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
4464,
353,
29871,
29900,
29953,
29946,
29946,
29892,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
1958,
1127,
29899,
9990,
29899,
562,
3137,
29889,
3134,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
11089,
3991,
742,
525,
1958,
1127,
29899,
2746,
29889,
3134,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1970,
29918,
3972,
353,
8207,
7070,
29914,
22075,
29914,
5527,
742,
13,
462,
795,
22920,
353,
1583,
29889,
657,
3991,
580,
1839,
2917,
332,
800,
16215,
1958,
1127,
29899,
2746,
7464,
13,
462,
795,
5285,
29918,
15697,
353,
1583,
29889,
657,
3991,
580,
1839,
13305,
29918,
15697,
16215,
1958,
1127,
29899,
2746,
2033,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
29888,
1466,
29899,
816,
14952,
29889,
3134,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
16265,
29899,
4645,
29889,
3134,
29889,
4773,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7070,
29914,
22075,
29914,
5527,
29914,
16265,
29899,
2974,
29889,
3134,
29889,
4773,
742,
13,
462,
795,
12271,
353,
525,
1958,
1127,
742,
13,
462,
795,
2318,
353,
525,
22075,
742,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
3782,
20761,
13770,
580,
13,
13,
29871,
732,
5041,
29889,
3318,
29898,
12637,
1445,
1699,
3150,
613,
716,
353,
26494,
18680,
3101,
13,
29871,
732,
5041,
29889,
3318,
29898,
7382,
1445,
1699,
11256,
29881,
7382,
613,
716,
353,
26494,
18680,
29898,
2457,
29918,
1767,
2433,
29914,
7050,
29914,
29896,
29906,
29941,
8785,
13,
29871,
732,
5041,
29889,
3318,
29898,
4703,
1982,
1699,
11291,
292,
613,
716,
353,
26494,
18680,
3101,
13,
29871,
732,
5041,
703,
359,
29889,
2084,
29889,
9933,
613,
716,
353,
26494,
18680,
29898,
2457,
29918,
1767,
29922,
5574,
876,
13,
29871,
822,
1243,
29918,
17158,
29918,
2917,
29879,
29918,
4381,
29898,
1311,
1125,
13,
1678,
1583,
29889,
7978,
4081,
703,
29896,
29889,
29941,
29889,
29906,
29914,
9916,
29914,
1529,
15094,
14849,
4741,
29914,
5113,
29914,
16713,
29914,
4645,
29889,
2272,
613,
13,
462,
539,
770,
978,
353,
376,
4032,
613,
13,
462,
539,
1899,
353,
376,
17158,
29918,
2917,
29879,
613,
13,
462,
539,
2295,
29918,
1445,
543,
4381,
29889,
3126,
29908,
13,
1678,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
7050,
742,
13,
462,
795,
16732,
353,
5852,
29892,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
11089,
3991,
742,
525,
3221,
29899,
2746,
29889,
3134,
742,
13,
462,
795,
1970,
29918,
3972,
353,
8207,
7050,
29914,
29896,
29906,
29941,
742,
13,
462,
795,
5285,
29918,
15697,
353,
1583,
29889,
657,
3991,
580,
1839,
13305,
29918,
15697,
16215,
3221,
29899,
2746,
7464,
13,
462,
795,
22920,
353,
1583,
29889,
657,
3991,
580,
1839,
2917,
332,
800,
16215,
3221,
29899,
2746,
7464,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
11089,
3991,
742,
525,
1958,
1127,
29899,
2746,
29889,
3134,
742,
13,
462,
795,
1970,
29918,
3972,
353,
8207,
7050,
29914,
29896,
29906,
29941,
742,
13,
462,
795,
5285,
29918,
15697,
353,
1583,
29889,
657,
3991,
580,
1839,
13305,
29918,
15697,
16215,
1958,
1127,
29899,
2746,
7464,
13,
462,
795,
22920,
353,
1583,
29889,
657,
3991,
580,
1839,
2917,
332,
800,
16215,
1958,
1127,
29899,
2746,
7464,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
2283,
742,
8207,
7050,
29914,
29896,
29906,
29941,
29914,
1188,
29946,
29926,
29889,
11330,
742,
13,
462,
795,
2793,
353,
512,
1220,
6733,
703,
1188,
29946,
29926,
11330,
29905,
29876,
1220,
29906,
1188,
29946,
29926,
11330,
29905,
29876,
1220,
29906,
29905,
29876,
1117,
1306,
29889,
9057,
18434,
29889,
9803,
29922,
15686,
29901,
29272,
597,
29883,
29953,
29946,
29900,
29896,
29889,
1117,
1306,
29889,
4288,
29889,
990,
29914,
1117,
279,
381,
1113,
29905,
29876,
1117,
1306,
29889,
9057,
18434,
29889,
9465,
29922,
990,
29889,
29272,
29889,
12376,
29905,
29876,
1117,
1306,
29889,
9057,
18434,
29889,
1792,
29922,
1958,
1127,
29905,
29876,
1117,
1306,
29889,
9057,
18434,
29889,
5630,
29922,
1958,
1127,
29905,
29876,
1117,
1306,
29889,
9057,
18434,
29889,
21707,
23339,
22075,
29889,
4632,
29889,
21707,
1012,
29876,
29905,
29876,
1188,
29946,
29926,
29889,
932,
1581,
29889,
29967,
15715,
29922,
990,
29889,
4288,
29889,
1117,
1306,
29889,
1188,
29946,
29926,
29889,
22075,
29889,
1958,
17469,
29889,
9057,
18434,
29889,
11947,
20570,
2052,
1581,
29905,
29876,
1188,
29946,
29926,
29889,
932,
1581,
29889,
29967,
15715,
29889,
9803,
29922,
15686,
29901,
29272,
597,
29883,
29953,
29946,
29900,
29896,
29889,
1117,
1306,
29889,
4288,
29889,
990,
29914,
1117,
279,
381,
1113,
29905,
29876,
1188,
29946,
29926,
29889,
932,
1581,
29889,
29967,
15715,
29889,
9465,
29922,
990,
29889,
29272,
29889,
12376,
29905,
29876,
1188,
29946,
29926,
29889,
932,
1581,
29889,
29967,
15715,
29889,
1792,
29922,
1958,
1127,
29905,
29876,
1188,
29946,
29926,
29889,
932,
1581,
29889,
29967,
15715,
29889,
5630,
29922,
29966,
25711,
17013,
15513,
990,
29889,
4288,
29889,
22075,
29889,
1958,
1127,
29889,
11947,
20570,
29938,
11947,
20570,
16363,
29922,
18525,
29892,
29967,
15715,
29905,
29876,
1188,
29946,
29926,
29889,
1202,
24858,
29889,
990,
29889,
4288,
29889,
22075,
29889,
1958,
1127,
29889,
11947,
20570,
29938,
11947,
20570,
16363,
29922,
3009,
29905,
29876,
29905,
29876,
4968,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
6848,
29907,
4212,
877,
9882,
742,
8207,
7050,
29914,
29896,
29906,
29941,
742,
13,
462,
795,
3158,
353,
6024,
8143,
7464,
13,
462,
795,
1723,
13,
1678,
1583,
29889,
9294,
3782,
20761,
13770,
580,
13,
2
] |
singleAlgoritm/ContinuousEnvMlpInput/SAC.py | NLS-SJTU/BatcRL | 3 | 102329 | import os
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
class ReplayBuffer:
def __init__(self, state_dim, action_dim,max_size=1e6, device = torch.device('cpu')):
self.state_dim = state_dim
self.action_dim = action_dim
self.max_size = max_size
self.device = device
self.state_buf = torch.empty((max_size, state_dim), dtype=torch.float32, device=device)
self.other_buf = torch.empty((max_size, action_dim + 2), dtype=torch.float32, device=device)
self.index = 0
self.total_len = 0
def append(self, state, other):
#other: reward, done, action
self.index = self.index % self.max_size
self.state_buf[self.index] = torch.as_tensor(state, dtype=torch.float32, device=self.device)
self.other_buf[self.index] = torch.as_tensor(other, dtype=torch.float32, device=self.device)
self.index = self.index+1
self.total_len = min(self.max_size, max(self.index, self.total_len))
def sample_batch(self, batch_size):
self.idx = np.random.randint(0, self.total_len-1, batch_size)
state = self.state_buf[self.idx]
action = self.other_buf[self.idx, 2:].long()
reward = self.other_buf[self.idx, 0].unsqueeze(1)
mask = self.other_buf[self.idx, 1].unsqueeze(1)
next_state = self.state_buf[self.idx + 1]
return state, action, reward, mask, next_state
class ActorSAC(nn.Module):
def __init__(self, state_dim, action_dim, mid_dim=256):
super(ActorSAC, self).__init__()
self.net = nn.Sequential(
nn.Linear(state_dim, mid_dim), nn.ReLU(),
nn.Linear(mid_dim, mid_dim), nn.ReLU(),
nn.Linear(mid_dim, mid_dim), nn.ReLU(),
)
self.avg = nn.Linear(mid_dim, action_dim)
self.log_std = nn.Linear(mid_dim, action_dim)
self.log_sqrt_2pi = np.log(np.sqrt(2 * np.pi))
def forward(self, state):
x = self.net(state)
return self.avg(x).tanh()
def get_actions(self, state):
x = self.net(state)
avg = self.avg(x)
std = self.log_std(x).clamp(-20, 2).exp()
action = avg + torch.rand_like(avg) * std
return action.tanh()
def get_actions_logprob(self, state):
x =self.net(state)
avg = self.avg(x)
log_std = self.log_std(x).clamp(-20, 2)
noise = torch.rand_like(avg, requires_grad=True)
action_tanh = (avg + noise * log_std.exp()).tanh()
log_prob = log_std + self.log_sqrt_2pi + noise.pow(2).__mul__(0.5)
log_prob = log_prob + (1. - action_tanh.pow(2)).log()
return action_tanh, log_prob.sum(1,keepdim=True)
class CriticSAC(nn.Module):
def __init__(self, state_dim, action_dim, mid_dim=256):
super(CriticSAC, self).__init__()
self.net = nn.Sequential(
nn.Linear(state_dim+action_dim, mid_dim), nn.ReLU(),
nn.Linear(mid_dim, mid_dim), nn.ReLU()
)
self.q1 = nn.Linear(mid_dim, 1) # optimal Q value
self.q2 = nn.Linear(mid_dim, 1)
def forward(self, state, action):
x = torch.cat((state, action), dim=1)
x = self.net(x)
q1 = self.q1(x)
q2 = self.q2(x)
return q1, q2
class SACAgent:
def __init__(self, state_dim, action_dim):
self.learning_rate = 1e-4
self.batch_size = 128
self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
self.alpha = 0.1
self.max_memo = int(1e6)
self.target_step = 1024
self.gamma = 0.99
self.mid_dim = 256
self.actor = ActorSAC(state_dim, action_dim, self.mid_dim).to(self.device)
self.critic = CriticSAC(state_dim, action_dim,self.mid_dim).to(self.device)
self.actor_optim = torch.optim.Adam(self.actor.parameters(), lr=self.learning_rate)
self.critic_optim = torch.optim.Adam(self.critic.parameters(), lr=self.learning_rate)
self.replay_buffer = ReplayBuffer(state_dim, action_dim, self.max_memo, self.device)
self.repect_time = 32
self.state = None
def select_action(self, states):
states = torch.as_tensor((states, ), dtype=torch.float32, device=self.device)
action = self.actor.get_actions(states)
return action.cpu().detach().numpy()[0]
def explore_env(self, env):
state = self.state if self.state is not None else env.reset()
for __ in range(self.target_step):
action = self.select_action(state)
state_, reward, done, _ = env.step(action)
other = (reward, (1 - done) * self.gamma, *action)
self.replay_buffer.append(state, other)
state = state_ if not done else env.reset()
self.state = state
return self.target_step
def update(self):
for i in range(int(self.target_step * self.repect_time / self.batch_size)):
batch_state, batch_action, batch_reward, batch_mask, batch_next_state = self.replay_buffer.sample_batch(self.batch_size)
with torch.no_grad():
next_action, next_log_prob = self.actor.get_actions_logprob(batch_next_state)
next_q = torch.min(*self.critic(batch_next_state, next_action))
q_label = batch_reward + batch_mask * (next_q + self.alpha * next_log_prob)
# critic optim
q1, q2 = self.critic(batch_state, batch_action)
critic_loss = F.mse_loss(q1, q_label) + F.mse_loss(q2, q_label)
self.optim_update(self.critic_optim, critic_loss)
# actor optim
action_pg, log_prob = self.actor.get_actions_logprob(batch_state)
actor_obj = -torch.mean(torch.min(*self.critic(batch_state, action_pg))+ self.alpha * log_prob)
self.optim_update(self.actor_optim, actor_obj)
@staticmethod
def optim_update(optimizer, objective):
optimizer.zero_grad()
objective.backward()
optimizer.step()
@torch.no_grad()
def evaluate(self, env, render=False):
epochs = 20
res = np.zeros((epochs,))
obs = env.reset()
index = 0
while index < epochs:
if render: env.render()
obs = torch.as_tensor((obs,), dtype=torch.float32, device=self.device)
action = self.actor(obs)
action = action.detach().cpu().numpy()[0]
s_, reward, done, _ = env.step(action)
res[index] += reward
if done:
index += 1
obs = env.reset()
else:
obs = s_
return res.mean(), res.std()
def load_and_save_weight(self, path, mode='load'):
actor_path = os.path.join(path, 'actor.pth')
critic_path = os.path.join(path, 'critic.pth')
if mode == 'load':
if os.path.exists(actor_path) and os.path.exists(critic_path):
self.actor.load_state_dict(torch.load(actor_path))
self.critic.load_state_dict(torch.load(critic_path))
else:
if not os.path.exists(path):
os.makedirs(path)
torch.save(self.actor.state_dict(), actor_path)
torch.save(self.critic.state_dict(), critic_path)
| [
1,
1053,
2897,
13,
13,
5215,
4842,
305,
13,
5215,
12655,
408,
7442,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
13,
1990,
830,
1456,
7701,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29918,
6229,
29892,
3158,
29918,
6229,
29892,
3317,
29918,
2311,
29922,
29896,
29872,
29953,
29892,
4742,
353,
4842,
305,
29889,
10141,
877,
21970,
8785,
29901,
13,
4706,
1583,
29889,
3859,
29918,
6229,
29871,
353,
2106,
29918,
6229,
13,
4706,
1583,
29889,
2467,
29918,
6229,
353,
3158,
29918,
6229,
13,
4706,
1583,
29889,
3317,
29918,
2311,
353,
4236,
29918,
2311,
13,
4706,
1583,
29889,
10141,
353,
4742,
13,
4706,
1583,
29889,
3859,
29918,
9721,
353,
4842,
305,
29889,
6310,
3552,
3317,
29918,
2311,
29892,
2106,
29918,
6229,
511,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
10141,
29897,
13,
4706,
1583,
29889,
1228,
29918,
9721,
353,
4842,
305,
29889,
6310,
3552,
3317,
29918,
2311,
29892,
3158,
29918,
6229,
718,
29871,
29906,
511,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
10141,
29897,
13,
4706,
1583,
29889,
2248,
353,
29871,
29900,
13,
4706,
1583,
29889,
7827,
29918,
2435,
353,
29871,
29900,
13,
13,
1678,
822,
9773,
29898,
1311,
29892,
2106,
29892,
916,
1125,
13,
4706,
396,
1228,
29901,
20751,
29892,
2309,
29892,
3158,
13,
4706,
1583,
29889,
2248,
353,
1583,
29889,
2248,
1273,
1583,
29889,
3317,
29918,
2311,
13,
4706,
1583,
29889,
3859,
29918,
9721,
29961,
1311,
29889,
2248,
29962,
353,
4842,
305,
29889,
294,
29918,
20158,
29898,
3859,
29892,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
4706,
1583,
29889,
1228,
29918,
9721,
29961,
1311,
29889,
2248,
29962,
29871,
353,
4842,
305,
29889,
294,
29918,
20158,
29898,
1228,
29892,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
4706,
1583,
29889,
2248,
353,
1583,
29889,
2248,
29974,
29896,
13,
4706,
1583,
29889,
7827,
29918,
2435,
353,
1375,
29898,
1311,
29889,
3317,
29918,
2311,
29892,
4236,
29898,
1311,
29889,
2248,
29892,
1583,
29889,
7827,
29918,
2435,
876,
13,
13,
1678,
822,
4559,
29918,
16175,
29898,
1311,
29892,
9853,
29918,
2311,
1125,
13,
4706,
1583,
29889,
13140,
353,
7442,
29889,
8172,
29889,
9502,
524,
29898,
29900,
29892,
1583,
29889,
7827,
29918,
2435,
29899,
29896,
29892,
9853,
29918,
2311,
29897,
13,
4706,
2106,
353,
1583,
29889,
3859,
29918,
9721,
29961,
1311,
29889,
13140,
29962,
13,
4706,
3158,
353,
1583,
29889,
1228,
29918,
9721,
29961,
1311,
29889,
13140,
29892,
29871,
29906,
29901,
1822,
5426,
580,
13,
4706,
20751,
353,
1583,
29889,
1228,
29918,
9721,
29961,
1311,
29889,
13140,
29892,
29871,
29900,
1822,
6948,
802,
29872,
911,
29898,
29896,
29897,
13,
4706,
11105,
353,
1583,
29889,
1228,
29918,
9721,
29961,
1311,
29889,
13140,
29892,
29871,
29896,
1822,
6948,
802,
29872,
911,
29898,
29896,
29897,
13,
4706,
2446,
29918,
3859,
353,
1583,
29889,
3859,
29918,
9721,
29961,
1311,
29889,
13140,
718,
29871,
29896,
29962,
13,
4706,
736,
2106,
29892,
3158,
29892,
20751,
29892,
11105,
29892,
2446,
29918,
3859,
13,
13,
13,
13,
1990,
319,
2801,
29903,
2477,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29918,
6229,
29892,
3158,
29918,
6229,
29892,
7145,
29918,
6229,
29922,
29906,
29945,
29953,
1125,
13,
4706,
2428,
29898,
29909,
2801,
29903,
2477,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
1212,
353,
302,
29876,
29889,
16941,
2556,
29898,
13,
9651,
302,
29876,
29889,
12697,
29898,
3859,
29918,
6229,
29892,
7145,
29918,
6229,
511,
302,
29876,
29889,
1123,
29931,
29965,
3285,
13,
9651,
302,
29876,
29889,
12697,
29898,
6563,
29918,
6229,
29892,
7145,
29918,
6229,
511,
302,
29876,
29889,
1123,
29931,
29965,
3285,
13,
9651,
302,
29876,
29889,
12697,
29898,
6563,
29918,
6229,
29892,
7145,
29918,
6229,
511,
302,
29876,
29889,
1123,
29931,
29965,
3285,
13,
4706,
1723,
13,
4706,
1583,
29889,
485,
29887,
353,
302,
29876,
29889,
12697,
29898,
6563,
29918,
6229,
29892,
3158,
29918,
6229,
29897,
13,
4706,
1583,
29889,
1188,
29918,
4172,
353,
302,
29876,
29889,
12697,
29898,
6563,
29918,
6229,
29892,
3158,
29918,
6229,
29897,
13,
4706,
1583,
29889,
1188,
29918,
3676,
29918,
29906,
1631,
353,
7442,
29889,
1188,
29898,
9302,
29889,
3676,
29898,
29906,
334,
7442,
29889,
1631,
876,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
2106,
1125,
13,
4706,
921,
353,
1583,
29889,
1212,
29898,
3859,
29897,
13,
4706,
736,
1583,
29889,
485,
29887,
29898,
29916,
467,
13161,
29882,
580,
13,
13,
1678,
822,
679,
29918,
7387,
29898,
1311,
29892,
2106,
1125,
13,
4706,
921,
353,
1583,
29889,
1212,
29898,
3859,
29897,
13,
4706,
1029,
29887,
353,
1583,
29889,
485,
29887,
29898,
29916,
29897,
13,
4706,
3659,
353,
1583,
29889,
1188,
29918,
4172,
29898,
29916,
467,
695,
1160,
6278,
29906,
29900,
29892,
29871,
29906,
467,
4548,
580,
13,
4706,
3158,
353,
1029,
29887,
718,
4842,
305,
29889,
9502,
29918,
4561,
29898,
485,
29887,
29897,
334,
3659,
13,
4706,
736,
3158,
29889,
13161,
29882,
580,
13,
13,
1678,
822,
679,
29918,
7387,
29918,
1188,
22795,
29898,
1311,
29892,
2106,
1125,
13,
4706,
921,
353,
1311,
29889,
1212,
29898,
3859,
29897,
13,
4706,
1029,
29887,
353,
1583,
29889,
485,
29887,
29898,
29916,
29897,
13,
4706,
1480,
29918,
4172,
353,
1583,
29889,
1188,
29918,
4172,
29898,
29916,
467,
695,
1160,
6278,
29906,
29900,
29892,
29871,
29906,
29897,
13,
4706,
11462,
353,
4842,
305,
29889,
9502,
29918,
4561,
29898,
485,
29887,
29892,
6858,
29918,
5105,
29922,
5574,
29897,
13,
4706,
3158,
29918,
13161,
29882,
353,
313,
485,
29887,
718,
11462,
334,
1480,
29918,
4172,
29889,
4548,
16655,
13161,
29882,
580,
13,
13,
4706,
1480,
29918,
22795,
353,
1480,
29918,
4172,
718,
1583,
29889,
1188,
29918,
3676,
29918,
29906,
1631,
718,
11462,
29889,
12248,
29898,
29906,
467,
1649,
16109,
12035,
29900,
29889,
29945,
29897,
13,
4706,
1480,
29918,
22795,
353,
1480,
29918,
22795,
718,
313,
29896,
29889,
448,
3158,
29918,
13161,
29882,
29889,
12248,
29898,
29906,
8106,
1188,
580,
13,
4706,
736,
3158,
29918,
13161,
29882,
29892,
1480,
29918,
22795,
29889,
2083,
29898,
29896,
29892,
17462,
6229,
29922,
5574,
29897,
13,
13,
13,
1990,
15976,
293,
29903,
2477,
29898,
15755,
29889,
7355,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29918,
6229,
29892,
3158,
29918,
6229,
29892,
7145,
29918,
6229,
29922,
29906,
29945,
29953,
1125,
13,
4706,
2428,
29898,
29907,
768,
293,
29903,
2477,
29892,
1583,
467,
1649,
2344,
1649,
580,
13,
4706,
1583,
29889,
1212,
353,
302,
29876,
29889,
16941,
2556,
29898,
13,
9651,
302,
29876,
29889,
12697,
29898,
3859,
29918,
6229,
29974,
2467,
29918,
6229,
29892,
7145,
29918,
6229,
511,
302,
29876,
29889,
1123,
29931,
29965,
3285,
13,
9651,
302,
29876,
29889,
12697,
29898,
6563,
29918,
6229,
29892,
7145,
29918,
6229,
511,
302,
29876,
29889,
1123,
29931,
29965,
580,
13,
4706,
1723,
13,
4706,
1583,
29889,
29939,
29896,
353,
302,
29876,
29889,
12697,
29898,
6563,
29918,
6229,
29892,
29871,
29896,
29897,
396,
14413,
660,
995,
13,
4706,
1583,
29889,
29939,
29906,
353,
302,
29876,
29889,
12697,
29898,
6563,
29918,
6229,
29892,
29871,
29896,
29897,
13,
13,
1678,
822,
6375,
29898,
1311,
29892,
2106,
29892,
3158,
1125,
13,
4706,
921,
353,
4842,
305,
29889,
4117,
3552,
3859,
29892,
3158,
511,
3964,
29922,
29896,
29897,
13,
4706,
921,
353,
1583,
29889,
1212,
29898,
29916,
29897,
13,
4706,
3855,
29896,
353,
1583,
29889,
29939,
29896,
29898,
29916,
29897,
13,
4706,
3855,
29906,
353,
1583,
29889,
29939,
29906,
29898,
29916,
29897,
13,
4706,
736,
3855,
29896,
29892,
3855,
29906,
13,
13,
13,
1990,
317,
2477,
19661,
29901,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
2106,
29918,
6229,
29892,
3158,
29918,
6229,
1125,
13,
4706,
1583,
29889,
21891,
29918,
10492,
353,
29871,
29896,
29872,
29899,
29946,
13,
4706,
1583,
29889,
16175,
29918,
2311,
353,
29871,
29896,
29906,
29947,
13,
4706,
1583,
29889,
10141,
353,
4842,
305,
29889,
10141,
877,
29883,
6191,
29915,
565,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
580,
1683,
525,
21970,
1495,
13,
4706,
1583,
29889,
2312,
353,
29871,
29900,
29889,
29896,
13,
4706,
1583,
29889,
3317,
29918,
6954,
29877,
353,
938,
29898,
29896,
29872,
29953,
29897,
13,
4706,
1583,
29889,
5182,
29918,
10568,
353,
29871,
29896,
29900,
29906,
29946,
13,
4706,
1583,
29889,
4283,
353,
29871,
29900,
29889,
29929,
29929,
13,
4706,
1583,
29889,
6563,
29918,
6229,
353,
29871,
29906,
29945,
29953,
13,
13,
4706,
1583,
29889,
7168,
353,
319,
2801,
29903,
2477,
29898,
3859,
29918,
6229,
29892,
3158,
29918,
6229,
29892,
1583,
29889,
6563,
29918,
6229,
467,
517,
29898,
1311,
29889,
10141,
29897,
13,
4706,
1583,
29889,
9695,
293,
353,
15976,
293,
29903,
2477,
29898,
3859,
29918,
6229,
29892,
3158,
29918,
6229,
29892,
1311,
29889,
6563,
29918,
6229,
467,
517,
29898,
1311,
29889,
10141,
29897,
13,
4706,
1583,
29889,
7168,
29918,
20640,
353,
4842,
305,
29889,
20640,
29889,
3253,
314,
29898,
1311,
29889,
7168,
29889,
16744,
3285,
301,
29878,
29922,
1311,
29889,
21891,
29918,
10492,
29897,
13,
4706,
1583,
29889,
9695,
293,
29918,
20640,
353,
4842,
305,
29889,
20640,
29889,
3253,
314,
29898,
1311,
29889,
9695,
293,
29889,
16744,
3285,
301,
29878,
29922,
1311,
29889,
21891,
29918,
10492,
29897,
13,
4706,
1583,
29889,
276,
1456,
29918,
9040,
353,
830,
1456,
7701,
29898,
3859,
29918,
6229,
29892,
3158,
29918,
6229,
29892,
1583,
29889,
3317,
29918,
6954,
29877,
29892,
1583,
29889,
10141,
29897,
13,
4706,
1583,
29889,
276,
1103,
29918,
2230,
353,
29871,
29941,
29906,
13,
4706,
1583,
29889,
3859,
353,
6213,
13,
13,
1678,
822,
1831,
29918,
2467,
29898,
1311,
29892,
5922,
1125,
13,
4706,
5922,
353,
4842,
305,
29889,
294,
29918,
20158,
3552,
28631,
29892,
10353,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
4706,
3158,
353,
1583,
29889,
7168,
29889,
657,
29918,
7387,
29898,
28631,
29897,
13,
4706,
736,
3158,
29889,
21970,
2141,
4801,
496,
2141,
23749,
580,
29961,
29900,
29962,
13,
13,
1678,
822,
26987,
29918,
6272,
29898,
1311,
29892,
8829,
1125,
13,
4706,
2106,
353,
1583,
29889,
3859,
565,
1583,
29889,
3859,
338,
451,
6213,
1683,
8829,
29889,
12071,
580,
13,
4706,
363,
4770,
297,
3464,
29898,
1311,
29889,
5182,
29918,
10568,
1125,
13,
9651,
3158,
353,
1583,
29889,
2622,
29918,
2467,
29898,
3859,
29897,
13,
9651,
2106,
3383,
20751,
29892,
2309,
29892,
903,
353,
8829,
29889,
10568,
29898,
2467,
29897,
13,
9651,
916,
353,
313,
276,
1328,
29892,
313,
29896,
448,
2309,
29897,
334,
1583,
29889,
4283,
29892,
334,
2467,
29897,
13,
9651,
1583,
29889,
276,
1456,
29918,
9040,
29889,
4397,
29898,
3859,
29892,
916,
29897,
13,
9651,
2106,
353,
2106,
29918,
565,
451,
2309,
1683,
8829,
29889,
12071,
580,
13,
4706,
1583,
29889,
3859,
353,
2106,
13,
4706,
736,
1583,
29889,
5182,
29918,
10568,
13,
13,
1678,
822,
2767,
29898,
1311,
1125,
13,
4706,
363,
474,
297,
3464,
29898,
524,
29898,
1311,
29889,
5182,
29918,
10568,
334,
1583,
29889,
276,
1103,
29918,
2230,
847,
1583,
29889,
16175,
29918,
2311,
22164,
13,
9651,
9853,
29918,
3859,
29892,
9853,
29918,
2467,
29892,
9853,
29918,
276,
1328,
29892,
9853,
29918,
13168,
29892,
9853,
29918,
4622,
29918,
3859,
353,
1583,
29889,
276,
1456,
29918,
9040,
29889,
11249,
29918,
16175,
29898,
1311,
29889,
16175,
29918,
2311,
29897,
13,
9651,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
18884,
2446,
29918,
2467,
29892,
2446,
29918,
1188,
29918,
22795,
353,
1583,
29889,
7168,
29889,
657,
29918,
7387,
29918,
1188,
22795,
29898,
16175,
29918,
4622,
29918,
3859,
29897,
13,
18884,
2446,
29918,
29939,
353,
4842,
305,
29889,
1195,
10456,
1311,
29889,
9695,
293,
29898,
16175,
29918,
4622,
29918,
3859,
29892,
2446,
29918,
2467,
876,
13,
18884,
3855,
29918,
1643,
353,
9853,
29918,
276,
1328,
718,
9853,
29918,
13168,
334,
313,
4622,
29918,
29939,
718,
1583,
29889,
2312,
334,
2446,
29918,
1188,
29918,
22795,
29897,
13,
13,
9651,
396,
11164,
5994,
13,
9651,
3855,
29896,
29892,
3855,
29906,
353,
1583,
29889,
9695,
293,
29898,
16175,
29918,
3859,
29892,
9853,
29918,
2467,
29897,
13,
9651,
11164,
29918,
6758,
353,
383,
29889,
29885,
344,
29918,
6758,
29898,
29939,
29896,
29892,
3855,
29918,
1643,
29897,
718,
383,
29889,
29885,
344,
29918,
6758,
29898,
29939,
29906,
29892,
3855,
29918,
1643,
29897,
13,
9651,
1583,
29889,
20640,
29918,
5504,
29898,
1311,
29889,
9695,
293,
29918,
20640,
29892,
11164,
29918,
6758,
29897,
13,
13,
9651,
396,
11339,
5994,
13,
9651,
3158,
29918,
4061,
29892,
1480,
29918,
22795,
353,
1583,
29889,
7168,
29889,
657,
29918,
7387,
29918,
1188,
22795,
29898,
16175,
29918,
3859,
29897,
13,
9651,
11339,
29918,
5415,
353,
448,
7345,
305,
29889,
12676,
29898,
7345,
305,
29889,
1195,
10456,
1311,
29889,
9695,
293,
29898,
16175,
29918,
3859,
29892,
3158,
29918,
4061,
876,
29974,
1583,
29889,
2312,
334,
1480,
29918,
22795,
29897,
13,
9651,
1583,
29889,
20640,
29918,
5504,
29898,
1311,
29889,
7168,
29918,
20640,
29892,
11339,
29918,
5415,
29897,
13,
13,
13,
1678,
732,
7959,
5696,
13,
1678,
822,
5994,
29918,
5504,
29898,
20640,
3950,
29892,
12091,
1125,
13,
4706,
5994,
3950,
29889,
9171,
29918,
5105,
580,
13,
4706,
12091,
29889,
1627,
1328,
580,
13,
4706,
5994,
3950,
29889,
10568,
580,
13,
13,
1678,
732,
7345,
305,
29889,
1217,
29918,
5105,
580,
13,
1678,
822,
14707,
29898,
1311,
29892,
8829,
29892,
4050,
29922,
8824,
1125,
13,
4706,
21502,
12168,
353,
29871,
29906,
29900,
13,
4706,
620,
353,
7442,
29889,
3298,
359,
3552,
1022,
2878,
29879,
29892,
876,
13,
4706,
20881,
353,
8829,
29889,
12071,
580,
13,
4706,
2380,
353,
29871,
29900,
13,
4706,
1550,
2380,
529,
21502,
12168,
29901,
13,
9651,
565,
4050,
29901,
8829,
29889,
9482,
580,
13,
9651,
20881,
353,
4842,
305,
29889,
294,
29918,
20158,
3552,
26290,
29892,
511,
26688,
29922,
7345,
305,
29889,
7411,
29941,
29906,
29892,
4742,
29922,
1311,
29889,
10141,
29897,
13,
9651,
3158,
353,
1583,
29889,
7168,
29898,
26290,
29897,
13,
9651,
3158,
353,
3158,
29889,
4801,
496,
2141,
21970,
2141,
23749,
580,
29961,
29900,
29962,
13,
9651,
269,
3383,
20751,
29892,
2309,
29892,
903,
353,
8829,
29889,
10568,
29898,
2467,
29897,
13,
9651,
620,
29961,
2248,
29962,
4619,
20751,
13,
9651,
565,
2309,
29901,
13,
18884,
2380,
4619,
29871,
29896,
13,
18884,
20881,
353,
8829,
29889,
12071,
580,
13,
9651,
1683,
29901,
13,
18884,
20881,
353,
269,
29918,
13,
4706,
736,
620,
29889,
12676,
3285,
620,
29889,
4172,
580,
13,
13,
1678,
822,
2254,
29918,
392,
29918,
7620,
29918,
7915,
29898,
1311,
29892,
2224,
29892,
4464,
2433,
1359,
29374,
13,
4706,
11339,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
525,
7168,
29889,
29886,
386,
1495,
13,
4706,
11164,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
2084,
29892,
525,
9695,
293,
29889,
29886,
386,
1495,
13,
4706,
565,
4464,
1275,
525,
1359,
2396,
13,
9651,
565,
2897,
29889,
2084,
29889,
9933,
29898,
7168,
29918,
2084,
29897,
322,
2897,
29889,
2084,
29889,
9933,
29898,
9695,
293,
29918,
2084,
1125,
13,
18884,
1583,
29889,
7168,
29889,
1359,
29918,
3859,
29918,
8977,
29898,
7345,
305,
29889,
1359,
29898,
7168,
29918,
2084,
876,
13,
18884,
1583,
29889,
9695,
293,
29889,
1359,
29918,
3859,
29918,
8977,
29898,
7345,
305,
29889,
1359,
29898,
9695,
293,
29918,
2084,
876,
13,
4706,
1683,
29901,
13,
9651,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
2084,
1125,
13,
18884,
2897,
29889,
29885,
12535,
12935,
29898,
2084,
29897,
13,
9651,
4842,
305,
29889,
7620,
29898,
1311,
29889,
7168,
29889,
3859,
29918,
8977,
3285,
11339,
29918,
2084,
29897,
13,
9651,
4842,
305,
29889,
7620,
29898,
1311,
29889,
9695,
293,
29889,
3859,
29918,
8977,
3285,
11164,
29918,
2084,
29897,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
13,
2
] |
ckanext/federgob/FDG/merge_metadata.py | ontoquercus/ckanext-federgob | 1 | 99660 | <reponame>ontoquercus/ckanext-federgob
#!/usr/bin/python
# -*- coding: utf-8 -*-
#Script by: <NAME>
#Date: 28-10-2014
#Script to process the user metadata about the catalog.
#Get all the fields from fields.conf
fields_conf_file = open('fields.conf','r')
fields_lines = fields_conf_file.readlines()
fields_conf_file.close()
for line in fields_lines :
if '{-URL-CATALOG-} : ' in line : url_catalog = line.replace('{-URL-CATALOG-} : ','').replace('\n','')
elif '{-URL-DATASET-} : ' in line : url_dataset = line.replace('{-URL-DATASET-} : ','').replace('\n','')
elif '{-LANGUAGE-} : ' in line : language = line.replace('{-LANGUAGE-} : ','').replace('\n','')
elif '{-TITLE-} : ' in line : title = line.replace('{-TITLE-} : ','').replace('\n','')
elif '{-DESCRIPTION-} : ' in line : description = line.replace('{-DESCRIPTION-} : ','').replace('\n','')
elif '{-ISSUED-} : ' in line : issued = line.replace('{-ISSUED-} : ','').replace('\n','')
elif '{-URL-PUBLISHER-} : ' in line : url_publisher = line.replace('{-URL-PUBLISHER-} : ','').replace('\n','')
elif '{-URL-LICENSE-} : ' in line : url_license = line.replace('{-URL-LICENSE-} : ','').replace('\n','')
#Save the metadata in the base catalog.
fIn = open('base_catalog_template.rdf','r')
filedata = fIn.read()
fIn.close()
newdata = filedata.replace('{-URL-CATALOG-}',url_catalog)
newdata = newdata.replace('{-URL-DATASET-}',url_dataset)
newdata = newdata.replace('{-LANGUAGE-}',language)
newdata = newdata.replace('{-TITLE-}',title)
newdata = newdata.replace('{-DESCRIPTION-}',description)
newdata = newdata.replace('{-ISSUED-}',issued)
newdata = newdata.replace('{-URL-PUBLISHER-}',url_publisher)
newdata = newdata.replace('{-URL-LICENSE-}',url_license)
fOut = open('base_catalog.rdf','w')
fOut.write(newdata)
fOut.close()
| [
1,
529,
276,
1112,
420,
29958,
10268,
339,
6269,
375,
29914,
384,
273,
1062,
29899,
29888,
2447,
29887,
711,
13,
29937,
14708,
4855,
29914,
2109,
29914,
4691,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
13,
29937,
4081,
491,
29901,
529,
5813,
29958,
13,
29937,
2539,
29901,
29871,
29906,
29947,
29899,
29896,
29900,
29899,
29906,
29900,
29896,
29946,
13,
13,
29937,
4081,
304,
1889,
278,
1404,
15562,
1048,
278,
16653,
29889,
13,
13,
29937,
2577,
599,
278,
4235,
515,
4235,
29889,
5527,
13,
9621,
29918,
5527,
29918,
1445,
353,
1722,
877,
9621,
29889,
5527,
3788,
29878,
1495,
13,
9621,
29918,
9012,
353,
4235,
29918,
5527,
29918,
1445,
29889,
949,
9012,
580,
13,
9621,
29918,
5527,
29918,
1445,
29889,
5358,
580,
13,
13,
1454,
1196,
297,
4235,
29918,
9012,
584,
13,
12,
361,
525,
8499,
4219,
29899,
23972,
1964,
29949,
29954,
27154,
584,
525,
297,
1196,
584,
3142,
29918,
28045,
353,
1196,
29889,
6506,
877,
8499,
4219,
29899,
23972,
1964,
29949,
29954,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
12,
23681,
525,
8499,
4219,
29899,
25832,
8127,
29911,
27154,
584,
525,
297,
1196,
584,
3142,
29918,
24713,
353,
1196,
29889,
6506,
877,
8499,
4219,
29899,
25832,
8127,
29911,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
12,
23681,
525,
8499,
29931,
19453,
29965,
10461,
27154,
584,
525,
297,
1196,
584,
4086,
353,
1196,
29889,
6506,
877,
8499,
29931,
19453,
29965,
10461,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
12,
23681,
525,
8499,
29911,
1806,
1307,
27154,
584,
525,
297,
1196,
584,
3611,
353,
1196,
29889,
6506,
877,
8499,
29911,
1806,
1307,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
12,
23681,
525,
8499,
2287,
7187,
24290,
2725,
27154,
584,
525,
297,
1196,
584,
6139,
353,
1196,
29889,
6506,
877,
8499,
2287,
7187,
24290,
2725,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
12,
23681,
525,
8499,
29902,
1799,
29965,
3352,
27154,
584,
525,
297,
1196,
584,
16610,
353,
1196,
29889,
6506,
877,
8499,
29902,
1799,
29965,
3352,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
12,
23681,
525,
8499,
4219,
29899,
7056,
13367,
3235,
4448,
27154,
584,
525,
297,
1196,
584,
3142,
29918,
23679,
261,
353,
1196,
29889,
6506,
877,
8499,
4219,
29899,
7056,
13367,
3235,
4448,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
12,
23681,
525,
8499,
4219,
29899,
27888,
1430,
1660,
27154,
584,
525,
297,
1196,
584,
3142,
29918,
506,
1947,
353,
1196,
29889,
6506,
877,
8499,
4219,
29899,
27888,
1430,
1660,
27154,
584,
525,
5501,
2824,
6506,
28909,
29876,
3788,
1495,
13,
13,
13,
13,
29937,
11371,
278,
15562,
297,
278,
2967,
16653,
29889,
13,
29888,
797,
353,
1722,
877,
3188,
29918,
28045,
29918,
6886,
29889,
29878,
2176,
3788,
29878,
1495,
13,
1445,
1272,
353,
285,
797,
29889,
949,
580,
13,
29888,
797,
29889,
5358,
580,
13,
13,
1482,
1272,
353,
934,
1272,
29889,
6506,
877,
8499,
4219,
29899,
23972,
1964,
29949,
29954,
27154,
742,
2271,
29918,
28045,
29897,
13,
1482,
1272,
353,
716,
1272,
29889,
6506,
877,
8499,
4219,
29899,
25832,
8127,
29911,
27154,
742,
2271,
29918,
24713,
29897,
13,
1482,
1272,
353,
716,
1272,
29889,
6506,
877,
8499,
29931,
19453,
29965,
10461,
27154,
742,
11675,
29897,
13,
1482,
1272,
353,
716,
1272,
29889,
6506,
877,
8499,
29911,
1806,
1307,
27154,
742,
3257,
29897,
13,
1482,
1272,
353,
716,
1272,
29889,
6506,
877,
8499,
2287,
7187,
24290,
2725,
27154,
742,
8216,
29897,
13,
1482,
1272,
353,
716,
1272,
29889,
6506,
877,
8499,
29902,
1799,
29965,
3352,
27154,
742,
790,
6742,
29897,
13,
1482,
1272,
353,
716,
1272,
29889,
6506,
877,
8499,
4219,
29899,
7056,
13367,
3235,
4448,
27154,
742,
2271,
29918,
23679,
261,
29897,
13,
1482,
1272,
353,
716,
1272,
29889,
6506,
877,
8499,
4219,
29899,
27888,
1430,
1660,
27154,
742,
2271,
29918,
506,
1947,
29897,
13,
13,
29888,
3744,
353,
1722,
877,
3188,
29918,
28045,
29889,
29878,
2176,
3788,
29893,
1495,
13,
29888,
3744,
29889,
3539,
29898,
1482,
1272,
29897,
13,
29888,
3744,
29889,
5358,
580,
13,
2
] |
tests/test_topo.py | marrow-legacy/pulp.dependancy | 0 | 72329 | # encoding: utf-8
from unittest import TestCase
from pulp.wsgi.graph.registry import register, graph
from pulp.wsgi.graph.exception import *
from pulp.wsgi.graph.topo import resolve, leveled
@register
class A(object):
provides = ['foo']
@register
class B(object):
uses = ['foo', 'bar']
@register
class C(object):
after = '*'
@register
class D(object):
provides = ['bar']
needs = ['A']
class TestErrorConditions(TestCase):
pass
class TestResolve(TestCase):
def test_basic(self):
self.assertEquals(resolve([(1,2), (3,4), (5,6), (1,3), (1,5), (1,6), (2,5)]), [1, 2, 3, 5, 4, 6])
self.assertEquals(resolve([(1,2), (1,3), (2,4), (3,4), (5,6), (4,5)] ), [1, 2, 3, 4, 5, 6])
def test_errors(self):
self.assertRaises(CyclicDependancyError, lambda: resolve([(1,2), (2,3), (3,2)]))
class TestLeveledSort(TestCase):
def test_basic(self):
dependency_pairs = [(1,2), (3,4), (5,6), (1,3), (1,5), (1,6), (2,5)]
dependency_graph = [i for i in leveled(dependency_pairs)]
self.assertEquals(dependency_graph, [[1], [2, 3], [4, 5], [6]])
dependency_pairs = [(1,2), (1,3), (2,4), (3,4), (5,6), (4,5)]
dependency_graph = [i for i in leveled(dependency_pairs)]
self.assertEquals(dependency_graph, [[1], [2, 3], [4], [5], [6]])
def test_errors(self):
dependency_pairs = [(1,2), (2,3), (3,4), (4, 3)]
self.assertRaises(CyclicDependancyError, lambda: [i for i in leveled(dependency_pairs)])
class TestMiddlewareGraph(TestCase):
def test_classes(self):
self.assertEquals(resolve(graph()), [B, D, A, C])
| [
1,
396,
8025,
29901,
23616,
29899,
29947,
13,
13,
3166,
443,
27958,
1053,
4321,
8259,
13,
13,
3166,
9505,
29886,
29889,
5652,
3146,
29889,
4262,
29889,
1727,
6020,
1053,
6036,
29892,
3983,
13,
3166,
9505,
29886,
29889,
5652,
3146,
29889,
4262,
29889,
11739,
1053,
334,
13,
3166,
9505,
29886,
29889,
5652,
3146,
29889,
4262,
29889,
3332,
29877,
1053,
8814,
29892,
454,
345,
839,
13,
13,
13,
29992,
9573,
13,
1990,
319,
29898,
3318,
1125,
13,
1678,
8128,
353,
6024,
5431,
2033,
13,
13,
29992,
9573,
13,
1990,
350,
29898,
3318,
1125,
13,
1678,
3913,
353,
6024,
5431,
742,
525,
1646,
2033,
13,
13,
29992,
9573,
13,
1990,
315,
29898,
3318,
1125,
13,
1678,
1156,
353,
525,
29930,
29915,
13,
13,
29992,
9573,
13,
1990,
360,
29898,
3318,
1125,
13,
1678,
8128,
353,
6024,
1646,
2033,
13,
1678,
4225,
353,
6024,
29909,
2033,
13,
13,
13,
1990,
4321,
2392,
10983,
2187,
29898,
3057,
8259,
1125,
13,
1678,
1209,
13,
13,
13,
1990,
4321,
12375,
345,
29898,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
16121,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
14776,
29898,
17863,
4197,
29898,
29896,
29892,
29906,
511,
313,
29941,
29892,
29946,
511,
313,
29945,
29892,
29953,
511,
313,
29896,
29892,
29941,
511,
313,
29896,
29892,
29945,
511,
313,
29896,
29892,
29953,
511,
313,
29906,
29892,
29945,
4638,
511,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29945,
29892,
29871,
29946,
29892,
29871,
29953,
2314,
13,
4706,
1583,
29889,
9294,
14776,
29898,
17863,
4197,
29898,
29896,
29892,
29906,
511,
313,
29896,
29892,
29941,
511,
313,
29906,
29892,
29946,
511,
313,
29941,
29892,
29946,
511,
313,
29945,
29892,
29953,
511,
313,
29946,
29892,
29945,
4638,
10353,
518,
29896,
29892,
29871,
29906,
29892,
29871,
29941,
29892,
29871,
29946,
29892,
29871,
29945,
29892,
29871,
29953,
2314,
13,
268,
13,
1678,
822,
1243,
29918,
12523,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29907,
11078,
506,
8498,
355,
6906,
2392,
29892,
14013,
29901,
8814,
4197,
29898,
29896,
29892,
29906,
511,
313,
29906,
29892,
29941,
511,
313,
29941,
29892,
29906,
4638,
876,
13,
13,
13,
1990,
4321,
3226,
345,
839,
13685,
29898,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
16121,
29898,
1311,
1125,
13,
4706,
10609,
29918,
29886,
7121,
353,
17288,
29896,
29892,
29906,
511,
313,
29941,
29892,
29946,
511,
313,
29945,
29892,
29953,
511,
313,
29896,
29892,
29941,
511,
313,
29896,
29892,
29945,
511,
313,
29896,
29892,
29953,
511,
313,
29906,
29892,
29945,
4638,
13,
4706,
10609,
29918,
4262,
353,
518,
29875,
363,
474,
297,
454,
345,
839,
29898,
10836,
29918,
29886,
7121,
4638,
13,
4706,
1583,
29889,
9294,
14776,
29898,
10836,
29918,
4262,
29892,
5519,
29896,
1402,
518,
29906,
29892,
29871,
29941,
1402,
518,
29946,
29892,
29871,
29945,
1402,
518,
29953,
24960,
13,
308,
13,
4706,
10609,
29918,
29886,
7121,
353,
17288,
29896,
29892,
29906,
511,
313,
29896,
29892,
29941,
511,
313,
29906,
29892,
29946,
511,
313,
29941,
29892,
29946,
511,
313,
29945,
29892,
29953,
511,
313,
29946,
29892,
29945,
4638,
13,
4706,
10609,
29918,
4262,
353,
518,
29875,
363,
474,
297,
454,
345,
839,
29898,
10836,
29918,
29886,
7121,
4638,
13,
4706,
1583,
29889,
9294,
14776,
29898,
10836,
29918,
4262,
29892,
5519,
29896,
1402,
518,
29906,
29892,
29871,
29941,
1402,
518,
29946,
1402,
518,
29945,
1402,
518,
29953,
24960,
13,
268,
13,
1678,
822,
1243,
29918,
12523,
29898,
1311,
1125,
13,
4706,
10609,
29918,
29886,
7121,
353,
17288,
29896,
29892,
29906,
511,
313,
29906,
29892,
29941,
511,
313,
29941,
29892,
29946,
511,
313,
29946,
29892,
29871,
29941,
4638,
13,
4706,
1583,
29889,
9294,
29934,
1759,
267,
29898,
29907,
11078,
506,
8498,
355,
6906,
2392,
29892,
14013,
29901,
518,
29875,
363,
474,
297,
454,
345,
839,
29898,
10836,
29918,
29886,
7121,
29897,
2314,
13,
13,
13,
1990,
4321,
25411,
2519,
9527,
29898,
3057,
8259,
1125,
13,
1678,
822,
1243,
29918,
13203,
29898,
1311,
1125,
13,
4706,
1583,
29889,
9294,
14776,
29898,
17863,
29898,
4262,
25739,
518,
29933,
29892,
360,
29892,
319,
29892,
315,
2314,
13,
2
] |
aoc-2021/day5.py | flanggut/advent-of-code | 0 | 54036 | <gh_stars>0
import aoc
import numpy as np
def drawlinetogrid(grid, begin, end):
diff = end - begin
numpoints = np.max(np.abs(diff))
if numpoints == 0:
return
diff = diff / numpoints
for i in range(0, numpoints + 1):
coord = (begin + i * diff).astype(int)
grid[coord[0], coord[1]] += 1
data = aoc.get_data(5)[0]
board = np.zeros(shape=(1000, 1000))
for line in data:
begin, end = line.split(" -> ")
begin = np.array(begin.split(",")).astype(int)
end = np.array(end.split(",")).astype(int)
drawlinetogrid(board, begin, end)
print(np.count_nonzero(board >= 2))
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
263,
542,
13,
5215,
12655,
408,
7442,
13,
13,
13,
1753,
4216,
1915,
300,
468,
2429,
29898,
7720,
29892,
3380,
29892,
1095,
1125,
13,
1678,
2923,
353,
1095,
448,
3380,
13,
1678,
954,
9748,
353,
7442,
29889,
3317,
29898,
9302,
29889,
6897,
29898,
12765,
876,
13,
1678,
565,
954,
9748,
1275,
29871,
29900,
29901,
13,
4706,
736,
13,
1678,
2923,
353,
2923,
847,
954,
9748,
13,
1678,
363,
474,
297,
3464,
29898,
29900,
29892,
954,
9748,
718,
29871,
29896,
1125,
13,
4706,
29311,
353,
313,
463,
718,
474,
334,
2923,
467,
579,
668,
29898,
524,
29897,
13,
4706,
6856,
29961,
1111,
536,
29961,
29900,
1402,
29311,
29961,
29896,
5262,
4619,
29871,
29896,
13,
13,
13,
1272,
353,
263,
542,
29889,
657,
29918,
1272,
29898,
29945,
9601,
29900,
29962,
13,
13,
3377,
353,
7442,
29889,
3298,
359,
29898,
12181,
7607,
29896,
29900,
29900,
29900,
29892,
29871,
29896,
29900,
29900,
29900,
876,
13,
13,
1454,
1196,
297,
848,
29901,
13,
1678,
3380,
29892,
1095,
353,
1196,
29889,
5451,
703,
1599,
16521,
13,
1678,
3380,
353,
7442,
29889,
2378,
29898,
463,
29889,
5451,
28165,
1159,
467,
579,
668,
29898,
524,
29897,
13,
1678,
1095,
353,
7442,
29889,
2378,
29898,
355,
29889,
5451,
28165,
1159,
467,
579,
668,
29898,
524,
29897,
13,
1678,
4216,
1915,
300,
468,
2429,
29898,
3377,
29892,
3380,
29892,
1095,
29897,
13,
13,
2158,
29898,
9302,
29889,
2798,
29918,
5464,
9171,
29898,
3377,
6736,
29871,
29906,
876,
13,
2
] |
data-integration/getPANGAEA.py | enermaps/enermaps | 5 | 133336 | #!/usr/bin/env python3
"""
Pipeline for PANGAEA data, with custom NETCDF reading.
This script allows for data updates.
@author: giuseppeperonato
"""
import json
import logging
import os
import shutil
import sys
import frictionless
import numpy as np
import pandas as pd
import requests
import utilities
import xarray
from pyproj import CRS
# Constants
logging.basicConfig(level=logging.INFO)
Z = None
DT = 720
SEL = "MON"
EPSG = 4326 # source
# Settings for the query metadata
# these are the fields that are used to construct a query
QUERY_FIELDS = ["scale"] # empty list means all; None means do not use query fields.
# these are parameters that added to those automatically generated by the pipeline
QUERY_PARAMETERS = {
"temporal_granularity": "month",
"is_tiled": False,
"is_raster": True,
}
DB_URL = utilities.DB_URL
def prepareNETCDF(
df: pd.DataFrame,
crs: CRS = CRS.from_epsg(3035),
delete_orig: bool = False,
):
"""
Convert NetCDF into EnerMaps rasters (single band, GeoTiff, EPSG:3035).
Adapted to multi-dimensional NetCDF files as the ones from PANGAEA.
Parameters
----------
df : DataFrame.
Results of API extraction.
crs : pyproj.crs.CRS.
coordinate reference system.
delete_orig : bool, optional.
Set to True to delete original downloaded file (e.g. NetCDF).
Returns
-------
df : DataFrame
Results with schema for EnerMaps data table
"""
dicts = []
for i, row in df.iterrows():
filename_orig = row["value"]
logging.info(filename_orig)
xds = xarray.open_dataset(filename_orig)
if "crs" not in df.columns:
raise ValueError("Missing crs")
if "variable" not in df.columns:
raise ValueError("Missing variable")
xds.rio.write_crs(row["crs"].to_string(), inplace=True)
variable = row.variable
dims = list(xds[variable].dims)
if "lat" in dims:
dims.remove("lat")
if "lon" in dims:
dims.remove("lon")
def np_encoder(object):
"""Source: https://stackoverflow.com/a/65151218."""
if isinstance(object, np.generic):
return object.item()
def prepareFile(tmp_filename, dest_filename, my_dict, filename_orig):
"""Export raster."""
# Change day to 1st of the month, to be consistent across datasets
my_dict["start_at"] = my_dict["start_at"].replace(day=1)
if not os.path.exists(tmp_filename):
reprojected.rio.to_raster(tmp_filename)
dicts.append(my_dict)
# Compress
os.system( # nosec
"gdal_translate {filename} {dest_filename} -of GTIFF --config"
" GDAL_PAM_ENABLED NO -co COMPRESS=DEFLATE -co BIGTIFF=YES".format(
filename=tmp_filename, dest_filename=dest_filename
)
)
os.remove(tmp_filename)
return dicts
if len(dims) == 2:
for d0 in range(xds[variable][dims[0]].shape[0]):
for d1 in range(xds[variable][dims[1]].shape[0]):
my_dict = {}
dest_filename = "{}_{}_{}.tif".format(
filename_orig.split(".")[0], d0, d1
)
tmp_filename = "{}_{}_{}_tmp.tif".format(
filename_orig.split(".")[0], d0, d1
)
my_dict["fid"] = os.path.basename(dest_filename)
my_dict["variable"] = xds[variable][d0][d1].attrs["long_name"]
my_dict["unit"] = xds[variable][d0].attrs.get("units")
# Add extra fields
my_dict["fields"] = {
**xds.attrs, # at the dataset level
**xds[variable][d0][d1].attrs,
} # at the dimension level
for dim in dims:
if dim != "time": # add information about extra dimensions
my_dict["fields"][dim] = str(
xds[variable][d0][d1][dim].values
)
my_dict["fields"] = json.dumps(
my_dict["fields"], default=np_encoder
)
my_dict["israster"] = True
my_dict["start_at"] = pd.to_datetime(
xds[variable][d0][d1].time.values
)
date_future = my_dict["start_at"] + pd.DateOffset(months=1)
my_dict["dt"] = (
date_future - my_dict["start_at"]
).total_seconds() / 3600
# reproj
reprojected = xds[variable][d0][d1].rio.reproject(crs.to_string())
dicts = prepareFile(
tmp_filename, dest_filename, my_dict, filename_orig
)
elif len(dims) == 1:
for d0 in range(xds[variable][dims[0]].shape[0]):
my_dict = {}
dest_filename = "{}_{}.tif".format(filename_orig.split(".")[0], d0)
tmp_filename = "{}_{}_tmp.tif".format(filename_orig.split(".")[0], d0)
my_dict["fid"] = os.path.basename(dest_filename)
my_dict["variable"] = xds[variable][d0].attrs["long_name"]
my_dict["unit"] = xds[variable][d0].attrs.get("units")
# Add extra fields
my_dict["fields"] = {
**xds.attrs, # at the dataset level
**xds[variable][d0].attrs,
} # at the dimension level
my_dict["fields"] = json.dumps(my_dict["fields"], default=np_encoder)
my_dict["israster"] = True
my_dict["start_at"] = pd.to_datetime(xds[variable][d0].time.values)
date_future = my_dict["start_at"] + pd.DateOffset(months=1)
my_dict["dt"] = (
date_future - my_dict["start_at"]
).total_seconds() / 3600
# Reproject
if xds[variable][d0].dtype == "<m8[ns]":
# otherwise an error is thrown
reprojected = (
xds[variable][d0]
.astype(np.float32)
.rio.reproject(crs.to_string())
)
else:
reprojected = xds[variable][d0].rio.reproject(crs.to_string())
dicts = prepareFile(tmp_filename, dest_filename, my_dict, filename_orig)
else:
raise ValueError("Too many dimensions")
if delete_orig:
os.remove(filename_orig)
data = pd.DataFrame(
dicts,
columns=[
"start_at",
"fields",
"variable",
"value",
"ds_id",
"fid",
"dt",
"z",
"unit",
"israster",
],
)
return data
def prepare(dp: frictionless.package.Package):
"""
Prepare data in EnerMaps format.
Parameters
----------
dp : frictionless.package.Package
Valid datapackage
Returns
-------
DataFrame
Data in EnerMaps format.
"""
if not os.path.exists("tmp"):
os.mkdir("tmp")
for resource_idx, resource in enumerate(dp["resources"]):
file_list = resource["path"]
r = requests.get(file_list, stream=True)
lines = [line for line in r.iter_lines()]
skiprows = [ind for ind, i in enumerate(lines) if i.startswith(b"*/")][0]
files = pd.read_csv(file_list, skiprows=skiprows + 1, delimiter="\t")
files = files.loc[files["File name"].str.contains(SEL), :]
# Prepare df containing paths to rasters
rasters = []
for r, row in files.iterrows():
if not os.path.exists(os.path.join("tmp", row["File name"])):
logging.info("Downloading {}".format(row["File name"]))
utilities.download_url(
row["URL file"], os.path.join("tmp", row["File name"])
)
raster = {
"value": os.path.join("tmp", row["File name"]),
"start_at": pd.to_datetime(row["File name"].split("_")[6]),
"z": None,
"unit": None,
"dt": DT,
"crs": CRS.from_epsg(EPSG),
"variable": row["File name"].split("_")[0],
}
rasters.append(raster)
rasters = pd.DataFrame(rasters)
data_enermaps = prepareNETCDF(rasters, delete_orig=True)
return data_enermaps
def get(url: str, dp: frictionless.package.Package, force: bool = False):
"""
Retrieve data and check update.
Parameters
----------
url : str
URL to retrieve the data from.
dp : frictionless.package.Package
Datapackage against which validating the data.
force : Boolean, optional
If True, new data will be uploaded even if the same as in the db. The default is False.
Returns
-------
DataFrame
Data in EnerMaps format.
GeoDataFrame
Spatial data in EnerMaps format.
frictionless.package.Package
Pakage descring the data.
"""
ld = utilities.get_ld_json(url)
for resource in ld["distribution"]:
if resource["@type"] == "DataDownload":
if (
resource["encodingFormat"] == "CSV"
or resource["encodingFormat"] == "text/tab-separated-values"
):
file = resource["contentUrl"]
datePublished = ld["datePublished"]
# Inferring and completing metadata
logging.info("Creating datapackage for input data")
new_dp = frictionless.describe_package(
file,
stats=True,
) # Add stats
# Add date
new_dp["datePublished"] = datePublished
# Logic for update
if dp is not None: # Existing dataset
# check stats
isChangedStats = dp["resources"][0]["stats"] != new_dp["resources"][0]["stats"]
isChangedDate = dp["datePublished"] != new_dp["datePublished"]
if (
isChangedStats or isChangedDate
): # Data integration will continue, regardless of force argument
logging.info("Data has changed")
if utilities.isDFvalid(dp, new_dp):
enermaps_data = prepare(new_dp)
elif force: # Data integration will continue, even if data has not changed
logging.info("Forced update")
if utilities.isDFvalid(dp, new_dp):
enermaps_data = prepare(new_dp)
else: # Data integration will stop here, returning Nones
logging.info("Data has not changed. Use --force if you want to reupload.")
return None, None, None
else: # New dataset
dp = new_dp # this is just for the sake of the schema control
if utilities.isDFvalid(dp, new_dp):
enermaps_data = prepare(new_dp)
return enermaps_data, new_dp
if __name__ == "__main__":
datasets = pd.read_csv("datasets.csv", index_col=[0])
script_name = os.path.basename(sys.argv[0])
ds_ids, isForced = utilities.parser(script_name, datasets)
for ds_id in ds_ids:
logging.info("Retrieving Dataset {}".format(ds_id))
dp = utilities.getDataPackage(
ds_id,
DB_URL,
)
data, dp = get(datasets.loc[ds_id, "di_URL"], dp, isForced)
# Move rasters into the data directory
if not os.path.exists("data"):
os.mkdir("data")
if not os.path.exists(os.path.join("data", str(ds_id))):
os.mkdir(os.path.join("data", str(ds_id)))
for i, row in data.iterrows():
try:
shutil.move(
os.path.join("tmp", row.fid),
os.path.join("data", str(ds_id), row.fid),
)
except FileNotFoundError:
logging.error("File not found; {}".format(row.fid))
if isinstance(data, pd.DataFrame):
if utilities.datasetExists(
ds_id,
DB_URL,
):
utilities.removeDataset(ds_id, DB_URL)
logging.info("Removed existing dataset")
# Create dataset table
metadata = datasets.loc[ds_id].fillna("").to_dict()
metadata["datapackage"] = dp
# Add parameters as metadata
(
metadata["parameters"],
metadata["default_parameters"],
) = utilities.get_query_metadata(data, QUERY_FIELDS, QUERY_PARAMETERS)
metadata["datapackage"] = dp
metadata = json.dumps(metadata)
dataset = pd.DataFrame(
[
{
"ds_id": ds_id,
"metadata": metadata,
"shared_id": datasets.loc[ds_id, "shared_id"],
}
]
)
utilities.toPostgreSQL(
dataset,
DB_URL,
schema="datasets",
)
# Create data table
data["ds_id"] = ds_id
utilities.toPostgreSQL(
data,
DB_URL,
schema="data",
)
# Create empty spatial table
spatial = pd.DataFrame()
spatial[["fid", "ds_id"]] = data[["fid", "ds_id"]]
utilities.toPostgreSQL(
spatial,
DB_URL,
schema="spatial",
)
| [
1,
18787,
4855,
29914,
2109,
29914,
6272,
3017,
29941,
13,
15945,
29908,
13,
29925,
23828,
363,
349,
2190,
12739,
29923,
29909,
848,
29892,
411,
2888,
405,
2544,
29907,
4037,
5183,
29889,
13,
4013,
2471,
6511,
363,
848,
11217,
29889,
13,
13,
29992,
8921,
29901,
4005,
18005,
546,
12732,
13,
15945,
29908,
13,
13,
5215,
4390,
13,
5215,
12183,
13,
5215,
2897,
13,
5215,
528,
4422,
13,
5215,
10876,
13,
13,
5215,
1424,
2463,
2222,
13,
5215,
12655,
408,
7442,
13,
5215,
11701,
408,
10518,
13,
5215,
7274,
13,
5215,
3667,
1907,
13,
5215,
921,
2378,
13,
3166,
11451,
20865,
1053,
315,
12445,
13,
13,
29937,
5798,
1934,
13,
21027,
29889,
16121,
3991,
29898,
5563,
29922,
21027,
29889,
11690,
29897,
13,
29999,
353,
6213,
13,
12972,
353,
29871,
29955,
29906,
29900,
13,
1660,
29931,
353,
376,
22877,
29908,
13,
29923,
7024,
29954,
353,
29871,
29946,
29941,
29906,
29953,
29871,
396,
2752,
13,
13,
13,
29937,
19215,
363,
278,
2346,
15562,
13,
29937,
1438,
526,
278,
4235,
393,
526,
1304,
304,
3386,
263,
2346,
13,
13356,
24422,
29918,
3738,
6670,
8452,
353,
6796,
7052,
3108,
29871,
396,
4069,
1051,
2794,
599,
29936,
6213,
2794,
437,
451,
671,
2346,
4235,
29889,
13,
29937,
1438,
526,
4128,
393,
2715,
304,
1906,
6336,
5759,
491,
278,
16439,
13,
13356,
24422,
29918,
16320,
25797,
4945,
29903,
353,
426,
13,
1678,
376,
1356,
1971,
284,
29918,
629,
273,
1070,
537,
1115,
376,
10874,
613,
13,
1678,
376,
275,
29918,
29873,
2356,
1115,
7700,
29892,
13,
1678,
376,
275,
29918,
29878,
1901,
1115,
5852,
29892,
13,
29913,
13,
13,
4051,
29918,
4219,
353,
3667,
1907,
29889,
4051,
29918,
4219,
13,
13,
13,
1753,
19012,
6006,
29907,
4037,
29898,
13,
1678,
4489,
29901,
10518,
29889,
17271,
29892,
13,
1678,
2181,
29879,
29901,
315,
12445,
353,
315,
12445,
29889,
3166,
29918,
8961,
29887,
29898,
29941,
29900,
29941,
29945,
511,
13,
1678,
5217,
29918,
12683,
29901,
6120,
353,
7700,
29892,
13,
1125,
13,
1678,
9995,
13,
1678,
14806,
29871,
12670,
29907,
4037,
964,
15163,
29924,
2547,
364,
1901,
29879,
313,
14369,
3719,
29892,
1879,
29877,
29911,
2593,
29892,
382,
7024,
29954,
29901,
29941,
29900,
29941,
29945,
467,
13,
1678,
23255,
415,
287,
304,
2473,
29899,
12531,
12670,
29907,
4037,
2066,
408,
278,
6743,
515,
349,
2190,
12739,
29923,
29909,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
4489,
584,
3630,
4308,
29889,
13,
4706,
17212,
310,
3450,
4805,
428,
29889,
13,
1678,
2181,
29879,
584,
11451,
20865,
29889,
29883,
2288,
29889,
11341,
29903,
29889,
13,
539,
14821,
3407,
1788,
29889,
13,
1678,
5217,
29918,
12683,
584,
6120,
29892,
13136,
29889,
13,
4706,
3789,
304,
5852,
304,
5217,
2441,
16532,
934,
313,
29872,
29889,
29887,
29889,
12670,
29907,
4037,
467,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
4489,
584,
3630,
4308,
13,
4706,
17212,
411,
10938,
363,
15163,
29924,
2547,
848,
1591,
13,
13,
1678,
9995,
13,
1678,
9657,
29879,
353,
5159,
13,
1678,
363,
474,
29892,
1948,
297,
4489,
29889,
1524,
5727,
7295,
13,
4706,
10422,
29918,
12683,
353,
1948,
3366,
1767,
3108,
13,
4706,
12183,
29889,
3888,
29898,
9507,
29918,
12683,
29897,
13,
4706,
921,
6289,
353,
921,
2378,
29889,
3150,
29918,
24713,
29898,
9507,
29918,
12683,
29897,
13,
4706,
565,
376,
29883,
2288,
29908,
451,
297,
4489,
29889,
13099,
29901,
13,
9651,
12020,
7865,
2392,
703,
18552,
292,
2181,
29879,
1159,
13,
4706,
565,
376,
11918,
29908,
451,
297,
4489,
29889,
13099,
29901,
13,
9651,
12020,
7865,
2392,
703,
18552,
292,
2286,
1159,
13,
13,
4706,
921,
6289,
29889,
5378,
29889,
3539,
29918,
29883,
2288,
29898,
798,
3366,
29883,
2288,
16862,
517,
29918,
1807,
3285,
297,
6689,
29922,
5574,
29897,
13,
13,
4706,
2286,
353,
1948,
29889,
11918,
13,
4706,
3964,
29879,
353,
1051,
29898,
29916,
6289,
29961,
11918,
1822,
6229,
29879,
29897,
13,
13,
4706,
565,
376,
5066,
29908,
297,
3964,
29879,
29901,
13,
9651,
3964,
29879,
29889,
5992,
703,
5066,
1159,
13,
4706,
565,
376,
12957,
29908,
297,
3964,
29879,
29901,
13,
9651,
3964,
29879,
29889,
5992,
703,
12957,
1159,
13,
13,
4706,
822,
7442,
29918,
3977,
6119,
29898,
3318,
1125,
13,
9651,
9995,
4435,
29901,
2045,
597,
2417,
29889,
510,
29914,
29874,
29914,
29953,
29945,
29896,
29945,
29896,
29906,
29896,
29947,
1213,
15945,
13,
9651,
565,
338,
8758,
29898,
3318,
29892,
7442,
29889,
19206,
1125,
13,
18884,
736,
1203,
29889,
667,
580,
13,
13,
4706,
822,
19012,
2283,
29898,
7050,
29918,
9507,
29892,
2731,
29918,
9507,
29892,
590,
29918,
8977,
29892,
10422,
29918,
12683,
1125,
13,
9651,
9995,
26382,
364,
1901,
1213,
15945,
13,
9651,
396,
10726,
2462,
304,
29871,
29896,
303,
310,
278,
4098,
29892,
304,
367,
13747,
4822,
20035,
13,
9651,
590,
29918,
8977,
3366,
2962,
29918,
271,
3108,
353,
590,
29918,
8977,
3366,
2962,
29918,
271,
16862,
6506,
29898,
3250,
29922,
29896,
29897,
13,
13,
9651,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
7050,
29918,
9507,
1125,
13,
18884,
337,
4836,
287,
29889,
5378,
29889,
517,
29918,
29878,
1901,
29898,
7050,
29918,
9507,
29897,
13,
9651,
9657,
29879,
29889,
4397,
29898,
1357,
29918,
8977,
29897,
13,
13,
9651,
396,
422,
2139,
13,
9651,
2897,
29889,
5205,
29898,
29871,
396,
694,
3471,
13,
18884,
376,
29887,
12293,
29918,
21652,
426,
9507,
29913,
426,
7854,
29918,
9507,
29913,
448,
974,
21342,
29902,
4198,
1192,
2917,
29908,
13,
18884,
376,
402,
29928,
1964,
29918,
29925,
5194,
29918,
1430,
6181,
29928,
11698,
448,
1111,
4810,
3580,
26785,
29922,
2287,
10536,
3040,
448,
1111,
350,
6259,
24301,
4198,
29922,
21143,
1642,
4830,
29898,
13,
462,
1678,
10422,
29922,
7050,
29918,
9507,
29892,
2731,
29918,
9507,
29922,
7854,
29918,
9507,
13,
18884,
1723,
13,
9651,
1723,
13,
13,
9651,
2897,
29889,
5992,
29898,
7050,
29918,
9507,
29897,
13,
13,
9651,
736,
9657,
29879,
13,
13,
4706,
565,
7431,
29898,
6229,
29879,
29897,
1275,
29871,
29906,
29901,
13,
9651,
363,
270,
29900,
297,
3464,
29898,
29916,
6289,
29961,
11918,
3816,
6229,
29879,
29961,
29900,
29962,
1822,
12181,
29961,
29900,
29962,
1125,
13,
18884,
363,
270,
29896,
297,
3464,
29898,
29916,
6289,
29961,
11918,
3816,
6229,
29879,
29961,
29896,
29962,
1822,
12181,
29961,
29900,
29962,
1125,
13,
462,
1678,
590,
29918,
8977,
353,
6571,
13,
462,
1678,
2731,
29918,
9507,
353,
29850,
3227,
3227,
1836,
29873,
361,
1642,
4830,
29898,
13,
462,
4706,
10422,
29918,
12683,
29889,
5451,
17350,
1159,
29961,
29900,
1402,
270,
29900,
29892,
270,
29896,
13,
462,
1678,
1723,
13,
462,
1678,
13128,
29918,
9507,
353,
29850,
3227,
3227,
2403,
7050,
29889,
29873,
361,
1642,
4830,
29898,
13,
462,
4706,
10422,
29918,
12683,
29889,
5451,
17350,
1159,
29961,
29900,
1402,
270,
29900,
29892,
270,
29896,
13,
462,
1678,
1723,
13,
13,
462,
1678,
590,
29918,
8977,
3366,
29888,
333,
3108,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
7854,
29918,
9507,
29897,
13,
462,
1678,
590,
29918,
8977,
3366,
11918,
3108,
353,
921,
6289,
29961,
11918,
3816,
29881,
29900,
3816,
29881,
29896,
1822,
5552,
29879,
3366,
5426,
29918,
978,
3108,
13,
462,
1678,
590,
29918,
8977,
3366,
5441,
3108,
353,
921,
6289,
29961,
11918,
3816,
29881,
29900,
1822,
5552,
29879,
29889,
657,
703,
348,
1169,
1159,
13,
13,
462,
1678,
396,
3462,
4805,
4235,
13,
462,
1678,
590,
29918,
8977,
3366,
9621,
3108,
353,
426,
13,
462,
4706,
3579,
29916,
6289,
29889,
5552,
29879,
29892,
29871,
396,
472,
278,
8783,
3233,
13,
462,
4706,
3579,
29916,
6289,
29961,
11918,
3816,
29881,
29900,
3816,
29881,
29896,
1822,
5552,
29879,
29892,
13,
462,
1678,
500,
29871,
396,
472,
278,
9927,
3233,
13,
462,
1678,
363,
3964,
297,
3964,
29879,
29901,
13,
462,
4706,
565,
3964,
2804,
376,
2230,
1115,
29871,
396,
788,
2472,
1048,
4805,
13391,
13,
462,
9651,
590,
29918,
8977,
3366,
9621,
3108,
29961,
6229,
29962,
353,
851,
29898,
13,
462,
18884,
921,
6289,
29961,
11918,
3816,
29881,
29900,
3816,
29881,
29896,
3816,
6229,
1822,
5975,
13,
462,
9651,
1723,
13,
13,
462,
1678,
590,
29918,
8977,
3366,
9621,
3108,
353,
4390,
29889,
29881,
17204,
29898,
13,
462,
4706,
590,
29918,
8977,
3366,
9621,
12436,
2322,
29922,
9302,
29918,
3977,
6119,
13,
462,
1678,
1723,
13,
13,
462,
1678,
590,
29918,
8977,
3366,
275,
29878,
1901,
3108,
353,
5852,
13,
13,
462,
1678,
590,
29918,
8977,
3366,
2962,
29918,
271,
3108,
353,
10518,
29889,
517,
29918,
12673,
29898,
13,
462,
4706,
921,
6289,
29961,
11918,
3816,
29881,
29900,
3816,
29881,
29896,
1822,
2230,
29889,
5975,
13,
462,
1678,
1723,
13,
462,
1678,
2635,
29918,
29888,
9130,
353,
590,
29918,
8977,
3366,
2962,
29918,
271,
3108,
718,
10518,
29889,
2539,
10302,
29898,
10874,
29879,
29922,
29896,
29897,
13,
462,
1678,
590,
29918,
8977,
3366,
6008,
3108,
353,
313,
13,
462,
4706,
2635,
29918,
29888,
9130,
448,
590,
29918,
8977,
3366,
2962,
29918,
271,
3108,
13,
462,
1678,
13742,
7827,
29918,
23128,
580,
847,
29871,
29941,
29953,
29900,
29900,
13,
13,
462,
1678,
396,
337,
20865,
13,
462,
1678,
337,
4836,
287,
353,
921,
6289,
29961,
11918,
3816,
29881,
29900,
3816,
29881,
29896,
1822,
5378,
29889,
276,
4836,
29898,
29883,
2288,
29889,
517,
29918,
1807,
3101,
13,
13,
462,
1678,
9657,
29879,
353,
19012,
2283,
29898,
13,
462,
4706,
13128,
29918,
9507,
29892,
2731,
29918,
9507,
29892,
590,
29918,
8977,
29892,
10422,
29918,
12683,
13,
462,
1678,
1723,
13,
13,
4706,
25342,
7431,
29898,
6229,
29879,
29897,
1275,
29871,
29896,
29901,
13,
9651,
363,
270,
29900,
297,
3464,
29898,
29916,
6289,
29961,
11918,
3816,
6229,
29879,
29961,
29900,
29962,
1822,
12181,
29961,
29900,
29962,
1125,
13,
18884,
590,
29918,
8977,
353,
6571,
13,
18884,
2731,
29918,
9507,
353,
29850,
3227,
1836,
29873,
361,
1642,
4830,
29898,
9507,
29918,
12683,
29889,
5451,
17350,
1159,
29961,
29900,
1402,
270,
29900,
29897,
13,
18884,
13128,
29918,
9507,
353,
29850,
3227,
2403,
7050,
29889,
29873,
361,
1642,
4830,
29898,
9507,
29918,
12683,
29889,
5451,
17350,
1159,
29961,
29900,
1402,
270,
29900,
29897,
13,
13,
18884,
590,
29918,
8977,
3366,
29888,
333,
3108,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
7854,
29918,
9507,
29897,
13,
18884,
590,
29918,
8977,
3366,
11918,
3108,
353,
921,
6289,
29961,
11918,
3816,
29881,
29900,
1822,
5552,
29879,
3366,
5426,
29918,
978,
3108,
13,
18884,
590,
29918,
8977,
3366,
5441,
3108,
353,
921,
6289,
29961,
11918,
3816,
29881,
29900,
1822,
5552,
29879,
29889,
657,
703,
348,
1169,
1159,
13,
13,
18884,
396,
3462,
4805,
4235,
13,
18884,
590,
29918,
8977,
3366,
9621,
3108,
353,
426,
13,
462,
1678,
3579,
29916,
6289,
29889,
5552,
29879,
29892,
29871,
396,
472,
278,
8783,
3233,
13,
462,
1678,
3579,
29916,
6289,
29961,
11918,
3816,
29881,
29900,
1822,
5552,
29879,
29892,
13,
18884,
500,
29871,
396,
472,
278,
9927,
3233,
13,
18884,
590,
29918,
8977,
3366,
9621,
3108,
353,
4390,
29889,
29881,
17204,
29898,
1357,
29918,
8977,
3366,
9621,
12436,
2322,
29922,
9302,
29918,
3977,
6119,
29897,
13,
13,
18884,
590,
29918,
8977,
3366,
275,
29878,
1901,
3108,
353,
5852,
13,
13,
18884,
590,
29918,
8977,
3366,
2962,
29918,
271,
3108,
353,
10518,
29889,
517,
29918,
12673,
29898,
29916,
6289,
29961,
11918,
3816,
29881,
29900,
1822,
2230,
29889,
5975,
29897,
13,
18884,
2635,
29918,
29888,
9130,
353,
590,
29918,
8977,
3366,
2962,
29918,
271,
3108,
718,
10518,
29889,
2539,
10302,
29898,
10874,
29879,
29922,
29896,
29897,
13,
18884,
590,
29918,
8977,
3366,
6008,
3108,
353,
313,
13,
462,
1678,
2635,
29918,
29888,
9130,
448,
590,
29918,
8977,
3366,
2962,
29918,
271,
3108,
13,
18884,
13742,
7827,
29918,
23128,
580,
847,
29871,
29941,
29953,
29900,
29900,
13,
13,
18884,
396,
830,
4836,
13,
18884,
565,
921,
6289,
29961,
11918,
3816,
29881,
29900,
1822,
29881,
1853,
1275,
9872,
29885,
29947,
29961,
1983,
29962,
1115,
13,
462,
1678,
396,
6467,
385,
1059,
338,
12005,
13,
462,
1678,
337,
4836,
287,
353,
313,
13,
462,
4706,
921,
6289,
29961,
11918,
3816,
29881,
29900,
29962,
13,
462,
4706,
869,
579,
668,
29898,
9302,
29889,
7411,
29941,
29906,
29897,
13,
462,
4706,
869,
5378,
29889,
276,
4836,
29898,
29883,
2288,
29889,
517,
29918,
1807,
3101,
13,
462,
1678,
1723,
13,
18884,
1683,
29901,
13,
462,
1678,
337,
4836,
287,
353,
921,
6289,
29961,
11918,
3816,
29881,
29900,
1822,
5378,
29889,
276,
4836,
29898,
29883,
2288,
29889,
517,
29918,
1807,
3101,
13,
13,
18884,
9657,
29879,
353,
19012,
2283,
29898,
7050,
29918,
9507,
29892,
2731,
29918,
9507,
29892,
590,
29918,
8977,
29892,
10422,
29918,
12683,
29897,
13,
4706,
1683,
29901,
13,
9651,
12020,
7865,
2392,
703,
1762,
29877,
1784,
13391,
1159,
13,
13,
1678,
565,
5217,
29918,
12683,
29901,
13,
4706,
2897,
29889,
5992,
29898,
9507,
29918,
12683,
29897,
13,
13,
1678,
848,
353,
10518,
29889,
17271,
29898,
13,
4706,
9657,
29879,
29892,
13,
4706,
4341,
11759,
13,
9651,
376,
2962,
29918,
271,
613,
13,
9651,
376,
9621,
613,
13,
9651,
376,
11918,
613,
13,
9651,
376,
1767,
613,
13,
9651,
376,
6289,
29918,
333,
613,
13,
9651,
376,
29888,
333,
613,
13,
9651,
376,
6008,
613,
13,
9651,
376,
29920,
613,
13,
9651,
376,
5441,
613,
13,
9651,
376,
275,
29878,
1901,
613,
13,
4706,
21251,
13,
1678,
1723,
13,
13,
1678,
736,
848,
13,
13,
13,
1753,
19012,
29898,
6099,
29901,
1424,
2463,
2222,
29889,
5113,
29889,
14459,
1125,
13,
1678,
9995,
13,
1678,
349,
3445,
598,
848,
297,
15163,
29924,
2547,
3402,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
270,
29886,
584,
1424,
2463,
2222,
29889,
5113,
29889,
14459,
13,
3986,
15758,
1418,
481,
2229,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
3630,
4308,
13,
308,
3630,
297,
15163,
29924,
2547,
3402,
29889,
13,
1678,
9995,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
703,
7050,
29908,
1125,
13,
4706,
2897,
29889,
11256,
3972,
703,
7050,
1159,
13,
1678,
363,
6503,
29918,
13140,
29892,
6503,
297,
26985,
29898,
6099,
3366,
13237,
3108,
1125,
13,
4706,
934,
29918,
1761,
353,
6503,
3366,
2084,
3108,
13,
4706,
364,
353,
7274,
29889,
657,
29898,
1445,
29918,
1761,
29892,
4840,
29922,
5574,
29897,
13,
4706,
3454,
353,
518,
1220,
363,
1196,
297,
364,
29889,
1524,
29918,
9012,
580,
29962,
13,
4706,
14383,
5727,
353,
518,
513,
363,
1399,
29892,
474,
297,
26985,
29898,
9012,
29897,
565,
474,
29889,
27382,
2541,
29898,
29890,
29908,
3877,
1159,
3816,
29900,
29962,
13,
4706,
2066,
353,
10518,
29889,
949,
29918,
7638,
29898,
1445,
29918,
1761,
29892,
14383,
5727,
29922,
11014,
5727,
718,
29871,
29896,
29892,
28552,
543,
29905,
29873,
1159,
13,
4706,
2066,
353,
2066,
29889,
2029,
29961,
5325,
3366,
2283,
1024,
16862,
710,
29889,
11516,
29898,
1660,
29931,
511,
584,
29962,
13,
13,
4706,
396,
349,
3445,
598,
4489,
6943,
10898,
304,
364,
1901,
29879,
13,
4706,
364,
1901,
29879,
353,
5159,
13,
4706,
363,
364,
29892,
1948,
297,
2066,
29889,
1524,
5727,
7295,
13,
9651,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
359,
29889,
2084,
29889,
7122,
703,
7050,
613,
1948,
3366,
2283,
1024,
3108,
22164,
13,
18884,
12183,
29889,
3888,
703,
6767,
13234,
6571,
1642,
4830,
29898,
798,
3366,
2283,
1024,
3108,
876,
13,
18884,
3667,
1907,
29889,
10382,
29918,
2271,
29898,
13,
462,
1678,
1948,
3366,
4219,
934,
12436,
2897,
29889,
2084,
29889,
7122,
703,
7050,
613,
1948,
3366,
2283,
1024,
20068,
13,
18884,
1723,
13,
9651,
364,
1901,
353,
426,
13,
18884,
376,
1767,
1115,
2897,
29889,
2084,
29889,
7122,
703,
7050,
613,
1948,
3366,
2283,
1024,
3108,
511,
13,
18884,
376,
2962,
29918,
271,
1115,
10518,
29889,
517,
29918,
12673,
29898,
798,
3366,
2283,
1024,
16862,
5451,
703,
29918,
1159,
29961,
29953,
11724,
13,
18884,
376,
29920,
1115,
6213,
29892,
13,
18884,
376,
5441,
1115,
6213,
29892,
13,
18884,
376,
6008,
1115,
360,
29911,
29892,
13,
18884,
376,
29883,
2288,
1115,
315,
12445,
29889,
3166,
29918,
8961,
29887,
29898,
29923,
7024,
29954,
511,
13,
18884,
376,
11918,
1115,
1948,
3366,
2283,
1024,
16862,
5451,
703,
29918,
1159,
29961,
29900,
1402,
13,
9651,
500,
13,
9651,
364,
1901,
29879,
29889,
4397,
29898,
29878,
1901,
29897,
13,
1678,
364,
1901,
29879,
353,
10518,
29889,
17271,
29898,
29878,
1901,
29879,
29897,
13,
1678,
848,
29918,
759,
10339,
353,
19012,
6006,
29907,
4037,
29898,
29878,
1901,
29879,
29892,
5217,
29918,
12683,
29922,
5574,
29897,
13,
13,
1678,
736,
848,
29918,
759,
10339,
13,
13,
13,
1753,
679,
29898,
2271,
29901,
851,
29892,
270,
29886,
29901,
1424,
2463,
2222,
29889,
5113,
29889,
14459,
29892,
4889,
29901,
6120,
353,
7700,
1125,
13,
1678,
9995,
13,
13,
1678,
4649,
29878,
2418,
848,
322,
1423,
2767,
29889,
13,
13,
1678,
12662,
2699,
13,
1678,
448,
1378,
29899,
13,
1678,
3142,
584,
851,
13,
4706,
3988,
304,
10563,
278,
848,
515,
29889,
13,
1678,
270,
29886,
584,
1424,
2463,
2222,
29889,
5113,
29889,
14459,
13,
4706,
13373,
481,
2229,
2750,
607,
2854,
1218,
278,
848,
29889,
13,
1678,
4889,
584,
11185,
29892,
13136,
13,
4706,
960,
5852,
29892,
716,
848,
674,
367,
20373,
1584,
565,
278,
1021,
408,
297,
278,
4833,
29889,
450,
2322,
338,
7700,
29889,
13,
13,
1678,
16969,
13,
1678,
448,
22158,
13,
1678,
3630,
4308,
13,
4706,
3630,
297,
15163,
29924,
2547,
3402,
29889,
13,
1678,
1879,
29877,
17271,
13,
4706,
1706,
15238,
848,
297,
15163,
29924,
2547,
3402,
29889,
13,
1678,
1424,
2463,
2222,
29889,
5113,
29889,
14459,
13,
4706,
14371,
482,
5153,
5393,
278,
848,
29889,
13,
13,
1678,
9995,
13,
1678,
301,
29881,
353,
3667,
1907,
29889,
657,
29918,
430,
29918,
3126,
29898,
2271,
29897,
13,
1678,
363,
6503,
297,
301,
29881,
3366,
27691,
3108,
29901,
13,
4706,
565,
6503,
3366,
29992,
1853,
3108,
1275,
376,
1469,
22954,
1115,
13,
9651,
565,
313,
13,
18884,
6503,
3366,
22331,
5809,
3108,
1275,
376,
29907,
7597,
29908,
13,
18884,
470,
6503,
3366,
22331,
5809,
3108,
1275,
376,
726,
29914,
3891,
29899,
25048,
630,
29899,
5975,
29908,
13,
632,
1125,
13,
18884,
934,
353,
6503,
3366,
3051,
5983,
3108,
13,
1678,
2635,
21076,
3726,
353,
301,
29881,
3366,
1256,
21076,
3726,
3108,
13,
13,
1678,
396,
512,
571,
5393,
322,
1614,
1259,
15562,
13,
1678,
12183,
29889,
3888,
703,
9832,
1218,
1418,
481,
2229,
363,
1881,
848,
1159,
13,
1678,
716,
29918,
6099,
353,
1424,
2463,
2222,
29889,
2783,
29581,
29918,
5113,
29898,
13,
4706,
934,
29892,
13,
4706,
22663,
29922,
5574,
29892,
13,
1678,
1723,
29871,
396,
3462,
22663,
13,
1678,
396,
3462,
2635,
13,
1678,
716,
29918,
6099,
3366,
1256,
21076,
3726,
3108,
353,
2635,
21076,
3726,
13,
13,
1678,
396,
4522,
293,
363,
2767,
13,
1678,
565,
270,
29886,
338,
451,
6213,
29901,
29871,
396,
1222,
15423,
8783,
13,
4706,
396,
1423,
22663,
13,
4706,
338,
7590,
25060,
353,
270,
29886,
3366,
13237,
3108,
29961,
29900,
29962,
3366,
16202,
3108,
2804,
716,
29918,
6099,
3366,
13237,
3108,
29961,
29900,
29962,
3366,
16202,
3108,
13,
4706,
338,
7590,
2539,
353,
270,
29886,
3366,
1256,
21076,
3726,
3108,
2804,
716,
29918,
6099,
3366,
1256,
21076,
3726,
3108,
13,
13,
4706,
565,
313,
13,
9651,
338,
7590,
25060,
470,
338,
7590,
2539,
13,
308,
1125,
29871,
396,
3630,
13465,
674,
6773,
29892,
17126,
310,
4889,
2980,
13,
9651,
12183,
29889,
3888,
703,
1469,
756,
3939,
1159,
13,
9651,
565,
3667,
1907,
29889,
275,
4037,
3084,
29898,
6099,
29892,
716,
29918,
6099,
1125,
13,
18884,
427,
837,
2547,
29918,
1272,
353,
19012,
29898,
1482,
29918,
6099,
29897,
13,
4706,
25342,
4889,
29901,
29871,
396,
3630,
13465,
674,
6773,
29892,
1584,
565,
848,
756,
451,
3939,
13,
9651,
12183,
29889,
3888,
703,
2831,
1133,
2767,
1159,
13,
9651,
565,
3667,
1907,
29889,
275,
4037,
3084,
29898,
6099,
29892,
716,
29918,
6099,
1125,
13,
18884,
427,
837,
2547,
29918,
1272,
353,
19012,
29898,
1482,
29918,
6099,
29897,
13,
4706,
1683,
29901,
29871,
396,
3630,
13465,
674,
5040,
1244,
29892,
7863,
405,
2873,
13,
9651,
12183,
29889,
3888,
703,
1469,
756,
451,
3939,
29889,
4803,
1192,
10118,
565,
366,
864,
304,
337,
9009,
23157,
13,
9651,
736,
6213,
29892,
6213,
29892,
6213,
13,
1678,
1683,
29901,
29871,
396,
1570,
8783,
13,
4706,
270,
29886,
353,
716,
29918,
6099,
29871,
396,
445,
338,
925,
363,
278,
16563,
310,
278,
10938,
2761,
13,
4706,
565,
3667,
1907,
29889,
275,
4037,
3084,
29898,
6099,
29892,
716,
29918,
6099,
1125,
13,
9651,
427,
837,
2547,
29918,
1272,
353,
19012,
29898,
1482,
29918,
6099,
29897,
13,
13,
1678,
736,
427,
837,
2547,
29918,
1272,
29892,
716,
29918,
6099,
13,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
20035,
353,
10518,
29889,
949,
29918,
7638,
703,
14538,
1691,
29889,
7638,
613,
2380,
29918,
1054,
11759,
29900,
2314,
13,
1678,
2471,
29918,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
9675,
29889,
19218,
29961,
29900,
2314,
13,
1678,
18031,
29918,
4841,
29892,
338,
2831,
1133,
353,
3667,
1907,
29889,
16680,
29898,
2154,
29918,
978,
29892,
20035,
29897,
13,
13,
1678,
363,
18031,
29918,
333,
297,
18031,
29918,
4841,
29901,
13,
4706,
12183,
29889,
3888,
703,
8015,
2546,
1747,
13373,
24541,
6571,
1642,
4830,
29898,
6289,
29918,
333,
876,
13,
4706,
270,
29886,
353,
3667,
1907,
29889,
657,
1469,
14459,
29898,
13,
9651,
18031,
29918,
333,
29892,
13,
9651,
6535,
29918,
4219,
29892,
13,
4706,
1723,
13,
13,
4706,
848,
29892,
270,
29886,
353,
679,
29898,
14538,
1691,
29889,
2029,
29961,
6289,
29918,
333,
29892,
376,
6051,
29918,
4219,
12436,
270,
29886,
29892,
338,
2831,
1133,
29897,
13,
13,
4706,
396,
25249,
364,
1901,
29879,
964,
278,
848,
3884,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
703,
1272,
29908,
1125,
13,
9651,
2897,
29889,
11256,
3972,
703,
1272,
1159,
13,
4706,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
359,
29889,
2084,
29889,
7122,
703,
1272,
613,
851,
29898,
6289,
29918,
333,
876,
1125,
13,
9651,
2897,
29889,
11256,
3972,
29898,
359,
29889,
2084,
29889,
7122,
703,
1272,
613,
851,
29898,
6289,
29918,
333,
4961,
13,
4706,
363,
474,
29892,
1948,
297,
848,
29889,
1524,
5727,
7295,
13,
9651,
1018,
29901,
13,
18884,
528,
4422,
29889,
11631,
29898,
13,
462,
1678,
2897,
29889,
2084,
29889,
7122,
703,
7050,
613,
1948,
29889,
29888,
333,
511,
13,
462,
1678,
2897,
29889,
2084,
29889,
7122,
703,
1272,
613,
851,
29898,
6289,
29918,
333,
511,
1948,
29889,
29888,
333,
511,
13,
18884,
1723,
13,
9651,
5174,
3497,
17413,
2392,
29901,
13,
18884,
12183,
29889,
2704,
703,
2283,
451,
1476,
29936,
6571,
1642,
4830,
29898,
798,
29889,
29888,
333,
876,
13,
13,
4706,
565,
338,
8758,
29898,
1272,
29892,
10518,
29889,
17271,
1125,
13,
9651,
565,
3667,
1907,
29889,
24713,
24217,
29898,
13,
18884,
18031,
29918,
333,
29892,
13,
18884,
6535,
29918,
4219,
29892,
13,
632,
1125,
13,
18884,
3667,
1907,
29889,
5992,
16390,
24541,
29898,
6289,
29918,
333,
29892,
6535,
29918,
4219,
29897,
13,
18884,
12183,
29889,
3888,
703,
7301,
8238,
5923,
8783,
1159,
13,
13,
9651,
396,
6204,
8783,
1591,
13,
9651,
15562,
353,
20035,
29889,
2029,
29961,
6289,
29918,
333,
1822,
5589,
1056,
703,
2564,
517,
29918,
8977,
580,
13,
9651,
15562,
3366,
4130,
481,
2229,
3108,
353,
270,
29886,
13,
9651,
396,
3462,
4128,
408,
15562,
13,
9651,
313,
13,
18884,
15562,
3366,
16744,
12436,
13,
18884,
15562,
3366,
4381,
29918,
16744,
12436,
13,
9651,
1723,
353,
3667,
1907,
29889,
657,
29918,
1972,
29918,
19635,
29898,
1272,
29892,
660,
29965,
24422,
29918,
3738,
6670,
8452,
29892,
660,
29965,
24422,
29918,
16320,
25797,
4945,
29903,
29897,
13,
9651,
15562,
3366,
4130,
481,
2229,
3108,
353,
270,
29886,
13,
9651,
15562,
353,
4390,
29889,
29881,
17204,
29898,
19635,
29897,
13,
9651,
8783,
353,
10518,
29889,
17271,
29898,
13,
18884,
518,
13,
462,
1678,
426,
13,
462,
4706,
376,
6289,
29918,
333,
1115,
18031,
29918,
333,
29892,
13,
462,
4706,
376,
19635,
1115,
15562,
29892,
13,
462,
4706,
376,
12366,
29918,
333,
1115,
20035,
29889,
2029,
29961,
6289,
29918,
333,
29892,
376,
12366,
29918,
333,
12436,
13,
462,
1678,
500,
13,
18884,
4514,
13,
9651,
1723,
13,
9651,
3667,
1907,
29889,
517,
6747,
7979,
4176,
29898,
13,
18884,
8783,
29892,
13,
18884,
6535,
29918,
4219,
29892,
13,
18884,
10938,
543,
14538,
1691,
613,
13,
9651,
1723,
13,
13,
9651,
396,
6204,
848,
1591,
13,
9651,
848,
3366,
6289,
29918,
333,
3108,
353,
18031,
29918,
333,
13,
9651,
3667,
1907,
29889,
517,
6747,
7979,
4176,
29898,
13,
18884,
848,
29892,
13,
18884,
6535,
29918,
4219,
29892,
13,
18884,
10938,
543,
1272,
613,
13,
9651,
1723,
13,
13,
9651,
396,
6204,
4069,
18652,
1591,
13,
9651,
18652,
353,
10518,
29889,
17271,
580,
13,
9651,
18652,
29961,
3366,
29888,
333,
613,
376,
6289,
29918,
333,
3108,
29962,
353,
848,
29961,
3366,
29888,
333,
613,
376,
6289,
29918,
333,
3108,
29962,
13,
9651,
3667,
1907,
29889,
517,
6747,
7979,
4176,
29898,
13,
18884,
18652,
29892,
13,
18884,
6535,
29918,
4219,
29892,
13,
18884,
10938,
543,
1028,
15238,
613,
13,
9651,
1723,
13,
2
] |
examples/assessing_frontier/zt_loader.py | OscarDeGar/py_grama | 13 | 37678 | ## Data Loader: TE-CCA zT Dataset
# <NAME> (<EMAIL>) 2021-03-12
#
from citrination_client import CitrinationClient, PifSystemReturningQuery
from citrination_client import DataQuery, DatasetQuery, Filter
from matminer.featurizers.base import MultipleFeaturizer
from matminer.featurizers import composition as cf
from pymatgen import Composition
from sl_utils import pifs2df, setResDir
import pandas as pd
import numpy as np
import os
import time
prefix = "zT"
file_responses = prefix + "_responses.csv"
file_features = prefix + "_features.csv"
## Helper functions
def get_compostion(c):
"""Attempt to parse composition, return None if failed"""
try:
return Composition(c)
except:
return None
def load_data_zT():
results_dir = setResDir()
## Metadata
keys_response = [
'Seebeck coefficient; squared',
'Electrical resistivity',
'Thermal conductivity'
]
sign = np.array([
+1, # Seebeck
-1, # Electric resistivity
-1 # Thermal conductivity
])
## Load data, if possible
# --------------------------------------------------
try:
df_X_all = pd.read_csv(results_dir + file_features)
X_all = df_X_all.drop(df_X_all.columns[0], axis = 1).values
df_Y_all = pd.read_csv(results_dir + file_responses)
Y_all = df_Y_all.drop(df_Y_all.columns[0], axis = 1).values
print("Cached data loaded.")
except FileNotFoundError:
## Data Import
# --------------------------------------------------
# Initialize client
print("Accessing data from Citrination...")
site = 'https://citrination.com' # Citrination
client = CitrinationClient(api_key=os.environ['CITRINATION_API_KEY'], site=site)
search_client = client.search
# Aluminum dataset
dataset_id = 178480 # ucsb_te_roomtemp_seebeck
system_query = PifSystemReturningQuery(
size=1000,
query=DataQuery(
dataset=DatasetQuery(id=Filter(equal=str(dataset_id)))
)
)
query_result = search_client.pif_search(system_query)
print(" Found {} PIFs in dataset {}.".format(
query_result.total_num_hits,
dataset_id
))
## Wrangle
# --------------------------------------------------
pifs = [x.system for x in query_result.hits]
# Utility function will tabularize PIFs
df_response = pifs2df(pifs)
# Down-select columns to play well with to_numeric
df_response = df_response[
['Seebeck coefficient', 'Electrical resistivity', 'Thermal conductivity']
]
df_response = df_response.apply(pd.to_numeric)
# Parse chemical compositions
formulas = [pif.chemical_formula for pif in pifs]
df_comp = pd.DataFrame(
columns = ['chemical_formula'],
data = formulas
)
# Join
df_data = pd.concat([df_comp, df_response], axis = 1)
print(" Accessed data.")
# Featurize
print("Featurizing data...")
df_data['composition'] = df_data['chemical_formula'].apply(get_compostion)
f = MultipleFeaturizer([
cf.Stoichiometry(),
cf.ElementProperty.from_preset("magpie"),
cf.ValenceOrbital(props=['avg']),
cf.IonProperty(fast=True)
])
X = np.array(f.featurize_many(df_data['composition']))
# Find valid response values
keys_original = [
'Seebeck coefficient',
'Electrical resistivity',
'Thermal conductivity'
]
index_valid_response = {
key: df_data[key].dropna().index.values for key in keys_original
}
index_valid_all = df_data[keys_original].dropna().index.values
X_all = X[index_valid_all, :]
Y_all = df_data[keys_original].iloc[index_valid_all].values
# Manipulate columns for proper objective values
Y_all[:, 0] = Y_all[:, 0] ** 2 # Squared seebeck
print(" Data prepared; {0:} valid observations.".format(X_all.shape[0]))
# Cache data
pd.DataFrame(data = X_all).to_csv(results_dir + file_features)
pd.DataFrame(
data = Y_all,
columns = keys_response
).to_csv(results_dir + file_responses)
print("Data cached in results directory.")
return X_all, Y_all, sign, keys_response, prefix
if __name__ == "__main__":
X_all, Y_all, sign, keys_response, prefix = load_data_zT()
| [
1,
444,
3630,
4309,
1664,
29901,
17067,
29899,
4174,
29909,
503,
29911,
13373,
24541,
13,
29937,
529,
5813,
29958,
313,
29966,
26862,
6227,
12948,
29871,
29906,
29900,
29906,
29896,
29899,
29900,
29941,
29899,
29896,
29906,
13,
29937,
13,
3166,
7537,
29878,
3381,
29918,
4645,
1053,
21353,
29878,
3381,
4032,
29892,
349,
361,
3924,
11609,
292,
3010,
13,
3166,
7537,
29878,
3381,
29918,
4645,
1053,
3630,
3010,
29892,
13373,
24541,
3010,
29892,
19916,
13,
3166,
1775,
1195,
261,
29889,
1725,
1337,
19427,
29889,
3188,
1053,
26905,
8263,
1337,
3950,
13,
3166,
1775,
1195,
261,
29889,
1725,
1337,
19427,
1053,
15259,
408,
274,
29888,
13,
3166,
282,
962,
271,
1885,
1053,
422,
3283,
13,
13,
3166,
2243,
29918,
13239,
1053,
282,
10270,
29906,
2176,
29892,
731,
1666,
9170,
13,
13,
5215,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
5215,
2897,
13,
5215,
931,
13,
13,
13506,
353,
376,
29920,
29911,
29908,
13,
1445,
29918,
26679,
267,
353,
10944,
718,
11119,
26679,
267,
29889,
7638,
29908,
13,
1445,
29918,
22100,
29871,
353,
10944,
718,
11119,
22100,
29889,
7638,
29908,
13,
13,
2277,
6162,
546,
3168,
13,
1753,
679,
29918,
2388,
520,
291,
29898,
29883,
1125,
13,
1678,
9995,
4165,
3456,
304,
6088,
15259,
29892,
736,
6213,
565,
5229,
15945,
29908,
13,
13,
1678,
1018,
29901,
13,
4706,
736,
422,
3283,
29898,
29883,
29897,
13,
1678,
5174,
29901,
13,
4706,
736,
6213,
13,
13,
1753,
2254,
29918,
1272,
29918,
29920,
29911,
7295,
13,
1678,
2582,
29918,
3972,
353,
731,
1666,
9170,
580,
13,
13,
1678,
444,
4737,
7221,
13,
1678,
6611,
29918,
5327,
353,
518,
13,
4706,
525,
2008,
774,
29872,
384,
10825,
29936,
10674,
1965,
742,
13,
4706,
525,
29923,
781,
16888,
9241,
2068,
742,
13,
4706,
525,
1349,
837,
284,
7512,
2068,
29915,
13,
539,
4514,
13,
1678,
1804,
353,
7442,
29889,
2378,
4197,
13,
4706,
718,
29896,
29892,
396,
922,
774,
29872,
384,
13,
4706,
448,
29896,
29892,
396,
26953,
9241,
2068,
13,
4706,
448,
29896,
29871,
396,
498,
837,
284,
7512,
2068,
13,
4706,
2314,
13,
13,
1678,
444,
16012,
848,
29892,
565,
1950,
13,
1678,
396,
448,
2683,
2683,
2683,
29899,
13,
1678,
1018,
29901,
13,
4706,
4489,
29918,
29990,
29918,
497,
353,
10518,
29889,
949,
29918,
7638,
29898,
9902,
29918,
3972,
718,
934,
29918,
22100,
29897,
13,
4706,
1060,
29918,
497,
353,
4489,
29918,
29990,
29918,
497,
29889,
8865,
29898,
2176,
29918,
29990,
29918,
497,
29889,
13099,
29961,
29900,
1402,
9685,
353,
29871,
29896,
467,
5975,
13,
13,
4706,
4489,
29918,
29979,
29918,
497,
353,
10518,
29889,
949,
29918,
7638,
29898,
9902,
29918,
3972,
718,
934,
29918,
26679,
267,
29897,
13,
4706,
612,
29918,
497,
353,
4489,
29918,
29979,
29918,
497,
29889,
8865,
29898,
2176,
29918,
29979,
29918,
497,
29889,
13099,
29961,
29900,
1402,
9685,
353,
29871,
29896,
467,
5975,
13,
4706,
1596,
703,
29907,
3791,
848,
7500,
23157,
13,
13,
1678,
5174,
3497,
17413,
2392,
29901,
13,
4706,
444,
3630,
16032,
13,
4706,
396,
448,
2683,
2683,
2683,
29899,
13,
4706,
396,
25455,
3132,
13,
4706,
1596,
703,
6638,
292,
848,
515,
21353,
29878,
3381,
856,
1159,
13,
4706,
3268,
353,
525,
991,
597,
20752,
29878,
3381,
29889,
510,
29915,
396,
21353,
29878,
3381,
13,
4706,
3132,
353,
21353,
29878,
3381,
4032,
29898,
2754,
29918,
1989,
29922,
359,
29889,
21813,
1839,
29907,
1806,
29934,
1177,
8098,
29918,
8787,
29918,
10818,
7464,
3268,
29922,
2746,
29897,
13,
4706,
2740,
29918,
4645,
353,
3132,
29889,
4478,
13,
4706,
396,
838,
9735,
398,
8783,
13,
4706,
8783,
29918,
333,
353,
29871,
29896,
29955,
29947,
29946,
29947,
29900,
396,
318,
2395,
29890,
29918,
371,
29918,
8345,
7382,
29918,
344,
774,
29872,
384,
13,
4706,
1788,
29918,
1972,
353,
349,
361,
3924,
11609,
292,
3010,
29898,
13,
9651,
2159,
29922,
29896,
29900,
29900,
29900,
29892,
13,
9651,
2346,
29922,
1469,
3010,
29898,
13,
18884,
8783,
29922,
16390,
24541,
3010,
29898,
333,
29922,
5072,
29898,
11745,
29922,
710,
29898,
24713,
29918,
333,
4961,
13,
9651,
1723,
13,
965,
1723,
13,
13,
4706,
2346,
29918,
2914,
353,
2740,
29918,
4645,
29889,
29886,
361,
29918,
4478,
29898,
5205,
29918,
1972,
29897,
13,
4706,
1596,
703,
1678,
7460,
6571,
349,
6545,
29879,
297,
8783,
6571,
1213,
29889,
4830,
29898,
13,
9651,
2346,
29918,
2914,
29889,
7827,
29918,
1949,
29918,
29882,
1169,
29892,
13,
9651,
8783,
29918,
333,
13,
308,
876,
13,
13,
4706,
444,
399,
5854,
13,
4706,
396,
448,
2683,
2683,
2683,
29899,
13,
4706,
282,
10270,
353,
518,
29916,
29889,
5205,
363,
921,
297,
2346,
29918,
2914,
29889,
29882,
1169,
29962,
13,
4706,
396,
22310,
537,
740,
674,
4434,
1070,
675,
349,
6545,
29879,
13,
4706,
4489,
29918,
5327,
353,
282,
10270,
29906,
2176,
29898,
29886,
10270,
29897,
13,
4706,
396,
9943,
29899,
2622,
4341,
304,
1708,
1532,
411,
304,
29918,
21574,
13,
4706,
4489,
29918,
5327,
353,
4489,
29918,
5327,
29961,
13,
9651,
6024,
2008,
774,
29872,
384,
10825,
742,
525,
29923,
781,
16888,
9241,
2068,
742,
525,
1349,
837,
284,
7512,
2068,
2033,
13,
965,
4514,
13,
4706,
4489,
29918,
5327,
353,
4489,
29918,
5327,
29889,
7302,
29898,
15926,
29889,
517,
29918,
21574,
29897,
13,
13,
4706,
396,
20969,
22233,
5541,
2187,
13,
4706,
26760,
353,
518,
29886,
361,
29889,
14969,
936,
29918,
689,
2497,
363,
282,
361,
297,
282,
10270,
29962,
13,
13,
4706,
4489,
29918,
2388,
353,
10518,
29889,
17271,
29898,
13,
9651,
4341,
353,
6024,
14969,
936,
29918,
689,
2497,
7464,
13,
9651,
848,
353,
26760,
13,
965,
1723,
13,
13,
4706,
396,
3650,
262,
13,
4706,
4489,
29918,
1272,
353,
10518,
29889,
17685,
4197,
2176,
29918,
2388,
29892,
4489,
29918,
5327,
1402,
9685,
353,
29871,
29896,
29897,
13,
4706,
1596,
703,
1678,
11028,
287,
848,
23157,
13,
13,
4706,
396,
5169,
1337,
675,
13,
4706,
1596,
703,
8263,
1337,
5281,
848,
856,
1159,
13,
4706,
4489,
29918,
1272,
1839,
510,
3283,
2033,
353,
4489,
29918,
1272,
1839,
14969,
936,
29918,
689,
2497,
13359,
7302,
29898,
657,
29918,
2388,
520,
291,
29897,
13,
13,
4706,
285,
353,
29871,
26905,
8263,
1337,
3950,
4197,
13,
9651,
274,
29888,
29889,
20754,
18544,
7843,
3285,
13,
9651,
274,
29888,
29889,
2642,
4854,
29889,
3166,
29918,
4569,
300,
703,
11082,
12343,
4968,
13,
9651,
274,
29888,
29889,
1440,
663,
2816,
29890,
2410,
29898,
11030,
29922,
1839,
485,
29887,
2033,
511,
13,
9651,
274,
29888,
29889,
29902,
265,
4854,
29898,
11255,
29922,
5574,
29897,
13,
9651,
2314,
13,
13,
4706,
1060,
353,
7442,
29889,
2378,
29898,
29888,
29889,
1725,
1337,
675,
29918,
13011,
29898,
2176,
29918,
1272,
1839,
510,
3283,
25901,
13,
13,
4706,
396,
10987,
2854,
2933,
1819,
13,
4706,
6611,
29918,
13492,
353,
518,
13,
9651,
525,
2008,
774,
29872,
384,
10825,
742,
13,
9651,
525,
29923,
781,
16888,
9241,
2068,
742,
13,
9651,
525,
1349,
837,
284,
7512,
2068,
29915,
13,
965,
4514,
13,
13,
4706,
2380,
29918,
3084,
29918,
5327,
353,
426,
13,
9651,
1820,
29901,
4489,
29918,
1272,
29961,
1989,
1822,
8865,
1056,
2141,
2248,
29889,
5975,
363,
1820,
297,
6611,
29918,
13492,
13,
965,
500,
13,
13,
4706,
2380,
29918,
3084,
29918,
497,
353,
4489,
29918,
1272,
29961,
8149,
29918,
13492,
1822,
8865,
1056,
2141,
2248,
29889,
5975,
13,
4706,
1060,
29918,
497,
965,
353,
1060,
29961,
2248,
29918,
3084,
29918,
497,
29892,
584,
29962,
13,
4706,
612,
29918,
497,
965,
353,
4489,
29918,
1272,
29961,
8149,
29918,
13492,
1822,
309,
542,
29961,
2248,
29918,
3084,
29918,
497,
1822,
5975,
13,
13,
4706,
396,
2315,
666,
5987,
4341,
363,
1571,
12091,
1819,
13,
4706,
612,
29918,
497,
7503,
29892,
29871,
29900,
29962,
353,
612,
29918,
497,
7503,
29892,
29871,
29900,
29962,
3579,
29871,
29906,
396,
317,
339,
1965,
409,
774,
29872,
384,
13,
4706,
1596,
703,
1678,
3630,
13240,
29936,
426,
29900,
3854,
2854,
13917,
1213,
29889,
4830,
29898,
29990,
29918,
497,
29889,
12181,
29961,
29900,
12622,
13,
13,
4706,
396,
28540,
848,
13,
4706,
10518,
29889,
17271,
29898,
1272,
353,
1060,
29918,
497,
467,
517,
29918,
7638,
29898,
9902,
29918,
3972,
718,
934,
29918,
22100,
29897,
13,
4706,
10518,
29889,
17271,
29898,
13,
9651,
848,
353,
612,
29918,
497,
29892,
13,
9651,
4341,
353,
6611,
29918,
5327,
13,
4706,
13742,
517,
29918,
7638,
29898,
9902,
29918,
3972,
718,
934,
29918,
26679,
267,
29897,
13,
4706,
1596,
703,
1469,
22152,
297,
2582,
3884,
23157,
13,
308,
13,
1678,
736,
1060,
29918,
497,
29892,
612,
29918,
497,
29892,
1804,
29892,
6611,
29918,
5327,
29892,
10944,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
1060,
29918,
497,
29892,
612,
29918,
497,
29892,
1804,
29892,
6611,
29918,
5327,
29892,
10944,
353,
2254,
29918,
1272,
29918,
29920,
29911,
580,
13,
2
] |
test.py | Yanrs/PokemonGoInBrazil | 0 | 130365 | <reponame>Yanrs/PokemonGoInBrazil
import sys
import unittest
from unittest.mock import patch, Mock
import urllib.request
import urllib.error
import http.client
import main
# Pokemon Go in Brazil Test Suite
# --------------------------------
# For the HTML Parser tests, unicode strings
# are encoded to utf-8 in bytes, then passed into
# the feed methods as string decoded into the system's
# default encoding. This is done because the parser expects
# a string that is formatted to the system's default encoding
# so it can then encode that to the system's default encoding
# in bytes, then decode to utf-8.
class TestingPokemonGoMethods(unittest.TestCase):
def test_pokemonHTMLParser(self):
parser = main.PokemonHTMLParser()
myBytes = "<html><meta content=\"Pokémon GO on the App Store\"></meta></html>".encode("utf-8")
parser.feed(myBytes.decode(sys.stdout.encoding))
self.assertEqual(parser.didFindGo(), True)
def test_pokemonHTMLParser_pokemonGoFind(self):
parser = main.PokemonHTMLParser()
myBytes = "<html><meta content=\"fgfdsdfgsdfgdfsgdfPokémon GOsdfgdsfgfdgdfsgdfg\"></meta></html>".encode("utf-8")
parser.feed(myBytes.decode(sys.stdout.encoding))
self.assertEqual(parser.didFindGo(), True)
def test_pokemonHTMLParser_noContent(self):
parser = main.PokemonHTMLParser()
myBytes = "<html></html>".encode("utf-8")
parser.feed(myBytes.decode(sys.stdout.encoding))
self.assertEqual(parser.didFindGo(), False)
def test_pokemonHTMLParser_noPokemonGo(self):
parser = main.PokemonHTMLParser()
parser.feed("<html><meta content=\"Digimon NO\"></meta></html>")
self.assertEqual(parser.didFindGo(), False)
@patch("urllib.request.urlopen")
def test_checkForPokemonGo(self, urlopen_mock):
urlopen_mock.return_value = Mock(spec=http.client.HTTPResponse)
urlopen_mock.return_value.read.return_value = "<html><meta content=\"Pokémon GO on the App Store\"></meta></html>".encode("utf-8")
self.assertEqual(main.checkForPokemonGo("us"), True) # those bastards!
@patch("urllib.request.urlopen")
def test_checkForPokemonGoErrorHandling(self, urlopen_mock):
urlopen_mock.side_effect = urllib.error.URLError("Error retrieving webpage")
with self.assertRaises(main.PokemonGoError):
main.checkForPokemonGo("us")
@patch("main.checkForPokemonGo")
def test_PokemonGoBrazilCall(self, checkForPokemonGo_mock):
main.isPokemonGoInBrazil()
main.checkForPokemonGo.assert_called_once_with("br")
if __name__ == "__main__":
unittest.main()
| [
1,
529,
276,
1112,
420,
29958,
29979,
273,
2288,
29914,
29925,
554,
9857,
8120,
797,
29933,
9504,
309,
13,
5215,
10876,
13,
5215,
443,
27958,
13,
3166,
443,
27958,
29889,
17640,
1053,
13261,
29892,
26297,
13,
5215,
3142,
1982,
29889,
3827,
13,
5215,
3142,
1982,
29889,
2704,
13,
5215,
1732,
29889,
4645,
13,
5215,
1667,
13,
13,
29937,
21747,
9857,
2921,
297,
16078,
4321,
2166,
568,
13,
29937,
448,
2683,
9072,
5634,
13,
29937,
1152,
278,
4544,
1459,
643,
6987,
29892,
29104,
6031,
13,
29937,
526,
18511,
304,
23616,
29899,
29947,
297,
6262,
29892,
769,
4502,
964,
13,
29937,
278,
8343,
3519,
408,
1347,
1602,
6797,
964,
278,
1788,
29915,
29879,
13,
29937,
2322,
8025,
29889,
910,
338,
2309,
1363,
278,
13812,
23347,
13,
29937,
263,
1347,
393,
338,
20917,
304,
278,
1788,
29915,
29879,
2322,
8025,
13,
29937,
577,
372,
508,
769,
19750,
393,
304,
278,
1788,
29915,
29879,
2322,
8025,
13,
29937,
297,
6262,
29892,
769,
21822,
304,
23616,
29899,
29947,
29889,
13,
13,
1990,
4321,
292,
29925,
554,
9857,
8120,
26112,
29898,
348,
27958,
29889,
3057,
8259,
1125,
13,
13,
1678,
822,
1243,
29918,
29886,
554,
9857,
7020,
11726,
29898,
1311,
1125,
13,
4706,
13812,
353,
1667,
29889,
29925,
554,
9857,
7020,
11726,
580,
13,
4706,
590,
11207,
353,
9872,
1420,
5299,
7299,
2793,
14672,
29925,
554,
2249,
265,
21947,
373,
278,
2401,
14491,
29905,
5319,
7299,
2565,
1420,
29958,
1642,
12508,
703,
9420,
29899,
29947,
1159,
13,
4706,
13812,
29889,
18798,
29898,
1357,
11207,
29889,
13808,
29898,
9675,
29889,
25393,
29889,
22331,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16680,
29889,
18361,
12542,
8120,
3285,
5852,
29897,
13,
13,
1678,
822,
1243,
29918,
29886,
554,
9857,
7020,
11726,
29918,
29886,
554,
9857,
8120,
12542,
29898,
1311,
1125,
13,
4706,
13812,
353,
1667,
29889,
29925,
554,
9857,
7020,
11726,
580,
13,
4706,
590,
11207,
353,
9872,
1420,
5299,
7299,
2793,
14672,
16434,
29888,
6289,
2176,
3174,
2176,
29887,
2176,
5311,
2176,
29925,
554,
2249,
265,
21947,
29879,
2176,
29887,
29881,
4668,
29887,
11512,
29887,
2176,
5311,
2176,
29887,
29905,
5319,
7299,
2565,
1420,
29958,
1642,
12508,
703,
9420,
29899,
29947,
1159,
13,
4706,
13812,
29889,
18798,
29898,
1357,
11207,
29889,
13808,
29898,
9675,
29889,
25393,
29889,
22331,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16680,
29889,
18361,
12542,
8120,
3285,
5852,
29897,
13,
13,
1678,
822,
1243,
29918,
29886,
554,
9857,
7020,
11726,
29918,
1217,
3916,
29898,
1311,
1125,
13,
4706,
13812,
353,
1667,
29889,
29925,
554,
9857,
7020,
11726,
580,
13,
4706,
590,
11207,
353,
9872,
1420,
2565,
1420,
29958,
1642,
12508,
703,
9420,
29899,
29947,
1159,
13,
4706,
13812,
29889,
18798,
29898,
1357,
11207,
29889,
13808,
29898,
9675,
29889,
25393,
29889,
22331,
876,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16680,
29889,
18361,
12542,
8120,
3285,
7700,
29897,
13,
13,
1678,
822,
1243,
29918,
29886,
554,
9857,
7020,
11726,
29918,
1217,
29925,
554,
9857,
8120,
29898,
1311,
1125,
13,
4706,
13812,
353,
1667,
29889,
29925,
554,
9857,
7020,
11726,
580,
13,
4706,
13812,
29889,
18798,
28945,
1420,
5299,
7299,
2793,
14672,
14991,
20170,
11698,
29905,
5319,
7299,
2565,
1420,
29958,
1159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
16680,
29889,
18361,
12542,
8120,
3285,
7700,
29897,
13,
13,
1678,
732,
5041,
703,
2271,
1982,
29889,
3827,
29889,
332,
417,
2238,
1159,
13,
1678,
822,
1243,
29918,
3198,
2831,
29925,
554,
9857,
8120,
29898,
1311,
29892,
5065,
417,
2238,
29918,
17640,
1125,
13,
4706,
5065,
417,
2238,
29918,
17640,
29889,
2457,
29918,
1767,
353,
26297,
29898,
6550,
29922,
1124,
29889,
4645,
29889,
10493,
5103,
29897,
13,
4706,
5065,
417,
2238,
29918,
17640,
29889,
2457,
29918,
1767,
29889,
949,
29889,
2457,
29918,
1767,
353,
9872,
1420,
5299,
7299,
2793,
14672,
29925,
554,
2249,
265,
21947,
373,
278,
2401,
14491,
29905,
5319,
7299,
2565,
1420,
29958,
1642,
12508,
703,
9420,
29899,
29947,
1159,
13,
4706,
1583,
29889,
9294,
9843,
29898,
3396,
29889,
3198,
2831,
29925,
554,
9857,
8120,
703,
375,
4968,
5852,
29897,
396,
1906,
21156,
3163,
29991,
13,
13,
1678,
732,
5041,
703,
2271,
1982,
29889,
3827,
29889,
332,
417,
2238,
1159,
13,
1678,
822,
1243,
29918,
3198,
2831,
29925,
554,
9857,
8120,
2392,
3481,
1847,
29898,
1311,
29892,
5065,
417,
2238,
29918,
17640,
1125,
13,
4706,
5065,
417,
2238,
29918,
17640,
29889,
2975,
29918,
15987,
353,
3142,
1982,
29889,
2704,
29889,
4574,
1307,
24616,
703,
2392,
5663,
15387,
24499,
1159,
13,
4706,
411,
1583,
29889,
9294,
29934,
1759,
267,
29898,
3396,
29889,
29925,
554,
9857,
8120,
2392,
1125,
13,
9651,
1667,
29889,
3198,
2831,
29925,
554,
9857,
8120,
703,
375,
1159,
13,
13,
1678,
732,
5041,
703,
3396,
29889,
3198,
2831,
29925,
554,
9857,
8120,
1159,
13,
1678,
822,
1243,
29918,
29925,
554,
9857,
8120,
29933,
9504,
309,
5594,
29898,
1311,
29892,
1423,
2831,
29925,
554,
9857,
8120,
29918,
17640,
1125,
13,
4706,
1667,
29889,
275,
29925,
554,
9857,
8120,
797,
29933,
9504,
309,
580,
13,
4706,
1667,
29889,
3198,
2831,
29925,
554,
9857,
8120,
29889,
9294,
29918,
13998,
29918,
10646,
29918,
2541,
703,
1182,
1159,
13,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
13,
1678,
443,
27958,
29889,
3396,
580,
13,
2
] |
src/scene/common.py | Speterius/ray_tracing | 3 | 148052 | <gh_stars>1-10
from typing import Union, List, Tuple
import numpy as np
# Typing aliases:
Vector3D = Union[np.ndarray, list, Tuple[float, float, float]]
Color = Union[List[int], Tuple[int, int, int]]
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
19229,
1053,
7761,
29892,
2391,
29892,
12603,
552,
13,
5215,
12655,
408,
7442,
13,
13,
29937,
14213,
292,
14430,
2129,
29901,
13,
12877,
29941,
29928,
353,
7761,
29961,
9302,
29889,
299,
2378,
29892,
1051,
29892,
12603,
552,
29961,
7411,
29892,
5785,
29892,
5785,
5262,
13,
3306,
353,
7761,
29961,
1293,
29961,
524,
1402,
12603,
552,
29961,
524,
29892,
938,
29892,
938,
5262,
13,
2
] |
utils.py | plotly/sample_dash_livy_spark | 6 | 189429 | <filename>utils.py<gh_stars>1-10
from constants import JobStates, SparkStates
import json
import requests
def prettify_json(json_dict):
return json.dumps(json_dict, indent=4, sort_keys=True)
def parse_json(json_text):
return json.loads(json_text)
job_states = JobStates()
spark_states = SparkStates()
class LivyRequests:
livy_host = "http://localhost:8998"
data = {"kind": "pyspark", "executorMemory": "512m"}
headers = {"Content-Type": "application/json"}
def list_sessions(self):
resp = requests.get(self.livy_host + "/sessions", headers=self.headers)
payload = resp.json()
return payload["sessions"]
def kill_sessions(self):
sessions = self.list_sessions()
payloads = []
for session in sessions:
session_url = self.livy_host + "/sessions/{}".format(session["id"])
resp = requests.delete(session_url, headers=self.headers)
payload = resp.json()
payloads.append(payload)
if len(payloads) == 0:
return None
else:
return payloads
def run_session(self):
resp = requests.post(
self.livy_host + "/sessions",
data=json.dumps(self.data),
headers=self.headers,
)
payload = resp.json()
return {
"id": payload["id"],
"state": payload["state"],
"session-url": self.livy_host + resp.headers["location"],
}
def session_info(self, session_url):
resp = requests.get(session_url, headers=self.headers)
payload = resp.json()
return {
"id": payload["id"],
"state": payload["state"],
"session-url": session_url,
}
def run_job(self, session_url, job):
resp = requests.post(
session_url + "/statements", data=json.dumps(job), headers=self.headers
)
payload = resp.json()
return {
"id": payload["id"],
"state": payload["state"],
"output": payload["output"],
"statement-url": self.livy_host + resp.headers["location"],
}
def job_info(self, statement_url):
try:
resp = requests.get(statement_url, headers=self.headers)
payload = resp.json()
return {
"id": payload["id"],
"state": payload["state"],
"output": payload["output"],
"statement-url": statement_url,
}
except Exception as e:
return {"state": job_states.ERROR, "error": str(e)}
| [
1,
529,
9507,
29958,
13239,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
3166,
17727,
1053,
17163,
855,
1078,
29892,
20814,
855,
1078,
13,
5215,
4390,
13,
5215,
7274,
13,
13,
13,
1753,
758,
698,
1598,
29918,
3126,
29898,
3126,
29918,
8977,
1125,
13,
1678,
736,
4390,
29889,
29881,
17204,
29898,
3126,
29918,
8977,
29892,
29536,
29922,
29946,
29892,
2656,
29918,
8149,
29922,
5574,
29897,
13,
13,
13,
1753,
6088,
29918,
3126,
29898,
3126,
29918,
726,
1125,
13,
1678,
736,
4390,
29889,
18132,
29898,
3126,
29918,
726,
29897,
13,
13,
13,
9057,
29918,
28631,
353,
17163,
855,
1078,
580,
13,
12597,
29918,
28631,
353,
20814,
855,
1078,
580,
13,
13,
13,
1990,
16238,
29891,
3089,
29879,
29901,
13,
1678,
7294,
29891,
29918,
3069,
353,
376,
1124,
597,
7640,
29901,
29947,
29929,
29929,
29947,
29908,
13,
1678,
848,
353,
8853,
14380,
1115,
376,
29886,
952,
6378,
613,
376,
4258,
3406,
16015,
1115,
376,
29945,
29896,
29906,
29885,
9092,
13,
1678,
9066,
353,
8853,
3916,
29899,
1542,
1115,
376,
6214,
29914,
3126,
9092,
13,
13,
1678,
822,
1051,
29918,
29879,
10964,
29898,
1311,
1125,
13,
4706,
4613,
353,
7274,
29889,
657,
29898,
1311,
29889,
17843,
29891,
29918,
3069,
718,
5591,
29879,
10964,
613,
9066,
29922,
1311,
29889,
13662,
29897,
13,
4706,
20092,
353,
4613,
29889,
3126,
580,
13,
4706,
736,
20092,
3366,
29879,
10964,
3108,
13,
13,
1678,
822,
12088,
29918,
29879,
10964,
29898,
1311,
1125,
13,
4706,
21396,
353,
1583,
29889,
1761,
29918,
29879,
10964,
580,
13,
4706,
5146,
18132,
353,
5159,
13,
4706,
363,
4867,
297,
21396,
29901,
13,
9651,
4867,
29918,
2271,
353,
1583,
29889,
17843,
29891,
29918,
3069,
718,
5591,
29879,
10964,
29914,
8875,
1642,
4830,
29898,
7924,
3366,
333,
20068,
13,
9651,
4613,
353,
7274,
29889,
8143,
29898,
7924,
29918,
2271,
29892,
9066,
29922,
1311,
29889,
13662,
29897,
13,
9651,
20092,
353,
4613,
29889,
3126,
580,
13,
9651,
5146,
18132,
29889,
4397,
29898,
23813,
29897,
13,
13,
4706,
565,
7431,
29898,
10472,
18132,
29897,
1275,
29871,
29900,
29901,
13,
9651,
736,
6213,
13,
4706,
1683,
29901,
13,
9651,
736,
5146,
18132,
13,
13,
1678,
822,
1065,
29918,
7924,
29898,
1311,
1125,
13,
4706,
4613,
353,
7274,
29889,
2490,
29898,
13,
9651,
1583,
29889,
17843,
29891,
29918,
3069,
718,
5591,
29879,
10964,
613,
13,
9651,
848,
29922,
3126,
29889,
29881,
17204,
29898,
1311,
29889,
1272,
511,
13,
9651,
9066,
29922,
1311,
29889,
13662,
29892,
13,
4706,
1723,
13,
4706,
20092,
353,
4613,
29889,
3126,
580,
13,
4706,
736,
426,
13,
9651,
376,
333,
1115,
20092,
3366,
333,
12436,
13,
9651,
376,
3859,
1115,
20092,
3366,
3859,
12436,
13,
9651,
376,
7924,
29899,
2271,
1115,
1583,
29889,
17843,
29891,
29918,
3069,
718,
4613,
29889,
13662,
3366,
5479,
12436,
13,
4706,
500,
13,
13,
1678,
822,
4867,
29918,
3888,
29898,
1311,
29892,
4867,
29918,
2271,
1125,
13,
4706,
4613,
353,
7274,
29889,
657,
29898,
7924,
29918,
2271,
29892,
9066,
29922,
1311,
29889,
13662,
29897,
13,
4706,
20092,
353,
4613,
29889,
3126,
580,
13,
4706,
736,
426,
13,
9651,
376,
333,
1115,
20092,
3366,
333,
12436,
13,
9651,
376,
3859,
1115,
20092,
3366,
3859,
12436,
13,
9651,
376,
7924,
29899,
2271,
1115,
4867,
29918,
2271,
29892,
13,
4706,
500,
13,
13,
1678,
822,
1065,
29918,
9057,
29898,
1311,
29892,
4867,
29918,
2271,
29892,
4982,
1125,
13,
4706,
4613,
353,
7274,
29889,
2490,
29898,
13,
9651,
4867,
29918,
2271,
718,
5591,
6112,
4110,
613,
848,
29922,
3126,
29889,
29881,
17204,
29898,
9057,
511,
9066,
29922,
1311,
29889,
13662,
13,
4706,
1723,
13,
4706,
20092,
353,
4613,
29889,
3126,
580,
13,
13,
4706,
736,
426,
13,
9651,
376,
333,
1115,
20092,
3366,
333,
12436,
13,
9651,
376,
3859,
1115,
20092,
3366,
3859,
12436,
13,
9651,
376,
4905,
1115,
20092,
3366,
4905,
12436,
13,
9651,
376,
20788,
29899,
2271,
1115,
1583,
29889,
17843,
29891,
29918,
3069,
718,
4613,
29889,
13662,
3366,
5479,
12436,
13,
4706,
500,
13,
13,
1678,
822,
4982,
29918,
3888,
29898,
1311,
29892,
3229,
29918,
2271,
1125,
13,
13,
4706,
1018,
29901,
13,
9651,
4613,
353,
7274,
29889,
657,
29898,
20788,
29918,
2271,
29892,
9066,
29922,
1311,
29889,
13662,
29897,
13,
9651,
20092,
353,
4613,
29889,
3126,
580,
13,
13,
9651,
736,
426,
13,
18884,
376,
333,
1115,
20092,
3366,
333,
12436,
13,
18884,
376,
3859,
1115,
20092,
3366,
3859,
12436,
13,
18884,
376,
4905,
1115,
20092,
3366,
4905,
12436,
13,
18884,
376,
20788,
29899,
2271,
1115,
3229,
29918,
2271,
29892,
13,
9651,
500,
13,
13,
4706,
5174,
8960,
408,
321,
29901,
13,
9651,
736,
8853,
3859,
1115,
4982,
29918,
28631,
29889,
11432,
29892,
376,
2704,
1115,
851,
29898,
29872,
2915,
13,
2
] |
Panalyzer/TraceParser/csv2np_buffered.py | dashazhangdake/gem5test | 0 | 47675 | import csv
import numpy as np
import time
from pathlib import Path
from Panalyzer.utils.wr_extractor import wr_extractor
from Panalyzer.TraceParser.logic_masking import *
def arm32buffered_csv2np(fcsv, buffersize, num_reg):
detailded_info = {'wr': None, 'regval': None, 'tick': None, 'masking': None, 'src1': None, 'src2': None,
'op': None}
tick_list = np.zeros([buffersize], dtype=np.int64)
wr_list = np.full([num_reg, 2, buffersize], False, dtype=bool)
reg_val_table = np.zeros([num_reg, buffersize], dtype=np.int64)
op_list = []
src1_list = []
src2_list = []
with open(fcsv, mode='r') as infocsv:
info_reader = csv.reader(infocsv)
buffer_idx = 0
chunk_counter = 0
for idx, row in enumerate(info_reader):
if idx % buffersize == 0:
buffer_idx = 0
chunk_counter = chunk_counter + 1
print(chunk_counter)
tick_list = np.zeros([buffersize], dtype=np.int64)
wr_list = np.full([num_reg, 2, buffersize], False, dtype=bool)
reg_val_table = np.zeros([num_reg, buffersize], dtype=np.int64)
op_list = []
src1_list = []
src2_list = []
else:
buffer_idx = buffer_idx + 1
tick_list[buffer_idx] = row[0] # Tick number list: an 1 x line_number np array
op_id = row[3]
op_list.append(op_id) # Opname is just a simple list of strings
# Variables required for utility.wr_extractor, feed into the function, then abstract the required
# data structure
op_dst1 = row[4]
op_dst2 = row[5]
op_src1 = row[6]
op_src2 = row[7]
src1_list.append(op_src1)
src2_list.append(op_src2)
data = row[-1]
for k in range(num_reg): # kth register
val_prev = reg_val_table[k, buffer_idx - 1]
reg_name = 'r' + str(k) # fp, lr, sp ,pc are renamed, simply
wr_list[k, 0, buffer_idx] = \
wr_extractor(reg_name, op_dst1, op_dst2, op_src1, op_src2, op_id, data, val_prev)[0]
wr_list[k, 1, buffer_idx] = \
wr_extractor(reg_name, op_dst1, op_dst2, op_src1, op_src2, op_id, data, val_prev)[1]
reg_val_table[k, buffer_idx] = \
wr_extractor(reg_name, op_dst1, op_dst2, op_src1, op_src2, op_id, data, val_prev)[2]
return tick_list
if __name__ == "__main__":
project_dir = Path(__file__).resolve().parent.parent
csv_dir = project_dir.joinpath('tempcsv')
fname = "fftbaseline.csv"
start_time = time.perf_counter() # Time counter starts
T = arm32buffered_csv2np(csv_dir / fname, 10000, 16)
elapsed_time_pandas = time.perf_counter() - start_time # Stop point of the timer
# tickexample = T['tick']
# wrexample = T['wr']
# regvalexample = T['regval']
# masking_table = T['masking']
# ops_list = T['op']
#
# # print('tick \n', tickexample, '\n wr: \n', wrexample, '\n regval:\n', regvalexample)
# print(ops_list) | [
1,
1053,
11799,
30004,
13,
5215,
12655,
408,
7442,
30004,
13,
5215,
931,
30004,
13,
30004,
13,
3166,
2224,
1982,
1053,
10802,
30004,
13,
30004,
13,
3166,
6518,
14997,
3298,
29889,
13239,
29889,
15866,
29918,
21111,
272,
1053,
2358,
29918,
21111,
272,
30004,
13,
3166,
6518,
14997,
3298,
29889,
11591,
11726,
29889,
19227,
29918,
13168,
292,
1053,
334,
30004,
13,
30004,
13,
30004,
13,
1753,
5075,
29941,
29906,
9040,
287,
29918,
7638,
29906,
9302,
29898,
29888,
7638,
29892,
20487,
414,
675,
29892,
954,
29918,
1727,
1125,
30004,
13,
1678,
9493,
7176,
29918,
3888,
353,
11117,
15866,
2396,
6213,
29892,
525,
1727,
791,
2396,
6213,
29892,
525,
24667,
2396,
6213,
29892,
525,
13168,
292,
2396,
6213,
29892,
525,
4351,
29896,
2396,
6213,
29892,
525,
4351,
29906,
2396,
6213,
11167,
13,
462,
418,
525,
459,
2396,
6213,
8117,
13,
30004,
13,
1678,
16892,
29918,
1761,
353,
7442,
29889,
3298,
359,
4197,
28040,
414,
675,
1402,
26688,
29922,
9302,
29889,
524,
29953,
29946,
8443,
13,
1678,
2358,
29918,
1761,
353,
7442,
29889,
8159,
4197,
1949,
29918,
1727,
29892,
29871,
29906,
29892,
20487,
414,
675,
1402,
7700,
29892,
26688,
29922,
11227,
8443,
13,
1678,
1072,
29918,
791,
29918,
2371,
353,
7442,
29889,
3298,
359,
4197,
1949,
29918,
1727,
29892,
20487,
414,
675,
1402,
26688,
29922,
9302,
29889,
524,
29953,
29946,
8443,
13,
30004,
13,
1678,
1015,
29918,
1761,
353,
5159,
30004,
13,
1678,
4765,
29896,
29918,
1761,
353,
5159,
30004,
13,
1678,
4765,
29906,
29918,
1761,
353,
5159,
30004,
13,
30004,
13,
1678,
411,
1722,
29898,
29888,
7638,
29892,
4464,
2433,
29878,
1495,
408,
3041,
542,
4501,
29901,
30004,
13,
4706,
5235,
29918,
16950,
353,
11799,
29889,
16950,
29898,
7192,
542,
4501,
8443,
13,
4706,
6835,
29918,
13140,
353,
29871,
29900,
30004,
13,
4706,
19875,
29918,
11808,
353,
29871,
29900,
30004,
13,
4706,
363,
22645,
29892,
1948,
297,
26985,
29898,
3888,
29918,
16950,
1125,
30004,
13,
9651,
565,
22645,
1273,
20487,
414,
675,
1275,
29871,
29900,
29901,
30004,
13,
18884,
6835,
29918,
13140,
353,
29871,
29900,
30004,
13,
18884,
19875,
29918,
11808,
353,
19875,
29918,
11808,
718,
29871,
29896,
30004,
13,
18884,
1596,
29898,
29812,
29918,
11808,
8443,
13,
30004,
13,
18884,
16892,
29918,
1761,
353,
7442,
29889,
3298,
359,
4197,
28040,
414,
675,
1402,
26688,
29922,
9302,
29889,
524,
29953,
29946,
8443,
13,
18884,
2358,
29918,
1761,
353,
7442,
29889,
8159,
4197,
1949,
29918,
1727,
29892,
29871,
29906,
29892,
20487,
414,
675,
1402,
7700,
29892,
26688,
29922,
11227,
8443,
13,
18884,
1072,
29918,
791,
29918,
2371,
353,
7442,
29889,
3298,
359,
4197,
1949,
29918,
1727,
29892,
20487,
414,
675,
1402,
26688,
29922,
9302,
29889,
524,
29953,
29946,
8443,
13,
30004,
13,
18884,
1015,
29918,
1761,
353,
5159,
30004,
13,
18884,
4765,
29896,
29918,
1761,
353,
5159,
30004,
13,
18884,
4765,
29906,
29918,
1761,
353,
5159,
30004,
13,
9651,
1683,
29901,
30004,
13,
18884,
6835,
29918,
13140,
353,
6835,
29918,
13140,
718,
29871,
29896,
30004,
13,
18884,
16892,
29918,
1761,
29961,
9040,
29918,
13140,
29962,
353,
1948,
29961,
29900,
29962,
29871,
396,
323,
860,
1353,
1051,
29901,
385,
29871,
29896,
921,
1196,
29918,
4537,
7442,
1409,
30004,
13,
30004,
13,
18884,
1015,
29918,
333,
353,
1948,
29961,
29941,
29962,
30004,
13,
18884,
1015,
29918,
1761,
29889,
4397,
29898,
459,
29918,
333,
29897,
29871,
396,
6461,
978,
338,
925,
263,
2560,
1051,
310,
6031,
30004,
13,
30004,
13,
18884,
396,
9586,
1849,
3734,
363,
19725,
29889,
15866,
29918,
21111,
272,
29892,
8343,
964,
278,
740,
29892,
769,
9846,
278,
3734,
30004,
13,
18884,
396,
848,
3829,
30004,
13,
18884,
1015,
29918,
22992,
29896,
353,
1948,
29961,
29946,
29962,
30004,
13,
18884,
1015,
29918,
22992,
29906,
353,
1948,
29961,
29945,
29962,
30004,
13,
18884,
1015,
29918,
4351,
29896,
353,
1948,
29961,
29953,
29962,
30004,
13,
18884,
1015,
29918,
4351,
29906,
353,
1948,
29961,
29955,
29962,
30004,
13,
30004,
13,
18884,
4765,
29896,
29918,
1761,
29889,
4397,
29898,
459,
29918,
4351,
29896,
8443,
13,
18884,
4765,
29906,
29918,
1761,
29889,
4397,
29898,
459,
29918,
4351,
29906,
8443,
13,
30004,
13,
18884,
848,
353,
1948,
14352,
29896,
29962,
30004,
13,
18884,
363,
413,
297,
3464,
29898,
1949,
29918,
1727,
1125,
29871,
396,
413,
386,
6036,
30004,
13,
462,
1678,
659,
29918,
16304,
353,
1072,
29918,
791,
29918,
2371,
29961,
29895,
29892,
6835,
29918,
13140,
448,
29871,
29896,
29962,
30004,
13,
462,
1678,
1072,
29918,
978,
353,
525,
29878,
29915,
718,
851,
29898,
29895,
29897,
29871,
396,
285,
29886,
29892,
301,
29878,
29892,
805,
1919,
6739,
526,
19533,
29892,
3763,
30004,
13,
462,
1678,
2358,
29918,
1761,
29961,
29895,
29892,
29871,
29900,
29892,
6835,
29918,
13140,
29962,
353,
320,
30004,
13,
462,
4706,
2358,
29918,
21111,
272,
29898,
1727,
29918,
978,
29892,
1015,
29918,
22992,
29896,
29892,
1015,
29918,
22992,
29906,
29892,
1015,
29918,
4351,
29896,
29892,
1015,
29918,
4351,
29906,
29892,
1015,
29918,
333,
29892,
848,
29892,
659,
29918,
16304,
9601,
29900,
29962,
30004,
13,
462,
1678,
2358,
29918,
1761,
29961,
29895,
29892,
29871,
29896,
29892,
6835,
29918,
13140,
29962,
353,
320,
30004,
13,
462,
4706,
2358,
29918,
21111,
272,
29898,
1727,
29918,
978,
29892,
1015,
29918,
22992,
29896,
29892,
1015,
29918,
22992,
29906,
29892,
1015,
29918,
4351,
29896,
29892,
1015,
29918,
4351,
29906,
29892,
1015,
29918,
333,
29892,
848,
29892,
659,
29918,
16304,
9601,
29896,
29962,
30004,
13,
462,
1678,
1072,
29918,
791,
29918,
2371,
29961,
29895,
29892,
6835,
29918,
13140,
29962,
353,
320,
30004,
13,
462,
4706,
2358,
29918,
21111,
272,
29898,
1727,
29918,
978,
29892,
1015,
29918,
22992,
29896,
29892,
1015,
29918,
22992,
29906,
29892,
1015,
29918,
4351,
29896,
29892,
1015,
29918,
4351,
29906,
29892,
1015,
29918,
333,
29892,
848,
29892,
659,
29918,
16304,
9601,
29906,
29962,
30004,
13,
4706,
736,
16892,
29918,
1761,
30004,
13,
30004,
13,
30004,
13,
361,
4770,
978,
1649,
1275,
376,
1649,
3396,
1649,
1115,
30004,
13,
1678,
2060,
29918,
3972,
353,
10802,
22168,
1445,
1649,
467,
17863,
2141,
3560,
29889,
3560,
30004,
13,
1678,
11799,
29918,
3972,
353,
2060,
29918,
3972,
29889,
7122,
2084,
877,
7382,
7638,
1495,
30004,
13,
1678,
285,
978,
353,
376,
600,
29873,
6500,
5570,
29889,
7638,
19451,
13,
30004,
13,
1678,
1369,
29918,
2230,
353,
931,
29889,
546,
29888,
29918,
11808,
580,
29871,
396,
5974,
6795,
8665,
30004,
13,
1678,
323,
353,
5075,
29941,
29906,
9040,
287,
29918,
7638,
29906,
9302,
29898,
7638,
29918,
3972,
847,
285,
978,
29892,
29871,
29896,
29900,
29900,
29900,
29900,
29892,
29871,
29896,
29953,
8443,
13,
1678,
560,
28170,
29918,
2230,
29918,
15112,
353,
931,
29889,
546,
29888,
29918,
11808,
580,
448,
1369,
29918,
2230,
29871,
396,
22303,
1298,
310,
278,
12237,
30004,
13,
1678,
396,
260,
293,
446,
29916,
981,
353,
323,
1839,
24667,
2033,
30004,
13,
1678,
396,
281,
276,
29916,
981,
353,
323,
1839,
15866,
2033,
30004,
13,
1678,
396,
1072,
29894,
744,
29916,
981,
353,
323,
1839,
1727,
791,
2033,
30004,
13,
1678,
396,
11105,
292,
29918,
2371,
353,
323,
1839,
13168,
292,
2033,
30004,
13,
1678,
396,
288,
567,
29918,
1761,
353,
323,
1839,
459,
2033,
30004,
13,
1678,
396,
30004,
13,
1678,
396,
396,
1596,
877,
24667,
320,
29876,
742,
260,
293,
446,
29916,
981,
29892,
11297,
29876,
2358,
29901,
320,
29876,
742,
281,
276,
29916,
981,
29892,
11297,
29876,
1072,
791,
3583,
29876,
742,
1072,
29894,
744,
29916,
981,
8443,
13,
1678,
396,
1596,
29898,
3554,
29918,
1761,
29897,
2
] |
nngen/operator/pad.py | hirayamy/nngen | 0 | 96145 | <reponame>hirayamy/nngen
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from nngen.operator.pool import _pool
class pad(_pool):
def __sub_str__(self):
if hasattr(self, 'pad_col_left') and self.padding == 'SAME':
padding = ("'%s'-(%d, %d, %d, %d)" %
(self.padding,
self.pad_col_left_value, self.pad_col_right_value,
self.pad_row_top_value, self.pad_row_bottom_value))
else:
padding = self.padding
par = ' par:%d' % self.par if self.par > 1 else ''
value_ram_size = (' value_ram_size:%d' % self.value_ram_size
if self.value_ram_size is not None else '')
out_ram_size = (' out_ram_size:%d' % self.out_ram_size
if self.out_ram_size is not None else '')
return (' padding:%s%s%s%s' %
(padding, par, value_ram_size, out_ram_size))
def __init__(self, value, padding,
dtype=None, name=None, par=1,
value_ram_size=None, out_ram_size=None):
ksize = (1, 1, 1, 1)
strides = (1, 1, 1, 1)
_pool.__init__(self, value, ksize, strides,
padding, dtype, name, par,
value_ram_size, out_ram_size)
def get_pad_value(self, strm):
return strm.Int(0)
def pool_op(self, strm, index, *vars):
return vars[0]
def eval(self, memo, input_dict, **kwargs):
if id(self) in memo:
return memo[id(self)]
import nngen.verify as verify
name = self.__class__.__name__
args = [arg.eval(memo, input_dict)
for arg in self.args]
value = args[0]
kwargs['padding'] = self.padding
kwargs['dtype'] = self.dtype
kwargs['name'] = self.name
kwargs['par'] = self.par
method = self.get_eval_method()
ret = method(value, **kwargs)
memo[id(self)] = ret
return ret
| [
1,
529,
276,
1112,
420,
29958,
2918,
764,
25934,
29914,
29876,
865,
264,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8380,
29918,
5215,
13,
3166,
4770,
29888,
9130,
1649,
1053,
1596,
29918,
2220,
13,
3166,
4770,
29888,
9130,
1649,
1053,
8542,
13,
13,
3166,
302,
865,
264,
29889,
6891,
29889,
10109,
1053,
903,
10109,
13,
13,
13,
1990,
17132,
7373,
10109,
1125,
13,
13,
1678,
822,
4770,
1491,
29918,
710,
12035,
1311,
1125,
13,
4706,
565,
756,
5552,
29898,
1311,
29892,
525,
8305,
29918,
1054,
29918,
1563,
1495,
322,
1583,
29889,
12791,
1275,
525,
8132,
2303,
2396,
13,
9651,
7164,
353,
4852,
29915,
29995,
29879,
29915,
17722,
29995,
29881,
29892,
1273,
29881,
29892,
1273,
29881,
29892,
1273,
29881,
5513,
1273,
13,
462,
539,
313,
1311,
29889,
12791,
29892,
13,
462,
4706,
1583,
29889,
8305,
29918,
1054,
29918,
1563,
29918,
1767,
29892,
1583,
29889,
8305,
29918,
1054,
29918,
1266,
29918,
1767,
29892,
13,
462,
4706,
1583,
29889,
8305,
29918,
798,
29918,
3332,
29918,
1767,
29892,
1583,
29889,
8305,
29918,
798,
29918,
8968,
29918,
1767,
876,
13,
4706,
1683,
29901,
13,
9651,
7164,
353,
1583,
29889,
12791,
13,
13,
4706,
610,
353,
525,
610,
16664,
29881,
29915,
1273,
1583,
29889,
862,
565,
1583,
29889,
862,
1405,
29871,
29896,
1683,
6629,
13,
13,
4706,
995,
29918,
2572,
29918,
2311,
353,
6702,
995,
29918,
2572,
29918,
2311,
16664,
29881,
29915,
1273,
1583,
29889,
1767,
29918,
2572,
29918,
2311,
13,
462,
3986,
565,
1583,
29889,
1767,
29918,
2572,
29918,
2311,
338,
451,
6213,
1683,
27255,
13,
4706,
714,
29918,
2572,
29918,
2311,
353,
6702,
714,
29918,
2572,
29918,
2311,
16664,
29881,
29915,
1273,
1583,
29889,
449,
29918,
2572,
29918,
2311,
13,
462,
4706,
565,
1583,
29889,
449,
29918,
2572,
29918,
2311,
338,
451,
6213,
1683,
27255,
13,
13,
4706,
736,
6702,
7164,
16664,
29879,
29995,
29879,
29995,
29879,
29995,
29879,
29915,
1273,
13,
18884,
313,
12791,
29892,
610,
29892,
995,
29918,
2572,
29918,
2311,
29892,
714,
29918,
2572,
29918,
2311,
876,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
995,
29892,
7164,
29892,
13,
462,
26688,
29922,
8516,
29892,
1024,
29922,
8516,
29892,
610,
29922,
29896,
29892,
13,
462,
995,
29918,
2572,
29918,
2311,
29922,
8516,
29892,
714,
29918,
2572,
29918,
2311,
29922,
8516,
1125,
13,
13,
4706,
413,
2311,
353,
313,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
851,
2247,
353,
313,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29892,
29871,
29896,
29897,
13,
4706,
903,
10109,
17255,
2344,
12035,
1311,
29892,
995,
29892,
413,
2311,
29892,
851,
2247,
29892,
13,
462,
539,
7164,
29892,
26688,
29892,
1024,
29892,
610,
29892,
13,
462,
539,
995,
29918,
2572,
29918,
2311,
29892,
714,
29918,
2572,
29918,
2311,
29897,
13,
13,
1678,
822,
679,
29918,
8305,
29918,
1767,
29898,
1311,
29892,
851,
29885,
1125,
13,
4706,
736,
851,
29885,
29889,
2928,
29898,
29900,
29897,
13,
13,
1678,
822,
11565,
29918,
459,
29898,
1311,
29892,
851,
29885,
29892,
2380,
29892,
334,
16908,
1125,
13,
4706,
736,
24987,
29961,
29900,
29962,
13,
13,
1678,
822,
19745,
29898,
1311,
29892,
2626,
29877,
29892,
1881,
29918,
8977,
29892,
3579,
19290,
1125,
13,
4706,
565,
1178,
29898,
1311,
29897,
297,
2626,
29877,
29901,
13,
9651,
736,
2626,
29877,
29961,
333,
29898,
1311,
4638,
13,
13,
4706,
1053,
302,
865,
264,
29889,
27902,
408,
11539,
13,
13,
4706,
1024,
353,
1583,
17255,
1990,
1649,
17255,
978,
1649,
13,
13,
4706,
6389,
353,
518,
1191,
29889,
14513,
29898,
6954,
29877,
29892,
1881,
29918,
8977,
29897,
13,
18884,
363,
1852,
297,
1583,
29889,
5085,
29962,
13,
13,
4706,
995,
353,
6389,
29961,
29900,
29962,
13,
13,
4706,
9049,
5085,
1839,
12791,
2033,
353,
1583,
29889,
12791,
13,
4706,
9049,
5085,
1839,
29881,
1853,
2033,
353,
1583,
29889,
29881,
1853,
13,
4706,
9049,
5085,
1839,
978,
2033,
353,
1583,
29889,
978,
13,
4706,
9049,
5085,
1839,
862,
2033,
353,
1583,
29889,
862,
13,
13,
4706,
1158,
353,
1583,
29889,
657,
29918,
14513,
29918,
5696,
580,
13,
4706,
3240,
353,
1158,
29898,
1767,
29892,
3579,
19290,
29897,
13,
4706,
2626,
29877,
29961,
333,
29898,
1311,
4638,
353,
3240,
13,
13,
4706,
736,
3240,
13,
2
] |
models/eval_rels.py | IIGROUP/PUM | 12 | 176408 | import os
from dataloaders.visual_genome import VG, vg_collate
from lib.utils import define_model, load_ckpt, do_test
from config import cfg
from torch.utils.data import DataLoader
test_data = VG(cfg.test_data_name, num_val_im=5000, filter_duplicate_rels=True,
use_proposals=cfg.use_proposals, filter_non_overlap=cfg.mode == 'sgdet',
num_im=cfg.num_im)
test_loader = DataLoader(
dataset=test_data,
batch_size=cfg.num_gpus,
shuffle=False,
num_workers=cfg.num_workers,
collate_fn=lambda x: vg_collate(x, mode='rel', num_gpus=cfg.num_gpus, is_train=True if cfg.test_data_name == 'train' else False),
drop_last=True,
pin_memory=True,
)
if cfg.cache is not None and os.path.exists(cfg.cache):
# No need to load model
detector = None
else:
detector = define_model(cfg, test_data.ind_to_classes, test_data.ind_to_predicates)
load_ckpt(detector, cfg.ckpt)
detector.cuda()
do_test(detector, test_data, test_loader)
| [
1,
1053,
2897,
13,
3166,
1418,
7003,
24574,
29889,
20119,
29918,
1885,
608,
1053,
478,
29954,
29892,
325,
29887,
29918,
1054,
9632,
13,
3166,
4303,
29889,
13239,
1053,
4529,
29918,
4299,
29892,
2254,
29918,
384,
415,
29892,
437,
29918,
1688,
13,
3166,
2295,
1053,
274,
16434,
13,
3166,
4842,
305,
29889,
13239,
29889,
1272,
1053,
3630,
10036,
13,
13,
13,
1688,
29918,
1272,
353,
478,
29954,
29898,
16859,
29889,
1688,
29918,
1272,
29918,
978,
29892,
954,
29918,
791,
29918,
326,
29922,
29945,
29900,
29900,
29900,
29892,
4175,
29918,
20908,
5926,
29918,
2674,
29879,
29922,
5574,
29892,
13,
1669,
671,
29918,
771,
1066,
1338,
29922,
16859,
29889,
1509,
29918,
771,
1066,
1338,
29892,
4175,
29918,
5464,
29918,
957,
6984,
29922,
16859,
29889,
8513,
1275,
525,
5311,
4801,
742,
13,
1669,
954,
29918,
326,
29922,
16859,
29889,
1949,
29918,
326,
29897,
13,
1688,
29918,
12657,
353,
3630,
10036,
29898,
13,
1678,
8783,
29922,
1688,
29918,
1272,
29892,
13,
1678,
9853,
29918,
2311,
29922,
16859,
29889,
1949,
29918,
29887,
13364,
29892,
13,
1678,
528,
21897,
29922,
8824,
29892,
13,
1678,
954,
29918,
1287,
414,
29922,
16859,
29889,
1949,
29918,
1287,
414,
29892,
13,
1678,
5321,
403,
29918,
9144,
29922,
2892,
921,
29901,
325,
29887,
29918,
1054,
9632,
29898,
29916,
29892,
4464,
2433,
2674,
742,
954,
29918,
29887,
13364,
29922,
16859,
29889,
1949,
29918,
29887,
13364,
29892,
338,
29918,
14968,
29922,
5574,
565,
274,
16434,
29889,
1688,
29918,
1272,
29918,
978,
1275,
525,
14968,
29915,
1683,
7700,
511,
13,
1678,
5768,
29918,
4230,
29922,
5574,
29892,
13,
1678,
12534,
29918,
14834,
29922,
5574,
29892,
13,
29897,
13,
13,
361,
274,
16434,
29889,
8173,
338,
451,
6213,
322,
2897,
29889,
2084,
29889,
9933,
29898,
16859,
29889,
8173,
1125,
13,
1678,
396,
1939,
817,
304,
2254,
1904,
13,
1678,
1439,
3019,
353,
6213,
13,
2870,
29901,
13,
1678,
1439,
3019,
353,
4529,
29918,
4299,
29898,
16859,
29892,
1243,
29918,
1272,
29889,
513,
29918,
517,
29918,
13203,
29892,
1243,
29918,
1272,
29889,
513,
29918,
517,
29918,
11965,
293,
1078,
29897,
13,
1678,
2254,
29918,
384,
415,
29898,
4801,
3019,
29892,
274,
16434,
29889,
384,
415,
29897,
13,
1678,
1439,
3019,
29889,
29883,
6191,
580,
13,
13,
1867,
29918,
1688,
29898,
4801,
3019,
29892,
1243,
29918,
1272,
29892,
1243,
29918,
12657,
29897,
13,
2
] |
scripts/train_template.py | mibaumgartner/hackathon_health | 0 | 75684 | from dataset import CovidImageDataset
from argparse import ArgumentParser
import torch
import torch.nn as nn
from model import VGG
import numpy as np
import os
from pytorch_lightning.utilities.seed import seed_everything
import random
def seed_worker(worker_id):
'''
https://pytorch.org/docs/stable/notes/randomness.html#dataloader
to fix https://tanelp.github.io/posts/a-bug-that-plagues-thousands-of-open-source-ml-projects/
ensures different random numbers each batch with each worker every epoch while keeping reproducibility
'''
worker_seed = torch.initial_seed() % 2 ** 32
np.random.seed(worker_seed)
random.seed(worker_seed)
def train(args, model, device, train_loader, optimizer, epoch):
model.train()
train_loss = 0
correct = 0
for batch_idx, (data, target) in enumerate(train_loader):
data, target = data.to(device), target.to(device)
optimizer.zero_grad()
output = model(data)
loss = nn.CrossEntropyLoss()(output, target)
loss.backward()
train_loss += loss
_, predicted = torch.max(output.data, 1)
correct += (predicted == target).sum().item()
optimizer.step()
if batch_idx % args.log_interval == 0:
print('Train Epoch: {} [{}/{} ({:.0f}%)]\tLoss: {:.6f}'.format(
epoch, batch_idx * len(data), len(train_loader.dataset),
100. * batch_idx / len(train_loader), loss.item()))
def val(model, device, val_loader):
model.eval()
val_loss = 0
correct = 0
with torch.no_grad():
for data, target in val_loader:
data, target = data.to(device), target.to(device)
output = model(data)
val_loss += nn.CrossEntropyLoss()(output, target)
_, predicted = torch.max(output.data, 1)
correct += (predicted == target).sum().item()
print('\nValidation set: Average loss: {:.4f}, Accuracy: {}/{} ({:.0f}%)\n'.format(
val_loss / len(val_loader), correct, len(val_loader.dataset),
100. * correct / len(val_loader.dataset)))
def main():
parser = ArgumentParser()
parser.add_argument("--data_dir", type=str, default='/hkfs/work/workspace/scratch/im9193-health_challenge/data')
parser.add_argument("--num_epochs", type=int, default=250)
parser.add_argument("--augment", type=str, default='resize_rotate_crop')
parser.add_argument("--seed", type=int, default=42)
parser.add_argument('--log-interval', type=int, default=100, metavar='N',
help='how many batches to wait before logging training status')
parser.add_argument('--save_model', action='store_true', help='saves the trained model')
parser.add_argument('--model_name', type=str, help='model file name', default='vgg_baseline')
args = parser.parse_args()
device = torch.device("cuda")
# the following 3 lines are only needed to make the training fully reproducible, you can remove them
seed_everything(args.seed)
os.environ['CUBLAS_WORKSPACE_CONFIG'] = ':16:8'
torch.use_deterministic_algorithms(True)
data_base = args.data_dir
trainset = CovidImageDataset(
os.path.join(data_base, 'train.csv'),
os.path.join(data_base, 'imgs'),
transform=args.augment)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=64, shuffle=True, num_workers=128,
worker_init_fn=seed_worker)
valset = CovidImageDataset(
os.path.join(data_base, 'valid.csv'),
os.path.join(data_base, 'imgs'),
transform=None)
valloader = torch.utils.data.DataLoader(valset, batch_size=64, shuffle=False, num_workers=128,
worker_init_fn=seed_worker)
model = VGG('VGG19').cuda()
optimizer = torch.optim.SGD(model.parameters(), lr=0.1, nesterov=True, momentum=0.9)
scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, T_max=args.num_epochs)
print('CUDA available:', torch.cuda.is_available())
for epoch in range(1, args.num_epochs + 1):
train(args, model, device, trainloader, optimizer, epoch)
val(model, device, valloader)
scheduler.step()
if args.save_model:
model_dir = '/hkfs/work/workspace/scratch/im9193-health_challenge_baseline/saved_models' # TODO adapt to your group workspace
os.makedirs(model_dir, exist_ok=True)
torch.save(model.state_dict(), os.path.join(model_dir, "{}.pt".format(args.model_name)))
if __name__ == '__main__':
main()
| [
1,
515,
8783,
1053,
25669,
333,
2940,
16390,
24541,
13,
3166,
1852,
5510,
1053,
23125,
11726,
13,
5215,
4842,
305,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
13,
3166,
1904,
1053,
478,
26788,
13,
5215,
12655,
408,
7442,
13,
5215,
2897,
13,
3166,
282,
3637,
25350,
29918,
4366,
1076,
29889,
4422,
1907,
29889,
26776,
1053,
16717,
29918,
17991,
1918,
13,
5215,
4036,
13,
13,
13,
1753,
16717,
29918,
24602,
29898,
24602,
29918,
333,
1125,
13,
1678,
14550,
13,
1678,
2045,
597,
2272,
7345,
305,
29889,
990,
29914,
2640,
29914,
13844,
29914,
16953,
29914,
8172,
2264,
29889,
1420,
29937,
29881,
2075,
29877,
1664,
13,
1678,
304,
2329,
2045,
597,
29873,
3870,
29886,
29889,
3292,
29889,
601,
29914,
14080,
29914,
29874,
29899,
6152,
29899,
5747,
29899,
572,
21628,
29899,
386,
681,
4167,
29899,
974,
29899,
3150,
29899,
4993,
29899,
828,
29899,
16418,
29914,
13,
1678,
5662,
1973,
1422,
4036,
3694,
1269,
9853,
411,
1269,
15645,
1432,
21502,
305,
1550,
12515,
9483,
455,
29890,
1793,
13,
1678,
14550,
13,
1678,
15645,
29918,
26776,
353,
4842,
305,
29889,
11228,
29918,
26776,
580,
1273,
29871,
29906,
3579,
29871,
29941,
29906,
13,
1678,
7442,
29889,
8172,
29889,
26776,
29898,
24602,
29918,
26776,
29897,
13,
1678,
4036,
29889,
26776,
29898,
24602,
29918,
26776,
29897,
13,
13,
13,
1753,
7945,
29898,
5085,
29892,
1904,
29892,
4742,
29892,
7945,
29918,
12657,
29892,
5994,
3950,
29892,
21502,
305,
1125,
13,
1678,
1904,
29889,
14968,
580,
13,
1678,
7945,
29918,
6758,
353,
29871,
29900,
13,
1678,
1959,
353,
29871,
29900,
13,
13,
1678,
363,
9853,
29918,
13140,
29892,
313,
1272,
29892,
3646,
29897,
297,
26985,
29898,
14968,
29918,
12657,
1125,
13,
4706,
848,
29892,
3646,
353,
848,
29889,
517,
29898,
10141,
511,
3646,
29889,
517,
29898,
10141,
29897,
13,
4706,
5994,
3950,
29889,
9171,
29918,
5105,
580,
13,
13,
4706,
1962,
353,
1904,
29898,
1272,
29897,
13,
4706,
6410,
353,
302,
29876,
29889,
29907,
2124,
5292,
14441,
29931,
2209,
580,
29898,
4905,
29892,
3646,
29897,
13,
4706,
6410,
29889,
1627,
1328,
580,
13,
13,
4706,
7945,
29918,
6758,
4619,
6410,
13,
4706,
17117,
25383,
353,
4842,
305,
29889,
3317,
29898,
4905,
29889,
1272,
29892,
29871,
29896,
29897,
13,
4706,
1959,
4619,
313,
11965,
18186,
1275,
3646,
467,
2083,
2141,
667,
580,
13,
13,
4706,
5994,
3950,
29889,
10568,
580,
13,
4706,
565,
9853,
29918,
13140,
1273,
6389,
29889,
1188,
29918,
19207,
1275,
29871,
29900,
29901,
13,
9651,
1596,
877,
5323,
262,
382,
1129,
305,
29901,
6571,
15974,
6822,
8875,
21313,
29901,
29889,
29900,
29888,
10560,
4638,
29905,
29873,
29931,
2209,
29901,
12365,
29889,
29953,
29888,
29913,
4286,
4830,
29898,
13,
18884,
21502,
305,
29892,
9853,
29918,
13140,
334,
7431,
29898,
1272,
511,
7431,
29898,
14968,
29918,
12657,
29889,
24713,
511,
13,
462,
29896,
29900,
29900,
29889,
334,
9853,
29918,
13140,
847,
7431,
29898,
14968,
29918,
12657,
511,
6410,
29889,
667,
22130,
13,
13,
13,
1753,
659,
29898,
4299,
29892,
4742,
29892,
659,
29918,
12657,
1125,
13,
1678,
1904,
29889,
14513,
580,
13,
1678,
659,
29918,
6758,
353,
29871,
29900,
13,
1678,
1959,
353,
29871,
29900,
13,
13,
1678,
411,
4842,
305,
29889,
1217,
29918,
5105,
7295,
13,
4706,
363,
848,
29892,
3646,
297,
659,
29918,
12657,
29901,
13,
9651,
848,
29892,
3646,
353,
848,
29889,
517,
29898,
10141,
511,
3646,
29889,
517,
29898,
10141,
29897,
13,
9651,
1962,
353,
1904,
29898,
1272,
29897,
13,
9651,
659,
29918,
6758,
4619,
302,
29876,
29889,
29907,
2124,
5292,
14441,
29931,
2209,
580,
29898,
4905,
29892,
3646,
29897,
13,
9651,
17117,
25383,
353,
4842,
305,
29889,
3317,
29898,
4905,
29889,
1272,
29892,
29871,
29896,
29897,
13,
9651,
1959,
4619,
313,
11965,
18186,
1275,
3646,
467,
2083,
2141,
667,
580,
13,
13,
1678,
1596,
28909,
29876,
19448,
731,
29901,
319,
19698,
6410,
29901,
12365,
29889,
29946,
29888,
1118,
4831,
332,
4135,
29901,
6571,
29914,
8875,
21313,
29901,
29889,
29900,
29888,
10560,
2144,
29876,
4286,
4830,
29898,
13,
4706,
659,
29918,
6758,
847,
7431,
29898,
791,
29918,
12657,
511,
1959,
29892,
7431,
29898,
791,
29918,
12657,
29889,
24713,
511,
13,
308,
29896,
29900,
29900,
29889,
334,
1959,
847,
7431,
29898,
791,
29918,
12657,
29889,
24713,
4961,
13,
13,
13,
1753,
1667,
7295,
13,
1678,
13812,
353,
23125,
11726,
580,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1272,
29918,
3972,
613,
1134,
29922,
710,
29892,
2322,
2433,
29914,
29882,
29895,
5847,
29914,
1287,
29914,
1287,
3493,
29914,
10526,
905,
29914,
326,
29929,
29896,
29929,
29941,
29899,
354,
4298,
29918,
305,
11768,
29914,
1272,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
1949,
29918,
1022,
2878,
29879,
613,
1134,
29922,
524,
29892,
2322,
29922,
29906,
29945,
29900,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
2987,
358,
613,
1134,
29922,
710,
29892,
2322,
2433,
21476,
29918,
23361,
29918,
29883,
1336,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
703,
489,
26776,
613,
1134,
29922,
524,
29892,
2322,
29922,
29946,
29906,
29897,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
1188,
29899,
19207,
742,
1134,
29922,
524,
29892,
2322,
29922,
29896,
29900,
29900,
29892,
1539,
485,
279,
2433,
29940,
742,
13,
462,
4706,
1371,
2433,
3525,
1784,
9853,
267,
304,
4480,
1434,
12183,
6694,
4660,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
7620,
29918,
4299,
742,
3158,
2433,
8899,
29918,
3009,
742,
1371,
2433,
29879,
5989,
278,
16370,
1904,
1495,
13,
1678,
13812,
29889,
1202,
29918,
23516,
877,
489,
4299,
29918,
978,
742,
1134,
29922,
710,
29892,
1371,
2433,
4299,
934,
1024,
742,
2322,
2433,
29894,
1505,
29918,
6500,
5570,
1495,
13,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
13,
1678,
4742,
353,
4842,
305,
29889,
10141,
703,
29883,
6191,
1159,
13,
13,
1678,
396,
278,
1494,
29871,
29941,
3454,
526,
871,
4312,
304,
1207,
278,
6694,
8072,
9483,
15520,
29892,
366,
508,
3349,
963,
13,
1678,
16717,
29918,
17991,
1918,
29898,
5085,
29889,
26776,
29897,
13,
1678,
2897,
29889,
21813,
1839,
29907,
7466,
29931,
3289,
29918,
11686,
29968,
5550,
11538,
29918,
25903,
2033,
353,
525,
29901,
29896,
29953,
29901,
29947,
29915,
13,
1678,
4842,
305,
29889,
1509,
29918,
4801,
837,
262,
4695,
29918,
9564,
12404,
29898,
5574,
29897,
13,
13,
1678,
848,
29918,
3188,
353,
6389,
29889,
1272,
29918,
3972,
13,
13,
1678,
7945,
842,
353,
25669,
333,
2940,
16390,
24541,
29898,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
1272,
29918,
3188,
29892,
525,
14968,
29889,
7638,
5477,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
1272,
29918,
3188,
29892,
525,
2492,
29879,
5477,
13,
4706,
4327,
29922,
5085,
29889,
2987,
358,
29897,
13,
1678,
7945,
12657,
353,
4842,
305,
29889,
13239,
29889,
1272,
29889,
1469,
10036,
29898,
14968,
842,
29892,
9853,
29918,
2311,
29922,
29953,
29946,
29892,
528,
21897,
29922,
5574,
29892,
954,
29918,
1287,
414,
29922,
29896,
29906,
29947,
29892,
13,
462,
462,
795,
15645,
29918,
2344,
29918,
9144,
29922,
26776,
29918,
24602,
29897,
13,
1678,
659,
842,
353,
25669,
333,
2940,
16390,
24541,
29898,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
1272,
29918,
3188,
29892,
525,
3084,
29889,
7638,
5477,
13,
4706,
2897,
29889,
2084,
29889,
7122,
29898,
1272,
29918,
3188,
29892,
525,
2492,
29879,
5477,
13,
4706,
4327,
29922,
8516,
29897,
13,
1678,
659,
12657,
353,
4842,
305,
29889,
13239,
29889,
1272,
29889,
1469,
10036,
29898,
791,
842,
29892,
9853,
29918,
2311,
29922,
29953,
29946,
29892,
528,
21897,
29922,
8824,
29892,
954,
29918,
1287,
414,
29922,
29896,
29906,
29947,
29892,
13,
462,
462,
9651,
15645,
29918,
2344,
29918,
9144,
29922,
26776,
29918,
24602,
29897,
13,
13,
1678,
1904,
353,
478,
26788,
877,
29963,
26788,
29896,
29929,
2824,
29883,
6191,
580,
13,
1678,
5994,
3950,
353,
4842,
305,
29889,
20640,
29889,
26016,
29928,
29898,
4299,
29889,
16744,
3285,
301,
29878,
29922,
29900,
29889,
29896,
29892,
302,
4156,
586,
29922,
5574,
29892,
19399,
29922,
29900,
29889,
29929,
29897,
13,
1678,
1364,
14952,
353,
4842,
305,
29889,
20640,
29889,
29212,
29918,
816,
14952,
29889,
29907,
359,
457,
2744,
484,
12818,
29519,
29898,
20640,
3950,
29892,
323,
29918,
3317,
29922,
5085,
29889,
1949,
29918,
1022,
2878,
29879,
29897,
13,
13,
1678,
1596,
877,
29907,
29965,
7698,
3625,
29901,
742,
4842,
305,
29889,
29883,
6191,
29889,
275,
29918,
16515,
3101,
13,
13,
1678,
363,
21502,
305,
297,
3464,
29898,
29896,
29892,
6389,
29889,
1949,
29918,
1022,
2878,
29879,
718,
29871,
29896,
1125,
13,
4706,
7945,
29898,
5085,
29892,
1904,
29892,
4742,
29892,
7945,
12657,
29892,
5994,
3950,
29892,
21502,
305,
29897,
13,
4706,
659,
29898,
4299,
29892,
4742,
29892,
659,
12657,
29897,
13,
4706,
1364,
14952,
29889,
10568,
580,
13,
13,
1678,
565,
6389,
29889,
7620,
29918,
4299,
29901,
13,
4706,
1904,
29918,
3972,
353,
8207,
29882,
29895,
5847,
29914,
1287,
29914,
1287,
3493,
29914,
10526,
905,
29914,
326,
29929,
29896,
29929,
29941,
29899,
354,
4298,
29918,
305,
11768,
29918,
6500,
5570,
29914,
17314,
29918,
9794,
29915,
29871,
396,
14402,
7744,
304,
596,
2318,
664,
3493,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
4299,
29918,
3972,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
4706,
4842,
305,
29889,
7620,
29898,
4299,
29889,
3859,
29918,
8977,
3285,
2897,
29889,
2084,
29889,
7122,
29898,
4299,
29918,
3972,
29892,
29850,
1836,
415,
1642,
4830,
29898,
5085,
29889,
4299,
29918,
978,
4961,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
1667,
580,
13,
2
] |
avrofilter/avrofilter.py | CAIDA/hermes-avrofilter | 0 | 55368 | # Copyright 2019 The Regents of the University of California.
#
# 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.
#
# Original version written by <NAME> <<EMAIL>>
from swift.common.utils import get_logger, split_path, list_from_csv
from swift.common.swob import Request, Response, wsgify
from swift.common.constraints import valid_api_version
from swift.common.request_helpers import get_param
from swift.proxy.controllers.base import get_container_info, get_object_info
from swift.common.swob import wsgify
from avro_streamer.avro_streamer import GenericStrippingAvroParser
class AvroFilterMiddleware(object):
"""
Swift middleware for removing certain fields from downloaded Avro
objects, depending on a user's role.
Essentially, this allows the Avro objects to be selectively censored
for different classes of user -- for instance, there may be sensitive
data that is being collected that should only be made available to
privileged users.
See attached README.md file for instructions on how to configure this
middleware appropriately.
Stripping is only applied to objects that have a Content-Type of
'application/vnd.caida.<datatype>.avro'.
Requires: python-avro-streamer (https://github.com/CAIDA/python-avro-streamer)
"""
def __init__(self, app, conf, logger=None):
self.app = app
if logger:
self.logger = logger
else:
self.logger = get_logger(conf, log_route='avrofilter')
# Any roles specified as "nostrip_roles" will always receive the
# full uncensored Avro data
if 'nostrip_roles' in conf:
self.nostrip_roles = set([x.strip() \
for x in conf['nostrip_roles'].split(',')])
else:
self.nostrip_roles = set()
# admin should always be a nostrip role
self.nostrip_roles.add('admin')
self.defaultstrip = {}
self.dontstrip = {}
# Any field mentioned in a "retain_keys" option will be stripped
# by default, unless the user matches a role where that field is
# explicitly listed as being retained
# In other words: defaultstrip is the union of all of the fields that
# are explicitly configured as retainable. Any "public" fields should
# NOT be listed as a retained field for any role.
for k,v in conf.iteritems():
# The role that this option applies to is specified in the
# prefix of the configuration option name
# e.g. "swiftro_retain_keys" -> role = "swiftro"
if not k.endswith("_retain_keys"):
continue
role = k[:-12]
if role in self.dontstrip:
self.logger.info("Warning: role '%s' appears multiple times in AvroFilterMiddleware configuration" % (role))
# TODO only warn once per duplicate role
continue
self.dontstrip[role] = {}
for ts in list_from_csv(v):
ts = ts.strip()
if len(ts) == 0:
continue
# fields are listed using <datatype>:<fieldname> format, e.g.
# "flowtuple:netacq_country"
ts = ts.split(':')
if len(ts) != 2:
self.logger.info("Invalid 'retain_keys' parameter format, should be <data type>:<field name> (not %s)" % (ts))
continue
if ts[0] not in self.dontstrip[role]:
self.dontstrip[role][ts[0]] = set()
if ts[0] not in self.defaultstrip:
self.defaultstrip[ts[0]] = set()
self.dontstrip[role][ts[0]].add(ts[1])
self.defaultstrip[ts[0]].add(ts[1])
@wsgify
def __call__(self, req):
try:
(version, account, container, obj) = \
split_path(req.path_info, 4, 4, True)
except ValueError:
return req.get_response(self.app)
# Only worry about data fetches, not uploads.
if not valid_api_version(version) or req.method not in ('GET', 'HEAD'):
return req.get_response(self.app)
# Get all roles that apply to the user making the request
roles = set()
if (req.environ.get('HTTP_X_IDENTITY_STATUS') == 'Confirmed' or \
req.environ.get('HTTP_X_SERVICE_IDENTITY_STATUS') in \
(None, "Confirmed")):
roles = set(list_from_csv(req.environ.get('HTTP_X_ROLES', '')))
# If we have one of the "nostrip" roles, then don't do any stripping
if roles.intersection(self.nostrip_roles):
return req.get_response(self.app)
# Perform the request and grab a response object that we can work
# with
resp = req.get_response(self.app)
# Check that the requested object is actually a CAIDA avro file
conttype = resp.headers.get("Content-Type", None)
if conttype is None:
return resp
if not conttype.startswith("application/vnd.caida."):
return resp
if not conttype.endswith(".avro"):
return resp
dtype = conttype.replace("application/vnd.caida.", "", 1)[:-5]
if dtype not in self.defaultstrip:
return resp
# Start by planning to strip all fields for this datatype that have
# been explicitly appeared in the config file. Then for each role that
# the user has, remove any fields from the strip set that should be
# retained for that role.
tostrip = self.defaultstrip[dtype]
for r in roles:
if r not in self.dontstrip:
# No specified config for this role, so leave strip set as is
continue
if dtype not in self.dontstrip[r]:
continue
tostrip = tostrip - self.dontstrip[r][dtype]
# Remove the Etag because otherwise swift clients get very upset
# about the md5sum of the response body not matching the md5sum
# in the Etag header :/
if 'Etag' in resp.headers:
del(resp.headers['Etag'])
# If we are going to be stripping fields, replace our response
# iterable with one that will parse the received Avro and remove
# the desired fields. The swift proxy should handle the rest.
x = GenericStrippingAvroParser(resp.app_iter, resp.body, tostrip)
resp.app_iter = x
return resp
def filter_factory(global_conf, **local_conf):
"""Returns a WSGI filter app for use with paste.deploy."""
conf = global_conf.copy()
conf.update(local_conf)
def avro_strip(app):
return AvroFilterMiddleware(app, conf)
return avro_strip
# vim: set sw=4 tabstop=4 softtabstop=4 expandtab :
| [
1,
396,
14187,
1266,
29871,
29906,
29900,
29896,
29929,
450,
2169,
1237,
310,
278,
3014,
310,
8046,
29889,
13,
29937,
13,
29937,
10413,
21144,
1090,
278,
13380,
19245,
29892,
10079,
29871,
29906,
29889,
29900,
313,
1552,
376,
29931,
293,
1947,
1496,
366,
1122,
13,
29937,
451,
671,
445,
934,
5174,
297,
752,
13036,
411,
278,
19245,
29889,
887,
1122,
4017,
13,
29937,
263,
3509,
310,
278,
19245,
472,
13,
29937,
13,
29937,
418,
1732,
597,
1636,
29889,
4288,
29889,
990,
29914,
506,
11259,
29914,
27888,
1430,
1660,
29899,
29906,
29889,
29900,
13,
29937,
13,
29937,
25870,
3734,
491,
22903,
4307,
470,
15502,
304,
297,
5007,
29892,
7047,
13,
29937,
13235,
1090,
278,
19245,
338,
13235,
373,
385,
376,
3289,
8519,
29908,
350,
3289,
3235,
29892,
399,
1806,
8187,
2692,
13,
29937,
399,
1718,
29934,
13566,
29059,
6323,
8707,
29928,
22122,
29903,
8079,
13764,
29979,
476,
22255,
29892,
2845,
4653,
470,
2411,
2957,
29889,
2823,
278,
13,
29937,
19245,
363,
278,
2702,
4086,
14765,
1076,
11239,
322,
27028,
13,
29937,
1090,
278,
19245,
29889,
13,
29937,
13,
29937,
8533,
1873,
3971,
491,
529,
5813,
29958,
3532,
26862,
6227,
6778,
13,
13,
3166,
12086,
29889,
9435,
29889,
13239,
1053,
679,
29918,
21707,
29892,
6219,
29918,
2084,
29892,
1051,
29918,
3166,
29918,
7638,
13,
3166,
12086,
29889,
9435,
29889,
2774,
711,
1053,
10729,
29892,
13291,
29892,
281,
5311,
1598,
13,
3166,
12086,
29889,
9435,
29889,
13646,
29879,
1053,
2854,
29918,
2754,
29918,
3259,
13,
3166,
12086,
29889,
9435,
29889,
3827,
29918,
3952,
6774,
1053,
679,
29918,
3207,
13,
3166,
12086,
29889,
14701,
29889,
1285,
11897,
29889,
3188,
1053,
679,
29918,
7611,
29918,
3888,
29892,
679,
29918,
3318,
29918,
3888,
13,
3166,
12086,
29889,
9435,
29889,
2774,
711,
1053,
281,
5311,
1598,
13,
13,
3166,
1029,
307,
29918,
5461,
261,
29889,
485,
307,
29918,
5461,
261,
1053,
3251,
293,
855,
374,
3262,
12810,
307,
11726,
13,
13,
1990,
7740,
307,
5072,
25411,
2519,
29898,
3318,
1125,
13,
1678,
9995,
13,
1678,
14156,
7256,
2519,
363,
11077,
3058,
4235,
515,
16532,
7740,
307,
13,
1678,
3618,
29892,
8679,
373,
263,
1404,
29915,
29879,
6297,
29889,
13,
13,
1678,
11044,
9247,
29892,
445,
6511,
278,
7740,
307,
3618,
304,
367,
1831,
3598,
19343,
4395,
13,
1678,
363,
1422,
4413,
310,
1404,
1192,
363,
2777,
29892,
727,
1122,
367,
20502,
13,
1678,
848,
393,
338,
1641,
16531,
393,
881,
871,
367,
1754,
3625,
304,
13,
1678,
14828,
3192,
4160,
29889,
13,
13,
1678,
2823,
10959,
5195,
3035,
2303,
29889,
3487,
934,
363,
11994,
373,
920,
304,
10822,
445,
13,
1678,
7256,
2519,
7128,
2486,
29889,
13,
13,
1678,
624,
374,
3262,
338,
871,
7436,
304,
3618,
393,
505,
263,
10576,
29899,
1542,
310,
13,
1678,
525,
6214,
29914,
29894,
299,
29889,
1113,
1458,
19423,
4130,
23179,
15513,
485,
307,
4286,
13,
13,
1678,
830,
339,
2658,
29901,
3017,
29899,
485,
307,
29899,
5461,
261,
313,
991,
597,
3292,
29889,
510,
29914,
5454,
1367,
29909,
29914,
4691,
29899,
485,
307,
29899,
5461,
261,
29897,
13,
1678,
9995,
13,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
623,
29892,
1970,
29892,
17927,
29922,
8516,
1125,
13,
4706,
1583,
29889,
932,
353,
623,
13,
13,
4706,
565,
17927,
29901,
13,
9651,
1583,
29889,
21707,
353,
17927,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
21707,
353,
679,
29918,
21707,
29898,
5527,
29892,
1480,
29918,
13134,
2433,
485,
307,
4572,
1495,
13,
13,
4706,
396,
3139,
16178,
6790,
408,
376,
6582,
6472,
29918,
307,
793,
29908,
674,
2337,
7150,
278,
13,
4706,
396,
2989,
443,
29883,
575,
4395,
7740,
307,
848,
13,
4706,
565,
525,
6582,
6472,
29918,
307,
793,
29915,
297,
1970,
29901,
13,
9651,
1583,
29889,
6582,
6472,
29918,
307,
793,
353,
731,
4197,
29916,
29889,
17010,
580,
320,
13,
462,
1678,
363,
921,
297,
1970,
1839,
6582,
6472,
29918,
307,
793,
13359,
5451,
29317,
1495,
2314,
13,
4706,
1683,
29901,
13,
9651,
1583,
29889,
6582,
6472,
29918,
307,
793,
353,
731,
580,
13,
13,
4706,
396,
4113,
881,
2337,
367,
263,
20990,
6472,
6297,
13,
4706,
1583,
29889,
6582,
6472,
29918,
307,
793,
29889,
1202,
877,
6406,
1495,
13,
13,
4706,
1583,
29889,
4381,
17010,
353,
6571,
13,
4706,
1583,
29889,
29881,
609,
17010,
353,
6571,
13,
13,
4706,
396,
3139,
1746,
5276,
297,
263,
376,
2267,
475,
29918,
8149,
29908,
2984,
674,
367,
10076,
2986,
13,
4706,
396,
491,
2322,
29892,
6521,
278,
1404,
7087,
263,
6297,
988,
393,
1746,
338,
13,
4706,
396,
9479,
9904,
408,
1641,
26060,
13,
13,
4706,
396,
512,
916,
3838,
29901,
2322,
17010,
338,
278,
9833,
310,
599,
310,
278,
4235,
393,
13,
4706,
396,
526,
9479,
13252,
408,
11551,
519,
29889,
3139,
376,
3597,
29908,
4235,
881,
13,
4706,
396,
6058,
367,
9904,
408,
263,
26060,
1746,
363,
738,
6297,
29889,
13,
4706,
363,
413,
29892,
29894,
297,
1970,
29889,
1524,
7076,
7295,
13,
9651,
396,
450,
6297,
393,
445,
2984,
16058,
304,
338,
6790,
297,
278,
13,
9651,
396,
10944,
310,
278,
5285,
2984,
1024,
13,
9651,
396,
321,
29889,
29887,
29889,
376,
26792,
307,
29918,
2267,
475,
29918,
8149,
29908,
1599,
6297,
353,
376,
26792,
307,
29908,
13,
9651,
565,
451,
413,
29889,
1975,
2541,
703,
29918,
2267,
475,
29918,
8149,
29908,
1125,
13,
18884,
6773,
13,
13,
9651,
6297,
353,
413,
7503,
29899,
29896,
29906,
29962,
13,
13,
9651,
565,
6297,
297,
1583,
29889,
29881,
609,
17010,
29901,
13,
18884,
1583,
29889,
21707,
29889,
3888,
703,
22709,
29901,
6297,
14210,
29879,
29915,
5692,
2999,
3064,
297,
7740,
307,
5072,
25411,
2519,
5285,
29908,
1273,
313,
12154,
876,
13,
18884,
396,
14402,
871,
29383,
2748,
639,
7929,
6297,
13,
18884,
6773,
13,
13,
9651,
1583,
29889,
29881,
609,
17010,
29961,
12154,
29962,
353,
6571,
13,
13,
9651,
363,
18696,
297,
1051,
29918,
3166,
29918,
7638,
29898,
29894,
1125,
13,
18884,
18696,
353,
18696,
29889,
17010,
580,
13,
18884,
565,
7431,
29898,
1372,
29897,
1275,
29871,
29900,
29901,
13,
462,
1678,
6773,
13,
13,
18884,
396,
4235,
526,
9904,
773,
529,
4130,
23179,
23917,
29966,
2671,
978,
29958,
3402,
29892,
321,
29889,
29887,
29889,
13,
18884,
396,
376,
1731,
23583,
29901,
1212,
562,
29939,
29918,
13509,
29908,
13,
18884,
18696,
353,
18696,
29889,
5451,
877,
29901,
1495,
13,
18884,
565,
7431,
29898,
1372,
29897,
2804,
29871,
29906,
29901,
13,
462,
1678,
1583,
29889,
21707,
29889,
3888,
703,
13919,
525,
2267,
475,
29918,
8149,
29915,
3443,
3402,
29892,
881,
367,
529,
1272,
1134,
23917,
29966,
2671,
1024,
29958,
313,
1333,
1273,
29879,
5513,
1273,
313,
1372,
876,
13,
462,
1678,
6773,
13,
13,
18884,
565,
18696,
29961,
29900,
29962,
451,
297,
1583,
29889,
29881,
609,
17010,
29961,
12154,
5387,
13,
462,
1678,
1583,
29889,
29881,
609,
17010,
29961,
12154,
3816,
1372,
29961,
29900,
5262,
353,
731,
580,
13,
18884,
565,
18696,
29961,
29900,
29962,
451,
297,
1583,
29889,
4381,
17010,
29901,
13,
462,
1678,
1583,
29889,
4381,
17010,
29961,
1372,
29961,
29900,
5262,
353,
731,
580,
13,
13,
18884,
1583,
29889,
29881,
609,
17010,
29961,
12154,
3816,
1372,
29961,
29900,
29962,
1822,
1202,
29898,
1372,
29961,
29896,
2314,
13,
18884,
1583,
29889,
4381,
17010,
29961,
1372,
29961,
29900,
29962,
1822,
1202,
29898,
1372,
29961,
29896,
2314,
13,
13,
13,
1678,
732,
29893,
5311,
1598,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
12428,
1125,
13,
4706,
1018,
29901,
13,
9651,
313,
3259,
29892,
3633,
29892,
5639,
29892,
5446,
29897,
353,
320,
13,
462,
1678,
6219,
29918,
2084,
29898,
7971,
29889,
2084,
29918,
3888,
29892,
29871,
29946,
29892,
29871,
29946,
29892,
5852,
29897,
13,
4706,
5174,
7865,
2392,
29901,
13,
9651,
736,
12428,
29889,
657,
29918,
5327,
29898,
1311,
29889,
932,
29897,
13,
13,
4706,
396,
9333,
15982,
1048,
848,
6699,
267,
29892,
451,
6441,
29879,
29889,
13,
4706,
565,
451,
2854,
29918,
2754,
29918,
3259,
29898,
3259,
29897,
470,
12428,
29889,
5696,
451,
297,
6702,
7194,
742,
525,
23252,
29374,
13,
9651,
736,
12428,
29889,
657,
29918,
5327,
29898,
1311,
29889,
932,
29897,
13,
13,
4706,
396,
3617,
599,
16178,
393,
3394,
304,
278,
1404,
3907,
278,
2009,
13,
4706,
16178,
353,
731,
580,
13,
4706,
565,
313,
7971,
29889,
21813,
29889,
657,
877,
10493,
29918,
29990,
29918,
1367,
3919,
11937,
29918,
27047,
1495,
1275,
525,
16376,
381,
2168,
29915,
470,
320,
13,
18884,
12428,
29889,
21813,
29889,
657,
877,
10493,
29918,
29990,
29918,
6304,
19059,
29918,
1367,
3919,
11937,
29918,
27047,
1495,
297,
320,
13,
462,
4706,
313,
8516,
29892,
376,
16376,
381,
2168,
5783,
29901,
13,
9651,
16178,
353,
731,
29898,
1761,
29918,
3166,
29918,
7638,
29898,
7971,
29889,
21813,
29889,
657,
877,
10493,
29918,
29990,
29918,
1672,
17101,
742,
6629,
4961,
13,
13,
4706,
396,
960,
591,
505,
697,
310,
278,
376,
6582,
6472,
29908,
16178,
29892,
769,
1016,
29915,
29873,
437,
738,
10076,
3262,
13,
4706,
565,
16178,
29889,
1639,
2042,
29898,
1311,
29889,
6582,
6472,
29918,
307,
793,
1125,
13,
9651,
736,
12428,
29889,
657,
29918,
5327,
29898,
1311,
29889,
932,
29897,
13,
13,
4706,
396,
27313,
278,
2009,
322,
17229,
263,
2933,
1203,
393,
591,
508,
664,
13,
4706,
396,
411,
13,
4706,
4613,
353,
12428,
29889,
657,
29918,
5327,
29898,
1311,
29889,
932,
29897,
13,
13,
4706,
396,
5399,
393,
278,
13877,
1203,
338,
2869,
263,
12766,
1367,
29909,
1029,
307,
934,
13,
4706,
640,
1853,
353,
4613,
29889,
13662,
29889,
657,
703,
3916,
29899,
1542,
613,
6213,
29897,
13,
13,
4706,
565,
640,
1853,
338,
6213,
29901,
13,
9651,
736,
4613,
13,
13,
4706,
565,
451,
640,
1853,
29889,
27382,
2541,
703,
6214,
29914,
29894,
299,
29889,
1113,
1458,
1213,
1125,
13,
9651,
736,
4613,
13,
13,
4706,
565,
451,
640,
1853,
29889,
1975,
2541,
17350,
485,
307,
29908,
1125,
13,
9651,
736,
4613,
13,
13,
4706,
26688,
353,
640,
1853,
29889,
6506,
703,
6214,
29914,
29894,
299,
29889,
1113,
1458,
19602,
12633,
29871,
29896,
29897,
7503,
29899,
29945,
29962,
13,
13,
4706,
565,
26688,
451,
297,
1583,
29889,
4381,
17010,
29901,
13,
9651,
736,
4613,
13,
13,
4706,
396,
7370,
491,
18987,
304,
17820,
599,
4235,
363,
445,
1418,
23179,
393,
505,
13,
4706,
396,
1063,
9479,
7470,
297,
278,
2295,
934,
29889,
1987,
363,
1269,
6297,
393,
13,
4706,
396,
278,
1404,
756,
29892,
3349,
738,
4235,
515,
278,
17820,
731,
393,
881,
367,
13,
4706,
396,
26060,
363,
393,
6297,
29889,
13,
4706,
304,
17010,
353,
1583,
29889,
4381,
17010,
29961,
29881,
1853,
29962,
13,
13,
4706,
363,
364,
297,
16178,
29901,
13,
9651,
565,
364,
451,
297,
1583,
29889,
29881,
609,
17010,
29901,
13,
18884,
396,
1939,
6790,
2295,
363,
445,
6297,
29892,
577,
5967,
17820,
731,
408,
338,
13,
18884,
6773,
13,
13,
9651,
565,
26688,
451,
297,
1583,
29889,
29881,
609,
17010,
29961,
29878,
5387,
13,
18884,
6773,
13,
13,
9651,
304,
17010,
353,
304,
17010,
448,
1583,
29889,
29881,
609,
17010,
29961,
29878,
3816,
29881,
1853,
29962,
13,
13,
4706,
396,
15154,
278,
382,
4039,
1363,
6467,
12086,
13154,
679,
1407,
24081,
300,
13,
4706,
396,
1048,
278,
22821,
29945,
2083,
310,
278,
2933,
3573,
451,
9686,
278,
22821,
29945,
2083,
13,
4706,
396,
297,
278,
382,
4039,
4839,
584,
29914,
13,
4706,
565,
525,
29923,
4039,
29915,
297,
4613,
29889,
13662,
29901,
13,
9651,
628,
29898,
13713,
29889,
13662,
1839,
29923,
4039,
11287,
13,
13,
4706,
396,
960,
591,
526,
2675,
304,
367,
10076,
3262,
4235,
29892,
5191,
1749,
2933,
13,
4706,
396,
4256,
519,
411,
697,
393,
674,
6088,
278,
4520,
7740,
307,
322,
3349,
13,
4706,
396,
278,
7429,
4235,
29889,
450,
12086,
10166,
881,
4386,
278,
1791,
29889,
13,
4706,
921,
353,
3251,
293,
855,
374,
3262,
12810,
307,
11726,
29898,
13713,
29889,
932,
29918,
1524,
29892,
4613,
29889,
2587,
29892,
304,
17010,
29897,
13,
4706,
4613,
29889,
932,
29918,
1524,
353,
921,
13,
13,
4706,
736,
4613,
13,
13,
13,
1753,
4175,
29918,
14399,
29898,
10945,
29918,
5527,
29892,
3579,
2997,
29918,
5527,
1125,
13,
1678,
9995,
11609,
29879,
263,
399,
26016,
29902,
4175,
623,
363,
671,
411,
11417,
29889,
16519,
1213,
15945,
13,
1678,
1970,
353,
5534,
29918,
5527,
29889,
8552,
580,
13,
1678,
1970,
29889,
5504,
29898,
2997,
29918,
5527,
29897,
13,
13,
1678,
822,
1029,
307,
29918,
17010,
29898,
932,
1125,
13,
4706,
736,
7740,
307,
5072,
25411,
2519,
29898,
932,
29892,
1970,
29897,
13,
1678,
736,
1029,
307,
29918,
17010,
13,
13,
13,
29937,
325,
326,
29901,
731,
2381,
29922,
29946,
4434,
9847,
29922,
29946,
4964,
3891,
9847,
29922,
29946,
7985,
3891,
584,
13,
13,
2
] |
src/model/operationsbn.py | guoyongcs/HNAS | 60 | 113826 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import sys
sys.path.append("..")
from option import args
OPS = {
'none': lambda C, stride, affine: Zero(stride),
'avg_pool_3x3': lambda C, stride, affine: nn.AvgPool2d(3, stride=stride, padding=1, count_include_pad=False),
'max_pool_3x3': lambda C, stride, affine: nn.MaxPool2d(3, stride=stride, padding=1),
'skip_connect': lambda C, stride, affine: Identity(),
'sep_conv_3x3': lambda C, stride, affine: SepConv(C, C, 3, stride, 1, affine=affine),
'sep_conv_5x5': lambda C, stride, affine: SepConv(C, C, 5, stride, 2, affine=affine),
'sep_conv_7x7': lambda C, stride, affine: SepConv(C, C, 7, stride, 3, affine=affine),
'dil_conv_3x3': lambda C, stride, affine: DilConv(C, C, 3, stride, 2, 2, affine=affine),
'dil_conv_5x5': lambda C, stride, affine: DilConv(C, C, 5, stride, 4, 2, affine=affine),
'conv_7x1_1x7': lambda C, stride, affine: nn.Sequential(
nn.ReLU(inplace=False),
nn.Conv2d(C, C, (1, 7), stride=(1, stride), padding=(0, 3), bias=False),
nn.Conv2d(C, C, (7, 1), stride=(stride, 1), padding=(3, 0), bias=False),
nn.BatchNorm2d(C, affine=affine)
),
'conv_3x3': lambda C, stride, affine: ReLUConvBN(C, C, 3, stride, 1, affine=affine),
'conv_3x3_no_relu': lambda C, stride, affine: ConvBN(C, C, 3, stride, 1, affine=affine),
'conv_3x3_no_relu_no_bn': lambda C, stride, affine: Conv(C, C, 3, stride, 1, affine=affine),
'conv_3x3_no_bn': lambda C, stride, affine: ReLUConv(C, C, 3, stride, 1, affine=affine),
'rcab': lambda C, stride, affine: RCAB( C, 3, 3,bias=True, bn=True, act=nn.ReLU(True), res_scale=1),
#first 3 is kernel-size,the second 3 is the number of feature map
'up_and_down': lambda C, stride, affine: UPANDDOWN( C, scale_factor=args.scale[0]),
#upsampling cell:
'sub_pixel':lambda C, stride, affine: SUBPIXEL(C, scale_factor=stride),
'manual_sub_pixel':lambda C, stride, affine: SUBPIXEL(C, scale_factor=2),
'deconvolution':lambda C, stride, affine: Deconvolution(C,stride),
'bilinear':lambda C, stride, affine: Bilinear(stride),
'nearest':lambda C, stride, affine: Nearest(stride),
'linear':lambda C, stride, affine: Linear(stride),
'area':lambda C, stride, affine: Area(stride),
'upproject': lambda C, stride, affine: Upproject(C, scale_factor=2),
'downproject': lambda C, stride, affine: Downproject(C, scale_factor=2),
'upprojectnone': lambda C, stride, affine: UpprojectNone(C, scale_factor=2),
}
def default_conv(in_channels, out_channels, kernel_size, bias=True):
return nn.Conv2d(
in_channels, out_channels, kernel_size,
padding=(kernel_size//2), bias=bias)
class ReLUConv(nn.Module):
def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=True):
super(ReLUConv, self).__init__()
self.op = nn.Sequential(
nn.ReLU(inplace=False),
nn.Conv2d(C_in, C_out, kernel_size, stride=stride, padding=padding, bias=False),
# nn.BatchNorm2d(C_out, affine=affine)
)
def forward(self, x):
return self.op(x)
class Downproject(nn.Module):
def __init__(
self, base_filter, scale_factor):
super(Downproject, self).__init__()
if scale_factor == 2:
kernel = 6
stride = 2
padding = 2
elif scale_factor == 4:
kernel = 8
stride = 4
padding = 2
elif scale_factor == 8:
kernel = 12
stride = 8
padding = 2
# self.up1 = UpBlock(base_filter, kernel, stride, padding)
self.down1 = DownBlock(base_filter, kernel, stride, padding)
def forward(self, x):
x = self.down1(x)
return x
class UpprojectNone(nn.Module):
def __init__(
self, base_filter, scale_factor):
super(UpprojectNone, self).__init__()
if scale_factor == 2:
kernel = 6
stride = 2
padding = 2
elif scale_factor == 4:
kernel = 8
stride = 4
padding = 2
elif scale_factor == 8:
kernel = 12
stride = 8
padding = 2
self.up1 = UpBlock(base_filter, kernel, stride, padding)
# self.down1 = DownBlock(base_filter, kernel, stride, padding)
def forward(self, x):
x = self.up1(x)
return x.mul(0.)
class Upproject(nn.Module):
def __init__(
self, base_filter, scale_factor):
super(Upproject, self).__init__()
if scale_factor == 2:
kernel = 6
stride = 2
padding = 2
elif scale_factor == 4:
kernel = 8
stride = 4
padding = 2
elif scale_factor == 8:
kernel = 12
stride = 8
padding = 2
self.up1 = UpBlock(base_filter, kernel, stride, padding)
# self.down1 = DownBlock(base_filter, kernel, stride, padding)
def forward(self, x):
x = self.up1(x)
return x
class Conv(nn.Module):
def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=True):
super(Conv, self).__init__()
self.op = nn.Sequential(
# nn.ReLU(inplace=False),
nn.Conv2d(C_in, C_out, kernel_size, stride=stride, padding=padding, bias=False),
# nn.BatchNorm2d(C_out, affine=affine)
)
def forward(self, x):
return self.op(x)
class ConvBN(nn.Module):
def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=True):
super(ConvBN, self).__init__()
self.op = nn.Sequential(
# nn.ReLU(inplace=False),
nn.Conv2d(C_in, C_out, kernel_size, stride=stride, padding=padding, bias=False),
nn.BatchNorm2d(C_out, affine=affine)
)
def forward(self, x):
return self.op(x)
class Bilinear(nn.Module):
def __init__(self, stride):
super(Bilinear, self).__init__()
self.scale=stride
def forward(self, x):
return F.interpolate(x, scale_factor=self.scale, mode='bilinear')
class Linear(nn.Module):
def __init__(self, stride):
super(Linear, self).__init__()
self.scale=stride
def forward(self, x):
return F.interpolate(x, scale_factor=self.scale, mode='linear')
class Area(nn.Module):
def __init__(self, stride):
super(Area, self).__init__()
self.scale=stride
def forward(self, x):
return F.interpolate(x, scale_factor=self.scale, mode='area')
class Nearest(nn.Module):
def __init__(self, stride):
super(Nearest, self).__init__()
self.scale=stride
def forward(self, x):
return F.interpolate(x, scale_factor=self.scale, mode='nearest')
class Deconvolution(nn.Module):
def __init__(self, C, stride):
super(Deconvolution, self).__init__()
if stride==2:
kernel_size=3
output_padding=1
elif stride==4:
kernel_size=5
output_padding = 1
else:
kernel_size=3
output_padding = 0
self.deconv=nn.ConvTranspose2d(C, C,kernel_size=kernel_size,stride=stride, padding=1,output_padding=output_padding)
def forward(self, x):
return self.deconv(x)
class SUBPIXEL(nn.Module):
def __init__(self, C, scale_factor,conv=default_conv):
super(SUBPIXEL, self).__init__()
self.upsample=Upsampler(conv, scale_factor, C, act=False)
def forward(self, x):
return self.upsample(x)
class Upsampler(nn.Sequential):
def __init__(self, conv, scale, n_feats, bn=False, act=False, bias=True):
m = []
if (scale & (scale - 1)) == 0: # Is scale = 2^n?
for _ in range(int(math.log(scale, 2))):
m.append(conv(n_feats, 4 * n_feats, 3, bias))
m.append(nn.PixelShuffle(2))
if bn:
m.append(nn.BatchNorm2d(n_feats))
if act == 'relu':
m.append(nn.ReLU(True))
elif act == 'prelu':
m.append(nn.PReLU(n_feats))
elif scale == 3:
m.append(conv(n_feats, 9 * n_feats, 3, bias))
m.append(nn.PixelShuffle(3))
if bn:
m.append(nn.BatchNorm2d(n_feats))
if act == 'relu':
m.append(nn.ReLU(True))
elif act == 'prelu':
m.append(nn.PReLU(n_feats))
else:
raise NotImplementedError
super(Upsampler, self).__init__(*m)
class ReLUConvBN(nn.Module):
def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=True):
super(ReLUConvBN, self).__init__()
self.op = nn.Sequential(
nn.ReLU(inplace=False),
nn.Conv2d(C_in, C_out, kernel_size, stride=stride, padding=padding, bias=False),
nn.BatchNorm2d(C_out, affine=affine)
)
def forward(self, x):
return self.op(x)
class DilConv(nn.Module):
def __init__(self, C_in, C_out, kernel_size, stride, padding, dilation, affine=True):
super(DilConv, self).__init__()
self.op = nn.Sequential(
nn.ReLU(inplace=False),
nn.Conv2d(C_in, C_in, kernel_size=kernel_size, stride=stride, padding=padding, dilation=dilation,
groups=C_in, bias=False),
nn.Conv2d(C_in, C_out, kernel_size=1, padding=0, bias=False),
nn.BatchNorm2d(C_out, affine=affine),
)
def forward(self, x):
return self.op(x)
class SepConv(nn.Module):
def __init__(self, C_in, C_out, kernel_size, stride, padding, affine=True):
super(SepConv, self).__init__()
self.op = nn.Sequential(
nn.ReLU(inplace=False),
nn.Conv2d(C_in, C_in, kernel_size=kernel_size, stride=stride, padding=padding, groups=C_in, bias=False),
nn.Conv2d(C_in, C_in, kernel_size=1, padding=0, bias=False),
nn.BatchNorm2d(C_in, affine=affine),
nn.ReLU(inplace=False),
nn.Conv2d(C_in, C_in, kernel_size=kernel_size, stride=1, padding=padding, groups=C_in, bias=False),
nn.Conv2d(C_in, C_out, kernel_size=1, padding=0, bias=False),
nn.BatchNorm2d(C_out, affine=affine),
)
def forward(self, x):
return self.op(x)
class Identity(nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
class Zero(nn.Module):
def __init__(self, stride):
super(Zero, self).__init__()
self.stride = stride
def forward(self, x):
return x.mul(0.)
class FactorizedReduce(nn.Module):
def __init__(self, C_in, C_out, affine=True):
super(FactorizedReduce, self).__init__()
assert C_out % 2 == 0
self.relu = nn.ReLU(inplace=False)
self.conv_1 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
self.conv_2 = nn.Conv2d(C_in, C_out // 2, 1, stride=2, padding=0, bias=False)
self.bn = nn.BatchNorm2d(C_out, affine=affine)
def forward(self, x):
x = self.relu(x)
if x.size(2)%2!=0:
x = F.pad(x, (1,0,1,0), "constant", 0)
out = torch.cat([self.conv_1(x), self.conv_2(x[:, :, 1:, 1:])], dim=1)
out = self.bn(out)
return out
class ThinConv2d(nn.Conv2d):
"""
custom convolutional layers for thin convolution
"""
def __init__(self, in_channels, out_channels, kernel_size,
stride=1, padding=0, dilation=1, groups=1, bias=True):
super(ThinConv2d, self).__init__(in_channels=in_channels, out_channels=out_channels,
kernel_size=kernel_size,
stride=stride, padding=padding, dilation=dilation, groups=groups, bias=bias)
def _thin_weight(self, input, index=None):
n, c, h, w = input.size()
# print(index.size())
# print(index)
num_nodes = index.size(0)
index = index.view(1, num_nodes, 1, 1)
final_index = index.expand(n, num_nodes, h, w)
thin_data = torch.gather(input, 1, final_index)
return thin_data
def forward(self, input, index=None):
if index is not None:
thin_weight = self._thin_weight(self.weight, index)
else:
thin_weight = self.weight
return F.conv2d(input, thin_weight, self.bias, self.stride,
self.padding, self.dilation, self.groups)
class FinalConv(nn.Module):
def __init__(self, C_in, C_out, affine=True):
super(FinalConv, self).__init__()
assert C_out % 2 == 0
self.relu = nn.ReLU(inplace=False)
self.thin_conv = ThinConv2d(C_in, C_out, 1, stride=1, padding=0, bias=False)
self.bn = nn.BatchNorm2d(C_out, affine=affine)
def forward(self, x, index):
x = self.relu(x)
out = self.thin_conv(x, index)
out = self.bn(out)
return out
## Channel Attention (CA) Layer
class CALayer(nn.Module):
def __init__(self, channel, reduction=16):
super(CALayer, self).__init__()
# global average pooling: feature --> point
self.avg_pool = nn.AdaptiveAvgPool2d(1)
# feature channel downscale and upscale --> channel weight
self.conv_du = nn.Sequential(
nn.Conv2d(channel, channel // reduction, 1, padding=0, bias=True),
nn.ReLU(inplace=True),
nn.Conv2d(channel // reduction, channel, 1, padding=0, bias=True),
nn.Sigmoid()
)
def forward(self, x):
y = self.avg_pool(x)
y = self.conv_du(y)
return x * y
## Residual Channel Attention Block (RCAB)
class RCAB(nn.Module):
def __init__(
self, n_feat, kernel_size, reduction,conv=default_conv,
bias=True, bn=False, act=nn.ReLU(True), res_scale=1):
super(RCAB, self).__init__()
modules_body = []
for i in range(2):
modules_body.append(conv(n_feat, n_feat, kernel_size, bias=bias))
if bn: modules_body.append(nn.BatchNorm2d(n_feat))
if i == 0: modules_body.append(act)
modules_body.append(CALayer(n_feat, reduction))
self.body = nn.Sequential(*modules_body)
self.res_scale = res_scale
def forward(self, x):
res = self.body(x)
#res = self.body(x).mul(self.res_scale)
res += x
return res
class UPANDDOWN(nn.Module):
def __init__(
self, base_filter, scale_factor):
super(UPANDDOWN, self).__init__()
if scale_factor == 2:
kernel = 6
stride = 2
padding = 2
elif scale_factor == 4:
kernel = 8
stride = 4
padding = 2
elif scale_factor == 8:
kernel = 12
stride = 8
padding = 2
self.up1 = UpBlock(base_filter, kernel, stride, padding)
self.down1 = DownBlock(base_filter, kernel, stride, padding)
def forward(self, x):
x = self.up1(x)
x = self.down1(x)
return x
class UpBlock(torch.nn.Module):
def __init__(self, num_filter, kernel_size=8, stride=4, padding=2, bias=True, activation='prelu', norm=None):
super(UpBlock, self).__init__()
self.up_conv1 = DeconvBlock(num_filter, num_filter, kernel_size, stride, padding, activation, norm=None)
self.up_conv2 = ConvBlock(num_filter, num_filter, kernel_size, stride, padding, activation, norm=None)
self.up_conv3 = DeconvBlock(num_filter, num_filter, kernel_size, stride, padding, activation, norm=None)
def forward(self, x):
h0 = self.up_conv1(x)
l0 = self.up_conv2(h0)
h1 = self.up_conv3(l0 - x)
return h1 + h0
class DownBlock(torch.nn.Module):
def __init__(self, num_filter, kernel_size=8, stride=4, padding=2, bias=True, activation='prelu', norm=None):
super(DownBlock, self).__init__()
self.down_conv1 = ConvBlock(num_filter, num_filter, kernel_size, stride, padding, activation, norm=None)
self.down_conv2 = DeconvBlock(num_filter, num_filter, kernel_size, stride, padding, activation, norm=None)
self.down_conv3 = ConvBlock(num_filter, num_filter, kernel_size, stride, padding, activation, norm=None)
def forward(self, x):
l0 = self.down_conv1(x)
h0 = self.down_conv2(l0)
l1 = self.down_conv3(h0 - x)
return l1 + l0
class DeconvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=4, stride=2, padding=1, bias=True, activation='prelu', norm=None):
super(DeconvBlock, self).__init__()
self.deconv = torch.nn.ConvTranspose2d(input_size, output_size, kernel_size, stride, padding, bias=bias)
self.norm = norm
if self.norm == 'batch':
self.bn = torch.nn.BatchNorm2d(output_size)
elif self.norm == 'instance':
self.bn = torch.nn.InstanceNorm2d(output_size)
self.activation = activation
if self.activation == 'relu':
self.act = torch.nn.ReLU(True)
elif self.activation == 'prelu':
self.act = torch.nn.PReLU()
elif self.activation == 'lrelu':
self.act = torch.nn.LeakyReLU(0.2, True)
elif self.activation == 'tanh':
self.act = torch.nn.Tanh()
elif self.activation == 'sigmoid':
self.act = torch.nn.Sigmoid()
def forward(self, x):
if self.norm is not None:
out = self.bn(self.deconv(x))
else:
out = self.deconv(x)
if self.activation is not None:
return self.act(out)
else:
return out
class ConvBlock(torch.nn.Module):
def __init__(self, input_size, output_size, kernel_size=3, stride=1, padding=1, bias=True, activation='prelu', norm=None):
super(ConvBlock, self).__init__()
self.conv = torch.nn.Conv2d(input_size, output_size, kernel_size, stride, padding, bias=bias)
self.norm = norm
if self.norm =='batch':
self.bn = torch.nn.BatchNorm2d(output_size)
elif self.norm == 'instance':
self.bn = torch.nn.InstanceNorm2d(output_size)
self.activation = activation
if self.activation == 'relu':
self.act = torch.nn.ReLU(True)
elif self.activation == 'prelu':
self.act = torch.nn.PReLU()
elif self.activation == 'lrelu':
self.act = torch.nn.LeakyReLU(0.2, True)
elif self.activation == 'tanh':
self.act = torch.nn.Tanh()
elif self.activation == 'sigmoid':
self.act = torch.nn.Sigmoid()
def forward(self, x):
if self.norm is not None:
out = self.bn(self.conv(x))
else:
out = self.conv(x)
if self.activation is not None:
return self.act(out)
else:
return out | [
1,
1053,
4842,
305,
30004,
13,
5215,
4842,
305,
29889,
15755,
408,
302,
29876,
30004,
13,
5215,
4842,
305,
29889,
15755,
29889,
2220,
284,
408,
383,
30004,
13,
5215,
5844,
30004,
13,
5215,
10876,
30004,
13,
9675,
29889,
2084,
29889,
4397,
703,
636,
1159,
30004,
13,
3166,
2984,
1053,
6389,
30004,
13,
30004,
13,
4590,
29903,
353,
3336,
13,
1678,
525,
9290,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
28933,
29898,
303,
2426,
511,
30004,
13,
1678,
525,
485,
29887,
29918,
10109,
29918,
29941,
29916,
29941,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
302,
29876,
29889,
12810,
29887,
11426,
29906,
29881,
29898,
29941,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
29896,
29892,
2302,
29918,
2856,
29918,
8305,
29922,
8824,
511,
30004,
13,
1678,
525,
3317,
29918,
10109,
29918,
29941,
29916,
29941,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
302,
29876,
29889,
7976,
11426,
29906,
29881,
29898,
29941,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
29896,
511,
30004,
13,
1678,
525,
11014,
29918,
6915,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
27486,
3285,
30004,
13,
1678,
525,
19570,
29918,
20580,
29918,
29941,
29916,
29941,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
29639,
1168,
29894,
29898,
29907,
29892,
315,
29892,
29871,
29941,
29892,
380,
2426,
29892,
29871,
29896,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
19570,
29918,
20580,
29918,
29945,
29916,
29945,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
29639,
1168,
29894,
29898,
29907,
29892,
315,
29892,
29871,
29945,
29892,
380,
2426,
29892,
29871,
29906,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
19570,
29918,
20580,
29918,
29955,
29916,
29955,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
29639,
1168,
29894,
29898,
29907,
29892,
315,
29892,
29871,
29955,
29892,
380,
2426,
29892,
29871,
29941,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
29881,
309,
29918,
20580,
29918,
29941,
29916,
29941,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
360,
309,
1168,
29894,
29898,
29907,
29892,
315,
29892,
29871,
29941,
29892,
380,
2426,
29892,
29871,
29906,
29892,
29871,
29906,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
29881,
309,
29918,
20580,
29918,
29945,
29916,
29945,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
360,
309,
1168,
29894,
29898,
29907,
29892,
315,
29892,
29871,
29945,
29892,
380,
2426,
29892,
29871,
29946,
29892,
29871,
29906,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
20580,
29918,
29955,
29916,
29896,
29918,
29896,
29916,
29955,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
4706,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
4706,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29892,
315,
29892,
313,
29896,
29892,
29871,
29955,
511,
380,
2426,
7607,
29896,
29892,
380,
2426,
511,
7164,
7607,
29900,
29892,
29871,
29941,
511,
24003,
29922,
8824,
511,
30004,
13,
4706,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29892,
315,
29892,
313,
29955,
29892,
29871,
29896,
511,
380,
2426,
7607,
303,
2426,
29892,
29871,
29896,
511,
7164,
7607,
29941,
29892,
29871,
29900,
511,
24003,
29922,
8824,
511,
30004,
13,
4706,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29892,
2756,
457,
29922,
3470,
457,
8443,
13,
1678,
10353,
30004,
13,
1678,
525,
20580,
29918,
29941,
29916,
29941,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
830,
29931,
29965,
1168,
29894,
29933,
29940,
29898,
29907,
29892,
315,
29892,
29871,
29941,
29892,
380,
2426,
29892,
29871,
29896,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
20580,
29918,
29941,
29916,
29941,
29918,
1217,
29918,
2674,
29884,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
1281,
29894,
29933,
29940,
29898,
29907,
29892,
315,
29892,
29871,
29941,
29892,
380,
2426,
29892,
29871,
29896,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
20580,
29918,
29941,
29916,
29941,
29918,
1217,
29918,
2674,
29884,
29918,
1217,
29918,
11197,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
1281,
29894,
29898,
29907,
29892,
315,
29892,
29871,
29941,
29892,
380,
2426,
29892,
29871,
29896,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
20580,
29918,
29941,
29916,
29941,
29918,
1217,
29918,
11197,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
830,
29931,
29965,
1168,
29894,
29898,
29907,
29892,
315,
29892,
29871,
29941,
29892,
380,
2426,
29892,
29871,
29896,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
1678,
525,
2214,
370,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
29138,
2882,
29898,
315,
29892,
29871,
29941,
29892,
29871,
29941,
29892,
29890,
3173,
29922,
5574,
29892,
289,
29876,
29922,
5574,
29892,
1044,
29922,
15755,
29889,
1123,
29931,
29965,
29898,
5574,
511,
620,
29918,
7052,
29922,
29896,
511,
30004,
13,
462,
18884,
396,
4102,
29871,
29941,
338,
8466,
29899,
2311,
29892,
1552,
1473,
29871,
29941,
338,
278,
1353,
310,
4682,
2910,
30004,
13,
1678,
525,
786,
29918,
392,
29918,
3204,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
11901,
9468,
3970,
16048,
29898,
315,
29892,
6287,
29918,
19790,
29922,
5085,
29889,
7052,
29961,
29900,
11724,
30004,
13,
30004,
13,
1678,
396,
14340,
314,
10335,
3038,
29901,
30004,
13,
1678,
525,
1491,
29918,
29886,
15711,
2396,
2892,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
27092,
2227,
29990,
6670,
29898,
29907,
29892,
6287,
29918,
19790,
29922,
303,
2426,
511,
30004,
13,
1678,
525,
11288,
29918,
1491,
29918,
29886,
15711,
2396,
2892,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
27092,
2227,
29990,
6670,
29898,
29907,
29892,
6287,
29918,
19790,
29922,
29906,
511,
30004,
13,
1678,
525,
311,
535,
4068,
2396,
2892,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
897,
535,
4068,
29898,
29907,
29892,
303,
2426,
511,
30004,
13,
1678,
525,
18152,
457,
279,
2396,
2892,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
20347,
457,
279,
29898,
303,
2426,
511,
30004,
13,
1678,
525,
28502,
342,
2396,
2892,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
26206,
342,
29898,
303,
2426,
511,
30004,
13,
1678,
525,
10660,
2396,
2892,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
22985,
29898,
303,
2426,
511,
30004,
13,
1678,
525,
6203,
2396,
2892,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
18320,
29898,
303,
2426,
511,
30004,
13,
1678,
525,
14889,
307,
622,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
501,
407,
307,
622,
29898,
29907,
29892,
6287,
29918,
19790,
29922,
29906,
511,
30004,
13,
1678,
525,
3204,
4836,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
9943,
4836,
29898,
29907,
29892,
6287,
29918,
19790,
29922,
29906,
511,
30004,
13,
1678,
525,
14889,
307,
622,
9290,
2396,
14013,
315,
29892,
380,
2426,
29892,
2756,
457,
29901,
501,
407,
307,
622,
8516,
29898,
29907,
29892,
6287,
29918,
19790,
29922,
29906,
511,
30004,
13,
8117,
13,
1753,
2322,
29918,
20580,
29898,
262,
29918,
305,
12629,
29892,
714,
29918,
305,
12629,
29892,
8466,
29918,
2311,
29892,
24003,
29922,
5574,
1125,
30004,
13,
1678,
736,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
30004,
13,
4706,
297,
29918,
305,
12629,
29892,
714,
29918,
305,
12629,
29892,
8466,
29918,
2311,
11167,
13,
4706,
7164,
7607,
17460,
29918,
2311,
458,
29906,
511,
24003,
29922,
29890,
3173,
8443,
13,
30004,
13,
1990,
830,
29931,
29965,
1168,
29894,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
1123,
29931,
29965,
1168,
29894,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
459,
353,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
9651,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
12791,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
396,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
8443,
13,
4706,
1723,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
459,
29898,
29916,
8443,
13,
30004,
13,
1990,
9943,
4836,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
30004,
13,
4706,
1583,
29892,
29871,
2967,
29918,
4572,
29892,
6287,
29918,
19790,
1125,
30004,
13,
4706,
2428,
29898,
6767,
4836,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
30004,
13,
4706,
565,
6287,
29918,
19790,
1275,
29871,
29906,
29901,
30004,
13,
9651,
8466,
353,
29871,
29953,
30004,
13,
9651,
380,
2426,
353,
29871,
29906,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29946,
29901,
30004,
13,
9651,
8466,
353,
29871,
29947,
30004,
13,
9651,
380,
2426,
353,
29871,
29946,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29947,
29901,
30004,
13,
9651,
8466,
353,
29871,
29896,
29906,
30004,
13,
9651,
380,
2426,
353,
29871,
29947,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
30004,
13,
4706,
396,
1583,
29889,
786,
29896,
353,
5020,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
4706,
1583,
29889,
3204,
29896,
353,
9943,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
921,
353,
1583,
29889,
3204,
29896,
29898,
29916,
8443,
13,
4706,
736,
921,
30004,
13,
30004,
13,
1990,
501,
407,
307,
622,
8516,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
30004,
13,
4706,
1583,
29892,
29871,
2967,
29918,
4572,
29892,
6287,
29918,
19790,
1125,
30004,
13,
4706,
2428,
29898,
29965,
407,
307,
622,
8516,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
30004,
13,
4706,
565,
6287,
29918,
19790,
1275,
29871,
29906,
29901,
30004,
13,
9651,
8466,
353,
29871,
29953,
30004,
13,
9651,
380,
2426,
353,
29871,
29906,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29946,
29901,
30004,
13,
9651,
8466,
353,
29871,
29947,
30004,
13,
9651,
380,
2426,
353,
29871,
29946,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29947,
29901,
30004,
13,
9651,
8466,
353,
29871,
29896,
29906,
30004,
13,
9651,
380,
2426,
353,
29871,
29947,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
30004,
13,
4706,
1583,
29889,
786,
29896,
353,
5020,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
4706,
396,
1583,
29889,
3204,
29896,
353,
9943,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
921,
353,
1583,
29889,
786,
29896,
29898,
29916,
8443,
13,
4706,
736,
921,
29889,
16109,
29898,
29900,
1846,
30004,
13,
30004,
13,
1990,
501,
407,
307,
622,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
30004,
13,
4706,
1583,
29892,
29871,
2967,
29918,
4572,
29892,
6287,
29918,
19790,
1125,
30004,
13,
4706,
2428,
29898,
29965,
407,
307,
622,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
30004,
13,
4706,
565,
6287,
29918,
19790,
1275,
29871,
29906,
29901,
30004,
13,
9651,
8466,
353,
29871,
29953,
30004,
13,
9651,
380,
2426,
353,
29871,
29906,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29946,
29901,
30004,
13,
9651,
8466,
353,
29871,
29947,
30004,
13,
9651,
380,
2426,
353,
29871,
29946,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29947,
29901,
30004,
13,
9651,
8466,
353,
29871,
29896,
29906,
30004,
13,
9651,
380,
2426,
353,
29871,
29947,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
30004,
13,
4706,
1583,
29889,
786,
29896,
353,
5020,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
4706,
396,
1583,
29889,
3204,
29896,
353,
9943,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
921,
353,
1583,
29889,
786,
29896,
29898,
29916,
8443,
13,
4706,
736,
921,
30004,
13,
30004,
13,
1990,
1281,
29894,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
1168,
29894,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
459,
353,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
9651,
396,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
12791,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
396,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
8443,
13,
4706,
1723,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
459,
29898,
29916,
8443,
13,
30004,
13,
1990,
1281,
29894,
29933,
29940,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
1168,
29894,
29933,
29940,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
459,
353,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
9651,
396,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
12791,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
8443,
13,
4706,
1723,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
459,
29898,
29916,
8443,
13,
30004,
13,
1990,
20347,
457,
279,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
380,
2426,
1125,
30004,
13,
4706,
2428,
29898,
29933,
309,
457,
279,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
7052,
29922,
303,
2426,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
383,
29889,
1639,
3733,
403,
29898,
29916,
29892,
6287,
29918,
19790,
29922,
1311,
29889,
7052,
29892,
4464,
2433,
18152,
457,
279,
1495,
30004,
13,
30004,
13,
1990,
22985,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
380,
2426,
1125,
30004,
13,
4706,
2428,
29898,
12697,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
7052,
29922,
303,
2426,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
383,
29889,
1639,
3733,
403,
29898,
29916,
29892,
6287,
29918,
19790,
29922,
1311,
29889,
7052,
29892,
4464,
2433,
10660,
1495,
30004,
13,
30004,
13,
1990,
18320,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
380,
2426,
1125,
30004,
13,
4706,
2428,
29898,
13799,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
7052,
29922,
303,
2426,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
383,
29889,
1639,
3733,
403,
29898,
29916,
29892,
6287,
29918,
19790,
29922,
1311,
29889,
7052,
29892,
4464,
2433,
6203,
1495,
30004,
13,
30004,
13,
1990,
26206,
342,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
380,
2426,
1125,
30004,
13,
4706,
2428,
29898,
29940,
799,
342,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
7052,
29922,
303,
2426,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
383,
29889,
1639,
3733,
403,
29898,
29916,
29892,
6287,
29918,
19790,
29922,
1311,
29889,
7052,
29892,
4464,
2433,
28502,
342,
1495,
30004,
13,
30004,
13,
1990,
897,
535,
4068,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29892,
380,
2426,
1125,
30004,
13,
4706,
2428,
29898,
2772,
535,
4068,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
565,
380,
2426,
1360,
29906,
29901,
30004,
13,
9651,
8466,
29918,
2311,
29922,
29941,
30004,
13,
9651,
1962,
29918,
12791,
29922,
29896,
30004,
13,
4706,
25342,
380,
2426,
1360,
29946,
29901,
30004,
13,
9651,
8466,
29918,
2311,
29922,
29945,
30004,
13,
9651,
1962,
29918,
12791,
353,
29871,
29896,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
8466,
29918,
2311,
29922,
29941,
30004,
13,
9651,
1962,
29918,
12791,
353,
29871,
29900,
30004,
13,
4706,
1583,
29889,
311,
20580,
29922,
15755,
29889,
1168,
29894,
4300,
4220,
29906,
29881,
29898,
29907,
29892,
315,
29892,
17460,
29918,
2311,
29922,
17460,
29918,
2311,
29892,
303,
2426,
29922,
303,
2426,
29892,
7164,
29922,
29896,
29892,
4905,
29918,
12791,
29922,
4905,
29918,
12791,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
311,
20580,
29898,
29916,
8443,
13,
30004,
13,
1990,
27092,
2227,
29990,
6670,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29892,
6287,
29918,
19790,
29892,
20580,
29922,
4381,
29918,
20580,
1125,
30004,
13,
4706,
2428,
29898,
20633,
2227,
29990,
6670,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
14340,
981,
29922,
29965,
567,
314,
20069,
29898,
20580,
29892,
6287,
29918,
19790,
29892,
315,
29892,
1044,
29922,
8824,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
14340,
981,
29898,
29916,
8443,
13,
30004,
13,
1990,
501,
567,
314,
20069,
29898,
15755,
29889,
16941,
2556,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
7602,
29892,
6287,
29892,
302,
29918,
1725,
1446,
29892,
289,
29876,
29922,
8824,
29892,
1044,
29922,
8824,
29892,
24003,
29922,
5574,
1125,
30004,
13,
30004,
13,
4706,
286,
353,
5159,
30004,
13,
4706,
565,
313,
7052,
669,
313,
7052,
448,
29871,
29896,
876,
1275,
29871,
29900,
29901,
1678,
396,
1317,
6287,
353,
29871,
29906,
29985,
29876,
29973,
30004,
13,
9651,
363,
903,
297,
3464,
29898,
524,
29898,
755,
29889,
1188,
29898,
7052,
29892,
29871,
29906,
876,
1125,
30004,
13,
18884,
286,
29889,
4397,
29898,
20580,
29898,
29876,
29918,
1725,
1446,
29892,
29871,
29946,
334,
302,
29918,
1725,
1446,
29892,
29871,
29941,
29892,
24003,
876,
30004,
13,
18884,
286,
29889,
4397,
29898,
15755,
29889,
29637,
2713,
21897,
29898,
29906,
876,
30004,
13,
18884,
565,
289,
29876,
29901,
30004,
13,
462,
1678,
286,
29889,
4397,
29898,
15755,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29876,
29918,
1725,
1446,
876,
30004,
13,
18884,
565,
1044,
1275,
525,
2674,
29884,
2396,
30004,
13,
462,
1678,
286,
29889,
4397,
29898,
15755,
29889,
1123,
29931,
29965,
29898,
5574,
876,
30004,
13,
18884,
25342,
1044,
1275,
525,
1457,
6092,
2396,
30004,
13,
462,
1678,
286,
29889,
4397,
29898,
15755,
29889,
29925,
1123,
29931,
29965,
29898,
29876,
29918,
1725,
1446,
876,
30004,
13,
30004,
13,
4706,
25342,
6287,
1275,
29871,
29941,
29901,
30004,
13,
9651,
286,
29889,
4397,
29898,
20580,
29898,
29876,
29918,
1725,
1446,
29892,
29871,
29929,
334,
302,
29918,
1725,
1446,
29892,
29871,
29941,
29892,
24003,
876,
30004,
13,
9651,
286,
29889,
4397,
29898,
15755,
29889,
29637,
2713,
21897,
29898,
29941,
876,
30004,
13,
9651,
565,
289,
29876,
29901,
30004,
13,
18884,
286,
29889,
4397,
29898,
15755,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29876,
29918,
1725,
1446,
876,
30004,
13,
9651,
565,
1044,
1275,
525,
2674,
29884,
2396,
30004,
13,
18884,
286,
29889,
4397,
29898,
15755,
29889,
1123,
29931,
29965,
29898,
5574,
876,
30004,
13,
9651,
25342,
1044,
1275,
525,
1457,
6092,
2396,
30004,
13,
18884,
286,
29889,
4397,
29898,
15755,
29889,
29925,
1123,
29931,
29965,
29898,
29876,
29918,
1725,
1446,
876,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
12020,
2216,
1888,
2037,
287,
2392,
30004,
13,
30004,
13,
4706,
2428,
29898,
29965,
567,
314,
20069,
29892,
1583,
467,
1649,
2344,
1649,
10456,
29885,
8443,
13,
30004,
13,
30004,
13,
30004,
13,
1990,
830,
29931,
29965,
1168,
29894,
29933,
29940,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
1123,
29931,
29965,
1168,
29894,
29933,
29940,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
459,
353,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
9651,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
12791,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
8443,
13,
4706,
1723,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
459,
29898,
29916,
8443,
13,
30004,
13,
30004,
13,
1990,
360,
309,
1168,
29894,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
270,
8634,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
29928,
309,
1168,
29894,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
459,
353,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
9651,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
262,
29892,
8466,
29918,
2311,
29922,
17460,
29918,
2311,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
12791,
29892,
270,
8634,
29922,
29881,
8634,
11167,
13,
462,
418,
6471,
29922,
29907,
29918,
262,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29922,
29896,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
4706,
1723,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
459,
29898,
29916,
8443,
13,
30004,
13,
30004,
13,
1990,
29639,
1168,
29894,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
29903,
1022,
1168,
29894,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
459,
353,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
9651,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
262,
29892,
8466,
29918,
2311,
29922,
17460,
29918,
2311,
29892,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
12791,
29892,
6471,
29922,
29907,
29918,
262,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
262,
29892,
8466,
29918,
2311,
29922,
29896,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
262,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
9651,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
262,
29892,
8466,
29918,
2311,
29922,
17460,
29918,
2311,
29892,
380,
2426,
29922,
29896,
29892,
7164,
29922,
12791,
29892,
6471,
29922,
29907,
29918,
262,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
29892,
8466,
29918,
2311,
29922,
29896,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
8824,
511,
30004,
13,
9651,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
511,
30004,
13,
4706,
1723,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
1583,
29889,
459,
29898,
29916,
8443,
13,
30004,
13,
30004,
13,
1990,
27486,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
30004,
13,
4706,
2428,
29898,
18415,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
921,
30004,
13,
30004,
13,
30004,
13,
1990,
28933,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
29871,
4770,
2344,
12035,
1311,
29892,
380,
2426,
1125,
30004,
13,
4706,
2428,
29898,
24214,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
303,
2426,
353,
380,
2426,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
736,
921,
29889,
16109,
29898,
29900,
1846,
30004,
13,
30004,
13,
1990,
383,
7168,
1891,
29934,
6085,
346,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
29943,
7168,
1891,
29934,
6085,
346,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
4974,
315,
29918,
449,
1273,
29871,
29906,
1275,
29871,
29900,
30004,
13,
4706,
1583,
29889,
2674,
29884,
353,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
8443,
13,
4706,
1583,
29889,
20580,
29918,
29896,
353,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
849,
29871,
29906,
29892,
29871,
29896,
29892,
380,
2426,
29922,
29906,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
8824,
8443,
13,
4706,
1583,
29889,
20580,
29918,
29906,
353,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
849,
29871,
29906,
29892,
29871,
29896,
29892,
380,
2426,
29922,
29906,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
8824,
8443,
13,
4706,
1583,
29889,
11197,
353,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
921,
353,
1583,
29889,
2674,
29884,
29898,
29916,
8443,
13,
4706,
565,
921,
29889,
2311,
29898,
29906,
29897,
29995,
29906,
19216,
29900,
29901,
30004,
13,
9651,
921,
353,
383,
29889,
8305,
29898,
29916,
29892,
313,
29896,
29892,
29900,
29892,
29896,
29892,
29900,
511,
376,
23362,
613,
29871,
29900,
8443,
13,
4706,
714,
353,
4842,
305,
29889,
4117,
4197,
1311,
29889,
20580,
29918,
29896,
29898,
29916,
511,
1583,
29889,
20580,
29918,
29906,
29898,
29916,
7503,
29892,
584,
29892,
29871,
29896,
29901,
29892,
29871,
29896,
29901,
2314,
1402,
3964,
29922,
29896,
8443,
13,
4706,
714,
353,
1583,
29889,
11197,
29898,
449,
8443,
13,
4706,
736,
714,
30004,
13,
30004,
13,
30004,
13,
1990,
498,
262,
1168,
29894,
29906,
29881,
29898,
15755,
29889,
1168,
29894,
29906,
29881,
1125,
30004,
13,
1678,
9995,
30004,
13,
1678,
2888,
26851,
284,
15359,
363,
16835,
26851,
30004,
13,
1678,
9995,
30004,
13,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
297,
29918,
305,
12629,
29892,
714,
29918,
305,
12629,
29892,
8466,
29918,
2311,
11167,
13,
462,
380,
2426,
29922,
29896,
29892,
7164,
29922,
29900,
29892,
270,
8634,
29922,
29896,
29892,
6471,
29922,
29896,
29892,
24003,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
1349,
262,
1168,
29894,
29906,
29881,
29892,
1583,
467,
1649,
2344,
12035,
262,
29918,
305,
12629,
29922,
262,
29918,
305,
12629,
29892,
714,
29918,
305,
12629,
29922,
449,
29918,
305,
12629,
11167,
13,
462,
462,
308,
8466,
29918,
2311,
29922,
17460,
29918,
2311,
11167,
13,
462,
462,
308,
380,
2426,
29922,
303,
2426,
29892,
7164,
29922,
12791,
29892,
270,
8634,
29922,
29881,
8634,
29892,
6471,
29922,
13155,
29892,
24003,
29922,
29890,
3173,
8443,
13,
30004,
13,
1678,
822,
903,
386,
262,
29918,
7915,
29898,
1311,
29892,
1881,
29892,
2380,
29922,
8516,
1125,
30004,
13,
4706,
302,
29892,
274,
29892,
298,
29892,
281,
353,
1881,
29889,
2311,
26471,
13,
4706,
396,
1596,
29898,
2248,
29889,
2311,
3101,
30004,
13,
4706,
396,
1596,
29898,
2248,
8443,
13,
4706,
954,
29918,
18010,
353,
2380,
29889,
2311,
29898,
29900,
8443,
13,
4706,
2380,
353,
2380,
29889,
1493,
29898,
29896,
29892,
954,
29918,
18010,
29892,
29871,
29896,
29892,
29871,
29896,
8443,
13,
4706,
2186,
29918,
2248,
353,
2380,
29889,
18837,
29898,
29876,
29892,
954,
29918,
18010,
29892,
298,
29892,
281,
8443,
13,
4706,
16835,
29918,
1272,
353,
4842,
305,
29889,
29887,
1624,
29898,
2080,
29892,
29871,
29896,
29892,
2186,
29918,
2248,
8443,
13,
4706,
736,
16835,
29918,
1272,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
1881,
29892,
2380,
29922,
8516,
1125,
30004,
13,
4706,
565,
2380,
338,
451,
6213,
29901,
30004,
13,
9651,
16835,
29918,
7915,
353,
1583,
3032,
386,
262,
29918,
7915,
29898,
1311,
29889,
7915,
29892,
2380,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
16835,
29918,
7915,
353,
1583,
29889,
7915,
30004,
13,
4706,
736,
383,
29889,
20580,
29906,
29881,
29898,
2080,
29892,
16835,
29918,
7915,
29892,
1583,
29889,
29890,
3173,
29892,
1583,
29889,
303,
2426,
11167,
13,
462,
4706,
1583,
29889,
12791,
29892,
1583,
29889,
29881,
8634,
29892,
1583,
29889,
13155,
8443,
13,
30004,
13,
30004,
13,
1990,
9550,
1168,
29894,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
315,
29918,
262,
29892,
315,
29918,
449,
29892,
2756,
457,
29922,
5574,
1125,
30004,
13,
4706,
2428,
29898,
15790,
1168,
29894,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
4974,
315,
29918,
449,
1273,
29871,
29906,
1275,
29871,
29900,
30004,
13,
4706,
1583,
29889,
2674,
29884,
353,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
8824,
8443,
13,
4706,
1583,
29889,
386,
262,
29918,
20580,
353,
498,
262,
1168,
29894,
29906,
29881,
29898,
29907,
29918,
262,
29892,
315,
29918,
449,
29892,
29871,
29896,
29892,
380,
2426,
29922,
29896,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
8824,
8443,
13,
4706,
1583,
29889,
11197,
353,
302,
29876,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29907,
29918,
449,
29892,
2756,
457,
29922,
3470,
457,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
29892,
2380,
1125,
30004,
13,
4706,
921,
353,
1583,
29889,
2674,
29884,
29898,
29916,
8443,
13,
4706,
714,
353,
1583,
29889,
386,
262,
29918,
20580,
29898,
29916,
29892,
2380,
8443,
13,
4706,
714,
353,
1583,
29889,
11197,
29898,
449,
8443,
13,
4706,
736,
714,
30004,
13,
30004,
13,
2277,
17368,
6212,
2509,
313,
5454,
29897,
365,
2747,
30004,
13,
1990,
315,
1964,
2747,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
8242,
29892,
20376,
29922,
29896,
29953,
1125,
30004,
13,
4706,
2428,
29898,
29907,
1964,
2747,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
396,
5534,
6588,
11565,
292,
29901,
4682,
6660,
1298,
30004,
13,
4706,
1583,
29889,
485,
29887,
29918,
10109,
353,
302,
29876,
29889,
29909,
1388,
415,
573,
12810,
29887,
11426,
29906,
29881,
29898,
29896,
8443,
13,
4706,
396,
4682,
8242,
1623,
7052,
322,
24081,
29883,
744,
6660,
8242,
7688,
30004,
13,
4706,
1583,
29889,
20580,
29918,
700,
353,
302,
29876,
29889,
16941,
2556,
29898,
30004,
13,
18884,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
12719,
29892,
8242,
849,
20376,
29892,
29871,
29896,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
5574,
511,
30004,
13,
18884,
302,
29876,
29889,
1123,
29931,
29965,
29898,
262,
6689,
29922,
5574,
511,
30004,
13,
18884,
302,
29876,
29889,
1168,
29894,
29906,
29881,
29898,
12719,
849,
20376,
29892,
8242,
29892,
29871,
29896,
29892,
7164,
29922,
29900,
29892,
24003,
29922,
5574,
511,
30004,
13,
18884,
302,
29876,
29889,
29903,
335,
29885,
3398,
26471,
13,
4706,
1723,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
343,
353,
1583,
29889,
485,
29887,
29918,
10109,
29898,
29916,
8443,
13,
4706,
343,
353,
1583,
29889,
20580,
29918,
700,
29898,
29891,
8443,
13,
4706,
736,
921,
334,
343,
30004,
13,
30004,
13,
2277,
2538,
333,
950,
17368,
6212,
2509,
15658,
313,
10363,
2882,
8443,
13,
1990,
29138,
2882,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
30004,
13,
4706,
1583,
29892,
29871,
302,
29918,
1725,
271,
29892,
8466,
29918,
2311,
29892,
20376,
29892,
20580,
29922,
4381,
29918,
20580,
11167,
13,
4706,
24003,
29922,
5574,
29892,
289,
29876,
29922,
8824,
29892,
1044,
29922,
15755,
29889,
1123,
29931,
29965,
29898,
5574,
511,
620,
29918,
7052,
29922,
29896,
1125,
30004,
13,
4706,
2428,
29898,
10363,
2882,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
10585,
29918,
2587,
353,
5159,
30004,
13,
4706,
363,
474,
297,
3464,
29898,
29906,
1125,
30004,
13,
9651,
10585,
29918,
2587,
29889,
4397,
29898,
20580,
29898,
29876,
29918,
1725,
271,
29892,
302,
29918,
1725,
271,
29892,
8466,
29918,
2311,
29892,
24003,
29922,
29890,
3173,
876,
30004,
13,
9651,
565,
289,
29876,
29901,
10585,
29918,
2587,
29889,
4397,
29898,
15755,
29889,
23145,
29940,
555,
29906,
29881,
29898,
29876,
29918,
1725,
271,
876,
30004,
13,
9651,
565,
474,
1275,
29871,
29900,
29901,
10585,
29918,
2587,
29889,
4397,
29898,
627,
8443,
13,
4706,
10585,
29918,
2587,
29889,
4397,
29898,
29907,
1964,
2747,
29898,
29876,
29918,
1725,
271,
29892,
20376,
876,
30004,
13,
4706,
1583,
29889,
2587,
353,
302,
29876,
29889,
16941,
2556,
10456,
7576,
29918,
2587,
8443,
13,
4706,
1583,
29889,
690,
29918,
7052,
353,
620,
29918,
7052,
30004,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
620,
353,
1583,
29889,
2587,
29898,
29916,
8443,
13,
4706,
396,
690,
353,
1583,
29889,
2587,
29898,
29916,
467,
16109,
29898,
1311,
29889,
690,
29918,
7052,
8443,
13,
4706,
620,
4619,
921,
30004,
13,
4706,
736,
620,
30004,
13,
30004,
13,
30004,
13,
1990,
11901,
9468,
3970,
16048,
29898,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
30004,
13,
4706,
1583,
29892,
29871,
2967,
29918,
4572,
29892,
6287,
29918,
19790,
1125,
30004,
13,
4706,
2428,
29898,
4897,
9468,
3970,
16048,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
30004,
13,
4706,
565,
6287,
29918,
19790,
1275,
29871,
29906,
29901,
30004,
13,
9651,
8466,
353,
29871,
29953,
30004,
13,
9651,
380,
2426,
353,
29871,
29906,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29946,
29901,
30004,
13,
9651,
8466,
353,
29871,
29947,
30004,
13,
9651,
380,
2426,
353,
29871,
29946,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
4706,
25342,
6287,
29918,
19790,
1275,
29871,
29947,
29901,
30004,
13,
9651,
8466,
353,
29871,
29896,
29906,
30004,
13,
9651,
380,
2426,
353,
29871,
29947,
30004,
13,
9651,
7164,
353,
29871,
29906,
30004,
13,
30004,
13,
4706,
1583,
29889,
786,
29896,
353,
5020,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
4706,
1583,
29889,
3204,
29896,
353,
9943,
7445,
29898,
3188,
29918,
4572,
29892,
8466,
29892,
380,
2426,
29892,
7164,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
921,
353,
1583,
29889,
786,
29896,
29898,
29916,
8443,
13,
4706,
921,
353,
1583,
29889,
3204,
29896,
29898,
29916,
8443,
13,
4706,
736,
921,
30004,
13,
30004,
13,
1990,
5020,
7445,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29922,
29947,
29892,
380,
2426,
29922,
29946,
29892,
7164,
29922,
29906,
29892,
24003,
29922,
5574,
29892,
26229,
2433,
1457,
6092,
742,
6056,
29922,
8516,
1125,
30004,
13,
4706,
2428,
29898,
3373,
7445,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
786,
29918,
20580,
29896,
353,
897,
20580,
7445,
29898,
1949,
29918,
4572,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
26229,
29892,
6056,
29922,
8516,
8443,
13,
4706,
1583,
29889,
786,
29918,
20580,
29906,
353,
1281,
29894,
7445,
29898,
1949,
29918,
4572,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
26229,
29892,
6056,
29922,
8516,
8443,
13,
4706,
1583,
29889,
786,
29918,
20580,
29941,
353,
897,
20580,
7445,
29898,
1949,
29918,
4572,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
26229,
29892,
6056,
29922,
8516,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
298,
29900,
353,
1583,
29889,
786,
29918,
20580,
29896,
29898,
29916,
8443,
13,
4706,
301,
29900,
353,
1583,
29889,
786,
29918,
20580,
29906,
29898,
29882,
29900,
8443,
13,
4706,
298,
29896,
353,
1583,
29889,
786,
29918,
20580,
29941,
29898,
29880,
29900,
448,
921,
8443,
13,
4706,
736,
298,
29896,
718,
298,
29900,
30004,
13,
30004,
13,
1990,
9943,
7445,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29922,
29947,
29892,
380,
2426,
29922,
29946,
29892,
7164,
29922,
29906,
29892,
24003,
29922,
5574,
29892,
26229,
2433,
1457,
6092,
742,
6056,
29922,
8516,
1125,
30004,
13,
4706,
2428,
29898,
6767,
7445,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
3204,
29918,
20580,
29896,
353,
1281,
29894,
7445,
29898,
1949,
29918,
4572,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
26229,
29892,
6056,
29922,
8516,
8443,
13,
4706,
1583,
29889,
3204,
29918,
20580,
29906,
353,
897,
20580,
7445,
29898,
1949,
29918,
4572,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
26229,
29892,
6056,
29922,
8516,
8443,
13,
4706,
1583,
29889,
3204,
29918,
20580,
29941,
353,
1281,
29894,
7445,
29898,
1949,
29918,
4572,
29892,
954,
29918,
4572,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
26229,
29892,
6056,
29922,
8516,
8443,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
301,
29900,
353,
1583,
29889,
3204,
29918,
20580,
29896,
29898,
29916,
8443,
13,
4706,
298,
29900,
353,
1583,
29889,
3204,
29918,
20580,
29906,
29898,
29880,
29900,
8443,
13,
4706,
301,
29896,
353,
1583,
29889,
3204,
29918,
20580,
29941,
29898,
29882,
29900,
448,
921,
8443,
13,
4706,
736,
301,
29896,
718,
301,
29900,
30004,
13,
30004,
13,
1990,
897,
20580,
7445,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1881,
29918,
2311,
29892,
1962,
29918,
2311,
29892,
8466,
29918,
2311,
29922,
29946,
29892,
380,
2426,
29922,
29906,
29892,
7164,
29922,
29896,
29892,
24003,
29922,
5574,
29892,
26229,
2433,
1457,
6092,
742,
6056,
29922,
8516,
1125,
30004,
13,
4706,
2428,
29898,
2772,
20580,
7445,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
311,
20580,
353,
4842,
305,
29889,
15755,
29889,
1168,
29894,
4300,
4220,
29906,
29881,
29898,
2080,
29918,
2311,
29892,
1962,
29918,
2311,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
24003,
29922,
29890,
3173,
8443,
13,
30004,
13,
4706,
1583,
29889,
12324,
353,
6056,
30004,
13,
4706,
565,
1583,
29889,
12324,
1275,
525,
16175,
2396,
30004,
13,
9651,
1583,
29889,
11197,
353,
4842,
305,
29889,
15755,
29889,
23145,
29940,
555,
29906,
29881,
29898,
4905,
29918,
2311,
8443,
13,
4706,
25342,
1583,
29889,
12324,
1275,
525,
8758,
2396,
30004,
13,
9651,
1583,
29889,
11197,
353,
4842,
305,
29889,
15755,
29889,
4998,
29940,
555,
29906,
29881,
29898,
4905,
29918,
2311,
8443,
13,
30004,
13,
4706,
1583,
29889,
11236,
362,
353,
26229,
30004,
13,
4706,
565,
1583,
29889,
11236,
362,
1275,
525,
2674,
29884,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
1123,
29931,
29965,
29898,
5574,
8443,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
1457,
6092,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
29925,
1123,
29931,
29965,
26471,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
29880,
2674,
29884,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
3226,
557,
29891,
1123,
29931,
29965,
29898,
29900,
29889,
29906,
29892,
5852,
8443,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
13161,
29882,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
29911,
27731,
26471,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
18816,
29885,
3398,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
29903,
335,
29885,
3398,
26471,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
565,
1583,
29889,
12324,
338,
451,
6213,
29901,
30004,
13,
9651,
714,
353,
1583,
29889,
11197,
29898,
1311,
29889,
311,
20580,
29898,
29916,
876,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
714,
353,
1583,
29889,
311,
20580,
29898,
29916,
8443,
13,
30004,
13,
4706,
565,
1583,
29889,
11236,
362,
338,
451,
6213,
29901,
30004,
13,
9651,
736,
1583,
29889,
627,
29898,
449,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
736,
714,
30004,
13,
30004,
13,
1990,
1281,
29894,
7445,
29898,
7345,
305,
29889,
15755,
29889,
7355,
1125,
30004,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
1881,
29918,
2311,
29892,
1962,
29918,
2311,
29892,
8466,
29918,
2311,
29922,
29941,
29892,
380,
2426,
29922,
29896,
29892,
7164,
29922,
29896,
29892,
24003,
29922,
5574,
29892,
26229,
2433,
1457,
6092,
742,
6056,
29922,
8516,
1125,
30004,
13,
4706,
2428,
29898,
1168,
29894,
7445,
29892,
1583,
467,
1649,
2344,
1649,
26471,
13,
4706,
1583,
29889,
20580,
353,
4842,
305,
29889,
15755,
29889,
1168,
29894,
29906,
29881,
29898,
2080,
29918,
2311,
29892,
1962,
29918,
2311,
29892,
8466,
29918,
2311,
29892,
380,
2426,
29892,
7164,
29892,
24003,
29922,
29890,
3173,
8443,
13,
30004,
13,
4706,
1583,
29889,
12324,
353,
6056,
30004,
13,
4706,
565,
1583,
29889,
12324,
1275,
29915,
16175,
2396,
30004,
13,
9651,
1583,
29889,
11197,
353,
4842,
305,
29889,
15755,
29889,
23145,
29940,
555,
29906,
29881,
29898,
4905,
29918,
2311,
8443,
13,
4706,
25342,
1583,
29889,
12324,
1275,
525,
8758,
2396,
30004,
13,
9651,
1583,
29889,
11197,
353,
4842,
305,
29889,
15755,
29889,
4998,
29940,
555,
29906,
29881,
29898,
4905,
29918,
2311,
8443,
13,
30004,
13,
4706,
1583,
29889,
11236,
362,
353,
26229,
30004,
13,
4706,
565,
1583,
29889,
11236,
362,
1275,
525,
2674,
29884,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
1123,
29931,
29965,
29898,
5574,
8443,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
1457,
6092,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
29925,
1123,
29931,
29965,
26471,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
29880,
2674,
29884,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
3226,
557,
29891,
1123,
29931,
29965,
29898,
29900,
29889,
29906,
29892,
5852,
8443,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
13161,
29882,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
29911,
27731,
26471,
13,
4706,
25342,
1583,
29889,
11236,
362,
1275,
525,
18816,
29885,
3398,
2396,
30004,
13,
9651,
1583,
29889,
627,
353,
4842,
305,
29889,
15755,
29889,
29903,
335,
29885,
3398,
26471,
13,
30004,
13,
1678,
822,
6375,
29898,
1311,
29892,
921,
1125,
30004,
13,
4706,
565,
1583,
29889,
12324,
338,
451,
6213,
29901,
30004,
13,
9651,
714,
353,
1583,
29889,
11197,
29898,
1311,
29889,
20580,
29898,
29916,
876,
30004,
13,
4706,
1683,
29901,
30004,
13,
9651,
714,
353,
1583,
29889,
20580,
29898,
29916,
8443,
13,
30004,
13,
4706,
565,
1583,
29889,
11236,
362,
338,
451,
6213,
29901,
30004,
13,
9651,
736,
1583,
29889,
627,
29898,
449,
8443,
13,
4706,
1683,
29901,
30004,
13,
9651,
736,
714,
2
] |
config.py | StuartSul/SampyoNet | 0 | 32410 | ## Built-in packages
import getopt
import json
import os
import sys
## Third-party packages
from PIL import Image
import joblib
import numpy as np
import tqdm
## Tensorflow
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.layers import Dense
from tensorflow.keras.layers import Dropout
from tensorflow.keras.layers import GlobalMaxPool2D
from tensorflow.keras.layers import Input
from tensorflow.keras.layers import MaxPool2D
from tensorflow.keras.models import Model
from tensorflow.keras.layers import SeparableConv2D
import tensorflow_addons as tfa
## Global variable declarations
global INPUT_WIDTH
global INPUT_HEIGHT
global FILTER_SIZE
global DENSE_UNITS
global DROPOUT
global OUTPUT_CLASS
## Global model parameters (DO NOT CHANGE)
INPUT_WIDTH = 1500
INPUT_HEIGHT = 850
FILTER_SIZE = 32
DENSE_UNITS = 1024
DROPOUT = 0.3
OUTPUT_CLASS = 3
| [
1,
444,
5373,
2782,
29899,
262,
9741,
13,
5215,
679,
3670,
13,
5215,
4390,
13,
5215,
2897,
13,
5215,
10876,
13,
13,
2277,
18008,
29899,
22633,
9741,
13,
3166,
349,
6227,
1053,
7084,
13,
5215,
4982,
1982,
13,
5215,
12655,
408,
7442,
13,
5215,
260,
29939,
18933,
13,
13,
2277,
323,
6073,
1731,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
350,
905,
19077,
2133,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
360,
1947,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
20724,
449,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
12002,
7976,
11426,
29906,
29928,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
10567,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
5918,
11426,
29906,
29928,
13,
3166,
26110,
29889,
3946,
294,
29889,
9794,
1053,
8125,
13,
3166,
26110,
29889,
3946,
294,
29889,
29277,
1053,
922,
862,
519,
1168,
29894,
29906,
29928,
13,
5215,
26110,
29918,
1202,
787,
408,
260,
5444,
13,
13,
2277,
12002,
2286,
28721,
13,
10945,
2672,
12336,
29918,
22574,
13,
10945,
2672,
12336,
29918,
9606,
22530,
13,
10945,
383,
6227,
4945,
29918,
14226,
13,
10945,
360,
1430,
1660,
29918,
3904,
1806,
29903,
13,
10945,
360,
29366,
12015,
13,
10945,
19474,
12336,
29918,
13875,
1799,
13,
13,
2277,
12002,
1904,
4128,
313,
3970,
6058,
5868,
24336,
29897,
13,
1177,
12336,
29918,
22574,
353,
29871,
29896,
29945,
29900,
29900,
13,
1177,
12336,
29918,
9606,
22530,
353,
29871,
29947,
29945,
29900,
13,
3738,
29931,
4945,
29918,
14226,
353,
29871,
29941,
29906,
13,
29928,
1430,
1660,
29918,
3904,
1806,
29903,
353,
29871,
29896,
29900,
29906,
29946,
13,
29928,
29366,
12015,
353,
29871,
29900,
29889,
29941,
13,
12015,
12336,
29918,
13875,
1799,
353,
29871,
29941,
13,
2
] |
src/isa.py | plafl/helisim | 6 | 1610075 | # Atmosfera ISA
# Condiciones a nivel del mar
P0 = 101.3e3 # Pa
T0 = 288 # K
# Gravedad
g = 9.81 # m/s^2
# Ley de temperatura en la troposfera: T = T0 - L*h
L = 0.0065 # K/m
# Constante del gas
Ra = 287 # J/(Kg*K)
# h en metros, T en kelvins
def T(h):
return T0 - L*h
# h en metros, P en pascales
def P(h):
return P0*(T(h)/T0)**(g/L/Ra)
# Conversion
def inHg_to_Pa(x):
return 3.386389e3*x
def Pa_to_inHg(x):
return x/3.386389e3
| [
1,
396,
2180,
7681,
571,
29874,
306,
8132,
13,
13,
29937,
11790,
14674,
263,
23594,
628,
1766,
13,
29925,
29900,
353,
29871,
29896,
29900,
29896,
29889,
29941,
29872,
29941,
1678,
396,
2621,
13,
29911,
29900,
353,
29871,
29906,
29947,
29947,
4706,
396,
476,
13,
13,
29937,
4989,
1490,
328,
13,
29887,
29871,
353,
29871,
29929,
29889,
29947,
29896,
539,
396,
286,
29914,
29879,
29985,
29906,
13,
13,
29937,
25933,
316,
6238,
7969,
427,
425,
3147,
1066,
571,
29874,
29901,
323,
353,
323,
29900,
448,
365,
29930,
29882,
13,
29931,
29871,
353,
29871,
29900,
29889,
29900,
29900,
29953,
29945,
268,
396,
476,
29914,
29885,
13,
13,
29937,
5798,
1647,
628,
10489,
13,
29934,
29874,
353,
29871,
29906,
29947,
29955,
4706,
396,
435,
14571,
29968,
29887,
29930,
29968,
29897,
13,
13,
29937,
298,
427,
24086,
29892,
323,
427,
413,
295,
29894,
1144,
13,
1753,
323,
29898,
29882,
1125,
13,
1678,
736,
323,
29900,
448,
365,
29930,
29882,
13,
13,
29937,
298,
427,
24086,
29892,
349,
427,
2331,
1052,
267,
13,
1753,
349,
29898,
29882,
1125,
13,
1678,
736,
349,
29900,
16395,
29911,
29898,
29882,
6802,
29911,
29900,
29897,
1068,
29898,
29887,
29914,
29931,
29914,
29934,
29874,
29897,
13,
13,
13,
29937,
1281,
3259,
13,
1753,
297,
29950,
29887,
29918,
517,
29918,
11868,
29898,
29916,
1125,
13,
1678,
736,
29871,
29941,
29889,
29941,
29947,
29953,
29941,
29947,
29929,
29872,
29941,
29930,
29916,
13,
13,
1753,
2621,
29918,
517,
29918,
262,
29950,
29887,
29898,
29916,
1125,
13,
1678,
736,
921,
29914,
29941,
29889,
29941,
29947,
29953,
29941,
29947,
29929,
29872,
29941,
13,
2
] |
python/AlgoritmosPython/raizAlgarismos.py | jonfisik/Projects | 2 | 98158 | __author__ = 'JPaschoal'
__version__ = '1.0.1'
__email__ = '<EMAIL>'
__date__ = '08/05/2021'
'''
Qualquer número natural de quatro algarismos pode ser dividido
em duas dezenas formadas pelos seus dois primeiros e dois
últimos dígitos.
Exemplos:
1297: 12 e 97
5314: 53 e 14
Escreva um programa que imprime todos os milhares (4 algarismos), 1000 <= n < 10000, cuja raiz quadrada seja a soma das dezenas formadas pela divisão acima.
Exemplo: raiz de 9801 = 99 = 98 + 01
Portanto 9801 é um dos números a ser impresso.
'''
# 1000 --> 10 00 --> 10 + 00 = 10 --> 10**2 = 100 == 1000 [V/F] imprimir 1000
# 1001 --> 10 01 --> 10 + 01 = 11 --> 11**2 = 121 == 1001 [V/F] imprimir 1001
# .
# .
# .
# 9801 --> 98 01 --> 98 + 01 = 99 --> 99**2 = 9801 == 9801 [V/F] imprimir 9801
#--------------------------------------------
def traco():
return print('-----'*10)
print('')
print("TESTE MILHARES 1000 - 10 000")
traco()
# váriaveis
num = 1000
while num < 10000:
aux = num
dois_ultm = aux%100
aux //= 100
dois_prim = aux%100
if (dois_ultm + dois_prim)**2 == num:
print(f'>>> {num}')
num += 1
traco()
print('')
# END | [
1,
4770,
8921,
1649,
29871,
353,
525,
29967,
29925,
294,
1859,
284,
29915,
13,
1649,
3259,
1649,
353,
525,
29896,
29889,
29900,
29889,
29896,
29915,
13,
1649,
5269,
1649,
259,
353,
12801,
26862,
6227,
16299,
13,
1649,
1256,
1649,
1678,
353,
525,
29900,
29947,
29914,
29900,
29945,
29914,
29906,
29900,
29906,
29896,
29915,
13,
12008,
13,
24399,
7808,
13831,
5613,
316,
439,
7816,
3093,
279,
1608,
359,
13279,
724,
25227,
1941,
13,
331,
27544,
316,
2256,
294,
883,
3922,
29678,
11018,
19760,
6019,
17177,
321,
19760,
29871,
13,
28961,
18594,
19559,
5559,
359,
29889,
13,
13,
1252,
16305,
359,
29901,
13,
29896,
29906,
29929,
29955,
29901,
29871,
29896,
29906,
321,
29871,
29929,
29955,
13,
29945,
29941,
29896,
29946,
29901,
29871,
29945,
29941,
321,
29871,
29896,
29946,
13,
13,
14190,
1037,
1564,
1922,
16914,
712,
527,
10080,
10843,
2897,
2316,
29882,
5114,
313,
29946,
3093,
279,
1608,
359,
511,
29871,
29896,
29900,
29900,
29900,
5277,
302,
529,
29871,
29896,
29900,
29900,
29900,
29900,
29892,
2723,
1764,
1153,
466,
15448,
1114,
409,
1764,
263,
1047,
29874,
1697,
316,
2256,
294,
883,
3922,
10571,
8572,
1368,
1274,
2946,
29889,
13,
4706,
1222,
13141,
29901,
1153,
466,
316,
29871,
29929,
29947,
29900,
29896,
353,
29871,
29929,
29929,
353,
29871,
29929,
29947,
718,
29871,
29900,
29896,
13,
4706,
3371,
5361,
29871,
29929,
29947,
29900,
29896,
904,
1922,
3248,
12158,
359,
263,
724,
21210,
29877,
29889,
13,
12008,
13,
29937,
1678,
29896,
29900,
29900,
29900,
6660,
29871,
29896,
29900,
259,
29900,
29900,
6660,
29871,
29896,
29900,
718,
29871,
29900,
29900,
353,
29871,
29896,
29900,
6660,
29871,
29896,
29900,
1068,
29906,
353,
29871,
29896,
29900,
29900,
1275,
29871,
29896,
29900,
29900,
29900,
518,
29963,
29914,
29943,
29962,
527,
9469,
381,
29871,
29896,
29900,
29900,
29900,
13,
29937,
1678,
29896,
29900,
29900,
29896,
6660,
29871,
29896,
29900,
259,
29900,
29896,
6660,
29871,
29896,
29900,
718,
29871,
29900,
29896,
353,
29871,
29896,
29896,
6660,
29871,
29896,
29896,
1068,
29906,
353,
29871,
29896,
29906,
29896,
1275,
29871,
29896,
29900,
29900,
29896,
518,
29963,
29914,
29943,
29962,
527,
9469,
381,
29871,
29896,
29900,
29900,
29896,
259,
13,
29937,
259,
869,
13,
29937,
259,
869,
13,
29937,
259,
869,
13,
29937,
1678,
29929,
29947,
29900,
29896,
6660,
29871,
29929,
29947,
259,
29900,
29896,
6660,
29871,
29929,
29947,
718,
29871,
29900,
29896,
353,
29871,
29929,
29929,
6660,
29871,
29929,
29929,
1068,
29906,
353,
29871,
29929,
29947,
29900,
29896,
1275,
29871,
29929,
29947,
29900,
29896,
518,
29963,
29914,
29943,
29962,
527,
9469,
381,
29871,
29929,
29947,
29900,
29896,
13,
29937,
2683,
2683,
9072,
13,
13,
1753,
16703,
29877,
7295,
13,
1678,
736,
1596,
877,
23648,
29915,
29930,
29896,
29900,
29897,
13,
13,
2158,
877,
1495,
13,
2158,
703,
18267,
29923,
341,
6227,
15715,
15989,
29871,
29896,
29900,
29900,
29900,
448,
29871,
29896,
29900,
29871,
29900,
29900,
29900,
1159,
13,
29873,
945,
29877,
580,
13,
13,
29937,
9366,
374,
1351,
275,
29871,
13,
1949,
353,
29871,
29896,
29900,
29900,
29900,
13,
13,
8000,
954,
529,
29871,
29896,
29900,
29900,
29900,
29900,
29901,
13,
1678,
3479,
353,
954,
13,
1678,
19760,
29918,
499,
29885,
353,
3479,
29995,
29896,
29900,
29900,
13,
13,
1678,
3479,
849,
29922,
29871,
29896,
29900,
29900,
13,
13,
1678,
19760,
29918,
9469,
353,
3479,
29995,
29896,
29900,
29900,
13,
13,
1678,
565,
313,
1867,
275,
29918,
499,
29885,
718,
19760,
29918,
9469,
29897,
1068,
29906,
1275,
954,
29901,
13,
4706,
1596,
29898,
29888,
29915,
6778,
29958,
426,
1949,
29913,
1495,
13,
13,
1678,
954,
4619,
29871,
29896,
13,
13,
29873,
945,
29877,
580,
13,
2158,
877,
1495,
13,
29937,
11056,
2
] |
lesson 16/question 2.py | Kev-in123/ICS2O7 | 2 | 1609911 | <filename>lesson 16/question 2.py
import random
rolls = [random.randint(1, 6) + random.randint(1,6) for i in range(50)]
try:
interested_roll = int(input("What number are you interested in: "))
except ValueError:
print("Invalid value try again")
interested_roll = int(input("What number are you interested in: "))
while 2<interested_roll>12:
print("Invalid number try again")
try:
interested_roll = int(input("What number are you interested in: "))
except ValueError:
print("Invalid value try again")
interested_roll = int(input("What number are you interested in: "))
count_interested = rolls.count(interested_roll)
print(f"The number {interested_roll} appeared {count_interested} time(s)") | [
1,
529,
9507,
29958,
2222,
265,
29871,
29896,
29953,
29914,
12470,
29871,
29906,
29889,
2272,
13,
5215,
4036,
30004,
13,
30004,
13,
1245,
29879,
353,
518,
8172,
29889,
9502,
524,
29898,
29896,
29892,
29871,
29953,
29897,
718,
4036,
29889,
9502,
524,
29898,
29896,
29892,
29953,
29897,
363,
474,
297,
3464,
29898,
29945,
29900,
4638,
30004,
13,
30004,
13,
2202,
29901,
30004,
13,
29871,
8852,
29918,
1245,
353,
938,
29898,
2080,
703,
5618,
1353,
526,
366,
8852,
297,
29901,
376,
876,
30004,
13,
19499,
7865,
2392,
29901,
30004,
13,
29871,
1596,
703,
13919,
995,
1018,
1449,
1159,
30004,
13,
29871,
8852,
29918,
1245,
353,
938,
29898,
2080,
703,
5618,
1353,
526,
366,
8852,
297,
29901,
376,
876,
30004,
13,
30004,
13,
8000,
29871,
29906,
29966,
1639,
2868,
29918,
1245,
29958,
29896,
29906,
29901,
30004,
13,
29871,
1596,
703,
13919,
1353,
1018,
1449,
1159,
30004,
13,
29871,
1018,
29901,
30004,
13,
1678,
8852,
29918,
1245,
353,
938,
29898,
2080,
703,
5618,
1353,
526,
366,
8852,
297,
29901,
376,
876,
30004,
13,
29871,
5174,
7865,
2392,
29901,
30004,
13,
1678,
1596,
703,
13919,
995,
1018,
1449,
1159,
30004,
13,
1678,
8852,
29918,
1245,
353,
938,
29898,
2080,
703,
5618,
1353,
526,
366,
8852,
297,
29901,
376,
876,
30004,
13,
30004,
13,
2798,
29918,
1639,
2868,
353,
9679,
29879,
29889,
2798,
29898,
1639,
2868,
29918,
1245,
8443,
13,
30004,
13,
2158,
29898,
29888,
29908,
1576,
1353,
426,
1639,
2868,
29918,
1245,
29913,
7470,
426,
2798,
29918,
1639,
2868,
29913,
931,
29898,
29879,
25760,
2
] |
python/spinn/models/fat_classifier.py | stanfordnlp/spinn | 200 | 57337 | <reponame>stanfordnlp/spinn<gh_stars>100-1000
"""From the project root directory (containing data files), this can be run with:
Boolean logic evaluation:
python -m spinn.models.fat_classifier --training_data_path ../bl-data/pbl_train.tsv \
--eval_data_path ../bl-data/pbl_dev.tsv
SST sentiment (Demo only, model needs a full GloVe embeddings file to do well):
python -m spinn.models.fat_classifier --data_type sst --training_data_path sst-data/train.txt \
--eval_data_path sst-data/dev.txt --embedding_data_path spinn/tests/test_embedding_matrix.5d.txt \
--model_dim 10 --word_embedding_dim 5
SNLI entailment (Demo only, model needs a full GloVe embeddings file to do well):
python -m spinn.models.fat_classifier --data_type snli --training_data_path snli_1.0/snli_1.0_dev.jsonl \
--eval_data_path snli_1.0/snli_1.0_dev.jsonl --embedding_data_path spinn/tests/test_embedding_matrix.5d.txt \
--model_dim 10 --word_embedding_dim 5
Note: If you get an error starting with "TypeError: ('Wrong number of dimensions..." during development,
there may already be a saved checkpoint in ckpt_path that matches the name of the model you're developing.
Move or delete it as appropriate.
"""
from functools import partial
import os
import pprint
import sys
import gflags
from theano import tensor as T
import theano
import numpy as np
from spinn import afs_safe_logger
from spinn import util
from spinn.data.boolean import load_boolean_data
from spinn.data.sst import load_sst_data
from spinn.data.snli import load_snli_data
import spinn.fat_stack
import spinn.plain_rnn
import spinn.cbow
FLAGS = gflags.FLAGS
def build_sentence_model(cls, vocab_size, seq_length, tokens, transitions,
num_classes, training_mode, ground_truth_transitions_visible, vs,
initial_embeddings=None, project_embeddings=False, ss_mask_gen=None, ss_prob=0.0):
"""
Construct a classifier which makes use of some hard-stack model.
Args:
cls: Hard stack class to use (from e.g. `spinn.fat_stack`)
vocab_size:
seq_length: Length of each sequence provided to the stack model
tokens: Theano batch (integer matrix), `batch_size * seq_length`
transitions: Theano batch (integer matrix), `batch_size * seq_length`
num_classes: Number of output classes
training_mode: A Theano scalar indicating whether to act as a training model
with dropout (1.0) or to act as an eval model with rescaling (0.0).
ground_truth_transitions_visible: A Theano scalar. If set (1.0), allow the model access
to ground truth transitions. This can be disabled at evaluation time to force Model 1
(or 2S) to evaluate in the Model 2 style with predicted transitions. Has no effect on Model 0.
vs: Variable store.
"""
# Prepare layer which performs stack element composition.
if cls is spinn.plain_rnn.RNN:
if FLAGS.use_gru:
compose_network = partial(util.GRULayer,
initializer=util.HeKaimingInitializer())
else:
compose_network = partial(util.LSTMLayer,
initializer=util.HeKaimingInitializer())
embedding_projection_network = None
elif cls is spinn.cbow.CBOW:
compose_network = None
embedding_projection_network = None
else:
if FLAGS.lstm_composition:
if FLAGS.use_gru:
compose_network = partial(util.TreeGRULayer,
initializer=util.HeKaimingInitializer())
else:
compose_network = partial(util.TreeLSTMLayer,
initializer=util.HeKaimingInitializer())
else:
assert not FLAGS.connect_tracking_comp, "Can only connect tracking and composition unit while using TreeLSTM"
compose_network = partial(util.ReLULayer,
initializer=util.HeKaimingInitializer())
if project_embeddings:
embedding_projection_network = util.Linear
else:
assert FLAGS.word_embedding_dim == FLAGS.model_dim, \
"word_embedding_dim must equal model_dim unless a projection layer is used."
embedding_projection_network = util.IdentityLayer
# Build hard stack which scans over input sequence.
sentence_model = cls(
FLAGS.model_dim, FLAGS.word_embedding_dim, vocab_size, seq_length,
compose_network, embedding_projection_network, training_mode, ground_truth_transitions_visible, vs,
predict_use_cell=FLAGS.predict_use_cell,
use_tracking_lstm=FLAGS.use_tracking_lstm,
tracking_lstm_hidden_dim=FLAGS.tracking_lstm_hidden_dim,
X=tokens,
transitions=transitions,
initial_embeddings=initial_embeddings,
embedding_dropout_keep_rate=FLAGS.embedding_keep_rate,
ss_mask_gen=ss_mask_gen,
ss_prob=ss_prob,
connect_tracking_comp=FLAGS.connect_tracking_comp,
context_sensitive_shift=FLAGS.context_sensitive_shift,
context_sensitive_use_relu=FLAGS.context_sensitive_use_relu,
use_input_batch_norm=False)
# Extract top element of final stack timestep.
if FLAGS.lstm_composition or cls is spinn.plain_rnn.RNN:
sentence_vector = sentence_model.final_representations[:,:FLAGS.model_dim / 2].reshape((-1, FLAGS.model_dim / 2))
sentence_vector_dim = FLAGS.model_dim / 2
else:
sentence_vector = sentence_model.final_representations.reshape((-1, FLAGS.model_dim))
sentence_vector_dim = FLAGS.model_dim
sentence_vector = util.BatchNorm(sentence_vector, sentence_vector_dim, vs, "sentence_vector", training_mode)
sentence_vector = util.Dropout(sentence_vector, FLAGS.semantic_classifier_keep_rate, training_mode)
# Feed forward through a single output layer
logits = util.Linear(
sentence_vector, sentence_vector_dim, num_classes, vs,
name="semantic_classifier", use_bias=True)
return sentence_model.transitions_pred, logits
def build_sentence_pair_model(cls, vocab_size, seq_length, tokens, transitions,
num_classes, training_mode, ground_truth_transitions_visible, vs,
initial_embeddings=None, project_embeddings=False, ss_mask_gen=None, ss_prob=0.0):
"""
Construct a classifier which makes use of some hard-stack model.
Args:
cls: Hard stack class to use (from e.g. `spinn.fat_stack`)
vocab_size:
seq_length: Length of each sequence provided to the stack model
tokens: Theano batch (integer matrix), `batch_size * seq_length`
transitions: Theano batch (integer matrix), `batch_size * seq_length`
num_classes: Number of output classes
training_mode: A Theano scalar indicating whether to act as a training model
with dropout (1.0) or to act as an eval model with rescaling (0.0).
ground_truth_transitions_visible: A Theano scalar. If set (1.0), allow the model access
to ground truth transitions. This can be disabled at evaluation time to force Model 1
(or 2S) to evaluate in the Model 2 style with predicted transitions. Has no effect on Model 0.
vs: Variable store.
"""
# Prepare layer which performs stack element composition.
if cls is spinn.plain_rnn.RNN:
if FLAGS.use_gru:
compose_network = partial(util.GRULayer,
initializer=util.HeKaimingInitializer())
else:
compose_network = partial(util.LSTMLayer,
initializer=util.HeKaimingInitializer())
embedding_projection_network = None
elif cls is spinn.cbow.CBOW:
compose_network = None
embedding_projection_network = None
else:
if FLAGS.lstm_composition:
if FLAGS.use_gru:
compose_network = partial(util.TreeGRULayer,
initializer=util.HeKaimingInitializer())
else:
compose_network = partial(util.TreeLSTMLayer,
initializer=util.HeKaimingInitializer())
else:
assert not FLAGS.connect_tracking_comp, "Can only connect tracking and composition unit while using TreeLSTM"
compose_network = partial(util.ReLULayer,
initializer=util.HeKaimingInitializer())
if project_embeddings:
embedding_projection_network = util.Linear
else:
assert FLAGS.word_embedding_dim == FLAGS.model_dim, \
"word_embedding_dim must equal model_dim unless a projection layer is used."
embedding_projection_network = util.IdentityLayer
# Split the two sentences
premise_tokens = tokens[:, :, 0]
hypothesis_tokens = tokens[:, :, 1]
premise_transitions = transitions[:, :, 0]
hypothesis_transitions = transitions[:, :, 1]
# Build two hard stack models which scan over input sequences.
premise_model = cls(
FLAGS.model_dim, FLAGS.word_embedding_dim, vocab_size, seq_length,
compose_network, embedding_projection_network, training_mode, ground_truth_transitions_visible, vs,
predict_use_cell=FLAGS.predict_use_cell,
use_tracking_lstm=FLAGS.use_tracking_lstm,
tracking_lstm_hidden_dim=FLAGS.tracking_lstm_hidden_dim,
X=premise_tokens,
transitions=premise_transitions,
initial_embeddings=initial_embeddings,
embedding_dropout_keep_rate=FLAGS.embedding_keep_rate,
ss_mask_gen=ss_mask_gen,
ss_prob=ss_prob,
connect_tracking_comp=FLAGS.connect_tracking_comp,
context_sensitive_shift=FLAGS.context_sensitive_shift,
context_sensitive_use_relu=FLAGS.context_sensitive_use_relu,
use_attention=FLAGS.use_attention,
initialize_hyp_tracking_state=FLAGS.initialize_hyp_tracking_state)
premise_stack_tops = premise_model.stack_tops if FLAGS.use_attention != "None" else None
premise_tracking_c_state_final = premise_model.tracking_c_state_final if cls not in [spinn.plain_rnn.RNN,
spinn.cbow.CBOW] else None
hypothesis_model = cls(
FLAGS.model_dim, FLAGS.word_embedding_dim, vocab_size, seq_length,
compose_network, embedding_projection_network, training_mode, ground_truth_transitions_visible, vs,
predict_use_cell=FLAGS.predict_use_cell,
use_tracking_lstm=FLAGS.use_tracking_lstm,
tracking_lstm_hidden_dim=FLAGS.tracking_lstm_hidden_dim,
X=hypothesis_tokens,
transitions=hypothesis_transitions,
initial_embeddings=initial_embeddings,
embedding_dropout_keep_rate=FLAGS.embedding_keep_rate,
ss_mask_gen=ss_mask_gen,
ss_prob=ss_prob,
connect_tracking_comp=FLAGS.connect_tracking_comp,
context_sensitive_shift=FLAGS.context_sensitive_shift,
context_sensitive_use_relu=FLAGS.context_sensitive_use_relu,
use_attention=FLAGS.use_attention,
premise_stack_tops=premise_stack_tops,
is_hypothesis=True,
initialize_hyp_tracking_state=FLAGS.initialize_hyp_tracking_state,
premise_tracking_c_state_final=premise_tracking_c_state_final)
# Extract top element of final stack timestep.
if FLAGS.use_attention == "None" or FLAGS.use_difference_feature or FLAGS.use_product_feature:
premise_vector = premise_model.final_representations
hypothesis_vector = hypothesis_model.final_representations
if (FLAGS.lstm_composition and cls is not spinn.cbow.CBOW) or cls is spinn.plain_rnn.RNN:
premise_vector = premise_vector[:,:FLAGS.model_dim / 2].reshape((-1, FLAGS.model_dim / 2))
hypothesis_vector = hypothesis_vector[:,:FLAGS.model_dim / 2].reshape((-1, FLAGS.model_dim / 2))
sentence_vector_dim = FLAGS.model_dim / 2
else:
premise_vector = premise_vector.reshape((-1, FLAGS.model_dim))
hypothesis_vector = hypothesis_vector.reshape((-1, FLAGS.model_dim))
sentence_vector_dim = FLAGS.model_dim
if FLAGS.use_attention != "None":
# Use the attention weighted representation
h_dim = FLAGS.model_dim / 2
mlp_input = hypothesis_model.final_weighed_representation.reshape((-1, h_dim))
mlp_input_dim = h_dim
else:
# Create standard MLP features
mlp_input = T.concatenate([premise_vector, hypothesis_vector], axis=1)
mlp_input_dim = 2 * sentence_vector_dim
if FLAGS.use_difference_feature:
mlp_input = T.concatenate([mlp_input, premise_vector - hypothesis_vector], axis=1)
mlp_input_dim += sentence_vector_dim
if FLAGS.use_product_feature:
mlp_input = T.concatenate([mlp_input, premise_vector * hypothesis_vector], axis=1)
mlp_input_dim += sentence_vector_dim
mlp_input = util.BatchNorm(mlp_input, mlp_input_dim, vs, "sentence_vectors", training_mode)
mlp_input = util.Dropout(mlp_input, FLAGS.semantic_classifier_keep_rate, training_mode)
if FLAGS.classifier_type == "ResNet":
features = util.Linear(
mlp_input, mlp_input_dim, FLAGS.sentence_pair_combination_layer_dim, vs,
name="resnet/linear", use_bias=True)
features_dim = FLAGS.sentence_pair_combination_layer_dim
for layer in range(FLAGS.num_sentence_pair_combination_layers):
features = util.HeKaimingResidualLayerSet(features, features_dim, vs, training_mode, name="resnet/" + str(layer),
dropout_keep_rate=FLAGS.semantic_classifier_keep_rate, depth=FLAGS.resnet_unit_depth,
initializer=util.HeKaimingInitializer())
features = util.BatchNorm(features, features_dim, vs, "combining_mlp/" + str(layer), training_mode)
features = util.Dropout(features, FLAGS.semantic_classifier_keep_rate, training_mode)
elif FLAGS.classifier_type == "Highway":
features = util.Linear(
mlp_input, mlp_input_dim, FLAGS.sentence_pair_combination_layer_dim, vs,
name="resnet/linear", use_bias=True)
features_dim = FLAGS.sentence_pair_combination_layer_dim
for layer in range(FLAGS.num_sentence_pair_combination_layers):
features = util.HighwayLayer(features, features_dim, vs, training_mode, name="highway/" + str(layer),
dropout_keep_rate=FLAGS.semantic_classifier_keep_rate,
initializer=util.HeKaimingInitializer())
features = util.BatchNorm(features, features_dim, vs, "combining_mlp/" + str(layer), training_mode)
features = util.Dropout(features, FLAGS.semantic_classifier_keep_rate, training_mode)
else:
# Apply a combining MLP
features = mlp_input
features_dim = mlp_input_dim
for layer in range(FLAGS.num_sentence_pair_combination_layers):
features = util.ReLULayer(features, features_dim, FLAGS.sentence_pair_combination_layer_dim, vs,
name="combining_mlp/" + str(layer),
initializer=util.HeKaimingInitializer())
features_dim = FLAGS.sentence_pair_combination_layer_dim
features = util.BatchNorm(features, features_dim, vs, "combining_mlp/" + str(layer), training_mode)
features = util.Dropout(features, FLAGS.semantic_classifier_keep_rate, training_mode)
# Feed forward through a single output layer
logits = util.Linear(
features, features_dim, num_classes, vs,
name="semantic_classifier", use_bias=True)
return premise_model.transitions_pred, hypothesis_model.transitions_pred, logits
def build_cost(logits, targets):
"""
Build a classification cost function.
"""
# Clip gradients coming from the cost function.
logits = theano.gradient.grad_clip(
logits, -1. * FLAGS.clipping_max_value, FLAGS.clipping_max_value)
predicted_dist = T.nnet.softmax(logits)
costs = T.nnet.categorical_crossentropy(predicted_dist, targets)
cost = costs.mean()
pred = T.argmax(logits, axis=1)
acc = 1. - T.mean(T.cast(T.neq(pred, targets), theano.config.floatX))
return cost, acc
def build_transition_cost(logits, targets, num_transitions):
"""
Build a parse action prediction cost function.
"""
# swap seq_length dimension to front so that we can scan per timestep
logits = T.swapaxes(logits, 0, 1)
targets = targets.T
def cost_t(logits, tgt, num_transitions):
# TODO(jongauthier): Taper down xent cost as we proceed through
# sequence?
predicted_dist = T.nnet.softmax(logits)
cost = T.nnet.categorical_crossentropy(predicted_dist, tgt)
pred = T.argmax(logits, axis=1)
error = T.neq(pred, tgt)
return cost, error
results, _ = theano.scan(cost_t, [logits, targets], non_sequences=[num_transitions])
costs, errors = results
# Create a mask that selects only transitions that involve real data.
unrolling_length = T.shape(costs)[0]
padding = unrolling_length - num_transitions
padding = T.reshape(padding, (1, -1))
rng = T.arange(unrolling_length) + 1
rng = T.reshape(rng, (-1, 1))
mask = T.gt(rng, padding)
# Compute acc using the mask
acc = 1.0 - (T.sum(errors * mask, dtype=theano.config.floatX)
/ T.sum(num_transitions, dtype=theano.config.floatX))
# Compute cost directly, since we *do* want a cost incentive to get the padding
# transitions right.
cost = T.mean(costs)
return cost, acc
def evaluate(eval_fn, eval_set, logger, step):
# Evaluate
acc_accum = 0.0
action_acc_accum = 0.0
eval_batches = 0.0
for (eval_X_batch, eval_transitions_batch, eval_y_batch, eval_num_transitions_batch) in eval_set[1]:
acc_value, action_acc_value = eval_fn(
eval_X_batch, eval_transitions_batch,
eval_y_batch, eval_num_transitions_batch, 0.0, # Eval mode: Don't apply dropout.
int(FLAGS.allow_gt_transitions_in_eval), # Allow GT transitions to be used according to flag.
float(FLAGS.allow_gt_transitions_in_eval)) # If flag not set, used scheduled sampling
# p(ground truth) = 0.0,
# else SS p(ground truth) = 1.0
acc_accum += acc_value
action_acc_accum += action_acc_value
eval_batches += 1.0
logger.Log("Step: %i\tEval acc: %f\t %f\t%s" %
(step, acc_accum / eval_batches, action_acc_accum / eval_batches, eval_set[0]))
return acc_accum / eval_batches
def evaluate_expanded(eval_fn, eval_set, eval_path, logger, step, sentence_pair_data, ind_to_word, predict_transitions):
"""
Write the gold parses and predicted parses in the files <eval_out_path>.gld and <eval_out_path>.tst
respectively. These files can be given as inputs to Evalb to evaluate parsing performance -
evalb -p evalb_spinn.prm <eval_out_path>.gld <eval_out_path>.tst
TODO(SB): Set up for RNN and Model0 on non-sentence-pair data; port support to classifier.py.
"""
# TODO: Prune out redundant code, make usable on Model0 as well.
acc_accum = 0.0
action_acc_accum = 0.0
eval_batches = 0.0
eval_gold_path = eval_path + ".gld"
eval_out_path = eval_path + ".tst"
eval_lbl_path = eval_path + ".lbl"
with open(eval_gold_path, "w") as eval_gold, open(eval_out_path, "w") as eval_out:
if FLAGS.write_predicted_label:
label_out = open(eval_lbl_path, "w")
if sentence_pair_data:
for (eval_X_batch, eval_transitions_batch, eval_y_batch,
eval_num_transitions_batch) in eval_set[1]:
acc_value, action_acc_value, sem_logit_values, logits_pred_hyp, logits_pred_prem = eval_fn(
eval_X_batch, eval_transitions_batch, eval_y_batch, eval_num_transitions_batch,
0.0, # Eval mode: Don't apply dropout.
int(FLAGS.allow_gt_transitions_in_eval), # Allow GT transitions to be used according to flag.
float(FLAGS.allow_gt_transitions_in_eval)) # adjust visibility of GT
acc_accum += acc_value
action_acc_accum += action_acc_value
eval_batches += 1.0
# write each predicted transition to file
for orig_transitions, pred_logit_hyp, pred_logit_prem, tokens, true_class, example_sem_logits \
in zip(eval_transitions_batch, logits_pred_hyp,
logits_pred_prem, eval_X_batch, eval_y_batch, sem_logit_values):
if predict_transitions:
orig_hyp_transitions, orig_prem_transitions = orig_transitions.T
pred_hyp_transitions = pred_logit_hyp.argmax(axis=1)
pred_prem_transitions = pred_logit_prem.argmax(axis=1)
else:
orig_hyp_transitions = orig_prem_transitions = pred_hyp_transitions = pred_prem_transitions = None
hyp_tokens, prem_tokens = tokens.T
hyp_words = [ind_to_word[t] for t in hyp_tokens]
prem_words = [ind_to_word[t] for t in prem_tokens]
eval_gold.write(util.TransitionsToParse(orig_hyp_transitions, hyp_words) + "\n")
eval_out.write(util.TransitionsToParse(pred_hyp_transitions, hyp_words) + "\n")
eval_gold.write(util.TransitionsToParse(orig_prem_transitions, prem_words) + "\n")
eval_out.write(util.TransitionsToParse(pred_prem_transitions, prem_words) + "\n")
predicted_class = np.argmax(example_sem_logits)
exp_logit_values = np.exp(example_sem_logits)
class_probs = exp_logit_values / np.sum(exp_logit_values)
class_probs_repr = "\t".join(map(lambda p : "%.8f" % (p,), class_probs))
if FLAGS.write_predicted_label:
label_out.write(str(true_class == predicted_class) + "\t" + str(true_class)
+ "\t" + str(predicted_class) + "\t" + class_probs_repr + "\n")
else:
for (eval_X_batch, eval_transitions_batch, eval_y_batch,
eval_num_transitions_batch) in eval_set[1]:
acc_value, action_acc_value, sem_logit_values, logits_pred = eval_fn(
eval_X_batch, eval_transitions_batch, eval_y_batch, eval_num_transitions_batch,
0.0, # Eval mode: Don't apply dropout.
int(FLAGS.allow_gt_transitions_in_eval), # Allow GT transitions to be used according to flag.
float(FLAGS.allow_gt_transitions_in_eval)) # adjust visibility of GT
acc_accum += acc_value
action_acc_accum += action_acc_value
eval_batches += 1.0
# write each predicted transition to file
for orig_transitions, pred_logit, tokens, true_class, example_sem_logits \
in zip(eval_transitions_batch, logits_pred, eval_X_batch, eval_y_batch, sem_logit_values):
words = [ind_to_word[t] for t in tokens]
eval_gold.write(util.TransitionsToParse(orig_transitions, words) + "\n")
eval_out.write(util.TransitionsToParse(pred_logit.argmax(axis=1), words) + "\n")
predicted_class = np.argmax(example_sem_logits)
exp_logit_values = np.exp(example_sem_logits)
class_probs = exp_logit_values / np.sum(exp_logit_values)
class_probs_repr = "\t".join(map(lambda p : "%.3f" % (p,), class_probs))
if FLAGS.write_predicted_label:
label_out.write(str(true_class == predicted_class) + "\t" + str(true_class)
+ "\t" + str(predicted_class) + "\t" + class_probs_repr + "\n")
logger.Log("Written gold parses in %s" % (eval_gold_path))
logger.Log("Written predicted parses in %s" % (eval_out_path))
if FLAGS.write_predicted_label:
logger.Log("Written predicted labels in %s" % (eval_lbl_path))
label_out.close()
logger.Log("Step: %i\tEval acc: %f\t %f\t%s" %
(step, acc_accum / eval_batches, action_acc_accum / eval_batches, eval_set[0]))
def run(only_forward=False):
logger = afs_safe_logger.Logger(os.path.join(FLAGS.log_path, FLAGS.experiment_name) + ".log")
if FLAGS.data_type == "bl":
data_manager = load_boolean_data
elif FLAGS.data_type == "sst":
data_manager = load_sst_data
elif FLAGS.data_type == "snli":
data_manager = load_snli_data
else:
logger.Log("Bad data type.")
return
pp = pprint.PrettyPrinter(indent=4)
logger.Log("Flag values:\n" + pp.pformat(FLAGS.FlagValuesDict()))
# Load the data.
raw_training_data, vocabulary = data_manager.load_data(
FLAGS.training_data_path)
# Load the eval data.
raw_eval_sets = []
if FLAGS.eval_data_path:
for eval_filename in FLAGS.eval_data_path.split(":"):
eval_data, _ = data_manager.load_data(eval_filename)
raw_eval_sets.append((eval_filename, eval_data))
# Prepare the vocabulary.
if not vocabulary:
logger.Log("In open vocabulary mode. Using loaded embeddings without fine-tuning.")
train_embeddings = False
vocabulary = util.BuildVocabulary(
raw_training_data, raw_eval_sets, FLAGS.embedding_data_path, logger=logger,
sentence_pair_data=data_manager.SENTENCE_PAIR_DATA)
else:
logger.Log("In fixed vocabulary mode. Training embeddings.")
train_embeddings = True
# Load pretrained embeddings.
if FLAGS.embedding_data_path:
logger.Log("Loading vocabulary with " + str(len(vocabulary))
+ " words from " + FLAGS.embedding_data_path)
initial_embeddings = util.LoadEmbeddingsFromASCII(
vocabulary, FLAGS.word_embedding_dim, FLAGS.embedding_data_path)
else:
initial_embeddings = None
# Trim dataset, convert token sequences to integer sequences, crop, and
# pad.
logger.Log("Preprocessing training data.")
training_data = util.PreprocessDataset(
raw_training_data, vocabulary, FLAGS.seq_length, data_manager, eval_mode=False, logger=logger,
sentence_pair_data=data_manager.SENTENCE_PAIR_DATA,
for_rnn=FLAGS.model_type == "RNN" or FLAGS.model_type == "CBOW")
training_data_iter = util.MakeTrainingIterator(
training_data, FLAGS.batch_size)
eval_iterators = []
for filename, raw_eval_set in raw_eval_sets:
logger.Log("Preprocessing eval data: " + filename)
e_X, e_transitions, e_y, e_num_transitions = util.PreprocessDataset(
raw_eval_set, vocabulary, FLAGS.seq_length, data_manager, eval_mode=True, logger=logger,
sentence_pair_data=data_manager.SENTENCE_PAIR_DATA,
for_rnn=FLAGS.model_type == "RNN" or FLAGS.model_type == "CBOW")
eval_iterators.append((filename,
util.MakeEvalIterator((e_X, e_transitions, e_y, e_num_transitions), FLAGS.batch_size)))
# Set up the placeholders.
y = T.vector("y", dtype="int32")
lr = T.scalar("lr")
training_mode = T.scalar("training_mode") # 1: Training with dropout, 0: Eval
ground_truth_transitions_visible = T.scalar("ground_truth_transitions_visible", dtype="int32")
logger.Log("Building model.")
vs = util.VariableStore(
default_initializer=util.UniformInitializer(FLAGS.init_range), logger=logger)
if FLAGS.model_type == "CBOW":
model_cls = spinn.cbow.CBOW
elif FLAGS.model_type == "RNN":
model_cls = spinn.plain_rnn.RNN
else:
model_cls = getattr(spinn.fat_stack, FLAGS.model_type)
# Generator of mask for scheduled sampling
numpy_random = np.random.RandomState(1234)
ss_mask_gen = T.shared_randomstreams.RandomStreams(numpy_random.randint(999999))
# Training step number
ss_prob = T.scalar("ss_prob")
if data_manager.SENTENCE_PAIR_DATA:
X = T.itensor3("X")
transitions = T.itensor3("transitions")
num_transitions = T.imatrix("num_transitions")
predicted_premise_transitions, predicted_hypothesis_transitions, logits = build_sentence_pair_model(
model_cls, len(vocabulary), FLAGS.seq_length,
X, transitions, len(data_manager.LABEL_MAP), training_mode, ground_truth_transitions_visible, vs,
initial_embeddings=initial_embeddings, project_embeddings=(not train_embeddings),
ss_mask_gen=ss_mask_gen,
ss_prob=ss_prob)
else:
X = T.matrix("X", dtype="int32")
transitions = T.imatrix("transitions")
num_transitions = T.vector("num_transitions", dtype="int32")
predicted_transitions, logits = build_sentence_model(
model_cls, len(vocabulary), FLAGS.seq_length,
X, transitions, len(data_manager.LABEL_MAP), training_mode, ground_truth_transitions_visible, vs,
initial_embeddings=initial_embeddings, project_embeddings=(not train_embeddings),
ss_mask_gen=ss_mask_gen,
ss_prob=ss_prob)
xent_cost, acc = build_cost(logits, y)
# Set up L2 regularization.
l2_cost = 0.0
for var in vs.trainable_vars:
l2_cost += FLAGS.l2_lambda * T.sum(T.sqr(vs.vars[var]))
# Compute cross-entropy cost on action predictions.
if (not data_manager.SENTENCE_PAIR_DATA) and FLAGS.model_type not in ["Model0", "RNN", "CBOW"]:
transition_cost, action_acc = build_transition_cost(predicted_transitions, transitions, num_transitions)
elif data_manager.SENTENCE_PAIR_DATA and FLAGS.model_type not in ["Model0", "RNN", "CBOW"]:
p_transition_cost, p_action_acc = build_transition_cost(predicted_premise_transitions, transitions[:, :, 0],
num_transitions[:, 0])
h_transition_cost, h_action_acc = build_transition_cost(predicted_hypothesis_transitions, transitions[:, :, 1],
num_transitions[:, 1])
transition_cost = p_transition_cost + h_transition_cost
action_acc = (p_action_acc + h_action_acc) / 2.0 # TODO(SB): Average over transitions, not words.
else:
transition_cost = T.constant(0.0)
action_acc = T.constant(0.0)
transition_cost = transition_cost * FLAGS.transition_cost_scale
total_cost = xent_cost + l2_cost + transition_cost
if ".ckpt" in FLAGS.ckpt_path:
checkpoint_path = FLAGS.ckpt_path
else:
checkpoint_path = os.path.join(FLAGS.ckpt_path, FLAGS.experiment_name + ".ckpt")
if os.path.isfile(checkpoint_path):
logger.Log("Found checkpoint, restoring.")
step, best_dev_error = vs.load_checkpoint(checkpoint_path, num_extra_vars=2,
skip_saved_unsavables=FLAGS.skip_saved_unsavables)
else:
assert not only_forward, "Can't run an eval-only run without a checkpoint. Supply a checkpoint."
step = 0
best_dev_error = 1.0
# Do an evaluation-only run.
if only_forward:
if FLAGS.eval_output_paths:
eval_output_paths = FLAGS.eval_output_paths.strip().split(":")
assert len(eval_output_paths) == len(eval_iterators), "Invalid no. of output paths."
else:
eval_output_paths = [FLAGS.experiment_name + "-" + os.path.split(eval_set[0])[1] + "-parse"
for eval_set in eval_iterators]
# Load model from checkpoint.
logger.Log("Checkpointed model was trained for %d steps." % (step,))
# Generate function for forward pass.
logger.Log("Building forward pass.")
if data_manager.SENTENCE_PAIR_DATA:
eval_fn = theano.function(
[X, transitions, y, num_transitions, training_mode, ground_truth_transitions_visible, ss_prob],
[acc, action_acc, logits, predicted_hypothesis_transitions, predicted_premise_transitions],
on_unused_input='ignore',
allow_input_downcast=True)
else:
eval_fn = theano.function(
[X, transitions, y, num_transitions, training_mode, ground_truth_transitions_visible, ss_prob],
[acc, action_acc, logits, predicted_transitions],
on_unused_input='ignore',
allow_input_downcast=True)
# Generate the inverse vocabulary lookup table.
ind_to_word = {v : k for k, v in vocabulary.iteritems()}
# Do a forward pass and write the output to disk.
for eval_set, eval_out_path in zip(eval_iterators, eval_output_paths):
logger.Log("Writing eval output for %s." % (eval_set[0],))
evaluate_expanded(eval_fn, eval_set, eval_out_path, logger, step,
data_manager.SENTENCE_PAIR_DATA, ind_to_word, FLAGS.model_type not in ["Model0", "RNN", "CBOW"])
else:
# Train
new_values = util.RMSprop(total_cost, vs.trainable_vars.values(), lr)
new_values += [(key, vs.nongradient_updates[key]) for key in vs.nongradient_updates]
# Training open-vocabulary embeddings is a questionable idea right now. Disabled:
# new_values.append(
# util.embedding_SGD(total_cost, embedding_params, embedding_lr))
# Create training and eval functions.
# Unused variable warnings are supressed so that num_transitions can be passed in when training Model 0,
# which ignores it. This yields more readable code that is very slightly slower.
logger.Log("Building update function.")
update_fn = theano.function(
[X, transitions, y, num_transitions, lr, training_mode, ground_truth_transitions_visible, ss_prob],
[total_cost, xent_cost, transition_cost, action_acc, l2_cost, acc],
updates=new_values,
on_unused_input='ignore',
allow_input_downcast=True)
logger.Log("Building eval function.")
eval_fn = theano.function([X, transitions, y, num_transitions, training_mode, ground_truth_transitions_visible, ss_prob], [acc, action_acc],
on_unused_input='ignore',
allow_input_downcast=True)
logger.Log("Training.")
# Main training loop.
for step in range(step, FLAGS.training_steps):
if step % FLAGS.eval_interval_steps == 0:
for index, eval_set in enumerate(eval_iterators):
acc = evaluate(eval_fn, eval_set, logger, step)
if FLAGS.ckpt_on_best_dev_error and index == 0 and (1 - acc) < 0.99 * best_dev_error and step > 1000:
best_dev_error = 1 - acc
logger.Log("Checkpointing with new best dev accuracy of %f" % acc)
vs.save_checkpoint(checkpoint_path + "_best", extra_vars=[step, best_dev_error])
X_batch, transitions_batch, y_batch, num_transitions_batch = training_data_iter.next()
learning_rate = FLAGS.learning_rate * (FLAGS.learning_rate_decay_per_10k_steps ** (step / 10000.0))
ret = update_fn(X_batch, transitions_batch, y_batch, num_transitions_batch,
learning_rate, 1.0, 1.0, np.exp(step*np.log(FLAGS.scheduled_sampling_exponent_base)))
total_cost_val, xent_cost_val, transition_cost_val, action_acc_val, l2_cost_val, acc_val = ret
if step % FLAGS.statistics_interval_steps == 0:
logger.Log(
"Step: %i\tAcc: %f\t%f\tCost: %5f %5f %5f %5f"
% (step, acc_val, action_acc_val, total_cost_val, xent_cost_val, transition_cost_val,
l2_cost_val))
if step % FLAGS.ckpt_interval_steps == 0 and step > 0:
vs.save_checkpoint(checkpoint_path, extra_vars=[step, best_dev_error])
if __name__ == '__main__':
# Experiment naming.
gflags.DEFINE_string("experiment_name", "experiment", "")
# Data types.
gflags.DEFINE_enum("data_type", "bl", ["bl", "sst", "snli"],
"Which data handler and classifier to use.")
# Where to store checkpoints
gflags.DEFINE_string("ckpt_path", ".", "Where to save/load checkpoints. Can be either "
"a filename or a directory. In the latter case, the experiment name serves as the "
"base for the filename.")
gflags.DEFINE_string("log_path", ".", "A directory in which to write logs.")
# Data settings.
gflags.DEFINE_string("training_data_path", None, "")
gflags.DEFINE_string("eval_data_path", None, "Can contain multiple file paths, separated "
"using ':' tokens. The first file should be the dev set, and is used for determining "
"when to save the early stopping 'best' checkpoints.")
gflags.DEFINE_integer("seq_length", 30, "")
gflags.DEFINE_integer("eval_seq_length", 30, "")
gflags.DEFINE_string("embedding_data_path", None,
"If set, load GloVe-formatted embeddings from here.")
# Model architecture settings.
gflags.DEFINE_enum("model_type", "Model0",
["CBOW", "RNN", "Model0", "Model1", "Model2", "Model2S"],
"")
gflags.DEFINE_boolean("allow_gt_transitions_in_eval", False,
"Whether to use ground truth transitions in evaluation when appropriate "
"(i.e., in Model 1 and Model 2S.)")
gflags.DEFINE_integer("model_dim", 8, "")
gflags.DEFINE_integer("word_embedding_dim", 8, "")
gflags.DEFINE_integer("tracking_lstm_hidden_dim", 4, "")
gflags.DEFINE_boolean("use_tracking_lstm", True,
"Whether to use LSTM in the tracking unit")
gflags.DEFINE_boolean("predict_use_cell", False,
"For models which predict parser actions, use "
"both the tracking LSTM hidden and cell values as "
"input to the prediction layer")
gflags.DEFINE_enum("use_attention", "None",
["None", "Rocktaschel", "WangJiang", "Thang", "TreeWangJiang", "TreeThang"],
"")
gflags.DEFINE_boolean("context_sensitive_shift", False,
"Use LSTM hidden state and word embedding to determine the vector to be pushed")
gflags.DEFINE_boolean("context_sensitive_use_relu", False,
"Use ReLU Layer to combine embedding and tracking unit hidden state")
gflags.DEFINE_float("semantic_classifier_keep_rate", 0.5,
"Used for dropout in the semantic task classifier.")
gflags.DEFINE_float("embedding_keep_rate", 0.5,
"Used for dropout on transformed embeddings.")
gflags.DEFINE_boolean("lstm_composition", True, "")
gflags.DEFINE_enum("classifier_type", "MLP", ["MLP", "Highway", "ResNet"], "")
gflags.DEFINE_integer("resnet_unit_depth", 2, "")
# gflags.DEFINE_integer("num_composition_layers", 1, "")
gflags.DEFINE_integer("num_sentence_pair_combination_layers", 2, "")
gflags.DEFINE_integer("sentence_pair_combination_layer_dim", 1024, "")
gflags.DEFINE_float("scheduled_sampling_exponent_base", 0.99,
"Used for scheduled sampling, with probability of Model 1 over Model 2 being base^#training_steps")
gflags.DEFINE_boolean("use_difference_feature", True,
"Supply the sentence pair classifier with sentence difference features.")
gflags.DEFINE_boolean("use_product_feature", True,
"Supply the sentence pair classifier with sentence product features.")
gflags.DEFINE_boolean("connect_tracking_comp", True,
"Connect tracking unit and composition unit. Can only be true if using LSTM in both units.")
gflags.DEFINE_boolean("initialize_hyp_tracking_state", False,
"Initialize the c state of the tracking unit of hypothesis model with the final"
"tracking unit c state of the premise model.")
gflags.DEFINE_boolean("use_gru", False,
"Use GRU units instead of LSTM units.")
# Optimization settings.
gflags.DEFINE_integer("training_steps", 500000, "Stop training after this point.")
gflags.DEFINE_integer("batch_size", 32, "SGD minibatch size.")
gflags.DEFINE_float("learning_rate", 0.001, "Used in RMSProp.")
gflags.DEFINE_float("learning_rate_decay_per_10k_steps", 0.75, "Used in RMSProp.")
gflags.DEFINE_float("clipping_max_value", 5.0, "")
gflags.DEFINE_float("l2_lambda", 1e-5, "")
gflags.DEFINE_float("init_range", 0.005, "Mainly used for softmax parameters. Range for uniform random init.")
gflags.DEFINE_float("transition_cost_scale", 1.0, "Multiplied by the transition cost.")
# Display settings.
gflags.DEFINE_integer("statistics_interval_steps", 100, "Print training set results at this interval.")
gflags.DEFINE_integer("eval_interval_steps", 100, "Evaluate at this interval.")
gflags.DEFINE_integer("ckpt_interval_steps", 5000, "Update the checkpoint on disk at this interval.")
gflags.DEFINE_boolean("ckpt_on_best_dev_error", True, "If error on the first eval set (the dev set) is "
"at most 0.99 of error at the previous checkpoint, save a special 'best' checkpoint.")
# Evaluation settings
gflags.DEFINE_boolean("expanded_eval_only_mode", False,
"If set, a checkpoint is loaded and a forward pass is done to get the predicted "
"transitions. The inferred parses are written to the supplied file(s) along with example-"
"by-example accuracy information. Requirements: Must specify checkpoint path.")
gflags.DEFINE_string("eval_output_paths", None,
"Used when expanded_eval_only_mode is set. The number of supplied paths should be same"
"as the number of eval sets.")
gflags.DEFINE_boolean("write_predicted_label", False,
"Write the predicted labels in a <eval_output_name>.lbl file.")
gflags.DEFINE_boolean("skip_saved_unsavables", False,
"Assume that variables marked as not savable will appear in checkpoints anyway, and "
"skip them when loading. This should be used only when loading old checkpoints.")
# Parse command line flags.
FLAGS(sys.argv)
run(only_forward=FLAGS.expanded_eval_only_mode)
| [
1,
529,
276,
1112,
420,
29958,
14411,
4006,
12938,
29886,
29914,
1028,
2559,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29900,
29900,
29899,
29896,
29900,
29900,
29900,
13,
15945,
29908,
4591,
278,
2060,
3876,
3884,
313,
1285,
17225,
848,
2066,
511,
445,
508,
367,
1065,
411,
29901,
13,
13,
18146,
5900,
17983,
29901,
13,
4691,
448,
29885,
805,
2559,
29889,
9794,
29889,
29888,
271,
29918,
1990,
3709,
1192,
26495,
29918,
1272,
29918,
2084,
29772,
2204,
29899,
1272,
29914,
29886,
2204,
29918,
14968,
29889,
1372,
29894,
320,
13,
539,
1192,
14513,
29918,
1272,
29918,
2084,
29772,
2204,
29899,
1272,
29914,
29886,
2204,
29918,
3359,
29889,
1372,
29894,
13,
13,
29903,
1254,
19688,
313,
23444,
871,
29892,
1904,
4225,
263,
2989,
21806,
29963,
29872,
8297,
29881,
886,
934,
304,
437,
1532,
1125,
13,
4691,
448,
29885,
805,
2559,
29889,
9794,
29889,
29888,
271,
29918,
1990,
3709,
1192,
1272,
29918,
1853,
269,
303,
1192,
26495,
29918,
1272,
29918,
2084,
269,
303,
29899,
1272,
29914,
14968,
29889,
3945,
320,
13,
539,
1192,
14513,
29918,
1272,
29918,
2084,
269,
303,
29899,
1272,
29914,
3359,
29889,
3945,
1192,
17987,
8497,
29918,
1272,
29918,
2084,
805,
2559,
29914,
21150,
29914,
1688,
29918,
17987,
8497,
29918,
5344,
29889,
29945,
29881,
29889,
3945,
320,
13,
539,
1192,
4299,
29918,
6229,
29871,
29896,
29900,
1192,
1742,
29918,
17987,
8497,
29918,
6229,
29871,
29945,
13,
13,
19296,
5265,
875,
737,
358,
313,
23444,
871,
29892,
1904,
4225,
263,
2989,
21806,
29963,
29872,
8297,
29881,
886,
934,
304,
437,
1532,
1125,
13,
4691,
448,
29885,
805,
2559,
29889,
9794,
29889,
29888,
271,
29918,
1990,
3709,
1192,
1272,
29918,
1853,
5807,
492,
1192,
26495,
29918,
1272,
29918,
2084,
5807,
492,
29918,
29896,
29889,
29900,
29914,
16586,
492,
29918,
29896,
29889,
29900,
29918,
3359,
29889,
3126,
29880,
320,
13,
539,
1192,
14513,
29918,
1272,
29918,
2084,
5807,
492,
29918,
29896,
29889,
29900,
29914,
16586,
492,
29918,
29896,
29889,
29900,
29918,
3359,
29889,
3126,
29880,
1192,
17987,
8497,
29918,
1272,
29918,
2084,
805,
2559,
29914,
21150,
29914,
1688,
29918,
17987,
8497,
29918,
5344,
29889,
29945,
29881,
29889,
3945,
320,
13,
539,
1192,
4299,
29918,
6229,
29871,
29896,
29900,
1192,
1742,
29918,
17987,
8497,
29918,
6229,
29871,
29945,
13,
13,
9842,
29901,
960,
366,
679,
385,
1059,
6257,
411,
376,
1542,
2392,
29901,
6702,
29956,
29373,
1353,
310,
13391,
17794,
2645,
5849,
29892,
13,
1678,
727,
1122,
2307,
367,
263,
7160,
1423,
3149,
297,
274,
29895,
415,
29918,
2084,
393,
7087,
278,
1024,
310,
278,
1904,
366,
29915,
276,
14338,
29889,
13,
1678,
25249,
470,
5217,
372,
408,
8210,
29889,
13,
15945,
29908,
13,
13,
3166,
2090,
312,
8789,
1053,
7687,
13,
5215,
2897,
13,
5215,
282,
2158,
13,
5215,
10876,
13,
13,
5215,
330,
15764,
13,
3166,
278,
1562,
1053,
12489,
408,
323,
13,
5215,
278,
1562,
13,
5215,
12655,
408,
7442,
13,
13,
3166,
805,
2559,
1053,
2511,
29879,
29918,
11177,
29918,
21707,
13,
3166,
805,
2559,
1053,
3667,
13,
3166,
805,
2559,
29889,
1272,
29889,
20054,
1053,
2254,
29918,
20054,
29918,
1272,
13,
3166,
805,
2559,
29889,
1272,
29889,
29879,
303,
1053,
2254,
29918,
29879,
303,
29918,
1272,
13,
3166,
805,
2559,
29889,
1272,
29889,
16586,
492,
1053,
2254,
29918,
16586,
492,
29918,
1272,
13,
13,
5215,
805,
2559,
29889,
29888,
271,
29918,
1429,
13,
5215,
805,
2559,
29889,
24595,
29918,
29878,
15755,
13,
5215,
805,
2559,
29889,
10702,
340,
13,
13,
13,
18823,
10749,
353,
330,
15764,
29889,
18823,
10749,
13,
13,
13,
1753,
2048,
29918,
18616,
663,
29918,
4299,
29898,
25932,
29892,
7931,
370,
29918,
2311,
29892,
19359,
29918,
2848,
29892,
18897,
29892,
1301,
2187,
29892,
13,
462,
308,
954,
29918,
13203,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
7186,
29892,
13,
462,
308,
2847,
29918,
17987,
29881,
886,
29922,
8516,
29892,
2060,
29918,
17987,
29881,
886,
29922,
8824,
29892,
17971,
29918,
13168,
29918,
1885,
29922,
8516,
29892,
17971,
29918,
22795,
29922,
29900,
29889,
29900,
1125,
13,
1678,
9995,
13,
1678,
1281,
4984,
263,
770,
3709,
607,
3732,
671,
310,
777,
2898,
29899,
1429,
1904,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
418,
1067,
29879,
29901,
10999,
5096,
770,
304,
671,
313,
3166,
321,
29889,
29887,
29889,
421,
1028,
2559,
29889,
29888,
271,
29918,
1429,
6348,
13,
418,
7931,
370,
29918,
2311,
29901,
13,
418,
19359,
29918,
2848,
29901,
365,
1477,
310,
1269,
5665,
4944,
304,
278,
5096,
1904,
13,
418,
18897,
29901,
450,
1562,
9853,
313,
16031,
4636,
511,
421,
16175,
29918,
2311,
334,
19359,
29918,
2848,
29952,
13,
418,
1301,
2187,
29901,
450,
1562,
9853,
313,
16031,
4636,
511,
421,
16175,
29918,
2311,
334,
19359,
29918,
2848,
29952,
13,
418,
954,
29918,
13203,
29901,
9681,
310,
1962,
4413,
13,
418,
6694,
29918,
8513,
29901,
319,
450,
1562,
17336,
23941,
3692,
304,
1044,
408,
263,
6694,
1904,
13,
4706,
411,
5768,
449,
313,
29896,
29889,
29900,
29897,
470,
304,
1044,
408,
385,
19745,
1904,
411,
620,
1052,
292,
313,
29900,
29889,
29900,
467,
13,
418,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29901,
319,
450,
1562,
17336,
29889,
960,
731,
313,
29896,
29889,
29900,
511,
2758,
278,
1904,
2130,
13,
4706,
304,
5962,
8760,
1301,
2187,
29889,
910,
508,
367,
12708,
472,
17983,
931,
304,
4889,
8125,
29871,
29896,
13,
4706,
313,
272,
29871,
29906,
29903,
29897,
304,
14707,
297,
278,
8125,
29871,
29906,
3114,
411,
25383,
1301,
2187,
29889,
11699,
694,
2779,
373,
8125,
29871,
29900,
29889,
13,
418,
7186,
29901,
28736,
3787,
29889,
13,
1678,
9995,
13,
13,
1678,
396,
349,
3445,
598,
7546,
607,
23233,
5096,
1543,
15259,
29889,
13,
1678,
565,
1067,
29879,
338,
805,
2559,
29889,
24595,
29918,
29878,
15755,
29889,
29934,
10262,
29901,
13,
4706,
565,
383,
4375,
10749,
29889,
1509,
29918,
7108,
29901,
13,
9651,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
14345,
13309,
2747,
29892,
13,
462,
462,
3986,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
4706,
1683,
29901,
13,
9651,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
29931,
1254,
1988,
2747,
29892,
13,
462,
462,
3986,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
4706,
23655,
29918,
771,
6929,
29918,
11618,
353,
6213,
13,
1678,
25342,
1067,
29879,
338,
805,
2559,
29889,
10702,
340,
29889,
29907,
8456,
29956,
29901,
13,
4706,
27435,
29918,
11618,
353,
6213,
13,
4706,
23655,
29918,
771,
6929,
29918,
11618,
353,
6213,
13,
1678,
1683,
29901,
13,
4706,
565,
383,
4375,
10749,
29889,
20155,
29885,
29918,
510,
3283,
29901,
13,
9651,
565,
383,
4375,
10749,
29889,
1509,
29918,
7108,
29901,
13,
18884,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
9643,
14345,
13309,
2747,
29892,
13,
462,
462,
418,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
9651,
1683,
29901,
13,
18884,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
9643,
29931,
1254,
1988,
2747,
29892,
13,
462,
462,
3986,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
4706,
1683,
29901,
13,
9651,
4974,
451,
383,
4375,
10749,
29889,
6915,
29918,
11294,
292,
29918,
2388,
29892,
376,
6028,
871,
4511,
23110,
322,
15259,
5190,
1550,
773,
15472,
29931,
1254,
29924,
29908,
13,
9651,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
1123,
29931,
13309,
2747,
29892,
13,
462,
462,
418,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
13,
4706,
565,
2060,
29918,
17987,
29881,
886,
29901,
13,
9651,
23655,
29918,
771,
6929,
29918,
11618,
353,
3667,
29889,
12697,
13,
4706,
1683,
29901,
13,
9651,
4974,
383,
4375,
10749,
29889,
1742,
29918,
17987,
8497,
29918,
6229,
1275,
383,
4375,
10749,
29889,
4299,
29918,
6229,
29892,
320,
13,
18884,
376,
1742,
29918,
17987,
8497,
29918,
6229,
1818,
5186,
1904,
29918,
6229,
6521,
263,
18246,
7546,
338,
1304,
1213,
13,
9651,
23655,
29918,
771,
6929,
29918,
11618,
353,
3667,
29889,
18415,
14420,
13,
13,
1678,
396,
8878,
2898,
5096,
607,
885,
550,
975,
1881,
5665,
29889,
13,
1678,
10541,
29918,
4299,
353,
1067,
29879,
29898,
13,
4706,
383,
4375,
10749,
29889,
4299,
29918,
6229,
29892,
383,
4375,
10749,
29889,
1742,
29918,
17987,
8497,
29918,
6229,
29892,
7931,
370,
29918,
2311,
29892,
19359,
29918,
2848,
29892,
13,
4706,
27435,
29918,
11618,
29892,
23655,
29918,
771,
6929,
29918,
11618,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
7186,
29892,
13,
4706,
8500,
29918,
1509,
29918,
3729,
29922,
18823,
10749,
29889,
27711,
29918,
1509,
29918,
3729,
29892,
13,
4706,
671,
29918,
11294,
292,
29918,
20155,
29885,
29922,
18823,
10749,
29889,
1509,
29918,
11294,
292,
29918,
20155,
29885,
29892,
13,
4706,
23110,
29918,
20155,
29885,
29918,
10892,
29918,
6229,
29922,
18823,
10749,
29889,
11294,
292,
29918,
20155,
29885,
29918,
10892,
29918,
6229,
29892,
13,
4706,
1060,
29922,
517,
12360,
29892,
13,
4706,
1301,
2187,
29922,
3286,
2187,
29892,
13,
4706,
2847,
29918,
17987,
29881,
886,
29922,
11228,
29918,
17987,
29881,
886,
29892,
13,
4706,
23655,
29918,
8865,
449,
29918,
17462,
29918,
10492,
29922,
18823,
10749,
29889,
17987,
8497,
29918,
17462,
29918,
10492,
29892,
13,
4706,
17971,
29918,
13168,
29918,
1885,
29922,
893,
29918,
13168,
29918,
1885,
29892,
13,
4706,
17971,
29918,
22795,
29922,
893,
29918,
22795,
29892,
13,
4706,
4511,
29918,
11294,
292,
29918,
2388,
29922,
18823,
10749,
29889,
6915,
29918,
11294,
292,
29918,
2388,
29892,
13,
4706,
3030,
29918,
23149,
3321,
29918,
10889,
29922,
18823,
10749,
29889,
4703,
29918,
23149,
3321,
29918,
10889,
29892,
13,
4706,
3030,
29918,
23149,
3321,
29918,
1509,
29918,
2674,
29884,
29922,
18823,
10749,
29889,
4703,
29918,
23149,
3321,
29918,
1509,
29918,
2674,
29884,
29892,
13,
4706,
671,
29918,
2080,
29918,
16175,
29918,
12324,
29922,
8824,
29897,
13,
13,
1678,
396,
7338,
1461,
2246,
1543,
310,
2186,
5096,
5335,
342,
1022,
29889,
13,
1678,
565,
383,
4375,
10749,
29889,
20155,
29885,
29918,
510,
3283,
470,
1067,
29879,
338,
805,
2559,
29889,
24595,
29918,
29878,
15755,
29889,
29934,
10262,
29901,
13,
4706,
10541,
29918,
8111,
353,
10541,
29918,
4299,
29889,
8394,
29918,
276,
6338,
800,
7503,
29892,
29901,
18823,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
1822,
690,
14443,
3552,
29899,
29896,
29892,
383,
4375,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
876,
13,
4706,
10541,
29918,
8111,
29918,
6229,
353,
383,
4375,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
13,
1678,
1683,
29901,
13,
4706,
10541,
29918,
8111,
353,
10541,
29918,
4299,
29889,
8394,
29918,
276,
6338,
800,
29889,
690,
14443,
3552,
29899,
29896,
29892,
383,
4375,
10749,
29889,
4299,
29918,
6229,
876,
13,
4706,
10541,
29918,
8111,
29918,
6229,
353,
383,
4375,
10749,
29889,
4299,
29918,
6229,
13,
13,
1678,
10541,
29918,
8111,
353,
3667,
29889,
23145,
29940,
555,
29898,
18616,
663,
29918,
8111,
29892,
10541,
29918,
8111,
29918,
6229,
29892,
7186,
29892,
376,
18616,
663,
29918,
8111,
613,
6694,
29918,
8513,
29897,
13,
1678,
10541,
29918,
8111,
353,
3667,
29889,
15063,
449,
29898,
18616,
663,
29918,
8111,
29892,
383,
4375,
10749,
29889,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
29892,
6694,
29918,
8513,
29897,
13,
13,
1678,
396,
5169,
287,
6375,
1549,
263,
2323,
1962,
7546,
13,
1678,
1480,
1169,
353,
3667,
29889,
12697,
29898,
13,
4706,
10541,
29918,
8111,
29892,
10541,
29918,
8111,
29918,
6229,
29892,
954,
29918,
13203,
29892,
7186,
29892,
13,
4706,
1024,
543,
12846,
7716,
29918,
1990,
3709,
613,
671,
29918,
29890,
3173,
29922,
5574,
29897,
13,
13,
1678,
736,
10541,
29918,
4299,
29889,
3286,
2187,
29918,
11965,
29892,
1480,
1169,
13,
13,
13,
13,
1753,
2048,
29918,
18616,
663,
29918,
18784,
29918,
4299,
29898,
25932,
29892,
7931,
370,
29918,
2311,
29892,
19359,
29918,
2848,
29892,
18897,
29892,
1301,
2187,
29892,
13,
462,
268,
954,
29918,
13203,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
7186,
29892,
13,
462,
268,
2847,
29918,
17987,
29881,
886,
29922,
8516,
29892,
2060,
29918,
17987,
29881,
886,
29922,
8824,
29892,
17971,
29918,
13168,
29918,
1885,
29922,
8516,
29892,
17971,
29918,
22795,
29922,
29900,
29889,
29900,
1125,
13,
1678,
9995,
13,
1678,
1281,
4984,
263,
770,
3709,
607,
3732,
671,
310,
777,
2898,
29899,
1429,
1904,
29889,
13,
13,
1678,
826,
3174,
29901,
13,
418,
1067,
29879,
29901,
10999,
5096,
770,
304,
671,
313,
3166,
321,
29889,
29887,
29889,
421,
1028,
2559,
29889,
29888,
271,
29918,
1429,
6348,
13,
418,
7931,
370,
29918,
2311,
29901,
13,
418,
19359,
29918,
2848,
29901,
365,
1477,
310,
1269,
5665,
4944,
304,
278,
5096,
1904,
13,
418,
18897,
29901,
450,
1562,
9853,
313,
16031,
4636,
511,
421,
16175,
29918,
2311,
334,
19359,
29918,
2848,
29952,
13,
418,
1301,
2187,
29901,
450,
1562,
9853,
313,
16031,
4636,
511,
421,
16175,
29918,
2311,
334,
19359,
29918,
2848,
29952,
13,
418,
954,
29918,
13203,
29901,
9681,
310,
1962,
4413,
13,
418,
6694,
29918,
8513,
29901,
319,
450,
1562,
17336,
23941,
3692,
304,
1044,
408,
263,
6694,
1904,
13,
4706,
411,
5768,
449,
313,
29896,
29889,
29900,
29897,
470,
304,
1044,
408,
385,
19745,
1904,
411,
620,
1052,
292,
313,
29900,
29889,
29900,
467,
13,
418,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29901,
319,
450,
1562,
17336,
29889,
960,
731,
313,
29896,
29889,
29900,
511,
2758,
278,
1904,
2130,
13,
4706,
304,
5962,
8760,
1301,
2187,
29889,
910,
508,
367,
12708,
472,
17983,
931,
304,
4889,
8125,
29871,
29896,
13,
4706,
313,
272,
29871,
29906,
29903,
29897,
304,
14707,
297,
278,
8125,
29871,
29906,
3114,
411,
25383,
1301,
2187,
29889,
11699,
694,
2779,
373,
8125,
29871,
29900,
29889,
13,
418,
7186,
29901,
28736,
3787,
29889,
13,
1678,
9995,
13,
13,
13,
1678,
396,
349,
3445,
598,
7546,
607,
23233,
5096,
1543,
15259,
29889,
13,
1678,
565,
1067,
29879,
338,
805,
2559,
29889,
24595,
29918,
29878,
15755,
29889,
29934,
10262,
29901,
13,
4706,
565,
383,
4375,
10749,
29889,
1509,
29918,
7108,
29901,
13,
9651,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
14345,
13309,
2747,
29892,
13,
462,
462,
3986,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
4706,
1683,
29901,
13,
9651,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
29931,
1254,
1988,
2747,
29892,
13,
462,
462,
3986,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
4706,
23655,
29918,
771,
6929,
29918,
11618,
353,
6213,
13,
1678,
25342,
1067,
29879,
338,
805,
2559,
29889,
10702,
340,
29889,
29907,
8456,
29956,
29901,
13,
4706,
27435,
29918,
11618,
353,
6213,
13,
4706,
23655,
29918,
771,
6929,
29918,
11618,
353,
6213,
13,
1678,
1683,
29901,
13,
4706,
565,
383,
4375,
10749,
29889,
20155,
29885,
29918,
510,
3283,
29901,
13,
9651,
565,
383,
4375,
10749,
29889,
1509,
29918,
7108,
29901,
13,
18884,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
9643,
14345,
13309,
2747,
29892,
13,
462,
462,
3986,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
9651,
1683,
29901,
13,
18884,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
9643,
29931,
1254,
1988,
2747,
29892,
13,
462,
462,
3986,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
4706,
1683,
29901,
13,
9651,
4974,
451,
383,
4375,
10749,
29889,
6915,
29918,
11294,
292,
29918,
2388,
29892,
376,
6028,
871,
4511,
23110,
322,
15259,
5190,
1550,
773,
15472,
29931,
1254,
29924,
29908,
13,
9651,
27435,
29918,
11618,
353,
7687,
29898,
4422,
29889,
1123,
29931,
13309,
2747,
29892,
13,
462,
462,
418,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
13,
4706,
565,
2060,
29918,
17987,
29881,
886,
29901,
13,
9651,
23655,
29918,
771,
6929,
29918,
11618,
353,
3667,
29889,
12697,
13,
4706,
1683,
29901,
13,
9651,
4974,
383,
4375,
10749,
29889,
1742,
29918,
17987,
8497,
29918,
6229,
1275,
383,
4375,
10749,
29889,
4299,
29918,
6229,
29892,
320,
13,
18884,
376,
1742,
29918,
17987,
8497,
29918,
6229,
1818,
5186,
1904,
29918,
6229,
6521,
263,
18246,
7546,
338,
1304,
1213,
13,
9651,
23655,
29918,
771,
6929,
29918,
11618,
353,
3667,
29889,
18415,
14420,
13,
13,
1678,
396,
26178,
278,
1023,
25260,
13,
1678,
5188,
895,
29918,
517,
12360,
353,
18897,
7503,
29892,
584,
29892,
29871,
29900,
29962,
13,
1678,
20051,
29918,
517,
12360,
353,
18897,
7503,
29892,
584,
29892,
29871,
29896,
29962,
13,
13,
1678,
5188,
895,
29918,
3286,
2187,
353,
1301,
2187,
7503,
29892,
584,
29892,
29871,
29900,
29962,
13,
1678,
20051,
29918,
3286,
2187,
353,
1301,
2187,
7503,
29892,
584,
29892,
29871,
29896,
29962,
13,
13,
1678,
396,
8878,
1023,
2898,
5096,
4733,
607,
12812,
975,
1881,
15602,
29889,
13,
1678,
5188,
895,
29918,
4299,
353,
1067,
29879,
29898,
13,
4706,
383,
4375,
10749,
29889,
4299,
29918,
6229,
29892,
383,
4375,
10749,
29889,
1742,
29918,
17987,
8497,
29918,
6229,
29892,
7931,
370,
29918,
2311,
29892,
19359,
29918,
2848,
29892,
13,
4706,
27435,
29918,
11618,
29892,
23655,
29918,
771,
6929,
29918,
11618,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
7186,
29892,
13,
4706,
8500,
29918,
1509,
29918,
3729,
29922,
18823,
10749,
29889,
27711,
29918,
1509,
29918,
3729,
29892,
13,
4706,
671,
29918,
11294,
292,
29918,
20155,
29885,
29922,
18823,
10749,
29889,
1509,
29918,
11294,
292,
29918,
20155,
29885,
29892,
13,
4706,
23110,
29918,
20155,
29885,
29918,
10892,
29918,
6229,
29922,
18823,
10749,
29889,
11294,
292,
29918,
20155,
29885,
29918,
10892,
29918,
6229,
29892,
13,
4706,
1060,
29922,
1457,
29885,
895,
29918,
517,
12360,
29892,
13,
4706,
1301,
2187,
29922,
1457,
29885,
895,
29918,
3286,
2187,
29892,
13,
4706,
2847,
29918,
17987,
29881,
886,
29922,
11228,
29918,
17987,
29881,
886,
29892,
13,
4706,
23655,
29918,
8865,
449,
29918,
17462,
29918,
10492,
29922,
18823,
10749,
29889,
17987,
8497,
29918,
17462,
29918,
10492,
29892,
13,
4706,
17971,
29918,
13168,
29918,
1885,
29922,
893,
29918,
13168,
29918,
1885,
29892,
13,
4706,
17971,
29918,
22795,
29922,
893,
29918,
22795,
29892,
13,
4706,
4511,
29918,
11294,
292,
29918,
2388,
29922,
18823,
10749,
29889,
6915,
29918,
11294,
292,
29918,
2388,
29892,
13,
4706,
3030,
29918,
23149,
3321,
29918,
10889,
29922,
18823,
10749,
29889,
4703,
29918,
23149,
3321,
29918,
10889,
29892,
13,
4706,
3030,
29918,
23149,
3321,
29918,
1509,
29918,
2674,
29884,
29922,
18823,
10749,
29889,
4703,
29918,
23149,
3321,
29918,
1509,
29918,
2674,
29884,
29892,
13,
4706,
671,
29918,
1131,
2509,
29922,
18823,
10749,
29889,
1509,
29918,
1131,
2509,
29892,
13,
4706,
11905,
29918,
29882,
1478,
29918,
11294,
292,
29918,
3859,
29922,
18823,
10749,
29889,
24926,
29918,
29882,
1478,
29918,
11294,
292,
29918,
3859,
29897,
13,
13,
1678,
5188,
895,
29918,
1429,
29918,
3332,
29879,
353,
5188,
895,
29918,
4299,
29889,
1429,
29918,
3332,
29879,
565,
383,
4375,
10749,
29889,
1509,
29918,
1131,
2509,
2804,
376,
8516,
29908,
1683,
6213,
13,
1678,
5188,
895,
29918,
11294,
292,
29918,
29883,
29918,
3859,
29918,
8394,
353,
5188,
895,
29918,
4299,
29889,
11294,
292,
29918,
29883,
29918,
3859,
29918,
8394,
565,
1067,
29879,
451,
297,
518,
1028,
2559,
29889,
24595,
29918,
29878,
15755,
29889,
29934,
10262,
29892,
29871,
13,
462,
462,
462,
462,
462,
9651,
805,
2559,
29889,
10702,
340,
29889,
29907,
8456,
29956,
29962,
1683,
6213,
13,
1678,
20051,
29918,
4299,
353,
1067,
29879,
29898,
13,
4706,
383,
4375,
10749,
29889,
4299,
29918,
6229,
29892,
383,
4375,
10749,
29889,
1742,
29918,
17987,
8497,
29918,
6229,
29892,
7931,
370,
29918,
2311,
29892,
19359,
29918,
2848,
29892,
13,
4706,
27435,
29918,
11618,
29892,
23655,
29918,
771,
6929,
29918,
11618,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
7186,
29892,
13,
4706,
8500,
29918,
1509,
29918,
3729,
29922,
18823,
10749,
29889,
27711,
29918,
1509,
29918,
3729,
29892,
13,
4706,
671,
29918,
11294,
292,
29918,
20155,
29885,
29922,
18823,
10749,
29889,
1509,
29918,
11294,
292,
29918,
20155,
29885,
29892,
13,
4706,
23110,
29918,
20155,
29885,
29918,
10892,
29918,
6229,
29922,
18823,
10749,
29889,
11294,
292,
29918,
20155,
29885,
29918,
10892,
29918,
6229,
29892,
13,
4706,
1060,
29922,
29882,
1478,
720,
6656,
29918,
517,
12360,
29892,
13,
4706,
1301,
2187,
29922,
29882,
1478,
720,
6656,
29918,
3286,
2187,
29892,
13,
4706,
2847,
29918,
17987,
29881,
886,
29922,
11228,
29918,
17987,
29881,
886,
29892,
13,
4706,
23655,
29918,
8865,
449,
29918,
17462,
29918,
10492,
29922,
18823,
10749,
29889,
17987,
8497,
29918,
17462,
29918,
10492,
29892,
13,
4706,
17971,
29918,
13168,
29918,
1885,
29922,
893,
29918,
13168,
29918,
1885,
29892,
13,
4706,
17971,
29918,
22795,
29922,
893,
29918,
22795,
29892,
13,
4706,
4511,
29918,
11294,
292,
29918,
2388,
29922,
18823,
10749,
29889,
6915,
29918,
11294,
292,
29918,
2388,
29892,
13,
4706,
3030,
29918,
23149,
3321,
29918,
10889,
29922,
18823,
10749,
29889,
4703,
29918,
23149,
3321,
29918,
10889,
29892,
13,
4706,
3030,
29918,
23149,
3321,
29918,
1509,
29918,
2674,
29884,
29922,
18823,
10749,
29889,
4703,
29918,
23149,
3321,
29918,
1509,
29918,
2674,
29884,
29892,
13,
4706,
671,
29918,
1131,
2509,
29922,
18823,
10749,
29889,
1509,
29918,
1131,
2509,
29892,
13,
4706,
5188,
895,
29918,
1429,
29918,
3332,
29879,
29922,
1457,
29885,
895,
29918,
1429,
29918,
3332,
29879,
29892,
13,
4706,
338,
29918,
29882,
1478,
720,
6656,
29922,
5574,
29892,
13,
4706,
11905,
29918,
29882,
1478,
29918,
11294,
292,
29918,
3859,
29922,
18823,
10749,
29889,
24926,
29918,
29882,
1478,
29918,
11294,
292,
29918,
3859,
29892,
13,
4706,
5188,
895,
29918,
11294,
292,
29918,
29883,
29918,
3859,
29918,
8394,
29922,
1457,
29885,
895,
29918,
11294,
292,
29918,
29883,
29918,
3859,
29918,
8394,
29897,
13,
13,
1678,
396,
7338,
1461,
2246,
1543,
310,
2186,
5096,
5335,
342,
1022,
29889,
13,
1678,
565,
383,
4375,
10749,
29889,
1509,
29918,
1131,
2509,
1275,
376,
8516,
29908,
470,
383,
4375,
10749,
29889,
1509,
29918,
29881,
17678,
29918,
14394,
470,
383,
4375,
10749,
29889,
1509,
29918,
4704,
29918,
14394,
29901,
13,
4706,
5188,
895,
29918,
8111,
353,
5188,
895,
29918,
4299,
29889,
8394,
29918,
276,
6338,
800,
13,
4706,
20051,
29918,
8111,
353,
20051,
29918,
4299,
29889,
8394,
29918,
276,
6338,
800,
13,
13,
4706,
565,
313,
18823,
10749,
29889,
20155,
29885,
29918,
510,
3283,
322,
1067,
29879,
338,
451,
805,
2559,
29889,
10702,
340,
29889,
29907,
8456,
29956,
29897,
470,
1067,
29879,
338,
805,
2559,
29889,
24595,
29918,
29878,
15755,
29889,
29934,
10262,
29901,
13,
9651,
5188,
895,
29918,
8111,
353,
5188,
895,
29918,
8111,
7503,
29892,
29901,
18823,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
1822,
690,
14443,
3552,
29899,
29896,
29892,
383,
4375,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
876,
13,
9651,
20051,
29918,
8111,
353,
20051,
29918,
8111,
7503,
29892,
29901,
18823,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
1822,
690,
14443,
3552,
29899,
29896,
29892,
383,
4375,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
876,
13,
9651,
10541,
29918,
8111,
29918,
6229,
353,
383,
4375,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
13,
4706,
1683,
29901,
13,
9651,
5188,
895,
29918,
8111,
353,
5188,
895,
29918,
8111,
29889,
690,
14443,
3552,
29899,
29896,
29892,
383,
4375,
10749,
29889,
4299,
29918,
6229,
876,
13,
9651,
20051,
29918,
8111,
353,
20051,
29918,
8111,
29889,
690,
14443,
3552,
29899,
29896,
29892,
383,
4375,
10749,
29889,
4299,
29918,
6229,
876,
13,
9651,
10541,
29918,
8111,
29918,
6229,
353,
383,
4375,
10749,
29889,
4299,
29918,
6229,
13,
13,
1678,
565,
383,
4375,
10749,
29889,
1509,
29918,
1131,
2509,
2804,
376,
8516,
1115,
13,
4706,
396,
4803,
278,
8570,
7688,
287,
8954,
13,
4706,
298,
29918,
6229,
353,
383,
4375,
10749,
29889,
4299,
29918,
6229,
847,
29871,
29906,
13,
4706,
286,
22833,
29918,
2080,
353,
20051,
29918,
4299,
29889,
8394,
29918,
705,
25398,
29918,
276,
26081,
29889,
690,
14443,
3552,
29899,
29896,
29892,
298,
29918,
6229,
876,
13,
4706,
286,
22833,
29918,
2080,
29918,
6229,
353,
298,
29918,
6229,
13,
1678,
1683,
29901,
13,
4706,
396,
6204,
3918,
341,
13208,
5680,
13,
4706,
286,
22833,
29918,
2080,
353,
323,
29889,
535,
29883,
2579,
403,
4197,
1457,
29885,
895,
29918,
8111,
29892,
20051,
29918,
8111,
1402,
9685,
29922,
29896,
29897,
13,
4706,
286,
22833,
29918,
2080,
29918,
6229,
353,
29871,
29906,
334,
10541,
29918,
8111,
29918,
6229,
13,
13,
1678,
565,
383,
4375,
10749,
29889,
1509,
29918,
29881,
17678,
29918,
14394,
29901,
13,
4706,
286,
22833,
29918,
2080,
353,
323,
29889,
535,
29883,
2579,
403,
4197,
828,
29886,
29918,
2080,
29892,
5188,
895,
29918,
8111,
448,
20051,
29918,
8111,
1402,
9685,
29922,
29896,
29897,
13,
4706,
286,
22833,
29918,
2080,
29918,
6229,
4619,
10541,
29918,
8111,
29918,
6229,
13,
13,
1678,
565,
383,
4375,
10749,
29889,
1509,
29918,
4704,
29918,
14394,
29901,
13,
4706,
286,
22833,
29918,
2080,
353,
323,
29889,
535,
29883,
2579,
403,
4197,
828,
29886,
29918,
2080,
29892,
5188,
895,
29918,
8111,
334,
20051,
29918,
8111,
1402,
9685,
29922,
29896,
29897,
13,
4706,
286,
22833,
29918,
2080,
29918,
6229,
4619,
10541,
29918,
8111,
29918,
6229,
13,
13,
1678,
286,
22833,
29918,
2080,
353,
3667,
29889,
23145,
29940,
555,
29898,
828,
29886,
29918,
2080,
29892,
286,
22833,
29918,
2080,
29918,
6229,
29892,
7186,
29892,
376,
18616,
663,
29918,
345,
14359,
613,
6694,
29918,
8513,
29897,
13,
1678,
286,
22833,
29918,
2080,
353,
3667,
29889,
15063,
449,
29898,
828,
29886,
29918,
2080,
29892,
383,
4375,
10749,
29889,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
29892,
6694,
29918,
8513,
29897,
13,
13,
1678,
565,
383,
4375,
10749,
29889,
1990,
3709,
29918,
1853,
1275,
376,
1666,
6779,
1115,
13,
4706,
5680,
353,
3667,
29889,
12697,
29898,
13,
9651,
286,
22833,
29918,
2080,
29892,
286,
22833,
29918,
2080,
29918,
6229,
29892,
383,
4375,
10749,
29889,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
13148,
29918,
6229,
29892,
7186,
29892,
13,
9651,
1024,
543,
690,
1212,
29914,
10660,
613,
671,
29918,
29890,
3173,
29922,
5574,
29897,
13,
4706,
5680,
29918,
6229,
353,
383,
4375,
10749,
29889,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
13148,
29918,
6229,
13,
13,
4706,
363,
7546,
297,
3464,
29898,
18823,
10749,
29889,
1949,
29918,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
29277,
1125,
13,
9651,
5680,
353,
3667,
29889,
3868,
29968,
29874,
326,
292,
1666,
333,
950,
14420,
2697,
29898,
22100,
29892,
5680,
29918,
6229,
29892,
7186,
29892,
6694,
29918,
8513,
29892,
1024,
543,
690,
1212,
12975,
718,
851,
29898,
13148,
511,
29871,
13,
18884,
5768,
449,
29918,
17462,
29918,
10492,
29922,
18823,
10749,
29889,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
29892,
10809,
29922,
18823,
10749,
29889,
690,
1212,
29918,
5441,
29918,
19488,
29892,
29871,
13,
18884,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
9651,
5680,
353,
3667,
29889,
23145,
29940,
555,
29898,
22100,
29892,
5680,
29918,
6229,
29892,
7186,
29892,
376,
510,
2109,
292,
29918,
828,
29886,
12975,
718,
851,
29898,
13148,
511,
6694,
29918,
8513,
29897,
13,
9651,
5680,
353,
3667,
29889,
15063,
449,
29898,
22100,
29892,
383,
4375,
10749,
29889,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
29892,
6694,
29918,
8513,
29897,
13,
1678,
25342,
383,
4375,
10749,
29889,
1990,
3709,
29918,
1853,
1275,
376,
16382,
1582,
1115,
13,
4706,
5680,
353,
3667,
29889,
12697,
29898,
13,
9651,
286,
22833,
29918,
2080,
29892,
286,
22833,
29918,
2080,
29918,
6229,
29892,
383,
4375,
10749,
29889,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
13148,
29918,
6229,
29892,
7186,
29892,
13,
9651,
1024,
543,
690,
1212,
29914,
10660,
613,
671,
29918,
29890,
3173,
29922,
5574,
29897,
13,
4706,
5680,
29918,
6229,
353,
383,
4375,
10749,
29889,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
13148,
29918,
6229,
13,
13,
4706,
363,
7546,
297,
3464,
29898,
18823,
10749,
29889,
1949,
29918,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
29277,
1125,
13,
9651,
5680,
353,
3667,
29889,
16382,
1582,
14420,
29898,
22100,
29892,
5680,
29918,
6229,
29892,
7186,
29892,
6694,
29918,
8513,
29892,
1024,
543,
9812,
1582,
12975,
718,
851,
29898,
13148,
511,
29871,
13,
18884,
5768,
449,
29918,
17462,
29918,
10492,
29922,
18823,
10749,
29889,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
29892,
13,
18884,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
9651,
5680,
353,
3667,
29889,
23145,
29940,
555,
29898,
22100,
29892,
5680,
29918,
6229,
29892,
7186,
29892,
376,
510,
2109,
292,
29918,
828,
29886,
12975,
718,
851,
29898,
13148,
511,
6694,
29918,
8513,
29897,
13,
9651,
5680,
353,
3667,
29889,
15063,
449,
29898,
22100,
29892,
383,
4375,
10749,
29889,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
29892,
6694,
29918,
8513,
29897,
13,
1678,
1683,
29901,
268,
13,
4706,
396,
2401,
368,
263,
29299,
341,
13208,
13,
4706,
5680,
353,
286,
22833,
29918,
2080,
13,
4706,
5680,
29918,
6229,
353,
286,
22833,
29918,
2080,
29918,
6229,
13,
4706,
363,
7546,
297,
3464,
29898,
18823,
10749,
29889,
1949,
29918,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
29277,
1125,
13,
9651,
5680,
353,
3667,
29889,
1123,
29931,
13309,
2747,
29898,
22100,
29892,
5680,
29918,
6229,
29892,
383,
4375,
10749,
29889,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
13148,
29918,
6229,
29892,
7186,
29892,
13,
18884,
1024,
543,
510,
2109,
292,
29918,
828,
29886,
12975,
718,
851,
29898,
13148,
511,
13,
18884,
2847,
3950,
29922,
4422,
29889,
3868,
29968,
29874,
326,
292,
15514,
3950,
3101,
13,
9651,
5680,
29918,
6229,
353,
383,
4375,
10749,
29889,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
13148,
29918,
6229,
13,
13,
9651,
5680,
353,
3667,
29889,
23145,
29940,
555,
29898,
22100,
29892,
5680,
29918,
6229,
29892,
7186,
29892,
376,
510,
2109,
292,
29918,
828,
29886,
12975,
718,
851,
29898,
13148,
511,
6694,
29918,
8513,
29897,
13,
9651,
5680,
353,
3667,
29889,
15063,
449,
29898,
22100,
29892,
383,
4375,
10749,
29889,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
29892,
6694,
29918,
8513,
29897,
29871,
13,
13,
1678,
396,
5169,
287,
6375,
1549,
263,
2323,
1962,
7546,
13,
1678,
1480,
1169,
353,
3667,
29889,
12697,
29898,
13,
4706,
5680,
29892,
5680,
29918,
6229,
29892,
954,
29918,
13203,
29892,
7186,
29892,
13,
4706,
1024,
543,
12846,
7716,
29918,
1990,
3709,
613,
671,
29918,
29890,
3173,
29922,
5574,
29897,
13,
13,
1678,
736,
5188,
895,
29918,
4299,
29889,
3286,
2187,
29918,
11965,
29892,
20051,
29918,
4299,
29889,
3286,
2187,
29918,
11965,
29892,
1480,
1169,
13,
13,
13,
1753,
2048,
29918,
18253,
29898,
1188,
1169,
29892,
22525,
1125,
13,
1678,
9995,
13,
1678,
8878,
263,
12965,
3438,
740,
29889,
13,
1678,
9995,
13,
1678,
396,
315,
3466,
4656,
10070,
6421,
515,
278,
3438,
740,
29889,
13,
1678,
1480,
1169,
353,
278,
1562,
29889,
24970,
29889,
5105,
29918,
24049,
29898,
13,
4706,
1480,
1169,
29892,
448,
29896,
29889,
334,
383,
4375,
10749,
29889,
11303,
3262,
29918,
3317,
29918,
1767,
29892,
383,
4375,
10749,
29889,
11303,
3262,
29918,
3317,
29918,
1767,
29897,
13,
13,
1678,
25383,
29918,
5721,
353,
323,
29889,
29876,
1212,
29889,
2695,
3317,
29898,
1188,
1169,
29897,
13,
13,
1678,
21544,
353,
323,
29889,
29876,
1212,
29889,
29883,
20440,
936,
29918,
19128,
296,
14441,
29898,
11965,
18186,
29918,
5721,
29892,
22525,
29897,
13,
1678,
3438,
353,
21544,
29889,
12676,
580,
13,
13,
1678,
4450,
353,
323,
29889,
1191,
3317,
29898,
1188,
1169,
29892,
9685,
29922,
29896,
29897,
13,
1678,
1035,
353,
29871,
29896,
29889,
448,
323,
29889,
12676,
29898,
29911,
29889,
4384,
29898,
29911,
29889,
10743,
29898,
11965,
29892,
22525,
511,
278,
1562,
29889,
2917,
29889,
7411,
29990,
876,
13,
13,
1678,
736,
3438,
29892,
1035,
13,
13,
13,
1753,
2048,
29918,
20543,
29918,
18253,
29898,
1188,
1169,
29892,
22525,
29892,
954,
29918,
3286,
2187,
1125,
13,
1678,
9995,
13,
1678,
8878,
263,
6088,
3158,
18988,
3438,
740,
29889,
13,
1678,
9995,
13,
13,
1678,
396,
17945,
19359,
29918,
2848,
9927,
304,
4565,
577,
393,
591,
508,
12812,
639,
5335,
342,
1022,
13,
1678,
1480,
1169,
353,
323,
29889,
26276,
1165,
267,
29898,
1188,
1169,
29892,
29871,
29900,
29892,
29871,
29896,
29897,
13,
1678,
22525,
353,
22525,
29889,
29911,
13,
13,
1678,
822,
3438,
29918,
29873,
29898,
1188,
1169,
29892,
260,
4141,
29892,
954,
29918,
3286,
2187,
1125,
13,
4706,
396,
14402,
29898,
29926,
549,
5150,
631,
1125,
323,
7202,
1623,
921,
296,
3438,
408,
591,
8469,
1549,
13,
4706,
396,
5665,
29973,
13,
4706,
25383,
29918,
5721,
353,
323,
29889,
29876,
1212,
29889,
2695,
3317,
29898,
1188,
1169,
29897,
13,
4706,
3438,
353,
323,
29889,
29876,
1212,
29889,
29883,
20440,
936,
29918,
19128,
296,
14441,
29898,
11965,
18186,
29918,
5721,
29892,
260,
4141,
29897,
13,
13,
4706,
4450,
353,
323,
29889,
1191,
3317,
29898,
1188,
1169,
29892,
9685,
29922,
29896,
29897,
13,
4706,
1059,
353,
323,
29889,
10743,
29898,
11965,
29892,
260,
4141,
29897,
13,
4706,
736,
3438,
29892,
1059,
13,
13,
1678,
2582,
29892,
903,
353,
278,
1562,
29889,
16192,
29898,
18253,
29918,
29873,
29892,
518,
1188,
1169,
29892,
22525,
1402,
1661,
29918,
6831,
2063,
11759,
1949,
29918,
3286,
2187,
2314,
13,
1678,
21544,
29892,
4436,
353,
2582,
13,
13,
1678,
396,
6204,
263,
11105,
393,
27778,
871,
1301,
2187,
393,
25135,
1855,
848,
29889,
13,
1678,
443,
22155,
29918,
2848,
353,
323,
29889,
12181,
29898,
18253,
29879,
9601,
29900,
29962,
13,
1678,
7164,
353,
443,
22155,
29918,
2848,
448,
954,
29918,
3286,
2187,
13,
1678,
7164,
353,
323,
29889,
690,
14443,
29898,
12791,
29892,
313,
29896,
29892,
448,
29896,
876,
13,
1678,
364,
865,
353,
323,
29889,
279,
927,
29898,
348,
22155,
29918,
2848,
29897,
718,
29871,
29896,
13,
1678,
364,
865,
353,
323,
29889,
690,
14443,
29898,
29878,
865,
29892,
8521,
29896,
29892,
29871,
29896,
876,
13,
1678,
11105,
353,
323,
29889,
4141,
29898,
29878,
865,
29892,
7164,
29897,
13,
13,
1678,
396,
11796,
29872,
1035,
773,
278,
11105,
13,
1678,
1035,
353,
29871,
29896,
29889,
29900,
448,
313,
29911,
29889,
2083,
29898,
12523,
334,
11105,
29892,
26688,
29922,
1552,
1562,
29889,
2917,
29889,
7411,
29990,
29897,
13,
462,
847,
323,
29889,
2083,
29898,
1949,
29918,
3286,
2187,
29892,
26688,
29922,
1552,
1562,
29889,
2917,
29889,
7411,
29990,
876,
13,
13,
1678,
396,
11796,
29872,
3438,
4153,
29892,
1951,
591,
334,
1867,
29930,
864,
263,
3438,
297,
1760,
573,
304,
679,
278,
7164,
13,
1678,
396,
1301,
2187,
1492,
29889,
13,
1678,
3438,
353,
323,
29889,
12676,
29898,
18253,
29879,
29897,
13,
1678,
736,
3438,
29892,
1035,
13,
13,
13,
1753,
14707,
29898,
14513,
29918,
9144,
29892,
19745,
29918,
842,
29892,
17927,
29892,
4331,
1125,
13,
1678,
396,
382,
4387,
403,
13,
1678,
1035,
29918,
5753,
398,
353,
29871,
29900,
29889,
29900,
13,
1678,
3158,
29918,
5753,
29918,
5753,
398,
353,
29871,
29900,
29889,
29900,
13,
1678,
19745,
29918,
16175,
267,
353,
29871,
29900,
29889,
29900,
13,
1678,
363,
313,
14513,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
3286,
2187,
29918,
16175,
29892,
19745,
29918,
29891,
29918,
16175,
29892,
19745,
29918,
1949,
29918,
3286,
2187,
29918,
16175,
29897,
297,
19745,
29918,
842,
29961,
29896,
5387,
13,
4706,
1035,
29918,
1767,
29892,
3158,
29918,
5753,
29918,
1767,
353,
19745,
29918,
9144,
29898,
13,
9651,
19745,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
3286,
2187,
29918,
16175,
29892,
13,
9651,
19745,
29918,
29891,
29918,
16175,
29892,
19745,
29918,
1949,
29918,
3286,
2187,
29918,
16175,
29892,
29871,
29900,
29889,
29900,
29892,
29871,
396,
382,
791,
4464,
29901,
3872,
29915,
29873,
3394,
5768,
449,
29889,
13,
9651,
938,
29898,
18823,
10749,
29889,
9536,
29918,
4141,
29918,
3286,
2187,
29918,
262,
29918,
14513,
511,
29871,
396,
29408,
21342,
1301,
2187,
304,
367,
1304,
5034,
304,
7353,
29889,
13,
9651,
5785,
29898,
18823,
10749,
29889,
9536,
29918,
4141,
29918,
3286,
2187,
29918,
262,
29918,
14513,
876,
29871,
396,
960,
7353,
451,
731,
29892,
1304,
21467,
23460,
13,
462,
462,
462,
4706,
396,
282,
29898,
2057,
8760,
29897,
353,
29871,
29900,
29889,
29900,
29892,
13,
462,
462,
462,
4706,
396,
1683,
5886,
282,
29898,
2057,
8760,
29897,
353,
29871,
29896,
29889,
29900,
13,
4706,
1035,
29918,
5753,
398,
4619,
1035,
29918,
1767,
13,
4706,
3158,
29918,
5753,
29918,
5753,
398,
4619,
3158,
29918,
5753,
29918,
1767,
13,
4706,
19745,
29918,
16175,
267,
4619,
29871,
29896,
29889,
29900,
13,
1678,
17927,
29889,
3403,
703,
14448,
29901,
1273,
29875,
29905,
29873,
29923,
791,
1035,
29901,
1273,
29888,
29905,
29873,
1273,
29888,
29905,
29873,
29995,
29879,
29908,
1273,
13,
795,
313,
10568,
29892,
1035,
29918,
5753,
398,
847,
19745,
29918,
16175,
267,
29892,
3158,
29918,
5753,
29918,
5753,
398,
847,
19745,
29918,
16175,
267,
29892,
19745,
29918,
842,
29961,
29900,
12622,
13,
1678,
736,
1035,
29918,
5753,
398,
847,
19745,
29918,
16175,
267,
13,
13,
13,
1753,
14707,
29918,
18837,
287,
29898,
14513,
29918,
9144,
29892,
19745,
29918,
842,
29892,
19745,
29918,
2084,
29892,
17927,
29892,
4331,
29892,
10541,
29918,
18784,
29918,
1272,
29892,
1399,
29918,
517,
29918,
1742,
29892,
8500,
29918,
3286,
2187,
1125,
13,
1678,
9995,
13,
1678,
14350,
278,
29871,
7684,
610,
29879,
267,
322,
25383,
610,
29879,
267,
297,
278,
2066,
529,
14513,
29918,
449,
29918,
2084,
15513,
29887,
430,
322,
529,
14513,
29918,
449,
29918,
2084,
15513,
29873,
303,
13,
1678,
8307,
29889,
4525,
2066,
508,
367,
2183,
408,
10970,
304,
382,
791,
29890,
304,
14707,
13755,
4180,
448,
13,
13,
4706,
19745,
29890,
448,
29886,
19745,
29890,
29918,
1028,
2559,
29889,
558,
29885,
529,
14513,
29918,
449,
29918,
2084,
15513,
29887,
430,
29871,
529,
14513,
29918,
449,
29918,
2084,
15513,
29873,
303,
13,
13,
1678,
14402,
29898,
1744,
1125,
3789,
701,
363,
390,
10262,
322,
8125,
29900,
373,
1661,
29899,
18616,
663,
29899,
18784,
848,
29936,
2011,
2304,
304,
770,
3709,
29889,
2272,
29889,
13,
1678,
9995,
13,
1678,
396,
14402,
29901,
1588,
1540,
714,
28005,
775,
29892,
1207,
502,
519,
373,
8125,
29900,
408,
1532,
29889,
13,
1678,
1035,
29918,
5753,
398,
353,
29871,
29900,
29889,
29900,
13,
1678,
3158,
29918,
5753,
29918,
5753,
398,
353,
29871,
29900,
29889,
29900,
13,
1678,
19745,
29918,
16175,
267,
353,
29871,
29900,
29889,
29900,
13,
1678,
19745,
29918,
29887,
1025,
29918,
2084,
353,
19745,
29918,
2084,
718,
11393,
29887,
430,
29908,
13,
1678,
19745,
29918,
449,
29918,
2084,
353,
19745,
29918,
2084,
718,
11393,
29873,
303,
29908,
13,
1678,
19745,
29918,
26648,
29918,
2084,
353,
19745,
29918,
2084,
718,
11393,
26648,
29908,
13,
1678,
411,
1722,
29898,
14513,
29918,
29887,
1025,
29918,
2084,
29892,
376,
29893,
1159,
408,
19745,
29918,
29887,
1025,
29892,
1722,
29898,
14513,
29918,
449,
29918,
2084,
29892,
376,
29893,
1159,
408,
19745,
29918,
449,
29901,
13,
4706,
565,
383,
4375,
10749,
29889,
3539,
29918,
11965,
18186,
29918,
1643,
29901,
13,
9651,
3858,
29918,
449,
353,
1722,
29898,
14513,
29918,
26648,
29918,
2084,
29892,
376,
29893,
1159,
13,
4706,
565,
10541,
29918,
18784,
29918,
1272,
29901,
13,
9651,
363,
313,
14513,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
3286,
2187,
29918,
16175,
29892,
19745,
29918,
29891,
29918,
16175,
29892,
13,
462,
1678,
19745,
29918,
1949,
29918,
3286,
2187,
29918,
16175,
29897,
297,
19745,
29918,
842,
29961,
29896,
5387,
13,
18884,
1035,
29918,
1767,
29892,
3158,
29918,
5753,
29918,
1767,
29892,
3031,
29918,
1188,
277,
29918,
5975,
29892,
1480,
1169,
29918,
11965,
29918,
29882,
1478,
29892,
1480,
1169,
29918,
11965,
29918,
1457,
29885,
353,
19745,
29918,
9144,
29898,
13,
462,
1678,
19745,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
3286,
2187,
29918,
16175,
29892,
19745,
29918,
29891,
29918,
16175,
29892,
19745,
29918,
1949,
29918,
3286,
2187,
29918,
16175,
29892,
13,
462,
268,
29900,
29889,
29900,
29892,
29871,
396,
382,
791,
4464,
29901,
3872,
29915,
29873,
3394,
5768,
449,
29889,
13,
462,
1678,
938,
29898,
18823,
10749,
29889,
9536,
29918,
4141,
29918,
3286,
2187,
29918,
262,
29918,
14513,
511,
29871,
396,
29408,
21342,
1301,
2187,
304,
367,
1304,
5034,
304,
7353,
29889,
13,
462,
1678,
5785,
29898,
18823,
10749,
29889,
9536,
29918,
4141,
29918,
3286,
2187,
29918,
262,
29918,
14513,
876,
396,
10365,
26401,
310,
21342,
13,
13,
18884,
1035,
29918,
5753,
398,
4619,
1035,
29918,
1767,
13,
18884,
3158,
29918,
5753,
29918,
5753,
398,
4619,
3158,
29918,
5753,
29918,
1767,
13,
18884,
19745,
29918,
16175,
267,
4619,
29871,
29896,
29889,
29900,
13,
13,
18884,
396,
2436,
1269,
25383,
9558,
304,
934,
13,
18884,
363,
1677,
29918,
3286,
2187,
29892,
4450,
29918,
1188,
277,
29918,
29882,
1478,
29892,
4450,
29918,
1188,
277,
29918,
1457,
29885,
29892,
18897,
29892,
1565,
29918,
1990,
29892,
1342,
29918,
12846,
29918,
1188,
1169,
320,
13,
462,
4706,
297,
14319,
29898,
14513,
29918,
3286,
2187,
29918,
16175,
29892,
1480,
1169,
29918,
11965,
29918,
29882,
1478,
29892,
13,
462,
1669,
1480,
1169,
29918,
11965,
29918,
1457,
29885,
29892,
19745,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
29891,
29918,
16175,
29892,
3031,
29918,
1188,
277,
29918,
5975,
1125,
13,
462,
1678,
565,
8500,
29918,
3286,
2187,
29901,
13,
462,
4706,
1677,
29918,
29882,
1478,
29918,
3286,
2187,
29892,
1677,
29918,
1457,
29885,
29918,
3286,
2187,
353,
1677,
29918,
3286,
2187,
29889,
29911,
13,
462,
4706,
4450,
29918,
29882,
1478,
29918,
3286,
2187,
353,
4450,
29918,
1188,
277,
29918,
29882,
1478,
29889,
1191,
3317,
29898,
8990,
29922,
29896,
29897,
13,
462,
4706,
4450,
29918,
1457,
29885,
29918,
3286,
2187,
353,
4450,
29918,
1188,
277,
29918,
1457,
29885,
29889,
1191,
3317,
29898,
8990,
29922,
29896,
29897,
13,
462,
1678,
1683,
29901,
13,
462,
4706,
1677,
29918,
29882,
1478,
29918,
3286,
2187,
353,
1677,
29918,
1457,
29885,
29918,
3286,
2187,
353,
4450,
29918,
29882,
1478,
29918,
3286,
2187,
353,
4450,
29918,
1457,
29885,
29918,
3286,
2187,
353,
6213,
13,
13,
462,
1678,
10163,
29918,
517,
12360,
29892,
5188,
29918,
517,
12360,
353,
18897,
29889,
29911,
13,
462,
1678,
10163,
29918,
9303,
353,
518,
513,
29918,
517,
29918,
1742,
29961,
29873,
29962,
363,
260,
297,
10163,
29918,
517,
12360,
29962,
13,
462,
1678,
5188,
29918,
9303,
353,
518,
513,
29918,
517,
29918,
1742,
29961,
29873,
29962,
363,
260,
297,
5188,
29918,
517,
12360,
29962,
13,
462,
1678,
19745,
29918,
29887,
1025,
29889,
3539,
29898,
4422,
29889,
4300,
2187,
1762,
12914,
29898,
12683,
29918,
29882,
1478,
29918,
3286,
2187,
29892,
10163,
29918,
9303,
29897,
718,
6634,
29876,
1159,
13,
462,
1678,
19745,
29918,
449,
29889,
3539,
29898,
4422,
29889,
4300,
2187,
1762,
12914,
29898,
11965,
29918,
29882,
1478,
29918,
3286,
2187,
29892,
10163,
29918,
9303,
29897,
718,
6634,
29876,
1159,
13,
462,
1678,
19745,
29918,
29887,
1025,
29889,
3539,
29898,
4422,
29889,
4300,
2187,
1762,
12914,
29898,
12683,
29918,
1457,
29885,
29918,
3286,
2187,
29892,
5188,
29918,
9303,
29897,
718,
6634,
29876,
1159,
13,
462,
1678,
19745,
29918,
449,
29889,
3539,
29898,
4422,
29889,
4300,
2187,
1762,
12914,
29898,
11965,
29918,
1457,
29885,
29918,
3286,
2187,
29892,
5188,
29918,
9303,
29897,
718,
6634,
29876,
1159,
13,
13,
462,
1678,
25383,
29918,
1990,
353,
7442,
29889,
1191,
3317,
29898,
4773,
29918,
12846,
29918,
1188,
1169,
29897,
13,
462,
1678,
1518,
29918,
1188,
277,
29918,
5975,
353,
7442,
29889,
4548,
29898,
4773,
29918,
12846,
29918,
1188,
1169,
29897,
13,
462,
1678,
770,
29918,
771,
5824,
353,
1518,
29918,
1188,
277,
29918,
5975,
847,
7442,
29889,
2083,
29898,
4548,
29918,
1188,
277,
29918,
5975,
29897,
13,
462,
1678,
770,
29918,
771,
5824,
29918,
276,
558,
353,
6634,
29873,
1642,
7122,
29898,
1958,
29898,
2892,
282,
584,
11860,
29889,
29947,
29888,
29908,
1273,
313,
29886,
29892,
511,
770,
29918,
771,
5824,
876,
13,
462,
1678,
565,
383,
4375,
10749,
29889,
3539,
29918,
11965,
18186,
29918,
1643,
29901,
13,
462,
4706,
3858,
29918,
449,
29889,
3539,
29898,
710,
29898,
3009,
29918,
1990,
1275,
25383,
29918,
1990,
29897,
718,
6634,
29873,
29908,
718,
851,
29898,
3009,
29918,
1990,
29897,
13,
462,
462,
29871,
718,
6634,
29873,
29908,
718,
851,
29898,
11965,
18186,
29918,
1990,
29897,
718,
6634,
29873,
29908,
718,
770,
29918,
771,
5824,
29918,
276,
558,
718,
6634,
29876,
1159,
13,
4706,
1683,
29901,
13,
9651,
363,
313,
14513,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
3286,
2187,
29918,
16175,
29892,
19745,
29918,
29891,
29918,
16175,
29892,
13,
462,
19745,
29918,
1949,
29918,
3286,
2187,
29918,
16175,
29897,
297,
19745,
29918,
842,
29961,
29896,
5387,
13,
18884,
1035,
29918,
1767,
29892,
3158,
29918,
5753,
29918,
1767,
29892,
3031,
29918,
1188,
277,
29918,
5975,
29892,
1480,
1169,
29918,
11965,
353,
19745,
29918,
9144,
29898,
13,
462,
1678,
19745,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
3286,
2187,
29918,
16175,
29892,
19745,
29918,
29891,
29918,
16175,
29892,
19745,
29918,
1949,
29918,
3286,
2187,
29918,
16175,
29892,
13,
462,
268,
29900,
29889,
29900,
29892,
29871,
396,
382,
791,
4464,
29901,
3872,
29915,
29873,
3394,
5768,
449,
29889,
13,
462,
1678,
938,
29898,
18823,
10749,
29889,
9536,
29918,
4141,
29918,
3286,
2187,
29918,
262,
29918,
14513,
511,
29871,
396,
29408,
21342,
1301,
2187,
304,
367,
1304,
5034,
304,
7353,
29889,
13,
462,
1678,
5785,
29898,
18823,
10749,
29889,
9536,
29918,
4141,
29918,
3286,
2187,
29918,
262,
29918,
14513,
876,
396,
10365,
26401,
310,
21342,
13,
13,
18884,
1035,
29918,
5753,
398,
4619,
1035,
29918,
1767,
13,
18884,
3158,
29918,
5753,
29918,
5753,
398,
4619,
3158,
29918,
5753,
29918,
1767,
13,
18884,
19745,
29918,
16175,
267,
4619,
29871,
29896,
29889,
29900,
13,
13,
18884,
396,
2436,
1269,
25383,
9558,
304,
934,
13,
18884,
363,
1677,
29918,
3286,
2187,
29892,
4450,
29918,
1188,
277,
29892,
18897,
29892,
1565,
29918,
1990,
29892,
1342,
29918,
12846,
29918,
1188,
1169,
320,
13,
462,
1678,
297,
14319,
29898,
14513,
29918,
3286,
2187,
29918,
16175,
29892,
1480,
1169,
29918,
11965,
29892,
19745,
29918,
29990,
29918,
16175,
29892,
19745,
29918,
29891,
29918,
16175,
29892,
3031,
29918,
1188,
277,
29918,
5975,
1125,
13,
462,
1678,
3838,
353,
518,
513,
29918,
517,
29918,
1742,
29961,
29873,
29962,
363,
260,
297,
18897,
29962,
13,
462,
1678,
19745,
29918,
29887,
1025,
29889,
3539,
29898,
4422,
29889,
4300,
2187,
1762,
12914,
29898,
12683,
29918,
3286,
2187,
29892,
3838,
29897,
718,
6634,
29876,
1159,
13,
462,
1678,
19745,
29918,
449,
29889,
3539,
29898,
4422,
29889,
4300,
2187,
1762,
12914,
29898,
11965,
29918,
1188,
277,
29889,
1191,
3317,
29898,
8990,
29922,
29896,
511,
3838,
29897,
718,
6634,
29876,
1159,
13,
13,
462,
1678,
25383,
29918,
1990,
353,
7442,
29889,
1191,
3317,
29898,
4773,
29918,
12846,
29918,
1188,
1169,
29897,
13,
462,
1678,
1518,
29918,
1188,
277,
29918,
5975,
353,
7442,
29889,
4548,
29898,
4773,
29918,
12846,
29918,
1188,
1169,
29897,
13,
462,
1678,
770,
29918,
771,
5824,
353,
1518,
29918,
1188,
277,
29918,
5975,
847,
7442,
29889,
2083,
29898,
4548,
29918,
1188,
277,
29918,
5975,
29897,
13,
462,
1678,
770,
29918,
771,
5824,
29918,
276,
558,
353,
6634,
29873,
1642,
7122,
29898,
1958,
29898,
2892,
282,
584,
11860,
29889,
29941,
29888,
29908,
1273,
313,
29886,
29892,
511,
770,
29918,
771,
5824,
876,
13,
462,
1678,
565,
383,
4375,
10749,
29889,
3539,
29918,
11965,
18186,
29918,
1643,
29901,
13,
462,
4706,
3858,
29918,
449,
29889,
3539,
29898,
710,
29898,
3009,
29918,
1990,
1275,
25383,
29918,
1990,
29897,
718,
6634,
29873,
29908,
718,
851,
29898,
3009,
29918,
1990,
29897,
13,
462,
462,
1678,
718,
6634,
29873,
29908,
718,
851,
29898,
11965,
18186,
29918,
1990,
29897,
718,
6634,
29873,
29908,
718,
770,
29918,
771,
5824,
29918,
276,
558,
718,
6634,
29876,
1159,
13,
13,
1678,
17927,
29889,
3403,
703,
29956,
20833,
7684,
610,
29879,
267,
297,
1273,
29879,
29908,
1273,
313,
14513,
29918,
29887,
1025,
29918,
2084,
876,
13,
1678,
17927,
29889,
3403,
703,
29956,
20833,
25383,
610,
29879,
267,
297,
1273,
29879,
29908,
1273,
313,
14513,
29918,
449,
29918,
2084,
876,
13,
1678,
565,
383,
4375,
10749,
29889,
3539,
29918,
11965,
18186,
29918,
1643,
29901,
13,
4706,
17927,
29889,
3403,
703,
29956,
20833,
25383,
11073,
297,
1273,
29879,
29908,
1273,
313,
14513,
29918,
26648,
29918,
2084,
876,
13,
4706,
3858,
29918,
449,
29889,
5358,
580,
13,
1678,
17927,
29889,
3403,
703,
14448,
29901,
1273,
29875,
29905,
29873,
29923,
791,
1035,
29901,
1273,
29888,
29905,
29873,
1273,
29888,
29905,
29873,
29995,
29879,
29908,
1273,
13,
1669,
313,
10568,
29892,
1035,
29918,
5753,
398,
847,
19745,
29918,
16175,
267,
29892,
3158,
29918,
5753,
29918,
5753,
398,
847,
19745,
29918,
16175,
267,
29892,
19745,
29918,
842,
29961,
29900,
12622,
13,
13,
13,
1753,
1065,
29898,
6194,
29918,
11333,
29922,
8824,
1125,
13,
1678,
17927,
353,
2511,
29879,
29918,
11177,
29918,
21707,
29889,
16363,
29898,
359,
29889,
2084,
29889,
7122,
29898,
18823,
10749,
29889,
1188,
29918,
2084,
29892,
383,
4375,
10749,
29889,
735,
15362,
29918,
978,
29897,
718,
11393,
1188,
1159,
13,
13,
1678,
565,
383,
4375,
10749,
29889,
1272,
29918,
1853,
1275,
376,
2204,
1115,
13,
4706,
848,
29918,
12847,
353,
2254,
29918,
20054,
29918,
1272,
13,
1678,
25342,
383,
4375,
10749,
29889,
1272,
29918,
1853,
1275,
376,
29879,
303,
1115,
13,
4706,
848,
29918,
12847,
353,
2254,
29918,
29879,
303,
29918,
1272,
13,
1678,
25342,
383,
4375,
10749,
29889,
1272,
29918,
1853,
1275,
376,
16586,
492,
1115,
13,
4706,
848,
29918,
12847,
353,
2254,
29918,
16586,
492,
29918,
1272,
13,
1678,
1683,
29901,
13,
4706,
17927,
29889,
3403,
703,
22050,
848,
1134,
23157,
13,
4706,
736,
13,
13,
1678,
6499,
353,
282,
2158,
29889,
6572,
4349,
4040,
1639,
29898,
12860,
29922,
29946,
29897,
13,
1678,
17927,
29889,
3403,
703,
21979,
1819,
3583,
29876,
29908,
718,
6499,
29889,
29886,
4830,
29898,
18823,
10749,
29889,
21979,
9065,
21533,
22130,
13,
13,
1678,
396,
16012,
278,
848,
29889,
13,
1678,
10650,
29918,
26495,
29918,
1272,
29892,
7931,
370,
352,
653,
353,
848,
29918,
12847,
29889,
1359,
29918,
1272,
29898,
13,
4706,
383,
4375,
10749,
29889,
26495,
29918,
1272,
29918,
2084,
29897,
13,
13,
1678,
396,
16012,
278,
19745,
848,
29889,
13,
1678,
10650,
29918,
14513,
29918,
7224,
353,
5159,
13,
1678,
565,
383,
4375,
10749,
29889,
14513,
29918,
1272,
29918,
2084,
29901,
13,
4706,
363,
19745,
29918,
9507,
297,
383,
4375,
10749,
29889,
14513,
29918,
1272,
29918,
2084,
29889,
5451,
703,
6160,
1125,
13,
9651,
19745,
29918,
1272,
29892,
903,
353,
848,
29918,
12847,
29889,
1359,
29918,
1272,
29898,
14513,
29918,
9507,
29897,
13,
9651,
10650,
29918,
14513,
29918,
7224,
29889,
4397,
3552,
14513,
29918,
9507,
29892,
19745,
29918,
1272,
876,
13,
13,
1678,
396,
349,
3445,
598,
278,
7931,
370,
352,
653,
29889,
13,
1678,
565,
451,
7931,
370,
352,
653,
29901,
13,
4706,
17927,
29889,
3403,
703,
797,
1722,
7931,
370,
352,
653,
4464,
29889,
5293,
7500,
8297,
29881,
886,
1728,
2691,
29899,
29873,
27964,
23157,
13,
4706,
7945,
29918,
17987,
29881,
886,
353,
7700,
13,
4706,
7931,
370,
352,
653,
353,
3667,
29889,
8893,
29963,
542,
370,
352,
653,
29898,
13,
9651,
10650,
29918,
26495,
29918,
1272,
29892,
10650,
29918,
14513,
29918,
7224,
29892,
383,
4375,
10749,
29889,
17987,
8497,
29918,
1272,
29918,
2084,
29892,
17927,
29922,
21707,
29892,
13,
9651,
10541,
29918,
18784,
29918,
1272,
29922,
1272,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
29897,
13,
1678,
1683,
29901,
13,
4706,
17927,
29889,
3403,
703,
797,
4343,
7931,
370,
352,
653,
4464,
29889,
26101,
8297,
29881,
886,
23157,
13,
4706,
7945,
29918,
17987,
29881,
886,
353,
5852,
13,
13,
1678,
396,
16012,
758,
3018,
1312,
8297,
29881,
886,
29889,
13,
1678,
565,
383,
4375,
10749,
29889,
17987,
8497,
29918,
1272,
29918,
2084,
29901,
13,
4706,
17927,
29889,
3403,
703,
23456,
7931,
370,
352,
653,
411,
376,
718,
851,
29898,
2435,
29898,
29894,
542,
370,
352,
653,
876,
13,
462,
259,
718,
376,
3838,
515,
376,
718,
383,
4375,
10749,
29889,
17987,
8497,
29918,
1272,
29918,
2084,
29897,
13,
4706,
2847,
29918,
17987,
29881,
886,
353,
3667,
29889,
5896,
6026,
2580,
29881,
886,
4591,
28599,
2687,
29898,
13,
9651,
7931,
370,
352,
653,
29892,
383,
4375,
10749,
29889,
1742,
29918,
17987,
8497,
29918,
6229,
29892,
383,
4375,
10749,
29889,
17987,
8497,
29918,
1272,
29918,
2084,
29897,
13,
1678,
1683,
29901,
13,
4706,
2847,
29918,
17987,
29881,
886,
353,
6213,
13,
13,
1678,
396,
1605,
326,
8783,
29892,
3588,
5993,
15602,
304,
6043,
15602,
29892,
274,
1336,
29892,
322,
13,
1678,
396,
17132,
29889,
13,
1678,
17927,
29889,
3403,
703,
6572,
19170,
6694,
848,
23157,
13,
1678,
6694,
29918,
1272,
353,
3667,
29889,
6572,
5014,
16390,
24541,
29898,
13,
4706,
10650,
29918,
26495,
29918,
1272,
29892,
7931,
370,
352,
653,
29892,
383,
4375,
10749,
29889,
11762,
29918,
2848,
29892,
848,
29918,
12847,
29892,
19745,
29918,
8513,
29922,
8824,
29892,
17927,
29922,
21707,
29892,
13,
4706,
10541,
29918,
18784,
29918,
1272,
29922,
1272,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
29892,
13,
4706,
363,
29918,
29878,
15755,
29922,
18823,
10749,
29889,
4299,
29918,
1853,
1275,
376,
29934,
10262,
29908,
470,
383,
4375,
10749,
29889,
4299,
29918,
1853,
1275,
376,
29907,
8456,
29956,
1159,
13,
1678,
6694,
29918,
1272,
29918,
1524,
353,
3667,
29889,
9984,
5323,
2827,
20277,
29898,
13,
4706,
6694,
29918,
1272,
29892,
383,
4375,
10749,
29889,
16175,
29918,
2311,
29897,
13,
13,
1678,
19745,
29918,
1524,
4097,
353,
5159,
13,
1678,
363,
10422,
29892,
10650,
29918,
14513,
29918,
842,
297,
10650,
29918,
14513,
29918,
7224,
29901,
13,
4706,
17927,
29889,
3403,
703,
6572,
19170,
19745,
848,
29901,
376,
718,
10422,
29897,
13,
4706,
321,
29918,
29990,
29892,
321,
29918,
3286,
2187,
29892,
321,
29918,
29891,
29892,
321,
29918,
1949,
29918,
3286,
2187,
353,
3667,
29889,
6572,
5014,
16390,
24541,
29898,
13,
9651,
10650,
29918,
14513,
29918,
842,
29892,
7931,
370,
352,
653,
29892,
383,
4375,
10749,
29889,
11762,
29918,
2848,
29892,
848,
29918,
12847,
29892,
19745,
29918,
8513,
29922,
5574,
29892,
17927,
29922,
21707,
29892,
13,
9651,
10541,
29918,
18784,
29918,
1272,
29922,
1272,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
29892,
13,
9651,
363,
29918,
29878,
15755,
29922,
18823,
10749,
29889,
4299,
29918,
1853,
1275,
376,
29934,
10262,
29908,
470,
383,
4375,
10749,
29889,
4299,
29918,
1853,
1275,
376,
29907,
8456,
29956,
1159,
13,
4706,
19745,
29918,
1524,
4097,
29889,
4397,
3552,
9507,
29892,
13,
9651,
3667,
29889,
9984,
29923,
791,
20277,
3552,
29872,
29918,
29990,
29892,
321,
29918,
3286,
2187,
29892,
321,
29918,
29891,
29892,
321,
29918,
1949,
29918,
3286,
2187,
511,
383,
4375,
10749,
29889,
16175,
29918,
2311,
4961,
13,
13,
1678,
396,
3789,
701,
278,
2058,
8948,
414,
29889,
13,
13,
1678,
343,
353,
323,
29889,
8111,
703,
29891,
613,
26688,
543,
524,
29941,
29906,
1159,
13,
1678,
301,
29878,
353,
323,
29889,
19529,
279,
703,
29212,
1159,
13,
1678,
6694,
29918,
8513,
353,
323,
29889,
19529,
279,
703,
26495,
29918,
8513,
1159,
29871,
396,
29871,
29896,
29901,
26101,
411,
5768,
449,
29892,
29871,
29900,
29901,
382,
791,
13,
1678,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
353,
323,
29889,
19529,
279,
703,
2057,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
613,
26688,
543,
524,
29941,
29906,
1159,
13,
13,
1678,
17927,
29889,
3403,
703,
8893,
292,
1904,
23157,
13,
1678,
7186,
353,
3667,
29889,
16174,
9044,
29898,
13,
4706,
2322,
29918,
11228,
3950,
29922,
4422,
29889,
2525,
5560,
15514,
3950,
29898,
18823,
10749,
29889,
2344,
29918,
3881,
511,
17927,
29922,
21707,
29897,
13,
13,
1678,
565,
383,
4375,
10749,
29889,
4299,
29918,
1853,
1275,
376,
29907,
8456,
29956,
1115,
13,
4706,
1904,
29918,
25932,
353,
805,
2559,
29889,
10702,
340,
29889,
29907,
8456,
29956,
13,
1678,
25342,
383,
4375,
10749,
29889,
4299,
29918,
1853,
1275,
376,
29934,
10262,
1115,
13,
4706,
1904,
29918,
25932,
353,
805,
2559,
29889,
24595,
29918,
29878,
15755,
29889,
29934,
10262,
13,
1678,
1683,
29901,
13,
4706,
1904,
29918,
25932,
353,
679,
5552,
29898,
1028,
2559,
29889,
29888,
271,
29918,
1429,
29892,
383,
4375,
10749,
29889,
4299,
29918,
1853,
29897,
13,
13,
1678,
396,
3251,
1061,
310,
11105,
363,
21467,
23460,
13,
1678,
12655,
29918,
8172,
353,
7442,
29889,
8172,
29889,
17875,
2792,
29898,
29896,
29906,
29941,
29946,
29897,
13,
1678,
17971,
29918,
13168,
29918,
1885,
353,
323,
29889,
12366,
29918,
8172,
5461,
29879,
29889,
17875,
3835,
29879,
29898,
23749,
29918,
8172,
29889,
9502,
524,
29898,
29929,
29929,
29929,
29929,
29929,
29929,
876,
13,
13,
1678,
396,
26101,
4331,
1353,
13,
1678,
17971,
29918,
22795,
353,
323,
29889,
19529,
279,
703,
893,
29918,
22795,
1159,
13,
13,
1678,
565,
848,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
29901,
13,
4706,
1060,
353,
323,
29889,
277,
6073,
29941,
703,
29990,
1159,
13,
4706,
1301,
2187,
353,
323,
29889,
277,
6073,
29941,
703,
3286,
2187,
1159,
13,
4706,
954,
29918,
3286,
2187,
353,
323,
29889,
15840,
2126,
703,
1949,
29918,
3286,
2187,
1159,
13,
13,
4706,
25383,
29918,
1457,
29885,
895,
29918,
3286,
2187,
29892,
25383,
29918,
29882,
1478,
720,
6656,
29918,
3286,
2187,
29892,
1480,
1169,
353,
2048,
29918,
18616,
663,
29918,
18784,
29918,
4299,
29898,
13,
9651,
1904,
29918,
25932,
29892,
7431,
29898,
29894,
542,
370,
352,
653,
511,
383,
4375,
10749,
29889,
11762,
29918,
2848,
29892,
13,
9651,
1060,
29892,
1301,
2187,
29892,
7431,
29898,
1272,
29918,
12847,
29889,
24461,
6670,
29918,
23827,
511,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
7186,
29892,
13,
9651,
2847,
29918,
17987,
29881,
886,
29922,
11228,
29918,
17987,
29881,
886,
29892,
2060,
29918,
17987,
29881,
886,
7607,
1333,
7945,
29918,
17987,
29881,
886,
511,
13,
9651,
17971,
29918,
13168,
29918,
1885,
29922,
893,
29918,
13168,
29918,
1885,
29892,
13,
9651,
17971,
29918,
22795,
29922,
893,
29918,
22795,
29897,
13,
1678,
1683,
29901,
13,
4706,
1060,
353,
323,
29889,
5344,
703,
29990,
613,
26688,
543,
524,
29941,
29906,
1159,
13,
4706,
1301,
2187,
353,
323,
29889,
15840,
2126,
703,
3286,
2187,
1159,
13,
4706,
954,
29918,
3286,
2187,
353,
323,
29889,
8111,
703,
1949,
29918,
3286,
2187,
613,
26688,
543,
524,
29941,
29906,
1159,
13,
13,
4706,
25383,
29918,
3286,
2187,
29892,
1480,
1169,
353,
2048,
29918,
18616,
663,
29918,
4299,
29898,
13,
9651,
1904,
29918,
25932,
29892,
7431,
29898,
29894,
542,
370,
352,
653,
511,
383,
4375,
10749,
29889,
11762,
29918,
2848,
29892,
13,
9651,
1060,
29892,
1301,
2187,
29892,
7431,
29898,
1272,
29918,
12847,
29889,
24461,
6670,
29918,
23827,
511,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
7186,
29892,
13,
9651,
2847,
29918,
17987,
29881,
886,
29922,
11228,
29918,
17987,
29881,
886,
29892,
2060,
29918,
17987,
29881,
886,
7607,
1333,
7945,
29918,
17987,
29881,
886,
511,
13,
9651,
17971,
29918,
13168,
29918,
1885,
29922,
893,
29918,
13168,
29918,
1885,
29892,
13,
9651,
17971,
29918,
22795,
29922,
893,
29918,
22795,
29897,
13,
13,
1678,
921,
296,
29918,
18253,
29892,
1035,
353,
2048,
29918,
18253,
29898,
1188,
1169,
29892,
343,
29897,
13,
13,
1678,
396,
3789,
701,
365,
29906,
4943,
2133,
29889,
13,
1678,
301,
29906,
29918,
18253,
353,
29871,
29900,
29889,
29900,
13,
1678,
363,
722,
297,
7186,
29889,
14968,
519,
29918,
16908,
29901,
13,
4706,
301,
29906,
29918,
18253,
4619,
383,
4375,
10749,
29889,
29880,
29906,
29918,
2892,
334,
323,
29889,
2083,
29898,
29911,
29889,
3044,
29878,
29898,
4270,
29889,
16908,
29961,
1707,
12622,
13,
13,
1678,
396,
11796,
29872,
4891,
29899,
296,
14441,
3438,
373,
3158,
27303,
29889,
13,
1678,
565,
313,
1333,
848,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
29897,
322,
383,
4375,
10749,
29889,
4299,
29918,
1853,
451,
297,
6796,
3195,
29900,
613,
376,
29934,
10262,
613,
376,
29907,
8456,
29956,
3108,
29901,
13,
4706,
9558,
29918,
18253,
29892,
3158,
29918,
5753,
353,
2048,
29918,
20543,
29918,
18253,
29898,
11965,
18186,
29918,
3286,
2187,
29892,
1301,
2187,
29892,
954,
29918,
3286,
2187,
29897,
13,
1678,
25342,
848,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
322,
383,
4375,
10749,
29889,
4299,
29918,
1853,
451,
297,
6796,
3195,
29900,
613,
376,
29934,
10262,
613,
376,
29907,
8456,
29956,
3108,
29901,
13,
4706,
282,
29918,
20543,
29918,
18253,
29892,
282,
29918,
2467,
29918,
5753,
353,
2048,
29918,
20543,
29918,
18253,
29898,
11965,
18186,
29918,
1457,
29885,
895,
29918,
3286,
2187,
29892,
1301,
2187,
7503,
29892,
584,
29892,
29871,
29900,
1402,
13,
9651,
954,
29918,
3286,
2187,
7503,
29892,
29871,
29900,
2314,
13,
4706,
298,
29918,
20543,
29918,
18253,
29892,
298,
29918,
2467,
29918,
5753,
353,
2048,
29918,
20543,
29918,
18253,
29898,
11965,
18186,
29918,
29882,
1478,
720,
6656,
29918,
3286,
2187,
29892,
1301,
2187,
7503,
29892,
584,
29892,
29871,
29896,
1402,
13,
9651,
954,
29918,
3286,
2187,
7503,
29892,
29871,
29896,
2314,
13,
4706,
9558,
29918,
18253,
353,
282,
29918,
20543,
29918,
18253,
718,
298,
29918,
20543,
29918,
18253,
13,
4706,
3158,
29918,
5753,
353,
313,
29886,
29918,
2467,
29918,
5753,
718,
298,
29918,
2467,
29918,
5753,
29897,
847,
29871,
29906,
29889,
29900,
29871,
396,
14402,
29898,
1744,
1125,
319,
19698,
975,
1301,
2187,
29892,
451,
3838,
29889,
13,
1678,
1683,
29901,
13,
4706,
9558,
29918,
18253,
353,
323,
29889,
23362,
29898,
29900,
29889,
29900,
29897,
13,
4706,
3158,
29918,
5753,
353,
323,
29889,
23362,
29898,
29900,
29889,
29900,
29897,
13,
1678,
9558,
29918,
18253,
353,
9558,
29918,
18253,
334,
383,
4375,
10749,
29889,
20543,
29918,
18253,
29918,
7052,
13,
13,
1678,
3001,
29918,
18253,
353,
921,
296,
29918,
18253,
718,
301,
29906,
29918,
18253,
718,
9558,
29918,
18253,
13,
13,
1678,
565,
11393,
384,
415,
29908,
297,
383,
4375,
10749,
29889,
384,
415,
29918,
2084,
29901,
13,
4706,
1423,
3149,
29918,
2084,
353,
383,
4375,
10749,
29889,
384,
415,
29918,
2084,
13,
1678,
1683,
29901,
13,
4706,
1423,
3149,
29918,
2084,
353,
2897,
29889,
2084,
29889,
7122,
29898,
18823,
10749,
29889,
384,
415,
29918,
2084,
29892,
383,
4375,
10749,
29889,
735,
15362,
29918,
978,
718,
11393,
384,
415,
1159,
13,
1678,
565,
2897,
29889,
2084,
29889,
275,
1445,
29898,
3198,
3149,
29918,
2084,
1125,
13,
4706,
17927,
29889,
3403,
703,
9692,
1423,
3149,
29892,
1791,
8253,
23157,
13,
4706,
4331,
29892,
1900,
29918,
3359,
29918,
2704,
353,
7186,
29889,
1359,
29918,
3198,
3149,
29898,
3198,
3149,
29918,
2084,
29892,
954,
29918,
17833,
29918,
16908,
29922,
29906,
29892,
13,
462,
462,
462,
29871,
14383,
29918,
17314,
29918,
6948,
485,
1849,
29922,
18823,
10749,
29889,
11014,
29918,
17314,
29918,
6948,
485,
1849,
29897,
13,
1678,
1683,
29901,
13,
4706,
4974,
451,
871,
29918,
11333,
29892,
376,
6028,
29915,
29873,
1065,
385,
19745,
29899,
6194,
1065,
1728,
263,
1423,
3149,
29889,
9179,
368,
263,
1423,
3149,
1213,
13,
4706,
4331,
353,
29871,
29900,
13,
4706,
1900,
29918,
3359,
29918,
2704,
353,
29871,
29896,
29889,
29900,
13,
13,
1678,
396,
1938,
385,
17983,
29899,
6194,
1065,
29889,
13,
1678,
565,
871,
29918,
11333,
29901,
13,
4706,
565,
383,
4375,
10749,
29889,
14513,
29918,
4905,
29918,
24772,
29901,
13,
9651,
19745,
29918,
4905,
29918,
24772,
353,
383,
4375,
10749,
29889,
14513,
29918,
4905,
29918,
24772,
29889,
17010,
2141,
5451,
703,
29901,
1159,
13,
9651,
4974,
7431,
29898,
14513,
29918,
4905,
29918,
24772,
29897,
1275,
7431,
29898,
14513,
29918,
1524,
4097,
511,
376,
13919,
694,
29889,
310,
1962,
10898,
1213,
13,
4706,
1683,
29901,
13,
9651,
19745,
29918,
4905,
29918,
24772,
353,
518,
18823,
10749,
29889,
735,
15362,
29918,
978,
718,
11663,
29908,
718,
2897,
29889,
2084,
29889,
5451,
29898,
14513,
29918,
842,
29961,
29900,
2314,
29961,
29896,
29962,
718,
11663,
5510,
29908,
13,
462,
462,
29871,
363,
19745,
29918,
842,
297,
19745,
29918,
1524,
4097,
29962,
13,
13,
4706,
396,
16012,
1904,
515,
1423,
3149,
29889,
13,
4706,
17927,
29889,
3403,
703,
5596,
3149,
287,
1904,
471,
16370,
363,
1273,
29881,
6576,
1213,
1273,
313,
10568,
29892,
876,
13,
13,
4706,
396,
3251,
403,
740,
363,
6375,
1209,
29889,
13,
4706,
17927,
29889,
3403,
703,
8893,
292,
6375,
1209,
23157,
13,
4706,
565,
848,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
29901,
13,
9651,
19745,
29918,
9144,
353,
278,
1562,
29889,
2220,
29898,
13,
18884,
518,
29990,
29892,
1301,
2187,
29892,
343,
29892,
954,
29918,
3286,
2187,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
17971,
29918,
22795,
1402,
13,
18884,
518,
5753,
29892,
3158,
29918,
5753,
29892,
1480,
1169,
29892,
25383,
29918,
29882,
1478,
720,
6656,
29918,
3286,
2187,
29892,
25383,
29918,
1457,
29885,
895,
29918,
3286,
2187,
1402,
13,
18884,
373,
29918,
348,
3880,
29918,
2080,
2433,
17281,
742,
13,
18884,
2758,
29918,
2080,
29918,
3204,
4384,
29922,
5574,
29897,
13,
4706,
1683,
29901,
13,
9651,
19745,
29918,
9144,
353,
278,
1562,
29889,
2220,
29898,
13,
18884,
518,
29990,
29892,
1301,
2187,
29892,
343,
29892,
954,
29918,
3286,
2187,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
17971,
29918,
22795,
1402,
13,
18884,
518,
5753,
29892,
3158,
29918,
5753,
29892,
1480,
1169,
29892,
25383,
29918,
3286,
2187,
1402,
13,
18884,
373,
29918,
348,
3880,
29918,
2080,
2433,
17281,
742,
13,
18884,
2758,
29918,
2080,
29918,
3204,
4384,
29922,
5574,
29897,
13,
13,
4706,
396,
3251,
403,
278,
16402,
7931,
370,
352,
653,
16280,
1591,
29889,
13,
4706,
1399,
29918,
517,
29918,
1742,
353,
426,
29894,
584,
413,
363,
413,
29892,
325,
297,
7931,
370,
352,
653,
29889,
1524,
7076,
28296,
13,
13,
4706,
396,
1938,
263,
6375,
1209,
322,
2436,
278,
1962,
304,
8086,
29889,
13,
4706,
363,
19745,
29918,
842,
29892,
19745,
29918,
449,
29918,
2084,
297,
14319,
29898,
14513,
29918,
1524,
4097,
29892,
19745,
29918,
4905,
29918,
24772,
1125,
13,
9651,
17927,
29889,
3403,
703,
29956,
768,
292,
19745,
1962,
363,
1273,
29879,
1213,
1273,
313,
14513,
29918,
842,
29961,
29900,
1402,
876,
13,
9651,
14707,
29918,
18837,
287,
29898,
14513,
29918,
9144,
29892,
19745,
29918,
842,
29892,
19745,
29918,
449,
29918,
2084,
29892,
17927,
29892,
4331,
29892,
13,
462,
795,
848,
29918,
12847,
29889,
29903,
3919,
1430,
4741,
29918,
7228,
8193,
29918,
14573,
29892,
1399,
29918,
517,
29918,
1742,
29892,
383,
4375,
10749,
29889,
4299,
29918,
1853,
451,
297,
6796,
3195,
29900,
613,
376,
29934,
10262,
613,
376,
29907,
8456,
29956,
20068,
13,
1678,
1683,
29901,
13,
308,
396,
28186,
13,
13,
4706,
716,
29918,
5975,
353,
3667,
29889,
29934,
4345,
7728,
29898,
7827,
29918,
18253,
29892,
7186,
29889,
14968,
519,
29918,
16908,
29889,
5975,
3285,
301,
29878,
29897,
13,
4706,
716,
29918,
5975,
4619,
17288,
1989,
29892,
7186,
29889,
29876,
549,
3665,
993,
29918,
786,
15190,
29961,
1989,
2314,
363,
1820,
297,
7186,
29889,
29876,
549,
3665,
993,
29918,
786,
15190,
29962,
13,
4706,
396,
26101,
1722,
29899,
29894,
542,
370,
352,
653,
8297,
29881,
886,
338,
263,
1139,
519,
2969,
1492,
1286,
29889,
3295,
3606,
29901,
13,
4706,
396,
716,
29918,
5975,
29889,
4397,
29898,
13,
4706,
396,
268,
3667,
29889,
17987,
8497,
29918,
26016,
29928,
29898,
7827,
29918,
18253,
29892,
23655,
29918,
7529,
29892,
23655,
29918,
29212,
876,
13,
13,
4706,
396,
6204,
6694,
322,
19745,
3168,
29889,
13,
4706,
396,
853,
3880,
2286,
18116,
526,
480,
13120,
577,
393,
954,
29918,
3286,
2187,
508,
367,
4502,
297,
746,
6694,
8125,
29871,
29900,
29892,
13,
4706,
396,
607,
5330,
2361,
372,
29889,
910,
17498,
901,
19909,
775,
393,
338,
1407,
10029,
20312,
29889,
13,
4706,
17927,
29889,
3403,
703,
8893,
292,
2767,
740,
23157,
13,
4706,
2767,
29918,
9144,
353,
278,
1562,
29889,
2220,
29898,
13,
9651,
518,
29990,
29892,
1301,
2187,
29892,
343,
29892,
954,
29918,
3286,
2187,
29892,
301,
29878,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
17971,
29918,
22795,
1402,
13,
9651,
518,
7827,
29918,
18253,
29892,
921,
296,
29918,
18253,
29892,
9558,
29918,
18253,
29892,
3158,
29918,
5753,
29892,
301,
29906,
29918,
18253,
29892,
1035,
1402,
13,
9651,
11217,
29922,
1482,
29918,
5975,
29892,
13,
9651,
373,
29918,
348,
3880,
29918,
2080,
2433,
17281,
742,
13,
9651,
2758,
29918,
2080,
29918,
3204,
4384,
29922,
5574,
29897,
13,
4706,
17927,
29889,
3403,
703,
8893,
292,
19745,
740,
23157,
13,
4706,
19745,
29918,
9144,
353,
278,
1562,
29889,
2220,
4197,
29990,
29892,
1301,
2187,
29892,
343,
29892,
954,
29918,
3286,
2187,
29892,
6694,
29918,
8513,
29892,
5962,
29918,
509,
2806,
29918,
3286,
2187,
29918,
12872,
29892,
17971,
29918,
22795,
1402,
518,
5753,
29892,
3158,
29918,
5753,
1402,
13,
9651,
373,
29918,
348,
3880,
29918,
2080,
2433,
17281,
742,
13,
9651,
2758,
29918,
2080,
29918,
3204,
4384,
29922,
5574,
29897,
13,
4706,
17927,
29889,
3403,
703,
5323,
2827,
23157,
13,
13,
4706,
396,
4241,
6694,
2425,
29889,
13,
4706,
363,
4331,
297,
3464,
29898,
10568,
29892,
383,
4375,
10749,
29889,
26495,
29918,
24530,
1125,
13,
9651,
565,
4331,
1273,
383,
4375,
10749,
29889,
14513,
29918,
19207,
29918,
24530,
1275,
29871,
29900,
29901,
13,
18884,
363,
2380,
29892,
19745,
29918,
842,
297,
26985,
29898,
14513,
29918,
1524,
4097,
1125,
13,
462,
1678,
1035,
353,
14707,
29898,
14513,
29918,
9144,
29892,
19745,
29918,
842,
29892,
17927,
29892,
4331,
29897,
13,
462,
1678,
565,
383,
4375,
10749,
29889,
384,
415,
29918,
265,
29918,
13318,
29918,
3359,
29918,
2704,
322,
2380,
1275,
29871,
29900,
322,
313,
29896,
448,
1035,
29897,
529,
29871,
29900,
29889,
29929,
29929,
334,
1900,
29918,
3359,
29918,
2704,
322,
4331,
1405,
29871,
29896,
29900,
29900,
29900,
29901,
13,
462,
4706,
1900,
29918,
3359,
29918,
2704,
353,
29871,
29896,
448,
1035,
13,
462,
4706,
17927,
29889,
3403,
703,
5596,
3149,
292,
411,
716,
1900,
2906,
13600,
310,
1273,
29888,
29908,
1273,
1035,
29897,
13,
462,
4706,
7186,
29889,
7620,
29918,
3198,
3149,
29898,
3198,
3149,
29918,
2084,
718,
11119,
13318,
613,
4805,
29918,
16908,
11759,
10568,
29892,
1900,
29918,
3359,
29918,
2704,
2314,
13,
13,
9651,
1060,
29918,
16175,
29892,
1301,
2187,
29918,
16175,
29892,
343,
29918,
16175,
29892,
954,
29918,
3286,
2187,
29918,
16175,
353,
6694,
29918,
1272,
29918,
1524,
29889,
4622,
580,
13,
9651,
6509,
29918,
10492,
353,
383,
4375,
10749,
29889,
21891,
29918,
10492,
334,
313,
18823,
10749,
29889,
21891,
29918,
10492,
29918,
7099,
388,
29918,
546,
29918,
29896,
29900,
29895,
29918,
24530,
3579,
313,
10568,
847,
29871,
29896,
29900,
29900,
29900,
29900,
29889,
29900,
876,
13,
9651,
3240,
353,
2767,
29918,
9144,
29898,
29990,
29918,
16175,
29892,
1301,
2187,
29918,
16175,
29892,
343,
29918,
16175,
29892,
954,
29918,
3286,
2187,
29918,
16175,
29892,
13,
462,
9651,
6509,
29918,
10492,
29892,
29871,
29896,
29889,
29900,
29892,
29871,
29896,
29889,
29900,
29892,
7442,
29889,
4548,
29898,
10568,
29930,
9302,
29889,
1188,
29898,
18823,
10749,
29889,
816,
14989,
29918,
13445,
10335,
29918,
735,
3296,
29918,
3188,
4961,
13,
9651,
3001,
29918,
18253,
29918,
791,
29892,
921,
296,
29918,
18253,
29918,
791,
29892,
9558,
29918,
18253,
29918,
791,
29892,
3158,
29918,
5753,
29918,
791,
29892,
301,
29906,
29918,
18253,
29918,
791,
29892,
1035,
29918,
791,
353,
3240,
13,
13,
9651,
565,
4331,
1273,
383,
4375,
10749,
29889,
6112,
6765,
29918,
19207,
29918,
24530,
1275,
29871,
29900,
29901,
13,
18884,
17927,
29889,
3403,
29898,
13,
462,
1678,
376,
14448,
29901,
1273,
29875,
29905,
29873,
7504,
29901,
1273,
29888,
29905,
29873,
29995,
29888,
29905,
29873,
25733,
29901,
1273,
29945,
29888,
1273,
29945,
29888,
1273,
29945,
29888,
1273,
29945,
29888,
29908,
13,
462,
1678,
1273,
313,
10568,
29892,
1035,
29918,
791,
29892,
3158,
29918,
5753,
29918,
791,
29892,
3001,
29918,
18253,
29918,
791,
29892,
921,
296,
29918,
18253,
29918,
791,
29892,
9558,
29918,
18253,
29918,
791,
29892,
13,
462,
539,
301,
29906,
29918,
18253,
29918,
791,
876,
13,
13,
9651,
565,
4331,
1273,
383,
4375,
10749,
29889,
384,
415,
29918,
19207,
29918,
24530,
1275,
29871,
29900,
322,
4331,
1405,
29871,
29900,
29901,
13,
18884,
7186,
29889,
7620,
29918,
3198,
3149,
29898,
3198,
3149,
29918,
2084,
29892,
4805,
29918,
16908,
11759,
10568,
29892,
1900,
29918,
3359,
29918,
2704,
2314,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
396,
1222,
15362,
22006,
29889,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
1807,
703,
735,
15362,
29918,
978,
613,
376,
735,
15362,
613,
20569,
13,
13,
1678,
396,
3630,
4072,
29889,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
18605,
703,
1272,
29918,
1853,
613,
376,
2204,
613,
6796,
2204,
613,
376,
29879,
303,
613,
376,
16586,
492,
12436,
13,
4706,
376,
8809,
436,
848,
7834,
322,
770,
3709,
304,
671,
23157,
13,
13,
1678,
396,
6804,
304,
3787,
1423,
9748,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
1807,
703,
384,
415,
29918,
2084,
613,
11393,
613,
376,
11921,
304,
4078,
29914,
1359,
1423,
9748,
29889,
1815,
367,
2845,
376,
13,
4706,
376,
29874,
10422,
470,
263,
3884,
29889,
512,
278,
7480,
1206,
29892,
278,
7639,
1024,
19700,
408,
278,
376,
13,
4706,
376,
3188,
363,
278,
10422,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
1807,
703,
1188,
29918,
2084,
613,
11393,
613,
376,
29909,
3884,
297,
607,
304,
2436,
10748,
23157,
13,
13,
1678,
396,
3630,
6055,
29889,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
1807,
703,
26495,
29918,
1272,
29918,
2084,
613,
6213,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
1807,
703,
14513,
29918,
1272,
29918,
2084,
613,
6213,
29892,
376,
6028,
1712,
2999,
934,
10898,
29892,
13055,
376,
13,
4706,
376,
4746,
525,
11283,
18897,
29889,
450,
937,
934,
881,
367,
278,
2906,
731,
29892,
322,
338,
1304,
363,
3683,
2827,
376,
13,
4706,
376,
8256,
304,
4078,
278,
4688,
25480,
525,
13318,
29915,
1423,
9748,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
11762,
29918,
2848,
613,
29871,
29941,
29900,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
14513,
29918,
11762,
29918,
2848,
613,
29871,
29941,
29900,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
1807,
703,
17987,
8497,
29918,
1272,
29918,
2084,
613,
6213,
29892,
13,
4706,
376,
3644,
731,
29892,
2254,
21806,
29963,
29872,
29899,
689,
19667,
8297,
29881,
886,
515,
1244,
23157,
13,
13,
1678,
396,
8125,
11258,
6055,
29889,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
18605,
703,
4299,
29918,
1853,
613,
376,
3195,
29900,
613,
13,
462,
539,
6796,
29907,
8456,
29956,
613,
376,
29934,
10262,
613,
376,
3195,
29900,
613,
376,
3195,
29896,
613,
376,
3195,
29906,
613,
376,
3195,
29906,
29903,
12436,
13,
462,
539,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
9536,
29918,
4141,
29918,
3286,
2187,
29918,
262,
29918,
14513,
613,
7700,
29892,
13,
4706,
376,
8809,
1979,
304,
671,
5962,
8760,
1301,
2187,
297,
17983,
746,
8210,
376,
13,
4706,
18227,
29875,
29889,
29872,
1696,
297,
8125,
29871,
29896,
322,
8125,
29871,
29906,
29903,
1846,
1159,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
4299,
29918,
6229,
613,
29871,
29947,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
1742,
29918,
17987,
8497,
29918,
6229,
613,
29871,
29947,
29892,
20569,
13,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
11294,
292,
29918,
20155,
29885,
29918,
10892,
29918,
6229,
613,
29871,
29946,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
1509,
29918,
11294,
292,
29918,
20155,
29885,
613,
5852,
29892,
13,
462,
3986,
376,
8809,
1979,
304,
671,
365,
1254,
29924,
297,
278,
23110,
5190,
1159,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
27711,
29918,
1509,
29918,
3729,
613,
7700,
29892,
13,
462,
3986,
376,
2831,
4733,
607,
8500,
13812,
8820,
29892,
671,
376,
13,
462,
3986,
376,
20313,
278,
23110,
365,
1254,
29924,
7934,
322,
3038,
1819,
408,
376,
13,
462,
3986,
376,
2080,
304,
278,
18988,
7546,
1159,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
18605,
703,
1509,
29918,
1131,
2509,
613,
376,
8516,
613,
13,
462,
539,
6796,
8516,
613,
376,
29934,
1698,
29873,
294,
305,
295,
613,
376,
29956,
574,
29967,
29875,
574,
613,
376,
1349,
574,
613,
376,
9643,
29956,
574,
29967,
29875,
574,
613,
376,
9643,
1349,
574,
12436,
13,
462,
539,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
4703,
29918,
23149,
3321,
29918,
10889,
613,
7700,
29892,
13,
4706,
376,
11403,
365,
1254,
29924,
7934,
2106,
322,
1734,
23655,
304,
8161,
278,
4608,
304,
367,
18760,
1159,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
4703,
29918,
23149,
3321,
29918,
1509,
29918,
2674,
29884,
613,
7700,
29892,
13,
4706,
376,
11403,
830,
29931,
29965,
365,
2747,
304,
14405,
23655,
322,
23110,
5190,
7934,
2106,
1159,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
12846,
7716,
29918,
1990,
3709,
29918,
17462,
29918,
10492,
613,
29871,
29900,
29889,
29945,
29892,
13,
4706,
376,
29965,
8485,
363,
5768,
449,
297,
278,
28837,
3414,
770,
3709,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
17987,
8497,
29918,
17462,
29918,
10492,
613,
29871,
29900,
29889,
29945,
29892,
13,
4706,
376,
29965,
8485,
363,
5768,
449,
373,
27615,
8297,
29881,
886,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
20155,
29885,
29918,
510,
3283,
613,
5852,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
18605,
703,
1990,
3709,
29918,
1853,
613,
376,
1988,
29925,
613,
6796,
1988,
29925,
613,
376,
16382,
1582,
613,
376,
1666,
6779,
12436,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
690,
1212,
29918,
5441,
29918,
19488,
613,
29871,
29906,
29892,
20569,
13,
1678,
396,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
1949,
29918,
510,
3283,
29918,
29277,
613,
29871,
29896,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
1949,
29918,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
29277,
613,
29871,
29906,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
18616,
663,
29918,
18784,
29918,
510,
2109,
362,
29918,
13148,
29918,
6229,
613,
29871,
29896,
29900,
29906,
29946,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
816,
14989,
29918,
13445,
10335,
29918,
735,
3296,
29918,
3188,
613,
29871,
29900,
29889,
29929,
29929,
29892,
13,
4706,
376,
29965,
8485,
363,
21467,
23460,
29892,
411,
6976,
310,
8125,
29871,
29896,
975,
8125,
29871,
29906,
1641,
2967,
29985,
29937,
26495,
29918,
24530,
1159,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
1509,
29918,
29881,
17678,
29918,
14394,
613,
5852,
29892,
13,
4706,
376,
20182,
368,
278,
10541,
5101,
770,
3709,
411,
10541,
4328,
5680,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
1509,
29918,
4704,
29918,
14394,
613,
5852,
29892,
13,
4706,
376,
20182,
368,
278,
10541,
5101,
770,
3709,
411,
10541,
3234,
5680,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
6915,
29918,
11294,
292,
29918,
2388,
613,
5852,
29892,
13,
4706,
376,
17918,
23110,
5190,
322,
15259,
5190,
29889,
1815,
871,
367,
1565,
565,
773,
365,
1254,
29924,
297,
1716,
10340,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
24926,
29918,
29882,
1478,
29918,
11294,
292,
29918,
3859,
613,
7700,
29892,
13,
4706,
376,
6644,
6646,
278,
274,
2106,
310,
278,
23110,
5190,
310,
20051,
1904,
411,
278,
2186,
29908,
13,
4706,
376,
11294,
292,
5190,
274,
2106,
310,
278,
5188,
895,
1904,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
1509,
29918,
7108,
613,
7700,
29892,
13,
462,
3986,
376,
11403,
18016,
29965,
10340,
2012,
310,
365,
1254,
29924,
10340,
23157,
13,
13,
1678,
396,
20693,
326,
2133,
6055,
29889,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
26495,
29918,
24530,
613,
29871,
29945,
29900,
29900,
29900,
29900,
29900,
29892,
376,
16329,
6694,
1156,
445,
1298,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
16175,
29918,
2311,
613,
29871,
29941,
29906,
29892,
376,
26016,
29928,
1375,
747,
905,
2159,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
21891,
29918,
10492,
613,
29871,
29900,
29889,
29900,
29900,
29896,
29892,
376,
29965,
8485,
297,
390,
4345,
20420,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
21891,
29918,
10492,
29918,
7099,
388,
29918,
546,
29918,
29896,
29900,
29895,
29918,
24530,
613,
29871,
29900,
29889,
29955,
29945,
29892,
376,
29965,
8485,
297,
390,
4345,
20420,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
11303,
3262,
29918,
3317,
29918,
1767,
613,
29871,
29945,
29889,
29900,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
29880,
29906,
29918,
2892,
613,
29871,
29896,
29872,
29899,
29945,
29892,
20569,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
2344,
29918,
3881,
613,
29871,
29900,
29889,
29900,
29900,
29945,
29892,
376,
6330,
368,
1304,
363,
4964,
3317,
4128,
29889,
12146,
363,
9090,
4036,
2069,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
7411,
703,
20543,
29918,
18253,
29918,
7052,
613,
29871,
29896,
29889,
29900,
29892,
376,
6857,
666,
2957,
491,
278,
9558,
3438,
23157,
13,
13,
1678,
396,
17440,
6055,
29889,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
6112,
6765,
29918,
19207,
29918,
24530,
613,
29871,
29896,
29900,
29900,
29892,
376,
11816,
6694,
731,
2582,
472,
445,
7292,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
14513,
29918,
19207,
29918,
24530,
613,
29871,
29896,
29900,
29900,
29892,
376,
29923,
4387,
403,
472,
445,
7292,
23157,
13,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
16031,
703,
384,
415,
29918,
19207,
29918,
24530,
613,
29871,
29945,
29900,
29900,
29900,
29892,
376,
6422,
278,
1423,
3149,
373,
8086,
472,
445,
7292,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
384,
415,
29918,
265,
29918,
13318,
29918,
3359,
29918,
2704,
613,
5852,
29892,
376,
3644,
1059,
373,
278,
937,
19745,
731,
313,
1552,
2906,
731,
29897,
338,
376,
13,
4706,
376,
271,
1556,
29871,
29900,
29889,
29929,
29929,
310,
1059,
472,
278,
3517,
1423,
3149,
29892,
4078,
263,
4266,
525,
13318,
29915,
1423,
3149,
23157,
13,
13,
1678,
396,
382,
4387,
362,
6055,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
18837,
287,
29918,
14513,
29918,
6194,
29918,
8513,
613,
7700,
29892,
13,
4706,
376,
3644,
731,
29892,
263,
1423,
3149,
338,
7500,
322,
263,
6375,
1209,
338,
2309,
304,
679,
278,
25383,
376,
13,
4706,
376,
3286,
2187,
29889,
450,
10115,
1127,
610,
29879,
267,
526,
3971,
304,
278,
19056,
934,
29898,
29879,
29897,
3412,
411,
1342,
29899,
29908,
13,
4706,
376,
1609,
29899,
4773,
13600,
2472,
29889,
830,
1548,
1860,
29901,
19928,
6084,
1423,
3149,
2224,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
1807,
703,
14513,
29918,
4905,
29918,
24772,
613,
6213,
29892,
13,
4706,
376,
29965,
8485,
746,
17832,
29918,
14513,
29918,
6194,
29918,
8513,
338,
731,
29889,
450,
1353,
310,
19056,
10898,
881,
367,
1021,
29908,
13,
4706,
376,
294,
278,
1353,
310,
19745,
6166,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
3539,
29918,
11965,
18186,
29918,
1643,
613,
7700,
29892,
13,
4706,
376,
6113,
278,
25383,
11073,
297,
263,
529,
14513,
29918,
4905,
29918,
978,
15513,
26648,
934,
23157,
13,
1678,
330,
15764,
29889,
24405,
8895,
29918,
20054,
703,
11014,
29918,
17314,
29918,
6948,
485,
1849,
613,
7700,
29892,
13,
4706,
376,
7900,
2017,
393,
3651,
10902,
408,
451,
4048,
519,
674,
2615,
297,
1423,
9748,
8763,
29892,
322,
376,
13,
4706,
376,
11014,
963,
746,
8363,
29889,
910,
881,
367,
1304,
871,
746,
8363,
2030,
1423,
9748,
23157,
13,
13,
1678,
396,
20969,
1899,
1196,
13449,
29889,
13,
1678,
383,
4375,
10749,
29898,
9675,
29889,
19218,
29897,
13,
13,
1678,
1065,
29898,
6194,
29918,
11333,
29922,
18823,
10749,
29889,
18837,
287,
29918,
14513,
29918,
6194,
29918,
8513,
29897,
13,
2
] |
laia/common/saver.py | eivtho/PyLaia | 89 | 1600676 | <reponame>eivtho/PyLaia
import inspect
import os
from typing import Any, Callable
import torch
from laia.common.logging import get_logger
_logger = get_logger(__name__)
class Saver:
def __call__(self, *args: Any, **kwargs: Any):
return self.save(*args, **kwargs)
def save(self, *args: Any, **kwargs: Any):
raise NotImplementedError
class BasicSaver(Saver):
def save(self, obj: Any, filepath: str) -> str:
filepath = os.path.realpath(filepath)
dirname = os.path.dirname(filepath)
os.makedirs(dirname, exist_ok=True)
torch.save(obj, filepath)
return filepath
class ObjectSaver(Saver):
def __init__(self, filepath: str) -> None:
self._filepath = filepath
self._basic_saver = BasicSaver()
def save(self, func_or_class: Callable, *args: Any, **kwargs: Any) -> str:
return self._basic_saver.save(
{
"module": inspect.getmodule(func_or_class).__name__,
"name": func_or_class.__name__,
"args": args,
"kwargs": kwargs,
},
self._filepath,
)
class ModelSaver(ObjectSaver):
def __init__(self, save_path: str, filename: str = "model") -> None:
super().__init__(os.path.join(save_path, filename))
def save(self, func: Callable, *args: Any, **kwargs: Any) -> str:
path = super().save(func, *args, **kwargs)
_logger.debug("Saved model {}", path)
return path
| [
1,
529,
276,
1112,
420,
29958,
29872,
440,
386,
29877,
29914,
19737,
5661,
423,
13,
5215,
16096,
13,
5215,
2897,
13,
3166,
19229,
1053,
3139,
29892,
8251,
519,
13,
13,
5215,
4842,
305,
13,
13,
3166,
425,
423,
29889,
9435,
29889,
21027,
1053,
679,
29918,
21707,
13,
13,
29918,
21707,
353,
679,
29918,
21707,
22168,
978,
1649,
29897,
13,
13,
13,
1990,
5701,
369,
29901,
13,
1678,
822,
4770,
4804,
12035,
1311,
29892,
334,
5085,
29901,
3139,
29892,
3579,
19290,
29901,
3139,
1125,
13,
4706,
736,
1583,
29889,
7620,
10456,
5085,
29892,
3579,
19290,
29897,
13,
13,
1678,
822,
4078,
29898,
1311,
29892,
334,
5085,
29901,
3139,
29892,
3579,
19290,
29901,
3139,
1125,
13,
4706,
12020,
2216,
1888,
2037,
287,
2392,
13,
13,
13,
1990,
19219,
29903,
12483,
29898,
29903,
12483,
1125,
13,
1678,
822,
4078,
29898,
1311,
29892,
5446,
29901,
3139,
29892,
934,
2084,
29901,
851,
29897,
1599,
851,
29901,
13,
4706,
934,
2084,
353,
2897,
29889,
2084,
29889,
6370,
2084,
29898,
1445,
2084,
29897,
13,
4706,
4516,
978,
353,
2897,
29889,
2084,
29889,
25721,
29898,
1445,
2084,
29897,
13,
4706,
2897,
29889,
29885,
12535,
12935,
29898,
25721,
29892,
1863,
29918,
554,
29922,
5574,
29897,
13,
4706,
4842,
305,
29889,
7620,
29898,
5415,
29892,
934,
2084,
29897,
13,
4706,
736,
934,
2084,
13,
13,
13,
1990,
4669,
29903,
12483,
29898,
29903,
12483,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
934,
2084,
29901,
851,
29897,
1599,
6213,
29901,
13,
4706,
1583,
3032,
1445,
2084,
353,
934,
2084,
13,
4706,
1583,
3032,
16121,
29918,
4977,
369,
353,
19219,
29903,
12483,
580,
13,
13,
1678,
822,
4078,
29898,
1311,
29892,
3653,
29918,
272,
29918,
1990,
29901,
8251,
519,
29892,
334,
5085,
29901,
3139,
29892,
3579,
19290,
29901,
3139,
29897,
1599,
851,
29901,
13,
4706,
736,
1583,
3032,
16121,
29918,
4977,
369,
29889,
7620,
29898,
13,
9651,
426,
13,
18884,
376,
5453,
1115,
16096,
29889,
657,
5453,
29898,
9891,
29918,
272,
29918,
1990,
467,
1649,
978,
1649,
29892,
13,
18884,
376,
978,
1115,
3653,
29918,
272,
29918,
1990,
17255,
978,
1649,
29892,
13,
18884,
376,
5085,
1115,
6389,
29892,
13,
18884,
376,
19290,
1115,
9049,
5085,
29892,
13,
9651,
2981,
13,
9651,
1583,
3032,
1445,
2084,
29892,
13,
4706,
1723,
13,
13,
13,
1990,
8125,
29903,
12483,
29898,
2061,
29903,
12483,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4078,
29918,
2084,
29901,
851,
29892,
10422,
29901,
851,
353,
376,
4299,
1159,
1599,
6213,
29901,
13,
4706,
2428,
2141,
1649,
2344,
12035,
359,
29889,
2084,
29889,
7122,
29898,
7620,
29918,
2084,
29892,
10422,
876,
13,
13,
1678,
822,
4078,
29898,
1311,
29892,
3653,
29901,
8251,
519,
29892,
334,
5085,
29901,
3139,
29892,
3579,
19290,
29901,
3139,
29897,
1599,
851,
29901,
13,
4706,
2224,
353,
2428,
2141,
7620,
29898,
9891,
29892,
334,
5085,
29892,
3579,
19290,
29897,
13,
4706,
903,
21707,
29889,
8382,
703,
29903,
10511,
1904,
6571,
613,
2224,
29897,
13,
4706,
736,
2224,
13,
2
] |
fluid/image_classification/eval.py | Panxj/models-1 | 0 | 182868 | <gh_stars>0
import os
import sys
import numpy as np
import argparse
import functools
import paddle
import paddle.fluid as fluid
from utility import add_arguments, print_arguments
from se_resnext import SE_ResNeXt
import reader
parser = argparse.ArgumentParser(description=__doc__)
add_arg = functools.partial(add_arguments, argparser=parser)
# yapf: disable
add_arg('batch_size', int, 32, "Minibatch size.")
add_arg('use_gpu', bool, True, "Whether to use GPU or not.")
add_arg('test_list', str, '', "The testing data lists.")
add_arg('num_layers', int, 50, "How many layers for SE-ResNeXt model.")
add_arg('model_dir', str, '', "The model path.")
# yapf: enable
def eval(args):
class_dim = 1000
image_shape = [3, 224, 224]
image = fluid.layers.data(name='image', shape=image_shape, dtype='float32')
label = fluid.layers.data(name='label', shape=[1], dtype='int64')
out = SE_ResNeXt(input=image, class_dim=class_dim, layers=args.num_layers)
cost = fluid.layers.cross_entropy(input=out, label=label)
acc_top1 = fluid.layers.accuracy(input=out, label=label, k=1)
acc_top5 = fluid.layers.accuracy(input=out, label=label, k=5)
avg_cost = fluid.layers.mean(x=cost)
inference_program = fluid.default_main_program().clone(for_test=True)
place = fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace()
exe = fluid.Executor(place)
if not os.path.exists(args.model_dir):
raise ValueError("The model path [%s] does not exist." %
(args.model_dir))
if not os.path.exists(args.test_list):
raise ValueError("The test lists [%s] does not exist." %
(args.test_list))
def if_exist(var):
return os.path.exists(os.path.join(args.model_dir, var.name))
fluid.io.load_vars(exe, args.model_dir, predicate=if_exist)
test_reader = paddle.batch(
reader.test(args.test_list), batch_size=args.batch_size)
feeder = fluid.DataFeeder(place=place, feed_list=[image, label])
fetch_list = [avg_cost, acc_top1, acc_top5]
test_info = [[], [], []]
for batch_id, data in enumerate(test_reader()):
loss, acc1, acc5 = exe.run(inference_program,
feed=feeder.feed(data),
fetch_list=fetch_list)
test_info[0].append(loss[0])
test_info[1].append(acc1[0])
test_info[2].append(acc5[0])
if batch_id % 1 == 0:
print("Test {0}, loss {1}, acc1 {2}, acc5 {3}"
.format(batch_id, loss[0], acc1[0], acc5[0]))
sys.stdout.flush()
test_loss = np.array(test_info[0]).mean()
test_acc1 = np.array(test_info[1]).mean()
test_acc5 = np.array(test_info[2]).mean()
print("Test loss {0}, acc1 {1}, acc5 {2}".format(test_loss, test_acc1,
test_acc5))
sys.stdout.flush()
if __name__ == '__main__':
args = parser.parse_args()
print_arguments(args)
eval(args)
| [
1,
529,
12443,
29918,
303,
1503,
29958,
29900,
13,
5215,
2897,
13,
5215,
10876,
13,
5215,
12655,
408,
7442,
13,
5215,
1852,
5510,
13,
5215,
2090,
312,
8789,
13,
13,
5215,
282,
22352,
13,
5215,
282,
22352,
29889,
1579,
5416,
408,
22576,
13,
3166,
19725,
1053,
788,
29918,
25699,
29892,
1596,
29918,
25699,
13,
3166,
409,
29918,
690,
4622,
1053,
3725,
29918,
1666,
8139,
29990,
29873,
13,
5215,
9591,
13,
13,
16680,
353,
1852,
5510,
29889,
15730,
11726,
29898,
8216,
29922,
1649,
1514,
1649,
29897,
13,
1202,
29918,
1191,
353,
2090,
312,
8789,
29889,
3846,
29898,
1202,
29918,
25699,
29892,
1852,
16680,
29922,
16680,
29897,
13,
29937,
343,
481,
29888,
29901,
11262,
13,
1202,
29918,
1191,
877,
16175,
29918,
2311,
742,
539,
938,
29892,
1678,
29941,
29906,
29892,
4706,
376,
8140,
747,
905,
2159,
23157,
13,
1202,
29918,
1191,
877,
1509,
29918,
29887,
3746,
742,
3986,
6120,
29892,
29871,
5852,
29892,
418,
376,
8809,
1979,
304,
671,
22796,
470,
451,
23157,
13,
1202,
29918,
1191,
877,
1688,
29918,
1761,
742,
4706,
851,
29892,
259,
15516,
4706,
376,
1576,
6724,
848,
8857,
23157,
13,
1202,
29918,
1191,
877,
1949,
29918,
29277,
742,
539,
938,
29892,
259,
29945,
29900,
29892,
308,
376,
5328,
1784,
15359,
363,
3725,
29899,
1666,
8139,
29990,
29873,
1904,
23157,
13,
1202,
29918,
1191,
877,
4299,
29918,
3972,
742,
4706,
851,
29892,
259,
15516,
4706,
376,
1576,
1904,
2224,
23157,
13,
29937,
343,
481,
29888,
29901,
9025,
13,
13,
13,
1753,
19745,
29898,
5085,
1125,
13,
1678,
770,
29918,
6229,
353,
29871,
29896,
29900,
29900,
29900,
13,
1678,
1967,
29918,
12181,
353,
518,
29941,
29892,
29871,
29906,
29906,
29946,
29892,
29871,
29906,
29906,
29946,
29962,
13,
1678,
1967,
353,
22576,
29889,
29277,
29889,
1272,
29898,
978,
2433,
3027,
742,
8267,
29922,
3027,
29918,
12181,
29892,
26688,
2433,
7411,
29941,
29906,
1495,
13,
1678,
3858,
353,
22576,
29889,
29277,
29889,
1272,
29898,
978,
2433,
1643,
742,
8267,
11759,
29896,
1402,
26688,
2433,
524,
29953,
29946,
1495,
13,
1678,
714,
353,
3725,
29918,
1666,
8139,
29990,
29873,
29898,
2080,
29922,
3027,
29892,
770,
29918,
6229,
29922,
1990,
29918,
6229,
29892,
15359,
29922,
5085,
29889,
1949,
29918,
29277,
29897,
13,
1678,
3438,
353,
22576,
29889,
29277,
29889,
19128,
29918,
296,
14441,
29898,
2080,
29922,
449,
29892,
3858,
29922,
1643,
29897,
13,
1678,
1035,
29918,
3332,
29896,
353,
22576,
29889,
29277,
29889,
562,
2764,
4135,
29898,
2080,
29922,
449,
29892,
3858,
29922,
1643,
29892,
413,
29922,
29896,
29897,
13,
1678,
1035,
29918,
3332,
29945,
353,
22576,
29889,
29277,
29889,
562,
2764,
4135,
29898,
2080,
29922,
449,
29892,
3858,
29922,
1643,
29892,
413,
29922,
29945,
29897,
13,
1678,
1029,
29887,
29918,
18253,
353,
22576,
29889,
29277,
29889,
12676,
29898,
29916,
29922,
18253,
29897,
13,
13,
1678,
27262,
29918,
8860,
353,
22576,
29889,
4381,
29918,
3396,
29918,
8860,
2141,
16513,
29898,
1454,
29918,
1688,
29922,
5574,
29897,
13,
13,
1678,
2058,
353,
22576,
29889,
29907,
15789,
3301,
1265,
29898,
29900,
29897,
565,
6389,
29889,
1509,
29918,
29887,
3746,
1683,
22576,
29889,
6271,
4897,
1265,
580,
13,
1678,
429,
29872,
353,
22576,
29889,
13366,
29898,
6689,
29897,
13,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
5085,
29889,
4299,
29918,
3972,
1125,
13,
4706,
12020,
7865,
2392,
703,
1576,
1904,
2224,
518,
29995,
29879,
29962,
947,
451,
1863,
1213,
1273,
13,
462,
308,
313,
5085,
29889,
4299,
29918,
3972,
876,
13,
1678,
565,
451,
2897,
29889,
2084,
29889,
9933,
29898,
5085,
29889,
1688,
29918,
1761,
1125,
13,
4706,
12020,
7865,
2392,
703,
1576,
1243,
8857,
518,
29995,
29879,
29962,
947,
451,
1863,
1213,
1273,
13,
462,
308,
313,
5085,
29889,
1688,
29918,
1761,
876,
13,
13,
1678,
822,
565,
29918,
28997,
29898,
1707,
1125,
13,
4706,
736,
2897,
29889,
2084,
29889,
9933,
29898,
359,
29889,
2084,
29889,
7122,
29898,
5085,
29889,
4299,
29918,
3972,
29892,
722,
29889,
978,
876,
13,
13,
1678,
22576,
29889,
601,
29889,
1359,
29918,
16908,
29898,
8097,
29892,
6389,
29889,
4299,
29918,
3972,
29892,
24384,
29922,
361,
29918,
28997,
29897,
13,
13,
1678,
1243,
29918,
16950,
353,
282,
22352,
29889,
16175,
29898,
13,
4706,
9591,
29889,
1688,
29898,
5085,
29889,
1688,
29918,
1761,
511,
9853,
29918,
2311,
29922,
5085,
29889,
16175,
29918,
2311,
29897,
13,
1678,
1238,
2447,
353,
22576,
29889,
1469,
8263,
2447,
29898,
6689,
29922,
6689,
29892,
8343,
29918,
1761,
11759,
3027,
29892,
3858,
2314,
13,
13,
1678,
6699,
29918,
1761,
353,
518,
485,
29887,
29918,
18253,
29892,
1035,
29918,
3332,
29896,
29892,
1035,
29918,
3332,
29945,
29962,
13,
13,
1678,
1243,
29918,
3888,
353,
5519,
1402,
19997,
5159,
29962,
13,
1678,
363,
9853,
29918,
333,
29892,
848,
297,
26985,
29898,
1688,
29918,
16950,
580,
1125,
13,
4706,
6410,
29892,
1035,
29896,
29892,
1035,
29945,
353,
429,
29872,
29889,
3389,
29898,
262,
1659,
29918,
8860,
29892,
13,
462,
462,
259,
8343,
29922,
1725,
2447,
29889,
18798,
29898,
1272,
511,
13,
462,
462,
259,
6699,
29918,
1761,
29922,
9155,
29918,
1761,
29897,
13,
4706,
1243,
29918,
3888,
29961,
29900,
1822,
4397,
29898,
6758,
29961,
29900,
2314,
13,
4706,
1243,
29918,
3888,
29961,
29896,
1822,
4397,
29898,
5753,
29896,
29961,
29900,
2314,
13,
4706,
1243,
29918,
3888,
29961,
29906,
1822,
4397,
29898,
5753,
29945,
29961,
29900,
2314,
13,
4706,
565,
9853,
29918,
333,
1273,
29871,
29896,
1275,
29871,
29900,
29901,
13,
9651,
1596,
703,
3057,
426,
29900,
1118,
6410,
426,
29896,
1118,
1035,
29896,
426,
29906,
1118,
1035,
29945,
426,
29941,
5038,
13,
462,
29871,
869,
4830,
29898,
16175,
29918,
333,
29892,
6410,
29961,
29900,
1402,
1035,
29896,
29961,
29900,
1402,
1035,
29945,
29961,
29900,
12622,
13,
9651,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
1678,
1243,
29918,
6758,
353,
7442,
29889,
2378,
29898,
1688,
29918,
3888,
29961,
29900,
14664,
12676,
580,
13,
1678,
1243,
29918,
5753,
29896,
353,
7442,
29889,
2378,
29898,
1688,
29918,
3888,
29961,
29896,
14664,
12676,
580,
13,
1678,
1243,
29918,
5753,
29945,
353,
7442,
29889,
2378,
29898,
1688,
29918,
3888,
29961,
29906,
14664,
12676,
580,
13,
13,
1678,
1596,
703,
3057,
6410,
426,
29900,
1118,
1035,
29896,
426,
29896,
1118,
1035,
29945,
426,
29906,
29913,
1642,
4830,
29898,
1688,
29918,
6758,
29892,
1243,
29918,
5753,
29896,
29892,
13,
462,
462,
462,
268,
1243,
29918,
5753,
29945,
876,
13,
1678,
10876,
29889,
25393,
29889,
23126,
580,
13,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
6389,
353,
13812,
29889,
5510,
29918,
5085,
580,
13,
1678,
1596,
29918,
25699,
29898,
5085,
29897,
13,
1678,
19745,
29898,
5085,
29897,
13,
2
] |
tests/example/reflexes/example_reflex.py | FarhanAliRaza/django-sockpuppet | 371 | 139049 | <reponame>FarhanAliRaza/django-sockpuppet
from sockpuppet.reflex import Reflex
class ExampleReflex(Reflex):
def increment(self, step=1):
self.session['count'] = int(self.element.dataset['count']) + step
class DecrementReflex(Reflex):
def decrement(self, step=1):
self.session['otherCount'] = int(self.element.dataset['count']) - step
class ParamReflex(Reflex):
def change_word(self):
self.word = 'space'
self.success = True
class FormReflex(Reflex):
def submit(self):
self.text_output = self.request.POST['text-input']
class ErrorReflex(Reflex):
def increment(self, step=1):
raise Exception('error happened')
class UserReflex(Reflex):
def get_user(self):
context = self.get_context_data()
self.user_reveal = context['object']
| [
1,
529,
276,
1112,
420,
29958,
29943,
279,
5403,
29909,
492,
29934,
19924,
29914,
14095,
29899,
21852,
3746,
7988,
13,
3166,
577,
384,
3746,
7988,
29889,
999,
2506,
1053,
9897,
2506,
13,
13,
13,
1990,
8741,
5620,
2506,
29898,
5620,
2506,
1125,
13,
1678,
822,
11924,
29898,
1311,
29892,
4331,
29922,
29896,
1125,
13,
4706,
1583,
29889,
7924,
1839,
2798,
2033,
353,
938,
29898,
1311,
29889,
5029,
29889,
24713,
1839,
2798,
11287,
718,
4331,
13,
13,
13,
1990,
3826,
276,
358,
5620,
2506,
29898,
5620,
2506,
1125,
13,
1678,
822,
9263,
358,
29898,
1311,
29892,
4331,
29922,
29896,
1125,
13,
4706,
1583,
29889,
7924,
1839,
1228,
3981,
2033,
353,
938,
29898,
1311,
29889,
5029,
29889,
24713,
1839,
2798,
11287,
448,
4331,
13,
13,
13,
1990,
12662,
5620,
2506,
29898,
5620,
2506,
1125,
13,
1678,
822,
1735,
29918,
1742,
29898,
1311,
1125,
13,
4706,
1583,
29889,
1742,
353,
525,
3493,
29915,
13,
4706,
1583,
29889,
8698,
353,
5852,
13,
13,
13,
1990,
3812,
5620,
2506,
29898,
5620,
2506,
1125,
13,
1678,
822,
9752,
29898,
1311,
1125,
13,
4706,
1583,
29889,
726,
29918,
4905,
353,
1583,
29889,
3827,
29889,
5438,
1839,
726,
29899,
2080,
2033,
13,
13,
13,
1990,
4829,
5620,
2506,
29898,
5620,
2506,
1125,
13,
1678,
822,
11924,
29898,
1311,
29892,
4331,
29922,
29896,
1125,
13,
4706,
12020,
8960,
877,
2704,
9559,
1495,
13,
13,
13,
1990,
4911,
5620,
2506,
29898,
5620,
2506,
1125,
13,
1678,
822,
679,
29918,
1792,
29898,
1311,
1125,
13,
4706,
3030,
353,
1583,
29889,
657,
29918,
4703,
29918,
1272,
580,
13,
4706,
1583,
29889,
1792,
29918,
276,
345,
284,
353,
3030,
1839,
3318,
2033,
13,
2
] |
ops/multihead/__init__.py | ancientmooner/CCNet | 0 | 192043 | from .multihead_block import MultiheadBlock
from .multihead_spatial_block import MultiheadSpatialBlock
__all__ = [
'MultiheadBlock', 'MultiheadSpatialBlock',
]
| [
1,
515,
869,
9910,
2813,
29918,
1271,
1053,
14974,
2813,
7445,
13,
3166,
869,
9910,
2813,
29918,
1028,
15238,
29918,
1271,
1053,
14974,
2813,
29903,
5031,
616,
7445,
13,
13,
1649,
497,
1649,
353,
518,
13,
1678,
525,
15329,
2813,
7445,
742,
525,
15329,
2813,
29903,
5031,
616,
7445,
742,
13,
29962,
13,
2
] |
viper/cli.py | curtisma/conda-virtuoso | 2 | 171942 | """
Command line interface for viper
"""
import click
from .docs import docs as docs_internal
from .cdslib import add_library, include_cdslib
@click.group()
def virt():
"""
Cadence virtuoso command-line utilities
"""
pass
@virt.command()
def docs():
docs_internal()
@virt.group()
def cdslib():
"""Edit a *.cdslib file"""
pass
@cdslib.command()
@click.argument("cds_path")
@click.argument("library_name")
@click.argument("library_path")
def add():
"""
Add a library
"""
add_library(cds_path, library_name, library_path)
@cdslib.command()
@click.argument("cds_path")
@click.argument("include_file_path")
@click.option('-s','--soft')
def include():
"""
Include another cds.lib file in the current one.
:return:
"""
include_cdslib(cds_path, include_file_path, soft)
if __name__ == '__main__':
virt(auto_envvar_prefix='VIRT')
| [
1,
9995,
13,
6255,
1196,
5067,
363,
3516,
546,
13,
15945,
29908,
13,
5215,
2828,
13,
3166,
869,
2640,
1053,
10561,
408,
10561,
29918,
7564,
13,
3166,
869,
2252,
29879,
1982,
1053,
788,
29918,
5258,
29892,
3160,
29918,
2252,
29879,
1982,
13,
13,
13,
29992,
3808,
29889,
2972,
580,
13,
1753,
4610,
7295,
13,
1678,
9995,
13,
1678,
21542,
663,
4610,
29884,
9064,
1899,
29899,
1220,
3667,
1907,
13,
1678,
9995,
13,
1678,
1209,
13,
13,
29992,
15389,
29889,
6519,
580,
13,
1753,
10561,
7295,
13,
1678,
10561,
29918,
7564,
580,
13,
13,
29992,
15389,
29889,
2972,
580,
13,
1753,
274,
6289,
1982,
7295,
13,
1678,
9995,
6103,
263,
20611,
2252,
29879,
1982,
934,
15945,
29908,
13,
1678,
1209,
13,
13,
29992,
2252,
29879,
1982,
29889,
6519,
580,
13,
29992,
3808,
29889,
23516,
703,
2252,
29879,
29918,
2084,
1159,
13,
29992,
3808,
29889,
23516,
703,
5258,
29918,
978,
1159,
13,
29992,
3808,
29889,
23516,
703,
5258,
29918,
2084,
1159,
13,
1753,
788,
7295,
13,
1678,
9995,
13,
1678,
3462,
263,
3489,
13,
1678,
9995,
13,
1678,
788,
29918,
5258,
29898,
2252,
29879,
29918,
2084,
29892,
3489,
29918,
978,
29892,
3489,
29918,
2084,
29897,
13,
13,
29992,
2252,
29879,
1982,
29889,
6519,
580,
13,
29992,
3808,
29889,
23516,
703,
2252,
29879,
29918,
2084,
1159,
13,
29992,
3808,
29889,
23516,
703,
2856,
29918,
1445,
29918,
2084,
1159,
13,
29992,
3808,
29889,
3385,
877,
29899,
29879,
3788,
489,
2695,
1495,
13,
1753,
3160,
7295,
13,
1678,
9995,
13,
1678,
512,
2325,
1790,
274,
6289,
29889,
1982,
934,
297,
278,
1857,
697,
29889,
13,
1678,
584,
2457,
29901,
13,
1678,
9995,
13,
1678,
3160,
29918,
2252,
29879,
1982,
29898,
2252,
29879,
29918,
2084,
29892,
3160,
29918,
1445,
29918,
2084,
29892,
4964,
29897,
13,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
4610,
29898,
6921,
29918,
6272,
1707,
29918,
13506,
2433,
29963,
8193,
29911,
1495,
13,
2
] |
lmbl_weight.py | zhuruijie16/Scripts_CE | 0 | 199293 | <filename>lmbl_weight.py
import os
import pandas as pd
import numpy as np
import shutil
cwd = os.getcwd()
sysname = os.path.basename(cwd)
print(sysname)
if os.path.isdir(cwd+'/lmbl/'):
shutil.rmtree(cwd+'/lmbl/')
os.mkdir('lmbl')
coor = os.path.join(cwd+ '/coordinates/')
lmbl = os.path.join(cwd+ '/lmbl/')
os.chdir(lmbl)
for filename in os.listdir(coor):
other_name=[]
other_X = []
other_Y = []
other_Z = []
C_X = []
C_Y = []
C_Z = []
count_C = 0
pos_C = []
print(filename)
with open(os.path.join(coor+filename)) as f:
lines=f.readlines()
f.close()
#obtian the number of C atoms and the coordinates of other atoms
for i in range(1,len(lines)):
lines_ele = lines[i].strip().split(',')
ele = lines_ele[0]
if ele == sysname:
count_C+=1
pos_C.append(i)
continue
else:
other_name.append(lines_ele[0])
other_X.append(lines_ele[1])
other_Y.append(lines_ele[2])
other_Z.append(lines_ele[3])
len_others=len(lines)-1-count_C
#obtain coordinates of
for j in range(0,count_C):
lines_C = lines[pos_C[j]].strip().split(',')
C_X.append(lines_C[1])
C_Y.append(lines_C[2])
C_Z.append(lines_C[3])
#calculate dist between C and other atoms
#dist between first C and other atoms
print(C_X)
CX = C_X[0]
CY = C_Y[0]
CZ = C_Z[0]
pair=[]
dist=[]
for k in range(0,len_others):
Xdiff = float(other_X[k]) - float(CX)
Ydiff = float(other_Y[k]) - float(CY)
Zdiff = float(other_Z[k]) - float(CZ)
d = np.sqrt(np.square(Xdiff)+np.square(Ydiff)+np.square(Zdiff))
pair.append(sysname + '-' + other_name[k])
dist.append(d)
if count_C > 1:
for l in range(1,count_C):
Xdiff = float(C_X[l]) - float(CX)
Ydiff = float(C_Y[l]) - float(CY)
Zdiff = float(C_Z[l]) - float(CZ)
d = np.sqrt(np.square(Xdiff) + np.square(Ydiff) + np.square(Zdiff))
pair.append(sysname + '-' + sysname)
dist.append(d)
weight=[]
for dis in dist:
w = 1 / dis
weight.append(w)
weight_sum=sum(weight)
frac = [ w / weight_sum for w in weight]
df = pd.DataFrame({'pair':pair,'dist':dist,'weight':weight,'weight_sum':weight_sum,'frac':frac})
df.to_csv(filename,index=False)
| [
1,
529,
9507,
29958,
21457,
2204,
29918,
7915,
29889,
2272,
13,
5215,
2897,
13,
5215,
11701,
408,
10518,
13,
5215,
12655,
408,
7442,
13,
5215,
528,
4422,
13,
29883,
9970,
353,
2897,
29889,
657,
29883,
9970,
580,
13,
9675,
978,
353,
2897,
29889,
2084,
29889,
6500,
3871,
29898,
29883,
9970,
29897,
13,
2158,
29898,
9675,
978,
29897,
13,
361,
2897,
29889,
2084,
29889,
275,
3972,
29898,
29883,
9970,
23097,
29914,
21457,
2204,
22208,
1125,
13,
1678,
528,
4422,
29889,
1758,
8336,
29898,
29883,
9970,
23097,
29914,
21457,
2204,
29914,
1495,
13,
359,
29889,
11256,
3972,
877,
21457,
2204,
1495,
13,
1111,
272,
353,
2897,
29889,
2084,
29889,
7122,
29898,
29883,
9970,
29974,
8207,
1111,
24266,
29914,
1495,
13,
21457,
2204,
353,
2897,
29889,
2084,
29889,
7122,
29898,
29883,
9970,
29974,
8207,
21457,
2204,
29914,
1495,
13,
359,
29889,
305,
3972,
29898,
21457,
2204,
29897,
13,
1454,
10422,
297,
2897,
29889,
1761,
3972,
29898,
1111,
272,
1125,
13,
1678,
916,
29918,
978,
29922,
2636,
13,
1678,
916,
29918,
29990,
353,
5159,
13,
1678,
916,
29918,
29979,
353,
5159,
13,
1678,
916,
29918,
29999,
353,
5159,
13,
1678,
315,
29918,
29990,
353,
5159,
13,
1678,
315,
29918,
29979,
353,
5159,
13,
1678,
315,
29918,
29999,
353,
5159,
13,
1678,
2302,
29918,
29907,
353,
29871,
29900,
13,
1678,
926,
29918,
29907,
353,
5159,
13,
1678,
1596,
29898,
9507,
29897,
13,
1678,
411,
1722,
29898,
359,
29889,
2084,
29889,
7122,
29898,
1111,
272,
29974,
9507,
876,
408,
285,
29901,
13,
4706,
3454,
29922,
29888,
29889,
949,
9012,
580,
13,
1678,
285,
29889,
5358,
580,
13,
1678,
396,
711,
29873,
713,
278,
1353,
310,
315,
28422,
322,
278,
10350,
310,
916,
28422,
13,
1678,
363,
474,
297,
3464,
29898,
29896,
29892,
2435,
29898,
9012,
22164,
13,
4706,
3454,
29918,
6146,
353,
3454,
29961,
29875,
1822,
17010,
2141,
5451,
29317,
1495,
13,
4706,
4552,
353,
3454,
29918,
6146,
29961,
29900,
29962,
13,
4706,
565,
4552,
1275,
10876,
978,
29901,
13,
9651,
2302,
29918,
29907,
23661,
29896,
13,
9651,
926,
29918,
29907,
29889,
4397,
29898,
29875,
29897,
13,
9651,
6773,
13,
4706,
1683,
29901,
13,
9651,
916,
29918,
978,
29889,
4397,
29898,
9012,
29918,
6146,
29961,
29900,
2314,
13,
9651,
916,
29918,
29990,
29889,
4397,
29898,
9012,
29918,
6146,
29961,
29896,
2314,
13,
9651,
916,
29918,
29979,
29889,
4397,
29898,
9012,
29918,
6146,
29961,
29906,
2314,
13,
9651,
916,
29918,
29999,
29889,
4397,
29898,
9012,
29918,
6146,
29961,
29941,
2314,
13,
13,
1678,
7431,
29918,
720,
414,
29922,
2435,
29898,
9012,
6817,
29896,
29899,
2798,
29918,
29907,
13,
1678,
396,
711,
2408,
10350,
310,
13,
1678,
363,
432,
297,
3464,
29898,
29900,
29892,
2798,
29918,
29907,
1125,
13,
4706,
3454,
29918,
29907,
353,
3454,
29961,
1066,
29918,
29907,
29961,
29926,
29962,
1822,
17010,
2141,
5451,
29317,
1495,
13,
4706,
315,
29918,
29990,
29889,
4397,
29898,
9012,
29918,
29907,
29961,
29896,
2314,
13,
4706,
315,
29918,
29979,
29889,
4397,
29898,
9012,
29918,
29907,
29961,
29906,
2314,
13,
4706,
315,
29918,
29999,
29889,
4397,
29898,
9012,
29918,
29907,
29961,
29941,
2314,
13,
1678,
396,
15807,
403,
1320,
1546,
315,
322,
916,
28422,
13,
1678,
396,
5721,
1546,
937,
315,
322,
916,
28422,
13,
1678,
1596,
29898,
29907,
29918,
29990,
29897,
13,
1678,
315,
29990,
353,
315,
29918,
29990,
29961,
29900,
29962,
13,
1678,
315,
29979,
353,
315,
29918,
29979,
29961,
29900,
29962,
13,
1678,
315,
29999,
353,
315,
29918,
29999,
29961,
29900,
29962,
13,
1678,
5101,
29922,
2636,
13,
1678,
1320,
29922,
2636,
13,
1678,
363,
413,
297,
3464,
29898,
29900,
29892,
2435,
29918,
720,
414,
1125,
13,
4706,
1060,
12765,
353,
5785,
29898,
1228,
29918,
29990,
29961,
29895,
2314,
448,
5785,
29898,
29907,
29990,
29897,
13,
4706,
612,
12765,
353,
5785,
29898,
1228,
29918,
29979,
29961,
29895,
2314,
448,
5785,
29898,
29907,
29979,
29897,
13,
4706,
796,
12765,
353,
5785,
29898,
1228,
29918,
29999,
29961,
29895,
2314,
448,
5785,
29898,
29907,
29999,
29897,
13,
4706,
270,
353,
7442,
29889,
3676,
29898,
9302,
29889,
17619,
29898,
29990,
12765,
7240,
9302,
29889,
17619,
29898,
29979,
12765,
7240,
9302,
29889,
17619,
29898,
29999,
12765,
876,
13,
4706,
5101,
29889,
4397,
29898,
9675,
978,
718,
17411,
29915,
718,
916,
29918,
978,
29961,
29895,
2314,
13,
4706,
1320,
29889,
4397,
29898,
29881,
29897,
13,
1678,
565,
2302,
29918,
29907,
1405,
29871,
29896,
29901,
13,
4706,
363,
301,
297,
3464,
29898,
29896,
29892,
2798,
29918,
29907,
1125,
13,
9651,
1060,
12765,
353,
5785,
29898,
29907,
29918,
29990,
29961,
29880,
2314,
448,
5785,
29898,
29907,
29990,
29897,
13,
9651,
612,
12765,
353,
5785,
29898,
29907,
29918,
29979,
29961,
29880,
2314,
448,
5785,
29898,
29907,
29979,
29897,
13,
9651,
796,
12765,
353,
5785,
29898,
29907,
29918,
29999,
29961,
29880,
2314,
448,
5785,
29898,
29907,
29999,
29897,
13,
9651,
270,
353,
7442,
29889,
3676,
29898,
9302,
29889,
17619,
29898,
29990,
12765,
29897,
718,
7442,
29889,
17619,
29898,
29979,
12765,
29897,
718,
7442,
29889,
17619,
29898,
29999,
12765,
876,
13,
9651,
5101,
29889,
4397,
29898,
9675,
978,
718,
17411,
29915,
718,
10876,
978,
29897,
13,
9651,
1320,
29889,
4397,
29898,
29881,
29897,
13,
1678,
7688,
29922,
2636,
13,
1678,
363,
766,
297,
1320,
29901,
13,
4706,
281,
353,
29871,
29896,
847,
766,
13,
4706,
7688,
29889,
4397,
29898,
29893,
29897,
13,
1678,
7688,
29918,
2083,
29922,
2083,
29898,
7915,
29897,
13,
1678,
285,
945,
353,
518,
281,
847,
7688,
29918,
2083,
363,
281,
297,
7688,
29962,
13,
1678,
4489,
353,
10518,
29889,
17271,
3319,
29915,
18784,
2396,
18784,
5501,
5721,
2396,
5721,
5501,
7915,
2396,
7915,
5501,
7915,
29918,
2083,
2396,
7915,
29918,
2083,
5501,
1154,
2396,
1154,
1800,
13,
1678,
4489,
29889,
517,
29918,
7638,
29898,
9507,
29892,
2248,
29922,
8824,
29897,
13,
13,
13,
2
] |
znfTruth/renameNewick.py | joelarmstrong/treeBuildingEvaluation | 0 | 173168 | <reponame>joelarmstrong/treeBuildingEvaluation
#!/usr/bin/env python
import sys
from sonLib.bioio import fastaRead
from sonLib.nxnewick import NXNewick
from sonLib.nxtree import NXTree
import networkx as nx
def induceTreeOnLeaves(nxtree, leaves):
leaves = set(leaves)
dg = nxtree.nxDg
nodesToKeep = []
for node in dg.nodes():
succ = set([nxtree.getName(i) for i in nx.dfs_postorder_nodes(dg, node) if nxtree.hasName(i)])
if len(succ.intersection(leaves)) != 0:
nodesToKeep.append(node)
return NXTree(dg.subgraph(nodesToKeep))
renameFile = open(sys.argv[1])
newickFile = open(sys.argv[2])
translate = {}
curPastaID = None
curRealName = None
for i, line in enumerate(renameFile):
line = line.strip()
if i % 3 == 0:
curPastaID = line
elif i % 3 == 1:
curRealName = line
else:
translate[curPastaID] = curRealName.replace("...", ".-.").replace(".", "_").replace("__", "_")
s = newickFile.read()
for header1, header2 in translate.items():
s = s.replace(header1, header2)
tree = NXNewick().parseString(s)
inducedTree = induceTreeOnLeaves(tree, translate.values())
print NXNewick().writeString(inducedTree)
| [
1,
529,
276,
1112,
420,
29958,
2212,
295,
2817,
1110,
29914,
8336,
8893,
292,
29923,
4387,
362,
13,
29937,
14708,
4855,
29914,
2109,
29914,
6272,
3017,
13,
5215,
10876,
13,
3166,
1487,
14868,
29889,
24840,
601,
1053,
5172,
29874,
6359,
13,
3166,
1487,
14868,
29889,
23818,
1482,
860,
1053,
405,
29990,
4373,
860,
13,
3166,
1487,
14868,
29889,
29876,
486,
929,
1053,
405,
29990,
9643,
13,
5215,
3564,
29916,
408,
302,
29916,
13,
13,
1753,
9013,
346,
9643,
2951,
3226,
5989,
29898,
29876,
486,
929,
29892,
11308,
1125,
13,
1678,
11308,
353,
731,
29898,
280,
5989,
29897,
13,
1678,
270,
29887,
353,
302,
486,
929,
29889,
23818,
29928,
29887,
13,
1678,
7573,
1762,
9598,
1022,
353,
5159,
13,
1678,
363,
2943,
297,
270,
29887,
29889,
18010,
7295,
13,
4706,
8348,
353,
731,
4197,
29876,
486,
929,
29889,
19629,
29898,
29875,
29897,
363,
474,
297,
302,
29916,
29889,
29069,
29918,
2490,
2098,
29918,
18010,
29898,
20726,
29892,
2943,
29897,
565,
302,
486,
929,
29889,
5349,
1170,
29898,
29875,
29897,
2314,
13,
4706,
565,
7431,
29898,
2146,
617,
29889,
1639,
2042,
29898,
280,
5989,
876,
2804,
29871,
29900,
29901,
13,
9651,
7573,
1762,
9598,
1022,
29889,
4397,
29898,
3177,
29897,
13,
1678,
736,
405,
29990,
9643,
29898,
20726,
29889,
1491,
4262,
29898,
18010,
1762,
9598,
1022,
876,
13,
13,
1267,
420,
2283,
353,
1722,
29898,
9675,
29889,
19218,
29961,
29896,
2314,
13,
1482,
860,
2283,
353,
1722,
29898,
9675,
29889,
19218,
29961,
29906,
2314,
13,
13,
21652,
353,
6571,
13,
2764,
29925,
5427,
1367,
353,
6213,
13,
2764,
21713,
1170,
353,
6213,
13,
1454,
474,
29892,
1196,
297,
26985,
29898,
1267,
420,
2283,
1125,
13,
1678,
1196,
353,
1196,
29889,
17010,
580,
13,
1678,
565,
474,
1273,
29871,
29941,
1275,
29871,
29900,
29901,
13,
4706,
3151,
29925,
5427,
1367,
353,
1196,
13,
1678,
25342,
474,
1273,
29871,
29941,
1275,
29871,
29896,
29901,
13,
4706,
3151,
21713,
1170,
353,
1196,
13,
1678,
1683,
29901,
13,
4706,
14240,
29961,
2764,
29925,
5427,
1367,
29962,
353,
3151,
21713,
1170,
29889,
6506,
703,
856,
613,
376,
9229,
1213,
467,
6506,
17350,
613,
11119,
2564,
6506,
703,
1649,
613,
11119,
1159,
13,
13,
29879,
353,
716,
860,
2283,
29889,
949,
580,
13,
1454,
4839,
29896,
29892,
4839,
29906,
297,
14240,
29889,
7076,
7295,
13,
1678,
269,
353,
269,
29889,
6506,
29898,
6672,
29896,
29892,
4839,
29906,
29897,
13,
13,
8336,
353,
405,
29990,
4373,
860,
2141,
5510,
1231,
29898,
29879,
29897,
13,
13,
19910,
1133,
9643,
353,
9013,
346,
9643,
2951,
3226,
5989,
29898,
8336,
29892,
14240,
29889,
5975,
3101,
13,
13,
2158,
405,
29990,
4373,
860,
2141,
3539,
1231,
29898,
19910,
1133,
9643,
29897,
13,
2
] |
Python/prova/fibro 2.py | marcelosilva7/Primeiro-repositorio | 0 | 84341 | t1 = 0
t2 = 1
print(f'{t1} -> {t2} -> ', end='')
for c in range(1, 21):
t3 = t1 + t2
print(f'{t3} -> ', end='')
t1 = t2
t2 = t3
print('FIM', end='') | [
1,
260,
29896,
353,
29871,
29900,
30004,
13,
29873,
29906,
353,
29871,
29896,
30004,
13,
2158,
29898,
29888,
29915,
29912,
29873,
29896,
29913,
1599,
426,
29873,
29906,
29913,
1599,
13420,
1095,
2433,
1495,
30004,
13,
1454,
274,
297,
3464,
29898,
29896,
29892,
29871,
29906,
29896,
1125,
30004,
13,
1678,
260,
29941,
353,
260,
29896,
718,
260,
29906,
30004,
13,
1678,
1596,
29898,
29888,
29915,
29912,
29873,
29941,
29913,
1599,
13420,
1095,
2433,
1495,
30004,
13,
1678,
260,
29896,
353,
260,
29906,
30004,
13,
1678,
260,
29906,
353,
260,
29941,
30004,
13,
2158,
877,
3738,
29924,
742,
1095,
2433,
1495,
2
] |
builder_engine/custom_components/__init__.py | DiablosWhisper/machine_learning_toolpack | 0 | 166672 | <reponame>DiablosWhisper/machine_learning_toolpack<filename>builder_engine/custom_components/__init__.py
from .optimizers import *
from .callbacks import *
from .metrics import *
from .losses import *
from .layers import * | [
1,
529,
276,
1112,
420,
29958,
12130,
370,
5409,
8809,
275,
546,
29914,
23523,
29918,
21891,
29918,
10154,
4058,
29966,
9507,
29958,
16409,
29918,
10599,
29914,
6341,
29918,
14036,
29914,
1649,
2344,
26914,
2272,
13,
3166,
869,
20640,
19427,
1053,
334,
13,
3166,
869,
14035,
29879,
1053,
334,
13,
3166,
869,
2527,
10817,
1053,
334,
13,
3166,
869,
6758,
267,
1053,
334,
13,
3166,
869,
29277,
1053,
334,
2
] |
web/migrations/0007_auto_20180824_0925.py | zinaukarenku/zkr-platform | 2 | 7360 | <filename>web/migrations/0007_auto_20180824_0925.py<gh_stars>1-10
# Generated by Django 2.1 on 2018-08-24 09:25
from django.db import migrations, models
import web.models
class Migration(migrations.Migration):
dependencies = [
('web', '0006_organizationmember_user'),
]
operations = [
migrations.AlterField(
model_name='organizationpartner',
name='logo',
field=models.ImageField(upload_to=web.models.OrganizationPartner._organization_partner_logo_file),
),
]
| [
1,
529,
9507,
29958,
2676,
29914,
26983,
800,
29914,
29900,
29900,
29900,
29955,
29918,
6921,
29918,
29906,
29900,
29896,
29947,
29900,
29947,
29906,
29946,
29918,
29900,
29929,
29906,
29945,
29889,
2272,
29966,
12443,
29918,
303,
1503,
29958,
29896,
29899,
29896,
29900,
13,
29937,
3251,
630,
491,
15337,
29871,
29906,
29889,
29896,
373,
29871,
29906,
29900,
29896,
29947,
29899,
29900,
29947,
29899,
29906,
29946,
29871,
29900,
29929,
29901,
29906,
29945,
13,
13,
3166,
9557,
29889,
2585,
1053,
9725,
800,
29892,
4733,
13,
5215,
1856,
29889,
9794,
13,
13,
13,
1990,
341,
16783,
29898,
26983,
800,
29889,
29924,
16783,
1125,
13,
13,
1678,
9962,
353,
518,
13,
4706,
6702,
2676,
742,
525,
29900,
29900,
29900,
29953,
29918,
6388,
2133,
14242,
29918,
1792,
5477,
13,
1678,
4514,
13,
13,
1678,
6931,
353,
518,
13,
4706,
9725,
800,
29889,
2499,
357,
3073,
29898,
13,
9651,
1904,
29918,
978,
2433,
6388,
2133,
1595,
1089,
742,
13,
9651,
1024,
2433,
14569,
742,
13,
9651,
1746,
29922,
9794,
29889,
2940,
3073,
29898,
9009,
29918,
517,
29922,
2676,
29889,
9794,
29889,
27356,
2133,
7439,
1089,
3032,
6388,
2133,
29918,
1595,
1089,
29918,
14569,
29918,
1445,
511,
13,
4706,
10353,
13,
1678,
4514,
13,
2
] |
AsRoot/app/views.py | erin-hughes/qradar-sample-apps | 8 | 25383 | <reponame>erin-hughes/qradar-sample-apps
# Copyright 2020 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from flask import Blueprint
# pylint: disable=invalid-name
viewsbp = Blueprint('viewsbp', __name__, url_prefix='/')
# Simple endpoint that displays the contents of sudoers
@viewsbp.route('/index')
def index():
with open('/opt/app-root/sudoers', 'r') as file:
text_formatted = " "
for line in file:
text_formatted += line + "</br>"
file.close()
return text_formatted
| [
1,
529,
276,
1112,
420,
29958,
261,
262,
29899,
29882,
6129,
267,
29914,
29939,
3665,
279,
29899,
11249,
29899,
13371,
13,
29937,
14187,
1266,
29871,
29906,
29900,
29906,
29900,
27955,
15025,
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,
3166,
29784,
1053,
10924,
2158,
13,
13,
29937,
282,
2904,
524,
29901,
11262,
29922,
20965,
29899,
978,
13,
7406,
25288,
353,
10924,
2158,
877,
7406,
25288,
742,
4770,
978,
1649,
29892,
3142,
29918,
13506,
2433,
29914,
1495,
13,
13,
13,
29937,
12545,
16248,
393,
14423,
278,
8118,
310,
9196,
414,
13,
29992,
7406,
25288,
29889,
13134,
11219,
2248,
1495,
13,
1753,
2380,
7295,
13,
1678,
411,
1722,
11219,
3670,
29914,
932,
29899,
4632,
29914,
15360,
414,
742,
525,
29878,
1495,
408,
934,
29901,
13,
4706,
1426,
29918,
689,
19667,
353,
376,
376,
13,
4706,
363,
1196,
297,
934,
29901,
13,
9651,
1426,
29918,
689,
19667,
4619,
1196,
718,
25225,
1182,
11903,
13,
1678,
934,
29889,
5358,
580,
13,
1678,
736,
1426,
29918,
689,
19667,
13,
2
] |
aztk/spark/models/plugins/spark_ui_proxy/configuration.py | Geims83/aztk | 161 | 52316 | import os
from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole
from aztk.models.plugins.plugin_file import PluginFile
dir_path = os.path.dirname(os.path.realpath(__file__))
class SparkUIProxyPlugin(PluginConfiguration):
def __init__(self):
super().__init__(
name="spark_ui_proxy",
ports=[PluginPort(internal=9999, public=True)],
target_role=PluginTargetRole.Master,
execute="spark_ui_proxy.sh",
args=["localhost:8080", "9999"],
files=[
PluginFile("spark_ui_proxy.sh", os.path.join(dir_path, "spark_ui_proxy.sh")),
PluginFile("spark_ui_proxy.py", os.path.join(dir_path, "spark_ui_proxy.py")),
],
)
| [
1,
1053,
2897,
13,
3166,
263,
2065,
29895,
29889,
9794,
29889,
12800,
29889,
8582,
29918,
13305,
1053,
1858,
3851,
8614,
29892,
1858,
3851,
2290,
29892,
1858,
3851,
8667,
16727,
13,
3166,
263,
2065,
29895,
29889,
9794,
29889,
12800,
29889,
8582,
29918,
1445,
1053,
1858,
3851,
2283,
13,
13,
3972,
29918,
2084,
353,
2897,
29889,
2084,
29889,
25721,
29898,
359,
29889,
2084,
29889,
6370,
2084,
22168,
1445,
1649,
876,
13,
13,
13,
1990,
20814,
3120,
14048,
16288,
29898,
16288,
8614,
1125,
13,
1678,
822,
4770,
2344,
12035,
1311,
1125,
13,
4706,
2428,
2141,
1649,
2344,
12035,
13,
9651,
1024,
543,
12597,
29918,
1481,
29918,
14701,
613,
13,
9651,
16169,
11759,
16288,
2290,
29898,
7564,
29922,
29929,
29929,
29929,
29929,
29892,
970,
29922,
5574,
29897,
1402,
13,
9651,
3646,
29918,
12154,
29922,
16288,
8667,
16727,
29889,
19203,
29892,
13,
9651,
6222,
543,
12597,
29918,
1481,
29918,
14701,
29889,
845,
613,
13,
9651,
6389,
29922,
3366,
7640,
29901,
29947,
29900,
29947,
29900,
613,
376,
29929,
29929,
29929,
29929,
12436,
13,
9651,
2066,
11759,
13,
18884,
1858,
3851,
2283,
703,
12597,
29918,
1481,
29918,
14701,
29889,
845,
613,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
2084,
29892,
376,
12597,
29918,
1481,
29918,
14701,
29889,
845,
1159,
511,
13,
18884,
1858,
3851,
2283,
703,
12597,
29918,
1481,
29918,
14701,
29889,
2272,
613,
2897,
29889,
2084,
29889,
7122,
29898,
3972,
29918,
2084,
29892,
376,
12597,
29918,
1481,
29918,
14701,
29889,
2272,
1159,
511,
13,
9651,
21251,
13,
4706,
1723,
13,
2
] |
tests/test_fetcher.py | someshchaturvedi/reference-sequence-fetcher | 0 | 165218 | from reference_sequence_fetcher.fetcher import Fetcher, handle_error
import pytest
import json
class MockResponse(object):
'''
Mock object to test handle_error function in test_handle_error_function.
It mocks the functionality of Response object from requests library
'''
def __init__(self, status_code, text=None):
self.status_code = status_code
self.text = text
def get_metadata(seq):
'''Used to retrieve metadata of sequence object using checksum. Called from
check_complete_metdata_response
'''
response = {
"metadata": {
"md5": seq.md5,
"trunc512": seq.sha512,
"length": seq.size,
"aliases": []
}
}
return json.dumps(response)
def check_complete_metdata_response(metadata, seq, checksum):
'''check_complete_metdata_response is a utility function used by
test_metadata function to remove duplication of code. It takes
response seq object and checksum ID used to query as input parameter and
assert for reponse header, status code and content
'''
assert metadata == get_metadata(seq)
def test_getter_setter_base_url_Fetcher():
'''test all scenarios of the user putting in base_url along with str() on
Fetcher object
'''
fetcher = Fetcher('172.16.58.3')
assert fetcher.get_base_url() == 'http://172.16.58.3'
fetcher.set_base_url('http://localhost')
assert fetcher.get_base_url() == 'http://localhost'
fetcher.set_base_url('http://localhost/cran')
assert fetcher.get_base_url() == 'http://localhost/cran'
fetcher.set_base_url('http://localhost/cran/')
assert fetcher.get_base_url() == 'http://localhost/cran'
assert str(fetcher) == 'http://localhost/cran'
def test_fetch_complete_sequence_retrieval(data, server):
'''test the complete sequence retrieval
'''
fetcher = Fetcher(server)
seq = data[0]
assert fetcher.fetch_sequence(seq.md5) == seq.sequence
assert Fetcher.sequence(server, seq.md5) == seq.sequence
assert fetcher._Fetcher__cache is None
def test_fetch_sub_sequence_retrieval(data, server):
'''test the sub sequence retrieval using start and end when end > start
'''
fetcher = Fetcher(server)
seq = data[0]
assert fetcher.fetch_sequence(seq.md5, start=0, end=10) \
== seq.sequence[:10]
assert fetcher.fetch_sequence(seq.md5, start=0, end=1) \
== seq.sequence[:1]
assert fetcher._Fetcher__cache is None
def test_fetch_sub_sequence_retrieval_one_parameter(data, server):
'''test the sub sequence retrieval using start and end when only one of the
start and end is given
'''
fetcher = Fetcher(server)
seq = data[0]
assert fetcher.fetch_sequence(seq.md5, end=5) == 'CCACA'
assert fetcher._Fetcher__cache == \
json.loads(get_metadata(seq))
assert fetcher.fetch_sequence(seq.md5, start=0) == seq.sequence
def test_fetch_circular_sub_sequence_retrieval(data, server):
'''test the sub sequence retrieval using start and end when end <= start
'''
fetcher = Fetcher(server)
assert fetcher.fetch_sequence(data[2].md5, start=5374, end=5) == \
'ATCCAACCTGCAGAGTT'
assert fetcher._Fetcher__cache is None
@pytest.mark.parametrize("_input, _output", [
(400, 'Check the parameters provided i.e start, end, fbs and lbs.'),
(404, 'Checksum identifier provided can not be found.'),
(415, 'Encoding is not supported by the server.'),
(416, 'Range can not be satisfied.'),
(500, 'There maybe some internal server error.')
])
def test_handle_error_function_sequence(server, _input, _output):
'''Uses MockResponse object to test handle_error function
'''
with pytest.raises(Exception) as excinfo:
handle_error(MockResponse(_input), 'sequence')
assert str(excinfo.value) == _output
@pytest.mark.parametrize("_input, _output", [
(400, 'Bad Request.'),
(404, 'Path does not exsist.')
])
def test_handle_error_function_metadata_info(server, _input, _output):
'''Uses MockResponse object to test handle_error function
'''
with pytest.raises(Exception) as excinfo:
handle_error(MockResponse(_input), 'metadata')
assert str(excinfo.value) == _output
def test_warning_501_handle_error_function(server):
'''Uses MockResponse object to test warning issued in case of 501 from
handle_error function
'''
with pytest.warns(UserWarning, match='Circular support is not implemented in the server'):
handle_error(MockResponse(501), 'sequence')
def test_metadata(server, data):
'''Uses check_complete_metdata_response utility function to test metadata
retrieval from fetch_metadata and Fetch.metadata using a mock server.
'''
seq = data[0]
fetcher = Fetcher(server)
check_complete_metdata_response(
fetcher.fetch_metadata(seq.md5), seq, seq.md5)
check_complete_metdata_response(
Fetcher.metadata(server, seq.md5), seq, seq.md5)
def check_complete_info_response(info):
assert "circular_supported" in info
assert "algorithms" in info
assert "subsequence_limit" in info
assert "supported_api_versions" in info
def test_service_info(server):
'''Test info retrieval from fetch_info and Fetch.info using a mock server.
'''
fetcher = Fetcher(server)
check_complete_info_response(fetcher.fetch_info())
check_complete_info_response(Fetcher.info(server))
| [
1,
515,
3407,
29918,
16506,
29918,
9155,
261,
29889,
9155,
261,
1053,
383,
3486,
261,
29892,
4386,
29918,
2704,
13,
5215,
11451,
1688,
13,
5215,
4390,
13,
13,
13,
1990,
26297,
5103,
29898,
3318,
1125,
13,
1678,
14550,
13,
1678,
26297,
1203,
304,
1243,
4386,
29918,
2704,
740,
297,
1243,
29918,
8411,
29918,
2704,
29918,
2220,
29889,
13,
1678,
739,
11187,
29879,
278,
9863,
310,
13291,
1203,
515,
7274,
3489,
13,
1678,
14550,
13,
1678,
822,
4770,
2344,
12035,
1311,
29892,
4660,
29918,
401,
29892,
1426,
29922,
8516,
1125,
13,
4706,
1583,
29889,
4882,
29918,
401,
353,
4660,
29918,
401,
13,
4706,
1583,
29889,
726,
353,
1426,
13,
13,
13,
1753,
679,
29918,
19635,
29898,
11762,
1125,
13,
1678,
14550,
29965,
8485,
304,
10563,
15562,
310,
5665,
1203,
773,
1423,
2083,
29889,
3037,
839,
515,
13,
1678,
1423,
29918,
8835,
29918,
2527,
1272,
29918,
5327,
13,
1678,
14550,
13,
1678,
2933,
353,
426,
13,
4706,
376,
19635,
1115,
426,
13,
9651,
376,
3487,
29945,
1115,
19359,
29889,
3487,
29945,
29892,
13,
9651,
376,
509,
4661,
29945,
29896,
29906,
1115,
19359,
29889,
17051,
29945,
29896,
29906,
29892,
13,
9651,
376,
2848,
1115,
19359,
29889,
2311,
29892,
13,
9651,
376,
2606,
2129,
1115,
5159,
13,
4706,
500,
13,
1678,
500,
13,
1678,
736,
4390,
29889,
29881,
17204,
29898,
5327,
29897,
13,
13,
13,
1753,
1423,
29918,
8835,
29918,
2527,
1272,
29918,
5327,
29898,
19635,
29892,
19359,
29892,
1423,
2083,
1125,
13,
1678,
14550,
3198,
29918,
8835,
29918,
2527,
1272,
29918,
5327,
338,
263,
19725,
740,
1304,
491,
13,
1678,
1243,
29918,
19635,
740,
304,
3349,
5141,
1414,
310,
775,
29889,
739,
4893,
13,
1678,
2933,
19359,
1203,
322,
1423,
2083,
3553,
1304,
304,
2346,
408,
1881,
3443,
322,
13,
1678,
4974,
363,
337,
1713,
4839,
29892,
4660,
775,
322,
2793,
13,
1678,
14550,
13,
13,
1678,
4974,
15562,
1275,
679,
29918,
19635,
29898,
11762,
29897,
13,
13,
13,
1753,
1243,
29918,
657,
357,
29918,
842,
357,
29918,
3188,
29918,
2271,
29918,
20927,
261,
7295,
13,
1678,
14550,
1688,
599,
21846,
310,
278,
1404,
10594,
297,
2967,
29918,
2271,
3412,
411,
851,
580,
373,
13,
1678,
383,
3486,
261,
1203,
13,
1678,
14550,
13,
1678,
6699,
261,
353,
383,
3486,
261,
877,
29896,
29955,
29906,
29889,
29896,
29953,
29889,
29945,
29947,
29889,
29941,
1495,
13,
1678,
4974,
6699,
261,
29889,
657,
29918,
3188,
29918,
2271,
580,
1275,
525,
1124,
597,
29896,
29955,
29906,
29889,
29896,
29953,
29889,
29945,
29947,
29889,
29941,
29915,
13,
13,
1678,
6699,
261,
29889,
842,
29918,
3188,
29918,
2271,
877,
1124,
597,
7640,
1495,
13,
1678,
4974,
6699,
261,
29889,
657,
29918,
3188,
29918,
2271,
580,
1275,
525,
1124,
597,
7640,
29915,
13,
13,
1678,
6699,
261,
29889,
842,
29918,
3188,
29918,
2271,
877,
1124,
597,
7640,
29914,
29883,
661,
1495,
13,
1678,
4974,
6699,
261,
29889,
657,
29918,
3188,
29918,
2271,
580,
1275,
525,
1124,
597,
7640,
29914,
29883,
661,
29915,
13,
13,
1678,
6699,
261,
29889,
842,
29918,
3188,
29918,
2271,
877,
1124,
597,
7640,
29914,
29883,
661,
29914,
1495,
13,
1678,
4974,
6699,
261,
29889,
657,
29918,
3188,
29918,
2271,
580,
1275,
525,
1124,
597,
7640,
29914,
29883,
661,
29915,
13,
13,
1678,
4974,
851,
29898,
9155,
261,
29897,
1275,
525,
1124,
597,
7640,
29914,
29883,
661,
29915,
13,
13,
13,
1753,
1243,
29918,
9155,
29918,
8835,
29918,
16506,
29918,
276,
509,
16837,
29898,
1272,
29892,
1923,
1125,
13,
1678,
14550,
1688,
278,
4866,
5665,
5663,
16837,
13,
1678,
14550,
13,
1678,
6699,
261,
353,
383,
3486,
261,
29898,
2974,
29897,
13,
1678,
19359,
353,
848,
29961,
29900,
29962,
13,
1678,
4974,
6699,
261,
29889,
9155,
29918,
16506,
29898,
11762,
29889,
3487,
29945,
29897,
1275,
19359,
29889,
16506,
13,
1678,
4974,
383,
3486,
261,
29889,
16506,
29898,
2974,
29892,
19359,
29889,
3487,
29945,
29897,
1275,
19359,
29889,
16506,
13,
1678,
4974,
6699,
261,
3032,
20927,
261,
1649,
8173,
338,
6213,
13,
13,
13,
1753,
1243,
29918,
9155,
29918,
1491,
29918,
16506,
29918,
276,
509,
16837,
29898,
1272,
29892,
1923,
1125,
13,
1678,
14550,
1688,
278,
1014,
5665,
5663,
16837,
773,
1369,
322,
1095,
746,
1095,
1405,
1369,
13,
1678,
14550,
13,
1678,
6699,
261,
353,
383,
3486,
261,
29898,
2974,
29897,
13,
1678,
19359,
353,
848,
29961,
29900,
29962,
13,
1678,
4974,
6699,
261,
29889,
9155,
29918,
16506,
29898,
11762,
29889,
3487,
29945,
29892,
1369,
29922,
29900,
29892,
1095,
29922,
29896,
29900,
29897,
320,
13,
4706,
1275,
19359,
29889,
16506,
7503,
29896,
29900,
29962,
13,
1678,
4974,
6699,
261,
29889,
9155,
29918,
16506,
29898,
11762,
29889,
3487,
29945,
29892,
1369,
29922,
29900,
29892,
1095,
29922,
29896,
29897,
320,
13,
4706,
1275,
19359,
29889,
16506,
7503,
29896,
29962,
13,
1678,
4974,
6699,
261,
3032,
20927,
261,
1649,
8173,
338,
6213,
13,
13,
13,
1753,
1243,
29918,
9155,
29918,
1491,
29918,
16506,
29918,
276,
509,
16837,
29918,
650,
29918,
15501,
29898,
1272,
29892,
1923,
1125,
13,
1678,
14550,
1688,
278,
1014,
5665,
5663,
16837,
773,
1369,
322,
1095,
746,
871,
697,
310,
278,
13,
1678,
1369,
322,
1095,
338,
2183,
13,
1678,
14550,
13,
1678,
6699,
261,
353,
383,
3486,
261,
29898,
2974,
29897,
13,
1678,
19359,
353,
848,
29961,
29900,
29962,
13,
1678,
4974,
6699,
261,
29889,
9155,
29918,
16506,
29898,
11762,
29889,
3487,
29945,
29892,
1095,
29922,
29945,
29897,
1275,
525,
4174,
2477,
29909,
29915,
13,
1678,
4974,
6699,
261,
3032,
20927,
261,
1649,
8173,
1275,
320,
13,
4706,
4390,
29889,
18132,
29898,
657,
29918,
19635,
29898,
11762,
876,
13,
1678,
4974,
6699,
261,
29889,
9155,
29918,
16506,
29898,
11762,
29889,
3487,
29945,
29892,
1369,
29922,
29900,
29897,
1275,
19359,
29889,
16506,
13,
13,
13,
1753,
1243,
29918,
9155,
29918,
6034,
1070,
29918,
1491,
29918,
16506,
29918,
276,
509,
16837,
29898,
1272,
29892,
1923,
1125,
13,
1678,
14550,
1688,
278,
1014,
5665,
5663,
16837,
773,
1369,
322,
1095,
746,
1095,
5277,
1369,
13,
1678,
14550,
13,
1678,
6699,
261,
353,
383,
3486,
261,
29898,
2974,
29897,
13,
1678,
4974,
6699,
261,
29889,
9155,
29918,
16506,
29898,
1272,
29961,
29906,
1822,
3487,
29945,
29892,
1369,
29922,
29945,
29941,
29955,
29946,
29892,
1095,
29922,
29945,
29897,
1275,
320,
13,
4706,
525,
1299,
4174,
29909,
2477,
1783,
29954,
5454,
29954,
10051,
19988,
29915,
13,
1678,
4974,
6699,
261,
3032,
20927,
261,
1649,
8173,
338,
6213,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
29918,
2080,
29892,
903,
4905,
613,
518,
13,
1678,
313,
29946,
29900,
29900,
29892,
525,
5596,
278,
4128,
4944,
474,
29889,
29872,
1369,
29892,
1095,
29892,
285,
5824,
322,
301,
5824,
29889,
5477,
13,
1678,
313,
29946,
29900,
29946,
29892,
525,
5596,
2083,
15882,
4944,
508,
451,
367,
1476,
29889,
5477,
13,
1678,
313,
29946,
29896,
29945,
29892,
525,
14934,
338,
451,
6969,
491,
278,
1923,
29889,
5477,
13,
1678,
313,
29946,
29896,
29953,
29892,
525,
6069,
508,
451,
367,
15787,
29889,
5477,
13,
1678,
313,
29945,
29900,
29900,
29892,
525,
8439,
5505,
777,
7463,
1923,
1059,
29889,
1495,
13,
13,
2314,
13,
1753,
1243,
29918,
8411,
29918,
2704,
29918,
2220,
29918,
16506,
29898,
2974,
29892,
903,
2080,
29892,
903,
4905,
1125,
13,
1678,
14550,
15922,
267,
26297,
5103,
1203,
304,
1243,
4386,
29918,
2704,
740,
13,
1678,
14550,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
2451,
29897,
408,
5566,
3888,
29901,
13,
4706,
4386,
29918,
2704,
29898,
18680,
5103,
7373,
2080,
511,
525,
16506,
1495,
13,
1678,
4974,
851,
29898,
735,
29883,
3888,
29889,
1767,
29897,
1275,
903,
4905,
13,
13,
13,
29992,
2272,
1688,
29889,
3502,
29889,
3207,
300,
374,
911,
703,
29918,
2080,
29892,
903,
4905,
613,
518,
13,
1678,
313,
29946,
29900,
29900,
29892,
525,
22050,
10729,
29889,
5477,
13,
1678,
313,
29946,
29900,
29946,
29892,
525,
2605,
947,
451,
429,
29879,
391,
29889,
1495,
13,
2314,
13,
1753,
1243,
29918,
8411,
29918,
2704,
29918,
2220,
29918,
19635,
29918,
3888,
29898,
2974,
29892,
903,
2080,
29892,
903,
4905,
1125,
13,
1678,
14550,
15922,
267,
26297,
5103,
1203,
304,
1243,
4386,
29918,
2704,
740,
13,
1678,
14550,
13,
1678,
411,
11451,
1688,
29889,
336,
4637,
29898,
2451,
29897,
408,
5566,
3888,
29901,
13,
4706,
4386,
29918,
2704,
29898,
18680,
5103,
7373,
2080,
511,
525,
19635,
1495,
13,
1678,
4974,
851,
29898,
735,
29883,
3888,
29889,
1767,
29897,
1275,
903,
4905,
13,
13,
13,
1753,
1243,
29918,
27392,
29918,
29945,
29900,
29896,
29918,
8411,
29918,
2704,
29918,
2220,
29898,
2974,
1125,
13,
1678,
14550,
15922,
267,
26297,
5103,
1203,
304,
1243,
9177,
16610,
297,
1206,
310,
29871,
29945,
29900,
29896,
515,
13,
1678,
4386,
29918,
2704,
740,
13,
1678,
14550,
13,
1678,
411,
11451,
1688,
29889,
4495,
1983,
29898,
2659,
22709,
29892,
1993,
2433,
23495,
1070,
2304,
338,
451,
8762,
297,
278,
1923,
29374,
13,
4706,
4386,
29918,
2704,
29898,
18680,
5103,
29898,
29945,
29900,
29896,
511,
525,
16506,
1495,
13,
13,
13,
1753,
1243,
29918,
19635,
29898,
2974,
29892,
848,
1125,
13,
1678,
14550,
15922,
267,
1423,
29918,
8835,
29918,
2527,
1272,
29918,
5327,
19725,
740,
304,
1243,
15562,
13,
1678,
5663,
16837,
515,
6699,
29918,
19635,
322,
383,
3486,
29889,
19635,
773,
263,
11187,
1923,
29889,
13,
1678,
14550,
13,
1678,
19359,
353,
848,
29961,
29900,
29962,
13,
1678,
6699,
261,
353,
383,
3486,
261,
29898,
2974,
29897,
13,
1678,
1423,
29918,
8835,
29918,
2527,
1272,
29918,
5327,
29898,
13,
4706,
6699,
261,
29889,
9155,
29918,
19635,
29898,
11762,
29889,
3487,
29945,
511,
19359,
29892,
19359,
29889,
3487,
29945,
29897,
13,
1678,
1423,
29918,
8835,
29918,
2527,
1272,
29918,
5327,
29898,
13,
9651,
383,
3486,
261,
29889,
19635,
29898,
2974,
29892,
19359,
29889,
3487,
29945,
511,
19359,
29892,
19359,
29889,
3487,
29945,
29897,
13,
13,
13,
1753,
1423,
29918,
8835,
29918,
3888,
29918,
5327,
29898,
3888,
1125,
13,
1678,
4974,
376,
6034,
1070,
29918,
23765,
29908,
297,
5235,
13,
1678,
4974,
376,
9564,
12404,
29908,
297,
5235,
13,
1678,
4974,
376,
1491,
16506,
29918,
13400,
29908,
297,
5235,
13,
1678,
4974,
376,
23765,
29918,
2754,
29918,
26100,
29908,
297,
5235,
13,
13,
13,
1753,
1243,
29918,
5509,
29918,
3888,
29898,
2974,
1125,
13,
1678,
14550,
3057,
5235,
5663,
16837,
515,
6699,
29918,
3888,
322,
383,
3486,
29889,
3888,
773,
263,
11187,
1923,
29889,
13,
1678,
14550,
13,
1678,
6699,
261,
353,
383,
3486,
261,
29898,
2974,
29897,
13,
1678,
1423,
29918,
8835,
29918,
3888,
29918,
5327,
29898,
9155,
261,
29889,
9155,
29918,
3888,
3101,
13,
1678,
1423,
29918,
8835,
29918,
3888,
29918,
5327,
29898,
20927,
261,
29889,
3888,
29898,
2974,
876,
13,
2
] |
autotest/t056_test_pcg_fmt.py | ritchie46/flopy | 1 | 1608378 | <reponame>ritchie46/flopy
# -*- coding: utf-8 -*-
"""
This simple script tests that the pcg load function works for both free-
and fixed-format pcg files for mf2005 models.
Refer to pull request #311: "Except block to forgive old fixed format pcg
for post-mf2k model versions" for more details.
"""
import os
import flopy as fp
pcg_fname = os.path.join("..","examples", "data", "pcg_fmt_test", "fixfmt.pcg")
def pcg_fmt_test():
# mf2k container - this will pass
m2k = fp.modflow.Modflow(version='mf2k')
m2k.pcg = fp.modflow.ModflowPcg.load(model=m2k,
f=pcg_fname)
# mf2005 container
m05 = fp.modflow.Modflow(version='mf2005')
m05.pcg = fp.modflow.ModflowPcg.load(model=m05,
f=pcg_fname)
# this will exit with ValueError without the except block added in pull req
assert m2k.pcg.rclose == m05.pcg.rclose
assert m2k.pcg.damp == m05.pcg.damp
return
if __name__ == '__main__':
pcg_fmt_test()
| [
1,
529,
276,
1112,
420,
29958,
768,
305,
347,
29946,
29953,
29914,
29888,
417,
2272,
13,
29937,
448,
29930,
29899,
14137,
29901,
23616,
29899,
29947,
448,
29930,
29899,
13,
15945,
29908,
13,
4013,
2560,
2471,
6987,
393,
278,
22844,
29887,
2254,
740,
1736,
363,
1716,
3889,
29899,
13,
392,
4343,
29899,
4830,
22844,
29887,
2066,
363,
286,
29888,
29906,
29900,
29900,
29945,
4733,
29889,
13,
13,
1123,
571,
304,
8206,
2009,
396,
29941,
29896,
29896,
29901,
376,
1252,
1547,
2908,
304,
18879,
573,
2030,
4343,
3402,
22844,
29887,
13,
1454,
1400,
29899,
29885,
29888,
29906,
29895,
1904,
6910,
29908,
363,
901,
4902,
29889,
13,
15945,
29908,
13,
13,
5215,
2897,
13,
5215,
5685,
2272,
408,
285,
29886,
13,
13,
6739,
29887,
29918,
29888,
978,
353,
2897,
29889,
2084,
29889,
7122,
703,
636,
3284,
19057,
613,
376,
1272,
613,
376,
6739,
29887,
29918,
23479,
29918,
1688,
613,
376,
5878,
23479,
29889,
6739,
29887,
1159,
13,
13,
1753,
22844,
29887,
29918,
23479,
29918,
1688,
7295,
13,
1678,
396,
286,
29888,
29906,
29895,
5639,
448,
445,
674,
1209,
13,
1678,
286,
29906,
29895,
353,
285,
29886,
29889,
1545,
1731,
29889,
2111,
1731,
29898,
3259,
2433,
29885,
29888,
29906,
29895,
1495,
13,
1678,
286,
29906,
29895,
29889,
6739,
29887,
353,
285,
29886,
29889,
1545,
1731,
29889,
2111,
1731,
29925,
29883,
29887,
29889,
1359,
29898,
4299,
29922,
29885,
29906,
29895,
29892,
29871,
13,
462,
462,
268,
285,
29922,
6739,
29887,
29918,
29888,
978,
29897,
13,
268,
13,
1678,
396,
286,
29888,
29906,
29900,
29900,
29945,
5639,
13,
1678,
286,
29900,
29945,
353,
285,
29886,
29889,
1545,
1731,
29889,
2111,
1731,
29898,
3259,
2433,
29885,
29888,
29906,
29900,
29900,
29945,
1495,
13,
1678,
286,
29900,
29945,
29889,
6739,
29887,
353,
285,
29886,
29889,
1545,
1731,
29889,
2111,
1731,
29925,
29883,
29887,
29889,
1359,
29898,
4299,
29922,
29885,
29900,
29945,
29892,
29871,
13,
462,
462,
285,
29922,
6739,
29887,
29918,
29888,
978,
29897,
13,
1678,
396,
445,
674,
6876,
411,
7865,
2392,
1728,
278,
5174,
2908,
2715,
297,
8206,
12428,
13,
268,
13,
1678,
4974,
286,
29906,
29895,
29889,
6739,
29887,
29889,
2214,
2226,
1275,
286,
29900,
29945,
29889,
6739,
29887,
29889,
2214,
2226,
13,
1678,
4974,
286,
29906,
29895,
29889,
6739,
29887,
29889,
29881,
1160,
1275,
286,
29900,
29945,
29889,
6739,
29887,
29889,
29881,
1160,
13,
268,
13,
1678,
736,
13,
268,
13,
361,
4770,
978,
1649,
1275,
525,
1649,
3396,
1649,
2396,
13,
1678,
22844,
29887,
29918,
23479,
29918,
1688,
580,
13,
2
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.