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
tests/test_win_app.py
koyoki/Airtest
6,140
28502
# encoding=utf-8 from airtest.core.win import Windows import unittest import numpy import time from testconf import try_remove SNAPSHOT = "win_snapshot.png" class TestWin(unittest.TestCase): @classmethod def setUpClass(cls): w = Windows() w.start_app("calc") time.sleep(1) cls.windows = Windows(title_re=".*计算器.*".decode("utf-8")) def test_snapshot(self): try_remove(SNAPSHOT) result = self.windows.snapshot(filename=SNAPSHOT) self.assertIsInstance(result, numpy.ndarray) try_remove(SNAPSHOT) def test_touch(self): self.windows.touch((11, 11)) def test_swipe(self): self.windows.swipe((11, 11), (100, 100)) @classmethod def tearDownClass(cls): cls.windows.app.kill() if __name__ == '__main__': unittest.main()
[ 1, 396, 8025, 29922, 9420, 29899, 29947, 13, 3166, 4799, 1688, 29889, 3221, 29889, 5080, 1053, 3852, 13, 5215, 443, 27958, 13, 5215, 12655, 13, 5215, 931, 13, 3166, 1243, 5527, 1053, 1018, 29918, 5992, 13, 13, 13, 19296, 3301, 7068, 2891, 353, 376, 5080, 29918, 29879, 14551, 29889, 2732, 29908, 13, 13, 13, 1990, 4321, 17734, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 731, 3373, 2385, 29898, 25932, 1125, 13, 4706, 281, 353, 3852, 580, 13, 4706, 281, 29889, 2962, 29918, 932, 703, 28667, 1159, 13, 4706, 931, 29889, 17059, 29898, 29896, 29897, 13, 4706, 1067, 29879, 29889, 10499, 353, 3852, 29898, 3257, 29918, 276, 543, 5575, 31466, 31565, 30943, 5575, 1642, 13808, 703, 9420, 29899, 29947, 5783, 13, 13, 1678, 822, 1243, 29918, 29879, 14551, 29898, 1311, 1125, 13, 4706, 1018, 29918, 5992, 29898, 19296, 3301, 7068, 2891, 29897, 13, 4706, 1121, 353, 1583, 29889, 10499, 29889, 29879, 14551, 29898, 9507, 29922, 19296, 3301, 7068, 2891, 29897, 13, 4706, 1583, 29889, 9294, 3624, 4998, 29898, 2914, 29892, 12655, 29889, 299, 2378, 29897, 13, 4706, 1018, 29918, 5992, 29898, 19296, 3301, 7068, 2891, 29897, 13, 13, 1678, 822, 1243, 29918, 16747, 29898, 1311, 1125, 13, 4706, 1583, 29889, 10499, 29889, 16747, 3552, 29896, 29896, 29892, 29871, 29896, 29896, 876, 13, 13, 1678, 822, 1243, 29918, 2774, 15705, 29898, 1311, 1125, 13, 4706, 1583, 29889, 10499, 29889, 2774, 15705, 3552, 29896, 29896, 29892, 29871, 29896, 29896, 511, 313, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 876, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 734, 279, 6767, 2385, 29898, 25932, 1125, 13, 4706, 1067, 29879, 29889, 10499, 29889, 932, 29889, 21174, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
tools/rest_integration_test.py
osrf/cloudsim-legacy
0
27244
#!/usr/bin/env python from __future__ import print_function import os import sys import unittest import time import datetime import logging from cloudsim_rest_api import CloudSimRestApi import traceback # add cloudsim directory to system path basepath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) sys.path.insert(0, basepath) print (sys.path) import cloudsimd.launchers.cloudsim as cloudsim from cloudsimd.launchers.launch_utils.launch_db import ConstellationState from cloudsimd.launchers.launch_utils.launch_db import get_unique_short_name from cloudsimd.launchers.launch_utils.testing import get_test_runner from cloudsimd.launchers.launch_utils.testing import get_boto_path from cloudsimd.launchers.launch_utils.testing import get_test_path CLOUDSIM_CONFIG = "CloudSim-stable (m1.small)" SIM_CONFIG = "Simulator-stable (g2.2xlarge)" # Simulator-stable (cg1.4xlarge) CLOUD_CREDS = "aws" CLOUD_REGION = "us-east-1" try: logging.basicConfig(filename='/tmp/rest_integration_test.log', format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', level=logging.DEBUG) except Exception, e: print("Can't enable logging: %s" % e) def create_task_dict(title, launch_file='vrc_task_1.launch'): """ Generates a simple task for testing purposes """ def _get_now_str(days_offset=0): """ Returns a utc string date time format of now, with optional offset. """ dt = datetime.timedelta(days=days_offset) now = datetime.datetime.utcnow() t = now - dt s = t.isoformat() return s task = {} task['task_title'] = title task['ros_package'] = 'drcsim_gazebo' task['ros_launch'] = launch_file task['launch_args'] = '' task['timeout'] = '3600' task['latency'] = '0' task['uplink_data_cap'] = '0' task['downlink_data_cap'] = '0' task['local_start'] = _get_now_str(-1) # yesterday task['local_stop'] = _get_now_str(1) # tomorrow task['bash_src'] = "/home/ubuntu/cloudsim/sim_setup.bash" task['vrc_id'] = 1 task['vrc_num'] = 1 return task class RestException(Exception): pass def _diff_list(a, b): """ Compares 2 lists and returns the elements in list a only """ b = set(b) return [aa for aa in a if aa not in b] def launch_constellation_and_wait(api, config, max_count=100): """ Launch a new constellation, waits for it to appear, and returns the new constellation name """ # we're about to create a new constellation... this may not # be the first previous_constellations = [x['constellation_name'] \ for x in api.get_constellations()] api.launch_constellation(CLOUD_CREDS, CLOUD_REGION, config) print("waiting 10 secs") time.sleep(10) found = False count = 0 constellation_name = None while not found: count += 1 if count > max_count: raise RestException("Timeout in Launch %s" % config) constellation_list = api.get_constellations() current_names = [x['constellation_name'] \ for x in constellation_list] new_constellations = _diff_list(current_names, previous_constellations) print ("%s/%s) new constellations: %s" % (count, max_count, new_constellations)) if len(new_constellations) > 0: found = True constellation_name = new_constellations[0] return constellation_name def terminate_constellation(api, constellation_name, sleep_secs=2, max_count=100): """ Terminates a constellation and waits until the process is done. """ def exists(api, constellation_name): constellation_list = api.get_constellations() current_names = [x['constellation_name'] \ for x in constellation_list] return constellation_name in current_names constellation_exists = exists(api, constellation_name) if not constellation_exists: raise RestException("terminate_constellation: " "Constellation '%s' not found" % constellation_name) # send the termination signal api.terminate_constellation(constellation_name) count = 0 while constellation_exists: time.sleep(sleep_secs) count += 1 if count > max_count: raise RestException("Timeout in terminate_constellation %s" % ( constellation_name)) constellation_exists = exists(api, constellation_name) print("%s/%s %s exists: %s" % (count, max_count, constellation_name, constellation_exists)) def wait_for_constellation_state(api, constellation_name, key="constellation_state", value="running", max_count=100, sleep_secs=5): """ Polls constellation state key until its value matches value. This is used to wait until a constellation is ready to run simulations """ count = 0 while True: time.sleep(sleep_secs) count += 1 if count > max_count: raise RestException("Timeout in wait for %s = %s " " for %s" % (key, value, constellation_name)) const_data = api.get_constellation_data(constellation_name) state = const_data[key] print("%s/%s) %s [%s] = %s" % (count, max_count, constellation_name, key, state)) if state == value: return const_data def create_task(cloudsim_api, constellation_name, task_dict): """ Creates a new task and retrieves the id of the new task. This requires comparing task names before and after creation """ def task_names(): const_data = cloudsim_api.get_constellation_data(constellation_name) task_names = [x['task_id'] for x in const_data['tasks']] return task_names previous_tasks = task_names() cloudsim_api.create_task(constellation_name, task_dict) new_tasks = task_names() delta_tasks = _diff_list(new_tasks, previous_tasks) new_task_id = delta_tasks[0] return new_task_id def wait_for_task_state(cloudsim_api, constellation_name, task_id, target_state, max_count=100, sleep_secs=1): """ Wait until the task is in a target state (ex "running", or "stopped") """ count = 0 while True: time.sleep(sleep_secs) count += 1 if count > max_count: raise RestException("Timeout in start_task" "%s for %s" % (task_id, constellation_name)) task_dict = cloudsim_api.read_task(constellation_name, task_id) current_state = task_dict['task_state'] print("%s/%s Task %s: %s" % (count, max_count, task_id, current_state)) if current_state == target_state: return def run_task(cloudsim_api, constellation_name, task_id, max_count=100, sleep_secs=1): """ Starts a task and waits for its status to be "running" """ # check task task_dict = cloudsim_api.read_task(constellation_name, task_id) state = task_dict['task_state'] if state != "ready": raise RestException("Can't start task in state '%s'" % state) # run task cloudsim_api.start_task(constellation_name, task_id) wait_for_task_state(cloudsim_api, constellation_name, task_id, 'running', max_count, sleep_secs) def run_notebook(cloudsim_api, constellation_name): """ Starts the notebook service and waits for its status to be "running" """ cloudsim_api.start_notebook(constellation_name) count=100 while count > 0: time.sleep(5) count -= 1 r = cloudsim_api.ping_notebook(constellation_name) print("%s/100 notebook state: %s" % (count, r)) if r == "running": return raise RestException("Can't start notebook on %s" % constellation_name) def stop_notebook(cloudsim_api, constellation_name): """ Stops the notebook service and waits for its status to "stopped" """ cloudsim_api.stop_notebook(constellation_name) count=100 while count > 0: print("count %s/100" % count) time.sleep(5) count -= 1 r = cloudsim_api.ping_notebook(constellation_name) print("%s/100 notebook state: %s" % (count, r)) if r == "": return raise RestException("Can't start notebook on %s" % constellation_name) def run_gzweb(cloudsim_api, constellation_name): """ Starts the gzweb service and waits for its status to be "running" """ cloudsim_api.start_gzweb(constellation_name) count=100 while count > 0: time.sleep(5) count -= 1 r = cloudsim_api.ping_gzweb(constellation_name) print("%s/100 gzweb state: %s" % (count, r)) if r == "running": return raise RestException("Can't start gzweb on %s" % constellation_name) def stop_gzweb(cloudsim_api, constellation_name): """ Stops the gzweb service and waits for its status to "stopped" """ cloudsim_api.stop_gzweb(constellation_name) count=100 while count > 0: print("count %s/100" % count) time.sleep(5) count -= 1 r = cloudsim_api.ping_gzweb(constellation_name) print("%s/100 gzweb state: %s" % (count, r)) if r == "": return raise RestException("Can't start notebook on %s" % constellation_name) def stop_task(cloudsim_api, constellation_name, task_id, max_count=100, sleep_secs=1): """ Stops a task and waits for its status to go from "running" to "stopped" """ # check task task_dict = cloudsim_api.read_task(constellation_name, task_id) state = task_dict['task_state'] if state != "running": raise RestException("Can't stop task in state '%s'" % state) # run task cloudsim_api.stop_task(constellation_name) wait_for_task_state(cloudsim_api, constellation_name, task_id, 'stopped', max_count, sleep_secs) def flush(): """ Fake method to avoid crashes, because flush is not present on Delegate_io class used by XMLTestRunner. """ pass class RestTest(unittest.TestCase): """ Test that Creates a CloudSim on AWS. A simulator is then launched from that CloudSim and a simulation task is run. This test is run by Jenkins when CloudSim code is modified. """ def title(self, text): print("") print("#######################################") print("#") print("# %s" % text) print("#") print("#######################################") def setUp(self): self.title("setUp") try: # provide no op flush to avoid crashes when sys.stdout and stderr # are overriden to write xml files (when running with Jenkins) sys.stdout.flush = flush sys.stderr.flush = flush except: print("Using normal sys.stdout and sys.stderr") self.cloudsim_api = None self.simulator_name = None self.papa_cloudsim_name = None self.baby_cloudsim_name = None self.user = 'admin' self.password = '<PASSWORD>' self.papa_cloudsim_name = get_unique_short_name('rst') self.data_dir = get_test_path("rest_test") self.creds_fname = get_boto_path() self.ip = None print("data dir: %s" % self.data_dir) print("cloudsim constellation: %s" % self.papa_cloudsim_name) print("user: %s, password: %s" % (self.user, self.password)) def test(self): self.title("create_cloudsim") self.ip = cloudsim.create_cloudsim(username=self.user, credentials_fname=self.creds_fname, region=CLOUD_REGION, configuration=CLOUDSIM_CONFIG, authentication_type="Basic", password=<PASSWORD>, data_dir=self.data_dir, constellation_name=self.papa_cloudsim_name) self.assertTrue(True, "cloudsim not created") print("papa cloudsim %s created in %s" % (self.ip, self.data_dir)) print("\n\n") print('api = CloudSimRestApi("%s", "%s", "%s")' % (self.ip, self.user, self.password)) self.cloudsim_api = CloudSimRestApi(self.ip, self.user, self.password) cfgs = self.cloudsim_api.get_machine_configs() try: print(cfgs.keys()) print(cfgs) cfgs_creds = cfgs[CLOUD_CREDS]['regions'] cfgs_region = cfgs_creds[CLOUD_REGION]['configurations'] cfgs_names = [x['name'] for x in cfgs_region] print("configs: %s" % cfgs_names) except Exception, e: import traceback tb = traceback.format_exc() print("traceback: %s" % tb) self.title("launch baby cloudsim") self.baby_cloudsim_name = launch_constellation_and_wait( self.cloudsim_api, config=CLOUDSIM_CONFIG) print("# baby cloudsim %s launched" % (self.baby_cloudsim_name)) self.assertTrue(True, "baby cloudsim not created") self.title("launch simulator") self.simulator_name = launch_constellation_and_wait(self.cloudsim_api, config=SIM_CONFIG) print("# Simulator %s launched" % (self.simulator_name)) self.assertTrue(True, "simulator not created") self.title("Wait for baby cloudsim readyness") print("api.get_constellation_data('%s')" % self.baby_cloudsim_name) wait_for_constellation_state(self.cloudsim_api, self.baby_cloudsim_name, key="constellation_state", value="running", max_count=100) self.assertTrue(True, "baby cloudsim not ready") print("# baby cloudsim machine ready") self.title("Update baby cloudsim") self.cloudsim_api.update_constellation(self.baby_cloudsim_name) wait_for_constellation_state(self.cloudsim_api, self.baby_cloudsim_name, key="constellation_state", value="running", max_count=100) print("# baby cloudsim machine updated") self.title("Wait for simulator readyness") print("api.get_constellation_data('%s')" % self.simulator_name) wait_for_constellation_state(self.cloudsim_api, self.simulator_name, key="launch_stage", value="running", max_count=100) self.assertTrue(True, "simulator not ready") print("# Simulator machine ready") self.title("Test notebook") run_notebook(self.cloudsim_api,self.simulator_name) stop_notebook(self.cloudsim_api,self.simulator_name) # the simulator is ready! self.title("# create task") print('tid = create_task(api, "%s", ' 'create_task_dict("test 0"))' % self.simulator_name) print("\n\n") task_dict = create_task_dict("test task 1") print("%s" % task_dict) self.task_id = create_task(self.cloudsim_api, self.simulator_name, task_dict) self.assertTrue(True, "task not created") run_task(self.cloudsim_api,self.simulator_name, self.task_id) self.title("Test gzweb") run_gzweb(self.cloudsim_api,self.simulator_name) stop_gzweb(self.cloudsim_api,self.simulator_name) self.assertTrue(True, "task not run") self.title("# stop task") stop_task(self.cloudsim_api,self.simulator_name, self.task_id) self.assertTrue(True, "task not stopped") def tearDown(self): self.title("tearDown") self.title("terminate baby cloudsim") try: if self.cloudsim_api and self.baby_cloudsim_name: terminate_constellation(self.cloudsim_api, self.baby_cloudsim_name) else: print("No baby cloudsim created") except Exception, e: print("Error terminating baby cloudsim constellation %s: %s" % ( self.baby_cloudsim_name, e)) self.title("terminate simulator") try: if self.cloudsim_api and self.simulator_name: terminate_constellation(self.cloudsim_api, self.simulator_name) else: print("No simulator created") except Exception, e: print("Error terminating simulator constellation %s: %s" % ( self.simulator_name, e)) tb = traceback.format_exc() print("traceback: %s" % tb) self.title("terminate papa cloudsim") try: if self.papa_cloudsim_name and self.ip: print("terminate cloudsim '%s' %s" % (self.papa_cloudsim_name, self.ip)) cloudsim.terminate(self.papa_cloudsim_name) # remove from Redis constellation = ConstellationState(self.papa_cloudsim_name) constellation.expire(1) except Exception, e: print("Error terminating papa cloudsim '%s' : %s" % ( self.papa_cloudsim_name, e)) tb = traceback.format_exc() print("traceback: %s" % tb) if __name__ == "__main__": xmlTestRunner = get_test_runner() unittest.main(testRunner=xmlTestRunner)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 443, 27958, 13, 5215, 931, 13, 5215, 12865, 13, 5215, 12183, 13, 13, 3166, 9570, 3601, 29918, 5060, 29918, 2754, 1053, 14293, 8942, 15078, 11713, 13, 5215, 9637, 1627, 13, 13, 29937, 788, 9570, 3601, 3884, 304, 1788, 2224, 13, 3188, 2084, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 525, 636, 8785, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 2967, 2084, 29897, 13, 2158, 313, 9675, 29889, 2084, 29897, 13, 13, 5215, 9570, 3601, 29881, 29889, 15343, 414, 29889, 9274, 3601, 408, 9570, 3601, 13, 3166, 9570, 3601, 29881, 29889, 15343, 414, 29889, 15343, 29918, 13239, 29889, 15343, 29918, 2585, 1053, 5798, 514, 362, 2792, 13, 3166, 9570, 3601, 29881, 29889, 15343, 414, 29889, 15343, 29918, 13239, 29889, 15343, 29918, 2585, 1053, 679, 29918, 13092, 29918, 12759, 29918, 978, 13, 3166, 9570, 3601, 29881, 29889, 15343, 414, 29889, 15343, 29918, 13239, 29889, 13424, 1053, 679, 29918, 1688, 29918, 27492, 13, 3166, 9570, 3601, 29881, 29889, 15343, 414, 29889, 15343, 29918, 13239, 29889, 13424, 1053, 679, 29918, 29890, 3747, 29918, 2084, 13, 3166, 9570, 3601, 29881, 29889, 15343, 414, 29889, 15343, 29918, 13239, 29889, 13424, 1053, 679, 29918, 1688, 29918, 2084, 13, 13, 13, 29907, 3927, 15789, 5425, 29924, 29918, 25903, 353, 376, 20442, 8942, 29899, 13844, 313, 29885, 29896, 29889, 9278, 5513, 13, 5425, 29924, 29918, 25903, 353, 376, 8942, 9183, 29899, 13844, 313, 29887, 29906, 29889, 29906, 29916, 16961, 5513, 29871, 396, 3439, 9183, 29899, 13844, 313, 29883, 29887, 29896, 29889, 29946, 29916, 16961, 29897, 13, 13, 29907, 3927, 15789, 29918, 22245, 8452, 353, 376, 10467, 29908, 13, 29907, 3927, 15789, 29918, 18166, 2725, 353, 376, 375, 29899, 23027, 29899, 29896, 29908, 13, 13, 2202, 29901, 13, 1678, 12183, 29889, 16121, 3991, 29898, 9507, 2433, 29914, 7050, 29914, 5060, 29918, 27925, 29918, 1688, 29889, 1188, 742, 13, 18884, 3402, 2433, 29995, 29898, 294, 312, 603, 29897, 29879, 1273, 29898, 978, 6817, 29896, 29906, 29879, 1273, 29898, 5563, 978, 6817, 29947, 29879, 1273, 29898, 4906, 29897, 29879, 742, 13, 18884, 3233, 29922, 21027, 29889, 18525, 29897, 13, 19499, 8960, 29892, 321, 29901, 13, 1678, 1596, 703, 6028, 29915, 29873, 9025, 12183, 29901, 1273, 29879, 29908, 1273, 321, 29897, 13, 13, 13, 1753, 1653, 29918, 7662, 29918, 8977, 29898, 3257, 29892, 6826, 29918, 1445, 2433, 29894, 2214, 29918, 7662, 29918, 29896, 29889, 15343, 29374, 13, 1678, 9995, 13, 1678, 3251, 1078, 263, 2560, 3414, 363, 6724, 11976, 13, 1678, 9995, 13, 1678, 822, 903, 657, 29918, 3707, 29918, 710, 29898, 16700, 29918, 10289, 29922, 29900, 1125, 13, 4706, 9995, 13, 4706, 16969, 263, 3477, 29883, 1347, 2635, 931, 3402, 310, 1286, 29892, 411, 13136, 13, 4706, 9210, 29889, 13, 4706, 9995, 13, 4706, 11636, 353, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 16700, 29918, 10289, 29897, 13, 4706, 1286, 353, 12865, 29889, 12673, 29889, 329, 29883, 3707, 580, 13, 4706, 260, 353, 1286, 448, 11636, 13, 4706, 269, 353, 260, 29889, 10718, 4830, 580, 13, 4706, 736, 269, 13, 13, 1678, 3414, 353, 6571, 13, 1678, 3414, 1839, 7662, 29918, 3257, 2033, 353, 3611, 13, 1678, 3414, 1839, 1883, 29918, 5113, 2033, 353, 525, 29881, 2214, 3601, 29918, 29887, 834, 774, 29877, 29915, 13, 1678, 3414, 1839, 1883, 29918, 15343, 2033, 353, 6826, 29918, 1445, 13, 1678, 3414, 1839, 15343, 29918, 5085, 2033, 353, 6629, 13, 1678, 3414, 1839, 15619, 2033, 353, 525, 29941, 29953, 29900, 29900, 29915, 13, 1678, 3414, 1839, 29880, 2579, 1270, 2033, 353, 525, 29900, 29915, 13, 1678, 3414, 1839, 29884, 572, 682, 29918, 1272, 29918, 5030, 2033, 353, 525, 29900, 29915, 13, 1678, 3414, 1839, 3204, 2324, 29918, 1272, 29918, 5030, 2033, 353, 525, 29900, 29915, 13, 1678, 3414, 1839, 2997, 29918, 2962, 2033, 353, 903, 657, 29918, 3707, 29918, 710, 6278, 29896, 29897, 29871, 396, 22600, 13, 1678, 3414, 1839, 2997, 29918, 9847, 2033, 353, 903, 657, 29918, 3707, 29918, 710, 29898, 29896, 29897, 1678, 396, 6454, 22396, 13, 1678, 3414, 1839, 13067, 29918, 4351, 2033, 353, 29871, 5591, 5184, 29914, 8767, 29914, 9274, 3601, 29914, 3601, 29918, 14669, 29889, 13067, 29908, 13, 1678, 3414, 1839, 29894, 2214, 29918, 333, 2033, 353, 29871, 29896, 13, 1678, 3414, 1839, 29894, 2214, 29918, 1949, 2033, 353, 29871, 29896, 13, 1678, 736, 3414, 13, 13, 13, 1990, 11654, 2451, 29898, 2451, 1125, 13, 1678, 1209, 13, 13, 1753, 903, 12765, 29918, 1761, 29898, 29874, 29892, 289, 1125, 13, 1678, 9995, 13, 1678, 28663, 267, 29871, 29906, 8857, 322, 3639, 278, 3161, 297, 1051, 263, 871, 259, 13, 1678, 9995, 13, 1678, 289, 353, 731, 29898, 29890, 29897, 13, 1678, 736, 518, 7340, 363, 29099, 297, 263, 565, 29099, 451, 297, 289, 29962, 13, 13, 13, 1753, 6826, 29918, 3075, 514, 362, 29918, 392, 29918, 10685, 29898, 2754, 29892, 2295, 29892, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 1125, 13, 1678, 9995, 13, 1678, 997, 3322, 263, 716, 1040, 514, 362, 29892, 11324, 1169, 363, 372, 304, 2615, 29892, 322, 13, 1678, 3639, 278, 716, 1040, 514, 362, 1024, 13, 1678, 9995, 13, 13, 1678, 396, 591, 29915, 276, 1048, 304, 1653, 263, 716, 1040, 514, 362, 856, 445, 1122, 451, 29871, 13, 1678, 396, 367, 278, 937, 13, 1678, 3517, 29918, 3075, 514, 800, 353, 518, 29916, 1839, 3075, 514, 362, 29918, 978, 2033, 320, 13, 462, 1669, 363, 921, 297, 7882, 29889, 657, 29918, 3075, 514, 800, 580, 29962, 13, 13, 1678, 7882, 29889, 15343, 29918, 3075, 514, 362, 29898, 29907, 3927, 15789, 29918, 22245, 8452, 29892, 315, 3927, 15789, 29918, 18166, 2725, 29892, 2295, 29897, 13, 1678, 1596, 703, 10685, 292, 29871, 29896, 29900, 409, 2395, 1159, 13, 1678, 931, 29889, 17059, 29898, 29896, 29900, 29897, 13, 13, 1678, 1476, 353, 7700, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 1040, 514, 362, 29918, 978, 353, 6213, 13, 1678, 1550, 451, 1476, 29901, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 565, 2302, 1405, 4236, 29918, 2798, 29901, 13, 9651, 12020, 11654, 2451, 703, 10851, 297, 997, 3322, 1273, 29879, 29908, 1273, 2295, 29897, 13, 13, 4706, 1040, 514, 362, 29918, 1761, 353, 7882, 29889, 657, 29918, 3075, 514, 800, 580, 13, 4706, 1857, 29918, 7039, 353, 518, 29916, 1839, 3075, 514, 362, 29918, 978, 2033, 320, 13, 462, 1669, 363, 921, 297, 1040, 514, 362, 29918, 1761, 29962, 13, 13, 4706, 716, 29918, 3075, 514, 800, 353, 903, 12765, 29918, 1761, 29898, 3784, 29918, 7039, 29892, 3517, 29918, 3075, 514, 800, 29897, 13, 4706, 1596, 4852, 29995, 29879, 22584, 29879, 29897, 716, 1040, 514, 800, 29901, 1273, 29879, 29908, 1273, 313, 2798, 29892, 13, 462, 462, 462, 29871, 4236, 29918, 2798, 29892, 13, 462, 462, 462, 29871, 716, 29918, 3075, 514, 800, 876, 13, 4706, 565, 7431, 29898, 1482, 29918, 3075, 514, 800, 29897, 1405, 29871, 29900, 29901, 13, 632, 1476, 353, 5852, 13, 632, 1040, 514, 362, 29918, 978, 353, 716, 29918, 3075, 514, 800, 29961, 29900, 29962, 13, 1678, 736, 1040, 514, 362, 29918, 978, 13, 13, 13, 1753, 29504, 29918, 3075, 514, 362, 29898, 2754, 29892, 13, 462, 9651, 1040, 514, 362, 29918, 978, 29892, 13, 462, 9651, 8709, 29918, 344, 2395, 29922, 29906, 29892, 13, 462, 9651, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 1125, 13, 1678, 9995, 13, 1678, 11814, 262, 1078, 263, 1040, 514, 362, 322, 11324, 1169, 2745, 278, 1889, 338, 2309, 29889, 13, 1678, 9995, 13, 1678, 822, 4864, 29898, 2754, 29892, 1040, 514, 362, 29918, 978, 1125, 13, 4706, 1040, 514, 362, 29918, 1761, 353, 7882, 29889, 657, 29918, 3075, 514, 800, 580, 13, 4706, 1857, 29918, 7039, 353, 518, 29916, 1839, 3075, 514, 362, 29918, 978, 2033, 320, 13, 462, 1669, 363, 921, 297, 1040, 514, 362, 29918, 1761, 29962, 13, 4706, 736, 1040, 514, 362, 29918, 978, 297, 1857, 29918, 7039, 13, 13, 1678, 1040, 514, 362, 29918, 9933, 353, 4864, 29898, 2754, 29892, 1040, 514, 362, 29918, 978, 29897, 13, 1678, 565, 451, 1040, 514, 362, 29918, 9933, 29901, 13, 4706, 12020, 11654, 2451, 703, 18821, 403, 29918, 3075, 514, 362, 29901, 376, 13, 462, 4706, 376, 1168, 6236, 362, 14210, 29879, 29915, 451, 1476, 29908, 1273, 1040, 514, 362, 29918, 978, 29897, 13, 13, 1678, 396, 3638, 278, 1840, 3381, 7182, 13, 1678, 7882, 29889, 18821, 403, 29918, 3075, 514, 362, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 1550, 1040, 514, 362, 29918, 9933, 29901, 13, 4706, 931, 29889, 17059, 29898, 17059, 29918, 344, 2395, 29897, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 565, 2302, 1405, 4236, 29918, 2798, 29901, 13, 9651, 12020, 11654, 2451, 703, 10851, 297, 29504, 29918, 3075, 514, 362, 1273, 29879, 29908, 1273, 313, 13, 462, 462, 462, 3986, 1040, 514, 362, 29918, 978, 876, 13, 4706, 1040, 514, 362, 29918, 9933, 353, 4864, 29898, 2754, 29892, 1040, 514, 362, 29918, 978, 29897, 13, 4706, 1596, 11702, 29879, 22584, 29879, 1273, 29879, 4864, 29901, 1273, 29879, 29908, 1273, 313, 2798, 29892, 13, 462, 462, 539, 4236, 29918, 2798, 29892, 29871, 13, 462, 462, 539, 1040, 514, 362, 29918, 978, 29892, 13, 462, 462, 539, 1040, 514, 362, 29918, 9933, 876, 13, 13, 13, 1753, 4480, 29918, 1454, 29918, 3075, 514, 362, 29918, 3859, 29898, 2754, 29892, 13, 462, 462, 1040, 514, 362, 29918, 978, 29892, 13, 462, 462, 1820, 543, 3075, 514, 362, 29918, 3859, 613, 13, 462, 462, 995, 543, 21094, 613, 13, 462, 462, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 29892, 13, 462, 462, 8709, 29918, 344, 2395, 29922, 29945, 1125, 13, 1678, 9995, 13, 1678, 2043, 3137, 1040, 514, 362, 2106, 1820, 2745, 967, 995, 7087, 995, 29889, 910, 338, 1304, 13, 1678, 304, 4480, 2745, 263, 1040, 514, 362, 338, 7960, 304, 1065, 23876, 29871, 13, 1678, 9995, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 1550, 5852, 29901, 13, 4706, 931, 29889, 17059, 29898, 17059, 29918, 344, 2395, 29897, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 565, 2302, 1405, 4236, 29918, 2798, 29901, 13, 9651, 12020, 11654, 2451, 703, 10851, 297, 4480, 363, 1273, 29879, 353, 1273, 29879, 376, 13, 462, 18884, 376, 363, 1273, 29879, 29908, 1273, 313, 1989, 29892, 995, 29892, 1040, 514, 362, 29918, 978, 876, 13, 13, 4706, 1040, 29918, 1272, 353, 7882, 29889, 657, 29918, 3075, 514, 362, 29918, 1272, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 4706, 2106, 353, 1040, 29918, 1272, 29961, 1989, 29962, 13, 4706, 1596, 11702, 29879, 22584, 29879, 29897, 1273, 29879, 518, 29995, 29879, 29962, 353, 1273, 29879, 29908, 1273, 313, 2798, 29892, 13, 462, 462, 539, 4236, 29918, 2798, 29892, 13, 462, 462, 539, 1040, 514, 362, 29918, 978, 29892, 13, 462, 462, 539, 1820, 29892, 13, 462, 462, 539, 2106, 876, 13, 4706, 565, 2106, 1275, 995, 29901, 13, 9651, 736, 29871, 1040, 29918, 1272, 13, 13, 13, 1753, 1653, 29918, 7662, 29898, 9274, 3601, 29918, 2754, 29892, 1040, 514, 362, 29918, 978, 29892, 3414, 29918, 8977, 1125, 13, 1678, 9995, 13, 1678, 6760, 1078, 263, 716, 3414, 322, 5663, 17180, 278, 1178, 310, 278, 716, 3414, 29889, 910, 29871, 13, 1678, 6858, 17420, 3414, 2983, 1434, 322, 1156, 11265, 29871, 13, 1678, 9995, 13, 1678, 822, 3414, 29918, 7039, 7295, 13, 4706, 1040, 29918, 1272, 353, 9570, 3601, 29918, 2754, 29889, 657, 29918, 3075, 514, 362, 29918, 1272, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 4706, 3414, 29918, 7039, 353, 518, 29916, 1839, 7662, 29918, 333, 2033, 363, 921, 297, 1040, 29918, 1272, 1839, 20673, 2033, 29962, 13, 4706, 736, 3414, 29918, 7039, 13, 268, 13, 1678, 3517, 29918, 20673, 353, 3414, 29918, 7039, 580, 13, 1678, 9570, 3601, 29918, 2754, 29889, 3258, 29918, 7662, 29898, 3075, 514, 362, 29918, 978, 29892, 3414, 29918, 8977, 29897, 13, 1678, 716, 29918, 20673, 353, 3414, 29918, 7039, 580, 13, 268, 13, 1678, 19471, 29918, 20673, 353, 903, 12765, 29918, 1761, 29898, 1482, 29918, 20673, 29892, 3517, 29918, 20673, 29897, 13, 1678, 716, 29918, 7662, 29918, 333, 353, 19471, 29918, 20673, 29961, 29900, 29962, 13, 1678, 736, 716, 29918, 7662, 29918, 333, 13, 13, 13, 1753, 4480, 29918, 1454, 29918, 7662, 29918, 3859, 29898, 9274, 3601, 29918, 2754, 29892, 13, 462, 4706, 1040, 514, 362, 29918, 978, 29892, 13, 462, 4706, 3414, 29918, 333, 29892, 13, 462, 4706, 3646, 29918, 3859, 29892, 13, 462, 4706, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 29892, 13, 462, 4706, 8709, 29918, 344, 2395, 29922, 29896, 1125, 13, 1678, 9995, 13, 1678, 20340, 2745, 278, 3414, 338, 297, 263, 3646, 2106, 313, 735, 376, 21094, 613, 470, 376, 7864, 2986, 1159, 13, 1678, 9995, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 1550, 5852, 29901, 13, 4706, 931, 29889, 17059, 29898, 17059, 29918, 344, 2395, 29897, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 565, 2302, 1405, 4236, 29918, 2798, 29901, 13, 9651, 12020, 11654, 2451, 703, 10851, 297, 1369, 29918, 7662, 29908, 13, 462, 18884, 11860, 29879, 363, 1273, 29879, 29908, 1273, 313, 7662, 29918, 333, 29892, 1040, 514, 362, 29918, 978, 876, 268, 13, 4706, 3414, 29918, 8977, 353, 9570, 3601, 29918, 2754, 29889, 949, 29918, 7662, 29898, 3075, 514, 362, 29918, 978, 29892, 3414, 29918, 333, 29897, 13, 4706, 1857, 29918, 3859, 353, 3414, 29918, 8977, 1839, 7662, 29918, 3859, 2033, 13, 4706, 1596, 11702, 29879, 22584, 29879, 9330, 1273, 29879, 29901, 1273, 29879, 29908, 1273, 313, 2798, 29892, 4236, 29918, 2798, 29892, 13, 462, 462, 268, 3414, 29918, 333, 29892, 13, 462, 462, 268, 1857, 29918, 3859, 876, 13, 4706, 565, 1857, 29918, 3859, 1275, 3646, 29918, 3859, 29901, 13, 9651, 736, 13, 13, 13, 1753, 1065, 29918, 7662, 29898, 9274, 3601, 29918, 2754, 29892, 1040, 514, 362, 29918, 978, 29892, 3414, 29918, 333, 29892, 13, 1669, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 29892, 13, 1669, 8709, 29918, 344, 2395, 29922, 29896, 1125, 13, 1678, 9995, 13, 1678, 624, 5708, 263, 3414, 322, 11324, 1169, 363, 967, 4660, 304, 367, 376, 21094, 29908, 13, 1678, 9995, 13, 1678, 396, 1423, 3414, 13, 1678, 3414, 29918, 8977, 353, 9570, 3601, 29918, 2754, 29889, 949, 29918, 7662, 29898, 3075, 514, 362, 29918, 978, 29892, 3414, 29918, 333, 29897, 13, 1678, 2106, 353, 3414, 29918, 8977, 1839, 7662, 29918, 3859, 2033, 13, 1678, 565, 2106, 2804, 376, 2040, 1115, 13, 4706, 12020, 11654, 2451, 703, 6028, 29915, 29873, 1369, 3414, 297, 2106, 14210, 29879, 11838, 1273, 2106, 29897, 13, 13, 1678, 396, 1065, 3414, 13, 1678, 9570, 3601, 29918, 2754, 29889, 2962, 29918, 7662, 29898, 3075, 514, 362, 29918, 978, 29892, 3414, 29918, 333, 29897, 13, 1678, 4480, 29918, 1454, 29918, 7662, 29918, 3859, 29898, 9274, 3601, 29918, 2754, 29892, 13, 462, 4706, 1040, 514, 362, 29918, 978, 29892, 13, 462, 4706, 3414, 29918, 333, 29892, 13, 462, 4706, 525, 21094, 742, 13, 462, 4706, 4236, 29918, 2798, 29892, 13, 462, 4706, 8709, 29918, 344, 2395, 29897, 13, 13, 13, 1753, 1065, 29918, 1333, 19273, 29898, 9274, 3601, 29918, 2754, 29892, 1040, 514, 362, 29918, 978, 1125, 13, 1678, 9995, 13, 1678, 624, 5708, 278, 451, 19273, 2669, 322, 11324, 1169, 363, 967, 4660, 304, 367, 376, 21094, 29908, 13, 1678, 9995, 13, 1678, 9570, 3601, 29918, 2754, 29889, 2962, 29918, 1333, 19273, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 13, 1678, 2302, 29922, 29896, 29900, 29900, 13, 1678, 1550, 2302, 1405, 29871, 29900, 29901, 13, 4706, 931, 29889, 17059, 29898, 29945, 29897, 13, 4706, 2302, 22361, 29871, 29896, 13, 4706, 364, 353, 9570, 3601, 29918, 2754, 29889, 15702, 29918, 1333, 19273, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 4706, 1596, 11702, 29879, 29914, 29896, 29900, 29900, 451, 19273, 2106, 29901, 1273, 29879, 29908, 1273, 313, 2798, 29892, 364, 876, 13, 4706, 565, 364, 1275, 376, 21094, 1115, 13, 9651, 736, 13, 1678, 12020, 11654, 2451, 703, 6028, 29915, 29873, 1369, 451, 19273, 373, 1273, 29879, 29908, 1273, 1040, 514, 362, 29918, 978, 29897, 13, 13, 1753, 5040, 29918, 1333, 19273, 29898, 9274, 3601, 29918, 2754, 29892, 1040, 514, 362, 29918, 978, 1125, 13, 1678, 9995, 13, 1678, 624, 3554, 278, 451, 19273, 2669, 322, 11324, 1169, 363, 967, 4660, 304, 376, 7864, 2986, 29908, 13, 1678, 9995, 13, 1678, 9570, 3601, 29918, 2754, 29889, 9847, 29918, 1333, 19273, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 13, 1678, 2302, 29922, 29896, 29900, 29900, 13, 1678, 1550, 2302, 1405, 29871, 29900, 29901, 13, 4706, 1596, 703, 2798, 1273, 29879, 29914, 29896, 29900, 29900, 29908, 1273, 2302, 29897, 13, 4706, 931, 29889, 17059, 29898, 29945, 29897, 13, 4706, 2302, 22361, 29871, 29896, 13, 4706, 364, 353, 9570, 3601, 29918, 2754, 29889, 15702, 29918, 1333, 19273, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 4706, 1596, 11702, 29879, 29914, 29896, 29900, 29900, 451, 19273, 2106, 29901, 1273, 29879, 29908, 1273, 313, 2798, 29892, 364, 876, 13, 4706, 565, 364, 1275, 376, 1115, 13, 9651, 736, 13, 1678, 12020, 11654, 2451, 703, 6028, 29915, 29873, 1369, 451, 19273, 373, 1273, 29879, 29908, 1273, 1040, 514, 362, 29918, 978, 29897, 13, 13, 13, 1753, 1065, 29918, 18828, 2676, 29898, 9274, 3601, 29918, 2754, 29892, 1040, 514, 362, 29918, 978, 1125, 13, 1678, 9995, 13, 1678, 624, 5708, 278, 330, 29920, 2676, 2669, 322, 11324, 1169, 363, 967, 4660, 304, 367, 376, 21094, 29908, 13, 1678, 9995, 13, 1678, 9570, 3601, 29918, 2754, 29889, 2962, 29918, 18828, 2676, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 13, 1678, 2302, 29922, 29896, 29900, 29900, 13, 1678, 1550, 2302, 1405, 29871, 29900, 29901, 13, 4706, 931, 29889, 17059, 29898, 29945, 29897, 13, 4706, 2302, 22361, 29871, 29896, 13, 4706, 364, 353, 9570, 3601, 29918, 2754, 29889, 15702, 29918, 18828, 2676, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 4706, 1596, 11702, 29879, 29914, 29896, 29900, 29900, 330, 29920, 2676, 2106, 29901, 1273, 29879, 29908, 1273, 313, 2798, 29892, 364, 876, 13, 4706, 565, 364, 1275, 376, 21094, 1115, 13, 9651, 736, 13, 1678, 12020, 11654, 2451, 703, 6028, 29915, 29873, 1369, 330, 29920, 2676, 373, 1273, 29879, 29908, 1273, 1040, 514, 362, 29918, 978, 29897, 13, 13, 13, 1753, 5040, 29918, 18828, 2676, 29898, 9274, 3601, 29918, 2754, 29892, 1040, 514, 362, 29918, 978, 1125, 13, 1678, 9995, 13, 1678, 624, 3554, 278, 330, 29920, 2676, 2669, 322, 11324, 1169, 363, 967, 4660, 304, 376, 7864, 2986, 29908, 13, 1678, 9995, 13, 1678, 9570, 3601, 29918, 2754, 29889, 9847, 29918, 18828, 2676, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 13, 1678, 2302, 29922, 29896, 29900, 29900, 13, 1678, 1550, 2302, 1405, 29871, 29900, 29901, 13, 4706, 1596, 703, 2798, 1273, 29879, 29914, 29896, 29900, 29900, 29908, 1273, 2302, 29897, 13, 4706, 931, 29889, 17059, 29898, 29945, 29897, 13, 4706, 2302, 22361, 29871, 29896, 13, 4706, 364, 353, 9570, 3601, 29918, 2754, 29889, 15702, 29918, 18828, 2676, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 4706, 1596, 11702, 29879, 29914, 29896, 29900, 29900, 330, 29920, 2676, 2106, 29901, 1273, 29879, 29908, 1273, 313, 2798, 29892, 364, 876, 13, 4706, 565, 364, 1275, 376, 1115, 13, 9651, 736, 13, 1678, 12020, 11654, 2451, 703, 6028, 29915, 29873, 1369, 451, 19273, 373, 1273, 29879, 29908, 1273, 1040, 514, 362, 29918, 978, 29897, 13, 13, 1753, 5040, 29918, 7662, 29898, 9274, 3601, 29918, 2754, 29892, 1040, 514, 362, 29918, 978, 29892, 3414, 29918, 333, 29892, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 29892, 13, 795, 8709, 29918, 344, 2395, 29922, 29896, 1125, 13, 1678, 9995, 13, 1678, 624, 3554, 263, 3414, 322, 11324, 1169, 363, 967, 4660, 304, 748, 515, 376, 21094, 29908, 304, 376, 7864, 2986, 29908, 13, 1678, 9995, 13, 1678, 396, 1423, 3414, 13, 1678, 3414, 29918, 8977, 353, 9570, 3601, 29918, 2754, 29889, 949, 29918, 7662, 29898, 3075, 514, 362, 29918, 978, 29892, 3414, 29918, 333, 29897, 13, 1678, 2106, 353, 3414, 29918, 8977, 1839, 7662, 29918, 3859, 2033, 13, 1678, 565, 2106, 2804, 376, 21094, 1115, 13, 4706, 12020, 11654, 2451, 703, 6028, 29915, 29873, 5040, 3414, 297, 2106, 14210, 29879, 11838, 1273, 2106, 29897, 13, 268, 13, 1678, 396, 1065, 3414, 13, 1678, 9570, 3601, 29918, 2754, 29889, 9847, 29918, 7662, 29898, 3075, 514, 362, 29918, 978, 29897, 13, 1678, 4480, 29918, 1454, 29918, 7662, 29918, 3859, 29898, 9274, 3601, 29918, 2754, 29892, 13, 462, 4706, 1040, 514, 362, 29918, 978, 29892, 13, 462, 4706, 3414, 29918, 333, 29892, 13, 462, 4706, 525, 7864, 2986, 742, 13, 462, 4706, 4236, 29918, 2798, 29892, 13, 462, 4706, 8709, 29918, 344, 2395, 29897, 13, 13, 1753, 28371, 7295, 13, 1678, 9995, 13, 1678, 383, 1296, 1158, 304, 4772, 21985, 29892, 1363, 28371, 338, 451, 2198, 373, 897, 6045, 29918, 601, 13, 1678, 770, 1304, 491, 6560, 3057, 16802, 29889, 13, 1678, 9995, 13, 1678, 1209, 13, 13, 13, 1990, 11654, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 9995, 13, 1678, 4321, 393, 6760, 1078, 263, 14293, 8942, 373, 15540, 29889, 319, 1027, 9183, 338, 769, 15241, 13, 1678, 515, 393, 14293, 8942, 322, 263, 17402, 3414, 338, 1065, 29889, 13, 1678, 910, 1243, 338, 1065, 491, 23750, 746, 14293, 8942, 775, 338, 9120, 29889, 13, 1678, 9995, 13, 1678, 822, 3611, 29898, 1311, 29892, 1426, 1125, 13, 4706, 1596, 703, 1159, 13, 4706, 1596, 703, 13383, 13383, 4136, 2277, 29937, 1159, 13, 4706, 1596, 14822, 1159, 13, 4706, 1596, 14822, 1273, 29879, 29908, 1273, 1426, 29897, 13, 4706, 1596, 14822, 1159, 13, 4706, 1596, 703, 13383, 13383, 4136, 2277, 29937, 1159, 13, 308, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 632, 13, 4706, 1583, 29889, 3257, 703, 842, 3373, 1159, 13, 13, 4706, 1018, 29901, 13, 9651, 396, 3867, 694, 1015, 28371, 304, 4772, 21985, 746, 10876, 29889, 25393, 322, 380, 20405, 13, 9651, 396, 526, 20831, 264, 304, 2436, 4903, 2066, 313, 8256, 2734, 411, 23750, 29897, 13, 9651, 10876, 29889, 25393, 29889, 23126, 353, 28371, 13, 9651, 10876, 29889, 303, 20405, 29889, 23126, 353, 28371, 13, 4706, 5174, 29901, 13, 9651, 1596, 703, 15156, 4226, 10876, 29889, 25393, 322, 10876, 29889, 303, 20405, 1159, 13, 13, 4706, 1583, 29889, 9274, 3601, 29918, 2754, 353, 6213, 13, 4706, 1583, 29889, 3601, 9183, 29918, 978, 353, 6213, 13, 4706, 1583, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 353, 6213, 13, 4706, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 353, 6213, 13, 308, 13, 4706, 1583, 29889, 1792, 353, 525, 6406, 29915, 13, 4706, 1583, 29889, 5630, 353, 12801, 25711, 17013, 16299, 13, 308, 13, 4706, 1583, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 353, 679, 29918, 13092, 29918, 12759, 29918, 978, 877, 29878, 303, 1495, 13, 4706, 1583, 29889, 1272, 29918, 3972, 353, 679, 29918, 1688, 29918, 2084, 703, 5060, 29918, 1688, 1159, 13, 4706, 1583, 29889, 1037, 6289, 29918, 29888, 978, 353, 679, 29918, 29890, 3747, 29918, 2084, 580, 13, 4706, 1583, 29889, 666, 353, 6213, 13, 308, 13, 4706, 1596, 703, 1272, 4516, 29901, 1273, 29879, 29908, 1273, 1583, 29889, 1272, 29918, 3972, 29897, 13, 4706, 1596, 703, 9274, 3601, 1040, 514, 362, 29901, 1273, 29879, 29908, 1273, 1583, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 29897, 13, 4706, 1596, 703, 1792, 29901, 1273, 29879, 29892, 4800, 29901, 1273, 29879, 29908, 1273, 313, 1311, 29889, 1792, 29892, 1583, 29889, 5630, 876, 13, 13, 1678, 822, 1243, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3257, 703, 3258, 29918, 9274, 3601, 1159, 13, 4706, 1583, 29889, 666, 353, 9570, 3601, 29889, 3258, 29918, 9274, 3601, 29898, 6786, 29922, 1311, 29889, 1792, 29892, 13, 462, 462, 29871, 16140, 29918, 29888, 978, 29922, 1311, 29889, 1037, 6289, 29918, 29888, 978, 29892, 13, 462, 462, 29871, 5120, 29922, 29907, 3927, 15789, 29918, 18166, 2725, 29892, 13, 462, 462, 29871, 5285, 29922, 29907, 3927, 15789, 5425, 29924, 29918, 25903, 29892, 13, 462, 462, 29871, 10760, 29918, 1853, 543, 16616, 613, 13, 462, 462, 29871, 4800, 29922, 29966, 25711, 17013, 10202, 13, 462, 462, 29871, 848, 29918, 3972, 29922, 1311, 29889, 1272, 29918, 3972, 29892, 13, 462, 462, 29871, 1040, 514, 362, 29918, 978, 29922, 1311, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 9274, 3601, 451, 2825, 1159, 13, 4706, 1596, 703, 29886, 14274, 9570, 3601, 1273, 29879, 2825, 297, 1273, 29879, 29908, 1273, 313, 1311, 29889, 666, 29892, 1583, 29889, 1272, 29918, 3972, 876, 13, 4706, 1596, 14182, 29876, 29905, 29876, 1159, 13, 4706, 1596, 877, 2754, 353, 14293, 8942, 15078, 11713, 11702, 29879, 613, 11860, 29879, 613, 11860, 29879, 1159, 29915, 1273, 313, 1311, 29889, 666, 29892, 13, 462, 462, 462, 268, 1583, 29889, 1792, 29892, 13, 462, 462, 462, 268, 1583, 29889, 5630, 876, 13, 4706, 1583, 29889, 9274, 3601, 29918, 2754, 353, 14293, 8942, 15078, 11713, 29898, 1311, 29889, 666, 29892, 1583, 29889, 1792, 29892, 1583, 29889, 5630, 29897, 13, 13, 4706, 274, 29888, 3174, 353, 1583, 29889, 9274, 3601, 29918, 2754, 29889, 657, 29918, 23523, 29918, 2917, 29879, 580, 13, 4706, 1018, 29901, 13, 9651, 1596, 29898, 6854, 3174, 29889, 8149, 3101, 13, 9651, 1596, 29898, 6854, 3174, 29897, 13, 9651, 274, 29888, 3174, 29918, 1037, 6289, 353, 274, 29888, 3174, 29961, 29907, 3927, 15789, 29918, 22245, 8452, 22322, 1727, 1080, 2033, 13, 9651, 274, 29888, 3174, 29918, 12803, 353, 274, 29888, 3174, 29918, 1037, 6289, 29961, 29907, 3927, 15789, 29918, 18166, 2725, 22322, 2917, 332, 800, 2033, 13, 9651, 274, 29888, 3174, 29918, 7039, 353, 518, 29916, 1839, 978, 2033, 363, 921, 297, 274, 29888, 3174, 29918, 12803, 29962, 13, 9651, 1596, 703, 2917, 29879, 29901, 1273, 29879, 29908, 1273, 274, 29888, 3174, 29918, 7039, 29897, 13, 13, 4706, 5174, 8960, 29892, 321, 29901, 13, 9651, 1053, 9637, 1627, 13, 9651, 260, 29890, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 9651, 1596, 703, 15003, 1627, 29901, 29871, 1273, 29879, 29908, 1273, 260, 29890, 29897, 13, 13, 4706, 1583, 29889, 3257, 703, 15343, 24354, 9570, 3601, 1159, 13, 4706, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 353, 6826, 29918, 3075, 514, 362, 29918, 392, 29918, 10685, 29898, 13, 462, 462, 462, 259, 1583, 29889, 9274, 3601, 29918, 2754, 29892, 29871, 13, 462, 462, 462, 259, 2295, 29922, 29907, 3927, 15789, 5425, 29924, 29918, 25903, 29897, 13, 4706, 1596, 14822, 24354, 9570, 3601, 1273, 29879, 15241, 29908, 1273, 313, 1311, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 29890, 10798, 9570, 3601, 451, 2825, 1159, 13, 13, 4706, 1583, 29889, 3257, 703, 15343, 1027, 9183, 1159, 13, 4706, 1583, 29889, 3601, 9183, 29918, 978, 353, 6826, 29918, 3075, 514, 362, 29918, 392, 29918, 10685, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 13, 462, 462, 462, 9651, 2295, 29922, 5425, 29924, 29918, 25903, 29897, 13, 4706, 1596, 14822, 3439, 9183, 1273, 29879, 15241, 29908, 1273, 313, 1311, 29889, 3601, 9183, 29918, 978, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 3601, 9183, 451, 2825, 1159, 13, 13, 4706, 1583, 29889, 3257, 703, 15716, 363, 24354, 9570, 3601, 1303, 948, 404, 1159, 13, 4706, 1596, 703, 2754, 29889, 657, 29918, 3075, 514, 362, 29918, 1272, 877, 29995, 29879, 1495, 29908, 1273, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 29897, 13, 4706, 4480, 29918, 1454, 29918, 3075, 514, 362, 29918, 3859, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 13, 462, 462, 268, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 29892, 13, 462, 462, 268, 1820, 543, 3075, 514, 362, 29918, 3859, 613, 13, 462, 462, 268, 995, 543, 21094, 613, 13, 462, 462, 268, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 29890, 10798, 9570, 3601, 451, 7960, 1159, 13, 4706, 1596, 14822, 24354, 9570, 3601, 4933, 7960, 1159, 13, 13, 4706, 1583, 29889, 3257, 703, 6422, 24354, 9570, 3601, 1159, 13, 4706, 1583, 29889, 9274, 3601, 29918, 2754, 29889, 5504, 29918, 3075, 514, 362, 29898, 1311, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 29897, 13, 4706, 4480, 29918, 1454, 29918, 3075, 514, 362, 29918, 3859, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 13, 462, 462, 268, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 29892, 13, 462, 462, 268, 1820, 543, 3075, 514, 362, 29918, 3859, 613, 13, 462, 462, 268, 995, 543, 21094, 613, 13, 462, 462, 268, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 29897, 13, 4706, 1596, 14822, 24354, 9570, 3601, 4933, 4784, 1159, 13, 13, 4706, 1583, 29889, 3257, 703, 15716, 363, 1027, 9183, 1303, 948, 404, 1159, 13, 4706, 1596, 703, 2754, 29889, 657, 29918, 3075, 514, 362, 29918, 1272, 877, 29995, 29879, 1495, 29908, 1273, 1583, 29889, 3601, 9183, 29918, 978, 29897, 13, 4706, 4480, 29918, 1454, 29918, 3075, 514, 362, 29918, 3859, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 13, 462, 462, 268, 1583, 29889, 3601, 9183, 29918, 978, 29892, 13, 462, 462, 268, 1820, 543, 15343, 29918, 19190, 613, 13, 462, 462, 268, 995, 543, 21094, 613, 13, 462, 462, 268, 4236, 29918, 2798, 29922, 29896, 29900, 29900, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 3601, 9183, 451, 7960, 1159, 13, 4706, 1596, 14822, 3439, 9183, 4933, 7960, 1159, 13, 13, 4706, 1583, 29889, 3257, 703, 3057, 451, 19273, 1159, 13, 4706, 1065, 29918, 1333, 19273, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 1311, 29889, 3601, 9183, 29918, 978, 29897, 13, 4706, 5040, 29918, 1333, 19273, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 1311, 29889, 3601, 9183, 29918, 978, 29897, 13, 13, 4706, 396, 278, 1027, 9183, 338, 7960, 29991, 13, 4706, 1583, 29889, 3257, 14822, 1653, 3414, 1159, 13, 4706, 1596, 877, 17681, 353, 1653, 29918, 7662, 29898, 2754, 29892, 11860, 29879, 613, 525, 13, 795, 525, 3258, 29918, 7662, 29918, 8977, 703, 1688, 29871, 29900, 5783, 29915, 1273, 1583, 29889, 3601, 9183, 29918, 978, 29897, 13, 4706, 1596, 14182, 29876, 29905, 29876, 1159, 13, 4706, 3414, 29918, 8977, 353, 1653, 29918, 7662, 29918, 8977, 703, 1688, 3414, 29871, 29896, 1159, 13, 4706, 1596, 11702, 29879, 29908, 1273, 3414, 29918, 8977, 29897, 13, 4706, 1583, 29889, 7662, 29918, 333, 353, 1653, 29918, 7662, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 13, 462, 462, 259, 1583, 29889, 3601, 9183, 29918, 978, 29892, 13, 462, 462, 259, 3414, 29918, 8977, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 7662, 451, 2825, 1159, 13, 4706, 1065, 29918, 7662, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 1311, 29889, 3601, 9183, 29918, 978, 29892, 1583, 29889, 7662, 29918, 333, 29897, 13, 13, 4706, 1583, 29889, 3257, 703, 3057, 330, 29920, 2676, 1159, 13, 4706, 1065, 29918, 18828, 2676, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 1311, 29889, 3601, 9183, 29918, 978, 29897, 13, 4706, 5040, 29918, 18828, 2676, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 1311, 29889, 3601, 9183, 29918, 978, 29897, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 7662, 451, 1065, 1159, 13, 4706, 1583, 29889, 3257, 14822, 5040, 3414, 1159, 13, 4706, 5040, 29918, 7662, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 1311, 29889, 3601, 9183, 29918, 978, 29892, 1583, 29889, 7662, 29918, 333, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29892, 376, 7662, 451, 11084, 1159, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 29871, 13, 4706, 1583, 29889, 3257, 703, 371, 279, 6767, 1159, 13, 308, 13, 4706, 1583, 29889, 3257, 703, 18821, 403, 24354, 9570, 3601, 1159, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 29889, 9274, 3601, 29918, 2754, 322, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 29901, 13, 18884, 29504, 29918, 3075, 514, 362, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 13, 462, 462, 4706, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 29897, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 3782, 24354, 9570, 3601, 2825, 1159, 13, 4706, 5174, 8960, 29892, 321, 29901, 13, 9651, 1596, 703, 2392, 6624, 1218, 24354, 9570, 3601, 1040, 514, 362, 1273, 29879, 29901, 1273, 29879, 29908, 1273, 313, 13, 462, 462, 462, 1678, 1583, 29889, 29890, 10798, 29918, 9274, 3601, 29918, 978, 29892, 13, 462, 462, 462, 1678, 321, 876, 13, 13, 4706, 1583, 29889, 3257, 703, 18821, 403, 1027, 9183, 1159, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 29889, 9274, 3601, 29918, 2754, 322, 1583, 29889, 3601, 9183, 29918, 978, 29901, 13, 18884, 29504, 29918, 3075, 514, 362, 29898, 1311, 29889, 9274, 3601, 29918, 2754, 29892, 1583, 29889, 3601, 9183, 29918, 978, 29897, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 3782, 1027, 9183, 2825, 1159, 13, 4706, 5174, 8960, 29892, 321, 29901, 13, 9651, 1596, 703, 2392, 6624, 1218, 1027, 9183, 1040, 514, 362, 1273, 29879, 29901, 1273, 29879, 29908, 1273, 313, 13, 462, 462, 462, 4706, 1583, 29889, 3601, 9183, 29918, 978, 29892, 13, 462, 462, 462, 4706, 321, 876, 13, 9651, 260, 29890, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 9651, 1596, 703, 15003, 1627, 29901, 29871, 1273, 29879, 29908, 1273, 260, 29890, 29897, 13, 13, 4706, 1583, 29889, 3257, 703, 18821, 403, 23872, 9570, 3601, 1159, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 322, 1583, 29889, 666, 29901, 13, 18884, 1596, 703, 18821, 403, 9570, 3601, 14210, 29879, 29915, 1273, 29879, 29908, 1273, 313, 1311, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 29892, 13, 462, 462, 462, 418, 1583, 29889, 666, 876, 13, 9651, 9570, 3601, 29889, 18821, 403, 29898, 1311, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 29897, 13, 9651, 396, 3349, 515, 4367, 275, 13, 9651, 1040, 514, 362, 353, 5798, 514, 362, 2792, 29898, 1311, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 29897, 13, 9651, 1040, 514, 362, 29889, 4548, 533, 29898, 29896, 29897, 13, 539, 13, 4706, 5174, 8960, 29892, 321, 29901, 13, 632, 1596, 703, 2392, 6624, 1218, 23872, 9570, 3601, 14210, 29879, 29915, 584, 1273, 29879, 29908, 1273, 313, 13, 462, 462, 462, 1678, 1583, 29889, 29886, 14274, 29918, 9274, 3601, 29918, 978, 29892, 13, 462, 462, 462, 1678, 321, 876, 13, 632, 260, 29890, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 580, 13, 632, 1596, 703, 15003, 1627, 29901, 29871, 1273, 29879, 29908, 1273, 260, 29890, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 4903, 3057, 16802, 353, 679, 29918, 1688, 29918, 27492, 580, 13, 1678, 443, 27958, 29889, 3396, 29898, 1688, 16802, 29922, 3134, 3057, 16802, 29897, 13, 13, 2 ]
pyPyrTools/entropy2.py
spencerkent/pyPyrTools
40
114763
import numpy def entropy2(*args): ''' E = ENTROPY2(MTX,BINSIZE) Compute the first-order sample entropy of MTX. Samples of VEC are first discretized. Optional argument BINSIZE controls the discretization, and defaults to 256/(max(VEC)-min(VEC)). NOTE: This is a heavily biased estimate of entropy when you don't have much data. <NAME>, 6/96. Ported to Python by <NAME>, 10/15. ''' vec = numpy.array(args[0]) # if 2D flatten to a vector if len(vec.shape) != 1 and (vec.shape[0] != 1 or vec.shape[1] != 1): vec = vec.flatten() (mn, mx) = range2(vec) if len(args) > 1: binsize = args[1] # FIX: why is this max in the Matlab code; it's just a float? # we insure that vec isn't 2D above, so this shouldn't be needed #nbins = max( float(mx-mn)/float(binsize) ) nbins = float(mx-mn) / float(binsize) else: nbins = 256 [bincount, bins] = histo(vec, nbins) ## Collect non-zero bins: H = bincount[ numpy.where(bincount > 0) ] H = H / float(sum(H)) return -sum(H * numpy.log2(H))
[ 1, 1053, 12655, 13, 13, 1753, 24687, 29906, 10456, 5085, 1125, 13, 1678, 14550, 382, 353, 12524, 29911, 1672, 20055, 29906, 29898, 11490, 29990, 29892, 29933, 1177, 14226, 29897, 29871, 13, 418, 13, 4706, 11796, 29872, 278, 937, 29899, 2098, 4559, 24687, 310, 341, 28627, 29889, 29871, 3685, 2701, 310, 478, 11206, 526, 13, 4706, 937, 766, 4838, 1891, 29889, 29871, 28379, 2980, 350, 1177, 14226, 11761, 278, 13, 4706, 766, 4838, 2133, 29892, 322, 21274, 304, 29871, 29906, 29945, 29953, 14571, 3317, 29898, 29963, 11206, 6817, 1195, 29898, 29963, 11206, 8106, 13, 268, 13, 4706, 6058, 29923, 29901, 910, 338, 263, 20365, 29871, 4768, 1463, 12678, 310, 24687, 746, 366, 13, 4706, 1016, 29915, 29873, 505, 1568, 848, 29889, 13, 268, 13, 4706, 529, 5813, 10202, 29871, 29953, 29914, 29929, 29953, 29889, 3371, 287, 304, 5132, 491, 529, 5813, 10202, 29871, 29896, 29900, 29914, 29896, 29945, 29889, 29871, 14550, 13, 268, 13, 1678, 9649, 353, 12655, 29889, 2378, 29898, 5085, 29961, 29900, 2314, 13, 1678, 396, 565, 29871, 29906, 29928, 1652, 8606, 304, 263, 4608, 13, 1678, 565, 7431, 29898, 2003, 29889, 12181, 29897, 2804, 29871, 29896, 322, 313, 2003, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 470, 9649, 29889, 12181, 29961, 29896, 29962, 2804, 29871, 29896, 1125, 13, 4706, 9649, 353, 9649, 29889, 1579, 8606, 580, 13, 13, 1678, 313, 23521, 29892, 286, 29916, 29897, 353, 3464, 29906, 29898, 2003, 29897, 13, 13, 1678, 565, 7431, 29898, 5085, 29897, 1405, 29871, 29896, 29901, 13, 4706, 289, 1144, 675, 353, 6389, 29961, 29896, 29962, 13, 4706, 396, 383, 6415, 29901, 2020, 338, 445, 4236, 297, 278, 5345, 8205, 775, 29936, 372, 29915, 29879, 925, 263, 5785, 29973, 13, 4706, 396, 591, 1663, 545, 393, 9649, 3508, 29915, 29873, 29871, 29906, 29928, 2038, 29892, 577, 445, 9273, 29915, 29873, 367, 4312, 13, 4706, 396, 9877, 1144, 353, 4236, 29898, 5785, 29898, 16838, 29899, 23521, 6802, 7411, 29898, 29890, 1144, 675, 29897, 1723, 13, 4706, 302, 29890, 1144, 353, 5785, 29898, 16838, 29899, 23521, 29897, 847, 5785, 29898, 29890, 1144, 675, 29897, 13, 1678, 1683, 29901, 13, 4706, 302, 29890, 1144, 353, 29871, 29906, 29945, 29953, 13, 13, 1678, 518, 2109, 2798, 29892, 289, 1144, 29962, 353, 298, 5137, 29898, 2003, 29892, 302, 29890, 1144, 29897, 13, 13, 1678, 444, 24930, 1661, 29899, 9171, 289, 1144, 29901, 13, 1678, 379, 353, 9016, 2798, 29961, 12655, 29889, 3062, 29898, 2109, 2798, 1405, 29871, 29900, 29897, 4514, 13, 1678, 379, 353, 379, 847, 5785, 29898, 2083, 29898, 29950, 876, 13, 13, 1678, 736, 448, 2083, 29898, 29950, 334, 12655, 29889, 1188, 29906, 29898, 29950, 876, 13, 2 ]
eval/scripts/__init__.py
mbatchkarov/dc_evaluation
0
25751
<reponame>mbatchkarov/dc_evaluation __author__ = 'mmb28' import sys sys.path.append('.') sys.path.append('..') sys.path.append('../..')
[ 1, 529, 276, 1112, 420, 29958, 8337, 905, 5689, 586, 29914, 13891, 29918, 24219, 362, 13, 1649, 8921, 1649, 353, 525, 4317, 29890, 29906, 29947, 29915, 13, 5215, 10876, 13, 13, 9675, 29889, 2084, 29889, 4397, 12839, 1495, 13, 9675, 29889, 2084, 29889, 4397, 877, 636, 1495, 13, 9675, 29889, 2084, 29889, 4397, 877, 6995, 636, 1495, 2 ]
tests/session_tests/single_agent.py
gitter-badger/agent
8
75296
<reponame>gitter-badger/agent #!/usr/bin/env python3 # -*- coding: utf-8 -*- __author__ = "<NAME>" __doc__ = r""" Created on 18/01/2020 """ from neodroidagent.entry_points import session_entry_point def test_single_agent_session(): from neodroidagent.agents.random_agent import RandomAgent from neodroidagent.common.session_factory.single_agent.parallel import ( ParallelSession, ) from neodroidagent.common.session_factory.single_agent.procedures.rollout_inference import ( RolloutInference, ) session_entry_point( RandomAgent, {}, session=ParallelSession( procedure=RolloutInference, environment_type=True, auto_reset_on_terminal_state=True, ), ) if __name__ == "__main__": test_single_agent_session()
[ 1, 529, 276, 1112, 420, 29958, 29887, 5171, 29899, 12313, 914, 29914, 14748, 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, 9872, 5813, 11903, 13, 1649, 1514, 1649, 353, 364, 15945, 29908, 13, 13, 965, 6760, 630, 373, 29871, 29896, 29947, 29914, 29900, 29896, 29914, 29906, 29900, 29906, 29900, 13, 965, 9995, 13, 13, 3166, 452, 397, 1007, 14748, 29889, 8269, 29918, 9748, 1053, 4867, 29918, 8269, 29918, 3149, 13, 13, 13, 1753, 1243, 29918, 14369, 29918, 14748, 29918, 7924, 7295, 13, 1678, 515, 452, 397, 1007, 14748, 29889, 351, 1237, 29889, 8172, 29918, 14748, 1053, 16968, 19661, 13, 1678, 515, 452, 397, 1007, 14748, 29889, 9435, 29889, 7924, 29918, 14399, 29889, 14369, 29918, 14748, 29889, 23482, 1053, 313, 13, 4706, 1459, 6553, 7317, 29892, 13, 1678, 1723, 13, 1678, 515, 452, 397, 1007, 14748, 29889, 9435, 29889, 7924, 29918, 14399, 29889, 14369, 29918, 14748, 29889, 771, 1133, 1973, 29889, 1245, 449, 29918, 262, 1659, 1053, 313, 13, 4706, 21809, 449, 797, 1659, 29892, 13, 1678, 1723, 13, 13, 1678, 4867, 29918, 8269, 29918, 3149, 29898, 13, 4706, 16968, 19661, 29892, 13, 4706, 24335, 13, 4706, 4867, 29922, 2177, 6553, 7317, 29898, 13, 9651, 8792, 29922, 29934, 3028, 449, 797, 1659, 29892, 13, 9651, 5177, 29918, 1853, 29922, 5574, 29892, 13, 9651, 4469, 29918, 12071, 29918, 265, 29918, 8489, 979, 29918, 3859, 29922, 5574, 29892, 13, 4706, 10353, 13, 1678, 1723, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1243, 29918, 14369, 29918, 14748, 29918, 7924, 580, 13, 2 ]
trypython/stdlib/itertools_/itertools04.py
devlights/try-python
4
190962
<gh_stars>1-10 # coding: utf-8 """ itertools モジュールについてのサンプル 以下の処理についてのサンプルです。 - count() - accumulate() - compress() - dropwhile() - filterfalse() """ import itertools as it import operator as op from trypython.common.commoncls import SampleBase from trypython.common.commonfunc import pr, hr class Sample(SampleBase): def exec(self): # ----------------------------------------------- # itertools.count() # ---------------------- # 無限イテレータ。 # 指定した start 値から step 分加算した値を # 生成し続ける。 # ----------------------------------------------- hr('itertools.count()') iter01 = it.count(start=10, step=2) for i in iter01: if i > 20: break pr('it.count', i) # ----------------------------------------------- # itertools.accumulate() # ---------------------- # 指定した関数の結果を累積した結果を返す。 # 汎用性が高い関数。seed は指定できない。 # 最終的な累積結果のみが欲しい場合はfunctools.reduce() を使う。 # # 操作するための関数を指定しない場合、デフォルトは加算(operator.add)となる # 操作関数は引数を二つ受け取るものを指定する必要がある # 一つ目の引数に現在の累積値、二つ目に次の項目が入る。 # 以下のようなイメージとなる # # list(itertools.accumlate([1, 2, 3, 4, 5])) # # operator.add(1, 2) ==> 3 # operator.add(3, 3) ==> 6 # operator.add(6, 4) ==> 10 # operator.add(10, 5) ==> 15 # # なので、結果は[1, 3, 6, 10, 15]となる # ----------------------------------------------- hr('itertools.accumulate()') data01 = [1, 2, 3, 4, 5] # 加算 pr('it.accumulate', list(it.accumulate(data01, op.add))) # 乗算 pr('it.accumulate', list(it.accumulate(data01, op.mul))) # 自前関数 def _accum(accum: int, curr: int) -> int: return accum * curr if accum < 20 else 20 pr('it.accumulate', list(it.accumulate(data01, func=_accum))) # ----------------------------------------------- # itertools.compress() # ---------------------- # 引数に指定されたシーケンスを第二引数で指定したリスト # 内でTrueとなっているもののみにフィルタリングする。 # 注意点として、zip関数と同様に短い方が終了した # 段階で処理が打ち切られる。 # ----------------------------------------------- hr('itertools.compress()') selector01 = [True if x >= 3 else False for x in data01] pr('it.compress', list(it.compress(data01, selectors=selector01))) # ----------------------------------------------- # itertools.dropwhile() # ---------------------- # 条件が成り立つ間、要素を捨てる。 # 条件が成り立たなくなってからの要素が返る。 # 他の言語では、SkipWhile() という名前になったりする。 # 第一引数が predicate つまり、条件。 # 第二引数が データ であることに注意。 # ----------------------------------------------- hr('itertools.dropwhile()') pr('it.dropwhile', list(it.dropwhile(lambda x: x < 3, data01))) # ----------------------------------------------- # itertools.filterfalse() # ---------------------- # ちょっと特殊な子で、条件がfalseとなるものが返る。 # predicate に None が指定できる。Noneを指定した # 場合は、データの要素が false 判定されたものが返る。 # 第一引数が predicate つまり、条件。 # 第二引数が データ であることに注意。 # ----------------------------------------------- hr('itertools.filterfalse()') pr('it.filterfalse', list(it.filterfalse(lambda x: x < 3, data01))) # ---------------------------------------------------------------------------- # 上の dropwhile と filterfalse では同じ条件を指定している。 # dropwhile は predicate が True の要素は飛ばして、falseになってから要素を返す。 # filterfalse は predicate が false の要素を返す。 # つまり、上の2つは対象データが[1, 2, 3, 4, 5]の場合は、同じ結果となる。 # # 違いが出るのは、一旦 True なデータが出現した後に 再度 false データが出現した場合 # # dropwhile() は、一度 True になった後は、以降のデータは無条件で全部返る。 # filterfalse() は、false の判定になったものしか返さない。 # ---------------------------------------------------------------------------- hr('difference between dropwhile() and filterfalse()') data02 = [*data01, 2, 1, 3, 4, 5] pr('it.dropwhile', list(it.dropwhile(lambda x: x < 3, data02))) pr('it.filterfalse', list(it.filterfalse(lambda x: x < 3, data02))) def go(): obj = Sample() obj.exec()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 15945, 29908, 13, 1524, 8504, 29871, 30761, 30391, 30645, 30185, 30258, 30353, 30773, 30298, 30466, 30199, 30615, 30203, 30605, 30258, 13, 13, 30651, 30557, 30199, 232, 138, 169, 30687, 30353, 30773, 30298, 30466, 30199, 30615, 30203, 30605, 30258, 30499, 30427, 30267, 13, 13, 29899, 2302, 580, 13, 29899, 18414, 5987, 580, 13, 29899, 27122, 580, 13, 29899, 5768, 8000, 580, 13, 29899, 4175, 4541, 580, 13, 15945, 29908, 13, 5215, 4256, 8504, 408, 372, 13, 5215, 5455, 408, 1015, 13, 13, 3166, 1018, 4691, 29889, 9435, 29889, 9435, 25932, 1053, 21029, 5160, 13, 3166, 1018, 4691, 29889, 9435, 29889, 9435, 9891, 1053, 544, 29892, 22157, 13, 13, 13, 1990, 21029, 29898, 17708, 5160, 1125, 13, 1678, 822, 2279, 29898, 1311, 1125, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 396, 4256, 8504, 29889, 2798, 580, 13, 4706, 396, 448, 2683, 23648, 13, 4706, 396, 29871, 31209, 31175, 30260, 30572, 30420, 30185, 30369, 30267, 13, 4706, 396, 29871, 31084, 30495, 30326, 30366, 1369, 29871, 232, 131, 167, 30412, 30513, 4331, 29871, 30748, 30666, 31565, 30326, 30366, 232, 131, 167, 30396, 13, 4706, 396, 29871, 30486, 30494, 30326, 234, 185, 157, 30807, 30332, 30267, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 22157, 877, 1524, 8504, 29889, 2798, 580, 1495, 13, 13, 4706, 4256, 29900, 29896, 353, 372, 29889, 2798, 29898, 2962, 29922, 29896, 29900, 29892, 4331, 29922, 29906, 29897, 13, 4706, 363, 474, 297, 4256, 29900, 29896, 29901, 13, 9651, 565, 474, 1405, 29871, 29906, 29900, 29901, 13, 18884, 2867, 13, 9651, 544, 877, 277, 29889, 2798, 742, 474, 29897, 13, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 396, 4256, 8504, 29889, 5753, 398, 5987, 580, 13, 4706, 396, 448, 2683, 23648, 13, 4706, 396, 29871, 31084, 30495, 30326, 30366, 31606, 30354, 30199, 31711, 30801, 30396, 234, 183, 178, 234, 172, 144, 30326, 30366, 31711, 30801, 30396, 31086, 30427, 30267, 13, 4706, 396, 29871, 233, 180, 145, 30406, 30952, 30458, 30528, 30298, 31606, 30354, 30267, 26776, 29871, 30449, 31084, 30495, 30499, 30538, 30371, 30298, 30267, 13, 4706, 396, 29871, 30878, 234, 184, 133, 30210, 30371, 234, 183, 178, 234, 172, 144, 31711, 30801, 30199, 30735, 30458, 233, 175, 181, 30326, 30298, 31045, 30733, 30449, 7692, 312, 8789, 29889, 17469, 580, 29871, 30396, 30785, 30465, 30267, 13, 4706, 396, 13, 4706, 396, 29871, 31904, 30732, 30427, 30332, 30366, 30954, 30199, 31606, 30354, 30396, 31084, 30495, 30326, 30371, 30298, 31045, 30733, 30330, 30597, 30423, 31402, 30258, 30279, 30449, 30666, 31565, 29898, 6891, 29889, 1202, 29897, 30364, 30371, 30332, 13, 4706, 396, 29871, 31904, 30732, 31606, 30354, 30449, 31674, 30354, 30396, 30685, 30773, 232, 146, 154, 30807, 30683, 30332, 30723, 30199, 30396, 31084, 30495, 30427, 30332, 31641, 30698, 30458, 30641, 30332, 13, 4706, 396, 29871, 30287, 30773, 30895, 30199, 31674, 30354, 30353, 31928, 30505, 30199, 234, 183, 178, 234, 172, 144, 232, 131, 167, 30330, 30685, 30773, 30895, 30353, 30936, 30199, 236, 163, 136, 30895, 30458, 30752, 30332, 30267, 13, 4706, 396, 29871, 30651, 30557, 30199, 30787, 30465, 30371, 30260, 30604, 30185, 30391, 30364, 30371, 30332, 13, 4706, 396, 13, 4706, 396, 1051, 29898, 1524, 8504, 29889, 5753, 398, 9632, 4197, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 12622, 13, 4706, 396, 13, 4706, 396, 5455, 29889, 1202, 29898, 29896, 29892, 29871, 29906, 29897, 29871, 25230, 29871, 29941, 13, 4706, 396, 5455, 29889, 1202, 29898, 29941, 29892, 29871, 29941, 29897, 29871, 25230, 29871, 29953, 13, 4706, 396, 5455, 29889, 1202, 29898, 29953, 29892, 29871, 29946, 29897, 29871, 25230, 29871, 29896, 29900, 13, 4706, 396, 5455, 29889, 1202, 29898, 29896, 29900, 29892, 29871, 29945, 29897, 25230, 29871, 29896, 29945, 13, 4706, 396, 13, 4706, 396, 29871, 30371, 30199, 30499, 30330, 31711, 30801, 30449, 29961, 29896, 29892, 29871, 29941, 29892, 29871, 29953, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29945, 29962, 30364, 30371, 30332, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 22157, 877, 1524, 8504, 29889, 5753, 398, 5987, 580, 1495, 13, 13, 4706, 848, 29900, 29896, 353, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29962, 13, 13, 4706, 396, 29871, 30666, 31565, 13, 4706, 544, 877, 277, 29889, 5753, 398, 5987, 742, 1051, 29898, 277, 29889, 5753, 398, 5987, 29898, 1272, 29900, 29896, 29892, 1015, 29889, 1202, 4961, 13, 4706, 396, 29871, 231, 188, 154, 31565, 13, 4706, 544, 877, 277, 29889, 5753, 398, 5987, 742, 1051, 29898, 277, 29889, 5753, 398, 5987, 29898, 1272, 29900, 29896, 29892, 1015, 29889, 16109, 4961, 13, 13, 4706, 396, 29871, 30688, 30658, 31606, 30354, 13, 4706, 822, 903, 5753, 398, 29898, 5753, 398, 29901, 938, 29892, 16256, 29901, 938, 29897, 1599, 938, 29901, 13, 9651, 736, 18414, 334, 16256, 565, 18414, 529, 29871, 29906, 29900, 1683, 29871, 29906, 29900, 13, 13, 4706, 544, 877, 277, 29889, 5753, 398, 5987, 742, 1051, 29898, 277, 29889, 5753, 398, 5987, 29898, 1272, 29900, 29896, 29892, 3653, 29922, 29918, 5753, 398, 4961, 13, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 396, 4256, 8504, 29889, 510, 2139, 580, 13, 4706, 396, 448, 2683, 23648, 13, 4706, 396, 29871, 31674, 30354, 30353, 31084, 30495, 30566, 30553, 30366, 30373, 30185, 30978, 30203, 30255, 30396, 30622, 30685, 31674, 30354, 30499, 31084, 30495, 30326, 30366, 30303, 30255, 30279, 13, 4706, 396, 29871, 30728, 30499, 5574, 30364, 30371, 30665, 30466, 30298, 30332, 30723, 30199, 30199, 30735, 30353, 30423, 30532, 30258, 30369, 30303, 30203, 30521, 30427, 30332, 30267, 13, 4706, 396, 29871, 31368, 31474, 30940, 30364, 30326, 30466, 30330, 7554, 31606, 30354, 30364, 30980, 233, 170, 155, 30353, 234, 162, 176, 30298, 30525, 30458, 234, 184, 133, 30743, 30326, 30366, 13, 4706, 396, 29871, 31559, 236, 157, 145, 30499, 232, 138, 169, 30687, 30458, 31656, 30644, 31757, 30513, 30553, 30332, 30267, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 22157, 877, 1524, 8504, 29889, 510, 2139, 580, 1495, 13, 13, 4706, 11764, 29900, 29896, 353, 518, 5574, 565, 921, 6736, 29871, 29941, 1683, 7700, 363, 921, 297, 848, 29900, 29896, 29962, 13, 4706, 544, 877, 277, 29889, 510, 2139, 742, 1051, 29898, 277, 29889, 510, 2139, 29898, 1272, 29900, 29896, 29892, 1831, 943, 29922, 14357, 29900, 29896, 4961, 13, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 396, 4256, 8504, 29889, 8865, 8000, 580, 13, 4706, 396, 448, 2683, 23648, 13, 4706, 396, 29871, 31217, 30631, 30458, 30494, 30453, 30939, 30773, 31069, 30330, 30698, 31605, 30396, 233, 144, 171, 30466, 30332, 30267, 13, 4706, 396, 29871, 31217, 30631, 30458, 30494, 30453, 30939, 30366, 30371, 30568, 30371, 30665, 30466, 30412, 30513, 30199, 30698, 31605, 30458, 31086, 30332, 30267, 13, 4706, 396, 29871, 31221, 30199, 31243, 30968, 30499, 30449, 30330, 15797, 666, 8809, 488, 580, 29871, 30364, 30298, 30465, 30548, 30658, 30353, 30371, 30665, 30366, 30453, 30427, 30332, 30267, 13, 4706, 396, 29871, 30622, 30287, 31674, 30354, 30458, 24384, 29871, 30773, 30441, 30453, 30330, 31217, 30631, 30267, 13, 4706, 396, 29871, 30622, 30685, 31674, 30354, 30458, 29871, 30597, 30185, 30369, 29871, 30499, 30641, 30332, 30589, 30364, 30353, 31368, 31474, 30267, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 22157, 877, 1524, 8504, 29889, 8865, 8000, 580, 1495, 13, 4706, 544, 877, 277, 29889, 8865, 8000, 742, 1051, 29898, 277, 29889, 8865, 8000, 29898, 2892, 921, 29901, 921, 529, 29871, 29941, 29892, 848, 29900, 29896, 4961, 13, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 396, 4256, 8504, 29889, 4572, 4541, 580, 13, 4706, 396, 448, 2683, 23648, 13, 4706, 396, 29871, 30644, 31414, 30665, 30364, 31141, 233, 177, 141, 30371, 30319, 30499, 30330, 31217, 30631, 30458, 4541, 30364, 30371, 30332, 30723, 30199, 30458, 31086, 30332, 30267, 13, 4706, 396, 24384, 29871, 30353, 6213, 29871, 30458, 31084, 30495, 30499, 30538, 30332, 30267, 8516, 30396, 31084, 30495, 30326, 30366, 13, 4706, 396, 29871, 31045, 30733, 30449, 30330, 30597, 30185, 30369, 30199, 30698, 31605, 30458, 2089, 29871, 31791, 30495, 30566, 30553, 30366, 30723, 30199, 30458, 31086, 30332, 30267, 13, 4706, 396, 29871, 30622, 30287, 31674, 30354, 30458, 24384, 29871, 30773, 30441, 30453, 30330, 31217, 30631, 30267, 13, 4706, 396, 29871, 30622, 30685, 31674, 30354, 30458, 29871, 30597, 30185, 30369, 29871, 30499, 30641, 30332, 30589, 30364, 30353, 31368, 31474, 30267, 13, 4706, 396, 448, 2683, 2683, 9072, 489, 13, 4706, 22157, 877, 1524, 8504, 29889, 4572, 4541, 580, 1495, 13, 4706, 544, 877, 277, 29889, 4572, 4541, 742, 1051, 29898, 277, 29889, 4572, 4541, 29898, 2892, 921, 29901, 921, 529, 29871, 29941, 29892, 848, 29900, 29896, 4961, 13, 13, 4706, 396, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 4706, 396, 29871, 30429, 30199, 5768, 8000, 29871, 30364, 4175, 4541, 29871, 30499, 30449, 30980, 31115, 31217, 30631, 30396, 31084, 30495, 30326, 30466, 30298, 30332, 30267, 13, 4706, 396, 5768, 8000, 29871, 30449, 24384, 29871, 30458, 5852, 29871, 30199, 30698, 31605, 30449, 31877, 31254, 30326, 30466, 30330, 4541, 30353, 30371, 30665, 30466, 30412, 30513, 30698, 31605, 30396, 31086, 30427, 30267, 13, 4706, 396, 4175, 4541, 29871, 30449, 24384, 29871, 30458, 2089, 29871, 30199, 30698, 31605, 30396, 31086, 30427, 30267, 13, 4706, 396, 29871, 30773, 30441, 30453, 30330, 30429, 30199, 29906, 30773, 30449, 232, 178, 193, 31133, 30597, 30185, 30369, 30458, 29961, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29962, 30199, 31045, 30733, 30449, 30330, 30980, 31115, 31711, 30801, 30364, 30371, 30332, 30267, 13, 4706, 396, 13, 4706, 396, 29871, 236, 132, 152, 30298, 30458, 30544, 30332, 30199, 30449, 30330, 30287, 233, 154, 169, 5852, 29871, 30371, 30597, 30185, 30369, 30458, 30544, 31928, 30326, 30366, 31220, 30353, 29871, 31733, 30898, 2089, 29871, 30597, 30185, 30369, 30458, 30544, 31928, 30326, 30366, 31045, 30733, 13, 4706, 396, 13, 4706, 396, 5768, 8000, 580, 29871, 30449, 30330, 30287, 30898, 5852, 29871, 30353, 30371, 30665, 30366, 31220, 30449, 30330, 30651, 236, 156, 144, 30199, 30597, 30185, 30369, 30449, 31209, 31217, 30631, 30499, 30753, 30636, 31086, 30332, 30267, 13, 4706, 396, 4175, 4541, 580, 29871, 30449, 30330, 4541, 29871, 30199, 31791, 30495, 30353, 30371, 30665, 30366, 30723, 30199, 30326, 30412, 31086, 30566, 30371, 30298, 30267, 13, 4706, 396, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 4706, 22157, 877, 29881, 17678, 1546, 5768, 8000, 580, 322, 4175, 4541, 580, 1495, 13, 4706, 848, 29900, 29906, 353, 518, 29930, 1272, 29900, 29896, 29892, 29871, 29906, 29892, 29871, 29896, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29962, 13, 4706, 544, 877, 277, 29889, 8865, 8000, 742, 1051, 29898, 277, 29889, 8865, 8000, 29898, 2892, 921, 29901, 921, 529, 29871, 29941, 29892, 848, 29900, 29906, 4961, 13, 4706, 544, 877, 277, 29889, 4572, 4541, 742, 1051, 29898, 277, 29889, 4572, 4541, 29898, 2892, 921, 29901, 921, 529, 29871, 29941, 29892, 848, 29900, 29906, 4961, 13, 13, 13, 1753, 748, 7295, 13, 1678, 5446, 353, 21029, 580, 13, 1678, 5446, 29889, 4258, 580, 13, 2 ]
mountaintools/cairio/__init__.py
tjd2002/spikeforest2
0
148751
<reponame>tjd2002/spikeforest2 from .cairioclient import CairioClient, client
[ 1, 529, 276, 1112, 420, 29958, 29873, 26012, 29906, 29900, 29900, 29906, 29914, 1028, 9345, 1454, 342, 29906, 13, 3166, 869, 1113, 12737, 542, 1593, 1053, 315, 1794, 5378, 4032, 29892, 3132, 13, 2 ]
indicators/data.py
WPRDC/community-simulacrum
0
38357
import dataclasses import typing from dataclasses import dataclass from typing import List from typing import Optional from profiles.settings import DENOM_DKEY, VALUE_DKEY, GEOG_DKEY, TIME_DKEY if typing.TYPE_CHECKING: from indicators.models import CensusVariable, CKANVariable @dataclass class Datum: variable: str geog: str time: str value: Optional[float] = None moe: Optional[float] = None percent: Optional[float] = None denom: Optional[float] = None @staticmethod def from_census_response_datum(variable: 'CensusVariable', census_datum) -> 'Datum': return Datum( variable=variable.slug, geog=census_datum.get('geog'), time=census_datum.get('time'), value=census_datum.get('value'), moe=census_datum.get('moe'), denom=census_datum.get('denom'), percent=census_datum.get('percent'), ) @staticmethod def from_census_response_data(variable: 'CensusVariable', census_data: list[dict]) -> List['Datum']: return [Datum.from_census_response_datum(variable, census_datum) for census_datum in census_data] @staticmethod def from_ckan_response_datum(variable: 'CKANVariable', ckan_datum) -> 'Datum': denom, percent = None, None if DENOM_DKEY in ckan_datum: denom = ckan_datum[DENOM_DKEY] percent = (ckan_datum[VALUE_DKEY] / ckan_datum[DENOM_DKEY]) return Datum(variable=variable.slug, geog=ckan_datum[GEOG_DKEY], time=ckan_datum[TIME_DKEY], value=ckan_datum[VALUE_DKEY], denom=denom, percent=percent) @staticmethod def from_ckan_response_data(variable: 'CKANVariable', ckan_data: list[dict]) -> List['Datum']: return [Datum.from_ckan_response_datum(variable, ckan_datum) for ckan_datum in ckan_data] def update(self, **kwargs): """ Creates new Datum similar to the instance with new values from kwargs """ return Datum(**{**self.as_dict(), **kwargs}) def with_denom_val(self, denom_val: Optional[float]): """ Merge the denom value and generate the percent """ return dataclasses.replace(self, denom=denom_val, percent=(self.value / denom_val)) def as_dict(self): return {'variable': self.variable, 'geog': self.geog, 'time': self.time, 'value': self.value, 'moe': self.moe, 'percent': self.percent, 'denom': self.denom} def as_value_dict(self): return {'value': self.value, 'moe': self.moe, 'percent': self.percent, 'denom': self.denom}
[ 1, 1053, 848, 13203, 13, 5215, 19229, 13, 3166, 848, 13203, 1053, 848, 1990, 13, 3166, 19229, 1053, 2391, 13, 3166, 19229, 1053, 28379, 13, 13, 3166, 28723, 29889, 11027, 1053, 360, 1430, 6488, 29918, 29928, 10818, 29892, 12599, 4462, 29918, 29928, 10818, 29892, 402, 29923, 29949, 29954, 29918, 29928, 10818, 29892, 323, 8890, 29918, 29928, 10818, 13, 13, 361, 19229, 29889, 11116, 29918, 3210, 16658, 4214, 29901, 13, 1678, 515, 4221, 4097, 29889, 9794, 1053, 20121, 16174, 29892, 315, 29968, 2190, 16174, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 13373, 398, 29901, 13, 1678, 2286, 29901, 851, 13, 1678, 1737, 468, 29901, 851, 13, 1678, 931, 29901, 851, 13, 1678, 995, 29901, 28379, 29961, 7411, 29962, 353, 6213, 13, 1678, 2730, 29872, 29901, 28379, 29961, 7411, 29962, 353, 6213, 13, 1678, 10151, 29901, 28379, 29961, 7411, 29962, 353, 6213, 13, 1678, 972, 290, 29901, 28379, 29961, 7411, 29962, 353, 6213, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 515, 29918, 29883, 8841, 29918, 5327, 29918, 4130, 398, 29898, 11918, 29901, 525, 29907, 8841, 16174, 742, 16411, 29918, 4130, 398, 29897, 1599, 525, 16390, 398, 2396, 13, 4706, 736, 13373, 398, 29898, 13, 9651, 2286, 29922, 11918, 29889, 29517, 29892, 13, 9651, 1737, 468, 29922, 29883, 8841, 29918, 4130, 398, 29889, 657, 877, 479, 468, 5477, 13, 9651, 931, 29922, 29883, 8841, 29918, 4130, 398, 29889, 657, 877, 2230, 5477, 13, 9651, 995, 29922, 29883, 8841, 29918, 4130, 398, 29889, 657, 877, 1767, 5477, 13, 9651, 2730, 29872, 29922, 29883, 8841, 29918, 4130, 398, 29889, 657, 877, 4346, 29872, 5477, 13, 9651, 972, 290, 29922, 29883, 8841, 29918, 4130, 398, 29889, 657, 877, 1145, 290, 5477, 13, 9651, 10151, 29922, 29883, 8841, 29918, 4130, 398, 29889, 657, 877, 25376, 5477, 1723, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 515, 29918, 29883, 8841, 29918, 5327, 29918, 1272, 29898, 11918, 29901, 525, 29907, 8841, 16174, 742, 16411, 29918, 1272, 29901, 1051, 29961, 8977, 2314, 1599, 2391, 1839, 16390, 398, 2033, 29901, 13, 4706, 736, 518, 16390, 398, 29889, 3166, 29918, 29883, 8841, 29918, 5327, 29918, 4130, 398, 29898, 11918, 29892, 16411, 29918, 4130, 398, 29897, 363, 16411, 29918, 4130, 398, 297, 16411, 29918, 1272, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 515, 29918, 384, 273, 29918, 5327, 29918, 4130, 398, 29898, 11918, 29901, 525, 7077, 2190, 16174, 742, 274, 11052, 29918, 4130, 398, 29897, 1599, 525, 16390, 398, 2396, 13, 4706, 972, 290, 29892, 10151, 353, 6213, 29892, 6213, 13, 4706, 565, 360, 1430, 6488, 29918, 29928, 10818, 297, 274, 11052, 29918, 4130, 398, 29901, 13, 9651, 972, 290, 353, 274, 11052, 29918, 4130, 398, 29961, 29928, 1430, 6488, 29918, 29928, 10818, 29962, 13, 9651, 10151, 353, 313, 384, 273, 29918, 4130, 398, 29961, 19143, 29918, 29928, 10818, 29962, 847, 274, 11052, 29918, 4130, 398, 29961, 29928, 1430, 6488, 29918, 29928, 10818, 2314, 13, 13, 4706, 736, 13373, 398, 29898, 11918, 29922, 11918, 29889, 29517, 29892, 13, 462, 268, 1737, 468, 29922, 384, 273, 29918, 4130, 398, 29961, 1692, 29949, 29954, 29918, 29928, 10818, 1402, 13, 462, 268, 931, 29922, 384, 273, 29918, 4130, 398, 29961, 15307, 29918, 29928, 10818, 1402, 13, 462, 268, 995, 29922, 384, 273, 29918, 4130, 398, 29961, 19143, 29918, 29928, 10818, 1402, 13, 462, 268, 972, 290, 29922, 1145, 290, 29892, 13, 462, 268, 10151, 29922, 25376, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 515, 29918, 384, 273, 29918, 5327, 29918, 1272, 29898, 11918, 29901, 525, 7077, 2190, 16174, 742, 274, 11052, 29918, 1272, 29901, 1051, 29961, 8977, 2314, 1599, 2391, 1839, 16390, 398, 2033, 29901, 13, 4706, 736, 518, 16390, 398, 29889, 3166, 29918, 384, 273, 29918, 5327, 29918, 4130, 398, 29898, 11918, 29892, 274, 11052, 29918, 4130, 398, 29897, 363, 274, 11052, 29918, 4130, 398, 297, 274, 11052, 29918, 1272, 29962, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 9995, 6760, 1078, 716, 13373, 398, 2788, 304, 278, 2777, 411, 716, 1819, 515, 9049, 5085, 9995, 13, 4706, 736, 13373, 398, 29898, 1068, 29912, 1068, 1311, 29889, 294, 29918, 8977, 3285, 3579, 19290, 1800, 13, 13, 1678, 822, 411, 29918, 1145, 290, 29918, 791, 29898, 1311, 29892, 972, 290, 29918, 791, 29901, 28379, 29961, 7411, 29962, 1125, 13, 4706, 9995, 4702, 479, 278, 972, 290, 995, 322, 5706, 278, 10151, 9995, 13, 4706, 736, 848, 13203, 29889, 6506, 29898, 1311, 29892, 972, 290, 29922, 1145, 290, 29918, 791, 29892, 10151, 7607, 1311, 29889, 1767, 847, 972, 290, 29918, 791, 876, 13, 13, 1678, 822, 408, 29918, 8977, 29898, 1311, 1125, 13, 4706, 736, 11117, 11918, 2396, 1583, 29889, 11918, 29892, 525, 479, 468, 2396, 1583, 29889, 479, 468, 29892, 525, 2230, 2396, 1583, 29889, 2230, 29892, 13, 18884, 525, 1767, 2396, 1583, 29889, 1767, 29892, 525, 4346, 29872, 2396, 1583, 29889, 4346, 29872, 29892, 525, 25376, 2396, 1583, 29889, 25376, 29892, 525, 1145, 290, 2396, 1583, 29889, 1145, 290, 29913, 13, 13, 1678, 822, 408, 29918, 1767, 29918, 8977, 29898, 1311, 1125, 13, 4706, 736, 11117, 1767, 2396, 1583, 29889, 1767, 29892, 525, 4346, 29872, 2396, 1583, 29889, 4346, 29872, 29892, 525, 25376, 2396, 1583, 29889, 25376, 29892, 525, 1145, 290, 2396, 1583, 29889, 1145, 290, 29913, 13, 2 ]
gym_locm/toolbox/predictor.py
dfpetrin/gym-locm
12
23139
<reponame>dfpetrin/gym-locm<gh_stars>10-100 import argparse import json import os import pathlib import numpy as np import pexpect from scipy.special import softmax base_path = str(pathlib.Path(__file__).parent.absolute()) def get_arg_parser(): p = argparse.ArgumentParser( description="This is a predictor for trained RL drafts.", formatter_class=argparse.ArgumentDefaultsHelpFormatter) p.add_argument("--draft", help="path to draft model", default="draft.json") p.add_argument("--draft-1", help="path to first draft model", default="1st-draft.json") p.add_argument("--draft-2", help="path to second draft model", default="2nd-draft.json") p.add_argument("--battle", help="command line to execute the battle agent", default='./battle') return p def read_game_input(): # read players info game_input = [input(), input()] # read cards in hand and actions from opponent opp_hand, opp_actions = [int(i) for i in input().split()] game_input.append(f"{opp_hand} {opp_actions}") # read all opponent actions for i in range(opp_actions): game_input.append(input()) # opp action #i # read card count card_count = int(input()) game_input.append(str(card_count)) # read cards for i in range(card_count): game_input.append(input()) # card #i return game_input def encode_state(game_input): # initialize empty state state = np.zeros((3, 16), dtype=np.float32) # get how many opponent action lines to skip opp_actions = int(game_input[2].split()[1]) # put choices from player hand into the state for i, card in enumerate(game_input[4 + opp_actions:]): card = card.split() card_type = [1.0 if int(card[3]) == i else 0.0 for i in range(4)] cost = int(card[4]) / 12 attack = int(card[5]) / 12 defense = max(-12, int(card[6])) / 12 keywords = list(map(int, map(card[7].__contains__, 'BCDGLW'))) player_hp = int(card[8]) / 12 enemy_hp = int(card[9]) / 12 card_draw = int(card[10]) / 2 state[i] = card_type + [cost, attack, defense, player_hp, enemy_hp, card_draw] + keywords return state.flatten() def act(network, state, past_choices): i = 0 use_history = network[list(network.keys())[0]].shape[0] == 33 * 16 if use_history: state = np.concatenate([past_choices, state]) # do a forward pass through all fully connected layers while f"model/shared_fc{i}/w:0" in network: weights = network[f"model/shared_fc{i}/w:0"] biases = network[f"model/shared_fc{i}/b:0"] state = np.dot(state, weights) + biases state = np.tanh(state) i += 1 # calculate the policy pi = np.dot(state, network["model/pi/w:0"]) + network["model/pi/b:0"] pi = softmax(pi) # extract the deterministic action action = np.argmax(pi) return action def is_valid_action(action): return action.startswith('PASS') or action.startswith('PICK') \ or action.startswith('SUMMON') or action.startswith('USE') \ or action.startswith('ATTACK') def load_model(path: str): # read the parameters with open(base_path + "/" + path, 'r') as json_file: params = json.load(json_file) # initialize the network dict network = {} # load activation function for hidden layers if 'version' not in params or params['version'] < 2: network['act_fun'] = np.tanh else: network['act_fun'] = dict( tanh=np.tanh, relu=lambda x: np.maximum(x, 0), elu=lambda x: np.where(x > 0, x, np.exp(x) - 1) )[params['act_fun']] del params['version'] del params['act_fun'] # load weights as numpy arrays for label, weights in params.items(): network[label] = np.array(weights) return network def predict(paths: list, battle_cmd: str): network = None # spawn the battle agent battle_agent = pexpect.spawn(battle_cmd, echo=False, encoding='utf-8') # count the draft turns turn = 0 # initialize past choices past_choices = np.zeros((30, 16)) while True: game_input = read_game_input() # write game input to the agent regardless of the phase battle_agent.write("\n".join(game_input) + "\n") action = "" # find action line between all of the agent output while not is_valid_action(action): action = battle_agent.readline() # if mana is zero then it is draft phase is_draft_phase = int(game_input[0].split()[1]) == 0 if network is None: playing_first = game_input[0].split()[2] == game_input[1].split()[2] path = paths[0] if playing_first or len(paths) == 1 else paths[1] network = load_model(path) if is_draft_phase: state = encode_state(game_input) action = act(network, state, past_choices) # update past choices with current pick past_choices[turn] = state[action * 16:(action + 1) * 16] turn += 1 print("PICK", action) else: # print action from battle agent print(action.strip()) def run(): # get arguments arg_parser = get_arg_parser() args = arg_parser.parse_args() # use json as draft agent if os.path.isfile(args.draft): paths = [args.draft] else: paths = [args.draft_1, args.draft_2] predict(paths, args.battle) if __name__ == '__main__': run()
[ 1, 529, 276, 1112, 420, 29958, 2176, 10963, 17056, 29914, 29887, 962, 29899, 2029, 29885, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 1852, 5510, 13, 5215, 4390, 13, 5215, 2897, 13, 5215, 2224, 1982, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 282, 17854, 13, 3166, 4560, 2272, 29889, 18732, 1053, 4964, 3317, 13, 13, 3188, 29918, 2084, 353, 851, 29898, 2084, 1982, 29889, 2605, 22168, 1445, 1649, 467, 3560, 29889, 23552, 3101, 13, 13, 13, 1753, 679, 29918, 1191, 29918, 16680, 7295, 13, 1678, 282, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 4706, 6139, 543, 4013, 338, 263, 8500, 272, 363, 16370, 390, 29931, 18195, 29879, 19602, 13, 4706, 883, 2620, 29918, 1990, 29922, 1191, 5510, 29889, 15730, 24863, 29648, 18522, 29897, 13, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 489, 29881, 4154, 613, 1371, 543, 2084, 304, 18195, 1904, 613, 13, 462, 259, 2322, 543, 29881, 4154, 29889, 3126, 1159, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 489, 29881, 4154, 29899, 29896, 613, 1371, 543, 2084, 304, 937, 18195, 1904, 613, 13, 462, 259, 2322, 543, 29896, 303, 29899, 29881, 4154, 29889, 3126, 1159, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 489, 29881, 4154, 29899, 29906, 613, 1371, 543, 2084, 304, 1473, 18195, 1904, 613, 13, 462, 259, 2322, 543, 29906, 299, 29899, 29881, 4154, 29889, 3126, 1159, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 489, 29890, 5315, 613, 1371, 543, 6519, 1196, 304, 6222, 278, 10555, 10823, 613, 13, 462, 259, 2322, 2433, 6904, 29890, 5315, 1495, 13, 13, 1678, 736, 282, 13, 13, 13, 1753, 1303, 29918, 11802, 29918, 2080, 7295, 13, 1678, 396, 1303, 10769, 5235, 13, 1678, 3748, 29918, 2080, 353, 518, 2080, 3285, 1881, 580, 29962, 13, 13, 1678, 396, 1303, 15889, 297, 1361, 322, 8820, 515, 23995, 296, 13, 1678, 4575, 29918, 3179, 29892, 4575, 29918, 7387, 353, 518, 524, 29898, 29875, 29897, 363, 474, 297, 1881, 2141, 5451, 580, 29962, 13, 1678, 3748, 29918, 2080, 29889, 4397, 29898, 29888, 29908, 29912, 9354, 29918, 3179, 29913, 426, 9354, 29918, 7387, 27195, 13, 13, 1678, 396, 1303, 599, 23995, 296, 8820, 13, 1678, 363, 474, 297, 3464, 29898, 9354, 29918, 7387, 1125, 13, 4706, 3748, 29918, 2080, 29889, 4397, 29898, 2080, 3101, 29871, 396, 4575, 3158, 396, 29875, 13, 13, 1678, 396, 1303, 5881, 2302, 13, 1678, 5881, 29918, 2798, 353, 938, 29898, 2080, 3101, 13, 1678, 3748, 29918, 2080, 29889, 4397, 29898, 710, 29898, 7543, 29918, 2798, 876, 13, 13, 1678, 396, 1303, 15889, 13, 1678, 363, 474, 297, 3464, 29898, 7543, 29918, 2798, 1125, 13, 4706, 3748, 29918, 2080, 29889, 4397, 29898, 2080, 3101, 29871, 396, 5881, 396, 29875, 13, 13, 1678, 736, 3748, 29918, 2080, 13, 13, 13, 1753, 19750, 29918, 3859, 29898, 11802, 29918, 2080, 1125, 13, 1678, 396, 11905, 4069, 2106, 13, 1678, 2106, 353, 7442, 29889, 3298, 359, 3552, 29941, 29892, 29871, 29896, 29953, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 13, 1678, 396, 679, 920, 1784, 23995, 296, 3158, 3454, 304, 14383, 13, 1678, 4575, 29918, 7387, 353, 938, 29898, 11802, 29918, 2080, 29961, 29906, 1822, 5451, 580, 29961, 29896, 2314, 13, 13, 1678, 396, 1925, 19995, 515, 4847, 1361, 964, 278, 2106, 13, 1678, 363, 474, 29892, 5881, 297, 26985, 29898, 11802, 29918, 2080, 29961, 29946, 718, 4575, 29918, 7387, 17531, 1125, 13, 4706, 5881, 353, 5881, 29889, 5451, 580, 13, 13, 4706, 5881, 29918, 1853, 353, 518, 29896, 29889, 29900, 565, 938, 29898, 7543, 29961, 29941, 2314, 1275, 474, 1683, 29871, 29900, 29889, 29900, 363, 474, 297, 3464, 29898, 29946, 4638, 13, 4706, 3438, 353, 938, 29898, 7543, 29961, 29946, 2314, 847, 29871, 29896, 29906, 13, 4706, 5337, 353, 938, 29898, 7543, 29961, 29945, 2314, 847, 29871, 29896, 29906, 13, 4706, 26406, 353, 4236, 6278, 29896, 29906, 29892, 938, 29898, 7543, 29961, 29953, 12622, 847, 29871, 29896, 29906, 13, 4706, 29361, 353, 1051, 29898, 1958, 29898, 524, 29892, 2910, 29898, 7543, 29961, 29955, 1822, 1649, 11516, 1649, 29892, 525, 5371, 29928, 7239, 29956, 29915, 4961, 13, 4706, 4847, 29918, 28887, 353, 938, 29898, 7543, 29961, 29947, 2314, 847, 29871, 29896, 29906, 13, 4706, 11103, 29918, 28887, 353, 938, 29898, 7543, 29961, 29929, 2314, 847, 29871, 29896, 29906, 13, 4706, 5881, 29918, 4012, 353, 938, 29898, 7543, 29961, 29896, 29900, 2314, 847, 29871, 29906, 13, 13, 4706, 2106, 29961, 29875, 29962, 353, 5881, 29918, 1853, 718, 518, 18253, 29892, 5337, 29892, 26406, 29892, 4847, 29918, 28887, 29892, 13, 462, 18884, 11103, 29918, 28887, 29892, 5881, 29918, 4012, 29962, 718, 29361, 13, 13, 1678, 736, 2106, 29889, 1579, 8606, 580, 13, 13, 13, 1753, 1044, 29898, 11618, 29892, 2106, 29892, 4940, 29918, 1859, 1575, 1125, 13, 1678, 474, 353, 29871, 29900, 13, 13, 1678, 671, 29918, 18434, 353, 3564, 29961, 1761, 29898, 11618, 29889, 8149, 3101, 29961, 29900, 29962, 1822, 12181, 29961, 29900, 29962, 1275, 29871, 29941, 29941, 334, 29871, 29896, 29953, 13, 13, 1678, 565, 671, 29918, 18434, 29901, 13, 4706, 2106, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 29886, 579, 29918, 1859, 1575, 29892, 2106, 2314, 13, 13, 1678, 396, 437, 263, 6375, 1209, 1549, 599, 8072, 6631, 15359, 13, 1678, 1550, 285, 29908, 4299, 29914, 12366, 29918, 13801, 29912, 29875, 6822, 29893, 29901, 29900, 29908, 297, 3564, 29901, 13, 4706, 18177, 353, 3564, 29961, 29888, 29908, 4299, 29914, 12366, 29918, 13801, 29912, 29875, 6822, 29893, 29901, 29900, 3108, 13, 4706, 4768, 2129, 353, 3564, 29961, 29888, 29908, 4299, 29914, 12366, 29918, 13801, 29912, 29875, 6822, 29890, 29901, 29900, 3108, 13, 13, 4706, 2106, 353, 7442, 29889, 6333, 29898, 3859, 29892, 18177, 29897, 718, 4768, 2129, 13, 4706, 2106, 353, 7442, 29889, 13161, 29882, 29898, 3859, 29897, 13, 13, 4706, 474, 4619, 29871, 29896, 13, 13, 1678, 396, 8147, 278, 8898, 13, 1678, 2930, 353, 7442, 29889, 6333, 29898, 3859, 29892, 3564, 3366, 4299, 29914, 1631, 29914, 29893, 29901, 29900, 20068, 718, 3564, 3366, 4299, 29914, 1631, 29914, 29890, 29901, 29900, 3108, 13, 1678, 2930, 353, 4964, 3317, 29898, 1631, 29897, 13, 13, 1678, 396, 6597, 278, 11806, 4695, 3158, 13, 1678, 3158, 353, 7442, 29889, 1191, 3317, 29898, 1631, 29897, 13, 13, 1678, 736, 3158, 13, 13, 13, 1753, 338, 29918, 3084, 29918, 2467, 29898, 2467, 1125, 13, 1678, 736, 3158, 29889, 27382, 2541, 877, 25711, 1495, 470, 3158, 29889, 27382, 2541, 877, 2227, 7077, 1495, 320, 13, 965, 470, 3158, 29889, 27382, 2541, 877, 25021, 22877, 1495, 470, 3158, 29889, 27382, 2541, 877, 17171, 1495, 320, 13, 965, 470, 3158, 29889, 27382, 2541, 877, 1299, 8687, 29968, 1495, 13, 13, 13, 1753, 2254, 29918, 4299, 29898, 2084, 29901, 851, 1125, 13, 1678, 396, 1303, 278, 4128, 13, 1678, 411, 1722, 29898, 3188, 29918, 2084, 718, 5591, 29908, 718, 2224, 29892, 525, 29878, 1495, 408, 4390, 29918, 1445, 29901, 13, 4706, 8636, 353, 4390, 29889, 1359, 29898, 3126, 29918, 1445, 29897, 13, 13, 1678, 396, 11905, 278, 3564, 9657, 13, 1678, 3564, 353, 6571, 13, 13, 1678, 396, 2254, 26229, 740, 363, 7934, 15359, 13, 1678, 565, 525, 3259, 29915, 451, 297, 8636, 470, 8636, 1839, 3259, 2033, 529, 29871, 29906, 29901, 13, 4706, 3564, 1839, 627, 29918, 7692, 2033, 353, 7442, 29889, 13161, 29882, 13, 1678, 1683, 29901, 13, 4706, 3564, 1839, 627, 29918, 7692, 2033, 353, 9657, 29898, 13, 9651, 10345, 29882, 29922, 9302, 29889, 13161, 29882, 29892, 13, 9651, 1104, 29884, 29922, 2892, 921, 29901, 7442, 29889, 27525, 398, 29898, 29916, 29892, 29871, 29900, 511, 13, 9651, 560, 29884, 29922, 2892, 921, 29901, 7442, 29889, 3062, 29898, 29916, 1405, 29871, 29900, 29892, 921, 29892, 7442, 29889, 4548, 29898, 29916, 29897, 448, 29871, 29896, 29897, 13, 4706, 1723, 29961, 7529, 1839, 627, 29918, 7692, 2033, 29962, 13, 13, 1678, 628, 8636, 1839, 3259, 2033, 13, 1678, 628, 8636, 1839, 627, 29918, 7692, 2033, 13, 13, 1678, 396, 2254, 18177, 408, 12655, 7049, 13, 1678, 363, 3858, 29892, 18177, 297, 8636, 29889, 7076, 7295, 13, 4706, 3564, 29961, 1643, 29962, 353, 7442, 29889, 2378, 29898, 705, 5861, 29897, 13, 13, 1678, 736, 3564, 13, 13, 13, 1753, 8500, 29898, 24772, 29901, 1051, 29892, 10555, 29918, 9006, 29901, 851, 1125, 13, 1678, 3564, 353, 6213, 13, 13, 1678, 396, 29178, 278, 10555, 10823, 13, 1678, 10555, 29918, 14748, 353, 282, 17854, 29889, 1028, 18101, 29898, 29890, 5315, 29918, 9006, 29892, 2916, 29922, 8824, 29892, 8025, 2433, 9420, 29899, 29947, 1495, 13, 13, 1678, 396, 2302, 278, 18195, 12169, 13, 1678, 2507, 353, 29871, 29900, 13, 13, 1678, 396, 11905, 4940, 19995, 13, 1678, 4940, 29918, 1859, 1575, 353, 7442, 29889, 3298, 359, 3552, 29941, 29900, 29892, 29871, 29896, 29953, 876, 13, 13, 1678, 1550, 5852, 29901, 13, 4706, 3748, 29918, 2080, 353, 1303, 29918, 11802, 29918, 2080, 580, 13, 13, 4706, 396, 2436, 3748, 1881, 304, 278, 10823, 17126, 310, 278, 8576, 13, 4706, 10555, 29918, 14748, 29889, 3539, 14182, 29876, 1642, 7122, 29898, 11802, 29918, 2080, 29897, 718, 6634, 29876, 1159, 13, 13, 4706, 3158, 353, 5124, 13, 13, 4706, 396, 1284, 3158, 1196, 1546, 599, 310, 278, 10823, 1962, 13, 4706, 1550, 451, 338, 29918, 3084, 29918, 2467, 29898, 2467, 1125, 13, 9651, 3158, 353, 10555, 29918, 14748, 29889, 949, 1220, 580, 13, 13, 4706, 396, 565, 767, 29874, 338, 5225, 769, 372, 338, 18195, 8576, 13, 4706, 338, 29918, 29881, 4154, 29918, 21646, 353, 938, 29898, 11802, 29918, 2080, 29961, 29900, 1822, 5451, 580, 29961, 29896, 2314, 1275, 29871, 29900, 13, 13, 4706, 565, 3564, 338, 6213, 29901, 13, 9651, 8743, 29918, 4102, 353, 3748, 29918, 2080, 29961, 29900, 1822, 5451, 580, 29961, 29906, 29962, 1275, 3748, 29918, 2080, 29961, 29896, 1822, 5451, 580, 29961, 29906, 29962, 13, 13, 9651, 2224, 353, 10898, 29961, 29900, 29962, 565, 8743, 29918, 4102, 470, 7431, 29898, 24772, 29897, 1275, 29871, 29896, 1683, 10898, 29961, 29896, 29962, 13, 13, 9651, 3564, 353, 2254, 29918, 4299, 29898, 2084, 29897, 13, 13, 4706, 565, 338, 29918, 29881, 4154, 29918, 21646, 29901, 13, 9651, 2106, 353, 19750, 29918, 3859, 29898, 11802, 29918, 2080, 29897, 13, 9651, 3158, 353, 1044, 29898, 11618, 29892, 2106, 29892, 4940, 29918, 1859, 1575, 29897, 13, 13, 9651, 396, 2767, 4940, 19995, 411, 1857, 5839, 13, 9651, 4940, 29918, 1859, 1575, 29961, 685, 29962, 353, 2106, 29961, 2467, 334, 29871, 29896, 29953, 5919, 2467, 718, 29871, 29896, 29897, 334, 29871, 29896, 29953, 29962, 13, 13, 9651, 2507, 4619, 29871, 29896, 13, 13, 9651, 1596, 703, 2227, 7077, 613, 3158, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 1596, 3158, 515, 10555, 10823, 13, 9651, 1596, 29898, 2467, 29889, 17010, 3101, 13, 13, 13, 1753, 1065, 7295, 13, 1678, 396, 679, 6273, 13, 1678, 1852, 29918, 16680, 353, 679, 29918, 1191, 29918, 16680, 580, 13, 1678, 6389, 353, 1852, 29918, 16680, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 396, 671, 4390, 408, 18195, 10823, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 5085, 29889, 29881, 4154, 1125, 13, 4706, 10898, 353, 518, 5085, 29889, 29881, 4154, 29962, 13, 1678, 1683, 29901, 13, 4706, 10898, 353, 518, 5085, 29889, 29881, 4154, 29918, 29896, 29892, 6389, 29889, 29881, 4154, 29918, 29906, 29962, 13, 13, 1678, 8500, 29898, 24772, 29892, 6389, 29889, 29890, 5315, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1065, 580, 13, 2 ]
modules/python3/tests/unittests/scripts/glm.py
ImagiaViz/inviwo
349
18572
import inviwopy from inviwopy.glm import * v1 = vec3(1,2,3) v2 = size2_t(4,5) m1 = mat4(1) m2 = mat3(0,1,0,-1,0,0,0,0,2) v3 = m2 * v1 v4 = vec4(1,2,3,4) w = v4.w a = v4.a q = v4.q z = v4.z b = v4.b p = v4.p y = v4.y g = v4.g t = v4.t x = v4.x r = v4.r s = v4.s
[ 1, 1053, 297, 1403, 29893, 2270, 13, 3166, 297, 1403, 29893, 2270, 29889, 3820, 29885, 1053, 334, 13, 13, 29894, 29896, 353, 9649, 29941, 29898, 29896, 29892, 29906, 29892, 29941, 29897, 13, 29894, 29906, 353, 2159, 29906, 29918, 29873, 29898, 29946, 29892, 29945, 29897, 13, 13, 29885, 29896, 353, 1775, 29946, 29898, 29896, 29897, 13, 29885, 29906, 353, 1775, 29941, 29898, 29900, 29892, 29896, 29892, 29900, 6653, 29896, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29906, 29897, 13, 13, 29894, 29941, 353, 286, 29906, 334, 325, 29896, 13, 13, 29894, 29946, 353, 9649, 29946, 29898, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29897, 13, 29893, 353, 325, 29946, 29889, 29893, 13, 29874, 353, 325, 29946, 29889, 29874, 13, 29939, 353, 325, 29946, 29889, 29939, 13, 29920, 353, 325, 29946, 29889, 29920, 13, 29890, 353, 325, 29946, 29889, 29890, 13, 29886, 353, 325, 29946, 29889, 29886, 13, 29891, 353, 325, 29946, 29889, 29891, 13, 29887, 353, 325, 29946, 29889, 29887, 13, 29873, 353, 325, 29946, 29889, 29873, 13, 29916, 353, 325, 29946, 29889, 29916, 13, 29878, 353, 325, 29946, 29889, 29878, 13, 29879, 353, 325, 29946, 29889, 29879, 13, 2 ]
python/examples/find_similar.py
yupbank/euclidesdb
0
19463
<reponame>yupbank/euclidesdb<filename>python/examples/find_similar.py import sys import argparse import euclides from PIL import Image import numpy as np from torchvision.transforms import functional as F def run_main(): parser = argparse.ArgumentParser(description='Find similar images in EuclidesDB.') parser.add_argument('--topk', dest='topk', type=int, required=True, help='Find top k results.') parser.add_argument('--file', dest='filename', type=str, required=True, help='Image file name.') args = parser.parse_args() image = Image.open(args.filename) image.thumbnail((300, 300), Image.ANTIALIAS) image = F.center_crop(image, 224) with euclides.Channel("localhost", 50000) as channel: db = euclides.EuclidesDB(channel) ret_similar = db.find_similar(image, ["resnet18"], args.topk) print(ret_similar) if __name__ == "__main__": run_main()
[ 1, 529, 276, 1112, 420, 29958, 29891, 786, 9157, 29914, 12932, 695, 2247, 2585, 29966, 9507, 29958, 4691, 29914, 19057, 29914, 2886, 29918, 29764, 29889, 2272, 13, 5215, 10876, 13, 5215, 1852, 5510, 13, 13, 5215, 11878, 695, 2247, 13, 13, 3166, 349, 6227, 1053, 7084, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 4842, 305, 4924, 29889, 9067, 29879, 1053, 13303, 408, 383, 13, 13, 13, 1753, 1065, 29918, 3396, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 12542, 2788, 4558, 297, 16430, 695, 2247, 4051, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 3332, 29895, 742, 2731, 2433, 3332, 29895, 742, 1134, 29922, 524, 29892, 3734, 29922, 5574, 29892, 13, 462, 4706, 1371, 2433, 12542, 2246, 413, 2582, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1445, 742, 2731, 2433, 9507, 742, 1134, 29922, 710, 29892, 3734, 29922, 5574, 29892, 13, 462, 4706, 1371, 2433, 2940, 934, 1024, 29889, 1495, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 1967, 353, 7084, 29889, 3150, 29898, 5085, 29889, 9507, 29897, 13, 1678, 1967, 29889, 386, 21145, 3552, 29941, 29900, 29900, 29892, 29871, 29941, 29900, 29900, 511, 7084, 29889, 13566, 25758, 29902, 3289, 29897, 13, 1678, 1967, 353, 383, 29889, 5064, 29918, 29883, 1336, 29898, 3027, 29892, 29871, 29906, 29906, 29946, 29897, 13, 13, 1678, 411, 11878, 695, 2247, 29889, 13599, 703, 7640, 613, 29871, 29945, 29900, 29900, 29900, 29900, 29897, 408, 8242, 29901, 13, 4706, 4833, 353, 11878, 695, 2247, 29889, 29923, 29884, 695, 2247, 4051, 29898, 12719, 29897, 13, 4706, 3240, 29918, 29764, 353, 4833, 29889, 2886, 29918, 29764, 29898, 3027, 29892, 6796, 690, 1212, 29896, 29947, 12436, 6389, 29889, 3332, 29895, 29897, 13, 13, 1678, 1596, 29898, 2267, 29918, 29764, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1065, 29918, 3396, 580, 13, 2 ]
cms/tests/middleware.py
ScholzVolkmer/django-cms-old
1
195367
#-*- coding: utf-8 -*- from __future__ import with_statement from cms.middleware.multilingual import MultilingualURLMiddleware, HAS_LANG_PREFIX_RE from cms.test_utils.testcases import CMSTestCase from cms.test_utils.util.context_managers import SettingsOverride from cms.test_utils.util.mock import AttributeObject from django.http import HttpResponse, HttpResponseRedirect from django.conf import settings import django class MiddlewareTestCase(CMSTestCase): def test_multilingual_middleware_get_lang_from_request(self): middle = MultilingualURLMiddleware() KLINGON = 'x-klingon' ELVISH = 'x-elvish' with SettingsOverride(CMS_LANGUAGES=((KLINGON, 'Klingon'),)): request = AttributeObject( session={}, path_info='/en/whatever', path='/en/whatever' ) result = middle.get_language_from_request(request) self.assertEqual(result, 'en') request = AttributeObject( session={ 'django_language': KLINGON, }, path_info='whatever', path='whatever', COOKIES={}, META={}, ) result = middle.get_language_from_request(request) self.assertEqual(result, KLINGON) # the session's language. Nerd. request = AttributeObject( path_info='whatever', path='whatever', COOKIES={ 'django_language': KLINGON, }, META={}, ) result = middle.get_language_from_request(request) self.assertEqual(result, KLINGON) # the cookies language. # Now the following should revert to the default language (en) request.COOKIES['django_language'] = ELVISH result = middle.get_language_from_request(request) self.assertEqual(result, 'en') # The default def test_multilingual_middleware_ignores_static_url(self): middle = MultilingualURLMiddleware() KLINGON = 'x-klingon' with SettingsOverride(CMS_LANGUAGES=((KLINGON, 'Klingon'),)): request = AttributeObject( session={}, path_info='whatever', path='whatever', COOKIES={ 'django_language': KLINGON, }, META = {}, LANGUAGE_CODE = KLINGON ) html = """<ul> <li><a href="/some-page/">some page</a></li> <li><a href="%simages/some-media-file.jpg">some media file</a></li> <li><a href="%simages/some-static-file.jpg">some static file</a></li> <li><a href="%simages/some-admin-file.jpg">some admin media file</a></li> <li><a href="%simages/some-other-file.jpg">some static file</a></li> </ul>""" %( settings.MEDIA_URL, settings.STATIC_URL, settings.ADMIN_MEDIA_PREFIX, '/some-path/', ) response = middle.process_response(request,HttpResponse(html)) # These paths shall be prefixed self.assertTrue('href="/%s/some-page/' %KLINGON in response.content) self.assertTrue('href="/%s%simages/some-other-file.jpg' %(KLINGON, '/some-path/') in response.content) # These shall not self.assertTrue('href="%simages/some-media-file.jpg' %settings.MEDIA_URL in response.content) self.assertTrue('href="%simages/some-static-file.jpg' %settings.STATIC_URL in response.content) self.assertTrue('href="%simages/some-admin-file.jpg' %settings.ADMIN_MEDIA_PREFIX in response.content) def test_multilingual_middleware_handles_redirections(self): middle = MultilingualURLMiddleware() request = AttributeObject( session={}, path_info='whatever', path='whatever', COOKIES={ 'django_language': 'en', }, META = {}, LANGUAGE_CODE = 'en' ) # Don't re-prefix response = middle.process_response(request,HttpResponseRedirect('/en/some-path/')) self.assertTrue(response['Location'] == '/en/some-path/') response = middle.process_response(request,HttpResponseRedirect('%ssome-path/'%settings.MEDIA_URL)) self.assertTrue(response['Location'] == '%ssome-path/' %settings.MEDIA_URL) response = middle.process_response(request,HttpResponseRedirect('%ssome-path/'%settings.STATIC_URL)) self.assertTrue(response['Location'] == '%ssome-path/' %settings.STATIC_URL) # Prefix response = middle.process_response(request,HttpResponseRedirect('/xx/some-path/')) self.assertTrue(response['Location'] == '/en/xx/some-path/')
[ 1, 396, 29899, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 411, 29918, 20788, 13, 3166, 274, 1516, 29889, 17662, 2519, 29889, 4713, 6504, 950, 1053, 9683, 6504, 950, 4219, 25411, 2519, 29892, 379, 3289, 29918, 29931, 19453, 29918, 15094, 25634, 29918, 1525, 13, 3166, 274, 1516, 29889, 1688, 29918, 13239, 29889, 1688, 11436, 1053, 315, 29924, 1254, 342, 8259, 13, 3166, 274, 1516, 29889, 1688, 29918, 13239, 29889, 4422, 29889, 4703, 29918, 1171, 18150, 1053, 19215, 4640, 13, 3166, 274, 1516, 29889, 1688, 29918, 13239, 29889, 4422, 29889, 17640, 1053, 23833, 2061, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 29892, 9056, 5103, 24735, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 5215, 9557, 13, 13, 1990, 14253, 2519, 3057, 8259, 29898, 24494, 1254, 342, 8259, 1125, 13, 1678, 822, 1243, 29918, 4713, 6504, 950, 29918, 17662, 2519, 29918, 657, 29918, 3893, 29918, 3166, 29918, 3827, 29898, 1311, 1125, 13, 308, 13, 4706, 7256, 353, 9683, 6504, 950, 4219, 25411, 2519, 580, 13, 308, 13, 4706, 476, 29931, 4214, 1164, 353, 525, 29916, 29899, 29895, 1847, 265, 29915, 13, 4706, 14845, 28607, 29950, 353, 525, 29916, 29899, 295, 29894, 728, 29915, 13, 308, 13, 4706, 411, 19215, 4640, 29898, 29907, 4345, 29918, 29931, 19453, 29965, 10461, 29903, 29922, 3552, 29968, 29931, 4214, 1164, 29892, 525, 29968, 1847, 265, 5477, 22164, 13, 9651, 2009, 353, 23833, 2061, 29898, 13, 18884, 4867, 3790, 1118, 13, 18884, 2224, 29918, 3888, 2433, 29914, 264, 29914, 1332, 5564, 742, 13, 18884, 2224, 2433, 29914, 264, 29914, 1332, 5564, 29915, 13, 9651, 1723, 13, 9651, 1121, 353, 7256, 29889, 657, 29918, 11675, 29918, 3166, 29918, 3827, 29898, 3827, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 525, 264, 1495, 13, 632, 13, 632, 13, 9651, 2009, 353, 23833, 2061, 29898, 13, 18884, 4867, 3790, 13, 462, 1678, 525, 14095, 29918, 11675, 2396, 476, 29931, 4214, 1164, 29892, 13, 18884, 2981, 13, 18884, 2224, 29918, 3888, 2433, 1332, 5564, 742, 13, 18884, 2224, 2433, 1332, 5564, 742, 13, 18884, 4810, 8949, 29059, 3790, 1118, 13, 18884, 341, 2544, 29909, 3790, 1118, 13, 9651, 1723, 13, 9651, 1121, 353, 7256, 29889, 657, 29918, 11675, 29918, 3166, 29918, 3827, 29898, 3827, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 476, 29931, 4214, 1164, 29897, 396, 278, 4867, 29915, 29879, 4086, 29889, 405, 2018, 29889, 13, 632, 13, 632, 13, 9651, 2009, 353, 23833, 2061, 29898, 13, 18884, 2224, 29918, 3888, 2433, 1332, 5564, 742, 13, 18884, 2224, 2433, 1332, 5564, 742, 13, 18884, 4810, 8949, 29059, 3790, 13, 462, 1678, 525, 14095, 29918, 11675, 2396, 476, 29931, 4214, 1164, 29892, 13, 18884, 2981, 13, 18884, 341, 2544, 29909, 3790, 1118, 13, 9651, 1723, 13, 9651, 1121, 353, 7256, 29889, 657, 29918, 11675, 29918, 3166, 29918, 3827, 29898, 3827, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 476, 29931, 4214, 1164, 29897, 396, 278, 21046, 4086, 29889, 13, 632, 13, 9651, 396, 2567, 278, 1494, 881, 29538, 304, 278, 2322, 4086, 313, 264, 29897, 13, 9651, 2009, 29889, 3217, 8949, 29059, 1839, 14095, 29918, 11675, 2033, 353, 14845, 28607, 29950, 13, 9651, 1121, 353, 7256, 29889, 657, 29918, 11675, 29918, 3166, 29918, 3827, 29898, 3827, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 525, 264, 1495, 396, 450, 2322, 13, 13, 13, 1678, 822, 1243, 29918, 4713, 6504, 950, 29918, 17662, 2519, 29918, 647, 2361, 29918, 7959, 29918, 2271, 29898, 1311, 1125, 13, 13, 4706, 7256, 353, 9683, 6504, 950, 4219, 25411, 2519, 580, 13, 4706, 476, 29931, 4214, 1164, 353, 525, 29916, 29899, 29895, 1847, 265, 29915, 13, 308, 13, 4706, 411, 19215, 4640, 29898, 29907, 4345, 29918, 29931, 19453, 29965, 10461, 29903, 29922, 3552, 29968, 29931, 4214, 1164, 29892, 525, 29968, 1847, 265, 5477, 22164, 13, 9651, 2009, 353, 23833, 2061, 29898, 13, 18884, 4867, 3790, 1118, 13, 18884, 2224, 29918, 3888, 2433, 1332, 5564, 742, 13, 18884, 2224, 2433, 1332, 5564, 742, 13, 18884, 4810, 8949, 29059, 3790, 13, 462, 1678, 525, 14095, 29918, 11675, 2396, 476, 29931, 4214, 1164, 29892, 13, 18884, 2981, 13, 18884, 341, 2544, 29909, 353, 24335, 13, 18884, 365, 19453, 29965, 10461, 29918, 16524, 353, 476, 29931, 4214, 1164, 13, 9651, 1723, 13, 9651, 3472, 353, 9995, 29966, 352, 29958, 13, 18884, 529, 492, 5299, 29874, 2822, 13802, 5372, 29899, 3488, 29914, 1013, 5372, 1813, 829, 29874, 2565, 492, 29958, 13, 18884, 529, 492, 5299, 29874, 2822, 543, 29995, 3601, 1179, 29914, 5372, 29899, 9799, 29899, 1445, 29889, 6173, 1013, 5372, 5745, 934, 829, 29874, 2565, 492, 29958, 13, 18884, 529, 492, 5299, 29874, 2822, 543, 29995, 3601, 1179, 29914, 5372, 29899, 7959, 29899, 1445, 29889, 6173, 1013, 5372, 2294, 934, 829, 29874, 2565, 492, 29958, 13, 18884, 529, 492, 5299, 29874, 2822, 543, 29995, 3601, 1179, 29914, 5372, 29899, 6406, 29899, 1445, 29889, 6173, 1013, 5372, 4113, 5745, 934, 829, 29874, 2565, 492, 29958, 13, 18884, 529, 492, 5299, 29874, 2822, 543, 29995, 3601, 1179, 29914, 5372, 29899, 1228, 29899, 1445, 29889, 6173, 1013, 5372, 2294, 934, 829, 29874, 2565, 492, 29958, 13, 18884, 1533, 352, 11903, 15945, 1273, 29898, 13, 462, 1678, 6055, 29889, 2303, 4571, 29909, 29918, 4219, 29892, 13, 462, 1678, 6055, 29889, 17816, 2965, 29918, 4219, 29892, 13, 462, 1678, 6055, 29889, 3035, 16173, 29918, 2303, 4571, 29909, 29918, 15094, 25634, 29892, 13, 462, 1678, 8207, 5372, 29899, 2084, 29914, 742, 13, 18884, 1723, 13, 632, 13, 9651, 2933, 353, 7256, 29889, 5014, 29918, 5327, 29898, 3827, 29892, 5506, 5103, 29898, 1420, 876, 13, 632, 13, 9651, 396, 4525, 10898, 4091, 367, 10944, 287, 13, 9651, 1583, 29889, 9294, 5574, 877, 12653, 13802, 29995, 29879, 29914, 5372, 29899, 3488, 22208, 1273, 29968, 29931, 4214, 1164, 297, 2933, 29889, 3051, 29897, 13, 9651, 1583, 29889, 9294, 5574, 877, 12653, 13802, 29995, 29879, 29995, 3601, 1179, 29914, 5372, 29899, 1228, 29899, 1445, 29889, 6173, 29915, 1273, 29898, 29968, 29931, 4214, 1164, 29892, 8207, 5372, 29899, 2084, 29914, 1495, 297, 2933, 29889, 3051, 29897, 13, 13, 9651, 396, 4525, 4091, 451, 13, 9651, 1583, 29889, 9294, 5574, 877, 12653, 543, 29995, 3601, 1179, 29914, 5372, 29899, 9799, 29899, 1445, 29889, 6173, 29915, 1273, 11027, 29889, 2303, 4571, 29909, 29918, 4219, 297, 2933, 29889, 3051, 29897, 13, 9651, 1583, 29889, 9294, 5574, 877, 12653, 543, 29995, 3601, 1179, 29914, 5372, 29899, 7959, 29899, 1445, 29889, 6173, 29915, 1273, 11027, 29889, 17816, 2965, 29918, 4219, 297, 2933, 29889, 3051, 29897, 632, 13, 9651, 1583, 29889, 9294, 5574, 877, 12653, 543, 29995, 3601, 1179, 29914, 5372, 29899, 6406, 29899, 1445, 29889, 6173, 29915, 1273, 11027, 29889, 3035, 16173, 29918, 2303, 4571, 29909, 29918, 15094, 25634, 297, 2933, 29889, 3051, 29897, 13, 632, 13, 268, 13, 1678, 822, 1243, 29918, 4713, 6504, 950, 29918, 17662, 2519, 29918, 3179, 793, 29918, 1127, 533, 1953, 29898, 1311, 1125, 13, 13, 4706, 7256, 353, 9683, 6504, 950, 4219, 25411, 2519, 580, 13, 13, 4706, 2009, 353, 23833, 2061, 29898, 13, 9651, 4867, 3790, 1118, 13, 9651, 2224, 29918, 3888, 2433, 1332, 5564, 742, 13, 9651, 2224, 2433, 1332, 5564, 742, 13, 9651, 4810, 8949, 29059, 3790, 13, 18884, 525, 14095, 29918, 11675, 2396, 525, 264, 742, 13, 9651, 2981, 13, 9651, 341, 2544, 29909, 353, 24335, 13, 9651, 365, 19453, 29965, 10461, 29918, 16524, 353, 525, 264, 29915, 13, 4706, 1723, 13, 308, 13, 4706, 396, 3872, 29915, 29873, 337, 29899, 13506, 13, 4706, 2933, 353, 7256, 29889, 5014, 29918, 5327, 29898, 3827, 29892, 5506, 5103, 24735, 11219, 264, 29914, 5372, 29899, 2084, 29914, 8785, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5327, 1839, 6508, 2033, 1275, 8207, 264, 29914, 5372, 29899, 2084, 29914, 1495, 13, 13, 4706, 2933, 353, 7256, 29889, 5014, 29918, 5327, 29898, 3827, 29892, 5506, 5103, 24735, 877, 29995, 893, 608, 29899, 2084, 22208, 29995, 11027, 29889, 2303, 4571, 29909, 29918, 4219, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5327, 1839, 6508, 2033, 1275, 14210, 893, 608, 29899, 2084, 22208, 1273, 11027, 29889, 2303, 4571, 29909, 29918, 4219, 29897, 13, 13, 4706, 2933, 353, 7256, 29889, 5014, 29918, 5327, 29898, 3827, 29892, 5506, 5103, 24735, 877, 29995, 893, 608, 29899, 2084, 22208, 29995, 11027, 29889, 17816, 2965, 29918, 4219, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5327, 1839, 6508, 2033, 1275, 14210, 893, 608, 29899, 2084, 22208, 1273, 11027, 29889, 17816, 2965, 29918, 4219, 29897, 13, 308, 13, 13, 4706, 396, 349, 9569, 13, 4706, 2933, 353, 7256, 29889, 5014, 29918, 5327, 29898, 3827, 29892, 5506, 5103, 24735, 11219, 4419, 29914, 5372, 29899, 2084, 29914, 8785, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5327, 1839, 6508, 2033, 1275, 8207, 264, 29914, 4419, 29914, 5372, 29899, 2084, 29914, 1495, 13, 13, 2 ]
scripts/striptags.py
innesmck/GaelicFrequencyLists
0
1610517
import re, os directory = 'corpus/watch_raw' for entry in os.scandir(directory): if entry.is_file(): with open(entry.path, encoding="utf-8") as f: text = f.read() text = re.sub('\[.*\]', '', text) path = entry.path.replace( 'watch_raw', 'watch' ) with open(path, "w", encoding="utf-8") as f: f.write(text)
[ 1, 1053, 337, 29892, 2897, 30004, 13, 30004, 13, 12322, 353, 525, 2616, 13364, 29914, 12344, 29918, 1610, 29915, 30004, 13, 1454, 6251, 297, 2897, 29889, 1557, 392, 381, 29898, 12322, 1125, 30004, 13, 12, 361, 6251, 29889, 275, 29918, 1445, 7295, 30004, 13, 12, 12, 2541, 1722, 29898, 8269, 29889, 2084, 29892, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29901, 30004, 13, 12, 12, 12, 726, 353, 285, 29889, 949, 26471, 13, 12, 12, 12, 726, 353, 337, 29889, 1491, 28909, 29961, 5575, 18899, 742, 15516, 1426, 8443, 13, 12, 12, 2084, 353, 6251, 29889, 2084, 29889, 6506, 29898, 525, 12344, 29918, 1610, 742, 525, 12344, 29915, 1723, 30004, 13, 12, 12, 2541, 1722, 29898, 2084, 29892, 376, 29893, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29901, 30004, 13, 12, 12, 12, 29888, 29889, 3539, 29898, 726, 8443, 13, 30004, 13, 30004, 13, 2 ]
python/strip_comments.py
TechieHelper/Codewars
0
146648
<gh_stars>0 def solution(string, markers): output = [] for line in string.split("\n"): containsCommentIndicator = "" for c in line: if c in markers: containsCommentIndicator = c break if containsCommentIndicator != "": line = line[:line.find(containsCommentIndicator)] line = line.rstrip(" ") output.append(line) return '\n'.join(output) print(solution("apples, pears # and bananas\ngrapes\nbananas !apples", ["#", "!"]))
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 1753, 1650, 29898, 1807, 29892, 29320, 1125, 13, 12, 4905, 353, 5159, 13, 12, 1454, 1196, 297, 1347, 29889, 5451, 14182, 29876, 29908, 1125, 13, 12, 12, 11516, 20001, 28013, 353, 5124, 13, 12, 12, 1454, 274, 297, 1196, 29901, 13, 12, 12, 12, 361, 274, 297, 29320, 29901, 13, 12, 12, 12, 12, 11516, 20001, 28013, 353, 274, 13, 12, 12, 12, 12, 8690, 13, 13, 12, 12, 361, 3743, 20001, 28013, 2804, 376, 1115, 13, 12, 12, 12, 1220, 353, 1196, 7503, 1220, 29889, 2886, 29898, 11516, 20001, 28013, 4638, 13, 13, 12, 12, 1220, 353, 1196, 29889, 29878, 17010, 703, 16521, 13, 12, 12, 4905, 29889, 4397, 29898, 1220, 29897, 13, 13, 12, 2457, 11297, 29876, 4286, 7122, 29898, 4905, 29897, 13, 13, 13, 2158, 29898, 2929, 918, 703, 932, 793, 29892, 282, 15451, 396, 322, 9892, 16397, 29905, 865, 2390, 267, 29905, 29876, 2571, 16397, 1738, 932, 793, 613, 6796, 29937, 613, 376, 29991, 3108, 876, 13, 2 ]
brd_mod/main.py
benrdavison/brd_mod
0
120458
<reponame>benrdavison/brd_mod import pandas as pd import sys import os from brd_mod.brdstats import * from brd_mod.brdgeo import * from brd_mod.brdecon import * if __name__ == "__main__": print("test")
[ 1, 529, 276, 1112, 420, 29958, 1785, 5499, 485, 2285, 29914, 1182, 29881, 29918, 1545, 13, 5215, 11701, 408, 10518, 30004, 13, 30004, 13, 5215, 10876, 30004, 13, 5215, 2897, 30004, 13, 30004, 13, 3166, 1506, 29881, 29918, 1545, 29889, 1182, 29881, 16202, 1053, 334, 30004, 13, 3166, 1506, 29881, 29918, 1545, 29889, 1182, 29881, 24756, 1053, 334, 30004, 13, 3166, 1506, 29881, 29918, 1545, 29889, 1182, 311, 535, 1053, 334, 30004, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 30004, 13, 12, 2158, 703, 1688, 1159, 2 ]
filesfolders/views_api.py
bihealth/sodar-core
7
76295
<reponame>bihealth/sodar-core """REST API views for the samplesheets app""" from rest_framework.generics import ( ListCreateAPIView, RetrieveUpdateDestroyAPIView, GenericAPIView, ) # Projectroles dependency from projectroles.models import SODAR_CONSTANTS from projectroles.plugins import get_backend_api from projectroles.views_api import CoreAPIGenericProjectMixin from filesfolders.models import Folder from filesfolders.serializers import ( FolderSerializer, FileSerializer, HyperLinkSerializer, ) from filesfolders.views import ( FilesfoldersTimelineMixin, FileServeMixin, TL_OBJ_TYPES, APP_NAME, ) # SODAR constants PROJECT_TYPE_PROJECT = SODAR_CONSTANTS['PROJECT_TYPE_PROJECT'] # Base Classes and Mixins ------------------------------------------------------ class ListCreateAPITimelineMixin(FilesfoldersTimelineMixin): """ Mixin that ties ListCreateAPIView:s to the SODAR timeline for filesfolders. """ def perform_create(self, serializer): # Actually perform the creation super().perform_create(serializer) # Register creation with timeline self._add_item_modify_event( obj=serializer.instance, request=self.request, view_action='create' ) class RetrieveUpdateDestroyAPITimelineMixin(FilesfoldersTimelineMixin): """ Mixin that ties RetrieveUpdateDestroyAPIView:s to the SODAR timeline for filesfolders. """ def perform_update(self, serializer): # Collect update_attrs and old_data update_attrs = ['name', 'folder', 'description', 'flag'] old_item = serializer.instance old_data = {} if old_item.__class__.__name__ == 'HyperLink': update_attrs.append('url') elif old_item.__class__.__name__ == 'File': update_attrs.append('public_url') for a in update_attrs: old_data[a] = getattr(old_item, a) # Actually perform the update super().perform_update(serializer) # Register update with timeline self._add_item_modify_event( obj=serializer.instance, request=self.request, view_action='update', update_attrs=update_attrs, old_data=old_data, ) def perform_destroy(self, instance): instance.delete() timeline = get_backend_api('timeline_backend') # Add event in Timeline if timeline: obj_type = TL_OBJ_TYPES[instance.__class__.__name__] # Add event in Timeline tl_event = timeline.add_event( project=instance.project, app_name=APP_NAME, user=self.request.user, event_name='{}_delete'.format(obj_type), description='delete {} {{{}}}'.format(obj_type, obj_type), status_type='OK', ) tl_event.add_object( obj=instance, label=obj_type, name=instance.get_path() if isinstance(instance, Folder) else instance.name, ) class ListCreatePermissionMixin: """Mixing adding get_permission_required() for list-create API views.""" def get_permission_required(self): if self.request.method == 'POST': return 'filesfolders.add_data' else: return 'filesfolders.view_data' class RetrieveUpdateDestroyPermissionMixin: """ Mixing adding get_permission_required() for retrieve-update-destroy API views. """ def get_permission_required(self): if self.request.method == 'GET': return 'filesfolders.view_data' else: obj = self.get_object() if obj.owner == self.request.user: return 'filesfolders.update_data_own' else: return 'filesfolders.update_data_all' # API Views -------------------------------------------------------------------- class FolderListCreateAPIView( ListCreateAPITimelineMixin, ListCreatePermissionMixin, CoreAPIGenericProjectMixin, ListCreateAPIView, ): """ List folders or create a folder. **URL:** ``/files/api/folder/list-create/{Project.sodar_uuid}`` **Methods:** ``GET``, ``POST`` **Parameters for POST:** - ``name``: Folder name (string) - ``folder``: Parent folder UUID (string) - ``owner``: User UUID of folder owner (string) - ``flag``: Folder flag (string, optional) - ``description``: Folder description (string, optional) """ project_type = PROJECT_TYPE_PROJECT serializer_class = FolderSerializer class FolderRetrieveUpdateDestroyAPIView( RetrieveUpdateDestroyAPITimelineMixin, RetrieveUpdateDestroyPermissionMixin, CoreAPIGenericProjectMixin, RetrieveUpdateDestroyAPIView, ): """ Retrieve, update or destroy a folder. **URL:** ``/files/api/folder/retrieve-update-destroy/{Folder.sodar_uuid}`` **Methods:** ``GET``, ``PUT``, ``PATCH``, ``DELETE`` **Parameters for PUT and PATCH:** - ``name``: Folder name (string) - ``folder``: Parent folder UUID (string) - ``owner``: User UUID of folder owner (string) - ``flag``: Folder flag (string, optional) - ``description``: Folder description (string, optional) """ lookup_field = 'sodar_uuid' lookup_url_kwarg = 'folder' project_type = PROJECT_TYPE_PROJECT serializer_class = FolderSerializer class FileListCreateAPIView( ListCreateAPITimelineMixin, ListCreatePermissionMixin, CoreAPIGenericProjectMixin, ListCreateAPIView, ): """ List files or upload a file. For uploads, the request must be made in the ``multipart`` format. **URL:** ``/files/api/file/list-create/{Project.sodar_uuid}`` **Methods:** ``GET``, ``POST`` **Parameters for POST:** - ``name``: Folder name (string) - ``folder``: Parent folder UUID (string) - ``owner``: User UUID of folder owner (string) - ``flag``: Folder flag (string, optional) - ``description``: Folder description (string, optional) - ``public_url``: Allow creation of a publicly viewable URL (bool) - ``file``: File to be uploaded """ project_type = PROJECT_TYPE_PROJECT serializer_class = FileSerializer class FileRetrieveUpdateDestroyAPIView( RetrieveUpdateDestroyAPITimelineMixin, RetrieveUpdateDestroyPermissionMixin, CoreAPIGenericProjectMixin, RetrieveUpdateDestroyAPIView, ): """ Retrieve, update or destroy a file. **URL:** ``/files/api/file/retrieve-update-destroy/{File.sodar_uuid}`` **Methods:** ``GET``, ``PUT``, ``PATCH``, ``DELETE`` **Parameters for PUT and PATCH:** - ``name``: Folder name (string) - ``folder``: Parent folder UUID (string) - ``owner``: User UUID of folder owner (string) - ``flag``: Folder flag (string, optional) - ``description``: Folder description (string, optional) - ``public_url``: Allow creation of a publicly viewable URL (bool) - ``file``: File to be uploaded """ lookup_field = 'sodar_uuid' lookup_url_kwarg = 'file' project_type = PROJECT_TYPE_PROJECT serializer_class = FileSerializer class FileServeAPIView( CoreAPIGenericProjectMixin, FileServeMixin, GenericAPIView ): """ Serve the file content. **URL:** ``/files/api/file/serve/{File.sodar_uuid}`` **Methods:** ``GET`` """ lookup_field = 'sodar_uuid' lookup_url_kwarg = 'file' permission_required = 'filesfolders.view_data' class HyperLinkListCreateAPIView( ListCreateAPITimelineMixin, ListCreatePermissionMixin, CoreAPIGenericProjectMixin, ListCreateAPIView, ): """ List hyperlinks or create a hyperlink. **URL:** ``/files/api/hyperlink/list-create/{Project.sodar_uuid}`` **Methods:** ``GET``, ``POST`` **Parameters for POST:** - ``name``: Folder name (string) - ``folder``: Parent folder UUID (string) - ``owner``: User UUID of folder owner (string) - ``flag``: Folder flag (string, optional) - ``description``: Folder description (string, optional) - ``url``: URL for the link (string) """ project_type = PROJECT_TYPE_PROJECT serializer_class = HyperLinkSerializer class HyperLinkRetrieveUpdateDestroyAPIView( RetrieveUpdateDestroyAPITimelineMixin, RetrieveUpdateDestroyPermissionMixin, CoreAPIGenericProjectMixin, RetrieveUpdateDestroyAPIView, ): """ Retrieve, update or destroy a hyperlink. **URL:** ``/files/api/hyperlink/retrieve-update-destroy/{HyperLink.sodar_uuid}`` **Methods:** ``GET``, ``PUT``, ``PATCH``, ``DELETE`` **Parameters for PUT and PATCH:** - ``name``: Folder name (string) - ``folder``: Parent folder UUID (string) - ``owner``: User UUID of folder owner (string) - ``flag``: Folder flag (string, optional) - ``description``: Folder description (string, optional) - ``url``: URL for the link (string) """ lookup_field = 'sodar_uuid' lookup_url_kwarg = 'hyperlink' project_type = PROJECT_TYPE_PROJECT serializer_class = HyperLinkSerializer
[ 1, 529, 276, 1112, 420, 29958, 5365, 354, 4298, 29914, 29879, 397, 279, 29899, 3221, 13, 15945, 29908, 1525, 1254, 3450, 8386, 363, 278, 11916, 354, 1691, 623, 15945, 29908, 13, 13, 3166, 1791, 29918, 4468, 29889, 4738, 1199, 1053, 313, 13, 1678, 2391, 4391, 8787, 1043, 29892, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29892, 13, 1678, 3251, 293, 8787, 1043, 29892, 13, 29897, 13, 13, 29937, 8010, 307, 793, 10609, 13, 3166, 2060, 307, 793, 29889, 9794, 1053, 7791, 29928, 1718, 29918, 6007, 1254, 2190, 9375, 13, 3166, 2060, 307, 793, 29889, 12800, 1053, 679, 29918, 27852, 29918, 2754, 13, 3166, 2060, 307, 793, 29889, 7406, 29918, 2754, 1053, 10239, 8787, 15809, 7653, 29924, 861, 262, 13, 13, 3166, 2066, 8771, 414, 29889, 9794, 1053, 383, 3194, 13, 3166, 2066, 8771, 414, 29889, 15550, 19427, 1053, 313, 13, 1678, 383, 3194, 17679, 29892, 13, 1678, 3497, 17679, 29892, 13, 1678, 26078, 6595, 17679, 29892, 13, 29897, 13, 3166, 2066, 8771, 414, 29889, 7406, 1053, 313, 13, 1678, 12745, 8771, 414, 13711, 5570, 29924, 861, 262, 29892, 13, 1678, 3497, 1748, 345, 29924, 861, 262, 29892, 13, 1678, 323, 29931, 29918, 14824, 29967, 29918, 15631, 29925, 2890, 29892, 13, 1678, 12279, 29925, 29918, 5813, 29892, 13, 29897, 13, 13, 13, 29937, 7791, 29928, 1718, 17727, 13, 8618, 17637, 29918, 11116, 29918, 8618, 17637, 353, 7791, 29928, 1718, 29918, 6007, 1254, 2190, 9375, 1839, 8618, 17637, 29918, 11116, 29918, 8618, 17637, 2033, 13, 13, 13, 29937, 7399, 4134, 267, 322, 23478, 1144, 448, 2683, 2683, 2683, 23648, 13, 13, 13, 1990, 2391, 4391, 3301, 1806, 326, 5570, 29924, 861, 262, 29898, 10547, 8771, 414, 13711, 5570, 29924, 861, 262, 1125, 13, 1678, 9995, 13, 1678, 23478, 262, 393, 260, 583, 2391, 4391, 8787, 1043, 29901, 29879, 304, 278, 7791, 29928, 1718, 5335, 5570, 363, 2066, 8771, 414, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 2189, 29918, 3258, 29898, 1311, 29892, 7797, 3950, 1125, 13, 4706, 396, 12823, 2189, 278, 11265, 13, 4706, 2428, 2141, 19826, 29918, 3258, 29898, 15550, 3950, 29897, 13, 4706, 396, 12577, 11265, 411, 5335, 5570, 13, 4706, 1583, 3032, 1202, 29918, 667, 29918, 1545, 1598, 29918, 3696, 29898, 13, 9651, 5446, 29922, 15550, 3950, 29889, 8758, 29892, 2009, 29922, 1311, 29889, 3827, 29892, 1776, 29918, 2467, 2433, 3258, 29915, 13, 4706, 1723, 13, 13, 13, 1990, 4649, 29878, 2418, 6422, 14994, 4727, 3301, 1806, 326, 5570, 29924, 861, 262, 29898, 10547, 8771, 414, 13711, 5570, 29924, 861, 262, 1125, 13, 1678, 9995, 13, 1678, 23478, 262, 393, 260, 583, 4649, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29901, 29879, 304, 278, 7791, 29928, 1718, 5335, 5570, 363, 13, 1678, 2066, 8771, 414, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 2189, 29918, 5504, 29898, 1311, 29892, 7797, 3950, 1125, 13, 4706, 396, 24930, 2767, 29918, 5552, 29879, 322, 2030, 29918, 1272, 13, 4706, 2767, 29918, 5552, 29879, 353, 6024, 978, 742, 525, 12083, 742, 525, 8216, 742, 525, 15581, 2033, 13, 4706, 2030, 29918, 667, 353, 7797, 3950, 29889, 8758, 13, 4706, 2030, 29918, 1272, 353, 6571, 13, 13, 4706, 565, 2030, 29918, 667, 17255, 1990, 1649, 17255, 978, 1649, 1275, 525, 26322, 546, 6595, 2396, 13, 9651, 2767, 29918, 5552, 29879, 29889, 4397, 877, 2271, 1495, 13, 4706, 25342, 2030, 29918, 667, 17255, 1990, 1649, 17255, 978, 1649, 1275, 525, 2283, 2396, 13, 9651, 2767, 29918, 5552, 29879, 29889, 4397, 877, 3597, 29918, 2271, 1495, 13, 13, 4706, 363, 263, 297, 2767, 29918, 5552, 29879, 29901, 13, 9651, 2030, 29918, 1272, 29961, 29874, 29962, 353, 679, 5552, 29898, 1025, 29918, 667, 29892, 263, 29897, 13, 13, 4706, 396, 12823, 2189, 278, 2767, 13, 4706, 2428, 2141, 19826, 29918, 5504, 29898, 15550, 3950, 29897, 13, 13, 4706, 396, 12577, 2767, 411, 5335, 5570, 13, 4706, 1583, 3032, 1202, 29918, 667, 29918, 1545, 1598, 29918, 3696, 29898, 13, 9651, 5446, 29922, 15550, 3950, 29889, 8758, 29892, 13, 9651, 2009, 29922, 1311, 29889, 3827, 29892, 13, 9651, 1776, 29918, 2467, 2433, 5504, 742, 13, 9651, 2767, 29918, 5552, 29879, 29922, 5504, 29918, 5552, 29879, 29892, 13, 9651, 2030, 29918, 1272, 29922, 1025, 29918, 1272, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 2189, 29918, 20524, 29898, 1311, 29892, 2777, 1125, 13, 4706, 2777, 29889, 8143, 580, 13, 13, 4706, 5335, 5570, 353, 679, 29918, 27852, 29918, 2754, 877, 9346, 5570, 29918, 27852, 1495, 13, 13, 4706, 396, 3462, 1741, 297, 7870, 5570, 13, 4706, 565, 5335, 5570, 29901, 13, 9651, 5446, 29918, 1853, 353, 323, 29931, 29918, 14824, 29967, 29918, 15631, 29925, 2890, 29961, 8758, 17255, 1990, 1649, 17255, 978, 1649, 29962, 13, 13, 9651, 396, 3462, 1741, 297, 7870, 5570, 13, 9651, 260, 29880, 29918, 3696, 353, 5335, 5570, 29889, 1202, 29918, 3696, 29898, 13, 18884, 2060, 29922, 8758, 29889, 4836, 29892, 13, 18884, 623, 29918, 978, 29922, 20576, 29918, 5813, 29892, 13, 18884, 1404, 29922, 1311, 29889, 3827, 29889, 1792, 29892, 13, 18884, 1741, 29918, 978, 2433, 29912, 2403, 8143, 4286, 4830, 29898, 5415, 29918, 1853, 511, 13, 18884, 6139, 2433, 8143, 6571, 426, 6224, 12499, 4286, 4830, 29898, 5415, 29918, 1853, 29892, 5446, 29918, 1853, 511, 13, 18884, 4660, 29918, 1853, 2433, 8949, 742, 13, 9651, 1723, 13, 13, 9651, 260, 29880, 29918, 3696, 29889, 1202, 29918, 3318, 29898, 13, 18884, 5446, 29922, 8758, 29892, 13, 18884, 3858, 29922, 5415, 29918, 1853, 29892, 13, 18884, 1024, 29922, 8758, 29889, 657, 29918, 2084, 580, 13, 18884, 565, 338, 8758, 29898, 8758, 29892, 383, 3194, 29897, 13, 18884, 1683, 2777, 29889, 978, 29892, 13, 9651, 1723, 13, 13, 13, 1990, 2391, 4391, 27293, 29924, 861, 262, 29901, 13, 1678, 9995, 29924, 861, 292, 4417, 679, 29918, 16074, 29918, 12403, 580, 363, 1051, 29899, 3258, 3450, 8386, 1213, 15945, 13, 13, 1678, 822, 679, 29918, 16074, 29918, 12403, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 3827, 29889, 5696, 1275, 525, 5438, 2396, 13, 9651, 736, 525, 5325, 8771, 414, 29889, 1202, 29918, 1272, 29915, 13, 13, 4706, 1683, 29901, 13, 9651, 736, 525, 5325, 8771, 414, 29889, 1493, 29918, 1272, 29915, 13, 13, 13, 1990, 4649, 29878, 2418, 6422, 14994, 4727, 27293, 29924, 861, 262, 29901, 13, 1678, 9995, 13, 1678, 23478, 292, 4417, 679, 29918, 16074, 29918, 12403, 580, 363, 10563, 29899, 5504, 29899, 20524, 3450, 13, 1678, 8386, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 679, 29918, 16074, 29918, 12403, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 3827, 29889, 5696, 1275, 525, 7194, 2396, 13, 9651, 736, 525, 5325, 8771, 414, 29889, 1493, 29918, 1272, 29915, 13, 13, 4706, 1683, 29901, 13, 9651, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 13, 9651, 565, 5446, 29889, 20348, 1275, 1583, 29889, 3827, 29889, 1792, 29901, 13, 18884, 736, 525, 5325, 8771, 414, 29889, 5504, 29918, 1272, 29918, 776, 29915, 13, 13, 9651, 1683, 29901, 13, 18884, 736, 525, 5325, 8771, 414, 29889, 5504, 29918, 1272, 29918, 497, 29915, 13, 13, 13, 29937, 3450, 4533, 29879, 448, 2683, 2683, 2683, 2683, 5634, 13, 13, 13, 1990, 383, 3194, 1293, 4391, 8787, 1043, 29898, 13, 1678, 2391, 4391, 3301, 1806, 326, 5570, 29924, 861, 262, 29892, 13, 1678, 2391, 4391, 27293, 29924, 861, 262, 29892, 13, 1678, 10239, 8787, 15809, 7653, 29924, 861, 262, 29892, 13, 1678, 2391, 4391, 8787, 1043, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 2391, 16495, 470, 1653, 263, 4138, 29889, 13, 13, 1678, 3579, 4219, 29901, 1068, 4954, 29914, 5325, 29914, 2754, 29914, 12083, 29914, 1761, 29899, 3258, 19248, 7653, 29889, 29879, 397, 279, 29918, 25118, 10114, 29952, 13, 13, 1678, 3579, 26112, 29901, 1068, 4954, 7194, 29952, 1673, 4954, 5438, 16159, 13, 13, 1678, 3579, 11507, 363, 11971, 29901, 1068, 13, 13, 1678, 448, 4954, 978, 29952, 6998, 383, 3194, 1024, 313, 1807, 29897, 13, 1678, 448, 4954, 12083, 29952, 6998, 22280, 4138, 501, 11150, 313, 1807, 29897, 13, 1678, 448, 4954, 20348, 29952, 6998, 4911, 501, 11150, 310, 4138, 12271, 313, 1807, 29897, 13, 1678, 448, 4954, 15581, 29952, 6998, 383, 3194, 7353, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 8216, 29952, 6998, 383, 3194, 6139, 313, 1807, 29892, 13136, 29897, 13, 1678, 9995, 13, 13, 1678, 2060, 29918, 1853, 353, 13756, 17637, 29918, 11116, 29918, 8618, 17637, 13, 1678, 7797, 3950, 29918, 1990, 353, 383, 3194, 17679, 13, 13, 13, 1990, 383, 3194, 8015, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29898, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 3301, 1806, 326, 5570, 29924, 861, 262, 29892, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 27293, 29924, 861, 262, 29892, 13, 1678, 10239, 8787, 15809, 7653, 29924, 861, 262, 29892, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 29892, 2767, 470, 8174, 263, 4138, 29889, 13, 13, 1678, 3579, 4219, 29901, 1068, 4954, 29914, 5325, 29914, 2754, 29914, 12083, 29914, 276, 509, 2418, 29899, 5504, 29899, 20524, 19248, 12924, 29889, 29879, 397, 279, 29918, 25118, 10114, 29952, 13, 13, 1678, 3579, 26112, 29901, 1068, 4954, 7194, 29952, 1673, 4954, 12336, 29952, 1673, 4954, 29925, 14789, 29952, 1673, 4954, 2287, 18476, 16159, 13, 13, 1678, 3579, 11507, 363, 349, 2692, 322, 349, 14789, 29901, 1068, 13, 13, 1678, 448, 4954, 978, 29952, 6998, 383, 3194, 1024, 313, 1807, 29897, 13, 1678, 448, 4954, 12083, 29952, 6998, 22280, 4138, 501, 11150, 313, 1807, 29897, 13, 1678, 448, 4954, 20348, 29952, 6998, 4911, 501, 11150, 310, 4138, 12271, 313, 1807, 29897, 13, 1678, 448, 4954, 15581, 29952, 6998, 383, 3194, 7353, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 8216, 29952, 6998, 383, 3194, 6139, 313, 1807, 29892, 13136, 29897, 13, 1678, 9995, 13, 13, 1678, 16280, 29918, 2671, 353, 525, 29879, 397, 279, 29918, 25118, 29915, 13, 1678, 16280, 29918, 2271, 29918, 11022, 1191, 353, 525, 12083, 29915, 13, 1678, 2060, 29918, 1853, 353, 13756, 17637, 29918, 11116, 29918, 8618, 17637, 13, 1678, 7797, 3950, 29918, 1990, 353, 383, 3194, 17679, 13, 13, 13, 1990, 3497, 1293, 4391, 8787, 1043, 29898, 13, 1678, 2391, 4391, 3301, 1806, 326, 5570, 29924, 861, 262, 29892, 13, 1678, 2391, 4391, 27293, 29924, 861, 262, 29892, 13, 1678, 10239, 8787, 15809, 7653, 29924, 861, 262, 29892, 13, 1678, 2391, 4391, 8787, 1043, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 2391, 2066, 470, 6441, 263, 934, 29889, 1152, 6441, 29879, 29892, 278, 2009, 1818, 367, 1754, 297, 278, 13, 1678, 4954, 18056, 442, 16159, 3402, 29889, 13, 13, 1678, 3579, 4219, 29901, 1068, 4954, 29914, 5325, 29914, 2754, 29914, 1445, 29914, 1761, 29899, 3258, 19248, 7653, 29889, 29879, 397, 279, 29918, 25118, 10114, 29952, 13, 13, 1678, 3579, 26112, 29901, 1068, 4954, 7194, 29952, 1673, 4954, 5438, 16159, 13, 13, 1678, 3579, 11507, 363, 11971, 29901, 1068, 13, 13, 1678, 448, 4954, 978, 29952, 6998, 383, 3194, 1024, 313, 1807, 29897, 13, 1678, 448, 4954, 12083, 29952, 6998, 22280, 4138, 501, 11150, 313, 1807, 29897, 13, 1678, 448, 4954, 20348, 29952, 6998, 4911, 501, 11150, 310, 4138, 12271, 313, 1807, 29897, 13, 1678, 448, 4954, 15581, 29952, 6998, 383, 3194, 7353, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 8216, 29952, 6998, 383, 3194, 6139, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 3597, 29918, 2271, 29952, 6998, 29408, 11265, 310, 263, 970, 368, 1776, 519, 3988, 313, 11227, 29897, 13, 1678, 448, 4954, 1445, 29952, 6998, 3497, 304, 367, 20373, 13, 1678, 9995, 13, 13, 1678, 2060, 29918, 1853, 353, 13756, 17637, 29918, 11116, 29918, 8618, 17637, 13, 1678, 7797, 3950, 29918, 1990, 353, 3497, 17679, 13, 13, 13, 1990, 3497, 8015, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29898, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 3301, 1806, 326, 5570, 29924, 861, 262, 29892, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 27293, 29924, 861, 262, 29892, 13, 1678, 10239, 8787, 15809, 7653, 29924, 861, 262, 29892, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 29892, 2767, 470, 8174, 263, 934, 29889, 13, 13, 1678, 3579, 4219, 29901, 1068, 4954, 29914, 5325, 29914, 2754, 29914, 1445, 29914, 276, 509, 2418, 29899, 5504, 29899, 20524, 19248, 2283, 29889, 29879, 397, 279, 29918, 25118, 10114, 29952, 13, 13, 1678, 3579, 26112, 29901, 1068, 4954, 7194, 29952, 1673, 4954, 12336, 29952, 1673, 4954, 29925, 14789, 29952, 1673, 4954, 2287, 18476, 16159, 13, 13, 1678, 3579, 11507, 363, 349, 2692, 322, 349, 14789, 29901, 1068, 13, 13, 1678, 448, 4954, 978, 29952, 6998, 383, 3194, 1024, 313, 1807, 29897, 13, 1678, 448, 4954, 12083, 29952, 6998, 22280, 4138, 501, 11150, 313, 1807, 29897, 13, 1678, 448, 4954, 20348, 29952, 6998, 4911, 501, 11150, 310, 4138, 12271, 313, 1807, 29897, 13, 1678, 448, 4954, 15581, 29952, 6998, 383, 3194, 7353, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 8216, 29952, 6998, 383, 3194, 6139, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 3597, 29918, 2271, 29952, 6998, 29408, 11265, 310, 263, 970, 368, 1776, 519, 3988, 313, 11227, 29897, 13, 1678, 448, 4954, 1445, 29952, 6998, 3497, 304, 367, 20373, 13, 1678, 9995, 13, 13, 1678, 16280, 29918, 2671, 353, 525, 29879, 397, 279, 29918, 25118, 29915, 13, 1678, 16280, 29918, 2271, 29918, 11022, 1191, 353, 525, 1445, 29915, 13, 1678, 2060, 29918, 1853, 353, 13756, 17637, 29918, 11116, 29918, 8618, 17637, 13, 1678, 7797, 3950, 29918, 1990, 353, 3497, 17679, 13, 13, 13, 1990, 3497, 1748, 345, 8787, 1043, 29898, 13, 1678, 10239, 8787, 15809, 7653, 29924, 861, 262, 29892, 3497, 1748, 345, 29924, 861, 262, 29892, 3251, 293, 8787, 1043, 13, 1125, 13, 1678, 9995, 13, 1678, 1816, 345, 278, 934, 2793, 29889, 13, 13, 1678, 3579, 4219, 29901, 1068, 4954, 29914, 5325, 29914, 2754, 29914, 1445, 29914, 16349, 19248, 2283, 29889, 29879, 397, 279, 29918, 25118, 10114, 29952, 13, 13, 1678, 3579, 26112, 29901, 1068, 4954, 7194, 16159, 13, 1678, 9995, 13, 13, 1678, 16280, 29918, 2671, 353, 525, 29879, 397, 279, 29918, 25118, 29915, 13, 1678, 16280, 29918, 2271, 29918, 11022, 1191, 353, 525, 1445, 29915, 13, 1678, 10751, 29918, 12403, 353, 525, 5325, 8771, 414, 29889, 1493, 29918, 1272, 29915, 13, 13, 13, 1990, 26078, 6595, 1293, 4391, 8787, 1043, 29898, 13, 1678, 2391, 4391, 3301, 1806, 326, 5570, 29924, 861, 262, 29892, 13, 1678, 2391, 4391, 27293, 29924, 861, 262, 29892, 13, 1678, 10239, 8787, 15809, 7653, 29924, 861, 262, 29892, 13, 1678, 2391, 4391, 8787, 1043, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 2391, 11266, 4965, 470, 1653, 263, 11266, 2324, 29889, 13, 13, 1678, 3579, 4219, 29901, 1068, 4954, 29914, 5325, 29914, 2754, 29914, 24947, 2324, 29914, 1761, 29899, 3258, 19248, 7653, 29889, 29879, 397, 279, 29918, 25118, 10114, 29952, 13, 13, 1678, 3579, 26112, 29901, 1068, 4954, 7194, 29952, 1673, 4954, 5438, 16159, 13, 13, 1678, 3579, 11507, 363, 11971, 29901, 1068, 13, 13, 1678, 448, 4954, 978, 29952, 6998, 383, 3194, 1024, 313, 1807, 29897, 13, 1678, 448, 4954, 12083, 29952, 6998, 22280, 4138, 501, 11150, 313, 1807, 29897, 13, 1678, 448, 4954, 20348, 29952, 6998, 4911, 501, 11150, 310, 4138, 12271, 313, 1807, 29897, 13, 1678, 448, 4954, 15581, 29952, 6998, 383, 3194, 7353, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 8216, 29952, 6998, 383, 3194, 6139, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 2271, 29952, 6998, 3988, 363, 278, 1544, 313, 1807, 29897, 13, 1678, 9995, 13, 13, 1678, 2060, 29918, 1853, 353, 13756, 17637, 29918, 11116, 29918, 8618, 17637, 13, 1678, 7797, 3950, 29918, 1990, 353, 26078, 6595, 17679, 13, 13, 13, 1990, 26078, 6595, 8015, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29898, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 3301, 1806, 326, 5570, 29924, 861, 262, 29892, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 27293, 29924, 861, 262, 29892, 13, 1678, 10239, 8787, 15809, 7653, 29924, 861, 262, 29892, 13, 1678, 4649, 29878, 2418, 6422, 14994, 4727, 8787, 1043, 29892, 13, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 29892, 2767, 470, 8174, 263, 11266, 2324, 29889, 13, 13, 1678, 3579, 4219, 29901, 1068, 4954, 29914, 5325, 29914, 2754, 29914, 24947, 2324, 29914, 276, 509, 2418, 29899, 5504, 29899, 20524, 19248, 26322, 546, 6595, 29889, 29879, 397, 279, 29918, 25118, 10114, 29952, 13, 13, 1678, 3579, 26112, 29901, 1068, 4954, 7194, 29952, 1673, 4954, 12336, 29952, 1673, 4954, 29925, 14789, 29952, 1673, 4954, 2287, 18476, 16159, 13, 13, 1678, 3579, 11507, 363, 349, 2692, 322, 349, 14789, 29901, 1068, 13, 13, 1678, 448, 4954, 978, 29952, 6998, 383, 3194, 1024, 313, 1807, 29897, 13, 1678, 448, 4954, 12083, 29952, 6998, 22280, 4138, 501, 11150, 313, 1807, 29897, 13, 1678, 448, 4954, 20348, 29952, 6998, 4911, 501, 11150, 310, 4138, 12271, 313, 1807, 29897, 13, 1678, 448, 4954, 15581, 29952, 6998, 383, 3194, 7353, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 8216, 29952, 6998, 383, 3194, 6139, 313, 1807, 29892, 13136, 29897, 13, 1678, 448, 4954, 2271, 29952, 6998, 3988, 363, 278, 1544, 313, 1807, 29897, 13, 1678, 9995, 13, 13, 1678, 16280, 29918, 2671, 353, 525, 29879, 397, 279, 29918, 25118, 29915, 13, 1678, 16280, 29918, 2271, 29918, 11022, 1191, 353, 525, 24947, 2324, 29915, 13, 1678, 2060, 29918, 1853, 353, 13756, 17637, 29918, 11116, 29918, 8618, 17637, 13, 1678, 7797, 3950, 29918, 1990, 353, 26078, 6595, 17679, 13, 2 ]
modules/friday/engine.py
roshanmaind/Nico
2
193287
<filename>modules/friday/engine.py import h5py import pickle import random def split_list(artists, seperator): for i in range(len(artists)): artists += artists[i].split(seperator) for artist in artists: if artist.split(seperator) != [artist]: artists.remove(artist) return artists def individualize(artists): for seperator in (",", "+", "&", "Featuring"): artists = split_list(artists, seperator) for i in range(len(artists)): artists[i] = artists[i].strip() artists = list(set(artists)) return artists def caps_alpha_numeric(string): string = string.upper() string = list(string) for i in range(len(string)): if (not string[i].isalnum()) or string[i] == " ": string[i] = " " string = "".join(string) return string def tweets_have(user, string): if "sentences_tone" in user["tone"].keys(): tweets_tone = user["tone"]["sentences_tone"] tweets = [sentences["text"] for sentences in tweets_tone] for i in range(len(tweets)): if string in tweets[i] or caps_alpha_numeric(string) in tweets[i]: return True, tweets_tone[i]["tones"] return False, None def recommend(user): songs, liked, disliked = None, None, None with open("data/friday/songs.bin", "rb") as file: songs = pickle.load(file) all_songs = [] all_artists = [] liked_artists = {} disliked_artists = {} liked_genre = {} disliked_genre = {} pool = [] for genre in songs.keys(): for song in songs[genre]: # giving "greatest of all time" songs a preference if genre == "goat": if list(song + [0]) not in all_songs: all_songs.append(song + [1]) else: if list(song + [0]) not in all_songs: all_songs.append(song + [0]) artists = individualize([song[0].split("~")[1].strip()]) for artist in artists: if artist not in all_artists: all_artists.append(artist) for song in user["liked"]: artists = individualize([song[0].split("~")[1].strip()]) for artist in artists: if artist in liked_artists.keys(): liked_artists[artist] += 1 else: liked_artists[artist] = 1 if song[2] in liked_genre.keys(): liked_genre[song[2]] += 1 else: liked_genre[song[2]] = 1 for song in user["disliked"]: artists = individualize([song[0].split("~")[1].strip()]) for artist in artists: if artist in disliked_artists.keys(): disliked_artists[artist] += 1 else: disliked_artists[artist] = 1 if song[2] in disliked_genre.keys(): disliked_genre[song[2]] += 1 else: disliked_genre[song[2]] = 1 """ Criteria of picking songs Likelyhood of a song being picked is based upon 4 aspects 1. User's mentions of songs/artists/genres in tweets along with the sentiment of the tweet 2. Overall sentiment of user's tweets 3. User's liked and disliked songs 4. Randomness """ for song in all_songs: if "tone" in user.keys(): # mentions in tweets negatives = ["anger", "sadness"] positives = ["joy"] artists = individualize([song[0].split("~")[1].strip()]) ## check the mention of this song's genre they_do, tones = tweets_have(user, song[2]) if they_do: tone_ids = [t["tone_id"] for t in tones] if any([pos in tone_ids for pos in positives]): print(song[0], " +{} score because of positive genre mention in tweets".format((liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1.5)) song[3] += (liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1.5 elif any([neg in tone_ids for neg in negatives]): print(song[0], " -{} score because of negative genre mention in tweets".format(0.25)) song[3] -= 0.25 else: print(song[0], " +{} score because of genre mention in tweets".format((liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1)) song[3] += (liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1 ## check the mention of this song's artist's name artists = individualize([song[0].split("~")[1].strip()]) for artist in artists: they_do, tones = tweets_have(user, artist) if they_do: tone_ids = [t["tone_id"] for t in tones] if any([pos in tone_ids for pos in positives]): print(song[0], " +{} score because of positive artist mention in tweets".format((liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 4)) song[3] += (liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 4 elif any([neg in tone_ids for neg in negatives]): print(song[0], " -{} score because of negative artist mention in tweets".format(1)) song[3] -= 1 else: print(song[0], " +{} score because of artist mention in tweets".format((liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 3)) song[3] += (liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 3 ## check the mention of this song's name they_do, tones = tweets_have(user, song[0].split("~")[0].strip()) if they_do: tone_ids = [t["tone_id"] for t in tones] for s in all_songs: ### judge other songs based on artists artists = individualize([song[0].split("~")[1].strip()]) for artist in artists: if artist in s[0]: if any([pos in tone_ids for pos in positives]): print(song[0], " +{} score because of positive song mention of same artist in tweets".format((liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 4)) s[3] += (liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 4 elif any([neg in tone_ids for neg in negatives]): print(song[0], " -{} score because of negative song mention of same artist in tweets".format(1)) s[3] -= 1 else: print(song[0], " +{} score because of song mention of same artist in tweets".format((liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 2)) s[3] += (liked_artists[max(liked_artists)] if len(liked_artists) else 0) * 3 + 3 if s[2] == song[2]: if any([pos in tone_ids for pos in positives]): print(song[0], " +{} score because of positive song of same genre mention in tweets".format((liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1.5)) s[3] += (liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1.5 elif any([neg in tone_ids for neg in negatives]): print(song[0], " -{} score because of negative song of same genre mention in tweets".format(0.25)) s[3] -= 0.25 else: print(song[0], " +{} score because of song of same genre mention in tweets".format((liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1)) s[3] += (liked_genre[max(liked_genre)] if len(liked_genre) else 0) + 1 # overall sentiment of the tweets link = { "anger": ("hip-hop", "rock", "edm"), "fear": (), ## neutral sentiment in this context "joy": ("hip-hop", "rock", "edm", "pop", "country"), "sadness": ("classical", "rock", "pop", "jazz", "country"), "analytical": ("classical", "jazz", "country"), "confident": (), ## neutral sentiment in this context "tentative": () ## neutral sentiment in this context } overall_sentiment = user["tone_24_hours"]["document_tone"]["tones"] for sentiment in overall_sentiment: if song[2] in link[sentiment["tone_id"]]: print(song[0], "{} for {} overall tone".format(round(sentiment["score"] * 2), sentiment["tone_id"])) song[3] += round(sentiment["score"] * 2) # likes and dislikes ## likes artists = individualize([song[0].split("~")[1].strip()]) for artist in artists: if artist in liked_artists.keys(): print(song[0], " +{} for liking artist {}".format(3 * liked_artists[artist], artist)) song[3] += 4 * liked_artists[artist] if song[2] in liked_genre.keys(): print(song[0], " +{} for liking genre {}".format(0.75 * liked_genre[song[2]], song[2])) song[3] += 0.75 * liked_genre[song[2]] ## dislikes artists = individualize([song[0].split("~")[1].strip()]) for artist in artists: if artist in disliked_artists.keys(): print(song[0], " -{} for disliking artist {}".format(1 * disliked_artists[artist], artist)) song[3] -= 1 * disliked_artists[artist] if song[2] in disliked_genre.keys(): print(song[0], " -{} for disliking genre {}".format(0.2 * disliked_genre[song[2]], song[2])) song[3] -= 0.2 * disliked_genre[song[2]] # normalizing scores to convert scores into probabilities lowest = min([s[3] for s in all_songs]) if lowest <= 0: for song in all_songs: song[3] -= lowest - 1 highest = max([s[3] for s in all_songs]) print("Final probabilities:-") for song in all_songs: print("score:", song[3]) song[3] = song[3] / highest print(song[0], "| final probability:", song[3], "highest:", highest) if "songs" in user.keys(): del user["songs"] user["songs"] = [] # picking 10 songs print("10 picked songs:-") for i in range(10): while True: draw = random.uniform(0, 1) pool = [] for song in all_songs: if song not in user["songs"] and draw <= song[3]: pool.append(song) if len(pool) > 0: break idx = random.randint(0, len(pool) - 1) user["songs"].append(pool[idx]) print("Picked", pool[idx][0], "for probability", pool[idx][3]) return user
[ 1, 529, 9507, 29958, 7576, 29914, 1341, 22394, 29914, 10599, 29889, 2272, 13, 5215, 298, 29945, 2272, 13, 5215, 5839, 280, 13, 5215, 4036, 13, 13, 1753, 6219, 29918, 1761, 29898, 442, 2879, 29892, 409, 546, 1061, 1125, 13, 12, 1454, 474, 297, 3464, 29898, 2435, 29898, 442, 2879, 22164, 13, 12, 12, 442, 2879, 4619, 17906, 29961, 29875, 1822, 5451, 29898, 344, 546, 1061, 29897, 13, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 361, 7664, 29889, 5451, 29898, 344, 546, 1061, 29897, 2804, 518, 442, 391, 5387, 13, 12, 12, 12, 442, 2879, 29889, 5992, 29898, 442, 391, 29897, 13, 12, 2457, 17906, 13, 13, 13, 1753, 5375, 675, 29898, 442, 2879, 1125, 13, 12, 1454, 409, 546, 1061, 297, 313, 613, 613, 15691, 613, 376, 29987, 613, 376, 8263, 19021, 29908, 1125, 12, 13, 12, 12, 442, 2879, 353, 6219, 29918, 1761, 29898, 442, 2879, 29892, 409, 546, 1061, 29897, 13, 12, 1454, 474, 297, 3464, 29898, 2435, 29898, 442, 2879, 22164, 13, 12, 12, 442, 2879, 29961, 29875, 29962, 353, 17906, 29961, 29875, 1822, 17010, 580, 13, 12, 442, 2879, 353, 1051, 29898, 842, 29898, 442, 2879, 876, 13, 12, 2457, 17906, 13, 13, 13, 1753, 26091, 29918, 2312, 29918, 21574, 29898, 1807, 1125, 13, 12, 1807, 353, 1347, 29889, 21064, 580, 13, 12, 1807, 353, 1051, 29898, 1807, 29897, 13, 12, 1454, 474, 297, 3464, 29898, 2435, 29898, 1807, 22164, 13, 12, 12, 361, 313, 1333, 1347, 29961, 29875, 1822, 275, 284, 1949, 3101, 470, 1347, 29961, 29875, 29962, 1275, 376, 29242, 13, 12, 12, 12, 1807, 29961, 29875, 29962, 353, 376, 376, 13, 12, 1807, 353, 376, 1642, 7122, 29898, 1807, 29897, 13, 12, 2457, 1347, 13, 13, 13, 1753, 7780, 1691, 29918, 17532, 29898, 1792, 29892, 1347, 1125, 13, 12, 361, 376, 18616, 2063, 29918, 29873, 650, 29908, 297, 1404, 3366, 29873, 650, 16862, 8149, 7295, 13, 12, 12, 29873, 705, 1691, 29918, 29873, 650, 353, 1404, 3366, 29873, 650, 3108, 3366, 18616, 2063, 29918, 29873, 650, 3108, 13, 12, 12, 29873, 705, 1691, 353, 518, 18616, 2063, 3366, 726, 3108, 363, 25260, 297, 7780, 1691, 29918, 29873, 650, 29962, 13, 12, 12, 1454, 474, 297, 3464, 29898, 2435, 29898, 29873, 705, 1691, 22164, 13, 12, 12, 12, 361, 1347, 297, 7780, 1691, 29961, 29875, 29962, 470, 26091, 29918, 2312, 29918, 21574, 29898, 1807, 29897, 297, 7780, 1691, 29961, 29875, 5387, 13, 12, 12, 12, 12, 2457, 5852, 29892, 7780, 1691, 29918, 29873, 650, 29961, 29875, 29962, 3366, 880, 267, 3108, 13, 12, 2457, 7700, 29892, 6213, 13, 13, 13, 1753, 6907, 29898, 1792, 1125, 13, 12, 21453, 29879, 29892, 23289, 29892, 766, 5081, 287, 353, 6213, 29892, 6213, 29892, 6213, 13, 12, 2541, 1722, 703, 1272, 29914, 1341, 22394, 29914, 21453, 29879, 29889, 2109, 613, 376, 6050, 1159, 408, 934, 29901, 13, 12, 12, 21453, 29879, 353, 5839, 280, 29889, 1359, 29898, 1445, 29897, 13, 13, 12, 497, 29918, 21453, 29879, 353, 5159, 13, 12, 497, 29918, 442, 2879, 353, 5159, 13, 12, 5081, 287, 29918, 442, 2879, 353, 6571, 13, 12, 2218, 5081, 287, 29918, 442, 2879, 353, 6571, 13, 12, 5081, 287, 29918, 1885, 276, 353, 6571, 13, 12, 2218, 5081, 287, 29918, 1885, 276, 353, 6571, 13, 12, 10109, 353, 5159, 13, 13, 12, 1454, 16151, 297, 12516, 29889, 8149, 7295, 13, 12, 12, 1454, 4823, 297, 12516, 29961, 1885, 276, 5387, 13, 12, 12, 12, 29937, 6820, 376, 7979, 271, 342, 310, 599, 931, 29908, 12516, 263, 24583, 13, 12, 12, 12, 361, 16151, 1275, 376, 1484, 271, 1115, 13, 12, 12, 12, 12, 361, 1051, 29898, 21453, 718, 518, 29900, 2314, 451, 297, 599, 29918, 21453, 29879, 29901, 13, 12, 12, 12, 12, 12, 497, 29918, 21453, 29879, 29889, 4397, 29898, 21453, 718, 518, 29896, 2314, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 361, 1051, 29898, 21453, 718, 518, 29900, 2314, 451, 297, 599, 29918, 21453, 29879, 29901, 13, 12, 12, 12, 12, 12, 497, 29918, 21453, 29879, 29889, 4397, 29898, 21453, 718, 518, 29900, 2314, 13, 13, 12, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 12, 12, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 12, 12, 361, 7664, 451, 297, 599, 29918, 442, 2879, 29901, 13, 12, 12, 12, 12, 12, 497, 29918, 442, 2879, 29889, 4397, 29898, 442, 391, 29897, 13, 13, 12, 1454, 4823, 297, 1404, 3366, 5081, 287, 3108, 29901, 13, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 12, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 12, 361, 7664, 297, 23289, 29918, 442, 2879, 29889, 8149, 7295, 13, 12, 12, 12, 12, 5081, 287, 29918, 442, 2879, 29961, 442, 391, 29962, 4619, 29871, 29896, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 5081, 287, 29918, 442, 2879, 29961, 442, 391, 29962, 353, 29871, 29896, 13, 12, 12, 361, 4823, 29961, 29906, 29962, 297, 23289, 29918, 1885, 276, 29889, 8149, 7295, 13, 12, 12, 12, 5081, 287, 29918, 1885, 276, 29961, 21453, 29961, 29906, 5262, 4619, 29871, 29896, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 5081, 287, 29918, 1885, 276, 29961, 21453, 29961, 29906, 5262, 353, 29871, 29896, 13, 13, 12, 1454, 4823, 297, 1404, 3366, 2218, 5081, 287, 3108, 29901, 13, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 12, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 12, 361, 7664, 297, 766, 5081, 287, 29918, 442, 2879, 29889, 8149, 7295, 13, 12, 12, 12, 12, 2218, 5081, 287, 29918, 442, 2879, 29961, 442, 391, 29962, 4619, 29871, 29896, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 2218, 5081, 287, 29918, 442, 2879, 29961, 442, 391, 29962, 353, 29871, 29896, 13, 12, 12, 361, 4823, 29961, 29906, 29962, 297, 766, 5081, 287, 29918, 1885, 276, 29889, 8149, 7295, 13, 12, 12, 12, 2218, 5081, 287, 29918, 1885, 276, 29961, 21453, 29961, 29906, 5262, 4619, 29871, 29896, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2218, 5081, 287, 29918, 1885, 276, 29961, 21453, 29961, 29906, 5262, 353, 29871, 29896, 13, 13, 13, 12, 15945, 29908, 13, 12, 29907, 21977, 310, 5839, 292, 12516, 13, 12, 13, 12, 29931, 638, 873, 6614, 310, 263, 4823, 1641, 18691, 338, 2729, 2501, 29871, 29946, 21420, 13, 12, 29896, 29889, 4911, 29915, 29879, 26649, 310, 12516, 29914, 442, 2879, 29914, 1885, 690, 297, 7780, 1691, 3412, 411, 278, 19688, 310, 278, 7780, 300, 13, 12, 29906, 29889, 6811, 497, 19688, 310, 1404, 29915, 29879, 7780, 1691, 13, 12, 29941, 29889, 4911, 29915, 29879, 23289, 322, 766, 5081, 287, 12516, 13, 12, 29946, 29889, 16968, 2264, 13, 12, 15945, 29908, 13, 13, 12, 1454, 4823, 297, 599, 29918, 21453, 29879, 29901, 13, 12, 12, 361, 376, 29873, 650, 29908, 297, 1404, 29889, 8149, 7295, 13, 12, 12, 12, 29937, 26649, 297, 7780, 1691, 13, 12, 12, 12, 10052, 5056, 353, 6796, 4600, 613, 376, 29879, 328, 2264, 3108, 13, 12, 12, 12, 1066, 277, 3145, 353, 6796, 2212, 29891, 3108, 13, 13, 12, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 13, 12, 12, 12, 2277, 1423, 278, 3585, 310, 445, 4823, 29915, 29879, 16151, 13, 12, 12, 12, 19562, 29918, 1867, 29892, 260, 2873, 353, 7780, 1691, 29918, 17532, 29898, 1792, 29892, 4823, 29961, 29906, 2314, 12, 13, 12, 12, 12, 361, 896, 29918, 1867, 29901, 13, 12, 12, 12, 12, 29873, 650, 29918, 4841, 353, 518, 29873, 3366, 29873, 650, 29918, 333, 3108, 363, 260, 297, 260, 2873, 29962, 13, 12, 12, 12, 12, 361, 738, 4197, 1066, 297, 16225, 29918, 4841, 363, 926, 297, 13686, 3145, 29962, 1125, 13, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 6374, 16151, 3585, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 29889, 29945, 876, 13, 12, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 29889, 29945, 13, 12, 12, 12, 12, 23681, 738, 4197, 10052, 297, 16225, 29918, 4841, 363, 3480, 297, 3480, 5056, 29962, 1125, 13, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 448, 8875, 8158, 1363, 310, 8178, 16151, 3585, 297, 7780, 1691, 1642, 4830, 29898, 29900, 29889, 29906, 29945, 876, 13, 12, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 22361, 29871, 29900, 29889, 29906, 29945, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 16151, 3585, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 876, 13, 12, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 13, 13, 12, 12, 12, 2277, 1423, 278, 3585, 310, 445, 4823, 29915, 29879, 7664, 29915, 29879, 1024, 13, 12, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 12, 12, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 12, 12, 19562, 29918, 1867, 29892, 260, 2873, 353, 7780, 1691, 29918, 17532, 29898, 1792, 29892, 7664, 29897, 13, 12, 12, 12, 12, 361, 896, 29918, 1867, 29901, 13, 12, 12, 12, 12, 12, 29873, 650, 29918, 4841, 353, 518, 29873, 3366, 29873, 650, 29918, 333, 3108, 363, 260, 297, 260, 2873, 29962, 13, 12, 12, 12, 12, 12, 361, 738, 4197, 1066, 297, 16225, 29918, 4841, 363, 926, 297, 13686, 3145, 29962, 1125, 13, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 6374, 7664, 3585, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29946, 876, 13, 12, 12, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29946, 13, 12, 12, 12, 12, 12, 23681, 738, 4197, 10052, 297, 16225, 29918, 4841, 363, 3480, 297, 3480, 5056, 29962, 1125, 13, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 448, 8875, 8158, 1363, 310, 8178, 7664, 3585, 297, 7780, 1691, 1642, 4830, 29898, 29896, 876, 13, 12, 12, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 22361, 29871, 29896, 13, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 7664, 3585, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29941, 876, 13, 12, 12, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29941, 13, 13, 12, 12, 12, 2277, 1423, 278, 3585, 310, 445, 4823, 29915, 29879, 1024, 13, 12, 12, 12, 19562, 29918, 1867, 29892, 260, 2873, 353, 7780, 1691, 29918, 17532, 29898, 1792, 29892, 4823, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29900, 1822, 17010, 3101, 13, 12, 12, 12, 361, 896, 29918, 1867, 29901, 13, 12, 12, 12, 12, 29873, 650, 29918, 4841, 353, 518, 29873, 3366, 29873, 650, 29918, 333, 3108, 363, 260, 297, 260, 2873, 29962, 13, 12, 12, 12, 12, 1454, 269, 297, 599, 29918, 21453, 29879, 29901, 13, 12, 12, 12, 12, 12, 2277, 29937, 16833, 916, 12516, 2729, 373, 17906, 13, 12, 12, 12, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 12, 12, 12, 12, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 12, 12, 12, 12, 361, 7664, 297, 269, 29961, 29900, 5387, 13, 12, 12, 12, 12, 12, 12, 12, 361, 738, 4197, 1066, 297, 16225, 29918, 4841, 363, 926, 297, 13686, 3145, 29962, 1125, 13, 12, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 6374, 4823, 3585, 310, 1021, 7664, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29946, 876, 13, 12, 12, 12, 12, 12, 12, 12, 12, 29879, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29946, 13, 12, 12, 12, 12, 12, 12, 12, 23681, 738, 4197, 10052, 297, 16225, 29918, 4841, 363, 3480, 297, 3480, 5056, 29962, 1125, 13, 12, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 448, 8875, 8158, 1363, 310, 8178, 4823, 3585, 310, 1021, 7664, 297, 7780, 1691, 1642, 4830, 29898, 29896, 876, 13, 12, 12, 12, 12, 12, 12, 12, 12, 29879, 29961, 29941, 29962, 22361, 29871, 29896, 13, 12, 12, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 4823, 3585, 310, 1021, 7664, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29906, 876, 13, 12, 12, 12, 12, 12, 12, 12, 12, 29879, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 442, 2879, 29961, 3317, 29898, 5081, 287, 29918, 442, 2879, 4638, 565, 7431, 29898, 5081, 287, 29918, 442, 2879, 29897, 1683, 29871, 29900, 29897, 334, 29871, 29941, 718, 29871, 29941, 13, 12, 12, 12, 12, 12, 361, 269, 29961, 29906, 29962, 1275, 4823, 29961, 29906, 5387, 13, 12, 12, 12, 12, 12, 12, 361, 738, 4197, 1066, 297, 16225, 29918, 4841, 363, 926, 297, 13686, 3145, 29962, 1125, 13, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 6374, 4823, 310, 1021, 16151, 3585, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 29889, 29945, 876, 13, 12, 12, 12, 12, 12, 12, 12, 29879, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 29889, 29945, 13, 12, 12, 12, 12, 12, 12, 23681, 738, 4197, 10052, 297, 16225, 29918, 4841, 363, 3480, 297, 3480, 5056, 29962, 1125, 13, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 448, 8875, 8158, 1363, 310, 8178, 4823, 310, 1021, 16151, 3585, 297, 7780, 1691, 1642, 4830, 29898, 29900, 29889, 29906, 29945, 876, 13, 12, 12, 12, 12, 12, 12, 12, 29879, 29961, 29941, 29962, 22361, 29871, 29900, 29889, 29906, 29945, 13, 12, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 8158, 1363, 310, 4823, 310, 1021, 16151, 3585, 297, 7780, 1691, 1642, 4830, 3552, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 876, 13, 12, 12, 12, 12, 12, 12, 12, 29879, 29961, 29941, 29962, 4619, 313, 5081, 287, 29918, 1885, 276, 29961, 3317, 29898, 5081, 287, 29918, 1885, 276, 4638, 565, 7431, 29898, 5081, 287, 29918, 1885, 276, 29897, 1683, 29871, 29900, 29897, 718, 29871, 29896, 13, 13, 12, 12, 12, 29937, 12463, 19688, 310, 278, 7780, 1691, 13, 12, 12, 12, 2324, 353, 426, 13, 12, 12, 12, 12, 29908, 4600, 1115, 4852, 4034, 29899, 29882, 459, 613, 376, 20821, 613, 376, 287, 29885, 4968, 13, 12, 12, 12, 12, 29908, 29888, 799, 1115, 313, 511, 462, 4706, 444, 21104, 19688, 297, 445, 3030, 13, 12, 12, 12, 12, 29908, 2212, 29891, 1115, 4852, 4034, 29899, 29882, 459, 613, 376, 20821, 613, 376, 287, 29885, 613, 376, 7323, 613, 376, 13509, 4968, 13, 12, 12, 12, 12, 29908, 29879, 328, 2264, 1115, 4852, 1990, 936, 613, 376, 20821, 613, 376, 7323, 613, 376, 29926, 7511, 613, 376, 13509, 4968, 13, 12, 12, 12, 12, 29908, 7054, 3637, 936, 1115, 4852, 1990, 936, 613, 376, 29926, 7511, 613, 376, 13509, 4968, 13, 12, 12, 12, 12, 29908, 5527, 1693, 1115, 313, 511, 462, 259, 444, 21104, 19688, 297, 445, 3030, 13, 12, 12, 12, 12, 29908, 29873, 296, 1230, 1115, 3861, 462, 1678, 444, 21104, 19688, 297, 445, 3030, 13, 12, 12, 12, 29913, 13, 12, 12, 12, 957, 497, 29918, 18616, 2073, 353, 1404, 3366, 29873, 650, 29918, 29906, 29946, 29918, 29882, 2470, 3108, 3366, 3225, 29918, 29873, 650, 3108, 3366, 880, 267, 3108, 13, 13, 12, 12, 12, 1454, 19688, 297, 12463, 29918, 18616, 2073, 29901, 13, 12, 12, 12, 12, 361, 4823, 29961, 29906, 29962, 297, 1544, 29961, 18616, 2073, 3366, 29873, 650, 29918, 333, 3108, 5387, 13, 12, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 8875, 363, 6571, 12463, 16225, 1642, 4830, 29898, 14486, 29898, 18616, 2073, 3366, 13628, 3108, 334, 29871, 29906, 511, 19688, 3366, 29873, 650, 29918, 333, 3108, 876, 13, 12, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 4619, 4513, 29898, 18616, 2073, 3366, 13628, 3108, 334, 29871, 29906, 29897, 13, 13, 12, 12, 29937, 4188, 267, 322, 766, 5081, 267, 13, 12, 12, 2277, 4188, 267, 13, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 12, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 12, 361, 7664, 297, 23289, 29918, 442, 2879, 29889, 8149, 7295, 13, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 363, 4188, 292, 7664, 6571, 1642, 4830, 29898, 29941, 334, 23289, 29918, 442, 2879, 29961, 442, 391, 1402, 7664, 876, 13, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 4619, 29871, 29946, 334, 23289, 29918, 442, 2879, 29961, 442, 391, 29962, 13, 12, 12, 361, 4823, 29961, 29906, 29962, 297, 23289, 29918, 1885, 276, 29889, 8149, 7295, 13, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 718, 8875, 363, 4188, 292, 16151, 6571, 1642, 4830, 29898, 29900, 29889, 29955, 29945, 334, 23289, 29918, 1885, 276, 29961, 21453, 29961, 29906, 20526, 4823, 29961, 29906, 12622, 13, 12, 12, 12, 21453, 29961, 29941, 29962, 4619, 29871, 29900, 29889, 29955, 29945, 334, 23289, 29918, 1885, 276, 29961, 21453, 29961, 29906, 5262, 13, 13, 12, 12, 2277, 766, 5081, 267, 13, 12, 12, 442, 2879, 353, 5375, 675, 4197, 21453, 29961, 29900, 1822, 5451, 703, 30022, 1159, 29961, 29896, 1822, 17010, 580, 2314, 13, 12, 12, 1454, 7664, 297, 17906, 29901, 13, 12, 12, 12, 361, 7664, 297, 766, 5081, 287, 29918, 442, 2879, 29889, 8149, 7295, 13, 12, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 448, 8875, 363, 766, 5081, 292, 7664, 6571, 1642, 4830, 29898, 29896, 334, 766, 5081, 287, 29918, 442, 2879, 29961, 442, 391, 1402, 7664, 876, 13, 12, 12, 12, 12, 21453, 29961, 29941, 29962, 22361, 29871, 29896, 334, 766, 5081, 287, 29918, 442, 2879, 29961, 442, 391, 29962, 13, 12, 12, 361, 4823, 29961, 29906, 29962, 297, 766, 5081, 287, 29918, 1885, 276, 29889, 8149, 7295, 13, 12, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 448, 8875, 363, 766, 5081, 292, 16151, 6571, 1642, 4830, 29898, 29900, 29889, 29906, 334, 766, 5081, 287, 29918, 1885, 276, 29961, 21453, 29961, 29906, 20526, 4823, 29961, 29906, 12622, 13, 12, 12, 12, 21453, 29961, 29941, 29962, 22361, 29871, 29900, 29889, 29906, 334, 766, 5081, 287, 29918, 1885, 276, 29961, 21453, 29961, 29906, 5262, 12, 12, 13, 13, 12, 29937, 4226, 5281, 19435, 304, 3588, 19435, 964, 2070, 11614, 13, 12, 677, 342, 353, 1375, 4197, 29879, 29961, 29941, 29962, 363, 269, 297, 599, 29918, 21453, 29879, 2314, 13, 12, 361, 19604, 5277, 29871, 29900, 29901, 13, 12, 12, 1454, 4823, 297, 599, 29918, 21453, 29879, 29901, 13, 12, 12, 12, 21453, 29961, 29941, 29962, 22361, 19604, 448, 29871, 29896, 13, 12, 9812, 342, 353, 4236, 4197, 29879, 29961, 29941, 29962, 363, 269, 297, 599, 29918, 21453, 29879, 2314, 13, 12, 2158, 703, 15790, 2070, 11614, 13018, 1159, 13, 12, 1454, 4823, 297, 599, 29918, 21453, 29879, 29901, 13, 12, 12, 2158, 703, 13628, 29901, 613, 4823, 29961, 29941, 2314, 13, 12, 12, 21453, 29961, 29941, 29962, 353, 4823, 29961, 29941, 29962, 847, 9939, 13, 12, 12, 2158, 29898, 21453, 29961, 29900, 1402, 376, 29989, 2186, 6976, 29901, 613, 4823, 29961, 29941, 1402, 376, 9812, 342, 29901, 613, 9939, 29897, 13, 13, 12, 361, 376, 21453, 29879, 29908, 297, 1404, 29889, 8149, 7295, 13, 12, 12, 6144, 1404, 3366, 21453, 29879, 3108, 13, 12, 1792, 3366, 21453, 29879, 3108, 353, 5159, 13, 13, 12, 29937, 5839, 292, 29871, 29896, 29900, 12516, 13, 12, 2158, 703, 29896, 29900, 18691, 12516, 13018, 1159, 13, 12, 1454, 474, 297, 3464, 29898, 29896, 29900, 1125, 13, 12, 12, 8000, 5852, 29901, 13, 12, 12, 12, 4012, 353, 4036, 29889, 29590, 29898, 29900, 29892, 29871, 29896, 29897, 13, 12, 12, 12, 10109, 353, 5159, 13, 12, 12, 12, 1454, 4823, 297, 599, 29918, 21453, 29879, 29901, 13, 12, 12, 12, 12, 361, 4823, 451, 297, 1404, 3366, 21453, 29879, 3108, 322, 4216, 5277, 4823, 29961, 29941, 5387, 13, 12, 12, 12, 12, 12, 10109, 29889, 4397, 29898, 21453, 29897, 13, 12, 12, 12, 361, 7431, 29898, 10109, 29897, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 12, 8690, 13, 12, 12, 13140, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 7431, 29898, 10109, 29897, 448, 29871, 29896, 29897, 13, 12, 12, 1792, 3366, 21453, 29879, 16862, 4397, 29898, 10109, 29961, 13140, 2314, 13, 12, 12, 2158, 703, 29925, 17840, 613, 11565, 29961, 13140, 3816, 29900, 1402, 376, 1454, 6976, 613, 11565, 29961, 13140, 3816, 29941, 2314, 13, 12, 2457, 1404, 2 ]
day_18/day_18_project_the_hirst_painting.py
MatheusNascimentoS/100_days_of_code_python
0
180061
<reponame>MatheusNascimentoS/100_days_of_code_python<gh_stars>0 import turtle as t from random import choice,randint rgb_colors = [(202, 164, 110), (240, 245, 241), (236, 239, 243), (149, 75, 50), (222, 201, 136), (53, 93, 123), (170, 154, 41), (138, 31, 20), (134, 163, 184), (197, 92, 73), (47, 121, 86), (73, 43, 35), (145, 178, 149), (14, 98, 70), (232, 176, 165), (160, 142, 158), (54, 45, 50), (101, 75, 77), (183, 205, 171), (36, 60, 74), (19, 86, 89), (82, 148, 129), (147, 17, 19), (27, 68, 102), (12, 70, 64), (107, 127, 153), (176, 192, 208), (168, 99, 102)] print(rgb_colors) tim = t.Turtle() tim.speed("fastest") tim.penup() t.colormode(255) tim.goto(-250,-250) for _ in range(10): for _ in range(10): tim.color(choice(rgb_colors)) tim.forward(50) tim.dot(20) tim.left(90) tim.forward(50) tim.left(90) tim.forward(500) tim.left(180) tim.hideturtle() screen = t.Screen() screen.exitonclick()
[ 1, 529, 276, 1112, 420, 29958, 9782, 354, 375, 29940, 6151, 6174, 29903, 29914, 29896, 29900, 29900, 29918, 16700, 29918, 974, 29918, 401, 29918, 4691, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 260, 4227, 280, 408, 260, 13, 13, 3166, 4036, 1053, 7348, 29892, 9502, 524, 13, 13, 23973, 29918, 27703, 353, 17288, 29906, 29900, 29906, 29892, 29871, 29896, 29953, 29946, 29892, 29871, 29896, 29896, 29900, 511, 313, 29906, 29946, 29900, 29892, 29871, 29906, 29946, 29945, 29892, 29871, 29906, 29946, 29896, 511, 313, 29906, 29941, 29953, 29892, 29871, 29906, 29941, 29929, 29892, 29871, 29906, 29946, 29941, 511, 313, 29896, 29946, 29929, 29892, 29871, 29955, 29945, 29892, 29871, 29945, 29900, 511, 313, 29906, 29906, 29906, 29892, 29871, 29906, 29900, 29896, 29892, 29871, 29896, 29941, 29953, 511, 313, 29945, 29941, 29892, 29871, 29929, 29941, 29892, 29871, 29896, 29906, 29941, 511, 313, 29896, 29955, 29900, 29892, 29871, 29896, 29945, 29946, 29892, 29871, 29946, 29896, 511, 313, 29896, 29941, 29947, 29892, 29871, 29941, 29896, 29892, 29871, 29906, 29900, 511, 313, 29896, 29941, 29946, 29892, 29871, 29896, 29953, 29941, 29892, 29871, 29896, 29947, 29946, 511, 313, 29896, 29929, 29955, 29892, 29871, 29929, 29906, 29892, 29871, 29955, 29941, 511, 313, 29946, 29955, 29892, 29871, 29896, 29906, 29896, 29892, 29871, 29947, 29953, 511, 313, 29955, 29941, 29892, 29871, 29946, 29941, 29892, 29871, 29941, 29945, 511, 313, 29896, 29946, 29945, 29892, 29871, 29896, 29955, 29947, 29892, 29871, 29896, 29946, 29929, 511, 313, 29896, 29946, 29892, 29871, 29929, 29947, 29892, 29871, 29955, 29900, 511, 313, 29906, 29941, 29906, 29892, 29871, 29896, 29955, 29953, 29892, 29871, 29896, 29953, 29945, 511, 313, 29896, 29953, 29900, 29892, 29871, 29896, 29946, 29906, 29892, 29871, 29896, 29945, 29947, 511, 313, 29945, 29946, 29892, 29871, 29946, 29945, 29892, 29871, 13, 29945, 29900, 511, 313, 29896, 29900, 29896, 29892, 29871, 29955, 29945, 29892, 29871, 29955, 29955, 511, 313, 29896, 29947, 29941, 29892, 29871, 29906, 29900, 29945, 29892, 29871, 29896, 29955, 29896, 511, 313, 29941, 29953, 29892, 29871, 29953, 29900, 29892, 29871, 29955, 29946, 511, 313, 29896, 29929, 29892, 29871, 29947, 29953, 29892, 29871, 29947, 29929, 511, 313, 29947, 29906, 29892, 29871, 29896, 29946, 29947, 29892, 29871, 29896, 29906, 29929, 511, 313, 29896, 29946, 29955, 29892, 29871, 29896, 29955, 29892, 29871, 29896, 29929, 511, 313, 29906, 29955, 29892, 29871, 29953, 29947, 29892, 29871, 29896, 29900, 29906, 511, 313, 29896, 29906, 29892, 29871, 29955, 29900, 29892, 29871, 29953, 29946, 511, 313, 29896, 29900, 29955, 29892, 29871, 29896, 29906, 29955, 29892, 29871, 29896, 29945, 29941, 511, 313, 29896, 29955, 29953, 29892, 29871, 29896, 29929, 29906, 29892, 29871, 29906, 29900, 29947, 511, 313, 29896, 29953, 29947, 29892, 29871, 29929, 29929, 29892, 29871, 29896, 29900, 29906, 4638, 13, 13, 13, 2158, 29898, 23973, 29918, 27703, 29897, 13, 9346, 353, 260, 29889, 29911, 4227, 280, 580, 13, 9346, 29889, 19322, 703, 11255, 342, 1159, 13, 9346, 29889, 2238, 786, 580, 13, 29873, 29889, 1054, 555, 356, 29898, 29906, 29945, 29945, 29897, 13, 9346, 29889, 27102, 6278, 29906, 29945, 29900, 6653, 29906, 29945, 29900, 29897, 13, 13, 1454, 903, 297, 3464, 29898, 29896, 29900, 1125, 13, 1678, 363, 903, 297, 3464, 29898, 29896, 29900, 1125, 13, 4706, 5335, 29889, 2780, 29898, 16957, 29898, 23973, 29918, 27703, 876, 13, 4706, 5335, 29889, 11333, 29898, 29945, 29900, 29897, 13, 4706, 5335, 29889, 6333, 29898, 29906, 29900, 29897, 13, 1678, 5335, 29889, 1563, 29898, 29929, 29900, 29897, 13, 1678, 5335, 29889, 11333, 29898, 29945, 29900, 29897, 13, 1678, 5335, 29889, 1563, 29898, 29929, 29900, 29897, 13, 1678, 5335, 29889, 11333, 29898, 29945, 29900, 29900, 29897, 13, 1678, 5335, 29889, 1563, 29898, 29896, 29947, 29900, 29897, 13, 13, 9346, 29889, 29882, 333, 300, 4227, 280, 580, 13, 10525, 353, 260, 29889, 11357, 580, 13, 10525, 29889, 13322, 265, 3808, 580, 1678, 13, 2 ]
setup.py
robertjanes/drawbot
0
15621
#!/usr/bin/env python from __future__ import division, absolute_import, print_function from setuptools import setup import os import re import shutil _versionRE = re.compile(r'__version__\s*=\s*\"([^\"]+)\"') # read the version number for the settings file with open('drawBot/drawBotSettings.py', "r") as settings: code = settings.read() found = _versionRE.search(code) assert found is not None, "drawBot __version__ not found" __version__ = found.group(1) externalTools = ("ffmpeg", "gifsicle", "mkbitmap", "potrace") externalToolsSourceRoot = os.path.join(os.path.dirname(__file__), "Resources", "externalTools") externalToolsDestRoot = os.path.join(os.path.dirname(__file__), "drawBot", "context", "tools") # copy all external tools into drawBot.context.tools folder for externalTool in externalTools: source = os.path.join(externalToolsSourceRoot, externalTool) dest = os.path.join(externalToolsDestRoot, externalTool) shutil.copyfile(source, dest) os.chmod(dest, 0o775) setup(name="drawBot", version=__version__, description="DrawBot is a powerful tool that invites you to write simple Python scripts to generate two-dimensional graphics. The builtin graphics primitives support rectangles, ovals, (bezier) paths, polygons, text objects and transparency.", author="<NAME>, <NAME>, <NAME>", author_email="<EMAIL>", url="http://drawbot.com", license="BSD", packages=[ "drawBot", "drawBot.context", "drawBot.context.tools", "drawBot.ui" ], package_data={ "drawBot": [ "context/tools/ffmpeg", "context/tools/gifsicle", "context/tools/mkbitmap", "context/tools/potrace" ] }, install_requires=[ "pyobjc", "fontTools", "booleanOperations", "pillow" ], include_package_data=True, ) # remove all external tools for externalTool in externalTools: dest = os.path.join(externalToolsDestRoot, externalTool) os.remove(dest)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 29892, 8380, 29918, 5215, 29892, 1596, 29918, 2220, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 5215, 2897, 13, 5215, 337, 13, 5215, 528, 4422, 13, 13, 13, 29918, 3259, 1525, 353, 337, 29889, 12198, 29898, 29878, 29915, 1649, 3259, 1649, 29905, 29879, 29930, 2013, 29879, 29930, 5931, 4197, 3823, 3108, 29974, 2144, 29908, 1495, 13, 29937, 1303, 278, 1873, 1353, 363, 278, 6055, 934, 13, 2541, 1722, 877, 4012, 29933, 327, 29914, 4012, 29933, 327, 9585, 29889, 2272, 742, 376, 29878, 1159, 408, 6055, 29901, 13, 1678, 775, 353, 6055, 29889, 949, 580, 13, 1678, 1476, 353, 903, 3259, 1525, 29889, 4478, 29898, 401, 29897, 13, 1678, 4974, 1476, 338, 451, 6213, 29892, 376, 4012, 29933, 327, 4770, 3259, 1649, 451, 1476, 29908, 13, 1678, 4770, 3259, 1649, 353, 1476, 29889, 2972, 29898, 29896, 29897, 13, 13, 13, 23176, 24183, 353, 4852, 600, 20856, 613, 376, 29887, 10270, 2512, 613, 376, 11256, 2966, 1958, 613, 376, 17765, 25525, 1159, 13, 23176, 24183, 4435, 10303, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 376, 13770, 613, 376, 23176, 24183, 1159, 13, 23176, 24183, 14994, 10303, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 376, 4012, 29933, 327, 613, 376, 4703, 613, 376, 8504, 1159, 13, 13, 29937, 3509, 599, 7029, 8492, 964, 4216, 29933, 327, 29889, 4703, 29889, 8504, 29871, 4138, 13, 1454, 7029, 12229, 297, 7029, 24183, 29901, 13, 1678, 2752, 353, 2897, 29889, 2084, 29889, 7122, 29898, 23176, 24183, 4435, 10303, 29892, 7029, 12229, 29897, 13, 1678, 2731, 353, 2897, 29889, 2084, 29889, 7122, 29898, 23176, 24183, 14994, 10303, 29892, 7029, 12229, 29897, 13, 1678, 528, 4422, 29889, 8552, 1445, 29898, 4993, 29892, 2731, 29897, 13, 1678, 2897, 29889, 305, 1545, 29898, 7854, 29892, 29871, 29900, 29877, 29955, 29955, 29945, 29897, 13, 13, 13, 14669, 29898, 978, 543, 4012, 29933, 327, 613, 13, 1678, 1873, 29922, 1649, 3259, 1649, 29892, 13, 1678, 6139, 543, 8537, 29933, 327, 338, 263, 13988, 5780, 393, 2437, 3246, 366, 304, 2436, 2560, 5132, 12078, 304, 5706, 1023, 29899, 12531, 18533, 29889, 450, 4240, 262, 18533, 28147, 3145, 2304, 7705, 19536, 29892, 288, 791, 29879, 29892, 313, 15325, 631, 29897, 10898, 29892, 1248, 4790, 787, 29892, 1426, 3618, 322, 1301, 862, 3819, 19602, 13, 1678, 4148, 543, 29966, 5813, 10202, 529, 5813, 10202, 529, 5813, 28341, 13, 1678, 4148, 29918, 5269, 543, 29966, 26862, 6227, 28341, 13, 1678, 3142, 543, 1124, 597, 4012, 7451, 29889, 510, 613, 13, 1678, 19405, 543, 29933, 7230, 613, 13, 1678, 9741, 11759, 13, 4706, 376, 4012, 29933, 327, 613, 13, 4706, 376, 4012, 29933, 327, 29889, 4703, 613, 13, 4706, 376, 4012, 29933, 327, 29889, 4703, 29889, 8504, 613, 13, 4706, 376, 4012, 29933, 327, 29889, 1481, 29908, 13, 1678, 21251, 13, 1678, 3577, 29918, 1272, 3790, 13, 4706, 376, 4012, 29933, 327, 1115, 518, 13, 9651, 376, 4703, 29914, 8504, 29914, 600, 20856, 613, 13, 9651, 376, 4703, 29914, 8504, 29914, 29887, 10270, 2512, 613, 13, 9651, 376, 4703, 29914, 8504, 29914, 11256, 2966, 1958, 613, 13, 9651, 376, 4703, 29914, 8504, 29914, 17765, 25525, 29908, 13, 4706, 4514, 13, 1678, 2981, 13, 1678, 2601, 29918, 276, 339, 2658, 11759, 13, 4706, 376, 2272, 5415, 29883, 613, 13, 4706, 376, 5657, 24183, 613, 13, 4706, 376, 20054, 7094, 800, 613, 13, 4706, 376, 29886, 453, 340, 29908, 13, 1678, 21251, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 29897, 13, 13, 29937, 3349, 599, 7029, 8492, 13, 1454, 7029, 12229, 297, 7029, 24183, 29901, 13, 1678, 2731, 353, 2897, 29889, 2084, 29889, 7122, 29898, 23176, 24183, 14994, 10303, 29892, 7029, 12229, 29897, 13, 1678, 2897, 29889, 5992, 29898, 7854, 29897, 13, 2 ]
test_algorithm.py
tykkz/hasherapp
0
160080
<reponame>tykkz/hasherapp<gh_stars>0 import unittest from algorithm import hash_text class TestHashText(unittest.TestCase): def setUp(self): self.avail_func_array = ['md5', 'sha1', 'sha256'] self.avail_func_array2 = ['sha256', 'sha224'] self.text = "hello" self.hello_pass_1 = {'sha1': '<PASSWORD>8a2<PASSWORD>3b482<PASSWORD>34d', 'sha256': '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824', 'md5': '5d41402abc4b2a76b9719d911017c592'} self.hello_pass_100 = {'sha1': '3005a7cebc1edda34127c87c7bc79074e1<PASSWORD>5d', 'sha256': '0c7e20c4751943a4cf4ec6a2d17a520c8aaf1d2a714e2af1ad6667fd06c056de', 'md5': '3b8ca2de573942e58426494e9fcf8766'} def test_successful(self): self.assertEqual(self.hello_pass_1, hash_text(self.avail_func_array, self.text, 1)[1], "Correct hash values for one (1) pass of given hash algorithms") self.assertCountEqual(self.hello_pass_100, hash_text(self.avail_func_array, self.text, 100)[1], "Correct hash values for hundred (100) pass of given hash algorithms") def test_empty_function_array(self): self.assertFalse(hash_text([], self.text, 1)[0], "One should not use empty array for the hash algorithm list.") def test_none_function_array_type(self): self.assertFalse(hash_text(None, self.text, 1)[0], "Incorrect type for hash algorithms list.") def test_diferent_function_array(self): self.assertNotEqual(self.hello_pass_1, hash_text(self.avail_func_array2, self.text, 1), "Incorrect list of results, different hash algorithms used.") def test_none_text_type(self): self.assertFalse(hash_text(self.avail_func_array, None, 1)[0], "Incorrect type for text to be hashed.") def test_incorrect_text_type(self): self.assertFalse(hash_text(self.avail_func_array, 9999, 1)[0], "Incorrect type for the text parameter; should be of string type.") def test_none_pass_count_type(self): self.assertFalse(hash_text(self.avail_func_array, self.text, None)[0], "Incorrect type for pass count.") def test_different_pass_count(self): self.assertNotEqual(self.hello_pass_1, hash_text(self.avail_func_array, self.text, 9999), "Incorrect list of results, different hash algorithms used.") def test_incorrect_pass_count_type(self): self.assertFalse(hash_text(self.avail_func_array, self.text, self.text)[0], "Incorrect type for the pass count parameter; should be of integer type.") def test_pass_count_value(self): self.assertFalse(hash_text(self.avail_func_array, self.text, 0)[0], "Incorrect value for the pass count parameter; should be larger than zero.") self.assertFalse(hash_text(self.avail_func_array, self.text, -9999)[0], "Incorrect value for the pass count parameter; should be larger than zero.") self.assertFalse(hash_text(self.avail_func_array, self.text, 99999999)[0], "Incorrect value for the pass count parameter; should be smaller than 1000000.") if __name__ == '__main__': unittest.main()
[ 1, 529, 276, 1112, 420, 29958, 1017, 6859, 29920, 29914, 8568, 261, 932, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 443, 27958, 13, 3166, 5687, 1053, 6608, 29918, 726, 13, 13, 13, 1990, 4321, 10438, 1626, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 485, 737, 29918, 9891, 29918, 2378, 353, 6024, 3487, 29945, 742, 525, 17051, 29896, 742, 525, 17051, 29906, 29945, 29953, 2033, 13, 4706, 1583, 29889, 485, 737, 29918, 9891, 29918, 2378, 29906, 353, 6024, 17051, 29906, 29945, 29953, 742, 525, 17051, 29906, 29906, 29946, 2033, 13, 4706, 1583, 29889, 726, 353, 376, 12199, 29908, 13, 4706, 1583, 29889, 12199, 29918, 3364, 29918, 29896, 353, 11117, 17051, 29896, 2396, 12801, 25711, 17013, 29958, 29947, 29874, 29906, 29966, 25711, 17013, 29958, 29941, 29890, 29946, 29947, 29906, 29966, 25711, 17013, 29958, 29941, 29946, 29881, 742, 13, 462, 632, 525, 17051, 29906, 29945, 29953, 2396, 525, 29906, 6854, 29906, 29946, 29881, 2291, 29945, 14943, 29900, 29874, 29941, 29900, 29872, 29906, 29953, 29872, 29947, 29941, 29890, 29906, 562, 29945, 29890, 29929, 29872, 29906, 29929, 29872, 29896, 29890, 29896, 29953, 29896, 29872, 29945, 29883, 29896, 5444, 29955, 29946, 29906, 29945, 29872, 29955, 29941, 29900, 29946, 29941, 29941, 29953, 29906, 29929, 29941, 29947, 29890, 29929, 29947, 29906, 29946, 742, 13, 462, 632, 525, 3487, 29945, 2396, 525, 29945, 29881, 29946, 29896, 29946, 29900, 29906, 10736, 29946, 29890, 29906, 29874, 29955, 29953, 29890, 29929, 29955, 29896, 29929, 29881, 29929, 29896, 29896, 29900, 29896, 29955, 29883, 29945, 29929, 29906, 10827, 13, 4706, 1583, 29889, 12199, 29918, 3364, 29918, 29896, 29900, 29900, 353, 11117, 17051, 29896, 2396, 525, 29941, 29900, 29900, 29945, 29874, 29955, 346, 12328, 29896, 287, 1388, 29941, 29946, 29896, 29906, 29955, 29883, 29947, 29955, 29883, 29955, 12328, 29955, 29929, 29900, 29955, 29946, 29872, 29896, 29966, 25711, 17013, 29958, 29945, 29881, 742, 13, 462, 1669, 525, 17051, 29906, 29945, 29953, 2396, 525, 29900, 29883, 29955, 29872, 29906, 29900, 29883, 29946, 29955, 29945, 29896, 29929, 29946, 29941, 29874, 29946, 6854, 29946, 687, 29953, 29874, 29906, 29881, 29896, 29955, 29874, 29945, 29906, 29900, 29883, 29947, 29874, 2142, 29896, 29881, 29906, 29874, 29955, 29896, 29946, 29872, 29906, 2142, 29896, 328, 29953, 29953, 29953, 29955, 11512, 29900, 29953, 29883, 29900, 29945, 29953, 311, 742, 13, 462, 1669, 525, 3487, 29945, 2396, 525, 29941, 29890, 29947, 1113, 29906, 311, 29945, 29955, 29941, 29929, 29946, 29906, 29872, 29945, 29947, 29946, 29906, 29953, 29946, 29929, 29946, 29872, 29929, 29888, 6854, 29947, 29955, 29953, 29953, 10827, 13, 13, 1678, 822, 1243, 29918, 8698, 1319, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 12199, 29918, 3364, 29918, 29896, 29892, 6608, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 29871, 29896, 9601, 29896, 1402, 13, 462, 308, 376, 12521, 1621, 6608, 1819, 363, 697, 313, 29896, 29897, 1209, 310, 2183, 6608, 14009, 1159, 13, 4706, 1583, 29889, 9294, 3981, 9843, 29898, 1311, 29889, 12199, 29918, 3364, 29918, 29896, 29900, 29900, 29892, 6608, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 29871, 29896, 29900, 29900, 9601, 29896, 1402, 13, 462, 795, 376, 12521, 1621, 6608, 1819, 363, 6893, 313, 29896, 29900, 29900, 29897, 1209, 310, 2183, 6608, 14009, 1159, 13, 13, 1678, 822, 1243, 29918, 6310, 29918, 2220, 29918, 2378, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 4197, 1402, 1583, 29889, 726, 29892, 29871, 29896, 9601, 29900, 1402, 376, 6716, 881, 451, 671, 4069, 1409, 363, 278, 6608, 5687, 1051, 23157, 13, 13, 1678, 822, 1243, 29918, 9290, 29918, 2220, 29918, 2378, 29918, 1853, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 8516, 29892, 1583, 29889, 726, 29892, 29871, 29896, 9601, 29900, 1402, 376, 797, 15728, 1134, 363, 6608, 14009, 1051, 23157, 13, 13, 1678, 822, 1243, 29918, 29881, 9633, 296, 29918, 2220, 29918, 2378, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 3664, 9843, 29898, 1311, 29889, 12199, 29918, 3364, 29918, 29896, 29892, 6608, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29906, 29892, 1583, 29889, 726, 29892, 29871, 29896, 511, 13, 462, 9651, 376, 797, 15728, 1051, 310, 2582, 29892, 1422, 6608, 14009, 1304, 23157, 13, 13, 1678, 822, 1243, 29918, 9290, 29918, 726, 29918, 1853, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 6213, 29892, 29871, 29896, 9601, 29900, 1402, 376, 797, 15728, 1134, 363, 1426, 304, 367, 6608, 287, 23157, 13, 13, 1678, 822, 1243, 29918, 262, 15728, 29918, 726, 29918, 1853, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 29871, 29929, 29929, 29929, 29929, 29892, 29871, 29896, 9601, 29900, 1402, 13, 462, 308, 376, 797, 15728, 1134, 363, 278, 1426, 3443, 29936, 881, 367, 310, 1347, 1134, 23157, 13, 13, 1678, 822, 1243, 29918, 9290, 29918, 3364, 29918, 2798, 29918, 1853, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 6213, 9601, 29900, 1402, 376, 797, 15728, 1134, 363, 1209, 2302, 23157, 13, 13, 1678, 822, 1243, 29918, 29881, 15622, 29918, 3364, 29918, 2798, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 3664, 9843, 29898, 1311, 29889, 12199, 29918, 3364, 29918, 29896, 29892, 6608, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 29871, 29929, 29929, 29929, 29929, 511, 13, 462, 9651, 376, 797, 15728, 1051, 310, 2582, 29892, 1422, 6608, 14009, 1304, 23157, 13, 13, 1678, 822, 1243, 29918, 262, 15728, 29918, 3364, 29918, 2798, 29918, 1853, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 1583, 29889, 726, 9601, 29900, 1402, 13, 462, 308, 376, 797, 15728, 1134, 363, 278, 1209, 2302, 3443, 29936, 881, 367, 310, 6043, 1134, 23157, 13, 13, 1678, 822, 1243, 29918, 3364, 29918, 2798, 29918, 1767, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 29871, 29900, 9601, 29900, 1402, 13, 462, 308, 376, 797, 15728, 995, 363, 278, 1209, 2302, 3443, 29936, 881, 367, 7200, 1135, 5225, 23157, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 448, 29929, 29929, 29929, 29929, 9601, 29900, 1402, 13, 462, 308, 376, 797, 15728, 995, 363, 278, 1209, 2302, 3443, 29936, 881, 367, 7200, 1135, 5225, 23157, 13, 4706, 1583, 29889, 9294, 8824, 29898, 8568, 29918, 726, 29898, 1311, 29889, 485, 737, 29918, 9891, 29918, 2378, 29892, 1583, 29889, 726, 29892, 29871, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 9601, 29900, 1402, 13, 462, 308, 376, 797, 15728, 995, 363, 278, 1209, 2302, 3443, 29936, 881, 367, 7968, 1135, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 23157, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
transport/processing/config.py
zkdev/cc-utils
15
168789
<filename>transport/processing/config.py import typing ACTIONS: typing.List[str] = list() PROCESSING_CFG = 'transport.yaml' RESOURCES_DIR = 'resources' TAR_FILE = 'resources.tar' DRY_RUN = False
[ 1, 529, 9507, 29958, 27882, 29914, 19170, 29914, 2917, 29889, 2272, 13, 5215, 19229, 13, 13, 24705, 29903, 29901, 19229, 29889, 1293, 29961, 710, 29962, 353, 1051, 580, 13, 8618, 23524, 4214, 29918, 9207, 29954, 353, 525, 27882, 29889, 25162, 29915, 13, 1525, 27839, 27266, 29918, 9464, 353, 525, 13237, 29915, 13, 29911, 1718, 29918, 7724, 353, 525, 13237, 29889, 12637, 29915, 13, 8353, 29979, 29918, 29934, 3904, 353, 7700, 13, 2 ]
cloudmesh/pi/grove_air_quality_sensor.py
cloudmesh/cloudmesh.pi
2
109286
import time import grovepi class GroveAirQualitySensor: def __init__(self, pin = 0): """ connect to an analog pin to get input, pin A0 by default """ self.air_sensor = pin grovepi.pinMode(self.air_sensor,"INPUT") def get(self): """ return the analog value of air quality recieved. less value means fresher air """ value = grovepi.analogRead(self.air_sensor) return value if __name__ == "__main__": air_quality_sensor = GroveAirQualitySensor() while True: value = air_quality_sensor.get() print "sensor value = ", value time.sleep(0.5)
[ 1, 1053, 931, 13, 5215, 4071, 345, 1631, 13, 13, 1990, 6070, 345, 29909, 381, 24399, 537, 29903, 6073, 29901, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 12534, 353, 29871, 29900, 1125, 13, 12, 12, 15945, 29908, 13, 12, 12, 6915, 304, 385, 15690, 12534, 304, 679, 1881, 29892, 12534, 319, 29900, 491, 2322, 13, 12, 12, 15945, 29908, 13, 12, 12, 1311, 29889, 1466, 29918, 29879, 6073, 353, 12534, 13, 12, 12, 17170, 345, 1631, 29889, 12687, 6818, 29898, 1311, 29889, 1466, 29918, 29879, 6073, 1699, 1177, 12336, 1159, 13, 12, 1753, 679, 29898, 1311, 1125, 13, 12, 12, 15945, 29908, 13, 12, 12, 2457, 29871, 278, 15690, 995, 310, 4799, 11029, 1162, 6402, 29889, 13, 12, 12, 2222, 995, 2794, 29595, 2276, 4799, 13, 12, 12, 15945, 29908, 13, 12, 12, 1767, 353, 4071, 345, 1631, 29889, 7054, 468, 6359, 29898, 1311, 29889, 1466, 29918, 29879, 6073, 29897, 13, 12, 12, 2457, 995, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 12, 1466, 29918, 29567, 29918, 29879, 6073, 353, 6070, 345, 29909, 381, 24399, 537, 29903, 6073, 580, 13, 12, 8000, 5852, 29901, 13, 12, 12, 1767, 353, 4799, 29918, 29567, 29918, 29879, 6073, 29889, 657, 580, 13, 12, 12, 2158, 376, 29879, 6073, 995, 353, 9162, 995, 13, 12, 12, 2230, 29889, 17059, 29898, 29900, 29889, 29945, 29897, 13, 2 ]
ptpy/transports/usb.py
komodo108/sequoia-ptpy
0
29952
<filename>ptpy/transports/usb.py '''This module implements the USB transport layer for PTP. It exports the PTPUSB class. Both the transport layer and the basic PTP implementation are Vendor agnostic. Vendor extensions should extend these to support more operations. ''' from __future__ import absolute_import import atexit import logging import usb.core import six import array from usb.util import ( endpoint_type, endpoint_direction, ENDPOINT_TYPE_BULK, ENDPOINT_TYPE_INTR, ENDPOINT_OUT, ENDPOINT_IN, ) from ..ptp import PTPError from ..util import _main_thread_alive from construct import ( Bytes, Container, Embedded, Enum, ExprAdapter, Int16ul, Int32ul, Pass, Range, Struct, ) from threading import Thread, Event, RLock from six.moves.queue import Queue from hexdump import hexdump logger = logging.getLogger(__name__) __all__ = ('USBTransport', 'find_usb_cameras') __author__ = '<NAME>' PTP_USB_CLASS = 6 class find_class(object): def __init__(self, class_, name=None): self._class = class_ self._name = name def __call__(self, device): if device.bDeviceClass == self._class: return ( self._name in usb.util.get_string(device, device.iProduct) if self._name else True ) for cfg in device: intf = usb.util.find_descriptor( cfg, bInterfaceClass=self._class ) if intf is not None: return ( self._name in usb.util.get_string(device, device.iProduct) if self._name else True ) return False def find_usb_cameras(name=None): return usb.core.find( find_all=True, custom_match=find_class(PTP_USB_CLASS, name=name) ) class USBTransport(object): '''Implement USB transport.''' def __init__(self, *args, **kwargs): device = kwargs.get('device', None) '''Instantiate the first available PTP device over USB''' logger.debug('Init USB') self.__setup_constructors() # If no device is specified, find all devices claiming to be Cameras # and get the USB endpoints for the first one that works. if device is None: logger.debug('No device provided, probing all USB devices.') if isinstance(device, six.string_types): name = device logger.debug( 'Device name provided, probing all USB devices for {}.' .format(name) ) device = None else: name = None devs = ( [device] if (device is not None) else find_usb_cameras(name=name) ) self.__claimed = False self.__acquire_camera(devs) self.__event_queue = Queue() self.__event_shutdown = Event() # Locks for different end points. self.__inep_lock = RLock() self.__intep_lock = RLock() self.__outep_lock = RLock() # Slightly redundant transaction lock to avoid catching other request's # response self.__transaction_lock = RLock() self.__event_proc = Thread( name='EvtPolling', target=self.__poll_events ) self.__event_proc.daemon = False atexit.register(self._shutdown) self.__event_proc.start() def __available_cameras(self, devs): for dev in devs: if self.__setup_device(dev): logger.debug('Found USB PTP device {}'.format(dev)) yield else: message = 'No USB PTP device found.' logger.error(message) raise PTPError(message) def __acquire_camera(self, devs): '''From the cameras given, get the first one that does not fail''' for _ in self.__available_cameras(devs): # Stop system drivers try: if self.__dev.is_kernel_driver_active( self.__intf.bInterfaceNumber): try: self.__dev.detach_kernel_driver( self.__intf.bInterfaceNumber) except usb.core.USBError: message = ( 'Could not detach kernel driver. ' 'Maybe the camera is mounted?' ) logger.error(message) except NotImplementedError as e: logger.debug('Ignoring unimplemented function: {}'.format(e)) # Claim camera try: logger.debug('Claiming {}'.format(repr(self.__dev))) usb.util.claim_interface(self.__dev, self.__intf) self.__claimed = True except Exception as e: logger.warn('Failed to claim PTP device: {}'.format(e)) continue self.__dev.reset() break else: message = ( 'Could not acquire any camera.' ) logger.error(message) raise PTPError(message) def _shutdown(self): logger.debug('Shutdown request') self.__event_shutdown.set() # Free USB resource on shutdown. # Only join a running thread. if self.__event_proc.is_alive(): self.__event_proc.join(2) try: if self.__claimed: logger.debug('Release {}'.format(repr(self.__dev))) usb.util.release_interface(self.__dev, self.__intf) except Exception as e: logger.warn(e) # Helper methods. # --------------------- def __setup_device(self, dev): '''Get endpoints for a device. True on success.''' self.__inep = None self.__outep = None self.__intep = None self.__cfg = None self.__dev = None self.__intf = None # Attempt to find the USB in, out and interrupt endpoints for a PTP # interface. for cfg in dev: for intf in cfg: if intf.bInterfaceClass == PTP_USB_CLASS: for ep in intf: ep_type = endpoint_type(ep.bmAttributes) ep_dir = endpoint_direction(ep.bEndpointAddress) if ep_type == ENDPOINT_TYPE_BULK: if ep_dir == ENDPOINT_IN: self.__inep = ep elif ep_dir == ENDPOINT_OUT: self.__outep = ep elif ((ep_type == ENDPOINT_TYPE_INTR) and (ep_dir == ENDPOINT_IN)): self.__intep = ep if not (self.__inep and self.__outep and self.__intep): self.__inep = None self.__outep = None self.__intep = None else: logger.debug('Found {}'.format(repr(self.__inep))) logger.debug('Found {}'.format(repr(self.__outep))) logger.debug('Found {}'.format(repr(self.__intep))) self.__cfg = cfg self.__dev = dev self.__intf = intf return True return False def __setup_constructors(self): '''Set endianness and create transport-specific constructors.''' # Set endianness of constructors before using them. self._set_endian('little') self.__Length = Int32ul self.__Type = Enum( Int16ul, default=Pass, Undefined=0x0000, Command=0x0001, Data=0x0002, Response=0x0003, Event=0x0004, ) # This is just a convenience constructor to get the size of a header. self.__Code = Int16ul self.__Header = Struct( 'Length' / self.__Length, 'Type' / self.__Type, 'Code' / self.__Code, 'TransactionID' / self._TransactionID, ) # These are the actual constructors for parsing and building. self.__CommandHeader = Struct( 'Length' / self.__Length, 'Type' / self.__Type, 'OperationCode' / self._OperationCode, 'TransactionID' / self._TransactionID, ) self.__ResponseHeader = Struct( 'Length' / self.__Length, 'Type' / self.__Type, 'ResponseCode' / self._ResponseCode, 'TransactionID' / self._TransactionID, ) self.__EventHeader = Struct( 'Length' / self.__Length, 'Type' / self.__Type, 'EventCode' / self._EventCode, 'TransactionID' / self._TransactionID, ) # Apparently nobody uses the SessionID field. Even though it is # specified in ISO15740:2013(E), no device respects it and the session # number is implicit over USB. self.__Param = Range(0, 5, self._Parameter) self.__CommandTransactionBase = Struct( Embedded(self.__CommandHeader), 'Payload' / Bytes( lambda ctx, h=self.__Header: ctx.Length - h.sizeof() ) ) self.__CommandTransaction = ExprAdapter( self.__CommandTransactionBase, encoder=lambda obj, ctx, h=self.__Header: Container( Length=len(obj.Payload) + h.sizeof(), **obj ), decoder=lambda obj, ctx: obj, ) self.__ResponseTransactionBase = Struct( Embedded(self.__ResponseHeader), 'Payload' / Bytes( lambda ctx, h=self.__Header: ctx.Length - h.sizeof()) ) self.__ResponseTransaction = ExprAdapter( self.__ResponseTransactionBase, encoder=lambda obj, ctx, h=self.__Header: Container( Length=len(obj.Payload) + h.sizeof(), **obj ), decoder=lambda obj, ctx: obj, ) def __parse_response(self, usbdata): '''Helper method for parsing USB data.''' # Build up container with all PTP info. logger.debug('Transaction:') usbdata = bytearray(usbdata) if logger.isEnabledFor(logging.DEBUG): for l in hexdump( six.binary_type(usbdata[:512]), result='generator' ): logger.debug(l) transaction = self.__ResponseTransaction.parse(usbdata) response = Container( SessionID=self.session_id, TransactionID=transaction.TransactionID, ) logger.debug('Interpreting {} transaction'.format(transaction.Type)) if transaction.Type == 'Response': response['ResponseCode'] = transaction.ResponseCode response['Parameter'] = self.__Param.parse(transaction.Payload) elif transaction.Type == 'Event': event = self.__EventHeader.parse( usbdata[0:self.__Header.sizeof()] ) response['EventCode'] = event.EventCode response['Parameter'] = self.__Param.parse(transaction.Payload) else: command = self.__CommandHeader.parse( usbdata[0:self.__Header.sizeof()] ) response['OperationCode'] = command.OperationCode response['Data'] = transaction.Payload return response def __recv(self, event=False, wait=False, raw=False): '''Helper method for receiving data.''' # TODO: clear stalls automatically ep = self.__intep if event else self.__inep lock = self.__intep_lock if event else self.__inep_lock usbdata = array.array('B', []) with lock: tries = 0 # Attempt to read a header while len(usbdata) < self.__Header.sizeof() and tries < 5: if tries > 0: logger.debug('Data smaller than a header') logger.debug( 'Requesting {} bytes of data' .format(ep.wMaxPacketSize) ) try: usbdata += ep.read( ep.wMaxPacketSize ) except usb.core.USBError as e: # Return None on timeout or busy for events if ( (e.errno is None and ('timeout' in e.strerror.decode() or 'busy' in e.strerror.decode())) or (e.errno == 110 or e.errno == 16 or e.errno == 5) ): if event: return None else: logger.warning('Ignored exception: {}'.format(e)) else: logger.error(e) raise e tries += 1 logger.debug('Read {} bytes of data'.format(len(usbdata))) if len(usbdata) == 0: if event: return None else: raise PTPError('Empty USB read') if ( logger.isEnabledFor(logging.DEBUG) and len(usbdata) < self.__Header.sizeof() ): logger.debug('Incomplete header') for l in hexdump( six.binary_type(bytearray(usbdata)), result='generator' ): logger.debug(l) header = self.__ResponseHeader.parse( bytearray(usbdata[0:self.__Header.sizeof()]) ) if header.Type not in ['Response', 'Data', 'Event']: raise PTPError( 'Unexpected USB transfer type. ' 'Expected Response, Event or Data but received {}' .format(header.Type) ) while len(usbdata) < header.Length: usbdata += ep.read( min( header.Length - len(usbdata), # Up to 64kB 64 * 2**10 ) ) if raw: return usbdata else: return self.__parse_response(usbdata) def __send(self, ptp_container, event=False): '''Helper method for sending data.''' ep = self.__intep if event else self.__outep lock = self.__intep_lock if event else self.__outep_lock transaction = self.__CommandTransaction.build(ptp_container) with lock: try: sent = 0 while sent < len(transaction): sent = ep.write( # Up to 64kB transaction[sent:(sent + 64*2**10)] ) except usb.core.USBError as e: # Ignore timeout or busy device once. if ( (e.errno is None and ('timeout' in e.strerror.decode() or 'busy' in e.strerror.decode())) or (e.errno == 110 or e.errno == 16 or e.errno == 5) ): logger.warning('Ignored USBError {}'.format(e.errno)) ep.write(transaction) def __send_request(self, ptp_container): '''Send PTP request without checking answer.''' # Don't modify original container to keep abstraction barrier. ptp = Container(**ptp_container) # Send all parameters #try: # while not ptp.Parameter[-1]: # ptp.Parameter.pop() # if len(ptp.Parameter) == 0: # break #except IndexError: # # The Parameter list is already empty. # pass # Send request ptp['Type'] = 'Command' ptp['Payload'] = self.__Param.build(ptp.Parameter) self.__send(ptp) def __send_data(self, ptp_container, data): '''Send data without checking answer.''' # Don't modify original container to keep abstraction barrier. ptp = Container(**ptp_container) # Send data ptp['Type'] = 'Data' ptp['Payload'] = data self.__send(ptp) @property def _dev(self): return None if self.__event_shutdown.is_set() else self.__dev @_dev.setter def _dev(self, value): raise ValueError('Read-only property') # Actual implementation # --------------------- def send(self, ptp_container, data): '''Transfer operation with dataphase from initiator to responder''' datalen = len(data) logger.debug('SEND {} {} bytes{}'.format( ptp_container.OperationCode, datalen, ' ' + str(list(map(hex, ptp_container.Parameter))) if ptp_container.Parameter else '', )) with self.__transaction_lock: self.__send_request(ptp_container) self.__send_data(ptp_container, data) # Get response and sneak in implicit SessionID and missing # parameters. response = self.__recv() logger.debug('SEND {} {} bytes {}{}'.format( ptp_container.OperationCode, datalen, response.ResponseCode, ' ' + str(list(map(hex, response.Parameter))) if ptp_container.Parameter else '', )) return response def recv(self, ptp_container): '''Transfer operation with dataphase from responder to initiator.''' logger.debug('RECV {}{}'.format( ptp_container.OperationCode, ' ' + str(list(map(hex, ptp_container.Parameter))) if ptp_container.Parameter else '', )) with self.__transaction_lock: self.__send_request(ptp_container) dataphase = self.__recv() if hasattr(dataphase, 'Data'): response = self.__recv() if not (ptp_container.SessionID == dataphase.SessionID == response.SessionID): self.__dev.reset() raise PTPError( 'Dataphase session ID missmatch: {}, {}, {}.' .format( ptp_container.SessionID, dataphase.SessionID, response.SessionID ) ) if not (ptp_container.TransactionID == dataphase.TransactionID == response.TransactionID): self.__dev.reset() raise PTPError( 'Dataphase transaction ID missmatch: {}, {}, {}.' .format( ptp_container.TransactionID, dataphase.TransactionID, response.TransactionID ) ) if not (ptp_container.OperationCode == dataphase.OperationCode): self.__dev.reset() raise PTPError( 'Dataphase operation code missmatch: {}, {}.'. format( ptp_container.OperationCode, dataphase.OperationCode ) ) response['Data'] = dataphase.Data else: response = dataphase logger.debug('RECV {} {}{}{}'.format( ptp_container.OperationCode, response.ResponseCode, ' {} bytes'.format(len(response.Data)) if hasattr(response, 'Data') else '', ' ' + str(list(map(hex, response.Parameter))) if response.Parameter else '', )) return response def mesg(self, ptp_container): '''Transfer operation without dataphase.''' logger.debug('MESG {}{}'.format( ptp_container.OperationCode, ' ' + str(list(map(hex, ptp_container.Parameter))) if ptp_container.Parameter else '', )) with self.__transaction_lock: self.__send_request(ptp_container) # Get response and sneak in implicit SessionID and missing # parameters for FullResponse. response = self.__recv() logger.debug('MESG {} {}{}'.format( ptp_container.OperationCode, response.ResponseCode, ' ' + str(list(map(hex, response.Parameter))) if response.Parameter else '', )) return response def event(self, wait=False): '''Check event. If `wait` this function is blocking. Otherwise it may return None. ''' evt = None usbdata = None if wait: usbdata = self.__event_queue.get(block=True) elif not self.__event_queue.empty(): usbdata = self.__event_queue.get(block=False) if usbdata is not None: evt = self.__parse_response(usbdata) return evt def __poll_events(self): '''Poll events, adding them to a queue.''' while not self.__event_shutdown.is_set() and _main_thread_alive(): try: evt = self.__recv(event=True, wait=False, raw=True) if evt is not None: logger.debug('Event queued') self.__event_queue.put(evt) except usb.core.USBError as e: logger.error( '{} polling exception: {}'.format(repr(self.__dev), e) ) # check if disconnected if e.errno == 19: break except Exception as e: logger.error( '{} polling exception: {}'.format(repr(self.__dev), e) )
[ 1, 529, 9507, 29958, 415, 2272, 29914, 3286, 4011, 29914, 28685, 29889, 2272, 13, 12008, 4013, 3883, 10703, 278, 12951, 8608, 7546, 363, 349, 3557, 29889, 13, 13, 3112, 29586, 278, 349, 3557, 29965, 1744, 770, 29889, 9134, 278, 8608, 7546, 322, 278, 6996, 349, 3557, 13, 21382, 526, 478, 12184, 946, 6582, 293, 29889, 478, 12184, 17752, 881, 10985, 1438, 304, 13, 5924, 901, 6931, 29889, 13, 12008, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 5215, 263, 4776, 277, 13, 5215, 12183, 13, 5215, 502, 29890, 29889, 3221, 13, 5215, 4832, 13, 5215, 1409, 13, 3166, 502, 29890, 29889, 4422, 1053, 313, 13, 1678, 16248, 29918, 1853, 29892, 16248, 29918, 20845, 29892, 11056, 29925, 6992, 29911, 29918, 11116, 29918, 7838, 29931, 29968, 29892, 11056, 29925, 6992, 29911, 29918, 11116, 29918, 1177, 5659, 29892, 13, 1678, 11056, 29925, 6992, 29911, 29918, 12015, 29892, 11056, 29925, 6992, 29911, 29918, 1177, 29892, 13, 29897, 13, 3166, 6317, 415, 29886, 1053, 349, 3557, 2392, 13, 3166, 6317, 4422, 1053, 903, 3396, 29918, 7097, 29918, 284, 573, 13, 3166, 3386, 1053, 313, 13, 1678, 2648, 2167, 29892, 21679, 29892, 2812, 2580, 7176, 29892, 1174, 398, 29892, 1222, 558, 6168, 29892, 3159, 29896, 29953, 352, 29892, 3159, 29941, 29906, 352, 29892, 6978, 29892, 13, 1678, 12146, 29892, 28771, 29892, 13, 29897, 13, 3166, 3244, 292, 1053, 10480, 29892, 6864, 29892, 390, 16542, 13, 3166, 4832, 29889, 13529, 267, 29889, 9990, 1053, 5462, 434, 13, 3166, 15090, 15070, 1053, 15090, 15070, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 1649, 497, 1649, 353, 6702, 29965, 1744, 27395, 742, 525, 2886, 29918, 28685, 29918, 29883, 4183, 294, 1495, 13, 1649, 8921, 1649, 353, 12801, 5813, 16299, 13, 13, 13, 29925, 3557, 29918, 29965, 1744, 29918, 13875, 1799, 353, 29871, 29953, 13, 13, 13, 1990, 1284, 29918, 1990, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 770, 3383, 1024, 29922, 8516, 1125, 13, 4706, 1583, 3032, 1990, 353, 770, 29918, 13, 4706, 1583, 3032, 978, 353, 1024, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 4742, 1125, 13, 4706, 565, 4742, 29889, 29890, 11501, 2385, 1275, 1583, 3032, 1990, 29901, 13, 9651, 736, 313, 13, 18884, 1583, 3032, 978, 297, 502, 29890, 29889, 4422, 29889, 657, 29918, 1807, 29898, 10141, 29892, 4742, 29889, 29875, 7566, 29897, 13, 18884, 565, 1583, 3032, 978, 1683, 5852, 13, 9651, 1723, 13, 4706, 363, 274, 16434, 297, 4742, 29901, 13, 9651, 938, 29888, 353, 502, 29890, 29889, 4422, 29889, 2886, 29918, 2783, 11709, 29898, 13, 18884, 274, 16434, 29892, 13, 18884, 289, 10448, 2385, 29922, 1311, 3032, 1990, 13, 9651, 1723, 13, 9651, 565, 938, 29888, 338, 451, 6213, 29901, 13, 18884, 736, 313, 13, 462, 1678, 1583, 3032, 978, 297, 502, 29890, 29889, 4422, 29889, 657, 29918, 1807, 29898, 10141, 29892, 4742, 29889, 29875, 7566, 29897, 13, 462, 1678, 565, 1583, 3032, 978, 1683, 5852, 13, 18884, 1723, 13, 4706, 736, 7700, 13, 13, 13, 1753, 1284, 29918, 28685, 29918, 29883, 4183, 294, 29898, 978, 29922, 8516, 1125, 13, 4706, 736, 502, 29890, 29889, 3221, 29889, 2886, 29898, 13, 9651, 1284, 29918, 497, 29922, 5574, 29892, 13, 9651, 2888, 29918, 4352, 29922, 2886, 29918, 1990, 29898, 29925, 3557, 29918, 29965, 1744, 29918, 13875, 1799, 29892, 1024, 29922, 978, 29897, 13, 4706, 1723, 13, 13, 13, 1990, 12951, 27395, 29898, 3318, 1125, 13, 1678, 14550, 1888, 2037, 12951, 8608, 29889, 12008, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 4742, 353, 9049, 5085, 29889, 657, 877, 10141, 742, 6213, 29897, 13, 4706, 14550, 3379, 3656, 403, 278, 937, 3625, 349, 3557, 4742, 975, 12951, 12008, 13, 4706, 17927, 29889, 8382, 877, 6644, 12951, 1495, 13, 4706, 1583, 17255, 14669, 29918, 11433, 943, 580, 13, 4706, 396, 960, 694, 4742, 338, 6790, 29892, 1284, 599, 9224, 5995, 292, 304, 367, 20939, 294, 13, 4706, 396, 322, 679, 278, 12951, 1095, 9748, 363, 278, 937, 697, 393, 1736, 29889, 13, 4706, 565, 4742, 338, 6213, 29901, 13, 9651, 17927, 29889, 8382, 877, 3782, 4742, 4944, 29892, 2070, 292, 599, 12951, 9224, 29889, 1495, 13, 4706, 565, 338, 8758, 29898, 10141, 29892, 4832, 29889, 1807, 29918, 8768, 1125, 13, 9651, 1024, 353, 4742, 13, 9651, 17927, 29889, 8382, 29898, 13, 18884, 525, 11501, 1024, 4944, 29892, 2070, 292, 599, 12951, 9224, 363, 426, 1836, 29915, 13, 18884, 869, 4830, 29898, 978, 29897, 13, 9651, 1723, 13, 9651, 4742, 353, 6213, 13, 4706, 1683, 29901, 13, 9651, 1024, 353, 6213, 13, 4706, 2906, 29879, 353, 313, 13, 9651, 518, 10141, 29962, 565, 313, 10141, 338, 451, 6213, 29897, 13, 9651, 1683, 1284, 29918, 28685, 29918, 29883, 4183, 294, 29898, 978, 29922, 978, 29897, 13, 4706, 1723, 13, 4706, 1583, 17255, 29883, 13190, 353, 7700, 13, 4706, 1583, 17255, 562, 1548, 29918, 26065, 29898, 3359, 29879, 29897, 13, 13, 4706, 1583, 17255, 3696, 29918, 9990, 353, 5462, 434, 580, 13, 4706, 1583, 17255, 3696, 29918, 845, 329, 3204, 353, 6864, 580, 13, 4706, 396, 18199, 29879, 363, 1422, 1095, 3291, 29889, 13, 4706, 1583, 17255, 457, 29886, 29918, 908, 353, 390, 16542, 580, 13, 4706, 1583, 17255, 6693, 29886, 29918, 908, 353, 390, 16542, 580, 13, 4706, 1583, 17255, 2663, 29886, 29918, 908, 353, 390, 16542, 580, 13, 4706, 396, 317, 4366, 368, 28005, 10804, 7714, 304, 4772, 4380, 292, 916, 2009, 29915, 29879, 13, 4706, 396, 2933, 13, 4706, 1583, 17255, 20736, 29918, 908, 353, 390, 16542, 580, 13, 13, 4706, 1583, 17255, 3696, 29918, 15439, 353, 10480, 29898, 13, 9651, 1024, 2433, 29923, 21908, 7713, 1847, 742, 13, 9651, 3646, 29922, 1311, 17255, 29886, 3028, 29918, 13604, 13, 4706, 1723, 13, 4706, 1583, 17255, 3696, 29918, 15439, 29889, 1388, 9857, 353, 7700, 13, 4706, 263, 4776, 277, 29889, 9573, 29898, 1311, 3032, 845, 329, 3204, 29897, 13, 4706, 1583, 17255, 3696, 29918, 15439, 29889, 2962, 580, 13, 13, 1678, 822, 4770, 16515, 29918, 29883, 4183, 294, 29898, 1311, 29892, 2906, 29879, 1125, 13, 4706, 363, 2906, 297, 2906, 29879, 29901, 13, 9651, 565, 1583, 17255, 14669, 29918, 10141, 29898, 3359, 1125, 13, 18884, 17927, 29889, 8382, 877, 9692, 12951, 349, 3557, 4742, 6571, 4286, 4830, 29898, 3359, 876, 13, 18884, 7709, 13, 4706, 1683, 29901, 13, 9651, 2643, 353, 525, 3782, 12951, 349, 3557, 4742, 1476, 6169, 13, 9651, 17927, 29889, 2704, 29898, 4906, 29897, 13, 9651, 12020, 349, 3557, 2392, 29898, 4906, 29897, 13, 13, 1678, 822, 4770, 562, 1548, 29918, 26065, 29898, 1311, 29892, 2906, 29879, 1125, 13, 4706, 14550, 4591, 278, 3949, 18464, 2183, 29892, 679, 278, 937, 697, 393, 947, 451, 4418, 12008, 13, 13, 4706, 363, 903, 297, 1583, 17255, 16515, 29918, 29883, 4183, 294, 29898, 3359, 29879, 1125, 13, 9651, 396, 22303, 1788, 18563, 13, 9651, 1018, 29901, 13, 18884, 565, 1583, 17255, 3359, 29889, 275, 29918, 17460, 29918, 9465, 29918, 4925, 29898, 13, 462, 4706, 1583, 17255, 524, 29888, 29889, 29890, 10448, 4557, 1125, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 1583, 17255, 3359, 29889, 4801, 496, 29918, 17460, 29918, 9465, 29898, 13, 462, 9651, 1583, 17255, 524, 29888, 29889, 29890, 10448, 4557, 29897, 13, 462, 1678, 5174, 502, 29890, 29889, 3221, 29889, 29965, 1744, 2392, 29901, 13, 462, 4706, 2643, 353, 313, 13, 462, 9651, 525, 23323, 451, 1439, 496, 8466, 7156, 29889, 525, 13, 462, 9651, 525, 22762, 278, 10656, 338, 19239, 17901, 13, 462, 4706, 1723, 13, 462, 4706, 17927, 29889, 2704, 29898, 4906, 29897, 13, 9651, 5174, 2216, 1888, 2037, 287, 2392, 408, 321, 29901, 13, 18884, 17927, 29889, 8382, 877, 17273, 8253, 443, 326, 2037, 287, 740, 29901, 6571, 4286, 4830, 29898, 29872, 876, 13, 9651, 396, 6015, 326, 10656, 13, 9651, 1018, 29901, 13, 18884, 17927, 29889, 8382, 877, 29907, 8342, 292, 6571, 4286, 4830, 29898, 276, 558, 29898, 1311, 17255, 3359, 4961, 13, 18884, 502, 29890, 29889, 4422, 29889, 29883, 8342, 29918, 13248, 29898, 1311, 17255, 3359, 29892, 1583, 17255, 524, 29888, 29897, 13, 18884, 1583, 17255, 29883, 13190, 353, 5852, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 17927, 29889, 25442, 877, 17776, 304, 5995, 349, 3557, 4742, 29901, 6571, 4286, 4830, 29898, 29872, 876, 13, 18884, 6773, 13, 9651, 1583, 17255, 3359, 29889, 12071, 580, 13, 9651, 2867, 13, 4706, 1683, 29901, 13, 9651, 2643, 353, 313, 13, 18884, 525, 23323, 451, 1274, 1548, 738, 10656, 6169, 13, 9651, 1723, 13, 9651, 17927, 29889, 2704, 29898, 4906, 29897, 13, 9651, 12020, 349, 3557, 2392, 29898, 4906, 29897, 13, 13, 1678, 822, 903, 845, 329, 3204, 29898, 1311, 1125, 13, 4706, 17927, 29889, 8382, 877, 2713, 329, 3204, 2009, 1495, 13, 4706, 1583, 17255, 3696, 29918, 845, 329, 3204, 29889, 842, 580, 13, 4706, 396, 12362, 12951, 6503, 373, 12522, 3204, 29889, 13, 13, 4706, 396, 9333, 5988, 263, 2734, 3244, 29889, 13, 4706, 565, 1583, 17255, 3696, 29918, 15439, 29889, 275, 29918, 284, 573, 7295, 13, 9651, 1583, 17255, 3696, 29918, 15439, 29889, 7122, 29898, 29906, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 17255, 29883, 13190, 29901, 13, 18884, 17927, 29889, 8382, 877, 19729, 6571, 4286, 4830, 29898, 276, 558, 29898, 1311, 17255, 3359, 4961, 13, 18884, 502, 29890, 29889, 4422, 29889, 14096, 29918, 13248, 29898, 1311, 17255, 3359, 29892, 1583, 17255, 524, 29888, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 17927, 29889, 25442, 29898, 29872, 29897, 13, 13, 1678, 396, 6162, 546, 3519, 29889, 13, 1678, 396, 448, 2683, 807, 13, 1678, 822, 4770, 14669, 29918, 10141, 29898, 1311, 29892, 2906, 1125, 13, 4706, 14550, 2577, 1095, 9748, 363, 263, 4742, 29889, 5852, 373, 2551, 29889, 12008, 13, 4706, 1583, 17255, 457, 29886, 353, 6213, 13, 4706, 1583, 17255, 2663, 29886, 353, 6213, 13, 4706, 1583, 17255, 6693, 29886, 353, 6213, 13, 4706, 1583, 17255, 16859, 353, 6213, 13, 4706, 1583, 17255, 3359, 353, 6213, 13, 4706, 1583, 17255, 524, 29888, 353, 6213, 13, 4706, 396, 6212, 3456, 304, 1284, 278, 12951, 297, 29892, 714, 322, 23754, 1095, 9748, 363, 263, 349, 3557, 13, 4706, 396, 5067, 29889, 13, 4706, 363, 274, 16434, 297, 2906, 29901, 13, 9651, 363, 938, 29888, 297, 274, 16434, 29901, 13, 18884, 565, 938, 29888, 29889, 29890, 10448, 2385, 1275, 349, 3557, 29918, 29965, 1744, 29918, 13875, 1799, 29901, 13, 462, 1678, 363, 9358, 297, 938, 29888, 29901, 13, 462, 4706, 9358, 29918, 1853, 353, 16248, 29918, 1853, 29898, 1022, 29889, 5838, 15801, 29897, 13, 462, 4706, 9358, 29918, 3972, 353, 16248, 29918, 20845, 29898, 1022, 29889, 29890, 25602, 7061, 29897, 13, 462, 4706, 565, 9358, 29918, 1853, 1275, 11056, 29925, 6992, 29911, 29918, 11116, 29918, 7838, 29931, 29968, 29901, 13, 462, 9651, 565, 9358, 29918, 3972, 1275, 11056, 29925, 6992, 29911, 29918, 1177, 29901, 13, 462, 18884, 1583, 17255, 457, 29886, 353, 9358, 13, 462, 9651, 25342, 9358, 29918, 3972, 1275, 11056, 29925, 6992, 29911, 29918, 12015, 29901, 13, 462, 18884, 1583, 17255, 2663, 29886, 353, 9358, 13, 462, 4706, 25342, 5135, 1022, 29918, 1853, 1275, 11056, 29925, 6992, 29911, 29918, 11116, 29918, 1177, 5659, 29897, 322, 13, 462, 18884, 313, 1022, 29918, 3972, 1275, 11056, 29925, 6992, 29911, 29918, 1177, 22164, 13, 462, 9651, 1583, 17255, 6693, 29886, 353, 9358, 13, 18884, 565, 451, 313, 1311, 17255, 457, 29886, 322, 1583, 17255, 2663, 29886, 322, 1583, 17255, 6693, 29886, 1125, 13, 462, 1678, 1583, 17255, 457, 29886, 353, 6213, 13, 462, 1678, 1583, 17255, 2663, 29886, 353, 6213, 13, 462, 1678, 1583, 17255, 6693, 29886, 353, 6213, 13, 18884, 1683, 29901, 13, 462, 1678, 17927, 29889, 8382, 877, 9692, 6571, 4286, 4830, 29898, 276, 558, 29898, 1311, 17255, 457, 29886, 4961, 13, 462, 1678, 17927, 29889, 8382, 877, 9692, 6571, 4286, 4830, 29898, 276, 558, 29898, 1311, 17255, 2663, 29886, 4961, 13, 462, 1678, 17927, 29889, 8382, 877, 9692, 6571, 4286, 4830, 29898, 276, 558, 29898, 1311, 17255, 6693, 29886, 4961, 13, 462, 1678, 1583, 17255, 16859, 353, 274, 16434, 13, 462, 1678, 1583, 17255, 3359, 353, 2906, 13, 462, 1678, 1583, 17255, 524, 29888, 353, 938, 29888, 13, 462, 1678, 736, 5852, 13, 4706, 736, 7700, 13, 13, 1678, 822, 4770, 14669, 29918, 11433, 943, 29898, 1311, 1125, 13, 4706, 14550, 2697, 1095, 713, 2264, 322, 1653, 8608, 29899, 14940, 3386, 943, 29889, 12008, 13, 4706, 396, 3789, 1095, 713, 2264, 310, 3386, 943, 1434, 773, 963, 29889, 13, 4706, 1583, 3032, 842, 29918, 355, 713, 877, 29880, 1992, 1495, 13, 13, 4706, 1583, 17255, 6513, 353, 3159, 29941, 29906, 352, 13, 4706, 1583, 17255, 1542, 353, 1174, 398, 29898, 13, 18884, 3159, 29896, 29953, 352, 29892, 13, 18884, 2322, 29922, 7129, 29892, 13, 18884, 14211, 5598, 29922, 29900, 29916, 29900, 29900, 29900, 29900, 29892, 13, 18884, 10516, 29922, 29900, 29916, 29900, 29900, 29900, 29896, 29892, 13, 18884, 3630, 29922, 29900, 29916, 29900, 29900, 29900, 29906, 29892, 13, 18884, 13291, 29922, 29900, 29916, 29900, 29900, 29900, 29941, 29892, 13, 18884, 6864, 29922, 29900, 29916, 29900, 29900, 29900, 29946, 29892, 13, 18884, 1723, 13, 4706, 396, 910, 338, 925, 263, 29703, 5823, 304, 679, 278, 2159, 310, 263, 4839, 29889, 13, 4706, 1583, 17255, 3399, 353, 3159, 29896, 29953, 352, 13, 4706, 1583, 17255, 7850, 353, 28771, 29898, 13, 18884, 525, 6513, 29915, 847, 1583, 17255, 6513, 29892, 13, 18884, 525, 1542, 29915, 847, 1583, 17255, 1542, 29892, 13, 18884, 525, 3399, 29915, 847, 1583, 17255, 3399, 29892, 13, 18884, 525, 12460, 1367, 29915, 847, 1583, 3032, 12460, 1367, 29892, 13, 18884, 1723, 13, 4706, 396, 4525, 526, 278, 3935, 3386, 943, 363, 13755, 322, 5214, 29889, 13, 4706, 1583, 17255, 6255, 7850, 353, 28771, 29898, 13, 18884, 525, 6513, 29915, 847, 1583, 17255, 6513, 29892, 13, 18884, 525, 1542, 29915, 847, 1583, 17255, 1542, 29892, 13, 18884, 525, 10925, 3399, 29915, 847, 1583, 3032, 10925, 3399, 29892, 13, 18884, 525, 12460, 1367, 29915, 847, 1583, 3032, 12460, 1367, 29892, 13, 18884, 1723, 13, 4706, 1583, 17255, 5103, 7850, 353, 28771, 29898, 13, 18884, 525, 6513, 29915, 847, 1583, 17255, 6513, 29892, 13, 18884, 525, 1542, 29915, 847, 1583, 17255, 1542, 29892, 13, 18884, 525, 5103, 3399, 29915, 847, 1583, 3032, 5103, 3399, 29892, 13, 18884, 525, 12460, 1367, 29915, 847, 1583, 3032, 12460, 1367, 29892, 13, 18884, 1723, 13, 4706, 1583, 17255, 2624, 7850, 353, 28771, 29898, 13, 18884, 525, 6513, 29915, 847, 1583, 17255, 6513, 29892, 13, 18884, 525, 1542, 29915, 847, 1583, 17255, 1542, 29892, 13, 18884, 525, 2624, 3399, 29915, 847, 1583, 3032, 2624, 3399, 29892, 13, 18884, 525, 12460, 1367, 29915, 847, 1583, 3032, 12460, 1367, 29892, 13, 18884, 1723, 13, 4706, 396, 27466, 2705, 23196, 3913, 278, 16441, 1367, 1746, 29889, 7753, 2466, 372, 338, 13, 4706, 396, 6790, 297, 17723, 29896, 29945, 29955, 29946, 29900, 29901, 29906, 29900, 29896, 29941, 29898, 29923, 511, 694, 4742, 3390, 29879, 372, 322, 278, 4867, 13, 4706, 396, 1353, 338, 12235, 975, 12951, 29889, 13, 4706, 1583, 17255, 4736, 353, 12146, 29898, 29900, 29892, 29871, 29945, 29892, 1583, 3032, 9329, 29897, 13, 4706, 1583, 17255, 6255, 12460, 5160, 353, 28771, 29898, 13, 18884, 2812, 2580, 7176, 29898, 1311, 17255, 6255, 7850, 511, 13, 18884, 525, 15467, 1359, 29915, 847, 2648, 2167, 29898, 13, 462, 1678, 14013, 12893, 29892, 298, 29922, 1311, 17255, 7850, 29901, 12893, 29889, 6513, 448, 298, 29889, 17921, 580, 13, 18884, 1723, 13, 4706, 1723, 13, 4706, 1583, 17255, 6255, 12460, 353, 1222, 558, 6168, 29898, 13, 18884, 1583, 17255, 6255, 12460, 5160, 29892, 13, 18884, 2094, 6119, 29922, 2892, 5446, 29892, 12893, 29892, 298, 29922, 1311, 17255, 7850, 29901, 21679, 29898, 13, 462, 1678, 365, 1477, 29922, 2435, 29898, 5415, 29889, 15467, 1359, 29897, 718, 298, 29889, 17921, 3285, 13, 462, 1678, 3579, 5415, 13, 462, 1678, 10353, 13, 18884, 1602, 6119, 29922, 2892, 5446, 29892, 12893, 29901, 5446, 29892, 13, 18884, 1723, 13, 4706, 1583, 17255, 5103, 12460, 5160, 353, 28771, 29898, 13, 18884, 2812, 2580, 7176, 29898, 1311, 17255, 5103, 7850, 511, 13, 18884, 525, 15467, 1359, 29915, 847, 2648, 2167, 29898, 13, 462, 1678, 14013, 12893, 29892, 298, 29922, 1311, 17255, 7850, 29901, 12893, 29889, 6513, 448, 298, 29889, 17921, 3101, 13, 18884, 1723, 13, 4706, 1583, 17255, 5103, 12460, 353, 1222, 558, 6168, 29898, 13, 18884, 1583, 17255, 5103, 12460, 5160, 29892, 13, 18884, 2094, 6119, 29922, 2892, 5446, 29892, 12893, 29892, 298, 29922, 1311, 17255, 7850, 29901, 21679, 29898, 13, 462, 1678, 365, 1477, 29922, 2435, 29898, 5415, 29889, 15467, 1359, 29897, 718, 298, 29889, 17921, 3285, 13, 462, 1678, 3579, 5415, 13, 462, 1678, 10353, 13, 18884, 1602, 6119, 29922, 2892, 5446, 29892, 12893, 29901, 5446, 29892, 13, 18884, 1723, 13, 13, 1678, 822, 4770, 5510, 29918, 5327, 29898, 1311, 29892, 502, 29890, 1272, 1125, 13, 4706, 14550, 10739, 1158, 363, 13755, 12951, 848, 29889, 12008, 13, 4706, 396, 8878, 701, 5639, 411, 599, 349, 3557, 5235, 29889, 13, 4706, 17927, 29889, 8382, 877, 12460, 29901, 1495, 13, 4706, 502, 29890, 1272, 353, 7023, 2378, 29898, 28685, 1272, 29897, 13, 4706, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 9651, 363, 301, 297, 15090, 15070, 29898, 13, 462, 1678, 4832, 29889, 19541, 29918, 1853, 29898, 28685, 1272, 7503, 29945, 29896, 29906, 11724, 13, 462, 1678, 1121, 2433, 27959, 29915, 13, 632, 1125, 13, 18884, 17927, 29889, 8382, 29898, 29880, 29897, 13, 4706, 10804, 353, 1583, 17255, 5103, 12460, 29889, 5510, 29898, 28685, 1272, 29897, 13, 4706, 2933, 353, 21679, 29898, 13, 9651, 16441, 1367, 29922, 1311, 29889, 7924, 29918, 333, 29892, 13, 9651, 4103, 2467, 1367, 29922, 20736, 29889, 12460, 1367, 29892, 13, 4706, 1723, 13, 4706, 17927, 29889, 8382, 877, 4074, 1457, 1259, 6571, 10804, 4286, 4830, 29898, 20736, 29889, 1542, 876, 13, 4706, 565, 10804, 29889, 1542, 1275, 525, 5103, 2396, 13, 9651, 2933, 1839, 5103, 3399, 2033, 353, 10804, 29889, 5103, 3399, 13, 9651, 2933, 1839, 9329, 2033, 353, 1583, 17255, 4736, 29889, 5510, 29898, 20736, 29889, 15467, 1359, 29897, 13, 4706, 25342, 10804, 29889, 1542, 1275, 525, 2624, 2396, 13, 9651, 1741, 353, 1583, 17255, 2624, 7850, 29889, 5510, 29898, 13, 18884, 502, 29890, 1272, 29961, 29900, 29901, 1311, 17255, 7850, 29889, 17921, 580, 29962, 13, 9651, 1723, 13, 9651, 2933, 1839, 2624, 3399, 2033, 353, 1741, 29889, 2624, 3399, 13, 9651, 2933, 1839, 9329, 2033, 353, 1583, 17255, 4736, 29889, 5510, 29898, 20736, 29889, 15467, 1359, 29897, 13, 4706, 1683, 29901, 13, 9651, 1899, 353, 1583, 17255, 6255, 7850, 29889, 5510, 29898, 13, 18884, 502, 29890, 1272, 29961, 29900, 29901, 1311, 17255, 7850, 29889, 17921, 580, 29962, 13, 9651, 1723, 13, 9651, 2933, 1839, 10925, 3399, 2033, 353, 1899, 29889, 10925, 3399, 13, 9651, 2933, 1839, 1469, 2033, 353, 10804, 29889, 15467, 1359, 13, 4706, 736, 2933, 13, 13, 1678, 822, 4770, 3757, 29894, 29898, 1311, 29892, 1741, 29922, 8824, 29892, 4480, 29922, 8824, 29892, 10650, 29922, 8824, 1125, 13, 4706, 14550, 10739, 1158, 363, 13442, 848, 29889, 12008, 13, 4706, 396, 14402, 29901, 2821, 380, 4293, 6336, 13, 4706, 9358, 353, 1583, 17255, 6693, 29886, 565, 1741, 1683, 1583, 17255, 457, 29886, 13, 4706, 7714, 353, 1583, 17255, 6693, 29886, 29918, 908, 565, 1741, 1683, 1583, 17255, 457, 29886, 29918, 908, 13, 4706, 502, 29890, 1272, 353, 1409, 29889, 2378, 877, 29933, 742, 518, 2314, 13, 4706, 411, 7714, 29901, 13, 9651, 14335, 353, 29871, 29900, 13, 9651, 396, 6212, 3456, 304, 1303, 263, 4839, 13, 9651, 1550, 7431, 29898, 28685, 1272, 29897, 529, 1583, 17255, 7850, 29889, 17921, 580, 322, 14335, 529, 29871, 29945, 29901, 13, 18884, 565, 14335, 1405, 29871, 29900, 29901, 13, 462, 1678, 17927, 29889, 8382, 877, 1469, 7968, 1135, 263, 4839, 1495, 13, 462, 1678, 17927, 29889, 8382, 29898, 13, 462, 4706, 525, 3089, 292, 6571, 6262, 310, 848, 29915, 13, 462, 4706, 869, 4830, 29898, 1022, 29889, 29893, 7976, 16638, 300, 3505, 29897, 13, 462, 1678, 1723, 13, 18884, 1018, 29901, 13, 462, 1678, 502, 29890, 1272, 4619, 9358, 29889, 949, 29898, 13, 462, 4706, 9358, 29889, 29893, 7976, 16638, 300, 3505, 13, 462, 1678, 1723, 13, 18884, 5174, 502, 29890, 29889, 3221, 29889, 29965, 1744, 2392, 408, 321, 29901, 13, 462, 1678, 396, 7106, 6213, 373, 11815, 470, 19587, 363, 4959, 13, 462, 1678, 565, 313, 13, 462, 9651, 313, 29872, 29889, 3127, 1217, 338, 6213, 322, 13, 462, 632, 6702, 15619, 29915, 297, 321, 29889, 710, 2704, 29889, 13808, 580, 470, 13, 462, 795, 525, 8262, 29891, 29915, 297, 321, 29889, 710, 2704, 29889, 13808, 22130, 470, 13, 462, 9651, 313, 29872, 29889, 3127, 1217, 1275, 29871, 29896, 29896, 29900, 470, 321, 29889, 3127, 1217, 1275, 29871, 29896, 29953, 470, 321, 29889, 3127, 1217, 1275, 29871, 29945, 29897, 13, 462, 268, 1125, 13, 462, 4706, 565, 1741, 29901, 13, 462, 9651, 736, 6213, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 17927, 29889, 27392, 877, 17273, 4395, 3682, 29901, 6571, 4286, 4830, 29898, 29872, 876, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 17927, 29889, 2704, 29898, 29872, 29897, 13, 462, 4706, 12020, 321, 13, 18884, 14335, 4619, 29871, 29896, 13, 9651, 17927, 29889, 8382, 877, 6359, 6571, 6262, 310, 848, 4286, 4830, 29898, 2435, 29898, 28685, 1272, 4961, 13, 13, 9651, 565, 7431, 29898, 28685, 1272, 29897, 1275, 29871, 29900, 29901, 13, 18884, 565, 1741, 29901, 13, 462, 1678, 736, 6213, 13, 18884, 1683, 29901, 13, 462, 1678, 12020, 349, 3557, 2392, 877, 8915, 12951, 1303, 1495, 13, 13, 9651, 565, 313, 13, 462, 1678, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 29897, 322, 13, 462, 1678, 7431, 29898, 28685, 1272, 29897, 529, 1583, 17255, 7850, 29889, 17921, 580, 13, 632, 1125, 13, 18884, 17927, 29889, 8382, 877, 797, 8835, 4839, 1495, 13, 18884, 363, 301, 297, 15090, 15070, 29898, 13, 462, 4706, 4832, 29889, 19541, 29918, 1853, 29898, 10389, 2378, 29898, 28685, 1272, 8243, 13, 462, 4706, 1121, 2433, 27959, 29915, 13, 462, 1125, 13, 462, 1678, 17927, 29889, 8382, 29898, 29880, 29897, 13, 13, 9651, 4839, 353, 1583, 17255, 5103, 7850, 29889, 5510, 29898, 13, 18884, 7023, 2378, 29898, 28685, 1272, 29961, 29900, 29901, 1311, 17255, 7850, 29889, 17921, 580, 2314, 13, 9651, 1723, 13, 9651, 565, 4839, 29889, 1542, 451, 297, 6024, 5103, 742, 525, 1469, 742, 525, 2624, 2033, 29901, 13, 18884, 12020, 349, 3557, 2392, 29898, 13, 462, 1678, 525, 29965, 13996, 6021, 12951, 6782, 1134, 29889, 525, 13, 462, 1678, 525, 1252, 6021, 13291, 29892, 6864, 470, 3630, 541, 4520, 6571, 29915, 13, 462, 1678, 869, 4830, 29898, 6672, 29889, 1542, 29897, 13, 18884, 1723, 13, 9651, 1550, 7431, 29898, 28685, 1272, 29897, 529, 4839, 29889, 6513, 29901, 13, 18884, 502, 29890, 1272, 4619, 9358, 29889, 949, 29898, 13, 462, 1678, 1375, 29898, 13, 462, 4706, 4839, 29889, 6513, 448, 7431, 29898, 28685, 1272, 511, 13, 462, 4706, 396, 5020, 304, 29871, 29953, 29946, 29895, 29933, 13, 462, 308, 29953, 29946, 334, 29871, 29906, 1068, 29896, 29900, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 4706, 565, 10650, 29901, 13, 9651, 736, 502, 29890, 1272, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 17255, 5510, 29918, 5327, 29898, 28685, 1272, 29897, 13, 13, 1678, 822, 4770, 6717, 29898, 1311, 29892, 282, 9392, 29918, 7611, 29892, 1741, 29922, 8824, 1125, 13, 4706, 14550, 10739, 1158, 363, 9348, 848, 29889, 12008, 13, 4706, 9358, 353, 1583, 17255, 6693, 29886, 565, 1741, 1683, 1583, 17255, 2663, 29886, 13, 4706, 7714, 353, 1583, 17255, 6693, 29886, 29918, 908, 565, 1741, 1683, 1583, 17255, 2663, 29886, 29918, 908, 13, 4706, 10804, 353, 1583, 17255, 6255, 12460, 29889, 4282, 29898, 415, 29886, 29918, 7611, 29897, 13, 4706, 411, 7714, 29901, 13, 9651, 1018, 29901, 13, 18884, 2665, 353, 29871, 29900, 13, 18884, 1550, 2665, 529, 7431, 29898, 20736, 1125, 13, 462, 1678, 2665, 353, 9358, 29889, 3539, 29898, 13, 462, 4706, 396, 5020, 304, 29871, 29953, 29946, 29895, 29933, 13, 462, 4706, 10804, 29961, 18616, 5919, 18616, 718, 29871, 29953, 29946, 29930, 29906, 1068, 29896, 29900, 4638, 13, 462, 1678, 1723, 13, 9651, 5174, 502, 29890, 29889, 3221, 29889, 29965, 1744, 2392, 408, 321, 29901, 13, 18884, 396, 18076, 487, 11815, 470, 19587, 4742, 2748, 29889, 13, 18884, 565, 313, 13, 462, 4706, 313, 29872, 29889, 3127, 1217, 338, 6213, 322, 13, 462, 308, 6702, 15619, 29915, 297, 321, 29889, 710, 2704, 29889, 13808, 580, 470, 13, 462, 3986, 525, 8262, 29891, 29915, 297, 321, 29889, 710, 2704, 29889, 13808, 22130, 470, 13, 462, 4706, 313, 29872, 29889, 3127, 1217, 1275, 29871, 29896, 29896, 29900, 470, 321, 29889, 3127, 1217, 1275, 29871, 29896, 29953, 470, 321, 29889, 3127, 1217, 1275, 29871, 29945, 29897, 13, 462, 1125, 13, 462, 1678, 17927, 29889, 27392, 877, 17273, 4395, 12951, 2392, 6571, 4286, 4830, 29898, 29872, 29889, 3127, 1217, 876, 13, 462, 1678, 9358, 29889, 3539, 29898, 20736, 29897, 13, 13, 1678, 822, 4770, 6717, 29918, 3827, 29898, 1311, 29892, 282, 9392, 29918, 7611, 1125, 13, 4706, 14550, 12600, 349, 3557, 2009, 1728, 8454, 1234, 29889, 12008, 13, 4706, 396, 3872, 29915, 29873, 6623, 2441, 5639, 304, 3013, 27086, 428, 2594, 4336, 29889, 13, 4706, 282, 9392, 353, 21679, 29898, 1068, 415, 29886, 29918, 7611, 29897, 13, 4706, 396, 15076, 599, 4128, 13, 4706, 396, 2202, 29901, 13, 4706, 396, 1678, 1550, 451, 282, 9392, 29889, 9329, 14352, 29896, 5387, 13, 4706, 396, 4706, 282, 9392, 29889, 9329, 29889, 7323, 580, 13, 4706, 396, 4706, 565, 7431, 29898, 415, 29886, 29889, 9329, 29897, 1275, 29871, 29900, 29901, 13, 4706, 396, 9651, 2867, 13, 4706, 396, 19499, 11374, 2392, 29901, 13, 4706, 396, 1678, 396, 450, 24953, 1051, 338, 2307, 4069, 29889, 13, 4706, 396, 1678, 1209, 13, 13, 4706, 396, 15076, 2009, 13, 4706, 282, 9392, 1839, 1542, 2033, 353, 525, 6255, 29915, 13, 4706, 282, 9392, 1839, 15467, 1359, 2033, 353, 1583, 17255, 4736, 29889, 4282, 29898, 415, 29886, 29889, 9329, 29897, 13, 4706, 1583, 17255, 6717, 29898, 415, 29886, 29897, 13, 13, 1678, 822, 4770, 6717, 29918, 1272, 29898, 1311, 29892, 282, 9392, 29918, 7611, 29892, 848, 1125, 13, 4706, 14550, 12600, 848, 1728, 8454, 1234, 29889, 12008, 13, 4706, 396, 3872, 29915, 29873, 6623, 2441, 5639, 304, 3013, 27086, 428, 2594, 4336, 29889, 13, 4706, 282, 9392, 353, 21679, 29898, 1068, 415, 29886, 29918, 7611, 29897, 13, 4706, 396, 15076, 848, 13, 4706, 282, 9392, 1839, 1542, 2033, 353, 525, 1469, 29915, 13, 4706, 282, 9392, 1839, 15467, 1359, 2033, 353, 848, 13, 4706, 1583, 17255, 6717, 29898, 415, 29886, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 903, 3359, 29898, 1311, 1125, 13, 4706, 736, 6213, 565, 1583, 17255, 3696, 29918, 845, 329, 3204, 29889, 275, 29918, 842, 580, 1683, 1583, 17255, 3359, 13, 13, 1678, 732, 29918, 3359, 29889, 842, 357, 13, 1678, 822, 903, 3359, 29898, 1311, 29892, 995, 1125, 13, 4706, 12020, 7865, 2392, 877, 6359, 29899, 6194, 2875, 1495, 13, 13, 1678, 396, 3185, 950, 5314, 13, 1678, 396, 448, 2683, 807, 13, 1678, 822, 3638, 29898, 1311, 29892, 282, 9392, 29918, 7611, 29892, 848, 1125, 13, 4706, 14550, 4300, 571, 5858, 411, 1418, 12451, 559, 515, 14511, 1061, 304, 620, 27582, 12008, 13, 4706, 1418, 10066, 353, 7431, 29898, 1272, 29897, 13, 4706, 17927, 29889, 8382, 877, 29903, 11794, 6571, 6571, 6262, 8875, 4286, 4830, 29898, 13, 9651, 282, 9392, 29918, 7611, 29889, 10925, 3399, 29892, 13, 9651, 1418, 10066, 29892, 13, 9651, 525, 525, 718, 851, 29898, 1761, 29898, 1958, 29898, 20970, 29892, 282, 9392, 29918, 7611, 29889, 9329, 4961, 13, 9651, 565, 282, 9392, 29918, 7611, 29889, 9329, 1683, 15516, 13, 308, 876, 13, 4706, 411, 1583, 17255, 20736, 29918, 908, 29901, 13, 9651, 1583, 17255, 6717, 29918, 3827, 29898, 415, 29886, 29918, 7611, 29897, 13, 9651, 1583, 17255, 6717, 29918, 1272, 29898, 415, 29886, 29918, 7611, 29892, 848, 29897, 13, 9651, 396, 3617, 2933, 322, 269, 484, 557, 297, 12235, 16441, 1367, 322, 4567, 13, 9651, 396, 4128, 29889, 13, 9651, 2933, 353, 1583, 17255, 3757, 29894, 580, 13, 4706, 17927, 29889, 8382, 877, 29903, 11794, 6571, 6571, 6262, 426, 1157, 29913, 4286, 4830, 29898, 13, 9651, 282, 9392, 29918, 7611, 29889, 10925, 3399, 29892, 13, 9651, 1418, 10066, 29892, 13, 9651, 2933, 29889, 5103, 3399, 29892, 13, 9651, 525, 525, 718, 851, 29898, 1761, 29898, 1958, 29898, 20970, 29892, 2933, 29889, 9329, 4961, 13, 9651, 565, 282, 9392, 29918, 7611, 29889, 9329, 1683, 15516, 13, 308, 876, 13, 4706, 736, 2933, 13, 13, 1678, 822, 1162, 29894, 29898, 1311, 29892, 282, 9392, 29918, 7611, 1125, 13, 4706, 14550, 4300, 571, 5858, 411, 1418, 12451, 559, 515, 620, 27582, 304, 14511, 1061, 29889, 12008, 13, 4706, 17927, 29889, 8382, 877, 1525, 15633, 426, 1157, 29913, 4286, 4830, 29898, 13, 9651, 282, 9392, 29918, 7611, 29889, 10925, 3399, 29892, 13, 9651, 525, 525, 718, 851, 29898, 1761, 29898, 1958, 29898, 20970, 29892, 282, 9392, 29918, 7611, 29889, 9329, 4961, 13, 9651, 565, 282, 9392, 29918, 7611, 29889, 9329, 1683, 15516, 13, 308, 876, 13, 4706, 411, 1583, 17255, 20736, 29918, 908, 29901, 13, 9651, 1583, 17255, 6717, 29918, 3827, 29898, 415, 29886, 29918, 7611, 29897, 13, 9651, 1418, 12451, 559, 353, 1583, 17255, 3757, 29894, 580, 13, 9651, 565, 756, 5552, 29898, 4130, 12451, 559, 29892, 525, 1469, 29374, 13, 18884, 2933, 353, 1583, 17255, 3757, 29894, 580, 13, 18884, 565, 451, 313, 415, 29886, 29918, 7611, 29889, 7317, 1367, 1275, 13, 462, 4706, 1418, 12451, 559, 29889, 7317, 1367, 1275, 13, 462, 4706, 2933, 29889, 7317, 1367, 1125, 13, 462, 1678, 1583, 17255, 3359, 29889, 12071, 580, 13, 462, 1678, 12020, 349, 3557, 2392, 29898, 13, 462, 4706, 525, 16390, 12451, 559, 4867, 3553, 3052, 4352, 29901, 24335, 24335, 426, 1836, 29915, 13, 462, 4706, 869, 4830, 29898, 13, 462, 9651, 282, 9392, 29918, 7611, 29889, 7317, 1367, 29892, 13, 462, 9651, 1418, 12451, 559, 29889, 7317, 1367, 29892, 13, 462, 9651, 2933, 29889, 7317, 1367, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 565, 451, 313, 415, 29886, 29918, 7611, 29889, 12460, 1367, 1275, 13, 462, 4706, 1418, 12451, 559, 29889, 12460, 1367, 1275, 13, 462, 4706, 2933, 29889, 12460, 1367, 1125, 13, 462, 1678, 1583, 17255, 3359, 29889, 12071, 580, 13, 462, 1678, 12020, 349, 3557, 2392, 29898, 13, 462, 4706, 525, 16390, 12451, 559, 10804, 3553, 3052, 4352, 29901, 24335, 24335, 426, 1836, 29915, 13, 462, 4706, 869, 4830, 29898, 13, 462, 9651, 282, 9392, 29918, 7611, 29889, 12460, 1367, 29892, 13, 462, 9651, 1418, 12451, 559, 29889, 12460, 1367, 29892, 13, 462, 9651, 2933, 29889, 12460, 1367, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 565, 451, 313, 415, 29886, 29918, 7611, 29889, 10925, 3399, 1275, 13, 462, 4706, 1418, 12451, 559, 29889, 10925, 3399, 1125, 13, 462, 1678, 1583, 17255, 3359, 29889, 12071, 580, 13, 462, 1678, 12020, 349, 3557, 2392, 29898, 13, 462, 4706, 525, 16390, 12451, 559, 5858, 775, 3052, 4352, 29901, 24335, 426, 1836, 4286, 13, 462, 4706, 3402, 29898, 13, 462, 9651, 282, 9392, 29918, 7611, 29889, 10925, 3399, 29892, 13, 462, 9651, 1418, 12451, 559, 29889, 10925, 3399, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 13, 18884, 2933, 1839, 1469, 2033, 353, 1418, 12451, 559, 29889, 1469, 13, 9651, 1683, 29901, 13, 18884, 2933, 353, 1418, 12451, 559, 13, 13, 4706, 17927, 29889, 8382, 877, 1525, 15633, 6571, 426, 1157, 1157, 29913, 4286, 4830, 29898, 13, 9651, 282, 9392, 29918, 7611, 29889, 10925, 3399, 29892, 13, 9651, 2933, 29889, 5103, 3399, 29892, 13, 9651, 525, 6571, 6262, 4286, 4830, 29898, 2435, 29898, 5327, 29889, 1469, 876, 13, 9651, 565, 756, 5552, 29898, 5327, 29892, 525, 1469, 1495, 1683, 15516, 13, 9651, 525, 525, 718, 851, 29898, 1761, 29898, 1958, 29898, 20970, 29892, 2933, 29889, 9329, 4961, 13, 9651, 565, 2933, 29889, 9329, 1683, 15516, 13, 308, 876, 13, 4706, 736, 2933, 13, 13, 1678, 822, 4883, 29887, 29898, 1311, 29892, 282, 9392, 29918, 7611, 1125, 13, 4706, 14550, 4300, 571, 5858, 1728, 1418, 12451, 559, 29889, 12008, 13, 4706, 17927, 29889, 8382, 877, 2303, 26016, 426, 1157, 29913, 4286, 4830, 29898, 13, 9651, 282, 9392, 29918, 7611, 29889, 10925, 3399, 29892, 13, 9651, 525, 525, 718, 851, 29898, 1761, 29898, 1958, 29898, 20970, 29892, 282, 9392, 29918, 7611, 29889, 9329, 4961, 13, 9651, 565, 282, 9392, 29918, 7611, 29889, 9329, 1683, 15516, 13, 308, 876, 13, 4706, 411, 1583, 17255, 20736, 29918, 908, 29901, 13, 9651, 1583, 17255, 6717, 29918, 3827, 29898, 415, 29886, 29918, 7611, 29897, 13, 9651, 396, 3617, 2933, 322, 269, 484, 557, 297, 12235, 16441, 1367, 322, 4567, 13, 9651, 396, 4128, 363, 14846, 5103, 29889, 13, 9651, 2933, 353, 1583, 17255, 3757, 29894, 580, 13, 4706, 17927, 29889, 8382, 877, 2303, 26016, 6571, 426, 1157, 29913, 4286, 4830, 29898, 13, 9651, 282, 9392, 29918, 7611, 29889, 10925, 3399, 29892, 13, 9651, 2933, 29889, 5103, 3399, 29892, 13, 9651, 525, 525, 718, 851, 29898, 1761, 29898, 1958, 29898, 20970, 29892, 2933, 29889, 9329, 4961, 13, 9651, 565, 2933, 29889, 9329, 1683, 15516, 13, 308, 876, 13, 4706, 736, 2933, 13, 13, 1678, 822, 1741, 29898, 1311, 29892, 4480, 29922, 8824, 1125, 13, 4706, 14550, 5596, 1741, 29889, 13, 13, 4706, 960, 421, 10685, 29952, 445, 740, 338, 23473, 29889, 13466, 372, 1122, 736, 6213, 29889, 13, 4706, 14550, 13, 4706, 3415, 29873, 353, 6213, 13, 4706, 502, 29890, 1272, 353, 6213, 13, 4706, 565, 4480, 29901, 13, 9651, 502, 29890, 1272, 353, 1583, 17255, 3696, 29918, 9990, 29889, 657, 29898, 1271, 29922, 5574, 29897, 13, 4706, 25342, 451, 1583, 17255, 3696, 29918, 9990, 29889, 6310, 7295, 13, 9651, 502, 29890, 1272, 353, 1583, 17255, 3696, 29918, 9990, 29889, 657, 29898, 1271, 29922, 8824, 29897, 13, 13, 4706, 565, 502, 29890, 1272, 338, 451, 6213, 29901, 13, 9651, 3415, 29873, 353, 1583, 17255, 5510, 29918, 5327, 29898, 28685, 1272, 29897, 13, 13, 4706, 736, 3415, 29873, 13, 13, 1678, 822, 4770, 29886, 3028, 29918, 13604, 29898, 1311, 1125, 13, 4706, 14550, 29925, 3028, 4959, 29892, 4417, 963, 304, 263, 9521, 29889, 12008, 13, 4706, 1550, 451, 1583, 17255, 3696, 29918, 845, 329, 3204, 29889, 275, 29918, 842, 580, 322, 903, 3396, 29918, 7097, 29918, 284, 573, 7295, 13, 9651, 1018, 29901, 13, 18884, 3415, 29873, 353, 1583, 17255, 3757, 29894, 29898, 3696, 29922, 5574, 29892, 4480, 29922, 8824, 29892, 10650, 29922, 5574, 29897, 13, 18884, 565, 3415, 29873, 338, 451, 6213, 29901, 13, 462, 1678, 17927, 29889, 8382, 877, 2624, 712, 6742, 1495, 13, 462, 1678, 1583, 17255, 3696, 29918, 9990, 29889, 649, 29898, 5750, 29873, 29897, 13, 9651, 5174, 502, 29890, 29889, 3221, 29889, 29965, 1744, 2392, 408, 321, 29901, 13, 18884, 17927, 29889, 2704, 29898, 13, 462, 1678, 525, 8875, 1248, 1847, 3682, 29901, 6571, 4286, 4830, 29898, 276, 558, 29898, 1311, 17255, 3359, 511, 321, 29897, 13, 18884, 1723, 13, 18884, 396, 1423, 565, 766, 18045, 13, 18884, 565, 321, 29889, 3127, 1217, 1275, 29871, 29896, 29929, 29901, 13, 462, 1678, 2867, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 17927, 29889, 2704, 29898, 13, 462, 1678, 525, 8875, 1248, 1847, 3682, 29901, 6571, 4286, 4830, 29898, 276, 558, 29898, 1311, 17255, 3359, 511, 321, 29897, 13, 18884, 1723, 13, 2 ]
lendingclub2/filter.py
washcycle/lendingclub2
0
151059
# Filename: filter.py """ LendingClub2 Filter Module """ # Standard libraries import collections from abc import abstractmethod from abc import ABC # lendingclub2 from lendingclub2.error import LCError # pylint: disable=too-few-public-methods class BorrowerTrait(ABC): """ Abstract base class to define borrowers of interest """ @abstractmethod def matches(self, borrower): """ Check if borrower has the trait :param borrower: instance of lendingclub2.loan.Borrower :returns: boolean """ return True class BorrowerEmployedTrait(BorrowerTrait): """ Check if borrower is employed """ def matches(self, borrower): """ Check if borrower has the trait :param borrower: instance of lendingclub2.loan.Borrower :returns: boolean """ return borrower.employed class Filter(ABC): """ Abstract base class for filtering the loan """ @abstractmethod def meet_requirement(self, loan): """ Check if the loan is meeting the filter requirement :param loan: instance of lendingclub2.loan.Loan :returns: boolean """ return True class FilterByApproved(Filter): """ Filter by if the loan is already approved """ def meet_requirement(self, loan): """ Check if the loan is meeting the filter requirement :param loan: instance of lendingclub2.loan.Loan :returns: boolean """ return loan.approved class FilterByBorrowerTraits(Filter): """ Filter to have borrower matching specific traits """ # pylint: disable=super-init-not-called def __init__(self, traits): """ Constructor :param traits: instance of lendingclub2.filter.BorrowerTrait or iterable of instance of lendingclub2.filter.BorrowerTrait """ if isinstance(traits, collections.abc.Iterable): self._specs = traits elif isinstance(traits, BorrowerTrait): self._specs = (traits, ) else: fstr = "invalid traits type for {}".format(self.__class__.__name__) raise LCError(fstr) # pylint: enable=super-init-not-called def meet_requirement(self, loan): """ Check if the loan is meeting the filter requirement :param loan: instance of lendingclub2.loan.Loan :returns: boolean """ for spec in self._specs: if not spec.matches(loan.borrower): return False return True class FilterByFunded(Filter): """ Filter by percentage funded """ # pylint: disable=super-init-not-called def __init__(self, percentage): """ Constructor. :param percentage: float (between 0 and 100 inclusive) """ if percentage < 0.0 or percentage > 100.0: fstr = "percentage needs to be between 0 and 100 (inclusive)" raise LCError(fstr) self._percentage = percentage # pylint: enable=super-init-not-called def meet_requirement(self, loan): """ The loan would have to be at least the percentage value to meet the requirement. :param loan: instance of lendingclub2.loan.Loan :returns: boolean """ return loan.percent_funded >= self._percentage class FilterByGrade(Filter): """ Filter by grade """ # pylint: disable=super-init-not-called def __init__(self, grades=None): """ Constructor :param grades: iterable of string (default: None, example: ('A', 'B')) """ self._grades = grades # pylint: enable=super-init-not-called def meet_requirement(self, loan): """ Check if the loan is meeting the filter requirement :param loan: instance of lendingclub2.loan.Loan :returns: boolean """ if self._grades and loan.grade in self._grades: return True return False class FilterByTerm(Filter): """ Filter by term """ # pylint: disable=super-init-not-called def __init__(self, value=36, min_val=None, max_val=None): """ Constructor. To filter by a specific value, set value to a number. To filter by a range, set value to None, and set min_val and max_val to integers. :param value: int - exact term value (default: 36) :param min_val: int - minimum term value (inclusive) (default: None) :param max_val: int - maximum term value (inclusive) (default: None) """ if value is not None and (min_val is not None or max_val is not None): fstr = "value and min_val, max_val are mutually exclusive" details = "value: {}".format(value) if min_val is not None: details += ", min_val: {}".format(min_val) if max_val is not None: details += ", max_val: {}".format(max_val) raise LCError(fstr, details=details) if min_val is not None and max_val is not None: if max_val > min_val: fstr = "max_val cannot be greater than min_val" raise LCError(fstr) elif value is None and (min_val is None or max_val is None): fstr = "invalid specification on the values" hint = "either value or min_val + max_val combo should be specified" raise LCError(fstr, hint=hint) self._value = value self._min_value = min_val self._max_value = max_val # pylint: enable=super-init-not-called def meet_requirement(self, loan): """ Check if the loan is meeting the filter requirement :param loan: instance of lendingclub2.loan.Loan :returns: boolean """ if self._value is not None: return loan.term == self._value return self._min_value <= loan.term <= self._max_value # pylint: enable=too-few-public-methods
[ 1, 396, 2514, 3871, 29901, 4175, 29889, 2272, 13, 13, 15945, 29908, 13, 29931, 2548, 6821, 431, 29906, 19916, 15591, 13, 15945, 29908, 13, 13, 29937, 10117, 9562, 13, 5215, 16250, 13, 3166, 25638, 1053, 9846, 5696, 13, 3166, 25638, 1053, 16417, 13, 13, 13, 29937, 301, 2548, 29066, 29906, 13, 3166, 301, 2548, 29066, 29906, 29889, 2704, 1053, 365, 29907, 2392, 13, 13, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 29888, 809, 29899, 3597, 29899, 23515, 13, 1990, 6780, 307, 556, 5323, 277, 29898, 19658, 1125, 13, 1678, 9995, 13, 1678, 25513, 2967, 770, 304, 4529, 27942, 414, 310, 4066, 13, 1678, 9995, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 7087, 29898, 1311, 29892, 9820, 307, 556, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 9820, 307, 556, 756, 278, 22917, 13, 13, 4706, 584, 3207, 9820, 307, 556, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 29933, 272, 307, 556, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 736, 5852, 13, 13, 13, 1990, 6780, 307, 556, 10495, 2376, 287, 5323, 277, 29898, 29933, 272, 307, 556, 5323, 277, 1125, 13, 1678, 9995, 13, 1678, 5399, 565, 9820, 307, 556, 338, 15723, 13, 1678, 9995, 13, 1678, 822, 7087, 29898, 1311, 29892, 9820, 307, 556, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 9820, 307, 556, 756, 278, 22917, 13, 13, 4706, 584, 3207, 9820, 307, 556, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 29933, 272, 307, 556, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 736, 9820, 307, 556, 29889, 3451, 2376, 287, 13, 13, 13, 1990, 19916, 29898, 19658, 1125, 13, 1678, 9995, 13, 1678, 25513, 2967, 770, 363, 21166, 278, 24806, 13, 1678, 9995, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 5870, 29918, 12277, 358, 29898, 1311, 29892, 24806, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 278, 24806, 338, 11781, 278, 4175, 11809, 13, 13, 4706, 584, 3207, 24806, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 3410, 273, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 736, 5852, 13, 13, 13, 1990, 19916, 2059, 2052, 307, 1490, 29898, 5072, 1125, 13, 1678, 9995, 13, 1678, 19916, 491, 565, 278, 24806, 338, 2307, 23454, 13, 1678, 9995, 13, 1678, 822, 5870, 29918, 12277, 358, 29898, 1311, 29892, 24806, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 278, 24806, 338, 11781, 278, 4175, 11809, 13, 13, 4706, 584, 3207, 24806, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 3410, 273, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 736, 24806, 29889, 9961, 1490, 13, 13, 13, 1990, 19916, 2059, 29933, 272, 307, 556, 5323, 1169, 29898, 5072, 1125, 13, 1678, 9995, 13, 1678, 19916, 304, 505, 9820, 307, 556, 9686, 2702, 1020, 1169, 13, 1678, 9995, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1020, 1169, 1125, 13, 4706, 9995, 13, 4706, 1281, 18769, 13, 13, 4706, 584, 3207, 1020, 1169, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 4572, 29889, 29933, 272, 307, 556, 5323, 277, 13, 462, 539, 470, 4256, 519, 310, 2777, 310, 13, 462, 539, 301, 2548, 29066, 29906, 29889, 4572, 29889, 29933, 272, 307, 556, 5323, 277, 13, 4706, 9995, 13, 4706, 565, 338, 8758, 29898, 3018, 1169, 29892, 16250, 29889, 10736, 29889, 13463, 519, 1125, 13, 9651, 1583, 3032, 5965, 2395, 353, 1020, 1169, 13, 4706, 25342, 338, 8758, 29898, 3018, 1169, 29892, 6780, 307, 556, 5323, 277, 1125, 13, 9651, 1583, 3032, 5965, 2395, 353, 313, 3018, 1169, 29892, 1723, 13, 4706, 1683, 29901, 13, 9651, 285, 710, 353, 376, 20965, 1020, 1169, 1134, 363, 6571, 1642, 4830, 29898, 1311, 17255, 1990, 1649, 17255, 978, 1649, 29897, 13, 9651, 12020, 365, 29907, 2392, 29898, 29888, 710, 29897, 13, 1678, 396, 282, 2904, 524, 29901, 9025, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 13, 1678, 822, 5870, 29918, 12277, 358, 29898, 1311, 29892, 24806, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 278, 24806, 338, 11781, 278, 4175, 11809, 13, 13, 4706, 584, 3207, 24806, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 3410, 273, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 363, 1580, 297, 1583, 3032, 5965, 2395, 29901, 13, 9651, 565, 451, 1580, 29889, 20317, 29898, 417, 273, 29889, 4089, 307, 556, 1125, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 13, 13, 1990, 19916, 2059, 29943, 870, 287, 29898, 5072, 1125, 13, 1678, 9995, 13, 1678, 19916, 491, 19649, 5220, 287, 13, 1678, 9995, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19649, 1125, 13, 4706, 9995, 13, 4706, 1281, 18769, 29889, 13, 13, 4706, 584, 3207, 19649, 29901, 5785, 313, 14811, 29871, 29900, 322, 29871, 29896, 29900, 29900, 20978, 573, 29897, 13, 4706, 9995, 13, 4706, 565, 19649, 529, 29871, 29900, 29889, 29900, 470, 19649, 1405, 29871, 29896, 29900, 29900, 29889, 29900, 29901, 13, 9651, 285, 710, 353, 376, 25376, 482, 4225, 304, 367, 1546, 29871, 29900, 322, 29871, 29896, 29900, 29900, 313, 262, 7009, 573, 5513, 13, 9651, 12020, 365, 29907, 2392, 29898, 29888, 710, 29897, 13, 13, 4706, 1583, 3032, 25376, 482, 353, 19649, 13, 1678, 396, 282, 2904, 524, 29901, 9025, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 13, 1678, 822, 5870, 29918, 12277, 358, 29898, 1311, 29892, 24806, 1125, 13, 4706, 9995, 13, 4706, 450, 24806, 723, 505, 304, 367, 472, 3203, 278, 19649, 995, 304, 5870, 278, 13, 4706, 11809, 29889, 13, 13, 4706, 584, 3207, 24806, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 3410, 273, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 736, 24806, 29889, 25376, 29918, 27159, 287, 6736, 1583, 3032, 25376, 482, 13, 13, 13, 1990, 19916, 2059, 29954, 15464, 29898, 5072, 1125, 13, 1678, 9995, 13, 1678, 19916, 491, 19468, 13, 1678, 9995, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 867, 3076, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 1281, 18769, 13, 13, 4706, 584, 3207, 867, 3076, 29901, 4256, 519, 310, 1347, 313, 4381, 29901, 6213, 29892, 1342, 29901, 6702, 29909, 742, 525, 29933, 8785, 13, 4706, 9995, 13, 4706, 1583, 3032, 629, 3076, 353, 867, 3076, 13, 1678, 396, 282, 2904, 524, 29901, 9025, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 13, 1678, 822, 5870, 29918, 12277, 358, 29898, 1311, 29892, 24806, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 278, 24806, 338, 11781, 278, 4175, 11809, 13, 13, 4706, 584, 3207, 24806, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 3410, 273, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 565, 1583, 3032, 629, 3076, 322, 24806, 29889, 8228, 297, 1583, 3032, 629, 3076, 29901, 13, 9651, 736, 5852, 13, 4706, 736, 7700, 13, 13, 13, 1990, 19916, 2059, 14343, 29898, 5072, 1125, 13, 1678, 9995, 13, 1678, 19916, 491, 1840, 13, 1678, 9995, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 995, 29922, 29941, 29953, 29892, 1375, 29918, 791, 29922, 8516, 29892, 4236, 29918, 791, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 1281, 18769, 29889, 1763, 4175, 491, 263, 2702, 995, 29892, 731, 995, 304, 263, 1353, 29889, 13, 4706, 1763, 4175, 491, 263, 3464, 29892, 731, 995, 304, 6213, 29892, 322, 731, 1375, 29918, 791, 322, 4236, 29918, 791, 13, 4706, 304, 11920, 29889, 13, 13, 4706, 584, 3207, 995, 29901, 938, 448, 2684, 1840, 995, 313, 4381, 29901, 29871, 29941, 29953, 29897, 13, 4706, 584, 3207, 1375, 29918, 791, 29901, 938, 448, 9212, 1840, 995, 313, 262, 7009, 573, 29897, 313, 4381, 29901, 6213, 29897, 13, 4706, 584, 3207, 4236, 29918, 791, 29901, 938, 448, 7472, 1840, 995, 313, 262, 7009, 573, 29897, 313, 4381, 29901, 6213, 29897, 13, 4706, 9995, 13, 4706, 565, 995, 338, 451, 6213, 322, 313, 1195, 29918, 791, 338, 451, 6213, 470, 4236, 29918, 791, 338, 451, 6213, 1125, 13, 9651, 285, 710, 353, 376, 1767, 322, 1375, 29918, 791, 29892, 4236, 29918, 791, 526, 5478, 1474, 29192, 29908, 13, 9651, 4902, 353, 376, 1767, 29901, 6571, 1642, 4830, 29898, 1767, 29897, 13, 9651, 565, 1375, 29918, 791, 338, 451, 6213, 29901, 13, 18884, 4902, 4619, 9162, 1375, 29918, 791, 29901, 6571, 1642, 4830, 29898, 1195, 29918, 791, 29897, 13, 9651, 565, 4236, 29918, 791, 338, 451, 6213, 29901, 13, 18884, 4902, 4619, 9162, 4236, 29918, 791, 29901, 6571, 1642, 4830, 29898, 3317, 29918, 791, 29897, 13, 9651, 12020, 365, 29907, 2392, 29898, 29888, 710, 29892, 4902, 29922, 14144, 29897, 13, 13, 4706, 565, 1375, 29918, 791, 338, 451, 6213, 322, 4236, 29918, 791, 338, 451, 6213, 29901, 13, 9651, 565, 4236, 29918, 791, 1405, 1375, 29918, 791, 29901, 13, 18884, 285, 710, 353, 376, 3317, 29918, 791, 2609, 367, 7621, 1135, 1375, 29918, 791, 29908, 13, 18884, 12020, 365, 29907, 2392, 29898, 29888, 710, 29897, 13, 4706, 25342, 995, 338, 6213, 322, 313, 1195, 29918, 791, 338, 6213, 470, 4236, 29918, 791, 338, 6213, 1125, 13, 9651, 285, 710, 353, 376, 20965, 21992, 373, 278, 1819, 29908, 13, 9651, 13182, 353, 376, 29872, 2121, 995, 470, 1375, 29918, 791, 718, 4236, 29918, 791, 419, 833, 881, 367, 6790, 29908, 13, 9651, 12020, 365, 29907, 2392, 29898, 29888, 710, 29892, 13182, 29922, 29882, 524, 29897, 13, 13, 4706, 1583, 3032, 1767, 353, 995, 13, 4706, 1583, 3032, 1195, 29918, 1767, 353, 1375, 29918, 791, 13, 4706, 1583, 3032, 3317, 29918, 1767, 353, 4236, 29918, 791, 13, 1678, 396, 282, 2904, 524, 29901, 9025, 29922, 9136, 29899, 2344, 29899, 1333, 29899, 13998, 13, 13, 1678, 822, 5870, 29918, 12277, 358, 29898, 1311, 29892, 24806, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 278, 24806, 338, 11781, 278, 4175, 11809, 13, 13, 4706, 584, 3207, 24806, 29901, 2777, 310, 301, 2548, 29066, 29906, 29889, 417, 273, 29889, 3410, 273, 13, 4706, 584, 18280, 29901, 7223, 13, 4706, 9995, 13, 4706, 565, 1583, 3032, 1767, 338, 451, 6213, 29901, 13, 9651, 736, 24806, 29889, 8489, 1275, 1583, 3032, 1767, 13, 4706, 736, 1583, 3032, 1195, 29918, 1767, 5277, 24806, 29889, 8489, 5277, 1583, 3032, 3317, 29918, 1767, 13, 29937, 282, 2904, 524, 29901, 9025, 29922, 517, 29877, 29899, 29888, 809, 29899, 3597, 29899, 23515, 13, 2 ]
modules/BoxSampler.py
kapitsa2811/research-e2e-pagereader
1
66649
import torch.nn as nn import torch from utils import BBoxTransform,ClipBoxes from nms.nms_pytorch import nms as nms_op def nms(dets, thresh): #dets = dets.cpu().detach() #dets = np.array(dets) "Dispatch to either CPU or GPU NMS implementations.\ Accept dets as tensor""" #keep = torch.tensor(py_cpu_nms(dets,thresh)) scores = dets[:,4].clone() detections = dets[:,:4].clone() thresh=0.1 keep,count = nms_op(detections,scores,thresh) return keep.view(keep.numel()) #return nms_op(dets,scores, thresh) class BoxSampler(nn.Module): # Module to calculate the box coordinates given the classification scores, offset regression, # score and nms thresholds def __init__(self,training,score_threshold): super(BoxSampler, self).__init__() self.training = training self.regressBoxes = BBoxTransform() self.clipBoxes = ClipBoxes() self.score_threshold = score_threshold def forward(self,img_batch,anchors,regression,classification,score_threshold): transformed_anchors = self.regressBoxes(anchors, regression) transformed_anchors = self.clipBoxes(transformed_anchors, img_batch) scores = torch.max(classification, dim=2, keepdim=True)[0] scores_over_thresh = (scores>score_threshold)[0, :, 0] #scores_over_thresh = (scores>score_threshold)[0, :, 0] scores_over_thresh_idx=scores_over_thresh.nonzero() if scores_over_thresh.sum() > 0: transformed_anchors = transformed_anchors[:, scores_over_thresh, :] scores = scores[:, scores_over_thresh, :] anchors_nms_idx = nms(torch.cat([transformed_anchors, scores], dim=2)[0, :, :], 0.2) transformed_anchors = transformed_anchors[0,anchors_nms_idx,:] classification = classification[:, scores_over_thresh, :] nms_scores, classes = classification[0, anchors_nms_idx, :].max(dim=1) selected_indices = scores_over_thresh_idx[anchors_nms_idx] selected_indices = selected_indices.view(selected_indices.numel()) return nms_scores,classes,transformed_anchors,selected_indices else: return torch.zeros(1, 1),torch.zeros(1, 1),torch.zeros(1, 4),torch.zeros(1)
[ 1, 1053, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 13, 3166, 3667, 29879, 1053, 350, 3313, 13372, 29892, 29907, 3466, 3313, 267, 13, 3166, 302, 1516, 29889, 29876, 1516, 29918, 2272, 7345, 305, 1053, 302, 1516, 408, 302, 1516, 29918, 459, 13, 13, 1753, 302, 1516, 29898, 29881, 1691, 29892, 266, 3781, 1125, 13, 1678, 396, 29881, 1691, 353, 1439, 29879, 29889, 21970, 2141, 4801, 496, 580, 13, 1678, 396, 29881, 1691, 353, 7442, 29889, 2378, 29898, 29881, 1691, 29897, 13, 1678, 376, 14777, 304, 2845, 10808, 470, 22796, 405, 4345, 20240, 7790, 13, 1678, 29848, 1439, 29879, 408, 12489, 15945, 29908, 13, 1678, 396, 17462, 353, 4842, 305, 29889, 20158, 29898, 2272, 29918, 21970, 29918, 29876, 1516, 29898, 29881, 1691, 29892, 386, 3781, 876, 13, 1678, 19435, 353, 1439, 29879, 7503, 29892, 29946, 1822, 16513, 580, 13, 1678, 1439, 29872, 1953, 353, 1439, 29879, 7503, 29892, 29901, 29946, 1822, 16513, 580, 13, 1678, 266, 3781, 29922, 29900, 29889, 29896, 13, 1678, 3013, 29892, 2798, 353, 302, 1516, 29918, 459, 29898, 29881, 2650, 1953, 29892, 1557, 2361, 29892, 386, 3781, 29897, 13, 1678, 736, 3013, 29889, 1493, 29898, 17462, 29889, 1949, 295, 3101, 13, 1678, 396, 2457, 302, 1516, 29918, 459, 29898, 29881, 1691, 29892, 1557, 2361, 29892, 266, 3781, 29897, 13, 13, 1990, 11773, 22966, 20069, 29898, 15755, 29889, 7355, 1125, 13, 1678, 396, 15591, 304, 8147, 278, 3800, 10350, 2183, 278, 12965, 19435, 29892, 9210, 17855, 29892, 13, 1678, 396, 8158, 322, 302, 1516, 266, 3781, 3361, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 26495, 29892, 13628, 29918, 386, 12268, 1125, 13, 4706, 2428, 29898, 3313, 22966, 20069, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 26495, 353, 6694, 13, 4706, 1583, 29889, 276, 3663, 3313, 267, 353, 350, 3313, 13372, 580, 13, 4706, 1583, 29889, 24049, 3313, 267, 353, 315, 3466, 3313, 267, 580, 13, 4706, 1583, 29889, 13628, 29918, 386, 12268, 353, 8158, 29918, 386, 12268, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 2492, 29918, 16175, 29892, 14588, 943, 29892, 276, 11476, 29892, 1990, 2450, 29892, 13628, 29918, 386, 12268, 1125, 13, 4706, 27615, 29918, 14588, 943, 353, 1583, 29889, 276, 3663, 3313, 267, 29898, 14588, 943, 29892, 17855, 29897, 13, 4706, 27615, 29918, 14588, 943, 353, 1583, 29889, 24049, 3313, 267, 29898, 9067, 287, 29918, 14588, 943, 29892, 10153, 29918, 16175, 29897, 13, 13, 4706, 19435, 353, 4842, 305, 29889, 3317, 29898, 1990, 2450, 29892, 3964, 29922, 29906, 29892, 3013, 6229, 29922, 5574, 9601, 29900, 29962, 13, 13, 4706, 19435, 29918, 957, 29918, 386, 3781, 353, 313, 1557, 2361, 29958, 13628, 29918, 386, 12268, 9601, 29900, 29892, 584, 29892, 29871, 29900, 29962, 13, 4706, 396, 1557, 2361, 29918, 957, 29918, 386, 3781, 353, 313, 1557, 2361, 29958, 13628, 29918, 386, 12268, 9601, 29900, 29892, 584, 29892, 29871, 29900, 29962, 13, 308, 13, 4706, 19435, 29918, 957, 29918, 386, 3781, 29918, 13140, 29922, 1557, 2361, 29918, 957, 29918, 386, 3781, 29889, 5464, 9171, 580, 13, 4706, 565, 19435, 29918, 957, 29918, 386, 3781, 29889, 2083, 580, 1405, 29871, 29900, 29901, 13, 9651, 27615, 29918, 14588, 943, 353, 27615, 29918, 14588, 943, 7503, 29892, 19435, 29918, 957, 29918, 386, 3781, 29892, 584, 29962, 13, 9651, 19435, 353, 19435, 7503, 29892, 19435, 29918, 957, 29918, 386, 3781, 29892, 584, 29962, 13, 632, 13, 9651, 23791, 943, 29918, 29876, 1516, 29918, 13140, 353, 302, 1516, 29898, 7345, 305, 29889, 4117, 4197, 9067, 287, 29918, 14588, 943, 29892, 19435, 1402, 3964, 29922, 29906, 9601, 29900, 29892, 584, 29892, 584, 1402, 29871, 29900, 29889, 29906, 29897, 13, 9651, 27615, 29918, 14588, 943, 29871, 353, 27615, 29918, 14588, 943, 29961, 29900, 29892, 14588, 943, 29918, 29876, 1516, 29918, 13140, 29892, 17531, 13, 632, 13, 9651, 12965, 353, 12965, 7503, 29892, 19435, 29918, 957, 29918, 386, 3781, 29892, 584, 29962, 13, 9651, 302, 1516, 29918, 1557, 2361, 29892, 4413, 353, 12965, 29961, 29900, 29892, 23791, 943, 29918, 29876, 1516, 29918, 13140, 29892, 584, 1822, 3317, 29898, 6229, 29922, 29896, 29897, 13, 13, 9651, 4629, 29918, 513, 1575, 353, 19435, 29918, 957, 29918, 386, 3781, 29918, 13140, 29961, 14588, 943, 29918, 29876, 1516, 29918, 13140, 29962, 13, 9651, 4629, 29918, 513, 1575, 353, 4629, 29918, 513, 1575, 29889, 1493, 29898, 8391, 29918, 513, 1575, 29889, 1949, 295, 3101, 13, 9651, 736, 302, 1516, 29918, 1557, 2361, 29892, 13203, 29892, 9067, 287, 29918, 14588, 943, 29892, 8391, 29918, 513, 1575, 13, 4706, 1683, 29901, 13, 9651, 736, 4842, 305, 29889, 3298, 359, 29898, 29896, 29892, 29871, 29896, 511, 7345, 305, 29889, 3298, 359, 29898, 29896, 29892, 29871, 29896, 511, 7345, 305, 29889, 3298, 359, 29898, 29896, 29892, 29871, 29946, 511, 7345, 305, 29889, 3298, 359, 29898, 29896, 29897, 13, 13, 2 ]
finetuner/tuner/callback/evaluation.py
jina-ai/finetuner
270
187403
import math from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Tuple from ... import embed from ..evaluation import Evaluator from .base import BaseCallback if TYPE_CHECKING: from docarray import DocumentArray from ..base import BaseTuner class EvaluationCallback(BaseCallback): """ A callback that uses the Evaluator to calculate IR metrics at the end of each epoch. When used with other callbacks that rely on metrics, like checkpoints and logging, this callback should be defined first, so that it precedes in execution. """ def __init__( self, query_data: 'DocumentArray', index_data: Optional['DocumentArray'] = None, metrics: Optional[ Dict[str, Tuple[Callable[..., float], Dict[str, Any]]] ] = None, exclude_self: bool = True, limit: int = 20, distance: str = 'cosine', num_workers: int = 1, ): """ :param query_data: Search data used by the evaluator at the end of each epoch, to evaluate the model. :param index_data: Index data or catalog used by the evaluator at the end of each epoch, to evaluate the model. :param metrics: A dictionary that specifies the metrics to calculate. It maps metric names to tuples of metric functions and their keyword arguments. If set to None, default metrics are computed. :param exclude_self: Whether to exclude self when matching. :param limit: The number of top search results to consider when computing the evaluation metrics. :param distance: The type of distance metric to use when matching query and index docs, available options are ``'cosine'``, ``'euclidean'`` and ``'sqeuclidean'``. :param num_workers: The number of workers to use when matching query and index data. """ self._query_data = query_data self._index_data = index_data self._metrics = metrics self._exclude_self = exclude_self self._limit = limit self._distance = distance self._num_workers = num_workers self._query_pbar_id = None self._index_pbar_id = None self._match_pbar_id = None def on_fit_begin(self, tuner: 'BaseTuner'): self._query_pbar_id = tuner._progress_bar.add_task( 'Embedding queries', visible=False, start=False ) self._index_pbar_id = tuner._progress_bar.add_task( 'Embedding index', visible=False, start=False ) self._match_pbar_id = tuner._progress_bar.add_task( 'Matching', visible=False, start=False ) def on_epoch_end(self, tuner: 'BaseTuner'): # start query data progress bar tuner._progress_bar.reset( self._query_pbar_id, visible=True, description='Embedding queries', total=math.ceil(len(self._query_data) / tuner._batch_size), completed=0, metrics='', ) # embed queries for batch in self._query_data.batch(tuner._batch_size): embed( batch, tuner._embed_model, device=tuner._device_name, batch_size=tuner._batch_size, preprocess_fn=tuner._preprocess_fn, collate_fn=tuner._collate_fn, ) tuner._progress_bar.update(task_id=self._query_pbar_id, advance=1) tuner._progress_bar.update(task_id=self._query_pbar_id, visible=False) if self._index_data: # start index data progress bar tuner._progress_bar.reset( self._index_pbar_id, visible=True, description='Embedding index', total=math.ceil(len(self._index_data) / tuner._batch_size), completed=0, metrics='', ) # embed index for batch in self._index_data.batch(tuner._batch_size): embed( batch, tuner._embed_model, device=tuner._device_name, batch_size=tuner._batch_size, preprocess_fn=tuner._preprocess_fn, collate_fn=tuner._collate_fn, ) tuner._progress_bar.update(task_id=self._index_pbar_id, advance=1) index_data = self._index_data tuner._progress_bar.update(task_id=self._index_pbar_id, visible=False) else: index_data = self._query_data # start matching progress bar tuner._progress_bar.reset( self._match_pbar_id, visible=True, description='Matching', metrics='', ) # compute metrics evaluator = Evaluator(self._query_data, index_data, metrics=self._metrics) tuner.state.eval_metrics = evaluator.evaluate( exclude_self=self._exclude_self, limit=self._limit, distance=self._distance, num_workers=self._num_workers, ) tuner._progress_bar.update(task_id=self._match_pbar_id, visible=False)
[ 1, 1053, 5844, 13, 3166, 19229, 1053, 323, 6959, 29918, 3210, 16658, 4214, 29892, 3139, 29892, 8251, 519, 29892, 360, 919, 29892, 28379, 29892, 12603, 552, 13, 13, 3166, 2023, 1053, 8297, 13, 3166, 6317, 24219, 362, 1053, 382, 4387, 1061, 13, 3166, 869, 3188, 1053, 7399, 10717, 13, 13, 361, 323, 6959, 29918, 3210, 16658, 4214, 29901, 13, 1678, 515, 1574, 2378, 1053, 10854, 2588, 13, 13, 1678, 515, 6317, 3188, 1053, 7399, 29911, 348, 261, 13, 13, 13, 1990, 382, 4387, 362, 10717, 29898, 5160, 10717, 1125, 13, 1678, 9995, 13, 1678, 319, 6939, 393, 3913, 278, 382, 4387, 1061, 304, 8147, 23292, 21556, 472, 278, 1095, 310, 1269, 21502, 305, 29889, 13, 1678, 1932, 1304, 411, 916, 6939, 29879, 393, 19104, 373, 21556, 29892, 763, 1423, 9748, 322, 12183, 29892, 13, 1678, 445, 6939, 881, 367, 3342, 937, 29892, 577, 393, 372, 9399, 267, 297, 8225, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 2346, 29918, 1272, 29901, 525, 6268, 2588, 742, 13, 4706, 2380, 29918, 1272, 29901, 28379, 1839, 6268, 2588, 2033, 353, 6213, 29892, 13, 4706, 21556, 29901, 28379, 29961, 13, 9651, 360, 919, 29961, 710, 29892, 12603, 552, 29961, 5594, 519, 29961, 16361, 5785, 1402, 360, 919, 29961, 710, 29892, 3139, 5262, 29962, 13, 4706, 4514, 353, 6213, 29892, 13, 4706, 19060, 29918, 1311, 29901, 6120, 353, 5852, 29892, 13, 4706, 4046, 29901, 938, 353, 29871, 29906, 29900, 29892, 13, 4706, 5418, 29901, 851, 353, 525, 3944, 457, 742, 13, 4706, 954, 29918, 1287, 414, 29901, 938, 353, 29871, 29896, 29892, 13, 268, 1125, 13, 4706, 9995, 13, 4706, 584, 3207, 2346, 29918, 1272, 29901, 11856, 848, 1304, 491, 278, 6161, 1061, 472, 278, 1095, 310, 1269, 21502, 305, 29892, 13, 9651, 304, 14707, 278, 1904, 29889, 13, 4706, 584, 3207, 2380, 29918, 1272, 29901, 11374, 848, 470, 16653, 1304, 491, 278, 6161, 1061, 472, 278, 1095, 310, 13, 9651, 1269, 21502, 305, 29892, 304, 14707, 278, 1904, 29889, 13, 4706, 584, 3207, 21556, 29901, 319, 8600, 393, 1580, 11057, 278, 21556, 304, 8147, 29889, 739, 11053, 13, 9651, 12714, 2983, 304, 5291, 2701, 310, 12714, 3168, 322, 1009, 13553, 6273, 29889, 960, 13, 9651, 731, 304, 6213, 29892, 2322, 21556, 526, 15712, 29889, 13, 4706, 584, 3207, 19060, 29918, 1311, 29901, 26460, 304, 19060, 1583, 746, 9686, 29889, 13, 4706, 584, 3207, 4046, 29901, 450, 1353, 310, 2246, 2740, 2582, 304, 2050, 746, 20602, 278, 13, 9651, 17983, 21556, 29889, 13, 4706, 584, 3207, 5418, 29901, 450, 1134, 310, 5418, 12714, 304, 671, 746, 9686, 2346, 322, 13, 9651, 2380, 10561, 29892, 3625, 3987, 526, 4954, 29915, 3944, 457, 11120, 1673, 4954, 29915, 29872, 27511, 11120, 29952, 322, 13, 9651, 4954, 29915, 3044, 29872, 27511, 11120, 1412, 13, 4706, 584, 3207, 954, 29918, 1287, 414, 29901, 450, 1353, 310, 17162, 304, 671, 746, 9686, 2346, 322, 13, 9651, 2380, 848, 29889, 13, 4706, 9995, 13, 4706, 1583, 3032, 1972, 29918, 1272, 353, 2346, 29918, 1272, 13, 4706, 1583, 3032, 2248, 29918, 1272, 353, 2380, 29918, 1272, 13, 4706, 1583, 3032, 2527, 10817, 353, 21556, 13, 4706, 1583, 3032, 735, 2325, 29918, 1311, 353, 19060, 29918, 1311, 13, 4706, 1583, 3032, 13400, 353, 4046, 13, 4706, 1583, 3032, 19244, 353, 5418, 13, 4706, 1583, 3032, 1949, 29918, 1287, 414, 353, 954, 29918, 1287, 414, 13, 4706, 1583, 3032, 1972, 29918, 29886, 1646, 29918, 333, 353, 6213, 13, 4706, 1583, 3032, 2248, 29918, 29886, 1646, 29918, 333, 353, 6213, 13, 4706, 1583, 3032, 4352, 29918, 29886, 1646, 29918, 333, 353, 6213, 13, 13, 1678, 822, 373, 29918, 9202, 29918, 463, 29898, 1311, 29892, 18515, 261, 29901, 525, 5160, 29911, 348, 261, 29374, 13, 4706, 1583, 3032, 1972, 29918, 29886, 1646, 29918, 333, 353, 18515, 261, 3032, 18035, 29918, 1646, 29889, 1202, 29918, 7662, 29898, 13, 9651, 525, 6026, 2580, 8497, 9365, 742, 7962, 29922, 8824, 29892, 1369, 29922, 8824, 13, 4706, 1723, 13, 4706, 1583, 3032, 2248, 29918, 29886, 1646, 29918, 333, 353, 18515, 261, 3032, 18035, 29918, 1646, 29889, 1202, 29918, 7662, 29898, 13, 9651, 525, 6026, 2580, 8497, 2380, 742, 7962, 29922, 8824, 29892, 1369, 29922, 8824, 13, 4706, 1723, 13, 4706, 1583, 3032, 4352, 29918, 29886, 1646, 29918, 333, 353, 18515, 261, 3032, 18035, 29918, 1646, 29889, 1202, 29918, 7662, 29898, 13, 9651, 525, 9652, 292, 742, 7962, 29922, 8824, 29892, 1369, 29922, 8824, 13, 4706, 1723, 13, 13, 1678, 822, 373, 29918, 1022, 2878, 29918, 355, 29898, 1311, 29892, 18515, 261, 29901, 525, 5160, 29911, 348, 261, 29374, 13, 13, 4706, 396, 1369, 2346, 848, 6728, 2594, 13, 4706, 18515, 261, 3032, 18035, 29918, 1646, 29889, 12071, 29898, 13, 9651, 1583, 3032, 1972, 29918, 29886, 1646, 29918, 333, 29892, 13, 9651, 7962, 29922, 5574, 29892, 13, 9651, 6139, 2433, 6026, 2580, 8497, 9365, 742, 13, 9651, 3001, 29922, 755, 29889, 27696, 29898, 2435, 29898, 1311, 3032, 1972, 29918, 1272, 29897, 847, 18515, 261, 3032, 16175, 29918, 2311, 511, 13, 9651, 8676, 29922, 29900, 29892, 13, 9651, 21556, 2433, 742, 13, 4706, 1723, 13, 13, 4706, 396, 8297, 9365, 13, 4706, 363, 9853, 297, 1583, 3032, 1972, 29918, 1272, 29889, 16175, 29898, 29873, 348, 261, 3032, 16175, 29918, 2311, 1125, 13, 9651, 8297, 29898, 13, 18884, 9853, 29892, 13, 18884, 18515, 261, 3032, 17987, 29918, 4299, 29892, 13, 18884, 4742, 29922, 29873, 348, 261, 3032, 10141, 29918, 978, 29892, 13, 18884, 9853, 29918, 2311, 29922, 29873, 348, 261, 3032, 16175, 29918, 2311, 29892, 13, 18884, 758, 5014, 29918, 9144, 29922, 29873, 348, 261, 3032, 1457, 5014, 29918, 9144, 29892, 13, 18884, 5321, 403, 29918, 9144, 29922, 29873, 348, 261, 3032, 1054, 9632, 29918, 9144, 29892, 13, 9651, 1723, 13, 9651, 18515, 261, 3032, 18035, 29918, 1646, 29889, 5504, 29898, 7662, 29918, 333, 29922, 1311, 3032, 1972, 29918, 29886, 1646, 29918, 333, 29892, 6564, 29922, 29896, 29897, 13, 4706, 18515, 261, 3032, 18035, 29918, 1646, 29889, 5504, 29898, 7662, 29918, 333, 29922, 1311, 3032, 1972, 29918, 29886, 1646, 29918, 333, 29892, 7962, 29922, 8824, 29897, 13, 13, 4706, 565, 1583, 3032, 2248, 29918, 1272, 29901, 13, 13, 9651, 396, 1369, 2380, 848, 6728, 2594, 13, 9651, 18515, 261, 3032, 18035, 29918, 1646, 29889, 12071, 29898, 13, 18884, 1583, 3032, 2248, 29918, 29886, 1646, 29918, 333, 29892, 13, 18884, 7962, 29922, 5574, 29892, 13, 18884, 6139, 2433, 6026, 2580, 8497, 2380, 742, 13, 18884, 3001, 29922, 755, 29889, 27696, 29898, 2435, 29898, 1311, 3032, 2248, 29918, 1272, 29897, 847, 18515, 261, 3032, 16175, 29918, 2311, 511, 13, 18884, 8676, 29922, 29900, 29892, 13, 18884, 21556, 2433, 742, 13, 9651, 1723, 13, 13, 9651, 396, 8297, 2380, 13, 9651, 363, 9853, 297, 1583, 3032, 2248, 29918, 1272, 29889, 16175, 29898, 29873, 348, 261, 3032, 16175, 29918, 2311, 1125, 13, 18884, 8297, 29898, 13, 462, 1678, 9853, 29892, 13, 462, 1678, 18515, 261, 3032, 17987, 29918, 4299, 29892, 13, 462, 1678, 4742, 29922, 29873, 348, 261, 3032, 10141, 29918, 978, 29892, 13, 462, 1678, 9853, 29918, 2311, 29922, 29873, 348, 261, 3032, 16175, 29918, 2311, 29892, 13, 462, 1678, 758, 5014, 29918, 9144, 29922, 29873, 348, 261, 3032, 1457, 5014, 29918, 9144, 29892, 13, 462, 1678, 5321, 403, 29918, 9144, 29922, 29873, 348, 261, 3032, 1054, 9632, 29918, 9144, 29892, 13, 18884, 1723, 13, 18884, 18515, 261, 3032, 18035, 29918, 1646, 29889, 5504, 29898, 7662, 29918, 333, 29922, 1311, 3032, 2248, 29918, 29886, 1646, 29918, 333, 29892, 6564, 29922, 29896, 29897, 13, 13, 9651, 2380, 29918, 1272, 353, 1583, 3032, 2248, 29918, 1272, 13, 9651, 18515, 261, 3032, 18035, 29918, 1646, 29889, 5504, 29898, 7662, 29918, 333, 29922, 1311, 3032, 2248, 29918, 29886, 1646, 29918, 333, 29892, 7962, 29922, 8824, 29897, 13, 13, 4706, 1683, 29901, 13, 9651, 2380, 29918, 1272, 353, 1583, 3032, 1972, 29918, 1272, 13, 13, 4706, 396, 1369, 9686, 6728, 2594, 13, 4706, 18515, 261, 3032, 18035, 29918, 1646, 29889, 12071, 29898, 13, 9651, 1583, 3032, 4352, 29918, 29886, 1646, 29918, 333, 29892, 13, 9651, 7962, 29922, 5574, 29892, 13, 9651, 6139, 2433, 9652, 292, 742, 13, 9651, 21556, 2433, 742, 13, 4706, 1723, 13, 13, 4706, 396, 10272, 21556, 13, 4706, 6161, 1061, 353, 382, 4387, 1061, 29898, 1311, 3032, 1972, 29918, 1272, 29892, 2380, 29918, 1272, 29892, 21556, 29922, 1311, 3032, 2527, 10817, 29897, 13, 4706, 18515, 261, 29889, 3859, 29889, 14513, 29918, 2527, 10817, 353, 6161, 1061, 29889, 24219, 403, 29898, 13, 9651, 19060, 29918, 1311, 29922, 1311, 3032, 735, 2325, 29918, 1311, 29892, 13, 9651, 4046, 29922, 1311, 3032, 13400, 29892, 13, 9651, 5418, 29922, 1311, 3032, 19244, 29892, 13, 9651, 954, 29918, 1287, 414, 29922, 1311, 3032, 1949, 29918, 1287, 414, 29892, 13, 4706, 1723, 13, 4706, 18515, 261, 3032, 18035, 29918, 1646, 29889, 5504, 29898, 7662, 29918, 333, 29922, 1311, 3032, 4352, 29918, 29886, 1646, 29918, 333, 29892, 7962, 29922, 8824, 29897, 13, 2 ]
src/vardb/deposit/annotation_config.py
Dabble-of-DevOps-Bio/ella
0
31294
from typing import Any, List, Mapping, Sequence import jsonschema from dataclasses import dataclass, field from sqlalchemy.orm import scoped_session from vardb.datamodel.jsonschemas.load_schema import load_schema from vardb.datamodel import annotation @dataclass class ConverterConfig: elements: Sequence[Mapping[str, Any]] @dataclass(init=False) class AnnotationImportConfig: name: str converter_config: ConverterConfig def __init__(self, name: str, converter_config: Mapping[str, Any]) -> None: self.name = name self.converter_config = ConverterConfig(**converter_config) @dataclass(init=False) class AnnotationConfig: deposit: Sequence[AnnotationImportConfig] view: List = field(default_factory=list) def __init__(self, deposit: Sequence[Mapping[str, Any]], view: List) -> None: self.view = view self.deposit = list() for sub_conf in deposit: self.deposit.append(AnnotationImportConfig(**sub_conf)) def deposit_annotationconfig( session: scoped_session, annotationconfig: Mapping[str, Any] ) -> annotation.AnnotationConfig: schema = load_schema("annotationconfig.json") jsonschema.validate(annotationconfig, schema) active_annotationconfig = ( session.query(annotation.AnnotationConfig) .order_by(annotation.AnnotationConfig.id.desc()) .limit(1) .one_or_none() ) # Check if annotation config is equal. Note that for deposit, we do not care about order or duplicity # Since the deposit is a list of dicts, we can not check set-equality (dicts are not hashable), # so we check that all items in incoming are in active, and vice versa. if ( active_annotationconfig and all(x in active_annotationconfig.deposit for x in annotationconfig["deposit"]) and all(x in annotationconfig["deposit"] for x in active_annotationconfig.deposit) and active_annotationconfig.view == annotationconfig["view"] ): raise RuntimeError("The annotation config matches the current active annotation config.") ac_obj = annotation.AnnotationConfig( deposit=annotationconfig["deposit"], view=annotationconfig["view"] ) session.add(ac_obj) session.flush() return ac_obj
[ 1, 515, 19229, 1053, 3139, 29892, 2391, 29892, 341, 20304, 29892, 922, 3910, 13, 5215, 6965, 787, 305, 2603, 13, 3166, 848, 13203, 1053, 848, 1990, 29892, 1746, 13, 3166, 4576, 284, 305, 6764, 29889, 555, 1053, 16505, 287, 29918, 7924, 13, 3166, 325, 538, 29890, 29889, 4130, 314, 27224, 29889, 1315, 787, 305, 8609, 29889, 1359, 29918, 11010, 1053, 2254, 29918, 11010, 13, 3166, 325, 538, 29890, 29889, 4130, 314, 27224, 1053, 17195, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 1281, 13549, 3991, 29901, 13, 1678, 3161, 29901, 922, 3910, 29961, 15845, 29961, 710, 29892, 3139, 5262, 13, 13, 13, 29992, 1272, 1990, 29898, 2344, 29922, 8824, 29897, 13, 1990, 530, 16666, 17518, 3991, 29901, 13, 1678, 1024, 29901, 851, 13, 1678, 29105, 29918, 2917, 29901, 1281, 13549, 3991, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29901, 851, 29892, 29105, 29918, 2917, 29901, 341, 20304, 29961, 710, 29892, 3139, 2314, 1599, 6213, 29901, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 535, 13549, 29918, 2917, 353, 1281, 13549, 3991, 29898, 1068, 535, 13549, 29918, 2917, 29897, 13, 13, 13, 29992, 1272, 1990, 29898, 2344, 29922, 8824, 29897, 13, 1990, 530, 16666, 3991, 29901, 13, 1678, 19754, 277, 29901, 922, 3910, 29961, 21978, 17518, 3991, 29962, 13, 1678, 1776, 29901, 2391, 353, 1746, 29898, 4381, 29918, 14399, 29922, 1761, 29897, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19754, 277, 29901, 922, 3910, 29961, 15845, 29961, 710, 29892, 3139, 20526, 1776, 29901, 2391, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 1493, 353, 1776, 13, 4706, 1583, 29889, 311, 1066, 277, 353, 1051, 580, 13, 4706, 363, 1014, 29918, 5527, 297, 19754, 277, 29901, 13, 9651, 1583, 29889, 311, 1066, 277, 29889, 4397, 29898, 21978, 17518, 3991, 29898, 1068, 1491, 29918, 5527, 876, 13, 13, 13, 1753, 19754, 277, 29918, 18317, 2917, 29898, 13, 1678, 4867, 29901, 16505, 287, 29918, 7924, 29892, 17195, 2917, 29901, 341, 20304, 29961, 710, 29892, 3139, 29962, 13, 29897, 1599, 17195, 29889, 21978, 3991, 29901, 13, 1678, 10938, 353, 2254, 29918, 11010, 703, 18317, 2917, 29889, 3126, 1159, 13, 1678, 6965, 787, 305, 2603, 29889, 15480, 29898, 18317, 2917, 29892, 10938, 29897, 13, 13, 1678, 6136, 29918, 18317, 2917, 353, 313, 13, 4706, 4867, 29889, 1972, 29898, 18317, 29889, 21978, 3991, 29897, 13, 4706, 869, 2098, 29918, 1609, 29898, 18317, 29889, 21978, 3991, 29889, 333, 29889, 14273, 3101, 13, 4706, 869, 13400, 29898, 29896, 29897, 13, 4706, 869, 650, 29918, 272, 29918, 9290, 580, 13, 1678, 1723, 13, 13, 1678, 396, 5399, 565, 17195, 2295, 338, 5186, 29889, 3940, 393, 363, 19754, 277, 29892, 591, 437, 451, 2562, 1048, 1797, 470, 5141, 17024, 13, 1678, 396, 4001, 278, 19754, 277, 338, 263, 1051, 310, 9657, 29879, 29892, 591, 508, 451, 1423, 731, 29899, 13895, 313, 8977, 29879, 526, 451, 6608, 519, 511, 13, 1678, 396, 577, 591, 1423, 393, 599, 4452, 297, 23235, 526, 297, 6136, 29892, 322, 11289, 1224, 29874, 29889, 13, 1678, 565, 313, 13, 4706, 6136, 29918, 18317, 2917, 13, 4706, 322, 599, 29898, 29916, 297, 6136, 29918, 18317, 2917, 29889, 311, 1066, 277, 363, 921, 297, 17195, 2917, 3366, 311, 1066, 277, 20068, 13, 4706, 322, 599, 29898, 29916, 297, 17195, 2917, 3366, 311, 1066, 277, 3108, 363, 921, 297, 6136, 29918, 18317, 2917, 29889, 311, 1066, 277, 29897, 13, 4706, 322, 6136, 29918, 18317, 2917, 29889, 1493, 1275, 17195, 2917, 3366, 1493, 3108, 13, 268, 1125, 13, 4706, 12020, 24875, 2392, 703, 1576, 17195, 2295, 7087, 278, 1857, 6136, 17195, 2295, 23157, 13, 13, 1678, 1274, 29918, 5415, 353, 17195, 29889, 21978, 3991, 29898, 13, 4706, 19754, 277, 29922, 18317, 2917, 3366, 311, 1066, 277, 12436, 1776, 29922, 18317, 2917, 3366, 1493, 3108, 13, 1678, 1723, 13, 13, 1678, 4867, 29889, 1202, 29898, 562, 29918, 5415, 29897, 13, 1678, 4867, 29889, 23126, 580, 13, 13, 1678, 736, 1274, 29918, 5415, 13, 2 ]
leetcode/1701-remove-max-number-of-edges-to-keep-graph-fully-traversable.py
Magic07/online-judge-solutions
0
55575
<gh_stars>0 class Solution: def maxNumEdgesToRemove(self, n: int, edges: List[List[int]]) -> int: answer=0 aliceVisited=[0]*(n+1) bobVisited=[0]*(n+1) aliceSet={} aliceSetNum=1 bobSet={} bobSetNum=1 # Return False if this edge can be deleted. Applies to all addEdge* methods. def addEdge(edge) -> bool: [t, v1, v2]=edge if t==3: use1=addEdgeFor('alice', edge) use2=addEdgeFor('bob', edge) return use1 or use2 elif t==1: return addEdgeFor('alice', edge) else: return addEdgeFor('bob', edge) def addEdgeFor(name, edge): nonlocal aliceSetNum nonlocal bobSetNum [t, v1, v2]=edge visited=aliceVisited vSet=aliceSet setNum=aliceSetNum if name=='bob': visited=bobVisited vSet=bobSet setNum=bobSetNum if visited[v1]==visited[v2]: if visited[v1]!=0: return False visited[v1]=setNum visited[v2]=setNum vSet[setNum]=[v1, v2] if name=='alice': aliceSetNum+=1 else: bobSetNum+=1 elif visited[v1]==0: visited[v1]=visited[v2] vSet[visited[v1]].append(v1) elif visited[v2]==0: visited[v2]=visited[v1] vSet[visited[v2]].append(v2) else: set1=visited[v1] set2=visited[v2] for x in vSet[set2]: visited[x]=set1 vSet[set1].extend(vSet[set2]) del vSet[set2] return True for edge in edges: if edge[0]==3: if not addEdge(edge): answer+=1 for edge in edges: if edge[0]!=3: if not addEdge(edge): answer+=1 if len([x for x in aliceVisited[1:] if x==0])!=0 or len([x for x in bobVisited[1:] if x==0])!=0: return -1 return answer
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 1990, 24380, 29901, 30004, 13, 1678, 822, 4236, 8009, 3853, 2710, 1762, 15941, 29898, 1311, 29892, 302, 29901, 938, 29892, 12770, 29901, 2391, 29961, 1293, 29961, 524, 24960, 1599, 938, 29901, 30004, 13, 4706, 1234, 29922, 29900, 30004, 13, 4706, 394, 625, 6116, 1573, 11759, 29900, 14178, 29898, 29876, 29974, 29896, 8443, 13, 4706, 289, 711, 6116, 1573, 11759, 29900, 14178, 29898, 29876, 29974, 29896, 8443, 13, 4706, 394, 625, 2697, 3790, 8117, 13, 4706, 394, 625, 2697, 8009, 29922, 29896, 30004, 13, 4706, 289, 711, 2697, 3790, 8117, 13, 4706, 289, 711, 2697, 8009, 29922, 29896, 30004, 13, 30004, 13, 4706, 396, 7106, 7700, 565, 445, 7636, 508, 367, 11132, 29889, 2401, 3687, 304, 599, 788, 23894, 29930, 3519, 22993, 13, 4706, 822, 788, 23894, 29898, 12864, 29897, 1599, 6120, 29901, 30004, 13, 9651, 518, 29873, 29892, 325, 29896, 29892, 325, 29906, 13192, 12864, 30004, 13, 9651, 565, 260, 1360, 29941, 29901, 30004, 13, 18884, 671, 29896, 29922, 1202, 23894, 2831, 877, 284, 625, 742, 7636, 8443, 13, 18884, 671, 29906, 29922, 1202, 23894, 2831, 877, 29890, 711, 742, 7636, 8443, 13, 18884, 736, 671, 29896, 470, 671, 29906, 30004, 13, 9651, 25342, 260, 1360, 29896, 29901, 30004, 13, 18884, 736, 788, 23894, 2831, 877, 284, 625, 742, 7636, 8443, 13, 9651, 1683, 29901, 30004, 13, 18884, 736, 788, 23894, 2831, 877, 29890, 711, 742, 7636, 8443, 13, 30004, 13, 4706, 822, 788, 23894, 2831, 29898, 978, 29892, 7636, 1125, 30004, 13, 9651, 1661, 2997, 394, 625, 2697, 8009, 30004, 13, 9651, 1661, 2997, 289, 711, 2697, 8009, 30004, 13, 9651, 518, 29873, 29892, 325, 29896, 29892, 325, 29906, 13192, 12864, 30004, 13, 9651, 16669, 29922, 284, 625, 6116, 1573, 30004, 13, 9651, 325, 2697, 29922, 284, 625, 2697, 30004, 13, 9651, 731, 8009, 29922, 284, 625, 2697, 8009, 30004, 13, 9651, 565, 1024, 1360, 29915, 29890, 711, 2396, 30004, 13, 18884, 16669, 29922, 29890, 711, 6116, 1573, 30004, 13, 18884, 325, 2697, 29922, 29890, 711, 2697, 30004, 13, 18884, 731, 8009, 29922, 29890, 711, 2697, 8009, 30004, 13, 9651, 6756, 13, 9651, 565, 16669, 29961, 29894, 29896, 29962, 1360, 1730, 1573, 29961, 29894, 29906, 5387, 30004, 13, 18884, 565, 16669, 29961, 29894, 29896, 29962, 19216, 29900, 29901, 30004, 13, 462, 1678, 736, 7700, 30004, 13, 18884, 16669, 29961, 29894, 29896, 13192, 842, 8009, 30004, 13, 18884, 16669, 29961, 29894, 29906, 13192, 842, 8009, 30004, 13, 18884, 325, 2697, 29961, 842, 8009, 29962, 11759, 29894, 29896, 29892, 325, 29906, 29962, 30004, 13, 18884, 565, 1024, 1360, 29915, 284, 625, 2396, 30004, 13, 462, 1678, 394, 625, 2697, 8009, 23661, 29896, 30004, 13, 18884, 1683, 29901, 30004, 13, 462, 1678, 289, 711, 2697, 8009, 23661, 29896, 30004, 13, 9651, 25342, 16669, 29961, 29894, 29896, 29962, 1360, 29900, 29901, 30004, 13, 18884, 16669, 29961, 29894, 29896, 13192, 1730, 1573, 29961, 29894, 29906, 29962, 30004, 13, 18884, 325, 2697, 29961, 1730, 1573, 29961, 29894, 29896, 29962, 1822, 4397, 29898, 29894, 29896, 8443, 13, 9651, 25342, 16669, 29961, 29894, 29906, 29962, 1360, 29900, 29901, 30004, 13, 18884, 16669, 29961, 29894, 29906, 13192, 1730, 1573, 29961, 29894, 29896, 29962, 30004, 13, 18884, 325, 2697, 29961, 1730, 1573, 29961, 29894, 29906, 29962, 1822, 4397, 29898, 29894, 29906, 8443, 13, 9651, 1683, 29901, 30004, 13, 18884, 731, 29896, 29922, 1730, 1573, 29961, 29894, 29896, 29962, 30004, 13, 18884, 731, 29906, 29922, 1730, 1573, 29961, 29894, 29906, 29962, 30004, 13, 18884, 363, 921, 297, 325, 2697, 29961, 842, 29906, 5387, 30004, 13, 462, 1678, 16669, 29961, 29916, 13192, 842, 29896, 30004, 13, 18884, 325, 2697, 29961, 842, 29896, 1822, 21843, 29898, 29894, 2697, 29961, 842, 29906, 2314, 30004, 13, 18884, 628, 325, 2697, 29961, 842, 29906, 29962, 30004, 13, 9651, 736, 5852, 30004, 13, 4706, 6756, 13, 4706, 363, 7636, 297, 12770, 29901, 30004, 13, 9651, 565, 7636, 29961, 29900, 29962, 1360, 29941, 29901, 30004, 13, 18884, 565, 451, 788, 23894, 29898, 12864, 1125, 30004, 13, 462, 1678, 1234, 23661, 29896, 30004, 13, 4706, 363, 7636, 297, 12770, 29901, 30004, 13, 9651, 565, 7636, 29961, 29900, 29962, 19216, 29941, 29901, 30004, 13, 18884, 565, 451, 788, 23894, 29898, 12864, 1125, 30004, 13, 462, 1678, 1234, 23661, 29896, 30004, 13, 30004, 13, 4706, 565, 7431, 4197, 29916, 363, 921, 297, 394, 625, 6116, 1573, 29961, 29896, 17531, 565, 921, 1360, 29900, 2314, 19216, 29900, 470, 7431, 4197, 29916, 363, 921, 297, 289, 711, 6116, 1573, 29961, 29896, 17531, 565, 921, 1360, 29900, 2314, 19216, 29900, 29901, 30004, 13, 9651, 736, 448, 29896, 30004, 13, 4706, 736, 1234, 2 ]
setup.py
timmartin19/turbogears
0
192678
<reponame>timmartin19/turbogears<filename>setup.py from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages import sys import os if sys.version_info < (2, 3): raise SystemExit("TurboGears 1.0 requires Python 2.3 or later.") elif sys.version_info >= (2, 7): # The main problem here is RuleDispatch. # TurboGears 1.1 uses PEAK-Rules instead. import warnings warnings.warn("TurboGears 1.0.11.2 does not support Python 2.7 or later." "\nYou should upgrade to TurboGears 1.1 or later.") # import meta data (version, author etc.) execfile(os.path.join("turbogears", "release.py")) # setup params install_requires = [ "CherryPy >= 2.3.0, < 3.0dev", "ConfigObj >= 4.3.2", "DecoratorTools >= 1.4", "FormEncode >= 0.7.1", "newrelic >= 2.32", "PasteScript >= 1.6.2", #"RuleDispatch >= 0.5a0.dev-r2303", "setuptools >= 0.6c2", "simplejson >= 1.3", "TurboCheetah >= 1.0", # TurboJson >= 1.2 uses PEAK-Rules "TurboJson >= 1.3.2", "TurboKid >= 1.0.5", "memory_profiler >= 0.52.0", "fluent-logger >= 0.4.4", "psutil == 5.4.3", "Pympler >= 0.5" ] exp = ["TGFastData"] future = [ "Elixir >= 0.4.0", "Genshi >= 0.4.4", ] testtools = [ "nose >= 0.9.3", ] tgtesttools = testtools if sys.version_info < (2, 5): # simplejson >= 2.1 does not support Py 2.4 install_requires[install_requires.index( "simplejson >= 1.3")] += ", < 2.1dev" # Python < 2.5 does not include SQLite tgtesttools.append("pysqlite < 2.6dev") if sys.version_info < (2, 4): # FormEcode >= 1.3 does not support Py 2.3 install_requires[install_requires.index( "FormEncode >= 0.7.1")] += ", < 1.3dev" # Genshi >= 0.5 does not support Py 2.3 future[future.index( "Genshi >= 0.4.4")] += ", < 0.5dev" sqlobject = [ # SQLObject >= 0.11 does not support Py 2.3 "SQLObject >= 0.10.1, < 0.11dev", ] sqlalchemy = [ # SQLAlchemy >= 0.5 does not support Py 2.3 "SQLAlchemy >= 0.3.10, < 0.5dev", ] else: sqlobject = [ "SQLObject >= 0.10.1, < 0.12dev", ] sqlalchemy = [ "SQLAlchemy >= 0.3.10, < 0.6dev", ] develop_requires = (install_requires + future + tgtesttools + sqlalchemy + sqlobject) setup( name="TurboGears", description=description, long_description=long_description, version=version, author=author, author_email=email, maintainer=maintainer, maintainer_email=maintainer_email, url=url, download_url=download_url, dependency_links=[ '<EMAIL>:OnShift/RuleDispatch.git@master#egg=RuleDispatch-dev', ], license=license, zip_safe=False, install_requires=install_requires, packages=find_packages(), include_package_data=True, exclude_package_data={"thirdparty": ["*"]}, entry_points=""" [console_scripts] tg-admin = turbogears.command:main [distutils.commands] docs = turbogears.docgen:GenSite [paste.paster_create_template] tgbase = turbogears.command.quickstart:BaseTemplate turbogears = turbogears.command.quickstart:TurbogearsTemplate tgbig = turbogears.command.quickstart:TGBig tgwidget = turbogears.command.quickstart:TGWidgetTemplate [turbogears.command] quickstart = turbogears.command.quickstart:quickstart sql = turbogears.command.base:SQL shell = turbogears.command.base:Shell toolbox = turbogears.command.base:ToolboxCommand update = turbogears.command.quickstart:update i18n = turbogears.command.i18n:InternationalizationTool info = turbogears.command.info:InfoCommand [turbogears.identity.provider] sqlobject = turbogears.identity.soprovider:SqlObjectIdentityProvider sqlalchemy= turbogears.identity.saprovider:SqlAlchemyIdentityProvider [turbogears.extensions] identity = turbogears.identity.visitor visit = turbogears.visit [turbogears.visit.manager] sqlobject = turbogears.visit.sovisit:SqlObjectVisitManager sqlalchemy = turbogears.visit.savisit:SqlAlchemyVisitManager [turbogears.toolboxcommand] widgets = turbogears.toolbox.base:WidgetBrowser shell = turbogears.toolbox.shell:WebConsole admi18n = turbogears.toolbox.admi18n:Internationalization designer = turbogears.toolbox.designer:Designer info = turbogears.toolbox.base:Info catwalk = turbogears.toolbox.catwalk:CatWalk """, extras_require={ "exp" : exp, "sqlobject" : sqlobject, "sqlalchemy" : sqlalchemy, "future" : future, "testtools" : testtools, "tgtesttools" : tgtesttools, "develop" : develop_requires }, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Software Development :: Libraries :: Python Modules'], test_suite='nose.collector', )
[ 1, 529, 276, 1112, 420, 29958, 29873, 6727, 442, 262, 29896, 29929, 29914, 29873, 9265, 468, 15451, 29966, 9507, 29958, 14669, 29889, 2272, 13, 3166, 20803, 29918, 14669, 1053, 671, 29918, 842, 21245, 8789, 13, 1509, 29918, 842, 21245, 8789, 580, 13, 3166, 731, 21245, 8789, 1053, 6230, 29892, 1284, 29918, 8318, 13, 13, 5215, 10876, 13, 5215, 2897, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 529, 313, 29906, 29892, 29871, 29941, 1125, 13, 1678, 12020, 2184, 24365, 703, 29911, 332, 833, 29954, 15451, 29871, 29896, 29889, 29900, 6858, 5132, 29871, 29906, 29889, 29941, 470, 2678, 23157, 13, 23681, 10876, 29889, 3259, 29918, 3888, 6736, 313, 29906, 29892, 29871, 29955, 1125, 13, 1678, 396, 450, 1667, 1108, 1244, 338, 27308, 14777, 29889, 13, 1678, 396, 5383, 833, 29954, 15451, 29871, 29896, 29889, 29896, 3913, 349, 29923, 22311, 29899, 29934, 2540, 2012, 29889, 13, 1678, 1053, 18116, 13, 1678, 18116, 29889, 25442, 703, 29911, 332, 833, 29954, 15451, 29871, 29896, 29889, 29900, 29889, 29896, 29896, 29889, 29906, 947, 451, 2304, 5132, 29871, 29906, 29889, 29955, 470, 2678, 1213, 13, 4706, 6634, 29876, 3492, 881, 14955, 304, 5383, 833, 29954, 15451, 29871, 29896, 29889, 29896, 470, 2678, 23157, 13, 13, 29937, 1053, 12700, 848, 313, 3259, 29892, 4148, 2992, 1846, 13, 4258, 1445, 29898, 359, 29889, 2084, 29889, 7122, 703, 29873, 9265, 468, 15451, 613, 376, 14096, 29889, 2272, 5783, 13, 13, 29937, 6230, 8636, 13, 6252, 29918, 276, 339, 2658, 353, 518, 13, 1678, 376, 1451, 261, 719, 19737, 6736, 29871, 29906, 29889, 29941, 29889, 29900, 29892, 529, 29871, 29941, 29889, 29900, 3359, 613, 13, 1678, 376, 3991, 9930, 6736, 29871, 29946, 29889, 29941, 29889, 29906, 613, 13, 1678, 376, 6185, 272, 1061, 24183, 6736, 29871, 29896, 29889, 29946, 613, 13, 1678, 376, 2500, 2369, 401, 6736, 29871, 29900, 29889, 29955, 29889, 29896, 613, 13, 1678, 376, 1482, 276, 506, 6736, 29871, 29906, 29889, 29941, 29906, 613, 13, 1678, 376, 29925, 4350, 4081, 6736, 29871, 29896, 29889, 29953, 29889, 29906, 613, 13, 1678, 396, 29908, 10740, 14777, 6736, 29871, 29900, 29889, 29945, 29874, 29900, 29889, 3359, 29899, 29878, 29906, 29941, 29900, 29941, 613, 13, 1678, 376, 842, 21245, 8789, 6736, 29871, 29900, 29889, 29953, 29883, 29906, 613, 13, 1678, 376, 12857, 3126, 6736, 29871, 29896, 29889, 29941, 613, 13, 1678, 376, 29911, 332, 833, 29907, 4155, 801, 6736, 29871, 29896, 29889, 29900, 613, 13, 1678, 396, 5383, 833, 8148, 6736, 29871, 29896, 29889, 29906, 3913, 349, 29923, 22311, 29899, 29934, 2540, 13, 1678, 376, 29911, 332, 833, 8148, 6736, 29871, 29896, 29889, 29941, 29889, 29906, 613, 13, 1678, 376, 29911, 332, 833, 29968, 333, 6736, 29871, 29896, 29889, 29900, 29889, 29945, 613, 13, 1678, 376, 14834, 29918, 771, 1777, 261, 6736, 29871, 29900, 29889, 29945, 29906, 29889, 29900, 613, 13, 1678, 376, 1579, 8122, 29899, 21707, 6736, 29871, 29900, 29889, 29946, 29889, 29946, 613, 13, 1678, 376, 567, 4422, 1275, 29871, 29945, 29889, 29946, 29889, 29941, 613, 13, 1678, 376, 29925, 962, 20069, 6736, 29871, 29900, 29889, 29945, 29908, 13, 29962, 13, 13, 4548, 353, 6796, 29911, 29954, 29943, 579, 1469, 3108, 13, 13, 29888, 9130, 353, 518, 13, 1678, 376, 29923, 492, 29916, 381, 6736, 29871, 29900, 29889, 29946, 29889, 29900, 613, 13, 1678, 376, 29954, 575, 2918, 6736, 29871, 29900, 29889, 29946, 29889, 29946, 613, 13, 29962, 13, 13, 1688, 8504, 353, 29871, 518, 13, 1678, 376, 29876, 852, 6736, 29871, 29900, 29889, 29929, 29889, 29941, 613, 13, 29962, 13, 13, 29873, 29887, 1688, 8504, 353, 1243, 8504, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 529, 313, 29906, 29892, 29871, 29945, 1125, 13, 1678, 396, 2560, 3126, 6736, 29871, 29906, 29889, 29896, 947, 451, 2304, 10772, 29871, 29906, 29889, 29946, 13, 1678, 2601, 29918, 276, 339, 2658, 29961, 6252, 29918, 276, 339, 2658, 29889, 2248, 29898, 13, 4706, 376, 12857, 3126, 6736, 29871, 29896, 29889, 29941, 13531, 4619, 9162, 529, 29871, 29906, 29889, 29896, 3359, 29908, 13, 1678, 396, 5132, 529, 29871, 29906, 29889, 29945, 947, 451, 3160, 23299, 13, 1678, 260, 29887, 1688, 8504, 29889, 4397, 703, 29886, 952, 1519, 568, 529, 29871, 29906, 29889, 29953, 3359, 1159, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 529, 313, 29906, 29892, 29871, 29946, 1125, 13, 1678, 396, 3812, 29923, 401, 6736, 29871, 29896, 29889, 29941, 947, 451, 2304, 10772, 29871, 29906, 29889, 29941, 13, 1678, 2601, 29918, 276, 339, 2658, 29961, 6252, 29918, 276, 339, 2658, 29889, 2248, 29898, 13, 4706, 376, 2500, 2369, 401, 6736, 29871, 29900, 29889, 29955, 29889, 29896, 13531, 4619, 9162, 529, 29871, 29896, 29889, 29941, 3359, 29908, 13, 1678, 396, 402, 575, 2918, 6736, 29871, 29900, 29889, 29945, 947, 451, 2304, 10772, 29871, 29906, 29889, 29941, 13, 1678, 5434, 29961, 29888, 9130, 29889, 2248, 29898, 13, 4706, 376, 29954, 575, 2918, 6736, 29871, 29900, 29889, 29946, 29889, 29946, 13531, 4619, 9162, 529, 29871, 29900, 29889, 29945, 3359, 29908, 13, 1678, 18074, 417, 1675, 353, 518, 13, 4706, 396, 3758, 2061, 6736, 29871, 29900, 29889, 29896, 29896, 947, 451, 2304, 10772, 29871, 29906, 29889, 29941, 13, 4706, 376, 4176, 2061, 6736, 29871, 29900, 29889, 29896, 29900, 29889, 29896, 29892, 529, 29871, 29900, 29889, 29896, 29896, 3359, 613, 13, 4706, 4514, 13, 1678, 4576, 284, 305, 6764, 353, 518, 13, 4706, 396, 3758, 2499, 305, 6764, 6736, 29871, 29900, 29889, 29945, 947, 451, 2304, 10772, 29871, 29906, 29889, 29941, 13, 4706, 376, 4176, 2499, 305, 6764, 6736, 29871, 29900, 29889, 29941, 29889, 29896, 29900, 29892, 529, 29871, 29900, 29889, 29945, 3359, 613, 13, 4706, 4514, 13, 2870, 29901, 13, 1678, 18074, 417, 1675, 353, 518, 13, 4706, 376, 4176, 2061, 6736, 29871, 29900, 29889, 29896, 29900, 29889, 29896, 29892, 529, 29871, 29900, 29889, 29896, 29906, 3359, 613, 13, 1678, 4514, 13, 1678, 4576, 284, 305, 6764, 353, 518, 13, 4706, 376, 4176, 2499, 305, 6764, 6736, 29871, 29900, 29889, 29941, 29889, 29896, 29900, 29892, 529, 29871, 29900, 29889, 29953, 3359, 613, 13, 1678, 4514, 13, 13, 4888, 29918, 276, 339, 2658, 353, 313, 6252, 29918, 276, 339, 2658, 13, 1678, 718, 5434, 718, 260, 29887, 1688, 8504, 718, 4576, 284, 305, 6764, 718, 18074, 417, 1675, 29897, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 29911, 332, 833, 29954, 15451, 613, 13, 1678, 6139, 29922, 8216, 29892, 13, 1678, 1472, 29918, 8216, 29922, 5426, 29918, 8216, 29892, 13, 1678, 1873, 29922, 3259, 29892, 13, 1678, 4148, 29922, 8921, 29892, 13, 1678, 4148, 29918, 5269, 29922, 5269, 29892, 13, 1678, 7344, 261, 29922, 29885, 2365, 4008, 29892, 13, 1678, 7344, 261, 29918, 5269, 29922, 29885, 2365, 4008, 29918, 5269, 29892, 13, 1678, 3142, 29922, 2271, 29892, 13, 1678, 5142, 29918, 2271, 29922, 10382, 29918, 2271, 29892, 13, 1678, 10609, 29918, 4965, 11759, 13, 4706, 12801, 26862, 6227, 23917, 2951, 29657, 29914, 10740, 14777, 29889, 5559, 29992, 6207, 29937, 387, 29887, 29922, 10740, 14777, 29899, 3359, 742, 13, 1678, 21251, 13, 1678, 19405, 29922, 506, 1947, 29892, 13, 1678, 14319, 29918, 11177, 29922, 8824, 29892, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 6252, 29918, 276, 339, 2658, 29892, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 1678, 19060, 29918, 5113, 29918, 1272, 3790, 29908, 22585, 22633, 1115, 6796, 29930, 3108, 1118, 13, 1678, 6251, 29918, 9748, 13776, 29908, 13, 1678, 518, 11058, 29918, 16713, 29962, 13, 1678, 260, 29887, 29899, 6406, 353, 7013, 29890, 468, 15451, 29889, 6519, 29901, 3396, 13, 13, 1678, 518, 5721, 13239, 29889, 26381, 29962, 13, 1678, 10561, 353, 7013, 29890, 468, 15451, 29889, 1514, 1885, 29901, 15462, 17033, 13, 13, 1678, 518, 16179, 29889, 29886, 1901, 29918, 3258, 29918, 6886, 29962, 13, 1678, 260, 29887, 3188, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 24561, 2962, 29901, 5160, 6733, 13, 1678, 7013, 29890, 468, 15451, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 24561, 2962, 29901, 29911, 9265, 468, 15451, 6733, 13, 1678, 260, 29887, 3752, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 24561, 2962, 29901, 29911, 29954, 6970, 13, 1678, 260, 29887, 8030, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 24561, 2962, 29901, 29911, 29954, 8801, 6733, 13, 13, 1678, 518, 29873, 9265, 468, 15451, 29889, 6519, 29962, 13, 1678, 4996, 2962, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 24561, 2962, 29901, 24561, 2962, 13, 1678, 4576, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 3188, 29901, 4176, 13, 1678, 6473, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 3188, 29901, 16037, 13, 1678, 5780, 1884, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 3188, 29901, 12229, 1884, 6255, 13, 1678, 2767, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 24561, 2962, 29901, 5504, 13, 1678, 474, 29896, 29947, 29876, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 29875, 29896, 29947, 29876, 29901, 17579, 1288, 2133, 12229, 13, 1678, 5235, 353, 7013, 29890, 468, 15451, 29889, 6519, 29889, 3888, 29901, 3401, 6255, 13, 13, 1678, 518, 29873, 9265, 468, 15451, 29889, 22350, 29889, 18121, 29962, 13, 1678, 18074, 417, 1675, 353, 7013, 29890, 468, 15451, 29889, 22350, 29889, 29879, 26555, 5489, 29901, 10520, 2061, 18415, 6980, 13, 1678, 4576, 284, 305, 6764, 29922, 7013, 29890, 468, 15451, 29889, 22350, 29889, 29879, 481, 307, 5489, 29901, 10520, 2499, 305, 6764, 18415, 6980, 13, 13, 1678, 518, 29873, 9265, 468, 15451, 29889, 24299, 29962, 13, 1678, 10110, 353, 7013, 29890, 468, 15451, 29889, 22350, 29889, 1730, 2105, 13, 1678, 6493, 353, 7013, 29890, 468, 15451, 29889, 1730, 277, 13, 13, 1678, 518, 29873, 9265, 468, 15451, 29889, 1730, 277, 29889, 12847, 29962, 13, 1678, 18074, 417, 1675, 353, 7013, 29890, 468, 15451, 29889, 1730, 277, 29889, 578, 1730, 277, 29901, 10520, 2061, 6116, 277, 3260, 13, 1678, 4576, 284, 305, 6764, 353, 7013, 29890, 468, 15451, 29889, 1730, 277, 29889, 29879, 485, 275, 277, 29901, 10520, 2499, 305, 6764, 6116, 277, 3260, 13, 13, 1678, 518, 29873, 9265, 468, 15451, 29889, 10154, 1884, 6519, 29962, 13, 1678, 11109, 29879, 353, 7013, 29890, 468, 15451, 29889, 10154, 1884, 29889, 3188, 29901, 8801, 21537, 13, 1678, 6473, 353, 7013, 29890, 468, 15451, 29889, 10154, 1884, 29889, 15903, 29901, 3609, 20008, 13, 1678, 594, 2460, 29896, 29947, 29876, 353, 7013, 29890, 468, 15451, 29889, 10154, 1884, 29889, 328, 2460, 29896, 29947, 29876, 29901, 17579, 1288, 2133, 13, 1678, 23383, 353, 7013, 29890, 468, 15451, 29889, 10154, 1884, 29889, 13892, 261, 29901, 4002, 21216, 13, 1678, 5235, 353, 7013, 29890, 468, 15451, 29889, 10154, 1884, 29889, 3188, 29901, 3401, 13, 1678, 6635, 20919, 353, 7013, 29890, 468, 15451, 29889, 10154, 1884, 29889, 4117, 20919, 29901, 9694, 29956, 2235, 13, 13, 1678, 5124, 613, 13, 1678, 429, 10678, 29918, 12277, 3790, 13, 4706, 376, 4548, 29908, 584, 1518, 29892, 13, 4706, 376, 3044, 417, 1675, 29908, 584, 18074, 417, 1675, 29892, 13, 4706, 376, 2850, 284, 305, 6764, 29908, 584, 4576, 284, 305, 6764, 29892, 13, 4706, 376, 29888, 9130, 29908, 584, 5434, 29892, 13, 4706, 376, 1688, 8504, 29908, 584, 1243, 8504, 29892, 13, 4706, 376, 29873, 29887, 1688, 8504, 29908, 584, 260, 29887, 1688, 8504, 29892, 13, 4706, 376, 4888, 29908, 584, 2693, 29918, 276, 339, 2658, 13, 1678, 2981, 13, 1678, 770, 14903, 11759, 13, 4706, 525, 21956, 358, 16034, 4761, 29871, 29945, 448, 19561, 29914, 855, 519, 742, 13, 4706, 525, 18649, 4761, 9405, 742, 13, 4706, 525, 2928, 2760, 319, 4749, 663, 4761, 10682, 414, 742, 13, 4706, 525, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 742, 13, 4706, 525, 7094, 1218, 2184, 4761, 6570, 25266, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 742, 13, 4706, 525, 7031, 293, 4761, 18540, 14650, 4761, 365, 4626, 4314, 4761, 5132, 3382, 2540, 7464, 13, 1678, 1243, 29918, 13495, 2433, 29876, 852, 29889, 15914, 272, 742, 13, 29897, 13, 2 ]
tests/0_orchestrator/test_suite/testcases/advanced_tests/test04_etcd.py
5l1v3r1/0-orchestrator
3
108273
<filename>tests/0_orchestrator/test_suite/testcases/advanced_tests/test04_etcd.py<gh_stars>1-10 import random, time from testcases.testcases_base import TestcasesBase import unittest class Test_etcd(TestcasesBase): def setUp(self): super().setUp() number_of_free_disks, disk_type = self.get_max_available_free_disks([self.nodeid]) storageclusters = self.storageclusters_api.get_storageclusters() if storageclusters.json() == []: if number_of_free_disks == []: self.skipTest(' [*] No free disks to create storagecluster') self.lg.info(' [*] Deploy new storage cluster (SC0)') response, data = self.storageclusters_api.post_storageclusters( nodes=[self.nodeid], driveType=disk_type, servers=random.randint(1, number_of_free_disks) ) self.assertEqual(response.status_code, 201) self.storagecluster = data['label'] else: self.storagecluster = storageclusters.json()[0] self.lg.info(' [*] Create vdiskstorage (VDS0)') response, self.vdiskstoragedata = self.vdisks_api.post_vdiskstorage(storagecluster=self.storagecluster) self.assertEqual(response.status_code, 201) self.lg.info(' [*] Import Image (IMG0) for (VDS0)') response, self.imagedata = self.vdisks_api.post_import_image(vdiskstorageid=self.vdiskstoragedata["id"]) self.assertEqual(response.status_code, 201) self.lg.info(' [*] Create vdisk (VD0)') response, self.vdisk = self.vdisks_api.post_vdisks(vdiskstorageid=self.vdiskstoragedata["id"], imageid=self.imagedata["imageName"]) self.assertEqual(response.status_code, 201) self.disks = [{"vdiskid": self.vdisk['id'], "maxIOps": 2000}] self.lg.info('[*]Get number of nodes (n)') self.number_of_nodes = len(self.nodes_info) self.lg.info('[*] Check that etcd process is running in n of nodes if n odd,and (n-1) of nodes if n even') self.nodes_with_etcd=[] for node in self.nodes_info: node_client = self.Client(node["ip"], password=self.jwt) response = node_client.client.bash("ps xu | grep [e]tcd").get() if response.state == "SUCCESS": self.nodes_with_etcd.append(node) if len(self.nodes_info)%2 == 0: self.lg.info("[*]number of nodes even") self.assertEqual(len(self.nodes_with_etcd), self.number_of_nodes-1) else: self.lg.info("[*]number of nodes odd") self.assertEqual(len(self.nodes_with_etcd), self.number_of_nodes) def test001_kill_etcdcluster_less_than_tolerance(self): """ GAT-150 **Test Scenario:** #. Check that etcd process is running in all nodes if number of nodes odd. #. Check that etcd process is running in (n-1) nodes if number of nodes even. #. Kill etcd_cluster in less than or equal (n-1)/2 nodes ,should succeed. #. Check that etcd process return back in this nodes, should succeed. #. Create (VM0),should succeed. #. Get (VM0) details ,(VM0) status should be running. """ self.lg.info(" Kill etcd_cluster in less than (n-1)/2 nodes") tolerance = int((len(self.nodes_with_etcd)-1)/2) for i in range(tolerance): node_client = self.Client(self.nodes_with_etcd[i]["ip"], password=self.jwt) response = node_client.client.bash("ps xu | grep [e]tcd | awk '{ print $1 }'").get() self.assertEqual(response.state, "SUCCESS") response = node_client.client.bash(" kill -9 %s"%response.stdout).get() self.assertEqual(response.state, "SUCCESS") self.lg.info(" Check that etcd process return back in this nodes, should succeed. ") for i in range(tolerance): for _ in range(5): time.sleep(5) node_client = self.Client(self.nodes_with_etcd[i]["ip"], password=self.jwt) response = node_client.client.bash("ps xu | grep [e]tcd | awk '{ print $1 }'").get() if response.stdout == " ": continue break else: self.assertTrue(False, "etcd_cluster doesn't work again for node %s"%self.nodes_with_etcd[i]["id"]) self.lg.info("Create (VM0),should succeed.") self.response, self.data = self.vms_api.post_nodes_vms(node_id=self.nodeid, disks=self.disks) self.assertEqual(self.response.status_code, 201) self.lg.info("Get (VM0) details ,(VM0) status should be running.") for _ in range(20): response = self.vms_api.get_nodes_vms_vmid(self.nodeid, self.data['id']) self.assertEqual(response.status_code, 200) status = response.json()['status'] if status == 'running': break else: time.sleep(3) else: self.assertEqual(response.json()['status'], 'running', " [*] can't start vm.") @unittest.skip("https://github.com/zero-os/0-orchestrator/issues/1196") def test002_kill_etcdcluster_more_than_tolerance(self): """ GAT-151 **Test Scenario:** #. Check that etcd process run in all nodes if number of nodes odd. #. Check that etcd process run in (n-1) nodes if number of nodes even. #. kill etcd process in more than (n-1)/2 nodes ,should succeed. #. Check that etcd process recovered in same numbers of nodes before killing etcd. #. Create (VM0),should succeed. #. Get (VM0) details ,(VM0) status should be running. """ self.lg.info(" Kill etcd process in more than (n-1)/2 nodes") tolerance = int((len(self.nodes_with_etcd)-1)/2) for i in range(tolerance+1): node_client = self.Client(self.nodes_with_etcd[i]["ip"], password=self.jwt) response = node_client.client.bash("ps xu | grep [e]tcd | awk '{ print $1 }'").get() self.assertEqual(response.state, "SUCCESS") response = node_client.client.bash(" kill -9 %s"%response.stdout).get() self.assertEqual(response.state, "SUCCESS") self.lg.info(" Check that etcd process recovered in same numbers of nodes before killing etcd") recoverd_etcd = [] for i in range(self.number_of_nodes): node_client = self.Client(self.nodes_info[i]["ip"], password=<PASSWORD>) for _ in range(5): time.sleep(5) response = node_client.client.bash("ps xu | grep [e]tcd | grep [r]ecovered ").get() if "recovered" not in response.stdout: continue recoverd_etcd.append(self.nodes_info[i]) break if (len(recoverd_etcd) == len(self.nodes_with_etcd)): break else: self.assertEqual(len(recoverd_etcd), len(self.nodes_with_etcd)) self.lg.info("Create (VM0),should succeed.") self.response, self.data = self.vms_api.post_nodes_vms(node_id=self.nodeid, memory=1024, cpu=1, disks=self.disks) self.assertEqual(self.response.status_code, 201) self.lg.info("Get (VM0) details ,(VM0) status should be running.") for _ in range(20): response = self.vms_api.get_nodes_vms_vmid(self.nodeid, self.data['id']) self.assertEqual(response.status_code, 200) status = response.json()['status'] if status == 'running': break else: time.sleep(3) else: self.assertEqual(response.json()['status'], 'running', " [*] can't start vm.")
[ 1, 529, 9507, 29958, 21150, 29914, 29900, 29918, 25350, 16444, 1061, 29914, 1688, 29918, 13495, 29914, 1688, 11436, 29914, 328, 16858, 29918, 21150, 29914, 1688, 29900, 29946, 29918, 300, 2252, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 4036, 29892, 931, 13, 3166, 1243, 11436, 29889, 1688, 11436, 29918, 3188, 1053, 4321, 11436, 5160, 13, 5215, 443, 27958, 13, 13, 13, 1990, 4321, 29918, 300, 2252, 29898, 3057, 11436, 5160, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 2141, 842, 3373, 580, 13, 4706, 1353, 29918, 974, 29918, 9021, 29918, 2218, 2039, 29892, 8086, 29918, 1853, 353, 1583, 29889, 657, 29918, 3317, 29918, 16515, 29918, 9021, 29918, 2218, 2039, 4197, 1311, 29889, 3177, 333, 2314, 13, 4706, 8635, 695, 504, 414, 353, 1583, 29889, 12925, 695, 504, 414, 29918, 2754, 29889, 657, 29918, 12925, 695, 504, 414, 580, 13, 13, 4706, 565, 8635, 695, 504, 414, 29889, 3126, 580, 1275, 5159, 29901, 13, 9651, 565, 1353, 29918, 974, 29918, 9021, 29918, 2218, 2039, 1275, 5159, 29901, 13, 18884, 1583, 29889, 11014, 3057, 877, 518, 29930, 29962, 1939, 3889, 766, 2039, 304, 1653, 8635, 19594, 1495, 13, 13, 9651, 1583, 29889, 19920, 29889, 3888, 877, 518, 29930, 29962, 10034, 2376, 716, 8635, 9867, 313, 7187, 29900, 29897, 1495, 13, 9651, 2933, 29892, 848, 353, 1583, 29889, 12925, 695, 504, 414, 29918, 2754, 29889, 2490, 29918, 12925, 695, 504, 414, 29898, 13, 18884, 7573, 11759, 1311, 29889, 3177, 333, 1402, 13, 18884, 7899, 1542, 29922, 20960, 29918, 1853, 29892, 13, 18884, 12424, 29922, 8172, 29889, 9502, 524, 29898, 29896, 29892, 1353, 29918, 974, 29918, 9021, 29918, 2218, 2039, 29897, 13, 9651, 1723, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29896, 29897, 13, 9651, 1583, 29889, 12925, 19594, 353, 848, 1839, 1643, 2033, 13, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 12925, 19594, 353, 8635, 695, 504, 414, 29889, 3126, 580, 29961, 29900, 29962, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 877, 518, 29930, 29962, 6204, 325, 20960, 12925, 313, 29963, 8452, 29900, 29897, 1495, 13, 4706, 2933, 29892, 1583, 29889, 29894, 20960, 28957, 4063, 532, 353, 1583, 29889, 29894, 2218, 2039, 29918, 2754, 29889, 2490, 29918, 29894, 20960, 12925, 29898, 12925, 19594, 29922, 1311, 29889, 12925, 19594, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29896, 29897, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 877, 518, 29930, 29962, 16032, 7084, 313, 7833, 29954, 29900, 29897, 363, 313, 29963, 8452, 29900, 29897, 1495, 13, 4706, 2933, 29892, 1583, 29889, 326, 4063, 532, 353, 1583, 29889, 29894, 2218, 2039, 29918, 2754, 29889, 2490, 29918, 5215, 29918, 3027, 29898, 29894, 20960, 12925, 333, 29922, 1311, 29889, 29894, 20960, 28957, 4063, 532, 3366, 333, 20068, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29896, 29897, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 877, 518, 29930, 29962, 6204, 325, 20960, 313, 10699, 29900, 29897, 1495, 13, 4706, 2933, 29892, 1583, 29889, 29894, 20960, 353, 1583, 29889, 29894, 2218, 2039, 29918, 2754, 29889, 2490, 29918, 29894, 2218, 2039, 29898, 29894, 20960, 12925, 333, 29922, 1311, 29889, 29894, 20960, 28957, 4063, 532, 3366, 333, 12436, 1967, 333, 29922, 1311, 29889, 326, 4063, 532, 3366, 3027, 1170, 20068, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29896, 29897, 13, 4706, 1583, 29889, 2218, 2039, 353, 518, 6377, 29894, 20960, 333, 1115, 1583, 29889, 29894, 20960, 1839, 333, 7464, 376, 3317, 5971, 567, 1115, 29871, 29906, 29900, 29900, 29900, 6525, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 877, 29961, 29930, 29962, 2577, 1353, 310, 7573, 313, 29876, 29897, 1495, 13, 4706, 1583, 29889, 4537, 29918, 974, 29918, 18010, 353, 7431, 29898, 1311, 29889, 18010, 29918, 3888, 29897, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 877, 29961, 29930, 29962, 5399, 393, 634, 2252, 1889, 338, 2734, 297, 302, 310, 7573, 565, 302, 7736, 29892, 392, 313, 29876, 29899, 29896, 29897, 310, 7573, 565, 302, 1584, 1495, 13, 4706, 1583, 29889, 18010, 29918, 2541, 29918, 300, 2252, 29922, 2636, 13, 4706, 363, 2943, 297, 1583, 29889, 18010, 29918, 3888, 29901, 13, 9651, 2943, 29918, 4645, 353, 1583, 29889, 4032, 29898, 3177, 3366, 666, 12436, 4800, 29922, 1311, 29889, 29926, 14554, 29897, 13, 9651, 2933, 353, 2943, 29918, 4645, 29889, 4645, 29889, 13067, 703, 567, 921, 29884, 891, 12680, 518, 29872, 29962, 29873, 2252, 2564, 657, 580, 13, 9651, 565, 2933, 29889, 3859, 1275, 376, 14605, 26925, 1115, 13, 18884, 1583, 29889, 18010, 29918, 2541, 29918, 300, 2252, 29889, 4397, 29898, 3177, 29897, 13, 4706, 565, 7431, 29898, 1311, 29889, 18010, 29918, 3888, 29897, 29995, 29906, 1275, 29871, 29900, 29901, 13, 9651, 1583, 29889, 19920, 29889, 3888, 703, 29961, 29930, 29962, 4537, 310, 7573, 1584, 1159, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 511, 1583, 29889, 4537, 29918, 974, 29918, 18010, 29899, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 19920, 29889, 3888, 703, 29961, 29930, 29962, 4537, 310, 7573, 7736, 1159, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 511, 1583, 29889, 4537, 29918, 974, 29918, 18010, 29897, 13, 13, 1678, 822, 1243, 29900, 29900, 29896, 29918, 21174, 29918, 300, 2252, 19594, 29918, 2222, 29918, 27603, 29918, 25027, 261, 749, 29898, 1311, 1125, 13, 4706, 9995, 402, 1299, 29899, 29896, 29945, 29900, 13, 4706, 3579, 3057, 2522, 24893, 29901, 1068, 13, 13, 4706, 396, 29889, 5399, 393, 634, 2252, 1889, 338, 2734, 297, 599, 7573, 565, 1353, 310, 7573, 7736, 29889, 13, 4706, 396, 29889, 5399, 393, 634, 2252, 1889, 338, 2734, 297, 313, 29876, 29899, 29896, 29897, 7573, 565, 1353, 310, 7573, 1584, 29889, 13, 4706, 396, 29889, 29021, 634, 2252, 29918, 19594, 297, 3109, 1135, 470, 5186, 313, 29876, 29899, 29896, 6802, 29906, 7573, 1919, 9344, 9269, 29889, 13, 4706, 396, 29889, 5399, 393, 634, 2252, 1889, 736, 1250, 297, 445, 7573, 29892, 881, 9269, 29889, 13, 4706, 396, 29889, 6204, 313, 9219, 29900, 511, 9344, 9269, 29889, 13, 4706, 396, 29889, 3617, 313, 9219, 29900, 29897, 4902, 1919, 29898, 9219, 29900, 29897, 4660, 881, 367, 2734, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 29021, 634, 2252, 29918, 19594, 297, 3109, 1135, 313, 29876, 29899, 29896, 6802, 29906, 7573, 1159, 13, 4706, 20341, 749, 353, 938, 3552, 2435, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 6817, 29896, 6802, 29906, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 25027, 261, 749, 1125, 13, 9651, 2943, 29918, 4645, 353, 1583, 29889, 4032, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 29961, 29875, 29962, 3366, 666, 12436, 4800, 29922, 1311, 29889, 29926, 14554, 29897, 13, 9651, 2933, 353, 2943, 29918, 4645, 29889, 4645, 29889, 13067, 703, 567, 921, 29884, 891, 12680, 518, 29872, 29962, 29873, 2252, 891, 13689, 22372, 1596, 395, 29896, 500, 29915, 2564, 657, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3859, 29892, 376, 14605, 26925, 1159, 13, 9651, 2933, 353, 2943, 29918, 4645, 29889, 4645, 29889, 13067, 703, 12088, 448, 29929, 1273, 29879, 29908, 29995, 5327, 29889, 25393, 467, 657, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3859, 29892, 376, 14605, 26925, 1159, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 5399, 393, 634, 2252, 1889, 736, 1250, 297, 445, 7573, 29892, 881, 9269, 29889, 16521, 13, 4706, 363, 474, 297, 3464, 29898, 25027, 261, 749, 1125, 13, 9651, 363, 903, 297, 3464, 29898, 29945, 1125, 13, 18884, 931, 29889, 17059, 29898, 29945, 29897, 13, 18884, 2943, 29918, 4645, 353, 1583, 29889, 4032, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 29961, 29875, 29962, 3366, 666, 12436, 4800, 29922, 1311, 29889, 29926, 14554, 29897, 13, 18884, 2933, 353, 2943, 29918, 4645, 29889, 4645, 29889, 13067, 703, 567, 921, 29884, 891, 12680, 518, 29872, 29962, 29873, 2252, 891, 13689, 22372, 1596, 395, 29896, 500, 29915, 2564, 657, 580, 13, 18884, 565, 2933, 29889, 25393, 1275, 376, 29242, 13, 462, 1678, 6773, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 9294, 5574, 29898, 8824, 29892, 376, 300, 2252, 29918, 19594, 1838, 29915, 29873, 664, 1449, 363, 2943, 1273, 29879, 29908, 29995, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 29961, 29875, 29962, 3366, 333, 20068, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 4391, 313, 9219, 29900, 511, 9344, 9269, 23157, 13, 4706, 1583, 29889, 5327, 29892, 1583, 29889, 1272, 353, 1583, 29889, 29894, 1516, 29918, 2754, 29889, 2490, 29918, 18010, 29918, 29894, 1516, 29898, 3177, 29918, 333, 29922, 1311, 29889, 3177, 333, 29892, 766, 2039, 29922, 1311, 29889, 2218, 2039, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29896, 29897, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 2577, 313, 9219, 29900, 29897, 4902, 1919, 29898, 9219, 29900, 29897, 4660, 881, 367, 2734, 23157, 13, 4706, 363, 903, 297, 3464, 29898, 29906, 29900, 1125, 13, 9651, 2933, 353, 1583, 29889, 29894, 1516, 29918, 2754, 29889, 657, 29918, 18010, 29918, 29894, 1516, 29918, 29894, 6563, 29898, 1311, 29889, 3177, 333, 29892, 1583, 29889, 1272, 1839, 333, 11287, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 9651, 4660, 353, 2933, 29889, 3126, 580, 1839, 4882, 2033, 13, 9651, 565, 4660, 1275, 525, 21094, 2396, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 931, 29889, 17059, 29898, 29941, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3126, 580, 1839, 4882, 7464, 525, 21094, 742, 376, 518, 29930, 29962, 508, 29915, 29873, 1369, 22419, 23157, 13, 13, 1678, 732, 348, 27958, 29889, 11014, 703, 991, 597, 3292, 29889, 510, 29914, 9171, 29899, 359, 29914, 29900, 29899, 25350, 16444, 1061, 29914, 12175, 29914, 29896, 29896, 29929, 29953, 1159, 13, 1678, 822, 1243, 29900, 29900, 29906, 29918, 21174, 29918, 300, 2252, 19594, 29918, 5514, 29918, 27603, 29918, 25027, 261, 749, 29898, 1311, 1125, 13, 4706, 9995, 402, 1299, 29899, 29896, 29945, 29896, 13, 4706, 3579, 3057, 2522, 24893, 29901, 1068, 13, 13, 4706, 396, 29889, 5399, 393, 634, 2252, 1889, 1065, 297, 599, 7573, 565, 1353, 310, 7573, 7736, 29889, 13, 4706, 396, 29889, 5399, 393, 634, 2252, 1889, 1065, 297, 313, 29876, 29899, 29896, 29897, 7573, 565, 1353, 310, 7573, 1584, 29889, 13, 4706, 396, 29889, 12088, 634, 2252, 1889, 297, 901, 1135, 29871, 313, 29876, 29899, 29896, 6802, 29906, 7573, 1919, 9344, 9269, 29889, 13, 4706, 396, 29889, 5399, 393, 634, 2252, 1889, 24776, 297, 1021, 3694, 310, 7573, 1434, 23393, 634, 2252, 29889, 13, 4706, 396, 29889, 6204, 313, 9219, 29900, 511, 9344, 9269, 29889, 13, 4706, 396, 29889, 3617, 313, 9219, 29900, 29897, 4902, 1919, 29898, 9219, 29900, 29897, 4660, 881, 367, 2734, 29889, 13, 4706, 9995, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 29021, 634, 2252, 1889, 297, 901, 1135, 313, 29876, 29899, 29896, 6802, 29906, 7573, 1159, 13, 4706, 20341, 749, 353, 938, 3552, 2435, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 6817, 29896, 6802, 29906, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 25027, 261, 749, 29974, 29896, 1125, 13, 9651, 2943, 29918, 4645, 353, 1583, 29889, 4032, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 29961, 29875, 29962, 3366, 666, 12436, 4800, 29922, 1311, 29889, 29926, 14554, 29897, 13, 9651, 2933, 353, 2943, 29918, 4645, 29889, 4645, 29889, 13067, 703, 567, 921, 29884, 891, 12680, 518, 29872, 29962, 29873, 2252, 891, 13689, 22372, 1596, 395, 29896, 500, 29915, 2564, 657, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3859, 29892, 376, 14605, 26925, 1159, 13, 9651, 2933, 353, 2943, 29918, 4645, 29889, 4645, 29889, 13067, 703, 12088, 448, 29929, 1273, 29879, 29908, 29995, 5327, 29889, 25393, 467, 657, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3859, 29892, 376, 14605, 26925, 1159, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 5399, 393, 634, 2252, 1889, 24776, 297, 1021, 3694, 310, 7573, 1434, 23393, 634, 2252, 1159, 13, 4706, 9792, 29881, 29918, 300, 2252, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 4537, 29918, 974, 29918, 18010, 1125, 13, 9651, 2943, 29918, 4645, 353, 1583, 29889, 4032, 29898, 1311, 29889, 18010, 29918, 3888, 29961, 29875, 29962, 3366, 666, 12436, 4800, 29922, 29966, 25711, 17013, 12948, 13, 9651, 363, 903, 297, 3464, 29898, 29945, 1125, 13, 18884, 931, 29889, 17059, 29898, 29945, 29897, 13, 18884, 2933, 353, 2943, 29918, 4645, 29889, 4645, 29889, 13067, 703, 567, 921, 29884, 891, 12680, 518, 29872, 29962, 29873, 2252, 891, 12680, 518, 29878, 29962, 687, 957, 287, 376, 467, 657, 580, 13, 18884, 565, 376, 3757, 957, 287, 29908, 451, 297, 2933, 29889, 25393, 29901, 13, 462, 1678, 6773, 13, 18884, 9792, 29881, 29918, 300, 2252, 29889, 4397, 29898, 1311, 29889, 18010, 29918, 3888, 29961, 29875, 2314, 13, 18884, 2867, 13, 13, 9651, 565, 313, 2435, 29898, 3757, 957, 29881, 29918, 300, 2252, 29897, 1275, 7431, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 22164, 13, 18884, 2867, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 3757, 957, 29881, 29918, 300, 2252, 511, 7431, 29898, 1311, 29889, 18010, 29918, 2541, 29918, 300, 2252, 876, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 4391, 313, 9219, 29900, 511, 9344, 9269, 23157, 13, 4706, 1583, 29889, 5327, 29892, 1583, 29889, 1272, 353, 1583, 29889, 29894, 1516, 29918, 2754, 29889, 2490, 29918, 18010, 29918, 29894, 1516, 29898, 3177, 29918, 333, 29922, 1311, 29889, 3177, 333, 29892, 3370, 29922, 29896, 29900, 29906, 29946, 29892, 26403, 29922, 29896, 29892, 766, 2039, 29922, 1311, 29889, 2218, 2039, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29896, 29897, 13, 13, 4706, 1583, 29889, 19920, 29889, 3888, 703, 2577, 313, 9219, 29900, 29897, 4902, 1919, 29898, 9219, 29900, 29897, 4660, 881, 367, 2734, 23157, 13, 4706, 363, 903, 297, 3464, 29898, 29906, 29900, 1125, 13, 9651, 2933, 353, 1583, 29889, 29894, 1516, 29918, 2754, 29889, 657, 29918, 18010, 29918, 29894, 1516, 29918, 29894, 6563, 29898, 1311, 29889, 3177, 333, 29892, 1583, 29889, 1272, 1839, 333, 11287, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 9651, 4660, 353, 2933, 29889, 3126, 580, 1839, 4882, 2033, 13, 9651, 565, 4660, 1275, 525, 21094, 2396, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 931, 29889, 17059, 29898, 29941, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 3126, 580, 1839, 4882, 7464, 525, 21094, 742, 376, 518, 29930, 29962, 508, 29915, 29873, 1369, 22419, 23157, 13, 2 ]
CNN/SENet/senet.py
cutz-j/Paper2Code
2
160623
<gh_stars>1-10 from keras import backend as K from keras_applications.imagenet_utils import _obtain_input_shape, preprocess_input from keras.layers import Activation, Conv2D, Add, Concatenate, GlobalAveragePooling2D, GlobalMaxPool2D from keras.layers import Input, Dense, MaxPooling2D, AveragePooling2D, BatchNormalization, Lambda from keras.layers import DepthwiseConv2D, Dropout, concatenate, Reshape, Multiply from keras.models import Model from keras.regularizers import l2 import numpy as np def SENet(input_shape=None, reduction_ratio=16, include_top=True, weights=None, classes=1000, **kwargs): ''' Squeeze & Excitation Net for Keras SE-Res50Net input: - input_shape: image input shape - include_top: final classification layer - reduction: float, reduce the number of feature-maps at transition layers - weights: pre-trained weight - classes: output classes ''' input_shape = _obtain_input_shape(input_shape, default_size=224, min_size=32, data_format=K.image_data_format(), require_flatten=include_top, weights=weights) img_input = Input(shape=input_shape) # 1 layer x = Conv2D(filters=64, kernel_size=(7,7), strides=2, padding='same', kernel_initializer='he_normal', use_bias=False, name='conv1')(img_input) x = BatchNormalization(epsilon=0.0001, name='conv1_bn')(x) x = Activation('relu')(x) x = MaxPooling2D(pool_size=(3, 3), strides=2, padding='same',name='maxpool1')(x) # res stage 1 (64 64 256) x 3 x = res_block(x, input_dim=64, out_dim=256, shortcut_conv=True, strided_conv=False, stage=1, block=1) x = se_block(x, out_dim=256, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(1, 1)) for i in range(2): x = res_block(x, input_dim=64, out_dim=256, shortcut_conv=False, strided_conv=False, stage=1, block=i+2) x = se_block(x, out_dim=256, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(1, i+2)) # res stage 2 (128 128 512) x 4 x = res_block(x, input_dim=128, out_dim=512, shortcut_conv=True, strided_conv=True, stage=2, block=1) x = se_block(x, out_dim=512, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(2,1)) for i in range(3): x = res_block(x, input_dim=64, out_dim=512, shortcut_conv=False, strided_conv=False, stage=2, block=(i+2)) x = se_block(x, out_dim=512, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(2,i+2)) # res stage 3 (256 256 1024) x 6 x = res_block(x, input_dim=256, out_dim=1024, shortcut_conv=True, strided_conv=True, stage=3, block=1) x = se_block(x, out_dim=1024, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(3,1)) for i in range(5): x = res_block(x, input_dim=256, out_dim=1024, shortcut_conv=False, strided_conv=False, stage=3, block=(i+2)) x = se_block(x, out_dim=1024, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(3,i+2)) # res stage 4 (512 512 2048) x 3 x = res_block(x, input_dim=512, out_dim=2048, shortcut_conv=True, strided_conv=True,stage=4, block=1) x = se_block(x, out_dim=2048, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(4,1)) for i in range(2): x = res_block(x, input_dim=512, out_dim=2048, shortcut_conv=False, strided_conv=False, stage=4, block=(i+2)) x = se_block(x, out_dim=2048, reduction_ratio=reduction_ratio, layer_name='se_block_%d_%d'%(4,i+2)) if include_top: x = GlobalAveragePooling2D(name='avg_pool')(x) x = Dense(classes, activation=None, name='dense')(x) x = Activation('softmax')(x) model = Model(img_input, x) return model def se_block(x, out_dim, reduction_ratio=16, layer_name=None): ''' Squeeze Excitation block x --> GAP (squeeze) --> FC Dense --> Relu --> FC Dense --> sigmoid --> Scale ----------------------- Element by Mul ------------------------------> input: - x: input tensor - out_dim: output dimension - reduction_ratio: channel reduction - layer_name: name ''' # squeeze squeeze = GlobalAveragePooling2D()(x) # excitation excitation = Dense(units=int(out_dim/reduction_ratio), activation=None, kernel_initializer='he_normal',name=layer_name+'_1')(squeeze) excitation = Activation('relu')(excitation) excitation = Dense(units=out_dim, activation=None,kernel_initializer='he_normal',name=layer_name+'_2')(excitation) excitation = Reshape(target_shape=[1, 1, out_dim])(excitation) # scale with add (skip connection) scale = Multiply()([x, excitation]) return scale def res_block(x, input_dim, out_dim, eps=0.0001, shortcut_conv=False, strided_conv=True, stage=None, block=None): ''' residual block for resnet-50 x --> conv 1x1 (input_dim) --> conv 3x3 (input_dim) --> conv 1x1 (out_dim) --> Add ---------------------------------------------------------------------------> input: - x: input tensor - input_dim: channel dimension reduction - out_dim: output dim - eps: Batch Normalization Epsilon - shortcut_conv: shortcut_conv (channel_dim) - strided_conv: 1x1 strided 2 conv (down-sampling) - stage: resnet stage - block: block num in stage (iter) ''' shortcut = x if shortcut_conv: shortcut = Conv2D(filters=out_dim, kernel_size=(1, 1), strides=2 if strided_conv==True else 1, padding='same', kernel_initializer='he_normal', name='conv_shortcut_%d_%d'%(stage,block))(shortcut) shortcut = BatchNormalization(epsilon=eps, name='bn_shortcut_%d_%d'%(stage,block))(shortcut) x = Conv2D(filters=input_dim, kernel_size=(1, 1), strides=2 if strided_conv==True else 1, padding='same', kernel_initializer='he_normal', name='res_conv1_%d_%d'%(stage, block))(x) x = BatchNormalization(epsilon=eps, name='res_bn1_%d_%d'%(stage, block))(x) x = Activation('relu')(x) x = Conv2D(filters=input_dim, kernel_size=(3, 3), strides=1, padding='same', kernel_initializer='he_normal', name='res_conv2_%d_%d'%(stage, block))(x) x = BatchNormalization(epsilon=eps, name='res_bn2_%d_%d'%(stage, block))(x) x = Activation('relu')(x) x = Conv2D(filters=out_dim, kernel_size=(1, 1), strides=1, padding='same', kernel_initializer='he_normal', name='res_conv3_%d_%d'%(stage, block))(x) x = BatchNormalization(epsilon=eps, name='res_bn3_%d_%d'%(stage, block))(x) x = Add()([x, shortcut]) x = Activation('relu')(x) return x
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 13023, 294, 1053, 14998, 408, 476, 13, 3166, 13023, 294, 29918, 932, 5795, 29889, 326, 5370, 300, 29918, 13239, 1053, 903, 711, 2408, 29918, 2080, 29918, 12181, 29892, 758, 5014, 29918, 2080, 13, 3166, 13023, 294, 29889, 29277, 1053, 21775, 362, 29892, 1281, 29894, 29906, 29928, 29892, 3462, 29892, 23924, 2579, 403, 29892, 12002, 29909, 19698, 11426, 292, 29906, 29928, 29892, 12002, 7976, 11426, 29906, 29928, 13, 3166, 13023, 294, 29889, 29277, 1053, 10567, 29892, 360, 1947, 29892, 5918, 11426, 292, 29906, 29928, 29892, 319, 19698, 11426, 292, 29906, 29928, 29892, 350, 905, 19077, 2133, 29892, 365, 2269, 13, 3166, 13023, 294, 29889, 29277, 1053, 10034, 386, 3538, 1168, 29894, 29906, 29928, 29892, 20724, 449, 29892, 16125, 403, 29892, 2538, 14443, 29892, 9683, 666, 368, 13, 3166, 13023, 294, 29889, 9794, 1053, 8125, 13, 3166, 13023, 294, 29889, 15227, 19427, 1053, 301, 29906, 13, 5215, 12655, 408, 7442, 13, 13, 1753, 317, 1430, 300, 29898, 2080, 29918, 12181, 29922, 8516, 29892, 20376, 29918, 3605, 601, 29922, 29896, 29953, 29892, 3160, 29918, 3332, 29922, 5574, 29892, 18177, 29922, 8516, 29892, 4413, 29922, 29896, 29900, 29900, 29900, 29892, 13, 3986, 3579, 19290, 1125, 13, 1678, 14550, 13, 1678, 317, 802, 29872, 911, 669, 1222, 29883, 7018, 12670, 363, 12693, 294, 13, 1678, 3725, 29899, 1666, 29945, 29900, 6779, 13, 268, 13, 1678, 1881, 29901, 13, 1678, 448, 1881, 29918, 12181, 29901, 13, 4706, 1967, 1881, 8267, 13, 1678, 448, 3160, 29918, 3332, 29901, 13, 4706, 2186, 12965, 7546, 13, 1678, 448, 20376, 29901, 13, 4706, 5785, 29892, 10032, 278, 1353, 310, 4682, 29899, 10339, 472, 9558, 15359, 13, 1678, 448, 18177, 29901, 13, 4706, 758, 29899, 3018, 1312, 7688, 13, 1678, 448, 4413, 29901, 13, 4706, 1962, 4413, 13, 1678, 14550, 13, 1678, 1881, 29918, 12181, 353, 903, 711, 2408, 29918, 2080, 29918, 12181, 29898, 2080, 29918, 12181, 29892, 13, 462, 462, 418, 2322, 29918, 2311, 29922, 29906, 29906, 29946, 29892, 13, 462, 462, 418, 1375, 29918, 2311, 29922, 29941, 29906, 29892, 13, 462, 462, 418, 848, 29918, 4830, 29922, 29968, 29889, 3027, 29918, 1272, 29918, 4830, 3285, 13, 462, 462, 418, 1996, 29918, 1579, 8606, 29922, 2856, 29918, 3332, 29892, 13, 462, 462, 418, 18177, 29922, 705, 5861, 29897, 13, 1678, 10153, 29918, 2080, 353, 10567, 29898, 12181, 29922, 2080, 29918, 12181, 29897, 13, 1678, 396, 29871, 29896, 7546, 13, 1678, 921, 353, 1281, 29894, 29906, 29928, 29898, 26705, 29922, 29953, 29946, 29892, 8466, 29918, 2311, 7607, 29955, 29892, 29955, 511, 851, 2247, 29922, 29906, 29892, 7164, 2433, 17642, 742, 8466, 29918, 11228, 3950, 2433, 354, 29918, 8945, 742, 671, 29918, 29890, 3173, 29922, 8824, 29892, 1024, 2433, 20580, 29896, 1495, 29898, 2492, 29918, 2080, 29897, 13, 1678, 921, 353, 350, 905, 19077, 2133, 29898, 5463, 29922, 29900, 29889, 29900, 29900, 29900, 29896, 29892, 1024, 2433, 20580, 29896, 29918, 11197, 1495, 29898, 29916, 29897, 13, 1678, 921, 353, 21775, 362, 877, 2674, 29884, 1495, 29898, 29916, 29897, 13, 268, 13, 1678, 921, 353, 5918, 11426, 292, 29906, 29928, 29898, 10109, 29918, 2311, 7607, 29941, 29892, 29871, 29941, 511, 851, 2247, 29922, 29906, 29892, 7164, 2433, 17642, 742, 978, 2433, 3317, 10109, 29896, 1495, 29898, 29916, 29897, 13, 268, 13, 1678, 396, 620, 7408, 29871, 29896, 313, 29953, 29946, 29871, 29953, 29946, 29871, 29906, 29945, 29953, 29897, 921, 29871, 29941, 13, 1678, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29953, 29946, 29892, 714, 29918, 6229, 29922, 29906, 29945, 29953, 29892, 21697, 29918, 20580, 29922, 5574, 29892, 851, 2618, 29918, 20580, 29922, 8824, 29892, 7408, 29922, 29896, 29892, 2908, 29922, 29896, 29897, 13, 1678, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29906, 29945, 29953, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29896, 29892, 29871, 29896, 876, 13, 1678, 363, 474, 297, 3464, 29898, 29906, 1125, 13, 4706, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29953, 29946, 29892, 714, 29918, 6229, 29922, 29906, 29945, 29953, 29892, 21697, 29918, 20580, 29922, 8824, 29892, 851, 2618, 29918, 20580, 29922, 8824, 29892, 7408, 29922, 29896, 29892, 2908, 29922, 29875, 29974, 29906, 29897, 13, 4706, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29906, 29945, 29953, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29896, 29892, 474, 29974, 29906, 876, 13, 268, 13, 1678, 396, 620, 7408, 29871, 29906, 313, 29896, 29906, 29947, 29871, 29896, 29906, 29947, 29871, 29945, 29896, 29906, 29897, 921, 29871, 29946, 13, 1678, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29896, 29906, 29947, 29892, 714, 29918, 6229, 29922, 29945, 29896, 29906, 29892, 21697, 29918, 20580, 29922, 5574, 29892, 851, 2618, 29918, 20580, 29922, 5574, 29892, 7408, 29922, 29906, 29892, 2908, 29922, 29896, 29897, 13, 1678, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29945, 29896, 29906, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29906, 29892, 29896, 876, 13, 1678, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 4706, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29953, 29946, 29892, 714, 29918, 6229, 29922, 29945, 29896, 29906, 29892, 21697, 29918, 20580, 29922, 8824, 29892, 851, 2618, 29918, 20580, 29922, 8824, 29892, 7408, 29922, 29906, 29892, 2908, 7607, 29875, 29974, 29906, 876, 13, 4706, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29945, 29896, 29906, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29906, 29892, 29875, 29974, 29906, 876, 13, 268, 13, 1678, 396, 620, 7408, 29871, 29941, 313, 29906, 29945, 29953, 29871, 29906, 29945, 29953, 29871, 29896, 29900, 29906, 29946, 29897, 921, 29871, 29953, 13, 1678, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29906, 29945, 29953, 29892, 714, 29918, 6229, 29922, 29896, 29900, 29906, 29946, 29892, 21697, 29918, 20580, 29922, 5574, 29892, 851, 2618, 29918, 20580, 29922, 5574, 29892, 7408, 29922, 29941, 29892, 2908, 29922, 29896, 29897, 13, 1678, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29896, 29900, 29906, 29946, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29941, 29892, 29896, 876, 13, 1678, 363, 474, 297, 3464, 29898, 29945, 1125, 13, 4706, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29906, 29945, 29953, 29892, 714, 29918, 6229, 29922, 29896, 29900, 29906, 29946, 29892, 21697, 29918, 20580, 29922, 8824, 29892, 851, 2618, 29918, 20580, 29922, 8824, 29892, 7408, 29922, 29941, 29892, 2908, 7607, 29875, 29974, 29906, 876, 13, 4706, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29896, 29900, 29906, 29946, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29941, 29892, 29875, 29974, 29906, 876, 13, 268, 13, 1678, 396, 620, 7408, 29871, 29946, 313, 29945, 29896, 29906, 29871, 29945, 29896, 29906, 29871, 29906, 29900, 29946, 29947, 29897, 921, 29871, 29941, 13, 1678, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29945, 29896, 29906, 29892, 714, 29918, 6229, 29922, 29906, 29900, 29946, 29947, 29892, 21697, 29918, 20580, 29922, 5574, 29892, 851, 2618, 29918, 20580, 29922, 5574, 29892, 19190, 29922, 29946, 29892, 2908, 29922, 29896, 29897, 13, 1678, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29906, 29900, 29946, 29947, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29946, 29892, 29896, 876, 13, 1678, 363, 474, 297, 3464, 29898, 29906, 1125, 13, 4706, 921, 353, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29922, 29945, 29896, 29906, 29892, 714, 29918, 6229, 29922, 29906, 29900, 29946, 29947, 29892, 21697, 29918, 20580, 29922, 8824, 29892, 851, 2618, 29918, 20580, 29922, 8824, 29892, 7408, 29922, 29946, 29892, 2908, 7607, 29875, 29974, 29906, 876, 13, 4706, 921, 353, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29922, 29906, 29900, 29946, 29947, 29892, 20376, 29918, 3605, 601, 29922, 9313, 428, 29918, 3605, 601, 29892, 7546, 29918, 978, 2433, 344, 29918, 1271, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 29946, 29892, 29875, 29974, 29906, 876, 13, 268, 13, 1678, 565, 3160, 29918, 3332, 29901, 13, 4706, 921, 353, 12002, 29909, 19698, 11426, 292, 29906, 29928, 29898, 978, 2433, 485, 29887, 29918, 10109, 1495, 29898, 29916, 29897, 13, 4706, 921, 353, 360, 1947, 29898, 13203, 29892, 26229, 29922, 8516, 29892, 1024, 2433, 1145, 344, 1495, 29898, 29916, 29897, 13, 4706, 921, 353, 21775, 362, 877, 2695, 3317, 1495, 29898, 29916, 29897, 13, 268, 13, 1678, 1904, 353, 8125, 29898, 2492, 29918, 2080, 29892, 921, 29897, 13, 1678, 736, 1904, 13, 13, 1753, 409, 29918, 1271, 29898, 29916, 29892, 714, 29918, 6229, 29892, 20376, 29918, 3605, 601, 29922, 29896, 29953, 29892, 7546, 29918, 978, 29922, 8516, 1125, 13, 1678, 14550, 13, 1678, 317, 802, 29872, 911, 1222, 29883, 7018, 2908, 13, 1678, 921, 6660, 402, 3301, 313, 29879, 802, 29872, 911, 29897, 6660, 7992, 360, 1947, 6660, 6376, 29884, 6660, 7992, 360, 1947, 6660, 4365, 29885, 3398, 6660, 2522, 744, 13, 418, 448, 2683, 22158, 10619, 491, 21193, 448, 2683, 9072, 976, 13, 268, 13, 1678, 1881, 29901, 13, 4706, 448, 921, 29901, 13, 9651, 1881, 12489, 13, 4706, 448, 714, 29918, 6229, 29901, 13, 9651, 1962, 9927, 13, 4706, 448, 20376, 29918, 3605, 601, 29901, 13, 9651, 8242, 20376, 13, 4706, 448, 7546, 29918, 978, 29901, 13, 9651, 1024, 13, 1678, 14550, 13, 1678, 396, 269, 802, 29872, 911, 13, 1678, 269, 802, 29872, 911, 353, 12002, 29909, 19698, 11426, 292, 29906, 29928, 580, 29898, 29916, 29897, 13, 268, 13, 1678, 396, 5566, 7018, 13, 1678, 5566, 7018, 353, 360, 1947, 29898, 348, 1169, 29922, 524, 29898, 449, 29918, 6229, 29914, 9313, 428, 29918, 3605, 601, 511, 26229, 29922, 8516, 29892, 8466, 29918, 11228, 3950, 2433, 354, 29918, 8945, 742, 978, 29922, 13148, 29918, 978, 29974, 15972, 29896, 1495, 29898, 29879, 802, 29872, 911, 29897, 13, 1678, 5566, 7018, 353, 21775, 362, 877, 2674, 29884, 1495, 29898, 735, 29883, 7018, 29897, 13, 1678, 5566, 7018, 353, 360, 1947, 29898, 348, 1169, 29922, 449, 29918, 6229, 29892, 26229, 29922, 8516, 29892, 17460, 29918, 11228, 3950, 2433, 354, 29918, 8945, 742, 978, 29922, 13148, 29918, 978, 29974, 15972, 29906, 1495, 29898, 735, 29883, 7018, 29897, 13, 1678, 5566, 7018, 353, 2538, 14443, 29898, 5182, 29918, 12181, 11759, 29896, 29892, 29871, 29896, 29892, 714, 29918, 6229, 2314, 29898, 735, 29883, 7018, 29897, 13, 268, 13, 1678, 396, 6287, 411, 788, 313, 11014, 3957, 29897, 13, 1678, 6287, 353, 9683, 666, 368, 580, 4197, 29916, 29892, 5566, 7018, 2314, 13, 1678, 736, 6287, 13, 308, 13, 1753, 620, 29918, 1271, 29898, 29916, 29892, 1881, 29918, 6229, 29892, 714, 29918, 6229, 29892, 321, 567, 29922, 29900, 29889, 29900, 29900, 29900, 29896, 29892, 21697, 29918, 20580, 29922, 8824, 29892, 851, 2618, 29918, 20580, 29922, 5574, 29892, 7408, 29922, 8516, 29892, 2908, 29922, 8516, 1125, 13, 1678, 14550, 13, 1678, 10995, 950, 2908, 363, 620, 1212, 29899, 29945, 29900, 13, 1678, 921, 6660, 7602, 29871, 29896, 29916, 29896, 313, 2080, 29918, 6229, 29897, 6660, 7602, 29871, 29941, 29916, 29941, 313, 2080, 29918, 6229, 29897, 6660, 7602, 29871, 29896, 29916, 29896, 313, 449, 29918, 6229, 29897, 6660, 3462, 13, 418, 448, 2683, 2683, 2683, 2683, 1378, 15110, 13, 268, 13, 1678, 1881, 29901, 13, 4706, 448, 921, 29901, 13, 9651, 1881, 12489, 13, 4706, 448, 1881, 29918, 6229, 29901, 13, 9651, 8242, 9927, 20376, 13, 4706, 448, 714, 29918, 6229, 29901, 13, 9651, 1962, 3964, 13, 4706, 448, 321, 567, 29901, 13, 9651, 350, 905, 21981, 2133, 382, 3232, 13, 4706, 448, 21697, 29918, 20580, 29901, 13, 9651, 21697, 29918, 20580, 313, 12719, 29918, 6229, 29897, 13, 4706, 448, 851, 2618, 29918, 20580, 29901, 13, 632, 29896, 29916, 29896, 851, 2618, 29871, 29906, 7602, 313, 3204, 29899, 13445, 10335, 29897, 13, 4706, 448, 7408, 29901, 13, 9651, 620, 1212, 7408, 13, 4706, 448, 2908, 29901, 13, 9651, 2908, 954, 297, 7408, 313, 1524, 29897, 13, 1678, 14550, 13, 1678, 21697, 353, 921, 13, 268, 13, 1678, 565, 21697, 29918, 20580, 29901, 13, 4706, 21697, 353, 1281, 29894, 29906, 29928, 29898, 26705, 29922, 449, 29918, 6229, 29892, 8466, 29918, 2311, 7607, 29896, 29892, 29871, 29896, 511, 851, 2247, 29922, 29906, 565, 851, 2618, 29918, 20580, 1360, 5574, 1683, 29871, 29896, 29892, 7164, 2433, 17642, 742, 13, 462, 3986, 8466, 29918, 11228, 3950, 2433, 354, 29918, 8945, 742, 1024, 2433, 20580, 29918, 12759, 7582, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 1271, 876, 29898, 12759, 7582, 29897, 13, 4706, 21697, 353, 350, 905, 19077, 2133, 29898, 5463, 29922, 8961, 29892, 1024, 2433, 11197, 29918, 12759, 7582, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 1271, 876, 29898, 12759, 7582, 29897, 13, 268, 13, 1678, 921, 353, 1281, 29894, 29906, 29928, 29898, 26705, 29922, 2080, 29918, 6229, 29892, 8466, 29918, 2311, 7607, 29896, 29892, 29871, 29896, 511, 851, 2247, 29922, 29906, 565, 851, 2618, 29918, 20580, 1360, 5574, 1683, 29871, 29896, 29892, 7164, 2433, 17642, 742, 13, 1669, 8466, 29918, 11228, 3950, 2433, 354, 29918, 8945, 742, 1024, 2433, 690, 29918, 20580, 29896, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 2908, 876, 29898, 29916, 29897, 13, 1678, 921, 353, 350, 905, 19077, 2133, 29898, 5463, 29922, 8961, 29892, 1024, 2433, 690, 29918, 11197, 29896, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 2908, 876, 29898, 29916, 29897, 13, 1678, 921, 353, 21775, 362, 877, 2674, 29884, 1495, 29898, 29916, 29897, 13, 268, 13, 1678, 921, 353, 1281, 29894, 29906, 29928, 29898, 26705, 29922, 2080, 29918, 6229, 29892, 8466, 29918, 2311, 7607, 29941, 29892, 29871, 29941, 511, 851, 2247, 29922, 29896, 29892, 7164, 2433, 17642, 742, 13, 1669, 8466, 29918, 11228, 3950, 2433, 354, 29918, 8945, 742, 1024, 2433, 690, 29918, 20580, 29906, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 2908, 876, 29898, 29916, 29897, 13, 1678, 921, 353, 350, 905, 19077, 2133, 29898, 5463, 29922, 8961, 29892, 1024, 2433, 690, 29918, 11197, 29906, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 2908, 876, 29898, 29916, 29897, 13, 1678, 921, 353, 21775, 362, 877, 2674, 29884, 1495, 29898, 29916, 29897, 13, 268, 13, 1678, 921, 353, 1281, 29894, 29906, 29928, 29898, 26705, 29922, 449, 29918, 6229, 29892, 8466, 29918, 2311, 7607, 29896, 29892, 29871, 29896, 511, 851, 2247, 29922, 29896, 29892, 7164, 2433, 17642, 742, 13, 1669, 8466, 29918, 11228, 3950, 2433, 354, 29918, 8945, 742, 1024, 2433, 690, 29918, 20580, 29941, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 2908, 876, 29898, 29916, 29897, 13, 1678, 921, 353, 350, 905, 19077, 2133, 29898, 5463, 29922, 8961, 29892, 1024, 2433, 690, 29918, 11197, 29941, 29918, 29995, 29881, 29918, 29995, 29881, 29915, 29995, 29898, 19190, 29892, 2908, 876, 29898, 29916, 29897, 13, 268, 13, 1678, 921, 353, 3462, 580, 4197, 29916, 29892, 21697, 2314, 13, 1678, 921, 353, 21775, 362, 877, 2674, 29884, 1495, 29898, 29916, 29897, 13, 1678, 736, 921, 2 ]
src/user-config.py
aryamanarora/wdp
0
107722
<reponame>aryamanarora/wdp family = 'wiktionary' mylang = 'en' usernames['wiktionary']['en'] = u'AryamanA' # change to your username console_encoding = 'utf-8' minthrottle = 0 maxthrottle = 1
[ 1, 529, 276, 1112, 420, 29958, 653, 13533, 279, 2207, 29914, 29893, 6099, 13, 11922, 353, 525, 2851, 12757, 653, 29915, 13, 1357, 3893, 353, 525, 264, 29915, 13, 13, 375, 824, 1280, 1839, 2851, 12757, 653, 16215, 264, 2033, 353, 318, 29915, 29909, 719, 13533, 29909, 29915, 396, 1735, 304, 596, 8952, 13, 13, 11058, 29918, 22331, 353, 525, 9420, 29899, 29947, 29915, 13, 13, 1195, 386, 26970, 280, 353, 29871, 29900, 13, 3317, 386, 26970, 280, 353, 29871, 29896, 2 ]
TEMpcPlot/Symmetry/spacegroup.py
Prestipino/TEMpcPlot
0
165417
<filename>TEMpcPlot/Symmetry/spacegroup.py # Copyright (C) 2010, <NAME> # (see accompanying license files for details). """Definition of the Spacegroup class. from ase library few change for extinctions This module only depends on NumPy and the space group database. """ import os import warnings from functools import total_ordering from typing import Union from .CFML_exti import Search_Extinctions import numpy as np from .CFML_exti import Search_Extinctions __all__ = ['Spacegroup'] class SpacegroupError(Exception): """Base exception for the spacegroup module.""" pass class SpacegroupNotFoundError(SpacegroupError): """Raised when given space group cannot be found in data base.""" pass class SpacegroupValueError(SpacegroupError): """Raised when arguments have invalid value.""" pass # Type alias _SPACEGROUP = Union[int, str, 'Spacegroup'] @total_ordering class Spacegroup: """A space group class. The instances of Spacegroup describes the symmetry operations for the given space group. Example: >>> from ase.spacegroup import Spacegroup >>> >>> sg = Spacegroup(225) >>> print('Space group', sg.no, sg.symbol) Space group 225 F m -3 m >>> sg.scaled_primitive_cell array([[ 0. , 0.5, 0.5], [ 0.5, 0. , 0.5], [ 0.5, 0.5, 0. ]]) >>> sites, kinds = sg.equivalent_sites([[0,0,0]]) >>> sites array([[ 0. , 0. , 0. ], [ 0. , 0.5, 0.5], [ 0.5, 0. , 0.5], [ 0.5, 0.5, 0. ]]) """ no = property( lambda self: self._no, doc='Space group number in International Tables of Crystallography.') symbol = property( lambda self: self._symbol, doc='Hermann-Mauguin (or international) symbol for the space group.') setting = property(lambda self: self._setting, doc='Space group setting. Either one or two.') lattice = property(lambda self: self._symbol[0], doc="""Lattice type: P primitive I body centering, h+k+l=2n F face centering, h,k,l all odd or even A,B,C single face centering, k+l=2n, h+l=2n, h+k=2n R rhombohedral centering, -h+k+l=3n (obverse); h-k+l=3n (reverse) """) centrosymmetric = property(lambda self: self._centrosymmetric, doc='Whether a center of symmetry exists.') scaled_primitive_cell = property( lambda self: self._scaled_primitive_cell, doc='Primitive cell in scaled coordinates as a matrix with the ' 'primitive vectors along the rows.') reciprocal_cell = property( lambda self: self._reciprocal_cell, doc='Tree Miller indices that span all kinematically non-forbidden ' 'reflections as a matrix with the Miller indices along the rows.') nsubtrans = property(lambda self: len(self._subtrans), doc='Number of cell-subtranslation vectors.') systematic_absence = property( lambda self: Search_Extinctions(self, 1), doc='print systematic absence ands redefine is_exti') def _get_nsymop(self): """Returns total number of symmetry operations.""" if self.centrosymmetric: return 2 * len(self._rotations) * len(self._subtrans) else: return len(self._rotations) * len(self._subtrans) nsymop = property(_get_nsymop, doc='Total number of symmetry operations.') subtrans = property( lambda self: self._subtrans, doc='Translations vectors belonging to cell-sub-translations.') rotations = property( lambda self: self._rotations, doc='Symmetry rotation matrices. The invertions are not included ' 'for centrosymmetrical crystals.') translations = property( lambda self: self._translations, doc='Symmetry translations. The invertions are not included ' 'for centrosymmetrical crystals.') def __init__(self, spacegroup: _SPACEGROUP, setting=1, datafile=None): """Returns a new Spacegroup instance. Parameters: spacegroup : int | string | Spacegroup instance The space group number in International Tables of Crystallography or its Hermann-Mauguin symbol. E.g. spacegroup=225 and spacegroup='F m -3 m' are equivalent. setting : 1 | 2 Some space groups have more than one setting. `setting` determines Which of these should be used. datafile : None | string Path to database file. If `None`, the the default database will be used. """ if isinstance(spacegroup, Spacegroup): for k, v in spacegroup.__dict__.items(): setattr(self, k, v) Search_Extinctions(self, False) return if not datafile: datafile = get_datafile() with open(datafile, 'r') as fd: _read_datafile(self, spacegroup, setting, fd) Search_Extinctions(self, False) Search_Extinctions(self, 0) def __repr__(self): return 'Spacegroup(%d, setting=%d)' % (self.no, self.setting) def todict(self): return {'number': self.no, 'setting': self.setting} def __str__(self): """Return a string representation of the space group data in the same format as found the database.""" retval = [] # no, symbol retval.append('%-3d %s\n' % (self.no, self.symbol)) # setting retval.append(' setting %d\n' % (self.setting)) # centrosymmetric retval.append(' centrosymmetric %d\n' % (self.centrosymmetric)) # primitive vectors retval.append(' primitive vectors\n') for i in range(3): retval.append(' ') for j in range(3): retval.append(' %13.10f' % (self.scaled_primitive_cell[i, j])) retval.append('\n') # primitive reciprocal vectors retval.append(' reciprocal vectors\n') for i in range(3): retval.append(' ') for j in range(3): retval.append(' %3d' % (self.reciprocal_cell[i, j])) retval.append('\n') # sublattice retval.append(' %d subtranslations\n' % self.nsubtrans) for i in range(self.nsubtrans): retval.append(' ') for j in range(3): retval.append(' %13.10f' % (self.subtrans[i, j])) retval.append('\n') # symmetry operations nrot = len(self.rotations) retval.append(' %d symmetry operations (rot+trans)\n' % nrot) for i in range(nrot): retval.append(' ') for j in range(3): retval.append(' ') for k in range(3): retval.append(' %2d' % (self.rotations[i, j, k])) retval.append(' ') for j in range(3): retval.append(' %13.10f' % self.translations[i, j]) retval.append('\n') retval.append('\n') return ''.join(retval) def __eq__(self, other): return self.no == other.no and self.setting == other.setting def __ne__(self, other): return not self.__eq__(other) def __lt__(self, other): return self.no < other.no or (self.no == other.no and self.setting < other.setting) def __index__(self): return self.no __int__ = __index__ def get_symop(self, matrix=True): """Returns all symmetry operations (including inversions and subtranslations) as a sequence of (rotation, translation) tuples. Parameters: matrix: boolean if false return asymmetry operation as x,y,z """ symop = [] parities = [1] if self.centrosymmetric: parities.append(-1) for parity in parities: for subtrans in self.subtrans: for rot, trans in zip(self.rotations, self.translations): newtrans = np.mod(trans + subtrans, 1) symop.append((parity * rot, newtrans)) if not(matrix): symop = [MT2text(Opr) for Opr in symop] return symop def get_op(self): """Returns all symmetry operations (including inversions and subtranslations), but unlike get_symop(), they are returned as two ndarrays.""" if self.centrosymmetric: rot = np.tile(np.vstack((self.rotations, -self.rotations)), (self.nsubtrans, 1, 1)) trans = np.tile(np.vstack((self.translations, -self.translations)), (self.nsubtrans, 1)) trans += np.repeat(self.subtrans, 2 * len(self.rotations), axis=0) trans = np.mod(trans, 1) else: rot = np.tile(self.rotations, (self.nsubtrans, 1, 1)) trans = np.tile(self.translations, (self.nsubtrans, 1)) trans += np.repeat(self.subtrans, len(self.rotations), axis=0) trans = np.mod(trans, 1) return rot, trans def get_rotations(self): """Return all rotations, including inversions for centrosymmetric crystals.""" if self.centrosymmetric: return np.vstack((self.rotations, -self.rotations)) else: return self.rotations def equivalent_reflections(self, hkl): """Return all equivalent reflections to the list of Miller indices in hkl. Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sg.equivalent_reflections([[0, 0, 2]]) array([[ 0, 0, -2], [ 0, -2, 0], [-2, 0, 0], [ 2, 0, 0], [ 0, 2, 0], [ 0, 0, 2]]) """ hkl = np.array(hkl, dtype='int', ndmin=2) rot = self.get_rotations() n, nrot = len(hkl), len(rot) R = rot.transpose(0, 2, 1).reshape((3 * nrot, 3)).T refl = np.dot(hkl, R).reshape((n * nrot, 3)) ind = np.lexsort(refl.T) refl = refl[ind] diff = np.diff(refl, axis=0) mask = np.any(diff, axis=1) return np.vstack((refl[:-1][mask], refl[-1, :])) def equivalent_lattice_points(self, uvw): """Return all lattice points equivalent to any of the lattice points in `uvw` with respect to rotations only. Only equivalent lattice points that conserves the distance to origo are included in the output (making this a kind of real space version of the equivalent_reflections() method). Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sg.equivalent_lattice_points([[0, 0, 2]]) array([[ 0, 0, -2], [ 0, -2, 0], [-2, 0, 0], [ 2, 0, 0], [ 0, 2, 0], [ 0, 0, 2]]) """ uvw = np.array(uvw, ndmin=2) rot = self.get_rotations() n, nrot = len(uvw), len(rot) directions = np.dot(uvw, rot).reshape((n * nrot, 3)) ind = np.lexsort(directions.T) directions = directions[ind] diff = np.diff(directions, axis=0) mask = np.any(diff, axis=1) return np.vstack((directions[:-1][mask], directions[-1:])) def symmetry_normalised_reflections(self, hkl): """Returns an array of same size as *hkl*, containing the corresponding symmetry-equivalent reflections of lowest indices. Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sg.symmetry_normalised_reflections([[2, 0, 0], [0, 2, 0]]) array([[ 0, 0, -2], [ 0, 0, -2]]) """ hkl = np.array(hkl, dtype=int, ndmin=2) normalised = np.empty(hkl.shape, int) R = self.get_rotations().transpose(0, 2, 1) for i, g in enumerate(hkl): gsym = np.dot(R, g) j = np.lexsort(gsym.T)[0] normalised[i, :] = gsym[j] return normalised def unique_reflections(self, hkl): """Returns a subset *hkl* containing only the symmetry-unique reflections. Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sg.unique_reflections([[ 2, 0, 0], ... [ 0, -2, 0], ... [ 2, 2, 0], ... [ 0, -2, -2]]) array([[2, 0, 0], [2, 2, 0]]) """ hkl = np.array(hkl, dtype=int, ndmin=2) hklnorm = self.symmetry_normalised_reflections(hkl) perm = np.lexsort(hklnorm.T) iperm = perm.argsort() xmask = np.abs(np.diff(hklnorm[perm], axis=0)).any(axis=1) mask = np.concatenate(([True], xmask)) imask = mask[iperm] return hkl[imask] def equivalent_sites(self, scaled_positions, onduplicates='error', symprec=1e-3, occupancies=None): """Returns the scaled positions and all their equivalent sites. Parameters: scaled_positions: list | array List of non-equivalent sites given in unit cell coordinates. occupancies: list | array, optional (default=None) List of occupancies corresponding to the respective sites. onduplicates : 'keep' | 'replace' | 'warn' | 'error' Action if `scaled_positions` contain symmetry-equivalent positions of full occupancy: 'keep' ignore additional symmetry-equivalent positions 'replace' replace 'warn' like 'keep', but issue an UserWarning 'error' raises a SpacegroupValueError symprec: float Minimum "distance" betweed two sites in scaled coordinates before they are counted as the same site. Returns: sites: array A NumPy array of equivalent sites. kinds: list A list of integer indices specifying which input site is equivalent to the corresponding returned site. Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sites, kinds = sg.equivalent_sites([[0, 0, 0], [0.5, 0.0, 0.0]]) >>> sites array([[ 0. , 0. , 0. ], [ 0. , 0.5, 0.5], [ 0.5, 0. , 0.5], [ 0.5, 0.5, 0. ], [ 0.5, 0. , 0. ], [ 0. , 0.5, 0. ], [ 0. , 0. , 0.5], [ 0.5, 0.5, 0.5]]) >>> kinds [0, 0, 0, 0, 1, 1, 1, 1] """ kinds = [] sites = [] scaled = np.array(scaled_positions, ndmin=2) for kind, pos in enumerate(scaled): for rot, trans in self.get_symop(): site = np.mod(np.dot(rot, pos) + trans, 1.) if not sites: sites.append(site) kinds.append(kind) continue t = site - sites mask = np.all( (abs(t) < symprec) | (abs(abs(t) - 1.0) < symprec), axis=1) if np.any(mask): inds = np.argwhere(mask).flatten() for ind in inds: # then we would just add the same thing again -> skip if kinds[ind] == kind: pass elif onduplicates == 'keep': pass elif onduplicates == 'replace': kinds[ind] = kind elif onduplicates == 'warn': warnings.warn('scaled_positions %d and %d ' 'are equivalent' % (kinds[ind], kind)) elif onduplicates == 'error': raise SpacegroupValueError( 'scaled_positions %d and %d are equivalent' % (kinds[ind], kind)) else: raise SpacegroupValueError( 'Argument "onduplicates" must be one of: ' '"keep", "replace", "warn" or "error".') else: sites.append(site) kinds.append(kind) return np.array(sites), kinds def symmetry_normalised_sites(self, scaled_positions, map_to_unitcell=True): """Returns an array of same size as *scaled_positions*, containing the corresponding symmetry-equivalent sites of lowest indices. If *map_to_unitcell* is true, the returned positions are all mapped into the unit cell, i.e. lattice translations are included as symmetry operator. Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sg.symmetry_normalised_sites([[0.0, 0.5, 0.5], [1.0, 1.0, 0.0]]) array([[ 0., 0., 0.], [ 0., 0., 0.]]) """ scaled = np.array(scaled_positions, ndmin=2) normalised = np.empty(scaled.shape, float) rot, trans = self.get_op() for i, pos in enumerate(scaled): sympos = np.dot(rot, pos) + trans if map_to_unitcell: # Must be done twice, see the scaled_positions.py test sympos %= 1.0 sympos %= 1.0 j = np.lexsort(sympos.T)[0] normalised[i, :] = sympos[j] return normalised def unique_sites(self, scaled_positions, symprec=1e-3, output_mask=False, map_to_unitcell=True): """Returns a subset of *scaled_positions* containing only the symmetry-unique positions. If *output_mask* is True, a boolean array masking the subset is also returned. If *map_to_unitcell* is true, all sites are first mapped into the unit cell making e.g. [0, 0, 0] and [1, 0, 0] equivalent. Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sg.unique_sites([[0.0, 0.0, 0.0], ... [0.5, 0.5, 0.0], ... [1.0, 0.0, 0.0], ... [0.5, 0.0, 0.0]]) array([[ 0. , 0. , 0. ], [ 0.5, 0. , 0. ]]) """ scaled = np.array(scaled_positions, ndmin=2) symnorm = self.symmetry_normalised_sites(scaled, map_to_unitcell) perm = np.lexsort(symnorm.T) iperm = perm.argsort() xmask = np.abs(np.diff(symnorm[perm], axis=0)).max(axis=1) > symprec mask = np.concatenate(([True], xmask)) imask = mask[iperm] if output_mask: return scaled[imask], imask else: return scaled[imask] def tag_sites(self, scaled_positions, symprec=1e-3): """Returns an integer array of the same length as *scaled_positions*, tagging all equivalent atoms with the same index. Example: >>> from ase.spacegroup import Spacegroup >>> sg = Spacegroup(225) # fcc >>> sg.tag_sites([[0.0, 0.0, 0.0], ... [0.5, 0.5, 0.0], ... [1.0, 0.0, 0.0], ... [0.5, 0.0, 0.0]]) array([0, 0, 0, 1]) """ scaled = np.array(scaled_positions, ndmin=2) scaled %= 1.0 scaled %= 1.0 tags = -np.ones((len(scaled), ), dtype=int) mask = np.ones((len(scaled), ), dtype=bool) rot, trans = self.get_op() i = 0 while mask.any(): pos = scaled[mask][0] sympos = np.dot(rot, pos) + trans # Must be done twice, see the scaled_positions.py test sympos %= 1.0 sympos %= 1.0 m = ~np.all(np.any(np.abs(scaled[np.newaxis, :, :] - sympos[:, np.newaxis, :]) > symprec, axis=2), axis=0) assert not np.any((~mask) & m) tags[m] = i mask &= ~m i += 1 return tags def MT2text(Opr, reverse=False): "From space group matrix/translation operator returns text version" XYZ = ('-z', '-y', '-x', 'x-y', 'ERR', 'y-x', 'x', 'y', 'z') TRA = (' ', 'ERR', '1/6', '1/4', '1/3', 'ERR', '1/2', 'ERR', '2/3', '3/4', '5/6', 'ERR') Fld = '' M, T = Opr for j in range(3): IJ = int(round(2 * M[j][0] + 3 * M[j][1] + 4 * M[j][2] + 4)) % 12 IK = int(round(T[j] * 12)) % 12 if IK: if IJ < 3: if reverse: Fld += (XYZ[IJ] + '+' + TRA[IK]).rjust(5) else: Fld += (TRA[IK] + XYZ[IJ]).rjust(5) else: if reverse: Fld += (XYZ[IJ] + '+' + TRA[IK]).rjust(5) else: Fld += (TRA[IK] + '+' + XYZ[IJ]).rjust(5) else: Fld += XYZ[IJ].rjust(5) if j != 2: Fld += ', ' return Fld def Text2MT(mcifOpr, CIF=True): "From space group cif text returns matrix/translation" XYZ = {'x': [1, 0, 0], '+x': [1, 0, 0], '-x': [-1, 0, 0], 'y': [0, 1, 0], '+y': [0, 1, 0], '-y': [0, -1, 0], 'z': [0, 0, 1], '+z': [0, 0, 1], '-z': [0, 0, -1], 'x-y': [1, -1, 0], '-x+y': [-1, 1, 0], 'y-x': [-1, 1, 0], '+x-y': [1, -1, 0], '+y-x': [-1, 1, 0]} ops = mcifOpr.split(",") M = [] T = [] for op in ops[:3]: ip = len(op) if '/' in op: ip = op.index('/') T.append(eval(op[:ip + 2])) opMT = [op[ip + 2:], ''] else: opMT = [op, ''] T.append(0.) M.append(XYZ[opMT[0].lower()]) return np.array(M), np.array(T) def get_datafile(): """Return default path to datafile.""" return os.path.join(os.path.dirname(__file__), 'spacegroup.dat') def format_symbol(symbol): """Returns well formatted Hermann-Mauguin symbol as extected by the database, by correcting the case and adding missing or removing dublicated spaces.""" fixed = [] s = symbol.strip() s = s[0].upper() + s[1:].lower() for c in s: if c.isalpha(): if len(fixed) and fixed[-1] == '/': fixed.append(c) else: fixed.append(' ' + c + ' ') elif c.isspace(): fixed.append(' ') elif c.isdigit(): fixed.append(c) elif c == '-': fixed.append(' ' + c) elif c == '/': fixed.append(c) s = ''.join(fixed).strip() return ' '.join(s.split()) # Functions for parsing the database. They are moved outside the # Spacegroup class in order to make it easier to later implement # caching to avoid reading the database each time a new Spacegroup # instance is created. def _skip_to_blank(f, spacegroup, setting): """Read lines from f until a blank line is encountered.""" while True: line = f.readline() if not line: raise SpacegroupNotFoundError( 'invalid spacegroup `%s`, setting `%s` not found in data base' % (spacegroup, setting)) if not line.strip(): break def _skip_to_nonblank(f, spacegroup, setting): """Read lines from f until a nonblank line not starting with a hash (#) is encountered and returns this and the next line.""" while True: line1 = f.readline() if not line1: raise SpacegroupNotFoundError( 'invalid spacegroup %s, setting %i not found in data base' % (spacegroup, setting)) line1.strip() if line1 and not line1.startswith('#'): line2 = f.readline() break return line1, line2 def _read_datafile_entry(spg, no, symbol, setting, f): """Read space group data from f to spg.""" floats = {'0.0': 0.0, '1.0': 1.0, '0': 0.0, '1': 1.0, '-1': -1.0} for n, d in [(1, 2), (1, 3), (2, 3), (1, 4), (3, 4), (1, 6), (5, 6)]: floats['{0}/{1}'.format(n, d)] = n / d floats['-{0}/{1}'.format(n, d)] = -n / d spg._no = no spg._symbol = symbol.strip() spg._setting = setting spg._centrosymmetric = bool(int(f.readline().split()[1])) # primitive vectors f.readline() spg._scaled_primitive_cell = np.array( [[float(floats.get(s, s)) for s in f.readline().split()] for i in range(3)], dtype=float) # primitive reciprocal vectors f.readline() spg._reciprocal_cell = np.array([[int(i) for i in f.readline().split()] for i in range(3)], dtype=int) # subtranslations spg._nsubtrans = int(f.readline().split()[0]) spg._subtrans = np.array( [[float(floats.get(t, t)) for t in f.readline().split()] for i in range(spg._nsubtrans)], dtype=float) # symmetry operations nsym = int(f.readline().split()[0]) symop = np.array([[float(floats.get(s, s)) for s in f.readline().split()] for i in range(nsym)], dtype=float) spg._nsymop = nsym spg._rotations = np.array(symop[:, :9].reshape((nsym, 3, 3)), dtype=int) spg._translations = symop[:, 9:] def _read_datafile(spg, spacegroup, setting, f): if isinstance(spacegroup, int): pass elif isinstance(spacegroup, str): spacegroup = ' '.join(spacegroup.strip().split()) compact_spacegroup = ''.join(spacegroup.split()) else: raise SpacegroupValueError('`spacegroup` must be of type int or str') while True: line1, line2 = _skip_to_nonblank(f, spacegroup, setting) _no, _symbol = line1.strip().split(None, 1) _symbol = format_symbol(_symbol) compact_symbol = ''.join(_symbol.split()) _setting = int(line2.strip().split()[1]) _no = int(_no) if ((isinstance(spacegroup, int) and _no == spacegroup and _setting == setting) or (isinstance(spacegroup, str) and compact_symbol == compact_spacegroup) and (setting is None or _setting == setting)): _read_datafile_entry(spg, _no, _symbol, _setting, f) break else: _skip_to_blank(f, spacegroup, setting) def parse_sitesym_element(element): """Parses one element from a single site symmetry in the form used by the International Tables. Examples: >>> parse_sitesym_element("x") ([(0, 1)], 0.0) >>> parse_sitesym_element("-1/2-y") ([(1, -1)], -0.5) >>> parse_sitesym_element("z+0.25") ([(2, 1)], 0.25) >>> parse_sitesym_element("x-z+0.5") ([(0, 1), (2, -1)], 0.5) Parameters ---------- element: str Site symmetry like "x" or "-y+1/4" or "0.5+z". Returns ------- list[tuple[int, int]] Rotation information in the form '(index, sign)' where index is 0 for "x", 1 for "y" and 2 for "z" and sign is '1' for a positive entry and '-1' for a negative entry. E.g. "x" is '(0, 1)' and "-z" is (2, -1). float Translation information in fractional space. E.g. "-1/4" is '-0.25' and "1/2" is '0.5' and "0.75" is '0.75'. """ element = element.lower() is_positive = True is_frac = False sng_trans = None fst_trans = [] snd_trans = [] rot = [] for char in element: if char == "+": is_positive = True elif char == "-": is_positive = False elif char == "/": is_frac = True elif char in "xyz": rot.append((ord(char) - ord("x"), 1 if is_positive else -1)) elif char.isdigit() or char == ".": if sng_trans is None: sng_trans = 1.0 if is_positive else -1.0 if is_frac: snd_trans.append(char) else: fst_trans.append(char) trans = 0.0 if not fst_trans else (sng_trans * float("".join(fst_trans))) if is_frac: trans /= float("".join(snd_trans)) return rot, trans def parse_sitesym_single(sym, out_rot, out_trans, sep=",", force_positive_translation=False): """Parses a single site symmetry in the form used by International Tables and overwrites 'out_rot' and 'out_trans' with data. Parameters ---------- sym: str Site symmetry in the form used by International Tables (e.g. "x,y,z", "y-1/2,x,-z"). out_rot: np.array A 3x3-integer array representing rotations (changes are made inplace). out_rot: np.array A 3-float array representing translations (changes are made inplace). sep: str String separator ("," in "x,y,z"). force_positive_translation: bool Forces fractional translations to be between 0 and 1 (otherwise negative values might be accepted). Defaults to 'False'. Returns ------- Nothing is returned: 'out_rot' and 'out_trans' are changed inplace. """ out_rot[:] = 0.0 out_trans[:] = 0.0 for i, element in enumerate(sym.split(sep)): e_rot_list, e_trans = parse_sitesym_element(element) for rot_idx, rot_sgn in e_rot_list: out_rot[i][rot_idx] = rot_sgn out_trans[i] = (e_trans % 1.0) if force_positive_translation else e_trans def parse_sitesym(symlist, sep=',', force_positive_translation=False): """Parses a sequence of site symmetries in the form used by International Tables and returns corresponding rotation and translation arrays. Example: >>> symlist = [ ... 'x,y,z', ... '-y+1/2,x+1/2,z', ... '-y,-x,-z', ... 'x-1/4, y-1/4, -z' ... ] >>> rot, trans = parse_sitesym(symlist) >>> rot array([[[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, 1]], <BLANKLINE> [[ 0, -1, 0], [ 1, 0, 0], [ 0, 0, 1]], <BLANKLINE> [[ 0, -1, 0], [-1, 0, 0], [ 0, 0, -1]], <BLANKLINE> [[ 1, 0, 0], [ 0, 1, 0], [ 0, 0, -1]]]) >>> trans array([[ 0. , 0. , 0. ], [ 0.5 , 0.5 , 0. ], [ 0. , 0. , 0. ], [-0.25, -0.25, 0. ]]) """ nsym = len(symlist) rot = np.zeros((nsym, 3, 3), dtype='int') trans = np.zeros((nsym, 3)) for i, sym in enumerate(symlist): parse_sitesym_single(sym, rot[i], trans[i], sep=sep, force_positive_translation=force_positive_translation) return rot, trans def spacegroup_from_data(no=None, symbol=None, setting=None, centrosymmetric=None, scaled_primitive_cell=None, reciprocal_cell=None, subtrans=None, sitesym=None, rotations=None, translations=None, datafile=None): """Manually create a new space group instance. This might be useful when reading crystal data with its own spacegroup definitions.""" if no is not None and setting is not None: spg = Spacegroup(no, setting, datafile) elif symbol is not None: spg = Spacegroup(symbol, None, datafile) else: raise SpacegroupValueError('either *no* and *setting* ' 'or *symbol* must be given') if not isinstance(sitesym, list): raise TypeError('sitesym must be a list') have_sym = False if centrosymmetric is not None: spg._centrosymmetric = bool(centrosymmetric) if scaled_primitive_cell is not None: spg._scaled_primitive_cell = np.array(scaled_primitive_cell) if reciprocal_cell is not None: spg._reciprocal_cell = np.array(reciprocal_cell) if subtrans is not None: spg._subtrans = np.atleast_2d(subtrans) spg._nsubtrans = spg._subtrans.shape[0] if sitesym is not None: spg._rotations, spg._translations = parse_sitesym(sitesym) have_sym = True if rotations is not None: spg._rotations = np.atleast_3d(rotations) have_sym = True if translations is not None: spg._translations = np.atleast_2d(translations) have_sym = True if have_sym: if spg._rotations.shape[0] != spg._translations.shape[0]: raise SpacegroupValueError('inconsistent number of rotations and ' 'translations') spg._nsymop = spg._rotations.shape[0] return spg
[ 1, 529, 9507, 29958, 4330, 29924, 6739, 20867, 29914, 25548, 2527, 719, 29914, 3493, 2972, 29889, 2272, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29900, 29892, 529, 5813, 29958, 13, 29937, 313, 4149, 10259, 1384, 292, 19405, 2066, 363, 4902, 467, 13, 15945, 29908, 14683, 310, 278, 14121, 2972, 770, 29889, 13, 3166, 263, 344, 3489, 13, 29888, 809, 1735, 363, 1294, 262, 1953, 13, 4013, 3883, 871, 7111, 373, 11848, 19737, 322, 278, 2913, 2318, 2566, 29889, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 5215, 18116, 13, 3166, 2090, 312, 8789, 1053, 3001, 29918, 2098, 292, 13, 3166, 19229, 1053, 7761, 13, 3166, 869, 9207, 1988, 29918, 1062, 29875, 1053, 11856, 29918, 5647, 262, 1953, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 869, 9207, 1988, 29918, 1062, 29875, 1053, 11856, 29918, 5647, 262, 1953, 13, 13, 1649, 497, 1649, 353, 6024, 14936, 2972, 2033, 13, 13, 13, 13, 1990, 14121, 2972, 2392, 29898, 2451, 1125, 13, 1678, 9995, 5160, 3682, 363, 278, 2913, 2972, 3883, 1213, 15945, 13, 1678, 1209, 13, 13, 13, 1990, 14121, 2972, 17413, 2392, 29898, 14936, 2972, 2392, 1125, 13, 1678, 9995, 29934, 1759, 287, 746, 2183, 2913, 2318, 2609, 367, 1476, 297, 848, 2967, 1213, 15945, 13, 1678, 1209, 13, 13, 13, 1990, 14121, 2972, 1917, 2392, 29898, 14936, 2972, 2392, 1125, 13, 1678, 9995, 29934, 1759, 287, 746, 6273, 505, 8340, 995, 1213, 15945, 13, 1678, 1209, 13, 13, 13, 29937, 5167, 13995, 13, 29918, 5550, 11538, 26284, 353, 7761, 29961, 524, 29892, 851, 29892, 525, 14936, 2972, 2033, 13, 13, 13, 29992, 7827, 29918, 2098, 292, 13, 1990, 14121, 2972, 29901, 13, 1678, 9995, 29909, 2913, 2318, 770, 29889, 13, 13, 1678, 450, 8871, 310, 14121, 2972, 16612, 278, 18446, 6931, 363, 13, 1678, 278, 2183, 2913, 2318, 29889, 13, 13, 1678, 8741, 29901, 13, 13, 1678, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 1678, 8653, 13, 1678, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 13, 1678, 8653, 1596, 877, 14936, 2318, 742, 269, 29887, 29889, 1217, 29892, 269, 29887, 29889, 18098, 29897, 13, 1678, 14121, 2318, 29871, 29906, 29906, 29945, 383, 286, 448, 29941, 286, 13, 1678, 8653, 269, 29887, 29889, 7052, 29881, 29918, 9469, 3321, 29918, 3729, 13, 1678, 1409, 4197, 29961, 29871, 29900, 29889, 1919, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 1402, 13, 965, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 1919, 259, 29900, 29889, 29945, 1402, 13, 965, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 4514, 2314, 13, 1678, 8653, 11840, 29892, 17690, 353, 269, 29887, 29889, 1686, 27445, 29918, 16315, 4197, 29961, 29900, 29892, 29900, 29892, 29900, 24960, 13, 1678, 8653, 11840, 13, 1678, 1409, 4197, 29961, 29871, 29900, 29889, 1919, 259, 29900, 29889, 1919, 259, 29900, 29889, 21251, 13, 965, 518, 29871, 29900, 29889, 1919, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 1402, 13, 965, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 1919, 259, 29900, 29889, 29945, 1402, 13, 965, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 4514, 2314, 13, 1678, 9995, 13, 1678, 694, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 1583, 3032, 1217, 29892, 13, 4706, 1574, 2433, 14936, 2318, 1353, 297, 4623, 323, 1849, 310, 22121, 11195, 1188, 1140, 29891, 29889, 1495, 13, 1678, 5829, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 1583, 3032, 18098, 29892, 13, 4706, 1574, 2433, 29950, 20648, 29899, 29924, 585, 2543, 262, 313, 272, 6121, 29897, 5829, 363, 278, 2913, 2318, 29889, 1495, 13, 1678, 4444, 353, 2875, 29898, 2892, 1583, 29901, 1583, 3032, 26740, 29892, 13, 462, 539, 1574, 2433, 14936, 2318, 4444, 29889, 20370, 697, 470, 1023, 29889, 1495, 13, 1678, 24094, 353, 2875, 29898, 2892, 1583, 29901, 1583, 3032, 18098, 29961, 29900, 1402, 13, 462, 539, 1574, 13776, 29908, 29931, 19704, 1134, 29901, 13, 13, 1678, 349, 268, 19269, 13, 1678, 306, 268, 3573, 1644, 3241, 29892, 298, 29974, 29895, 29974, 29880, 29922, 29906, 29876, 13, 1678, 383, 268, 3700, 1644, 3241, 29892, 298, 29892, 29895, 29892, 29880, 599, 7736, 470, 1584, 13, 1678, 319, 29892, 29933, 29892, 29907, 2323, 3700, 1644, 3241, 29892, 413, 29974, 29880, 29922, 29906, 29876, 29892, 298, 29974, 29880, 29922, 29906, 29876, 29892, 298, 29974, 29895, 29922, 29906, 29876, 13, 1678, 390, 268, 364, 9706, 833, 17143, 1705, 1644, 3241, 29892, 448, 29882, 29974, 29895, 29974, 29880, 29922, 29941, 29876, 313, 711, 3901, 416, 298, 29899, 29895, 29974, 29880, 29922, 29941, 29876, 313, 24244, 29897, 13, 9651, 5124, 1159, 13, 1678, 1644, 1883, 962, 16414, 353, 2875, 29898, 2892, 1583, 29901, 1583, 3032, 1760, 1883, 962, 16414, 29892, 13, 462, 1669, 1574, 2433, 8809, 1979, 263, 4818, 310, 18446, 4864, 29889, 1495, 13, 1678, 6287, 29881, 29918, 9469, 3321, 29918, 3729, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 1583, 3032, 7052, 29881, 29918, 9469, 3321, 29918, 3729, 29892, 13, 4706, 1574, 2433, 18213, 3321, 3038, 297, 6287, 29881, 10350, 408, 263, 4636, 411, 278, 525, 13, 4706, 525, 9469, 3321, 12047, 3412, 278, 4206, 29889, 1495, 13, 1678, 9522, 771, 1052, 29918, 3729, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 1583, 3032, 4361, 771, 1052, 29918, 3729, 29892, 13, 4706, 1574, 2433, 9643, 16498, 16285, 393, 10638, 599, 19015, 4579, 1711, 1661, 29899, 1454, 29890, 4215, 525, 13, 4706, 525, 999, 5942, 408, 263, 4636, 411, 278, 16498, 16285, 3412, 278, 4206, 29889, 1495, 13, 1678, 302, 1491, 3286, 353, 2875, 29898, 2892, 1583, 29901, 7431, 29898, 1311, 3032, 1491, 3286, 511, 13, 462, 308, 1574, 2433, 4557, 310, 3038, 29899, 1491, 3286, 18411, 12047, 29889, 1495, 13, 1678, 1788, 2454, 29918, 6897, 663, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 11856, 29918, 5647, 262, 1953, 29898, 1311, 29892, 29871, 29896, 511, 13, 4706, 1574, 2433, 2158, 1788, 2454, 18070, 322, 29879, 337, 7922, 338, 29918, 1062, 29875, 1495, 13, 13, 13, 1678, 822, 903, 657, 29918, 1983, 962, 459, 29898, 1311, 1125, 13, 4706, 9995, 11609, 29879, 3001, 1353, 310, 18446, 6931, 1213, 15945, 13, 4706, 565, 1583, 29889, 1760, 1883, 962, 16414, 29901, 13, 9651, 736, 29871, 29906, 334, 7431, 29898, 1311, 3032, 5450, 800, 29897, 334, 7431, 29898, 1311, 3032, 1491, 3286, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 7431, 29898, 1311, 3032, 5450, 800, 29897, 334, 7431, 29898, 1311, 3032, 1491, 3286, 29897, 13, 13, 1678, 302, 11967, 459, 353, 2875, 7373, 657, 29918, 1983, 962, 459, 29892, 1574, 2433, 11536, 1353, 310, 18446, 6931, 29889, 1495, 13, 1678, 1014, 3286, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 1583, 3032, 1491, 3286, 29892, 13, 4706, 1574, 2433, 4300, 29880, 800, 12047, 23329, 304, 3038, 29899, 1491, 29899, 3286, 29880, 800, 29889, 1495, 13, 1678, 5731, 800, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 1583, 3032, 5450, 800, 29892, 13, 4706, 1574, 2433, 25548, 2527, 719, 13733, 13516, 29889, 450, 21292, 1080, 526, 451, 5134, 525, 13, 4706, 525, 1454, 1644, 1883, 962, 2527, 16888, 10901, 303, 1338, 29889, 1495, 13, 1678, 5578, 800, 353, 2875, 29898, 13, 4706, 14013, 1583, 29901, 1583, 3032, 3286, 29880, 800, 29892, 13, 4706, 1574, 2433, 25548, 2527, 719, 5578, 800, 29889, 450, 21292, 1080, 526, 451, 5134, 525, 13, 4706, 525, 1454, 1644, 1883, 962, 2527, 16888, 10901, 303, 1338, 29889, 1495, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2913, 2972, 29901, 903, 5550, 11538, 26284, 29892, 4444, 29922, 29896, 29892, 848, 1445, 29922, 8516, 1125, 13, 4706, 9995, 11609, 29879, 263, 716, 14121, 2972, 2777, 29889, 13, 13, 4706, 12662, 2699, 29901, 13, 13, 4706, 2913, 2972, 584, 938, 891, 1347, 891, 14121, 2972, 2777, 13, 9651, 450, 2913, 2318, 1353, 297, 4623, 323, 1849, 310, 13, 9651, 22121, 11195, 1188, 1140, 29891, 470, 967, 18033, 29899, 29924, 585, 2543, 262, 5829, 29889, 382, 29889, 29887, 29889, 13, 9651, 2913, 2972, 29922, 29906, 29906, 29945, 322, 2913, 2972, 2433, 29943, 286, 448, 29941, 286, 29915, 526, 7126, 29889, 13, 4706, 4444, 584, 29871, 29896, 891, 29871, 29906, 13, 9651, 3834, 2913, 6471, 505, 901, 1135, 697, 4444, 29889, 421, 26740, 29952, 13, 9651, 3683, 1475, 8449, 310, 1438, 881, 367, 1304, 29889, 13, 4706, 848, 1445, 584, 6213, 891, 1347, 13, 9651, 10802, 304, 2566, 934, 29889, 960, 421, 8516, 1673, 278, 278, 2322, 2566, 13, 9651, 674, 367, 1304, 29889, 13, 4706, 9995, 13, 4706, 565, 338, 8758, 29898, 3493, 2972, 29892, 14121, 2972, 1125, 13, 9651, 363, 413, 29892, 325, 297, 2913, 2972, 17255, 8977, 26914, 7076, 7295, 13, 18884, 731, 5552, 29898, 1311, 29892, 413, 29892, 325, 29897, 13, 18884, 11856, 29918, 5647, 262, 1953, 29898, 1311, 29892, 7700, 29897, 13, 9651, 736, 13, 4706, 565, 451, 848, 1445, 29901, 13, 9651, 848, 1445, 353, 679, 29918, 1272, 1445, 580, 13, 4706, 411, 1722, 29898, 1272, 1445, 29892, 525, 29878, 1495, 408, 285, 29881, 29901, 13, 9651, 903, 949, 29918, 1272, 1445, 29898, 1311, 29892, 2913, 2972, 29892, 4444, 29892, 285, 29881, 29897, 13, 4706, 11856, 29918, 5647, 262, 1953, 29898, 1311, 29892, 7700, 29897, 13, 13, 13, 4706, 11856, 29918, 5647, 262, 1953, 29898, 1311, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 525, 14936, 2972, 29414, 29881, 29892, 4444, 16328, 29881, 16029, 1273, 313, 1311, 29889, 1217, 29892, 1583, 29889, 26740, 29897, 13, 13, 1678, 822, 7379, 919, 29898, 1311, 1125, 13, 4706, 736, 11117, 4537, 2396, 1583, 29889, 1217, 29892, 525, 26740, 2396, 1583, 29889, 26740, 29913, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 9995, 11609, 263, 1347, 8954, 310, 278, 2913, 2318, 848, 297, 13, 4706, 278, 1021, 3402, 408, 1476, 278, 2566, 1213, 15945, 13, 4706, 3240, 791, 353, 5159, 13, 4706, 396, 694, 29892, 5829, 13, 4706, 3240, 791, 29889, 4397, 877, 29995, 29899, 29941, 29881, 259, 1273, 29879, 29905, 29876, 29915, 1273, 313, 1311, 29889, 1217, 29892, 1583, 29889, 18098, 876, 13, 4706, 396, 4444, 13, 4706, 3240, 791, 29889, 4397, 877, 29871, 4444, 1273, 29881, 29905, 29876, 29915, 1273, 313, 1311, 29889, 26740, 876, 13, 4706, 396, 1644, 1883, 962, 16414, 13, 4706, 3240, 791, 29889, 4397, 877, 29871, 1644, 1883, 962, 16414, 1273, 29881, 29905, 29876, 29915, 1273, 313, 1311, 29889, 1760, 1883, 962, 16414, 876, 13, 4706, 396, 19269, 12047, 13, 4706, 3240, 791, 29889, 4397, 877, 29871, 19269, 12047, 29905, 29876, 1495, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 9651, 3240, 791, 29889, 4397, 877, 259, 25710, 13, 9651, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 18884, 3240, 791, 29889, 4397, 877, 1273, 29896, 29941, 29889, 29896, 29900, 29888, 29915, 1273, 313, 1311, 29889, 7052, 29881, 29918, 9469, 3321, 29918, 3729, 29961, 29875, 29892, 432, 12622, 13, 9651, 3240, 791, 29889, 4397, 28909, 29876, 1495, 13, 4706, 396, 19269, 9522, 771, 1052, 12047, 13, 4706, 3240, 791, 29889, 4397, 877, 29871, 9522, 771, 1052, 12047, 29905, 29876, 1495, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 9651, 3240, 791, 29889, 4397, 877, 259, 25710, 13, 9651, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 18884, 3240, 791, 29889, 4397, 877, 1273, 29941, 29881, 29915, 1273, 313, 1311, 29889, 4361, 771, 1052, 29918, 3729, 29961, 29875, 29892, 432, 12622, 13, 9651, 3240, 791, 29889, 4397, 28909, 29876, 1495, 13, 4706, 396, 1014, 29880, 19704, 13, 4706, 3240, 791, 29889, 4397, 877, 29871, 1273, 29881, 1014, 3286, 29880, 800, 29905, 29876, 29915, 1273, 1583, 29889, 29876, 1491, 3286, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 29876, 1491, 3286, 1125, 13, 9651, 3240, 791, 29889, 4397, 877, 259, 25710, 13, 9651, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 18884, 3240, 791, 29889, 4397, 877, 1273, 29896, 29941, 29889, 29896, 29900, 29888, 29915, 1273, 313, 1311, 29889, 1491, 3286, 29961, 29875, 29892, 432, 12622, 13, 9651, 3240, 791, 29889, 4397, 28909, 29876, 1495, 13, 4706, 396, 18446, 6931, 13, 4706, 302, 5450, 353, 7431, 29898, 1311, 29889, 5450, 800, 29897, 13, 4706, 3240, 791, 29889, 4397, 877, 29871, 1273, 29881, 18446, 6931, 313, 5450, 29974, 3286, 2144, 29876, 29915, 1273, 302, 5450, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 5450, 1125, 13, 9651, 3240, 791, 29889, 4397, 877, 25710, 13, 9651, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 18884, 3240, 791, 29889, 4397, 877, 25710, 13, 18884, 363, 413, 297, 3464, 29898, 29941, 1125, 13, 462, 1678, 3240, 791, 29889, 4397, 877, 1273, 29906, 29881, 29915, 1273, 313, 1311, 29889, 5450, 800, 29961, 29875, 29892, 432, 29892, 413, 12622, 13, 18884, 3240, 791, 29889, 4397, 877, 29871, 25710, 13, 9651, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 18884, 3240, 791, 29889, 4397, 877, 1273, 29896, 29941, 29889, 29896, 29900, 29888, 29915, 1273, 1583, 29889, 3286, 29880, 800, 29961, 29875, 29892, 432, 2314, 13, 9651, 3240, 791, 29889, 4397, 28909, 29876, 1495, 13, 4706, 3240, 791, 29889, 4397, 28909, 29876, 1495, 13, 4706, 736, 525, 4286, 7122, 29898, 2267, 791, 29897, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 736, 1583, 29889, 1217, 1275, 916, 29889, 1217, 322, 1583, 29889, 26740, 1275, 916, 29889, 26740, 13, 13, 1678, 822, 4770, 484, 12035, 1311, 29892, 916, 1125, 13, 4706, 736, 451, 1583, 17255, 1837, 12035, 1228, 29897, 13, 13, 1678, 822, 4770, 1896, 12035, 1311, 29892, 916, 1125, 13, 4706, 736, 1583, 29889, 1217, 529, 916, 29889, 1217, 470, 313, 1311, 29889, 1217, 1275, 916, 29889, 1217, 13, 462, 462, 418, 322, 1583, 29889, 26740, 529, 916, 29889, 26740, 29897, 13, 13, 1678, 822, 4770, 2248, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 1217, 13, 13, 1678, 4770, 524, 1649, 353, 4770, 2248, 1649, 13, 13, 1678, 822, 679, 29918, 11967, 459, 29898, 1311, 29892, 4636, 29922, 5574, 1125, 13, 4706, 9995, 11609, 29879, 599, 18446, 6931, 313, 18271, 297, 26100, 322, 13, 4706, 1014, 3286, 29880, 800, 29897, 408, 263, 5665, 310, 313, 5450, 362, 29892, 13962, 29897, 13, 4706, 5291, 2701, 29889, 13, 4706, 12662, 2699, 29901, 13, 13, 4706, 4636, 29901, 7223, 13, 9651, 565, 2089, 736, 16936, 2527, 719, 5858, 408, 921, 29892, 29891, 29892, 29920, 13, 4706, 9995, 13, 4706, 5016, 459, 353, 5159, 13, 4706, 610, 1907, 353, 518, 29896, 29962, 13, 4706, 565, 1583, 29889, 1760, 1883, 962, 16414, 29901, 13, 9651, 610, 1907, 29889, 4397, 6278, 29896, 29897, 13, 4706, 363, 610, 537, 297, 610, 1907, 29901, 13, 9651, 363, 1014, 3286, 297, 1583, 29889, 1491, 3286, 29901, 13, 18884, 363, 5731, 29892, 1301, 297, 14319, 29898, 1311, 29889, 5450, 800, 29892, 1583, 29889, 3286, 29880, 800, 1125, 13, 462, 1678, 716, 3286, 353, 7442, 29889, 1545, 29898, 3286, 718, 1014, 3286, 29892, 29871, 29896, 29897, 13, 462, 1678, 5016, 459, 29889, 4397, 3552, 862, 537, 334, 5731, 29892, 716, 3286, 876, 13, 4706, 565, 451, 29898, 5344, 1125, 13, 9651, 5016, 459, 353, 518, 11490, 29906, 726, 29898, 29949, 558, 29897, 363, 438, 558, 297, 5016, 459, 29962, 13, 4706, 736, 5016, 459, 13, 13, 1678, 822, 679, 29918, 459, 29898, 1311, 1125, 13, 4706, 9995, 11609, 29879, 599, 18446, 6931, 313, 18271, 297, 26100, 322, 13, 4706, 1014, 3286, 29880, 800, 511, 541, 25531, 679, 29918, 11967, 459, 3285, 896, 526, 4133, 408, 13, 4706, 1023, 29871, 299, 2378, 29879, 1213, 15945, 13, 4706, 565, 1583, 29889, 1760, 1883, 962, 16414, 29901, 13, 9651, 5731, 353, 7442, 29889, 29873, 488, 29898, 9302, 29889, 29894, 1429, 3552, 1311, 29889, 5450, 800, 29892, 448, 1311, 29889, 5450, 800, 8243, 13, 462, 3986, 313, 1311, 29889, 29876, 1491, 3286, 29892, 29871, 29896, 29892, 29871, 29896, 876, 13, 9651, 1301, 353, 7442, 29889, 29873, 488, 29898, 9302, 29889, 29894, 1429, 3552, 1311, 29889, 3286, 29880, 800, 29892, 448, 1311, 29889, 3286, 29880, 800, 8243, 13, 462, 9651, 313, 1311, 29889, 29876, 1491, 3286, 29892, 29871, 29896, 876, 13, 9651, 1301, 4619, 7442, 29889, 14358, 29898, 1311, 29889, 1491, 3286, 29892, 29871, 29906, 334, 7431, 29898, 1311, 29889, 5450, 800, 511, 9685, 29922, 29900, 29897, 13, 9651, 1301, 353, 7442, 29889, 1545, 29898, 3286, 29892, 29871, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 5731, 353, 7442, 29889, 29873, 488, 29898, 1311, 29889, 5450, 800, 29892, 313, 1311, 29889, 29876, 1491, 3286, 29892, 29871, 29896, 29892, 29871, 29896, 876, 13, 9651, 1301, 353, 7442, 29889, 29873, 488, 29898, 1311, 29889, 3286, 29880, 800, 29892, 313, 1311, 29889, 29876, 1491, 3286, 29892, 29871, 29896, 876, 13, 9651, 1301, 4619, 7442, 29889, 14358, 29898, 1311, 29889, 1491, 3286, 29892, 7431, 29898, 1311, 29889, 5450, 800, 511, 9685, 29922, 29900, 29897, 13, 9651, 1301, 353, 7442, 29889, 1545, 29898, 3286, 29892, 29871, 29896, 29897, 13, 4706, 736, 5731, 29892, 1301, 13, 13, 1678, 822, 679, 29918, 5450, 800, 29898, 1311, 1125, 13, 4706, 9995, 11609, 599, 5731, 800, 29892, 3704, 297, 26100, 363, 13, 4706, 1644, 1883, 962, 16414, 10901, 303, 1338, 1213, 15945, 13, 4706, 565, 1583, 29889, 1760, 1883, 962, 16414, 29901, 13, 9651, 736, 7442, 29889, 29894, 1429, 3552, 1311, 29889, 5450, 800, 29892, 448, 1311, 29889, 5450, 800, 876, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 5450, 800, 13, 13, 1678, 822, 7126, 29918, 999, 5942, 29898, 1311, 29892, 298, 6321, 1125, 13, 4706, 9995, 11609, 599, 7126, 2143, 5942, 304, 278, 1051, 310, 16498, 16285, 13, 4706, 297, 298, 6321, 29889, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 269, 29887, 29889, 1686, 27445, 29918, 999, 5942, 4197, 29961, 29900, 29892, 29871, 29900, 29892, 29871, 29906, 24960, 13, 4706, 1409, 4197, 29961, 29871, 29900, 29892, 259, 29900, 29892, 448, 29906, 1402, 13, 1669, 518, 29871, 29900, 29892, 448, 29906, 29892, 259, 29900, 1402, 13, 1669, 21069, 29906, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 1669, 518, 29871, 29906, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 1669, 518, 29871, 29900, 29892, 259, 29906, 29892, 259, 29900, 1402, 13, 1669, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29906, 24960, 13, 4706, 9995, 13, 4706, 298, 6321, 353, 7442, 29889, 2378, 29898, 29882, 6321, 29892, 26688, 2433, 524, 742, 29871, 299, 1195, 29922, 29906, 29897, 13, 4706, 5731, 353, 1583, 29889, 657, 29918, 5450, 800, 580, 13, 4706, 302, 29892, 302, 5450, 353, 7431, 29898, 29882, 6321, 511, 7431, 29898, 5450, 29897, 13, 4706, 390, 353, 5731, 29889, 3286, 4220, 29898, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 467, 690, 14443, 3552, 29941, 334, 302, 5450, 29892, 29871, 29941, 8106, 29911, 13, 4706, 337, 1579, 353, 7442, 29889, 6333, 29898, 29882, 6321, 29892, 390, 467, 690, 14443, 3552, 29876, 334, 302, 5450, 29892, 29871, 29941, 876, 13, 4706, 1399, 353, 7442, 29889, 2506, 6605, 29898, 999, 29880, 29889, 29911, 29897, 13, 4706, 337, 1579, 353, 337, 1579, 29961, 513, 29962, 13, 4706, 2923, 353, 7442, 29889, 12765, 29898, 999, 29880, 29892, 9685, 29922, 29900, 29897, 13, 4706, 11105, 353, 7442, 29889, 1384, 29898, 12765, 29892, 9685, 29922, 29896, 29897, 13, 4706, 736, 7442, 29889, 29894, 1429, 3552, 999, 29880, 7503, 29899, 29896, 3816, 13168, 1402, 337, 1579, 14352, 29896, 29892, 584, 12622, 13, 13, 1678, 822, 7126, 29918, 29880, 19704, 29918, 9748, 29898, 1311, 29892, 318, 29894, 29893, 1125, 13, 4706, 9995, 11609, 599, 24094, 3291, 7126, 304, 738, 310, 278, 24094, 3291, 13, 4706, 297, 421, 4090, 29893, 29952, 411, 3390, 304, 5731, 800, 871, 29889, 13, 13, 4706, 9333, 7126, 24094, 3291, 393, 21929, 1960, 278, 5418, 304, 13, 4706, 1677, 29877, 526, 5134, 297, 278, 1962, 313, 28990, 445, 263, 2924, 310, 1855, 13, 4706, 2913, 1873, 310, 278, 7126, 29918, 999, 5942, 580, 1158, 467, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 269, 29887, 29889, 1686, 27445, 29918, 29880, 19704, 29918, 9748, 4197, 29961, 29900, 29892, 29871, 29900, 29892, 29871, 29906, 24960, 13, 4706, 1409, 4197, 29961, 29871, 29900, 29892, 259, 29900, 29892, 448, 29906, 1402, 13, 1669, 518, 29871, 29900, 29892, 448, 29906, 29892, 259, 29900, 1402, 13, 1669, 21069, 29906, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 1669, 518, 29871, 29906, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 1669, 518, 29871, 29900, 29892, 259, 29906, 29892, 259, 29900, 1402, 13, 1669, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29906, 24960, 13, 13, 4706, 9995, 13, 4706, 318, 29894, 29893, 353, 7442, 29889, 2378, 29898, 4090, 29893, 29892, 29871, 299, 1195, 29922, 29906, 29897, 13, 4706, 5731, 353, 1583, 29889, 657, 29918, 5450, 800, 580, 13, 4706, 302, 29892, 302, 5450, 353, 7431, 29898, 4090, 29893, 511, 7431, 29898, 5450, 29897, 13, 4706, 18112, 353, 7442, 29889, 6333, 29898, 4090, 29893, 29892, 5731, 467, 690, 14443, 3552, 29876, 334, 302, 5450, 29892, 29871, 29941, 876, 13, 4706, 1399, 353, 7442, 29889, 2506, 6605, 29898, 20146, 1953, 29889, 29911, 29897, 13, 4706, 18112, 353, 18112, 29961, 513, 29962, 13, 4706, 2923, 353, 7442, 29889, 12765, 29898, 20146, 1953, 29892, 9685, 29922, 29900, 29897, 13, 4706, 11105, 353, 7442, 29889, 1384, 29898, 12765, 29892, 9685, 29922, 29896, 29897, 13, 4706, 736, 7442, 29889, 29894, 1429, 3552, 20146, 1953, 7503, 29899, 29896, 3816, 13168, 1402, 18112, 14352, 29896, 29901, 12622, 13, 13, 1678, 822, 18446, 29918, 8945, 3368, 29918, 999, 5942, 29898, 1311, 29892, 298, 6321, 1125, 13, 4706, 9995, 11609, 29879, 385, 1409, 310, 1021, 2159, 408, 334, 29882, 6321, 15966, 6943, 278, 13, 4706, 6590, 18446, 29899, 1686, 27445, 2143, 5942, 310, 19604, 13, 4706, 16285, 29889, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 269, 29887, 29889, 11967, 2527, 719, 29918, 8945, 3368, 29918, 999, 5942, 4197, 29961, 29906, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29900, 24960, 13, 4706, 1409, 4197, 29961, 29871, 29900, 29892, 259, 29900, 29892, 448, 29906, 1402, 13, 1669, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29906, 24960, 13, 4706, 9995, 13, 4706, 298, 6321, 353, 7442, 29889, 2378, 29898, 29882, 6321, 29892, 26688, 29922, 524, 29892, 29871, 299, 1195, 29922, 29906, 29897, 13, 4706, 4226, 3368, 353, 7442, 29889, 6310, 29898, 29882, 6321, 29889, 12181, 29892, 938, 29897, 13, 4706, 390, 353, 1583, 29889, 657, 29918, 5450, 800, 2141, 3286, 4220, 29898, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 29897, 13, 4706, 363, 474, 29892, 330, 297, 26985, 29898, 29882, 6321, 1125, 13, 9651, 330, 11967, 353, 7442, 29889, 6333, 29898, 29934, 29892, 330, 29897, 13, 9651, 432, 353, 7442, 29889, 2506, 6605, 29898, 3174, 962, 29889, 29911, 9601, 29900, 29962, 13, 9651, 4226, 3368, 29961, 29875, 29892, 584, 29962, 353, 330, 11967, 29961, 29926, 29962, 13, 4706, 736, 4226, 3368, 13, 13, 1678, 822, 5412, 29918, 999, 5942, 29898, 1311, 29892, 298, 6321, 1125, 13, 4706, 9995, 11609, 29879, 263, 11306, 334, 29882, 6321, 29930, 6943, 871, 278, 18446, 29899, 13092, 13, 4706, 2143, 5942, 29889, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 269, 29887, 29889, 13092, 29918, 999, 5942, 4197, 29961, 29871, 29906, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 4706, 2023, 462, 4706, 518, 29871, 29900, 29892, 448, 29906, 29892, 259, 29900, 1402, 13, 4706, 2023, 462, 4706, 518, 29871, 29906, 29892, 259, 29906, 29892, 259, 29900, 1402, 13, 4706, 2023, 462, 4706, 518, 29871, 29900, 29892, 448, 29906, 29892, 448, 29906, 24960, 13, 4706, 1409, 4197, 29961, 29906, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 13, 1669, 518, 29906, 29892, 29871, 29906, 29892, 29871, 29900, 24960, 13, 4706, 9995, 13, 4706, 298, 6321, 353, 7442, 29889, 2378, 29898, 29882, 6321, 29892, 26688, 29922, 524, 29892, 29871, 299, 1195, 29922, 29906, 29897, 13, 4706, 298, 29895, 3083, 555, 353, 1583, 29889, 11967, 2527, 719, 29918, 8945, 3368, 29918, 999, 5942, 29898, 29882, 6321, 29897, 13, 4706, 3635, 353, 7442, 29889, 2506, 6605, 29898, 29882, 29895, 3083, 555, 29889, 29911, 29897, 13, 4706, 474, 17858, 353, 3635, 29889, 5085, 441, 580, 13, 4706, 921, 13168, 353, 7442, 29889, 6897, 29898, 9302, 29889, 12765, 29898, 29882, 29895, 3083, 555, 29961, 17858, 1402, 9685, 29922, 29900, 8106, 1384, 29898, 8990, 29922, 29896, 29897, 13, 4706, 11105, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 29961, 5574, 1402, 921, 13168, 876, 13, 4706, 527, 1278, 353, 11105, 29961, 29875, 17858, 29962, 13, 4706, 736, 298, 6321, 29961, 326, 1278, 29962, 13, 13, 1678, 822, 7126, 29918, 16315, 29898, 1311, 29892, 13, 462, 308, 6287, 29881, 29918, 1066, 2187, 29892, 13, 462, 308, 373, 20908, 15815, 2433, 2704, 742, 13, 462, 308, 5016, 17990, 29922, 29896, 29872, 29899, 29941, 29892, 13, 462, 308, 6919, 273, 2478, 29922, 8516, 1125, 13, 4706, 9995, 11609, 29879, 278, 6287, 29881, 11909, 322, 599, 1009, 7126, 11840, 29889, 13, 13, 4706, 12662, 2699, 29901, 13, 13, 4706, 6287, 29881, 29918, 1066, 2187, 29901, 1051, 891, 1409, 13, 9651, 2391, 310, 1661, 29899, 1686, 27445, 11840, 2183, 297, 5190, 3038, 10350, 29889, 13, 13, 4706, 6919, 273, 2478, 29901, 1051, 891, 1409, 29892, 13136, 313, 4381, 29922, 8516, 29897, 13, 9651, 2391, 310, 6919, 273, 2478, 6590, 304, 278, 18067, 11840, 29889, 13, 13, 4706, 373, 20908, 15815, 584, 525, 17462, 29915, 891, 525, 6506, 29915, 891, 525, 25442, 29915, 891, 525, 2704, 29915, 13, 9651, 9123, 565, 421, 7052, 29881, 29918, 1066, 2187, 29952, 1712, 18446, 29899, 1686, 27445, 13, 9651, 11909, 310, 2989, 6919, 6906, 29901, 13, 13, 9651, 525, 17462, 29915, 13, 1669, 11455, 5684, 18446, 29899, 1686, 27445, 11909, 13, 9651, 525, 6506, 29915, 13, 18884, 5191, 13, 9651, 525, 25442, 29915, 13, 18884, 763, 525, 17462, 742, 541, 2228, 385, 4911, 22709, 13, 9651, 525, 2704, 29915, 13, 18884, 1153, 4637, 263, 14121, 2972, 1917, 2392, 13, 13, 4706, 5016, 17990, 29901, 5785, 13, 9651, 3080, 12539, 376, 19244, 29908, 1010, 705, 287, 1023, 11840, 297, 6287, 29881, 10350, 13, 9651, 1434, 896, 526, 29115, 408, 278, 1021, 3268, 29889, 13, 13, 4706, 16969, 29901, 13, 13, 4706, 11840, 29901, 1409, 13, 9651, 319, 11848, 19737, 1409, 310, 7126, 11840, 29889, 13, 4706, 17690, 29901, 1051, 13, 9651, 319, 1051, 310, 6043, 16285, 22146, 607, 1881, 3268, 338, 13, 9651, 7126, 304, 278, 6590, 4133, 3268, 29889, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 11840, 29892, 17690, 353, 269, 29887, 29889, 1686, 27445, 29918, 16315, 4197, 29961, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 518, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 24960, 13, 4706, 8653, 11840, 13, 4706, 1409, 4197, 29961, 29871, 29900, 29889, 1919, 259, 29900, 29889, 1919, 259, 29900, 29889, 21251, 13, 1669, 518, 29871, 29900, 29889, 1919, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 1402, 13, 1669, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 1919, 259, 29900, 29889, 29945, 1402, 13, 1669, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 21251, 13, 1669, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 1919, 259, 29900, 29889, 21251, 13, 1669, 518, 29871, 29900, 29889, 1919, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 21251, 13, 1669, 518, 29871, 29900, 29889, 1919, 259, 29900, 29889, 1919, 259, 29900, 29889, 29945, 1402, 13, 1669, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 29892, 259, 29900, 29889, 29945, 24960, 13, 4706, 8653, 17690, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29962, 13, 4706, 9995, 13, 4706, 17690, 353, 5159, 13, 4706, 11840, 353, 5159, 13, 13, 4706, 6287, 29881, 353, 7442, 29889, 2378, 29898, 7052, 29881, 29918, 1066, 2187, 29892, 29871, 299, 1195, 29922, 29906, 29897, 13, 13, 4706, 363, 2924, 29892, 926, 297, 26985, 29898, 7052, 29881, 1125, 13, 9651, 363, 5731, 29892, 1301, 297, 1583, 29889, 657, 29918, 11967, 459, 7295, 13, 18884, 3268, 353, 7442, 29889, 1545, 29898, 9302, 29889, 6333, 29898, 5450, 29892, 926, 29897, 718, 1301, 29892, 29871, 29896, 1846, 13, 18884, 565, 451, 11840, 29901, 13, 462, 1678, 11840, 29889, 4397, 29898, 2746, 29897, 13, 462, 1678, 17690, 29889, 4397, 29898, 14380, 29897, 13, 462, 1678, 6773, 13, 18884, 260, 353, 3268, 448, 11840, 13, 18884, 11105, 353, 7442, 29889, 497, 29898, 13, 462, 1678, 313, 6897, 29898, 29873, 29897, 529, 5016, 17990, 29897, 891, 313, 6897, 29898, 6897, 29898, 29873, 29897, 448, 29871, 29896, 29889, 29900, 29897, 529, 5016, 17990, 511, 9685, 29922, 29896, 29897, 13, 18884, 565, 7442, 29889, 1384, 29898, 13168, 1125, 13, 462, 1678, 1399, 29879, 353, 7442, 29889, 1191, 3062, 29898, 13168, 467, 1579, 8606, 580, 13, 462, 1678, 363, 1399, 297, 1399, 29879, 29901, 13, 462, 4706, 396, 769, 591, 723, 925, 788, 278, 1021, 2655, 1449, 1599, 14383, 13, 462, 4706, 565, 17690, 29961, 513, 29962, 1275, 2924, 29901, 13, 462, 9651, 1209, 13, 462, 4706, 25342, 373, 20908, 15815, 1275, 525, 17462, 2396, 13, 462, 9651, 1209, 13, 462, 4706, 25342, 373, 20908, 15815, 1275, 525, 6506, 2396, 13, 462, 9651, 17690, 29961, 513, 29962, 353, 2924, 13, 462, 4706, 25342, 373, 20908, 15815, 1275, 525, 25442, 2396, 13, 462, 9651, 18116, 29889, 25442, 877, 7052, 29881, 29918, 1066, 2187, 1273, 29881, 322, 1273, 29881, 525, 13, 462, 462, 3986, 525, 598, 7126, 29915, 1273, 13, 462, 462, 3986, 313, 29895, 12772, 29961, 513, 1402, 2924, 876, 13, 462, 4706, 25342, 373, 20908, 15815, 1275, 525, 2704, 2396, 13, 462, 9651, 12020, 14121, 2972, 1917, 2392, 29898, 13, 462, 18884, 525, 7052, 29881, 29918, 1066, 2187, 1273, 29881, 322, 1273, 29881, 526, 7126, 29915, 1273, 13, 462, 18884, 313, 29895, 12772, 29961, 513, 1402, 2924, 876, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 12020, 14121, 2972, 1917, 2392, 29898, 13, 462, 18884, 525, 15730, 376, 265, 20908, 15815, 29908, 1818, 367, 697, 310, 29901, 525, 13, 462, 18884, 18793, 17462, 613, 376, 6506, 613, 376, 25442, 29908, 470, 376, 2704, 1642, 1495, 13, 18884, 1683, 29901, 13, 462, 1678, 11840, 29889, 4397, 29898, 2746, 29897, 13, 462, 1678, 17690, 29889, 4397, 29898, 14380, 29897, 13, 13, 4706, 736, 7442, 29889, 2378, 29898, 16315, 511, 17690, 13, 13, 1678, 822, 18446, 29918, 8945, 3368, 29918, 16315, 29898, 1311, 29892, 13, 462, 462, 29871, 6287, 29881, 29918, 1066, 2187, 29892, 13, 462, 462, 29871, 2910, 29918, 517, 29918, 5441, 3729, 29922, 5574, 1125, 13, 4706, 9995, 11609, 29879, 385, 1409, 310, 1021, 2159, 408, 334, 7052, 29881, 29918, 1066, 2187, 15966, 13, 4706, 6943, 278, 6590, 18446, 29899, 1686, 27445, 11840, 310, 13, 4706, 19604, 16285, 29889, 13, 13, 4706, 960, 334, 1958, 29918, 517, 29918, 5441, 3729, 29930, 338, 1565, 29892, 278, 4133, 11909, 526, 599, 13, 4706, 20545, 964, 278, 5190, 3038, 29892, 474, 29889, 29872, 29889, 24094, 5578, 800, 526, 13, 4706, 5134, 408, 18446, 5455, 29889, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 269, 29887, 29889, 11967, 2527, 719, 29918, 8945, 3368, 29918, 16315, 4197, 29961, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29945, 1402, 518, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 24960, 13, 4706, 1409, 4197, 29961, 29871, 29900, 1696, 259, 29900, 1696, 259, 29900, 29889, 1402, 13, 1669, 518, 29871, 29900, 1696, 259, 29900, 1696, 259, 29900, 5586, 2314, 13, 4706, 9995, 13, 4706, 6287, 29881, 353, 7442, 29889, 2378, 29898, 7052, 29881, 29918, 1066, 2187, 29892, 29871, 299, 1195, 29922, 29906, 29897, 13, 4706, 4226, 3368, 353, 7442, 29889, 6310, 29898, 7052, 29881, 29889, 12181, 29892, 5785, 29897, 13, 4706, 5731, 29892, 1301, 353, 1583, 29889, 657, 29918, 459, 580, 13, 4706, 363, 474, 29892, 926, 297, 26985, 29898, 7052, 29881, 1125, 13, 9651, 5016, 1066, 353, 7442, 29889, 6333, 29898, 5450, 29892, 926, 29897, 718, 1301, 13, 9651, 565, 2910, 29918, 517, 29918, 5441, 3729, 29901, 13, 18884, 396, 19928, 367, 2309, 8951, 29892, 1074, 278, 6287, 29881, 29918, 1066, 2187, 29889, 2272, 1243, 13, 18884, 5016, 1066, 1273, 29922, 29871, 29896, 29889, 29900, 13, 18884, 5016, 1066, 1273, 29922, 29871, 29896, 29889, 29900, 13, 9651, 432, 353, 7442, 29889, 2506, 6605, 29898, 11967, 1066, 29889, 29911, 9601, 29900, 29962, 13, 9651, 4226, 3368, 29961, 29875, 29892, 584, 29962, 353, 5016, 1066, 29961, 29926, 29962, 13, 4706, 736, 4226, 3368, 13, 13, 1678, 822, 5412, 29918, 16315, 29898, 1311, 29892, 13, 462, 268, 6287, 29881, 29918, 1066, 2187, 29892, 13, 462, 268, 5016, 17990, 29922, 29896, 29872, 29899, 29941, 29892, 13, 462, 268, 1962, 29918, 13168, 29922, 8824, 29892, 13, 462, 268, 2910, 29918, 517, 29918, 5441, 3729, 29922, 5574, 1125, 13, 4706, 9995, 11609, 29879, 263, 11306, 310, 334, 7052, 29881, 29918, 1066, 2187, 29930, 6943, 871, 278, 13, 4706, 18446, 29899, 13092, 11909, 29889, 29871, 960, 334, 4905, 29918, 13168, 29930, 338, 5852, 29892, 263, 7223, 13, 4706, 1409, 11105, 292, 278, 11306, 338, 884, 4133, 29889, 13, 13, 4706, 960, 334, 1958, 29918, 517, 29918, 5441, 3729, 29930, 338, 1565, 29892, 599, 11840, 526, 937, 20545, 964, 13, 4706, 278, 5190, 3038, 3907, 321, 29889, 29887, 29889, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 322, 518, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 7126, 29889, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 269, 29887, 29889, 13092, 29918, 16315, 4197, 29961, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 1402, 13, 4706, 2023, 462, 29871, 518, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29900, 1402, 13, 4706, 2023, 462, 29871, 518, 29896, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 1402, 13, 4706, 2023, 462, 29871, 518, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 24960, 13, 4706, 1409, 4197, 29961, 29871, 29900, 29889, 1919, 259, 29900, 29889, 1919, 259, 29900, 29889, 21251, 13, 1669, 518, 29871, 29900, 29889, 29945, 29892, 259, 29900, 29889, 1919, 259, 29900, 29889, 4514, 2314, 13, 4706, 9995, 13, 4706, 6287, 29881, 353, 7442, 29889, 2378, 29898, 7052, 29881, 29918, 1066, 2187, 29892, 29871, 299, 1195, 29922, 29906, 29897, 13, 4706, 5016, 12324, 353, 1583, 29889, 11967, 2527, 719, 29918, 8945, 3368, 29918, 16315, 29898, 7052, 29881, 29892, 2910, 29918, 517, 29918, 5441, 3729, 29897, 13, 4706, 3635, 353, 7442, 29889, 2506, 6605, 29898, 11967, 12324, 29889, 29911, 29897, 13, 4706, 474, 17858, 353, 3635, 29889, 5085, 441, 580, 13, 4706, 921, 13168, 353, 7442, 29889, 6897, 29898, 9302, 29889, 12765, 29898, 11967, 12324, 29961, 17858, 1402, 9685, 29922, 29900, 8106, 3317, 29898, 8990, 29922, 29896, 29897, 1405, 5016, 17990, 13, 4706, 11105, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 29961, 5574, 1402, 921, 13168, 876, 13, 4706, 527, 1278, 353, 11105, 29961, 29875, 17858, 29962, 13, 4706, 565, 1962, 29918, 13168, 29901, 13, 9651, 736, 6287, 29881, 29961, 326, 1278, 1402, 527, 1278, 13, 4706, 1683, 29901, 13, 9651, 736, 6287, 29881, 29961, 326, 1278, 29962, 13, 13, 1678, 822, 4055, 29918, 16315, 29898, 1311, 29892, 6287, 29881, 29918, 1066, 2187, 29892, 5016, 17990, 29922, 29896, 29872, 29899, 29941, 1125, 13, 4706, 9995, 11609, 29879, 385, 6043, 1409, 310, 278, 1021, 3309, 408, 334, 7052, 29881, 29918, 1066, 2187, 15966, 13, 4706, 4055, 3460, 599, 7126, 28422, 411, 278, 1021, 2380, 29889, 13, 13, 4706, 8741, 29901, 13, 13, 4706, 8653, 515, 263, 344, 29889, 3493, 2972, 1053, 14121, 2972, 13, 4706, 8653, 269, 29887, 353, 14121, 2972, 29898, 29906, 29906, 29945, 29897, 29871, 396, 285, 617, 13, 4706, 8653, 269, 29887, 29889, 4039, 29918, 16315, 4197, 29961, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 1402, 13, 4706, 2023, 1669, 518, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29900, 1402, 13, 4706, 2023, 1669, 518, 29896, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 1402, 13, 4706, 2023, 1669, 518, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 24960, 13, 4706, 1409, 4197, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 2314, 13, 4706, 9995, 13, 4706, 6287, 29881, 353, 7442, 29889, 2378, 29898, 7052, 29881, 29918, 1066, 2187, 29892, 29871, 299, 1195, 29922, 29906, 29897, 13, 4706, 6287, 29881, 1273, 29922, 29871, 29896, 29889, 29900, 13, 4706, 6287, 29881, 1273, 29922, 29871, 29896, 29889, 29900, 13, 4706, 8282, 353, 448, 9302, 29889, 2873, 3552, 2435, 29898, 7052, 29881, 511, 10353, 26688, 29922, 524, 29897, 13, 4706, 11105, 353, 7442, 29889, 2873, 3552, 2435, 29898, 7052, 29881, 511, 10353, 26688, 29922, 11227, 29897, 13, 4706, 5731, 29892, 1301, 353, 1583, 29889, 657, 29918, 459, 580, 13, 4706, 474, 353, 29871, 29900, 13, 4706, 1550, 11105, 29889, 1384, 7295, 13, 9651, 926, 353, 6287, 29881, 29961, 13168, 3816, 29900, 29962, 13, 9651, 5016, 1066, 353, 7442, 29889, 6333, 29898, 5450, 29892, 926, 29897, 718, 1301, 13, 9651, 396, 19928, 367, 2309, 8951, 29892, 1074, 278, 6287, 29881, 29918, 1066, 2187, 29889, 2272, 1243, 13, 9651, 5016, 1066, 1273, 29922, 29871, 29896, 29889, 29900, 13, 9651, 5016, 1066, 1273, 29922, 29871, 29896, 29889, 29900, 13, 9651, 286, 353, 3695, 9302, 29889, 497, 29898, 9302, 29889, 1384, 29898, 9302, 29889, 6897, 29898, 7052, 29881, 29961, 9302, 29889, 1482, 8990, 29892, 584, 29892, 584, 29962, 448, 13, 462, 462, 418, 5016, 1066, 7503, 29892, 7442, 29889, 1482, 8990, 29892, 584, 2314, 1405, 5016, 17990, 29892, 13, 462, 1669, 9685, 29922, 29906, 511, 13, 462, 4706, 9685, 29922, 29900, 29897, 13, 9651, 4974, 451, 7442, 29889, 1384, 3552, 30022, 13168, 29897, 669, 286, 29897, 13, 9651, 8282, 29961, 29885, 29962, 353, 474, 13, 9651, 11105, 7878, 3695, 29885, 13, 9651, 474, 4619, 29871, 29896, 13, 4706, 736, 8282, 13, 13, 13, 13, 1753, 341, 29911, 29906, 726, 29898, 29949, 558, 29892, 11837, 29922, 8824, 1125, 13, 1678, 376, 4591, 2913, 2318, 4636, 29914, 3286, 18411, 5455, 3639, 1426, 1873, 29908, 13, 1678, 1060, 29979, 29999, 353, 6702, 29899, 29920, 742, 17411, 29891, 742, 17411, 29916, 742, 525, 29916, 29899, 29891, 742, 525, 21662, 742, 525, 29891, 29899, 29916, 742, 525, 29916, 742, 525, 29891, 742, 525, 29920, 1495, 13, 1678, 323, 4717, 353, 6702, 259, 13420, 525, 21662, 742, 525, 29896, 29914, 29953, 742, 525, 29896, 29914, 29946, 742, 525, 29896, 29914, 29941, 742, 525, 21662, 742, 13, 965, 525, 29896, 29914, 29906, 742, 525, 21662, 742, 525, 29906, 29914, 29941, 742, 525, 29941, 29914, 29946, 742, 525, 29945, 29914, 29953, 742, 525, 21662, 1495, 13, 1678, 383, 430, 353, 6629, 13, 1678, 341, 29892, 323, 353, 438, 558, 13, 1678, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 4706, 306, 29967, 353, 938, 29898, 14486, 29898, 29906, 334, 341, 29961, 29926, 3816, 29900, 29962, 718, 29871, 29941, 334, 341, 29961, 29926, 3816, 29896, 29962, 718, 29871, 29946, 334, 341, 29961, 29926, 3816, 29906, 29962, 718, 29871, 29946, 876, 1273, 29871, 29896, 29906, 13, 4706, 306, 29968, 353, 938, 29898, 14486, 29898, 29911, 29961, 29926, 29962, 334, 29871, 29896, 29906, 876, 1273, 29871, 29896, 29906, 13, 4706, 565, 306, 29968, 29901, 13, 9651, 565, 306, 29967, 529, 29871, 29941, 29901, 13, 18884, 565, 11837, 29901, 13, 462, 1678, 383, 430, 4619, 313, 18454, 29999, 29961, 29902, 29967, 29962, 718, 525, 23097, 718, 323, 4717, 29961, 23328, 14664, 29878, 5143, 29898, 29945, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 383, 430, 4619, 313, 29911, 4717, 29961, 23328, 29962, 718, 1060, 29979, 29999, 29961, 29902, 29967, 14664, 29878, 5143, 29898, 29945, 29897, 13, 9651, 1683, 29901, 13, 18884, 565, 11837, 29901, 13, 462, 1678, 383, 430, 4619, 313, 18454, 29999, 29961, 29902, 29967, 29962, 718, 525, 23097, 718, 323, 4717, 29961, 23328, 14664, 29878, 5143, 29898, 29945, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 383, 430, 4619, 313, 29911, 4717, 29961, 23328, 29962, 718, 525, 23097, 718, 1060, 29979, 29999, 29961, 29902, 29967, 14664, 29878, 5143, 29898, 29945, 29897, 13, 4706, 1683, 29901, 13, 9651, 383, 430, 4619, 1060, 29979, 29999, 29961, 29902, 29967, 1822, 29878, 5143, 29898, 29945, 29897, 13, 4706, 565, 432, 2804, 29871, 29906, 29901, 13, 9651, 383, 430, 4619, 13420, 525, 13, 1678, 736, 383, 430, 13, 13, 13, 1753, 3992, 29906, 11490, 29898, 14047, 361, 29949, 558, 29892, 315, 6545, 29922, 5574, 1125, 13, 1678, 376, 4591, 2913, 2318, 274, 361, 1426, 3639, 4636, 29914, 3286, 18411, 29908, 13, 1678, 1060, 29979, 29999, 353, 11117, 29916, 2396, 518, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 525, 29974, 29916, 2396, 518, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 17411, 29916, 2396, 21069, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 525, 29891, 2396, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 1402, 13, 965, 525, 29974, 29891, 2396, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 1402, 17411, 29891, 2396, 518, 29900, 29892, 448, 29896, 29892, 29871, 29900, 1402, 525, 29920, 2396, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 1402, 525, 29974, 29920, 2396, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 1402, 13, 965, 17411, 29920, 2396, 518, 29900, 29892, 29871, 29900, 29892, 448, 29896, 1402, 525, 29916, 29899, 29891, 2396, 518, 29896, 29892, 448, 29896, 29892, 29871, 29900, 1402, 17411, 29916, 29974, 29891, 2396, 21069, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 1402, 13, 965, 525, 29891, 29899, 29916, 2396, 21069, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 1402, 525, 29974, 29916, 29899, 29891, 2396, 518, 29896, 29892, 448, 29896, 29892, 29871, 29900, 1402, 525, 29974, 29891, 29899, 29916, 2396, 21069, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 12258, 13, 1678, 288, 567, 353, 286, 29883, 361, 29949, 558, 29889, 5451, 28165, 1159, 13, 1678, 341, 353, 5159, 13, 1678, 323, 353, 5159, 13, 1678, 363, 1015, 297, 288, 567, 7503, 29941, 5387, 13, 4706, 10377, 353, 7431, 29898, 459, 29897, 13, 4706, 565, 8207, 29915, 297, 1015, 29901, 13, 9651, 10377, 353, 1015, 29889, 2248, 11219, 1495, 13, 9651, 323, 29889, 4397, 29898, 14513, 29898, 459, 7503, 666, 718, 29871, 29906, 12622, 13, 9651, 1015, 11490, 353, 518, 459, 29961, 666, 718, 29871, 29906, 29901, 1402, 525, 2033, 13, 4706, 1683, 29901, 13, 9651, 1015, 11490, 353, 518, 459, 29892, 525, 2033, 13, 9651, 323, 29889, 4397, 29898, 29900, 1846, 13, 4706, 341, 29889, 4397, 29898, 18454, 29999, 29961, 459, 11490, 29961, 29900, 1822, 13609, 580, 2314, 13, 1678, 736, 7442, 29889, 2378, 29898, 29924, 511, 7442, 29889, 2378, 29898, 29911, 29897, 13, 13, 13, 1753, 679, 29918, 1272, 1445, 7295, 13, 1678, 9995, 11609, 2322, 2224, 304, 848, 1445, 1213, 15945, 13, 1678, 736, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 525, 3493, 2972, 29889, 4130, 1495, 13, 13, 13, 1753, 3402, 29918, 18098, 29898, 18098, 1125, 13, 1678, 9995, 11609, 29879, 1532, 20917, 18033, 29899, 29924, 585, 2543, 262, 5829, 408, 429, 371, 2954, 491, 13, 1678, 278, 2566, 29892, 491, 1959, 292, 278, 1206, 322, 4417, 4567, 470, 13, 1678, 11077, 270, 803, 630, 8162, 1213, 15945, 13, 1678, 4343, 353, 5159, 13, 1678, 269, 353, 5829, 29889, 17010, 580, 13, 1678, 269, 353, 269, 29961, 29900, 1822, 21064, 580, 718, 269, 29961, 29896, 29901, 1822, 13609, 580, 13, 1678, 363, 274, 297, 269, 29901, 13, 4706, 565, 274, 29889, 275, 2312, 7295, 13, 9651, 565, 7431, 29898, 20227, 29897, 322, 4343, 14352, 29896, 29962, 1275, 8207, 2396, 13, 18884, 4343, 29889, 4397, 29898, 29883, 29897, 13, 9651, 1683, 29901, 13, 18884, 4343, 29889, 4397, 877, 525, 718, 274, 718, 525, 25710, 13, 4706, 25342, 274, 29889, 790, 3535, 7295, 13, 9651, 4343, 29889, 4397, 877, 25710, 13, 4706, 25342, 274, 29889, 275, 26204, 7295, 13, 9651, 4343, 29889, 4397, 29898, 29883, 29897, 13, 4706, 25342, 274, 1275, 17411, 2396, 13, 9651, 4343, 29889, 4397, 877, 525, 718, 274, 29897, 13, 4706, 25342, 274, 1275, 8207, 2396, 13, 9651, 4343, 29889, 4397, 29898, 29883, 29897, 13, 1678, 269, 353, 525, 4286, 7122, 29898, 20227, 467, 17010, 580, 13, 1678, 736, 525, 15300, 7122, 29898, 29879, 29889, 5451, 3101, 13, 13, 13, 29937, 6680, 29879, 363, 13755, 278, 2566, 29889, 2688, 526, 6153, 5377, 278, 13, 29937, 14121, 2972, 770, 297, 1797, 304, 1207, 372, 6775, 304, 2678, 2334, 13, 29937, 22488, 304, 4772, 5183, 278, 2566, 1269, 931, 263, 716, 14121, 2972, 13, 29937, 2777, 338, 2825, 29889, 13, 13, 13, 1753, 903, 11014, 29918, 517, 29918, 19465, 29898, 29888, 29892, 2913, 2972, 29892, 4444, 1125, 13, 1678, 9995, 6359, 3454, 515, 285, 2745, 263, 9654, 1196, 338, 18169, 1213, 15945, 13, 1678, 1550, 5852, 29901, 13, 4706, 1196, 353, 285, 29889, 949, 1220, 580, 13, 4706, 565, 451, 1196, 29901, 13, 9651, 12020, 14121, 2972, 17413, 2392, 29898, 13, 18884, 525, 20965, 2913, 2972, 22570, 29879, 1673, 4444, 22570, 29879, 29952, 451, 1476, 297, 848, 2967, 29915, 13, 18884, 1273, 313, 3493, 2972, 29892, 4444, 876, 13, 4706, 565, 451, 1196, 29889, 17010, 7295, 13, 9651, 2867, 13, 13, 13, 1753, 903, 11014, 29918, 517, 29918, 5464, 19465, 29898, 29888, 29892, 2913, 2972, 29892, 4444, 1125, 13, 1678, 9995, 6359, 3454, 515, 285, 2745, 263, 1661, 19465, 1196, 451, 6257, 411, 263, 13, 1678, 6608, 313, 29937, 29897, 338, 18169, 322, 3639, 445, 322, 278, 2446, 1196, 1213, 15945, 13, 1678, 1550, 5852, 29901, 13, 4706, 1196, 29896, 353, 285, 29889, 949, 1220, 580, 13, 4706, 565, 451, 1196, 29896, 29901, 13, 9651, 12020, 14121, 2972, 17413, 2392, 29898, 13, 18884, 525, 20965, 2913, 2972, 1273, 29879, 29892, 4444, 1273, 29875, 451, 1476, 297, 848, 2967, 29915, 1273, 13, 18884, 313, 3493, 2972, 29892, 4444, 876, 13, 4706, 1196, 29896, 29889, 17010, 580, 13, 4706, 565, 1196, 29896, 322, 451, 1196, 29896, 29889, 27382, 2541, 14237, 29374, 13, 9651, 1196, 29906, 353, 285, 29889, 949, 1220, 580, 13, 9651, 2867, 13, 1678, 736, 1196, 29896, 29892, 1196, 29906, 13, 13, 13, 1753, 903, 949, 29918, 1272, 1445, 29918, 8269, 29898, 1028, 29887, 29892, 694, 29892, 5829, 29892, 4444, 29892, 285, 1125, 13, 1678, 9995, 6359, 2913, 2318, 848, 515, 285, 304, 805, 29887, 1213, 15945, 13, 13, 1678, 5685, 1446, 353, 11117, 29900, 29889, 29900, 2396, 29871, 29900, 29889, 29900, 29892, 525, 29896, 29889, 29900, 2396, 29871, 29896, 29889, 29900, 29892, 525, 29900, 2396, 29871, 29900, 29889, 29900, 29892, 525, 29896, 2396, 29871, 29896, 29889, 29900, 29892, 17411, 29896, 2396, 448, 29896, 29889, 29900, 29913, 13, 1678, 363, 302, 29892, 270, 297, 17288, 29896, 29892, 29871, 29906, 511, 313, 29896, 29892, 29871, 29941, 511, 313, 29906, 29892, 29871, 29941, 511, 313, 29896, 29892, 29871, 29946, 511, 313, 29941, 29892, 29871, 29946, 511, 313, 29896, 29892, 29871, 29953, 511, 313, 29945, 29892, 29871, 29953, 4638, 29901, 13, 4706, 5685, 1446, 1839, 29912, 29900, 6822, 29912, 29896, 29913, 4286, 4830, 29898, 29876, 29892, 270, 4638, 353, 302, 847, 270, 13, 4706, 5685, 1446, 1839, 29899, 29912, 29900, 6822, 29912, 29896, 29913, 4286, 4830, 29898, 29876, 29892, 270, 4638, 353, 448, 29876, 847, 270, 13, 13, 1678, 805, 29887, 3032, 1217, 353, 694, 13, 1678, 805, 29887, 3032, 18098, 353, 5829, 29889, 17010, 580, 13, 1678, 805, 29887, 3032, 26740, 353, 4444, 13, 1678, 805, 29887, 3032, 1760, 1883, 962, 16414, 353, 6120, 29898, 524, 29898, 29888, 29889, 949, 1220, 2141, 5451, 580, 29961, 29896, 12622, 13, 1678, 396, 19269, 12047, 13, 1678, 285, 29889, 949, 1220, 580, 13, 1678, 805, 29887, 3032, 7052, 29881, 29918, 9469, 3321, 29918, 3729, 353, 7442, 29889, 2378, 29898, 13, 4706, 5519, 7411, 29898, 29888, 417, 1446, 29889, 657, 29898, 29879, 29892, 269, 876, 363, 269, 297, 285, 29889, 949, 1220, 2141, 5451, 580, 29962, 13, 308, 363, 474, 297, 3464, 29898, 29941, 29897, 1402, 13, 4706, 26688, 29922, 7411, 29897, 13, 1678, 396, 19269, 9522, 771, 1052, 12047, 13, 1678, 285, 29889, 949, 1220, 580, 13, 1678, 805, 29887, 3032, 4361, 771, 1052, 29918, 3729, 353, 7442, 29889, 2378, 4197, 29961, 524, 29898, 29875, 29897, 363, 474, 297, 285, 29889, 949, 1220, 2141, 5451, 580, 29962, 13, 462, 462, 268, 363, 474, 297, 3464, 29898, 29941, 29897, 1402, 13, 462, 462, 1678, 26688, 29922, 524, 29897, 13, 1678, 396, 1014, 3286, 29880, 800, 13, 1678, 805, 29887, 3032, 29876, 1491, 3286, 353, 938, 29898, 29888, 29889, 949, 1220, 2141, 5451, 580, 29961, 29900, 2314, 13, 1678, 805, 29887, 3032, 1491, 3286, 353, 7442, 29889, 2378, 29898, 13, 4706, 5519, 7411, 29898, 29888, 417, 1446, 29889, 657, 29898, 29873, 29892, 260, 876, 363, 260, 297, 285, 29889, 949, 1220, 2141, 5451, 580, 29962, 13, 308, 363, 474, 297, 3464, 29898, 1028, 29887, 3032, 29876, 1491, 3286, 29897, 1402, 13, 4706, 26688, 29922, 7411, 29897, 13, 1678, 396, 18446, 6931, 13, 1678, 302, 11967, 353, 938, 29898, 29888, 29889, 949, 1220, 2141, 5451, 580, 29961, 29900, 2314, 13, 1678, 5016, 459, 353, 7442, 29889, 2378, 4197, 29961, 7411, 29898, 29888, 417, 1446, 29889, 657, 29898, 29879, 29892, 269, 876, 363, 269, 297, 285, 29889, 949, 1220, 2141, 5451, 580, 29962, 13, 462, 418, 363, 474, 297, 3464, 29898, 1983, 962, 29897, 1402, 13, 462, 268, 26688, 29922, 7411, 29897, 13, 1678, 805, 29887, 3032, 1983, 962, 459, 353, 302, 11967, 13, 1678, 805, 29887, 3032, 5450, 800, 353, 7442, 29889, 2378, 29898, 11967, 459, 7503, 29892, 584, 29929, 1822, 690, 14443, 3552, 1983, 962, 29892, 29871, 29941, 29892, 29871, 29941, 8243, 26688, 29922, 524, 29897, 13, 1678, 805, 29887, 3032, 3286, 29880, 800, 353, 5016, 459, 7503, 29892, 29871, 29929, 17531, 13, 13, 13, 1753, 903, 949, 29918, 1272, 1445, 29898, 1028, 29887, 29892, 2913, 2972, 29892, 4444, 29892, 285, 1125, 13, 1678, 565, 338, 8758, 29898, 3493, 2972, 29892, 938, 1125, 13, 4706, 1209, 13, 1678, 25342, 338, 8758, 29898, 3493, 2972, 29892, 851, 1125, 13, 4706, 2913, 2972, 353, 525, 15300, 7122, 29898, 3493, 2972, 29889, 17010, 2141, 5451, 3101, 13, 4706, 11071, 29918, 3493, 2972, 353, 525, 4286, 7122, 29898, 3493, 2972, 29889, 5451, 3101, 13, 1678, 1683, 29901, 13, 4706, 12020, 14121, 2972, 1917, 2392, 877, 29952, 3493, 2972, 29952, 1818, 367, 310, 1134, 938, 470, 851, 1495, 13, 1678, 1550, 5852, 29901, 13, 4706, 1196, 29896, 29892, 1196, 29906, 353, 903, 11014, 29918, 517, 29918, 5464, 19465, 29898, 29888, 29892, 2913, 2972, 29892, 4444, 29897, 13, 4706, 903, 1217, 29892, 903, 18098, 353, 1196, 29896, 29889, 17010, 2141, 5451, 29898, 8516, 29892, 29871, 29896, 29897, 13, 4706, 903, 18098, 353, 3402, 29918, 18098, 7373, 18098, 29897, 13, 4706, 11071, 29918, 18098, 353, 525, 4286, 7122, 7373, 18098, 29889, 5451, 3101, 13, 4706, 903, 26740, 353, 938, 29898, 1220, 29906, 29889, 17010, 2141, 5451, 580, 29961, 29896, 2314, 13, 4706, 903, 1217, 353, 938, 7373, 1217, 29897, 13, 4706, 565, 5135, 275, 8758, 29898, 3493, 2972, 29892, 938, 29897, 322, 903, 1217, 1275, 2913, 2972, 13, 632, 322, 903, 26740, 1275, 4444, 29897, 13, 18884, 470, 313, 275, 8758, 29898, 3493, 2972, 29892, 851, 29897, 13, 462, 1678, 322, 11071, 29918, 18098, 1275, 11071, 29918, 3493, 2972, 29897, 322, 13, 18884, 313, 26740, 338, 6213, 470, 903, 26740, 1275, 4444, 22164, 13, 9651, 903, 949, 29918, 1272, 1445, 29918, 8269, 29898, 1028, 29887, 29892, 903, 1217, 29892, 903, 18098, 29892, 903, 26740, 29892, 285, 29897, 13, 9651, 2867, 13, 4706, 1683, 29901, 13, 9651, 903, 11014, 29918, 517, 29918, 19465, 29898, 29888, 29892, 2913, 2972, 29892, 4444, 29897, 13, 13, 13, 1753, 6088, 29918, 16315, 962, 29918, 5029, 29898, 5029, 1125, 13, 1678, 9995, 29925, 1503, 267, 697, 1543, 515, 263, 2323, 3268, 18446, 297, 278, 883, 1304, 13, 1678, 491, 278, 4623, 323, 1849, 29889, 13, 13, 1678, 1222, 9422, 29901, 13, 13, 1678, 8653, 6088, 29918, 16315, 962, 29918, 5029, 703, 29916, 1159, 13, 1678, 9310, 29898, 29900, 29892, 29871, 29896, 29897, 1402, 29871, 29900, 29889, 29900, 29897, 13, 1678, 8653, 6088, 29918, 16315, 962, 29918, 5029, 703, 29899, 29896, 29914, 29906, 29899, 29891, 1159, 13, 1678, 9310, 29898, 29896, 29892, 448, 29896, 29897, 1402, 448, 29900, 29889, 29945, 29897, 13, 1678, 8653, 6088, 29918, 16315, 962, 29918, 5029, 703, 29920, 29974, 29900, 29889, 29906, 29945, 1159, 13, 1678, 9310, 29898, 29906, 29892, 29871, 29896, 29897, 1402, 29871, 29900, 29889, 29906, 29945, 29897, 13, 1678, 8653, 6088, 29918, 16315, 962, 29918, 5029, 703, 29916, 29899, 29920, 29974, 29900, 29889, 29945, 1159, 13, 1678, 9310, 29898, 29900, 29892, 29871, 29896, 511, 313, 29906, 29892, 448, 29896, 29897, 1402, 29871, 29900, 29889, 29945, 29897, 13, 13, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 13, 1678, 1543, 29901, 851, 13, 418, 10781, 18446, 763, 376, 29916, 29908, 470, 11663, 29891, 29974, 29896, 29914, 29946, 29908, 470, 376, 29900, 29889, 29945, 29974, 29920, 1642, 13, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 13, 1678, 1051, 29961, 23583, 29961, 524, 29892, 938, 5262, 13, 418, 9664, 362, 2472, 297, 278, 883, 525, 29898, 2248, 29892, 1804, 16029, 988, 2380, 338, 13, 539, 29900, 363, 376, 29916, 613, 29871, 29896, 363, 376, 29891, 29908, 322, 29871, 29906, 363, 376, 29920, 29908, 322, 1804, 338, 525, 29896, 29915, 363, 263, 6374, 13, 418, 6251, 322, 17411, 29896, 29915, 363, 263, 8178, 6251, 29889, 382, 29889, 29887, 29889, 376, 29916, 29908, 338, 525, 29898, 29900, 29892, 29871, 29896, 16029, 322, 13, 418, 11663, 29920, 29908, 338, 313, 29906, 29892, 448, 29896, 467, 13, 13, 1678, 5785, 13, 418, 4103, 18411, 2472, 297, 15958, 284, 2913, 29889, 382, 29889, 29887, 29889, 11663, 29896, 29914, 29946, 29908, 338, 13, 418, 17411, 29900, 29889, 29906, 29945, 29915, 322, 376, 29896, 29914, 29906, 29908, 338, 525, 29900, 29889, 29945, 29915, 322, 376, 29900, 29889, 29955, 29945, 29908, 338, 525, 29900, 29889, 29955, 29945, 4286, 13, 13, 13, 1678, 9995, 13, 1678, 1543, 353, 1543, 29889, 13609, 580, 13, 1678, 338, 29918, 1066, 3321, 353, 5852, 13, 1678, 338, 29918, 1154, 353, 7700, 13, 1678, 269, 865, 29918, 3286, 353, 6213, 13, 1678, 285, 303, 29918, 3286, 353, 5159, 13, 1678, 269, 299, 29918, 3286, 353, 5159, 13, 1678, 5731, 353, 5159, 13, 13, 1678, 363, 1373, 297, 1543, 29901, 13, 4706, 565, 1373, 1275, 15691, 1115, 13, 9651, 338, 29918, 1066, 3321, 353, 5852, 13, 4706, 25342, 1373, 1275, 11663, 1115, 13, 9651, 338, 29918, 1066, 3321, 353, 7700, 13, 4706, 25342, 1373, 1275, 5591, 1115, 13, 9651, 338, 29918, 1154, 353, 5852, 13, 4706, 25342, 1373, 297, 376, 20230, 1115, 13, 9651, 5731, 29889, 4397, 3552, 536, 29898, 3090, 29897, 448, 4356, 703, 29916, 4968, 29871, 29896, 565, 338, 29918, 1066, 3321, 1683, 448, 29896, 876, 13, 4706, 25342, 1373, 29889, 275, 26204, 580, 470, 1373, 1275, 11393, 1115, 13, 9651, 565, 269, 865, 29918, 3286, 338, 6213, 29901, 13, 18884, 269, 865, 29918, 3286, 353, 29871, 29896, 29889, 29900, 565, 338, 29918, 1066, 3321, 1683, 448, 29896, 29889, 29900, 13, 9651, 565, 338, 29918, 1154, 29901, 13, 18884, 269, 299, 29918, 3286, 29889, 4397, 29898, 3090, 29897, 13, 9651, 1683, 29901, 13, 18884, 285, 303, 29918, 3286, 29889, 4397, 29898, 3090, 29897, 13, 13, 1678, 1301, 353, 29871, 29900, 29889, 29900, 565, 451, 285, 303, 29918, 3286, 1683, 313, 29879, 865, 29918, 3286, 334, 5785, 703, 1642, 7122, 29898, 29888, 303, 29918, 3286, 4961, 13, 1678, 565, 338, 29918, 1154, 29901, 13, 4706, 1301, 847, 29922, 5785, 703, 1642, 7122, 29898, 29879, 299, 29918, 3286, 876, 13, 13, 1678, 736, 5731, 29892, 1301, 13, 13, 13, 1753, 6088, 29918, 16315, 962, 29918, 14369, 29898, 11967, 29892, 714, 29918, 5450, 29892, 714, 29918, 3286, 29892, 16345, 543, 29892, 613, 4889, 29918, 1066, 3321, 29918, 3286, 18411, 29922, 8824, 1125, 13, 1678, 9995, 29925, 1503, 267, 263, 2323, 3268, 18446, 297, 278, 883, 1304, 491, 4623, 29871, 13, 1678, 323, 1849, 322, 975, 8231, 267, 525, 449, 29918, 5450, 29915, 322, 525, 449, 29918, 3286, 29915, 411, 848, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 13, 1678, 5016, 29901, 851, 13, 418, 10781, 18446, 297, 278, 883, 1304, 491, 4623, 323, 1849, 313, 29872, 29889, 29887, 29889, 376, 29916, 29892, 29891, 29892, 29920, 613, 376, 29891, 29899, 29896, 29914, 29906, 29892, 29916, 6653, 29920, 2564, 13, 13, 1678, 714, 29918, 5450, 29901, 7442, 29889, 2378, 13, 418, 319, 29871, 29941, 29916, 29941, 29899, 16031, 1409, 15783, 5731, 800, 313, 25990, 526, 1754, 297, 6689, 467, 13, 13, 1678, 714, 29918, 5450, 29901, 7442, 29889, 2378, 13, 418, 319, 29871, 29941, 29899, 7411, 1409, 15783, 5578, 800, 313, 25990, 526, 1754, 297, 6689, 467, 13, 13, 1678, 16345, 29901, 851, 13, 418, 1714, 28128, 313, 3284, 297, 376, 29916, 29892, 29891, 29892, 29920, 2564, 13, 13, 1678, 4889, 29918, 1066, 3321, 29918, 3286, 18411, 29901, 6120, 13, 418, 25571, 15958, 284, 5578, 800, 304, 367, 1546, 29871, 29900, 322, 29871, 29896, 313, 1228, 3538, 8178, 1819, 1795, 367, 9259, 467, 13, 418, 13109, 29879, 304, 525, 8824, 4286, 13, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 13, 1678, 9531, 338, 4133, 29901, 525, 449, 29918, 5450, 29915, 322, 525, 449, 29918, 3286, 29915, 526, 3939, 297, 6689, 29889, 13, 13, 13, 1678, 9995, 13, 1678, 714, 29918, 5450, 7503, 29962, 353, 29871, 29900, 29889, 29900, 13, 1678, 714, 29918, 3286, 7503, 29962, 353, 29871, 29900, 29889, 29900, 13, 13, 1678, 363, 474, 29892, 1543, 297, 26985, 29898, 11967, 29889, 5451, 29898, 19570, 22164, 13, 4706, 321, 29918, 5450, 29918, 1761, 29892, 321, 29918, 3286, 353, 6088, 29918, 16315, 962, 29918, 5029, 29898, 5029, 29897, 13, 4706, 363, 5731, 29918, 13140, 29892, 5731, 29918, 29879, 5138, 297, 321, 29918, 5450, 29918, 1761, 29901, 13, 9651, 714, 29918, 5450, 29961, 29875, 3816, 5450, 29918, 13140, 29962, 353, 5731, 29918, 29879, 5138, 13, 4706, 714, 29918, 3286, 29961, 29875, 29962, 353, 313, 29872, 29918, 3286, 1273, 13, 462, 308, 29896, 29889, 29900, 29897, 565, 4889, 29918, 1066, 3321, 29918, 3286, 18411, 1683, 321, 29918, 3286, 13, 13, 13, 1753, 6088, 29918, 16315, 962, 29898, 29879, 21053, 391, 29892, 16345, 29922, 742, 742, 4889, 29918, 1066, 3321, 29918, 3286, 18411, 29922, 8824, 1125, 13, 1678, 9995, 29925, 1503, 267, 263, 5665, 310, 3268, 9682, 2722, 297, 278, 883, 1304, 491, 13, 1678, 4623, 323, 1849, 322, 3639, 6590, 13733, 322, 13, 1678, 13962, 7049, 29889, 13, 13, 1678, 8741, 29901, 13, 13, 1678, 8653, 9878, 828, 391, 353, 518, 13, 1678, 2023, 268, 525, 29916, 29892, 29891, 29892, 29920, 742, 13, 1678, 2023, 268, 17411, 29891, 29974, 29896, 29914, 29906, 29892, 29916, 29974, 29896, 29914, 29906, 29892, 29920, 742, 13, 1678, 2023, 268, 17411, 29891, 6653, 29916, 6653, 29920, 742, 13, 1678, 2023, 268, 525, 29916, 29899, 29896, 29914, 29946, 29892, 343, 29899, 29896, 29914, 29946, 29892, 448, 29920, 29915, 13, 1678, 2023, 4514, 13, 1678, 8653, 5731, 29892, 1301, 353, 6088, 29918, 16315, 962, 29898, 29879, 21053, 391, 29897, 13, 1678, 8653, 5731, 13, 1678, 1409, 4197, 8999, 29871, 29896, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29896, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29896, 20526, 13, 1678, 529, 13367, 2190, 29968, 18521, 29958, 13, 965, 5519, 29871, 29900, 29892, 448, 29896, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29896, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 259, 29896, 20526, 13, 1678, 529, 13367, 2190, 29968, 18521, 29958, 13, 965, 5519, 29871, 29900, 29892, 448, 29896, 29892, 259, 29900, 1402, 13, 9651, 21069, 29896, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29896, 20526, 13, 1678, 529, 13367, 2190, 29968, 18521, 29958, 13, 965, 5519, 29871, 29896, 29892, 259, 29900, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29896, 29892, 259, 29900, 1402, 13, 9651, 518, 29871, 29900, 29892, 259, 29900, 29892, 448, 29896, 5262, 2314, 13, 1678, 8653, 1301, 13, 1678, 1409, 4197, 29961, 29871, 29900, 29889, 29871, 1919, 259, 29900, 29889, 29871, 1919, 259, 29900, 29889, 29871, 21251, 13, 965, 518, 29871, 29900, 29889, 29945, 1919, 259, 29900, 29889, 29945, 1919, 259, 29900, 29889, 29871, 21251, 13, 965, 518, 29871, 29900, 29889, 29871, 1919, 259, 29900, 29889, 29871, 1919, 259, 29900, 29889, 29871, 21251, 13, 965, 21069, 29900, 29889, 29906, 29945, 29892, 448, 29900, 29889, 29906, 29945, 29892, 259, 29900, 29889, 29871, 4514, 2314, 13, 1678, 9995, 13, 13, 1678, 302, 11967, 353, 7431, 29898, 29879, 21053, 391, 29897, 13, 1678, 5731, 353, 7442, 29889, 3298, 359, 3552, 1983, 962, 29892, 29871, 29941, 29892, 29871, 29941, 511, 26688, 2433, 524, 1495, 13, 1678, 1301, 353, 7442, 29889, 3298, 359, 3552, 1983, 962, 29892, 29871, 29941, 876, 13, 13, 1678, 363, 474, 29892, 5016, 297, 26985, 29898, 29879, 21053, 391, 1125, 13, 4706, 6088, 29918, 16315, 962, 29918, 14369, 29898, 11967, 29892, 5731, 29961, 29875, 1402, 1301, 29961, 29875, 1402, 16345, 29922, 19570, 29892, 13, 462, 632, 4889, 29918, 1066, 3321, 29918, 3286, 18411, 29922, 10118, 29918, 1066, 3321, 29918, 3286, 18411, 29897, 13, 13, 1678, 736, 5731, 29892, 1301, 13, 13, 13, 1753, 2913, 2972, 29918, 3166, 29918, 1272, 29898, 1217, 29922, 8516, 29892, 13, 462, 308, 5829, 29922, 8516, 29892, 13, 462, 308, 4444, 29922, 8516, 29892, 13, 462, 308, 1644, 1883, 962, 16414, 29922, 8516, 29892, 13, 462, 308, 6287, 29881, 29918, 9469, 3321, 29918, 3729, 29922, 8516, 29892, 13, 462, 308, 9522, 771, 1052, 29918, 3729, 29922, 8516, 29892, 13, 462, 308, 1014, 3286, 29922, 8516, 29892, 13, 462, 308, 11840, 962, 29922, 8516, 29892, 13, 462, 308, 5731, 800, 29922, 8516, 29892, 13, 462, 308, 5578, 800, 29922, 8516, 29892, 13, 462, 308, 848, 1445, 29922, 8516, 1125, 13, 1678, 9995, 2517, 1474, 1653, 263, 716, 2913, 2318, 2777, 29889, 29871, 910, 1795, 367, 13, 1678, 5407, 746, 5183, 10901, 11195, 848, 411, 967, 1914, 2913, 2972, 13, 1678, 15848, 1213, 15945, 13, 1678, 565, 694, 338, 451, 6213, 322, 4444, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 353, 14121, 2972, 29898, 1217, 29892, 4444, 29892, 848, 1445, 29897, 13, 1678, 25342, 5829, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 353, 14121, 2972, 29898, 18098, 29892, 6213, 29892, 848, 1445, 29897, 13, 1678, 1683, 29901, 13, 4706, 12020, 14121, 2972, 1917, 2392, 877, 29872, 2121, 334, 1217, 29930, 322, 334, 26740, 29930, 525, 13, 462, 462, 259, 525, 272, 334, 18098, 29930, 1818, 367, 2183, 1495, 13, 1678, 565, 451, 338, 8758, 29898, 16315, 962, 29892, 1051, 1125, 13, 4706, 12020, 20948, 877, 16315, 962, 1818, 367, 263, 1051, 1495, 13, 13, 1678, 505, 29918, 11967, 353, 7700, 13, 1678, 565, 1644, 1883, 962, 16414, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 3032, 1760, 1883, 962, 16414, 353, 6120, 29898, 1760, 1883, 962, 16414, 29897, 13, 1678, 565, 6287, 29881, 29918, 9469, 3321, 29918, 3729, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 3032, 7052, 29881, 29918, 9469, 3321, 29918, 3729, 353, 7442, 29889, 2378, 29898, 7052, 29881, 29918, 9469, 3321, 29918, 3729, 29897, 13, 1678, 565, 9522, 771, 1052, 29918, 3729, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 3032, 4361, 771, 1052, 29918, 3729, 353, 7442, 29889, 2378, 29898, 4361, 771, 1052, 29918, 3729, 29897, 13, 1678, 565, 1014, 3286, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 3032, 1491, 3286, 353, 7442, 29889, 271, 280, 579, 29918, 29906, 29881, 29898, 1491, 3286, 29897, 13, 4706, 805, 29887, 3032, 29876, 1491, 3286, 353, 805, 29887, 3032, 1491, 3286, 29889, 12181, 29961, 29900, 29962, 13, 1678, 565, 11840, 962, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 3032, 5450, 800, 29892, 805, 29887, 3032, 3286, 29880, 800, 353, 6088, 29918, 16315, 962, 29898, 16315, 962, 29897, 13, 4706, 505, 29918, 11967, 353, 5852, 13, 1678, 565, 5731, 800, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 3032, 5450, 800, 353, 7442, 29889, 271, 280, 579, 29918, 29941, 29881, 29898, 5450, 800, 29897, 13, 4706, 505, 29918, 11967, 353, 5852, 13, 1678, 565, 5578, 800, 338, 451, 6213, 29901, 13, 4706, 805, 29887, 3032, 3286, 29880, 800, 353, 7442, 29889, 271, 280, 579, 29918, 29906, 29881, 29898, 3286, 29880, 800, 29897, 13, 4706, 505, 29918, 11967, 353, 5852, 13, 1678, 565, 505, 29918, 11967, 29901, 13, 4706, 565, 805, 29887, 3032, 5450, 800, 29889, 12181, 29961, 29900, 29962, 2804, 805, 29887, 3032, 3286, 29880, 800, 29889, 12181, 29961, 29900, 5387, 13, 9651, 12020, 14121, 2972, 1917, 2392, 877, 262, 3200, 9696, 1353, 310, 5731, 800, 322, 525, 13, 462, 462, 539, 525, 3286, 29880, 800, 1495, 13, 4706, 805, 29887, 3032, 1983, 962, 459, 353, 805, 29887, 3032, 5450, 800, 29889, 12181, 29961, 29900, 29962, 13, 1678, 736, 805, 29887, 13, 2 ]
src/runner.py
Shahrukh-Badar/DeepLearning
0
22843
from os import listdir from os.path import join, isfile import json from random import randint ######################################### ## START of part that students may change from code_completion_baseline import Code_Completion_Baseline training_dir = "./../../programs_800/" query_dir = "./../../programs_200/" model_file = "./../../trained_model" use_stored_model = False max_hole_size = 2 simplify_tokens = True ## END of part that students may change ######################################### def simplify_token(token): if token["type"] == "Identifier": token["value"] = "ID" elif token["type"] == "String": token["value"] = "\"STR\"" elif token["type"] == "RegularExpression": token["value"] = "/REGEXP/" elif token["type"] == "Numeric": token["value"] = "5" # load sequences of tokens from files def load_tokens(token_dir): token_files = [join(token_dir, f) for f in listdir(token_dir) if isfile(join(token_dir, f)) and f.endswith("_tokens.json")] token_lists = [json.load(open(f)) for f in token_files] if simplify_tokens: for token_list in token_lists: for token in token_list: simplify_token(token) return token_lists # removes up to max_hole_size tokens def create_hole(tokens): hole_size = randint(1, max_hole_size) hole_start_idx = randint(1, len(tokens) - hole_size) prefix = tokens[0:hole_start_idx] expected = tokens[hole_start_idx:hole_start_idx + hole_size] suffix = tokens[hole_start_idx + hole_size:] return(prefix, expected, suffix) # checks if two sequences of tokens are identical def same_tokens(tokens1, tokens2): if len(tokens1) != len(tokens2): return False for idx, t1 in enumerate(tokens1): t2 = tokens2[idx] if t1["type"] != t2["type"] or t1["value"] != t2["value"]: return False return True ######################################### ## START of part that students may change code_completion = Code_Completion_Baseline() ## END of part that students may change ######################################### # train the network training_token_lists = load_tokens(training_dir) if use_stored_model: code_completion.load(training_token_lists, model_file) else: code_completion.train(training_token_lists, model_file) # query the network and measure its accuracy query_token_lists = load_tokens(query_dir) correct = incorrect = 0 for tokens in query_token_lists: (prefix, expected, suffix) = create_hole(tokens) completion = code_completion.query(prefix, suffix) if same_tokens(completion, expected): correct += 1 else: incorrect += 1 accuracy = correct / (correct + incorrect) print("Accuracy: " + str(correct) + " correct vs. " + str(incorrect) + " incorrect = " + str(accuracy))
[ 1, 515, 2897, 1053, 1051, 3972, 13, 3166, 2897, 29889, 2084, 1053, 5988, 29892, 338, 1445, 13, 5215, 4390, 13, 3166, 4036, 1053, 20088, 524, 13, 13, 13383, 13383, 7346, 29937, 13, 2277, 6850, 8322, 310, 760, 393, 8041, 1122, 1735, 13, 3166, 775, 29918, 5729, 12757, 29918, 6500, 5570, 1053, 5920, 29918, 28958, 29918, 9496, 5570, 13, 13, 26495, 29918, 3972, 353, 376, 6904, 21546, 8860, 29879, 29918, 29947, 29900, 29900, 12975, 13, 1972, 29918, 3972, 353, 376, 6904, 21546, 8860, 29879, 29918, 29906, 29900, 29900, 12975, 13, 13, 4299, 29918, 1445, 353, 376, 6904, 21546, 3018, 1312, 29918, 4299, 29908, 13, 1509, 29918, 303, 4395, 29918, 4299, 353, 7700, 13, 13, 3317, 29918, 29716, 29918, 2311, 353, 29871, 29906, 13, 3601, 572, 1598, 29918, 517, 12360, 353, 5852, 13, 2277, 11056, 310, 760, 393, 8041, 1122, 1735, 13, 13383, 13383, 7346, 29937, 13, 13, 1753, 21092, 29918, 6979, 29898, 6979, 1125, 13, 1678, 565, 5993, 3366, 1853, 3108, 1275, 376, 12889, 1115, 13, 4706, 5993, 3366, 1767, 3108, 353, 376, 1367, 29908, 13, 1678, 25342, 5993, 3366, 1853, 3108, 1275, 376, 1231, 1115, 13, 4706, 5993, 3366, 1767, 3108, 353, 376, 5931, 10810, 5931, 29908, 13, 1678, 25342, 5993, 3366, 1853, 3108, 1275, 376, 4597, 1070, 10960, 1115, 13, 4706, 5993, 3366, 1767, 3108, 353, 5591, 1525, 1692, 29990, 29925, 12975, 13, 1678, 25342, 5993, 3366, 1853, 3108, 1275, 376, 29940, 25099, 1115, 13, 4706, 5993, 3366, 1767, 3108, 353, 376, 29945, 29908, 13, 13, 29937, 2254, 15602, 310, 18897, 515, 2066, 13, 1753, 2254, 29918, 517, 12360, 29898, 6979, 29918, 3972, 1125, 13, 1678, 5993, 29918, 5325, 353, 518, 7122, 29898, 6979, 29918, 3972, 29892, 285, 29897, 363, 285, 297, 1051, 3972, 29898, 6979, 29918, 3972, 29897, 565, 338, 1445, 29898, 7122, 29898, 6979, 29918, 3972, 29892, 285, 876, 322, 285, 29889, 1975, 2541, 703, 29918, 517, 12360, 29889, 3126, 13531, 13, 1678, 5993, 29918, 21513, 353, 518, 3126, 29889, 1359, 29898, 3150, 29898, 29888, 876, 363, 285, 297, 5993, 29918, 5325, 29962, 13, 1678, 565, 21092, 29918, 517, 12360, 29901, 13, 4706, 363, 5993, 29918, 1761, 297, 5993, 29918, 21513, 29901, 13, 9651, 363, 5993, 297, 5993, 29918, 1761, 29901, 13, 18884, 21092, 29918, 6979, 29898, 6979, 29897, 13, 1678, 736, 5993, 29918, 21513, 13, 13, 29937, 25388, 701, 304, 4236, 29918, 29716, 29918, 2311, 18897, 13, 1753, 1653, 29918, 29716, 29898, 517, 12360, 1125, 13, 1678, 16188, 29918, 2311, 353, 20088, 524, 29898, 29896, 29892, 4236, 29918, 29716, 29918, 2311, 29897, 13, 1678, 16188, 29918, 2962, 29918, 13140, 353, 20088, 524, 29898, 29896, 29892, 7431, 29898, 517, 12360, 29897, 448, 16188, 29918, 2311, 29897, 13, 1678, 10944, 353, 18897, 29961, 29900, 29901, 29716, 29918, 2962, 29918, 13140, 29962, 13, 1678, 3806, 353, 18897, 29961, 29716, 29918, 2962, 29918, 13140, 29901, 29716, 29918, 2962, 29918, 13140, 718, 16188, 29918, 2311, 29962, 13, 1678, 25557, 353, 18897, 29961, 29716, 29918, 2962, 29918, 13140, 718, 16188, 29918, 2311, 17531, 13, 1678, 736, 29898, 13506, 29892, 3806, 29892, 25557, 29897, 13, 13, 29937, 12747, 565, 1023, 15602, 310, 18897, 526, 13557, 13, 1753, 1021, 29918, 517, 12360, 29898, 517, 12360, 29896, 29892, 18897, 29906, 1125, 13, 1678, 565, 7431, 29898, 517, 12360, 29896, 29897, 2804, 7431, 29898, 517, 12360, 29906, 1125, 13, 4706, 736, 7700, 13, 1678, 363, 22645, 29892, 260, 29896, 297, 26985, 29898, 517, 12360, 29896, 1125, 13, 4706, 260, 29906, 353, 18897, 29906, 29961, 13140, 29962, 13, 4706, 565, 260, 29896, 3366, 1853, 3108, 2804, 260, 29906, 3366, 1853, 3108, 470, 260, 29896, 3366, 1767, 3108, 2804, 260, 29906, 3366, 1767, 3108, 29901, 13, 9651, 736, 7700, 259, 13, 1678, 736, 5852, 13, 13, 13383, 13383, 7346, 29937, 13, 2277, 6850, 8322, 310, 760, 393, 8041, 1122, 1735, 13, 401, 29918, 5729, 12757, 353, 5920, 29918, 28958, 29918, 9496, 5570, 580, 13, 2277, 11056, 310, 760, 393, 8041, 1122, 1735, 13, 13383, 13383, 7346, 29937, 13, 13, 29937, 7945, 278, 3564, 13, 26495, 29918, 6979, 29918, 21513, 353, 2254, 29918, 517, 12360, 29898, 26495, 29918, 3972, 29897, 13, 361, 671, 29918, 303, 4395, 29918, 4299, 29901, 13, 1678, 775, 29918, 5729, 12757, 29889, 1359, 29898, 26495, 29918, 6979, 29918, 21513, 29892, 1904, 29918, 1445, 29897, 13, 2870, 29901, 13, 1678, 775, 29918, 5729, 12757, 29889, 14968, 29898, 26495, 29918, 6979, 29918, 21513, 29892, 1904, 29918, 1445, 29897, 13, 13, 29937, 2346, 278, 3564, 322, 5645, 967, 13600, 13, 1972, 29918, 6979, 29918, 21513, 353, 2254, 29918, 517, 12360, 29898, 1972, 29918, 3972, 29897, 13, 15728, 353, 10240, 353, 29871, 29900, 13, 1454, 18897, 297, 2346, 29918, 6979, 29918, 21513, 29901, 13, 1678, 313, 13506, 29892, 3806, 29892, 25557, 29897, 353, 1653, 29918, 29716, 29898, 517, 12360, 29897, 13, 1678, 13285, 353, 775, 29918, 5729, 12757, 29889, 1972, 29898, 13506, 29892, 25557, 29897, 13, 1678, 565, 1021, 29918, 517, 12360, 29898, 5729, 12757, 29892, 3806, 1125, 13, 4706, 1959, 4619, 29871, 29896, 13, 1678, 1683, 29901, 13, 4706, 10240, 4619, 29871, 29896, 13, 562, 2764, 4135, 353, 1959, 847, 313, 15728, 718, 10240, 29897, 13, 2158, 703, 7504, 332, 4135, 29901, 376, 718, 851, 29898, 15728, 29897, 718, 376, 1959, 7186, 29889, 376, 718, 851, 29898, 262, 15728, 29897, 718, 376, 10240, 353, 376, 29871, 718, 851, 29898, 562, 2764, 4135, 876, 13, 13, 2 ]
snekcord/objects/user.py
asleep-cult/snekcord
9
172791
<reponame>asleep-cult/snekcord import enum from .base import BaseObject from .. import json __all__ = ('UserFlags', 'PremiumType', 'User') class UserFlags(enum.IntFlag): NONE = 0 STAFF = 1 << 0 PARTNER = 1 << 1 HYPESQUAD = 1 << 2 BUG_HUNTER_LEVEL_1 = 1 << 3 HYPESQUAD_ONLINE_HOUSE_1 = 1 << 6 HYPESQUAD_ONLINE_HOUSE_2 = 1 << 7 HYPESQUAD_ONLINE_HOUSE_3 = 1 << 8 PREMIUM_EARLY_SUPPORTER = 1 << 9 TEAM_PSUEDO_USER = 1 << 10 BUG_HUNTER_LEVEL_2 = 1 << 14 VERIFIED_BOT = 1 << 16 VERIFIED_DEVELOPER = 1 << 17 CERTIFIED_MODERATOR = 1 << 18 BOT_HTTP_INTERACTIONS = 1 << 19 class PremiumType(enum.IntEnum): NONE = 0 NITRO_CLASSIC = 1 NITRO = 2 class User(BaseObject): name = json.JSONField('username') discriminator = json.JSONField('discriminator') avatar = json.JSONField('avatar') bot = json.JSONField('bot') system = json.JSONField('system') mfa_enabled = json.JSONField('mfa_enabled') banner = json.JSONField('banner') accent_color = json.JSONField('accent_color') locale = json.JSONField('locale') verified = json.JSONField('verified') email = json.JSONField('email') flags = json.JSONField('flags', UserFlags) premium_type = json.JSONField('premium_type', PremiumType) public_flags = json.JSONField('public_flags', UserFlags)
[ 1, 529, 276, 1112, 420, 29958, 294, 5436, 29899, 29883, 499, 29914, 29879, 6750, 16090, 13, 5215, 14115, 13, 13, 3166, 869, 3188, 1053, 7399, 2061, 13, 3166, 6317, 1053, 4390, 13, 13, 1649, 497, 1649, 353, 6702, 2659, 15675, 742, 525, 29925, 1745, 1974, 1542, 742, 525, 2659, 1495, 13, 13, 13, 1990, 4911, 15675, 29898, 18605, 29889, 2928, 21979, 1125, 13, 1678, 405, 12413, 353, 29871, 29900, 13, 1678, 317, 6040, 4198, 353, 29871, 29896, 3532, 29871, 29900, 13, 1678, 349, 8322, 13865, 353, 29871, 29896, 3532, 29871, 29896, 13, 1678, 379, 29979, 29925, 2890, 13356, 3035, 353, 29871, 29896, 3532, 29871, 29906, 13, 1678, 350, 23338, 29918, 29950, 3904, 4945, 29918, 1307, 29963, 6670, 29918, 29896, 353, 29871, 29896, 3532, 29871, 29941, 13, 1678, 379, 29979, 29925, 2890, 13356, 3035, 29918, 1164, 18521, 29918, 8187, 17171, 29918, 29896, 353, 29871, 29896, 3532, 29871, 29953, 13, 1678, 379, 29979, 29925, 2890, 13356, 3035, 29918, 1164, 18521, 29918, 8187, 17171, 29918, 29906, 353, 29871, 29896, 3532, 29871, 29955, 13, 1678, 379, 29979, 29925, 2890, 13356, 3035, 29918, 1164, 18521, 29918, 8187, 17171, 29918, 29941, 353, 29871, 29896, 3532, 29871, 29947, 13, 1678, 349, 1525, 10403, 5005, 29918, 26441, 16786, 29918, 29903, 4897, 29925, 1955, 4945, 353, 29871, 29896, 3532, 29871, 29929, 13, 1678, 17067, 5194, 29918, 7024, 29965, 3352, 29949, 29918, 11889, 353, 29871, 29896, 3532, 29871, 29896, 29900, 13, 1678, 350, 23338, 29918, 29950, 3904, 4945, 29918, 1307, 29963, 6670, 29918, 29906, 353, 29871, 29896, 3532, 29871, 29896, 29946, 13, 1678, 478, 1001, 29902, 3738, 3352, 29918, 29933, 2891, 353, 29871, 29896, 3532, 29871, 29896, 29953, 13, 1678, 478, 1001, 29902, 3738, 3352, 29918, 2287, 12064, 3927, 13171, 353, 29871, 29896, 3532, 29871, 29896, 29955, 13, 1678, 315, 20161, 29902, 3738, 3352, 29918, 6720, 8032, 1299, 1955, 353, 29871, 29896, 3532, 29871, 29896, 29947, 13, 1678, 350, 2891, 29918, 10493, 29918, 23845, 24705, 29903, 353, 29871, 29896, 3532, 29871, 29896, 29929, 13, 13, 13, 1990, 6097, 1974, 1542, 29898, 18605, 29889, 2928, 16854, 1125, 13, 1678, 405, 12413, 353, 29871, 29900, 13, 1678, 405, 1806, 1672, 29918, 13875, 1799, 2965, 353, 29871, 29896, 13, 1678, 405, 1806, 1672, 353, 29871, 29906, 13, 13, 13, 1990, 4911, 29898, 5160, 2061, 1125, 13, 1678, 1024, 353, 4390, 29889, 7249, 3073, 877, 6786, 1495, 13, 1678, 2313, 20386, 1061, 353, 4390, 29889, 7249, 3073, 877, 2218, 29883, 20386, 1061, 1495, 13, 1678, 1029, 14873, 353, 4390, 29889, 7249, 3073, 877, 485, 14873, 1495, 13, 1678, 9225, 353, 4390, 29889, 7249, 3073, 877, 7451, 1495, 13, 1678, 1788, 353, 4390, 29889, 7249, 3073, 877, 5205, 1495, 13, 1678, 286, 5444, 29918, 17590, 353, 4390, 29889, 7249, 3073, 877, 29885, 5444, 29918, 17590, 1495, 13, 1678, 289, 7310, 353, 4390, 29889, 7249, 3073, 877, 29890, 7310, 1495, 13, 1678, 1035, 296, 29918, 2780, 353, 4390, 29889, 7249, 3073, 877, 562, 1760, 29918, 2780, 1495, 13, 1678, 15068, 353, 4390, 29889, 7249, 3073, 877, 23337, 1495, 13, 1678, 26834, 353, 4390, 29889, 7249, 3073, 877, 369, 2164, 1495, 13, 1678, 4876, 353, 4390, 29889, 7249, 3073, 877, 5269, 1495, 13, 1678, 13449, 353, 4390, 29889, 7249, 3073, 877, 15764, 742, 4911, 15675, 29897, 13, 1678, 5188, 1974, 29918, 1853, 353, 4390, 29889, 7249, 3073, 877, 1457, 29885, 1974, 29918, 1853, 742, 6097, 1974, 1542, 29897, 13, 1678, 970, 29918, 15764, 353, 4390, 29889, 7249, 3073, 877, 3597, 29918, 15764, 742, 4911, 15675, 29897, 13, 2 ]
pyvieslib/pyvieslib.py
KG5321/pyvieslib
1
107193
<reponame>KG5321/pyvieslib from .vies_validator import ViesValidator class PyViesLib: def __init__(self): self.vvld = ViesValidator() def check_vies(self, vies: str) -> bool: """Function checks validity of given VIES number :param vies: VIES number :type vies: str :return: Returns True when VIES is valid :rtype: bool """ vies = "".join(vies.split()).upper() country_code = self._get_cuntry_code(vies) vies_number = vies[0:3].replace(country_code, '') + vies[3:] result = self.vvld.validate(country_code, vies_number) return result def _get_cuntry_code(self, vies: str) -> str: """Functions extracts country code from VIES number :param vies: VIES number :type vies: str :return: VIES number country code :rtype: str """ if vies[0:3] == "CHE": return vies[0:3] return vies[0:2]
[ 1, 529, 276, 1112, 420, 29958, 29968, 29954, 29945, 29941, 29906, 29896, 29914, 2272, 29894, 583, 1982, 13, 3166, 869, 29894, 583, 29918, 3084, 1061, 1053, 478, 583, 24204, 13, 13, 13, 1990, 10772, 29963, 583, 14868, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 29894, 29894, 430, 353, 478, 583, 24204, 580, 13, 13, 1678, 822, 1423, 29918, 29894, 583, 29898, 1311, 29892, 325, 583, 29901, 851, 29897, 1599, 6120, 29901, 13, 4706, 9995, 6678, 12747, 2854, 537, 310, 2183, 5473, 2890, 1353, 13, 13, 4706, 584, 3207, 325, 583, 29901, 5473, 2890, 1353, 13, 4706, 584, 1853, 325, 583, 29901, 851, 13, 4706, 584, 2457, 29901, 16969, 5852, 746, 5473, 2890, 338, 2854, 13, 4706, 584, 29878, 1853, 29901, 6120, 13, 4706, 9995, 13, 4706, 325, 583, 353, 376, 1642, 7122, 29898, 29894, 583, 29889, 5451, 16655, 21064, 580, 13, 4706, 4234, 29918, 401, 353, 1583, 3032, 657, 29918, 29883, 348, 2202, 29918, 401, 29898, 29894, 583, 29897, 13, 4706, 325, 583, 29918, 4537, 353, 325, 583, 29961, 29900, 29901, 29941, 1822, 6506, 29898, 13509, 29918, 401, 29892, 27255, 718, 325, 583, 29961, 29941, 17531, 13, 4706, 1121, 353, 1583, 29889, 29894, 29894, 430, 29889, 15480, 29898, 13509, 29918, 401, 29892, 325, 583, 29918, 4537, 29897, 13, 4706, 736, 1121, 13, 13, 1678, 822, 903, 657, 29918, 29883, 348, 2202, 29918, 401, 29898, 1311, 29892, 325, 583, 29901, 851, 29897, 1599, 851, 29901, 13, 4706, 9995, 6678, 29879, 6597, 29879, 4234, 775, 515, 5473, 2890, 1353, 13, 13, 4706, 584, 3207, 325, 583, 29901, 5473, 2890, 1353, 13, 4706, 584, 1853, 325, 583, 29901, 851, 13, 4706, 584, 2457, 29901, 5473, 2890, 1353, 4234, 775, 13, 4706, 584, 29878, 1853, 29901, 851, 13, 4706, 9995, 13, 4706, 565, 325, 583, 29961, 29900, 29901, 29941, 29962, 1275, 376, 3210, 29923, 1115, 13, 9651, 736, 325, 583, 29961, 29900, 29901, 29941, 29962, 13, 4706, 736, 325, 583, 29961, 29900, 29901, 29906, 29962, 13, 2 ]
scripts/train/train_descriminator.py
bernardomig/photobooth
3
86471
import os import sys import argparse import torch import torch.distributed as dist from torch.nn.parallel import DistributedDataParallel from torch.utils.data import DataLoader, DistributedSampler from torchvision.transforms import functional as tfms # import wandb from apex import amp import numpy as np from numpy import array from ignite.engine import Events, Engine, _prepare_batch from ignite.metrics import RunningAverage from ignite.handlers import TerminateOnNan, ModelCheckpoint, DiskSaver, global_step_from_engine from ignite.contrib.handlers import ProgressBar from photobooth.engines.sr_supervised import create_sr_evaluator, create_sr_trainer from photobooth.data.datasets import DIV2K from photobooth.models import edsr from photobooth.models.srgan import SRDescriminator from photobooth.transforms import flip_horizontal, flip_vertical, to_tensor, crop_bounding_box, rot_90 MEAN = torch.tensor([0.4488, 0.4371, 0.4040]) DS_ROOT = '/srv/datasets/DIV2K' def train_tfms(crop_size, mean): def _transform(lowres, highres): h, w, _ = lowres.shape scaling_factor = highres.shape[0] // lowres.shape[0] x = np.random.randint(h // crop_size) y = np.random.randint(w // crop_size) lr = crop_bounding_box( lowres, x * crop_size, y * crop_size, crop_size, crop_size) hr = crop_bounding_box( highres, x * crop_size * scaling_factor, y * crop_size * scaling_factor, crop_size * scaling_factor, crop_size * scaling_factor) if np.random.rand() > 0.5: # Rotate by 90 lr = rot_90(lr) hr = rot_90(hr) if np.random.rand() > 0.5: # Vertical Flip lr = flip_vertical(lr) hr = flip_vertical(hr) if np.random.rand() > 0.5: # Horizontal Flip lr = flip_horizontal(lr) hr = flip_horizontal(hr) # Normalize lr = lr / 255. - MEAN.numpy() hr = hr / 255. - MEAN.numpy() # To torch tensor lr = torch.from_numpy(lr.astype('f4')) hr = torch.from_numpy(hr.astype('f4')) lr = lr.permute(2, 0, 1) hr = hr.permute(2, 0, 1) return {'lowres': lr, 'highres': hr} return _transform if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--batch_size', type=int, required=True) parser.add_argument('--learning_rate', type=float, required=True) parser.add_argument('--weight_decay', type=float, required=False, default=1e-4) parser.add_argument('--epochs', type=int, required=True) parser.add_argument('--model', type=str, required=True) parser.add_argument('--crop_size', type=int, default=48) parser.add_argument('--state_dict', type=str, required=False) parser.add_argument('--bootstrap', action='store_true') parser.add_argument('--distributed', action='store_true') parser.add_argument('--mixed_precision', action='store_true') parser.add_argument('--local_rank', type=int) args = parser.parse_args() if args.distributed: dist.init_process_group('nccl', init_method='env://') world_size = dist.get_world_size() world_rank = dist.get_rank() local_rank = args.local_rank else: local_rank = 0 torch.cuda.set_device(local_rank) device = torch.device('cuda') train_ds = DIV2K(DS_ROOT, split='train', config='bicubic/x4', transforms=train_tfms(args.crop_size, MEAN)) if args.distributed: sampler_args = dict(num_replicas=world_size, rank=local_rank) train_loader = DataLoader( train_ds, batch_size=args.batch_size, shuffle=False, num_workers=8, sampler=(DistributedSampler(train_ds, **sampler_args) if args.distributed else None) ) model = edsr.edsr_baseline_x4(3, 3) checkpoint = torch.load('weights/edsr_baseline_x4_pnsr=27.36.pth', map_location='cpu') model.load_state_dict(checkpoint) model = model.to(device) for p in model.parameters(): p.requires_grad_(False) descriminator = SRDescriminator(3, 1) descriminator = descriminator.to(device) loss_fn = torch.nn.BCEWithLogitsLoss() optimizer = torch.optim.AdamW(descriminator.parameters(), lr=args.learning_rate, weight_decay=args.weight_decay) if args.mixed_precision: (model, descriminator), optimizer = amp.initialize([model, descriminator], optimizer) if args.distributed: descriminator = DistributedDataParallel(descriminator, device_ids=[local_rank]) def _update_model(engine, batch): x, y = _prepare_batch(batch, device=device, non_blocking=True) optimizer.zero_grad() with torch.no_grad(): fake = model(x) real = y x_gan = torch.cat([fake, real], dim=0) y_gan = torch.cat([ torch.zeros(fake.size(0), 1), torch.ones(real.size(0), 1) ]).to(device) y_pred = descriminator(x_gan) loss = loss_fn(y_pred, y_gan) if args.mixed_precision: with amp.scale_loss(loss, optimizer) as scaled_loss: scaled_loss.backward() else: loss.backward() optimizer.step() return loss trainer = Engine(_update_model) RunningAverage(output_transform=lambda x: x).attach(trainer, 'loss') ProgressBar(persist=False).attach(trainer, ['loss']) if local_rank == 0: checkpointer = ModelCheckpoint( dirname='checkpoints', filename_prefix='model', score_name='loss', score_function=lambda engine: engine.state.metrics['loss'], n_saved=5, global_step_transform=global_step_from_engine(trainer), ) trainer.add_event_handler( Events.COMPLETED, checkpointer, to_save={'descriminator': descriminator if not args.distributed else descriminator.module}) trainer.run(train_loader, max_epochs=args.epochs)
[ 1, 1053, 2897, 13, 5215, 10876, 13, 5215, 1852, 5510, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 5721, 7541, 408, 1320, 13, 3166, 4842, 305, 29889, 15755, 29889, 23482, 1053, 6652, 7541, 1469, 2177, 6553, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 3630, 10036, 29892, 6652, 7541, 22966, 20069, 13, 13, 3166, 4842, 305, 4924, 29889, 9067, 29879, 1053, 13303, 408, 15886, 1516, 13, 13, 29937, 1053, 24706, 29890, 13, 13, 3166, 263, 412, 29916, 1053, 21332, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 12655, 1053, 1409, 13, 13, 3166, 5330, 568, 29889, 10599, 1053, 28488, 29892, 10863, 29892, 903, 19125, 29918, 16175, 13, 3166, 5330, 568, 29889, 2527, 10817, 1053, 19509, 29909, 19698, 13, 3166, 5330, 568, 29889, 3179, 9306, 1053, 11814, 16976, 2951, 29940, 273, 29892, 8125, 5596, 3149, 29892, 20579, 29903, 12483, 29892, 5534, 29918, 10568, 29918, 3166, 29918, 10599, 13, 3166, 5330, 568, 29889, 21570, 29889, 3179, 9306, 1053, 20018, 4297, 13, 13, 13, 3166, 6731, 711, 6983, 29889, 996, 1475, 29889, 21935, 29918, 9136, 11292, 1053, 1653, 29918, 21935, 29918, 24219, 1061, 29892, 1653, 29918, 21935, 29918, 3018, 4983, 13, 3166, 6731, 711, 6983, 29889, 1272, 29889, 14538, 1691, 1053, 360, 5667, 29906, 29968, 13, 3166, 6731, 711, 6983, 29889, 9794, 1053, 1226, 21935, 13, 3166, 6731, 711, 6983, 29889, 9794, 29889, 21935, 6249, 1053, 21020, 19617, 20386, 1061, 13, 3166, 6731, 711, 6983, 29889, 9067, 29879, 1053, 285, 3466, 29918, 22672, 29892, 285, 3466, 29918, 18575, 29892, 304, 29918, 20158, 29892, 274, 1336, 29918, 9917, 292, 29918, 1884, 29892, 5731, 29918, 29929, 29900, 13, 13, 13, 2303, 2190, 353, 4842, 305, 29889, 20158, 4197, 29900, 29889, 29946, 29946, 29947, 29947, 29892, 29871, 29900, 29889, 29946, 29941, 29955, 29896, 29892, 29871, 29900, 29889, 29946, 29900, 29946, 29900, 2314, 13, 8452, 29918, 21289, 353, 8207, 29879, 15291, 29914, 14538, 1691, 29914, 4571, 29963, 29906, 29968, 29915, 13, 13, 13, 1753, 7945, 29918, 13264, 1516, 29898, 29883, 1336, 29918, 2311, 29892, 2099, 1125, 13, 1678, 822, 903, 9067, 29898, 677, 690, 29892, 1880, 690, 1125, 13, 4706, 298, 29892, 281, 29892, 903, 353, 4482, 690, 29889, 12181, 13, 4706, 21640, 29918, 19790, 353, 1880, 690, 29889, 12181, 29961, 29900, 29962, 849, 4482, 690, 29889, 12181, 29961, 29900, 29962, 13, 13, 4706, 921, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29882, 849, 274, 1336, 29918, 2311, 29897, 13, 4706, 343, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29893, 849, 274, 1336, 29918, 2311, 29897, 13, 13, 4706, 301, 29878, 353, 274, 1336, 29918, 9917, 292, 29918, 1884, 29898, 13, 9651, 4482, 690, 29892, 13, 9651, 921, 334, 274, 1336, 29918, 2311, 29892, 343, 334, 274, 1336, 29918, 2311, 29892, 13, 9651, 274, 1336, 29918, 2311, 29892, 274, 1336, 29918, 2311, 29897, 13, 4706, 22157, 353, 274, 1336, 29918, 9917, 292, 29918, 1884, 29898, 13, 9651, 1880, 690, 29892, 13, 9651, 921, 334, 274, 1336, 29918, 2311, 334, 21640, 29918, 19790, 29892, 343, 334, 274, 1336, 29918, 2311, 334, 21640, 29918, 19790, 29892, 13, 9651, 274, 1336, 29918, 2311, 334, 21640, 29918, 19790, 29892, 274, 1336, 29918, 2311, 334, 21640, 29918, 19790, 29897, 13, 13, 4706, 565, 7442, 29889, 8172, 29889, 9502, 580, 1405, 29871, 29900, 29889, 29945, 29901, 13, 9651, 396, 9664, 403, 491, 29871, 29929, 29900, 13, 9651, 301, 29878, 353, 5731, 29918, 29929, 29900, 29898, 29212, 29897, 13, 9651, 22157, 353, 5731, 29918, 29929, 29900, 29898, 1092, 29897, 13, 13, 4706, 565, 7442, 29889, 8172, 29889, 9502, 580, 1405, 29871, 29900, 29889, 29945, 29901, 13, 9651, 396, 11198, 936, 383, 3466, 13, 9651, 301, 29878, 353, 285, 3466, 29918, 18575, 29898, 29212, 29897, 13, 9651, 22157, 353, 285, 3466, 29918, 18575, 29898, 1092, 29897, 13, 4706, 565, 7442, 29889, 8172, 29889, 9502, 580, 1405, 29871, 29900, 29889, 29945, 29901, 13, 9651, 396, 6912, 7731, 383, 3466, 13, 9651, 301, 29878, 353, 285, 3466, 29918, 22672, 29898, 29212, 29897, 13, 9651, 22157, 353, 285, 3466, 29918, 22672, 29898, 1092, 29897, 13, 13, 4706, 396, 21981, 675, 13, 4706, 301, 29878, 353, 301, 29878, 847, 29871, 29906, 29945, 29945, 29889, 448, 22986, 2190, 29889, 23749, 580, 13, 4706, 22157, 353, 22157, 847, 29871, 29906, 29945, 29945, 29889, 448, 22986, 2190, 29889, 23749, 580, 13, 13, 4706, 396, 1763, 4842, 305, 12489, 13, 4706, 301, 29878, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 29212, 29889, 579, 668, 877, 29888, 29946, 8785, 13, 4706, 22157, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 1092, 29889, 579, 668, 877, 29888, 29946, 8785, 13, 13, 4706, 301, 29878, 353, 301, 29878, 29889, 17858, 1082, 29898, 29906, 29892, 29871, 29900, 29892, 29871, 29896, 29897, 13, 4706, 22157, 353, 22157, 29889, 17858, 1082, 29898, 29906, 29892, 29871, 29900, 29892, 29871, 29896, 29897, 13, 13, 4706, 736, 11117, 677, 690, 2396, 301, 29878, 29892, 525, 9812, 690, 2396, 22157, 29913, 13, 1678, 736, 903, 9067, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16175, 29918, 2311, 742, 1134, 29922, 524, 29892, 3734, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 21891, 29918, 10492, 742, 1134, 29922, 7411, 29892, 3734, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 7915, 29918, 7099, 388, 742, 1134, 29922, 7411, 29892, 3734, 29922, 8824, 29892, 2322, 29922, 29896, 29872, 29899, 29946, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1022, 2878, 29879, 742, 1134, 29922, 524, 29892, 3734, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4299, 742, 1134, 29922, 710, 29892, 3734, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29883, 1336, 29918, 2311, 742, 1134, 29922, 524, 29892, 2322, 29922, 29946, 29947, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 3859, 29918, 8977, 742, 1134, 29922, 710, 29892, 3734, 29922, 8824, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 8704, 742, 3158, 2433, 8899, 29918, 3009, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 5721, 7541, 742, 3158, 2433, 8899, 29918, 3009, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29885, 11925, 29918, 17990, 2459, 742, 3158, 2433, 8899, 29918, 3009, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2997, 29918, 10003, 742, 1134, 29922, 524, 29897, 13, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 565, 6389, 29889, 5721, 7541, 29901, 13, 4706, 1320, 29889, 2344, 29918, 5014, 29918, 2972, 877, 29876, 617, 29880, 742, 2069, 29918, 5696, 2433, 6272, 597, 1495, 13, 4706, 3186, 29918, 2311, 353, 1320, 29889, 657, 29918, 11526, 29918, 2311, 580, 13, 4706, 3186, 29918, 10003, 353, 1320, 29889, 657, 29918, 10003, 580, 13, 4706, 1887, 29918, 10003, 353, 6389, 29889, 2997, 29918, 10003, 13, 1678, 1683, 29901, 13, 4706, 1887, 29918, 10003, 353, 29871, 29900, 13, 13, 1678, 4842, 305, 29889, 29883, 6191, 29889, 842, 29918, 10141, 29898, 2997, 29918, 10003, 29897, 13, 1678, 4742, 353, 4842, 305, 29889, 10141, 877, 29883, 6191, 1495, 13, 13, 1678, 7945, 29918, 6289, 353, 360, 5667, 29906, 29968, 29898, 8452, 29918, 21289, 29892, 6219, 2433, 14968, 742, 2295, 2433, 29890, 293, 431, 293, 29914, 29916, 29946, 742, 13, 462, 268, 4327, 29879, 29922, 14968, 29918, 13264, 1516, 29898, 5085, 29889, 29883, 1336, 29918, 2311, 29892, 22986, 2190, 876, 13, 13, 1678, 565, 6389, 29889, 5721, 7541, 29901, 13, 4706, 3514, 20069, 29918, 5085, 353, 9657, 29898, 1949, 29918, 3445, 506, 294, 29922, 11526, 29918, 2311, 29892, 7115, 29922, 2997, 29918, 10003, 29897, 13, 1678, 7945, 29918, 12657, 353, 3630, 10036, 29898, 13, 4706, 7945, 29918, 6289, 29892, 9853, 29918, 2311, 29922, 5085, 29889, 16175, 29918, 2311, 29892, 13, 4706, 528, 21897, 29922, 8824, 29892, 954, 29918, 1287, 414, 29922, 29947, 29892, 13, 4706, 3514, 20069, 7607, 13398, 7541, 22966, 20069, 29898, 14968, 29918, 6289, 29892, 3579, 13445, 20069, 29918, 5085, 29897, 565, 6389, 29889, 5721, 7541, 1683, 6213, 29897, 13, 1678, 1723, 13, 13, 1678, 1904, 353, 1226, 21935, 29889, 5779, 29878, 29918, 6500, 5570, 29918, 29916, 29946, 29898, 29941, 29892, 29871, 29941, 29897, 13, 1678, 1423, 3149, 353, 4842, 305, 29889, 1359, 877, 705, 5861, 29914, 5779, 29878, 29918, 6500, 5570, 29918, 29916, 29946, 29918, 29886, 1983, 29878, 29922, 29906, 29955, 29889, 29941, 29953, 29889, 29886, 386, 742, 2910, 29918, 5479, 2433, 21970, 1495, 13, 1678, 1904, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 3149, 29897, 13, 13, 1678, 1904, 353, 1904, 29889, 517, 29898, 10141, 29897, 13, 1678, 363, 282, 297, 1904, 29889, 16744, 7295, 13, 4706, 282, 29889, 276, 339, 2658, 29918, 5105, 23538, 8824, 29897, 13, 1678, 5153, 20386, 1061, 353, 21020, 19617, 20386, 1061, 29898, 29941, 29892, 29871, 29896, 29897, 13, 1678, 5153, 20386, 1061, 353, 5153, 20386, 1061, 29889, 517, 29898, 10141, 29897, 13, 1678, 6410, 29918, 9144, 353, 4842, 305, 29889, 15755, 29889, 29933, 4741, 3047, 3403, 1169, 29931, 2209, 580, 13, 13, 1678, 5994, 3950, 353, 4842, 305, 29889, 20640, 29889, 3253, 314, 29956, 29898, 14273, 20386, 1061, 29889, 16744, 3285, 13, 462, 462, 29871, 301, 29878, 29922, 5085, 29889, 21891, 29918, 10492, 29892, 13, 462, 462, 29871, 7688, 29918, 7099, 388, 29922, 5085, 29889, 7915, 29918, 7099, 388, 29897, 13, 13, 1678, 565, 6389, 29889, 29885, 11925, 29918, 17990, 2459, 29901, 13, 4706, 313, 4299, 29892, 5153, 20386, 1061, 511, 5994, 3950, 353, 21332, 29889, 24926, 4197, 4299, 29892, 5153, 20386, 1061, 1402, 5994, 3950, 29897, 13, 13, 1678, 565, 6389, 29889, 5721, 7541, 29901, 13, 4706, 5153, 20386, 1061, 353, 6652, 7541, 1469, 2177, 6553, 29898, 14273, 20386, 1061, 29892, 4742, 29918, 4841, 11759, 2997, 29918, 10003, 2314, 13, 13, 1678, 822, 903, 5504, 29918, 4299, 29898, 10599, 29892, 9853, 1125, 13, 4706, 921, 29892, 343, 353, 903, 19125, 29918, 16175, 29898, 16175, 29892, 4742, 29922, 10141, 29892, 1661, 29918, 1271, 292, 29922, 5574, 29897, 13, 13, 4706, 5994, 3950, 29889, 9171, 29918, 5105, 580, 13, 4706, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 9651, 25713, 353, 1904, 29898, 29916, 29897, 13, 4706, 1855, 353, 343, 13, 4706, 921, 29918, 6249, 353, 4842, 305, 29889, 4117, 4197, 29888, 1296, 29892, 1855, 1402, 3964, 29922, 29900, 29897, 13, 4706, 343, 29918, 6249, 353, 4842, 305, 29889, 4117, 4197, 13, 9651, 4842, 305, 29889, 3298, 359, 29898, 29888, 1296, 29889, 2311, 29898, 29900, 511, 29871, 29896, 511, 13, 9651, 4842, 305, 29889, 2873, 29898, 6370, 29889, 2311, 29898, 29900, 511, 29871, 29896, 29897, 13, 4706, 4514, 467, 517, 29898, 10141, 29897, 13, 13, 4706, 343, 29918, 11965, 353, 5153, 20386, 1061, 29898, 29916, 29918, 6249, 29897, 13, 13, 4706, 6410, 353, 6410, 29918, 9144, 29898, 29891, 29918, 11965, 29892, 343, 29918, 6249, 29897, 13, 13, 4706, 565, 6389, 29889, 29885, 11925, 29918, 17990, 2459, 29901, 13, 9651, 411, 21332, 29889, 7052, 29918, 6758, 29898, 6758, 29892, 5994, 3950, 29897, 408, 6287, 29881, 29918, 6758, 29901, 13, 18884, 6287, 29881, 29918, 6758, 29889, 1627, 1328, 580, 13, 4706, 1683, 29901, 13, 9651, 6410, 29889, 1627, 1328, 580, 13, 13, 4706, 5994, 3950, 29889, 10568, 580, 13, 4706, 736, 6410, 13, 13, 1678, 1020, 4983, 353, 10863, 7373, 5504, 29918, 4299, 29897, 13, 1678, 19509, 29909, 19698, 29898, 4905, 29918, 9067, 29922, 2892, 921, 29901, 921, 467, 14930, 29898, 3018, 4983, 29892, 525, 6758, 1495, 13, 1678, 20018, 4297, 29898, 6774, 391, 29922, 8824, 467, 14930, 29898, 3018, 4983, 29892, 6024, 6758, 11287, 13, 13, 1678, 565, 1887, 29918, 10003, 1275, 29871, 29900, 29901, 13, 4706, 1423, 17226, 353, 8125, 5596, 3149, 29898, 13, 9651, 4516, 978, 2433, 3198, 9748, 742, 13, 9651, 10422, 29918, 13506, 2433, 4299, 742, 13, 9651, 8158, 29918, 978, 2433, 6758, 742, 13, 9651, 8158, 29918, 2220, 29922, 2892, 6012, 29901, 6012, 29889, 3859, 29889, 2527, 10817, 1839, 6758, 7464, 13, 9651, 302, 29918, 17314, 29922, 29945, 29892, 13, 9651, 5534, 29918, 10568, 29918, 9067, 29922, 10945, 29918, 10568, 29918, 3166, 29918, 10599, 29898, 3018, 4983, 511, 13, 4706, 1723, 13, 4706, 1020, 4983, 29889, 1202, 29918, 3696, 29918, 13789, 29898, 13, 9651, 28488, 29889, 21514, 1307, 29911, 3352, 29892, 1423, 17226, 29892, 13, 9651, 304, 29918, 7620, 3790, 29915, 14273, 20386, 1061, 2396, 5153, 20386, 1061, 565, 451, 6389, 29889, 5721, 7541, 1683, 5153, 20386, 1061, 29889, 5453, 1800, 13, 13, 1678, 1020, 4983, 29889, 3389, 29898, 14968, 29918, 12657, 29892, 4236, 29918, 1022, 2878, 29879, 29922, 5085, 29889, 1022, 2878, 29879, 29897, 13, 2 ]
2018/11/code.py
Akumatic/Advent-of-Code
22
90500
""" https://adventofcode.com/2018/day/11 """ def readFile(): with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f: return int(f.read()) def getPowerlevel(x, y, serial): rackId = x + 10 powerLevel = (rackId * y + serial) * rackId return (int(powerLevel / 100) % 10) - 5 def createGrid(serial): grid = [] for j in range(1, 301): row = [] for i in range(1, 301): row.append(getPowerlevel(i, j, serial)) grid.append(row) return grid def getBiggestField(grid, size): maxSum = 0 maxCoords = (-1, -1) for j in range(300 - size + 1): for i in range(300 - size + 1): curSum = 0 for n in range(size): for m in range(size): curSum += grid[j + m][i + n] if curSum > maxSum: maxSum = curSum maxCoords = (i + 1, j + 1) return maxCoords, maxSum def getSat(grid): # generates and returns summed-area table sat = {} size = len(grid) for j in range(size): for i in range(size): value = grid[j][i] + sat.get(str((i - 1, j)), 0) value += sat.get(str((i, j - 1)), 0) - sat.get(str((i - 1, j - 1)), 0) sat[str((i, j))] = value return sat def getBiggestFieldSAT(sat, size): maxSum = 0 maxCoords = (-1, -1) for j in range(300 - size): for i in range(300 - size): ip, jp = i + size, j + size curSum = sat[str((i, j))] + sat[str((ip, jp))] - sat[str((ip, j))] - sat[str((i, jp))] if curSum > maxSum: maxSum = curSum maxCoords = (i + 2, j + 2) return maxCoords, maxSum def part1(value): grid = createGrid(value) return getBiggestField(grid, 3)[0] def part2(value): grid = createGrid(value) sat = getSat(grid) maxSum = 0 size = -1 maxCoords = (-1, -1) for i in range(300): curCoords, curSum = getBiggestFieldSAT(sat, i) if curSum > maxSum: maxSum = curSum size = i maxCoords = curCoords return (maxCoords[0], maxCoords[1], size) if __name__ == "__main__": value = readFile() print(f"Part 1: {part1(value)}") print(f"Part 2: {part2(value)}")
[ 1, 9995, 2045, 597, 328, 794, 974, 401, 29889, 510, 29914, 29906, 29900, 29896, 29947, 29914, 3250, 29914, 29896, 29896, 9995, 13, 13, 1753, 1303, 2283, 7295, 13, 1678, 411, 1722, 29898, 29888, 29908, 29912, 1649, 1445, 26914, 29878, 17010, 877, 401, 29889, 2272, 1495, 29913, 2080, 29889, 3945, 613, 376, 29878, 1159, 408, 285, 29901, 13, 4706, 736, 938, 29898, 29888, 29889, 949, 3101, 13, 13, 1753, 679, 21472, 5563, 29898, 29916, 29892, 343, 29892, 7797, 1125, 13, 1678, 1153, 384, 1204, 353, 921, 718, 29871, 29896, 29900, 13, 1678, 3081, 10108, 353, 313, 22282, 1204, 334, 343, 718, 7797, 29897, 334, 1153, 384, 1204, 13, 1678, 736, 313, 524, 29898, 13519, 10108, 847, 29871, 29896, 29900, 29900, 29897, 1273, 29871, 29896, 29900, 29897, 448, 29871, 29945, 13, 13, 1753, 1653, 5756, 29898, 15550, 1125, 13, 1678, 6856, 353, 5159, 13, 1678, 363, 432, 297, 3464, 29898, 29896, 29892, 29871, 29941, 29900, 29896, 1125, 13, 4706, 1948, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 29871, 29941, 29900, 29896, 1125, 13, 9651, 1948, 29889, 4397, 29898, 657, 21472, 5563, 29898, 29875, 29892, 432, 29892, 7797, 876, 13, 4706, 6856, 29889, 4397, 29898, 798, 29897, 13, 1678, 736, 6856, 13, 13, 1753, 679, 6970, 7118, 3073, 29898, 7720, 29892, 2159, 1125, 13, 1678, 4236, 11139, 353, 29871, 29900, 13, 1678, 4236, 7967, 4339, 353, 8521, 29896, 29892, 448, 29896, 29897, 13, 1678, 363, 432, 297, 3464, 29898, 29941, 29900, 29900, 448, 2159, 718, 29871, 29896, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 29900, 29900, 448, 2159, 718, 29871, 29896, 1125, 13, 9651, 3151, 11139, 353, 29871, 29900, 13, 9651, 363, 302, 297, 3464, 29898, 2311, 1125, 13, 18884, 363, 286, 297, 3464, 29898, 2311, 1125, 13, 462, 1678, 3151, 11139, 4619, 6856, 29961, 29926, 718, 286, 3816, 29875, 718, 302, 29962, 13, 9651, 565, 3151, 11139, 1405, 4236, 11139, 29901, 13, 18884, 4236, 11139, 353, 3151, 11139, 13, 18884, 4236, 7967, 4339, 353, 313, 29875, 718, 29871, 29896, 29892, 432, 718, 29871, 29896, 29897, 13, 1678, 736, 4236, 7967, 4339, 29892, 4236, 11139, 13, 13, 1753, 679, 29903, 271, 29898, 7720, 1125, 13, 1678, 396, 16785, 322, 3639, 2533, 2168, 29899, 6203, 1591, 13, 1678, 3290, 353, 6571, 13, 1678, 2159, 353, 7431, 29898, 7720, 29897, 13, 1678, 363, 432, 297, 3464, 29898, 2311, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 2311, 1125, 13, 9651, 995, 353, 6856, 29961, 29926, 3816, 29875, 29962, 718, 3290, 29889, 657, 29898, 710, 3552, 29875, 448, 29871, 29896, 29892, 432, 8243, 29871, 29900, 29897, 29871, 13, 9651, 995, 4619, 3290, 29889, 657, 29898, 710, 3552, 29875, 29892, 432, 448, 29871, 29896, 8243, 29871, 29900, 29897, 448, 3290, 29889, 657, 29898, 710, 3552, 29875, 448, 29871, 29896, 29892, 432, 448, 29871, 29896, 8243, 29871, 29900, 29897, 13, 9651, 3290, 29961, 710, 3552, 29875, 29892, 432, 28166, 353, 995, 13, 1678, 736, 3290, 13, 13, 1753, 679, 6970, 7118, 3073, 29903, 1299, 29898, 29879, 271, 29892, 2159, 1125, 13, 1678, 4236, 11139, 353, 29871, 29900, 13, 1678, 4236, 7967, 4339, 353, 8521, 29896, 29892, 448, 29896, 29897, 13, 1678, 363, 432, 297, 3464, 29898, 29941, 29900, 29900, 448, 2159, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 29900, 29900, 448, 2159, 1125, 13, 9651, 10377, 29892, 432, 29886, 353, 474, 718, 2159, 29892, 432, 718, 2159, 13, 9651, 3151, 11139, 353, 3290, 29961, 710, 3552, 29875, 29892, 432, 28166, 718, 3290, 29961, 710, 3552, 666, 29892, 432, 29886, 28166, 448, 3290, 29961, 710, 3552, 666, 29892, 432, 28166, 448, 3290, 29961, 710, 3552, 29875, 29892, 432, 29886, 28166, 13, 9651, 565, 3151, 11139, 1405, 4236, 11139, 29901, 13, 18884, 4236, 11139, 353, 3151, 11139, 13, 18884, 4236, 7967, 4339, 353, 313, 29875, 718, 29871, 29906, 29892, 432, 718, 29871, 29906, 29897, 13, 1678, 736, 4236, 7967, 4339, 29892, 4236, 11139, 13, 13, 1753, 760, 29896, 29898, 1767, 1125, 13, 1678, 6856, 353, 1653, 5756, 29898, 1767, 29897, 13, 1678, 736, 679, 6970, 7118, 3073, 29898, 7720, 29892, 29871, 29941, 9601, 29900, 29962, 13, 13, 1753, 760, 29906, 29898, 1767, 1125, 13, 1678, 6856, 353, 1653, 5756, 29898, 1767, 29897, 13, 1678, 3290, 353, 679, 29903, 271, 29898, 7720, 29897, 13, 1678, 4236, 11139, 353, 29871, 29900, 13, 1678, 2159, 353, 448, 29896, 13, 1678, 4236, 7967, 4339, 353, 8521, 29896, 29892, 448, 29896, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29941, 29900, 29900, 1125, 13, 4706, 3151, 7967, 4339, 29892, 3151, 11139, 353, 679, 6970, 7118, 3073, 29903, 1299, 29898, 29879, 271, 29892, 474, 29897, 13, 4706, 565, 3151, 11139, 1405, 4236, 11139, 29901, 13, 9651, 4236, 11139, 353, 3151, 11139, 13, 9651, 2159, 353, 474, 13, 9651, 4236, 7967, 4339, 353, 3151, 7967, 4339, 13, 1678, 736, 313, 3317, 7967, 4339, 29961, 29900, 1402, 4236, 7967, 4339, 29961, 29896, 1402, 2159, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 995, 353, 1303, 2283, 580, 13, 1678, 1596, 29898, 29888, 29908, 7439, 29871, 29896, 29901, 426, 1595, 29896, 29898, 1767, 2915, 1159, 13, 1678, 1596, 29898, 29888, 29908, 7439, 29871, 29906, 29901, 426, 1595, 29906, 29898, 1767, 2915, 1159, 2 ]
robot_framework/utils/pattern_formed.py
abarcis/robot-framework
0
131925
#! /usr/bin/env python import numpy as np from .order_parameters import potential_M_N, centroid_m def is_discrete_pattern_formed(states, params): K = params['K'] M = params['M'] potential = potential_M_N(K, M, states.values()) velocities = np.array([s.velocity for s in states.values()]) speeds = np.linalg.norm(velocities, axis=1) # print(max(speeds)) return potential < 1e-15 and max(speeds) < 0.001 def is_original_pattern_formed(states, params): phases = [s.phase for s in states.values()] centroid = centroid_m(1, phases) velocities = np.array([s.velocity for s in states.values()]) speeds = np.linalg.norm(velocities, axis=1) return abs(1 - centroid) < 1e-15 and max(speeds) < 0.001
[ 1, 396, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 869, 2098, 29918, 16744, 1053, 7037, 29918, 29924, 29918, 29940, 29892, 1644, 1007, 29918, 29885, 13, 13, 13, 1753, 338, 29918, 2218, 9084, 29918, 11037, 29918, 15628, 29898, 28631, 29892, 8636, 1125, 13, 1678, 476, 353, 8636, 1839, 29968, 2033, 13, 1678, 341, 353, 8636, 1839, 29924, 2033, 13, 1678, 7037, 353, 7037, 29918, 29924, 29918, 29940, 29898, 29968, 29892, 341, 29892, 5922, 29889, 5975, 3101, 13, 1678, 9110, 1907, 353, 7442, 29889, 2378, 4197, 29879, 29889, 955, 25245, 363, 269, 297, 5922, 29889, 5975, 580, 2314, 13, 1678, 961, 5779, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 955, 542, 1907, 29892, 9685, 29922, 29896, 29897, 13, 1678, 396, 1596, 29898, 3317, 29898, 5965, 5779, 876, 13, 1678, 736, 7037, 529, 29871, 29896, 29872, 29899, 29896, 29945, 322, 4236, 29898, 5965, 5779, 29897, 529, 29871, 29900, 29889, 29900, 29900, 29896, 13, 13, 13, 1753, 338, 29918, 13492, 29918, 11037, 29918, 15628, 29898, 28631, 29892, 8636, 1125, 13, 1678, 29540, 353, 518, 29879, 29889, 21646, 363, 269, 297, 5922, 29889, 5975, 580, 29962, 13, 1678, 1644, 1007, 353, 1644, 1007, 29918, 29885, 29898, 29896, 29892, 29540, 29897, 13, 1678, 9110, 1907, 353, 7442, 29889, 2378, 4197, 29879, 29889, 955, 25245, 363, 269, 297, 5922, 29889, 5975, 580, 2314, 13, 1678, 961, 5779, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 955, 542, 1907, 29892, 9685, 29922, 29896, 29897, 13, 1678, 736, 6425, 29898, 29896, 448, 1644, 1007, 29897, 529, 29871, 29896, 29872, 29899, 29896, 29945, 322, 4236, 29898, 5965, 5779, 29897, 529, 29871, 29900, 29889, 29900, 29900, 29896, 13, 2 ]
crypto_tracker/crypto.py
sonalimahajan12/Automation-scripts
496
171099
<reponame>sonalimahajan12/Automation-scripts import requests import sys def get_prices(): # Checking there is a coin passed if len(sys.argv) > 1: coins = sys.argv[1:] else: # Default coins coins = ["BTC", "ETH", "XRP", "LTC", "BCH", "ADA", "DOT", "LINK", "BNB", "XLM"] crypto_data = requests.get( "https://min-api.cryptocompare.com/" "data/pricemultifull?fsyms={}&tsyms=USD" .format(",".join(coins))).json()["RAW"] data = {} for i in crypto_data: data[i] = { "coin": i, "price": crypto_data[i]["USD"]["PRICE"], "change_day": crypto_data[i]["USD"]["CHANGEPCT24HOUR"], "change_hour": crypto_data[i]["USD"]["CHANGEPCTHOUR"] } return data if __name__ == "__main__": crypto_data = get_prices() message = "" for i in crypto_data: coin = crypto_data[i]["coin"] price = crypto_data[i]["price"] change_day = crypto_data[i]["change_day"] change_hour = crypto_data[i]["change_hour"] message += f"\nCoin: {coin}" message += f"\nPrice: ${price:,.2f}" message += f"\nHour Change: {change_hour:.3f}%" message += f"\nDay Change: {change_day:.3f}%\n" print(message)
[ 1, 529, 276, 1112, 420, 29958, 1100, 284, 326, 801, 1175, 273, 29896, 29906, 29914, 28451, 362, 29899, 16713, 13, 5215, 7274, 13, 5215, 10876, 13, 13, 13, 1753, 679, 29918, 558, 1575, 7295, 13, 13, 1678, 396, 5399, 292, 727, 338, 263, 19480, 4502, 13, 1678, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29896, 29901, 13, 4706, 1302, 1144, 353, 10876, 29889, 19218, 29961, 29896, 17531, 13, 1678, 1683, 29901, 13, 4706, 396, 13109, 1302, 1144, 13, 4706, 1302, 1144, 353, 6796, 29933, 9472, 613, 376, 2544, 29950, 613, 376, 29990, 29934, 29925, 613, 376, 5850, 29907, 613, 376, 29933, 3210, 613, 13, 462, 376, 3035, 29909, 613, 376, 29928, 2891, 613, 376, 23714, 29968, 613, 376, 29933, 23189, 613, 376, 29990, 26369, 3108, 13, 1678, 274, 17929, 29918, 1272, 353, 7274, 29889, 657, 29898, 13, 4706, 376, 991, 597, 1195, 29899, 2754, 29889, 29883, 17929, 18307, 29889, 510, 12975, 13, 4706, 376, 1272, 29914, 558, 293, 331, 499, 361, 913, 29973, 5847, 962, 29879, 3790, 15704, 1372, 962, 29879, 29922, 3308, 29928, 29908, 13, 4706, 869, 4830, 28165, 1642, 7122, 29898, 1111, 1144, 876, 467, 3126, 580, 3366, 4717, 29956, 3108, 13, 13, 1678, 848, 353, 6571, 13, 1678, 363, 474, 297, 274, 17929, 29918, 1272, 29901, 13, 4706, 848, 29961, 29875, 29962, 353, 426, 13, 9651, 376, 1111, 262, 1115, 474, 29892, 13, 9651, 376, 9175, 1115, 274, 17929, 29918, 1272, 29961, 29875, 29962, 3366, 3308, 29928, 3108, 3366, 10593, 12107, 12436, 13, 9651, 376, 3167, 29918, 3250, 1115, 274, 17929, 29918, 1272, 29961, 29875, 29962, 3366, 3308, 29928, 3108, 3366, 3210, 24336, 29925, 1783, 29906, 29946, 8187, 4574, 12436, 13, 9651, 376, 3167, 29918, 18721, 1115, 274, 17929, 29918, 1272, 29961, 29875, 29962, 3366, 3308, 29928, 3108, 3366, 3210, 24336, 29925, 1783, 8187, 4574, 3108, 13, 4706, 500, 13, 1678, 736, 848, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 274, 17929, 29918, 1272, 353, 679, 29918, 558, 1575, 580, 13, 1678, 2643, 353, 5124, 13, 1678, 363, 474, 297, 274, 17929, 29918, 1272, 29901, 13, 4706, 19480, 353, 274, 17929, 29918, 1272, 29961, 29875, 29962, 3366, 1111, 262, 3108, 13, 4706, 8666, 353, 274, 17929, 29918, 1272, 29961, 29875, 29962, 3366, 9175, 3108, 13, 4706, 1735, 29918, 3250, 353, 274, 17929, 29918, 1272, 29961, 29875, 29962, 3366, 3167, 29918, 3250, 3108, 13, 4706, 1735, 29918, 18721, 353, 274, 17929, 29918, 1272, 29961, 29875, 29962, 3366, 3167, 29918, 18721, 3108, 13, 4706, 2643, 4619, 285, 26732, 29876, 7967, 262, 29901, 426, 1111, 262, 5038, 13, 4706, 2643, 4619, 285, 26732, 29876, 13026, 29901, 6435, 9175, 29901, 7671, 29906, 29888, 5038, 13, 4706, 2643, 4619, 285, 26732, 29876, 29950, 473, 10726, 29901, 426, 3167, 29918, 18721, 29901, 29889, 29941, 29888, 10560, 29908, 13, 4706, 2643, 4619, 285, 26732, 29876, 12742, 10726, 29901, 426, 3167, 29918, 3250, 29901, 29889, 29941, 29888, 10560, 29905, 29876, 29908, 13, 1678, 1596, 29898, 4906, 29897, 13, 2 ]
render/PC_Normalisation.py
sun-pyo/OcCo
158
1070
<reponame>sun-pyo/OcCo<gh_stars>100-1000 # Copyright (c) 2020. <NAME>, <EMAIL> import os, open3d, numpy as np File_ = open('ModelNet_flist_short.txt', 'w') if __name__ == "__main__": root_dir = "../data/ModelNet_subset/" for root, dirs, files in os.walk(root_dir, topdown=False): for file in files: if '.ply' in file: amesh = open3d.io.read_triangle_mesh(os.path.join(root, file)) out_file_name = os.path.join(root, file).replace('.ply', '_normalised.obj') center = amesh.get_center() amesh.translate(-center) maxR = (np.asarray(amesh.vertices)**2).sum(axis=1).max()**(1/2) # we found divided by (2*maxR) has best rendered visualisation results amesh.scale(1/(2*maxR)) open3d.io.write_triangle_mesh(out_file_name, amesh) File_.writelines(out_file_name.replace('.obj', '').replace(root_dir, '') + '\n') print(out_file_name)
[ 1, 529, 276, 1112, 420, 29958, 11445, 29899, 2272, 29877, 29914, 29949, 29883, 7967, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 29937, 29871, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29900, 29889, 529, 5813, 10202, 529, 26862, 6227, 29958, 13, 13, 5215, 2897, 29892, 1722, 29941, 29881, 29892, 12655, 408, 7442, 13, 13, 2283, 29918, 353, 1722, 877, 3195, 6779, 29918, 1579, 391, 29918, 12759, 29889, 3945, 742, 525, 29893, 1495, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 3876, 29918, 3972, 353, 376, 6995, 1272, 29914, 3195, 6779, 29918, 6484, 12975, 13, 13, 1678, 363, 3876, 29892, 4516, 29879, 29892, 2066, 297, 2897, 29889, 20919, 29898, 4632, 29918, 3972, 29892, 2246, 3204, 29922, 8824, 1125, 13, 4706, 363, 934, 297, 2066, 29901, 13, 9651, 565, 15300, 17632, 29915, 297, 934, 29901, 13, 18884, 626, 12094, 353, 1722, 29941, 29881, 29889, 601, 29889, 949, 29918, 26701, 29918, 4467, 29882, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4632, 29892, 934, 876, 13, 18884, 714, 29918, 1445, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4632, 29892, 934, 467, 6506, 12839, 17632, 742, 22868, 8945, 3368, 29889, 5415, 1495, 13, 13, 18884, 4818, 353, 626, 12094, 29889, 657, 29918, 5064, 580, 13, 18884, 626, 12094, 29889, 21652, 6278, 5064, 29897, 13, 18884, 4236, 29934, 353, 313, 9302, 29889, 294, 2378, 29898, 1280, 29882, 29889, 1765, 1575, 29897, 1068, 29906, 467, 2083, 29898, 8990, 29922, 29896, 467, 3317, 580, 1068, 29898, 29896, 29914, 29906, 29897, 13, 18884, 396, 591, 1476, 13931, 491, 313, 29906, 29930, 3317, 29934, 29897, 756, 1900, 13751, 7604, 4371, 2582, 13, 18884, 626, 12094, 29889, 7052, 29898, 29896, 14571, 29906, 29930, 3317, 29934, 876, 13, 18884, 1722, 29941, 29881, 29889, 601, 29889, 3539, 29918, 26701, 29918, 4467, 29882, 29898, 449, 29918, 1445, 29918, 978, 29892, 626, 12094, 29897, 13, 18884, 3497, 5396, 8231, 24210, 29898, 449, 29918, 1445, 29918, 978, 29889, 6506, 12839, 5415, 742, 525, 2824, 6506, 29898, 4632, 29918, 3972, 29892, 27255, 718, 11297, 29876, 1495, 13, 18884, 1596, 29898, 449, 29918, 1445, 29918, 978, 29897, 13, 2 ]
Editor/Resources/CloudFormation/scenario2_single_fleet/tests/test.py
aws/amazon-gamelift-plugin-unity
37
73122
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import boto3 import requests import json import time GAME_NAME = '<REPLACE_WITH_YOUR_GAME_NAME>' REGION = '<REPLACE_WITH_YOUR_REGION>' USER_POOL_NAME = GAME_NAME + 'UserPool' USER_POOL_CLIENT_NAME = GAME_NAME + 'UserPoolClient' USERNAME = '<EMAIL>' PASSWORD = '<PASSWORD>.' REST_API_NAME = GAME_NAME + 'RestApi' REST_API_STAGE = 'v1' GAME_REQUEST_PATH = 'start_game' RESULTS_REQUEST_PATH = 'get_game_connection' cognito_idp = boto3.client('cognito-idp', region_name=REGION) apig = boto3.client('apigateway', region_name=REGION) REGION_TO_LATENCY_MAPPING = { "regionToLatencyMapping": { "us-west-2": 50, "us-east-1": 100, "eu-west-1": 150, "ap-northeast-1": 300 } } GAME_REQUEST_PAYLOAD = json.dumps(REGION_TO_LATENCY_MAPPING) def main(): user_pool = find_user_pool(USER_POOL_NAME) user_pool_id = user_pool['Id'] print("User Pool Id:", user_pool_id) user_pool_client = find_user_pool_client(user_pool_id, USER_POOL_CLIENT_NAME) user_pool_client_id = user_pool_client['ClientId'] print("User Pool Client Id:", user_pool_client_id) try: cognito_idp.sign_up( ClientId=user_pool_client_id, Username=USERNAME, Password=PASSWORD, ) print("Created user:", USERNAME) cognito_idp.admin_confirm_sign_up( UserPoolId=user_pool_id, Username=USERNAME, ) init_auth_result = cognito_idp.initiate_auth( AuthFlow='USER_PASSWORD_AUTH', AuthParameters={ 'USERNAME': USERNAME, 'PASSWORD': PASSWORD, }, ClientId=user_pool_client_id ) assert init_auth_result['ResponseMetadata']['HTTPStatusCode'] == 200, "Unsuccessful init_auth" print("Authenticated via username and password") id_token = init_auth_result['AuthenticationResult']['IdToken'] headers = { 'Auth': id_token } results_request_url = get_rest_api_endpoint(REST_API_NAME, REGION, REST_API_STAGE, RESULTS_REQUEST_PATH) game_request_url = get_rest_api_endpoint(REST_API_NAME, REGION, REST_API_STAGE, GAME_REQUEST_PATH) results_request_response = requests.post(url=results_request_url, headers=headers) assert results_request_response.status_code == 204 or results_request_response.status_code == 200, \ "Expect 'POST /get_game_info' status code to be 200 (Success) or 204 (No Content). Actual: " \ f"{str(results_request_response.status_code)}" print("Verified mock ResultsRequest response", results_request_response) game_request_response = requests.post(url=game_request_url, headers=headers, data=GAME_REQUEST_PAYLOAD) assert game_request_response.status_code == 202, "Expect 'POST /start_game' status code to be 202 (Accepted)/ Actual: " \ f"{str(results_request_response.status_code)}" print("Verified lambda GameRequest response", game_request_response) print("Waiting for game session to be created...") time.sleep(10) results_request_response = requests.post(url=results_request_url, headers=headers) assert results_request_response.status_code == 200, "Expect 'POST /get_game_info' status code to be 200 (Success). Actual: " \ f"{str(results_request_response.status_code)}" print("Verified lambda ResultsRequest response", results_request_response) game_connection_info = json.loads(results_request_response.content) print(f"Received game connection info: {game_connection_info}") assert game_connection_info['IpAddress'] != '' assert game_connection_info['Port'] > 0 assert "us-west-2" in game_connection_info['DnsName'], \ f"Expect {game_connection_info['DnsName']} to contain 'us-west-2'" assert "psess-" in game_connection_info['PlayerSessionId'], \ f"Expect {game_connection_info['PlayerSessionId']} to contain 'psess-'" assert "us-west-2" in game_connection_info['GameSessionArn'], \ f"Expect {game_connection_info['GameSessionArn']} to contain 'us-west-2'" print("Verified game connection info:", game_connection_info) finally: cognito_idp.admin_delete_user( UserPoolId=user_pool_id, Username=USERNAME, ) print("Deleted user:", USERNAME) print("Test Succeeded!") def find_user_pool(user_pool_name): print("Finding user pool:", user_pool_name) result = cognito_idp.list_user_pools(MaxResults=50) pools = result['UserPools'] return next(x for x in pools if x['Name'] == user_pool_name) def find_user_pool_client(user_pool_id, user_pool_client_name): print("Finding user pool client:", user_pool_client_name) results = cognito_idp.list_user_pool_clients(UserPoolId=user_pool_id) clients = results['UserPoolClients'] return next(x for x in clients if x['ClientName'] == user_pool_client_name) def find_rest_api(rest_api_name): print("Finding rest api:", rest_api_name) results = apig.get_rest_apis() rest_apis = results['items'] return next(x for x in rest_apis if x['name'] == rest_api_name) def get_rest_api_endpoint(rest_api_name, region, stage, path): print("Getting rest api endpoint", rest_api_name) rest_api = find_rest_api(rest_api_name) rest_api_id = rest_api['id'] return f'https://{rest_api_id}.execute-api.{region}.amazonaws.com/{stage}/{path}' if __name__ == '__main__': main()
[ 1, 396, 14187, 1266, 16631, 29889, 510, 29892, 9266, 29889, 470, 967, 23736, 1078, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 10937, 29928, 29990, 29899, 29931, 293, 1947, 29899, 12889, 29901, 341, 1806, 29899, 29900, 13, 13, 5215, 289, 3747, 29941, 13, 5215, 7274, 13, 5215, 4390, 13, 5215, 931, 13, 13, 12739, 2303, 29918, 5813, 353, 12801, 1525, 7390, 11538, 29918, 29956, 13054, 29918, 29979, 22970, 29918, 12739, 2303, 29918, 5813, 16299, 13, 18166, 2725, 353, 12801, 1525, 7390, 11538, 29918, 29956, 13054, 29918, 29979, 22970, 29918, 18166, 2725, 16299, 13, 13, 11889, 29918, 13152, 5607, 29918, 5813, 353, 402, 25797, 29918, 5813, 718, 525, 2659, 11426, 29915, 13, 11889, 29918, 13152, 5607, 29918, 27205, 3919, 29918, 5813, 353, 402, 25797, 29918, 5813, 718, 525, 2659, 11426, 4032, 29915, 13, 11889, 5813, 353, 12801, 26862, 6227, 16299, 13, 25711, 17013, 353, 12801, 25711, 17013, 29958, 6169, 13, 1525, 1254, 29918, 8787, 29918, 5813, 353, 402, 25797, 29918, 5813, 718, 525, 15078, 11713, 29915, 13, 1525, 1254, 29918, 8787, 29918, 1254, 10461, 353, 525, 29894, 29896, 29915, 13, 12739, 2303, 29918, 16244, 29918, 10145, 353, 525, 2962, 29918, 11802, 29915, 13, 15989, 8647, 29903, 29918, 16244, 29918, 10145, 353, 525, 657, 29918, 11802, 29918, 9965, 29915, 13, 29883, 3811, 2049, 29918, 333, 29886, 353, 289, 3747, 29941, 29889, 4645, 877, 29883, 3811, 2049, 29899, 333, 29886, 742, 5120, 29918, 978, 29922, 18166, 2725, 29897, 13, 481, 335, 353, 289, 3747, 29941, 29889, 4645, 877, 481, 335, 403, 1582, 742, 5120, 29918, 978, 29922, 18166, 2725, 29897, 13, 18166, 2725, 29918, 4986, 29918, 29931, 1299, 1430, 29907, 29979, 29918, 1529, 18009, 4214, 353, 426, 13, 1678, 376, 12803, 1762, 29931, 2579, 1270, 15845, 1115, 426, 13, 4706, 376, 375, 29899, 5933, 29899, 29906, 1115, 29871, 29945, 29900, 29892, 13, 4706, 376, 375, 29899, 23027, 29899, 29896, 1115, 29871, 29896, 29900, 29900, 29892, 13, 4706, 376, 12932, 29899, 5933, 29899, 29896, 1115, 29871, 29896, 29945, 29900, 29892, 13, 4706, 376, 481, 29899, 29876, 27374, 29899, 29896, 1115, 29871, 29941, 29900, 29900, 13, 1678, 500, 13, 29913, 13, 12739, 2303, 29918, 16244, 29918, 7228, 29979, 29428, 353, 4390, 29889, 29881, 17204, 29898, 18166, 2725, 29918, 4986, 29918, 29931, 1299, 1430, 29907, 29979, 29918, 1529, 18009, 4214, 29897, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 1404, 29918, 10109, 353, 1284, 29918, 1792, 29918, 10109, 29898, 11889, 29918, 13152, 5607, 29918, 5813, 29897, 13, 1678, 1404, 29918, 10109, 29918, 333, 353, 1404, 29918, 10109, 1839, 1204, 2033, 13, 1678, 1596, 703, 2659, 28625, 5163, 29901, 613, 1404, 29918, 10109, 29918, 333, 29897, 13, 13, 1678, 1404, 29918, 10109, 29918, 4645, 353, 1284, 29918, 1792, 29918, 10109, 29918, 4645, 29898, 1792, 29918, 10109, 29918, 333, 29892, 3148, 1001, 29918, 13152, 5607, 29918, 27205, 3919, 29918, 5813, 29897, 13, 1678, 1404, 29918, 10109, 29918, 4645, 29918, 333, 353, 1404, 29918, 10109, 29918, 4645, 1839, 4032, 1204, 2033, 13, 1678, 1596, 703, 2659, 28625, 12477, 5163, 29901, 613, 1404, 29918, 10109, 29918, 4645, 29918, 333, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 25323, 2049, 29918, 333, 29886, 29889, 4530, 29918, 786, 29898, 13, 9651, 12477, 1204, 29922, 1792, 29918, 10109, 29918, 4645, 29918, 333, 29892, 13, 9651, 4911, 978, 29922, 11889, 5813, 29892, 13, 9651, 25280, 29922, 25711, 17013, 29892, 13, 4706, 1723, 13, 13, 4706, 1596, 703, 20399, 1404, 29901, 613, 3148, 1001, 5813, 29897, 13, 13, 4706, 25323, 2049, 29918, 333, 29886, 29889, 6406, 29918, 26897, 29918, 4530, 29918, 786, 29898, 13, 9651, 4911, 11426, 1204, 29922, 1792, 29918, 10109, 29918, 333, 29892, 13, 9651, 4911, 978, 29922, 11889, 5813, 29892, 13, 4706, 1723, 13, 13, 4706, 2069, 29918, 5150, 29918, 2914, 353, 25323, 2049, 29918, 333, 29886, 29889, 2344, 29347, 29918, 5150, 29898, 13, 9651, 13189, 17907, 2433, 11889, 29918, 25711, 17013, 29918, 20656, 29950, 742, 13, 9651, 13189, 11507, 3790, 13, 18884, 525, 11889, 5813, 2396, 3148, 1001, 5813, 29892, 13, 18884, 525, 25711, 17013, 2396, 17687, 1799, 17013, 29892, 13, 9651, 2981, 13, 9651, 12477, 1204, 29922, 1792, 29918, 10109, 29918, 4645, 29918, 333, 13, 4706, 1723, 13, 13, 4706, 4974, 2069, 29918, 5150, 29918, 2914, 1839, 5103, 18417, 16215, 10493, 5709, 3399, 2033, 1275, 29871, 29906, 29900, 29900, 29892, 376, 25807, 29884, 1676, 1319, 2069, 29918, 5150, 29908, 13, 4706, 1596, 703, 6444, 4173, 630, 3025, 8952, 322, 4800, 1159, 13, 13, 4706, 1178, 29918, 6979, 353, 2069, 29918, 5150, 29918, 2914, 1839, 16746, 3591, 16215, 1204, 6066, 2033, 13, 4706, 9066, 353, 426, 13, 9651, 525, 6444, 2396, 1178, 29918, 6979, 13, 4706, 500, 13, 4706, 2582, 29918, 3827, 29918, 2271, 353, 679, 29918, 5060, 29918, 2754, 29918, 29734, 29898, 1525, 1254, 29918, 8787, 29918, 5813, 29892, 5195, 29954, 2725, 29892, 16759, 29918, 8787, 29918, 1254, 10461, 29892, 390, 2890, 8647, 29903, 29918, 16244, 29918, 10145, 29897, 13, 4706, 3748, 29918, 3827, 29918, 2271, 353, 679, 29918, 5060, 29918, 2754, 29918, 29734, 29898, 1525, 1254, 29918, 8787, 29918, 5813, 29892, 5195, 29954, 2725, 29892, 16759, 29918, 8787, 29918, 1254, 10461, 29892, 402, 25797, 29918, 16244, 29918, 10145, 29897, 13, 13, 4706, 2582, 29918, 3827, 29918, 5327, 353, 7274, 29889, 2490, 29898, 2271, 29922, 9902, 29918, 3827, 29918, 2271, 29892, 9066, 29922, 13662, 29897, 13, 4706, 4974, 2582, 29918, 3827, 29918, 5327, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 470, 2582, 29918, 3827, 29918, 5327, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29892, 320, 13, 9651, 376, 1252, 1103, 525, 5438, 847, 657, 29918, 11802, 29918, 3888, 29915, 4660, 775, 304, 367, 29871, 29906, 29900, 29900, 313, 14191, 29897, 470, 29871, 29906, 29900, 29946, 313, 3782, 10576, 467, 3185, 950, 29901, 376, 320, 13, 9651, 285, 29908, 29912, 710, 29898, 9902, 29918, 3827, 29918, 5327, 29889, 4882, 29918, 401, 2915, 29908, 13, 4706, 1596, 703, 6565, 2164, 11187, 17212, 3089, 2933, 613, 2582, 29918, 3827, 29918, 5327, 29897, 13, 13, 4706, 3748, 29918, 3827, 29918, 5327, 353, 7274, 29889, 2490, 29898, 2271, 29922, 11802, 29918, 3827, 29918, 2271, 29892, 9066, 29922, 13662, 29892, 848, 29922, 12739, 2303, 29918, 16244, 29918, 7228, 29979, 29428, 29897, 13, 4706, 4974, 3748, 29918, 3827, 29918, 5327, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29906, 29892, 376, 1252, 1103, 525, 5438, 847, 2962, 29918, 11802, 29915, 4660, 775, 304, 367, 29871, 29906, 29900, 29906, 313, 23965, 287, 6802, 3185, 950, 29901, 376, 320, 13, 9651, 285, 29908, 29912, 710, 29898, 9902, 29918, 3827, 29918, 5327, 29889, 4882, 29918, 401, 2915, 29908, 13, 4706, 1596, 703, 6565, 2164, 14013, 8448, 3089, 2933, 613, 3748, 29918, 3827, 29918, 5327, 29897, 13, 13, 4706, 1596, 703, 15716, 292, 363, 3748, 4867, 304, 367, 2825, 856, 1159, 13, 4706, 931, 29889, 17059, 29898, 29896, 29900, 29897, 13, 13, 4706, 2582, 29918, 3827, 29918, 5327, 353, 7274, 29889, 2490, 29898, 2271, 29922, 9902, 29918, 3827, 29918, 2271, 29892, 9066, 29922, 13662, 29897, 13, 4706, 4974, 2582, 29918, 3827, 29918, 5327, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29892, 376, 1252, 1103, 525, 5438, 847, 657, 29918, 11802, 29918, 3888, 29915, 4660, 775, 304, 367, 29871, 29906, 29900, 29900, 313, 14191, 467, 3185, 950, 29901, 376, 320, 13, 9651, 285, 29908, 29912, 710, 29898, 9902, 29918, 3827, 29918, 5327, 29889, 4882, 29918, 401, 2915, 29908, 13, 4706, 1596, 703, 6565, 2164, 14013, 17212, 3089, 2933, 613, 2582, 29918, 3827, 29918, 5327, 29897, 13, 13, 4706, 3748, 29918, 9965, 29918, 3888, 353, 4390, 29889, 18132, 29898, 9902, 29918, 3827, 29918, 5327, 29889, 3051, 29897, 13, 4706, 1596, 29898, 29888, 29908, 29816, 3748, 3957, 5235, 29901, 426, 11802, 29918, 9965, 29918, 3888, 27195, 13, 4706, 4974, 3748, 29918, 9965, 29918, 3888, 1839, 29902, 29886, 7061, 2033, 2804, 6629, 13, 4706, 4974, 3748, 29918, 9965, 29918, 3888, 1839, 2290, 2033, 1405, 29871, 29900, 13, 4706, 4974, 376, 375, 29899, 5933, 29899, 29906, 29908, 297, 3748, 29918, 9965, 29918, 3888, 1839, 29928, 1983, 1170, 7464, 320, 13, 9651, 285, 29908, 1252, 1103, 426, 11802, 29918, 9965, 29918, 3888, 1839, 29928, 1983, 1170, 2033, 29913, 304, 1712, 525, 375, 29899, 5933, 29899, 29906, 11838, 13, 4706, 4974, 376, 567, 404, 29899, 29908, 297, 3748, 29918, 9965, 29918, 3888, 1839, 9075, 7317, 1204, 7464, 320, 13, 9651, 285, 29908, 1252, 1103, 426, 11802, 29918, 9965, 29918, 3888, 1839, 9075, 7317, 1204, 2033, 29913, 304, 1712, 525, 567, 404, 29899, 11838, 13, 4706, 4974, 376, 375, 29899, 5933, 29899, 29906, 29908, 297, 3748, 29918, 9965, 29918, 3888, 1839, 14199, 7317, 1433, 29876, 7464, 320, 13, 9651, 285, 29908, 1252, 1103, 426, 11802, 29918, 9965, 29918, 3888, 1839, 14199, 7317, 1433, 29876, 2033, 29913, 304, 1712, 525, 375, 29899, 5933, 29899, 29906, 11838, 13, 4706, 1596, 703, 6565, 2164, 3748, 3957, 5235, 29901, 613, 3748, 29918, 9965, 29918, 3888, 29897, 13, 13, 1678, 7146, 29901, 13, 4706, 25323, 2049, 29918, 333, 29886, 29889, 6406, 29918, 8143, 29918, 1792, 29898, 13, 9651, 4911, 11426, 1204, 29922, 1792, 29918, 10109, 29918, 333, 29892, 13, 9651, 4911, 978, 29922, 11889, 5813, 29892, 13, 4706, 1723, 13, 13, 4706, 1596, 703, 2772, 22742, 1404, 29901, 613, 3148, 1001, 5813, 29897, 13, 13, 4706, 1596, 703, 3057, 317, 1682, 3947, 287, 29991, 1159, 13, 13, 13, 1753, 1284, 29918, 1792, 29918, 10109, 29898, 1792, 29918, 10109, 29918, 978, 1125, 13, 1678, 1596, 703, 29943, 4015, 1404, 11565, 29901, 613, 1404, 29918, 10109, 29918, 978, 29897, 13, 1678, 1121, 353, 25323, 2049, 29918, 333, 29886, 29889, 1761, 29918, 1792, 29918, 1129, 3775, 29898, 7976, 12191, 29922, 29945, 29900, 29897, 13, 1678, 772, 3775, 353, 1121, 1839, 2659, 29925, 8789, 2033, 13, 1678, 736, 2446, 29898, 29916, 363, 921, 297, 772, 3775, 565, 921, 1839, 1170, 2033, 1275, 1404, 29918, 10109, 29918, 978, 29897, 13, 13, 13, 1753, 1284, 29918, 1792, 29918, 10109, 29918, 4645, 29898, 1792, 29918, 10109, 29918, 333, 29892, 1404, 29918, 10109, 29918, 4645, 29918, 978, 1125, 13, 1678, 1596, 703, 29943, 4015, 1404, 11565, 3132, 29901, 613, 1404, 29918, 10109, 29918, 4645, 29918, 978, 29897, 13, 1678, 2582, 353, 25323, 2049, 29918, 333, 29886, 29889, 1761, 29918, 1792, 29918, 10109, 29918, 11303, 1237, 29898, 2659, 11426, 1204, 29922, 1792, 29918, 10109, 29918, 333, 29897, 13, 1678, 13154, 353, 2582, 1839, 2659, 11426, 29907, 492, 1237, 2033, 13, 1678, 736, 2446, 29898, 29916, 363, 921, 297, 13154, 565, 921, 1839, 4032, 1170, 2033, 1275, 1404, 29918, 10109, 29918, 4645, 29918, 978, 29897, 13, 13, 13, 1753, 1284, 29918, 5060, 29918, 2754, 29898, 5060, 29918, 2754, 29918, 978, 1125, 13, 1678, 1596, 703, 29943, 4015, 1791, 7882, 29901, 613, 1791, 29918, 2754, 29918, 978, 29897, 13, 1678, 2582, 353, 3095, 335, 29889, 657, 29918, 5060, 29918, 11355, 580, 13, 1678, 1791, 29918, 11355, 353, 2582, 1839, 7076, 2033, 13, 1678, 736, 2446, 29898, 29916, 363, 921, 297, 1791, 29918, 11355, 565, 921, 1839, 978, 2033, 1275, 1791, 29918, 2754, 29918, 978, 29897, 13, 13, 13, 1753, 679, 29918, 5060, 29918, 2754, 29918, 29734, 29898, 5060, 29918, 2754, 29918, 978, 29892, 5120, 29892, 7408, 29892, 2224, 1125, 13, 1678, 1596, 703, 2577, 1259, 1791, 7882, 16248, 613, 1791, 29918, 2754, 29918, 978, 29897, 13, 1678, 1791, 29918, 2754, 353, 1284, 29918, 5060, 29918, 2754, 29898, 5060, 29918, 2754, 29918, 978, 29897, 13, 1678, 1791, 29918, 2754, 29918, 333, 353, 1791, 29918, 2754, 1839, 333, 2033, 13, 1678, 736, 285, 29915, 991, 597, 29912, 5060, 29918, 2754, 29918, 333, 1836, 7978, 29899, 2754, 29889, 29912, 12803, 1836, 17260, 10467, 29889, 510, 19248, 19190, 6822, 29912, 2084, 10162, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
day01/python/beckel/solution.py
clssn/aoc-2019
22
14355
import math def fuel_needed(mass): return math.floor(int(mass)/3 - 2) def fuel_needed_recursive(mass): fuel_needed_i = fuel_needed(mass) if (fuel_needed_i <= 0): return 0 return fuel_needed_i + fuel_needed_recursive(fuel_needed_i) total_fuel = 0 total_fuel_recursive = 0 with open("input.txt", "r") as fp: for line in fp: total_fuel += fuel_needed(line) total_fuel_recursive += fuel_needed_recursive(line) print("Total fuel: " + str(total_fuel)) print("Total fuel recursive: " + str(total_fuel_recursive))
[ 1, 1053, 5844, 13, 13, 1753, 26413, 29918, 484, 19226, 29898, 25379, 1125, 13, 1678, 736, 5844, 29889, 14939, 29898, 524, 29898, 25379, 6802, 29941, 448, 29871, 29906, 29897, 13, 13, 1753, 26413, 29918, 484, 19226, 29918, 3757, 25397, 29898, 25379, 1125, 13, 1678, 26413, 29918, 484, 19226, 29918, 29875, 353, 26413, 29918, 484, 19226, 29898, 25379, 29897, 13, 1678, 565, 313, 29888, 2491, 29918, 484, 19226, 29918, 29875, 5277, 29871, 29900, 1125, 13, 4706, 736, 29871, 29900, 13, 1678, 736, 26413, 29918, 484, 19226, 29918, 29875, 718, 26413, 29918, 484, 19226, 29918, 3757, 25397, 29898, 29888, 2491, 29918, 484, 19226, 29918, 29875, 29897, 13, 13, 7827, 29918, 29888, 2491, 353, 29871, 29900, 13, 7827, 29918, 29888, 2491, 29918, 3757, 25397, 353, 29871, 29900, 13, 13, 2541, 1722, 703, 2080, 29889, 3945, 613, 376, 29878, 1159, 408, 285, 29886, 29901, 13, 1678, 363, 1196, 297, 285, 29886, 29901, 13, 4706, 3001, 29918, 29888, 2491, 4619, 26413, 29918, 484, 19226, 29898, 1220, 29897, 13, 4706, 3001, 29918, 29888, 2491, 29918, 3757, 25397, 4619, 26413, 29918, 484, 19226, 29918, 3757, 25397, 29898, 1220, 29897, 13, 13, 2158, 703, 11536, 26413, 29901, 376, 718, 851, 29898, 7827, 29918, 29888, 2491, 876, 13, 2158, 703, 11536, 26413, 16732, 29901, 376, 718, 851, 29898, 7827, 29918, 29888, 2491, 29918, 3757, 25397, 876, 13, 2 ]
analyses_and_ml/nlp_utils.py
aashish-jain/Social-unrest-prediction
8
62418
import warnings import numpy as np from tabulate import tabulate from collections import Counter from sklearn.ensemble import ExtraTreesClassifier from sklearn.metrics import precision_score, recall_score, f1_score from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer def get_sentiment(documents, document_ids): """ Input - A document_df that basically has documents and their IDs [tweetid/message hash etc] Returns - A dictionary mapping document ID to sentiment from Vader This function is basically as a function that is generic to the documents which at the moment are tweets & news articles. """ # Vader vader = SentimentIntensityAnalyzer() # Create & populating dict mapping document_id # to sentiment dict sentiment_dict = {} for i, document in enumerate(documents): if document_ids[i] not in sentiment_dict: sentiment_dict[document_ids[i]] = vader.polarity_scores(document) return sentiment_dict def make_predictions(location_features_dict, labels, model=None, permute=False, lead_days=2, days_window=5): """ Input - location_features_dict - The dict mapping from location to features labels - Label dict generated from process_acled_csv(..) model - Specific sklearn model to evaluate/benchmark performance permute - Permute the data before train-test split Returns - None """ # Table for presenting on tabulate result_table = [] # Suppress warnings for divide-by-zero error warnings.filterwarnings("ignore") # Compute intersection for locations present on both dicts common_locations = set(location_features_dict.keys()) & set(labels.keys()) # Sorted for clarity common_locations = sorted(list(common_locations)) for common_location in common_locations: # Get data and labels X, y = location_features_dict[common_location], labels[common_location] X, y = np.array(X), np.array(y) # Eliminate last days to match labels.shape X = X[:-(lead_days + days_window)] # Permute randomly if specified if permute: p = np.random.permutation(len(X)) X, y = X[p], y[p] # Split data into train & test - 75% & 25% split = int(0.75 * len(X)) xtrain, ytrain = X[:split], y[:split] xtest, ytest = X[split:], y[split:] # Default model if model is None: model = xgboost.XGBClassifier(n_estimators=200, n_jobs=-1) # Fit the train data model.fit(xtrain, ytrain) # Make predictions ypred = model.predict(xtest) # Compute metrics train_acc = model.score(xtrain, ytrain) test_acc = model.score(xtest, ytest) precision = precision_score(ytest, ypred) recall = recall_score(ytest, ypred) f1 = f1_score(ytest, ypred) # Add row to result_table result_row = [ common_location, np.round(train_acc, 2), np.round(test_acc, 2), np.round(precision, 2), np.round(recall, 2), np.round(f1, 2), np.round(np.sum(y) / len(y), 2) ] result_table.append(result_row) # Average stats # Turns out median is kind of useless result_table_copy = (np.array(result_table)[:, 1:]).astype(np.float32) averages = np.round(np.mean(result_table_copy, axis=0), 2) # Sort by test accuracy result_table = sorted(result_table, key=lambda x: -x[-2]) # Add them to the existing result table result_table.append(["Average"] + averages.tolist()) # Header for table header = ["Location", "Train Accuracy", "Test Accuracy", "Precision", "Recall", "F1 Score", "+'s in data"] # Print tabulated result print(tabulate(result_table, tablefmt="pipe", stralign="center", headers=header)) # Unsuppress warning warnings.filterwarnings("default") return def get_features(date_dict): """ Input: date_dict to compute features for each date Returns: Features for each date """ # Initialize list for features features = [] # Iterate through dates for date in date_dict: feature_row = [] docs = date_dict[date] # If no rows are present, add zero-row if docs is None: feature_row = [0] * 6 else: # Compute features feature_row.append(len(docs)) mean = docs.mean() feature_row.extend( [mean['pos'], mean['neg'], mean['neu'], mean['compound']]) feature_row.append(len(docs[docs['neg'] > 0])) # Add feature_row to above list features.append(feature_row) return features
[ 1, 1053, 18116, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 4434, 5987, 1053, 4434, 5987, 13, 3166, 16250, 1053, 315, 5336, 13, 3166, 2071, 19668, 29889, 24031, 1053, 7338, 336, 29911, 11003, 2385, 3709, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 16716, 29918, 13628, 29892, 17386, 29918, 13628, 29892, 285, 29896, 29918, 13628, 13, 3166, 325, 1664, 29903, 296, 2073, 29889, 29894, 1664, 29903, 296, 2073, 1053, 28048, 2073, 2928, 575, 537, 2744, 14997, 3298, 13, 13, 13, 1753, 679, 29918, 18616, 2073, 29898, 3225, 29879, 29892, 1842, 29918, 4841, 1125, 13, 1678, 9995, 13, 1678, 10567, 448, 319, 1842, 29918, 2176, 393, 8830, 756, 10701, 13, 9651, 322, 1009, 23481, 518, 29873, 16668, 333, 29914, 4906, 6608, 2992, 29962, 13, 1678, 16969, 448, 319, 8600, 10417, 1842, 3553, 304, 19688, 13, 795, 515, 478, 1664, 13, 13, 1678, 910, 740, 338, 8830, 408, 263, 740, 393, 338, 10035, 13, 1678, 304, 278, 10701, 607, 472, 278, 3256, 526, 7780, 1691, 669, 9763, 13, 1678, 7456, 29889, 13, 1678, 9995, 13, 1678, 396, 478, 1664, 13, 1678, 325, 1664, 353, 28048, 2073, 2928, 575, 537, 2744, 14997, 3298, 580, 13, 13, 1678, 396, 6204, 669, 14938, 1218, 9657, 10417, 1842, 29918, 333, 13, 1678, 396, 304, 19688, 9657, 13, 1678, 19688, 29918, 8977, 353, 6571, 13, 13, 1678, 363, 474, 29892, 1842, 297, 26985, 29898, 3225, 29879, 1125, 13, 4706, 565, 1842, 29918, 4841, 29961, 29875, 29962, 451, 297, 19688, 29918, 8977, 29901, 13, 9651, 19688, 29918, 8977, 29961, 3225, 29918, 4841, 29961, 29875, 5262, 353, 325, 1664, 29889, 3733, 279, 537, 29918, 1557, 2361, 29898, 3225, 29897, 13, 13, 1678, 736, 19688, 29918, 8977, 13, 13, 13, 1753, 1207, 29918, 27711, 1080, 29898, 5479, 29918, 22100, 29918, 8977, 29892, 11073, 29892, 1904, 29922, 8516, 29892, 3635, 1082, 29922, 8824, 29892, 3275, 29918, 16700, 29922, 29906, 29892, 3841, 29918, 7165, 29922, 29945, 1125, 13, 1678, 9995, 13, 1678, 10567, 448, 29871, 13, 9651, 4423, 29918, 22100, 29918, 8977, 448, 450, 9657, 10417, 515, 4423, 304, 5680, 13, 9651, 11073, 448, 15796, 9657, 5759, 515, 1889, 29918, 562, 839, 29918, 7638, 29898, 636, 29897, 13, 9651, 1904, 448, 21220, 2071, 19668, 1904, 304, 14707, 29914, 1785, 16580, 4180, 13, 9651, 3635, 1082, 448, 20894, 1082, 278, 848, 1434, 7945, 29899, 1688, 6219, 13, 1678, 16969, 448, 6213, 13, 1678, 9995, 13, 1678, 396, 6137, 363, 2198, 292, 373, 4434, 5987, 13, 1678, 1121, 29918, 2371, 353, 5159, 13, 13, 1678, 396, 9179, 1253, 18116, 363, 16429, 29899, 1609, 29899, 9171, 1059, 13, 1678, 18116, 29889, 4572, 25442, 886, 703, 17281, 1159, 13, 13, 1678, 396, 11796, 29872, 17686, 363, 14354, 2198, 373, 1716, 9657, 29879, 13, 1678, 3619, 29918, 2029, 800, 353, 731, 29898, 5479, 29918, 22100, 29918, 8977, 29889, 8149, 3101, 669, 731, 29898, 21134, 29889, 8149, 3101, 13, 13, 1678, 396, 317, 18054, 363, 7542, 537, 13, 1678, 3619, 29918, 2029, 800, 353, 12705, 29898, 1761, 29898, 9435, 29918, 2029, 800, 876, 13, 13, 1678, 363, 3619, 29918, 5479, 297, 3619, 29918, 2029, 800, 29901, 13, 4706, 396, 3617, 848, 322, 11073, 13, 4706, 1060, 29892, 343, 353, 4423, 29918, 22100, 29918, 8977, 29961, 9435, 29918, 5479, 1402, 11073, 29961, 9435, 29918, 5479, 29962, 13, 4706, 1060, 29892, 343, 353, 7442, 29889, 2378, 29898, 29990, 511, 7442, 29889, 2378, 29898, 29891, 29897, 13, 13, 4706, 396, 1260, 8332, 403, 1833, 3841, 304, 1993, 11073, 29889, 12181, 13, 4706, 1060, 353, 1060, 7503, 17722, 280, 328, 29918, 16700, 718, 3841, 29918, 7165, 4638, 13, 13, 4706, 396, 20894, 1082, 20459, 565, 6790, 13, 4706, 565, 3635, 1082, 29901, 13, 9651, 282, 353, 7442, 29889, 8172, 29889, 546, 6149, 362, 29898, 2435, 29898, 29990, 876, 13, 9651, 1060, 29892, 343, 353, 1060, 29961, 29886, 1402, 343, 29961, 29886, 29962, 13, 13, 4706, 396, 26178, 848, 964, 7945, 669, 1243, 448, 29871, 29955, 29945, 29995, 669, 29871, 29906, 29945, 29995, 13, 4706, 6219, 353, 938, 29898, 29900, 29889, 29955, 29945, 334, 7431, 29898, 29990, 876, 13, 308, 486, 6038, 29892, 343, 14968, 353, 1060, 7503, 5451, 1402, 343, 7503, 5451, 29962, 13, 308, 486, 342, 29892, 343, 1688, 353, 1060, 29961, 5451, 29901, 1402, 343, 29961, 5451, 17531, 13, 13, 4706, 396, 13109, 1904, 13, 4706, 565, 1904, 338, 6213, 29901, 13, 9651, 1904, 353, 921, 29887, 17079, 29889, 29990, 7210, 2385, 3709, 29898, 29876, 29918, 342, 326, 4097, 29922, 29906, 29900, 29900, 29892, 302, 29918, 9057, 29879, 10457, 29896, 29897, 13, 13, 4706, 396, 383, 277, 278, 7945, 848, 13, 4706, 1904, 29889, 9202, 29898, 486, 6038, 29892, 343, 14968, 29897, 13, 13, 4706, 396, 8561, 27303, 13, 4706, 343, 11965, 353, 1904, 29889, 27711, 29898, 486, 342, 29897, 13, 13, 4706, 396, 11796, 29872, 21556, 13, 4706, 7945, 29918, 5753, 353, 1904, 29889, 13628, 29898, 486, 6038, 29892, 343, 14968, 29897, 13, 4706, 1243, 29918, 5753, 353, 1904, 29889, 13628, 29898, 486, 342, 29892, 343, 1688, 29897, 13, 4706, 16716, 353, 16716, 29918, 13628, 29898, 29891, 1688, 29892, 343, 11965, 29897, 13, 4706, 17386, 353, 17386, 29918, 13628, 29898, 29891, 1688, 29892, 343, 11965, 29897, 13, 4706, 285, 29896, 353, 285, 29896, 29918, 13628, 29898, 29891, 1688, 29892, 343, 11965, 29897, 13, 13, 4706, 396, 3462, 1948, 304, 1121, 29918, 2371, 13, 4706, 1121, 29918, 798, 353, 518, 13, 462, 418, 3619, 29918, 5479, 29892, 13, 462, 418, 7442, 29889, 14486, 29898, 14968, 29918, 5753, 29892, 29871, 29906, 511, 7442, 29889, 14486, 29898, 1688, 29918, 5753, 29892, 29871, 29906, 511, 13, 462, 418, 7442, 29889, 14486, 29898, 17990, 2459, 29892, 29871, 29906, 511, 7442, 29889, 14486, 29898, 3757, 497, 29892, 29871, 29906, 511, 13, 462, 418, 7442, 29889, 14486, 29898, 29888, 29896, 29892, 29871, 29906, 511, 7442, 29889, 14486, 29898, 9302, 29889, 2083, 29898, 29891, 29897, 847, 7431, 29898, 29891, 511, 29871, 29906, 29897, 13, 462, 268, 4514, 13, 462, 539, 13, 4706, 1121, 29918, 2371, 29889, 4397, 29898, 2914, 29918, 798, 29897, 13, 13, 1678, 396, 319, 19698, 22663, 13, 1678, 396, 9603, 29879, 714, 19194, 338, 2924, 310, 19315, 13, 1678, 1121, 29918, 2371, 29918, 8552, 353, 313, 9302, 29889, 2378, 29898, 2914, 29918, 2371, 29897, 7503, 29892, 29871, 29896, 29901, 14664, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 4759, 1179, 353, 7442, 29889, 14486, 29898, 9302, 29889, 12676, 29898, 2914, 29918, 2371, 29918, 8552, 29892, 9685, 29922, 29900, 511, 29871, 29906, 29897, 13, 268, 13, 1678, 396, 20025, 491, 1243, 13600, 13, 1678, 1121, 29918, 2371, 353, 12705, 29898, 2914, 29918, 2371, 29892, 1820, 29922, 2892, 921, 29901, 448, 29916, 14352, 29906, 2314, 13, 13, 13, 1678, 396, 3462, 963, 304, 278, 5923, 1121, 1591, 13, 1678, 1121, 29918, 2371, 29889, 4397, 29898, 3366, 29909, 19698, 3108, 718, 4759, 1179, 29889, 25027, 391, 3101, 13, 13, 1678, 396, 19345, 363, 1591, 13, 1678, 4839, 353, 6796, 6508, 613, 376, 5323, 262, 4831, 332, 4135, 613, 376, 3057, 4831, 332, 4135, 613, 13, 795, 376, 29925, 3757, 2459, 613, 376, 4789, 497, 613, 376, 29943, 29896, 2522, 487, 613, 15691, 29915, 29879, 297, 848, 3108, 13, 268, 13, 1678, 396, 13905, 4434, 7964, 1121, 13, 1678, 1596, 29898, 3891, 5987, 29898, 2914, 29918, 2371, 29892, 29871, 13, 462, 259, 1591, 23479, 543, 17760, 613, 29871, 13, 462, 259, 851, 2520, 543, 5064, 613, 29871, 13, 462, 259, 9066, 29922, 6672, 876, 13, 268, 13, 1678, 396, 853, 19303, 1253, 9177, 13, 1678, 18116, 29889, 4572, 25442, 886, 703, 4381, 1159, 13, 1678, 736, 13, 13, 1753, 679, 29918, 22100, 29898, 1256, 29918, 8977, 1125, 13, 1678, 9995, 13, 1678, 10567, 29901, 2635, 29918, 8977, 304, 10272, 5680, 363, 1269, 2635, 13, 1678, 16969, 29901, 5169, 3698, 363, 1269, 2635, 13, 1678, 9995, 13, 1678, 396, 25455, 1051, 363, 5680, 13, 1678, 5680, 353, 5159, 13, 13, 1678, 396, 20504, 403, 1549, 10116, 13, 1678, 363, 2635, 297, 2635, 29918, 8977, 29901, 13, 4706, 4682, 29918, 798, 353, 5159, 13, 4706, 10561, 353, 2635, 29918, 8977, 29961, 1256, 29962, 13, 13, 4706, 396, 960, 694, 4206, 526, 2198, 29892, 788, 5225, 29899, 798, 13, 4706, 565, 10561, 338, 6213, 29901, 13, 9651, 4682, 29918, 798, 353, 518, 29900, 29962, 334, 29871, 29953, 13, 4706, 1683, 29901, 13, 9651, 396, 11796, 29872, 5680, 13, 9651, 4682, 29918, 798, 29889, 4397, 29898, 2435, 29898, 2640, 876, 13, 9651, 2099, 353, 10561, 29889, 12676, 580, 13, 13, 9651, 4682, 29918, 798, 29889, 21843, 29898, 13, 18884, 518, 12676, 1839, 1066, 7464, 2099, 1839, 10052, 7464, 2099, 1839, 484, 29884, 7464, 2099, 1839, 2388, 618, 2033, 2314, 13, 9651, 4682, 29918, 798, 29889, 4397, 29898, 2435, 29898, 2640, 29961, 2640, 1839, 10052, 2033, 1405, 29871, 29900, 12622, 13, 13, 4706, 396, 3462, 4682, 29918, 798, 304, 2038, 1051, 13, 4706, 5680, 29889, 4397, 29898, 14394, 29918, 798, 29897, 13, 1678, 736, 5680, 13, 2 ]
src/compas_convert/native.py
tetov/compas_convert
2
127137
<reponame>tetov/compas_convert from __future__ import absolute_import from __future__ import division from __future__ import print_function import compas.data from compas_convert import register_converter @register_converter([str], compas.data.Data) def json_str_to_compas_obj(json_str): # type: (str) -> compas.data.Data """Convert JSON string to object based on :class:`compas.data.Data`.""" return compas.data.json_loads(json_str) def compas_obj_to_json_str(obj, pretty=False): # type: (compas.Base, bool) -> str """Convert object based on :class:`compas.data.Data` to JSON string. Just use the native function instead. """ return compas.data.json_dumps(obj, pretty=pretty)
[ 1, 529, 276, 1112, 420, 29958, 29873, 300, 586, 29914, 2388, 294, 29918, 13441, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 752, 294, 29889, 1272, 13, 13, 3166, 752, 294, 29918, 13441, 1053, 6036, 29918, 535, 13549, 13, 13, 13, 29992, 9573, 29918, 535, 13549, 4197, 710, 1402, 752, 294, 29889, 1272, 29889, 1469, 29897, 13, 1753, 4390, 29918, 710, 29918, 517, 29918, 2388, 294, 29918, 5415, 29898, 3126, 29918, 710, 1125, 29871, 396, 1134, 29901, 313, 710, 29897, 1599, 752, 294, 29889, 1272, 29889, 1469, 13, 1678, 9995, 18455, 4663, 1347, 304, 1203, 2729, 373, 584, 1990, 18078, 2388, 294, 29889, 1272, 29889, 1469, 29952, 1213, 15945, 13, 1678, 736, 752, 294, 29889, 1272, 29889, 3126, 29918, 18132, 29898, 3126, 29918, 710, 29897, 13, 13, 13, 1753, 752, 294, 29918, 5415, 29918, 517, 29918, 3126, 29918, 710, 29898, 5415, 29892, 5051, 29922, 8824, 1125, 29871, 396, 1134, 29901, 313, 2388, 294, 29889, 5160, 29892, 6120, 29897, 1599, 851, 13, 1678, 9995, 18455, 1203, 2729, 373, 584, 1990, 18078, 2388, 294, 29889, 1272, 29889, 1469, 29952, 304, 4663, 1347, 29889, 13, 13, 1678, 3387, 671, 278, 7531, 740, 2012, 29889, 13, 1678, 9995, 13, 1678, 736, 752, 294, 29889, 1272, 29889, 3126, 29918, 29881, 17204, 29898, 5415, 29892, 5051, 29922, 1457, 4349, 29897, 13, 2 ]
vb2py/test_at_scale/testheinsega.py
ceprio/xl_vb2py
0
39888
import unittest from vb2py.test_at_scale import file_tester class Test_heinsega(file_tester.FileTester): def test0(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/Module1.bas') def test1(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/start.frm') def test2(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/ShutDownWin.frm') def test3(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/password_win.frm') def test4(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX_CookiesCtrl.bas') def test5(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/Parsing.bas') def test6(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/BrowserW.frm') def test7(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX_manifest.bas') def test8(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/Declare_Function.bas') def test9(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX_function.bas') def test10(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX_FileSystem.bas') def test11(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/Transcoding.bas') def test12(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/History_Logs.frm') def test13(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/script_from.frm') def test14(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/CMDresult.bas') def test15(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/variable.bas') def test16(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX_MouseWheel.bas') def test17(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX_Finish_Download.frm') def test18(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/Ctrl8dot3name.frm') def test19(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/ComDialog.frm') def test20(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/sys.frm') def test21(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX_163_Module.bas') def test22(self): self._testFile('/Users/paul/Workspace/sandbox/vb2py-git-files/heinsega/OX163_VB6project_Win32/OX163_mainfrm.frm') if __name__ == '__main__': unittest.main()
[ 1, 29871, 13, 5215, 443, 27958, 13, 3166, 16822, 29906, 2272, 29889, 1688, 29918, 271, 29918, 7052, 1053, 934, 29918, 1688, 261, 13, 13, 13, 1990, 4321, 29918, 12880, 344, 3249, 29898, 1445, 29918, 1688, 261, 29889, 2283, 3057, 261, 1125, 13, 13, 12, 1753, 1243, 29900, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 7355, 29896, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29896, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 2962, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29906, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 2713, 329, 6767, 17734, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29941, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 5630, 29918, 5080, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29946, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29918, 19159, 583, 18069, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29945, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29925, 1503, 292, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29953, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 21537, 29956, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29955, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29918, 29135, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29947, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 6185, 8663, 29918, 6678, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29929, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29918, 2220, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29896, 29900, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29918, 2283, 3924, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29896, 29896, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 4300, 29883, 3689, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29896, 29906, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 20570, 29918, 3403, 29879, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29896, 29941, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 2154, 29918, 3166, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29896, 29946, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29907, 5773, 2914, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29896, 29945, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 11918, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29896, 29953, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29918, 14346, 29956, 10552, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29896, 29955, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29918, 12881, 728, 29918, 22954, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29896, 29947, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 18069, 29947, 6333, 29941, 978, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29896, 29929, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 1523, 7647, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29906, 29900, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 9675, 29889, 1341, 29885, 1495, 13, 13, 12, 1753, 1243, 29906, 29896, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29918, 29896, 29953, 29941, 29918, 7355, 29889, 6500, 1495, 13, 13, 12, 1753, 1243, 29906, 29906, 29898, 1311, 1125, 13, 12, 12, 1311, 3032, 1688, 2283, 11219, 5959, 29914, 3274, 352, 29914, 5531, 3493, 29914, 29879, 26738, 29914, 24666, 29906, 2272, 29899, 5559, 29899, 5325, 29914, 12880, 344, 3249, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 24281, 29953, 4836, 29918, 17734, 29941, 29906, 29914, 29949, 29990, 29896, 29953, 29941, 29918, 3396, 1341, 29885, 29889, 1341, 29885, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 12, 348, 27958, 29889, 3396, 580, 13, 2 ]
qdev_wrappers/customised_instruments/AlazarTech_ATS9360_ext.py
Dominik-Vogel/qdev-wrappers
0
79240
<gh_stars>0 from qcodes.instrument_drivers.AlazarTech.ATS9360 import AlazarTech_ATS9360 from qdev_wrappers.alazar_controllers.ATS9360Controller import ATS9360Controller from qcodes.utils import validators as vals class ATS9360Controller_ext(ATS9360Controller): def __init__(self, name, alazar, ctrl_type='ave'): if ctrl_type is 'samp': integrate_samples = False average_records = True elif ctrl_type is 'ave': integrate_samples = True average_records = True elif ctrl_type is 'rec': integrate_samples = True average_records = False else: raise Exception('acquisition controller type must be in {}, ' 'received: {}'.format(['samp', 'ave', 'rec'], ctrl_type)) super().__init__(name=name, alazar_name=alazar.name, integrate_samples=integrate_samples, average_records=average_records) class AlazarTech_ATS9360_ext(AlazarTech_ATS9360): def __init__(self, name, seq_mode='off'): if seq_mode is 'on': io_mode = 'AUX_IN_TRIGGER_ENABLE' io_param = 'TRIG_SLOPE_POSITIVE' elif seq_mode is 'off': io_mode = 'AUX_IN_AUXILIARY' io_param = 'NONE' else: raise ValueError('must set seq mode to "on" or ' '"off", received {}'.format(seq_mode)) super().__init__(name=name) self.config(clock_source='EXTERNAL_CLOCK_10MHz_REF', #sample_rate=500_000_000, external_sample_rate=500_000_000, clock_edge='CLOCK_EDGE_RISING', decimation=1, coupling=['DC', 'DC'], channel_range=[.4, .4], impedance=[50, 50], trigger_operation='TRIG_ENGINE_OP_J', trigger_engine1='TRIG_ENGINE_J', trigger_source1='EXTERNAL', trigger_slope1='TRIG_SLOPE_POSITIVE', trigger_level1=140, trigger_engine2='TRIG_ENGINE_K', trigger_source2='DISABLE', trigger_slope2='TRIG_SLOPE_POSITIVE', trigger_level2=128, external_trigger_coupling='DC', external_trigger_range='ETR_2V5', trigger_delay=0, timeout_ticks=0, aux_io_mode=io_mode, aux_io_param=io_param ) self.add_parameter(name='seq_mode', get_cmd=self._get_seq_mod, set_cmd=self._set_seq_mode, vals=vals.Anything() ) def _get_seq_mod(self): if (self.aux_io_mode() is 'AUX_IN_TRIGGER_ENABLE' and self.aux_io_param() is 'TRIG_SLOPE_POSITIVE'): return 'on' elif (self.aux_io_mode() is 'AUX_IN_AUXILIARY' and self.aux_io_param() is 'NONE'): return 'off' else: raise ValueError('aux_io_mode: {}, aux_io_param: {} ' 'do not correspond to seq_mode on or off') def _set_seq_mode(self, mode): if mode is 'on': self.config(sample_rate=self.sample_rate(), clock_edge=self.clock_edge(), clock_source=self.clock_source(), aux_io_mode='AUX_IN_TRIGGER_ENABLE', aux_io_param='TRIG_SLOPE_POSITIVE') elif mode is 'off': self.config(sample_rate=self.sample_rate(), clock_edge=self.clock_edge(), clock_source=self.clock_source(), aux_io_mode='AUX_IN_AUXILIARY', aux_io_param='NONE') else: raise ValueError('must set seq mode to "on" or "off"')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 3855, 18137, 29889, 2611, 15461, 29918, 24477, 874, 29889, 29909, 21051, 279, 29911, 5309, 29889, 1299, 29903, 29929, 29941, 29953, 29900, 1053, 319, 21051, 279, 29911, 5309, 29918, 1299, 29903, 29929, 29941, 29953, 29900, 13, 3166, 3855, 3359, 29918, 29893, 336, 22437, 29889, 284, 28690, 29918, 1285, 11897, 29889, 1299, 29903, 29929, 29941, 29953, 29900, 2956, 1053, 319, 9375, 29929, 29941, 29953, 29900, 2956, 13, 3166, 3855, 18137, 29889, 13239, 1053, 2854, 4097, 408, 659, 29879, 13, 13, 13, 1990, 319, 9375, 29929, 29941, 29953, 29900, 2956, 29918, 1062, 29898, 1299, 29903, 29929, 29941, 29953, 29900, 2956, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 394, 28690, 29892, 274, 11742, 29918, 1853, 2433, 1351, 29374, 13, 4706, 565, 274, 11742, 29918, 1853, 338, 525, 29879, 1160, 2396, 13, 9651, 22782, 29918, 27736, 353, 7700, 13, 9651, 6588, 29918, 3757, 4339, 353, 5852, 13, 4706, 25342, 274, 11742, 29918, 1853, 338, 525, 1351, 2396, 13, 9651, 22782, 29918, 27736, 353, 5852, 13, 9651, 6588, 29918, 3757, 4339, 353, 5852, 13, 4706, 25342, 274, 11742, 29918, 1853, 338, 525, 3757, 2396, 13, 9651, 22782, 29918, 27736, 353, 5852, 13, 9651, 6588, 29918, 3757, 4339, 353, 7700, 13, 4706, 1683, 29901, 13, 9651, 12020, 8960, 877, 562, 23493, 4701, 1134, 1818, 367, 297, 24335, 525, 13, 462, 9651, 525, 13556, 2347, 29901, 6571, 4286, 4830, 18959, 29879, 1160, 742, 525, 1351, 742, 525, 3757, 7464, 13, 462, 462, 462, 29871, 274, 11742, 29918, 1853, 876, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29922, 978, 29892, 394, 28690, 29918, 978, 29922, 284, 28690, 29889, 978, 29892, 13, 462, 308, 22782, 29918, 27736, 29922, 14146, 403, 29918, 27736, 29892, 13, 462, 308, 6588, 29918, 3757, 4339, 29922, 12483, 482, 29918, 3757, 4339, 29897, 13, 13, 13, 1990, 319, 21051, 279, 29911, 5309, 29918, 1299, 29903, 29929, 29941, 29953, 29900, 29918, 1062, 29898, 29909, 21051, 279, 29911, 5309, 29918, 1299, 29903, 29929, 29941, 29953, 29900, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 19359, 29918, 8513, 2433, 2696, 29374, 13, 4706, 565, 19359, 29918, 8513, 338, 525, 265, 2396, 13, 9651, 12013, 29918, 8513, 353, 525, 25951, 29990, 29918, 1177, 29918, 29911, 22789, 17070, 29918, 1430, 6181, 29915, 13, 9651, 12013, 29918, 3207, 353, 525, 29911, 22789, 29918, 29903, 3927, 4162, 29918, 24815, 1806, 18474, 29915, 13, 4706, 25342, 19359, 29918, 8513, 338, 525, 2696, 2396, 13, 9651, 12013, 29918, 8513, 353, 525, 25951, 29990, 29918, 1177, 29918, 25951, 29990, 29902, 5265, 19926, 29915, 13, 9651, 12013, 29918, 3207, 353, 525, 29940, 12413, 29915, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 877, 21969, 731, 19359, 4464, 304, 376, 265, 29908, 470, 525, 13, 462, 632, 18793, 2696, 613, 4520, 6571, 4286, 4830, 29898, 11762, 29918, 8513, 876, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29922, 978, 29897, 13, 4706, 1583, 29889, 2917, 29898, 13058, 29918, 4993, 2433, 5746, 4945, 29940, 1964, 29918, 29907, 21339, 29918, 29896, 29900, 29924, 12661, 29918, 25866, 742, 13, 462, 1678, 396, 11249, 29918, 10492, 29922, 29945, 29900, 29900, 29918, 29900, 29900, 29900, 29918, 29900, 29900, 29900, 29892, 13, 462, 1678, 7029, 29918, 11249, 29918, 10492, 29922, 29945, 29900, 29900, 29918, 29900, 29900, 29900, 29918, 29900, 29900, 29900, 29892, 13, 462, 1678, 12006, 29918, 12864, 2433, 29907, 21339, 29918, 3352, 1692, 29918, 29934, 3235, 4214, 742, 13, 462, 1678, 1602, 7715, 29922, 29896, 29892, 13, 462, 1678, 23638, 29922, 1839, 12696, 742, 525, 12696, 7464, 13, 462, 1678, 8242, 29918, 3881, 11759, 29889, 29946, 29892, 869, 29946, 1402, 13, 462, 1678, 25275, 749, 11759, 29945, 29900, 29892, 29871, 29945, 29900, 1402, 13, 462, 1678, 7135, 29918, 16453, 2433, 29911, 22789, 29918, 1430, 29954, 8895, 29918, 4590, 29918, 29967, 742, 13, 462, 1678, 7135, 29918, 10599, 29896, 2433, 29911, 22789, 29918, 1430, 29954, 8895, 29918, 29967, 742, 13, 462, 1678, 7135, 29918, 4993, 29896, 2433, 5746, 4945, 29940, 1964, 742, 13, 462, 1678, 7135, 29918, 29879, 417, 412, 29896, 2433, 29911, 22789, 29918, 29903, 3927, 4162, 29918, 24815, 1806, 18474, 742, 13, 462, 1678, 7135, 29918, 5563, 29896, 29922, 29896, 29946, 29900, 29892, 13, 462, 1678, 7135, 29918, 10599, 29906, 2433, 29911, 22789, 29918, 1430, 29954, 8895, 29918, 29968, 742, 13, 462, 1678, 7135, 29918, 4993, 29906, 2433, 23711, 6181, 742, 13, 462, 1678, 7135, 29918, 29879, 417, 412, 29906, 2433, 29911, 22789, 29918, 29903, 3927, 4162, 29918, 24815, 1806, 18474, 742, 13, 462, 1678, 7135, 29918, 5563, 29906, 29922, 29896, 29906, 29947, 29892, 13, 462, 1678, 7029, 29918, 21001, 29918, 16589, 10335, 2433, 12696, 742, 13, 462, 1678, 7029, 29918, 21001, 29918, 3881, 2433, 2544, 29934, 29918, 29906, 29963, 29945, 742, 13, 462, 1678, 7135, 29918, 18829, 29922, 29900, 29892, 13, 462, 1678, 11815, 29918, 29873, 7358, 29922, 29900, 29892, 13, 462, 1678, 3479, 29918, 601, 29918, 8513, 29922, 601, 29918, 8513, 29892, 13, 462, 1678, 3479, 29918, 601, 29918, 3207, 29922, 601, 29918, 3207, 13, 462, 1678, 1723, 13, 4706, 1583, 29889, 1202, 29918, 15501, 29898, 978, 2433, 11762, 29918, 8513, 742, 13, 462, 965, 679, 29918, 9006, 29922, 1311, 3032, 657, 29918, 11762, 29918, 1545, 29892, 13, 462, 965, 731, 29918, 9006, 29922, 1311, 3032, 842, 29918, 11762, 29918, 8513, 29892, 13, 462, 965, 659, 29879, 29922, 791, 29879, 29889, 10773, 1918, 580, 13, 462, 965, 1723, 13, 13, 1678, 822, 903, 657, 29918, 11762, 29918, 1545, 29898, 1311, 1125, 13, 4706, 565, 313, 1311, 29889, 2993, 29918, 601, 29918, 8513, 580, 338, 525, 25951, 29990, 29918, 1177, 29918, 29911, 22789, 17070, 29918, 1430, 6181, 29915, 322, 13, 18884, 1583, 29889, 2993, 29918, 601, 29918, 3207, 580, 338, 525, 29911, 22789, 29918, 29903, 3927, 4162, 29918, 24815, 1806, 18474, 29374, 13, 9651, 736, 525, 265, 29915, 13, 4706, 25342, 313, 1311, 29889, 2993, 29918, 601, 29918, 8513, 580, 338, 525, 25951, 29990, 29918, 1177, 29918, 25951, 29990, 29902, 5265, 19926, 29915, 322, 13, 795, 1583, 29889, 2993, 29918, 601, 29918, 3207, 580, 338, 525, 29940, 12413, 29374, 13, 9651, 736, 525, 2696, 29915, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 877, 2993, 29918, 601, 29918, 8513, 29901, 24335, 3479, 29918, 601, 29918, 3207, 29901, 6571, 525, 13, 462, 632, 525, 1867, 451, 3928, 304, 19359, 29918, 8513, 373, 470, 1283, 1495, 13, 13, 1678, 822, 903, 842, 29918, 11762, 29918, 8513, 29898, 1311, 29892, 4464, 1125, 13, 4706, 565, 4464, 338, 525, 265, 2396, 13, 9651, 1583, 29889, 2917, 29898, 11249, 29918, 10492, 29922, 1311, 29889, 11249, 29918, 10492, 3285, 13, 462, 4706, 12006, 29918, 12864, 29922, 1311, 29889, 13058, 29918, 12864, 3285, 13, 462, 4706, 12006, 29918, 4993, 29922, 1311, 29889, 13058, 29918, 4993, 3285, 13, 462, 4706, 3479, 29918, 601, 29918, 8513, 2433, 25951, 29990, 29918, 1177, 29918, 29911, 22789, 17070, 29918, 1430, 6181, 742, 13, 462, 4706, 3479, 29918, 601, 29918, 3207, 2433, 29911, 22789, 29918, 29903, 3927, 4162, 29918, 24815, 1806, 18474, 1495, 13, 4706, 25342, 4464, 338, 525, 2696, 2396, 13, 9651, 1583, 29889, 2917, 29898, 11249, 29918, 10492, 29922, 1311, 29889, 11249, 29918, 10492, 3285, 13, 462, 4706, 12006, 29918, 12864, 29922, 1311, 29889, 13058, 29918, 12864, 3285, 13, 462, 4706, 12006, 29918, 4993, 29922, 1311, 29889, 13058, 29918, 4993, 3285, 13, 462, 4706, 3479, 29918, 601, 29918, 8513, 2433, 25951, 29990, 29918, 1177, 29918, 25951, 29990, 29902, 5265, 19926, 742, 13, 462, 4706, 3479, 29918, 601, 29918, 3207, 2433, 29940, 12413, 1495, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 877, 21969, 731, 19359, 4464, 304, 376, 265, 29908, 470, 376, 2696, 29908, 1495, 13, 2 ]
psm/lake/lake_driver.py
amoodie/PRYSM
21
53337
<gh_stars>10-100 #====================================================================== # <NAME> # Modified 03/08/16 <<EMAIL>> # Modified 04/02/18 <<EMAIL>> # Script to run lake sediment proxy system model #====================================================================== # PRYSM v2.0 Lake Sediments, DRIVER SCRIPT # Notes: please see all function docstrings for proper use. # Dependencies: rpy2, f2py, numpy """ Lake PSM ~ Load Environmental Variables to compute lake energy/water balance. This is a driver script. It is set up to walk the user through the necessary commands to use the lake PSM. The user can load there own data in the fields below, or use the provided test data. This driver script calls the submodels: lake_sensor lake_archive lake_obs The final output is a pseudoproxy time series at a given site, with 1000 plausible chronologies, age-depth information, and related sensor uncertaities. """ #====================================================================== # L0. Initialization #====================================================================== import numpy as np import matplotlib.pyplot as plt import matplotlib from math import pi, sqrt, exp #============================================================== # L1. ENVIRONMENT SUB-MODEL: Load environment Input data #============================================================== # cd /disk/staff/sylvia/LAKEPSM/ # # Example data directory # datadir='test_data_lake/' # print 'Loading data from ', datadir,' ...' # env_input='example_input.txt' #============================================================== # F2PY to run environment model: run the following in the command window # NOTE: # (1) IT RUNS IN THE COMMAND LINE NOT IN THE PYTHON SHELL. # (2) Make sure to run and install in the correct environment. # f2py -c -m lakepsm lake_environment.f90 # MUST BE IN SAME DIRECTORY AS COMPILED FORTRAN WRAPPER import lakepsm lake_data_file= env_input # Run Environment Model lakepsm.lakemodel() # The above should run the fortran model through a wrapper (F2Py) # The output files (listed below) should now appear in your working directory. # output files: #profile_output.dat #surface_output.dat #============================================================== # L2. SENSOR MODEL(S) #============================================================== import sensor_gdgt as gdgt import sensor_carbonate as carb import sensor_leafwax as leafwax # Pull data (lake surface temperature) from output from env # model and use to run sensor model surf_ouput = 'ERA-HIST-Tlake_surf.dat' surf_tempr = [] with open(surf_ouput, 'r') as data: tempr_yr = [] for line in data: line_vals = line.split() tempr_yr.append(line_vals[1]) surf_tempr.append(tempr_yr[341:-11]) surf_tempr = np.array(surf_tempr[0], dtype = float) +275.15 climate_input = 'ERA_INTERIM_climatology_Tanganyika.txt' air_tempr = [] with open(climate_input, 'r') as data: airtemp_yr = [] for line in data: line_vals = line.split() airtemp_yr.append(line_vals[2]) air_tempr.append(airtemp_yr[:-12]) air_tempr = np.array(air_tempr[0], dtype = float) LST = surf_tempr # THIS SHOULD BE THE FULL TIME SERIES of lake surface temp MAAT = air_tempr # Full timeseries of air temperatures beta = 1./50. d18Ow = -2 # To be set by the user if isoflag is off print('Running sensor model...') # 2.1 GDGT Sensors gdgt_proxy = gdgt.gdgt_sensor(LST,MAAT,beta=beta,model = 'MBT') # SAVE IN CURRENT DIRECTORY np.save('gdgt_sensor.npy',gdgt_proxy) # 2.2 Carbonate Sensor carb_proxy = carb.carb_sensor(LST,d18Ow,isoflag=-1,model='ONeil') # SAVE IN CURRENT DIRECTORY np.save('carb_sensor.npy',carb_proxy) # 2.3 Leaf Wax Sensor sample_input = 'IsoGSM_dDP_1953_2012.txt' dDp = np.loadtxt(sample_input) fC_3 = 0.7 #fraction of C3 plants fC_4 = 0.3 #fraction of C4 plants eps_c3 = -112.8 #pm 34.7 eps_c4 = -124.5 #pm 28.2 wax_proxy = leafwax.wax_sensor(dDp,fC_3,fC_4,eps_c3,eps_c4) # define the error range on the epsilon (apparent fractionation) measurement: eps_c3_err=34.7 eps_c4_err=28.2 # add uncertainties in apparent fractionation via monte-carlo resampling process: delta_d_wax_mc,Q1,Q2=leafwax.wax_uncertainty(dDp,fC_3,fC_4,eps_c3,eps_c4,eps_c3_err,eps_c4_err) # where Q1 is the 2.5th percentile, Q2 is the 97.5th percentile of the 1000 MC realizations # SAVE IN CURRENT DIRECTORY np.save('leafwax_sensor.npy',wax_proxy) np.save('leafwax_sensor_1000mc.npy',delta_d_wax_mc) np.save('leafwax_sensor_975CI.npy',Q2) np.save('leafwax_sensor_25CI.npy,Q1') print('Sensor model finished....') #============================================================== # L4. RUN ARCHIVE MODEL #============================================================== import lake_archive_compact as compact print 'Running archive model...' # 4.1 SEDIMENTATION Sbar = 100.0 # Sedimentation rate, cm/kyr S = Sbar/1000. # Sedimentation rate, cm/yr # Without compaction: T = 21000. #years !set from the envriomental model! H = S*T #meters # TODO: NOTE THAT IF YOU HAVE DEPTH MEASUREMENTS THIS SHOULD BE SPECIFIED HERE depth_profile = H # total depth of core [m] h=np.linspace(0,H,num=100) depth_profile=H # total depth of core # Trends in porosity ~ reflect inhomogeneities in relatve compaction: # Apply correction based on conservation of dry sediment volume wherein the thickness of each layer # is adjusted so as to remove trends in porosity. # Run porosity function to calculate compaction due to porosity in # lake sediments: phi,z = compact.porosity(depth_profile) phi_0 = 0.95 # porosity of sediments at site (typical value for lake seds = 0.99) np.save('phi.npy', phi) np.save('z.npy',z) # Now adjust the compacted sediment depth scale based on porosity h_prime = np.zeros(len(phi)) # depth and age at each index. for i in range(len(phi)): h_prime[i] = h[i]*(1-phi_0)/(1-phi[i]) # save depth-age profile as independent output #============================================================== # 4.2 BIOTURBATION ~ TURBO2 (Trauth, 2013) import lake_archive_bioturb as bio years = np.arange(1979,2015,1) # READ THE YEARS. age = years mxl = np.ones(36)*4. abu = np.ones(36)*200. # abundance of species carrier 1 abu2 = abu[-37:-1] iso = pseudoproxy lngth = len(pseudoproxy) numb = 10 oriabu,bioabu,oriiso,bioiso = bio.bioturbation(abu2,iso,mxl,numb) #========================================================================== # L5. APPLY OBSERVATION MODEL #========================================================================== print 'Running observation model...' import csv from numpy import genfromtxt from rpy2.robjects import FloatVector from rpy2.robjects.vectors import StrVector import rpy2.robjects as robjects from rpy2.robjects.packages import importr # require rpy2 installed import lake_obs_bchron2 as bchron data = genfromtxt('TEX86_cal.csv', delimiter = ',', names=True, dtype=None #mask module may be used when better understood #,usemask=True ) # example input file: user have to provide their own input year=data['AGE'] depth=data['DP'] sds=data['SD'] r = robjects.r #robjective calCurves=np.repeat('normal', 26) nyears=21000. # that should fixed from the input d=500. # same as H in the sendimentation. ages = FloatVector(year) # age estimate sd = FloatVector(sds)# SD of ages positions = FloatVector(depth) # position in core in cm calCurves = StrVector(calCurves) predictPositions = r.seq(0,d,by=d/nyears) # note d= total depth of core (60cm) # Specify extractDate (top-most age of the core, in years BP. 1950=0BP) extractDate= -55 # Call BCHRON observation model to return CHRONS (in years BP) # NOTE: long run time waming chronBP, depth_horizons = bchron.chron(ages,sd,positions,calCurves,predictPositions,extractDate) # recast in years CE chronCE = np.fliplr(1950 - chronBP) #========================================================================== # 3.2: Analytical Uncertainty Model: print 'Adding uncertainty...' #Enter final simulated speleothem record (choose from above options) X=pseudoproxy #X=d18O_wm2 #3.2.1 Simple Model: just add uncertainty bands based on measurement precision sigma=0.1 # permil, measurement precision lake_upper, lake_lower = analytical_err_simple(X,sigma) #3.2.2 Gaussian Noise Model for analytical error: sigma=0.1 #nsamples = ## enter number of samples here lake_Xn=analytical_error(X,sigma) #==================================================================== # Save whatever needs to be saved print 'Saving data...' outdir='./results/' np.save(outdir+"lake_Xn.npy",lake_Xn) #Whatever else... #==================================================================== # ~ # ~ # ~ # ~ #====================================================================== # L7 PLOTTING EXAMPLES #====================================================================== # Plotting! Uncomment to plot compaction profile # plt.style.use('ggplot') # fig2 = plt.figure(1) # fig2.add_subplot(1,2,1) # plt.plot(z,phi,'b') # plt.xlabel(r'Depth (m)',fontsize=16) # plt.ylabel(r'Porosity Profile ($\phi$) (unitless)',fontsize=16) # plt.title(r'Porosity ($\phi$) Profile in Sediment Core',fontsize=16) # plt.grid('on',color='grey') # plt.tick_params(axis='both', which='major', labelsize=14) # plt.xticks(fontname = "Helvetica") # This argument will change the font. # plt.yticks(fontname = "Helvetica") # This argument will change the font. # #====================================================================== # fig2.add_subplot(1,2,2) # plt.plot(z,h_prime,'r',label=r'Compacted Layer') # plt.plot(z,h,'b',label=r'Non-Compacted Original Layer') # plt.xlabel(r'Depth (m)',fontsize=16) # plt.ylabel(r'Sediment Height (m)',fontsize=16) # plt.title(r'Depth Scale w/Compaction in Sediment Core',fontsize=16) # plt.grid('on',color='grey') # plt.tick_params(axis='both', which='major', labelsize=14) # plt.xticks(fontname = "Helvetica") # This argument will change the font. # plt.yticks(fontname = "Helvetica") # This argument will change the font. # plt.legend(loc=2) # plt.show() # # ======================================================================
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 9166, 9166, 9166, 9166, 2751, 1360, 13, 29937, 529, 5813, 29958, 13, 29937, 3382, 2164, 29871, 29900, 29941, 29914, 29900, 29947, 29914, 29896, 29953, 3532, 26862, 6227, 6778, 13, 29937, 3382, 2164, 29871, 29900, 29946, 29914, 29900, 29906, 29914, 29896, 29947, 3532, 26862, 6227, 6778, 13, 29937, 14415, 304, 1065, 19437, 7048, 2073, 10166, 1788, 1904, 13, 29937, 9166, 9166, 9166, 9166, 2751, 1360, 13, 13, 29937, 12089, 29979, 17061, 325, 29906, 29889, 29900, 9459, 20951, 7862, 29892, 360, 3960, 5348, 12314, 24290, 13, 29937, 8695, 29901, 3113, 1074, 599, 740, 1574, 19651, 363, 1571, 671, 29889, 13, 29937, 10034, 7158, 29901, 364, 2272, 29906, 29892, 285, 29906, 2272, 29892, 12655, 13, 13, 15945, 29908, 13, 1678, 9459, 11323, 29924, 3695, 16012, 16738, 284, 9586, 1849, 304, 10272, 19437, 5864, 29914, 13405, 17346, 29889, 13, 1678, 910, 338, 263, 7156, 2471, 29889, 739, 338, 731, 701, 304, 6686, 278, 1404, 1549, 278, 5181, 13, 1678, 8260, 304, 671, 278, 19437, 11323, 29924, 29889, 450, 1404, 508, 2254, 727, 1914, 848, 297, 278, 4235, 2400, 29892, 13, 1678, 470, 671, 278, 4944, 1243, 848, 29889, 13, 13, 1678, 910, 7156, 2471, 5717, 278, 1014, 9794, 29901, 13, 4706, 19437, 29918, 29879, 6073, 13, 4706, 19437, 29918, 10867, 13, 4706, 19437, 29918, 26290, 13, 13, 1678, 450, 2186, 1962, 338, 263, 19923, 26555, 3594, 931, 3652, 472, 263, 2183, 3268, 29892, 411, 29871, 29896, 29900, 29900, 29900, 13, 1678, 2174, 375, 1821, 17168, 11763, 29892, 5046, 29899, 19488, 2472, 29892, 322, 4475, 23530, 443, 6327, 1249, 583, 29889, 13, 13, 15945, 29908, 13, 29937, 9166, 9166, 9166, 9166, 2751, 1360, 13, 29937, 365, 29900, 29889, 17250, 2133, 13, 29937, 9166, 9166, 9166, 9166, 2751, 1360, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 22889, 13, 3166, 5844, 1053, 2930, 29892, 18074, 2273, 29892, 1518, 13, 13, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 29937, 365, 29896, 29889, 12524, 29963, 8193, 1164, 13780, 27092, 29899, 20387, 29931, 29901, 29871, 16012, 5177, 10567, 848, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 13, 29937, 14965, 847, 20960, 29914, 303, 3470, 29914, 29879, 2904, 6071, 29914, 4375, 6059, 7024, 29924, 29914, 13, 13, 29937, 396, 8741, 848, 3884, 13, 29937, 1418, 328, 381, 2433, 1688, 29918, 1272, 29918, 433, 446, 22208, 13, 29937, 1596, 525, 23456, 848, 515, 13420, 1418, 328, 381, 5501, 2023, 29915, 13, 13, 29937, 8829, 29918, 2080, 2433, 4773, 29918, 2080, 29889, 3945, 29915, 13, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 13, 29937, 383, 29906, 20055, 304, 1065, 5177, 1904, 29901, 1065, 278, 1494, 297, 278, 1899, 3474, 13, 29937, 6058, 29923, 29901, 13, 29937, 313, 29896, 29897, 13315, 390, 29965, 3059, 2672, 6093, 23353, 1529, 2797, 365, 8895, 6058, 2672, 6093, 349, 29979, 4690, 1164, 317, 9606, 2208, 29889, 13, 29937, 313, 29906, 29897, 8561, 1854, 304, 1065, 322, 2601, 297, 278, 1959, 5177, 29889, 13, 13, 29937, 285, 29906, 2272, 448, 29883, 448, 29885, 19437, 567, 29885, 19437, 29918, 20944, 29889, 29888, 29929, 29900, 13, 13, 29937, 341, 17321, 20700, 2672, 16698, 2303, 22471, 26282, 18929, 3339, 23353, 2227, 20566, 15842, 26813, 399, 29934, 3301, 13171, 13, 13, 5215, 19437, 567, 29885, 13, 13, 433, 446, 29918, 1272, 29918, 1445, 29922, 8829, 29918, 2080, 13, 13, 29937, 7525, 16738, 8125, 13, 433, 446, 567, 29885, 29889, 18170, 331, 27224, 580, 13, 13, 29937, 450, 2038, 881, 1065, 278, 363, 509, 273, 1904, 1549, 263, 14476, 313, 29943, 29906, 19737, 29897, 13, 29937, 450, 1962, 2066, 313, 1761, 287, 2400, 29897, 881, 1286, 2615, 297, 596, 1985, 3884, 29889, 13, 13, 29937, 1962, 2066, 29901, 13, 29937, 10185, 29918, 4905, 29889, 4130, 13, 29937, 7610, 2161, 29918, 4905, 29889, 4130, 13, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 29937, 365, 29906, 29889, 317, 1430, 29903, 1955, 16999, 2287, 29931, 29898, 29903, 29897, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 5215, 23530, 29918, 29887, 29881, 4141, 408, 330, 29881, 4141, 13, 5215, 23530, 29918, 4287, 6718, 403, 408, 1559, 29890, 13, 5215, 23530, 29918, 29500, 29893, 1165, 408, 20447, 29893, 1165, 13, 13, 29937, 349, 913, 848, 313, 433, 446, 7101, 10430, 29897, 515, 1962, 515, 8829, 13, 29937, 1904, 322, 671, 304, 1065, 23530, 1904, 13, 7610, 29888, 29918, 283, 649, 353, 525, 1001, 29909, 29899, 29950, 9047, 29899, 29911, 433, 446, 29918, 7610, 29888, 29889, 4130, 29915, 13, 7610, 29888, 29918, 1356, 558, 353, 5159, 13, 2541, 1722, 29898, 7610, 29888, 29918, 283, 649, 29892, 525, 29878, 1495, 408, 848, 29901, 13, 12, 1356, 558, 29918, 4316, 353, 5159, 29871, 13, 12, 1454, 1196, 297, 848, 29901, 13, 12, 12, 1220, 29918, 791, 29879, 353, 1196, 29889, 5451, 580, 13, 12, 12, 1356, 558, 29918, 4316, 29889, 4397, 29898, 1220, 29918, 791, 29879, 29961, 29896, 2314, 13, 12, 7610, 29888, 29918, 1356, 558, 29889, 4397, 29898, 1356, 558, 29918, 4316, 29961, 29941, 29946, 29896, 13018, 29896, 29896, 2314, 13, 7610, 29888, 29918, 1356, 558, 353, 7442, 29889, 2378, 29898, 7610, 29888, 29918, 1356, 558, 29961, 29900, 1402, 26688, 353, 5785, 29897, 718, 29906, 29955, 29945, 29889, 29896, 29945, 13, 13, 695, 6490, 29918, 2080, 353, 525, 1001, 29909, 29918, 23845, 7833, 29918, 695, 15840, 3002, 29918, 29911, 574, 1384, 4106, 29889, 3945, 29915, 13, 1466, 29918, 1356, 558, 353, 5159, 13, 2541, 1722, 29898, 695, 6490, 29918, 2080, 29892, 525, 29878, 1495, 408, 848, 29901, 13, 1678, 4799, 7382, 29918, 4316, 353, 5159, 13, 1678, 363, 1196, 297, 848, 29901, 13, 4706, 1196, 29918, 791, 29879, 353, 1196, 29889, 5451, 580, 13, 4706, 4799, 7382, 29918, 4316, 29889, 4397, 29898, 1220, 29918, 791, 29879, 29961, 29906, 2314, 13, 1678, 4799, 29918, 1356, 558, 29889, 4397, 29898, 1466, 7382, 29918, 4316, 7503, 29899, 29896, 29906, 2314, 13, 1466, 29918, 1356, 558, 353, 7442, 29889, 2378, 29898, 1466, 29918, 1356, 558, 29961, 29900, 1402, 26688, 353, 5785, 29897, 13, 13, 13, 29931, 1254, 353, 1190, 29888, 29918, 1356, 558, 29871, 396, 3446, 3235, 317, 8187, 29965, 10249, 20700, 6093, 383, 3299, 323, 8890, 26996, 29059, 310, 19437, 7101, 5694, 13, 1529, 1299, 353, 4799, 29918, 1356, 558, 29871, 396, 14846, 3064, 6358, 310, 4799, 6238, 3698, 13, 3571, 353, 29871, 29896, 6904, 29945, 29900, 29889, 13, 29881, 29896, 29947, 29949, 29893, 353, 448, 29906, 396, 1763, 367, 731, 491, 278, 1404, 565, 338, 974, 3110, 338, 1283, 13, 13, 2158, 877, 27795, 23530, 1904, 856, 1495, 13, 13, 29937, 29871, 29906, 29889, 29896, 402, 29928, 23799, 317, 575, 943, 13, 29887, 29881, 4141, 29918, 14701, 353, 330, 29881, 4141, 29889, 29887, 29881, 4141, 29918, 29879, 6073, 29898, 29931, 1254, 29892, 1529, 1299, 29892, 3571, 29922, 3571, 29892, 4299, 353, 525, 9486, 29911, 1495, 13, 13, 29937, 317, 7520, 29923, 2672, 315, 4574, 29450, 22471, 26282, 18929, 13, 13, 9302, 29889, 7620, 877, 29887, 29881, 4141, 29918, 29879, 6073, 29889, 29876, 2272, 742, 29887, 29881, 4141, 29918, 14701, 29897, 13, 13, 29937, 29871, 29906, 29889, 29906, 1704, 6718, 403, 317, 6073, 13, 13, 4287, 29890, 29918, 14701, 353, 1559, 29890, 29889, 4287, 29890, 29918, 29879, 6073, 29898, 29931, 1254, 29892, 29881, 29896, 29947, 29949, 29893, 29892, 275, 974, 3110, 10457, 29896, 29892, 4299, 2433, 1164, 23270, 1495, 13, 13, 29937, 317, 7520, 29923, 2672, 315, 4574, 29450, 22471, 26282, 18929, 13, 13, 9302, 29889, 7620, 877, 4287, 29890, 29918, 29879, 6073, 29889, 29876, 2272, 742, 4287, 29890, 29918, 14701, 29897, 13, 13, 29937, 29871, 29906, 29889, 29941, 951, 2142, 399, 1165, 317, 6073, 13, 13, 11249, 29918, 2080, 353, 525, 29902, 578, 10749, 29924, 29918, 29881, 11191, 29918, 29896, 29929, 29945, 29941, 29918, 29906, 29900, 29896, 29906, 29889, 3945, 29915, 13, 29881, 29928, 29886, 29871, 353, 7442, 29889, 1359, 3945, 29898, 11249, 29918, 2080, 29897, 29871, 13, 29888, 29907, 29918, 29941, 353, 29871, 29900, 29889, 29955, 396, 29888, 13857, 310, 315, 29941, 18577, 13, 29888, 29907, 29918, 29946, 353, 259, 29900, 29889, 29941, 29871, 396, 29888, 13857, 310, 315, 29946, 18577, 13, 8961, 29918, 29883, 29941, 353, 448, 29896, 29896, 29906, 29889, 29947, 396, 3358, 29871, 29941, 29946, 29889, 29955, 13, 8961, 29918, 29883, 29946, 353, 448, 29896, 29906, 29946, 29889, 29945, 396, 3358, 29871, 29906, 29947, 29889, 29906, 13, 13, 29893, 1165, 29918, 14701, 353, 20447, 29893, 1165, 29889, 29893, 1165, 29918, 29879, 6073, 29898, 29881, 29928, 29886, 29892, 29888, 29907, 29918, 29941, 29892, 29888, 29907, 29918, 29946, 29892, 8961, 29918, 29883, 29941, 29892, 8961, 29918, 29883, 29946, 29897, 13, 13, 29937, 4529, 278, 1059, 3464, 373, 278, 321, 3232, 313, 932, 279, 296, 15958, 362, 29897, 20039, 29901, 13, 8961, 29918, 29883, 29941, 29918, 3127, 29922, 29941, 29946, 29889, 29955, 13, 8961, 29918, 29883, 29946, 29918, 3127, 29922, 29906, 29947, 29889, 29906, 13, 13, 29937, 788, 443, 6327, 2365, 583, 297, 20295, 15958, 362, 3025, 1601, 371, 29899, 4287, 417, 620, 314, 10335, 1889, 29901, 13, 4181, 29918, 29881, 29918, 29893, 1165, 29918, 14047, 29892, 29984, 29896, 29892, 29984, 29906, 29922, 29500, 29893, 1165, 29889, 29893, 1165, 29918, 4661, 13946, 1017, 29898, 29881, 29928, 29886, 29892, 29888, 29907, 29918, 29941, 29892, 29888, 29907, 29918, 29946, 29892, 8961, 29918, 29883, 29941, 29892, 8961, 29918, 29883, 29946, 29892, 8961, 29918, 29883, 29941, 29918, 3127, 29892, 8961, 29918, 29883, 29946, 29918, 3127, 29897, 13, 13, 29937, 988, 660, 29896, 338, 278, 29871, 29906, 29889, 29945, 386, 10151, 488, 29892, 660, 29906, 338, 278, 29871, 29929, 29955, 29889, 29945, 386, 10151, 488, 310, 278, 29871, 29896, 29900, 29900, 29900, 21271, 8869, 800, 13, 13, 29937, 317, 7520, 29923, 2672, 315, 4574, 29450, 22471, 26282, 18929, 13, 13, 9302, 29889, 7620, 877, 29500, 29893, 1165, 29918, 29879, 6073, 29889, 29876, 2272, 742, 29893, 1165, 29918, 14701, 29897, 13, 13, 9302, 29889, 7620, 877, 29500, 29893, 1165, 29918, 29879, 6073, 29918, 29896, 29900, 29900, 29900, 14047, 29889, 29876, 2272, 742, 4181, 29918, 29881, 29918, 29893, 1165, 29918, 14047, 29897, 13, 9302, 29889, 7620, 877, 29500, 29893, 1165, 29918, 29879, 6073, 29918, 29929, 29955, 29945, 8426, 29889, 29876, 2272, 742, 29984, 29906, 29897, 13, 9302, 29889, 7620, 877, 29500, 29893, 1165, 29918, 29879, 6073, 29918, 29906, 29945, 8426, 29889, 29876, 2272, 29892, 29984, 29896, 1495, 13, 13, 2158, 877, 29903, 6073, 1904, 7743, 3045, 1495, 13, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 29937, 365, 29946, 29889, 27694, 9033, 3210, 18474, 16999, 2287, 29931, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 13, 5215, 19437, 29918, 10867, 29918, 2388, 627, 408, 11071, 13, 13, 2158, 525, 27795, 18871, 1904, 856, 29915, 13, 13, 29937, 29871, 29946, 29889, 29896, 317, 3352, 7833, 3919, 8098, 13, 13, 29903, 1646, 353, 29871, 29896, 29900, 29900, 29889, 29900, 308, 396, 20951, 2073, 362, 6554, 29892, 7477, 29914, 3459, 29878, 13, 29903, 353, 317, 1646, 29914, 29896, 29900, 29900, 29900, 29889, 4706, 396, 20951, 2073, 362, 6554, 29892, 7477, 29914, 4316, 13, 13, 29937, 13932, 752, 2467, 29901, 13, 13, 29911, 353, 29871, 29906, 29896, 29900, 29900, 29900, 29889, 9651, 396, 6360, 29879, 1738, 842, 515, 278, 8829, 374, 2932, 284, 1904, 29991, 29871, 13, 29950, 353, 317, 29930, 29911, 1669, 396, 2527, 414, 13, 13, 29937, 14402, 29901, 6058, 29923, 3446, 1299, 10762, 612, 27269, 379, 7520, 29923, 5012, 29925, 4690, 22986, 3289, 11499, 13780, 29903, 3446, 3235, 317, 8187, 29965, 10249, 20700, 317, 4162, 8426, 3738, 3352, 379, 27267, 13, 13, 19488, 29918, 10185, 353, 379, 268, 396, 3001, 10809, 310, 7136, 518, 29885, 29962, 13, 13, 29882, 29922, 9302, 29889, 1915, 3493, 29898, 29900, 29892, 29950, 29892, 1949, 29922, 29896, 29900, 29900, 29897, 13, 19488, 29918, 10185, 29922, 29950, 396, 3001, 10809, 310, 7136, 13, 13, 13, 29937, 1605, 1975, 297, 1277, 359, 537, 3695, 9432, 297, 9706, 16603, 1907, 297, 1104, 271, 345, 752, 2467, 29901, 13, 29937, 2401, 368, 26385, 2729, 373, 24201, 310, 15589, 7048, 2073, 7977, 988, 262, 278, 12003, 2264, 310, 1269, 7546, 13, 29937, 338, 10365, 287, 577, 408, 304, 3349, 534, 1975, 297, 1277, 359, 537, 29889, 13, 13, 29937, 7525, 1277, 359, 537, 740, 304, 8147, 752, 2467, 2861, 304, 1277, 359, 537, 297, 13, 29937, 19437, 7048, 7862, 29901, 13, 13, 2876, 29892, 29920, 353, 11071, 29889, 1971, 359, 537, 29898, 19488, 29918, 10185, 29897, 13, 2876, 29918, 29900, 353, 29871, 29900, 29889, 29929, 29945, 3986, 396, 1277, 359, 537, 310, 7048, 7862, 472, 3268, 313, 22449, 936, 995, 363, 19437, 269, 5779, 353, 29871, 29900, 29889, 29929, 29929, 29897, 13, 13, 9302, 29889, 7620, 877, 2876, 29889, 29876, 2272, 742, 1374, 29875, 29897, 13, 9302, 29889, 7620, 877, 29920, 29889, 29876, 2272, 742, 29920, 29897, 13, 29937, 2567, 10365, 278, 11071, 287, 7048, 2073, 10809, 6287, 2729, 373, 1277, 359, 537, 13, 13, 29882, 29918, 10080, 353, 7442, 29889, 3298, 359, 29898, 2435, 29898, 2876, 876, 396, 10809, 322, 5046, 472, 1269, 2380, 29889, 29871, 13, 1454, 474, 297, 3464, 29898, 2435, 29898, 2876, 22164, 13, 1678, 298, 29918, 10080, 29961, 29875, 29962, 353, 298, 29961, 29875, 14178, 29898, 29896, 29899, 2876, 29918, 29900, 6802, 29898, 29896, 29899, 2876, 29961, 29875, 2314, 13, 13, 29937, 4078, 10809, 29899, 482, 8722, 408, 7417, 1962, 13, 29937, 9166, 9166, 9166, 4936, 2751, 1360, 13, 13, 29937, 29871, 29946, 29889, 29906, 350, 29902, 2891, 4574, 29933, 8098, 3695, 323, 4574, 8456, 29906, 313, 5323, 2806, 29892, 29871, 29906, 29900, 29896, 29941, 29897, 13, 13, 5215, 19437, 29918, 10867, 29918, 5365, 327, 9265, 408, 17799, 13, 13, 6360, 29879, 353, 7442, 29889, 279, 927, 29898, 29896, 29929, 29955, 29929, 29892, 29906, 29900, 29896, 29945, 29892, 29896, 29897, 396, 5195, 3035, 6093, 612, 26441, 29903, 29889, 13, 482, 259, 353, 2440, 13, 29885, 15524, 259, 353, 7442, 29889, 2873, 29898, 29941, 29953, 11877, 29946, 29889, 13, 370, 29884, 259, 353, 7442, 29889, 2873, 29898, 29941, 29953, 11877, 29906, 29900, 29900, 29889, 29871, 396, 18666, 749, 310, 6606, 1559, 4336, 29871, 29896, 13, 370, 29884, 29906, 353, 633, 29884, 14352, 29941, 29955, 13018, 29896, 29962, 13, 10718, 259, 353, 19923, 26555, 3594, 13, 29880, 865, 386, 353, 7431, 29898, 27358, 566, 26555, 3594, 29897, 13, 1949, 29890, 29871, 353, 29871, 29896, 29900, 13, 13, 4170, 370, 29884, 29892, 24840, 370, 29884, 29892, 4170, 10718, 29892, 24840, 10718, 353, 17799, 29889, 5365, 327, 9265, 362, 29898, 370, 29884, 29906, 29892, 10718, 29892, 29885, 15524, 29892, 1949, 29890, 29897, 13, 13, 29937, 9166, 9166, 9166, 9166, 4936, 1360, 13, 29937, 365, 29945, 29889, 12279, 7390, 29979, 438, 29933, 6304, 29963, 8098, 16999, 2287, 29931, 13, 29937, 9166, 9166, 9166, 9166, 4936, 1360, 13, 2158, 525, 27795, 15500, 1904, 856, 29915, 13, 13, 5215, 11799, 13, 3166, 12655, 1053, 2531, 3166, 3945, 29871, 13, 3166, 364, 2272, 29906, 29889, 307, 1675, 29879, 1053, 27842, 12877, 13, 3166, 364, 2272, 29906, 29889, 307, 1675, 29879, 29889, 345, 14359, 1053, 3767, 12877, 13, 5215, 364, 2272, 29906, 29889, 307, 1675, 29879, 408, 696, 1675, 29879, 13, 3166, 364, 2272, 29906, 29889, 307, 1675, 29879, 29889, 8318, 1053, 1053, 29878, 13, 29937, 1996, 364, 2272, 29906, 5130, 13, 13, 5215, 19437, 29918, 26290, 29918, 29890, 5904, 29906, 408, 289, 5904, 13, 13, 1272, 353, 2531, 3166, 3945, 877, 4330, 29990, 29947, 29953, 29918, 1052, 29889, 7638, 742, 13, 18884, 28552, 353, 13420, 742, 13, 18884, 2983, 29922, 5574, 29892, 13, 18884, 26688, 29922, 8516, 13, 18884, 396, 13168, 3883, 1122, 367, 1304, 746, 2253, 11098, 13, 18884, 396, 29892, 375, 331, 1278, 29922, 5574, 13, 18884, 1723, 13, 13, 29937, 1342, 1881, 934, 29901, 1404, 505, 304, 3867, 1009, 1914, 1881, 13, 13, 6360, 29922, 1272, 1839, 10461, 2033, 13, 19488, 29922, 1272, 1839, 11191, 2033, 13, 4928, 29879, 29922, 1272, 1839, 7230, 2033, 13, 13, 29878, 353, 696, 1675, 29879, 29889, 29878, 396, 307, 1675, 573, 13, 1052, 23902, 1960, 29922, 9302, 29889, 14358, 877, 8945, 742, 29871, 29906, 29953, 29897, 13, 13, 1460, 15451, 29922, 29906, 29896, 29900, 29900, 29900, 29889, 396, 393, 881, 4343, 515, 278, 1881, 13, 29881, 29922, 29945, 29900, 29900, 29889, 259, 396, 1021, 408, 379, 297, 278, 3638, 2073, 362, 29889, 13, 13, 1179, 353, 27842, 12877, 29898, 6360, 29897, 1678, 396, 5046, 12678, 13, 4928, 29871, 353, 27842, 12877, 29898, 4928, 29879, 29897, 29937, 8073, 310, 24646, 13, 1066, 2187, 353, 27842, 12877, 29898, 19488, 29897, 268, 396, 2602, 297, 7136, 297, 7477, 13, 1052, 23902, 1960, 353, 3767, 12877, 29898, 1052, 23902, 1960, 29897, 13, 27711, 9135, 2187, 353, 364, 29889, 11762, 29898, 29900, 29892, 29881, 29892, 1609, 29922, 29881, 29914, 1460, 15451, 29897, 259, 396, 4443, 270, 29922, 3001, 10809, 310, 7136, 313, 29953, 29900, 4912, 29897, 13, 29937, 12048, 1598, 6597, 2539, 313, 3332, 29899, 3242, 5046, 310, 278, 7136, 29892, 297, 2440, 350, 29925, 29889, 29871, 29896, 29929, 29945, 29900, 29922, 29900, 29933, 29925, 29897, 13, 21111, 2539, 29922, 448, 29945, 29945, 13, 13, 29937, 8251, 350, 3210, 29934, 1164, 15500, 1904, 304, 736, 5868, 29934, 1164, 29903, 313, 262, 2440, 350, 29925, 29897, 13, 13, 29937, 6058, 29923, 29901, 1472, 1065, 931, 281, 11500, 13, 5904, 29933, 29925, 29892, 10809, 29918, 2015, 466, 787, 353, 289, 5904, 29889, 5904, 29898, 1179, 29892, 4928, 29892, 1066, 2187, 29892, 1052, 23902, 1960, 29892, 27711, 9135, 2187, 29892, 21111, 2539, 29897, 13, 13, 29937, 1162, 579, 297, 2440, 14645, 13, 5904, 4741, 353, 7442, 29889, 20157, 572, 29878, 29898, 29896, 29929, 29945, 29900, 448, 17168, 29933, 29925, 29897, 13, 13, 29937, 9166, 9166, 9166, 9166, 4936, 1360, 13, 13, 29937, 29871, 29941, 29889, 29906, 29901, 11597, 3637, 936, 853, 14082, 1017, 8125, 29901, 13, 13, 2158, 525, 2528, 292, 25812, 856, 29915, 13, 29937, 10399, 2186, 1027, 7964, 961, 280, 720, 331, 2407, 313, 21803, 515, 2038, 3987, 29897, 13, 29990, 29922, 27358, 566, 26555, 3594, 13, 29937, 29990, 29922, 29881, 29896, 29947, 29949, 29918, 29893, 29885, 29906, 13, 13, 29937, 29941, 29889, 29906, 29889, 29896, 12545, 8125, 29901, 925, 788, 25812, 22706, 2729, 373, 20039, 16716, 13, 3754, 29922, 29900, 29889, 29896, 396, 3635, 309, 29892, 20039, 29871, 16716, 13, 433, 446, 29918, 21064, 29892, 19437, 29918, 13609, 353, 16114, 936, 29918, 3127, 29918, 12857, 29898, 29990, 29892, 3754, 29897, 13, 13, 29937, 29941, 29889, 29906, 29889, 29906, 22477, 1939, 895, 8125, 363, 16114, 936, 1059, 29901, 13, 3754, 29922, 29900, 29889, 29896, 13, 29937, 1983, 9422, 353, 444, 3896, 1353, 310, 11916, 1244, 13, 433, 446, 29918, 29990, 29876, 29922, 7054, 3637, 936, 29918, 2704, 29898, 29990, 29892, 3754, 29897, 13, 13, 29937, 9166, 9166, 9166, 9166, 2751, 13, 29937, 16913, 6514, 4225, 304, 367, 7160, 13, 2158, 525, 29903, 5555, 848, 856, 29915, 13, 449, 3972, 2433, 6904, 9902, 22208, 13, 9302, 29889, 7620, 29898, 449, 3972, 13578, 433, 446, 29918, 29990, 29876, 29889, 29876, 2272, 613, 433, 446, 29918, 29990, 29876, 29897, 13, 29937, 8809, 5564, 1683, 856, 13, 29937, 9166, 9166, 9166, 9166, 2751, 13, 13, 29937, 3695, 13, 29937, 3695, 13, 29937, 3695, 13, 29937, 3695, 13, 13, 29937, 9166, 9166, 9166, 9166, 2751, 1360, 13, 29937, 365, 29955, 16507, 2891, 29911, 4214, 8528, 19297, 17101, 13, 29937, 9166, 9166, 9166, 9166, 2751, 1360, 13, 13, 29937, 18399, 1259, 29991, 29871, 853, 9342, 304, 6492, 752, 2467, 8722, 13, 13, 29937, 14770, 29889, 3293, 29889, 1509, 877, 1505, 5317, 1495, 13, 13, 29937, 2537, 29906, 353, 14770, 29889, 4532, 29898, 29896, 29897, 13, 13, 29937, 2537, 29906, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29892, 29906, 29892, 29896, 29897, 13, 13, 29937, 14770, 29889, 5317, 29898, 29920, 29892, 2876, 5501, 29890, 1495, 13, 29937, 14770, 29889, 29916, 1643, 29898, 29878, 29915, 8498, 386, 313, 29885, 29897, 742, 5657, 2311, 29922, 29896, 29953, 29897, 13, 29937, 14770, 29889, 29891, 1643, 29898, 29878, 29915, 29925, 272, 359, 537, 20802, 20430, 2876, 10931, 313, 5441, 2222, 29897, 742, 5657, 2311, 29922, 29896, 29953, 29897, 13, 29937, 14770, 29889, 3257, 29898, 29878, 29915, 29925, 272, 359, 537, 20430, 2876, 10931, 20802, 297, 20951, 2073, 10239, 742, 5657, 2311, 29922, 29896, 29953, 29897, 13, 29937, 14770, 29889, 7720, 877, 265, 742, 2780, 2433, 7979, 29891, 1495, 13, 29937, 14770, 29889, 24667, 29918, 7529, 29898, 8990, 2433, 20313, 742, 607, 2433, 21355, 742, 3858, 2311, 29922, 29896, 29946, 29897, 13, 29937, 14770, 29889, 486, 7358, 29898, 5657, 978, 353, 376, 7658, 5990, 983, 1159, 29871, 396, 910, 2980, 674, 1735, 278, 4079, 29889, 13, 29937, 14770, 29889, 3637, 7358, 29898, 5657, 978, 353, 376, 7658, 5990, 983, 1159, 29871, 396, 910, 2980, 674, 1735, 278, 4079, 29889, 13, 13, 29937, 396, 9166, 9166, 9166, 9166, 2751, 1360, 13, 13, 29937, 2537, 29906, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29892, 29906, 29892, 29906, 29897, 13, 29937, 14770, 29889, 5317, 29898, 29920, 29892, 29882, 29918, 10080, 5501, 29878, 742, 1643, 29922, 29878, 29915, 6843, 627, 287, 365, 2747, 1495, 13, 29937, 14770, 29889, 5317, 29898, 29920, 29892, 29882, 5501, 29890, 742, 1643, 29922, 29878, 29915, 12283, 29899, 6843, 627, 287, 8533, 365, 2747, 1495, 13, 29937, 14770, 29889, 29916, 1643, 29898, 29878, 29915, 8498, 386, 313, 29885, 29897, 742, 5657, 2311, 29922, 29896, 29953, 29897, 13, 29937, 14770, 29889, 29891, 1643, 29898, 29878, 29915, 29903, 287, 2073, 22907, 313, 29885, 29897, 742, 5657, 2311, 29922, 29896, 29953, 29897, 13, 29937, 14770, 29889, 3257, 29898, 29878, 29915, 8498, 386, 2522, 744, 281, 29914, 6843, 2467, 297, 20951, 2073, 10239, 742, 5657, 2311, 29922, 29896, 29953, 29897, 13, 29937, 14770, 29889, 7720, 877, 265, 742, 2780, 2433, 7979, 29891, 1495, 13, 29937, 14770, 29889, 24667, 29918, 7529, 29898, 8990, 2433, 20313, 742, 607, 2433, 21355, 742, 3858, 2311, 29922, 29896, 29946, 29897, 13, 29937, 14770, 29889, 486, 7358, 29898, 5657, 978, 353, 376, 7658, 5990, 983, 1159, 29871, 396, 910, 2980, 674, 1735, 278, 4079, 29889, 13, 29937, 14770, 29889, 3637, 7358, 29898, 5657, 978, 353, 376, 7658, 5990, 983, 1159, 29871, 396, 910, 2980, 674, 1735, 278, 4079, 29889, 13, 29937, 14770, 29889, 26172, 29898, 2029, 29922, 29906, 29897, 13, 29937, 14770, 29889, 4294, 580, 13, 13, 13, 29937, 396, 1275, 9166, 9166, 9166, 9166, 2751, 13, 2 ]
beast/plotting/plot_param_vs_chi2min.py
marthaboyer/beast
0
1615763
#!/usr/bin/env python """ Plot the chi2min versus the fit parametrs Used to explore where the bad (and good) fits are located """ from __future__ import (absolute_import, division, print_function, unicode_literals) import matplotlib.pyplot as plt from astropy.table import Table from matplotlib.colors import LogNorm from matplotlib import rc # local imports from .beastplotlib import (fancify_colname, initialize_parser, plot_generic, set_params) def make_param_vs_chi2min_plots(stats, suffix='Exp', figsize=(20,10)): '''Makes a set of 6 diagnostic 2D histograms for BEAST output. Parameters ---------- stats : astropy Table stats table from BEAST run suffix : str, optional Column type ('Exp', 'Best', 'p16', 'p50', 'p84'). Defaults to 'Exp'. figsize : tuple of ints, optional Size of figure to return in inches (width, height). Defaults to (10, 5.5). Returns ------- fig : matplotlib figure object Figure with diagnostic plots ''' base_cnames = ['Av', 'logA', 'M_ini', 'Rv', 'f_A', 'Z'] cnames = ['{}_{}'.format(n, suffix) for n in base_cnames] ycol = 'chi2min' plot_pairs = [[name, ycol] for name in cnames] xlog_decide = [False, False, True, False, False, False] fig, axes = plt.subplots(2, 3, figsize=figsize) ax = axes.ravel() for i, pair in enumerate(plot_pairs): plot_generic(stats, pair[0], pair[1], fig, ax[i], xlog=xlog_decide[i],ylog=True, plot_kwargs={'norm':LogNorm()}) fig.tight_layout() return fig if __name__ == '__main__': parser = initialize_parser() parser.add_argument('filename', type=str, help='Path to FITS file with output stats') suffixes = ['Exp', 'Best', 'p50'] parser.add_argument('--suffix', action='store', default='Exp', choices=suffixes, help='Choose column type to plot. \ Must be one of: "{}"'.format('", "'.join(suffixes)) ) args = parser.parse_args() if args.tex: plt.rc({'usetex':True}) basename = args.filename.replace('.fits', '_diagnostics') set_params(lw=2, fontsize=16, usetex=False) stats = Table.read(args.filename) fig = make_param_vs_chi2min_plots(stats, suffix=args.suffix) if args.savefig: fig.savefig('{}.{}'.format(basename, args.savefig)) else: plt.show()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 20867, 278, 18558, 29906, 1195, 23797, 278, 6216, 25011, 2288, 13, 29965, 8485, 304, 26987, 988, 278, 4319, 313, 392, 1781, 29897, 23994, 526, 5982, 13, 15945, 29908, 13, 3166, 4770, 29888, 9130, 1649, 1053, 313, 23552, 29918, 5215, 29892, 8542, 29892, 1596, 29918, 2220, 29892, 13, 462, 4706, 29104, 29918, 20889, 1338, 29897, 13, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 8717, 14441, 29889, 2371, 1053, 6137, 13, 3166, 22889, 29889, 27703, 1053, 4522, 29940, 555, 13, 3166, 22889, 1053, 364, 29883, 13, 13, 29937, 1887, 24802, 13, 3166, 869, 915, 579, 17357, 1053, 313, 29888, 4564, 1598, 29918, 1054, 978, 29892, 11905, 29918, 16680, 29892, 13, 462, 3986, 6492, 29918, 19206, 29892, 731, 29918, 7529, 29897, 13, 13, 1753, 1207, 29918, 3207, 29918, 4270, 29918, 4161, 29906, 1195, 29918, 26762, 29898, 16202, 29892, 25557, 2433, 9544, 742, 2537, 2311, 7607, 29906, 29900, 29892, 29896, 29900, 22164, 13, 1678, 14550, 29924, 6926, 263, 731, 310, 29871, 29953, 652, 21780, 29871, 29906, 29928, 9825, 468, 25402, 363, 20700, 28938, 1962, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 22663, 584, 8717, 14441, 6137, 13, 4706, 22663, 1591, 515, 20700, 28938, 1065, 13, 1678, 25557, 584, 851, 29892, 13136, 13, 4706, 12481, 1134, 6702, 9544, 742, 525, 25353, 742, 525, 29886, 29896, 29953, 742, 525, 29886, 29945, 29900, 742, 525, 29886, 29947, 29946, 2824, 13, 4706, 13109, 29879, 304, 525, 9544, 4286, 13, 1678, 2537, 2311, 584, 18761, 310, 938, 29879, 29892, 13136, 13, 4706, 21179, 310, 4377, 304, 736, 297, 22831, 313, 2103, 29892, 3171, 467, 13, 4706, 13109, 29879, 304, 313, 29896, 29900, 29892, 29871, 29945, 29889, 29945, 467, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 2537, 584, 22889, 4377, 1203, 13, 4706, 11479, 411, 652, 21780, 24580, 13, 1678, 14550, 13, 13, 1678, 2967, 29918, 29883, 7039, 353, 6024, 12810, 742, 525, 1188, 29909, 742, 525, 29924, 29918, 2172, 742, 525, 29934, 29894, 742, 525, 29888, 29918, 29909, 742, 525, 29999, 2033, 13, 1678, 274, 7039, 353, 6024, 29912, 3227, 29913, 4286, 4830, 29898, 29876, 29892, 25557, 29897, 363, 302, 297, 2967, 29918, 29883, 7039, 29962, 13, 1678, 343, 1054, 353, 525, 4161, 29906, 1195, 29915, 13, 1678, 6492, 29918, 29886, 7121, 353, 5519, 978, 29892, 343, 1054, 29962, 363, 1024, 297, 274, 7039, 29962, 13, 1678, 921, 1188, 29918, 311, 8204, 353, 518, 8824, 29892, 7700, 29892, 5852, 29892, 7700, 29892, 7700, 29892, 7700, 29962, 13, 1678, 2537, 29892, 27815, 353, 14770, 29889, 1491, 26762, 29898, 29906, 29892, 29871, 29941, 29892, 2537, 2311, 29922, 1003, 2311, 29897, 13, 1678, 4853, 353, 27815, 29889, 336, 955, 580, 13, 1678, 363, 474, 29892, 5101, 297, 26985, 29898, 5317, 29918, 29886, 7121, 1125, 13, 4706, 6492, 29918, 19206, 29898, 16202, 29892, 5101, 29961, 29900, 1402, 5101, 29961, 29896, 1402, 2537, 29892, 4853, 29961, 29875, 1402, 13, 462, 268, 921, 1188, 29922, 29916, 1188, 29918, 311, 8204, 29961, 29875, 1402, 29891, 1188, 29922, 5574, 29892, 13, 462, 268, 6492, 29918, 19290, 3790, 29915, 12324, 2396, 3403, 29940, 555, 580, 1800, 13, 1678, 2537, 29889, 29873, 523, 29918, 2680, 580, 13, 1678, 736, 2537, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 11905, 29918, 16680, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 9507, 742, 1134, 29922, 710, 29892, 13, 462, 4706, 1371, 2433, 2605, 304, 383, 1806, 29903, 934, 411, 1962, 22663, 1495, 13, 1678, 25557, 267, 353, 6024, 9544, 742, 525, 25353, 742, 525, 29886, 29945, 29900, 2033, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2146, 600, 861, 742, 3158, 2433, 8899, 742, 2322, 2433, 9544, 742, 13, 462, 4706, 19995, 29922, 2146, 600, 861, 267, 29892, 13, 462, 4706, 1371, 2433, 15954, 852, 1897, 1134, 304, 6492, 29889, 320, 13, 462, 4706, 19928, 367, 697, 310, 29901, 29850, 5038, 4286, 4830, 877, 613, 376, 4286, 7122, 29898, 2146, 600, 861, 267, 876, 13, 462, 4706, 1723, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 565, 6389, 29889, 4776, 29901, 13, 4706, 14770, 29889, 2214, 3319, 29915, 11616, 735, 2396, 5574, 1800, 13, 1678, 2362, 3871, 353, 6389, 29889, 9507, 29889, 6506, 12839, 29888, 1169, 742, 22868, 6051, 20921, 1495, 13, 13, 1678, 731, 29918, 7529, 29898, 29880, 29893, 29922, 29906, 29892, 4079, 2311, 29922, 29896, 29953, 29892, 502, 300, 735, 29922, 8824, 29897, 13, 13, 1678, 22663, 353, 6137, 29889, 949, 29898, 5085, 29889, 9507, 29897, 13, 1678, 2537, 353, 1207, 29918, 3207, 29918, 4270, 29918, 4161, 29906, 1195, 29918, 26762, 29898, 16202, 29892, 25557, 29922, 5085, 29889, 2146, 600, 861, 29897, 13, 13, 1678, 565, 6389, 29889, 7620, 1003, 29901, 13, 4706, 2537, 29889, 7620, 1003, 877, 29912, 1836, 8875, 4286, 4830, 29898, 6500, 3871, 29892, 6389, 29889, 7620, 1003, 876, 13, 1678, 1683, 29901, 13, 4706, 14770, 29889, 4294, 580, 13, 2 ]
app.py
Tokky-tane/todo_server
0
39672
<gh_stars>0 import os import datetime import dateutil.parser from flask import Flask, request, Response from flask_api import status from database import close_db from crud_task import get_all_tasks, delete_all_tasks, create_task, delete_user_tasks, get_user_tasks, delete_task, get_task, update_task, exist_task import firebase_admin from firebase_admin import credentials, auth from dotenv import find_dotenv, load_dotenv app = Flask(__name__) app.teardown_appcontext(close_db) load_dotenv(find_dotenv()) cred = credentials.Certificate({ "type": os.environ['FIREBASE_TYPE'], "project_id": os.environ['FIREBASE_PROJECT_ID'], "private_key_id": os.environ['FIREBASE_PRIVATE_KEY_ID'], "private_key": os.environ['FIREBASE_PRIVATE_KEY'].replace('\\n', '\n'), "client_email": os.environ['FIREBASE_CLIENT_EMAIL'], "client_id": os.environ['FIREBASE_CLIENT_ID'], "auth_uri": os.environ['FIREBASE_AUTH_URI'], "token_uri": os.environ['FIREBASE_TOKEN_URI'], "auth_provider_x509_cert_url": os.environ['FIREBASE_AUTH_PROVIDER_CERT_URL'], "client_x509_cert_url": os.environ['FIREBASE_CLIENT_CERT_URL'] }) firebase_admin.initialize_app(cred) @app.route('/users/me/tasks', methods=['GET', 'POST', 'DELETE']) def route_users_tasks(): token = request.headers.get('Authorization') try: user_id = auth.verify_id_token(token)['uid'] except ValueError: return '', status.HTTP_401_UNAUTHORIZED except auth.AuthError: return '', status.HTTP_401_UNAUTHORIZED if request.method == 'GET': updated_at_min = request.args.get('updated_at_min') datetime_updated_at_min = None if(updated_at_min is not None): datetime_updated_at_min = dateutil.parser.isoparse(updated_at_min) tasks = get_user_tasks(user_id, datetime_updated_at_min) response = Response(mimetype='applicaiotn/json') response.set_data(tasks) return response elif request.method == 'POST': title = request.json['title'] due_date = request.json['due_date'] if(due_date is not None): due_date = dateutil.parser.isoparse(due_date) id = create_task(user_id, title, due_date) location = '/users/me/tasks/{}'.format(id) response = Response(status=status.HTTP_201_CREATED) response.headers['location'] = location return response else: delete_user_tasks(user_id) return Response(status=status.HTTP_204_NO_CONTENT) @app.route('/users/me/tasks/<int:task_id>', methods=['GET', 'PUT', 'DELETE']) def route_task(task_id): token = request.headers.get('Authorization') try: auth.verify_id_token(token) except ValueError: return '', status.HTTP_401_UNAUTHORIZED except auth.AuthError: return '', status.HTTP_401_UNAUTHORIZED if exist_task(task_id) == False: return Response(status=status.HTTP_404_NOT_FOUND) if request.method == 'GET': task = get_task(task_id) response = Response(mimetype='application/json') response.set_data(task) return response elif request.method == 'PUT': title = request.json['title'] due_date = request.json['due_date'] update_task(task_id, title, due_date) return '', status.HTTP_200_OK else: delete_task(task_id) return '', status.HTTP_204_NO_CONTENT
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 5215, 12865, 13, 5215, 2635, 4422, 29889, 16680, 13, 3166, 29784, 1053, 2379, 1278, 29892, 2009, 29892, 13291, 13, 3166, 29784, 29918, 2754, 1053, 4660, 13, 3166, 2566, 1053, 3802, 29918, 2585, 13, 3166, 2181, 566, 29918, 7662, 1053, 679, 29918, 497, 29918, 20673, 29892, 5217, 29918, 497, 29918, 20673, 29892, 1653, 29918, 7662, 29892, 5217, 29918, 1792, 29918, 20673, 29892, 679, 29918, 1792, 29918, 20673, 29892, 5217, 29918, 7662, 29892, 679, 29918, 7662, 29892, 2767, 29918, 7662, 29892, 1863, 29918, 7662, 13, 5215, 16119, 29918, 6406, 13, 3166, 16119, 29918, 6406, 1053, 16140, 29892, 4817, 13, 3166, 8329, 6272, 1053, 1284, 29918, 6333, 6272, 29892, 2254, 29918, 6333, 6272, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 932, 29889, 371, 538, 776, 29918, 932, 4703, 29898, 5358, 29918, 2585, 29897, 13, 1359, 29918, 6333, 6272, 29898, 2886, 29918, 6333, 6272, 3101, 13, 13, 11944, 353, 16140, 29889, 20455, 8021, 3319, 13, 1678, 376, 1853, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 11116, 7464, 13, 1678, 376, 4836, 29918, 333, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 8618, 17637, 29918, 1367, 7464, 13, 1678, 376, 9053, 29918, 1989, 29918, 333, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 29829, 29963, 3040, 29918, 10818, 29918, 1367, 7464, 13, 1678, 376, 9053, 29918, 1989, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 29829, 29963, 3040, 29918, 10818, 13359, 6506, 877, 1966, 29876, 742, 11297, 29876, 5477, 13, 1678, 376, 4645, 29918, 5269, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 27205, 3919, 29918, 26862, 6227, 7464, 13, 1678, 376, 4645, 29918, 333, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 27205, 3919, 29918, 1367, 7464, 13, 1678, 376, 5150, 29918, 5338, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 20656, 29950, 29918, 15551, 7464, 13, 1678, 376, 6979, 29918, 5338, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 4986, 29968, 1430, 29918, 15551, 7464, 13, 1678, 376, 5150, 29918, 18121, 29918, 29916, 29945, 29900, 29929, 29918, 6327, 29918, 2271, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 20656, 29950, 29918, 8618, 13044, 1001, 29918, 29907, 20161, 29918, 4219, 7464, 13, 1678, 376, 4645, 29918, 29916, 29945, 29900, 29929, 29918, 6327, 29918, 2271, 1115, 2897, 29889, 21813, 1839, 3738, 1525, 25416, 29918, 27205, 3919, 29918, 29907, 20161, 29918, 4219, 2033, 13, 1800, 13, 17445, 29918, 6406, 29889, 24926, 29918, 932, 29898, 11944, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 7193, 29914, 1004, 29914, 20673, 742, 3519, 29922, 1839, 7194, 742, 525, 5438, 742, 525, 2287, 18476, 11287, 13, 1753, 5782, 29918, 7193, 29918, 20673, 7295, 13, 1678, 5993, 353, 2009, 29889, 13662, 29889, 657, 877, 25471, 1495, 13, 1678, 1018, 29901, 13, 4706, 1404, 29918, 333, 353, 4817, 29889, 27902, 29918, 333, 29918, 6979, 29898, 6979, 29897, 1839, 5416, 2033, 13, 1678, 5174, 7865, 2392, 29901, 13, 4706, 736, 15516, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 13, 1678, 5174, 4817, 29889, 6444, 2392, 29901, 13, 4706, 736, 15516, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 13, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 7194, 2396, 13, 4706, 4784, 29918, 271, 29918, 1195, 353, 2009, 29889, 5085, 29889, 657, 877, 21402, 29918, 271, 29918, 1195, 1495, 13, 13, 4706, 12865, 29918, 21402, 29918, 271, 29918, 1195, 353, 6213, 13, 4706, 565, 29898, 21402, 29918, 271, 29918, 1195, 338, 451, 6213, 1125, 13, 9651, 12865, 29918, 21402, 29918, 271, 29918, 1195, 353, 2635, 4422, 29889, 16680, 29889, 275, 459, 7989, 29898, 21402, 29918, 271, 29918, 1195, 29897, 13, 13, 4706, 9595, 353, 679, 29918, 1792, 29918, 20673, 29898, 1792, 29918, 333, 29892, 12865, 29918, 21402, 29918, 271, 29918, 1195, 29897, 13, 13, 4706, 2933, 353, 13291, 29898, 29885, 17528, 668, 2433, 932, 506, 1794, 327, 29876, 29914, 3126, 1495, 13, 4706, 2933, 29889, 842, 29918, 1272, 29898, 20673, 29897, 13, 4706, 736, 2933, 13, 13, 1678, 25342, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 3611, 353, 2009, 29889, 3126, 1839, 3257, 2033, 13, 4706, 2861, 29918, 1256, 353, 2009, 29889, 3126, 1839, 29123, 29918, 1256, 2033, 13, 13, 4706, 565, 29898, 29123, 29918, 1256, 338, 451, 6213, 1125, 13, 9651, 2861, 29918, 1256, 353, 2635, 4422, 29889, 16680, 29889, 275, 459, 7989, 29898, 29123, 29918, 1256, 29897, 13, 13, 4706, 1178, 353, 1653, 29918, 7662, 29898, 1792, 29918, 333, 29892, 3611, 29892, 2861, 29918, 1256, 29897, 13, 4706, 4423, 353, 8207, 7193, 29914, 1004, 29914, 20673, 29914, 8875, 4286, 4830, 29898, 333, 29897, 13, 4706, 2933, 353, 13291, 29898, 4882, 29922, 4882, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 29897, 13, 4706, 2933, 29889, 13662, 1839, 5479, 2033, 353, 4423, 13, 13, 4706, 736, 2933, 13, 13, 1678, 1683, 29901, 13, 4706, 5217, 29918, 1792, 29918, 20673, 29898, 1792, 29918, 333, 29897, 13, 4706, 736, 13291, 29898, 4882, 29922, 4882, 29889, 10493, 29918, 29906, 29900, 29946, 29918, 6632, 29918, 22412, 3919, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 7193, 29914, 1004, 29914, 20673, 29914, 29966, 524, 29901, 7662, 29918, 333, 29958, 742, 3519, 29922, 1839, 7194, 742, 525, 12336, 742, 525, 2287, 18476, 11287, 13, 1753, 5782, 29918, 7662, 29898, 7662, 29918, 333, 1125, 13, 1678, 5993, 353, 2009, 29889, 13662, 29889, 657, 877, 25471, 1495, 13, 1678, 1018, 29901, 13, 4706, 4817, 29889, 27902, 29918, 333, 29918, 6979, 29898, 6979, 29897, 13, 1678, 5174, 7865, 2392, 29901, 13, 4706, 736, 15516, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 13, 1678, 5174, 4817, 29889, 6444, 2392, 29901, 13, 4706, 736, 15516, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 13, 13, 1678, 565, 1863, 29918, 7662, 29898, 7662, 29918, 333, 29897, 1275, 7700, 29901, 13, 4706, 736, 13291, 29898, 4882, 29922, 4882, 29889, 10493, 29918, 29946, 29900, 29946, 29918, 12256, 29918, 5800, 18783, 29897, 13, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 7194, 2396, 13, 4706, 3414, 353, 679, 29918, 7662, 29898, 7662, 29918, 333, 29897, 13, 13, 4706, 2933, 353, 13291, 29898, 29885, 17528, 668, 2433, 6214, 29914, 3126, 1495, 13, 4706, 2933, 29889, 842, 29918, 1272, 29898, 7662, 29897, 13, 4706, 736, 2933, 13, 13, 1678, 25342, 2009, 29889, 5696, 1275, 525, 12336, 2396, 13, 4706, 3611, 353, 2009, 29889, 3126, 1839, 3257, 2033, 13, 4706, 2861, 29918, 1256, 353, 2009, 29889, 3126, 1839, 29123, 29918, 1256, 2033, 13, 13, 4706, 2767, 29918, 7662, 29898, 7662, 29918, 333, 29892, 3611, 29892, 2861, 29918, 1256, 29897, 13, 13, 4706, 736, 15516, 4660, 29889, 10493, 29918, 29906, 29900, 29900, 29918, 8949, 13, 13, 1678, 1683, 29901, 13, 4706, 5217, 29918, 7662, 29898, 7662, 29918, 333, 29897, 13, 4706, 736, 15516, 4660, 29889, 10493, 29918, 29906, 29900, 29946, 29918, 6632, 29918, 22412, 3919, 13, 2 ]
utils/search_methods/__init__.py
Yzx835/AISafety
0
1606087
<gh_stars>0 # !/usr/bin/env python # coding=UTF-8 """ @Author: <NAME> @LastEditors: <NAME> @Description: @Date: 2021-07-23 @LastEditTime: 2021-09-08 """ from .base import SearchMethod from .word_importance_ranking import WordImportanceRanking from .beam_search import BeamSearch, GreedySearch from .population_based_search import PopulationBasedSearch from .genetic_algorithm_base import GeneticAlgorithmBase from .alzantot_genetic_algorithm import AlzantotGeneticAlgorithm from .improved_genetic_algorithm import ImprovedGeneticAlgorithm from .particle_swarm_optimization import ParticleSwarmOptimization __all__ = [ "SearchMethod", "WordImportanceRanking", "BeamSearch", "GreedySearch", "PopulationBasedSearch", "GeneticAlgorithmBase", "AlzantotGeneticAlgorithm", "ImprovedGeneticAlgorithm", "ParticleSwarmOptimization", ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 1738, 29914, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29922, 10496, 29899, 29947, 13, 15945, 29908, 13, 29992, 13720, 29901, 529, 5813, 29958, 13, 29992, 8897, 6103, 943, 29901, 529, 5813, 29958, 13, 29992, 9868, 29901, 13, 29992, 2539, 29901, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29955, 29899, 29906, 29941, 13, 29992, 8897, 6103, 2481, 29901, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29929, 29899, 29900, 29947, 13, 15945, 29908, 13, 13, 3166, 869, 3188, 1053, 11856, 4062, 13, 3166, 869, 1742, 29918, 5215, 749, 29918, 661, 9292, 1053, 10803, 17518, 749, 29934, 804, 292, 13, 3166, 869, 915, 314, 29918, 4478, 1053, 1522, 314, 7974, 29892, 4122, 7584, 7974, 13, 3166, 869, 7323, 2785, 29918, 6707, 29918, 4478, 1053, 24810, 29933, 1463, 7974, 13, 3166, 869, 1885, 7492, 29918, 20567, 29918, 3188, 1053, 5739, 7492, 22461, 4540, 5160, 13, 3166, 869, 284, 29920, 424, 327, 29918, 1885, 7492, 29918, 20567, 1053, 838, 29920, 424, 327, 15462, 7492, 22461, 4540, 13, 3166, 869, 326, 771, 1490, 29918, 1885, 7492, 29918, 20567, 1053, 1954, 771, 1490, 15462, 7492, 22461, 4540, 13, 3166, 869, 1595, 2512, 29918, 2774, 2817, 29918, 20640, 2133, 1053, 3455, 2512, 10840, 2817, 20624, 326, 2133, 13, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 376, 7974, 4062, 613, 13, 1678, 376, 14463, 17518, 749, 29934, 804, 292, 613, 13, 1678, 376, 3629, 314, 7974, 613, 13, 1678, 376, 25120, 7584, 7974, 613, 13, 1678, 376, 12310, 2785, 29933, 1463, 7974, 613, 13, 1678, 376, 15462, 7492, 22461, 4540, 5160, 613, 13, 1678, 376, 2499, 29920, 424, 327, 15462, 7492, 22461, 4540, 613, 13, 1678, 376, 1888, 771, 1490, 15462, 7492, 22461, 4540, 613, 13, 1678, 376, 7439, 2512, 10840, 2817, 20624, 326, 2133, 613, 13, 29962, 13, 2 ]
datacode/summarize/subset/missing/detail/textfuncs.py
nickderobertis/data-code
0
1606759
<reponame>nickderobertis/data-code<gh_stars>0 from datacode.typing import IntOrNone, FloatOrNone, Union def missing_more_than_str(missing_tolerance: IntOrNone, missing_quantile: FloatOrNone, missing_display_str: str, id_var: str) -> str: return f'More than {_t_or_q(missing_tolerance, missing_quantile)} {missing_display_str} {id_var}' def missing_more_than_pct_str(missing_tolerance: IntOrNone, missing_quantile: FloatOrNone, missing_display_str: str, id_var: str) -> str: return f'More than {_t_or_q(missing_tolerance, missing_quantile)} {missing_display_str} {id_var} Percentage' def missing_tolerance_count_str(missing_tolerance: IntOrNone, missing_quantile: FloatOrNone, missing_display_str: str, id_var: str) -> str: return f'{_t_or_q(missing_tolerance, missing_quantile)} or less {missing_display_str} {id_var} Count' def id_count_str(id_var: str) -> str: return f'{id_var} Count' def num_or_pct(missing_tolerance: IntOrNone, missing_quantile: FloatOrNone) -> str: if missing_quantile is not None: return '%' return '#' def num_or_pct_word(missing_tolerance: IntOrNone, missing_quantile: FloatOrNone) -> str: if missing_quantile is not None: return 'percentage' return 'number' def pct_of_if_necessary(missing_tolerance: IntOrNone, missing_quantile: FloatOrNone) -> str: if missing_quantile is not None: return '% of' return '' def _t_or_q(missing_tolerance: IntOrNone, missing_quantile: FloatOrNone) -> Union[int, str]: if missing_quantile is not None: return f'{missing_quantile * 100:g}%' return missing_tolerance
[ 1, 529, 276, 1112, 420, 29958, 19254, 672, 29877, 2151, 275, 29914, 1272, 29899, 401, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 848, 401, 29889, 1017, 15702, 1053, 3159, 2816, 8516, 29892, 27842, 2816, 8516, 29892, 7761, 13, 13, 1753, 4567, 29918, 5514, 29918, 27603, 29918, 710, 29898, 27259, 29918, 25027, 261, 749, 29901, 3159, 2816, 8516, 29892, 4567, 29918, 12150, 488, 29901, 27842, 2816, 8516, 29892, 13, 462, 3986, 4567, 29918, 4990, 29918, 710, 29901, 851, 29892, 1178, 29918, 1707, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 736, 285, 29915, 20761, 1135, 426, 29918, 29873, 29918, 272, 29918, 29939, 29898, 27259, 29918, 25027, 261, 749, 29892, 4567, 29918, 12150, 488, 2915, 426, 27259, 29918, 4990, 29918, 710, 29913, 426, 333, 29918, 1707, 10162, 13, 13, 1753, 4567, 29918, 5514, 29918, 27603, 29918, 29886, 312, 29918, 710, 29898, 27259, 29918, 25027, 261, 749, 29901, 3159, 2816, 8516, 29892, 4567, 29918, 12150, 488, 29901, 27842, 2816, 8516, 29892, 13, 462, 795, 4567, 29918, 4990, 29918, 710, 29901, 851, 29892, 1178, 29918, 1707, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 736, 285, 29915, 20761, 1135, 426, 29918, 29873, 29918, 272, 29918, 29939, 29898, 27259, 29918, 25027, 261, 749, 29892, 4567, 29918, 12150, 488, 2915, 426, 27259, 29918, 4990, 29918, 710, 29913, 426, 333, 29918, 1707, 29913, 2431, 1760, 482, 29915, 13, 13, 1753, 4567, 29918, 25027, 261, 749, 29918, 2798, 29918, 710, 29898, 27259, 29918, 25027, 261, 749, 29901, 3159, 2816, 8516, 29892, 4567, 29918, 12150, 488, 29901, 27842, 2816, 8516, 29892, 13, 462, 18884, 4567, 29918, 4990, 29918, 710, 29901, 851, 29892, 1178, 29918, 1707, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 736, 285, 29915, 29912, 29918, 29873, 29918, 272, 29918, 29939, 29898, 27259, 29918, 25027, 261, 749, 29892, 4567, 29918, 12150, 488, 2915, 470, 3109, 426, 27259, 29918, 4990, 29918, 710, 29913, 426, 333, 29918, 1707, 29913, 3917, 29915, 13, 13, 1753, 1178, 29918, 2798, 29918, 710, 29898, 333, 29918, 1707, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 736, 285, 29915, 29912, 333, 29918, 1707, 29913, 3917, 29915, 13, 13, 1753, 954, 29918, 272, 29918, 29886, 312, 29898, 27259, 29918, 25027, 261, 749, 29901, 3159, 2816, 8516, 29892, 4567, 29918, 12150, 488, 29901, 27842, 2816, 8516, 29897, 1599, 851, 29901, 13, 1678, 565, 4567, 29918, 12150, 488, 338, 451, 6213, 29901, 13, 4706, 736, 14210, 29915, 13, 13, 1678, 736, 16321, 29915, 13, 13, 1753, 954, 29918, 272, 29918, 29886, 312, 29918, 1742, 29898, 27259, 29918, 25027, 261, 749, 29901, 3159, 2816, 8516, 29892, 4567, 29918, 12150, 488, 29901, 27842, 2816, 8516, 29897, 1599, 851, 29901, 13, 1678, 565, 4567, 29918, 12150, 488, 338, 451, 6213, 29901, 13, 4706, 736, 525, 25376, 482, 29915, 13, 13, 1678, 736, 525, 4537, 29915, 13, 13, 1753, 282, 312, 29918, 974, 29918, 361, 29918, 15107, 653, 29898, 27259, 29918, 25027, 261, 749, 29901, 3159, 2816, 8516, 29892, 4567, 29918, 12150, 488, 29901, 27842, 2816, 8516, 29897, 1599, 851, 29901, 13, 1678, 565, 4567, 29918, 12150, 488, 338, 451, 6213, 29901, 13, 4706, 736, 14210, 310, 29915, 13, 13, 1678, 736, 6629, 13, 13, 1753, 903, 29873, 29918, 272, 29918, 29939, 29898, 27259, 29918, 25027, 261, 749, 29901, 3159, 2816, 8516, 29892, 4567, 29918, 12150, 488, 29901, 27842, 2816, 8516, 29897, 1599, 7761, 29961, 524, 29892, 851, 5387, 13, 1678, 565, 4567, 29918, 12150, 488, 338, 451, 6213, 29901, 13, 4706, 736, 285, 29915, 29912, 27259, 29918, 12150, 488, 334, 29871, 29896, 29900, 29900, 29901, 29887, 10560, 29915, 13, 13, 1678, 736, 4567, 29918, 25027, 261, 749, 2 ]
loss/combine_loss.py
shijun18/RS_SEG20
4
70035
import torch import torch.nn as nn import torch.nn.functional as F from loss.dice_loss import DiceLoss from loss.cross_entropy import CrossentropyLoss, TopKLoss class BCEPlusDice(nn.Module): """Dice loss, need one hot encode input Args: weight: An array of shape [num_classes,] ignore_index: class index to ignore predict: A list of two tensors target: A list of two tensors other args pass to BinaryDiceLoss Return: combination loss, dice plus bce """ def __init__(self, weight=None, ignore_index=None, **kwargs): super(BCEPlusDice, self).__init__() self.kwargs = kwargs self.weight = weight self.ignore_index = ignore_index def forward(self, predict, target): assert isinstance(predict,list) assert isinstance(target,list) assert len(predict) == len(target) and len(predict) == 2 dice = DiceLoss(weight=self.weight,ignore_index=self.ignore_index,**self.kwargs) dice_loss = dice(predict[1],target[1]) bce = nn.BCEWithLogitsLoss(self.weight) bce_loss = bce(predict[0],target[0]) total_loss = bce_loss + dice_loss return total_loss #---------------------------------seg loss--------------------------------- class CEPlusDice(nn.Module): """Dice loss, need one hot encode input Args: weight: An array of shape [num_classes,] ignore_index: class index to ignore predict: A list of two tensors target: A list of two tensors other args pass to BinaryDiceLoss Return: combination loss, dice plus cross entropy """ def __init__(self, weight=None, ignore_index=None, **kwargs): super(CEPlusDice, self).__init__() self.kwargs = kwargs self.weight = weight self.ignore_index = ignore_index def forward(self, predict, target): # print(predict.size()) # print(target.size()) assert predict.size() == target.size() dice = DiceLoss(weight=self.weight,ignore_index=self.ignore_index,**self.kwargs) dice_loss = dice(predict,target) ce = CrossentropyLoss(weight=self.weight) ce_loss = ce(predict,target) total_loss = ce_loss + dice_loss return total_loss class CEPlusTopkDice(nn.Module): """Dice loss, need one hot encode input Args: weight: An array of shape [num_classes,] ignore_index: class index to ignore predict: A list of two tensors target: A list of two tensors other args pass to BinaryDiceLoss Return: combination loss, dice plus cross entropy """ def __init__(self, weight=None, ignore_index=None, **kwargs): super(CEPlusTopkDice, self).__init__() self.kwargs = kwargs self.weight = weight self.ignore_index = ignore_index def forward(self, predict, target): # print(predict.size()) # print(target.size()) assert predict.size() == target.size() dice = DiceLoss(weight=self.weight,ignore_index=self.ignore_index,**self.kwargs) dice_loss = dice(predict,target) ce = CrossentropyLoss(weight=self.weight) ce_loss = ce(predict,target) total_loss = ce_loss + dice_loss return total_loss class TopkCEPlusDice(nn.Module): """Dice loss, need one hot encode input Args: weight: An array of shape [num_classes,] ignore_index: class index to ignore predict: A list of two tensors target: A list of two tensors other args pass to BinaryDiceLoss Return: combination loss, dice plus topk cross entropy """ def __init__(self, weight=None, ignore_index=None, **kwargs): super(TopkCEPlusDice, self).__init__() self.kwargs = kwargs self.weight = weight self.ignore_index = ignore_index def forward(self, predict, target): assert predict.size() == target.size() dice = DiceLoss(weight=self.weight,ignore_index=self.ignore_index,**self.kwargs) dice_loss = dice(predict,target) topk = TopKLoss(weight=self.weight,**self.kwargs) topk_loss = topk(predict,target) total_loss = topk_loss + dice_loss return total_loss class TopkCEPlusTopkDice(nn.Module): """Dice loss, need one hot encode input Args: weight: An array of shape [num_classes,] ignore_index: class index to ignore predict: A list of two tensors target: A list of two tensors other args pass to BinaryDiceLoss Return: combination loss, dice plus topk cross entropy """ def __init__(self, weight=None, ignore_index=None, **kwargs): super(TopkCEPlusTopkDice, self).__init__() self.kwargs = kwargs self.weight = weight self.ignore_index = ignore_index def forward(self, predict, target): assert predict.size() == target.size() dice = DiceLoss(weight=self.weight,ignore_index=self.ignore_index,**self.kwargs) dice_loss = dice(predict,target) topk = TopKLoss(weight=self.weight,k=50) topk_loss = topk(predict,target) total_loss = topk_loss + dice_loss return total_loss
[ 1, 1053, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 13, 3166, 6410, 29889, 29881, 625, 29918, 6758, 1053, 360, 625, 29931, 2209, 13, 3166, 6410, 29889, 19128, 29918, 296, 14441, 1053, 29871, 11189, 296, 14441, 29931, 2209, 29892, 7488, 29968, 29931, 2209, 13, 13, 1990, 350, 4741, 29575, 29928, 625, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 29928, 625, 6410, 29892, 817, 697, 7375, 19750, 1881, 13, 1678, 826, 3174, 29901, 13, 4706, 7688, 29901, 530, 1409, 310, 8267, 518, 1949, 29918, 13203, 26073, 13, 4706, 11455, 29918, 2248, 29901, 770, 2380, 304, 11455, 13, 4706, 8500, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 3646, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 916, 6389, 1209, 304, 29479, 29928, 625, 29931, 2209, 13, 1678, 7106, 29901, 13, 4706, 10296, 6410, 29892, 17629, 2298, 289, 346, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7688, 29922, 8516, 29892, 11455, 29918, 2248, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 29933, 4741, 29575, 29928, 625, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 19290, 353, 9049, 5085, 13, 4706, 1583, 29889, 7915, 353, 7688, 13, 4706, 1583, 29889, 17281, 29918, 2248, 353, 11455, 29918, 2248, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 8500, 29892, 3646, 1125, 13, 13, 4706, 4974, 338, 8758, 29898, 27711, 29892, 1761, 29897, 13, 4706, 4974, 338, 8758, 29898, 5182, 29892, 1761, 29897, 13, 4706, 4974, 7431, 29898, 27711, 29897, 1275, 7431, 29898, 5182, 29897, 322, 7431, 29898, 27711, 29897, 1275, 29871, 29906, 13, 13, 4706, 17629, 353, 360, 625, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29892, 17281, 29918, 2248, 29922, 1311, 29889, 17281, 29918, 2248, 29892, 1068, 1311, 29889, 19290, 29897, 13, 4706, 17629, 29918, 6758, 353, 17629, 29898, 27711, 29961, 29896, 1402, 5182, 29961, 29896, 2314, 13, 13, 4706, 289, 346, 353, 302, 29876, 29889, 29933, 4741, 3047, 3403, 1169, 29931, 2209, 29898, 1311, 29889, 7915, 29897, 13, 4706, 289, 346, 29918, 6758, 353, 289, 346, 29898, 27711, 29961, 29900, 1402, 5182, 29961, 29900, 2314, 13, 308, 13, 4706, 3001, 29918, 6758, 353, 289, 346, 29918, 6758, 718, 17629, 29918, 6758, 13, 13, 4706, 736, 3001, 29918, 6758, 13, 13, 29937, 2683, 2683, 29899, 10199, 6410, 2683, 2683, 29899, 13, 1990, 14645, 29575, 29928, 625, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 29928, 625, 6410, 29892, 817, 697, 7375, 19750, 1881, 13, 1678, 826, 3174, 29901, 13, 4706, 7688, 29901, 530, 1409, 310, 8267, 518, 1949, 29918, 13203, 26073, 13, 4706, 11455, 29918, 2248, 29901, 770, 2380, 304, 11455, 13, 4706, 8500, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 3646, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 916, 6389, 1209, 304, 29479, 29928, 625, 29931, 2209, 13, 1678, 7106, 29901, 13, 4706, 10296, 6410, 29892, 17629, 2298, 4891, 24687, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7688, 29922, 8516, 29892, 11455, 29918, 2248, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 4741, 29575, 29928, 625, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 19290, 353, 9049, 5085, 13, 4706, 1583, 29889, 7915, 353, 7688, 13, 4706, 1583, 29889, 17281, 29918, 2248, 353, 11455, 29918, 2248, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 8500, 29892, 3646, 1125, 13, 4706, 396, 1596, 29898, 27711, 29889, 2311, 3101, 13, 4706, 396, 1596, 29898, 5182, 29889, 2311, 3101, 13, 4706, 4974, 8500, 29889, 2311, 580, 1275, 3646, 29889, 2311, 580, 13, 4706, 17629, 353, 360, 625, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29892, 17281, 29918, 2248, 29922, 1311, 29889, 17281, 29918, 2248, 29892, 1068, 1311, 29889, 19290, 29897, 13, 4706, 17629, 29918, 6758, 353, 17629, 29898, 27711, 29892, 5182, 29897, 13, 13, 4706, 2257, 353, 11189, 296, 14441, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29897, 13, 4706, 2257, 29918, 6758, 353, 2257, 29898, 27711, 29892, 5182, 29897, 13, 308, 13, 4706, 3001, 29918, 6758, 353, 2257, 29918, 6758, 718, 17629, 29918, 6758, 13, 13, 4706, 736, 3001, 29918, 6758, 13, 13, 13, 13, 1990, 14645, 29575, 7031, 29895, 29928, 625, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 29928, 625, 6410, 29892, 817, 697, 7375, 19750, 1881, 13, 1678, 826, 3174, 29901, 13, 4706, 7688, 29901, 530, 1409, 310, 8267, 518, 1949, 29918, 13203, 26073, 13, 4706, 11455, 29918, 2248, 29901, 770, 2380, 304, 11455, 13, 4706, 8500, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 3646, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 916, 6389, 1209, 304, 29479, 29928, 625, 29931, 2209, 13, 1678, 7106, 29901, 13, 4706, 10296, 6410, 29892, 17629, 2298, 4891, 24687, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7688, 29922, 8516, 29892, 11455, 29918, 2248, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 4741, 29575, 7031, 29895, 29928, 625, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 19290, 353, 9049, 5085, 13, 4706, 1583, 29889, 7915, 353, 7688, 13, 4706, 1583, 29889, 17281, 29918, 2248, 353, 11455, 29918, 2248, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 8500, 29892, 3646, 1125, 13, 4706, 396, 1596, 29898, 27711, 29889, 2311, 3101, 13, 4706, 396, 1596, 29898, 5182, 29889, 2311, 3101, 13, 4706, 4974, 8500, 29889, 2311, 580, 1275, 3646, 29889, 2311, 580, 13, 4706, 17629, 353, 360, 625, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29892, 17281, 29918, 2248, 29922, 1311, 29889, 17281, 29918, 2248, 29892, 1068, 1311, 29889, 19290, 29897, 13, 4706, 17629, 29918, 6758, 353, 17629, 29898, 27711, 29892, 5182, 29897, 13, 13, 4706, 2257, 353, 11189, 296, 14441, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29897, 13, 4706, 2257, 29918, 6758, 353, 2257, 29898, 27711, 29892, 5182, 29897, 13, 308, 13, 4706, 3001, 29918, 6758, 353, 2257, 29918, 6758, 718, 17629, 29918, 6758, 13, 13, 4706, 736, 3001, 29918, 6758, 13, 13, 1990, 7488, 29895, 4741, 29575, 29928, 625, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 29928, 625, 6410, 29892, 817, 697, 7375, 19750, 1881, 13, 1678, 826, 3174, 29901, 13, 4706, 7688, 29901, 530, 1409, 310, 8267, 518, 1949, 29918, 13203, 26073, 13, 4706, 11455, 29918, 2248, 29901, 770, 2380, 304, 11455, 13, 4706, 8500, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 3646, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 916, 6389, 1209, 304, 29479, 29928, 625, 29931, 2209, 13, 1678, 7106, 29901, 13, 4706, 10296, 6410, 29892, 17629, 2298, 2246, 29895, 4891, 24687, 29871, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7688, 29922, 8516, 29892, 11455, 29918, 2248, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 7031, 29895, 4741, 29575, 29928, 625, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 19290, 353, 9049, 5085, 13, 4706, 1583, 29889, 7915, 353, 7688, 13, 4706, 1583, 29889, 17281, 29918, 2248, 353, 11455, 29918, 2248, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 8500, 29892, 3646, 1125, 13, 13, 4706, 4974, 8500, 29889, 2311, 580, 1275, 3646, 29889, 2311, 580, 13, 4706, 17629, 353, 360, 625, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29892, 17281, 29918, 2248, 29922, 1311, 29889, 17281, 29918, 2248, 29892, 1068, 1311, 29889, 19290, 29897, 13, 4706, 17629, 29918, 6758, 353, 17629, 29898, 27711, 29892, 5182, 29897, 13, 13, 4706, 2246, 29895, 353, 7488, 29968, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29892, 1068, 1311, 29889, 19290, 29897, 13, 4706, 2246, 29895, 29918, 6758, 353, 2246, 29895, 29898, 27711, 29892, 5182, 29897, 13, 308, 13, 4706, 3001, 29918, 6758, 353, 2246, 29895, 29918, 6758, 718, 17629, 29918, 6758, 13, 13, 4706, 736, 3001, 29918, 6758, 13, 13, 13, 1990, 7488, 29895, 4741, 29575, 7031, 29895, 29928, 625, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 29928, 625, 6410, 29892, 817, 697, 7375, 19750, 1881, 13, 1678, 826, 3174, 29901, 13, 4706, 7688, 29901, 530, 1409, 310, 8267, 518, 1949, 29918, 13203, 26073, 13, 4706, 11455, 29918, 2248, 29901, 770, 2380, 304, 11455, 13, 4706, 8500, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 3646, 29901, 319, 1051, 310, 1023, 25187, 943, 13, 4706, 916, 6389, 1209, 304, 29479, 29928, 625, 29931, 2209, 13, 1678, 7106, 29901, 13, 4706, 10296, 6410, 29892, 17629, 2298, 2246, 29895, 4891, 24687, 29871, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7688, 29922, 8516, 29892, 11455, 29918, 2248, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 7031, 29895, 4741, 29575, 7031, 29895, 29928, 625, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 19290, 353, 9049, 5085, 13, 4706, 1583, 29889, 7915, 353, 7688, 13, 4706, 1583, 29889, 17281, 29918, 2248, 353, 11455, 29918, 2248, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 8500, 29892, 3646, 1125, 13, 13, 4706, 4974, 8500, 29889, 2311, 580, 1275, 3646, 29889, 2311, 580, 13, 4706, 17629, 353, 360, 625, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29892, 17281, 29918, 2248, 29922, 1311, 29889, 17281, 29918, 2248, 29892, 1068, 1311, 29889, 19290, 29897, 13, 4706, 17629, 29918, 6758, 353, 17629, 29898, 27711, 29892, 5182, 29897, 13, 13, 4706, 2246, 29895, 353, 7488, 29968, 29931, 2209, 29898, 7915, 29922, 1311, 29889, 7915, 29892, 29895, 29922, 29945, 29900, 29897, 13, 4706, 2246, 29895, 29918, 6758, 353, 2246, 29895, 29898, 27711, 29892, 5182, 29897, 13, 308, 13, 4706, 3001, 29918, 6758, 353, 2246, 29895, 29918, 6758, 718, 17629, 29918, 6758, 13, 13, 4706, 736, 3001, 29918, 6758, 2 ]
lib/hypervisor/hv_kvm/monitor.py
yiannist/pkg-ganeti
0
157994
# # # Copyright (C) 2014 Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS # IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """Qemu monitor control classes """ import os import stat import errno import socket import StringIO from ganeti import errors from ganeti import utils from ganeti import serializer class QmpCommandNotSupported(errors.HypervisorError): """QMP command not supported by the monitor. This is raised in case a QmpMonitor instance is asked to execute a command not supported by the instance. This is a KVM-specific exception, intended to assist in falling back to using the human monitor for operations QMP does not support. """ pass class QmpMessage(object): """QEMU Messaging Protocol (QMP) message. """ def __init__(self, data): """Creates a new QMP message based on the passed data. """ if not isinstance(data, dict): raise TypeError("QmpMessage must be initialized with a dict") self.data = data def __getitem__(self, field_name): """Get the value of the required field if present, or None. Overrides the [] operator to provide access to the message data, returning None if the required item is not in the message @return: the value of the field_name field, or None if field_name is not contained in the message """ return self.data.get(field_name, None) def __setitem__(self, field_name, field_value): """Set the value of the required field_name to field_value. """ self.data[field_name] = field_value def __len__(self): """Return the number of fields stored in this QmpMessage. """ return len(self.data) def __delitem__(self, key): """Delete the specified element from the QmpMessage. """ del(self.data[key]) @staticmethod def BuildFromJsonString(json_string): """Build a QmpMessage from a JSON encoded string. @type json_string: str @param json_string: JSON string representing the message @rtype: L{QmpMessage} @return: a L{QmpMessage} built from json_string """ # Parse the string data = serializer.LoadJson(json_string) return QmpMessage(data) def __str__(self): # The protocol expects the JSON object to be sent as a single line. return serializer.DumpJson(self.data) def __eq__(self, other): # When comparing two QmpMessages, we are interested in comparing # their internal representation of the message data return self.data == other.data class MonitorSocket(object): _SOCKET_TIMEOUT = 5 def __init__(self, monitor_filename): """Instantiates the MonitorSocket object. @type monitor_filename: string @param monitor_filename: the filename of the UNIX raw socket on which the monitor (QMP or simple one) is listening """ self.monitor_filename = monitor_filename self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) # We want to fail if the server doesn't send a complete message # in a reasonable amount of time self.sock.settimeout(self._SOCKET_TIMEOUT) self._connected = False def _check_socket(self): sock_stat = None try: sock_stat = os.stat(self.monitor_filename) except EnvironmentError, err: if err.errno == errno.ENOENT: raise errors.HypervisorError("No monitor socket found") else: raise errors.HypervisorError("Error checking monitor socket: %s", utils.ErrnoOrStr(err)) if not stat.S_ISSOCK(sock_stat.st_mode): raise errors.HypervisorError("Monitor socket is not a socket") def _check_connection(self): """Make sure that the connection is established. """ if not self._connected: raise errors.ProgrammerError("To use a MonitorSocket you need to first" " invoke connect() on it") def connect(self): """Connects to the monitor. Connects to the UNIX socket @raise errors.HypervisorError: when there are communication errors """ if self._connected: raise errors.ProgrammerError("Cannot connect twice") self._check_socket() # Check file existance/stuff try: self.sock.connect(self.monitor_filename) except EnvironmentError: raise errors.HypervisorError("Can't connect to qmp socket") self._connected = True def close(self): """Closes the socket It cannot be used after this call. """ self.sock.close() class QmpConnection(MonitorSocket): """Connection to the QEMU Monitor using the QEMU Monitor Protocol (QMP). """ _FIRST_MESSAGE_KEY = "QMP" _EVENT_KEY = "event" _ERROR_KEY = "error" _RETURN_KEY = "return" _ACTUAL_KEY = ACTUAL_KEY = "actual" _ERROR_CLASS_KEY = "class" _ERROR_DESC_KEY = "desc" _EXECUTE_KEY = "execute" _ARGUMENTS_KEY = "arguments" _VERSION_KEY = "version" _PACKAGE_KEY = "package" _QEMU_KEY = "qemu" _CAPABILITIES_COMMAND = "qmp_capabilities" _QUERY_COMMANDS = "query-commands" _MESSAGE_END_TOKEN = "\r\n" def __init__(self, monitor_filename): super(QmpConnection, self).__init__(monitor_filename) self._buf = "" self.supported_commands = None def __enter__(self): self.connect() return self def __exit__(self, exc_type, exc_value, tb): self.close() def connect(self): """Connects to the QMP monitor. Connects to the UNIX socket and makes sure that we can actually send and receive data to the kvm instance via QMP. @raise errors.HypervisorError: when there are communication errors @raise errors.ProgrammerError: when there are data serialization errors """ super(QmpConnection, self).connect() # Check if we receive a correct greeting message from the server # (As per the QEMU Protocol Specification 0.1 - section 2.2) greeting = self._Recv() if not greeting[self._FIRST_MESSAGE_KEY]: self._connected = False raise errors.HypervisorError("kvm: QMP communication error (wrong" " server greeting") # Extract the version info from the greeting and make it available to users # of the monitor. version_info = greeting[self._FIRST_MESSAGE_KEY][self._VERSION_KEY] self.version = (version_info[self._QEMU_KEY]["major"], version_info[self._QEMU_KEY]["minor"], version_info[self._QEMU_KEY]["micro"]) self.package = version_info[self._PACKAGE_KEY].strip() # This is needed because QMP can return more than one greetings # see https://groups.google.com/d/msg/ganeti-devel/gZYcvHKDooU/SnukC8dgS5AJ self._buf = "" # Let's put the monitor in command mode using the qmp_capabilities # command, or else no command will be executable. # (As per the QEMU Protocol Specification 0.1 - section 4) self.Execute(self._CAPABILITIES_COMMAND) self.supported_commands = self._GetSupportedCommands() def _ParseMessage(self, buf): """Extract and parse a QMP message from the given buffer. Seeks for a QMP message in the given buf. If found, it parses it and returns it together with the rest of the characters in the buf. If no message is found, returns None and the whole buffer. @raise errors.ProgrammerError: when there are data serialization errors """ message = None # Check if we got the message end token (CRLF, as per the QEMU Protocol # Specification 0.1 - Section 2.1.1) pos = buf.find(self._MESSAGE_END_TOKEN) if pos >= 0: try: message = QmpMessage.BuildFromJsonString(buf[:pos + 1]) except Exception, err: raise errors.ProgrammerError("QMP data serialization error: %s" % err) buf = buf[pos + 1:] return (message, buf) def _Recv(self): """Receives a message from QMP and decodes the received JSON object. @rtype: QmpMessage @return: the received message @raise errors.HypervisorError: when there are communication errors @raise errors.ProgrammerError: when there are data serialization errors """ self._check_connection() # Check if there is already a message in the buffer (message, self._buf) = self._ParseMessage(self._buf) if message: return message recv_buffer = StringIO.StringIO(self._buf) recv_buffer.seek(len(self._buf)) try: while True: data = self.sock.recv(4096) if not data: break recv_buffer.write(data) (message, self._buf) = self._ParseMessage(recv_buffer.getvalue()) if message: return message except socket.timeout, err: raise errors.HypervisorError("Timeout while receiving a QMP message: " "%s" % (err)) except socket.error, err: raise errors.HypervisorError("Unable to receive data from KVM using the" " QMP protocol: %s" % err) def _Send(self, message): """Encodes and sends a message to KVM using QMP. @type message: QmpMessage @param message: message to send to KVM @raise errors.HypervisorError: when there are communication errors @raise errors.ProgrammerError: when there are data serialization errors """ self._check_connection() try: message_str = str(message) except Exception, err: raise errors.ProgrammerError("QMP data deserialization error: %s" % err) try: self.sock.sendall(message_str) except socket.timeout, err: raise errors.HypervisorError("Timeout while sending a QMP message: " "%s (%s)" % (err.string, err.errno)) except socket.error, err: raise errors.HypervisorError("Unable to send data from KVM using the" " QMP protocol: %s" % err) def _GetSupportedCommands(self): """Update the list of supported commands. """ result = self.Execute(self._QUERY_COMMANDS) return frozenset(com["name"] for com in result) def Execute(self, command, arguments=None): """Executes a QMP command and returns the response of the server. @type command: str @param command: the command to execute @type arguments: dict @param arguments: dictionary of arguments to be passed to the command @rtype: dict @return: dictionary representing the received JSON object @raise errors.HypervisorError: when there are communication errors @raise errors.ProgrammerError: when there are data serialization errors """ self._check_connection() # During the first calls of Execute, the list of supported commands has not # yet been populated, so we can't use it. if (self.supported_commands is not None and command not in self.supported_commands): raise QmpCommandNotSupported("Instance does not support the '%s'" " QMP command." % command) message = QmpMessage({self._EXECUTE_KEY: command}) if arguments: message[self._ARGUMENTS_KEY] = arguments self._Send(message) # According the the QMP specification, there are only two reply types to a # command: either error (containing the "error" key) or success (containing # the "return" key). There is also a third possibility, that of an # (unrelated to the command) asynchronous event notification, identified by # the "event" key. while True: response = self._Recv() err = response[self._ERROR_KEY] if err: raise errors.HypervisorError("kvm: error executing the %s" " command: %s (%s):" % (command, err[self._ERROR_DESC_KEY], err[self._ERROR_CLASS_KEY])) elif response[self._EVENT_KEY]: # Filter-out any asynchronous events continue return response[self._RETURN_KEY]
[ 1, 396, 13, 29937, 13, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29946, 5087, 9266, 29889, 13, 29937, 2178, 10462, 21676, 29889, 13, 29937, 13, 29937, 4367, 391, 3224, 322, 671, 297, 2752, 322, 7581, 7190, 29892, 411, 470, 1728, 13, 29937, 21733, 29892, 526, 21905, 4944, 393, 278, 1494, 5855, 526, 13, 29937, 1539, 29901, 13, 29937, 13, 29937, 29871, 29896, 29889, 4367, 391, 3224, 29879, 310, 2752, 775, 1818, 11551, 278, 2038, 3509, 1266, 8369, 29892, 13, 29937, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 29889, 13, 29937, 13, 29937, 29871, 29906, 29889, 4367, 391, 3224, 29879, 297, 7581, 883, 1818, 18532, 278, 2038, 3509, 1266, 13, 29937, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 297, 278, 13, 29937, 5106, 322, 29914, 272, 916, 17279, 4944, 411, 278, 4978, 29889, 13, 29937, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6770, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 5300, 8707, 29911, 3960, 29933, 2692, 24125, 376, 3289, 13, 29937, 8519, 29908, 5300, 13764, 29979, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 29892, 2672, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 13, 29937, 7495, 29892, 6093, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 5300, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 13, 29937, 349, 4574, 13152, 1660, 319, 1525, 28657, 13875, 8890, 29928, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 6323, 13, 29937, 8707, 29911, 3960, 29933, 2692, 24125, 20700, 17705, 6181, 15842, 13764, 29979, 22471, 26282, 29892, 2672, 4571, 26282, 29892, 2672, 29907, 1367, 3919, 1964, 29892, 317, 4162, 8426, 1964, 29892, 13, 29937, 8528, 29923, 3580, 29931, 19926, 29892, 6323, 8707, 1660, 13356, 3919, 25758, 21330, 1529, 1692, 29903, 313, 1177, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 7495, 29892, 13, 29937, 13756, 29907, 11499, 13780, 8079, 27092, 1254, 1806, 26027, 21947, 29949, 8452, 6323, 26996, 29963, 2965, 2890, 29936, 11247, 1799, 8079, 501, 1660, 29892, 360, 8254, 29892, 6323, 13, 29937, 13756, 29943, 1806, 29903, 29936, 6323, 350, 3308, 8895, 1799, 2672, 4945, 29934, 4897, 29911, 2725, 29897, 29832, 8851, 5348, 12766, 17171, 29928, 5300, 6732, 13764, 29979, 6093, 18929, 8079, 13, 29937, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 8707, 29911, 4717, 1783, 29892, 6850, 3960, 1783, 17705, 2882, 6227, 11937, 29892, 6323, 323, 8476, 313, 1177, 6154, 15789, 4214, 13, 29937, 405, 11787, 5265, 24647, 4741, 6323, 438, 29911, 4448, 22119, 1660, 29897, 9033, 3235, 4214, 2672, 13764, 29979, 399, 29909, 29979, 19474, 8079, 6093, 501, 1660, 8079, 3446, 3235, 13, 29937, 7791, 7818, 12982, 1525, 29892, 382, 29963, 1430, 10762, 11033, 18118, 1660, 29928, 8079, 6093, 21521, 1799, 8979, 6227, 11937, 8079, 20134, 3210, 21330, 1529, 1692, 29889, 13, 13, 13, 15945, 29908, 29984, 24425, 11819, 2761, 4413, 13, 13, 15945, 29908, 13, 13, 13, 5215, 2897, 13, 5215, 1002, 13, 5215, 4589, 1217, 13, 5215, 9909, 13, 5215, 1714, 5971, 13, 13, 3166, 9581, 16577, 1053, 4436, 13, 3166, 9581, 16577, 1053, 3667, 29879, 13, 3166, 9581, 16577, 1053, 7797, 3950, 13, 13, 13, 1990, 660, 1526, 6255, 3664, 14039, 287, 29898, 12523, 29889, 26322, 546, 19188, 2392, 1125, 13, 29871, 9995, 29984, 3580, 1899, 451, 6969, 491, 278, 11819, 29889, 13, 13, 29871, 910, 338, 10425, 297, 1206, 263, 660, 1526, 7185, 2105, 2777, 338, 4433, 304, 6222, 263, 1899, 13, 29871, 451, 6969, 491, 278, 2777, 29889, 13, 13, 29871, 910, 338, 263, 476, 9219, 29899, 14940, 3682, 29892, 9146, 304, 6985, 297, 20327, 1250, 304, 773, 13, 29871, 278, 5199, 11819, 363, 6931, 660, 3580, 947, 451, 2304, 29889, 13, 13, 29871, 9995, 13, 29871, 1209, 13, 13, 13, 1990, 660, 1526, 3728, 29898, 3318, 1125, 13, 29871, 9995, 29984, 12665, 29965, 11946, 6751, 1019, 5770, 313, 29984, 3580, 29897, 2643, 29889, 13, 13, 29871, 9995, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 848, 1125, 13, 1678, 9995, 9832, 1078, 263, 716, 660, 3580, 2643, 2729, 373, 278, 4502, 848, 29889, 13, 13, 1678, 9995, 13, 1678, 565, 451, 338, 8758, 29898, 1272, 29892, 9657, 1125, 13, 418, 12020, 20948, 703, 29984, 1526, 3728, 1818, 367, 16601, 411, 263, 9657, 1159, 13, 13, 1678, 1583, 29889, 1272, 353, 848, 13, 13, 29871, 822, 4770, 657, 667, 12035, 1311, 29892, 1746, 29918, 978, 1125, 13, 1678, 9995, 2577, 278, 995, 310, 278, 3734, 1746, 565, 2198, 29892, 470, 6213, 29889, 13, 13, 1678, 6811, 24040, 278, 5159, 5455, 304, 3867, 2130, 304, 278, 2643, 848, 29892, 13, 1678, 7863, 6213, 565, 278, 3734, 2944, 338, 451, 297, 278, 2643, 13, 1678, 732, 2457, 29901, 278, 995, 310, 278, 1746, 29918, 978, 1746, 29892, 470, 6213, 565, 1746, 29918, 978, 13, 632, 338, 451, 11122, 297, 278, 2643, 13, 13, 1678, 9995, 13, 1678, 736, 1583, 29889, 1272, 29889, 657, 29898, 2671, 29918, 978, 29892, 6213, 29897, 13, 13, 29871, 822, 4770, 842, 667, 12035, 1311, 29892, 1746, 29918, 978, 29892, 1746, 29918, 1767, 1125, 13, 1678, 9995, 2697, 278, 995, 310, 278, 3734, 1746, 29918, 978, 304, 1746, 29918, 1767, 29889, 13, 13, 1678, 9995, 13, 1678, 1583, 29889, 1272, 29961, 2671, 29918, 978, 29962, 353, 1746, 29918, 1767, 13, 13, 29871, 822, 4770, 2435, 12035, 1311, 1125, 13, 1678, 9995, 11609, 278, 1353, 310, 4235, 6087, 297, 445, 660, 1526, 3728, 29889, 13, 13, 1678, 9995, 13, 1678, 736, 7431, 29898, 1311, 29889, 1272, 29897, 13, 13, 29871, 822, 4770, 6144, 667, 12035, 1311, 29892, 1820, 1125, 13, 1678, 9995, 12498, 278, 6790, 1543, 515, 278, 660, 1526, 3728, 29889, 13, 13, 1678, 9995, 13, 1678, 628, 29898, 1311, 29889, 1272, 29961, 1989, 2314, 13, 13, 29871, 732, 7959, 5696, 13, 29871, 822, 8878, 4591, 8148, 1231, 29898, 3126, 29918, 1807, 1125, 13, 1678, 9995, 8893, 263, 660, 1526, 3728, 515, 263, 4663, 18511, 1347, 29889, 13, 13, 1678, 732, 1853, 4390, 29918, 1807, 29901, 851, 13, 1678, 732, 3207, 4390, 29918, 1807, 29901, 4663, 1347, 15783, 278, 2643, 13, 1678, 732, 29878, 1853, 29901, 365, 29912, 29984, 1526, 3728, 29913, 13, 1678, 732, 2457, 29901, 263, 365, 29912, 29984, 1526, 3728, 29913, 4240, 515, 4390, 29918, 1807, 13, 13, 1678, 9995, 13, 1678, 396, 20969, 278, 1347, 13, 1678, 848, 353, 7797, 3950, 29889, 5896, 8148, 29898, 3126, 29918, 1807, 29897, 13, 1678, 736, 660, 1526, 3728, 29898, 1272, 29897, 13, 13, 29871, 822, 4770, 710, 12035, 1311, 1125, 13, 1678, 396, 450, 9608, 23347, 278, 4663, 1203, 304, 367, 2665, 408, 263, 2323, 1196, 29889, 13, 1678, 736, 7797, 3950, 29889, 29928, 3427, 8148, 29898, 1311, 29889, 1272, 29897, 13, 13, 29871, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 1678, 396, 1932, 17420, 1023, 660, 1526, 25510, 29892, 591, 526, 8852, 297, 17420, 13, 1678, 396, 1009, 7463, 8954, 310, 278, 2643, 848, 13, 1678, 736, 1583, 29889, 1272, 1275, 916, 29889, 1272, 13, 13, 13, 1990, 2598, 2105, 11373, 29898, 3318, 1125, 13, 29871, 903, 6156, 7077, 2544, 29918, 15307, 12015, 353, 29871, 29945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 11819, 29918, 9507, 1125, 13, 1678, 9995, 3379, 3656, 1078, 278, 2598, 2105, 11373, 1203, 29889, 13, 13, 1678, 732, 1853, 11819, 29918, 9507, 29901, 1347, 13, 1678, 732, 3207, 11819, 29918, 9507, 29901, 278, 10422, 310, 278, 8291, 6415, 10650, 9909, 373, 607, 278, 13, 462, 632, 11819, 313, 29984, 3580, 470, 2560, 697, 29897, 338, 19866, 13, 13, 1678, 9995, 13, 1678, 1583, 29889, 3712, 2105, 29918, 9507, 353, 11819, 29918, 9507, 13, 1678, 1583, 29889, 21852, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 3904, 6415, 29892, 9909, 29889, 6156, 7077, 29918, 1254, 1525, 5194, 29897, 13, 1678, 396, 1334, 864, 304, 4418, 565, 278, 1923, 1838, 29915, 29873, 3638, 263, 4866, 2643, 13, 1678, 396, 297, 263, 15590, 5253, 310, 931, 13, 1678, 1583, 29889, 21852, 29889, 842, 15619, 29898, 1311, 3032, 6156, 7077, 2544, 29918, 15307, 12015, 29897, 13, 1678, 1583, 3032, 18045, 353, 7700, 13, 13, 29871, 822, 903, 3198, 29918, 11514, 29898, 1311, 1125, 13, 1678, 577, 384, 29918, 6112, 353, 6213, 13, 1678, 1018, 29901, 13, 418, 577, 384, 29918, 6112, 353, 2897, 29889, 6112, 29898, 1311, 29889, 3712, 2105, 29918, 9507, 29897, 13, 1678, 5174, 16738, 2392, 29892, 4589, 29901, 13, 418, 565, 4589, 29889, 3127, 1217, 1275, 4589, 1217, 29889, 1430, 29949, 3919, 29901, 13, 4706, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 3782, 11819, 9909, 1476, 1159, 13, 418, 1683, 29901, 13, 4706, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 2392, 8454, 11819, 9909, 29901, 1273, 29879, 613, 13, 462, 462, 268, 3667, 29879, 29889, 19212, 1217, 2816, 5015, 29898, 3127, 876, 13, 1678, 565, 451, 1002, 29889, 29903, 29918, 29902, 1799, 29949, 7077, 29898, 21852, 29918, 6112, 29889, 303, 29918, 8513, 1125, 13, 418, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 7185, 2105, 9909, 338, 451, 263, 9909, 1159, 13, 13, 29871, 822, 903, 3198, 29918, 9965, 29898, 1311, 1125, 13, 1678, 9995, 9984, 1854, 393, 278, 3957, 338, 7841, 29889, 13, 13, 1678, 9995, 13, 1678, 565, 451, 1583, 3032, 18045, 29901, 13, 418, 12020, 4436, 29889, 9283, 1050, 2392, 703, 1762, 671, 263, 2598, 2105, 11373, 366, 817, 304, 937, 29908, 13, 462, 462, 259, 376, 15928, 4511, 580, 373, 372, 1159, 13, 13, 29871, 822, 4511, 29898, 1311, 1125, 13, 1678, 9995, 17918, 29879, 304, 278, 11819, 29889, 13, 13, 1678, 14971, 29879, 304, 278, 8291, 6415, 9909, 13, 13, 1678, 732, 22692, 4436, 29889, 26322, 546, 19188, 2392, 29901, 746, 727, 526, 12084, 4436, 13, 13, 1678, 9995, 13, 1678, 565, 1583, 3032, 18045, 29901, 13, 418, 12020, 4436, 29889, 9283, 1050, 2392, 703, 29089, 4511, 8951, 1159, 13, 13, 1678, 1583, 3032, 3198, 29918, 11514, 580, 13, 13, 1678, 396, 5399, 934, 1863, 749, 29914, 303, 3096, 13, 1678, 1018, 29901, 13, 418, 1583, 29889, 21852, 29889, 6915, 29898, 1311, 29889, 3712, 2105, 29918, 9507, 29897, 13, 1678, 5174, 16738, 2392, 29901, 13, 418, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 6028, 29915, 29873, 4511, 304, 3855, 1526, 9909, 1159, 13, 1678, 1583, 3032, 18045, 353, 5852, 13, 13, 29871, 822, 3802, 29898, 1311, 1125, 13, 1678, 9995, 29907, 5409, 267, 278, 9909, 13, 13, 1678, 739, 2609, 367, 1304, 1156, 445, 1246, 29889, 13, 13, 1678, 9995, 13, 1678, 1583, 29889, 21852, 29889, 5358, 580, 13, 13, 13, 1990, 660, 1526, 5350, 29898, 7185, 2105, 11373, 1125, 13, 29871, 9995, 5350, 304, 278, 660, 12665, 29965, 2598, 2105, 773, 278, 660, 12665, 29965, 2598, 2105, 1019, 5770, 313, 29984, 3580, 467, 13, 13, 29871, 9995, 13, 29871, 903, 3738, 29934, 1254, 29918, 2303, 1799, 10461, 29918, 10818, 353, 376, 29984, 3580, 29908, 13, 29871, 903, 22240, 3919, 29918, 10818, 353, 376, 3696, 29908, 13, 29871, 903, 11432, 29918, 10818, 353, 376, 2704, 29908, 13, 29871, 903, 1525, 29911, 24015, 29918, 10818, 353, 376, 2457, 29908, 13, 29871, 903, 17923, 29965, 1964, 29918, 10818, 353, 319, 1783, 29965, 1964, 29918, 10818, 353, 376, 19304, 29908, 13, 29871, 903, 11432, 29918, 13875, 1799, 29918, 10818, 353, 376, 1990, 29908, 13, 29871, 903, 11432, 29918, 2287, 7187, 29918, 10818, 353, 376, 14273, 29908, 13, 29871, 903, 5746, 11206, 26027, 29918, 10818, 353, 376, 7978, 29908, 13, 29871, 903, 1718, 29954, 5005, 3919, 29903, 29918, 10818, 353, 376, 25699, 29908, 13, 29871, 903, 16358, 29918, 10818, 353, 376, 3259, 29908, 13, 29871, 903, 29925, 11375, 10461, 29918, 10818, 353, 376, 5113, 29908, 13, 29871, 903, 29984, 12665, 29965, 29918, 10818, 353, 376, 29939, 24425, 29908, 13, 29871, 903, 29907, 3301, 2882, 6227, 1806, 29059, 29918, 19795, 1529, 2797, 353, 376, 29939, 1526, 29918, 5030, 11614, 29908, 13, 29871, 903, 13356, 24422, 29918, 19795, 1529, 2797, 29903, 353, 376, 1972, 29899, 26381, 29908, 13, 29871, 903, 2303, 1799, 10461, 29918, 11794, 29918, 4986, 29968, 1430, 353, 6634, 29878, 29905, 29876, 29908, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 11819, 29918, 9507, 1125, 13, 1678, 2428, 29898, 29984, 1526, 5350, 29892, 1583, 467, 1649, 2344, 12035, 3712, 2105, 29918, 9507, 29897, 13, 1678, 1583, 3032, 9721, 353, 5124, 13, 1678, 1583, 29889, 23765, 29918, 26381, 353, 6213, 13, 13, 29871, 822, 4770, 5893, 12035, 1311, 1125, 13, 1678, 1583, 29889, 6915, 580, 13, 1678, 736, 1583, 13, 13, 29871, 822, 4770, 13322, 12035, 1311, 29892, 5566, 29918, 1853, 29892, 5566, 29918, 1767, 29892, 260, 29890, 1125, 13, 1678, 1583, 29889, 5358, 580, 13, 13, 29871, 822, 4511, 29898, 1311, 1125, 13, 1678, 9995, 17918, 29879, 304, 278, 660, 3580, 11819, 29889, 13, 13, 1678, 14971, 29879, 304, 278, 8291, 6415, 9909, 322, 3732, 1854, 393, 591, 508, 2869, 3638, 322, 13, 1678, 7150, 848, 304, 278, 413, 6925, 2777, 3025, 660, 3580, 29889, 13, 13, 1678, 732, 22692, 4436, 29889, 26322, 546, 19188, 2392, 29901, 746, 727, 526, 12084, 4436, 13, 1678, 732, 22692, 4436, 29889, 9283, 1050, 2392, 29901, 746, 727, 526, 848, 7797, 2133, 4436, 13, 13, 1678, 9995, 13, 1678, 2428, 29898, 29984, 1526, 5350, 29892, 1583, 467, 6915, 580, 13, 1678, 396, 5399, 565, 591, 7150, 263, 1959, 1395, 15133, 2643, 515, 278, 1923, 13, 1678, 396, 313, 2887, 639, 278, 660, 12665, 29965, 1019, 5770, 12048, 2450, 29871, 29900, 29889, 29896, 448, 4004, 29871, 29906, 29889, 29906, 29897, 13, 1678, 1395, 15133, 353, 1583, 3032, 4789, 29894, 580, 13, 1678, 565, 451, 1395, 15133, 29961, 1311, 3032, 3738, 29934, 1254, 29918, 2303, 1799, 10461, 29918, 10818, 5387, 13, 418, 1583, 3032, 18045, 353, 7700, 13, 418, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 29895, 6925, 29901, 660, 3580, 12084, 1059, 313, 15866, 549, 29908, 13, 462, 462, 259, 376, 1923, 1395, 15133, 1159, 13, 13, 1678, 396, 7338, 1461, 278, 1873, 5235, 515, 278, 1395, 15133, 322, 1207, 372, 3625, 304, 4160, 13, 1678, 396, 310, 278, 11819, 29889, 13, 1678, 1873, 29918, 3888, 353, 1395, 15133, 29961, 1311, 3032, 3738, 29934, 1254, 29918, 2303, 1799, 10461, 29918, 10818, 3816, 1311, 3032, 16358, 29918, 10818, 29962, 13, 13, 1678, 1583, 29889, 3259, 353, 313, 3259, 29918, 3888, 29961, 1311, 3032, 29984, 12665, 29965, 29918, 10818, 29962, 3366, 21355, 12436, 13, 462, 1678, 1873, 29918, 3888, 29961, 1311, 3032, 29984, 12665, 29965, 29918, 10818, 29962, 3366, 1195, 272, 12436, 13, 462, 1678, 1873, 29918, 3888, 29961, 1311, 3032, 29984, 12665, 29965, 29918, 10818, 29962, 3366, 29885, 2357, 20068, 13, 1678, 1583, 29889, 5113, 353, 1873, 29918, 3888, 29961, 1311, 3032, 29925, 11375, 10461, 29918, 10818, 1822, 17010, 580, 13, 13, 1678, 396, 910, 338, 4312, 1363, 660, 3580, 508, 736, 901, 1135, 697, 1395, 300, 886, 13, 1678, 396, 1074, 2045, 597, 13155, 29889, 3608, 29889, 510, 29914, 29881, 29914, 7645, 29914, 6249, 16577, 29899, 311, 955, 29914, 29887, 29999, 29979, 11023, 29950, 29968, 29928, 3634, 29965, 29914, 29903, 29876, 2679, 29907, 29947, 20726, 29903, 29945, 29909, 29967, 13, 1678, 1583, 3032, 9721, 353, 5124, 13, 13, 1678, 396, 2803, 29915, 29879, 1925, 278, 11819, 297, 1899, 4464, 773, 278, 3855, 1526, 29918, 5030, 11614, 13, 1678, 396, 1899, 29892, 470, 1683, 694, 1899, 674, 367, 16813, 29889, 13, 1678, 396, 313, 2887, 639, 278, 660, 12665, 29965, 1019, 5770, 12048, 2450, 29871, 29900, 29889, 29896, 448, 4004, 29871, 29946, 29897, 13, 1678, 1583, 29889, 12296, 29898, 1311, 3032, 29907, 3301, 2882, 6227, 1806, 29059, 29918, 19795, 1529, 2797, 29897, 13, 1678, 1583, 29889, 23765, 29918, 26381, 353, 1583, 3032, 2577, 14039, 287, 5261, 4167, 580, 13, 13, 29871, 822, 903, 12914, 3728, 29898, 1311, 29892, 18392, 1125, 13, 1678, 9995, 5647, 1461, 322, 6088, 263, 660, 3580, 2643, 515, 278, 2183, 6835, 29889, 13, 13, 1678, 922, 14541, 363, 263, 660, 3580, 2643, 297, 278, 2183, 18392, 29889, 960, 1476, 29892, 372, 610, 29879, 267, 372, 322, 13, 1678, 3639, 372, 4208, 411, 278, 1791, 310, 278, 4890, 297, 278, 18392, 29889, 13, 1678, 960, 694, 2643, 338, 1476, 29892, 3639, 6213, 322, 278, 3353, 6835, 29889, 13, 13, 1678, 732, 22692, 4436, 29889, 9283, 1050, 2392, 29901, 746, 727, 526, 848, 7797, 2133, 4436, 13, 13, 1678, 9995, 13, 1678, 2643, 353, 6213, 13, 1678, 396, 5399, 565, 591, 2355, 278, 2643, 1095, 5993, 313, 29907, 2241, 29943, 29892, 408, 639, 278, 660, 12665, 29965, 1019, 5770, 13, 1678, 396, 12048, 2450, 29871, 29900, 29889, 29896, 448, 9779, 29871, 29906, 29889, 29896, 29889, 29896, 29897, 13, 1678, 926, 353, 18392, 29889, 2886, 29898, 1311, 3032, 2303, 1799, 10461, 29918, 11794, 29918, 4986, 29968, 1430, 29897, 13, 1678, 565, 926, 6736, 29871, 29900, 29901, 13, 418, 1018, 29901, 13, 4706, 2643, 353, 660, 1526, 3728, 29889, 8893, 4591, 8148, 1231, 29898, 9721, 7503, 1066, 718, 29871, 29896, 2314, 13, 418, 5174, 8960, 29892, 4589, 29901, 13, 4706, 12020, 4436, 29889, 9283, 1050, 2392, 703, 29984, 3580, 848, 7797, 2133, 1059, 29901, 1273, 29879, 29908, 1273, 4589, 29897, 13, 418, 18392, 353, 18392, 29961, 1066, 718, 29871, 29896, 17531, 13, 13, 1678, 736, 313, 4906, 29892, 18392, 29897, 13, 13, 29871, 822, 903, 4789, 29894, 29898, 1311, 1125, 13, 1678, 9995, 10380, 3145, 263, 2643, 515, 660, 3580, 322, 1602, 2631, 278, 4520, 4663, 1203, 29889, 13, 13, 1678, 732, 29878, 1853, 29901, 660, 1526, 3728, 13, 1678, 732, 2457, 29901, 278, 4520, 2643, 13, 1678, 732, 22692, 4436, 29889, 26322, 546, 19188, 2392, 29901, 746, 727, 526, 12084, 4436, 13, 1678, 732, 22692, 4436, 29889, 9283, 1050, 2392, 29901, 746, 727, 526, 848, 7797, 2133, 4436, 13, 13, 1678, 9995, 13, 1678, 1583, 3032, 3198, 29918, 9965, 580, 13, 13, 1678, 396, 5399, 565, 727, 338, 2307, 263, 2643, 297, 278, 6835, 13, 1678, 313, 4906, 29892, 1583, 3032, 9721, 29897, 353, 1583, 3032, 12914, 3728, 29898, 1311, 3032, 9721, 29897, 13, 1678, 565, 2643, 29901, 13, 418, 736, 2643, 13, 13, 1678, 1162, 29894, 29918, 9040, 353, 1714, 5971, 29889, 1231, 5971, 29898, 1311, 3032, 9721, 29897, 13, 1678, 1162, 29894, 29918, 9040, 29889, 344, 1416, 29898, 2435, 29898, 1311, 3032, 9721, 876, 13, 1678, 1018, 29901, 13, 418, 1550, 5852, 29901, 13, 4706, 848, 353, 1583, 29889, 21852, 29889, 3757, 29894, 29898, 29946, 29900, 29929, 29953, 29897, 13, 4706, 565, 451, 848, 29901, 13, 3986, 2867, 13, 4706, 1162, 29894, 29918, 9040, 29889, 3539, 29898, 1272, 29897, 13, 13, 4706, 313, 4906, 29892, 1583, 3032, 9721, 29897, 353, 1583, 3032, 12914, 3728, 29898, 3757, 29894, 29918, 9040, 29889, 657, 1767, 3101, 13, 4706, 565, 2643, 29901, 13, 3986, 736, 2643, 13, 13, 1678, 5174, 9909, 29889, 15619, 29892, 4589, 29901, 13, 418, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 10851, 1550, 13442, 263, 660, 3580, 2643, 29901, 376, 13, 462, 462, 259, 11860, 29879, 29908, 1273, 313, 3127, 876, 13, 1678, 5174, 9909, 29889, 2704, 29892, 4589, 29901, 13, 418, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 2525, 519, 304, 7150, 848, 515, 476, 9219, 773, 278, 29908, 13, 462, 462, 259, 376, 660, 3580, 9608, 29901, 1273, 29879, 29908, 1273, 4589, 29897, 13, 13, 29871, 822, 903, 12600, 29898, 1311, 29892, 2643, 1125, 13, 1678, 9995, 8566, 2631, 322, 16003, 263, 2643, 304, 476, 9219, 773, 660, 3580, 29889, 13, 13, 1678, 732, 1853, 2643, 29901, 660, 1526, 3728, 13, 1678, 732, 3207, 2643, 29901, 2643, 304, 3638, 304, 476, 9219, 13, 1678, 732, 22692, 4436, 29889, 26322, 546, 19188, 2392, 29901, 746, 727, 526, 12084, 4436, 13, 1678, 732, 22692, 4436, 29889, 9283, 1050, 2392, 29901, 746, 727, 526, 848, 7797, 2133, 4436, 13, 13, 1678, 9995, 13, 1678, 1583, 3032, 3198, 29918, 9965, 580, 13, 1678, 1018, 29901, 13, 418, 2643, 29918, 710, 353, 851, 29898, 4906, 29897, 13, 1678, 5174, 8960, 29892, 4589, 29901, 13, 418, 12020, 4436, 29889, 9283, 1050, 2392, 703, 29984, 3580, 848, 16964, 616, 2133, 1059, 29901, 1273, 29879, 29908, 1273, 4589, 29897, 13, 13, 1678, 1018, 29901, 13, 418, 1583, 29889, 21852, 29889, 6717, 497, 29898, 4906, 29918, 710, 29897, 13, 1678, 5174, 9909, 29889, 15619, 29892, 4589, 29901, 13, 418, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 10851, 1550, 9348, 263, 660, 3580, 2643, 29901, 376, 13, 462, 462, 259, 11860, 29879, 313, 29995, 29879, 5513, 1273, 313, 3127, 29889, 1807, 29892, 4589, 29889, 3127, 1217, 876, 13, 1678, 5174, 9909, 29889, 2704, 29892, 4589, 29901, 13, 418, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 2525, 519, 304, 3638, 848, 515, 476, 9219, 773, 278, 29908, 13, 462, 462, 259, 376, 660, 3580, 9608, 29901, 1273, 29879, 29908, 1273, 4589, 29897, 13, 13, 29871, 822, 903, 2577, 14039, 287, 5261, 4167, 29898, 1311, 1125, 13, 1678, 9995, 6422, 278, 1051, 310, 6969, 8260, 29889, 13, 13, 1678, 9995, 13, 1678, 1121, 353, 1583, 29889, 12296, 29898, 1311, 3032, 13356, 24422, 29918, 19795, 1529, 2797, 29903, 29897, 13, 1678, 736, 14671, 29920, 575, 300, 29898, 510, 3366, 978, 3108, 363, 419, 297, 1121, 29897, 13, 13, 29871, 822, 11080, 1082, 29898, 1311, 29892, 1899, 29892, 6273, 29922, 8516, 1125, 13, 1678, 9995, 5379, 2667, 263, 660, 3580, 1899, 322, 3639, 278, 2933, 310, 278, 1923, 29889, 13, 13, 1678, 732, 1853, 1899, 29901, 851, 13, 1678, 732, 3207, 1899, 29901, 278, 1899, 304, 6222, 13, 1678, 732, 1853, 6273, 29901, 9657, 13, 1678, 732, 3207, 6273, 29901, 8600, 310, 6273, 304, 367, 4502, 304, 278, 1899, 13, 1678, 732, 29878, 1853, 29901, 9657, 13, 1678, 732, 2457, 29901, 8600, 15783, 278, 4520, 4663, 1203, 13, 1678, 732, 22692, 4436, 29889, 26322, 546, 19188, 2392, 29901, 746, 727, 526, 12084, 4436, 13, 1678, 732, 22692, 4436, 29889, 9283, 1050, 2392, 29901, 746, 727, 526, 848, 7797, 2133, 4436, 13, 13, 1678, 9995, 13, 1678, 1583, 3032, 3198, 29918, 9965, 580, 13, 13, 1678, 396, 7133, 278, 937, 5717, 310, 11080, 1082, 29892, 278, 1051, 310, 6969, 8260, 756, 451, 13, 1678, 396, 3447, 1063, 24146, 29892, 577, 591, 508, 29915, 29873, 671, 372, 29889, 13, 1678, 565, 313, 1311, 29889, 23765, 29918, 26381, 338, 451, 6213, 322, 13, 4706, 1899, 451, 297, 1583, 29889, 23765, 29918, 26381, 1125, 13, 418, 12020, 660, 1526, 6255, 3664, 14039, 287, 703, 4998, 947, 451, 2304, 278, 14210, 29879, 11838, 13, 462, 462, 1678, 376, 660, 3580, 1899, 1213, 1273, 1899, 29897, 13, 13, 1678, 2643, 353, 660, 1526, 3728, 3319, 1311, 3032, 5746, 11206, 26027, 29918, 10818, 29901, 1899, 1800, 13, 1678, 565, 6273, 29901, 13, 418, 2643, 29961, 1311, 3032, 1718, 29954, 5005, 3919, 29903, 29918, 10818, 29962, 353, 6273, 13, 1678, 1583, 3032, 12600, 29898, 4906, 29897, 13, 13, 1678, 396, 7579, 278, 278, 660, 3580, 21992, 29892, 727, 526, 871, 1023, 8908, 4072, 304, 263, 13, 1678, 396, 1899, 29901, 2845, 1059, 313, 1285, 17225, 278, 376, 2704, 29908, 1820, 29897, 470, 2551, 313, 1285, 17225, 13, 1678, 396, 278, 376, 2457, 29908, 1820, 467, 1670, 338, 884, 263, 4654, 13331, 29892, 393, 310, 385, 13, 1678, 396, 313, 348, 12817, 304, 278, 1899, 29897, 20489, 1741, 12519, 29892, 15659, 491, 13, 1678, 396, 278, 376, 3696, 29908, 1820, 29889, 13, 1678, 1550, 5852, 29901, 13, 418, 2933, 353, 1583, 3032, 4789, 29894, 580, 13, 418, 4589, 353, 2933, 29961, 1311, 3032, 11432, 29918, 10818, 29962, 13, 418, 565, 4589, 29901, 13, 4706, 12020, 4436, 29889, 26322, 546, 19188, 2392, 703, 29895, 6925, 29901, 1059, 14012, 278, 1273, 29879, 29908, 13, 462, 462, 268, 376, 1899, 29901, 1273, 29879, 313, 29995, 29879, 1125, 29908, 1273, 13, 462, 462, 268, 313, 6519, 29892, 13, 462, 462, 418, 4589, 29961, 1311, 3032, 11432, 29918, 2287, 7187, 29918, 10818, 1402, 13, 462, 462, 418, 4589, 29961, 1311, 3032, 11432, 29918, 13875, 1799, 29918, 10818, 12622, 13, 13, 418, 25342, 2933, 29961, 1311, 3032, 22240, 3919, 29918, 10818, 5387, 13, 4706, 396, 19916, 29899, 449, 738, 20489, 4959, 13, 4706, 6773, 13, 13, 418, 736, 2933, 29961, 1311, 3032, 1525, 29911, 24015, 29918, 10818, 29962, 13, 2 ]
scripts/inversedynamics_openrave.py
personalrobotics/herbpy
4
169900
#!/usr/bin/env python """ Provides a simple console that sets up basic functionality for using herbpy and openravepy. """ import argparse, herbpy, numpy, openravepy def iD(): robot.right_arm.SetActive() jpos_list = [ [3.1670137672513565, -1.5896855774682224, -0.030490730254705722, 1.5286675450710463, -0.032386115821109854, -0.03605547869739324, -0.026511110707008654], [5.147064052327087, - 1.3622957134787639, -0.46951207447023835, 1.4621965585328196, -0.6525084419130015, 0.9042586427293137, -1.00526432576227], [4.121337486391367, 0.5703433599319374, -2.2175569328355724, 2.049783564999927, -0.2955432490571725, -0.646366247533136, -1.4040613050409545], [3.102831025390782, - 0.04296665515610201, 0.1361467570187895, 0.045580105054784076, -3.0213214848284657, 0.0714728073293458, -0.24661498332101073] ] for i, jpos in enumerate(jpos_list): robot.SetActiveDOFValues(jpos, openravepy.KinBody.CheckLimitsAction.Nothing) robot.SetActiveDOFVelocities(numpy.zeros(7)) jtor = robot.ComputeInverseDynamics([]) print 'jpos[{}] gravtorques: {}'.format(i, ' '.join(['{:7.3f}'.format(x) for x in jtor[robot.GetActiveDOFIndices()]])) if __name__ == "__main__": openravepy.RaveInitialize(True) openravepy.misc.InitOpenRAVELogging() # herbpy_args = {'sim':args.sim, # 'attach_viewer':args.viewer, # 'robot_xml':args.robot_xml, # 'env_path':args.env_xml, # 'segway_sim':args.segway_sim} # if args.sim and not args.segway_sim: # herbpy_args['segway_sim'] = args.sim env, robot = herbpy.initialize(sim=True, segway_sim=True) iD()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 1184, 29894, 2247, 263, 2560, 2991, 393, 6166, 701, 6996, 9863, 363, 13, 4746, 902, 29890, 2272, 322, 1722, 336, 345, 2272, 29889, 13, 15945, 29908, 13, 13, 5215, 1852, 5510, 29892, 902, 29890, 2272, 29892, 12655, 29892, 1722, 336, 345, 2272, 13, 13, 13, 1753, 474, 29928, 7295, 13, 1678, 19964, 29889, 1266, 29918, 2817, 29889, 2697, 9966, 580, 13, 1678, 432, 1066, 29918, 1761, 353, 518, 13, 4706, 518, 29941, 29889, 29896, 29953, 29955, 29900, 29896, 29941, 29955, 29953, 29955, 29906, 29945, 29896, 29941, 29945, 29953, 29945, 29892, 448, 29896, 29889, 29945, 29947, 29929, 29953, 29947, 29945, 29945, 29955, 29955, 29946, 29953, 29947, 29906, 29906, 29906, 29946, 29892, 448, 29900, 29889, 29900, 29941, 29900, 29946, 29929, 29900, 29955, 29941, 29900, 29906, 29945, 29946, 29955, 29900, 29945, 29955, 29906, 29906, 29892, 29871, 29896, 29889, 29945, 29906, 29947, 29953, 29953, 29955, 29945, 29946, 29945, 29900, 29955, 29896, 29900, 29946, 29953, 29941, 29892, 259, 448, 29900, 29889, 29900, 29941, 29906, 29941, 29947, 29953, 29896, 29896, 29945, 29947, 29906, 29896, 29896, 29900, 29929, 29947, 29945, 29946, 29892, 448, 29900, 29889, 29900, 29941, 29953, 29900, 29945, 29945, 29946, 29955, 29947, 29953, 29929, 29955, 29941, 29929, 29941, 29906, 29946, 29892, 448, 29900, 29889, 29900, 29906, 29953, 29945, 29896, 29896, 29896, 29896, 29900, 29955, 29900, 29955, 29900, 29900, 29947, 29953, 29945, 29946, 1402, 13, 4706, 518, 29945, 29889, 29896, 29946, 29955, 29900, 29953, 29946, 29900, 29945, 29906, 29941, 29906, 29955, 29900, 29947, 29955, 29892, 448, 29871, 29896, 29889, 29941, 29953, 29906, 29906, 29929, 29945, 29955, 29896, 29941, 29946, 29955, 29947, 29955, 29953, 29941, 29929, 29892, 448, 29900, 29889, 29946, 29953, 29929, 29945, 29896, 29906, 29900, 29955, 29946, 29946, 29955, 29900, 29906, 29941, 29947, 29941, 29945, 29892, 259, 29896, 29889, 29946, 29953, 29906, 29896, 29929, 29953, 29945, 29945, 29947, 29945, 29941, 29906, 29947, 29896, 29929, 29953, 29892, 259, 448, 29900, 29889, 29953, 29945, 29906, 29945, 29900, 29947, 29946, 29946, 29896, 29929, 29896, 29941, 29900, 29900, 29896, 29945, 29892, 268, 29900, 29889, 29929, 29900, 29946, 29906, 29945, 29947, 29953, 29946, 29906, 29955, 29906, 29929, 29941, 29896, 29941, 29955, 29892, 29871, 448, 29896, 29889, 29900, 29900, 29945, 29906, 29953, 29946, 29941, 29906, 29945, 29955, 29953, 29906, 29906, 29955, 1402, 13, 4706, 518, 29946, 29889, 29896, 29906, 29896, 29941, 29941, 29955, 29946, 29947, 29953, 29941, 29929, 29896, 29941, 29953, 29955, 29892, 1678, 29900, 29889, 29945, 29955, 29900, 29941, 29946, 29941, 29941, 29945, 29929, 29929, 29941, 29896, 29929, 29941, 29955, 29946, 29892, 448, 29906, 29889, 29906, 29896, 29955, 29945, 29945, 29953, 29929, 29941, 29906, 29947, 29941, 29945, 29945, 29955, 29906, 29946, 29892, 1678, 29906, 29889, 29900, 29946, 29929, 29955, 29947, 29941, 29945, 29953, 29946, 29929, 29929, 29929, 29929, 29906, 29955, 29892, 1678, 448, 29900, 29889, 29906, 29929, 29945, 29945, 29946, 29941, 29906, 29946, 29929, 29900, 29945, 29955, 29896, 29955, 29906, 29945, 29892, 259, 448, 29900, 29889, 29953, 29946, 29953, 29941, 29953, 29953, 29906, 29946, 29955, 29945, 29941, 29941, 29896, 29941, 29953, 29892, 259, 448, 29896, 29889, 29946, 29900, 29946, 29900, 29953, 29896, 29941, 29900, 29945, 29900, 29946, 29900, 29929, 29945, 29946, 29945, 1402, 13, 4706, 518, 29941, 29889, 29896, 29900, 29906, 29947, 29941, 29896, 29900, 29906, 29945, 29941, 29929, 29900, 29955, 29947, 29906, 29892, 448, 29871, 29900, 29889, 29900, 29946, 29906, 29929, 29953, 29953, 29953, 29945, 29945, 29896, 29945, 29953, 29896, 29900, 29906, 29900, 29896, 29892, 29871, 29900, 29889, 29896, 29941, 29953, 29896, 29946, 29953, 29955, 29945, 29955, 29900, 29896, 29947, 29955, 29947, 29929, 29945, 29892, 1678, 29900, 29889, 29900, 29946, 29945, 29945, 29947, 29900, 29896, 29900, 29945, 29900, 29945, 29946, 29955, 29947, 29946, 29900, 29955, 29953, 29892, 448, 29941, 29889, 29900, 29906, 29896, 29941, 29906, 29896, 29946, 29947, 29946, 29947, 29906, 29947, 29946, 29953, 29945, 29955, 29892, 268, 29900, 29889, 29900, 29955, 29896, 29946, 29955, 29906, 29947, 29900, 29955, 29941, 29906, 29929, 29941, 29946, 29945, 29947, 29892, 29871, 448, 29900, 29889, 29906, 29946, 29953, 29953, 29896, 29946, 29929, 29947, 29941, 29941, 29906, 29896, 29900, 29896, 29900, 29955, 29941, 29962, 13, 4706, 4514, 13, 13, 1678, 363, 474, 29892, 432, 1066, 297, 26985, 29898, 29926, 1066, 29918, 1761, 1125, 13, 13, 4706, 19964, 29889, 2697, 9966, 3970, 29943, 9065, 29898, 29926, 1066, 29892, 1722, 336, 345, 2272, 29889, 29968, 262, 8434, 29889, 5596, 29931, 326, 1169, 4276, 29889, 26521, 29897, 13, 4706, 19964, 29889, 2697, 9966, 3970, 29943, 29963, 295, 542, 1907, 29898, 23749, 29889, 3298, 359, 29898, 29955, 876, 13, 13, 4706, 432, 7345, 353, 19964, 29889, 20606, 29872, 797, 3901, 29928, 2926, 1199, 4197, 2314, 13, 4706, 1596, 525, 29926, 1066, 19660, 6525, 8310, 7345, 1912, 29901, 6571, 4286, 4830, 29898, 29875, 29892, 525, 15300, 7122, 18959, 25641, 29955, 29889, 29941, 29888, 29913, 4286, 4830, 29898, 29916, 29897, 363, 921, 297, 432, 7345, 29961, 307, 7451, 29889, 2577, 9966, 3970, 29943, 2568, 1575, 580, 5262, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 1722, 336, 345, 2272, 29889, 29934, 1351, 6644, 6646, 29898, 5574, 29897, 13, 1678, 1722, 336, 345, 2272, 29889, 29885, 10669, 29889, 6644, 6585, 4717, 12064, 3403, 3460, 580, 13, 13, 1678, 396, 902, 29890, 2272, 29918, 5085, 353, 11117, 3601, 2396, 5085, 29889, 3601, 29892, 13, 1678, 396, 18884, 525, 14930, 29918, 29894, 15580, 2396, 5085, 29889, 29894, 15580, 29892, 13, 1678, 396, 18884, 525, 307, 7451, 29918, 3134, 2396, 5085, 29889, 307, 7451, 29918, 3134, 29892, 13, 1678, 396, 18884, 525, 6272, 29918, 2084, 2396, 5085, 29889, 6272, 29918, 3134, 29892, 13, 1678, 396, 18884, 525, 10199, 1582, 29918, 3601, 2396, 5085, 29889, 10199, 1582, 29918, 3601, 29913, 13, 1678, 396, 565, 6389, 29889, 3601, 322, 451, 6389, 29889, 10199, 1582, 29918, 3601, 29901, 13, 1678, 396, 268, 902, 29890, 2272, 29918, 5085, 1839, 10199, 1582, 29918, 3601, 2033, 353, 6389, 29889, 3601, 13, 13, 1678, 8829, 29892, 19964, 353, 902, 29890, 2272, 29889, 24926, 29898, 3601, 29922, 5574, 29892, 2377, 1582, 29918, 3601, 29922, 5574, 29897, 13, 1678, 474, 29928, 580, 13, 2 ]
experiments/ab_tmd/run_experiment.py
eltonfss/TMDLibrary
0
180107
<reponame>eltonfss/TMDLibrary from experiments.tmd_experiment_base import TMDExperiment from os import path from detectors.ab_tmd import AdaBoostTMD experiment = TMDExperiment( experiment_path=path.abspath(path.dirname(__file__)), detector_type=AdaBoostTMD ) experiment.run()
[ 1, 529, 276, 1112, 420, 29958, 295, 880, 29888, 893, 29914, 29911, 5773, 12284, 13, 3166, 15729, 29889, 29873, 3487, 29918, 735, 15362, 29918, 3188, 1053, 323, 5773, 1252, 15362, 13, 3166, 2897, 1053, 2224, 13, 3166, 6459, 943, 29889, 370, 29918, 29873, 3487, 1053, 23255, 8431, 520, 29911, 5773, 13, 13, 735, 15362, 353, 323, 5773, 1252, 15362, 29898, 13, 1678, 7639, 29918, 2084, 29922, 2084, 29889, 370, 1028, 493, 29898, 2084, 29889, 25721, 22168, 1445, 1649, 8243, 13, 1678, 1439, 3019, 29918, 1853, 29922, 29909, 1388, 8431, 520, 29911, 5773, 13, 29897, 13, 735, 15362, 29889, 3389, 580, 13, 13, 2 ]
lingvo/core/lstm_frnn_layer_test.py
halostorm/lingvo
1
133477
<filename>lingvo/core/lstm_frnn_layer_test.py # Lint as: python3 # Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tests for lingvo.core.lstm_frnn_layer.""" from absl.testing import parameterized from lingvo import compat as tf from lingvo.core import lstm_frnn_layer from lingvo.core import py_utils from lingvo.core import rnn_cell from lingvo.core import rnn_layers from lingvo.core import test_utils import numpy as np _INIT_RANDOM_SEED = 2020 _RANDOM_SEED = 2019 class LSTMCellExtTest(test_utils.TestCase, parameterized.TestCase): def _GetParams(self, num_hidden_nodes=None): params = lstm_frnn_layer.LayerNormalizedLSTMCellLeanExt.Params() params.name = 'lstm' params.output_nonlinearity = True params.params_init = py_utils.WeightInit.Uniform(1.24, _INIT_RANDOM_SEED) params.vn.global_vn = False params.vn.per_step_vn = False params.num_input_nodes = 2 params.num_output_nodes = 2 if num_hidden_nodes: params.num_hidden_nodes = num_hidden_nodes params.zo_prob = 0.0 params.random_seed = _RANDOM_SEED return params def testLayerNormalizedLSTMCellLeanExt(self): cell_p = self._GetParams() seqlen, batch, input_dim = 4, 2, 2 inputs = tf.convert_to_tensor( np.random.rand(seqlen, batch, input_dim).astype(np.float32)) input_lens = np.random.randint(1, seqlen + 1, size=batch) paddings = 1. - tf.sequence_mask( input_lens, maxlen=seqlen, dtype=tf.float32) paddings = tf.transpose(paddings) reset_mask = tf.zeros((seqlen, batch), tf.float32) m0 = tf.convert_to_tensor( np.random.rand(batch, input_dim).astype(np.float32)) c0 = tf.convert_to_tensor( np.random.rand(batch, input_dim).astype(np.float32)) state0 = py_utils.NestedMap(m=m0, c=c0) with self.session() as sess: cell = cell_p.Instantiate() tf.global_variables_initializer().run() # The canonical path state = state0 for i in range(seqlen): state, _ = cell.FPropDefaultTheta( state, py_utils.NestedMap( act=[inputs[i, :, :]], padding=paddings[i, :, tf.newaxis], reset_mask=reset_mask[i, :, tf.newaxis])) expected_state = sess.run(state) # Taking input projection outside of the loop. cell_theta = cell.theta.copy() cell_theta.wm_i = cell_theta.wm[:cell.params.num_input_nodes, :] cell_theta.wm_h = cell_theta.wm[cell.params.num_input_nodes:, :] proj_inputs = cell.ProjectInputSequence(cell_theta, py_utils.NestedMap(act=[inputs])) state = state0 for i in range(seqlen): state, _ = cell.FPropWithProjectedInput( cell_theta, state, py_utils.NestedMap( proj_inputs=proj_inputs[i, :, :], padding=paddings[i, :, tf.newaxis], reset_mask=reset_mask[i, :, tf.newaxis])) actual_state = sess.run(state) tf.logging.info('expected_state:{}'.format(expected_state)) tf.logging.info('actual_state:{}'.format(actual_state)) self.assertAllClose(expected_state.m, actual_state.m) self.assertAllClose(expected_state.c, actual_state.c) class LstmFRNNTest(test_utils.TestCase, parameterized.TestCase): def _SetCellParams(self, cell_p, num_hidden_nodes=None): params = cell_p params.name = cell_p.cls.__name__ params.output_nonlinearity = True params.params_init = py_utils.WeightInit.Uniform(1.24, _INIT_RANDOM_SEED) params.vn.global_vn = False params.vn.per_step_vn = False params.num_input_nodes = 7 params.num_output_nodes = 9 if num_hidden_nodes: params.num_hidden_nodes = num_hidden_nodes params.zo_prob = 0.0 params.random_seed = _RANDOM_SEED def _GetTestInputs(self, packed_input): seqlen, batch, input_dim, output_dim = 4, 5, 7, 9 inputs = tf.convert_to_tensor( np.random.rand(seqlen, batch, input_dim).astype(np.float32)) input_lens = np.random.randint(1, seqlen + 1, size=batch) padding = 1. - tf.sequence_mask(input_lens, maxlen=seqlen, dtype=tf.float32) padding = tf.transpose(padding)[:, :, tf.newaxis] segment_id = None if packed_input: segment_id = tf.convert_to_tensor( np.random.randint(0, seqlen, (seqlen, batch, 1), np.int32)) m = tf.convert_to_tensor( np.random.rand(batch, output_dim).astype(np.float32)) c = tf.convert_to_tensor( np.random.rand(batch, output_dim).astype(np.float32)) return inputs, padding, m, c, segment_id def _testHelper(self, base_frnn_p, frnn_p, packed_input=False): inputs, padding, m0, c0, segment_id = self._GetTestInputs(packed_input) base_frnn = base_frnn_p.Instantiate() frnn = frnn_p.Instantiate() with self.session() as sess: tf.global_variables_initializer().run() state0 = py_utils.NestedMap(m=m0, c=c0) act, state = base_frnn.FPropDefaultTheta( inputs, padding, state0=state0, segment_id=segment_id) # Compute grads loss = -tf.log( tf.sigmoid((tf.reduce_sum(tf.math.square(act)) + tf.reduce_sum(state.m * state.c * state.c)))) grads = tf.gradients(loss, base_frnn.vars.Flatten()) expected_act, expected_state, expected_grads = sess.run( [act, state, grads]) act, state = frnn.FPropDefaultTheta( inputs, padding, state0=state0, segment_id=segment_id) # Compute grads loss = -tf.log( tf.sigmoid((tf.reduce_sum(tf.math.square(act)) + tf.reduce_sum(state.m * state.c * state.c)))) grads = tf.gradients(loss, frnn.vars.Flatten()) actual_act, actual_state, actual_grads = sess.run([act, state, grads]) tf.logging.info('expected_act:{}'.format(expected_act)) tf.logging.info('actual_act:{}'.format(actual_act)) tf.logging.info('expected_state:{}'.format(expected_state)) tf.logging.info('actual_state:{}'.format(actual_state)) tf.logging.info('expected_grads:{}'.format(expected_grads)) tf.logging.info('actual_grads:{}'.format(actual_grads)) self.assertAllClose(expected_act, actual_act) self.assertAllClose(expected_state.m, actual_state.m) self.assertAllClose(expected_state.c, actual_state.c) for (vname, _), expected, actual in zip(frnn.vars.FlattenItems(), expected_grads, actual_grads): self.assertAllClose(expected, actual, msg=vname) @parameterized.named_parameters( ('HasBias', True), ('NoBias', False), ('HasBiasPackedInputs', True, True), ('NoBiasPackedInputs', False, True), ) def testLSTMCellSimple(self, enable_lstm_bias, packed_inputs=False): base_cell_p = rnn_cell.LSTMCellSimple.Params() base_cell_p.enable_lstm_bias = enable_lstm_bias self._SetCellParams(base_cell_p) base_frnn_p = rnn_layers.FRNN.Params().Set( name='base_frnn', cell=base_cell_p) cell_p = lstm_frnn_layer.LSTMCellSimpleExt.Params() cell_p.enable_lstm_bias = enable_lstm_bias self._SetCellParams(cell_p) frnn_p = lstm_frnn_layer.LstmFRNN.Params().Set(name='frnn', cell=cell_p) self._testHelper(base_frnn_p, frnn_p, packed_inputs) def testLayerNormalizedLSTMCellSimple(self): base_cell_p = rnn_cell.LayerNormalizedLSTMCellSimple.Params() base_cell_p.enable_lstm_bias = True self._SetCellParams(base_cell_p) base_frnn_p = rnn_layers.FRNN.Params().Set( name='base_frnn', cell=base_cell_p) cell_p = lstm_frnn_layer.LayerNormalizedLSTMCellSimpleExt.Params() cell_p.enable_lstm_bias = True self._SetCellParams(cell_p) frnn_p = lstm_frnn_layer.LstmFRNN.Params().Set(name='frnn', cell=cell_p) self._testHelper(base_frnn_p, frnn_p) def testLayerNormalizedLSTMCellLean(self): base_cell_p = rnn_cell.LayerNormalizedLSTMCellLean.Params() base_cell_p.enable_lstm_bias = True self._SetCellParams(base_cell_p) base_frnn_p = rnn_layers.FRNN.Params().Set( name='base_frnn', cell=base_cell_p) cell_p = lstm_frnn_layer.LayerNormalizedLSTMCellLeanExt.Params() cell_p.enable_lstm_bias = True self._SetCellParams(cell_p) frnn_p = lstm_frnn_layer.LstmFRNN.Params().Set(name='frnn', cell=cell_p) self._testHelper(base_frnn_p, frnn_p) if __name__ == '__main__': tf.test.main()
[ 1, 529, 9507, 29958, 1847, 1365, 29914, 3221, 29914, 20155, 29885, 29918, 1341, 15755, 29918, 13148, 29918, 1688, 29889, 2272, 13, 29937, 365, 524, 408, 29901, 3017, 29941, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 450, 323, 6073, 17907, 13189, 943, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 15945, 29908, 24376, 363, 16850, 1365, 29889, 3221, 29889, 20155, 29885, 29918, 1341, 15755, 29918, 13148, 1213, 15945, 13, 13, 3166, 633, 2536, 29889, 13424, 1053, 3443, 1891, 13, 13, 3166, 16850, 1365, 1053, 10007, 408, 15886, 13, 3166, 16850, 1365, 29889, 3221, 1053, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 13, 3166, 16850, 1365, 29889, 3221, 1053, 11451, 29918, 13239, 13, 3166, 16850, 1365, 29889, 3221, 1053, 364, 15755, 29918, 3729, 13, 3166, 16850, 1365, 29889, 3221, 1053, 364, 15755, 29918, 29277, 13, 3166, 16850, 1365, 29889, 3221, 1053, 1243, 29918, 13239, 13, 13, 5215, 12655, 408, 7442, 13, 13, 29918, 26019, 29918, 29934, 2190, 22141, 29918, 1660, 3352, 353, 29871, 29906, 29900, 29906, 29900, 13, 29918, 29934, 2190, 22141, 29918, 1660, 3352, 353, 29871, 29906, 29900, 29896, 29929, 13, 13, 13, 1990, 365, 1254, 29924, 4617, 5647, 3057, 29898, 1688, 29918, 13239, 29889, 3057, 8259, 29892, 3443, 1891, 29889, 3057, 8259, 1125, 13, 13, 29871, 822, 903, 2577, 9629, 29898, 1311, 29892, 954, 29918, 10892, 29918, 18010, 29922, 8516, 1125, 13, 1678, 8636, 353, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 29889, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 3226, 273, 5647, 29889, 9629, 580, 13, 1678, 8636, 29889, 978, 353, 525, 20155, 29885, 29915, 13, 1678, 8636, 29889, 4905, 29918, 5464, 10660, 537, 353, 5852, 13, 1678, 8636, 29889, 7529, 29918, 2344, 353, 11451, 29918, 13239, 29889, 22676, 6644, 29889, 2525, 5560, 29898, 29896, 29889, 29906, 29946, 29892, 903, 26019, 29918, 29934, 2190, 22141, 29918, 1660, 3352, 29897, 13, 1678, 8636, 29889, 18564, 29889, 10945, 29918, 18564, 353, 7700, 13, 1678, 8636, 29889, 18564, 29889, 546, 29918, 10568, 29918, 18564, 353, 7700, 13, 1678, 8636, 29889, 1949, 29918, 2080, 29918, 18010, 353, 29871, 29906, 13, 1678, 8636, 29889, 1949, 29918, 4905, 29918, 18010, 353, 29871, 29906, 13, 1678, 565, 954, 29918, 10892, 29918, 18010, 29901, 13, 418, 8636, 29889, 1949, 29918, 10892, 29918, 18010, 353, 954, 29918, 10892, 29918, 18010, 13, 1678, 8636, 29889, 2502, 29918, 22795, 353, 29871, 29900, 29889, 29900, 13, 1678, 8636, 29889, 8172, 29918, 26776, 353, 903, 29934, 2190, 22141, 29918, 1660, 3352, 13, 1678, 736, 8636, 13, 13, 29871, 822, 1243, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 3226, 273, 5647, 29898, 1311, 1125, 13, 1678, 3038, 29918, 29886, 353, 1583, 3032, 2577, 9629, 580, 13, 13, 1678, 409, 1519, 264, 29892, 9853, 29892, 1881, 29918, 6229, 353, 29871, 29946, 29892, 29871, 29906, 29892, 29871, 29906, 13, 1678, 10970, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29898, 344, 1519, 264, 29892, 9853, 29892, 1881, 29918, 6229, 467, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 1678, 1881, 29918, 29880, 575, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29896, 29892, 409, 1519, 264, 718, 29871, 29896, 29892, 2159, 29922, 16175, 29897, 13, 1678, 282, 1202, 886, 353, 29871, 29896, 29889, 448, 15886, 29889, 16506, 29918, 13168, 29898, 13, 4706, 1881, 29918, 29880, 575, 29892, 4236, 2435, 29922, 344, 1519, 264, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 29897, 13, 1678, 282, 1202, 886, 353, 15886, 29889, 3286, 4220, 29898, 29886, 1202, 886, 29897, 13, 1678, 10092, 29918, 13168, 353, 15886, 29889, 3298, 359, 3552, 344, 1519, 264, 29892, 9853, 511, 15886, 29889, 7411, 29941, 29906, 29897, 13, 1678, 286, 29900, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29898, 16175, 29892, 1881, 29918, 6229, 467, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 1678, 274, 29900, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29898, 16175, 29892, 1881, 29918, 6229, 467, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 1678, 2106, 29900, 353, 11451, 29918, 13239, 29889, 29940, 2868, 3388, 29898, 29885, 29922, 29885, 29900, 29892, 274, 29922, 29883, 29900, 29897, 13, 13, 1678, 411, 1583, 29889, 7924, 580, 408, 27937, 29901, 13, 418, 3038, 353, 3038, 29918, 29886, 29889, 3379, 3656, 403, 580, 13, 418, 15886, 29889, 10945, 29918, 20897, 29918, 11228, 3950, 2141, 3389, 580, 13, 13, 418, 396, 450, 24420, 2224, 13, 418, 2106, 353, 2106, 29900, 13, 418, 363, 474, 297, 3464, 29898, 344, 1519, 264, 1125, 13, 4706, 2106, 29892, 903, 353, 3038, 29889, 29943, 20420, 4592, 17458, 29898, 13, 9651, 2106, 29892, 13, 9651, 11451, 29918, 13239, 29889, 29940, 2868, 3388, 29898, 13, 18884, 1044, 11759, 2080, 29879, 29961, 29875, 29892, 584, 29892, 584, 20526, 13, 18884, 7164, 29922, 29886, 1202, 886, 29961, 29875, 29892, 584, 29892, 15886, 29889, 1482, 8990, 1402, 13, 18884, 10092, 29918, 13168, 29922, 12071, 29918, 13168, 29961, 29875, 29892, 584, 29892, 15886, 29889, 1482, 8990, 12622, 13, 418, 3806, 29918, 3859, 353, 27937, 29889, 3389, 29898, 3859, 29897, 13, 13, 418, 396, 323, 5086, 1881, 18246, 5377, 310, 278, 2425, 29889, 13, 418, 3038, 29918, 3416, 353, 3038, 29889, 3416, 29889, 8552, 580, 13, 418, 3038, 29918, 3416, 29889, 29893, 29885, 29918, 29875, 353, 3038, 29918, 3416, 29889, 29893, 29885, 7503, 3729, 29889, 7529, 29889, 1949, 29918, 2080, 29918, 18010, 29892, 584, 29962, 13, 418, 3038, 29918, 3416, 29889, 29893, 29885, 29918, 29882, 353, 3038, 29918, 3416, 29889, 29893, 29885, 29961, 3729, 29889, 7529, 29889, 1949, 29918, 2080, 29918, 18010, 29901, 29892, 584, 29962, 13, 418, 410, 29926, 29918, 2080, 29879, 353, 3038, 29889, 7653, 4290, 20529, 29898, 3729, 29918, 3416, 29892, 13, 462, 462, 795, 11451, 29918, 13239, 29889, 29940, 2868, 3388, 29898, 627, 11759, 2080, 29879, 12622, 13, 418, 2106, 353, 2106, 29900, 13, 418, 363, 474, 297, 3464, 29898, 344, 1519, 264, 1125, 13, 4706, 2106, 29892, 903, 353, 3038, 29889, 29943, 20420, 3047, 7653, 287, 4290, 29898, 13, 9651, 3038, 29918, 3416, 29892, 2106, 29892, 13, 9651, 11451, 29918, 13239, 29889, 29940, 2868, 3388, 29898, 13, 18884, 410, 29926, 29918, 2080, 29879, 29922, 20865, 29918, 2080, 29879, 29961, 29875, 29892, 584, 29892, 584, 1402, 13, 18884, 7164, 29922, 29886, 1202, 886, 29961, 29875, 29892, 584, 29892, 15886, 29889, 1482, 8990, 1402, 13, 18884, 10092, 29918, 13168, 29922, 12071, 29918, 13168, 29961, 29875, 29892, 584, 29892, 15886, 29889, 1482, 8990, 12622, 13, 418, 3935, 29918, 3859, 353, 27937, 29889, 3389, 29898, 3859, 29897, 13, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 9684, 29918, 3859, 29901, 8875, 4286, 4830, 29898, 9684, 29918, 3859, 876, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 19304, 29918, 3859, 29901, 8875, 4286, 4830, 29898, 19304, 29918, 3859, 876, 13, 1678, 1583, 29889, 9294, 3596, 11123, 29898, 9684, 29918, 3859, 29889, 29885, 29892, 3935, 29918, 3859, 29889, 29885, 29897, 13, 1678, 1583, 29889, 9294, 3596, 11123, 29898, 9684, 29918, 3859, 29889, 29883, 29892, 3935, 29918, 3859, 29889, 29883, 29897, 13, 13, 13, 1990, 365, 303, 29885, 15860, 10262, 3057, 29898, 1688, 29918, 13239, 29889, 3057, 8259, 29892, 3443, 1891, 29889, 3057, 8259, 1125, 13, 13, 29871, 822, 903, 2697, 4617, 9629, 29898, 1311, 29892, 3038, 29918, 29886, 29892, 954, 29918, 10892, 29918, 18010, 29922, 8516, 1125, 13, 1678, 8636, 353, 3038, 29918, 29886, 13, 1678, 8636, 29889, 978, 353, 3038, 29918, 29886, 29889, 25932, 17255, 978, 1649, 13, 1678, 8636, 29889, 4905, 29918, 5464, 10660, 537, 353, 5852, 13, 1678, 8636, 29889, 7529, 29918, 2344, 353, 11451, 29918, 13239, 29889, 22676, 6644, 29889, 2525, 5560, 29898, 29896, 29889, 29906, 29946, 29892, 903, 26019, 29918, 29934, 2190, 22141, 29918, 1660, 3352, 29897, 13, 1678, 8636, 29889, 18564, 29889, 10945, 29918, 18564, 353, 7700, 13, 1678, 8636, 29889, 18564, 29889, 546, 29918, 10568, 29918, 18564, 353, 7700, 13, 1678, 8636, 29889, 1949, 29918, 2080, 29918, 18010, 353, 29871, 29955, 13, 1678, 8636, 29889, 1949, 29918, 4905, 29918, 18010, 353, 29871, 29929, 13, 1678, 565, 954, 29918, 10892, 29918, 18010, 29901, 13, 418, 8636, 29889, 1949, 29918, 10892, 29918, 18010, 353, 954, 29918, 10892, 29918, 18010, 13, 1678, 8636, 29889, 2502, 29918, 22795, 353, 29871, 29900, 29889, 29900, 13, 1678, 8636, 29889, 8172, 29918, 26776, 353, 903, 29934, 2190, 22141, 29918, 1660, 3352, 13, 13, 29871, 822, 903, 2577, 3057, 4290, 29879, 29898, 1311, 29892, 4870, 287, 29918, 2080, 1125, 13, 1678, 409, 1519, 264, 29892, 9853, 29892, 1881, 29918, 6229, 29892, 1962, 29918, 6229, 353, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29955, 29892, 29871, 29929, 13, 1678, 10970, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29898, 344, 1519, 264, 29892, 9853, 29892, 1881, 29918, 6229, 467, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 1678, 1881, 29918, 29880, 575, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29896, 29892, 409, 1519, 264, 718, 29871, 29896, 29892, 2159, 29922, 16175, 29897, 13, 1678, 7164, 353, 29871, 29896, 29889, 448, 15886, 29889, 16506, 29918, 13168, 29898, 2080, 29918, 29880, 575, 29892, 4236, 2435, 29922, 344, 1519, 264, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 29897, 13, 1678, 7164, 353, 15886, 29889, 3286, 4220, 29898, 12791, 29897, 7503, 29892, 584, 29892, 15886, 29889, 1482, 8990, 29962, 13, 1678, 10768, 29918, 333, 353, 6213, 13, 1678, 565, 4870, 287, 29918, 2080, 29901, 13, 418, 10768, 29918, 333, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 3986, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 409, 1519, 264, 29892, 313, 344, 1519, 264, 29892, 9853, 29892, 29871, 29896, 511, 7442, 29889, 524, 29941, 29906, 876, 13, 13, 1678, 286, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29898, 16175, 29892, 1962, 29918, 6229, 467, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 1678, 274, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29898, 16175, 29892, 1962, 29918, 6229, 467, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 1678, 736, 10970, 29892, 7164, 29892, 286, 29892, 274, 29892, 10768, 29918, 333, 13, 13, 29871, 822, 903, 1688, 10739, 29898, 1311, 29892, 2967, 29918, 1341, 15755, 29918, 29886, 29892, 1424, 15755, 29918, 29886, 29892, 4870, 287, 29918, 2080, 29922, 8824, 1125, 13, 1678, 10970, 29892, 7164, 29892, 286, 29900, 29892, 274, 29900, 29892, 10768, 29918, 333, 353, 1583, 3032, 2577, 3057, 4290, 29879, 29898, 4058, 287, 29918, 2080, 29897, 13, 1678, 2967, 29918, 1341, 15755, 353, 2967, 29918, 1341, 15755, 29918, 29886, 29889, 3379, 3656, 403, 580, 13, 1678, 1424, 15755, 353, 1424, 15755, 29918, 29886, 29889, 3379, 3656, 403, 580, 13, 13, 1678, 411, 1583, 29889, 7924, 580, 408, 27937, 29901, 13, 418, 15886, 29889, 10945, 29918, 20897, 29918, 11228, 3950, 2141, 3389, 580, 13, 13, 418, 2106, 29900, 353, 11451, 29918, 13239, 29889, 29940, 2868, 3388, 29898, 29885, 29922, 29885, 29900, 29892, 274, 29922, 29883, 29900, 29897, 13, 418, 1044, 29892, 2106, 353, 2967, 29918, 1341, 15755, 29889, 29943, 20420, 4592, 17458, 29898, 13, 3986, 10970, 29892, 7164, 29892, 2106, 29900, 29922, 3859, 29900, 29892, 10768, 29918, 333, 29922, 28192, 29918, 333, 29897, 13, 418, 396, 11796, 29872, 4656, 29879, 13, 418, 6410, 353, 448, 13264, 29889, 1188, 29898, 13, 3986, 15886, 29889, 18816, 29885, 3398, 3552, 13264, 29889, 17469, 29918, 2083, 29898, 13264, 29889, 755, 29889, 17619, 29898, 627, 876, 718, 13, 462, 418, 15886, 29889, 17469, 29918, 2083, 29898, 3859, 29889, 29885, 334, 2106, 29889, 29883, 334, 2106, 29889, 29883, 13697, 13, 418, 4656, 29879, 353, 15886, 29889, 5105, 10070, 29898, 6758, 29892, 2967, 29918, 1341, 15755, 29889, 16908, 29889, 29943, 5066, 841, 3101, 13, 13, 418, 3806, 29918, 627, 29892, 3806, 29918, 3859, 29892, 3806, 29918, 5105, 29879, 353, 27937, 29889, 3389, 29898, 13, 3986, 518, 627, 29892, 2106, 29892, 4656, 29879, 2314, 13, 13, 418, 1044, 29892, 2106, 353, 1424, 15755, 29889, 29943, 20420, 4592, 17458, 29898, 13, 3986, 10970, 29892, 7164, 29892, 2106, 29900, 29922, 3859, 29900, 29892, 10768, 29918, 333, 29922, 28192, 29918, 333, 29897, 13, 418, 396, 11796, 29872, 4656, 29879, 13, 418, 6410, 353, 448, 13264, 29889, 1188, 29898, 13, 3986, 15886, 29889, 18816, 29885, 3398, 3552, 13264, 29889, 17469, 29918, 2083, 29898, 13264, 29889, 755, 29889, 17619, 29898, 627, 876, 718, 13, 462, 418, 15886, 29889, 17469, 29918, 2083, 29898, 3859, 29889, 29885, 334, 2106, 29889, 29883, 334, 2106, 29889, 29883, 13697, 13, 418, 4656, 29879, 353, 15886, 29889, 5105, 10070, 29898, 6758, 29892, 1424, 15755, 29889, 16908, 29889, 29943, 5066, 841, 3101, 13, 13, 418, 3935, 29918, 627, 29892, 3935, 29918, 3859, 29892, 3935, 29918, 5105, 29879, 353, 27937, 29889, 3389, 4197, 627, 29892, 2106, 29892, 4656, 29879, 2314, 13, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 9684, 29918, 627, 29901, 8875, 4286, 4830, 29898, 9684, 29918, 627, 876, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 19304, 29918, 627, 29901, 8875, 4286, 4830, 29898, 19304, 29918, 627, 876, 13, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 9684, 29918, 3859, 29901, 8875, 4286, 4830, 29898, 9684, 29918, 3859, 876, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 19304, 29918, 3859, 29901, 8875, 4286, 4830, 29898, 19304, 29918, 3859, 876, 13, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 9684, 29918, 5105, 29879, 29901, 8875, 4286, 4830, 29898, 9684, 29918, 5105, 29879, 876, 13, 1678, 15886, 29889, 21027, 29889, 3888, 877, 19304, 29918, 5105, 29879, 29901, 8875, 4286, 4830, 29898, 19304, 29918, 5105, 29879, 876, 13, 13, 1678, 1583, 29889, 9294, 3596, 11123, 29898, 9684, 29918, 627, 29892, 3935, 29918, 627, 29897, 13, 1678, 1583, 29889, 9294, 3596, 11123, 29898, 9684, 29918, 3859, 29889, 29885, 29892, 3935, 29918, 3859, 29889, 29885, 29897, 13, 1678, 1583, 29889, 9294, 3596, 11123, 29898, 9684, 29918, 3859, 29889, 29883, 29892, 3935, 29918, 3859, 29889, 29883, 29897, 13, 1678, 363, 313, 29894, 978, 29892, 903, 511, 3806, 29892, 3935, 297, 14319, 29898, 1341, 15755, 29889, 16908, 29889, 29943, 5066, 841, 6913, 3285, 13, 462, 462, 9651, 3806, 29918, 5105, 29879, 29892, 3935, 29918, 5105, 29879, 1125, 13, 418, 1583, 29889, 9294, 3596, 11123, 29898, 9684, 29892, 3935, 29892, 10191, 29922, 29894, 978, 29897, 13, 13, 29871, 732, 15501, 1891, 29889, 17514, 29918, 16744, 29898, 13, 418, 6702, 14510, 29933, 3173, 742, 5852, 511, 13, 418, 6702, 3782, 29933, 3173, 742, 7700, 511, 13, 418, 6702, 14510, 29933, 3173, 16638, 287, 4290, 29879, 742, 5852, 29892, 5852, 511, 13, 418, 6702, 3782, 29933, 3173, 16638, 287, 4290, 29879, 742, 7700, 29892, 5852, 511, 13, 29871, 1723, 13, 29871, 822, 1243, 29931, 1254, 29924, 4617, 15427, 29898, 1311, 29892, 9025, 29918, 20155, 29885, 29918, 29890, 3173, 29892, 4870, 287, 29918, 2080, 29879, 29922, 8824, 1125, 13, 1678, 2967, 29918, 3729, 29918, 29886, 353, 364, 15755, 29918, 3729, 29889, 29931, 1254, 29924, 4617, 15427, 29889, 9629, 580, 13, 1678, 2967, 29918, 3729, 29918, 29886, 29889, 12007, 29918, 20155, 29885, 29918, 29890, 3173, 353, 9025, 29918, 20155, 29885, 29918, 29890, 3173, 13, 1678, 1583, 3032, 2697, 4617, 9629, 29898, 3188, 29918, 3729, 29918, 29886, 29897, 13, 1678, 2967, 29918, 1341, 15755, 29918, 29886, 353, 364, 15755, 29918, 29277, 29889, 15860, 10262, 29889, 9629, 2141, 2697, 29898, 13, 4706, 1024, 2433, 3188, 29918, 1341, 15755, 742, 3038, 29922, 3188, 29918, 3729, 29918, 29886, 29897, 13, 13, 1678, 3038, 29918, 29886, 353, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 29889, 29931, 1254, 29924, 4617, 15427, 5647, 29889, 9629, 580, 13, 1678, 3038, 29918, 29886, 29889, 12007, 29918, 20155, 29885, 29918, 29890, 3173, 353, 9025, 29918, 20155, 29885, 29918, 29890, 3173, 13, 1678, 1583, 3032, 2697, 4617, 9629, 29898, 3729, 29918, 29886, 29897, 13, 1678, 1424, 15755, 29918, 29886, 353, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 29889, 29931, 303, 29885, 15860, 10262, 29889, 9629, 2141, 2697, 29898, 978, 2433, 1341, 15755, 742, 3038, 29922, 3729, 29918, 29886, 29897, 13, 1678, 1583, 3032, 1688, 10739, 29898, 3188, 29918, 1341, 15755, 29918, 29886, 29892, 1424, 15755, 29918, 29886, 29892, 4870, 287, 29918, 2080, 29879, 29897, 13, 13, 29871, 822, 1243, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 15427, 29898, 1311, 1125, 13, 1678, 2967, 29918, 3729, 29918, 29886, 353, 364, 15755, 29918, 3729, 29889, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 15427, 29889, 9629, 580, 13, 1678, 2967, 29918, 3729, 29918, 29886, 29889, 12007, 29918, 20155, 29885, 29918, 29890, 3173, 353, 5852, 13, 1678, 1583, 3032, 2697, 4617, 9629, 29898, 3188, 29918, 3729, 29918, 29886, 29897, 13, 1678, 2967, 29918, 1341, 15755, 29918, 29886, 353, 364, 15755, 29918, 29277, 29889, 15860, 10262, 29889, 9629, 2141, 2697, 29898, 13, 4706, 1024, 2433, 3188, 29918, 1341, 15755, 742, 3038, 29922, 3188, 29918, 3729, 29918, 29886, 29897, 13, 13, 1678, 3038, 29918, 29886, 353, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 29889, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 15427, 5647, 29889, 9629, 580, 13, 1678, 3038, 29918, 29886, 29889, 12007, 29918, 20155, 29885, 29918, 29890, 3173, 353, 5852, 13, 1678, 1583, 3032, 2697, 4617, 9629, 29898, 3729, 29918, 29886, 29897, 13, 1678, 1424, 15755, 29918, 29886, 353, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 29889, 29931, 303, 29885, 15860, 10262, 29889, 9629, 2141, 2697, 29898, 978, 2433, 1341, 15755, 742, 3038, 29922, 3729, 29918, 29886, 29897, 13, 1678, 1583, 3032, 1688, 10739, 29898, 3188, 29918, 1341, 15755, 29918, 29886, 29892, 1424, 15755, 29918, 29886, 29897, 13, 13, 29871, 822, 1243, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 3226, 273, 29898, 1311, 1125, 13, 1678, 2967, 29918, 3729, 29918, 29886, 353, 364, 15755, 29918, 3729, 29889, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 3226, 273, 29889, 9629, 580, 13, 1678, 2967, 29918, 3729, 29918, 29886, 29889, 12007, 29918, 20155, 29885, 29918, 29890, 3173, 353, 5852, 13, 1678, 1583, 3032, 2697, 4617, 9629, 29898, 3188, 29918, 3729, 29918, 29886, 29897, 13, 1678, 2967, 29918, 1341, 15755, 29918, 29886, 353, 364, 15755, 29918, 29277, 29889, 15860, 10262, 29889, 9629, 2141, 2697, 29898, 13, 4706, 1024, 2433, 3188, 29918, 1341, 15755, 742, 3038, 29922, 3188, 29918, 3729, 29918, 29886, 29897, 13, 13, 1678, 3038, 29918, 29886, 353, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 29889, 14420, 19077, 1891, 29931, 1254, 29924, 4617, 3226, 273, 5647, 29889, 9629, 580, 13, 1678, 3038, 29918, 29886, 29889, 12007, 29918, 20155, 29885, 29918, 29890, 3173, 353, 5852, 13, 1678, 1583, 3032, 2697, 4617, 9629, 29898, 3729, 29918, 29886, 29897, 13, 1678, 1424, 15755, 29918, 29886, 353, 24471, 29885, 29918, 1341, 15755, 29918, 13148, 29889, 29931, 303, 29885, 15860, 10262, 29889, 9629, 2141, 2697, 29898, 978, 2433, 1341, 15755, 742, 3038, 29922, 3729, 29918, 29886, 29897, 13, 1678, 1583, 3032, 1688, 10739, 29898, 3188, 29918, 1341, 15755, 29918, 29886, 29892, 1424, 15755, 29918, 29886, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 29871, 15886, 29889, 1688, 29889, 3396, 580, 13, 2 ]
tests/cli/templar_test.py
Cal-CS-61A-Staff/templar
6
104557
"""End-to-end test for templar/cli/templar.py""" from templar.api.config import ConfigBuilderError from templar.cli import templar import io import mock import os.path import shutil import unittest STAGING_DIR = os.path.join('tests', 'cli', 'staging') TEST_DATA = os.path.join('tests', 'cli', 'test_data') class TemplarTest(unittest.TestCase): def setUp(self): os.mkdir(STAGING_DIR) def tearDown(self): shutil.rmtree(STAGING_DIR) def testConfigNotFound(self): with self.assertRaises(ConfigBuilderError) as cm: templar.run(templar.flags([ '-s', os.path.join(TEST_DATA, 'file.md'), '-c', os.path.join('no', 'such', 'config.py'), '--debug', ])) self.assertEqual('Could not find config file: no/such/config.py', str(cm.exception)) def testConfig_withNoVariableFails(self): with self.assertRaises(ConfigBuilderError) as cm: templar.run(templar.flags([ '-s', os.path.join(TEST_DATA, 'file.md'), '-c', os.path.join(TEST_DATA, 'no_variable_config.py'), '--debug', ])) self.assertEqual( 'Could not load config file "tests/cli/test_data/no_variable_config.py": ' 'config files must contain a variable called "config" that is assigned to ' 'a Config object.', str(cm.exception)) def testConfig_whoseVariableIsNotAConfig(self): with self.assertRaises(ConfigBuilderError) as cm: templar.run(templar.flags([ '-s', os.path.join(TEST_DATA, 'file.md'), '-c', os.path.join(TEST_DATA, 'invalid_variable_config.py'), '--debug', ])) self.assertEqual( 'Could not load config file "tests/cli/test_data/invalid_variable_config.py": ' 'config files must contain a variable called "config" that is assigned to ' 'a Config object.', str(cm.exception)) def testWriteToDestination(self): destination_file = os.path.join(STAGING_DIR, 'destination.html') templar.run(templar.flags([ '-s', os.path.join(TEST_DATA, 'file.md'), '-c', os.path.join(TEST_DATA, 'config.py'), '-t', 'template.html', '-d', destination_file, '--debug', ])) self.assertTrue(os.path.isfile(destination_file)) with open(os.path.join(destination_file), 'r') as f: self.assertEqual('<p>Content in my block.</p>', f.read()) def testPrint(self): destination_file = os.path.join(STAGING_DIR, 'destination.html') with mock.patch('sys.stdout', new_callable=io.StringIO) as mock_stdout: templar.run(templar.flags([ '-s', os.path.join(TEST_DATA, 'file.md'), '-c', os.path.join(TEST_DATA, 'config.py'), '-t', 'template.html', '-d', destination_file, '--print', '--debug', ])) # Using --print should prevent writing to the destination. self.assertFalse(os.path.isfile(destination_file)) # There should be trailing newline because the print function adds a # newline at the end. self.assertEqual('<p>Content in my block.</p>\n', mock_stdout.getvalue()) def testPrintErrorIfDebugFlagNotUsed(self): destination_file = os.path.join(STAGING_DIR, 'destination.html') with self.assertRaises(SystemExit) as cm: with mock.patch('sys.stderr', new_callable=io.StringIO) as mock_stdout: templar.run(templar.flags([ # Missing both source and template causes an error. '-c', os.path.join(TEST_DATA, 'config.py'), ])) self.assertFalse(os.path.isfile(destination_file)) self.assertEqual( 'PublishError: When publishing, source and template cannot both be omitted.\n', mock_stdout.getvalue()) self.assertNotEqual(cm.exception.code, 0) def testCreateDestinationNonExistentDirectory(self): # The directiory STAGING_DIR/dir does not exist beforehand. self.assertFalse(os.path.isdir(os.path.join(STAGING_DIR, 'dir'))) destination_file = os.path.join(STAGING_DIR, 'dir', 'destination.html') templar.run(templar.flags([ '-s', os.path.join(TEST_DATA, 'file.md'), '-c', os.path.join(TEST_DATA, 'config.py'), '-t', 'template.html', '-d', destination_file, '--debug', ])) self.assertTrue(os.path.isfile(destination_file)) with open(os.path.join(destination_file), 'r') as f: self.assertEqual('<p>Content in my block.</p>', f.read())
[ 1, 9995, 5044, 29899, 517, 29899, 355, 1243, 363, 1350, 572, 279, 29914, 11303, 29914, 1356, 572, 279, 29889, 2272, 15945, 29908, 13, 13, 3166, 1350, 572, 279, 29889, 2754, 29889, 2917, 1053, 12782, 5627, 2392, 13, 3166, 1350, 572, 279, 29889, 11303, 1053, 1350, 572, 279, 13, 13, 5215, 12013, 13, 5215, 11187, 13, 5215, 2897, 29889, 2084, 13, 5215, 528, 4422, 13, 5215, 443, 27958, 13, 13, 1254, 10051, 4214, 29918, 9464, 353, 2897, 29889, 2084, 29889, 7122, 877, 21150, 742, 525, 11303, 742, 525, 303, 6751, 1495, 13, 18267, 29918, 14573, 353, 2897, 29889, 2084, 29889, 7122, 877, 21150, 742, 525, 11303, 742, 525, 1688, 29918, 1272, 1495, 13, 13, 1990, 6789, 572, 279, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2897, 29889, 11256, 3972, 29898, 1254, 10051, 4214, 29918, 9464, 29897, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 528, 4422, 29889, 1758, 8336, 29898, 1254, 10051, 4214, 29918, 9464, 29897, 13, 13, 1678, 822, 1243, 3991, 17413, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3991, 5627, 2392, 29897, 408, 7477, 29901, 13, 9651, 1350, 572, 279, 29889, 3389, 29898, 1356, 572, 279, 29889, 15764, 4197, 13, 18884, 17411, 29879, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 1445, 29889, 3487, 5477, 13, 18884, 17411, 29883, 742, 2897, 29889, 2084, 29889, 7122, 877, 1217, 742, 525, 14565, 742, 525, 2917, 29889, 2272, 5477, 13, 18884, 525, 489, 8382, 742, 13, 9651, 4514, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 23323, 451, 1284, 2295, 934, 29901, 694, 29914, 14565, 29914, 2917, 29889, 2272, 742, 851, 29898, 4912, 29889, 11739, 876, 13, 13, 1678, 822, 1243, 3991, 29918, 2541, 3782, 16174, 29943, 2234, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3991, 5627, 2392, 29897, 408, 7477, 29901, 13, 9651, 1350, 572, 279, 29889, 3389, 29898, 1356, 572, 279, 29889, 15764, 4197, 13, 18884, 17411, 29879, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 1445, 29889, 3487, 5477, 13, 18884, 17411, 29883, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 1217, 29918, 11918, 29918, 2917, 29889, 2272, 5477, 13, 18884, 525, 489, 8382, 742, 13, 9651, 4514, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 23323, 451, 2254, 2295, 934, 376, 21150, 29914, 11303, 29914, 1688, 29918, 1272, 29914, 1217, 29918, 11918, 29918, 2917, 29889, 2272, 1115, 525, 13, 18884, 525, 2917, 2066, 1818, 1712, 263, 2286, 2000, 376, 2917, 29908, 393, 338, 9859, 304, 525, 13, 18884, 525, 29874, 12782, 1203, 29889, 742, 13, 18884, 851, 29898, 4912, 29889, 11739, 876, 13, 13, 1678, 822, 1243, 3991, 29918, 1332, 852, 16174, 3624, 3664, 29909, 3991, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3991, 5627, 2392, 29897, 408, 7477, 29901, 13, 9651, 1350, 572, 279, 29889, 3389, 29898, 1356, 572, 279, 29889, 15764, 4197, 13, 18884, 17411, 29879, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 1445, 29889, 3487, 5477, 13, 18884, 17411, 29883, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 20965, 29918, 11918, 29918, 2917, 29889, 2272, 5477, 13, 18884, 525, 489, 8382, 742, 13, 9651, 4514, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 23323, 451, 2254, 2295, 934, 376, 21150, 29914, 11303, 29914, 1688, 29918, 1272, 29914, 20965, 29918, 11918, 29918, 2917, 29889, 2272, 1115, 525, 13, 18884, 525, 2917, 2066, 1818, 1712, 263, 2286, 2000, 376, 2917, 29908, 393, 338, 9859, 304, 525, 13, 18884, 525, 29874, 12782, 1203, 29889, 742, 13, 18884, 851, 29898, 4912, 29889, 11739, 876, 13, 13, 1678, 822, 1243, 6113, 1762, 14994, 3381, 29898, 1311, 1125, 13, 4706, 12551, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1254, 10051, 4214, 29918, 9464, 29892, 525, 23848, 29889, 1420, 1495, 13, 4706, 1350, 572, 279, 29889, 3389, 29898, 1356, 572, 279, 29889, 15764, 4197, 13, 9651, 17411, 29879, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 1445, 29889, 3487, 5477, 13, 9651, 17411, 29883, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 2917, 29889, 2272, 5477, 13, 9651, 17411, 29873, 742, 525, 6886, 29889, 1420, 742, 13, 9651, 17411, 29881, 742, 12551, 29918, 1445, 29892, 13, 9651, 525, 489, 8382, 742, 13, 4706, 4514, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 359, 29889, 2084, 29889, 275, 1445, 29898, 23848, 29918, 1445, 876, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 23848, 29918, 1445, 511, 525, 29878, 1495, 408, 285, 29901, 13, 9651, 1583, 29889, 9294, 9843, 877, 29966, 29886, 29958, 3916, 297, 590, 2908, 21106, 29886, 29958, 742, 285, 29889, 949, 3101, 13, 13, 1678, 822, 1243, 11816, 29898, 1311, 1125, 13, 4706, 12551, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1254, 10051, 4214, 29918, 9464, 29892, 525, 23848, 29889, 1420, 1495, 13, 4706, 411, 11187, 29889, 5041, 877, 9675, 29889, 25393, 742, 716, 29918, 4804, 519, 29922, 601, 29889, 1231, 5971, 29897, 408, 11187, 29918, 25393, 29901, 13, 9651, 1350, 572, 279, 29889, 3389, 29898, 1356, 572, 279, 29889, 15764, 4197, 13, 18884, 17411, 29879, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 1445, 29889, 3487, 5477, 13, 18884, 17411, 29883, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 2917, 29889, 2272, 5477, 13, 18884, 17411, 29873, 742, 525, 6886, 29889, 1420, 742, 13, 18884, 17411, 29881, 742, 12551, 29918, 1445, 29892, 13, 18884, 525, 489, 2158, 742, 13, 18884, 525, 489, 8382, 742, 13, 9651, 4514, 876, 13, 4706, 396, 5293, 1192, 2158, 881, 5557, 5007, 304, 278, 12551, 29889, 13, 4706, 1583, 29889, 9294, 8824, 29898, 359, 29889, 2084, 29889, 275, 1445, 29898, 23848, 29918, 1445, 876, 13, 4706, 396, 1670, 881, 367, 25053, 25899, 1363, 278, 1596, 740, 12778, 263, 13, 4706, 396, 25899, 472, 278, 1095, 29889, 13, 4706, 1583, 29889, 9294, 9843, 877, 29966, 29886, 29958, 3916, 297, 590, 2908, 21106, 29886, 14247, 29876, 742, 11187, 29918, 25393, 29889, 657, 1767, 3101, 13, 13, 1678, 822, 1243, 11816, 2392, 3644, 11862, 21979, 3664, 29965, 8485, 29898, 1311, 1125, 13, 4706, 12551, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1254, 10051, 4214, 29918, 9464, 29892, 525, 23848, 29889, 1420, 1495, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3924, 24365, 29897, 408, 7477, 29901, 13, 9651, 411, 11187, 29889, 5041, 877, 9675, 29889, 303, 20405, 742, 716, 29918, 4804, 519, 29922, 601, 29889, 1231, 5971, 29897, 408, 11187, 29918, 25393, 29901, 13, 18884, 1350, 572, 279, 29889, 3389, 29898, 1356, 572, 279, 29889, 15764, 4197, 13, 462, 1678, 396, 4750, 292, 1716, 2752, 322, 4472, 9946, 385, 1059, 29889, 13, 462, 1678, 17411, 29883, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 2917, 29889, 2272, 5477, 13, 18884, 4514, 876, 13, 4706, 1583, 29889, 9294, 8824, 29898, 359, 29889, 2084, 29889, 275, 1445, 29898, 23848, 29918, 1445, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 21076, 1674, 2392, 29901, 1932, 27256, 29892, 2752, 322, 4472, 2609, 1716, 367, 25811, 7790, 29876, 742, 13, 18884, 11187, 29918, 25393, 29889, 657, 1767, 3101, 13, 4706, 1583, 29889, 9294, 3664, 9843, 29898, 4912, 29889, 11739, 29889, 401, 29892, 29871, 29900, 29897, 13, 13, 13, 1678, 822, 1243, 4391, 14994, 3381, 12283, 1252, 9696, 9882, 29898, 1311, 1125, 13, 4706, 396, 450, 1513, 29875, 706, 317, 16881, 4214, 29918, 9464, 29914, 3972, 947, 451, 1863, 1434, 3179, 29889, 13, 4706, 1583, 29889, 9294, 8824, 29898, 359, 29889, 2084, 29889, 275, 3972, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1254, 10051, 4214, 29918, 9464, 29892, 525, 3972, 29915, 4961, 13, 13, 4706, 12551, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1254, 10051, 4214, 29918, 9464, 29892, 525, 3972, 742, 525, 23848, 29889, 1420, 1495, 13, 4706, 1350, 572, 279, 29889, 3389, 29898, 1356, 572, 279, 29889, 15764, 4197, 13, 9651, 17411, 29879, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 1445, 29889, 3487, 5477, 13, 9651, 17411, 29883, 742, 2897, 29889, 2084, 29889, 7122, 29898, 18267, 29918, 14573, 29892, 525, 2917, 29889, 2272, 5477, 13, 9651, 17411, 29873, 742, 525, 6886, 29889, 1420, 742, 13, 9651, 17411, 29881, 742, 12551, 29918, 1445, 29892, 13, 9651, 525, 489, 8382, 742, 13, 4706, 4514, 876, 13, 4706, 1583, 29889, 9294, 5574, 29898, 359, 29889, 2084, 29889, 275, 1445, 29898, 23848, 29918, 1445, 876, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 23848, 29918, 1445, 511, 525, 29878, 1495, 408, 285, 29901, 13, 9651, 1583, 29889, 9294, 9843, 877, 29966, 29886, 29958, 3916, 297, 590, 2908, 21106, 29886, 29958, 742, 285, 29889, 949, 3101, 13, 13, 13, 13, 2 ]
Utils/py/ActionSelection/play_striker.py
BerlinUnited/NaoTH
15
85146
<reponame>BerlinUnited/NaoTH from __future__ import division import math import copy import numpy as np from matplotlib import pyplot as plt from naoth.math import * from tools import action as a from tools import Simulation as Sim from tools import tools from tools import raw_attack_direction_provider as attack_dir from state import State from run_simulation_with_particleFilter import calculate_best_direction as heinrich_test def minimal_rotation(s, action, turn_direction): turn_speed = math.radians(5.0) action_dir = 0 none = a.Action("none", 0, 0, 0, 0) none_actions_consequences = Sim.simulateAction(none, s, num_particles=30) while True: # turn towards the direction of the action s.pose.rotate(action_dir) # Simulate Consequences actions_consequences = Sim.simulateAction(action, s, num_particles=30) # Decide best action selected_action_idx = Sim.decide_minimal([none_actions_consequences, actions_consequences], s) # restore the previous orientation s.pose.rotate(-action_dir) if selected_action_idx != 0: break elif np.abs(action_dir) > math.pi: # print("WARNING: in minimal_rotation no kick found after rotation {0}.".format(action_dir)) break else: # decide on rotation direction once if turn_direction == 0: attack_direction = attack_dir.get_attack_direction(s) turn_direction = np.sign(attack_direction.angle()) # "> 0" => left, "< 0" => right # set motion request action_dir += turn_direction * turn_speed return action_dir def direct_kick_strategy_cool_best(s, action_list): return direct_kick_strategy_cool(s, action_list, True) def direct_kick_strategy_cool(s, action_list, take_best=False): actions_consequences = [] rotations = [] fastest_action_dir = None fastest_action_idx = 0 for idx, action in enumerate(action_list): if action.name is "none": rotation = 0 else: # optimize action a0 = minimal_rotation(s, action, 1) a1 = minimal_rotation(s, action, -1) if np.abs(a0) < np.abs(a1): rotation = a0 else: rotation = a1 if np.abs(rotation) > 3: print( "WARNING: in direct_kick_strategy_cool no kick found after rotation {0}.".format( rotation)) rotations += [rotation] # apply optimized rotation s.pose.rotate(rotation) actions_consequences.append(Sim.simulateAction(action, s, num_particles=30)) # restore previous rotation s.pose.rotate(-rotation) if action.name is not "none": if fastest_action_dir is None or np.abs(rotation) < np.abs(fastest_action_dir): fastest_action_dir = rotation fastest_action_idx = idx # Decide best action if take_best: selected_action_idx = Sim.decide_minimal(actions_consequences, s) return selected_action_idx, rotations[selected_action_idx] else: # print fastest_action_idx, selected_action_idx return fastest_action_idx, fastest_action_dir def direct_kick_strategy(s, action_list): turn_speed = math.radians(5.0) action_dir = 0 turn_direction = 0 while True: # turn towards the direction of the action s.pose.rotate(action_dir) # Simulate Consequences actions_consequences = [Sim.simulateAction(action, s, num_particles=30) for action in action_list] # Decide best action selected_action_idx = Sim.decide_minimal(actions_consequences, s) # restore the previous orientation s.pose.rotate(-action_dir) if selected_action_idx != 0: break elif np.abs(action_dir) > math.pi: print("WARNING: in direct_kick_strategy no kick found after rotation {0}.".format( action_dir)) break else: # decide on rotation direction once if turn_direction == 0: attack_direction = attack_dir.get_attack_direction(s) turn_direction = np.sign(attack_direction.angle()) # "> 0" => left, "< 0" => right # set motion request action_dir += turn_direction * turn_speed return selected_action_idx, action_dir def optimal_kick_strategy(s, action_list): action_dir = None selected_action_idx = 0 for ix, action in enumerate(action_list): if action.name is "none": continue rotation, _ = heinrich_test(s, action, False, iterations=20) if action_dir is None or np.abs(rotation) < np.abs(action_dir): action_dir = rotation selected_action_idx = ix return selected_action_idx, action_dir def optimal_value_strategy(s, action_list): actions_consequences = [] rotations = [] for action in action_list: if action.name is "none": rotation = 0 else: # optimize action rotation, _ = heinrich_test(s, action, False, iterations=20) rotations += [rotation] # apply optimized rotation s.pose.rotate(rotation) actions_consequences.append(Sim.simulateAction(action, s, num_particles=30)) # restore previous rotation s.pose.rotate(-rotation) # Decide best action selected_action_idx = Sim.decide_minimal(actions_consequences, s) return selected_action_idx, rotations[selected_action_idx] class Simulator: def __init__(self, s, strategy, action_list): self.state = s self.strategy = strategy self.action_list = action_list # self.state_category = None # actions self.selected_action_idx = None self.turn_around_ball = 0 self.rotate = 0 self.walk_dist = 0 def step(self): # reset stuff self.turn_around_ball = 0 self.rotate = 0 self.walk_dist = 0 # --------------- # approach ball # --------------- self.rotate = self.state.ball_position.angle() self.walk_dist = self.state.ball_position.abs() # HACK: execute motion request self.state.pose.rotate(self.rotate) self.state.pose.translate(self.walk_dist, 0) self.state.ball_position = Vector2(100.0, 0.0) # ----------------- # make a decision # ----------------- self.selected_action_idx, self.turn_around_ball = self.strategy(self.state, self.action_list) selected_action = self.action_list[self.selected_action_idx] # -------------------- # execute the action # -------------------- if selected_action.name == "none": # print("INFO: NONE action while ball outside of the field.") if self.state_category == a.Category.INFIELD: print("WARNING: action is NONE, what should we do here? " + str( self.selected_action_idx)) print("STATE: robot = {0}".format(self.state.pose)) else: # rotate around ball if necessary self.state.pose.rotate(self.turn_around_ball) # hack: perfect world without noise perfect_world = False if perfect_world: real_action = a.Action("real_action", selected_action.speed, 0, selected_action.angle, 0) else: real_action = selected_action # expected_ball_pos should be in local coordinates for rotation calculations action_results = Sim.simulateAction(real_action, self.state, num_particles=1) # store the state and update the state new_ball_position = action_results.positions()[0] self.state_category = new_ball_position.cat() self.state.ball_position = new_ball_position.pos() def run_experiment(original_state, strategy, action_list, max_iterations=30): s = copy.deepcopy(original_state) simulator = Simulator(s, strategy, action_list) # record the state of the simulator history = [copy.deepcopy(simulator)] while len(history) < max_iterations: simulator.step() history += [copy.deepcopy(simulator)] if simulator.state_category == a.Category.OPPGOAL: # print ("success") break elif simulator.state_category != a.Category.INFIELD: # print ("failure") break # hack: make the last run simulator.step() history += [copy.deepcopy(simulator)] return history def select(selected_actions, ids): return [selected_actions[x] for x in ids] if __name__ == "__main__": # set up the available actions actions = { "none": a.Action("none", 0, 0, 0, 0), "kick_short": a.Action("kick_short", 1080, 150, 0, 7), "sidekick_left": a.Action("sidekick_left", 750, 150, 90, 10), "sidekick_right": a.Action("sidekick_right", 750, 50, -90, 10) } all_actions = select(actions, ["none", "kick_short", "sidekick_left", "sidekick_right"]) # print ([a.name for a in all_actions]) # repeat it multiple times to see how reliable the result is for i in range(100): origin = State() origin.pose.rotation = np.radians([66.0]) origin.pose.translation.x = 1086 origin.pose.translation.y = 2047 ''' state = copy.deepcopy(origin) print("run optimal_kick_strategy") history1 = run_experiment(state, optimal_kick_strategy, select(actions, ["none", "kick_short"])) state = copy.deepcopy(origin) print("run optimal_kick_strategy") history2 = run_experiment(state, optimal_kick_strategy, all_actions) state = copy.deepcopy(origin) print("run direct_kick_strategy") history3 = run_experiment(state, direct_kick_strategy, all_actions) state = copy.deepcopy(origin) print("run optimal_value_strategy") history4 = run_experiment(state, optimal_value_strategy, all_actions) h1 = np.array([[h.state.pose.translation.x, h.state.pose.translation.y] for h in history1]) h2 = np.array([[h.state.pose.translation.x, h.state.pose.translation.y] for h in history2]) h3 = np.array([[h.state.pose.translation.x, h.state.pose.translation.y] for h in history3]) h4 = np.array([[h.state.pose.translation.x, h.state.pose.translation.y] for h in history4]) plt.clf() axes = plt.gca() tools.draw_field(axes) plt.plot(h1[:, 0], h1[:, 1], '-ob') plt.plot(h2[:, 0], h2[:, 1], '-ok') plt.plot(h3[:, 0], h3[:, 1], '-or') plt.plot(h4[:, 0], h4[:, 1], '-oy') plt.pause(2) ''' state = copy.deepcopy(origin) print("run direct_kick_strategy") history3 = run_experiment(state, direct_kick_strategy_cool, all_actions) print([np.degrees(h.turn_around_ball) for h in history3[0:-1]]) print([h.selected_action_idx for h in history3[0:-1]]) h3 = np.array([[h.state.pose.translation.x, h.state.pose.translation.y] for h in history3]) v3 = np.array([[np.cos(h.state.pose.rotation), np.sin(h.state.pose.rotation)] for h in history3]) * 200 plt.clf() axes = plt.gca() tools.draw_field(axes) plt.plot(h3[:, 0], h3[:, 1], '-or') plt.quiver(h3[:, 0], h3[:, 1], v3[:, 0], v3[:, 1], units='width') plt.show()
[ 1, 529, 276, 1112, 420, 29958, 17104, 1915, 2525, 1573, 29914, 29940, 6241, 4690, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 5215, 5844, 13, 5215, 3509, 13, 5215, 12655, 408, 7442, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 13, 3166, 1055, 720, 29889, 755, 1053, 334, 13, 3166, 8492, 1053, 3158, 408, 263, 13, 3166, 8492, 1053, 3439, 2785, 408, 3439, 13, 3166, 8492, 1053, 8492, 13, 3166, 8492, 1053, 10650, 29918, 1131, 547, 29918, 20845, 29918, 18121, 408, 5337, 29918, 3972, 13, 3166, 2106, 1053, 4306, 13, 3166, 1065, 29918, 3601, 2785, 29918, 2541, 29918, 1595, 2512, 5072, 1053, 8147, 29918, 13318, 29918, 20845, 408, 540, 262, 4018, 29918, 1688, 13, 13, 13, 1753, 13114, 29918, 5450, 362, 29898, 29879, 29892, 3158, 29892, 2507, 29918, 20845, 1125, 13, 1678, 2507, 29918, 19322, 353, 5844, 29889, 3665, 5834, 29898, 29945, 29889, 29900, 29897, 13, 1678, 3158, 29918, 3972, 353, 29871, 29900, 13, 13, 1678, 5642, 353, 263, 29889, 4276, 703, 9290, 613, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 1678, 5642, 29918, 7387, 29918, 535, 6831, 2063, 353, 3439, 29889, 3601, 5987, 4276, 29898, 9290, 29892, 269, 29892, 954, 29918, 1595, 4027, 29922, 29941, 29900, 29897, 13, 13, 1678, 1550, 5852, 29901, 13, 4706, 396, 2507, 7113, 278, 5305, 310, 278, 3158, 13, 4706, 269, 29889, 4220, 29889, 23361, 29898, 2467, 29918, 3972, 29897, 13, 13, 4706, 396, 3439, 5987, 1281, 6831, 2063, 13, 4706, 8820, 29918, 535, 6831, 2063, 353, 3439, 29889, 3601, 5987, 4276, 29898, 2467, 29892, 269, 29892, 954, 29918, 1595, 4027, 29922, 29941, 29900, 29897, 13, 13, 4706, 396, 897, 8204, 1900, 3158, 13, 4706, 4629, 29918, 2467, 29918, 13140, 353, 3439, 29889, 311, 8204, 29918, 1195, 3039, 4197, 9290, 29918, 7387, 29918, 535, 6831, 2063, 29892, 8820, 29918, 535, 6831, 2063, 1402, 13, 462, 462, 462, 269, 29897, 13, 13, 4706, 396, 17749, 278, 3517, 19843, 13, 4706, 269, 29889, 4220, 29889, 23361, 6278, 2467, 29918, 3972, 29897, 13, 13, 4706, 565, 4629, 29918, 2467, 29918, 13140, 2804, 29871, 29900, 29901, 13, 9651, 2867, 13, 4706, 25342, 7442, 29889, 6897, 29898, 2467, 29918, 3972, 29897, 1405, 5844, 29889, 1631, 29901, 13, 9651, 396, 1596, 703, 29956, 25614, 29901, 297, 13114, 29918, 5450, 362, 694, 24817, 1476, 1156, 13733, 426, 29900, 29913, 1213, 29889, 4830, 29898, 2467, 29918, 3972, 876, 13, 9651, 2867, 13, 4706, 1683, 29901, 13, 9651, 396, 11097, 373, 13733, 5305, 2748, 13, 9651, 565, 2507, 29918, 20845, 1275, 29871, 29900, 29901, 13, 18884, 5337, 29918, 20845, 353, 5337, 29918, 3972, 29889, 657, 29918, 1131, 547, 29918, 20845, 29898, 29879, 29897, 13, 18884, 2507, 29918, 20845, 353, 7442, 29889, 4530, 29898, 1131, 547, 29918, 20845, 29889, 2521, 3101, 29871, 396, 376, 29958, 29871, 29900, 29908, 1149, 2175, 29892, 9872, 29871, 29900, 29908, 1149, 1492, 13, 13, 9651, 396, 731, 10884, 2009, 13, 9651, 3158, 29918, 3972, 4619, 2507, 29918, 20845, 334, 2507, 29918, 19322, 13, 13, 1678, 736, 3158, 29918, 3972, 13, 13, 13, 1753, 1513, 29918, 29895, 860, 29918, 710, 8963, 29918, 1111, 324, 29918, 13318, 29898, 29879, 29892, 3158, 29918, 1761, 1125, 13, 1678, 736, 1513, 29918, 29895, 860, 29918, 710, 8963, 29918, 1111, 324, 29898, 29879, 29892, 3158, 29918, 1761, 29892, 5852, 29897, 13, 13, 13, 1753, 1513, 29918, 29895, 860, 29918, 710, 8963, 29918, 1111, 324, 29898, 29879, 29892, 3158, 29918, 1761, 29892, 2125, 29918, 13318, 29922, 8824, 1125, 13, 1678, 8820, 29918, 535, 6831, 2063, 353, 5159, 13, 1678, 5731, 800, 353, 5159, 13, 13, 1678, 5172, 342, 29918, 2467, 29918, 3972, 353, 6213, 13, 1678, 5172, 342, 29918, 2467, 29918, 13140, 353, 29871, 29900, 13, 13, 1678, 363, 22645, 29892, 3158, 297, 26985, 29898, 2467, 29918, 1761, 1125, 13, 13, 4706, 565, 3158, 29889, 978, 338, 376, 9290, 1115, 13, 9651, 13733, 353, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 396, 24656, 3158, 13, 9651, 263, 29900, 353, 13114, 29918, 5450, 362, 29898, 29879, 29892, 3158, 29892, 29871, 29896, 29897, 13, 9651, 263, 29896, 353, 13114, 29918, 5450, 362, 29898, 29879, 29892, 3158, 29892, 448, 29896, 29897, 13, 9651, 565, 7442, 29889, 6897, 29898, 29874, 29900, 29897, 529, 7442, 29889, 6897, 29898, 29874, 29896, 1125, 13, 18884, 13733, 353, 263, 29900, 13, 9651, 1683, 29901, 13, 18884, 13733, 353, 263, 29896, 13, 13, 9651, 565, 7442, 29889, 6897, 29898, 5450, 362, 29897, 1405, 29871, 29941, 29901, 13, 18884, 1596, 29898, 13, 462, 1678, 376, 29956, 25614, 29901, 297, 1513, 29918, 29895, 860, 29918, 710, 8963, 29918, 1111, 324, 694, 24817, 1476, 1156, 13733, 426, 29900, 29913, 1213, 29889, 4830, 29898, 13, 462, 4706, 13733, 876, 13, 13, 4706, 5731, 800, 4619, 518, 5450, 362, 29962, 13, 13, 4706, 396, 3394, 27545, 13733, 13, 4706, 269, 29889, 4220, 29889, 23361, 29898, 5450, 362, 29897, 13, 13, 4706, 8820, 29918, 535, 6831, 2063, 29889, 4397, 29898, 8942, 29889, 3601, 5987, 4276, 29898, 2467, 29892, 269, 29892, 954, 29918, 1595, 4027, 29922, 29941, 29900, 876, 13, 13, 4706, 396, 17749, 3517, 13733, 13, 4706, 269, 29889, 4220, 29889, 23361, 6278, 5450, 362, 29897, 13, 13, 4706, 565, 3158, 29889, 978, 338, 451, 376, 9290, 1115, 13, 9651, 565, 5172, 342, 29918, 2467, 29918, 3972, 338, 6213, 470, 7442, 29889, 6897, 29898, 5450, 362, 29897, 529, 7442, 29889, 6897, 29898, 11255, 342, 29918, 2467, 29918, 3972, 1125, 13, 18884, 5172, 342, 29918, 2467, 29918, 3972, 353, 13733, 13, 18884, 5172, 342, 29918, 2467, 29918, 13140, 353, 22645, 13, 13, 1678, 396, 897, 8204, 1900, 3158, 13, 1678, 565, 2125, 29918, 13318, 29901, 13, 4706, 4629, 29918, 2467, 29918, 13140, 353, 3439, 29889, 311, 8204, 29918, 1195, 3039, 29898, 7387, 29918, 535, 6831, 2063, 29892, 269, 29897, 13, 4706, 736, 4629, 29918, 2467, 29918, 13140, 29892, 5731, 800, 29961, 8391, 29918, 2467, 29918, 13140, 29962, 13, 1678, 1683, 29901, 13, 4706, 396, 1596, 5172, 342, 29918, 2467, 29918, 13140, 29892, 4629, 29918, 2467, 29918, 13140, 13, 4706, 736, 5172, 342, 29918, 2467, 29918, 13140, 29892, 5172, 342, 29918, 2467, 29918, 3972, 13, 13, 13, 1753, 1513, 29918, 29895, 860, 29918, 710, 8963, 29898, 29879, 29892, 3158, 29918, 1761, 1125, 13, 1678, 2507, 29918, 19322, 353, 5844, 29889, 3665, 5834, 29898, 29945, 29889, 29900, 29897, 13, 1678, 3158, 29918, 3972, 353, 29871, 29900, 13, 1678, 2507, 29918, 20845, 353, 29871, 29900, 13, 13, 1678, 1550, 5852, 29901, 13, 4706, 396, 2507, 7113, 278, 5305, 310, 278, 3158, 13, 4706, 269, 29889, 4220, 29889, 23361, 29898, 2467, 29918, 3972, 29897, 13, 13, 4706, 396, 3439, 5987, 1281, 6831, 2063, 13, 4706, 8820, 29918, 535, 6831, 2063, 353, 518, 8942, 29889, 3601, 5987, 4276, 29898, 2467, 29892, 269, 29892, 954, 29918, 1595, 4027, 29922, 29941, 29900, 29897, 363, 3158, 297, 13, 462, 18884, 3158, 29918, 1761, 29962, 13, 13, 4706, 396, 897, 8204, 1900, 3158, 13, 4706, 4629, 29918, 2467, 29918, 13140, 353, 3439, 29889, 311, 8204, 29918, 1195, 3039, 29898, 7387, 29918, 535, 6831, 2063, 29892, 269, 29897, 13, 13, 4706, 396, 17749, 278, 3517, 19843, 13, 4706, 269, 29889, 4220, 29889, 23361, 6278, 2467, 29918, 3972, 29897, 13, 13, 4706, 565, 4629, 29918, 2467, 29918, 13140, 2804, 29871, 29900, 29901, 13, 9651, 2867, 13, 4706, 25342, 7442, 29889, 6897, 29898, 2467, 29918, 3972, 29897, 1405, 5844, 29889, 1631, 29901, 13, 9651, 1596, 703, 29956, 25614, 29901, 297, 1513, 29918, 29895, 860, 29918, 710, 8963, 694, 24817, 1476, 1156, 13733, 426, 29900, 29913, 1213, 29889, 4830, 29898, 13, 18884, 3158, 29918, 3972, 876, 13, 9651, 2867, 13, 4706, 1683, 29901, 13, 9651, 396, 11097, 373, 13733, 5305, 2748, 13, 9651, 565, 2507, 29918, 20845, 1275, 29871, 29900, 29901, 13, 18884, 5337, 29918, 20845, 353, 5337, 29918, 3972, 29889, 657, 29918, 1131, 547, 29918, 20845, 29898, 29879, 29897, 13, 18884, 2507, 29918, 20845, 353, 7442, 29889, 4530, 29898, 1131, 547, 29918, 20845, 29889, 2521, 3101, 29871, 396, 376, 29958, 29871, 29900, 29908, 1149, 2175, 29892, 9872, 29871, 29900, 29908, 1149, 1492, 13, 13, 9651, 396, 731, 10884, 2009, 13, 9651, 3158, 29918, 3972, 4619, 2507, 29918, 20845, 334, 2507, 29918, 19322, 13, 13, 1678, 736, 4629, 29918, 2467, 29918, 13140, 29892, 3158, 29918, 3972, 13, 13, 13, 1753, 14413, 29918, 29895, 860, 29918, 710, 8963, 29898, 29879, 29892, 3158, 29918, 1761, 1125, 13, 1678, 3158, 29918, 3972, 353, 6213, 13, 1678, 4629, 29918, 2467, 29918, 13140, 353, 29871, 29900, 13, 13, 1678, 363, 474, 29916, 29892, 3158, 297, 26985, 29898, 2467, 29918, 1761, 1125, 13, 4706, 565, 3158, 29889, 978, 338, 376, 9290, 1115, 13, 9651, 6773, 13, 13, 4706, 13733, 29892, 903, 353, 540, 262, 4018, 29918, 1688, 29898, 29879, 29892, 3158, 29892, 7700, 29892, 24372, 29922, 29906, 29900, 29897, 13, 13, 4706, 565, 3158, 29918, 3972, 338, 6213, 470, 7442, 29889, 6897, 29898, 5450, 362, 29897, 529, 7442, 29889, 6897, 29898, 2467, 29918, 3972, 1125, 13, 9651, 3158, 29918, 3972, 353, 13733, 13, 9651, 4629, 29918, 2467, 29918, 13140, 353, 474, 29916, 13, 13, 1678, 736, 4629, 29918, 2467, 29918, 13140, 29892, 3158, 29918, 3972, 13, 13, 13, 1753, 14413, 29918, 1767, 29918, 710, 8963, 29898, 29879, 29892, 3158, 29918, 1761, 1125, 13, 1678, 8820, 29918, 535, 6831, 2063, 353, 5159, 13, 1678, 5731, 800, 353, 5159, 13, 1678, 363, 3158, 297, 3158, 29918, 1761, 29901, 13, 13, 4706, 565, 3158, 29889, 978, 338, 376, 9290, 1115, 13, 9651, 13733, 353, 29871, 29900, 13, 4706, 1683, 29901, 13, 9651, 396, 24656, 3158, 13, 9651, 13733, 29892, 903, 353, 540, 262, 4018, 29918, 1688, 29898, 29879, 29892, 3158, 29892, 7700, 29892, 24372, 29922, 29906, 29900, 29897, 13, 13, 4706, 5731, 800, 4619, 518, 5450, 362, 29962, 13, 13, 4706, 396, 3394, 27545, 13733, 13, 4706, 269, 29889, 4220, 29889, 23361, 29898, 5450, 362, 29897, 13, 13, 4706, 8820, 29918, 535, 6831, 2063, 29889, 4397, 29898, 8942, 29889, 3601, 5987, 4276, 29898, 2467, 29892, 269, 29892, 954, 29918, 1595, 4027, 29922, 29941, 29900, 876, 13, 13, 4706, 396, 17749, 3517, 13733, 13, 4706, 269, 29889, 4220, 29889, 23361, 6278, 5450, 362, 29897, 13, 13, 1678, 396, 897, 8204, 1900, 3158, 13, 1678, 4629, 29918, 2467, 29918, 13140, 353, 3439, 29889, 311, 8204, 29918, 1195, 3039, 29898, 7387, 29918, 535, 6831, 2063, 29892, 269, 29897, 13, 13, 1678, 736, 4629, 29918, 2467, 29918, 13140, 29892, 5731, 800, 29961, 8391, 29918, 2467, 29918, 13140, 29962, 13, 13, 13, 1990, 3439, 9183, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 269, 29892, 13705, 29892, 3158, 29918, 1761, 1125, 13, 4706, 1583, 29889, 3859, 353, 269, 13, 4706, 1583, 29889, 710, 8963, 353, 13705, 13, 4706, 1583, 29889, 2467, 29918, 1761, 353, 3158, 29918, 1761, 13, 13, 4706, 396, 13, 4706, 1583, 29889, 3859, 29918, 7320, 353, 6213, 13, 13, 4706, 396, 8820, 13, 4706, 1583, 29889, 8391, 29918, 2467, 29918, 13140, 353, 6213, 13, 4706, 1583, 29889, 685, 29918, 11316, 29918, 2135, 353, 29871, 29900, 13, 4706, 1583, 29889, 23361, 353, 29871, 29900, 13, 4706, 1583, 29889, 20919, 29918, 5721, 353, 29871, 29900, 13, 13, 1678, 822, 4331, 29898, 1311, 1125, 13, 13, 4706, 396, 10092, 6433, 13, 4706, 1583, 29889, 685, 29918, 11316, 29918, 2135, 353, 29871, 29900, 13, 4706, 1583, 29889, 23361, 353, 29871, 29900, 13, 4706, 1583, 29889, 20919, 29918, 5721, 353, 29871, 29900, 13, 13, 4706, 396, 448, 9072, 489, 13, 4706, 396, 2948, 8287, 13, 4706, 396, 448, 9072, 489, 13, 4706, 1583, 29889, 23361, 353, 1583, 29889, 3859, 29889, 2135, 29918, 3283, 29889, 2521, 580, 13, 4706, 1583, 29889, 20919, 29918, 5721, 353, 1583, 29889, 3859, 29889, 2135, 29918, 3283, 29889, 6897, 580, 13, 13, 4706, 396, 379, 11375, 29901, 6222, 10884, 2009, 13, 4706, 1583, 29889, 3859, 29889, 4220, 29889, 23361, 29898, 1311, 29889, 23361, 29897, 13, 4706, 1583, 29889, 3859, 29889, 4220, 29889, 21652, 29898, 1311, 29889, 20919, 29918, 5721, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 3859, 29889, 2135, 29918, 3283, 353, 16510, 29906, 29898, 29896, 29900, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29897, 13, 13, 4706, 396, 448, 2683, 13, 4706, 396, 29871, 1207, 263, 10608, 13, 4706, 396, 448, 2683, 13, 13, 4706, 1583, 29889, 8391, 29918, 2467, 29918, 13140, 29892, 1583, 29889, 685, 29918, 11316, 29918, 2135, 353, 1583, 29889, 710, 8963, 29898, 1311, 29889, 3859, 29892, 13, 462, 462, 462, 462, 4706, 1583, 29889, 2467, 29918, 1761, 29897, 13, 4706, 4629, 29918, 2467, 353, 1583, 29889, 2467, 29918, 1761, 29961, 1311, 29889, 8391, 29918, 2467, 29918, 13140, 29962, 13, 13, 4706, 396, 448, 2683, 5634, 13, 4706, 396, 29871, 6222, 278, 3158, 13, 4706, 396, 448, 2683, 5634, 13, 4706, 565, 4629, 29918, 2467, 29889, 978, 1275, 376, 9290, 1115, 13, 9651, 396, 1596, 703, 11690, 29901, 405, 12413, 3158, 1550, 8287, 5377, 310, 278, 1746, 23157, 13, 9651, 565, 1583, 29889, 3859, 29918, 7320, 1275, 263, 29889, 10900, 29889, 1177, 3738, 27286, 29901, 13, 18884, 1596, 703, 29956, 25614, 29901, 3158, 338, 405, 12413, 29892, 825, 881, 591, 437, 1244, 29973, 376, 718, 851, 29898, 13, 462, 1678, 1583, 29889, 8391, 29918, 2467, 29918, 13140, 876, 13, 18884, 1596, 703, 19713, 29901, 19964, 353, 426, 29900, 29913, 1642, 4830, 29898, 1311, 29889, 3859, 29889, 4220, 876, 13, 4706, 1683, 29901, 13, 9651, 396, 16734, 2820, 8287, 565, 5181, 13, 9651, 1583, 29889, 3859, 29889, 4220, 29889, 23361, 29898, 1311, 29889, 685, 29918, 11316, 29918, 2135, 29897, 13, 13, 9651, 396, 15833, 29901, 4922, 3186, 1728, 11462, 13, 9651, 4922, 29918, 11526, 353, 7700, 13, 9651, 565, 4922, 29918, 11526, 29901, 13, 18884, 1855, 29918, 2467, 353, 263, 29889, 4276, 703, 6370, 29918, 2467, 613, 4629, 29918, 2467, 29889, 19322, 29892, 29871, 29900, 29892, 13, 462, 462, 539, 4629, 29918, 2467, 29889, 2521, 29892, 29871, 29900, 29897, 13, 9651, 1683, 29901, 13, 18884, 1855, 29918, 2467, 353, 4629, 29918, 2467, 13, 13, 9651, 396, 3806, 29918, 2135, 29918, 1066, 881, 367, 297, 1887, 10350, 363, 13733, 17203, 13, 9651, 3158, 29918, 9902, 353, 3439, 29889, 3601, 5987, 4276, 29898, 6370, 29918, 2467, 29892, 1583, 29889, 3859, 29892, 954, 29918, 1595, 4027, 29922, 29896, 29897, 13, 13, 9651, 396, 3787, 278, 2106, 322, 2767, 278, 2106, 13, 9651, 716, 29918, 2135, 29918, 3283, 353, 3158, 29918, 9902, 29889, 1066, 2187, 580, 29961, 29900, 29962, 13, 9651, 1583, 29889, 3859, 29918, 7320, 353, 716, 29918, 2135, 29918, 3283, 29889, 4117, 580, 13, 9651, 1583, 29889, 3859, 29889, 2135, 29918, 3283, 353, 716, 29918, 2135, 29918, 3283, 29889, 1066, 580, 13, 13, 13, 1753, 1065, 29918, 735, 15362, 29898, 13492, 29918, 3859, 29892, 13705, 29892, 3158, 29918, 1761, 29892, 4236, 29918, 1524, 800, 29922, 29941, 29900, 1125, 13, 1678, 269, 353, 3509, 29889, 24535, 8552, 29898, 13492, 29918, 3859, 29897, 13, 1678, 1027, 9183, 353, 3439, 9183, 29898, 29879, 29892, 13705, 29892, 3158, 29918, 1761, 29897, 13, 13, 1678, 396, 2407, 278, 2106, 310, 278, 1027, 9183, 13, 1678, 4955, 353, 518, 8552, 29889, 24535, 8552, 29898, 3601, 9183, 4638, 13, 13, 1678, 1550, 7431, 29898, 18434, 29897, 529, 4236, 29918, 1524, 800, 29901, 13, 13, 4706, 1027, 9183, 29889, 10568, 580, 13, 13, 4706, 4955, 4619, 518, 8552, 29889, 24535, 8552, 29898, 3601, 9183, 4638, 13, 13, 4706, 565, 1027, 9183, 29889, 3859, 29918, 7320, 1275, 263, 29889, 10900, 29889, 4590, 16903, 29949, 1964, 29901, 13, 9651, 396, 1596, 4852, 8698, 1159, 13, 9651, 2867, 13, 4706, 25342, 1027, 9183, 29889, 3859, 29918, 7320, 2804, 263, 29889, 10900, 29889, 1177, 3738, 27286, 29901, 13, 9651, 396, 1596, 4852, 14057, 545, 1159, 13, 9651, 2867, 13, 13, 1678, 396, 15833, 29901, 1207, 278, 1833, 1065, 13, 1678, 1027, 9183, 29889, 10568, 580, 13, 1678, 4955, 4619, 518, 8552, 29889, 24535, 8552, 29898, 3601, 9183, 4638, 13, 13, 1678, 736, 4955, 13, 13, 13, 1753, 1831, 29898, 8391, 29918, 7387, 29892, 18999, 1125, 13, 1678, 736, 518, 8391, 29918, 7387, 29961, 29916, 29962, 363, 921, 297, 18999, 29962, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 396, 731, 701, 278, 3625, 8820, 13, 1678, 8820, 353, 426, 13, 4706, 376, 9290, 1115, 263, 29889, 4276, 703, 9290, 613, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 511, 13, 4706, 376, 29895, 860, 29918, 12759, 1115, 263, 29889, 4276, 703, 29895, 860, 29918, 12759, 613, 29871, 29896, 29900, 29947, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29900, 29892, 29871, 29955, 511, 13, 4706, 376, 2975, 29895, 860, 29918, 1563, 1115, 263, 29889, 4276, 703, 2975, 29895, 860, 29918, 1563, 613, 29871, 29955, 29945, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29929, 29900, 29892, 29871, 29896, 29900, 511, 13, 4706, 376, 2975, 29895, 860, 29918, 1266, 1115, 263, 29889, 4276, 703, 2975, 29895, 860, 29918, 1266, 613, 29871, 29955, 29945, 29900, 29892, 29871, 29945, 29900, 29892, 448, 29929, 29900, 29892, 29871, 29896, 29900, 29897, 13, 1678, 500, 13, 13, 1678, 599, 29918, 7387, 353, 1831, 29898, 7387, 29892, 6796, 9290, 613, 376, 29895, 860, 29918, 12759, 613, 376, 2975, 29895, 860, 29918, 1563, 613, 376, 2975, 29895, 860, 29918, 1266, 20068, 13, 1678, 396, 1596, 9310, 29874, 29889, 978, 363, 263, 297, 599, 29918, 7387, 2314, 13, 13, 1678, 396, 12312, 372, 2999, 3064, 304, 1074, 920, 23279, 278, 1121, 338, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29900, 29900, 1125, 13, 4706, 3978, 353, 4306, 580, 13, 4706, 3978, 29889, 4220, 29889, 5450, 362, 353, 7442, 29889, 3665, 5834, 4197, 29953, 29953, 29889, 29900, 2314, 13, 4706, 3978, 29889, 4220, 29889, 3286, 18411, 29889, 29916, 353, 29871, 29896, 29900, 29947, 29953, 13, 4706, 3978, 29889, 4220, 29889, 3286, 18411, 29889, 29891, 353, 29871, 29906, 29900, 29946, 29955, 13, 13, 4706, 14550, 13, 4706, 2106, 353, 3509, 29889, 24535, 8552, 29898, 12574, 29897, 13, 4706, 1596, 703, 3389, 14413, 29918, 29895, 860, 29918, 710, 8963, 1159, 13, 4706, 4955, 29896, 353, 1065, 29918, 735, 15362, 29898, 3859, 29892, 14413, 29918, 29895, 860, 29918, 710, 8963, 29892, 1831, 29898, 7387, 29892, 6796, 9290, 613, 376, 29895, 860, 29918, 12759, 3108, 876, 13, 308, 13, 4706, 2106, 353, 3509, 29889, 24535, 8552, 29898, 12574, 29897, 13, 4706, 1596, 703, 3389, 14413, 29918, 29895, 860, 29918, 710, 8963, 1159, 13, 4706, 4955, 29906, 353, 1065, 29918, 735, 15362, 29898, 3859, 29892, 14413, 29918, 29895, 860, 29918, 710, 8963, 29892, 599, 29918, 7387, 29897, 13, 308, 13, 4706, 2106, 353, 3509, 29889, 24535, 8552, 29898, 12574, 29897, 13, 4706, 1596, 703, 3389, 1513, 29918, 29895, 860, 29918, 710, 8963, 1159, 13, 4706, 4955, 29941, 353, 1065, 29918, 735, 15362, 29898, 3859, 29892, 1513, 29918, 29895, 860, 29918, 710, 8963, 29892, 599, 29918, 7387, 29897, 13, 308, 13, 4706, 2106, 353, 3509, 29889, 24535, 8552, 29898, 12574, 29897, 13, 4706, 1596, 703, 3389, 14413, 29918, 1767, 29918, 710, 8963, 1159, 13, 4706, 4955, 29946, 353, 1065, 29918, 735, 15362, 29898, 3859, 29892, 14413, 29918, 1767, 29918, 710, 8963, 29892, 599, 29918, 7387, 29897, 13, 308, 13, 4706, 298, 29896, 353, 7442, 29889, 2378, 4197, 29961, 29882, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29916, 29892, 298, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29891, 29962, 363, 298, 297, 4955, 29896, 2314, 13, 4706, 298, 29906, 353, 7442, 29889, 2378, 4197, 29961, 29882, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29916, 29892, 298, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29891, 29962, 363, 298, 297, 4955, 29906, 2314, 13, 4706, 298, 29941, 353, 7442, 29889, 2378, 4197, 29961, 29882, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29916, 29892, 298, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29891, 29962, 363, 298, 297, 4955, 29941, 2314, 13, 4706, 298, 29946, 353, 7442, 29889, 2378, 4197, 29961, 29882, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29916, 29892, 298, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29891, 29962, 363, 298, 297, 4955, 29946, 2314, 13, 308, 13, 4706, 14770, 29889, 695, 29888, 580, 13, 4706, 27815, 353, 14770, 29889, 29887, 1113, 580, 13, 4706, 8492, 29889, 4012, 29918, 2671, 29898, 1165, 267, 29897, 13, 308, 13, 308, 13, 4706, 14770, 29889, 5317, 29898, 29882, 29896, 7503, 29892, 29871, 29900, 1402, 298, 29896, 7503, 29892, 29871, 29896, 1402, 17411, 711, 1495, 13, 4706, 14770, 29889, 5317, 29898, 29882, 29906, 7503, 29892, 29871, 29900, 1402, 298, 29906, 7503, 29892, 29871, 29896, 1402, 17411, 554, 1495, 13, 4706, 14770, 29889, 5317, 29898, 29882, 29941, 7503, 29892, 29871, 29900, 1402, 298, 29941, 7503, 29892, 29871, 29896, 1402, 17411, 272, 1495, 13, 4706, 14770, 29889, 5317, 29898, 29882, 29946, 7503, 29892, 29871, 29900, 1402, 298, 29946, 7503, 29892, 29871, 29896, 1402, 17411, 12602, 1495, 13, 308, 13, 4706, 14770, 29889, 29886, 1071, 29898, 29906, 29897, 13, 4706, 14550, 13, 13, 4706, 2106, 353, 3509, 29889, 24535, 8552, 29898, 12574, 29897, 13, 4706, 1596, 703, 3389, 1513, 29918, 29895, 860, 29918, 710, 8963, 1159, 13, 4706, 4955, 29941, 353, 1065, 29918, 735, 15362, 29898, 3859, 29892, 1513, 29918, 29895, 860, 29918, 710, 8963, 29918, 1111, 324, 29892, 599, 29918, 7387, 29897, 13, 13, 4706, 1596, 4197, 9302, 29889, 311, 7979, 267, 29898, 29882, 29889, 685, 29918, 11316, 29918, 2135, 29897, 363, 298, 297, 4955, 29941, 29961, 29900, 13018, 29896, 24960, 13, 4706, 1596, 4197, 29882, 29889, 8391, 29918, 2467, 29918, 13140, 363, 298, 297, 4955, 29941, 29961, 29900, 13018, 29896, 24960, 13, 13, 4706, 298, 29941, 353, 7442, 29889, 2378, 4197, 29961, 29882, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29916, 29892, 298, 29889, 3859, 29889, 4220, 29889, 3286, 18411, 29889, 29891, 29962, 363, 298, 297, 4955, 29941, 2314, 13, 4706, 325, 29941, 353, 7442, 29889, 2378, 4197, 29961, 9302, 29889, 3944, 29898, 29882, 29889, 3859, 29889, 4220, 29889, 5450, 362, 511, 7442, 29889, 5223, 29898, 29882, 29889, 3859, 29889, 4220, 29889, 5450, 362, 4638, 363, 298, 297, 13, 462, 539, 4955, 29941, 2314, 334, 29871, 29906, 29900, 29900, 13, 13, 4706, 14770, 29889, 695, 29888, 580, 13, 4706, 27815, 353, 14770, 29889, 29887, 1113, 580, 13, 4706, 8492, 29889, 4012, 29918, 2671, 29898, 1165, 267, 29897, 13, 13, 4706, 14770, 29889, 5317, 29898, 29882, 29941, 7503, 29892, 29871, 29900, 1402, 298, 29941, 7503, 29892, 29871, 29896, 1402, 17411, 272, 1495, 13, 4706, 14770, 29889, 339, 2147, 29898, 29882, 29941, 7503, 29892, 29871, 29900, 1402, 298, 29941, 7503, 29892, 29871, 29896, 1402, 325, 29941, 7503, 29892, 29871, 29900, 1402, 325, 29941, 7503, 29892, 29871, 29896, 1402, 10340, 2433, 2103, 1495, 13, 13, 4706, 14770, 29889, 4294, 580, 13, 2 ]
configs/diseased/resnet50_cancer_adddata.py
jiangwenj02/mmclassification
0
14379
_base_ = [ '../_base_/models/resnet50.py', '../_base_/datasets/cancer_bs32_pil_resize.py', '../_base_/schedules/imagenet_bs256_coslr.py', '../_base_/default_runtime.py' ] model = dict( head=dict( num_classes=2, topk=(1,)) ) data = dict( train=dict( data_prefix='/data3/zzhang/tmp/classification/train'), val=dict( data_prefix='/data3/zzhang/tmp/classification/test'), test=dict( data_prefix='/data3/zzhang/tmp/classification/test')) optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001) load_from = 'https://download.openmmlab.com/mmclassification/v0/resnet/resnet50_batch256_imagenet_20200708-cfb998bf.pth'
[ 1, 903, 3188, 29918, 353, 518, 13, 1678, 525, 6995, 29918, 3188, 29918, 29914, 9794, 29914, 690, 1212, 29945, 29900, 29889, 2272, 742, 525, 6995, 29918, 3188, 29918, 29914, 14538, 1691, 29914, 3068, 2265, 29918, 5824, 29941, 29906, 29918, 29886, 309, 29918, 21476, 29889, 2272, 742, 13, 1678, 525, 6995, 29918, 3188, 29918, 29914, 816, 287, 2540, 29914, 326, 5370, 300, 29918, 5824, 29906, 29945, 29953, 29918, 3944, 29212, 29889, 2272, 742, 525, 6995, 29918, 3188, 29918, 29914, 4381, 29918, 15634, 29889, 2272, 29915, 13, 29962, 13, 4299, 353, 9657, 29898, 13, 1678, 2343, 29922, 8977, 29898, 13, 4706, 954, 29918, 13203, 29922, 29906, 29892, 13, 4706, 2246, 29895, 7607, 29896, 29892, 876, 13, 29897, 13, 13, 1272, 353, 9657, 29898, 13, 1678, 7945, 29922, 8977, 29898, 13, 4706, 848, 29918, 13506, 2433, 29914, 1272, 29941, 29914, 5617, 11895, 29914, 7050, 29914, 1990, 2450, 29914, 14968, 5477, 13, 1678, 659, 29922, 8977, 29898, 13, 4706, 848, 29918, 13506, 2433, 29914, 1272, 29941, 29914, 5617, 11895, 29914, 7050, 29914, 1990, 2450, 29914, 1688, 5477, 13, 1678, 1243, 29922, 8977, 29898, 13, 4706, 848, 29918, 13506, 2433, 29914, 1272, 29941, 29914, 5617, 11895, 29914, 7050, 29914, 1990, 2450, 29914, 1688, 8785, 13, 13, 20640, 3950, 353, 9657, 29898, 1853, 2433, 26016, 29928, 742, 301, 29878, 29922, 29900, 29889, 29900, 29896, 29892, 19399, 29922, 29900, 29889, 29929, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29889, 29900, 29900, 29900, 29896, 29897, 13, 1359, 29918, 3166, 353, 525, 991, 597, 10382, 29889, 3150, 29885, 828, 370, 29889, 510, 29914, 4317, 1990, 2450, 29914, 29894, 29900, 29914, 690, 1212, 29914, 690, 1212, 29945, 29900, 29918, 16175, 29906, 29945, 29953, 29918, 326, 5370, 300, 29918, 29906, 29900, 29906, 29900, 29900, 29955, 29900, 29947, 29899, 6854, 29890, 29929, 29929, 29947, 1635, 29889, 29886, 386, 29915, 29871, 2 ]
experiment_replay/__init__.py
Narsil/experiment_replay
0
172607
import git import subprocess import datetime import sys import random PREFIX = "ExpReplay" # Prepare to escape in amend_command COMMIT_LINE = 'ExpReplay: {id} \\"{command}\\" {date}' def setup(): repo = git.Repo(search_parent_directories=True) if repo.is_dirty(): raise Exception("Repo is dirty") if len(repo.untracked_files) != 0: raise Exception("You have some untracked files, stash or commit to continue") sha = repo.head.object.hexsha command = " ".join(["python"] + sys.argv) id = "%06x" % random.getrandbits(24) line = COMMIT_LINE.format(id=id, command=command, date=datetime.datetime.now()) amend_command = f"""GIT_EDITOR="echo '{line}' >> $1" git commit --amend""" subprocess.call(amend_command, shell=True) return sha
[ 1, 1053, 6315, 13, 5215, 1014, 5014, 13, 5215, 12865, 13, 5215, 10876, 13, 5215, 4036, 13, 13, 15094, 25634, 353, 376, 9544, 1123, 1456, 29908, 13, 29937, 29871, 349, 3445, 598, 304, 10169, 297, 626, 355, 29918, 6519, 13, 3217, 7428, 1806, 29918, 18521, 353, 525, 9544, 1123, 1456, 29901, 426, 333, 29913, 2474, 29908, 29912, 6519, 1012, 5931, 426, 1256, 10162, 13, 13, 13, 1753, 6230, 7295, 13, 1678, 13761, 353, 6315, 29889, 5612, 29877, 29898, 4478, 29918, 3560, 29918, 11851, 3842, 29922, 5574, 29897, 13, 1678, 565, 13761, 29889, 275, 29918, 3972, 1017, 7295, 13, 4706, 12020, 8960, 703, 5612, 29877, 338, 26616, 1159, 13, 1678, 565, 7431, 29898, 20095, 29889, 1657, 22282, 287, 29918, 5325, 29897, 2804, 29871, 29900, 29901, 13, 4706, 12020, 8960, 703, 3492, 505, 777, 443, 11294, 287, 2066, 29892, 380, 1161, 470, 9063, 304, 6773, 1159, 13, 1678, 528, 29874, 353, 13761, 29889, 2813, 29889, 3318, 29889, 20970, 17051, 13, 1678, 1899, 353, 376, 11393, 7122, 29898, 3366, 4691, 3108, 718, 10876, 29889, 19218, 29897, 13, 1678, 1178, 353, 11860, 29900, 29953, 29916, 29908, 1273, 4036, 29889, 657, 9502, 14836, 29898, 29906, 29946, 29897, 13, 1678, 1196, 353, 4810, 7428, 1806, 29918, 18521, 29889, 4830, 29898, 333, 29922, 333, 29892, 1899, 29922, 6519, 29892, 2635, 29922, 12673, 29889, 12673, 29889, 3707, 3101, 13, 13, 1678, 626, 355, 29918, 6519, 353, 285, 15945, 29908, 29954, 1806, 29918, 12378, 1955, 543, 8057, 22372, 1220, 10162, 5099, 395, 29896, 29908, 6315, 9063, 1192, 314, 355, 15945, 29908, 13, 1678, 1014, 5014, 29889, 4804, 29898, 314, 355, 29918, 6519, 29892, 6473, 29922, 5574, 29897, 13, 1678, 736, 528, 29874, 13, 2 ]
Google_Sheet_Sensor_Logging/max31855_logger.py
claycooper/Adafruit_Learning_System_Guides
0
1612531
<gh_stars>0 # SPDX-FileCopyrightText: 2020 <NAME> for Adafruit Industries # # SPDX-License-Identifier: MIT import time from datetime import datetime import board import digitalio import adafruit_max31855 from google.oauth2.service_account import Credentials from googleapiclient.discovery import build #--| User Config |----------------------------------------------- SERVICE_ACCOUNT_FILE = 'YOUR_CREDENTIALS_FILE.json' SPREADSHEET_ID = 'YOUR_SHEET_ID' DATA_LOCATION = 'A1' UPDATE_RATE = 60 #--| User Config |----------------------------------------------- # Sensor setup cs = digitalio.DigitalInOut(board.C0) max31855 = adafruit_max31855.MAX31855(board.SPI(), cs) # Google Sheets API setup SCOPES = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'] CREDS = Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES) SHEET = build('sheets', 'v4', credentials=CREDS).spreadsheets() # Logging loop print("Logging...") while True: values = [[datetime.now().isoformat(), max31855.temperature]] SHEET.values().append(spreadsheetId=SPREADSHEET_ID, valueInputOption='RAW', range=DATA_LOCATION, body={'values' : values}).execute() time.sleep(UPDATE_RATE)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 10937, 29928, 29990, 29899, 2283, 11882, 1266, 1626, 29901, 29871, 29906, 29900, 29906, 29900, 529, 5813, 29958, 363, 23255, 29888, 9216, 12157, 2722, 13, 29937, 13, 29937, 10937, 29928, 29990, 29899, 29931, 293, 1947, 29899, 12889, 29901, 341, 1806, 13, 13, 5215, 931, 13, 3166, 12865, 1053, 12865, 13, 5215, 7613, 13, 5215, 13436, 601, 13, 5215, 594, 2142, 9216, 29918, 3317, 29941, 29896, 29947, 29945, 29945, 13, 3166, 5386, 29889, 23106, 29906, 29889, 5509, 29918, 10149, 1053, 24596, 9409, 13, 3166, 5386, 481, 293, 1593, 29889, 2218, 11911, 29891, 1053, 2048, 13, 13, 29937, 489, 29989, 4911, 12782, 891, 2683, 2683, 9072, 5634, 13, 6304, 19059, 29918, 2477, 18736, 29918, 7724, 353, 525, 29979, 22970, 29918, 29907, 19386, 3919, 25758, 29903, 29918, 7724, 29889, 3126, 29915, 13, 5550, 16310, 7068, 29923, 2544, 29918, 1367, 353, 525, 29979, 22970, 29918, 7068, 29923, 2544, 29918, 1367, 29915, 13, 14573, 29918, 16652, 8098, 353, 525, 29909, 29896, 29915, 13, 14474, 29918, 29934, 3040, 353, 29871, 29953, 29900, 13, 29937, 489, 29989, 4911, 12782, 891, 2683, 2683, 9072, 5634, 13, 13, 29937, 317, 6073, 6230, 13, 2395, 353, 13436, 601, 29889, 27103, 797, 3744, 29898, 3377, 29889, 29907, 29900, 29897, 13, 3317, 29941, 29896, 29947, 29945, 29945, 353, 594, 2142, 9216, 29918, 3317, 29941, 29896, 29947, 29945, 29945, 29889, 12648, 29941, 29896, 29947, 29945, 29945, 29898, 3377, 29889, 29903, 2227, 3285, 5939, 29897, 13, 13, 29937, 5087, 2296, 1691, 3450, 6230, 13, 29903, 3217, 29925, 2890, 353, 6024, 991, 597, 1028, 949, 19360, 29889, 3608, 29889, 510, 29914, 1725, 5779, 742, 13, 3986, 525, 991, 597, 1636, 29889, 15947, 29889, 510, 29914, 5150, 29914, 21594, 2033, 13, 22245, 8452, 353, 24596, 9409, 29889, 3166, 29918, 5509, 29918, 10149, 29918, 1445, 29898, 6304, 19059, 29918, 2477, 18736, 29918, 7724, 29892, 16505, 267, 29922, 29903, 3217, 29925, 2890, 29897, 13, 7068, 29923, 2544, 353, 2048, 877, 19360, 742, 525, 29894, 29946, 742, 16140, 29922, 22245, 8452, 467, 1028, 949, 19360, 580, 13, 13, 29937, 4522, 3460, 2425, 13, 2158, 703, 3403, 3460, 856, 1159, 13, 8000, 5852, 29901, 13, 1678, 1819, 353, 5519, 12673, 29889, 3707, 2141, 10718, 4830, 3285, 4236, 29941, 29896, 29947, 29945, 29945, 29889, 12863, 1535, 5262, 13, 1678, 317, 9606, 2544, 29889, 5975, 2141, 4397, 29898, 1028, 27844, 1204, 29922, 5550, 16310, 7068, 29923, 2544, 29918, 1367, 29892, 13, 462, 3986, 995, 4290, 8375, 2433, 4717, 29956, 742, 13, 462, 3986, 3464, 29922, 14573, 29918, 16652, 8098, 29892, 13, 462, 3986, 3573, 3790, 29915, 5975, 29915, 584, 1819, 7690, 7978, 580, 13, 1678, 931, 29889, 17059, 29898, 14474, 29918, 29934, 3040, 29897, 13, 2 ]
tests/hospital_resident/test_solver.py
drvinceknight/matching
0
28452
""" Unit tests for the HR solver. """ import pytest from matching import Matching from matching import Player as Resident from matching.games import HospitalResident from matching.players import Hospital from .params import HOSPITAL_RESIDENT, make_game, make_prefs @HOSPITAL_RESIDENT def test_init(resident_names, hospital_names, capacities, seed): """ Test that an instance of HospitalResident is created correctly when passed a set of players. """ residents, hospitals, game = make_game( resident_names, hospital_names, capacities, seed ) assert game.residents == residents assert game.hospitals == hospitals assert all([resident.matching is None for resident in game.residents]) assert all([hospital.matching == [] for hospital in game.hospitals]) assert game.matching is None @HOSPITAL_RESIDENT def test_create_from_dictionaries( resident_names, hospital_names, capacities, seed ): """ Test that HospitalResident is created correctly when passed a set of dictionaries for each party. """ resident_prefs, hospital_prefs = make_prefs( resident_names, hospital_names, seed ) capacities_ = dict(zip(hospital_names, capacities)) game = HospitalResident.create_from_dictionaries( resident_prefs, hospital_prefs, capacities_ ) for resident in game.residents: assert resident.pref_names == resident_prefs[resident.name] assert resident.matching is None for hospital in game.hospitals: assert hospital.pref_names == hospital_prefs[hospital.name] assert hospital.capacity == capacities_[hospital.name] assert hospital.matching == [] assert game.matching is None @HOSPITAL_RESIDENT def test_inputs_resident_prefs( resident_names, hospital_names, capacities, seed ): """ Test that each resident's preference list is a subset of the available hospitals, and check that an Exception is raised if not. """ _, _, game = make_game(resident_names, hospital_names, capacities, seed) assert game._check_resident_prefs() game.residents[0].prefs = [Resident("foo")] with pytest.raises(Exception): game._check_resident_prefs() @HOSPITAL_RESIDENT def test_inputs_hospital_prefs( resident_names, hospital_names, capacities, seed ): """ Test that each hospital has ranked all and only those residents that have ranked it, and check that an Exception is raised if not. """ _, _, game = make_game(resident_names, hospital_names, capacities, seed) assert game._check_hospital_prefs() game.hospitals[0].prefs.pop() with pytest.raises(Exception): game._check_hospital_prefs() @HOSPITAL_RESIDENT def test_solve(resident_names, hospital_names, capacities, seed): """ Test that HospitalResident can solve games correctly when passed players. """ for optimal in ["resident", "hospital"]: residents, hospitals, game = make_game( resident_names, hospital_names, capacities, seed ) matching = game.solve(optimal) assert isinstance(matching, Matching) assert set(matching.keys()) == set(hospitals) matched_residents = [ res for match in matching.values() for res in match ] assert matched_residents != [] and set(matched_residents).issubset( set(residents) ) for resident in set(residents) - set(matched_residents): assert resident.matching is None @HOSPITAL_RESIDENT def test_check_validity(resident_names, hospital_names, capacities, seed): """ Test that HospitalResident finds a valid matching when the game is solved. """ _, _, game = make_game(resident_names, hospital_names, capacities, seed) game.solve() assert game.check_validity() @HOSPITAL_RESIDENT def test_resident_matching(resident_names, hospital_names, capacities, seed): """ Test that HospitalResident recognises a valid matching requires a resident to have a preference of their match, if they have one. """ _, _, game = make_game(resident_names, hospital_names, capacities, seed) game.solve() game.residents[0].matching = Resident(name="foo") with pytest.raises(Exception): game._check_resident_matching() @HOSPITAL_RESIDENT def test_hospital_matching(resident_names, hospital_names, capacities, seed): """ Test that HospitalResident recognises a valid matching requires a hospital to have a preference of each of its matches, if any. """ _, _, game = make_game(resident_names, hospital_names, capacities, seed) game.solve() game.hospitals[0].matching.append(Resident(name="foo")) with pytest.raises(Exception): game._check_hospital_matching() @HOSPITAL_RESIDENT def test_hospital_capacity(resident_names, hospital_names, capacities, seed): """ Test that HospitalResident recognises a valid matching requires all hospitals to not be over-subscribed. """ _, _, game = make_game(resident_names, hospital_names, capacities, seed) game.solve() game.hospitals[0].matching = range(game.hospitals[0].capacity + 1) with pytest.raises(Exception): game._check_hospital_capacity() def test_check_stability(): """ Test that HospitalResident can recognise whether a matching is stable or not. """ residents = [Resident("A"), Resident("B"), Resident("C")] hospitals = [Hospital("X", 2), Hospital("Y", 2)] a, b, c = residents x, y = hospitals a.set_prefs([x, y]) b.set_prefs([y]) c.set_prefs([y, x]) x.set_prefs([c, a]) y.set_prefs([a, b, c]) game = HospitalResident(residents, hospitals) matching = game.solve() assert game.check_stability() matching[x] = [c] matching[y] = [a, b] assert not game.check_stability()
[ 1, 9995, 13223, 6987, 363, 278, 379, 29934, 899, 369, 29889, 9995, 13, 13, 5215, 11451, 1688, 13, 13, 3166, 9686, 1053, 14514, 292, 13, 3166, 9686, 1053, 14574, 408, 2538, 1693, 13, 3166, 9686, 29889, 29887, 1280, 1053, 15967, 1666, 1693, 13, 3166, 9686, 29889, 1456, 414, 1053, 15967, 13, 13, 3166, 869, 7529, 1053, 379, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 29892, 1207, 29918, 11802, 29892, 1207, 29918, 29886, 24539, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 2344, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 1125, 13, 1678, 9995, 4321, 393, 385, 2777, 310, 15967, 1666, 1693, 338, 2825, 5149, 746, 13, 1678, 4502, 263, 731, 310, 10769, 29889, 9995, 13, 13, 1678, 24060, 29892, 29418, 277, 1338, 29892, 3748, 353, 1207, 29918, 11802, 29898, 13, 4706, 20201, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 13, 1678, 1723, 13, 13, 1678, 4974, 3748, 29889, 690, 16719, 1275, 24060, 13, 1678, 4974, 3748, 29889, 29882, 4705, 277, 1338, 1275, 29418, 277, 1338, 13, 1678, 4974, 599, 4197, 690, 1693, 29889, 4352, 292, 338, 6213, 363, 20201, 297, 3748, 29889, 690, 16719, 2314, 13, 1678, 4974, 599, 4197, 29882, 8189, 29889, 4352, 292, 1275, 5159, 363, 13457, 297, 3748, 29889, 29882, 4705, 277, 1338, 2314, 13, 1678, 4974, 3748, 29889, 4352, 292, 338, 6213, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 3258, 29918, 3166, 29918, 29467, 4314, 29898, 13, 1678, 20201, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 13, 1125, 13, 1678, 9995, 4321, 393, 15967, 1666, 1693, 338, 2825, 5149, 746, 4502, 263, 731, 310, 13, 1678, 21503, 4314, 363, 1269, 6263, 29889, 9995, 13, 13, 1678, 20201, 29918, 29886, 24539, 29892, 13457, 29918, 29886, 24539, 353, 1207, 29918, 29886, 24539, 29898, 13, 4706, 20201, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 16717, 13, 1678, 1723, 13, 13, 1678, 11101, 1907, 29918, 353, 9657, 29898, 7554, 29898, 29882, 8189, 29918, 7039, 29892, 11101, 1907, 876, 13, 1678, 3748, 353, 15967, 1666, 1693, 29889, 3258, 29918, 3166, 29918, 29467, 4314, 29898, 13, 4706, 20201, 29918, 29886, 24539, 29892, 13457, 29918, 29886, 24539, 29892, 11101, 1907, 29918, 13, 1678, 1723, 13, 13, 1678, 363, 20201, 297, 3748, 29889, 690, 16719, 29901, 13, 4706, 4974, 20201, 29889, 29886, 999, 29918, 7039, 1275, 20201, 29918, 29886, 24539, 29961, 690, 1693, 29889, 978, 29962, 13, 4706, 4974, 20201, 29889, 4352, 292, 338, 6213, 13, 13, 1678, 363, 13457, 297, 3748, 29889, 29882, 4705, 277, 1338, 29901, 13, 4706, 4974, 13457, 29889, 29886, 999, 29918, 7039, 1275, 13457, 29918, 29886, 24539, 29961, 29882, 8189, 29889, 978, 29962, 13, 4706, 4974, 13457, 29889, 5030, 5946, 1275, 11101, 1907, 29918, 29961, 29882, 8189, 29889, 978, 29962, 13, 4706, 4974, 13457, 29889, 4352, 292, 1275, 5159, 13, 13, 1678, 4974, 3748, 29889, 4352, 292, 338, 6213, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 2080, 29879, 29918, 690, 1693, 29918, 29886, 24539, 29898, 13, 1678, 20201, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 13, 1125, 13, 1678, 9995, 4321, 393, 1269, 20201, 29915, 29879, 24583, 1051, 338, 263, 11306, 310, 278, 3625, 13, 1678, 29418, 277, 1338, 29892, 322, 1423, 393, 385, 8960, 338, 10425, 565, 451, 29889, 9995, 13, 13, 1678, 17117, 17117, 3748, 353, 1207, 29918, 11802, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 29897, 13, 13, 1678, 4974, 3748, 3032, 3198, 29918, 690, 1693, 29918, 29886, 24539, 580, 13, 13, 1678, 3748, 29889, 690, 16719, 29961, 29900, 1822, 29886, 24539, 353, 518, 1666, 1693, 703, 5431, 13531, 13, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2451, 1125, 13, 4706, 3748, 3032, 3198, 29918, 690, 1693, 29918, 29886, 24539, 580, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 2080, 29879, 29918, 29882, 8189, 29918, 29886, 24539, 29898, 13, 1678, 20201, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 13, 1125, 13, 1678, 9995, 4321, 393, 1269, 13457, 756, 26642, 599, 322, 871, 1906, 24060, 393, 13, 1678, 505, 26642, 372, 29892, 322, 1423, 393, 385, 8960, 338, 10425, 565, 451, 29889, 9995, 13, 13, 1678, 17117, 17117, 3748, 353, 1207, 29918, 11802, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 29897, 13, 13, 1678, 4974, 3748, 3032, 3198, 29918, 29882, 8189, 29918, 29886, 24539, 580, 13, 13, 1678, 3748, 29889, 29882, 4705, 277, 1338, 29961, 29900, 1822, 29886, 24539, 29889, 7323, 580, 13, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2451, 1125, 13, 4706, 3748, 3032, 3198, 29918, 29882, 8189, 29918, 29886, 24539, 580, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 2929, 345, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 1125, 13, 1678, 9995, 4321, 393, 15967, 1666, 1693, 508, 4505, 8090, 5149, 746, 4502, 13, 1678, 10769, 29889, 9995, 13, 13, 1678, 363, 14413, 297, 6796, 690, 1693, 613, 376, 29882, 8189, 3108, 29901, 13, 4706, 24060, 29892, 29418, 277, 1338, 29892, 3748, 353, 1207, 29918, 11802, 29898, 13, 9651, 20201, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 13, 4706, 1723, 13, 13, 4706, 9686, 353, 3748, 29889, 2929, 345, 29898, 3670, 3039, 29897, 13, 4706, 4974, 338, 8758, 29898, 4352, 292, 29892, 14514, 292, 29897, 13, 4706, 4974, 731, 29898, 4352, 292, 29889, 8149, 3101, 1275, 731, 29898, 29882, 4705, 277, 1338, 29897, 13, 4706, 19228, 29918, 690, 16719, 353, 518, 13, 9651, 620, 363, 1993, 297, 9686, 29889, 5975, 580, 363, 620, 297, 1993, 13, 4706, 4514, 13, 4706, 4974, 19228, 29918, 690, 16719, 2804, 5159, 322, 731, 29898, 4352, 287, 29918, 690, 16719, 467, 790, 431, 842, 29898, 13, 9651, 731, 29898, 690, 16719, 29897, 13, 4706, 1723, 13, 13, 4706, 363, 20201, 297, 731, 29898, 690, 16719, 29897, 448, 731, 29898, 4352, 287, 29918, 690, 16719, 1125, 13, 9651, 4974, 20201, 29889, 4352, 292, 338, 6213, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 3198, 29918, 3084, 537, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 1125, 13, 1678, 9995, 4321, 393, 15967, 1666, 1693, 14061, 263, 2854, 9686, 746, 278, 3748, 338, 13, 1678, 7484, 29889, 9995, 13, 13, 1678, 17117, 17117, 3748, 353, 1207, 29918, 11802, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 29897, 13, 13, 1678, 3748, 29889, 2929, 345, 580, 13, 1678, 4974, 3748, 29889, 3198, 29918, 3084, 537, 580, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 690, 1693, 29918, 4352, 292, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 1125, 13, 1678, 9995, 4321, 393, 15967, 1666, 1693, 5936, 4637, 263, 2854, 9686, 6858, 263, 20201, 13, 1678, 304, 505, 263, 24583, 310, 1009, 1993, 29892, 565, 896, 505, 697, 29889, 9995, 13, 13, 1678, 17117, 17117, 3748, 353, 1207, 29918, 11802, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 29897, 13, 13, 1678, 3748, 29889, 2929, 345, 580, 13, 1678, 3748, 29889, 690, 16719, 29961, 29900, 1822, 4352, 292, 353, 2538, 1693, 29898, 978, 543, 5431, 1159, 13, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2451, 1125, 13, 4706, 3748, 3032, 3198, 29918, 690, 1693, 29918, 4352, 292, 580, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 29882, 8189, 29918, 4352, 292, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 1125, 13, 1678, 9995, 4321, 393, 15967, 1666, 1693, 5936, 4637, 263, 2854, 9686, 6858, 263, 13, 1678, 13457, 304, 505, 263, 24583, 310, 1269, 310, 967, 7087, 29892, 565, 738, 29889, 9995, 13, 13, 1678, 17117, 17117, 3748, 353, 1207, 29918, 11802, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 29897, 13, 13, 1678, 3748, 29889, 2929, 345, 580, 13, 1678, 3748, 29889, 29882, 4705, 277, 1338, 29961, 29900, 1822, 4352, 292, 29889, 4397, 29898, 1666, 1693, 29898, 978, 543, 5431, 5783, 13, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2451, 1125, 13, 4706, 3748, 3032, 3198, 29918, 29882, 8189, 29918, 4352, 292, 580, 13, 13, 13, 29992, 29950, 3267, 29925, 1806, 1964, 29918, 15989, 1367, 3919, 13, 1753, 1243, 29918, 29882, 8189, 29918, 5030, 5946, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 1125, 13, 1678, 9995, 4321, 393, 15967, 1666, 1693, 5936, 4637, 263, 2854, 9686, 6858, 599, 13, 1678, 29418, 277, 1338, 304, 451, 367, 975, 29899, 1491, 7588, 2580, 29889, 9995, 13, 13, 1678, 17117, 17117, 3748, 353, 1207, 29918, 11802, 29898, 690, 1693, 29918, 7039, 29892, 13457, 29918, 7039, 29892, 11101, 1907, 29892, 16717, 29897, 13, 13, 1678, 3748, 29889, 2929, 345, 580, 13, 1678, 3748, 29889, 29882, 4705, 277, 1338, 29961, 29900, 1822, 4352, 292, 353, 3464, 29898, 11802, 29889, 29882, 4705, 277, 1338, 29961, 29900, 1822, 5030, 5946, 718, 29871, 29896, 29897, 13, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 2451, 1125, 13, 4706, 3748, 3032, 3198, 29918, 29882, 8189, 29918, 5030, 5946, 580, 13, 13, 13, 1753, 1243, 29918, 3198, 29918, 303, 3097, 7295, 13, 1678, 9995, 4321, 393, 15967, 1666, 1693, 508, 5936, 895, 3692, 263, 9686, 338, 13714, 470, 13, 1678, 451, 29889, 9995, 13, 13, 1678, 24060, 353, 518, 1666, 1693, 703, 29909, 4968, 2538, 1693, 703, 29933, 4968, 2538, 1693, 703, 29907, 13531, 13, 1678, 29418, 277, 1338, 353, 518, 29950, 8189, 703, 29990, 613, 29871, 29906, 511, 15967, 703, 29979, 613, 29871, 29906, 4638, 13, 13, 1678, 263, 29892, 289, 29892, 274, 353, 24060, 13, 1678, 921, 29892, 343, 353, 29418, 277, 1338, 13, 13, 1678, 263, 29889, 842, 29918, 29886, 24539, 4197, 29916, 29892, 343, 2314, 13, 1678, 289, 29889, 842, 29918, 29886, 24539, 4197, 29891, 2314, 13, 1678, 274, 29889, 842, 29918, 29886, 24539, 4197, 29891, 29892, 921, 2314, 13, 13, 1678, 921, 29889, 842, 29918, 29886, 24539, 4197, 29883, 29892, 263, 2314, 13, 1678, 343, 29889, 842, 29918, 29886, 24539, 4197, 29874, 29892, 289, 29892, 274, 2314, 13, 13, 1678, 3748, 353, 15967, 1666, 1693, 29898, 690, 16719, 29892, 29418, 277, 1338, 29897, 13, 13, 1678, 9686, 353, 3748, 29889, 2929, 345, 580, 13, 1678, 4974, 3748, 29889, 3198, 29918, 303, 3097, 580, 13, 13, 1678, 9686, 29961, 29916, 29962, 353, 518, 29883, 29962, 13, 1678, 9686, 29961, 29891, 29962, 353, 518, 29874, 29892, 289, 29962, 13, 13, 1678, 4974, 451, 3748, 29889, 3198, 29918, 303, 3097, 580, 13, 2 ]
HSI_Data_Preparation.py
fjpsxh/CNN_HSIC_MRF
56
31839
<filename>HSI_Data_Preparation.py<gh_stars>10-100 # -*- coding: utf-8 -*- """ Created on Sat Feb 18 16:21:13 2017 @author: <NAME> This code is modified based on https://github.com/KGPML/Hyperspectral """ import scipy.io import numpy as np from random import shuffle import random import scipy.ndimage from skimage.util import pad import os import time import pandas as pd from utils import patch_size,convertToOneHot import math from sklearn.decomposition import PCA flag_augment = True # true if adopt data-augmentation strategy start_time = time.time() ## Load data DATA_PATH = os.path.join(os.getcwd(),"Data") Data = scipy.io.loadmat(os.path.join(DATA_PATH, 'Indian_pines.mat'))['indian_pines'] Label = scipy.io.loadmat(os.path.join(DATA_PATH, 'Indian_pines_gt.mat'))['indian_pines_gt'] #Data = scipy.io.loadmat(os.path.join(DATA_PATH, 'PaviaU.mat'))['paviaU'] #Label = scipy.io.loadmat(os.path.join(DATA_PATH, 'PaviaU_gt.mat'))['paviaU_gt'] #Data = scipy.io.loadmat(os.path.join(DATA_PATH, 'Simu_data.mat'))['Simu_data'] #Label = scipy.io.loadmat(os.path.join(DATA_PATH, 'Simu_label.mat'))['Simu_label'] ## Some constant parameters Height, Width, Band = Data.shape[0], Data.shape[1], Data.shape[2] Num_Classes = len(np.unique(Label))-1 # Simu: len(np.unique(Label)) ## Scale the HSI Data between [0,1] Data = Data.astype(float) for band in range(Band): Data[:,:,band] = (Data[:,:,band]-np.min(Data[:,:,band]))/(np.max(Data[:,:,band])-np.min(Data[:,:,band])) #data_all = Data.transpose(2,0,1).transpose(0,2,1).reshape(Band,-1).transpose(1,0) #n_components = 40 #pca = PCA(n_components=n_components) #data_all = pca.fit_transform(data_all) #Data = data_all.transpose(1,0).reshape(n_components,Width,Height).transpose(0,2,1).transpose(1,2,0) ## padding the data beforehand Height, Width, Band = Data.shape[0], Data.shape[1], Data.shape[2] Data_Padding = np.zeros((Height+int(patch_size-1),Width+int(patch_size-1),Band)) for band in range(Band): Data_Padding[:,:,band] = pad(Data[:,:,band],int((patch_size-1)/2),'symmetric') def Patch(height_index,width_index): """ function to extract patches from the orignal data """ transpose_array = np.transpose(Data_Padding,(2,0,1)) height_slice = slice(height_index, height_index + patch_size) width_slice = slice(width_index, width_index + patch_size) patch = transpose_array[:,height_slice, width_slice] return np.array(patch) ## Collect patches for each class Classes,Classes_Index = [],[] for k in range(Num_Classes): Classes.append([]) Classes_Index.append([]) All_Patches, All_Labels = [],[] for j in range(0,Width): for i in range(0,Height): curr_inp = Patch(i,j) curr_ind = j * Height + i curr_tar = Label[i,j] All_Patches.append(curr_inp) All_Labels.append(curr_tar) #Ignore patches with unknown landcover type for the central pixel if(curr_tar!=0): Classes[curr_tar-1].append(curr_inp) Classes_Index[curr_tar-1].append(curr_ind) All_data = {} All_data['patch'] = All_Patches All_data['labels'] = All_Labels Num_Each_Class=[] for k in range(Num_Classes): Num_Each_Class.append(len(Classes[k])) def DataDivide(Classes_k,Num_Train_Each_Class_k,Classes_Index_k): """ function to divide collected patches into training and test patches """ np.random.seed(0) idx = np.random.choice(len(Classes_k), Num_Train_Each_Class_k, replace=False) train_patch = [Classes_k[i] for i in idx] train_index = [Classes_Index_k[i] for i in idx] idx_test = np.setdiff1d(range(len(Classes_k)),idx) test_patch = [Classes_k[i] for i in idx_test] test_index = [Classes_Index_k[i] for i in idx_test] return train_patch, test_patch, train_index, test_index ## Make a train and test split # method 1: fixed proportion train_frac = 0.05 Num_Train_Each_Class = [math.ceil(train_frac*x) for x in Num_Each_Class] Num_Train_Each_Class = [int(x) for x in Num_Train_Each_Class] # method 2: a fixed number for each class #Num_Train_Each_Class = [40] * Num_Classes Num_Test_Each_Class = list(np.array(Num_Each_Class) - np.array(Num_Train_Each_Class)) Train_Patch, Train_Label, Test_Patch, Test_Label = [],[],[],[] TestIndex, TrainIndex = [], [] for k in range(Num_Classes): train_patch, test_patch, train_index, test_index = DataDivide(Classes[k],Num_Train_Each_Class[k], Classes_Index[k]) TestIndex.extend(test_index) TrainIndex.extend(train_index) #Make training and test splits Train_Patch.append(train_patch) # patches_of_current_class[:-test_split_size] Test_Patch.extend(test_patch) # patches_of_current_class[-test_split_size:] Test_Label.extend(np.full(Num_Test_Each_Class[k], k, dtype=int)) Train_Label = [] for k in range(Num_Classes): Train_Label.append([k]*Num_Train_Each_Class[k]) Resample_Num_Count = Num_Train_Each_Class # Augment the data with random flipped and rotated patches fixed_Train_Patch = Train_Patch if flag_augment: Resample_Num_Count = [] times = 10 # can be tuned for k in range(Num_Classes): for l in range(times*Num_Train_Each_Class[k]): if(len(Train_Patch[k])<times*Num_Train_Each_Class[k]): num = random.randint(0,3) j = random.randint(0,Num_Train_Each_Class[k]-1) if num == 0 : #Flip patch up-down flipped_patch = np.flipud(fixed_Train_Patch[k][j]) if num == 1 : #Flip patch left-right flipped_patch = np.fliplr(fixed_Train_Patch[k][j]) if num == 2 : #add gaussian noise flipped_patch = Train_Patch[k][j] + np.random.normal(0,0.01,size = fixed_Train_Patch[k][j].shape) if num == 3 : #Rotate patch by a random angle no = random.randrange(-180,180,30) flipped_patch = scipy.ndimage.interpolation.rotate(fixed_Train_Patch[k][j], no,axes=(1, 0), reshape=False, output=None, order=3, mode='constant', cval=0.0, prefilter=False) Train_Patch[k].append(flipped_patch) Train_Label[k].append(k) Resample_Num_Count.append(len(Train_Patch[k])) OS_Aug_Num_Training_Each = [] for k in range(Num_Classes): OS_Aug_Num_Training_Each.append(len(Train_Label[k])) if flag_augment == False: OS_Aug_Num_Training_Each = Resample_Num_Count # release list to elements Temp1,Temp2 = [],[] for k in range(Num_Classes): Temp1.extend(Train_Patch[k]) Temp2.extend(Train_Label[k]) Train_Patch = Temp1 Train_Label = Temp2 Train_Patch = np.array(Train_Patch) # Convert the labels to One-Hot vector Train_Label = np.array(Train_Label) Test_Label = np.array(Test_Label) Train_Label = convertToOneHot(Train_Label,num_classes=Num_Classes) Test_Label = convertToOneHot(Test_Label,num_classes=Num_Classes) ## Save the patches in segments # Train Data train_dict = {} num_train = len(Train_Patch) num_train_file = 10 num_each_file = int(num_train / num_train_file) res_num = num_train - num_train_file * num_each_file Num_Each_File = num_each_file * np.ones((1,num_train_file),dtype=int) Num_Each_File = Num_Each_File[0] Num_Each_File[num_train_file-1] = Num_Each_File[num_train_file-1] + res_num start = 0 for i in range(num_train_file): file_name = 'Train_'+str(patch_size)+'_'+str(i+1)+'.mat' train_dict["train_patch"] = Train_Patch[start:start+Num_Each_File[i]] train_dict["train_labels"] = Train_Label[start:start+Num_Each_File[i],:] scipy.io.savemat(os.path.join(DATA_PATH, file_name),train_dict) start = start + Num_Each_File[i] # Test Data test_dict = {} num_test = len(Test_Patch) num_test_file = 10 num_each_file = int(num_test / num_test_file) res_num = num_test - num_test_file * num_each_file Num_Each_File = num_each_file * np.ones((1,num_test_file),dtype=int) Num_Each_File = Num_Each_File[0] Num_Each_File[num_test_file-1] = Num_Each_File[num_test_file-1] + res_num start = 0 for i in range(num_test_file): file_name = 'Test_'+str(patch_size)+'_'+str(i+1)+'.mat' test_dict["test_patch"] = Test_Patch[start:start+Num_Each_File[i]] test_dict["test_labels"] = Test_Label[start:start+Num_Each_File[i],:] scipy.io.savemat(os.path.join(DATA_PATH, file_name),test_dict) start += Num_Each_File[i] def add_DataSet(first,second,data_type): if data_type == 'train': temp_image = np.concatenate((first['train_patch'],second['train_patch']),axis=0) temp_labels = np.concatenate((first['train_labels'],second['train_labels']),axis=0) Combined_data = {} Combined_data['train_patch'] = temp_image Combined_data['train_labels'] = temp_labels if data_type == 'test': temp_image = np.concatenate((first['test_patch'],second['test_patch']),axis=0) temp_labels = np.concatenate((first['test_labels'],second['test_labels']),axis=0) Combined_data = {} Combined_data['test_patch'] = temp_image Combined_data['test_labels'] = temp_labels return Combined_data def Prepare_data(): """ functions to prepare Training and Testing data""" for i in range(num_train_file): file_name = 'Train_'+str(patch_size)+'_'+str(i+1)+'.mat' data_sets = scipy.io.loadmat(os.path.join(DATA_PATH, file_name)) if(i==0): Training_data = data_sets continue else: Training_data = add_DataSet(Training_data,data_sets,'train') for i in range(num_test_file): file_name = 'Test_'+str(patch_size)+'_'+str(i+1)+'.mat' data_sets = scipy.io.loadmat(os.path.join(DATA_PATH, file_name)) if(i==0): Test_data = data_sets continue else: Test_data = add_DataSet(Test_data,data_sets,'test') return Training_data, Test_data Training_data, Test_data = Prepare_data() print('Training Data:') print(Training_data['train_patch'].shape) print('Test Data:') print(Test_data['test_patch'].shape) # Data Summary df = pd.DataFrame(np.random.randn(Num_Classes, 4), columns=['Total', 'Training', 'OS&Aug', 'Testing']) df['Total'] = Num_Each_Class df['Training'] = Num_Train_Each_Class df['OS&Aug'] = OS_Aug_Num_Training_Each df['Testing'] = Num_Test_Each_Class print("=======================================================================") print("Data Summary") print("=======================================================================") print('The size of the original HSI data is (%d,%d,%d)'%(Height,Width,Band)) print('The size of Training data is (%d)'%(num_train)) print('The size of Test data is (%d)'%(num_test)) print('The size of each sample is (%d,%d,%d)'%(Band,patch_size,patch_size)) print('-----------------------------------------------------------------------') print("The Data Division is") print(df) duration_time = time.time() - start_time print("=======================================================================") print('Data Preparation is Completed! (It takes %.5f seconds)'%(duration_time)) print("=======================================================================") def load_index_data(): data_path = os.getcwd() train_index = scipy.io.loadmat(os.path.join(data_path, 'TrainIndex.mat'))['TrainIndex'] test_index = scipy.io.loadmat(os.path.join(data_path, 'TestIndex.mat'))['TestIndex'] train_index = train_index[0] test_index = test_index[0] TrainData = {} TrainData['train_patch'] = np.array([All_data['patch'][i] for i in train_index]) TrainLabel = [All_data['labels'][i] for i in train_index] TrainLabel = np.array(TrainLabel) TrainLabel = convertToOneHot(TrainLabel-1,num_classes=Num_Classes) TrainData['train_labels'] = TrainLabel TestData = {} TestData['test_patch'] = np.array([All_data['patch'][i] for i in test_index]) TestLabel = [All_data['labels'][i] for i in test_index] TestLabel = np.array(TestLabel) TestLabel = convertToOneHot(TestLabel-1,num_classes=Num_Classes) TestData['test_labels'] = TestLabel return TrainData, TestData, train_index, test_index
[ 1, 529, 9507, 29958, 29950, 5425, 29918, 1469, 29918, 6572, 862, 362, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 373, 12178, 26319, 29871, 29896, 29947, 29871, 29896, 29953, 29901, 29906, 29896, 29901, 29896, 29941, 29871, 29906, 29900, 29896, 29955, 13, 29992, 8921, 29901, 529, 5813, 29958, 13, 4013, 775, 338, 9120, 2729, 373, 2045, 597, 3292, 29889, 510, 29914, 29968, 19903, 1988, 29914, 29950, 1478, 414, 1103, 1705, 13, 15945, 29908, 13, 13, 5215, 4560, 2272, 29889, 601, 13, 5215, 12655, 408, 7442, 13, 3166, 4036, 1053, 528, 21897, 13, 5215, 4036, 13, 5215, 4560, 2272, 29889, 299, 3027, 13, 3166, 2071, 3027, 29889, 4422, 1053, 17132, 13, 5215, 2897, 13, 5215, 931, 13, 5215, 11701, 408, 10518, 13, 3166, 3667, 29879, 1053, 13261, 29918, 2311, 29892, 13441, 1762, 6716, 28917, 13, 5215, 5844, 13, 3166, 2071, 19668, 29889, 311, 510, 3283, 1053, 349, 5454, 13, 13, 15581, 29918, 2987, 358, 353, 5852, 1678, 396, 1565, 565, 9332, 848, 29899, 2987, 358, 362, 13705, 13, 13, 2962, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 13, 2277, 16012, 848, 13, 14573, 29918, 10145, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 657, 29883, 9970, 3285, 29908, 1469, 1159, 13, 1469, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 525, 2568, 713, 29918, 29886, 1475, 29889, 2922, 8785, 1839, 513, 713, 29918, 29886, 1475, 2033, 13, 4775, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 525, 2568, 713, 29918, 29886, 1475, 29918, 4141, 29889, 2922, 8785, 1839, 513, 713, 29918, 29886, 1475, 29918, 4141, 2033, 13, 13, 29937, 1469, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 525, 29925, 12751, 29965, 29889, 2922, 8785, 1839, 29886, 12751, 29965, 2033, 13, 29937, 4775, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 525, 29925, 12751, 29965, 29918, 4141, 29889, 2922, 8785, 1839, 29886, 12751, 29965, 29918, 4141, 2033, 13, 13, 29937, 1469, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 525, 8942, 29884, 29918, 1272, 29889, 2922, 8785, 1839, 8942, 29884, 29918, 1272, 2033, 13, 29937, 4775, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 525, 8942, 29884, 29918, 1643, 29889, 2922, 8785, 1839, 8942, 29884, 29918, 1643, 2033, 13, 13, 2277, 3834, 4868, 4128, 13, 7011, 29892, 21485, 29892, 5158, 353, 3630, 29889, 12181, 29961, 29900, 1402, 3630, 29889, 12181, 29961, 29896, 1402, 3630, 29889, 12181, 29961, 29906, 29962, 13, 8009, 29918, 27403, 353, 7431, 29898, 9302, 29889, 13092, 29898, 4775, 876, 29899, 29896, 268, 396, 3439, 29884, 29901, 7431, 29898, 9302, 29889, 13092, 29898, 4775, 876, 259, 13, 13, 13, 2277, 2522, 744, 278, 379, 5425, 3630, 1546, 518, 29900, 29892, 29896, 29962, 13, 1469, 353, 3630, 29889, 579, 668, 29898, 7411, 29897, 13, 1454, 3719, 297, 3464, 29898, 29933, 392, 1125, 13, 1678, 3630, 7503, 29892, 29901, 29892, 4980, 29962, 353, 313, 1469, 7503, 29892, 29901, 29892, 4980, 29962, 29899, 9302, 29889, 1195, 29898, 1469, 7503, 29892, 29901, 29892, 4980, 12622, 14571, 9302, 29889, 3317, 29898, 1469, 7503, 29892, 29901, 29892, 4980, 2314, 29899, 9302, 29889, 1195, 29898, 1469, 7503, 29892, 29901, 29892, 4980, 12622, 13, 13, 29937, 1272, 29918, 497, 353, 3630, 29889, 3286, 4220, 29898, 29906, 29892, 29900, 29892, 29896, 467, 3286, 4220, 29898, 29900, 29892, 29906, 29892, 29896, 467, 690, 14443, 29898, 29933, 392, 6653, 29896, 467, 3286, 4220, 29898, 29896, 29892, 29900, 29897, 13, 29937, 29876, 29918, 14036, 353, 29871, 29946, 29900, 13, 29937, 29886, 1113, 353, 349, 5454, 29898, 29876, 29918, 14036, 29922, 29876, 29918, 14036, 29897, 13, 29937, 1272, 29918, 497, 353, 282, 1113, 29889, 9202, 29918, 9067, 29898, 1272, 29918, 497, 29897, 13, 29937, 1469, 353, 848, 29918, 497, 29889, 3286, 4220, 29898, 29896, 29892, 29900, 467, 690, 14443, 29898, 29876, 29918, 14036, 29892, 6110, 29892, 7011, 467, 3286, 4220, 29898, 29900, 29892, 29906, 29892, 29896, 467, 3286, 4220, 29898, 29896, 29892, 29906, 29892, 29900, 29897, 268, 13, 268, 13, 2277, 7164, 278, 848, 1434, 3179, 13, 7011, 29892, 21485, 29892, 5158, 353, 3630, 29889, 12181, 29961, 29900, 1402, 3630, 29889, 12181, 29961, 29896, 1402, 3630, 29889, 12181, 29961, 29906, 29962, 13, 1469, 29918, 29925, 4676, 353, 7442, 29889, 3298, 359, 3552, 7011, 29974, 524, 29898, 5041, 29918, 2311, 29899, 29896, 511, 6110, 29974, 524, 29898, 5041, 29918, 2311, 29899, 29896, 511, 29933, 392, 876, 13, 1454, 3719, 297, 3464, 29898, 29933, 392, 1125, 13, 1678, 3630, 29918, 29925, 4676, 7503, 29892, 29901, 29892, 4980, 29962, 353, 17132, 29898, 1469, 7503, 29892, 29901, 29892, 4980, 1402, 524, 3552, 5041, 29918, 2311, 29899, 29896, 6802, 29906, 511, 29915, 11967, 16414, 1495, 13, 268, 13, 1753, 349, 905, 29898, 3545, 29918, 2248, 29892, 2103, 29918, 2248, 1125, 13, 1678, 9995, 740, 304, 6597, 13261, 267, 515, 278, 470, 647, 284, 848, 9995, 13, 1678, 1301, 4220, 29918, 2378, 353, 7442, 29889, 3286, 4220, 29898, 1469, 29918, 29925, 4676, 22657, 29906, 29892, 29900, 29892, 29896, 876, 13, 1678, 3171, 29918, 18337, 353, 22780, 29898, 3545, 29918, 2248, 29892, 3171, 29918, 2248, 718, 13261, 29918, 2311, 29897, 13, 1678, 2920, 29918, 18337, 353, 22780, 29898, 2103, 29918, 2248, 29892, 2920, 29918, 2248, 718, 13261, 29918, 2311, 29897, 13, 1678, 13261, 353, 1301, 4220, 29918, 2378, 7503, 29892, 3545, 29918, 18337, 29892, 2920, 29918, 18337, 29962, 13, 1678, 736, 7442, 29889, 2378, 29898, 5041, 29897, 1678, 13, 13, 2277, 24930, 13261, 267, 363, 1269, 770, 13, 27403, 29892, 27403, 29918, 3220, 353, 19997, 2636, 13, 1454, 413, 297, 3464, 29898, 8009, 29918, 27403, 1125, 13, 1678, 4134, 267, 29889, 4397, 4197, 2314, 13, 1678, 4134, 267, 29918, 3220, 29889, 4397, 4197, 2314, 13, 13, 3596, 29918, 29925, 905, 267, 29892, 2178, 29918, 4775, 29879, 353, 19997, 2636, 1678, 13, 1454, 432, 297, 3464, 29898, 29900, 29892, 6110, 1125, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7011, 1125, 13, 4706, 16256, 29918, 262, 29886, 353, 349, 905, 29898, 29875, 29892, 29926, 29897, 13, 4706, 16256, 29918, 513, 353, 432, 334, 22907, 718, 474, 13, 4706, 16256, 29918, 12637, 353, 15796, 29961, 29875, 29892, 29926, 29962, 13, 4706, 2178, 29918, 29925, 905, 267, 29889, 4397, 29898, 21962, 29918, 262, 29886, 29897, 13, 4706, 2178, 29918, 4775, 29879, 29889, 4397, 29898, 21962, 29918, 12637, 29897, 13, 4706, 396, 23805, 13261, 267, 411, 9815, 2982, 11911, 1134, 363, 278, 6555, 15526, 13, 4706, 565, 29898, 21962, 29918, 12637, 19216, 29900, 1125, 29871, 13, 9651, 4134, 267, 29961, 21962, 29918, 12637, 29899, 29896, 1822, 4397, 29898, 21962, 29918, 262, 29886, 29897, 29871, 13, 9651, 4134, 267, 29918, 3220, 29961, 21962, 29918, 12637, 29899, 29896, 1822, 4397, 29898, 21962, 29918, 513, 29897, 13, 3596, 29918, 1272, 353, 6571, 13, 3596, 29918, 1272, 1839, 5041, 2033, 353, 2178, 29918, 29925, 905, 267, 13, 3596, 29918, 1272, 1839, 21134, 2033, 353, 2178, 29918, 4775, 29879, 13, 13, 8009, 29918, 9760, 29918, 2385, 29922, 2636, 13, 1454, 413, 297, 3464, 29898, 8009, 29918, 27403, 1125, 13, 1678, 11848, 29918, 9760, 29918, 2385, 29889, 4397, 29898, 2435, 29898, 27403, 29961, 29895, 12622, 13, 268, 13, 13, 1753, 3630, 12596, 680, 29898, 27403, 29918, 29895, 29892, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29918, 29895, 29892, 27403, 29918, 3220, 29918, 29895, 1125, 13, 1678, 9995, 740, 304, 16429, 16531, 13261, 267, 964, 6694, 322, 1243, 13261, 267, 9995, 13, 1678, 7442, 29889, 8172, 29889, 26776, 29898, 29900, 29897, 13, 1678, 22645, 353, 7442, 29889, 8172, 29889, 16957, 29898, 2435, 29898, 27403, 29918, 29895, 511, 11848, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29918, 29895, 29892, 5191, 29922, 8824, 29897, 13, 1678, 7945, 29918, 5041, 353, 518, 27403, 29918, 29895, 29961, 29875, 29962, 363, 474, 297, 22645, 29962, 13, 1678, 7945, 29918, 2248, 353, 518, 27403, 29918, 3220, 29918, 29895, 29961, 29875, 29962, 363, 474, 297, 22645, 29962, 13, 1678, 22645, 29918, 1688, 353, 7442, 29889, 842, 12765, 29896, 29881, 29898, 3881, 29898, 2435, 29898, 27403, 29918, 29895, 8243, 13140, 29897, 13, 1678, 1243, 29918, 5041, 353, 518, 27403, 29918, 29895, 29961, 29875, 29962, 363, 474, 297, 22645, 29918, 1688, 29962, 13, 1678, 1243, 29918, 2248, 353, 518, 27403, 29918, 3220, 29918, 29895, 29961, 29875, 29962, 363, 474, 297, 22645, 29918, 1688, 29962, 13, 1678, 736, 7945, 29918, 5041, 29892, 1243, 29918, 5041, 29892, 7945, 29918, 2248, 29892, 1243, 29918, 2248, 1678, 13, 4706, 13, 2277, 8561, 263, 7945, 322, 1243, 6219, 29871, 13, 29937, 1158, 29871, 29896, 29901, 4343, 18618, 13, 14968, 29918, 1154, 353, 29871, 29900, 29889, 29900, 29945, 13, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 353, 518, 755, 29889, 27696, 29898, 14968, 29918, 1154, 29930, 29916, 29897, 363, 921, 297, 11848, 29918, 9760, 29918, 2385, 29962, 13, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 353, 518, 524, 29898, 29916, 29897, 363, 921, 297, 11848, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29962, 29871, 13, 13, 29937, 1158, 29871, 29906, 29901, 263, 4343, 1353, 363, 1269, 770, 462, 259, 13, 29937, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 353, 518, 29946, 29900, 29962, 334, 11848, 29918, 27403, 13, 13, 8009, 29918, 3057, 29918, 9760, 29918, 2385, 353, 1051, 29898, 9302, 29889, 2378, 29898, 8009, 29918, 9760, 29918, 2385, 29897, 448, 7442, 29889, 2378, 29898, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 876, 13, 5323, 262, 29918, 29925, 905, 29892, 28186, 29918, 4775, 29892, 4321, 29918, 29925, 905, 29892, 4321, 29918, 4775, 353, 518, 16272, 16272, 1402, 2636, 13, 3057, 3220, 29892, 28186, 3220, 353, 19997, 5159, 13, 1454, 413, 297, 3464, 29898, 8009, 29918, 27403, 1125, 29871, 13, 1678, 7945, 29918, 5041, 29892, 1243, 29918, 5041, 29892, 7945, 29918, 2248, 29892, 1243, 29918, 2248, 29871, 353, 3630, 12596, 680, 29898, 27403, 29961, 29895, 1402, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29961, 29895, 1402, 13, 462, 462, 462, 268, 4134, 267, 29918, 3220, 29961, 29895, 2314, 13, 1678, 4321, 3220, 29889, 21843, 29898, 1688, 29918, 2248, 29897, 13, 1678, 28186, 3220, 29889, 21843, 29898, 14968, 29918, 2248, 29897, 13, 1678, 396, 9984, 6694, 322, 1243, 8536, 1169, 13, 1678, 28186, 29918, 29925, 905, 29889, 4397, 29898, 14968, 29918, 5041, 29897, 1678, 396, 13261, 267, 29918, 974, 29918, 3784, 29918, 1990, 7503, 29899, 1688, 29918, 5451, 29918, 2311, 29962, 13, 1678, 4321, 29918, 29925, 905, 29889, 21843, 29898, 1688, 29918, 5041, 29897, 1678, 396, 13261, 267, 29918, 974, 29918, 3784, 29918, 1990, 14352, 1688, 29918, 5451, 29918, 2311, 17531, 13, 1678, 4321, 29918, 4775, 29889, 21843, 29898, 9302, 29889, 8159, 29898, 8009, 29918, 3057, 29918, 9760, 29918, 2385, 29961, 29895, 1402, 413, 29892, 26688, 29922, 524, 876, 13, 13, 5323, 262, 29918, 4775, 353, 5159, 13, 1454, 413, 297, 3464, 29898, 8009, 29918, 27403, 1125, 13, 1678, 28186, 29918, 4775, 29889, 4397, 4197, 29895, 14178, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29961, 29895, 2314, 13, 1678, 2538, 981, 29918, 8009, 29918, 3981, 353, 11848, 29918, 5323, 262, 29918, 9760, 29918, 2385, 13, 268, 13, 29937, 22333, 358, 278, 848, 411, 4036, 285, 492, 2986, 322, 5731, 630, 13261, 267, 13, 20227, 29918, 5323, 262, 29918, 29925, 905, 353, 28186, 29918, 29925, 905, 268, 13, 361, 7353, 29918, 2987, 358, 29901, 13, 1678, 2538, 981, 29918, 8009, 29918, 3981, 353, 5159, 13, 1678, 3064, 353, 29871, 29896, 29900, 1678, 396, 508, 367, 18515, 287, 13, 1678, 363, 413, 297, 3464, 29898, 8009, 29918, 27403, 1125, 13, 4706, 363, 301, 297, 3464, 29898, 3706, 29930, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29961, 29895, 29962, 1125, 18884, 13, 9651, 565, 29898, 2435, 29898, 5323, 262, 29918, 29925, 905, 29961, 29895, 2314, 29966, 3706, 29930, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29961, 29895, 29962, 1125, 1678, 13, 18884, 954, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 29941, 29897, 13, 18884, 432, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 8009, 29918, 5323, 262, 29918, 9760, 29918, 2385, 29961, 29895, 29962, 29899, 29896, 29897, 13, 18884, 565, 954, 1275, 29871, 29900, 584, 13, 462, 1678, 396, 29943, 3466, 13261, 701, 29899, 3204, 13, 462, 1678, 285, 492, 2986, 29918, 5041, 353, 7442, 29889, 29888, 3466, 566, 29898, 20227, 29918, 5323, 262, 29918, 29925, 905, 29961, 29895, 3816, 29926, 2314, 29871, 13, 18884, 565, 954, 1275, 29871, 29896, 584, 13, 462, 1678, 396, 29943, 3466, 13261, 2175, 29899, 1266, 13, 462, 1678, 285, 492, 2986, 29918, 5041, 353, 7442, 29889, 20157, 572, 29878, 29898, 20227, 29918, 5323, 262, 29918, 29925, 905, 29961, 29895, 3816, 29926, 2314, 29871, 13, 18884, 565, 954, 1275, 29871, 29906, 584, 13, 462, 1678, 396, 1202, 330, 17019, 11462, 13, 462, 1678, 285, 492, 2986, 29918, 5041, 353, 28186, 29918, 29925, 905, 29961, 29895, 3816, 29926, 29962, 718, 7442, 29889, 8172, 29889, 8945, 29898, 29900, 29892, 29900, 29889, 29900, 29896, 29892, 2311, 353, 4343, 29918, 5323, 262, 29918, 29925, 905, 29961, 29895, 3816, 29926, 1822, 12181, 29897, 29871, 13, 18884, 565, 954, 1275, 29871, 29941, 584, 13, 462, 1678, 396, 21281, 403, 13261, 491, 263, 4036, 10696, 13, 462, 1678, 694, 353, 4036, 29889, 9502, 3881, 6278, 29896, 29947, 29900, 29892, 29896, 29947, 29900, 29892, 29941, 29900, 29897, 13, 462, 1678, 285, 492, 2986, 29918, 5041, 353, 4560, 2272, 29889, 299, 3027, 29889, 1639, 3733, 362, 29889, 23361, 29898, 20227, 29918, 5323, 262, 29918, 29925, 905, 29961, 29895, 3816, 29926, 1402, 694, 29892, 1165, 267, 7607, 29896, 29892, 29871, 29900, 511, 29871, 13, 462, 4706, 620, 14443, 29922, 8824, 29892, 1962, 29922, 8516, 29892, 1797, 29922, 29941, 29892, 4464, 2433, 23362, 742, 274, 791, 29922, 29900, 29889, 29900, 29892, 758, 4572, 29922, 8824, 29897, 13, 18884, 28186, 29918, 29925, 905, 29961, 29895, 1822, 4397, 29898, 20157, 2986, 29918, 5041, 29897, 13, 18884, 28186, 29918, 4775, 29961, 29895, 1822, 4397, 29898, 29895, 29897, 13, 4706, 2538, 981, 29918, 8009, 29918, 3981, 29889, 4397, 29898, 2435, 29898, 5323, 262, 29918, 29925, 905, 29961, 29895, 12622, 13, 462, 462, 13, 1678, 6570, 29918, 29909, 688, 29918, 8009, 29918, 5323, 2827, 29918, 9760, 353, 5159, 795, 13, 1678, 363, 413, 297, 3464, 29898, 8009, 29918, 27403, 1125, 13, 4706, 6570, 29918, 29909, 688, 29918, 8009, 29918, 5323, 2827, 29918, 9760, 29889, 4397, 29898, 2435, 29898, 5323, 262, 29918, 4775, 29961, 29895, 12622, 29871, 13, 13, 361, 7353, 29918, 2987, 358, 1275, 7700, 29901, 13, 1678, 6570, 29918, 29909, 688, 29918, 8009, 29918, 5323, 2827, 29918, 9760, 353, 2538, 981, 29918, 8009, 29918, 3981, 13, 632, 13, 29937, 6507, 1051, 304, 3161, 795, 13, 15637, 29896, 29892, 15637, 29906, 353, 19997, 2636, 13, 1454, 413, 297, 3464, 29898, 8009, 29918, 27403, 1125, 13, 1678, 21121, 29896, 29889, 21843, 29898, 5323, 262, 29918, 29925, 905, 29961, 29895, 2314, 13, 1678, 21121, 29906, 29889, 21843, 29898, 5323, 262, 29918, 4775, 29961, 29895, 2314, 13, 5323, 262, 29918, 29925, 905, 353, 21121, 29896, 13, 5323, 262, 29918, 4775, 353, 21121, 29906, 13, 13, 5323, 262, 29918, 29925, 905, 353, 7442, 29889, 2378, 29898, 5323, 262, 29918, 29925, 905, 29897, 13, 13, 29937, 14806, 278, 11073, 304, 3118, 29899, 28917, 4608, 13, 5323, 262, 29918, 4775, 353, 7442, 29889, 2378, 29898, 5323, 262, 29918, 4775, 29897, 13, 3057, 29918, 4775, 353, 7442, 29889, 2378, 29898, 3057, 29918, 4775, 29897, 13, 5323, 262, 29918, 4775, 353, 3588, 1762, 6716, 28917, 29898, 5323, 262, 29918, 4775, 29892, 1949, 29918, 13203, 29922, 8009, 29918, 27403, 29897, 13, 3057, 29918, 4775, 353, 3588, 1762, 6716, 28917, 29898, 3057, 29918, 4775, 29892, 1949, 29918, 13203, 29922, 8009, 29918, 27403, 29897, 13, 462, 539, 13, 2277, 16913, 278, 13261, 267, 297, 24611, 13, 29937, 28186, 3630, 13, 14968, 29918, 8977, 353, 6571, 13, 1949, 29918, 14968, 353, 7431, 29898, 5323, 262, 29918, 29925, 905, 29897, 13, 1949, 29918, 14968, 29918, 1445, 353, 29871, 29896, 29900, 13, 1949, 29918, 4204, 29918, 1445, 353, 938, 29898, 1949, 29918, 14968, 847, 954, 29918, 14968, 29918, 1445, 29897, 13, 690, 29918, 1949, 353, 954, 29918, 14968, 448, 954, 29918, 14968, 29918, 1445, 334, 954, 29918, 4204, 29918, 1445, 13, 8009, 29918, 9760, 29918, 2283, 353, 954, 29918, 4204, 29918, 1445, 334, 7442, 29889, 2873, 3552, 29896, 29892, 1949, 29918, 14968, 29918, 1445, 511, 29881, 1853, 29922, 524, 29897, 13, 8009, 29918, 9760, 29918, 2283, 353, 11848, 29918, 9760, 29918, 2283, 29961, 29900, 29962, 13, 8009, 29918, 9760, 29918, 2283, 29961, 1949, 29918, 14968, 29918, 1445, 29899, 29896, 29962, 353, 11848, 29918, 9760, 29918, 2283, 29961, 1949, 29918, 14968, 29918, 1445, 29899, 29896, 29962, 718, 620, 29918, 1949, 13, 2962, 353, 29871, 29900, 13, 1454, 474, 297, 3464, 29898, 1949, 29918, 14968, 29918, 1445, 1125, 13, 1678, 934, 29918, 978, 353, 525, 5323, 262, 29918, 18717, 710, 29898, 5041, 29918, 2311, 7240, 15972, 18717, 710, 29898, 29875, 29974, 29896, 7240, 4286, 2922, 29915, 13, 1678, 7945, 29918, 8977, 3366, 14968, 29918, 5041, 3108, 353, 28186, 29918, 29925, 905, 29961, 2962, 29901, 2962, 29974, 8009, 29918, 9760, 29918, 2283, 29961, 29875, 5262, 13, 1678, 7945, 29918, 8977, 3366, 14968, 29918, 21134, 3108, 353, 28186, 29918, 4775, 29961, 2962, 29901, 2962, 29974, 8009, 29918, 9760, 29918, 2283, 29961, 29875, 1402, 17531, 13, 1678, 4560, 2272, 29889, 601, 29889, 29879, 485, 4579, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 934, 29918, 978, 511, 14968, 29918, 8977, 29897, 13, 1678, 1369, 353, 1369, 718, 11848, 29918, 9760, 29918, 2283, 29961, 29875, 29962, 13, 268, 13, 29937, 4321, 3630, 13, 1688, 29918, 8977, 353, 6571, 13, 1949, 29918, 1688, 353, 7431, 29898, 3057, 29918, 29925, 905, 29897, 13, 1949, 29918, 1688, 29918, 1445, 353, 29871, 29896, 29900, 13, 1949, 29918, 4204, 29918, 1445, 353, 938, 29898, 1949, 29918, 1688, 847, 954, 29918, 1688, 29918, 1445, 29897, 13, 690, 29918, 1949, 353, 954, 29918, 1688, 448, 954, 29918, 1688, 29918, 1445, 334, 954, 29918, 4204, 29918, 1445, 13, 8009, 29918, 9760, 29918, 2283, 353, 954, 29918, 4204, 29918, 1445, 334, 7442, 29889, 2873, 3552, 29896, 29892, 1949, 29918, 1688, 29918, 1445, 511, 29881, 1853, 29922, 524, 29897, 13, 8009, 29918, 9760, 29918, 2283, 353, 11848, 29918, 9760, 29918, 2283, 29961, 29900, 29962, 13, 8009, 29918, 9760, 29918, 2283, 29961, 1949, 29918, 1688, 29918, 1445, 29899, 29896, 29962, 353, 11848, 29918, 9760, 29918, 2283, 29961, 1949, 29918, 1688, 29918, 1445, 29899, 29896, 29962, 718, 620, 29918, 1949, 13, 2962, 353, 29871, 29900, 13, 1454, 474, 297, 3464, 29898, 1949, 29918, 1688, 29918, 1445, 1125, 13, 1678, 934, 29918, 978, 353, 525, 3057, 29918, 18717, 710, 29898, 5041, 29918, 2311, 7240, 15972, 18717, 710, 29898, 29875, 29974, 29896, 7240, 4286, 2922, 29915, 13, 1678, 1243, 29918, 8977, 3366, 1688, 29918, 5041, 3108, 353, 4321, 29918, 29925, 905, 29961, 2962, 29901, 2962, 29974, 8009, 29918, 9760, 29918, 2283, 29961, 29875, 5262, 13, 1678, 1243, 29918, 8977, 3366, 1688, 29918, 21134, 3108, 353, 4321, 29918, 4775, 29961, 2962, 29901, 2962, 29974, 8009, 29918, 9760, 29918, 2283, 29961, 29875, 1402, 17531, 13, 1678, 4560, 2272, 29889, 601, 29889, 29879, 485, 4579, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 934, 29918, 978, 511, 1688, 29918, 8977, 29897, 13, 1678, 1369, 4619, 11848, 29918, 9760, 29918, 2283, 29961, 29875, 29962, 13, 13, 13, 1753, 788, 29918, 28449, 29898, 4102, 29892, 7496, 29892, 1272, 29918, 1853, 1125, 13, 1678, 565, 848, 29918, 1853, 1275, 525, 14968, 2396, 13, 4706, 5694, 29918, 3027, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 4102, 1839, 14968, 29918, 5041, 7464, 7496, 1839, 14968, 29918, 5041, 2033, 511, 8990, 29922, 29900, 29897, 13, 4706, 5694, 29918, 21134, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 4102, 1839, 14968, 29918, 21134, 7464, 7496, 1839, 14968, 29918, 21134, 2033, 511, 8990, 29922, 29900, 29897, 13, 4706, 422, 29890, 1312, 29918, 1272, 353, 6571, 13, 4706, 422, 29890, 1312, 29918, 1272, 1839, 14968, 29918, 5041, 2033, 353, 5694, 29918, 3027, 13, 4706, 422, 29890, 1312, 29918, 1272, 1839, 14968, 29918, 21134, 2033, 353, 5694, 29918, 21134, 13, 1678, 565, 848, 29918, 1853, 1275, 525, 1688, 2396, 13, 4706, 5694, 29918, 3027, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 4102, 1839, 1688, 29918, 5041, 7464, 7496, 1839, 1688, 29918, 5041, 2033, 511, 8990, 29922, 29900, 29897, 13, 4706, 5694, 29918, 21134, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 4102, 1839, 1688, 29918, 21134, 7464, 7496, 1839, 1688, 29918, 21134, 2033, 511, 8990, 29922, 29900, 29897, 13, 4706, 422, 29890, 1312, 29918, 1272, 353, 6571, 13, 4706, 422, 29890, 1312, 29918, 1272, 1839, 1688, 29918, 5041, 2033, 353, 5694, 29918, 3027, 13, 4706, 422, 29890, 1312, 29918, 1272, 1839, 1688, 29918, 21134, 2033, 353, 5694, 29918, 21134, 13, 1678, 736, 422, 29890, 1312, 29918, 1272, 13, 13, 1753, 349, 3445, 598, 29918, 1272, 7295, 13, 1678, 9995, 3168, 304, 19012, 26101, 322, 4321, 292, 848, 15945, 29908, 13, 1678, 363, 474, 297, 3464, 29898, 1949, 29918, 14968, 29918, 1445, 1125, 13, 4706, 934, 29918, 978, 353, 525, 5323, 262, 29918, 18717, 710, 29898, 5041, 29918, 2311, 7240, 15972, 18717, 710, 29898, 29875, 29974, 29896, 7240, 4286, 2922, 29915, 13, 4706, 848, 29918, 7224, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 934, 29918, 978, 876, 13, 4706, 565, 29898, 29875, 1360, 29900, 1125, 13, 9651, 26101, 29918, 1272, 353, 848, 29918, 7224, 13, 9651, 6773, 13, 4706, 1683, 29901, 13, 9651, 26101, 29918, 1272, 353, 788, 29918, 28449, 29898, 5323, 2827, 29918, 1272, 29892, 1272, 29918, 7224, 5501, 14968, 1495, 13, 632, 13, 1678, 363, 474, 297, 3464, 29898, 1949, 29918, 1688, 29918, 1445, 1125, 13, 4706, 934, 29918, 978, 353, 525, 3057, 29918, 18717, 710, 29898, 5041, 29918, 2311, 7240, 15972, 18717, 710, 29898, 29875, 29974, 29896, 7240, 4286, 2922, 29915, 13, 4706, 848, 29918, 7224, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 934, 29918, 978, 876, 13, 4706, 565, 29898, 29875, 1360, 29900, 1125, 13, 9651, 4321, 29918, 1272, 353, 848, 29918, 7224, 13, 9651, 6773, 13, 4706, 1683, 29901, 13, 9651, 4321, 29918, 1272, 353, 788, 29918, 28449, 29898, 3057, 29918, 1272, 29892, 1272, 29918, 7224, 5501, 1688, 1495, 13, 1678, 736, 26101, 29918, 1272, 29892, 4321, 29918, 1272, 13, 13, 5323, 2827, 29918, 1272, 29892, 4321, 29918, 1272, 353, 349, 3445, 598, 29918, 1272, 580, 13, 259, 13, 2158, 877, 5323, 2827, 3630, 29901, 1495, 13, 2158, 29898, 5323, 2827, 29918, 1272, 1839, 14968, 29918, 5041, 13359, 12181, 29897, 13, 2158, 877, 3057, 3630, 29901, 1495, 13, 2158, 29898, 3057, 29918, 1272, 1839, 1688, 29918, 5041, 13359, 12181, 29897, 13, 13, 29937, 3630, 6991, 5219, 13, 2176, 353, 10518, 29889, 17271, 29898, 9302, 29889, 8172, 29889, 9502, 29876, 29898, 8009, 29918, 27403, 29892, 29871, 29946, 511, 13, 462, 29871, 4341, 29922, 1839, 11536, 742, 525, 5323, 2827, 742, 525, 3267, 29987, 29909, 688, 742, 525, 3057, 292, 11287, 13, 2176, 1839, 11536, 2033, 353, 11848, 29918, 9760, 29918, 2385, 13, 2176, 1839, 5323, 2827, 2033, 353, 11848, 29918, 5323, 262, 29918, 9760, 29918, 2385, 13, 2176, 1839, 3267, 29987, 29909, 688, 2033, 353, 6570, 29918, 29909, 688, 29918, 8009, 29918, 5323, 2827, 29918, 9760, 13, 2176, 1839, 3057, 292, 2033, 353, 11848, 29918, 3057, 29918, 9760, 29918, 2385, 13, 2158, 703, 9166, 9166, 9166, 9166, 2751, 1360, 543, 29897, 13, 2158, 703, 1469, 6991, 5219, 1159, 13, 2158, 703, 9166, 9166, 9166, 9166, 2751, 1360, 543, 29897, 13, 2158, 877, 1576, 2159, 310, 278, 2441, 379, 5425, 848, 338, 313, 29995, 29881, 24163, 29881, 24163, 29881, 16029, 29995, 29898, 7011, 29892, 6110, 29892, 29933, 392, 876, 13, 2158, 877, 1576, 2159, 310, 26101, 848, 338, 313, 29995, 29881, 16029, 29995, 29898, 1949, 29918, 14968, 876, 13, 2158, 877, 1576, 2159, 310, 4321, 848, 338, 313, 29995, 29881, 16029, 29995, 29898, 1949, 29918, 1688, 876, 13, 2158, 877, 1576, 2159, 310, 1269, 4559, 338, 313, 29995, 29881, 24163, 29881, 24163, 29881, 16029, 29995, 29898, 29933, 392, 29892, 5041, 29918, 2311, 29892, 5041, 29918, 2311, 876, 13, 2158, 877, 2683, 2683, 2683, 2683, 26589, 1495, 13, 2158, 703, 1576, 3630, 7946, 338, 1159, 13, 2158, 29898, 2176, 29897, 13, 19708, 29918, 2230, 353, 931, 29889, 2230, 580, 448, 1369, 29918, 2230, 13, 2158, 703, 9166, 9166, 9166, 9166, 2751, 1360, 543, 29897, 13, 2158, 877, 1469, 4721, 862, 362, 338, 15642, 9446, 29991, 313, 3112, 4893, 18695, 29945, 29888, 6923, 16029, 29995, 29898, 19708, 29918, 2230, 876, 13, 2158, 703, 9166, 9166, 9166, 9166, 2751, 1360, 543, 29897, 13, 13, 1753, 2254, 29918, 2248, 29918, 1272, 7295, 13, 1678, 848, 29918, 2084, 353, 2897, 29889, 657, 29883, 9970, 580, 13, 1678, 7945, 29918, 2248, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 525, 5323, 262, 3220, 29889, 2922, 8785, 1839, 5323, 262, 3220, 2033, 13, 1678, 1243, 29918, 2248, 353, 4560, 2272, 29889, 601, 29889, 1359, 2922, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1272, 29918, 2084, 29892, 525, 3057, 3220, 29889, 2922, 8785, 1839, 3057, 3220, 2033, 13, 1678, 7945, 29918, 2248, 353, 7945, 29918, 2248, 29961, 29900, 29962, 13, 1678, 1243, 29918, 2248, 353, 1243, 29918, 2248, 29961, 29900, 29962, 268, 13, 13, 1678, 28186, 1469, 353, 6571, 13, 1678, 28186, 1469, 1839, 14968, 29918, 5041, 2033, 29871, 353, 7442, 29889, 2378, 4197, 3596, 29918, 1272, 1839, 5041, 2033, 29961, 29875, 29962, 363, 474, 297, 7945, 29918, 2248, 2314, 13, 1678, 28186, 4775, 353, 518, 3596, 29918, 1272, 1839, 21134, 2033, 29961, 29875, 29962, 363, 474, 297, 7945, 29918, 2248, 29962, 13, 1678, 28186, 4775, 353, 7442, 29889, 2378, 29898, 5323, 262, 4775, 29897, 13, 1678, 28186, 4775, 353, 3588, 1762, 6716, 28917, 29898, 5323, 262, 4775, 29899, 29896, 29892, 1949, 29918, 13203, 29922, 8009, 29918, 27403, 29897, 13, 1678, 28186, 1469, 1839, 14968, 29918, 21134, 2033, 29871, 353, 28186, 4775, 13, 13, 1678, 4321, 1469, 353, 6571, 13, 1678, 4321, 1469, 1839, 1688, 29918, 5041, 2033, 29871, 353, 7442, 29889, 2378, 4197, 3596, 29918, 1272, 1839, 5041, 2033, 29961, 29875, 29962, 363, 474, 297, 1243, 29918, 2248, 2314, 13, 1678, 4321, 4775, 353, 518, 3596, 29918, 1272, 1839, 21134, 2033, 29961, 29875, 29962, 363, 474, 297, 1243, 29918, 2248, 29962, 13, 1678, 4321, 4775, 353, 7442, 29889, 2378, 29898, 3057, 4775, 29897, 13, 1678, 4321, 4775, 353, 3588, 1762, 6716, 28917, 29898, 3057, 4775, 29899, 29896, 29892, 1949, 29918, 13203, 29922, 8009, 29918, 27403, 29897, 13, 1678, 4321, 1469, 1839, 1688, 29918, 21134, 2033, 29871, 353, 4321, 4775, 13, 1678, 736, 28186, 1469, 29892, 4321, 1469, 29892, 7945, 29918, 2248, 29892, 1243, 29918, 2248, 2 ]
harpoon/src/plugins/Selfroles/functions/SetupAddSelfrole.py
xezzz/Harpoon
0
102027
async def setupAddSelfrole(plugin, ctx, name, role, roles): role_id = role.id name = name.lower() if role_id in [roles[x] for x in roles] or name in roles: return await ctx.send(plugin.t(ctx.guild, "already_selfrole", _emote="WARN")) if role.position >= ctx.guild.me.top_role.position: return await ctx.send(plugin.t(ctx.guild, "role_too_high", _emote="WARN")) if role == ctx.guild.default_role: return await ctx.send(plugin.t(ctx.guild, "default_role_forbidden", _emote="WARN")) roles[name] = str(role_id) plugin.db.configs.update(ctx.guild.id, "selfroles", roles) await ctx.send(plugin.t(ctx.guild, "selfrole_added", _emote="YES", role=role.name, name=name, prefix=plugin.bot.get_guild_prefix(ctx.guild)))
[ 1, 29871, 13, 13, 13, 12674, 822, 6230, 2528, 24313, 12154, 29898, 8582, 29892, 12893, 29892, 1024, 29892, 6297, 29892, 16178, 1125, 13, 1678, 6297, 29918, 333, 353, 6297, 29889, 333, 13, 1678, 1024, 353, 1024, 29889, 13609, 580, 13, 1678, 565, 6297, 29918, 333, 297, 518, 307, 793, 29961, 29916, 29962, 363, 921, 297, 16178, 29962, 470, 1024, 297, 16178, 29901, 13, 4706, 736, 7272, 12893, 29889, 6717, 29898, 8582, 29889, 29873, 29898, 13073, 29889, 2543, 789, 29892, 376, 284, 2040, 29918, 1311, 12154, 613, 903, 331, 866, 543, 29956, 15249, 5783, 13, 13, 1678, 565, 6297, 29889, 3283, 6736, 12893, 29889, 2543, 789, 29889, 1004, 29889, 3332, 29918, 12154, 29889, 3283, 29901, 13, 4706, 736, 7272, 12893, 29889, 6717, 29898, 8582, 29889, 29873, 29898, 13073, 29889, 2543, 789, 29892, 376, 12154, 29918, 517, 29877, 29918, 9812, 613, 903, 331, 866, 543, 29956, 15249, 5783, 13, 13, 1678, 565, 6297, 1275, 12893, 29889, 2543, 789, 29889, 4381, 29918, 12154, 29901, 13, 4706, 736, 7272, 12893, 29889, 6717, 29898, 8582, 29889, 29873, 29898, 13073, 29889, 2543, 789, 29892, 376, 4381, 29918, 12154, 29918, 1454, 29890, 4215, 613, 903, 331, 866, 543, 29956, 15249, 5783, 13, 13, 1678, 16178, 29961, 978, 29962, 353, 851, 29898, 12154, 29918, 333, 29897, 13, 1678, 7079, 29889, 2585, 29889, 2917, 29879, 29889, 5504, 29898, 13073, 29889, 2543, 789, 29889, 333, 29892, 376, 1311, 307, 793, 613, 16178, 29897, 13, 1678, 7272, 12893, 29889, 6717, 29898, 8582, 29889, 29873, 29898, 13073, 29889, 2543, 789, 29892, 376, 1311, 12154, 29918, 23959, 613, 903, 331, 866, 543, 21143, 613, 6297, 29922, 12154, 29889, 978, 29892, 1024, 29922, 978, 29892, 10944, 29922, 8582, 29889, 7451, 29889, 657, 29918, 2543, 789, 29918, 13506, 29898, 13073, 29889, 2543, 789, 4961, 2 ]
pyaz/sf/managed_application/__init__.py
py-az-cli/py-az-cli
0
1600985
from ... pyaz_utils import _call_az def list(cluster_name, resource_group): ''' List managed applications of a given managed cluster. Required Parameters: - cluster_name -- Specify the name of the cluster, if not given it will be same as resource group name - resource_group -- Specify the resource group name. You can configure the default group using `az configure --defaults group=<name>` ''' return _call_az("az sf managed-application list", locals()) def delete(cluster_name, name, resource_group): ''' Delete a managed application. Required Parameters: - cluster_name -- Specify the name of the cluster, if not given it will be same as resource group name - name -- Specify the application name. - resource_group -- Specify the resource group name. You can configure the default group using `az configure --defaults group=<name>` ''' return _call_az("az sf managed-application delete", locals()) def show(cluster_name, name, resource_group): ''' Show the properties of a managed application on an Azure Service Fabric managed cluster. Required Parameters: - cluster_name -- Specify the name of the cluster, if not given it will be same as resource group name - name -- Specify the application name. - resource_group -- Specify the resource group name. You can configure the default group using `az configure --defaults group=<name>` ''' return _call_az("az sf managed-application show", locals()) def create(cluster_name, name, resource_group, type_name, version, package_url=None, parameters=None, tags=None): ''' Create a new managed application on an Azure Service Fabric managed cluster. Required Parameters: - cluster_name -- Specify the name of the cluster, if not given it will be same as resource group name - name -- Specify the application name. - resource_group -- Specify the resource group name. You can configure the default group using `az configure --defaults group=<name>` - type_name -- Specify the application type name. - version -- Specify the application type version. Optional Parameters: - package_url -- Specify the url of the application package sfpkg file. - parameters -- Specify the application parameters as key/value pairs. These parameters must exist in the application manifest. for example: --application-parameters param1=value1 param2=value2 - tags -- space-separated tags: key[=value] [key[=value] ...]. Use '' to clear existing tags. ''' return _call_az("az sf managed-application create", locals()) def update(cluster_name, name, resource_group, failure_action=None, force_restart=None, hc_retry_timeout=None, hc_stable_duration=None, hc_wait_duration=None, instance_close_delay_duration=None, max_percent_unhealthy_deployed_applications=None, max_percent_unhealthy_partitions=None, max_percent_unhealthy_replicas=None, max_percent_unhealthy_services=None, parameters=None, recreate_application=None, service_type_health_policy_map=None, tags=None, ud_timeout=None, upgrade_mode=None, upgrade_replica_set_check_timeout=None, upgrade_timeout=None, version=None, warning_as_error=None): ''' Update a Azure Service Fabric managed application. Required Parameters: - cluster_name -- Specify the name of the cluster, if not given it will be same as resource group name - name -- Specify the application name. - resource_group -- Specify the resource group name. You can configure the default group using `az configure --defaults group=<name>` Optional Parameters: - failure_action -- Specify the action to take if the monitored upgrade fails. The acceptable values for this parameter are Rollback or Manual. - force_restart -- Indicates that the service host restarts even if the upgrade is a configuration-only change. - hc_retry_timeout -- Specify the duration, in seconds, after which Service Fabric retries the health check if the previous health check fails. - hc_stable_duration -- Specify the duration, in seconds, that Service Fabric waits in order to verify that the application is stable before moving to the next upgrade domain or completing the upgrade. This wait duration prevents undetected changes of health right after the health check is performed. - hc_wait_duration -- Specify the duration, in seconds, that Service Fabric waits before it performs the initial health check after it finishes the upgrade on the upgrade domain. - instance_close_delay_duration -- Specify the duration in seconds, to wait before a stateless instance is closed, to allow the active requests to drain gracefully. This would be effective when the instance is closing during the application/cluster upgrade, only for those instances which have a non-zero delay duration configured in the service description. - max_percent_unhealthy_deployed_applications -- Specify the maximum percentage of the application instances deployed on the nodes in the cluster that have a health state of error before the application health state for the cluster is error. Allowed values are form 0 to 100. - max_percent_unhealthy_partitions -- Specify the maximum percent of unhelthy partitions per service allowed by the health policy for the default service type to use for the monitored upgrade. Allowed values are from 0 to 100. - max_percent_unhealthy_replicas -- Specify the maximum percent of unhelthy replicas per service allowed by the health policy for the default service type to use for the monitored upgrade. Allowed values are from 0 to 100. - max_percent_unhealthy_services -- Specify the maximum percent of unhelthy services allowed by the health policy for the default service type to use for the monitored upgrade. Allowed values are from 0 to 100. - parameters -- Specify the application parameters as key/value pairs. These parameters must exist in the application manifest. for example: --application-parameters param1=value1 param2=value2 - recreate_application -- Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed. - service_type_health_policy_map -- Specify the map of the health policy to use for different service types as key/value pairs in the following format: "ServiceTypeName"="MaxPercentUnhealthyPartitionsPerService,MaxPercentUnhealthyReplicasPerPartition,MaxPercentUnhealthyServices". for example: --service-type-health-policy-map "ServiceTypeName01"="5,10,5" "ServiceTypeName02"="5,5,5" - tags -- space-separated tags: key[=value] [key[=value] ...]. Use '' to clear existing tags. - ud_timeout -- Specify the maximum time, in seconds, that Service Fabric takes to upgrade a single upgrade domain. After this period, the upgrade fails. - upgrade_mode -- Specify the mode used to monitor health during a rolling upgrade. The values are Monitored, and UnmonitoredAuto. - upgrade_replica_set_check_timeout -- Specify the maximum time, in seconds, that Service Fabric waits for a service to reconfigure into a safe state, if not already in a safe state, before Service Fabric proceeds with the upgrade. - upgrade_timeout -- Specify the maximum time, in seconds, that Service Fabric takes for the entire upgrade. After this period, the upgrade fails. - version -- Specify the application type version. - warning_as_error -- Indicates whether to treat a warning health event as an error event during health evaluation. ''' return _call_az("az sf managed-application update", locals())
[ 1, 515, 2023, 11451, 834, 29918, 13239, 1053, 903, 4804, 29918, 834, 13, 13, 1753, 1051, 29898, 19594, 29918, 978, 29892, 6503, 29918, 2972, 1125, 13, 1678, 14550, 13, 1678, 2391, 8745, 8324, 310, 263, 2183, 8745, 9867, 29889, 13, 13, 1678, 830, 5958, 12662, 2699, 29901, 13, 1678, 448, 9867, 29918, 978, 1192, 12048, 1598, 278, 1024, 310, 278, 9867, 29892, 565, 451, 2183, 372, 674, 367, 1021, 408, 6503, 2318, 1024, 13, 1678, 448, 6503, 29918, 2972, 1192, 12048, 1598, 278, 6503, 2318, 1024, 29889, 887, 508, 10822, 278, 2322, 2318, 773, 421, 834, 10822, 1192, 4381, 29879, 2318, 29922, 29966, 978, 13885, 13, 1678, 14550, 13, 1678, 736, 903, 4804, 29918, 834, 703, 834, 18668, 8745, 29899, 6214, 1051, 613, 1180, 1338, 3101, 13, 13, 13, 1753, 5217, 29898, 19594, 29918, 978, 29892, 1024, 29892, 6503, 29918, 2972, 1125, 13, 1678, 14550, 13, 1678, 21267, 263, 8745, 2280, 29889, 13, 13, 1678, 830, 5958, 12662, 2699, 29901, 13, 1678, 448, 9867, 29918, 978, 1192, 12048, 1598, 278, 1024, 310, 278, 9867, 29892, 565, 451, 2183, 372, 674, 367, 1021, 408, 6503, 2318, 1024, 13, 1678, 448, 1024, 1192, 12048, 1598, 278, 2280, 1024, 29889, 13, 1678, 448, 6503, 29918, 2972, 1192, 12048, 1598, 278, 6503, 2318, 1024, 29889, 887, 508, 10822, 278, 2322, 2318, 773, 421, 834, 10822, 1192, 4381, 29879, 2318, 29922, 29966, 978, 13885, 13, 1678, 14550, 13, 1678, 736, 903, 4804, 29918, 834, 703, 834, 18668, 8745, 29899, 6214, 5217, 613, 1180, 1338, 3101, 13, 13, 13, 1753, 1510, 29898, 19594, 29918, 978, 29892, 1024, 29892, 6503, 29918, 2972, 1125, 13, 1678, 14550, 13, 1678, 7704, 278, 4426, 310, 263, 8745, 2280, 373, 385, 12634, 6692, 10629, 2200, 8745, 9867, 29889, 13, 13, 1678, 830, 5958, 12662, 2699, 29901, 13, 1678, 448, 9867, 29918, 978, 1192, 12048, 1598, 278, 1024, 310, 278, 9867, 29892, 565, 451, 2183, 372, 674, 367, 1021, 408, 6503, 2318, 1024, 13, 1678, 448, 1024, 1192, 12048, 1598, 278, 2280, 1024, 29889, 13, 1678, 448, 6503, 29918, 2972, 1192, 12048, 1598, 278, 6503, 2318, 1024, 29889, 887, 508, 10822, 278, 2322, 2318, 773, 421, 834, 10822, 1192, 4381, 29879, 2318, 29922, 29966, 978, 13885, 13, 1678, 14550, 13, 1678, 736, 903, 4804, 29918, 834, 703, 834, 18668, 8745, 29899, 6214, 1510, 613, 1180, 1338, 3101, 13, 13, 13, 1753, 1653, 29898, 19594, 29918, 978, 29892, 1024, 29892, 6503, 29918, 2972, 29892, 1134, 29918, 978, 29892, 1873, 29892, 3577, 29918, 2271, 29922, 8516, 29892, 4128, 29922, 8516, 29892, 8282, 29922, 8516, 1125, 13, 1678, 14550, 13, 1678, 6204, 263, 716, 8745, 2280, 373, 385, 12634, 6692, 10629, 2200, 8745, 9867, 29889, 13, 13, 1678, 830, 5958, 12662, 2699, 29901, 13, 1678, 448, 9867, 29918, 978, 1192, 12048, 1598, 278, 1024, 310, 278, 9867, 29892, 565, 451, 2183, 372, 674, 367, 1021, 408, 6503, 2318, 1024, 13, 1678, 448, 1024, 1192, 12048, 1598, 278, 2280, 1024, 29889, 13, 1678, 448, 6503, 29918, 2972, 1192, 12048, 1598, 278, 6503, 2318, 1024, 29889, 887, 508, 10822, 278, 2322, 2318, 773, 421, 834, 10822, 1192, 4381, 29879, 2318, 29922, 29966, 978, 13885, 13, 1678, 448, 1134, 29918, 978, 1192, 12048, 1598, 278, 2280, 1134, 1024, 29889, 13, 1678, 448, 1873, 1192, 12048, 1598, 278, 2280, 1134, 1873, 29889, 13, 13, 1678, 28379, 12662, 2699, 29901, 13, 1678, 448, 3577, 29918, 2271, 1192, 12048, 1598, 278, 3142, 310, 278, 2280, 3577, 18668, 15865, 934, 29889, 13, 1678, 448, 4128, 1192, 12048, 1598, 278, 2280, 4128, 408, 1820, 29914, 1767, 11000, 29889, 4525, 4128, 1818, 1863, 297, 278, 2280, 10419, 29889, 363, 1342, 29901, 1192, 6214, 29899, 16744, 1828, 29896, 29922, 1767, 29896, 1828, 29906, 29922, 1767, 29906, 13, 1678, 448, 8282, 1192, 2913, 29899, 25048, 630, 8282, 29901, 1820, 29961, 29922, 1767, 29962, 518, 1989, 29961, 29922, 1767, 29962, 2023, 1822, 4803, 6629, 304, 2821, 5923, 8282, 29889, 13, 1678, 14550, 13, 1678, 736, 903, 4804, 29918, 834, 703, 834, 18668, 8745, 29899, 6214, 1653, 613, 1180, 1338, 3101, 13, 13, 13, 1753, 2767, 29898, 19594, 29918, 978, 29892, 1024, 29892, 6503, 29918, 2972, 29892, 10672, 29918, 2467, 29922, 8516, 29892, 4889, 29918, 5060, 442, 29922, 8516, 29892, 298, 29883, 29918, 276, 2202, 29918, 15619, 29922, 8516, 29892, 298, 29883, 29918, 13844, 29918, 19708, 29922, 8516, 29892, 298, 29883, 29918, 10685, 29918, 19708, 29922, 8516, 29892, 2777, 29918, 5358, 29918, 18829, 29918, 19708, 29922, 8516, 29892, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 16519, 287, 29918, 932, 5795, 29922, 8516, 29892, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 1595, 2187, 29922, 8516, 29892, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 3445, 506, 294, 29922, 8516, 29892, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 9916, 29922, 8516, 29892, 4128, 29922, 8516, 29892, 337, 3258, 29918, 6214, 29922, 8516, 29892, 2669, 29918, 1853, 29918, 354, 4298, 29918, 22197, 29918, 1958, 29922, 8516, 29892, 8282, 29922, 8516, 29892, 11430, 29918, 15619, 29922, 8516, 29892, 14955, 29918, 8513, 29922, 8516, 29892, 14955, 29918, 3445, 10123, 29918, 842, 29918, 3198, 29918, 15619, 29922, 8516, 29892, 14955, 29918, 15619, 29922, 8516, 29892, 1873, 29922, 8516, 29892, 9177, 29918, 294, 29918, 2704, 29922, 8516, 1125, 13, 1678, 14550, 13, 1678, 10318, 263, 12634, 6692, 10629, 2200, 8745, 2280, 29889, 13, 13, 1678, 830, 5958, 12662, 2699, 29901, 13, 1678, 448, 9867, 29918, 978, 1192, 12048, 1598, 278, 1024, 310, 278, 9867, 29892, 565, 451, 2183, 372, 674, 367, 1021, 408, 6503, 2318, 1024, 13, 1678, 448, 1024, 1192, 12048, 1598, 278, 2280, 1024, 29889, 13, 1678, 448, 6503, 29918, 2972, 1192, 12048, 1598, 278, 6503, 2318, 1024, 29889, 887, 508, 10822, 278, 2322, 2318, 773, 421, 834, 10822, 1192, 4381, 29879, 2318, 29922, 29966, 978, 13885, 13, 13, 1678, 28379, 12662, 2699, 29901, 13, 1678, 448, 10672, 29918, 2467, 1192, 12048, 1598, 278, 3158, 304, 2125, 565, 278, 11819, 287, 14955, 8465, 29889, 450, 22691, 1819, 363, 445, 3443, 526, 21809, 1627, 470, 2315, 950, 29889, 13, 1678, 448, 4889, 29918, 5060, 442, 1192, 1894, 293, 1078, 393, 278, 2669, 3495, 1791, 5708, 1584, 565, 278, 14955, 338, 263, 5285, 29899, 6194, 1735, 29889, 13, 1678, 448, 298, 29883, 29918, 276, 2202, 29918, 15619, 1192, 12048, 1598, 278, 14385, 29892, 297, 6923, 29892, 1156, 607, 6692, 10629, 2200, 3240, 2722, 278, 9045, 1423, 565, 278, 3517, 9045, 1423, 8465, 29889, 13, 1678, 448, 298, 29883, 29918, 13844, 29918, 19708, 1192, 12048, 1598, 278, 14385, 29892, 297, 6923, 29892, 393, 6692, 10629, 2200, 11324, 1169, 297, 1797, 304, 11539, 393, 278, 2280, 338, 13714, 1434, 8401, 304, 278, 2446, 14955, 5354, 470, 1614, 1259, 278, 14955, 29889, 910, 4480, 14385, 28057, 563, 300, 26458, 3620, 310, 9045, 1492, 1156, 278, 9045, 1423, 338, 8560, 29889, 13, 1678, 448, 298, 29883, 29918, 10685, 29918, 19708, 1192, 12048, 1598, 278, 14385, 29892, 297, 6923, 29892, 393, 6692, 10629, 2200, 11324, 1169, 1434, 372, 23233, 278, 2847, 9045, 1423, 1156, 372, 8341, 267, 278, 14955, 373, 278, 14955, 5354, 29889, 13, 1678, 448, 2777, 29918, 5358, 29918, 18829, 29918, 19708, 1192, 12048, 1598, 278, 14385, 297, 6923, 29892, 304, 4480, 1434, 263, 1002, 6393, 2777, 338, 5764, 29892, 304, 2758, 278, 6136, 7274, 304, 270, 6038, 17659, 3730, 29889, 910, 723, 367, 11828, 746, 278, 2777, 338, 14382, 2645, 278, 2280, 29914, 19594, 14955, 29892, 871, 363, 1906, 8871, 607, 505, 263, 1661, 29899, 9171, 9055, 14385, 13252, 297, 278, 2669, 6139, 29889, 13, 1678, 448, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 16519, 287, 29918, 932, 5795, 1192, 12048, 1598, 278, 7472, 19649, 310, 278, 2280, 8871, 21168, 373, 278, 7573, 297, 278, 9867, 393, 505, 263, 9045, 2106, 310, 1059, 1434, 278, 2280, 9045, 2106, 363, 278, 9867, 338, 1059, 29889, 2178, 20937, 1819, 526, 883, 29871, 29900, 304, 29871, 29896, 29900, 29900, 29889, 13, 1678, 448, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 1595, 2187, 1192, 12048, 1598, 278, 7472, 10151, 310, 443, 3952, 21155, 23629, 639, 2669, 6068, 491, 278, 9045, 8898, 363, 278, 2322, 2669, 1134, 304, 671, 363, 278, 11819, 287, 14955, 29889, 2178, 20937, 1819, 526, 515, 29871, 29900, 304, 29871, 29896, 29900, 29900, 29889, 13, 1678, 448, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 3445, 506, 294, 1192, 12048, 1598, 278, 7472, 10151, 310, 443, 3952, 21155, 1634, 506, 294, 639, 2669, 6068, 491, 278, 9045, 8898, 363, 278, 2322, 2669, 1134, 304, 671, 363, 278, 11819, 287, 14955, 29889, 2178, 20937, 1819, 526, 515, 29871, 29900, 304, 29871, 29896, 29900, 29900, 29889, 13, 1678, 448, 4236, 29918, 25376, 29918, 348, 354, 4298, 29891, 29918, 9916, 1192, 12048, 1598, 278, 7472, 10151, 310, 443, 3952, 21155, 5786, 6068, 491, 278, 9045, 8898, 363, 278, 2322, 2669, 1134, 304, 671, 363, 278, 11819, 287, 14955, 29889, 2178, 20937, 1819, 526, 515, 29871, 29900, 304, 29871, 29896, 29900, 29900, 29889, 13, 1678, 448, 4128, 1192, 12048, 1598, 278, 2280, 4128, 408, 1820, 29914, 1767, 11000, 29889, 4525, 4128, 1818, 1863, 297, 278, 2280, 10419, 29889, 363, 1342, 29901, 1192, 6214, 29899, 16744, 1828, 29896, 29922, 1767, 29896, 1828, 29906, 29922, 1767, 29906, 13, 1678, 448, 337, 3258, 29918, 6214, 1192, 5953, 837, 1475, 3692, 278, 2280, 881, 367, 337, 11600, 373, 2767, 29889, 960, 995, 29922, 3009, 29892, 278, 1791, 310, 278, 14955, 8898, 4128, 526, 451, 6068, 29889, 13, 1678, 448, 2669, 29918, 1853, 29918, 354, 4298, 29918, 22197, 29918, 1958, 1192, 12048, 1598, 278, 2910, 310, 278, 9045, 8898, 304, 671, 363, 1422, 2669, 4072, 408, 1820, 29914, 1767, 11000, 297, 278, 1494, 3402, 29901, 376, 3170, 1542, 1170, 29908, 543, 7976, 27933, 2525, 354, 4298, 29891, 7439, 2187, 5894, 3170, 29892, 7976, 27933, 2525, 354, 4298, 29891, 5612, 506, 294, 5894, 7439, 654, 29892, 7976, 27933, 2525, 354, 4298, 29891, 13779, 1642, 363, 1342, 29901, 1192, 5509, 29899, 1853, 29899, 354, 4298, 29899, 22197, 29899, 1958, 376, 3170, 1542, 1170, 29900, 29896, 29908, 543, 29945, 29892, 29896, 29900, 29892, 29945, 29908, 376, 3170, 1542, 1170, 29900, 29906, 29908, 543, 29945, 29892, 29945, 29892, 29945, 29908, 13, 1678, 448, 8282, 1192, 2913, 29899, 25048, 630, 8282, 29901, 1820, 29961, 29922, 1767, 29962, 518, 1989, 29961, 29922, 1767, 29962, 2023, 1822, 4803, 6629, 304, 2821, 5923, 8282, 29889, 13, 1678, 448, 11430, 29918, 15619, 1192, 12048, 1598, 278, 7472, 931, 29892, 297, 6923, 29892, 393, 6692, 10629, 2200, 4893, 304, 14955, 263, 2323, 14955, 5354, 29889, 2860, 445, 3785, 29892, 278, 14955, 8465, 29889, 13, 1678, 448, 14955, 29918, 8513, 1192, 12048, 1598, 278, 4464, 1304, 304, 11819, 9045, 2645, 263, 27777, 14955, 29889, 450, 1819, 526, 2598, 2105, 287, 29892, 322, 853, 3712, 2105, 287, 12300, 29889, 13, 1678, 448, 14955, 29918, 3445, 10123, 29918, 842, 29918, 3198, 29918, 15619, 1192, 12048, 1598, 278, 7472, 931, 29892, 297, 6923, 29892, 393, 6692, 10629, 2200, 11324, 1169, 363, 263, 2669, 304, 337, 17591, 964, 263, 9109, 2106, 29892, 565, 451, 2307, 297, 263, 9109, 2106, 29892, 1434, 6692, 10629, 2200, 8469, 29879, 411, 278, 14955, 29889, 13, 1678, 448, 14955, 29918, 15619, 1192, 12048, 1598, 278, 7472, 931, 29892, 297, 6923, 29892, 393, 6692, 10629, 2200, 4893, 363, 278, 4152, 14955, 29889, 2860, 445, 3785, 29892, 278, 14955, 8465, 29889, 13, 1678, 448, 1873, 1192, 12048, 1598, 278, 2280, 1134, 1873, 29889, 13, 1678, 448, 9177, 29918, 294, 29918, 2704, 1192, 1894, 293, 1078, 3692, 304, 7539, 263, 9177, 9045, 1741, 408, 385, 1059, 1741, 2645, 9045, 17983, 29889, 13, 1678, 14550, 13, 1678, 736, 903, 4804, 29918, 834, 703, 834, 18668, 8745, 29899, 6214, 2767, 613, 1180, 1338, 3101, 13, 13, 2 ]
looking_for_group/helpdesk/views.py
andrlik/looking-for-group
0
121923
import logging from braces.views import PrefetchRelatedMixin, SelectRelatedMixin from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin from django.core.cache import cache from django.forms import modelform_factory from django.http import Http404, HttpResponseNotAllowed, HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from django.views import generic from rules.contrib.views import PermissionRequiredMixin from rules.permissions import has_perm from . import models from .backends import AuthenticationError, OperationError from .signals import issue_state_changed from .tasks import ( close_remote_issue, create_remote_comment, create_remote_issue, delete_remote_comment, delete_remote_issue, reopen_remote_issue, update_remote_comment, update_remote_issue ) from .utils import get_backend_client, reconcile_comments logger = logging.getLogger("helpdesk") # Create your views here. class IssueListView( LoginRequiredMixin, SelectRelatedMixin, PrefetchRelatedMixin, generic.ListView ): model = models.IssueLink context_object_name = "issue_list" paginate_by = 25 paginate_orphans = 2 select_related = ["creator"] prefetch_related = ["subscribers"] template_name = "helpdesk/issue_list.html" status_type = "opened" ordering = ["-created"] def dispatch(self, request, *args, **kwargs): get_dict = request.GET.copy() user_info = get_dict.pop("status", None) if user_info and user_info[0] in ["opened", "closed"]: self.status_type = user_info[0] return super().dispatch(request, *args, **kwargs) def get_queryset(self): return ( self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) .filter(cached_status=self.status_type) .order_by("-created") ) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["listmode"] = self.status_type all_issues_not_deleted = self.model.objects.exclude( sync_status__in=["delete_err", "deleted"] ) context["total_open"] = all_issues_not_deleted.filter( cached_status="opened" ).count() context["total_closed"] = all_issues_not_deleted.filter( cached_status="closed" ).count() context["your_open"] = all_issues_not_deleted.filter( creator=self.request.user, cached_status="opened" ).count() context["your_closed"] = all_issues_not_deleted.filter( creator=self.request.user, cached_status="closed" ).count() return context class MyIssueListView(IssueListView): def get_queryset(self): return super().get_queryset().filter(creator=self.request.user) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["listmode"] = "my{}".format(self.status_type) return context class IssueCreateView(LoginRequiredMixin, generic.CreateView): model = models.IssueLink fields = ["cached_title", "cached_description"] template_name = "helpdesk/issue_create.html" def form_valid(self, form): il = form.save(commit=False) il.creator = self.request.user il.save() create_remote_issue(il) il.refresh_from_db() if il.sync_status != "sync": messages.error( self.request, _( "We weren't able to reach the helpdesk backend. We will attempt to finish creating this issue later. No futher action is required on your part." ), ) return HttpResponseRedirect(il.get_absolute_url()) class IssueDetailView( LoginRequiredMixin, SelectRelatedMixin, PrefetchRelatedMixin, generic.DetailView ): """ Detail view for an issue. """ model = models.IssueLink context_object_name = "issue" select_related = ["creator"] prefetch_related = ["comments"] template_name = "helpdesk/issue_detail.html" slug_url_kwarg = "ext_id" slug_field = "external_id" def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) gl = get_backend_client() context["comment_form"] = modelform_factory( models.IssueCommentLink, fields=["cached_body"] ) try: context["gl_issue"] = cache.get_or_set( "helpdesk-{}", gl.get_issue(context["issue"].external_id), 20 ) context["reconciled_comments"] = cache.get_or_set( "helpdesk-{}-reconciled-comments".format(context["gl_issue"].iid), reconcile_comments(context["issue"]), ) except AuthenticationError: logger.error( "Authentication to gitlab failed! Falling back to cached values." ) except OperationError as oe: logger.error( "There was an error retrieving the gitlab data. Falling back to cached values. Error message was: {}".format( str(oe) ) ) return context def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssuePendingDetailView( LoginRequiredMixin, PermissionRequiredMixin, SelectRelatedMixin, generic.DetailView ): """ Detail view for a pending issue (not yet created in backend.) """ model = models.IssueLink pk_url_kwarg = "pk" context_object_name = "issue" template_name = "helpdesk/issue_pending_detail.html" select_related = ["creator"] permission_required = "helpdesk.edit_issue" def dispatch(self, request, *args, **kwargs): obj = self.get_object() if obj.sync_status == "sync" and obj.external_id: return HttpResponseRedirect(obj.get_absolute_url()) return super().dispatch(request, *args, **kwargs) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueUpdateView( LoginRequiredMixin, PermissionRequiredMixin, generic.edit.UpdateView ): model = models.IssueLink slug_field = "external_id" slug_url_kwarg = "ext_id" permission_required = "helpdesk.edit_issue" context_object_name = "issue" template_name = "helpdesk/issue_update.html" fields = ["cached_title", "cached_description"] def dispatch(self, request, *args, **kwargs): obj = self.get_object() if obj.sync_status != "sync": messages.info( request, _( "This item is still pending sync with our issue tracking system and cannot currently be edited." ), ) return HttpResponseRedirect(obj.get_absolute_url) return super().dispatch(request, *args, **kwargs) def form_valid(self, form): il = form.save() update_remote_issue(il) il.refresh_from_db() if il.sync_status != "sync": messages.info( self.request, _( "We have updated the record, but it is still awaiting an update on the backend. No further action is required on your part." ), ) return HttpResponseRedirect(il.get_absolute_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueDeleteView( LoginRequiredMixin, PermissionRequiredMixin, generic.edit.DeleteView ): model = models.IssueLink slug_url_kwarg = "ext_id" slug_field = "external_id" permission_required = "helpdesk.delete_issue" context_object_name = "issue" template_name = "helpdesk/issue_delete.html" def delete(self, request, *args, **kwargs): obj = self.get_object() delete_remote_issue(obj) obj.refresh_from_db() if obj.sync_status == "deleted": obj.delete() messages.success(request, _("Your issue is successfully deleted.")) else: messages.success(request, _("Your issue has been queued for deletion.")) return HttpResponseRedirect(reverse_lazy("helpdesk:issue-list")) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueSubscribeView(LoginRequiredMixin, generic.edit.UpdateView): model = models.IssueLink slug_field = "external_id" slug_url_kwarg = "ext_id" context_object_name = "issue" fields = [] def dispatch(self, request, *args, **kwargs): if request.method.lower() not in ["post"]: return HttpResponseNotAllowed(["POST"]) return super().dispatch(request, *args, **kwargs) def form_valid(self, form): obj = self.get_object() obj.subscribers.add(self.request.user) messages.success( self.request, _("You are now subscribed to updates on this issue.") ) return HttpResponseRedirect(obj.get_absolute_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueUnsubscribeView(IssueSubscribeView): def form_valid(self, form): obj = self.get_object() obj.subscribers.remove(self.request.user) messages.success( self.request, _("You are no longer subscribed to updates on this issue.") ) return HttpResponseRedirect(obj.get_absolute_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueCloseView( LoginRequiredMixin, PermissionRequiredMixin, generic.edit.UpdateView ): model = models.IssueLink slug_field = "external_id" slug_url_kwarg = "ext_id" permission_required = "helpdesk.close_issue" # Add a form here fields = [] def dispatch(self, request, *args, **kwargs): if request.method.lower() not in ["post"]: return HttpResponseNotAllowed(["POST"]) return super().dispatch(request, *args, **kwargs) def form_valid(self, form): obj = self.get_object() close_remote_issue(obj) obj.status = "closed" obj.save() messages.success(self.request, _("Issue has been closed.")) issue_state_changed.send( obj, issue=obj, user=self.request.user, old_status="opened", new_status="closed", ) return HttpResponseRedirect(obj.get_absolute_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueReopenView( LoginRequiredMixin, PermissionRequiredMixin, generic.edit.UpdateView ): model = models.IssueLink slug_url_kwarg = "ext_id" slug_field = "external_id" permission_required = "helpdesk.reopen_issue" fields = [] def dispatch(self, request, *args, **kwargs): if request.method.lower() not in ["post"]: return HttpResponseNotAllowed(["POST"]) return super().dispatch(request, *args, **kwargs) def form_valid(self, form): obj = self.get_object() obj.status = "opened" obj.save() reopen_remote_issue(obj) messages.success(self.request, _("This issue has been reopened.")) issue_state_changed.send( obj, issue=obj, user=self.request.user, old_status="closed", new_status="opened", ) return HttpResponseRedirect(obj.get_absolute_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueCommentCreateView(LoginRequiredMixin, generic.CreateView): model = models.IssueCommentLink fields = ["cached_body"] template_name = "helpdesk/comment_create.html" master_issue = None def dispatch(self, request, *args, **kwargs): issue_id = kwargs.pop("ext_id", None) self.master_issue = get_object_or_404(models.IssueLink, external_id=issue_id) return super().dispatch(request, *args, **kwargs) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["issue"] = self.master_issue return context def form_valid(self, form): obj = form.save(commit=False) obj.creator = self.request.user obj.master_issue = self.master_issue obj.save() create_remote_comment(obj) if "close_issue" in self.request.POST.keys(): logger.debug( "Request to add comment also includes request to close issue. Checking permissions..." ) if has_perm("helpdesk.close_issue", self.request.user, self.master_issue): logger.debug("User has permissions. Closing the remote issue...") close_remote_issue(self.master_issue) logger.debug("Issue was closed. Refreshing the object from the DB") obj.refresh_from_db() else: logger.debug("User did not have the correct permissions...") messages.error( self.request, _("You do not have the necessary rights to close this issue."), ) if obj.sync_status != "sync": messages.info(self.request, _("Your comment has been queued for creation.")) else: messages.success(self.request, _("Your comment has been added.")) self.master_issue.refresh_from_db() if self.master_issue.cached_status == "closed": if self.master_issue.sync_status != "sync": messages.info(self.request, _("Issue has been queued for closing.")) else: messages.success(self.request, _("Issue has been closed.")) issue_state_changed.send( obj, issue=obj.master_issue, user=self.request.user, old_status="opened", new_status="closed", ) self.master_issue.subscribers.add( self.request.user ) # Subscribe them to updates. return HttpResponseRedirect(obj.master_issue.get_absolute_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueCommentUpdateView( LoginRequiredMixin, PermissionRequiredMixin, SelectRelatedMixin, generic.edit.UpdateView, ): model = models.IssueCommentLink fields = ["cached_body"] template_name = "helpdesk/comment_update.html" select_related = ["creator", "master_issue"] master_issue = None slug_field = "external_id" slug_url_kwarg = "cext_id" permission_required = "helpdesk.edit_comment" context_object_name = "comment" def dispatch(self, request, *args, **kwargs): issue_id = kwargs.pop("ext_id", None) self.master_issue = get_object_or_404(models.IssueLink, external_id=issue_id) if self.master_issue != self.get_object().master_issue: raise Http404 return super().dispatch(request, *args, **kwargs) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["issue"] = self.master_issue return context def form_valid(self, form): obj = form.save() update_remote_comment(obj) obj.refresh_from_db() if obj.sync_status == "sync": messages.success(self.request, _("Your comment was updated.")) else: messages.success( self.request, _("Your comment change was queued for update.") ) return HttpResponseRedirect(obj.master_issue.get_absolute_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"]) class IssueCommentDeleteView( LoginRequiredMixin, PermissionRequiredMixin, SelectRelatedMixin, generic.edit.DeleteView, ): model = models.IssueCommentLink template_name = "helpdesk/comment_delete.html" permission_required = "helpdesk.delete_comment" slug_url_kwarg = "cext_id" slug_field = "external_id" select_related = ["master_issue"] def dispatch(self, request, *args, **kwargs): issue_id = kwargs.pop("ext_id", None) self.master_issue = get_object_or_404(models.IssueLink, external_id=issue_id) if self.master_issue != self.get_object().master_issue: raise Http404 return super().dispatch(request, *args, **kwargs) def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["issue"] = self.master_issue return context def get_success_url(self): return self.master_issue.get_absolute_url() def delete(self, request, *args, **kwargs): obj = self.get_object() delete_remote_comment(obj) obj.refresh_from_db() if obj.sync_status != "deleted": messages.success(self.request, _("Comment was queued for deletion.")) return HttpResponseRedirect(self.get_success_url()) obj.delete() messages.success(self.request, _("Comment was deleted.")) return HttpResponseRedirect(self.get_success_url()) def get_queryset(self): return self.model.objects.exclude(sync_status__in=["delete_err", "deleted"])
[ 1, 1053, 12183, 13, 13, 3166, 4105, 778, 29889, 7406, 1053, 27611, 3486, 9662, 630, 29924, 861, 262, 29892, 7605, 9662, 630, 29924, 861, 262, 13, 3166, 9557, 29889, 21570, 1053, 7191, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 28084, 1144, 1053, 19130, 19347, 29924, 861, 262, 13, 3166, 9557, 29889, 3221, 29889, 8173, 1053, 7090, 13, 3166, 9557, 29889, 9514, 1053, 1904, 689, 29918, 14399, 13, 3166, 9557, 29889, 1124, 1053, 9056, 29946, 29900, 29946, 29892, 9056, 5103, 3664, 15930, 287, 29892, 9056, 5103, 24735, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 13, 3166, 9557, 29889, 26045, 1053, 11837, 29918, 433, 1537, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 318, 657, 726, 29918, 433, 1537, 408, 903, 13, 3166, 9557, 29889, 7406, 1053, 10035, 13, 3166, 6865, 29889, 21570, 29889, 7406, 1053, 20894, 2333, 19347, 29924, 861, 262, 13, 3166, 6865, 29889, 17858, 6847, 1053, 756, 29918, 17858, 13, 13, 3166, 869, 1053, 4733, 13, 3166, 869, 1627, 1975, 1053, 27241, 2392, 29892, 20462, 2392, 13, 3166, 869, 4530, 1338, 1053, 2228, 29918, 3859, 29918, 15033, 13, 3166, 869, 20673, 1053, 313, 13, 1678, 3802, 29918, 16674, 29918, 15118, 29892, 13, 1678, 1653, 29918, 16674, 29918, 9342, 29892, 13, 1678, 1653, 29918, 16674, 29918, 15118, 29892, 13, 1678, 5217, 29918, 16674, 29918, 9342, 29892, 13, 1678, 5217, 29918, 16674, 29918, 15118, 29892, 13, 1678, 337, 3150, 29918, 16674, 29918, 15118, 29892, 13, 1678, 2767, 29918, 16674, 29918, 9342, 29892, 13, 1678, 2767, 29918, 16674, 29918, 15118, 13, 29897, 13, 3166, 869, 13239, 1053, 679, 29918, 27852, 29918, 4645, 29892, 8265, 21873, 29918, 21032, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 703, 8477, 2783, 29895, 1159, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 13, 13, 1990, 26246, 15660, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 7605, 9662, 630, 29924, 861, 262, 29892, 27611, 3486, 9662, 630, 29924, 861, 262, 29892, 10035, 29889, 15660, 13, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 3030, 29918, 3318, 29918, 978, 353, 376, 15118, 29918, 1761, 29908, 13, 1678, 10203, 16976, 29918, 1609, 353, 29871, 29906, 29945, 13, 1678, 10203, 16976, 29918, 5676, 550, 353, 29871, 29906, 13, 1678, 1831, 29918, 12817, 353, 6796, 1037, 1061, 3108, 13, 1678, 758, 9155, 29918, 12817, 353, 6796, 1491, 7588, 2596, 3108, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 15118, 29918, 1761, 29889, 1420, 29908, 13, 1678, 4660, 29918, 1853, 353, 376, 3150, 287, 29908, 13, 1678, 20520, 353, 6796, 29899, 11600, 3108, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 679, 29918, 8977, 353, 2009, 29889, 7194, 29889, 8552, 580, 13, 4706, 1404, 29918, 3888, 353, 679, 29918, 8977, 29889, 7323, 703, 4882, 613, 6213, 29897, 13, 4706, 565, 1404, 29918, 3888, 322, 1404, 29918, 3888, 29961, 29900, 29962, 297, 6796, 3150, 287, 613, 376, 15603, 3108, 29901, 13, 9651, 1583, 29889, 4882, 29918, 1853, 353, 1404, 29918, 3888, 29961, 29900, 29962, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 313, 13, 9651, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 9651, 869, 4572, 29898, 29883, 3791, 29918, 4882, 29922, 1311, 29889, 4882, 29918, 1853, 29897, 13, 9651, 869, 2098, 29918, 1609, 703, 29899, 11600, 1159, 13, 4706, 1723, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 2141, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 3030, 3366, 1761, 8513, 3108, 353, 1583, 29889, 4882, 29918, 1853, 13, 4706, 599, 29918, 12175, 29918, 1333, 29918, 311, 22742, 353, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 13, 9651, 16523, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 3108, 13, 4706, 1723, 13, 4706, 3030, 3366, 7827, 29918, 3150, 3108, 353, 599, 29918, 12175, 29918, 1333, 29918, 311, 22742, 29889, 4572, 29898, 13, 9651, 22152, 29918, 4882, 543, 3150, 287, 29908, 13, 4706, 13742, 2798, 580, 13, 4706, 3030, 3366, 7827, 29918, 15603, 3108, 353, 599, 29918, 12175, 29918, 1333, 29918, 311, 22742, 29889, 4572, 29898, 13, 9651, 22152, 29918, 4882, 543, 15603, 29908, 13, 4706, 13742, 2798, 580, 13, 4706, 3030, 3366, 8066, 29918, 3150, 3108, 353, 599, 29918, 12175, 29918, 1333, 29918, 311, 22742, 29889, 4572, 29898, 13, 9651, 907, 1061, 29922, 1311, 29889, 3827, 29889, 1792, 29892, 22152, 29918, 4882, 543, 3150, 287, 29908, 13, 4706, 13742, 2798, 580, 13, 4706, 3030, 3366, 8066, 29918, 15603, 3108, 353, 599, 29918, 12175, 29918, 1333, 29918, 311, 22742, 29889, 4572, 29898, 13, 9651, 907, 1061, 29922, 1311, 29889, 3827, 29889, 1792, 29892, 22152, 29918, 4882, 543, 15603, 29908, 13, 4706, 13742, 2798, 580, 13, 4706, 736, 3030, 13, 13, 13, 1990, 1619, 29902, 893, 434, 15660, 29898, 29902, 893, 434, 15660, 1125, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 2428, 2141, 657, 29918, 1972, 842, 2141, 4572, 29898, 1037, 1061, 29922, 1311, 29889, 3827, 29889, 1792, 29897, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 2141, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 3030, 3366, 1761, 8513, 3108, 353, 376, 1357, 8875, 1642, 4830, 29898, 1311, 29889, 4882, 29918, 1853, 29897, 13, 4706, 736, 3030, 13, 13, 13, 1990, 26246, 4391, 1043, 29898, 11049, 19347, 29924, 861, 262, 29892, 10035, 29889, 4391, 1043, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 4235, 353, 6796, 29883, 3791, 29918, 3257, 613, 376, 29883, 3791, 29918, 8216, 3108, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 15118, 29918, 3258, 29889, 1420, 29908, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 980, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 4706, 980, 29889, 1037, 1061, 353, 1583, 29889, 3827, 29889, 1792, 13, 4706, 980, 29889, 7620, 580, 13, 4706, 1653, 29918, 16674, 29918, 15118, 29898, 309, 29897, 13, 4706, 980, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 565, 980, 29889, 16593, 29918, 4882, 2804, 376, 16593, 1115, 13, 9651, 7191, 29889, 2704, 29898, 13, 18884, 1583, 29889, 3827, 29892, 13, 18884, 903, 29898, 13, 462, 1678, 376, 4806, 2949, 264, 29915, 29873, 2221, 304, 6159, 278, 1371, 2783, 29895, 14998, 29889, 1334, 674, 4218, 304, 8341, 4969, 445, 2228, 2678, 29889, 1939, 3105, 2276, 3158, 338, 3734, 373, 596, 760, 1213, 13, 18884, 10353, 13, 9651, 1723, 13, 4706, 736, 9056, 5103, 24735, 29898, 309, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 13, 1990, 26246, 16570, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 7605, 9662, 630, 29924, 861, 262, 29892, 27611, 3486, 9662, 630, 29924, 861, 262, 29892, 10035, 29889, 16570, 1043, 13, 1125, 13, 1678, 9995, 13, 1678, 5953, 737, 1776, 363, 385, 2228, 29889, 13, 1678, 9995, 13, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 3030, 29918, 3318, 29918, 978, 353, 376, 15118, 29908, 13, 1678, 1831, 29918, 12817, 353, 6796, 1037, 1061, 3108, 13, 1678, 758, 9155, 29918, 12817, 353, 6796, 21032, 3108, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 15118, 29918, 16432, 29889, 1420, 29908, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 1062, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 2141, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 3144, 353, 679, 29918, 27852, 29918, 4645, 580, 13, 4706, 3030, 3366, 9342, 29918, 689, 3108, 353, 1904, 689, 29918, 14399, 29898, 13, 9651, 4733, 29889, 29902, 893, 434, 20001, 6595, 29892, 4235, 29922, 3366, 29883, 3791, 29918, 2587, 3108, 13, 4706, 1723, 13, 4706, 1018, 29901, 13, 9651, 3030, 3366, 3820, 29918, 15118, 3108, 353, 7090, 29889, 657, 29918, 272, 29918, 842, 29898, 13, 18884, 376, 8477, 2783, 29895, 29899, 8875, 613, 3144, 29889, 657, 29918, 15118, 29898, 4703, 3366, 15118, 16862, 23176, 29918, 333, 511, 29871, 29906, 29900, 13, 9651, 1723, 13, 9651, 3030, 3366, 276, 535, 455, 839, 29918, 21032, 3108, 353, 7090, 29889, 657, 29918, 272, 29918, 842, 29898, 13, 18884, 376, 8477, 2783, 29895, 29899, 29912, 7402, 276, 535, 455, 839, 29899, 21032, 1642, 4830, 29898, 4703, 3366, 3820, 29918, 15118, 16862, 29875, 333, 511, 13, 18884, 8265, 21873, 29918, 21032, 29898, 4703, 3366, 15118, 3108, 511, 13, 9651, 1723, 13, 4706, 5174, 27241, 2392, 29901, 13, 9651, 17927, 29889, 2704, 29898, 13, 18884, 376, 16746, 304, 6315, 8205, 5229, 29991, 14053, 292, 1250, 304, 22152, 1819, 1213, 13, 9651, 1723, 13, 4706, 5174, 20462, 2392, 408, 288, 29872, 29901, 13, 9651, 17927, 29889, 2704, 29898, 13, 18884, 376, 8439, 471, 385, 1059, 5663, 15387, 278, 6315, 8205, 848, 29889, 14053, 292, 1250, 304, 22152, 1819, 29889, 4829, 2643, 471, 29901, 6571, 1642, 4830, 29898, 13, 462, 1678, 851, 29898, 7297, 29897, 13, 18884, 1723, 13, 9651, 1723, 13, 4706, 736, 3030, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 29925, 2548, 16570, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 20894, 2333, 19347, 29924, 861, 262, 29892, 7605, 9662, 630, 29924, 861, 262, 29892, 10035, 29889, 16570, 1043, 13, 1125, 13, 1678, 9995, 13, 1678, 5953, 737, 1776, 363, 263, 28235, 2228, 313, 1333, 3447, 2825, 297, 14998, 1846, 13, 1678, 9995, 13, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 282, 29895, 29918, 2271, 29918, 11022, 1191, 353, 376, 20571, 29908, 13, 1678, 3030, 29918, 3318, 29918, 978, 353, 376, 15118, 29908, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 15118, 29918, 29886, 2548, 29918, 16432, 29889, 1420, 29908, 13, 1678, 1831, 29918, 12817, 353, 6796, 1037, 1061, 3108, 13, 1678, 10751, 29918, 12403, 353, 376, 8477, 2783, 29895, 29889, 5628, 29918, 15118, 29908, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 565, 5446, 29889, 16593, 29918, 4882, 1275, 376, 16593, 29908, 322, 5446, 29889, 23176, 29918, 333, 29901, 13, 9651, 736, 9056, 5103, 24735, 29898, 5415, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 6422, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 20894, 2333, 19347, 29924, 861, 262, 29892, 10035, 29889, 5628, 29889, 6422, 1043, 13, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 1062, 29918, 333, 29908, 13, 1678, 10751, 29918, 12403, 353, 376, 8477, 2783, 29895, 29889, 5628, 29918, 15118, 29908, 13, 1678, 3030, 29918, 3318, 29918, 978, 353, 376, 15118, 29908, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 15118, 29918, 5504, 29889, 1420, 29908, 13, 1678, 4235, 353, 6796, 29883, 3791, 29918, 3257, 613, 376, 29883, 3791, 29918, 8216, 3108, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 565, 5446, 29889, 16593, 29918, 4882, 2804, 376, 16593, 1115, 13, 9651, 7191, 29889, 3888, 29898, 13, 18884, 2009, 29892, 13, 18884, 903, 29898, 13, 462, 1678, 376, 4013, 2944, 338, 1603, 28235, 16523, 411, 1749, 2228, 23110, 1788, 322, 2609, 5279, 367, 8788, 1213, 13, 18884, 10353, 13, 9651, 1723, 13, 9651, 736, 9056, 5103, 24735, 29898, 5415, 29889, 657, 29918, 23552, 29918, 2271, 29897, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 980, 353, 883, 29889, 7620, 580, 13, 4706, 2767, 29918, 16674, 29918, 15118, 29898, 309, 29897, 13, 4706, 980, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 565, 980, 29889, 16593, 29918, 4882, 2804, 376, 16593, 1115, 13, 9651, 7191, 29889, 3888, 29898, 13, 18884, 1583, 29889, 3827, 29892, 13, 18884, 903, 29898, 13, 462, 1678, 376, 4806, 505, 4784, 278, 2407, 29892, 541, 372, 338, 1603, 7272, 292, 385, 2767, 373, 278, 14998, 29889, 1939, 4340, 3158, 338, 3734, 373, 596, 760, 1213, 13, 18884, 10353, 13, 9651, 1723, 13, 4706, 736, 9056, 5103, 24735, 29898, 309, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 12498, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 20894, 2333, 19347, 29924, 861, 262, 29892, 10035, 29889, 5628, 29889, 12498, 1043, 13, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 1062, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 1678, 10751, 29918, 12403, 353, 376, 8477, 2783, 29895, 29889, 8143, 29918, 15118, 29908, 13, 1678, 3030, 29918, 3318, 29918, 978, 353, 376, 15118, 29908, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 15118, 29918, 8143, 29889, 1420, 29908, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 5217, 29918, 16674, 29918, 15118, 29898, 5415, 29897, 13, 4706, 5446, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 565, 5446, 29889, 16593, 29918, 4882, 1275, 376, 311, 22742, 1115, 13, 9651, 5446, 29889, 8143, 580, 13, 9651, 7191, 29889, 8698, 29898, 3827, 29892, 903, 703, 10858, 2228, 338, 8472, 11132, 1213, 876, 13, 4706, 1683, 29901, 13, 9651, 7191, 29889, 8698, 29898, 3827, 29892, 903, 703, 10858, 2228, 756, 1063, 712, 6742, 363, 7374, 291, 1213, 876, 13, 4706, 736, 9056, 5103, 24735, 29898, 24244, 29918, 433, 1537, 703, 8477, 2783, 29895, 29901, 15118, 29899, 1761, 5783, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 4035, 13086, 1043, 29898, 11049, 19347, 29924, 861, 262, 29892, 10035, 29889, 5628, 29889, 6422, 1043, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 1062, 29918, 333, 29908, 13, 1678, 3030, 29918, 3318, 29918, 978, 353, 376, 15118, 29908, 13, 1678, 4235, 353, 5159, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 565, 2009, 29889, 5696, 29889, 13609, 580, 451, 297, 6796, 2490, 3108, 29901, 13, 9651, 736, 9056, 5103, 3664, 15930, 287, 29898, 3366, 5438, 20068, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 5446, 29889, 1491, 7588, 2596, 29889, 1202, 29898, 1311, 29889, 3827, 29889, 1792, 29897, 13, 4706, 7191, 29889, 8698, 29898, 13, 9651, 1583, 29889, 3827, 29892, 903, 703, 3492, 526, 1286, 21696, 2580, 304, 11217, 373, 445, 2228, 23157, 13, 4706, 1723, 13, 4706, 736, 9056, 5103, 24735, 29898, 5415, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 2525, 19496, 1043, 29898, 29902, 893, 434, 4035, 13086, 1043, 1125, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 5446, 29889, 1491, 7588, 2596, 29889, 5992, 29898, 1311, 29889, 3827, 29889, 1792, 29897, 13, 4706, 7191, 29889, 8698, 29898, 13, 9651, 1583, 29889, 3827, 29892, 903, 703, 3492, 526, 694, 5520, 21696, 2580, 304, 11217, 373, 445, 2228, 23157, 13, 4706, 1723, 13, 4706, 736, 9056, 5103, 24735, 29898, 5415, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 11123, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 20894, 2333, 19347, 29924, 861, 262, 29892, 10035, 29889, 5628, 29889, 6422, 1043, 13, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 1062, 29918, 333, 29908, 13, 1678, 10751, 29918, 12403, 353, 376, 8477, 2783, 29895, 29889, 5358, 29918, 15118, 29908, 13, 1678, 396, 3462, 263, 883, 1244, 13, 1678, 4235, 353, 5159, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 565, 2009, 29889, 5696, 29889, 13609, 580, 451, 297, 6796, 2490, 3108, 29901, 13, 9651, 736, 9056, 5103, 3664, 15930, 287, 29898, 3366, 5438, 20068, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 3802, 29918, 16674, 29918, 15118, 29898, 5415, 29897, 13, 4706, 5446, 29889, 4882, 353, 376, 15603, 29908, 13, 4706, 5446, 29889, 7620, 580, 13, 4706, 7191, 29889, 8698, 29898, 1311, 29889, 3827, 29892, 903, 703, 29902, 893, 434, 756, 1063, 5764, 1213, 876, 13, 4706, 2228, 29918, 3859, 29918, 15033, 29889, 6717, 29898, 13, 9651, 5446, 29892, 13, 9651, 2228, 29922, 5415, 29892, 13, 9651, 1404, 29922, 1311, 29889, 3827, 29889, 1792, 29892, 13, 9651, 2030, 29918, 4882, 543, 3150, 287, 613, 13, 9651, 716, 29918, 4882, 543, 15603, 613, 13, 4706, 1723, 13, 4706, 736, 9056, 5103, 24735, 29898, 5415, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 1123, 3150, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 20894, 2333, 19347, 29924, 861, 262, 29892, 10035, 29889, 5628, 29889, 6422, 1043, 13, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 6595, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 1062, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 1678, 10751, 29918, 12403, 353, 376, 8477, 2783, 29895, 29889, 276, 3150, 29918, 15118, 29908, 13, 1678, 4235, 353, 5159, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 565, 2009, 29889, 5696, 29889, 13609, 580, 451, 297, 6796, 2490, 3108, 29901, 13, 9651, 736, 9056, 5103, 3664, 15930, 287, 29898, 3366, 5438, 20068, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 5446, 29889, 4882, 353, 376, 3150, 287, 29908, 13, 4706, 5446, 29889, 7620, 580, 13, 4706, 337, 3150, 29918, 16674, 29918, 15118, 29898, 5415, 29897, 13, 4706, 7191, 29889, 8698, 29898, 1311, 29889, 3827, 29892, 903, 703, 4013, 2228, 756, 1063, 337, 3150, 287, 1213, 876, 13, 4706, 2228, 29918, 3859, 29918, 15033, 29889, 6717, 29898, 13, 9651, 5446, 29892, 13, 9651, 2228, 29922, 5415, 29892, 13, 9651, 1404, 29922, 1311, 29889, 3827, 29889, 1792, 29892, 13, 9651, 2030, 29918, 4882, 543, 15603, 613, 13, 9651, 716, 29918, 4882, 543, 3150, 287, 613, 13, 4706, 1723, 13, 4706, 736, 9056, 5103, 24735, 29898, 5415, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 20001, 4391, 1043, 29898, 11049, 19347, 29924, 861, 262, 29892, 10035, 29889, 4391, 1043, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 20001, 6595, 13, 1678, 4235, 353, 6796, 29883, 3791, 29918, 2587, 3108, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 9342, 29918, 3258, 29889, 1420, 29908, 13, 1678, 5835, 29918, 15118, 353, 6213, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2228, 29918, 333, 353, 9049, 5085, 29889, 7323, 703, 1062, 29918, 333, 613, 6213, 29897, 13, 4706, 1583, 29889, 6207, 29918, 15118, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 9794, 29889, 29902, 893, 434, 6595, 29892, 7029, 29918, 333, 29922, 15118, 29918, 333, 29897, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 2141, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 3030, 3366, 15118, 3108, 353, 1583, 29889, 6207, 29918, 15118, 13, 4706, 736, 3030, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 5446, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 4706, 5446, 29889, 1037, 1061, 353, 1583, 29889, 3827, 29889, 1792, 13, 4706, 5446, 29889, 6207, 29918, 15118, 353, 1583, 29889, 6207, 29918, 15118, 13, 4706, 5446, 29889, 7620, 580, 13, 4706, 1653, 29918, 16674, 29918, 9342, 29898, 5415, 29897, 13, 4706, 565, 376, 5358, 29918, 15118, 29908, 297, 1583, 29889, 3827, 29889, 5438, 29889, 8149, 7295, 13, 9651, 17927, 29889, 8382, 29898, 13, 18884, 376, 3089, 304, 788, 3440, 884, 7805, 2009, 304, 3802, 2228, 29889, 5399, 292, 11239, 17794, 13, 9651, 1723, 13, 9651, 565, 756, 29918, 17858, 703, 8477, 2783, 29895, 29889, 5358, 29918, 15118, 613, 1583, 29889, 3827, 29889, 1792, 29892, 1583, 29889, 6207, 29918, 15118, 1125, 13, 18884, 17927, 29889, 8382, 703, 2659, 756, 11239, 29889, 2233, 14556, 278, 7592, 2228, 856, 1159, 13, 18884, 3802, 29918, 16674, 29918, 15118, 29898, 1311, 29889, 6207, 29918, 15118, 29897, 13, 18884, 17927, 29889, 8382, 703, 29902, 893, 434, 471, 5764, 29889, 9897, 690, 2790, 278, 1203, 515, 278, 6535, 1159, 13, 18884, 5446, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 9651, 1683, 29901, 13, 18884, 17927, 29889, 8382, 703, 2659, 1258, 451, 505, 278, 1959, 11239, 856, 1159, 13, 18884, 7191, 29889, 2704, 29898, 13, 462, 1678, 1583, 29889, 3827, 29892, 13, 462, 1678, 903, 703, 3492, 437, 451, 505, 278, 5181, 10462, 304, 3802, 445, 2228, 1213, 511, 13, 18884, 1723, 13, 4706, 565, 5446, 29889, 16593, 29918, 4882, 2804, 376, 16593, 1115, 13, 9651, 7191, 29889, 3888, 29898, 1311, 29889, 3827, 29892, 903, 703, 10858, 3440, 756, 1063, 712, 6742, 363, 11265, 1213, 876, 13, 4706, 1683, 29901, 13, 9651, 7191, 29889, 8698, 29898, 1311, 29889, 3827, 29892, 903, 703, 10858, 3440, 756, 1063, 2715, 1213, 876, 13, 4706, 1583, 29889, 6207, 29918, 15118, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 565, 1583, 29889, 6207, 29918, 15118, 29889, 29883, 3791, 29918, 4882, 1275, 376, 15603, 1115, 13, 9651, 565, 1583, 29889, 6207, 29918, 15118, 29889, 16593, 29918, 4882, 2804, 376, 16593, 1115, 13, 18884, 7191, 29889, 3888, 29898, 1311, 29889, 3827, 29892, 903, 703, 29902, 893, 434, 756, 1063, 712, 6742, 363, 14382, 1213, 876, 13, 9651, 1683, 29901, 13, 18884, 7191, 29889, 8698, 29898, 1311, 29889, 3827, 29892, 903, 703, 29902, 893, 434, 756, 1063, 5764, 1213, 876, 13, 9651, 2228, 29918, 3859, 29918, 15033, 29889, 6717, 29898, 13, 18884, 5446, 29892, 13, 18884, 2228, 29922, 5415, 29889, 6207, 29918, 15118, 29892, 13, 18884, 1404, 29922, 1311, 29889, 3827, 29889, 1792, 29892, 13, 18884, 2030, 29918, 4882, 543, 3150, 287, 613, 13, 18884, 716, 29918, 4882, 543, 15603, 613, 13, 9651, 1723, 13, 4706, 1583, 29889, 6207, 29918, 15118, 29889, 1491, 7588, 2596, 29889, 1202, 29898, 13, 9651, 1583, 29889, 3827, 29889, 1792, 13, 4706, 1723, 29871, 396, 3323, 13086, 963, 304, 11217, 29889, 13, 4706, 736, 9056, 5103, 24735, 29898, 5415, 29889, 6207, 29918, 15118, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 20001, 6422, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 13, 1678, 20894, 2333, 19347, 29924, 861, 262, 29892, 13, 1678, 7605, 9662, 630, 29924, 861, 262, 29892, 13, 1678, 10035, 29889, 5628, 29889, 6422, 1043, 29892, 13, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 20001, 6595, 13, 1678, 4235, 353, 6796, 29883, 3791, 29918, 2587, 3108, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 9342, 29918, 5504, 29889, 1420, 29908, 13, 1678, 1831, 29918, 12817, 353, 6796, 1037, 1061, 613, 376, 6207, 29918, 15118, 3108, 13, 1678, 5835, 29918, 15118, 353, 6213, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 346, 486, 29918, 333, 29908, 13, 1678, 10751, 29918, 12403, 353, 376, 8477, 2783, 29895, 29889, 5628, 29918, 9342, 29908, 13, 1678, 3030, 29918, 3318, 29918, 978, 353, 376, 9342, 29908, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2228, 29918, 333, 353, 9049, 5085, 29889, 7323, 703, 1062, 29918, 333, 613, 6213, 29897, 13, 4706, 1583, 29889, 6207, 29918, 15118, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 9794, 29889, 29902, 893, 434, 6595, 29892, 7029, 29918, 333, 29922, 15118, 29918, 333, 29897, 13, 4706, 565, 1583, 29889, 6207, 29918, 15118, 2804, 1583, 29889, 657, 29918, 3318, 2141, 6207, 29918, 15118, 29901, 13, 9651, 12020, 9056, 29946, 29900, 29946, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 2141, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 3030, 3366, 15118, 3108, 353, 1583, 29889, 6207, 29918, 15118, 13, 4706, 736, 3030, 13, 13, 1678, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 4706, 5446, 353, 883, 29889, 7620, 580, 13, 4706, 2767, 29918, 16674, 29918, 9342, 29898, 5415, 29897, 13, 4706, 5446, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 565, 5446, 29889, 16593, 29918, 4882, 1275, 376, 16593, 1115, 13, 9651, 7191, 29889, 8698, 29898, 1311, 29889, 3827, 29892, 903, 703, 10858, 3440, 471, 4784, 1213, 876, 13, 4706, 1683, 29901, 13, 9651, 7191, 29889, 8698, 29898, 13, 18884, 1583, 29889, 3827, 29892, 903, 703, 10858, 3440, 1735, 471, 712, 6742, 363, 2767, 23157, 13, 9651, 1723, 13, 4706, 736, 9056, 5103, 24735, 29898, 5415, 29889, 6207, 29918, 15118, 29889, 657, 29918, 23552, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 13, 13, 1990, 26246, 20001, 12498, 1043, 29898, 13, 1678, 19130, 19347, 29924, 861, 262, 29892, 13, 1678, 20894, 2333, 19347, 29924, 861, 262, 29892, 13, 1678, 7605, 9662, 630, 29924, 861, 262, 29892, 13, 1678, 10035, 29889, 5628, 29889, 12498, 1043, 29892, 13, 1125, 13, 1678, 1904, 353, 4733, 29889, 29902, 893, 434, 20001, 6595, 13, 1678, 4472, 29918, 978, 353, 376, 8477, 2783, 29895, 29914, 9342, 29918, 8143, 29889, 1420, 29908, 13, 1678, 10751, 29918, 12403, 353, 376, 8477, 2783, 29895, 29889, 8143, 29918, 9342, 29908, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 376, 346, 486, 29918, 333, 29908, 13, 1678, 2243, 688, 29918, 2671, 353, 376, 23176, 29918, 333, 29908, 13, 1678, 1831, 29918, 12817, 353, 6796, 6207, 29918, 15118, 3108, 13, 13, 1678, 822, 13916, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2228, 29918, 333, 353, 9049, 5085, 29889, 7323, 703, 1062, 29918, 333, 613, 6213, 29897, 13, 4706, 1583, 29889, 6207, 29918, 15118, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 9794, 29889, 29902, 893, 434, 6595, 29892, 7029, 29918, 333, 29922, 15118, 29918, 333, 29897, 13, 4706, 565, 1583, 29889, 6207, 29918, 15118, 2804, 1583, 29889, 657, 29918, 3318, 2141, 6207, 29918, 15118, 29901, 13, 9651, 12020, 9056, 29946, 29900, 29946, 13, 4706, 736, 2428, 2141, 13369, 29898, 3827, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 2141, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 3030, 3366, 15118, 3108, 353, 1583, 29889, 6207, 29918, 15118, 13, 4706, 736, 3030, 13, 13, 1678, 822, 679, 29918, 8698, 29918, 2271, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 6207, 29918, 15118, 29889, 657, 29918, 23552, 29918, 2271, 580, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 5446, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 5217, 29918, 16674, 29918, 9342, 29898, 5415, 29897, 13, 4706, 5446, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 565, 5446, 29889, 16593, 29918, 4882, 2804, 376, 311, 22742, 1115, 13, 9651, 7191, 29889, 8698, 29898, 1311, 29889, 3827, 29892, 903, 703, 20001, 471, 712, 6742, 363, 7374, 291, 1213, 876, 13, 9651, 736, 9056, 5103, 24735, 29898, 1311, 29889, 657, 29918, 8698, 29918, 2271, 3101, 13, 4706, 5446, 29889, 8143, 580, 13, 4706, 7191, 29889, 8698, 29898, 1311, 29889, 3827, 29892, 903, 703, 20001, 471, 11132, 1213, 876, 13, 4706, 736, 9056, 5103, 24735, 29898, 1311, 29889, 657, 29918, 8698, 29918, 2271, 3101, 13, 13, 1678, 822, 679, 29918, 1972, 842, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 12650, 29889, 735, 2325, 29898, 16593, 29918, 4882, 1649, 262, 29922, 3366, 8143, 29918, 3127, 613, 376, 311, 22742, 20068, 13, 2 ]
ddexreader/ddexreader.py
iwalkdaline/ddex-reader
0
150024
from ddexreader import ern382 import pyxb def open_ddex(path): """ Open an XML from a path and parse it into a DDEX data structure. This script automatically finds which ERN version to use. Args: path (str): path to the XML file. Returns: A DDEX data structure. The type depends on the ERN version. Raises: ValueError: No ERN version compatible with this DDEX file. """ with open(path, 'rb') as f: xml_data = f.read() if b'MessageSchemaVersionId="2010/ern-main/312"' in xml_data: return ern312.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="ern/32"' in xml_data: return ern32.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="2011/ern-main/33"' in xml_data: return ern33.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="ern/34"' in xml_data: return ern34.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="ern/341"' in xml_data: return ern341.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="ern/35"' in xml_data: return ern35.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="ern/351"' in xml_data: return ern351.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="ern/36"' in xml_data: return ern36.CreateFromDocument(xml_data) elif b'MessageSchemaVersionId="ern/382"' in xml_data: return ern382.CreateFromDocument(xml_data) else: raise ValueError('No ERN version compatible with this DDEX file.') def ddex_to_dict(ddex): """ Parse a DDEX data structure into a dictionary whose leaves are unicode strings or data structures from pyxb. Args: ddex: the result of applying ddexreader.open_ddex Returns: A dictionarywhose leaves are unicode strings or data structures from pyxb. """ # Ddex attributes start with an uppercase letter in pyxb. Factory is used by pyxb attributes = [attr for attr in dir(ddex) if attr[0].isupper() and attr != 'Factory'] # Check if we have a leaf type (which means its repr will be a string containing a unicode string) if 'object' not in repr(ddex): return str(ddex) d = {} for attr in attributes: value = getattr(ddex, attr) # Some leaf elements have a value method, others do not if hasattr(value, 'value'): try: value = value.value() except pyxb.NotSimpleContentError: # In this case value was not a leaf element value = ddex_to_dict(value) elif isinstance(value, pyxb.binding.content._PluralBinding): value = [ddex_to_dict(el) for el in value] d[attr] = value return d
[ 1, 29871, 13, 3166, 270, 1390, 16950, 1053, 22276, 29941, 29947, 29906, 13, 5215, 11451, 29916, 29890, 13, 13, 13, 1753, 1722, 29918, 29881, 1390, 29898, 2084, 1125, 13, 1678, 9995, 13, 1678, 4673, 385, 6560, 515, 263, 2224, 322, 6088, 372, 964, 263, 360, 19577, 848, 3829, 29889, 13, 1678, 910, 2471, 6336, 14061, 607, 8982, 29940, 1873, 304, 671, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 2224, 313, 710, 1125, 2224, 304, 278, 6560, 934, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 319, 360, 19577, 848, 3829, 29889, 450, 1134, 7111, 373, 278, 8982, 29940, 1873, 29889, 13, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 7865, 2392, 29901, 1939, 8982, 29940, 1873, 15878, 411, 445, 360, 19577, 934, 29889, 13, 1678, 9995, 13, 1678, 411, 1722, 29898, 2084, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 4706, 4903, 29918, 1272, 353, 285, 29889, 949, 580, 13, 13, 1678, 565, 289, 29915, 3728, 12763, 6594, 1204, 543, 29906, 29900, 29896, 29900, 29914, 824, 29899, 3396, 29914, 29941, 29896, 29906, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29896, 29906, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 824, 29914, 29941, 29906, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29906, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 29906, 29900, 29896, 29896, 29914, 824, 29899, 3396, 29914, 29941, 29941, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29941, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 824, 29914, 29941, 29946, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29946, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 824, 29914, 29941, 29946, 29896, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29946, 29896, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 824, 29914, 29941, 29945, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29945, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 824, 29914, 29941, 29945, 29896, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29945, 29896, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 824, 29914, 29941, 29953, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29953, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 25342, 289, 29915, 3728, 12763, 6594, 1204, 543, 824, 29914, 29941, 29947, 29906, 29908, 29915, 297, 4903, 29918, 1272, 29901, 13, 4706, 736, 22276, 29941, 29947, 29906, 29889, 4391, 4591, 6268, 29898, 3134, 29918, 1272, 29897, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 3782, 8982, 29940, 1873, 15878, 411, 445, 360, 19577, 934, 29889, 1495, 13, 13, 13, 1753, 270, 1390, 29918, 517, 29918, 8977, 29898, 29881, 1390, 1125, 13, 1678, 9995, 13, 1678, 20969, 263, 360, 19577, 848, 3829, 964, 263, 8600, 5069, 11308, 526, 29104, 6031, 13, 1678, 470, 848, 12286, 515, 11451, 29916, 29890, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 270, 1390, 29901, 278, 1121, 310, 15399, 270, 1390, 16950, 29889, 3150, 29918, 29881, 1390, 13, 13, 1678, 16969, 29901, 13, 4706, 319, 8600, 1332, 852, 11308, 526, 29104, 6031, 470, 848, 12286, 515, 11451, 29916, 29890, 29889, 13, 1678, 9995, 13, 1678, 396, 360, 1390, 8393, 1369, 411, 385, 7568, 4878, 5497, 297, 11451, 29916, 29890, 29889, 27561, 338, 1304, 491, 11451, 29916, 29890, 13, 1678, 8393, 353, 518, 5552, 363, 12421, 297, 4516, 29898, 29881, 1390, 29897, 565, 12421, 29961, 29900, 1822, 275, 21064, 580, 322, 12421, 2804, 525, 5126, 2033, 13, 13, 1678, 396, 5399, 565, 591, 505, 263, 20447, 1134, 313, 4716, 2794, 967, 2062, 674, 367, 263, 1347, 6943, 263, 29104, 1347, 29897, 13, 1678, 565, 525, 3318, 29915, 451, 297, 2062, 29898, 29881, 1390, 1125, 13, 4706, 736, 851, 29898, 29881, 1390, 29897, 13, 1678, 270, 353, 6571, 13, 13, 1678, 363, 12421, 297, 8393, 29901, 13, 4706, 995, 353, 679, 5552, 29898, 29881, 1390, 29892, 12421, 29897, 13, 4706, 396, 3834, 20447, 3161, 505, 263, 995, 1158, 29892, 4045, 437, 451, 13, 4706, 565, 756, 5552, 29898, 1767, 29892, 525, 1767, 29374, 13, 9651, 1018, 29901, 13, 18884, 995, 353, 995, 29889, 1767, 580, 13, 9651, 5174, 11451, 29916, 29890, 29889, 3664, 15427, 3916, 2392, 29901, 13, 18884, 396, 512, 445, 1206, 995, 471, 451, 263, 20447, 1543, 13, 18884, 995, 353, 270, 1390, 29918, 517, 29918, 8977, 29898, 1767, 29897, 13, 4706, 25342, 338, 8758, 29898, 1767, 29892, 11451, 29916, 29890, 29889, 19672, 29889, 3051, 3032, 3247, 3631, 9270, 1125, 13, 9651, 995, 353, 518, 29881, 1390, 29918, 517, 29918, 8977, 29898, 295, 29897, 363, 560, 297, 995, 29962, 13, 4706, 270, 29961, 5552, 29962, 353, 995, 13, 1678, 736, 270, 13, 2 ]
src/backbones/Rethinking.py
NeurAI-Lab/biHomE
19
105862
<gh_stars>10-100 import torch import torch.nn as nn from src.backbones.utils import ResNet50ConvBlock from src.backbones.utils import ResNet50IdentityBlock from src.backbones.utils import ResNet50DeconvBlock from src.backbones.utils import ResNet34ConvBlock from src.backbones.utils import ResNet34IdentityBlock class Model(nn.Module): def __init__(self, **kwargs): super(Model, self).__init__() self.image_size = kwargs['IMAGE_SIZE'] self.patch_keys = kwargs['PATCH_KEYS'] self.target_keys = kwargs['TARGET_KEYS'] self.resnet_block = kwargs['RESNET_BLOCK'] self.pretrained_resnet = kwargs['PRETRAINED_RESNET'] self.variant = str.lower(kwargs['VARIANT']) if 'VARIANT' in kwargs else 'oneline' assert 'oneline' in self.variant or 'doubleline' in self.variant, 'Only OneLine or DoubleLine variant is' \ 'supported' ####################################################################### # STAGE 1 ####################################################################### self.layer1 = nn.Sequential(nn.Conv2d(in_channels=2, out_channels=64, kernel_size=7, padding=3, stride=2, bias=False), nn.BatchNorm2d(64), nn.ReLU(), nn.MaxPool2d(kernel_size=3, stride=2, padding=1)) ####################################################################### # STAGE 2 ####################################################################### if self.resnet_block == 'ResNet50': self.layer2 = nn.Sequential(ResNet50ConvBlock(input_channels=64, output_channels=256, stride=1), ResNet50IdentityBlock(input_channels=256), ResNet50IdentityBlock(input_channels=256)) elif self.resnet_block == 'ResNet34': self.layer2 = nn.Sequential(ResNet34ConvBlock(input_channels=64, output_channels=64, stride=1), ResNet34IdentityBlock(input_channels=64), ResNet34IdentityBlock(input_channels=64)) else: assert False, 'I know only ResNet50 and ResNet34' ####################################################################### # STAGE 3 ####################################################################### if self.resnet_block == 'ResNet50': self.layer3 = nn.Sequential(ResNet50ConvBlock(input_channels=256, output_channels=512, stride=2), ResNet50IdentityBlock(input_channels=512), ResNet50IdentityBlock(input_channels=512), ResNet50IdentityBlock(input_channels=512)) elif self.resnet_block == 'ResNet34': self.layer3 = nn.Sequential(ResNet34ConvBlock(input_channels=64, output_channels=128, stride=2), ResNet34IdentityBlock(input_channels=128), ResNet34IdentityBlock(input_channels=128), ResNet34IdentityBlock(input_channels=128)) else: assert False, 'I know only ResNet50 and ResNet34' ####################################################################### # STAGE 4 ####################################################################### if self.resnet_block == 'ResNet50': self.layer4 = nn.Sequential(ResNet50ConvBlock(input_channels=512, output_channels=1024, stride=2), ResNet50IdentityBlock(input_channels=1024), ResNet50IdentityBlock(input_channels=1024), ResNet50IdentityBlock(input_channels=1024), ResNet50IdentityBlock(input_channels=1024), ResNet50IdentityBlock(input_channels=1024), ResNet50DeconvBlock(input_channels=1024)) elif self.resnet_block == 'ResNet34': self.layer4 = nn.Sequential(ResNet34ConvBlock(input_channels=128, output_channels=256, stride=2), ResNet34IdentityBlock(input_channels=256), ResNet34IdentityBlock(input_channels=256), ResNet34IdentityBlock(input_channels=256), ResNet34IdentityBlock(input_channels=256), ResNet34IdentityBlock(input_channels=256), ResNet50DeconvBlock(input_channels=256)) else: assert False, 'I know only ResNet50 and ResNet34' ####################################################################### # STAGE 5 ####################################################################### if self.resnet_block == 'ResNet50': self.layer5 = nn.Sequential(ResNet50IdentityBlock(input_channels=512), ResNet50IdentityBlock(input_channels=512), ResNet50IdentityBlock(input_channels=512), ResNet50DeconvBlock(input_channels=512)) elif self.resnet_block == 'ResNet34': self.layer5 = nn.Sequential(ResNet34IdentityBlock(input_channels=128), ResNet34IdentityBlock(input_channels=128), ResNet34IdentityBlock(input_channels=128), ResNet50DeconvBlock(input_channels=128)) else: assert False, 'I know only ResNet50 and ResNet34' ####################################################################### # STAGE 6 ####################################################################### if self.resnet_block == 'ResNet50': self.layer6 = nn.Sequential(ResNet50IdentityBlock(input_channels=256), ResNet50IdentityBlock(input_channels=256), ResNet50DeconvBlock(input_channels=256)) elif self.resnet_block == 'ResNet34': self.layer6 = nn.Sequential(ResNet34IdentityBlock(input_channels=64), ResNet34IdentityBlock(input_channels=64), ResNet50DeconvBlock(input_channels=64)) else: assert False, 'I know only ResNet50 and ResNet34' ####################################################################### # STAGE 7 ####################################################################### if self.resnet_block == 'ResNet50': self.layer7 = nn.Sequential(ResNet50IdentityBlock(input_channels=128), ResNet50DeconvBlock(input_channels=128)) elif self.resnet_block == 'ResNet34': self.layer7 = nn.Sequential(ResNet34IdentityBlock(input_channels=32), ResNet50DeconvBlock(input_channels=32)) else: assert False, 'I know only ResNet50 and ResNet34' ####################################################################### # STAGE 8 ####################################################################### if self.resnet_block == 'ResNet50': self.layer8 = nn.Sequential(nn.Conv2d(in_channels=64, out_channels=512, kernel_size=1, padding=0, stride=1), nn.BatchNorm2d(512), nn.ReLU(), nn.Conv2d(in_channels=512, out_channels=2, kernel_size=1, padding=0, stride=1)) elif self.resnet_block == 'ResNet34': self.layer8 = nn.Sequential(nn.Conv2d(in_channels=16, out_channels=128, kernel_size=1, padding=0, stride=1), nn.BatchNorm2d(128), nn.ReLU(), nn.Conv2d(in_channels=128, out_channels=2, kernel_size=1, padding=0, stride=1)) else: assert False, 'I know only ResNet50 and ResNet34' ####################################################################### # Load pretrained Resnet50 weights ####################################################################### if self.pretrained_resnet: self._load_pretrained_weights() def _load_pretrained_weights(self): ################################################################### # Help function ################################################################### def rename(old_dict, old_name, new_name): new_dict = {} for key, value in zip(old_dict.keys(), old_dict.values()): new_key = key if key != old_name else new_name new_dict[new_key] = old_dict[key] return new_dict ################################################################### # Download weights ################################################################### # Get pretrained weights from torch.hub import load_state_dict_from_url if self.resnet_block == 'ResNet50': resnet_url = 'https://download.pytorch.org/models/resnet50-19c8e357.pth' elif self.resnet_block == 'ResNet34': resnet_url = 'https://download.pytorch.org/models/resnet34-333f7ec4.pth' else: assert False, 'I know only ResNet50 and ResNet34' resnet_model_state = load_state_dict_from_url(resnet_url, progress=True) ################################################################### # Layer 1 ################################################################### layer1_resnet = dict(filter(lambda elem: 'layer1' in elem[0], resnet_model_state.items())) for e in list(layer1_resnet.keys()): target_key = e if 'layer1' in target_key: target_key = target_key.replace('layer1', 'layer2') if 'conv1' in target_key: target_key = target_key.replace('conv1', 'upper_branch.0') if 'bn1' in target_key: target_key = target_key.replace('bn1', 'upper_branch.1') if 'conv2' in target_key: target_key = target_key.replace('conv2', 'upper_branch.3') if 'bn2' in target_key: target_key = target_key.replace('bn2', 'upper_branch.4') if 'conv3' in target_key: target_key = target_key.replace('conv3', 'upper_branch.6') if 'bn3' in target_key: target_key = target_key.replace('bn3', 'upper_branch.7') if 'downsample' in target_key: target_key = target_key.replace('downsample', 'lower_branch') layer1_resnet = rename(layer1_resnet, e, target_key) model_dict = self.state_dict() model_dict = dict(filter(lambda elem: 'layer2' in elem[0], model_dict.items())) for e in layer1_resnet.keys(): if layer1_resnet[e].shape != model_dict[e].shape: print('layer1: SOMETHING WENT WRONG!', layer1_resnet[e].shape, model_dict[e].shape) ################################################################### # Layer 2 ################################################################### layer2_resnet = dict(filter(lambda elem: 'layer2' in elem[0], resnet_model_state.items())) for e in list(layer2_resnet.keys()): target_key = e if 'layer2' in target_key: target_key = target_key.replace('layer2', 'layer3') if 'conv1' in target_key: target_key = target_key.replace('conv1', 'upper_branch.0') if 'bn1' in target_key: target_key = target_key.replace('bn1', 'upper_branch.1') if 'conv2' in target_key: target_key = target_key.replace('conv2', 'upper_branch.3') if 'bn2' in target_key: target_key = target_key.replace('bn2', 'upper_branch.4') if 'conv3' in target_key: target_key = target_key.replace('conv3', 'upper_branch.6') if 'bn3' in target_key: target_key = target_key.replace('bn3', 'upper_branch.7') if 'downsample' in target_key: target_key = target_key.replace('downsample', 'lower_branch') layer2_resnet = rename(layer2_resnet, e, target_key) model_dict = self.state_dict() model_dict = dict(filter(lambda elem: 'layer3' in elem[0], model_dict.items())) for e in layer2_resnet.keys(): if layer2_resnet[e].shape != model_dict[e].shape: print('layer2: SOMETHING WENT WRONG!', layer2_resnet[e].shape, model_dict[e].shape, e) ################################################################### # Layer 3 ################################################################### layer3_resnet = dict(filter(lambda elem: 'layer3' in elem[0], resnet_model_state.items())) for e in list(layer3_resnet.keys()): target_key = e if 'layer3' in target_key: target_key = target_key.replace('layer3', 'layer4') if 'conv1' in target_key: target_key = target_key.replace('conv1', 'upper_branch.0') if 'bn1' in target_key: target_key = target_key.replace('bn1', 'upper_branch.1') if 'conv2' in target_key: target_key = target_key.replace('conv2', 'upper_branch.3') if 'bn2' in target_key: target_key = target_key.replace('bn2', 'upper_branch.4') if 'conv3' in target_key: target_key = target_key.replace('conv3', 'upper_branch.6') if 'bn3' in target_key: target_key = target_key.replace('bn3', 'upper_branch.7') if 'downsample' in target_key: target_key = target_key.replace('downsample', 'lower_branch') layer3_resnet = rename(layer3_resnet, e, target_key) model_dict = self.state_dict() model_dict = dict(filter(lambda elem: 'layer4' in elem[0], model_dict.items())) for e in layer3_resnet.keys(): if layer3_resnet[e].shape != model_dict[e].shape: print('layer3: SOMETHING WENT WRONG!', layer3_resnet[e].shape, model_dict[e].shape, e) ################################################################### # Load weights ################################################################### self.load_state_dict({**layer1_resnet, **layer2_resnet, **layer3_resnet}, strict=False) def _forward(self, x): # Forward out = self.layer1(x) out = self.layer2(out) out = self.layer3(out) out = self.layer4(out) out = self.layer5(out) out = self.layer6(out) out = self.layer7(out) out = self.layer8(out) return out def forward(self, data): (e1, e2) = self.patch_keys # Oneline o1 = self.target_keys[0] p1 = data[e1] p2 = data[e2] x12 = torch.cat([p1, p2], axis=1) data[o1] = self._forward(x12) # Double if self.variant == 'doubleline': o2 = self.target_keys[1] x21 = torch.cat([p2, p1], axis=1) data[o2] = self._forward(x21) return data def predict_homography(self, data): return self.forward(data)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 13, 3166, 4765, 29889, 1627, 29890, 2873, 29889, 13239, 1053, 2538, 6779, 29945, 29900, 1168, 29894, 7445, 13, 3166, 4765, 29889, 1627, 29890, 2873, 29889, 13239, 1053, 2538, 6779, 29945, 29900, 18415, 7445, 13, 3166, 4765, 29889, 1627, 29890, 2873, 29889, 13239, 1053, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 13, 3166, 4765, 29889, 1627, 29890, 2873, 29889, 13239, 1053, 2538, 6779, 29941, 29946, 1168, 29894, 7445, 13, 3166, 4765, 29889, 1627, 29890, 2873, 29889, 13239, 1053, 2538, 6779, 29941, 29946, 18415, 7445, 13, 13, 13, 1990, 8125, 29898, 15755, 29889, 7355, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 3195, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 3027, 29918, 2311, 353, 9049, 5085, 1839, 2382, 29918, 14226, 2033, 13, 4706, 1583, 29889, 5041, 29918, 8149, 353, 9049, 5085, 1839, 29925, 14789, 29918, 10818, 29903, 2033, 13, 4706, 1583, 29889, 5182, 29918, 8149, 353, 9049, 5085, 1839, 29911, 1718, 7194, 29918, 10818, 29903, 2033, 13, 13, 4706, 1583, 29889, 690, 1212, 29918, 1271, 353, 9049, 5085, 1839, 15989, 6006, 29918, 29933, 21339, 2033, 13, 4706, 1583, 29889, 1457, 3018, 1312, 29918, 690, 1212, 353, 9049, 5085, 1839, 15094, 29911, 4717, 1177, 3352, 29918, 15989, 6006, 2033, 13, 13, 4706, 1583, 29889, 19365, 353, 851, 29889, 13609, 29898, 19290, 1839, 26865, 29902, 13566, 11287, 565, 525, 26865, 29902, 13566, 29915, 297, 9049, 5085, 1683, 525, 265, 5570, 29915, 13, 4706, 4974, 525, 265, 5570, 29915, 297, 1583, 29889, 19365, 470, 525, 8896, 1220, 29915, 297, 1583, 29889, 19365, 29892, 525, 11730, 3118, 3542, 470, 11599, 3542, 17305, 338, 29915, 320, 13, 462, 462, 462, 462, 3986, 525, 23765, 29915, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29896, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 1583, 29889, 13148, 29896, 353, 302, 29876, 29889, 16941, 2556, 29898, 15755, 29889, 1168, 29894, 29906, 29881, 29898, 262, 29918, 305, 12629, 29922, 29906, 29892, 714, 29918, 305, 12629, 29922, 29953, 29946, 29892, 8466, 29918, 2311, 29922, 29955, 29892, 7164, 29922, 29941, 29892, 380, 2426, 29922, 29906, 29892, 13, 462, 462, 795, 24003, 29922, 8824, 511, 13, 462, 462, 1678, 302, 29876, 29889, 23145, 29940, 555, 29906, 29881, 29898, 29953, 29946, 511, 13, 462, 462, 1678, 302, 29876, 29889, 1123, 29931, 29965, 3285, 13, 462, 462, 1678, 302, 29876, 29889, 7976, 11426, 29906, 29881, 29898, 17460, 29918, 2311, 29922, 29941, 29892, 380, 2426, 29922, 29906, 29892, 7164, 29922, 29896, 876, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29906, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 1583, 29889, 13148, 29906, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29945, 29900, 1168, 29894, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 29892, 1962, 29918, 305, 12629, 29922, 29906, 29945, 29953, 29892, 380, 2426, 29922, 29896, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 876, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 1583, 29889, 13148, 29906, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29941, 29946, 1168, 29894, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 29892, 1962, 29918, 305, 12629, 29922, 29953, 29946, 29892, 380, 2426, 29922, 29896, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 876, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29941, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 1583, 29889, 13148, 29941, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29945, 29900, 1168, 29894, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 29892, 1962, 29918, 305, 12629, 29922, 29945, 29896, 29906, 29892, 380, 2426, 29922, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 876, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 1583, 29889, 13148, 29941, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29941, 29946, 1168, 29894, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 29892, 1962, 29918, 305, 12629, 29922, 29896, 29906, 29947, 29892, 380, 2426, 29922, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 876, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29946, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 1583, 29889, 13148, 29946, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29945, 29900, 1168, 29894, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 29892, 1962, 29918, 305, 12629, 29922, 29896, 29900, 29906, 29946, 29892, 380, 2426, 29922, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29900, 29906, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29900, 29906, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29900, 29906, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29900, 29906, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29900, 29906, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29900, 29906, 29946, 876, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 1583, 29889, 13148, 29946, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29941, 29946, 1168, 29894, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 29892, 1962, 29918, 305, 12629, 29922, 29906, 29945, 29953, 29892, 380, 2426, 29922, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 876, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29945, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 1583, 29889, 13148, 29945, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29945, 29896, 29906, 876, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 1583, 29889, 13148, 29945, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 876, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29953, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 1583, 29889, 13148, 29953, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29906, 29945, 29953, 876, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 1583, 29889, 13148, 29953, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29953, 29946, 876, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29955, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 1583, 29889, 13148, 29955, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29945, 29900, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29896, 29906, 29947, 876, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 1583, 29889, 13148, 29955, 353, 302, 29876, 29889, 16941, 2556, 29898, 1666, 6779, 29941, 29946, 18415, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29941, 29906, 511, 13, 462, 462, 4706, 2538, 6779, 29945, 29900, 2772, 20580, 7445, 29898, 2080, 29918, 305, 12629, 29922, 29941, 29906, 876, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 317, 6040, 1692, 29871, 29947, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 1583, 29889, 13148, 29947, 353, 302, 29876, 29889, 16941, 2556, 29898, 15755, 29889, 1168, 29894, 29906, 29881, 29898, 262, 29918, 305, 12629, 29922, 29953, 29946, 29892, 714, 29918, 305, 12629, 29922, 29945, 29896, 29906, 29892, 8466, 29918, 2311, 29922, 29896, 29892, 7164, 29922, 29900, 29892, 380, 2426, 29922, 29896, 511, 13, 462, 462, 4706, 302, 29876, 29889, 23145, 29940, 555, 29906, 29881, 29898, 29945, 29896, 29906, 511, 302, 29876, 29889, 1123, 29931, 29965, 3285, 13, 462, 462, 4706, 302, 29876, 29889, 1168, 29894, 29906, 29881, 29898, 262, 29918, 305, 12629, 29922, 29945, 29896, 29906, 29892, 714, 29918, 305, 12629, 29922, 29906, 29892, 8466, 29918, 2311, 29922, 29896, 29892, 7164, 29922, 29900, 29892, 380, 2426, 29922, 29896, 876, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 1583, 29889, 13148, 29947, 353, 302, 29876, 29889, 16941, 2556, 29898, 15755, 29889, 1168, 29894, 29906, 29881, 29898, 262, 29918, 305, 12629, 29922, 29896, 29953, 29892, 714, 29918, 305, 12629, 29922, 29896, 29906, 29947, 29892, 8466, 29918, 2311, 29922, 29896, 29892, 7164, 29922, 29900, 29892, 380, 2426, 29922, 29896, 511, 13, 462, 462, 4706, 302, 29876, 29889, 23145, 29940, 555, 29906, 29881, 29898, 29896, 29906, 29947, 511, 302, 29876, 29889, 1123, 29931, 29965, 3285, 13, 462, 462, 4706, 302, 29876, 29889, 1168, 29894, 29906, 29881, 29898, 262, 29918, 305, 12629, 29922, 29896, 29906, 29947, 29892, 714, 29918, 305, 12629, 29922, 29906, 29892, 8466, 29918, 2311, 29922, 29896, 29892, 7164, 29922, 29900, 29892, 380, 2426, 29922, 29896, 876, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 4706, 396, 16012, 758, 3018, 1312, 2538, 1212, 29945, 29900, 18177, 13, 4706, 835, 13383, 13383, 13383, 13383, 4136, 13, 13, 4706, 565, 1583, 29889, 1457, 3018, 1312, 29918, 690, 1212, 29901, 13, 9651, 1583, 3032, 1359, 29918, 1457, 3018, 1312, 29918, 705, 5861, 580, 13, 13, 1678, 822, 903, 1359, 29918, 1457, 3018, 1312, 29918, 705, 5861, 29898, 1311, 1125, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 4706, 396, 22305, 740, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 13, 4706, 822, 19508, 29898, 1025, 29918, 8977, 29892, 2030, 29918, 978, 29892, 716, 29918, 978, 1125, 13, 9651, 716, 29918, 8977, 353, 6571, 13, 9651, 363, 1820, 29892, 995, 297, 14319, 29898, 1025, 29918, 8977, 29889, 8149, 3285, 2030, 29918, 8977, 29889, 5975, 580, 1125, 13, 18884, 716, 29918, 1989, 353, 1820, 565, 1820, 2804, 2030, 29918, 978, 1683, 716, 29918, 978, 13, 18884, 716, 29918, 8977, 29961, 1482, 29918, 1989, 29962, 353, 2030, 29918, 8977, 29961, 1989, 29962, 13, 9651, 736, 716, 29918, 8977, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 4706, 396, 25553, 18177, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 13, 4706, 396, 3617, 758, 3018, 1312, 18177, 13, 4706, 515, 4842, 305, 29889, 29882, 431, 1053, 2254, 29918, 3859, 29918, 8977, 29918, 3166, 29918, 2271, 13, 4706, 565, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29945, 29900, 2396, 13, 9651, 620, 1212, 29918, 2271, 353, 525, 991, 597, 10382, 29889, 2272, 7345, 305, 29889, 990, 29914, 9794, 29914, 690, 1212, 29945, 29900, 29899, 29896, 29929, 29883, 29947, 29872, 29941, 29945, 29955, 29889, 29886, 386, 29915, 13, 4706, 25342, 1583, 29889, 690, 1212, 29918, 1271, 1275, 525, 1666, 6779, 29941, 29946, 2396, 13, 9651, 620, 1212, 29918, 2271, 353, 525, 991, 597, 10382, 29889, 2272, 7345, 305, 29889, 990, 29914, 9794, 29914, 690, 1212, 29941, 29946, 29899, 29941, 29941, 29941, 29888, 29955, 687, 29946, 29889, 29886, 386, 29915, 13, 4706, 1683, 29901, 13, 9651, 4974, 7700, 29892, 525, 29902, 1073, 871, 2538, 6779, 29945, 29900, 322, 2538, 6779, 29941, 29946, 29915, 13, 4706, 620, 1212, 29918, 4299, 29918, 3859, 353, 2254, 29918, 3859, 29918, 8977, 29918, 3166, 29918, 2271, 29898, 690, 1212, 29918, 2271, 29892, 6728, 29922, 5574, 29897, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 4706, 396, 365, 2747, 29871, 29896, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 13, 4706, 7546, 29896, 29918, 690, 1212, 353, 9657, 29898, 4572, 29898, 2892, 21268, 29901, 525, 13148, 29896, 29915, 297, 21268, 29961, 29900, 1402, 620, 1212, 29918, 4299, 29918, 3859, 29889, 7076, 22130, 13, 4706, 363, 321, 297, 1051, 29898, 13148, 29896, 29918, 690, 1212, 29889, 8149, 580, 1125, 13, 9651, 3646, 29918, 1989, 353, 321, 13, 9651, 565, 525, 13148, 29896, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 13148, 29896, 742, 525, 13148, 29906, 1495, 13, 9651, 565, 525, 20580, 29896, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29896, 742, 525, 21064, 29918, 17519, 29889, 29900, 1495, 13, 9651, 565, 525, 11197, 29896, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29896, 742, 525, 21064, 29918, 17519, 29889, 29896, 1495, 13, 9651, 565, 525, 20580, 29906, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29906, 742, 525, 21064, 29918, 17519, 29889, 29941, 1495, 13, 9651, 565, 525, 11197, 29906, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29906, 742, 525, 21064, 29918, 17519, 29889, 29946, 1495, 13, 9651, 565, 525, 20580, 29941, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29941, 742, 525, 21064, 29918, 17519, 29889, 29953, 1495, 13, 9651, 565, 525, 11197, 29941, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29941, 742, 525, 21064, 29918, 17519, 29889, 29955, 1495, 13, 9651, 565, 525, 3204, 11249, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 3204, 11249, 742, 525, 13609, 29918, 17519, 1495, 13, 9651, 7546, 29896, 29918, 690, 1212, 353, 19508, 29898, 13148, 29896, 29918, 690, 1212, 29892, 321, 29892, 3646, 29918, 1989, 29897, 13, 13, 4706, 1904, 29918, 8977, 353, 1583, 29889, 3859, 29918, 8977, 580, 13, 4706, 1904, 29918, 8977, 353, 9657, 29898, 4572, 29898, 2892, 21268, 29901, 525, 13148, 29906, 29915, 297, 21268, 29961, 29900, 1402, 1904, 29918, 8977, 29889, 7076, 22130, 13, 4706, 363, 321, 297, 7546, 29896, 29918, 690, 1212, 29889, 8149, 7295, 13, 9651, 565, 7546, 29896, 29918, 690, 1212, 29961, 29872, 1822, 12181, 2804, 1904, 29918, 8977, 29961, 29872, 1822, 12181, 29901, 13, 18884, 1596, 877, 13148, 29896, 29901, 7791, 2303, 4690, 4214, 399, 3919, 399, 29934, 20614, 29991, 742, 7546, 29896, 29918, 690, 1212, 29961, 29872, 1822, 12181, 29892, 1904, 29918, 8977, 29961, 29872, 1822, 12181, 29897, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 4706, 396, 365, 2747, 29871, 29906, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 13, 4706, 7546, 29906, 29918, 690, 1212, 353, 9657, 29898, 4572, 29898, 2892, 21268, 29901, 525, 13148, 29906, 29915, 297, 21268, 29961, 29900, 1402, 620, 1212, 29918, 4299, 29918, 3859, 29889, 7076, 22130, 13, 4706, 363, 321, 297, 1051, 29898, 13148, 29906, 29918, 690, 1212, 29889, 8149, 580, 1125, 13, 9651, 3646, 29918, 1989, 353, 321, 13, 9651, 565, 525, 13148, 29906, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 13148, 29906, 742, 525, 13148, 29941, 1495, 13, 9651, 565, 525, 20580, 29896, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29896, 742, 525, 21064, 29918, 17519, 29889, 29900, 1495, 13, 9651, 565, 525, 11197, 29896, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29896, 742, 525, 21064, 29918, 17519, 29889, 29896, 1495, 13, 9651, 565, 525, 20580, 29906, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29906, 742, 525, 21064, 29918, 17519, 29889, 29941, 1495, 13, 9651, 565, 525, 11197, 29906, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29906, 742, 525, 21064, 29918, 17519, 29889, 29946, 1495, 13, 9651, 565, 525, 20580, 29941, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29941, 742, 525, 21064, 29918, 17519, 29889, 29953, 1495, 13, 9651, 565, 525, 11197, 29941, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29941, 742, 525, 21064, 29918, 17519, 29889, 29955, 1495, 13, 9651, 565, 525, 3204, 11249, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 3204, 11249, 742, 525, 13609, 29918, 17519, 1495, 13, 9651, 7546, 29906, 29918, 690, 1212, 353, 19508, 29898, 13148, 29906, 29918, 690, 1212, 29892, 321, 29892, 3646, 29918, 1989, 29897, 13, 13, 4706, 1904, 29918, 8977, 353, 1583, 29889, 3859, 29918, 8977, 580, 13, 4706, 1904, 29918, 8977, 353, 9657, 29898, 4572, 29898, 2892, 21268, 29901, 525, 13148, 29941, 29915, 297, 21268, 29961, 29900, 1402, 1904, 29918, 8977, 29889, 7076, 22130, 13, 4706, 363, 321, 297, 7546, 29906, 29918, 690, 1212, 29889, 8149, 7295, 13, 9651, 565, 7546, 29906, 29918, 690, 1212, 29961, 29872, 1822, 12181, 2804, 1904, 29918, 8977, 29961, 29872, 1822, 12181, 29901, 13, 18884, 1596, 877, 13148, 29906, 29901, 7791, 2303, 4690, 4214, 399, 3919, 399, 29934, 20614, 29991, 742, 7546, 29906, 29918, 690, 1212, 29961, 29872, 1822, 12181, 29892, 1904, 29918, 8977, 29961, 29872, 1822, 12181, 29892, 321, 29897, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 4706, 396, 365, 2747, 29871, 29941, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 13, 4706, 7546, 29941, 29918, 690, 1212, 353, 9657, 29898, 4572, 29898, 2892, 21268, 29901, 525, 13148, 29941, 29915, 297, 21268, 29961, 29900, 1402, 620, 1212, 29918, 4299, 29918, 3859, 29889, 7076, 22130, 13, 4706, 363, 321, 297, 1051, 29898, 13148, 29941, 29918, 690, 1212, 29889, 8149, 580, 1125, 13, 9651, 3646, 29918, 1989, 353, 321, 13, 9651, 565, 525, 13148, 29941, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 13148, 29941, 742, 525, 13148, 29946, 1495, 13, 9651, 565, 525, 20580, 29896, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29896, 742, 525, 21064, 29918, 17519, 29889, 29900, 1495, 13, 9651, 565, 525, 11197, 29896, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29896, 742, 525, 21064, 29918, 17519, 29889, 29896, 1495, 13, 9651, 565, 525, 20580, 29906, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29906, 742, 525, 21064, 29918, 17519, 29889, 29941, 1495, 13, 9651, 565, 525, 11197, 29906, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29906, 742, 525, 21064, 29918, 17519, 29889, 29946, 1495, 13, 9651, 565, 525, 20580, 29941, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 20580, 29941, 742, 525, 21064, 29918, 17519, 29889, 29953, 1495, 13, 9651, 565, 525, 11197, 29941, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 11197, 29941, 742, 525, 21064, 29918, 17519, 29889, 29955, 1495, 13, 9651, 565, 525, 3204, 11249, 29915, 297, 3646, 29918, 1989, 29901, 13, 18884, 3646, 29918, 1989, 353, 3646, 29918, 1989, 29889, 6506, 877, 3204, 11249, 742, 525, 13609, 29918, 17519, 1495, 13, 9651, 7546, 29941, 29918, 690, 1212, 353, 19508, 29898, 13148, 29941, 29918, 690, 1212, 29892, 321, 29892, 3646, 29918, 1989, 29897, 13, 13, 4706, 1904, 29918, 8977, 353, 1583, 29889, 3859, 29918, 8977, 580, 13, 4706, 1904, 29918, 8977, 353, 9657, 29898, 4572, 29898, 2892, 21268, 29901, 525, 13148, 29946, 29915, 297, 21268, 29961, 29900, 1402, 1904, 29918, 8977, 29889, 7076, 22130, 13, 4706, 363, 321, 297, 7546, 29941, 29918, 690, 1212, 29889, 8149, 7295, 13, 9651, 565, 7546, 29941, 29918, 690, 1212, 29961, 29872, 1822, 12181, 2804, 1904, 29918, 8977, 29961, 29872, 1822, 12181, 29901, 13, 18884, 1596, 877, 13148, 29941, 29901, 7791, 2303, 4690, 4214, 399, 3919, 399, 29934, 20614, 29991, 742, 7546, 29941, 29918, 690, 1212, 29961, 29872, 1822, 12181, 29892, 1904, 29918, 8977, 29961, 29872, 1822, 12181, 29892, 321, 29897, 13, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 4706, 396, 16012, 18177, 13, 4706, 835, 13383, 13383, 13383, 13383, 13, 13, 4706, 1583, 29889, 1359, 29918, 3859, 29918, 8977, 3319, 1068, 13148, 29896, 29918, 690, 1212, 29892, 3579, 13148, 29906, 29918, 690, 1212, 29892, 3579, 13148, 29941, 29918, 690, 1212, 1118, 9406, 29922, 8824, 29897, 13, 13, 1678, 822, 903, 11333, 29898, 1311, 29892, 921, 1125, 13, 4706, 396, 1152, 1328, 13, 4706, 714, 353, 1583, 29889, 13148, 29896, 29898, 29916, 29897, 13, 4706, 714, 353, 1583, 29889, 13148, 29906, 29898, 449, 29897, 13, 4706, 714, 353, 1583, 29889, 13148, 29941, 29898, 449, 29897, 13, 4706, 714, 353, 1583, 29889, 13148, 29946, 29898, 449, 29897, 13, 4706, 714, 353, 1583, 29889, 13148, 29945, 29898, 449, 29897, 13, 4706, 714, 353, 1583, 29889, 13148, 29953, 29898, 449, 29897, 13, 4706, 714, 353, 1583, 29889, 13148, 29955, 29898, 449, 29897, 13, 4706, 714, 353, 1583, 29889, 13148, 29947, 29898, 449, 29897, 13, 4706, 736, 714, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 848, 1125, 13, 13, 4706, 313, 29872, 29896, 29892, 321, 29906, 29897, 353, 1583, 29889, 5041, 29918, 8149, 13, 13, 4706, 396, 1551, 5570, 13, 4706, 288, 29896, 353, 1583, 29889, 5182, 29918, 8149, 29961, 29900, 29962, 13, 4706, 282, 29896, 353, 848, 29961, 29872, 29896, 29962, 13, 4706, 282, 29906, 353, 848, 29961, 29872, 29906, 29962, 13, 4706, 921, 29896, 29906, 353, 4842, 305, 29889, 4117, 4197, 29886, 29896, 29892, 282, 29906, 1402, 9685, 29922, 29896, 29897, 13, 4706, 848, 29961, 29877, 29896, 29962, 353, 1583, 3032, 11333, 29898, 29916, 29896, 29906, 29897, 13, 13, 4706, 396, 11599, 13, 4706, 565, 1583, 29889, 19365, 1275, 525, 8896, 1220, 2396, 13, 9651, 288, 29906, 353, 1583, 29889, 5182, 29918, 8149, 29961, 29896, 29962, 13, 9651, 921, 29906, 29896, 353, 4842, 305, 29889, 4117, 4197, 29886, 29906, 29892, 282, 29896, 1402, 9685, 29922, 29896, 29897, 13, 9651, 848, 29961, 29877, 29906, 29962, 353, 1583, 3032, 11333, 29898, 29916, 29906, 29896, 29897, 13, 13, 4706, 736, 848, 13, 13, 1678, 822, 8500, 29918, 9706, 5275, 29898, 1311, 29892, 848, 1125, 13, 4706, 736, 1583, 29889, 11333, 29898, 1272, 29897, 13, 2 ]
cairotext/templatetags/cairotext.py
akaihola/django-cairo-text
4
61076
from django import template register = template.Library() from django.template import Node, TemplateSyntaxError, Variable from django.core.mail import mail_admins try: from hashlib import md5 except ImportError: from md5 import md5 import struct from urlparse import urljoin from os import remove, rename from os.path import join, abspath, exists, split from pprint import pformat from subprocess import Popen, PIPE import cairo from django.conf import settings PARAM_KEYWORDS = set( ['font', 'size', 'baseline', 'height', 'color', 'background']) _colors = { 'aliceblue':'#f0f8ff','antiquewhite':'#faebd7','aqua':'#00ffff', 'aquamarine':'#7fffd4','azure':'#f0ffff','beige':'#f5f5dc', 'bisque':'#ffe4c4','black':'#000000','blanchedalmond':'#ffebcd', 'blue':'#0000ff','blueviolet':'#8a2be2','brown':'#a52a2a', 'burlywood':'#deb887','cadetblue':'#5f9ea0','chartreuse':'#7fff00', 'chocolate':'#d2691e','coral':'#ff7f50','cornflowerblue':'#6495ed', 'cornsilk':'#fff8dc','crimson':'#dc143c','cyan':'#00ffff', 'darkblue':'#00008b','darkcyan':'#008b8b','darkgoldenrod':'#b8860b', 'darkgray':'#a9a9a9','darkgreen':'#006400','darkkhaki':'#bdb76b', 'darkmagenta':'#8b008b','darkolivegreen':'#556b2f','darkorange':'#ff8c00', 'darkorchid':'#9932cc','darkred':'#8b0000','darksalmon':'#e9967a', 'darkseagreen':'#8fbc8f','darkslateblue':'#483d8b', 'darkslategray':'#2f4f4f','darkturquoise':'#00ced1','darkviolet':'#9400d3', 'deeppink':'#ff1493','deepskyblue':'#00bfff','dimgray':'#696969', 'dodgerblue':'#1e90ff','firebrick':'#b22222','floralwhite':'#fffaf0', 'forestgreen':'#228b22','fuchsia':'#ff00ff','gainsboro':'#dcdcdc', 'ghostwhite':'#f8f8ff','gold':'#ffd700','goldenrod':'#daa520', 'gray':'#808080','green':'#008000','greenyellow':'#adff2f', 'honeydew':'#f0fff0','hotpink':'#ff69b4','indianred':'#cd5c5c', 'indigo':'#4b0082','ivory':'#fffff0','khaki':'#f0e68c', 'lavender':'#e6e6fa','lavenderblush':'#fff0f5','lawngreen':'#7cfc00', 'lemonchiffon':'#fffacd','lightblue':'#add8e6','lightcoral':'#f08080', 'lightcyan':'#e0ffff','lightgoldenrodyellow':'#fafad2', 'lightgreen':'#90ee90','lightgrey':'#d3d3d3','lightpink':'#ffb6c1', 'lightsalmon':'#ffa07a','lightseagreen':'#20b2aa','lightskyblue':'#87cefa', 'lightslategray':'#778899','lightsteelblue':'#b0c4de', 'lightyellow':'#ffffe0','lime':'#00ff00','limegreen':'#32cd32', 'linen':'#faf0e6','magenta':'#ff00ff','maroon':'#800000', 'mediumaquamarine':'#66cdaa','mediumblue':'#0000cd', 'mediumorchid':'#ba55d3','mediumpurple':'#9370db', 'mediumseagreen':'#3cb371','mediumslateblue':'#7b68ee', 'mediumspringgreen':'#00fa9a','mediumturquoise':'#48d1cc', 'mediumvioletred':'#c71585','midnightblue':'#191970','mintcream':'#f5fffa', 'mistyrose':'#ffe4e1','moccasin':'#ffe4b5','navajowhite':'#ffdead', 'navy':'#000080','oldlace':'#fdf5e6','olive':'#808000', 'olivedrab':'#6b8e23','orange':'#ffa500','orangered':'#ff4500', 'orchid':'#da70d6','palegoldenrod':'#eee8aa','palegreen':'#98fb98', 'paleturquoise':'#afeeee','palevioletred':'#db7093','papayawhip':'#ffefd5', 'peachpuff':'#ffdab9','peru':'#cd853f','pink':'#ffc0cb','plum':'#dda0dd', 'powderblue':'#b0e0e6','purple':'#800080','red':'#ff0000', 'rosybrown':'#bc8f8f','royalblue':'#4169e1','saddlebrown':'#8b4513', 'salmon':'#fa8072','sandybrown':'#f4a460','seagreen':'#2e8b57', 'seashell':'#fff5ee','sienna':'#a0522d','silver':'#c0c0c0', 'skyblue':'#87ceeb','slateblue':'#6a5acd','slategray':'#708090', 'snow':'#fffafa','springgreen':'#00ff7f','steelblue':'#4682b4', 'tan':'#d2b48c','teal':'#008080','thistle':'#d8bfd8','tomato':'#ff6347', 'turquoise':'#40e0d0','violet':'#ee82ee','wheat':'#f5deb3', 'white':'#ffffff','whitesmoke':'#f5f5f5','yellow':'#ffff00', 'yellowgreen':'#9acd32'} def convert_color(s): if not isinstance(s, basestring): return s if not s.startswith('#'): s = _colors[s] l = len(s) if l in (4, 5): c = [int(x*2, 16)/255.0 for x in s[1:]] elif l in (7, 9): c = [int(s[i:i+2], 16)/255.0 for i in range(1, l, 2)] else: raise ValueError('color %r has invalid length' % s) if len(c) < 4: c.append(1) return tuple(c) def read_png_chunk(pngfile): "Read a PNG chunk from the input file, return tag name and data." # http://www.w3.org/TR/PNG/#5Chunk-layout data_bytes, tag = struct.unpack('!I4s', pngfile.read(8)) data = pngfile.read(data_bytes) return tag, data def get_png_size(filepath): pngfile = file(filepath, 'rb') signature = pngfile.read(8) if (signature != struct.pack("8B", 137, 80, 78, 71, 13, 10, 26, 10)): raise ValueError("Invalid PNG signature") while True: try: tag, data = read_png_chunk(pngfile) except ValueError, e: raise ValueError('Invalid PNG file: ' + e.args[0]) if tag == 'IHDR': # http://www.w3.org/TR/PNG/#11IHDR return struct.unpack("!2I5B", data)[:2] raise ValueError('PNG header not found') def render_text(text, filepath, params): size = params.get('size', 18) weight = cairo.FONT_WEIGHT_NORMAL style = cairo.FONT_SLANT_NORMAL font = params.get('font', 'Sans') surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1, 1) context = cairo.Context(surface) context.select_font_face(font, style, weight) context.set_font_size(size) extents = context.text_extents(text) x = -extents[0] baseline = params.get('baseline', -extents[1]) width = max(1, extents[2]) height = max(1, params.get('height', extents[3])) surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, int(width), int(height)) font_options = surface.get_font_options() font_options.set_antialias(cairo.ANTIALIAS_GRAY) context = cairo.Context(surface) # Paint the background, default is white. background = convert_color(params.get('background', (1, 1, 1, 1))) context.set_source_rgba(*background) context.paint() color = convert_color(params.get('color', (0, 0, 0, 1))) # black context.set_source_rgba(*color) context.select_font_face(font, style, weight) context.set_font_size(size) # We need to adjust by the text's offsets to center it. context.move_to(x, baseline) # We stroke and fill to make sure thinner parts are visible. context.text_path(text) #context.set_line_width(0.05) #context.stroke_preserve() context.fill() filepath = abspath(filepath) try: surface.write_to_png(filepath) except IOError, e: raise IOError("Can't save image in %r: %s\n" "Text: %r\n" "Parameters: %r" % (filepath, e, text, params)) optimizer = Optimizer() if optimizer.is_enabled(): optimizer.optimize(filepath) surface.finish() return int(width), int(height) class OptimizerError(Exception): pass class Optimizer(object): def __init__(self): self.cmdline_template = getattr( settings, 'CAIROTEXT_OPTIMIZER', None) self.dest_path_template = getattr( settings, 'CAIROTEXT_OPTIMIZED_PATH', None) def is_enabled(self): return self.cmdline_template and self.dest_path_template def optimize(self, filepath): self.filepath = filepath params = self.get_params_for(filepath) self.cmdline = self.cmdline_template % params self.dest_path = self.dest_path_template % params process = Popen(self.cmdline, shell=True, stdout=PIPE, stderr=PIPE) self.stdout, self.stderr = process.stdout.read(), process.stderr.read() self.retval = process.wait() if self.retval: self.error('Cairotext external optimizer failure') elif not exists(self.dest_path): self.error('Cairotext optimized image missing') elif self.stdout or self.stderr: if not self.stderr.startswith('libpng warning: '): self.error('Cairotext optimizer output') if exists(self.dest_path): # os.rename overwrites existing destination rename(self.dest_path, filepath) def get_params_for(self, filepath): directory, filename = split(filepath) name, ext = filename.rsplit('.', 1) return {'path': filepath, 'directory': directory, 'name': name, 'ext': ext} def error(self, subject): message = ( 'Original PNG path: %s\n' 'Optimized PNG path: %s\n' 'Optimizer command line: %s\n' 'Optimizer return value: %d\n%s%s' % ( self.filepath, self.dest_path, self.cmdline, self.retval, self.stdout, self.stderr)) if settings.DEBUG: raise OptimizerError(message) else: mail_admins(subject, message, fail_silently=True) class TextImage(object): def __init__(self, url, path, size): self.url = url self.path = path self.width, self.height = size def _embed(self): if not hasattr(self, '_base64'): self._base64 = ('data:image/png;base64,%s' % file(self.path).read().encode('base64')[:-1]) return self._base64 embed = property(_embed) class GetTextImageNode(Node): def __init__(self, base_params, text, overrides, varname): self.base_params = base_params self.text = text self.overrides = overrides self.varname = varname def render(self, context): params = {} if self.base_params is not None: params = self.base_params.resolve(context) if isinstance(params, basestring): try: presets = settings.CAIROTEXT_PRESETS params = dict(presets[params]) except (AttributeError, KeyError): raise KeyError('Preset "%s" not found in ' 'settings.CAIROTEXT_PRESETS' % params) params.update(dict((key, val.resolve(context)) for key, val in self.overrides.items())) text = self.text.resolve(context) name = md5(text.encode('UTF-8') + pformat(params)).hexdigest() render_dir = getattr(settings, 'CAIROTEXT_DIR', 'cairotext_cache') filename = '%s.png' % name fileurl = urljoin(settings.MEDIA_URL, join(render_dir, filename)) filepath = join(settings.MEDIA_ROOT, render_dir, filename) size = None if not exists(filepath): size = render_text(text, filepath, params) pngsize = get_png_size(filepath) assert size is None or size == pngsize, \ 'size mismatch: expected %rx%r, got %rx%r' % (size+pngsize) context[self.varname] = TextImage(fileurl, filepath, pngsize) return '' def compile(parser, value): if value[0] in '-0123456789': return Variable(value) return parser.compile_filter(value) def do_get_text_image(parser, token): """ To use presets from settings.CAIROTEXT_PRESETS['base_params'] and override text color, use: {% get_text_image "Text" color "#aaa" font "Sans" height 20 as img %} <img src="{{img.url}}" width="{{img.width}}" height="{{img.height}}" /> """ bits = token.split_contents() count = len(bits) if count < 4: raise TemplateSyntaxError('%r expects at least 3 arguments') if bits[-2] != 'as': raise TemplateSyntaxError('%r expects "as" as its ' 'second last argument') text = parser.compile_filter(bits[1]) base_params = None if count % 2: base_params = parser.compile_filter(bits[2]) overrides = dict((keyword, compile(parser, value)) for keyword, value in zip(bits[2+count%2:-2:2], bits[3+count%2:-2:2])) varname = bits[-1] unknown_keywords = set(overrides.keys()).difference(PARAM_KEYWORDS) if unknown_keywords: raise TemplateSyntaxError('%r got unknown keywords %s' % ( bits[0], ', '.join(unknown_keywords))) return GetTextImageNode(base_params, text, overrides, varname) do_get_text_image = register.tag('get_text_image', do_get_text_image)
[ 1, 515, 9557, 1053, 4472, 13, 9573, 353, 4472, 29889, 12284, 580, 13, 13, 3166, 9557, 29889, 6886, 1053, 9071, 29892, 25663, 16676, 2392, 29892, 28736, 13, 3166, 9557, 29889, 3221, 29889, 2549, 1053, 10524, 29918, 328, 29885, 1144, 13, 13, 2202, 29901, 13, 1678, 515, 6608, 1982, 1053, 22821, 29945, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 22821, 29945, 1053, 22821, 29945, 13, 5215, 2281, 13, 3166, 3142, 5510, 1053, 3142, 7122, 13, 3166, 2897, 1053, 3349, 29892, 19508, 13, 3166, 2897, 29889, 2084, 1053, 5988, 29892, 633, 1028, 493, 29892, 4864, 29892, 6219, 13, 3166, 282, 2158, 1053, 282, 4830, 13, 3166, 1014, 5014, 1053, 349, 3150, 29892, 349, 29902, 4162, 13, 5215, 274, 26025, 13, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 16320, 5194, 29918, 10818, 11686, 8452, 353, 731, 29898, 13, 1678, 6024, 5657, 742, 525, 2311, 742, 525, 6500, 5570, 742, 525, 3545, 742, 525, 2780, 742, 525, 7042, 11287, 13, 13, 29918, 27703, 353, 426, 13, 1678, 525, 284, 625, 9539, 22099, 29937, 29888, 29900, 29888, 29947, 600, 3788, 424, 1387, 10921, 22099, 29937, 5444, 774, 29881, 29955, 3788, 18463, 29874, 22099, 29937, 29900, 29900, 17156, 742, 13, 1678, 525, 18463, 8715, 457, 22099, 29937, 29955, 600, 11512, 29946, 3788, 17688, 22099, 29937, 29888, 29900, 17156, 3788, 915, 2231, 22099, 29937, 29888, 29945, 29888, 29945, 13891, 742, 13, 1678, 525, 18809, 802, 22099, 29937, 17615, 29946, 29883, 29946, 3788, 8517, 22099, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 3788, 2204, 14588, 287, 284, 8315, 22099, 29937, 600, 774, 2252, 742, 13, 1678, 525, 9539, 22099, 29937, 29900, 29900, 29900, 29900, 600, 3788, 9539, 29894, 601, 1026, 22099, 29937, 29947, 29874, 29906, 915, 29906, 3788, 29890, 4708, 22099, 29937, 29874, 29945, 29906, 29874, 29906, 29874, 742, 13, 1678, 525, 8399, 16239, 22099, 29937, 16529, 29947, 29947, 29955, 3788, 29883, 328, 300, 9539, 22099, 29937, 29945, 29888, 29929, 11248, 29900, 3788, 15425, 276, 1509, 22099, 29937, 29955, 18725, 29900, 29900, 742, 13, 1678, 525, 305, 542, 23167, 22099, 29937, 29881, 29906, 29953, 29929, 29896, 29872, 3788, 2616, 284, 22099, 29937, 600, 29955, 29888, 29945, 29900, 3788, 29883, 1398, 1731, 261, 9539, 22099, 29937, 29953, 29946, 29929, 29945, 287, 742, 13, 1678, 525, 29883, 1398, 25590, 29895, 22099, 29937, 18725, 29947, 13891, 3788, 29883, 5632, 1100, 22099, 29937, 13891, 29896, 29946, 29941, 29883, 3788, 1270, 273, 22099, 29937, 29900, 29900, 17156, 742, 13, 1678, 525, 26031, 9539, 22099, 29937, 29900, 29900, 29900, 29900, 29947, 29890, 3788, 26031, 1270, 273, 22099, 29937, 29900, 29900, 29947, 29890, 29947, 29890, 3788, 26031, 29887, 1025, 264, 5964, 22099, 29937, 29890, 29947, 29947, 29953, 29900, 29890, 742, 13, 1678, 525, 26031, 21012, 22099, 29937, 29874, 29929, 29874, 29929, 29874, 29929, 3788, 26031, 12692, 22099, 29937, 29900, 29900, 29953, 29946, 29900, 29900, 3788, 26031, 15339, 9940, 22099, 29937, 29890, 2585, 29955, 29953, 29890, 742, 13, 1678, 525, 26031, 11082, 6381, 22099, 29937, 29947, 29890, 29900, 29900, 29947, 29890, 3788, 26031, 324, 573, 12692, 22099, 29937, 29945, 29945, 29953, 29890, 29906, 29888, 3788, 26031, 272, 927, 22099, 29937, 600, 29947, 29883, 29900, 29900, 742, 13, 1678, 525, 26031, 25350, 333, 22099, 29937, 29929, 29929, 29941, 29906, 617, 3788, 26031, 1127, 22099, 29937, 29947, 29890, 29900, 29900, 29900, 29900, 3788, 29881, 17862, 284, 3712, 22099, 29937, 29872, 29929, 29929, 29953, 29955, 29874, 742, 13, 1678, 525, 26031, 344, 351, 2733, 22099, 29937, 29947, 29888, 12328, 29947, 29888, 3788, 26031, 2536, 403, 9539, 22099, 29937, 29946, 29947, 29941, 29881, 29947, 29890, 742, 13, 1678, 525, 26031, 2536, 1845, 764, 22099, 29937, 29906, 29888, 29946, 29888, 29946, 29888, 3788, 26031, 29873, 332, 339, 29877, 895, 22099, 29937, 29900, 29900, 1133, 29896, 3788, 26031, 29894, 601, 1026, 22099, 29937, 29929, 29946, 29900, 29900, 29881, 29941, 742, 13, 1678, 525, 311, 29872, 407, 682, 22099, 29937, 600, 29896, 29946, 29929, 29941, 3788, 311, 8961, 3459, 9539, 22099, 29937, 29900, 29900, 29890, 18725, 3788, 29881, 2492, 764, 22099, 29937, 29953, 29929, 29953, 29929, 29953, 29929, 742, 13, 1678, 525, 29881, 397, 914, 9539, 22099, 29937, 29896, 29872, 29929, 29900, 600, 3788, 8696, 1182, 860, 22099, 29937, 29890, 29906, 29906, 29906, 29906, 29906, 3788, 1579, 11251, 10921, 22099, 29937, 18725, 2142, 29900, 742, 13, 1678, 525, 1454, 342, 12692, 22099, 29937, 29906, 29906, 29947, 29890, 29906, 29906, 3788, 29888, 19873, 423, 22099, 29937, 600, 29900, 29900, 600, 3788, 29887, 2708, 4089, 29877, 22099, 29937, 29881, 2252, 2252, 29883, 742, 13, 1678, 525, 29887, 3069, 10921, 22099, 29937, 29888, 29947, 29888, 29947, 600, 3788, 29887, 1025, 22099, 29937, 600, 29881, 29955, 29900, 29900, 3788, 29887, 1025, 264, 5964, 22099, 29937, 1388, 29874, 29945, 29906, 29900, 742, 13, 1678, 525, 21012, 22099, 29937, 29947, 29900, 29947, 29900, 29947, 29900, 3788, 12692, 22099, 29937, 29900, 29900, 29947, 29900, 29900, 29900, 3788, 12692, 29136, 22099, 29937, 328, 600, 29906, 29888, 742, 13, 1678, 525, 29882, 4992, 311, 29893, 22099, 29937, 29888, 29900, 18725, 29900, 3788, 8711, 29886, 682, 22099, 29937, 600, 29953, 29929, 29890, 29946, 3788, 513, 713, 1127, 22099, 29937, 2252, 29945, 29883, 29945, 29883, 742, 13, 1678, 525, 513, 5973, 22099, 29937, 29946, 29890, 29900, 29900, 29947, 29906, 3788, 440, 706, 22099, 29937, 17156, 29888, 29900, 3788, 15339, 9940, 22099, 29937, 29888, 29900, 29872, 29953, 29947, 29883, 742, 13, 1678, 525, 4112, 1581, 22099, 29937, 29872, 29953, 29872, 29953, 5444, 3788, 4112, 1581, 2204, 1878, 22099, 29937, 18725, 29900, 29888, 29945, 3788, 10653, 865, 2733, 22099, 29937, 29955, 6854, 29883, 29900, 29900, 742, 13, 1678, 525, 2409, 265, 305, 2593, 265, 22099, 29937, 600, 17470, 29881, 3788, 4366, 9539, 22099, 29937, 1202, 29947, 29872, 29953, 3788, 4366, 2616, 284, 22099, 29937, 29888, 29900, 29947, 29900, 29947, 29900, 742, 13, 1678, 525, 4366, 1270, 273, 22099, 29937, 29872, 29900, 17156, 3788, 4366, 29887, 1025, 264, 307, 4518, 4743, 22099, 29937, 29888, 2142, 328, 29906, 742, 13, 1678, 525, 4366, 12692, 22099, 29937, 29929, 29900, 3905, 29929, 29900, 3788, 4366, 7979, 29891, 22099, 29937, 29881, 29941, 29881, 29941, 29881, 29941, 3788, 4366, 29886, 682, 22099, 29937, 600, 29890, 29953, 29883, 29896, 742, 13, 1678, 525, 4366, 19585, 3712, 22099, 29937, 600, 29874, 29900, 29955, 29874, 3788, 4366, 344, 351, 2733, 22099, 29937, 29906, 29900, 29890, 29906, 7340, 3788, 4366, 7912, 9539, 22099, 29937, 29947, 29955, 346, 5444, 742, 13, 1678, 525, 4366, 2536, 1845, 764, 22099, 29937, 29955, 29955, 29947, 29947, 29929, 29929, 3788, 4366, 1655, 295, 9539, 22099, 29937, 29890, 29900, 29883, 29946, 311, 742, 13, 1678, 525, 4366, 29136, 22099, 29937, 17156, 29872, 29900, 3788, 28046, 22099, 29937, 29900, 29900, 600, 29900, 29900, 3788, 2576, 387, 2733, 22099, 29937, 29941, 29906, 2252, 29941, 29906, 742, 13, 1678, 525, 1915, 264, 22099, 29937, 29888, 2142, 29900, 29872, 29953, 3788, 11082, 6381, 22099, 29937, 600, 29900, 29900, 600, 3788, 3034, 6150, 22099, 29937, 29947, 29900, 29900, 29900, 29900, 29900, 742, 13, 1678, 525, 27891, 18463, 8715, 457, 22099, 29937, 29953, 29953, 29883, 1388, 29874, 3788, 27891, 9539, 22099, 29937, 29900, 29900, 29900, 29900, 2252, 742, 13, 1678, 525, 27891, 25350, 333, 22099, 29937, 2291, 29945, 29945, 29881, 29941, 3788, 27891, 15503, 552, 22099, 29937, 29929, 29941, 29955, 29900, 2585, 742, 13, 1678, 525, 27891, 344, 351, 2733, 22099, 29937, 29941, 10702, 29941, 29955, 29896, 3788, 27891, 2536, 403, 9539, 22099, 29937, 29955, 29890, 29953, 29947, 3905, 742, 13, 1678, 525, 27891, 4278, 12692, 22099, 29937, 29900, 29900, 5444, 29929, 29874, 3788, 27891, 29873, 332, 339, 29877, 895, 22099, 29937, 29946, 29947, 29881, 29896, 617, 742, 13, 1678, 525, 27891, 29894, 601, 1026, 1127, 22099, 29937, 29883, 29955, 29896, 29945, 29947, 29945, 3788, 6563, 11147, 9539, 22099, 29937, 29896, 29929, 29896, 29929, 29955, 29900, 3788, 29885, 524, 1037, 314, 22099, 29937, 29888, 29945, 600, 5444, 742, 13, 1678, 525, 29885, 391, 29891, 17811, 22099, 29937, 17615, 29946, 29872, 29896, 3788, 29885, 542, 9398, 262, 22099, 29937, 17615, 29946, 29890, 29945, 3788, 29876, 879, 29926, 340, 29882, 568, 22099, 29937, 600, 311, 328, 742, 13, 1678, 525, 29876, 5301, 22099, 29937, 29900, 29900, 29900, 29900, 29947, 29900, 3788, 1025, 1265, 22099, 29937, 29888, 2176, 29945, 29872, 29953, 3788, 324, 573, 22099, 29937, 29947, 29900, 29947, 29900, 29900, 29900, 742, 13, 1678, 525, 324, 2347, 4201, 22099, 29937, 29953, 29890, 29947, 29872, 29906, 29941, 3788, 272, 927, 22099, 29937, 600, 29874, 29945, 29900, 29900, 3788, 272, 4600, 287, 22099, 29937, 600, 29946, 29945, 29900, 29900, 742, 13, 1678, 525, 25350, 333, 22099, 29937, 1388, 29955, 29900, 29881, 29953, 3788, 29886, 744, 29887, 1025, 264, 5964, 22099, 29937, 3905, 29872, 29947, 7340, 3788, 29886, 744, 12692, 22099, 29937, 29929, 29947, 14943, 29929, 29947, 742, 13, 1678, 525, 29886, 9457, 332, 339, 29877, 895, 22099, 29937, 29874, 1725, 3905, 29872, 3788, 29886, 744, 29894, 601, 1026, 1127, 22099, 29937, 2585, 29955, 29900, 29929, 29941, 3788, 29886, 481, 9010, 1332, 666, 22099, 29937, 600, 1389, 29881, 29945, 742, 13, 1678, 525, 412, 496, 29886, 3096, 22099, 29937, 600, 29881, 370, 29929, 3788, 546, 29884, 22099, 29937, 2252, 29947, 29945, 29941, 29888, 3788, 29886, 682, 22099, 29937, 600, 29883, 29900, 10702, 3788, 572, 398, 22099, 29937, 1289, 29874, 29900, 1289, 742, 13, 1678, 525, 12248, 672, 9539, 22099, 29937, 29890, 29900, 29872, 29900, 29872, 29953, 3788, 15503, 552, 22099, 29937, 29947, 29900, 29900, 29900, 29947, 29900, 3788, 1127, 22099, 29937, 600, 29900, 29900, 29900, 29900, 742, 13, 1678, 525, 1883, 29891, 29890, 4708, 22099, 29937, 12328, 29947, 29888, 29947, 29888, 3788, 307, 4605, 9539, 22099, 29937, 29946, 29896, 29953, 29929, 29872, 29896, 3788, 29879, 1202, 19982, 4708, 22099, 29937, 29947, 29890, 29946, 29945, 29896, 29941, 742, 13, 1678, 525, 19585, 3712, 22099, 29937, 5444, 29947, 29900, 29955, 29906, 3788, 29879, 13910, 29890, 4708, 22099, 29937, 29888, 29946, 29874, 29946, 29953, 29900, 3788, 344, 351, 2733, 22099, 29937, 29906, 29872, 29947, 29890, 29945, 29955, 742, 13, 1678, 525, 344, 1161, 514, 22099, 29937, 18725, 29945, 3905, 3788, 29879, 819, 1056, 22099, 29937, 29874, 29900, 29945, 29906, 29906, 29881, 3788, 25590, 369, 22099, 29937, 29883, 29900, 29883, 29900, 29883, 29900, 742, 13, 1678, 525, 7912, 9539, 22099, 29937, 29947, 29955, 346, 774, 3788, 2536, 403, 9539, 22099, 29937, 29953, 29874, 29945, 562, 29881, 3788, 2536, 1845, 764, 22099, 29937, 29955, 29900, 29947, 29900, 29929, 29900, 742, 13, 1678, 525, 29879, 3707, 22099, 29937, 18725, 2142, 29874, 3788, 4278, 12692, 22099, 29937, 29900, 29900, 600, 29955, 29888, 3788, 1655, 295, 9539, 22099, 29937, 29946, 29953, 29947, 29906, 29890, 29946, 742, 13, 1678, 525, 13161, 22099, 29937, 29881, 29906, 29890, 29946, 29947, 29883, 3788, 371, 284, 22099, 29937, 29900, 29900, 29947, 29900, 29947, 29900, 3788, 386, 391, 280, 22099, 29937, 29881, 29947, 1635, 29881, 29947, 3788, 15135, 1219, 22099, 29937, 600, 29953, 29941, 29946, 29955, 742, 13, 1678, 525, 29873, 332, 339, 29877, 895, 22099, 29937, 29946, 29900, 29872, 29900, 29881, 29900, 3788, 29894, 601, 1026, 22099, 29937, 3905, 29947, 29906, 3905, 3788, 29893, 354, 271, 22099, 29937, 29888, 29945, 16529, 29941, 742, 13, 1678, 525, 10921, 22099, 29937, 17156, 600, 3788, 1332, 3246, 4346, 446, 22099, 29937, 29888, 29945, 29888, 29945, 29888, 29945, 3788, 29136, 22099, 29937, 17156, 29900, 29900, 742, 13, 1678, 525, 29136, 12692, 22099, 29937, 29929, 562, 29881, 29941, 29906, 10827, 13, 13, 1753, 3588, 29918, 2780, 29898, 29879, 1125, 13, 1678, 565, 451, 338, 8758, 29898, 29879, 29892, 2362, 342, 5393, 1125, 13, 4706, 736, 269, 13, 1678, 565, 451, 269, 29889, 27382, 2541, 14237, 29374, 13, 4706, 269, 353, 903, 27703, 29961, 29879, 29962, 13, 1678, 301, 353, 7431, 29898, 29879, 29897, 13, 1678, 565, 301, 297, 313, 29946, 29892, 29871, 29945, 1125, 13, 4706, 274, 353, 518, 524, 29898, 29916, 29930, 29906, 29892, 29871, 29896, 29953, 6802, 29906, 29945, 29945, 29889, 29900, 363, 921, 297, 269, 29961, 29896, 29901, 5262, 13, 1678, 25342, 301, 297, 313, 29955, 29892, 29871, 29929, 1125, 13, 4706, 274, 353, 518, 524, 29898, 29879, 29961, 29875, 29901, 29875, 29974, 29906, 1402, 29871, 29896, 29953, 6802, 29906, 29945, 29945, 29889, 29900, 363, 474, 297, 3464, 29898, 29896, 29892, 301, 29892, 29871, 29906, 4638, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 2780, 1273, 29878, 756, 8340, 3309, 29915, 1273, 269, 29897, 13, 1678, 565, 7431, 29898, 29883, 29897, 529, 29871, 29946, 29901, 13, 4706, 274, 29889, 4397, 29898, 29896, 29897, 13, 1678, 736, 18761, 29898, 29883, 29897, 13, 13, 1753, 1303, 29918, 2732, 29918, 29812, 29898, 2732, 1445, 1125, 13, 1678, 376, 6359, 263, 349, 9312, 19875, 515, 278, 1881, 934, 29892, 736, 4055, 1024, 322, 848, 1213, 13, 1678, 396, 1732, 597, 1636, 29889, 29893, 29941, 29889, 990, 29914, 5659, 29914, 29925, 9312, 8484, 29945, 1451, 2960, 29899, 2680, 13, 1678, 848, 29918, 13193, 29892, 4055, 353, 2281, 29889, 348, 4058, 877, 29991, 29902, 29946, 29879, 742, 282, 865, 1445, 29889, 949, 29898, 29947, 876, 13, 1678, 848, 353, 282, 865, 1445, 29889, 949, 29898, 1272, 29918, 13193, 29897, 13, 1678, 736, 4055, 29892, 848, 13, 13, 1753, 679, 29918, 2732, 29918, 2311, 29898, 1445, 2084, 1125, 13, 1678, 282, 865, 1445, 353, 934, 29898, 1445, 2084, 29892, 525, 6050, 1495, 13, 1678, 12608, 353, 282, 865, 1445, 29889, 949, 29898, 29947, 29897, 13, 1678, 565, 313, 4530, 1535, 2804, 2281, 29889, 4058, 703, 29947, 29933, 613, 29871, 29896, 29941, 29955, 29892, 29871, 29947, 29900, 29892, 29871, 29955, 29947, 29892, 29871, 29955, 29896, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29900, 29892, 29871, 29906, 29953, 29892, 29871, 29896, 29900, 22164, 13, 4706, 12020, 7865, 2392, 703, 13919, 349, 9312, 12608, 1159, 13, 1678, 1550, 5852, 29901, 13, 4706, 1018, 29901, 13, 9651, 4055, 29892, 848, 353, 1303, 29918, 2732, 29918, 29812, 29898, 2732, 1445, 29897, 13, 4706, 5174, 7865, 2392, 29892, 321, 29901, 13, 9651, 12020, 7865, 2392, 877, 13919, 349, 9312, 934, 29901, 525, 718, 321, 29889, 5085, 29961, 29900, 2314, 13, 4706, 565, 4055, 1275, 525, 29902, 29950, 8353, 2396, 396, 1732, 597, 1636, 29889, 29893, 29941, 29889, 990, 29914, 5659, 29914, 29925, 9312, 8484, 29896, 29896, 29902, 29950, 8353, 13, 9651, 736, 2281, 29889, 348, 4058, 703, 29991, 29906, 29902, 29945, 29933, 613, 848, 29897, 7503, 29906, 29962, 13, 1678, 12020, 7865, 2392, 877, 29925, 9312, 4839, 451, 1476, 1495, 13, 13, 1753, 4050, 29918, 726, 29898, 726, 29892, 934, 2084, 29892, 8636, 1125, 13, 1678, 2159, 353, 8636, 29889, 657, 877, 2311, 742, 29871, 29896, 29947, 29897, 13, 1678, 7688, 353, 274, 26025, 29889, 29943, 1164, 29911, 29918, 8851, 22530, 29918, 29940, 1955, 1529, 29931, 13, 1678, 3114, 353, 274, 26025, 29889, 29943, 1164, 29911, 29918, 12750, 13566, 29918, 29940, 1955, 1529, 29931, 13, 1678, 4079, 353, 8636, 29889, 657, 877, 5657, 742, 525, 29903, 550, 1495, 13, 13, 1678, 7101, 353, 274, 26025, 29889, 2940, 18498, 2161, 29898, 1113, 3350, 29889, 19094, 1299, 29918, 1718, 7210, 29941, 29906, 29892, 29871, 29896, 29892, 29871, 29896, 29897, 13, 1678, 3030, 353, 274, 26025, 29889, 2677, 29898, 7610, 2161, 29897, 13, 1678, 3030, 29889, 2622, 29918, 5657, 29918, 2161, 29898, 5657, 29892, 3114, 29892, 7688, 29897, 13, 1678, 3030, 29889, 842, 29918, 5657, 29918, 2311, 29898, 2311, 29897, 13, 1678, 1294, 1237, 353, 3030, 29889, 726, 29918, 1062, 1237, 29898, 726, 29897, 13, 1678, 921, 353, 448, 1062, 1237, 29961, 29900, 29962, 13, 1678, 2362, 5570, 353, 8636, 29889, 657, 877, 6500, 5570, 742, 448, 1062, 1237, 29961, 29896, 2314, 13, 1678, 2920, 353, 4236, 29898, 29896, 29892, 1294, 1237, 29961, 29906, 2314, 13, 1678, 3171, 353, 4236, 29898, 29896, 29892, 8636, 29889, 657, 877, 3545, 742, 1294, 1237, 29961, 29941, 12622, 13, 13, 1678, 7101, 353, 274, 26025, 29889, 2940, 18498, 2161, 29898, 1113, 3350, 29889, 19094, 1299, 29918, 1718, 7210, 29941, 29906, 29892, 938, 29898, 2103, 511, 938, 29898, 3545, 876, 13, 1678, 4079, 29918, 6768, 353, 7101, 29889, 657, 29918, 5657, 29918, 6768, 580, 13, 1678, 4079, 29918, 6768, 29889, 842, 29918, 424, 616, 3173, 29898, 1113, 3350, 29889, 13566, 25758, 29902, 3289, 29918, 29954, 22800, 29897, 13, 1678, 3030, 353, 274, 26025, 29889, 2677, 29898, 7610, 2161, 29897, 13, 13, 1678, 396, 349, 2365, 278, 3239, 29892, 2322, 338, 4796, 29889, 13, 1678, 3239, 353, 3588, 29918, 2780, 29898, 7529, 29889, 657, 877, 7042, 742, 313, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 4961, 13, 1678, 3030, 29889, 842, 29918, 4993, 29918, 11007, 2291, 10456, 7042, 29897, 13, 1678, 3030, 29889, 29886, 2365, 580, 13, 13, 1678, 2927, 353, 3588, 29918, 2780, 29898, 7529, 29889, 657, 877, 2780, 742, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 396, 4628, 13, 1678, 3030, 29889, 842, 29918, 4993, 29918, 11007, 2291, 10456, 2780, 29897, 13, 13, 1678, 3030, 29889, 2622, 29918, 5657, 29918, 2161, 29898, 5657, 29892, 3114, 29892, 7688, 29897, 13, 1678, 3030, 29889, 842, 29918, 5657, 29918, 2311, 29898, 2311, 29897, 13, 1678, 396, 1334, 817, 304, 10365, 491, 278, 1426, 29915, 29879, 1283, 7224, 304, 4818, 372, 29889, 13, 1678, 3030, 29889, 11631, 29918, 517, 29898, 29916, 29892, 2362, 5570, 29897, 13, 1678, 396, 1334, 19782, 322, 5445, 304, 1207, 1854, 266, 3993, 5633, 526, 7962, 29889, 13, 1678, 3030, 29889, 726, 29918, 2084, 29898, 726, 29897, 13, 1678, 396, 4703, 29889, 842, 29918, 1220, 29918, 2103, 29898, 29900, 29889, 29900, 29945, 29897, 13, 1678, 396, 4703, 29889, 25893, 29918, 4569, 7143, 580, 13, 1678, 3030, 29889, 5589, 580, 13, 13, 1678, 934, 2084, 353, 633, 1028, 493, 29898, 1445, 2084, 29897, 13, 1678, 1018, 29901, 13, 4706, 7101, 29889, 3539, 29918, 517, 29918, 2732, 29898, 1445, 2084, 29897, 13, 1678, 5174, 10663, 2392, 29892, 321, 29901, 13, 4706, 12020, 10663, 2392, 703, 6028, 29915, 29873, 4078, 1967, 297, 1273, 29878, 29901, 1273, 29879, 29905, 29876, 29908, 13, 462, 418, 376, 1626, 29901, 1273, 29878, 29905, 29876, 29908, 13, 462, 418, 376, 11507, 29901, 1273, 29878, 29908, 1273, 313, 1445, 2084, 29892, 321, 29892, 1426, 29892, 8636, 876, 13, 1678, 5994, 3950, 353, 20693, 326, 3950, 580, 13, 1678, 565, 5994, 3950, 29889, 275, 29918, 17590, 7295, 13, 4706, 5994, 3950, 29889, 20640, 675, 29898, 1445, 2084, 29897, 13, 1678, 7101, 29889, 4951, 728, 580, 13, 13, 1678, 736, 938, 29898, 2103, 511, 938, 29898, 3545, 29897, 13, 13, 1990, 20693, 326, 3950, 2392, 29898, 2451, 1125, 1209, 13, 13, 1990, 20693, 326, 3950, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 9006, 1220, 29918, 6886, 353, 679, 5552, 29898, 13, 9651, 6055, 29892, 525, 5454, 29902, 1672, 16975, 29918, 14094, 7833, 26664, 1001, 742, 6213, 29897, 13, 4706, 1583, 29889, 7854, 29918, 2084, 29918, 6886, 353, 679, 5552, 29898, 13, 9651, 6055, 29892, 525, 5454, 29902, 1672, 16975, 29918, 14094, 7833, 26664, 3352, 29918, 10145, 742, 6213, 29897, 13, 13, 1678, 822, 338, 29918, 17590, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 9006, 1220, 29918, 6886, 322, 1583, 29889, 7854, 29918, 2084, 29918, 6886, 13, 13, 1678, 822, 24656, 29898, 1311, 29892, 934, 2084, 1125, 13, 4706, 1583, 29889, 1445, 2084, 353, 934, 2084, 13, 4706, 8636, 353, 1583, 29889, 657, 29918, 7529, 29918, 1454, 29898, 1445, 2084, 29897, 13, 4706, 1583, 29889, 9006, 1220, 353, 1583, 29889, 9006, 1220, 29918, 6886, 1273, 8636, 13, 4706, 1583, 29889, 7854, 29918, 2084, 353, 1583, 29889, 7854, 29918, 2084, 29918, 6886, 1273, 8636, 13, 4706, 1889, 353, 349, 3150, 29898, 1311, 29889, 9006, 1220, 29892, 6473, 29922, 5574, 29892, 27591, 29922, 2227, 4162, 29892, 380, 20405, 29922, 2227, 4162, 29897, 13, 4706, 1583, 29889, 25393, 29892, 1583, 29889, 303, 20405, 353, 1889, 29889, 25393, 29889, 949, 3285, 1889, 29889, 303, 20405, 29889, 949, 580, 13, 4706, 1583, 29889, 2267, 791, 353, 1889, 29889, 10685, 580, 13, 4706, 565, 1583, 29889, 2267, 791, 29901, 13, 9651, 1583, 29889, 2704, 877, 29907, 26025, 726, 7029, 5994, 3950, 10672, 1495, 13, 4706, 25342, 451, 4864, 29898, 1311, 29889, 7854, 29918, 2084, 1125, 13, 9651, 1583, 29889, 2704, 877, 29907, 26025, 726, 27545, 1967, 4567, 1495, 13, 4706, 25342, 1583, 29889, 25393, 470, 1583, 29889, 303, 20405, 29901, 13, 9651, 565, 451, 1583, 29889, 303, 20405, 29889, 27382, 2541, 877, 1982, 2732, 9177, 29901, 525, 1125, 13, 18884, 1583, 29889, 2704, 877, 29907, 26025, 726, 5994, 3950, 1962, 1495, 13, 4706, 565, 4864, 29898, 1311, 29889, 7854, 29918, 2084, 1125, 13, 9651, 396, 2897, 29889, 1267, 420, 975, 8231, 267, 5923, 12551, 13, 9651, 19508, 29898, 1311, 29889, 7854, 29918, 2084, 29892, 934, 2084, 29897, 13, 13, 1678, 822, 679, 29918, 7529, 29918, 1454, 29898, 1311, 29892, 934, 2084, 1125, 13, 4706, 3884, 29892, 10422, 353, 6219, 29898, 1445, 2084, 29897, 13, 4706, 1024, 29892, 1294, 353, 10422, 29889, 2288, 2830, 12839, 742, 29871, 29896, 29897, 13, 4706, 736, 11117, 2084, 2396, 934, 2084, 29892, 13, 18884, 525, 12322, 2396, 3884, 29892, 13, 18884, 525, 978, 2396, 1024, 29892, 13, 18884, 525, 1062, 2396, 1294, 29913, 13, 13, 1678, 822, 1059, 29898, 1311, 29892, 4967, 1125, 13, 4706, 2643, 353, 313, 13, 9651, 525, 26036, 349, 9312, 2224, 29901, 1273, 29879, 29905, 29876, 29915, 13, 9651, 525, 20624, 326, 1891, 349, 9312, 2224, 29901, 1273, 29879, 29905, 29876, 29915, 13, 9651, 525, 20624, 326, 3950, 1899, 1196, 29901, 1273, 29879, 29905, 29876, 29915, 13, 9651, 525, 20624, 326, 3950, 736, 995, 29901, 1273, 29881, 29905, 29876, 29995, 29879, 29995, 29879, 29915, 1273, 313, 13, 18884, 1583, 29889, 1445, 2084, 29892, 1583, 29889, 7854, 29918, 2084, 29892, 1583, 29889, 9006, 1220, 29892, 13, 18884, 1583, 29889, 2267, 791, 29892, 1583, 29889, 25393, 29892, 1583, 29889, 303, 20405, 876, 13, 4706, 565, 6055, 29889, 18525, 29901, 13, 9651, 12020, 20693, 326, 3950, 2392, 29898, 4906, 29897, 13, 4706, 1683, 29901, 13, 9651, 10524, 29918, 328, 29885, 1144, 29898, 16009, 29892, 2643, 29892, 4418, 29918, 25590, 2705, 29922, 5574, 29897, 13, 13, 1990, 3992, 2940, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3142, 29892, 2224, 29892, 2159, 1125, 13, 4706, 1583, 29889, 2271, 353, 3142, 13, 4706, 1583, 29889, 2084, 353, 2224, 13, 4706, 1583, 29889, 2103, 29892, 1583, 29889, 3545, 353, 2159, 13, 1678, 822, 903, 17987, 29898, 1311, 1125, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 22868, 3188, 29953, 29946, 29374, 13, 9651, 1583, 3032, 3188, 29953, 29946, 353, 6702, 1272, 29901, 3027, 29914, 2732, 29936, 3188, 29953, 29946, 24163, 29879, 29915, 1273, 13, 462, 9651, 934, 29898, 1311, 29889, 2084, 467, 949, 2141, 12508, 877, 3188, 29953, 29946, 1495, 7503, 29899, 29896, 2314, 13, 4706, 736, 1583, 3032, 3188, 29953, 29946, 13, 1678, 8297, 353, 2875, 7373, 17987, 29897, 13, 13, 1990, 3617, 1626, 2940, 4247, 29898, 4247, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2967, 29918, 7529, 29892, 1426, 29892, 975, 24040, 29892, 722, 978, 1125, 13, 4706, 1583, 29889, 3188, 29918, 7529, 353, 2967, 29918, 7529, 13, 4706, 1583, 29889, 726, 353, 1426, 13, 4706, 1583, 29889, 957, 24040, 353, 975, 24040, 13, 4706, 1583, 29889, 1707, 978, 353, 722, 978, 13, 1678, 822, 4050, 29898, 1311, 29892, 3030, 1125, 13, 4706, 8636, 353, 6571, 13, 4706, 565, 1583, 29889, 3188, 29918, 7529, 338, 451, 6213, 29901, 13, 9651, 8636, 353, 1583, 29889, 3188, 29918, 7529, 29889, 17863, 29898, 4703, 29897, 13, 4706, 565, 338, 8758, 29898, 7529, 29892, 2362, 342, 5393, 1125, 13, 9651, 1018, 29901, 13, 18884, 2225, 1691, 353, 6055, 29889, 5454, 29902, 1672, 16975, 29918, 15094, 1660, 9375, 13, 18884, 8636, 353, 9657, 29898, 4569, 1691, 29961, 7529, 2314, 13, 9651, 5174, 313, 6708, 2392, 29892, 7670, 2392, 1125, 13, 18884, 12020, 7670, 2392, 877, 29925, 12071, 11860, 29879, 29908, 451, 1476, 297, 525, 13, 462, 1669, 525, 11027, 29889, 5454, 29902, 1672, 16975, 29918, 15094, 1660, 9375, 29915, 1273, 8636, 29897, 13, 4706, 8636, 29889, 5504, 29898, 8977, 3552, 1989, 29892, 659, 29889, 17863, 29898, 4703, 876, 13, 462, 965, 363, 1820, 29892, 659, 297, 1583, 29889, 957, 24040, 29889, 7076, 22130, 13, 4706, 1426, 353, 1583, 29889, 726, 29889, 17863, 29898, 4703, 29897, 13, 4706, 1024, 353, 22821, 29945, 29898, 726, 29889, 12508, 877, 10496, 29899, 29947, 1495, 718, 282, 4830, 29898, 7529, 8106, 20970, 7501, 342, 580, 13, 4706, 4050, 29918, 3972, 353, 679, 5552, 29898, 11027, 29892, 525, 5454, 29902, 1672, 16975, 29918, 9464, 742, 525, 1113, 3350, 726, 29918, 8173, 1495, 13, 4706, 10422, 353, 14210, 29879, 29889, 2732, 29915, 1273, 1024, 13, 4706, 934, 2271, 353, 3142, 7122, 29898, 11027, 29889, 2303, 4571, 29909, 29918, 4219, 29892, 5988, 29898, 9482, 29918, 3972, 29892, 10422, 876, 13, 4706, 934, 2084, 353, 5988, 29898, 11027, 29889, 2303, 4571, 29909, 29918, 21289, 29892, 4050, 29918, 3972, 29892, 10422, 29897, 13, 4706, 2159, 353, 6213, 13, 4706, 565, 451, 4864, 29898, 1445, 2084, 1125, 13, 9651, 2159, 353, 4050, 29918, 726, 29898, 726, 29892, 934, 2084, 29892, 8636, 29897, 13, 4706, 282, 865, 2311, 353, 679, 29918, 2732, 29918, 2311, 29898, 1445, 2084, 29897, 13, 4706, 4974, 2159, 338, 6213, 470, 2159, 1275, 282, 865, 2311, 29892, 320, 13, 9651, 525, 2311, 29635, 29901, 3806, 1273, 17697, 29995, 29878, 29892, 2355, 1273, 17697, 29995, 29878, 29915, 1273, 313, 2311, 29974, 2732, 2311, 29897, 13, 13, 4706, 3030, 29961, 1311, 29889, 1707, 978, 29962, 353, 3992, 2940, 29898, 1445, 2271, 29892, 934, 2084, 29892, 282, 865, 2311, 29897, 13, 4706, 736, 6629, 13, 13, 1753, 6633, 29898, 16680, 29892, 995, 1125, 13, 1678, 565, 995, 29961, 29900, 29962, 297, 17411, 29900, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 2396, 13, 4706, 736, 28736, 29898, 1767, 29897, 13, 1678, 736, 13812, 29889, 12198, 29918, 4572, 29898, 1767, 29897, 13, 13, 1753, 437, 29918, 657, 29918, 726, 29918, 3027, 29898, 16680, 29892, 5993, 1125, 13, 1678, 9995, 13, 1678, 1763, 671, 2225, 1691, 515, 6055, 29889, 5454, 29902, 1672, 16975, 29918, 15094, 1660, 9375, 1839, 3188, 29918, 7529, 2033, 322, 13, 1678, 5712, 1426, 2927, 29892, 671, 29901, 13, 13, 1678, 18674, 679, 29918, 726, 29918, 3027, 376, 1626, 29908, 2927, 12305, 7340, 29874, 29908, 4079, 376, 29903, 550, 29908, 3171, 29871, 29906, 29900, 408, 10153, 15493, 13, 1678, 529, 2492, 4765, 543, 6224, 2492, 29889, 2271, 930, 29908, 2920, 543, 6224, 2492, 29889, 2103, 930, 29908, 3171, 543, 6224, 2492, 29889, 3545, 930, 29908, 2900, 13, 1678, 9995, 13, 1678, 9978, 353, 5993, 29889, 5451, 29918, 10853, 580, 13, 1678, 2302, 353, 7431, 29898, 14836, 29897, 13, 1678, 565, 2302, 529, 29871, 29946, 29901, 13, 4706, 12020, 25663, 16676, 2392, 877, 29995, 29878, 23347, 472, 3203, 29871, 29941, 6273, 1495, 13, 1678, 565, 9978, 14352, 29906, 29962, 2804, 525, 294, 2396, 13, 4706, 12020, 25663, 16676, 2392, 877, 29995, 29878, 23347, 376, 294, 29908, 408, 967, 525, 13, 462, 462, 29871, 525, 7496, 1833, 2980, 1495, 13, 1678, 1426, 353, 13812, 29889, 12198, 29918, 4572, 29898, 14836, 29961, 29896, 2314, 13, 1678, 2967, 29918, 7529, 353, 6213, 13, 1678, 565, 2302, 1273, 29871, 29906, 29901, 13, 4706, 2967, 29918, 7529, 353, 13812, 29889, 12198, 29918, 4572, 29898, 14836, 29961, 29906, 2314, 13, 1678, 975, 24040, 353, 9657, 3552, 26766, 29892, 6633, 29898, 16680, 29892, 995, 876, 13, 462, 268, 363, 13553, 29892, 995, 297, 14319, 29898, 14836, 29961, 29906, 29974, 2798, 29995, 29906, 13018, 29906, 29901, 29906, 1402, 9978, 29961, 29941, 29974, 2798, 29995, 29906, 13018, 29906, 29901, 29906, 12622, 13, 1678, 722, 978, 353, 9978, 14352, 29896, 29962, 13, 13, 1678, 9815, 29918, 1989, 9303, 353, 731, 29898, 957, 24040, 29889, 8149, 16655, 29881, 17678, 29898, 16320, 5194, 29918, 10818, 11686, 8452, 29897, 13, 1678, 565, 9815, 29918, 1989, 9303, 29901, 13, 4706, 12020, 25663, 16676, 2392, 877, 29995, 29878, 2355, 9815, 29361, 1273, 29879, 29915, 1273, 313, 13, 18884, 9978, 29961, 29900, 1402, 13, 18884, 13420, 15300, 7122, 29898, 26690, 29918, 1989, 9303, 4961, 13, 1678, 736, 3617, 1626, 2940, 4247, 29898, 3188, 29918, 7529, 29892, 1426, 29892, 975, 24040, 29892, 722, 978, 29897, 13, 1867, 29918, 657, 29918, 726, 29918, 3027, 353, 6036, 29889, 4039, 877, 657, 29918, 726, 29918, 3027, 742, 437, 29918, 657, 29918, 726, 29918, 3027, 29897, 13, 2 ]
src/apiron/service/discoverable.py
tushar-deepsource/apiron
109
11587
from typing import List, Type from apiron.service.base import ServiceBase class DiscoverableService(ServiceBase): """ A Service whose hosts are determined via a host resolver. A host resolver is any class with a :func:`resolve` method that takes a service name as its sole argument and returns a list of host names that correspond to that service. """ host_resolver_class: Type service_name: str @classmethod def get_hosts(cls) -> List[str]: return cls.host_resolver_class.resolve(cls.service_name) def __str__(self) -> str: return self.service_name def __repr__(self) -> str: klass = self.__class__ return "{klass}(service_name={service_name}, host_resolver={host_resolver})".format( klass=klass.__name__, service_name=klass.service_name, host_resolver=klass.host_resolver_class.__name__ )
[ 1, 515, 19229, 1053, 2391, 29892, 5167, 13, 13, 3166, 3095, 381, 265, 29889, 5509, 29889, 3188, 1053, 6692, 5160, 13, 13, 13, 1990, 8565, 957, 519, 3170, 29898, 3170, 5160, 1125, 13, 1678, 9995, 13, 1678, 319, 6692, 5069, 18982, 526, 10087, 3025, 263, 3495, 3770, 369, 29889, 13, 1678, 319, 3495, 3770, 369, 338, 738, 770, 411, 263, 584, 9891, 18078, 17863, 29952, 1158, 13, 1678, 393, 4893, 263, 2669, 1024, 408, 967, 14419, 2980, 13, 1678, 322, 3639, 263, 1051, 310, 3495, 2983, 393, 3928, 304, 393, 2669, 29889, 13, 1678, 9995, 13, 13, 1678, 3495, 29918, 9778, 369, 29918, 1990, 29901, 5167, 13, 1678, 2669, 29918, 978, 29901, 851, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 679, 29918, 23525, 29898, 25932, 29897, 1599, 2391, 29961, 710, 5387, 13, 4706, 736, 1067, 29879, 29889, 3069, 29918, 9778, 369, 29918, 1990, 29889, 17863, 29898, 25932, 29889, 5509, 29918, 978, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 1583, 29889, 5509, 29918, 978, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 22902, 353, 1583, 17255, 1990, 1649, 13, 4706, 736, 29850, 29895, 605, 2119, 5509, 29918, 978, 3790, 5509, 29918, 978, 1118, 3495, 29918, 9778, 369, 3790, 3069, 29918, 9778, 369, 1800, 1642, 4830, 29898, 13, 9651, 22902, 29922, 29895, 605, 17255, 978, 1649, 29892, 2669, 29918, 978, 29922, 29895, 605, 29889, 5509, 29918, 978, 29892, 3495, 29918, 9778, 369, 29922, 29895, 605, 29889, 3069, 29918, 9778, 369, 29918, 1990, 17255, 978, 1649, 13, 4706, 1723, 13, 2 ]
iris/src/iris/main.py
headma5ter/wall-e
0
20084
<filename>iris/src/iris/main.py from matplotlib import pyplot as plt import matplotlib.lines as lines from statistics import mode, StatisticsError from csv import QUOTE_ALL import pandas as pd import pathlib import json from iris import logger from iris import config from iris import classifier from iris.helpers.utils import log_function # TODO: change to ceres COLUMN_NAMES = ["w", "x", "y", "z"] @log_function def read_data( csv_path: pathlib.Path = None, serial_path: pathlib.Path = None ) -> (pd.DataFrame, dict): """ Read in either raw CSV data or pickled data. :param csv_path: path to CSV data :param serial_path: path to pickled/JSON data :return: pd.DataFrame """ if serial_path is not None: ext = serial_path.suffix if ext == ".pkl": # Read in centroids serialized file return pd.read_pickle(serial_path) elif ext == ".json": # Read in mapping serialized file with open(serial_path) as f: return {int(k): v for k, v in json.load(f).items()} else: msg = f"Unknown file extension ({serial_path})" logger.error(msg) raise ValueError(msg) # Read in default CSV file return pd.read_csv( csv_path, low_memory=True, header=None, names=COLUMN_NAMES + ["classification"], ) @log_function def classify_clusters( df: pd.DataFrame, initial_centroids: pd.DataFrame = None ) -> (pd.DataFrame, pd.DataFrame): """ Send raw data to classifier.py to be run through the k-means algorithm in order to cluster the data points. :param df: raw data :param initial_centroids: centroids from training data (when applicable) :return: (finalized data, centroids for testing data) """ initial_centroids = ( initial_centroids.to_numpy() if initial_centroids is not None else None ) # Initiate algo class all_clusters = classifier.LloydsAlgorithm( number_of_clusters=config.clusters, data_set=df[df.columns[:-1]].to_numpy(), initial_centroids=initial_centroids, ) while ( not all_clusters.is_optimized() and all_clusters.iteration <= all_clusters.max_iterations ): # Update centroids with their new center of mass all_clusters.update_centroids() # Assign data points to their closest centroid all_clusters.assign_clusters() # Increase the increment counter by one all_clusters.increment_iteration() merged_df = df.join( pd.DataFrame(all_clusters.clusters, columns=["cluster"], dtype=int) ) centroids_df = pd.DataFrame(all_clusters.centroids, columns=COLUMN_NAMES) return merged_df, centroids_df @log_function def serialize_data(data_obj: (pd.DataFrame, dict), file_path: pathlib.Path) -> None: """ Pickle training data. :param data_obj: Dataframe (post-algorithm) or dict (post-mapping) :param file_path: where to write serialized data """ if not file_path.parent.is_dir(): msg = f"The indicated path cannot be found; perhaps a parent folder is missing? ({file_path})" logger.error(msg) raise FileNotFoundError(msg) if isinstance(data_obj, dict): with open(file_path, "w") as f: json.dump(data_obj, f) else: data_obj.to_pickle(file_path) @log_function def map_cluster_to_species(df: pd.DataFrame) -> dict: """ Finds the most common species linked to each cluster value (for plotting, as well as sanity-checking). :param df: data (after running algorithm) :return: dict """ cluster_map = { row["cluster"]: list(df[df["cluster"] == row["cluster"]]["classification"]) for _, row in df.iterrows() } try: cluster_map = {int(k): mode(v) for k, v in cluster_map.items()} except StatisticsError as e: msg = f"Error finding unique mappings for clusters ({e})" logger.error(msg) raise ValueError(msg) if set(cluster_map.values()) != set(df["classification"].unique()): logger.warn("Not all classifications are mapped") cluster_map.update( { cluster: "UNMAPPED" for cluster in range(config.clusters) if cluster not in cluster_map } ) return cluster_map @log_function def write_to_csv(df: pd.DataFrame, file_path: pathlib.Path) -> None: """ Write final testing dataframe to file. :param df: testing df (post-algorithm) :param file_path: file path """ if not file_path.parent.is_dir(): msg = f"The indicated path cannot be found; perhaps a parent folder is missing? ({file_path})" logger.error(msg) raise FileNotFoundError(msg) df.to_csv(file_path, index=False, quoting=QUOTE_ALL) @log_function def plot_clusters(df: pd.DataFrame, cluster_map: dict) -> None: """ Create a plot containing (NxM - k) plots, showing the relationship between each parameter and the clusters contained in each sub-data set. :param df: the data after being classified :param cluster_map: mapping to convert cluster to Iris species """ variants = [ col for col in df.columns.tolist() if col not in ("cluster", "classification", "color", "model_classification") ] fig, ax = plt.subplots( nrows=len(variants), ncols=len(variants), figsize=[12.0, 12.0], squeeze=True ) color_map = { k: plt.get_cmap("Dark2")((k + 1) / config.clusters) for k in range(config.clusters) } df["color"] = df["cluster"].apply(lambda x: color_map[x]) for row_idx, _ in enumerate(ax): for col_idx, _ in enumerate(_): x_var = variants[col_idx] y_var = variants[row_idx] curr_plot = ax[row_idx][col_idx] if row_idx == col_idx: curr_plot.text( 0.5, 0.5, f"{x_var.upper()}", ha="center", va="center", fontsize="xx-large", label="", ) curr_plot.get_xaxis().set_visible(False) curr_plot.get_yaxis().set_visible(False) else: curr_plot.scatter(df[x_var], df[y_var], c=df["color"]) fig.suptitle(f"Iris Classification ({config.stage} data)", fontsize="xx-large") fig.tight_layout() fig.subplots_adjust(top=0.93) handles = list() labels = list() for classification, color in { cluster_map[cluster]: color for cluster, color in color_map.items() }.items(): handles.append( lines.Line2D(list(), list(), marker="o", color=color, linestyle="none") ) labels.append(classification) plt.legend(handles=handles, labels=labels) if config.save: plt.savefig(config.plot_path) plt.show() @log_function def map_species_onto_data(df: pd.DataFrame, cluster_map: dict) -> pd.DataFrame: """ Add species names to the final dataframe. :param df: dataframe (after running through algorithm) :param cluster_map: mapping data to go from cluster to species :return: pd.DataFrame """ df["model_classification"] = df["cluster"].map(cluster_map) return df @log_function def calculate_statistics(df: pd.DataFrame, cluster_map: dict) -> None: """ Calculates accuracy of model. :param df: dataframe (after running through algorithm) :param cluster_map: mapping data to go from cluster to species """ num_correct = len(df[df["classification"] == df["cluster"].map(cluster_map)]) total_num = len(df) logger.info(f"Accuracy: {'{:.1%}'.format(num_correct / total_num)} (N={total_num})") if __name__ == "__main__": # Get relevant paths data_path = getattr(config, f"{config.stage}_data_path") centroid_path = config.centroid_serial_path mapping_path = config.mapping_serial_path centroids = None mapping = dict() if config.stage == "testing": if not centroid_path.is_file() or not mapping_path.is_file(): logger.warn( "No training data to be read -- could result in poor model performance" ) else: # Get centroids and species mapping from training data centroids = read_data(serial_path=centroid_path) mapping = read_data(serial_path=mapping_path) # Classify data set data = read_data(csv_path=data_path) data, centroids = classify_clusters(data, initial_centroids=centroids) if config.stage == "training": # Map species to cluster mapping = map_cluster_to_species(data) if config.serialize: # Save data serialize_data(centroids, config.centroid_serial_path) serialize_data(mapping, config.mapping_serial_path) # Add the model's species classification to data data = map_species_onto_data(data, mapping) if config.save: # Save testing results to files write_to_csv(data, config.results_path) if config.visualize: # Plot data plot_clusters(data, mapping) calculate_statistics(data, mapping) logger.info(f"Process complete\n\t{config.summary}")
[ 1, 529, 9507, 29958, 381, 275, 29914, 4351, 29914, 381, 275, 29914, 3396, 29889, 2272, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 30004, 13, 5215, 22889, 29889, 9012, 408, 3454, 30004, 13, 3166, 13964, 1053, 4464, 29892, 27098, 2392, 30004, 13, 3166, 11799, 1053, 660, 29965, 2891, 29923, 29918, 9818, 30004, 13, 5215, 11701, 408, 10518, 30004, 13, 5215, 2224, 1982, 30004, 13, 5215, 4390, 30004, 13, 30004, 13, 3166, 3805, 275, 1053, 17927, 30004, 13, 3166, 3805, 275, 1053, 2295, 30004, 13, 3166, 3805, 275, 1053, 770, 3709, 30004, 13, 3166, 3805, 275, 29889, 3952, 6774, 29889, 13239, 1053, 1480, 29918, 2220, 29871, 396, 14402, 29901, 1735, 304, 5147, 267, 30004, 13, 30004, 13, 15032, 29127, 29918, 5813, 29903, 353, 6796, 29893, 613, 376, 29916, 613, 376, 29891, 613, 376, 29920, 3108, 30004, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 1303, 29918, 1272, 29898, 30004, 13, 1678, 11799, 29918, 2084, 29901, 2224, 1982, 29889, 2605, 353, 6213, 29892, 7797, 29918, 2084, 29901, 2224, 1982, 29889, 2605, 353, 6213, 30004, 13, 29897, 1599, 313, 15926, 29889, 17271, 29892, 9657, 1125, 30004, 13, 1678, 9995, 30004, 13, 1678, 7523, 297, 2845, 10650, 16874, 848, 470, 5839, 839, 848, 22993, 13, 1678, 584, 3207, 11799, 29918, 2084, 29901, 2224, 304, 16874, 848, 30004, 13, 1678, 584, 3207, 7797, 29918, 2084, 29901, 2224, 304, 5839, 839, 29914, 7249, 848, 30004, 13, 1678, 584, 2457, 29901, 10518, 29889, 17271, 30004, 13, 1678, 9995, 30004, 13, 1678, 565, 7797, 29918, 2084, 338, 451, 6213, 29901, 30004, 13, 4706, 1294, 353, 7797, 29918, 2084, 29889, 2146, 600, 861, 30004, 13, 4706, 565, 1294, 1275, 11393, 29886, 6321, 1115, 30004, 13, 9651, 396, 7523, 297, 1644, 1007, 29879, 7797, 1891, 934, 30004, 13, 9651, 736, 10518, 29889, 949, 29918, 23945, 280, 29898, 15550, 29918, 2084, 8443, 13, 4706, 25342, 1294, 1275, 11393, 3126, 1115, 30004, 13, 9651, 396, 7523, 297, 10417, 7797, 1891, 934, 30004, 13, 9651, 411, 1722, 29898, 15550, 29918, 2084, 29897, 408, 285, 29901, 30004, 13, 18884, 736, 426, 524, 29898, 29895, 1125, 325, 363, 413, 29892, 325, 297, 4390, 29889, 1359, 29898, 29888, 467, 7076, 580, 8117, 13, 4706, 1683, 29901, 30004, 13, 9651, 10191, 353, 285, 29908, 14148, 934, 6081, 21313, 15550, 29918, 2084, 1800, 19451, 13, 9651, 17927, 29889, 2704, 29898, 7645, 8443, 13, 9651, 12020, 7865, 2392, 29898, 7645, 8443, 13, 30004, 13, 1678, 396, 7523, 297, 2322, 16874, 934, 30004, 13, 1678, 736, 10518, 29889, 949, 29918, 7638, 29898, 30004, 13, 4706, 11799, 29918, 2084, 29892, 4482, 29918, 14834, 29922, 5574, 29892, 4839, 29922, 8516, 29892, 2983, 29922, 15032, 29127, 29918, 5813, 29903, 718, 6796, 1990, 2450, 12436, 30004, 13, 1678, 1723, 30004, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 770, 1598, 29918, 695, 504, 414, 29898, 30004, 13, 1678, 4489, 29901, 10518, 29889, 17271, 29892, 2847, 29918, 1760, 1007, 29879, 29901, 10518, 29889, 17271, 353, 6213, 30004, 13, 29897, 1599, 313, 15926, 29889, 17271, 29892, 10518, 29889, 17271, 1125, 30004, 13, 1678, 9995, 30004, 13, 1678, 15076, 10650, 848, 304, 770, 3709, 29889, 2272, 304, 367, 1065, 1549, 278, 30004, 13, 1678, 413, 29899, 1004, 550, 5687, 297, 1797, 304, 9867, 278, 848, 3291, 22993, 13, 1678, 584, 3207, 4489, 29901, 10650, 848, 30004, 13, 1678, 584, 3207, 2847, 29918, 1760, 1007, 29879, 29901, 1644, 1007, 29879, 515, 6694, 848, 313, 8256, 22903, 8443, 13, 1678, 584, 2457, 29901, 313, 8394, 1891, 848, 29892, 1644, 1007, 29879, 363, 6724, 848, 8443, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 2847, 29918, 1760, 1007, 29879, 353, 313, 30004, 13, 4706, 2847, 29918, 1760, 1007, 29879, 29889, 517, 29918, 23749, 580, 565, 2847, 29918, 1760, 1007, 29879, 338, 451, 6213, 1683, 6213, 30004, 13, 1678, 1723, 30004, 13, 30004, 13, 1678, 396, 512, 4812, 403, 24673, 770, 30004, 13, 1678, 599, 29918, 695, 504, 414, 353, 770, 3709, 29889, 29931, 2376, 6289, 22461, 4540, 29898, 30004, 13, 4706, 1353, 29918, 974, 29918, 695, 504, 414, 29922, 2917, 29889, 695, 504, 414, 11167, 13, 4706, 848, 29918, 842, 29922, 2176, 29961, 2176, 29889, 13099, 7503, 29899, 29896, 29962, 1822, 517, 29918, 23749, 3285, 30004, 13, 4706, 2847, 29918, 1760, 1007, 29879, 29922, 11228, 29918, 1760, 1007, 29879, 11167, 13, 1678, 1723, 30004, 13, 30004, 13, 1678, 1550, 313, 30004, 13, 4706, 451, 599, 29918, 695, 504, 414, 29889, 275, 29918, 20640, 1891, 26471, 13, 4706, 322, 599, 29918, 695, 504, 414, 29889, 1524, 362, 5277, 599, 29918, 695, 504, 414, 29889, 3317, 29918, 1524, 800, 30004, 13, 268, 1125, 30004, 13, 4706, 396, 10318, 1644, 1007, 29879, 411, 1009, 716, 4818, 310, 4158, 30004, 13, 4706, 599, 29918, 695, 504, 414, 29889, 5504, 29918, 1760, 1007, 29879, 26471, 13, 30004, 13, 4706, 396, 4007, 647, 848, 3291, 304, 1009, 21438, 1644, 1007, 30004, 13, 4706, 599, 29918, 695, 504, 414, 29889, 16645, 29918, 695, 504, 414, 26471, 13, 30004, 13, 4706, 396, 512, 1037, 559, 278, 11924, 6795, 491, 697, 30004, 13, 4706, 599, 29918, 695, 504, 414, 29889, 25629, 29918, 1524, 362, 26471, 13, 30004, 13, 1678, 19412, 29918, 2176, 353, 4489, 29889, 7122, 29898, 30004, 13, 4706, 10518, 29889, 17271, 29898, 497, 29918, 695, 504, 414, 29889, 695, 504, 414, 29892, 4341, 29922, 3366, 19594, 12436, 26688, 29922, 524, 8443, 13, 1678, 1723, 30004, 13, 1678, 1644, 1007, 29879, 29918, 2176, 353, 10518, 29889, 17271, 29898, 497, 29918, 695, 504, 414, 29889, 1760, 1007, 29879, 29892, 4341, 29922, 15032, 29127, 29918, 5813, 29903, 8443, 13, 30004, 13, 1678, 736, 19412, 29918, 2176, 29892, 1644, 1007, 29879, 29918, 2176, 30004, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 28755, 29918, 1272, 29898, 1272, 29918, 5415, 29901, 313, 15926, 29889, 17271, 29892, 9657, 511, 934, 29918, 2084, 29901, 2224, 1982, 29889, 2605, 29897, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 23868, 280, 6694, 848, 22993, 13, 1678, 584, 3207, 848, 29918, 5415, 29901, 3630, 2557, 313, 2490, 29899, 20567, 29897, 470, 9657, 313, 2490, 29899, 20698, 8443, 13, 1678, 584, 3207, 934, 29918, 2084, 29901, 988, 304, 2436, 7797, 1891, 848, 30004, 13, 1678, 9995, 30004, 13, 1678, 565, 451, 934, 29918, 2084, 29889, 3560, 29889, 275, 29918, 3972, 7295, 30004, 13, 4706, 10191, 353, 285, 29908, 1576, 18694, 2224, 2609, 367, 1476, 29936, 6060, 263, 3847, 4138, 338, 4567, 29973, 21313, 1445, 29918, 2084, 1800, 19451, 13, 4706, 17927, 29889, 2704, 29898, 7645, 8443, 13, 4706, 12020, 3497, 17413, 2392, 29898, 7645, 8443, 13, 30004, 13, 1678, 565, 338, 8758, 29898, 1272, 29918, 5415, 29892, 9657, 1125, 30004, 13, 4706, 411, 1722, 29898, 1445, 29918, 2084, 29892, 376, 29893, 1159, 408, 285, 29901, 30004, 13, 9651, 4390, 29889, 15070, 29898, 1272, 29918, 5415, 29892, 285, 8443, 13, 1678, 1683, 29901, 30004, 13, 4706, 848, 29918, 5415, 29889, 517, 29918, 23945, 280, 29898, 1445, 29918, 2084, 8443, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 2910, 29918, 19594, 29918, 517, 29918, 24091, 29898, 2176, 29901, 10518, 29889, 17271, 29897, 1599, 9657, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 10987, 29879, 278, 1556, 3619, 6606, 9024, 304, 1269, 9867, 30004, 13, 1678, 995, 313, 1454, 6492, 1259, 29892, 408, 1532, 408, 9753, 537, 29899, 3198, 292, 467, 30004, 13, 1678, 584, 3207, 4489, 29901, 848, 313, 7045, 2734, 5687, 8443, 13, 1678, 584, 2457, 29901, 9657, 30004, 13, 1678, 9995, 30004, 13, 1678, 9867, 29918, 1958, 353, 3336, 13, 4706, 1948, 3366, 19594, 3108, 29901, 1051, 29898, 2176, 29961, 2176, 3366, 19594, 3108, 1275, 1948, 3366, 19594, 3108, 29962, 3366, 1990, 2450, 20068, 30004, 13, 4706, 363, 17117, 1948, 297, 4489, 29889, 1524, 5727, 26471, 13, 1678, 4970, 13, 1678, 1018, 29901, 30004, 13, 4706, 9867, 29918, 1958, 353, 426, 524, 29898, 29895, 1125, 4464, 29898, 29894, 29897, 363, 413, 29892, 325, 297, 9867, 29918, 1958, 29889, 7076, 580, 8117, 13, 1678, 5174, 27098, 2392, 408, 321, 29901, 30004, 13, 4706, 10191, 353, 285, 29908, 2392, 9138, 5412, 611, 27775, 363, 24554, 21313, 29872, 1800, 19451, 13, 4706, 17927, 29889, 2704, 29898, 7645, 8443, 13, 4706, 12020, 7865, 2392, 29898, 7645, 8443, 13, 30004, 13, 1678, 565, 731, 29898, 19594, 29918, 1958, 29889, 5975, 3101, 2804, 731, 29898, 2176, 3366, 1990, 2450, 16862, 13092, 580, 1125, 30004, 13, 4706, 17927, 29889, 25442, 703, 3664, 599, 770, 8232, 526, 20545, 1159, 30004, 13, 4706, 9867, 29918, 1958, 29889, 5504, 29898, 30004, 13, 9651, 3336, 13, 18884, 9867, 29901, 376, 3904, 1529, 18009, 3352, 19451, 13, 18884, 363, 9867, 297, 3464, 29898, 2917, 29889, 695, 504, 414, 8443, 13, 18884, 565, 9867, 451, 297, 9867, 29918, 1958, 30004, 13, 9651, 4970, 13, 4706, 1723, 30004, 13, 30004, 13, 1678, 736, 9867, 29918, 1958, 30004, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 2436, 29918, 517, 29918, 7638, 29898, 2176, 29901, 10518, 29889, 17271, 29892, 934, 29918, 2084, 29901, 2224, 1982, 29889, 2605, 29897, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 14350, 2186, 6724, 12205, 304, 934, 22993, 13, 1678, 584, 3207, 4489, 29901, 6724, 4489, 313, 2490, 29899, 20567, 8443, 13, 1678, 584, 3207, 934, 29918, 2084, 29901, 934, 2224, 30004, 13, 1678, 9995, 30004, 13, 1678, 565, 451, 934, 29918, 2084, 29889, 3560, 29889, 275, 29918, 3972, 7295, 30004, 13, 4706, 10191, 353, 285, 29908, 1576, 18694, 2224, 2609, 367, 1476, 29936, 6060, 263, 3847, 4138, 338, 4567, 29973, 21313, 1445, 29918, 2084, 1800, 19451, 13, 4706, 17927, 29889, 2704, 29898, 7645, 8443, 13, 4706, 12020, 3497, 17413, 2392, 29898, 7645, 8443, 13, 30004, 13, 1678, 4489, 29889, 517, 29918, 7638, 29898, 1445, 29918, 2084, 29892, 2380, 29922, 8824, 29892, 439, 11427, 29922, 13356, 2891, 29923, 29918, 9818, 8443, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 6492, 29918, 695, 504, 414, 29898, 2176, 29901, 10518, 29889, 17271, 29892, 9867, 29918, 1958, 29901, 9657, 29897, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 6204, 263, 6492, 6943, 313, 29940, 29916, 29924, 448, 413, 29897, 24580, 29892, 6445, 30004, 13, 1678, 278, 9443, 1546, 1269, 3443, 322, 278, 30004, 13, 1678, 24554, 11122, 297, 1269, 1014, 29899, 1272, 731, 22993, 13, 1678, 584, 3207, 4489, 29901, 278, 848, 1156, 1641, 770, 2164, 30004, 13, 1678, 584, 3207, 9867, 29918, 1958, 29901, 10417, 304, 3588, 9867, 304, 306, 3780, 6606, 30004, 13, 1678, 9995, 30004, 13, 1678, 29161, 353, 518, 30004, 13, 4706, 784, 30004, 13, 4706, 363, 784, 297, 4489, 29889, 13099, 29889, 25027, 391, 26471, 13, 4706, 565, 784, 451, 297, 4852, 19594, 613, 376, 1990, 2450, 613, 376, 2780, 613, 376, 4299, 29918, 1990, 2450, 1159, 30004, 13, 1678, 4514, 30004, 13, 30004, 13, 1678, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 30004, 13, 4706, 302, 5727, 29922, 2435, 29898, 5927, 1934, 511, 302, 22724, 29922, 2435, 29898, 5927, 1934, 511, 2537, 2311, 11759, 29896, 29906, 29889, 29900, 29892, 29871, 29896, 29906, 29889, 29900, 1402, 269, 802, 29872, 911, 29922, 5574, 30004, 13, 1678, 1723, 30004, 13, 30004, 13, 1678, 2927, 29918, 1958, 353, 3336, 13, 4706, 413, 29901, 14770, 29889, 657, 29918, 29883, 1958, 703, 29928, 935, 29906, 1159, 3552, 29895, 718, 29871, 29896, 29897, 847, 2295, 29889, 695, 504, 414, 8443, 13, 4706, 363, 413, 297, 3464, 29898, 2917, 29889, 695, 504, 414, 8443, 13, 1678, 4970, 13, 1678, 4489, 3366, 2780, 3108, 353, 4489, 3366, 19594, 16862, 7302, 29898, 2892, 921, 29901, 2927, 29918, 1958, 29961, 29916, 2314, 30004, 13, 30004, 13, 1678, 363, 1948, 29918, 13140, 29892, 903, 297, 26985, 29898, 1165, 1125, 30004, 13, 4706, 363, 784, 29918, 13140, 29892, 903, 297, 26985, 7373, 1125, 30004, 13, 9651, 921, 29918, 1707, 353, 29161, 29961, 1054, 29918, 13140, 29962, 30004, 13, 9651, 343, 29918, 1707, 353, 29161, 29961, 798, 29918, 13140, 29962, 30004, 13, 9651, 16256, 29918, 5317, 353, 4853, 29961, 798, 29918, 13140, 3816, 1054, 29918, 13140, 29962, 30004, 13, 30004, 13, 9651, 565, 1948, 29918, 13140, 1275, 784, 29918, 13140, 29901, 30004, 13, 18884, 16256, 29918, 5317, 29889, 726, 29898, 30004, 13, 462, 268, 29900, 29889, 29945, 11167, 13, 462, 268, 29900, 29889, 29945, 11167, 13, 462, 1678, 285, 29908, 29912, 29916, 29918, 1707, 29889, 21064, 28296, 15231, 13, 462, 1678, 447, 543, 5064, 15231, 13, 462, 1678, 2947, 543, 5064, 15231, 13, 462, 1678, 4079, 2311, 543, 4419, 29899, 16961, 15231, 13, 462, 1678, 3858, 543, 15231, 13, 18884, 1723, 30004, 13, 18884, 16256, 29918, 5317, 29889, 657, 29918, 29916, 8990, 2141, 842, 29918, 12872, 29898, 8824, 8443, 13, 18884, 16256, 29918, 5317, 29889, 657, 29918, 29891, 8990, 2141, 842, 29918, 12872, 29898, 8824, 8443, 13, 9651, 1683, 29901, 30004, 13, 18884, 16256, 29918, 5317, 29889, 1557, 2620, 29898, 2176, 29961, 29916, 29918, 1707, 1402, 4489, 29961, 29891, 29918, 1707, 1402, 274, 29922, 2176, 3366, 2780, 20068, 30004, 13, 30004, 13, 1678, 2537, 29889, 2146, 415, 1740, 29898, 29888, 29908, 29902, 3780, 23236, 21313, 2917, 29889, 19190, 29913, 848, 19123, 4079, 2311, 543, 4419, 29899, 16961, 1159, 30004, 13, 1678, 2537, 29889, 29873, 523, 29918, 2680, 26471, 13, 1678, 2537, 29889, 1491, 26762, 29918, 328, 5143, 29898, 3332, 29922, 29900, 29889, 29929, 29941, 8443, 13, 30004, 13, 1678, 17766, 353, 1051, 26471, 13, 1678, 11073, 353, 1051, 26471, 13, 1678, 363, 12965, 29892, 2927, 297, 3336, 13, 4706, 9867, 29918, 1958, 29961, 19594, 5387, 2927, 363, 9867, 29892, 2927, 297, 2927, 29918, 1958, 29889, 7076, 26471, 13, 1678, 500, 29889, 7076, 7295, 30004, 13, 4706, 17766, 29889, 4397, 29898, 30004, 13, 9651, 3454, 29889, 3542, 29906, 29928, 29898, 1761, 3285, 1051, 3285, 17456, 543, 29877, 613, 2927, 29922, 2780, 29892, 6276, 342, 1508, 543, 9290, 1159, 30004, 13, 4706, 1723, 30004, 13, 4706, 11073, 29889, 4397, 29898, 1990, 2450, 8443, 13, 30004, 13, 1678, 14770, 29889, 26172, 29898, 3179, 793, 29922, 3179, 793, 29892, 11073, 29922, 21134, 8443, 13, 30004, 13, 1678, 565, 2295, 29889, 7620, 29901, 30004, 13, 4706, 14770, 29889, 7620, 1003, 29898, 2917, 29889, 5317, 29918, 2084, 8443, 13, 30004, 13, 1678, 14770, 29889, 4294, 26471, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 2910, 29918, 24091, 29918, 10268, 29918, 1272, 29898, 2176, 29901, 10518, 29889, 17271, 29892, 9867, 29918, 1958, 29901, 9657, 29897, 1599, 10518, 29889, 17271, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 3462, 6606, 2983, 304, 278, 2186, 12205, 22993, 13, 1678, 584, 3207, 4489, 29901, 12205, 313, 7045, 2734, 1549, 5687, 8443, 13, 1678, 584, 3207, 9867, 29918, 1958, 29901, 10417, 848, 304, 748, 515, 9867, 304, 6606, 30004, 13, 1678, 584, 2457, 29901, 10518, 29889, 17271, 30004, 13, 1678, 9995, 30004, 13, 1678, 4489, 3366, 4299, 29918, 1990, 2450, 3108, 353, 4489, 3366, 19594, 16862, 1958, 29898, 19594, 29918, 1958, 8443, 13, 1678, 736, 4489, 30004, 13, 30004, 13, 30004, 13, 29992, 1188, 29918, 2220, 30004, 13, 1753, 8147, 29918, 6112, 6765, 29898, 2176, 29901, 10518, 29889, 17271, 29892, 9867, 29918, 1958, 29901, 9657, 29897, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 20535, 1078, 13600, 310, 1904, 22993, 13, 1678, 584, 3207, 4489, 29901, 12205, 313, 7045, 2734, 1549, 5687, 8443, 13, 1678, 584, 3207, 9867, 29918, 1958, 29901, 10417, 848, 304, 748, 515, 9867, 304, 6606, 30004, 13, 1678, 9995, 30004, 13, 1678, 954, 29918, 15728, 353, 7431, 29898, 2176, 29961, 2176, 3366, 1990, 2450, 3108, 1275, 4489, 3366, 19594, 16862, 1958, 29898, 19594, 29918, 1958, 29897, 2314, 30004, 13, 1678, 3001, 29918, 1949, 353, 7431, 29898, 2176, 8443, 13, 1678, 17927, 29889, 3888, 29898, 29888, 29908, 7504, 332, 4135, 29901, 11117, 25641, 29889, 29896, 29995, 29913, 4286, 4830, 29898, 1949, 29918, 15728, 847, 3001, 29918, 1949, 2915, 313, 29940, 3790, 7827, 29918, 1949, 1800, 1159, 30004, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 30004, 13, 1678, 396, 3617, 8018, 10898, 30004, 13, 1678, 848, 29918, 2084, 353, 679, 5552, 29898, 2917, 29892, 285, 29908, 29912, 2917, 29889, 19190, 2403, 1272, 29918, 2084, 1159, 30004, 13, 1678, 1644, 1007, 29918, 2084, 353, 2295, 29889, 1760, 1007, 29918, 15550, 29918, 2084, 30004, 13, 1678, 10417, 29918, 2084, 353, 2295, 29889, 20698, 29918, 15550, 29918, 2084, 30004, 13, 30004, 13, 1678, 1644, 1007, 29879, 353, 6213, 30004, 13, 1678, 10417, 353, 9657, 26471, 13, 1678, 565, 2295, 29889, 19190, 1275, 376, 13424, 1115, 30004, 13, 4706, 565, 451, 1644, 1007, 29918, 2084, 29889, 275, 29918, 1445, 580, 470, 451, 10417, 29918, 2084, 29889, 275, 29918, 1445, 7295, 30004, 13, 9651, 17927, 29889, 25442, 29898, 30004, 13, 18884, 376, 3782, 6694, 848, 304, 367, 1303, 1192, 1033, 1121, 297, 6460, 1904, 4180, 19451, 13, 9651, 1723, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 396, 3617, 1644, 1007, 29879, 322, 6606, 10417, 515, 6694, 848, 30004, 13, 9651, 1644, 1007, 29879, 353, 1303, 29918, 1272, 29898, 15550, 29918, 2084, 29922, 1760, 1007, 29918, 2084, 8443, 13, 9651, 10417, 353, 1303, 29918, 1272, 29898, 15550, 29918, 2084, 29922, 20698, 29918, 2084, 8443, 13, 30004, 13, 1678, 396, 4134, 1598, 848, 731, 30004, 13, 1678, 848, 353, 1303, 29918, 1272, 29898, 7638, 29918, 2084, 29922, 1272, 29918, 2084, 8443, 13, 1678, 848, 29892, 1644, 1007, 29879, 353, 770, 1598, 29918, 695, 504, 414, 29898, 1272, 29892, 2847, 29918, 1760, 1007, 29879, 29922, 1760, 1007, 29879, 8443, 13, 30004, 13, 1678, 565, 2295, 29889, 19190, 1275, 376, 26495, 1115, 30004, 13, 4706, 396, 7315, 6606, 304, 9867, 30004, 13, 4706, 10417, 353, 2910, 29918, 19594, 29918, 517, 29918, 24091, 29898, 1272, 8443, 13, 30004, 13, 4706, 565, 2295, 29889, 643, 6646, 29901, 30004, 13, 9651, 396, 16913, 848, 30004, 13, 9651, 28755, 29918, 1272, 29898, 1760, 1007, 29879, 29892, 2295, 29889, 1760, 1007, 29918, 15550, 29918, 2084, 8443, 13, 9651, 28755, 29918, 1272, 29898, 20698, 29892, 2295, 29889, 20698, 29918, 15550, 29918, 2084, 8443, 13, 30004, 13, 1678, 396, 3462, 278, 1904, 29915, 29879, 6606, 12965, 304, 848, 30004, 13, 1678, 848, 353, 2910, 29918, 24091, 29918, 10268, 29918, 1272, 29898, 1272, 29892, 10417, 8443, 13, 30004, 13, 1678, 565, 2295, 29889, 7620, 29901, 30004, 13, 4706, 396, 16913, 6724, 2582, 304, 2066, 30004, 13, 4706, 2436, 29918, 517, 29918, 7638, 29898, 1272, 29892, 2295, 29889, 9902, 29918, 2084, 8443, 13, 30004, 13, 1678, 565, 2295, 29889, 20119, 675, 29901, 30004, 13, 4706, 396, 18399, 848, 30004, 13, 4706, 6492, 29918, 695, 504, 414, 29898, 1272, 29892, 10417, 8443, 13, 30004, 13, 1678, 8147, 29918, 6112, 6765, 29898, 1272, 29892, 10417, 8443, 13, 30004, 13, 1678, 17927, 29889, 3888, 29898, 29888, 29908, 7032, 4866, 29905, 29876, 29905, 29873, 29912, 2917, 29889, 7727, 27195, 30004, 13, 2 ]
singlet/io/csv/__init__.py
iosonofabio/singlet
11
182999
<gh_stars>10-100 # vim: fdm=indent # author: <NAME> # date: 02/08/17 # content: Support module for filenames related to CSV/TSV files. # Modules import numpy as np from singlet.config import config csv_formats = ['csv', 'tsv', 'csv.gz', 'tsv.gz'] # Parser def parse_samplesheet(path, fmt): import pandas as pd if fmt in ('tsv', 'tsv.gz'): sep = '\t' elif fmt in ('csv', 'csv.gz'): sep = ',' else: raise ValueError('Format not understood') table = pd.read_csv(path, sep=sep, index_col=False) return table def parse_featuresheet(path, fmt): import pandas as pd if fmt in ('tsv', 'tsv.gz'): sep = '\t' elif fmt in ('csv', 'csv.gz'): sep = ',' else: raise ValueError('Format not understood') table = pd.read_csv(path, sep=sep, index_col=False) return table def parse_counts_table(path, fmt): import pandas as pd if fmt in ('tsv', 'tsv.gz'): sep = '\t' elif fmt in ('csv', 'csv.gz'): sep = ',' else: raise ValueError('Format not understood') table = pd.read_csv(path, sep=sep, index_col=False) return table
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 325, 326, 29901, 285, 18933, 29922, 12860, 13, 29937, 4148, 29901, 268, 529, 5813, 29958, 13, 29937, 2635, 29901, 4706, 29900, 29906, 29914, 29900, 29947, 29914, 29896, 29955, 13, 29937, 2793, 29901, 1678, 18601, 3883, 363, 977, 264, 1280, 4475, 304, 16874, 29914, 29911, 7597, 2066, 29889, 13, 29937, 3382, 2540, 13, 5215, 12655, 408, 7442, 13, 3166, 1809, 1026, 29889, 2917, 1053, 2295, 13, 13, 13, 7638, 29918, 689, 1446, 353, 6024, 7638, 742, 525, 1372, 29894, 742, 525, 7638, 29889, 18828, 742, 525, 1372, 29894, 29889, 18828, 2033, 13, 13, 13, 29937, 1459, 643, 13, 1753, 6088, 29918, 27736, 4155, 29898, 2084, 29892, 19200, 1125, 13, 1678, 1053, 11701, 408, 10518, 13, 13, 1678, 565, 19200, 297, 6702, 1372, 29894, 742, 525, 1372, 29894, 29889, 18828, 29374, 13, 4706, 16345, 353, 11297, 29873, 29915, 13, 1678, 25342, 19200, 297, 6702, 7638, 742, 525, 7638, 29889, 18828, 29374, 13, 4706, 16345, 353, 525, 5501, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 5809, 451, 11098, 1495, 13, 13, 1678, 1591, 353, 10518, 29889, 949, 29918, 7638, 29898, 2084, 29892, 16345, 29922, 19570, 29892, 2380, 29918, 1054, 29922, 8824, 29897, 13, 1678, 736, 1591, 13, 13, 13, 1753, 6088, 29918, 22100, 4155, 29898, 2084, 29892, 19200, 1125, 13, 1678, 1053, 11701, 408, 10518, 13, 13, 1678, 565, 19200, 297, 6702, 1372, 29894, 742, 525, 1372, 29894, 29889, 18828, 29374, 13, 4706, 16345, 353, 11297, 29873, 29915, 13, 1678, 25342, 19200, 297, 6702, 7638, 742, 525, 7638, 29889, 18828, 29374, 13, 4706, 16345, 353, 525, 5501, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 5809, 451, 11098, 1495, 13, 13, 1678, 1591, 353, 10518, 29889, 949, 29918, 7638, 29898, 2084, 29892, 16345, 29922, 19570, 29892, 2380, 29918, 1054, 29922, 8824, 29897, 13, 1678, 736, 1591, 13, 13, 13, 1753, 6088, 29918, 2798, 29879, 29918, 2371, 29898, 2084, 29892, 19200, 1125, 13, 1678, 1053, 11701, 408, 10518, 13, 13, 1678, 565, 19200, 297, 6702, 1372, 29894, 742, 525, 1372, 29894, 29889, 18828, 29374, 13, 4706, 16345, 353, 11297, 29873, 29915, 13, 1678, 25342, 19200, 297, 6702, 7638, 742, 525, 7638, 29889, 18828, 29374, 13, 4706, 16345, 353, 525, 5501, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 5809, 451, 11098, 1495, 13, 13, 1678, 1591, 353, 10518, 29889, 949, 29918, 7638, 29898, 2084, 29892, 16345, 29922, 19570, 29892, 2380, 29918, 1054, 29922, 8824, 29897, 13, 1678, 736, 1591, 13, 2 ]
timeparse/LunarSolarConverter/__init__.py
tornadoyi/timeparse
0
7829
# -*- coding: utf-8 -*- __author__ = 'isee15' import LunarSolarConverter converter = LunarSolarConverter.LunarSolarConverter() def LunarToSolar(year, month, day, isleap = False): lunar = LunarSolarConverter.Lunar(year, month, day, isleap) solar = converter.LunarToSolar(lunar) return (solar.solarYear, solar.solarMonth, solar.solarDay) def SolarToLunar(year, month, day): solar = LunarSolarConverter.Solar(year, month, day) lunar = converter.SolarToLunar(solar) return (lunar.lunarYear, lunar.lunarMonth, lunar.lunarDay) def LunarMonthDays(year, month, isleap = False): converter = LunarSolarConverter.LunarSolarConverter days = converter.lunar_month_days[year - converter.lunar_month_days[0]] leap = LunarSolarConverter.GetBitInt(days, 4, 13) offset = 0 loopend = leap if not isleap: if month <= leap or leap == 0: loopend = month - 1 else: loopend = month days = LunarSolarConverter.GetBitInt(days, 1, 12 - loopend) == 1 and 30 or 29 return days
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 1649, 8921, 1649, 353, 525, 895, 29872, 29896, 29945, 29915, 13, 13, 5215, 365, 348, 279, 29903, 10170, 18545, 13, 13, 535, 13549, 353, 365, 348, 279, 29903, 10170, 18545, 29889, 29931, 348, 279, 29903, 10170, 18545, 580, 13, 13, 1753, 365, 348, 279, 1762, 29903, 10170, 29898, 6360, 29892, 4098, 29892, 2462, 29892, 338, 280, 481, 353, 7700, 1125, 13, 1678, 25081, 279, 353, 365, 348, 279, 29903, 10170, 18545, 29889, 29931, 348, 279, 29898, 6360, 29892, 4098, 29892, 2462, 29892, 338, 280, 481, 29897, 13, 1678, 21635, 353, 29105, 29889, 29931, 348, 279, 1762, 29903, 10170, 29898, 29880, 348, 279, 29897, 13, 1678, 736, 313, 2929, 279, 29889, 2929, 279, 12883, 29892, 21635, 29889, 2929, 279, 13953, 29892, 21635, 29889, 2929, 279, 12742, 29897, 13, 13, 13, 1753, 4956, 279, 1762, 29931, 348, 279, 29898, 6360, 29892, 4098, 29892, 2462, 1125, 13, 1678, 21635, 353, 365, 348, 279, 29903, 10170, 18545, 29889, 29903, 10170, 29898, 6360, 29892, 4098, 29892, 2462, 29897, 13, 1678, 25081, 279, 353, 29105, 29889, 29903, 10170, 1762, 29931, 348, 279, 29898, 2929, 279, 29897, 13, 1678, 736, 313, 29880, 348, 279, 29889, 29880, 348, 279, 12883, 29892, 25081, 279, 29889, 29880, 348, 279, 13953, 29892, 25081, 279, 29889, 29880, 348, 279, 12742, 29897, 13, 13, 13, 13, 13, 1753, 365, 348, 279, 13953, 25991, 29898, 6360, 29892, 4098, 29892, 338, 280, 481, 353, 7700, 1125, 13, 1678, 29105, 353, 365, 348, 279, 29903, 10170, 18545, 29889, 29931, 348, 279, 29903, 10170, 18545, 13, 1678, 3841, 353, 29105, 29889, 29880, 348, 279, 29918, 10874, 29918, 16700, 29961, 6360, 448, 29105, 29889, 29880, 348, 279, 29918, 10874, 29918, 16700, 29961, 29900, 5262, 13, 1678, 454, 481, 353, 365, 348, 279, 29903, 10170, 18545, 29889, 2577, 21591, 2928, 29898, 16700, 29892, 29871, 29946, 29892, 29871, 29896, 29941, 29897, 13, 1678, 9210, 353, 29871, 29900, 13, 1678, 2425, 355, 353, 454, 481, 13, 1678, 565, 451, 338, 280, 481, 29901, 13, 13, 4706, 565, 4098, 5277, 454, 481, 470, 454, 481, 1275, 29871, 29900, 29901, 13, 9651, 2425, 355, 353, 4098, 448, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 2425, 355, 353, 4098, 13, 13, 1678, 3841, 353, 365, 348, 279, 29903, 10170, 18545, 29889, 2577, 21591, 2928, 29898, 16700, 29892, 29871, 29896, 29892, 29871, 29896, 29906, 448, 2425, 355, 29897, 1275, 29871, 29896, 322, 29871, 29941, 29900, 470, 29871, 29906, 29929, 13, 1678, 736, 3841, 13, 2 ]
src/sashimi/__main__.py
solstag/isgc-congress
0
157512
<reponame>solstag/isgc-congress import sys from pathlib import Path from . import get_data from .clean import check_clean # User input ISGC_FILES_DIR = Path(sys.argv[1] if len(sys.argv) > 1 else ".") ISGC_FILES = [ ISGC_FILES_DIR / file for file in ["abstracts_contents_2015.tsv", "abstracts_contents_1719.tsv"] ] CLEAN_FILE = "abstracts_contents_clean.csv.xz" ACTION = sys.argv[2] if len(sys.argv) > 2 else "check_clean" START = int(sys.argv[3]) if len(sys.argv) > 3 else 0 def main(): if ACTION == "check_clean": unclean = get_data(ISGC_FILES, False) clean = get_data(ISGC_FILES, True) clean.to_csv(CLEAN_FILE) check_clean(unclean, clean["abstract_text"], START) elif ACTION == "sashimi": import sashimi try: a = sashimi.load() except FileNotFoundError: a = sashimi.bootstrap() sashimi.plot(a) main()
[ 1, 529, 276, 1112, 420, 29958, 2929, 24403, 29914, 275, 27354, 29899, 535, 3663, 13, 5215, 10876, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 869, 1053, 679, 29918, 1272, 13, 3166, 869, 14941, 1053, 1423, 29918, 14941, 13, 13, 29937, 4911, 1881, 13, 3235, 8766, 29918, 24483, 29918, 9464, 353, 10802, 29898, 9675, 29889, 19218, 29961, 29896, 29962, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29896, 1683, 11393, 1159, 13, 3235, 8766, 29918, 24483, 353, 518, 13, 1678, 8519, 8766, 29918, 24483, 29918, 9464, 847, 934, 13, 1678, 363, 934, 297, 6796, 16595, 29879, 29918, 10853, 29918, 29906, 29900, 29896, 29945, 29889, 1372, 29894, 613, 376, 16595, 29879, 29918, 10853, 29918, 29896, 29955, 29896, 29929, 29889, 1372, 29894, 3108, 13, 29962, 13, 29907, 1307, 2190, 29918, 7724, 353, 376, 16595, 29879, 29918, 10853, 29918, 14941, 29889, 7638, 29889, 29916, 29920, 29908, 13, 24705, 353, 10876, 29889, 19218, 29961, 29906, 29962, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29906, 1683, 376, 3198, 29918, 14941, 29908, 13, 25826, 353, 938, 29898, 9675, 29889, 19218, 29961, 29941, 2314, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29941, 1683, 29871, 29900, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 565, 319, 9838, 1275, 376, 3198, 29918, 14941, 1115, 13, 4706, 443, 14941, 353, 679, 29918, 1272, 29898, 3235, 8766, 29918, 24483, 29892, 7700, 29897, 13, 4706, 5941, 353, 679, 29918, 1272, 29898, 3235, 8766, 29918, 24483, 29892, 5852, 29897, 13, 4706, 5941, 29889, 517, 29918, 7638, 29898, 29907, 1307, 2190, 29918, 7724, 29897, 13, 4706, 1423, 29918, 14941, 29898, 348, 14941, 29892, 5941, 3366, 16595, 29918, 726, 12436, 6850, 8322, 29897, 13, 1678, 25342, 319, 9838, 1275, 376, 29879, 1161, 10233, 1115, 13, 4706, 1053, 269, 1161, 10233, 13, 4706, 1018, 29901, 13, 9651, 263, 353, 269, 1161, 10233, 29889, 1359, 580, 13, 4706, 5174, 3497, 17413, 2392, 29901, 13, 9651, 263, 353, 269, 1161, 10233, 29889, 8704, 580, 13, 4706, 269, 1161, 10233, 29889, 5317, 29898, 29874, 29897, 13, 13, 13, 3396, 580, 13, 2 ]
tests/util.py
cook-health/messaging
0
102250
import re import pytest try: from urllib.parse import urlparse except ImportError: from urlparse import urlparse import responses def request_body(): return responses.calls[0].request.body def request_query(): return urlparse(responses.calls[0].request.url).query def request_user_agent(): return responses.calls[0].request.headers['User-Agent'] def request_authorization(): return responses.calls[0].request.headers['Authorization'].decode('utf-8') def request_content_type(): return responses.calls[0].request.headers['Content-Type'] def stub(method, url): responses.add(method, url, body='{"key":"value"}', status=200, content_type='application/json') def assert_re(pattern, string): __tracebackhide__ = True if not re.search(pattern, string): pytest.fail("Cannot find pattern %r in %r" % (pattern, string))
[ 1, 1053, 337, 13, 13, 5215, 11451, 1688, 13, 13, 2202, 29901, 13, 1678, 515, 3142, 1982, 29889, 5510, 1053, 3142, 5510, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 3142, 5510, 1053, 3142, 5510, 13, 13, 5215, 20890, 13, 13, 13, 1753, 2009, 29918, 2587, 7295, 13, 1678, 736, 20890, 29889, 29883, 4293, 29961, 29900, 1822, 3827, 29889, 2587, 13, 13, 13, 1753, 2009, 29918, 1972, 7295, 13, 1678, 736, 3142, 5510, 29898, 26679, 267, 29889, 29883, 4293, 29961, 29900, 1822, 3827, 29889, 2271, 467, 1972, 13, 13, 13, 1753, 2009, 29918, 1792, 29918, 14748, 7295, 13, 1678, 736, 20890, 29889, 29883, 4293, 29961, 29900, 1822, 3827, 29889, 13662, 1839, 2659, 29899, 19661, 2033, 13, 13, 13, 1753, 2009, 29918, 8921, 2133, 7295, 13, 1678, 736, 20890, 29889, 29883, 4293, 29961, 29900, 1822, 3827, 29889, 13662, 1839, 25471, 13359, 13808, 877, 9420, 29899, 29947, 1495, 13, 13, 13, 1753, 2009, 29918, 3051, 29918, 1853, 7295, 13, 1678, 736, 20890, 29889, 29883, 4293, 29961, 29900, 1822, 3827, 29889, 13662, 1839, 3916, 29899, 1542, 2033, 13, 13, 13, 1753, 19281, 29898, 5696, 29892, 3142, 1125, 13, 1678, 20890, 29889, 1202, 29898, 5696, 29892, 3142, 29892, 3573, 2433, 6377, 1989, 4710, 1767, 9092, 742, 4660, 29922, 29906, 29900, 29900, 29892, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 1495, 13, 13, 13, 1753, 4974, 29918, 276, 29898, 11037, 29892, 1347, 1125, 13, 1678, 4770, 15003, 1627, 11458, 1649, 353, 5852, 13, 1678, 565, 451, 337, 29889, 4478, 29898, 11037, 29892, 1347, 1125, 13, 4706, 11451, 1688, 29889, 14057, 703, 29089, 1284, 4766, 1273, 29878, 297, 1273, 29878, 29908, 1273, 313, 11037, 29892, 1347, 876, 13, 2 ]
scripts/colour_names.py
cbosoft/aite
0
192071
<reponame>cbosoft/aite<gh_stars>0 from matplotlib import pyplot as plt import numpy as np NAMES_OF_COLOURS = [ (( 0.0, 1.00, 1.00), 'red'), (( 4.0, 0.71, 1.00), 'orange-red'), (( 35.0, 0.92, 0.53), 'brown'), (( 45.0, 1.00, 1.00), 'orange'), (( 60.0, 1.00, 1.00), 'yellow'), (( 84.0, 0.82, 1.00), 'yellow-green'), (( 120.0, 1.00, 1.00), 'lime-green'), (( 136.0, 1.00, 0.76), 'green'), (( 180.0, 1.00, 1.00), 'cyan'), (( 240.0, 1.00, 1.00), 'blue'), (( 275.0, 0.92, 0.68), 'purple'), (( 300.0, 1.00, 1.00), 'magenta'), (( 300.0, 0.54, 0.99), 'pink'), ((np.nan, 0.00, 0.00), 'black'), ((np.nan, 0.00, 0.50), 'grey'), ((np.nan, 0.00, 1.00), 'white') ] UNSAT = [ 'dilute', 'pale', 'dull' ] SAT = [ 'lively', 'spirited', 'intense', 'vivid' ] BRIGHT = [ 'bright', 'vibrant' ] DARK = [ 'dark', 'gloomy' ] def norm(colour): h, s, v = colour h = h/150.0 return h, s, v def linear(colour): h, s, v = colour h = 2.0*np.pi*h/360.0 return s*v*np.cos(h), s*v*np.sin(h), v def cdist(col1, col2): linear1 = linear(col1) linear2 = linear(col2) dist = np.sum(np.power(np.subtract(linear1, linear2), 2.0)) return dist def name_colour(colour): h, s, v = colour min_dist = 1e9 name = 'na' ignore_hue = colour[1] <= 0.25 norm_colour = norm(colour) if ignore_hue: norm_colour = norm_colour[1:] for named_colour, colour_name in NAMES_OF_COLOURS: norm_named_colour = norm(named_colour) if ignore_hue: norm_named_colour = norm_named_colour[1:] #dist = np.sum(np.power(np.subtract(norm_named_colour, norm_colour), 2.0)) dist = cdist(named_colour, colour) if dist < min_dist: min_dist = dist name = colour_name description = list() if s < 0.5: description.insert(0, np.random.choice(UNSAT)) else: if s > 0.95: description.insert(0, np.random.choice(SAT)) if v < 0.5: description.insert(0, np.random.choice(DARK)) elif v > 0.8: description.insert(0, np.random.choice(BRIGHT)) # if description: # name = ', '.join(description) + ' ' + name return name def hsv2rgb(h, s, v): if s > 1.0: s = 1.0 if s < 0.0: s = 0.0 if v > 1.0: v = 1.0 if v < 0.0: v = 0.0 if s == 0.0: return (v, v, v) hh = np.fmod(h, 360.0) hh /= 60.0 i = int(hh); ff = hh - float(i) p = v*(1.0 - s) q = v*(1.0 - s*ff) t = v*(1.0 - (s*(1.0 - ff))) if i == 0: return v, t, p elif i == 1: return q, v, p elif i == 2: return p, v, t elif i == 3: return p, q, v elif i == 4: return t, p, v else: return v, p, q if __name__ == '__main__': colour = (136.0, 1.0, 1.0) plt.gca().add_artist(plt.Circle((0.5,0.5), 1.0, color=hsv2rgb(*colour))) plt.text(0.5,0.5, name_colour(colour), ha='center', va='center') plt.savefig('colour.pdf')
[ 1, 529, 276, 1112, 420, 29958, 10702, 9064, 615, 29914, 29874, 568, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 13, 5215, 12655, 408, 7442, 13, 13, 5813, 29903, 29918, 9800, 29918, 3217, 3927, 4574, 29903, 353, 518, 13, 1678, 5135, 1678, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 1127, 5477, 13, 1678, 5135, 1678, 29946, 29889, 29900, 29892, 29871, 29900, 29889, 29955, 29896, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 272, 927, 29899, 1127, 5477, 13, 1678, 5135, 259, 29941, 29945, 29889, 29900, 29892, 29871, 29900, 29889, 29929, 29906, 29892, 29871, 29900, 29889, 29945, 29941, 511, 525, 29890, 4708, 5477, 13, 1678, 5135, 259, 29946, 29945, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 272, 927, 5477, 13, 1678, 5135, 259, 29953, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 29136, 5477, 13, 1678, 5135, 259, 29947, 29946, 29889, 29900, 29892, 29871, 29900, 29889, 29947, 29906, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 29136, 29899, 12692, 5477, 13, 1678, 5135, 29871, 29896, 29906, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 28046, 29899, 12692, 5477, 13, 1678, 5135, 29871, 29896, 29941, 29953, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29900, 29889, 29955, 29953, 511, 525, 12692, 5477, 13, 1678, 5135, 29871, 29896, 29947, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 1270, 273, 5477, 13, 1678, 5135, 29871, 29906, 29946, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 9539, 5477, 13, 1678, 5135, 29871, 29906, 29955, 29945, 29889, 29900, 29892, 29871, 29900, 29889, 29929, 29906, 29892, 29871, 29900, 29889, 29953, 29947, 511, 525, 15503, 552, 5477, 13, 1678, 5135, 29871, 29941, 29900, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 11082, 6381, 5477, 13, 1678, 5135, 29871, 29941, 29900, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29945, 29946, 29892, 29871, 29900, 29889, 29929, 29929, 511, 525, 29886, 682, 5477, 13, 1678, 5135, 9302, 29889, 13707, 29892, 29871, 29900, 29889, 29900, 29900, 29892, 29871, 29900, 29889, 29900, 29900, 511, 525, 8517, 5477, 13, 1678, 5135, 9302, 29889, 13707, 29892, 29871, 29900, 29889, 29900, 29900, 29892, 29871, 29900, 29889, 29945, 29900, 511, 525, 7979, 29891, 5477, 13, 1678, 5135, 9302, 29889, 13707, 29892, 29871, 29900, 29889, 29900, 29900, 29892, 29871, 29896, 29889, 29900, 29900, 511, 525, 10921, 1495, 13, 29962, 13, 13, 29965, 3059, 1299, 353, 518, 13, 1678, 525, 29881, 309, 1082, 742, 13, 1678, 525, 29886, 744, 742, 13, 1678, 525, 29881, 913, 29915, 13, 29962, 13, 13, 29903, 1299, 353, 518, 13, 1678, 525, 29880, 3598, 742, 13, 1678, 525, 1028, 381, 1573, 742, 13, 1678, 525, 524, 1947, 742, 13, 1678, 525, 29894, 3640, 29915, 13, 29962, 13, 13, 29933, 22789, 3912, 353, 518, 13, 1678, 525, 1182, 523, 742, 13, 1678, 525, 29894, 4626, 424, 29915, 13, 29962, 13, 13, 29928, 1718, 29968, 353, 518, 13, 1678, 525, 26031, 742, 13, 1678, 525, 29887, 417, 16103, 29915, 13, 29962, 13, 13, 13, 13, 1753, 6056, 29898, 1054, 473, 1125, 13, 1678, 298, 29892, 269, 29892, 325, 353, 12384, 13, 1678, 298, 353, 298, 29914, 29896, 29945, 29900, 29889, 29900, 13, 1678, 736, 298, 29892, 269, 29892, 325, 13, 13, 1753, 5608, 29898, 1054, 473, 1125, 13, 1678, 298, 29892, 269, 29892, 325, 353, 12384, 13, 1678, 298, 353, 29871, 29906, 29889, 29900, 29930, 9302, 29889, 1631, 29930, 29882, 29914, 29941, 29953, 29900, 29889, 29900, 13, 1678, 736, 269, 29930, 29894, 29930, 9302, 29889, 3944, 29898, 29882, 511, 269, 29930, 29894, 29930, 9302, 29889, 5223, 29898, 29882, 511, 325, 13, 13, 1753, 274, 5721, 29898, 1054, 29896, 29892, 784, 29906, 1125, 13, 1678, 5608, 29896, 353, 5608, 29898, 1054, 29896, 29897, 13, 1678, 5608, 29906, 353, 5608, 29898, 1054, 29906, 29897, 13, 1678, 1320, 353, 7442, 29889, 2083, 29898, 9302, 29889, 13519, 29898, 9302, 29889, 1491, 29873, 1461, 29898, 10660, 29896, 29892, 5608, 29906, 511, 29871, 29906, 29889, 29900, 876, 13, 1678, 736, 1320, 13, 13, 1753, 1024, 29918, 1054, 473, 29898, 1054, 473, 1125, 13, 1678, 298, 29892, 269, 29892, 325, 353, 12384, 13, 1678, 1375, 29918, 5721, 353, 29871, 29896, 29872, 29929, 13, 1678, 1024, 353, 525, 1056, 29915, 13, 1678, 11455, 29918, 29882, 434, 353, 12384, 29961, 29896, 29962, 5277, 29871, 29900, 29889, 29906, 29945, 13, 1678, 6056, 29918, 1054, 473, 353, 6056, 29898, 1054, 473, 29897, 13, 1678, 565, 11455, 29918, 29882, 434, 29901, 13, 4706, 6056, 29918, 1054, 473, 353, 6056, 29918, 1054, 473, 29961, 29896, 17531, 13, 1678, 363, 4257, 29918, 1054, 473, 29892, 12384, 29918, 978, 297, 27085, 29903, 29918, 9800, 29918, 3217, 3927, 4574, 29903, 29901, 13, 4706, 6056, 29918, 17514, 29918, 1054, 473, 353, 6056, 29898, 17514, 29918, 1054, 473, 29897, 13, 4706, 565, 11455, 29918, 29882, 434, 29901, 13, 9651, 6056, 29918, 17514, 29918, 1054, 473, 353, 6056, 29918, 17514, 29918, 1054, 473, 29961, 29896, 17531, 13, 4706, 396, 5721, 353, 7442, 29889, 2083, 29898, 9302, 29889, 13519, 29898, 9302, 29889, 1491, 29873, 1461, 29898, 12324, 29918, 17514, 29918, 1054, 473, 29892, 6056, 29918, 1054, 473, 511, 29871, 29906, 29889, 29900, 876, 13, 4706, 1320, 353, 274, 5721, 29898, 17514, 29918, 1054, 473, 29892, 12384, 29897, 13, 4706, 565, 1320, 529, 1375, 29918, 5721, 29901, 13, 9651, 1375, 29918, 5721, 353, 1320, 13, 9651, 1024, 353, 12384, 29918, 978, 13, 13, 1678, 6139, 353, 1051, 580, 13, 1678, 565, 269, 529, 29871, 29900, 29889, 29945, 29901, 13, 4706, 6139, 29889, 7851, 29898, 29900, 29892, 7442, 29889, 8172, 29889, 16957, 29898, 29965, 3059, 1299, 876, 13, 1678, 1683, 29901, 13, 4706, 565, 269, 1405, 29871, 29900, 29889, 29929, 29945, 29901, 13, 9651, 6139, 29889, 7851, 29898, 29900, 29892, 7442, 29889, 8172, 29889, 16957, 29898, 29903, 1299, 876, 13, 268, 13, 4706, 565, 325, 529, 29871, 29900, 29889, 29945, 29901, 13, 9651, 6139, 29889, 7851, 29898, 29900, 29892, 7442, 29889, 8172, 29889, 16957, 29898, 29928, 1718, 29968, 876, 13, 4706, 25342, 325, 1405, 29871, 29900, 29889, 29947, 29901, 13, 9651, 6139, 29889, 7851, 29898, 29900, 29892, 7442, 29889, 8172, 29889, 16957, 29898, 29933, 22789, 3912, 876, 13, 13, 1678, 396, 565, 6139, 29901, 13, 1678, 396, 268, 1024, 353, 13420, 15300, 7122, 29898, 8216, 29897, 718, 525, 525, 718, 1024, 13, 1678, 736, 1024, 13, 13, 1753, 298, 4501, 29906, 23973, 29898, 29882, 29892, 269, 29892, 325, 1125, 13, 13, 1678, 565, 269, 1405, 29871, 29896, 29889, 29900, 29901, 13, 4706, 269, 353, 29871, 29896, 29889, 29900, 13, 1678, 565, 269, 529, 29871, 29900, 29889, 29900, 29901, 13, 4706, 269, 353, 29871, 29900, 29889, 29900, 13, 1678, 565, 325, 1405, 29871, 29896, 29889, 29900, 29901, 13, 4706, 325, 353, 29871, 29896, 29889, 29900, 13, 1678, 565, 325, 529, 29871, 29900, 29889, 29900, 29901, 13, 4706, 325, 353, 29871, 29900, 29889, 29900, 13, 13, 1678, 565, 269, 1275, 29871, 29900, 29889, 29900, 29901, 13, 4706, 736, 313, 29894, 29892, 325, 29892, 325, 29897, 13, 13, 1678, 298, 29882, 353, 7442, 29889, 29888, 1545, 29898, 29882, 29892, 29871, 29941, 29953, 29900, 29889, 29900, 29897, 13, 1678, 298, 29882, 847, 29922, 29871, 29953, 29900, 29889, 29900, 13, 1678, 474, 353, 938, 29898, 25446, 416, 13, 1678, 14336, 353, 298, 29882, 448, 5785, 29898, 29875, 29897, 13, 1678, 282, 353, 325, 16395, 29896, 29889, 29900, 448, 269, 29897, 13, 1678, 3855, 353, 325, 16395, 29896, 29889, 29900, 448, 269, 29930, 600, 29897, 13, 1678, 260, 353, 325, 16395, 29896, 29889, 29900, 448, 313, 29879, 16395, 29896, 29889, 29900, 448, 14336, 4961, 13, 1678, 565, 474, 1275, 29871, 29900, 29901, 13, 4706, 736, 325, 29892, 260, 29892, 282, 13, 1678, 25342, 474, 1275, 29871, 29896, 29901, 13, 4706, 736, 3855, 29892, 325, 29892, 282, 13, 1678, 25342, 474, 1275, 29871, 29906, 29901, 13, 4706, 736, 282, 29892, 325, 29892, 260, 13, 1678, 25342, 474, 1275, 29871, 29941, 29901, 13, 4706, 736, 282, 29892, 3855, 29892, 325, 13, 1678, 25342, 474, 1275, 29871, 29946, 29901, 13, 4706, 736, 260, 29892, 282, 29892, 325, 13, 1678, 1683, 29901, 13, 4706, 736, 325, 29892, 282, 29892, 3855, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 12384, 353, 313, 29896, 29941, 29953, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29897, 13, 1678, 14770, 29889, 29887, 1113, 2141, 1202, 29918, 442, 391, 29898, 572, 29873, 29889, 23495, 280, 3552, 29900, 29889, 29945, 29892, 29900, 29889, 29945, 511, 29871, 29896, 29889, 29900, 29892, 2927, 29922, 29882, 4501, 29906, 23973, 10456, 1054, 473, 4961, 13, 1678, 14770, 29889, 726, 29898, 29900, 29889, 29945, 29892, 29900, 29889, 29945, 29892, 1024, 29918, 1054, 473, 29898, 1054, 473, 511, 447, 2433, 5064, 742, 2947, 2433, 5064, 1495, 13, 1678, 14770, 29889, 7620, 1003, 877, 1054, 473, 29889, 5140, 1495, 13, 2 ]
GitSearch.py
inishchith/GithubTools
1
24319
# Find file contents via various criteria.
[ 1, 396, 10987, 934, 8118, 3025, 5164, 16614, 29889, 2 ]
accounts/tests.py
HerbyDE/jagdreisencheck-webapp
0
39988
from django.contrib.auth.hashers import check_password from django.test import TestCase from accounts.forms import CreateBaseUserInstance from accounts.models import User # Unit tests for SignUp and Registration class UserManagementTestCase(TestCase): def test_create_base_user_form(self): ''' Test form behavior. Failure and Validation. This method checks whether the :return: ''' invalid_base_data = { 'email': '<EMAIL>', 'username': 'maxmustermann', 'password': '<PASSWORD>', 'confirm_passwd': '<PASSWORD>', 'first_name': 'Max', 'last_name': 'Mustermann', 'country_of_residence': 'DE', 'agree_to_privacy': True, 'agree_to_tos': True } valid_base_data = { 'email': '<EMAIL>', 'username': 'maxmustermann', 'password': '<PASSWORD>', 'confirm_passwd': '<PASSWORD>', 'first_name': 'Max', 'last_name': 'Mustermann', 'country_of_residence': 'DE', 'agree_to_privacy': True, 'agree_to_tos': True } # Test form with invalid data form = CreateBaseUserInstance(data=invalid_base_data) form.is_valid() self.assertTrue(form.errors) # Test form with valid data and write it to the database. Then retrieve the base user instance and compare it to # the submitted form. form = CreateBaseUserInstance(data=valid_base_data) form.is_valid() self.assertFalse(form.errors) form = form.save(commit=False) self.assertTrue(isinstance(form, User)) form.save() maxi = User.objects.get(email='<EMAIL>') self.assertEqual(maxi, form, msg="User found in DB.") self.assertTrue(check_password(valid_base_data['password'], <PASSWORD>.password)) def test_create_individual_user(self): ''' Test the individual user creation procedure. Uses the base user created in the base user test. :return: ''' pass
[ 1, 515, 9557, 29889, 21570, 29889, 5150, 29889, 8568, 414, 1053, 1423, 29918, 5630, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 13, 13, 3166, 15303, 29889, 9514, 1053, 6204, 5160, 2659, 4998, 13, 3166, 15303, 29889, 9794, 1053, 4911, 13, 13, 13, 29937, 13223, 6987, 363, 9954, 3373, 322, 2169, 8306, 13, 1990, 4911, 27107, 3057, 8259, 29898, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 3188, 29918, 1792, 29918, 689, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 4321, 883, 6030, 29889, 29098, 545, 322, 15758, 362, 29889, 13, 4706, 910, 1158, 12747, 3692, 278, 13, 4706, 584, 2457, 29901, 13, 4706, 14550, 13, 4706, 8340, 29918, 3188, 29918, 1272, 353, 426, 13, 9651, 525, 5269, 2396, 12801, 26862, 6227, 29958, 742, 13, 9651, 525, 6786, 2396, 525, 3317, 21969, 20648, 742, 13, 9651, 525, 5630, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 26897, 29918, 3364, 9970, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 4102, 29918, 978, 2396, 525, 7976, 742, 13, 9651, 525, 4230, 29918, 978, 2396, 525, 29924, 504, 20648, 742, 13, 9651, 525, 13509, 29918, 974, 29918, 690, 5084, 2396, 525, 2287, 742, 13, 9651, 525, 351, 929, 29918, 517, 29918, 22534, 4135, 2396, 5852, 29892, 13, 9651, 525, 351, 929, 29918, 517, 29918, 29873, 359, 2396, 5852, 13, 4706, 500, 13, 13, 4706, 2854, 29918, 3188, 29918, 1272, 353, 426, 13, 9651, 525, 5269, 2396, 12801, 26862, 6227, 29958, 742, 13, 9651, 525, 6786, 2396, 525, 3317, 21969, 20648, 742, 13, 9651, 525, 5630, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 26897, 29918, 3364, 9970, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 4102, 29918, 978, 2396, 525, 7976, 742, 13, 9651, 525, 4230, 29918, 978, 2396, 525, 29924, 504, 20648, 742, 13, 9651, 525, 13509, 29918, 974, 29918, 690, 5084, 2396, 525, 2287, 742, 13, 9651, 525, 351, 929, 29918, 517, 29918, 22534, 4135, 2396, 5852, 29892, 13, 9651, 525, 351, 929, 29918, 517, 29918, 29873, 359, 2396, 5852, 13, 4706, 500, 13, 13, 4706, 396, 4321, 883, 411, 8340, 848, 13, 4706, 883, 353, 6204, 5160, 2659, 4998, 29898, 1272, 29922, 20965, 29918, 3188, 29918, 1272, 29897, 13, 4706, 883, 29889, 275, 29918, 3084, 580, 13, 4706, 1583, 29889, 9294, 5574, 29898, 689, 29889, 12523, 29897, 13, 13, 4706, 396, 4321, 883, 411, 2854, 848, 322, 2436, 372, 304, 278, 2566, 29889, 1987, 10563, 278, 2967, 1404, 2777, 322, 7252, 372, 304, 13, 4706, 396, 278, 18397, 883, 29889, 13, 4706, 883, 353, 6204, 5160, 2659, 4998, 29898, 1272, 29922, 3084, 29918, 3188, 29918, 1272, 29897, 13, 4706, 883, 29889, 275, 29918, 3084, 580, 13, 4706, 1583, 29889, 9294, 8824, 29898, 689, 29889, 12523, 29897, 13, 4706, 883, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 689, 29892, 4911, 876, 13, 4706, 883, 29889, 7620, 580, 13, 4706, 4236, 29875, 353, 4911, 29889, 12650, 29889, 657, 29898, 5269, 2433, 29966, 26862, 6227, 29958, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 3317, 29875, 29892, 883, 29892, 10191, 543, 2659, 1476, 297, 6535, 23157, 13, 4706, 1583, 29889, 9294, 5574, 29898, 3198, 29918, 5630, 29898, 3084, 29918, 3188, 29918, 1272, 1839, 5630, 7464, 529, 25711, 17013, 15513, 5630, 876, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 513, 23352, 29918, 1792, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 4321, 278, 5375, 1404, 11265, 8792, 29889, 10783, 267, 278, 2967, 1404, 2825, 297, 278, 2967, 1404, 1243, 29889, 13, 4706, 584, 2457, 29901, 13, 4706, 14550, 13, 4706, 1209, 2 ]
symposion/speakers/migrations/0001_initial.py
azkarmoulana/pycon
154
1613217
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import datetime from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Speaker', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(help_text='As you would like it to appear in the conference program.', max_length=100)), ('biography', models.TextField(help_text='A little bit about you. 100 words or less, please. This will be used in print publications so please keep it simple, no links or formatting.')), ('photo', models.ImageField(upload_to=b'speaker_photos', blank=True)), ('twitter_username', models.CharField(help_text='Your Twitter account', max_length=15, blank=True)), ('annotation', models.TextField()), ('invite_email', models.CharField(max_length=200, unique=True, null=True, db_index=True)), ('invite_token', models.CharField(max_length=40, db_index=True)), ('created', models.DateTimeField(default=datetime.datetime.now, editable=False)), ('sessions_preference', models.IntegerField(blank=True, help_text="If you've submitted multiple talk proposals, please let us know if you only want to give one or if you'd like to give two talks. For tutorials and posters, state similar preferences in the additional notes section of your proposals.", null=True, choices=[(1, 'One'), (2, 'Two')])), ('user', models.OneToOneField(related_name='speaker_profile', null=True, to=settings.AUTH_USER_MODEL)), ], options={ 'ordering': ['name'], }, bases=(models.Model,), ), ]
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 9557, 29889, 2585, 1053, 4733, 29892, 9725, 800, 13, 5215, 12865, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 9725, 800, 29889, 2774, 932, 519, 29918, 10836, 29898, 11027, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 511, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 10649, 5790, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 12300, 3073, 29898, 369, 15828, 29918, 978, 2433, 1367, 742, 28755, 29922, 8824, 29892, 4469, 29918, 11600, 29922, 5574, 29892, 7601, 29918, 1989, 29922, 5574, 8243, 13, 18884, 6702, 978, 742, 4733, 29889, 27890, 29898, 8477, 29918, 726, 2433, 2887, 366, 723, 763, 372, 304, 2615, 297, 278, 21362, 1824, 29889, 742, 4236, 29918, 2848, 29922, 29896, 29900, 29900, 8243, 13, 18884, 6702, 5365, 5275, 742, 4733, 29889, 15778, 29898, 8477, 29918, 726, 2433, 29909, 2217, 2586, 1048, 366, 29889, 29871, 29896, 29900, 29900, 3838, 470, 3109, 29892, 3113, 29889, 910, 674, 367, 1304, 297, 1596, 25964, 577, 3113, 3013, 372, 2560, 29892, 694, 2988, 470, 15998, 29889, 1495, 511, 13, 18884, 6702, 21596, 742, 4733, 29889, 2940, 3073, 29898, 9009, 29918, 517, 29922, 29890, 29915, 5965, 5790, 29918, 561, 15788, 742, 9654, 29922, 5574, 8243, 13, 18884, 6702, 24946, 29918, 6786, 742, 4733, 29889, 27890, 29898, 8477, 29918, 726, 2433, 10858, 20147, 3633, 742, 4236, 29918, 2848, 29922, 29896, 29945, 29892, 9654, 29922, 5574, 8243, 13, 18884, 6702, 18317, 742, 4733, 29889, 15778, 25739, 13, 18884, 6702, 11569, 568, 29918, 5269, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29900, 29900, 29892, 5412, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 4833, 29918, 2248, 29922, 5574, 8243, 13, 18884, 6702, 11569, 568, 29918, 6979, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29946, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 8243, 13, 18884, 6702, 11600, 742, 4733, 29889, 11384, 3073, 29898, 4381, 29922, 12673, 29889, 12673, 29889, 3707, 29892, 3863, 519, 29922, 8824, 8243, 13, 18884, 6702, 29879, 10964, 29918, 1457, 1659, 742, 4733, 29889, 7798, 3073, 29898, 19465, 29922, 5574, 29892, 1371, 29918, 726, 543, 3644, 366, 29915, 345, 18397, 2999, 5193, 9551, 1338, 29892, 3113, 1235, 502, 1073, 565, 366, 871, 864, 304, 2367, 697, 470, 565, 366, 29915, 29881, 763, 304, 2367, 1023, 5969, 2039, 29889, 29871, 1152, 25410, 322, 1400, 414, 29892, 2106, 2788, 5821, 2063, 297, 278, 5684, 11486, 4004, 310, 596, 9551, 1338, 19602, 1870, 29922, 5574, 29892, 19995, 11759, 29898, 29896, 29892, 525, 6716, 5477, 313, 29906, 29892, 525, 13985, 1495, 2314, 511, 13, 18884, 6702, 1792, 742, 4733, 29889, 6716, 1762, 6716, 3073, 29898, 12817, 29918, 978, 2433, 5965, 5790, 29918, 10185, 742, 1870, 29922, 5574, 29892, 304, 29922, 11027, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 8243, 13, 9651, 21251, 13, 9651, 3987, 3790, 13, 18884, 525, 2098, 292, 2396, 6024, 978, 7464, 13, 9651, 2981, 13, 9651, 22561, 7607, 9794, 29889, 3195, 29892, 511, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
__pkg_metadata__.py
douglatornell/randopony-tetra
1
1605268
<reponame>douglatornell/randopony-tetra """RandoPony-tetra package metadata. """ # pragma: no cover number = '2017' release = '.1' dev_status = '5 - Production/Stable'
[ 1, 529, 276, 1112, 420, 29958, 29881, 692, 29880, 1061, 18437, 29914, 9502, 459, 2592, 29899, 29873, 27280, 13, 15945, 29908, 29934, 1743, 29925, 2592, 29899, 29873, 27280, 3577, 15562, 29889, 13, 15945, 29908, 13, 13, 29937, 282, 23929, 29901, 694, 4612, 13, 4537, 353, 525, 29906, 29900, 29896, 29955, 29915, 13, 14096, 353, 15300, 29896, 29915, 13, 3359, 29918, 4882, 353, 525, 29945, 448, 19561, 29914, 855, 519, 29915, 13, 2 ]
youtuatools/extractor/ctv.py
Pagasis/YouTua
47
1612176
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class CTVIE(InfoExtractor): _VALID_URL = r"https?://(?:www\.)?ctv\.ca/(?P<id>(?:show|movie)s/[^/]+/[^/?#&]+)" _TESTS = [ { "url": "https://www.ctv.ca/shows/your-morning/wednesday-december-23-2020-s5e88", "info_dict": { "id": "2102249", "ext": "flv", "title": "Wednesday, December 23, 2020", "thumbnail": r"re:^https?://.*\.jpg$", "description": "Your Morning delivers original perspectives and unique insights into the headlines of the day.", "timestamp": 1608732000, "upload_date": "20201223", "series": "Your Morning", "season": "2020-2021", "season_number": 5, "episode_number": 88, "tags": ["Your Morning"], "categories": ["Talk Show"], "duration": 7467.126, }, }, { "url": "https://www.ctv.ca/movies/adam-sandlers-eight-crazy-nights/adam-sandlers-eight-crazy-nights", "only_matching": True, }, ] def _real_extract(self, url): display_id = self._match_id(url) content = self._download_json( "https://www.ctv.ca/space-graphql/graphql", display_id, query={ "query": """{ resolvedPath(path: "/%s") { lastSegment { content { ... on AxisContent { axisId videoPlayerDestCode } } } } }""" % display_id, }, )["data"]["resolvedPath"]["lastSegment"]["content"] video_id = content["axisId"] return self.url_result( "9c9media:%s:%s" % (content["videoPlayerDestCode"], video_id), "NineCNineMedia", video_id, )
[ 1, 396, 14137, 29901, 23616, 29899, 29947, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 869, 9435, 1053, 22140, 5647, 28891, 13, 13, 13, 1990, 315, 8050, 8673, 29898, 3401, 5647, 28891, 1125, 13, 1678, 903, 26707, 29918, 4219, 353, 364, 29908, 991, 29973, 597, 10780, 29901, 1636, 29905, 1846, 29973, 312, 29894, 23301, 1113, 29914, 10780, 29925, 29966, 333, 5961, 25825, 4294, 29989, 27362, 29897, 29879, 29914, 22896, 29914, 10062, 29914, 22896, 13401, 29937, 29987, 10062, 5513, 13, 1678, 903, 18267, 29903, 353, 518, 13, 4706, 426, 13, 9651, 376, 2271, 1115, 376, 991, 597, 1636, 29889, 312, 29894, 29889, 1113, 29914, 845, 1242, 29914, 8066, 29899, 12257, 1076, 29914, 8734, 4515, 3250, 29899, 7099, 1096, 29899, 29906, 29941, 29899, 29906, 29900, 29906, 29900, 29899, 29879, 29945, 29872, 29947, 29947, 613, 13, 9651, 376, 3888, 29918, 8977, 1115, 426, 13, 18884, 376, 333, 1115, 376, 29906, 29896, 29900, 29906, 29906, 29946, 29929, 613, 13, 18884, 376, 1062, 1115, 376, 1579, 29894, 613, 13, 18884, 376, 3257, 1115, 376, 29956, 287, 4515, 3250, 29892, 5846, 29871, 29906, 29941, 29892, 29871, 29906, 29900, 29906, 29900, 613, 13, 18884, 376, 386, 21145, 1115, 364, 29908, 276, 29901, 29985, 991, 29973, 597, 5575, 23301, 6173, 29938, 613, 13, 18884, 376, 8216, 1115, 376, 10858, 3879, 1076, 628, 1536, 2441, 3736, 1103, 3145, 322, 5412, 1663, 5861, 964, 278, 2343, 9012, 310, 278, 2462, 19602, 13, 18884, 376, 16394, 1115, 29871, 29896, 29953, 29900, 29947, 29955, 29941, 29906, 29900, 29900, 29900, 29892, 13, 18884, 376, 9009, 29918, 1256, 1115, 376, 29906, 29900, 29906, 29900, 29896, 29906, 29906, 29941, 613, 13, 18884, 376, 13757, 1115, 376, 10858, 3879, 1076, 613, 13, 18884, 376, 25682, 1115, 376, 29906, 29900, 29906, 29900, 29899, 29906, 29900, 29906, 29896, 613, 13, 18884, 376, 25682, 29918, 4537, 1115, 29871, 29945, 29892, 13, 18884, 376, 1022, 275, 356, 29918, 4537, 1115, 29871, 29947, 29947, 29892, 13, 18884, 376, 11338, 1115, 6796, 10858, 3879, 1076, 12436, 13, 18884, 376, 20683, 1115, 6796, 29911, 2235, 7704, 12436, 13, 18884, 376, 19708, 1115, 29871, 29955, 29946, 29953, 29955, 29889, 29896, 29906, 29953, 29892, 13, 9651, 2981, 13, 4706, 2981, 13, 4706, 426, 13, 9651, 376, 2271, 1115, 376, 991, 597, 1636, 29889, 312, 29894, 29889, 1113, 29914, 13529, 583, 29914, 328, 314, 29899, 29879, 392, 9306, 29899, 29872, 523, 29899, 26844, 1537, 29899, 29876, 5861, 29914, 328, 314, 29899, 29879, 392, 9306, 29899, 29872, 523, 29899, 26844, 1537, 29899, 29876, 5861, 613, 13, 9651, 376, 6194, 29918, 4352, 292, 1115, 5852, 29892, 13, 4706, 2981, 13, 1678, 4514, 13, 13, 1678, 822, 903, 6370, 29918, 21111, 29898, 1311, 29892, 3142, 1125, 13, 4706, 2479, 29918, 333, 353, 1583, 3032, 4352, 29918, 333, 29898, 2271, 29897, 13, 4706, 2793, 353, 1583, 3032, 10382, 29918, 3126, 29898, 13, 9651, 376, 991, 597, 1636, 29889, 312, 29894, 29889, 1113, 29914, 3493, 29899, 4262, 1519, 29914, 4262, 1519, 613, 13, 9651, 2479, 29918, 333, 29892, 13, 9651, 2346, 3790, 13, 18884, 376, 1972, 1115, 9995, 29912, 13, 29871, 11527, 2605, 29898, 2084, 29901, 5591, 29995, 29879, 1159, 426, 13, 1678, 1833, 17669, 358, 426, 13, 418, 2793, 426, 13, 4706, 2023, 373, 319, 11497, 3916, 426, 13, 3986, 9685, 1204, 13, 3986, 4863, 9075, 14994, 3399, 13, 4706, 500, 13, 418, 500, 13, 1678, 500, 13, 29871, 500, 13, 5038, 15945, 13, 18884, 1273, 2479, 29918, 333, 29892, 13, 9651, 2981, 13, 4706, 1723, 3366, 1272, 3108, 3366, 9778, 1490, 2605, 3108, 3366, 4230, 17669, 358, 3108, 3366, 3051, 3108, 13, 4706, 4863, 29918, 333, 353, 2793, 3366, 8990, 1204, 3108, 13, 4706, 736, 1583, 29889, 2271, 29918, 2914, 29898, 13, 9651, 376, 29929, 29883, 29929, 9799, 16664, 29879, 16664, 29879, 29908, 1273, 313, 3051, 3366, 9641, 9075, 14994, 3399, 12436, 4863, 29918, 333, 511, 13, 9651, 376, 29940, 457, 13778, 457, 10572, 613, 13, 9651, 4863, 29918, 333, 29892, 13, 4706, 1723, 13, 2 ]
operators.py
fomightez/stable-fluids
1
181453
<filename>operators.py from functools import reduce from math import factorial import numpy as np import scipy.sparse as sp def differences(accuracy, order): # Implemented based on the article here: http://web.media.mit.edu/~crtaylor/calculator.html # By the properties of square Vandermonde matrices this matrix is invertible (non-singular) # iff all stencil points are unique. This is always the case for this application. def parts(points, o): coefficients = np.vander(points) coefficients = np.linalg.inv(coefficients) return coefficients[-o - 1] * factorial(o) return tuple(parts(range(-accuracy, accuracy + 1), o) for o in order) def matrices(shape, operators, combine): def parts(): for i, o in enumerate(operators): diagonals = [] for j, p in enumerate(o): index = j - len(o) // 2 diagonals.append((p * np.ones(shape[i] - abs(index)), index)) matrix = sp.diags(*zip(*diagonals)) if combine: yield matrix else: # The sum of these kronecker product folds is equivalent to the kronecker sum of all the matrices. # This identity can be derived from the properties of the kronecker product. # This is useful when you need to apply each operator on a different axis, # like in the case of finding the divergence of a velocity field using the gradient. yield reduce(sp.kron, (matrix if k == i else sp.identity(d) for k, d in enumerate(shape))) # Credit to <NAME> for figuring out that kronsum's argument order is reversed. # Without that bit of wisdom I'd have lost it. return reduce(lambda a, b: sp.kronsum(b, a), parts()) if combine else tuple(parts())
[ 1, 529, 9507, 29958, 3372, 4097, 29889, 2272, 13, 3166, 2090, 312, 8789, 1053, 10032, 13, 3166, 5844, 1053, 7329, 616, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 4560, 2272, 29889, 29879, 5510, 408, 805, 13, 13, 13, 1753, 12651, 29898, 562, 2764, 4135, 29892, 1797, 1125, 13, 1678, 396, 1954, 2037, 287, 2729, 373, 278, 4274, 1244, 29901, 1732, 597, 2676, 29889, 9799, 29889, 2415, 29889, 6085, 24629, 29883, 2273, 11017, 29914, 15807, 1061, 29889, 1420, 13, 1678, 396, 2648, 278, 4426, 310, 6862, 478, 392, 837, 13469, 13516, 445, 4636, 338, 21292, 1821, 313, 5464, 29899, 2976, 1070, 29897, 13, 1678, 396, 565, 29888, 599, 380, 3977, 309, 3291, 526, 5412, 29889, 910, 338, 2337, 278, 1206, 363, 445, 2280, 29889, 13, 1678, 822, 5633, 29898, 9748, 29892, 288, 1125, 13, 4706, 16127, 353, 7442, 29889, 29894, 3825, 29898, 9748, 29897, 13, 4706, 16127, 353, 7442, 29889, 29880, 979, 29887, 29889, 11569, 29898, 1111, 8462, 29879, 29897, 13, 4706, 736, 16127, 14352, 29877, 448, 29871, 29896, 29962, 334, 7329, 616, 29898, 29877, 29897, 13, 13, 1678, 736, 18761, 29898, 20895, 29898, 3881, 6278, 562, 2764, 4135, 29892, 13600, 718, 29871, 29896, 511, 288, 29897, 363, 288, 297, 1797, 29897, 13, 13, 13, 1753, 13516, 29898, 12181, 29892, 12768, 29892, 14405, 1125, 13, 1678, 822, 5633, 7295, 13, 4706, 363, 474, 29892, 288, 297, 26985, 29898, 3372, 4097, 1125, 13, 9651, 7936, 265, 1338, 353, 5159, 13, 9651, 363, 432, 29892, 282, 297, 26985, 29898, 29877, 1125, 13, 18884, 2380, 353, 432, 448, 7431, 29898, 29877, 29897, 849, 29871, 29906, 13, 18884, 7936, 265, 1338, 29889, 4397, 3552, 29886, 334, 7442, 29889, 2873, 29898, 12181, 29961, 29875, 29962, 448, 6425, 29898, 2248, 8243, 2380, 876, 13, 13, 9651, 4636, 353, 805, 29889, 6051, 810, 10456, 7554, 10456, 6051, 12841, 1338, 876, 13, 9651, 565, 14405, 29901, 13, 18884, 7709, 4636, 13, 9651, 1683, 29901, 13, 18884, 396, 450, 2533, 310, 1438, 12920, 650, 4937, 3234, 900, 6289, 338, 7126, 304, 278, 12920, 650, 4937, 2533, 310, 599, 278, 13516, 29889, 13, 18884, 396, 910, 10110, 508, 367, 10723, 515, 278, 4426, 310, 278, 12920, 650, 4937, 3234, 29889, 13, 18884, 396, 910, 338, 5407, 746, 366, 817, 304, 3394, 1269, 5455, 373, 263, 1422, 9685, 29892, 13, 18884, 396, 763, 297, 278, 1206, 310, 9138, 278, 17089, 10238, 310, 263, 12885, 1746, 773, 278, 16030, 29889, 13, 18884, 7709, 10032, 29898, 1028, 29889, 29895, 1617, 29892, 313, 5344, 565, 413, 1275, 474, 1683, 805, 29889, 22350, 29898, 29881, 29897, 363, 413, 29892, 270, 297, 26985, 29898, 12181, 4961, 13, 13, 1678, 396, 24596, 277, 304, 529, 5813, 29958, 363, 2537, 3864, 714, 393, 413, 12628, 398, 29915, 29879, 2980, 1797, 338, 18764, 287, 29889, 13, 1678, 396, 13932, 393, 2586, 310, 29714, 306, 29915, 29881, 505, 5714, 372, 29889, 13, 1678, 736, 10032, 29898, 2892, 263, 29892, 289, 29901, 805, 29889, 29895, 12628, 398, 29898, 29890, 29892, 263, 511, 5633, 3101, 565, 14405, 1683, 18761, 29898, 20895, 3101, 13, 2 ]
algorithm/deep_learning/neural_network6.py
kake777/python_sample
0
39852
#ミニバッチ学習 import numpy as np from dataset.mnist import load_mnist (x_train, t_train), (x_test, t_test) =\ load_mnist(normalize=True, one_hot_label=True) print(x_train.shape) print(t_train.shape) train_size = x_train.shape[0] batch_size = 10 batch_mask = np.random.choice(train_size, batch_size) x_batch = x_train[batch_mask] t_batch = x_train[batch_mask] print(batch_mask)
[ 1, 396, 30627, 30635, 30517, 30317, 30656, 30415, 234, 194, 149, 13, 5215, 12655, 408, 7442, 13, 3166, 8783, 29889, 23521, 391, 1053, 2254, 29918, 23521, 391, 13, 13, 29898, 29916, 29918, 14968, 29892, 260, 29918, 14968, 511, 313, 29916, 29918, 1688, 29892, 260, 29918, 1688, 29897, 17313, 13, 1678, 2254, 29918, 23521, 391, 29898, 8945, 675, 29922, 5574, 29892, 697, 29918, 8711, 29918, 1643, 29922, 5574, 29897, 13, 13, 2158, 29898, 29916, 29918, 14968, 29889, 12181, 29897, 13, 2158, 29898, 29873, 29918, 14968, 29889, 12181, 29897, 13, 13, 14968, 29918, 2311, 353, 921, 29918, 14968, 29889, 12181, 29961, 29900, 29962, 13, 16175, 29918, 2311, 353, 29871, 29896, 29900, 13, 16175, 29918, 13168, 353, 7442, 29889, 8172, 29889, 16957, 29898, 14968, 29918, 2311, 29892, 9853, 29918, 2311, 29897, 13, 29916, 29918, 16175, 353, 921, 29918, 14968, 29961, 16175, 29918, 13168, 29962, 13, 29873, 29918, 16175, 353, 921, 29918, 14968, 29961, 16175, 29918, 13168, 29962, 13, 13, 2158, 29898, 16175, 29918, 13168, 29897, 13, 2 ]
Aula 07/ex6.py
diegorafaelvieira/Programacao-1
0
22725
<reponame>diegorafaelvieira/Programacao-1 val = int(input("Valor:")) soma = val maior = val menor = val for i in range(0,9): val = int(input("Valor:")) if val>maior: maior = val if val<menor: menor=val soma+=val print("O maior valor é:",maior) print("O menor valor é:",menor) print("A média é:",(soma/10))
[ 1, 529, 276, 1112, 420, 29958, 29881, 5876, 272, 2142, 4271, 25965, 3055, 29914, 9283, 562, 6241, 29899, 29896, 13, 791, 353, 938, 29898, 2080, 703, 1440, 272, 29901, 5783, 13, 29879, 4125, 353, 659, 13, 655, 1611, 353, 659, 13, 1527, 272, 353, 659, 13, 13, 1454, 474, 297, 3464, 29898, 29900, 29892, 29929, 1125, 13, 1678, 659, 353, 938, 29898, 2080, 703, 1440, 272, 29901, 5783, 13, 1678, 565, 659, 29958, 655, 1611, 29901, 13, 4706, 17136, 353, 659, 13, 1678, 565, 659, 29966, 1527, 272, 29901, 13, 4706, 26764, 29922, 791, 13, 1678, 1047, 29874, 23661, 791, 13, 13, 2158, 703, 29949, 17136, 16497, 904, 29901, 613, 655, 1611, 29897, 13, 2158, 703, 29949, 26764, 16497, 904, 29901, 613, 1527, 272, 29897, 13, 2158, 703, 29909, 10283, 423, 904, 29901, 613, 29898, 29879, 4125, 29914, 29896, 29900, 876, 13, 268, 13, 2 ]
bills/models.py
leogregianin/create-automatic-api
8
186604
<reponame>leogregianin/create-automatic-api<filename>bills/models.py from django.db import models class Category(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255) operation = models.IntegerField() class Meta: managed = False db_table = 'category' verbose_name_plural = 'Categories' def __str__(self): return self.name class Bill(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255) date = models.DateTimeField() ident_category = models.ForeignKey('Category', models.DO_NOTHING, db_column='ident_category') price = models.DecimalField(max_digits=7, decimal_places=2) comment = models.TextField(blank=True, null=True) class Meta: managed = False db_table = 'bill' verbose_name_plural = 'Bills' ordering = ('date',) def __str__(self): return self.name
[ 1, 529, 276, 1112, 420, 29958, 280, 468, 1727, 713, 262, 29914, 3258, 29899, 17405, 2454, 29899, 2754, 29966, 9507, 29958, 29890, 6090, 29914, 9794, 29889, 2272, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 13, 13, 1990, 17943, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1178, 353, 4733, 29889, 7798, 3073, 29898, 16072, 29918, 1989, 29922, 5574, 29897, 13, 1678, 1024, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 1678, 5858, 353, 4733, 29889, 7798, 3073, 580, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 8745, 353, 7700, 13, 4706, 4833, 29918, 2371, 353, 525, 7320, 29915, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 525, 29907, 14404, 29915, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 978, 13, 13, 1990, 6682, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1178, 353, 4733, 29889, 7798, 3073, 29898, 16072, 29918, 1989, 29922, 5574, 29897, 13, 1678, 1024, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 1678, 2635, 353, 4733, 29889, 11384, 3073, 580, 13, 1678, 2893, 29918, 7320, 353, 4733, 29889, 27755, 2558, 877, 10900, 742, 4733, 29889, 3970, 29918, 12256, 29950, 4214, 29892, 4833, 29918, 4914, 2433, 1693, 29918, 7320, 1495, 13, 1678, 8666, 353, 4733, 29889, 23307, 3073, 29898, 3317, 29918, 7501, 1169, 29922, 29955, 29892, 13677, 29918, 29886, 6048, 29922, 29906, 29897, 13, 1678, 3440, 353, 4733, 29889, 15778, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 8745, 353, 7700, 13, 4706, 4833, 29918, 2371, 353, 525, 29890, 453, 29915, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 525, 29933, 6090, 29915, 13, 4706, 20520, 353, 6702, 1256, 742, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 978, 13, 13, 2 ]
poem_generator/PoemCallback.py
Aaronsom/poem-generation
0
32677
from tensorflow.keras.callbacks import Callback from poem_generator.word_generator import generate_poem class PoemCallback(Callback): def __init__(self, poems, seed_length, dictionary, single=True): super(PoemCallback, self).__init__() self.poems = poems self.dictionary = dictionary self.reverse_dictionary = {dictionary[key]: key for key in dictionary.keys()} self.seed_length = seed_length self.single = single def on_epoch_end(self, epoch, logs=None): for i in range(self.poems): print(f"Poem {i+1}/{self.poems}") generate_poem(self.model, self.reverse_dictionary, self.dictionary, self.seed_length, single=self.single)
[ 1, 515, 26110, 29889, 3946, 294, 29889, 14035, 29879, 1053, 8251, 1627, 13, 3166, 26576, 29918, 27959, 29889, 1742, 29918, 27959, 1053, 5706, 29918, 1129, 331, 13, 13, 13, 1990, 3929, 331, 10717, 29898, 10717, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 772, 1567, 29892, 16717, 29918, 2848, 29892, 8600, 29892, 2323, 29922, 5574, 1125, 13, 4706, 2428, 29898, 9837, 331, 10717, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 1129, 1567, 353, 772, 1567, 13, 4706, 1583, 29889, 27126, 353, 8600, 13, 4706, 1583, 29889, 24244, 29918, 27126, 353, 426, 27126, 29961, 1989, 5387, 1820, 363, 1820, 297, 8600, 29889, 8149, 28296, 13, 4706, 1583, 29889, 26776, 29918, 2848, 353, 16717, 29918, 2848, 13, 4706, 1583, 29889, 14369, 353, 2323, 13, 13, 1678, 822, 373, 29918, 1022, 2878, 29918, 355, 29898, 1311, 29892, 21502, 305, 29892, 10748, 29922, 8516, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 1129, 1567, 1125, 13, 9651, 1596, 29898, 29888, 29908, 9837, 331, 426, 29875, 29974, 29896, 6822, 29912, 1311, 29889, 1129, 1567, 27195, 13, 9651, 5706, 29918, 1129, 331, 29898, 1311, 29889, 4299, 29892, 1583, 29889, 24244, 29918, 27126, 29892, 1583, 29889, 27126, 29892, 1583, 29889, 26776, 29918, 2848, 29892, 2323, 29922, 1311, 29889, 14369, 29897, 2 ]
Section 7 - Text Classification/Text Classification Part 2 - Pickling and Unpickling dataset.py
kungfumas/bahasa-alami
169
64389
# Text Classifiation using NLP # Importing the libraries import numpy as np import re import pickle import nltk from nltk.corpus import stopwords from sklearn.datasets import load_files nltk.download('stopwords') # Importing the dataset reviews = load_files('txt_sentoken/') X,y = reviews.data,reviews.target # Pickling the dataset with open('X.pickle','wb') as f: pickle.dump(X,f) with open('y.pickle','wb') as f: pickle.dump(y,f) # Unpickling dataset X_in = open('X.pickle','rb') y_in = open('y.pickle','rb') X = pickle.load(X_in) y = pickle.load(y_in)
[ 1, 396, 3992, 4134, 6832, 362, 773, 405, 13208, 13, 13, 29937, 16032, 292, 278, 9562, 13, 5215, 12655, 408, 7442, 13, 5215, 337, 13, 5215, 5839, 280, 29871, 13, 5215, 302, 1896, 29895, 13, 3166, 302, 1896, 29895, 29889, 2616, 13364, 1053, 5040, 9303, 13, 3166, 2071, 19668, 29889, 14538, 1691, 1053, 2254, 29918, 5325, 13, 29876, 1896, 29895, 29889, 10382, 877, 9847, 9303, 1495, 13, 13, 13, 29937, 16032, 292, 278, 8783, 13, 276, 7406, 353, 2254, 29918, 5325, 877, 3945, 29918, 18616, 4476, 29914, 1495, 13, 29990, 29892, 29891, 353, 21804, 29889, 1272, 29892, 276, 7406, 29889, 5182, 13, 13, 13, 29937, 23868, 1847, 278, 8783, 13, 2541, 1722, 877, 29990, 29889, 23945, 280, 3788, 29893, 29890, 1495, 408, 285, 29901, 13, 1678, 5839, 280, 29889, 15070, 29898, 29990, 29892, 29888, 29897, 13, 268, 13, 2541, 1722, 877, 29891, 29889, 23945, 280, 3788, 29893, 29890, 1495, 408, 285, 29901, 13, 1678, 5839, 280, 29889, 15070, 29898, 29891, 29892, 29888, 29897, 13, 13, 29937, 853, 23945, 1847, 8783, 13, 29990, 29918, 262, 353, 1722, 877, 29990, 29889, 23945, 280, 3788, 6050, 1495, 13, 29891, 29918, 262, 353, 1722, 877, 29891, 29889, 23945, 280, 3788, 6050, 1495, 13, 29990, 353, 5839, 280, 29889, 1359, 29898, 29990, 29918, 262, 29897, 13, 29891, 353, 5839, 280, 29889, 1359, 29898, 29891, 29918, 262, 29897, 2 ]
fupan.py
huobingli/fpyd
0
134896
<filename>fupan.py<gh_stars>0 import requests import json from fpdata import * from Middleware import * # 热门研报 # type 1 最新 # type 2 近一周 # type 3 新财富分析师 page_num = 50 # 第一个tab页面 热门研报 # 近24小时 hot_new_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=%d&type=1" # 近一周 hot_later_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=10&type=2" # 新财富分析师 hot_new_reseach_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=10&type=3" # 第二个页面 看涨预期 more_money_url = "https://www.fupanyoudao.com/v1/api/report/stock_expect?page_num=1&page_size=%d" # 第三个tab页面 最新 # 最新数据 new_reseach_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=%d&type=0" # 第四个tab页面 全部 # 个股研报 stock_reseach_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=%d&type=4" # 行业 industry_reseach_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=%d&type=6" # 策略 strategy_reseach_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=%d&type=5" # 宏观 macro_reseach_url = "https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=%d&type=7" # detail_base_url + source ID detail_base_url = "https://www.fupanyoudao.com/v1/api/report/report_detail?source_id=%s" # page_url = "https://www.fupanyoudao.com/v1/api/report?page_num=%d&page_size=10&type=1" def GetDataFromUrl(_url): headers = { 'Accept-Encoding': 'gzip, deflate, br', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat', 'Host': 'www.fupanyoudao.com' } ret = requests.get(headers=headers, url=_url) return ret def GetResNum(): page_url = hot_new_url % page_num print(page_url) ret = GetDataFromUrl(page_url) print(ret.content) geturl = json.loads(ret.content) total = geturl["total"] print(total) def GetPageContent(): # headers = { # 'Accept-Encoding': 'gzip, deflate, br', # 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat', # 'Referer': 'https://servicewechat.com/wxe04e1890bc944202/33/page-frame.html', # 'Host': 'www.fupanyoudao.com' # } page_url = hot_new_url % (1, 411) print(page_url) ret = GetDataFromUrl(page_url) json_root = json.loads(ret.content) fplist=[] for json_data in json_root["data"]: # print(json_data["id"] + " " + json_data["title"] + " " + json_data["source_id"]) data = fpdata(json_data) insert_data("fpyd_hot", data.toArray()) # fplist.append(data) # insert_data("fpyd_stock", aa.toArray()) def GetStockResearch(): # https://www.fupanyoudao.com/v1/api/report?page_num=1&page_size=10&type=4 page_url = stock_reseach_url % (1, 599) print(page_url) ret = GetDataFromUrl(page_url) json_root = json.loads(ret.content) for json_data in json_root["data"]: # print(json_data["id"] + " " + json_data["title"] + " " + json_data["source_id"]) data = fpdata(json_data) insert_data("fpyd_stock", data.toArray()) def GetStrategyResearch(): page_url = strategy_reseach_url % (1, 621) print(page_url) ret = GetDataFromUrl(page_url) json_root = json.loads(ret.content) for json_data in json_root["data"]: # print(json_data["id"] + " " + json_data["title"] + " " + json_data["source_id"]) data = fpdata(json_data) insert_data("fpyd_strategy", data.toArray()) def GetIndustryResearch(): page_url = industry_reseach_url % (1, 1449) print(page_url) ret = GetDataFromUrl(page_url) json_root = json.loads(ret.content) for json_data in json_root["data"]: # print(json_data["id"] + " " + json_data["title"] + " " + json_data["source_id"]) data = fpdata(json_data) insert_data("fpyd_industry", data.toArray()) if __name__ == '__main__': # 获取页数 # total = GetResNum() GetIndustryResearch()
[ 1, 529, 9507, 29958, 29888, 786, 273, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 7274, 13, 5215, 4390, 13, 13, 3166, 285, 29886, 1272, 1053, 334, 13, 3166, 14253, 2519, 1053, 334, 13, 29937, 29871, 234, 134, 176, 31649, 31367, 233, 141, 168, 13, 29937, 1134, 29871, 29896, 29871, 30878, 30374, 13, 29937, 1134, 29871, 29906, 29871, 31830, 30287, 31109, 13, 29937, 1134, 29871, 29941, 29871, 30374, 235, 183, 165, 31730, 30748, 233, 161, 147, 232, 187, 139, 13, 13, 3488, 29918, 1949, 353, 29871, 29945, 29900, 13, 13, 13, 29937, 29871, 30622, 30287, 30502, 3891, 31610, 30806, 29871, 234, 134, 176, 31649, 31367, 233, 141, 168, 13, 29937, 29871, 31830, 29906, 29946, 30446, 30594, 13, 8711, 29918, 1482, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 16328, 29881, 29987, 1853, 29922, 29896, 29908, 13, 29937, 29871, 31830, 30287, 31109, 13, 8711, 29918, 29880, 1008, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 29922, 29896, 29900, 29987, 1853, 29922, 29906, 29908, 13, 29937, 29871, 30374, 235, 183, 165, 31730, 30748, 233, 161, 147, 232, 187, 139, 13, 8711, 29918, 1482, 29918, 690, 4204, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 29922, 29896, 29900, 29987, 1853, 29922, 29941, 29908, 13, 13, 29937, 29871, 30622, 30685, 30502, 31610, 30806, 29871, 31811, 233, 185, 171, 236, 165, 135, 31117, 13, 5514, 29918, 29885, 4992, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29914, 17712, 29918, 17854, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 16328, 29881, 29908, 13, 13, 29937, 29871, 30622, 30457, 30502, 3891, 31610, 30806, 29871, 30878, 30374, 13, 29937, 29871, 30878, 30374, 30354, 30763, 13, 1482, 29918, 690, 4204, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 16328, 29881, 29987, 1853, 29922, 29900, 29908, 13, 13, 29937, 29871, 30622, 30928, 30502, 3891, 31610, 30806, 29871, 30753, 30636, 13, 29937, 29871, 30502, 235, 133, 164, 31367, 233, 141, 168, 13, 17712, 29918, 690, 4204, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 16328, 29881, 29987, 1853, 29922, 29946, 29908, 13, 13, 29937, 29871, 30448, 31729, 13, 20041, 719, 29918, 690, 4204, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 16328, 29881, 29987, 1853, 29922, 29953, 29908, 13, 13, 29937, 29871, 234, 176, 153, 234, 152, 168, 13, 710, 8963, 29918, 690, 4204, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 16328, 29881, 29987, 1853, 29922, 29945, 29908, 13, 13, 29937, 29871, 232, 177, 146, 235, 170, 133, 13, 25254, 29918, 690, 4204, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 16328, 29881, 29987, 1853, 29922, 29955, 29908, 13, 13, 29937, 9493, 29918, 3188, 29918, 2271, 718, 2752, 3553, 13, 16432, 29918, 3188, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29914, 12276, 29918, 16432, 29973, 4993, 29918, 333, 16328, 29879, 29908, 13, 13, 13, 13, 29937, 1813, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 16328, 29881, 29987, 3488, 29918, 2311, 29922, 29896, 29900, 29987, 1853, 29922, 29896, 29908, 13, 13, 13, 13, 1753, 3617, 1469, 4591, 5983, 7373, 2271, 1125, 13, 1678, 9066, 353, 426, 29871, 13, 4706, 525, 23965, 29899, 14934, 2396, 525, 29887, 7554, 29892, 822, 9632, 29892, 1506, 742, 13, 4706, 525, 2659, 29899, 19661, 2396, 525, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 7685, 405, 29911, 29871, 29953, 29889, 29896, 29936, 399, 9806, 29953, 29946, 29897, 12113, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10228, 29914, 29945, 29941, 29889, 29900, 29889, 29906, 29955, 29947, 29945, 29889, 29896, 29946, 29941, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 20140, 29924, 9957, 914, 29914, 29955, 29889, 29900, 29889, 29929, 29889, 29945, 29900, 29896, 12670, 1542, 29914, 22119, 3738, 341, 2172, 9283, 21745, 29914, 7685, 3852, 4806, 13496, 742, 13, 4706, 525, 8514, 2396, 525, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29915, 13, 1678, 500, 13, 1678, 3240, 353, 7274, 29889, 657, 29898, 13662, 29922, 13662, 29892, 3142, 29922, 29918, 2271, 29897, 13, 1678, 736, 3240, 13, 13, 1753, 3617, 1666, 8009, 7295, 13, 1678, 1813, 29918, 2271, 353, 7375, 29918, 1482, 29918, 2271, 1273, 1813, 29918, 1949, 13, 1678, 1596, 29898, 3488, 29918, 2271, 29897, 13, 1678, 3240, 353, 3617, 1469, 4591, 5983, 29898, 3488, 29918, 2271, 29897, 13, 268, 13, 1678, 1596, 29898, 2267, 29889, 3051, 29897, 13, 13, 1678, 679, 2271, 353, 4390, 29889, 18132, 29898, 2267, 29889, 3051, 29897, 13, 1678, 3001, 353, 679, 2271, 3366, 7827, 3108, 13, 1678, 1596, 29898, 7827, 29897, 13, 13, 1753, 3617, 5074, 3916, 7295, 13, 1678, 396, 9066, 353, 426, 29871, 13, 1678, 396, 268, 525, 23965, 29899, 14934, 2396, 525, 29887, 7554, 29892, 822, 9632, 29892, 1506, 742, 13, 1678, 396, 268, 525, 2659, 29899, 19661, 2396, 525, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 7685, 405, 29911, 29871, 29953, 29889, 29896, 29936, 399, 9806, 29953, 29946, 29897, 12113, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10228, 29914, 29945, 29941, 29889, 29900, 29889, 29906, 29955, 29947, 29945, 29889, 29896, 29946, 29941, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 20140, 29924, 9957, 914, 29914, 29955, 29889, 29900, 29889, 29929, 29889, 29945, 29900, 29896, 12670, 1542, 29914, 22119, 3738, 341, 2172, 9283, 21745, 29914, 7685, 3852, 4806, 13496, 742, 13, 1678, 396, 268, 525, 1123, 571, 261, 2396, 525, 991, 597, 5509, 705, 13496, 29889, 510, 29914, 29893, 17115, 29900, 29946, 29872, 29896, 29947, 29929, 29900, 12328, 29929, 29946, 29946, 29906, 29900, 29906, 29914, 29941, 29941, 29914, 3488, 29899, 2557, 29889, 1420, 742, 13, 1678, 396, 268, 525, 8514, 2396, 525, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29915, 13, 1678, 396, 500, 13, 1678, 1813, 29918, 2271, 353, 7375, 29918, 1482, 29918, 2271, 1273, 313, 29896, 29892, 29871, 29946, 29896, 29896, 29897, 13, 1678, 1596, 29898, 3488, 29918, 2271, 29897, 13, 1678, 3240, 353, 3617, 1469, 4591, 5983, 29898, 3488, 29918, 2271, 29897, 259, 13, 13, 1678, 4390, 29918, 4632, 353, 4390, 29889, 18132, 29898, 2267, 29889, 3051, 29897, 13, 1678, 285, 572, 391, 29922, 2636, 13, 1678, 363, 4390, 29918, 1272, 297, 4390, 29918, 4632, 3366, 1272, 3108, 29901, 13, 4706, 396, 1596, 29898, 3126, 29918, 1272, 3366, 333, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 3257, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 4993, 29918, 333, 20068, 13, 4706, 848, 353, 285, 29886, 1272, 29898, 3126, 29918, 1272, 29897, 13, 4706, 4635, 29918, 1272, 703, 29888, 2272, 29881, 29918, 8711, 613, 848, 29889, 517, 2588, 3101, 13, 4706, 396, 285, 572, 391, 29889, 4397, 29898, 1272, 29897, 13, 268, 13, 13, 1678, 396, 4635, 29918, 1272, 703, 29888, 2272, 29881, 29918, 17712, 613, 29099, 29889, 517, 2588, 3101, 13, 13, 1753, 3617, 20754, 384, 1666, 2842, 7295, 13, 1678, 396, 2045, 597, 1636, 29889, 29888, 786, 1384, 283, 1388, 29877, 29889, 510, 29914, 29894, 29896, 29914, 2754, 29914, 12276, 29973, 3488, 29918, 1949, 29922, 29896, 29987, 3488, 29918, 2311, 29922, 29896, 29900, 29987, 1853, 29922, 29946, 13, 1678, 1813, 29918, 2271, 353, 10961, 29918, 690, 4204, 29918, 2271, 1273, 313, 29896, 29892, 29871, 29945, 29929, 29929, 29897, 13, 1678, 1596, 29898, 3488, 29918, 2271, 29897, 13, 1678, 3240, 353, 3617, 1469, 4591, 5983, 29898, 3488, 29918, 2271, 29897, 259, 13, 13, 1678, 4390, 29918, 4632, 353, 4390, 29889, 18132, 29898, 2267, 29889, 3051, 29897, 13, 1678, 363, 4390, 29918, 1272, 297, 4390, 29918, 4632, 3366, 1272, 3108, 29901, 13, 4706, 396, 1596, 29898, 3126, 29918, 1272, 3366, 333, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 3257, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 4993, 29918, 333, 20068, 13, 4706, 848, 353, 285, 29886, 1272, 29898, 3126, 29918, 1272, 29897, 13, 4706, 4635, 29918, 1272, 703, 29888, 2272, 29881, 29918, 17712, 613, 848, 29889, 517, 2588, 3101, 13, 13, 1753, 3617, 26910, 1666, 2842, 7295, 13, 1678, 1813, 29918, 2271, 353, 13705, 29918, 690, 4204, 29918, 2271, 1273, 313, 29896, 29892, 29871, 29953, 29906, 29896, 29897, 13, 1678, 1596, 29898, 3488, 29918, 2271, 29897, 13, 1678, 3240, 353, 3617, 1469, 4591, 5983, 29898, 3488, 29918, 2271, 29897, 259, 13, 13, 1678, 4390, 29918, 4632, 353, 4390, 29889, 18132, 29898, 2267, 29889, 3051, 29897, 13, 1678, 363, 4390, 29918, 1272, 297, 4390, 29918, 4632, 3366, 1272, 3108, 29901, 13, 4706, 396, 1596, 29898, 3126, 29918, 1272, 3366, 333, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 3257, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 4993, 29918, 333, 20068, 13, 4706, 848, 353, 285, 29886, 1272, 29898, 3126, 29918, 1272, 29897, 13, 4706, 4635, 29918, 1272, 703, 29888, 2272, 29881, 29918, 710, 8963, 613, 848, 29889, 517, 2588, 3101, 13, 13, 1753, 3617, 2568, 504, 719, 1666, 2842, 7295, 13, 1678, 1813, 29918, 2271, 353, 13661, 29918, 690, 4204, 29918, 2271, 1273, 313, 29896, 29892, 29871, 29896, 29946, 29946, 29929, 29897, 13, 1678, 1596, 29898, 3488, 29918, 2271, 29897, 13, 1678, 3240, 353, 3617, 1469, 4591, 5983, 29898, 3488, 29918, 2271, 29897, 259, 13, 13, 1678, 4390, 29918, 4632, 353, 4390, 29889, 18132, 29898, 2267, 29889, 3051, 29897, 13, 1678, 363, 4390, 29918, 1272, 297, 4390, 29918, 4632, 3366, 1272, 3108, 29901, 13, 4706, 396, 1596, 29898, 3126, 29918, 1272, 3366, 333, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 3257, 3108, 718, 376, 29871, 376, 718, 4390, 29918, 1272, 3366, 4993, 29918, 333, 20068, 13, 4706, 848, 353, 285, 29886, 1272, 29898, 3126, 29918, 1272, 29897, 13, 4706, 4635, 29918, 1272, 703, 29888, 2272, 29881, 29918, 20041, 719, 613, 848, 29889, 517, 2588, 3101, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 29871, 31024, 30683, 31610, 30354, 13, 1678, 396, 3001, 353, 3617, 1666, 8009, 580, 13, 13, 1678, 3617, 2568, 504, 719, 1666, 2842, 580, 13, 13, 2 ]
instance.py
frayel/camundacmd
1
192262
import argparse import json import sys import traceback from camundatools.definition import Definition from camundatools.instance import Instance from camundatools.task import Task class InstanceCommand: args: argparse.Namespace instance: Instance definition: Definition task: Task def __init__(self, args: argparse.Namespace): self.args = args self.instance = Instance(silent=True, config_file=args.config_file) self.definition = Definition(silent=True, config_file=args.config_file) self.task = Task(silent=True, config_file=args.config_file) def _do_start(self, process_key, business_key, variables, json_vars_file): try: if json_vars_file: with open(json_vars_file, "r") as file: variables = json.load(file) result = self.instance.start_process(process_key, business_key, variables) print(f'Process instance started with id {result["id"]} and definition {result["definitionId"]}') except Exception as e: print(str(e)) sys.exit(1) def _do_list(self, key_definition): try: print(f"{'ProcessInstanceId':<40} {'ProcessDefinitionKey':<30} {'Version':<8} {'BusinessKey':<12}") print(f"{'-'*40:<40} {'-'*30:<30} {'-'*8:<8} {'-'*10:<12}") instances = self.instance.list(key_definition) for i in instances: d = self.definition.inspect(i['definitionId']) print(f"{i['id']:<40} {d['key']:<30} {d['version']:<8} {i['businessKey'] or i['caseInstanceId'] or '':<12}") except Exception as e: print(str(e)) sys.exit(1) def _do_inspect(self, process_instance_id): try: result = self.instance.inspect(process_instance_id) print(json.dumps(result, indent=4, sort_keys=True, default=str)) except Exception as e: print(str(e)) sys.exit(1) def _do_find(self, process_key, business_key): try: result = self.instance.find(process_key, business_key) if result: print(json.dumps(result, indent=4, sort_keys=True, default=str)) else: print('Process definition not found!') except Exception as e: print(str(e)) sys.exit(1) def _do_delete(self, process_instance_id, reason): try: result = self.instance.delete(process_instance_id, reason) print(f'Instance deleted!') except Exception as e: print(str(e)) sys.exit(1) def _do_download(self, process_instance_id, file_name): try: result = self.instance.inspect(process_instance_id) xml = self.instance.get_xml(result["definitionId"]) filename = f"{xml['id']}.bpmn".replace(":", "_") if not file_name else file_name with open(filename, 'w') as file: file.write(xml['bpmn20Xml']) file.close() print(f'{filename} saved.') except Exception as e: print(str(e)) sys.exit(1) def _do_migrate(self, key_definition, business_key, source_activity, target_activity): try: for instance in self.instance.list(key_definition, business_key): instance = self.instance.inspect(instance['id']) definition = self.definition.inspect(instance['definitionId']) last_definition = self.definition.inspect(key=definition['key']) if last_definition['id'] != instance['definitionId']: print(f"Process {last_definition['id']} differs from {instance['definitionId']}") instructions = list() for atividade in self.task.list(process_instance_id=instance['id']): instruction = dict() instruction["sourceActivityIds"] = [source_activity] if source_activity else [atividade["taskDefinitionKey"]] instruction["targetActivityIds"] = [target_activity] if target_activity else [atividade["taskDefinitionKey"]] instructions.append(instruction) # if instructions and len(instructions) > 0: print(f"Migrating {definition['key']} {instance['id']}: {definition['versionTag']} ({definition['version']}) -> {last_definition['versionTag']} ({last_definition['version']})") result = self.instance.migrate([instance['id']], instance['definitionId'], last_definition['id'], instructions) for k in instructions: print(f'Task migrated from {k["sourceActivityIds"]} to {k["targetActivityIds"]}') # else: # print(f"There are no tasks to migrate in {definition['key']} {intance['id']}") print('Finished migrations.') except Exception as e: traceback.print_exc() sys.exit(1) def run(self, parser): if self.args.command == 'start': variables = self.args.variables if 'variables' in self.args else None json_vars_file = self.args.json_vars_file if 'json_vars_file' in self.args else None self._do_start(self.args.key_definition, self.args.business_key, variables, json_vars_file) elif self.args.command == 'list': key_definition = self.args.key_definition if 'key_definition' in self.args else None self._do_list(key_definition) elif self.args.command == 'inspect': self._do_inspect(self.args.id) elif self.args.command == 'find': self._do_find(self.args.key_definition, self.args.business_key) elif self.args.command == 'delete': self._do_delete(self.args.id, self.args.reason) elif self.args.command == 'download': file_name = self.args.file_name if 'file_name' in self.args else False self._do_download(self.args.id, file_name) elif self.args.command == 'migrate': key_definition = self.args.key_definition if 'key_definition' in self.args else None business_key = self.args.business_key if 'business_key' in self.args else None source_activity = self.args.source_activity if 'source_activity' in self.args else None target_activity = self.args.target_activity if 'target_activity' in self.args else None self._do_migrate(key_definition, business_key, source_activity, target_activity) else: parser.print_help() def main(): description = '''Manage process instances on a Camunda server''' parser = argparse.ArgumentParser(description=description, argument_default=argparse.SUPPRESS) subparsers = parser.add_subparsers(help='Commands', dest='command') parser.add_argument('--cfg', help='config file', nargs='?', default='camundatools.cfg', dest='config_file') # Start start_parser = subparsers.add_parser('start', help='Start a process instance') start_parser.add_argument('key_definition', help='process key definition') start_parser.add_argument('business_key', help='business key') start_parser.add_argument('-v', help='process variables', nargs='?', dest='variables') start_parser.add_argument('-j', help='json vars file name', nargs='?', dest='json_vars_file') # List list_parser = subparsers.add_parser('list', help='List process instances') list_parser.add_argument('-k', help='process key definition', nargs='?', dest='key_definition') # Inspect inspect_parser = subparsers.add_parser('inspect', help='Inspect a process instance') inspect_parser.add_argument('id', help='process instance id') # Find find_parser = subparsers.add_parser('find', help='Find a process instance by business key') find_parser.add_argument('key_definition', help='process key definition') find_parser.add_argument('business_key', help='business key') # Delete cancel_parser = subparsers.add_parser('delete', help='Delete a process instance') cancel_parser.add_argument('id', help='process instance id') cancel_parser.add_argument('reason', help='delete reason') # Migrate migrate_parser = subparsers.add_parser('migrate', help='Migrate a process instance to a newer definition') migrate_parser.add_argument('-k', help='process key definition', nargs='?', dest='key_definition') migrate_parser.add_argument('-b', help='business key', nargs='?', dest='business_key') migrate_parser.add_argument('-s', '--source', help='source activity', nargs='?', dest='source_activity') migrate_parser.add_argument('-t', '--target', help='target activity', nargs='?', dest='target_activity') # Download download_parser = subparsers.add_parser('download', help='Download a XML of the process instance') download_parser.add_argument('id', help='process instance id') download_parser.add_argument('-f', help='output name', nargs='?', dest='file_name') deployment = InstanceCommand(parser.parse_args()) deployment.run(parser) if __name__ == "__main__": main()
[ 1, 1053, 1852, 5510, 13, 5215, 4390, 13, 5215, 10876, 13, 5215, 9637, 1627, 13, 13, 3166, 3949, 870, 1219, 3775, 29889, 16553, 1053, 21940, 13, 3166, 3949, 870, 1219, 3775, 29889, 8758, 1053, 2799, 749, 13, 3166, 3949, 870, 1219, 3775, 29889, 7662, 1053, 9330, 13, 13, 13, 1990, 2799, 749, 6255, 29901, 13, 13, 1678, 6389, 29901, 1852, 5510, 29889, 23335, 13, 1678, 2777, 29901, 2799, 749, 13, 1678, 5023, 29901, 21940, 13, 1678, 3414, 29901, 9330, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6389, 29901, 1852, 5510, 29889, 23335, 1125, 13, 4706, 1583, 29889, 5085, 353, 6389, 13, 4706, 1583, 29889, 8758, 353, 2799, 749, 29898, 25590, 296, 29922, 5574, 29892, 2295, 29918, 1445, 29922, 5085, 29889, 2917, 29918, 1445, 29897, 13, 4706, 1583, 29889, 16553, 353, 21940, 29898, 25590, 296, 29922, 5574, 29892, 2295, 29918, 1445, 29922, 5085, 29889, 2917, 29918, 1445, 29897, 13, 4706, 1583, 29889, 7662, 353, 9330, 29898, 25590, 296, 29922, 5574, 29892, 2295, 29918, 1445, 29922, 5085, 29889, 2917, 29918, 1445, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 2962, 29898, 1311, 29892, 1889, 29918, 1989, 29892, 5381, 29918, 1989, 29892, 3651, 29892, 4390, 29918, 16908, 29918, 1445, 1125, 13, 4706, 1018, 29901, 13, 9651, 565, 4390, 29918, 16908, 29918, 1445, 29901, 13, 18884, 411, 1722, 29898, 3126, 29918, 16908, 29918, 1445, 29892, 376, 29878, 1159, 408, 934, 29901, 13, 462, 1678, 3651, 353, 4390, 29889, 1359, 29898, 1445, 29897, 13, 9651, 1121, 353, 1583, 29889, 8758, 29889, 2962, 29918, 5014, 29898, 5014, 29918, 1989, 29892, 5381, 29918, 1989, 29892, 3651, 29897, 13, 9651, 1596, 29898, 29888, 29915, 7032, 2777, 4687, 411, 1178, 426, 2914, 3366, 333, 3108, 29913, 322, 5023, 426, 2914, 3366, 16553, 1204, 3108, 29913, 1495, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 29898, 710, 29898, 29872, 876, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 1761, 29898, 1311, 29892, 1820, 29918, 16553, 1125, 13, 4706, 1018, 29901, 13, 9651, 1596, 29898, 29888, 29908, 10998, 7032, 4998, 1204, 2396, 29966, 29946, 29900, 29913, 11117, 7032, 14683, 2558, 2396, 29966, 29941, 29900, 29913, 11117, 6594, 2396, 29966, 29947, 29913, 11117, 16890, 3335, 2558, 2396, 29966, 29896, 29906, 27195, 13, 9651, 1596, 29898, 29888, 29908, 10998, 29899, 29915, 29930, 29946, 29900, 29901, 29966, 29946, 29900, 29913, 11117, 29899, 29915, 29930, 29941, 29900, 29901, 29966, 29941, 29900, 29913, 11117, 29899, 29915, 29930, 29947, 29901, 29966, 29947, 29913, 11117, 29899, 29915, 29930, 29896, 29900, 29901, 29966, 29896, 29906, 27195, 13, 9651, 8871, 353, 1583, 29889, 8758, 29889, 1761, 29898, 1989, 29918, 16553, 29897, 13, 9651, 363, 474, 297, 8871, 29901, 13, 18884, 270, 353, 1583, 29889, 16553, 29889, 1144, 1103, 29898, 29875, 1839, 16553, 1204, 11287, 13, 18884, 1596, 29898, 29888, 29908, 29912, 29875, 1839, 333, 2033, 29901, 29966, 29946, 29900, 29913, 426, 29881, 1839, 1989, 2033, 29901, 29966, 29941, 29900, 29913, 426, 29881, 1839, 3259, 2033, 29901, 29966, 29947, 29913, 426, 29875, 1839, 8262, 3335, 2558, 2033, 470, 474, 1839, 4878, 4998, 1204, 2033, 470, 525, 2396, 29966, 29896, 29906, 27195, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 29898, 710, 29898, 29872, 876, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 1144, 1103, 29898, 1311, 29892, 1889, 29918, 8758, 29918, 333, 1125, 13, 4706, 1018, 29901, 13, 9651, 1121, 353, 1583, 29889, 8758, 29889, 1144, 1103, 29898, 5014, 29918, 8758, 29918, 333, 29897, 13, 9651, 1596, 29898, 3126, 29889, 29881, 17204, 29898, 2914, 29892, 29536, 29922, 29946, 29892, 2656, 29918, 8149, 29922, 5574, 29892, 2322, 29922, 710, 876, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 29898, 710, 29898, 29872, 876, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 2886, 29898, 1311, 29892, 1889, 29918, 1989, 29892, 5381, 29918, 1989, 1125, 13, 4706, 1018, 29901, 13, 9651, 1121, 353, 1583, 29889, 8758, 29889, 2886, 29898, 5014, 29918, 1989, 29892, 5381, 29918, 1989, 29897, 13, 9651, 565, 1121, 29901, 13, 18884, 1596, 29898, 3126, 29889, 29881, 17204, 29898, 2914, 29892, 29536, 29922, 29946, 29892, 2656, 29918, 8149, 29922, 5574, 29892, 2322, 29922, 710, 876, 13, 9651, 1683, 29901, 13, 18884, 1596, 877, 7032, 5023, 451, 1476, 29991, 1495, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 29898, 710, 29898, 29872, 876, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 8143, 29898, 1311, 29892, 1889, 29918, 8758, 29918, 333, 29892, 2769, 1125, 13, 4706, 1018, 29901, 13, 9651, 1121, 353, 1583, 29889, 8758, 29889, 8143, 29898, 5014, 29918, 8758, 29918, 333, 29892, 2769, 29897, 13, 9651, 1596, 29898, 29888, 29915, 4998, 11132, 29991, 1495, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 29898, 710, 29898, 29872, 876, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 10382, 29898, 1311, 29892, 1889, 29918, 8758, 29918, 333, 29892, 934, 29918, 978, 1125, 13, 4706, 1018, 29901, 13, 9651, 1121, 353, 1583, 29889, 8758, 29889, 1144, 1103, 29898, 5014, 29918, 8758, 29918, 333, 29897, 13, 9651, 4903, 353, 1583, 29889, 8758, 29889, 657, 29918, 3134, 29898, 2914, 3366, 16553, 1204, 20068, 13, 9651, 10422, 353, 285, 29908, 29912, 3134, 1839, 333, 2033, 1836, 29890, 3358, 29876, 1642, 6506, 703, 29901, 613, 11119, 1159, 565, 451, 934, 29918, 978, 1683, 934, 29918, 978, 13, 9651, 411, 1722, 29898, 9507, 29892, 525, 29893, 1495, 408, 934, 29901, 13, 18884, 934, 29889, 3539, 29898, 3134, 1839, 29890, 3358, 29876, 29906, 29900, 11089, 11287, 13, 9651, 934, 29889, 5358, 580, 13, 9651, 1596, 29898, 29888, 29915, 29912, 9507, 29913, 7160, 29889, 1495, 13, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 29898, 710, 29898, 29872, 876, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 26983, 403, 29898, 1311, 29892, 1820, 29918, 16553, 29892, 5381, 29918, 1989, 29892, 2752, 29918, 10072, 29892, 3646, 29918, 10072, 1125, 13, 4706, 1018, 29901, 13, 9651, 363, 2777, 297, 1583, 29889, 8758, 29889, 1761, 29898, 1989, 29918, 16553, 29892, 5381, 29918, 1989, 1125, 13, 18884, 2777, 353, 1583, 29889, 8758, 29889, 1144, 1103, 29898, 8758, 1839, 333, 11287, 13, 18884, 5023, 353, 1583, 29889, 16553, 29889, 1144, 1103, 29898, 8758, 1839, 16553, 1204, 11287, 13, 18884, 1833, 29918, 16553, 353, 1583, 29889, 16553, 29889, 1144, 1103, 29898, 1989, 29922, 16553, 1839, 1989, 11287, 13, 18884, 565, 1833, 29918, 16553, 1839, 333, 2033, 2804, 2777, 1839, 16553, 1204, 2033, 29901, 13, 462, 1678, 1596, 29898, 29888, 29908, 7032, 426, 4230, 29918, 16553, 1839, 333, 2033, 29913, 2923, 414, 515, 426, 8758, 1839, 16553, 1204, 2033, 27195, 13, 462, 1678, 11994, 353, 1051, 580, 13, 462, 1678, 363, 472, 440, 5558, 297, 1583, 29889, 7662, 29889, 1761, 29898, 5014, 29918, 8758, 29918, 333, 29922, 8758, 1839, 333, 2033, 1125, 13, 462, 4706, 15278, 353, 9657, 580, 13, 462, 4706, 15278, 3366, 4993, 3886, 21943, 3108, 353, 518, 4993, 29918, 10072, 29962, 565, 2752, 29918, 10072, 1683, 518, 1926, 5558, 3366, 7662, 14683, 2558, 3108, 29962, 13, 462, 4706, 15278, 3366, 5182, 3886, 21943, 3108, 353, 518, 5182, 29918, 10072, 29962, 565, 3646, 29918, 10072, 1683, 518, 1926, 5558, 3366, 7662, 14683, 2558, 3108, 29962, 13, 462, 4706, 11994, 29889, 4397, 29898, 2611, 4080, 29897, 13, 462, 4706, 396, 565, 11994, 322, 7431, 29898, 2611, 582, 1953, 29897, 1405, 29871, 29900, 29901, 13, 462, 4706, 1596, 29898, 29888, 29908, 29924, 4481, 1218, 426, 16553, 1839, 1989, 2033, 29913, 426, 8758, 1839, 333, 2033, 6177, 426, 16553, 1839, 3259, 8176, 2033, 29913, 21313, 16553, 1839, 3259, 2033, 1800, 1599, 426, 4230, 29918, 16553, 1839, 3259, 8176, 2033, 29913, 21313, 4230, 29918, 16553, 1839, 3259, 2033, 1800, 1159, 13, 462, 4706, 1121, 353, 1583, 29889, 8758, 29889, 26983, 403, 4197, 8758, 1839, 333, 2033, 1402, 2777, 1839, 16553, 1204, 7464, 1833, 29918, 16553, 1839, 333, 7464, 11994, 29897, 13, 462, 4706, 363, 413, 297, 11994, 29901, 13, 462, 9651, 1596, 29898, 29888, 29915, 5398, 9725, 630, 515, 426, 29895, 3366, 4993, 3886, 21943, 3108, 29913, 304, 426, 29895, 3366, 5182, 3886, 21943, 3108, 29913, 1495, 13, 462, 4706, 396, 1683, 29901, 13, 462, 4706, 396, 268, 1596, 29898, 29888, 29908, 8439, 526, 694, 9595, 304, 9725, 403, 297, 426, 16553, 1839, 1989, 2033, 29913, 426, 524, 749, 1839, 333, 2033, 27195, 13, 13, 9651, 1596, 877, 12881, 3276, 9725, 800, 29889, 1495, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 9637, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 822, 1065, 29898, 1311, 29892, 13812, 1125, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 6519, 1275, 525, 2962, 2396, 13, 9651, 3651, 353, 1583, 29889, 5085, 29889, 20897, 565, 525, 20897, 29915, 297, 1583, 29889, 5085, 1683, 6213, 13, 9651, 4390, 29918, 16908, 29918, 1445, 353, 1583, 29889, 5085, 29889, 3126, 29918, 16908, 29918, 1445, 565, 525, 3126, 29918, 16908, 29918, 1445, 29915, 297, 1583, 29889, 5085, 1683, 6213, 13, 9651, 1583, 3032, 1867, 29918, 2962, 29898, 1311, 29889, 5085, 29889, 1989, 29918, 16553, 29892, 1583, 29889, 5085, 29889, 8262, 3335, 29918, 1989, 29892, 3651, 29892, 4390, 29918, 16908, 29918, 1445, 29897, 13, 4706, 25342, 1583, 29889, 5085, 29889, 6519, 1275, 525, 1761, 2396, 13, 9651, 1820, 29918, 16553, 353, 1583, 29889, 5085, 29889, 1989, 29918, 16553, 565, 525, 1989, 29918, 16553, 29915, 297, 1583, 29889, 5085, 1683, 6213, 13, 9651, 1583, 3032, 1867, 29918, 1761, 29898, 1989, 29918, 16553, 29897, 13, 4706, 25342, 1583, 29889, 5085, 29889, 6519, 1275, 525, 1144, 1103, 2396, 13, 9651, 1583, 3032, 1867, 29918, 1144, 1103, 29898, 1311, 29889, 5085, 29889, 333, 29897, 13, 4706, 25342, 1583, 29889, 5085, 29889, 6519, 1275, 525, 2886, 2396, 13, 9651, 1583, 3032, 1867, 29918, 2886, 29898, 1311, 29889, 5085, 29889, 1989, 29918, 16553, 29892, 1583, 29889, 5085, 29889, 8262, 3335, 29918, 1989, 29897, 13, 4706, 25342, 1583, 29889, 5085, 29889, 6519, 1275, 525, 8143, 2396, 13, 9651, 1583, 3032, 1867, 29918, 8143, 29898, 1311, 29889, 5085, 29889, 333, 29892, 1583, 29889, 5085, 29889, 23147, 29897, 13, 4706, 25342, 1583, 29889, 5085, 29889, 6519, 1275, 525, 10382, 2396, 13, 9651, 934, 29918, 978, 353, 1583, 29889, 5085, 29889, 1445, 29918, 978, 565, 525, 1445, 29918, 978, 29915, 297, 1583, 29889, 5085, 1683, 7700, 13, 9651, 1583, 3032, 1867, 29918, 10382, 29898, 1311, 29889, 5085, 29889, 333, 29892, 934, 29918, 978, 29897, 13, 4706, 25342, 1583, 29889, 5085, 29889, 6519, 1275, 525, 26983, 403, 2396, 13, 9651, 1820, 29918, 16553, 353, 1583, 29889, 5085, 29889, 1989, 29918, 16553, 565, 525, 1989, 29918, 16553, 29915, 297, 1583, 29889, 5085, 1683, 6213, 13, 9651, 5381, 29918, 1989, 353, 1583, 29889, 5085, 29889, 8262, 3335, 29918, 1989, 565, 525, 8262, 3335, 29918, 1989, 29915, 297, 1583, 29889, 5085, 1683, 6213, 13, 9651, 2752, 29918, 10072, 353, 1583, 29889, 5085, 29889, 4993, 29918, 10072, 565, 525, 4993, 29918, 10072, 29915, 297, 1583, 29889, 5085, 1683, 6213, 13, 9651, 3646, 29918, 10072, 353, 1583, 29889, 5085, 29889, 5182, 29918, 10072, 565, 525, 5182, 29918, 10072, 29915, 297, 1583, 29889, 5085, 1683, 6213, 13, 9651, 1583, 3032, 1867, 29918, 26983, 403, 29898, 1989, 29918, 16553, 29892, 5381, 29918, 1989, 29892, 2752, 29918, 10072, 29892, 3646, 29918, 10072, 29897, 13, 4706, 1683, 29901, 13, 9651, 13812, 29889, 2158, 29918, 8477, 580, 13, 13, 13, 1753, 1667, 7295, 13, 13, 1678, 6139, 353, 14550, 2517, 482, 1889, 8871, 373, 263, 5500, 8917, 1923, 12008, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 29922, 8216, 29892, 2980, 29918, 4381, 29922, 1191, 5510, 29889, 29903, 4897, 15094, 1799, 29897, 13, 1678, 1014, 862, 4253, 353, 13812, 29889, 1202, 29918, 1491, 862, 4253, 29898, 8477, 2433, 5261, 4167, 742, 2731, 2433, 6519, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16859, 742, 1371, 2433, 2917, 934, 742, 302, 5085, 2433, 29973, 742, 2322, 2433, 11108, 870, 1219, 3775, 29889, 16859, 742, 2731, 2433, 2917, 29918, 1445, 1495, 13, 13, 1678, 396, 7370, 13, 1678, 1369, 29918, 16680, 353, 1014, 862, 4253, 29889, 1202, 29918, 16680, 877, 2962, 742, 1371, 2433, 4763, 263, 1889, 2777, 1495, 13, 1678, 1369, 29918, 16680, 29889, 1202, 29918, 23516, 877, 1989, 29918, 16553, 742, 1371, 2433, 5014, 1820, 5023, 1495, 13, 1678, 1369, 29918, 16680, 29889, 1202, 29918, 23516, 877, 8262, 3335, 29918, 1989, 742, 1371, 2433, 8262, 3335, 1820, 1495, 13, 1678, 1369, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29894, 742, 1371, 2433, 5014, 3651, 742, 29871, 302, 5085, 2433, 29973, 742, 2731, 2433, 20897, 1495, 13, 1678, 1369, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29926, 742, 1371, 2433, 3126, 24987, 934, 1024, 742, 302, 5085, 2433, 29973, 742, 2731, 2433, 3126, 29918, 16908, 29918, 1445, 1495, 13, 13, 1678, 396, 2391, 13, 1678, 1051, 29918, 16680, 353, 1014, 862, 4253, 29889, 1202, 29918, 16680, 877, 1761, 742, 1371, 2433, 1293, 1889, 8871, 1495, 13, 1678, 1051, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29895, 742, 1371, 2433, 5014, 1820, 5023, 742, 302, 5085, 2433, 29973, 742, 2731, 2433, 1989, 29918, 16553, 1495, 13, 13, 1678, 396, 13377, 1103, 13, 1678, 16096, 29918, 16680, 353, 1014, 862, 4253, 29889, 1202, 29918, 16680, 877, 1144, 1103, 742, 1371, 2433, 797, 21494, 263, 1889, 2777, 1495, 13, 1678, 16096, 29918, 16680, 29889, 1202, 29918, 23516, 877, 333, 742, 1371, 2433, 5014, 2777, 1178, 1495, 13, 13, 1678, 396, 10987, 13, 1678, 1284, 29918, 16680, 353, 1014, 862, 4253, 29889, 1202, 29918, 16680, 877, 2886, 742, 1371, 2433, 12542, 263, 1889, 2777, 491, 5381, 1820, 1495, 13, 1678, 1284, 29918, 16680, 29889, 1202, 29918, 23516, 877, 1989, 29918, 16553, 742, 1371, 2433, 5014, 1820, 5023, 1495, 13, 1678, 1284, 29918, 16680, 29889, 1202, 29918, 23516, 877, 8262, 3335, 29918, 1989, 742, 1371, 2433, 8262, 3335, 1820, 1495, 13, 13, 1678, 396, 21267, 13, 1678, 12611, 29918, 16680, 353, 1014, 862, 4253, 29889, 1202, 29918, 16680, 877, 8143, 742, 1371, 2433, 12498, 263, 1889, 2777, 1495, 13, 1678, 12611, 29918, 16680, 29889, 1202, 29918, 23516, 877, 333, 742, 1371, 2433, 5014, 2777, 1178, 1495, 13, 1678, 12611, 29918, 16680, 29889, 1202, 29918, 23516, 877, 23147, 742, 1371, 2433, 8143, 2769, 1495, 13, 13, 1678, 396, 341, 4481, 403, 13, 1678, 9725, 403, 29918, 16680, 353, 1014, 862, 4253, 29889, 1202, 29918, 16680, 877, 26983, 403, 742, 1371, 2433, 29924, 4481, 403, 263, 1889, 2777, 304, 263, 20687, 5023, 1495, 13, 1678, 9725, 403, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29895, 742, 1371, 2433, 5014, 1820, 5023, 742, 302, 5085, 2433, 29973, 742, 2731, 2433, 1989, 29918, 16553, 1495, 13, 1678, 9725, 403, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29890, 742, 1371, 2433, 8262, 3335, 1820, 742, 302, 5085, 2433, 29973, 742, 2731, 2433, 8262, 3335, 29918, 1989, 1495, 13, 1678, 9725, 403, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29879, 742, 525, 489, 4993, 742, 1371, 2433, 4993, 6354, 742, 302, 5085, 2433, 29973, 742, 2731, 2433, 4993, 29918, 10072, 1495, 13, 1678, 9725, 403, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29873, 742, 525, 489, 5182, 742, 1371, 2433, 5182, 6354, 742, 302, 5085, 2433, 29973, 742, 2731, 2433, 5182, 29918, 10072, 1495, 13, 13, 1678, 396, 25553, 13, 1678, 5142, 29918, 16680, 353, 1014, 862, 4253, 29889, 1202, 29918, 16680, 877, 10382, 742, 1371, 2433, 22954, 263, 6560, 310, 278, 1889, 2777, 1495, 13, 1678, 5142, 29918, 16680, 29889, 1202, 29918, 23516, 877, 333, 742, 1371, 2433, 5014, 2777, 1178, 1495, 13, 1678, 5142, 29918, 16680, 29889, 1202, 29918, 23516, 877, 29899, 29888, 742, 1371, 2433, 4905, 1024, 742, 302, 5085, 2433, 29973, 742, 2731, 2433, 1445, 29918, 978, 1495, 13, 13, 1678, 18209, 353, 2799, 749, 6255, 29898, 16680, 29889, 5510, 29918, 5085, 3101, 13, 1678, 18209, 29889, 3389, 29898, 16680, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 2 ]
homeassistant/components/sonarr/sensor.py
tbarbette/core
6
64593
"""Support for Sonarr sensors.""" from datetime import timedelta import logging from typing import Any, Callable, Dict, List, Optional from sonarr import Sonarr, SonarrConnectionError, SonarrError from homeassistant.config_entries import ConfigEntry from homeassistant.const import DATA_GIGABYTES from homeassistant.helpers.entity import Entity from homeassistant.helpers.typing import HomeAssistantType import homeassistant.util.dt as dt_util from . import SonarrEntity from .const import CONF_UPCOMING_DAYS, CONF_WANTED_MAX_ITEMS, DATA_SONARR, DOMAIN _LOGGER = logging.getLogger(__name__) async def async_setup_entry( hass: HomeAssistantType, entry: ConfigEntry, async_add_entities: Callable[[List[Entity], bool], None], ) -> None: """Set up Sonarr sensors based on a config entry.""" options = entry.options sonarr = hass.data[DOMAIN][entry.entry_id][DATA_SONARR] entities = [ SonarrCommandsSensor(sonarr, entry.entry_id), SonarrDiskspaceSensor(sonarr, entry.entry_id), SonarrQueueSensor(sonarr, entry.entry_id), SonarrSeriesSensor(sonarr, entry.entry_id), SonarrUpcomingSensor(sonarr, entry.entry_id, days=options[CONF_UPCOMING_DAYS]), SonarrWantedSensor( sonarr, entry.entry_id, max_items=options[CONF_WANTED_MAX_ITEMS] ), ] async_add_entities(entities, True) def sonarr_exception_handler(func): """Decorate Sonarr calls to handle Sonarr exceptions. A decorator that wraps the passed in function, catches Sonarr errors, and handles the availability of the entity. """ async def handler(self, *args, **kwargs): try: await func(self, *args, **kwargs) self.last_update_success = True except SonarrConnectionError as error: if self.available: _LOGGER.error("Error communicating with API: %s", error) self.last_update_success = False except SonarrError as error: if self.available: _LOGGER.error("Invalid response from API: %s", error) self.last_update_success = False return handler class SonarrSensor(SonarrEntity): """Implementation of the Sonarr sensor.""" def __init__( self, *, sonarr: Sonarr, entry_id: str, enabled_default: bool = True, icon: str, key: str, name: str, unit_of_measurement: Optional[str] = None, ) -> None: """Initialize Sonarr sensor.""" self._unit_of_measurement = unit_of_measurement self._key = key self._unique_id = f"{entry_id}_{key}" self.last_update_success = False super().__init__( sonarr=sonarr, entry_id=entry_id, device_id=entry_id, name=name, icon=icon, enabled_default=enabled_default, ) @property def unique_id(self) -> str: """Return the unique ID for this sensor.""" return self._unique_id @property def available(self) -> bool: """Return sensor availability.""" return self.last_update_success @property def unit_of_measurement(self) -> str: """Return the unit this state is expressed in.""" return self._unit_of_measurement class SonarrCommandsSensor(SonarrSensor): """Defines a Sonarr Commands sensor.""" def __init__(self, sonarr: Sonarr, entry_id: str) -> None: """Initialize Sonarr Commands sensor.""" self._commands = [] super().__init__( sonarr=sonarr, entry_id=entry_id, icon="mdi:code-braces", key="commands", name=f"{sonarr.app.info.app_name} Commands", unit_of_measurement="Commands", enabled_default=False, ) @sonarr_exception_handler async def async_update(self) -> None: """Update entity.""" self._commands = await self.sonarr.commands() @property def device_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the entity.""" attrs = {} for command in self._commands: attrs[command.name] = command.state return attrs @property def state(self) -> int: """Return the state of the sensor.""" return len(self._commands) class SonarrDiskspaceSensor(SonarrSensor): """Defines a Sonarr Disk Space sensor.""" def __init__(self, sonarr: Sonarr, entry_id: str) -> None: """Initialize Sonarr Disk Space sensor.""" self._disks = [] self._total_free = 0 super().__init__( sonarr=sonarr, entry_id=entry_id, icon="mdi:harddisk", key="diskspace", name=f"{sonarr.app.info.app_name} Disk Space", unit_of_measurement=DATA_GIGABYTES, enabled_default=False, ) @sonarr_exception_handler async def async_update(self) -> None: """Update entity.""" app = await self.sonarr.update() self._disks = app.disks self._total_free = sum([disk.free for disk in self._disks]) @property def device_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the entity.""" attrs = {} for disk in self._disks: free = disk.free / 1024 ** 3 total = disk.total / 1024 ** 3 usage = free / total * 100 attrs[ disk.path ] = f"{free:.2f}/{total:.2f}{self._unit_of_measurement} ({usage:.2f}%)" return attrs @property def state(self) -> str: """Return the state of the sensor.""" free = self._total_free / 1024 ** 3 return f"{free:.2f}" class SonarrQueueSensor(SonarrSensor): """Defines a Sonarr Queue sensor.""" def __init__(self, sonarr: Sonarr, entry_id: str) -> None: """Initialize Sonarr Queue sensor.""" self._queue = [] super().__init__( sonarr=sonarr, entry_id=entry_id, icon="mdi:download", key="queue", name=f"{sonarr.app.info.app_name} Queue", unit_of_measurement="Episodes", enabled_default=False, ) @sonarr_exception_handler async def async_update(self) -> None: """Update entity.""" self._queue = await self.sonarr.queue() @property def device_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the entity.""" attrs = {} for item in self._queue: remaining = 1 if item.size == 0 else item.size_remaining / item.size remaining_pct = 100 * (1 - remaining) name = f"{item.episode.series.title} {item.episode.identifier}" attrs[name] = f"{remaining_pct:.2f}%" return attrs @property def state(self) -> int: """Return the state of the sensor.""" return len(self._queue) class SonarrSeriesSensor(SonarrSensor): """Defines a Sonarr Series sensor.""" def __init__(self, sonarr: Sonarr, entry_id: str) -> None: """Initialize Sonarr Series sensor.""" self._items = [] super().__init__( sonarr=sonarr, entry_id=entry_id, icon="mdi:television", key="series", name=f"{sonarr.app.info.app_name} Shows", unit_of_measurement="Series", enabled_default=False, ) @sonarr_exception_handler async def async_update(self) -> None: """Update entity.""" self._items = await self.sonarr.series() @property def device_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the entity.""" attrs = {} for item in self._items: attrs[item.series.title] = f"{item.downloaded}/{item.episodes} Episodes" return attrs @property def state(self) -> int: """Return the state of the sensor.""" return len(self._items) class SonarrUpcomingSensor(SonarrSensor): """Defines a Sonarr Upcoming sensor.""" def __init__(self, sonarr: Sonarr, entry_id: str, days: int = 1) -> None: """Initialize Sonarr Upcoming sensor.""" self._days = days self._upcoming = [] super().__init__( sonarr=sonarr, entry_id=entry_id, icon="mdi:television", key="upcoming", name=f"{sonarr.app.info.app_name} Upcoming", unit_of_measurement="Episodes", ) @sonarr_exception_handler async def async_update(self) -> None: """Update entity.""" local = dt_util.start_of_local_day().replace(microsecond=0) start = dt_util.as_utc(local) end = start + timedelta(days=self._days) self._upcoming = await self.sonarr.calendar( start=start.isoformat(), end=end.isoformat() ) @property def device_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the entity.""" attrs = {} for episode in self._upcoming: attrs[episode.series.title] = episode.identifier return attrs @property def state(self) -> int: """Return the state of the sensor.""" return len(self._upcoming) class SonarrWantedSensor(SonarrSensor): """Defines a Sonarr Wanted sensor.""" def __init__(self, sonarr: Sonarr, entry_id: str, max_items: int = 10) -> None: """Initialize Sonarr Wanted sensor.""" self._max_items = max_items self._results = None self._total: Optional[int] = None super().__init__( sonarr=sonarr, entry_id=entry_id, icon="mdi:television", key="wanted", name=f"{sonarr.app.info.app_name} Wanted", unit_of_measurement="Episodes", enabled_default=False, ) @sonarr_exception_handler async def async_update(self) -> None: """Update entity.""" self._results = await self.sonarr.wanted(page_size=self._max_items) self._total = self._results.total @property def device_state_attributes(self) -> Optional[Dict[str, Any]]: """Return the state attributes of the entity.""" attrs = {} if self._results is not None: for episode in self._results.episodes: name = f"{episode.series.title} {episode.identifier}" attrs[name] = episode.airdate return attrs @property def state(self) -> Optional[int]: """Return the state of the sensor.""" return self._total
[ 1, 9995, 14039, 363, 5791, 2749, 4771, 943, 1213, 15945, 13, 3166, 12865, 1053, 5335, 287, 2554, 13, 5215, 12183, 13, 3166, 19229, 1053, 3139, 29892, 8251, 519, 29892, 360, 919, 29892, 2391, 29892, 28379, 13, 13, 3166, 1487, 2749, 1053, 5791, 2749, 29892, 5791, 2749, 5350, 2392, 29892, 5791, 2749, 2392, 13, 13, 3166, 3271, 465, 22137, 29889, 2917, 29918, 26586, 1053, 12782, 9634, 13, 3166, 3271, 465, 22137, 29889, 3075, 1053, 360, 8254, 29918, 29954, 6259, 2882, 29979, 29911, 2890, 13, 3166, 3271, 465, 22137, 29889, 3952, 6774, 29889, 10041, 1053, 14945, 13, 3166, 3271, 465, 22137, 29889, 3952, 6774, 29889, 1017, 15702, 1053, 8778, 7900, 22137, 1542, 13, 5215, 3271, 465, 22137, 29889, 4422, 29889, 6008, 408, 11636, 29918, 4422, 13, 13, 3166, 869, 1053, 5791, 2749, 6691, 13, 3166, 869, 3075, 1053, 8707, 29943, 29918, 4897, 19795, 4214, 29918, 7698, 21554, 29892, 8707, 29943, 29918, 29956, 13566, 3352, 29918, 12648, 29918, 9094, 4345, 29892, 360, 8254, 29918, 3094, 1718, 29934, 29892, 11662, 29032, 13, 13, 29918, 14480, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 12674, 822, 7465, 29918, 14669, 29918, 8269, 29898, 13, 1678, 298, 465, 29901, 8778, 7900, 22137, 1542, 29892, 13, 1678, 6251, 29901, 12782, 9634, 29892, 13, 1678, 7465, 29918, 1202, 29918, 296, 1907, 29901, 8251, 519, 8999, 1293, 29961, 6691, 1402, 6120, 1402, 6213, 1402, 13, 29897, 1599, 6213, 29901, 13, 1678, 9995, 2697, 701, 5791, 2749, 4771, 943, 2729, 373, 263, 2295, 6251, 1213, 15945, 13, 1678, 3987, 353, 6251, 29889, 6768, 13, 1678, 1487, 2749, 353, 298, 465, 29889, 1272, 29961, 3970, 29032, 3816, 8269, 29889, 8269, 29918, 333, 3816, 14573, 29918, 3094, 1718, 29934, 29962, 13, 13, 1678, 16212, 353, 518, 13, 4706, 5791, 2749, 5261, 4167, 29903, 6073, 29898, 1100, 2749, 29892, 6251, 29889, 8269, 29918, 333, 511, 13, 4706, 5791, 2749, 29928, 3873, 3493, 29903, 6073, 29898, 1100, 2749, 29892, 6251, 29889, 8269, 29918, 333, 511, 13, 4706, 5791, 2749, 10620, 29903, 6073, 29898, 1100, 2749, 29892, 6251, 29889, 8269, 29918, 333, 511, 13, 4706, 5791, 2749, 19204, 29903, 6073, 29898, 1100, 2749, 29892, 6251, 29889, 8269, 29918, 333, 511, 13, 4706, 5791, 2749, 3373, 11506, 29903, 6073, 29898, 1100, 2749, 29892, 6251, 29889, 8269, 29918, 333, 29892, 3841, 29922, 6768, 29961, 6007, 29943, 29918, 4897, 19795, 4214, 29918, 7698, 21554, 11724, 13, 4706, 5791, 2749, 29956, 9714, 29903, 6073, 29898, 13, 9651, 1487, 2749, 29892, 6251, 29889, 8269, 29918, 333, 29892, 4236, 29918, 7076, 29922, 6768, 29961, 6007, 29943, 29918, 29956, 13566, 3352, 29918, 12648, 29918, 9094, 4345, 29962, 13, 4706, 10353, 13, 1678, 4514, 13, 13, 1678, 7465, 29918, 1202, 29918, 296, 1907, 29898, 296, 1907, 29892, 5852, 29897, 13, 13, 13, 1753, 1487, 2749, 29918, 11739, 29918, 13789, 29898, 9891, 1125, 13, 1678, 9995, 6185, 272, 403, 5791, 2749, 5717, 304, 4386, 5791, 2749, 15283, 29889, 13, 13, 1678, 319, 10200, 1061, 393, 11463, 567, 278, 4502, 297, 740, 29892, 4380, 267, 5791, 2749, 4436, 29892, 13, 1678, 322, 17766, 278, 20847, 3097, 310, 278, 7855, 29889, 13, 1678, 9995, 13, 13, 1678, 7465, 822, 7834, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1018, 29901, 13, 9651, 7272, 3653, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 9651, 1583, 29889, 4230, 29918, 5504, 29918, 8698, 353, 5852, 13, 4706, 5174, 5791, 2749, 5350, 2392, 408, 1059, 29901, 13, 9651, 565, 1583, 29889, 16515, 29901, 13, 18884, 903, 14480, 17070, 29889, 2704, 703, 2392, 7212, 1218, 411, 3450, 29901, 1273, 29879, 613, 1059, 29897, 13, 9651, 1583, 29889, 4230, 29918, 5504, 29918, 8698, 353, 7700, 13, 4706, 5174, 5791, 2749, 2392, 408, 1059, 29901, 13, 9651, 565, 1583, 29889, 16515, 29901, 13, 18884, 903, 14480, 17070, 29889, 2704, 703, 13919, 2933, 515, 3450, 29901, 1273, 29879, 613, 1059, 29897, 13, 18884, 1583, 29889, 4230, 29918, 5504, 29918, 8698, 353, 7700, 13, 13, 1678, 736, 7834, 13, 13, 13, 1990, 5791, 2749, 29903, 6073, 29898, 29903, 265, 2749, 6691, 1125, 13, 1678, 9995, 1888, 14607, 310, 278, 5791, 2749, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 334, 29892, 13, 4706, 1487, 2749, 29901, 5791, 2749, 29892, 13, 4706, 6251, 29918, 333, 29901, 851, 29892, 13, 4706, 9615, 29918, 4381, 29901, 6120, 353, 5852, 29892, 13, 4706, 9849, 29901, 851, 29892, 13, 4706, 1820, 29901, 851, 29892, 13, 4706, 1024, 29901, 851, 29892, 13, 4706, 5190, 29918, 974, 29918, 26658, 358, 29901, 28379, 29961, 710, 29962, 353, 6213, 29892, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 5791, 2749, 23530, 1213, 15945, 13, 4706, 1583, 3032, 5441, 29918, 974, 29918, 26658, 358, 353, 5190, 29918, 974, 29918, 26658, 358, 13, 4706, 1583, 3032, 1989, 353, 1820, 13, 4706, 1583, 3032, 13092, 29918, 333, 353, 285, 29908, 29912, 8269, 29918, 333, 3227, 1989, 5038, 13, 4706, 1583, 29889, 4230, 29918, 5504, 29918, 8698, 353, 7700, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1487, 2749, 29922, 1100, 2749, 29892, 13, 9651, 6251, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 4742, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 1024, 29922, 978, 29892, 13, 9651, 9849, 29922, 4144, 29892, 13, 9651, 9615, 29918, 4381, 29922, 17590, 29918, 4381, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5412, 29918, 333, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 9995, 11609, 278, 5412, 3553, 363, 445, 23530, 1213, 15945, 13, 4706, 736, 1583, 3032, 13092, 29918, 333, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3625, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 11609, 23530, 20847, 3097, 1213, 15945, 13, 4706, 736, 1583, 29889, 4230, 29918, 5504, 29918, 8698, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5190, 29918, 974, 29918, 26658, 358, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 9995, 11609, 278, 5190, 445, 2106, 338, 13384, 297, 1213, 15945, 13, 4706, 736, 1583, 3032, 5441, 29918, 974, 29918, 26658, 358, 13, 13, 13, 1990, 5791, 2749, 5261, 4167, 29903, 6073, 29898, 29903, 265, 2749, 29903, 6073, 1125, 13, 1678, 9995, 3206, 1475, 263, 5791, 2749, 1876, 4167, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1487, 2749, 29901, 5791, 2749, 29892, 6251, 29918, 333, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 5791, 2749, 1876, 4167, 23530, 1213, 15945, 13, 4706, 1583, 3032, 26381, 353, 5159, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1487, 2749, 29922, 1100, 2749, 29892, 13, 9651, 6251, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 9849, 543, 3487, 29875, 29901, 401, 29899, 2634, 778, 613, 13, 9651, 1820, 543, 26381, 613, 13, 9651, 1024, 29922, 29888, 29908, 29912, 1100, 2749, 29889, 932, 29889, 3888, 29889, 932, 29918, 978, 29913, 1876, 4167, 613, 13, 9651, 5190, 29918, 974, 29918, 26658, 358, 543, 5261, 4167, 613, 13, 9651, 9615, 29918, 4381, 29922, 8824, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 1100, 2749, 29918, 11739, 29918, 13789, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6422, 7855, 1213, 15945, 13, 4706, 1583, 3032, 26381, 353, 7272, 1583, 29889, 1100, 2749, 29889, 26381, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3859, 29918, 15697, 29898, 1311, 29897, 1599, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 29901, 13, 4706, 9995, 11609, 278, 2106, 8393, 310, 278, 7855, 1213, 15945, 13, 4706, 12421, 29879, 353, 6571, 13, 13, 4706, 363, 1899, 297, 1583, 3032, 26381, 29901, 13, 9651, 12421, 29879, 29961, 6519, 29889, 978, 29962, 353, 1899, 29889, 3859, 13, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2106, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 9995, 11609, 278, 2106, 310, 278, 23530, 1213, 15945, 13, 4706, 736, 7431, 29898, 1311, 3032, 26381, 29897, 13, 13, 13, 1990, 5791, 2749, 29928, 3873, 3493, 29903, 6073, 29898, 29903, 265, 2749, 29903, 6073, 1125, 13, 1678, 9995, 3206, 1475, 263, 5791, 2749, 20579, 14121, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1487, 2749, 29901, 5791, 2749, 29892, 6251, 29918, 333, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 5791, 2749, 20579, 14121, 23530, 1213, 15945, 13, 4706, 1583, 3032, 2218, 2039, 353, 5159, 13, 4706, 1583, 3032, 7827, 29918, 9021, 353, 29871, 29900, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1487, 2749, 29922, 1100, 2749, 29892, 13, 9651, 6251, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 9849, 543, 3487, 29875, 29901, 6800, 20960, 613, 13, 9651, 1820, 543, 20960, 3493, 613, 13, 9651, 1024, 29922, 29888, 29908, 29912, 1100, 2749, 29889, 932, 29889, 3888, 29889, 932, 29918, 978, 29913, 20579, 14121, 613, 13, 9651, 5190, 29918, 974, 29918, 26658, 358, 29922, 14573, 29918, 29954, 6259, 2882, 29979, 29911, 2890, 29892, 13, 9651, 9615, 29918, 4381, 29922, 8824, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 1100, 2749, 29918, 11739, 29918, 13789, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6422, 7855, 1213, 15945, 13, 4706, 623, 353, 7272, 1583, 29889, 1100, 2749, 29889, 5504, 580, 13, 4706, 1583, 3032, 2218, 2039, 353, 623, 29889, 2218, 2039, 13, 4706, 1583, 3032, 7827, 29918, 9021, 353, 2533, 4197, 20960, 29889, 9021, 363, 8086, 297, 1583, 3032, 2218, 2039, 2314, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3859, 29918, 15697, 29898, 1311, 29897, 1599, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 29901, 13, 4706, 9995, 11609, 278, 2106, 8393, 310, 278, 7855, 1213, 15945, 13, 4706, 12421, 29879, 353, 6571, 13, 13, 4706, 363, 8086, 297, 1583, 3032, 2218, 2039, 29901, 13, 9651, 3889, 353, 8086, 29889, 9021, 847, 29871, 29896, 29900, 29906, 29946, 3579, 29871, 29941, 13, 9651, 3001, 353, 8086, 29889, 7827, 847, 29871, 29896, 29900, 29906, 29946, 3579, 29871, 29941, 13, 9651, 8744, 353, 3889, 847, 3001, 334, 29871, 29896, 29900, 29900, 13, 13, 9651, 12421, 29879, 29961, 13, 18884, 8086, 29889, 2084, 13, 9651, 4514, 353, 285, 29908, 29912, 9021, 29901, 29889, 29906, 29888, 6822, 29912, 7827, 29901, 29889, 29906, 29888, 1157, 1311, 3032, 5441, 29918, 974, 29918, 26658, 358, 29913, 21313, 21125, 29901, 29889, 29906, 29888, 10560, 5513, 13, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2106, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 9995, 11609, 278, 2106, 310, 278, 23530, 1213, 15945, 13, 4706, 3889, 353, 1583, 3032, 7827, 29918, 9021, 847, 29871, 29896, 29900, 29906, 29946, 3579, 29871, 29941, 13, 4706, 736, 285, 29908, 29912, 9021, 29901, 29889, 29906, 29888, 5038, 13, 13, 13, 1990, 5791, 2749, 10620, 29903, 6073, 29898, 29903, 265, 2749, 29903, 6073, 1125, 13, 1678, 9995, 3206, 1475, 263, 5791, 2749, 5462, 434, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1487, 2749, 29901, 5791, 2749, 29892, 6251, 29918, 333, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 5791, 2749, 5462, 434, 23530, 1213, 15945, 13, 4706, 1583, 3032, 9990, 353, 5159, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1487, 2749, 29922, 1100, 2749, 29892, 13, 9651, 6251, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 9849, 543, 3487, 29875, 29901, 10382, 613, 13, 9651, 1820, 543, 9990, 613, 13, 9651, 1024, 29922, 29888, 29908, 29912, 1100, 2749, 29889, 932, 29889, 3888, 29889, 932, 29918, 978, 29913, 5462, 434, 613, 13, 9651, 5190, 29918, 974, 29918, 26658, 358, 543, 29923, 3334, 2631, 613, 13, 9651, 9615, 29918, 4381, 29922, 8824, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 1100, 2749, 29918, 11739, 29918, 13789, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6422, 7855, 1213, 15945, 13, 4706, 1583, 3032, 9990, 353, 7272, 1583, 29889, 1100, 2749, 29889, 9990, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3859, 29918, 15697, 29898, 1311, 29897, 1599, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 29901, 13, 4706, 9995, 11609, 278, 2106, 8393, 310, 278, 7855, 1213, 15945, 13, 4706, 12421, 29879, 353, 6571, 13, 13, 4706, 363, 2944, 297, 1583, 3032, 9990, 29901, 13, 9651, 9886, 353, 29871, 29896, 565, 2944, 29889, 2311, 1275, 29871, 29900, 1683, 2944, 29889, 2311, 29918, 1745, 17225, 847, 2944, 29889, 2311, 13, 9651, 9886, 29918, 29886, 312, 353, 29871, 29896, 29900, 29900, 334, 313, 29896, 448, 9886, 29897, 13, 9651, 1024, 353, 285, 29908, 29912, 667, 29889, 1022, 275, 356, 29889, 13757, 29889, 3257, 29913, 426, 667, 29889, 1022, 275, 356, 29889, 25378, 5038, 13, 9651, 12421, 29879, 29961, 978, 29962, 353, 285, 29908, 29912, 1745, 17225, 29918, 29886, 312, 29901, 29889, 29906, 29888, 10560, 29908, 13, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2106, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 9995, 11609, 278, 2106, 310, 278, 23530, 1213, 15945, 13, 4706, 736, 7431, 29898, 1311, 3032, 9990, 29897, 13, 13, 13, 1990, 5791, 2749, 19204, 29903, 6073, 29898, 29903, 265, 2749, 29903, 6073, 1125, 13, 1678, 9995, 3206, 1475, 263, 5791, 2749, 10488, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1487, 2749, 29901, 5791, 2749, 29892, 6251, 29918, 333, 29901, 851, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 5791, 2749, 10488, 23530, 1213, 15945, 13, 4706, 1583, 3032, 7076, 353, 5159, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1487, 2749, 29922, 1100, 2749, 29892, 13, 9651, 6251, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 9849, 543, 3487, 29875, 29901, 15494, 4924, 613, 13, 9651, 1820, 543, 13757, 613, 13, 9651, 1024, 29922, 29888, 29908, 29912, 1100, 2749, 29889, 932, 29889, 3888, 29889, 932, 29918, 978, 29913, 1383, 1242, 613, 13, 9651, 5190, 29918, 974, 29918, 26658, 358, 543, 19204, 613, 13, 9651, 9615, 29918, 4381, 29922, 8824, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 1100, 2749, 29918, 11739, 29918, 13789, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6422, 7855, 1213, 15945, 13, 4706, 1583, 3032, 7076, 353, 7272, 1583, 29889, 1100, 2749, 29889, 13757, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3859, 29918, 15697, 29898, 1311, 29897, 1599, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 29901, 13, 4706, 9995, 11609, 278, 2106, 8393, 310, 278, 7855, 1213, 15945, 13, 4706, 12421, 29879, 353, 6571, 13, 13, 4706, 363, 2944, 297, 1583, 3032, 7076, 29901, 13, 9651, 12421, 29879, 29961, 667, 29889, 13757, 29889, 3257, 29962, 353, 285, 29908, 29912, 667, 29889, 10382, 287, 6822, 29912, 667, 29889, 1022, 275, 2631, 29913, 20981, 2631, 29908, 13, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2106, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 9995, 11609, 278, 2106, 310, 278, 23530, 1213, 15945, 13, 4706, 736, 7431, 29898, 1311, 3032, 7076, 29897, 13, 13, 13, 1990, 5791, 2749, 3373, 11506, 29903, 6073, 29898, 29903, 265, 2749, 29903, 6073, 1125, 13, 1678, 9995, 3206, 1475, 263, 5791, 2749, 5020, 11506, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1487, 2749, 29901, 5791, 2749, 29892, 6251, 29918, 333, 29901, 851, 29892, 3841, 29901, 938, 353, 29871, 29896, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 5791, 2749, 5020, 11506, 23530, 1213, 15945, 13, 4706, 1583, 3032, 16700, 353, 3841, 13, 4706, 1583, 3032, 786, 11506, 353, 5159, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1487, 2749, 29922, 1100, 2749, 29892, 13, 9651, 6251, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 9849, 543, 3487, 29875, 29901, 15494, 4924, 613, 13, 9651, 1820, 543, 786, 11506, 613, 13, 9651, 1024, 29922, 29888, 29908, 29912, 1100, 2749, 29889, 932, 29889, 3888, 29889, 932, 29918, 978, 29913, 5020, 11506, 613, 13, 9651, 5190, 29918, 974, 29918, 26658, 358, 543, 29923, 3334, 2631, 613, 13, 4706, 1723, 13, 13, 1678, 732, 1100, 2749, 29918, 11739, 29918, 13789, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6422, 7855, 1213, 15945, 13, 4706, 1887, 353, 11636, 29918, 4422, 29889, 2962, 29918, 974, 29918, 2997, 29918, 3250, 2141, 6506, 29898, 29885, 2357, 7496, 29922, 29900, 29897, 13, 4706, 1369, 353, 11636, 29918, 4422, 29889, 294, 29918, 329, 29883, 29898, 2997, 29897, 13, 4706, 1095, 353, 1369, 718, 5335, 287, 2554, 29898, 16700, 29922, 1311, 3032, 16700, 29897, 13, 4706, 1583, 3032, 786, 11506, 353, 7272, 1583, 29889, 1100, 2749, 29889, 23392, 29898, 13, 9651, 1369, 29922, 2962, 29889, 10718, 4830, 3285, 1095, 29922, 355, 29889, 10718, 4830, 580, 13, 4706, 1723, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3859, 29918, 15697, 29898, 1311, 29897, 1599, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 29901, 13, 4706, 9995, 11609, 278, 2106, 8393, 310, 278, 7855, 1213, 15945, 13, 4706, 12421, 29879, 353, 6571, 13, 13, 4706, 363, 12720, 297, 1583, 3032, 786, 11506, 29901, 13, 9651, 12421, 29879, 29961, 1022, 275, 356, 29889, 13757, 29889, 3257, 29962, 353, 12720, 29889, 25378, 13, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2106, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 9995, 11609, 278, 2106, 310, 278, 23530, 1213, 15945, 13, 4706, 736, 7431, 29898, 1311, 3032, 786, 11506, 29897, 13, 13, 13, 1990, 5791, 2749, 29956, 9714, 29903, 6073, 29898, 29903, 265, 2749, 29903, 6073, 1125, 13, 1678, 9995, 3206, 1475, 263, 5791, 2749, 399, 9714, 23530, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1487, 2749, 29901, 5791, 2749, 29892, 6251, 29918, 333, 29901, 851, 29892, 4236, 29918, 7076, 29901, 938, 353, 29871, 29896, 29900, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6644, 6646, 5791, 2749, 399, 9714, 23530, 1213, 15945, 13, 4706, 1583, 3032, 3317, 29918, 7076, 353, 4236, 29918, 7076, 13, 4706, 1583, 3032, 9902, 353, 6213, 13, 4706, 1583, 3032, 7827, 29901, 28379, 29961, 524, 29962, 353, 6213, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1487, 2749, 29922, 1100, 2749, 29892, 13, 9651, 6251, 29918, 333, 29922, 8269, 29918, 333, 29892, 13, 9651, 9849, 543, 3487, 29875, 29901, 15494, 4924, 613, 13, 9651, 1820, 543, 29893, 9714, 613, 13, 9651, 1024, 29922, 29888, 29908, 29912, 1100, 2749, 29889, 932, 29889, 3888, 29889, 932, 29918, 978, 29913, 399, 9714, 613, 13, 9651, 5190, 29918, 974, 29918, 26658, 358, 543, 29923, 3334, 2631, 613, 13, 9651, 9615, 29918, 4381, 29922, 8824, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 1100, 2749, 29918, 11739, 29918, 13789, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 6422, 7855, 1213, 15945, 13, 4706, 1583, 3032, 9902, 353, 7272, 1583, 29889, 1100, 2749, 29889, 29893, 9714, 29898, 3488, 29918, 2311, 29922, 1311, 3032, 3317, 29918, 7076, 29897, 13, 4706, 1583, 3032, 7827, 353, 1583, 3032, 9902, 29889, 7827, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4742, 29918, 3859, 29918, 15697, 29898, 1311, 29897, 1599, 28379, 29961, 21533, 29961, 710, 29892, 3139, 5262, 29901, 13, 4706, 9995, 11609, 278, 2106, 8393, 310, 278, 7855, 1213, 15945, 13, 4706, 12421, 29879, 353, 6571, 13, 13, 4706, 565, 1583, 3032, 9902, 338, 451, 6213, 29901, 13, 9651, 363, 12720, 297, 1583, 3032, 9902, 29889, 1022, 275, 2631, 29901, 13, 18884, 1024, 353, 285, 29908, 29912, 1022, 275, 356, 29889, 13757, 29889, 3257, 29913, 426, 1022, 275, 356, 29889, 25378, 5038, 13, 18884, 12421, 29879, 29961, 978, 29962, 353, 12720, 29889, 1466, 1256, 13, 13, 4706, 736, 12421, 29879, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2106, 29898, 1311, 29897, 1599, 28379, 29961, 524, 5387, 13, 4706, 9995, 11609, 278, 2106, 310, 278, 23530, 1213, 15945, 13, 4706, 736, 1583, 3032, 7827, 13, 2 ]
contrib/capitalone_dataprofiler_expectations/capitalone_dataprofiler_expectations/expectations/expect_column_values_confidence_to_be_greater_than_or_equal_to_threshold_for_data_label.py
zachlindsey/great_expectations
1
1612330
<gh_stars>1-10 """ This is a template for creating custom ColumnMapExpectations. For detailed instructions on how to use it, please see: https://docs.greatexpectations.io/docs/guides/expectations/creating_custom_expectations/how_to_create_custom_column_map_expectations """ import json from typing import Any import dataprofiler as dp import numpy as np # remove extra tf loggin import tensorflow as tf tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) from great_expectations.execution_engine import ( PandasExecutionEngine, SparkDFExecutionEngine, SqlAlchemyExecutionEngine, ) from great_expectations.expectations.expectation import ColumnMapExpectation from great_expectations.expectations.metrics import ( ColumnMapMetricProvider, column_condition_partial, ) class ColumnValuesConfidenceForDataLabelToBeGreaterThanOrEqualToThreshold( ColumnMapMetricProvider ): """MetricProvider Class for Data Label Probability greater than \ or equal to the user-specified threshold""" # This is the id string that will be used to reference your metric. condition_metric_name = "column_values.prediction_confidence_for_data_label_greater_than_or_equal_to_threshold" condition_value_keys = ( "threshold", "data_label", ) # This method implements the core logic for the PandasExecutionEngine @column_condition_partial(engine=PandasExecutionEngine) def _pandas( cls: Any, column: str, threshold: float, data_label: str, **kwargs: Any ) -> np.ndarray: """ Implement the yes/no question for the expectation """ labeler = dp.DataLabeler(labeler_type="structured") labeler.postprocessor.set_params(is_pred_labels=False) results = labeler.predict( column, predict_options={"show_confidences": True}, ) if data_label.upper() in labeler.label_mapping.keys(): data_label_ind = labeler.label_mapping[data_label.upper()] else: raise ValueError( """ The only values acceptable for the data label parameter are as follows: ['PAD', 'UNKNOWN', 'ADDRESS', 'BAN', 'CREDIT_CARD', 'DATE', 'TIME', 'DATETIME',\ 'DRIVERS_LICENSE', 'EMAIL_ADDRESS', 'UUID', 'HASH_OR_KEY', 'IPV4', 'IPV6',\ 'MAC_ADDRESS', 'PERSON', 'PHONE_NUMBER', 'SSN', 'URL', 'US_STATE', 'INTEGER',\ 'FLOAT', 'QUANTITY', 'ORDINAL'] """ ) data_label_conf = results["conf"][:, data_label_ind] return data_label_conf >= threshold class ExpectColumnsValuesConfidenceForDataLabelToBeGreaterThanOrEqualtoThreshold( ColumnMapExpectation ): """ This function builds upon the custom column map expectations of Great Expectations. This function asks the question a yes/no question of each row in the user-specified column; namely, does the confidence threshold provided by the DataProfiler model exceed the user-specified threshold. Args: column (str): The column name that you want to check. data_label(str): The data label for which you want to check confidences against the threshold value threshold (float): The value, usually as a decimal (e.g. .32), you want to use to flag low confidence predictions df.expect_column_values_to_probabilistically_match_data_label( column, data_label=<>, threshold=float(0<=1) ) """ examples = [ { "data": { "OPEID6": ["1002", "1052", "25034", "McRoomyRoom"], "INSTNM": [ "Alabama A & M University", "University of Alabama at Birmingham", "Amridge University", "McRoomyRoom", ], "ZIP": ["35762", "35294-0110", "36117-3553", "McRoomyRoom"], "ACCREDAGENCY": [ "Southern Association of Colleges and Schools Commission on Colleges", "Southern Association of Colleges and Schools Commission on Colleges", "Southern Association of Colleges and Schools Commission on Colleges", "McRoomyRoom", ], "INSTURL": [ "www.aamu.edu/", "https://www.uab.edu", "www.amridgeuniversity.edu", "McRoomyRoom", ], "NPCURL": [ "www.aamu.edu/admissions-aid/tuition-fees/net-price-calculator.html", "https://uab.studentaidcalculator.com/survey.aspx", "www2.amridgeuniversity.edu:9091/", "McRoomyRoom", ], "LATITUDE": ["34.783368", "33.505697", "32.362609", "McRoomyRoom"], "LONGITUDE": ["-86.568502", "-86.799345", "-86.17401", "McRoomyRoom"], "RELAFFIL": ["NULL", "NULL", "74", "McRoomyRoom"], "DEATH_YR2_RT": [ "PrivacySuppressed", "PrivacySuppressed", "PrivacySuppressed", "McRoomyRoom", ], "SEARCH_STRING": [ "Alabama A & M University AAMU", "University of Alabama at Birmingham ", "Amridge University Southern Christian University Regions University", "McRoomyRoom", ], }, "tests": [ { "title": "positive_test_with_column_one", "exact_match_out": False, "include_in_gallery": True, "in": {"column": "ZIP", "data_label": "ADDRESS", "threshold": 0.00}, "out": { "success": True, }, }, { "title": "failing_test_with_column_one", "exact_match_out": False, "include_in_gallery": True, "in": {"column": "ZIP", "data_label": "ADDRESS", "threshold": 1.00}, "out": { "success": False, }, }, ], } ] # This is the id string of the Metric used by this Expectation. # For most Expectations, it will be the same as the `condition_metric_name` defined in your Metric class above. map_metric = "column_values.prediction_confidence_for_data_label_greater_than_or_equal_to_threshold" # This is a list of parameter names that can affect whether the Expectation evaluates to True or False success_keys = ( "threshold", "data_label", "mostly", ) # This dictionary contains default values for any parameters that should have default values default_kwarg_values = { "threshold": None, "data_label": None, "result_format": "BASIC", "include_config": True, "catch_exceptions": False, } # This object contains metadata for display in the public Gallery library_metadata = { "requirements": ["dataprofiler", "tensorflow", "scikit-learn", "numpy"], "maturity": "experimental", # "concept_only", "experimental", "beta", or "production" "tags": ["dataprofiler"], # Tags for this Expectation in the Gallery "contributors": [ # Github handles for all contributors to this Expectation. "@taylorfturner", # Don't forget to add your github handle here! ], } if __name__ == "__main__": diagnostics_report = ( ExpectColumnsValuesConfidenceForDataLabelToBeGreaterThanOrEqualtoThreshold().run_diagnostics() ) print(diagnostics_report.generate_checklist())
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 15945, 29908, 13, 4013, 338, 263, 4472, 363, 4969, 2888, 12481, 3388, 1252, 1103, 800, 29889, 13, 2831, 13173, 11994, 373, 920, 304, 671, 372, 29892, 3113, 1074, 29901, 13, 1678, 2045, 597, 2640, 29889, 29887, 3015, 29916, 1103, 800, 29889, 601, 29914, 2640, 29914, 2543, 2247, 29914, 17854, 800, 29914, 1037, 1218, 29918, 6341, 29918, 17854, 800, 29914, 3525, 29918, 517, 29918, 3258, 29918, 6341, 29918, 4914, 29918, 1958, 29918, 17854, 800, 13, 15945, 29908, 13, 13, 5215, 4390, 13, 3166, 19229, 1053, 3139, 13, 13, 5215, 1418, 481, 307, 1777, 261, 408, 270, 29886, 13, 5215, 12655, 408, 7442, 13, 13, 29937, 3349, 4805, 15886, 1480, 5359, 13, 5215, 26110, 408, 15886, 13, 13, 13264, 29889, 12667, 29889, 29894, 29896, 29889, 21027, 29889, 842, 29918, 18248, 359, 537, 29898, 13264, 29889, 12667, 29889, 29894, 29896, 29889, 21027, 29889, 11432, 29897, 13, 13, 3166, 2107, 29918, 17854, 800, 29889, 22256, 29918, 10599, 1053, 313, 13, 1678, 349, 7086, 20418, 12412, 29892, 13, 1678, 20814, 4037, 20418, 12412, 29892, 13, 1678, 13093, 2499, 305, 6764, 20418, 12412, 29892, 13, 29897, 13, 3166, 2107, 29918, 17854, 800, 29889, 17854, 800, 29889, 17854, 362, 1053, 12481, 3388, 1252, 1103, 362, 13, 3166, 2107, 29918, 17854, 800, 29889, 17854, 800, 29889, 2527, 10817, 1053, 313, 13, 1678, 12481, 3388, 10095, 2200, 6980, 29892, 13, 1678, 1897, 29918, 16122, 29918, 3846, 29892, 13, 29897, 13, 13, 13, 1990, 12481, 9065, 16376, 5084, 2831, 1469, 4775, 1762, 3629, 25120, 1008, 1349, 273, 2816, 9843, 1762, 1349, 12268, 29898, 13, 1678, 12481, 3388, 10095, 2200, 6980, 13, 1125, 13, 1678, 9995, 10095, 2200, 6980, 4134, 363, 3630, 15796, 1019, 29890, 3097, 7621, 1135, 320, 13, 1678, 470, 5186, 304, 278, 1404, 29899, 6550, 2164, 16897, 15945, 29908, 13, 13, 1678, 396, 910, 338, 278, 1178, 1347, 393, 674, 367, 1304, 304, 3407, 596, 12714, 29889, 13, 1678, 4195, 29918, 16414, 29918, 978, 353, 376, 4914, 29918, 5975, 29889, 11965, 2463, 29918, 5527, 5084, 29918, 1454, 29918, 1272, 29918, 1643, 29918, 7979, 1008, 29918, 27603, 29918, 272, 29918, 11745, 29918, 517, 29918, 386, 12268, 29908, 13, 13, 1678, 4195, 29918, 1767, 29918, 8149, 353, 313, 13, 4706, 376, 386, 12268, 613, 13, 4706, 376, 1272, 29918, 1643, 613, 13, 1678, 1723, 13, 13, 1678, 396, 910, 1158, 10703, 278, 7136, 5900, 363, 278, 349, 7086, 20418, 12412, 13, 1678, 732, 4914, 29918, 16122, 29918, 3846, 29898, 10599, 29922, 29925, 7086, 20418, 12412, 29897, 13, 1678, 822, 903, 15112, 29898, 13, 4706, 1067, 29879, 29901, 3139, 29892, 1897, 29901, 851, 29892, 16897, 29901, 5785, 29892, 848, 29918, 1643, 29901, 851, 29892, 3579, 19290, 29901, 3139, 13, 1678, 1723, 1599, 7442, 29889, 299, 2378, 29901, 13, 4706, 9995, 13, 4706, 1954, 2037, 278, 4874, 29914, 1217, 1139, 363, 278, 23227, 13, 4706, 9995, 13, 4706, 3858, 261, 353, 270, 29886, 29889, 1469, 4775, 261, 29898, 1643, 261, 29918, 1853, 543, 4984, 2955, 1159, 13, 4706, 3858, 261, 29889, 2490, 26482, 29889, 842, 29918, 7529, 29898, 275, 29918, 11965, 29918, 21134, 29922, 8824, 29897, 13, 13, 4706, 2582, 353, 3858, 261, 29889, 27711, 29898, 13, 9651, 1897, 29892, 13, 9651, 8500, 29918, 6768, 3790, 29908, 4294, 29918, 5527, 333, 2063, 1115, 5852, 1118, 13, 4706, 1723, 13, 13, 4706, 565, 848, 29918, 1643, 29889, 21064, 580, 297, 3858, 261, 29889, 1643, 29918, 20698, 29889, 8149, 7295, 13, 9651, 848, 29918, 1643, 29918, 513, 353, 3858, 261, 29889, 1643, 29918, 20698, 29961, 1272, 29918, 1643, 29889, 21064, 580, 29962, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 9995, 13, 18884, 450, 871, 1819, 22691, 363, 278, 848, 3858, 3443, 526, 408, 4477, 29901, 13, 18884, 6024, 29925, 3035, 742, 525, 3904, 29968, 6632, 16048, 742, 525, 17744, 26785, 742, 525, 29933, 2190, 742, 525, 29907, 19386, 1806, 29918, 29907, 17011, 742, 525, 6248, 742, 525, 15307, 742, 525, 25832, 2544, 8890, 742, 29905, 13, 462, 1678, 525, 29928, 3960, 5348, 29903, 29918, 27888, 1430, 1660, 742, 525, 26862, 6227, 29918, 17744, 26785, 742, 525, 29965, 11150, 742, 525, 29950, 24943, 29918, 1955, 29918, 10818, 742, 525, 5690, 29963, 29946, 742, 525, 5690, 29963, 29953, 742, 29905, 13, 462, 1678, 525, 1529, 29907, 29918, 17744, 26785, 742, 525, 13171, 3094, 742, 525, 19689, 12413, 29918, 23207, 742, 525, 13429, 742, 525, 4219, 742, 525, 3308, 29918, 19713, 742, 525, 1177, 4330, 17070, 742, 29905, 13, 462, 1678, 525, 29943, 3927, 1299, 742, 525, 13356, 13566, 11937, 742, 525, 25593, 1177, 1964, 2033, 13, 9651, 9995, 13, 9651, 1723, 13, 4706, 848, 29918, 1643, 29918, 5527, 353, 2582, 3366, 5527, 3108, 7503, 29892, 848, 29918, 1643, 29918, 513, 29962, 13, 4706, 736, 848, 29918, 1643, 29918, 5527, 6736, 16897, 13, 13, 13, 1990, 1222, 1103, 14289, 9065, 16376, 5084, 2831, 1469, 4775, 1762, 3629, 25120, 1008, 1349, 273, 2816, 9843, 517, 1349, 12268, 29898, 13, 1678, 12481, 3388, 1252, 1103, 362, 13, 1125, 13, 1678, 9995, 13, 1678, 910, 740, 23315, 2501, 278, 2888, 1897, 2910, 2149, 800, 310, 7027, 1222, 1103, 800, 29889, 910, 740, 19514, 278, 1139, 263, 4874, 29914, 1217, 1139, 310, 1269, 1948, 297, 278, 1404, 29899, 6550, 2164, 1897, 29936, 18451, 29892, 947, 278, 16420, 16897, 4944, 491, 278, 3630, 1184, 1777, 261, 1904, 13461, 278, 1404, 29899, 6550, 2164, 16897, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 1897, 313, 710, 1125, 450, 1897, 1024, 393, 366, 864, 304, 1423, 29889, 13, 4706, 848, 29918, 1643, 29898, 710, 1125, 450, 848, 3858, 363, 607, 366, 864, 304, 1423, 1970, 333, 2063, 2750, 278, 16897, 995, 13, 4706, 16897, 313, 7411, 1125, 450, 995, 29892, 5491, 408, 263, 13677, 313, 29872, 29889, 29887, 29889, 869, 29941, 29906, 511, 366, 864, 304, 671, 304, 7353, 4482, 16420, 27303, 13, 13, 1678, 4489, 29889, 17854, 29918, 4914, 29918, 5975, 29918, 517, 29918, 22795, 4427, 391, 1711, 29918, 4352, 29918, 1272, 29918, 1643, 29898, 13, 4706, 1897, 29892, 13, 4706, 848, 29918, 1643, 29922, 29966, 10202, 13, 4706, 16897, 29922, 7411, 29898, 29900, 14065, 29896, 29897, 13, 1678, 1723, 13, 1678, 9995, 13, 13, 1678, 6455, 353, 518, 13, 4706, 426, 13, 9651, 376, 1272, 1115, 426, 13, 18884, 376, 29949, 4162, 1367, 29953, 1115, 6796, 29896, 29900, 29900, 29906, 613, 376, 29896, 29900, 29945, 29906, 613, 376, 29906, 29945, 29900, 29941, 29946, 613, 376, 27297, 9588, 16103, 9588, 290, 12436, 13, 18884, 376, 25580, 29940, 29924, 1115, 518, 13, 462, 1678, 376, 2499, 23758, 319, 669, 341, 3014, 613, 13, 462, 1678, 376, 11574, 537, 310, 26911, 472, 350, 28836, 613, 13, 462, 1678, 376, 6833, 8605, 3014, 613, 13, 462, 1678, 376, 27297, 9588, 16103, 9588, 290, 613, 13, 18884, 21251, 13, 18884, 376, 29999, 5690, 1115, 6796, 29941, 29945, 29955, 29953, 29906, 613, 376, 29941, 29945, 29906, 29929, 29946, 29899, 29900, 29896, 29896, 29900, 613, 376, 29941, 29953, 29896, 29896, 29955, 29899, 29941, 29945, 29945, 29941, 613, 376, 27297, 9588, 16103, 9588, 290, 12436, 13, 18884, 376, 2477, 22245, 7698, 24647, 29907, 29979, 1115, 518, 13, 462, 1678, 376, 29903, 283, 5063, 7993, 310, 7064, 267, 322, 4523, 29879, 11444, 373, 7064, 267, 613, 13, 462, 1678, 376, 29903, 283, 5063, 7993, 310, 7064, 267, 322, 4523, 29879, 11444, 373, 7064, 267, 613, 13, 462, 1678, 376, 29903, 283, 5063, 7993, 310, 7064, 267, 322, 4523, 29879, 11444, 373, 7064, 267, 613, 13, 462, 1678, 376, 27297, 9588, 16103, 9588, 290, 613, 13, 18884, 21251, 13, 18884, 376, 25580, 4219, 1115, 518, 13, 462, 1678, 376, 1636, 29889, 29874, 314, 29884, 29889, 6085, 29914, 613, 13, 462, 1678, 376, 991, 597, 1636, 29889, 29884, 370, 29889, 6085, 613, 13, 462, 1678, 376, 1636, 29889, 314, 8605, 14540, 537, 29889, 6085, 613, 13, 462, 1678, 376, 27297, 9588, 16103, 9588, 290, 613, 13, 18884, 21251, 13, 18884, 376, 29940, 9026, 4219, 1115, 518, 13, 462, 1678, 376, 1636, 29889, 29874, 314, 29884, 29889, 6085, 29914, 328, 29885, 6847, 29899, 29874, 333, 29914, 9161, 654, 29899, 1725, 267, 29914, 1212, 29899, 9175, 29899, 15807, 1061, 29889, 1420, 613, 13, 462, 1678, 376, 991, 597, 29884, 370, 29889, 18082, 6381, 333, 15807, 1061, 29889, 510, 29914, 7610, 6950, 29889, 6307, 613, 13, 462, 1678, 376, 1636, 29906, 29889, 314, 8605, 14540, 537, 29889, 6085, 29901, 29929, 29900, 29929, 29896, 29914, 613, 13, 462, 1678, 376, 27297, 9588, 16103, 9588, 290, 613, 13, 18884, 21251, 13, 18884, 376, 29931, 1299, 1806, 29965, 2287, 1115, 6796, 29941, 29946, 29889, 29955, 29947, 29941, 29941, 29953, 29947, 613, 376, 29941, 29941, 29889, 29945, 29900, 29945, 29953, 29929, 29955, 613, 376, 29941, 29906, 29889, 29941, 29953, 29906, 29953, 29900, 29929, 613, 376, 27297, 9588, 16103, 9588, 290, 12436, 13, 18884, 376, 29931, 20614, 1806, 29965, 2287, 1115, 6796, 29899, 29947, 29953, 29889, 29945, 29953, 29947, 29945, 29900, 29906, 613, 11663, 29947, 29953, 29889, 29955, 29929, 29929, 29941, 29946, 29945, 613, 11663, 29947, 29953, 29889, 29896, 29955, 29946, 29900, 29896, 613, 376, 27297, 9588, 16103, 9588, 290, 12436, 13, 18884, 376, 1525, 4375, 29943, 3738, 29931, 1115, 6796, 10074, 613, 376, 10074, 613, 376, 29955, 29946, 613, 376, 27297, 9588, 16103, 9588, 290, 12436, 13, 18884, 376, 2287, 7534, 29918, 29979, 29934, 29906, 29918, 13079, 1115, 518, 13, 462, 1678, 376, 29925, 1150, 4135, 20182, 1253, 287, 613, 13, 462, 1678, 376, 29925, 1150, 4135, 20182, 1253, 287, 613, 13, 462, 1678, 376, 29925, 1150, 4135, 20182, 1253, 287, 613, 13, 462, 1678, 376, 27297, 9588, 16103, 9588, 290, 613, 13, 18884, 21251, 13, 18884, 376, 1660, 1718, 3210, 29918, 20785, 1115, 518, 13, 462, 1678, 376, 2499, 23758, 319, 669, 341, 3014, 319, 5194, 29965, 613, 13, 462, 1678, 376, 11574, 537, 310, 26911, 472, 350, 28836, 9162, 13, 462, 1678, 376, 6833, 8605, 3014, 14234, 6111, 3014, 29871, 2169, 1080, 3014, 613, 13, 462, 1678, 376, 27297, 9588, 16103, 9588, 290, 613, 13, 18884, 21251, 13, 9651, 2981, 13, 9651, 376, 21150, 1115, 518, 13, 18884, 426, 13, 462, 1678, 376, 3257, 1115, 376, 1066, 3321, 29918, 1688, 29918, 2541, 29918, 4914, 29918, 650, 613, 13, 462, 1678, 376, 735, 627, 29918, 4352, 29918, 449, 1115, 7700, 29892, 13, 462, 1678, 376, 2856, 29918, 262, 29918, 29887, 23365, 1115, 5852, 29892, 13, 462, 1678, 376, 262, 1115, 8853, 4914, 1115, 376, 29999, 5690, 613, 376, 1272, 29918, 1643, 1115, 376, 17744, 26785, 613, 376, 386, 12268, 1115, 29871, 29900, 29889, 29900, 29900, 1118, 13, 462, 1678, 376, 449, 1115, 426, 13, 462, 4706, 376, 8698, 1115, 5852, 29892, 13, 462, 1678, 2981, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 376, 3257, 1115, 376, 14057, 292, 29918, 1688, 29918, 2541, 29918, 4914, 29918, 650, 613, 13, 462, 1678, 376, 735, 627, 29918, 4352, 29918, 449, 1115, 7700, 29892, 13, 462, 1678, 376, 2856, 29918, 262, 29918, 29887, 23365, 1115, 5852, 29892, 13, 462, 1678, 376, 262, 1115, 8853, 4914, 1115, 376, 29999, 5690, 613, 376, 1272, 29918, 1643, 1115, 376, 17744, 26785, 613, 376, 386, 12268, 1115, 29871, 29896, 29889, 29900, 29900, 1118, 13, 462, 1678, 376, 449, 1115, 426, 13, 462, 4706, 376, 8698, 1115, 7700, 29892, 13, 462, 1678, 2981, 13, 18884, 2981, 13, 9651, 21251, 13, 4706, 500, 13, 1678, 4514, 13, 13, 1678, 396, 910, 338, 278, 1178, 1347, 310, 278, 4737, 2200, 1304, 491, 445, 1222, 1103, 362, 29889, 13, 1678, 396, 1152, 1556, 1222, 1103, 800, 29892, 372, 674, 367, 278, 1021, 408, 278, 421, 16122, 29918, 16414, 29918, 978, 29952, 3342, 297, 596, 4737, 2200, 770, 2038, 29889, 13, 1678, 2910, 29918, 16414, 353, 376, 4914, 29918, 5975, 29889, 11965, 2463, 29918, 5527, 5084, 29918, 1454, 29918, 1272, 29918, 1643, 29918, 7979, 1008, 29918, 27603, 29918, 272, 29918, 11745, 29918, 517, 29918, 386, 12268, 29908, 13, 13, 1678, 396, 910, 338, 263, 1051, 310, 3443, 2983, 393, 508, 6602, 3692, 278, 1222, 1103, 362, 6161, 1078, 304, 5852, 470, 7700, 13, 1678, 2551, 29918, 8149, 353, 313, 13, 4706, 376, 386, 12268, 613, 13, 4706, 376, 1272, 29918, 1643, 613, 13, 4706, 376, 3242, 368, 613, 13, 1678, 1723, 13, 13, 1678, 396, 910, 8600, 3743, 2322, 1819, 363, 738, 4128, 393, 881, 505, 2322, 1819, 13, 1678, 2322, 29918, 11022, 1191, 29918, 5975, 353, 426, 13, 4706, 376, 386, 12268, 1115, 6213, 29892, 13, 4706, 376, 1272, 29918, 1643, 1115, 6213, 29892, 13, 4706, 376, 2914, 29918, 4830, 1115, 376, 29933, 3289, 2965, 613, 13, 4706, 376, 2856, 29918, 2917, 1115, 5852, 29892, 13, 4706, 376, 12510, 29918, 11739, 29879, 1115, 7700, 29892, 13, 1678, 500, 13, 13, 1678, 396, 910, 1203, 3743, 15562, 363, 2479, 297, 278, 970, 15230, 13, 1678, 3489, 29918, 19635, 353, 426, 13, 4706, 376, 12277, 1860, 1115, 6796, 4130, 481, 307, 1777, 261, 613, 376, 29056, 613, 376, 26167, 7354, 29899, 19668, 613, 376, 23749, 12436, 13, 4706, 376, 29885, 1337, 537, 1115, 376, 735, 27910, 613, 29871, 396, 376, 535, 1547, 29918, 6194, 613, 376, 735, 27910, 613, 376, 3571, 613, 470, 376, 24601, 29908, 13, 4706, 376, 11338, 1115, 6796, 4130, 481, 307, 1777, 261, 12436, 29871, 396, 917, 363, 445, 1222, 1103, 362, 297, 278, 15230, 13, 4706, 376, 21570, 29560, 1115, 518, 29871, 396, 402, 2985, 17766, 363, 599, 17737, 29560, 304, 445, 1222, 1103, 362, 29889, 13, 9651, 17962, 29873, 11017, 615, 595, 261, 613, 29871, 396, 3872, 29915, 29873, 9566, 304, 788, 596, 18546, 4386, 1244, 29991, 13, 4706, 21251, 13, 1678, 500, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 652, 20921, 29918, 12276, 353, 313, 13, 4706, 1222, 1103, 14289, 9065, 16376, 5084, 2831, 1469, 4775, 1762, 3629, 25120, 1008, 1349, 273, 2816, 9843, 517, 1349, 12268, 2141, 3389, 29918, 6051, 20921, 580, 13, 1678, 1723, 13, 1678, 1596, 29898, 6051, 20921, 29918, 12276, 29889, 17158, 29918, 3198, 1761, 3101, 13, 2 ]
diplomova_praca/face_features/models.py
MDobransky/thesis-grizzly
1
169838
<reponame>MDobransky/thesis-grizzly from django.db import models # Create your models here. class FaceFeaturesSubmission(models.Model): created = models.DateTimeField(auto_now_add=True) request = models.TextField() selected = models.TextField() num_hints = models.IntegerField()
[ 1, 529, 276, 1112, 420, 29958, 5773, 711, 29878, 550, 3459, 29914, 26533, 29899, 29887, 374, 5617, 368, 13, 3166, 9557, 29889, 2585, 1053, 4733, 30004, 13, 30004, 13, 29937, 6204, 596, 4733, 1244, 22993, 13, 30004, 13, 30004, 13, 1990, 10635, 8263, 3698, 4035, 6737, 29898, 9794, 29889, 3195, 1125, 30004, 13, 1678, 2825, 353, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29918, 1202, 29922, 5574, 8443, 13, 1678, 2009, 353, 4733, 29889, 15778, 26471, 13, 1678, 4629, 353, 4733, 29889, 15778, 26471, 13, 1678, 954, 29918, 29882, 9466, 353, 4733, 29889, 7798, 3073, 26471, 13, 30004, 13, 30004, 13, 2 ]
kube_log_watcher/agents/__init__.py
dryewo/kubernetes-log-watcher
0
180984
<filename>kube_log_watcher/agents/__init__.py from kube_log_watcher.agents.base import BaseWatcher from kube_log_watcher.agents.appdynamics import AppDynamicsAgent from kube_log_watcher.agents.scalyr import ScalyrAgent __all__ = ( AppDynamicsAgent, BaseWatcher, ScalyrAgent, )
[ 1, 529, 9507, 29958, 29895, 4003, 29918, 1188, 29918, 12344, 261, 29914, 351, 1237, 29914, 1649, 2344, 26914, 2272, 13, 3166, 413, 4003, 29918, 1188, 29918, 12344, 261, 29889, 351, 1237, 29889, 3188, 1053, 7399, 24709, 261, 13, 13, 3166, 413, 4003, 29918, 1188, 29918, 12344, 261, 29889, 351, 1237, 29889, 932, 29881, 2926, 1199, 1053, 2401, 29928, 2926, 1199, 19661, 13, 3166, 413, 4003, 29918, 1188, 29918, 12344, 261, 29889, 351, 1237, 29889, 19529, 4316, 1053, 317, 1052, 4316, 19661, 13, 13, 13, 1649, 497, 1649, 353, 313, 13, 1678, 2401, 29928, 2926, 1199, 19661, 29892, 13, 1678, 7399, 24709, 261, 29892, 13, 1678, 317, 1052, 4316, 19661, 29892, 13, 29897, 13, 2 ]
PyFunceble/checker/syntax/domain_base.py
Centaurioun/PyFunceble
213
47784
<reponame>Centaurioun/PyFunceble """ The tool to check the availability or syntax of domain, IP or URL. :: ██████╗ ██╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗███████╗██████╗ ██╗ ███████╗ ██╔══██╗╚██╗ ██╔╝██╔════╝██║ ██║████╗ ██║██╔════╝██╔════╝██╔══██╗██║ ██╔════╝ ██████╔╝ ╚████╔╝ █████╗ ██║ ██║██╔██╗ ██║██║ █████╗ ██████╔╝██║ █████╗ ██╔═══╝ ╚██╔╝ ██╔══╝ ██║ ██║██║╚██╗██║██║ ██╔══╝ ██╔══██╗██║ ██╔══╝ ██║ ██║ ██║ ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝ Provides the base of all domain syntax checker. Author: <NAME>, @funilrys, contactTATAfunilrysTODTODcom Special thanks: https://pyfunceble.github.io/#/special-thanks Contributors: https://pyfunceble.github.io/#/contributors Project link: https://github.com/funilrys/PyFunceble Project documentation: https://pyfunceble.readthedocs.io/en/dev/ Project homepage: https://pyfunceble.github.io/ License: :: Copyright 2017, 2018, 2019, 2020, 2021 <NAME> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import functools from typing import Optional, Tuple from PyFunceble.checker.base import CheckerBase from PyFunceble.dataset.iana import IanaDataset from PyFunceble.dataset.public_suffix import PublicSuffixDataset class DomainSyntaxCheckerBase(CheckerBase): """ Provides an interface to check the syntax of a second domain. :param str subject: Optional, The subject to work with. """ # pylint: disable=line-too-long SPECIAL_USE_DOMAIN_NAMES_EXTENSIONS = ["onion"] """ Specifies the extension which are specified as "Special-Use Domain Names" and supported by our project. :type: list .. seealso:: * `RFC6761`_ * `IANA Special-Use Domain Names`_ assignments. * `RFC7686`_ .. _RFC6761: https://tools.ietf.org/html/rfc6761 .. _RFC7686: https://tools.ietf.org/html/rfc6761 .. _IANA Special-Use Domain Names: https://www.iana.org/assignments/special-use-domain-names/special-use-domain-names.txt """ last_point_index: Optional[int] = None """ Saves the index of the last point. """ iana_dataset: Optional[IanaDataset] = None public_suffix_dataset: Optional[PublicSuffixDataset] = None def __init__(self, subject: Optional[str] = None) -> None: self.iana_dataset = IanaDataset() self.public_suffix_dataset = PublicSuffixDataset() super().__init__(subject) def reset_last_point_index(func): # pylint: disable=no-self-argument """ Resets the last point index before executing the decorated method. """ @functools.wraps(func) def wrapper(self, *args, **kwargs): self.last_point_index = None return func(self, *args, **kwargs) # pylint: disable=not-callable return wrapper def find_last_point_index(func): # pylint: disable=no-self-argument """ Try to find the index of the last point after the execution of the decorated method. """ @functools.wraps(func) def wrapper(self, *args, **kwargs): result = func(self, *args, **kwargs) # pylint: disable=not-callable self.last_point_index = self.get_last_point_index(self.idna_subject) return result return wrapper @CheckerBase.subject.setter @reset_last_point_index @find_last_point_index def subject(self, value: str): """ Sets the subject to work with. :param value: The subject to set. :raise TypeError: When the given :code:`value` is not a :py:class:`str`. :raise ValueError: When the given :code:`value` is empty. """ # pylint: disable=no-member super(DomainSyntaxCheckerBase, self.__class__).subject.fset(self, value) @staticmethod def get_last_point_index(subject: str) -> Optional[int]: """ Provides the index of the last point of the given subject. """ try: if subject.endswith("."): return subject[:-1].rfind(".") return subject.rindex(".") except ValueError: return None def get_subject_without_suffix( self, subject: str, extension: str ) -> Optional[Tuple[Optional[int], Optional[str]]]: """ Provides the given subject without the suffix. :param subject: The subject to work with. :param extension: The extension previously extracted. """ if extension in self.public_suffix_dataset: for suffix in self.public_suffix_dataset.get_available_suffix(extension): try: return subject[: subject.rindex(f".{suffix}")], suffix except ValueError: continue return None, None @CheckerBase.ensure_subject_is_given def get_extension(self) -> Optional[str]: """ Provides the extension to work with (if exists). """ if self.last_point_index is None: return None # Plus one is for the leading point. extension = self.idna_subject[self.last_point_index + 1 :] if extension.endswith("."): extension = extension[:-1] return extension def is_valid(self) -> bool: """ Validate the given subject. """ raise NotImplementedError()
[ 1, 529, 276, 1112, 420, 29958, 29907, 6381, 5338, 1309, 29914, 19737, 25394, 346, 569, 13, 15945, 29908, 13, 1576, 5780, 304, 1423, 278, 20847, 3097, 470, 5877, 310, 5354, 29892, 5641, 470, 3988, 29889, 13, 13, 1057, 13, 13, 13, 268, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 29871, 30208, 30208, 31215, 1678, 30208, 30208, 31215, 30208, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 30208, 30208, 31215, 1678, 30208, 30208, 31215, 30208, 30208, 30208, 31215, 1678, 30208, 30208, 31215, 29871, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 30208, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 29871, 30208, 30208, 31215, 418, 30208, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 13, 268, 30208, 30208, 31351, 13648, 30208, 30208, 31215, 31372, 30208, 30208, 31215, 29871, 30208, 30208, 31351, 31269, 30208, 30208, 31351, 24078, 31269, 30208, 30208, 30246, 1678, 30208, 30208, 30246, 30208, 30208, 30208, 30208, 31215, 259, 30208, 30208, 30246, 30208, 30208, 31351, 24078, 31269, 30208, 30208, 31351, 24078, 31269, 30208, 30208, 31351, 13648, 30208, 30208, 31215, 30208, 30208, 30246, 418, 30208, 30208, 31351, 24078, 31269, 13, 268, 30208, 30208, 30208, 30208, 30208, 30208, 31351, 31269, 29871, 31372, 30208, 30208, 30208, 30208, 31351, 31269, 29871, 30208, 30208, 30208, 30208, 30208, 31215, 259, 30208, 30208, 30246, 1678, 30208, 30208, 30246, 30208, 30208, 31351, 30208, 30208, 31215, 29871, 30208, 30208, 30246, 30208, 30208, 30246, 418, 30208, 30208, 30208, 30208, 30208, 31215, 259, 30208, 30208, 30208, 30208, 30208, 30208, 31351, 31269, 30208, 30208, 30246, 418, 30208, 30208, 30208, 30208, 30208, 31215, 13, 268, 30208, 30208, 31351, 13648, 30114, 31269, 1678, 31372, 30208, 30208, 31351, 31269, 259, 30208, 30208, 31351, 13648, 31269, 259, 30208, 30208, 30246, 1678, 30208, 30208, 30246, 30208, 30208, 30246, 31372, 30208, 30208, 31215, 30208, 30208, 30246, 30208, 30208, 30246, 418, 30208, 30208, 31351, 13648, 31269, 259, 30208, 30208, 31351, 13648, 30208, 30208, 31215, 30208, 30208, 30246, 418, 30208, 30208, 31351, 13648, 31269, 13, 268, 30208, 30208, 30246, 308, 30208, 30208, 30246, 1678, 30208, 30208, 30246, 418, 31372, 30208, 30208, 30208, 30208, 30208, 30208, 31351, 31269, 30208, 30208, 30246, 29871, 31372, 30208, 30208, 30208, 30208, 30246, 31372, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 30208, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 30208, 30208, 30208, 30208, 30208, 30208, 31351, 31269, 30208, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 30208, 30208, 30208, 30208, 30208, 30208, 30208, 31215, 13, 268, 31372, 30114, 31269, 308, 31372, 30114, 31269, 1678, 31372, 30114, 31269, 539, 31372, 24078, 30114, 31269, 29871, 31372, 30114, 31269, 259, 31372, 13648, 30114, 31269, 29871, 31372, 24078, 30114, 31269, 31372, 24078, 13648, 31269, 31372, 24078, 30114, 31269, 29871, 31372, 24078, 13648, 31269, 31372, 24078, 13648, 31269, 13, 13, 1184, 29894, 2247, 278, 2967, 310, 599, 5354, 5877, 1423, 261, 29889, 13, 13, 13720, 29901, 13, 1678, 529, 5813, 10202, 732, 7692, 309, 18450, 29892, 6958, 29911, 8254, 7692, 309, 18450, 4986, 29928, 4986, 29928, 510, 13, 13, 24780, 3969, 29901, 13, 1678, 2045, 597, 2272, 7692, 346, 569, 29889, 3292, 29889, 601, 8484, 29914, 18732, 29899, 386, 1331, 13, 13, 1323, 1091, 29560, 29901, 13, 1678, 2045, 597, 2272, 7692, 346, 569, 29889, 3292, 29889, 601, 8484, 29914, 21570, 29560, 13, 13, 7653, 1544, 29901, 13, 1678, 2045, 597, 3292, 29889, 510, 29914, 7692, 309, 18450, 29914, 19737, 25394, 346, 569, 13, 13, 7653, 5106, 29901, 13, 1678, 2045, 597, 2272, 7692, 346, 569, 29889, 949, 386, 287, 12332, 29889, 601, 29914, 264, 29914, 3359, 29914, 13, 13, 7653, 3271, 3488, 29901, 13, 1678, 2045, 597, 2272, 7692, 346, 569, 29889, 3292, 29889, 601, 29914, 13, 13, 29931, 293, 1947, 29901, 13, 1057, 13, 13, 13, 1678, 14187, 1266, 29871, 29906, 29900, 29896, 29955, 29892, 29871, 29906, 29900, 29896, 29947, 29892, 29871, 29906, 29900, 29896, 29929, 29892, 29871, 29906, 29900, 29906, 29900, 29892, 29871, 29906, 29900, 29906, 29896, 529, 5813, 29958, 13, 13, 1678, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 1678, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 1678, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 13, 4706, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 13, 1678, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 1678, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 1678, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 1678, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 1678, 27028, 1090, 278, 19245, 29889, 13, 15945, 29908, 13, 13, 5215, 2090, 312, 8789, 13, 3166, 19229, 1053, 28379, 29892, 12603, 552, 13, 13, 3166, 10772, 25394, 346, 569, 29889, 3198, 261, 29889, 3188, 1053, 5399, 261, 5160, 13, 3166, 10772, 25394, 346, 569, 29889, 24713, 29889, 3857, 1053, 306, 1648, 16390, 24541, 13, 3166, 10772, 25394, 346, 569, 29889, 24713, 29889, 3597, 29918, 2146, 600, 861, 1053, 5236, 29903, 3096, 861, 16390, 24541, 13, 13, 13, 1990, 28460, 16676, 5596, 261, 5160, 29898, 5596, 261, 5160, 1125, 13, 1678, 9995, 13, 1678, 9133, 2247, 385, 5067, 304, 1423, 278, 5877, 310, 263, 1473, 5354, 29889, 13, 13, 1678, 584, 3207, 851, 4967, 29901, 13, 4706, 28379, 29892, 450, 4967, 304, 664, 411, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 1220, 29899, 517, 29877, 29899, 5426, 13, 1678, 317, 4162, 8426, 1964, 29918, 17171, 29918, 3970, 29032, 29918, 5813, 29903, 29918, 12194, 1430, 13381, 29903, 353, 6796, 265, 291, 3108, 13, 1678, 9995, 13, 1678, 12048, 11057, 278, 6081, 607, 526, 6790, 408, 376, 24780, 29899, 11403, 28460, 14706, 29908, 13, 1678, 322, 6969, 491, 1749, 2060, 29889, 13, 13, 1678, 584, 1853, 29901, 1051, 13, 13, 1678, 6317, 1074, 15189, 1057, 13, 539, 334, 421, 29934, 8610, 29953, 29955, 29953, 29896, 29952, 29918, 13, 539, 334, 421, 29902, 2190, 29909, 12630, 29899, 11403, 28460, 14706, 29952, 29918, 3566, 1860, 29889, 13, 539, 334, 421, 29934, 8610, 29955, 29953, 29947, 29953, 29952, 29918, 13, 13, 1678, 6317, 903, 29934, 8610, 29953, 29955, 29953, 29896, 29901, 2045, 597, 8504, 29889, 2035, 29888, 29889, 990, 29914, 1420, 29914, 9600, 29883, 29953, 29955, 29953, 29896, 13, 1678, 6317, 903, 29934, 8610, 29955, 29953, 29947, 29953, 29901, 2045, 597, 8504, 29889, 2035, 29888, 29889, 990, 29914, 1420, 29914, 9600, 29883, 29953, 29955, 29953, 29896, 13, 1678, 6317, 903, 29902, 2190, 29909, 12630, 29899, 11403, 28460, 14706, 29901, 2045, 597, 1636, 29889, 3857, 29889, 990, 29914, 16645, 1860, 29914, 18732, 29899, 1509, 29899, 7247, 29899, 7039, 29914, 18732, 29899, 1509, 29899, 7247, 29899, 7039, 29889, 3945, 13, 1678, 9995, 13, 13, 1678, 1833, 29918, 3149, 29918, 2248, 29901, 28379, 29961, 524, 29962, 353, 6213, 13, 1678, 9995, 13, 1678, 317, 5989, 278, 2380, 310, 278, 1833, 1298, 29889, 13, 1678, 9995, 13, 13, 1678, 474, 1648, 29918, 24713, 29901, 28379, 29961, 29902, 1648, 16390, 24541, 29962, 353, 6213, 13, 1678, 970, 29918, 2146, 600, 861, 29918, 24713, 29901, 28379, 29961, 19858, 29903, 3096, 861, 16390, 24541, 29962, 353, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4967, 29901, 28379, 29961, 710, 29962, 353, 6213, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 3857, 29918, 24713, 353, 306, 1648, 16390, 24541, 580, 13, 4706, 1583, 29889, 3597, 29918, 2146, 600, 861, 29918, 24713, 353, 5236, 29903, 3096, 861, 16390, 24541, 580, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 16009, 29897, 13, 13, 1678, 822, 10092, 29918, 4230, 29918, 3149, 29918, 2248, 29898, 9891, 1125, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 1311, 29899, 23516, 13, 4706, 9995, 13, 4706, 2538, 1691, 278, 1833, 1298, 2380, 1434, 14012, 278, 10200, 630, 1158, 29889, 13, 4706, 9995, 13, 13, 4706, 732, 7692, 312, 8789, 29889, 29893, 336, 567, 29898, 9891, 29897, 13, 4706, 822, 14476, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 9651, 1583, 29889, 4230, 29918, 3149, 29918, 2248, 353, 6213, 13, 13, 9651, 736, 3653, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1333, 29899, 4804, 519, 13, 13, 4706, 736, 14476, 13, 13, 1678, 822, 1284, 29918, 4230, 29918, 3149, 29918, 2248, 29898, 9891, 1125, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 1311, 29899, 23516, 13, 4706, 9995, 13, 4706, 3967, 304, 1284, 278, 2380, 310, 278, 1833, 1298, 1156, 278, 8225, 310, 278, 13, 4706, 10200, 630, 1158, 29889, 13, 4706, 9995, 13, 13, 4706, 732, 7692, 312, 8789, 29889, 29893, 336, 567, 29898, 9891, 29897, 13, 4706, 822, 14476, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 9651, 1121, 353, 3653, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1333, 29899, 4804, 519, 13, 13, 9651, 1583, 29889, 4230, 29918, 3149, 29918, 2248, 353, 1583, 29889, 657, 29918, 4230, 29918, 3149, 29918, 2248, 29898, 1311, 29889, 333, 1056, 29918, 16009, 29897, 13, 13, 9651, 736, 1121, 13, 13, 4706, 736, 14476, 13, 13, 1678, 732, 5596, 261, 5160, 29889, 16009, 29889, 842, 357, 13, 1678, 732, 12071, 29918, 4230, 29918, 3149, 29918, 2248, 13, 1678, 732, 2886, 29918, 4230, 29918, 3149, 29918, 2248, 13, 1678, 822, 4967, 29898, 1311, 29892, 995, 29901, 851, 1125, 13, 4706, 9995, 13, 4706, 317, 1691, 278, 4967, 304, 664, 411, 29889, 13, 13, 4706, 584, 3207, 995, 29901, 13, 9651, 450, 4967, 304, 731, 29889, 13, 13, 4706, 584, 22692, 20948, 29901, 13, 9651, 1932, 278, 2183, 584, 401, 18078, 1767, 29952, 338, 451, 263, 584, 2272, 29901, 1990, 18078, 710, 1412, 13, 4706, 584, 22692, 7865, 2392, 29901, 13, 9651, 1932, 278, 2183, 584, 401, 18078, 1767, 29952, 338, 4069, 29889, 13, 4706, 9995, 13, 13, 4706, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 14242, 13, 4706, 2428, 29898, 15951, 16676, 5596, 261, 5160, 29892, 1583, 17255, 1990, 1649, 467, 16009, 29889, 29888, 842, 29898, 1311, 29892, 995, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 4230, 29918, 3149, 29918, 2248, 29898, 16009, 29901, 851, 29897, 1599, 28379, 29961, 524, 5387, 13, 4706, 9995, 13, 4706, 9133, 2247, 278, 2380, 310, 278, 1833, 1298, 310, 278, 2183, 4967, 29889, 13, 4706, 9995, 13, 13, 4706, 1018, 29901, 13, 9651, 565, 4967, 29889, 1975, 2541, 703, 1213, 1125, 13, 18884, 736, 4967, 7503, 29899, 29896, 1822, 29878, 2886, 17350, 1159, 13, 13, 9651, 736, 4967, 29889, 29878, 2248, 17350, 1159, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 736, 6213, 13, 13, 1678, 822, 679, 29918, 16009, 29918, 14037, 29918, 2146, 600, 861, 29898, 13, 4706, 1583, 29892, 4967, 29901, 851, 29892, 6081, 29901, 851, 13, 1678, 1723, 1599, 28379, 29961, 23215, 552, 29961, 27636, 29961, 524, 1402, 28379, 29961, 710, 5262, 5387, 13, 4706, 9995, 13, 4706, 9133, 2247, 278, 2183, 4967, 1728, 278, 25557, 29889, 13, 13, 4706, 584, 3207, 4967, 29901, 13, 9651, 450, 4967, 304, 664, 411, 29889, 13, 4706, 584, 3207, 6081, 29901, 13, 9651, 450, 6081, 9251, 23892, 29889, 13, 4706, 9995, 13, 13, 4706, 565, 6081, 297, 1583, 29889, 3597, 29918, 2146, 600, 861, 29918, 24713, 29901, 13, 9651, 363, 25557, 297, 1583, 29889, 3597, 29918, 2146, 600, 861, 29918, 24713, 29889, 657, 29918, 16515, 29918, 2146, 600, 861, 29898, 17588, 1125, 13, 18884, 1018, 29901, 13, 462, 1678, 736, 4967, 7503, 4967, 29889, 29878, 2248, 29898, 29888, 1642, 29912, 2146, 600, 861, 27195, 1402, 25557, 13, 18884, 5174, 7865, 2392, 29901, 13, 462, 1678, 6773, 13, 13, 4706, 736, 6213, 29892, 6213, 13, 13, 1678, 732, 5596, 261, 5160, 29889, 7469, 29918, 16009, 29918, 275, 29918, 29887, 5428, 13, 1678, 822, 679, 29918, 17588, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 9995, 13, 4706, 9133, 2247, 278, 6081, 304, 664, 411, 313, 361, 4864, 467, 13, 4706, 9995, 13, 13, 4706, 565, 1583, 29889, 4230, 29918, 3149, 29918, 2248, 338, 6213, 29901, 13, 9651, 736, 6213, 13, 13, 4706, 396, 15113, 697, 338, 363, 278, 8236, 1298, 29889, 13, 4706, 6081, 353, 1583, 29889, 333, 1056, 29918, 16009, 29961, 1311, 29889, 4230, 29918, 3149, 29918, 2248, 718, 29871, 29896, 584, 29962, 13, 13, 4706, 565, 6081, 29889, 1975, 2541, 703, 1213, 1125, 13, 9651, 6081, 353, 6081, 7503, 29899, 29896, 29962, 13, 13, 4706, 736, 6081, 13, 13, 1678, 822, 338, 29918, 3084, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 15758, 403, 278, 2183, 4967, 29889, 13, 4706, 9995, 13, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 2 ]
setup.py
jmbhughes/slidingpuzzle
1
155259
<reponame>jmbhughes/slidingpuzzle<filename>setup.py from setuptools import setup setup( name='slidingpuzzle', version='0.0.1', packages=['slidingpuzzle', 'slidingpuzzle.tests'], url='https://slidingpuzzle.readthedocs.io/en/latest/?', license='MIT', author='jmbhughes', author_email='<EMAIL>', description='a sliding puzzle solver' )
[ 1, 529, 276, 1112, 420, 29958, 29926, 8337, 29882, 6129, 267, 29914, 2536, 4821, 29886, 18813, 280, 29966, 9507, 29958, 14669, 29889, 2272, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 2536, 4821, 29886, 18813, 280, 742, 13, 1678, 1873, 2433, 29900, 29889, 29900, 29889, 29896, 742, 13, 1678, 9741, 29922, 1839, 2536, 4821, 29886, 18813, 280, 742, 525, 2536, 4821, 29886, 18813, 280, 29889, 21150, 7464, 13, 1678, 3142, 2433, 991, 597, 2536, 4821, 29886, 18813, 280, 29889, 949, 386, 287, 12332, 29889, 601, 29914, 264, 29914, 12333, 13401, 742, 13, 1678, 19405, 2433, 26349, 742, 13, 1678, 4148, 2433, 29926, 8337, 29882, 6129, 267, 742, 13, 1678, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 1678, 6139, 2433, 29874, 2243, 4821, 20285, 280, 899, 369, 29915, 13, 29897, 13, 2 ]
AzureWorkloadSnapshotPreReqCLIScripts/helpers.py
shashwattrivedi/Azure-Workload-Backup-Troubleshooting-Scripts
0
147637
# # Copyright 2021 (c) Microsoft Corporation # # MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this script and associated documentation files (the "script"), to deal # in the script without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the scipt, and to permit persons to whom the script 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 script. # THE SCRIPT 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 SCRIPT OR THE USE OR OTHER DEALINGS IN THE # SCRIPT import os import fileinput import sys import time def assignRoleOnResourceGroup(PrincipalId, ResourceGroup, RoleName): print(bcolors.OKBLUE + "Fetching assigned role " + RoleName + " for " + PrincipalId + " on resource group " + ResourceGroup + bcolors.ENDC) output = os.system("az role assignment list -g {} --assignee {} --role {} -o tsv --only-show-errors > roleGet.txt".format(ResourceGroup, PrincipalId, "\"" + RoleName + "\"")) #Error handling if output != 0: print(bcolors.FAIL + "Script failed with unexpected error ... " + bcolors.ENDC) print(bcolors.FAIL + "Please re-run the script after some time." + bcolors.ENDC) sys.exit() print(bcolors.OKGREEN + "Role assignment with role " + RoleName + " for " + PrincipalId + " on resource group " + ResourceGroup + " fetched successfully " + bcolors.ENDC) role = [line[:-1] for line in fileinput.input(files='roleGet.txt')] if len(role): print(bcolors.OKBLUE + "Already assigned " + RoleName + " role on resource group " + ResourceGroup + " to "+ PrincipalId + bcolors.ENDC) else: print(bcolors.OKBLUE + "Assigning role " + RoleName + " to " + PrincipalId + " on resource group " + ResourceGroup + bcolors.ENDC) output = os.system("az role assignment create -g {} --assignee {} --role {} -o tsv --only-show-errors".format(ResourceGroup, PrincipalId, "\"" + RoleName + "\"")) if output != 0: print(bcolors.OKBLUE + "Exception caught while assigning role" + bcolors.ENDC) print(bcolors.FAIL + "Please re-run the script after some time." + bcolors.ENDC) sys.exit() else: print(bcolors.OKBLUE + "Assigned " + RoleName + " role on resource group " + ResourceGroup + " to " + PrincipalId + " successfully." + bcolors.ENDC) def assignRoleOnScope(PrincipalId, RoleName, Scope): print(bcolors.OKBLUE + "Fetching assigned role " + RoleName + " for " + PrincipalId + " on scope " + Scope + bcolors.ENDC) output = os.system("az role assignment list --assignee {} --role {} --scope {} -o tsv --only-show-errors > roleGetScope.txt".format( PrincipalId, "\"" + RoleName + "\"", Scope)) #Error handling if output != 0: print(bcolors.FAIL + "Script failed with unexpected error ... " + bcolors.ENDC) print(bcolors.FAIL + "Please re-run the script after some time." + bcolors.ENDC) sys.exit() print(bcolors.OKGREEN + "Role assignment with role" + RoleName + " for " + PrincipalId + " on scope " + Scope + " fetched successfully " + bcolors.ENDC) role = [line[:-1] for line in fileinput.input(files='roleGetScope.txt')] if len(role): print(bcolors.OKBLUE + "Already assigned " + RoleName + " role on scope " + Scope + " to " + PrincipalId + bcolors.ENDC) else: print(bcolors.OKBLUE + "Assigning role " + RoleName + " to " + PrincipalId + " on scope " + Scope + bcolors.ENDC) output = os.system("az role assignment create --assignee {} --role {} --scope {} -o tsv --only-show-errors".format(PrincipalId, "\"" + RoleName + "\"", Scope)) if output != 0: print(bcolors.FAIL + "Exception caught while assigning role" + bcolors.ENDC) print(bcolors.FAIL + "Please re-run the script after some time." + bcolors.ENDC) sys.exit() else: print(bcolors.OKBLUE + "Assigned " + RoleName + " role on scope " + Scope + " to " + PrincipalId + " successfully." + bcolors.ENDC) def assignIdentityToVMs(UserAssignedServiceIdentityId, VirtualMachineResourceGroup, VirtualMachineNames, Subscription): service_principal_id = "" principalIds = [] if UserAssignedServiceIdentityId is not None: output = os.system("az identity show --ids {} -o tsv --only-show-errors > msiPrincipal.txt".format(UserAssignedServiceIdentityId)) if output != 0: print(bcolors.FAIL + "Given user assigned identity is not found or script failed with unexpected error ..." + bcolors.ENDC) print(bcolors.FAIL + "Please re-run the script after some time." + bcolors.ENDC) sys.exit() identity = [line[:-1] for line in fileinput.input(files='msiPrincipal.txt')] service_principal_id = identity[0].split('\t')[5] print(bcolors.OKGREEN + "Using user assigned service identity principal " + service_principal_id + bcolors.ENDC) principalIds.append(service_principal_id) for virtualMachineName in VirtualMachineNames: identity = "\"" + UserAssignedServiceIdentityId + "\"" print(bcolors.OKBLUE + "Enabling user assigned identity on virtual machine " + virtualMachineName + bcolors.ENDC) output = os.system("az vm identity assign -n {} -g {} --subscription {} --identities {} -o tsv --only-show-errors > identityAssign.txt".format(virtualMachineName, VirtualMachineResourceGroup, Subscription, identity)) if output != 0: print(bcolors.FAIL + "script failed with unexpected error ..." + bcolors.ENDC) print(bcolors.FAIL + "Please re-run the script after some time." + bcolors.ENDC) sys.exit() print(bcolors.OKGREEN + "Enabled user assigned identity on virtual machine " + virtualMachineName + bcolors.ENDC) else: for virtualMachineName in VirtualMachineNames: output = os.system("az vm identity show -n {} -g {} --subscription {} -o tsv --only-show-errors > identityShow.txt".format(virtualMachineName, VirtualMachineResourceGroup, Subscription)) identity = [line[:-1] for line in fileinput.input(files='identityShow.txt')] if len(identity) == 0 or "systemassigned" not in identity[0].lower(): print(bcolors.OKBLUE + "Enabling system assigned identity on virtual machine " + virtualMachineName + bcolors.ENDC) output = os.system("az vm identity assign -n {} -g {} --subscription {} -o tsv --only-show-errors > identityAssign.txt".format(virtualMachineName, VirtualMachineResourceGroup, Subscription)) if output != 0: print(bcolors.FAIL + "Script failed with unexpected error while assigning VM identity ..." + bcolors.ENDC) print(bcolors.FAIL + "Please re-run the script after some time." + bcolors.ENDC) sys.exit() print(bcolors.OKGREEN + "Successfully assigned system identity to VM " + virtualMachineName + bcolors.ENDC) time.sleep(10) output = os.system("az vm identity show -n {} -g {} --subscription {} -o tsv --only-show-errors > identityShow.txt".format(virtualMachineName, VirtualMachineResourceGroup, Subscription)) else: print(bcolors.OKGREEN + "System assigned identity already enabled on virtual machine " + virtualMachineName + bcolors.ENDC) identity = [line[:-1] for line in fileinput.input(files='identityShow.txt')] service_principal_id = identity[0].split("\t")[0] # (identity[1].split('"'))[3] #check - add to the principalIds list principalIds.append(service_principal_id) return principalIds class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m'
[ 1, 396, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 313, 29883, 29897, 7783, 15025, 13, 29937, 13, 29937, 341, 1806, 19245, 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, 2471, 322, 6942, 5106, 2066, 313, 1552, 376, 2154, 4968, 304, 5376, 13, 29937, 297, 278, 2471, 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, 4560, 415, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 2471, 338, 13, 29937, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 13, 29937, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 599, 13, 29937, 14591, 470, 23228, 2011, 1080, 310, 278, 2471, 29889, 13, 13, 29937, 6093, 12314, 24290, 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, 12314, 24290, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 13, 29937, 12314, 24290, 13, 13, 5215, 2897, 13, 5215, 934, 2080, 13, 5215, 10876, 13, 5215, 931, 13, 13, 1753, 3566, 16727, 2951, 6848, 4782, 29898, 4040, 26706, 1204, 29892, 18981, 4782, 29892, 1528, 280, 1170, 1125, 13, 1678, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 20927, 292, 9859, 6297, 376, 718, 1528, 280, 1170, 718, 376, 363, 376, 718, 14771, 7830, 1204, 718, 376, 373, 6503, 2318, 376, 718, 18981, 4782, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 13, 1678, 1962, 353, 2897, 29889, 5205, 703, 834, 6297, 12827, 1051, 448, 29887, 6571, 1192, 465, 4895, 29872, 6571, 1192, 12154, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1405, 6297, 2577, 29889, 3945, 1642, 4830, 29898, 6848, 4782, 29892, 14771, 7830, 1204, 29892, 376, 5931, 29908, 718, 1528, 280, 1170, 718, 376, 5931, 5783, 29871, 13, 13, 1678, 396, 2392, 11415, 13, 1678, 565, 1962, 2804, 29871, 29900, 29901, 13, 4706, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 4081, 5229, 411, 15668, 1059, 2023, 376, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 4706, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 12148, 337, 29899, 3389, 278, 2471, 1156, 777, 931, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 4706, 10876, 29889, 13322, 580, 13, 13, 1678, 1596, 29898, 29890, 27703, 29889, 8949, 29954, 1525, 1430, 718, 376, 16727, 12827, 411, 6297, 29871, 376, 718, 1528, 280, 1170, 718, 376, 363, 376, 718, 14771, 7830, 1204, 718, 376, 373, 6503, 2318, 376, 718, 18981, 4782, 718, 376, 6699, 287, 8472, 376, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 13, 1678, 6297, 353, 518, 1220, 7503, 29899, 29896, 29962, 363, 1196, 297, 934, 2080, 29889, 2080, 29898, 5325, 2433, 12154, 2577, 29889, 3945, 1495, 29962, 13, 13, 1678, 565, 7431, 29898, 12154, 1125, 13, 4706, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 2499, 2040, 9859, 376, 718, 1528, 280, 1170, 718, 376, 6297, 373, 6503, 2318, 376, 718, 18981, 4782, 718, 376, 304, 15691, 14771, 7830, 1204, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 7900, 647, 292, 6297, 376, 718, 1528, 280, 1170, 718, 376, 304, 376, 718, 14771, 7830, 1204, 718, 376, 373, 6503, 2318, 376, 718, 18981, 4782, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 4706, 1962, 353, 2897, 29889, 5205, 703, 834, 6297, 12827, 1653, 448, 29887, 6571, 1192, 465, 4895, 29872, 6571, 1192, 12154, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1642, 4830, 29898, 6848, 4782, 29892, 14771, 7830, 1204, 29892, 376, 5931, 29908, 718, 1528, 280, 1170, 718, 376, 5931, 5783, 13, 13, 4706, 565, 1962, 2804, 29871, 29900, 29901, 13, 9651, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 2451, 12624, 1550, 23188, 6297, 29908, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 9651, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 12148, 337, 29899, 3389, 278, 2471, 1156, 777, 931, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 9651, 10876, 29889, 13322, 580, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 7900, 12961, 376, 718, 1528, 280, 1170, 718, 376, 6297, 373, 6503, 2318, 376, 718, 18981, 4782, 718, 376, 304, 376, 718, 14771, 7830, 1204, 718, 376, 8472, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 268, 13, 13, 1753, 3566, 16727, 2951, 15289, 29898, 4040, 26706, 1204, 29892, 1528, 280, 1170, 29892, 317, 4338, 1125, 13, 1678, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 20927, 292, 9859, 6297, 376, 718, 1528, 280, 1170, 718, 376, 363, 376, 718, 14771, 7830, 1204, 718, 376, 373, 6874, 376, 718, 317, 4338, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 13, 1678, 1962, 353, 2897, 29889, 5205, 703, 834, 6297, 12827, 1051, 1192, 465, 4895, 29872, 6571, 1192, 12154, 6571, 1192, 6078, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1405, 6297, 2577, 15289, 29889, 3945, 1642, 4830, 29898, 14771, 7830, 1204, 29892, 376, 5931, 29908, 718, 1528, 280, 1170, 718, 376, 5931, 613, 317, 4338, 876, 29871, 13, 13, 1678, 396, 2392, 11415, 13, 1678, 565, 1962, 2804, 29871, 29900, 29901, 13, 4706, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 4081, 5229, 411, 15668, 1059, 2023, 376, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 4706, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 12148, 337, 29899, 3389, 278, 2471, 1156, 777, 931, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 4706, 10876, 29889, 13322, 580, 13, 13, 1678, 1596, 29898, 29890, 27703, 29889, 8949, 29954, 1525, 1430, 718, 376, 16727, 12827, 411, 6297, 29908, 718, 1528, 280, 1170, 718, 376, 363, 376, 718, 14771, 7830, 1204, 718, 376, 373, 6874, 376, 718, 317, 4338, 718, 376, 6699, 287, 8472, 376, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 13, 1678, 6297, 353, 518, 1220, 7503, 29899, 29896, 29962, 363, 1196, 297, 934, 2080, 29889, 2080, 29898, 5325, 2433, 12154, 2577, 15289, 29889, 3945, 1495, 29962, 13, 13, 1678, 565, 7431, 29898, 12154, 1125, 13, 4706, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 2499, 2040, 9859, 376, 718, 1528, 280, 1170, 718, 376, 6297, 373, 6874, 376, 718, 317, 4338, 718, 376, 304, 376, 718, 14771, 7830, 1204, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 7900, 647, 292, 6297, 376, 718, 1528, 280, 1170, 718, 376, 304, 376, 718, 14771, 7830, 1204, 718, 376, 373, 6874, 376, 718, 317, 4338, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 4706, 1962, 353, 2897, 29889, 5205, 703, 834, 6297, 12827, 1653, 1192, 465, 4895, 29872, 6571, 1192, 12154, 6571, 1192, 6078, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1642, 4830, 29898, 4040, 26706, 1204, 29892, 376, 5931, 29908, 718, 1528, 280, 1170, 718, 376, 5931, 613, 317, 4338, 876, 13, 13, 4706, 565, 1962, 2804, 29871, 29900, 29901, 13, 9651, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 2451, 12624, 1550, 23188, 6297, 29908, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 9651, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 12148, 337, 29899, 3389, 278, 2471, 1156, 777, 931, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 9651, 10876, 29889, 13322, 580, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 7900, 12961, 376, 718, 1528, 280, 1170, 718, 376, 6297, 373, 6874, 376, 718, 317, 4338, 718, 376, 304, 376, 718, 14771, 7830, 1204, 718, 376, 8472, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 13, 1753, 3566, 18415, 1762, 9219, 29879, 29898, 2659, 7900, 12961, 3170, 18415, 1204, 29892, 19181, 29076, 6848, 4782, 29892, 19181, 29076, 8659, 29892, 3323, 22371, 1125, 13, 1678, 2669, 29918, 558, 26706, 29918, 333, 353, 5124, 13, 1678, 5882, 21943, 353, 5159, 13, 13, 1678, 565, 4911, 7900, 12961, 3170, 18415, 1204, 338, 451, 6213, 29901, 795, 13, 4706, 1962, 353, 2897, 29889, 5205, 703, 834, 10110, 1510, 1192, 4841, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1405, 286, 1039, 4040, 26706, 29889, 3945, 1642, 4830, 29898, 2659, 7900, 12961, 3170, 18415, 1204, 876, 13, 13, 4706, 565, 1962, 2804, 29871, 29900, 29901, 13, 9651, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 29954, 5428, 1404, 9859, 10110, 338, 451, 1476, 470, 2471, 5229, 411, 15668, 1059, 2023, 29908, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 9651, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 12148, 337, 29899, 3389, 278, 2471, 1156, 777, 931, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 9651, 10876, 29889, 13322, 580, 13, 13, 4706, 10110, 353, 518, 1220, 7503, 29899, 29896, 29962, 363, 1196, 297, 934, 2080, 29889, 2080, 29898, 5325, 2433, 29885, 1039, 4040, 26706, 29889, 3945, 1495, 29962, 13, 4706, 2669, 29918, 558, 26706, 29918, 333, 353, 10110, 29961, 29900, 1822, 5451, 28909, 29873, 29861, 29945, 29962, 13, 308, 13, 4706, 1596, 29898, 29890, 27703, 29889, 8949, 29954, 1525, 1430, 718, 376, 15156, 1404, 9859, 2669, 10110, 5882, 376, 718, 2669, 29918, 558, 26706, 29918, 333, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 4706, 5882, 21943, 29889, 4397, 29898, 5509, 29918, 558, 26706, 29918, 333, 29897, 13, 13, 4706, 363, 6901, 29076, 1170, 297, 19181, 29076, 8659, 29901, 632, 13, 9651, 10110, 353, 376, 5931, 29908, 718, 4911, 7900, 12961, 3170, 18415, 1204, 718, 376, 5931, 29908, 13, 9651, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 2369, 17961, 1404, 9859, 10110, 373, 6901, 4933, 376, 718, 6901, 29076, 1170, 718, 289, 27703, 29889, 11794, 29907, 29897, 29871, 13, 9651, 1962, 353, 2897, 29889, 5205, 703, 834, 22419, 10110, 3566, 448, 29876, 6571, 448, 29887, 6571, 1192, 1491, 22371, 6571, 1192, 1693, 1907, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1405, 10110, 7900, 647, 29889, 3945, 1642, 4830, 29898, 18714, 29076, 1170, 29892, 19181, 29076, 6848, 4782, 29892, 3323, 22371, 29892, 10110, 876, 13, 632, 13, 9651, 565, 1962, 2804, 29871, 29900, 29901, 13, 18884, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 2154, 5229, 411, 15668, 1059, 2023, 29908, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 18884, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 12148, 337, 29899, 3389, 278, 2471, 1156, 777, 931, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 18884, 10876, 29889, 13322, 580, 13, 13, 9651, 1596, 29898, 29890, 27703, 29889, 8949, 29954, 1525, 1430, 718, 376, 10861, 1404, 9859, 10110, 373, 6901, 4933, 376, 718, 6901, 29076, 1170, 718, 289, 27703, 29889, 11794, 29907, 29897, 29871, 13, 13, 1678, 1683, 29901, 13, 308, 13, 4706, 363, 6901, 29076, 1170, 297, 19181, 29076, 8659, 29901, 13, 13, 9651, 1962, 353, 2897, 29889, 5205, 703, 834, 22419, 10110, 1510, 448, 29876, 6571, 448, 29887, 6571, 1192, 1491, 22371, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1405, 10110, 8964, 29889, 3945, 1642, 4830, 29898, 18714, 29076, 1170, 29892, 19181, 29076, 6848, 4782, 29892, 3323, 22371, 876, 13, 13, 9651, 10110, 353, 518, 1220, 7503, 29899, 29896, 29962, 363, 1196, 297, 934, 2080, 29889, 2080, 29898, 5325, 2433, 22350, 8964, 29889, 3945, 1495, 29962, 13, 13, 9651, 565, 7431, 29898, 22350, 29897, 1275, 29871, 29900, 470, 376, 5205, 465, 12961, 29908, 451, 297, 10110, 29961, 29900, 1822, 13609, 7295, 13, 18884, 1596, 29898, 29890, 27703, 29889, 8949, 13367, 4462, 718, 376, 2369, 17961, 1788, 9859, 10110, 373, 6901, 4933, 376, 718, 6901, 29076, 1170, 718, 289, 27703, 29889, 11794, 29907, 29897, 29871, 13, 13, 18884, 1962, 353, 2897, 29889, 5205, 703, 834, 22419, 10110, 3566, 448, 29876, 6571, 448, 29887, 6571, 1192, 1491, 22371, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1405, 10110, 7900, 647, 29889, 3945, 1642, 4830, 29898, 18714, 29076, 1170, 29892, 19181, 29076, 6848, 4782, 29892, 3323, 22371, 876, 13, 13, 18884, 565, 1962, 2804, 29871, 29900, 29901, 13, 462, 1678, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 4081, 5229, 411, 15668, 1059, 1550, 23188, 11400, 10110, 2023, 29908, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 462, 1678, 1596, 29898, 29890, 27703, 29889, 4519, 6227, 718, 376, 12148, 337, 29899, 3389, 278, 2471, 1156, 777, 931, 1213, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 462, 1678, 10876, 29889, 13322, 580, 13, 13, 18884, 1596, 29898, 29890, 27703, 29889, 8949, 29954, 1525, 1430, 718, 376, 14191, 3730, 9859, 1788, 10110, 304, 11400, 376, 718, 6901, 29076, 1170, 718, 289, 27703, 29889, 11794, 29907, 29897, 13, 18884, 931, 29889, 17059, 29898, 29896, 29900, 29897, 13, 462, 13, 18884, 1962, 353, 2897, 29889, 5205, 703, 834, 22419, 10110, 1510, 448, 29876, 6571, 448, 29887, 6571, 1192, 1491, 22371, 6571, 448, 29877, 260, 4501, 1192, 6194, 29899, 4294, 29899, 12523, 1405, 10110, 8964, 29889, 3945, 1642, 4830, 29898, 18714, 29076, 1170, 29892, 19181, 29076, 6848, 4782, 29892, 3323, 22371, 876, 29871, 13, 9651, 1683, 29901, 13, 18884, 1596, 29898, 29890, 27703, 29889, 8949, 29954, 1525, 1430, 718, 376, 3924, 9859, 10110, 2307, 9615, 373, 6901, 4933, 376, 718, 6901, 29076, 1170, 718, 289, 27703, 29889, 11794, 29907, 29897, 29871, 13, 632, 13, 9651, 10110, 353, 518, 1220, 7503, 29899, 29896, 29962, 363, 1196, 297, 934, 2080, 29889, 2080, 29898, 5325, 2433, 22350, 8964, 29889, 3945, 1495, 29962, 13, 9651, 2669, 29918, 558, 26706, 29918, 333, 353, 10110, 29961, 29900, 1822, 5451, 14182, 29873, 1159, 29961, 29900, 29962, 396, 313, 22350, 29961, 29896, 1822, 5451, 877, 29908, 8785, 29961, 29941, 29962, 13, 13, 9651, 396, 3198, 448, 788, 304, 278, 5882, 21943, 1051, 29871, 13, 9651, 5882, 21943, 29889, 4397, 29898, 5509, 29918, 558, 26706, 29918, 333, 29897, 13, 1678, 736, 5882, 21943, 13, 13, 1990, 289, 27703, 29901, 13, 1678, 17714, 3035, 1001, 353, 11297, 29900, 29941, 29941, 29961, 29929, 29945, 29885, 29915, 13, 1678, 9280, 13367, 4462, 353, 11297, 29900, 29941, 29941, 29961, 29929, 29946, 29885, 29915, 13, 1678, 9280, 29907, 29979, 2190, 353, 11297, 29900, 29941, 29941, 29961, 29929, 29953, 29885, 29915, 13, 1678, 9280, 29954, 1525, 1430, 353, 11297, 29900, 29941, 29941, 29961, 29929, 29906, 29885, 29915, 13, 1678, 399, 25614, 353, 11297, 29900, 29941, 29941, 29961, 29929, 29941, 29885, 29915, 13, 1678, 13515, 6227, 353, 11297, 29900, 29941, 29941, 29961, 29929, 29896, 29885, 29915, 13, 1678, 11056, 29907, 353, 11297, 29900, 29941, 29941, 29961, 29900, 29885, 29915, 13, 1678, 350, 5607, 29928, 353, 11297, 29900, 29941, 29941, 29961, 29896, 29885, 29915, 13, 1678, 501, 2797, 1001, 18521, 353, 11297, 29900, 29941, 29941, 29961, 29946, 29885, 29915, 2 ]
gamelib/pyglet/app/__init__.py
luciotorre/aiamsori
1
70374
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 <NAME> # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # * Neither the name of pyglet nor the names of its # contributors may be used to endorse or promote products # derived from this software without specific prior written # permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # ---------------------------------------------------------------------------- '''Application-wide functionality. Most applications need only call `run` after creating one or more windows to begin processing events. For example, a simple application consisting of one window is:: from pyglet import app from pyglet import window win = window.Window() app.run() To handle events on the main event loop, instantiate it manually. The following example exits the application as soon as any window is closed (the default policy is to wait until all windows are closed):: event_loop = app.EventLoop() @event_loop.event def on_window_close(window): event_loop.exit() :since: pyglet 1.1 ''' __docformat__ = 'restructuredtext' __version__ = '$Id: __init__.py 2140 2008-07-27 04:15:52Z Alex.Holkner $' import sys import weakref from pyglet import clock from pyglet import event _is_epydoc = hasattr(sys, 'is_epydoc') and sys.is_epydoc class WeakSet(object): '''Set of objects, referenced weakly. Adding an object to this set does not prevent it from being garbage collected. Upon being garbage collected, the object is automatically removed from the set. ''' def __init__(self): self._dict = weakref.WeakKeyDictionary() def add(self, value): self._dict[value] = True def remove(self, value): del self._dict[value] def __iter__(self): for key in self._dict.keys(): yield key def __contains__(self, other): return other in self._dict def __len__(self): return len(self._dict) #: Set of all open displays. Instances of `Display` are automatically added #: to this set upon construction. The set uses weak references, so displays #: are removed from the set when they are no longer referenced. #: #: :type: `WeakSet` displays = WeakSet() #: Set of all open windows (including invisible windows). Instances of #: `Window` are automatically added to this set upon construction. The set #: uses weak references, so windows are removed from the set when they are no #: longer referenced or are closed explicitly. #: #: :type: `WeakSet` windows = WeakSet() class BaseEventLoop(event.EventDispatcher): '''The main run loop of the application. Calling `run` begins the application event loop, which processes operating system events, calls `pyglet.clock.tick` to call scheduled functions and calls `pyglet.window.Window.on_draw` and `pyglet.window.Window.flip` to update window contents. Applications can subclass `EventLoop` and override certain methods to integrate another framework's run loop, or to customise processing in some other way. You should not in general override `run`, as this method contains platform-specific code that ensures the application remains responsive to the user while keeping CPU usage to a minimum. ''' #: Flag indicating if the event loop will exit in the next iteration. #: This is has_exit = False def run(self): '''Begin processing events, scheduled functions and window updates. This method returns when `has_exit` is set to True. Developers are discouraged from overriding this method, as the implementation is platform-specific. ''' raise NotImplementedError('abstract') def _setup(self): global event_loop event_loop = self # Disable event queuing for dispatch_events from pyglet.window import Window Window._enable_event_queue = False # Dispatch pending events for window in windows: window.switch_to() window.dispatch_pending_events() def _idle_chance(self): '''If timeout has expired, manually force an idle loop. Called by window that have blocked the event loop (e.g. during resizing). ''' def idle(self): '''Called during each iteration of the event loop. The method is called immediately after any window events (i.e., after any user input). The method can return a duration after which the idle method will be called again. The method may be called earlier if the user creates more input events. The method can return `None` to only wait for user events. For example, return ``1.0`` to have the idle method called every second, or immediately after any user events. The default implementation dispatches the `pyglet.window.Window.on_draw` event for all windows and uses `pyglet.clock.tick` and `pyglet.clock.get_sleep_time` on the default clock to determine the return value. This method should be overridden by advanced users only. To have code execute at regular intervals, use the `pyglet.clock.schedule` methods. :rtype: float :return: The number of seconds before the idle method should be called again, or `None` to block for user input. ''' dt = clock.tick(True) # Redraw all windows for window in windows: if window.invalid: window.switch_to() window.dispatch_event('on_draw') window.flip() # Update timout return clock.get_sleep_time(True) def exit(self): '''Safely exit the event loop at the end of the current iteration. This method is convenience for setting `has_exit` to ``True``. ''' self.has_exit = True def on_window_close(self, window): '''Default window close handler.''' if not windows: self.exit() if _is_epydoc: def on_window_close(window): '''A window was closed. This event is dispatched when a window is closed. It is not dispatched if the window's close button was pressed but the window did not close. The default handler calls `exit` if no more windows are open. You can override this handler to base your application exit on some other policy. :event: ''' def on_enter(): '''The event loop is about to begin. This is dispatched when the event loop is prepared to enter the main run loop, and represents the last chance for an application to initialise itself. :event: ''' def on_exit(): '''The event loop is about to exit. After dispatching this event, the `run` method returns (the application may not actually exit if you have more code following the `run` invocation). :event: ''' BaseEventLoop.register_event_type('on_window_close') BaseEventLoop.register_event_type('on_enter') BaseEventLoop.register_event_type('on_exit') #: The global event loop. Set to the correct instance when an `EventLoop` is #: started. #: #: :type: `EventLoop` event_loop = None def run(): '''Begin processing events, scheduled functions and window updates. This is a convenience function, equivalent to:: EventLoop().run() ''' EventLoop().run() def exit(): '''Exit the application event loop. Causes the application event loop to finish, if an event loop is currently running. The application may not necessarily exit (for example, there may be additional code following the `run` invocation). This is a convenience function, equivalent to:: event_loop.exit() ''' if event_loop: event_loop.exit() if _is_epydoc: EventLoop = BaseEventLoop EventLoop.__name__ = 'EventLoop' del BaseEventLoop else: # Permit cyclic import. import pyglet pyglet.app = sys.modules[__name__] if sys.platform == 'darwin': from pyglet.app.carbon import CarbonEventLoop as EventLoop elif sys.platform in ('win32', 'cygwin'): from pyglet.app.win32 import Win32EventLoop as EventLoop else: from pyglet.app.xlib import XlibEventLoop as EventLoop
[ 1, 396, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 29937, 19484, 1026, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29900, 29953, 29899, 29906, 29900, 29900, 29947, 529, 5813, 29958, 13, 29937, 2178, 10462, 21676, 29889, 13, 29937, 29871, 13, 29937, 4367, 391, 3224, 322, 671, 297, 2752, 322, 7581, 7190, 29892, 411, 470, 1728, 13, 29937, 21733, 29892, 526, 21905, 4944, 393, 278, 1494, 5855, 29871, 13, 29937, 526, 1539, 29901, 13, 29937, 13, 29937, 29871, 334, 4367, 391, 3224, 29879, 310, 2752, 775, 1818, 11551, 278, 2038, 3509, 1266, 13, 29937, 1678, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 29889, 13, 29937, 29871, 334, 4367, 391, 3224, 29879, 297, 7581, 883, 1818, 18532, 278, 2038, 3509, 1266, 29871, 13, 29937, 1678, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 297, 13, 29937, 1678, 278, 5106, 322, 29914, 272, 916, 17279, 4944, 411, 278, 13, 29937, 1678, 4978, 29889, 13, 29937, 29871, 334, 2448, 2121, 278, 1024, 310, 19484, 1026, 3643, 278, 2983, 310, 967, 13, 29937, 1678, 17737, 29560, 1122, 367, 1304, 304, 1095, 272, 344, 470, 27391, 9316, 13, 29937, 1678, 10723, 515, 445, 7047, 1728, 2702, 7536, 3971, 13, 29937, 1678, 10751, 29889, 13, 29937, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6770, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 5300, 8707, 29911, 3960, 29933, 2692, 24125, 13, 29937, 376, 3289, 8519, 29908, 5300, 13764, 29979, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 29892, 2672, 6154, 15789, 4214, 29892, 350, 2692, 6058, 13, 29937, 27848, 3352, 7495, 29892, 6093, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 5300, 383, 1806, 8186, 1799, 13, 29937, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 319, 1525, 28657, 13875, 8890, 29928, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 13, 29937, 315, 4590, 29979, 22789, 3912, 438, 29956, 13865, 6323, 8707, 29911, 3960, 29933, 2692, 24125, 20700, 17705, 6181, 15842, 13764, 29979, 22471, 26282, 29892, 2672, 4571, 26282, 29892, 13, 29937, 2672, 29907, 1367, 3919, 1964, 29892, 317, 4162, 8426, 1964, 29892, 8528, 29923, 3580, 29931, 19926, 29892, 6323, 8707, 1660, 13356, 3919, 25758, 21330, 1529, 1692, 29903, 313, 1177, 6154, 15789, 4214, 29892, 13, 29937, 350, 2692, 6058, 27848, 3352, 7495, 29892, 13756, 29907, 11499, 13780, 8079, 27092, 1254, 1806, 26027, 21947, 29949, 8452, 6323, 26996, 29963, 2965, 2890, 29936, 13, 29937, 11247, 1799, 8079, 501, 1660, 29892, 360, 8254, 29892, 6323, 13756, 29943, 1806, 29903, 29936, 6323, 350, 3308, 8895, 1799, 2672, 4945, 29934, 4897, 29911, 2725, 29897, 29832, 8851, 5348, 13, 29937, 12766, 17171, 29928, 5300, 6732, 13764, 29979, 6093, 18929, 8079, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 8707, 29911, 4717, 1783, 29892, 6850, 3960, 1783, 13, 29937, 17705, 2882, 6227, 11937, 29892, 6323, 323, 8476, 313, 1177, 6154, 15789, 4214, 405, 11787, 5265, 24647, 4741, 6323, 438, 29911, 4448, 22119, 1660, 29897, 9033, 3235, 4214, 2672, 13, 29937, 13764, 29979, 399, 29909, 29979, 19474, 8079, 6093, 501, 1660, 8079, 3446, 3235, 7791, 7818, 12982, 1525, 29892, 382, 29963, 1430, 10762, 11033, 18118, 1660, 29928, 8079, 6093, 13, 29937, 21521, 1799, 8979, 6227, 11937, 8079, 20134, 3210, 21330, 1529, 1692, 29889, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 13, 12008, 4873, 29899, 8157, 9863, 29889, 13, 13, 29924, 520, 8324, 817, 871, 1246, 421, 3389, 29952, 1156, 4969, 697, 470, 901, 5417, 13, 517, 3380, 9068, 4959, 29889, 29871, 1152, 1342, 29892, 263, 2560, 2280, 19849, 310, 13, 650, 3474, 338, 1057, 13, 13, 1678, 515, 19484, 1026, 1053, 623, 13, 1678, 515, 19484, 1026, 1053, 3474, 13, 13, 1678, 5401, 353, 3474, 29889, 5907, 580, 13, 1678, 623, 29889, 3389, 580, 13, 13, 1762, 4386, 4959, 373, 278, 1667, 1741, 2425, 29892, 25112, 372, 7522, 29889, 29871, 450, 13, 23031, 292, 1342, 429, 1169, 278, 2280, 408, 4720, 408, 738, 3474, 338, 5764, 313, 1552, 13, 4381, 8898, 338, 304, 4480, 2745, 599, 5417, 526, 5764, 29897, 1057, 13, 13, 1678, 1741, 29918, 7888, 353, 623, 29889, 2624, 18405, 580, 13, 13, 1678, 732, 3696, 29918, 7888, 29889, 3696, 13, 1678, 822, 373, 29918, 7165, 29918, 5358, 29898, 7165, 1125, 13, 4706, 1741, 29918, 7888, 29889, 13322, 580, 13, 13, 29901, 16076, 29901, 19484, 1026, 29871, 29896, 29889, 29896, 13, 12008, 13, 13, 1649, 1514, 4830, 1649, 353, 525, 5060, 1247, 2955, 726, 29915, 13, 1649, 3259, 1649, 353, 14180, 1204, 29901, 4770, 2344, 26914, 2272, 29871, 29906, 29896, 29946, 29900, 29871, 29906, 29900, 29900, 29947, 29899, 29900, 29955, 29899, 29906, 29955, 29871, 29900, 29946, 29901, 29896, 29945, 29901, 29945, 29906, 29999, 4827, 29889, 19984, 29895, 1089, 395, 29915, 13, 13, 5215, 10876, 13, 5215, 8062, 999, 13, 13, 3166, 19484, 1026, 1053, 12006, 13, 3166, 19484, 1026, 1053, 1741, 13, 13, 29918, 275, 29918, 1022, 29891, 1514, 353, 756, 5552, 29898, 9675, 29892, 525, 275, 29918, 1022, 29891, 1514, 1495, 322, 10876, 29889, 275, 29918, 1022, 29891, 1514, 13, 13, 1990, 1334, 557, 2697, 29898, 3318, 1125, 13, 1678, 14550, 2697, 310, 3618, 29892, 16180, 8062, 368, 29889, 13, 13, 1678, 18804, 385, 1203, 304, 445, 731, 947, 451, 5557, 372, 515, 1641, 25861, 13, 1678, 16531, 29889, 29871, 19956, 1641, 25861, 16531, 29892, 278, 1203, 338, 6336, 13, 1678, 6206, 515, 278, 731, 29889, 13, 1678, 14550, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 3032, 8977, 353, 8062, 999, 29889, 4806, 557, 2558, 11513, 580, 13, 13, 1678, 822, 788, 29898, 1311, 29892, 995, 1125, 13, 4706, 1583, 3032, 8977, 29961, 1767, 29962, 353, 5852, 13, 13, 1678, 822, 3349, 29898, 1311, 29892, 995, 1125, 13, 4706, 628, 1583, 3032, 8977, 29961, 1767, 29962, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 363, 1820, 297, 1583, 3032, 8977, 29889, 8149, 7295, 13, 9651, 7709, 1820, 13, 13, 1678, 822, 4770, 11516, 12035, 1311, 29892, 916, 1125, 13, 4706, 736, 916, 297, 1583, 3032, 8977, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 3032, 8977, 29897, 13, 13, 29937, 29901, 3789, 310, 599, 1722, 14423, 29889, 29871, 2799, 2925, 310, 421, 9323, 29952, 526, 6336, 2715, 13, 29937, 29901, 304, 445, 731, 2501, 7632, 29889, 29871, 450, 731, 3913, 8062, 9282, 29892, 577, 14423, 13, 29937, 29901, 526, 6206, 515, 278, 731, 746, 896, 526, 694, 5520, 16180, 29889, 13, 29937, 29901, 13, 29937, 29901, 584, 1853, 29901, 421, 4806, 557, 2697, 29952, 13, 2218, 12922, 353, 1334, 557, 2697, 580, 13, 13, 29937, 29901, 3789, 310, 599, 1722, 5417, 313, 18271, 27597, 5417, 467, 29871, 2799, 2925, 310, 13, 29937, 29901, 421, 5907, 29952, 526, 6336, 2715, 304, 445, 731, 2501, 7632, 29889, 29871, 450, 731, 13, 29937, 29901, 3913, 8062, 9282, 29892, 577, 5417, 526, 6206, 515, 278, 731, 746, 896, 526, 694, 13, 29937, 29901, 5520, 16180, 470, 526, 5764, 9479, 29889, 13, 29937, 29901, 13, 29937, 29901, 584, 1853, 29901, 421, 4806, 557, 2697, 29952, 13, 10499, 353, 1334, 557, 2697, 580, 13, 13, 13, 1990, 7399, 2624, 18405, 29898, 3696, 29889, 2624, 23669, 1125, 13, 1678, 14550, 1576, 1667, 1065, 2425, 310, 278, 2280, 29889, 13, 13, 1678, 8251, 292, 421, 3389, 29952, 16410, 278, 2280, 1741, 2425, 29892, 607, 10174, 13, 1678, 13598, 1788, 4959, 29892, 5717, 421, 2272, 29887, 1026, 29889, 13058, 29889, 24667, 29952, 304, 1246, 21467, 13, 1678, 3168, 322, 5717, 421, 2272, 29887, 1026, 29889, 7165, 29889, 5907, 29889, 265, 29918, 4012, 29952, 322, 13, 1678, 421, 2272, 29887, 1026, 29889, 7165, 29889, 5907, 29889, 29888, 3466, 29952, 304, 2767, 3474, 8118, 29889, 13, 13, 1678, 2401, 5795, 508, 19481, 421, 2624, 18405, 29952, 322, 5712, 3058, 3519, 13, 1678, 304, 22782, 1790, 6890, 29915, 29879, 1065, 2425, 29892, 470, 304, 2888, 895, 9068, 13, 1678, 297, 777, 916, 982, 29889, 29871, 887, 881, 451, 297, 2498, 5712, 421, 3389, 1673, 408, 13, 1678, 445, 1158, 3743, 7481, 29899, 14940, 775, 393, 5662, 1973, 278, 2280, 13, 1678, 9242, 5544, 573, 304, 278, 1404, 1550, 12515, 10808, 8744, 304, 263, 9212, 29889, 13, 1678, 14550, 13, 13, 1678, 396, 29901, 28697, 23941, 565, 278, 1741, 2425, 674, 6876, 297, 278, 2446, 12541, 29889, 13, 1678, 396, 29901, 910, 338, 13, 1678, 756, 29918, 13322, 353, 7700, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 14550, 17946, 9068, 4959, 29892, 21467, 3168, 322, 3474, 11217, 29889, 13, 13, 4706, 910, 1158, 3639, 746, 421, 5349, 29918, 13322, 29952, 338, 731, 304, 5852, 29889, 13, 13, 4706, 10682, 414, 526, 2313, 283, 1431, 287, 515, 20831, 292, 445, 1158, 29892, 408, 278, 13, 4706, 5314, 338, 7481, 29899, 14940, 29889, 13, 4706, 14550, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 877, 16595, 1495, 13, 13, 1678, 822, 903, 14669, 29898, 1311, 1125, 13, 4706, 5534, 1741, 29918, 7888, 13, 4706, 1741, 29918, 7888, 353, 1583, 13, 13, 4706, 396, 3295, 519, 1741, 712, 26420, 363, 13916, 29918, 13604, 13, 4706, 515, 19484, 1026, 29889, 7165, 1053, 18379, 13, 4706, 18379, 3032, 12007, 29918, 3696, 29918, 9990, 353, 7700, 13, 308, 13, 4706, 396, 3295, 5041, 28235, 4959, 13, 4706, 363, 3474, 297, 5417, 29901, 13, 9651, 3474, 29889, 15123, 29918, 517, 580, 13, 9651, 3474, 29889, 13369, 29918, 29886, 2548, 29918, 13604, 580, 13, 13, 1678, 822, 903, 333, 280, 29918, 305, 749, 29898, 1311, 1125, 13, 4706, 14550, 3644, 11815, 756, 1518, 2859, 29892, 7522, 4889, 385, 28132, 2425, 29889, 13, 13, 4706, 3037, 839, 491, 3474, 393, 505, 24370, 278, 1741, 2425, 313, 29872, 29889, 29887, 29889, 2645, 13, 4706, 620, 5281, 467, 13, 4706, 14550, 13, 13, 1678, 822, 28132, 29898, 1311, 1125, 13, 4706, 14550, 29907, 4212, 2645, 1269, 12541, 310, 278, 1741, 2425, 29889, 13, 13, 4706, 450, 1158, 338, 2000, 7389, 1156, 738, 3474, 4959, 313, 29875, 29889, 29872, 1696, 1156, 13, 4706, 738, 1404, 1881, 467, 29871, 450, 1158, 508, 736, 263, 14385, 1156, 607, 13, 4706, 278, 28132, 1158, 674, 367, 2000, 1449, 29889, 29871, 450, 1158, 1122, 367, 2000, 13, 4706, 8859, 565, 278, 1404, 10017, 901, 1881, 4959, 29889, 29871, 450, 1158, 13, 4706, 508, 736, 421, 8516, 29952, 304, 871, 4480, 363, 1404, 4959, 29889, 13, 13, 4706, 1152, 1342, 29892, 736, 4954, 29896, 29889, 29900, 16159, 304, 505, 278, 28132, 1158, 2000, 1432, 13, 4706, 1473, 29892, 470, 7389, 1156, 738, 1404, 4959, 29889, 13, 13, 4706, 450, 2322, 5314, 13916, 267, 278, 13, 4706, 421, 2272, 29887, 1026, 29889, 7165, 29889, 5907, 29889, 265, 29918, 4012, 29952, 1741, 363, 599, 5417, 322, 3913, 13, 4706, 421, 2272, 29887, 1026, 29889, 13058, 29889, 24667, 29952, 322, 421, 2272, 29887, 1026, 29889, 13058, 29889, 657, 29918, 17059, 29918, 2230, 29952, 373, 278, 2322, 13, 4706, 12006, 304, 8161, 278, 736, 995, 29889, 13, 13, 4706, 910, 1158, 881, 367, 20831, 1145, 491, 12862, 4160, 871, 29889, 29871, 1763, 505, 13, 4706, 775, 6222, 472, 4943, 18747, 29892, 671, 278, 13, 4706, 421, 2272, 29887, 1026, 29889, 13058, 29889, 816, 11272, 29952, 3519, 29889, 13, 13, 4706, 584, 29878, 1853, 29901, 5785, 13, 4706, 584, 2457, 29901, 450, 1353, 310, 6923, 1434, 278, 28132, 1158, 881, 13, 9651, 367, 2000, 1449, 29892, 470, 421, 8516, 29952, 304, 2908, 363, 1404, 1881, 29889, 13, 4706, 14550, 13, 4706, 11636, 353, 12006, 29889, 24667, 29898, 5574, 29897, 13, 13, 4706, 396, 4367, 1610, 599, 5417, 13, 4706, 363, 3474, 297, 5417, 29901, 13, 9651, 565, 3474, 29889, 20965, 29901, 13, 18884, 3474, 29889, 15123, 29918, 517, 580, 13, 18884, 3474, 29889, 13369, 29918, 3696, 877, 265, 29918, 4012, 1495, 13, 18884, 3474, 29889, 29888, 3466, 580, 13, 13, 4706, 396, 10318, 5335, 449, 13, 4706, 736, 12006, 29889, 657, 29918, 17059, 29918, 2230, 29898, 5574, 29897, 13, 13, 1678, 822, 6876, 29898, 1311, 1125, 13, 4706, 14550, 29903, 2142, 873, 6876, 278, 1741, 2425, 472, 278, 1095, 310, 278, 1857, 12541, 29889, 13, 13, 4706, 910, 1158, 338, 29703, 363, 4444, 421, 5349, 29918, 13322, 29952, 304, 4954, 5574, 29952, 1412, 13, 4706, 14550, 13, 4706, 1583, 29889, 5349, 29918, 13322, 353, 5852, 13, 13, 1678, 822, 373, 29918, 7165, 29918, 5358, 29898, 1311, 29892, 3474, 1125, 13, 4706, 14550, 4592, 3474, 3802, 7834, 29889, 12008, 13, 4706, 565, 451, 5417, 29901, 13, 9651, 1583, 29889, 13322, 580, 13, 13, 1678, 565, 903, 275, 29918, 1022, 29891, 1514, 29901, 13, 4706, 822, 373, 29918, 7165, 29918, 5358, 29898, 7165, 1125, 13, 9651, 14550, 29909, 3474, 471, 5764, 29889, 13, 13, 9651, 910, 1741, 338, 13916, 287, 746, 263, 3474, 338, 5764, 29889, 29871, 739, 338, 451, 13, 9651, 13916, 287, 565, 278, 3474, 29915, 29879, 3802, 2826, 471, 15385, 541, 278, 13, 9651, 3474, 1258, 451, 3802, 29889, 13, 13, 9651, 450, 2322, 7834, 5717, 421, 13322, 29952, 565, 694, 901, 5417, 526, 1722, 29889, 29871, 887, 13, 9651, 508, 5712, 445, 7834, 304, 2967, 596, 2280, 6876, 373, 777, 13, 9651, 916, 8898, 29889, 13, 13, 9651, 584, 3696, 29901, 13, 9651, 14550, 13, 13, 4706, 822, 373, 29918, 5893, 7295, 13, 9651, 14550, 1576, 1741, 2425, 338, 1048, 304, 3380, 29889, 13, 13, 9651, 910, 338, 13916, 287, 746, 278, 1741, 2425, 338, 13240, 304, 3896, 13, 9651, 278, 1667, 1065, 2425, 29892, 322, 11524, 278, 1833, 8825, 363, 385, 29871, 13, 9651, 2280, 304, 2847, 895, 3528, 29889, 13, 13, 9651, 584, 3696, 29901, 13, 9651, 14550, 13, 13, 4706, 822, 373, 29918, 13322, 7295, 13, 9651, 14550, 1576, 1741, 2425, 338, 1048, 304, 6876, 29889, 13, 13, 9651, 2860, 13916, 292, 445, 1741, 29892, 278, 421, 3389, 29952, 1158, 3639, 313, 1552, 13, 9651, 2280, 1122, 451, 2869, 6876, 565, 366, 505, 901, 775, 13, 9651, 1494, 278, 421, 3389, 29952, 2437, 10610, 467, 13, 13, 9651, 584, 3696, 29901, 13, 9651, 14550, 13, 13, 5160, 2624, 18405, 29889, 9573, 29918, 3696, 29918, 1853, 877, 265, 29918, 7165, 29918, 5358, 1495, 13, 5160, 2624, 18405, 29889, 9573, 29918, 3696, 29918, 1853, 877, 265, 29918, 5893, 1495, 13, 5160, 2624, 18405, 29889, 9573, 29918, 3696, 29918, 1853, 877, 265, 29918, 13322, 1495, 13, 13, 29937, 29901, 450, 5534, 1741, 2425, 29889, 29871, 3789, 304, 278, 1959, 2777, 746, 385, 421, 2624, 18405, 29952, 338, 13, 29937, 29901, 4687, 29889, 13, 29937, 29901, 13, 29937, 29901, 584, 1853, 29901, 421, 2624, 18405, 29952, 13, 3696, 29918, 7888, 353, 6213, 13, 13, 1753, 1065, 7295, 13, 1678, 14550, 17946, 9068, 4959, 29892, 21467, 3168, 322, 3474, 11217, 29889, 13, 13, 1678, 910, 338, 263, 29703, 740, 29892, 7126, 304, 1057, 13, 13, 4706, 6864, 18405, 2141, 3389, 580, 13, 13, 1678, 14550, 13, 1678, 6864, 18405, 2141, 3389, 580, 13, 13, 1753, 6876, 7295, 13, 1678, 14550, 24365, 278, 2280, 1741, 2425, 29889, 13, 13, 1678, 315, 1485, 267, 278, 2280, 1741, 2425, 304, 8341, 29892, 565, 385, 1741, 2425, 338, 5279, 13, 1678, 2734, 29889, 29871, 450, 2280, 1122, 451, 12695, 6876, 313, 1454, 1342, 29892, 727, 1122, 13, 1678, 367, 5684, 775, 1494, 278, 421, 3389, 29952, 2437, 10610, 467, 13, 13, 1678, 910, 338, 263, 29703, 740, 29892, 7126, 304, 1057, 13, 13, 4706, 1741, 29918, 7888, 29889, 13322, 580, 13, 13, 1678, 14550, 13, 1678, 565, 1741, 29918, 7888, 29901, 13, 4706, 1741, 29918, 7888, 29889, 13322, 580, 13, 13, 361, 903, 275, 29918, 1022, 29891, 1514, 29901, 13, 1678, 6864, 18405, 353, 7399, 2624, 18405, 13, 1678, 6864, 18405, 17255, 978, 1649, 353, 525, 2624, 18405, 29915, 13, 1678, 628, 7399, 2624, 18405, 13, 2870, 29901, 13, 1678, 396, 20894, 277, 5094, 28746, 1053, 29889, 13, 1678, 1053, 19484, 1026, 13, 1678, 19484, 1026, 29889, 932, 353, 10876, 29889, 7576, 29961, 1649, 978, 1649, 29962, 13, 13, 1678, 565, 10876, 29889, 12120, 1275, 525, 16702, 5080, 2396, 13, 4706, 515, 19484, 1026, 29889, 932, 29889, 4287, 6718, 1053, 1704, 6718, 2624, 18405, 408, 6864, 18405, 13, 1678, 25342, 10876, 29889, 12120, 297, 6702, 5080, 29941, 29906, 742, 525, 1270, 29887, 5080, 29374, 13, 4706, 515, 19484, 1026, 29889, 932, 29889, 5080, 29941, 29906, 1053, 8892, 29941, 29906, 2624, 18405, 408, 6864, 18405, 13, 1678, 1683, 29901, 13, 4706, 515, 19484, 1026, 29889, 932, 29889, 29916, 1982, 1053, 1060, 1982, 2624, 18405, 408, 6864, 18405, 13, 13, 13, 2 ]
tests/test_your_app.py
MQSchleich/continuous-template
0
1604587
import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) def test_test(): print("Yeah")
[ 1, 1053, 2897, 13, 5215, 10876, 13, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 376, 636, 29908, 4961, 13, 13, 13, 1753, 1243, 29918, 1688, 7295, 13, 1678, 1596, 703, 29979, 29872, 801, 1159, 13, 2 ]
python/helpers/pycharm_matplotlib_backend/backend_interagg.py
truthiswill/intellij-community
0
196514
<reponame>truthiswill/intellij-community import base64 import matplotlib import os from typing import Dict, Tuple from matplotlib._pylab_helpers import Gcf from matplotlib.backend_bases import FigureManagerBase, ShowBase from matplotlib.backends.backend_agg import FigureCanvasAgg from matplotlib.figure import Figure from datalore.display import display index = int(os.getenv("PYCHARM_MATPLOTLIB_INDEX", 0)) rcParams = matplotlib.rcParams class Show(ShowBase): def __call__(self, **kwargs): managers = Gcf.get_all_fig_managers() if not managers: return for manager in managers: manager.show(**kwargs) def mainloop(self): pass show = Show() # from pyplot API def draw_if_interactive(): if matplotlib.is_interactive(): figManager = Gcf.get_active() if figManager is not None: figManager.canvas.show() # from pyplot API def new_figure_manager(num, *args, **kwargs): FigureClass = kwargs.pop('FigureClass', Figure) figure = FigureClass(*args, **kwargs) return new_figure_manager_given_figure(num, figure) # from pyplot API def new_figure_manager_given_figure(num, figure): canvas = FigureCanvasInterAgg(figure) manager = FigureManagerInterAgg(canvas, num) return manager # from pyplot API class FigureCanvasInterAgg(FigureCanvasAgg): def __init__(self, figure): FigureCanvasAgg.__init__(self, figure) def show(self): self.figure.tight_layout() FigureCanvasAgg.draw(self) if matplotlib.__version__ < '1.2': buffer = self.tostring_rgb(0, 0) else: buffer = self.tostring_rgb() if len(set(buffer)) <= 1: # do not plot empty return render = self.get_renderer() width = int(render.width) plot_index = index if os.getenv("PYCHARM_MATPLOTLIB_INTERACTIVE", False) else -1 display(DisplayDataObject(plot_index, width, buffer)) def draw(self): is_interactive = os.getenv("PYCHARM_MATPLOTLIB_INTERACTIVE", False) if is_interactive and matplotlib.is_interactive(): self.show() class FigureManagerInterAgg(FigureManagerBase): def __init__(self, canvas, num): FigureManagerBase.__init__(self, canvas, num) global index index += 1 self.canvas = canvas self._num = num self._shown = False def show(self, **kwargs): self.canvas.show() Gcf.destroy(self._num) class DisplayDataObject: def __init__(self, plot_index, width, image_bytes): self.plot_index = plot_index self.image_width = width self.image_bytes = image_bytes def _repr_display_(self) -> Tuple[str, Dict]: image_bytes_base64 = base64.b64encode(self.image_bytes) body = { 'plot_index': self.plot_index, 'image_width': self.image_width, 'image_base64': image_bytes_base64.decode() } return ('pycharm-plot-image', body)
[ 1, 529, 276, 1112, 420, 29958, 509, 2806, 275, 14043, 29914, 28820, 29899, 23834, 13, 5215, 2967, 29953, 29946, 13, 5215, 22889, 13, 5215, 2897, 13, 13, 3166, 19229, 1053, 360, 919, 29892, 12603, 552, 13, 13, 3166, 22889, 3032, 2272, 8205, 29918, 3952, 6774, 1053, 402, 6854, 13, 3166, 22889, 29889, 27852, 29918, 29890, 2129, 1053, 11479, 3260, 5160, 29892, 7704, 5160, 13, 3166, 22889, 29889, 1627, 1975, 29889, 27852, 29918, 16170, 1053, 11479, 21960, 29909, 1505, 13, 3166, 22889, 29889, 4532, 1053, 11479, 13, 13, 3166, 1418, 284, 487, 29889, 4990, 1053, 2479, 13, 13, 2248, 353, 938, 29898, 359, 29889, 657, 6272, 703, 20055, 11282, 29924, 29918, 29924, 1299, 7390, 2891, 5265, 29933, 29918, 27992, 613, 29871, 29900, 876, 13, 13, 2214, 9629, 353, 22889, 29889, 2214, 9629, 13, 13, 13, 1990, 7704, 29898, 8964, 5160, 1125, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 767, 18150, 353, 402, 6854, 29889, 657, 29918, 497, 29918, 1003, 29918, 1171, 18150, 580, 13, 4706, 565, 451, 767, 18150, 29901, 13, 9651, 736, 13, 13, 4706, 363, 8455, 297, 767, 18150, 29901, 13, 9651, 8455, 29889, 4294, 29898, 1068, 19290, 29897, 13, 13, 1678, 822, 1667, 7888, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 13, 4294, 353, 7704, 580, 13, 13, 13, 29937, 515, 11451, 5317, 3450, 13, 1753, 4216, 29918, 361, 29918, 1639, 4925, 7295, 13, 1678, 565, 22889, 29889, 275, 29918, 1639, 4925, 7295, 13, 4706, 2537, 3260, 353, 402, 6854, 29889, 657, 29918, 4925, 580, 13, 4706, 565, 2537, 3260, 338, 451, 6213, 29901, 13, 9651, 2537, 3260, 29889, 15257, 29889, 4294, 580, 13, 13, 13, 29937, 515, 11451, 5317, 3450, 13, 1753, 716, 29918, 4532, 29918, 12847, 29898, 1949, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 1678, 11479, 2385, 353, 9049, 5085, 29889, 7323, 877, 13080, 545, 2385, 742, 11479, 29897, 13, 1678, 4377, 353, 11479, 2385, 10456, 5085, 29892, 3579, 19290, 29897, 13, 1678, 736, 716, 29918, 4532, 29918, 12847, 29918, 29887, 5428, 29918, 4532, 29898, 1949, 29892, 4377, 29897, 13, 13, 13, 29937, 515, 11451, 5317, 3450, 13, 1753, 716, 29918, 4532, 29918, 12847, 29918, 29887, 5428, 29918, 4532, 29898, 1949, 29892, 4377, 1125, 13, 1678, 10508, 353, 11479, 21960, 4074, 29909, 1505, 29898, 4532, 29897, 13, 1678, 8455, 353, 11479, 3260, 4074, 29909, 1505, 29898, 15257, 29892, 954, 29897, 13, 1678, 736, 8455, 13, 13, 13, 29937, 515, 11451, 5317, 3450, 13, 1990, 11479, 21960, 4074, 29909, 1505, 29898, 13080, 545, 21960, 29909, 1505, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4377, 1125, 13, 4706, 11479, 21960, 29909, 1505, 17255, 2344, 12035, 1311, 29892, 4377, 29897, 13, 13, 1678, 822, 1510, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4532, 29889, 29873, 523, 29918, 2680, 580, 13, 4706, 11479, 21960, 29909, 1505, 29889, 4012, 29898, 1311, 29897, 13, 13, 4706, 565, 22889, 17255, 3259, 1649, 529, 525, 29896, 29889, 29906, 2396, 13, 9651, 6835, 353, 1583, 29889, 517, 1807, 29918, 23973, 29898, 29900, 29892, 29871, 29900, 29897, 13, 4706, 1683, 29901, 13, 9651, 6835, 353, 1583, 29889, 517, 1807, 29918, 23973, 580, 13, 13, 4706, 565, 7431, 29898, 842, 29898, 9040, 876, 5277, 29871, 29896, 29901, 13, 9651, 396, 437, 451, 6492, 4069, 13, 9651, 736, 13, 13, 4706, 4050, 353, 1583, 29889, 657, 29918, 9482, 261, 580, 13, 4706, 2920, 353, 938, 29898, 9482, 29889, 2103, 29897, 13, 13, 4706, 6492, 29918, 2248, 353, 2380, 565, 2897, 29889, 657, 6272, 703, 20055, 11282, 29924, 29918, 29924, 1299, 7390, 2891, 5265, 29933, 29918, 23845, 17923, 18474, 613, 7700, 29897, 1683, 448, 29896, 13, 4706, 2479, 29898, 9323, 1469, 2061, 29898, 5317, 29918, 2248, 29892, 2920, 29892, 6835, 876, 13, 13, 1678, 822, 4216, 29898, 1311, 1125, 13, 4706, 338, 29918, 1639, 4925, 353, 2897, 29889, 657, 6272, 703, 20055, 11282, 29924, 29918, 29924, 1299, 7390, 2891, 5265, 29933, 29918, 23845, 17923, 18474, 613, 7700, 29897, 13, 4706, 565, 338, 29918, 1639, 4925, 322, 22889, 29889, 275, 29918, 1639, 4925, 7295, 13, 9651, 1583, 29889, 4294, 580, 13, 13, 13, 1990, 11479, 3260, 4074, 29909, 1505, 29898, 13080, 545, 3260, 5160, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10508, 29892, 954, 1125, 13, 4706, 11479, 3260, 5160, 17255, 2344, 12035, 1311, 29892, 10508, 29892, 954, 29897, 13, 4706, 5534, 2380, 13, 4706, 2380, 4619, 29871, 29896, 13, 4706, 1583, 29889, 15257, 353, 10508, 13, 4706, 1583, 3032, 1949, 353, 954, 13, 4706, 1583, 3032, 845, 776, 353, 7700, 13, 13, 1678, 822, 1510, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 15257, 29889, 4294, 580, 13, 4706, 402, 6854, 29889, 20524, 29898, 1311, 3032, 1949, 29897, 13, 13, 13, 1990, 17440, 1469, 2061, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6492, 29918, 2248, 29892, 2920, 29892, 1967, 29918, 13193, 1125, 13, 4706, 1583, 29889, 5317, 29918, 2248, 353, 6492, 29918, 2248, 13, 4706, 1583, 29889, 3027, 29918, 2103, 353, 2920, 13, 4706, 1583, 29889, 3027, 29918, 13193, 353, 1967, 29918, 13193, 13, 13, 1678, 822, 903, 276, 558, 29918, 4990, 23538, 1311, 29897, 1599, 12603, 552, 29961, 710, 29892, 360, 919, 5387, 13, 4706, 1967, 29918, 13193, 29918, 3188, 29953, 29946, 353, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 12508, 29898, 1311, 29889, 3027, 29918, 13193, 29897, 13, 4706, 3573, 353, 426, 13, 9651, 525, 5317, 29918, 2248, 2396, 1583, 29889, 5317, 29918, 2248, 29892, 13, 9651, 525, 3027, 29918, 2103, 2396, 1583, 29889, 3027, 29918, 2103, 29892, 13, 9651, 525, 3027, 29918, 3188, 29953, 29946, 2396, 1967, 29918, 13193, 29918, 3188, 29953, 29946, 29889, 13808, 580, 13, 4706, 500, 13, 4706, 736, 6702, 2272, 305, 2817, 29899, 5317, 29899, 3027, 742, 3573, 29897, 13, 2 ]