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
pinolo/tasks.py
piger/pinolo
2
41511
# -*- coding: utf-8 -*- """ pinolo.tasks ~~~~~~~~~~~~ A Task object is a `threading.Thread` instance that will be executed without blocking the main thread. This is useful to perform potentially blocking actions like fecthing resources via HTTP. :copyright: (c) 2013 <NAME> :license: BSD, see LICENSE for more details. """ import threading class Task(threading.Thread): """A task is an execution unit that will be run in a separate thread that should not block tha main thread (handling irc connections). """ def __init__(self, event, *args, **kwargs): self.event = event super(Task, self).__init__(*args, **kwargs) @property def queue(self): return self.event.client.bot.coda @property def reply(self): return self.event.reply def run(self): raise RuntimeError("Must be implemented!") def put_results(self, *data): """Task output will be sent to the main thread via the configured queue; data should be a string containing the full output, that will later be splitted on newlines.""" self.queue.put(tuple(data))
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 1678, 12534, 3543, 29889, 20673, 13, 1678, 3695, 26594, 7377, 30022, 13, 13, 1678, 319, 9330, 1203, 338, 263, 421, 7097, 292, 29889, 4899, 29952, 2777, 393, 674, 367, 8283, 13, 1678, 1728, 23473, 278, 1667, 3244, 29889, 13, 1678, 910, 338, 5407, 304, 2189, 19998, 23473, 8820, 763, 285, 522, 2790, 13, 1678, 7788, 3025, 7331, 29889, 13, 13, 1678, 584, 8552, 1266, 29901, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29941, 529, 5813, 29958, 13, 1678, 584, 506, 1947, 29901, 350, 7230, 29892, 1074, 365, 2965, 1430, 1660, 363, 901, 4902, 29889, 13, 15945, 29908, 13, 5215, 3244, 292, 13, 13, 13, 1990, 9330, 29898, 7097, 292, 29889, 4899, 1125, 13, 1678, 9995, 29909, 3414, 338, 385, 8225, 5190, 393, 674, 367, 1065, 297, 263, 5004, 3244, 13, 1678, 393, 881, 451, 2908, 266, 29874, 1667, 3244, 313, 3179, 1847, 29871, 2076, 12368, 467, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1741, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 3696, 353, 1741, 13, 4706, 2428, 29898, 5398, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 9521, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 3696, 29889, 4645, 29889, 7451, 29889, 29883, 8887, 13, 13, 1678, 732, 6799, 13, 1678, 822, 8908, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 3696, 29889, 3445, 368, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 12020, 24875, 2392, 703, 29924, 504, 367, 8762, 29991, 1159, 13, 308, 13, 1678, 822, 1925, 29918, 9902, 29898, 1311, 29892, 334, 1272, 1125, 13, 4706, 9995, 5398, 1962, 674, 367, 2665, 304, 278, 1667, 3244, 3025, 278, 13252, 13, 4706, 9521, 29936, 848, 881, 367, 263, 1347, 6943, 278, 2989, 1962, 29892, 393, 674, 13, 4706, 2678, 367, 8536, 4430, 373, 716, 9012, 1213, 15945, 13, 4706, 1583, 29889, 9990, 29889, 649, 29898, 23583, 29898, 1272, 876, 13, 2 ]
setup.py
danihodovic/django-toolshed
3
17579
<gh_stars>1-10 #!/usr/bin/env python import os import re from setuptools import find_packages, setup def get_version(*file_paths): filename = os.path.join(os.path.dirname(__file__), *file_paths) version_file = open(filename).read() version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) if version_match: return version_match.group(1) raise RuntimeError("Unable to find version string.") version = get_version("django_toolshed", "__init__.py") readme = open("README.md").read() setup( name="django-toolshed", version=version, description="""Your project description goes here""", long_description=readme, author="<NAME>", author_email="<EMAIL>", url="https://github.com/danihodovic/django-toolshed", packages=find_packages(), include_package_data=True, install_requires=[], license="MIT", keywords="django,app", classifiers=[ "Development Status :: 3 - Alpha", "Framework :: Django :: 2.0", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", ], )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 5215, 2897, 13, 5215, 337, 13, 13, 3166, 731, 21245, 8789, 1053, 1284, 29918, 8318, 29892, 6230, 13, 13, 13, 1753, 679, 29918, 3259, 10456, 1445, 29918, 24772, 1125, 13, 1678, 10422, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 334, 1445, 29918, 24772, 29897, 13, 1678, 1873, 29918, 1445, 353, 1722, 29898, 9507, 467, 949, 580, 13, 1678, 1873, 29918, 4352, 353, 337, 29889, 4478, 29898, 29878, 29908, 29985, 1649, 3259, 1649, 353, 6024, 5931, 850, 22896, 12764, 3108, 7528, 1839, 29905, 3108, 613, 1873, 29918, 1445, 29892, 337, 29889, 29924, 29897, 13, 1678, 565, 1873, 29918, 4352, 29901, 13, 4706, 736, 1873, 29918, 4352, 29889, 2972, 29898, 29896, 29897, 13, 1678, 12020, 24875, 2392, 703, 2525, 519, 304, 1284, 1873, 1347, 23157, 13, 13, 13, 3259, 353, 679, 29918, 3259, 703, 14095, 29918, 10154, 845, 287, 613, 376, 1649, 2344, 26914, 2272, 1159, 13, 13, 949, 1004, 353, 1722, 703, 16310, 2303, 29889, 3487, 2564, 949, 580, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 14095, 29899, 10154, 845, 287, 613, 13, 1678, 1873, 29922, 3259, 29892, 13, 1678, 6139, 13776, 29908, 10858, 2060, 6139, 5771, 1244, 15945, 613, 13, 1678, 1472, 29918, 8216, 29922, 949, 1004, 29892, 13, 1678, 4148, 543, 29966, 5813, 28341, 13, 1678, 4148, 29918, 5269, 543, 29966, 26862, 6227, 28341, 13, 1678, 3142, 543, 991, 597, 3292, 29889, 510, 29914, 29881, 3270, 24008, 586, 293, 29914, 14095, 29899, 10154, 845, 287, 613, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 1678, 2601, 29918, 276, 339, 2658, 11759, 1402, 13, 1678, 19405, 543, 26349, 613, 13, 1678, 29361, 543, 14095, 29892, 932, 613, 13, 1678, 770, 14903, 11759, 13, 4706, 376, 21956, 358, 16034, 4761, 29871, 29941, 448, 838, 2026, 613, 13, 4706, 376, 16660, 4761, 15337, 4761, 29871, 29906, 29889, 29900, 613, 13, 4706, 376, 2928, 2760, 319, 4749, 663, 4761, 10682, 414, 613, 13, 4706, 376, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 613, 13, 4706, 376, 29940, 18771, 17088, 4761, 4223, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 613, 13, 1678, 21251, 13, 29897, 13, 2 ]
src/code/djangotest/migrations/0001_initial.py
jielyu/notebook
2
9220
# Generated by Django 2.2.5 on 2019-10-05 23:22 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Password', fields=[ ('id', models.IntegerField(primary_key=True, serialize=False, unique=True)), ('website', models.CharField(max_length=128)), ('username', models.CharField(max_length=128)), ('pwd', models.CharField(max_length=128)), ('time_add', models.DateTimeField(auto_now_add=True, null=True)), ('time_modify', models.DateTimeField(auto_now=True)), ], options={ 'db_table': 'password_tab', }, ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29945, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29900, 29899, 29900, 29945, 29871, 29906, 29941, 29901, 29906, 29906, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 2847, 353, 5852, 13, 13, 1678, 9962, 353, 518, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 10048, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 7798, 3073, 29898, 16072, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 29892, 5412, 29922, 5574, 8243, 13, 18884, 6702, 22942, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 8243, 13, 18884, 6702, 6786, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 8243, 13, 18884, 6702, 29886, 9970, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 8243, 13, 18884, 6702, 2230, 29918, 1202, 742, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29918, 1202, 29922, 5574, 29892, 1870, 29922, 5574, 8243, 13, 18884, 6702, 2230, 29918, 1545, 1598, 742, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29922, 5574, 8243, 13, 9651, 21251, 13, 9651, 3987, 3790, 13, 18884, 525, 2585, 29918, 2371, 2396, 525, 5630, 29918, 3891, 742, 13, 9651, 2981, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
ROS/fprime_ws/src/genfprime/src/genfprime/generate_modmk.py
genemerewether/fprime
5
2362
<gh_stars>1-10 # # Copyright 2004-2016, by the California Institute of Technology. # ALL RIGHTS RESERVED. United States Government Sponsorship # acknowledged. Any commercial use must be negotiated with the Office # of Technology Transfer at the California Institute of Technology. # # This software may be subject to U.S. export control laws and # regulations. By accepting this document, the user agrees to comply # with all U.S. export laws and regulations. User has the # responsibility to obtain export licenses, or other export authority # as may be required before exporting such information to foreign # countries or providing access to foreign persons. # from __future__ import print_function import os from genmsg import MsgGenerationException #from . name import * ## :param type_name outdir: Full path to output directory ## :returns int: status. 0 if successful def write_modmk(outdir): #, msg_types, srv_types): if not os.path.isdir(outdir): #TODO: warn? return 0 xml_in_dir = set([f for f in os.listdir(outdir) if f.endswith('.xml')]) _write_modmk(outdir, sorted(xml_in_dir)) # TODO(mereweth) if we want to independently specify the generated XML files # generated_xml = [_msg_serializable_xml_name(f) for f in sorted(msg_types)] # generated_xml.extend([_port_xml_name(f) for f in sorted(msg_types)] # write_msg_modmk(outdir, generated_xml) # generated_xml = [_srv_serializable_xml_name(f) for f in sorted(srv_types)] # generated_xml.extend([_port_xml_name(f) for f in sorted(srv_types)] # write_msg_modmk(outdir, generated_xml) return 0 def _write_modmk(outdir, generated_xml): if not os.path.exists(outdir): os.makedirs(outdir) elif not os.path.isdir(outdir): raise MsgGenerationException("file preventing the creating of Fprime directory: %s"%dir) p = os.path.join(outdir, 'mod.mk') with open(p, 'w') as f: f.write('SRC = \\\n') if len(generated_xml) != 0: for xml in generated_xml[:-1]: f.write('%s \\\n'%xml) f.write('%s\n'%generated_xml[-1]) return 0
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 13, 29937, 259, 14187, 1266, 29871, 29906, 29900, 29900, 29946, 29899, 29906, 29900, 29896, 29953, 29892, 491, 278, 8046, 8907, 310, 17968, 29889, 13, 29937, 259, 15149, 390, 22530, 29903, 390, 2890, 1001, 29963, 3352, 29889, 3303, 3900, 10354, 1706, 787, 272, 3527, 13, 29937, 259, 24084, 3192, 29889, 3139, 12128, 671, 1818, 367, 27214, 630, 411, 278, 11367, 13, 29937, 259, 310, 17968, 17934, 472, 278, 8046, 8907, 310, 17968, 29889, 13, 29937, 13, 29937, 259, 910, 7047, 1122, 367, 4967, 304, 501, 29889, 29903, 29889, 5609, 2761, 14243, 322, 13, 29937, 259, 1072, 8250, 29889, 29871, 2648, 25967, 445, 1842, 29892, 278, 1404, 8571, 267, 304, 752, 368, 13, 29937, 259, 411, 599, 501, 29889, 29903, 29889, 5609, 14243, 322, 1072, 8250, 29889, 29871, 4911, 756, 278, 13, 29937, 259, 23134, 304, 4017, 5609, 7794, 11259, 29892, 470, 916, 5609, 14329, 13, 29937, 259, 408, 1122, 367, 3734, 1434, 5609, 292, 1316, 2472, 304, 9117, 13, 29937, 259, 10916, 470, 13138, 2130, 304, 9117, 12407, 29889, 13, 29937, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 2897, 13, 13, 3166, 2531, 7645, 1053, 28264, 5631, 362, 2451, 13, 13, 29937, 3166, 869, 1024, 1053, 334, 13, 13, 2277, 584, 3207, 1134, 29918, 978, 714, 3972, 29901, 14846, 2224, 304, 1962, 3884, 13, 2277, 584, 18280, 938, 29901, 4660, 29889, 29871, 29900, 565, 9150, 13, 1753, 2436, 29918, 1545, 11256, 29898, 449, 3972, 1125, 396, 29892, 10191, 29918, 8768, 29892, 269, 15291, 29918, 8768, 1125, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 449, 3972, 1125, 13, 4706, 396, 4986, 3970, 29901, 29383, 29973, 13, 4706, 736, 29871, 29900, 13, 13, 1678, 4903, 29918, 262, 29918, 3972, 353, 731, 4197, 29888, 363, 285, 297, 2897, 29889, 1761, 3972, 29898, 449, 3972, 29897, 13, 462, 418, 565, 285, 29889, 1975, 2541, 12839, 3134, 1495, 2314, 13, 1678, 903, 3539, 29918, 1545, 11256, 29898, 449, 3972, 29892, 12705, 29898, 3134, 29918, 262, 29918, 3972, 876, 13, 13, 29937, 14402, 29898, 29885, 406, 29893, 621, 29897, 565, 591, 864, 304, 25499, 6084, 278, 5759, 6560, 2066, 13, 29937, 268, 5759, 29918, 3134, 353, 23160, 7645, 29918, 15550, 13902, 29918, 3134, 29918, 978, 29898, 29888, 29897, 363, 285, 297, 12705, 29898, 7645, 29918, 8768, 4638, 13, 29937, 268, 5759, 29918, 3134, 29889, 21843, 4197, 29918, 637, 29918, 3134, 29918, 978, 29898, 29888, 29897, 363, 285, 297, 12705, 29898, 7645, 29918, 8768, 4638, 13, 29937, 268, 2436, 29918, 7645, 29918, 1545, 11256, 29898, 449, 3972, 29892, 5759, 29918, 3134, 29897, 13, 13, 29937, 268, 5759, 29918, 3134, 353, 23160, 29879, 15291, 29918, 15550, 13902, 29918, 3134, 29918, 978, 29898, 29888, 29897, 363, 285, 297, 12705, 29898, 29879, 15291, 29918, 8768, 4638, 13, 29937, 268, 5759, 29918, 3134, 29889, 21843, 4197, 29918, 637, 29918, 3134, 29918, 978, 29898, 29888, 29897, 363, 285, 297, 12705, 29898, 29879, 15291, 29918, 8768, 4638, 13, 29937, 268, 2436, 29918, 7645, 29918, 1545, 11256, 29898, 449, 3972, 29892, 5759, 29918, 3134, 29897, 13, 13, 1678, 736, 29871, 29900, 13, 13, 1753, 903, 3539, 29918, 1545, 11256, 29898, 449, 3972, 29892, 5759, 29918, 3134, 1125, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 449, 3972, 1125, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 449, 3972, 29897, 13, 1678, 25342, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 449, 3972, 1125, 13, 4706, 12020, 28264, 5631, 362, 2451, 703, 1445, 5557, 292, 278, 4969, 310, 383, 10080, 3884, 29901, 1273, 29879, 29908, 29995, 3972, 29897, 13, 1678, 282, 353, 2897, 29889, 2084, 29889, 7122, 29898, 449, 3972, 29892, 525, 1545, 29889, 11256, 1495, 13, 1678, 411, 1722, 29898, 29886, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 4706, 285, 29889, 3539, 877, 29903, 10363, 353, 320, 1966, 29876, 1495, 13, 4706, 565, 7431, 29898, 13525, 29918, 3134, 29897, 2804, 29871, 29900, 29901, 13, 9651, 363, 4903, 297, 5759, 29918, 3134, 7503, 29899, 29896, 5387, 13, 18884, 285, 29889, 3539, 877, 29995, 29879, 320, 1966, 29876, 29915, 29995, 3134, 29897, 13, 9651, 285, 29889, 3539, 877, 29995, 29879, 29905, 29876, 29915, 29995, 13525, 29918, 3134, 14352, 29896, 2314, 13, 1678, 736, 29871, 29900, 13, 2 ]
CodeWars/8 Kyu/Grasshopper - Debug sayHello.py
anubhab-code/Competitive-Programming
0
64924
<filename>CodeWars/8 Kyu/Grasshopper - Debug sayHello.py def say_hello(name): return "Hello, {0}".format(name)
[ 1, 529, 9507, 29958, 3399, 29956, 1503, 29914, 29947, 16931, 29884, 29914, 3338, 465, 1251, 2496, 448, 16171, 1827, 10994, 29889, 2272, 13, 1753, 1827, 29918, 12199, 29898, 978, 1125, 13, 1678, 736, 376, 10994, 29892, 426, 29900, 29913, 1642, 4830, 29898, 978, 29897, 2 ]
Contest/ABC086/d/main.py
mpses/AtCoder
0
35923
#!/usr/bin/env python3 # 2次元累積和 S の [x1, x2) × [y1, y2) 総和 def ac2(s, x1, x2, y1, y2): return s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1] import numpy as np _, *d = open(0) n, k = map(int, _.split()) B = np.zeros((2*k, 2*k)) for e in d: *z, c = e.split() x, y = map(int, z) B[x % (2*k)][(y + k * (z == "W")) % (2*k)] += 1 B.cumsum(axis = 0) B.cumsum(axis = 1) B = np.tile(B, (2,2)) print(B) # 書きかけ
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 29871, 29906, 30936, 30824, 234, 183, 178, 234, 172, 144, 30503, 317, 29871, 30199, 518, 29916, 29896, 29892, 921, 29906, 29897, 13105, 518, 29891, 29896, 29892, 343, 29906, 29897, 29871, 234, 186, 146, 30503, 13, 1753, 1274, 29906, 29898, 29879, 29892, 921, 29896, 29892, 921, 29906, 29892, 343, 29896, 29892, 343, 29906, 1125, 13, 1678, 736, 269, 29961, 29916, 29906, 3816, 29891, 29906, 29962, 448, 269, 29961, 29916, 29896, 3816, 29891, 29906, 29962, 448, 269, 29961, 29916, 29906, 3816, 29891, 29896, 29962, 718, 269, 29961, 29916, 29896, 3816, 29891, 29896, 29962, 13, 13, 5215, 12655, 408, 7442, 13, 3383, 334, 29881, 353, 1722, 29898, 29900, 29897, 13, 29876, 29892, 413, 353, 2910, 29898, 524, 29892, 903, 29889, 5451, 3101, 13, 29933, 353, 7442, 29889, 3298, 359, 3552, 29906, 29930, 29895, 29892, 29871, 29906, 29930, 29895, 876, 13, 1454, 321, 297, 270, 29901, 13, 1678, 334, 29920, 29892, 274, 353, 321, 29889, 5451, 580, 13, 1678, 921, 29892, 343, 353, 2910, 29898, 524, 29892, 503, 29897, 13, 1678, 350, 29961, 29916, 1273, 313, 29906, 29930, 29895, 29897, 3816, 29898, 29891, 718, 413, 334, 313, 29920, 1275, 376, 29956, 5783, 1273, 313, 29906, 29930, 29895, 4638, 4619, 29871, 29896, 13, 29933, 29889, 29883, 398, 2083, 29898, 8990, 353, 29871, 29900, 29897, 13, 29933, 29889, 29883, 398, 2083, 29898, 8990, 353, 29871, 29896, 29897, 13, 29933, 353, 7442, 29889, 29873, 488, 29898, 29933, 29892, 313, 29906, 29892, 29906, 876, 13, 2158, 29898, 29933, 29897, 13, 29937, 29871, 30854, 30538, 30412, 30807, 2 ]
workspaces/voyage/server/src/util/smartcomponent.py
raychorn/svn_hp-projects
0
81883
##################################################### # # smartcomponent.py # # Copyright 2007 Hewlett-Packard Development Company, L.P. # # Hewlett-Packard and the Hewlett-Packard logo are trademarks of # Hewlett-Packard Development Company, L.P. in the U.S. and/or other countries. # # Confidential computer software. Valid license from Hewlett-Packard required # for possession, use or copying. Consistent with FAR 12.211 and 12.212, # Commercial Computer Software, Computer Software Documentation, and Technical # Data for Commercial Items are licensed to the U.S. Government under # vendor's standard commercial license. # # Author: # <NAME> # # Description: # Manages Smart Component objects for Breckenridge. # ##################################################### import os import tarfile import tempfile from xml.dom.minidom import parse from threading import Thread import logging log = logging.getLogger(__name__) SC_SHARE_PATH='static/sc_share' class SmartComponent: def __init__(self): self.version = "Unknown" self.name = "Unknown Component" self.filename = "" def __repr__(self): return str(self.__dict__) def json(self): return json.dumps(self.__dict__) class SmartComponentManager: def __init__(self): self.components = [] self.path = os.path.abspath(SC_SHARE_PATH) log.debug("Initializing SmartComponentManager") def get_sc_file_list(self): for root, directories, files in os.walk(self.path): return files def delete_component(self, sc_filename): sc_path = self.path + '\\' + sc_filename try: os.remove(sc_path) for component in self.components: if component.filename == sc_filename: self.components.remove(component) except: pass def discover_components(self): t = Thread(target=self.do_discover_components) t.daemon = True t.start() def do_discover_components(self): files = self.get_sc_file_list() if files: for file in files: if file.lower().endswith('.scexe') : log.debug("Discovered component %s", file) self.add_component(file) def add_component(self, filename): log.debug("Adding component %s", filename) if filename in [c.filename for c in self.components ] : log.error("Component %s already added", filename) return False component = SmartComponent() component.filename = filename digest_filename = self.extract_component_digest(filename) if digest_filename != "": self.parse_digest(digest_filename, component) # Remove the digest file. try: os.remove(self.path + '\\' + digest_filename) except: log.exception("Error removing digest file %s", digest_filename) pass self.components.append(component) # Each smart component should have an XML file inside. We'll use # tar to extract that file and obtain information about the component. # This function will return the filename of the xml file after it # has been extracted from the archive. def extract_component_digest(self, sc_filename): # The first step is to find the line where the tarfile starts. sc_path = self.path + '\\' + sc_filename sc_file = open(sc_path, "rb") line_offset = -1 while True: buf = sc_file.read(1024) if buf == "": break skip_idx = buf.find("_SKIP=") if (skip_idx != -1): buf = buf[(skip_idx+6):] newline = buf.find('\n') line_offset = buf[0:newline] break # We didn't find the line offset. We can't go any further. if line_offset == -1: sc_file.close() log.error("Unable to find tar offset in %s", sc_filename) return "" line_offset = int(line_offset)-1 sc_file.seek(0) log.debug("tar file in %s at offset %d", sc_filename, line_offset) # Now that we have our line offset, move to the correct position in the file. for line in range(0, line_offset): sc_file.readline() tar_file = tempfile.mkstemp(dir=self.path) while True: buf = sc_file.read(1024) if buf == "": break os.write(tar_file[0], buf) sc_file.close() os.close(tar_file[0]) # Now we should have a good tarfile to extract the digest. digest_name = "" try: tf = tarfile.open(tar_file[1], 'r') for filename in tf.getnames() : if filename.lower() == sc_filename.lower().replace('.scexe', '.xml') : digest_name = filename log.debug("Extracting %s from tar", digest_name) tf.extract(digest_name, self.path) tf.close() os.remove(tar_file[1]) break except: log.exception("Error getting XML file name from %s", sc_filename) os.remove(tar_file[1]) tf.close() if not digest_name : log.error("Unable to find component xml file in %s", sc_filename) return digest_name # Parses the digest file and adds the required attributes to the SmartComponent object. def parse_digest(self, filename, component): log.debug("Parsing %s", filename) digest_dom = None try: digest_dom = parse(self.path + '\\' + filename) except: log.exception("Error parsing file %s",filename) return None package_elem = digest_dom.getElementsByTagName('cpq_package') if not package_elem: log.error("No cpq_package found") return None package_elem = package_elem[0] version_elem = None name_elem = None for node in package_elem.childNodes: if node.nodeName == 'version': version_elem = node elif node.nodeName == 'name': name_elem = node # Add the version from the version element's value attribute. if version_elem: component.version = version_elem.getAttribute('value') log.debug("%s component version: %s", component.filename, component.version) else : log.error("Error: no component version in %s", filename) if name_elem: for node in name_elem.childNodes: if node.nodeName == "name_xlate" and node.getAttribute("lang") == "en": for cn in node.childNodes: component.name = cn.wholeText log.debug("%s component name: %s", component.filename, component.name) else : log.error("Error: no component name in %s", filename) def json(self): json_list = [] for component in self.components: json_list.append(component.__dict__) return json_list # The main smart component manager object. __scm = SmartComponentManager() def get_scm(): return __scm
[ 1, 835, 13383, 13383, 13383, 2277, 13, 29937, 13, 29937, 15040, 9700, 29889, 2272, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29900, 29955, 379, 809, 13650, 29899, 16638, 538, 14650, 6938, 29892, 365, 29889, 29925, 29889, 13, 29937, 13, 29937, 379, 809, 13650, 29899, 16638, 538, 322, 278, 379, 809, 13650, 29899, 16638, 538, 20194, 526, 1020, 2310, 17862, 310, 13, 29937, 379, 809, 13650, 29899, 16638, 538, 14650, 6938, 29892, 365, 29889, 29925, 29889, 297, 278, 501, 29889, 29903, 29889, 322, 29914, 272, 916, 10916, 29889, 13, 29937, 13, 29937, 10811, 1693, 616, 6601, 7047, 29889, 15758, 19405, 515, 379, 809, 13650, 29899, 16638, 538, 3734, 13, 29937, 363, 17715, 29892, 671, 470, 17596, 29889, 2138, 9696, 411, 383, 1718, 29871, 29896, 29906, 29889, 29906, 29896, 29896, 322, 29871, 29896, 29906, 29889, 29906, 29896, 29906, 29892, 13, 29937, 422, 1050, 1455, 20972, 18540, 29892, 20972, 18540, 10854, 362, 29892, 322, 8364, 936, 13, 29937, 3630, 363, 422, 1050, 1455, 25085, 526, 7794, 21144, 304, 278, 501, 29889, 29903, 29889, 10354, 1090, 13, 29937, 27042, 29915, 29879, 3918, 12128, 19405, 29889, 13, 29937, 13, 29937, 13361, 29901, 13, 29937, 1678, 529, 5813, 29958, 13, 29937, 29871, 13, 29937, 12953, 29901, 13, 29937, 1678, 2315, 1179, 4116, 442, 15924, 3618, 363, 5826, 8916, 8605, 29889, 13, 29937, 13, 13383, 13383, 13383, 4136, 29937, 13, 13, 5215, 2897, 13, 5215, 9913, 1445, 13, 5215, 5694, 1445, 13, 3166, 4903, 29889, 3129, 29889, 1195, 333, 290, 1053, 6088, 13, 3166, 3244, 292, 1053, 10480, 13, 5215, 12183, 13, 1188, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 7187, 29918, 23498, 1525, 29918, 10145, 2433, 7959, 29914, 1557, 29918, 13653, 29915, 13, 13, 1990, 4116, 442, 5308, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 3259, 353, 376, 14148, 29908, 13, 4706, 1583, 29889, 978, 353, 376, 14148, 15924, 29908, 13, 4706, 1583, 29889, 9507, 353, 5124, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 851, 29898, 1311, 17255, 8977, 1649, 29897, 13, 13, 1678, 822, 4390, 29898, 1311, 1125, 13, 4706, 736, 4390, 29889, 29881, 17204, 29898, 1311, 17255, 8977, 1649, 29897, 13, 13, 1990, 4116, 442, 5308, 3260, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 14036, 353, 5159, 13, 4706, 1583, 29889, 2084, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 7187, 29918, 23498, 1525, 29918, 10145, 29897, 13, 4706, 1480, 29889, 8382, 703, 15514, 5281, 4116, 442, 5308, 3260, 1159, 13, 13, 1678, 822, 679, 29918, 1557, 29918, 1445, 29918, 1761, 29898, 1311, 1125, 13, 4706, 363, 3876, 29892, 17525, 29892, 2066, 297, 2897, 29889, 20919, 29898, 1311, 29889, 2084, 1125, 13, 9651, 736, 2066, 13, 13, 1678, 822, 5217, 29918, 9700, 29898, 1311, 29892, 885, 29918, 9507, 1125, 13, 4706, 885, 29918, 2084, 353, 1583, 29889, 2084, 718, 525, 1966, 29915, 718, 885, 29918, 9507, 13, 4706, 1018, 29901, 13, 9651, 2897, 29889, 5992, 29898, 1557, 29918, 2084, 29897, 13, 9651, 363, 4163, 297, 1583, 29889, 14036, 29901, 13, 18884, 565, 4163, 29889, 9507, 1275, 885, 29918, 9507, 29901, 13, 462, 1678, 1583, 29889, 14036, 29889, 5992, 29898, 9700, 29897, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 13, 1678, 822, 6523, 29918, 14036, 29898, 1311, 1125, 13, 4706, 260, 353, 10480, 29898, 5182, 29922, 1311, 29889, 1867, 29918, 2218, 11911, 29918, 14036, 29897, 13, 4706, 260, 29889, 1388, 9857, 353, 5852, 13, 4706, 260, 29889, 2962, 580, 13, 13, 1678, 822, 437, 29918, 2218, 11911, 29918, 14036, 29898, 1311, 1125, 13, 4706, 2066, 353, 1583, 29889, 657, 29918, 1557, 29918, 1445, 29918, 1761, 580, 13, 4706, 565, 2066, 29901, 13, 9651, 363, 934, 297, 2066, 29901, 13, 18884, 565, 934, 29889, 13609, 2141, 1975, 2541, 12839, 22774, 17115, 1495, 584, 13, 462, 1678, 1480, 29889, 8382, 703, 4205, 11911, 287, 4163, 1273, 29879, 613, 934, 29897, 13, 462, 1678, 1583, 29889, 1202, 29918, 9700, 29898, 1445, 29897, 13, 13, 1678, 822, 788, 29918, 9700, 29898, 1311, 29892, 10422, 1125, 13, 13, 4706, 1480, 29889, 8382, 703, 2528, 292, 4163, 1273, 29879, 613, 10422, 29897, 13, 4706, 565, 10422, 297, 518, 29883, 29889, 9507, 363, 274, 297, 1583, 29889, 14036, 4514, 584, 308, 13, 9651, 1480, 29889, 2704, 703, 5308, 1273, 29879, 2307, 2715, 613, 10422, 29897, 13, 9651, 736, 7700, 13, 13, 4706, 4163, 353, 4116, 442, 5308, 580, 13, 4706, 4163, 29889, 9507, 353, 10422, 13, 13, 4706, 4697, 342, 29918, 9507, 353, 1583, 29889, 21111, 29918, 9700, 29918, 7501, 342, 29898, 9507, 29897, 13, 4706, 565, 4697, 342, 29918, 9507, 2804, 376, 1115, 13, 9651, 1583, 29889, 5510, 29918, 7501, 342, 29898, 7501, 342, 29918, 9507, 29892, 4163, 29897, 13, 9651, 396, 15154, 278, 4697, 342, 934, 29889, 13, 9651, 1018, 29901, 13, 18884, 2897, 29889, 5992, 29898, 1311, 29889, 2084, 718, 525, 1966, 29915, 718, 4697, 342, 29918, 9507, 29897, 13, 9651, 5174, 29901, 13, 18884, 1480, 29889, 11739, 703, 2392, 11077, 4697, 342, 934, 1273, 29879, 613, 4697, 342, 29918, 9507, 29897, 13, 18884, 1209, 13, 4706, 1583, 29889, 14036, 29889, 4397, 29898, 9700, 29897, 13, 13, 1678, 396, 7806, 15040, 4163, 881, 505, 385, 6560, 934, 2768, 29889, 1334, 29915, 645, 671, 13, 1678, 396, 9913, 304, 6597, 393, 934, 322, 4017, 2472, 1048, 278, 4163, 29889, 13, 1678, 396, 910, 740, 674, 736, 278, 10422, 310, 278, 4903, 934, 1156, 372, 13, 1678, 396, 756, 1063, 23892, 515, 278, 18871, 29889, 13, 1678, 822, 6597, 29918, 9700, 29918, 7501, 342, 29898, 1311, 29892, 885, 29918, 9507, 1125, 13, 13, 4706, 396, 450, 937, 4331, 338, 304, 1284, 278, 1196, 988, 278, 9913, 1445, 8665, 29889, 13, 4706, 885, 29918, 2084, 353, 1583, 29889, 2084, 718, 525, 1966, 29915, 718, 885, 29918, 9507, 13, 4706, 885, 29918, 1445, 353, 1722, 29898, 1557, 29918, 2084, 29892, 376, 6050, 1159, 13, 13, 4706, 1196, 29918, 10289, 353, 448, 29896, 13, 4706, 1550, 5852, 29901, 13, 9651, 18392, 353, 885, 29918, 1445, 29889, 949, 29898, 29896, 29900, 29906, 29946, 29897, 13, 9651, 565, 18392, 1275, 376, 1115, 13, 18884, 2867, 13, 13, 9651, 14383, 29918, 13140, 353, 18392, 29889, 2886, 703, 29918, 16033, 5690, 543, 29897, 13, 9651, 565, 313, 11014, 29918, 13140, 2804, 448, 29896, 1125, 13, 18884, 18392, 353, 18392, 15625, 11014, 29918, 13140, 29974, 29953, 1125, 29962, 13, 18884, 25899, 353, 18392, 29889, 2886, 28909, 29876, 1495, 13, 18884, 1196, 29918, 10289, 353, 18392, 29961, 29900, 29901, 1482, 1220, 29962, 13, 18884, 2867, 308, 13, 462, 13, 4706, 396, 1334, 3282, 29915, 29873, 1284, 278, 1196, 9210, 29889, 1334, 508, 29915, 29873, 748, 738, 4340, 29889, 13, 4706, 565, 1196, 29918, 10289, 1275, 448, 29896, 29901, 13, 9651, 885, 29918, 1445, 29889, 5358, 580, 13, 9651, 1480, 29889, 2704, 703, 2525, 519, 304, 1284, 9913, 9210, 297, 1273, 29879, 613, 885, 29918, 9507, 29897, 13, 9651, 736, 5124, 13, 308, 13, 4706, 1196, 29918, 10289, 353, 938, 29898, 1220, 29918, 10289, 6817, 29896, 13, 4706, 885, 29918, 1445, 29889, 344, 1416, 29898, 29900, 29897, 13, 13, 4706, 1480, 29889, 8382, 703, 12637, 934, 297, 1273, 29879, 472, 9210, 1273, 29881, 613, 885, 29918, 9507, 29892, 1196, 29918, 10289, 29897, 13, 308, 13, 4706, 396, 2567, 393, 591, 505, 1749, 1196, 9210, 29892, 4337, 304, 278, 1959, 2602, 297, 278, 934, 29889, 13, 4706, 363, 1196, 297, 3464, 29898, 29900, 29892, 1196, 29918, 10289, 1125, 13, 9651, 885, 29918, 1445, 29889, 949, 1220, 580, 13, 13, 4706, 9913, 29918, 1445, 353, 5694, 1445, 29889, 11256, 303, 3451, 29898, 3972, 29922, 1311, 29889, 2084, 29897, 13, 13, 4706, 1550, 5852, 29901, 13, 9651, 18392, 353, 885, 29918, 1445, 29889, 949, 29898, 29896, 29900, 29906, 29946, 29897, 13, 9651, 565, 18392, 1275, 376, 1115, 13, 18884, 2867, 13, 13, 9651, 2897, 29889, 3539, 29898, 12637, 29918, 1445, 29961, 29900, 1402, 18392, 29897, 13, 13, 4706, 885, 29918, 1445, 29889, 5358, 580, 13, 4706, 2897, 29889, 5358, 29898, 12637, 29918, 1445, 29961, 29900, 2314, 13, 13, 4706, 396, 2567, 591, 881, 505, 263, 1781, 9913, 1445, 304, 6597, 278, 4697, 342, 29889, 13, 4706, 4697, 342, 29918, 978, 353, 5124, 13, 13, 4706, 1018, 29901, 13, 9651, 15886, 353, 9913, 1445, 29889, 3150, 29898, 12637, 29918, 1445, 29961, 29896, 1402, 525, 29878, 1495, 632, 13, 9651, 363, 10422, 297, 15886, 29889, 657, 7039, 580, 584, 13, 18884, 565, 10422, 29889, 13609, 580, 1275, 29871, 885, 29918, 9507, 29889, 13609, 2141, 6506, 12839, 22774, 17115, 742, 15300, 3134, 1495, 584, 9651, 13, 462, 1678, 4697, 342, 29918, 978, 353, 10422, 13, 462, 1678, 1480, 29889, 8382, 703, 5647, 1461, 292, 1273, 29879, 515, 9913, 613, 4697, 342, 29918, 978, 29897, 13, 462, 1678, 15886, 29889, 21111, 29898, 7501, 342, 29918, 978, 29892, 1583, 29889, 2084, 29897, 13, 462, 1678, 15886, 29889, 5358, 580, 13, 462, 1678, 2897, 29889, 5992, 29898, 12637, 29918, 1445, 29961, 29896, 2314, 13, 462, 1678, 2867, 13, 4706, 5174, 29901, 13, 9651, 1480, 29889, 11739, 703, 2392, 2805, 6560, 934, 1024, 515, 1273, 29879, 613, 885, 29918, 9507, 29897, 13, 9651, 2897, 29889, 5992, 29898, 12637, 29918, 1445, 29961, 29896, 2314, 13, 9651, 15886, 29889, 5358, 580, 13, 13, 4706, 565, 451, 4697, 342, 29918, 978, 584, 13, 9651, 1480, 29889, 2704, 703, 2525, 519, 304, 1284, 4163, 4903, 934, 297, 1273, 29879, 613, 885, 29918, 9507, 29897, 268, 13, 632, 13, 4706, 736, 4697, 342, 29918, 978, 13, 13, 1678, 396, 1459, 29879, 267, 278, 4697, 342, 934, 322, 12778, 278, 3734, 8393, 304, 278, 4116, 442, 5308, 1203, 29889, 13, 1678, 822, 6088, 29918, 7501, 342, 29898, 1311, 29892, 10422, 29892, 4163, 1125, 13, 4706, 1480, 29889, 8382, 703, 29925, 1503, 292, 1273, 29879, 613, 10422, 29897, 13, 4706, 4697, 342, 29918, 3129, 353, 6213, 13, 4706, 1018, 29901, 13, 9651, 4697, 342, 29918, 3129, 353, 6088, 29898, 1311, 29889, 2084, 718, 525, 1966, 29915, 718, 10422, 29897, 13, 4706, 5174, 29901, 13, 9651, 1480, 29889, 11739, 703, 2392, 13755, 934, 1273, 29879, 613, 9507, 29897, 13, 9651, 736, 6213, 13, 13, 4706, 3577, 29918, 20461, 353, 4697, 342, 29918, 3129, 29889, 22266, 29269, 877, 6814, 29939, 29918, 5113, 1495, 13, 4706, 565, 451, 3577, 29918, 20461, 29901, 13, 9651, 1480, 29889, 2704, 703, 3782, 21447, 29939, 29918, 5113, 1476, 1159, 13, 9651, 736, 6213, 13, 13, 4706, 3577, 29918, 20461, 353, 3577, 29918, 20461, 29961, 29900, 29962, 13, 4706, 1873, 29918, 20461, 353, 6213, 13, 4706, 1024, 29918, 20461, 353, 6213, 13, 13, 4706, 363, 2943, 297, 3577, 29918, 20461, 29889, 5145, 20284, 29901, 13, 9651, 565, 2943, 29889, 3177, 1170, 1275, 525, 3259, 2396, 13, 18884, 1873, 29918, 20461, 353, 2943, 13, 9651, 25342, 2943, 29889, 3177, 1170, 1275, 525, 978, 2396, 13, 18884, 1024, 29918, 20461, 353, 2943, 13, 13, 4706, 396, 3462, 278, 1873, 515, 278, 1873, 1543, 29915, 29879, 995, 5352, 29889, 13, 4706, 565, 1873, 29918, 20461, 29901, 13, 9651, 4163, 29889, 3259, 353, 1873, 29918, 20461, 29889, 657, 6708, 877, 1767, 1495, 13, 9651, 1480, 29889, 8382, 11702, 29879, 4163, 1873, 29901, 1273, 29879, 613, 4163, 29889, 9507, 29892, 4163, 29889, 3259, 29897, 13, 4706, 1683, 584, 13, 9651, 1480, 29889, 2704, 703, 2392, 29901, 694, 4163, 1873, 297, 1273, 29879, 613, 10422, 29897, 13, 13, 4706, 565, 1024, 29918, 20461, 29901, 13, 9651, 363, 2943, 297, 1024, 29918, 20461, 29889, 5145, 20284, 29901, 13, 18884, 565, 2943, 29889, 3177, 1170, 1275, 376, 978, 29918, 29916, 9632, 29908, 322, 2943, 29889, 657, 6708, 703, 3893, 1159, 1275, 376, 264, 1115, 13, 462, 1678, 363, 274, 29876, 297, 2943, 29889, 5145, 20284, 29901, 13, 462, 4706, 4163, 29889, 978, 353, 274, 29876, 29889, 15970, 280, 1626, 13, 462, 4706, 1480, 29889, 8382, 11702, 29879, 4163, 1024, 29901, 1273, 29879, 613, 4163, 29889, 9507, 29892, 4163, 29889, 978, 29897, 13, 4706, 1683, 584, 13, 9651, 1480, 29889, 2704, 703, 2392, 29901, 694, 4163, 1024, 297, 1273, 29879, 613, 10422, 29897, 13, 13, 1678, 822, 4390, 29898, 1311, 1125, 13, 4706, 4390, 29918, 1761, 353, 5159, 13, 4706, 363, 4163, 297, 1583, 29889, 14036, 29901, 13, 9651, 4390, 29918, 1761, 29889, 4397, 29898, 9700, 17255, 8977, 1649, 29897, 13, 4706, 736, 4390, 29918, 1761, 13, 13, 29937, 450, 1667, 15040, 4163, 8455, 1203, 29889, 13, 1649, 1557, 29885, 353, 4116, 442, 5308, 3260, 580, 13, 13, 1753, 679, 29918, 1557, 29885, 7295, 13, 1678, 736, 4770, 1557, 29885, 13, 2 ]
test/generic_profiler_test.py
newstzpz/ClassyVision-1
0
130914
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest from test.generic.config_utils import get_test_model_configs import torch import torch.nn as nn from classy_vision.generic.profiler import ( compute_activations, compute_flops, count_params, get_shape, ) from classy_vision.models import build_model class TestModule(nn.Module): def __init__(self): super().__init__() # add parameters to the module to affect the parameter count self.linear = nn.Linear(2, 3, bias=False) def forward(self, x): return x + 1 def flops(self, x): # TODO: this should raise an exception if this function is not defined # since the FLOPs are indeterminable # need to define flops since this is an unknown class return x.numel() class TestConvModule(nn.Conv2d): def __init__(self): super().__init__(2, 3, (4, 4), bias=False) # add another (unused) layer for added complexity and to test parameters self.linear = nn.Linear(4, 5, bias=False) def forward(self, x): return x def activations(self, x, out): # TODO: this should ideally work without this function being defined return out.numel() def flops(self, x): # need to define flops since this is an unknown class return 0 class TestModel(nn.Module): def __init__(self): super().__init__() self.linear = nn.Linear(300, 300, bias=False) self.mod = TestModule() self.conv = TestConvModule() # we should be able to pick up user defined parameters as well self.extra_params = nn.Parameter(torch.randn(10, 10)) # we shouldn't count flops for an unused layer self.unused_linear = nn.Linear(2, 2, bias=False) def forward(self, x): out = self.conv(x) out = out.view(out.shape[0], -1) out = self.mod(out) return self.linear(out) class TestModel2(nn.Module): def __init__(self): super().__init__() # create a model which re-uses a module (conv_module in this case) conv_module = nn.Conv2d(3, 3, (2, 2), bias=False) self.seq_1 = nn.Sequential(conv_module) self.seq_2 = nn.Sequential(conv_module) def forward(self, x): return self.seq_1(x) + self.seq_2(x) class TestModuleWithoutFlops(nn.Module): # this module doesn't have FLOPs defined def forward(self, x): return x class TestModuleWithFlops(nn.Module): # this module does have FLOPs defined _flops = 1234 def __init__(self): super().__init__() self.mod = TestModuleWithoutFlops() # add a conv module; this shouldn't impact the FLOPs since we define # self.flops() self.conv = nn.Conv2d(3, 3, (2, 2)) def forward(self, x): return self.conv(x) def flops(self, x): return self._flops class TestProfilerFunctions(unittest.TestCase): def test_complexity_calculation_resnext(self) -> None: model_configs = get_test_model_configs() # make sure there are three configs returned self.assertEqual(len(model_configs), 3) # expected values which allow minor deviations from model changes # we only test at the 10^6 scale expected_m_flops = [4122, 7850, 8034] expected_m_params = [25, 44, 44] expected_m_activations = [11, 16, 21] for model_config, m_flops, m_params, m_activations in zip( model_configs, expected_m_flops, expected_m_params, expected_m_activations ): model = build_model(model_config) self.assertEqual(compute_activations(model) // 10 ** 6, m_activations) self.assertEqual(compute_flops(model) // 10 ** 6, m_flops) self.assertEqual(count_params(model) // 10 ** 6, m_params) def test_complexity_calculation(self) -> None: model = TestModel() input_shape = (3, 10, 10) num_elems = 3 * 10 * 10 self.assertEqual(compute_activations(model, input_shape=input_shape), num_elems) self.assertEqual( compute_flops(model, input_shape=input_shape), num_elems + 0 + (300 * 300), # TestModule + TestConvModule + TestModel.linear; # TestModel.unused_linear is unused and shouldn't be counted ) self.assertEqual( count_params(model), (2 * 3) + (2 * 3 * 4 * 4) + (4 * 5) + (300 * 300) + (10 * 10) + (2 * 2), ) # TestModule.linear + TestConvModule + TestConvModule.linear + # TestModel.linear + TestModel.extra_params + TestModel.unused_linear # test that we calculate complexity correctly for a model which re-uses a module model = TestModel2() in_channels = 3 out_channels = 3 out_h, out_w = 9, 9 kernel_h, kernel_w = 2, 2 conv_flops = in_channels * out_channels * out_h * out_w * kernel_h * kernel_w conv_activations = out_channels * out_h * out_w self.assertEqual( compute_activations(model, input_shape=input_shape), conv_activations * 2 ) # the conv is applied twice self.assertEqual( compute_flops(model, input_shape=input_shape), conv_flops * 2 ) # the conv is applied twice self.assertEqual( count_params(model), in_channels * out_channels * kernel_h * kernel_w ) def test_flops_calculation(self): # test that a model containing a custom module which doesn't have FLOPs defined # raises an exception model = nn.Sequential(TestModuleWithoutFlops()) input_shape = (3, 10, 10) with self.assertRaises(Exception): compute_flops(model, input_shape=input_shape) # test that a model containing a custom module does have FLOPs defined works, # even if the module has children which don't define FLOPs model = nn.Sequential(TestModuleWithFlops()) input_shape = (3, 10, 10) self.assertEqual( compute_flops(model, input_shape=input_shape), TestModuleWithFlops._flops ) # the conv is applied twice class TestHelperFunctions(unittest.TestCase): def test_get_shape(self) -> None: list_x = [torch.zeros(2, 4), torch.zeros(3, 3)] shapes = get_shape(list_x) expected_shapes = [torch.zeros(2, 4).size(), torch.zeros(3, 3).size()] for shape, expected in zip(shapes, expected_shapes): self.assertEqual(shape, expected) dict_x = {"x1": torch.zeros(2, 4), "x2": torch.zeros(3, 3)} shapes = get_shape(dict_x) expected_shapes = { "x1": torch.zeros(2, 4).size(), "x2": torch.zeros(3, 3).size(), } for k, shape in shapes.items(): self.assertEqual(shape, expected_shapes[k]) list_dict_x = [ {"x1": torch.zeros(2, 4), "x2": torch.zeros(3, 3)}, {"x1": torch.zeros(3, 4), "x2": torch.zeros(4, 5)}, ] shapes = get_shape(list_dict_x) expected_shapes = [ {"x1": torch.zeros(2, 4).size(), "x2": torch.zeros(3, 3).size()}, {"x1": torch.zeros(3, 4).size(), "x2": torch.zeros(4, 5).size()}, ] for shape, expected in zip(shapes, expected_shapes): for k, s in shape.items(): self.assertEqual(s, expected[k])
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 14187, 1266, 313, 29883, 29897, 13327, 29892, 9266, 29889, 322, 967, 23736, 1078, 29889, 13, 29937, 13, 29937, 910, 2752, 775, 338, 7794, 21144, 1090, 278, 341, 1806, 19405, 1476, 297, 278, 13, 29937, 365, 2965, 1430, 1660, 934, 297, 278, 3876, 3884, 310, 445, 2752, 5447, 29889, 13, 13, 5215, 443, 27958, 13, 3166, 1243, 29889, 19206, 29889, 2917, 29918, 13239, 1053, 679, 29918, 1688, 29918, 4299, 29918, 2917, 29879, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 3166, 770, 29891, 29918, 4924, 29889, 19206, 29889, 771, 1777, 261, 1053, 313, 13, 1678, 10272, 29918, 11236, 800, 29892, 13, 1678, 10272, 29918, 29888, 417, 567, 29892, 13, 1678, 2302, 29918, 7529, 29892, 13, 1678, 679, 29918, 12181, 29892, 13, 29897, 13, 3166, 770, 29891, 29918, 4924, 29889, 9794, 1053, 2048, 29918, 4299, 13, 13, 13, 1990, 4321, 7355, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 396, 788, 4128, 304, 278, 3883, 304, 6602, 278, 3443, 2302, 13, 4706, 1583, 29889, 10660, 353, 302, 29876, 29889, 12697, 29898, 29906, 29892, 29871, 29941, 29892, 24003, 29922, 8824, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 921, 718, 29871, 29896, 13, 13, 1678, 822, 5685, 567, 29898, 1311, 29892, 921, 1125, 13, 4706, 396, 14402, 29901, 445, 881, 12020, 385, 3682, 565, 445, 740, 338, 451, 3342, 13, 4706, 396, 1951, 278, 383, 3927, 29925, 29879, 526, 1399, 300, 837, 262, 519, 13, 13, 4706, 396, 817, 304, 4529, 5685, 567, 1951, 445, 338, 385, 9815, 770, 13, 4706, 736, 921, 29889, 1949, 295, 580, 13, 13, 13, 1990, 4321, 1168, 29894, 7355, 29898, 15755, 29889, 1168, 29894, 29906, 29881, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 29906, 29892, 29871, 29941, 29892, 313, 29946, 29892, 29871, 29946, 511, 24003, 29922, 8824, 29897, 13, 4706, 396, 788, 1790, 313, 348, 3880, 29897, 7546, 363, 2715, 13644, 322, 304, 1243, 4128, 13, 4706, 1583, 29889, 10660, 353, 302, 29876, 29889, 12697, 29898, 29946, 29892, 29871, 29945, 29892, 24003, 29922, 8824, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 921, 13, 13, 1678, 822, 5039, 800, 29898, 1311, 29892, 921, 29892, 714, 1125, 13, 4706, 396, 14402, 29901, 445, 881, 1957, 635, 664, 1728, 445, 740, 1641, 3342, 13, 4706, 736, 714, 29889, 1949, 295, 580, 13, 13, 1678, 822, 5685, 567, 29898, 1311, 29892, 921, 1125, 13, 4706, 396, 817, 304, 4529, 5685, 567, 1951, 445, 338, 385, 9815, 770, 13, 4706, 736, 29871, 29900, 13, 13, 13, 1990, 4321, 3195, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 10660, 353, 302, 29876, 29889, 12697, 29898, 29941, 29900, 29900, 29892, 29871, 29941, 29900, 29900, 29892, 24003, 29922, 8824, 29897, 13, 4706, 1583, 29889, 1545, 353, 4321, 7355, 580, 13, 4706, 1583, 29889, 20580, 353, 4321, 1168, 29894, 7355, 580, 13, 4706, 396, 591, 881, 367, 2221, 304, 5839, 701, 1404, 3342, 4128, 408, 1532, 13, 4706, 1583, 29889, 17833, 29918, 7529, 353, 302, 29876, 29889, 9329, 29898, 7345, 305, 29889, 9502, 29876, 29898, 29896, 29900, 29892, 29871, 29896, 29900, 876, 13, 4706, 396, 591, 9273, 29915, 29873, 2302, 5685, 567, 363, 385, 443, 3880, 7546, 13, 4706, 1583, 29889, 348, 3880, 29918, 10660, 353, 302, 29876, 29889, 12697, 29898, 29906, 29892, 29871, 29906, 29892, 24003, 29922, 8824, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 714, 353, 1583, 29889, 20580, 29898, 29916, 29897, 13, 4706, 714, 353, 714, 29889, 1493, 29898, 449, 29889, 12181, 29961, 29900, 1402, 448, 29896, 29897, 13, 4706, 714, 353, 1583, 29889, 1545, 29898, 449, 29897, 13, 4706, 736, 1583, 29889, 10660, 29898, 449, 29897, 13, 13, 13, 1990, 4321, 3195, 29906, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 396, 1653, 263, 1904, 607, 337, 29899, 6394, 263, 3883, 313, 20580, 29918, 5453, 297, 445, 1206, 29897, 13, 4706, 7602, 29918, 5453, 353, 302, 29876, 29889, 1168, 29894, 29906, 29881, 29898, 29941, 29892, 29871, 29941, 29892, 313, 29906, 29892, 29871, 29906, 511, 24003, 29922, 8824, 29897, 13, 4706, 1583, 29889, 11762, 29918, 29896, 353, 302, 29876, 29889, 16941, 2556, 29898, 20580, 29918, 5453, 29897, 13, 4706, 1583, 29889, 11762, 29918, 29906, 353, 302, 29876, 29889, 16941, 2556, 29898, 20580, 29918, 5453, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 1583, 29889, 11762, 29918, 29896, 29898, 29916, 29897, 718, 1583, 29889, 11762, 29918, 29906, 29898, 29916, 29897, 13, 13, 13, 1990, 4321, 7355, 3047, 449, 29943, 417, 567, 29898, 15755, 29889, 7355, 1125, 13, 1678, 396, 445, 3883, 1838, 29915, 29873, 505, 383, 3927, 29925, 29879, 3342, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 921, 13, 13, 13, 1990, 4321, 7355, 3047, 29943, 417, 567, 29898, 15755, 29889, 7355, 1125, 13, 1678, 396, 445, 3883, 947, 505, 383, 3927, 29925, 29879, 3342, 13, 1678, 903, 29888, 417, 567, 353, 29871, 29896, 29906, 29941, 29946, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 1545, 353, 4321, 7355, 3047, 449, 29943, 417, 567, 580, 13, 4706, 396, 788, 263, 7602, 3883, 29936, 445, 9273, 29915, 29873, 10879, 278, 383, 3927, 29925, 29879, 1951, 591, 4529, 13, 4706, 396, 1583, 29889, 29888, 417, 567, 580, 13, 4706, 1583, 29889, 20580, 353, 302, 29876, 29889, 1168, 29894, 29906, 29881, 29898, 29941, 29892, 29871, 29941, 29892, 313, 29906, 29892, 29871, 29906, 876, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 1583, 29889, 20580, 29898, 29916, 29897, 13, 13, 1678, 822, 5685, 567, 29898, 1311, 29892, 921, 1125, 13, 4706, 736, 1583, 3032, 29888, 417, 567, 13, 13, 13, 1990, 4321, 1184, 1777, 261, 6678, 29879, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 19676, 537, 29918, 15807, 362, 29918, 690, 4622, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1904, 29918, 2917, 29879, 353, 679, 29918, 1688, 29918, 4299, 29918, 2917, 29879, 580, 13, 4706, 396, 1207, 1854, 727, 526, 2211, 2295, 29879, 4133, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 4299, 29918, 2917, 29879, 511, 29871, 29941, 29897, 13, 13, 4706, 396, 3806, 1819, 607, 2758, 9461, 29668, 800, 515, 1904, 3620, 13, 4706, 396, 591, 871, 1243, 472, 278, 29871, 29896, 29900, 29985, 29953, 6287, 13, 4706, 3806, 29918, 29885, 29918, 29888, 417, 567, 353, 518, 29946, 29896, 29906, 29906, 29892, 29871, 29955, 29947, 29945, 29900, 29892, 29871, 29947, 29900, 29941, 29946, 29962, 13, 4706, 3806, 29918, 29885, 29918, 7529, 353, 518, 29906, 29945, 29892, 29871, 29946, 29946, 29892, 29871, 29946, 29946, 29962, 13, 4706, 3806, 29918, 29885, 29918, 11236, 800, 353, 518, 29896, 29896, 29892, 29871, 29896, 29953, 29892, 29871, 29906, 29896, 29962, 13, 13, 4706, 363, 1904, 29918, 2917, 29892, 286, 29918, 29888, 417, 567, 29892, 286, 29918, 7529, 29892, 286, 29918, 11236, 800, 297, 14319, 29898, 13, 9651, 1904, 29918, 2917, 29879, 29892, 3806, 29918, 29885, 29918, 29888, 417, 567, 29892, 3806, 29918, 29885, 29918, 7529, 29892, 3806, 29918, 29885, 29918, 11236, 800, 13, 308, 1125, 13, 9651, 1904, 353, 2048, 29918, 4299, 29898, 4299, 29918, 2917, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 26017, 29918, 11236, 800, 29898, 4299, 29897, 849, 29871, 29896, 29900, 3579, 29871, 29953, 29892, 286, 29918, 11236, 800, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 26017, 29918, 29888, 417, 567, 29898, 4299, 29897, 849, 29871, 29896, 29900, 3579, 29871, 29953, 29892, 286, 29918, 29888, 417, 567, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 2798, 29918, 7529, 29898, 4299, 29897, 849, 29871, 29896, 29900, 3579, 29871, 29953, 29892, 286, 29918, 7529, 29897, 13, 13, 1678, 822, 1243, 29918, 19676, 537, 29918, 15807, 362, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1904, 353, 4321, 3195, 580, 13, 4706, 1881, 29918, 12181, 353, 313, 29941, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29897, 13, 4706, 954, 29918, 6146, 1516, 353, 29871, 29941, 334, 29871, 29896, 29900, 334, 29871, 29896, 29900, 13, 4706, 1583, 29889, 9294, 9843, 29898, 26017, 29918, 11236, 800, 29898, 4299, 29892, 1881, 29918, 12181, 29922, 2080, 29918, 12181, 511, 954, 29918, 6146, 1516, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 10272, 29918, 29888, 417, 567, 29898, 4299, 29892, 1881, 29918, 12181, 29922, 2080, 29918, 12181, 511, 13, 9651, 954, 29918, 6146, 1516, 13, 9651, 718, 29871, 29900, 13, 9651, 718, 313, 29941, 29900, 29900, 334, 29871, 29941, 29900, 29900, 511, 29871, 396, 4321, 7355, 718, 4321, 1168, 29894, 7355, 718, 4321, 3195, 29889, 10660, 29936, 13, 9651, 396, 4321, 3195, 29889, 348, 3880, 29918, 10660, 338, 443, 3880, 322, 9273, 29915, 29873, 367, 29115, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 2302, 29918, 7529, 29898, 4299, 511, 13, 9651, 313, 29906, 334, 29871, 29941, 29897, 718, 313, 29906, 334, 29871, 29941, 334, 29871, 29946, 334, 29871, 29946, 29897, 718, 313, 29946, 334, 29871, 29945, 29897, 718, 313, 29941, 29900, 29900, 334, 29871, 29941, 29900, 29900, 29897, 718, 313, 29896, 29900, 334, 29871, 29896, 29900, 29897, 718, 313, 29906, 334, 29871, 29906, 511, 13, 4706, 1723, 29871, 396, 4321, 7355, 29889, 10660, 718, 4321, 1168, 29894, 7355, 718, 4321, 1168, 29894, 7355, 29889, 10660, 718, 13, 4706, 396, 4321, 3195, 29889, 10660, 718, 4321, 3195, 29889, 17833, 29918, 7529, 718, 4321, 3195, 29889, 348, 3880, 29918, 10660, 13, 13, 4706, 396, 1243, 393, 591, 8147, 13644, 5149, 363, 263, 1904, 607, 337, 29899, 6394, 263, 3883, 13, 4706, 1904, 353, 4321, 3195, 29906, 580, 13, 4706, 297, 29918, 305, 12629, 353, 29871, 29941, 13, 4706, 714, 29918, 305, 12629, 353, 29871, 29941, 13, 4706, 714, 29918, 29882, 29892, 714, 29918, 29893, 353, 29871, 29929, 29892, 29871, 29929, 13, 4706, 8466, 29918, 29882, 29892, 8466, 29918, 29893, 353, 29871, 29906, 29892, 29871, 29906, 13, 4706, 7602, 29918, 29888, 417, 567, 353, 297, 29918, 305, 12629, 334, 714, 29918, 305, 12629, 334, 714, 29918, 29882, 334, 714, 29918, 29893, 334, 8466, 29918, 29882, 334, 8466, 29918, 29893, 13, 4706, 7602, 29918, 11236, 800, 353, 714, 29918, 305, 12629, 334, 714, 29918, 29882, 334, 714, 29918, 29893, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 10272, 29918, 11236, 800, 29898, 4299, 29892, 1881, 29918, 12181, 29922, 2080, 29918, 12181, 511, 7602, 29918, 11236, 800, 334, 29871, 29906, 13, 4706, 1723, 29871, 396, 278, 7602, 338, 7436, 8951, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 10272, 29918, 29888, 417, 567, 29898, 4299, 29892, 1881, 29918, 12181, 29922, 2080, 29918, 12181, 511, 7602, 29918, 29888, 417, 567, 334, 29871, 29906, 13, 4706, 1723, 29871, 396, 278, 7602, 338, 7436, 8951, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 2302, 29918, 7529, 29898, 4299, 511, 297, 29918, 305, 12629, 334, 714, 29918, 305, 12629, 334, 8466, 29918, 29882, 334, 8466, 29918, 29893, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 29888, 417, 567, 29918, 15807, 362, 29898, 1311, 1125, 13, 4706, 396, 1243, 393, 263, 1904, 6943, 263, 2888, 3883, 607, 1838, 29915, 29873, 505, 383, 3927, 29925, 29879, 3342, 13, 4706, 396, 1153, 4637, 385, 3682, 13, 4706, 1904, 353, 302, 29876, 29889, 16941, 2556, 29898, 3057, 7355, 3047, 449, 29943, 417, 567, 3101, 13, 4706, 1881, 29918, 12181, 353, 313, 29941, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29897, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 2451, 1125, 13, 9651, 10272, 29918, 29888, 417, 567, 29898, 4299, 29892, 1881, 29918, 12181, 29922, 2080, 29918, 12181, 29897, 13, 13, 4706, 396, 1243, 393, 263, 1904, 6943, 263, 2888, 3883, 947, 505, 383, 3927, 29925, 29879, 3342, 1736, 29892, 13, 4706, 396, 1584, 565, 278, 3883, 756, 4344, 607, 1016, 29915, 29873, 4529, 383, 3927, 29925, 29879, 13, 4706, 1904, 353, 302, 29876, 29889, 16941, 2556, 29898, 3057, 7355, 3047, 29943, 417, 567, 3101, 13, 4706, 1881, 29918, 12181, 353, 313, 29941, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 10272, 29918, 29888, 417, 567, 29898, 4299, 29892, 1881, 29918, 12181, 29922, 2080, 29918, 12181, 511, 4321, 7355, 3047, 29943, 417, 567, 3032, 29888, 417, 567, 13, 4706, 1723, 29871, 396, 278, 7602, 338, 7436, 8951, 13, 13, 13, 1990, 4321, 10739, 6678, 29879, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 657, 29918, 12181, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1051, 29918, 29916, 353, 518, 7345, 305, 29889, 3298, 359, 29898, 29906, 29892, 29871, 29946, 511, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29941, 4638, 13, 4706, 25834, 353, 679, 29918, 12181, 29898, 1761, 29918, 29916, 29897, 13, 4706, 3806, 29918, 845, 11603, 353, 518, 7345, 305, 29889, 3298, 359, 29898, 29906, 29892, 29871, 29946, 467, 2311, 3285, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29941, 467, 2311, 580, 29962, 13, 4706, 363, 8267, 29892, 3806, 297, 14319, 29898, 845, 11603, 29892, 3806, 29918, 845, 11603, 1125, 13, 9651, 1583, 29889, 9294, 9843, 29898, 12181, 29892, 3806, 29897, 13, 13, 4706, 9657, 29918, 29916, 353, 8853, 29916, 29896, 1115, 4842, 305, 29889, 3298, 359, 29898, 29906, 29892, 29871, 29946, 511, 376, 29916, 29906, 1115, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29941, 2915, 13, 4706, 25834, 353, 679, 29918, 12181, 29898, 8977, 29918, 29916, 29897, 13, 4706, 3806, 29918, 845, 11603, 353, 426, 13, 9651, 376, 29916, 29896, 1115, 4842, 305, 29889, 3298, 359, 29898, 29906, 29892, 29871, 29946, 467, 2311, 3285, 13, 9651, 376, 29916, 29906, 1115, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29941, 467, 2311, 3285, 13, 4706, 500, 13, 4706, 363, 413, 29892, 8267, 297, 25834, 29889, 7076, 7295, 13, 9651, 1583, 29889, 9294, 9843, 29898, 12181, 29892, 3806, 29918, 845, 11603, 29961, 29895, 2314, 13, 13, 4706, 1051, 29918, 8977, 29918, 29916, 353, 518, 13, 9651, 8853, 29916, 29896, 1115, 4842, 305, 29889, 3298, 359, 29898, 29906, 29892, 29871, 29946, 511, 376, 29916, 29906, 1115, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29941, 19230, 13, 9651, 8853, 29916, 29896, 1115, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29946, 511, 376, 29916, 29906, 1115, 4842, 305, 29889, 3298, 359, 29898, 29946, 29892, 29871, 29945, 19230, 13, 4706, 4514, 13, 4706, 25834, 353, 679, 29918, 12181, 29898, 1761, 29918, 8977, 29918, 29916, 29897, 13, 4706, 3806, 29918, 845, 11603, 353, 518, 13, 9651, 8853, 29916, 29896, 1115, 4842, 305, 29889, 3298, 359, 29898, 29906, 29892, 29871, 29946, 467, 2311, 3285, 376, 29916, 29906, 1115, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29941, 467, 2311, 580, 1118, 13, 9651, 8853, 29916, 29896, 1115, 4842, 305, 29889, 3298, 359, 29898, 29941, 29892, 29871, 29946, 467, 2311, 3285, 376, 29916, 29906, 1115, 4842, 305, 29889, 3298, 359, 29898, 29946, 29892, 29871, 29945, 467, 2311, 580, 1118, 13, 4706, 4514, 13, 4706, 363, 8267, 29892, 3806, 297, 14319, 29898, 845, 11603, 29892, 3806, 29918, 845, 11603, 1125, 13, 9651, 363, 413, 29892, 269, 297, 8267, 29889, 7076, 7295, 13, 18884, 1583, 29889, 9294, 9843, 29898, 29879, 29892, 3806, 29961, 29895, 2314, 13, 2 ]
app/replenishjob.py
RobbieSoutham/DanielBCF
0
192496
from app import database from app.database import Database import datetime from configparser import ConfigParser config = ConfigParser() def rep(): #Get delivery time from config config.read("app/config.ini") del_time = datetime.timedelta(days=int(config.get("Settings", "del_time"))) today = datetime.datetime.now().date() ordered_stock = Database.get("Stock") stock_out = [] for stock in ordered_stock: if stock[3] == None and stock[3] is not None: #Retrieve stock items that are out of stock stock_out.append(stock) for stock in stock_out: #If the delivery time has passed set the stock level as healthy print(stock[4]) if stock[4] - today >= del_time: Database.update("Stock", "stock_healthy", 1, "stock_healthy", "Null") rep()
[ 1, 515, 623, 1053, 2566, 13, 3166, 623, 29889, 9803, 1053, 5470, 13, 5215, 12865, 13, 3166, 2295, 16680, 1053, 12782, 11726, 13, 13, 2917, 353, 12782, 11726, 580, 13, 13, 1753, 1634, 7295, 13, 1678, 396, 2577, 28289, 931, 515, 2295, 13, 1678, 2295, 29889, 949, 703, 932, 29914, 2917, 29889, 2172, 1159, 13, 1678, 628, 29918, 2230, 353, 12865, 29889, 9346, 287, 2554, 29898, 16700, 29922, 524, 29898, 2917, 29889, 657, 703, 9585, 613, 376, 6144, 29918, 2230, 29908, 4961, 13, 1678, 9826, 353, 12865, 29889, 12673, 29889, 3707, 2141, 1256, 580, 13, 1678, 10372, 29918, 17712, 353, 5470, 29889, 657, 703, 20754, 384, 1159, 13, 1678, 10961, 29918, 449, 353, 5159, 13, 13, 1678, 363, 10961, 297, 10372, 29918, 17712, 29901, 13, 4706, 565, 10961, 29961, 29941, 29962, 1275, 6213, 322, 10961, 29961, 29941, 29962, 338, 451, 6213, 29901, 13, 9651, 396, 8015, 29878, 2418, 10961, 4452, 393, 526, 714, 310, 10961, 13, 9651, 10961, 29918, 449, 29889, 4397, 29898, 17712, 29897, 13, 13, 1678, 363, 10961, 297, 10961, 29918, 449, 29901, 13, 4706, 396, 3644, 278, 28289, 931, 756, 4502, 731, 278, 10961, 3233, 408, 9045, 29891, 13, 4706, 1596, 29898, 17712, 29961, 29946, 2314, 13, 4706, 565, 10961, 29961, 29946, 29962, 448, 9826, 6736, 628, 29918, 2230, 29901, 13, 9651, 5470, 29889, 5504, 703, 20754, 384, 613, 376, 17712, 29918, 354, 4298, 29891, 613, 29871, 29896, 29892, 376, 17712, 29918, 354, 4298, 29891, 613, 376, 7327, 1159, 13, 13, 3445, 580, 13, 2 ]
ModelServices/eventTriggerOutputDeviceMappingServices.py
tuanldchainos/HcPullData
0
119584
<reponame>tuanldchainos/HcPullData from Repository.eventTriggerOutputDeviceMappingRepo import eventTriggerOutputDeviceMappingRepo from sqlalchemy import Table from sqlalchemy.engine.base import Connection from sqlalchemy.sql.expression import BinaryExpression class eventTriggerOutputDeviceMappingServices(): __eventTriggerOutputDeviceMappingRepo: eventTriggerOutputDeviceMappingRepo def __init__(self, eventTriggerOutputDeviceMappingTable: Table, context: Connection): self.__eventTriggerOutputDeviceMappingRepo = eventTriggerOutputDeviceMappingRepo(eventTriggerOutputDeviceMappingTable, context=context) def AddManyEventTriggerOutputDeviceMappingWithCustomData(self, l: list): self.__eventTriggerOutputDeviceMappingRepo.InsertManyWithCustomData(l)
[ 1, 529, 276, 1112, 420, 29958, 9161, 273, 430, 14153, 359, 29914, 29950, 29883, 29925, 913, 1469, 13, 3166, 830, 7036, 29889, 3696, 20211, 6466, 11501, 15845, 5612, 29877, 1053, 1741, 20211, 6466, 11501, 15845, 5612, 29877, 13, 3166, 4576, 284, 305, 6764, 1053, 6137, 13, 3166, 4576, 284, 305, 6764, 29889, 10599, 29889, 3188, 1053, 15160, 13, 3166, 4576, 284, 305, 6764, 29889, 2850, 29889, 17471, 1053, 29479, 10960, 13, 13, 1990, 1741, 20211, 6466, 11501, 15845, 13779, 7295, 13, 1678, 4770, 3696, 20211, 6466, 11501, 15845, 5612, 29877, 29901, 1741, 20211, 6466, 11501, 15845, 5612, 29877, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1741, 20211, 6466, 11501, 15845, 3562, 29901, 6137, 29892, 3030, 29901, 15160, 1125, 13, 4706, 1583, 17255, 3696, 20211, 6466, 11501, 15845, 5612, 29877, 353, 1741, 20211, 6466, 11501, 15845, 5612, 29877, 29898, 3696, 20211, 6466, 11501, 15845, 3562, 29892, 3030, 29922, 4703, 29897, 13, 418, 13, 1678, 822, 3462, 14804, 2624, 20211, 6466, 11501, 15845, 3047, 7281, 1469, 29898, 1311, 29892, 301, 29901, 1051, 1125, 13, 4706, 1583, 17255, 3696, 20211, 6466, 11501, 15845, 5612, 29877, 29889, 17491, 14804, 3047, 7281, 1469, 29898, 29880, 29897, 1678, 2 ]
train/models.py
soymintc/brain_tumor_segmentation_web_service
1
1616968
<reponame>soymintc/brain_tumor_segmentation_web_service<gh_stars>1-10 import os import glob import psutil from django.db import models from django.conf import settings from django.contrib.auth import get_user_model from django.urls import reverse from django.core.validators import MaxValueValidator, MinValueValidator from django.core.exceptions import ValidationError def validate_optimizer(value): if value not in ['adam', 'sgd']: raise ValidationError("optimizer '{}' should be either adam or sgd".format(value)) class Train(models.Model): # Creation attrs author = models.ForeignKey( get_user_model(), on_delete=models.CASCADE, ) date = models.DateTimeField(auto_now_add=True) title = models.CharField(max_length=255) batch_size = models.PositiveIntegerField() image_size = models.PositiveIntegerField() n_validation = models.PositiveIntegerField() n_test = models.PositiveIntegerField() learning_rate = models.FloatField( validators=[MinValueValidator(1e-20), MaxValueValidator(1)],) optimizer = models.CharField(max_length=10, validators=[validate_optimizer]) group_size = models.PositiveIntegerField() filters_root = models.PositiveIntegerField() augment = models.BooleanField() # Non-input attrs pid = models.PositiveIntegerField(default=0, null=True, blank=True) tb_pid = models.PositiveIntegerField(default=0, null=True, blank=True) port = models.PositiveIntegerField(default=0, null=True, blank=True) # assign unused port cmd_str = models.CharField(max_length=1000, default='.', null=True, blank=True) def __str__(self): return self.title def pid_exists(self): return psutil.pid_exists(self.pid) def tb_pid_exists(self): return psutil.pid_exists(self.tb_pid) def run_phase(self): return self.pid == 0 def get_log_path(self): log_dir = os.path.join(settings.BASE_DIR, 'train', 'train_logs') return os.path.join(log_dir, self.title + '.log') def get_tb_log_dir(self): log_dir = os.path.join(settings.BASE_DIR, 'train', 'tb_logs', self.author.username) return log_dir def get_absolute_url(self): # page to return after save #return reverse('train_detail', args=[str(self.id)]) #return reverse('train_log', args=[self.pk]) return reverse('train_detail', args=[self.pk])
[ 1, 529, 276, 1112, 420, 29958, 578, 962, 524, 29883, 29914, 2634, 262, 29918, 29873, 398, 272, 29918, 28192, 362, 29918, 2676, 29918, 5509, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 13, 5215, 13149, 13, 5215, 6529, 4422, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 21570, 29889, 5150, 1053, 679, 29918, 1792, 29918, 4299, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 3166, 9557, 29889, 3221, 29889, 3084, 4097, 1053, 5918, 1917, 24204, 29892, 3080, 1917, 24204, 13, 3166, 9557, 29889, 3221, 29889, 11739, 29879, 1053, 15758, 362, 2392, 13, 13, 13, 13, 1753, 12725, 29918, 20640, 3950, 29898, 1767, 1125, 13, 1678, 565, 995, 451, 297, 6024, 328, 314, 742, 525, 5311, 29881, 2033, 29901, 13, 4706, 12020, 15758, 362, 2392, 703, 20640, 3950, 525, 8875, 29915, 881, 367, 2845, 594, 314, 470, 269, 29887, 29881, 1642, 4830, 29898, 1767, 876, 13, 13, 13, 1990, 28186, 29898, 9794, 29889, 3195, 1125, 13, 1678, 396, 6760, 362, 12421, 29879, 13, 1678, 4148, 353, 4733, 29889, 27755, 2558, 29898, 13, 4706, 679, 29918, 1792, 29918, 4299, 3285, 13, 4706, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 13, 1678, 1723, 13, 1678, 2635, 353, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29918, 1202, 29922, 5574, 29897, 13, 13, 1678, 3611, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 13, 1678, 9853, 29918, 2311, 353, 4733, 29889, 9135, 3321, 7798, 3073, 580, 13, 1678, 1967, 29918, 2311, 353, 4733, 29889, 9135, 3321, 7798, 3073, 580, 13, 1678, 302, 29918, 18157, 353, 4733, 29889, 9135, 3321, 7798, 3073, 580, 13, 1678, 302, 29918, 1688, 353, 4733, 29889, 9135, 3321, 7798, 3073, 580, 13, 13, 1678, 6509, 29918, 10492, 353, 4733, 29889, 11031, 3073, 29898, 13, 4706, 2854, 4097, 11759, 8140, 1917, 24204, 29898, 29896, 29872, 29899, 29906, 29900, 511, 5918, 1917, 24204, 29898, 29896, 29897, 1402, 29897, 13, 13, 1678, 5994, 3950, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29892, 2854, 4097, 11759, 15480, 29918, 20640, 3950, 2314, 13, 1678, 2318, 29918, 2311, 353, 4733, 29889, 9135, 3321, 7798, 3073, 580, 13, 1678, 18094, 29918, 4632, 353, 4733, 29889, 9135, 3321, 7798, 3073, 580, 13, 1678, 18765, 353, 4733, 29889, 18146, 3073, 580, 13, 13, 1678, 396, 10050, 29899, 2080, 12421, 29879, 13, 1678, 23107, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29892, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 1678, 260, 29890, 29918, 5935, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29892, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 1678, 2011, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29892, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 396, 3566, 443, 3880, 2011, 13, 1678, 9920, 29918, 710, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29900, 29900, 29892, 2322, 2433, 29889, 742, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 3257, 13, 268, 13, 1678, 822, 23107, 29918, 9933, 29898, 1311, 1125, 13, 4706, 736, 6529, 4422, 29889, 5935, 29918, 9933, 29898, 1311, 29889, 5935, 29897, 13, 13, 1678, 822, 260, 29890, 29918, 5935, 29918, 9933, 29898, 1311, 1125, 13, 4706, 736, 6529, 4422, 29889, 5935, 29918, 9933, 29898, 1311, 29889, 22625, 29918, 5935, 29897, 13, 13, 1678, 822, 1065, 29918, 21646, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 5935, 1275, 29871, 29900, 13, 13, 1678, 822, 679, 29918, 1188, 29918, 2084, 29898, 1311, 1125, 13, 4706, 1480, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 11027, 29889, 25416, 29918, 9464, 29892, 525, 14968, 742, 525, 14968, 29918, 20756, 1495, 13, 4706, 736, 2897, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29892, 1583, 29889, 3257, 718, 15300, 1188, 1495, 13, 13, 1678, 822, 679, 29918, 22625, 29918, 1188, 29918, 3972, 29898, 1311, 1125, 13, 4706, 1480, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 11027, 29889, 25416, 29918, 9464, 29892, 525, 14968, 742, 525, 22625, 29918, 20756, 742, 1583, 29889, 8921, 29889, 6786, 29897, 13, 4706, 736, 1480, 29918, 3972, 13, 13, 1678, 822, 679, 29918, 23552, 29918, 2271, 29898, 1311, 1125, 396, 1813, 304, 736, 1156, 4078, 13, 4706, 396, 2457, 11837, 877, 14968, 29918, 16432, 742, 6389, 11759, 710, 29898, 1311, 29889, 333, 29897, 2314, 13, 4706, 396, 2457, 11837, 877, 14968, 29918, 1188, 742, 6389, 11759, 1311, 29889, 20571, 2314, 13, 4706, 736, 11837, 877, 14968, 29918, 16432, 742, 6389, 11759, 1311, 29889, 20571, 2314, 13, 13, 268, 13, 13, 2 ]
text/opencv_dnn_detect.py
kingemma/invoice
1,017
39174
<filename>text/opencv_dnn_detect.py from config import yoloCfg,yoloWeights,opencvFlag from config import AngleModelPb,AngleModelPbtxt from config import IMGSIZE from PIL import Image import numpy as np import cv2 if opencvFlag=='keras': ##转换为tf模型,以便GPU调用 import tensorflow as tf from tensorflow.python.platform import gfile config = tf.ConfigProto(allow_soft_placement=True) sess = tf.Session(config=config) with gfile.FastGFile(AngleModelPb, 'rb') as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) sess.graph.as_default() tf.import_graph_def(graph_def, name='') inputImg = sess.graph.get_tensor_by_name('input_1:0') predictions = sess.graph.get_tensor_by_name('predictions/Softmax:0') keep_prob = tf.placeholder(tf.float32) else: angleNet = cv2.dnn.readNetFromTensorflow(AngleModelPb,AngleModelPbtxt)##dnn 文字方向检测 textNet = cv2.dnn.readNetFromDarknet(yoloCfg,yoloWeights)##文字定位 def text_detect(img): thresh=0 h,w = img.shape[:2] inputBlob = cv2.dnn.blobFromImage(img, scalefactor=0.00390625, size=IMGSIZE,swapRB=True ,crop=False); textNet.setInput(inputBlob) pred = textNet.forward() cx = pred[:,0]*w cy = pred[:,1]*h xmin = cx - pred[:,2]*w/2 xmax = cx + pred[:,2]*w/2 ymin = cy - pred[:,3]*h/2 ymax = cy + pred[:,3]*h/2 scores = pred[:,4] indx = np.where(scores>thresh)[0] scores = scores[indx] boxes = np.array(list(zip(xmin[indx],ymin[indx],xmax[indx],ymax[indx]))) return boxes,scores def angle_detect_dnn(img,adjust=True): """ 文字方向检测 """ h,w = img.shape[:2] ROTATE = [0,90,180,270] if adjust: thesh = 0.05 xmin,ymin,xmax,ymax = int(thesh*w),int(thesh*h),w-int(thesh*w),h-int(thesh*h) img = img[ymin:ymax,xmin:xmax]##剪切图片边缘 inputBlob = cv2.dnn.blobFromImage(img, scalefactor=1.0, size=(224, 224), swapRB=True , mean=[103.939,116.779,123.68],crop=False); angleNet.setInput(inputBlob) pred = angleNet.forward() index = np.argmax(pred,axis=1)[0] return ROTATE[index] def angle_detect_tf(img,adjust=True): """ 文字方向检测 """ h,w = img.shape[:2] ROTATE = [0,90,180,270] if adjust: thesh = 0.05 xmin,ymin,xmax,ymax = int(thesh*w),int(thesh*h),w-int(thesh*w),h-int(thesh*h) img = img[ymin:ymax,xmin:xmax]##剪切图片边缘 img = cv2.resize(img,(224,224)) img = img[..., ::-1].astype(np.float32) img[..., 0] -= 103.939 img[..., 1] -= 116.779 img[..., 2] -= 123.68 img = np.array([img]) out = sess.run(predictions, feed_dict={inputImg: img, keep_prob: 0 }) index = np.argmax(out,axis=1)[0] return ROTATE[index] def angle_detect(img,adjust=True): """ 文字方向检测 """ if opencvFlag=='keras': return angle_detect_tf(img,adjust=adjust) else: return angle_detect_dnn(img,adjust=adjust)
[ 1, 529, 9507, 29958, 726, 29914, 3150, 11023, 29918, 5200, 29876, 29918, 4801, 522, 29889, 2272, 13, 3166, 2295, 1053, 343, 3543, 29907, 16434, 29892, 29891, 3543, 4806, 5861, 29892, 3150, 11023, 21979, 13, 3166, 2295, 1053, 3218, 280, 3195, 29925, 29890, 29892, 19582, 3195, 29925, 3116, 486, 13, 3166, 2295, 1053, 22313, 29954, 14226, 13, 3166, 349, 6227, 1053, 7084, 13, 5215, 12655, 408, 7442, 13, 5215, 13850, 29906, 13, 13, 361, 1722, 11023, 21979, 1360, 29915, 3946, 294, 2396, 13, 1678, 444, 31415, 31640, 30573, 13264, 31382, 30883, 30214, 30651, 231, 193, 194, 29954, 7056, 31268, 30406, 13, 1678, 1053, 26110, 408, 15886, 13, 1678, 515, 26110, 29889, 4691, 29889, 12120, 1053, 330, 1445, 13, 1678, 2295, 353, 15886, 29889, 3991, 1184, 517, 29898, 9536, 29918, 2695, 29918, 29886, 9552, 29922, 5574, 29897, 13, 1678, 27937, 353, 15886, 29889, 7317, 29898, 2917, 29922, 2917, 29897, 13, 1678, 411, 330, 1445, 29889, 29943, 579, 29954, 2283, 29898, 19582, 3195, 29925, 29890, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 9651, 3983, 29918, 1753, 353, 15886, 29889, 9527, 3206, 580, 13, 9651, 3983, 29918, 1753, 29889, 12914, 4591, 1231, 29898, 29888, 29889, 949, 3101, 13, 9651, 27937, 29889, 4262, 29889, 294, 29918, 4381, 580, 13, 9651, 15886, 29889, 5215, 29918, 4262, 29918, 1753, 29898, 4262, 29918, 1753, 29892, 1024, 2433, 1495, 13, 1678, 1881, 25518, 353, 29871, 27937, 29889, 4262, 29889, 657, 29918, 20158, 29918, 1609, 29918, 978, 877, 2080, 29918, 29896, 29901, 29900, 1495, 13, 1678, 27303, 353, 27937, 29889, 4262, 29889, 657, 29918, 20158, 29918, 1609, 29918, 978, 877, 27711, 1080, 29914, 6295, 615, 3317, 29901, 29900, 1495, 13, 1678, 3013, 29918, 22795, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29897, 13, 13, 268, 13, 2870, 29901, 13, 259, 10696, 6779, 353, 13850, 29906, 29889, 5200, 29876, 29889, 949, 6779, 4591, 29911, 6073, 1731, 29898, 19582, 3195, 29925, 29890, 29892, 19582, 3195, 29925, 3116, 486, 29897, 2277, 5200, 29876, 29871, 30333, 30578, 30525, 31331, 233, 166, 131, 31851, 13, 726, 6779, 29871, 353, 13850, 29906, 29889, 5200, 29876, 29889, 949, 6779, 4591, 29928, 935, 1212, 29898, 29891, 3543, 29907, 16434, 29892, 29891, 3543, 4806, 5861, 29897, 2277, 30333, 30578, 30495, 30956, 13, 1753, 1426, 29918, 4801, 522, 29898, 2492, 1125, 13, 1678, 266, 3781, 29922, 29900, 13, 1678, 298, 29892, 29893, 353, 10153, 29889, 12181, 7503, 29906, 29962, 13, 268, 13, 1678, 1881, 29933, 2127, 353, 13850, 29906, 29889, 5200, 29876, 29889, 10054, 4591, 2940, 29898, 2492, 29892, 6287, 19790, 29922, 29900, 29889, 29900, 29900, 29941, 29929, 29900, 29953, 29906, 29945, 29892, 2159, 29922, 7833, 29954, 14226, 29892, 26276, 29934, 29933, 29922, 5574, 1919, 29883, 1336, 29922, 8824, 416, 13, 1678, 1426, 6779, 29889, 842, 4290, 29898, 2080, 29933, 2127, 29897, 13, 1678, 4450, 353, 1426, 6779, 29889, 11333, 580, 13, 1678, 28232, 353, 4450, 7503, 29892, 29900, 14178, 29893, 13, 1678, 5094, 353, 4450, 7503, 29892, 29896, 14178, 29882, 13, 1678, 921, 1195, 353, 28232, 448, 4450, 7503, 29892, 29906, 14178, 29893, 29914, 29906, 13, 1678, 921, 3317, 353, 28232, 718, 4450, 7503, 29892, 29906, 14178, 29893, 29914, 29906, 13, 1678, 343, 1195, 353, 5094, 448, 4450, 7503, 29892, 29941, 14178, 29882, 29914, 29906, 13, 1678, 343, 3317, 353, 5094, 718, 4450, 7503, 29892, 29941, 14178, 29882, 29914, 29906, 13, 1678, 19435, 353, 4450, 7503, 29892, 29946, 29962, 13, 1678, 1399, 29916, 353, 7442, 29889, 3062, 29898, 1557, 2361, 29958, 386, 3781, 9601, 29900, 29962, 13, 1678, 19435, 353, 19435, 29961, 513, 29916, 29962, 13, 1678, 16273, 353, 7442, 29889, 2378, 29898, 1761, 29898, 7554, 29898, 29916, 1195, 29961, 513, 29916, 1402, 962, 262, 29961, 513, 29916, 1402, 29916, 3317, 29961, 513, 29916, 1402, 29891, 3317, 29961, 513, 29916, 29962, 4961, 13, 1678, 736, 16273, 29892, 1557, 2361, 13, 13, 13, 1753, 10696, 29918, 4801, 522, 29918, 5200, 29876, 29898, 2492, 29892, 328, 5143, 29922, 5574, 1125, 13, 1678, 9995, 13, 268, 30333, 30578, 30525, 31331, 233, 166, 131, 31851, 13, 1678, 9995, 13, 1678, 298, 29892, 29893, 353, 10153, 29889, 12181, 7503, 29906, 29962, 13, 1678, 390, 2891, 3040, 353, 518, 29900, 29892, 29929, 29900, 29892, 29896, 29947, 29900, 29892, 29906, 29955, 29900, 29962, 13, 1678, 565, 10365, 29901, 13, 539, 266, 12094, 353, 29871, 29900, 29889, 29900, 29945, 13, 539, 921, 1195, 29892, 962, 262, 29892, 29916, 3317, 29892, 29891, 3317, 353, 938, 29898, 386, 12094, 29930, 29893, 511, 524, 29898, 386, 12094, 29930, 29882, 511, 29893, 29899, 524, 29898, 386, 12094, 29930, 29893, 511, 29882, 29899, 524, 29898, 386, 12094, 29930, 29882, 29897, 13, 539, 10153, 353, 10153, 29961, 962, 262, 29901, 29891, 3317, 29892, 29916, 1195, 29901, 29916, 3317, 29962, 2277, 232, 140, 173, 31757, 30861, 31122, 31993, 234, 191, 155, 13, 268, 13, 268, 13, 1678, 1881, 29933, 2127, 353, 13850, 29906, 29889, 5200, 29876, 29889, 10054, 4591, 2940, 29898, 2492, 29892, 29871, 13, 462, 462, 418, 6287, 19790, 29922, 29896, 29889, 29900, 29892, 29871, 13, 462, 462, 418, 2159, 7607, 29906, 29906, 29946, 29892, 29871, 29906, 29906, 29946, 511, 13, 462, 462, 418, 17945, 29934, 29933, 29922, 5574, 1919, 13, 462, 462, 418, 2099, 11759, 29896, 29900, 29941, 29889, 29929, 29941, 29929, 29892, 29896, 29896, 29953, 29889, 29955, 29955, 29929, 29892, 29896, 29906, 29941, 29889, 29953, 29947, 1402, 29883, 1336, 29922, 8824, 416, 13, 1678, 10696, 6779, 29889, 842, 4290, 29898, 2080, 29933, 2127, 29897, 13, 1678, 4450, 353, 10696, 6779, 29889, 11333, 580, 13, 1678, 2380, 353, 7442, 29889, 1191, 3317, 29898, 11965, 29892, 8990, 29922, 29896, 9601, 29900, 29962, 13, 1678, 736, 390, 2891, 3040, 29961, 2248, 29962, 13, 13, 13, 1753, 10696, 29918, 4801, 522, 29918, 13264, 29898, 2492, 29892, 328, 5143, 29922, 5574, 1125, 13, 1678, 9995, 13, 268, 30333, 30578, 30525, 31331, 233, 166, 131, 31851, 13, 1678, 9995, 13, 1678, 298, 29892, 29893, 353, 10153, 29889, 12181, 7503, 29906, 29962, 13, 1678, 390, 2891, 3040, 353, 518, 29900, 29892, 29929, 29900, 29892, 29896, 29947, 29900, 29892, 29906, 29955, 29900, 29962, 13, 1678, 565, 10365, 29901, 13, 539, 266, 12094, 353, 29871, 29900, 29889, 29900, 29945, 13, 539, 921, 1195, 29892, 962, 262, 29892, 29916, 3317, 29892, 29891, 3317, 353, 938, 29898, 386, 12094, 29930, 29893, 511, 524, 29898, 386, 12094, 29930, 29882, 511, 29893, 29899, 524, 29898, 386, 12094, 29930, 29893, 511, 29882, 29899, 524, 29898, 386, 12094, 29930, 29882, 29897, 13, 539, 10153, 353, 10153, 29961, 962, 262, 29901, 29891, 3317, 29892, 29916, 1195, 29901, 29916, 3317, 29962, 2277, 232, 140, 173, 31757, 30861, 31122, 31993, 234, 191, 155, 13, 1678, 10153, 353, 13850, 29906, 29889, 21476, 29898, 2492, 22657, 29906, 29906, 29946, 29892, 29906, 29906, 29946, 876, 13, 1678, 10153, 353, 10153, 29961, 16361, 4761, 29899, 29896, 1822, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 29897, 13, 308, 13, 1678, 10153, 29961, 16361, 29871, 29900, 29962, 22361, 29871, 29896, 29900, 29941, 29889, 29929, 29941, 29929, 13, 1678, 10153, 29961, 16361, 29871, 29896, 29962, 22361, 29871, 29896, 29896, 29953, 29889, 29955, 29955, 29929, 13, 1678, 10153, 29961, 16361, 29871, 29906, 29962, 22361, 29871, 29896, 29906, 29941, 29889, 29953, 29947, 13, 1678, 10153, 3986, 353, 7442, 29889, 2378, 4197, 2492, 2314, 13, 308, 13, 268, 13, 268, 13, 1678, 714, 353, 27937, 29889, 3389, 29898, 27711, 1080, 29892, 8343, 29918, 8977, 3790, 2080, 25518, 29901, 10153, 29892, 13, 462, 462, 795, 3013, 29918, 22795, 29901, 29871, 29900, 13, 462, 462, 632, 5615, 13, 268, 13, 13, 1678, 2380, 353, 7442, 29889, 1191, 3317, 29898, 449, 29892, 8990, 29922, 29896, 9601, 29900, 29962, 13, 1678, 736, 390, 2891, 3040, 29961, 2248, 29962, 13, 13, 1753, 10696, 29918, 4801, 522, 29898, 2492, 29892, 328, 5143, 29922, 5574, 1125, 13, 1678, 9995, 13, 268, 30333, 30578, 30525, 31331, 233, 166, 131, 31851, 13, 1678, 9995, 13, 1678, 565, 1722, 11023, 21979, 1360, 29915, 3946, 294, 2396, 13, 4706, 736, 10696, 29918, 4801, 522, 29918, 13264, 29898, 2492, 29892, 328, 5143, 29922, 328, 5143, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 10696, 29918, 4801, 522, 29918, 5200, 29876, 29898, 2492, 29892, 328, 5143, 29922, 328, 5143, 29897, 2 ]
ooobuild/csslo/view/__init__.py
Amourspirit/ooo_uno_tmpl
0
163570
<reponame>Amourspirit/ooo_uno_tmpl # coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http: // www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # from ...lo.view.document_zoom_type import DocumentZoomType as DocumentZoomType from ...lo.view.duplex_mode import DuplexMode as DuplexMode from ...lo.view.office_document_view import OfficeDocumentView as OfficeDocumentView from ...lo.view.paper_format import PaperFormat as PaperFormat from ...lo.view.paper_orientation import PaperOrientation as PaperOrientation from ...lo.view.print_job_event import PrintJobEvent as PrintJobEvent from ...lo.view.print_options import PrintOptions as PrintOptions from ...lo.view.print_settings import PrintSettings as PrintSettings from ...lo.view.printable_state import PrintableState as PrintableState from ...lo.view.printable_state_event import PrintableStateEvent as PrintableStateEvent from ...lo.view.printer_descriptor import PrinterDescriptor as PrinterDescriptor from ...lo.view.render_descriptor import RenderDescriptor as RenderDescriptor from ...lo.view.render_options import RenderOptions as RenderOptions from ...lo.view.selection_type import SelectionType as SelectionType from ...lo.view.view_settings import ViewSettings as ViewSettings from ...lo.view.x_control_access import XControlAccess as XControlAccess from ...lo.view.x_form_layer_access import XFormLayerAccess as XFormLayerAccess from ...lo.view.x_line_cursor import XLineCursor as XLineCursor from ...lo.view.x_multi_selection_supplier import XMultiSelectionSupplier as XMultiSelectionSupplier from ...lo.view.x_print_job import XPrintJob as XPrintJob from ...lo.view.x_print_job_broadcaster import XPrintJobBroadcaster as XPrintJobBroadcaster from ...lo.view.x_print_job_listener import XPrintJobListener as XPrintJobListener from ...lo.view.x_print_settings_supplier import XPrintSettingsSupplier as XPrintSettingsSupplier from ...lo.view.x_printable import XPrintable as XPrintable from ...lo.view.x_printable_broadcaster import XPrintableBroadcaster as XPrintableBroadcaster from ...lo.view.x_printable_listener import XPrintableListener as XPrintableListener from ...lo.view.x_renderable import XRenderable as XRenderable from ...lo.view.x_screen_cursor import XScreenCursor as XScreenCursor from ...lo.view.x_selection_change_listener import XSelectionChangeListener as XSelectionChangeListener from ...lo.view.x_selection_supplier import XSelectionSupplier as XSelectionSupplier from ...lo.view.x_view_cursor import XViewCursor as XViewCursor from ...lo.view.x_view_settings_supplier import XViewSettingsSupplier as XViewSettingsSupplier
[ 1, 529, 276, 1112, 420, 29958, 6833, 473, 1028, 14987, 29914, 3634, 29877, 29918, 9447, 29918, 18276, 572, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29906, 584, 4297, 719, 29899, 1349, 18902, 29899, 18275, 29901, 341, 2209, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1159, 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, 29901, 849, 7821, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 3166, 2023, 417, 29889, 1493, 29889, 3225, 29918, 2502, 290, 29918, 1853, 1053, 10854, 29999, 29667, 1542, 408, 10854, 29999, 29667, 1542, 13, 3166, 2023, 417, 29889, 1493, 29889, 700, 10709, 29918, 8513, 1053, 5334, 10709, 6818, 408, 5334, 10709, 6818, 13, 3166, 2023, 417, 29889, 1493, 29889, 20205, 29918, 3225, 29918, 1493, 1053, 11367, 6268, 1043, 408, 11367, 6268, 1043, 13, 3166, 2023, 417, 29889, 1493, 29889, 19773, 29918, 4830, 1053, 349, 7202, 5809, 408, 349, 7202, 5809, 13, 3166, 2023, 417, 29889, 1493, 29889, 19773, 29918, 20659, 1053, 349, 7202, 25231, 408, 349, 7202, 25231, 13, 3166, 2023, 417, 29889, 1493, 29889, 2158, 29918, 9057, 29918, 3696, 1053, 13905, 11947, 2624, 408, 13905, 11947, 2624, 13, 3166, 2023, 417, 29889, 1493, 29889, 2158, 29918, 6768, 1053, 13905, 5856, 408, 13905, 5856, 13, 3166, 2023, 417, 29889, 1493, 29889, 2158, 29918, 11027, 1053, 13905, 9585, 408, 13905, 9585, 13, 3166, 2023, 417, 29889, 1493, 29889, 2158, 519, 29918, 3859, 1053, 13905, 519, 2792, 408, 13905, 519, 2792, 13, 3166, 2023, 417, 29889, 1493, 29889, 2158, 519, 29918, 3859, 29918, 3696, 1053, 13905, 519, 2792, 2624, 408, 13905, 519, 2792, 2624, 13, 3166, 2023, 417, 29889, 1493, 29889, 558, 1639, 29918, 2783, 11709, 1053, 1588, 1639, 19124, 408, 1588, 1639, 19124, 13, 3166, 2023, 417, 29889, 1493, 29889, 9482, 29918, 2783, 11709, 1053, 26000, 19124, 408, 26000, 19124, 13, 3166, 2023, 417, 29889, 1493, 29889, 9482, 29918, 6768, 1053, 26000, 5856, 408, 26000, 5856, 13, 3166, 2023, 417, 29889, 1493, 29889, 21731, 29918, 1853, 1053, 27930, 1542, 408, 27930, 1542, 13, 3166, 2023, 417, 29889, 1493, 29889, 1493, 29918, 11027, 1053, 4533, 9585, 408, 4533, 9585, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 6451, 29918, 5943, 1053, 1060, 4809, 6638, 408, 1060, 4809, 6638, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 689, 29918, 13148, 29918, 5943, 1053, 1060, 2500, 14420, 6638, 408, 1060, 2500, 14420, 6638, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 1220, 29918, 18127, 1053, 1060, 3542, 19890, 408, 1060, 3542, 19890, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 9910, 29918, 21731, 29918, 19303, 4926, 1053, 1060, 15329, 15097, 20182, 4926, 408, 1060, 15329, 15097, 20182, 4926, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 2158, 29918, 9057, 1053, 1060, 11816, 11947, 408, 1060, 11816, 11947, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 2158, 29918, 9057, 29918, 6729, 328, 29883, 1901, 1053, 1060, 11816, 11947, 29933, 9972, 29883, 1901, 408, 1060, 11816, 11947, 29933, 9972, 29883, 1901, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 2158, 29918, 9057, 29918, 25894, 1053, 1060, 11816, 11947, 3962, 408, 1060, 11816, 11947, 3962, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 2158, 29918, 11027, 29918, 19303, 4926, 1053, 1060, 11816, 9585, 20182, 4926, 408, 1060, 11816, 9585, 20182, 4926, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 2158, 519, 1053, 1060, 11816, 519, 408, 1060, 11816, 519, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 2158, 519, 29918, 6729, 328, 29883, 1901, 1053, 1060, 11816, 519, 29933, 9972, 29883, 1901, 408, 1060, 11816, 519, 29933, 9972, 29883, 1901, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 2158, 519, 29918, 25894, 1053, 1060, 11816, 519, 3962, 408, 1060, 11816, 519, 3962, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 9482, 519, 1053, 1060, 10716, 519, 408, 1060, 10716, 519, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 10525, 29918, 18127, 1053, 1060, 11357, 19890, 408, 1060, 11357, 19890, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 21731, 29918, 3167, 29918, 25894, 1053, 1060, 15097, 7277, 3962, 408, 1060, 15097, 7277, 3962, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 21731, 29918, 19303, 4926, 1053, 1060, 15097, 20182, 4926, 408, 1060, 15097, 20182, 4926, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 1493, 29918, 18127, 1053, 1060, 1043, 19890, 408, 1060, 1043, 19890, 13, 3166, 2023, 417, 29889, 1493, 29889, 29916, 29918, 1493, 29918, 11027, 29918, 19303, 4926, 1053, 1060, 1043, 9585, 20182, 4926, 408, 1060, 1043, 9585, 20182, 4926, 13, 2 ]
laa_court_data_api_app/models/ping.py
ministryofjustice/laa-court-data-api
1
74687
from typing import Optional from pydantic import BaseModel, Field class Ping(BaseModel): app_branch: Optional[str] = Field(None, example='test_branch') build_date: Optional[str] = Field(None, example='02022022') build_tag: Optional[str] = Field(None, example='test') commit_id: Optional[str] = Field(None, example='123456')
[ 1, 515, 19229, 1053, 28379, 13, 3166, 282, 2941, 7716, 1053, 7399, 3195, 29892, 8989, 13, 13, 13, 1990, 349, 292, 29898, 5160, 3195, 1125, 13, 1678, 623, 29918, 17519, 29901, 28379, 29961, 710, 29962, 353, 8989, 29898, 8516, 29892, 1342, 2433, 1688, 29918, 17519, 1495, 13, 1678, 2048, 29918, 1256, 29901, 28379, 29961, 710, 29962, 353, 8989, 29898, 8516, 29892, 1342, 2433, 29900, 29906, 29900, 29906, 29906, 29900, 29906, 29906, 1495, 13, 1678, 2048, 29918, 4039, 29901, 28379, 29961, 710, 29962, 353, 8989, 29898, 8516, 29892, 1342, 2433, 1688, 1495, 13, 1678, 9063, 29918, 333, 29901, 28379, 29961, 710, 29962, 353, 8989, 29898, 8516, 29892, 1342, 2433, 29896, 29906, 29941, 29946, 29945, 29953, 1495, 13, 2 ]
tests/test_linalg/test_solvers/test_probabilistic_linear_solver/test_symmetric.py
fxbriol/probnum
0
76261
<reponame>fxbriol/probnum """Tests for probabilistic linear solvers applied to symmetric linear systems.""" import pathlib import numpy as np from pytest_cases import parametrize_with_cases from probnum import linops, problems, randvars from probnum.linalg.solvers import ProbabilisticLinearSolver, beliefs case_modules = pathlib.Path("cases").stem cases_solvers = case_modules + ".solvers" cases_beliefs = case_modules + ".beliefs" cases_problems = case_modules + ".problems" @parametrize_with_cases("solver", cases=cases_solvers, has_tag="sym") @parametrize_with_cases("prior", cases=cases_beliefs, has_tag="sym") @parametrize_with_cases("problem", cases=cases_problems, has_tag="sym") def test_small_residual( solver: ProbabilisticLinearSolver, prior: beliefs.LinearSystemBelief, problem: problems.LinearSystem, ): """Test whether the output solution has small residual.""" belief, _ = solver.solve( prior=prior, problem=problem, rng=np.random.default_rng(42) ) residual_norm = np.linalg.norm(problem.b - problem.A @ belief.x.mean, ord=2) assert residual_norm < 1e-5 or residual_norm < 1e-5 * np.linalg.norm( problem.b, ord=2 ) @parametrize_with_cases("solver", cases=cases_solvers, has_tag="sym") @parametrize_with_cases("problem", cases=cases_problems, has_tag="sym") def test_perfect_information( solver: ProbabilisticLinearSolver, problem: problems.LinearSystem, ncols: int ): """Test whether a solver given perfect information converges instantly.""" # Construct prior belief with perfect information belief = beliefs.LinearSystemBelief( x=randvars.Normal( mean=problem.solution, cov=linops.Scaling(factors=0.0, shape=(ncols, ncols)) ), A=randvars.Constant(problem.A), Ainv=randvars.Constant(np.linalg.inv(problem.A @ np.eye(ncols))), ) # Run solver belief, solver_state = solver.solve( prior=belief, problem=problem, rng=np.random.default_rng(1) ) # Check for instant convergence assert solver_state.step == 0 np.testing.assert_allclose(belief.x.mean, problem.solution)
[ 1, 529, 276, 1112, 420, 29958, 11093, 29890, 374, 324, 29914, 22795, 1949, 13, 15945, 29908, 24376, 363, 23950, 4695, 5608, 899, 874, 7436, 304, 18348, 5608, 6757, 1213, 15945, 13, 5215, 2224, 1982, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 11451, 1688, 29918, 11436, 1053, 25011, 374, 911, 29918, 2541, 29918, 11436, 13, 13, 3166, 2070, 1949, 1053, 6276, 3554, 29892, 4828, 29892, 20088, 16908, 13, 3166, 2070, 1949, 29889, 29880, 979, 29887, 29889, 2929, 874, 1053, 1019, 29890, 4427, 4695, 12697, 13296, 369, 29892, 17750, 29879, 13, 13, 4878, 29918, 7576, 353, 2224, 1982, 29889, 2605, 703, 11436, 2564, 303, 331, 13, 11436, 29918, 2929, 874, 353, 1206, 29918, 7576, 718, 11393, 2929, 874, 29908, 13, 11436, 29918, 6596, 2575, 29879, 353, 1206, 29918, 7576, 718, 11393, 6596, 2575, 29879, 29908, 13, 11436, 29918, 17199, 29879, 353, 1206, 29918, 7576, 718, 11393, 17199, 29879, 29908, 13, 13, 13, 29992, 3207, 300, 374, 911, 29918, 2541, 29918, 11436, 703, 2929, 369, 613, 4251, 29922, 11436, 29918, 2929, 874, 29892, 756, 29918, 4039, 543, 11967, 1159, 13, 29992, 3207, 300, 374, 911, 29918, 2541, 29918, 11436, 703, 29886, 13479, 613, 4251, 29922, 11436, 29918, 6596, 2575, 29879, 29892, 756, 29918, 4039, 543, 11967, 1159, 13, 29992, 3207, 300, 374, 911, 29918, 2541, 29918, 11436, 703, 17199, 613, 4251, 29922, 11436, 29918, 17199, 29879, 29892, 756, 29918, 4039, 543, 11967, 1159, 13, 1753, 1243, 29918, 9278, 29918, 690, 333, 950, 29898, 13, 1678, 899, 369, 29901, 1019, 29890, 4427, 4695, 12697, 13296, 369, 29892, 13, 1678, 7536, 29901, 17750, 29879, 29889, 12697, 3924, 21140, 2575, 29892, 13, 1678, 1108, 29901, 4828, 29889, 12697, 3924, 29892, 13, 1125, 13, 1678, 9995, 3057, 3692, 278, 1962, 1650, 756, 2319, 10995, 950, 1213, 15945, 13, 1678, 17750, 29892, 903, 353, 899, 369, 29889, 2929, 345, 29898, 13, 4706, 7536, 29922, 29886, 13479, 29892, 1108, 29922, 17199, 29892, 364, 865, 29922, 9302, 29889, 8172, 29889, 4381, 29918, 29878, 865, 29898, 29946, 29906, 29897, 13, 1678, 1723, 13, 13, 1678, 10995, 950, 29918, 12324, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 17199, 29889, 29890, 448, 1108, 29889, 29909, 732, 17750, 29889, 29916, 29889, 12676, 29892, 4356, 29922, 29906, 29897, 13, 13, 1678, 4974, 10995, 950, 29918, 12324, 529, 29871, 29896, 29872, 29899, 29945, 470, 10995, 950, 29918, 12324, 529, 29871, 29896, 29872, 29899, 29945, 334, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 13, 4706, 1108, 29889, 29890, 29892, 4356, 29922, 29906, 13, 1678, 1723, 13, 13, 13, 29992, 3207, 300, 374, 911, 29918, 2541, 29918, 11436, 703, 2929, 369, 613, 4251, 29922, 11436, 29918, 2929, 874, 29892, 756, 29918, 4039, 543, 11967, 1159, 13, 29992, 3207, 300, 374, 911, 29918, 2541, 29918, 11436, 703, 17199, 613, 4251, 29922, 11436, 29918, 17199, 29879, 29892, 756, 29918, 4039, 543, 11967, 1159, 13, 1753, 1243, 29918, 546, 3647, 29918, 19678, 29898, 13, 1678, 899, 369, 29901, 1019, 29890, 4427, 4695, 12697, 13296, 369, 29892, 1108, 29901, 4828, 29889, 12697, 3924, 29892, 302, 22724, 29901, 938, 13, 1125, 13, 1678, 9995, 3057, 3692, 263, 899, 369, 2183, 4922, 2472, 24144, 26232, 1213, 15945, 13, 13, 1678, 396, 1281, 4984, 7536, 17750, 411, 4922, 2472, 13, 1678, 17750, 353, 17750, 29879, 29889, 12697, 3924, 21140, 2575, 29898, 13, 4706, 921, 29922, 9502, 16908, 29889, 19077, 29898, 13, 9651, 2099, 29922, 17199, 29889, 2929, 918, 29892, 18838, 29922, 1915, 3554, 29889, 29636, 292, 29898, 17028, 943, 29922, 29900, 29889, 29900, 29892, 8267, 7607, 29876, 22724, 29892, 302, 22724, 876, 13, 4706, 10353, 13, 4706, 319, 29922, 9502, 16908, 29889, 12075, 424, 29898, 17199, 29889, 29909, 511, 13, 4706, 319, 11569, 29922, 9502, 16908, 29889, 12075, 424, 29898, 9302, 29889, 29880, 979, 29887, 29889, 11569, 29898, 17199, 29889, 29909, 732, 7442, 29889, 1032, 29872, 29898, 29876, 22724, 876, 511, 13, 1678, 1723, 13, 13, 1678, 396, 7525, 899, 369, 13, 1678, 17750, 29892, 899, 369, 29918, 3859, 353, 899, 369, 29889, 2929, 345, 29898, 13, 4706, 7536, 29922, 6596, 2575, 29892, 1108, 29922, 17199, 29892, 364, 865, 29922, 9302, 29889, 8172, 29889, 4381, 29918, 29878, 865, 29898, 29896, 29897, 13, 1678, 1723, 13, 13, 1678, 396, 5399, 363, 14426, 17221, 13, 1678, 4974, 899, 369, 29918, 3859, 29889, 10568, 1275, 29871, 29900, 13, 1678, 7442, 29889, 13424, 29889, 9294, 29918, 497, 5358, 29898, 6596, 2575, 29889, 29916, 29889, 12676, 29892, 1108, 29889, 2929, 918, 29897, 13, 2 ]
sqlova/model/nl2sql/wikisql_models.py
guotong1988/Rule-SQL
15
120
# Copyright 2019-present NAVER Corp. # Apache License v2.0 # <NAME> import os, json from copy import deepcopy from matplotlib.pylab import * import torch import torch.nn as nn import torch.nn.functional as F device = torch.device("cuda" if torch.cuda.is_available() else "cpu") from sqlova.utils.utils import topk_multi_dim from sqlova.utils.utils_wikisql import * class Seq2SQL_v1(nn.Module): def __init__(self, input_size, hidden_size, num_layer, dropout, number_cond_ops, number_agg_ops, old=False): super(Seq2SQL_v1, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.max_where_number = 4 self.number_cond_ops = number_cond_ops self.number_agg_ops = number_agg_ops self.select_column_predict = SelectColumnPredict(input_size, hidden_size, num_layer, dropout) self.select_agg_predict = SelectAggPredict(input_size, hidden_size, num_layer, dropout, number_agg_ops, old=old) self.where_number_predict = WhereNumberPredict(input_size, hidden_size, num_layer, dropout) self.wcp = WhereColumnPredict(input_size, hidden_size, num_layer, dropout) self.wop = WhereOpPredict(input_size, hidden_size, num_layer, dropout, number_cond_ops) self.wvp = WhereValuePredict_startend(input_size, hidden_size, num_layer, dropout, number_cond_ops, old=old) # start-end-search-discriminative model # emb_question, [16,26,1536] # len_question, [16] # emb_header, [102,12,1536] # len_header_token, [102] # number_header, [16] def forward(self, emb_question, len_question, emb_header, len_header_token, number_header, g_sc=None, g_sa=None, g_wn=None, g_wc=None, g_wo=None, g_wvi=None, show_p_sc=False, show_p_sa=False, show_p_wn=False, show_p_wc=False, show_p_wo=False, show_p_wv=False): # sc s_sc,s_sc_softmax = self.select_column_predict(emb_question, len_question, emb_header, len_header_token, number_header, show_p_sc=show_p_sc) if g_sc: pr_sc = g_sc else: pr_sc = pred_sc(s_sc) # sa s_sa,s_sa_softmax = self.select_agg_predict(emb_question, len_question, emb_header, len_header_token, number_header, pr_sc, show_p_sa=show_p_sa) if g_sa: # it's not necessary though. pr_sa = g_sa else: pr_sa = pred_sa(s_sa) # wn s_wn,s_wn_softmax = self.where_number_predict(emb_question, len_question, emb_header, len_header_token, number_header, show_p_wn=show_p_wn) if g_wn: pr_wn = g_wn else: pr_wn = pred_wn(s_wn) # wc s_wc,s_wc_softmax = self.wcp(emb_question, len_question, emb_header, len_header_token, number_header, show_p_wc=show_p_wc, penalty=True) if g_wc: pr_wc = g_wc else: pr_wc = pred_wherecolumn(pr_wn, s_wc) # wo s_wo,s_wo_softmax = self.wop(emb_question, len_question, emb_header, len_header_token, number_header, wn=pr_wn, wc=pr_wc, show_p_wo=show_p_wo) if g_wo: pr_wo = g_wo else: pr_wo = pred_wo(pr_wn, s_wo) # wv s_wv,s_wv_softmax = self.wvp(emb_question, len_question, emb_header, len_header_token, number_header, wn=pr_wn, wc=pr_wc, wo=pr_wo, show_p_wv=show_p_wv) return s_sc, s_sa, s_wn, s_wc, s_wo, s_wv, s_sc_softmax, s_sa_softmax, s_wn_softmax, s_wc_softmax, s_wo_softmax, s_wv_softmax def beam_forward(self, emb_question, len_question, emb_header, len_header_token, l_header, engine, tb, nlu_t, nlu_wp_t, wp_to_wh_index, nlu, beam_size=4, show_p_sc=False, show_p_sa=False, show_p_wn=False, show_p_wc=False, show_p_wo=False, show_p_wv=False): """ Execution-guided beam decoding. """ # sc s_sc,_ = self.select_column_predict(emb_question, len_question, emb_header, len_header_token, l_header, show_p_sc=show_p_sc) prob_sc = F.softmax(s_sc, dim=-1) bS, mcL = s_sc.shape # minimum_header_length = min(l_header) # beam_size = minimum_header_length if beam_size > minimum_header_length else beam_size # sa # Construct all possible sc_sa_score prob_sc_sa = torch.zeros([bS, beam_size, self.number_agg_ops]).to(device) prob_sca = torch.zeros_like(prob_sc_sa).to(device) # get the top-k indices. pr_sc_beam = [B, beam_size] pr_sc_beam = pred_sc_beam(s_sc, beam_size) # calculate and predict s_sa. for i_beam in range(beam_size): pr_sc = list( array(pr_sc_beam)[:,i_beam] ) s_sa,_ = self.select_agg_predict(emb_question, len_question, emb_header, len_header_token, l_header, pr_sc, show_p_sa=show_p_sa) prob_sa = F.softmax(s_sa, dim=-1) prob_sc_sa[:, i_beam, :] = prob_sa prob_sc_selected = prob_sc[range(bS), pr_sc] # [B] prob_sca[:,i_beam,:] = (prob_sa.t() * prob_sc_selected).t() # [mcL, B] * [B] -> [mcL, B] (element-wise multiplication) # [mcL, B] -> [B, mcL] # Calculate the dimension of tensor # tot_dim = len(prob_sca.shape) # First flatten to 1-d idxs = topk_multi_dim(torch.tensor(prob_sca), n_topk=beam_size, batch_exist=True) # Now as sc_idx is already sorted, re-map them properly. idxs = remap_sc_idx(idxs, pr_sc_beam) # [sc_beam_idx, sa_idx] -> [sc_idx, sa_idx] idxs_arr = array(idxs) # [B, beam_size, remainig dim] # idxs[b][0] gives first probable [sc_idx, sa_idx] pairs. # idxs[b][1] gives of second. # Calculate prob_sca, a joint probability beam_idx_sca = [0] * bS beam_meet_the_final = [False] * bS while True: pr_sc = idxs_arr[range(bS),beam_idx_sca,0] pr_sa = idxs_arr[range(bS),beam_idx_sca,1] # map index properly check = check_sc_sa_pairs(tb, pr_sc, pr_sa) if sum(check) == bS: break else: for b, check1 in enumerate(check): if not check1: # wrong pair beam_idx_sca[b] += 1 if beam_idx_sca[b] >= beam_size: beam_meet_the_final[b] = True beam_idx_sca[b] -= 1 else: beam_meet_the_final[b] = True if sum(beam_meet_the_final) == bS: break # Now pr_sc, pr_sa are properly predicted. pr_sc_best = list(pr_sc) pr_sa_best = list(pr_sa) # Now, Where-clause beam search. s_wn,_ = self.where_number_predict(emb_question, len_question, emb_header, len_header_token, l_header, show_p_wn=show_p_wn) prob_wn = F.softmax(s_wn, dim=-1).detach().to('cpu').numpy() # Found "executable" most likely 4(=max_num_of_conditions) where-clauses. # wc s_wc,_ = self.wcp(emb_question, len_question, emb_header, len_header_token, l_header, show_p_wc=show_p_wc, penalty=True) prob_wc = F.sigmoid(s_wc).detach().to('cpu').numpy() # pr_wc_sorted_by_prob = pred_wc_sorted_by_prob(s_wc) # get max_wn # of most probable columns & their prob. pr_wn_max = [self.max_where_number] * bS pr_wc_max = pred_wherecolumn(pr_wn_max, s_wc) # if some column do not have executable where-claouse, omit that column prob_wc_max = zeros([bS, self.max_where_number]) for b, pr_wc_max1 in enumerate(pr_wc_max): prob_wc_max[b,:] = prob_wc[b,pr_wc_max1] # get most probable max_wn where-clouses # wo s_wo_max,_ = self.wop(emb_question, len_question, emb_header, len_header_token, l_header, wn=pr_wn_max, wc=pr_wc_max, show_p_wo=show_p_wo) prob_wo_max = F.softmax(s_wo_max, dim=-1).detach().to('cpu').numpy() # [B, max_wn, n_cond_op] pr_wvi_beam_op_list = [] prob_wvi_beam_op_list = [] for i_op in range(self.number_cond_ops - 1): pr_wo_temp = [[i_op] * self.max_where_number] * bS # wv s_wv,_ = self.wvp(emb_question, len_question, emb_header, len_header_token, l_header, wn=pr_wn_max, wc=pr_wc_max, wo=pr_wo_temp, show_p_wv=show_p_wv) prob_wv = F.softmax(s_wv, dim=-2).detach().to('cpu').numpy() # prob_wv pr_wvi_beam, prob_wvi_beam = pred_wvi_se_beam(self.max_where_number, s_wv, beam_size) pr_wvi_beam_op_list.append(pr_wvi_beam) prob_wvi_beam_op_list.append(prob_wvi_beam) # pr_wvi_beam = [B, max_wn, k_logit**2 [st, ed] paris] # pred_wv_beam # Calculate joint probability of where-clause # prob_w = [batch, wc, wo, wv] = [B, max_wn, n_cond_op, n_pairs] n_wv_beam_pairs = prob_wvi_beam.shape[2] prob_w = zeros([bS, self.max_where_number, self.number_cond_ops - 1, n_wv_beam_pairs]) for b in range(bS): for i_wn in range(self.max_where_number): for i_op in range(self.number_cond_ops - 1): # do not use final one for i_wv_beam in range(n_wv_beam_pairs): # i_wc = pr_wc_max[b][i_wn] # already done p_wc = prob_wc_max[b, i_wn] p_wo = prob_wo_max[b, i_wn, i_op] p_wv = prob_wvi_beam_op_list[i_op][b, i_wn, i_wv_beam] prob_w[b, i_wn, i_op, i_wv_beam] = p_wc * p_wo * p_wv # Perform execution guided decoding conds_max = [] prob_conds_max = [] # while len(conds_max) < self.max_wn: idxs = topk_multi_dim(torch.tensor(prob_w), n_topk=beam_size, batch_exist=True) # idxs = [B, i_wc_beam, i_op, i_wv_pairs] # Construct conds1 for b, idxs1 in enumerate(idxs): conds_max1 = [] prob_conds_max1 = [] for i_wn, idxs11 in enumerate(idxs1): i_wc = pr_wc_max[b][idxs11[0]] i_op = idxs11[1] wvi = pr_wvi_beam_op_list[i_op][b][idxs11[0]][idxs11[2]] # get wv_str temp_pr_wv_str, _ = convert_pred_wvi_to_string([[wvi]], [nlu_t[b]], [nlu_wp_t[b]], [wp_to_wh_index[b]], [nlu[b]]) merged_wv11 = merge_wv_t1_eng(temp_pr_wv_str[0][0], nlu[b]) conds11 = [i_wc, i_op, merged_wv11] prob_conds11 = prob_w[b, idxs11[0], idxs11[1], idxs11[2] ] # test execution # print(nlu[b]) # print(tb[b]['id'], tb[b]['types'], pr_sc[b], pr_sa[b], [conds11]) pr_ans = engine.execute(tb[b]['id'], pr_sc[b], pr_sa[b], [conds11]) if bool(pr_ans): # pr_ans is not empty! conds_max1.append(conds11) prob_conds_max1.append(prob_conds11) conds_max.append(conds_max1) prob_conds_max.append(prob_conds_max1) # May need to do more exhuastive search? # i.e. up to.. getting all executable cases. # Calculate total probability to decide the number of where-clauses pr_sql_i = [] prob_wn_w = [] pr_wn_based_on_prob = [] for b, prob_wn1 in enumerate(prob_wn): max_executable_wn1 = len( conds_max[b] ) prob_wn_w1 = [] prob_wn_w1.append(prob_wn1[0]) # wn=0 case. for i_wn in range(max_executable_wn1): prob_wn_w11 = prob_wn1[i_wn+1] * prob_conds_max[b][i_wn] prob_wn_w1.append(prob_wn_w11) pr_wn_based_on_prob.append(argmax(prob_wn_w1)) prob_wn_w.append(prob_wn_w1) pr_sql_i1 = {'agg': pr_sa_best[b], 'sel': pr_sc_best[b], 'conds': conds_max[b][:pr_wn_based_on_prob[b]]} pr_sql_i.append(pr_sql_i1) # s_wv = [B, max_wn, max_nlu_tokens, 2] return prob_sca, prob_w, prob_wn_w, pr_sc_best, pr_sa_best, pr_wn_based_on_prob, pr_sql_i class SelectColumnPredict(nn.Module): def __init__(self, input_size=300, hidden_size=100, num_layer=2, dropout=0.3): super(SelectColumnPredict, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.enc_h = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.enc_n = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.W_att = nn.Linear(hidden_size, hidden_size) self.W_c = nn.Linear(hidden_size, hidden_size) self.W_header = nn.Linear(hidden_size, hidden_size) self.sc_out = nn.Sequential(nn.Tanh(), nn.Linear(2 * hidden_size, 1)) self.softmax_dim1 = nn.Softmax(dim=1) self.softmax_dim2 = nn.Softmax(dim=2) self.softmax_dim_1 = nn.Softmax(dim=-1) # emb_question, [16,26,1536] # len_question, [16] # emb_header, [102,12,1536] # len_header_token, [102] # number_header, [16] def forward(self, emb_question, len_question, emb_header, len_header_token, number_header, show_p_sc=False): # Encode encoded_question = encode(self.enc_n, emb_question, len_question, return_hidden=False, hc0=None, last_only=False) # [b, n, dim] encoded_header = encode_header(self.enc_h, emb_header, len_header_token, number_header) # [b, header, dim] bS = len(number_header) mL_n = max(len_question) # [bS, max_len_header, 100] * [bS, 100, mL_n] -> [bS, max_len_header, mL_n] att_h = torch.bmm(encoded_header, self.W_att(encoded_question).transpose(1, 2)) # Penalty on blank parts for b, l_n1 in enumerate(len_question): if l_n1 < mL_n: att_h[b, :, l_n1:] = -10000000000 p_n = self.softmax_dim2(att_h) if show_p_sc: # p = [b, header, n] if p_n.shape[0] != 1: raise Exception("Batch size should be 1.") fig=figure(2001, figsize=(12,3.5)) # subplot(6,2,7) subplot2grid((7,2), (3, 0), rowspan=2) cla() _color='rgbkcm' _symbol='.......' for i_h in range(number_header[0]): color_idx = i_h % len(_color) plot(p_n[0][i_h][:].data.numpy() - i_h, '--'+_symbol[color_idx]+_color[color_idx], ms=7) title('sc: p_n for each h') grid(True) fig.tight_layout() fig.canvas.draw() show() # p_n [ bS, max_len_header, mL_n] -> [ bS, max_len_header, mL_n, 1] # wenc_n [ bS, mL_n, 100] -> [ bS, 1, mL_n, 100] # -> [bS, max_len_header, mL_n, 100] -> [bS, max_len_header, 100] c_n = torch.mul(p_n.unsqueeze(3), encoded_question.unsqueeze(1)).sum(dim=2) vec = torch.cat([self.W_c(c_n), self.W_header(encoded_header)], dim=2) score_select_column = self.sc_out(vec).squeeze(2) # [bS, max_len_header, 1] -> [bS, max_len_header] score_select_column_softmax = self.softmax_dim_1(score_select_column) # Penalty max_len_header = max(number_header) for b, l_header1 in enumerate(number_header): if l_header1 < max_len_header: score_select_column[b, l_header1:] = -10000000000 for b, l_header1 in enumerate(number_header): if l_header1 < max_len_header: score_select_column_softmax[b, l_header1:] = 0 return score_select_column,score_select_column_softmax class SelectAggPredict(nn.Module): def __init__(self, input_size=300, hidden_size=100, num_layer=2, dropout=0.3, n_agg_ops=-1, old=False): super(SelectAggPredict, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.enc_h = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.enc_n = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.W_att = nn.Linear(hidden_size, hidden_size) self.sa_out = nn.Sequential(nn.Linear(hidden_size, hidden_size), nn.Tanh(), nn.Linear(hidden_size, n_agg_ops)) # Fixed number of aggregation operator. self.softmax_dim1 = nn.Softmax(dim=1) self.softmax_dim2 = nn.Softmax(dim=2) self.softmax_dim_1 = nn.Softmax(dim=-1) if old: # for backwoard compatibility self.W_c = nn.Linear(hidden_size, hidden_size) self.W_header = nn.Linear(hidden_size, hidden_size) def forward(self, emb_question, len_question, emb_header, len_header_token, l_header, pr_sc, show_p_sa=False): # Encode encoded_question = encode(self.enc_n, emb_question, len_question, return_hidden=False, hc0=None, last_only=False) # [b, n, dim] encoded_header = encode_header(self.enc_h, emb_header, len_header_token, l_header) # [b, header, dim] bS = len(l_header) mL_n = max(len_question) wenc_header_ob = encoded_header[list(range(bS)), pr_sc] # list, so one sample for each batch. # [bS, question_len, 100] * [bS, 100, 1] -> [bS, question_len] att = torch.bmm(self.W_att(encoded_question), wenc_header_ob.unsqueeze(2)).squeeze(2) # Penalty on blank parts for b, l_n1 in enumerate(len_question): if l_n1 < mL_n: att[b, l_n1:] = -10000000000 # [bS, question_len] p = self.softmax_dim1(att) if show_p_sa: if p.shape[0] != 1: raise Exception("Batch size should be 1.") fig=figure(2001); subplot(7,2,3) cla() plot(p[0].data.numpy(), '--rs', ms=7) title('sa: nlu_weight') grid(True) fig.tight_layout() fig.canvas.draw() show() # [bS, question_len, 100] * ( [bS, question_len, 1] -> [bS, question_len, 100]) # -> [bS, question_len, 100] -> [bS, 100] c_n = torch.mul(encoded_question, p.unsqueeze(2).expand_as(encoded_question)).sum(dim=1) s_sa = self.sa_out(c_n) s_sa_softmax = self.softmax_dim_1(s_sa) return s_sa,s_sa_softmax class WhereNumberPredict(nn.Module): def __init__(self, input_size=300, hidden_size=100, num_layer=2, dropout=0.3, ): super(WhereNumberPredict, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.mL_w = 4 # max where condition number self.enc_h = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.enc_n = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.W_att_h = nn.Linear(hidden_size, 1) self.W_hidden = nn.Linear(hidden_size, num_layer * hidden_size) self.W_cell = nn.Linear(hidden_size, num_layer * hidden_size) self.W_att_n = nn.Linear(hidden_size, 1) self.wn_out = nn.Sequential(nn.Linear(hidden_size, hidden_size), nn.Tanh(), nn.Linear(hidden_size, self.mL_w + 1)) # max number (4 + 1) self.softmax_dim1 = nn.Softmax(dim=1) self.softmax_dim2 = nn.Softmax(dim=2) self.softmax_dim_1 = nn.Softmax(dim=-1) def forward(self, emb_question, len_question, emb_header, len_header_token, l_header, show_p_wn=False): # Encode encoded_header = encode_header(self.enc_h, emb_header, len_header_token, l_header) # [b, max_len_header, dim] bS = len(l_header) max_len_question = max(len_question) max_len_header = max(l_header) # mL_h = max(len_header_token) # (self-attention?) column Embedding? # [B, max_len_header, 100] -> [B, max_len_header, 1] -> [B, max_len_header] att_h = self.W_att_h(encoded_header).squeeze(2) # Penalty for b, l_header1 in enumerate(l_header): if l_header1 < max_len_header: att_h[b, l_header1:] = -10000000000 p_h = self.softmax_dim1(att_h) if show_p_wn: if p_h.shape[0] != 1: raise Exception("Batch size should be 1.") fig=figure(2001); subplot(7,2,5) cla() plot(p_h[0].data.numpy(), '--rs', ms=7) title('wn: header_weight') grid(True) fig.canvas.draw() show() # input('Type Eenter to continue.') # [B, max_len_header, 100] * [ B, max_len_header, 1] -> [B, max_len_header, 100] -> [B, 100] c_header = torch.mul(encoded_header, p_h.unsqueeze(2)).sum(1) # [B, 100] --> [B, 2*100] Enlarge because there are two layers. hidden = self.W_hidden(c_header) # [B, 4, 200/2] hidden = hidden.view(bS, self.num_layer * 2, int( self.hidden_size / 2)) # [4, B, 100/2] # number_of_layer_layer * (bi-direction) # lstm input convention. hidden = hidden.transpose(0, 1).contiguous() cell = self.W_cell(c_header) # [B, 4, 100/2] cell = cell.view(bS, self.num_layer * 2, int(self.hidden_size / 2)) # [4, B, 100/2] cell = cell.transpose(0, 1).contiguous() wenc_n = encode(self.enc_n, emb_question, len_question, return_hidden=False, hc0=(hidden, cell), last_only=False) # [b, n, dim] att_n = self.W_att_n(wenc_n).squeeze(2) # [B, max_len, 100] -> [B, max_len, 1] -> [B, max_len] # Penalty for b, l_n1 in enumerate(len_question): if l_n1 < max_len_question: att_n[b, l_n1:] = -10000000000 p_n = self.softmax_dim1(att_n) if show_p_wn: if p_n.shape[0] != 1: raise Exception("Batch size should be 1.") fig=figure(2001); subplot(7,2,6) cla() plot(p_n[0].data.numpy(), '--rs', ms=7) title('wn: nlu_weight') grid(True) fig.canvas.draw() show() # input('Type Enter to continue.') # [B, mL_n, 100] *([B, mL_n] -> [B, mL_n, 1] -> [B, mL_n, 100] ) -> [B, 100] c_n = torch.mul(wenc_n, p_n.unsqueeze(2).expand_as(wenc_n)).sum(dim=1) s_wn = self.wn_out(c_n) s_wn_softmax = self.softmax_dim_1(s_wn) return s_wn,s_wn_softmax # where column predict class WhereColumnPredict(nn.Module): def __init__(self, input_size=300, hidden_size=100, num_layer=2, dropout=0.3): super(WhereColumnPredict, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.enc_h = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.enc_n = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.W_att = nn.Linear(hidden_size, hidden_size) self.W_c = nn.Linear(hidden_size, hidden_size) self.W_header = nn.Linear(hidden_size, hidden_size) self.W_out = nn.Sequential( nn.Tanh(), nn.Linear(2 * hidden_size, 1) ) self.softmax_dim1 = nn.Softmax(dim=1) self.softmax_dim2 = nn.Softmax(dim=2) self.softmax_dim_1 = nn.Softmax(dim=-1) def forward(self, emb_question, len_question, emb_header, len_header_token, l_header, show_p_wc, penalty=True): # Encode encoded_question = encode(self.enc_n, emb_question, len_question, return_hidden=False, hc0=None, last_only=False) # [b, n, dim] encoded_header = encode_header(self.enc_h, emb_header, len_header_token, l_header) # [b, header, dim] # attention # wenc = [bS, mL, hidden_size] # att = [bS, max_len_header, mL_n] # att[b, i_h, j_n] = p(j_n| i_h) att = torch.bmm(encoded_header, self.W_att(encoded_question).transpose(1, 2)) # penalty to blank part. mL_n = max(len_question) for b_n, l_n1 in enumerate(len_question): if l_n1 < mL_n: att[b_n, :, l_n1:] = -10000000000 # make p(j_n | i_h) p = self.softmax_dim2(att) if show_p_wc: # p = [b, header, n] if p.shape[0] != 1: raise Exception("Batch size should be 1.") fig=figure(2001); # subplot(6,2,7) subplot2grid((7,2), (3, 1), rowspan=2) cla() _color='rgbkcm' _symbol='.......' for i_h in range(l_header[0]): color_idx = i_h % len(_color) plot(p[0][i_h][:].data.numpy() - i_h, '--'+_symbol[color_idx]+_color[color_idx], ms=7) title('wc: p_n for each h') grid(True) fig.tight_layout() fig.canvas.draw() show() # max nlu context vectors # [bS, max_len_header, mL_n]*[bS, max_len_header, mL_n] encoded_question = encoded_question.unsqueeze(1) # [ b, n, dim] -> [b, 1, n, dim] p = p.unsqueeze(3) # [b, header, n] -> [b, header, n, 1] c_n = torch.mul(encoded_question, p).sum(2) # -> [b, header, dim], c_n for each header. y = torch.cat([self.W_c(c_n), self.W_header(encoded_header)], dim=2) # [b, header, 2*dim] score = self.W_out(y).squeeze(2) # [b, header] score[torch.isnan(score)] = 0 score_softmax = self.softmax_dim_1(score) if penalty: for b, l_header1 in enumerate(l_header): score[b, l_header1:] = -1e+10 for b, l_header1 in enumerate(l_header): score_softmax[b, l_header1:] = 0 return score,score_softmax # where op predict class WhereOpPredict(nn.Module): def __init__(self, input_size=300, hidden_size=100, num_layer=2, dropout=0.3, n_cond_ops=3): super(WhereOpPredict, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.mL_w = 4 # max where condition number self.enc_h = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.enc_n = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.W_att = nn.Linear(hidden_size, hidden_size) self.W_c = nn.Linear(hidden_size, hidden_size) self.W_header = nn.Linear(hidden_size, hidden_size) self.wo_out = nn.Sequential( nn.Linear(2*hidden_size, hidden_size), nn.Tanh(), nn.Linear(hidden_size, n_cond_ops) ) self.softmax_dim1 = nn.Softmax(dim=1) self.softmax_dim2 = nn.Softmax(dim=2) self.softmax_dim_1 = nn.Softmax(dim=-1) def forward(self, emb_question, len_question, emb_header, len_header_token, l_header, wn, wc, wenc_n=None, show_p_wo=False): # Encode if not wenc_n: wenc_n = encode(self.enc_n, emb_question, len_question, return_hidden=False, hc0=None, last_only=False) # [b, n, dim] encoded_header = encode_header(self.enc_h, emb_header, len_header_token, l_header) # [b, header, dim] bS = len(l_header) # wn wenc_header_ob = [] # observed header for b in range(bS): # [[...], [...]] # Pad list to maximum number of selections real = [encoded_header[b, col] for col in wc[b]] pad = (self.mL_w - wn[b]) * [encoded_header[b, 0]] # this padding could be wrong. Test with zero padding later. wenc_header_ob1 = torch.stack(real + pad) # It is not used in the loss function. wenc_header_ob.append(wenc_header_ob1) # list to [B, 4, dim] tensor. wenc_header_ob = torch.stack(wenc_header_ob) # list to tensor. wenc_header_ob = wenc_header_ob.to(device) # [B, 1, mL_n, dim] * [B, 4, dim, 1] # -> [B, 4, mL_n, 1] -> [B, 4, mL_n] # multiplication bewteen NLq-tokens and selected column att = torch.matmul(self.W_att(wenc_n).unsqueeze(1), wenc_header_ob.unsqueeze(3) ).squeeze(3) # Penalty for blank part. mL_n = max(len_question) for b, l_n1 in enumerate(len_question): if l_n1 < mL_n: att[b, :, l_n1:] = -10000000000 p = self.softmax_dim2(att) # p( n| selected_col ) if show_p_wo: # p = [b, header, n] if p.shape[0] != 1: raise Exception("Batch size should be 1.") fig=figure(2001) # subplot(6,2,7) subplot2grid((7,2), (5, 0), rowspan=2) cla() _color='rgbkcm' _symbol='.......' for i_wn in range(self.mL_w): color_idx = i_wn % len(_color) plot(p[0][i_wn][:].data.numpy() - i_wn, '--'+_symbol[color_idx]+_color[color_idx], ms=7) title('wo: p_n for selected h') grid(True) fig.tight_layout() fig.canvas.draw() show() # [B, 1, mL_n, dim] * [B, 4, mL_n, 1] # --> [B, 4, mL_n, dim] # --> [B, 4, dim] c_n = torch.mul(wenc_n.unsqueeze(1), p.unsqueeze(3)).sum(dim=2) # [bS, 5-1, dim] -> [bS, 5-1, 3] vec = torch.cat([self.W_c(c_n), self.W_header(wenc_header_ob)], dim=2) s_wo = self.wo_out(vec) s_wo_softmax = self.softmax_dim_1(s_wo) return s_wo,s_wo_softmax class WhereValuePredict_startend(nn.Module): """ Discriminative model Get start and end. Here, classifier for [ [투수], [팀1], [팀2], [연도], ...] Input: Encoded nlu & selected column. Algorithm: Encoded nlu & selected column. -> classifier -> mask scores -> ... """ def __init__(self, input_size=300, hidden_size=100, num_layer=2, dropout=0.3, n_cond_ops=4, old=False): super(WhereValuePredict_startend, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.n_cond_ops = n_cond_ops self.mL_w = 4 # max where condition number self.enc_h = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.enc_n = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.W_att = nn.Linear(hidden_size, hidden_size) self.W_c = nn.Linear(hidden_size, hidden_size) self.W_header = nn.Linear(hidden_size, hidden_size) self.W_op = nn.Linear(n_cond_ops, hidden_size) # self.W_n = nn.Linear(hidden_size, hidden_size) if old: self.wv_out = nn.Sequential( nn.Linear(4 * hidden_size, 2) ) else: self.wv_out = nn.Sequential( nn.Linear(4 * hidden_size, hidden_size), nn.Tanh(), nn.Linear(hidden_size, 2) ) # self.wv_out = nn.Sequential( # nn.Linear(3 * hidden_size, hidden_size), # nn.Tanh(), # nn.Linear(hidden_size, self.gdkL) # ) self.softmax_dim1 = nn.Softmax(dim=1) self.softmax_dim2 = nn.Softmax(dim=2) self.softmax_dim_1 = nn.Softmax(dim=-1) def forward(self, emb_question, len_question, emb_header, len_header_token, l_header, wn, wc, wo, wenc_n=None, show_p_wv=False): # Encode if not wenc_n: wenc_n, hout, cout = encode(self.enc_n, emb_question, len_question, return_hidden=True, hc0=None, last_only=False) # [b, n, dim] encoded_header = encode_header(self.enc_h, emb_header, len_header_token, l_header) # [b, header, dim] bS = len(l_header) wenc_header_ob = [] # observed header for b in range(bS): # [[...], [...]] # Pad list to maximum number of selections real = [encoded_header[b, col] for col in wc[b]] pad = (self.mL_w - wn[b]) * [encoded_header[b, 0]] # this padding could be wrong. Test with zero padding later. wenc_header_ob1 = torch.stack(real + pad) # It is not used in the loss function. wenc_header_ob.append(wenc_header_ob1) # list to [B, 4, dim] tensor. wenc_header_ob = torch.stack(wenc_header_ob) # list to tensor. wenc_header_ob = wenc_header_ob.to(device) # Column attention # [B, 1, mL_n, dim] * [B, 4, dim, 1] # -> [B, 4, mL_n, 1] -> [B, 4, mL_n] # multiplication bewteen NLq-tokens and selected column att = torch.matmul(self.W_att(wenc_n).unsqueeze(1), wenc_header_ob.unsqueeze(3) ).squeeze(3) # Penalty for blank part. mL_n = max(len_question) for b, l_n1 in enumerate(len_question): if l_n1 < mL_n: att[b, :, l_n1:] = -10000000000 p = self.softmax_dim2(att) # p( n| selected_col ) if show_p_wv: # p = [b, header, n] if p.shape[0] != 1: raise Exception("Batch size should be 1.") fig=figure(2001) # subplot(6,2,7) subplot2grid((7,2), (5, 1), rowspan=2) cla() _color='rgbkcm' _symbol='.......' for i_wn in range(self.mL_w): color_idx = i_wn % len(_color) plot(p[0][i_wn][:].data.numpy() - i_wn, '--'+_symbol[color_idx]+_color[color_idx], ms=7) title('wv: p_n for selected h') grid(True) fig.tight_layout() fig.canvas.draw() show() # [B, 1, mL_n, dim] * [B, 4, mL_n, 1] # --> [B, 4, mL_n, dim] # --> [B, 4, dim] c_n = torch.mul(wenc_n.unsqueeze(1), p.unsqueeze(3)).sum(dim=2) # Select observed headers only. # Also generate one_hot vector encoding info of the operator # [B, 4, dim] wenc_op = [] for b in range(bS): # [[...], [...]] # Pad list to maximum number of selections wenc_op1 = torch.zeros(self.mL_w, self.n_cond_ops) wo1 = wo[b] idx_scatter = [] l_wo1 = len(wo1) for i_wo11 in range(self.mL_w): if i_wo11 < l_wo1: wo11 = wo1[i_wo11] idx_scatter.append([int(wo11)]) else: idx_scatter.append([0]) # not used anyway wenc_op1 = wenc_op1.scatter(1, torch.tensor(idx_scatter), 1) wenc_op.append(wenc_op1) # list to [B, 4, dim] tensor. wenc_op = torch.stack(wenc_op) # list to tensor. wenc_op = wenc_op.to(device) # Now after concat, calculate logits for each token # [bS, 5-1, 3*hidden_size] = [bS, 4, 300] vec = torch.cat([self.W_c(c_n), self.W_header(wenc_header_ob), self.W_op(wenc_op)], dim=2) # Make extended vector based on encoded nl token containing column and operator information. # wenc_n = [bS, mL, 100] # vec2 = [bS, 4, mL, 400] vec1e = vec.unsqueeze(2).expand(-1,-1, mL_n, -1) # [bS, 4, 1, 300] -> [bS, 4, mL, 300] wenc_ne = wenc_n.unsqueeze(1).expand(-1, 4, -1, -1) # [bS, 1, mL, 100] -> [bS, 4, mL, 100] vec2 = torch.cat( [vec1e, wenc_ne], dim=3) # now make logits s_wv = self.wv_out(vec2) # [bS, 4, mL, 400] -> [bS, 4, mL, 2] s_wv_softmax = self.softmax_dim_1(s_wv) # penalty for spurious tokens for b, l_n1 in enumerate(len_question): if l_n1 < mL_n: s_wv[b, :, l_n1:, :] = -10000000000 for b, l_n1 in enumerate(len_question): if l_n1 < mL_n: s_wv_softmax[b, :, l_n1:, :] = 0 return s_wv,s_wv_softmax def Loss_selectwhere_startend_v2(score_select_column, s_sa, s_wn, s_wc, s_wo, s_wv, ground_truth_select_column, g_sa, g_wn, g_wc, g_wo, g_wvi): """ :param s_wv: score [ B, n_conds, T, score] :param g_wn: [ B ] :param g_wvi: [B, conds, pnt], e.g. [[[0, 6, 7, 8, 15], [0, 1, 2, 3, 4, 15]], [[0, 1, 2, 3, 16], [0, 7, 8, 9, 16]]] :return: """ loss = 0 # loss += Loss_sc(score_select_column, ground_truth_select_column) # loss += Loss_sa(s_sa, g_sa) # loss += Loss_wn(s_wn, g_wn) # loss += Loss_wc(s_wc, g_wc) # loss += Loss_wo(s_wo, g_wn, g_wo) # loss += Loss_wv_se(s_wv, g_wn, g_wvi) return loss def Loss_sw_se(score_select_column, s_sa, s_wn, s_wc, s_wo, s_wv, ground_truth_select_column, g_sa, g_wn, g_wc, g_wo, g_wvi): """ :param s_wv: score [ B, n_conds, T, score] :param g_wn: [ B ] :param g_wvi: [B, conds, pnt], e.g. [[[0, 6, 7, 8, 15], [0, 1, 2, 3, 4, 15]], [[0, 1, 2, 3, 16], [0, 7, 8, 9, 16]]] :return: """ loss = 0 loss += Loss_sc(score_select_column, ground_truth_select_column) loss += Loss_sa(s_sa, g_sa) loss += Loss_wn(s_wn, g_wn) loss += Loss_wc(s_wc, g_wc) loss += Loss_wo(s_wo, g_wn, g_wo) loss += Loss_wv_se(s_wv, g_wn, g_wvi) return loss def Loss_sc(s_sc, g_sc): loss = F.cross_entropy(s_sc, torch.tensor(g_sc).to(device)) return loss def Loss_sa(s_sa, g_sa): loss = F.cross_entropy(s_sa, torch.tensor(g_sa).to(device)) return loss def Loss_wn(s_wn, g_wn): loss = F.cross_entropy(s_wn, torch.tensor(g_wn).to(device)) return loss def Loss_wc(s_wc, g_wc): # Construct index matrix bS, max_h_len = s_wc.shape im = torch.zeros([bS, max_h_len]).to(device) for b, g_wc1 in enumerate(g_wc): for g_wc11 in g_wc1: im[b, g_wc11] = 1.0 # Construct prob. p = F.sigmoid(s_wc) loss = F.binary_cross_entropy(p, im) return loss def Loss_wo(s_wo, g_wn, g_wo): # Construct index matrix loss = 0 for b, g_wn1 in enumerate(g_wn): if g_wn1 == 0: continue g_wo1 = g_wo[b] s_wo1 = s_wo[b] loss += F.cross_entropy(s_wo1[:g_wn1], torch.tensor(g_wo1).to(device)) return loss def Loss_wv_se(s_wv, g_wn, g_wvi): """ s_wv: [bS, 4, mL, 2], 4 stands for maximum # of condition, 2 tands for start & end logits. g_wvi: [ [1, 3, 2], [4,3] ] (when B=2, wn(b=1) = 3, wn(b=2) = 2). """ loss = 0 # g_wvi = torch.tensor(g_wvi).to(device) for b, g_wvi1 in enumerate(g_wvi): # for i_wn, g_wvi11 in enumerate(g_wvi1): g_wn1 = len(g_wvi1) # 有改动 # g_wn1 = g_wn[b] # 有改动 if g_wn1 == 0: continue g_wvi1 = torch.tensor(g_wvi1)[:g_wn1].to(device) # 有改动 g_st1 = g_wvi1[:,0] g_ed1 = g_wvi1[:,1] # loss from the start position loss += F.cross_entropy(s_wv[b,:g_wn1,:,0], g_st1) # print("st_login: ", s_wv[b,:g_wn1,:,0], g_st1, loss) # loss from the end position loss += F.cross_entropy(s_wv[b,:g_wn1,:,1], g_ed1) # print("ed_login: ", s_wv[b,:g_wn1,:,1], g_ed1, loss) return loss # ========= Decoder-Layer =========== class FT_s2s_1(nn.Module): """ Decoder-Layer """ def __init__(self, input_size, hidden_size, num_layer, dropout, max_seq_length, n_cond_ops, n_agg_ops, old=False): super(FT_s2s_1, self).__init__() self.input_size = input_size # input_size self.hidden_size = hidden_size # hidden_size self.ls = num_layer self.dropout = dropout self.n_cond_ops = n_cond_ops self.n_agg_ops = n_agg_ops self.n_where_num = 4 self.decoder_s2s = Decoder_s2s(input_size, hidden_size, num_layer, dropout, max_seq_length) def forward(self, wenc_s2s, l_input, cls_vec, pnt_start_tok, g_pnt_idxs=None): score = self.decoder_s2s(wenc_s2s, l_input, cls_vec, pnt_start_tok, g_pnt_idxs) return score def EG_forward(self, wenc_s2s, l_input, cls_vec, pnt_start_tok, pnt_end_tok, i_sql_vocab, i_nlu, i_hds, # for EG tokens, nlu, nlu_t, hds, tt_to_t_idx, # for EG tb, engine, beam_size=4, beam_only=True): """ EG-guided beam-search """ score = self.decoder_s2s.EG_forward(wenc_s2s, l_input, cls_vec, pnt_start_tok, pnt_end_tok, i_sql_vocab, i_nlu, i_hds, # for EG tokens, nlu, nlu_t, hds, tt_to_t_idx, # for EG tb, engine, beam_size, beam_only) return score class Decoder_s2s(nn.Module): def __init__(self, input_size=300, hidden_size=100, num_layer=2, dropout=0.3, max_seq_length=222, n_cond_ops=3): super(Decoder_s2s, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.mL = max_seq_length self.Tmax = 200 self.enc_h = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.enc_n = nn.LSTM(input_size=input_size, hidden_size=int(hidden_size / 2), num_layers=num_layer, batch_first=True, dropout=dropout, bidirectional=True) self.decode_pn = nn.LSTM(input_size=max_seq_length, hidden_size=hidden_size, num_layers=num_layer, batch_first=True, dropout=dropout) self.W_s2s = nn.Linear(input_size, hidden_size) self.W_pnt = nn.Linear(hidden_size, hidden_size) self.wv_out = nn.Sequential(nn.Tanh(), nn.Linear(hidden_size, 1)) def forward(self, wenc_s2s, l_input, cls_vec, pnt_start_tok, g_pnt_idxs=None,): # Encode bS, mL_input, input_size = wenc_s2s.shape # Now, pointer network. ipnt = wenc_s2s.new_zeros(bS, 1, mL_input).to(device) # [B, 1, 200] ipnt[:, 0, pnt_start_tok] = 1 # 27 is of start token under current tokenization scheme # initial (current) pointer cpnt = ipnt # reshape wenc_s2s to incorporate T later wenc_s2s = wenc_s2s.unsqueeze(1) # h_0 and c_0 from cls_vec # They are not bidirectional. h_0 = torch.zeros([self.num_layer, bS, self.hidden_size]).to(device) c_0 = torch.zeros([self.num_layer, bS, self.hidden_size]).to(device) for i_layer in range(self.num_layer): h_st = (2*i_layer)*self.hidden_size h_ed = h_st + self.hidden_size c_st = (2*i_layer+1)*self.hidden_size c_ed = c_st + self.hidden_size h_0[i_layer] = cls_vec[:, h_st:h_ed] # [ # of layers, batch, dim] c_0[i_layer] = cls_vec[:, c_st:c_ed] # [ # of layers, batch, dim] if g_pnt_idxs: pnt_n = torch.zeros(bS, self.Tmax, mL_input).to(device) # one hot # assign index for b, g_pnt_idxs1 in enumerate(g_pnt_idxs): for t, g_pnt_idx in enumerate(g_pnt_idxs1): pnt_n[b, t, g_pnt_idx] = 1 # Encode dec_pn, _ = self.decode_pn(pnt_n, (h_0, c_0)) dec_pn = dec_pn.contiguous() # [bS, T, input_size] dec_pn = dec_pn.unsqueeze(2) # Calculate score s_wv = self.wv_out( self.W_s2s(wenc_s2s) + self.W_pnt(dec_pn) ).squeeze(3) # [B, T, mL_input, dim] -> [B, T, mL_input, 1] -> [B, T, mL_input] # s_wv = [B, 4, T, mL_n] = [batch, conds, token idx, score] # penalty for b, l_input1 in enumerate(l_input): if l_input1 < mL_input: s_wv[b, :, l_input1:] = -10000000000 else: t = 0 s_wv_list = [] cpnt_h = (h_0, c_0) while t < self.Tmax: dec_pn, cpnt_h = self.decode_pn(cpnt, cpnt_h) # lstm # [B, 1, 100] -> [B, 1, 1, 100] dec_pn = dec_pn.unsqueeze(2) # [bS, T, input_size] # get score s_wv1 = self.wv_out( self.W_s2s(wenc_s2s) # [B, 1, mL_input, dim] + self.W_pnt(dec_pn) # [B, T=1, 1, dim] Now, T=1 ).squeeze(3) # s_wv = [B, 4, 1, mL_n, 1] = [batch, conds, token idx, score] # -> [B, 4, mL_n] # Masking -- for b, l_input1 in enumerate(l_input): if l_input1 < mL_input: s_wv1[b, :, l_input1:] = -10000000000 # Collect score-- s_wv_list.append(s_wv1) # [B, 1, mL_input] -> [B, mL_n] -> [bS*(5-1)] # (max_val, max_indices) _val, pnt_n = s_wv1.view(bS, -1).max(dim=1) # formatting pnt_n as a one-hot input. cpnt = torch.zeros(bS, mL_input).to(device) # cpnt = cpnt.scatter_(dim=1, index=pnt_n.unsqueeze(1), src=1).to(device) cpnt = cpnt.scatter_(1, pnt_n.unsqueeze(1), 1) cpnt = cpnt.unsqueeze(1) # --> [B * 4, 1, 200] t += 1 s_wv = torch.stack(s_wv_list, 1) # [B, s_wv = s_wv.squeeze(2) # # # Following lines seems to be unnecessary. # # Penalty to blank parts # for b, l_input1 in enumerate(l_input): # if l_input1 < mL_input: # s_wv[b, :, l_input1:] = -10000000000 return s_wv def EG_forward(self, wenc_s2s, l_input, cls_vec, pnt_start_tok, pnt_end_tok, i_sql_vocab, i_nlu, i_hds, # for EG tokens, nlu, nlu_t, hds, tt_to_t_idx, # for EG tb, engine, beam_size, beam_only=True): # Encode bS, mL_input, input_size = wenc_s2s.shape # reshape wenc_s2s to incorperate T later wenc_s2s = wenc_s2s.unsqueeze(1) # h_0 and c_0 from cls_vec # They are not bidirectional. h_0 = torch.zeros([self.num_layer, bS, self.hidden_size]).to(device) c_0 = torch.zeros([self.num_layer, bS, self.hidden_size]).to(device) for i_layer in range(self.num_layer): h_st = (2*i_layer)*self.hidden_size h_ed = h_st + self.hidden_size c_st = (2*i_layer+1)*self.hidden_size c_ed = c_st + self.hidden_size h_0[i_layer] = cls_vec[:, h_st:h_ed] # [ # of layers, batch, dim] c_0[i_layer] = cls_vec[:, c_st:c_ed] # [ # of layers, batch, dim] # initial (current) pointer pnt_list_beam = [] cpnt_beam = [] cpnt_h_beam = [] for i_beam in range(beam_size): pnt_list_beam1 = [] for b in range(bS): pnt_list_beam1.append( [ [pnt_start_tok], 0] ) pnt_list_beam.append(pnt_list_beam1) # initisl cpnt # Now, initialize pointer network. ipnt = wenc_s2s.new_zeros(bS, 1, mL_input).to(device) # [B, 1, 200] # Distort ipnt by i_bam on purpose to avoid initial duplication of beam-search ipnt[:, 0, pnt_start_tok] = 1 # 27 is of start token under current tokenization scheme cpnt_beam.append(ipnt) cpnt_h_beam.append( (h_0, c_0) ) t = 0 while t < self.Tmax: # s_wv1_beam = [] candidates = [ [] for b in range(bS) ] # [bS] # Generate beam for i_beam, cpnt in enumerate(cpnt_beam): cpnt_h = cpnt_h_beam[i_beam] pnt_list_beam1 = pnt_list_beam[i_beam] dec_pn, cpnt_h = self.decode_pn(cpnt, cpnt_h) # lstm cpnt_h_beam[i_beam] = cpnt_h # [B, 1, 100] -> [B, 1, 1, 100] dec_pn = dec_pn.unsqueeze(2) # [bS, T, input_size] # get score s_wv1 = self.wv_out( self.W_s2s(wenc_s2s) # [B, 1, mL_input, dim] + self.W_pnt(dec_pn) # [B, T=1, 1, dim] Now, T=1 ).squeeze(3) # s_wv = [B, 4, 1, mL_n, 1] = [batch, conds, token idx, score] # -> [B, 4, mL_n] # Masking -- for b, l_input1 in enumerate(l_input): if l_input1 < mL_input: s_wv1[b, :, l_input1:] = -10000000000 # Get the candidates only among the input space. prob, idxs = F.softmax(s_wv1.view(bS, -1), dim=1).topk(dim=1, k=max(l_input)) log_prob = torch.log(prob) # [bS, beam_size] for b, log_prob1 in enumerate(log_prob): pnt_list11, score = pnt_list_beam1[b] for i_can, log_prob11 in enumerate(log_prob1): # no update if last token was the end-token previous_pnt = pnt_list11[-1] if previous_pnt== pnt_end_tok: new_seq = pnt_list11 new_score = score else: new_seq = pnt_list11 + [idxs[b][i_can].item()] new_score = score + log_prob11.item() _candidate = [new_seq, new_score] candidates[b].append(_candidate) # Execution-guided beam filtering for b, candidates1 in enumerate(candidates): new_pnt_list_batch1 = sorted(candidates1, key=lambda list1: list1[-1], reverse=True) count = 0 selected_candidates1 = [] for new_pnt_list_batch11 in new_pnt_list_batch1: if new_pnt_list_batch11 not in selected_candidates1: if beam_only: selected_candidates1.append(new_pnt_list_batch11) pnt_list_beam[count][b] = new_pnt_list_batch11 count +=1 else: # Need to be modified here. executable = False testable = False pr_i_vg_list, pr_i_vg_sub_list = gen_i_vg_from_pnt_idxs([new_pnt_list_batch11[0]], [i_sql_vocab[b]], [i_nlu[b]], [i_hds[b]]) pr_sql_q_s2s, pr_sql_i = gen_sql_q_from_i_vg([tokens[b]], [nlu[b]], [nlu_t[b]], [hds[b]], [tt_to_t_idx[b]], pnt_start_tok, pnt_end_tok, [new_pnt_list_batch11[0]], pr_i_vg_list, pr_i_vg_sub_list) # check testability from select-clause try: # check whether basic elements presents in pr_sql_i # If so, it is testable. idx_agg = pr_sql_i[0]["agg"] idx_sel = pr_sql_i[0]["sel"] testable = True except: testable = False pass # check the presence of conds if testable: try: conds = pr_sql_i[0]["conds"] except: conds = [] try: pr_ans1 = engine.execute(tb[b]['id'], idx_sel, idx_agg, conds) executable = bool(pr_ans1) except: executable = False # if testable: if executable: add_candidate = True else: add_candidate = False else: add_candidate = True if add_candidate: selected_candidates1.append(new_pnt_list_batch11) pnt_list_beam[count][b] = new_pnt_list_batch11 count += 1 if count == beam_size: break if count < beam_size: # not executable at all.. # add junk sequence. for i_junk in range(count, beam_size): pnt_list_beam[i_junk][b] = [[pnt_end_tok],-9999999] # generate cpnt # formatting pnt_n as a one-hot input. for i_beam in range(beam_size): cpnt = torch.zeros(bS, mL_input).to(device) # cpnt = cpnt.scatter_(dim=1, index=pnt_n.unsqueeze(1), src=1).to(device) idx_batch = [seq_score[0][-1] for seq_score in pnt_list_beam[i_beam]] pnt_n = torch.tensor(idx_batch).to(device) cpnt = cpnt.scatter_(1, pnt_n.unsqueeze(1), 1) cpnt = cpnt.unsqueeze(1) # --> [B, t=1, mL_input] cpnt_beam[i_beam] = cpnt t += 1 # Generate best pr_pnt_list, p_tot pr_pnt_idxs = [] p_list = [] for b in range(bS): pnt_list_beam_best = pnt_list_beam[0] pr_pnt_idxs.append(pnt_list_beam_best[b][0]) p_list.append( pnt_list_beam_best[b][1]) return pr_pnt_idxs, p_list, pnt_list_beam # ============= Shallow-Layer =============== class FT_Scalar_1(nn.Module): """ Shallow-Layer """ def __init__(self, input_size, hidden_size, num_layer, dropout, n_cond_ops, n_agg_ops, old=False): super(FT_Scalar_1, self).__init__() self.input_size = input_size # input_size self.hidden_size = hidden_size self.num_layer = num_layer self.dropout = dropout self.n_cond_ops = n_cond_ops self.n_agg_ops = n_agg_ops self.n_where_num = 4 def scp(self, wemb_h, l_header): bS, max_header_len, _ = wemb_h.shape # s_sc s_sc = torch.zeros(bS, max_header_len).to(device) s_sc[:, :] = wemb_h[:, :, 0] # s_sc = [B, max_header length, 1] # s_sc[:,:] = F.tanh(wemb_h[:,:,0]) # s_sc = [B, max_header length, 1] # s_sc = s_sc.squeeze(2) # masking # print(f"s_sc {s_sc}") for b, l_header1 in enumerate(l_header): s_sc[b, l_header1:] = -9999999999.0 return s_sc def sap(self, wemb_h, pr_sc, idx_st, idx_ed): bS, max_header_len, _ = wemb_h.shape # select of aggregation operator s_sa = torch.zeros([bS, self.n_agg_ops]).to(device) for b, pr_sc1 in enumerate(pr_sc): s_sa[b,:] = wemb_h[b,pr_sc1,idx_st:idx_ed] return s_sa def wnp(self, cls_vec): bS = cls_vec.shape[0] # [B,hidden_size] -> [B, n_where_num+1] s_wn = torch.zeros(bS, (self.n_where_num + 1)).to(device) s_wn[:, :] = cls_vec[:, 0:(self.n_where_num + 1)] return s_wn def wcp(self, wemb_h, l_header, idx_st, idx_ed): bS, max_header_len, _ = wemb_h.shape s_wc = torch.zeros(bS, max_header_len, 1).to(device) s_wc[:, :, :] = wemb_h[:, :, idx_st:idx_ed] s_wc = s_wc.squeeze(2) # [B, max_header_length] # masking for b, l_header1 in enumerate(l_header): s_wc[b, l_header1:] = -99999999999.0 return s_wc def wop(self, wemb_h, pr_wc, idx_st, idx_ed): bS, max_header_len, _ = wemb_h.shape s_wo = torch.zeros([bS, self.n_where_num, self.n_cond_ops]).to(device) for b, pr_wc1 in enumerate(pr_wc): if len(pr_wc1) > 0: s_wo[b, 0:len(pr_wc1), :] = wemb_h[b, pr_wc1, idx_st:idx_ed] else: pass return s_wo def wvp(self, emb_question, len_question, pr_wc): bS, _, _ = emb_question.shape s_wv = torch.zeros([bS, self.n_where_num, max(len_question), 2]).to(device) for b, pr_wc1 in enumerate(pr_wc): if len(pr_wc1) > 0: # start logit s_wv[b, 0:len(pr_wc1), :, 0] = emb_question[b, :, pr_wc1].transpose(0, 1) # end logit s_wv[b, 0:len(pr_wc1), :, 1] = emb_question[b, :, [pr_wc11 + 100 for pr_wc11 in pr_wc1]].transpose(0, 1) else: pass # masking # penalty for spurious tokens for b, l_n1 in enumerate(len_question): if l_n1 < max(len_question): s_wv[b, :, l_n1:, :] = -1e+11 return s_wv def forward(self, emb_question, len_question, wemb_h, l_header, cls_vec, g_sc=None, g_sa=None, g_wn=None, g_wc=None, g_wo=None, g_wvi=None, show_p_sc=False, show_p_sa=False, show_p_wn=False, show_p_wc=False, show_p_wo=False, show_p_wv=False): # emb_question = [B, max_nlu_token_length, hidden_size] # here, # of target_layer is fixed to 1. # wemb_h = [B, max_header #, hidden_size] s_sc = self.scp(wemb_h, l_header) if g_sc: pr_sc = g_sc else: pr_sc = pred_sc(s_sc) # s_sa idx_st = 1 idx_ed = 1 + self.n_agg_ops s_sa = self.sap(wemb_h, pr_sc, idx_st, idx_ed) if g_sa: pr_sa = g_sa else: pr_sa = pred_sa(s_sa) # where_number s_wn = self.wnp(cls_vec) if g_wn: pr_wn = g_wn else: pr_wn = pred_wn(s_wn) # wc idx_st = idx_ed+1 idx_ed = idx_st+1 s_wc = self.wcp(wemb_h, l_header, idx_st, idx_ed) if g_wc: pr_wc = g_wc else: pr_wc = pred_wherecolumn(pr_wn, s_wc) # wo idx_st = idx_ed+1 idx_ed = idx_st + self.n_cond_ops s_wo = self.wop(wemb_h, pr_wc, idx_st, idx_ed) if g_wo: pr_wo = g_wo else: pr_wo = pred_wo(pr_wn, s_wo) # wv # s_wv = [bS, 4, mL, 2] s_wv = self.wvp(emb_question, len_question, pr_wc) # print(s_wv) # s_wv = F.tanh(s_wv) return s_sc, s_sa, s_wn, s_wc, s_wo, s_wv def forward_EG(self, emb_question, len_question, wemb_h, l_header, cls_vec, engine, tb, nlu_t, nlu_tt, tt_to_t_idx, nlu, beam_size=4): """ Execution-guided beam decoding. Essentially identical with that of NL2SQL Layer. """ # Select-clause prob_sca, pr_sc_best, pr_sa_best, \ p_sc_best, p_sa_best, p_select \ = self.EG_decoding_select(wemb_h, l_header, tb, beam_size=beam_size) # Where-clause prob_w, prob_wn_w, pr_wn_based_on_prob, pr_sql_i, pr_wvi_best, \ p_where, p_wn_best, p_wc_best, p_wo_best, p_wvi_best \ = self.EG_decoding_where(emb_question, len_question, wemb_h, l_header, cls_vec, engine, tb, nlu_t, nlu_tt, tt_to_t_idx, nlu, pr_sc_best, pr_sa_best, beam_size=4) p_tot = cal_prob_tot(p_select, p_where) return pr_sc_best, pr_sa_best, pr_wn_based_on_prob, pr_wvi_best, \ pr_sql_i, p_tot, p_select, p_where, p_sc_best, p_sa_best, \ p_wn_best, p_wc_best, p_wo_best, p_wvi_best def EG_decoding_select(self, wemb_h, l_header, tb, beam_size=4, show_p_sc=False, show_p_sa=False): # sc s_sc = self.scp(wemb_h, l_header) prob_sc = F.softmax(s_sc, dim=-1) bS, mcL = s_sc.shape # minimum_header_length = min(l_header) # beam_size = minimum_header_length if beam_size > minimum_header_length else beam_size # sa # Construct all possible sc_sa_score prob_sc_sa = torch.zeros([bS, beam_size, self.n_agg_ops]).to(device) score_sc_sa = torch.zeros([bS, beam_size, self.n_agg_ops]).to(device) prob_sca = torch.zeros_like(prob_sc_sa).to(device) # get the top-k indices. pr_sc_beam = [B, beam_size] pr_sc_beam = pred_sc_beam(s_sc, beam_size) # calculate and predict s_sa. idx_st = 1 idx_ed = 1 + self.n_agg_ops for i_beam in range(beam_size): pr_sc = list(array(pr_sc_beam)[:, i_beam]) s_sa = self.sap(wemb_h, pr_sc, idx_st, idx_ed) prob_sa = F.softmax(s_sa, dim=-1) prob_sc_sa[:, i_beam, :] = prob_sa score_sc_sa[:, i_beam, :] = s_sa prob_sc_selected = prob_sc[range(bS), pr_sc] # [B] prob_sca[:, i_beam, :] = (prob_sa.t() * prob_sc_selected).t() # [mcL, B] * [B] -> [mcL, B] (element-wise multiplication) # [mcL, B] -> [B, mcL] # Calculate the dimension of tensor # tot_dim = len(prob_sca.shape) idxs = topk_multi_dim(torch.tensor(prob_sca), n_topk=beam_size, batch_exist=True) # Now as sc_idx is already sorted, re-map them properly. idxs = remap_sc_idx(idxs, pr_sc_beam) # [sc_beam_idx, sa_idx] -> [sc_idx, sa_idx] idxs_arr = array(idxs) # [B, beam_size, remainig dim] # idxs[b][0] gives first probable [sc_idx, sa_idx] pairs. # idxs[b][1] gives of second. # Calculate prob_sca, a joint probability beam_idx_sca = [0] * bS beam_meet_the_final = [False] * bS while True: pr_sc = idxs_arr[range(bS), beam_idx_sca, 0] pr_sa = idxs_arr[range(bS), beam_idx_sca, 1] # map index properly check = check_sc_sa_pairs(tb, pr_sc, pr_sa) if sum(check) == bS: break else: for b, check1 in enumerate(check): if not check1: # wrong pair beam_idx_sca[b] += 1 if beam_idx_sca[b] >= beam_size: beam_meet_the_final[b] = True beam_idx_sca[b] -= 1 else: beam_meet_the_final[b] = True if sum(beam_meet_the_final) == bS: break # Now pr_sc, pr_sa are properly predicted. pr_sc_best = list(pr_sc) pr_sa_best = list(pr_sa) # output for later analysis. p_sc_best = cal_prob_sc(s_sc, pr_sc_best) p_sa_best = cal_prob_sa(score_sc_sa[range(bS), beam_idx_sca, :].squeeze(1), pr_sa_best) p_select = cal_prob_select(p_sc_best, p_sa_best) # p_select = prob_sca[range(bS),beam_idx_sca,pr_sa_best].detach().to('cpu').numpy() return prob_sca, pr_sc_best, pr_sa_best, p_sc_best, p_sa_best, p_select def EG_decoding_where(self, emb_question, len_question, wemb_h, l_header, cls_vec, engine, tb, nlu_t, nlu_wp_t, tt_to_t_idx, nlu, pr_sc_best, pr_sa_best, beam_size=4, show_p_wn=False, show_p_wc=False, show_p_wo=False, show_p_wv=False): bS, max_header_len, _ = wemb_h.shape # Now, Where-clause beam search. idx_st = 1 idx_ed = 1 + self.n_agg_ops s_wn = self.wnp(cls_vec) prob_wn = F.softmax(s_wn, dim=-1).detach().to('cpu').numpy() # Found "executable" most likely 4(=max_num_of_conditions) where-clauses. # wc idx_st = idx_ed + 1 idx_ed = idx_st + 1 s_wc = self.wcp(wemb_h, l_header, idx_st, idx_ed) prob_wc = torch.sigmoid(s_wc).detach().to('cpu').numpy() # pr_wc_sorted_by_prob = pred_wc_sorted_by_prob(s_wc) # get max_wn # of most probable columns & their prob. pr_wn_max = [self.n_where_num] * bS pr_wc_max = pred_wherecolumn(pr_wn_max, s_wc) # if some column do not have executable where-claouse, omit that column prob_wc_max = zeros([bS, self.n_where_num]) for b, pr_wc_max1 in enumerate(pr_wc_max): prob_wc_max[b, :] = prob_wc[b, pr_wc_max1] # get most probable n_where_num where-clouses # wo idx_st = idx_ed + 1 idx_ed = idx_st + self.n_cond_ops s_wo_max = self.wop(wemb_h, pr_wc_max, idx_st, idx_ed) prob_wo_max = F.softmax(s_wo_max, dim=-1).detach().to('cpu').numpy() # [B, n_where_num, n_cond_op] pr_wvi_beam_op_list = [] prob_wvi_beam_op_list = [] prob_wvi_beam_st_op_list = [] prob_wvi_beam_ed_op_list = [] # To re-use code, repeat the calculation unnecessarily. for i_op in range(self.n_cond_ops - 1): pr_wo_temp = [[i_op] * self.n_where_num] * bS # wv s_wv = self.wvp(emb_question, len_question, pr_wc_max) prob_wv = F.softmax(s_wv, dim=-2).detach().to('cpu').numpy() # prob_wv pr_wvi_beam, prob_wvi_beam, prob_wvi_beam_st, prob_wvi_beam_ed = pred_wvi_se_beam(self.n_where_num, s_wv, beam_size) pr_wvi_beam_op_list.append(pr_wvi_beam) prob_wvi_beam_op_list.append(prob_wvi_beam) prob_wvi_beam_st_op_list.append(prob_wvi_beam_st) prob_wvi_beam_ed_op_list.append(prob_wvi_beam_ed) # pr_wvi_beam = [B, n_where_num, k_logit**2 [st, ed] paris] # pred_wv_beam # Calculate joint probability of where-clause # prob_w = [batch, wc, wo, wv] = [B, n_where_num, n_cond_op, n_pairs] n_wv_beam_pairs = prob_wvi_beam.shape[2] prob_w = zeros([bS, self.n_where_num, self.n_cond_ops - 1, n_wv_beam_pairs]) prob_wc_dupl = zeros([bS, self.n_where_num, self.n_cond_ops - 1, n_wv_beam_pairs]) prob_wo_dupl = zeros([bS, self.n_where_num, self.n_cond_ops - 1, n_wv_beam_pairs]) prob_wvi_st_dupl = zeros([bS, self.n_where_num, self.n_cond_ops - 1, n_wv_beam_pairs]) prob_wvi_ed_dupl = zeros([bS, self.n_where_num, self.n_cond_ops - 1, n_wv_beam_pairs]) for b in range(bS): for i_wn in range(self.n_where_num): for i_op in range(self.n_cond_ops - 1): # do not use final one p_wc = prob_wc_max[b, i_wn] for i_wv_beam in range(n_wv_beam_pairs): # i_wc = pr_wc_max[b][i_wn] # already done p_wo = prob_wo_max[b, i_wn, i_op] p_wv = prob_wvi_beam_op_list[i_op][b, i_wn, i_wv_beam] prob_w[b, i_wn, i_op, i_wv_beam] = p_wc * p_wo * p_wv prob_wc_dupl[b, i_wn, i_op, i_wv_beam] = p_wc prob_wo_dupl[b, i_wn, i_op, i_wv_beam] = p_wo p_wv_st = prob_wvi_beam_st_op_list[i_op][b, i_wn, i_wv_beam] p_wv_ed = prob_wvi_beam_ed_op_list[i_op][b, i_wn, i_wv_beam] prob_wvi_st_dupl[b, i_wn, i_op, i_wv_beam] = p_wv_st prob_wvi_ed_dupl[b, i_wn, i_op, i_wv_beam] = p_wv_ed # Perform execution guided decoding conds_max = [] prob_conds_max = [] # while len(conds_max) < self.n_where_num: idxs = topk_multi_dim(torch.tensor(prob_w), n_topk=beam_size, batch_exist=True) # idxs = [B, i_wc_beam, i_op, i_wv_pairs] # Construct conds1. Collect only executable one. It is descending order of the probability. pr_wvi_max = [] p_wc_max = [] p_wo_max = [] p_wvi_max = [] for b, idxs1 in enumerate(idxs): conds_max1 = [] prob_conds_max1 = [] pr_wvi1_max = [] p_wc1_max = [] p_wo1_max = [] p_wvi1_max = [] for i_wn, idxs11 in enumerate(idxs1): i_wc = pr_wc_max[b][idxs11[0]] i_op = idxs11[1] wvi = pr_wvi_beam_op_list[i_op][b][idxs11[0]][idxs11[2]] # idx11[0] # get wv_str temp_pr_wv_str, _ = convert_pred_wvi_to_string([[wvi]], [nlu_t[b]], [nlu_wp_t[b]], [tt_to_t_idx[b]], [nlu[b]]) merged_wv11 = merge_wv_t1_eng(temp_pr_wv_str[0][0], nlu[b]) conds11 = [i_wc, i_op, merged_wv11] prob_conds11 = prob_w[b, idxs11[0], idxs11[1], idxs11[2]] p_wc11_max = prob_wc_dupl[b, idxs11[0], idxs11[1], idxs11[2]] p_wo11_max = prob_wo_dupl[b, idxs11[0], idxs11[1], idxs11[2]] p_wvi11_max = [ prob_wvi_st_dupl[b, idxs11[0], idxs11[1], idxs11[2]], prob_wvi_ed_dupl[b, idxs11[0], idxs11[1], idxs11[2]] ] # test execution # print(nlu[b]) # print(tb[b]['id'], tb[b]['types'], pr_sc[b], pr_sa[b], [conds11]) pr_ans = engine.execute(tb[b]['id'], pr_sc_best[b], pr_sa_best[b], [conds11]) if bool(pr_ans): # pr_ans is not empty! conds_max1.append(conds11) prob_conds_max1.append(prob_conds11) pr_wvi1_max.append(wvi) p_wc1_max.append(p_wc11_max) p_wo1_max.append(p_wo11_max) p_wvi1_max.append(p_wvi11_max) conds_max.append(conds_max1) prob_conds_max.append(prob_conds_max1) pr_wvi_max.append(pr_wvi1_max) p_wc_max.append(p_wc1_max) p_wo_max.append(p_wo1_max) p_wvi_max.append(p_wvi1_max) # May need to do more exhuastive search? # i.e. up to.. getting all executable cases. # Calculate total probability to decide the number of where-clauses pr_sql_i = [] prob_wn_w = [] # total where-clause probability pr_wn_based_on_prob = [] pr_wvi_best = [] p_wc = [] p_wo = [] p_wvi = [] for b, prob_wn1 in enumerate(prob_wn): max_executable_wn1 = len(conds_max[b]) prob_wn_w1 = [] prob_wn_w1.append(prob_wn1[0]) # wn=0 case. for i_wn in range(max_executable_wn1): prob_wn_w11 = prob_wn1[i_wn + 1] * prob_conds_max[b][i_wn] prob_wn_w1.append(prob_wn_w11) pr_wn_based_on_prob.append(argmax(prob_wn_w1)) prob_wn_w.append(prob_wn_w1) pr_sql_i1 = {'agg': pr_sa_best[b], 'sel': pr_sc_best[b], 'conds': conds_max[b][:pr_wn_based_on_prob[b]]} pr_wvi_best1 = pr_wvi_max[b][:pr_wn_based_on_prob[b]] pr_sql_i.append(pr_sql_i1) pr_wvi_best.append(pr_wvi_best1) p_wc.append( p_wc_max[b][:pr_wn_based_on_prob[b]] ) p_wo.append( p_wo_max[b][:pr_wn_based_on_prob[b]] ) p_wvi.append( p_wvi_max[b][:pr_wn_based_on_prob[b]] ) # s_wv = [B, n_where_num, max_nlu_tokens, 2] p_wn = cal_prob_wn(s_wn, pr_wn_based_on_prob) p_where = cal_prob_where(p_wn, p_wc, p_wo, p_wvi) return prob_w, prob_wn_w, pr_wn_based_on_prob, pr_sql_i, pr_wvi_best, \ p_where, p_wn, p_wc, p_wo, p_wvi def Loss_s2s(score, g_pnt_idxs): """ score = [B, T, max_seq_length] """ # WHERE string part loss = 0 for b, g_pnt_idxs1 in enumerate(g_pnt_idxs): ed = len(g_pnt_idxs1) - 1 score_part = score[b, :ed] loss += F.cross_entropy(score_part, torch.tensor(g_pnt_idxs1[1:]).to(device)) # +1 shift. return loss
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 29899, 6338, 8598, 5348, 2994, 29886, 29889, 13, 29937, 13380, 19245, 325, 29906, 29889, 29900, 13, 13, 29937, 529, 5813, 29958, 13, 13, 5215, 2897, 29892, 4390, 13, 3166, 3509, 1053, 6483, 8552, 13, 3166, 22889, 29889, 2272, 8205, 1053, 334, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 13, 13, 10141, 353, 4842, 305, 29889, 10141, 703, 29883, 6191, 29908, 565, 4842, 305, 29889, 29883, 6191, 29889, 275, 29918, 16515, 580, 1683, 376, 21970, 1159, 13, 13, 3166, 18074, 417, 1564, 29889, 13239, 29889, 13239, 1053, 2246, 29895, 29918, 9910, 29918, 6229, 13, 3166, 18074, 417, 1564, 29889, 13239, 29889, 13239, 29918, 2851, 275, 1519, 1053, 334, 13, 13, 1990, 25981, 29906, 4176, 29918, 29894, 29896, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29892, 13, 462, 1353, 29918, 1116, 29918, 3554, 29892, 1353, 29918, 16170, 29918, 3554, 29892, 2030, 29922, 8824, 1125, 13, 4706, 2428, 29898, 23718, 29906, 4176, 29918, 29894, 29896, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 1583, 29889, 3317, 29918, 3062, 29918, 4537, 353, 29871, 29946, 13, 4706, 1583, 29889, 4537, 29918, 1116, 29918, 3554, 353, 1353, 29918, 1116, 29918, 3554, 13, 4706, 1583, 29889, 4537, 29918, 16170, 29918, 3554, 353, 1353, 29918, 16170, 29918, 3554, 13, 13, 4706, 1583, 29889, 2622, 29918, 4914, 29918, 27711, 353, 7605, 4409, 23084, 919, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29897, 13, 4706, 1583, 29889, 2622, 29918, 16170, 29918, 27711, 353, 7605, 29909, 1505, 23084, 919, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29892, 1353, 29918, 16170, 29918, 3554, 29892, 2030, 29922, 1025, 29897, 13, 4706, 1583, 29889, 3062, 29918, 4537, 29918, 27711, 353, 6804, 4557, 23084, 919, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29897, 13, 4706, 1583, 29889, 29893, 6814, 353, 6804, 4409, 23084, 919, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29897, 13, 4706, 1583, 29889, 29893, 459, 353, 6804, 11746, 23084, 919, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29892, 1353, 29918, 1116, 29918, 3554, 29897, 13, 4706, 1583, 29889, 29893, 29894, 29886, 353, 6804, 1917, 23084, 919, 29918, 2962, 355, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29892, 1353, 29918, 1116, 29918, 3554, 29892, 2030, 29922, 1025, 29897, 396, 1369, 29899, 355, 29899, 4478, 29899, 2218, 29883, 20386, 1230, 1904, 13, 13, 1678, 396, 7232, 29918, 12470, 29892, 518, 29896, 29953, 29892, 29906, 29953, 29892, 29896, 29945, 29941, 29953, 29962, 13, 1678, 396, 7431, 29918, 12470, 29892, 518, 29896, 29953, 29962, 13, 1678, 396, 7232, 29918, 6672, 29892, 518, 29896, 29900, 29906, 29892, 29896, 29906, 29892, 29896, 29945, 29941, 29953, 29962, 13, 1678, 396, 7431, 29918, 6672, 29918, 6979, 29892, 518, 29896, 29900, 29906, 29962, 13, 1678, 396, 1353, 29918, 6672, 29892, 518, 29896, 29953, 29962, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 13, 18884, 330, 29918, 1557, 29922, 8516, 29892, 330, 29918, 4977, 29922, 8516, 29892, 330, 29918, 1233, 29922, 8516, 29892, 330, 29918, 29893, 29883, 29922, 8516, 29892, 330, 29918, 827, 29922, 8516, 29892, 330, 29918, 29893, 1403, 29922, 8516, 29892, 13, 18884, 1510, 29918, 29886, 29918, 1557, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 4977, 29922, 8824, 29892, 13, 18884, 1510, 29918, 29886, 29918, 1233, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29883, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 827, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29894, 29922, 8824, 1125, 13, 13, 4706, 396, 885, 13, 4706, 269, 29918, 1557, 29892, 29879, 29918, 1557, 29918, 2695, 3317, 353, 1583, 29889, 2622, 29918, 4914, 29918, 27711, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 1557, 29922, 4294, 29918, 29886, 29918, 1557, 29897, 13, 13, 4706, 565, 330, 29918, 1557, 29901, 13, 9651, 544, 29918, 1557, 353, 330, 29918, 1557, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 1557, 353, 4450, 29918, 1557, 29898, 29879, 29918, 1557, 29897, 13, 13, 4706, 396, 872, 13, 4706, 269, 29918, 4977, 29892, 29879, 29918, 4977, 29918, 2695, 3317, 353, 1583, 29889, 2622, 29918, 16170, 29918, 27711, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 544, 29918, 1557, 29892, 1510, 29918, 29886, 29918, 4977, 29922, 4294, 29918, 29886, 29918, 4977, 29897, 13, 4706, 565, 330, 29918, 4977, 29901, 13, 9651, 396, 372, 29915, 29879, 451, 5181, 2466, 29889, 13, 9651, 544, 29918, 4977, 353, 330, 29918, 4977, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 4977, 353, 4450, 29918, 4977, 29898, 29879, 29918, 4977, 29897, 13, 13, 13, 4706, 396, 281, 29876, 13, 4706, 269, 29918, 1233, 29892, 29879, 29918, 1233, 29918, 2695, 3317, 353, 1583, 29889, 3062, 29918, 4537, 29918, 27711, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 1233, 29922, 4294, 29918, 29886, 29918, 1233, 29897, 13, 13, 4706, 565, 330, 29918, 1233, 29901, 13, 9651, 544, 29918, 1233, 353, 330, 29918, 1233, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 1233, 353, 4450, 29918, 1233, 29898, 29879, 29918, 1233, 29897, 13, 13, 4706, 396, 28678, 13, 4706, 269, 29918, 29893, 29883, 29892, 29879, 29918, 29893, 29883, 29918, 2695, 3317, 353, 1583, 29889, 29893, 6814, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 29893, 29883, 29922, 4294, 29918, 29886, 29918, 29893, 29883, 29892, 27368, 29922, 5574, 29897, 13, 13, 4706, 565, 330, 29918, 29893, 29883, 29901, 13, 9651, 544, 29918, 29893, 29883, 353, 330, 29918, 29893, 29883, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 29893, 29883, 353, 4450, 29918, 3062, 4914, 29898, 558, 29918, 1233, 29892, 269, 29918, 29893, 29883, 29897, 13, 13, 4706, 396, 8879, 13, 4706, 269, 29918, 827, 29892, 29879, 29918, 827, 29918, 2695, 3317, 353, 1583, 29889, 29893, 459, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 281, 29876, 29922, 558, 29918, 1233, 29892, 28678, 29922, 558, 29918, 29893, 29883, 29892, 1510, 29918, 29886, 29918, 827, 29922, 4294, 29918, 29886, 29918, 827, 29897, 13, 13, 4706, 565, 330, 29918, 827, 29901, 13, 9651, 544, 29918, 827, 353, 330, 29918, 827, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 827, 353, 4450, 29918, 827, 29898, 558, 29918, 1233, 29892, 269, 29918, 827, 29897, 13, 13, 4706, 396, 281, 29894, 13, 4706, 269, 29918, 29893, 29894, 29892, 29879, 29918, 29893, 29894, 29918, 2695, 3317, 353, 1583, 29889, 29893, 29894, 29886, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 281, 29876, 29922, 558, 29918, 1233, 29892, 28678, 29922, 558, 29918, 29893, 29883, 29892, 8879, 29922, 558, 29918, 827, 29892, 1510, 29918, 29886, 29918, 29893, 29894, 29922, 4294, 29918, 29886, 29918, 29893, 29894, 29897, 13, 13, 4706, 736, 269, 29918, 1557, 29892, 269, 29918, 4977, 29892, 269, 29918, 1233, 29892, 269, 29918, 29893, 29883, 29892, 269, 29918, 827, 29892, 269, 29918, 29893, 29894, 29892, 269, 29918, 1557, 29918, 2695, 3317, 29892, 269, 29918, 4977, 29918, 2695, 3317, 29892, 269, 29918, 1233, 29918, 2695, 3317, 29892, 269, 29918, 29893, 29883, 29918, 2695, 3317, 29892, 269, 29918, 827, 29918, 2695, 3317, 29892, 269, 29918, 29893, 29894, 29918, 2695, 3317, 13, 13, 1678, 822, 22913, 29918, 11333, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 6012, 29892, 260, 29890, 29892, 13, 462, 268, 302, 6092, 29918, 29873, 29892, 302, 6092, 29918, 11912, 29918, 29873, 29892, 19247, 29918, 517, 29918, 1332, 29918, 2248, 29892, 302, 6092, 29892, 13, 462, 268, 22913, 29918, 2311, 29922, 29946, 29892, 13, 462, 268, 1510, 29918, 29886, 29918, 1557, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 4977, 29922, 8824, 29892, 13, 462, 268, 1510, 29918, 29886, 29918, 1233, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29883, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 827, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29894, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 11080, 918, 29899, 2543, 2618, 22913, 1602, 3689, 29889, 13, 4706, 9995, 13, 4706, 396, 885, 13, 4706, 269, 29918, 1557, 29892, 29918, 353, 1583, 29889, 2622, 29918, 4914, 29918, 27711, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 1557, 29922, 4294, 29918, 29886, 29918, 1557, 29897, 13, 4706, 2070, 29918, 1557, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 1557, 29892, 3964, 10457, 29896, 29897, 13, 4706, 289, 29903, 29892, 286, 29883, 29931, 353, 269, 29918, 1557, 29889, 12181, 13, 13, 4706, 396, 9212, 29918, 6672, 29918, 2848, 353, 1375, 29898, 29880, 29918, 6672, 29897, 13, 4706, 396, 22913, 29918, 2311, 353, 9212, 29918, 6672, 29918, 2848, 565, 22913, 29918, 2311, 1405, 9212, 29918, 6672, 29918, 2848, 1683, 22913, 29918, 2311, 13, 13, 4706, 396, 872, 13, 4706, 396, 1281, 4984, 599, 1950, 885, 29918, 4977, 29918, 13628, 13, 4706, 2070, 29918, 1557, 29918, 4977, 353, 4842, 305, 29889, 3298, 359, 4197, 29890, 29903, 29892, 22913, 29918, 2311, 29892, 1583, 29889, 4537, 29918, 16170, 29918, 3554, 14664, 517, 29898, 10141, 29897, 13, 4706, 2070, 29918, 29879, 1113, 353, 4842, 305, 29889, 3298, 359, 29918, 4561, 29898, 22795, 29918, 1557, 29918, 4977, 467, 517, 29898, 10141, 29897, 13, 13, 4706, 396, 679, 278, 2246, 29899, 29895, 16285, 29889, 29871, 544, 29918, 1557, 29918, 915, 314, 353, 518, 29933, 29892, 22913, 29918, 2311, 29962, 13, 4706, 544, 29918, 1557, 29918, 915, 314, 353, 4450, 29918, 1557, 29918, 915, 314, 29898, 29879, 29918, 1557, 29892, 22913, 29918, 2311, 29897, 13, 13, 4706, 396, 8147, 322, 8500, 269, 29918, 4977, 29889, 13, 4706, 363, 474, 29918, 915, 314, 297, 3464, 29898, 915, 314, 29918, 2311, 1125, 13, 9651, 544, 29918, 1557, 353, 1051, 29898, 1409, 29898, 558, 29918, 1557, 29918, 915, 314, 29897, 7503, 29892, 29875, 29918, 915, 314, 29962, 1723, 13, 9651, 269, 29918, 4977, 29892, 29918, 353, 1583, 29889, 2622, 29918, 16170, 29918, 27711, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 544, 29918, 1557, 29892, 1510, 29918, 29886, 29918, 4977, 29922, 4294, 29918, 29886, 29918, 4977, 29897, 13, 9651, 2070, 29918, 4977, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 4977, 29892, 3964, 10457, 29896, 29897, 13, 9651, 2070, 29918, 1557, 29918, 4977, 7503, 29892, 474, 29918, 915, 314, 29892, 584, 29962, 353, 2070, 29918, 4977, 13, 13, 9651, 2070, 29918, 1557, 29918, 8391, 353, 2070, 29918, 1557, 29961, 3881, 29898, 29890, 29903, 511, 544, 29918, 1557, 29962, 396, 518, 29933, 29962, 13, 9651, 2070, 29918, 29879, 1113, 7503, 29892, 29875, 29918, 915, 314, 29892, 17531, 353, 29871, 313, 22795, 29918, 4977, 29889, 29873, 580, 334, 2070, 29918, 1557, 29918, 8391, 467, 29873, 580, 13, 9651, 396, 518, 14047, 29931, 29892, 350, 29962, 334, 518, 29933, 29962, 1599, 518, 14047, 29931, 29892, 350, 29962, 313, 5029, 29899, 3538, 21666, 29897, 13, 9651, 396, 518, 14047, 29931, 29892, 350, 29962, 1599, 518, 29933, 29892, 286, 29883, 29931, 29962, 13, 13, 4706, 396, 20535, 403, 278, 9927, 310, 12489, 13, 4706, 396, 2025, 29918, 6229, 353, 7431, 29898, 22795, 29918, 29879, 1113, 29889, 12181, 29897, 13, 13, 4706, 396, 3824, 1652, 8606, 304, 29871, 29896, 29899, 29881, 13, 4706, 1178, 10351, 353, 2246, 29895, 29918, 9910, 29918, 6229, 29898, 7345, 305, 29889, 20158, 29898, 22795, 29918, 29879, 1113, 511, 302, 29918, 3332, 29895, 29922, 915, 314, 29918, 2311, 29892, 9853, 29918, 28997, 29922, 5574, 29897, 13, 4706, 396, 2567, 408, 885, 29918, 13140, 338, 2307, 12705, 29892, 337, 29899, 1958, 963, 6284, 29889, 13, 13, 4706, 1178, 10351, 353, 1083, 481, 29918, 1557, 29918, 13140, 29898, 333, 10351, 29892, 544, 29918, 1557, 29918, 915, 314, 29897, 396, 518, 1557, 29918, 915, 314, 29918, 13140, 29892, 872, 29918, 13140, 29962, 1599, 518, 1557, 29918, 13140, 29892, 872, 29918, 13140, 29962, 13, 4706, 1178, 10351, 29918, 2749, 353, 1409, 29898, 333, 10351, 29897, 13, 4706, 396, 518, 29933, 29892, 22913, 29918, 2311, 29892, 3933, 335, 3964, 29962, 13, 4706, 396, 1178, 10351, 29961, 29890, 3816, 29900, 29962, 4076, 937, 16269, 518, 1557, 29918, 13140, 29892, 872, 29918, 13140, 29962, 11000, 29889, 13, 4706, 396, 1178, 10351, 29961, 29890, 3816, 29896, 29962, 4076, 310, 1473, 29889, 13, 13, 4706, 396, 20535, 403, 2070, 29918, 29879, 1113, 29892, 263, 14002, 6976, 13, 4706, 22913, 29918, 13140, 29918, 29879, 1113, 353, 518, 29900, 29962, 334, 289, 29903, 13, 4706, 22913, 29918, 1004, 300, 29918, 1552, 29918, 8394, 353, 518, 8824, 29962, 334, 289, 29903, 13, 4706, 1550, 5852, 29901, 13, 9651, 544, 29918, 1557, 353, 1178, 10351, 29918, 2749, 29961, 3881, 29898, 29890, 29903, 511, 915, 314, 29918, 13140, 29918, 29879, 1113, 29892, 29900, 29962, 13, 9651, 544, 29918, 4977, 353, 1178, 10351, 29918, 2749, 29961, 3881, 29898, 29890, 29903, 511, 915, 314, 29918, 13140, 29918, 29879, 1113, 29892, 29896, 29962, 13, 13, 9651, 396, 2910, 2380, 6284, 13, 13, 9651, 1423, 353, 1423, 29918, 1557, 29918, 4977, 29918, 29886, 7121, 29898, 22625, 29892, 544, 29918, 1557, 29892, 544, 29918, 4977, 29897, 13, 13, 9651, 565, 2533, 29898, 3198, 29897, 1275, 289, 29903, 29901, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 363, 289, 29892, 1423, 29896, 297, 26985, 29898, 3198, 1125, 13, 462, 1678, 565, 451, 1423, 29896, 29901, 396, 2743, 5101, 13, 462, 4706, 22913, 29918, 13140, 29918, 29879, 1113, 29961, 29890, 29962, 4619, 29871, 29896, 13, 462, 4706, 565, 22913, 29918, 13140, 29918, 29879, 1113, 29961, 29890, 29962, 6736, 22913, 29918, 2311, 29901, 13, 462, 9651, 22913, 29918, 1004, 300, 29918, 1552, 29918, 8394, 29961, 29890, 29962, 353, 5852, 13, 462, 9651, 22913, 29918, 13140, 29918, 29879, 1113, 29961, 29890, 29962, 22361, 29871, 29896, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 22913, 29918, 1004, 300, 29918, 1552, 29918, 8394, 29961, 29890, 29962, 353, 5852, 13, 13, 9651, 565, 2533, 29898, 915, 314, 29918, 1004, 300, 29918, 1552, 29918, 8394, 29897, 1275, 289, 29903, 29901, 13, 18884, 2867, 13, 13, 13, 4706, 396, 2567, 544, 29918, 1557, 29892, 544, 29918, 4977, 526, 6284, 25383, 29889, 13, 4706, 544, 29918, 1557, 29918, 13318, 353, 1051, 29898, 558, 29918, 1557, 29897, 13, 4706, 544, 29918, 4977, 29918, 13318, 353, 1051, 29898, 558, 29918, 4977, 29897, 13, 13, 4706, 396, 2567, 29892, 6804, 29899, 16398, 1509, 22913, 2740, 29889, 13, 4706, 269, 29918, 1233, 29892, 29918, 353, 1583, 29889, 3062, 29918, 4537, 29918, 27711, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 1233, 29922, 4294, 29918, 29886, 29918, 1233, 29897, 13, 4706, 2070, 29918, 1233, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 1233, 29892, 3964, 10457, 29896, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 13, 4706, 396, 7460, 376, 4258, 9246, 29908, 1556, 5517, 29871, 29946, 29898, 29922, 3317, 29918, 1949, 29918, 974, 29918, 1116, 2187, 29897, 988, 29899, 16398, 6394, 29889, 13, 4706, 396, 28678, 13, 4706, 269, 29918, 29893, 29883, 29892, 29918, 353, 1583, 29889, 29893, 6814, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 29893, 29883, 29922, 4294, 29918, 29886, 29918, 29893, 29883, 29892, 27368, 29922, 5574, 29897, 13, 4706, 2070, 29918, 29893, 29883, 353, 383, 29889, 18816, 29885, 3398, 29898, 29879, 29918, 29893, 29883, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 4706, 396, 544, 29918, 29893, 29883, 29918, 24582, 29918, 1609, 29918, 22795, 353, 4450, 29918, 29893, 29883, 29918, 24582, 29918, 1609, 29918, 22795, 29898, 29879, 29918, 29893, 29883, 29897, 13, 13, 4706, 396, 679, 4236, 29918, 1233, 396, 310, 1556, 16269, 4341, 669, 1009, 2070, 29889, 13, 4706, 544, 29918, 1233, 29918, 3317, 353, 518, 1311, 29889, 3317, 29918, 3062, 29918, 4537, 29962, 334, 289, 29903, 13, 4706, 544, 29918, 29893, 29883, 29918, 3317, 353, 4450, 29918, 3062, 4914, 29898, 558, 29918, 1233, 29918, 3317, 29892, 269, 29918, 29893, 29883, 29897, 396, 565, 777, 1897, 437, 451, 505, 16813, 988, 29899, 16398, 1709, 29892, 288, 2415, 393, 1897, 13, 4706, 2070, 29918, 29893, 29883, 29918, 3317, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 3317, 29918, 3062, 29918, 4537, 2314, 13, 4706, 363, 289, 29892, 544, 29918, 29893, 29883, 29918, 3317, 29896, 297, 26985, 29898, 558, 29918, 29893, 29883, 29918, 3317, 1125, 13, 9651, 2070, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 29892, 17531, 353, 2070, 29918, 29893, 29883, 29961, 29890, 29892, 558, 29918, 29893, 29883, 29918, 3317, 29896, 29962, 13, 13, 4706, 396, 679, 1556, 16269, 4236, 29918, 1233, 988, 29899, 695, 23676, 13, 4706, 396, 8879, 13, 4706, 269, 29918, 827, 29918, 3317, 29892, 29918, 353, 1583, 29889, 29893, 459, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 281, 29876, 29922, 558, 29918, 1233, 29918, 3317, 29892, 28678, 29922, 558, 29918, 29893, 29883, 29918, 3317, 29892, 1510, 29918, 29886, 29918, 827, 29922, 4294, 29918, 29886, 29918, 827, 29897, 13, 4706, 2070, 29918, 827, 29918, 3317, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 827, 29918, 3317, 29892, 3964, 10457, 29896, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 4706, 396, 518, 29933, 29892, 4236, 29918, 1233, 29892, 302, 29918, 1116, 29918, 459, 29962, 13, 13, 4706, 544, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 353, 5159, 13, 4706, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 353, 5159, 13, 4706, 363, 474, 29918, 459, 29871, 297, 3464, 29898, 1311, 29889, 4537, 29918, 1116, 29918, 3554, 448, 29871, 29896, 1125, 13, 9651, 544, 29918, 827, 29918, 7382, 353, 5519, 29875, 29918, 459, 29962, 334, 1583, 29889, 3317, 29918, 3062, 29918, 4537, 29962, 334, 289, 29903, 13, 9651, 396, 281, 29894, 13, 9651, 269, 29918, 29893, 29894, 29892, 29918, 353, 1583, 29889, 29893, 29894, 29886, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 281, 29876, 29922, 558, 29918, 1233, 29918, 3317, 29892, 28678, 29922, 558, 29918, 29893, 29883, 29918, 3317, 29892, 8879, 29922, 558, 29918, 827, 29918, 7382, 29892, 1510, 29918, 29886, 29918, 29893, 29894, 29922, 4294, 29918, 29886, 29918, 29893, 29894, 29897, 13, 9651, 2070, 29918, 29893, 29894, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 29893, 29894, 29892, 3964, 10457, 29906, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 13, 9651, 396, 2070, 29918, 29893, 29894, 13, 9651, 544, 29918, 29893, 1403, 29918, 915, 314, 29892, 2070, 29918, 29893, 1403, 29918, 915, 314, 353, 4450, 29918, 29893, 1403, 29918, 344, 29918, 915, 314, 29898, 1311, 29889, 3317, 29918, 3062, 29918, 4537, 29892, 269, 29918, 29893, 29894, 29892, 22913, 29918, 2311, 29897, 13, 9651, 544, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29889, 4397, 29898, 558, 29918, 29893, 1403, 29918, 915, 314, 29897, 13, 9651, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29889, 4397, 29898, 22795, 29918, 29893, 1403, 29918, 915, 314, 29897, 13, 9651, 396, 544, 29918, 29893, 1403, 29918, 915, 314, 353, 518, 29933, 29892, 4236, 29918, 1233, 29892, 413, 29918, 1188, 277, 1068, 29906, 518, 303, 29892, 1226, 29962, 610, 275, 29962, 13, 13, 9651, 396, 4450, 29918, 29893, 29894, 29918, 915, 314, 13, 13, 4706, 396, 20535, 403, 14002, 6976, 310, 988, 29899, 16398, 1509, 13, 4706, 396, 2070, 29918, 29893, 353, 518, 16175, 29892, 28678, 29892, 8879, 29892, 281, 29894, 29962, 353, 518, 29933, 29892, 4236, 29918, 1233, 29892, 302, 29918, 1116, 29918, 459, 29892, 302, 29918, 29886, 7121, 29962, 13, 4706, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 353, 2070, 29918, 29893, 1403, 29918, 915, 314, 29889, 12181, 29961, 29906, 29962, 13, 4706, 2070, 29918, 29893, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 3317, 29918, 3062, 29918, 4537, 29892, 1583, 29889, 4537, 29918, 1116, 29918, 3554, 448, 29871, 29896, 29892, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 2314, 13, 4706, 363, 289, 297, 3464, 29898, 29890, 29903, 1125, 13, 9651, 363, 474, 29918, 1233, 297, 3464, 29898, 1311, 29889, 3317, 29918, 3062, 29918, 4537, 1125, 13, 18884, 363, 474, 29918, 459, 297, 3464, 29898, 1311, 29889, 4537, 29918, 1116, 29918, 3554, 448, 29871, 29896, 1125, 396, 437, 451, 671, 2186, 697, 13, 462, 1678, 363, 474, 29918, 29893, 29894, 29918, 915, 314, 297, 3464, 29898, 29876, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 1125, 13, 462, 4706, 396, 474, 29918, 29893, 29883, 353, 544, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 3816, 29875, 29918, 1233, 29962, 396, 2307, 2309, 13, 462, 4706, 282, 29918, 29893, 29883, 353, 2070, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 29892, 474, 29918, 1233, 29962, 13, 462, 4706, 282, 29918, 827, 353, 2070, 29918, 827, 29918, 3317, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29962, 13, 462, 4706, 282, 29918, 29893, 29894, 353, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29961, 29875, 29918, 459, 3816, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 13, 13, 462, 4706, 2070, 29918, 29893, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 353, 282, 29918, 29893, 29883, 334, 282, 29918, 827, 334, 282, 29918, 29893, 29894, 13, 13, 4706, 396, 27313, 8225, 1410, 2618, 1602, 3689, 13, 4706, 2148, 29879, 29918, 3317, 353, 5159, 13, 4706, 2070, 29918, 1116, 29879, 29918, 3317, 353, 5159, 13, 4706, 396, 1550, 7431, 29898, 1116, 29879, 29918, 3317, 29897, 529, 1583, 29889, 3317, 29918, 1233, 29901, 13, 4706, 1178, 10351, 353, 2246, 29895, 29918, 9910, 29918, 6229, 29898, 7345, 305, 29889, 20158, 29898, 22795, 29918, 29893, 511, 302, 29918, 3332, 29895, 29922, 915, 314, 29918, 2311, 29892, 9853, 29918, 28997, 29922, 5574, 29897, 13, 4706, 396, 1178, 10351, 353, 518, 29933, 29892, 474, 29918, 29893, 29883, 29918, 915, 314, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 29886, 7121, 29962, 13, 13, 4706, 396, 1281, 4984, 2148, 29879, 29896, 13, 4706, 363, 289, 29892, 1178, 10351, 29896, 297, 26985, 29898, 333, 10351, 1125, 13, 9651, 2148, 29879, 29918, 3317, 29896, 353, 5159, 13, 9651, 2070, 29918, 1116, 29879, 29918, 3317, 29896, 353, 5159, 13, 9651, 363, 474, 29918, 1233, 29892, 1178, 10351, 29896, 29896, 297, 26985, 29898, 333, 10351, 29896, 1125, 13, 18884, 474, 29918, 29893, 29883, 353, 544, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 3816, 333, 10351, 29896, 29896, 29961, 29900, 5262, 13, 18884, 474, 29918, 459, 353, 1178, 10351, 29896, 29896, 29961, 29896, 29962, 13, 18884, 281, 1403, 353, 544, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29961, 29875, 29918, 459, 3816, 29890, 3816, 333, 10351, 29896, 29896, 29961, 29900, 29962, 3816, 333, 10351, 29896, 29896, 29961, 29906, 5262, 13, 13, 18884, 396, 679, 281, 29894, 29918, 710, 13, 18884, 5694, 29918, 558, 29918, 29893, 29894, 29918, 710, 29892, 903, 353, 3588, 29918, 11965, 29918, 29893, 1403, 29918, 517, 29918, 1807, 4197, 29961, 29893, 1403, 20526, 518, 29876, 6092, 29918, 29873, 29961, 29890, 20526, 518, 29876, 6092, 29918, 11912, 29918, 29873, 29961, 29890, 20526, 518, 11912, 29918, 517, 29918, 1332, 29918, 2248, 29961, 29890, 20526, 518, 29876, 6092, 29961, 29890, 24960, 13, 18884, 19412, 29918, 29893, 29894, 29896, 29896, 353, 10366, 29918, 29893, 29894, 29918, 29873, 29896, 29918, 996, 29898, 7382, 29918, 558, 29918, 29893, 29894, 29918, 710, 29961, 29900, 3816, 29900, 1402, 302, 6092, 29961, 29890, 2314, 13, 18884, 2148, 29879, 29896, 29896, 353, 518, 29875, 29918, 29893, 29883, 29892, 474, 29918, 459, 29892, 19412, 29918, 29893, 29894, 29896, 29896, 29962, 13, 13, 18884, 2070, 29918, 1116, 29879, 29896, 29896, 353, 2070, 29918, 29893, 29961, 29890, 29892, 1178, 10351, 29896, 29896, 29961, 29900, 1402, 1178, 10351, 29896, 29896, 29961, 29896, 1402, 1178, 10351, 29896, 29896, 29961, 29906, 29962, 4514, 13, 13, 18884, 396, 1243, 8225, 13, 18884, 396, 1596, 29898, 29876, 6092, 29961, 29890, 2314, 13, 18884, 396, 1596, 29898, 22625, 29961, 29890, 22322, 333, 7464, 260, 29890, 29961, 29890, 22322, 8768, 7464, 544, 29918, 1557, 29961, 29890, 1402, 544, 29918, 4977, 29961, 29890, 1402, 518, 1116, 29879, 29896, 29896, 2314, 13, 18884, 544, 29918, 550, 353, 6012, 29889, 7978, 29898, 22625, 29961, 29890, 22322, 333, 7464, 544, 29918, 1557, 29961, 29890, 1402, 544, 29918, 4977, 29961, 29890, 1402, 518, 1116, 29879, 29896, 29896, 2314, 13, 18884, 565, 6120, 29898, 558, 29918, 550, 1125, 13, 462, 1678, 396, 544, 29918, 550, 338, 451, 4069, 29991, 13, 462, 1678, 2148, 29879, 29918, 3317, 29896, 29889, 4397, 29898, 1116, 29879, 29896, 29896, 29897, 13, 462, 1678, 2070, 29918, 1116, 29879, 29918, 3317, 29896, 29889, 4397, 29898, 22795, 29918, 1116, 29879, 29896, 29896, 29897, 13, 9651, 2148, 29879, 29918, 3317, 29889, 4397, 29898, 1116, 29879, 29918, 3317, 29896, 29897, 13, 9651, 2070, 29918, 1116, 29879, 29918, 3317, 29889, 4397, 29898, 22795, 29918, 1116, 29879, 29918, 3317, 29896, 29897, 13, 13, 9651, 396, 2610, 817, 304, 437, 901, 429, 6905, 579, 573, 2740, 29973, 13, 9651, 396, 474, 29889, 29872, 29889, 701, 304, 636, 2805, 599, 16813, 4251, 29889, 13, 13, 4706, 396, 20535, 403, 3001, 6976, 304, 11097, 278, 1353, 310, 988, 29899, 16398, 6394, 13, 4706, 544, 29918, 2850, 29918, 29875, 353, 5159, 13, 4706, 2070, 29918, 1233, 29918, 29893, 353, 5159, 13, 4706, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 353, 5159, 13, 13, 4706, 363, 289, 29892, 2070, 29918, 1233, 29896, 297, 26985, 29898, 22795, 29918, 1233, 1125, 13, 9651, 4236, 29918, 4258, 9246, 29918, 1233, 29896, 353, 7431, 29898, 2148, 29879, 29918, 3317, 29961, 29890, 29962, 1723, 13, 9651, 2070, 29918, 1233, 29918, 29893, 29896, 353, 5159, 13, 9651, 2070, 29918, 1233, 29918, 29893, 29896, 29889, 4397, 29898, 22795, 29918, 1233, 29896, 29961, 29900, 2314, 29871, 396, 281, 29876, 29922, 29900, 1206, 29889, 13, 9651, 363, 474, 29918, 1233, 297, 3464, 29898, 3317, 29918, 4258, 9246, 29918, 1233, 29896, 1125, 13, 18884, 2070, 29918, 1233, 29918, 29893, 29896, 29896, 353, 2070, 29918, 1233, 29896, 29961, 29875, 29918, 1233, 29974, 29896, 29962, 334, 2070, 29918, 1116, 29879, 29918, 3317, 29961, 29890, 3816, 29875, 29918, 1233, 29962, 13, 18884, 2070, 29918, 1233, 29918, 29893, 29896, 29889, 4397, 29898, 22795, 29918, 1233, 29918, 29893, 29896, 29896, 29897, 13, 9651, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29889, 4397, 29898, 1191, 3317, 29898, 22795, 29918, 1233, 29918, 29893, 29896, 876, 13, 9651, 2070, 29918, 1233, 29918, 29893, 29889, 4397, 29898, 22795, 29918, 1233, 29918, 29893, 29896, 29897, 13, 13, 9651, 544, 29918, 2850, 29918, 29875, 29896, 353, 11117, 16170, 2396, 544, 29918, 4977, 29918, 13318, 29961, 29890, 1402, 525, 2838, 2396, 544, 29918, 1557, 29918, 13318, 29961, 29890, 1402, 525, 1116, 29879, 2396, 2148, 29879, 29918, 3317, 29961, 29890, 3816, 29901, 558, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29961, 29890, 5262, 29913, 13, 9651, 544, 29918, 2850, 29918, 29875, 29889, 4397, 29898, 558, 29918, 2850, 29918, 29875, 29896, 29897, 13, 4706, 396, 269, 29918, 29893, 29894, 353, 518, 29933, 29892, 4236, 29918, 1233, 29892, 4236, 29918, 29876, 6092, 29918, 517, 12360, 29892, 29871, 29906, 29962, 13, 4706, 736, 2070, 29918, 29879, 1113, 29892, 2070, 29918, 29893, 29892, 2070, 29918, 1233, 29918, 29893, 29892, 544, 29918, 1557, 29918, 13318, 29892, 544, 29918, 4977, 29918, 13318, 29892, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29892, 544, 29918, 2850, 29918, 29875, 13, 13, 1990, 7605, 4409, 23084, 919, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29922, 29941, 29900, 29900, 29892, 7934, 29918, 2311, 29922, 29896, 29900, 29900, 29892, 954, 29918, 13148, 29922, 29906, 29892, 5768, 449, 29922, 29900, 29889, 29941, 1125, 13, 4706, 2428, 29898, 3549, 4409, 23084, 919, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 13, 4706, 1583, 29889, 3977, 29918, 29882, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 3977, 29918, 29876, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 1131, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 29883, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 6672, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 1557, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 15755, 29889, 29911, 27731, 3285, 302, 29876, 29889, 12697, 29898, 29906, 334, 7934, 29918, 2311, 29892, 29871, 29896, 876, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29896, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29906, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 10457, 29896, 29897, 13, 13, 1678, 396, 7232, 29918, 12470, 29892, 518, 29896, 29953, 29892, 29906, 29953, 29892, 29896, 29945, 29941, 29953, 29962, 13, 1678, 396, 7431, 29918, 12470, 29892, 518, 29896, 29953, 29962, 13, 1678, 396, 7232, 29918, 6672, 29892, 518, 29896, 29900, 29906, 29892, 29896, 29906, 29892, 29896, 29945, 29941, 29953, 29962, 13, 1678, 396, 7431, 29918, 6672, 29918, 6979, 29892, 518, 29896, 29900, 29906, 29962, 13, 1678, 396, 1353, 29918, 6672, 29892, 518, 29896, 29953, 29962, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 1557, 29922, 8824, 1125, 13, 4706, 396, 1174, 401, 13, 4706, 18511, 29918, 12470, 353, 19750, 29898, 1311, 29889, 3977, 29918, 29876, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 13, 462, 4706, 736, 29918, 10892, 29922, 8824, 29892, 13, 462, 4706, 298, 29883, 29900, 29922, 8516, 29892, 13, 462, 4706, 1833, 29918, 6194, 29922, 8824, 29897, 29871, 396, 518, 29890, 29892, 302, 29892, 3964, 29962, 13, 13, 4706, 18511, 29918, 6672, 353, 19750, 29918, 6672, 29898, 1311, 29889, 3977, 29918, 29882, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 1353, 29918, 6672, 29897, 29871, 396, 518, 29890, 29892, 4839, 29892, 3964, 29962, 13, 13, 4706, 289, 29903, 353, 7431, 29898, 4537, 29918, 6672, 29897, 13, 4706, 286, 29931, 29918, 29876, 353, 4236, 29898, 2435, 29918, 12470, 29897, 13, 13, 4706, 396, 259, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29900, 29900, 29962, 334, 518, 29890, 29903, 29892, 29871, 29896, 29900, 29900, 29892, 286, 29931, 29918, 29876, 29962, 1599, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 286, 29931, 29918, 29876, 29962, 13, 4706, 1098, 29918, 29882, 353, 4842, 305, 29889, 29890, 4317, 29898, 26716, 29918, 6672, 29892, 1583, 29889, 29956, 29918, 1131, 29898, 26716, 29918, 12470, 467, 3286, 4220, 29898, 29896, 29892, 29871, 29906, 876, 13, 13, 4706, 396, 259, 7363, 18745, 373, 9654, 5633, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 286, 29931, 29918, 29876, 29901, 13, 18884, 1098, 29918, 29882, 29961, 29890, 29892, 584, 29892, 301, 29918, 29876, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 282, 29918, 29876, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 29898, 1131, 29918, 29882, 29897, 13, 4706, 565, 1510, 29918, 29886, 29918, 1557, 29901, 13, 9651, 396, 282, 353, 518, 29890, 29892, 4839, 29892, 302, 29962, 13, 9651, 565, 282, 29918, 29876, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 23145, 2159, 881, 367, 29871, 29896, 23157, 13, 9651, 2537, 29922, 4532, 29898, 29906, 29900, 29900, 29896, 29892, 2537, 2311, 7607, 29896, 29906, 29892, 29941, 29889, 29945, 876, 13, 9651, 396, 1014, 5317, 29898, 29953, 29892, 29906, 29892, 29955, 29897, 13, 9651, 1014, 5317, 29906, 7720, 3552, 29955, 29892, 29906, 511, 313, 29941, 29892, 29871, 29900, 511, 1948, 9653, 29922, 29906, 29897, 13, 9651, 3711, 580, 13, 9651, 903, 2780, 2433, 23973, 29895, 4912, 29915, 13, 9651, 903, 18098, 2433, 3045, 856, 29915, 13, 9651, 363, 474, 29918, 29882, 297, 3464, 29898, 4537, 29918, 6672, 29961, 29900, 29962, 1125, 13, 18884, 2927, 29918, 13140, 353, 474, 29918, 29882, 1273, 7431, 7373, 2780, 29897, 13, 18884, 6492, 29898, 29886, 29918, 29876, 29961, 29900, 3816, 29875, 29918, 29882, 3816, 29901, 1822, 1272, 29889, 23749, 580, 448, 474, 29918, 29882, 29892, 525, 489, 18717, 29918, 18098, 29961, 2780, 29918, 13140, 10062, 29918, 2780, 29961, 2780, 29918, 13140, 1402, 10887, 29922, 29955, 29897, 13, 13, 9651, 3611, 877, 1557, 29901, 282, 29918, 29876, 363, 1269, 298, 1495, 13, 9651, 6856, 29898, 5574, 29897, 13, 9651, 2537, 29889, 29873, 523, 29918, 2680, 580, 13, 9651, 2537, 29889, 15257, 29889, 4012, 580, 13, 9651, 1510, 580, 13, 13, 13, 13, 4706, 396, 259, 282, 29918, 29876, 518, 289, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 286, 29931, 29918, 29876, 29962, 29871, 1599, 518, 289, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 13, 4706, 396, 259, 281, 3977, 29918, 29876, 518, 289, 29903, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 289, 29903, 29892, 29871, 29896, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29900, 29900, 29962, 13, 4706, 396, 259, 1599, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29900, 29900, 29962, 13, 4706, 274, 29918, 29876, 353, 4842, 305, 29889, 16109, 29898, 29886, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29941, 511, 18511, 29918, 12470, 29889, 6948, 802, 29872, 911, 29898, 29896, 8106, 2083, 29898, 6229, 29922, 29906, 29897, 13, 13, 4706, 9649, 353, 4842, 305, 29889, 4117, 4197, 1311, 29889, 29956, 29918, 29883, 29898, 29883, 29918, 29876, 511, 1583, 29889, 29956, 29918, 6672, 29898, 26716, 29918, 6672, 29897, 1402, 3964, 29922, 29906, 29897, 13, 4706, 8158, 29918, 2622, 29918, 4914, 353, 1583, 29889, 1557, 29918, 449, 29898, 2003, 467, 29879, 802, 29872, 911, 29898, 29906, 29897, 396, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29962, 1599, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29962, 13, 4706, 8158, 29918, 2622, 29918, 4914, 29918, 2695, 3317, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 29898, 13628, 29918, 2622, 29918, 4914, 29897, 13, 4706, 396, 7363, 18745, 13, 4706, 4236, 29918, 2435, 29918, 6672, 353, 4236, 29898, 4537, 29918, 6672, 29897, 13, 4706, 363, 289, 29892, 301, 29918, 6672, 29896, 297, 26985, 29898, 4537, 29918, 6672, 1125, 13, 9651, 565, 301, 29918, 6672, 29896, 529, 4236, 29918, 2435, 29918, 6672, 29901, 13, 18884, 8158, 29918, 2622, 29918, 4914, 29961, 29890, 29892, 301, 29918, 6672, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 363, 289, 29892, 301, 29918, 6672, 29896, 297, 26985, 29898, 4537, 29918, 6672, 1125, 13, 9651, 565, 301, 29918, 6672, 29896, 529, 4236, 29918, 2435, 29918, 6672, 29901, 13, 18884, 8158, 29918, 2622, 29918, 4914, 29918, 2695, 3317, 29961, 29890, 29892, 301, 29918, 6672, 29896, 17531, 353, 29871, 29900, 13, 13, 4706, 736, 8158, 29918, 2622, 29918, 4914, 29892, 13628, 29918, 2622, 29918, 4914, 29918, 2695, 3317, 13, 13, 13, 1990, 7605, 29909, 1505, 23084, 919, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29922, 29941, 29900, 29900, 29892, 7934, 29918, 2311, 29922, 29896, 29900, 29900, 29892, 954, 29918, 13148, 29922, 29906, 29892, 5768, 449, 29922, 29900, 29889, 29941, 29892, 302, 29918, 16170, 29918, 3554, 10457, 29896, 29892, 2030, 29922, 8824, 1125, 13, 4706, 2428, 29898, 3549, 29909, 1505, 23084, 919, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 13, 4706, 1583, 29889, 3977, 29918, 29882, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 3977, 29918, 29876, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 1131, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 4977, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 15755, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 511, 13, 462, 462, 1678, 302, 29876, 29889, 29911, 27731, 3285, 13, 462, 462, 1678, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 302, 29918, 16170, 29918, 3554, 876, 29871, 396, 383, 11925, 1353, 310, 11404, 362, 5455, 29889, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29896, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29906, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 10457, 29896, 29897, 13, 4706, 565, 2030, 29901, 13, 9651, 396, 363, 1250, 827, 538, 24521, 13, 9651, 1583, 29889, 29956, 29918, 29883, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 9651, 1583, 29889, 29956, 29918, 6672, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 544, 29918, 1557, 29892, 1510, 29918, 29886, 29918, 4977, 29922, 8824, 1125, 13, 4706, 396, 1174, 401, 13, 4706, 18511, 29918, 12470, 353, 19750, 29898, 1311, 29889, 3977, 29918, 29876, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 13, 462, 4706, 736, 29918, 10892, 29922, 8824, 29892, 13, 462, 4706, 298, 29883, 29900, 29922, 8516, 29892, 13, 462, 4706, 1833, 29918, 6194, 29922, 8824, 29897, 29871, 396, 518, 29890, 29892, 302, 29892, 3964, 29962, 13, 13, 4706, 18511, 29918, 6672, 353, 19750, 29918, 6672, 29898, 1311, 29889, 3977, 29918, 29882, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29897, 29871, 396, 518, 29890, 29892, 4839, 29892, 3964, 29962, 13, 13, 4706, 289, 29903, 353, 7431, 29898, 29880, 29918, 6672, 29897, 13, 4706, 286, 29931, 29918, 29876, 353, 4236, 29898, 2435, 29918, 12470, 29897, 13, 13, 4706, 281, 3977, 29918, 6672, 29918, 711, 353, 18511, 29918, 6672, 29961, 1761, 29898, 3881, 29898, 29890, 29903, 8243, 544, 29918, 1557, 29962, 29871, 396, 1051, 29892, 577, 697, 4559, 363, 1269, 9853, 29889, 13, 13, 4706, 396, 518, 29890, 29903, 29892, 1139, 29918, 2435, 29892, 29871, 29896, 29900, 29900, 29962, 334, 518, 29890, 29903, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29962, 1599, 518, 29890, 29903, 29892, 1139, 29918, 2435, 29962, 13, 4706, 1098, 353, 4842, 305, 29889, 29890, 4317, 29898, 1311, 29889, 29956, 29918, 1131, 29898, 26716, 29918, 12470, 511, 281, 3977, 29918, 6672, 29918, 711, 29889, 6948, 802, 29872, 911, 29898, 29906, 8106, 29879, 802, 29872, 911, 29898, 29906, 29897, 13, 13, 4706, 396, 259, 7363, 18745, 373, 9654, 5633, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 286, 29931, 29918, 29876, 29901, 13, 18884, 1098, 29961, 29890, 29892, 301, 29918, 29876, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 4706, 396, 518, 29890, 29903, 29892, 1139, 29918, 2435, 29962, 13, 4706, 282, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 29898, 1131, 29897, 13, 13, 4706, 565, 1510, 29918, 29886, 29918, 4977, 29901, 13, 9651, 565, 282, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 23145, 2159, 881, 367, 29871, 29896, 23157, 13, 9651, 2537, 29922, 4532, 29898, 29906, 29900, 29900, 29896, 416, 13, 9651, 1014, 5317, 29898, 29955, 29892, 29906, 29892, 29941, 29897, 13, 9651, 3711, 580, 13, 9651, 6492, 29898, 29886, 29961, 29900, 1822, 1272, 29889, 23749, 3285, 525, 489, 2288, 742, 10887, 29922, 29955, 29897, 13, 9651, 3611, 877, 4977, 29901, 302, 6092, 29918, 7915, 1495, 13, 9651, 6856, 29898, 5574, 29897, 13, 9651, 2537, 29889, 29873, 523, 29918, 2680, 580, 13, 9651, 2537, 29889, 15257, 29889, 4012, 580, 13, 9651, 1510, 580, 13, 632, 13, 4706, 396, 1678, 518, 29890, 29903, 29892, 1139, 29918, 2435, 29892, 29871, 29896, 29900, 29900, 29962, 334, 313, 518, 29890, 29903, 29892, 1139, 29918, 2435, 29892, 29871, 29896, 29962, 1599, 518, 29890, 29903, 29892, 1139, 29918, 2435, 29892, 29871, 29896, 29900, 29900, 2314, 13, 4706, 396, 539, 1599, 518, 29890, 29903, 29892, 1139, 29918, 2435, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29890, 29903, 29892, 29871, 29896, 29900, 29900, 29962, 13, 4706, 274, 29918, 29876, 353, 4842, 305, 29889, 16109, 29898, 26716, 29918, 12470, 29892, 282, 29889, 6948, 802, 29872, 911, 29898, 29906, 467, 18837, 29918, 294, 29898, 26716, 29918, 12470, 8106, 2083, 29898, 6229, 29922, 29896, 29897, 13, 4706, 269, 29918, 4977, 353, 1583, 29889, 4977, 29918, 449, 29898, 29883, 29918, 29876, 29897, 13, 4706, 269, 29918, 4977, 29918, 2695, 3317, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 29898, 29879, 29918, 4977, 29897, 13, 4706, 736, 269, 29918, 4977, 29892, 29879, 29918, 4977, 29918, 2695, 3317, 13, 13, 13, 1990, 6804, 4557, 23084, 919, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29922, 29941, 29900, 29900, 29892, 7934, 29918, 2311, 29922, 29896, 29900, 29900, 29892, 954, 29918, 13148, 29922, 29906, 29892, 5768, 449, 29922, 29900, 29889, 29941, 29892, 29871, 1125, 13, 4706, 2428, 29898, 11921, 4557, 23084, 919, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 1583, 29889, 29885, 29931, 29918, 29893, 353, 29871, 29946, 29871, 396, 4236, 988, 4195, 1353, 13, 13, 4706, 1583, 29889, 3977, 29918, 29882, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 3977, 29918, 29876, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 1131, 29918, 29882, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 29871, 29896, 29897, 13, 4706, 1583, 29889, 29956, 29918, 10892, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 954, 29918, 13148, 334, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 3729, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 954, 29918, 13148, 334, 7934, 29918, 2311, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 1131, 29918, 29876, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 29871, 29896, 29897, 13, 4706, 1583, 29889, 1233, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 15755, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 511, 13, 462, 462, 1678, 302, 29876, 29889, 29911, 27731, 3285, 13, 462, 462, 1678, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 1583, 29889, 29885, 29931, 29918, 29893, 718, 29871, 29896, 876, 29871, 396, 4236, 1353, 313, 29946, 718, 29871, 29896, 29897, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29896, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29906, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 10457, 29896, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 1233, 29922, 8824, 1125, 13, 4706, 396, 1174, 401, 13, 13, 4706, 18511, 29918, 6672, 353, 19750, 29918, 6672, 29898, 1311, 29889, 3977, 29918, 29882, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29897, 29871, 396, 518, 29890, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 3964, 29962, 13, 13, 4706, 289, 29903, 353, 7431, 29898, 29880, 29918, 6672, 29897, 13, 4706, 4236, 29918, 2435, 29918, 12470, 353, 4236, 29898, 2435, 29918, 12470, 29897, 13, 4706, 4236, 29918, 2435, 29918, 6672, 353, 4236, 29898, 29880, 29918, 6672, 29897, 13, 4706, 396, 286, 29931, 29918, 29882, 353, 4236, 29898, 2435, 29918, 6672, 29918, 6979, 29897, 13, 13, 4706, 396, 259, 313, 1311, 29899, 1131, 2509, 7897, 1897, 2812, 2580, 8497, 29973, 13, 4706, 396, 259, 518, 29933, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29933, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29962, 1599, 518, 29933, 29892, 4236, 29918, 2435, 29918, 6672, 29962, 13, 4706, 1098, 29918, 29882, 353, 1583, 29889, 29956, 29918, 1131, 29918, 29882, 29898, 26716, 29918, 6672, 467, 29879, 802, 29872, 911, 29898, 29906, 29897, 13, 13, 4706, 396, 259, 7363, 18745, 13, 4706, 363, 289, 29892, 301, 29918, 6672, 29896, 297, 26985, 29898, 29880, 29918, 6672, 1125, 13, 9651, 565, 301, 29918, 6672, 29896, 529, 4236, 29918, 2435, 29918, 6672, 29901, 13, 18884, 1098, 29918, 29882, 29961, 29890, 29892, 301, 29918, 6672, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 4706, 282, 29918, 29882, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 29898, 1131, 29918, 29882, 29897, 13, 13, 4706, 565, 1510, 29918, 29886, 29918, 1233, 29901, 13, 9651, 565, 282, 29918, 29882, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 23145, 2159, 881, 367, 29871, 29896, 23157, 13, 9651, 2537, 29922, 4532, 29898, 29906, 29900, 29900, 29896, 416, 13, 9651, 1014, 5317, 29898, 29955, 29892, 29906, 29892, 29945, 29897, 13, 9651, 3711, 580, 13, 9651, 6492, 29898, 29886, 29918, 29882, 29961, 29900, 1822, 1272, 29889, 23749, 3285, 525, 489, 2288, 742, 10887, 29922, 29955, 29897, 13, 9651, 3611, 877, 1233, 29901, 4839, 29918, 7915, 1495, 13, 9651, 6856, 29898, 5574, 29897, 13, 9651, 2537, 29889, 15257, 29889, 4012, 580, 13, 9651, 1510, 580, 13, 9651, 396, 1881, 877, 1542, 382, 5893, 304, 6773, 29889, 1495, 13, 13, 4706, 396, 259, 518, 29933, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29900, 29900, 29962, 334, 518, 350, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29962, 1599, 518, 29933, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29933, 29892, 29871, 29896, 29900, 29900, 29962, 13, 4706, 274, 29918, 6672, 353, 4842, 305, 29889, 16109, 29898, 26716, 29918, 6672, 29892, 282, 29918, 29882, 29889, 6948, 802, 29872, 911, 29898, 29906, 8106, 2083, 29898, 29896, 29897, 13, 13, 4706, 396, 259, 518, 29933, 29892, 29871, 29896, 29900, 29900, 29962, 6660, 518, 29933, 29892, 29871, 29906, 29930, 29896, 29900, 29900, 29962, 1174, 16961, 1363, 727, 526, 1023, 15359, 29889, 13, 4706, 7934, 353, 1583, 29889, 29956, 29918, 10892, 29898, 29883, 29918, 6672, 29897, 29871, 396, 518, 29933, 29892, 29871, 29946, 29892, 29871, 29906, 29900, 29900, 29914, 29906, 29962, 13, 4706, 7934, 353, 7934, 29889, 1493, 29898, 29890, 29903, 29892, 1583, 29889, 1949, 29918, 13148, 334, 29871, 29906, 29892, 938, 29898, 13, 9651, 1583, 29889, 10892, 29918, 2311, 847, 29871, 29906, 876, 29871, 396, 518, 29946, 29892, 350, 29892, 29871, 29896, 29900, 29900, 29914, 29906, 29962, 396, 1353, 29918, 974, 29918, 13148, 29918, 13148, 334, 313, 5365, 29899, 20845, 29897, 396, 24471, 29885, 1881, 15687, 29889, 13, 4706, 7934, 353, 7934, 29889, 3286, 4220, 29898, 29900, 29892, 29871, 29896, 467, 1285, 5526, 681, 580, 13, 13, 4706, 3038, 353, 1583, 29889, 29956, 29918, 3729, 29898, 29883, 29918, 6672, 29897, 29871, 396, 518, 29933, 29892, 29871, 29946, 29892, 29871, 29896, 29900, 29900, 29914, 29906, 29962, 13, 4706, 3038, 353, 3038, 29889, 1493, 29898, 29890, 29903, 29892, 1583, 29889, 1949, 29918, 13148, 334, 29871, 29906, 29892, 938, 29898, 1311, 29889, 10892, 29918, 2311, 847, 29871, 29906, 876, 29871, 396, 518, 29946, 29892, 350, 29892, 29871, 29896, 29900, 29900, 29914, 29906, 29962, 13, 4706, 3038, 353, 3038, 29889, 3286, 4220, 29898, 29900, 29892, 29871, 29896, 467, 1285, 5526, 681, 580, 13, 13, 4706, 281, 3977, 29918, 29876, 353, 19750, 29898, 1311, 29889, 3977, 29918, 29876, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 13, 462, 4706, 736, 29918, 10892, 29922, 8824, 29892, 13, 462, 4706, 298, 29883, 29900, 7607, 10892, 29892, 3038, 511, 13, 462, 4706, 1833, 29918, 6194, 29922, 8824, 29897, 29871, 396, 518, 29890, 29892, 302, 29892, 3964, 29962, 13, 13, 4706, 1098, 29918, 29876, 353, 1583, 29889, 29956, 29918, 1131, 29918, 29876, 29898, 29893, 3977, 29918, 29876, 467, 29879, 802, 29872, 911, 29898, 29906, 29897, 29871, 396, 518, 29933, 29892, 4236, 29918, 2435, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29933, 29892, 4236, 29918, 2435, 29892, 29871, 29896, 29962, 1599, 518, 29933, 29892, 4236, 29918, 2435, 29962, 13, 13, 4706, 396, 1678, 7363, 18745, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 4236, 29918, 2435, 29918, 12470, 29901, 13, 18884, 1098, 29918, 29876, 29961, 29890, 29892, 301, 29918, 29876, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 4706, 282, 29918, 29876, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 29898, 1131, 29918, 29876, 29897, 13, 13, 4706, 565, 1510, 29918, 29886, 29918, 1233, 29901, 13, 9651, 565, 282, 29918, 29876, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 23145, 2159, 881, 367, 29871, 29896, 23157, 13, 9651, 2537, 29922, 4532, 29898, 29906, 29900, 29900, 29896, 416, 13, 9651, 1014, 5317, 29898, 29955, 29892, 29906, 29892, 29953, 29897, 13, 9651, 3711, 580, 13, 9651, 6492, 29898, 29886, 29918, 29876, 29961, 29900, 1822, 1272, 29889, 23749, 3285, 525, 489, 2288, 742, 10887, 29922, 29955, 29897, 13, 9651, 3611, 877, 1233, 29901, 302, 6092, 29918, 7915, 1495, 13, 9651, 6856, 29898, 5574, 29897, 13, 9651, 2537, 29889, 15257, 29889, 4012, 580, 13, 13, 9651, 1510, 580, 13, 9651, 396, 1881, 877, 1542, 9041, 304, 6773, 29889, 1495, 13, 13, 4706, 396, 1678, 518, 29933, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29900, 29900, 29962, 334, 4197, 29933, 29892, 286, 29931, 29918, 29876, 29962, 1599, 518, 29933, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 1599, 518, 29933, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29900, 29900, 29962, 1723, 1599, 518, 29933, 29892, 29871, 29896, 29900, 29900, 29962, 13, 4706, 274, 29918, 29876, 353, 4842, 305, 29889, 16109, 29898, 29893, 3977, 29918, 29876, 29892, 282, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29906, 467, 18837, 29918, 294, 29898, 29893, 3977, 29918, 29876, 8106, 2083, 29898, 6229, 29922, 29896, 29897, 13, 4706, 269, 29918, 1233, 353, 1583, 29889, 1233, 29918, 449, 29898, 29883, 29918, 29876, 29897, 13, 4706, 269, 29918, 1233, 29918, 2695, 3317, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 29898, 29879, 29918, 1233, 29897, 13, 13, 4706, 736, 269, 29918, 1233, 29892, 29879, 29918, 1233, 29918, 2695, 3317, 13, 13, 29937, 988, 1897, 8500, 13, 1990, 6804, 4409, 23084, 919, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29922, 29941, 29900, 29900, 29892, 7934, 29918, 2311, 29922, 29896, 29900, 29900, 29892, 954, 29918, 13148, 29922, 29906, 29892, 5768, 449, 29922, 29900, 29889, 29941, 1125, 13, 4706, 2428, 29898, 11921, 4409, 23084, 919, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 1583, 29889, 3977, 29918, 29882, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 3977, 29918, 29876, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 1131, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 29883, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 6672, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 302, 29876, 29889, 29911, 27731, 3285, 302, 29876, 29889, 12697, 29898, 29906, 334, 7934, 29918, 2311, 29892, 29871, 29896, 29897, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29896, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29906, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 10457, 29896, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 13, 18884, 301, 29918, 6672, 29892, 1510, 29918, 29886, 29918, 29893, 29883, 29892, 27368, 29922, 5574, 1125, 13, 4706, 396, 1174, 401, 13, 4706, 18511, 29918, 12470, 353, 19750, 29898, 1311, 29889, 3977, 29918, 29876, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 13, 462, 4706, 736, 29918, 10892, 29922, 8824, 29892, 13, 462, 4706, 298, 29883, 29900, 29922, 8516, 29892, 13, 462, 4706, 1833, 29918, 6194, 29922, 8824, 29897, 29871, 396, 518, 29890, 29892, 302, 29892, 3964, 29962, 13, 13, 4706, 18511, 29918, 6672, 353, 19750, 29918, 6672, 29898, 1311, 29889, 3977, 29918, 29882, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29897, 29871, 396, 518, 29890, 29892, 4839, 29892, 3964, 29962, 13, 13, 4706, 396, 8570, 13, 4706, 396, 281, 3977, 353, 518, 29890, 29903, 29892, 286, 29931, 29892, 7934, 29918, 2311, 29962, 13, 4706, 396, 1098, 353, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 286, 29931, 29918, 29876, 29962, 13, 4706, 396, 1098, 29961, 29890, 29892, 474, 29918, 29882, 29892, 432, 29918, 29876, 29962, 353, 282, 29898, 29926, 29918, 29876, 29989, 474, 29918, 29882, 29897, 13, 4706, 1098, 353, 4842, 305, 29889, 29890, 4317, 29898, 26716, 29918, 6672, 29892, 1583, 29889, 29956, 29918, 1131, 29898, 26716, 29918, 12470, 467, 3286, 4220, 29898, 29896, 29892, 29871, 29906, 876, 13, 13, 4706, 396, 27368, 304, 9654, 760, 29889, 13, 4706, 286, 29931, 29918, 29876, 353, 4236, 29898, 2435, 29918, 12470, 29897, 13, 4706, 363, 289, 29918, 29876, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 286, 29931, 29918, 29876, 29901, 13, 18884, 1098, 29961, 29890, 29918, 29876, 29892, 584, 29892, 301, 29918, 29876, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 396, 1207, 282, 29898, 29926, 29918, 29876, 891, 474, 29918, 29882, 29897, 13, 4706, 282, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 29898, 1131, 29897, 13, 13, 4706, 565, 1510, 29918, 29886, 29918, 29893, 29883, 29901, 13, 9651, 396, 282, 353, 518, 29890, 29892, 4839, 29892, 302, 29962, 13, 9651, 565, 282, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 23145, 2159, 881, 367, 29871, 29896, 23157, 13, 9651, 2537, 29922, 4532, 29898, 29906, 29900, 29900, 29896, 416, 13, 9651, 396, 1014, 5317, 29898, 29953, 29892, 29906, 29892, 29955, 29897, 13, 9651, 1014, 5317, 29906, 7720, 3552, 29955, 29892, 29906, 511, 313, 29941, 29892, 29871, 29896, 511, 1948, 9653, 29922, 29906, 29897, 13, 9651, 3711, 580, 13, 9651, 903, 2780, 2433, 23973, 29895, 4912, 29915, 13, 9651, 903, 18098, 2433, 3045, 856, 29915, 13, 9651, 363, 474, 29918, 29882, 297, 3464, 29898, 29880, 29918, 6672, 29961, 29900, 29962, 1125, 13, 18884, 2927, 29918, 13140, 353, 474, 29918, 29882, 1273, 7431, 7373, 2780, 29897, 13, 18884, 6492, 29898, 29886, 29961, 29900, 3816, 29875, 29918, 29882, 3816, 29901, 1822, 1272, 29889, 23749, 580, 448, 474, 29918, 29882, 29892, 525, 489, 18717, 29918, 18098, 29961, 2780, 29918, 13140, 10062, 29918, 2780, 29961, 2780, 29918, 13140, 1402, 10887, 29922, 29955, 29897, 13, 13, 9651, 3611, 877, 29893, 29883, 29901, 282, 29918, 29876, 363, 1269, 298, 1495, 13, 9651, 6856, 29898, 5574, 29897, 13, 9651, 2537, 29889, 29873, 523, 29918, 2680, 580, 13, 9651, 2537, 29889, 15257, 29889, 4012, 580, 13, 9651, 1510, 580, 13, 4706, 396, 4236, 302, 6092, 3030, 12047, 13, 4706, 396, 518, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 286, 29931, 29918, 29876, 14178, 29961, 29890, 29903, 29892, 4236, 29918, 2435, 29918, 6672, 29892, 286, 29931, 29918, 29876, 29962, 13, 4706, 18511, 29918, 12470, 353, 18511, 29918, 12470, 29889, 6948, 802, 29872, 911, 29898, 29896, 29897, 29871, 396, 518, 289, 29892, 302, 29892, 3964, 29962, 1599, 518, 29890, 29892, 29871, 29896, 29892, 302, 29892, 3964, 29962, 13, 4706, 282, 353, 282, 29889, 6948, 802, 29872, 911, 29898, 29941, 29897, 29871, 396, 518, 29890, 29892, 4839, 29892, 302, 29962, 1599, 518, 29890, 29892, 4839, 29892, 302, 29892, 29871, 29896, 29962, 13, 4706, 274, 29918, 29876, 353, 4842, 305, 29889, 16109, 29898, 26716, 29918, 12470, 29892, 282, 467, 2083, 29898, 29906, 29897, 29871, 396, 1599, 518, 29890, 29892, 4839, 29892, 3964, 1402, 274, 29918, 29876, 363, 1269, 4839, 29889, 13, 13, 4706, 343, 353, 4842, 305, 29889, 4117, 4197, 1311, 29889, 29956, 29918, 29883, 29898, 29883, 29918, 29876, 511, 1583, 29889, 29956, 29918, 6672, 29898, 26716, 29918, 6672, 29897, 1402, 3964, 29922, 29906, 29897, 29871, 396, 518, 29890, 29892, 4839, 29892, 29871, 29906, 29930, 6229, 29962, 13, 4706, 8158, 353, 1583, 29889, 29956, 29918, 449, 29898, 29891, 467, 29879, 802, 29872, 911, 29898, 29906, 29897, 29871, 396, 518, 29890, 29892, 4839, 29962, 13, 13, 4706, 8158, 29961, 7345, 305, 29889, 275, 13707, 29898, 13628, 4638, 353, 29871, 29900, 13, 4706, 8158, 29918, 2695, 3317, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 29898, 13628, 29897, 13, 4706, 565, 27368, 29901, 13, 9651, 363, 289, 29892, 301, 29918, 6672, 29896, 297, 26985, 29898, 29880, 29918, 6672, 1125, 13, 18884, 8158, 29961, 29890, 29892, 301, 29918, 6672, 29896, 17531, 353, 448, 29896, 29872, 29974, 29896, 29900, 13, 13, 9651, 363, 289, 29892, 301, 29918, 6672, 29896, 297, 26985, 29898, 29880, 29918, 6672, 1125, 13, 18884, 8158, 29918, 2695, 3317, 29961, 29890, 29892, 301, 29918, 6672, 29896, 17531, 353, 29871, 29900, 13, 4706, 736, 8158, 29892, 13628, 29918, 2695, 3317, 13, 13, 29937, 988, 1015, 8500, 13, 1990, 6804, 11746, 23084, 919, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29922, 29941, 29900, 29900, 29892, 7934, 29918, 2311, 29922, 29896, 29900, 29900, 29892, 954, 29918, 13148, 29922, 29906, 29892, 5768, 449, 29922, 29900, 29889, 29941, 29892, 302, 29918, 1116, 29918, 3554, 29922, 29941, 1125, 13, 4706, 2428, 29898, 11921, 11746, 23084, 919, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 1583, 29889, 29885, 29931, 29918, 29893, 353, 29871, 29946, 396, 4236, 988, 4195, 1353, 13, 13, 4706, 1583, 29889, 3977, 29918, 29882, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 3977, 29918, 29876, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 1131, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 29883, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 6672, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 827, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 302, 29876, 29889, 12697, 29898, 29906, 29930, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 511, 13, 9651, 302, 29876, 29889, 29911, 27731, 3285, 13, 9651, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 302, 29918, 1116, 29918, 3554, 29897, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29896, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29906, 29897, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 10457, 29896, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 13, 18884, 301, 29918, 6672, 29892, 281, 29876, 29892, 28678, 29892, 281, 3977, 29918, 29876, 29922, 8516, 29892, 1510, 29918, 29886, 29918, 827, 29922, 8824, 1125, 13, 4706, 396, 1174, 401, 13, 4706, 565, 451, 281, 3977, 29918, 29876, 29901, 13, 9651, 281, 3977, 29918, 29876, 353, 19750, 29898, 1311, 29889, 3977, 29918, 29876, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 13, 462, 9651, 736, 29918, 10892, 29922, 8824, 29892, 13, 462, 9651, 298, 29883, 29900, 29922, 8516, 29892, 13, 462, 9651, 1833, 29918, 6194, 29922, 8824, 29897, 29871, 396, 518, 29890, 29892, 302, 29892, 3964, 29962, 13, 13, 4706, 18511, 29918, 6672, 353, 19750, 29918, 6672, 29898, 1311, 29889, 3977, 29918, 29882, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29897, 29871, 396, 518, 29890, 29892, 4839, 29892, 3964, 29962, 13, 13, 4706, 289, 29903, 353, 7431, 29898, 29880, 29918, 6672, 29897, 13, 4706, 396, 281, 29876, 13, 13, 13, 4706, 281, 3977, 29918, 6672, 29918, 711, 353, 5159, 396, 8900, 4839, 13, 4706, 363, 289, 297, 3464, 29898, 29890, 29903, 1125, 13, 9651, 396, 5519, 856, 1402, 518, 856, 5262, 13, 9651, 396, 18011, 1051, 304, 7472, 1353, 310, 409, 5942, 13, 9651, 1855, 353, 518, 26716, 29918, 6672, 29961, 29890, 29892, 784, 29962, 363, 784, 297, 28678, 29961, 29890, 5262, 13, 9651, 17132, 353, 313, 1311, 29889, 29885, 29931, 29918, 29893, 448, 281, 29876, 29961, 29890, 2314, 334, 518, 26716, 29918, 6672, 29961, 29890, 29892, 29871, 29900, 5262, 396, 445, 7164, 1033, 367, 2743, 29889, 4321, 411, 5225, 7164, 2678, 29889, 13, 9651, 281, 3977, 29918, 6672, 29918, 711, 29896, 353, 4842, 305, 29889, 1429, 29898, 6370, 718, 17132, 29897, 396, 739, 338, 451, 1304, 297, 278, 6410, 740, 29889, 13, 9651, 281, 3977, 29918, 6672, 29918, 711, 29889, 4397, 29898, 29893, 3977, 29918, 6672, 29918, 711, 29896, 29897, 13, 13, 4706, 396, 1051, 304, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29962, 12489, 29889, 13, 4706, 281, 3977, 29918, 6672, 29918, 711, 353, 4842, 305, 29889, 1429, 29898, 29893, 3977, 29918, 6672, 29918, 711, 29897, 396, 1051, 304, 12489, 29889, 13, 4706, 281, 3977, 29918, 6672, 29918, 711, 353, 281, 3977, 29918, 6672, 29918, 711, 29889, 517, 29898, 10141, 29897, 13, 13, 4706, 396, 518, 29933, 29892, 29871, 29896, 29892, 286, 29931, 29918, 29876, 29892, 3964, 29962, 334, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29892, 29871, 29896, 29962, 13, 4706, 396, 29871, 1599, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 1599, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29962, 13, 4706, 396, 21666, 16435, 9404, 405, 29931, 29939, 29899, 517, 12360, 322, 29871, 4629, 1897, 13, 4706, 1098, 353, 4842, 305, 29889, 2922, 16109, 29898, 1311, 29889, 29956, 29918, 1131, 29898, 29893, 3977, 29918, 29876, 467, 6948, 802, 29872, 911, 29898, 29896, 511, 13, 462, 795, 281, 3977, 29918, 6672, 29918, 711, 29889, 6948, 802, 29872, 911, 29898, 29941, 29897, 13, 462, 795, 13742, 29879, 802, 29872, 911, 29898, 29941, 29897, 13, 13, 4706, 396, 7363, 18745, 363, 9654, 760, 29889, 13, 4706, 286, 29931, 29918, 29876, 353, 4236, 29898, 2435, 29918, 12470, 29897, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 286, 29931, 29918, 29876, 29901, 13, 18884, 1098, 29961, 29890, 29892, 584, 29892, 301, 29918, 29876, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 282, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 29898, 1131, 29897, 29871, 396, 282, 29898, 302, 29989, 4629, 29918, 1054, 1723, 13, 4706, 565, 1510, 29918, 29886, 29918, 827, 29901, 13, 9651, 396, 282, 353, 518, 29890, 29892, 4839, 29892, 302, 29962, 13, 9651, 565, 282, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 23145, 2159, 881, 367, 29871, 29896, 23157, 13, 9651, 2537, 29922, 4532, 29898, 29906, 29900, 29900, 29896, 29897, 13, 9651, 396, 1014, 5317, 29898, 29953, 29892, 29906, 29892, 29955, 29897, 13, 9651, 1014, 5317, 29906, 7720, 3552, 29955, 29892, 29906, 511, 313, 29945, 29892, 29871, 29900, 511, 1948, 9653, 29922, 29906, 29897, 13, 9651, 3711, 580, 13, 9651, 903, 2780, 2433, 23973, 29895, 4912, 29915, 13, 9651, 903, 18098, 2433, 3045, 856, 29915, 13, 9651, 363, 474, 29918, 1233, 297, 3464, 29898, 1311, 29889, 29885, 29931, 29918, 29893, 1125, 13, 18884, 2927, 29918, 13140, 353, 474, 29918, 1233, 1273, 7431, 7373, 2780, 29897, 13, 18884, 6492, 29898, 29886, 29961, 29900, 3816, 29875, 29918, 1233, 3816, 29901, 1822, 1272, 29889, 23749, 580, 448, 474, 29918, 1233, 29892, 525, 489, 18717, 29918, 18098, 29961, 2780, 29918, 13140, 10062, 29918, 2780, 29961, 2780, 29918, 13140, 1402, 10887, 29922, 29955, 29897, 13, 13, 9651, 3611, 877, 827, 29901, 282, 29918, 29876, 363, 4629, 298, 1495, 13, 9651, 6856, 29898, 5574, 29897, 13, 9651, 2537, 29889, 29873, 523, 29918, 2680, 580, 13, 9651, 2537, 29889, 15257, 29889, 4012, 580, 13, 9651, 1510, 580, 13, 13, 4706, 396, 518, 29933, 29892, 29871, 29896, 29892, 286, 29931, 29918, 29876, 29892, 3964, 29962, 334, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 13, 4706, 396, 29871, 6660, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29892, 3964, 29962, 13, 4706, 396, 29871, 6660, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29962, 13, 4706, 274, 29918, 29876, 353, 4842, 305, 29889, 16109, 29898, 29893, 3977, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29896, 511, 282, 29889, 6948, 802, 29872, 911, 29898, 29941, 8106, 2083, 29898, 6229, 29922, 29906, 29897, 13, 13, 4706, 396, 518, 29890, 29903, 29892, 29871, 29945, 29899, 29896, 29892, 3964, 29962, 1599, 518, 29890, 29903, 29892, 29871, 29945, 29899, 29896, 29892, 29871, 29941, 29962, 13, 13, 4706, 9649, 353, 4842, 305, 29889, 4117, 4197, 1311, 29889, 29956, 29918, 29883, 29898, 29883, 29918, 29876, 511, 1583, 29889, 29956, 29918, 6672, 29898, 29893, 3977, 29918, 6672, 29918, 711, 29897, 1402, 3964, 29922, 29906, 29897, 13, 4706, 269, 29918, 827, 353, 1583, 29889, 827, 29918, 449, 29898, 2003, 29897, 13, 13, 4706, 269, 29918, 827, 29918, 2695, 3317, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 29898, 29879, 29918, 827, 29897, 13, 13, 4706, 736, 269, 29918, 827, 29892, 29879, 29918, 827, 29918, 2695, 3317, 13, 13, 1990, 6804, 1917, 23084, 919, 29918, 2962, 355, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 13, 1678, 8565, 20386, 1230, 1904, 13, 1678, 3617, 1369, 322, 1095, 29889, 13, 1678, 2266, 29892, 770, 3709, 363, 518, 518, 240, 139, 175, 30970, 1402, 518, 240, 143, 131, 29896, 1402, 518, 240, 143, 131, 29906, 1402, 518, 31285, 31136, 1402, 2023, 29962, 13, 1678, 10567, 29901, 418, 11346, 6797, 302, 6092, 669, 4629, 1897, 29889, 13, 1678, 29068, 29901, 11346, 6797, 302, 6092, 669, 4629, 1897, 29889, 1599, 770, 3709, 1599, 11105, 19435, 1599, 2023, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29922, 29941, 29900, 29900, 29892, 7934, 29918, 2311, 29922, 29896, 29900, 29900, 29892, 954, 29918, 13148, 29922, 29906, 29892, 5768, 449, 29922, 29900, 29889, 29941, 29892, 302, 29918, 1116, 29918, 3554, 29922, 29946, 29892, 2030, 29922, 8824, 1125, 13, 4706, 2428, 29898, 11921, 1917, 23084, 919, 29918, 2962, 355, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 4706, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 353, 302, 29918, 1116, 29918, 3554, 13, 13, 4706, 1583, 29889, 29885, 29931, 29918, 29893, 353, 29871, 29946, 29871, 396, 4236, 988, 4195, 1353, 13, 13, 4706, 1583, 29889, 3977, 29918, 29882, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 3977, 29918, 29876, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 1131, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 29883, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 6672, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 459, 353, 302, 29876, 29889, 12697, 29898, 29876, 29918, 1116, 29918, 3554, 29892, 7934, 29918, 2311, 29897, 13, 13, 4706, 396, 1583, 29889, 29956, 29918, 29876, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 565, 2030, 29901, 13, 9651, 1583, 29889, 29893, 29894, 29918, 449, 353, 29871, 302, 29876, 29889, 16941, 2556, 29898, 13, 9651, 302, 29876, 29889, 12697, 29898, 29946, 334, 7934, 29918, 2311, 29892, 29871, 29906, 29897, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 29893, 29894, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 18884, 302, 29876, 29889, 12697, 29898, 29946, 334, 7934, 29918, 2311, 29892, 7934, 29918, 2311, 511, 13, 18884, 302, 29876, 29889, 29911, 27731, 3285, 13, 18884, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 29871, 29906, 29897, 13, 9651, 1723, 13, 4706, 396, 1583, 29889, 29893, 29894, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 396, 268, 302, 29876, 29889, 12697, 29898, 29941, 334, 7934, 29918, 2311, 29892, 7934, 29918, 2311, 511, 13, 4706, 396, 268, 302, 29876, 29889, 29911, 27731, 3285, 13, 4706, 396, 268, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 1583, 29889, 29887, 8181, 29931, 29897, 13, 4706, 396, 1723, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29896, 29897, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 29922, 29906, 29897, 13, 13, 4706, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 353, 302, 29876, 29889, 6295, 615, 3317, 29898, 6229, 10457, 29896, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29892, 281, 29876, 29892, 28678, 29892, 8879, 29892, 281, 3977, 29918, 29876, 29922, 8516, 29892, 1510, 29918, 29886, 29918, 29893, 29894, 29922, 8824, 1125, 13, 13, 4706, 396, 1174, 401, 13, 4706, 565, 451, 281, 3977, 29918, 29876, 29901, 13, 9651, 281, 3977, 29918, 29876, 29892, 298, 449, 29892, 11196, 353, 19750, 29898, 1311, 29889, 3977, 29918, 29876, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 13, 462, 9651, 736, 29918, 10892, 29922, 5574, 29892, 13, 462, 9651, 298, 29883, 29900, 29922, 8516, 29892, 13, 462, 9651, 1833, 29918, 6194, 29922, 8824, 29897, 29871, 396, 518, 29890, 29892, 302, 29892, 3964, 29962, 13, 13, 4706, 18511, 29918, 6672, 353, 19750, 29918, 6672, 29898, 1311, 29889, 3977, 29918, 29882, 29892, 7232, 29918, 6672, 29892, 7431, 29918, 6672, 29918, 6979, 29892, 301, 29918, 6672, 29897, 29871, 396, 518, 29890, 29892, 4839, 29892, 3964, 29962, 13, 13, 4706, 289, 29903, 353, 7431, 29898, 29880, 29918, 6672, 29897, 13, 13, 4706, 281, 3977, 29918, 6672, 29918, 711, 353, 5159, 29871, 396, 8900, 4839, 13, 13, 4706, 363, 289, 297, 3464, 29898, 29890, 29903, 1125, 13, 9651, 396, 5519, 856, 1402, 518, 856, 5262, 13, 9651, 396, 18011, 1051, 304, 7472, 1353, 310, 409, 5942, 13, 9651, 1855, 353, 518, 26716, 29918, 6672, 29961, 29890, 29892, 784, 29962, 363, 784, 297, 28678, 29961, 29890, 5262, 13, 9651, 17132, 353, 313, 1311, 29889, 29885, 29931, 29918, 29893, 448, 281, 29876, 29961, 29890, 2314, 334, 518, 26716, 29918, 6672, 29961, 29890, 29892, 29871, 29900, 5262, 29871, 396, 445, 7164, 1033, 367, 2743, 29889, 4321, 411, 5225, 7164, 2678, 29889, 13, 9651, 281, 3977, 29918, 6672, 29918, 711, 29896, 353, 4842, 305, 29889, 1429, 29898, 6370, 718, 17132, 29897, 29871, 396, 739, 338, 451, 1304, 297, 278, 6410, 740, 29889, 13, 9651, 281, 3977, 29918, 6672, 29918, 711, 29889, 4397, 29898, 29893, 3977, 29918, 6672, 29918, 711, 29896, 29897, 13, 13, 4706, 396, 1051, 304, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29962, 12489, 29889, 13, 4706, 281, 3977, 29918, 6672, 29918, 711, 353, 4842, 305, 29889, 1429, 29898, 29893, 3977, 29918, 6672, 29918, 711, 29897, 29871, 396, 1051, 304, 12489, 29889, 13, 4706, 281, 3977, 29918, 6672, 29918, 711, 353, 281, 3977, 29918, 6672, 29918, 711, 29889, 517, 29898, 10141, 29897, 13, 13, 13, 4706, 396, 12481, 8570, 13, 4706, 396, 518, 29933, 29892, 29871, 29896, 29892, 286, 29931, 29918, 29876, 29892, 3964, 29962, 334, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29892, 29871, 29896, 29962, 13, 4706, 396, 29871, 1599, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 1599, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29962, 13, 4706, 396, 21666, 16435, 9404, 405, 29931, 29939, 29899, 517, 12360, 322, 29871, 4629, 1897, 13, 4706, 1098, 353, 4842, 305, 29889, 2922, 16109, 29898, 1311, 29889, 29956, 29918, 1131, 29898, 29893, 3977, 29918, 29876, 467, 6948, 802, 29872, 911, 29898, 29896, 511, 13, 462, 965, 281, 3977, 29918, 6672, 29918, 711, 29889, 6948, 802, 29872, 911, 29898, 29941, 29897, 13, 462, 965, 13742, 29879, 802, 29872, 911, 29898, 29941, 29897, 13, 4706, 396, 7363, 18745, 363, 9654, 760, 29889, 13, 4706, 286, 29931, 29918, 29876, 353, 4236, 29898, 2435, 29918, 12470, 29897, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 286, 29931, 29918, 29876, 29901, 13, 18884, 1098, 29961, 29890, 29892, 584, 29892, 301, 29918, 29876, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 282, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29906, 29898, 1131, 29897, 29871, 396, 282, 29898, 302, 29989, 4629, 29918, 1054, 1723, 13, 13, 4706, 565, 1510, 29918, 29886, 29918, 29893, 29894, 29901, 13, 9651, 396, 282, 353, 518, 29890, 29892, 4839, 29892, 302, 29962, 13, 9651, 565, 282, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 23145, 2159, 881, 367, 29871, 29896, 23157, 13, 9651, 2537, 29922, 4532, 29898, 29906, 29900, 29900, 29896, 29897, 13, 9651, 396, 1014, 5317, 29898, 29953, 29892, 29906, 29892, 29955, 29897, 13, 9651, 1014, 5317, 29906, 7720, 3552, 29955, 29892, 29906, 511, 313, 29945, 29892, 29871, 29896, 511, 1948, 9653, 29922, 29906, 29897, 13, 9651, 3711, 580, 13, 9651, 903, 2780, 2433, 23973, 29895, 4912, 29915, 13, 9651, 903, 18098, 2433, 3045, 856, 29915, 13, 9651, 363, 474, 29918, 1233, 297, 3464, 29898, 1311, 29889, 29885, 29931, 29918, 29893, 1125, 13, 18884, 2927, 29918, 13140, 353, 474, 29918, 1233, 1273, 7431, 7373, 2780, 29897, 13, 18884, 6492, 29898, 29886, 29961, 29900, 3816, 29875, 29918, 1233, 3816, 29901, 1822, 1272, 29889, 23749, 580, 448, 474, 29918, 1233, 29892, 525, 489, 18717, 29918, 18098, 29961, 2780, 29918, 13140, 10062, 29918, 2780, 29961, 2780, 29918, 13140, 1402, 10887, 29922, 29955, 29897, 13, 13, 9651, 3611, 877, 29893, 29894, 29901, 282, 29918, 29876, 363, 4629, 298, 1495, 13, 9651, 6856, 29898, 5574, 29897, 13, 9651, 2537, 29889, 29873, 523, 29918, 2680, 580, 13, 9651, 2537, 29889, 15257, 29889, 4012, 580, 13, 9651, 1510, 580, 13, 13, 13, 4706, 396, 518, 29933, 29892, 29871, 29896, 29892, 286, 29931, 29918, 29876, 29892, 3964, 29962, 334, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 13, 4706, 396, 29871, 6660, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29892, 3964, 29962, 13, 4706, 396, 29871, 6660, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29962, 13, 4706, 274, 29918, 29876, 353, 4842, 305, 29889, 16109, 29898, 29893, 3977, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29896, 511, 282, 29889, 6948, 802, 29872, 911, 29898, 29941, 8106, 2083, 29898, 6229, 29922, 29906, 29897, 13, 13, 4706, 396, 7605, 8900, 9066, 871, 29889, 13, 4706, 396, 3115, 5706, 697, 29918, 8711, 4608, 8025, 5235, 310, 278, 5455, 13, 4706, 396, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29962, 13, 4706, 281, 3977, 29918, 459, 353, 5159, 13, 4706, 363, 289, 297, 3464, 29898, 29890, 29903, 1125, 13, 9651, 396, 5519, 856, 1402, 518, 856, 5262, 13, 9651, 396, 18011, 1051, 304, 7472, 1353, 310, 409, 5942, 13, 9651, 281, 3977, 29918, 459, 29896, 353, 4842, 305, 29889, 3298, 359, 29898, 1311, 29889, 29885, 29931, 29918, 29893, 29892, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 29897, 13, 9651, 8879, 29896, 353, 8879, 29961, 29890, 29962, 13, 9651, 22645, 29918, 1557, 2620, 353, 5159, 13, 9651, 301, 29918, 827, 29896, 353, 7431, 29898, 827, 29896, 29897, 13, 9651, 363, 474, 29918, 827, 29896, 29896, 297, 3464, 29898, 1311, 29889, 29885, 29931, 29918, 29893, 1125, 13, 18884, 565, 474, 29918, 827, 29896, 29896, 529, 301, 29918, 827, 29896, 29901, 13, 462, 1678, 8879, 29896, 29896, 353, 8879, 29896, 29961, 29875, 29918, 827, 29896, 29896, 29962, 13, 462, 1678, 22645, 29918, 1557, 2620, 29889, 4397, 4197, 524, 29898, 827, 29896, 29896, 29897, 2314, 13, 18884, 1683, 29901, 13, 462, 1678, 22645, 29918, 1557, 2620, 29889, 4397, 4197, 29900, 2314, 396, 451, 1304, 8763, 13, 13, 9651, 281, 3977, 29918, 459, 29896, 353, 281, 3977, 29918, 459, 29896, 29889, 1557, 2620, 29898, 29896, 29892, 4842, 305, 29889, 20158, 29898, 13140, 29918, 1557, 2620, 511, 29871, 29896, 29897, 13, 13, 9651, 281, 3977, 29918, 459, 29889, 4397, 29898, 29893, 3977, 29918, 459, 29896, 29897, 13, 13, 4706, 396, 1051, 304, 518, 29933, 29892, 29871, 29946, 29892, 3964, 29962, 12489, 29889, 13, 4706, 281, 3977, 29918, 459, 353, 4842, 305, 29889, 1429, 29898, 29893, 3977, 29918, 459, 29897, 29871, 396, 1051, 304, 12489, 29889, 13, 4706, 281, 3977, 29918, 459, 353, 281, 3977, 29918, 459, 29889, 517, 29898, 10141, 29897, 13, 13, 4706, 396, 2567, 1156, 3022, 271, 29892, 8147, 1480, 1169, 363, 1269, 5993, 13, 4706, 396, 518, 29890, 29903, 29892, 29871, 29945, 29899, 29896, 29892, 29871, 29941, 29930, 10892, 29918, 2311, 29962, 353, 518, 29890, 29903, 29892, 29871, 29946, 29892, 29871, 29941, 29900, 29900, 29962, 13, 4706, 9649, 353, 4842, 305, 29889, 4117, 4197, 1311, 29889, 29956, 29918, 29883, 29898, 29883, 29918, 29876, 511, 1583, 29889, 29956, 29918, 6672, 29898, 29893, 3977, 29918, 6672, 29918, 711, 511, 1583, 29889, 29956, 29918, 459, 29898, 29893, 3977, 29918, 459, 29897, 1402, 3964, 29922, 29906, 29897, 13, 13, 4706, 396, 8561, 10410, 4608, 2729, 373, 18511, 302, 29880, 5993, 6943, 1897, 322, 5455, 2472, 29889, 13, 4706, 396, 281, 3977, 29918, 29876, 353, 518, 29890, 29903, 29892, 286, 29931, 29892, 29871, 29896, 29900, 29900, 29962, 13, 4706, 396, 9649, 29906, 353, 518, 29890, 29903, 29892, 29871, 29946, 29892, 286, 29931, 29892, 29871, 29946, 29900, 29900, 29962, 13, 4706, 9649, 29896, 29872, 353, 9649, 29889, 6948, 802, 29872, 911, 29898, 29906, 467, 18837, 6278, 29896, 6653, 29896, 29892, 286, 29931, 29918, 29876, 29892, 448, 29896, 29897, 396, 518, 29890, 29903, 29892, 29871, 29946, 29892, 29871, 29896, 29892, 29871, 29941, 29900, 29900, 29962, 29871, 1599, 518, 29890, 29903, 29892, 29871, 29946, 29892, 286, 29931, 29892, 29871, 29941, 29900, 29900, 29962, 13, 4706, 281, 3977, 29918, 484, 353, 281, 3977, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29896, 467, 18837, 6278, 29896, 29892, 29871, 29946, 29892, 448, 29896, 29892, 448, 29896, 29897, 396, 518, 29890, 29903, 29892, 29871, 29896, 29892, 286, 29931, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29890, 29903, 29892, 29871, 29946, 29892, 286, 29931, 29892, 29871, 29896, 29900, 29900, 29962, 13, 4706, 9649, 29906, 353, 4842, 305, 29889, 4117, 29898, 518, 2003, 29896, 29872, 29892, 281, 3977, 29918, 484, 1402, 3964, 29922, 29941, 29897, 13, 13, 4706, 396, 1286, 1207, 1480, 1169, 13, 4706, 269, 29918, 29893, 29894, 353, 1583, 29889, 29893, 29894, 29918, 449, 29898, 2003, 29906, 29897, 396, 518, 29890, 29903, 29892, 29871, 29946, 29892, 286, 29931, 29892, 29871, 29946, 29900, 29900, 29962, 1599, 518, 29890, 29903, 29892, 29871, 29946, 29892, 286, 29931, 29892, 29871, 29906, 29962, 13, 13, 4706, 269, 29918, 29893, 29894, 29918, 2695, 3317, 353, 1583, 29889, 2695, 3317, 29918, 6229, 29918, 29896, 29898, 29879, 29918, 29893, 29894, 29897, 13, 13, 4706, 396, 27368, 363, 805, 332, 2738, 18897, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 286, 29931, 29918, 29876, 29901, 13, 18884, 269, 29918, 29893, 29894, 29961, 29890, 29892, 584, 29892, 301, 29918, 29876, 29896, 29901, 29892, 584, 29962, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 286, 29931, 29918, 29876, 29901, 13, 18884, 269, 29918, 29893, 29894, 29918, 2695, 3317, 29961, 29890, 29892, 584, 29892, 301, 29918, 29876, 29896, 29901, 29892, 584, 29962, 353, 29871, 29900, 13, 13, 4706, 736, 269, 29918, 29893, 29894, 29892, 29879, 29918, 29893, 29894, 29918, 2695, 3317, 13, 13, 1753, 365, 2209, 29918, 2622, 3062, 29918, 2962, 355, 29918, 29894, 29906, 29898, 13628, 29918, 2622, 29918, 4914, 29892, 269, 29918, 4977, 29892, 269, 29918, 1233, 29892, 269, 29918, 29893, 29883, 29892, 269, 29918, 827, 29892, 13, 1669, 269, 29918, 29893, 29894, 29892, 5962, 29918, 509, 2806, 29918, 2622, 29918, 4914, 29892, 330, 29918, 4977, 29892, 330, 29918, 1233, 29892, 330, 29918, 29893, 29883, 29892, 330, 29918, 827, 29892, 330, 29918, 29893, 1403, 1125, 13, 1678, 9995, 13, 13, 1678, 584, 3207, 269, 29918, 29893, 29894, 29901, 8158, 29871, 518, 350, 29892, 302, 29918, 1116, 29879, 29892, 323, 29892, 8158, 29962, 13, 1678, 584, 3207, 330, 29918, 1233, 29901, 518, 350, 4514, 13, 1678, 584, 3207, 330, 29918, 29893, 1403, 29901, 518, 29933, 29892, 2148, 29879, 29892, 282, 593, 1402, 321, 29889, 29887, 29889, 5519, 29961, 29900, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29892, 29871, 29896, 29945, 1402, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29896, 29945, 20526, 5519, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29896, 29953, 1402, 518, 29900, 29892, 29871, 29955, 29892, 29871, 29947, 29892, 29871, 29929, 29892, 29871, 29896, 29953, 5262, 29962, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 6410, 353, 29871, 29900, 13, 1678, 396, 6410, 4619, 365, 2209, 29918, 1557, 29898, 13628, 29918, 2622, 29918, 4914, 29892, 5962, 29918, 509, 2806, 29918, 2622, 29918, 4914, 29897, 13, 1678, 396, 6410, 4619, 365, 2209, 29918, 4977, 29898, 29879, 29918, 4977, 29892, 330, 29918, 4977, 29897, 13, 1678, 396, 6410, 4619, 365, 2209, 29918, 1233, 29898, 29879, 29918, 1233, 29892, 330, 29918, 1233, 29897, 13, 1678, 396, 6410, 4619, 365, 2209, 29918, 29893, 29883, 29898, 29879, 29918, 29893, 29883, 29892, 330, 29918, 29893, 29883, 29897, 13, 1678, 396, 6410, 4619, 365, 2209, 29918, 827, 29898, 29879, 29918, 827, 29892, 330, 29918, 1233, 29892, 330, 29918, 827, 29897, 13, 1678, 396, 6410, 4619, 365, 2209, 29918, 29893, 29894, 29918, 344, 29898, 29879, 29918, 29893, 29894, 29892, 330, 29918, 1233, 29892, 330, 29918, 29893, 1403, 29897, 13, 13, 1678, 736, 6410, 13, 13, 1753, 365, 2209, 29918, 2774, 29918, 344, 29898, 13628, 29918, 2622, 29918, 4914, 29892, 269, 29918, 4977, 29892, 269, 29918, 1233, 29892, 269, 29918, 29893, 29883, 29892, 269, 29918, 827, 29892, 13, 1669, 269, 29918, 29893, 29894, 29892, 5962, 29918, 509, 2806, 29918, 2622, 29918, 4914, 29892, 330, 29918, 4977, 29892, 330, 29918, 1233, 29892, 330, 29918, 29893, 29883, 29892, 330, 29918, 827, 29892, 330, 29918, 29893, 1403, 1125, 13, 1678, 9995, 13, 13, 1678, 584, 3207, 269, 29918, 29893, 29894, 29901, 8158, 29871, 518, 350, 29892, 302, 29918, 1116, 29879, 29892, 323, 29892, 8158, 29962, 13, 1678, 584, 3207, 330, 29918, 1233, 29901, 518, 350, 4514, 13, 1678, 584, 3207, 330, 29918, 29893, 1403, 29901, 518, 29933, 29892, 2148, 29879, 29892, 282, 593, 1402, 321, 29889, 29887, 29889, 5519, 29961, 29900, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29892, 29871, 29896, 29945, 1402, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29896, 29945, 20526, 5519, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29896, 29953, 1402, 518, 29900, 29892, 29871, 29955, 29892, 29871, 29947, 29892, 29871, 29929, 29892, 29871, 29896, 29953, 5262, 29962, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 6410, 353, 29871, 29900, 13, 1678, 6410, 4619, 365, 2209, 29918, 1557, 29898, 13628, 29918, 2622, 29918, 4914, 29892, 5962, 29918, 509, 2806, 29918, 2622, 29918, 4914, 29897, 13, 1678, 6410, 4619, 365, 2209, 29918, 4977, 29898, 29879, 29918, 4977, 29892, 330, 29918, 4977, 29897, 13, 1678, 6410, 4619, 365, 2209, 29918, 1233, 29898, 29879, 29918, 1233, 29892, 330, 29918, 1233, 29897, 13, 1678, 6410, 4619, 365, 2209, 29918, 29893, 29883, 29898, 29879, 29918, 29893, 29883, 29892, 330, 29918, 29893, 29883, 29897, 13, 1678, 6410, 4619, 365, 2209, 29918, 827, 29898, 29879, 29918, 827, 29892, 330, 29918, 1233, 29892, 330, 29918, 827, 29897, 13, 1678, 6410, 4619, 365, 2209, 29918, 29893, 29894, 29918, 344, 29898, 29879, 29918, 29893, 29894, 29892, 330, 29918, 1233, 29892, 330, 29918, 29893, 1403, 29897, 13, 13, 1678, 736, 6410, 13, 13, 1753, 365, 2209, 29918, 1557, 29898, 29879, 29918, 1557, 29892, 330, 29918, 1557, 1125, 13, 1678, 6410, 353, 383, 29889, 19128, 29918, 296, 14441, 29898, 29879, 29918, 1557, 29892, 4842, 305, 29889, 20158, 29898, 29887, 29918, 1557, 467, 517, 29898, 10141, 876, 13, 1678, 736, 6410, 13, 13, 13, 1753, 365, 2209, 29918, 4977, 29898, 29879, 29918, 4977, 29892, 330, 29918, 4977, 1125, 13, 1678, 6410, 353, 383, 29889, 19128, 29918, 296, 14441, 29898, 29879, 29918, 4977, 29892, 4842, 305, 29889, 20158, 29898, 29887, 29918, 4977, 467, 517, 29898, 10141, 876, 13, 1678, 736, 6410, 13, 13, 1753, 365, 2209, 29918, 1233, 29898, 29879, 29918, 1233, 29892, 330, 29918, 1233, 1125, 13, 1678, 6410, 353, 383, 29889, 19128, 29918, 296, 14441, 29898, 29879, 29918, 1233, 29892, 4842, 305, 29889, 20158, 29898, 29887, 29918, 1233, 467, 517, 29898, 10141, 876, 13, 13, 1678, 736, 6410, 13, 13, 1753, 365, 2209, 29918, 29893, 29883, 29898, 29879, 29918, 29893, 29883, 29892, 330, 29918, 29893, 29883, 1125, 13, 13, 1678, 396, 1281, 4984, 2380, 4636, 13, 1678, 289, 29903, 29892, 4236, 29918, 29882, 29918, 2435, 353, 269, 29918, 29893, 29883, 29889, 12181, 13, 1678, 527, 353, 4842, 305, 29889, 3298, 359, 4197, 29890, 29903, 29892, 4236, 29918, 29882, 29918, 2435, 14664, 517, 29898, 10141, 29897, 13, 1678, 363, 289, 29892, 330, 29918, 29893, 29883, 29896, 297, 26985, 29898, 29887, 29918, 29893, 29883, 1125, 13, 4706, 363, 330, 29918, 29893, 29883, 29896, 29896, 297, 330, 29918, 29893, 29883, 29896, 29901, 13, 9651, 527, 29961, 29890, 29892, 330, 29918, 29893, 29883, 29896, 29896, 29962, 353, 29871, 29896, 29889, 29900, 13, 1678, 396, 1281, 4984, 2070, 29889, 13, 1678, 282, 353, 383, 29889, 18816, 29885, 3398, 29898, 29879, 29918, 29893, 29883, 29897, 13, 1678, 6410, 353, 383, 29889, 19541, 29918, 19128, 29918, 296, 14441, 29898, 29886, 29892, 527, 29897, 13, 13, 1678, 736, 6410, 13, 13, 13, 1753, 365, 2209, 29918, 827, 29898, 29879, 29918, 827, 29892, 330, 29918, 1233, 29892, 330, 29918, 827, 1125, 13, 13, 1678, 396, 1281, 4984, 2380, 4636, 13, 1678, 6410, 353, 29871, 29900, 13, 1678, 363, 289, 29892, 330, 29918, 1233, 29896, 297, 26985, 29898, 29887, 29918, 1233, 1125, 13, 4706, 565, 330, 29918, 1233, 29896, 1275, 29871, 29900, 29901, 13, 9651, 6773, 13, 4706, 330, 29918, 827, 29896, 353, 330, 29918, 827, 29961, 29890, 29962, 13, 4706, 269, 29918, 827, 29896, 353, 269, 29918, 827, 29961, 29890, 29962, 13, 4706, 6410, 4619, 383, 29889, 19128, 29918, 296, 14441, 29898, 29879, 29918, 827, 29896, 7503, 29887, 29918, 1233, 29896, 1402, 4842, 305, 29889, 20158, 29898, 29887, 29918, 827, 29896, 467, 517, 29898, 10141, 876, 13, 13, 1678, 736, 6410, 13, 13, 1753, 365, 2209, 29918, 29893, 29894, 29918, 344, 29898, 29879, 29918, 29893, 29894, 29892, 330, 29918, 1233, 29892, 330, 29918, 29893, 1403, 1125, 13, 1678, 9995, 13, 1678, 269, 29918, 29893, 29894, 29901, 259, 518, 29890, 29903, 29892, 29871, 29946, 29892, 286, 29931, 29892, 29871, 29906, 1402, 29871, 29946, 15028, 363, 7472, 396, 310, 4195, 29892, 29871, 29906, 260, 4167, 363, 1369, 669, 1095, 1480, 1169, 29889, 13, 1678, 330, 29918, 29893, 1403, 29901, 29871, 518, 518, 29896, 29892, 29871, 29941, 29892, 29871, 29906, 1402, 518, 29946, 29892, 29941, 29962, 4514, 313, 8256, 350, 29922, 29906, 29892, 281, 29876, 29898, 29890, 29922, 29896, 29897, 353, 29871, 29941, 29892, 281, 29876, 29898, 29890, 29922, 29906, 29897, 353, 29871, 29906, 467, 13, 1678, 9995, 13, 1678, 6410, 353, 29871, 29900, 13, 1678, 396, 330, 29918, 29893, 1403, 353, 4842, 305, 29889, 20158, 29898, 29887, 29918, 29893, 1403, 467, 517, 29898, 10141, 29897, 13, 1678, 363, 289, 29892, 330, 29918, 29893, 1403, 29896, 297, 26985, 29898, 29887, 29918, 29893, 1403, 1125, 13, 4706, 396, 363, 474, 29918, 1233, 29892, 330, 29918, 29893, 1403, 29896, 29896, 297, 26985, 29898, 29887, 29918, 29893, 1403, 29896, 1125, 13, 4706, 330, 29918, 1233, 29896, 353, 7431, 29898, 29887, 29918, 29893, 1403, 29896, 29897, 29871, 396, 29871, 30417, 31264, 30846, 13, 4706, 396, 330, 29918, 1233, 29896, 353, 330, 29918, 1233, 29961, 29890, 29962, 29871, 396, 29871, 30417, 31264, 30846, 13, 4706, 565, 330, 29918, 1233, 29896, 1275, 29871, 29900, 29901, 13, 9651, 6773, 13, 4706, 330, 29918, 29893, 1403, 29896, 353, 4842, 305, 29889, 20158, 29898, 29887, 29918, 29893, 1403, 29896, 29897, 7503, 29887, 29918, 1233, 29896, 1822, 517, 29898, 10141, 29897, 396, 29871, 30417, 31264, 30846, 13, 4706, 330, 29918, 303, 29896, 353, 330, 29918, 29893, 1403, 29896, 7503, 29892, 29900, 29962, 13, 4706, 330, 29918, 287, 29896, 353, 330, 29918, 29893, 1403, 29896, 7503, 29892, 29896, 29962, 13, 4706, 396, 6410, 515, 278, 1369, 2602, 13, 4706, 6410, 4619, 383, 29889, 19128, 29918, 296, 14441, 29898, 29879, 29918, 29893, 29894, 29961, 29890, 29892, 29901, 29887, 29918, 1233, 29896, 29892, 29901, 29892, 29900, 1402, 330, 29918, 303, 29896, 29897, 13, 13, 4706, 396, 1596, 703, 303, 29918, 7507, 29901, 9162, 269, 29918, 29893, 29894, 29961, 29890, 29892, 29901, 29887, 29918, 1233, 29896, 29892, 29901, 29892, 29900, 1402, 330, 29918, 303, 29896, 29892, 6410, 29897, 13, 4706, 396, 6410, 515, 278, 1095, 2602, 13, 4706, 6410, 4619, 383, 29889, 19128, 29918, 296, 14441, 29898, 29879, 29918, 29893, 29894, 29961, 29890, 29892, 29901, 29887, 29918, 1233, 29896, 29892, 29901, 29892, 29896, 1402, 330, 29918, 287, 29896, 29897, 13, 4706, 396, 1596, 703, 287, 29918, 7507, 29901, 9162, 269, 29918, 29893, 29894, 29961, 29890, 29892, 29901, 29887, 29918, 1233, 29896, 29892, 29901, 29892, 29896, 1402, 330, 29918, 287, 29896, 29892, 6410, 29897, 13, 13, 1678, 736, 6410, 13, 13, 13, 13, 13, 29937, 1275, 2751, 25512, 3826, 6119, 29899, 14420, 1275, 4936, 29922, 13, 1990, 383, 29911, 29918, 29879, 29906, 29879, 29918, 29896, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 3826, 6119, 29899, 14420, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29892, 4236, 29918, 11762, 29918, 2848, 29892, 302, 29918, 1116, 29918, 3554, 29892, 302, 29918, 16170, 29918, 3554, 29892, 2030, 29922, 8824, 1125, 13, 4706, 2428, 29898, 7818, 29918, 29879, 29906, 29879, 29918, 29896, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 396, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 396, 7934, 29918, 2311, 13, 4706, 1583, 29889, 3137, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 353, 302, 29918, 1116, 29918, 3554, 13, 4706, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 353, 302, 29918, 16170, 29918, 3554, 13, 4706, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 353, 29871, 29946, 13, 13, 4706, 1583, 29889, 7099, 6119, 29918, 29879, 29906, 29879, 353, 3826, 6119, 29918, 29879, 29906, 29879, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29892, 4236, 29918, 11762, 29918, 2848, 29897, 13, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 281, 3977, 29918, 29879, 29906, 29879, 29892, 301, 29918, 2080, 29892, 1067, 29879, 29918, 2003, 29892, 282, 593, 29918, 2962, 29918, 17082, 29892, 330, 29918, 29886, 593, 29918, 333, 10351, 29922, 8516, 1125, 13, 4706, 8158, 353, 1583, 29889, 7099, 6119, 29918, 29879, 29906, 29879, 29898, 29893, 3977, 29918, 29879, 29906, 29879, 29892, 301, 29918, 2080, 29892, 1067, 29879, 29918, 2003, 29892, 282, 593, 29918, 2962, 29918, 17082, 29892, 330, 29918, 29886, 593, 29918, 333, 10351, 29897, 13, 4706, 736, 8158, 13, 13, 13, 1678, 822, 382, 29954, 29918, 11333, 29898, 1311, 29892, 281, 3977, 29918, 29879, 29906, 29879, 29892, 301, 29918, 2080, 29892, 1067, 29879, 29918, 2003, 29892, 13, 462, 259, 282, 593, 29918, 2962, 29918, 17082, 29892, 282, 593, 29918, 355, 29918, 17082, 29892, 13, 462, 259, 474, 29918, 2850, 29918, 29894, 542, 370, 29892, 474, 29918, 29876, 6092, 29892, 474, 29918, 29882, 6289, 29892, 29871, 396, 363, 382, 29954, 13, 462, 259, 18897, 29892, 302, 6092, 29892, 302, 6092, 29918, 29873, 29892, 298, 6289, 29892, 260, 29873, 29918, 517, 29918, 29873, 29918, 13140, 29892, 29871, 396, 363, 382, 29954, 13, 462, 259, 260, 29890, 29892, 6012, 29892, 13, 462, 259, 22913, 29918, 2311, 29922, 29946, 29892, 22913, 29918, 6194, 29922, 5574, 1125, 13, 4706, 9995, 382, 29954, 29899, 2543, 2618, 22913, 29899, 4478, 9995, 13, 13, 4706, 8158, 353, 1583, 29889, 7099, 6119, 29918, 29879, 29906, 29879, 29889, 11787, 29918, 11333, 29898, 29893, 3977, 29918, 29879, 29906, 29879, 29892, 301, 29918, 2080, 29892, 1067, 29879, 29918, 2003, 29892, 13, 462, 462, 9651, 282, 593, 29918, 2962, 29918, 17082, 29892, 282, 593, 29918, 355, 29918, 17082, 29892, 13, 462, 462, 9651, 474, 29918, 2850, 29918, 29894, 542, 370, 29892, 474, 29918, 29876, 6092, 29892, 474, 29918, 29882, 6289, 29892, 29871, 396, 363, 382, 29954, 13, 462, 462, 9651, 18897, 29892, 302, 6092, 29892, 302, 6092, 29918, 29873, 29892, 298, 6289, 29892, 260, 29873, 29918, 517, 29918, 29873, 29918, 13140, 29892, 29871, 396, 363, 382, 29954, 13, 462, 462, 9651, 260, 29890, 29892, 6012, 29892, 13, 462, 462, 9651, 22913, 29918, 2311, 29892, 22913, 29918, 6194, 29897, 13, 4706, 736, 8158, 13, 13, 13, 1990, 3826, 6119, 29918, 29879, 29906, 29879, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29922, 29941, 29900, 29900, 29892, 7934, 29918, 2311, 29922, 29896, 29900, 29900, 29892, 954, 29918, 13148, 29922, 29906, 29892, 5768, 449, 29922, 29900, 29889, 29941, 29892, 4236, 29918, 11762, 29918, 2848, 29922, 29906, 29906, 29906, 29892, 302, 29918, 1116, 29918, 3554, 29922, 29941, 1125, 13, 4706, 2428, 29898, 6185, 6119, 29918, 29879, 29906, 29879, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 4706, 1583, 29889, 29885, 29931, 353, 4236, 29918, 11762, 29918, 2848, 13, 13, 4706, 1583, 29889, 29911, 3317, 353, 29871, 29906, 29900, 29900, 13, 13, 4706, 1583, 29889, 3977, 29918, 29882, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 3977, 29918, 29876, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29922, 524, 29898, 10892, 29918, 2311, 847, 29871, 29906, 511, 13, 462, 632, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 632, 5768, 449, 29922, 8865, 449, 29892, 21000, 8684, 284, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 13808, 29918, 21257, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 2080, 29918, 2311, 29922, 3317, 29918, 11762, 29918, 2848, 29892, 7934, 29918, 2311, 29922, 10892, 29918, 2311, 29892, 13, 462, 462, 954, 29918, 29277, 29922, 1949, 29918, 13148, 29892, 9853, 29918, 4102, 29922, 5574, 29892, 13, 462, 462, 5768, 449, 29922, 8865, 449, 29897, 13, 13, 4706, 1583, 29889, 29956, 29918, 29879, 29906, 29879, 353, 302, 29876, 29889, 12697, 29898, 2080, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 4706, 1583, 29889, 29956, 29918, 29886, 593, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 7934, 29918, 2311, 29897, 13, 13, 4706, 1583, 29889, 29893, 29894, 29918, 449, 353, 302, 29876, 29889, 16941, 2556, 29898, 15755, 29889, 29911, 27731, 3285, 302, 29876, 29889, 12697, 29898, 10892, 29918, 2311, 29892, 29871, 29896, 876, 13, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 281, 3977, 29918, 29879, 29906, 29879, 29892, 301, 29918, 2080, 29892, 1067, 29879, 29918, 2003, 29892, 282, 593, 29918, 2962, 29918, 17082, 29892, 330, 29918, 29886, 593, 29918, 333, 10351, 29922, 8516, 29892, 1125, 13, 13, 4706, 396, 1174, 401, 13, 4706, 289, 29903, 29892, 286, 29931, 29918, 2080, 29892, 1881, 29918, 2311, 353, 281, 3977, 29918, 29879, 29906, 29879, 29889, 12181, 13, 13, 4706, 396, 2567, 29892, 4879, 3564, 29889, 13, 4706, 10377, 593, 353, 281, 3977, 29918, 29879, 29906, 29879, 29889, 1482, 29918, 3298, 359, 29898, 29890, 29903, 29892, 29871, 29896, 29892, 286, 29931, 29918, 2080, 467, 517, 29898, 10141, 29897, 29871, 396, 518, 29933, 29892, 29871, 29896, 29892, 29871, 29906, 29900, 29900, 29962, 13, 4706, 10377, 593, 7503, 29892, 29871, 29900, 29892, 282, 593, 29918, 2962, 29918, 17082, 29962, 353, 29871, 29896, 396, 29871, 29906, 29955, 338, 310, 1369, 5993, 1090, 1857, 5993, 2133, 11380, 13, 13, 4706, 396, 2847, 313, 3784, 29897, 4879, 13, 4706, 21447, 593, 353, 10377, 593, 13, 13, 4706, 396, 620, 14443, 281, 3977, 29918, 29879, 29906, 29879, 304, 11039, 403, 323, 2678, 13, 4706, 281, 3977, 29918, 29879, 29906, 29879, 353, 281, 3977, 29918, 29879, 29906, 29879, 29889, 6948, 802, 29872, 911, 29898, 29896, 29897, 13, 4706, 396, 298, 29918, 29900, 322, 274, 29918, 29900, 515, 1067, 29879, 29918, 2003, 13, 4706, 396, 2688, 526, 451, 21000, 8684, 284, 29889, 13, 4706, 298, 29918, 29900, 353, 4842, 305, 29889, 3298, 359, 4197, 1311, 29889, 1949, 29918, 13148, 29892, 289, 29903, 29892, 1583, 29889, 10892, 29918, 2311, 14664, 517, 29898, 10141, 29897, 13, 4706, 274, 29918, 29900, 353, 4842, 305, 29889, 3298, 359, 4197, 1311, 29889, 1949, 29918, 13148, 29892, 289, 29903, 29892, 1583, 29889, 10892, 29918, 2311, 14664, 517, 29898, 10141, 29897, 13, 4706, 363, 474, 29918, 13148, 297, 3464, 29898, 1311, 29889, 1949, 29918, 13148, 1125, 13, 9651, 298, 29918, 303, 353, 313, 29906, 29930, 29875, 29918, 13148, 11877, 1311, 29889, 10892, 29918, 2311, 13, 9651, 298, 29918, 287, 353, 298, 29918, 303, 718, 1583, 29889, 10892, 29918, 2311, 13, 13, 9651, 274, 29918, 303, 353, 313, 29906, 29930, 29875, 29918, 13148, 29974, 29896, 11877, 1311, 29889, 10892, 29918, 2311, 13, 9651, 274, 29918, 287, 353, 274, 29918, 303, 718, 1583, 29889, 10892, 29918, 2311, 13, 13, 9651, 298, 29918, 29900, 29961, 29875, 29918, 13148, 29962, 353, 1067, 29879, 29918, 2003, 7503, 29892, 298, 29918, 303, 29901, 29882, 29918, 287, 29962, 396, 518, 396, 310, 15359, 29892, 9853, 29892, 3964, 29962, 13, 9651, 274, 29918, 29900, 29961, 29875, 29918, 13148, 29962, 353, 1067, 29879, 29918, 2003, 7503, 29892, 274, 29918, 303, 29901, 29883, 29918, 287, 29962, 396, 518, 396, 310, 15359, 29892, 9853, 29892, 3964, 29962, 13, 13, 4706, 565, 330, 29918, 29886, 593, 29918, 333, 10351, 29901, 13, 13, 9651, 282, 593, 29918, 29876, 353, 4842, 305, 29889, 3298, 359, 29898, 29890, 29903, 29892, 1583, 29889, 29911, 3317, 29892, 286, 29931, 29918, 2080, 467, 517, 29898, 10141, 29897, 29871, 396, 697, 7375, 13, 9651, 396, 3566, 2380, 13, 9651, 363, 289, 29892, 330, 29918, 29886, 593, 29918, 333, 10351, 29896, 297, 26985, 29898, 29887, 29918, 29886, 593, 29918, 333, 10351, 1125, 13, 18884, 363, 260, 29892, 330, 29918, 29886, 593, 29918, 13140, 297, 26985, 29898, 29887, 29918, 29886, 593, 29918, 333, 10351, 29896, 1125, 13, 462, 1678, 282, 593, 29918, 29876, 29961, 29890, 29892, 260, 29892, 330, 29918, 29886, 593, 29918, 13140, 29962, 353, 29871, 29896, 13, 13, 9651, 396, 1174, 401, 13, 9651, 1602, 29918, 21257, 29892, 903, 353, 1583, 29889, 13808, 29918, 21257, 29898, 29886, 593, 29918, 29876, 29892, 313, 29882, 29918, 29900, 29892, 274, 29918, 29900, 876, 13, 9651, 1602, 29918, 21257, 353, 1602, 29918, 21257, 29889, 1285, 5526, 681, 580, 13, 13, 9651, 396, 518, 29890, 29903, 29892, 323, 29892, 1881, 29918, 2311, 29962, 13, 9651, 1602, 29918, 21257, 353, 1602, 29918, 21257, 29889, 6948, 802, 29872, 911, 29898, 29906, 29897, 13, 13, 9651, 396, 20535, 403, 8158, 13, 9651, 269, 29918, 29893, 29894, 353, 1583, 29889, 29893, 29894, 29918, 449, 29898, 13, 18884, 1583, 29889, 29956, 29918, 29879, 29906, 29879, 29898, 29893, 3977, 29918, 29879, 29906, 29879, 29897, 13, 18884, 718, 1583, 29889, 29956, 29918, 29886, 593, 29898, 7099, 29918, 21257, 29897, 13, 9651, 13742, 29879, 802, 29872, 911, 29898, 29941, 29897, 396, 518, 29933, 29892, 323, 29892, 286, 29931, 29918, 2080, 29892, 3964, 29962, 1599, 518, 29933, 29892, 323, 29892, 286, 29931, 29918, 2080, 29892, 29871, 29896, 29962, 1599, 518, 29933, 29892, 323, 29892, 286, 29931, 29918, 2080, 29962, 13, 9651, 396, 269, 29918, 29893, 29894, 353, 518, 29933, 29892, 29871, 29946, 29892, 323, 29892, 286, 29931, 29918, 29876, 29962, 353, 518, 16175, 29892, 2148, 29879, 29892, 5993, 22645, 29892, 8158, 29962, 13, 13, 9651, 396, 27368, 13, 9651, 363, 289, 29892, 301, 29918, 2080, 29896, 297, 26985, 29898, 29880, 29918, 2080, 1125, 13, 18884, 565, 301, 29918, 2080, 29896, 529, 286, 29931, 29918, 2080, 29901, 13, 462, 1678, 269, 29918, 29893, 29894, 29961, 29890, 29892, 584, 29892, 301, 29918, 2080, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 1683, 29901, 13, 9651, 260, 353, 29871, 29900, 13, 9651, 269, 29918, 29893, 29894, 29918, 1761, 353, 5159, 13, 9651, 21447, 593, 29918, 29882, 353, 313, 29882, 29918, 29900, 29892, 274, 29918, 29900, 29897, 13, 9651, 1550, 260, 529, 1583, 29889, 29911, 3317, 29901, 13, 18884, 1602, 29918, 21257, 29892, 21447, 593, 29918, 29882, 353, 1583, 29889, 13808, 29918, 21257, 29898, 6814, 593, 29892, 21447, 593, 29918, 29882, 29897, 29871, 396, 24471, 29885, 13, 13, 18884, 396, 518, 29933, 29892, 29871, 29896, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29933, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29900, 29900, 29962, 13, 18884, 1602, 29918, 21257, 353, 1602, 29918, 21257, 29889, 6948, 802, 29872, 911, 29898, 29906, 29897, 13, 18884, 396, 518, 29890, 29903, 29892, 323, 29892, 1881, 29918, 2311, 29962, 13, 13, 18884, 396, 679, 8158, 13, 18884, 269, 29918, 29893, 29894, 29896, 353, 1583, 29889, 29893, 29894, 29918, 449, 29898, 13, 462, 1678, 1583, 29889, 29956, 29918, 29879, 29906, 29879, 29898, 29893, 3977, 29918, 29879, 29906, 29879, 29897, 29871, 396, 518, 29933, 29892, 29871, 29896, 29892, 259, 286, 29931, 29918, 2080, 29892, 3964, 29962, 13, 462, 1678, 718, 1583, 29889, 29956, 29918, 29886, 593, 29898, 7099, 29918, 21257, 29897, 29871, 396, 518, 29933, 29892, 323, 29922, 29896, 29892, 308, 29896, 29892, 3964, 29962, 259, 2567, 29892, 323, 29922, 29896, 13, 18884, 13742, 29879, 802, 29872, 911, 29898, 29941, 29897, 13, 18884, 396, 269, 29918, 29893, 29894, 353, 518, 29933, 29892, 29871, 29946, 29892, 29871, 29896, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 353, 518, 16175, 29892, 2148, 29879, 29892, 5993, 22645, 29892, 8158, 29962, 13, 18884, 396, 1599, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29962, 13, 13, 18884, 396, 341, 1278, 292, 1192, 13, 18884, 363, 289, 29892, 301, 29918, 2080, 29896, 297, 26985, 29898, 29880, 29918, 2080, 1125, 13, 462, 1678, 565, 301, 29918, 2080, 29896, 529, 286, 29931, 29918, 2080, 29901, 13, 462, 4706, 269, 29918, 29893, 29894, 29896, 29961, 29890, 29892, 584, 29892, 301, 29918, 2080, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 18884, 396, 24930, 8158, 489, 13, 18884, 269, 29918, 29893, 29894, 29918, 1761, 29889, 4397, 29898, 29879, 29918, 29893, 29894, 29896, 29897, 13, 13, 18884, 396, 518, 29933, 29892, 29871, 29896, 29892, 286, 29931, 29918, 2080, 29962, 1599, 518, 29933, 29892, 286, 29931, 29918, 29876, 29962, 1599, 518, 29890, 29903, 16395, 29945, 29899, 29896, 4638, 13, 18884, 396, 313, 3317, 29918, 791, 29892, 4236, 29918, 513, 1575, 29897, 13, 18884, 903, 791, 29892, 282, 593, 29918, 29876, 353, 269, 29918, 29893, 29894, 29896, 29889, 1493, 29898, 29890, 29903, 29892, 448, 29896, 467, 3317, 29898, 6229, 29922, 29896, 29897, 13, 13, 18884, 396, 15998, 282, 593, 29918, 29876, 408, 263, 697, 29899, 8711, 1881, 29889, 13, 18884, 21447, 593, 353, 4842, 305, 29889, 3298, 359, 29898, 29890, 29903, 29892, 286, 29931, 29918, 2080, 467, 517, 29898, 10141, 29897, 13, 18884, 396, 21447, 593, 353, 21447, 593, 29889, 1557, 2620, 23538, 6229, 29922, 29896, 29892, 2380, 29922, 29886, 593, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29896, 511, 4765, 29922, 29896, 467, 517, 29898, 10141, 29897, 13, 18884, 21447, 593, 353, 21447, 593, 29889, 1557, 2620, 23538, 29896, 29892, 282, 593, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29896, 511, 29871, 29896, 29897, 13, 13, 18884, 21447, 593, 353, 21447, 593, 29889, 6948, 802, 29872, 911, 29898, 29896, 29897, 29871, 396, 6660, 518, 29933, 334, 29871, 29946, 29892, 29871, 29896, 29892, 29871, 29906, 29900, 29900, 29962, 13, 18884, 260, 4619, 29871, 29896, 13, 13, 13, 9651, 269, 29918, 29893, 29894, 353, 4842, 305, 29889, 1429, 29898, 29879, 29918, 29893, 29894, 29918, 1761, 29892, 29871, 29896, 29897, 396, 518, 29933, 29892, 13, 9651, 269, 29918, 29893, 29894, 353, 269, 29918, 29893, 29894, 29889, 29879, 802, 29872, 911, 29898, 29906, 29897, 396, 13, 9651, 396, 396, 12206, 3454, 2444, 304, 367, 19039, 29889, 13, 9651, 396, 396, 7363, 18745, 304, 9654, 5633, 13, 9651, 396, 363, 289, 29892, 301, 29918, 2080, 29896, 297, 26985, 29898, 29880, 29918, 2080, 1125, 13, 9651, 396, 268, 565, 301, 29918, 2080, 29896, 529, 286, 29931, 29918, 2080, 29901, 13, 9651, 396, 308, 269, 29918, 29893, 29894, 29961, 29890, 29892, 584, 29892, 301, 29918, 2080, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4706, 736, 269, 29918, 29893, 29894, 13, 13, 13, 1678, 822, 382, 29954, 29918, 11333, 29898, 1311, 29892, 281, 3977, 29918, 29879, 29906, 29879, 29892, 301, 29918, 2080, 29892, 1067, 29879, 29918, 2003, 29892, 13, 462, 259, 282, 593, 29918, 2962, 29918, 17082, 29892, 282, 593, 29918, 355, 29918, 17082, 29892, 13, 462, 259, 474, 29918, 2850, 29918, 29894, 542, 370, 29892, 474, 29918, 29876, 6092, 29892, 474, 29918, 29882, 6289, 29892, 396, 363, 382, 29954, 13, 462, 259, 18897, 29892, 302, 6092, 29892, 302, 6092, 29918, 29873, 29892, 298, 6289, 29892, 260, 29873, 29918, 517, 29918, 29873, 29918, 13140, 29892, 396, 363, 382, 29954, 13, 462, 259, 260, 29890, 29892, 6012, 29892, 13, 462, 259, 22913, 29918, 2311, 29892, 22913, 29918, 6194, 29922, 5574, 1125, 13, 13, 4706, 396, 1174, 401, 13, 4706, 289, 29903, 29892, 286, 29931, 29918, 2080, 29892, 1881, 29918, 2311, 353, 281, 3977, 29918, 29879, 29906, 29879, 29889, 12181, 13, 13, 4706, 396, 620, 14443, 281, 3977, 29918, 29879, 29906, 29879, 304, 6178, 21194, 323, 2678, 13, 4706, 281, 3977, 29918, 29879, 29906, 29879, 353, 281, 3977, 29918, 29879, 29906, 29879, 29889, 6948, 802, 29872, 911, 29898, 29896, 29897, 13, 4706, 396, 298, 29918, 29900, 322, 274, 29918, 29900, 515, 1067, 29879, 29918, 2003, 13, 4706, 396, 2688, 526, 451, 21000, 8684, 284, 29889, 13, 4706, 298, 29918, 29900, 353, 4842, 305, 29889, 3298, 359, 4197, 1311, 29889, 1949, 29918, 13148, 29892, 289, 29903, 29892, 1583, 29889, 10892, 29918, 2311, 14664, 517, 29898, 10141, 29897, 13, 4706, 274, 29918, 29900, 353, 4842, 305, 29889, 3298, 359, 4197, 1311, 29889, 1949, 29918, 13148, 29892, 289, 29903, 29892, 1583, 29889, 10892, 29918, 2311, 14664, 517, 29898, 10141, 29897, 13, 4706, 363, 474, 29918, 13148, 297, 3464, 29898, 1311, 29889, 1949, 29918, 13148, 1125, 13, 9651, 298, 29918, 303, 353, 313, 29906, 29930, 29875, 29918, 13148, 11877, 1311, 29889, 10892, 29918, 2311, 13, 9651, 298, 29918, 287, 353, 298, 29918, 303, 718, 1583, 29889, 10892, 29918, 2311, 13, 13, 9651, 274, 29918, 303, 353, 313, 29906, 29930, 29875, 29918, 13148, 29974, 29896, 11877, 1311, 29889, 10892, 29918, 2311, 13, 9651, 274, 29918, 287, 353, 274, 29918, 303, 718, 1583, 29889, 10892, 29918, 2311, 13, 13, 9651, 298, 29918, 29900, 29961, 29875, 29918, 13148, 29962, 353, 1067, 29879, 29918, 2003, 7503, 29892, 298, 29918, 303, 29901, 29882, 29918, 287, 29962, 396, 518, 396, 310, 15359, 29892, 9853, 29892, 3964, 29962, 13, 9651, 274, 29918, 29900, 29961, 29875, 29918, 13148, 29962, 353, 1067, 29879, 29918, 2003, 7503, 29892, 274, 29918, 303, 29901, 29883, 29918, 287, 29962, 396, 518, 396, 310, 15359, 29892, 9853, 29892, 3964, 29962, 13, 13, 13, 4706, 396, 2847, 313, 3784, 29897, 4879, 13, 4706, 282, 593, 29918, 1761, 29918, 915, 314, 353, 5159, 13, 4706, 21447, 593, 29918, 915, 314, 353, 5159, 13, 4706, 21447, 593, 29918, 29882, 29918, 915, 314, 353, 5159, 13, 13, 4706, 363, 474, 29918, 915, 314, 297, 3464, 29898, 915, 314, 29918, 2311, 1125, 13, 9651, 282, 593, 29918, 1761, 29918, 915, 314, 29896, 353, 5159, 13, 9651, 363, 289, 297, 3464, 29898, 29890, 29903, 1125, 13, 18884, 282, 593, 29918, 1761, 29918, 915, 314, 29896, 29889, 4397, 29898, 518, 518, 29886, 593, 29918, 2962, 29918, 17082, 1402, 29871, 29900, 29962, 1723, 13, 9651, 282, 593, 29918, 1761, 29918, 915, 314, 29889, 4397, 29898, 29886, 593, 29918, 1761, 29918, 915, 314, 29896, 29897, 13, 9651, 396, 2069, 7497, 21447, 593, 13, 9651, 396, 2567, 29892, 11905, 4879, 3564, 29889, 13, 9651, 10377, 593, 353, 281, 3977, 29918, 29879, 29906, 29879, 29889, 1482, 29918, 3298, 359, 29898, 29890, 29903, 29892, 29871, 29896, 29892, 286, 29931, 29918, 2080, 467, 517, 29898, 10141, 29897, 29871, 396, 518, 29933, 29892, 29871, 29896, 29892, 29871, 29906, 29900, 29900, 29962, 13, 9651, 396, 6652, 441, 10377, 593, 491, 474, 29918, 29890, 314, 373, 6437, 304, 4772, 2847, 5141, 1414, 310, 22913, 29899, 4478, 13, 9651, 10377, 593, 7503, 29892, 29871, 29900, 29892, 282, 593, 29918, 2962, 29918, 17082, 29962, 353, 29871, 29896, 29871, 396, 29871, 29906, 29955, 338, 310, 1369, 5993, 1090, 1857, 5993, 2133, 11380, 13, 13, 9651, 21447, 593, 29918, 915, 314, 29889, 4397, 29898, 666, 593, 29897, 13, 9651, 21447, 593, 29918, 29882, 29918, 915, 314, 29889, 4397, 29898, 313, 29882, 29918, 29900, 29892, 274, 29918, 29900, 29897, 1723, 13, 4706, 260, 353, 29871, 29900, 13, 4706, 1550, 260, 529, 1583, 29889, 29911, 3317, 29901, 13, 9651, 396, 269, 29918, 29893, 29894, 29896, 29918, 915, 314, 353, 5159, 13, 9651, 21669, 353, 518, 5159, 363, 289, 297, 3464, 29898, 29890, 29903, 29897, 4514, 29871, 396, 518, 29890, 29903, 29962, 13, 13, 9651, 396, 3251, 403, 22913, 13, 9651, 363, 474, 29918, 915, 314, 29892, 21447, 593, 297, 26985, 29898, 6814, 593, 29918, 915, 314, 1125, 13, 18884, 21447, 593, 29918, 29882, 353, 21447, 593, 29918, 29882, 29918, 915, 314, 29961, 29875, 29918, 915, 314, 29962, 13, 13, 18884, 282, 593, 29918, 1761, 29918, 915, 314, 29896, 353, 282, 593, 29918, 1761, 29918, 915, 314, 29961, 29875, 29918, 915, 314, 29962, 13, 18884, 1602, 29918, 21257, 29892, 21447, 593, 29918, 29882, 353, 1583, 29889, 13808, 29918, 21257, 29898, 6814, 593, 29892, 21447, 593, 29918, 29882, 29897, 29871, 396, 24471, 29885, 13, 18884, 21447, 593, 29918, 29882, 29918, 915, 314, 29961, 29875, 29918, 915, 314, 29962, 353, 21447, 593, 29918, 29882, 13, 13, 18884, 396, 518, 29933, 29892, 29871, 29896, 29892, 29871, 29896, 29900, 29900, 29962, 1599, 518, 29933, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29900, 29900, 29962, 13, 18884, 1602, 29918, 21257, 353, 1602, 29918, 21257, 29889, 6948, 802, 29872, 911, 29898, 29906, 29897, 13, 18884, 396, 518, 29890, 29903, 29892, 323, 29892, 1881, 29918, 2311, 29962, 13, 13, 18884, 396, 679, 8158, 13, 18884, 269, 29918, 29893, 29894, 29896, 353, 1583, 29889, 29893, 29894, 29918, 449, 29898, 13, 462, 1678, 1583, 29889, 29956, 29918, 29879, 29906, 29879, 29898, 29893, 3977, 29918, 29879, 29906, 29879, 29897, 29871, 396, 518, 29933, 29892, 29871, 29896, 29892, 259, 286, 29931, 29918, 2080, 29892, 3964, 29962, 13, 462, 1678, 718, 1583, 29889, 29956, 29918, 29886, 593, 29898, 7099, 29918, 21257, 29897, 29871, 396, 518, 29933, 29892, 323, 29922, 29896, 29892, 308, 29896, 29892, 3964, 29962, 259, 2567, 29892, 323, 29922, 29896, 13, 18884, 13742, 29879, 802, 29872, 911, 29898, 29941, 29897, 13, 18884, 396, 269, 29918, 29893, 29894, 353, 518, 29933, 29892, 29871, 29946, 29892, 29871, 29896, 29892, 286, 29931, 29918, 29876, 29892, 29871, 29896, 29962, 353, 518, 16175, 29892, 2148, 29879, 29892, 5993, 22645, 29892, 8158, 29962, 13, 18884, 396, 1599, 518, 29933, 29892, 29871, 29946, 29892, 286, 29931, 29918, 29876, 29962, 13, 13, 18884, 396, 341, 1278, 292, 1192, 13, 18884, 363, 289, 29892, 301, 29918, 2080, 29896, 297, 26985, 29898, 29880, 29918, 2080, 1125, 13, 462, 1678, 565, 301, 29918, 2080, 29896, 529, 286, 29931, 29918, 2080, 29901, 13, 462, 4706, 269, 29918, 29893, 29894, 29896, 29961, 29890, 29892, 584, 29892, 301, 29918, 2080, 29896, 17531, 353, 448, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 13, 18884, 396, 3617, 278, 21669, 871, 4249, 278, 1881, 2913, 29889, 13, 18884, 2070, 29892, 1178, 10351, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 29893, 29894, 29896, 29889, 1493, 29898, 29890, 29903, 29892, 448, 29896, 511, 3964, 29922, 29896, 467, 3332, 29895, 29898, 6229, 29922, 29896, 29892, 413, 29922, 3317, 29898, 29880, 29918, 2080, 876, 13, 18884, 1480, 29918, 22795, 353, 4842, 305, 29889, 1188, 29898, 22795, 29897, 29871, 396, 518, 29890, 29903, 29892, 22913, 29918, 2311, 29962, 13, 13, 18884, 363, 289, 29892, 1480, 29918, 22795, 29896, 297, 26985, 29898, 1188, 29918, 22795, 1125, 13, 462, 1678, 282, 593, 29918, 1761, 29896, 29896, 29892, 8158, 353, 282, 593, 29918, 1761, 29918, 915, 314, 29896, 29961, 29890, 29962, 13, 462, 1678, 363, 474, 29918, 3068, 29892, 1480, 29918, 22795, 29896, 29896, 297, 26985, 29898, 1188, 29918, 22795, 29896, 1125, 13, 462, 4706, 396, 694, 2767, 565, 1833, 5993, 471, 278, 1095, 29899, 6979, 13, 462, 4706, 3517, 29918, 29886, 593, 353, 282, 593, 29918, 1761, 29896, 29896, 14352, 29896, 29962, 13, 462, 4706, 565, 3517, 29918, 29886, 593, 1360, 282, 593, 29918, 355, 29918, 17082, 29901, 13, 462, 9651, 716, 29918, 11762, 353, 282, 593, 29918, 1761, 29896, 29896, 13, 462, 9651, 716, 29918, 13628, 353, 8158, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 716, 29918, 11762, 353, 282, 593, 29918, 1761, 29896, 29896, 718, 518, 333, 10351, 29961, 29890, 3816, 29875, 29918, 3068, 1822, 667, 580, 29962, 13, 462, 9651, 716, 29918, 13628, 353, 8158, 718, 1480, 29918, 22795, 29896, 29896, 29889, 667, 580, 13, 462, 4706, 903, 29883, 5380, 403, 353, 518, 1482, 29918, 11762, 29892, 716, 29918, 13628, 29962, 13, 13, 462, 4706, 21669, 29961, 29890, 1822, 4397, 7373, 29883, 5380, 403, 29897, 13, 13, 13, 9651, 396, 11080, 918, 29899, 2543, 2618, 22913, 21166, 13, 9651, 363, 289, 29892, 21669, 29896, 297, 26985, 29898, 29883, 5380, 1078, 1125, 13, 18884, 716, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 353, 12705, 29898, 29883, 5380, 1078, 29896, 29892, 1820, 29922, 2892, 1051, 29896, 29901, 1051, 29896, 14352, 29896, 1402, 11837, 29922, 5574, 29897, 13, 18884, 2302, 353, 29871, 29900, 13, 18884, 4629, 29918, 29883, 5380, 1078, 29896, 353, 5159, 13, 18884, 363, 716, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 297, 716, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29901, 13, 462, 1678, 565, 716, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 451, 297, 4629, 29918, 29883, 5380, 1078, 29896, 29901, 13, 462, 4706, 565, 22913, 29918, 6194, 29901, 13, 462, 9651, 4629, 29918, 29883, 5380, 1078, 29896, 29889, 4397, 29898, 1482, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 29897, 13, 462, 9651, 282, 593, 29918, 1761, 29918, 915, 314, 29961, 2798, 3816, 29890, 29962, 353, 716, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 13, 462, 9651, 2302, 4619, 29896, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 396, 20768, 304, 367, 9120, 1244, 29889, 13, 462, 9651, 16813, 353, 7700, 13, 462, 9651, 1243, 519, 353, 7700, 13, 13, 462, 9651, 544, 29918, 29875, 29918, 29894, 29887, 29918, 1761, 29892, 544, 29918, 29875, 29918, 29894, 29887, 29918, 1491, 29918, 1761, 353, 2531, 29918, 29875, 29918, 29894, 29887, 29918, 3166, 29918, 29886, 593, 29918, 333, 10351, 4197, 1482, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 29961, 29900, 20526, 518, 29875, 29918, 2850, 29918, 29894, 542, 370, 29961, 29890, 20526, 518, 29875, 29918, 29876, 6092, 29961, 29890, 20526, 13, 462, 462, 462, 462, 462, 1678, 518, 29875, 29918, 29882, 6289, 29961, 29890, 24960, 13, 462, 9651, 544, 29918, 2850, 29918, 29939, 29918, 29879, 29906, 29879, 29892, 544, 29918, 2850, 29918, 29875, 353, 2531, 29918, 2850, 29918, 29939, 29918, 3166, 29918, 29875, 29918, 29894, 29887, 4197, 517, 12360, 29961, 29890, 20526, 518, 29876, 6092, 29961, 29890, 20526, 518, 29876, 6092, 29918, 29873, 29961, 29890, 20526, 518, 29882, 6289, 29961, 29890, 20526, 518, 698, 29918, 517, 29918, 29873, 29918, 13140, 29961, 29890, 20526, 13, 462, 462, 462, 462, 308, 282, 593, 29918, 2962, 29918, 17082, 29892, 282, 593, 29918, 355, 29918, 17082, 29892, 13, 462, 462, 462, 462, 308, 518, 1482, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 29961, 29900, 20526, 544, 29918, 29875, 29918, 29894, 29887, 29918, 1761, 29892, 544, 29918, 29875, 29918, 29894, 29887, 29918, 1491, 29918, 1761, 29897, 13, 13, 462, 9651, 396, 1423, 1243, 3097, 515, 1831, 29899, 16398, 1509, 13, 462, 9651, 1018, 29901, 13, 462, 18884, 396, 1423, 3692, 6996, 3161, 22981, 297, 544, 29918, 2850, 29918, 29875, 13, 462, 18884, 396, 960, 577, 29892, 372, 338, 1243, 519, 29889, 13, 13, 462, 18884, 22645, 29918, 16170, 353, 544, 29918, 2850, 29918, 29875, 29961, 29900, 29962, 3366, 16170, 3108, 13, 462, 18884, 22645, 29918, 2838, 353, 544, 29918, 2850, 29918, 29875, 29961, 29900, 29962, 3366, 2838, 3108, 13, 462, 18884, 1243, 519, 353, 5852, 13, 462, 9651, 5174, 29901, 13, 462, 18884, 1243, 519, 353, 7700, 13, 462, 18884, 1209, 13, 13, 462, 9651, 396, 1423, 278, 10122, 310, 2148, 29879, 13, 462, 9651, 565, 1243, 519, 29901, 13, 462, 18884, 1018, 29901, 13, 462, 462, 1678, 2148, 29879, 353, 544, 29918, 2850, 29918, 29875, 29961, 29900, 29962, 3366, 1116, 29879, 3108, 13, 462, 18884, 5174, 29901, 13, 462, 462, 1678, 2148, 29879, 353, 5159, 13, 13, 462, 18884, 1018, 29901, 13, 462, 462, 1678, 544, 29918, 550, 29896, 353, 6012, 29889, 7978, 29898, 22625, 29961, 29890, 22322, 333, 7464, 22645, 29918, 2838, 29892, 22645, 29918, 16170, 29892, 2148, 29879, 29897, 13, 462, 462, 1678, 16813, 353, 6120, 29898, 558, 29918, 550, 29896, 29897, 13, 462, 18884, 5174, 29901, 13, 462, 462, 1678, 16813, 353, 7700, 13, 13, 462, 9651, 396, 13, 462, 9651, 565, 1243, 519, 29901, 13, 462, 18884, 565, 16813, 29901, 13, 462, 462, 1678, 788, 29918, 29883, 5380, 403, 353, 5852, 13, 462, 18884, 1683, 29901, 13, 462, 462, 1678, 788, 29918, 29883, 5380, 403, 353, 7700, 13, 462, 9651, 1683, 29901, 13, 462, 18884, 788, 29918, 29883, 5380, 403, 353, 5852, 13, 13, 13, 462, 9651, 565, 788, 29918, 29883, 5380, 403, 29901, 13, 462, 18884, 4629, 29918, 29883, 5380, 1078, 29896, 29889, 4397, 29898, 1482, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 29897, 13, 462, 18884, 282, 593, 29918, 1761, 29918, 915, 314, 29961, 2798, 3816, 29890, 29962, 353, 716, 29918, 29886, 593, 29918, 1761, 29918, 16175, 29896, 29896, 13, 462, 18884, 2302, 4619, 29871, 29896, 13, 13, 462, 1678, 565, 2302, 1275, 22913, 29918, 2311, 29901, 13, 462, 4706, 2867, 13, 13, 18884, 565, 2302, 529, 22913, 29918, 2311, 29901, 13, 462, 1678, 396, 451, 16813, 472, 599, 636, 13, 462, 1678, 396, 788, 432, 2960, 5665, 29889, 13, 462, 1678, 363, 474, 29918, 29926, 2960, 297, 3464, 29898, 2798, 29892, 22913, 29918, 2311, 1125, 13, 462, 4706, 282, 593, 29918, 1761, 29918, 915, 314, 29961, 29875, 29918, 29926, 2960, 3816, 29890, 29962, 353, 5519, 29886, 593, 29918, 355, 29918, 17082, 1402, 29899, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29962, 13, 13, 9651, 396, 5706, 21447, 593, 13, 9651, 396, 15998, 282, 593, 29918, 29876, 408, 263, 697, 29899, 8711, 1881, 29889, 13, 9651, 363, 474, 29918, 915, 314, 297, 3464, 29898, 915, 314, 29918, 2311, 1125, 13, 18884, 21447, 593, 353, 4842, 305, 29889, 3298, 359, 29898, 29890, 29903, 29892, 286, 29931, 29918, 2080, 467, 517, 29898, 10141, 29897, 13, 18884, 396, 21447, 593, 353, 21447, 593, 29889, 1557, 2620, 23538, 6229, 29922, 29896, 29892, 2380, 29922, 29886, 593, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29896, 511, 4765, 29922, 29896, 467, 517, 29898, 10141, 29897, 13, 18884, 22645, 29918, 16175, 353, 518, 11762, 29918, 13628, 29961, 29900, 3816, 29899, 29896, 29962, 363, 19359, 29918, 13628, 297, 282, 593, 29918, 1761, 29918, 915, 314, 29961, 29875, 29918, 915, 314, 5262, 13, 18884, 282, 593, 29918, 29876, 353, 4842, 305, 29889, 20158, 29898, 13140, 29918, 16175, 467, 517, 29898, 10141, 29897, 13, 18884, 21447, 593, 353, 21447, 593, 29889, 1557, 2620, 23538, 29896, 29892, 282, 593, 29918, 29876, 29889, 6948, 802, 29872, 911, 29898, 29896, 511, 29871, 29896, 29897, 13, 18884, 21447, 593, 353, 21447, 593, 29889, 6948, 802, 29872, 911, 29898, 29896, 29897, 29871, 396, 6660, 518, 29933, 29892, 260, 29922, 29896, 29892, 286, 29931, 29918, 2080, 29962, 13, 18884, 21447, 593, 29918, 915, 314, 29961, 29875, 29918, 915, 314, 29962, 353, 21447, 593, 13, 9651, 260, 4619, 29871, 29896, 13, 13, 4706, 396, 3251, 403, 1900, 544, 29918, 29886, 593, 29918, 1761, 29892, 282, 29918, 4260, 13, 4706, 544, 29918, 29886, 593, 29918, 333, 10351, 353, 5159, 13, 4706, 282, 29918, 1761, 353, 5159, 13, 4706, 363, 289, 297, 3464, 29898, 29890, 29903, 1125, 13, 9651, 282, 593, 29918, 1761, 29918, 915, 314, 29918, 13318, 353, 282, 593, 29918, 1761, 29918, 915, 314, 29961, 29900, 29962, 13, 9651, 544, 29918, 29886, 593, 29918, 333, 10351, 29889, 4397, 29898, 29886, 593, 29918, 1761, 29918, 915, 314, 29918, 13318, 29961, 29890, 3816, 29900, 2314, 13, 9651, 282, 29918, 1761, 29889, 4397, 29898, 282, 593, 29918, 1761, 29918, 915, 314, 29918, 13318, 29961, 29890, 3816, 29896, 2314, 13, 13, 4706, 736, 544, 29918, 29886, 593, 29918, 333, 10351, 29892, 282, 29918, 1761, 29892, 282, 593, 29918, 1761, 29918, 915, 314, 13, 13, 13, 29937, 1275, 4936, 25512, 29871, 1383, 9536, 29899, 14420, 1275, 4936, 2751, 29922, 13, 1990, 383, 29911, 29918, 29636, 279, 29918, 29896, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 1383, 9536, 29899, 14420, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29892, 7934, 29918, 2311, 29892, 954, 29918, 13148, 29892, 5768, 449, 29892, 302, 29918, 1116, 29918, 3554, 29892, 302, 29918, 16170, 29918, 3554, 29892, 2030, 29922, 8824, 1125, 13, 4706, 2428, 29898, 7818, 29918, 29636, 279, 29918, 29896, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 396, 1881, 29918, 2311, 13, 4706, 1583, 29889, 10892, 29918, 2311, 353, 7934, 29918, 2311, 13, 4706, 1583, 29889, 1949, 29918, 13148, 353, 954, 29918, 13148, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 353, 302, 29918, 1116, 29918, 3554, 13, 4706, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 353, 302, 29918, 16170, 29918, 3554, 13, 4706, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 353, 29871, 29946, 13, 13, 13, 1678, 822, 885, 29886, 29898, 1311, 29892, 281, 1590, 29918, 29882, 29892, 301, 29918, 6672, 1125, 13, 4706, 289, 29903, 29892, 4236, 29918, 6672, 29918, 2435, 29892, 903, 353, 281, 1590, 29918, 29882, 29889, 12181, 13, 4706, 396, 269, 29918, 1557, 13, 13, 4706, 269, 29918, 1557, 353, 4842, 305, 29889, 3298, 359, 29898, 29890, 29903, 29892, 4236, 29918, 6672, 29918, 2435, 467, 517, 29898, 10141, 29897, 13, 4706, 269, 29918, 1557, 7503, 29892, 584, 29962, 353, 281, 1590, 29918, 29882, 7503, 29892, 584, 29892, 29871, 29900, 29962, 29871, 396, 269, 29918, 1557, 353, 518, 29933, 29892, 4236, 29918, 6672, 3309, 29892, 29871, 29896, 29962, 13, 13, 4706, 396, 269, 29918, 1557, 7503, 29892, 17531, 353, 383, 29889, 13161, 29882, 29898, 29893, 1590, 29918, 29882, 7503, 29892, 29901, 29892, 29900, 2314, 29871, 396, 269, 29918, 1557, 353, 518, 29933, 29892, 4236, 29918, 6672, 3309, 29892, 29871, 29896, 29962, 13, 4706, 396, 269, 29918, 1557, 353, 269, 29918, 1557, 29889, 29879, 802, 29872, 911, 29898, 29906, 29897, 13, 4706, 396, 11105, 292, 13, 4706, 396, 1596, 29898, 29888, 29908, 29879, 29918, 1557, 426, 29879, 29918, 1557, 27195, 13, 4706, 363, 289, 29892, 301, 29918, 6672, 29896, 297, 26985, 29898, 29880, 29918, 6672, 1125, 13, 9651, 269, 29918, 1557, 29961, 29890, 29892, 301, 29918, 6672, 29896, 17531, 353, 448, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29889, 29900, 13, 13, 4706, 736, 269, 29918, 1557, 13, 13, 1678, 822, 21672, 29898, 1311, 29892, 281, 1590, 29918, 29882, 29892, 544, 29918, 1557, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 1125, 13, 4706, 289, 29903, 29892, 4236, 29918, 6672, 29918, 2435, 29892, 903, 353, 281, 1590, 29918, 29882, 29889, 12181, 13, 4706, 396, 1831, 310, 11404, 362, 5455, 13, 4706, 269, 29918, 4977, 353, 4842, 305, 29889, 3298, 359, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 14664, 517, 29898, 10141, 29897, 13, 4706, 363, 289, 29892, 544, 29918, 1557, 29896, 297, 26985, 29898, 558, 29918, 1557, 1125, 13, 9651, 269, 29918, 4977, 29961, 29890, 29892, 17531, 353, 281, 1590, 29918, 29882, 29961, 29890, 29892, 558, 29918, 1557, 29896, 29892, 13140, 29918, 303, 29901, 13140, 29918, 287, 29962, 13, 13, 4706, 736, 269, 29918, 4977, 13, 13, 1678, 822, 281, 9302, 29898, 1311, 29892, 1067, 29879, 29918, 2003, 1125, 13, 4706, 289, 29903, 353, 1067, 29879, 29918, 2003, 29889, 12181, 29961, 29900, 29962, 13, 4706, 396, 518, 29933, 29892, 10892, 29918, 2311, 29962, 1599, 518, 29933, 29892, 302, 29918, 3062, 29918, 1949, 29974, 29896, 29962, 13, 4706, 269, 29918, 1233, 353, 4842, 305, 29889, 3298, 359, 29898, 29890, 29903, 29892, 313, 1311, 29889, 29876, 29918, 3062, 29918, 1949, 718, 29871, 29896, 8106, 517, 29898, 10141, 29897, 13, 4706, 269, 29918, 1233, 7503, 29892, 584, 29962, 353, 1067, 29879, 29918, 2003, 7503, 29892, 29871, 29900, 5919, 1311, 29889, 29876, 29918, 3062, 29918, 1949, 718, 29871, 29896, 4638, 13, 13, 4706, 736, 269, 29918, 1233, 13, 13, 1678, 822, 281, 6814, 29898, 1311, 29892, 281, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 1125, 13, 4706, 289, 29903, 29892, 4236, 29918, 6672, 29918, 2435, 29892, 903, 353, 281, 1590, 29918, 29882, 29889, 12181, 13, 13, 4706, 269, 29918, 29893, 29883, 353, 4842, 305, 29889, 3298, 359, 29898, 29890, 29903, 29892, 4236, 29918, 6672, 29918, 2435, 29892, 29871, 29896, 467, 517, 29898, 10141, 29897, 13, 4706, 269, 29918, 29893, 29883, 7503, 29892, 584, 29892, 584, 29962, 353, 281, 1590, 29918, 29882, 7503, 29892, 584, 29892, 22645, 29918, 303, 29901, 13140, 29918, 287, 29962, 13, 13, 4706, 269, 29918, 29893, 29883, 353, 269, 29918, 29893, 29883, 29889, 29879, 802, 29872, 911, 29898, 29906, 29897, 29871, 396, 518, 29933, 29892, 4236, 29918, 6672, 29918, 2848, 29962, 13, 13, 4706, 396, 11105, 292, 13, 4706, 363, 289, 29892, 301, 29918, 6672, 29896, 297, 26985, 29898, 29880, 29918, 6672, 1125, 13, 9651, 269, 29918, 29893, 29883, 29961, 29890, 29892, 301, 29918, 6672, 29896, 17531, 353, 448, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29929, 29889, 29900, 13, 13, 4706, 736, 269, 29918, 29893, 29883, 13, 13, 1678, 822, 281, 459, 29898, 1311, 29892, 281, 1590, 29918, 29882, 29892, 544, 29918, 29893, 29883, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 1125, 13, 4706, 289, 29903, 29892, 4236, 29918, 6672, 29918, 2435, 29892, 903, 353, 281, 1590, 29918, 29882, 29889, 12181, 13, 13, 4706, 269, 29918, 827, 353, 4842, 305, 29889, 3298, 359, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 14664, 517, 29898, 10141, 29897, 13, 4706, 363, 289, 29892, 544, 29918, 29893, 29883, 29896, 297, 26985, 29898, 558, 29918, 29893, 29883, 1125, 13, 9651, 565, 7431, 29898, 558, 29918, 29893, 29883, 29896, 29897, 1405, 29871, 29900, 29901, 13, 18884, 269, 29918, 827, 29961, 29890, 29892, 29871, 29900, 29901, 2435, 29898, 558, 29918, 29893, 29883, 29896, 511, 584, 29962, 353, 281, 1590, 29918, 29882, 29961, 29890, 29892, 544, 29918, 29893, 29883, 29896, 29892, 22645, 29918, 303, 29901, 13140, 29918, 287, 29962, 13, 9651, 1683, 29901, 13, 18884, 1209, 13, 13, 4706, 736, 269, 29918, 827, 13, 13, 1678, 822, 281, 29894, 29886, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 544, 29918, 29893, 29883, 1125, 13, 4706, 289, 29903, 29892, 17117, 903, 353, 7232, 29918, 12470, 29889, 12181, 13, 13, 4706, 269, 29918, 29893, 29894, 353, 4842, 305, 29889, 3298, 359, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 4236, 29898, 2435, 29918, 12470, 511, 29871, 29906, 14664, 517, 29898, 10141, 29897, 13, 4706, 363, 289, 29892, 544, 29918, 29893, 29883, 29896, 297, 26985, 29898, 558, 29918, 29893, 29883, 1125, 13, 13, 9651, 565, 7431, 29898, 558, 29918, 29893, 29883, 29896, 29897, 1405, 29871, 29900, 29901, 13, 18884, 396, 1369, 1480, 277, 13, 18884, 269, 29918, 29893, 29894, 29961, 29890, 29892, 29871, 29900, 29901, 2435, 29898, 558, 29918, 29893, 29883, 29896, 511, 584, 29892, 29871, 29900, 29962, 353, 7232, 29918, 12470, 29961, 29890, 29892, 584, 29892, 544, 29918, 29893, 29883, 29896, 1822, 3286, 4220, 29898, 29900, 29892, 29871, 29896, 29897, 13, 18884, 396, 1095, 1480, 277, 13, 18884, 269, 29918, 29893, 29894, 29961, 29890, 29892, 29871, 29900, 29901, 2435, 29898, 558, 29918, 29893, 29883, 29896, 511, 584, 29892, 29871, 29896, 29962, 353, 7232, 29918, 12470, 29961, 29890, 29892, 584, 29892, 518, 558, 29918, 29893, 29883, 29896, 29896, 718, 29871, 29896, 29900, 29900, 363, 544, 29918, 29893, 29883, 29896, 29896, 297, 544, 29918, 29893, 29883, 29896, 29962, 1822, 3286, 4220, 29898, 29900, 29892, 29871, 29896, 29897, 13, 9651, 1683, 29901, 13, 18884, 1209, 13, 13, 4706, 396, 11105, 292, 13, 4706, 396, 27368, 363, 805, 332, 2738, 18897, 13, 4706, 363, 289, 29892, 301, 29918, 29876, 29896, 297, 26985, 29898, 2435, 29918, 12470, 1125, 13, 9651, 565, 301, 29918, 29876, 29896, 529, 4236, 29898, 2435, 29918, 12470, 1125, 13, 18884, 269, 29918, 29893, 29894, 29961, 29890, 29892, 584, 29892, 301, 29918, 29876, 29896, 29901, 29892, 584, 29962, 353, 448, 29896, 29872, 29974, 29896, 29896, 13, 4706, 736, 269, 29918, 29893, 29894, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 281, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 1067, 29879, 29918, 2003, 29892, 13, 18884, 330, 29918, 1557, 29922, 8516, 29892, 330, 29918, 4977, 29922, 8516, 29892, 330, 29918, 1233, 29922, 8516, 29892, 330, 29918, 29893, 29883, 29922, 8516, 29892, 330, 29918, 827, 29922, 8516, 29892, 330, 29918, 29893, 1403, 29922, 8516, 29892, 13, 18884, 1510, 29918, 29886, 29918, 1557, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 4977, 29922, 8824, 29892, 13, 18884, 1510, 29918, 29886, 29918, 1233, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29883, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 827, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29894, 29922, 8824, 1125, 13, 13, 4706, 396, 7232, 29918, 12470, 353, 518, 29933, 29892, 4236, 29918, 29876, 6092, 29918, 6979, 29918, 2848, 29892, 7934, 29918, 2311, 29962, 396, 1244, 29892, 396, 310, 3646, 29918, 13148, 338, 4343, 304, 29871, 29896, 29889, 13, 4706, 396, 281, 1590, 29918, 29882, 353, 518, 29933, 29892, 4236, 29918, 6672, 396, 29892, 7934, 29918, 2311, 29962, 13, 13, 4706, 269, 29918, 1557, 353, 1583, 29889, 1557, 29886, 29898, 29893, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29897, 13, 4706, 565, 330, 29918, 1557, 29901, 13, 9651, 544, 29918, 1557, 353, 330, 29918, 1557, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 1557, 353, 4450, 29918, 1557, 29898, 29879, 29918, 1557, 29897, 13, 13, 4706, 396, 269, 29918, 4977, 13, 4706, 22645, 29918, 303, 353, 29871, 29896, 13, 4706, 22645, 29918, 287, 353, 29871, 29896, 718, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 13, 4706, 269, 29918, 4977, 353, 1583, 29889, 29879, 481, 29898, 29893, 1590, 29918, 29882, 29892, 544, 29918, 1557, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 29897, 13, 13, 4706, 565, 330, 29918, 4977, 29901, 13, 9651, 544, 29918, 4977, 353, 330, 29918, 4977, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 4977, 353, 4450, 29918, 4977, 29898, 29879, 29918, 4977, 29897, 13, 13, 4706, 396, 988, 29918, 4537, 13, 13, 4706, 269, 29918, 1233, 353, 1583, 29889, 1233, 29886, 29898, 25932, 29918, 2003, 29897, 13, 4706, 565, 330, 29918, 1233, 29901, 13, 9651, 544, 29918, 1233, 353, 330, 29918, 1233, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 1233, 353, 4450, 29918, 1233, 29898, 29879, 29918, 1233, 29897, 13, 13, 4706, 396, 28678, 13, 4706, 22645, 29918, 303, 353, 22645, 29918, 287, 29974, 29896, 13, 4706, 22645, 29918, 287, 353, 22645, 29918, 303, 29974, 29896, 13, 4706, 269, 29918, 29893, 29883, 353, 1583, 29889, 29893, 6814, 29898, 29893, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 29897, 13, 13, 4706, 565, 330, 29918, 29893, 29883, 29901, 13, 9651, 544, 29918, 29893, 29883, 353, 330, 29918, 29893, 29883, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 29893, 29883, 353, 4450, 29918, 3062, 4914, 29898, 558, 29918, 1233, 29892, 269, 29918, 29893, 29883, 29897, 13, 13, 4706, 396, 8879, 13, 4706, 22645, 29918, 303, 353, 22645, 29918, 287, 29974, 29896, 13, 4706, 22645, 29918, 287, 353, 22645, 29918, 303, 718, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 13, 13, 4706, 269, 29918, 827, 353, 1583, 29889, 29893, 459, 29898, 29893, 1590, 29918, 29882, 29892, 544, 29918, 29893, 29883, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 29897, 13, 13, 4706, 565, 330, 29918, 827, 29901, 13, 9651, 544, 29918, 827, 353, 330, 29918, 827, 13, 4706, 1683, 29901, 13, 9651, 544, 29918, 827, 353, 4450, 29918, 827, 29898, 558, 29918, 1233, 29892, 269, 29918, 827, 29897, 13, 13, 4706, 396, 281, 29894, 13, 4706, 396, 269, 29918, 29893, 29894, 353, 29871, 518, 29890, 29903, 29892, 29871, 29946, 29892, 286, 29931, 29892, 29871, 29906, 29962, 13, 4706, 269, 29918, 29893, 29894, 353, 1583, 29889, 29893, 29894, 29886, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 544, 29918, 29893, 29883, 29897, 13, 13, 4706, 396, 1596, 29898, 29879, 29918, 29893, 29894, 29897, 13, 4706, 396, 269, 29918, 29893, 29894, 353, 383, 29889, 13161, 29882, 29898, 29879, 29918, 29893, 29894, 29897, 13, 4706, 736, 269, 29918, 1557, 29892, 269, 29918, 4977, 29892, 269, 29918, 1233, 29892, 269, 29918, 29893, 29883, 29892, 269, 29918, 827, 29892, 269, 29918, 29893, 29894, 13, 13, 13, 1678, 822, 6375, 29918, 11787, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 281, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 1067, 29879, 29918, 2003, 29892, 6012, 29892, 260, 29890, 29892, 13, 462, 259, 302, 6092, 29918, 29873, 29892, 302, 6092, 29918, 698, 29892, 260, 29873, 29918, 517, 29918, 29873, 29918, 13140, 29892, 302, 6092, 29892, 13, 462, 259, 22913, 29918, 2311, 29922, 29946, 1125, 13, 4706, 9995, 13, 4706, 11080, 918, 29899, 2543, 2618, 22913, 1602, 3689, 29889, 13, 4706, 11044, 9247, 13557, 411, 393, 310, 405, 29931, 29906, 4176, 365, 2747, 29889, 13, 4706, 9995, 13, 4706, 396, 7605, 29899, 16398, 1509, 13, 4706, 2070, 29918, 29879, 1113, 29892, 544, 29918, 1557, 29918, 13318, 29892, 544, 29918, 4977, 29918, 13318, 29892, 320, 13, 4706, 282, 29918, 1557, 29918, 13318, 29892, 282, 29918, 4977, 29918, 13318, 29892, 282, 29918, 2622, 320, 13, 9651, 353, 1583, 29889, 11787, 29918, 7099, 3689, 29918, 2622, 29898, 29893, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 260, 29890, 29892, 22913, 29918, 2311, 29922, 915, 314, 29918, 2311, 29897, 13, 13, 4706, 396, 6804, 29899, 16398, 1509, 13, 4706, 2070, 29918, 29893, 29892, 2070, 29918, 1233, 29918, 29893, 29892, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29892, 544, 29918, 2850, 29918, 29875, 29892, 544, 29918, 29893, 1403, 29918, 13318, 29892, 320, 13, 4706, 282, 29918, 3062, 29892, 282, 29918, 1233, 29918, 13318, 29892, 282, 29918, 29893, 29883, 29918, 13318, 29892, 282, 29918, 827, 29918, 13318, 29892, 282, 29918, 29893, 1403, 29918, 13318, 320, 13, 9651, 353, 1583, 29889, 11787, 29918, 7099, 3689, 29918, 3062, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 281, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 1067, 29879, 29918, 2003, 29892, 6012, 29892, 260, 29890, 29892, 13, 462, 462, 268, 302, 6092, 29918, 29873, 29892, 302, 6092, 29918, 698, 29892, 260, 29873, 29918, 517, 29918, 29873, 29918, 13140, 29892, 302, 6092, 29892, 13, 462, 462, 268, 544, 29918, 1557, 29918, 13318, 29892, 544, 29918, 4977, 29918, 13318, 29892, 13, 462, 462, 268, 22913, 29918, 2311, 29922, 29946, 29897, 13, 13, 4706, 282, 29918, 4260, 353, 1208, 29918, 22795, 29918, 4260, 29898, 29886, 29918, 2622, 29892, 282, 29918, 3062, 29897, 13, 4706, 736, 544, 29918, 1557, 29918, 13318, 29892, 544, 29918, 4977, 29918, 13318, 29892, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29892, 544, 29918, 29893, 1403, 29918, 13318, 29892, 320, 13, 1669, 544, 29918, 2850, 29918, 29875, 29892, 282, 29918, 4260, 29892, 282, 29918, 2622, 29892, 282, 29918, 3062, 29892, 282, 29918, 1557, 29918, 13318, 29892, 282, 29918, 4977, 29918, 13318, 29892, 320, 13, 1669, 282, 29918, 1233, 29918, 13318, 29892, 282, 29918, 29893, 29883, 29918, 13318, 29892, 282, 29918, 827, 29918, 13318, 29892, 282, 29918, 29893, 1403, 29918, 13318, 13, 13, 13, 1678, 822, 382, 29954, 29918, 7099, 3689, 29918, 2622, 29898, 1311, 29892, 281, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 260, 29890, 29892, 13, 462, 965, 22913, 29918, 2311, 29922, 29946, 29892, 1510, 29918, 29886, 29918, 1557, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 4977, 29922, 8824, 1125, 13, 13, 4706, 396, 885, 13, 4706, 269, 29918, 1557, 353, 1583, 29889, 1557, 29886, 29898, 29893, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29897, 13, 4706, 2070, 29918, 1557, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 1557, 29892, 3964, 10457, 29896, 29897, 13, 4706, 289, 29903, 29892, 286, 29883, 29931, 353, 269, 29918, 1557, 29889, 12181, 13, 13, 4706, 396, 9212, 29918, 6672, 29918, 2848, 353, 1375, 29898, 29880, 29918, 6672, 29897, 13, 4706, 396, 22913, 29918, 2311, 353, 9212, 29918, 6672, 29918, 2848, 565, 22913, 29918, 2311, 1405, 9212, 29918, 6672, 29918, 2848, 1683, 22913, 29918, 2311, 13, 13, 4706, 396, 872, 13, 4706, 396, 1281, 4984, 599, 1950, 885, 29918, 4977, 29918, 13628, 13, 4706, 2070, 29918, 1557, 29918, 4977, 353, 4842, 305, 29889, 3298, 359, 4197, 29890, 29903, 29892, 22913, 29918, 2311, 29892, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 14664, 517, 29898, 10141, 29897, 13, 4706, 8158, 29918, 1557, 29918, 4977, 353, 4842, 305, 29889, 3298, 359, 4197, 29890, 29903, 29892, 22913, 29918, 2311, 29892, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 14664, 517, 29898, 10141, 29897, 13, 13, 4706, 2070, 29918, 29879, 1113, 353, 4842, 305, 29889, 3298, 359, 29918, 4561, 29898, 22795, 29918, 1557, 29918, 4977, 467, 517, 29898, 10141, 29897, 13, 13, 4706, 396, 679, 278, 2246, 29899, 29895, 16285, 29889, 29871, 544, 29918, 1557, 29918, 915, 314, 353, 518, 29933, 29892, 22913, 29918, 2311, 29962, 13, 4706, 544, 29918, 1557, 29918, 915, 314, 353, 4450, 29918, 1557, 29918, 915, 314, 29898, 29879, 29918, 1557, 29892, 22913, 29918, 2311, 29897, 13, 13, 4706, 396, 8147, 322, 8500, 269, 29918, 4977, 29889, 13, 4706, 22645, 29918, 303, 353, 29871, 29896, 13, 4706, 22645, 29918, 287, 353, 29871, 29896, 718, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 13, 4706, 363, 474, 29918, 915, 314, 297, 3464, 29898, 915, 314, 29918, 2311, 1125, 13, 9651, 544, 29918, 1557, 353, 1051, 29898, 2378, 29898, 558, 29918, 1557, 29918, 915, 314, 29897, 7503, 29892, 474, 29918, 915, 314, 2314, 13, 9651, 269, 29918, 4977, 353, 1583, 29889, 29879, 481, 29898, 29893, 1590, 29918, 29882, 29892, 544, 29918, 1557, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 29897, 13, 9651, 2070, 29918, 4977, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 4977, 29892, 3964, 10457, 29896, 29897, 13, 9651, 2070, 29918, 1557, 29918, 4977, 7503, 29892, 474, 29918, 915, 314, 29892, 584, 29962, 353, 2070, 29918, 4977, 13, 9651, 8158, 29918, 1557, 29918, 4977, 7503, 29892, 474, 29918, 915, 314, 29892, 584, 29962, 353, 269, 29918, 4977, 13, 13, 9651, 2070, 29918, 1557, 29918, 8391, 353, 2070, 29918, 1557, 29961, 3881, 29898, 29890, 29903, 511, 544, 29918, 1557, 29962, 29871, 396, 518, 29933, 29962, 13, 9651, 2070, 29918, 29879, 1113, 7503, 29892, 474, 29918, 915, 314, 29892, 584, 29962, 353, 313, 22795, 29918, 4977, 29889, 29873, 580, 334, 2070, 29918, 1557, 29918, 8391, 467, 29873, 580, 13, 9651, 396, 518, 14047, 29931, 29892, 350, 29962, 334, 518, 29933, 29962, 1599, 518, 14047, 29931, 29892, 350, 29962, 313, 5029, 29899, 3538, 21666, 29897, 13, 9651, 396, 518, 14047, 29931, 29892, 350, 29962, 1599, 518, 29933, 29892, 286, 29883, 29931, 29962, 13, 13, 4706, 396, 20535, 403, 278, 9927, 310, 12489, 13, 4706, 396, 2025, 29918, 6229, 353, 7431, 29898, 22795, 29918, 29879, 1113, 29889, 12181, 29897, 13, 13, 4706, 1178, 10351, 353, 2246, 29895, 29918, 9910, 29918, 6229, 29898, 7345, 305, 29889, 20158, 29898, 22795, 29918, 29879, 1113, 511, 302, 29918, 3332, 29895, 29922, 915, 314, 29918, 2311, 29892, 9853, 29918, 28997, 29922, 5574, 29897, 13, 4706, 396, 2567, 408, 885, 29918, 13140, 338, 2307, 12705, 29892, 337, 29899, 1958, 963, 6284, 29889, 13, 4706, 1178, 10351, 353, 1083, 481, 29918, 1557, 29918, 13140, 29898, 333, 10351, 29892, 544, 29918, 1557, 29918, 915, 314, 29897, 29871, 396, 518, 1557, 29918, 915, 314, 29918, 13140, 29892, 872, 29918, 13140, 29962, 1599, 518, 1557, 29918, 13140, 29892, 872, 29918, 13140, 29962, 13, 4706, 1178, 10351, 29918, 2749, 353, 1409, 29898, 333, 10351, 29897, 13, 4706, 396, 518, 29933, 29892, 22913, 29918, 2311, 29892, 3933, 335, 3964, 29962, 13, 4706, 396, 1178, 10351, 29961, 29890, 3816, 29900, 29962, 4076, 937, 16269, 518, 1557, 29918, 13140, 29892, 872, 29918, 13140, 29962, 11000, 29889, 13, 4706, 396, 1178, 10351, 29961, 29890, 3816, 29896, 29962, 4076, 310, 1473, 29889, 13, 13, 4706, 396, 20535, 403, 2070, 29918, 29879, 1113, 29892, 263, 14002, 6976, 13, 4706, 22913, 29918, 13140, 29918, 29879, 1113, 353, 518, 29900, 29962, 334, 289, 29903, 13, 4706, 22913, 29918, 1004, 300, 29918, 1552, 29918, 8394, 353, 518, 8824, 29962, 334, 289, 29903, 13, 4706, 1550, 5852, 29901, 13, 9651, 544, 29918, 1557, 353, 1178, 10351, 29918, 2749, 29961, 3881, 29898, 29890, 29903, 511, 22913, 29918, 13140, 29918, 29879, 1113, 29892, 29871, 29900, 29962, 13, 9651, 544, 29918, 4977, 353, 1178, 10351, 29918, 2749, 29961, 3881, 29898, 29890, 29903, 511, 22913, 29918, 13140, 29918, 29879, 1113, 29892, 29871, 29896, 29962, 13, 13, 9651, 396, 2910, 2380, 6284, 13, 13, 9651, 1423, 353, 1423, 29918, 1557, 29918, 4977, 29918, 29886, 7121, 29898, 22625, 29892, 544, 29918, 1557, 29892, 544, 29918, 4977, 29897, 13, 13, 9651, 565, 2533, 29898, 3198, 29897, 1275, 289, 29903, 29901, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 363, 289, 29892, 1423, 29896, 297, 26985, 29898, 3198, 1125, 13, 462, 1678, 565, 451, 1423, 29896, 29901, 29871, 396, 2743, 5101, 13, 462, 4706, 22913, 29918, 13140, 29918, 29879, 1113, 29961, 29890, 29962, 4619, 29871, 29896, 13, 462, 4706, 565, 22913, 29918, 13140, 29918, 29879, 1113, 29961, 29890, 29962, 6736, 22913, 29918, 2311, 29901, 13, 462, 9651, 22913, 29918, 1004, 300, 29918, 1552, 29918, 8394, 29961, 29890, 29962, 353, 5852, 13, 462, 9651, 22913, 29918, 13140, 29918, 29879, 1113, 29961, 29890, 29962, 22361, 29871, 29896, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 22913, 29918, 1004, 300, 29918, 1552, 29918, 8394, 29961, 29890, 29962, 353, 5852, 13, 13, 9651, 565, 2533, 29898, 915, 314, 29918, 1004, 300, 29918, 1552, 29918, 8394, 29897, 1275, 289, 29903, 29901, 13, 18884, 2867, 13, 13, 4706, 396, 2567, 544, 29918, 1557, 29892, 544, 29918, 4977, 526, 6284, 25383, 29889, 13, 4706, 544, 29918, 1557, 29918, 13318, 353, 1051, 29898, 558, 29918, 1557, 29897, 13, 4706, 544, 29918, 4977, 29918, 13318, 353, 1051, 29898, 558, 29918, 4977, 29897, 13, 13, 4706, 396, 1962, 363, 2678, 7418, 29889, 13, 4706, 282, 29918, 1557, 29918, 13318, 353, 1208, 29918, 22795, 29918, 1557, 29898, 29879, 29918, 1557, 29892, 544, 29918, 1557, 29918, 13318, 29897, 13, 4706, 282, 29918, 4977, 29918, 13318, 353, 1208, 29918, 22795, 29918, 4977, 29898, 13628, 29918, 1557, 29918, 4977, 29961, 3881, 29898, 29890, 29903, 511, 22913, 29918, 13140, 29918, 29879, 1113, 29892, 584, 1822, 29879, 802, 29872, 911, 29898, 29896, 511, 544, 29918, 4977, 29918, 13318, 29897, 13, 4706, 282, 29918, 2622, 353, 1208, 29918, 22795, 29918, 2622, 29898, 29886, 29918, 1557, 29918, 13318, 29892, 282, 29918, 4977, 29918, 13318, 29897, 13, 4706, 396, 282, 29918, 2622, 29871, 353, 2070, 29918, 29879, 1113, 29961, 3881, 29898, 29890, 29903, 511, 915, 314, 29918, 13140, 29918, 29879, 1113, 29892, 558, 29918, 4977, 29918, 13318, 1822, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 13, 4706, 736, 2070, 29918, 29879, 1113, 29892, 544, 29918, 1557, 29918, 13318, 29892, 544, 29918, 4977, 29918, 13318, 29892, 282, 29918, 1557, 29918, 13318, 29892, 282, 29918, 4977, 29918, 13318, 29892, 282, 29918, 2622, 13, 13, 1678, 822, 382, 29954, 29918, 7099, 3689, 29918, 3062, 29898, 1311, 29892, 7232, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 281, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 1067, 29879, 29918, 2003, 29892, 6012, 29892, 260, 29890, 29892, 13, 462, 268, 302, 6092, 29918, 29873, 29892, 302, 6092, 29918, 11912, 29918, 29873, 29892, 260, 29873, 29918, 517, 29918, 29873, 29918, 13140, 29892, 302, 6092, 29892, 13, 462, 3986, 544, 29918, 1557, 29918, 13318, 29892, 544, 29918, 4977, 29918, 13318, 29892, 13, 462, 268, 22913, 29918, 2311, 29922, 29946, 29892, 1510, 29918, 29886, 29918, 1233, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29883, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 827, 29922, 8824, 29892, 1510, 29918, 29886, 29918, 29893, 29894, 29922, 8824, 1125, 13, 13, 4706, 289, 29903, 29892, 4236, 29918, 6672, 29918, 2435, 29892, 903, 353, 281, 1590, 29918, 29882, 29889, 12181, 13, 13, 4706, 396, 2567, 29892, 6804, 29899, 16398, 1509, 22913, 2740, 29889, 13, 4706, 22645, 29918, 303, 353, 29871, 29896, 13, 4706, 22645, 29918, 287, 353, 29871, 29896, 718, 1583, 29889, 29876, 29918, 16170, 29918, 3554, 13, 13, 4706, 269, 29918, 1233, 353, 1583, 29889, 1233, 29886, 29898, 25932, 29918, 2003, 29897, 13, 4706, 2070, 29918, 1233, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 1233, 29892, 3964, 10457, 29896, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 13, 4706, 396, 7460, 376, 4258, 9246, 29908, 1556, 5517, 29871, 29946, 29898, 29922, 3317, 29918, 1949, 29918, 974, 29918, 1116, 2187, 29897, 988, 29899, 16398, 6394, 29889, 13, 4706, 396, 28678, 13, 4706, 22645, 29918, 303, 353, 22645, 29918, 287, 718, 29871, 29896, 13, 4706, 22645, 29918, 287, 353, 22645, 29918, 303, 718, 29871, 29896, 13, 13, 4706, 269, 29918, 29893, 29883, 353, 1583, 29889, 29893, 6814, 29898, 29893, 1590, 29918, 29882, 29892, 301, 29918, 6672, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 29897, 13, 4706, 2070, 29918, 29893, 29883, 353, 4842, 305, 29889, 18816, 29885, 3398, 29898, 29879, 29918, 29893, 29883, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 4706, 396, 544, 29918, 29893, 29883, 29918, 24582, 29918, 1609, 29918, 22795, 353, 4450, 29918, 29893, 29883, 29918, 24582, 29918, 1609, 29918, 22795, 29898, 29879, 29918, 29893, 29883, 29897, 13, 13, 4706, 396, 679, 4236, 29918, 1233, 396, 310, 1556, 16269, 4341, 669, 1009, 2070, 29889, 13, 4706, 544, 29918, 1233, 29918, 3317, 353, 518, 1311, 29889, 29876, 29918, 3062, 29918, 1949, 29962, 334, 289, 29903, 13, 4706, 544, 29918, 29893, 29883, 29918, 3317, 353, 4450, 29918, 3062, 4914, 29898, 558, 29918, 1233, 29918, 3317, 29892, 269, 29918, 29893, 29883, 29897, 29871, 396, 565, 777, 1897, 437, 451, 505, 16813, 988, 29899, 16398, 1709, 29892, 288, 2415, 393, 1897, 13, 4706, 2070, 29918, 29893, 29883, 29918, 3317, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 2314, 13, 4706, 363, 289, 29892, 544, 29918, 29893, 29883, 29918, 3317, 29896, 297, 26985, 29898, 558, 29918, 29893, 29883, 29918, 3317, 1125, 13, 9651, 2070, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 29892, 584, 29962, 353, 2070, 29918, 29893, 29883, 29961, 29890, 29892, 544, 29918, 29893, 29883, 29918, 3317, 29896, 29962, 13, 13, 4706, 396, 679, 1556, 16269, 302, 29918, 3062, 29918, 1949, 988, 29899, 695, 23676, 13, 4706, 396, 8879, 13, 4706, 22645, 29918, 303, 353, 22645, 29918, 287, 718, 29871, 29896, 13, 4706, 22645, 29918, 287, 353, 22645, 29918, 303, 718, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 13, 4706, 269, 29918, 827, 29918, 3317, 353, 1583, 29889, 29893, 459, 29898, 29893, 1590, 29918, 29882, 29892, 544, 29918, 29893, 29883, 29918, 3317, 29892, 22645, 29918, 303, 29892, 22645, 29918, 287, 29897, 13, 4706, 2070, 29918, 827, 29918, 3317, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 827, 29918, 3317, 29892, 3964, 10457, 29896, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 4706, 396, 518, 29933, 29892, 302, 29918, 3062, 29918, 1949, 29892, 302, 29918, 1116, 29918, 459, 29962, 13, 13, 4706, 544, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 353, 5159, 13, 4706, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 353, 5159, 13, 4706, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 303, 29918, 459, 29918, 1761, 353, 5159, 13, 4706, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 287, 29918, 459, 29918, 1761, 353, 5159, 13, 13, 4706, 396, 1763, 337, 29899, 1509, 775, 29892, 12312, 278, 13944, 17128, 6275, 29889, 13, 4706, 363, 474, 29918, 459, 297, 3464, 29898, 1311, 29889, 29876, 29918, 1116, 29918, 3554, 448, 29871, 29896, 1125, 13, 9651, 544, 29918, 827, 29918, 7382, 353, 5519, 29875, 29918, 459, 29962, 334, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29962, 334, 289, 29903, 13, 9651, 396, 281, 29894, 13, 9651, 269, 29918, 29893, 29894, 353, 1583, 29889, 29893, 29894, 29886, 29898, 1590, 29918, 12470, 29892, 7431, 29918, 12470, 29892, 544, 29918, 29893, 29883, 29918, 3317, 29897, 13, 9651, 2070, 29918, 29893, 29894, 353, 383, 29889, 2695, 3317, 29898, 29879, 29918, 29893, 29894, 29892, 3964, 10457, 29906, 467, 4801, 496, 2141, 517, 877, 21970, 2824, 23749, 580, 13, 13, 9651, 396, 2070, 29918, 29893, 29894, 13, 9651, 544, 29918, 29893, 1403, 29918, 915, 314, 29892, 2070, 29918, 29893, 1403, 29918, 915, 314, 29892, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 303, 29892, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 287, 353, 4450, 29918, 29893, 1403, 29918, 344, 29918, 915, 314, 29898, 1311, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 269, 29918, 29893, 29894, 29892, 22913, 29918, 2311, 29897, 13, 9651, 544, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29889, 4397, 29898, 558, 29918, 29893, 1403, 29918, 915, 314, 29897, 13, 13, 9651, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29889, 4397, 29898, 22795, 29918, 29893, 1403, 29918, 915, 314, 29897, 13, 9651, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 303, 29918, 459, 29918, 1761, 29889, 4397, 29898, 22795, 29918, 29893, 1403, 29918, 915, 314, 29918, 303, 29897, 13, 9651, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 287, 29918, 459, 29918, 1761, 29889, 4397, 29898, 22795, 29918, 29893, 1403, 29918, 915, 314, 29918, 287, 29897, 13, 9651, 396, 544, 29918, 29893, 1403, 29918, 915, 314, 353, 518, 29933, 29892, 302, 29918, 3062, 29918, 1949, 29892, 413, 29918, 1188, 277, 1068, 29906, 518, 303, 29892, 1226, 29962, 610, 275, 29962, 13, 13, 9651, 396, 4450, 29918, 29893, 29894, 29918, 915, 314, 13, 13, 4706, 396, 20535, 403, 14002, 6976, 310, 988, 29899, 16398, 1509, 13, 4706, 396, 2070, 29918, 29893, 353, 518, 16175, 29892, 28678, 29892, 8879, 29892, 281, 29894, 29962, 353, 518, 29933, 29892, 302, 29918, 3062, 29918, 1949, 29892, 302, 29918, 1116, 29918, 459, 29892, 302, 29918, 29886, 7121, 29962, 13, 4706, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 353, 2070, 29918, 29893, 1403, 29918, 915, 314, 29889, 12181, 29961, 29906, 29962, 13, 4706, 2070, 29918, 29893, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 448, 29871, 29896, 29892, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 2314, 13, 4706, 2070, 29918, 29893, 29883, 29918, 700, 572, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 448, 29871, 29896, 29892, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 2314, 13, 4706, 2070, 29918, 827, 29918, 700, 572, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 448, 29871, 29896, 29892, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 2314, 13, 4706, 2070, 29918, 29893, 1403, 29918, 303, 29918, 700, 572, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 448, 29871, 29896, 29892, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 2314, 13, 4706, 2070, 29918, 29893, 1403, 29918, 287, 29918, 700, 572, 353, 24786, 4197, 29890, 29903, 29892, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29892, 1583, 29889, 29876, 29918, 1116, 29918, 3554, 448, 29871, 29896, 29892, 302, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 2314, 13, 13, 4706, 363, 289, 297, 3464, 29898, 29890, 29903, 1125, 13, 9651, 363, 474, 29918, 1233, 297, 3464, 29898, 1311, 29889, 29876, 29918, 3062, 29918, 1949, 1125, 13, 18884, 363, 474, 29918, 459, 297, 3464, 29898, 1311, 29889, 29876, 29918, 1116, 29918, 3554, 448, 29871, 29896, 1125, 29871, 396, 437, 451, 671, 2186, 697, 13, 462, 1678, 282, 29918, 29893, 29883, 353, 2070, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 29892, 474, 29918, 1233, 29962, 13, 462, 1678, 363, 474, 29918, 29893, 29894, 29918, 915, 314, 297, 3464, 29898, 29876, 29918, 29893, 29894, 29918, 915, 314, 29918, 29886, 7121, 1125, 13, 462, 4706, 396, 474, 29918, 29893, 29883, 353, 544, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 3816, 29875, 29918, 1233, 29962, 396, 2307, 2309, 13, 462, 4706, 282, 29918, 827, 353, 2070, 29918, 827, 29918, 3317, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29962, 13, 462, 4706, 282, 29918, 29893, 29894, 353, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29961, 29875, 29918, 459, 3816, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 13, 13, 462, 4706, 2070, 29918, 29893, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 353, 282, 29918, 29893, 29883, 334, 282, 29918, 827, 334, 282, 29918, 29893, 29894, 13, 462, 4706, 2070, 29918, 29893, 29883, 29918, 700, 572, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 353, 282, 29918, 29893, 29883, 13, 462, 4706, 2070, 29918, 827, 29918, 700, 572, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 353, 282, 29918, 827, 13, 13, 462, 4706, 282, 29918, 29893, 29894, 29918, 303, 353, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 303, 29918, 459, 29918, 1761, 29961, 29875, 29918, 459, 3816, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 13, 462, 4706, 282, 29918, 29893, 29894, 29918, 287, 353, 2070, 29918, 29893, 1403, 29918, 915, 314, 29918, 287, 29918, 459, 29918, 1761, 29961, 29875, 29918, 459, 3816, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 13, 13, 462, 4706, 2070, 29918, 29893, 1403, 29918, 303, 29918, 700, 572, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 353, 282, 29918, 29893, 29894, 29918, 303, 13, 462, 4706, 2070, 29918, 29893, 1403, 29918, 287, 29918, 700, 572, 29961, 29890, 29892, 474, 29918, 1233, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 915, 314, 29962, 353, 282, 29918, 29893, 29894, 29918, 287, 13, 13, 13, 4706, 396, 27313, 8225, 1410, 2618, 1602, 3689, 13, 4706, 2148, 29879, 29918, 3317, 353, 5159, 13, 4706, 2070, 29918, 1116, 29879, 29918, 3317, 353, 5159, 13, 4706, 396, 1550, 7431, 29898, 1116, 29879, 29918, 3317, 29897, 529, 1583, 29889, 29876, 29918, 3062, 29918, 1949, 29901, 13, 4706, 1178, 10351, 353, 2246, 29895, 29918, 9910, 29918, 6229, 29898, 7345, 305, 29889, 20158, 29898, 22795, 29918, 29893, 511, 302, 29918, 3332, 29895, 29922, 915, 314, 29918, 2311, 29892, 9853, 29918, 28997, 29922, 5574, 29897, 13, 4706, 396, 1178, 10351, 353, 518, 29933, 29892, 474, 29918, 29893, 29883, 29918, 915, 314, 29892, 474, 29918, 459, 29892, 474, 29918, 29893, 29894, 29918, 29886, 7121, 29962, 13, 13, 4706, 396, 1281, 4984, 2148, 29879, 29896, 29889, 24930, 871, 16813, 697, 29889, 739, 338, 5153, 2548, 1797, 310, 278, 6976, 29889, 13, 4706, 544, 29918, 29893, 1403, 29918, 3317, 353, 5159, 13, 13, 4706, 282, 29918, 29893, 29883, 29918, 3317, 353, 5159, 13, 4706, 282, 29918, 827, 29918, 3317, 353, 5159, 13, 4706, 282, 29918, 29893, 1403, 29918, 3317, 353, 5159, 13, 4706, 363, 289, 29892, 1178, 10351, 29896, 297, 26985, 29898, 333, 10351, 1125, 13, 9651, 2148, 29879, 29918, 3317, 29896, 353, 5159, 13, 9651, 2070, 29918, 1116, 29879, 29918, 3317, 29896, 353, 5159, 13, 9651, 544, 29918, 29893, 1403, 29896, 29918, 3317, 353, 5159, 13, 13, 9651, 282, 29918, 29893, 29883, 29896, 29918, 3317, 353, 5159, 13, 9651, 282, 29918, 827, 29896, 29918, 3317, 353, 5159, 13, 9651, 282, 29918, 29893, 1403, 29896, 29918, 3317, 353, 5159, 13, 13, 9651, 363, 474, 29918, 1233, 29892, 1178, 10351, 29896, 29896, 297, 26985, 29898, 333, 10351, 29896, 1125, 13, 18884, 474, 29918, 29893, 29883, 353, 544, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 3816, 333, 10351, 29896, 29896, 29961, 29900, 5262, 13, 18884, 474, 29918, 459, 353, 1178, 10351, 29896, 29896, 29961, 29896, 29962, 13, 18884, 281, 1403, 353, 544, 29918, 29893, 1403, 29918, 915, 314, 29918, 459, 29918, 1761, 29961, 29875, 29918, 459, 3816, 29890, 3816, 333, 10351, 29896, 29896, 29961, 29900, 29962, 3816, 333, 10351, 29896, 29896, 29961, 29906, 5262, 13, 13, 18884, 396, 22645, 29896, 29896, 29961, 29900, 29962, 13, 13, 18884, 396, 679, 281, 29894, 29918, 710, 13, 18884, 5694, 29918, 558, 29918, 29893, 29894, 29918, 710, 29892, 903, 353, 3588, 29918, 11965, 29918, 29893, 1403, 29918, 517, 29918, 1807, 4197, 29961, 29893, 1403, 20526, 518, 29876, 6092, 29918, 29873, 29961, 29890, 20526, 518, 29876, 6092, 29918, 11912, 29918, 29873, 29961, 29890, 20526, 518, 698, 29918, 517, 29918, 29873, 29918, 13140, 29961, 29890, 20526, 13, 462, 462, 462, 1669, 518, 29876, 6092, 29961, 29890, 24960, 13, 18884, 19412, 29918, 29893, 29894, 29896, 29896, 353, 10366, 29918, 29893, 29894, 29918, 29873, 29896, 29918, 996, 29898, 7382, 29918, 558, 29918, 29893, 29894, 29918, 710, 29961, 29900, 3816, 29900, 1402, 302, 6092, 29961, 29890, 2314, 13, 18884, 2148, 29879, 29896, 29896, 353, 518, 29875, 29918, 29893, 29883, 29892, 474, 29918, 459, 29892, 19412, 29918, 29893, 29894, 29896, 29896, 29962, 13, 13, 13, 18884, 2070, 29918, 1116, 29879, 29896, 29896, 353, 2070, 29918, 29893, 29961, 29890, 29892, 1178, 10351, 29896, 29896, 29961, 29900, 1402, 1178, 10351, 29896, 29896, 29961, 29896, 1402, 1178, 10351, 29896, 29896, 29961, 29906, 5262, 13, 18884, 282, 29918, 29893, 29883, 29896, 29896, 29918, 3317, 353, 2070, 29918, 29893, 29883, 29918, 700, 572, 29961, 29890, 29892, 1178, 10351, 29896, 29896, 29961, 29900, 1402, 1178, 10351, 29896, 29896, 29961, 29896, 1402, 1178, 10351, 29896, 29896, 29961, 29906, 5262, 13, 18884, 282, 29918, 827, 29896, 29896, 29918, 3317, 353, 2070, 29918, 827, 29918, 700, 572, 29961, 29890, 29892, 1178, 10351, 29896, 29896, 29961, 29900, 1402, 1178, 10351, 29896, 29896, 29961, 29896, 1402, 1178, 10351, 29896, 29896, 29961, 29906, 5262, 13, 18884, 282, 29918, 29893, 1403, 29896, 29896, 29918, 3317, 353, 518, 2070, 29918, 29893, 1403, 29918, 303, 29918, 700, 572, 29961, 29890, 29892, 1178, 10351, 29896, 29896, 29961, 29900, 1402, 1178, 10351, 29896, 29896, 29961, 29896, 1402, 1178, 10351, 29896, 29896, 29961, 29906, 20526, 13, 462, 18884, 2070, 29918, 29893, 1403, 29918, 287, 29918, 700, 572, 29961, 29890, 29892, 1178, 10351, 29896, 29896, 29961, 29900, 1402, 1178, 10351, 29896, 29896, 29961, 29896, 1402, 1178, 10351, 29896, 29896, 29961, 29906, 5262, 4514, 13, 13, 18884, 396, 1243, 8225, 13, 18884, 396, 1596, 29898, 29876, 6092, 29961, 29890, 2314, 13, 18884, 396, 1596, 29898, 22625, 29961, 29890, 22322, 333, 7464, 260, 29890, 29961, 29890, 22322, 8768, 7464, 544, 29918, 1557, 29961, 29890, 1402, 544, 29918, 4977, 29961, 29890, 1402, 518, 1116, 29879, 29896, 29896, 2314, 13, 18884, 544, 29918, 550, 353, 6012, 29889, 7978, 29898, 22625, 29961, 29890, 22322, 333, 7464, 544, 29918, 1557, 29918, 13318, 29961, 29890, 1402, 544, 29918, 4977, 29918, 13318, 29961, 29890, 1402, 518, 1116, 29879, 29896, 29896, 2314, 13, 18884, 565, 6120, 29898, 558, 29918, 550, 1125, 13, 462, 1678, 396, 544, 29918, 550, 338, 451, 4069, 29991, 13, 462, 1678, 2148, 29879, 29918, 3317, 29896, 29889, 4397, 29898, 1116, 29879, 29896, 29896, 29897, 13, 462, 1678, 2070, 29918, 1116, 29879, 29918, 3317, 29896, 29889, 4397, 29898, 22795, 29918, 1116, 29879, 29896, 29896, 29897, 13, 462, 1678, 544, 29918, 29893, 1403, 29896, 29918, 3317, 29889, 4397, 29898, 29893, 1403, 29897, 13, 13, 462, 1678, 282, 29918, 29893, 29883, 29896, 29918, 3317, 29889, 4397, 29898, 29886, 29918, 29893, 29883, 29896, 29896, 29918, 3317, 29897, 13, 462, 1678, 282, 29918, 827, 29896, 29918, 3317, 29889, 4397, 29898, 29886, 29918, 827, 29896, 29896, 29918, 3317, 29897, 13, 462, 1678, 282, 29918, 29893, 1403, 29896, 29918, 3317, 29889, 4397, 29898, 29886, 29918, 29893, 1403, 29896, 29896, 29918, 3317, 29897, 13, 13, 13, 9651, 2148, 29879, 29918, 3317, 29889, 4397, 29898, 1116, 29879, 29918, 3317, 29896, 29897, 13, 9651, 2070, 29918, 1116, 29879, 29918, 3317, 29889, 4397, 29898, 22795, 29918, 1116, 29879, 29918, 3317, 29896, 29897, 13, 9651, 544, 29918, 29893, 1403, 29918, 3317, 29889, 4397, 29898, 558, 29918, 29893, 1403, 29896, 29918, 3317, 29897, 13, 13, 9651, 282, 29918, 29893, 29883, 29918, 3317, 29889, 4397, 29898, 29886, 29918, 29893, 29883, 29896, 29918, 3317, 29897, 13, 9651, 282, 29918, 827, 29918, 3317, 29889, 4397, 29898, 29886, 29918, 827, 29896, 29918, 3317, 29897, 13, 9651, 282, 29918, 29893, 1403, 29918, 3317, 29889, 4397, 29898, 29886, 29918, 29893, 1403, 29896, 29918, 3317, 29897, 13, 13, 9651, 396, 2610, 817, 304, 437, 901, 429, 6905, 579, 573, 2740, 29973, 13, 9651, 396, 474, 29889, 29872, 29889, 701, 304, 636, 2805, 599, 16813, 4251, 29889, 13, 13, 4706, 396, 20535, 403, 3001, 6976, 304, 11097, 278, 1353, 310, 988, 29899, 16398, 6394, 13, 4706, 544, 29918, 2850, 29918, 29875, 353, 5159, 13, 4706, 2070, 29918, 1233, 29918, 29893, 353, 5159, 396, 3001, 988, 29899, 16398, 1509, 6976, 13, 4706, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 353, 5159, 13, 4706, 544, 29918, 29893, 1403, 29918, 13318, 353, 5159, 13, 13, 4706, 282, 29918, 29893, 29883, 353, 5159, 13, 4706, 282, 29918, 827, 353, 5159, 13, 4706, 282, 29918, 29893, 1403, 353, 5159, 13, 13, 4706, 363, 289, 29892, 2070, 29918, 1233, 29896, 297, 26985, 29898, 22795, 29918, 1233, 1125, 13, 9651, 4236, 29918, 4258, 9246, 29918, 1233, 29896, 353, 7431, 29898, 1116, 29879, 29918, 3317, 29961, 29890, 2314, 13, 9651, 2070, 29918, 1233, 29918, 29893, 29896, 353, 5159, 13, 9651, 2070, 29918, 1233, 29918, 29893, 29896, 29889, 4397, 29898, 22795, 29918, 1233, 29896, 29961, 29900, 2314, 29871, 396, 281, 29876, 29922, 29900, 1206, 29889, 13, 9651, 363, 474, 29918, 1233, 297, 3464, 29898, 3317, 29918, 4258, 9246, 29918, 1233, 29896, 1125, 13, 18884, 2070, 29918, 1233, 29918, 29893, 29896, 29896, 353, 2070, 29918, 1233, 29896, 29961, 29875, 29918, 1233, 718, 29871, 29896, 29962, 334, 2070, 29918, 1116, 29879, 29918, 3317, 29961, 29890, 3816, 29875, 29918, 1233, 29962, 13, 18884, 2070, 29918, 1233, 29918, 29893, 29896, 29889, 4397, 29898, 22795, 29918, 1233, 29918, 29893, 29896, 29896, 29897, 13, 9651, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29889, 4397, 29898, 1191, 3317, 29898, 22795, 29918, 1233, 29918, 29893, 29896, 876, 13, 9651, 2070, 29918, 1233, 29918, 29893, 29889, 4397, 29898, 22795, 29918, 1233, 29918, 29893, 29896, 29897, 13, 13, 9651, 544, 29918, 2850, 29918, 29875, 29896, 353, 11117, 16170, 2396, 544, 29918, 4977, 29918, 13318, 29961, 29890, 1402, 525, 2838, 2396, 544, 29918, 1557, 29918, 13318, 29961, 29890, 1402, 525, 1116, 29879, 2396, 2148, 29879, 29918, 3317, 29961, 29890, 3816, 29901, 558, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29961, 29890, 5262, 29913, 13, 9651, 544, 29918, 29893, 1403, 29918, 13318, 29896, 353, 544, 29918, 29893, 1403, 29918, 3317, 29961, 29890, 3816, 29901, 558, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29961, 29890, 5262, 13, 13, 13, 9651, 544, 29918, 2850, 29918, 29875, 29889, 4397, 29898, 558, 29918, 2850, 29918, 29875, 29896, 29897, 13, 9651, 544, 29918, 29893, 1403, 29918, 13318, 29889, 4397, 29898, 558, 29918, 29893, 1403, 29918, 13318, 29896, 29897, 13, 13, 9651, 282, 29918, 29893, 29883, 29889, 4397, 29898, 282, 29918, 29893, 29883, 29918, 3317, 29961, 29890, 3816, 29901, 558, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29961, 29890, 5262, 1723, 13, 9651, 282, 29918, 827, 29889, 4397, 29898, 282, 29918, 827, 29918, 3317, 29961, 29890, 3816, 29901, 558, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29961, 29890, 5262, 1723, 13, 9651, 282, 29918, 29893, 1403, 29889, 4397, 29898, 282, 29918, 29893, 1403, 29918, 3317, 29961, 29890, 3816, 29901, 558, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29961, 29890, 5262, 1723, 13, 13, 13, 13, 13, 4706, 396, 269, 29918, 29893, 29894, 353, 518, 29933, 29892, 302, 29918, 3062, 29918, 1949, 29892, 4236, 29918, 29876, 6092, 29918, 517, 12360, 29892, 29871, 29906, 29962, 13, 13, 4706, 282, 29918, 1233, 353, 1208, 29918, 22795, 29918, 1233, 29898, 29879, 29918, 1233, 29892, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29897, 13, 4706, 282, 29918, 3062, 353, 1208, 29918, 22795, 29918, 3062, 29898, 29886, 29918, 1233, 29892, 282, 29918, 29893, 29883, 29892, 282, 29918, 827, 29892, 282, 29918, 29893, 1403, 29897, 13, 13, 4706, 736, 2070, 29918, 29893, 29892, 2070, 29918, 1233, 29918, 29893, 29892, 544, 29918, 1233, 29918, 6707, 29918, 265, 29918, 22795, 29892, 544, 29918, 2850, 29918, 29875, 29892, 544, 29918, 29893, 1403, 29918, 13318, 29892, 320, 13, 1669, 282, 29918, 3062, 29892, 282, 29918, 1233, 29892, 282, 29918, 29893, 29883, 29892, 282, 29918, 827, 29892, 282, 29918, 29893, 1403, 13, 13, 13, 1753, 365, 2209, 29918, 29879, 29906, 29879, 29898, 13628, 29892, 330, 29918, 29886, 593, 29918, 333, 10351, 1125, 13, 1678, 9995, 13, 1678, 8158, 353, 518, 29933, 29892, 323, 29892, 4236, 29918, 11762, 29918, 2848, 29962, 13, 1678, 9995, 13, 1678, 396, 308, 5754, 1347, 760, 13, 1678, 6410, 353, 29871, 29900, 13, 13, 1678, 363, 289, 29892, 330, 29918, 29886, 593, 29918, 333, 10351, 29896, 297, 26985, 29898, 29887, 29918, 29886, 593, 29918, 333, 10351, 1125, 13, 4706, 1226, 353, 7431, 29898, 29887, 29918, 29886, 593, 29918, 333, 10351, 29896, 29897, 448, 29871, 29896, 13, 4706, 8158, 29918, 1595, 353, 8158, 29961, 29890, 29892, 584, 287, 29962, 13, 4706, 6410, 4619, 383, 29889, 19128, 29918, 296, 14441, 29898, 13628, 29918, 1595, 29892, 4842, 305, 29889, 20158, 29898, 29887, 29918, 29886, 593, 29918, 333, 10351, 29896, 29961, 29896, 29901, 14664, 517, 29898, 10141, 876, 29871, 396, 718, 29896, 9500, 29889, 13, 1678, 736, 6410, 13, 2 ]
tests/test_db.py
schmocker/pv-FHNW
1
159902
import pytest from pvtool.db import PvModule, Measurement, MeasurementValues, FlasherData, ManufacturerData, db @pytest.mark.incremental class TestDBModels(object): def test_pv_module_insert(client, init_db): """ GIVEN a database WHEN database is initialized THEN check if pv_module can be inserted and removed """ test_pv_module = PvModule(model="TEST", manufacturer="TEST", cell_type="TEST", additional_information="TEST", price_CHF="-999", length="-999", width="-999", shunt_resistance="-999", ) db.session.add(test_pv_module) db.session.commit() query_result = db.session.query(PvModule).filter(PvModule.model == test_pv_module.model).first() assert query_result db.session.query(PvModule).filter(PvModule.model == test_pv_module.model).delete() db.session.commit() def test_measurement_insert(client, init_db): """ GIVEN a database WHEN database is initialized THEN check if pv_module can be inserted and removed """ test_measurement = Measurement(date='TEST', measurement_series='TEST', producer='TEST', pv_module_id=1, ) db.session.add(test_measurement) db.session.commit() query_result = db.session.query(Measurement).filter(Measurement.measurement_series == test_measurement.measurement_series).first() assert query_result db.session.query(Measurement).filter(Measurement.measurement_series == test_measurement.measurement_series).delete() db.session.commit() def test_measurement_values_insert(client, init_db): """ GIVEN a database WHEN database is initialized THEN check if measurement_values can be inserted and removed """ test_measurement_values = MeasurementValues(weather='TEST', _U_module=0, _U_shunt=0, _U_T_amb=0, _U_T_pan=0, _U_G_hor=0, _U_G_pan=0, _U_G_ref=0, measurement_id=1, ) db.session.add(test_measurement_values) db.session.commit() query_result = db.session.query(MeasurementValues).\ filter(MeasurementValues.weather == test_measurement_values.weather).first() assert query_result db.session.query(MeasurementValues).filter(MeasurementValues.weather == test_measurement_values.weather).delete() db.session.commit() def insert_multiple_pv_modules(client, init_db): pass
[ 1, 1053, 11451, 1688, 13, 3166, 282, 29894, 10154, 29889, 2585, 1053, 349, 29894, 7355, 29892, 2191, 3745, 358, 29892, 2191, 3745, 358, 9065, 29892, 21967, 261, 1469, 29892, 2315, 9765, 9945, 1469, 29892, 4833, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 25629, 284, 13, 1990, 4321, 4051, 23785, 29898, 3318, 1125, 13, 1678, 822, 1243, 29918, 29886, 29894, 29918, 5453, 29918, 7851, 29898, 4645, 29892, 2069, 29918, 2585, 1125, 13, 4706, 9995, 13, 9651, 402, 5667, 1430, 263, 2566, 13, 9651, 17980, 2566, 338, 16601, 13, 9651, 8183, 1423, 565, 282, 29894, 29918, 5453, 508, 367, 15478, 322, 6206, 13, 4706, 9995, 13, 4706, 1243, 29918, 29886, 29894, 29918, 5453, 353, 349, 29894, 7355, 29898, 4299, 543, 18267, 613, 13, 462, 462, 12012, 9945, 543, 18267, 613, 13, 462, 462, 3038, 29918, 1853, 543, 18267, 613, 13, 462, 462, 5684, 29918, 19678, 543, 18267, 613, 13, 462, 462, 8666, 29918, 3210, 29943, 543, 29899, 29929, 29929, 29929, 613, 13, 462, 462, 3309, 543, 29899, 29929, 29929, 29929, 613, 13, 462, 462, 2920, 543, 29899, 29929, 29929, 29929, 613, 13, 462, 462, 528, 1657, 29918, 690, 21558, 543, 29899, 29929, 29929, 29929, 613, 13, 462, 462, 1723, 13, 4706, 4833, 29889, 7924, 29889, 1202, 29898, 1688, 29918, 29886, 29894, 29918, 5453, 29897, 13, 4706, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 4706, 2346, 29918, 2914, 353, 4833, 29889, 7924, 29889, 1972, 29898, 29925, 29894, 7355, 467, 4572, 29898, 29925, 29894, 7355, 29889, 4299, 1275, 1243, 29918, 29886, 29894, 29918, 5453, 29889, 4299, 467, 4102, 580, 13, 4706, 4974, 2346, 29918, 2914, 13, 4706, 4833, 29889, 7924, 29889, 1972, 29898, 29925, 29894, 7355, 467, 4572, 29898, 29925, 29894, 7355, 29889, 4299, 1275, 1243, 29918, 29886, 29894, 29918, 5453, 29889, 4299, 467, 8143, 580, 13, 4706, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 1678, 822, 1243, 29918, 26658, 358, 29918, 7851, 29898, 4645, 29892, 2069, 29918, 2585, 1125, 13, 4706, 9995, 13, 9651, 402, 5667, 1430, 263, 2566, 13, 9651, 17980, 2566, 338, 16601, 13, 9651, 8183, 1423, 565, 282, 29894, 29918, 5453, 508, 367, 15478, 322, 6206, 13, 4706, 9995, 13, 4706, 1243, 29918, 26658, 358, 353, 2191, 3745, 358, 29898, 1256, 2433, 18267, 742, 13, 462, 462, 539, 20039, 29918, 13757, 2433, 18267, 742, 13, 462, 462, 539, 14297, 2433, 18267, 742, 13, 462, 462, 539, 282, 29894, 29918, 5453, 29918, 333, 29922, 29896, 29892, 13, 462, 462, 4706, 1723, 13, 13, 4706, 4833, 29889, 7924, 29889, 1202, 29898, 1688, 29918, 26658, 358, 29897, 13, 4706, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 4706, 2346, 29918, 2914, 353, 4833, 29889, 7924, 29889, 1972, 29898, 6816, 3745, 358, 467, 4572, 29898, 6816, 3745, 358, 29889, 26658, 358, 29918, 13757, 1275, 1243, 29918, 26658, 358, 29889, 26658, 358, 29918, 13757, 467, 4102, 580, 13, 4706, 4974, 2346, 29918, 2914, 13, 4706, 4833, 29889, 7924, 29889, 1972, 29898, 6816, 3745, 358, 467, 4572, 29898, 6816, 3745, 358, 29889, 26658, 358, 29918, 13757, 1275, 1243, 29918, 26658, 358, 29889, 26658, 358, 29918, 13757, 467, 8143, 580, 13, 4706, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 1678, 822, 1243, 29918, 26658, 358, 29918, 5975, 29918, 7851, 29898, 4645, 29892, 2069, 29918, 2585, 1125, 13, 4706, 9995, 13, 9651, 402, 5667, 1430, 263, 2566, 13, 9651, 17980, 2566, 338, 16601, 13, 9651, 8183, 1423, 565, 20039, 29918, 5975, 508, 367, 15478, 322, 6206, 13, 4706, 9995, 13, 4706, 1243, 29918, 26658, 358, 29918, 5975, 353, 2191, 3745, 358, 9065, 29898, 705, 1624, 2433, 18267, 742, 13, 462, 462, 462, 1678, 903, 29965, 29918, 5453, 29922, 29900, 29892, 13, 462, 462, 462, 1678, 903, 29965, 29918, 845, 1657, 29922, 29900, 29892, 13, 462, 462, 462, 1678, 903, 29965, 29918, 29911, 29918, 1117, 29922, 29900, 29892, 13, 462, 462, 462, 1678, 903, 29965, 29918, 29911, 29918, 8357, 29922, 29900, 29892, 13, 462, 462, 462, 1678, 903, 29965, 29918, 29954, 29918, 2015, 29922, 29900, 29892, 13, 462, 462, 462, 1678, 903, 29965, 29918, 29954, 29918, 8357, 29922, 29900, 29892, 13, 462, 462, 462, 1678, 903, 29965, 29918, 29954, 29918, 999, 29922, 29900, 29892, 13, 462, 462, 462, 1678, 20039, 29918, 333, 29922, 29896, 29892, 13, 462, 462, 462, 1678, 1723, 13, 13, 4706, 4833, 29889, 7924, 29889, 1202, 29898, 1688, 29918, 26658, 358, 29918, 5975, 29897, 13, 4706, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 4706, 2346, 29918, 2914, 353, 4833, 29889, 7924, 29889, 1972, 29898, 6816, 3745, 358, 9065, 467, 29905, 13, 9651, 4175, 29898, 6816, 3745, 358, 9065, 29889, 705, 1624, 1275, 1243, 29918, 26658, 358, 29918, 5975, 29889, 705, 1624, 467, 4102, 580, 13, 4706, 4974, 2346, 29918, 2914, 13, 4706, 4833, 29889, 7924, 29889, 1972, 29898, 6816, 3745, 358, 9065, 467, 4572, 29898, 6816, 3745, 358, 9065, 29889, 705, 1624, 1275, 1243, 29918, 26658, 358, 29918, 5975, 29889, 705, 1624, 467, 8143, 580, 13, 4706, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 13, 1753, 4635, 29918, 20787, 29918, 29886, 29894, 29918, 7576, 29898, 4645, 29892, 2069, 29918, 2585, 1125, 13, 1678, 1209, 13, 2 ]
autobahn/wamp/gen/wamp/proto/PublisherFeatures.py
rapyuta-robotics/autobahn-python
1,670
94563
# automatically generated by the FlatBuffers compiler, do not modify # namespace: proto import flatbuffers class PublisherFeatures(object): __slots__ = ['_tab'] @classmethod def GetRootAsPublisherFeatures(cls, buf, offset): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = PublisherFeatures() x.Init(buf, n + offset) return x # PublisherFeatures def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) # PublisherFeatures def PublisherIdentification(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False # PublisherFeatures def PublisherExclusion(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False # PublisherFeatures def SubscriberBlackwhiteListing(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False # PublisherFeatures def AcknowledgeEventReceived(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) if o != 0: return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False # PublisherFeatures def PayloadTransparency(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12)) if o != 0: return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False # PublisherFeatures def PayloadEncryptionCryptobox(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) if o != 0: return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False def PublisherFeaturesStart(builder): builder.StartObject(6) def PublisherFeaturesAddPublisherIdentification(builder, publisherIdentification): builder.PrependBoolSlot(0, publisherIdentification, 0) def PublisherFeaturesAddPublisherExclusion(builder, publisherExclusion): builder.PrependBoolSlot(1, publisherExclusion, 0) def PublisherFeaturesAddSubscriberBlackwhiteListing(builder, subscriberBlackwhiteListing): builder.PrependBoolSlot(2, subscriberBlackwhiteListing, 0) def PublisherFeaturesAddAcknowledgeEventReceived(builder, acknowledgeEventReceived): builder.PrependBoolSlot(3, acknowledgeEventReceived, 0) def PublisherFeaturesAddPayloadTransparency(builder, payloadTransparency): builder.PrependBoolSlot(4, payloadTransparency, 0) def PublisherFeaturesAddPayloadEncryptionCryptobox(builder, payloadEncryptionCryptobox): builder.PrependBoolSlot(5, payloadEncryptionCryptobox, 0) def PublisherFeaturesEnd(builder): return builder.EndObject()
[ 1, 396, 6336, 5759, 491, 278, 2379, 271, 29933, 3096, 414, 6516, 29892, 437, 451, 6623, 13, 13, 29937, 7397, 29901, 17814, 13, 13, 5215, 12151, 28040, 414, 13, 13, 1990, 12904, 261, 8263, 3698, 29898, 3318, 1125, 13, 1678, 4770, 2536, 1862, 1649, 353, 6024, 29918, 3891, 2033, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 3617, 10303, 2887, 21076, 1674, 261, 8263, 3698, 29898, 25932, 29892, 18392, 29892, 9210, 1125, 13, 4706, 302, 353, 12151, 28040, 414, 29889, 12508, 29889, 2577, 29898, 20620, 28040, 414, 29889, 4058, 261, 29889, 29884, 10289, 29892, 18392, 29892, 9210, 29897, 13, 4706, 921, 353, 12904, 261, 8263, 3698, 580, 13, 4706, 921, 29889, 6644, 29898, 9721, 29892, 302, 718, 9210, 29897, 13, 4706, 736, 921, 13, 13, 1678, 396, 12904, 261, 8263, 3698, 13, 1678, 822, 10886, 29898, 1311, 29892, 18392, 29892, 926, 1125, 13, 4706, 1583, 3032, 3891, 353, 12151, 28040, 414, 29889, 2371, 29889, 3562, 29898, 9721, 29892, 926, 29897, 13, 13, 1678, 396, 12904, 261, 8263, 3698, 13, 1678, 822, 12904, 261, 7648, 2450, 29898, 1311, 1125, 13, 4706, 288, 353, 12151, 28040, 414, 29889, 4537, 29918, 8768, 29889, 29965, 10302, 29911, 15675, 29889, 2272, 29918, 1853, 29898, 1311, 3032, 3891, 29889, 10302, 29898, 29946, 876, 13, 4706, 565, 288, 2804, 29871, 29900, 29901, 13, 9651, 736, 6120, 29898, 1311, 3032, 3891, 29889, 2577, 29898, 20620, 28040, 414, 29889, 4537, 29918, 8768, 29889, 24693, 15675, 29892, 288, 718, 1583, 3032, 3891, 29889, 9135, 876, 13, 4706, 736, 7700, 13, 13, 1678, 396, 12904, 261, 8263, 3698, 13, 1678, 822, 12904, 261, 1252, 10085, 29898, 1311, 1125, 13, 4706, 288, 353, 12151, 28040, 414, 29889, 4537, 29918, 8768, 29889, 29965, 10302, 29911, 15675, 29889, 2272, 29918, 1853, 29898, 1311, 3032, 3891, 29889, 10302, 29898, 29953, 876, 13, 4706, 565, 288, 2804, 29871, 29900, 29901, 13, 9651, 736, 6120, 29898, 1311, 3032, 3891, 29889, 2577, 29898, 20620, 28040, 414, 29889, 4537, 29918, 8768, 29889, 24693, 15675, 29892, 288, 718, 1583, 3032, 3891, 29889, 9135, 876, 13, 4706, 736, 7700, 13, 13, 1678, 396, 12904, 261, 8263, 3698, 13, 1678, 822, 3323, 7588, 495, 18700, 10921, 1293, 292, 29898, 1311, 1125, 13, 4706, 288, 353, 12151, 28040, 414, 29889, 4537, 29918, 8768, 29889, 29965, 10302, 29911, 15675, 29889, 2272, 29918, 1853, 29898, 1311, 3032, 3891, 29889, 10302, 29898, 29947, 876, 13, 4706, 565, 288, 2804, 29871, 29900, 29901, 13, 9651, 736, 6120, 29898, 1311, 3032, 3891, 29889, 2577, 29898, 20620, 28040, 414, 29889, 4537, 29918, 8768, 29889, 24693, 15675, 29892, 288, 718, 1583, 3032, 3891, 29889, 9135, 876, 13, 4706, 736, 7700, 13, 13, 1678, 396, 12904, 261, 8263, 3698, 13, 1678, 822, 319, 15415, 5485, 2624, 29816, 29898, 1311, 1125, 13, 4706, 288, 353, 12151, 28040, 414, 29889, 4537, 29918, 8768, 29889, 29965, 10302, 29911, 15675, 29889, 2272, 29918, 1853, 29898, 1311, 3032, 3891, 29889, 10302, 29898, 29896, 29900, 876, 13, 4706, 565, 288, 2804, 29871, 29900, 29901, 13, 9651, 736, 6120, 29898, 1311, 3032, 3891, 29889, 2577, 29898, 20620, 28040, 414, 29889, 4537, 29918, 8768, 29889, 24693, 15675, 29892, 288, 718, 1583, 3032, 3891, 29889, 9135, 876, 13, 4706, 736, 7700, 13, 13, 1678, 396, 12904, 261, 8263, 3698, 13, 1678, 822, 14617, 1359, 4300, 862, 3819, 29898, 1311, 1125, 13, 4706, 288, 353, 12151, 28040, 414, 29889, 4537, 29918, 8768, 29889, 29965, 10302, 29911, 15675, 29889, 2272, 29918, 1853, 29898, 1311, 3032, 3891, 29889, 10302, 29898, 29896, 29906, 876, 13, 4706, 565, 288, 2804, 29871, 29900, 29901, 13, 9651, 736, 6120, 29898, 1311, 3032, 3891, 29889, 2577, 29898, 20620, 28040, 414, 29889, 4537, 29918, 8768, 29889, 24693, 15675, 29892, 288, 718, 1583, 3032, 3891, 29889, 9135, 876, 13, 4706, 736, 7700, 13, 13, 1678, 396, 12904, 261, 8263, 3698, 13, 1678, 822, 14617, 1359, 8566, 14272, 29907, 4641, 23518, 29898, 1311, 1125, 13, 4706, 288, 353, 12151, 28040, 414, 29889, 4537, 29918, 8768, 29889, 29965, 10302, 29911, 15675, 29889, 2272, 29918, 1853, 29898, 1311, 3032, 3891, 29889, 10302, 29898, 29896, 29946, 876, 13, 4706, 565, 288, 2804, 29871, 29900, 29901, 13, 9651, 736, 6120, 29898, 1311, 3032, 3891, 29889, 2577, 29898, 20620, 28040, 414, 29889, 4537, 29918, 8768, 29889, 24693, 15675, 29892, 288, 718, 1583, 3032, 3891, 29889, 9135, 876, 13, 4706, 736, 7700, 13, 13, 1753, 12904, 261, 8263, 3698, 4763, 29898, 16409, 1125, 12856, 29889, 4763, 2061, 29898, 29953, 29897, 13, 1753, 12904, 261, 8263, 3698, 2528, 21076, 1674, 261, 7648, 2450, 29898, 16409, 29892, 9805, 261, 7648, 2450, 1125, 12856, 29889, 29925, 3445, 355, 24693, 29903, 8276, 29898, 29900, 29892, 9805, 261, 7648, 2450, 29892, 29871, 29900, 29897, 13, 1753, 12904, 261, 8263, 3698, 2528, 21076, 1674, 261, 1252, 10085, 29898, 16409, 29892, 9805, 261, 1252, 10085, 1125, 12856, 29889, 29925, 3445, 355, 24693, 29903, 8276, 29898, 29896, 29892, 9805, 261, 1252, 10085, 29892, 29871, 29900, 29897, 13, 1753, 12904, 261, 8263, 3698, 2528, 4035, 7588, 495, 18700, 10921, 1293, 292, 29898, 16409, 29892, 21696, 495, 18700, 10921, 1293, 292, 1125, 12856, 29889, 29925, 3445, 355, 24693, 29903, 8276, 29898, 29906, 29892, 21696, 495, 18700, 10921, 1293, 292, 29892, 29871, 29900, 29897, 13, 1753, 12904, 261, 8263, 3698, 2528, 29909, 15415, 5485, 2624, 29816, 29898, 16409, 29892, 18145, 5485, 2624, 29816, 1125, 12856, 29889, 29925, 3445, 355, 24693, 29903, 8276, 29898, 29941, 29892, 18145, 5485, 2624, 29816, 29892, 29871, 29900, 29897, 13, 1753, 12904, 261, 8263, 3698, 2528, 15467, 1359, 4300, 862, 3819, 29898, 16409, 29892, 20092, 4300, 862, 3819, 1125, 12856, 29889, 29925, 3445, 355, 24693, 29903, 8276, 29898, 29946, 29892, 20092, 4300, 862, 3819, 29892, 29871, 29900, 29897, 13, 1753, 12904, 261, 8263, 3698, 2528, 15467, 1359, 8566, 14272, 29907, 4641, 23518, 29898, 16409, 29892, 20092, 8566, 14272, 29907, 4641, 23518, 1125, 12856, 29889, 29925, 3445, 355, 24693, 29903, 8276, 29898, 29945, 29892, 20092, 8566, 14272, 29907, 4641, 23518, 29892, 29871, 29900, 29897, 13, 1753, 12904, 261, 8263, 3698, 5044, 29898, 16409, 1125, 736, 12856, 29889, 5044, 2061, 580, 13, 2 ]
setup.py
initOS/dob-lib
0
78135
import os from setuptools import find_packages, setup def read(fname): with open(os.path.join(os.path.dirname(__file__), fname)) as f: return f.read() deps = [ "black", "coverage", "debugpy", "flake8", "git-aggregator", "ipython", "isort>=4.3.10", "pylint_odoo", "pytest-cov", "PyYAML", ] if not os.getenv("DISABLE_PYTEST_ODOO"): deps.append("pytest-odoo") setup( name="doblib", version="0.8.3", author="<EMAIL>", author_email="<EMAIL>", description="Management tool for Odoo installations", long_description=read("README.md"), long_description_content_type="text/markdown", license="Apache License 2.0", keywords="odoo environment management", url="https://github.com/initos/dob-lib", packages=find_packages("src"), package_dir={"": "src"}, include_package_data=True, install_requires=deps, entry_points={"console_scripts": ["dob = doblib.main:main"]}, classifiers=[ "Environment :: Console", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", ], python_requires=">=3.6", )
[ 1, 1053, 2897, 13, 13, 3166, 731, 21245, 8789, 1053, 1284, 29918, 8318, 29892, 6230, 13, 13, 13, 1753, 1303, 29898, 29888, 978, 1125, 13, 1678, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 511, 285, 978, 876, 408, 285, 29901, 13, 4706, 736, 285, 29889, 949, 580, 13, 13, 13, 311, 567, 353, 518, 13, 1678, 376, 8517, 613, 13, 1678, 376, 11911, 482, 613, 13, 1678, 376, 8382, 2272, 613, 13, 1678, 376, 29888, 433, 446, 29947, 613, 13, 1678, 376, 5559, 29899, 26193, 1061, 613, 13, 1678, 376, 666, 1656, 613, 13, 1678, 376, 275, 441, 18572, 29946, 29889, 29941, 29889, 29896, 29900, 613, 13, 1678, 376, 2272, 27854, 29918, 397, 3634, 613, 13, 1678, 376, 2272, 1688, 29899, 24542, 613, 13, 1678, 376, 19737, 29979, 23956, 613, 13, 29962, 13, 13, 361, 451, 2897, 29889, 657, 6272, 703, 23711, 6181, 29918, 20055, 18267, 29918, 29949, 3970, 29949, 29908, 1125, 13, 1678, 316, 567, 29889, 4397, 703, 2272, 1688, 29899, 397, 3634, 1159, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 11152, 1982, 613, 13, 1678, 1873, 543, 29900, 29889, 29947, 29889, 29941, 613, 13, 1678, 4148, 543, 29966, 26862, 6227, 28341, 13, 1678, 4148, 29918, 5269, 543, 29966, 26862, 6227, 28341, 13, 1678, 6139, 543, 27107, 5780, 363, 438, 1867, 29877, 2601, 800, 613, 13, 1678, 1472, 29918, 8216, 29922, 949, 703, 16310, 2303, 29889, 3487, 4968, 13, 1678, 1472, 29918, 8216, 29918, 3051, 29918, 1853, 543, 726, 29914, 3502, 3204, 613, 13, 1678, 19405, 543, 17396, 1829, 19245, 29871, 29906, 29889, 29900, 613, 13, 1678, 29361, 543, 397, 3634, 5177, 10643, 613, 13, 1678, 3142, 543, 991, 597, 3292, 29889, 510, 29914, 2344, 359, 29914, 11152, 29899, 1982, 613, 13, 1678, 9741, 29922, 2886, 29918, 8318, 703, 4351, 4968, 13, 1678, 3577, 29918, 3972, 3790, 29908, 1115, 376, 4351, 10758, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 311, 567, 29892, 13, 1678, 6251, 29918, 9748, 3790, 29908, 11058, 29918, 16713, 1115, 6796, 11152, 353, 20129, 1982, 29889, 3396, 29901, 3396, 3108, 1118, 13, 1678, 770, 14903, 11759, 13, 4706, 376, 18649, 4761, 9405, 613, 13, 4706, 376, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 13380, 18540, 19245, 613, 13, 4706, 376, 7094, 1218, 2184, 4761, 6570, 25266, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 613, 13, 1678, 21251, 13, 1678, 3017, 29918, 276, 339, 2658, 543, 18572, 29941, 29889, 29953, 613, 13, 29897, 13, 2 ]
yummyPie.py
BoomBanger/EatPie
0
1610018
import time time.sleep(5) import datetime import os import git import pyglet from pyglet.window import Platform dir = os.path.dirname(os.path.realpath(__file__)) repo = git.cmd.Git(dir) t = -1 lastpull = 0 with open(os.path.join(dir, "dinnerTime.txt"), "r") as f: timestr = f.read() #####################################################04/02/22 04:03 t = time.mktime(datetime.datetime.strptime(timestr, "%m/%d/%y %H:%M:%S").timetuple()) #t += 5*3600 #only for replit, thinks we are in london def pull(): global time, dir, repo try: repo.pull() with open(os.path.join(dir, "dinnerTime.txt"), "r") as f: timestr = f.read() #####################################################04/02/22 04:03 t = time.mktime(datetime.datetime.strptime(timestr, "%d/%m/%y %H:%M:%S").timetuple()) #t += 5*3600 #only for replit, thinks we are in london except: pass while time.time() < t: print("waiting") if time.time() - lastpull > 4*60*60: pull() lastpull = time.time() if time.time() < t + 10*60*60: monitor = Platform().get_default_display().get_default_screen() sprite = pyglet.sprite.Sprite(pyglet.resource.animation(os.path.join(dir, "text.gif"))) H_ratio = max(sprite.height, monitor.height) / min(sprite.height, monitor.height) W_ratio = max(sprite.width, monitor.width) / min(sprite.width, monitor.width) sprite.scale = min(H_ratio, W_ratio) window = pyglet.window.Window(width=monitor.width, height=monitor.height, fullscreen=True) pyglet.gl.glClearColor(1, 1, 1, 1) @window.event def on_draw(): window.clear() sprite.draw() pyglet.app.run()
[ 1, 1053, 931, 13, 2230, 29889, 17059, 29898, 29945, 29897, 13, 13, 5215, 12865, 13, 5215, 2897, 13, 5215, 6315, 13, 5215, 19484, 1026, 13, 3166, 19484, 1026, 29889, 7165, 1053, 28096, 13, 13, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 876, 13, 13, 20095, 353, 6315, 29889, 9006, 29889, 28712, 29898, 3972, 29897, 13, 13, 29873, 353, 448, 29896, 13, 4230, 26746, 353, 29871, 29900, 13, 13, 2541, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 3972, 29892, 376, 29881, 3993, 2481, 29889, 3945, 4968, 376, 29878, 1159, 408, 285, 29901, 13, 1678, 5335, 16444, 353, 285, 29889, 949, 580, 13, 1678, 835, 13383, 13383, 13383, 2277, 29900, 29946, 29914, 29900, 29906, 29914, 29906, 29906, 29871, 29900, 29946, 29901, 29900, 29941, 13, 1678, 260, 353, 931, 29889, 29885, 1193, 603, 29898, 12673, 29889, 12673, 29889, 710, 415, 603, 29898, 9346, 16444, 29892, 11860, 29885, 22584, 29881, 22584, 29891, 1273, 29950, 16664, 29924, 16664, 29903, 2564, 9346, 24120, 552, 3101, 13, 1678, 396, 29873, 4619, 29871, 29945, 29930, 29941, 29953, 29900, 29900, 396, 6194, 363, 337, 2830, 29892, 22405, 591, 526, 297, 301, 898, 265, 13, 13, 1753, 8206, 7295, 13, 1678, 5534, 931, 29892, 4516, 29892, 13761, 13, 1678, 1018, 29901, 13, 4706, 13761, 29889, 26746, 580, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 3972, 29892, 376, 29881, 3993, 2481, 29889, 3945, 4968, 376, 29878, 1159, 408, 285, 29901, 13, 9651, 5335, 16444, 353, 285, 29889, 949, 580, 13, 9651, 835, 13383, 13383, 13383, 2277, 29900, 29946, 29914, 29900, 29906, 29914, 29906, 29906, 29871, 29900, 29946, 29901, 29900, 29941, 13, 9651, 260, 353, 931, 29889, 29885, 1193, 603, 29898, 12673, 29889, 12673, 29889, 710, 415, 603, 29898, 9346, 16444, 29892, 11860, 29881, 22584, 29885, 22584, 29891, 1273, 29950, 16664, 29924, 16664, 29903, 2564, 9346, 24120, 552, 3101, 13, 9651, 396, 29873, 4619, 29871, 29945, 29930, 29941, 29953, 29900, 29900, 396, 6194, 363, 337, 2830, 29892, 22405, 591, 526, 297, 301, 898, 265, 13, 1678, 5174, 29901, 13, 539, 1209, 13, 259, 13, 8000, 931, 29889, 2230, 580, 529, 260, 29901, 13, 1678, 1596, 703, 10685, 292, 1159, 13, 1678, 565, 931, 29889, 2230, 580, 448, 1833, 26746, 1405, 29871, 29946, 29930, 29953, 29900, 29930, 29953, 29900, 29901, 13, 4706, 8206, 580, 13, 4706, 1833, 26746, 353, 931, 29889, 2230, 580, 13, 13, 361, 931, 29889, 2230, 580, 529, 260, 718, 29871, 29896, 29900, 29930, 29953, 29900, 29930, 29953, 29900, 29901, 13, 1678, 11819, 353, 28096, 2141, 657, 29918, 4381, 29918, 4990, 2141, 657, 29918, 4381, 29918, 10525, 580, 13, 13, 1678, 29227, 353, 19484, 1026, 29889, 15099, 568, 29889, 29903, 558, 568, 29898, 2272, 29887, 1026, 29889, 10314, 29889, 18962, 29898, 359, 29889, 2084, 29889, 7122, 29898, 3972, 29892, 376, 726, 29889, 18660, 29908, 4961, 13, 1678, 379, 29918, 3605, 601, 353, 4236, 29898, 15099, 568, 29889, 3545, 29892, 11819, 29889, 3545, 29897, 847, 1375, 29898, 15099, 568, 29889, 3545, 29892, 11819, 29889, 3545, 29897, 13, 1678, 399, 29918, 3605, 601, 353, 4236, 29898, 15099, 568, 29889, 2103, 29892, 11819, 29889, 2103, 29897, 847, 1375, 29898, 15099, 568, 29889, 2103, 29892, 11819, 29889, 2103, 29897, 13, 13, 1678, 29227, 29889, 7052, 353, 1375, 29898, 29950, 29918, 3605, 601, 29892, 399, 29918, 3605, 601, 29897, 13, 13, 1678, 3474, 353, 19484, 1026, 29889, 7165, 29889, 5907, 29898, 2103, 29922, 3712, 2105, 29889, 2103, 29892, 3171, 29922, 3712, 2105, 29889, 3545, 29892, 2989, 10525, 29922, 5574, 29897, 13, 13, 1678, 19484, 1026, 29889, 3820, 29889, 3820, 18759, 3306, 29898, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29897, 13, 13, 1678, 732, 7165, 29889, 3696, 13, 1678, 822, 373, 29918, 4012, 7295, 13, 4706, 3474, 29889, 8551, 580, 13, 4706, 29227, 29889, 4012, 580, 13, 13, 1678, 19484, 1026, 29889, 932, 29889, 3389, 580, 13, 2 ]
tests/ut/python/dataset/test_datasets_obs_mindrecord.py
httpsgithu/mindspore
1
183851
# Copyright 2022 Huawei Technologies Co., Ltd # # 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. # ============================================================================== """ Test OBSMindDataset operator """ import pytest from mindspore.dataset.engine.datasets_standard_format import OBSMindDataset from mindspore import log as logger DATA_DIR = ["s3://dataset/imagenet0", "s3://dataset/imagenet1"] def test_obs_mindrecord_exception(): """ Feature: Test OBSMindDataset. Description: invalid input. Expectation: raise exception. """ logger.info("Test error cases for MnistDataset") error_msg_0 = "Argument dataset_files" with pytest.raises(TypeError, match=error_msg_0): OBSMindDataset("err_dataset", "https://dummy_site", "dummy_ak", "dummy_sk", "s3://dummy_sync_dir") error_msg_0_1 = "Item of dataset files" with pytest.raises(TypeError, match=error_msg_0_1): OBSMindDataset([1, 2], "https://dummy_site", "dummy_ak", "dummy_sk", "s3://dummy_sync_dir") error_msg_1 = "Argument server" with pytest.raises(TypeError, match=error_msg_1): OBSMindDataset(DATA_DIR, 12, "dummy_ak", "dummy_sk", "s3://dummy_sync_dir") error_msg_1_1 = "server should" with pytest.raises(ValueError, match=error_msg_1_1): OBSMindDataset(DATA_DIR, "ftp://dummy_site", "dummy_ak", "dummy_sk", "s3://dummy_sync_dir") error_msg_2 = "Argument ak" with pytest.raises(TypeError, match=error_msg_2): OBSMindDataset(DATA_DIR, "https://dummy_site", 12, "dummy_sk", "s3://dummy_sync_dir") error_msg_3 = "Argument sk" with pytest.raises(TypeError, match=error_msg_3): OBSMindDataset(DATA_DIR, "https://dummy_site", "dummy_ak", 12, "s3://dummy_sync_dir") error_msg_4 = "Argument sync_obs_path" with pytest.raises(TypeError, match=error_msg_4): OBSMindDataset(DATA_DIR, "https://dummy_site", "dummy_ak", "dummy_sk", 12) error_msg_5 = "Input shard_id is not within the required interval" with pytest.raises(ValueError, match=error_msg_5): OBSMindDataset(DATA_DIR, "https://dummy_site", "dummy_ak", "dummy_sk", "s3://dummy_sync_dir", num_shards=2, shard_id=-1) with pytest.raises(ValueError, match=error_msg_5): OBSMindDataset(DATA_DIR, "https://dummy_site", "dummy_ak", "dummy_sk", "s3://dummy_sync_dir", num_shards=4, shard_id=4) with pytest.raises(ValueError, match=error_msg_5): OBSMindDataset(DATA_DIR, "https://dummy_site", "dummy_ak", "dummy_sk", "s3://dummy_sync_dir", num_shards=2, shard_id=4) error_msg_7 = "Argument shard_equal_rows" with pytest.raises(TypeError, match=error_msg_7): OBSMindDataset(DATA_DIR, "https://dummy_site", "dummy_ak", "dummy_sk", "s3://dummy_sync_dir", shard_equal_rows=1) if __name__ == '__main__': test_obs_mindrecord_exception()
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29906, 29906, 379, 3357, 26599, 8364, 11763, 3189, 1696, 19806, 30004, 13, 29937, 30004, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 18584, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 22993, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 30004, 13, 29937, 30004, 13, 29937, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 30004, 13, 29937, 30004, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 30004, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 11167, 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, 22993, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 30004, 13, 29937, 27028, 1090, 278, 19245, 22993, 13, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 30004, 13, 15945, 19451, 13, 3057, 438, 9851, 29924, 513, 16390, 24541, 5455, 30004, 13, 15945, 19451, 13, 5215, 11451, 1688, 30004, 13, 30004, 13, 3166, 3458, 1028, 487, 29889, 24713, 29889, 10599, 29889, 14538, 1691, 29918, 15770, 29918, 4830, 1053, 438, 9851, 29924, 513, 16390, 24541, 30004, 13, 3166, 3458, 1028, 487, 1053, 1480, 408, 17927, 30004, 13, 30004, 13, 14573, 29918, 9464, 353, 6796, 29879, 29941, 597, 24713, 29914, 326, 5370, 300, 29900, 613, 376, 29879, 29941, 597, 24713, 29914, 326, 5370, 300, 29896, 3108, 30004, 13, 30004, 13, 30004, 13, 1753, 1243, 29918, 26290, 29918, 24021, 11651, 29918, 11739, 7295, 30004, 13, 1678, 9995, 30004, 13, 1678, 5169, 1535, 29901, 4321, 438, 9851, 29924, 513, 16390, 24541, 22993, 13, 1678, 12953, 29901, 8340, 1881, 22993, 13, 1678, 1222, 1103, 362, 29901, 12020, 3682, 22993, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 17927, 29889, 3888, 703, 3057, 1059, 4251, 363, 341, 29876, 391, 16390, 24541, 1159, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29900, 353, 376, 15730, 8783, 29918, 5325, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1542, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29900, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 703, 3127, 29918, 24713, 613, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 613, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 1159, 30004, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29900, 29918, 29896, 353, 376, 2001, 310, 8783, 2066, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1542, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29900, 29918, 29896, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 4197, 29896, 29892, 29871, 29906, 1402, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 613, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 1159, 30004, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29896, 353, 376, 15730, 1923, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1542, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29896, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 29871, 29896, 29906, 29892, 376, 29881, 11770, 29918, 557, 613, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 1159, 30004, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29896, 29918, 29896, 353, 376, 2974, 881, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29896, 29918, 29896, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 23102, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 613, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 1159, 30004, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29906, 353, 376, 15730, 11208, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1542, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29906, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 29871, 29896, 29906, 29892, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 1159, 30004, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29941, 353, 376, 15730, 2071, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1542, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29941, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 613, 29871, 29896, 29906, 29892, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 1159, 30004, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29946, 353, 376, 15730, 16523, 29918, 26290, 29918, 2084, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1542, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29946, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 613, 376, 29881, 11770, 29918, 808, 613, 29871, 29896, 29906, 8443, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29945, 353, 376, 4290, 528, 538, 29918, 333, 338, 451, 2629, 278, 3734, 7292, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29945, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 15231, 13, 462, 539, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 613, 954, 29918, 845, 3163, 29922, 29906, 29892, 528, 538, 29918, 333, 10457, 29896, 8443, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29945, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 15231, 13, 462, 539, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 613, 954, 29918, 845, 3163, 29922, 29946, 29892, 528, 538, 29918, 333, 29922, 29946, 8443, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1917, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29945, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 15231, 13, 462, 539, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 613, 954, 29918, 845, 3163, 29922, 29906, 29892, 528, 538, 29918, 333, 29922, 29946, 8443, 13, 30004, 13, 1678, 1059, 29918, 7645, 29918, 29955, 353, 376, 15730, 528, 538, 29918, 11745, 29918, 5727, 19451, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 1542, 2392, 29892, 1993, 29922, 2704, 29918, 7645, 29918, 29955, 1125, 30004, 13, 4706, 438, 9851, 29924, 513, 16390, 24541, 29898, 14573, 29918, 9464, 29892, 376, 991, 597, 29881, 11770, 29918, 2746, 613, 376, 29881, 11770, 29918, 557, 15231, 13, 462, 539, 376, 29881, 11770, 29918, 808, 613, 376, 29879, 29941, 597, 29881, 11770, 29918, 16593, 29918, 3972, 613, 528, 538, 29918, 11745, 29918, 5727, 29922, 29896, 8443, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 1678, 1243, 29918, 26290, 29918, 24021, 11651, 29918, 11739, 26471, 13, 2 ]
importanize/groups.py
xiachufang/importanize
0
13649
# -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import itertools import operator from collections import OrderedDict, defaultdict from functools import reduce import six from .formatters import DEFAULT_FORMATTER, DEFAULT_LENGTH from .utils import is_site_package, is_std_lib @six.python_2_unicode_compatible class BaseImportGroup(object): def __init__(self, config=None, **kwargs): self.config = config or {} self.statements = kwargs.get("statements", []) self.file_artifacts = kwargs.get("file_artifacts", {}) @property def unique_statements(self): return sorted(list(set(self.merged_statements))) @property def merged_statements(self): """ Merge statements with the same import stems """ leafless_counter = defaultdict(list) counter = defaultdict(list) for statement in self.statements: if statement.leafs: counter[statement.stem].append(statement) else: leafless_counter[statement.stem].append(statement) merged_statements = list(itertools.chain(*leafless_counter.values())) def merge(statements): _special = [] _statements = [] for i in statements: if i.leafs and i.leafs[0].name == "*": _special.append(i) else: _statements.append(i) _reduced = [] if _statements: _reduced = [reduce(lambda a, b: a + b, _statements)] return _special + _reduced for statements in counter.values(): merged_statements.extend(merge(statements)) return merged_statements def all_line_numbers(self): return sorted( list( set( list( itertools.chain( *map( operator.attrgetter("line_numbers"), self.statements, ) ) ) ) ) ) def should_add_statement(self, statement): raise NotImplementedError def add_statement(self, statement): if self.should_add_statement(statement): self.statements.append(statement) return True return False def as_string(self): sep = self.file_artifacts.get("sep", "\n") return sep.join( map(operator.methodcaller("as_string"), self.unique_statements) ) def formatted(self, formatter=DEFAULT_FORMATTER, length=DEFAULT_LENGTH): sep = self.file_artifacts.get("sep", "\n") return sep.join( map( operator.methodcaller( "formatted", formatter=formatter, length=length ), self.unique_statements, ) ) def __str__(self): return self.as_string() class StdLibGroup(BaseImportGroup): def should_add_statement(self, statement): return is_std_lib(statement.root_module) class SitePackagesGroup(BaseImportGroup): def should_add_statement(self, statement): return is_site_package(statement.root_module) class PackagesGroup(BaseImportGroup): def __init__(self, *args, **kwargs): super(PackagesGroup, self).__init__(*args, **kwargs) if "packages" not in self.config: msg = ( '"package" config must be supplied ' "for packages import group" ) raise ValueError(msg) def should_add_statement(self, statement): return statement.root_module in self.config.get("packages", []) class LocalGroup(BaseImportGroup): def should_add_statement(self, statement): return statement.stem.startswith(".") class RemainderGroup(BaseImportGroup): def should_add_statement(self, statement): return True # -- RemainderGroup goes last and catches everything left over GROUP_MAPPING = OrderedDict( ( ("stdlib", StdLibGroup), ("sitepackages", SitePackagesGroup), ("packages", PackagesGroup), ("local", LocalGroup), ("remainder", RemainderGroup), ) ) def sort_groups(groups): return sorted( groups, key=lambda i: list(GROUP_MAPPING.values()).index(type(i)) ) @six.python_2_unicode_compatible class ImportGroups(list): def __init__(self, *args, **kwargs): super(ImportGroups, self).__init__(*args) self.file_artifacts = kwargs.get("file_artifacts", {}) def all_line_numbers(self): return sorted( list( set( list( itertools.chain( *map( operator.methodcaller("all_line_numbers"), self ) ) ) ) ) ) def add_group(self, config): if "type" not in config: msg = '"type" must be specified in ' "import group config" raise ValueError(msg) if config["type"] not in GROUP_MAPPING: msg = '"{}" is not supported import group'.format(config["type"]) raise ValueError(msg) self.append(GROUP_MAPPING[config["type"]](config)) def add_statement_to_group(self, statement): groups_by_priority = sort_groups(self) added = False for group in groups_by_priority: if group.add_statement(statement): added = True break if not added: msg = ( "Import statement was not added into " "any of the import groups. " "Perhaps you can consider adding " '"remaining" import group which will ' "catch all remaining import statements." ) raise ValueError(msg) def as_string(self): sep = self.file_artifacts.get("sep", "\n") * 2 return sep.join( filter(None, map(operator.methodcaller("as_string"), self)) ) def formatted(self, formatter=DEFAULT_FORMATTER, length=DEFAULT_LENGTH): sep = self.file_artifacts.get("sep", "\n") * 2 return sep.join( filter( None, map( operator.methodcaller( "formatted", formatter=formatter, length=length ), self, ), ) ) def __str__(self): return self.as_string()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 1596, 29918, 2220, 29892, 29104, 29918, 20889, 1338, 13, 5215, 4256, 8504, 13, 5215, 5455, 13, 3166, 16250, 1053, 8170, 287, 21533, 29892, 2322, 8977, 13, 3166, 2090, 312, 8789, 1053, 10032, 13, 13, 5215, 4832, 13, 13, 3166, 869, 4830, 2153, 1053, 22236, 29918, 19094, 1299, 4945, 29892, 22236, 29918, 19433, 13, 3166, 869, 13239, 1053, 338, 29918, 2746, 29918, 5113, 29892, 338, 29918, 4172, 29918, 1982, 13, 13, 13, 29992, 28319, 29889, 4691, 29918, 29906, 29918, 2523, 356, 29918, 23712, 13, 1990, 7399, 17518, 4782, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 2917, 353, 2295, 470, 6571, 13, 13, 4706, 1583, 29889, 6112, 4110, 353, 9049, 5085, 29889, 657, 703, 6112, 4110, 613, 518, 2314, 13, 4706, 1583, 29889, 1445, 29918, 8813, 29879, 353, 9049, 5085, 29889, 657, 703, 1445, 29918, 8813, 29879, 613, 426, 1800, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5412, 29918, 6112, 4110, 29898, 1311, 1125, 13, 4706, 736, 12705, 29898, 1761, 29898, 842, 29898, 1311, 29889, 1050, 3192, 29918, 6112, 4110, 4961, 13, 13, 1678, 732, 6799, 13, 1678, 822, 19412, 29918, 6112, 4110, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4702, 479, 9506, 411, 278, 1021, 1053, 380, 1567, 13, 4706, 9995, 13, 4706, 454, 29874, 1579, 404, 29918, 11808, 353, 2322, 8977, 29898, 1761, 29897, 13, 4706, 6795, 353, 2322, 8977, 29898, 1761, 29897, 13, 4706, 363, 3229, 297, 1583, 29889, 6112, 4110, 29901, 13, 9651, 565, 3229, 29889, 29500, 29879, 29901, 13, 18884, 6795, 29961, 20788, 29889, 303, 331, 1822, 4397, 29898, 20788, 29897, 13, 9651, 1683, 29901, 13, 18884, 454, 29874, 1579, 404, 29918, 11808, 29961, 20788, 29889, 303, 331, 1822, 4397, 29898, 20788, 29897, 13, 13, 4706, 19412, 29918, 6112, 4110, 353, 1051, 29898, 1524, 8504, 29889, 14153, 10456, 20774, 1579, 404, 29918, 11808, 29889, 5975, 22130, 13, 13, 4706, 822, 10366, 29898, 6112, 4110, 1125, 13, 9651, 903, 18732, 353, 5159, 13, 9651, 903, 6112, 4110, 353, 5159, 13, 13, 9651, 363, 474, 297, 9506, 29901, 13, 18884, 565, 474, 29889, 29500, 29879, 322, 474, 29889, 29500, 29879, 29961, 29900, 1822, 978, 1275, 26345, 1115, 13, 462, 1678, 903, 18732, 29889, 4397, 29898, 29875, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 903, 6112, 4110, 29889, 4397, 29898, 29875, 29897, 13, 13, 9651, 903, 9313, 1133, 353, 5159, 13, 9651, 565, 903, 6112, 4110, 29901, 13, 18884, 903, 9313, 1133, 353, 518, 17469, 29898, 2892, 263, 29892, 289, 29901, 263, 718, 289, 29892, 903, 6112, 4110, 4638, 13, 13, 9651, 736, 903, 18732, 718, 903, 9313, 1133, 13, 13, 4706, 363, 9506, 297, 6795, 29889, 5975, 7295, 13, 9651, 19412, 29918, 6112, 4110, 29889, 21843, 29898, 14634, 29898, 6112, 4110, 876, 13, 13, 4706, 736, 19412, 29918, 6112, 4110, 13, 13, 1678, 822, 599, 29918, 1220, 29918, 20326, 29898, 1311, 1125, 13, 4706, 736, 12705, 29898, 13, 9651, 1051, 29898, 13, 18884, 731, 29898, 13, 462, 1678, 1051, 29898, 13, 462, 4706, 4256, 8504, 29889, 14153, 29898, 13, 462, 9651, 334, 1958, 29898, 13, 462, 18884, 5455, 29889, 5552, 657, 357, 703, 1220, 29918, 20326, 4968, 13, 462, 18884, 1583, 29889, 6112, 4110, 29892, 13, 462, 9651, 1723, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 1678, 822, 881, 29918, 1202, 29918, 20788, 29898, 1311, 29892, 3229, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 788, 29918, 20788, 29898, 1311, 29892, 3229, 1125, 13, 4706, 565, 1583, 29889, 9344, 29918, 1202, 29918, 20788, 29898, 20788, 1125, 13, 9651, 1583, 29889, 6112, 4110, 29889, 4397, 29898, 20788, 29897, 13, 9651, 736, 5852, 13, 4706, 736, 7700, 13, 13, 1678, 822, 408, 29918, 1807, 29898, 1311, 1125, 13, 4706, 16345, 353, 1583, 29889, 1445, 29918, 8813, 29879, 29889, 657, 703, 19570, 613, 6634, 29876, 1159, 13, 4706, 736, 16345, 29889, 7122, 29898, 13, 9651, 2910, 29898, 6891, 29889, 5696, 4804, 261, 703, 294, 29918, 1807, 4968, 1583, 29889, 13092, 29918, 6112, 4110, 29897, 13, 4706, 1723, 13, 13, 1678, 822, 20917, 29898, 1311, 29892, 883, 2620, 29922, 23397, 29918, 19094, 1299, 4945, 29892, 3309, 29922, 23397, 29918, 19433, 1125, 13, 4706, 16345, 353, 1583, 29889, 1445, 29918, 8813, 29879, 29889, 657, 703, 19570, 613, 6634, 29876, 1159, 13, 4706, 736, 16345, 29889, 7122, 29898, 13, 9651, 2910, 29898, 13, 18884, 5455, 29889, 5696, 4804, 261, 29898, 13, 462, 1678, 376, 689, 19667, 613, 883, 2620, 29922, 689, 2620, 29892, 3309, 29922, 2848, 13, 18884, 10353, 13, 18884, 1583, 29889, 13092, 29918, 6112, 4110, 29892, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 294, 29918, 1807, 580, 13, 13, 13, 1990, 624, 29881, 14868, 4782, 29898, 5160, 17518, 4782, 1125, 13, 1678, 822, 881, 29918, 1202, 29918, 20788, 29898, 1311, 29892, 3229, 1125, 13, 4706, 736, 338, 29918, 4172, 29918, 1982, 29898, 20788, 29889, 4632, 29918, 5453, 29897, 13, 13, 13, 1990, 10781, 16638, 1179, 4782, 29898, 5160, 17518, 4782, 1125, 13, 1678, 822, 881, 29918, 1202, 29918, 20788, 29898, 1311, 29892, 3229, 1125, 13, 4706, 736, 338, 29918, 2746, 29918, 5113, 29898, 20788, 29889, 4632, 29918, 5453, 29897, 13, 13, 13, 1990, 18744, 1179, 4782, 29898, 5160, 17518, 4782, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 16638, 1179, 4782, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 4706, 565, 376, 8318, 29908, 451, 297, 1583, 29889, 2917, 29901, 13, 9651, 10191, 353, 313, 13, 18884, 18793, 5113, 29908, 2295, 1818, 367, 19056, 525, 376, 1454, 9741, 1053, 2318, 29908, 13, 9651, 1723, 13, 9651, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 1678, 822, 881, 29918, 1202, 29918, 20788, 29898, 1311, 29892, 3229, 1125, 13, 4706, 736, 3229, 29889, 4632, 29918, 5453, 297, 1583, 29889, 2917, 29889, 657, 703, 8318, 613, 518, 2314, 13, 13, 13, 1990, 9959, 4782, 29898, 5160, 17518, 4782, 1125, 13, 1678, 822, 881, 29918, 1202, 29918, 20788, 29898, 1311, 29892, 3229, 1125, 13, 4706, 736, 3229, 29889, 303, 331, 29889, 27382, 2541, 17350, 1159, 13, 13, 13, 1990, 5240, 475, 672, 4782, 29898, 5160, 17518, 4782, 1125, 13, 1678, 822, 881, 29918, 1202, 29918, 20788, 29898, 1311, 29892, 3229, 1125, 13, 4706, 736, 5852, 13, 13, 13, 29937, 1192, 5240, 475, 672, 4782, 5771, 1833, 322, 4380, 267, 4129, 2175, 975, 13, 26284, 29918, 1529, 18009, 4214, 353, 8170, 287, 21533, 29898, 13, 1678, 313, 13, 4706, 4852, 4172, 1982, 613, 624, 29881, 14868, 4782, 511, 13, 4706, 4852, 2746, 8318, 613, 10781, 16638, 1179, 4782, 511, 13, 4706, 4852, 8318, 613, 18744, 1179, 4782, 511, 13, 4706, 4852, 2997, 613, 9959, 4782, 511, 13, 4706, 4852, 1745, 475, 672, 613, 5240, 475, 672, 4782, 511, 13, 1678, 1723, 13, 29897, 13, 13, 13, 1753, 2656, 29918, 13155, 29898, 13155, 1125, 13, 1678, 736, 12705, 29898, 13, 4706, 6471, 29892, 1820, 29922, 2892, 474, 29901, 1051, 29898, 26284, 29918, 1529, 18009, 4214, 29889, 5975, 16655, 2248, 29898, 1853, 29898, 29875, 876, 13, 1678, 1723, 13, 13, 13, 29992, 28319, 29889, 4691, 29918, 29906, 29918, 2523, 356, 29918, 23712, 13, 1990, 16032, 24020, 29898, 1761, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 17518, 24020, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29897, 13, 4706, 1583, 29889, 1445, 29918, 8813, 29879, 353, 9049, 5085, 29889, 657, 703, 1445, 29918, 8813, 29879, 613, 426, 1800, 13, 13, 1678, 822, 599, 29918, 1220, 29918, 20326, 29898, 1311, 1125, 13, 4706, 736, 12705, 29898, 13, 9651, 1051, 29898, 13, 18884, 731, 29898, 13, 462, 1678, 1051, 29898, 13, 462, 4706, 4256, 8504, 29889, 14153, 29898, 13, 462, 9651, 334, 1958, 29898, 13, 462, 18884, 5455, 29889, 5696, 4804, 261, 703, 497, 29918, 1220, 29918, 20326, 4968, 1583, 13, 462, 9651, 1723, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 1678, 822, 788, 29918, 2972, 29898, 1311, 29892, 2295, 1125, 13, 4706, 565, 376, 1853, 29908, 451, 297, 2295, 29901, 13, 9651, 10191, 353, 18793, 1853, 29908, 1818, 367, 6790, 297, 525, 376, 5215, 2318, 2295, 29908, 13, 9651, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 4706, 565, 2295, 3366, 1853, 3108, 451, 297, 15345, 29918, 1529, 18009, 4214, 29901, 13, 9651, 10191, 353, 18793, 29912, 5038, 338, 451, 6969, 1053, 2318, 4286, 4830, 29898, 2917, 3366, 1853, 20068, 13, 9651, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 4706, 1583, 29889, 4397, 29898, 26284, 29918, 1529, 18009, 4214, 29961, 2917, 3366, 1853, 3108, 850, 2917, 876, 13, 13, 1678, 822, 788, 29918, 20788, 29918, 517, 29918, 2972, 29898, 1311, 29892, 3229, 1125, 13, 4706, 6471, 29918, 1609, 29918, 29886, 21766, 353, 2656, 29918, 13155, 29898, 1311, 29897, 13, 13, 4706, 2715, 353, 7700, 13, 13, 4706, 363, 2318, 297, 6471, 29918, 1609, 29918, 29886, 21766, 29901, 13, 9651, 565, 2318, 29889, 1202, 29918, 20788, 29898, 20788, 1125, 13, 18884, 2715, 353, 5852, 13, 18884, 2867, 13, 13, 4706, 565, 451, 2715, 29901, 13, 9651, 10191, 353, 313, 13, 18884, 376, 17518, 3229, 471, 451, 2715, 964, 376, 13, 18884, 376, 1384, 310, 278, 1053, 6471, 29889, 376, 13, 18884, 376, 5894, 4252, 366, 508, 2050, 4417, 376, 13, 18884, 18793, 1745, 17225, 29908, 1053, 2318, 607, 674, 525, 13, 18884, 376, 12510, 599, 9886, 1053, 9506, 1213, 13, 9651, 1723, 13, 9651, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 1678, 822, 408, 29918, 1807, 29898, 1311, 1125, 13, 4706, 16345, 353, 1583, 29889, 1445, 29918, 8813, 29879, 29889, 657, 703, 19570, 613, 6634, 29876, 1159, 334, 29871, 29906, 13, 4706, 736, 16345, 29889, 7122, 29898, 13, 9651, 4175, 29898, 8516, 29892, 2910, 29898, 6891, 29889, 5696, 4804, 261, 703, 294, 29918, 1807, 4968, 1583, 876, 13, 4706, 1723, 13, 13, 1678, 822, 20917, 29898, 1311, 29892, 883, 2620, 29922, 23397, 29918, 19094, 1299, 4945, 29892, 3309, 29922, 23397, 29918, 19433, 1125, 13, 4706, 16345, 353, 1583, 29889, 1445, 29918, 8813, 29879, 29889, 657, 703, 19570, 613, 6634, 29876, 1159, 334, 29871, 29906, 13, 4706, 736, 16345, 29889, 7122, 29898, 13, 9651, 4175, 29898, 13, 18884, 6213, 29892, 13, 18884, 2910, 29898, 13, 462, 1678, 5455, 29889, 5696, 4804, 261, 29898, 13, 462, 4706, 376, 689, 19667, 613, 883, 2620, 29922, 689, 2620, 29892, 3309, 29922, 2848, 13, 462, 1678, 10353, 13, 462, 1678, 1583, 29892, 13, 18884, 10353, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 294, 29918, 1807, 580, 13, 2 ]
src/download_dataset.py
thomasreolon/DeepfakeDetection
2
181910
<gh_stars>1-10 import os, pathlib from gdrive import GoogleDriveDownloader as gdd from videoanalizer import VideoAnalizer os.chdir(pathlib.Path(__file__).parent.absolute()) #GDRIVE_CODE = '1La_4SVYRNT8ePgLzZGwlxuY1V9x989DC' # old dataset GDRIVE_CODE = '1djFwp9vLkmOtd65ylXSYYn7C1ju08lJ7' ######## Create Directory & Download Videos if ('test_data' not in os.listdir('../')): # if folder is empty, get videos from gdrive print("Default dataset size: 6GB") gdd.download_file_from_google_drive(file_id=GDRIVE_CODE, # my GDrive dest_path='../dataset.zip', unzip=True, showsize=True) os.system('rm ../dataset.zip') ######## This will fail and ask you to install OpenFace # press y to install OpenFace VideoAnalizer()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 29892, 2224, 1982, 13, 3166, 330, 21594, 1053, 5087, 29928, 4401, 6767, 12657, 408, 330, 1289, 13, 3166, 4863, 7054, 3950, 1053, 13987, 21067, 3950, 13, 13, 359, 29889, 305, 3972, 29898, 2084, 1982, 29889, 2605, 22168, 1445, 1649, 467, 3560, 29889, 23552, 3101, 13, 13, 29937, 29954, 29928, 3960, 12064, 29918, 16524, 353, 525, 29896, 5661, 29918, 29946, 7597, 29979, 29934, 20321, 29947, 29872, 29925, 29887, 29931, 29920, 29999, 29954, 29893, 29880, 29916, 29884, 29979, 29896, 29963, 29929, 29916, 29929, 29947, 29929, 12696, 29915, 29871, 396, 2030, 8783, 13, 29954, 29928, 3960, 12064, 29918, 16524, 353, 525, 29896, 19776, 29943, 11912, 29929, 29894, 29931, 8848, 29949, 1594, 29953, 29945, 2904, 29990, 14816, 29979, 29876, 29955, 29907, 29896, 4900, 29900, 29947, 29880, 29967, 29955, 29915, 13, 13, 7346, 6204, 18862, 669, 25553, 11812, 13, 13, 361, 6702, 1688, 29918, 1272, 29915, 451, 297, 2897, 29889, 1761, 3972, 877, 6995, 8785, 29901, 13, 1678, 396, 565, 4138, 338, 4069, 29892, 679, 19707, 515, 330, 21594, 13, 1678, 1596, 703, 4592, 8783, 2159, 29901, 29871, 29953, 7210, 1159, 13, 1678, 330, 1289, 29889, 10382, 29918, 1445, 29918, 3166, 29918, 3608, 29918, 21594, 29898, 1445, 29918, 333, 29922, 29954, 29928, 3960, 12064, 29918, 16524, 29892, 1678, 396, 590, 402, 29928, 4401, 13, 462, 462, 4706, 2731, 29918, 2084, 2433, 6995, 24713, 29889, 7554, 742, 13, 462, 462, 4706, 443, 7554, 29922, 5574, 29892, 13, 462, 462, 4706, 3697, 675, 29922, 5574, 29897, 13, 1678, 2897, 29889, 5205, 877, 1758, 29772, 24713, 29889, 7554, 1495, 13, 13, 13, 13, 7346, 910, 674, 4418, 322, 2244, 366, 304, 2601, 4673, 23360, 13, 13, 29937, 3965, 343, 304, 2601, 4673, 23360, 13, 15167, 21067, 3950, 580, 13, 2 ]
luxai2021/game/resource.py
nofate090/LuxPythonEnvGym
0
143923
'''Implements /src/Resource/index.ts''' class Resource: ''' Enum implemenation ''' class Types: WOOD = 'wood' COAL = 'coal' URANIUM = 'uranium' def __init__(self, type, amount) -> None: self.type = type self.amount = amount
[ 1, 29871, 13, 12008, 1888, 9711, 847, 4351, 29914, 6848, 29914, 2248, 29889, 1372, 12008, 13, 13, 1990, 18981, 29901, 13, 1678, 14550, 1174, 398, 527, 552, 1527, 362, 14550, 13, 1678, 770, 28025, 29901, 13, 4706, 399, 29949, 13668, 353, 525, 6115, 29915, 13, 4706, 4810, 1964, 353, 525, 1111, 284, 29915, 13, 4706, 501, 29934, 2190, 29902, 5005, 353, 525, 332, 273, 1974, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1134, 29892, 5253, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 1853, 353, 1134, 13, 4706, 1583, 29889, 14506, 353, 5253, 13, 2 ]
gocrawl/request.py
stephanebruckert/GoCrawl
0
152916
#!/usr/bin/python import requests from pyquery import PyQuery def stringified_page(url): ''' Request a webpage ''' r = requests.get(url) if r.status_code == 200: return str(PyQuery(r.text)) else: raise Exception(r.status_code)
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 13, 5215, 7274, 13, 3166, 11451, 1972, 1053, 10772, 3010, 13, 13, 13, 1753, 1347, 2164, 29918, 3488, 29898, 2271, 1125, 13, 1678, 14550, 13, 1678, 10729, 263, 24499, 13, 1678, 14550, 13, 1678, 364, 353, 7274, 29889, 657, 29898, 2271, 29897, 13, 13, 1678, 565, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29901, 13, 4706, 736, 851, 29898, 19737, 3010, 29898, 29878, 29889, 726, 876, 13, 1678, 1683, 29901, 13, 4706, 12020, 8960, 29898, 29878, 29889, 4882, 29918, 401, 29897, 13, 2 ]
cfanalytics/tests/test_affiliatelist.py
raybellwaves/cfanalytics
23
125641
<filename>cfanalytics/tests/test_affiliatelist.py import pytest import requests # HTTP library from . import TestCase class TestAffiliatelist(TestCase): def setUp(self): self.basepath = 'https://map.crossfit.com' self.headers = {'Host': 'map.crossfit.com', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2'+\ ') AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.13'+\ '2 Safari/537.36'} def test_get_lat_lons(self): expected = 40.3604 response = requests.get(self.basepath+'/getAllAffiliates.php').json() actual = response[0][0] assert expected == actual
[ 1, 529, 9507, 29958, 6854, 7054, 22026, 29914, 21150, 29914, 1688, 29918, 3470, 2638, 14830, 391, 29889, 2272, 13, 5215, 11451, 1688, 13, 5215, 7274, 396, 7331, 3489, 13, 13, 3166, 869, 1053, 4321, 8259, 13, 13, 13, 1990, 4321, 27867, 2638, 14830, 391, 29898, 3057, 8259, 1125, 268, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3188, 2084, 353, 525, 991, 597, 1958, 29889, 19128, 9202, 29889, 510, 29915, 13, 4706, 1583, 29889, 13662, 353, 11117, 8514, 2396, 525, 1958, 29889, 19128, 9202, 29889, 510, 742, 13, 1669, 525, 2659, 29899, 19661, 2396, 525, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 15735, 524, 10578, 29936, 18555, 4326, 6570, 1060, 29871, 29896, 29900, 29918, 29896, 29941, 29918, 29906, 29915, 3124, 13, 1669, 25710, 12113, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10228, 29914, 29953, 29941, 29889, 29900, 29889, 29941, 29906, 29941, 29929, 29889, 29896, 29941, 29915, 3124, 13, 1669, 525, 29906, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 10827, 13, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 5066, 29918, 29880, 787, 29898, 1311, 1125, 13, 4706, 3806, 353, 29871, 29946, 29900, 29889, 29941, 29953, 29900, 29946, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 1311, 29889, 3188, 2084, 23097, 29914, 657, 3596, 27867, 2638, 1078, 29889, 1961, 2824, 3126, 580, 13, 4706, 3935, 353, 2933, 29961, 29900, 3816, 29900, 29962, 13, 4706, 4974, 3806, 1275, 3935, 2 ]
server/ball_speed_placement.py
Rohansjamadagni/topspin-tracker
2
103678
import sys import cv2 import math import os import json import pandas as pd import numpy as np import json stroke_data = { "data" : [] } stroke_data_ = open('result.json', 'r') stroke_data = json.loads(stroke_data_.read()) print(stroke_data['data']) stroke_data_.close() speed_for_each_stroke = {} def read_coordinates(): f = open("coordinates.txt", 'r') data_ = f.read() data = data_.strip() str_table_coordinates = data.split(' ') table_coordinates = [] for i in str_table_coordinates: table_coordinates.append(list(map(int, (i.split(','))))) return table_coordinates def find_net(table_coordinates): """ Finding net coordinates, taking avg of x1 and x4 (mid points of table) """ top_x = table_coordinates[1][0] bottom_x = table_coordinates[4][0] avg = int((top_x+bottom_x)/2) return avg def get_coordinate_of_net_cross(x_coords, midpoint_x=270): print(list(x_coords), midpoint_x) for pos, x_coordinate in enumerate(list(x_coords)): if x_coordinate >= midpoint_x: return pos # 1 2 3 4 5 6 7 8 9 9 10 def euclidian_distance(x1, y1, x2, y2): distance = math.sqrt(((x1 - x2)**2) + ((y1 - y2)**2)) return distance def get_speed(buffer=3, fps = 20): speed_for_each_stroke = {} table_coordinates = read_coordinates() midpoint_x = find_net(table_coordinates) coordinates_df = pd.read_csv('final_result.csv') stroke_number = coordinates_df['stroke_number'] x_coords = coordinates_df['x'] y_coords = coordinates_df['y'] x_coords = list(x_coords) y_coords = list(y_coords) strokes_x_y = [] prev_stroke_number = list(stroke_number)[0] stroke = [] # separate strokes into array for i in coordinates_df.iterrows(): # print(i[1]['stroke_number']) if prev_stroke_number != i[1]['stroke_number']: prev_stroke_number = i[1]['stroke_number'] strokes_x_y.append(np.asarray(stroke)) stroke = [] stroke.append([i[1]['x'], i[1]['y']]) strokes_x_y.append(np.asarray(stroke)) # import sys # sys.exit(1) left_midpoint_coordinate = [ ((table_coordinates[0][0] + table_coordinates[5][0]) / 2), ((table_coordinates[0][1] + table_coordinates[5][1]) / 2)] right_midpoint_coordinate = [ ((table_coordinates[2][0] + table_coordinates[3][0]) / 2), ((table_coordinates[2][1] + table_coordinates[3][1]) / 2)] strokes_x_y = np.asarray(strokes_x_y) table_distance = euclidian_distance( left_midpoint_coordinate[0], left_midpoint_coordinate[1], right_midpoint_coordinate[0], right_midpoint_coordinate[1]) # print(stroke) import sys print(len(strokes_x_y)) for pos, stroke in enumerate(strokes_x_y): print('ffs', pos) x_coords = stroke[:, 0] y_coords = stroke[:, 1] speed_list = [] position_of_net_cross = get_coordinate_of_net_cross(x_coords, midpoint_x) distances = [] print(position_of_net_cross, 'pos', midpoint_x) # sys.exit(1) print(len(x_coords), len(y_coords)) try: for point in range(position_of_net_cross-buffer, position_of_net_cross+buffer+1): speed_list.append([x_coords[point], y_coords[point]]) except: pass for i in range(len(speed_list)-1): distances.append(euclidian_distance( speed_list[i][0], speed_list[i][1], speed_list[i+1][0], speed_list[i+1][1] )) speed = sum(distances) / (1 / fps * ((len(distances)+1))) speed = (speed * 2.74) / table_distance # find speed for each stroke speed *= 18 / 5 speed_for_each_stroke[pos+1] = speed return speed_for_each_stroke def get_zone(ball_coordinates, no_columns=6, no_rows=3): tt_table = np.zeros((3, 6), np.int32) table_map = { "03" : 1, "04" : 2, "05" : 3, "13" : 4, "14" : 5, "15" : 6, "23" : 7, "24" : 8, "25" : 9 } col_seg = 1920 / no_columns row_seg = 1080 / no_rows bounce_col = 0 bounce_row = 0 for i in range(1, no_columns+1): if ball_coordinates[0] < col_seg * i: bounce_col = i break for i in range(1, no_rows+1): if ball_coordinates[1] < row_seg * i: bounce_row = i break # tt_table[bounce_row-1][bounce_col-1] += 1 valid_check = str(bounce_row) + str(bounce_col) if valid_check in table_map: return str(table_map[valid_check]) else: print('wrong coords') return str(3) def warp_coordinates(x, y, matrix): print('warping') print(x, y, 'pints') p = (x, y) px = (matrix[0][0] * p[0] + matrix[0][1] * p[1] + matrix[0][2]) / \ ((matrix[2][0] * p[0] + matrix[2][1] * p[1] + matrix[2][2])) py = (matrix[1][0] * p[0] + matrix[1][1] * p[1] + matrix[1][2]) / \ ((matrix[2][0] * p[0] + matrix[2][1] * p[1] + matrix[2][2])) print(px, py, ' warped pints') return [int(px), int(py)] def get_transposed_coordinates(x, y): table_coordinates = read_coordinates() table_coordinates_corners = np.array([ table_coordinates[0], table_coordinates[2], table_coordinates[3], table_coordinates[5] ], np.float32) print(table_coordinates, 'table coords') warped_dimensions = np.array([[0, 0], [1920, 0], [0, 1080], [1920, 1080]], np.float32) matrix = cv2.getPerspectiveTransform(table_coordinates_corners, warped_dimensions) x, y = warp_coordinates(x, y, matrix) position = get_zone([x,y]) return position def caluclate_speed_and_placements(): global stroke_data # do speed tomorrow result = pd.read_csv('final_result.csv') left_bounces = result.groupby("stroke_number").first().reset_index() right_bounces = result.groupby("stroke_number").last().reset_index() speed_for_each_stroke = get_speed() print(speed_for_each_stroke, 'speed', len(left_bounces)) bc = 0 for bounces in zip(left_bounces.iterrows(), right_bounces.iterrows()): print(bc, 'bc') left, right = bounces[0][1], bounces[1][1] print(left['x'], right['x'], 'lr') data_ = { "stroke_name" : stroke_data['data'][bc]['stroke_name'], "stroke_number" : left['stroke_number'], "position" : get_transposed_coordinates(right['x'], right['y']), "speed" : speed_for_each_stroke[left['stroke_number']] } stroke_data['data'][bc] = data_ # if bc == 3: # break bc += 1 file_ = open('stroke_speed_result.json', 'w') json.dump(stroke_data, file_) if __name__ == "__main__": caluclate_speed_and_placements()
[ 1, 1053, 10876, 13, 5215, 13850, 29906, 13, 5215, 5844, 13, 5215, 2897, 13, 5215, 4390, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 5215, 4390, 13, 13, 25893, 29918, 1272, 353, 426, 13, 1678, 376, 1272, 29908, 584, 5159, 13, 29913, 13, 13, 25893, 29918, 1272, 29918, 353, 1722, 877, 2914, 29889, 3126, 742, 525, 29878, 1495, 13, 25893, 29918, 1272, 353, 4390, 29889, 18132, 29898, 25893, 29918, 1272, 5396, 949, 3101, 13, 2158, 29898, 25893, 29918, 1272, 1839, 1272, 11287, 13, 25893, 29918, 1272, 5396, 5358, 580, 13, 13, 19322, 29918, 1454, 29918, 4204, 29918, 25893, 353, 6571, 13, 13, 13, 1753, 1303, 29918, 1111, 24266, 7295, 13, 1678, 285, 353, 1722, 703, 1111, 24266, 29889, 3945, 613, 525, 29878, 1495, 13, 1678, 848, 29918, 353, 285, 29889, 949, 580, 13, 1678, 848, 353, 848, 5396, 17010, 580, 13, 1678, 851, 29918, 2371, 29918, 1111, 24266, 353, 848, 29889, 5451, 877, 25710, 13, 1678, 1591, 29918, 1111, 24266, 353, 5159, 13, 1678, 363, 474, 297, 851, 29918, 2371, 29918, 1111, 24266, 29901, 13, 4706, 1591, 29918, 1111, 24266, 29889, 4397, 29898, 1761, 29898, 1958, 29898, 524, 29892, 313, 29875, 29889, 5451, 29898, 3788, 876, 4961, 13, 1678, 736, 1591, 29918, 1111, 24266, 13, 268, 13, 268, 13, 1753, 1284, 29918, 1212, 29898, 2371, 29918, 1111, 24266, 1125, 13, 1678, 9995, 13, 1678, 383, 4015, 7787, 10350, 29892, 5622, 1029, 29887, 310, 921, 29896, 322, 921, 29946, 313, 6563, 3291, 310, 1591, 29897, 13, 1678, 9995, 13, 1678, 2246, 29918, 29916, 353, 1591, 29918, 1111, 24266, 29961, 29896, 3816, 29900, 29962, 13, 1678, 5970, 29918, 29916, 353, 1591, 29918, 1111, 24266, 29961, 29946, 3816, 29900, 29962, 13, 1678, 1029, 29887, 353, 938, 3552, 3332, 29918, 29916, 29974, 8968, 29918, 29916, 6802, 29906, 29897, 13, 13, 1678, 736, 1029, 29887, 13, 13, 13, 1753, 679, 29918, 29302, 29918, 974, 29918, 1212, 29918, 19128, 29898, 29916, 29918, 1111, 4339, 29892, 7145, 3149, 29918, 29916, 29922, 29906, 29955, 29900, 1125, 13, 1678, 1596, 29898, 1761, 29898, 29916, 29918, 1111, 4339, 511, 7145, 3149, 29918, 29916, 29897, 13, 1678, 363, 926, 29892, 921, 29918, 29302, 297, 26985, 29898, 1761, 29898, 29916, 29918, 1111, 4339, 22164, 13, 4706, 565, 921, 29918, 29302, 6736, 7145, 3149, 29918, 29916, 29901, 13, 9651, 736, 926, 13, 268, 13, 1678, 396, 29871, 29896, 29871, 29906, 29871, 29941, 29871, 29946, 29871, 29945, 29871, 29953, 29871, 29955, 29871, 29947, 29871, 29929, 29871, 29929, 29871, 29896, 29900, 13, 13, 13, 1753, 11878, 695, 333, 713, 29918, 19244, 29898, 29916, 29896, 29892, 343, 29896, 29892, 921, 29906, 29892, 343, 29906, 1125, 13, 1678, 5418, 353, 5844, 29889, 3676, 3552, 29898, 29916, 29896, 448, 921, 29906, 29897, 1068, 29906, 29897, 718, 5135, 29891, 29896, 448, 343, 29906, 29897, 1068, 29906, 876, 13, 1678, 736, 5418, 13, 13, 13, 1753, 679, 29918, 19322, 29898, 9040, 29922, 29941, 29892, 285, 567, 353, 29871, 29906, 29900, 1125, 13, 1678, 6210, 29918, 1454, 29918, 4204, 29918, 25893, 353, 6571, 13, 1678, 1591, 29918, 1111, 24266, 353, 1303, 29918, 1111, 24266, 580, 13, 1678, 7145, 3149, 29918, 29916, 353, 1284, 29918, 1212, 29898, 2371, 29918, 1111, 24266, 29897, 13, 1678, 10350, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 877, 8394, 29918, 2914, 29889, 7638, 1495, 13, 1678, 19782, 29918, 4537, 353, 10350, 29918, 2176, 1839, 25893, 29918, 4537, 2033, 13, 1678, 921, 29918, 1111, 4339, 353, 10350, 29918, 2176, 1839, 29916, 2033, 13, 1678, 343, 29918, 1111, 4339, 353, 10350, 29918, 2176, 1839, 29891, 2033, 13, 1678, 921, 29918, 1111, 4339, 353, 1051, 29898, 29916, 29918, 1111, 4339, 29897, 13, 1678, 343, 29918, 1111, 4339, 353, 1051, 29898, 29891, 29918, 1111, 4339, 29897, 13, 13, 1678, 23351, 10794, 29918, 29916, 29918, 29891, 353, 5159, 13, 1678, 12379, 29918, 25893, 29918, 4537, 353, 1051, 29898, 25893, 29918, 4537, 9601, 29900, 29962, 13, 1678, 19782, 353, 5159, 13, 1678, 396, 5004, 23351, 10794, 964, 1409, 13, 1678, 363, 474, 297, 10350, 29918, 2176, 29889, 1524, 5727, 7295, 13, 4706, 396, 1596, 29898, 29875, 29961, 29896, 22322, 25893, 29918, 4537, 11287, 13, 4706, 565, 12379, 29918, 25893, 29918, 4537, 2804, 474, 29961, 29896, 22322, 25893, 29918, 4537, 2033, 29901, 13, 9651, 12379, 29918, 25893, 29918, 4537, 353, 474, 29961, 29896, 22322, 25893, 29918, 4537, 2033, 13, 9651, 23351, 10794, 29918, 29916, 29918, 29891, 29889, 4397, 29898, 9302, 29889, 294, 2378, 29898, 25893, 876, 13, 9651, 19782, 353, 5159, 13, 4706, 19782, 29889, 4397, 4197, 29875, 29961, 29896, 22322, 29916, 7464, 474, 29961, 29896, 22322, 29891, 2033, 2314, 13, 1678, 23351, 10794, 29918, 29916, 29918, 29891, 29889, 4397, 29898, 9302, 29889, 294, 2378, 29898, 25893, 876, 13, 1678, 396, 1053, 10876, 13, 1678, 396, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 2175, 29918, 6563, 3149, 29918, 29302, 353, 518, 13, 1678, 5135, 2371, 29918, 1111, 24266, 29961, 29900, 3816, 29900, 29962, 718, 1591, 29918, 1111, 24266, 29961, 29945, 3816, 29900, 2314, 847, 29871, 29906, 511, 13, 1678, 5135, 2371, 29918, 1111, 24266, 29961, 29900, 3816, 29896, 29962, 718, 1591, 29918, 1111, 24266, 29961, 29945, 3816, 29896, 2314, 847, 29871, 29906, 4638, 13, 1678, 1492, 29918, 6563, 3149, 29918, 29302, 353, 518, 13, 1678, 5135, 2371, 29918, 1111, 24266, 29961, 29906, 3816, 29900, 29962, 718, 1591, 29918, 1111, 24266, 29961, 29941, 3816, 29900, 2314, 847, 29871, 29906, 511, 13, 1678, 5135, 2371, 29918, 1111, 24266, 29961, 29906, 3816, 29896, 29962, 718, 1591, 29918, 1111, 24266, 29961, 29941, 3816, 29896, 2314, 847, 29871, 29906, 4638, 13, 13, 1678, 23351, 10794, 29918, 29916, 29918, 29891, 353, 7442, 29889, 294, 2378, 29898, 303, 307, 10794, 29918, 29916, 29918, 29891, 29897, 13, 1678, 1591, 29918, 19244, 353, 11878, 695, 333, 713, 29918, 19244, 29898, 13, 462, 1678, 2175, 29918, 6563, 3149, 29918, 29302, 29961, 29900, 1402, 13, 462, 1678, 2175, 29918, 6563, 3149, 29918, 29302, 29961, 29896, 1402, 13, 462, 1678, 1492, 29918, 6563, 3149, 29918, 29302, 29961, 29900, 1402, 13, 462, 1678, 1492, 29918, 6563, 3149, 29918, 29302, 29961, 29896, 2314, 13, 13, 1678, 396, 1596, 29898, 25893, 29897, 13, 1678, 1053, 10876, 13, 1678, 1596, 29898, 2435, 29898, 303, 307, 10794, 29918, 29916, 29918, 29891, 876, 13, 1678, 363, 926, 29892, 19782, 297, 26985, 29898, 303, 307, 10794, 29918, 29916, 29918, 29891, 1125, 13, 4706, 1596, 877, 600, 29879, 742, 926, 29897, 13, 4706, 921, 29918, 1111, 4339, 353, 19782, 7503, 29892, 29871, 29900, 29962, 13, 4706, 343, 29918, 1111, 4339, 353, 19782, 7503, 29892, 29871, 29896, 29962, 13, 4706, 6210, 29918, 1761, 353, 5159, 13, 4706, 2602, 29918, 974, 29918, 1212, 29918, 19128, 353, 679, 29918, 29302, 29918, 974, 29918, 1212, 29918, 19128, 29898, 29916, 29918, 1111, 4339, 29892, 7145, 3149, 29918, 29916, 29897, 13, 4706, 24610, 353, 5159, 13, 13, 4706, 1596, 29898, 3283, 29918, 974, 29918, 1212, 29918, 19128, 29892, 525, 1066, 742, 7145, 3149, 29918, 29916, 29897, 13, 4706, 396, 10876, 29889, 13322, 29898, 29896, 29897, 13, 4706, 1596, 29898, 2435, 29898, 29916, 29918, 1111, 4339, 511, 7431, 29898, 29891, 29918, 1111, 4339, 876, 13, 4706, 1018, 29901, 13, 9651, 363, 1298, 297, 3464, 29898, 3283, 29918, 974, 29918, 1212, 29918, 19128, 29899, 9040, 29892, 2602, 29918, 974, 29918, 1212, 29918, 19128, 29974, 9040, 29974, 29896, 1125, 13, 18884, 6210, 29918, 1761, 29889, 4397, 4197, 29916, 29918, 1111, 4339, 29961, 3149, 1402, 343, 29918, 1111, 4339, 29961, 3149, 24960, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 308, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 19322, 29918, 1761, 6817, 29896, 1125, 13, 9651, 24610, 29889, 4397, 29898, 12932, 695, 333, 713, 29918, 19244, 29898, 13, 18884, 6210, 29918, 1761, 29961, 29875, 3816, 29900, 1402, 6210, 29918, 1761, 29961, 29875, 3816, 29896, 1402, 6210, 29918, 1761, 29961, 29875, 29974, 29896, 3816, 29900, 1402, 6210, 29918, 1761, 29961, 29875, 29974, 29896, 3816, 29896, 29962, 13, 462, 876, 13, 4706, 6210, 353, 2533, 29898, 5721, 2925, 29897, 847, 313, 29896, 847, 285, 567, 334, 5135, 2435, 29898, 5721, 2925, 7240, 29896, 4961, 13, 4706, 6210, 353, 313, 19322, 334, 29871, 29906, 29889, 29955, 29946, 29897, 847, 1591, 29918, 19244, 13, 4706, 396, 1284, 6210, 363, 1269, 19782, 13, 4706, 6210, 334, 29922, 29871, 29896, 29947, 847, 29871, 29945, 13, 13, 4706, 6210, 29918, 1454, 29918, 4204, 29918, 25893, 29961, 1066, 29974, 29896, 29962, 353, 6210, 13, 13, 1678, 736, 6210, 29918, 1454, 29918, 4204, 29918, 25893, 13, 13, 13, 1753, 679, 29918, 8028, 29898, 2135, 29918, 1111, 24266, 29892, 694, 29918, 13099, 29922, 29953, 29892, 694, 29918, 5727, 29922, 29941, 1125, 13, 1678, 260, 29873, 29918, 2371, 353, 7442, 29889, 3298, 359, 3552, 29941, 29892, 29871, 29953, 511, 7442, 29889, 524, 29941, 29906, 29897, 13, 1678, 1591, 29918, 1958, 353, 426, 13, 4706, 376, 29900, 29941, 29908, 584, 29871, 29896, 29892, 13, 4706, 376, 29900, 29946, 29908, 584, 29871, 29906, 29892, 13, 4706, 376, 29900, 29945, 29908, 584, 29871, 29941, 29892, 13, 4706, 376, 29896, 29941, 29908, 584, 29871, 29946, 29892, 13, 4706, 376, 29896, 29946, 29908, 584, 29871, 29945, 29892, 13, 4706, 376, 29896, 29945, 29908, 584, 29871, 29953, 29892, 13, 4706, 376, 29906, 29941, 29908, 584, 29871, 29955, 29892, 13, 4706, 376, 29906, 29946, 29908, 584, 29871, 29947, 29892, 13, 4706, 376, 29906, 29945, 29908, 584, 29871, 29929, 13, 1678, 500, 13, 13, 1678, 784, 29918, 10199, 353, 29871, 29896, 29929, 29906, 29900, 847, 694, 29918, 13099, 13, 1678, 1948, 29918, 10199, 353, 29871, 29896, 29900, 29947, 29900, 847, 694, 29918, 5727, 13, 1678, 289, 21543, 29918, 1054, 353, 29871, 29900, 13, 1678, 289, 21543, 29918, 798, 353, 29871, 29900, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 694, 29918, 13099, 29974, 29896, 1125, 13, 4706, 565, 8287, 29918, 1111, 24266, 29961, 29900, 29962, 529, 784, 29918, 10199, 334, 474, 29901, 13, 9651, 289, 21543, 29918, 1054, 353, 474, 13, 9651, 2867, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 694, 29918, 5727, 29974, 29896, 1125, 13, 4706, 565, 8287, 29918, 1111, 24266, 29961, 29896, 29962, 529, 1948, 29918, 10199, 334, 474, 29901, 13, 9651, 289, 21543, 29918, 798, 353, 474, 13, 9651, 2867, 13, 13, 1678, 396, 260, 29873, 29918, 2371, 29961, 29890, 21543, 29918, 798, 29899, 29896, 3816, 29890, 21543, 29918, 1054, 29899, 29896, 29962, 4619, 29871, 29896, 13, 1678, 2854, 29918, 3198, 353, 851, 29898, 29890, 21543, 29918, 798, 29897, 718, 851, 29898, 29890, 21543, 29918, 1054, 29897, 13, 1678, 565, 2854, 29918, 3198, 297, 1591, 29918, 1958, 29901, 13, 4706, 736, 851, 29898, 2371, 29918, 1958, 29961, 3084, 29918, 3198, 2314, 13, 1678, 1683, 29901, 13, 4706, 1596, 877, 15866, 549, 1302, 4339, 1495, 13, 4706, 736, 851, 29898, 29941, 29897, 13, 13, 13, 1753, 1370, 29886, 29918, 1111, 24266, 29898, 29916, 29892, 343, 29892, 4636, 1125, 13, 1678, 1596, 877, 4495, 15702, 1495, 13, 1678, 1596, 29898, 29916, 29892, 343, 29892, 525, 29886, 9466, 1495, 13, 1678, 282, 353, 313, 29916, 29892, 343, 29897, 13, 13, 1678, 282, 29916, 353, 313, 5344, 29961, 29900, 3816, 29900, 29962, 334, 282, 29961, 29900, 29962, 718, 4636, 29961, 29900, 3816, 29896, 29962, 334, 282, 29961, 29896, 29962, 718, 4636, 29961, 29900, 3816, 29906, 2314, 847, 320, 13, 4706, 5135, 5344, 29961, 29906, 3816, 29900, 29962, 334, 282, 29961, 29900, 29962, 718, 4636, 29961, 29906, 3816, 29896, 29962, 334, 282, 29961, 29896, 29962, 718, 4636, 29961, 29906, 3816, 29906, 12622, 13, 268, 13, 1678, 11451, 353, 313, 5344, 29961, 29896, 3816, 29900, 29962, 334, 282, 29961, 29900, 29962, 718, 4636, 29961, 29896, 3816, 29896, 29962, 334, 282, 29961, 29896, 29962, 718, 4636, 29961, 29896, 3816, 29906, 2314, 847, 320, 13, 4706, 5135, 5344, 29961, 29906, 3816, 29900, 29962, 334, 282, 29961, 29900, 29962, 718, 4636, 29961, 29906, 3816, 29896, 29962, 334, 282, 29961, 29896, 29962, 718, 4636, 29961, 29906, 3816, 29906, 12622, 13, 1678, 1596, 29898, 1756, 29892, 11451, 29892, 525, 1370, 9795, 282, 9466, 1495, 13, 1678, 736, 518, 524, 29898, 1756, 511, 938, 29898, 2272, 4638, 13, 13, 13, 1753, 679, 29918, 3286, 4752, 29918, 1111, 24266, 29898, 29916, 29892, 343, 1125, 13, 1678, 1591, 29918, 1111, 24266, 353, 1303, 29918, 1111, 24266, 580, 13, 1678, 1591, 29918, 1111, 24266, 29918, 29883, 1398, 414, 353, 7442, 29889, 2378, 4197, 13, 4706, 1591, 29918, 1111, 24266, 29961, 29900, 1402, 13, 4706, 1591, 29918, 1111, 24266, 29961, 29906, 1402, 13, 4706, 1591, 29918, 1111, 24266, 29961, 29941, 1402, 13, 4706, 1591, 29918, 1111, 24266, 29961, 29945, 29962, 13, 4706, 21251, 7442, 29889, 7411, 29941, 29906, 29897, 13, 268, 13, 1678, 1596, 29898, 2371, 29918, 1111, 24266, 29892, 525, 2371, 1302, 4339, 1495, 13, 13, 1678, 1370, 9795, 29918, 6229, 5580, 353, 7442, 29889, 2378, 4197, 29961, 29900, 29892, 29871, 29900, 1402, 518, 29896, 29929, 29906, 29900, 29892, 29871, 29900, 1402, 518, 29900, 29892, 29871, 29896, 29900, 29947, 29900, 1402, 518, 29896, 29929, 29906, 29900, 29892, 29871, 29896, 29900, 29947, 29900, 20526, 7442, 29889, 7411, 29941, 29906, 29897, 13, 13, 13, 1678, 4636, 353, 13850, 29906, 29889, 657, 15136, 12645, 13372, 29898, 2371, 29918, 1111, 24266, 29918, 29883, 1398, 414, 29892, 13, 462, 462, 308, 1370, 9795, 29918, 6229, 5580, 29897, 13, 13, 1678, 921, 29892, 343, 353, 1370, 29886, 29918, 1111, 24266, 29898, 29916, 29892, 343, 29892, 4636, 29897, 13, 1678, 2602, 353, 679, 29918, 8028, 4197, 29916, 29892, 29891, 2314, 13, 1678, 736, 2602, 13, 13, 13, 1753, 1208, 29884, 695, 403, 29918, 19322, 29918, 392, 29918, 29886, 4620, 4110, 7295, 13, 1678, 5534, 19782, 29918, 1272, 13, 1678, 396, 437, 6210, 6454, 22396, 13, 1678, 1121, 353, 10518, 29889, 949, 29918, 7638, 877, 8394, 29918, 2914, 29889, 7638, 1495, 13, 1678, 2175, 29918, 29890, 1309, 778, 353, 1121, 29889, 27789, 703, 25893, 29918, 4537, 2564, 4102, 2141, 12071, 29918, 2248, 580, 13, 1678, 1492, 29918, 29890, 1309, 778, 353, 1121, 29889, 27789, 703, 25893, 29918, 4537, 2564, 4230, 2141, 12071, 29918, 2248, 580, 13, 1678, 6210, 29918, 1454, 29918, 4204, 29918, 25893, 353, 679, 29918, 19322, 580, 13, 13, 1678, 1596, 29898, 19322, 29918, 1454, 29918, 4204, 29918, 25893, 29892, 525, 19322, 742, 7431, 29898, 1563, 29918, 29890, 1309, 778, 876, 13, 1678, 289, 29883, 353, 29871, 29900, 13, 1678, 363, 289, 1309, 778, 297, 14319, 29898, 1563, 29918, 29890, 1309, 778, 29889, 1524, 5727, 3285, 1492, 29918, 29890, 1309, 778, 29889, 1524, 5727, 580, 1125, 13, 4706, 1596, 29898, 12328, 29892, 525, 12328, 1495, 13, 4706, 2175, 29892, 1492, 353, 289, 1309, 778, 29961, 29900, 3816, 29896, 1402, 289, 1309, 778, 29961, 29896, 3816, 29896, 29962, 13, 4706, 1596, 29898, 1563, 1839, 29916, 7464, 1492, 1839, 29916, 7464, 525, 29212, 1495, 13, 4706, 848, 29918, 353, 426, 13, 9651, 376, 25893, 29918, 978, 29908, 584, 19782, 29918, 1272, 1839, 1272, 2033, 29961, 12328, 22322, 25893, 29918, 978, 7464, 13, 9651, 376, 25893, 29918, 4537, 29908, 584, 2175, 1839, 25893, 29918, 4537, 7464, 13, 9651, 376, 3283, 29908, 584, 679, 29918, 3286, 4752, 29918, 1111, 24266, 29898, 1266, 1839, 29916, 7464, 1492, 1839, 29891, 2033, 511, 13, 9651, 376, 19322, 29908, 584, 6210, 29918, 1454, 29918, 4204, 29918, 25893, 29961, 1563, 1839, 25893, 29918, 4537, 2033, 29962, 13, 4706, 500, 13, 4706, 19782, 29918, 1272, 1839, 1272, 2033, 29961, 12328, 29962, 353, 848, 29918, 13, 4706, 396, 565, 289, 29883, 1275, 29871, 29941, 29901, 13, 4706, 396, 268, 2867, 13, 4706, 289, 29883, 4619, 29871, 29896, 13, 268, 13, 1678, 934, 29918, 353, 1722, 877, 25893, 29918, 19322, 29918, 2914, 29889, 3126, 742, 525, 29893, 1495, 13, 1678, 4390, 29889, 15070, 29898, 25893, 29918, 1272, 29892, 934, 19925, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1208, 29884, 695, 403, 29918, 19322, 29918, 392, 29918, 29886, 4620, 4110, 580, 13, 2 ]
memsql_loader/api/caller.py
yonglehou/memsql-loader
1
181929
<filename>memsql_loader/api/caller.py import re from memsql_loader.api.exceptions import ApiException from memsql_loader.api.jobs import Jobs from memsql_loader.api.job import Job from memsql_loader.api.tasks import Tasks from memsql_loader.api.task import Task APIS = [ Jobs, Job, Tasks, Task ] __underscorer1 = re.compile(r'(.)([A-Z][a-z]+)') __underscorer2 = re.compile('([a-z0-9])([A-Z])') def __camelcase_convertor(s): subbed = __underscorer1.sub(r'\1_\2', s) return __underscorer2.sub(r'\1_\2', subbed).lower() API_NAME_MAP = { __camelcase_convertor(ApiClass.__name__): ApiClass for ApiClass in APIS } class ApiCaller(object): """ This class allows you to query any of the API's by name """ def __init__(self): for name, ApiClass in API_NAME_MAP.items(): setattr(self, name, ApiClass()) def call(self, api, params): return self.get(api).query(params) def get(self, api): if not hasattr(self, api): raise ApiException('Api not found: %s' % api) return getattr(self, api)
[ 1, 529, 9507, 29958, 29885, 1567, 1519, 29918, 12657, 29914, 2754, 29914, 4804, 261, 29889, 2272, 13, 5215, 337, 13, 13, 3166, 286, 1567, 1519, 29918, 12657, 29889, 2754, 29889, 11739, 29879, 1053, 29749, 2451, 13, 13, 3166, 286, 1567, 1519, 29918, 12657, 29889, 2754, 29889, 9057, 29879, 1053, 17163, 29879, 13, 3166, 286, 1567, 1519, 29918, 12657, 29889, 2754, 29889, 9057, 1053, 17163, 13, 3166, 286, 1567, 1519, 29918, 12657, 29889, 2754, 29889, 20673, 1053, 9330, 29879, 13, 3166, 286, 1567, 1519, 29918, 12657, 29889, 2754, 29889, 7662, 1053, 9330, 13, 8787, 29903, 353, 518, 17163, 29879, 29892, 17163, 29892, 9330, 29879, 29892, 9330, 4514, 13, 13, 1649, 870, 414, 2616, 261, 29896, 353, 337, 29889, 12198, 29898, 29878, 12215, 1846, 4197, 29909, 29899, 29999, 3816, 29874, 29899, 29920, 10062, 29897, 1495, 13, 1649, 870, 414, 2616, 261, 29906, 353, 337, 29889, 12198, 877, 4197, 29874, 29899, 29920, 29900, 29899, 29929, 2314, 4197, 29909, 29899, 29999, 2314, 1495, 13, 13, 1753, 4770, 11108, 295, 4878, 29918, 13441, 272, 29898, 29879, 1125, 13, 1678, 1014, 2580, 353, 4770, 870, 414, 2616, 261, 29896, 29889, 1491, 29898, 29878, 12764, 29896, 3187, 29906, 742, 269, 29897, 13, 1678, 736, 4770, 870, 414, 2616, 261, 29906, 29889, 1491, 29898, 29878, 12764, 29896, 3187, 29906, 742, 1014, 2580, 467, 13609, 580, 13, 13, 8787, 29918, 5813, 29918, 23827, 353, 426, 4770, 11108, 295, 4878, 29918, 13441, 272, 29898, 11713, 2385, 17255, 978, 1649, 1125, 29749, 2385, 363, 29749, 2385, 297, 3450, 29903, 500, 13, 13, 1990, 29749, 5594, 261, 29898, 3318, 1125, 13, 1678, 9995, 910, 770, 6511, 366, 304, 2346, 738, 310, 278, 3450, 29915, 29879, 491, 1024, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 363, 1024, 29892, 29749, 2385, 297, 3450, 29918, 5813, 29918, 23827, 29889, 7076, 7295, 13, 9651, 731, 5552, 29898, 1311, 29892, 1024, 29892, 29749, 2385, 3101, 13, 13, 1678, 822, 1246, 29898, 1311, 29892, 7882, 29892, 8636, 1125, 13, 4706, 736, 1583, 29889, 657, 29898, 2754, 467, 1972, 29898, 7529, 29897, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 7882, 1125, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 7882, 1125, 13, 9651, 12020, 29749, 2451, 877, 11713, 451, 1476, 29901, 1273, 29879, 29915, 1273, 7882, 29897, 13, 4706, 736, 679, 5552, 29898, 1311, 29892, 7882, 29897, 13, 2 ]
src/jomiel_kore/version.py
guendto/jomiel-kore
0
29931
<filename>src/jomiel_kore/version.py # # jomiel-kore # # Copyright # 2019-2020 <NAME> # # # SPDX-License-Identifier: Apache-2.0 # """TODO.""" try: # py38+ from importlib.metadata import version as metadata_version from importlib.metadata import PackageNotFoundError except ModuleNotFoundError: from importlib_metadata import version as metadata_version from importlib_metadata import PackageNotFoundError def package_version(package_name, destination): """Returns the package version string Args: package_name (str): the package name to look up destination (list): the list to store the result (tuple) to """ try: version = metadata_version(package_name) except PackageNotFoundError: version = "<unavailable>" if package_name == "pyzmq": from zmq import zmq_version version = "{} (libzmq version {})".format( version, zmq_version(), ) destination.append((package_name, version)) # vim: set ts=4 sw=4 tw=72 expandtab:
[ 1, 529, 9507, 29958, 4351, 29914, 29926, 290, 709, 29918, 29895, 487, 29914, 3259, 29889, 2272, 13, 29937, 13, 29937, 432, 290, 709, 29899, 29895, 487, 13, 29937, 13, 29937, 14187, 1266, 13, 29937, 259, 29906, 29900, 29896, 29929, 29899, 29906, 29900, 29906, 29900, 529, 5813, 29958, 13, 29937, 13, 29937, 13, 29937, 10937, 29928, 29990, 29899, 29931, 293, 1947, 29899, 12889, 29901, 13380, 29899, 29906, 29889, 29900, 13, 29937, 13, 15945, 29908, 4986, 3970, 1213, 15945, 13, 13, 2202, 29901, 29871, 396, 11451, 29941, 29947, 29974, 13, 1678, 515, 1053, 1982, 29889, 19635, 1053, 1873, 408, 15562, 29918, 3259, 13, 1678, 515, 1053, 1982, 29889, 19635, 1053, 22029, 17413, 2392, 13, 19499, 15591, 17413, 2392, 29901, 13, 1678, 515, 1053, 1982, 29918, 19635, 1053, 1873, 408, 15562, 29918, 3259, 13, 1678, 515, 1053, 1982, 29918, 19635, 1053, 22029, 17413, 2392, 13, 13, 13, 1753, 3577, 29918, 3259, 29898, 5113, 29918, 978, 29892, 12551, 1125, 13, 1678, 9995, 11609, 29879, 278, 3577, 1873, 1347, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 3577, 29918, 978, 313, 710, 1125, 278, 3577, 1024, 304, 1106, 701, 13, 4706, 12551, 313, 1761, 1125, 278, 1051, 304, 3787, 278, 1121, 313, 23583, 29897, 304, 13, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 4706, 1873, 353, 15562, 29918, 3259, 29898, 5113, 29918, 978, 29897, 13, 1678, 5174, 22029, 17413, 2392, 29901, 13, 4706, 1873, 353, 9872, 348, 16515, 11903, 13, 13, 1678, 565, 3577, 29918, 978, 1275, 376, 2272, 14018, 29939, 1115, 13, 4706, 515, 12162, 29939, 1053, 12162, 29939, 29918, 3259, 13, 13, 4706, 1873, 353, 376, 8875, 313, 1982, 14018, 29939, 1873, 426, 1800, 1642, 4830, 29898, 13, 9651, 1873, 29892, 13, 9651, 12162, 29939, 29918, 3259, 3285, 13, 4706, 1723, 13, 13, 1678, 12551, 29889, 4397, 3552, 5113, 29918, 978, 29892, 1873, 876, 13, 13, 13, 29937, 325, 326, 29901, 731, 18696, 29922, 29946, 2381, 29922, 29946, 3252, 29922, 29955, 29906, 7985, 3891, 29901, 13, 2 ]
oslo_db/sqlalchemy/enginefacade.py
calsoft-internal/oslo.db-internal
0
68130
# 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 contextlib import functools import operator import threading import warnings import debtcollector.moves import debtcollector.removals import debtcollector.renames from oslo_config import cfg from oslo_utils import excutils from oslo_db import exception from oslo_db import options from oslo_db.sqlalchemy import engines from oslo_db.sqlalchemy import orm from oslo_db.sqlalchemy import utils from oslo_db import warning class _symbol(object): """represent a fixed symbol.""" __slots__ = 'name', def __init__(self, name): self.name = name def __repr__(self): return "symbol(%r)" % self.name _ASYNC_READER = _symbol('ASYNC_READER') """Represent the transaction state of "async reader". This state indicates that the transaction is a read-only and is safe to use on an asynchronously updated slave database. """ _READER = _symbol('READER') """Represent the transaction state of "reader". This state indicates that the transaction is a read-only and is only safe to use on a synchronously updated slave database; otherwise the master database should be used. """ _WRITER = _symbol('WRITER') """Represent the transaction state of "writer". This state indicates that the transaction writes data and should be directed at the master database. """ class _Default(object): """Mark a value as a default value. A value in the local configuration dictionary wrapped with _Default() will not take precedence over a value that is specified in cfg.CONF. Values that are set after the fact using configure() will supersede those in cfg.CONF. """ __slots__ = 'value', _notset = _symbol("NOTSET") def __init__(self, value=_notset): self.value = value @classmethod def resolve(cls, value): if isinstance(value, _Default): v = value.value if v is cls._notset: return None else: return v else: return value @classmethod def resolve_w_conf(cls, value, conf_namespace, key): if isinstance(value, _Default): v = getattr(conf_namespace, key, value.value) if v is cls._notset: return None else: return v else: return value @classmethod def is_set(cls, value): return not isinstance(value, _Default) or \ value.value is not cls._notset @classmethod def is_set_w_conf(cls, value, conf_namespace, key): return not isinstance(value, _Default) or \ value.value is not cls._notset or \ hasattr(conf_namespace, key) class AlreadyStartedError(TypeError): """Raises when a factory is being asked to initialize a second time. Subclasses :class:`.TypeError` for legacy support. """ class _TransactionFactory(object): """A factory for :class:`._TransactionContext` objects. By default, there is just one of these, set up based on CONF, however instance-level :class:`._TransactionFactory` objects can be made, as is the case with the :class:`._TestTransactionFactory` subclass used by the oslo.db test suite. """ def __init__(self): self._url_cfg = { 'connection': _Default(), 'slave_connection': _Default(), } self._engine_cfg = { 'sqlite_fk': _Default(False), 'mysql_sql_mode': _Default('TRADITIONAL'), 'mysql_enable_ndb': _Default(False), 'connection_recycle_time': _Default(3600), 'connection_debug': _Default(0), 'max_pool_size': _Default(), 'max_overflow': _Default(), 'pool_timeout': _Default(), 'sqlite_synchronous': _Default(True), 'connection_trace': _Default(False), 'max_retries': _Default(10), 'retry_interval': _Default(10), 'thread_checkin': _Default(True), 'json_serializer': _Default(None), 'json_deserializer': _Default(None), 'logging_name': _Default(None), 'connection_parameters': _Default(None) } self._maker_cfg = { 'expire_on_commit': _Default(False), '__autocommit': True } self._transaction_ctx_cfg = { 'rollback_reader_sessions': False, 'flush_on_subtransaction': False, } self._facade_cfg = { 'synchronous_reader': True, 'on_engine_create': [], } # other options that are defined in oslo_db.options.database_opts # or oslo_db.concurrency.tpool_opts but do not apply to the standard # enginefacade arguments (most seem to apply to api.DBAPI). self._ignored_cfg = dict( (k, _Default(None)) for k in [ 'db_max_retries', 'db_inc_retry_interval', 'use_db_reconnect', 'db_retry_interval', 'db_max_retry_interval', 'backend', 'use_tpool']) self._started = False self._legacy_facade = None self._start_lock = threading.Lock() @debtcollector.renames.renamed_kwarg( "idle_timeout", "connection_recycle_time", replace=True) def configure_defaults(self, **kw): """Apply default configurational options. This method can only be called before any specific transaction-beginning methods have been called. Configurational options are within a fixed set of keys, and fall under three categories: URL configuration, engine configuration, and session configuration. Each key given will be tested against these three configuration sets to see which one is applicable; if it is not applicable to any set, an exception is raised. The configurational options given here act as **defaults** when the :class:`._TransactionFactory` is configured using a :class:`oslo_config.cfg.ConfigOpts` object; the options present within the :class:`oslo_config.cfg.ConfigOpts` **take precedence** versus the arguments passed here. By default, the :class:`._TransactionFactory` loads in the configuration from :data:`oslo_config.cfg.CONF`, after applying the :data:`oslo_db.options.database_opts` configurational defaults to it. :param connection: database URL :param slave_connection: database URL :param sqlite_fk: whether to enable SQLite foreign key pragma; default False :param mysql_sql_mode: MySQL SQL mode, defaults to TRADITIONAL :param mysql_enable_ndb: enable MySQL Cluster (NDB) support :param connection_recycle_time: connection pool recycle time, defaults to 3600. Note the connection does not actually have to be "idle" to be recycled. :param connection_debug: engine logging level, defaults to 0. set to 50 for INFO, 100 for DEBUG. :param connection_parameters: additional parameters to append onto the database URL query string, pass as "param1=value1&param2=value2&..." :param max_pool_size: max size of connection pool, uses CONF for default :param max_overflow: max overflow for connection pool, uses CONF for default :param sqlite_synchronous: disable SQLite SYNCHRONOUS pragma if False; defaults to True :param connection_trace: enable tracing comments in logging :param max_retries: max retries to connect, defaults to !0 :param retry_interval: time in seconds between retries, defaults to 10 :param thread_checkin: add sleep(0) on connection checkin to allow greenlet yields, defaults to True :param json_serializer: JSON serializer for PostgreSQL connections :param json_deserializer: JSON deserializer for PostgreSQL connections :param logging_name: logging name for engine :param expire_on_commit: sets expire_on_commit for SQLAlchemy sessionmaker; defaults to False :param rollback_reader_sessions: if True, a :class:`.Session` object will have its :meth:`.Session.rollback` method invoked at the end of a ``@reader`` block, actively rolling back the transaction and expiring the objects within, before the :class:`.Session` moves on to be closed, which has the effect of releasing connection resources back to the connection pool and detaching all objects. If False, the :class:`.Session` is not affected at the end of a ``@reader`` block; the underlying connection referred to by this :class:`.Session` will still be released in the enclosing context via the :meth:`.Session.close` method, which still ensures that the DBAPI connection is rolled back, however the objects associated with the :class:`.Session` retain their database-persisted contents after they are detached. .. seealso:: http://docs.sqlalchemy.org/en/rel_0_9/glossary.html#term-released\ SQLAlchemy documentation on what "releasing resources" means. :param synchronous_reader: whether or not to assume a "reader" context needs to guarantee it can read data committed by a "writer" assuming replication lag is present; defaults to True. When False, a @reader context works the same as @async_reader and will select the "slave" database if present. :param flush_on_subtransaction: if True, a :class:`.Session` object will have its :meth:`.Session.flush` method invoked whenever a context manager or decorator that is not itself the originator of the top- level or savepoint :class:`.Session` transaction exits - in this way it behaves like a "subtransaction" from a :class:`.Session` perspective. .. seealso:: :meth:`._TransactionFactory.configure` """ self._configure(True, kw) @debtcollector.renames.renamed_kwarg( "idle_timeout", "connection_recycle_time", replace=True) def configure(self, **kw): """Apply configurational options. This method can only be called before any specific transaction-beginning methods have been called. Behavior here is the same as that of :meth:`._TransactionFactory.configure_defaults`, with the exception that values specified here will **supersede** those setup in the :class:`oslo_config.cfg.ConfigOpts` options. See that method for a listing of all keyword arguments. .. seealso:: :meth:`._TransactionFactory.configure_defaults` """ self._configure(False, kw) def _configure(self, as_defaults, kw): if self._started: raise AlreadyStartedError( "this TransactionFactory is already started") not_supported = [] for k, v in kw.items(): for dict_ in ( self._url_cfg, self._engine_cfg, self._maker_cfg, self._ignored_cfg, self._facade_cfg, self._transaction_ctx_cfg): if k in dict_: dict_[k] = _Default(v) if as_defaults else v break else: not_supported.append(k) if not_supported: # would like to raise ValueError here, but there are just # too many unrecognized (obsolete?) configuration options # coming in from projects warnings.warn( "Configuration option(s) %r not supported" % sorted(not_supported), warning.NotSupportedWarning ) def get_legacy_facade(self): """Return a :class:`.LegacyEngineFacade` for this factory. This facade will make use of the same engine and sessionmaker as this factory, however will not share the same transaction context; the legacy facade continues to work the old way of returning a new Session each time get_session() is called. """ if not self._legacy_facade: self._legacy_facade = LegacyEngineFacade(None, _factory=self) if not self._started: self._start() return self._legacy_facade def get_writer_engine(self): """Return the writer engine for this factory. Implies start. """ if not self._started: self._start() return self._writer_engine def get_reader_engine(self): """Return the reader engine for this factory. Implies start. """ if not self._started: self._start() return self._reader_engine def get_writer_maker(self): """Return the writer sessionmaker for this factory. Implies start. """ if not self._started: self._start() return self._writer_maker def get_reader_maker(self): """Return the reader sessionmaker for this factory. Implies start. """ if not self._started: self._start() return self._reader_maker def _create_connection(self, mode): if not self._started: self._start() if mode is _WRITER: return self._writer_engine.connect() elif mode is _ASYNC_READER or \ (mode is _READER and not self.synchronous_reader): return self._reader_engine.connect() else: return self._writer_engine.connect() def _create_session(self, mode, bind=None): if not self._started: self._start() kw = {} # don't pass 'bind' if bind is None; the sessionmaker # already has a bind to the engine. if bind: kw['bind'] = bind if mode is _WRITER: return self._writer_maker(**kw) elif mode is _ASYNC_READER or \ (mode is _READER and not self.synchronous_reader): return self._reader_maker(**kw) else: return self._writer_maker(**kw) def _create_factory_copy(self): factory = _TransactionFactory() factory._url_cfg.update(self._url_cfg) factory._engine_cfg.update(self._engine_cfg) factory._maker_cfg.update(self._maker_cfg) factory._transaction_ctx_cfg.update(self._transaction_ctx_cfg) factory._facade_cfg.update(self._facade_cfg) return factory def _args_for_conf(self, default_cfg, conf): if conf is None: return dict( (key, _Default.resolve(value)) for key, value in default_cfg.items() if _Default.is_set(value) ) else: return dict( (key, _Default.resolve_w_conf(value, conf.database, key)) for key, value in default_cfg.items() if _Default.is_set_w_conf(value, conf.database, key) ) def _url_args_for_conf(self, conf): return self._args_for_conf(self._url_cfg, conf) def _engine_args_for_conf(self, conf): return self._args_for_conf(self._engine_cfg, conf) def _maker_args_for_conf(self, conf): maker_args = self._args_for_conf(self._maker_cfg, conf) maker_args['autocommit'] = maker_args.pop('__autocommit') return maker_args def dispose_pool(self): """Call engine.pool.dispose() on underlying Engine objects.""" with self._start_lock: if not self._started: return self._writer_engine.pool.dispose() if self._reader_engine is not self._writer_engine: self._reader_engine.pool.dispose() @property def is_started(self): """True if this :class:`._TransactionFactory` is already started.""" return self._started def _start(self, conf=False, connection=None, slave_connection=None): with self._start_lock: # self._started has been checked on the outside # when _start() was called. Within the lock, # check the flag once more to detect the case where # the start process proceeded while this thread was waiting # for the lock. if self._started: return if conf is False: conf = cfg.CONF # perform register_opts() local to actually using # the cfg.CONF to maintain exact compatibility with # the EngineFacade design. This can be changed if needed. if conf is not None: conf.register_opts(options.database_opts, 'database') url_args = self._url_args_for_conf(conf) if connection: url_args['connection'] = connection if slave_connection: url_args['slave_connection'] = slave_connection engine_args = self._engine_args_for_conf(conf) maker_args = self._maker_args_for_conf(conf) self._writer_engine, self._writer_maker = \ self._setup_for_connection( url_args['connection'], engine_args, maker_args) if url_args.get('slave_connection'): self._reader_engine, self._reader_maker = \ self._setup_for_connection( url_args['slave_connection'], engine_args, maker_args) else: self._reader_engine, self._reader_maker = \ self._writer_engine, self._writer_maker self.synchronous_reader = self._facade_cfg['synchronous_reader'] # set up _started last, so that in case of exceptions # we try the whole thing again and report errors # correctly self._started = True def _setup_for_connection( self, sql_connection, engine_kwargs, maker_kwargs): if sql_connection is None: raise exception.CantStartEngineError( "No sql_connection parameter is established") engine = engines.create_engine( sql_connection=sql_connection, **engine_kwargs) for hook in self._facade_cfg['on_engine_create']: hook(engine) sessionmaker = orm.get_maker(engine=engine, **maker_kwargs) return engine, sessionmaker class _TestTransactionFactory(_TransactionFactory): """A :class:`._TransactionFactory` used by test suites. This is a :class:`._TransactionFactory` that can be directly injected with an existing engine and sessionmaker. Note that while this is used by oslo.db's own tests of the enginefacade system, it is also exported for use by the test suites of other projects, first as an element of the oslo_db.sqlalchemy.test_base module, and secondly may be used by external test suites directly. Includes a feature to inject itself temporarily as the factory within the global :class:`._TransactionContextManager`. """ @debtcollector.removals.removed_kwarg( 'synchronous_reader', 'argument value is propagated from the parent _TransactionFactory') def __init__(self, engine, maker, apply_global, from_factory=None, **kw): # NOTE(zzzeek): **kw needed for backwards compability self._reader_engine = self._writer_engine = engine self._reader_maker = self._writer_maker = maker self._started = True self._legacy_facade = None if from_factory is None: from_factory = _context_manager._factory self._facade_cfg = from_factory._facade_cfg self._transaction_ctx_cfg = from_factory._transaction_ctx_cfg self.synchronous_reader = self._facade_cfg['synchronous_reader'] if apply_global: self.existing_factory = _context_manager._factory _context_manager._root_factory = self def dispose_global(self): _context_manager._root_factory = self.existing_factory class _TransactionContext(object): """Represent a single database transaction in progress.""" def __init__(self, factory, global_factory=None): """Construct a new :class:`.TransactionContext`. :param factory: the :class:`.TransactionFactory` which will serve as a source of connectivity. :param global_factory: the "global" factory which will be used by the global ``_context_manager`` for new ``_TransactionContext`` objects created under this one. When left as None the actual "global" factory is used. """ self.factory = factory self.global_factory = global_factory self.mode = None self.session = None self.connection = None self.transaction = None kw = self.factory._transaction_ctx_cfg self.rollback_reader_sessions = kw['rollback_reader_sessions'] self.flush_on_subtransaction = kw['flush_on_subtransaction'] @contextlib.contextmanager def _connection(self, savepoint=False, context=None): if self.connection is None: try: if self.session is not None: # use existing session, which is outer to us self.connection = self.session.connection() if savepoint: with self.connection.begin_nested(), \ self._add_context(self.connection, context): yield self.connection else: with self._add_context(self.connection, context): yield self.connection else: # is outermost self.connection = self.factory._create_connection( mode=self.mode) self.transaction = self.connection.begin() try: with self._add_context(self.connection, context): yield self.connection self._end_connection_transaction(self.transaction) except Exception: self.transaction.rollback() # TODO(zzzeek) do we need save_and_reraise() here, # or do newer eventlets not have issues? we are using # raw "raise" in many other places in oslo.db already raise finally: self.transaction = None self.connection.close() finally: self.connection = None else: # use existing connection, which is outer to us if savepoint: with self.connection.begin_nested(), \ self._add_context(self.connection, context): yield self.connection else: with self._add_context(self.connection, context): yield self.connection @contextlib.contextmanager def _session(self, savepoint=False, context=None): if self.session is None: self.session = self.factory._create_session( bind=self.connection, mode=self.mode) try: self.session.begin() with self._add_context(self.session, context): yield self.session self._end_session_transaction(self.session) except Exception: with excutils.save_and_reraise_exception(): self.session.rollback() finally: self.session.close() self.session = None else: # use existing session, which is outer to us if savepoint: with self.session.begin_nested(): with self._add_context(self.session, context): yield self.session else: with self._add_context(self.session, context): yield self.session if self.flush_on_subtransaction: self.session.flush() @contextlib.contextmanager def _add_context(self, connection, context): restore_context = connection.info.get('using_context') connection.info['using_context'] = context yield connection connection.info['using_context'] = restore_context def _end_session_transaction(self, session): if self.mode is _WRITER: session.commit() elif self.rollback_reader_sessions: session.rollback() # In the absence of calling session.rollback(), # the next call is session.close(). This releases all # objects from the session into the detached state, and # releases the connection as well; the connection when returned # to the pool is either rolled back in any case, or closed fully. def _end_connection_transaction(self, transaction): if self.mode is _WRITER: transaction.commit() else: transaction.rollback() def _produce_block(self, mode, connection, savepoint, allow_async=False, context=None): if mode is _WRITER: self._writer() elif mode is _ASYNC_READER: self._async_reader() else: self._reader(allow_async) if connection: return self._connection(savepoint, context=context) else: return self._session(savepoint, context=context) def _writer(self): if self.mode is None: self.mode = _WRITER elif self.mode is _READER: raise TypeError( "Can't upgrade a READER transaction " "to a WRITER mid-transaction") elif self.mode is _ASYNC_READER: raise TypeError( "Can't upgrade an ASYNC_READER transaction " "to a WRITER mid-transaction") def _reader(self, allow_async=False): if self.mode is None: self.mode = _READER elif self.mode is _ASYNC_READER and not allow_async: raise TypeError( "Can't upgrade an ASYNC_READER transaction " "to a READER mid-transaction") def _async_reader(self): if self.mode is None: self.mode = _ASYNC_READER class _TransactionContextTLocal(threading.local): def __deepcopy__(self, memo): return self def __reduce__(self): return _TransactionContextTLocal, () class _TransactionContextManager(object): """Provide context-management and decorator patterns for transactions. This object integrates user-defined "context" objects with the :class:`._TransactionContext` class, on behalf of a contained :class:`._TransactionFactory`. """ def __init__( self, root=None, mode=None, independent=False, savepoint=False, connection=False, replace_global_factory=None, _is_global_manager=False, allow_async=False): if root is None: self._root = self self._root_factory = _TransactionFactory() else: self._root = root self._replace_global_factory = replace_global_factory self._is_global_manager = _is_global_manager self._mode = mode self._independent = independent self._savepoint = savepoint if self._savepoint and self._independent: raise TypeError( "setting savepoint and independent makes no sense.") self._connection = connection self._allow_async = allow_async @property def _factory(self): """The :class:`._TransactionFactory` associated with this context.""" return self._root._root_factory @property def is_started(self): """True if this manager is already started.""" return self._factory.is_started def configure(self, **kw): """Apply configurational options to the factory. This method can only be called before any specific transaction-beginning methods have been called. """ self._factory.configure(**kw) def append_on_engine_create(self, fn): """Append a listener function to _facade_cfg["on_engine_create"]""" self._factory._facade_cfg['on_engine_create'].append(fn) def get_legacy_facade(self): """Return a :class:`.LegacyEngineFacade` for factory from this context. This facade will make use of the same engine and sessionmaker as this factory, however will not share the same transaction context; the legacy facade continues to work the old way of returning a new Session each time get_session() is called. """ return self._factory.get_legacy_facade() def get_engine(self): """Return the Engine in use. This will be based on the state being WRITER or READER. This implies a start operation. """ if self._mode is _WRITER: return self._factory.get_writer_engine() elif self._mode is _READER: return self._factory.get_reader_engine() else: raise ValueError("mode should be WRITER or READER") def get_sessionmaker(self): """Return the sessionmaker in use. This will be based on the state being WRITER or READER. This implies a start operation. """ if self._mode is _WRITER: return self._factory.get_writer_maker() elif self._mode is _READER: return self._factory.get_reader_maker() else: raise ValueError("mode should be WRITER or READER") def dispose_pool(self): """Call engine.pool.dispose() on underlying Engine objects.""" self._factory.dispose_pool() def make_new_manager(self): """Create a new, independent _TransactionContextManager from this one. Copies the underlying _TransactionFactory to a new one, so that it can be further configured with new options. Used for test environments where the application-wide _TransactionContextManager may be used as a factory for test-local managers. """ new = self._clone() new._root = new new._root_factory = self._root_factory._create_factory_copy() if new._factory._started: raise AssertionError('TransactionFactory is already started') return new def patch_factory(self, factory_or_manager): """Patch a _TransactionFactory into this manager. Replaces this manager's factory with the given one, and returns a callable that will reset the factory back to what we started with. Only works for root factories. Is intended for test suites that need to patch in alternate database configurations. The given argument may be a _TransactionContextManager or a _TransactionFactory. """ if isinstance(factory_or_manager, _TransactionContextManager): factory = factory_or_manager._factory elif isinstance(factory_or_manager, _TransactionFactory): factory = factory_or_manager else: raise ValueError( "_TransactionContextManager or " "_TransactionFactory expected.") if self._root is not self: raise AssertionError('patch_factory only works for root factory.') existing_factory = self._root_factory self._root_factory = factory def reset(): self._root_factory = existing_factory return reset def patch_engine(self, engine): """Patch an Engine into this manager. Replaces this manager's factory with a _TestTransactionFactory that will use the given Engine, and returns a callable that will reset the factory back to what we started with. Only works for root factories. Is intended for test suites that need to patch in alternate database configurations. """ existing_factory = self._factory if not existing_factory._started: existing_factory._start() maker = existing_factory._writer_maker maker_kwargs = existing_factory._maker_args_for_conf(cfg.CONF) maker = orm.get_maker(engine=engine, **maker_kwargs) factory = _TestTransactionFactory( engine, maker, apply_global=False, from_factory=existing_factory ) return self.patch_factory(factory) @property def replace(self): """Modifier to replace the global transaction factory with this one.""" return self._clone(replace_global_factory=self._factory) @property def writer(self): """Modifier to set the transaction to WRITER.""" return self._clone(mode=_WRITER) @property def reader(self): """Modifier to set the transaction to READER.""" return self._clone(mode=_READER) @property def allow_async(self): """Modifier to allow async operations Allows async operations if asynchronous session is already started in this context. Marking DB API methods with READER would make it impossible to use them in ASYNC_READER transactions, and marking them with ASYNC_READER would require a modification of all the places these DB API methods are called to force READER mode, where the latest DB state is required. In Nova DB API methods should have a 'safe' default (i.e. READER), so that they can start sessions on their own, but it would also be useful for them to be able to participate in an existing ASYNC_READER session, if one was started up the stack. """ if self._mode is _WRITER: raise TypeError("Setting async on a WRITER makes no sense") return self._clone(allow_async=True) @property def independent(self): """Modifier to start a transaction independent from any enclosing.""" return self._clone(independent=True) @property def savepoint(self): """Modifier to start a SAVEPOINT if a transaction already exists.""" return self._clone(savepoint=True) @property def connection(self): """Modifier to return a core Connection object instead of Session.""" return self._clone(connection=True) @property def async_(self): """Modifier to set a READER operation to ASYNC_READER.""" if self._mode is _WRITER: raise TypeError("Setting async on a WRITER makes no sense") return self._clone(mode=_ASYNC_READER) def using(self, context): """Provide a context manager block that will use the given context.""" return self._transaction_scope(context) def __call__(self, fn): """Decorate a function.""" argspec = utils.getargspec(fn) if argspec.args[0] == 'self' or argspec.args[0] == 'cls': context_index = 1 else: context_index = 0 context_kw = argspec.args[context_index] @functools.wraps(fn) def wrapper(*args, **kwargs): context = kwargs.get(context_kw, None) if not context: context = args[context_index] with self._transaction_scope(context): return fn(*args, **kwargs) return wrapper def _clone(self, **kw): default_kw = { "independent": self._independent, "mode": self._mode, "connection": self._connection } default_kw.update(kw) return _TransactionContextManager(root=self._root, **default_kw) @contextlib.contextmanager def _transaction_scope(self, context): new_transaction = self._independent transaction_contexts_by_thread = \ _transaction_contexts_by_thread(context) current = restore = getattr( transaction_contexts_by_thread, "current", None) use_factory = self._factory global_factory = None if self._replace_global_factory: use_factory = global_factory = self._replace_global_factory elif current is not None and current.global_factory: global_factory = current.global_factory if self._root._is_global_manager: use_factory = global_factory if current is not None and ( new_transaction or current.factory is not use_factory ): current = None if current is None: current = transaction_contexts_by_thread.current = \ _TransactionContext(use_factory, global_factory=global_factory) try: if self._mode is not None: with current._produce_block( mode=self._mode, connection=self._connection, savepoint=self._savepoint, allow_async=self._allow_async, context=context) as resource: yield resource else: yield finally: if restore is None: del transaction_contexts_by_thread.current elif current is not restore: transaction_contexts_by_thread.current = restore @property @debtcollector.moves.moved_property("async_") def async_compat(self): return self.async_ setattr( _TransactionContextManager, "async", async_compat ) def _context_descriptor(attr=None): getter = operator.attrgetter(attr) def _property_for_context(context): try: transaction_context = context.transaction_ctx except exception.NoEngineContextEstablished: raise exception.NoEngineContextEstablished( "No TransactionContext is established for " "this %s object within the current thread; " "the %r attribute is unavailable." % (context, attr) ) else: result = getter(transaction_context) if result is None: raise exception.ContextNotRequestedError( "The '%s' context attribute was requested but " "it has not been established for this context." % attr ) return result return property(_property_for_context) def _transaction_ctx_for_context(context): by_thread = _transaction_contexts_by_thread(context) try: return by_thread.current except AttributeError: raise exception.NoEngineContextEstablished( "No TransactionContext is established for " "this %s object within the current thread. " % context ) def _transaction_contexts_by_thread(context): transaction_contexts_by_thread = getattr( context, '_enginefacade_context', None) if transaction_contexts_by_thread is None: transaction_contexts_by_thread = \ context._enginefacade_context = _TransactionContextTLocal() return transaction_contexts_by_thread def transaction_context_provider(klass): """Decorate a class with ``session`` and ``connection`` attributes.""" setattr( klass, 'transaction_ctx', property(_transaction_ctx_for_context)) # Graft transaction context attributes as context properties for attr in ('session', 'connection', 'transaction'): setattr(klass, attr, _context_descriptor(attr)) return klass _context_manager = _TransactionContextManager(_is_global_manager=True) """default context manager.""" def transaction_context(): """Construct a local transaction context. """ return _TransactionContextManager() def configure(**kw): """Apply configurational options to the global factory. This method can only be called before any specific transaction-beginning methods have been called. .. seealso:: :meth:`._TransactionFactory.configure` """ _context_manager._factory.configure(**kw) def get_legacy_facade(): """Return a :class:`.LegacyEngineFacade` for the global factory. This facade will make use of the same engine and sessionmaker as this factory, however will not share the same transaction context; the legacy facade continues to work the old way of returning a new Session each time get_session() is called. """ return _context_manager.get_legacy_facade() reader = _context_manager.reader """The global 'reader' starting point.""" writer = _context_manager.writer """The global 'writer' starting point.""" class LegacyEngineFacade(object): """A helper class for removing of global engine instances from oslo.db. .. deprecated:: 1.12.0 Please use :mod:`oslo_db.sqlalchemy.enginefacade` for new development. As a library, oslo.db can't decide where to store/when to create engine and sessionmaker instances, so this must be left for a target application. On the other hand, in order to simplify the adoption of oslo.db changes, we'll provide a helper class, which creates engine and sessionmaker on its instantiation and provides get_engine()/get_session() methods that are compatible with corresponding utility functions that currently exist in target projects, e.g. in Nova. engine/sessionmaker instances will still be global (and they are meant to be global), but they will be stored in the app context, rather that in the oslo.db context. Two important things to remember: 1. An Engine instance is effectively a pool of DB connections, so it's meant to be shared (and it's thread-safe). 2. A Session instance is not meant to be shared and represents a DB transactional context (i.e. it's not thread-safe). sessionmaker is a factory of sessions. :param sql_connection: the connection string for the database to use :type sql_connection: string :param slave_connection: the connection string for the 'slave' database to use. If not provided, the master database will be used for all operations. Note: this is meant to be used for offloading of read operations to asynchronously replicated slaves to reduce the load on the master database. :type slave_connection: string :param sqlite_fk: enable foreign keys in SQLite :type sqlite_fk: bool :param autocommit: use autocommit mode for created Session instances :type autocommit: bool :param expire_on_commit: expire session objects on commit :type expire_on_commit: bool Keyword arguments: :keyword mysql_sql_mode: the SQL mode to be used for MySQL sessions. (defaults to TRADITIONAL) :keyword mysql_enable_ndb: If True, transparently enables support for handling MySQL Cluster (NDB). (defaults to False) :keyword connection_recycle_time: Time period for connections to be recycled upon checkout (defaults to 3600) :keyword connection_debug: verbosity of SQL debugging information. -1=Off, 0=None, 100=Everything (defaults to 0) :keyword max_pool_size: maximum number of SQL connections to keep open in a pool (defaults to SQLAlchemy settings) :keyword max_overflow: if set, use this value for max_overflow with sqlalchemy (defaults to SQLAlchemy settings) :keyword pool_timeout: if set, use this value for pool_timeout with sqlalchemy (defaults to SQLAlchemy settings) :keyword sqlite_synchronous: if True, SQLite uses synchronous mode (defaults to True) :keyword connection_trace: add python stack traces to SQL as comment strings (defaults to False) :keyword max_retries: maximum db connection retries during startup. (setting -1 implies an infinite retry count) (defaults to 10) :keyword retry_interval: interval between retries of opening a sql connection (defaults to 10) :keyword thread_checkin: boolean that indicates that between each engine checkin event a sleep(0) will occur to allow other greenthreads to run (defaults to True) """ def __init__(self, sql_connection, slave_connection=None, sqlite_fk=False, autocommit=True, expire_on_commit=False, _conf=None, _factory=None, **kwargs): warnings.warn( "EngineFacade is deprecated; please use " "oslo_db.sqlalchemy.enginefacade", warning.OsloDBDeprecationWarning, stacklevel=2) if _factory: self._factory = _factory else: self._factory = _TransactionFactory() self._factory.configure( sqlite_fk=sqlite_fk, __autocommit=autocommit, expire_on_commit=expire_on_commit, **kwargs ) # make sure passed-in urls are favored over that # of config self._factory._start( _conf, connection=sql_connection, slave_connection=slave_connection) def _check_factory_started(self): if not self._factory._started: self._factory._start() def get_engine(self, use_slave=False): """Get the engine instance (note, that it's shared). :param use_slave: if possible, use 'slave' database for this engine. If the connection string for the slave database wasn't provided, 'master' engine will be returned. (defaults to False) :type use_slave: bool """ self._check_factory_started() if use_slave: return self._factory._reader_engine else: return self._factory._writer_engine def get_session(self, use_slave=False, **kwargs): """Get a Session instance. :param use_slave: if possible, use 'slave' database connection for this session. If the connection string for the slave database wasn't provided, a session bound to the 'master' engine will be returned. (defaults to False) :type use_slave: bool Keyword arguments will be passed to a sessionmaker instance as is (if passed, they will override the ones used when the sessionmaker instance was created). See SQLAlchemy Session docs for details. """ self._check_factory_started() if use_slave: return self._factory._reader_maker(**kwargs) else: return self._factory._writer_maker(**kwargs) def get_sessionmaker(self, use_slave=False): """Get the sessionmaker instance used to create a Session. This can be called for those cases where the sessionmaker() is to be temporarily injected with some state such as a specific connection. """ self._check_factory_started() if use_slave: return self._factory._reader_maker else: return self._factory._writer_maker @classmethod def from_config(cls, conf, sqlite_fk=False, autocommit=True, expire_on_commit=False): """Initialize EngineFacade using oslo.config config instance options. :param conf: oslo.config config instance :type conf: oslo_config.cfg.ConfigOpts :param sqlite_fk: enable foreign keys in SQLite :type sqlite_fk: bool :param autocommit: use autocommit mode for created Session instances :type autocommit: bool :param expire_on_commit: expire session objects on commit :type expire_on_commit: bool """ return cls( None, sqlite_fk=sqlite_fk, autocommit=autocommit, expire_on_commit=expire_on_commit, _conf=conf)
[ 1, 396, 1678, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 13, 29937, 1678, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 887, 1122, 4017, 13, 29937, 1678, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 308, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 1678, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 1678, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 13, 29937, 1678, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 13, 29937, 1678, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1678, 1090, 278, 19245, 29889, 13, 13, 5215, 3030, 1982, 13, 5215, 2090, 312, 8789, 13, 5215, 5455, 13, 5215, 3244, 292, 13, 5215, 18116, 13, 13, 5215, 2553, 29873, 15914, 272, 29889, 13529, 267, 13, 5215, 2553, 29873, 15914, 272, 29889, 1745, 586, 1338, 13, 5215, 2553, 29873, 15914, 272, 29889, 1267, 1280, 13, 3166, 2897, 417, 29918, 2917, 1053, 274, 16434, 13, 3166, 2897, 417, 29918, 13239, 1053, 5566, 13239, 13, 13, 3166, 2897, 417, 29918, 2585, 1053, 3682, 13, 3166, 2897, 417, 29918, 2585, 1053, 3987, 13, 3166, 2897, 417, 29918, 2585, 29889, 2850, 284, 305, 6764, 1053, 24000, 13, 3166, 2897, 417, 29918, 2585, 29889, 2850, 284, 305, 6764, 1053, 470, 29885, 13, 3166, 2897, 417, 29918, 2585, 29889, 2850, 284, 305, 6764, 1053, 3667, 29879, 13, 3166, 2897, 417, 29918, 2585, 1053, 9177, 13, 13, 13, 1990, 903, 18098, 29898, 3318, 1125, 13, 1678, 9995, 276, 6338, 263, 4343, 5829, 1213, 15945, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 525, 978, 742, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 376, 18098, 29414, 29878, 5513, 1273, 1583, 29889, 978, 13, 13, 13, 29918, 3289, 29979, 15868, 29918, 16310, 1001, 353, 903, 18098, 877, 3289, 29979, 15868, 29918, 16310, 1001, 1495, 13, 15945, 29908, 1123, 6338, 278, 10804, 2106, 310, 376, 12674, 9591, 1642, 13, 13, 4013, 2106, 14088, 393, 278, 10804, 338, 263, 1303, 29899, 6194, 322, 338, 13, 11177, 304, 671, 373, 385, 408, 9524, 5794, 4784, 19532, 2566, 29889, 13, 13, 15945, 29908, 13, 13, 29918, 16310, 1001, 353, 903, 18098, 877, 16310, 1001, 1495, 13, 15945, 29908, 1123, 6338, 278, 10804, 2106, 310, 376, 16950, 1642, 13, 13, 4013, 2106, 14088, 393, 278, 10804, 338, 263, 1303, 29899, 6194, 322, 338, 13, 6194, 9109, 304, 671, 373, 263, 12231, 5794, 4784, 19532, 2566, 29936, 6467, 13, 1552, 5835, 2566, 881, 367, 1304, 29889, 13, 13, 15945, 29908, 13, 13, 13, 29918, 9980, 1806, 1001, 353, 903, 18098, 877, 9980, 1806, 1001, 1495, 13, 15945, 29908, 1123, 6338, 278, 10804, 2106, 310, 376, 13236, 1642, 13, 13, 4013, 2106, 14088, 393, 278, 10804, 15873, 848, 322, 13, 9344, 367, 10624, 472, 278, 5835, 2566, 29889, 13, 13, 15945, 29908, 13, 13, 13, 1990, 903, 4592, 29898, 3318, 1125, 13, 1678, 9995, 9802, 263, 995, 408, 263, 2322, 995, 29889, 13, 13, 1678, 319, 995, 297, 278, 1887, 5285, 8600, 21021, 411, 13, 1678, 903, 4592, 580, 674, 451, 2125, 9399, 663, 975, 263, 995, 393, 338, 6790, 13, 1678, 297, 274, 16434, 29889, 6007, 29943, 29889, 259, 2630, 1041, 393, 526, 731, 1156, 278, 2114, 773, 10822, 580, 13, 1678, 674, 480, 6774, 2742, 1906, 297, 274, 16434, 29889, 6007, 29943, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 4770, 2536, 1862, 1649, 353, 525, 1767, 742, 13, 13, 1678, 903, 1333, 842, 353, 903, 18098, 703, 12256, 10490, 1159, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 995, 29922, 29918, 1333, 842, 1125, 13, 4706, 1583, 29889, 1767, 353, 995, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 8814, 29898, 25932, 29892, 995, 1125, 13, 4706, 565, 338, 8758, 29898, 1767, 29892, 903, 4592, 1125, 13, 9651, 325, 353, 995, 29889, 1767, 13, 9651, 565, 325, 338, 1067, 29879, 3032, 1333, 842, 29901, 13, 18884, 736, 6213, 13, 9651, 1683, 29901, 13, 18884, 736, 325, 13, 4706, 1683, 29901, 13, 9651, 736, 995, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 8814, 29918, 29893, 29918, 5527, 29898, 25932, 29892, 995, 29892, 1970, 29918, 22377, 29892, 1820, 1125, 13, 4706, 565, 338, 8758, 29898, 1767, 29892, 903, 4592, 1125, 13, 9651, 325, 353, 679, 5552, 29898, 5527, 29918, 22377, 29892, 1820, 29892, 995, 29889, 1767, 29897, 13, 9651, 565, 325, 338, 1067, 29879, 3032, 1333, 842, 29901, 13, 18884, 736, 6213, 13, 9651, 1683, 29901, 13, 18884, 736, 325, 13, 4706, 1683, 29901, 13, 9651, 736, 995, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 338, 29918, 842, 29898, 25932, 29892, 995, 1125, 13, 4706, 736, 451, 338, 8758, 29898, 1767, 29892, 903, 4592, 29897, 470, 320, 13, 9651, 995, 29889, 1767, 338, 451, 1067, 29879, 3032, 1333, 842, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 338, 29918, 842, 29918, 29893, 29918, 5527, 29898, 25932, 29892, 995, 29892, 1970, 29918, 22377, 29892, 1820, 1125, 13, 4706, 736, 451, 338, 8758, 29898, 1767, 29892, 903, 4592, 29897, 470, 320, 13, 9651, 995, 29889, 1767, 338, 451, 1067, 29879, 3032, 1333, 842, 470, 320, 13, 9651, 756, 5552, 29898, 5527, 29918, 22377, 29892, 1820, 29897, 13, 13, 13, 1990, 838, 2040, 4763, 287, 2392, 29898, 1542, 2392, 1125, 13, 1678, 9995, 29934, 1759, 267, 746, 263, 12529, 338, 1641, 4433, 304, 11905, 263, 1473, 931, 29889, 13, 13, 1678, 3323, 13203, 584, 1990, 29901, 1412, 1542, 2392, 29952, 363, 25000, 2304, 29889, 13, 13, 1678, 9995, 13, 13, 13, 1990, 903, 12460, 5126, 29898, 3318, 1125, 13, 1678, 9995, 29909, 12529, 363, 584, 1990, 29901, 1412, 29918, 12460, 2677, 29952, 3618, 29889, 13, 13, 1678, 2648, 2322, 29892, 727, 338, 925, 697, 310, 1438, 29892, 731, 701, 13, 1678, 2729, 373, 8707, 29943, 29892, 3138, 2777, 29899, 5563, 584, 1990, 29901, 1412, 29918, 12460, 5126, 29952, 13, 1678, 3618, 508, 367, 1754, 29892, 408, 338, 278, 1206, 411, 278, 13, 1678, 584, 1990, 29901, 1412, 29918, 3057, 12460, 5126, 29952, 19481, 1304, 491, 278, 2897, 417, 29889, 2585, 1243, 9460, 29889, 13, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 3032, 2271, 29918, 16859, 353, 426, 13, 9651, 525, 9965, 2396, 903, 4592, 3285, 13, 9651, 525, 29879, 18398, 29918, 9965, 2396, 903, 4592, 3285, 13, 4706, 500, 13, 4706, 1583, 3032, 10599, 29918, 16859, 353, 426, 13, 9651, 525, 22793, 29918, 29888, 29895, 2396, 903, 4592, 29898, 8824, 511, 13, 9651, 525, 7938, 29918, 2850, 29918, 8513, 2396, 903, 4592, 877, 5659, 3035, 22122, 1964, 5477, 13, 9651, 525, 7938, 29918, 12007, 29918, 299, 29890, 2396, 903, 4592, 29898, 8824, 511, 13, 9651, 525, 9965, 29918, 276, 23090, 29918, 2230, 2396, 903, 4592, 29898, 29941, 29953, 29900, 29900, 511, 13, 9651, 525, 9965, 29918, 8382, 2396, 903, 4592, 29898, 29900, 511, 13, 9651, 525, 3317, 29918, 10109, 29918, 2311, 2396, 903, 4592, 3285, 13, 9651, 525, 3317, 29918, 2262, 2396, 903, 4592, 3285, 13, 9651, 525, 10109, 29918, 15619, 2396, 903, 4592, 3285, 13, 9651, 525, 22793, 29918, 29879, 15374, 2396, 903, 4592, 29898, 5574, 511, 13, 9651, 525, 9965, 29918, 15003, 2396, 903, 4592, 29898, 8824, 511, 13, 9651, 525, 3317, 29918, 2267, 2722, 2396, 903, 4592, 29898, 29896, 29900, 511, 13, 9651, 525, 276, 2202, 29918, 19207, 2396, 903, 4592, 29898, 29896, 29900, 511, 13, 9651, 525, 7097, 29918, 3198, 262, 2396, 903, 4592, 29898, 5574, 511, 13, 9651, 525, 3126, 29918, 15550, 3950, 2396, 903, 4592, 29898, 8516, 511, 13, 9651, 525, 3126, 29918, 2783, 261, 616, 3950, 2396, 903, 4592, 29898, 8516, 511, 13, 9651, 525, 21027, 29918, 978, 2396, 903, 4592, 29898, 8516, 511, 13, 9651, 525, 9965, 29918, 16744, 2396, 903, 4592, 29898, 8516, 29897, 13, 4706, 500, 13, 4706, 1583, 3032, 28107, 29918, 16859, 353, 426, 13, 9651, 525, 4548, 533, 29918, 265, 29918, 15060, 2396, 903, 4592, 29898, 8824, 511, 13, 9651, 525, 1649, 6921, 15060, 2396, 5852, 13, 4706, 500, 13, 4706, 1583, 3032, 20736, 29918, 13073, 29918, 16859, 353, 426, 13, 9651, 525, 1245, 1627, 29918, 16950, 29918, 29879, 10964, 2396, 7700, 29892, 13, 9651, 525, 23126, 29918, 265, 29918, 1491, 20736, 2396, 7700, 29892, 13, 9651, 500, 13, 4706, 1583, 3032, 17470, 1943, 29918, 16859, 353, 426, 13, 9651, 525, 29879, 15374, 29918, 16950, 2396, 5852, 29892, 13, 9651, 525, 265, 29918, 10599, 29918, 3258, 2396, 19997, 13, 4706, 500, 13, 13, 4706, 396, 916, 3987, 393, 526, 3342, 297, 2897, 417, 29918, 2585, 29889, 6768, 29889, 9803, 29918, 25707, 13, 4706, 396, 470, 2897, 417, 29918, 2585, 29889, 535, 26095, 29889, 29873, 10109, 29918, 25707, 541, 437, 451, 3394, 304, 278, 3918, 13, 4706, 396, 6012, 17470, 1943, 6273, 313, 3242, 2833, 304, 3394, 304, 7882, 29889, 4051, 8787, 467, 13, 4706, 1583, 3032, 647, 4395, 29918, 16859, 353, 9657, 29898, 13, 9651, 313, 29895, 29892, 903, 4592, 29898, 8516, 876, 363, 413, 297, 518, 13, 18884, 525, 2585, 29918, 3317, 29918, 2267, 2722, 742, 525, 2585, 29918, 3742, 29918, 276, 2202, 29918, 19207, 742, 13, 18884, 525, 1509, 29918, 2585, 29918, 276, 6915, 742, 13, 18884, 525, 2585, 29918, 276, 2202, 29918, 19207, 742, 13, 18884, 525, 2585, 29918, 3317, 29918, 276, 2202, 29918, 19207, 742, 525, 27852, 742, 525, 1509, 29918, 29873, 10109, 11287, 13, 13, 4706, 1583, 3032, 2962, 287, 353, 7700, 13, 4706, 1583, 3032, 1397, 4135, 29918, 17470, 1943, 353, 6213, 13, 4706, 1583, 3032, 2962, 29918, 908, 353, 3244, 292, 29889, 16542, 580, 13, 13, 1678, 732, 311, 3116, 15914, 272, 29889, 1267, 1280, 29889, 1267, 2795, 29918, 11022, 1191, 29898, 13, 4706, 376, 333, 280, 29918, 15619, 613, 376, 9965, 29918, 276, 23090, 29918, 2230, 613, 5191, 29922, 5574, 29897, 13, 1678, 822, 10822, 29918, 4381, 29879, 29898, 1311, 29892, 3579, 11022, 1125, 13, 4706, 9995, 2052, 368, 2322, 17127, 1288, 3987, 29889, 13, 13, 4706, 910, 1158, 508, 871, 367, 2000, 1434, 738, 2702, 13, 4706, 10804, 29899, 463, 1076, 3519, 505, 1063, 2000, 29889, 13, 13, 4706, 12782, 332, 1288, 3987, 526, 2629, 263, 4343, 731, 310, 6611, 29892, 322, 6416, 13, 4706, 1090, 2211, 13997, 29901, 3988, 5285, 29892, 6012, 5285, 29892, 13, 4706, 322, 4867, 5285, 29889, 29871, 7806, 1820, 2183, 674, 367, 9528, 2750, 13, 4706, 1438, 2211, 5285, 6166, 304, 1074, 607, 697, 338, 22903, 29936, 565, 13, 4706, 372, 338, 451, 22903, 304, 738, 731, 29892, 385, 3682, 338, 10425, 29889, 13, 13, 4706, 450, 17127, 1288, 3987, 2183, 1244, 1044, 408, 3579, 4381, 29879, 1068, 13, 4706, 746, 278, 584, 1990, 29901, 1412, 29918, 12460, 5126, 29952, 338, 13252, 773, 13, 4706, 263, 584, 1990, 18078, 359, 417, 29918, 2917, 29889, 16859, 29889, 3991, 29949, 16485, 29952, 1203, 29936, 278, 3987, 13, 4706, 2198, 2629, 278, 584, 1990, 18078, 359, 417, 29918, 2917, 29889, 16859, 29889, 3991, 29949, 16485, 29952, 3579, 19730, 13, 4706, 9399, 663, 1068, 23797, 278, 6273, 4502, 1244, 29889, 29871, 2648, 2322, 29892, 13, 4706, 278, 584, 1990, 29901, 1412, 29918, 12460, 5126, 29952, 15376, 297, 278, 5285, 515, 13, 4706, 584, 1272, 18078, 359, 417, 29918, 2917, 29889, 16859, 29889, 6007, 29943, 1673, 1156, 15399, 278, 13, 4706, 584, 1272, 18078, 359, 417, 29918, 2585, 29889, 6768, 29889, 9803, 29918, 25707, 29952, 17127, 1288, 21274, 304, 372, 29889, 13, 13, 4706, 584, 3207, 3957, 29901, 2566, 3988, 13, 13, 4706, 584, 3207, 19532, 29918, 9965, 29901, 2566, 3988, 13, 13, 4706, 584, 3207, 21120, 29918, 29888, 29895, 29901, 3692, 304, 9025, 23299, 9117, 1820, 282, 23929, 29936, 2322, 13, 308, 7700, 13, 13, 4706, 584, 3207, 5749, 29918, 2850, 29918, 8513, 29901, 9254, 3758, 4464, 29892, 21274, 304, 10014, 3035, 22122, 1964, 13, 13, 4706, 584, 3207, 5749, 29918, 12007, 29918, 299, 29890, 29901, 9025, 9254, 2233, 5402, 313, 2797, 29933, 29897, 2304, 13, 13, 4706, 584, 3207, 3957, 29918, 276, 23090, 29918, 2230, 29901, 3957, 11565, 1162, 13317, 931, 29892, 13, 308, 21274, 304, 29871, 29941, 29953, 29900, 29900, 29889, 3940, 278, 3957, 947, 451, 2869, 505, 304, 13, 308, 367, 376, 333, 280, 29908, 304, 367, 1162, 11078, 839, 29889, 13, 13, 4706, 584, 3207, 3957, 29918, 8382, 29901, 6012, 12183, 3233, 29892, 21274, 304, 29871, 29900, 29889, 731, 304, 13, 3986, 29945, 29900, 363, 15233, 29892, 29871, 29896, 29900, 29900, 363, 21681, 29889, 13, 13, 4706, 584, 3207, 3957, 29918, 16744, 29901, 5684, 4128, 304, 9773, 11480, 278, 13, 308, 2566, 3988, 2346, 1347, 29892, 1209, 408, 376, 3207, 29896, 29922, 1767, 29896, 29987, 3207, 29906, 29922, 1767, 29906, 29987, 17794, 13, 13, 4706, 584, 3207, 4236, 29918, 10109, 29918, 2311, 29901, 4236, 2159, 310, 3957, 11565, 29892, 3913, 8707, 29943, 363, 13, 308, 2322, 13, 13, 4706, 584, 3207, 4236, 29918, 2262, 29901, 4236, 11969, 363, 3957, 11565, 29892, 3913, 8707, 29943, 363, 13, 308, 2322, 13, 13, 4706, 584, 3207, 21120, 29918, 29879, 15374, 29901, 11262, 23299, 28962, 29940, 3210, 29934, 1164, 29949, 3308, 282, 23929, 565, 7700, 29936, 13, 308, 21274, 304, 5852, 13, 13, 4706, 584, 3207, 3957, 29918, 15003, 29901, 9025, 16703, 292, 6589, 297, 12183, 13, 13, 4706, 584, 3207, 4236, 29918, 2267, 2722, 29901, 4236, 3240, 2722, 304, 4511, 29892, 21274, 304, 1738, 29900, 13, 13, 4706, 584, 3207, 337, 2202, 29918, 19207, 29901, 931, 297, 6923, 1546, 3240, 2722, 29892, 21274, 304, 29871, 29896, 29900, 13, 13, 4706, 584, 3207, 3244, 29918, 3198, 262, 29901, 788, 8709, 29898, 29900, 29897, 373, 3957, 1423, 262, 304, 2758, 13, 308, 7933, 1026, 17498, 29892, 21274, 304, 5852, 13, 13, 4706, 584, 3207, 4390, 29918, 15550, 3950, 29901, 4663, 7797, 3950, 363, 4918, 7979, 4176, 12368, 13, 13, 4706, 584, 3207, 4390, 29918, 2783, 261, 616, 3950, 29901, 4663, 16964, 616, 3950, 363, 4918, 7979, 4176, 12368, 13, 13, 4706, 584, 3207, 12183, 29918, 978, 29901, 12183, 1024, 363, 6012, 13, 13, 4706, 584, 3207, 1518, 533, 29918, 265, 29918, 15060, 29901, 6166, 1518, 533, 29918, 265, 29918, 15060, 363, 3758, 2499, 305, 6764, 13, 308, 4867, 28107, 29936, 21274, 304, 7700, 13, 13, 4706, 584, 3207, 9679, 1627, 29918, 16950, 29918, 29879, 10964, 29901, 565, 5852, 29892, 263, 584, 1990, 29901, 1412, 7317, 29952, 1203, 13, 308, 674, 505, 967, 584, 29885, 621, 29901, 1412, 7317, 29889, 1245, 1627, 29952, 1158, 22336, 472, 278, 1095, 13, 308, 310, 263, 4954, 29992, 16950, 16159, 2908, 29892, 1044, 3598, 27777, 1250, 278, 10804, 322, 13, 308, 1518, 8491, 278, 3618, 2629, 29892, 1434, 278, 584, 1990, 29901, 1412, 7317, 29952, 16229, 13, 308, 373, 304, 367, 5764, 29892, 607, 756, 278, 2779, 310, 337, 280, 5832, 3957, 13, 308, 7788, 1250, 304, 278, 3957, 11565, 322, 1439, 9733, 599, 3618, 29889, 13, 308, 960, 7700, 29892, 278, 584, 1990, 29901, 1412, 7317, 29952, 338, 13, 308, 451, 15201, 472, 278, 1095, 310, 263, 4954, 29992, 16950, 16159, 2908, 29936, 278, 14407, 13, 308, 3957, 12992, 304, 491, 445, 584, 1990, 29901, 1412, 7317, 29952, 674, 1603, 13, 308, 367, 5492, 297, 278, 427, 11291, 292, 3030, 3025, 278, 584, 29885, 621, 29901, 1412, 7317, 29889, 5358, 29952, 13, 308, 1158, 29892, 607, 1603, 5662, 1973, 393, 278, 360, 5688, 2227, 3957, 338, 29081, 13, 308, 1250, 29892, 3138, 278, 3618, 6942, 411, 278, 584, 1990, 29901, 1412, 7317, 29952, 13, 308, 11551, 1009, 2566, 29899, 6774, 12652, 8118, 1156, 896, 526, 1439, 3791, 29889, 13, 13, 308, 6317, 1074, 15189, 1057, 13, 13, 9651, 1732, 597, 2640, 29889, 2850, 284, 305, 6764, 29889, 990, 29914, 264, 29914, 2674, 29918, 29900, 29918, 29929, 29914, 3820, 2209, 653, 29889, 1420, 29937, 8489, 29899, 276, 4611, 29905, 13, 9651, 3758, 2499, 305, 6764, 5106, 373, 825, 376, 276, 280, 5832, 7788, 29908, 2794, 29889, 13, 13, 4706, 584, 3207, 12231, 681, 29918, 16950, 29901, 3692, 470, 451, 304, 5251, 263, 376, 16950, 29908, 3030, 13, 308, 4225, 304, 18818, 372, 508, 1303, 848, 19355, 491, 263, 376, 13236, 29908, 10241, 13, 308, 1634, 1414, 11755, 338, 2198, 29936, 21274, 304, 5852, 29889, 29871, 1932, 7700, 29892, 263, 13, 308, 732, 16950, 3030, 1736, 278, 1021, 408, 732, 12674, 29918, 16950, 322, 674, 1831, 13, 308, 278, 376, 29879, 18398, 29908, 2566, 565, 2198, 29889, 13, 13, 4706, 584, 3207, 28371, 29918, 265, 29918, 1491, 20736, 29901, 565, 5852, 29892, 263, 584, 1990, 29901, 1412, 7317, 29952, 1203, 13, 308, 674, 505, 967, 584, 29885, 621, 29901, 1412, 7317, 29889, 23126, 29952, 1158, 22336, 10940, 263, 3030, 13, 308, 8455, 470, 10200, 1061, 393, 338, 451, 3528, 278, 3978, 1061, 310, 278, 2246, 29899, 13, 308, 3233, 470, 4078, 3149, 584, 1990, 29901, 1412, 7317, 29952, 10804, 429, 1169, 448, 297, 445, 982, 13, 308, 372, 4010, 267, 763, 263, 376, 1491, 20736, 29908, 515, 263, 584, 1990, 29901, 1412, 7317, 29952, 13, 308, 18520, 29889, 13, 13, 4706, 6317, 1074, 15189, 1057, 13, 13, 9651, 584, 29885, 621, 29901, 1412, 29918, 12460, 5126, 29889, 17591, 29952, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 17591, 29898, 5574, 29892, 9049, 29897, 13, 13, 1678, 732, 311, 3116, 15914, 272, 29889, 1267, 1280, 29889, 1267, 2795, 29918, 11022, 1191, 29898, 13, 4706, 376, 333, 280, 29918, 15619, 613, 376, 9965, 29918, 276, 23090, 29918, 2230, 613, 5191, 29922, 5574, 29897, 13, 1678, 822, 10822, 29898, 1311, 29892, 3579, 11022, 1125, 13, 4706, 9995, 2052, 368, 17127, 1288, 3987, 29889, 13, 13, 4706, 910, 1158, 508, 871, 367, 2000, 1434, 738, 2702, 13, 4706, 10804, 29899, 463, 1076, 3519, 505, 1063, 2000, 29889, 13, 13, 4706, 1522, 16300, 1244, 338, 278, 1021, 408, 393, 310, 13, 4706, 584, 29885, 621, 29901, 1412, 29918, 12460, 5126, 29889, 17591, 29918, 4381, 29879, 1673, 13, 4706, 411, 278, 3682, 393, 1819, 6790, 1244, 674, 3579, 12587, 414, 2742, 1068, 1906, 13, 4706, 6230, 297, 278, 584, 1990, 18078, 359, 417, 29918, 2917, 29889, 16859, 29889, 3991, 29949, 16485, 29952, 3987, 29889, 29871, 2823, 13, 4706, 393, 1158, 363, 263, 18028, 310, 599, 13553, 6273, 29889, 13, 13, 4706, 6317, 1074, 15189, 1057, 13, 13, 9651, 584, 29885, 621, 29901, 1412, 29918, 12460, 5126, 29889, 17591, 29918, 4381, 29879, 29952, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 17591, 29898, 8824, 29892, 9049, 29897, 13, 13, 1678, 822, 903, 17591, 29898, 1311, 29892, 408, 29918, 4381, 29879, 29892, 9049, 1125, 13, 13, 4706, 565, 1583, 3032, 2962, 287, 29901, 13, 9651, 12020, 838, 2040, 4763, 287, 2392, 29898, 13, 18884, 376, 1366, 4103, 2467, 5126, 338, 2307, 4687, 1159, 13, 4706, 451, 29918, 23765, 353, 5159, 13, 4706, 363, 413, 29892, 325, 297, 9049, 29889, 7076, 7295, 13, 9651, 363, 9657, 29918, 297, 313, 13, 462, 1678, 1583, 3032, 2271, 29918, 16859, 29892, 1583, 3032, 10599, 29918, 16859, 29892, 13, 462, 1678, 1583, 3032, 28107, 29918, 16859, 29892, 1583, 3032, 647, 4395, 29918, 16859, 29892, 13, 462, 1678, 1583, 3032, 17470, 1943, 29918, 16859, 29892, 1583, 3032, 20736, 29918, 13073, 29918, 16859, 1125, 13, 18884, 565, 413, 297, 9657, 29918, 29901, 13, 462, 1678, 9657, 29918, 29961, 29895, 29962, 353, 903, 4592, 29898, 29894, 29897, 565, 408, 29918, 4381, 29879, 1683, 325, 13, 462, 1678, 2867, 13, 9651, 1683, 29901, 13, 18884, 451, 29918, 23765, 29889, 4397, 29898, 29895, 29897, 13, 13, 4706, 565, 451, 29918, 23765, 29901, 13, 9651, 396, 723, 763, 304, 12020, 7865, 2392, 1244, 29892, 541, 727, 526, 925, 13, 9651, 396, 2086, 1784, 443, 29423, 1891, 313, 711, 2170, 371, 7897, 5285, 3987, 13, 9651, 396, 6421, 297, 515, 9279, 13, 9651, 18116, 29889, 25442, 29898, 13, 18884, 376, 8614, 2984, 29898, 29879, 29897, 1273, 29878, 451, 6969, 29908, 1273, 13, 18884, 12705, 29898, 1333, 29918, 23765, 511, 13, 18884, 9177, 29889, 3664, 14039, 287, 22709, 13, 9651, 1723, 13, 13, 1678, 822, 679, 29918, 1397, 4135, 29918, 17470, 1943, 29898, 1311, 1125, 13, 4706, 9995, 11609, 263, 584, 1990, 29901, 1412, 22988, 4135, 12412, 29943, 562, 1943, 29952, 363, 445, 12529, 29889, 13, 13, 4706, 910, 4024, 1943, 674, 1207, 671, 310, 278, 1021, 6012, 322, 4867, 28107, 13, 4706, 408, 445, 12529, 29892, 3138, 674, 451, 6232, 278, 1021, 10804, 3030, 29936, 13, 4706, 278, 25000, 4024, 1943, 18172, 304, 664, 278, 2030, 982, 310, 7863, 13, 4706, 263, 716, 16441, 1269, 931, 679, 29918, 7924, 580, 338, 2000, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 3032, 1397, 4135, 29918, 17470, 1943, 29901, 13, 9651, 1583, 3032, 1397, 4135, 29918, 17470, 1943, 353, 5682, 4135, 12412, 29943, 562, 1943, 29898, 8516, 29892, 903, 14399, 29922, 1311, 29897, 13, 9651, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 18884, 1583, 3032, 2962, 580, 13, 13, 4706, 736, 1583, 3032, 1397, 4135, 29918, 17470, 1943, 13, 13, 1678, 822, 679, 29918, 13236, 29918, 10599, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 9227, 6012, 363, 445, 12529, 29889, 13, 13, 4706, 14305, 3687, 1369, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 9651, 1583, 3032, 2962, 580, 13, 4706, 736, 1583, 3032, 13236, 29918, 10599, 13, 13, 1678, 822, 679, 29918, 16950, 29918, 10599, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 9591, 6012, 363, 445, 12529, 29889, 13, 13, 4706, 14305, 3687, 1369, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 9651, 1583, 3032, 2962, 580, 13, 4706, 736, 1583, 3032, 16950, 29918, 10599, 13, 13, 1678, 822, 679, 29918, 13236, 29918, 28107, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 9227, 4867, 28107, 363, 445, 12529, 29889, 13, 13, 4706, 14305, 3687, 1369, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 9651, 1583, 3032, 2962, 580, 13, 4706, 736, 1583, 3032, 13236, 29918, 28107, 13, 13, 1678, 822, 679, 29918, 16950, 29918, 28107, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 9591, 4867, 28107, 363, 445, 12529, 29889, 13, 13, 4706, 14305, 3687, 1369, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 9651, 1583, 3032, 2962, 580, 13, 4706, 736, 1583, 3032, 16950, 29918, 28107, 13, 13, 1678, 822, 903, 3258, 29918, 9965, 29898, 1311, 29892, 4464, 1125, 13, 4706, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 9651, 1583, 3032, 2962, 580, 13, 4706, 565, 4464, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 736, 1583, 3032, 13236, 29918, 10599, 29889, 6915, 580, 13, 4706, 25342, 4464, 338, 903, 3289, 29979, 15868, 29918, 16310, 1001, 470, 320, 13, 18884, 313, 8513, 338, 903, 16310, 1001, 322, 451, 1583, 29889, 29879, 15374, 29918, 16950, 1125, 13, 9651, 736, 1583, 3032, 16950, 29918, 10599, 29889, 6915, 580, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 13236, 29918, 10599, 29889, 6915, 580, 13, 13, 1678, 822, 903, 3258, 29918, 7924, 29898, 1311, 29892, 4464, 29892, 7868, 29922, 8516, 1125, 13, 4706, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 9651, 1583, 3032, 2962, 580, 13, 4706, 9049, 353, 6571, 13, 4706, 396, 1016, 29915, 29873, 1209, 525, 5355, 29915, 565, 7868, 338, 6213, 29936, 278, 4867, 28107, 13, 4706, 396, 2307, 756, 263, 7868, 304, 278, 6012, 29889, 13, 4706, 565, 7868, 29901, 13, 9651, 9049, 1839, 5355, 2033, 353, 7868, 13, 4706, 565, 4464, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 736, 1583, 3032, 13236, 29918, 28107, 29898, 1068, 11022, 29897, 13, 4706, 25342, 4464, 338, 903, 3289, 29979, 15868, 29918, 16310, 1001, 470, 320, 13, 18884, 313, 8513, 338, 903, 16310, 1001, 322, 451, 1583, 29889, 29879, 15374, 29918, 16950, 1125, 13, 9651, 736, 1583, 3032, 16950, 29918, 28107, 29898, 1068, 11022, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 13236, 29918, 28107, 29898, 1068, 11022, 29897, 13, 13, 1678, 822, 903, 3258, 29918, 14399, 29918, 8552, 29898, 1311, 1125, 13, 4706, 12529, 353, 903, 12460, 5126, 580, 13, 4706, 12529, 3032, 2271, 29918, 16859, 29889, 5504, 29898, 1311, 3032, 2271, 29918, 16859, 29897, 13, 4706, 12529, 3032, 10599, 29918, 16859, 29889, 5504, 29898, 1311, 3032, 10599, 29918, 16859, 29897, 13, 4706, 12529, 3032, 28107, 29918, 16859, 29889, 5504, 29898, 1311, 3032, 28107, 29918, 16859, 29897, 13, 4706, 12529, 3032, 20736, 29918, 13073, 29918, 16859, 29889, 5504, 29898, 1311, 3032, 20736, 29918, 13073, 29918, 16859, 29897, 13, 4706, 12529, 3032, 17470, 1943, 29918, 16859, 29889, 5504, 29898, 1311, 3032, 17470, 1943, 29918, 16859, 29897, 13, 4706, 736, 12529, 13, 13, 1678, 822, 903, 5085, 29918, 1454, 29918, 5527, 29898, 1311, 29892, 2322, 29918, 16859, 29892, 1970, 1125, 13, 4706, 565, 1970, 338, 6213, 29901, 13, 9651, 736, 9657, 29898, 13, 18884, 313, 1989, 29892, 903, 4592, 29889, 17863, 29898, 1767, 876, 13, 18884, 363, 1820, 29892, 995, 297, 2322, 29918, 16859, 29889, 7076, 580, 13, 18884, 565, 903, 4592, 29889, 275, 29918, 842, 29898, 1767, 29897, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 736, 9657, 29898, 13, 18884, 313, 1989, 29892, 903, 4592, 29889, 17863, 29918, 29893, 29918, 5527, 29898, 1767, 29892, 1970, 29889, 9803, 29892, 1820, 876, 13, 18884, 363, 1820, 29892, 995, 297, 2322, 29918, 16859, 29889, 7076, 580, 13, 18884, 565, 903, 4592, 29889, 275, 29918, 842, 29918, 29893, 29918, 5527, 29898, 1767, 29892, 1970, 29889, 9803, 29892, 1820, 29897, 13, 9651, 1723, 13, 13, 1678, 822, 903, 2271, 29918, 5085, 29918, 1454, 29918, 5527, 29898, 1311, 29892, 1970, 1125, 13, 4706, 736, 1583, 3032, 5085, 29918, 1454, 29918, 5527, 29898, 1311, 3032, 2271, 29918, 16859, 29892, 1970, 29897, 13, 13, 1678, 822, 903, 10599, 29918, 5085, 29918, 1454, 29918, 5527, 29898, 1311, 29892, 1970, 1125, 13, 4706, 736, 1583, 3032, 5085, 29918, 1454, 29918, 5527, 29898, 1311, 3032, 10599, 29918, 16859, 29892, 1970, 29897, 13, 13, 1678, 822, 903, 28107, 29918, 5085, 29918, 1454, 29918, 5527, 29898, 1311, 29892, 1970, 1125, 13, 4706, 2136, 261, 29918, 5085, 353, 1583, 3032, 5085, 29918, 1454, 29918, 5527, 29898, 1311, 3032, 28107, 29918, 16859, 29892, 1970, 29897, 13, 4706, 2136, 261, 29918, 5085, 1839, 6921, 15060, 2033, 353, 2136, 261, 29918, 5085, 29889, 7323, 877, 1649, 6921, 15060, 1495, 13, 4706, 736, 2136, 261, 29918, 5085, 13, 13, 1678, 822, 27905, 29918, 10109, 29898, 1311, 1125, 13, 4706, 9995, 5594, 6012, 29889, 10109, 29889, 2218, 4220, 580, 373, 14407, 10863, 3618, 1213, 15945, 13, 4706, 411, 1583, 3032, 2962, 29918, 908, 29901, 13, 9651, 565, 451, 1583, 3032, 2962, 287, 29901, 13, 18884, 736, 13, 13, 9651, 1583, 3032, 13236, 29918, 10599, 29889, 10109, 29889, 2218, 4220, 580, 13, 9651, 565, 1583, 3032, 16950, 29918, 10599, 338, 451, 1583, 3032, 13236, 29918, 10599, 29901, 13, 18884, 1583, 3032, 16950, 29918, 10599, 29889, 10109, 29889, 2218, 4220, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 2962, 287, 29898, 1311, 1125, 13, 4706, 9995, 5574, 565, 445, 584, 1990, 29901, 1412, 29918, 12460, 5126, 29952, 338, 2307, 4687, 1213, 15945, 13, 4706, 736, 1583, 3032, 2962, 287, 13, 13, 1678, 822, 903, 2962, 29898, 1311, 29892, 1970, 29922, 8824, 29892, 3957, 29922, 8516, 29892, 19532, 29918, 9965, 29922, 8516, 1125, 13, 4706, 411, 1583, 3032, 2962, 29918, 908, 29901, 13, 9651, 396, 1583, 3032, 2962, 287, 756, 1063, 7120, 373, 278, 5377, 13, 9651, 396, 746, 903, 2962, 580, 471, 2000, 29889, 29871, 23732, 278, 7714, 29892, 13, 9651, 396, 1423, 278, 7353, 2748, 901, 304, 6459, 278, 1206, 988, 13, 9651, 396, 278, 1369, 1889, 24825, 1550, 445, 3244, 471, 10534, 13, 9651, 396, 363, 278, 7714, 29889, 13, 9651, 565, 1583, 3032, 2962, 287, 29901, 13, 18884, 736, 13, 9651, 565, 1970, 338, 7700, 29901, 13, 18884, 1970, 353, 274, 16434, 29889, 6007, 29943, 13, 13, 9651, 396, 2189, 6036, 29918, 25707, 580, 1887, 304, 2869, 773, 13, 9651, 396, 278, 274, 16434, 29889, 6007, 29943, 304, 7344, 2684, 24521, 411, 13, 9651, 396, 278, 10863, 29943, 562, 1943, 2874, 29889, 29871, 910, 508, 367, 3939, 565, 4312, 29889, 13, 9651, 565, 1970, 338, 451, 6213, 29901, 13, 18884, 1970, 29889, 9573, 29918, 25707, 29898, 6768, 29889, 9803, 29918, 25707, 29892, 525, 9803, 1495, 13, 13, 9651, 3142, 29918, 5085, 353, 1583, 3032, 2271, 29918, 5085, 29918, 1454, 29918, 5527, 29898, 5527, 29897, 13, 9651, 565, 3957, 29901, 13, 18884, 3142, 29918, 5085, 1839, 9965, 2033, 353, 3957, 13, 9651, 565, 19532, 29918, 9965, 29901, 13, 18884, 3142, 29918, 5085, 1839, 29879, 18398, 29918, 9965, 2033, 353, 19532, 29918, 9965, 13, 9651, 6012, 29918, 5085, 353, 1583, 3032, 10599, 29918, 5085, 29918, 1454, 29918, 5527, 29898, 5527, 29897, 13, 9651, 2136, 261, 29918, 5085, 353, 1583, 3032, 28107, 29918, 5085, 29918, 1454, 29918, 5527, 29898, 5527, 29897, 13, 13, 9651, 1583, 3032, 13236, 29918, 10599, 29892, 1583, 3032, 13236, 29918, 28107, 353, 320, 13, 18884, 1583, 3032, 14669, 29918, 1454, 29918, 9965, 29898, 13, 462, 1678, 3142, 29918, 5085, 1839, 9965, 7464, 13, 462, 1678, 6012, 29918, 5085, 29892, 2136, 261, 29918, 5085, 29897, 13, 13, 9651, 565, 3142, 29918, 5085, 29889, 657, 877, 29879, 18398, 29918, 9965, 29374, 13, 18884, 1583, 3032, 16950, 29918, 10599, 29892, 1583, 3032, 16950, 29918, 28107, 353, 320, 13, 462, 1678, 1583, 3032, 14669, 29918, 1454, 29918, 9965, 29898, 13, 462, 4706, 3142, 29918, 5085, 1839, 29879, 18398, 29918, 9965, 7464, 13, 462, 4706, 6012, 29918, 5085, 29892, 2136, 261, 29918, 5085, 29897, 13, 9651, 1683, 29901, 13, 18884, 1583, 3032, 16950, 29918, 10599, 29892, 1583, 3032, 16950, 29918, 28107, 353, 320, 13, 462, 1678, 1583, 3032, 13236, 29918, 10599, 29892, 1583, 3032, 13236, 29918, 28107, 13, 13, 9651, 1583, 29889, 29879, 15374, 29918, 16950, 353, 1583, 3032, 17470, 1943, 29918, 16859, 1839, 29879, 15374, 29918, 16950, 2033, 13, 13, 9651, 396, 731, 701, 903, 2962, 287, 1833, 29892, 577, 393, 297, 1206, 310, 15283, 13, 9651, 396, 591, 1018, 278, 3353, 2655, 1449, 322, 3461, 4436, 13, 9651, 396, 5149, 13, 9651, 1583, 3032, 2962, 287, 353, 5852, 13, 13, 1678, 822, 903, 14669, 29918, 1454, 29918, 9965, 29898, 13, 9651, 1583, 29892, 4576, 29918, 9965, 29892, 6012, 29918, 19290, 29892, 2136, 261, 29918, 19290, 1125, 13, 4706, 565, 4576, 29918, 9965, 338, 6213, 29901, 13, 9651, 12020, 3682, 29889, 29907, 424, 4763, 12412, 2392, 29898, 13, 18884, 376, 3782, 4576, 29918, 9965, 3443, 338, 7841, 1159, 13, 4706, 6012, 353, 24000, 29889, 3258, 29918, 10599, 29898, 13, 9651, 4576, 29918, 9965, 29922, 2850, 29918, 9965, 29892, 3579, 10599, 29918, 19290, 29897, 13, 4706, 363, 12422, 297, 1583, 3032, 17470, 1943, 29918, 16859, 1839, 265, 29918, 10599, 29918, 3258, 2033, 29901, 13, 9651, 12422, 29898, 10599, 29897, 13, 4706, 4867, 28107, 353, 470, 29885, 29889, 657, 29918, 28107, 29898, 10599, 29922, 10599, 29892, 3579, 28107, 29918, 19290, 29897, 13, 4706, 736, 6012, 29892, 4867, 28107, 13, 13, 13, 1990, 903, 3057, 12460, 5126, 7373, 12460, 5126, 1125, 13, 1678, 9995, 29909, 584, 1990, 29901, 1412, 29918, 12460, 5126, 29952, 1304, 491, 1243, 480, 3246, 29889, 13, 13, 1678, 910, 338, 263, 584, 1990, 29901, 1412, 29918, 12460, 5126, 29952, 393, 508, 367, 4153, 11658, 287, 13, 1678, 411, 385, 5923, 6012, 322, 4867, 28107, 29889, 13, 13, 1678, 3940, 393, 1550, 445, 338, 1304, 491, 2897, 417, 29889, 2585, 29915, 29879, 1914, 6987, 310, 13, 1678, 278, 6012, 17470, 1943, 1788, 29892, 372, 338, 884, 5609, 287, 363, 671, 491, 13, 1678, 278, 1243, 480, 3246, 310, 916, 9279, 29892, 937, 408, 385, 1543, 310, 278, 13, 1678, 2897, 417, 29918, 2585, 29889, 2850, 284, 305, 6764, 29889, 1688, 29918, 3188, 3883, 29892, 322, 1473, 368, 1122, 367, 1304, 491, 13, 1678, 7029, 1243, 480, 3246, 4153, 29889, 13, 13, 1678, 512, 27722, 263, 4682, 304, 11658, 3528, 5382, 6275, 408, 278, 12529, 13, 1678, 2629, 278, 5534, 584, 1990, 29901, 1412, 29918, 12460, 2677, 3260, 1412, 13, 13, 1678, 9995, 13, 13, 1678, 732, 311, 3116, 15914, 272, 29889, 1745, 586, 1338, 29889, 1745, 8238, 29918, 11022, 1191, 29898, 13, 4706, 525, 29879, 15374, 29918, 16950, 742, 13, 4706, 525, 23516, 995, 338, 13089, 630, 515, 278, 3847, 903, 12460, 5126, 1495, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6012, 29892, 2136, 261, 29892, 3394, 29918, 10945, 29892, 515, 29918, 14399, 29922, 8516, 29892, 3579, 11022, 1125, 13, 4706, 396, 6058, 29923, 29898, 5617, 911, 1416, 1125, 3579, 11022, 4312, 363, 28953, 752, 3097, 13, 4706, 1583, 3032, 16950, 29918, 10599, 353, 1583, 3032, 13236, 29918, 10599, 353, 6012, 13, 4706, 1583, 3032, 16950, 29918, 28107, 353, 1583, 3032, 13236, 29918, 28107, 353, 2136, 261, 13, 4706, 1583, 3032, 2962, 287, 353, 5852, 13, 4706, 1583, 3032, 1397, 4135, 29918, 17470, 1943, 353, 6213, 13, 13, 4706, 565, 515, 29918, 14399, 338, 6213, 29901, 13, 9651, 515, 29918, 14399, 353, 903, 4703, 29918, 12847, 3032, 14399, 13, 13, 4706, 1583, 3032, 17470, 1943, 29918, 16859, 353, 515, 29918, 14399, 3032, 17470, 1943, 29918, 16859, 13, 4706, 1583, 3032, 20736, 29918, 13073, 29918, 16859, 353, 515, 29918, 14399, 3032, 20736, 29918, 13073, 29918, 16859, 13, 13, 4706, 1583, 29889, 29879, 15374, 29918, 16950, 353, 1583, 3032, 17470, 1943, 29918, 16859, 1839, 29879, 15374, 29918, 16950, 2033, 13, 13, 4706, 565, 3394, 29918, 10945, 29901, 13, 9651, 1583, 29889, 735, 15423, 29918, 14399, 353, 903, 4703, 29918, 12847, 3032, 14399, 13, 9651, 903, 4703, 29918, 12847, 3032, 4632, 29918, 14399, 353, 1583, 13, 13, 1678, 822, 27905, 29918, 10945, 29898, 1311, 1125, 13, 4706, 903, 4703, 29918, 12847, 3032, 4632, 29918, 14399, 353, 1583, 29889, 735, 15423, 29918, 14399, 13, 13, 13, 1990, 903, 12460, 2677, 29898, 3318, 1125, 13, 1678, 9995, 1123, 6338, 263, 2323, 2566, 10804, 297, 6728, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 12529, 29892, 5534, 29918, 14399, 29922, 8516, 1125, 13, 4706, 9995, 1168, 4984, 263, 716, 584, 1990, 29901, 1412, 12460, 2677, 1412, 13, 13, 4706, 584, 3207, 12529, 29901, 278, 584, 1990, 29901, 1412, 12460, 5126, 29952, 607, 674, 13, 308, 9080, 408, 263, 2752, 310, 4511, 2068, 29889, 13, 13, 4706, 584, 3207, 5534, 29918, 14399, 29901, 278, 376, 10945, 29908, 12529, 607, 674, 367, 1304, 13, 308, 491, 278, 5534, 4954, 29918, 4703, 29918, 12847, 16159, 363, 716, 4954, 29918, 12460, 2677, 16159, 13, 308, 3618, 2825, 1090, 445, 697, 29889, 29871, 1932, 2175, 408, 6213, 278, 3935, 13, 308, 376, 10945, 29908, 12529, 338, 1304, 29889, 13, 13, 4706, 9995, 13, 4706, 1583, 29889, 14399, 353, 12529, 13, 4706, 1583, 29889, 10945, 29918, 14399, 353, 5534, 29918, 14399, 13, 4706, 1583, 29889, 8513, 353, 6213, 13, 4706, 1583, 29889, 7924, 353, 6213, 13, 4706, 1583, 29889, 9965, 353, 6213, 13, 4706, 1583, 29889, 20736, 353, 6213, 13, 4706, 9049, 353, 1583, 29889, 14399, 3032, 20736, 29918, 13073, 29918, 16859, 13, 4706, 1583, 29889, 1245, 1627, 29918, 16950, 29918, 29879, 10964, 353, 9049, 1839, 1245, 1627, 29918, 16950, 29918, 29879, 10964, 2033, 13, 4706, 1583, 29889, 23126, 29918, 265, 29918, 1491, 20736, 353, 9049, 1839, 23126, 29918, 265, 29918, 1491, 20736, 2033, 13, 13, 1678, 732, 4703, 1982, 29889, 4703, 12847, 13, 1678, 822, 903, 9965, 29898, 1311, 29892, 4078, 3149, 29922, 8824, 29892, 3030, 29922, 8516, 1125, 13, 4706, 565, 1583, 29889, 9965, 338, 6213, 29901, 13, 9651, 1018, 29901, 13, 18884, 565, 1583, 29889, 7924, 338, 451, 6213, 29901, 13, 462, 1678, 396, 671, 5923, 4867, 29892, 607, 338, 11420, 304, 502, 13, 462, 1678, 1583, 29889, 9965, 353, 1583, 29889, 7924, 29889, 9965, 580, 13, 462, 1678, 565, 4078, 3149, 29901, 13, 462, 4706, 411, 1583, 29889, 9965, 29889, 463, 29918, 27420, 3285, 320, 13, 462, 18884, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 9965, 29892, 3030, 1125, 13, 462, 9651, 7709, 1583, 29889, 9965, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 411, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 9965, 29892, 3030, 1125, 13, 462, 9651, 7709, 1583, 29889, 9965, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 338, 11420, 3242, 13, 462, 1678, 1583, 29889, 9965, 353, 1583, 29889, 14399, 3032, 3258, 29918, 9965, 29898, 13, 462, 4706, 4464, 29922, 1311, 29889, 8513, 29897, 13, 462, 1678, 1583, 29889, 20736, 353, 1583, 29889, 9965, 29889, 463, 580, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 411, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 9965, 29892, 3030, 1125, 13, 462, 9651, 7709, 1583, 29889, 9965, 13, 462, 4706, 1583, 3032, 355, 29918, 9965, 29918, 20736, 29898, 1311, 29889, 20736, 29897, 13, 462, 1678, 5174, 8960, 29901, 13, 462, 4706, 1583, 29889, 20736, 29889, 1245, 1627, 580, 13, 462, 4706, 396, 14402, 29898, 5617, 911, 1416, 29897, 437, 591, 817, 4078, 29918, 392, 29918, 13941, 895, 580, 1244, 29892, 13, 462, 4706, 396, 470, 437, 20687, 1741, 10376, 451, 505, 5626, 29973, 29871, 591, 526, 773, 13, 462, 4706, 396, 10650, 376, 22692, 29908, 297, 1784, 916, 7600, 297, 2897, 417, 29889, 2585, 2307, 13, 462, 4706, 12020, 13, 462, 1678, 7146, 29901, 13, 462, 4706, 1583, 29889, 20736, 353, 6213, 13, 462, 4706, 1583, 29889, 9965, 29889, 5358, 580, 13, 9651, 7146, 29901, 13, 18884, 1583, 29889, 9965, 353, 6213, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 671, 5923, 3957, 29892, 607, 338, 11420, 304, 502, 13, 9651, 565, 4078, 3149, 29901, 13, 18884, 411, 1583, 29889, 9965, 29889, 463, 29918, 27420, 3285, 320, 13, 462, 4706, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 9965, 29892, 3030, 1125, 13, 462, 1678, 7709, 1583, 29889, 9965, 13, 9651, 1683, 29901, 13, 18884, 411, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 9965, 29892, 3030, 1125, 13, 462, 1678, 7709, 1583, 29889, 9965, 13, 13, 1678, 732, 4703, 1982, 29889, 4703, 12847, 13, 1678, 822, 903, 7924, 29898, 1311, 29892, 4078, 3149, 29922, 8824, 29892, 3030, 29922, 8516, 1125, 13, 4706, 565, 1583, 29889, 7924, 338, 6213, 29901, 13, 9651, 1583, 29889, 7924, 353, 1583, 29889, 14399, 3032, 3258, 29918, 7924, 29898, 13, 18884, 7868, 29922, 1311, 29889, 9965, 29892, 4464, 29922, 1311, 29889, 8513, 29897, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 7924, 29889, 463, 580, 13, 18884, 411, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 7924, 29892, 3030, 1125, 13, 462, 1678, 7709, 1583, 29889, 7924, 13, 18884, 1583, 3032, 355, 29918, 7924, 29918, 20736, 29898, 1311, 29889, 7924, 29897, 13, 9651, 5174, 8960, 29901, 13, 18884, 411, 5566, 13239, 29889, 7620, 29918, 392, 29918, 13941, 895, 29918, 11739, 7295, 13, 462, 1678, 1583, 29889, 7924, 29889, 1245, 1627, 580, 13, 9651, 7146, 29901, 13, 18884, 1583, 29889, 7924, 29889, 5358, 580, 13, 18884, 1583, 29889, 7924, 353, 6213, 13, 4706, 1683, 29901, 13, 9651, 396, 671, 5923, 4867, 29892, 607, 338, 11420, 304, 502, 13, 9651, 565, 4078, 3149, 29901, 13, 18884, 411, 1583, 29889, 7924, 29889, 463, 29918, 27420, 7295, 13, 462, 1678, 411, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 7924, 29892, 3030, 1125, 13, 462, 4706, 7709, 1583, 29889, 7924, 13, 9651, 1683, 29901, 13, 18884, 411, 1583, 3032, 1202, 29918, 4703, 29898, 1311, 29889, 7924, 29892, 3030, 1125, 13, 462, 1678, 7709, 1583, 29889, 7924, 13, 18884, 565, 1583, 29889, 23126, 29918, 265, 29918, 1491, 20736, 29901, 13, 462, 1678, 1583, 29889, 7924, 29889, 23126, 580, 13, 13, 1678, 732, 4703, 1982, 29889, 4703, 12847, 13, 1678, 822, 903, 1202, 29918, 4703, 29898, 1311, 29892, 3957, 29892, 3030, 1125, 13, 4706, 17749, 29918, 4703, 353, 3957, 29889, 3888, 29889, 657, 877, 4746, 29918, 4703, 1495, 13, 4706, 3957, 29889, 3888, 1839, 4746, 29918, 4703, 2033, 353, 3030, 13, 4706, 7709, 3957, 13, 4706, 3957, 29889, 3888, 1839, 4746, 29918, 4703, 2033, 353, 17749, 29918, 4703, 13, 13, 1678, 822, 903, 355, 29918, 7924, 29918, 20736, 29898, 1311, 29892, 4867, 1125, 13, 4706, 565, 1583, 29889, 8513, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 4867, 29889, 15060, 580, 13, 4706, 25342, 1583, 29889, 1245, 1627, 29918, 16950, 29918, 29879, 10964, 29901, 13, 9651, 4867, 29889, 1245, 1627, 580, 13, 4706, 396, 512, 278, 18070, 310, 5432, 4867, 29889, 1245, 1627, 3285, 13, 4706, 396, 278, 2446, 1246, 338, 4867, 29889, 5358, 2141, 29871, 910, 27474, 599, 13, 4706, 396, 3618, 515, 278, 4867, 964, 278, 1439, 3791, 2106, 29892, 322, 13, 4706, 396, 27474, 278, 3957, 408, 1532, 29936, 278, 3957, 746, 4133, 13, 4706, 396, 304, 278, 11565, 338, 2845, 29081, 1250, 297, 738, 1206, 29892, 470, 5764, 8072, 29889, 13, 13, 1678, 822, 903, 355, 29918, 9965, 29918, 20736, 29898, 1311, 29892, 10804, 1125, 13, 4706, 565, 1583, 29889, 8513, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 10804, 29889, 15060, 580, 13, 4706, 1683, 29901, 13, 9651, 10804, 29889, 1245, 1627, 580, 13, 13, 1678, 822, 903, 5498, 346, 29918, 1271, 29898, 1311, 29892, 4464, 29892, 3957, 29892, 4078, 3149, 29892, 2758, 29918, 12674, 29922, 8824, 29892, 13, 462, 539, 3030, 29922, 8516, 1125, 13, 4706, 565, 4464, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 1583, 3032, 13236, 580, 13, 4706, 25342, 4464, 338, 903, 3289, 29979, 15868, 29918, 16310, 1001, 29901, 13, 9651, 1583, 3032, 12674, 29918, 16950, 580, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 16950, 29898, 9536, 29918, 12674, 29897, 13, 4706, 565, 3957, 29901, 13, 9651, 736, 1583, 3032, 9965, 29898, 7620, 3149, 29892, 3030, 29922, 4703, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 7924, 29898, 7620, 3149, 29892, 3030, 29922, 4703, 29897, 13, 13, 1678, 822, 903, 13236, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 8513, 338, 6213, 29901, 13, 9651, 1583, 29889, 8513, 353, 903, 9980, 1806, 1001, 13, 4706, 25342, 1583, 29889, 8513, 338, 903, 16310, 1001, 29901, 13, 9651, 12020, 20948, 29898, 13, 18884, 376, 6028, 29915, 29873, 14955, 263, 5195, 3035, 1001, 10804, 376, 13, 18884, 376, 517, 263, 399, 29934, 1806, 1001, 7145, 29899, 20736, 1159, 13, 4706, 25342, 1583, 29889, 8513, 338, 903, 3289, 29979, 15868, 29918, 16310, 1001, 29901, 13, 9651, 12020, 20948, 29898, 13, 18884, 376, 6028, 29915, 29873, 14955, 385, 3339, 29979, 15868, 29918, 16310, 1001, 10804, 376, 13, 18884, 376, 517, 263, 399, 29934, 1806, 1001, 7145, 29899, 20736, 1159, 13, 13, 1678, 822, 903, 16950, 29898, 1311, 29892, 2758, 29918, 12674, 29922, 8824, 1125, 13, 4706, 565, 1583, 29889, 8513, 338, 6213, 29901, 13, 9651, 1583, 29889, 8513, 353, 903, 16310, 1001, 13, 4706, 25342, 1583, 29889, 8513, 338, 903, 3289, 29979, 15868, 29918, 16310, 1001, 322, 451, 2758, 29918, 12674, 29901, 13, 9651, 12020, 20948, 29898, 13, 18884, 376, 6028, 29915, 29873, 14955, 385, 3339, 29979, 15868, 29918, 16310, 1001, 10804, 376, 13, 18884, 376, 517, 263, 5195, 3035, 1001, 7145, 29899, 20736, 1159, 13, 13, 1678, 822, 903, 12674, 29918, 16950, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 8513, 338, 6213, 29901, 13, 9651, 1583, 29889, 8513, 353, 903, 3289, 29979, 15868, 29918, 16310, 1001, 13, 13, 13, 1990, 903, 12460, 2677, 29911, 7717, 29898, 7097, 292, 29889, 2997, 1125, 13, 1678, 822, 4770, 24535, 8552, 12035, 1311, 29892, 2626, 29877, 1125, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 17469, 12035, 1311, 1125, 13, 4706, 736, 903, 12460, 2677, 29911, 7717, 29892, 3861, 13, 13, 13, 1990, 903, 12460, 2677, 3260, 29898, 3318, 1125, 13, 1678, 9995, 1184, 29894, 680, 3030, 29899, 21895, 322, 10200, 1061, 15038, 363, 22160, 29889, 13, 13, 1678, 910, 1203, 3990, 1078, 1404, 29899, 12119, 376, 4703, 29908, 3618, 411, 278, 13, 1678, 584, 1990, 29901, 1412, 29918, 12460, 2677, 29952, 770, 29892, 373, 2306, 3131, 310, 263, 13, 1678, 11122, 584, 1990, 29901, 1412, 29918, 12460, 5126, 1412, 13, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 3876, 29922, 8516, 29892, 13, 9651, 4464, 29922, 8516, 29892, 13, 9651, 7417, 29922, 8824, 29892, 13, 9651, 4078, 3149, 29922, 8824, 29892, 13, 9651, 3957, 29922, 8824, 29892, 13, 9651, 5191, 29918, 10945, 29918, 14399, 29922, 8516, 29892, 13, 9651, 903, 275, 29918, 10945, 29918, 12847, 29922, 8824, 29892, 13, 9651, 2758, 29918, 12674, 29922, 8824, 1125, 13, 13, 4706, 565, 3876, 338, 6213, 29901, 13, 9651, 1583, 3032, 4632, 353, 1583, 13, 9651, 1583, 3032, 4632, 29918, 14399, 353, 903, 12460, 5126, 580, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 4632, 353, 3876, 13, 13, 4706, 1583, 3032, 6506, 29918, 10945, 29918, 14399, 353, 5191, 29918, 10945, 29918, 14399, 13, 4706, 1583, 3032, 275, 29918, 10945, 29918, 12847, 353, 903, 275, 29918, 10945, 29918, 12847, 13, 4706, 1583, 3032, 8513, 353, 4464, 13, 4706, 1583, 3032, 262, 18980, 353, 7417, 13, 4706, 1583, 3032, 7620, 3149, 353, 4078, 3149, 13, 4706, 565, 1583, 3032, 7620, 3149, 322, 1583, 3032, 262, 18980, 29901, 13, 9651, 12020, 20948, 29898, 13, 18884, 376, 26740, 4078, 3149, 322, 7417, 3732, 694, 4060, 23157, 13, 4706, 1583, 3032, 9965, 353, 3957, 13, 4706, 1583, 3032, 9536, 29918, 12674, 353, 2758, 29918, 12674, 13, 13, 1678, 732, 6799, 13, 1678, 822, 903, 14399, 29898, 1311, 1125, 13, 4706, 9995, 1576, 584, 1990, 29901, 1412, 29918, 12460, 5126, 29952, 6942, 411, 445, 3030, 1213, 15945, 13, 4706, 736, 1583, 3032, 4632, 3032, 4632, 29918, 14399, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 2962, 287, 29898, 1311, 1125, 13, 4706, 9995, 5574, 565, 445, 8455, 338, 2307, 4687, 1213, 15945, 13, 4706, 736, 1583, 3032, 14399, 29889, 275, 29918, 2962, 287, 13, 13, 1678, 822, 10822, 29898, 1311, 29892, 3579, 11022, 1125, 13, 4706, 9995, 2052, 368, 17127, 1288, 3987, 304, 278, 12529, 29889, 13, 13, 4706, 910, 1158, 508, 871, 367, 2000, 1434, 738, 2702, 13, 4706, 10804, 29899, 463, 1076, 3519, 505, 1063, 2000, 29889, 13, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 14399, 29889, 17591, 29898, 1068, 11022, 29897, 13, 13, 1678, 822, 9773, 29918, 265, 29918, 10599, 29918, 3258, 29898, 1311, 29892, 7876, 1125, 13, 4706, 9995, 18277, 263, 13254, 740, 304, 903, 17470, 1943, 29918, 16859, 3366, 265, 29918, 10599, 29918, 3258, 3108, 15945, 29908, 13, 4706, 1583, 3032, 14399, 3032, 17470, 1943, 29918, 16859, 1839, 265, 29918, 10599, 29918, 3258, 13359, 4397, 29898, 9144, 29897, 13, 13, 1678, 822, 679, 29918, 1397, 4135, 29918, 17470, 1943, 29898, 1311, 1125, 13, 4706, 9995, 11609, 263, 584, 1990, 29901, 1412, 22988, 4135, 12412, 29943, 562, 1943, 29952, 363, 12529, 515, 445, 3030, 29889, 13, 13, 4706, 910, 4024, 1943, 674, 1207, 671, 310, 278, 1021, 6012, 322, 4867, 28107, 13, 4706, 408, 445, 12529, 29892, 3138, 674, 451, 6232, 278, 1021, 10804, 3030, 29936, 13, 4706, 278, 25000, 4024, 1943, 18172, 304, 664, 278, 2030, 982, 310, 7863, 13, 4706, 263, 716, 16441, 1269, 931, 679, 29918, 7924, 580, 338, 2000, 29889, 13, 4706, 9995, 13, 13, 4706, 736, 1583, 3032, 14399, 29889, 657, 29918, 1397, 4135, 29918, 17470, 1943, 580, 13, 13, 1678, 822, 679, 29918, 10599, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 10863, 297, 671, 29889, 13, 13, 4706, 910, 674, 367, 2729, 373, 278, 2106, 1641, 399, 29934, 1806, 1001, 470, 5195, 3035, 1001, 29889, 13, 13, 4706, 910, 10469, 263, 1369, 5858, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 1583, 3032, 8513, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 736, 1583, 3032, 14399, 29889, 657, 29918, 13236, 29918, 10599, 580, 13, 4706, 25342, 1583, 3032, 8513, 338, 903, 16310, 1001, 29901, 13, 9651, 736, 1583, 3032, 14399, 29889, 657, 29918, 16950, 29918, 10599, 580, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 703, 8513, 881, 367, 399, 29934, 1806, 1001, 470, 5195, 3035, 1001, 1159, 13, 13, 1678, 822, 679, 29918, 7924, 28107, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 4867, 28107, 297, 671, 29889, 13, 13, 4706, 910, 674, 367, 2729, 373, 278, 2106, 1641, 399, 29934, 1806, 1001, 470, 5195, 3035, 1001, 29889, 13, 13, 4706, 910, 10469, 263, 1369, 5858, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 1583, 3032, 8513, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 736, 1583, 3032, 14399, 29889, 657, 29918, 13236, 29918, 28107, 580, 13, 4706, 25342, 1583, 3032, 8513, 338, 903, 16310, 1001, 29901, 13, 9651, 736, 1583, 3032, 14399, 29889, 657, 29918, 16950, 29918, 28107, 580, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 703, 8513, 881, 367, 399, 29934, 1806, 1001, 470, 5195, 3035, 1001, 1159, 13, 13, 1678, 822, 27905, 29918, 10109, 29898, 1311, 1125, 13, 4706, 9995, 5594, 6012, 29889, 10109, 29889, 2218, 4220, 580, 373, 14407, 10863, 3618, 1213, 15945, 13, 4706, 1583, 3032, 14399, 29889, 2218, 4220, 29918, 10109, 580, 13, 13, 1678, 822, 1207, 29918, 1482, 29918, 12847, 29898, 1311, 1125, 13, 4706, 9995, 4391, 263, 716, 29892, 7417, 903, 12460, 2677, 3260, 515, 445, 697, 29889, 13, 13, 4706, 10061, 583, 278, 14407, 903, 12460, 5126, 304, 263, 716, 697, 29892, 577, 393, 13, 4706, 372, 508, 367, 4340, 13252, 411, 716, 3987, 29889, 13, 13, 4706, 501, 8485, 363, 1243, 23136, 988, 278, 2280, 29899, 8157, 13, 4706, 903, 12460, 2677, 3260, 1122, 367, 1304, 408, 263, 12529, 363, 1243, 29899, 2997, 13, 4706, 767, 18150, 29889, 13, 13, 4706, 9995, 13, 4706, 716, 353, 1583, 3032, 16513, 580, 13, 4706, 716, 3032, 4632, 353, 716, 13, 4706, 716, 3032, 4632, 29918, 14399, 353, 1583, 3032, 4632, 29918, 14399, 3032, 3258, 29918, 14399, 29918, 8552, 580, 13, 4706, 565, 716, 3032, 14399, 3032, 2962, 287, 29901, 13, 9651, 12020, 16499, 291, 2392, 877, 12460, 5126, 338, 2307, 4687, 1495, 13, 4706, 736, 716, 13, 13, 1678, 822, 13261, 29918, 14399, 29898, 1311, 29892, 12529, 29918, 272, 29918, 12847, 1125, 13, 4706, 9995, 29925, 905, 263, 903, 12460, 5126, 964, 445, 8455, 29889, 13, 13, 4706, 10088, 6048, 445, 8455, 29915, 29879, 12529, 411, 278, 2183, 697, 29892, 322, 3639, 13, 4706, 263, 1246, 519, 393, 674, 10092, 278, 12529, 1250, 304, 825, 591, 13, 4706, 4687, 411, 29889, 13, 13, 4706, 9333, 1736, 363, 3876, 2114, 3842, 29889, 29871, 1317, 9146, 363, 1243, 480, 3246, 13, 4706, 393, 817, 304, 13261, 297, 25010, 2566, 22920, 29889, 13, 13, 4706, 450, 2183, 2980, 1122, 367, 263, 903, 12460, 2677, 3260, 470, 263, 13, 4706, 903, 12460, 5126, 29889, 13, 13, 4706, 9995, 13, 13, 4706, 565, 338, 8758, 29898, 14399, 29918, 272, 29918, 12847, 29892, 903, 12460, 2677, 3260, 1125, 13, 9651, 12529, 353, 12529, 29918, 272, 29918, 12847, 3032, 14399, 13, 4706, 25342, 338, 8758, 29898, 14399, 29918, 272, 29918, 12847, 29892, 903, 12460, 5126, 1125, 13, 9651, 12529, 353, 12529, 29918, 272, 29918, 12847, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 11119, 12460, 2677, 3260, 470, 376, 13, 18884, 11119, 12460, 5126, 3806, 23157, 13, 4706, 565, 1583, 3032, 4632, 338, 451, 1583, 29901, 13, 9651, 12020, 16499, 291, 2392, 877, 5041, 29918, 14399, 871, 1736, 363, 3876, 12529, 29889, 1495, 13, 4706, 5923, 29918, 14399, 353, 1583, 3032, 4632, 29918, 14399, 13, 4706, 1583, 3032, 4632, 29918, 14399, 353, 12529, 13, 13, 4706, 822, 10092, 7295, 13, 9651, 1583, 3032, 4632, 29918, 14399, 353, 5923, 29918, 14399, 13, 13, 4706, 736, 10092, 13, 13, 1678, 822, 13261, 29918, 10599, 29898, 1311, 29892, 6012, 1125, 13, 4706, 9995, 29925, 905, 385, 10863, 964, 445, 8455, 29889, 13, 13, 4706, 10088, 6048, 445, 8455, 29915, 29879, 12529, 411, 263, 903, 3057, 12460, 5126, 13, 4706, 393, 674, 671, 278, 2183, 10863, 29892, 322, 3639, 13, 4706, 263, 1246, 519, 393, 674, 10092, 278, 12529, 1250, 304, 825, 591, 13, 4706, 4687, 411, 29889, 13, 13, 4706, 9333, 1736, 363, 3876, 2114, 3842, 29889, 29871, 1317, 9146, 363, 1243, 480, 3246, 13, 4706, 393, 817, 304, 13261, 297, 25010, 2566, 22920, 29889, 13, 13, 4706, 9995, 13, 13, 4706, 5923, 29918, 14399, 353, 1583, 3032, 14399, 13, 4706, 565, 451, 5923, 29918, 14399, 3032, 2962, 287, 29901, 13, 9651, 5923, 29918, 14399, 3032, 2962, 580, 13, 4706, 2136, 261, 353, 5923, 29918, 14399, 3032, 13236, 29918, 28107, 13, 4706, 2136, 261, 29918, 19290, 353, 5923, 29918, 14399, 3032, 28107, 29918, 5085, 29918, 1454, 29918, 5527, 29898, 16859, 29889, 6007, 29943, 29897, 13, 4706, 2136, 261, 353, 470, 29885, 29889, 657, 29918, 28107, 29898, 10599, 29922, 10599, 29892, 3579, 28107, 29918, 19290, 29897, 13, 13, 4706, 12529, 353, 903, 3057, 12460, 5126, 29898, 13, 9651, 6012, 29892, 2136, 261, 29892, 13, 9651, 3394, 29918, 10945, 29922, 8824, 29892, 13, 9651, 515, 29918, 14399, 29922, 735, 15423, 29918, 14399, 13, 4706, 1723, 13, 4706, 736, 1583, 29889, 5041, 29918, 14399, 29898, 14399, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 5191, 29898, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 5191, 278, 5534, 10804, 12529, 411, 445, 697, 1213, 15945, 13, 4706, 736, 1583, 3032, 16513, 29898, 6506, 29918, 10945, 29918, 14399, 29922, 1311, 3032, 14399, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 9227, 29898, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 731, 278, 10804, 304, 399, 29934, 1806, 1001, 1213, 15945, 13, 4706, 736, 1583, 3032, 16513, 29898, 8513, 29922, 29918, 9980, 1806, 1001, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 9591, 29898, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 731, 278, 10804, 304, 5195, 3035, 1001, 1213, 15945, 13, 4706, 736, 1583, 3032, 16513, 29898, 8513, 29922, 29918, 16310, 1001, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2758, 29918, 12674, 29898, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 2758, 7465, 6931, 13, 13, 4706, 2178, 1242, 7465, 6931, 565, 20489, 4867, 338, 2307, 13, 4706, 4687, 297, 445, 3030, 29889, 4485, 292, 6535, 3450, 3519, 411, 5195, 3035, 1001, 723, 1207, 13, 4706, 372, 9301, 304, 671, 963, 297, 3339, 29979, 15868, 29918, 16310, 1001, 22160, 29892, 322, 2791, 292, 13, 4706, 963, 411, 3339, 29979, 15868, 29918, 16310, 1001, 723, 1996, 263, 21733, 310, 599, 278, 7600, 13, 4706, 1438, 6535, 3450, 3519, 526, 2000, 304, 4889, 5195, 3035, 1001, 4464, 29892, 988, 278, 9281, 13, 4706, 6535, 2106, 338, 3734, 29889, 13, 13, 4706, 512, 16216, 6535, 3450, 3519, 881, 505, 263, 525, 11177, 29915, 2322, 313, 29875, 29889, 29872, 29889, 5195, 3035, 1001, 511, 13, 4706, 577, 393, 896, 508, 1369, 21396, 373, 1009, 1914, 29892, 541, 372, 723, 884, 367, 13, 4706, 5407, 363, 963, 304, 367, 2221, 304, 5221, 403, 297, 385, 5923, 3339, 29979, 15868, 29918, 16310, 1001, 13, 4706, 4867, 29892, 565, 697, 471, 4687, 701, 278, 5096, 29889, 13, 4706, 9995, 13, 13, 4706, 565, 1583, 3032, 8513, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 12020, 20948, 703, 29020, 7465, 373, 263, 399, 29934, 1806, 1001, 3732, 694, 4060, 1159, 13, 4706, 736, 1583, 3032, 16513, 29898, 9536, 29918, 12674, 29922, 5574, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 7417, 29898, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 1369, 263, 10804, 7417, 515, 738, 427, 11291, 292, 1213, 15945, 13, 4706, 736, 1583, 3032, 16513, 29898, 262, 18980, 29922, 5574, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4078, 3149, 29898, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 1369, 263, 317, 7520, 15488, 6992, 29911, 565, 263, 10804, 2307, 4864, 1213, 15945, 13, 4706, 736, 1583, 3032, 16513, 29898, 7620, 3149, 29922, 5574, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3957, 29898, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 736, 263, 7136, 15160, 1203, 2012, 310, 16441, 1213, 15945, 13, 4706, 736, 1583, 3032, 16513, 29898, 9965, 29922, 5574, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 7465, 23538, 1311, 1125, 13, 4706, 9995, 2111, 3709, 304, 731, 263, 5195, 3035, 1001, 5858, 304, 3339, 29979, 15868, 29918, 16310, 1001, 1213, 15945, 13, 13, 4706, 565, 1583, 3032, 8513, 338, 903, 9980, 1806, 1001, 29901, 13, 9651, 12020, 20948, 703, 29020, 7465, 373, 263, 399, 29934, 1806, 1001, 3732, 694, 4060, 1159, 13, 4706, 736, 1583, 3032, 16513, 29898, 8513, 29922, 29918, 3289, 29979, 15868, 29918, 16310, 1001, 29897, 13, 13, 1678, 822, 773, 29898, 1311, 29892, 3030, 1125, 13, 4706, 9995, 1184, 29894, 680, 263, 3030, 8455, 2908, 393, 674, 671, 278, 2183, 3030, 1213, 15945, 13, 4706, 736, 1583, 3032, 20736, 29918, 6078, 29898, 4703, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 7876, 1125, 13, 4706, 9995, 6185, 272, 403, 263, 740, 1213, 15945, 13, 4706, 6389, 3135, 353, 3667, 29879, 29889, 657, 5085, 3135, 29898, 9144, 29897, 13, 4706, 565, 6389, 3135, 29889, 5085, 29961, 29900, 29962, 1275, 525, 1311, 29915, 470, 6389, 3135, 29889, 5085, 29961, 29900, 29962, 1275, 525, 25932, 2396, 13, 9651, 3030, 29918, 2248, 353, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 3030, 29918, 2248, 353, 29871, 29900, 13, 4706, 3030, 29918, 11022, 353, 6389, 3135, 29889, 5085, 29961, 4703, 29918, 2248, 29962, 13, 13, 4706, 732, 7692, 312, 8789, 29889, 29893, 336, 567, 29898, 9144, 29897, 13, 4706, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 9651, 3030, 353, 9049, 5085, 29889, 657, 29898, 4703, 29918, 11022, 29892, 6213, 29897, 13, 9651, 565, 451, 3030, 29901, 13, 18884, 3030, 353, 6389, 29961, 4703, 29918, 2248, 29962, 13, 13, 9651, 411, 1583, 3032, 20736, 29918, 6078, 29898, 4703, 1125, 13, 18884, 736, 7876, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 4706, 736, 14476, 13, 13, 1678, 822, 903, 16513, 29898, 1311, 29892, 3579, 11022, 1125, 13, 4706, 2322, 29918, 11022, 353, 426, 13, 9651, 376, 262, 18980, 1115, 1583, 3032, 262, 18980, 29892, 13, 9651, 376, 8513, 1115, 1583, 3032, 8513, 29892, 13, 9651, 376, 9965, 1115, 1583, 3032, 9965, 13, 4706, 500, 13, 4706, 2322, 29918, 11022, 29889, 5504, 29898, 11022, 29897, 13, 4706, 736, 903, 12460, 2677, 3260, 29898, 4632, 29922, 1311, 3032, 4632, 29892, 3579, 4381, 29918, 11022, 29897, 13, 13, 1678, 732, 4703, 1982, 29889, 4703, 12847, 13, 1678, 822, 903, 20736, 29918, 6078, 29898, 1311, 29892, 3030, 1125, 13, 4706, 716, 29918, 20736, 353, 1583, 3032, 262, 18980, 13, 4706, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 353, 320, 13, 9651, 903, 20736, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 29898, 4703, 29897, 13, 13, 4706, 1857, 353, 17749, 353, 679, 5552, 29898, 13, 9651, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 29892, 376, 3784, 613, 6213, 29897, 13, 13, 4706, 671, 29918, 14399, 353, 1583, 3032, 14399, 13, 4706, 5534, 29918, 14399, 353, 6213, 13, 13, 4706, 565, 1583, 3032, 6506, 29918, 10945, 29918, 14399, 29901, 13, 9651, 671, 29918, 14399, 353, 5534, 29918, 14399, 353, 1583, 3032, 6506, 29918, 10945, 29918, 14399, 13, 4706, 25342, 1857, 338, 451, 6213, 322, 1857, 29889, 10945, 29918, 14399, 29901, 13, 9651, 5534, 29918, 14399, 353, 1857, 29889, 10945, 29918, 14399, 13, 13, 9651, 565, 1583, 3032, 4632, 3032, 275, 29918, 10945, 29918, 12847, 29901, 13, 18884, 671, 29918, 14399, 353, 5534, 29918, 14399, 13, 13, 4706, 565, 1857, 338, 451, 6213, 322, 313, 13, 18884, 716, 29918, 20736, 470, 1857, 29889, 14399, 338, 451, 671, 29918, 14399, 13, 308, 1125, 13, 9651, 1857, 353, 6213, 13, 13, 4706, 565, 1857, 338, 6213, 29901, 13, 9651, 1857, 353, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 29889, 3784, 353, 320, 13, 18884, 903, 12460, 2677, 29898, 1509, 29918, 14399, 29892, 5534, 29918, 14399, 29922, 10945, 29918, 14399, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 3032, 8513, 338, 451, 6213, 29901, 13, 18884, 411, 1857, 3032, 5498, 346, 29918, 1271, 29898, 13, 462, 1678, 4464, 29922, 1311, 3032, 8513, 29892, 13, 462, 1678, 3957, 29922, 1311, 3032, 9965, 29892, 13, 462, 1678, 4078, 3149, 29922, 1311, 3032, 7620, 3149, 29892, 13, 462, 1678, 2758, 29918, 12674, 29922, 1311, 3032, 9536, 29918, 12674, 29892, 13, 462, 1678, 3030, 29922, 4703, 29897, 408, 6503, 29901, 13, 462, 1678, 7709, 6503, 13, 9651, 1683, 29901, 13, 18884, 7709, 13, 4706, 7146, 29901, 13, 9651, 565, 17749, 338, 6213, 29901, 13, 18884, 628, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 29889, 3784, 13, 9651, 25342, 1857, 338, 451, 17749, 29901, 13, 18884, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 29889, 3784, 353, 17749, 13, 13, 13, 29992, 6799, 13, 29992, 311, 3116, 15914, 272, 29889, 13529, 267, 29889, 29885, 8238, 29918, 6799, 703, 12674, 29918, 1159, 13, 1753, 7465, 29918, 12667, 29898, 1311, 1125, 13, 1678, 736, 1583, 29889, 12674, 29918, 13, 13, 13, 842, 5552, 29898, 13, 1678, 903, 12460, 2677, 3260, 29892, 13, 1678, 376, 12674, 613, 7465, 29918, 12667, 13, 29897, 13, 13, 13, 1753, 903, 4703, 29918, 2783, 11709, 29898, 5552, 29922, 8516, 1125, 13, 1678, 679, 357, 353, 5455, 29889, 5552, 657, 357, 29898, 5552, 29897, 13, 13, 1678, 822, 903, 6799, 29918, 1454, 29918, 4703, 29898, 4703, 1125, 13, 4706, 1018, 29901, 13, 9651, 10804, 29918, 4703, 353, 3030, 29889, 20736, 29918, 13073, 13, 4706, 5174, 3682, 29889, 3782, 12412, 2677, 12787, 370, 3726, 29901, 13, 9651, 12020, 3682, 29889, 3782, 12412, 2677, 12787, 370, 3726, 29898, 13, 18884, 376, 3782, 4103, 2467, 2677, 338, 7841, 363, 376, 13, 18884, 376, 1366, 1273, 29879, 1203, 2629, 278, 1857, 3244, 29936, 376, 13, 18884, 376, 1552, 1273, 29878, 5352, 338, 443, 16515, 1213, 13, 18884, 1273, 313, 4703, 29892, 12421, 29897, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 1121, 353, 679, 357, 29898, 20736, 29918, 4703, 29897, 13, 9651, 565, 1121, 338, 6213, 29901, 13, 18884, 12020, 3682, 29889, 2677, 3664, 3089, 287, 2392, 29898, 13, 462, 1678, 376, 1576, 14210, 29879, 29915, 3030, 5352, 471, 13877, 541, 376, 13, 462, 1678, 376, 277, 756, 451, 1063, 7841, 363, 445, 3030, 1213, 1273, 12421, 13, 18884, 1723, 13, 9651, 736, 1121, 13, 1678, 736, 2875, 7373, 6799, 29918, 1454, 29918, 4703, 29897, 13, 13, 13, 1753, 903, 20736, 29918, 13073, 29918, 1454, 29918, 4703, 29898, 4703, 1125, 13, 1678, 491, 29918, 7097, 353, 903, 20736, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 29898, 4703, 29897, 13, 1678, 1018, 29901, 13, 4706, 736, 491, 29918, 7097, 29889, 3784, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 12020, 3682, 29889, 3782, 12412, 2677, 12787, 370, 3726, 29898, 13, 9651, 376, 3782, 4103, 2467, 2677, 338, 7841, 363, 376, 13, 9651, 376, 1366, 1273, 29879, 1203, 2629, 278, 1857, 3244, 29889, 376, 13, 9651, 1273, 3030, 13, 4706, 1723, 13, 13, 13, 1753, 903, 20736, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 29898, 4703, 1125, 13, 1678, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 353, 679, 5552, 29898, 13, 4706, 3030, 29892, 22868, 10599, 17470, 1943, 29918, 4703, 742, 6213, 29897, 13, 1678, 565, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 338, 6213, 29901, 13, 4706, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 353, 320, 13, 9651, 3030, 3032, 10599, 17470, 1943, 29918, 4703, 353, 903, 12460, 2677, 29911, 7717, 580, 13, 13, 1678, 736, 10804, 29918, 4703, 29879, 29918, 1609, 29918, 7097, 13, 13, 13, 1753, 10804, 29918, 4703, 29918, 18121, 29898, 29895, 605, 1125, 13, 1678, 9995, 6185, 272, 403, 263, 770, 411, 4954, 7924, 16159, 322, 4954, 9965, 16159, 8393, 1213, 15945, 13, 13, 1678, 731, 5552, 29898, 13, 4706, 22902, 29892, 13, 4706, 525, 20736, 29918, 13073, 742, 13, 4706, 2875, 7373, 20736, 29918, 13073, 29918, 1454, 29918, 4703, 876, 13, 13, 1678, 396, 402, 4154, 10804, 3030, 8393, 408, 3030, 4426, 13, 1678, 363, 12421, 297, 6702, 7924, 742, 525, 9965, 742, 525, 20736, 29374, 13, 4706, 731, 5552, 29898, 29895, 605, 29892, 12421, 29892, 903, 4703, 29918, 2783, 11709, 29898, 5552, 876, 13, 13, 1678, 736, 22902, 13, 13, 13, 29918, 4703, 29918, 12847, 353, 903, 12460, 2677, 3260, 7373, 275, 29918, 10945, 29918, 12847, 29922, 5574, 29897, 13, 15945, 29908, 4381, 3030, 8455, 1213, 15945, 13, 13, 13, 1753, 10804, 29918, 4703, 7295, 13, 1678, 9995, 1168, 4984, 263, 1887, 10804, 3030, 29889, 13, 13, 1678, 9995, 13, 1678, 736, 903, 12460, 2677, 3260, 580, 13, 13, 13, 1753, 10822, 29898, 1068, 11022, 1125, 13, 1678, 9995, 2052, 368, 17127, 1288, 3987, 304, 278, 5534, 12529, 29889, 13, 13, 1678, 910, 1158, 508, 871, 367, 2000, 1434, 738, 2702, 10804, 29899, 463, 1076, 13, 1678, 3519, 505, 1063, 2000, 29889, 13, 13, 1678, 6317, 1074, 15189, 1057, 13, 13, 4706, 584, 29885, 621, 29901, 1412, 29918, 12460, 5126, 29889, 17591, 29952, 13, 13, 1678, 9995, 13, 1678, 903, 4703, 29918, 12847, 3032, 14399, 29889, 17591, 29898, 1068, 11022, 29897, 13, 13, 13, 1753, 679, 29918, 1397, 4135, 29918, 17470, 1943, 7295, 13, 1678, 9995, 11609, 263, 584, 1990, 29901, 1412, 22988, 4135, 12412, 29943, 562, 1943, 29952, 363, 278, 5534, 12529, 29889, 13, 13, 1678, 910, 4024, 1943, 674, 1207, 671, 310, 278, 1021, 6012, 322, 4867, 28107, 13, 1678, 408, 445, 12529, 29892, 3138, 674, 451, 6232, 278, 1021, 10804, 3030, 29936, 13, 1678, 278, 25000, 4024, 1943, 18172, 304, 664, 278, 2030, 982, 310, 7863, 13, 1678, 263, 716, 16441, 1269, 931, 679, 29918, 7924, 580, 338, 2000, 29889, 13, 13, 1678, 9995, 13, 1678, 736, 903, 4703, 29918, 12847, 29889, 657, 29918, 1397, 4135, 29918, 17470, 1943, 580, 13, 13, 13, 16950, 353, 903, 4703, 29918, 12847, 29889, 16950, 13, 15945, 29908, 1576, 5534, 525, 16950, 29915, 6257, 1298, 1213, 15945, 13, 13, 13, 13236, 353, 903, 4703, 29918, 12847, 29889, 13236, 13, 15945, 29908, 1576, 5534, 525, 13236, 29915, 6257, 1298, 1213, 15945, 13, 13, 13, 1990, 5682, 4135, 12412, 29943, 562, 1943, 29898, 3318, 1125, 13, 1678, 9995, 29909, 16876, 770, 363, 11077, 310, 5534, 6012, 8871, 515, 2897, 417, 29889, 2585, 29889, 13, 13, 1678, 6317, 18164, 1057, 29871, 29896, 29889, 29896, 29906, 29889, 29900, 13, 4706, 3529, 671, 584, 1545, 18078, 359, 417, 29918, 2585, 29889, 2850, 284, 305, 6764, 29889, 10599, 17470, 1943, 29952, 363, 716, 5849, 29889, 13, 13, 1678, 1094, 263, 3489, 29892, 2897, 417, 29889, 2585, 508, 29915, 29873, 11097, 988, 304, 3787, 29914, 8256, 304, 1653, 6012, 13, 1678, 322, 4867, 28107, 8871, 29892, 577, 445, 1818, 367, 2175, 363, 263, 3646, 2280, 29889, 13, 13, 1678, 1551, 278, 916, 1361, 29892, 297, 1797, 304, 21092, 278, 594, 3385, 310, 2897, 417, 29889, 2585, 3620, 29892, 13, 1678, 591, 29915, 645, 3867, 263, 16876, 770, 29892, 607, 10017, 6012, 322, 4867, 28107, 13, 1678, 373, 967, 13213, 362, 322, 8128, 679, 29918, 10599, 580, 29914, 657, 29918, 7924, 580, 3519, 13, 1678, 393, 526, 15878, 411, 6590, 19725, 3168, 393, 5279, 13, 1678, 1863, 297, 3646, 9279, 29892, 321, 29889, 29887, 29889, 297, 16216, 29889, 13, 13, 1678, 6012, 29914, 7924, 28107, 8871, 674, 1603, 367, 5534, 313, 392, 896, 526, 6839, 304, 13, 1678, 367, 5534, 511, 541, 896, 674, 367, 6087, 297, 278, 623, 3030, 29892, 3265, 393, 297, 278, 13, 1678, 2897, 417, 29889, 2585, 3030, 29889, 13, 13, 1678, 7803, 4100, 2712, 304, 6456, 29901, 13, 13, 268, 29896, 29889, 530, 10863, 2777, 338, 17583, 263, 11565, 310, 6535, 12368, 29892, 577, 372, 29915, 29879, 13, 539, 6839, 304, 367, 7258, 313, 392, 372, 29915, 29879, 3244, 29899, 11177, 467, 13, 268, 29906, 29889, 319, 16441, 2777, 338, 451, 6839, 304, 367, 7258, 322, 11524, 263, 6535, 13, 539, 10804, 284, 3030, 313, 29875, 29889, 29872, 29889, 372, 29915, 29879, 451, 3244, 29899, 11177, 467, 4867, 28107, 338, 13, 539, 263, 12529, 310, 21396, 29889, 13, 13, 1678, 584, 3207, 4576, 29918, 9965, 29901, 278, 3957, 1347, 363, 278, 2566, 304, 671, 13, 1678, 584, 1853, 4576, 29918, 9965, 29901, 1347, 13, 13, 1678, 584, 3207, 19532, 29918, 9965, 29901, 278, 3957, 1347, 363, 278, 525, 29879, 18398, 29915, 2566, 13, 462, 632, 304, 671, 29889, 960, 451, 4944, 29892, 278, 5835, 2566, 13, 462, 632, 674, 367, 1304, 363, 599, 6931, 29889, 3940, 29901, 445, 13, 462, 632, 338, 6839, 304, 367, 1304, 363, 1283, 13234, 310, 1303, 13, 462, 632, 6931, 304, 408, 9524, 5794, 1634, 9169, 25569, 13, 462, 632, 304, 10032, 278, 2254, 373, 278, 5835, 2566, 29889, 13, 1678, 584, 1853, 19532, 29918, 9965, 29901, 1347, 13, 13, 1678, 584, 3207, 21120, 29918, 29888, 29895, 29901, 9025, 9117, 6611, 297, 23299, 13, 1678, 584, 1853, 21120, 29918, 29888, 29895, 29901, 6120, 13, 13, 1678, 584, 3207, 4469, 15060, 29901, 671, 4469, 15060, 4464, 363, 2825, 16441, 8871, 13, 1678, 584, 1853, 4469, 15060, 29901, 6120, 13, 13, 1678, 584, 3207, 1518, 533, 29918, 265, 29918, 15060, 29901, 1518, 533, 4867, 3618, 373, 9063, 13, 1678, 584, 1853, 1518, 533, 29918, 265, 29918, 15060, 29901, 6120, 13, 13, 1678, 7670, 1742, 6273, 29901, 13, 13, 1678, 584, 26766, 5749, 29918, 2850, 29918, 8513, 29901, 278, 3758, 4464, 304, 367, 1304, 363, 9254, 21396, 29889, 13, 462, 632, 313, 4381, 29879, 304, 10014, 3035, 22122, 1964, 29897, 13, 1678, 584, 26766, 5749, 29918, 12007, 29918, 299, 29890, 29901, 960, 5852, 29892, 1301, 862, 2705, 28936, 2304, 363, 13, 462, 1669, 11415, 9254, 2233, 5402, 313, 2797, 29933, 467, 13, 462, 1669, 313, 4381, 29879, 304, 7700, 29897, 13, 1678, 584, 26766, 3957, 29918, 276, 23090, 29918, 2230, 29901, 5974, 3785, 363, 12368, 304, 367, 13, 462, 9651, 1162, 11078, 839, 2501, 24808, 313, 4381, 29879, 304, 29871, 29941, 29953, 29900, 29900, 29897, 13, 1678, 584, 26766, 3957, 29918, 8382, 29901, 9750, 359, 537, 310, 3758, 13490, 2472, 29889, 13, 462, 1669, 448, 29896, 29922, 6880, 29892, 29871, 29900, 29922, 8516, 29892, 29871, 29896, 29900, 29900, 29922, 26526, 1918, 313, 4381, 29879, 13, 462, 1669, 304, 29871, 29900, 29897, 13, 1678, 584, 26766, 4236, 29918, 10109, 29918, 2311, 29901, 7472, 1353, 310, 3758, 12368, 304, 3013, 1722, 13, 462, 9651, 297, 263, 11565, 313, 4381, 29879, 304, 3758, 2499, 305, 6764, 6055, 29897, 13, 1678, 584, 26766, 4236, 29918, 2262, 29901, 565, 731, 29892, 671, 445, 995, 363, 4236, 29918, 2262, 411, 13, 462, 965, 4576, 284, 305, 6764, 313, 4381, 29879, 304, 3758, 2499, 305, 6764, 6055, 29897, 13, 1678, 584, 26766, 11565, 29918, 15619, 29901, 565, 731, 29892, 671, 445, 995, 363, 11565, 29918, 15619, 411, 13, 462, 965, 4576, 284, 305, 6764, 313, 4381, 29879, 304, 3758, 2499, 305, 6764, 6055, 29897, 13, 1678, 584, 26766, 21120, 29918, 29879, 15374, 29901, 565, 5852, 29892, 23299, 3913, 12231, 681, 4464, 13, 462, 462, 313, 4381, 29879, 304, 5852, 29897, 13, 1678, 584, 26766, 3957, 29918, 15003, 29901, 788, 3017, 5096, 26695, 304, 3758, 408, 3440, 13, 462, 1669, 6031, 313, 4381, 29879, 304, 7700, 29897, 13, 1678, 584, 26766, 4236, 29918, 2267, 2722, 29901, 7472, 4833, 3957, 3240, 2722, 2645, 20234, 29889, 13, 462, 3986, 313, 26740, 448, 29896, 10469, 385, 10362, 337, 2202, 2302, 29897, 13, 462, 3986, 313, 4381, 29879, 304, 29871, 29896, 29900, 29897, 13, 1678, 584, 26766, 337, 2202, 29918, 19207, 29901, 7292, 1546, 3240, 2722, 310, 8718, 263, 4576, 13, 462, 632, 3957, 313, 4381, 29879, 304, 29871, 29896, 29900, 29897, 13, 1678, 584, 26766, 3244, 29918, 3198, 262, 29901, 7223, 393, 14088, 393, 1546, 1269, 13, 462, 632, 6012, 1423, 262, 1741, 263, 8709, 29898, 29900, 29897, 674, 6403, 304, 13, 462, 632, 2758, 916, 1395, 9097, 949, 29879, 304, 1065, 313, 4381, 29879, 304, 13, 462, 632, 5852, 29897, 13, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4576, 29918, 9965, 29892, 19532, 29918, 9965, 29922, 8516, 29892, 13, 462, 21120, 29918, 29888, 29895, 29922, 8824, 29892, 4469, 15060, 29922, 5574, 29892, 13, 462, 1518, 533, 29918, 265, 29918, 15060, 29922, 8824, 29892, 903, 5527, 29922, 8516, 29892, 903, 14399, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 18116, 29889, 25442, 29898, 13, 9651, 376, 12412, 29943, 562, 1943, 338, 18164, 29936, 3113, 671, 376, 13, 9651, 376, 359, 417, 29918, 2585, 29889, 2850, 284, 305, 6764, 29889, 10599, 17470, 1943, 613, 13, 9651, 9177, 29889, 24768, 417, 4051, 8498, 3757, 362, 22709, 29892, 13, 9651, 5096, 5563, 29922, 29906, 29897, 13, 4706, 565, 903, 14399, 29901, 13, 9651, 1583, 3032, 14399, 353, 903, 14399, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 14399, 353, 903, 12460, 5126, 580, 13, 13, 9651, 1583, 3032, 14399, 29889, 17591, 29898, 13, 18884, 21120, 29918, 29888, 29895, 29922, 22793, 29918, 29888, 29895, 29892, 13, 18884, 4770, 6921, 15060, 29922, 6921, 15060, 29892, 13, 18884, 1518, 533, 29918, 265, 29918, 15060, 29922, 4548, 533, 29918, 265, 29918, 15060, 29892, 13, 18884, 3579, 19290, 13, 9651, 1723, 13, 9651, 396, 1207, 1854, 4502, 29899, 262, 23942, 526, 5025, 4395, 975, 393, 13, 9651, 396, 310, 2295, 13, 9651, 1583, 3032, 14399, 3032, 2962, 29898, 13, 18884, 903, 5527, 29892, 3957, 29922, 2850, 29918, 9965, 29892, 13, 18884, 19532, 29918, 9965, 29922, 29879, 18398, 29918, 9965, 29897, 13, 13, 1678, 822, 903, 3198, 29918, 14399, 29918, 2962, 287, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 14399, 3032, 2962, 287, 29901, 13, 9651, 1583, 3032, 14399, 3032, 2962, 580, 13, 13, 1678, 822, 679, 29918, 10599, 29898, 1311, 29892, 671, 29918, 29879, 18398, 29922, 8824, 1125, 13, 4706, 9995, 2577, 278, 6012, 2777, 313, 6812, 29892, 393, 372, 29915, 29879, 7258, 467, 13, 13, 4706, 584, 3207, 671, 29918, 29879, 18398, 29901, 565, 1950, 29892, 671, 525, 29879, 18398, 29915, 2566, 363, 445, 6012, 29889, 13, 462, 3986, 960, 278, 3957, 1347, 363, 278, 19532, 2566, 13, 462, 3986, 9007, 29915, 29873, 4944, 29892, 525, 6207, 29915, 6012, 674, 367, 4133, 29889, 13, 462, 3986, 313, 4381, 29879, 304, 7700, 29897, 13, 4706, 584, 1853, 671, 29918, 29879, 18398, 29901, 6120, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 3198, 29918, 14399, 29918, 2962, 287, 580, 13, 4706, 565, 671, 29918, 29879, 18398, 29901, 13, 9651, 736, 1583, 3032, 14399, 3032, 16950, 29918, 10599, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 14399, 3032, 13236, 29918, 10599, 13, 13, 1678, 822, 679, 29918, 7924, 29898, 1311, 29892, 671, 29918, 29879, 18398, 29922, 8824, 29892, 3579, 19290, 1125, 13, 4706, 9995, 2577, 263, 16441, 2777, 29889, 13, 13, 4706, 584, 3207, 671, 29918, 29879, 18398, 29901, 565, 1950, 29892, 671, 525, 29879, 18398, 29915, 2566, 3957, 363, 13, 462, 3986, 445, 4867, 29889, 960, 278, 3957, 1347, 363, 278, 13, 462, 3986, 19532, 2566, 9007, 29915, 29873, 4944, 29892, 263, 4867, 3216, 13, 462, 3986, 304, 278, 525, 6207, 29915, 6012, 674, 367, 4133, 29889, 13, 462, 3986, 313, 4381, 29879, 304, 7700, 29897, 13, 4706, 584, 1853, 671, 29918, 29879, 18398, 29901, 6120, 13, 13, 4706, 7670, 1742, 6273, 674, 367, 4502, 304, 263, 4867, 28107, 2777, 408, 338, 313, 361, 13, 4706, 4502, 29892, 896, 674, 5712, 278, 6743, 1304, 746, 278, 4867, 28107, 2777, 13, 4706, 471, 2825, 467, 2823, 3758, 2499, 305, 6764, 16441, 10561, 363, 4902, 29889, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 3198, 29918, 14399, 29918, 2962, 287, 580, 13, 4706, 565, 671, 29918, 29879, 18398, 29901, 13, 9651, 736, 1583, 3032, 14399, 3032, 16950, 29918, 28107, 29898, 1068, 19290, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 14399, 3032, 13236, 29918, 28107, 29898, 1068, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 7924, 28107, 29898, 1311, 29892, 671, 29918, 29879, 18398, 29922, 8824, 1125, 13, 4706, 9995, 2577, 278, 4867, 28107, 2777, 1304, 304, 1653, 263, 16441, 29889, 13, 13, 4706, 910, 508, 367, 2000, 363, 1906, 4251, 988, 278, 4867, 28107, 580, 338, 304, 13, 4706, 367, 5382, 6275, 11658, 287, 411, 777, 2106, 1316, 408, 263, 2702, 3957, 29889, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 3198, 29918, 14399, 29918, 2962, 287, 580, 13, 4706, 565, 671, 29918, 29879, 18398, 29901, 13, 9651, 736, 1583, 3032, 14399, 3032, 16950, 29918, 28107, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 14399, 3032, 13236, 29918, 28107, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 2917, 29898, 25932, 29892, 1970, 29892, 13, 462, 1678, 21120, 29918, 29888, 29895, 29922, 8824, 29892, 4469, 15060, 29922, 5574, 29892, 1518, 533, 29918, 265, 29918, 15060, 29922, 8824, 1125, 13, 4706, 9995, 6644, 6646, 10863, 29943, 562, 1943, 773, 2897, 417, 29889, 2917, 2295, 2777, 3987, 29889, 13, 13, 4706, 584, 3207, 1970, 29901, 2897, 417, 29889, 2917, 2295, 2777, 13, 4706, 584, 1853, 1970, 29901, 2897, 417, 29918, 2917, 29889, 16859, 29889, 3991, 29949, 16485, 13, 13, 4706, 584, 3207, 21120, 29918, 29888, 29895, 29901, 9025, 9117, 6611, 297, 23299, 13, 4706, 584, 1853, 21120, 29918, 29888, 29895, 29901, 6120, 13, 13, 4706, 584, 3207, 4469, 15060, 29901, 671, 4469, 15060, 4464, 363, 2825, 16441, 8871, 13, 4706, 584, 1853, 4469, 15060, 29901, 6120, 13, 13, 4706, 584, 3207, 1518, 533, 29918, 265, 29918, 15060, 29901, 1518, 533, 4867, 3618, 373, 9063, 13, 4706, 584, 1853, 1518, 533, 29918, 265, 29918, 15060, 29901, 6120, 13, 13, 4706, 9995, 13, 13, 4706, 736, 1067, 29879, 29898, 13, 9651, 6213, 29892, 13, 9651, 21120, 29918, 29888, 29895, 29922, 22793, 29918, 29888, 29895, 29892, 13, 9651, 4469, 15060, 29922, 6921, 15060, 29892, 13, 9651, 1518, 533, 29918, 265, 29918, 15060, 29922, 4548, 533, 29918, 265, 29918, 15060, 29892, 903, 5527, 29922, 5527, 29897, 13, 2 ]
transform_docker/server.py
briglx/AzureConvertJson
0
143152
<filename>transform_docker/server.py<gh_stars>0 """HTTP Server to transform json to json using liquid formatter.""" import json import logging import os import uuid from aiohttp import web from liquid import Liquid, filter_manager def generate_guid(): """Generate a UUID string.""" return str(uuid.uuid4()) def convert_quality_filter(quality): """Jinja2 Filter to convert quality score.""" quality_map = { "A01": "Poor", "A02": "OK", "A03": "Moderate", "A04": "Good", } if quality not in quality_map: raise ValueError("The quality is not a valid value. It must be A01 - A04") return quality_map[quality] def render(data, template_path, template_name, filters, debug=False): """Render data as a string for a given template.""" file_name = os.path.join(template_path, template_name) # Register Filter for filter_name, filter_code in filters.items(): filter_manager.register(filter_name)(filter_code) with open(file_name, "r") as template_file: template_string = template_file.read() template = Liquid(template_string, liquid_config={"debug": debug}) # Transform result_string = template.render(**data) # Unpack argument lists return result_string def render_dict(data, template_path, template_name, filters): """Render data as Json Dictionary for a given template.""" result_string = render(data, template_path, template_name, filters) return json.loads(result_string) async def post_api_transform(request): """Handle transform api call.""" LOGGER.info("post_api_transform called") # Get payload data = await request.json() # Add tracking guid data["system_guid"] = generate_guid() # set filters filters = {"convert": convert_quality_filter} # Transform message = render_dict(data, TEMPLATE_PATH, TEMPLATE_NAME, filters) return web.json_response(message) if __name__ == "__main__": LOGGER = logging.getLogger(__name__) LOGGER.info("Starting Python HTTP web server.") TEMPLATE_PATH = os.environ.get("TEMPLATE_PATH") TEMPLATE_NAME = os.environ.get("TEMPLATE_NAME") if not TEMPLATE_PATH: raise ValueError( "Template path is required." "Have you set the TEMPLATE_PATH env variable?" ) if not TEMPLATE_NAME: raise ValueError( "Template transform is required." "Have you set the TEMPLATE_NAME env variable?" ) app = web.Application() app.add_routes([web.post("/api/liquid_json_transform", post_api_transform)]) web.run_app(app)
[ 1, 529, 9507, 29958, 9067, 29918, 14695, 29914, 2974, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 10493, 5656, 304, 4327, 4390, 304, 4390, 773, 23904, 883, 2620, 1213, 15945, 13, 5215, 4390, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 318, 5416, 13, 13, 3166, 263, 601, 1124, 1053, 1856, 13, 3166, 23904, 1053, 2718, 339, 333, 29892, 4175, 29918, 12847, 13, 13, 13, 1753, 5706, 29918, 2543, 333, 7295, 13, 1678, 9995, 5631, 403, 263, 501, 11150, 1347, 1213, 15945, 13, 1678, 736, 851, 29898, 25118, 29889, 25118, 29946, 3101, 13, 13, 13, 1753, 3588, 29918, 29567, 29918, 4572, 29898, 29567, 1125, 13, 1678, 9995, 29967, 262, 1764, 29906, 19916, 304, 3588, 11029, 8158, 1213, 15945, 13, 1678, 11029, 29918, 1958, 353, 426, 13, 4706, 376, 29909, 29900, 29896, 1115, 376, 9837, 272, 613, 13, 4706, 376, 29909, 29900, 29906, 1115, 376, 8949, 613, 13, 4706, 376, 29909, 29900, 29941, 1115, 376, 2111, 261, 403, 613, 13, 4706, 376, 29909, 29900, 29946, 1115, 376, 18420, 613, 13, 1678, 500, 13, 13, 1678, 565, 11029, 451, 297, 11029, 29918, 1958, 29901, 13, 4706, 12020, 7865, 2392, 703, 1576, 11029, 338, 451, 263, 2854, 995, 29889, 739, 1818, 367, 319, 29900, 29896, 448, 319, 29900, 29946, 1159, 13, 13, 1678, 736, 11029, 29918, 1958, 29961, 29567, 29962, 13, 13, 13, 1753, 4050, 29898, 1272, 29892, 4472, 29918, 2084, 29892, 4472, 29918, 978, 29892, 18094, 29892, 4744, 29922, 8824, 1125, 13, 1678, 9995, 10716, 848, 408, 263, 1347, 363, 263, 2183, 4472, 1213, 15945, 13, 1678, 934, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 6886, 29918, 2084, 29892, 4472, 29918, 978, 29897, 13, 13, 1678, 396, 12577, 19916, 13, 1678, 363, 4175, 29918, 978, 29892, 4175, 29918, 401, 297, 18094, 29889, 7076, 7295, 13, 4706, 4175, 29918, 12847, 29889, 9573, 29898, 4572, 29918, 978, 5033, 4572, 29918, 401, 29897, 13, 13, 1678, 411, 1722, 29898, 1445, 29918, 978, 29892, 376, 29878, 1159, 408, 4472, 29918, 1445, 29901, 13, 4706, 4472, 29918, 1807, 353, 4472, 29918, 1445, 29889, 949, 580, 13, 1678, 4472, 353, 2718, 339, 333, 29898, 6886, 29918, 1807, 29892, 23904, 29918, 2917, 3790, 29908, 8382, 1115, 4744, 1800, 13, 13, 1678, 396, 4103, 689, 13, 1678, 1121, 29918, 1807, 353, 4472, 29889, 9482, 29898, 1068, 1272, 29897, 29871, 396, 853, 4058, 2980, 8857, 13, 13, 1678, 736, 1121, 29918, 1807, 13, 13, 13, 1753, 4050, 29918, 8977, 29898, 1272, 29892, 4472, 29918, 2084, 29892, 4472, 29918, 978, 29892, 18094, 1125, 13, 1678, 9995, 10716, 848, 408, 14355, 13343, 363, 263, 2183, 4472, 1213, 15945, 13, 1678, 1121, 29918, 1807, 353, 4050, 29898, 1272, 29892, 4472, 29918, 2084, 29892, 4472, 29918, 978, 29892, 18094, 29897, 13, 13, 1678, 736, 4390, 29889, 18132, 29898, 2914, 29918, 1807, 29897, 13, 13, 13, 12674, 822, 1400, 29918, 2754, 29918, 9067, 29898, 3827, 1125, 13, 1678, 9995, 13554, 4327, 7882, 1246, 1213, 15945, 13, 1678, 25401, 17070, 29889, 3888, 703, 2490, 29918, 2754, 29918, 9067, 2000, 1159, 13, 13, 1678, 396, 3617, 20092, 13, 1678, 848, 353, 7272, 2009, 29889, 3126, 580, 13, 13, 1678, 396, 3462, 23110, 16605, 13, 1678, 848, 3366, 5205, 29918, 2543, 333, 3108, 353, 5706, 29918, 2543, 333, 580, 13, 13, 1678, 396, 731, 18094, 13, 1678, 18094, 353, 8853, 13441, 1115, 3588, 29918, 29567, 29918, 4572, 29913, 13, 13, 1678, 396, 4103, 689, 13, 1678, 2643, 353, 4050, 29918, 8977, 29898, 1272, 29892, 17067, 3580, 29931, 3040, 29918, 10145, 29892, 17067, 3580, 29931, 3040, 29918, 5813, 29892, 18094, 29897, 13, 13, 1678, 736, 1856, 29889, 3126, 29918, 5327, 29898, 4906, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 25401, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 1678, 25401, 17070, 29889, 3888, 703, 4763, 292, 5132, 7331, 1856, 1923, 23157, 13, 13, 1678, 17067, 3580, 29931, 3040, 29918, 10145, 353, 2897, 29889, 21813, 29889, 657, 703, 4330, 3580, 29931, 3040, 29918, 10145, 1159, 13, 1678, 17067, 3580, 29931, 3040, 29918, 5813, 353, 2897, 29889, 21813, 29889, 657, 703, 4330, 3580, 29931, 3040, 29918, 5813, 1159, 13, 13, 1678, 565, 451, 17067, 3580, 29931, 3040, 29918, 10145, 29901, 13, 4706, 12020, 7865, 2392, 29898, 13, 9651, 376, 6733, 2224, 338, 3734, 1213, 376, 25559, 366, 731, 278, 17067, 3580, 29931, 3040, 29918, 10145, 8829, 2286, 3026, 13, 4706, 1723, 13, 13, 1678, 565, 451, 17067, 3580, 29931, 3040, 29918, 5813, 29901, 13, 4706, 12020, 7865, 2392, 29898, 13, 9651, 376, 6733, 4327, 338, 3734, 1213, 13, 9651, 376, 25559, 366, 731, 278, 17067, 3580, 29931, 3040, 29918, 5813, 8829, 2286, 3026, 13, 4706, 1723, 13, 13, 1678, 623, 353, 1856, 29889, 4873, 580, 13, 1678, 623, 29889, 1202, 29918, 27894, 4197, 2676, 29889, 2490, 11974, 2754, 29914, 28378, 333, 29918, 3126, 29918, 9067, 613, 1400, 29918, 2754, 29918, 9067, 29897, 2314, 13, 1678, 1856, 29889, 3389, 29918, 932, 29898, 932, 29897, 13, 2 ]
raiden_client/interfaces/cli_commands/channels.py
s0b0lev/raiden-client-python
3
181743
<filename>raiden_client/interfaces/cli_commands/channels.py from argparse import ArgumentParser, Namespace, _SubParsersAction from raiden_client import Client, utils def configure_parser(arg_parser: ArgumentParser, subparser: _SubParsersAction) -> None: channels = subparser.add_parser("channels", help="Request a list of all unsettled channels") channels.add_argument("-t", "--token-address", required=False, help="For the given token address") channels.set_defaults(func=parser_function) def parser_function(args: Namespace) -> str: client = Client(endpoint=args.endpoint, version=args.version) channels = client.channels(token_address=args.token_address) return utils.print_stdout(channels)
[ 1, 529, 9507, 29958, 336, 3615, 29918, 4645, 29914, 1639, 8726, 29914, 11303, 29918, 26381, 29914, 305, 12629, 29889, 2272, 13, 3166, 1852, 5510, 1053, 23125, 11726, 29892, 14706, 3535, 29892, 903, 4035, 29925, 1503, 414, 4276, 13, 13, 3166, 1153, 3615, 29918, 4645, 1053, 12477, 29892, 3667, 29879, 13, 13, 13, 1753, 10822, 29918, 16680, 29898, 1191, 29918, 16680, 29901, 23125, 11726, 29892, 1014, 16680, 29901, 903, 4035, 29925, 1503, 414, 4276, 29897, 1599, 6213, 29901, 13, 1678, 18196, 353, 1014, 16680, 29889, 1202, 29918, 16680, 703, 305, 12629, 613, 1371, 543, 3089, 263, 1051, 310, 599, 443, 9915, 839, 18196, 1159, 13, 1678, 18196, 29889, 1202, 29918, 23516, 703, 29899, 29873, 613, 376, 489, 6979, 29899, 7328, 613, 3734, 29922, 8824, 29892, 1371, 543, 2831, 278, 2183, 5993, 3211, 1159, 13, 1678, 18196, 29889, 842, 29918, 4381, 29879, 29898, 9891, 29922, 16680, 29918, 2220, 29897, 13, 13, 13, 1753, 13812, 29918, 2220, 29898, 5085, 29901, 14706, 3535, 29897, 1599, 851, 29901, 13, 1678, 3132, 353, 12477, 29898, 29734, 29922, 5085, 29889, 29734, 29892, 1873, 29922, 5085, 29889, 3259, 29897, 13, 1678, 18196, 353, 3132, 29889, 305, 12629, 29898, 6979, 29918, 7328, 29922, 5085, 29889, 6979, 29918, 7328, 29897, 13, 1678, 736, 3667, 29879, 29889, 2158, 29918, 25393, 29898, 305, 12629, 29897, 13, 2 ]
manimpy/right_angle.py
Jin-Yuhan/manimpy
1
48193
# from @cigar666 # cgnb!!!! from manimlib.imports import * class RightAngle(VGroup): CONFIG = { 'size': 0.25, 'stroke_color': WHITE, 'stroke_width': 3.2, 'fill_color': BLUE, 'fill_opacity': 0.5, 'on_the_right': True, } def __init__(self, corner=ORIGIN, angle=0, **kwargs): VGroup.__init__(self, **kwargs) self.corner = ORIGIN self.angle = 0 r = UR if self.on_the_right else UL self.add( Polygon(ORIGIN, RIGHT * self.size * r, UR * self.size * r, UP * self.size * r, stroke_width=0, fill_color=self.fill_color, fill_opacity=self.fill_opacity), Line(RIGHT * self.size * r, UR * self.size * r + UP * self.stroke_width / 100 / 2 * 0.8, stroke_width=self.stroke_width, stroke_color=self.stroke_color), Line(UR * self.size * r + RIGHT * self.stroke_width / 100 / 2 * r * 0.8, UP * self.size * r, stroke_width=self.stroke_width, stroke_color=self.stroke_color), ) self.move_corner_to(corner) self.change_angle_to(angle) def move_corner_to(self, new_corner): self.shift(new_corner - self.corner) self.corner = new_corner return self def change_angle_to(self, new_angle): self.rotate(new_angle - self.angle, about_point=self.corner) self.angle = new_angle return self
[ 1, 396, 515, 732, 29883, 335, 279, 29953, 29953, 29953, 13, 29937, 274, 5138, 29890, 6824, 6824, 13, 13, 3166, 767, 326, 1982, 29889, 326, 4011, 1053, 334, 13, 13, 13, 1990, 10428, 19582, 29898, 29963, 4782, 1125, 13, 1678, 8707, 18667, 353, 426, 13, 4706, 525, 2311, 2396, 29871, 29900, 29889, 29906, 29945, 29892, 13, 4706, 525, 25893, 29918, 2780, 2396, 12317, 9094, 29892, 13, 4706, 525, 25893, 29918, 2103, 2396, 29871, 29941, 29889, 29906, 29892, 13, 4706, 525, 5589, 29918, 2780, 2396, 350, 29931, 4462, 29892, 13, 4706, 525, 5589, 29918, 28193, 2396, 29871, 29900, 29889, 29945, 29892, 13, 4706, 525, 265, 29918, 1552, 29918, 1266, 2396, 5852, 29892, 13, 1678, 500, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 11155, 29922, 1955, 6259, 1177, 29892, 10696, 29922, 29900, 29892, 3579, 19290, 1125, 13, 4706, 478, 4782, 17255, 2344, 12035, 1311, 29892, 3579, 19290, 29897, 13, 4706, 1583, 29889, 2616, 1089, 353, 438, 22789, 1177, 13, 4706, 1583, 29889, 2521, 353, 29871, 29900, 13, 4706, 364, 353, 501, 29934, 565, 1583, 29889, 265, 29918, 1552, 29918, 1266, 1683, 501, 29931, 13, 4706, 1583, 29889, 1202, 29898, 13, 18884, 2043, 17125, 29898, 1955, 6259, 1177, 29892, 390, 22530, 334, 1583, 29889, 2311, 334, 364, 29892, 501, 29934, 334, 1583, 29889, 2311, 334, 364, 29892, 11901, 334, 1583, 29889, 2311, 334, 364, 29892, 19782, 29918, 2103, 29922, 29900, 29892, 13, 462, 4706, 5445, 29918, 2780, 29922, 1311, 29889, 5589, 29918, 2780, 29892, 5445, 29918, 28193, 29922, 1311, 29889, 5589, 29918, 28193, 511, 13, 13, 18884, 7407, 29898, 22789, 3912, 334, 1583, 29889, 2311, 334, 364, 29892, 501, 29934, 334, 1583, 29889, 2311, 334, 364, 718, 11901, 334, 1583, 29889, 25893, 29918, 2103, 847, 29871, 29896, 29900, 29900, 847, 29871, 29906, 334, 29871, 29900, 29889, 29947, 29892, 13, 462, 268, 19782, 29918, 2103, 29922, 1311, 29889, 25893, 29918, 2103, 29892, 19782, 29918, 2780, 29922, 1311, 29889, 25893, 29918, 2780, 511, 13, 13, 18884, 7407, 29898, 4574, 334, 1583, 29889, 2311, 334, 364, 718, 390, 22530, 334, 1583, 29889, 25893, 29918, 2103, 847, 29871, 29896, 29900, 29900, 847, 29871, 29906, 334, 364, 334, 29871, 29900, 29889, 29947, 29892, 11901, 334, 1583, 29889, 2311, 334, 364, 29892, 13, 462, 268, 19782, 29918, 2103, 29922, 1311, 29889, 25893, 29918, 2103, 29892, 19782, 29918, 2780, 29922, 1311, 29889, 25893, 29918, 2780, 511, 13, 462, 1723, 13, 4706, 1583, 29889, 11631, 29918, 2616, 1089, 29918, 517, 29898, 2616, 1089, 29897, 13, 4706, 1583, 29889, 3167, 29918, 2521, 29918, 517, 29898, 2521, 29897, 13, 13, 1678, 822, 4337, 29918, 2616, 1089, 29918, 517, 29898, 1311, 29892, 716, 29918, 2616, 1089, 1125, 13, 4706, 1583, 29889, 10889, 29898, 1482, 29918, 2616, 1089, 448, 1583, 29889, 2616, 1089, 29897, 13, 4706, 1583, 29889, 2616, 1089, 353, 716, 29918, 2616, 1089, 13, 4706, 736, 1583, 13, 13, 1678, 822, 1735, 29918, 2521, 29918, 517, 29898, 1311, 29892, 716, 29918, 2521, 1125, 13, 4706, 1583, 29889, 23361, 29898, 1482, 29918, 2521, 448, 1583, 29889, 2521, 29892, 1048, 29918, 3149, 29922, 1311, 29889, 2616, 1089, 29897, 13, 4706, 1583, 29889, 2521, 353, 716, 29918, 2521, 13, 4706, 736, 1583, 13, 13, 2 ]
web_scraper/extract/common.py
rarc41/web_scraper_pro
0
3010
<reponame>rarc41/web_scraper_pro<filename>web_scraper/extract/common.py import yaml __config=None def config(): global __config if not __config: with open('config.yaml', mode='r') as f: __config=yaml.safe_load(f) return __config
[ 1, 529, 276, 1112, 420, 29958, 29878, 5666, 29946, 29896, 29914, 2676, 29918, 1557, 336, 546, 29918, 771, 29966, 9507, 29958, 2676, 29918, 1557, 336, 546, 29914, 21111, 29914, 9435, 29889, 2272, 13, 5215, 343, 8807, 13, 13, 13, 1649, 2917, 29922, 8516, 13, 13, 13, 1753, 2295, 7295, 13, 1678, 5534, 4770, 2917, 13, 1678, 565, 451, 4770, 2917, 29901, 13, 4706, 411, 1722, 877, 2917, 29889, 25162, 742, 4464, 2433, 29878, 1495, 408, 285, 29901, 13, 9651, 4770, 2917, 29922, 25162, 29889, 11177, 29918, 1359, 29898, 29888, 29897, 13, 632, 13, 1678, 736, 4770, 2917, 2 ]
000-025/p010/inle.py
CDL-Project-Euler/Solutions
3
75509
def checkprime(value: int): factor = 2 sqrt = value ** 0.5 while factor <= sqrt: if value % factor == 0: return False factor += 1 return True def sum_primes_under(n: int): num = 2 sum = 0 while num < n: if checkprime(num): sum += num num += 1 return(sum) if __name__ == "__main__": print(sum_primes_under(10))
[ 1, 822, 1423, 10080, 29898, 1767, 29901, 938, 1125, 13, 1678, 7329, 353, 29871, 29906, 13, 1678, 18074, 2273, 353, 995, 3579, 29871, 29900, 29889, 29945, 13, 1678, 1550, 7329, 5277, 18074, 2273, 29901, 13, 4706, 565, 995, 1273, 7329, 1275, 29871, 29900, 29901, 13, 9651, 736, 7700, 13, 4706, 7329, 4619, 29871, 29896, 13, 1678, 736, 5852, 13, 13, 13, 1753, 2533, 29918, 558, 1355, 29918, 5062, 29898, 29876, 29901, 938, 1125, 13, 1678, 954, 353, 29871, 29906, 13, 1678, 2533, 353, 29871, 29900, 13, 1678, 1550, 954, 529, 302, 29901, 13, 4706, 565, 1423, 10080, 29898, 1949, 1125, 13, 9651, 2533, 4619, 954, 13, 4706, 954, 4619, 29871, 29896, 13, 1678, 736, 29898, 2083, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1596, 29898, 2083, 29918, 558, 1355, 29918, 5062, 29898, 29896, 29900, 876, 2 ]
sc_utils/dhcp_listener.py
jkulawik/ServiceChecker
0
171543
#!/usr/bin/env python3 """scapy-dhcp-listener.py Listen for DHCP packets using scapy to learn when LAN hosts request IP addresses from DHCP Servers. Copyright (C) 2018 <NAME> https://jcutrer.com/python/scapy-dhcp-listener License Dual MIT, 0BSD Extended by jkulawik, 2020 """ from __future__ import print_function from scapy.all import * from scapy.layers.dhcp import DHCP from scapy.layers.dhcp import Ether from scapy.layers.dhcp import BOOTP from scapy.layers.dhcp import IP # Logging from datetime import date from inspect import getsourcefile from sc_utils import mac_vendor from scapy.layers.l2 import getmacbyip whitelist_file = 'MAC_whitelist.txt' __version__ = "0.0.4" def add_zero_to_time(time): if time < 10: return '0'+ time else: return time # print_and_log current time def pal_time(): todays_date = datetime.now() hour = add_zero_to_time(todays_date.hour) minute = add_zero_to_time(todays_date.minute) curr_time = '\n{}:{}'.format(hour, minute) print_and_log(curr_time) def check_whitelist(mac): with open(whitelist_file, 'r') as file: whitelist = file.read() return mac in whitelist def print_and_log(message): print(message) log(message) # Print a message into today's log in /logs def log(message): dir = 'logs' if not os.path.exists(dir): # The folder gets created in the run directory automatically... os.makedirs(dir) # ...but for file writing a full path is needed current_dir = os.path.dirname(getsourcefile(lambda: 0)) path = os.path.join(current_dir, 'logs') file_name = str(date.today()) + '-log.txt' file_path = os.path.join(path, file_name) file = open(file_path, "a") file.write(message + '\n') file.close() # Fixup function to extract dhcp_options by key def get_option(dhcp_options, key): must_decode = ['hostname', 'domain', 'vendor_class_id'] try: for i in dhcp_options: if i[0] == key: # If DHCP Server Returned multiple name servers # return all as comma separated string. if key == 'name_server' and len(i) > 2: return ",".join(i[1:]) # domain and hostname are binary strings, # decode to unicode string before returning elif key in must_decode: return i[1].decode() else: return i[1] except: pass def handle_dhcp_packet(packet): # Match DHCP discover if DHCP in packet and packet[DHCP].options[0][1] == 1: print('---') print('New DHCP Discover') #print(packet.summary()) #print(ls(packet)) hostname = get_option(packet[DHCP].options, 'hostname') mac = packet[Ether].src if check_whitelist(mac): print(f'Whitelisted host {hostname} asked for an IP.') print(f'Host vendor: {mac_vendor.get_str(mac)}') print(f'Host MAC: {mac}') return pal_time() print_and_log(f"Unknown host {hostname} asked for an IP.") print_and_log(f'Host vendor: {mac_vendor.get_str(mac)}') print_and_log(f'Host MAC: {mac}') # Match DHCP ack elif DHCP in packet and packet[DHCP].options[0][1] == 5\ and packet[BOOTP].yiaddr != '0.0.0.0': print('---') print('New DHCP Ack') #print(packet.summary()) #print(ls(packet)) subnet_mask = get_option(packet[DHCP].options, 'subnet_mask') lease_time = get_option(packet[DHCP].options, 'lease_time') router = get_option(packet[DHCP].options, 'router') name_server = get_option(packet[DHCP].options, 'name_server') server_mac = packet[Ether].src server_ip = packet[IP].src sus_ip = packet[BOOTP].yiaddr sus_mac = str(getmacbyip(sus_ip)) sus_vendor = mac_vendor.get_str(sus_mac) if check_whitelist(sus_mac): print(f"DHCP Server {server_ip} ({server_mac}) acknowledged a whitelisted device on IP {sus_ip}") print(f'Host vendor: {mac_vendor.get_str(sus_vendor)}') print(f'Host MAC: {sus_mac}\n') return pal_time() print_and_log(f"DHCP Server {server_ip} ({server_mac}) acknowledged unknown device on IP {sus_ip}") print_and_log(f'Unknown host vendor: {mac_vendor.get_str(sus_vendor)}') print_and_log(f'Unknown host MAC: {sus_mac}\n') print(f"DHCP Options: subnet_mask: {subnet_mask}, lease_time: " f"{lease_time}, router: {router}, name_server: {name_server}") # Match DHCP inform elif DHCP in packet and packet[DHCP].options[0][1] == 8: print('---') print('New DHCP Inform') #print(packet.summary()) #print(ls(packet)) hostname = get_option(packet[DHCP].options, 'hostname') vendor_class_id = get_option(packet[DHCP].options, 'vendor_class_id') print(f"DHCP Inform from {packet[IP].src} ({packet[Ether].src}) " f"hostname: {hostname}, vendor_class_id: {vendor_class_id}") else: print('---') print('Some Other DHCP Packet') print(packet.summary()) #print(ls(packet)) return # This is just to use this script as a dependency def start_sniffing(): # Create MAC whitelist if not os.path.exists(whitelist_file): open(whitelist_file, "w+") print('Sniffing DHCP broadcasts...') print('Press Ctrl+C to stop.') sniff(filter="udp and (port 67 or 68)", prn=handle_dhcp_packet) if __name__ == "__main__": sniff(filter="udp and (port 67 or 68)", prn=handle_dhcp_packet)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 15945, 29908, 1557, 27580, 29899, 12744, 6814, 29899, 25894, 29889, 2272, 13, 1293, 264, 363, 360, 29950, 6271, 23912, 773, 885, 27580, 304, 5110, 746, 365, 2190, 29871, 13, 23525, 2009, 5641, 14157, 515, 360, 29950, 6271, 1816, 874, 29889, 13, 11882, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29947, 529, 5813, 29958, 13, 991, 597, 29926, 7582, 2872, 29889, 510, 29914, 4691, 29914, 1557, 27580, 29899, 12744, 6814, 29899, 25894, 13, 29931, 293, 1947, 360, 950, 341, 1806, 29892, 29871, 29900, 29933, 7230, 13, 13, 5647, 2760, 491, 432, 29895, 352, 1450, 638, 29892, 29871, 29906, 29900, 29906, 29900, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 3166, 885, 27580, 29889, 497, 1053, 334, 13, 13, 3166, 885, 27580, 29889, 29277, 29889, 12744, 6814, 1053, 360, 29950, 6271, 13, 3166, 885, 27580, 29889, 29277, 29889, 12744, 6814, 1053, 382, 721, 13, 3166, 885, 27580, 29889, 29277, 29889, 12744, 6814, 1053, 16437, 2891, 29925, 13, 3166, 885, 27580, 29889, 29277, 29889, 12744, 6814, 1053, 5641, 13, 13, 29937, 4522, 3460, 13, 3166, 12865, 1053, 2635, 13, 3166, 16096, 1053, 4947, 1167, 1445, 13, 3166, 885, 29918, 13239, 1053, 5825, 29918, 19167, 13, 3166, 885, 27580, 29889, 29277, 29889, 29880, 29906, 1053, 679, 8628, 1609, 666, 13, 13, 1332, 7454, 391, 29918, 1445, 353, 525, 1529, 29907, 29918, 1332, 7454, 391, 29889, 3945, 29915, 13, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29900, 29889, 29946, 29908, 13, 13, 13, 1753, 788, 29918, 9171, 29918, 517, 29918, 2230, 29898, 2230, 1125, 13, 1678, 565, 931, 529, 29871, 29896, 29900, 29901, 13, 4706, 736, 525, 29900, 18717, 931, 13, 1678, 1683, 29901, 13, 4706, 736, 931, 13, 13, 13, 29937, 1596, 29918, 392, 29918, 1188, 1857, 931, 13, 1753, 5112, 29918, 2230, 7295, 13, 1678, 7379, 1036, 29918, 1256, 353, 12865, 29889, 3707, 580, 13, 1678, 7234, 353, 788, 29918, 9171, 29918, 517, 29918, 2230, 29898, 20034, 1036, 29918, 1256, 29889, 18721, 29897, 13, 1678, 11015, 353, 788, 29918, 9171, 29918, 517, 29918, 2230, 29898, 20034, 1036, 29918, 1256, 29889, 1195, 1082, 29897, 13, 1678, 16256, 29918, 2230, 353, 11297, 29876, 29912, 6177, 8875, 4286, 4830, 29898, 18721, 29892, 11015, 29897, 13, 1678, 1596, 29918, 392, 29918, 1188, 29898, 21962, 29918, 2230, 29897, 13, 13, 13, 1753, 1423, 29918, 1332, 7454, 391, 29898, 8628, 1125, 13, 1678, 411, 1722, 29898, 1332, 7454, 391, 29918, 1445, 29892, 525, 29878, 1495, 408, 934, 29901, 13, 4706, 377, 7454, 391, 353, 934, 29889, 949, 580, 13, 1678, 736, 5825, 297, 377, 7454, 391, 13, 13, 13, 1753, 1596, 29918, 392, 29918, 1188, 29898, 4906, 1125, 13, 1678, 1596, 29898, 4906, 29897, 13, 1678, 1480, 29898, 4906, 29897, 13, 13, 13, 29937, 13905, 263, 2643, 964, 9826, 29915, 29879, 1480, 297, 847, 20756, 13, 1753, 1480, 29898, 4906, 1125, 13, 1678, 4516, 353, 525, 20756, 29915, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 3972, 1125, 13, 4706, 396, 450, 4138, 4947, 2825, 297, 278, 1065, 3884, 6336, 856, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 3972, 29897, 13, 13, 1678, 396, 2023, 4187, 363, 934, 5007, 263, 2989, 2224, 338, 4312, 13, 1678, 1857, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 657, 4993, 1445, 29898, 2892, 29901, 29871, 29900, 876, 13, 1678, 2224, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3784, 29918, 3972, 29892, 525, 20756, 1495, 13, 13, 1678, 934, 29918, 978, 353, 851, 29898, 1256, 29889, 27765, 3101, 718, 17411, 1188, 29889, 3945, 29915, 13, 1678, 934, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 934, 29918, 978, 29897, 13, 13, 1678, 934, 353, 1722, 29898, 1445, 29918, 2084, 29892, 376, 29874, 1159, 13, 1678, 934, 29889, 3539, 29898, 4906, 718, 11297, 29876, 1495, 13, 1678, 934, 29889, 5358, 580, 13, 13, 13, 29937, 24778, 786, 740, 304, 6597, 270, 29882, 6814, 29918, 6768, 491, 1820, 13, 1753, 679, 29918, 3385, 29898, 12744, 6814, 29918, 6768, 29892, 1820, 1125, 13, 13, 1678, 1818, 29918, 13808, 353, 6024, 28988, 742, 525, 7247, 742, 525, 19167, 29918, 1990, 29918, 333, 2033, 13, 1678, 1018, 29901, 13, 4706, 363, 474, 297, 270, 29882, 6814, 29918, 6768, 29901, 13, 9651, 565, 474, 29961, 29900, 29962, 1275, 1820, 29901, 13, 18884, 396, 960, 360, 29950, 6271, 5656, 7106, 287, 2999, 1024, 12424, 29871, 13, 18884, 396, 736, 599, 408, 16694, 13055, 1347, 29889, 13, 18884, 565, 1820, 1275, 525, 978, 29918, 2974, 29915, 322, 7431, 29898, 29875, 29897, 1405, 29871, 29906, 29901, 13, 462, 1678, 736, 9162, 1642, 7122, 29898, 29875, 29961, 29896, 29901, 2314, 13, 18884, 396, 5354, 322, 3495, 978, 526, 7581, 6031, 29892, 13, 18884, 396, 21822, 304, 29104, 1347, 1434, 7863, 13, 18884, 25342, 1820, 297, 1818, 29918, 13808, 29901, 13, 462, 1678, 736, 474, 29961, 29896, 1822, 13808, 580, 13, 18884, 1683, 29901, 29871, 13, 462, 1678, 736, 474, 29961, 29896, 29962, 308, 13, 1678, 5174, 29901, 13, 4706, 1209, 13, 13, 13, 1753, 4386, 29918, 12744, 6814, 29918, 4058, 300, 29898, 4058, 300, 1125, 13, 13, 1678, 396, 14514, 360, 29950, 6271, 6523, 13, 1678, 565, 360, 29950, 6271, 297, 18203, 322, 18203, 29961, 29928, 29950, 6271, 1822, 6768, 29961, 29900, 3816, 29896, 29962, 1275, 29871, 29896, 29901, 13, 4706, 1596, 877, 5634, 1495, 13, 4706, 1596, 877, 4373, 360, 29950, 6271, 8565, 957, 1495, 13, 4706, 396, 2158, 29898, 4058, 300, 29889, 7727, 3101, 13, 4706, 396, 2158, 29898, 3137, 29898, 4058, 300, 876, 13, 4706, 3495, 978, 353, 679, 29918, 3385, 29898, 4058, 300, 29961, 29928, 29950, 6271, 1822, 6768, 29892, 525, 28988, 1495, 13, 4706, 5825, 353, 18203, 29961, 29923, 721, 1822, 4351, 13, 13, 4706, 565, 1423, 29918, 1332, 7454, 391, 29898, 8628, 1125, 13, 9651, 1596, 29898, 29888, 29915, 8809, 7454, 12652, 3495, 426, 28988, 29913, 4433, 363, 385, 5641, 29889, 1495, 13, 9651, 1596, 29898, 29888, 29915, 8514, 27042, 29901, 426, 8628, 29918, 19167, 29889, 657, 29918, 710, 29898, 8628, 2915, 1495, 13, 9651, 1596, 29898, 29888, 29915, 8514, 26750, 29901, 426, 8628, 29913, 1495, 13, 9651, 736, 13, 13, 4706, 5112, 29918, 2230, 580, 13, 4706, 1596, 29918, 392, 29918, 1188, 29898, 29888, 29908, 14148, 3495, 426, 28988, 29913, 4433, 363, 385, 5641, 23157, 13, 4706, 1596, 29918, 392, 29918, 1188, 29898, 29888, 29915, 8514, 27042, 29901, 426, 8628, 29918, 19167, 29889, 657, 29918, 710, 29898, 8628, 2915, 1495, 13, 4706, 1596, 29918, 392, 29918, 1188, 29898, 29888, 29915, 8514, 26750, 29901, 426, 8628, 29913, 1495, 13, 13, 1678, 396, 14514, 360, 29950, 6271, 263, 384, 13, 1678, 25342, 360, 29950, 6271, 297, 18203, 322, 18203, 29961, 29928, 29950, 6271, 1822, 6768, 29961, 29900, 3816, 29896, 29962, 1275, 29871, 29945, 29905, 13, 9651, 322, 18203, 29961, 8456, 2891, 29925, 1822, 25675, 10030, 2804, 525, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 2396, 13, 4706, 1596, 877, 5634, 1495, 13, 4706, 1596, 877, 4373, 360, 29950, 6271, 319, 384, 1495, 13, 4706, 396, 2158, 29898, 4058, 300, 29889, 7727, 3101, 13, 4706, 396, 2158, 29898, 3137, 29898, 4058, 300, 876, 13, 13, 4706, 1014, 1212, 29918, 13168, 353, 679, 29918, 3385, 29898, 4058, 300, 29961, 29928, 29950, 6271, 1822, 6768, 29892, 525, 1491, 1212, 29918, 13168, 1495, 13, 4706, 454, 559, 29918, 2230, 353, 679, 29918, 3385, 29898, 4058, 300, 29961, 29928, 29950, 6271, 1822, 6768, 29892, 525, 1511, 29918, 2230, 1495, 13, 4706, 12876, 353, 679, 29918, 3385, 29898, 4058, 300, 29961, 29928, 29950, 6271, 1822, 6768, 29892, 525, 15140, 1495, 13, 4706, 1024, 29918, 2974, 353, 679, 29918, 3385, 29898, 4058, 300, 29961, 29928, 29950, 6271, 1822, 6768, 29892, 525, 978, 29918, 2974, 1495, 13, 13, 4706, 1923, 29918, 8628, 353, 18203, 29961, 29923, 721, 1822, 4351, 13, 4706, 1923, 29918, 666, 353, 18203, 29961, 5690, 1822, 4351, 13, 13, 4706, 2858, 29918, 666, 353, 18203, 29961, 8456, 2891, 29925, 1822, 25675, 10030, 13, 4706, 2858, 29918, 8628, 353, 851, 29898, 657, 8628, 1609, 666, 29898, 29879, 375, 29918, 666, 876, 13, 4706, 2858, 29918, 19167, 353, 5825, 29918, 19167, 29889, 657, 29918, 710, 29898, 29879, 375, 29918, 8628, 29897, 13, 13, 4706, 565, 1423, 29918, 1332, 7454, 391, 29898, 29879, 375, 29918, 8628, 1125, 13, 9651, 1596, 29898, 29888, 29908, 29928, 29950, 6271, 5656, 426, 2974, 29918, 666, 29913, 21313, 2974, 29918, 8628, 1800, 24084, 3192, 263, 377, 7454, 12652, 4742, 373, 5641, 426, 29879, 375, 29918, 666, 27195, 13, 9651, 1596, 29898, 29888, 29915, 8514, 27042, 29901, 426, 8628, 29918, 19167, 29889, 657, 29918, 710, 29898, 29879, 375, 29918, 19167, 2915, 1495, 13, 9651, 1596, 29898, 29888, 29915, 8514, 26750, 29901, 426, 29879, 375, 29918, 8628, 1012, 29876, 1495, 13, 9651, 736, 13, 13, 4706, 5112, 29918, 2230, 580, 13, 4706, 1596, 29918, 392, 29918, 1188, 29898, 29888, 29908, 29928, 29950, 6271, 5656, 426, 2974, 29918, 666, 29913, 21313, 2974, 29918, 8628, 1800, 24084, 3192, 9815, 4742, 373, 5641, 426, 29879, 375, 29918, 666, 27195, 13, 4706, 1596, 29918, 392, 29918, 1188, 29898, 29888, 29915, 14148, 3495, 27042, 29901, 426, 8628, 29918, 19167, 29889, 657, 29918, 710, 29898, 29879, 375, 29918, 19167, 2915, 1495, 13, 4706, 1596, 29918, 392, 29918, 1188, 29898, 29888, 29915, 14148, 3495, 26750, 29901, 426, 29879, 375, 29918, 8628, 1012, 29876, 1495, 13, 13, 4706, 1596, 29898, 29888, 29908, 29928, 29950, 6271, 25186, 29901, 1014, 1212, 29918, 13168, 29901, 426, 1491, 1212, 29918, 13168, 1118, 454, 559, 29918, 2230, 29901, 376, 13, 795, 285, 29908, 29912, 1511, 29918, 2230, 1118, 12876, 29901, 426, 15140, 1118, 1024, 29918, 2974, 29901, 426, 978, 29918, 2974, 27195, 13, 13, 1678, 396, 14514, 360, 29950, 6271, 1871, 13, 1678, 25342, 360, 29950, 6271, 297, 18203, 322, 18203, 29961, 29928, 29950, 6271, 1822, 6768, 29961, 29900, 3816, 29896, 29962, 1275, 29871, 29947, 29901, 13, 4706, 1596, 877, 5634, 1495, 13, 4706, 1596, 877, 4373, 360, 29950, 6271, 15162, 1495, 13, 4706, 396, 2158, 29898, 4058, 300, 29889, 7727, 3101, 13, 4706, 396, 2158, 29898, 3137, 29898, 4058, 300, 876, 13, 13, 4706, 3495, 978, 353, 679, 29918, 3385, 29898, 4058, 300, 29961, 29928, 29950, 6271, 1822, 6768, 29892, 525, 28988, 1495, 13, 4706, 27042, 29918, 1990, 29918, 333, 353, 679, 29918, 3385, 29898, 4058, 300, 29961, 29928, 29950, 6271, 1822, 6768, 29892, 525, 19167, 29918, 1990, 29918, 333, 1495, 13, 13, 4706, 1596, 29898, 29888, 29908, 29928, 29950, 6271, 15162, 515, 426, 4058, 300, 29961, 5690, 1822, 4351, 29913, 21313, 4058, 300, 29961, 29923, 721, 1822, 4351, 1800, 376, 13, 795, 285, 29908, 28988, 29901, 426, 28988, 1118, 27042, 29918, 1990, 29918, 333, 29901, 426, 19167, 29918, 1990, 29918, 333, 27195, 13, 13, 1678, 1683, 29901, 13, 4706, 1596, 877, 5634, 1495, 13, 4706, 1596, 877, 9526, 5901, 360, 29950, 6271, 18744, 300, 1495, 13, 4706, 1596, 29898, 4058, 300, 29889, 7727, 3101, 13, 4706, 396, 2158, 29898, 3137, 29898, 4058, 300, 876, 13, 13, 1678, 736, 13, 13, 13, 29937, 910, 338, 925, 304, 671, 445, 2471, 408, 263, 10609, 13, 1753, 1369, 29918, 16586, 2593, 292, 7295, 13, 1678, 396, 6204, 26750, 377, 7454, 391, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1332, 7454, 391, 29918, 1445, 1125, 13, 4706, 1722, 29898, 1332, 7454, 391, 29918, 1445, 29892, 376, 29893, 29974, 1159, 13, 13, 1678, 1596, 877, 29903, 29876, 2593, 292, 360, 29950, 6271, 12672, 29879, 856, 1495, 13, 1678, 1596, 877, 10923, 315, 11742, 29974, 29907, 304, 5040, 29889, 1495, 13, 1678, 5807, 2593, 29898, 4572, 543, 566, 29886, 322, 313, 637, 29871, 29953, 29955, 470, 29871, 29953, 29947, 19123, 544, 29876, 29922, 8411, 29918, 12744, 6814, 29918, 4058, 300, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 5807, 2593, 29898, 4572, 543, 566, 29886, 322, 313, 637, 29871, 29953, 29955, 470, 29871, 29953, 29947, 19123, 544, 29876, 29922, 8411, 29918, 12744, 6814, 29918, 4058, 300, 29897, 2 ]
authz/test/test_obp_helper.py
shivdeep-singh/conversational-ai-chatbot
11
15295
<reponame>shivdeep-singh/conversational-ai-chatbot<gh_stars>10-100 import unittest from zmq_integration_lib import RPCClient, RPCServer import unittest.mock as mock class TestOBPHelper(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def logout(self, mock_zmq): self.assertTrue(True) def get_login_token(self, mock_zmq): self.assertTrue(True)
[ 1, 529, 276, 1112, 420, 29958, 845, 440, 24535, 29899, 2976, 29882, 29914, 535, 874, 1288, 29899, 1794, 29899, 13496, 7451, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 443, 27958, 13, 3166, 12162, 29939, 29918, 27925, 29918, 1982, 1053, 390, 9026, 4032, 29892, 390, 9026, 6004, 13, 5215, 443, 27958, 29889, 17640, 408, 11187, 13, 13, 13, 1990, 4321, 14824, 29925, 10739, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 1480, 449, 29898, 1311, 29892, 11187, 29918, 14018, 29939, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29897, 13, 268, 13, 1678, 822, 679, 29918, 7507, 29918, 6979, 29898, 1311, 29892, 11187, 29918, 14018, 29939, 1125, 13, 4706, 1583, 29889, 9294, 5574, 29898, 5574, 29897, 13, 268, 13, 2 ]
pkpdapp/pkpdapp/dash_apps/auce_app.py
pkpdapp-team/pkpdapp
4
118826
# # This file is part of PKPDApp (https://github.com/pkpdapp-team/pkpdapp) which # is released under the BSD 3-clause license. See accompanying LICENSE.md for # copyright notice and full license details. # import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Input, Output import plotly.graph_objects as go from .auce_figure import AuceFigure import pandas as pd import django_plotly_dash as dpd import json # Create data view app = dpd.DjangoDash( name='auce_view', add_bootstrap_links=True ) # Create dash app app.layout = dbc.Container([ dbc.Row(children=[ dbc.Col(width=5, children=[ html.Label("Select datasets to use:"), dcc.Dropdown( id='dataset-dropdown', ), ]) ]), dbc.Row([ dbc.Col( children=[ html.P(children=( 'Note: AUCE app requries Dosing Groups corresponding to ' 'numerical concentrations ' )), dbc.Col(width=3, children=[ html.Label("Choose variable:"), dcc.Dropdown( id='auce-biomarker-dropdown', ), ]), dcc.Graph( id='initial-doses-dashboard', figure=go.Figure(), style={'width': '100%'} ), dcc.Graph( id='auce-dashboard', figure=go.Figure(), style={'width': '100%'} ) ], ), ]), ]) def rehydrate_state(session_state): if session_state is None: raise NotImplementedError("Cannot handle a missing session state") state = session_state.get('auce_view', None) if state is None: raise NotImplementedError('AuceState missing in session state') return AuceState.from_json(state) @app.callback( [ Output('dataset-dropdown', 'options'), Output('dataset-dropdown', 'value'), ], [Input('auce-dashboard', 'style')], ) def update_datasets(_, session_state=None): state = rehydrate_state(session_state) return state._dataset_options, state._selected_dataset @app.callback( [ Output('auce-biomarker-dropdown', 'options'), Output('auce-biomarker-dropdown', 'value'), ], [ Input('dataset-dropdown', 'value'), ] ) def update_nca_auce_options(dataset_dropdown, session_state=None): state = rehydrate_state(session_state) state._selected_dataset = dataset_dropdown biomarkers = state._get_biomarkers() return biomarkers, biomarkers[0]['value'] @app.callback( [ Output('initial-doses-dashboard', 'figure'), Output('auce-dashboard', 'figure'), ], [ Input('auce-biomarker-dropdown', 'value'), Input('dataset-dropdown', 'value'), ], ) def update_auce(auce_biomarker_dropdown, dataset_dropdown, session_state=None): state = rehydrate_state(session_state) state._selected_dataset = dataset_dropdown return state.generate_auce_figures(auce_biomarker_dropdown) class AuceState: """ """ _id_key = 'ID' _biomarker_key = 'Biomarker' _compound_key = 'Compound' def __init__(self): self._selected_dataset = [] self._datasets = [] self._dataset_options = [] self._auce_biomarker = None def add_datasets(self, datasets, dataset_names): # handle empty datasets if not datasets: return # by default show last datset self._selected_dataset = 0 self._datasets = datasets for dataset, dataset_name in zip(self._datasets, dataset_names): dataset['Dataset'] = dataset_name self._dataset_options = [ {'label': name, 'value': i} for i, name in enumerate(dataset_names) ] # by default use first biomarker self._auce_biomarker = self._datasets[ self._selected_dataset ][self._biomarker_key][0] def to_json(self): state_dict = { '_selected_dataset': self._selected_dataset, '_datasets': [d.to_dict() for d in self._datasets], '_dataset_options': self._dataset_options, '_auce_biomarker': self._auce_biomarker, } return json.dumps(state_dict) @classmethod def from_json(cls, j): data_dict = json.loads(j) o = cls() o._selected_dataset = data_dict['_selected_dataset'] o._datasets = [ pd.DataFrame.from_dict(d) for d in data_dict['_datasets'] ] o._dataset_options = data_dict['_dataset_options'] o._auce_biomarker = data_dict['_auce_biomarker'] return o def generate_auce_figures(self, new_biomarker=None): if not self._datasets: return go.Figure(), go.Figure() if new_biomarker: self._auce_biomarker = new_biomarker self._auce_figure = AuceFigure( self._datasets[self._selected_dataset], self._auce_biomarker ) return self._auce_figure.figures() def _get_biomarkers(self): biomarkers = set() biomarkers = self._datasets[self._selected_dataset][ self._biomarker_key ].unique().tolist() return [{'label': str(i), 'value': i} for i in biomarkers]
[ 1, 396, 13, 29937, 910, 934, 338, 760, 310, 24457, 25014, 2052, 313, 991, 597, 3292, 29889, 510, 29914, 20571, 15926, 932, 29899, 14318, 29914, 20571, 15926, 932, 29897, 607, 13, 29937, 338, 5492, 1090, 278, 350, 7230, 29871, 29941, 29899, 16398, 1509, 19405, 29889, 2823, 10259, 1384, 292, 365, 2965, 1430, 1660, 29889, 3487, 363, 13, 29937, 3509, 1266, 8369, 322, 2989, 19405, 4902, 29889, 13, 29937, 13, 13, 5215, 12569, 29918, 3221, 29918, 14036, 408, 270, 617, 13, 5215, 12569, 29918, 1420, 29918, 14036, 408, 3472, 13, 5215, 12569, 29918, 8704, 29918, 14036, 408, 4833, 29883, 13, 3166, 12569, 29889, 22594, 1053, 10567, 29892, 10604, 13, 5215, 6492, 368, 29889, 4262, 29918, 12650, 408, 748, 13, 3166, 869, 585, 346, 29918, 4532, 1053, 8407, 346, 13080, 545, 13, 5215, 11701, 408, 10518, 13, 5215, 9557, 29918, 5317, 368, 29918, 14592, 408, 270, 15926, 13, 5215, 4390, 13, 13, 29937, 6204, 848, 1776, 13, 932, 353, 270, 15926, 29889, 29928, 5364, 29928, 1161, 29898, 13, 1678, 1024, 2433, 585, 346, 29918, 1493, 742, 13, 1678, 788, 29918, 8704, 29918, 4965, 29922, 5574, 13, 29897, 13, 13, 29937, 6204, 12569, 623, 13, 932, 29889, 2680, 353, 4833, 29883, 29889, 7895, 4197, 13, 1678, 4833, 29883, 29889, 4301, 29898, 11991, 11759, 13, 4706, 4833, 29883, 29889, 1625, 29898, 2103, 29922, 29945, 29892, 4344, 11759, 13, 9651, 3472, 29889, 4775, 703, 3549, 20035, 304, 671, 29901, 4968, 13, 9651, 270, 617, 29889, 15063, 3204, 29898, 13, 18884, 1178, 2433, 24713, 29899, 19305, 742, 13, 9651, 10353, 13, 308, 2314, 13, 1678, 4514, 511, 13, 1678, 4833, 29883, 29889, 4301, 4197, 13, 4706, 4833, 29883, 29889, 1625, 29898, 13, 9651, 4344, 11759, 13, 18884, 3472, 29889, 29925, 29898, 11991, 7607, 13, 462, 1678, 525, 9842, 29901, 319, 29965, 4741, 623, 12428, 14886, 360, 14556, 1632, 4410, 6590, 304, 525, 13, 462, 1678, 525, 8058, 936, 14953, 800, 525, 13, 18884, 1723, 511, 13, 18884, 4833, 29883, 29889, 1625, 29898, 2103, 29922, 29941, 29892, 4344, 11759, 13, 462, 1678, 3472, 29889, 4775, 703, 15954, 852, 2286, 29901, 4968, 13, 462, 1678, 270, 617, 29889, 15063, 3204, 29898, 13, 462, 4706, 1178, 2433, 585, 346, 29899, 5365, 290, 935, 261, 29899, 19305, 742, 13, 462, 1678, 10353, 13, 18884, 4514, 511, 13, 18884, 270, 617, 29889, 9527, 29898, 13, 462, 1678, 1178, 2433, 11228, 29899, 29881, 15806, 29899, 14592, 3377, 742, 13, 462, 1678, 4377, 29922, 1484, 29889, 13080, 545, 3285, 13, 462, 1678, 3114, 3790, 29915, 2103, 2396, 525, 29896, 29900, 29900, 29995, 10827, 13, 18884, 10353, 13, 18884, 270, 617, 29889, 9527, 29898, 13, 462, 1678, 1178, 2433, 585, 346, 29899, 14592, 3377, 742, 13, 462, 1678, 4377, 29922, 1484, 29889, 13080, 545, 3285, 13, 462, 1678, 3114, 3790, 29915, 2103, 2396, 525, 29896, 29900, 29900, 29995, 10827, 13, 18884, 1723, 13, 9651, 21251, 13, 4706, 10353, 13, 1678, 4514, 511, 13, 2314, 13, 13, 13, 1753, 337, 29882, 2941, 10492, 29918, 3859, 29898, 7924, 29918, 3859, 1125, 13, 1678, 565, 4867, 29918, 3859, 338, 6213, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 703, 29089, 4386, 263, 4567, 4867, 2106, 1159, 13, 13, 1678, 2106, 353, 4867, 29918, 3859, 29889, 657, 877, 585, 346, 29918, 1493, 742, 6213, 29897, 13, 13, 1678, 565, 2106, 338, 6213, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 877, 29909, 24551, 2792, 4567, 297, 4867, 2106, 1495, 13, 13, 1678, 736, 8407, 346, 2792, 29889, 3166, 29918, 3126, 29898, 3859, 29897, 13, 13, 13, 29992, 932, 29889, 14035, 29898, 13, 1678, 518, 13, 4706, 10604, 877, 24713, 29899, 19305, 742, 525, 6768, 5477, 13, 4706, 10604, 877, 24713, 29899, 19305, 742, 525, 1767, 5477, 13, 1678, 21251, 13, 1678, 518, 4290, 877, 585, 346, 29899, 14592, 3377, 742, 525, 3293, 1495, 1402, 13, 29897, 13, 1753, 2767, 29918, 14538, 1691, 29898, 3383, 4867, 29918, 3859, 29922, 8516, 1125, 13, 1678, 2106, 353, 337, 29882, 2941, 10492, 29918, 3859, 29898, 7924, 29918, 3859, 29897, 13, 1678, 736, 2106, 3032, 24713, 29918, 6768, 29892, 2106, 3032, 8391, 29918, 24713, 13, 13, 13, 29992, 932, 29889, 14035, 29898, 13, 1678, 518, 13, 4706, 10604, 877, 585, 346, 29899, 5365, 290, 935, 261, 29899, 19305, 742, 525, 6768, 5477, 13, 4706, 10604, 877, 585, 346, 29899, 5365, 290, 935, 261, 29899, 19305, 742, 525, 1767, 5477, 13, 1678, 21251, 13, 1678, 518, 13, 4706, 10567, 877, 24713, 29899, 19305, 742, 525, 1767, 5477, 13, 1678, 4514, 13, 29897, 13, 1753, 2767, 29918, 29876, 1113, 29918, 585, 346, 29918, 6768, 29898, 24713, 29918, 19305, 29892, 4867, 29918, 3859, 29922, 8516, 1125, 13, 1678, 2106, 353, 337, 29882, 2941, 10492, 29918, 3859, 29898, 7924, 29918, 3859, 29897, 13, 1678, 2106, 3032, 8391, 29918, 24713, 353, 8783, 29918, 19305, 13, 1678, 4768, 290, 935, 414, 353, 2106, 3032, 657, 29918, 5365, 290, 935, 414, 580, 13, 1678, 736, 4768, 290, 935, 414, 29892, 4768, 290, 935, 414, 29961, 29900, 22322, 1767, 2033, 13, 13, 13, 29992, 932, 29889, 14035, 29898, 13, 1678, 518, 13, 4706, 10604, 877, 11228, 29899, 29881, 15806, 29899, 14592, 3377, 742, 525, 4532, 5477, 13, 4706, 10604, 877, 585, 346, 29899, 14592, 3377, 742, 525, 4532, 5477, 13, 1678, 21251, 13, 1678, 518, 13, 4706, 10567, 877, 585, 346, 29899, 5365, 290, 935, 261, 29899, 19305, 742, 525, 1767, 5477, 13, 4706, 10567, 877, 24713, 29899, 19305, 742, 525, 1767, 5477, 13, 1678, 21251, 13, 29897, 13, 1753, 2767, 29918, 585, 346, 29898, 585, 346, 29918, 5365, 290, 935, 261, 29918, 19305, 29892, 8783, 29918, 19305, 29892, 13, 18884, 4867, 29918, 3859, 29922, 8516, 1125, 13, 1678, 2106, 353, 337, 29882, 2941, 10492, 29918, 3859, 29898, 7924, 29918, 3859, 29897, 13, 1678, 2106, 3032, 8391, 29918, 24713, 353, 8783, 29918, 19305, 13, 1678, 736, 2106, 29889, 17158, 29918, 585, 346, 29918, 1003, 1973, 29898, 585, 346, 29918, 5365, 290, 935, 261, 29918, 19305, 29897, 13, 13, 13, 1990, 8407, 346, 2792, 29901, 13, 1678, 9995, 13, 1678, 9995, 13, 1678, 903, 333, 29918, 1989, 353, 525, 1367, 29915, 13, 1678, 903, 5365, 290, 935, 261, 29918, 1989, 353, 525, 29933, 14910, 935, 261, 29915, 13, 1678, 903, 2388, 618, 29918, 1989, 353, 525, 6843, 618, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 3032, 8391, 29918, 24713, 353, 5159, 13, 4706, 1583, 3032, 14538, 1691, 353, 5159, 13, 4706, 1583, 3032, 24713, 29918, 6768, 353, 5159, 13, 4706, 1583, 3032, 585, 346, 29918, 5365, 290, 935, 261, 353, 6213, 13, 13, 1678, 822, 788, 29918, 14538, 1691, 29898, 1311, 29892, 20035, 29892, 8783, 29918, 7039, 1125, 13, 4706, 396, 4386, 4069, 20035, 13, 4706, 565, 451, 20035, 29901, 13, 9651, 736, 13, 13, 4706, 396, 491, 2322, 1510, 1833, 1418, 842, 13, 4706, 1583, 3032, 8391, 29918, 24713, 353, 29871, 29900, 13, 4706, 1583, 3032, 14538, 1691, 353, 20035, 13, 4706, 363, 8783, 29892, 8783, 29918, 978, 297, 14319, 29898, 1311, 3032, 14538, 1691, 29892, 8783, 29918, 7039, 1125, 13, 9651, 8783, 1839, 16390, 24541, 2033, 353, 8783, 29918, 978, 13, 4706, 1583, 3032, 24713, 29918, 6768, 353, 518, 13, 9651, 11117, 1643, 2396, 1024, 29892, 525, 1767, 2396, 474, 29913, 363, 474, 29892, 1024, 297, 26985, 29898, 24713, 29918, 7039, 29897, 13, 4706, 4514, 13, 13, 4706, 396, 491, 2322, 671, 937, 4768, 290, 935, 261, 13, 4706, 1583, 3032, 585, 346, 29918, 5365, 290, 935, 261, 353, 1583, 3032, 14538, 1691, 29961, 13, 9651, 1583, 3032, 8391, 29918, 24713, 13, 308, 3816, 1311, 3032, 5365, 290, 935, 261, 29918, 1989, 3816, 29900, 29962, 13, 13, 1678, 822, 304, 29918, 3126, 29898, 1311, 1125, 13, 4706, 2106, 29918, 8977, 353, 426, 13, 9651, 22868, 8391, 29918, 24713, 2396, 1583, 3032, 8391, 29918, 24713, 29892, 13, 9651, 22868, 14538, 1691, 2396, 518, 29881, 29889, 517, 29918, 8977, 580, 363, 270, 297, 1583, 3032, 14538, 1691, 1402, 13, 9651, 22868, 24713, 29918, 6768, 2396, 1583, 3032, 24713, 29918, 6768, 29892, 13, 9651, 22868, 585, 346, 29918, 5365, 290, 935, 261, 2396, 1583, 3032, 585, 346, 29918, 5365, 290, 935, 261, 29892, 13, 4706, 500, 13, 4706, 736, 4390, 29889, 29881, 17204, 29898, 3859, 29918, 8977, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 3126, 29898, 25932, 29892, 432, 1125, 13, 4706, 848, 29918, 8977, 353, 4390, 29889, 18132, 29898, 29926, 29897, 13, 4706, 288, 353, 1067, 29879, 580, 13, 4706, 288, 3032, 8391, 29918, 24713, 353, 848, 29918, 8977, 1839, 29918, 8391, 29918, 24713, 2033, 13, 4706, 288, 3032, 14538, 1691, 353, 518, 13, 9651, 10518, 29889, 17271, 29889, 3166, 29918, 8977, 29898, 29881, 29897, 363, 270, 297, 848, 29918, 8977, 1839, 29918, 14538, 1691, 2033, 13, 4706, 4514, 13, 13, 4706, 288, 3032, 24713, 29918, 6768, 353, 848, 29918, 8977, 1839, 29918, 24713, 29918, 6768, 2033, 13, 4706, 288, 3032, 585, 346, 29918, 5365, 290, 935, 261, 353, 848, 29918, 8977, 1839, 29918, 585, 346, 29918, 5365, 290, 935, 261, 2033, 13, 4706, 736, 288, 13, 13, 1678, 822, 5706, 29918, 585, 346, 29918, 1003, 1973, 29898, 1311, 29892, 716, 29918, 5365, 290, 935, 261, 29922, 8516, 1125, 13, 4706, 565, 451, 1583, 3032, 14538, 1691, 29901, 13, 9651, 736, 748, 29889, 13080, 545, 3285, 748, 29889, 13080, 545, 580, 13, 4706, 565, 716, 29918, 5365, 290, 935, 261, 29901, 13, 9651, 1583, 3032, 585, 346, 29918, 5365, 290, 935, 261, 353, 716, 29918, 5365, 290, 935, 261, 13, 4706, 1583, 3032, 585, 346, 29918, 4532, 353, 8407, 346, 13080, 545, 29898, 13, 9651, 1583, 3032, 14538, 1691, 29961, 1311, 3032, 8391, 29918, 24713, 1402, 13, 9651, 1583, 3032, 585, 346, 29918, 5365, 290, 935, 261, 13, 4706, 1723, 13, 4706, 736, 1583, 3032, 585, 346, 29918, 4532, 29889, 1003, 1973, 580, 13, 13, 1678, 822, 903, 657, 29918, 5365, 290, 935, 414, 29898, 1311, 1125, 13, 4706, 4768, 290, 935, 414, 353, 731, 580, 13, 4706, 4768, 290, 935, 414, 353, 1583, 3032, 14538, 1691, 29961, 1311, 3032, 8391, 29918, 24713, 3816, 13, 9651, 1583, 3032, 5365, 290, 935, 261, 29918, 1989, 13, 308, 1822, 13092, 2141, 25027, 391, 580, 13, 4706, 736, 518, 10998, 1643, 2396, 851, 29898, 29875, 511, 525, 1767, 2396, 474, 29913, 363, 474, 297, 4768, 290, 935, 414, 29962, 13, 2 ]
descriptor/customer6b.py
ambleacme/decorators-descriptors
78
132319
""" A client with name and e-mail: >>> jack = Customer('<NAME>', '<EMAIL>') >>> jack.full_email() '<NAME> <<EMAIL>>' A client cannot be created with a blank e-mail: >>> joe = Customer('<NAME>', '') Traceback (most recent call last): ... ValueError: 'email' must not be empty >>> joe = Customer('<NAME>', '<EMAIL>') >>> joe.full_email() '<NAME> <<EMAIL>>' Assigning a blank e-mail later is not allowed either: >>> joe.email = '' Traceback (most recent call last): ... ValueError: 'email' must not be empty `NonBlank` fields must also be strings: >>> dummy = Customer('Buster', 99) Traceback (most recent call last): ... TypeError: 'email' must be of type 'str' The `NonBlank` field values are stored in properly named `Customer` instance attributes: >>> for key, value in sorted(jack.__dict__.items()): ... print('{:>10} : {!r}'.format(key, value)) email : '<EMAIL>' fidelity : 0 name : '<NAME>' """ from model6b import Model, NonBlank class Customer(Model): name = NonBlank() email = NonBlank() def __init__(self, name, email, fidelity=0): self.name = name self.email = email self.fidelity = fidelity def full_email(self): return '{0} <{1}>'.format(self.name, self.email)
[ 1, 9995, 13, 29909, 3132, 411, 1024, 322, 321, 29899, 2549, 29901, 13, 13, 1678, 8653, 28015, 353, 21886, 877, 29966, 5813, 29958, 742, 12801, 26862, 6227, 29958, 1495, 13, 1678, 8653, 28015, 29889, 8159, 29918, 5269, 580, 13, 1678, 12801, 5813, 29958, 3532, 26862, 6227, 6778, 29915, 13, 13, 29909, 3132, 2609, 367, 2825, 411, 263, 9654, 321, 29899, 2549, 29901, 13, 13, 1678, 8653, 2958, 29872, 353, 21886, 877, 29966, 5813, 29958, 742, 27255, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 7865, 2392, 29901, 525, 5269, 29915, 1818, 451, 367, 4069, 13, 1678, 8653, 2958, 29872, 353, 21886, 877, 29966, 5813, 29958, 742, 12801, 26862, 6227, 29958, 1495, 13, 1678, 8653, 2958, 29872, 29889, 8159, 29918, 5269, 580, 13, 1678, 12801, 5813, 29958, 3532, 26862, 6227, 6778, 29915, 13, 13, 7900, 647, 292, 263, 9654, 321, 29899, 2549, 2678, 338, 451, 6068, 2845, 29901, 13, 13, 1678, 8653, 2958, 29872, 29889, 5269, 353, 6629, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 7865, 2392, 29901, 525, 5269, 29915, 1818, 451, 367, 4069, 13, 13, 29952, 12283, 10358, 804, 29952, 4235, 1818, 884, 367, 6031, 29901, 13, 13, 1678, 8653, 20254, 353, 21886, 877, 29933, 5402, 742, 29871, 29929, 29929, 29897, 13, 1678, 29243, 313, 3242, 7786, 1246, 1833, 1125, 13, 418, 2023, 13, 1678, 20948, 29901, 525, 5269, 29915, 1818, 367, 310, 1134, 525, 710, 29915, 13, 13, 1576, 421, 12283, 10358, 804, 29952, 1746, 1819, 526, 6087, 297, 6284, 4257, 13, 29952, 15122, 29952, 2777, 8393, 29901, 13, 13, 1678, 8653, 363, 1820, 29892, 995, 297, 12705, 29898, 21452, 17255, 8977, 26914, 7076, 580, 1125, 13, 1678, 2023, 268, 1596, 877, 25641, 29958, 29896, 29900, 29913, 584, 426, 29991, 29878, 29913, 4286, 4830, 29898, 1989, 29892, 995, 876, 13, 308, 4876, 584, 12801, 26862, 6227, 16299, 13, 418, 285, 10652, 537, 584, 29871, 29900, 13, 3986, 1024, 584, 12801, 5813, 16299, 13, 13, 15945, 29908, 13, 13, 3166, 1904, 29953, 29890, 1053, 8125, 29892, 10050, 10358, 804, 13, 13, 13, 1990, 21886, 29898, 3195, 1125, 13, 13, 1678, 1024, 353, 10050, 10358, 804, 580, 13, 1678, 4876, 353, 10050, 10358, 804, 580, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 4876, 29892, 285, 10652, 537, 29922, 29900, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 5269, 353, 4876, 13, 4706, 1583, 29889, 29888, 10652, 537, 353, 285, 10652, 537, 13, 13, 1678, 822, 2989, 29918, 5269, 29898, 1311, 1125, 13, 4706, 736, 22372, 29900, 29913, 529, 29912, 29896, 17428, 4286, 4830, 29898, 1311, 29889, 978, 29892, 1583, 29889, 5269, 29897, 13, 2 ]
src/bot.py
shirin1996/PyBot
1
194874
import telebot import os bot = telebot.TeleBot(os.environ['BOT_TOKEN'], parse_mode='HTML')
[ 1, 1053, 4382, 7451, 13, 5215, 2897, 13, 13, 7451, 353, 4382, 7451, 29889, 29911, 6146, 29933, 327, 29898, 359, 29889, 21813, 1839, 29933, 2891, 29918, 4986, 29968, 1430, 7464, 6088, 29918, 8513, 2433, 7020, 1495, 2 ]
SBOL2Excel/utils/sbol2excel.py
abamaj/SBOL-to-Excel
0
7384
import sbol2 import pandas as pd import os import logging from openpyxl import load_workbook from openpyxl.worksheet.table import Table, TableStyleInfo from openpyxl.utils.dataframe import dataframe_to_rows from openpyxl.styles import Font, PatternFill, Border, Side from requests_html import HTMLSession #wasderivedfrom: source #remove identity, persistenID, displayID, version #remove attachment (if empty) #add library sheets #add postprocessing function to remove unecessaries class seqFile: def __init__(self, file_path_in, output_path): # global varibales for homespace, document, and sheet self.homeSpace = 'https://sys-bio.org' self.document = file_path_in self.file_location_path = os.path.dirname(__file__) self.sheet = os.path.join(self.file_location_path, 'ontologies.xlsx') self.output_template = os.path.join(self.file_location_path, 'Template_to_Output_Into_v001.xlsx') self.output_path = output_path def roleVariables(self): # set Excel file into a dataframe df = pd.read_excel(self.sheet, index_col=0, sheet_name=1, usecols=[1, 2]) # convert the dataframe into a dictionary roleConvertDict = df.to_dict() # set dictionary indices and values (use column 'URI' in excel sheet) roleName = roleConvertDict['URI'] # switch indices' and values' postions roleDictionary = {uri: role for role, uri in roleName.items()} return roleDictionary def orgVariables(self): # set Excel file into a dataframe df = pd.read_excel(self.sheet, index_col=0, sheet_name=2, usecols=[0, 1]) # convert the dataframe into a dictionary organismConvertDict = df.to_dict() # set dictionary indices and values (use column 'txid' in excel sheet) organismName = organismConvertDict['txid'] # switch indices' and values' postions organismDictionary = {str(txid): organism for organism, txid in organismName.items()} return organismDictionary # def inspectDocInfo(self): # # declare homespace # sbol2.setHomespace(self.homeSpace) # doc = sbol2.Document() # doc.read('../tests/test_files/' + self.document) # # doc.read(self.document) # # print document information # print(doc) # def printDocContents(self): # # declare homespace # sbol2.setHomespace(self.homeSpace) # doc = sbol2.Document() # doc.read('../tests/test_files/' + self.document) # # doc.read(self.document) # # print document contents # for obj in doc: # print(obj) def readDocChart(self): # declare homespace sbol2.setHomespace(self.homeSpace) doc = sbol2.Document() doc.read(self.document) # create a dictionary to hold all the component defintions' information componentDefinitions = {} # iterate through the component definitions roleDict = self.roleVariables() orgDict = self.orgVariables() for cd in doc.componentDefinitions: cdType = cd.type # create a dictionary that has a key for the # component definition's identity, # and a value for all of its features componentFeatures = {} persistentIdentity = cd.properties['http://sbols.org/v2#persistentIdentity'][0] # iterate through the properties of the component defintions # and set them equal to propValue variable for prop in cd.properties: try: propValue = cd.properties[prop][0] except (IndexError): propValue = cd.properties[prop] # extract attribute property type if propValue == []: propValue = '' prop = self.prop_convert(prop) propValue = columnMethods(prop, propValue, doc, cdType, roleDict, orgDict).colV componentFeatures[prop] = str(propValue) # append each componentFeatures dictionary as a # value into the componentDefinitions # dictionary with the 'persistentIdentity' serving as the key componentDefinitions[persistentIdentity] = componentFeatures # return the dictionary of information (temporary, maybe # return true if read in correctly) doc_chart = pd.DataFrame.from_dict(componentDefinitions, orient="index") return doc_chart def prop_convert(self, prop): if type(prop) is str: idx = prop.find('#') # if parsing conditions meet, append them into the # componentFeatures dictionary as necessary if idx >= 1: prop = prop[idx + 1:] if prop == 'type': prop = 'types' if prop == 'http://purl.org/dc/terms/title': prop = 'title' if prop == 'http://purl.org/dc/terms/description': prop = 'description' if prop == 'http://purl.obolibrary.org/obo/OBI_0001617': prop = 'OBI_0001617' return (prop) else: raise ValueError() def displayDocChart(self): #display the dataframe return pd.DataFrame.from_dict(self.readDocChart(), orient = "index") def TEMP_readDocChart1(self): #demo of table column names columnNames = ['Part Name', 'Role', 'Design Notes', 'Altered Sequence', 'Part Description', 'Data Source Prefix', 'Data Source', 'Source Organism', 'Target Organism', 'Circular', 'length (bp)', 'Sequence', 'Data Source', 'Composite'] #import dataframe dictionary #convert dictionary to dataframe df = self.displayDocChart() #type caste dataframe to a set dfSet = set(df) #type caste column names to a set columnNameOrder = set(columnNames) #check difference between the dataframe set and the column name order dfSetDifference = dfSet.difference(columnNameOrder) #check intersection between the datframe set and the column name order dfSetIntersection = dfSet.intersection(columnNameOrder) #combine the type casted difference and intersection finalSetList = list(dfSetIntersection) + list(dfSetDifference) #set list to dictionary return finalSetList # def displayDocChart(self): # # display the dataframe # return pd.DataFrame.from_dict(self.readDocChart(), orient="index") def columnString(self, n): # loop through column length in order to get string appropriate # values for excel sheet rows and columns string = "" while n > 0: n, remainder = divmod(n - 1, 26) string = chr(65 + remainder) + string return string def returnExcelChart(self): start_row = 18 start_cell = f'A{start_row}' # load a workbook wb = load_workbook(self.output_template) ws = wb.active # load raw dataframe to df df = self.readDocChart() # set font features ft1 = Font(name='Arial', size=12, color='548235') ft2 = Font(name='Calibri', size=11, bold=True) hold = dataframe_to_rows(df, index=False, header=True) # counter = 0 # loop through worksheet ws[start_cell].value = '' for r in hold: # if a specific cell is empty, continue to loop past it if r == [None]: continue ws.append(r) # counter += 1 # set table features tab = Table(displayName="Parts_Lib", ref=f"A{start_row +1}:{self.columnString(len(df.columns))}{(len(df) * 2) - 2}") style = TableStyleInfo(name="TableStyleLight7", showFirstColumn=False, showLastColumn=False, showRowStripes=True, showColumnStripes=False) cellColor = PatternFill(patternType='solid', fgColor='DDEBF7') cellBorder = Side(border_style='medium', color="000000") # cellIndex = len(x) # gives cells within specified range their table attributes for col in range(1, len(df.columns) + 1): alpha = self.columnString(col) ws[f'{alpha}{start_row+1}'].fill = cellColor ws[f'{alpha}{start_row+1}'].border = Border(top=cellBorder) tab.tableStyleInfo = style ws.add_table(tab) # counter = 0 # gives cells within specified range their font attributes for row in range(len(df) - 1, (len(df) * 2 - 1)): # counter = counter + 1 for cell in ws[row]: cell.font = ft1 # gives cells within specified range their font attributes # (these are special features for the title) num_rows = len(df) if num_rows % 2 > 0: num_rows = num_rows - 1 for j in range(19, num_rows): for x in ws[j]: x.font = ft2 # output the file wb.save(self.output_path) wb.close() logging.warning(f'Your converted file has been output at {self.output_path}') class columnMethods: def __init__(self, colN, colV, doc, cdType, roleDict, orgDict): # global varibales for dataframe switch statements self.colN = colN self.colV = colV self.doc = doc self.cdType = cdType self.roleDict = roleDict self.orgDict = orgDict # if the column name matches the function name, call the function try: return getattr(self, self.colN)() # if the column name does not match the function name, call 'no_change' except AttributeError: return getattr(self, 'no_change')() def no_change(self): pass # if the specified column role value is within the role column def role(self): roleVal = str(self.colV) if roleVal in self.roleDict: self.colV = self.roleDict[roleVal] def types(self): self.colV = self.colV.split('#')[-1] def sequence(self): self.colV = self.doc.getSequence(self.colV).elements def sourceOrganism(self): orgVal = str(self.colV) orgVal = orgVal.split('=')[-1] txid = self.colV.split('=')[-1] if orgVal in self.orgDict: self.colV = self.orgDict[orgVal] else: session = HTMLSession() r = session.get(self.colV) v = r.html.find('strong', first=True) self.colV = v.text self.orgDict[txid] = self.colV def targetOrganism(self): orgVal = str(self.colV) orgVal = orgVal.split('=')[-1] txid = self.colV.split('=')[-1] if orgVal in self.orgDict: self.colV = self.orgDict[orgVal] else: session = HTMLSession() r = session.get(self.colV) v = r.html.find('strong', first=True) self.colV = v.text self.orgDict[txid] = self.colV
[ 1, 1053, 269, 2095, 29906, 13, 5215, 11701, 408, 10518, 13, 5215, 2897, 13, 5215, 12183, 13, 3166, 1722, 2272, 15524, 1053, 2254, 29918, 1287, 2909, 13, 3166, 1722, 2272, 15524, 29889, 1287, 9855, 29889, 2371, 1053, 6137, 29892, 6137, 5568, 3401, 13, 3166, 1722, 2272, 15524, 29889, 13239, 29889, 1272, 2557, 1053, 12205, 29918, 517, 29918, 5727, 13, 3166, 1722, 2272, 15524, 29889, 9783, 1053, 10928, 29892, 25860, 20876, 29892, 20830, 29892, 19160, 13, 3166, 7274, 29918, 1420, 1053, 4544, 7317, 13, 13, 29937, 11102, 672, 2347, 3166, 29901, 2752, 13, 29937, 5992, 10110, 29892, 3736, 8244, 1367, 29892, 2479, 1367, 29892, 1873, 13, 29937, 5992, 26305, 313, 361, 4069, 29897, 13, 29937, 1202, 3489, 26718, 13, 29937, 1202, 1400, 19170, 740, 304, 3349, 443, 687, 404, 4314, 13, 13, 13, 1990, 19359, 2283, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 29918, 2084, 29918, 262, 29892, 1962, 29918, 2084, 1125, 13, 4706, 396, 5534, 722, 747, 2122, 363, 17774, 3535, 29892, 1842, 29892, 322, 9869, 13, 4706, 1583, 29889, 5184, 14936, 353, 525, 991, 597, 9675, 29899, 24840, 29889, 990, 29915, 13, 4706, 1583, 29889, 3225, 353, 934, 29918, 2084, 29918, 262, 13, 4706, 1583, 29889, 1445, 29918, 5479, 29918, 2084, 353, 2897, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 29897, 13, 4706, 1583, 29889, 9855, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 1445, 29918, 5479, 29918, 2084, 29892, 525, 609, 11763, 29889, 20267, 29916, 1495, 13, 4706, 1583, 29889, 4905, 29918, 6886, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 1445, 29918, 5479, 29918, 2084, 29892, 525, 6733, 29918, 517, 29918, 6466, 29918, 797, 517, 29918, 29894, 29900, 29900, 29896, 29889, 20267, 29916, 1495, 13, 4706, 1583, 29889, 4905, 29918, 2084, 353, 1962, 29918, 2084, 13, 13, 1678, 822, 6297, 10444, 1849, 29898, 1311, 1125, 13, 4706, 396, 731, 11388, 934, 964, 263, 12205, 13, 4706, 4489, 353, 10518, 29889, 949, 29918, 24633, 29898, 1311, 29889, 9855, 29892, 2380, 29918, 1054, 29922, 29900, 29892, 13, 462, 965, 9869, 29918, 978, 29922, 29896, 29892, 671, 22724, 11759, 29896, 29892, 29871, 29906, 2314, 13, 4706, 396, 3588, 278, 12205, 964, 263, 8600, 13, 4706, 6297, 18455, 21533, 353, 4489, 29889, 517, 29918, 8977, 580, 13, 4706, 396, 731, 8600, 16285, 322, 1819, 313, 1509, 1897, 525, 15551, 29915, 297, 10616, 9869, 29897, 13, 4706, 6297, 1170, 353, 6297, 18455, 21533, 1839, 15551, 2033, 13, 4706, 396, 4607, 16285, 29915, 322, 1819, 29915, 1400, 1080, 13, 4706, 6297, 11513, 353, 426, 5338, 29901, 6297, 363, 6297, 29892, 21333, 297, 6297, 1170, 29889, 7076, 28296, 13, 4706, 736, 6297, 11513, 13, 13, 1678, 822, 1638, 10444, 1849, 29898, 1311, 1125, 13, 4706, 396, 731, 11388, 934, 964, 263, 12205, 13, 4706, 4489, 353, 10518, 29889, 949, 29918, 24633, 29898, 1311, 29889, 9855, 29892, 2380, 29918, 1054, 29922, 29900, 29892, 13, 462, 965, 9869, 29918, 978, 29922, 29906, 29892, 671, 22724, 11759, 29900, 29892, 29871, 29896, 2314, 13, 4706, 396, 3588, 278, 12205, 964, 263, 8600, 13, 4706, 2894, 1608, 18455, 21533, 353, 4489, 29889, 517, 29918, 8977, 580, 13, 4706, 396, 731, 8600, 16285, 322, 1819, 313, 1509, 1897, 525, 7508, 333, 29915, 297, 10616, 9869, 29897, 13, 4706, 2894, 1608, 1170, 353, 2894, 1608, 18455, 21533, 1839, 7508, 333, 2033, 13, 4706, 396, 4607, 16285, 29915, 322, 1819, 29915, 1400, 1080, 13, 4706, 2894, 1608, 11513, 353, 426, 710, 29898, 7508, 333, 1125, 2894, 1608, 363, 2894, 1608, 29892, 25568, 333, 297, 2894, 1608, 1170, 29889, 7076, 28296, 13, 4706, 736, 2894, 1608, 11513, 13, 13, 1678, 396, 822, 16096, 14526, 3401, 29898, 1311, 1125, 13, 1678, 396, 268, 396, 9607, 17774, 3535, 13, 1678, 396, 268, 269, 2095, 29906, 29889, 842, 24259, 267, 3535, 29898, 1311, 29889, 5184, 14936, 29897, 13, 1678, 396, 268, 1574, 353, 269, 2095, 29906, 29889, 6268, 580, 13, 1678, 396, 268, 1574, 29889, 949, 877, 6995, 21150, 29914, 1688, 29918, 5325, 22208, 718, 1583, 29889, 3225, 29897, 13, 1678, 396, 268, 396, 1574, 29889, 949, 29898, 1311, 29889, 3225, 29897, 13, 1678, 396, 268, 396, 1596, 1842, 2472, 13, 1678, 396, 268, 1596, 29898, 1514, 29897, 13, 13, 1678, 396, 822, 1596, 14526, 21002, 29898, 1311, 1125, 13, 1678, 396, 268, 396, 9607, 17774, 3535, 13, 1678, 396, 268, 269, 2095, 29906, 29889, 842, 24259, 267, 3535, 29898, 1311, 29889, 5184, 14936, 29897, 13, 1678, 396, 268, 1574, 353, 269, 2095, 29906, 29889, 6268, 580, 13, 1678, 396, 268, 1574, 29889, 949, 877, 6995, 21150, 29914, 1688, 29918, 5325, 22208, 718, 1583, 29889, 3225, 29897, 13, 1678, 396, 268, 396, 1574, 29889, 949, 29898, 1311, 29889, 3225, 29897, 13, 1678, 396, 268, 396, 1596, 1842, 8118, 13, 1678, 396, 268, 363, 5446, 297, 1574, 29901, 13, 1678, 396, 308, 1596, 29898, 5415, 29897, 13, 13, 1678, 822, 1303, 14526, 14732, 29898, 1311, 1125, 13, 4706, 396, 9607, 17774, 3535, 13, 4706, 269, 2095, 29906, 29889, 842, 24259, 267, 3535, 29898, 1311, 29889, 5184, 14936, 29897, 13, 4706, 1574, 353, 269, 2095, 29906, 29889, 6268, 580, 13, 4706, 1574, 29889, 949, 29898, 1311, 29889, 3225, 29897, 13, 4706, 396, 1653, 263, 8600, 304, 4808, 599, 278, 4163, 822, 524, 1080, 29915, 2472, 13, 4706, 4163, 3206, 262, 2187, 353, 6571, 13, 4706, 396, 13649, 1549, 278, 4163, 15848, 13, 4706, 6297, 21533, 353, 1583, 29889, 12154, 10444, 1849, 580, 13, 4706, 1638, 21533, 353, 1583, 29889, 990, 10444, 1849, 580, 13, 4706, 363, 14965, 297, 1574, 29889, 9700, 3206, 262, 2187, 29901, 13, 9651, 14965, 1542, 353, 14965, 29889, 1853, 13, 9651, 396, 1653, 263, 8600, 393, 756, 263, 1820, 363, 278, 13, 9651, 396, 4163, 5023, 29915, 29879, 10110, 29892, 13, 9651, 396, 322, 263, 995, 363, 599, 310, 967, 5680, 13, 9651, 4163, 8263, 3698, 353, 6571, 13, 9651, 28152, 18415, 353, 14965, 29889, 11330, 1839, 1124, 597, 29879, 2095, 29879, 29889, 990, 29914, 29894, 29906, 29937, 6774, 9696, 18415, 2033, 29961, 29900, 29962, 13, 9651, 396, 13649, 1549, 278, 4426, 310, 278, 4163, 822, 524, 1080, 13, 9651, 396, 322, 731, 963, 5186, 304, 3107, 1917, 2286, 13, 9651, 363, 3107, 297, 14965, 29889, 11330, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 3107, 1917, 353, 14965, 29889, 11330, 29961, 7728, 3816, 29900, 29962, 13, 18884, 5174, 313, 3220, 2392, 1125, 13, 462, 1678, 3107, 1917, 353, 14965, 29889, 11330, 29961, 7728, 29962, 13, 462, 1678, 396, 6597, 5352, 2875, 1134, 13, 18884, 565, 3107, 1917, 1275, 5159, 29901, 13, 462, 1678, 3107, 1917, 353, 6629, 13, 18884, 3107, 353, 1583, 29889, 7728, 29918, 13441, 29898, 7728, 29897, 13, 18884, 3107, 1917, 353, 1897, 26112, 29898, 7728, 29892, 3107, 1917, 29892, 1574, 29892, 14965, 1542, 29892, 13, 462, 462, 3986, 6297, 21533, 29892, 1638, 21533, 467, 1054, 29963, 13, 18884, 4163, 8263, 3698, 29961, 7728, 29962, 353, 851, 29898, 7728, 1917, 29897, 13, 9651, 396, 9773, 1269, 4163, 8263, 3698, 8600, 408, 263, 13, 9651, 396, 995, 964, 278, 4163, 3206, 262, 2187, 13, 9651, 396, 8600, 411, 278, 525, 6774, 9696, 18415, 29915, 16330, 408, 278, 1820, 13, 9651, 4163, 3206, 262, 2187, 29961, 6774, 9696, 18415, 29962, 353, 4163, 8263, 3698, 13, 4706, 396, 736, 278, 8600, 310, 2472, 313, 1356, 1971, 653, 29892, 5505, 13, 4706, 396, 736, 1565, 565, 1303, 297, 5149, 29897, 13, 308, 13, 4706, 1574, 29918, 15425, 353, 10518, 29889, 17271, 29889, 3166, 29918, 8977, 29898, 9700, 3206, 262, 2187, 29892, 7769, 543, 2248, 1159, 13, 4706, 736, 1574, 29918, 15425, 13, 13, 1678, 822, 3107, 29918, 13441, 29898, 1311, 29892, 3107, 1125, 13, 4706, 565, 1134, 29898, 7728, 29897, 338, 851, 29901, 13, 9651, 22645, 353, 3107, 29889, 2886, 14237, 1495, 13, 9651, 396, 565, 13755, 5855, 5870, 29892, 9773, 963, 964, 278, 13, 9651, 396, 4163, 8263, 3698, 8600, 408, 5181, 13, 9651, 565, 22645, 6736, 29871, 29896, 29901, 13, 18884, 3107, 353, 3107, 29961, 13140, 718, 29871, 29896, 17531, 13, 9651, 565, 3107, 1275, 525, 1853, 2396, 13, 18884, 3107, 353, 525, 8768, 29915, 13, 9651, 565, 3107, 1275, 525, 1124, 597, 29886, 2271, 29889, 990, 29914, 13891, 29914, 357, 1516, 29914, 3257, 2396, 13, 18884, 3107, 353, 525, 3257, 29915, 13, 9651, 565, 3107, 1275, 525, 1124, 597, 29886, 2271, 29889, 990, 29914, 13891, 29914, 357, 1516, 29914, 8216, 2396, 13, 18884, 3107, 353, 525, 8216, 29915, 13, 9651, 565, 3107, 1275, 525, 1124, 597, 29886, 2271, 29889, 711, 324, 6357, 29889, 990, 29914, 711, 29877, 29914, 29949, 12809, 29918, 29900, 29900, 29900, 29896, 29953, 29896, 29955, 2396, 13, 18884, 3107, 353, 525, 29949, 12809, 29918, 29900, 29900, 29900, 29896, 29953, 29896, 29955, 29915, 13, 9651, 736, 313, 7728, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 580, 13, 268, 13, 1678, 822, 2479, 14526, 14732, 29898, 1311, 1125, 13, 4706, 396, 4990, 278, 12205, 13, 4706, 736, 10518, 29889, 17271, 29889, 3166, 29918, 8977, 29898, 1311, 29889, 949, 14526, 14732, 3285, 7769, 353, 376, 2248, 1159, 13, 13, 1678, 822, 17067, 3580, 29918, 949, 14526, 14732, 29896, 29898, 1311, 1125, 13, 4706, 396, 17482, 310, 1591, 1897, 2983, 13, 4706, 1897, 8659, 353, 6024, 7439, 4408, 742, 29871, 13, 18884, 525, 16727, 742, 29871, 13, 18884, 525, 4002, 647, 8695, 742, 13, 1669, 525, 2499, 25396, 922, 3910, 742, 13, 1669, 525, 7439, 12953, 742, 13, 1669, 525, 1469, 7562, 349, 9569, 742, 13, 1669, 525, 1469, 7562, 742, 13, 1669, 525, 4435, 9205, 1608, 742, 13, 1669, 525, 8667, 9205, 1608, 742, 13, 1669, 525, 23495, 1070, 742, 13, 1669, 525, 2848, 313, 25288, 29897, 742, 13, 1669, 525, 20529, 742, 13, 1669, 525, 1469, 7562, 742, 13, 1669, 525, 1523, 1066, 568, 2033, 13, 4706, 396, 5215, 12205, 8600, 13, 4706, 396, 13441, 8600, 304, 12205, 13, 4706, 4489, 353, 1583, 29889, 4990, 14526, 14732, 580, 13, 4706, 396, 1853, 3209, 371, 12205, 304, 263, 731, 13, 4706, 4489, 2697, 353, 731, 29898, 2176, 29897, 13, 4706, 396, 1853, 3209, 371, 1897, 2983, 304, 263, 731, 13, 4706, 1897, 1170, 7514, 353, 731, 29898, 4914, 8659, 29897, 13, 4706, 396, 3198, 4328, 1546, 278, 12205, 731, 322, 278, 1897, 1024, 1797, 13, 4706, 4489, 2697, 29928, 17678, 353, 4489, 2697, 29889, 29881, 17678, 29898, 4914, 1170, 7514, 29897, 13, 4706, 396, 3198, 17686, 1546, 278, 1418, 2557, 731, 322, 278, 1897, 1024, 1797, 13, 4706, 4489, 2697, 4074, 2042, 353, 4489, 2697, 29889, 1639, 2042, 29898, 4914, 1170, 7514, 29897, 13, 4706, 396, 17743, 457, 278, 1134, 4320, 287, 4328, 322, 17686, 13, 4706, 2186, 2697, 1293, 353, 1051, 29898, 2176, 2697, 4074, 2042, 29897, 718, 1051, 29898, 2176, 2697, 29928, 17678, 29897, 13, 4706, 396, 842, 1051, 304, 8600, 13, 4706, 736, 2186, 2697, 1293, 13, 13, 1678, 396, 822, 2479, 14526, 14732, 29898, 1311, 1125, 13, 1678, 396, 268, 396, 2479, 278, 12205, 13, 1678, 396, 268, 736, 10518, 29889, 17271, 29889, 3166, 29918, 8977, 29898, 1311, 29889, 949, 14526, 14732, 3285, 7769, 543, 2248, 1159, 13, 13, 1678, 822, 1897, 1231, 29898, 1311, 29892, 302, 1125, 13, 4706, 396, 2425, 1549, 1897, 3309, 297, 1797, 304, 679, 1347, 8210, 13, 4706, 396, 1819, 363, 10616, 9869, 4206, 322, 4341, 13, 4706, 1347, 353, 5124, 13, 4706, 1550, 302, 1405, 29871, 29900, 29901, 13, 9651, 302, 29892, 21162, 353, 1933, 1545, 29898, 29876, 448, 29871, 29896, 29892, 29871, 29906, 29953, 29897, 13, 9651, 1347, 353, 18460, 29898, 29953, 29945, 718, 21162, 29897, 718, 1347, 13, 4706, 736, 1347, 13, 13, 1678, 822, 736, 22926, 14732, 29898, 1311, 1125, 13, 4706, 1369, 29918, 798, 353, 29871, 29896, 29947, 13, 4706, 1369, 29918, 3729, 353, 285, 29915, 29909, 29912, 2962, 29918, 798, 10162, 13, 4706, 396, 2254, 263, 664, 2909, 13, 4706, 281, 29890, 353, 2254, 29918, 1287, 2909, 29898, 1311, 29889, 4905, 29918, 6886, 29897, 13, 4706, 16904, 353, 281, 29890, 29889, 4925, 13, 4706, 396, 2254, 10650, 12205, 304, 4489, 13, 4706, 4489, 353, 1583, 29889, 949, 14526, 14732, 580, 13, 4706, 396, 731, 4079, 5680, 13, 4706, 11791, 29896, 353, 10928, 29898, 978, 2433, 29909, 9315, 742, 2159, 29922, 29896, 29906, 29892, 2927, 2433, 29945, 29946, 29947, 29906, 29941, 29945, 1495, 13, 4706, 11791, 29906, 353, 10928, 29898, 978, 2433, 7856, 747, 374, 742, 2159, 29922, 29896, 29896, 29892, 14288, 29922, 5574, 29897, 13, 4706, 4808, 353, 12205, 29918, 517, 29918, 5727, 29898, 2176, 29892, 2380, 29922, 8824, 29892, 4839, 29922, 5574, 29897, 13, 4706, 396, 6795, 353, 29871, 29900, 13, 4706, 396, 2425, 1549, 1736, 4155, 13, 4706, 16904, 29961, 2962, 29918, 3729, 1822, 1767, 353, 6629, 13, 4706, 363, 364, 297, 4808, 29901, 13, 9651, 396, 565, 263, 2702, 3038, 338, 4069, 29892, 6773, 304, 2425, 4940, 372, 13, 9651, 565, 364, 1275, 518, 8516, 5387, 13, 18884, 6773, 13, 9651, 16904, 29889, 4397, 29898, 29878, 29897, 13, 9651, 396, 6795, 4619, 29871, 29896, 13, 4706, 396, 731, 1591, 5680, 13, 4706, 4434, 353, 6137, 29898, 4990, 1170, 543, 29925, 5708, 29918, 14868, 613, 2143, 29922, 29888, 29908, 29909, 29912, 2962, 29918, 798, 718, 29896, 6177, 29912, 1311, 29889, 4914, 1231, 29898, 2435, 29898, 2176, 29889, 13099, 876, 19048, 2435, 29898, 2176, 29897, 334, 29871, 29906, 29897, 448, 29871, 29906, 27195, 13, 4706, 3114, 353, 6137, 5568, 3401, 29898, 978, 543, 3562, 5568, 20769, 29955, 613, 1510, 6730, 4409, 29922, 8824, 29892, 13, 462, 1669, 1510, 8897, 4409, 29922, 8824, 29892, 1510, 4301, 855, 374, 5547, 29922, 5574, 29892, 13, 462, 1669, 1510, 4409, 855, 374, 5547, 29922, 8824, 29897, 13, 4706, 3038, 3306, 353, 25860, 20876, 29898, 11037, 1542, 2433, 2929, 333, 742, 13, 462, 18884, 285, 29887, 3306, 2433, 29928, 2287, 28062, 29955, 1495, 13, 4706, 3038, 17025, 353, 19160, 29898, 11466, 29918, 3293, 2433, 27891, 742, 2927, 543, 29900, 29900, 29900, 29900, 29900, 29900, 1159, 13, 4706, 396, 3038, 3220, 353, 7431, 29898, 29916, 29897, 13, 4706, 396, 4076, 9101, 2629, 6790, 3464, 1009, 1591, 8393, 13, 4706, 363, 784, 297, 3464, 29898, 29896, 29892, 7431, 29898, 2176, 29889, 13099, 29897, 718, 29871, 29896, 1125, 13, 9651, 15595, 353, 1583, 29889, 4914, 1231, 29898, 1054, 29897, 13, 9651, 16904, 29961, 29888, 29915, 29912, 2312, 1157, 2962, 29918, 798, 29974, 29896, 10162, 1822, 5589, 353, 3038, 3306, 13, 9651, 16904, 29961, 29888, 29915, 29912, 2312, 1157, 2962, 29918, 798, 29974, 29896, 10162, 1822, 11466, 353, 20830, 29898, 3332, 29922, 3729, 17025, 29897, 13, 4706, 4434, 29889, 2371, 5568, 3401, 353, 3114, 13, 4706, 16904, 29889, 1202, 29918, 2371, 29898, 3891, 29897, 13, 4706, 396, 6795, 353, 29871, 29900, 13, 4706, 396, 4076, 9101, 2629, 6790, 3464, 1009, 4079, 8393, 13, 4706, 363, 1948, 297, 3464, 29898, 2435, 29898, 2176, 29897, 448, 29871, 29896, 29892, 313, 2435, 29898, 2176, 29897, 334, 29871, 29906, 448, 29871, 29896, 22164, 13, 9651, 396, 6795, 353, 6795, 718, 29871, 29896, 13, 9651, 363, 3038, 297, 16904, 29961, 798, 5387, 13, 18884, 3038, 29889, 5657, 353, 11791, 29896, 13, 4706, 396, 4076, 9101, 2629, 6790, 3464, 1009, 4079, 8393, 13, 4706, 396, 313, 386, 968, 526, 4266, 5680, 363, 278, 3611, 29897, 13, 4706, 954, 29918, 5727, 353, 7431, 29898, 2176, 29897, 13, 4706, 565, 954, 29918, 5727, 1273, 29871, 29906, 1405, 29871, 29900, 29901, 13, 9651, 954, 29918, 5727, 353, 954, 29918, 5727, 448, 29871, 29896, 13, 4706, 363, 432, 297, 3464, 29898, 29896, 29929, 29892, 954, 29918, 5727, 1125, 13, 9651, 363, 921, 297, 16904, 29961, 29926, 5387, 13, 18884, 921, 29889, 5657, 353, 11791, 29906, 13, 4706, 396, 1962, 278, 934, 13, 4706, 281, 29890, 29889, 7620, 29898, 1311, 29889, 4905, 29918, 2084, 29897, 13, 4706, 281, 29890, 29889, 5358, 580, 13, 4706, 12183, 29889, 27392, 29898, 29888, 29915, 10858, 11543, 934, 756, 1063, 1962, 472, 426, 1311, 29889, 4905, 29918, 2084, 29913, 1495, 13, 13, 13, 1990, 1897, 26112, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 784, 29940, 29892, 784, 29963, 29892, 1574, 29892, 14965, 1542, 29892, 6297, 21533, 29892, 1638, 21533, 1125, 13, 4706, 396, 5534, 722, 747, 2122, 363, 12205, 4607, 9506, 13, 4706, 1583, 29889, 1054, 29940, 353, 784, 29940, 13, 4706, 1583, 29889, 1054, 29963, 353, 784, 29963, 13, 4706, 1583, 29889, 1514, 353, 1574, 13, 4706, 1583, 29889, 2252, 1542, 353, 14965, 1542, 13, 4706, 1583, 29889, 12154, 21533, 353, 6297, 21533, 13, 4706, 1583, 29889, 990, 21533, 353, 1638, 21533, 13, 4706, 396, 565, 278, 1897, 1024, 7087, 278, 740, 1024, 29892, 1246, 278, 740, 13, 4706, 1018, 29901, 13, 9651, 736, 679, 5552, 29898, 1311, 29892, 1583, 29889, 1054, 29940, 29897, 580, 13, 4706, 396, 565, 278, 1897, 1024, 947, 451, 1993, 278, 740, 1024, 29892, 1246, 525, 1217, 29918, 3167, 29915, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 736, 679, 5552, 29898, 1311, 29892, 525, 1217, 29918, 3167, 1495, 580, 13, 13, 1678, 822, 694, 29918, 3167, 29898, 1311, 1125, 13, 4706, 1209, 13, 1678, 396, 565, 278, 6790, 1897, 6297, 995, 338, 2629, 278, 6297, 1897, 13, 13, 1678, 822, 6297, 29898, 1311, 1125, 13, 4706, 6297, 1440, 353, 851, 29898, 1311, 29889, 1054, 29963, 29897, 13, 4706, 565, 6297, 1440, 297, 1583, 29889, 12154, 21533, 29901, 13, 9651, 1583, 29889, 1054, 29963, 353, 1583, 29889, 12154, 21533, 29961, 12154, 1440, 29962, 13, 13, 1678, 822, 4072, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1054, 29963, 353, 1583, 29889, 1054, 29963, 29889, 5451, 14237, 1495, 14352, 29896, 29962, 13, 13, 1678, 822, 5665, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1054, 29963, 353, 1583, 29889, 1514, 29889, 657, 20529, 29898, 1311, 29889, 1054, 29963, 467, 17664, 13, 13, 1678, 822, 2752, 27356, 1608, 29898, 1311, 1125, 13, 4706, 1638, 1440, 353, 851, 29898, 1311, 29889, 1054, 29963, 29897, 13, 4706, 1638, 1440, 353, 1638, 1440, 29889, 5451, 877, 29922, 1495, 14352, 29896, 29962, 13, 4706, 25568, 333, 353, 1583, 29889, 1054, 29963, 29889, 5451, 877, 29922, 1495, 14352, 29896, 29962, 13, 4706, 565, 1638, 1440, 297, 1583, 29889, 990, 21533, 29901, 13, 9651, 1583, 29889, 1054, 29963, 353, 1583, 29889, 990, 21533, 29961, 990, 1440, 29962, 13, 4706, 1683, 29901, 13, 9651, 4867, 353, 4544, 7317, 580, 13, 9651, 364, 353, 4867, 29889, 657, 29898, 1311, 29889, 1054, 29963, 29897, 13, 9651, 325, 353, 364, 29889, 1420, 29889, 2886, 877, 1110, 742, 937, 29922, 5574, 29897, 13, 9651, 1583, 29889, 1054, 29963, 353, 325, 29889, 726, 13, 9651, 1583, 29889, 990, 21533, 29961, 7508, 333, 29962, 353, 1583, 29889, 1054, 29963, 13, 13, 1678, 822, 3646, 27356, 1608, 29898, 1311, 1125, 13, 4706, 1638, 1440, 353, 851, 29898, 1311, 29889, 1054, 29963, 29897, 13, 4706, 1638, 1440, 353, 1638, 1440, 29889, 5451, 877, 29922, 1495, 14352, 29896, 29962, 13, 4706, 25568, 333, 353, 1583, 29889, 1054, 29963, 29889, 5451, 877, 29922, 1495, 14352, 29896, 29962, 13, 4706, 565, 1638, 1440, 297, 1583, 29889, 990, 21533, 29901, 13, 9651, 1583, 29889, 1054, 29963, 353, 1583, 29889, 990, 21533, 29961, 990, 1440, 29962, 13, 4706, 1683, 29901, 13, 9651, 4867, 353, 4544, 7317, 580, 13, 9651, 364, 353, 4867, 29889, 657, 29898, 1311, 29889, 1054, 29963, 29897, 13, 9651, 325, 353, 364, 29889, 1420, 29889, 2886, 877, 1110, 742, 937, 29922, 5574, 29897, 13, 9651, 1583, 29889, 1054, 29963, 353, 325, 29889, 726, 13, 9651, 1583, 29889, 990, 21533, 29961, 7508, 333, 29962, 353, 1583, 29889, 1054, 29963, 13, 13, 13, 2 ]
quantization/tensorRT_test.py
Jihunn-Kim/khu_capstone_1
1
108250
<reponame>Jihunn-Kim/khu_capstone_1 import tensorrt as trt import pycuda.driver as cuda import numpy as np import torch import pycuda.autoinit import dataset import model import time # print(dir(trt)) tensorrt_file_name = 'bert.plan' TRT_LOGGER = trt.Logger(trt.Logger.WARNING) trt_runtime = trt.Runtime(TRT_LOGGER) with open(tensorrt_file_name, 'rb') as f: engine_data = f.read() engine = trt_runtime.deserialize_cuda_engine(engine_data) context = engine.create_execution_context() # class HostDeviceMem(object): # def __init__(self, host_mem, device_mem): # self.host = host_mem # self.device = device_mem # def __str__(self): # return "Host:\n" + str(self.host) + "\nDevice:\n" + str(self.device) # def __repr__(self): # return self.__str__() # inputs, outputs, bindings, stream = [], [], [], [] # for binding in engine: # size = trt.volume(engine.get_binding_shape(binding)) * engine.max_batch_size # dtype = trt.nptype(engine.get_binding_dtype(binding)) # host_mem = cuda.pagelocked_empty(size, dtype) # device_mem = cuda.mem_alloc(host_mem.nbytes) # bindings.append(int(device_mem)) # if engine.binding_is_input(binding): # inputs.append( HostDeviceMem(host_mem, device_mem) ) # else: # outputs.append(HostDeviceMem(host_mem, device_mem)) # input_ids = np.ones([1, 1, 29, 29]) # numpy_array_input = [input_ids] # hosts = [input.host for input in inputs] # trt_types = [trt.int32] # for numpy_array, host, trt_types in zip(numpy_array_input, hosts, trt_types): # numpy_array = np.asarray(numpy_array).ravel() # np.copyto(host, numpy_array) # def do_inference(context, bindings, inputs, outputs, stream): # [cuda.memcpy_htod_async(inp.device, inp.host, stream) for inp in inputs] # context.execute_async_v2(bindings=bindings, stream_handle=stream.handle) # [cuda.memcpy_dtoh_async(out.host, out.device, stream) for out in outputs] # stream.synchronize() # return [out.host for out in outputs] # trt_outputs = do_inference( # context=context, # bindings=bindings, # inputs=inputs, # outputs=outputs, # stream=stream) def infer(context, input_img, output_size, batch_size): # Load engine # engine = context.get_engine() # assert(engine.get_nb_bindings() == 2) # Convert input data to float32 input_img = input_img.astype(np.float32) # Create host buffer to receive data output = np.empty(output_size, dtype = np.float32) # Allocate device memory d_input = cuda.mem_alloc(batch_size * input_img.size * input_img.dtype.itemsize) d_output = cuda.mem_alloc(batch_size * output.size * output.dtype.itemsize) bindings = [int(d_input), int(d_output)] stream = cuda.Stream() # Transfer input data to device cuda.memcpy_htod_async(d_input, input_img, stream) # Execute model context.execute_async(batch_size, bindings, stream.handle, None) # Transfer predictions back cuda.memcpy_dtoh_async(output, d_output, stream) # Synchronize threads stream.synchronize() # Return predictions return output # kwargs = {"./dataset/DoS_dataset.csv" : './DoS_dataset.txt'} # train_data_set, data_idx_map, net_class_count, net_data_count, test_data_set = dataset.GetCanDatasetUsingTxtKwarg(100, 0, **kwargs) # testloader = torch.utils.data.DataLoader(test_data_set, batch_size=256, # shuffle=False, num_workers=2) check_time = time.time() cnt = 0 temp = np.ones([256, 1, 29, 29]) for idx in range(100): # for i, (inputs, labels) in enumerate(testloader): trt_outputs = infer(context, temp, (256, 2), 256) print(trt_outputs.shape) # print(trt_outputs) # print(np.argmax(trt_outputs, axis=0)) # cnt += 1 # if cnt == 100: # break print(time.time() - check_time) tensorrt_file_name = 'bert_int.plan' TRT_LOGGER = trt.Logger(trt.Logger.WARNING) trt_runtime = trt.Runtime(TRT_LOGGER) with open(tensorrt_file_name, 'rb') as f: engine_data = f.read() engine = trt_runtime.deserialize_cuda_engine(engine_data) context = engine.create_execution_context() check_time = time.time() cnt = 0 temp = np.ones([256, 1, 29, 29]) for idx in range(100): # for i, (inputs, labels) in enumerate(testloader): trt_outputs = infer(context, temp, (256, 2), 256) print(trt_outputs.shape) # print(trt_outputs) # print(np.argmax(trt_outputs, axis=0)) # cnt += 1 # if cnt == 100: # break print(time.time() - check_time) test_model = model.Net().cuda() check_time = time.time() cnt = 0 temp = torch.randn(256, 1, 29, 29).cuda() for idx in range(100): # for i, (inputs, labels) in enumerate(testloader): # inputs = inputs.float().cuda() normal_outputs = test_model(temp) # print(normal_outputs) print(normal_outputs.shape) cnt += 1 if cnt == 100: break print(time.time() - check_time) import tensorrt as trt import numpy as np import pycuda.autoinit import pycuda.driver as cuda import time model_path = "bert.onnx" input_size = 32 TRT_LOGGER = trt.Logger(trt.Logger.WARNING) # def build_engine(model_path): # with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.OnnxParser(network, TRT_LOGGER) as parser: # builder.max_workspace_size = 1<<20 # builder.max_batch_size = 1 # with open(model_path, "rb") as f: # parser.parse(f.read()) # engine = builder.build_cuda_engine(network) # return engine def alloc_buf(engine): # host cpu mem h_in_size = trt.volume(engine.get_binding_shape(0)) h_out_size = trt.volume(engine.get_binding_shape(1)) h_in_dtype = trt.nptype(engine.get_binding_dtype(0)) h_out_dtype = trt.nptype(engine.get_binding_dtype(1)) in_cpu = cuda.pagelocked_empty(h_in_size, h_in_dtype) out_cpu = cuda.pagelocked_empty(h_out_size, h_out_dtype) # allocate gpu mem in_gpu = cuda.mem_alloc(in_cpu.nbytes) out_gpu = cuda.mem_alloc(out_cpu.nbytes) stream = cuda.Stream() return in_cpu, out_cpu, in_gpu, out_gpu, stream def inference(engine, context, inputs, out_cpu, in_gpu, out_gpu, stream): # async version # with engine.create_execution_context() as context: # cost time to initialize # cuda.memcpy_htod_async(in_gpu, inputs, stream) # context.execute_async(1, [int(in_gpu), int(out_gpu)], stream.handle, None) # cuda.memcpy_dtoh_async(out_cpu, out_gpu, stream) # stream.synchronize() # sync version cuda.memcpy_htod(in_gpu, inputs) context.execute(1, [int(in_gpu), int(out_gpu)]) cuda.memcpy_dtoh(out_cpu, out_gpu) return out_cpu if __name__ == "__main__": inputs = np.random.random((1, 1, 29, 29)).astype(np.float32) tensorrt_file_name = '/content/drive/My Drive/capstone1/CAN/bert.plan' TRT_LOGGER = trt.Logger(trt.Logger.WARNING) trt_runtime = trt.Runtime(TRT_LOGGER) with open(tensorrt_file_name, 'rb') as f: engine_data = f.read() engine = trt_runtime.deserialize_cuda_engine(engine_data) # engine = build_engine(model_path) context = engine.create_execution_context() for _ in range(10): t1 = time.time() in_cpu, out_cpu, in_gpu, out_gpu, stream = alloc_buf(engine) res = inference(engine, context, inputs.reshape(-1), out_cpu, in_gpu, out_gpu, stream) print(res) print("cost time: ", time.time()-t1)
[ 1, 529, 276, 1112, 420, 29958, 29967, 4861, 5963, 29899, 29968, 326, 29914, 29895, 6905, 29918, 5030, 12734, 29918, 29896, 13, 5215, 12489, 2273, 408, 534, 29873, 13, 5215, 282, 11078, 6191, 29889, 9465, 408, 274, 6191, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 282, 11078, 6191, 29889, 6921, 2344, 13, 5215, 8783, 13, 5215, 1904, 13, 5215, 931, 13, 29937, 1596, 29898, 3972, 29898, 509, 29873, 876, 13, 29871, 13, 20158, 2273, 29918, 1445, 29918, 978, 353, 525, 2151, 29889, 9018, 29915, 13, 5659, 29911, 29918, 14480, 17070, 353, 534, 29873, 29889, 16363, 29898, 509, 29873, 29889, 16363, 29889, 29956, 25614, 29897, 13, 509, 29873, 29918, 15634, 353, 534, 29873, 29889, 7944, 29898, 5659, 29911, 29918, 14480, 17070, 29897, 13, 29871, 13, 2541, 1722, 29898, 20158, 2273, 29918, 1445, 29918, 978, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 1678, 6012, 29918, 1272, 353, 285, 29889, 949, 580, 13, 10599, 353, 534, 29873, 29918, 15634, 29889, 2783, 261, 6646, 29918, 29883, 6191, 29918, 10599, 29898, 10599, 29918, 1272, 29897, 13, 4703, 353, 6012, 29889, 3258, 29918, 22256, 29918, 4703, 580, 13, 13, 29937, 770, 16956, 11501, 11442, 29898, 3318, 1125, 13, 29937, 268, 822, 4770, 2344, 12035, 1311, 29892, 3495, 29918, 6954, 29892, 4742, 29918, 6954, 1125, 13, 29937, 308, 1583, 29889, 3069, 353, 3495, 29918, 6954, 13, 29937, 308, 1583, 29889, 10141, 353, 4742, 29918, 6954, 13, 29871, 13, 29937, 268, 822, 4770, 710, 12035, 1311, 1125, 13, 29937, 308, 736, 376, 8514, 3583, 29876, 29908, 718, 851, 29898, 1311, 29889, 3069, 29897, 718, 6634, 29876, 11501, 3583, 29876, 29908, 718, 851, 29898, 1311, 29889, 10141, 29897, 13, 29871, 13, 29937, 268, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 29937, 308, 736, 1583, 17255, 710, 1649, 580, 13, 29871, 13, 29937, 10970, 29892, 14391, 29892, 7868, 886, 29892, 4840, 353, 19997, 19997, 19997, 5159, 13, 29937, 363, 9956, 297, 6012, 29901, 13, 29937, 268, 2159, 353, 534, 29873, 29889, 24623, 29898, 10599, 29889, 657, 29918, 19672, 29918, 12181, 29898, 19672, 876, 334, 6012, 29889, 3317, 29918, 16175, 29918, 2311, 13, 29937, 268, 26688, 353, 534, 29873, 29889, 29876, 415, 668, 29898, 10599, 29889, 657, 29918, 19672, 29918, 29881, 1853, 29898, 19672, 876, 13, 29937, 268, 3495, 29918, 6954, 353, 274, 6191, 29889, 13573, 295, 1698, 287, 29918, 6310, 29898, 2311, 29892, 26688, 29897, 13, 29937, 268, 4742, 29918, 6954, 353, 274, 6191, 29889, 6954, 29918, 15956, 29898, 3069, 29918, 6954, 29889, 29876, 13193, 29897, 13, 29937, 268, 7868, 886, 29889, 4397, 29898, 524, 29898, 10141, 29918, 6954, 876, 13, 29937, 268, 565, 6012, 29889, 19672, 29918, 275, 29918, 2080, 29898, 19672, 1125, 13, 29937, 308, 10970, 29889, 4397, 29898, 16956, 11501, 11442, 29898, 3069, 29918, 6954, 29892, 4742, 29918, 6954, 29897, 1723, 13, 29937, 268, 1683, 29901, 13, 29937, 308, 14391, 29889, 4397, 29898, 8514, 11501, 11442, 29898, 3069, 29918, 6954, 29892, 4742, 29918, 6954, 876, 13, 13, 29937, 1881, 29918, 4841, 353, 7442, 29889, 2873, 4197, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 29929, 29892, 29871, 29906, 29929, 2314, 13, 29871, 13, 29937, 12655, 29918, 2378, 29918, 2080, 353, 518, 2080, 29918, 4841, 29962, 13, 29937, 18982, 353, 518, 2080, 29889, 3069, 363, 1881, 297, 10970, 29962, 13, 29937, 534, 29873, 29918, 8768, 353, 518, 509, 29873, 29889, 524, 29941, 29906, 29962, 13, 29871, 13, 29937, 363, 12655, 29918, 2378, 29892, 3495, 29892, 534, 29873, 29918, 8768, 297, 14319, 29898, 23749, 29918, 2378, 29918, 2080, 29892, 18982, 29892, 534, 29873, 29918, 8768, 1125, 13, 29937, 268, 12655, 29918, 2378, 353, 7442, 29889, 294, 2378, 29898, 23749, 29918, 2378, 467, 336, 955, 580, 13, 29937, 268, 7442, 29889, 8552, 517, 29898, 3069, 29892, 12655, 29918, 2378, 29897, 13, 13, 29937, 822, 437, 29918, 262, 1659, 29898, 4703, 29892, 7868, 886, 29892, 10970, 29892, 14391, 29892, 4840, 1125, 13, 29937, 268, 518, 29883, 6191, 29889, 6954, 23141, 29918, 400, 397, 29918, 12674, 29898, 262, 29886, 29889, 10141, 29892, 297, 29886, 29889, 3069, 29892, 4840, 29897, 363, 297, 29886, 297, 10970, 29962, 13, 29937, 268, 3030, 29889, 7978, 29918, 12674, 29918, 29894, 29906, 29898, 5355, 886, 29922, 5355, 886, 29892, 4840, 29918, 8411, 29922, 5461, 29889, 8411, 29897, 13, 29937, 268, 518, 29883, 6191, 29889, 6954, 23141, 29918, 29881, 517, 29882, 29918, 12674, 29898, 449, 29889, 3069, 29892, 714, 29889, 10141, 29892, 4840, 29897, 363, 714, 297, 14391, 29962, 13, 29937, 268, 4840, 29889, 29879, 9524, 675, 580, 13, 29937, 268, 736, 518, 449, 29889, 3069, 363, 714, 297, 14391, 29962, 13, 13, 29937, 534, 29873, 29918, 4905, 29879, 353, 437, 29918, 262, 1659, 29898, 13, 29937, 462, 308, 3030, 29922, 4703, 29892, 13, 29937, 462, 308, 7868, 886, 29922, 5355, 886, 29892, 13, 29937, 462, 308, 10970, 29922, 2080, 29879, 29892, 13, 29937, 462, 308, 14391, 29922, 4905, 29879, 29892, 13, 29937, 462, 308, 4840, 29922, 5461, 29897, 13, 13, 1753, 10115, 29898, 4703, 29892, 1881, 29918, 2492, 29892, 1962, 29918, 2311, 29892, 9853, 29918, 2311, 1125, 13, 1678, 396, 16012, 6012, 13, 1678, 396, 6012, 353, 3030, 29889, 657, 29918, 10599, 580, 13, 1678, 396, 4974, 29898, 10599, 29889, 657, 29918, 9877, 29918, 5355, 886, 580, 1275, 29871, 29906, 29897, 13, 1678, 396, 14806, 1881, 848, 304, 5785, 29941, 29906, 13, 1678, 1881, 29918, 2492, 353, 1881, 29918, 2492, 29889, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 396, 6204, 3495, 6835, 304, 7150, 848, 13, 1678, 1962, 353, 7442, 29889, 6310, 29898, 4905, 29918, 2311, 29892, 26688, 353, 7442, 29889, 7411, 29941, 29906, 29897, 13, 1678, 396, 838, 2029, 403, 4742, 3370, 13, 1678, 270, 29918, 2080, 353, 274, 6191, 29889, 6954, 29918, 15956, 29898, 16175, 29918, 2311, 334, 1881, 29918, 2492, 29889, 2311, 334, 1881, 29918, 2492, 29889, 29881, 1853, 29889, 667, 2311, 29897, 13, 1678, 270, 29918, 4905, 353, 274, 6191, 29889, 6954, 29918, 15956, 29898, 16175, 29918, 2311, 334, 1962, 29889, 2311, 334, 1962, 29889, 29881, 1853, 29889, 667, 2311, 29897, 13, 13, 1678, 7868, 886, 353, 518, 524, 29898, 29881, 29918, 2080, 511, 938, 29898, 29881, 29918, 4905, 4638, 13, 1678, 4840, 353, 274, 6191, 29889, 3835, 580, 13, 1678, 396, 17934, 1881, 848, 304, 4742, 13, 1678, 274, 6191, 29889, 6954, 23141, 29918, 400, 397, 29918, 12674, 29898, 29881, 29918, 2080, 29892, 1881, 29918, 2492, 29892, 4840, 29897, 13, 1678, 396, 11080, 1082, 1904, 13, 1678, 3030, 29889, 7978, 29918, 12674, 29898, 16175, 29918, 2311, 29892, 7868, 886, 29892, 4840, 29889, 8411, 29892, 6213, 29897, 13, 1678, 396, 17934, 27303, 1250, 13, 1678, 274, 6191, 29889, 6954, 23141, 29918, 29881, 517, 29882, 29918, 12674, 29898, 4905, 29892, 270, 29918, 4905, 29892, 4840, 29897, 13, 1678, 396, 317, 9524, 675, 9717, 13, 1678, 4840, 29889, 29879, 9524, 675, 580, 13, 1678, 396, 7106, 27303, 13, 1678, 736, 1962, 13, 13, 13, 29937, 9049, 5085, 353, 426, 1642, 29914, 24713, 29914, 6132, 29903, 29918, 24713, 29889, 7638, 29908, 584, 19283, 6132, 29903, 29918, 24713, 29889, 3945, 10827, 13, 29937, 7945, 29918, 1272, 29918, 842, 29892, 848, 29918, 13140, 29918, 1958, 29892, 7787, 29918, 1990, 29918, 2798, 29892, 7787, 29918, 1272, 29918, 2798, 29892, 1243, 29918, 1272, 29918, 842, 353, 8783, 29889, 2577, 6028, 16390, 24541, 15156, 29911, 486, 29968, 29893, 1191, 29898, 29896, 29900, 29900, 29892, 29871, 29900, 29892, 3579, 19290, 29897, 13, 29937, 1243, 12657, 353, 4842, 305, 29889, 13239, 29889, 1272, 29889, 1469, 10036, 29898, 1688, 29918, 1272, 29918, 842, 29892, 9853, 29918, 2311, 29922, 29906, 29945, 29953, 29892, 13, 29937, 462, 462, 308, 528, 21897, 29922, 8824, 29892, 954, 29918, 1287, 414, 29922, 29906, 29897, 13, 13, 3198, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 20047, 353, 29871, 29900, 13, 7382, 353, 7442, 29889, 2873, 4197, 29906, 29945, 29953, 29892, 29871, 29896, 29892, 29871, 29906, 29929, 29892, 29871, 29906, 29929, 2314, 13, 1454, 22645, 297, 3464, 29898, 29896, 29900, 29900, 1125, 13, 29937, 363, 474, 29892, 313, 2080, 29879, 29892, 11073, 29897, 297, 26985, 29898, 1688, 12657, 1125, 13, 1678, 534, 29873, 29918, 4905, 29879, 353, 10115, 29898, 4703, 29892, 5694, 29892, 313, 29906, 29945, 29953, 29892, 29871, 29906, 511, 29871, 29906, 29945, 29953, 29897, 13, 13, 1678, 1596, 29898, 509, 29873, 29918, 4905, 29879, 29889, 12181, 29897, 13, 1678, 396, 1596, 29898, 509, 29873, 29918, 4905, 29879, 29897, 13, 1678, 396, 1596, 29898, 9302, 29889, 1191, 3317, 29898, 509, 29873, 29918, 4905, 29879, 29892, 9685, 29922, 29900, 876, 13, 1678, 396, 274, 593, 4619, 29871, 29896, 13, 1678, 396, 565, 274, 593, 1275, 29871, 29896, 29900, 29900, 29901, 13, 1678, 396, 268, 2867, 13, 2158, 29898, 2230, 29889, 2230, 580, 448, 1423, 29918, 2230, 29897, 13, 13, 13, 20158, 2273, 29918, 1445, 29918, 978, 353, 525, 2151, 29918, 524, 29889, 9018, 29915, 13, 5659, 29911, 29918, 14480, 17070, 353, 534, 29873, 29889, 16363, 29898, 509, 29873, 29889, 16363, 29889, 29956, 25614, 29897, 13, 509, 29873, 29918, 15634, 353, 534, 29873, 29889, 7944, 29898, 5659, 29911, 29918, 14480, 17070, 29897, 13, 29871, 13, 2541, 1722, 29898, 20158, 2273, 29918, 1445, 29918, 978, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 1678, 6012, 29918, 1272, 353, 285, 29889, 949, 580, 13, 10599, 353, 534, 29873, 29918, 15634, 29889, 2783, 261, 6646, 29918, 29883, 6191, 29918, 10599, 29898, 10599, 29918, 1272, 29897, 13, 4703, 353, 6012, 29889, 3258, 29918, 22256, 29918, 4703, 580, 13, 3198, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 20047, 353, 29871, 29900, 13, 7382, 353, 7442, 29889, 2873, 4197, 29906, 29945, 29953, 29892, 29871, 29896, 29892, 29871, 29906, 29929, 29892, 29871, 29906, 29929, 2314, 13, 1454, 22645, 297, 3464, 29898, 29896, 29900, 29900, 1125, 13, 29937, 363, 474, 29892, 313, 2080, 29879, 29892, 11073, 29897, 297, 26985, 29898, 1688, 12657, 1125, 13, 1678, 534, 29873, 29918, 4905, 29879, 353, 10115, 29898, 4703, 29892, 5694, 29892, 313, 29906, 29945, 29953, 29892, 29871, 29906, 511, 29871, 29906, 29945, 29953, 29897, 13, 13, 1678, 1596, 29898, 509, 29873, 29918, 4905, 29879, 29889, 12181, 29897, 13, 1678, 396, 1596, 29898, 509, 29873, 29918, 4905, 29879, 29897, 13, 1678, 396, 1596, 29898, 9302, 29889, 1191, 3317, 29898, 509, 29873, 29918, 4905, 29879, 29892, 9685, 29922, 29900, 876, 13, 1678, 396, 274, 593, 4619, 29871, 29896, 13, 1678, 396, 565, 274, 593, 1275, 29871, 29896, 29900, 29900, 29901, 13, 1678, 396, 268, 2867, 13, 2158, 29898, 2230, 29889, 2230, 580, 448, 1423, 29918, 2230, 29897, 13, 13, 13, 1688, 29918, 4299, 353, 1904, 29889, 6779, 2141, 29883, 6191, 580, 13, 3198, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 20047, 353, 29871, 29900, 13, 7382, 353, 4842, 305, 29889, 9502, 29876, 29898, 29906, 29945, 29953, 29892, 29871, 29896, 29892, 29871, 29906, 29929, 29892, 29871, 29906, 29929, 467, 29883, 6191, 580, 13, 1454, 22645, 297, 3464, 29898, 29896, 29900, 29900, 1125, 13, 29937, 363, 474, 29892, 313, 2080, 29879, 29892, 11073, 29897, 297, 26985, 29898, 1688, 12657, 1125, 13, 1678, 396, 10970, 353, 10970, 29889, 7411, 2141, 29883, 6191, 580, 13, 1678, 4226, 29918, 4905, 29879, 353, 1243, 29918, 4299, 29898, 7382, 29897, 13, 1678, 396, 1596, 29898, 8945, 29918, 4905, 29879, 29897, 13, 1678, 1596, 29898, 8945, 29918, 4905, 29879, 29889, 12181, 29897, 13, 1678, 274, 593, 4619, 29871, 29896, 13, 1678, 565, 274, 593, 1275, 29871, 29896, 29900, 29900, 29901, 13, 4706, 2867, 13, 2158, 29898, 2230, 29889, 2230, 580, 448, 1423, 29918, 2230, 29897, 13, 13, 13, 13, 5215, 12489, 2273, 408, 534, 29873, 13, 5215, 12655, 408, 7442, 13, 5215, 282, 11078, 6191, 29889, 6921, 2344, 13, 5215, 282, 11078, 6191, 29889, 9465, 408, 274, 6191, 29871, 13, 5215, 931, 13, 13, 4299, 29918, 2084, 353, 376, 2151, 29889, 3409, 29916, 29908, 13, 2080, 29918, 2311, 353, 29871, 29941, 29906, 13, 13, 5659, 29911, 29918, 14480, 17070, 353, 534, 29873, 29889, 16363, 29898, 509, 29873, 29889, 16363, 29889, 29956, 25614, 29897, 13, 13, 29937, 822, 2048, 29918, 10599, 29898, 4299, 29918, 2084, 1125, 13, 29937, 268, 411, 534, 29873, 29889, 5627, 29898, 5659, 29911, 29918, 14480, 17070, 29897, 408, 12856, 29892, 12856, 29889, 3258, 29918, 11618, 580, 408, 3564, 29892, 534, 29873, 29889, 2951, 23818, 11726, 29898, 11618, 29892, 10014, 29911, 29918, 14480, 17070, 29897, 408, 13812, 29901, 29871, 13, 29937, 308, 12856, 29889, 3317, 29918, 1287, 3493, 29918, 2311, 353, 29871, 29896, 9314, 29906, 29900, 13, 29937, 308, 12856, 29889, 3317, 29918, 16175, 29918, 2311, 353, 29871, 29896, 13, 29937, 308, 411, 1722, 29898, 4299, 29918, 2084, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 29937, 632, 13812, 29889, 5510, 29898, 29888, 29889, 949, 3101, 13, 29937, 308, 6012, 353, 12856, 29889, 4282, 29918, 29883, 6191, 29918, 10599, 29898, 11618, 29897, 13, 29937, 308, 736, 6012, 13, 13, 1753, 6643, 29918, 9721, 29898, 10599, 1125, 13, 1678, 396, 3495, 26403, 2626, 13, 1678, 298, 29918, 262, 29918, 2311, 353, 534, 29873, 29889, 24623, 29898, 10599, 29889, 657, 29918, 19672, 29918, 12181, 29898, 29900, 876, 13, 1678, 298, 29918, 449, 29918, 2311, 353, 534, 29873, 29889, 24623, 29898, 10599, 29889, 657, 29918, 19672, 29918, 12181, 29898, 29896, 876, 13, 1678, 298, 29918, 262, 29918, 29881, 1853, 353, 534, 29873, 29889, 29876, 415, 668, 29898, 10599, 29889, 657, 29918, 19672, 29918, 29881, 1853, 29898, 29900, 876, 13, 1678, 298, 29918, 449, 29918, 29881, 1853, 353, 534, 29873, 29889, 29876, 415, 668, 29898, 10599, 29889, 657, 29918, 19672, 29918, 29881, 1853, 29898, 29896, 876, 13, 1678, 297, 29918, 21970, 353, 274, 6191, 29889, 13573, 295, 1698, 287, 29918, 6310, 29898, 29882, 29918, 262, 29918, 2311, 29892, 298, 29918, 262, 29918, 29881, 1853, 29897, 13, 1678, 714, 29918, 21970, 353, 274, 6191, 29889, 13573, 295, 1698, 287, 29918, 6310, 29898, 29882, 29918, 449, 29918, 2311, 29892, 298, 29918, 449, 29918, 29881, 1853, 29897, 13, 1678, 396, 23632, 330, 3746, 2626, 13, 1678, 297, 29918, 29887, 3746, 353, 274, 6191, 29889, 6954, 29918, 15956, 29898, 262, 29918, 21970, 29889, 29876, 13193, 29897, 13, 1678, 714, 29918, 29887, 3746, 353, 274, 6191, 29889, 6954, 29918, 15956, 29898, 449, 29918, 21970, 29889, 29876, 13193, 29897, 13, 1678, 4840, 353, 274, 6191, 29889, 3835, 580, 13, 1678, 736, 297, 29918, 21970, 29892, 714, 29918, 21970, 29892, 297, 29918, 29887, 3746, 29892, 714, 29918, 29887, 3746, 29892, 4840, 13, 13, 13, 1753, 27262, 29898, 10599, 29892, 3030, 29892, 10970, 29892, 714, 29918, 21970, 29892, 297, 29918, 29887, 3746, 29892, 714, 29918, 29887, 3746, 29892, 4840, 1125, 13, 1678, 396, 7465, 1873, 13, 1678, 396, 411, 6012, 29889, 3258, 29918, 22256, 29918, 4703, 580, 408, 3030, 29901, 29871, 396, 3438, 931, 304, 11905, 13, 1678, 396, 274, 6191, 29889, 6954, 23141, 29918, 400, 397, 29918, 12674, 29898, 262, 29918, 29887, 3746, 29892, 10970, 29892, 4840, 29897, 13, 1678, 396, 3030, 29889, 7978, 29918, 12674, 29898, 29896, 29892, 518, 524, 29898, 262, 29918, 29887, 3746, 511, 938, 29898, 449, 29918, 29887, 3746, 29897, 1402, 4840, 29889, 8411, 29892, 6213, 29897, 13, 1678, 396, 274, 6191, 29889, 6954, 23141, 29918, 29881, 517, 29882, 29918, 12674, 29898, 449, 29918, 21970, 29892, 714, 29918, 29887, 3746, 29892, 4840, 29897, 13, 1678, 396, 4840, 29889, 29879, 9524, 675, 580, 13, 13, 1678, 396, 16523, 1873, 13, 1678, 274, 6191, 29889, 6954, 23141, 29918, 400, 397, 29898, 262, 29918, 29887, 3746, 29892, 10970, 29897, 13, 1678, 3030, 29889, 7978, 29898, 29896, 29892, 518, 524, 29898, 262, 29918, 29887, 3746, 511, 938, 29898, 449, 29918, 29887, 3746, 29897, 2314, 13, 1678, 274, 6191, 29889, 6954, 23141, 29918, 29881, 517, 29882, 29898, 449, 29918, 21970, 29892, 714, 29918, 29887, 3746, 29897, 13, 1678, 736, 714, 29918, 21970, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 10970, 353, 7442, 29889, 8172, 29889, 8172, 3552, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 29929, 29892, 29871, 29906, 29929, 8106, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 29897, 13, 13, 1678, 12489, 2273, 29918, 1445, 29918, 978, 353, 8207, 3051, 29914, 21594, 29914, 3421, 22850, 29914, 5030, 12734, 29896, 29914, 29907, 2190, 29914, 2151, 29889, 9018, 29915, 13, 1678, 10014, 29911, 29918, 14480, 17070, 353, 534, 29873, 29889, 16363, 29898, 509, 29873, 29889, 16363, 29889, 29956, 25614, 29897, 13, 1678, 534, 29873, 29918, 15634, 353, 534, 29873, 29889, 7944, 29898, 5659, 29911, 29918, 14480, 17070, 29897, 13, 268, 13, 1678, 411, 1722, 29898, 20158, 2273, 29918, 1445, 29918, 978, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 4706, 6012, 29918, 1272, 353, 285, 29889, 949, 580, 13, 1678, 6012, 353, 534, 29873, 29918, 15634, 29889, 2783, 261, 6646, 29918, 29883, 6191, 29918, 10599, 29898, 10599, 29918, 1272, 29897, 13, 1678, 396, 6012, 353, 2048, 29918, 10599, 29898, 4299, 29918, 2084, 29897, 13, 1678, 3030, 353, 6012, 29889, 3258, 29918, 22256, 29918, 4703, 580, 13, 1678, 363, 903, 297, 3464, 29898, 29896, 29900, 1125, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 297, 29918, 21970, 29892, 714, 29918, 21970, 29892, 297, 29918, 29887, 3746, 29892, 714, 29918, 29887, 3746, 29892, 4840, 353, 6643, 29918, 9721, 29898, 10599, 29897, 13, 4706, 620, 353, 27262, 29898, 10599, 29892, 3030, 29892, 10970, 29889, 690, 14443, 6278, 29896, 511, 714, 29918, 21970, 29892, 297, 29918, 29887, 3746, 29892, 714, 29918, 29887, 3746, 29892, 4840, 29897, 13, 4706, 1596, 29898, 690, 29897, 13, 4706, 1596, 703, 18253, 931, 29901, 9162, 931, 29889, 2230, 580, 29899, 29873, 29896, 29897, 2 ]
dagger/dag_creator/airflow/utils/utils.py
jorgetagle/dagger
5
143709
from pathlib import Path def get_sql_queries(path): sql_queries = {} for query_file in Path(path).glob("*.sql"): with open(query_file, "r") as f: sql_queries[query_file.stem] = f.read() return sql_queries
[ 1, 515, 2224, 1982, 1053, 10802, 13, 13, 13, 1753, 679, 29918, 2850, 29918, 339, 6358, 29898, 2084, 1125, 13, 1678, 4576, 29918, 339, 6358, 353, 6571, 13, 1678, 363, 2346, 29918, 1445, 297, 10802, 29898, 2084, 467, 23705, 703, 10521, 2850, 29908, 1125, 13, 4706, 411, 1722, 29898, 1972, 29918, 1445, 29892, 376, 29878, 1159, 408, 285, 29901, 13, 9651, 4576, 29918, 339, 6358, 29961, 1972, 29918, 1445, 29889, 303, 331, 29962, 353, 285, 29889, 949, 580, 13, 1678, 736, 4576, 29918, 339, 6358, 13, 2 ]
action-server/covidflow/actions/action_daily_ci_early_opt_out.py
dialoguemd/covidflow
7
162107
from typing import Any, Dict, List, Text from rasa_sdk import Action, Tracker from rasa_sdk.events import SlotSet from rasa_sdk.executor import CollectingDispatcher from covidflow.constants import CONTINUE_CI_SLOT from covidflow.utils.persistence import cancel_reminder from .lib.log_util import bind_logger ACTION_NAME = "action_daily_ci_early_opt_out" class ActionDailyCiEarlyOptOut(Action): def name(self) -> Text: return ACTION_NAME def run( self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> List[Dict[Text, Any]]: bind_logger(tracker) dispatcher.utter_message( template="utter_daily_ci__early_opt_out__acknowledge_cancel_ci" ) dispatcher.utter_message( template="utter_daily_ci__early_opt_out__cancel_ci_recommendation" ) cancel_reminder(tracker.current_slot_values()) return [SlotSet(CONTINUE_CI_SLOT, False)]
[ 1, 515, 19229, 1053, 3139, 29892, 360, 919, 29892, 2391, 29892, 3992, 13, 13, 3166, 364, 11290, 29918, 15348, 1053, 9123, 29892, 3201, 4937, 13, 3166, 364, 11290, 29918, 15348, 29889, 13604, 1053, 317, 8276, 2697, 13, 3166, 364, 11290, 29918, 15348, 29889, 4258, 3406, 1053, 24930, 292, 23669, 13, 13, 3166, 18838, 333, 1731, 29889, 3075, 1934, 1053, 8707, 29911, 1177, 4462, 29918, 8426, 29918, 12750, 2891, 13, 3166, 18838, 333, 1731, 29889, 13239, 29889, 28249, 1053, 12611, 29918, 1745, 4995, 13, 13, 3166, 869, 1982, 29889, 1188, 29918, 4422, 1053, 7868, 29918, 21707, 13, 13, 24705, 29918, 5813, 353, 376, 2467, 29918, 29881, 8683, 29918, 455, 29918, 799, 368, 29918, 3670, 29918, 449, 29908, 13, 13, 13, 1990, 9123, 29928, 8683, 29907, 29875, 29923, 279, 368, 20624, 3744, 29898, 4276, 1125, 13, 1678, 822, 1024, 29898, 1311, 29897, 1599, 3992, 29901, 13, 4706, 736, 319, 9838, 29918, 5813, 13, 13, 1678, 822, 1065, 29898, 13, 4706, 1583, 29892, 13, 4706, 13916, 261, 29901, 24930, 292, 23669, 29892, 13, 4706, 1020, 4937, 29901, 3201, 4937, 29892, 13, 4706, 5354, 29901, 360, 919, 29961, 1626, 29892, 3139, 1402, 13, 1678, 1723, 1599, 2391, 29961, 21533, 29961, 1626, 29892, 3139, 5262, 29901, 13, 4706, 7868, 29918, 21707, 29898, 3018, 4937, 29897, 13, 4706, 13916, 261, 29889, 6463, 29918, 4906, 29898, 13, 9651, 4472, 543, 6463, 29918, 29881, 8683, 29918, 455, 1649, 799, 368, 29918, 3670, 29918, 449, 1649, 547, 3707, 5485, 29918, 20713, 29918, 455, 29908, 13, 4706, 1723, 13, 13, 4706, 13916, 261, 29889, 6463, 29918, 4906, 29898, 13, 9651, 4472, 543, 6463, 29918, 29881, 8683, 29918, 455, 1649, 799, 368, 29918, 3670, 29918, 449, 1649, 20713, 29918, 455, 29918, 276, 2055, 355, 362, 29908, 13, 4706, 1723, 13, 13, 4706, 12611, 29918, 1745, 4995, 29898, 3018, 4937, 29889, 3784, 29918, 2536, 327, 29918, 5975, 3101, 13, 13, 4706, 736, 518, 29903, 8276, 2697, 29898, 22412, 1177, 4462, 29918, 8426, 29918, 12750, 2891, 29892, 7700, 4638, 13, 2 ]
LambdaFunction/index.py
aws-samples/integrate-amazon-connect-with-smart-on-fhir-backend-services
3
92474
import json, random, string, os, math, time, datetime, dateutil.parser import boto3 from datetime import datetime, timedelta, timezone import logging from FHIRClient import FHIRClient logger = logging.getLogger() logger.setLevel(logging.INFO) ## Establish the connection to SMART on FHIR backend services fhirclient = FHIRClient( os.environ['client_id'], os.environ['endpoint_token'], os.environ['endpoint_stu3'], os.environ['kms_key_id'] ) """ --- Helpers to build responses which match the structure of the necessary dialog actions --- """ def elicit_slot(session_attributes, intent_name, slots, slot_to_elicit, message, response_card): return { 'sessionAttributes': session_attributes, 'dialogAction': { 'type': 'ElicitSlot', 'intentName': intent_name, 'slots': slots, 'slotToElicit': slot_to_elicit, 'message': message, 'responseCard': response_card } } def confirm_intent(session_attributes, intent_name, slots, message, response_card): return { 'sessionAttributes': session_attributes, 'dialogAction': { 'type': 'ConfirmIntent', 'intentName': intent_name, 'slots': slots, 'message': message, 'responseCard': response_card } } def close(session_attributes, fulfillment_state, message): response = { 'sessionAttributes': session_attributes, 'dialogAction': { 'type': 'Close', 'fulfillmentState': fulfillment_state, 'message': message } } return response def delegate(session_attributes, slots): return { 'sessionAttributes': session_attributes, 'dialogAction': { 'type': 'Delegate', 'slots': slots } } def build_response_card(title, subtitle, options): """ Build a responseCard with a title, subtitle, and an optional set of options which should be displayed as buttons. """ buttons = None if len(options) > 1: buttons = [] for i in range(min(5, len(options))): buttons.append(options[i]) return { 'contentType': 'application/vnd.amazonaws.card.generic', 'version': 1, 'genericAttachments': [{ 'title': title, 'subTitle': subtitle, 'buttons': buttons }] } else: return { 'contentType': 'application/vnd.amazonaws.card.generic', 'version': 1, 'genericAttachments': [{ 'title': title, 'subTitle': subtitle }] } """ --- Functions that control the bot's behavior --- """ def getPatientAuth(intent_request): """ Authenticate caller and return FHIR STU3 patient ID for the following query """ logger.debug('intent request: {}'.format(intent_request)) output_session_attributes = intent_request['currentIntent']['slots'] if intent_request['currentIntent']['slots'] is not None else {} telecom = intent_request['sessionAttributes']['telecom'] if intent_request['sessionAttributes']['telecom'] is not None else {} ## format phone number telecom = '{0}-{1}-{2}'.format(telecom[-10:-7], telecom[-7:-4], telecom[-4:]) logger.debug('phone number after tranformation: {}'.format(telecom)) patientinfo = { 'birthdate': output_session_attributes['patientBirthday'], 'gender': output_session_attributes['patientGender'], 'telecom': telecom } r = fhirclient.get_patient(patientinfo) output_session_attributes['patientid']=r['response'] if r['status']==200: statusMessage = "Thank you for authenticating" else: statusMessage = "I'm sorry, I didn't find a patient with that information" return close( output_session_attributes, 'Fulfilled', { 'contentType': 'PlainText', 'content': statusMessage } ) def getMedHelp(intent_request): """ Retrieve Medication Information for a given patient """ logger.info('intent request: {}'.format(intent_request)) output_session_attributes = intent_request['sessionAttributes'] if intent_request['sessionAttributes'] is not None else {} patientid = output_session_attributes['patientid'] if output_session_attributes['patientid'] is not None else {} res = fhirclient.get_meds(patientid) logger.debug(res) if res['status']==200: if type(res['response'])==str: outputtext = res['response'] else: outputtext = 'I have found the following medications and instructions for you. ' for med in res["response"]: outputtext += med['medicationReference'] + '. ' if 'dosage' in med and 'patientInstruction' in med['dosage'][0]: outputtext += 'The dosage for this is the following... ' + med['dosage'][0]['patientInstruction'] else: outputtext += 'I did not find a dosage for this medication. ' else: outputtext = 'I do not have any medication for you.' return close( output_session_attributes, 'Fulfilled', { 'contentType': 'PlainText', 'content': outputtext } ) """ --- Intents --- """ def dispatch(intent_request): """ Called when the user specifies an intent for this bot. """ logger.debug (intent_request) intent_name = intent_request['currentIntent']['name'] # Dispatch to your bot's intent handlers if intent_name == 'getAppointments': return findFutureAppt(intent_request) if intent_name == 'getMedication': return getMedHelp(intent_request) if intent_name == 'authenticateUser': return getPatientAuth(intent_request) raise Exception('Intent with name ' + intent_name + ' not supported') """ --- Main handler --- """ def lambda_handler(event, context): """ Route the incoming request based on intent. The JSON body of the request is provided in the event slot. """ # By default, treat the user request as coming from the America/New_York time zone. os.environ['TZ'] = 'America/New_York' time.tzset() logger.debug('event.bot.name={}'.format(event['bot']['name'])) return dispatch(event)
[ 1, 1053, 4390, 29892, 4036, 29892, 1347, 29892, 2897, 29892, 5844, 29892, 931, 29892, 12865, 29892, 2635, 4422, 29889, 16680, 13, 5215, 289, 3747, 29941, 13, 3166, 12865, 1053, 12865, 29892, 5335, 287, 2554, 29892, 29431, 13, 5215, 12183, 13, 3166, 383, 29950, 8193, 4032, 1053, 383, 29950, 8193, 4032, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 580, 13, 21707, 29889, 842, 10108, 29898, 21027, 29889, 11690, 29897, 13, 13, 2277, 2661, 370, 1674, 278, 3957, 304, 317, 1529, 13079, 373, 383, 29950, 8193, 14998, 5786, 13, 29888, 29882, 2076, 1593, 353, 383, 29950, 8193, 4032, 29898, 13, 1678, 2897, 29889, 21813, 1839, 4645, 29918, 333, 7464, 13, 1678, 2897, 29889, 21813, 1839, 29734, 29918, 6979, 7464, 13, 1678, 2897, 29889, 21813, 1839, 29734, 29918, 303, 29884, 29941, 7464, 13, 1678, 2897, 29889, 21813, 1839, 29895, 1516, 29918, 1989, 29918, 333, 2033, 13, 29897, 13, 13, 13, 13, 15945, 29908, 11474, 6162, 6774, 304, 2048, 20890, 607, 1993, 278, 3829, 310, 278, 5181, 7928, 8820, 11474, 9995, 13, 1753, 560, 293, 277, 29918, 2536, 327, 29898, 7924, 29918, 15697, 29892, 7609, 29918, 978, 29892, 2243, 1862, 29892, 21497, 29918, 517, 29918, 295, 293, 277, 29892, 2643, 29892, 2933, 29918, 7543, 1125, 13, 1678, 736, 426, 13, 4706, 525, 7924, 15801, 2396, 4867, 29918, 15697, 29892, 13, 4706, 525, 15901, 4276, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 29923, 4019, 29903, 8276, 742, 13, 9651, 525, 14029, 1170, 2396, 7609, 29918, 978, 29892, 13, 9651, 525, 2536, 1862, 2396, 2243, 1862, 29892, 13, 9651, 525, 2536, 327, 1762, 29923, 4019, 2396, 21497, 29918, 517, 29918, 295, 293, 277, 29892, 13, 9651, 525, 4906, 2396, 2643, 29892, 13, 9651, 525, 5327, 13200, 2396, 2933, 29918, 7543, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 1753, 9659, 29918, 14029, 29898, 7924, 29918, 15697, 29892, 7609, 29918, 978, 29892, 2243, 1862, 29892, 2643, 29892, 2933, 29918, 7543, 1125, 13, 1678, 736, 426, 13, 4706, 525, 7924, 15801, 2396, 4867, 29918, 15697, 29892, 13, 4706, 525, 15901, 4276, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 16376, 3568, 10286, 742, 13, 9651, 525, 14029, 1170, 2396, 7609, 29918, 978, 29892, 13, 9651, 525, 2536, 1862, 2396, 2243, 1862, 29892, 13, 9651, 525, 4906, 2396, 2643, 29892, 13, 9651, 525, 5327, 13200, 2396, 2933, 29918, 7543, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 1753, 3802, 29898, 7924, 29918, 15697, 29892, 6095, 5589, 358, 29918, 3859, 29892, 2643, 1125, 13, 1678, 2933, 353, 426, 13, 4706, 525, 7924, 15801, 2396, 4867, 29918, 15697, 29892, 13, 4706, 525, 15901, 4276, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 11123, 742, 13, 9651, 525, 1319, 5589, 358, 2792, 2396, 6095, 5589, 358, 29918, 3859, 29892, 13, 9651, 525, 4906, 2396, 2643, 13, 4706, 500, 13, 1678, 500, 13, 13, 1678, 736, 2933, 13, 259, 13, 268, 13, 1753, 13341, 29898, 7924, 29918, 15697, 29892, 2243, 1862, 1125, 13, 1678, 736, 426, 13, 4706, 525, 7924, 15801, 2396, 4867, 29918, 15697, 29892, 13, 4706, 525, 15901, 4276, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 11494, 742, 13, 9651, 525, 2536, 1862, 2396, 2243, 1862, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 1753, 2048, 29918, 5327, 29918, 7543, 29898, 3257, 29892, 1014, 3257, 29892, 3987, 1125, 13, 1678, 9995, 13, 1678, 8878, 263, 2933, 13200, 411, 263, 3611, 29892, 1014, 3257, 29892, 322, 385, 13136, 731, 310, 3987, 607, 881, 367, 8833, 408, 9828, 29889, 13, 1678, 9995, 13, 1678, 9828, 353, 6213, 13, 1678, 565, 7431, 29898, 6768, 29897, 1405, 29871, 29896, 29901, 13, 4706, 9828, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 1195, 29898, 29945, 29892, 7431, 29898, 6768, 876, 1125, 13, 9651, 9828, 29889, 4397, 29898, 6768, 29961, 29875, 2314, 13, 13, 4706, 736, 426, 13, 9651, 525, 3051, 1542, 2396, 525, 6214, 29914, 29894, 299, 29889, 17260, 10467, 29889, 7543, 29889, 19206, 742, 13, 9651, 525, 3259, 2396, 29871, 29896, 29892, 13, 9651, 525, 19206, 4165, 496, 1860, 2396, 15974, 13, 18884, 525, 3257, 2396, 3611, 29892, 13, 18884, 525, 1491, 7030, 2396, 1014, 3257, 29892, 13, 18884, 525, 4187, 7453, 2396, 9828, 13, 9651, 500, 29962, 13, 4706, 500, 13, 1678, 1683, 29901, 13, 4706, 736, 426, 13, 4706, 525, 3051, 1542, 2396, 525, 6214, 29914, 29894, 299, 29889, 17260, 10467, 29889, 7543, 29889, 19206, 742, 13, 4706, 525, 3259, 2396, 29871, 29896, 29892, 13, 4706, 525, 19206, 4165, 496, 1860, 2396, 15974, 13, 9651, 525, 3257, 2396, 3611, 29892, 13, 9651, 525, 1491, 7030, 2396, 1014, 3257, 13, 4706, 500, 29962, 13, 1678, 500, 13, 13, 13, 15945, 29908, 11474, 6680, 29879, 393, 2761, 278, 9225, 29915, 29879, 6030, 11474, 9995, 13, 1753, 679, 11457, 993, 6444, 29898, 14029, 29918, 3827, 1125, 13, 1678, 9995, 13, 1678, 13189, 4173, 403, 24959, 322, 736, 383, 29950, 8193, 6850, 29965, 29941, 16500, 3553, 363, 278, 1494, 2346, 13, 1678, 9995, 13, 1678, 17927, 29889, 8382, 877, 14029, 2009, 29901, 6571, 4286, 4830, 29898, 14029, 29918, 3827, 876, 13, 1678, 1962, 29918, 7924, 29918, 15697, 353, 7609, 29918, 3827, 1839, 3784, 10286, 16215, 2536, 1862, 2033, 565, 7609, 29918, 3827, 1839, 3784, 10286, 16215, 2536, 1862, 2033, 338, 451, 6213, 1683, 6571, 13, 1678, 4382, 510, 353, 7609, 29918, 3827, 1839, 7924, 15801, 16215, 15494, 510, 2033, 565, 7609, 29918, 3827, 1839, 7924, 15801, 16215, 15494, 510, 2033, 338, 451, 6213, 1683, 6571, 13, 268, 13, 1678, 444, 3402, 9008, 1353, 13, 1678, 4382, 510, 353, 22372, 29900, 7402, 29912, 29896, 7402, 29912, 29906, 29913, 4286, 4830, 29898, 15494, 510, 14352, 29896, 29900, 13018, 29955, 1402, 4382, 510, 14352, 29955, 13018, 29946, 1402, 4382, 510, 14352, 29946, 29901, 2314, 13, 1678, 17927, 29889, 8382, 877, 6710, 1353, 1156, 22024, 5404, 29901, 6571, 4286, 4830, 29898, 15494, 510, 876, 13, 1678, 16500, 3888, 353, 426, 13, 4706, 525, 29890, 7515, 1256, 2396, 1962, 29918, 7924, 29918, 15697, 1839, 5031, 993, 29933, 7515, 3250, 7464, 29871, 13, 4706, 525, 26098, 2396, 1962, 29918, 7924, 29918, 15697, 1839, 5031, 993, 29954, 1581, 7464, 13, 4706, 525, 15494, 510, 2396, 4382, 510, 13, 1678, 500, 13, 1678, 364, 353, 285, 29882, 2076, 1593, 29889, 657, 29918, 5031, 993, 29898, 5031, 993, 3888, 29897, 13, 1678, 1962, 29918, 7924, 29918, 15697, 1839, 5031, 993, 333, 2033, 29922, 29878, 1839, 5327, 2033, 13, 1678, 565, 364, 1839, 4882, 2033, 1360, 29906, 29900, 29900, 29901, 13, 4706, 4660, 3728, 353, 376, 25271, 366, 363, 15585, 1218, 29908, 13, 1678, 1683, 29901, 13, 4706, 4660, 3728, 353, 376, 29902, 29915, 29885, 7423, 29892, 306, 3282, 29915, 29873, 1284, 263, 16500, 411, 393, 2472, 29908, 13, 1678, 736, 3802, 29898, 13, 4706, 1962, 29918, 7924, 29918, 15697, 29892, 13, 4706, 525, 29943, 352, 26940, 742, 13, 4706, 426, 13, 9651, 525, 3051, 1542, 2396, 525, 29925, 7420, 1626, 742, 13, 9651, 525, 3051, 2396, 4660, 3728, 13, 4706, 500, 13, 1678, 1723, 13, 13, 13, 1753, 679, 19302, 29648, 29898, 14029, 29918, 3827, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 22247, 362, 10343, 363, 263, 2183, 16500, 13, 1678, 9995, 13, 1678, 17927, 29889, 3888, 877, 14029, 2009, 29901, 6571, 4286, 4830, 29898, 14029, 29918, 3827, 876, 13, 1678, 1962, 29918, 7924, 29918, 15697, 353, 7609, 29918, 3827, 1839, 7924, 15801, 2033, 565, 7609, 29918, 3827, 1839, 7924, 15801, 2033, 338, 451, 6213, 1683, 6571, 13, 1678, 16500, 333, 353, 1962, 29918, 7924, 29918, 15697, 1839, 5031, 993, 333, 2033, 565, 1962, 29918, 7924, 29918, 15697, 1839, 5031, 993, 333, 2033, 338, 451, 6213, 1683, 6571, 13, 1678, 620, 353, 285, 29882, 2076, 1593, 29889, 657, 29918, 2168, 29879, 29898, 5031, 993, 333, 29897, 13, 1678, 17927, 29889, 8382, 29898, 690, 29897, 13, 1678, 565, 620, 1839, 4882, 2033, 1360, 29906, 29900, 29900, 29901, 13, 4706, 565, 1134, 29898, 690, 1839, 5327, 11287, 1360, 710, 29901, 13, 9651, 1962, 726, 353, 620, 1839, 5327, 2033, 13, 4706, 1683, 29901, 13, 9651, 1962, 726, 353, 525, 29902, 505, 1476, 278, 1494, 13589, 800, 322, 11994, 363, 366, 29889, 525, 13, 9651, 363, 1612, 297, 620, 3366, 5327, 3108, 29901, 13, 18884, 1962, 726, 4619, 1612, 1839, 2168, 293, 362, 7422, 2033, 718, 15300, 525, 13, 18884, 565, 525, 29881, 359, 482, 29915, 297, 1612, 322, 525, 5031, 993, 3379, 4080, 29915, 297, 1612, 1839, 29881, 359, 482, 2033, 29961, 29900, 5387, 13, 462, 1678, 1962, 726, 4619, 525, 1576, 3248, 482, 363, 445, 338, 278, 1494, 856, 525, 718, 1612, 1839, 29881, 359, 482, 2033, 29961, 29900, 22322, 5031, 993, 3379, 4080, 2033, 13, 18884, 1683, 29901, 13, 462, 1678, 1962, 726, 4619, 525, 29902, 1258, 451, 1284, 263, 3248, 482, 363, 445, 13589, 362, 29889, 525, 13, 1678, 1683, 29901, 13, 4706, 1962, 726, 353, 525, 29902, 437, 451, 505, 738, 13589, 362, 363, 366, 6169, 13, 308, 13, 1678, 736, 3802, 29898, 13, 4706, 1962, 29918, 7924, 29918, 15697, 29892, 13, 4706, 525, 29943, 352, 26940, 742, 13, 4706, 426, 13, 9651, 525, 3051, 1542, 2396, 525, 29925, 7420, 1626, 742, 13, 9651, 525, 3051, 2396, 1962, 726, 13, 4706, 500, 13, 1678, 1723, 13, 13, 13, 15945, 29908, 11474, 3159, 1237, 11474, 9995, 13, 1753, 13916, 29898, 14029, 29918, 3827, 1125, 13, 1678, 9995, 13, 1678, 3037, 839, 746, 278, 1404, 1580, 11057, 385, 7609, 363, 445, 9225, 29889, 13, 1678, 9995, 13, 1678, 17927, 29889, 8382, 313, 14029, 29918, 3827, 29897, 13, 1678, 7609, 29918, 978, 353, 7609, 29918, 3827, 1839, 3784, 10286, 16215, 978, 2033, 13, 13, 1678, 396, 3295, 5041, 304, 596, 9225, 29915, 29879, 7609, 25795, 13, 1678, 565, 7609, 29918, 978, 1275, 525, 657, 2052, 2461, 1860, 2396, 13, 4706, 736, 1284, 20154, 2052, 29873, 29898, 14029, 29918, 3827, 29897, 13, 1678, 565, 7609, 29918, 978, 1275, 525, 657, 29924, 7486, 362, 2396, 13, 4706, 736, 679, 19302, 29648, 29898, 14029, 29918, 3827, 29897, 13, 1678, 565, 7609, 29918, 978, 1275, 525, 27218, 403, 2659, 2396, 13, 4706, 736, 679, 11457, 993, 6444, 29898, 14029, 29918, 3827, 29897, 13, 1678, 12020, 8960, 877, 10286, 411, 1024, 525, 718, 7609, 29918, 978, 718, 525, 451, 6969, 1495, 13, 13, 13, 15945, 29908, 11474, 4241, 7834, 11474, 9995, 13, 1753, 14013, 29918, 13789, 29898, 3696, 29892, 3030, 1125, 13, 1678, 9995, 13, 1678, 12034, 278, 23235, 2009, 2729, 373, 7609, 29889, 13, 1678, 450, 4663, 3573, 310, 278, 2009, 338, 4944, 297, 278, 1741, 21497, 29889, 13, 1678, 9995, 13, 1678, 396, 2648, 2322, 29892, 7539, 278, 1404, 2009, 408, 6421, 515, 278, 6813, 29914, 4373, 29918, 29979, 548, 931, 10640, 29889, 13, 1678, 2897, 29889, 21813, 1839, 29911, 29999, 2033, 353, 525, 29048, 29914, 4373, 29918, 29979, 548, 29915, 13, 1678, 931, 29889, 17559, 842, 580, 13, 1678, 17927, 29889, 8382, 877, 3696, 29889, 7451, 29889, 978, 3790, 29913, 4286, 4830, 29898, 3696, 1839, 7451, 16215, 978, 25901, 13, 13, 1678, 736, 13916, 29898, 3696, 29897, 13, 2 ]
app/recipe/tests/test_tags_api.py
leo-hoet/recipe-app-api
0
52291
<gh_stars>0 from django.contrib.auth import get_user_model from django.urls import reverse from django.test import TestCase from rest_framework import status from rest_framework.test import APIClient from recipe.tests.test_recipe_api import sample_recipe, sample_tag from core.models import Tag from recipe.serializers import TagSerializer TAGS_URL = reverse('recipe:tag-list') class PubliTagsApiTests(TestCase): """Test the publicly available endpoints""" def setUp(self) -> None: self.client = APIClient() def test_login_requiered(self): """Test that login is requeired for retrieveing tags""" res = self.client.get(TAGS_URL) self.assertEqual(res.status_code, status.HTTP_401_UNAUTHORIZED) class PrivateTagsApiTests(TestCase): """User tags API tests with authentication""" def setUp(self) -> None: self.user = get_user_model().objects.create_user( email='<EMAIL>', password='<PASSWORD>', ) self.client = APIClient() self.client.force_authenticate(self.user) def test_retrieve_tags(self): """Test retrieving tags""" Tag.objects.create(user=self.user, name='Vegan') Tag.objects.create(user=self.user, name='Dessert') res = self.client.get(TAGS_URL) tags = Tag.objects.all().order_by('-name') serializer = TagSerializer(tags, many=True) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(res.data, serializer.data) def test_tag_limited_to_user(self): """Test that tags returned are for the authenticated user""" user2 = get_user_model().objects.create_user( email='<EMAIL>', password='<PASSWORD>', ) Tag.objects.create(user=user2, name='Fruity') tag = Tag.objects.create(user=self.user, name='Comfort Food') res = self.client.get(TAGS_URL) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(len(res.data), 1) self.assertEqual(res.data[0]['name'], tag.name) def test_create_tag_successful(self): """Test creating a new tag""" payload = { 'name': 'Test tag' } res = self.client.post(TAGS_URL, payload) exists = Tag.objects.filter( user=self.user, name=payload['name'] ).exists() self.assertTrue(exists) self.assertEqual(res.status_code, status.HTTP_201_CREATED) def test_create_tag_invalid(self): """Test creating an invalid tag""" payload = {'name': ''} res = self.client.post(TAGS_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) def test_get_tags_in_use_succesful(self): """Test getting al ussed tags by recipes""" tag1 = sample_tag(self.user, 'ta') tag2 = sample_tag(self.user, 'tb') tag3 = sample_tag(self.user, 'tc') recip1 = sample_recipe(self.user, title='recip1') recip1.tags.add(tag1) recip1.tags.add(tag2) recip2 = sample_recipe(self.user, title='recip2') recip2.tags.add(tag2) payload = { 'in_use': 1 } res = self.client.get(TAGS_URL, payload) serializer1 = TagSerializer(tag1) serializer2 = TagSerializer(tag2) serializer3 = TagSerializer(tag3) self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(len(res.data), 2) self.assertIn(serializer1.data, res.data) self.assertIn(serializer2.data, res.data) self.assertNotIn(serializer3.data, res.data) def test_get_tags_in_use_invalid_inuse(self): payload = { 'in_use': 'invalid' } res = self.client.get(TAGS_URL, payload) self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) def test_get_tags_in_use_invalid_key(self): payload = { 'asdasd': 0 } res = self.client.get(TAGS_URL, payload) self.assertEqual(res.status_code, status.HTTP_200_OK)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 9557, 29889, 21570, 29889, 5150, 1053, 679, 29918, 1792, 29918, 4299, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 13, 13, 3166, 1791, 29918, 4468, 1053, 4660, 13, 3166, 1791, 29918, 4468, 29889, 1688, 1053, 3450, 4032, 13, 3166, 9522, 412, 29889, 21150, 29889, 1688, 29918, 4361, 412, 29918, 2754, 1053, 4559, 29918, 4361, 412, 29892, 4559, 29918, 4039, 13, 13, 3166, 7136, 29889, 9794, 1053, 10522, 13, 13, 3166, 9522, 412, 29889, 15550, 19427, 1053, 10522, 17679, 13, 13, 13, 6040, 10749, 29918, 4219, 353, 11837, 877, 4361, 412, 29901, 4039, 29899, 1761, 1495, 13, 13, 13, 1990, 8042, 492, 28089, 11713, 24376, 29898, 3057, 8259, 1125, 13, 1678, 9995, 3057, 278, 970, 368, 3625, 1095, 9748, 15945, 29908, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 4645, 353, 3450, 4032, 580, 13, 13, 1678, 822, 1243, 29918, 7507, 29918, 276, 16026, 287, 29898, 1311, 1125, 13, 4706, 9995, 3057, 393, 6464, 338, 337, 802, 2859, 363, 10563, 292, 8282, 15945, 29908, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 657, 29898, 6040, 10749, 29918, 4219, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 29897, 13, 13, 13, 1990, 12230, 28089, 11713, 24376, 29898, 3057, 8259, 1125, 13, 1678, 9995, 2659, 8282, 3450, 6987, 411, 10760, 15945, 29908, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 1792, 353, 679, 29918, 1792, 29918, 4299, 2141, 12650, 29889, 3258, 29918, 1792, 29898, 13, 9651, 4876, 2433, 29966, 26862, 6227, 29958, 742, 13, 9651, 4800, 2433, 29966, 25711, 17013, 29958, 742, 13, 4706, 1723, 13, 4706, 1583, 29889, 4645, 353, 3450, 4032, 580, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 27218, 403, 29898, 1311, 29889, 1792, 29897, 13, 13, 1678, 822, 1243, 29918, 276, 509, 2418, 29918, 11338, 29898, 1311, 1125, 13, 4706, 9995, 3057, 5663, 15387, 8282, 15945, 29908, 13, 4706, 10522, 29889, 12650, 29889, 3258, 29898, 1792, 29922, 1311, 29889, 1792, 29892, 1024, 2433, 29963, 387, 273, 1495, 13, 4706, 10522, 29889, 12650, 29889, 3258, 29898, 1792, 29922, 1311, 29889, 1792, 29892, 1024, 2433, 29928, 404, 814, 1495, 13, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 657, 29898, 6040, 10749, 29918, 4219, 29897, 13, 13, 4706, 8282, 353, 10522, 29889, 12650, 29889, 497, 2141, 2098, 29918, 1609, 877, 29899, 978, 1495, 13, 4706, 7797, 3950, 353, 10522, 17679, 29898, 11338, 29892, 1784, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29900, 29918, 8949, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 1272, 29892, 7797, 3950, 29889, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 4039, 29918, 29044, 29918, 517, 29918, 1792, 29898, 1311, 1125, 13, 4706, 9995, 3057, 393, 8282, 4133, 526, 363, 278, 15585, 630, 1404, 15945, 29908, 13, 13, 4706, 1404, 29906, 353, 679, 29918, 1792, 29918, 4299, 2141, 12650, 29889, 3258, 29918, 1792, 29898, 13, 9651, 4876, 2433, 29966, 26862, 6227, 29958, 742, 13, 9651, 4800, 2433, 29966, 25711, 17013, 29958, 742, 13, 4706, 1723, 13, 4706, 10522, 29889, 12650, 29889, 3258, 29898, 1792, 29922, 1792, 29906, 29892, 1024, 2433, 29943, 582, 537, 1495, 13, 4706, 4055, 353, 10522, 29889, 12650, 29889, 3258, 29898, 1792, 29922, 1311, 29889, 1792, 29892, 1024, 2433, 1523, 3921, 25453, 1495, 13, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 657, 29898, 6040, 10749, 29918, 4219, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29900, 29918, 8949, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 690, 29889, 1272, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 1272, 29961, 29900, 22322, 978, 7464, 4055, 29889, 978, 29897, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 4039, 29918, 8698, 1319, 29898, 1311, 1125, 13, 4706, 9995, 3057, 4969, 263, 716, 4055, 15945, 29908, 13, 4706, 20092, 353, 426, 13, 9651, 525, 978, 2396, 525, 3057, 4055, 29915, 13, 4706, 500, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 2490, 29898, 6040, 10749, 29918, 4219, 29892, 20092, 29897, 13, 13, 4706, 4864, 353, 10522, 29889, 12650, 29889, 4572, 29898, 13, 9651, 1404, 29922, 1311, 29889, 1792, 29892, 13, 9651, 1024, 29922, 23813, 1839, 978, 2033, 13, 4706, 13742, 9933, 580, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 9933, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 29897, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 4039, 29918, 20965, 29898, 1311, 1125, 13, 4706, 9995, 3057, 4969, 385, 8340, 4055, 15945, 29908, 13, 4706, 20092, 353, 11117, 978, 2396, 6629, 29913, 13, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 2490, 29898, 6040, 10749, 29918, 4219, 29892, 20092, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 11338, 29918, 262, 29918, 1509, 29918, 2146, 617, 267, 1319, 29898, 1311, 1125, 13, 4706, 9995, 3057, 2805, 394, 502, 8485, 8282, 491, 9522, 5547, 15945, 29908, 13, 4706, 4055, 29896, 353, 4559, 29918, 4039, 29898, 1311, 29889, 1792, 29892, 525, 941, 1495, 13, 4706, 4055, 29906, 353, 4559, 29918, 4039, 29898, 1311, 29889, 1792, 29892, 525, 22625, 1495, 13, 4706, 4055, 29941, 353, 4559, 29918, 4039, 29898, 1311, 29889, 1792, 29892, 525, 14246, 1495, 13, 13, 4706, 23957, 29896, 353, 4559, 29918, 4361, 412, 29898, 1311, 29889, 1792, 29892, 3611, 2433, 4361, 29886, 29896, 1495, 13, 4706, 23957, 29896, 29889, 11338, 29889, 1202, 29898, 4039, 29896, 29897, 13, 4706, 23957, 29896, 29889, 11338, 29889, 1202, 29898, 4039, 29906, 29897, 13, 4706, 23957, 29906, 353, 4559, 29918, 4361, 412, 29898, 1311, 29889, 1792, 29892, 3611, 2433, 4361, 29886, 29906, 1495, 13, 4706, 23957, 29906, 29889, 11338, 29889, 1202, 29898, 4039, 29906, 29897, 13, 13, 4706, 20092, 353, 426, 13, 9651, 525, 262, 29918, 1509, 2396, 29871, 29896, 13, 4706, 500, 13, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 657, 29898, 6040, 10749, 29918, 4219, 29892, 20092, 29897, 13, 13, 4706, 7797, 3950, 29896, 353, 10522, 17679, 29898, 4039, 29896, 29897, 13, 4706, 7797, 3950, 29906, 353, 10522, 17679, 29898, 4039, 29906, 29897, 13, 4706, 7797, 3950, 29941, 353, 10522, 17679, 29898, 4039, 29941, 29897, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29900, 29918, 8949, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 690, 29889, 1272, 511, 29871, 29906, 29897, 13, 4706, 1583, 29889, 9294, 797, 29898, 15550, 3950, 29896, 29889, 1272, 29892, 620, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 797, 29898, 15550, 3950, 29906, 29889, 1272, 29892, 620, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 3664, 797, 29898, 15550, 3950, 29941, 29889, 1272, 29892, 620, 29889, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 11338, 29918, 262, 29918, 1509, 29918, 20965, 29918, 262, 1509, 29898, 1311, 1125, 13, 4706, 20092, 353, 426, 13, 9651, 525, 262, 29918, 1509, 2396, 525, 20965, 29915, 13, 4706, 500, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 657, 29898, 6040, 10749, 29918, 4219, 29892, 20092, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 11338, 29918, 262, 29918, 1509, 29918, 20965, 29918, 1989, 29898, 1311, 1125, 13, 4706, 20092, 353, 426, 13, 9651, 525, 294, 17370, 29881, 2396, 29871, 29900, 13, 4706, 500, 13, 4706, 620, 353, 1583, 29889, 4645, 29889, 657, 29898, 6040, 10749, 29918, 4219, 29892, 20092, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 690, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29900, 29918, 8949, 29897, 2 ]
pydis_site/apps/api/migrations/0026_use_proper_default_for_infraction_insertion_date.py
Transfusion/site
700
175151
<filename>pydis_site/apps/api/migrations/0026_use_proper_default_for_infraction_insertion_date.py<gh_stars>100-1000 # Generated by Django 2.1.5 on 2019-01-09 19:50 from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('api', '0025_allow_custom_inserted_at_infraction_field'), ] operations = [ migrations.AlterField( model_name='infraction', name='inserted_at', field=models.DateTimeField(default=django.utils.timezone.now, help_text='The date and time of the creation of this infraction.'), ), ]
[ 1, 529, 9507, 29958, 2272, 2218, 29918, 2746, 29914, 13371, 29914, 2754, 29914, 26983, 800, 29914, 29900, 29900, 29906, 29953, 29918, 1509, 29918, 771, 546, 29918, 4381, 29918, 1454, 29918, 7192, 13857, 29918, 7851, 291, 29918, 1256, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 29937, 3251, 630, 491, 15337, 29871, 29906, 29889, 29896, 29889, 29945, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29900, 29896, 29899, 29900, 29929, 29871, 29896, 29929, 29901, 29945, 29900, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 5215, 9557, 29889, 13239, 29889, 2230, 8028, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 2754, 742, 525, 29900, 29900, 29906, 29945, 29918, 9536, 29918, 6341, 29918, 7851, 287, 29918, 271, 29918, 7192, 13857, 29918, 2671, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 7192, 13857, 742, 13, 9651, 1024, 2433, 7851, 287, 29918, 271, 742, 13, 9651, 1746, 29922, 9794, 29889, 11384, 3073, 29898, 4381, 29922, 14095, 29889, 13239, 29889, 2230, 8028, 29889, 3707, 29892, 1371, 29918, 726, 2433, 1576, 2635, 322, 931, 310, 278, 11265, 310, 445, 3041, 13857, 29889, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
configs/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_NoiseRandom_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/FlowNet512_1.5AugCosyAAEGray_NoiseRandom_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_16_36WoodBlock.py
THU-DA-6D-Pose-Group/self6dpp
33
2538
<gh_stars>10-100 _base_ = "./FlowNet512_1.5AugCosyAAEGray_NoiseRandom_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_01_02MasterChefCan.py" OUTPUT_DIR = "output/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_NoiseRandom_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/16_36WoodBlock" DATASETS = dict(TRAIN=("ycbv_036_wood_block_train_pbr",))
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29918, 3188, 29918, 353, 376, 6904, 17907, 6779, 29945, 29896, 29906, 29918, 29896, 29889, 29945, 29909, 688, 29907, 359, 29891, 6344, 11787, 764, 29918, 3782, 895, 17875, 29918, 14769, 3663, 573, 29934, 29918, 29907, 3466, 25584, 29918, 11093, 29888, 29891, 29896, 29918, 29928, 7516, 29900, 29896, 29918, 3403, 29928, 29920, 29918, 13427, 29896, 29900, 29918, 29943, 5066, 29918, 29925, 1182, 29918, 29900, 29896, 29918, 29900, 29906, 19203, 26856, 29888, 6028, 29889, 2272, 29908, 13, 12015, 12336, 29918, 9464, 353, 376, 4905, 29914, 24535, 326, 29914, 29891, 10702, 29894, 29925, 1182, 6156, 29914, 17907, 6779, 29945, 29896, 29906, 29918, 29896, 29889, 29945, 29909, 688, 29907, 359, 29891, 6344, 11787, 764, 29918, 3782, 895, 17875, 29918, 14769, 3663, 573, 29934, 29918, 29907, 3466, 25584, 29918, 11093, 29888, 29891, 29896, 29918, 29928, 7516, 29900, 29896, 29918, 3403, 29928, 29920, 29918, 13427, 29896, 29900, 29918, 29943, 5066, 29918, 29891, 10702, 29894, 29925, 1182, 29918, 6156, 29914, 29896, 29953, 29918, 29941, 29953, 29956, 2092, 7445, 29908, 13, 25832, 8127, 9375, 353, 9657, 29898, 29911, 4717, 1177, 29922, 703, 29891, 10702, 29894, 29918, 29900, 29941, 29953, 29918, 6115, 29918, 1271, 29918, 14968, 29918, 29886, 1182, 613, 876, 13, 2 ]
sources/args.py
NougatCA/SPT-Code
10
129158
<reponame>NougatCA/SPT-Code import dataclasses from dataclasses import dataclass, field import os import enums @dataclass class RuntimeArguments: """Arguments for runtime.""" do_pre_train: bool = field( default=False, metadata={'action': 'store_true', 'help': 'Whether to pre-train'} ) pre_train_tasks: str = field( default=','.join(enums.PRE_TRAIN_TASKS), metadata={'help': 'Pre-training tasks in order, split by commas, ' 'for example (default) {}'.format(','.join(enums.PRE_TRAIN_TASKS))} ) do_fine_tune: bool = field( default=False, metadata={'action': 'store_true', 'help': 'Whether to fine_tune, task can be specific by `--task`'} ) only_test: bool = field( default=False, metadata={'action': 'store_true', 'help': 'Whether to test only'} ) task: str = field( default='summarization', metadata={'help': 'Downstream task', 'choices': enums.ALL_DOWNSTREAM_TASKS} ) trained_vocab: str = field( default='../pre_trained/vocabs/', metadata={'help': 'Directory of trained vocabs'} ) trained_model: str = field( default='../pre_trained/models/all/', metadata={'help': 'Directory of trained model'} ) train_from_scratch: bool = field( default=False, metadata={'action': 'store_true', 'help': 'Whether to train from scratch, will ignore `--trained_model`'} ) random_seed: int = field( default=42, metadata={'help': 'Specific random seed manually for all operations, 0 to disable'} ) n_epoch: int = field( default=50, metadata={'help': 'Number of data iterations for training'} ) batch_size: int = field( default=64, metadata={'help': 'Batch size for training on each device'} ) eval_batch_size: int = field( default=64, metadata={'help': 'Batch size for evaluation on each device'} ) beam_width: int = field( default=5, metadata={'help': 'Beam width when using beam decoding, 1 to greedy decode'} ) logging_steps: int = field( default=100, metadata={'help': 'Log training state every n steps'} ) cuda_visible_devices: str = field( default=None, metadata={'help': 'Visible cuda devices, string formatted, device number divided by \',\', e.g., \'0, 2\', ' '\'None\' will use all'} ) fp16: bool = field( default=False, metadata={'action': 'store_true', 'help': 'Whether to use mixed precision'} ) @dataclass class DatasetArguments: """Arguments for dataset loading.""" dataset_root: str = field( default='../../dataset/', metadata={'help': 'Root of the dataset'} ) train_subset_ratio: float = field( default=None, metadata={'help': 'Ratio of train subset'} ) pre_train_subset_ratio: float = field( default=None, metadata={'help': 'Ratio of pre-train subset'} ) @dataclass class SavingArguments: """Arguments for saving and loading.""" model_name: str = field( default='default_model', metadata={'help': 'Name of the model'} ) dataset_save_dir: str = field( default=os.path.join(DatasetArguments.dataset_root, 'dataset_saved'), metadata={'help': 'Directory to save and load dataset pickle instance'} ) vocab_save_dir: str = field( default=os.path.join(DatasetArguments.dataset_root, 'vocab_saved'), metadata={'help': 'Directory to save and load vocab pickle instance'} ) @dataclass class PreprocessingArguments: """Arguments for data preprocessing.""" code_vocab_size: int = field( default=50000, metadata={'help': 'Maximum size of code vocab'} ) nl_vocab_size: int = field( default=30000, metadata={'help': 'Maximum size of nl vocab'} ) code_vocab_name: str = field( default='code', metadata={'help': 'Name of the code vocab'} ) ast_vocab_name: str = field( default='ast', metadata={'help': 'Name of the ast vocab'} ) nl_vocab_name: str = field( default='nl', metadata={'help': 'Name of the nl vocab'} ) max_code_len: int = field( default=256, metadata={'help': 'Maximum length of code sequence'} ) max_ast_len: int = field( default=32, metadata={'help': 'Maximum length of ast sequence'} ) max_nl_len: int = field( default=64, metadata={'help': 'Maximum length of the nl sequence'} ) code_tokenize_method: str = field( default='bpe', metadata={'help': 'Tokenize method of code', 'choices': ['word', 'bpe']} ) nl_tokenize_method: str = field( default='bpe', metadata={'help': 'Tokenize method of nl', 'choices': ['word', 'bpe']} ) no_ast: bool = field( default=False, metadata={'action': 'store_true', 'help': 'Whether to eliminate AST from input'} ) no_nl: bool = field( default=False, metadata={'action': 'store_true', 'help': 'Whether to eliminate natural language from input'} ) @dataclass class ModelArguments: """Arguments for model related hyper-parameters""" d_model: int = field( default=768, metadata={'help': 'Dimension of the model'} ) d_ff: int = field( default=3072, metadata={'help': 'Dimension of the feed forward layer'} ) n_head: int = field( default=12, metadata={'help': 'Number of head of self attention'} ) n_layer: int = field( default=12, metadata={'help': 'Number of layer'} ) dropout: float = field( default=0.1, metadata={'help': 'Dropout probability'} ) @dataclass class OptimizerArguments: """Arguments for optimizer, early stopping, warmup, grad clipping, label smoothing.""" learning_rate: float = field( default=5e-5, metadata={'help': 'Learning rate'} ) lr_decay_rate: float = field( default=0, metadata={'help': 'Decay ratio for learning rate, 0 to disable'} ) early_stop_patience: int = field( default=20, metadata={'help': 'Stop training if performance does not improve in n epoch, 0 to disable'} ) warmup_steps: int = field( default=1000, metadata={'help': 'Warmup steps for optimizer, 0 to disable'} ) grad_clipping_norm: float = field( default=1.0, metadata={'help': 'Gradient clipping norm, 0 to disable'} ) gradient_accumulation_steps: int = field( default=1, metadata={'help': 'Gradient accumulation steps, default to 1'} ) label_smoothing: float = field( default=0.1, metadata={'help': 'Label smoothing ratio, 0 to disable'} ) @dataclass class TaskArguments: """Arguments for specific tasks""" mass_mask_ratio: float = field( default=0.5, metadata={'help': 'Ratio between number of masked tokens and number of total tokens, in MASS'} ) summarization_language: str = field( default='java', metadata={'help': 'Language of the source code in code summarization, also the directory of the dataset dir'} ) completion_max_len: int = field( default=32, metadata={'help': 'Max length of code to completion'} ) translation_source_language: str = field( default='java', metadata={'help': 'Source language of the code translation', 'choices': ['java', 'c_sharp']} ) translation_target_language: str = field( default='c_sharp', metadata={'help': 'Target language of the code translation', 'choices': ['java', 'c_sharp']} ) search_language: str = field( default='java', metadata={'help': 'Language of the source code in code search, also the directory of the dataset dir'} ) bug_fix_scale: str = field( default='small', metadata={'help': 'Scale of the bug fix dataset.', 'choices': ['small', 'medium']} ) def transfer_arg_name(name): return '--' + name.replace('_', '-') def add_args(parser): """Add all arguments to the given parser.""" for data_container in [RuntimeArguments, DatasetArguments, SavingArguments, PreprocessingArguments, ModelArguments, OptimizerArguments, TaskArguments]: group = parser.add_argument_group(data_container.__name__) for data_field in dataclasses.fields(data_container): if 'action' in data_field.metadata: group.add_argument(transfer_arg_name(data_field.name), default=data_field.default, **data_field.metadata) else: group.add_argument(transfer_arg_name(data_field.name), type=data_field.type, default=data_field.default, **data_field.metadata)
[ 1, 529, 276, 1112, 420, 29958, 29940, 692, 271, 5454, 29914, 5550, 29911, 29899, 3399, 13, 13, 5215, 848, 13203, 13, 3166, 848, 13203, 1053, 848, 1990, 29892, 1746, 13, 5215, 2897, 13, 5215, 427, 6762, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 24875, 26915, 29901, 13, 1678, 9995, 26915, 363, 10073, 1213, 15945, 13, 13, 1678, 437, 29918, 1457, 29918, 14968, 29901, 6120, 353, 1746, 29898, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 15562, 3790, 29915, 2467, 2396, 525, 8899, 29918, 3009, 742, 13, 462, 29871, 525, 8477, 2396, 525, 8809, 1979, 304, 758, 29899, 14968, 10827, 13, 1678, 1723, 13, 13, 1678, 758, 29918, 14968, 29918, 20673, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 29922, 3788, 29889, 7122, 29898, 264, 6762, 29889, 15094, 29918, 29911, 4717, 1177, 29918, 29911, 3289, 17557, 511, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 6572, 29899, 26495, 9595, 297, 1797, 29892, 6219, 491, 844, 294, 29892, 525, 13, 462, 3986, 525, 1454, 1342, 313, 4381, 29897, 6571, 4286, 4830, 29898, 3788, 29889, 7122, 29898, 264, 6762, 29889, 15094, 29918, 29911, 4717, 1177, 29918, 29911, 3289, 17557, 876, 29913, 13, 1678, 1723, 13, 13, 1678, 437, 29918, 29888, 457, 29918, 29873, 1540, 29901, 6120, 353, 1746, 29898, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 15562, 3790, 29915, 2467, 2396, 525, 8899, 29918, 3009, 742, 13, 462, 29871, 525, 8477, 2396, 525, 8809, 1979, 304, 2691, 29918, 29873, 1540, 29892, 3414, 508, 367, 2702, 491, 22974, 7662, 29952, 10827, 13, 1678, 1723, 13, 13, 1678, 871, 29918, 1688, 29901, 6120, 353, 1746, 29898, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 15562, 3790, 29915, 2467, 2396, 525, 8899, 29918, 3009, 742, 13, 462, 29871, 525, 8477, 2396, 525, 8809, 1979, 304, 1243, 871, 10827, 13, 1678, 1723, 13, 13, 1678, 3414, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 2083, 3034, 2133, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 6767, 5461, 3414, 742, 13, 462, 29871, 525, 1859, 1575, 2396, 427, 6762, 29889, 9818, 29918, 3970, 16048, 1254, 1525, 5194, 29918, 29911, 3289, 17557, 29913, 13, 1678, 1723, 13, 13, 1678, 16370, 29918, 29894, 542, 370, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 6995, 1457, 29918, 3018, 1312, 29914, 29894, 542, 6897, 29914, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 9882, 310, 16370, 7931, 6897, 10827, 13, 1678, 1723, 13, 13, 1678, 16370, 29918, 4299, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 6995, 1457, 29918, 3018, 1312, 29914, 9794, 29914, 497, 29914, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 9882, 310, 16370, 1904, 10827, 13, 1678, 1723, 13, 13, 1678, 7945, 29918, 3166, 29918, 10526, 905, 29901, 6120, 353, 1746, 29898, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 15562, 3790, 29915, 2467, 2396, 525, 8899, 29918, 3009, 742, 13, 462, 29871, 525, 8477, 2396, 525, 8809, 1979, 304, 7945, 515, 22728, 29892, 674, 11455, 22974, 3018, 1312, 29918, 4299, 29952, 10827, 13, 1678, 1723, 13, 13, 1678, 4036, 29918, 26776, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29946, 29906, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 10299, 928, 4036, 16717, 7522, 363, 599, 6931, 29892, 29871, 29900, 304, 11262, 10827, 13, 1678, 1723, 13, 13, 1678, 302, 29918, 1022, 2878, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29945, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 4557, 310, 848, 24372, 363, 6694, 10827, 13, 1678, 1723, 13, 13, 1678, 9853, 29918, 2311, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29953, 29946, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 23145, 2159, 363, 6694, 373, 1269, 4742, 10827, 13, 1678, 1723, 13, 13, 1678, 19745, 29918, 16175, 29918, 2311, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29953, 29946, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 23145, 2159, 363, 17983, 373, 1269, 4742, 10827, 13, 1678, 1723, 13, 13, 1678, 22913, 29918, 2103, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29945, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 3629, 314, 2920, 746, 773, 22913, 1602, 3689, 29892, 29871, 29896, 304, 1395, 7584, 21822, 10827, 13, 1678, 1723, 13, 13, 1678, 12183, 29918, 24530, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29896, 29900, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 3403, 6694, 2106, 1432, 302, 6576, 10827, 13, 1678, 1723, 13, 13, 1678, 274, 6191, 29918, 12872, 29918, 3359, 1575, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 29922, 8516, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 12911, 274, 6191, 9224, 29892, 1347, 20917, 29892, 4742, 1353, 13931, 491, 320, 742, 29905, 742, 321, 29889, 29887, 1696, 320, 29915, 29900, 29892, 29871, 29906, 29905, 742, 525, 13, 462, 3986, 11297, 29915, 8516, 20333, 674, 671, 599, 10827, 13, 1678, 1723, 13, 13, 1678, 285, 29886, 29896, 29953, 29901, 6120, 353, 1746, 29898, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 15562, 3790, 29915, 2467, 2396, 525, 8899, 29918, 3009, 742, 13, 462, 29871, 525, 8477, 2396, 525, 8809, 1979, 304, 671, 12849, 16716, 10827, 13, 1678, 1723, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 13373, 24541, 26915, 29901, 13, 1678, 9995, 26915, 363, 8783, 8363, 1213, 15945, 13, 13, 1678, 8783, 29918, 4632, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 21546, 24713, 29914, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 10303, 310, 278, 8783, 10827, 13, 1678, 1723, 13, 13, 1678, 7945, 29918, 6484, 29918, 3605, 601, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 8516, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 29934, 20819, 310, 7945, 11306, 10827, 13, 1678, 1723, 13, 13, 1678, 758, 29918, 14968, 29918, 6484, 29918, 3605, 601, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 8516, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 29934, 20819, 310, 758, 29899, 14968, 11306, 10827, 13, 1678, 1723, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 317, 5555, 26915, 29901, 13, 1678, 9995, 26915, 363, 14238, 322, 8363, 1213, 15945, 13, 13, 1678, 1904, 29918, 978, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 4381, 29918, 4299, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 1170, 310, 278, 1904, 10827, 13, 1678, 1723, 13, 13, 1678, 8783, 29918, 7620, 29918, 3972, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 29922, 359, 29889, 2084, 29889, 7122, 29898, 16390, 24541, 26915, 29889, 24713, 29918, 4632, 29892, 525, 24713, 29918, 17314, 5477, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 9882, 304, 4078, 322, 2254, 8783, 5839, 280, 2777, 10827, 13, 1678, 1723, 13, 13, 1678, 7931, 370, 29918, 7620, 29918, 3972, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 29922, 359, 29889, 2084, 29889, 7122, 29898, 16390, 24541, 26915, 29889, 24713, 29918, 4632, 29892, 525, 29894, 542, 370, 29918, 17314, 5477, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 9882, 304, 4078, 322, 2254, 7931, 370, 5839, 280, 2777, 10827, 13, 1678, 1723, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4721, 19170, 26915, 29901, 13, 1678, 9995, 26915, 363, 848, 758, 19170, 1213, 15945, 13, 13, 1678, 775, 29918, 29894, 542, 370, 29918, 2311, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29945, 29900, 29900, 29900, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 7976, 12539, 2159, 310, 775, 7931, 370, 10827, 13, 1678, 1723, 13, 13, 1678, 302, 29880, 29918, 29894, 542, 370, 29918, 2311, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29941, 29900, 29900, 29900, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 7976, 12539, 2159, 310, 302, 29880, 7931, 370, 10827, 13, 1678, 1723, 13, 13, 1678, 775, 29918, 29894, 542, 370, 29918, 978, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 401, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 1170, 310, 278, 775, 7931, 370, 10827, 13, 1678, 1723, 13, 13, 1678, 8717, 29918, 29894, 542, 370, 29918, 978, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 579, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 1170, 310, 278, 8717, 7931, 370, 10827, 13, 1678, 1723, 13, 13, 1678, 302, 29880, 29918, 29894, 542, 370, 29918, 978, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 12938, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 1170, 310, 278, 302, 29880, 7931, 370, 10827, 13, 1678, 1723, 13, 13, 1678, 4236, 29918, 401, 29918, 2435, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29906, 29945, 29953, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 7976, 12539, 3309, 310, 775, 5665, 10827, 13, 1678, 1723, 13, 13, 1678, 4236, 29918, 579, 29918, 2435, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29941, 29906, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 7976, 12539, 3309, 310, 8717, 5665, 10827, 13, 1678, 1723, 13, 13, 1678, 4236, 29918, 12938, 29918, 2435, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29953, 29946, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 7976, 12539, 3309, 310, 278, 302, 29880, 5665, 10827, 13, 1678, 1723, 13, 13, 1678, 775, 29918, 6979, 675, 29918, 5696, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 29890, 412, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 6066, 675, 1158, 310, 775, 742, 13, 462, 29871, 525, 1859, 1575, 2396, 6024, 1742, 742, 525, 29890, 412, 2033, 29913, 13, 1678, 1723, 13, 13, 1678, 302, 29880, 29918, 6979, 675, 29918, 5696, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 29890, 412, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 6066, 675, 1158, 310, 302, 29880, 742, 13, 462, 29871, 525, 1859, 1575, 2396, 6024, 1742, 742, 525, 29890, 412, 2033, 29913, 13, 1678, 1723, 13, 13, 1678, 694, 29918, 579, 29901, 6120, 353, 1746, 29898, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 15562, 3790, 29915, 2467, 2396, 525, 8899, 29918, 3009, 742, 13, 462, 29871, 525, 8477, 2396, 525, 8809, 1979, 304, 27399, 319, 1254, 515, 1881, 10827, 13, 1678, 1723, 13, 13, 1678, 694, 29918, 12938, 29901, 6120, 353, 1746, 29898, 13, 4706, 2322, 29922, 8824, 29892, 13, 4706, 15562, 3790, 29915, 2467, 2396, 525, 8899, 29918, 3009, 742, 13, 462, 29871, 525, 8477, 2396, 525, 8809, 1979, 304, 27399, 5613, 4086, 515, 1881, 10827, 13, 1678, 1723, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 8125, 26915, 29901, 13, 1678, 9995, 26915, 363, 1904, 4475, 11266, 29899, 16744, 15945, 29908, 13, 13, 1678, 270, 29918, 4299, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29955, 29953, 29947, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 16142, 2673, 310, 278, 1904, 10827, 13, 1678, 1723, 13, 13, 1678, 270, 29918, 600, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29941, 29900, 29955, 29906, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 16142, 2673, 310, 278, 8343, 6375, 7546, 10827, 13, 1678, 1723, 13, 13, 1678, 302, 29918, 2813, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29896, 29906, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 4557, 310, 2343, 310, 1583, 8570, 10827, 13, 1678, 1723, 13, 13, 1678, 302, 29918, 13148, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29896, 29906, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 4557, 310, 7546, 10827, 13, 1678, 1723, 13, 13, 1678, 5768, 449, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 29900, 29889, 29896, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 15063, 449, 6976, 10827, 13, 1678, 1723, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 20693, 326, 3950, 26915, 29901, 13, 1678, 9995, 26915, 363, 5994, 3950, 29892, 4688, 25480, 29892, 14294, 786, 29892, 4656, 9335, 3262, 29892, 3858, 1560, 29877, 6046, 1213, 15945, 13, 13, 1678, 6509, 29918, 10492, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 29945, 29872, 29899, 29945, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 29931, 799, 1076, 6554, 10827, 13, 1678, 1723, 13, 13, 1678, 301, 29878, 29918, 7099, 388, 29918, 10492, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 6185, 388, 11959, 363, 6509, 6554, 29892, 29871, 29900, 304, 11262, 10827, 13, 1678, 1723, 13, 13, 1678, 4688, 29918, 9847, 29918, 29886, 24701, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29906, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 16329, 6694, 565, 4180, 947, 451, 11157, 297, 302, 21502, 305, 29892, 29871, 29900, 304, 11262, 10827, 13, 1678, 1723, 13, 13, 1678, 14294, 786, 29918, 24530, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29896, 29900, 29900, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 29956, 2817, 786, 6576, 363, 5994, 3950, 29892, 29871, 29900, 304, 11262, 10827, 13, 1678, 1723, 13, 13, 1678, 4656, 29918, 11303, 3262, 29918, 12324, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 29896, 29889, 29900, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 25584, 993, 9335, 3262, 6056, 29892, 29871, 29900, 304, 11262, 10827, 13, 1678, 1723, 13, 13, 1678, 16030, 29918, 5753, 398, 2785, 29918, 24530, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29896, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 25584, 993, 18414, 2785, 6576, 29892, 2322, 304, 29871, 29896, 10827, 13, 1678, 1723, 13, 13, 1678, 3858, 29918, 3844, 29877, 6046, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 29900, 29889, 29896, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 4775, 1560, 29877, 6046, 11959, 29892, 29871, 29900, 304, 11262, 10827, 13, 1678, 1723, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 9330, 26915, 29901, 13, 1678, 9995, 26915, 363, 2702, 9595, 15945, 29908, 13, 13, 1678, 4158, 29918, 13168, 29918, 3605, 601, 29901, 5785, 353, 1746, 29898, 13, 4706, 2322, 29922, 29900, 29889, 29945, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 29934, 20819, 1546, 1353, 310, 11105, 287, 18897, 322, 1353, 310, 3001, 18897, 29892, 297, 14861, 1799, 10827, 13, 1678, 1723, 13, 13, 1678, 19138, 2133, 29918, 11675, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 1645, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 21233, 310, 278, 2752, 775, 297, 775, 19138, 2133, 29892, 884, 278, 3884, 310, 278, 8783, 4516, 10827, 13, 1678, 1723, 13, 13, 1678, 13285, 29918, 3317, 29918, 2435, 29901, 938, 353, 1746, 29898, 13, 4706, 2322, 29922, 29941, 29906, 29892, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 7976, 3309, 310, 775, 304, 13285, 10827, 13, 1678, 1723, 13, 13, 1678, 13962, 29918, 4993, 29918, 11675, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 1645, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 4435, 4086, 310, 278, 775, 13962, 742, 13, 462, 29871, 525, 1859, 1575, 2396, 6024, 1645, 742, 525, 29883, 29918, 22064, 2033, 29913, 13, 1678, 1723, 13, 13, 1678, 13962, 29918, 5182, 29918, 11675, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 29883, 29918, 22064, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 8667, 4086, 310, 278, 775, 13962, 742, 13, 462, 29871, 525, 1859, 1575, 2396, 6024, 1645, 742, 525, 29883, 29918, 22064, 2033, 29913, 13, 1678, 1723, 13, 13, 1678, 2740, 29918, 11675, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 1645, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 21233, 310, 278, 2752, 775, 297, 775, 2740, 29892, 884, 278, 3884, 310, 278, 8783, 4516, 10827, 13, 1678, 1723, 13, 13, 1678, 6494, 29918, 5878, 29918, 7052, 29901, 851, 353, 1746, 29898, 13, 4706, 2322, 2433, 9278, 742, 13, 4706, 15562, 3790, 29915, 8477, 2396, 525, 17185, 310, 278, 6494, 2329, 8783, 29889, 742, 13, 462, 29871, 525, 1859, 1575, 2396, 6024, 9278, 742, 525, 27891, 2033, 29913, 13, 1678, 1723, 13, 13, 13, 1753, 6782, 29918, 1191, 29918, 978, 29898, 978, 1125, 13, 1678, 736, 525, 489, 29915, 718, 1024, 29889, 6506, 877, 29918, 742, 17411, 1495, 13, 13, 13, 1753, 788, 29918, 5085, 29898, 16680, 1125, 13, 1678, 9995, 2528, 599, 6273, 304, 278, 2183, 13812, 1213, 15945, 13, 1678, 363, 848, 29918, 7611, 297, 518, 7944, 26915, 29892, 13373, 24541, 26915, 29892, 317, 5555, 26915, 29892, 13, 462, 965, 4721, 19170, 26915, 29892, 8125, 26915, 29892, 20693, 326, 3950, 26915, 29892, 9330, 26915, 5387, 13, 4706, 2318, 353, 13812, 29889, 1202, 29918, 23516, 29918, 2972, 29898, 1272, 29918, 7611, 17255, 978, 1649, 29897, 13, 4706, 363, 848, 29918, 2671, 297, 848, 13203, 29889, 9621, 29898, 1272, 29918, 7611, 1125, 13, 9651, 565, 525, 2467, 29915, 297, 848, 29918, 2671, 29889, 19635, 29901, 13, 18884, 2318, 29889, 1202, 29918, 23516, 29898, 3286, 571, 29918, 1191, 29918, 978, 29898, 1272, 29918, 2671, 29889, 978, 511, 13, 462, 462, 259, 2322, 29922, 1272, 29918, 2671, 29889, 4381, 29892, 13, 462, 462, 259, 3579, 1272, 29918, 2671, 29889, 19635, 29897, 13, 9651, 1683, 29901, 13, 18884, 2318, 29889, 1202, 29918, 23516, 29898, 3286, 571, 29918, 1191, 29918, 978, 29898, 1272, 29918, 2671, 29889, 978, 511, 13, 462, 462, 259, 1134, 29922, 1272, 29918, 2671, 29889, 1853, 29892, 13, 462, 462, 259, 2322, 29922, 1272, 29918, 2671, 29889, 4381, 29892, 13, 462, 462, 259, 3579, 1272, 29918, 2671, 29889, 19635, 29897, 13, 2 ]
{{cookiecutter.project_hyphen}}/{{cookiecutter.project_slug}}/__init__.py
zhangxianbing/cookiecutter-pypackage
1
9816
"""{{ cookiecutter.project_name }} - {{ cookiecutter.project_short_description }}""" __version__ = "{{ cookiecutter.project_version }}" __author__ = """{{ cookiecutter.author_name }}""" __email__ = "{{ cookiecutter.author_email }}" prog_name = "{{ cookiecutter.project_hyphen }}"
[ 1, 9995, 6224, 15327, 29883, 6463, 29889, 4836, 29918, 978, 9156, 448, 8620, 15327, 29883, 6463, 29889, 4836, 29918, 12759, 29918, 8216, 500, 5038, 15945, 13, 13, 1649, 3259, 1649, 353, 376, 6224, 15327, 29883, 6463, 29889, 4836, 29918, 3259, 500, 5038, 13, 1649, 8921, 1649, 353, 9995, 6224, 15327, 29883, 6463, 29889, 8921, 29918, 978, 500, 5038, 15945, 13, 1649, 5269, 1649, 353, 376, 6224, 15327, 29883, 6463, 29889, 8921, 29918, 5269, 500, 5038, 13, 13, 29097, 29918, 978, 353, 376, 6224, 15327, 29883, 6463, 29889, 4836, 29918, 5819, 9789, 500, 5038, 13, 2 ]
hummingbot/connector/exchange/k2/k2_in_flight_order.py
d3alek/hummingbot
0
26659
<reponame>d3alek/hummingbot<filename>hummingbot/connector/exchange/k2/k2_in_flight_order.py<gh_stars>0 import asyncio from decimal import Decimal from typing import ( Any, Dict, Optional, ) from hummingbot.connector.exchange.k2.k2_utils import convert_from_exchange_trading_pair from hummingbot.connector.in_flight_order_base import InFlightOrderBase from hummingbot.core.event.events import ( OrderType, TradeType ) class K2InFlightOrder(InFlightOrderBase): def __init__(self, client_order_id: str, exchange_order_id: Optional[str], trading_pair: str, order_type: OrderType, trade_type: TradeType, price: Decimal, amount: Decimal, creation_timestamp: int, initial_state: str = "New", ): super().__init__( client_order_id, exchange_order_id, trading_pair, order_type, trade_type, price, amount, creation_timestamp, initial_state, ) self.last_executed_amount_base = Decimal("nan") self.trade_id_set = set() self.cancelled_event = asyncio.Event() @property def is_done(self) -> bool: return self.last_state in {"Filled", "Cancelled"} @property def is_failure(self) -> bool: return self.last_state in {"No Balance"} @property def is_cancelled(self) -> bool: return self.last_state in {"Cancelled", "Expired"} def update_with_trade_update(self, trade_update: Dict[str, Any]) -> bool: """ Update the InFlightOrder with the trade update from Private/GetHistory API endpoint return: True if the order gets updated successfully otherwise False """ trade_id: str = str(trade_update["id"]) trade_order_id: str = str(trade_update["orderid"]) if trade_order_id != self.exchange_order_id or trade_id in self.trade_id_set: return False self.trade_id_set.add(trade_id) trade_price: Decimal = Decimal(str(trade_update["price"])) trade_amount: Decimal = Decimal(str(trade_update["amount"])) if trade_update["type"] == "Buy": self.executed_amount_base += trade_amount self.executed_amount_quote += trade_price * trade_amount else: self.executed_amount_quote += trade_amount self.executed_amount_base += trade_amount / trade_price self.fee_paid += Decimal(str(trade_update["fee"])) if not self.fee_asset: base, quote = convert_from_exchange_trading_pair(trade_update["symbol"]).split("-") self.fee_asset = base if trade_update["type"] == "Buy" else quote return True
[ 1, 529, 276, 1112, 420, 29958, 29881, 29941, 744, 29895, 29914, 16063, 4056, 7451, 29966, 9507, 29958, 16063, 4056, 7451, 29914, 11958, 2801, 29914, 6543, 29914, 29895, 29906, 29914, 29895, 29906, 29918, 262, 29918, 1579, 523, 29918, 2098, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 408, 948, 3934, 13, 13, 3166, 13677, 1053, 3826, 3039, 13, 3166, 19229, 1053, 313, 13, 1678, 3139, 29892, 13, 1678, 360, 919, 29892, 13, 1678, 28379, 29892, 13, 29897, 13, 13, 3166, 3165, 4056, 7451, 29889, 11958, 2801, 29889, 6543, 29889, 29895, 29906, 29889, 29895, 29906, 29918, 13239, 1053, 3588, 29918, 3166, 29918, 6543, 29918, 509, 9382, 29918, 18784, 13, 3166, 3165, 4056, 7451, 29889, 11958, 2801, 29889, 262, 29918, 1579, 523, 29918, 2098, 29918, 3188, 1053, 512, 29943, 4366, 7514, 5160, 13, 3166, 3165, 4056, 7451, 29889, 3221, 29889, 3696, 29889, 13604, 1053, 313, 13, 1678, 8170, 1542, 29892, 13, 1678, 27226, 1542, 13, 29897, 13, 13, 13, 1990, 476, 29906, 797, 29943, 4366, 7514, 29898, 797, 29943, 4366, 7514, 5160, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 3132, 29918, 2098, 29918, 333, 29901, 851, 29892, 13, 462, 14523, 29918, 2098, 29918, 333, 29901, 28379, 29961, 710, 1402, 13, 462, 3534, 292, 29918, 18784, 29901, 851, 29892, 13, 462, 1797, 29918, 1853, 29901, 8170, 1542, 29892, 13, 462, 11302, 29918, 1853, 29901, 27226, 1542, 29892, 13, 462, 8666, 29901, 3826, 3039, 29892, 13, 462, 5253, 29901, 3826, 3039, 29892, 13, 462, 11265, 29918, 16394, 29901, 938, 29892, 13, 462, 2847, 29918, 3859, 29901, 851, 353, 376, 4373, 613, 13, 462, 29871, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 3132, 29918, 2098, 29918, 333, 29892, 13, 9651, 14523, 29918, 2098, 29918, 333, 29892, 13, 9651, 3534, 292, 29918, 18784, 29892, 13, 9651, 1797, 29918, 1853, 29892, 13, 9651, 11302, 29918, 1853, 29892, 13, 9651, 8666, 29892, 13, 9651, 5253, 29892, 13, 9651, 11265, 29918, 16394, 29892, 13, 9651, 2847, 29918, 3859, 29892, 13, 4706, 1723, 13, 4706, 1583, 29889, 4230, 29918, 4258, 3860, 29918, 14506, 29918, 3188, 353, 3826, 3039, 703, 13707, 1159, 13, 4706, 1583, 29889, 3018, 311, 29918, 333, 29918, 842, 353, 731, 580, 13, 4706, 1583, 29889, 20713, 839, 29918, 3696, 353, 408, 948, 3934, 29889, 2624, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 15091, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 736, 1583, 29889, 4230, 29918, 3859, 297, 8853, 3434, 839, 613, 376, 19420, 839, 9092, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 14057, 545, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 736, 1583, 29889, 4230, 29918, 3859, 297, 8853, 3782, 7392, 749, 9092, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 20713, 839, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 736, 1583, 29889, 4230, 29918, 3859, 297, 8853, 19420, 839, 613, 376, 9544, 2859, 9092, 13, 13, 1678, 822, 2767, 29918, 2541, 29918, 3018, 311, 29918, 5504, 29898, 1311, 29892, 11302, 29918, 5504, 29901, 360, 919, 29961, 710, 29892, 3139, 2314, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 10318, 278, 512, 29943, 4366, 7514, 411, 278, 11302, 2767, 515, 12230, 29914, 2577, 20570, 3450, 16248, 13, 4706, 736, 29901, 5852, 565, 278, 1797, 4947, 4784, 8472, 6467, 7700, 13, 4706, 9995, 13, 4706, 11302, 29918, 333, 29901, 851, 353, 851, 29898, 3018, 311, 29918, 5504, 3366, 333, 20068, 13, 4706, 11302, 29918, 2098, 29918, 333, 29901, 851, 353, 851, 29898, 3018, 311, 29918, 5504, 3366, 2098, 333, 20068, 13, 13, 4706, 565, 11302, 29918, 2098, 29918, 333, 2804, 1583, 29889, 6543, 29918, 2098, 29918, 333, 470, 11302, 29918, 333, 297, 1583, 29889, 3018, 311, 29918, 333, 29918, 842, 29901, 13, 9651, 736, 7700, 13, 13, 4706, 1583, 29889, 3018, 311, 29918, 333, 29918, 842, 29889, 1202, 29898, 3018, 311, 29918, 333, 29897, 13, 13, 4706, 11302, 29918, 9175, 29901, 3826, 3039, 353, 3826, 3039, 29898, 710, 29898, 3018, 311, 29918, 5504, 3366, 9175, 3108, 876, 13, 4706, 11302, 29918, 14506, 29901, 3826, 3039, 353, 3826, 3039, 29898, 710, 29898, 3018, 311, 29918, 5504, 3366, 14506, 3108, 876, 13, 13, 4706, 565, 11302, 29918, 5504, 3366, 1853, 3108, 1275, 376, 3727, 29891, 1115, 13, 9651, 1583, 29889, 4258, 3860, 29918, 14506, 29918, 3188, 4619, 11302, 29918, 14506, 13, 9651, 1583, 29889, 4258, 3860, 29918, 14506, 29918, 1396, 4619, 11302, 29918, 9175, 334, 11302, 29918, 14506, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 4258, 3860, 29918, 14506, 29918, 1396, 4619, 11302, 29918, 14506, 13, 9651, 1583, 29889, 4258, 3860, 29918, 14506, 29918, 3188, 4619, 11302, 29918, 14506, 847, 11302, 29918, 9175, 13, 13, 4706, 1583, 29889, 1725, 29872, 29918, 3274, 333, 4619, 3826, 3039, 29898, 710, 29898, 3018, 311, 29918, 5504, 3366, 1725, 29872, 3108, 876, 13, 13, 4706, 565, 451, 1583, 29889, 1725, 29872, 29918, 24129, 29901, 13, 9651, 2967, 29892, 14978, 353, 3588, 29918, 3166, 29918, 6543, 29918, 509, 9382, 29918, 18784, 29898, 3018, 311, 29918, 5504, 3366, 18098, 3108, 467, 5451, 703, 29899, 1159, 13, 9651, 1583, 29889, 1725, 29872, 29918, 24129, 353, 2967, 565, 11302, 29918, 5504, 3366, 1853, 3108, 1275, 376, 3727, 29891, 29908, 1683, 14978, 13, 13, 4706, 736, 5852, 13, 2 ]
api.py
mr-mixas/Nested-Diff-RESTful
0
39193
<filename>api.py # -*- coding: utf-8 -*- # # Copyright 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. from flask import Flask, Response, jsonify, render_template, request from nested_diff import Differ, Patcher from nested_diff.fmt import HtmlFormatter, TextFormatter, TermFormatter app = Flask(__name__) def format_diff_response(fmt, diff, opts): mimetype = 'text/plain' if fmt == 'text': formatter = TextFormatter elif fmt == 'term': formatter = TermFormatter elif fmt == 'html': formatter = HtmlFormatter else: return Response('Unsupported format ' + fmt, status=400) return Response( formatter(**opts).format(diff), status=200, mimetype=mimetype, ) @app.route('/') def index(): # this page is almost never reloaded, so it is OK to embed css in it return render_template('index.html', html_fmt_css=HtmlFormatter.get_css()) @app.route('/ping') def health_check(): return Response('pong', status=200) @app.route('/api/v1/diff', methods=['POST']) def diff(): try: diff_opts = request.json.get('diff_opts', {'U': False}) except AttributeError: return Response('Object expected', status=400) try: diff = Differ(**diff_opts).diff( request.json.get('a', None), request.json.get('b', None), ) except Exception: return Response('Incorrect options', status=400) ofmt = request.json.get('ofmt', 'json') if ofmt == 'json': return jsonify(diff) ofmt_opts = request.json.get('ofmt_opts', {}) return format_diff_response(ofmt, diff, ofmt_opts) @app.route('/api/v1/format', methods=['POST']) def format(): try: diff = request.json.get('diff', {}) ofmt = request.json.get('ofmt', None) if ofmt is None: return jsonify(diff) ofmt_opts = request.json.get('ofmt_opts', {}) return format_diff_response(ofmt, diff, ofmt_opts) except Exception: return Response('Incorrect arguments', status=400) @app.route('/api/v1/patch', methods=['POST']) def patch(): try: return jsonify(Patcher().patch( request.json['target'], request.json['patch'], )) except Exception: return Response('Incorrect arguments', status=400) if __name__ == '__main__': app.run(host='0.0.0.0', port=8080, debug=True)
[ 1, 529, 9507, 29958, 2754, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 529, 5813, 29958, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 3166, 29784, 1053, 2379, 1278, 29892, 13291, 29892, 4390, 1598, 29892, 4050, 29918, 6886, 29892, 2009, 13, 13, 3166, 9322, 29918, 12765, 1053, 360, 8349, 29892, 349, 905, 261, 13, 3166, 9322, 29918, 12765, 29889, 23479, 1053, 24726, 18522, 29892, 3992, 18522, 29892, 11814, 18522, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 3402, 29918, 12765, 29918, 5327, 29898, 23479, 29892, 2923, 29892, 29111, 1125, 13, 1678, 286, 17528, 668, 353, 525, 726, 29914, 24595, 29915, 13, 13, 1678, 565, 19200, 1275, 525, 726, 2396, 13, 4706, 883, 2620, 353, 3992, 18522, 13, 1678, 25342, 19200, 1275, 525, 8489, 2396, 13, 4706, 883, 2620, 353, 11814, 18522, 13, 1678, 25342, 19200, 1275, 525, 1420, 2396, 13, 4706, 883, 2620, 353, 24726, 18522, 13, 1678, 1683, 29901, 13, 4706, 736, 13291, 877, 25807, 29884, 3016, 287, 3402, 525, 718, 19200, 29892, 4660, 29922, 29946, 29900, 29900, 29897, 13, 13, 1678, 736, 13291, 29898, 13, 4706, 883, 2620, 29898, 1068, 25707, 467, 4830, 29898, 12765, 511, 13, 4706, 4660, 29922, 29906, 29900, 29900, 29892, 13, 4706, 286, 17528, 668, 29922, 29885, 17528, 668, 29892, 13, 1678, 1723, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 1495, 13, 1753, 2380, 7295, 13, 1678, 396, 445, 1813, 338, 4359, 2360, 337, 15638, 29892, 577, 372, 338, 9280, 304, 8297, 5997, 297, 372, 13, 1678, 736, 4050, 29918, 6886, 877, 2248, 29889, 1420, 742, 3472, 29918, 23479, 29918, 4268, 29922, 10922, 18522, 29889, 657, 29918, 4268, 3101, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 15702, 1495, 13, 1753, 9045, 29918, 3198, 7295, 13, 1678, 736, 13291, 877, 29886, 549, 742, 4660, 29922, 29906, 29900, 29900, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 2754, 29914, 29894, 29896, 29914, 12765, 742, 3519, 29922, 1839, 5438, 11287, 13, 1753, 2923, 7295, 13, 1678, 1018, 29901, 13, 4706, 2923, 29918, 25707, 353, 2009, 29889, 3126, 29889, 657, 877, 12765, 29918, 25707, 742, 11117, 29965, 2396, 7700, 1800, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 736, 13291, 877, 2061, 3806, 742, 4660, 29922, 29946, 29900, 29900, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 2923, 353, 360, 8349, 29898, 1068, 12765, 29918, 25707, 467, 12765, 29898, 13, 9651, 2009, 29889, 3126, 29889, 657, 877, 29874, 742, 6213, 511, 13, 9651, 2009, 29889, 3126, 29889, 657, 877, 29890, 742, 6213, 511, 13, 4706, 1723, 13, 1678, 5174, 8960, 29901, 13, 4706, 736, 13291, 877, 797, 15728, 3987, 742, 4660, 29922, 29946, 29900, 29900, 29897, 13, 13, 1678, 310, 4378, 353, 2009, 29889, 3126, 29889, 657, 877, 974, 4378, 742, 525, 3126, 1495, 13, 1678, 565, 310, 4378, 1275, 525, 3126, 2396, 13, 4706, 736, 4390, 1598, 29898, 12765, 29897, 13, 13, 1678, 310, 4378, 29918, 25707, 353, 2009, 29889, 3126, 29889, 657, 877, 974, 4378, 29918, 25707, 742, 426, 1800, 13, 13, 1678, 736, 3402, 29918, 12765, 29918, 5327, 29898, 974, 4378, 29892, 2923, 29892, 310, 4378, 29918, 25707, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 2754, 29914, 29894, 29896, 29914, 4830, 742, 3519, 29922, 1839, 5438, 11287, 13, 1753, 3402, 7295, 13, 1678, 1018, 29901, 13, 4706, 2923, 353, 2009, 29889, 3126, 29889, 657, 877, 12765, 742, 426, 1800, 13, 4706, 310, 4378, 353, 2009, 29889, 3126, 29889, 657, 877, 974, 4378, 742, 6213, 29897, 13, 4706, 565, 310, 4378, 338, 6213, 29901, 13, 9651, 736, 4390, 1598, 29898, 12765, 29897, 13, 13, 4706, 310, 4378, 29918, 25707, 353, 2009, 29889, 3126, 29889, 657, 877, 974, 4378, 29918, 25707, 742, 426, 1800, 13, 13, 4706, 736, 3402, 29918, 12765, 29918, 5327, 29898, 974, 4378, 29892, 2923, 29892, 310, 4378, 29918, 25707, 29897, 13, 1678, 5174, 8960, 29901, 13, 4706, 736, 13291, 877, 797, 15728, 6273, 742, 4660, 29922, 29946, 29900, 29900, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 2754, 29914, 29894, 29896, 29914, 5041, 742, 3519, 29922, 1839, 5438, 11287, 13, 1753, 13261, 7295, 13, 1678, 1018, 29901, 13, 4706, 736, 4390, 1598, 29898, 29925, 905, 261, 2141, 5041, 29898, 13, 9651, 2009, 29889, 3126, 1839, 5182, 7464, 13, 9651, 2009, 29889, 3126, 1839, 5041, 7464, 13, 308, 876, 13, 1678, 5174, 8960, 29901, 13, 4706, 736, 13291, 877, 797, 15728, 6273, 742, 4660, 29922, 29946, 29900, 29900, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 623, 29889, 3389, 29898, 3069, 2433, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 742, 2011, 29922, 29947, 29900, 29947, 29900, 29892, 4744, 29922, 5574, 29897, 13, 2 ]
experiments/messaging/pyuv/pyuv_server.py
chartbeat-labs/wade
16
74009
<reponame>chartbeat-labs/wade<gh_stars>10-100 import time import signal import pyuv import msgpack count = 0 st_time = 0 packer = msgpack.Packer() unpacker = msgpack.Unpacker() def on_read(client, data, error): if data is None: client.close() clients.remove(client) return unpacker.feed(data) try: msg = unpacker.unpack() except msgpack.OutOfData: return client.write(packer.pack(123)) global count global st_time if count % 10000 == 0: right_now = time.time() print count / (right_now - st_time) st_time = right_now count = 0 count += 1 def on_connection(server, error): client = pyuv.TCP(server.loop) server.accept(client) clients.append(client) client.start_read(on_read) def signal_cb(handle, signum): [c.close() for c in clients] signal_h.close() server.close() print("PyUV version %s" % pyuv.__version__) loop = pyuv.Loop.default_loop() clients = [] server = pyuv.TCP(loop) server.bind(("0.0.0.0", 12345)) server.listen(on_connection) signal_h = pyuv.Signal(loop) signal_h.start(signal_cb, signal.SIGINT) loop.run() print("Stopped!")
[ 1, 529, 276, 1112, 420, 29958, 15425, 915, 271, 29899, 29880, 6897, 29914, 29893, 1943, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 13, 5215, 931, 13, 13, 5215, 7182, 13, 5215, 11451, 4090, 13, 5215, 10191, 4058, 13, 13, 13, 2798, 353, 29871, 29900, 13, 303, 29918, 2230, 353, 29871, 29900, 13, 13, 4058, 261, 353, 10191, 4058, 29889, 16638, 261, 580, 13, 348, 4058, 261, 353, 10191, 4058, 29889, 2525, 4058, 261, 580, 13, 13, 13, 1753, 373, 29918, 949, 29898, 4645, 29892, 848, 29892, 1059, 1125, 13, 1678, 565, 848, 338, 6213, 29901, 13, 4706, 3132, 29889, 5358, 580, 13, 4706, 13154, 29889, 5992, 29898, 4645, 29897, 13, 4706, 736, 13, 13, 1678, 443, 4058, 261, 29889, 18798, 29898, 1272, 29897, 13, 1678, 1018, 29901, 13, 4706, 10191, 353, 443, 4058, 261, 29889, 348, 4058, 580, 13, 1678, 5174, 10191, 4058, 29889, 3744, 2776, 1469, 29901, 13, 4706, 736, 13, 13, 1678, 3132, 29889, 3539, 29898, 4058, 261, 29889, 4058, 29898, 29896, 29906, 29941, 876, 13, 13, 1678, 5534, 2302, 13, 1678, 5534, 380, 29918, 2230, 13, 13, 1678, 565, 2302, 1273, 29871, 29896, 29900, 29900, 29900, 29900, 1275, 29871, 29900, 29901, 13, 4706, 1492, 29918, 3707, 353, 931, 29889, 2230, 580, 13, 4706, 1596, 2302, 847, 313, 1266, 29918, 3707, 448, 380, 29918, 2230, 29897, 13, 4706, 380, 29918, 2230, 353, 1492, 29918, 3707, 13, 4706, 2302, 353, 29871, 29900, 13, 13, 1678, 2302, 4619, 29871, 29896, 13, 13, 1753, 373, 29918, 9965, 29898, 2974, 29892, 1059, 1125, 13, 1678, 3132, 353, 11451, 4090, 29889, 29911, 6271, 29898, 2974, 29889, 7888, 29897, 13, 1678, 1923, 29889, 16044, 29898, 4645, 29897, 13, 1678, 13154, 29889, 4397, 29898, 4645, 29897, 13, 1678, 3132, 29889, 2962, 29918, 949, 29898, 265, 29918, 949, 29897, 13, 13, 1753, 7182, 29918, 10702, 29898, 8411, 29892, 1804, 398, 1125, 13, 1678, 518, 29883, 29889, 5358, 580, 363, 274, 297, 13154, 29962, 13, 1678, 7182, 29918, 29882, 29889, 5358, 580, 13, 1678, 1923, 29889, 5358, 580, 13, 13, 13, 2158, 703, 19737, 29965, 29963, 1873, 1273, 29879, 29908, 1273, 11451, 4090, 17255, 3259, 1649, 29897, 13, 13, 7888, 353, 11451, 4090, 29889, 18405, 29889, 4381, 29918, 7888, 580, 13, 11303, 1237, 353, 5159, 13, 13, 2974, 353, 11451, 4090, 29889, 29911, 6271, 29898, 7888, 29897, 13, 2974, 29889, 5355, 29898, 703, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 613, 29871, 29896, 29906, 29941, 29946, 29945, 876, 13, 2974, 29889, 20631, 29898, 265, 29918, 9965, 29897, 13, 13, 25436, 29918, 29882, 353, 11451, 4090, 29889, 10140, 284, 29898, 7888, 29897, 13, 25436, 29918, 29882, 29889, 2962, 29898, 25436, 29918, 10702, 29892, 7182, 29889, 5425, 29954, 10192, 29897, 13, 13, 7888, 29889, 3389, 580, 13, 2158, 703, 20754, 2986, 29991, 1159, 13, 2 ]
scripts/benchmarking/parallel_benchmark.py
BerkeleyAutomation/pyhull
69
187898
<reponame>BerkeleyAutomation/pyhull #!/usr/bin/env python """ TODO: Change the module doc. """ from __future__ import division __author__ = "<NAME>" __version__ = "0.1" __maintainer__ = "<NAME>" __email__ = "<EMAIL>" __status__ = "Beta" __date__ = "11/19/12" from multiprocessing import Pool import numpy as np from pyhull.convex_hull import ConvexHull num_proc = 100 def get_vertices(data): return ConvexHull(data).vertices def serial_test(data): d = [] for i in xrange(num_proc): d.append(get_vertices(data)) return d def parallel_test(data): p = Pool(4) all_data = p.map(get_vertices, [data] * num_proc) assert all([all_data[i] == all_data[0] for i in xrange(num_proc)]) if __name__ == "__main__": import timeit global data for npts in [100, 1000, 10000]: for dim in [3, 4, 5]: data = np.random.randn(npts,dim) t = timeit.timeit("serial_test(data)", setup="from __main__ import serial_test, data", number=1) print ("Serial: {} {} {:.5f}".format(npts, dim, t)) t = timeit.timeit("parallel_test(data)", setup="from __main__ import parallel_test, data", number=1) print ("Parallel: {} {} {:.5f}".format(npts, dim, t))
[ 1, 529, 276, 1112, 420, 29958, 17104, 27279, 28451, 362, 29914, 2272, 29882, 913, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 15945, 29908, 13, 4986, 3970, 29901, 10726, 278, 3883, 1574, 29889, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 13, 1649, 8921, 1649, 353, 9872, 5813, 11903, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29896, 29908, 13, 1649, 29885, 2365, 4008, 1649, 353, 9872, 5813, 11903, 13, 1649, 5269, 1649, 353, 9872, 26862, 6227, 11903, 13, 1649, 4882, 1649, 353, 376, 29933, 1187, 29908, 13, 1649, 1256, 1649, 353, 376, 29896, 29896, 29914, 29896, 29929, 29914, 29896, 29906, 29908, 13, 13, 3166, 6674, 307, 985, 292, 1053, 28625, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 11451, 29882, 913, 29889, 535, 13809, 29918, 29882, 913, 1053, 1281, 13809, 29950, 913, 13, 13, 1949, 29918, 15439, 353, 29871, 29896, 29900, 29900, 13, 13, 1753, 679, 29918, 1765, 1575, 29898, 1272, 1125, 13, 1678, 736, 1281, 13809, 29950, 913, 29898, 1272, 467, 1765, 1575, 13, 13, 1753, 7797, 29918, 1688, 29898, 1272, 1125, 13, 1678, 270, 353, 5159, 13, 1678, 363, 474, 297, 921, 3881, 29898, 1949, 29918, 15439, 1125, 13, 4706, 270, 29889, 4397, 29898, 657, 29918, 1765, 1575, 29898, 1272, 876, 13, 1678, 736, 270, 13, 13, 1753, 8943, 29918, 1688, 29898, 1272, 1125, 13, 1678, 282, 353, 28625, 29898, 29946, 29897, 13, 1678, 599, 29918, 1272, 353, 282, 29889, 1958, 29898, 657, 29918, 1765, 1575, 29892, 518, 1272, 29962, 334, 954, 29918, 15439, 29897, 13, 1678, 4974, 599, 4197, 497, 29918, 1272, 29961, 29875, 29962, 1275, 599, 29918, 1272, 29961, 29900, 29962, 363, 474, 297, 921, 3881, 29898, 1949, 29918, 15439, 29897, 2314, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 931, 277, 13, 1678, 5534, 848, 13, 1678, 363, 302, 16485, 297, 518, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29900, 29900, 5387, 13, 4706, 363, 3964, 297, 518, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 5387, 13, 9651, 848, 353, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 29876, 16485, 29892, 6229, 29897, 13, 9651, 260, 353, 931, 277, 29889, 2230, 277, 703, 15550, 29918, 1688, 29898, 1272, 19123, 13, 462, 795, 6230, 543, 3166, 4770, 3396, 1649, 1053, 7797, 29918, 1688, 29892, 848, 613, 13, 462, 795, 1353, 29922, 29896, 29897, 13, 9651, 1596, 4852, 9125, 29901, 259, 6571, 6571, 12365, 29889, 29945, 29888, 29913, 1642, 4830, 29898, 29876, 16485, 29892, 3964, 29892, 260, 876, 13, 9651, 260, 353, 931, 277, 29889, 2230, 277, 703, 23482, 29918, 1688, 29898, 1272, 19123, 13, 462, 795, 6230, 543, 3166, 4770, 3396, 1649, 1053, 8943, 29918, 1688, 29892, 848, 613, 13, 462, 795, 1353, 29922, 29896, 29897, 13, 9651, 1596, 4852, 2177, 6553, 29901, 6571, 6571, 12365, 29889, 29945, 29888, 29913, 1642, 4830, 29898, 29876, 16485, 29892, 3964, 29892, 260, 876, 13, 2 ]
addons14/project_timeline/tests/__init__.py
odoochain/addons_oca
1
166723
from . import test_project_timeline
[ 1, 515, 869, 1053, 1243, 29918, 4836, 29918, 9346, 5570, 13, 2 ]
computational-linguistics/LSTM-POS-tagger/main.py
sangeet2020/ws-20-21
0
89208
<reponame>sangeet2020/ws-20-21 #!/usr/bin/python3 # -*- coding: utf-8 -*- # @Author: <NAME> # @Date: 2021-03-08 18:19:28 # @Email: <EMAIL> # @Organization: Universität des Saarlandes # @Last Modified time: 2021-03-15 23:28:47 """ LSTM based POS tagger """ import os import io import sys import pdb import nltk import zipfile import argparse import numpy as np import pandas as pd import time import urllib.request from nltk import corpus import matplotlib.pyplot as plt from gensim.models import KeyedVectors from keras.preprocessing.text import Tokenizer import seaborn; seaborn.set() # plot formatting from keras.utils.np_utils import to_categorical from sklearn.model_selection import train_test_split from tensorflow import keras from keras.preprocessing.sequence import pad_sequences from keras.models import Sequential from keras.layers import Embedding from keras.layers import Dense, Input from keras.layers import TimeDistributed from keras.layers import LSTM, Bidirectional from keras.models import Model from sklearn.metrics import classification_report MAX_SEQ_LEN = 100 EMBEDDING_SIZE = 300 class Vectorizer(object): def __init__(self, sentences, pos_tags, word2vec): self.sentences = sentences self.pos_tags = pos_tags self.word2vec = word2vec def vectorize(self): # Vectorize X and Y self.t_words = Tokenizer() self.t_words.fit_on_texts(self.sentences) X = self.t_words.texts_to_sequences(self.sentences) self.t_tags = Tokenizer() self.t_tags.fit_on_texts(self.pos_tags) y = self.t_tags.texts_to_sequences(self.pos_tags) # Padding and truncation to make all sequences of uniform length self.X = pad_sequences(X, maxlen=MAX_SEQ_LEN, truncating='post') self.y = pad_sequences(y, maxlen=MAX_SEQ_LEN, truncating='post') self.embedding_weights = self.prep_embeddings() self.target_labs = [*self.t_tags.word_index] return self.X, self.y, self.target_labs, self.embedding_weights def prep_embeddings(self): Vectorizer.prep_embeddings.VOCABULARY_SIZE = len(self.t_words.word_index) + 1 self.embedding_weights = np.zeros((Vectorizer.prep_embeddings.VOCABULARY_SIZE, EMBEDDING_SIZE)) word2id = self.t_words.word_index for word, index in word2id.items(): try: self.embedding_weights[index, :] = self.word2vec[word] except KeyError: pass self._encodings() return self.embedding_weights def _encodings(self): # one-hot encoding self.y = to_categorical(self.y) class LSTM_model(object): def __init__(self, X, y, target_labs, embedding_weights, BiLSTM=False): self.X = X self.y = y self.target_labs = target_labs self.embedding_weights = embedding_weights self.BiLSTM = BiLSTM def train_test_split(self): self.X_train, self.X_test, self.Y_train, self.Y_test = train_test_split(self.X, self.y, test_size=0.2, random_state=123) self.X_train, self.X_validation, self.Y_train, self.Y_validation = train_test_split(self.X_train, self.Y_train, test_size=0.2, random_state=123) def model_init(self, args): self.lstm_model = Sequential() self.target_labs = self.y.shape[2] VOCABULARY_SIZE = Vectorizer.prep_embeddings.VOCABULARY_SIZE self.lstm_model.add(Embedding( input_dim = VOCABULARY_SIZE, output_dim = EMBEDDING_SIZE, input_length = MAX_SEQ_LEN, weights = [self.embedding_weights], trainable = False )) if self.BiLSTM: print('-'*20,"Model architecture: Bi-LSTM",'-'*20) self.lstm_model.add(Bidirectional(LSTM(64, return_sequences=True))) else: print('-'*20,"Model architecture: LSTM",'-'*20) self.lstm_model.add(LSTM(64, return_sequences=True)) self.lstm_model.add(TimeDistributed(Dense(self.target_labs, activation='softmax'))) path = args.out_dir + "/model_arch.png" keras.utils.plot_model(self.lstm_model, path, show_shapes=True) def train(self, args): self.train_test_split() self.model_init(args) self.lstm_model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['acc']) print(self.lstm_model.summary()) self.lstm_training = self.lstm_model.fit(self.X_train, self.Y_train, batch_size=128, epochs=10, validation_data=(self.X_validation, self.Y_validation)) self.training_report(args) loss, accuracy = self.lstm_model.evaluate(self.X_test, self.Y_test, verbose = 1) print("Loss: {:.2f} %,\nAccuracy: {:.2f} %".format(loss*100, accuracy*100)) if self.BiLSTM: self.lstm_model.save(args.out_dir + '/model_Bi-LSTM.h5') else: self.lstm_model.save(args.out_dir + '/model_LSTM.h5') def training_report(self, args): # summarize history for accuracy plt.plot(self.lstm_training.history['acc']) plt.plot(self.lstm_training.history['val_acc']) plt.title('model accuracy') plt.ylabel('accuracy') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') if self.BiLSTM: plt.savefig(args.out_dir + '/accuray_plot_Bi-LSTM.eps', format='eps') else: plt.savefig(args.out_dir + '/accuray_plot_LSTM.eps', format='eps') # summarize history for loss plt.plot(self.lstm_training.history['acc']) plt.plot(self.lstm_training.history['val_loss']) plt.title('model loss') plt.ylabel('loss') plt.xlabel('epoch') plt.legend(['train', 'test'], loc='upper left') if self.BiLSTM: plt.savefig(args.out_dir + '/loss_plot_Bi-LSTM.eps', format='eps') else: plt.savefig(args.out_dir + '/loss_plot_LSTM.eps', format='eps') def download_data(args): """ purpose of my function """ # Download dataset nltk.download('treebank') nltk.download('brown') nltk.download('conll2000') nltk.download('universal_tagset') # Download pre-trained embeddings. 1M words with subword info if args.subword_info: print("Using Subword info") url = 'https://dl.fbaipublicfiles.com/fasttext/vectors-english/wiki-news-300d-1M-subword.vec.zip' else: print("Not using Subword info") url = 'https://dl.fbaipublicfiles.com/fasttext/vectors-english/wiki-news-300d-1M.vec.zip' fname = url.split('/')[-1] if not os.path.exists(fname): print("Downloading embeddings...") command = str("! wget -nc ") + url print(command) os.system(command) with zipfile.ZipFile(fname, 'r') as zip_ref: zip_ref.extractall('.') else: print("Pre-trained embeddings already present; not retrieving.") return KeyedVectors.load_word2vec_format(fname.strip('.zip')) def data_preparation(): treebank_corpus = corpus.treebank.tagged_sents(tagset='universal') brown_corpus = corpus.brown.tagged_sents(tagset='universal') conll_corpus = corpus.conll2000.tagged_sents(tagset='universal') return treebank_corpus + brown_corpus + conll_corpus def data_loader(tagged_sentences): sentences = [] pos_tags = [] for item in tagged_sentences: sentences.append([token[0] for token in item]) pos_tags.append([token[1] for token in item]) return sentences, pos_tags def main(): """ main method """ args = parse_arguments() start = time.time() os.makedirs(args.out_dir, exist_ok=True) word2vec = download_data(args) tagged_sentences = data_preparation() sentences, pos_tags = data_loader(tagged_sentences) vectorizer = Vectorizer(sentences, pos_tags, word2vec) X, y, target_labs, embedding_weights = vectorizer.vectorize() if args.model_choice=="BiLSTM": LSTM_model(X, y, target_labs, embedding_weights,BiLSTM=True).train(args) elif args.model_choice=="LSTM": LSTM_model(X, y, target_labs, embedding_weights,BiLSTM=False).train(args) else: print("Specified model architecture not understood. Try again!") end = time.time() print("Total runtime: %.3f s" % (end-start)) def parse_arguments(): """ parse arguments """ parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("out_dir", help="path to save the plots and results") parser.add_argument("model_choice",default=None,choices=['LSTM','BiLSTM'], type=str,help='Choice of training architecture') parser.add_argument("-subword_info", default=None, type=bool, help='use pre-embeddings with subword information') args = parser.parse_args() return args if __name__ == "__main__": main()
[ 1, 529, 276, 1112, 420, 29958, 29879, 927, 300, 29906, 29900, 29906, 29900, 29914, 5652, 29899, 29906, 29900, 29899, 29906, 29896, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 732, 13720, 29901, 529, 5813, 29958, 13, 29937, 732, 2539, 29901, 1678, 29906, 29900, 29906, 29896, 29899, 29900, 29941, 29899, 29900, 29947, 29871, 29896, 29947, 29901, 29896, 29929, 29901, 29906, 29947, 13, 29937, 732, 9823, 29901, 29871, 529, 26862, 6227, 29958, 13, 29937, 732, 27356, 2133, 29901, 12855, 553, 317, 4025, 1049, 267, 13, 29937, 732, 8897, 3382, 2164, 931, 29901, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29941, 29899, 29896, 29945, 29871, 29906, 29941, 29901, 29906, 29947, 29901, 29946, 29955, 13, 13, 13, 13, 13, 15945, 29908, 13, 29931, 1254, 29924, 2729, 349, 3267, 4055, 914, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 5215, 12013, 13, 5215, 10876, 13, 5215, 282, 2585, 13, 5215, 302, 1896, 29895, 13, 5215, 14319, 1445, 13, 5215, 1852, 5510, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 931, 13, 5215, 3142, 1982, 29889, 3827, 13, 3166, 302, 1896, 29895, 1053, 1034, 13364, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 26943, 326, 29889, 9794, 1053, 7670, 287, 29963, 11142, 13, 3166, 13023, 294, 29889, 1457, 19170, 29889, 726, 1053, 25159, 3950, 13, 5215, 409, 370, 1398, 29936, 409, 370, 1398, 29889, 842, 580, 396, 6492, 15998, 13, 3166, 13023, 294, 29889, 13239, 29889, 9302, 29918, 13239, 1053, 304, 29918, 29883, 20440, 936, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 3166, 26110, 1053, 13023, 294, 13, 3166, 13023, 294, 29889, 1457, 19170, 29889, 16506, 1053, 17132, 29918, 6831, 2063, 13, 3166, 13023, 294, 29889, 9794, 1053, 922, 339, 2556, 13, 3166, 13023, 294, 29889, 29277, 1053, 2812, 2580, 8497, 13, 3166, 13023, 294, 29889, 29277, 1053, 360, 1947, 29892, 10567, 13, 3166, 13023, 294, 29889, 29277, 1053, 5974, 13398, 7541, 13, 3166, 13023, 294, 29889, 29277, 1053, 365, 1254, 29924, 29892, 350, 333, 8684, 284, 13, 3166, 13023, 294, 29889, 9794, 1053, 8125, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 12965, 29918, 12276, 13, 13, 12648, 29918, 1660, 29984, 29918, 1307, 29940, 353, 29871, 29896, 29900, 29900, 13, 29923, 9486, 3352, 29928, 4214, 29918, 14226, 29871, 353, 29871, 29941, 29900, 29900, 13, 13, 1990, 16510, 3950, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 25260, 29892, 926, 29918, 11338, 29892, 1734, 29906, 2003, 1125, 13, 4706, 1583, 29889, 18616, 2063, 353, 25260, 13, 4706, 1583, 29889, 1066, 29918, 11338, 353, 926, 29918, 11338, 13, 4706, 1583, 29889, 1742, 29906, 2003, 353, 1734, 29906, 2003, 13, 268, 13, 13, 1678, 822, 4608, 675, 29898, 1311, 1125, 13, 4706, 396, 16510, 675, 1060, 322, 612, 13, 4706, 1583, 29889, 29873, 29918, 9303, 353, 25159, 3950, 580, 13, 4706, 1583, 29889, 29873, 29918, 9303, 29889, 9202, 29918, 265, 29918, 726, 29879, 29898, 1311, 29889, 18616, 2063, 29897, 259, 13, 4706, 1060, 353, 1583, 29889, 29873, 29918, 9303, 29889, 726, 29879, 29918, 517, 29918, 6831, 2063, 29898, 1311, 29889, 18616, 2063, 29897, 13, 13, 4706, 1583, 29889, 29873, 29918, 11338, 353, 25159, 3950, 580, 13, 4706, 1583, 29889, 29873, 29918, 11338, 29889, 9202, 29918, 265, 29918, 726, 29879, 29898, 1311, 29889, 1066, 29918, 11338, 29897, 259, 13, 4706, 343, 353, 1583, 29889, 29873, 29918, 11338, 29889, 726, 29879, 29918, 517, 29918, 6831, 2063, 29898, 1311, 29889, 1066, 29918, 11338, 29897, 13, 308, 13, 4706, 396, 349, 4676, 322, 21022, 362, 304, 1207, 599, 15602, 310, 9090, 3309, 13, 4706, 1583, 29889, 29990, 353, 17132, 29918, 6831, 2063, 29898, 29990, 29892, 4236, 2435, 29922, 12648, 29918, 1660, 29984, 29918, 1307, 29940, 29892, 21022, 1218, 2433, 2490, 1495, 13, 4706, 1583, 29889, 29891, 353, 17132, 29918, 6831, 2063, 29898, 29891, 29892, 4236, 2435, 29922, 12648, 29918, 1660, 29984, 29918, 1307, 29940, 29892, 21022, 1218, 2433, 2490, 1495, 13, 4706, 1583, 29889, 17987, 8497, 29918, 705, 5861, 353, 1583, 29889, 15287, 29918, 17987, 29881, 886, 580, 13, 308, 13, 4706, 1583, 29889, 5182, 29918, 29880, 6897, 353, 518, 29930, 1311, 29889, 29873, 29918, 11338, 29889, 1742, 29918, 2248, 29962, 13, 4706, 736, 1583, 29889, 29990, 29892, 1583, 29889, 29891, 29892, 1583, 29889, 5182, 29918, 29880, 6897, 29892, 1583, 29889, 17987, 8497, 29918, 705, 5861, 13, 13, 1678, 822, 8273, 29918, 17987, 29881, 886, 29898, 1311, 1125, 13, 268, 13, 4706, 16510, 3950, 29889, 15287, 29918, 17987, 29881, 886, 29889, 29963, 20166, 2882, 13309, 19926, 29918, 14226, 353, 7431, 29898, 1311, 29889, 29873, 29918, 9303, 29889, 1742, 29918, 2248, 29897, 718, 29871, 29896, 13, 4706, 1583, 29889, 17987, 8497, 29918, 705, 5861, 353, 7442, 29889, 3298, 359, 3552, 12877, 3950, 29889, 15287, 29918, 17987, 29881, 886, 29889, 29963, 20166, 2882, 13309, 19926, 29918, 14226, 29892, 382, 9486, 3352, 29928, 4214, 29918, 14226, 876, 13, 4706, 1734, 29906, 333, 353, 1583, 29889, 29873, 29918, 9303, 29889, 1742, 29918, 2248, 13, 4706, 363, 1734, 29892, 2380, 297, 1734, 29906, 333, 29889, 7076, 7295, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 17987, 8497, 29918, 705, 5861, 29961, 2248, 29892, 584, 29962, 353, 1583, 29889, 1742, 29906, 2003, 29961, 1742, 29962, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 1209, 13, 4706, 1583, 3032, 3977, 397, 886, 580, 13, 4706, 736, 1583, 29889, 17987, 8497, 29918, 705, 5861, 13, 13, 1678, 822, 903, 3977, 397, 886, 29898, 1311, 1125, 13, 4706, 396, 697, 29899, 8711, 8025, 13, 4706, 1583, 29889, 29891, 353, 304, 29918, 29883, 20440, 936, 29898, 1311, 29889, 29891, 29897, 13, 308, 13, 13, 1990, 365, 1254, 29924, 29918, 4299, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1060, 29892, 343, 29892, 3646, 29918, 29880, 6897, 29892, 23655, 29918, 705, 5861, 29892, 3457, 29931, 1254, 29924, 29922, 8824, 1125, 13, 4706, 1583, 29889, 29990, 353, 1060, 13, 4706, 1583, 29889, 29891, 353, 343, 13, 4706, 1583, 29889, 5182, 29918, 29880, 6897, 353, 3646, 29918, 29880, 6897, 13, 4706, 1583, 29889, 17987, 8497, 29918, 705, 5861, 353, 23655, 29918, 705, 5861, 13, 4706, 1583, 29889, 20517, 29931, 1254, 29924, 353, 3457, 29931, 1254, 29924, 13, 308, 13, 268, 13, 1678, 822, 7945, 29918, 1688, 29918, 5451, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29990, 29918, 14968, 29892, 1583, 29889, 29990, 29918, 1688, 29892, 1583, 29889, 29979, 29918, 14968, 29892, 1583, 29889, 29979, 29918, 1688, 353, 7945, 29918, 1688, 29918, 5451, 29898, 1311, 29889, 29990, 29892, 29871, 13, 462, 462, 462, 462, 18884, 1583, 29889, 29891, 29892, 29871, 13, 462, 462, 462, 462, 18884, 1243, 29918, 2311, 29922, 29900, 29889, 29906, 29892, 29871, 13, 462, 462, 462, 462, 18884, 4036, 29918, 3859, 29922, 29896, 29906, 29941, 29897, 13, 4706, 1583, 29889, 29990, 29918, 14968, 29892, 1583, 29889, 29990, 29918, 18157, 29892, 1583, 29889, 29979, 29918, 14968, 29892, 1583, 29889, 29979, 29918, 18157, 353, 7945, 29918, 1688, 29918, 5451, 29898, 1311, 29889, 29990, 29918, 14968, 29892, 29871, 13, 462, 462, 462, 462, 462, 9651, 1583, 29889, 29979, 29918, 14968, 29892, 13, 462, 462, 462, 462, 462, 9651, 1243, 29918, 2311, 29922, 29900, 29889, 29906, 29892, 29871, 13, 462, 462, 462, 462, 462, 9651, 4036, 29918, 3859, 29922, 29896, 29906, 29941, 29897, 13, 1678, 822, 1904, 29918, 2344, 29898, 1311, 29892, 6389, 1125, 13, 4706, 1583, 29889, 20155, 29885, 29918, 4299, 353, 922, 339, 2556, 580, 13, 4706, 1583, 29889, 5182, 29918, 29880, 6897, 353, 1583, 29889, 29891, 29889, 12181, 29961, 29906, 29962, 13, 4706, 478, 20166, 2882, 13309, 19926, 29918, 14226, 353, 16510, 3950, 29889, 15287, 29918, 17987, 29881, 886, 29889, 29963, 20166, 2882, 13309, 19926, 29918, 14226, 13, 4706, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 1202, 29898, 6026, 2580, 8497, 29898, 13, 462, 18884, 1881, 29918, 6229, 353, 478, 20166, 2882, 13309, 19926, 29918, 14226, 29892, 3986, 13, 462, 18884, 1962, 29918, 6229, 29871, 353, 382, 9486, 3352, 29928, 4214, 29918, 14226, 29892, 308, 13, 462, 18884, 1881, 29918, 2848, 353, 18134, 29918, 1660, 29984, 29918, 1307, 29940, 29892, 965, 13, 462, 18884, 18177, 353, 518, 1311, 29889, 17987, 8497, 29918, 705, 5861, 1402, 259, 13, 462, 18884, 7945, 519, 353, 7700, 462, 418, 13, 308, 876, 13, 4706, 565, 1583, 29889, 20517, 29931, 1254, 29924, 29901, 13, 9651, 1596, 877, 29899, 29915, 29930, 29906, 29900, 1699, 3195, 11258, 29901, 3457, 29899, 29931, 1254, 29924, 613, 28560, 29915, 29930, 29906, 29900, 29897, 13, 9651, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 1202, 29898, 29933, 333, 8684, 284, 29898, 29931, 1254, 29924, 29898, 29953, 29946, 29892, 736, 29918, 6831, 2063, 29922, 5574, 4961, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 29899, 29915, 29930, 29906, 29900, 1699, 3195, 11258, 29901, 365, 1254, 29924, 613, 28560, 29915, 29930, 29906, 29900, 29897, 13, 9651, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 1202, 29898, 29931, 1254, 29924, 29898, 29953, 29946, 29892, 736, 29918, 6831, 2063, 29922, 5574, 876, 13, 632, 13, 4706, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 1202, 29898, 2481, 13398, 7541, 29898, 29928, 1947, 29898, 1311, 29889, 5182, 29918, 29880, 6897, 29892, 26229, 2433, 2695, 3317, 29915, 4961, 13, 4706, 2224, 353, 6389, 29889, 449, 29918, 3972, 718, 5591, 4299, 29918, 1279, 29889, 2732, 29908, 13, 4706, 13023, 294, 29889, 13239, 29889, 5317, 29918, 4299, 29898, 1311, 29889, 20155, 29885, 29918, 4299, 29892, 2224, 29892, 1510, 29918, 845, 11603, 29922, 5574, 29897, 13, 308, 13, 13, 1678, 822, 7945, 29898, 1311, 29892, 6389, 1125, 13, 4706, 1583, 29889, 14968, 29918, 1688, 29918, 5451, 580, 13, 4706, 1583, 29889, 4299, 29918, 2344, 29898, 5085, 29897, 13, 4706, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 12198, 29898, 6758, 2433, 29883, 20440, 936, 29918, 19128, 296, 14441, 742, 13, 462, 18884, 5994, 3950, 2433, 328, 314, 742, 13, 462, 18884, 21556, 29922, 1839, 5753, 11287, 13, 4706, 1596, 29898, 1311, 29889, 20155, 29885, 29918, 4299, 29889, 7727, 3101, 13, 4706, 1583, 29889, 20155, 29885, 29918, 26495, 353, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 9202, 29898, 1311, 29889, 29990, 29918, 14968, 29892, 13, 462, 462, 18884, 1583, 29889, 29979, 29918, 14968, 29892, 29871, 13, 462, 462, 18884, 9853, 29918, 2311, 29922, 29896, 29906, 29947, 29892, 29871, 13, 462, 462, 18884, 21502, 12168, 29922, 29896, 29900, 29892, 29871, 13, 462, 462, 18884, 8845, 29918, 1272, 7607, 1311, 29889, 29990, 29918, 18157, 29892, 1583, 29889, 29979, 29918, 18157, 876, 13, 4706, 1583, 29889, 26495, 29918, 12276, 29898, 5085, 29897, 13, 4706, 6410, 29892, 13600, 353, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 24219, 403, 29898, 1311, 29889, 29990, 29918, 1688, 29892, 1583, 29889, 29979, 29918, 1688, 29892, 26952, 353, 29871, 29896, 29897, 13, 4706, 1596, 703, 29931, 2209, 29901, 12365, 29889, 29906, 29888, 29913, 1273, 2053, 29876, 7504, 332, 4135, 29901, 12365, 29889, 29906, 29888, 29913, 1273, 1642, 4830, 29898, 6758, 29930, 29896, 29900, 29900, 29892, 13600, 29930, 29896, 29900, 29900, 876, 13, 308, 13, 4706, 565, 1583, 29889, 20517, 29931, 1254, 29924, 29901, 13, 9651, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 7620, 29898, 5085, 29889, 449, 29918, 3972, 718, 8207, 4299, 29918, 20517, 29899, 29931, 1254, 29924, 29889, 29882, 29945, 1495, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 20155, 29885, 29918, 4299, 29889, 7620, 29898, 5085, 29889, 449, 29918, 3972, 718, 8207, 4299, 29918, 29931, 1254, 29924, 29889, 29882, 29945, 1495, 13, 632, 13, 1678, 822, 6694, 29918, 12276, 29898, 1311, 29892, 6389, 1125, 13, 462, 13, 4706, 396, 19138, 675, 4955, 363, 13600, 13, 4706, 14770, 29889, 5317, 29898, 1311, 29889, 20155, 29885, 29918, 26495, 29889, 18434, 1839, 5753, 11287, 13, 4706, 14770, 29889, 5317, 29898, 1311, 29889, 20155, 29885, 29918, 26495, 29889, 18434, 1839, 791, 29918, 5753, 11287, 13, 4706, 14770, 29889, 3257, 877, 4299, 13600, 1495, 13, 4706, 14770, 29889, 29891, 1643, 877, 562, 2764, 4135, 1495, 13, 4706, 14770, 29889, 29916, 1643, 877, 1022, 2878, 1495, 13, 4706, 14770, 29889, 26172, 18959, 14968, 742, 525, 1688, 7464, 1180, 2433, 21064, 2175, 1495, 13, 4706, 565, 1583, 29889, 20517, 29931, 1254, 29924, 29901, 13, 9651, 14770, 29889, 7620, 1003, 29898, 5085, 29889, 449, 29918, 3972, 718, 8207, 562, 2764, 388, 29918, 5317, 29918, 20517, 29899, 29931, 1254, 29924, 29889, 8961, 742, 3402, 2433, 8961, 1495, 13, 4706, 1683, 29901, 13, 9651, 14770, 29889, 7620, 1003, 29898, 5085, 29889, 449, 29918, 3972, 718, 8207, 562, 2764, 388, 29918, 5317, 29918, 29931, 1254, 29924, 29889, 8961, 742, 3402, 2433, 8961, 1495, 13, 308, 13, 4706, 396, 19138, 675, 4955, 363, 6410, 13, 4706, 14770, 29889, 5317, 29898, 1311, 29889, 20155, 29885, 29918, 26495, 29889, 18434, 1839, 5753, 11287, 13, 4706, 14770, 29889, 5317, 29898, 1311, 29889, 20155, 29885, 29918, 26495, 29889, 18434, 1839, 791, 29918, 6758, 11287, 13, 4706, 14770, 29889, 3257, 877, 4299, 6410, 1495, 13, 4706, 14770, 29889, 29891, 1643, 877, 6758, 1495, 13, 4706, 14770, 29889, 29916, 1643, 877, 1022, 2878, 1495, 13, 4706, 14770, 29889, 26172, 18959, 14968, 742, 525, 1688, 7464, 1180, 2433, 21064, 2175, 1495, 13, 4706, 565, 1583, 29889, 20517, 29931, 1254, 29924, 29901, 13, 9651, 14770, 29889, 7620, 1003, 29898, 5085, 29889, 449, 29918, 3972, 718, 8207, 6758, 29918, 5317, 29918, 20517, 29899, 29931, 1254, 29924, 29889, 8961, 742, 3402, 2433, 8961, 1495, 13, 4706, 1683, 29901, 13, 9651, 14770, 29889, 7620, 1003, 29898, 5085, 29889, 449, 29918, 3972, 718, 8207, 6758, 29918, 5317, 29918, 29931, 1254, 29924, 29889, 8961, 742, 3402, 2433, 8961, 1495, 13, 268, 13, 268, 13, 1753, 5142, 29918, 1272, 29898, 5085, 1125, 13, 1678, 9995, 6437, 310, 590, 740, 9995, 13, 13, 1678, 396, 25553, 8783, 13, 1678, 302, 1896, 29895, 29889, 10382, 877, 2484, 774, 804, 1495, 13, 1678, 302, 1896, 29895, 29889, 10382, 877, 29890, 4708, 1495, 13, 1678, 302, 1896, 29895, 29889, 10382, 877, 535, 645, 29906, 29900, 29900, 29900, 1495, 13, 1678, 302, 1896, 29895, 29889, 10382, 877, 14540, 284, 29918, 11338, 300, 1495, 13, 13, 1678, 396, 25553, 758, 29899, 3018, 1312, 8297, 29881, 886, 29889, 29871, 29896, 29924, 3838, 411, 1014, 1742, 5235, 13, 1678, 565, 6389, 29889, 1491, 1742, 29918, 3888, 29901, 13, 4706, 1596, 703, 15156, 3323, 1742, 5235, 1159, 13, 4706, 3142, 353, 525, 991, 597, 11671, 29889, 29888, 2291, 666, 803, 5325, 29889, 510, 29914, 11255, 726, 29914, 345, 14359, 29899, 996, 1674, 29914, 4594, 29899, 15753, 29899, 29941, 29900, 29900, 29881, 29899, 29896, 29924, 29899, 1491, 1742, 29889, 2003, 29889, 7554, 29915, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 3664, 773, 3323, 1742, 5235, 1159, 13, 4706, 3142, 353, 525, 991, 597, 11671, 29889, 29888, 2291, 666, 803, 5325, 29889, 510, 29914, 11255, 726, 29914, 345, 14359, 29899, 996, 1674, 29914, 4594, 29899, 15753, 29899, 29941, 29900, 29900, 29881, 29899, 29896, 29924, 29889, 2003, 29889, 7554, 29915, 13, 1678, 285, 978, 353, 3142, 29889, 5451, 11219, 1495, 14352, 29896, 29962, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 29888, 978, 1125, 13, 4706, 1596, 703, 6767, 13234, 8297, 29881, 886, 856, 1159, 13, 4706, 1899, 353, 851, 703, 29991, 281, 657, 448, 17608, 16521, 718, 3142, 13, 4706, 1596, 29898, 6519, 29897, 13, 4706, 2897, 29889, 5205, 29898, 6519, 29897, 13, 4706, 411, 14319, 1445, 29889, 26264, 2283, 29898, 29888, 978, 29892, 525, 29878, 1495, 408, 14319, 29918, 999, 29901, 13, 9651, 14319, 29918, 999, 29889, 21111, 497, 12839, 1495, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 6572, 29899, 3018, 1312, 8297, 29881, 886, 2307, 2198, 29936, 451, 5663, 15387, 23157, 13, 268, 13, 1678, 736, 7670, 287, 29963, 11142, 29889, 1359, 29918, 1742, 29906, 2003, 29918, 4830, 29898, 29888, 978, 29889, 17010, 12839, 7554, 8785, 13, 13, 13, 1753, 848, 29918, 1457, 862, 362, 7295, 13, 1678, 2578, 774, 804, 29918, 2616, 13364, 353, 1034, 13364, 29889, 2484, 774, 804, 29889, 4039, 3192, 29918, 29879, 1237, 29898, 11338, 300, 2433, 14540, 284, 1495, 13, 1678, 17354, 29918, 2616, 13364, 353, 1034, 13364, 29889, 29890, 4708, 29889, 4039, 3192, 29918, 29879, 1237, 29898, 11338, 300, 2433, 14540, 284, 1495, 13, 1678, 378, 645, 29918, 2616, 13364, 353, 1034, 13364, 29889, 535, 645, 29906, 29900, 29900, 29900, 29889, 4039, 3192, 29918, 29879, 1237, 29898, 11338, 300, 2433, 14540, 284, 1495, 13, 1678, 736, 2578, 774, 804, 29918, 2616, 13364, 718, 17354, 29918, 2616, 13364, 718, 378, 645, 29918, 2616, 13364, 13, 268, 13, 13, 1753, 848, 29918, 12657, 29898, 4039, 3192, 29918, 18616, 2063, 1125, 13, 1678, 25260, 353, 5159, 13, 1678, 926, 29918, 11338, 353, 5159, 13, 1678, 363, 2944, 297, 4055, 3192, 29918, 18616, 2063, 29901, 13, 4706, 25260, 29889, 4397, 4197, 6979, 29961, 29900, 29962, 363, 5993, 297, 2944, 2314, 13, 4706, 926, 29918, 11338, 29889, 4397, 4197, 6979, 29961, 29896, 29962, 363, 5993, 297, 2944, 2314, 13, 1678, 736, 25260, 29892, 926, 29918, 11338, 13, 13, 268, 13, 1753, 1667, 7295, 13, 1678, 9995, 1667, 1158, 9995, 13, 1678, 6389, 353, 6088, 29918, 25699, 580, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 5085, 29889, 449, 29918, 3972, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 1734, 29906, 2003, 353, 5142, 29918, 1272, 29898, 5085, 29897, 13, 1678, 4055, 3192, 29918, 18616, 2063, 353, 848, 29918, 1457, 862, 362, 580, 13, 1678, 25260, 29892, 926, 29918, 11338, 353, 848, 29918, 12657, 29898, 4039, 3192, 29918, 18616, 2063, 29897, 13, 1678, 4608, 3950, 353, 16510, 3950, 29898, 18616, 2063, 29892, 926, 29918, 11338, 29892, 1734, 29906, 2003, 29897, 13, 1678, 1060, 29892, 343, 29892, 3646, 29918, 29880, 6897, 29892, 23655, 29918, 705, 5861, 353, 4608, 3950, 29889, 8111, 675, 580, 13, 1678, 565, 6389, 29889, 4299, 29918, 16957, 26359, 20517, 29931, 1254, 29924, 1115, 13, 4706, 365, 1254, 29924, 29918, 4299, 29898, 29990, 29892, 343, 29892, 3646, 29918, 29880, 6897, 29892, 23655, 29918, 705, 5861, 29892, 20517, 29931, 1254, 29924, 29922, 5574, 467, 14968, 29898, 5085, 29897, 13, 1678, 25342, 6389, 29889, 4299, 29918, 16957, 26359, 29931, 1254, 29924, 1115, 13, 4706, 365, 1254, 29924, 29918, 4299, 29898, 29990, 29892, 343, 29892, 3646, 29918, 29880, 6897, 29892, 23655, 29918, 705, 5861, 29892, 20517, 29931, 1254, 29924, 29922, 8824, 467, 14968, 29898, 5085, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 10299, 2164, 1904, 11258, 451, 11098, 29889, 3967, 1449, 29991, 1159, 13, 1678, 1095, 353, 931, 29889, 2230, 580, 13, 1678, 1596, 703, 11536, 10073, 29901, 18695, 29941, 29888, 269, 29908, 1273, 313, 355, 29899, 2962, 876, 13, 268, 13, 13, 1753, 6088, 29918, 25699, 7295, 13, 1678, 9995, 6088, 6273, 9995, 13, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 29922, 1649, 1514, 1649, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 449, 29918, 3972, 613, 1371, 543, 2084, 304, 4078, 278, 24580, 322, 2582, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 4299, 29918, 16957, 613, 4381, 29922, 8516, 29892, 1859, 1575, 29922, 1839, 29931, 1254, 29924, 3788, 20517, 29931, 1254, 29924, 7464, 1134, 29922, 710, 29892, 8477, 2433, 29620, 310, 6694, 11258, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 29899, 1491, 1742, 29918, 3888, 613, 2322, 29922, 8516, 29892, 1134, 29922, 11227, 29892, 1371, 2433, 1509, 758, 29899, 17987, 29881, 886, 411, 1014, 1742, 2472, 1495, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 736, 6389, 13, 268, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 13, 2 ]
ihan/__init__.py
marklit/ihan
0
173734
<reponame>marklit/ihan<gh_stars>0 from __future__ import print_function from itertools import chain, islice import json from os.path import expanduser, join from random import randint import subprocess import sys from time import sleep import requests def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) def group(num_items, iterable): iterable = iter(iterable) while True: chunk = islice(iterable, num_items) try: first_element = next(chunk) except StopIteration: return yield chain((first_element,), chunk) def send_it(endpoint, api_key, api_secret, logs): r = requests.post(endpoint, json={'lines': logs, 'api_key': api_key, 'api_secret': api_secret}) assert r.status_code == 200, r.status_code assert r.json()['lines'] == len(logs), 'Line counts failed to match' has_binary = lambda s: "\x00" in s or any(ord(x) > 0x80 for x in s) # noqa:E731 def feed_file(filename, from_beginning, batch_size, endpoint, sleep_interval, backfill): try: config_file = join(expanduser("~"), ".ihan/config") api = json.loads(open(config_file, 'r').read()) assert len(api['api_key']) > 10 and len(api['api_secret']) > 10 except Exception as exc: print(exc) print("Please run this first: ihan login") return filename = '/dev/stdin' if filename.strip() == '-' else filename # WIP this can't detect the end of a stream when # gunzip -c data is being piped in. # If filename is /dev/stdin don't use tail, just use # something in python to follow stdin. if backfill: proc = subprocess.Popen(['cat', filename], stdout=subprocess.PIPE) else: proc = subprocess.Popen(['tail', '--lines=+0' if from_beginning else '-n 1000', '--follow=name', '--retry', '--quiet', '--silent', '--sleep-interval=%d' % sleep_interval, filename], stdout=subprocess.PIPE) for n_batch, lines in enumerate(group(batch_size, iter(proc.stdout.readline, ''))): eprint('batch: ' + str(n_batch)) # Don't let a few binary bytes stop this in its tracks. try: logs = list([l.rstrip().decode('utf-8') for l in lines]) except (AttributeError, # Python 3 UnicodeDecodeError) as exc: # Python 2 eprint('Compressed logs are not supported') sleep(randint(30, 60)) continue if has_binary(''.join(logs)): eprint('Compressed logs are not supported') sleep(randint(30, 60)) continue while True: try: send_it(endpoint, api['api_key'], api['api_secret'], logs) sleep(0.25) # WIP: Make this optional break except (KeyError, ValueError, AssertionError, requests.exceptions.ConnectionError) as exc: eprint(exc) # WIP: Set configuration for this _interval = randint(10, 180) eprint('Sleeping for ' + str(_interval) + 's') sleep(_interval)
[ 1, 529, 276, 1112, 420, 29958, 3502, 19411, 29914, 4861, 273, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 3166, 259, 4256, 8504, 1053, 9704, 29892, 338, 5897, 13, 5215, 4390, 13, 3166, 259, 2897, 29889, 2084, 1053, 7985, 1792, 29892, 5988, 13, 3166, 259, 4036, 1053, 20088, 524, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 3166, 259, 931, 1053, 8709, 13, 13, 13, 5215, 7274, 13, 13, 13, 1753, 321, 2158, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 1596, 10456, 5085, 29892, 934, 29922, 9675, 29889, 303, 20405, 29892, 3579, 19290, 29897, 13, 13, 13, 1753, 2318, 29898, 1949, 29918, 7076, 29892, 4256, 519, 1125, 13, 1678, 4256, 519, 353, 4256, 29898, 1524, 519, 29897, 13, 13, 1678, 1550, 5852, 29901, 13, 4706, 19875, 353, 338, 5897, 29898, 1524, 519, 29892, 954, 29918, 7076, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 937, 29918, 5029, 353, 2446, 29898, 29812, 29897, 13, 4706, 5174, 22303, 13463, 362, 29901, 13, 9651, 736, 13, 13, 4706, 7709, 9704, 3552, 4102, 29918, 5029, 29892, 511, 19875, 29897, 13, 13, 13, 1753, 3638, 29918, 277, 29898, 29734, 29892, 7882, 29918, 1989, 29892, 7882, 29918, 19024, 29892, 10748, 1125, 13, 1678, 364, 353, 7274, 29889, 2490, 29898, 29734, 29892, 4390, 3790, 29915, 9012, 2396, 10748, 29892, 13, 462, 462, 418, 525, 2754, 29918, 1989, 2396, 7882, 29918, 1989, 29892, 13, 462, 462, 418, 525, 2754, 29918, 19024, 2396, 7882, 29918, 19024, 1800, 13, 1678, 4974, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29892, 364, 29889, 4882, 29918, 401, 13, 1678, 4974, 364, 29889, 3126, 580, 1839, 9012, 2033, 1275, 7431, 29898, 20756, 511, 525, 3542, 18139, 5229, 304, 1993, 29915, 13, 13, 13, 5349, 29918, 19541, 353, 14013, 269, 29901, 6634, 29916, 29900, 29900, 29908, 297, 269, 470, 738, 29898, 536, 29898, 29916, 29897, 1405, 29871, 29900, 29916, 29947, 29900, 363, 921, 297, 269, 29897, 396, 694, 25621, 29901, 29923, 29955, 29941, 29896, 13, 13, 13, 1753, 8343, 29918, 1445, 29898, 9507, 29892, 515, 29918, 463, 1076, 29892, 9853, 29918, 2311, 29892, 16248, 29892, 8709, 29918, 19207, 29892, 13, 795, 1250, 5589, 1125, 13, 1678, 1018, 29901, 13, 4706, 2295, 29918, 1445, 353, 5988, 29898, 18837, 1792, 703, 30022, 4968, 11393, 4861, 273, 29914, 2917, 1159, 13, 4706, 7882, 353, 4390, 29889, 18132, 29898, 3150, 29898, 2917, 29918, 1445, 29892, 525, 29878, 2824, 949, 3101, 13, 4706, 4974, 7431, 29898, 2754, 1839, 2754, 29918, 1989, 11287, 1405, 29871, 29896, 29900, 322, 7431, 29898, 2754, 1839, 2754, 29918, 19024, 11287, 1405, 29871, 29896, 29900, 13, 1678, 5174, 8960, 408, 5566, 29901, 13, 4706, 1596, 29898, 735, 29883, 29897, 13, 4706, 1596, 703, 12148, 1065, 445, 937, 29901, 4686, 273, 6464, 1159, 13, 4706, 736, 13, 13, 1678, 10422, 353, 8207, 3359, 29914, 4172, 262, 29915, 565, 10422, 29889, 17010, 580, 1275, 17411, 29915, 1683, 10422, 13, 1678, 396, 399, 5690, 445, 508, 29915, 29873, 6459, 278, 1095, 310, 263, 4840, 746, 13, 1678, 396, 13736, 7554, 448, 29883, 848, 338, 1641, 8450, 287, 297, 29889, 13, 1678, 396, 960, 10422, 338, 847, 3359, 29914, 4172, 262, 1016, 29915, 29873, 671, 12464, 29892, 925, 671, 13, 1678, 396, 1554, 297, 3017, 304, 1101, 3659, 262, 29889, 13, 1678, 565, 1250, 5589, 29901, 13, 4706, 9580, 353, 1014, 5014, 29889, 29925, 3150, 18959, 4117, 742, 13, 462, 462, 10422, 1402, 13, 462, 18884, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 1678, 1683, 29901, 13, 4706, 9580, 353, 1014, 5014, 29889, 29925, 3150, 18959, 18237, 742, 13, 462, 462, 525, 489, 9012, 29922, 29974, 29900, 29915, 565, 515, 29918, 463, 1076, 1683, 17411, 29876, 29871, 29896, 29900, 29900, 29900, 742, 13, 462, 462, 525, 489, 23031, 29922, 978, 742, 13, 462, 462, 525, 489, 276, 2202, 742, 13, 462, 462, 525, 489, 339, 2035, 742, 13, 462, 462, 525, 489, 25590, 296, 742, 13, 462, 462, 525, 489, 17059, 29899, 19207, 16328, 29881, 29915, 1273, 8709, 29918, 19207, 29892, 13, 462, 462, 10422, 1402, 13, 462, 18884, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 13, 1678, 363, 302, 29918, 16175, 29892, 3454, 297, 26985, 29898, 2972, 29898, 16175, 29918, 2311, 29892, 13, 462, 9651, 4256, 29898, 15439, 29889, 25393, 29889, 949, 1220, 29892, 6629, 876, 1125, 13, 4706, 321, 2158, 877, 16175, 29901, 525, 718, 851, 29898, 29876, 29918, 16175, 876, 13, 4706, 396, 3872, 29915, 29873, 1235, 263, 2846, 7581, 6262, 5040, 445, 297, 967, 16257, 29889, 13, 4706, 1018, 29901, 13, 9651, 10748, 353, 1051, 4197, 29880, 29889, 29878, 17010, 2141, 13808, 877, 9420, 29899, 29947, 1495, 363, 301, 297, 3454, 2314, 13, 4706, 5174, 313, 6708, 2392, 29892, 396, 5132, 29871, 29941, 13, 18884, 23862, 2772, 401, 2392, 29897, 408, 5566, 29901, 396, 5132, 29871, 29906, 13, 9651, 321, 2158, 877, 1523, 13120, 10748, 526, 451, 6969, 1495, 13, 9651, 8709, 29898, 9502, 524, 29898, 29941, 29900, 29892, 29871, 29953, 29900, 876, 13, 9651, 6773, 13, 13, 4706, 565, 29871, 756, 29918, 19541, 877, 4286, 7122, 29898, 20756, 22164, 13, 9651, 321, 2158, 877, 1523, 13120, 10748, 526, 451, 6969, 1495, 13, 9651, 8709, 29898, 9502, 524, 29898, 29941, 29900, 29892, 29871, 29953, 29900, 876, 13, 9651, 6773, 13, 13, 4706, 1550, 5852, 29901, 13, 9651, 1018, 29901, 13, 18884, 3638, 29918, 277, 29898, 29734, 29892, 7882, 1839, 2754, 29918, 1989, 7464, 7882, 1839, 2754, 29918, 19024, 7464, 10748, 29897, 13, 18884, 8709, 29898, 29900, 29889, 29906, 29945, 29897, 396, 399, 5690, 29901, 8561, 445, 13136, 13, 18884, 2867, 13, 9651, 5174, 313, 2558, 2392, 29892, 13, 462, 1678, 7865, 2392, 29892, 13, 462, 1678, 16499, 291, 2392, 29892, 13, 462, 1678, 7274, 29889, 11739, 29879, 29889, 5350, 2392, 29897, 408, 5566, 29901, 13, 18884, 321, 2158, 29898, 735, 29883, 29897, 13, 13, 18884, 396, 399, 5690, 29901, 3789, 5285, 363, 445, 13, 18884, 903, 19207, 353, 20088, 524, 29898, 29896, 29900, 29892, 29871, 29896, 29947, 29900, 29897, 13, 18884, 321, 2158, 877, 29903, 5436, 292, 363, 525, 718, 851, 7373, 19207, 29897, 718, 525, 29879, 1495, 13, 18884, 8709, 7373, 19207, 29897, 2 ]
prediction/rawDataReader.py
garagonc/optimization-framework
0
138484
<filename>prediction/rawDataReader.py """ Created on Okt 04 13:51 2018 @author: nishit """ import datetime import os import time from senml import senml from utils_intern.messageLogger import MessageLogger logger = MessageLogger.get_logger_parent() class RawDataReader: @staticmethod def read_from_file(file_path, topic_name): try: if os.path.exists(file_path): with open(file_path) as file: data = file.readlines() file.close() return data else: logger.info("Saved data not available "+str(topic_name)) return [] except Exception as e: logger.error(e) return [] @staticmethod def time_conversion(time): time = int(time) if len(str(time)) > 10: new_t = time / (10 ** (len(str(time)) - 10)) return new_t else: return time @staticmethod def format_data(data=[]): new_data = [] doc = None try: doc = senml.SenMLDocument.from_json(data) except Exception as e: pass if not doc: try: meas = senml.SenMLMeasurement.from_json(data) doc = senml.SenMLDocument([meas]) except Exception as e: pass if doc: for meas in doc.measurements: try: n = meas.name v = meas.value t = meas.time t = RawDataReader.time_conversion(t) cols = [t,v] new_data.append(cols) except Exception as e: logger.error("Exception in formating meas " + str(e)) return new_data else: for row in data: try: cols = row.replace('\n', '').strip().split(",") dateTime = float(cols[0]) cols = cols[1:] cols = list(map(float, cols)) cols.insert(0, dateTime) new_data.append(cols) except Exception as e: logger.error("Exception in formating line "+str(row)+ " "+ str(e)) return new_data @staticmethod def get_raw_data(file_path, topic_name, data_length=None): data = RawDataReader.read_from_file(file_path, topic_name) if data_length is not None and len(data) > data_length: data = data[-data_length:] if len(data) > 0: indexes = [] for i,v in enumerate(data): if "inf" in str(v).lower() or "nan" in str(v).lower(): indexes.append(i) logger.debug("len indexes " + str(len(indexes))) indexes.sort(reverse=True) for index in indexes: data.pop(index) return RawDataReader.format_data(data) @staticmethod def get_raw_data_by_time(file_path, topic_name, start_time, end_time): #logger.debug("start time "+str(start_time)+" end time "+str(end_time)) flag = False new_data = [] if start_time < end_time: data = RawDataReader.read_from_file(file_path, topic_name) start_time = int(start_time) end_time = int(end_time) for row in data: try: col = row.replace('\n', '').strip().split(",") t = float(col[0]) v = float(col[1]) if not flag and start_time <= t: flag = True if flag and end_time < t: break if flag: new_data.append([t,v]) except Exception as e: logger.error("Exception in formating line " + str(row) + " " + str(e)) return new_data @staticmethod def save_to_file(file_path, topic_name, minute_data, max_file_size_mins=-1, overwrite=False): try: logger.info("Saving raw data to file " + str(file_path)) if overwrite: old_data = [] else: old_data = RawDataReader.read_from_file(file_path, topic_name) for item in minute_data: line = ','.join(map(str, item[:2])) + "\n" old_data.append(line) if max_file_size_mins > 0: old_data = old_data[-max_file_size_mins:] update_data = [] for i, line in enumerate(old_data): c = line.count(",") if c == 2: s = line.split(",") m = s[1] mv = m[:-12] mt = m[-12:] l1 = [float(s[0]), float(mv)] l1 = ','.join(map(str, l1[:2])) + "\n" l2 = [float(mt), float(s[2].replace("\n", ""))] l2 = ','.join(map(str, l2[:2])) + "\n" update_data.append([i, l1, l2]) elif c != 1: update_data.append([i, None, None]) shift = 0 for d in update_data: if d[1] is not None and d[2] is not None: old_data.pop(d[0] + shift) old_data.insert(d[0] + shift, d[1]) old_data.insert(d[0] + shift + 1, d[2]) shift += 1 else: old_data.pop(d[0] + shift) shift -= 1 with open(file_path, 'w+') as file: file.writelines(old_data) file.close() return [] except Exception as e: logger.error("failed to save_to_file " + str(e)) return minute_data @staticmethod def del_file(file_path, topic_name): try: if os.path.exists(file_path): os.remove(file_path) except Exception as e: logger.error("failed to del_to_file " + str(e)+" "+str(topic_name)) @staticmethod def removed_data_before_timestamp(file_path, topic_name, lastest_timestamp): data = RawDataReader.get_raw_data_by_time(file_path, topic_name, lastest_timestamp, time.time()) RawDataReader.save_to_file(file_path, topic_name, data, overwrite=True) @staticmethod def save_to_influx(influxdb, topic_name, minute_data, id): try: logger.info("Saving raw data to influx " + str(topic_name)) json_body = influxdb.timeseries_list_to_influx_json(minute_data, topic_name, "raw", id) if not influxdb.write(json_body): return minute_data else: return [] except Exception as e: logger.error("failed to save_to_influx " + str(e)) return minute_data @staticmethod def get_raw_data_influx(influxdb, topic_name, id, data_length=None): start_time = None if data_length: start_time = datetime.datetime.now() - datetime.timedelta(minutes=data_length+720) # half day extra data = influxdb.read(topic_name, "raw", instance_id=id, start_time=start_time) if data_length is not None and len(data) > data_length: data = data[-data_length:] if len(data) > 0: indexes = [] for i, v in enumerate(data): if "inf" in str(v).lower() or "nan" in str(v).lower(): indexes.append(i) logger.debug("len indexes " + str(len(indexes))) indexes.sort(reverse=True) for index in indexes: data.pop(index) return data @staticmethod def get_raw_data_by_time_influx(influxdb, topic_name, start_time, end_time, id): new_data = [] if start_time < end_time: new_data = influxdb.read(topic_name, "raw", instance_id=id, start_time=start_time, end_time=end_time) return new_data
[ 1, 529, 9507, 29958, 11965, 2463, 29914, 1610, 1469, 6982, 29889, 2272, 13, 15945, 29908, 13, 20399, 373, 438, 1193, 29871, 29900, 29946, 29871, 29896, 29941, 29901, 29945, 29896, 29871, 29906, 29900, 29896, 29947, 13, 13, 29992, 8921, 29901, 302, 728, 277, 13, 15945, 29908, 13, 5215, 12865, 13, 5215, 2897, 13, 5215, 931, 13, 13, 3166, 6940, 828, 1053, 6940, 828, 13, 13, 3166, 3667, 29879, 29918, 14168, 29889, 4906, 16363, 1053, 7777, 16363, 13, 21707, 353, 7777, 16363, 29889, 657, 29918, 21707, 29918, 3560, 580, 13, 13, 13, 1990, 22038, 1469, 6982, 29901, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1303, 29918, 3166, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 1125, 13, 4706, 1018, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 9933, 29898, 1445, 29918, 2084, 1125, 13, 18884, 411, 1722, 29898, 1445, 29918, 2084, 29897, 408, 934, 29901, 13, 462, 1678, 848, 353, 934, 29889, 949, 9012, 580, 13, 18884, 934, 29889, 5358, 580, 13, 18884, 736, 848, 13, 9651, 1683, 29901, 13, 18884, 17927, 29889, 3888, 703, 29903, 10511, 848, 451, 3625, 15691, 710, 29898, 13010, 29918, 978, 876, 13, 18884, 736, 5159, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 17927, 29889, 2704, 29898, 29872, 29897, 13, 4706, 736, 5159, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 931, 29918, 535, 3259, 29898, 2230, 1125, 13, 4706, 931, 353, 938, 29898, 2230, 29897, 13, 4706, 565, 7431, 29898, 710, 29898, 2230, 876, 1405, 29871, 29896, 29900, 29901, 13, 9651, 716, 29918, 29873, 353, 931, 847, 313, 29896, 29900, 3579, 313, 2435, 29898, 710, 29898, 2230, 876, 448, 29871, 29896, 29900, 876, 13, 9651, 736, 716, 29918, 29873, 13, 4706, 1683, 29901, 13, 9651, 736, 931, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 3402, 29918, 1272, 29898, 1272, 29922, 2636, 1125, 13, 4706, 716, 29918, 1272, 353, 5159, 13, 4706, 1574, 353, 6213, 13, 4706, 1018, 29901, 13, 9651, 1574, 353, 6940, 828, 29889, 29903, 264, 1988, 6268, 29889, 3166, 29918, 3126, 29898, 1272, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1209, 13, 4706, 565, 451, 1574, 29901, 13, 9651, 1018, 29901, 13, 18884, 7540, 353, 6940, 828, 29889, 29903, 264, 1988, 6816, 3745, 358, 29889, 3166, 29918, 3126, 29898, 1272, 29897, 13, 18884, 1574, 353, 6940, 828, 29889, 29903, 264, 1988, 6268, 4197, 1004, 294, 2314, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1209, 13, 4706, 565, 1574, 29901, 13, 9651, 363, 7540, 297, 1574, 29889, 26658, 1860, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 302, 353, 7540, 29889, 978, 13, 462, 1678, 325, 353, 7540, 29889, 1767, 13, 462, 1678, 260, 353, 7540, 29889, 2230, 13, 462, 1678, 260, 353, 22038, 1469, 6982, 29889, 2230, 29918, 535, 3259, 29898, 29873, 29897, 13, 462, 1678, 28730, 353, 518, 29873, 29892, 29894, 29962, 13, 462, 1678, 716, 29918, 1272, 29889, 4397, 29898, 22724, 29897, 13, 18884, 5174, 8960, 408, 321, 29901, 13, 462, 1678, 17927, 29889, 2704, 703, 2451, 297, 883, 1218, 7540, 376, 718, 851, 29898, 29872, 876, 13, 9651, 736, 716, 29918, 1272, 13, 4706, 1683, 29901, 13, 9651, 363, 1948, 297, 848, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 28730, 353, 1948, 29889, 6506, 28909, 29876, 742, 525, 2824, 17010, 2141, 5451, 28165, 1159, 13, 462, 1678, 2635, 2481, 353, 5785, 29898, 22724, 29961, 29900, 2314, 13, 462, 1678, 28730, 353, 28730, 29961, 29896, 17531, 13, 462, 1678, 28730, 353, 1051, 29898, 1958, 29898, 7411, 29892, 28730, 876, 13, 462, 1678, 28730, 29889, 7851, 29898, 29900, 29892, 2635, 2481, 29897, 13, 462, 1678, 716, 29918, 1272, 29889, 4397, 29898, 22724, 29897, 13, 18884, 5174, 8960, 408, 321, 29901, 13, 462, 1678, 17927, 29889, 2704, 703, 2451, 297, 883, 1218, 1196, 15691, 710, 29898, 798, 7240, 376, 15691, 851, 29898, 29872, 876, 13, 9651, 736, 716, 29918, 1272, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 1610, 29918, 1272, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29892, 848, 29918, 2848, 29922, 8516, 1125, 13, 4706, 848, 353, 22038, 1469, 6982, 29889, 949, 29918, 3166, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29897, 13, 4706, 565, 848, 29918, 2848, 338, 451, 6213, 322, 7431, 29898, 1272, 29897, 1405, 848, 29918, 2848, 29901, 13, 9651, 848, 353, 848, 14352, 1272, 29918, 2848, 17531, 13, 4706, 565, 7431, 29898, 1272, 29897, 1405, 29871, 29900, 29901, 13, 9651, 18111, 353, 5159, 13, 9651, 363, 474, 29892, 29894, 297, 26985, 29898, 1272, 1125, 13, 18884, 565, 376, 7192, 29908, 297, 851, 29898, 29894, 467, 13609, 580, 470, 376, 13707, 29908, 297, 851, 29898, 29894, 467, 13609, 7295, 13, 462, 1678, 18111, 29889, 4397, 29898, 29875, 29897, 13, 9651, 17927, 29889, 8382, 703, 2435, 18111, 376, 718, 851, 29898, 2435, 29898, 2248, 267, 4961, 13, 9651, 18111, 29889, 6605, 29898, 24244, 29922, 5574, 29897, 13, 9651, 363, 2380, 297, 18111, 29901, 13, 18884, 848, 29889, 7323, 29898, 2248, 29897, 13, 4706, 736, 22038, 1469, 6982, 29889, 4830, 29918, 1272, 29898, 1272, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 1610, 29918, 1272, 29918, 1609, 29918, 2230, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29892, 1369, 29918, 2230, 29892, 1095, 29918, 2230, 1125, 13, 4706, 396, 21707, 29889, 8382, 703, 2962, 931, 15691, 710, 29898, 2962, 29918, 2230, 7240, 29908, 1095, 931, 15691, 710, 29898, 355, 29918, 2230, 876, 13, 4706, 7353, 353, 7700, 13, 4706, 716, 29918, 1272, 353, 5159, 13, 4706, 565, 1369, 29918, 2230, 529, 1095, 29918, 2230, 29901, 13, 9651, 848, 353, 22038, 1469, 6982, 29889, 949, 29918, 3166, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29897, 13, 9651, 1369, 29918, 2230, 353, 938, 29898, 2962, 29918, 2230, 29897, 13, 9651, 1095, 29918, 2230, 353, 938, 29898, 355, 29918, 2230, 29897, 13, 9651, 363, 1948, 297, 848, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 784, 353, 1948, 29889, 6506, 28909, 29876, 742, 525, 2824, 17010, 2141, 5451, 28165, 1159, 13, 462, 1678, 260, 353, 5785, 29898, 1054, 29961, 29900, 2314, 13, 462, 1678, 325, 353, 5785, 29898, 1054, 29961, 29896, 2314, 13, 462, 1678, 565, 451, 7353, 322, 1369, 29918, 2230, 5277, 260, 29901, 13, 462, 4706, 7353, 353, 5852, 13, 462, 1678, 565, 7353, 322, 1095, 29918, 2230, 529, 260, 29901, 13, 462, 4706, 2867, 13, 462, 1678, 565, 7353, 29901, 13, 462, 4706, 716, 29918, 1272, 29889, 4397, 4197, 29873, 29892, 29894, 2314, 13, 18884, 5174, 8960, 408, 321, 29901, 13, 462, 1678, 17927, 29889, 2704, 703, 2451, 297, 883, 1218, 1196, 376, 718, 851, 29898, 798, 29897, 718, 376, 376, 718, 851, 29898, 29872, 876, 13, 4706, 736, 716, 29918, 1272, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 4078, 29918, 517, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29892, 11015, 29918, 1272, 29892, 4236, 29918, 1445, 29918, 2311, 29918, 29885, 1144, 10457, 29896, 29892, 26556, 29922, 8824, 1125, 13, 4706, 1018, 29901, 13, 9651, 17927, 29889, 3888, 703, 29903, 5555, 10650, 848, 304, 934, 376, 718, 851, 29898, 1445, 29918, 2084, 876, 13, 9651, 565, 26556, 29901, 13, 18884, 2030, 29918, 1272, 353, 5159, 13, 9651, 1683, 29901, 13, 18884, 2030, 29918, 1272, 353, 22038, 1469, 6982, 29889, 949, 29918, 3166, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29897, 13, 9651, 363, 2944, 297, 11015, 29918, 1272, 29901, 13, 18884, 1196, 353, 13420, 4286, 7122, 29898, 1958, 29898, 710, 29892, 2944, 7503, 29906, 12622, 718, 6634, 29876, 29908, 13, 18884, 2030, 29918, 1272, 29889, 4397, 29898, 1220, 29897, 13, 9651, 565, 4236, 29918, 1445, 29918, 2311, 29918, 29885, 1144, 1405, 29871, 29900, 29901, 13, 18884, 2030, 29918, 1272, 353, 2030, 29918, 1272, 14352, 3317, 29918, 1445, 29918, 2311, 29918, 29885, 1144, 17531, 13, 9651, 2767, 29918, 1272, 353, 5159, 13, 9651, 363, 474, 29892, 1196, 297, 26985, 29898, 1025, 29918, 1272, 1125, 13, 18884, 274, 353, 1196, 29889, 2798, 28165, 1159, 13, 18884, 565, 274, 1275, 29871, 29906, 29901, 13, 462, 1678, 269, 353, 1196, 29889, 5451, 28165, 1159, 13, 462, 1678, 286, 353, 269, 29961, 29896, 29962, 13, 462, 1678, 28241, 353, 286, 7503, 29899, 29896, 29906, 29962, 13, 462, 1678, 286, 29873, 353, 286, 14352, 29896, 29906, 17531, 13, 462, 1678, 301, 29896, 353, 518, 7411, 29898, 29879, 29961, 29900, 11724, 5785, 29898, 29324, 4638, 13, 462, 1678, 301, 29896, 353, 13420, 4286, 7122, 29898, 1958, 29898, 710, 29892, 301, 29896, 7503, 29906, 12622, 718, 6634, 29876, 29908, 13, 462, 1678, 301, 29906, 353, 518, 7411, 29898, 4378, 511, 5785, 29898, 29879, 29961, 29906, 1822, 6506, 14182, 29876, 613, 5124, 28166, 13, 462, 1678, 301, 29906, 353, 13420, 4286, 7122, 29898, 1958, 29898, 710, 29892, 301, 29906, 7503, 29906, 12622, 718, 6634, 29876, 29908, 13, 462, 1678, 2767, 29918, 1272, 29889, 4397, 4197, 29875, 29892, 301, 29896, 29892, 301, 29906, 2314, 13, 18884, 25342, 274, 2804, 29871, 29896, 29901, 13, 462, 1678, 2767, 29918, 1272, 29889, 4397, 4197, 29875, 29892, 6213, 29892, 6213, 2314, 13, 9651, 9500, 353, 29871, 29900, 13, 9651, 363, 270, 297, 2767, 29918, 1272, 29901, 13, 18884, 565, 270, 29961, 29896, 29962, 338, 451, 6213, 322, 270, 29961, 29906, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 2030, 29918, 1272, 29889, 7323, 29898, 29881, 29961, 29900, 29962, 718, 9500, 29897, 13, 462, 1678, 2030, 29918, 1272, 29889, 7851, 29898, 29881, 29961, 29900, 29962, 718, 9500, 29892, 270, 29961, 29896, 2314, 13, 462, 1678, 2030, 29918, 1272, 29889, 7851, 29898, 29881, 29961, 29900, 29962, 718, 9500, 718, 29871, 29896, 29892, 270, 29961, 29906, 2314, 13, 462, 1678, 9500, 4619, 29871, 29896, 13, 18884, 1683, 29901, 13, 462, 1678, 2030, 29918, 1272, 29889, 7323, 29898, 29881, 29961, 29900, 29962, 718, 9500, 29897, 13, 462, 1678, 9500, 22361, 29871, 29896, 13, 9651, 411, 1722, 29898, 1445, 29918, 2084, 29892, 525, 29893, 29974, 1495, 408, 934, 29901, 13, 18884, 934, 29889, 8231, 24210, 29898, 1025, 29918, 1272, 29897, 13, 9651, 934, 29889, 5358, 580, 13, 9651, 736, 5159, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 17927, 29889, 2704, 703, 26061, 304, 4078, 29918, 517, 29918, 1445, 376, 718, 851, 29898, 29872, 876, 13, 9651, 736, 11015, 29918, 1272, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 628, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 1125, 13, 4706, 1018, 29901, 13, 9651, 565, 2897, 29889, 2084, 29889, 9933, 29898, 1445, 29918, 2084, 1125, 13, 18884, 2897, 29889, 5992, 29898, 1445, 29918, 2084, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 17927, 29889, 2704, 703, 26061, 304, 628, 29918, 517, 29918, 1445, 376, 718, 851, 29898, 29872, 7240, 29908, 15691, 710, 29898, 13010, 29918, 978, 876, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 6206, 29918, 1272, 29918, 11083, 29918, 16394, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29892, 1833, 342, 29918, 16394, 1125, 13, 4706, 848, 353, 22038, 1469, 6982, 29889, 657, 29918, 1610, 29918, 1272, 29918, 1609, 29918, 2230, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29892, 1833, 342, 29918, 16394, 29892, 931, 29889, 2230, 3101, 13, 4706, 22038, 1469, 6982, 29889, 7620, 29918, 517, 29918, 1445, 29898, 1445, 29918, 2084, 29892, 11261, 29918, 978, 29892, 848, 29892, 26556, 29922, 5574, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 4078, 29918, 517, 29918, 13453, 1314, 29898, 13453, 1314, 2585, 29892, 11261, 29918, 978, 29892, 11015, 29918, 1272, 29892, 1178, 1125, 13, 4706, 1018, 29901, 13, 9651, 17927, 29889, 3888, 703, 29903, 5555, 10650, 848, 304, 4414, 1314, 376, 718, 851, 29898, 13010, 29918, 978, 876, 13, 9651, 4390, 29918, 2587, 353, 4414, 1314, 2585, 29889, 3706, 6358, 29918, 1761, 29918, 517, 29918, 13453, 1314, 29918, 3126, 29898, 1195, 1082, 29918, 1272, 29892, 11261, 29918, 978, 29892, 376, 1610, 613, 1178, 29897, 13, 9651, 565, 451, 4414, 1314, 2585, 29889, 3539, 29898, 3126, 29918, 2587, 1125, 13, 18884, 736, 11015, 29918, 1272, 13, 9651, 1683, 29901, 13, 18884, 736, 5159, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 17927, 29889, 2704, 703, 26061, 304, 4078, 29918, 517, 29918, 13453, 1314, 376, 718, 851, 29898, 29872, 876, 13, 9651, 736, 11015, 29918, 1272, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 1610, 29918, 1272, 29918, 13453, 1314, 29898, 13453, 1314, 2585, 29892, 11261, 29918, 978, 29892, 1178, 29892, 848, 29918, 2848, 29922, 8516, 1125, 13, 4706, 1369, 29918, 2230, 353, 6213, 13, 4706, 565, 848, 29918, 2848, 29901, 13, 9651, 1369, 29918, 2230, 353, 12865, 29889, 12673, 29889, 3707, 580, 448, 12865, 29889, 9346, 287, 2554, 29898, 1195, 2667, 29922, 1272, 29918, 2848, 29974, 29955, 29906, 29900, 29897, 396, 4203, 2462, 4805, 13, 4706, 848, 353, 4414, 1314, 2585, 29889, 949, 29898, 13010, 29918, 978, 29892, 376, 1610, 613, 2777, 29918, 333, 29922, 333, 29892, 1369, 29918, 2230, 29922, 2962, 29918, 2230, 29897, 13, 4706, 565, 848, 29918, 2848, 338, 451, 6213, 322, 7431, 29898, 1272, 29897, 1405, 848, 29918, 2848, 29901, 13, 9651, 848, 353, 848, 14352, 1272, 29918, 2848, 17531, 13, 4706, 565, 7431, 29898, 1272, 29897, 1405, 29871, 29900, 29901, 13, 9651, 18111, 353, 5159, 13, 9651, 363, 474, 29892, 325, 297, 26985, 29898, 1272, 1125, 13, 18884, 565, 376, 7192, 29908, 297, 851, 29898, 29894, 467, 13609, 580, 470, 376, 13707, 29908, 297, 851, 29898, 29894, 467, 13609, 7295, 13, 462, 1678, 18111, 29889, 4397, 29898, 29875, 29897, 13, 9651, 17927, 29889, 8382, 703, 2435, 18111, 376, 718, 851, 29898, 2435, 29898, 2248, 267, 4961, 13, 9651, 18111, 29889, 6605, 29898, 24244, 29922, 5574, 29897, 13, 9651, 363, 2380, 297, 18111, 29901, 13, 18884, 848, 29889, 7323, 29898, 2248, 29897, 13, 4706, 736, 848, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 1610, 29918, 1272, 29918, 1609, 29918, 2230, 29918, 13453, 1314, 29898, 13453, 1314, 2585, 29892, 11261, 29918, 978, 29892, 1369, 29918, 2230, 29892, 1095, 29918, 2230, 29892, 1178, 1125, 13, 4706, 716, 29918, 1272, 353, 5159, 13, 4706, 565, 1369, 29918, 2230, 529, 1095, 29918, 2230, 29901, 13, 9651, 716, 29918, 1272, 353, 4414, 1314, 2585, 29889, 949, 29898, 13010, 29918, 978, 29892, 376, 1610, 613, 2777, 29918, 333, 29922, 333, 29892, 1369, 29918, 2230, 29922, 2962, 29918, 2230, 29892, 1095, 29918, 2230, 29922, 355, 29918, 2230, 29897, 13, 4706, 736, 716, 29918, 1272, 2 ]
rasa/utils/io.py
chws0508/rasa
0
133978
import asyncio import filecmp import logging import os import pickle import tempfile import warnings import re from asyncio import AbstractEventLoop from pathlib import Path from typing import Text, Any, Union, List, Type, Callable, TYPE_CHECKING, Pattern import rasa.shared.constants import rasa.shared.utils.io if TYPE_CHECKING: from prompt_toolkit.validation import Validator def configure_colored_logging(loglevel: Text) -> None: import coloredlogs loglevel = loglevel or os.environ.get( rasa.shared.constants.ENV_LOG_LEVEL, rasa.shared.constants.DEFAULT_LOG_LEVEL ) field_styles = coloredlogs.DEFAULT_FIELD_STYLES.copy() field_styles["asctime"] = {} level_styles = coloredlogs.DEFAULT_LEVEL_STYLES.copy() level_styles["debug"] = {} coloredlogs.install( level=loglevel, use_chroot=False, fmt="%(asctime)s %(levelname)-8s %(name)s - %(message)s", level_styles=level_styles, field_styles=field_styles, ) def enable_async_loop_debugging( event_loop: AbstractEventLoop, slow_callback_duration: float = 0.1 ) -> AbstractEventLoop: logging.info( "Enabling coroutine debugging. Loop id {}.".format(id(asyncio.get_event_loop())) ) # Enable debugging event_loop.set_debug(True) # Make the threshold for "slow" tasks very very small for # illustration. The default is 0.1 (= 100 milliseconds). event_loop.slow_callback_duration = slow_callback_duration # Report all mistakes managing asynchronous resources. warnings.simplefilter("always", ResourceWarning) return event_loop def pickle_dump(filename: Union[Text, Path], obj: Any) -> None: """Saves object to file. Args: filename: the filename to save the object to obj: the object to store """ with open(filename, "wb") as f: pickle.dump(obj, f) def pickle_load(filename: Union[Text, Path]) -> Any: """Loads an object from a file. Args: filename: the filename to load the object from Returns: the loaded object """ with open(filename, "rb") as f: return pickle.load(f) def create_temporary_file(data: Any, suffix: Text = "", mode: Text = "w+") -> Text: """Creates a tempfile.NamedTemporaryFile object for data.""" encoding = None if "b" in mode else rasa.shared.utils.io.DEFAULT_ENCODING f = tempfile.NamedTemporaryFile( mode=mode, suffix=suffix, delete=False, encoding=encoding ) f.write(data) f.close() return f.name def create_temporary_directory() -> Text: """Creates a tempfile.TemporaryDirectory.""" f = tempfile.TemporaryDirectory() return f.name def create_path(file_path: Text) -> None: """Makes sure all directories in the 'file_path' exists.""" parent_dir = os.path.dirname(os.path.abspath(file_path)) if not os.path.exists(parent_dir): os.makedirs(parent_dir) def file_type_validator( valid_file_types: List[Text], error_message: Text ) -> Type["Validator"]: """Creates a `Validator` class which can be used with `questionary` to validate file paths. """ def is_valid(path: Text) -> bool: return path is not None and any( [path.endswith(file_type) for file_type in valid_file_types] ) return create_validator(is_valid, error_message) def not_empty_validator(error_message: Text) -> Type["Validator"]: """Creates a `Validator` class which can be used with `questionary` to validate that the user entered something other than whitespace. """ def is_valid(input: Text) -> bool: return input is not None and input.strip() != "" return create_validator(is_valid, error_message) def create_validator( function: Callable[[Text], bool], error_message: Text ) -> Type["Validator"]: """Helper method to create `Validator` classes from callable functions. Should be removed when questionary supports `Validator` objects.""" from prompt_toolkit.validation import Validator, ValidationError from prompt_toolkit.document import Document class FunctionValidator(Validator): @staticmethod def validate(document: Document) -> None: is_valid = function(document.text) if not is_valid: raise ValidationError(message=error_message) return FunctionValidator def json_unpickle( file_name: Union[Text, Path], encode_non_string_keys: bool = False ) -> Any: """Unpickle an object from file using json. Args: file_name: the file to load the object from encode_non_string_keys: If set to `True` then jsonpickle will encode non-string dictionary keys instead of coercing them into strings via `repr()`. Returns: the object """ import jsonpickle.ext.numpy as jsonpickle_numpy import jsonpickle jsonpickle_numpy.register_handlers() file_content = rasa.shared.utils.io.read_file(file_name) return jsonpickle.loads(file_content, keys=encode_non_string_keys) def json_pickle( file_name: Union[Text, Path], obj: Any, encode_non_string_keys: bool = False ) -> None: """Pickle an object to a file using json. Args: file_name: the file to store the object to obj: the object to store encode_non_string_keys: If set to `True` then jsonpickle will encode non-string dictionary keys instead of coercing them into strings via `repr()`. """ import jsonpickle.ext.numpy as jsonpickle_numpy import jsonpickle jsonpickle_numpy.register_handlers() rasa.shared.utils.io.write_text_file( jsonpickle.dumps(obj, keys=encode_non_string_keys), file_name ) def get_emoji_regex() -> Pattern: """Returns regex to identify emojis.""" return re.compile( "[" "\U0001F600-\U0001F64F" # emoticons "\U0001F300-\U0001F5FF" # symbols & pictographs "\U0001F680-\U0001F6FF" # transport & map symbols "\U0001F1E0-\U0001F1FF" # flags (iOS) "\U00002702-\U000027B0" "\U000024C2-\U0001F251" "\u200d" # zero width joiner "\u200c" # zero width non-joiner "]+", flags=re.UNICODE, ) def are_directories_equal(dir1: Path, dir2: Path) -> bool: """Compares two directories recursively. Files in each directory are assumed to be equal if their names and contents are equal. Args: dir1: The first directory. dir2: The second directory. Returns: `True` if they are equal, `False` otherwise. """ dirs_cmp = filecmp.dircmp(dir1, dir2) if dirs_cmp.left_only or dirs_cmp.right_only: return False (_, mismatches, errors) = filecmp.cmpfiles( dir1, dir2, dirs_cmp.common_files, shallow=False ) if mismatches or errors: return False for common_dir in dirs_cmp.common_dirs: new_dir1 = Path(dir1, common_dir) new_dir2 = Path(dir2, common_dir) is_equal = are_directories_equal(new_dir1, new_dir2) if not is_equal: return False return True
[ 1, 1053, 408, 948, 3934, 13, 5215, 934, 21058, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 5839, 280, 13, 5215, 5694, 1445, 13, 5215, 18116, 13, 5215, 337, 13, 3166, 408, 948, 3934, 1053, 25513, 2624, 18405, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 19229, 1053, 3992, 29892, 3139, 29892, 7761, 29892, 2391, 29892, 5167, 29892, 8251, 519, 29892, 323, 6959, 29918, 3210, 16658, 4214, 29892, 25860, 13, 13, 5215, 364, 11290, 29889, 12366, 29889, 3075, 1934, 13, 5215, 364, 11290, 29889, 12366, 29889, 13239, 29889, 601, 13, 13, 361, 323, 6959, 29918, 3210, 16658, 4214, 29901, 13, 1678, 515, 9508, 29918, 10154, 7354, 29889, 18157, 1053, 15758, 1061, 13, 13, 13, 1753, 10822, 29918, 2780, 287, 29918, 21027, 29898, 1188, 5563, 29901, 3992, 29897, 1599, 6213, 29901, 13, 1678, 1053, 28684, 20756, 13, 13, 1678, 1480, 5563, 353, 1480, 5563, 470, 2897, 29889, 21813, 29889, 657, 29898, 13, 4706, 364, 11290, 29889, 12366, 29889, 3075, 1934, 29889, 25838, 29918, 14480, 29918, 1307, 29963, 6670, 29892, 364, 11290, 29889, 12366, 29889, 3075, 1934, 29889, 23397, 29918, 14480, 29918, 1307, 29963, 6670, 13, 1678, 1723, 13, 13, 1678, 1746, 29918, 9783, 353, 28684, 20756, 29889, 23397, 29918, 3738, 27286, 29918, 1254, 29979, 17101, 29889, 8552, 580, 13, 1678, 1746, 29918, 9783, 3366, 294, 312, 603, 3108, 353, 6571, 13, 1678, 3233, 29918, 9783, 353, 28684, 20756, 29889, 23397, 29918, 1307, 29963, 6670, 29918, 1254, 29979, 17101, 29889, 8552, 580, 13, 1678, 3233, 29918, 9783, 3366, 8382, 3108, 353, 6571, 13, 1678, 28684, 20756, 29889, 6252, 29898, 13, 4706, 3233, 29922, 1188, 5563, 29892, 13, 4706, 671, 29918, 305, 4632, 29922, 8824, 29892, 13, 4706, 19200, 543, 29995, 29898, 294, 312, 603, 29897, 29879, 1273, 29898, 5563, 978, 6817, 29947, 29879, 1273, 29898, 978, 29897, 29879, 29871, 448, 1273, 29898, 4906, 29897, 29879, 613, 13, 4706, 3233, 29918, 9783, 29922, 5563, 29918, 9783, 29892, 13, 4706, 1746, 29918, 9783, 29922, 2671, 29918, 9783, 29892, 13, 1678, 1723, 13, 13, 13, 1753, 9025, 29918, 12674, 29918, 7888, 29918, 8382, 3460, 29898, 13, 1678, 1741, 29918, 7888, 29901, 25513, 2624, 18405, 29892, 5232, 29918, 14035, 29918, 19708, 29901, 5785, 353, 29871, 29900, 29889, 29896, 13, 29897, 1599, 25513, 2624, 18405, 29901, 13, 1678, 12183, 29889, 3888, 29898, 13, 4706, 376, 2369, 17961, 1034, 449, 457, 13490, 29889, 21493, 1178, 6571, 1213, 29889, 4830, 29898, 333, 29898, 294, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 22130, 13, 1678, 1723, 13, 13, 1678, 396, 1174, 519, 13490, 13, 1678, 1741, 29918, 7888, 29889, 842, 29918, 8382, 29898, 5574, 29897, 13, 13, 1678, 396, 8561, 278, 16897, 363, 376, 28544, 29908, 9595, 1407, 1407, 2319, 363, 13, 1678, 396, 8632, 362, 29889, 450, 2322, 338, 29871, 29900, 29889, 29896, 11070, 29871, 29896, 29900, 29900, 3533, 21462, 467, 13, 1678, 1741, 29918, 7888, 29889, 28544, 29918, 14035, 29918, 19708, 353, 5232, 29918, 14035, 29918, 19708, 13, 13, 1678, 396, 13969, 599, 28947, 767, 6751, 20489, 7788, 29889, 13, 1678, 18116, 29889, 12857, 4572, 703, 21936, 613, 18981, 22709, 29897, 13, 1678, 736, 1741, 29918, 7888, 13, 13, 13, 1753, 5839, 280, 29918, 15070, 29898, 9507, 29901, 7761, 29961, 1626, 29892, 10802, 1402, 5446, 29901, 3139, 29897, 1599, 6213, 29901, 13, 1678, 9995, 29903, 5989, 1203, 304, 934, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 10422, 29901, 278, 10422, 304, 4078, 278, 1203, 304, 13, 4706, 5446, 29901, 278, 1203, 304, 3787, 13, 1678, 9995, 13, 1678, 411, 1722, 29898, 9507, 29892, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 4706, 5839, 280, 29889, 15070, 29898, 5415, 29892, 285, 29897, 13, 13, 13, 1753, 5839, 280, 29918, 1359, 29898, 9507, 29901, 7761, 29961, 1626, 29892, 10802, 2314, 1599, 3139, 29901, 13, 1678, 9995, 5896, 29879, 385, 1203, 515, 263, 934, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 10422, 29901, 278, 10422, 304, 2254, 278, 1203, 515, 13, 13, 1678, 16969, 29901, 278, 7500, 1203, 13, 1678, 9995, 13, 1678, 411, 1722, 29898, 9507, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 4706, 736, 5839, 280, 29889, 1359, 29898, 29888, 29897, 13, 13, 13, 1753, 1653, 29918, 1356, 1971, 653, 29918, 1445, 29898, 1272, 29901, 3139, 29892, 25557, 29901, 3992, 353, 12633, 4464, 29901, 3992, 353, 376, 29893, 29974, 1159, 1599, 3992, 29901, 13, 1678, 9995, 9832, 1078, 263, 5694, 1445, 29889, 22175, 5776, 1971, 653, 2283, 1203, 363, 848, 1213, 15945, 13, 1678, 8025, 353, 6213, 565, 376, 29890, 29908, 297, 4464, 1683, 364, 11290, 29889, 12366, 29889, 13239, 29889, 601, 29889, 23397, 29918, 1430, 3217, 29928, 4214, 13, 1678, 285, 353, 5694, 1445, 29889, 22175, 5776, 1971, 653, 2283, 29898, 13, 4706, 4464, 29922, 8513, 29892, 25557, 29922, 2146, 600, 861, 29892, 5217, 29922, 8824, 29892, 8025, 29922, 22331, 13, 1678, 1723, 13, 1678, 285, 29889, 3539, 29898, 1272, 29897, 13, 13, 1678, 285, 29889, 5358, 580, 13, 1678, 736, 285, 29889, 978, 13, 13, 13, 1753, 1653, 29918, 1356, 1971, 653, 29918, 12322, 580, 1599, 3992, 29901, 13, 1678, 9995, 9832, 1078, 263, 5694, 1445, 29889, 5776, 1971, 653, 9882, 1213, 15945, 13, 1678, 285, 353, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 13, 1678, 736, 285, 29889, 978, 13, 13, 13, 1753, 1653, 29918, 2084, 29898, 1445, 29918, 2084, 29901, 3992, 29897, 1599, 6213, 29901, 13, 1678, 9995, 29924, 6926, 1854, 599, 17525, 297, 278, 525, 1445, 29918, 2084, 29915, 4864, 1213, 15945, 13, 13, 1678, 3847, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 1445, 29918, 2084, 876, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 3560, 29918, 3972, 1125, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 3560, 29918, 3972, 29897, 13, 13, 13, 1753, 934, 29918, 1853, 29918, 3084, 1061, 29898, 13, 1678, 2854, 29918, 1445, 29918, 8768, 29901, 2391, 29961, 1626, 1402, 1059, 29918, 4906, 29901, 3992, 13, 29897, 1599, 5167, 3366, 24204, 3108, 29901, 13, 1678, 9995, 9832, 1078, 263, 421, 24204, 29952, 770, 607, 508, 367, 1304, 411, 421, 12470, 653, 29952, 304, 12725, 13, 1678, 934, 10898, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 338, 29918, 3084, 29898, 2084, 29901, 3992, 29897, 1599, 6120, 29901, 13, 4706, 736, 2224, 338, 451, 6213, 322, 738, 29898, 13, 9651, 518, 2084, 29889, 1975, 2541, 29898, 1445, 29918, 1853, 29897, 363, 934, 29918, 1853, 297, 2854, 29918, 1445, 29918, 8768, 29962, 13, 4706, 1723, 13, 13, 1678, 736, 1653, 29918, 3084, 1061, 29898, 275, 29918, 3084, 29892, 1059, 29918, 4906, 29897, 13, 13, 13, 1753, 451, 29918, 6310, 29918, 3084, 1061, 29898, 2704, 29918, 4906, 29901, 3992, 29897, 1599, 5167, 3366, 24204, 3108, 29901, 13, 1678, 9995, 9832, 1078, 263, 421, 24204, 29952, 770, 607, 508, 367, 1304, 411, 421, 12470, 653, 29952, 304, 12725, 13, 1678, 393, 278, 1404, 7802, 1554, 916, 1135, 24358, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 338, 29918, 3084, 29898, 2080, 29901, 3992, 29897, 1599, 6120, 29901, 13, 4706, 736, 1881, 338, 451, 6213, 322, 1881, 29889, 17010, 580, 2804, 5124, 13, 13, 1678, 736, 1653, 29918, 3084, 1061, 29898, 275, 29918, 3084, 29892, 1059, 29918, 4906, 29897, 13, 13, 13, 1753, 1653, 29918, 3084, 1061, 29898, 13, 1678, 740, 29901, 8251, 519, 8999, 1626, 1402, 6120, 1402, 1059, 29918, 4906, 29901, 3992, 13, 29897, 1599, 5167, 3366, 24204, 3108, 29901, 13, 1678, 9995, 10739, 1158, 304, 1653, 421, 24204, 29952, 4413, 515, 1246, 519, 3168, 29889, 10575, 367, 13, 1678, 6206, 746, 1139, 653, 11286, 421, 24204, 29952, 3618, 1213, 15945, 13, 13, 1678, 515, 9508, 29918, 10154, 7354, 29889, 18157, 1053, 15758, 1061, 29892, 15758, 362, 2392, 13, 1678, 515, 9508, 29918, 10154, 7354, 29889, 3225, 1053, 10854, 13, 13, 1678, 770, 6680, 24204, 29898, 24204, 1125, 13, 4706, 732, 7959, 5696, 13, 4706, 822, 12725, 29898, 3225, 29901, 10854, 29897, 1599, 6213, 29901, 13, 9651, 338, 29918, 3084, 353, 740, 29898, 3225, 29889, 726, 29897, 13, 9651, 565, 451, 338, 29918, 3084, 29901, 13, 18884, 12020, 15758, 362, 2392, 29898, 4906, 29922, 2704, 29918, 4906, 29897, 13, 13, 1678, 736, 6680, 24204, 13, 13, 13, 1753, 4390, 29918, 348, 23945, 280, 29898, 13, 1678, 934, 29918, 978, 29901, 7761, 29961, 1626, 29892, 10802, 1402, 19750, 29918, 5464, 29918, 1807, 29918, 8149, 29901, 6120, 353, 7700, 13, 29897, 1599, 3139, 29901, 13, 1678, 9995, 2525, 23945, 280, 385, 1203, 515, 934, 773, 4390, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 934, 29918, 978, 29901, 278, 934, 304, 2254, 278, 1203, 515, 13, 4706, 19750, 29918, 5464, 29918, 1807, 29918, 8149, 29901, 960, 731, 304, 421, 5574, 29952, 769, 4390, 23945, 280, 674, 19750, 1661, 29899, 1807, 13, 3986, 8600, 6611, 2012, 310, 1302, 261, 3277, 963, 964, 6031, 3025, 421, 276, 558, 13595, 13, 13, 1678, 16969, 29901, 278, 1203, 13, 1678, 9995, 13, 1678, 1053, 4390, 23945, 280, 29889, 1062, 29889, 23749, 408, 4390, 23945, 280, 29918, 23749, 13, 1678, 1053, 4390, 23945, 280, 13, 13, 1678, 4390, 23945, 280, 29918, 23749, 29889, 9573, 29918, 3179, 9306, 580, 13, 13, 1678, 934, 29918, 3051, 353, 364, 11290, 29889, 12366, 29889, 13239, 29889, 601, 29889, 949, 29918, 1445, 29898, 1445, 29918, 978, 29897, 13, 1678, 736, 4390, 23945, 280, 29889, 18132, 29898, 1445, 29918, 3051, 29892, 6611, 29922, 12508, 29918, 5464, 29918, 1807, 29918, 8149, 29897, 13, 13, 13, 1753, 4390, 29918, 23945, 280, 29898, 13, 1678, 934, 29918, 978, 29901, 7761, 29961, 1626, 29892, 10802, 1402, 5446, 29901, 3139, 29892, 19750, 29918, 5464, 29918, 1807, 29918, 8149, 29901, 6120, 353, 7700, 13, 29897, 1599, 6213, 29901, 13, 1678, 9995, 29925, 860, 280, 385, 1203, 304, 263, 934, 773, 4390, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 934, 29918, 978, 29901, 278, 934, 304, 3787, 278, 1203, 304, 13, 4706, 5446, 29901, 278, 1203, 304, 3787, 13, 4706, 19750, 29918, 5464, 29918, 1807, 29918, 8149, 29901, 960, 731, 304, 421, 5574, 29952, 769, 4390, 23945, 280, 674, 19750, 1661, 29899, 1807, 13, 3986, 8600, 6611, 2012, 310, 1302, 261, 3277, 963, 964, 6031, 3025, 421, 276, 558, 13595, 13, 1678, 9995, 13, 1678, 1053, 4390, 23945, 280, 29889, 1062, 29889, 23749, 408, 4390, 23945, 280, 29918, 23749, 13, 1678, 1053, 4390, 23945, 280, 13, 13, 1678, 4390, 23945, 280, 29918, 23749, 29889, 9573, 29918, 3179, 9306, 580, 13, 13, 1678, 364, 11290, 29889, 12366, 29889, 13239, 29889, 601, 29889, 3539, 29918, 726, 29918, 1445, 29898, 13, 4706, 4390, 23945, 280, 29889, 29881, 17204, 29898, 5415, 29892, 6611, 29922, 12508, 29918, 5464, 29918, 1807, 29918, 8149, 511, 934, 29918, 978, 13, 1678, 1723, 13, 13, 13, 1753, 679, 29918, 15810, 2397, 29918, 13087, 580, 1599, 25860, 29901, 13, 1678, 9995, 11609, 29879, 6528, 304, 12439, 953, 3848, 275, 1213, 15945, 13, 1678, 736, 337, 29889, 12198, 29898, 13, 4706, 376, 3366, 13, 4706, 6634, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 29900, 29900, 2612, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 29946, 29943, 29908, 29871, 396, 953, 13574, 787, 13, 4706, 6634, 29965, 29900, 29900, 29900, 29896, 29943, 29941, 29900, 29900, 2612, 29965, 29900, 29900, 29900, 29896, 29943, 29945, 4198, 29908, 29871, 396, 15072, 669, 282, 919, 1946, 29879, 13, 4706, 6634, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 29947, 29900, 2612, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 4198, 29908, 29871, 396, 8608, 669, 2910, 15072, 13, 4706, 6634, 29965, 29900, 29900, 29900, 29896, 29943, 29896, 29923, 29900, 2612, 29965, 29900, 29900, 29900, 29896, 29943, 29896, 4198, 29908, 29871, 396, 13449, 313, 29875, 3267, 29897, 13, 4706, 6634, 29965, 29900, 29900, 29900, 29900, 29906, 29955, 29900, 29906, 2612, 29965, 29900, 29900, 29900, 29900, 29906, 29955, 29933, 29900, 29908, 13, 4706, 6634, 29965, 29900, 29900, 29900, 29900, 29906, 29946, 29907, 29906, 2612, 29965, 29900, 29900, 29900, 29896, 29943, 29906, 29945, 29896, 29908, 13, 4706, 6634, 29884, 29906, 29900, 29900, 29881, 29908, 29871, 396, 5225, 2920, 2958, 4983, 13, 4706, 6634, 29884, 29906, 29900, 29900, 29883, 29908, 29871, 396, 5225, 2920, 1661, 29899, 2212, 4983, 13, 4706, 376, 10062, 613, 13, 4706, 13449, 29922, 276, 29889, 3904, 2965, 29949, 2287, 29892, 13, 1678, 1723, 13, 13, 13, 1753, 526, 29918, 11851, 3842, 29918, 11745, 29898, 3972, 29896, 29901, 10802, 29892, 4516, 29906, 29901, 10802, 29897, 1599, 6120, 29901, 13, 1678, 9995, 1523, 862, 267, 1023, 17525, 8304, 3598, 29889, 13, 13, 1678, 12745, 297, 1269, 3884, 526, 13, 1678, 12023, 304, 367, 5186, 565, 1009, 2983, 322, 8118, 526, 5186, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 4516, 29896, 29901, 450, 937, 3884, 29889, 13, 4706, 4516, 29906, 29901, 450, 1473, 3884, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 421, 5574, 29952, 565, 896, 526, 5186, 29892, 421, 8824, 29952, 6467, 29889, 13, 1678, 9995, 13, 1678, 4516, 29879, 29918, 21058, 353, 934, 21058, 29889, 29881, 2076, 1526, 29898, 3972, 29896, 29892, 4516, 29906, 29897, 13, 1678, 565, 4516, 29879, 29918, 21058, 29889, 1563, 29918, 6194, 470, 4516, 29879, 29918, 21058, 29889, 1266, 29918, 6194, 29901, 13, 4706, 736, 7700, 13, 13, 1678, 313, 3383, 29635, 267, 29892, 4436, 29897, 353, 934, 21058, 29889, 21058, 5325, 29898, 13, 4706, 4516, 29896, 29892, 4516, 29906, 29892, 4516, 29879, 29918, 21058, 29889, 9435, 29918, 5325, 29892, 4091, 340, 29922, 8824, 13, 1678, 1723, 13, 13, 1678, 565, 29635, 267, 470, 4436, 29901, 13, 4706, 736, 7700, 13, 13, 1678, 363, 3619, 29918, 3972, 297, 4516, 29879, 29918, 21058, 29889, 9435, 29918, 3972, 29879, 29901, 13, 4706, 716, 29918, 3972, 29896, 353, 10802, 29898, 3972, 29896, 29892, 3619, 29918, 3972, 29897, 13, 4706, 716, 29918, 3972, 29906, 353, 10802, 29898, 3972, 29906, 29892, 3619, 29918, 3972, 29897, 13, 13, 4706, 338, 29918, 11745, 353, 526, 29918, 11851, 3842, 29918, 11745, 29898, 1482, 29918, 3972, 29896, 29892, 716, 29918, 3972, 29906, 29897, 13, 4706, 565, 451, 338, 29918, 11745, 29901, 13, 9651, 736, 7700, 13, 13, 1678, 736, 5852, 13, 2 ]
mosaic_letter.py
ryhoh/mosaicDesigner_py
0
88866
<gh_stars>0 ''' mosaic_letter.py Created by <NAME> on 2018/01/04. Copyright © 2018年 <NAME>. All rights reserved. モザイク文字画像の情報を持つクラス - フィールド - colors 整数リスト:使用するカラーコード(背景,色1,色2) - gridSize 整数:モザイクのグリッドの大きさ - grid_parameter np配列:背景の部分を0,色ありの部分を1で表現 - grid_pattern np配列:gridの各部分の色を指定 - メソッド - __init__ フィールドへ代入 - input 標準入力から色とグリッドの大きさとパターンを入力 - mask parameterが0でない部分は,patternの色を保持 parameterが0の部分は,patternに背景色を入れる - output bmp形式で出力 ''' import struct import numpy as np class MosaicLetter: def __init__(self): self.colors = list() self.gridSize = None self.grid_parameter = list() self.grid_pattern = list() self.input() # 入力を受ける def input(self): print("First, input 3 colorcodes.") for i in range(3): self.colors.append(int(input(), base=16)) print("Second, input size of grid.") self.gridSize = int(input()) print("Third, input grid parameter.") for i in range(self.gridSize): self.grid_parameter.append([int(j) for j in input()]) self.grid_parameter = np.array(self.grid_parameter) print("Finally, input grid pattern.") for i in range(self.gridSize): self.grid_pattern.append([int(j) for j in input()]) self.grid_pattern = np.array(self.grid_pattern) def mask(self): # grid_parameterに基づいてgrid_patternを編集する # grid_parameter[i][j]が0ならgrid_pattern[i][j]も0 # grid_parameter[i][j]が1ならgrid_pattern[i][j]はそのまま self.grid_pattern *= self.grid_parameter def output(self, name="output.bmp"): # 定数 FILEHEADER = 14 # ファイルヘッダの大きさ INFOHEADER = 12 # 情報ヘッダの大きさ SQUARESIZE = 32 # 小さな正方形の一辺の長さ FRAMETHICK = 1 # 縁取りの線の厚さ IMAGE_LEN = SQUARESIZE * self.gridSize # 画像の1辺の長さ # 書き込み with open(name, "wb") as f: # 符号なし4byte整数を書き込む関数 writeInt = (lambda x: f.write(struct.pack("I", x))) writeShort = (lambda x: f.write(struct.pack("H", x))) writeByte = (lambda x: f.write(struct.pack("B", x))) # ファイルヘッダ ---------------- f.write(struct.pack("BB", ord("B"), ord("M"))) # ファイルヘッダ # ファイルサイズ(4bit=1/2byteの画像であるので画素数を1/2する) writeInt(FILEHEADER + INFOHEADER+ 3*16 + IMAGE_LEN**2 // 2) writeInt(0) # 予約領域 # 先頭から画像までのオフセット = ファイルヘッダ + 情報ヘッダ + パレットデータ writeInt(FILEHEADER + INFOHEADER + 3*16) # 情報ヘッダ ---------------- writeInt(INFOHEADER) # 情報ヘッダの大きさ writeShort(IMAGE_LEN) # 縦横の長さ writeShort(IMAGE_LEN) # 正方形なので同じ数値を2つ writeShort(1) # bcプレーン数(?)は常に1 writeShort(4) # 画像の色数(4bit) # パレットデータ ---------------- # 最初の3色にcolorsのデータを入れ、残りは0に設定 for color in self.colors: # リトルエンディアンで1byteずつ書き込む writeByte(color & 0x0000FF) writeByte((color & 0x00FF00) >> 8) writeByte((color & 0xFF0000) >> 16) for i in range(16 - len(self.colors)): for j in range(3): writeByte(0) # 画像データ ---------------- # 1Byteに2pixelのデータが入ることに注意 # 画像データは左下から右上に記録される # 縁の内外を判定して書き込み ------------------------------------- def checkAndWrite(v_i, v_j, h_i, h_j): if FRAMETHICK <= v_j < SQUARESIZE-FRAMETHICK \ and FRAMETHICK <= h_j < SQUARESIZE-FRAMETHICK: # 縁の内側 data = self.grid_pattern[self.gridSize - v_i - 1][h_i] \ + (self.grid_pattern[self.gridSize - v_i - 1][h_i] << 4) else: # 縁 data = 0 # 書き込み writeByte(data) # ----------------------------------------------------------- for v_i in range(self.gridSize): # 縦のパターンの数だけループ for v_j in range(SQUARESIZE): # 小さい正方形の縦の長さだけループ for h_i in range(self.gridSize): # 横のパターンの数だけループ for h_j in range(SQUARESIZE // 2): # 小さい正方形の横の長さ/2だけループ # 1byteに2画素書き込むためループ数を1/2とする checkAndWrite(v_i, v_j, h_i, h_j) if __name__ == '__main__': ml = MosaicLetter() ml.mask() ml.output()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 12008, 13, 1678, 286, 3628, 293, 29918, 15670, 29889, 2272, 13, 13, 1678, 6760, 630, 491, 529, 5813, 29958, 373, 29871, 29906, 29900, 29896, 29947, 29914, 29900, 29896, 29914, 29900, 29946, 29889, 13, 1678, 14187, 1266, 29871, 30211, 29871, 29906, 29900, 29896, 29947, 30470, 529, 5813, 15513, 2178, 10462, 21676, 29889, 13, 13, 268, 30761, 31123, 30260, 30305, 30333, 30578, 31046, 31551, 30199, 30993, 31519, 30396, 31695, 30773, 30305, 30281, 30255, 13, 13, 1678, 448, 29871, 30423, 30532, 30185, 30258, 30335, 13, 4706, 448, 11955, 29871, 233, 152, 183, 30354, 30303, 30255, 30279, 30383, 30785, 30406, 30427, 30332, 30439, 30281, 30185, 30459, 30185, 30335, 30419, 235, 134, 143, 31495, 30214, 31085, 29896, 30214, 31085, 29906, 30409, 13, 4706, 448, 6856, 3505, 259, 233, 152, 183, 30354, 30383, 30761, 31123, 30260, 30305, 30199, 30521, 30303, 30317, 30335, 30199, 30257, 30538, 30566, 13, 4706, 448, 6856, 29918, 15501, 29871, 7442, 31361, 31025, 30383, 235, 134, 143, 31495, 30199, 30636, 30748, 30396, 29900, 30214, 31085, 30641, 30453, 30199, 30636, 30748, 30396, 29896, 30499, 30746, 31928, 13, 4706, 448, 6856, 29918, 11037, 259, 7442, 31361, 31025, 30383, 7720, 30199, 232, 147, 135, 30636, 30748, 30199, 31085, 30396, 31084, 30495, 13, 1678, 448, 29871, 30604, 31051, 30317, 30335, 13, 4706, 448, 4770, 2344, 1649, 259, 30423, 30532, 30185, 30258, 30335, 31388, 30690, 30752, 13, 4706, 448, 1881, 418, 233, 171, 156, 233, 189, 153, 30752, 31074, 30412, 30513, 31085, 30364, 30521, 30303, 30317, 30335, 30199, 30257, 30538, 30566, 30364, 30715, 30369, 30185, 30203, 30396, 30752, 31074, 13, 4706, 448, 11105, 418, 3443, 30458, 29900, 30499, 30371, 30298, 30636, 30748, 30449, 30214, 11037, 30199, 31085, 30396, 30982, 31695, 13, 462, 1678, 3443, 30458, 29900, 30199, 30636, 30748, 30449, 30214, 11037, 30353, 235, 134, 143, 31495, 31085, 30396, 30752, 30553, 30332, 13, 4706, 448, 1962, 1678, 289, 1526, 31305, 30607, 30499, 30544, 31074, 13, 12008, 13, 13, 5215, 2281, 13, 5215, 12655, 408, 7442, 13, 13, 1990, 341, 3628, 293, 12024, 357, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 13, 4706, 1583, 29889, 27703, 353, 1051, 580, 13, 4706, 1583, 29889, 7720, 3505, 353, 6213, 13, 4706, 1583, 29889, 7720, 29918, 15501, 353, 1051, 580, 13, 4706, 1583, 29889, 7720, 29918, 11037, 353, 1051, 580, 13, 13, 4706, 1583, 29889, 2080, 580, 396, 29871, 30752, 31074, 30396, 232, 146, 154, 30807, 30332, 13, 13, 1678, 822, 1881, 29898, 1311, 1125, 13, 4706, 1596, 703, 6730, 29892, 1881, 29871, 29941, 2927, 18137, 23157, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 9651, 1583, 29889, 27703, 29889, 4397, 29898, 524, 29898, 2080, 3285, 2967, 29922, 29896, 29953, 876, 13, 13, 4706, 1596, 703, 11863, 29892, 1881, 2159, 310, 6856, 23157, 13, 4706, 1583, 29889, 7720, 3505, 353, 938, 29898, 2080, 3101, 13, 13, 4706, 1596, 703, 1349, 1823, 29892, 1881, 6856, 3443, 23157, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 7720, 3505, 1125, 13, 9651, 1583, 29889, 7720, 29918, 15501, 29889, 4397, 4197, 524, 29898, 29926, 29897, 363, 432, 297, 1881, 580, 2314, 13, 4706, 1583, 29889, 7720, 29918, 15501, 353, 7442, 29889, 2378, 29898, 1311, 29889, 7720, 29918, 15501, 29897, 13, 13, 4706, 1596, 703, 12881, 635, 29892, 1881, 6856, 4766, 23157, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 29889, 7720, 3505, 1125, 13, 9651, 1583, 29889, 7720, 29918, 11037, 29889, 4397, 4197, 524, 29898, 29926, 29897, 363, 432, 297, 1881, 580, 2314, 13, 4706, 1583, 29889, 7720, 29918, 11037, 353, 7442, 29889, 2378, 29898, 1311, 29889, 7720, 29918, 11037, 29897, 13, 13, 1678, 822, 11105, 29898, 1311, 1125, 13, 4706, 396, 6856, 29918, 15501, 30353, 31359, 230, 132, 168, 30298, 30466, 7720, 29918, 11037, 30396, 31442, 30893, 30427, 30332, 13, 4706, 396, 6856, 29918, 15501, 29961, 29875, 3816, 29926, 29962, 30458, 29900, 30371, 30513, 7720, 29918, 11037, 29961, 29875, 3816, 29926, 29962, 30723, 29900, 13, 4706, 396, 6856, 29918, 15501, 29961, 29875, 3816, 29926, 29962, 30458, 29896, 30371, 30513, 7720, 29918, 11037, 29961, 29875, 3816, 29926, 29962, 30449, 31110, 30199, 30441, 30441, 13, 4706, 1583, 29889, 7720, 29918, 11037, 334, 29922, 1583, 29889, 7720, 29918, 15501, 13, 13, 1678, 822, 1962, 29898, 1311, 29892, 1024, 543, 4905, 29889, 29890, 1526, 29908, 1125, 13, 13, 4706, 396, 29871, 30495, 30354, 13, 4706, 24080, 23252, 1001, 353, 29871, 29896, 29946, 396, 29871, 30423, 30897, 30260, 30258, 230, 134, 155, 30317, 30617, 30199, 30257, 30538, 30566, 13, 4706, 15233, 23252, 1001, 353, 29871, 29896, 29906, 396, 29871, 30993, 31519, 230, 134, 155, 30317, 30617, 30199, 30257, 30538, 30566, 13, 4706, 317, 13356, 29909, 1525, 14226, 353, 29871, 29941, 29906, 396, 29871, 30446, 30566, 30371, 30724, 30525, 31305, 30199, 30287, 235, 193, 189, 30199, 30899, 30566, 13, 4706, 383, 4717, 2303, 4690, 2965, 29968, 353, 29871, 29896, 29871, 396, 29871, 234, 187, 132, 30683, 30453, 30199, 31357, 30199, 232, 145, 157, 30566, 13, 4706, 306, 1529, 1692, 29918, 1307, 29940, 353, 317, 13356, 29909, 1525, 14226, 334, 1583, 29889, 7720, 3505, 29871, 396, 29871, 31046, 31551, 30199, 29896, 235, 193, 189, 30199, 30899, 30566, 13, 13, 4706, 396, 29871, 30854, 30538, 235, 193, 191, 30735, 13, 4706, 411, 1722, 29898, 978, 29892, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 9651, 396, 29871, 31277, 30850, 30371, 30326, 29946, 10389, 233, 152, 183, 30354, 30396, 30854, 30538, 235, 193, 191, 31834, 31606, 30354, 13, 9651, 2436, 2928, 353, 313, 2892, 921, 29901, 285, 29889, 3539, 29898, 4984, 29889, 4058, 703, 29902, 613, 921, 4961, 13, 9651, 2436, 21322, 353, 313, 2892, 921, 29901, 285, 29889, 3539, 29898, 4984, 29889, 4058, 703, 29950, 613, 921, 4961, 13, 9651, 2436, 12901, 353, 313, 2892, 921, 29901, 285, 29889, 3539, 29898, 4984, 29889, 4058, 703, 29933, 613, 921, 4961, 13, 13, 9651, 396, 29871, 30423, 30897, 30260, 30258, 230, 134, 155, 30317, 30617, 448, 9072, 5634, 13, 9651, 285, 29889, 3539, 29898, 4984, 29889, 4058, 703, 14388, 613, 4356, 703, 29933, 4968, 4356, 703, 29924, 29908, 4961, 29871, 396, 29871, 30423, 30897, 30260, 30258, 230, 134, 155, 30317, 30617, 13, 9651, 396, 29871, 30423, 30897, 30260, 30258, 30615, 30260, 30719, 30419, 29946, 2966, 29922, 29896, 29914, 29906, 10389, 30199, 31046, 31551, 30499, 30641, 30332, 30199, 30499, 31046, 31605, 30354, 30396, 29896, 29914, 29906, 30427, 30332, 30409, 13, 9651, 2436, 2928, 29898, 7724, 23252, 1001, 718, 15233, 23252, 1001, 29974, 29871, 29941, 29930, 29896, 29953, 718, 306, 1529, 1692, 29918, 1307, 29940, 1068, 29906, 849, 29871, 29906, 29897, 13, 9651, 2436, 2928, 29898, 29900, 29897, 396, 29871, 231, 189, 139, 234, 183, 135, 236, 163, 155, 232, 162, 162, 13, 9651, 396, 29871, 31244, 31876, 30412, 30513, 31046, 31551, 30441, 30499, 30199, 30514, 30423, 30885, 30317, 30279, 353, 29871, 30423, 30897, 30260, 30258, 230, 134, 155, 30317, 30617, 718, 29871, 30993, 31519, 230, 134, 155, 30317, 30617, 718, 29871, 30715, 30420, 30317, 30279, 30597, 30185, 30369, 13, 9651, 2436, 2928, 29898, 7724, 23252, 1001, 718, 15233, 23252, 1001, 718, 29871, 29941, 29930, 29896, 29953, 29897, 13, 13, 9651, 396, 29871, 30993, 31519, 230, 134, 155, 30317, 30617, 448, 9072, 5634, 13, 9651, 2436, 2928, 29898, 11690, 23252, 1001, 29897, 396, 29871, 30993, 31519, 230, 134, 155, 30317, 30617, 30199, 30257, 30538, 30566, 13, 9651, 2436, 21322, 29898, 2382, 29918, 1307, 29940, 29897, 396, 29871, 234, 187, 169, 233, 171, 173, 30199, 30899, 30566, 13, 9651, 2436, 21322, 29898, 2382, 29918, 1307, 29940, 29897, 396, 29871, 30724, 30525, 31305, 30371, 30199, 30499, 30980, 31115, 30354, 232, 131, 167, 30396, 29906, 30773, 13, 9651, 2436, 21322, 29898, 29896, 29897, 396, 289, 29883, 30605, 30420, 30185, 30203, 30354, 30419, 30882, 30409, 30449, 31190, 30353, 29896, 13, 9651, 2436, 21322, 29898, 29946, 29897, 396, 29871, 31046, 31551, 30199, 31085, 30354, 30419, 29946, 2966, 30409, 13, 13, 9651, 396, 29871, 30715, 30420, 30317, 30279, 30597, 30185, 30369, 448, 9072, 5634, 13, 9651, 396, 29871, 30878, 31120, 30199, 29941, 31085, 30353, 27703, 30199, 30597, 30185, 30369, 30396, 30752, 30553, 30330, 233, 177, 142, 30453, 30449, 29900, 30353, 31770, 30495, 13, 9651, 363, 2927, 297, 1583, 29889, 27703, 29901, 13, 18884, 396, 29871, 30303, 30279, 30258, 30600, 30203, 30597, 30532, 30310, 30203, 30499, 29896, 10389, 31761, 30773, 30854, 30538, 235, 193, 191, 31834, 13, 18884, 2436, 12901, 29898, 2780, 669, 29871, 29900, 29916, 29900, 29900, 29900, 29900, 4198, 29897, 13, 18884, 2436, 12901, 3552, 2780, 669, 29871, 29900, 29916, 29900, 29900, 4198, 29900, 29900, 29897, 5099, 29871, 29947, 29897, 13, 18884, 2436, 12901, 3552, 2780, 669, 29871, 29900, 29916, 4198, 29900, 29900, 29900, 29900, 29897, 5099, 29871, 29896, 29953, 29897, 13, 13, 9651, 363, 474, 297, 3464, 29898, 29896, 29953, 448, 7431, 29898, 1311, 29889, 27703, 22164, 13, 18884, 363, 432, 297, 3464, 29898, 29941, 1125, 13, 462, 1678, 2436, 12901, 29898, 29900, 29897, 13, 13, 9651, 396, 29871, 31046, 31551, 30597, 30185, 30369, 448, 9072, 5634, 13, 9651, 396, 29871, 29896, 12901, 30353, 29906, 29886, 15711, 30199, 30597, 30185, 30369, 30458, 30752, 30332, 30589, 30364, 30353, 31368, 31474, 13, 9651, 396, 29871, 31046, 31551, 30597, 30185, 30369, 30449, 31651, 30557, 30412, 30513, 31803, 30429, 30353, 31049, 236, 143, 181, 30566, 30553, 30332, 13, 632, 13, 9651, 396, 29871, 234, 187, 132, 30199, 30728, 31066, 30396, 31791, 30495, 30326, 30466, 30854, 30538, 235, 193, 191, 30735, 448, 2683, 2683, 807, 13, 9651, 822, 1423, 2855, 6113, 29898, 29894, 29918, 29875, 29892, 325, 29918, 29926, 29892, 298, 29918, 29875, 29892, 298, 29918, 29926, 1125, 13, 18884, 565, 383, 4717, 2303, 4690, 2965, 29968, 5277, 325, 29918, 29926, 529, 317, 13356, 29909, 1525, 14226, 29899, 29943, 4717, 2303, 4690, 2965, 29968, 320, 13, 18884, 322, 383, 4717, 2303, 4690, 2965, 29968, 5277, 298, 29918, 29926, 529, 317, 13356, 29909, 1525, 14226, 29899, 29943, 4717, 2303, 4690, 2965, 29968, 29901, 13, 462, 1678, 396, 29871, 234, 187, 132, 30199, 30728, 232, 132, 183, 13, 462, 1678, 848, 353, 1583, 29889, 7720, 29918, 11037, 29961, 1311, 29889, 7720, 3505, 448, 325, 29918, 29875, 448, 29871, 29896, 3816, 29882, 29918, 29875, 29962, 320, 13, 462, 1678, 718, 313, 1311, 29889, 7720, 29918, 11037, 29961, 1311, 29889, 7720, 3505, 448, 325, 29918, 29875, 448, 29871, 29896, 3816, 29882, 29918, 29875, 29962, 3532, 29871, 29946, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 29871, 234, 187, 132, 13, 462, 1678, 848, 353, 29871, 29900, 13, 18884, 396, 29871, 30854, 30538, 235, 193, 191, 30735, 13, 18884, 2436, 12901, 29898, 1272, 29897, 13, 9651, 396, 448, 2683, 2683, 2683, 28400, 13, 13, 9651, 363, 325, 29918, 29875, 297, 3464, 29898, 1311, 29889, 7720, 3505, 1125, 396, 29871, 234, 187, 169, 30199, 30715, 30369, 30185, 30203, 30199, 30354, 30955, 30807, 30258, 30185, 30605, 13, 18884, 363, 325, 29918, 29926, 297, 3464, 29898, 29903, 13356, 29909, 1525, 14226, 1125, 396, 29871, 30446, 30566, 30298, 30724, 30525, 31305, 30199, 234, 187, 169, 30199, 30899, 30566, 30955, 30807, 30258, 30185, 30605, 13, 462, 1678, 363, 298, 29918, 29875, 297, 3464, 29898, 1311, 29889, 7720, 3505, 1125, 396, 29871, 233, 171, 173, 30199, 30715, 30369, 30185, 30203, 30199, 30354, 30955, 30807, 30258, 30185, 30605, 13, 462, 4706, 363, 298, 29918, 29926, 297, 3464, 29898, 29903, 13356, 29909, 1525, 14226, 849, 29871, 29906, 1125, 13, 462, 9651, 396, 29871, 30446, 30566, 30298, 30724, 30525, 31305, 30199, 233, 171, 173, 30199, 30899, 30566, 29914, 29906, 30955, 30807, 30258, 30185, 30605, 13, 462, 9651, 396, 29871, 29896, 10389, 30353, 29906, 31046, 31605, 30854, 30538, 235, 193, 191, 31834, 30366, 30954, 30258, 30185, 30605, 30354, 30396, 29896, 29914, 29906, 30364, 30427, 30332, 13, 462, 9651, 1423, 2855, 6113, 29898, 29894, 29918, 29875, 29892, 325, 29918, 29926, 29892, 298, 29918, 29875, 29892, 298, 29918, 29926, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 286, 29880, 353, 341, 3628, 293, 12024, 357, 580, 13, 1678, 286, 29880, 29889, 13168, 580, 13, 1678, 286, 29880, 29889, 4905, 580, 13, 2 ]
qualtrics/share.py
anhiancheong/topics_evaluation
0
196153
<gh_stars>0 import argparse import json import requests API_KEY = "<KEY>" ENDPOINT = "https://iad1.qualtrics.com/API/v3" users = [ "UR_56juIFbMBWLU9jo", "UR_bIMXWqoIF8GNR7E", "UR_4O2EvhVhx5UVoQS" ] survey_ids = [ "SV_ezlYrHXuI4oxV8W", "SV_0Va3pTzbIGiS8tM", "SV_50zRZfCRm5wvvxA", "SV_80UG9Vuo5KHKbFI", "SV_3z2XeepZD1uheui", "SV_6GuDFnyQX0IhAeq", "SV_4Ob1KEJ0trA5KCy", "SV_1NyEUJ5LX8KtHFQ", "SV_3z661hKZxFMnewC", "SV_bqpnsYfAAixidLM" ] for survey_id in survey_ids: for user_id in users: resp = requests.post( f"https://ca1.qualtrics.com/API/v3/surveys/{survey_id}/permissions/collaborations", headers={"X-API-TOKEN": API_KEY}, json={ "recipientId": user_id, "permissions": { "surveyDefinitionManipulation": { "copySurveyQuestions": True, "editSurveyFlow": True, "useBlocks": True, "useSkipLogic": True, "useConjoint": True, "useTriggers": True, "useQuotas": True, "setSurveyOptions": True, "editQuestions": True, "deleteSurveyQuestions": True, "useTableOfContents": True, "useAdvancedQuotas": True }, "surveyManagement": { "editSurveys": True, "activateSurveys": True, "deactivateSurveys": True, "copySurveys": True, "distributeSurveys": True, "deleteSurveys": True, "translateSurveys": True }, "response": { "editSurveyResponses": True, "createResponseSets": True, "viewResponseId": True, "useCrossTabs": True, "useScreenouts": True }, "result": { "downloadSurveyResults": True, "viewSurveyResults": True, "filterSurveyResults": True, "viewPersonalData": True } } }) print(resp.status_code) if resp.status_code > 299: print(resp.__dict__)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 13, 5215, 1852, 5510, 13, 5215, 4390, 13, 5215, 7274, 13, 13, 8787, 29918, 10818, 353, 9872, 10818, 11903, 13, 13, 1430, 11191, 6992, 29911, 353, 376, 991, 597, 29875, 328, 29896, 29889, 15380, 509, 1199, 29889, 510, 29914, 8787, 29914, 29894, 29941, 29908, 13, 13, 13, 7193, 353, 518, 13, 1678, 376, 4574, 29918, 29945, 29953, 4900, 6545, 29890, 9486, 29956, 29931, 29965, 29929, 2212, 613, 13, 1678, 376, 4574, 29918, 29890, 7833, 29990, 29956, 29939, 29877, 6545, 29947, 29954, 16514, 29955, 29923, 613, 13, 1678, 376, 4574, 29918, 29946, 29949, 29906, 29923, 29894, 29882, 29963, 29882, 29916, 29945, 29965, 29963, 29877, 29984, 29903, 29908, 13, 29962, 13, 13, 7610, 6950, 29918, 4841, 353, 518, 13, 1678, 376, 7597, 29918, 6096, 29880, 29979, 29878, 29950, 29990, 29884, 29902, 29946, 2251, 29963, 29947, 29956, 613, 13, 1678, 376, 7597, 29918, 29900, 29963, 29874, 29941, 29886, 29911, 29920, 29890, 6259, 29875, 29903, 29947, 29873, 29924, 613, 13, 1678, 376, 7597, 29918, 29945, 29900, 29920, 29934, 29999, 29888, 11341, 29885, 29945, 29893, 29894, 29894, 29916, 29909, 613, 13, 1678, 376, 7597, 29918, 29947, 29900, 23338, 29929, 29963, 25608, 29945, 29968, 29950, 29968, 29890, 3738, 613, 13, 1678, 376, 7597, 29918, 29941, 29920, 29906, 29990, 29872, 1022, 29999, 29928, 29896, 29884, 354, 1481, 613, 13, 1678, 376, 7597, 29918, 29953, 9485, 4037, 1460, 29984, 29990, 29900, 29902, 29882, 29909, 1837, 613, 13, 1678, 376, 7597, 29918, 29946, 6039, 29896, 6059, 29967, 29900, 509, 29909, 29945, 29968, 29733, 613, 13, 1678, 376, 7597, 29918, 29896, 29940, 29891, 29923, 29965, 29967, 29945, 29931, 29990, 29947, 29968, 29873, 29950, 29943, 29984, 613, 13, 1678, 376, 7597, 29918, 29941, 29920, 29953, 29953, 29896, 29882, 29968, 29999, 29916, 22192, 1482, 29907, 613, 13, 1678, 376, 7597, 29918, 29890, 29939, 29886, 1983, 29979, 29888, 6344, 861, 333, 26369, 29908, 13, 29962, 13, 13, 1454, 18994, 29918, 333, 297, 18994, 29918, 4841, 29901, 13, 1678, 363, 1404, 29918, 333, 297, 4160, 29901, 13, 13, 4706, 4613, 353, 7274, 29889, 2490, 29898, 13, 9651, 285, 29908, 991, 597, 1113, 29896, 29889, 15380, 509, 1199, 29889, 510, 29914, 8787, 29914, 29894, 29941, 29914, 7610, 345, 952, 19248, 7610, 6950, 29918, 333, 6822, 17858, 6847, 29914, 22017, 3717, 800, 613, 29871, 13, 9651, 9066, 3790, 29908, 29990, 29899, 8787, 29899, 4986, 29968, 1430, 1115, 3450, 29918, 10818, 1118, 13, 9651, 4390, 3790, 13, 18884, 376, 4361, 29886, 993, 1204, 1115, 1404, 29918, 333, 29892, 13, 18884, 376, 17858, 6847, 1115, 426, 13, 462, 1678, 376, 7610, 6950, 14683, 2517, 666, 2785, 1115, 426, 13, 462, 4706, 376, 8552, 18498, 6950, 2182, 2297, 1115, 5852, 29892, 13, 462, 4706, 376, 5628, 18498, 6950, 17907, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 7445, 29879, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 15797, 666, 3403, 293, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 1168, 12090, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 2308, 335, 5743, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 2182, 327, 294, 1115, 5852, 29892, 13, 462, 4706, 376, 842, 18498, 6950, 5856, 1115, 5852, 29892, 13, 462, 4706, 376, 5628, 2182, 2297, 1115, 5852, 29892, 13, 462, 4706, 376, 8143, 18498, 6950, 2182, 2297, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 3562, 2776, 21002, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 3253, 16858, 2182, 327, 294, 1115, 5852, 13, 462, 1678, 2981, 13, 462, 1678, 376, 7610, 6950, 27107, 1115, 426, 13, 462, 4706, 376, 5628, 18498, 345, 952, 1115, 5852, 29892, 13, 462, 4706, 376, 11236, 403, 18498, 345, 952, 1115, 5852, 29892, 13, 462, 4706, 376, 311, 11236, 403, 18498, 345, 952, 1115, 5852, 29892, 13, 462, 4706, 376, 8552, 18498, 345, 952, 1115, 5852, 29892, 13, 462, 4706, 376, 5721, 2666, 18498, 345, 952, 1115, 5852, 29892, 13, 462, 4706, 376, 8143, 18498, 345, 952, 1115, 5852, 29892, 13, 462, 4706, 376, 21652, 18498, 345, 952, 1115, 5852, 13, 462, 1678, 2981, 13, 462, 1678, 376, 5327, 1115, 426, 13, 462, 4706, 376, 5628, 18498, 6950, 1666, 29886, 787, 267, 1115, 5852, 29892, 13, 462, 4706, 376, 3258, 5103, 29903, 1691, 1115, 5852, 29892, 13, 462, 4706, 376, 1493, 5103, 1204, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 29907, 2124, 29911, 6897, 1115, 5852, 29892, 13, 462, 4706, 376, 1509, 11357, 17718, 1115, 5852, 13, 462, 1678, 2981, 13, 462, 1678, 376, 2914, 1115, 426, 13, 462, 4706, 376, 10382, 18498, 6950, 12191, 1115, 5852, 29892, 13, 462, 4706, 376, 1493, 18498, 6950, 12191, 1115, 5852, 29892, 13, 462, 4706, 376, 4572, 18498, 6950, 12191, 1115, 5852, 29892, 13, 462, 4706, 376, 1493, 7435, 284, 1469, 1115, 5852, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 5615, 13, 13, 4706, 1596, 29898, 13713, 29889, 4882, 29918, 401, 29897, 13, 4706, 565, 4613, 29889, 4882, 29918, 401, 1405, 29871, 29906, 29929, 29929, 29901, 13, 9651, 1596, 29898, 13713, 17255, 8977, 1649, 29897, 2 ]
tests/test_client.py
nyush-se-spring2021-forum/OurTieba
0
22001
<gh_stars>0 class TestClient: """ Test before_request and after_request decorators in __init__.py. """ def test_1(self, client): # disallowed methods res = client.put("/") assert res.status_code == 405 assert b"Method Not Allowed" in res.content res = client.options("/api/post/add") assert res.status_code == 405 assert b"Method Not Allowed" in res.content res = client.delete("/notifications") assert res.status_code == 405 assert b"Method Not Allowed" in res.content def test_2(self, client): # empty/fake user agent res = client.get("/", headers={"User-Agent": ""}) assert res.status_code == 403 assert b"No Scrappers!" in res.content res = client.get("/board/2", headers={"User-Agent": "python/3.8"}) assert res.status_code == 403 assert b"No Scrappers!" in res.content
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 1990, 4321, 4032, 29901, 13, 1678, 9995, 13, 1678, 4321, 1434, 29918, 3827, 322, 1156, 29918, 3827, 10200, 4097, 297, 4770, 2344, 26914, 2272, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 1243, 29918, 29896, 29898, 1311, 29892, 3132, 1125, 29871, 396, 766, 24622, 3519, 13, 4706, 620, 353, 3132, 29889, 649, 11974, 1159, 13, 4706, 4974, 620, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29945, 13, 4706, 4974, 289, 29908, 4062, 2216, 2178, 20937, 29908, 297, 620, 29889, 3051, 13, 13, 4706, 620, 353, 3132, 29889, 6768, 11974, 2754, 29914, 2490, 29914, 1202, 1159, 13, 4706, 4974, 620, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29945, 13, 4706, 4974, 289, 29908, 4062, 2216, 2178, 20937, 29908, 297, 620, 29889, 3051, 13, 13, 4706, 620, 353, 3132, 29889, 8143, 11974, 1333, 8232, 1159, 13, 4706, 4974, 620, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29945, 13, 4706, 4974, 289, 29908, 4062, 2216, 2178, 20937, 29908, 297, 620, 29889, 3051, 13, 13, 1678, 822, 1243, 29918, 29906, 29898, 1311, 29892, 3132, 1125, 29871, 396, 4069, 29914, 29888, 1296, 1404, 10823, 13, 4706, 620, 353, 3132, 29889, 657, 11974, 613, 9066, 3790, 29908, 2659, 29899, 19661, 1115, 5124, 1800, 13, 4706, 4974, 620, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29941, 13, 4706, 4974, 289, 29908, 3782, 2522, 336, 22437, 3850, 297, 620, 29889, 3051, 13, 13, 4706, 620, 353, 3132, 29889, 657, 11974, 3377, 29914, 29906, 613, 9066, 3790, 29908, 2659, 29899, 19661, 1115, 376, 4691, 29914, 29941, 29889, 29947, 29908, 1800, 13, 4706, 4974, 620, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29941, 13, 4706, 4974, 289, 29908, 3782, 2522, 336, 22437, 3850, 297, 620, 29889, 3051, 13, 2 ]
qemu/scripts/codeconverter/codeconverter/test_patching.py
hyunjoy/scripts
44
9469
# Copyright (C) 2020 Red Hat Inc. # # Authors: # <NAME> <<EMAIL>> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. from tempfile import NamedTemporaryFile from .patching import FileInfo, FileMatch, Patch, FileList from .regexps import * class BasicPattern(FileMatch): regexp = '[abc]{3}' @property def name(self): return self.group(0) def replacement(self) -> str: # replace match with the middle character repeated 5 times return self.group(0)[1].upper()*5 def test_pattern_patching(): of = NamedTemporaryFile('wt') of.writelines(['one line\n', 'this pattern will be patched: defbbahij\n', 'third line\n', 'another pattern: jihaabfed']) of.flush() files = FileList() f = FileInfo(files, of.name) f.load() matches = f.matches_of_type(BasicPattern) assert len(matches) == 2 p2 = matches[1] # manually add patch, to see if .append() works: f.patches.append(p2.append('XXX')) # apply all patches: f.gen_patches(matches) patched = f.get_patched_content() assert patched == ('one line\n'+ 'this pattern will be patched: defBBBBBhij\n'+ 'third line\n'+ 'another pattern: jihAAAAAXXXfed') class Function(FileMatch): regexp = S(r'BEGIN\s+', NAMED('name', RE_IDENTIFIER), r'\n', r'(.*\n)*?END\n') class Statement(FileMatch): regexp = S(r'^\s*', NAMED('name', RE_IDENTIFIER), r'\(\)\n') def test_container_match(): of = NamedTemporaryFile('wt') of.writelines(['statement1()\n', 'statement2()\n', 'BEGIN function1\n', ' statement3()\n', ' statement4()\n', 'END\n', 'BEGIN function2\n', ' statement5()\n', ' statement6()\n', 'END\n', 'statement7()\n']) of.flush() files = FileList() f = FileInfo(files, of.name) f.load() assert len(f.matches_of_type(Function)) == 2 print(' '.join(m.name for m in f.matches_of_type(Statement))) assert len(f.matches_of_type(Statement)) == 7 f1 = f.find_match(Function, 'function1') f2 = f.find_match(Function, 'function2') st1 = f.find_match(Statement, 'statement1') st2 = f.find_match(Statement, 'statement2') st3 = f.find_match(Statement, 'statement3') st4 = f.find_match(Statement, 'statement4') st5 = f.find_match(Statement, 'statement5') st6 = f.find_match(Statement, 'statement6') st7 = f.find_match(Statement, 'statement7') assert not f1.contains(st1) assert not f1.contains(st2) assert not f1.contains(st2) assert f1.contains(st3) assert f1.contains(st4) assert not f1.contains(st5) assert not f1.contains(st6) assert not f1.contains(st7) assert not f2.contains(st1) assert not f2.contains(st2) assert not f2.contains(st2) assert not f2.contains(st3) assert not f2.contains(st4) assert f2.contains(st5) assert f2.contains(st6) assert not f2.contains(st7)
[ 1, 396, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29906, 29900, 4367, 25966, 9266, 29889, 13, 29937, 13, 29937, 13189, 943, 29901, 13, 29937, 29871, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 13, 29937, 910, 664, 338, 7794, 21144, 1090, 278, 4958, 310, 278, 15143, 402, 7390, 29892, 1873, 29871, 29906, 29889, 29871, 2823, 13, 29937, 278, 315, 4590, 29979, 4214, 934, 297, 278, 2246, 29899, 5563, 3884, 29889, 13, 3166, 5694, 1445, 1053, 405, 2795, 5776, 1971, 653, 2283, 13, 3166, 869, 5041, 292, 1053, 3497, 3401, 29892, 3497, 9652, 29892, 349, 905, 29892, 3497, 1293, 13, 3166, 869, 13087, 567, 1053, 334, 13, 13, 1990, 19219, 17144, 29898, 2283, 9652, 1125, 13, 1678, 6528, 29886, 353, 525, 29961, 10736, 3199, 29941, 10162, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1024, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 2972, 29898, 29900, 29897, 13, 13, 1678, 822, 16920, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 396, 5191, 1993, 411, 278, 7256, 2931, 10324, 29871, 29945, 3064, 13, 4706, 736, 1583, 29889, 2972, 29898, 29900, 9601, 29896, 1822, 21064, 580, 29930, 29945, 13, 13, 1753, 1243, 29918, 11037, 29918, 5041, 292, 7295, 13, 1678, 310, 353, 405, 2795, 5776, 1971, 653, 2283, 877, 14554, 1495, 13, 1678, 310, 29889, 8231, 24210, 18959, 650, 1196, 29905, 29876, 742, 13, 462, 29871, 525, 1366, 4766, 674, 367, 13261, 287, 29901, 822, 1327, 801, 823, 29905, 29876, 742, 13, 462, 29871, 525, 22585, 1196, 29905, 29876, 742, 13, 462, 29871, 525, 23327, 4766, 29901, 19841, 2350, 370, 29888, 287, 11287, 13, 1678, 310, 29889, 23126, 580, 13, 13, 1678, 2066, 353, 3497, 1293, 580, 13, 1678, 285, 353, 3497, 3401, 29898, 5325, 29892, 310, 29889, 978, 29897, 13, 1678, 285, 29889, 1359, 580, 13, 1678, 7087, 353, 285, 29889, 20317, 29918, 974, 29918, 1853, 29898, 16616, 17144, 29897, 13, 1678, 4974, 7431, 29898, 20317, 29897, 1275, 29871, 29906, 13, 1678, 282, 29906, 353, 7087, 29961, 29896, 29962, 13, 13, 1678, 396, 7522, 788, 13261, 29892, 304, 1074, 565, 869, 4397, 580, 1736, 29901, 13, 1678, 285, 29889, 5041, 267, 29889, 4397, 29898, 29886, 29906, 29889, 4397, 877, 22791, 8785, 13, 13, 1678, 396, 3394, 599, 13261, 267, 29901, 13, 1678, 285, 29889, 1885, 29918, 5041, 267, 29898, 20317, 29897, 13, 1678, 13261, 287, 353, 285, 29889, 657, 29918, 5041, 287, 29918, 3051, 580, 13, 1678, 4974, 13261, 287, 1275, 6702, 650, 1196, 29905, 29876, 18717, 13, 462, 539, 525, 1366, 4766, 674, 367, 13261, 287, 29901, 822, 14388, 14388, 29933, 29882, 823, 29905, 29876, 18717, 13, 462, 539, 525, 22585, 1196, 29905, 29876, 18717, 13, 462, 539, 525, 23327, 4766, 29901, 432, 4861, 23184, 29909, 22791, 29888, 287, 1495, 13, 13, 1990, 6680, 29898, 2283, 9652, 1125, 13, 1678, 6528, 29886, 353, 317, 29898, 29878, 29915, 29933, 17958, 29905, 29879, 29974, 742, 27085, 29928, 877, 978, 742, 5195, 29918, 1367, 3919, 29902, 3738, 1001, 511, 364, 12764, 29876, 742, 13, 1669, 364, 12215, 5575, 29905, 29876, 11877, 29973, 11794, 29905, 29876, 1495, 13, 13, 1990, 6666, 882, 29898, 2283, 9652, 1125, 13, 1678, 6528, 29886, 353, 317, 29898, 29878, 29915, 3823, 29879, 29930, 742, 27085, 29928, 877, 978, 742, 5195, 29918, 1367, 3919, 29902, 3738, 1001, 511, 364, 12764, 1194, 2144, 29876, 1495, 13, 13, 1753, 1243, 29918, 7611, 29918, 4352, 7295, 13, 1678, 310, 353, 405, 2795, 5776, 1971, 653, 2283, 877, 14554, 1495, 13, 1678, 310, 29889, 8231, 24210, 18959, 20788, 29896, 580, 29905, 29876, 742, 13, 462, 259, 525, 20788, 29906, 580, 29905, 29876, 742, 13, 462, 259, 525, 29933, 17958, 740, 29896, 29905, 29876, 742, 13, 462, 259, 525, 29871, 3229, 29941, 580, 29905, 29876, 742, 13, 462, 259, 525, 29871, 3229, 29946, 580, 29905, 29876, 742, 13, 462, 259, 525, 11794, 29905, 29876, 742, 13, 462, 259, 525, 29933, 17958, 740, 29906, 29905, 29876, 742, 13, 462, 259, 525, 29871, 3229, 29945, 580, 29905, 29876, 742, 13, 462, 259, 525, 29871, 3229, 29953, 580, 29905, 29876, 742, 13, 462, 259, 525, 11794, 29905, 29876, 742, 13, 462, 259, 525, 20788, 29955, 580, 29905, 29876, 11287, 13, 1678, 310, 29889, 23126, 580, 13, 13, 1678, 2066, 353, 3497, 1293, 580, 13, 1678, 285, 353, 3497, 3401, 29898, 5325, 29892, 310, 29889, 978, 29897, 13, 1678, 285, 29889, 1359, 580, 13, 1678, 4974, 7431, 29898, 29888, 29889, 20317, 29918, 974, 29918, 1853, 29898, 6678, 876, 1275, 29871, 29906, 13, 1678, 1596, 877, 15300, 7122, 29898, 29885, 29889, 978, 363, 286, 297, 285, 29889, 20317, 29918, 974, 29918, 1853, 29898, 14473, 4961, 13, 1678, 4974, 7431, 29898, 29888, 29889, 20317, 29918, 974, 29918, 1853, 29898, 14473, 876, 1275, 29871, 29955, 13, 13, 1678, 285, 29896, 353, 285, 29889, 2886, 29918, 4352, 29898, 6678, 29892, 525, 2220, 29896, 1495, 13, 1678, 285, 29906, 353, 285, 29889, 2886, 29918, 4352, 29898, 6678, 29892, 525, 2220, 29906, 1495, 13, 1678, 380, 29896, 353, 285, 29889, 2886, 29918, 4352, 29898, 14473, 29892, 525, 20788, 29896, 1495, 13, 1678, 380, 29906, 353, 285, 29889, 2886, 29918, 4352, 29898, 14473, 29892, 525, 20788, 29906, 1495, 13, 1678, 380, 29941, 353, 285, 29889, 2886, 29918, 4352, 29898, 14473, 29892, 525, 20788, 29941, 1495, 13, 1678, 380, 29946, 353, 285, 29889, 2886, 29918, 4352, 29898, 14473, 29892, 525, 20788, 29946, 1495, 13, 1678, 380, 29945, 353, 285, 29889, 2886, 29918, 4352, 29898, 14473, 29892, 525, 20788, 29945, 1495, 13, 1678, 380, 29953, 353, 285, 29889, 2886, 29918, 4352, 29898, 14473, 29892, 525, 20788, 29953, 1495, 13, 1678, 380, 29955, 353, 285, 29889, 2886, 29918, 4352, 29898, 14473, 29892, 525, 20788, 29955, 1495, 13, 13, 1678, 4974, 451, 285, 29896, 29889, 11516, 29898, 303, 29896, 29897, 13, 1678, 4974, 451, 285, 29896, 29889, 11516, 29898, 303, 29906, 29897, 13, 1678, 4974, 451, 285, 29896, 29889, 11516, 29898, 303, 29906, 29897, 13, 1678, 4974, 285, 29896, 29889, 11516, 29898, 303, 29941, 29897, 13, 1678, 4974, 285, 29896, 29889, 11516, 29898, 303, 29946, 29897, 13, 1678, 4974, 451, 285, 29896, 29889, 11516, 29898, 303, 29945, 29897, 13, 1678, 4974, 451, 285, 29896, 29889, 11516, 29898, 303, 29953, 29897, 13, 1678, 4974, 451, 285, 29896, 29889, 11516, 29898, 303, 29955, 29897, 13, 13, 1678, 4974, 451, 285, 29906, 29889, 11516, 29898, 303, 29896, 29897, 13, 1678, 4974, 451, 285, 29906, 29889, 11516, 29898, 303, 29906, 29897, 13, 1678, 4974, 451, 285, 29906, 29889, 11516, 29898, 303, 29906, 29897, 13, 1678, 4974, 451, 285, 29906, 29889, 11516, 29898, 303, 29941, 29897, 13, 1678, 4974, 451, 285, 29906, 29889, 11516, 29898, 303, 29946, 29897, 13, 1678, 4974, 285, 29906, 29889, 11516, 29898, 303, 29945, 29897, 13, 1678, 4974, 285, 29906, 29889, 11516, 29898, 303, 29953, 29897, 13, 1678, 4974, 451, 285, 29906, 29889, 11516, 29898, 303, 29955, 29897, 13, 2 ]
wbia_cnn/netrun.py
WildMeOrg/wbia-plugin-cnn
0
31590
#!/usr/bin/env python # -*- coding: utf-8 -*- r""" FIXME: sometimes you have to chown -R user:user ~/.theano or run with sudo the first time after roboot, otherwise you get errors CommandLineHelp: python -m wbia_cnn --tf netrun <networkmodel> --dataset, --ds = <dstag>:<subtag> dstag is the main dataset name (eg PZ_MTEST), subtag are parameters to modify (max_examples=3) --weights, -w = \|new\|<checkpoint_tag>\|<dstag>:<checkpoint_tag> (default: <checkpoint_tag>) new will initialize clean weights. a checkpoint tag will try to to match a saved model state in the history. can load weights from an external dataset. <checkpoint_tag> defaults to current --arch, -a = <archtag> model architecture tag (eg siaml2_128, siam2stream, viewpoint) --device = <processor> sets theano device flag to a processor like gpu0, gpu1, or cpu0 """ import logging from wbia_cnn import models from wbia_cnn import ingest_data from wbia_cnn import experiments import utool as ut import sys print, rrr, profile = ut.inject2(__name__) logger = logging.getLogger() # This is more of a history tag CHECKPOINT_TAG_ALIAS = { 'current': None, '': None, } # second level of alias indirection # This is more of a dataset tag DS_TAG_ALIAS2 = { 'flankhack': "dict(acfg_name='ctrl:pername=None,excluderef=False,contributor_contains=FlankHack', colorspace='gray', db='PZ_Master1')", 'pzmtest-bgr': "PZ_MTEST;dict(colorspace='bgr', controlled=True, max_examples=None, num_top=None)", # NOQA 'pzmtest': "PZ_MTEST;dict(colorspace='gray', controlled=True, max_examples=None, num_top=None)", # NOQA 'gz-gray': "GZ_ALL;dict(colorspace='gray', controlled=False, max_examples=None, num_top=None)", # NOQA 'liberty': "liberty;dict(detector='dog', pairs=250000)", 'combo': 'combo_vdsujffw', 'timectrl_pzmaster1': "PZ_Master1;dict(acfg_name='timectrl', colorspace='gray', min_featweight=0.8)", # NOQA 'pzm2': "PZ_Master1;dict(acfg_name='timectrl:pername=None', colorspace='gray', min_featweight=0.8)", # NOQA 'pzm3': "PZ_Master1;dict(acfg_name=None, colorspace='gray', controlled=True, min_featweight=0.8)", #'pzm3' : "PZ_Master1;dict(acfg_name='default:is_known=True,qmin_pername=2,view=primary,species=primary,minqual=ok', colorspace='gray', min_featweight=0.8)", # NOQA 'pzm4': "PZ_Master1;dict(acfg_name='default:is_known=True,qmin_pername=2,view=primary,species=primary,minqual=ok', colorspace='gray', min_featweight=0.8)", } def netrun(): r""" CommandLine: # --- UTILITY python -m wbia_cnn --tf get_juction_dpath --show # --- DATASET BUILDING --- # Build Dataset Aliases python -m wbia_cnn --tf netrun --db PZ_MTEST --acfg ctrl --ensuredata --show python -m wbia_cnn --tf netrun --db PZ_Master1 --acfg timectrl --ensuredata python -m wbia_cnn --tf netrun --db PZ_Master1 --acfg timectrl:pername=None --ensuredata python -m wbia_cnn --tf netrun --db PZ_Master1 --acfg timectrl:pername=None --ensuredata python -m wbia_cnn --tf netrun --db mnist --ensuredata --show python -m wbia_cnn --tf netrun --db mnist --ensuredata --show --datatype=category python -m wbia_cnn --tf netrun --db mnist --ensuredata --show --datatype=siam-patch python -m wbia_cnn --tf netrun --db PZ_Master1 --acfg ctrl:pername=None,excluderef=False,contributor_contains=FlankHack --ensuredata --show --datatype=siam-part # Parts based datasets python -m wbia_cnn --tf netrun --db PZ_MTEST --acfg ctrl --datatype=siam-part --ensuredata --show # Patch based dataset (big one) python -m wbia_cnn --tf netrun --db PZ_Master1 --acfg default:is_known=True,qmin_pername=2,view=primary,species=primary,minqual=ok --ensuredata --show --vtd python -m wbia_cnn --tf netrun --ds pzm4 --weights=new --arch=siaml2_128 --train --monitor python -m wbia_cnn --tf netrun --ds pzm4 --arch=siaml2_128 --test python -m wbia_cnn --tf netrun --ds pzm4 --arch=siaml2_128 --veryverbose --no-flask # --- TRAINING --- python -m wbia_cnn --tf netrun --db PZ_Master1 --acfg default:is_known=True,qmin_pername=2,view=primary,species=primary,minqual=ok --weights=new --arch=siaml2_128 --train --monitor python -m wbia_cnn --tf netrun --ds timectrl_pzmaster1 --acfg ctrl:pername=None,excluderef=False,contributor_contains=FlankHack --train --weights=new --arch=siaml2_128 --monitor # NOQA python -m wbia_cnn --tf netrun --ds timectrl_pzmaster1 --acfg ctrl:pername=None,excluderef=False --train --weights=new --arch=siaml2_128 --monitor # NOQA python -m wbia_cnn --tf netrun --ds pzmtest --weights=new --arch=siaml2_128 --train --monitor --DEBUG_AUGMENTATION python -m wbia_cnn --tf netrun --ds pzmtest --weights=new --arch=siaml2_128 --train --monitor python -m wbia_cnn --tf netrun --ds flankhack --weights=new --arch=siaml2_partmatch --train --monitor --learning_rate=.00001 python -m wbia_cnn --tf netrun --ds flankhack --weights=new --arch=siam_deepfaceish --train --monitor --learning_rate=.00001 # Different ways to train mnist python -m wbia_cnn --tf netrun --db mnist --weights=new --arch=mnist_siaml2 --train --monitor --datatype=siam-patch python -m wbia_cnn --tf netrun --db mnist --weights=new --arch=mnist-category --train --monitor --datatype=category # --- INITIALIZED-TRAINING --- python -m wbia_cnn --tf netrun --ds pzmtest --arch=siaml2_128 --weights=gz-gray:current --train --monitor # --- TESTING --- python -m wbia_cnn --tf netrun --db liberty --weights=liberty:current --arch=siaml2_128 --test python -m wbia_cnn --tf netrun --db PZ_Master0 --weights=combo:current --arch=siaml2_128 --testall Example: >>> # DISABLE_DOCTEST >>> from wbia_cnn.netrun import * # NOQA >>> netrun() >>> ut.show_if_requested() """ ut.colorprint('[netrun] NET RUN', 'red') requests, hyperparams, tags = parse_args() ds_tag = tags['ds_tag'] datatype = tags['datatype'] extern_ds_tag = tags['extern_ds_tag'] arch_tag = tags['arch_tag'] checkpoint_tag = tags['checkpoint_tag'] # ---------------------------- # Choose the main dataset ut.colorprint('[netrun] Ensuring Dataset', 'yellow') dataset = ingest_data.grab_dataset(ds_tag, datatype) if extern_ds_tag is not None: extern_dpath = ingest_data.get_extern_training_dpath(extern_ds_tag) else: extern_dpath = None logger.info('dataset.training_dpath = %r' % (dataset.training_dpath,)) logger.info('Dataset Alias Key: %r' % (dataset.alias_key,)) logger.info( 'Current Dataset Tag: %r' % (ut.invert_dict(DS_TAG_ALIAS2).get(dataset.alias_key, None),) ) if requests['ensuredata']: # Print alias key that maps to this particular dataset if ut.show_was_requested(): interact_ = dataset.interact() # NOQA return logger.info('...exiting') sys.exit(1) # ---------------------------- # Choose model architecture # TODO: data will need to return info about number of labels in viewpoint models # Specify model archichitecture ut.colorprint('[netrun] Architecture Specification', 'yellow') if arch_tag == 'siam2stream': model = models.SiameseCenterSurroundModel( data_shape=dataset.data_shape, training_dpath=dataset.training_dpath, **hyperparams ) elif arch_tag.startswith('siam'): model = models.SiameseL2( data_shape=dataset.data_shape, arch_tag=arch_tag, training_dpath=dataset.training_dpath, **hyperparams ) elif arch_tag == 'mnist-category': model = models.MNISTModel( data_shape=dataset.data_shape, output_dims=dataset.output_dims, arch_tag=arch_tag, training_dpath=dataset.training_dpath, **hyperparams ) pass else: raise ValueError('Unknown arch_tag=%r' % (arch_tag,)) ut.colorprint('[netrun] Initialize archchitecture', 'yellow') model.init_arch() # ---------------------------- # Choose weight initialization ut.colorprint('[netrun] Setting weights', 'yellow') if checkpoint_tag == 'new': ut.colorprint('[netrun] * Initializing new weights', 'lightgray') model.reinit_weights() else: checkpoint_tag = model.resolve_fuzzy_checkpoint_pattern( checkpoint_tag, extern_dpath ) ut.colorprint( '[netrun] * Resolving weights checkpoint_tag=%r' % (checkpoint_tag,), 'lightgray', ) if extern_dpath is not None: model.load_extern_weights(dpath=extern_dpath, checkpoint_tag=checkpoint_tag) elif model.has_saved_state(checkpoint_tag=checkpoint_tag): model.load_model_state(checkpoint_tag=checkpoint_tag) else: model_state_fpath = model.get_model_state_fpath(checkpoint_tag=checkpoint_tag) logger.info('model_state_fpath = %r' % (model_state_fpath,)) ut.checkpath(model_state_fpath, verbose=True) logger.info( 'Known checkpoints are: ' + ut.repr3(model.list_saved_checkpoints()) ) raise ValueError( ('Unresolved weight init: ' 'checkpoint_tag=%r, extern_ds_tag=%r') % ( checkpoint_tag, extern_ds_tag, ) ) # logger.info('Model State:') # logger.info(model.get_state_str()) # ---------------------------- if not model.is_train_state_initialized(): ut.colorprint('[netrun] Need to initialize training state', 'yellow') X_train, y_train = dataset.subset('train') model.ensure_data_params(X_train, y_train) # Run Actions if requests['train']: ut.colorprint('[netrun] Training Requested', 'yellow') # parse training arguments config = ut.argparse_dict( dict( era_size=15, max_epochs=1200, rate_decay=0.8, ) ) model.monitor_config.update(**config) X_train, y_train = dataset.subset('train') X_valid, y_valid = dataset.subset('valid') model.fit(X_train, y_train, X_valid=X_valid, y_valid=y_valid) elif requests['test']: # assert model.best_results['epoch'] is not None ut.colorprint('[netrun] Test Requested', 'yellow') if requests['testall']: ut.colorprint('[netrun] * Testing on all data', 'lightgray') X_test, y_test = dataset.subset('all') flat_metadata = dataset.subset_metadata('all') else: ut.colorprint('[netrun] * Testing on test subset', 'lightgray') X_test, y_test = dataset.subset('test') flat_metadata = dataset.subset_metadata('test') data, labels = X_test, y_test dataname = dataset.alias_key experiments.test_siamese_performance(model, data, labels, flat_metadata, dataname) else: if not ut.get_argflag('--cmd'): raise ValueError('nothing here. need to train or test') if requests['publish']: ut.colorprint('[netrun] Publish Requested', 'yellow') publish_dpath = ut.truepath('~/Dropbox/IBEIS') published_model_state = ut.unixjoin( publish_dpath, model.arch_tag + '_model_state.pkl' ) ut.copy(model.get_model_state_fpath(), published_model_state) ut.view_directory(publish_dpath) logger.info( 'You need to get the dropbox link and ' 'register it into the appropriate file' ) # pip install dropbox # https://www.dropbox.com/developers/core/start/python # import dropbox # need oauth # client.share('/myfile.txt', short_url=False) # https://wildbookiarepository.azureedge.net/models/siaml2_128_model_state.pkl if ut.get_argflag('--cmd'): ut.embed() def parse_args(): ds_default = None arch_default = 'siaml2_128' weights_tag_default = None # Test values if False: ds_default = 'liberty' weights_tag_default = 'current' assert ut.inIPython() # Parse commandline args ds_tag = ut.get_argval(('--dataset', '--ds'), type_=str, default=ds_default) datatype = ut.get_argval(('--datatype', '--dt'), type_=str, default='siam-patch') arch_tag = ut.get_argval(('--arch', '-a'), default=arch_default) weights_tag = ut.get_argval( ('--weights', '+w'), type_=str, default=weights_tag_default ) # Incorporate new config stuff? # NEW = False # if NEW: # default_dstag_cfg = { # 'ds': 'PZ_MTEST', # 'mode': 'patches', # 'arch': arch_default # } # named_defaults_dict = { # '': default_dstag_cfg # } # ut.parse_argv_cfg('dstag', named_defaults_dict=named_defaults_dict) hyperparams = ut.argparse_dict( { #'batch_size': 128, 'batch_size': 256, #'learning_rate': .0005, 'learning_rate': 0.1, 'momentum': 0.9, #'weight_decay': 0.0005, 'weight_decay': 0.0001, }, alias_dict={ 'weight_decay': ['decay'], 'learning_rate': ['learn_rate'], }, ) requests = ut.argparse_dict( { 'train': False, 'test': False, 'testall': False, 'publish': False, 'ensuredata': False, } ) requests['test'] = requests['test'] or requests['testall'] # breakup weights tag into extern_ds and checkpoint if weights_tag is not None and ':' in weights_tag: extern_ds_tag, checkpoint_tag = weights_tag.split(':') else: extern_ds_tag = None checkpoint_tag = weights_tag # resolve aliases ds_tag = DS_TAG_ALIAS2.get(ds_tag, ds_tag) extern_ds_tag = DS_TAG_ALIAS2.get(extern_ds_tag, extern_ds_tag) checkpoint_tag = CHECKPOINT_TAG_ALIAS.get(checkpoint_tag, checkpoint_tag) tags = { 'ds_tag': ds_tag, 'extern_ds_tag': extern_ds_tag, 'checkpoint_tag': checkpoint_tag, 'arch_tag': arch_tag, 'datatype': datatype, } ut.colorprint('[netrun] * ds_tag=%r' % (ds_tag,), 'lightgray') ut.colorprint('[netrun] * arch_tag=%r' % (arch_tag,), 'lightgray') ut.colorprint('[netrun] * extern_ds_tag=%r' % (extern_ds_tag,), 'lightgray') ut.colorprint('[netrun] * checkpoint_tag=%r' % (checkpoint_tag,), 'lightgray') return requests, hyperparams, tags def merge_ds_tags(ds_alias_list): r""" CommandLine: python -m wbia_cnn --tf merge_ds_tags --alias-list gz-gray girm pzmtest nnp TODO: http://stackoverflow.com/questions/18492273/combining-hdf5-files Example: >>> # DISABLE_DOCTEST >>> from wbia_cnn.netrun import * # NOQA >>> ds_alias_list = ut.get_argval('--alias-list', type_=list, default=[]) >>> result = merge_ds_tags(ds_alias_list) >>> print(result) """ ds_tag_list = [DS_TAG_ALIAS2.get(ds_tag, ds_tag) for ds_tag in ds_alias_list] dataset_list = [ingest_data.grab_siam_dataset(ds_tag) for ds_tag in ds_tag_list] merged_dataset = ingest_data.merge_datasets(dataset_list) logger.info(merged_dataset.alias_key) return merged_dataset if __name__ == '__main__': """ CommandLine: python -m wbia_cnn.netrun python -m wbia_cnn.netrun --allexamples python -m wbia_cnn.netrun --allexamples --noface --nosrc """ # train_pz() import multiprocessing multiprocessing.freeze_support() # for win32 import utool as ut # NOQA # import warnings # with warnings.catch_warnings(): # # Cause all warnings to always be triggered. # warnings.filterwarnings("error", ".*get_all_non_bias_params.*") ut.doctest_funcs()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29878, 15945, 29908, 13, 25634, 2303, 29901, 13, 1678, 6041, 366, 505, 304, 521, 776, 448, 29934, 1404, 29901, 1792, 3695, 6294, 1552, 1562, 470, 1065, 411, 9196, 278, 13, 1678, 937, 931, 1156, 696, 4777, 29892, 6467, 366, 679, 4436, 13, 13, 6255, 3542, 29648, 29901, 13, 1678, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 529, 11618, 4299, 29958, 13, 13, 1678, 1192, 24713, 29892, 1192, 6289, 353, 529, 22992, 351, 23917, 29966, 1491, 4039, 29958, 13, 1678, 270, 24403, 338, 278, 1667, 8783, 1024, 313, 387, 349, 29999, 29918, 29924, 18267, 511, 1014, 4039, 526, 4128, 304, 13, 1678, 6623, 313, 3317, 29918, 19057, 29922, 29941, 29897, 13, 13, 1678, 1192, 705, 5861, 29892, 448, 29893, 353, 12926, 1482, 7893, 29966, 3198, 3149, 29918, 4039, 29958, 7893, 29966, 22992, 351, 23917, 29966, 3198, 3149, 29918, 4039, 29958, 313, 4381, 29901, 529, 3198, 3149, 29918, 4039, 12948, 13, 1678, 716, 674, 11905, 5941, 18177, 29889, 13, 1678, 263, 1423, 3149, 4055, 674, 1018, 304, 304, 1993, 263, 7160, 1904, 2106, 297, 278, 4955, 29889, 13, 1678, 508, 2254, 18177, 515, 385, 7029, 8783, 29889, 13, 1678, 529, 3198, 3149, 29918, 4039, 29958, 21274, 304, 1857, 13, 13, 1678, 1192, 1279, 29892, 448, 29874, 353, 529, 1279, 4039, 29958, 13, 1678, 1904, 11258, 4055, 313, 387, 1354, 8807, 29906, 29918, 29896, 29906, 29947, 29892, 1354, 314, 29906, 5461, 29892, 1776, 3149, 29897, 13, 13, 1678, 1192, 10141, 353, 529, 26482, 29958, 13, 1678, 6166, 278, 1562, 4742, 7353, 304, 263, 21433, 763, 330, 3746, 29900, 29892, 330, 3746, 29896, 29892, 470, 26403, 29900, 13, 15945, 29908, 13, 5215, 12183, 13, 3166, 281, 15959, 29918, 29883, 15755, 1053, 4733, 13, 3166, 281, 15959, 29918, 29883, 15755, 1053, 2348, 342, 29918, 1272, 13, 3166, 281, 15959, 29918, 29883, 15755, 1053, 15729, 13, 5215, 318, 10154, 408, 3477, 13, 5215, 10876, 13, 13, 2158, 29892, 364, 21478, 29892, 8722, 353, 3477, 29889, 21920, 29906, 22168, 978, 1649, 29897, 13, 21707, 353, 12183, 29889, 657, 16363, 580, 13, 13, 13, 29937, 910, 338, 901, 310, 263, 4955, 4055, 13, 3210, 16658, 29925, 6992, 29911, 29918, 16881, 29918, 1964, 29902, 3289, 353, 426, 13, 1678, 525, 3784, 2396, 6213, 29892, 13, 1678, 525, 2396, 6213, 29892, 13, 29913, 13, 13, 29937, 1473, 3233, 310, 13995, 1399, 8684, 13, 29937, 910, 338, 901, 310, 263, 8783, 4055, 13, 8452, 29918, 16881, 29918, 1964, 29902, 3289, 29906, 353, 426, 13, 1678, 525, 1579, 804, 29882, 547, 2396, 376, 8977, 29898, 562, 16434, 29918, 978, 2433, 24220, 29901, 546, 978, 29922, 8516, 29892, 735, 5762, 406, 29888, 29922, 8824, 29892, 21570, 3406, 29918, 11516, 29922, 8754, 804, 29950, 547, 742, 11955, 3535, 2433, 21012, 742, 4833, 2433, 29925, 29999, 29918, 19203, 29896, 1495, 613, 13, 1678, 525, 29886, 14018, 1688, 29899, 29890, 629, 2396, 376, 29925, 29999, 29918, 29924, 18267, 29936, 8977, 29898, 27703, 3535, 2433, 29890, 629, 742, 20704, 29922, 5574, 29892, 4236, 29918, 19057, 29922, 8516, 29892, 954, 29918, 3332, 29922, 8516, 19123, 29871, 396, 11698, 29984, 29909, 13, 1678, 525, 29886, 14018, 1688, 2396, 376, 29925, 29999, 29918, 29924, 18267, 29936, 8977, 29898, 27703, 3535, 2433, 21012, 742, 20704, 29922, 5574, 29892, 4236, 29918, 19057, 29922, 8516, 29892, 954, 29918, 3332, 29922, 8516, 19123, 29871, 396, 11698, 29984, 29909, 13, 1678, 525, 18828, 29899, 21012, 2396, 376, 29954, 29999, 29918, 9818, 29936, 8977, 29898, 27703, 3535, 2433, 21012, 742, 20704, 29922, 8824, 29892, 4236, 29918, 19057, 29922, 8516, 29892, 954, 29918, 3332, 29922, 8516, 19123, 29871, 396, 11698, 29984, 29909, 13, 1678, 525, 492, 495, 1017, 2396, 376, 492, 495, 1017, 29936, 8977, 29898, 4801, 3019, 2433, 26169, 742, 11000, 29922, 29906, 29945, 29900, 29900, 29900, 29900, 19123, 13, 1678, 525, 510, 833, 2396, 525, 510, 833, 29918, 27491, 2146, 29926, 600, 29893, 742, 13, 1678, 525, 9346, 522, 2096, 29918, 29886, 29920, 6207, 29896, 2396, 376, 29925, 29999, 29918, 19203, 29896, 29936, 8977, 29898, 562, 16434, 29918, 978, 2433, 9346, 522, 2096, 742, 11955, 3535, 2433, 21012, 742, 1375, 29918, 1725, 271, 7915, 29922, 29900, 29889, 29947, 19123, 29871, 396, 11698, 29984, 29909, 13, 1678, 525, 29886, 14018, 29906, 2396, 376, 29925, 29999, 29918, 19203, 29896, 29936, 8977, 29898, 562, 16434, 29918, 978, 2433, 9346, 522, 2096, 29901, 546, 978, 29922, 8516, 742, 11955, 3535, 2433, 21012, 742, 1375, 29918, 1725, 271, 7915, 29922, 29900, 29889, 29947, 19123, 29871, 396, 11698, 29984, 29909, 13, 1678, 525, 29886, 14018, 29941, 2396, 376, 29925, 29999, 29918, 19203, 29896, 29936, 8977, 29898, 562, 16434, 29918, 978, 29922, 8516, 29892, 11955, 3535, 2433, 21012, 742, 20704, 29922, 5574, 29892, 1375, 29918, 1725, 271, 7915, 29922, 29900, 29889, 29947, 19123, 13, 1678, 396, 29915, 29886, 14018, 29941, 29915, 1678, 584, 376, 29925, 29999, 29918, 19203, 29896, 29936, 8977, 29898, 562, 16434, 29918, 978, 2433, 4381, 29901, 275, 29918, 5203, 29922, 5574, 29892, 29939, 1195, 29918, 546, 978, 29922, 29906, 29892, 1493, 29922, 16072, 29892, 24091, 29922, 16072, 29892, 1195, 15380, 29922, 554, 742, 11955, 3535, 2433, 21012, 742, 1375, 29918, 1725, 271, 7915, 29922, 29900, 29889, 29947, 19123, 29871, 396, 11698, 29984, 29909, 13, 1678, 525, 29886, 14018, 29946, 2396, 376, 29925, 29999, 29918, 19203, 29896, 29936, 8977, 29898, 562, 16434, 29918, 978, 2433, 4381, 29901, 275, 29918, 5203, 29922, 5574, 29892, 29939, 1195, 29918, 546, 978, 29922, 29906, 29892, 1493, 29922, 16072, 29892, 24091, 29922, 16072, 29892, 1195, 15380, 29922, 554, 742, 11955, 3535, 2433, 21012, 742, 1375, 29918, 1725, 271, 7915, 29922, 29900, 29889, 29947, 19123, 13, 29913, 13, 13, 13, 1753, 7787, 3389, 7295, 13, 1678, 364, 15945, 29908, 13, 1678, 10516, 3542, 29901, 13, 4706, 396, 11474, 501, 29911, 6227, 11937, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 679, 29918, 4900, 428, 29918, 29881, 2084, 1192, 4294, 13, 13, 4706, 396, 11474, 27640, 8127, 29911, 350, 25282, 4214, 11474, 13, 4706, 396, 8878, 13373, 24541, 10785, 2129, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 29924, 18267, 1192, 562, 16434, 274, 11742, 1192, 7469, 1272, 1192, 4294, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 19203, 29896, 1192, 562, 16434, 5335, 522, 2096, 1192, 7469, 1272, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 19203, 29896, 1192, 562, 16434, 5335, 522, 2096, 29901, 546, 978, 29922, 8516, 1192, 7469, 1272, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 19203, 29896, 1192, 562, 16434, 5335, 522, 2096, 29901, 546, 978, 29922, 8516, 1192, 7469, 1272, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 28597, 391, 1192, 7469, 1272, 1192, 4294, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 28597, 391, 1192, 7469, 1272, 1192, 4294, 1192, 4130, 23179, 29922, 7320, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 28597, 391, 1192, 7469, 1272, 1192, 4294, 1192, 4130, 23179, 29922, 1039, 314, 29899, 5041, 13, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 19203, 29896, 1192, 562, 16434, 274, 11742, 29901, 546, 978, 29922, 8516, 29892, 735, 5762, 406, 29888, 29922, 8824, 29892, 21570, 3406, 29918, 11516, 29922, 8754, 804, 29950, 547, 1192, 7469, 1272, 1192, 4294, 1192, 4130, 23179, 29922, 1039, 314, 29899, 1595, 13, 13, 4706, 396, 3455, 29879, 2729, 20035, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 29924, 18267, 1192, 562, 16434, 274, 11742, 1192, 4130, 23179, 29922, 1039, 314, 29899, 1595, 1192, 7469, 1272, 1192, 4294, 13, 13, 4706, 396, 349, 905, 2729, 8783, 313, 3752, 697, 29897, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 19203, 29896, 1192, 562, 16434, 2322, 29901, 275, 29918, 5203, 29922, 5574, 29892, 29939, 1195, 29918, 546, 978, 29922, 29906, 29892, 1493, 29922, 16072, 29892, 24091, 29922, 16072, 29892, 1195, 15380, 29922, 554, 1192, 7469, 1272, 1192, 4294, 1192, 29894, 1594, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 282, 14018, 29946, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 14968, 1192, 3712, 2105, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 282, 14018, 29946, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 1688, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 282, 14018, 29946, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 1201, 369, 15828, 1192, 1217, 29899, 1579, 1278, 13, 13, 4706, 396, 11474, 323, 4717, 1177, 4214, 11474, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 19203, 29896, 1192, 562, 16434, 2322, 29901, 275, 29918, 5203, 29922, 5574, 29892, 29939, 1195, 29918, 546, 978, 29922, 29906, 29892, 1493, 29922, 16072, 29892, 24091, 29922, 16072, 29892, 1195, 15380, 29922, 554, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 14968, 1192, 3712, 2105, 13, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 5335, 522, 2096, 29918, 29886, 29920, 6207, 29896, 1192, 562, 16434, 274, 11742, 29901, 546, 978, 29922, 8516, 29892, 735, 5762, 406, 29888, 29922, 8824, 29892, 21570, 3406, 29918, 11516, 29922, 8754, 804, 29950, 547, 1192, 14968, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 29871, 1192, 3712, 2105, 29871, 396, 11698, 29984, 29909, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 5335, 522, 2096, 29918, 29886, 29920, 6207, 29896, 1192, 562, 16434, 274, 11742, 29901, 546, 978, 29922, 8516, 29892, 735, 5762, 406, 29888, 29922, 8824, 1192, 14968, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 29871, 1192, 3712, 2105, 29871, 396, 11698, 29984, 29909, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 282, 14018, 1688, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 14968, 1192, 3712, 2105, 1192, 18525, 29918, 29909, 23338, 13780, 8098, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 282, 14018, 1688, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 14968, 1192, 3712, 2105, 13, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 1652, 804, 29882, 547, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 1595, 4352, 1192, 14968, 1192, 3712, 2105, 1192, 21891, 29918, 10492, 21098, 29900, 29900, 29900, 29900, 29896, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 1652, 804, 29882, 547, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 1039, 314, 29918, 24535, 2161, 728, 1192, 14968, 1192, 3712, 2105, 1192, 21891, 29918, 10492, 21098, 29900, 29900, 29900, 29900, 29896, 13, 13, 4706, 396, 360, 15622, 5837, 304, 7945, 28597, 391, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 28597, 391, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 23521, 391, 29918, 1039, 8807, 29906, 1192, 14968, 1192, 3712, 2105, 1192, 4130, 23179, 29922, 1039, 314, 29899, 5041, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 28597, 391, 1192, 705, 5861, 29922, 1482, 1192, 1279, 29922, 23521, 391, 29899, 7320, 1192, 14968, 1192, 3712, 2105, 1192, 4130, 23179, 29922, 7320, 13, 13, 4706, 396, 11474, 2672, 1806, 25758, 26664, 3352, 29899, 29911, 4717, 1177, 4214, 11474, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 6289, 282, 14018, 1688, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 705, 5861, 29922, 18828, 29899, 21012, 29901, 3784, 1192, 14968, 1192, 3712, 2105, 13, 13, 4706, 396, 11474, 17067, 1254, 4214, 11474, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 24169, 1192, 705, 5861, 29922, 492, 495, 1017, 29901, 3784, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 1688, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 7787, 3389, 1192, 2585, 349, 29999, 29918, 19203, 29900, 1192, 705, 5861, 29922, 510, 833, 29901, 3784, 1192, 1279, 29922, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 1192, 1688, 497, 13, 13, 1678, 8741, 29901, 13, 4706, 8653, 396, 28657, 6181, 29918, 3970, 1783, 29923, 1254, 13, 4706, 8653, 515, 281, 15959, 29918, 29883, 15755, 29889, 1212, 3389, 1053, 334, 29871, 396, 11698, 29984, 29909, 13, 4706, 8653, 7787, 3389, 580, 13, 4706, 8653, 3477, 29889, 4294, 29918, 361, 29918, 3827, 287, 580, 13, 1678, 9995, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 405, 2544, 27694, 742, 525, 1127, 1495, 13, 13, 1678, 7274, 29892, 11266, 7529, 29892, 8282, 353, 6088, 29918, 5085, 580, 13, 1678, 18031, 29918, 4039, 353, 8282, 1839, 6289, 29918, 4039, 2033, 13, 1678, 1418, 23179, 353, 8282, 1839, 4130, 23179, 2033, 13, 1678, 3622, 29918, 6289, 29918, 4039, 353, 8282, 1839, 735, 725, 29918, 6289, 29918, 4039, 2033, 13, 1678, 3190, 29918, 4039, 353, 8282, 1839, 1279, 29918, 4039, 2033, 13, 1678, 1423, 3149, 29918, 4039, 353, 8282, 1839, 3198, 3149, 29918, 4039, 2033, 13, 13, 1678, 396, 448, 2683, 1378, 5634, 13, 1678, 396, 14542, 852, 278, 1667, 8783, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 22521, 3864, 13373, 24541, 742, 525, 29136, 1495, 13, 1678, 8783, 353, 2348, 342, 29918, 1272, 29889, 3874, 29890, 29918, 24713, 29898, 6289, 29918, 4039, 29892, 1418, 23179, 29897, 13, 1678, 565, 3622, 29918, 6289, 29918, 4039, 338, 451, 6213, 29901, 13, 4706, 3622, 29918, 29881, 2084, 353, 2348, 342, 29918, 1272, 29889, 657, 29918, 735, 725, 29918, 26495, 29918, 29881, 2084, 29898, 735, 725, 29918, 6289, 29918, 4039, 29897, 13, 1678, 1683, 29901, 13, 4706, 3622, 29918, 29881, 2084, 353, 6213, 13, 13, 1678, 17927, 29889, 3888, 877, 24713, 29889, 26495, 29918, 29881, 2084, 353, 1273, 29878, 29915, 1273, 313, 24713, 29889, 26495, 29918, 29881, 2084, 29892, 876, 13, 13, 1678, 17927, 29889, 3888, 877, 16390, 24541, 10785, 294, 7670, 29901, 1273, 29878, 29915, 1273, 313, 24713, 29889, 19973, 29918, 1989, 29892, 876, 13, 1678, 17927, 29889, 3888, 29898, 13, 4706, 525, 7583, 13373, 24541, 10522, 29901, 1273, 29878, 29915, 13, 4706, 1273, 313, 329, 29889, 262, 1765, 29918, 8977, 29898, 8452, 29918, 16881, 29918, 1964, 29902, 3289, 29906, 467, 657, 29898, 24713, 29889, 19973, 29918, 1989, 29892, 6213, 511, 29897, 13, 1678, 1723, 13, 13, 1678, 565, 7274, 1839, 7469, 1272, 2033, 29901, 13, 4706, 396, 13905, 13995, 1820, 393, 11053, 304, 445, 3153, 8783, 13, 4706, 565, 3477, 29889, 4294, 29918, 11102, 29918, 3827, 287, 7295, 13, 9651, 16254, 29918, 353, 8783, 29889, 1639, 627, 580, 29871, 396, 11698, 29984, 29909, 13, 9651, 736, 13, 4706, 17927, 29889, 3888, 877, 856, 735, 11407, 1495, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 396, 448, 2683, 1378, 5634, 13, 1678, 396, 14542, 852, 1904, 11258, 13, 1678, 396, 14402, 29901, 848, 674, 817, 304, 736, 5235, 1048, 1353, 310, 11073, 297, 1776, 3149, 4733, 13, 1678, 396, 12048, 1598, 1904, 3190, 436, 14819, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 28333, 12048, 2450, 742, 525, 29136, 1495, 13, 1678, 565, 3190, 29918, 4039, 1275, 525, 1039, 314, 29906, 5461, 2396, 13, 4706, 1904, 353, 4733, 29889, 29903, 2829, 968, 13409, 29903, 1038, 618, 3195, 29898, 13, 9651, 848, 29918, 12181, 29922, 24713, 29889, 1272, 29918, 12181, 29892, 13, 9651, 6694, 29918, 29881, 2084, 29922, 24713, 29889, 26495, 29918, 29881, 2084, 29892, 13, 9651, 3579, 24947, 7529, 13, 4706, 1723, 13, 1678, 25342, 3190, 29918, 4039, 29889, 27382, 2541, 877, 1039, 314, 29374, 13, 4706, 1904, 353, 4733, 29889, 29903, 2829, 968, 29931, 29906, 29898, 13, 9651, 848, 29918, 12181, 29922, 24713, 29889, 1272, 29918, 12181, 29892, 13, 9651, 3190, 29918, 4039, 29922, 1279, 29918, 4039, 29892, 13, 9651, 6694, 29918, 29881, 2084, 29922, 24713, 29889, 26495, 29918, 29881, 2084, 29892, 13, 9651, 3579, 24947, 7529, 13, 4706, 1723, 13, 1678, 25342, 3190, 29918, 4039, 1275, 525, 23521, 391, 29899, 7320, 2396, 13, 4706, 1904, 353, 4733, 29889, 29924, 29940, 9047, 3195, 29898, 13, 9651, 848, 29918, 12181, 29922, 24713, 29889, 1272, 29918, 12181, 29892, 13, 9651, 1962, 29918, 6229, 29879, 29922, 24713, 29889, 4905, 29918, 6229, 29879, 29892, 13, 9651, 3190, 29918, 4039, 29922, 1279, 29918, 4039, 29892, 13, 9651, 6694, 29918, 29881, 2084, 29922, 24713, 29889, 26495, 29918, 29881, 2084, 29892, 13, 9651, 3579, 24947, 7529, 13, 4706, 1723, 13, 4706, 1209, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 14148, 3190, 29918, 4039, 16328, 29878, 29915, 1273, 313, 1279, 29918, 4039, 29892, 876, 13, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 25455, 3190, 305, 14819, 742, 525, 29136, 1495, 13, 1678, 1904, 29889, 2344, 29918, 1279, 580, 13, 13, 1678, 396, 448, 2683, 1378, 5634, 13, 1678, 396, 14542, 852, 7688, 17865, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 21605, 18177, 742, 525, 29136, 1495, 13, 1678, 565, 1423, 3149, 29918, 4039, 1275, 525, 1482, 2396, 13, 4706, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 334, 17250, 5281, 716, 18177, 742, 525, 4366, 21012, 1495, 13, 4706, 1904, 29889, 276, 2344, 29918, 705, 5861, 580, 13, 1678, 1683, 29901, 13, 4706, 1423, 3149, 29918, 4039, 353, 1904, 29889, 17863, 29918, 29888, 3365, 1537, 29918, 3198, 3149, 29918, 11037, 29898, 13, 9651, 1423, 3149, 29918, 4039, 29892, 3622, 29918, 29881, 2084, 13, 4706, 1723, 13, 4706, 3477, 29889, 2780, 2158, 29898, 13, 9651, 525, 29961, 1212, 3389, 29962, 334, 24062, 1747, 18177, 1423, 3149, 29918, 4039, 16328, 29878, 29915, 1273, 313, 3198, 3149, 29918, 4039, 29892, 511, 13, 9651, 525, 4366, 21012, 742, 13, 4706, 1723, 13, 4706, 565, 3622, 29918, 29881, 2084, 338, 451, 6213, 29901, 13, 9651, 1904, 29889, 1359, 29918, 735, 725, 29918, 705, 5861, 29898, 29881, 2084, 29922, 735, 725, 29918, 29881, 2084, 29892, 1423, 3149, 29918, 4039, 29922, 3198, 3149, 29918, 4039, 29897, 13, 4706, 25342, 1904, 29889, 5349, 29918, 17314, 29918, 3859, 29898, 3198, 3149, 29918, 4039, 29922, 3198, 3149, 29918, 4039, 1125, 13, 9651, 1904, 29889, 1359, 29918, 4299, 29918, 3859, 29898, 3198, 3149, 29918, 4039, 29922, 3198, 3149, 29918, 4039, 29897, 13, 4706, 1683, 29901, 13, 9651, 1904, 29918, 3859, 29918, 29888, 2084, 353, 1904, 29889, 657, 29918, 4299, 29918, 3859, 29918, 29888, 2084, 29898, 3198, 3149, 29918, 4039, 29922, 3198, 3149, 29918, 4039, 29897, 13, 9651, 17927, 29889, 3888, 877, 4299, 29918, 3859, 29918, 29888, 2084, 353, 1273, 29878, 29915, 1273, 313, 4299, 29918, 3859, 29918, 29888, 2084, 29892, 876, 13, 9651, 3477, 29889, 3198, 2084, 29898, 4299, 29918, 3859, 29918, 29888, 2084, 29892, 26952, 29922, 5574, 29897, 13, 9651, 17927, 29889, 3888, 29898, 13, 18884, 525, 29968, 21369, 1423, 9748, 526, 29901, 525, 718, 3477, 29889, 276, 558, 29941, 29898, 4299, 29889, 1761, 29918, 17314, 29918, 3198, 9748, 3101, 13, 9651, 1723, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 6702, 2525, 9778, 1490, 7688, 2069, 29901, 525, 525, 3198, 3149, 29918, 4039, 16328, 29878, 29892, 3622, 29918, 6289, 29918, 4039, 16328, 29878, 1495, 13, 18884, 1273, 313, 13, 462, 1678, 1423, 3149, 29918, 4039, 29892, 13, 462, 1678, 3622, 29918, 6289, 29918, 4039, 29892, 13, 18884, 1723, 13, 9651, 1723, 13, 13, 1678, 396, 17927, 29889, 3888, 877, 3195, 4306, 29901, 1495, 13, 1678, 396, 17927, 29889, 3888, 29898, 4299, 29889, 657, 29918, 3859, 29918, 710, 3101, 13, 1678, 396, 448, 2683, 1378, 5634, 13, 1678, 565, 451, 1904, 29889, 275, 29918, 14968, 29918, 3859, 29918, 11228, 1891, 7295, 13, 4706, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 20768, 304, 11905, 6694, 2106, 742, 525, 29136, 1495, 13, 4706, 1060, 29918, 14968, 29892, 343, 29918, 14968, 353, 8783, 29889, 6484, 877, 14968, 1495, 13, 4706, 1904, 29889, 7469, 29918, 1272, 29918, 7529, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29897, 13, 13, 1678, 396, 7525, 319, 1953, 13, 1678, 565, 7274, 1839, 14968, 2033, 29901, 13, 4706, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 26101, 10729, 287, 742, 525, 29136, 1495, 13, 4706, 396, 6088, 6694, 6273, 13, 4706, 2295, 353, 3477, 29889, 1191, 5510, 29918, 8977, 29898, 13, 9651, 9657, 29898, 13, 18884, 3152, 29918, 2311, 29922, 29896, 29945, 29892, 13, 18884, 4236, 29918, 1022, 2878, 29879, 29922, 29896, 29906, 29900, 29900, 29892, 13, 18884, 6554, 29918, 7099, 388, 29922, 29900, 29889, 29947, 29892, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 1904, 29889, 3712, 2105, 29918, 2917, 29889, 5504, 29898, 1068, 2917, 29897, 13, 4706, 1060, 29918, 14968, 29892, 343, 29918, 14968, 353, 8783, 29889, 6484, 877, 14968, 1495, 13, 4706, 1060, 29918, 3084, 29892, 343, 29918, 3084, 353, 8783, 29889, 6484, 877, 3084, 1495, 13, 4706, 1904, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 3084, 29922, 29990, 29918, 3084, 29892, 343, 29918, 3084, 29922, 29891, 29918, 3084, 29897, 13, 13, 1678, 25342, 7274, 1839, 1688, 2033, 29901, 13, 4706, 396, 4974, 1904, 29889, 13318, 29918, 9902, 1839, 1022, 2878, 2033, 338, 451, 6213, 13, 4706, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 4321, 10729, 287, 742, 525, 29136, 1495, 13, 4706, 565, 7274, 1839, 1688, 497, 2033, 29901, 13, 9651, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 29871, 334, 4321, 292, 373, 599, 848, 742, 525, 4366, 21012, 1495, 13, 9651, 1060, 29918, 1688, 29892, 343, 29918, 1688, 353, 8783, 29889, 6484, 877, 497, 1495, 13, 9651, 12151, 29918, 19635, 353, 8783, 29889, 6484, 29918, 19635, 877, 497, 1495, 13, 4706, 1683, 29901, 13, 9651, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 29871, 334, 4321, 292, 373, 1243, 11306, 742, 525, 4366, 21012, 1495, 13, 9651, 1060, 29918, 1688, 29892, 343, 29918, 1688, 353, 8783, 29889, 6484, 877, 1688, 1495, 13, 9651, 12151, 29918, 19635, 353, 8783, 29889, 6484, 29918, 19635, 877, 1688, 1495, 13, 4706, 848, 29892, 11073, 353, 1060, 29918, 1688, 29892, 343, 29918, 1688, 13, 4706, 1418, 273, 420, 353, 8783, 29889, 19973, 29918, 1989, 13, 4706, 15729, 29889, 1688, 29918, 1039, 314, 968, 29918, 546, 13390, 29898, 4299, 29892, 848, 29892, 11073, 29892, 12151, 29918, 19635, 29892, 1418, 273, 420, 29897, 13, 1678, 1683, 29901, 13, 4706, 565, 451, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 9006, 29374, 13, 9651, 12020, 7865, 2392, 877, 28450, 1244, 29889, 817, 304, 7945, 470, 1243, 1495, 13, 13, 1678, 565, 7274, 1839, 23679, 2033, 29901, 13, 4706, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 12904, 10729, 287, 742, 525, 29136, 1495, 13, 4706, 9805, 29918, 29881, 2084, 353, 3477, 29889, 3009, 2084, 877, 20038, 15063, 1884, 29914, 8979, 29923, 3235, 1495, 13, 4706, 6369, 29918, 4299, 29918, 3859, 353, 3477, 29889, 24538, 7122, 29898, 13, 9651, 9805, 29918, 29881, 2084, 29892, 1904, 29889, 1279, 29918, 4039, 718, 22868, 4299, 29918, 3859, 29889, 29886, 6321, 29915, 13, 4706, 1723, 13, 4706, 3477, 29889, 8552, 29898, 4299, 29889, 657, 29918, 4299, 29918, 3859, 29918, 29888, 2084, 3285, 6369, 29918, 4299, 29918, 3859, 29897, 13, 4706, 3477, 29889, 1493, 29918, 12322, 29898, 23679, 29918, 29881, 2084, 29897, 13, 4706, 17927, 29889, 3888, 29898, 13, 9651, 525, 3492, 817, 304, 679, 278, 5768, 1884, 1544, 322, 525, 13, 9651, 525, 9573, 372, 964, 278, 8210, 934, 29915, 13, 4706, 1723, 13, 4706, 396, 8450, 2601, 5768, 1884, 13, 4706, 396, 2045, 597, 1636, 29889, 8865, 1884, 29889, 510, 29914, 17426, 29914, 3221, 29914, 2962, 29914, 4691, 13, 4706, 396, 1053, 5768, 1884, 29871, 396, 817, 288, 5150, 13, 4706, 396, 3132, 29889, 13653, 11219, 1357, 1445, 29889, 3945, 742, 3273, 29918, 2271, 29922, 8824, 29897, 13, 4706, 396, 2045, 597, 29893, 789, 2909, 423, 19033, 29889, 17688, 12864, 29889, 1212, 29914, 9794, 29914, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 29918, 4299, 29918, 3859, 29889, 29886, 6321, 13, 13, 1678, 565, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 9006, 29374, 13, 4706, 3477, 29889, 17987, 580, 13, 13, 13, 1753, 6088, 29918, 5085, 7295, 13, 1678, 18031, 29918, 4381, 353, 6213, 13, 1678, 3190, 29918, 4381, 353, 525, 1039, 8807, 29906, 29918, 29896, 29906, 29947, 29915, 13, 1678, 18177, 29918, 4039, 29918, 4381, 353, 6213, 13, 1678, 396, 4321, 1819, 13, 1678, 565, 7700, 29901, 13, 4706, 18031, 29918, 4381, 353, 525, 492, 495, 1017, 29915, 13, 4706, 18177, 29918, 4039, 29918, 4381, 353, 525, 3784, 29915, 13, 4706, 4974, 3477, 29889, 262, 5690, 1656, 580, 13, 13, 1678, 396, 20969, 1899, 1220, 6389, 13, 1678, 18031, 29918, 4039, 353, 3477, 29889, 657, 29918, 1191, 791, 29898, 877, 489, 24713, 742, 525, 489, 6289, 5477, 1134, 29918, 29922, 710, 29892, 2322, 29922, 6289, 29918, 4381, 29897, 13, 1678, 1418, 23179, 353, 3477, 29889, 657, 29918, 1191, 791, 29898, 877, 489, 4130, 23179, 742, 525, 489, 6008, 5477, 1134, 29918, 29922, 710, 29892, 2322, 2433, 1039, 314, 29899, 5041, 1495, 13, 1678, 3190, 29918, 4039, 353, 3477, 29889, 657, 29918, 1191, 791, 29898, 877, 489, 1279, 742, 17411, 29874, 5477, 2322, 29922, 1279, 29918, 4381, 29897, 13, 1678, 18177, 29918, 4039, 353, 3477, 29889, 657, 29918, 1191, 791, 29898, 13, 4706, 6702, 489, 705, 5861, 742, 525, 29974, 29893, 5477, 1134, 29918, 29922, 710, 29892, 2322, 29922, 705, 5861, 29918, 4039, 29918, 4381, 13, 1678, 1723, 13, 13, 1678, 396, 512, 2616, 1971, 403, 716, 2295, 6433, 29973, 13, 1678, 396, 29091, 353, 7700, 13, 1678, 396, 565, 29091, 29901, 13, 1678, 396, 1678, 2322, 29918, 22992, 351, 29918, 16859, 353, 426, 13, 1678, 396, 4706, 525, 6289, 2396, 525, 29925, 29999, 29918, 29924, 18267, 742, 13, 1678, 396, 4706, 525, 8513, 2396, 525, 5041, 267, 742, 13, 1678, 396, 4706, 525, 1279, 2396, 3190, 29918, 4381, 13, 1678, 396, 1678, 500, 13, 1678, 396, 1678, 4257, 29918, 4381, 29879, 29918, 8977, 353, 426, 13, 1678, 396, 4706, 525, 2396, 2322, 29918, 22992, 351, 29918, 16859, 13, 1678, 396, 1678, 500, 13, 1678, 396, 1678, 3477, 29889, 5510, 29918, 19218, 29918, 16859, 877, 22992, 351, 742, 4257, 29918, 4381, 29879, 29918, 8977, 29922, 17514, 29918, 4381, 29879, 29918, 8977, 29897, 13, 13, 1678, 11266, 7529, 353, 3477, 29889, 1191, 5510, 29918, 8977, 29898, 13, 4706, 426, 13, 9651, 396, 29915, 16175, 29918, 2311, 2396, 29871, 29896, 29906, 29947, 29892, 13, 9651, 525, 16175, 29918, 2311, 2396, 29871, 29906, 29945, 29953, 29892, 13, 9651, 396, 29915, 21891, 29918, 10492, 2396, 869, 29900, 29900, 29900, 29945, 29892, 13, 9651, 525, 21891, 29918, 10492, 2396, 29871, 29900, 29889, 29896, 29892, 13, 9651, 525, 29885, 2932, 398, 2396, 29871, 29900, 29889, 29929, 29892, 13, 9651, 396, 29915, 7915, 29918, 7099, 388, 2396, 29871, 29900, 29889, 29900, 29900, 29900, 29945, 29892, 13, 9651, 525, 7915, 29918, 7099, 388, 2396, 29871, 29900, 29889, 29900, 29900, 29900, 29896, 29892, 13, 4706, 2981, 13, 4706, 13995, 29918, 8977, 3790, 13, 9651, 525, 7915, 29918, 7099, 388, 2396, 6024, 7099, 388, 7464, 13, 9651, 525, 21891, 29918, 10492, 2396, 6024, 19668, 29918, 10492, 7464, 13, 4706, 2981, 13, 1678, 1723, 13, 1678, 7274, 353, 3477, 29889, 1191, 5510, 29918, 8977, 29898, 13, 4706, 426, 13, 9651, 525, 14968, 2396, 7700, 29892, 13, 9651, 525, 1688, 2396, 7700, 29892, 13, 9651, 525, 1688, 497, 2396, 7700, 29892, 13, 9651, 525, 23679, 2396, 7700, 29892, 13, 9651, 525, 7469, 1272, 2396, 7700, 29892, 13, 4706, 500, 13, 1678, 1723, 13, 1678, 7274, 1839, 1688, 2033, 353, 7274, 1839, 1688, 2033, 470, 7274, 1839, 1688, 497, 2033, 13, 13, 1678, 396, 2867, 786, 18177, 4055, 964, 3622, 29918, 6289, 322, 1423, 3149, 13, 1678, 565, 18177, 29918, 4039, 338, 451, 6213, 322, 525, 11283, 297, 18177, 29918, 4039, 29901, 13, 4706, 3622, 29918, 6289, 29918, 4039, 29892, 1423, 3149, 29918, 4039, 353, 18177, 29918, 4039, 29889, 5451, 877, 29901, 1495, 13, 1678, 1683, 29901, 13, 4706, 3622, 29918, 6289, 29918, 4039, 353, 6213, 13, 4706, 1423, 3149, 29918, 4039, 353, 18177, 29918, 4039, 13, 1678, 396, 8814, 14430, 2129, 13, 1678, 18031, 29918, 4039, 353, 360, 29903, 29918, 16881, 29918, 1964, 29902, 3289, 29906, 29889, 657, 29898, 6289, 29918, 4039, 29892, 18031, 29918, 4039, 29897, 13, 1678, 3622, 29918, 6289, 29918, 4039, 353, 360, 29903, 29918, 16881, 29918, 1964, 29902, 3289, 29906, 29889, 657, 29898, 735, 725, 29918, 6289, 29918, 4039, 29892, 3622, 29918, 6289, 29918, 4039, 29897, 13, 1678, 1423, 3149, 29918, 4039, 353, 23557, 29925, 6992, 29911, 29918, 16881, 29918, 1964, 29902, 3289, 29889, 657, 29898, 3198, 3149, 29918, 4039, 29892, 1423, 3149, 29918, 4039, 29897, 13, 1678, 8282, 353, 426, 13, 4706, 525, 6289, 29918, 4039, 2396, 18031, 29918, 4039, 29892, 13, 4706, 525, 735, 725, 29918, 6289, 29918, 4039, 2396, 3622, 29918, 6289, 29918, 4039, 29892, 13, 4706, 525, 3198, 3149, 29918, 4039, 2396, 1423, 3149, 29918, 4039, 29892, 13, 4706, 525, 1279, 29918, 4039, 2396, 3190, 29918, 4039, 29892, 13, 4706, 525, 4130, 23179, 2396, 1418, 23179, 29892, 13, 1678, 500, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 334, 18031, 29918, 4039, 16328, 29878, 29915, 1273, 313, 6289, 29918, 4039, 29892, 511, 525, 4366, 21012, 1495, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 334, 3190, 29918, 4039, 16328, 29878, 29915, 1273, 313, 1279, 29918, 4039, 29892, 511, 525, 4366, 21012, 1495, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 334, 3622, 29918, 6289, 29918, 4039, 16328, 29878, 29915, 1273, 313, 735, 725, 29918, 6289, 29918, 4039, 29892, 511, 525, 4366, 21012, 1495, 13, 1678, 3477, 29889, 2780, 2158, 877, 29961, 1212, 3389, 29962, 334, 1423, 3149, 29918, 4039, 16328, 29878, 29915, 1273, 313, 3198, 3149, 29918, 4039, 29892, 511, 525, 4366, 21012, 1495, 13, 1678, 736, 7274, 29892, 11266, 7529, 29892, 8282, 13, 13, 13, 1753, 10366, 29918, 6289, 29918, 11338, 29898, 6289, 29918, 19973, 29918, 1761, 1125, 13, 1678, 364, 15945, 29908, 13, 1678, 10516, 3542, 29901, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 1192, 13264, 10366, 29918, 6289, 29918, 11338, 1192, 19973, 29899, 1761, 330, 29920, 29899, 21012, 330, 3568, 282, 14018, 1688, 302, 9302, 13, 13, 1678, 14402, 29901, 13, 4706, 1732, 597, 2417, 29889, 510, 29914, 2619, 29914, 29896, 29947, 29946, 29929, 29906, 29906, 29955, 29941, 29914, 510, 2109, 292, 29899, 29882, 2176, 29945, 29899, 5325, 13, 13, 1678, 8741, 29901, 13, 4706, 8653, 396, 28657, 6181, 29918, 3970, 1783, 29923, 1254, 13, 4706, 8653, 515, 281, 15959, 29918, 29883, 15755, 29889, 1212, 3389, 1053, 334, 29871, 396, 11698, 29984, 29909, 13, 4706, 8653, 18031, 29918, 19973, 29918, 1761, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 19973, 29899, 1761, 742, 1134, 29918, 29922, 1761, 29892, 2322, 11759, 2314, 13, 4706, 8653, 1121, 353, 10366, 29918, 6289, 29918, 11338, 29898, 6289, 29918, 19973, 29918, 1761, 29897, 13, 4706, 8653, 1596, 29898, 2914, 29897, 13, 1678, 9995, 13, 1678, 18031, 29918, 4039, 29918, 1761, 353, 518, 8452, 29918, 16881, 29918, 1964, 29902, 3289, 29906, 29889, 657, 29898, 6289, 29918, 4039, 29892, 18031, 29918, 4039, 29897, 363, 18031, 29918, 4039, 297, 18031, 29918, 19973, 29918, 1761, 29962, 13, 1678, 8783, 29918, 1761, 353, 518, 292, 342, 29918, 1272, 29889, 3874, 29890, 29918, 1039, 314, 29918, 24713, 29898, 6289, 29918, 4039, 29897, 363, 18031, 29918, 4039, 297, 18031, 29918, 4039, 29918, 1761, 29962, 13, 1678, 19412, 29918, 24713, 353, 2348, 342, 29918, 1272, 29889, 14634, 29918, 14538, 1691, 29898, 24713, 29918, 1761, 29897, 13, 1678, 17927, 29889, 3888, 29898, 1050, 3192, 29918, 24713, 29889, 19973, 29918, 1989, 29897, 13, 1678, 736, 19412, 29918, 24713, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 9995, 13, 1678, 10516, 3542, 29901, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 29889, 1212, 3389, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 29889, 1212, 3389, 1192, 284, 2506, 9422, 13, 4706, 3017, 448, 29885, 281, 15959, 29918, 29883, 15755, 29889, 1212, 3389, 1192, 284, 2506, 9422, 1192, 3998, 815, 1192, 17639, 2214, 13, 1678, 9995, 13, 1678, 396, 7945, 29918, 29886, 29920, 580, 13, 1678, 1053, 6674, 307, 985, 292, 13, 13, 1678, 6674, 307, 985, 292, 29889, 9021, 911, 29918, 5924, 580, 29871, 396, 363, 5401, 29941, 29906, 13, 1678, 1053, 318, 10154, 408, 3477, 29871, 396, 11698, 29984, 29909, 13, 13, 1678, 396, 1053, 18116, 13, 1678, 396, 411, 18116, 29889, 12510, 29918, 25442, 886, 7295, 13, 1678, 396, 1678, 396, 315, 1071, 599, 18116, 304, 2337, 367, 19799, 29889, 13, 1678, 396, 1678, 18116, 29889, 4572, 25442, 886, 703, 2704, 613, 376, 5575, 657, 29918, 497, 29918, 5464, 29918, 29890, 3173, 29918, 7529, 5575, 1159, 13, 1678, 3477, 29889, 1867, 312, 342, 29918, 7692, 2395, 580, 13, 2 ]
upcfcardsearch/c133.py
ProfessorSean/Kasutamaiza
0
1615344
import discord from discord.ext import commands from discord.utils import get class c133(commands.Cog, name="c133"): def __init__(self, bot: commands.Bot): self.bot = bot @commands.command(name='Cyberse-Cop', aliases=['c133']) async def example_embed(self, ctx): embed = discord.Embed(title='Cyberse-Cop', color=0xFDE68A) embed.set_thumbnail(url='https://www.duelingbook.com/images/custom-pics/2300000/2334898.jpg') embed.add_field(name='Status (Archetype)', value='Casual:3/Tournament:3', inline=True) embed.add_field(name='Type (Attribute)', value='Cyberse/Normal (FIRE)', inline=False) embed.add_field(name='Level (ATK/DEF)', value='7 (3000/2500)', inline=False) embed.add_field(name='Lore Text', value='Constantly on guard, the Cyberse-Cops stop at nothing to ensure truth and justice is upheld. They are constanly updated on the crime in the area and are swift in taking action.', inline=False) embed.set_footer(text='Set Code: ANCF') await ctx.send(embed=embed) def setup(bot: commands.Bot): bot.add_cog(c133(bot))
[ 1, 1053, 2313, 536, 13, 3166, 2313, 536, 29889, 1062, 1053, 8260, 13, 3166, 2313, 536, 29889, 13239, 1053, 679, 13, 13, 1990, 274, 29896, 29941, 29941, 29898, 26381, 29889, 29907, 468, 29892, 1024, 543, 29883, 29896, 29941, 29941, 29908, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9225, 29901, 8260, 29889, 29933, 327, 1125, 13, 4706, 1583, 29889, 7451, 353, 9225, 13, 1678, 732, 26381, 29889, 6519, 29898, 978, 2433, 29733, 495, 344, 29899, 29907, 459, 742, 14430, 2129, 29922, 1839, 29883, 29896, 29941, 29941, 11287, 13, 1678, 7465, 822, 1342, 29918, 17987, 29898, 1311, 29892, 12893, 1125, 13, 4706, 8297, 353, 2313, 536, 29889, 6026, 2580, 29898, 3257, 2433, 29733, 495, 344, 29899, 29907, 459, 742, 13, 462, 795, 2927, 29922, 29900, 29916, 29943, 2287, 29953, 29947, 29909, 29897, 13, 4706, 8297, 29889, 842, 29918, 386, 21145, 29898, 2271, 2433, 991, 597, 1636, 29889, 700, 14067, 2909, 29889, 510, 29914, 8346, 29914, 6341, 29899, 29886, 1199, 29914, 29906, 29941, 29900, 29900, 29900, 29900, 29900, 29914, 29906, 29941, 29941, 29946, 29947, 29929, 29947, 29889, 6173, 1495, 13, 13, 4706, 8297, 29889, 1202, 29918, 2671, 29898, 978, 2433, 5709, 313, 13197, 300, 668, 29897, 742, 995, 2433, 29907, 294, 950, 29901, 29941, 29914, 29911, 2905, 1166, 29901, 29941, 742, 10583, 29922, 5574, 29897, 13, 4706, 8297, 29889, 1202, 29918, 2671, 29898, 978, 2433, 1542, 313, 6708, 29897, 742, 995, 2433, 29733, 495, 344, 29914, 19077, 313, 3738, 1525, 29897, 742, 10583, 29922, 8824, 29897, 13, 4706, 8297, 29889, 1202, 29918, 2671, 29898, 978, 2433, 10108, 313, 1299, 29968, 29914, 24405, 29897, 742, 995, 2433, 29955, 313, 29941, 29900, 29900, 29900, 29914, 29906, 29945, 29900, 29900, 29897, 742, 10583, 29922, 8824, 29897, 13, 4706, 8297, 29889, 1202, 29918, 2671, 29898, 978, 2433, 29931, 487, 3992, 742, 995, 2433, 12075, 10835, 373, 8372, 29892, 278, 8045, 495, 344, 29899, 29907, 3554, 5040, 472, 3078, 304, 9801, 8760, 322, 15426, 338, 318, 561, 2495, 29889, 2688, 526, 1040, 273, 368, 4784, 373, 278, 17268, 297, 278, 4038, 322, 526, 12086, 297, 5622, 3158, 29889, 742, 10583, 29922, 8824, 29897, 13, 4706, 8297, 29889, 842, 29918, 21720, 29898, 726, 2433, 2697, 5920, 29901, 13764, 9207, 1495, 13, 13, 4706, 7272, 12893, 29889, 6717, 29898, 17987, 29922, 17987, 29897, 13, 13, 1753, 6230, 29898, 7451, 29901, 8260, 29889, 29933, 327, 1125, 13, 1678, 9225, 29889, 1202, 29918, 29883, 468, 29898, 29883, 29896, 29941, 29941, 29898, 7451, 876, 2 ]
cs15211/StoneGame.py
JulyKikuAkita/PythonPrac
1
29901
<gh_stars>1-10 __source__ = 'https://leetcode.com/problems/stone-game/' # Time: O() # Space: O() # # Description: Leetcode # 877. Stone Game # # Alex and Lee play a game with piles of stones. # There are an even number of piles arranged in a row, # and each pile has a positive integer number of stones piles[i]. # # The objective of the game is to end with the most stones. # The total number of stones is odd, so there are no ties. # # Alex and Lee take turns, with Alex starting first. # Each turn, a player takes the entire pile of stones from either the beginning # or the end of the row. This continues until there are no more piles left, # at which point the person with the most stones wins. # # Assuming Alex and Lee play optimally, return True if and only if Alex wins the game. # # # # Example 1: # # Input: [5,3,4,5] # Output: true # Explanation: # Alex starts first, and can only take the first 5 or the last 5. # Say he takes the first 5, so that the row becomes [3, 4, 5]. # If Lee takes 3, then the board is [4, 5], and Alex takes 5 to win with 10 points. # If Lee takes the last 5, then the board is [3, 4], and Alex takes 4 to win with 9 points. # This demonstrated that taking the first 5 was a winning move for Alex, so we return true. # # # Note: # # 2 <= piles.length <= 500 # piles.length is even. # 1 <= piles[i] <= 500 # sum(piles) is odd. # import unittest class Solution(object): def stoneGame(self, piles): """ :type piles: List[int] :rtype: bool """ return True class SolutionDP(object): def stoneGame(self, piles): """ :type piles: List[int] :rtype: bool """ n = len(piles) dp = [[0] * n for _ in range(n)] for i in range(n): dp[i][i] = piles[i] for l in range(2, n + 1): for i in range(n - l + 1): j = i + l - 1 dp[i][j] = max(piles[i] - dp[i + 1][j], piles[j] - dp[i][j - 1]) return dp[0][n - 1] > 0 class TestMethods(unittest.TestCase): def test_Local(self): self.assertEqual(1, 1) if __name__ == '__main__': unittest.main() Java = ''' # Thought: https://leetcode.com/problems/stone-game/solution/ Approach 1: Dynamic Programming Complexity Analysis Time Complexity: O(N^2), where N is the number of piles. Space Complexity: O(N^2), the space used storing the intermediate results of each subgame. # 10ms 36.14% class Solution { public boolean stoneGame(int[] piles) { int N = piles.length; // dp[i+1][j+1] = the value of the game [piles[i], ..., piles[j]]. int[][] dp = new int[N+2][N+2]; for (int size = 1; size <= N; ++ size) { for (int i = 0; i + size <= N; ++i) { int j = i + size - 1; int parity = ( j + i + N) % 2; // j - i - N; but +x = -x (mod 2) if (parity == 1) { dp[i + 1][j + 1] = Math.max(piles[i] + dp[i +2][j + 1], piles[j] + dp[i + 1][j]); } else { dp[i + 1][j + 1] = Math.min(-piles[i] + dp[i +2][j + 1], -piles[j] + dp[i + 1][j]); } } } return dp[1][N] > 0; } } Approach 2: Mathematical Complexity Analysis Time and Space Complexity: O(1) # 3ms 53.69% class Solution { public boolean stoneGame(int[] piles) { return true; } } # 2ms 99.64% class Solution { public boolean stoneGame(int[] piles) { int left = 0; int right = piles.length-1; int alex = 0; int lee = 0; boolean alexTurn = true; while (left < right) { if (alexTurn) { if (piles[left] > piles[right]) { alex += piles[left]; left++; } else { alex += piles[right]; right--; } } else { if (piles[left] > piles[right]) { lee += piles[left]; left++; } else { lee += piles[right]; right--; } } } return alex > lee; } } '''
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 1649, 4993, 1649, 353, 525, 991, 597, 280, 300, 401, 29889, 510, 29914, 17199, 29879, 29914, 12734, 29899, 11802, 22208, 13, 29937, 5974, 29901, 29871, 438, 580, 13, 29937, 14121, 29901, 438, 580, 13, 29937, 13, 29937, 12953, 29901, 951, 300, 401, 396, 29871, 29947, 29955, 29955, 29889, 15681, 8448, 13, 29937, 13, 29937, 4827, 322, 9371, 1708, 263, 3748, 411, 282, 5475, 310, 25702, 29889, 13, 29937, 1670, 526, 385, 1584, 1353, 310, 282, 5475, 21050, 297, 263, 1948, 29892, 13, 29937, 322, 1269, 282, 488, 756, 263, 6374, 6043, 1353, 310, 25702, 282, 5475, 29961, 29875, 1822, 13, 29937, 13, 29937, 450, 12091, 310, 278, 3748, 338, 304, 1095, 411, 278, 1556, 25702, 29889, 13, 29937, 450, 3001, 1353, 310, 25702, 338, 7736, 29892, 577, 727, 526, 694, 260, 583, 29889, 13, 29937, 13, 29937, 4827, 322, 9371, 2125, 12169, 29892, 411, 4827, 6257, 937, 29889, 13, 29937, 7806, 2507, 29892, 263, 4847, 4893, 278, 4152, 282, 488, 310, 25702, 515, 2845, 278, 6763, 13, 29937, 470, 278, 1095, 310, 278, 1948, 29889, 29871, 910, 18172, 2745, 727, 526, 694, 901, 282, 5475, 2175, 29892, 13, 29937, 472, 607, 1298, 278, 2022, 411, 278, 1556, 25702, 21614, 29889, 13, 29937, 13, 29937, 17090, 4827, 322, 9371, 1708, 5994, 635, 29892, 736, 5852, 565, 322, 871, 565, 4827, 21614, 278, 3748, 29889, 13, 29937, 13, 29937, 13, 29937, 13, 29937, 8741, 29871, 29896, 29901, 13, 29937, 13, 29937, 10567, 29901, 518, 29945, 29892, 29941, 29892, 29946, 29892, 29945, 29962, 13, 29937, 10604, 29901, 1565, 13, 29937, 1222, 9018, 362, 29901, 13, 29937, 4827, 8665, 937, 29892, 322, 508, 871, 2125, 278, 937, 29871, 29945, 470, 278, 1833, 29871, 29945, 29889, 13, 29937, 14891, 540, 4893, 278, 937, 29871, 29945, 29892, 577, 393, 278, 1948, 7415, 518, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 1822, 13, 29937, 960, 9371, 4893, 29871, 29941, 29892, 769, 278, 7613, 338, 518, 29946, 29892, 29871, 29945, 1402, 322, 4827, 4893, 29871, 29945, 304, 5401, 411, 29871, 29896, 29900, 3291, 29889, 13, 29937, 960, 9371, 4893, 278, 1833, 29871, 29945, 29892, 769, 278, 7613, 338, 518, 29941, 29892, 29871, 29946, 1402, 322, 4827, 4893, 29871, 29946, 304, 5401, 411, 29871, 29929, 3291, 29889, 13, 29937, 910, 28585, 393, 5622, 278, 937, 29871, 29945, 471, 263, 15613, 4337, 363, 4827, 29892, 577, 591, 736, 1565, 29889, 13, 29937, 13, 29937, 13, 29937, 3940, 29901, 13, 29937, 13, 29937, 29871, 29906, 5277, 282, 5475, 29889, 2848, 5277, 29871, 29945, 29900, 29900, 13, 29937, 282, 5475, 29889, 2848, 338, 1584, 29889, 13, 29937, 29871, 29896, 5277, 282, 5475, 29961, 29875, 29962, 5277, 29871, 29945, 29900, 29900, 13, 29937, 2533, 29898, 29886, 5475, 29897, 338, 7736, 29889, 13, 29937, 13, 5215, 443, 27958, 13, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 12565, 14199, 29898, 1311, 29892, 282, 5475, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 282, 5475, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 29878, 1853, 29901, 6120, 13, 4706, 9995, 13, 4706, 736, 5852, 13, 13, 1990, 24380, 11191, 29898, 3318, 1125, 13, 1678, 822, 12565, 14199, 29898, 1311, 29892, 282, 5475, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 282, 5475, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 29878, 1853, 29901, 6120, 13, 4706, 9995, 13, 4706, 302, 353, 7431, 29898, 29886, 5475, 29897, 13, 4706, 270, 29886, 353, 5519, 29900, 29962, 334, 302, 363, 903, 297, 3464, 29898, 29876, 4638, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 9651, 270, 29886, 29961, 29875, 3816, 29875, 29962, 353, 282, 5475, 29961, 29875, 29962, 13, 13, 4706, 363, 301, 297, 3464, 29898, 29906, 29892, 302, 718, 29871, 29896, 1125, 13, 9651, 363, 474, 297, 3464, 29898, 29876, 448, 301, 718, 29871, 29896, 1125, 13, 18884, 432, 353, 474, 718, 301, 448, 29871, 29896, 13, 18884, 270, 29886, 29961, 29875, 3816, 29926, 29962, 353, 4236, 29898, 29886, 5475, 29961, 29875, 29962, 448, 270, 29886, 29961, 29875, 718, 29871, 29896, 3816, 29926, 1402, 282, 5475, 29961, 29926, 29962, 448, 270, 29886, 29961, 29875, 3816, 29926, 448, 29871, 29896, 2314, 13, 4706, 736, 270, 29886, 29961, 29900, 3816, 29876, 448, 29871, 29896, 29962, 1405, 29871, 29900, 13, 13, 1990, 4321, 26112, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 7717, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29896, 29892, 29871, 29896, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 13, 8404, 353, 14550, 13, 29937, 498, 1774, 29901, 2045, 597, 280, 300, 401, 29889, 510, 29914, 17199, 29879, 29914, 12734, 29899, 11802, 29914, 2929, 918, 29914, 13, 13, 2052, 307, 496, 29871, 29896, 29901, 27747, 7835, 4056, 13, 8909, 29916, 537, 24352, 13, 2481, 26596, 537, 29901, 438, 29898, 29940, 29985, 29906, 511, 988, 405, 338, 278, 1353, 310, 282, 5475, 29889, 13, 14936, 26596, 537, 29901, 438, 29898, 29940, 29985, 29906, 511, 278, 2913, 1304, 15446, 278, 19697, 2582, 310, 1269, 1014, 11802, 29889, 13, 13, 29937, 29871, 29896, 29900, 1516, 29871, 29941, 29953, 29889, 29896, 29946, 29995, 13, 1990, 24380, 426, 13, 1678, 970, 7223, 12565, 14199, 29898, 524, 2636, 282, 5475, 29897, 426, 13, 308, 938, 405, 353, 282, 5475, 29889, 2848, 29936, 13, 13, 4706, 849, 270, 29886, 29961, 29875, 29974, 29896, 3816, 29926, 29974, 29896, 29962, 353, 278, 995, 310, 278, 3748, 518, 29886, 5475, 29961, 29875, 1402, 2023, 29892, 282, 5475, 29961, 29926, 29962, 1822, 13, 4706, 938, 2636, 2636, 270, 29886, 353, 716, 938, 29961, 29940, 29974, 29906, 3816, 29940, 29974, 29906, 1385, 13, 13, 4706, 363, 313, 524, 2159, 353, 29871, 29896, 29936, 2159, 5277, 405, 29936, 8445, 2159, 29897, 426, 13, 9651, 363, 313, 524, 474, 353, 29871, 29900, 29936, 474, 718, 2159, 5277, 405, 29936, 8445, 29875, 29897, 426, 13, 18884, 938, 432, 353, 474, 718, 2159, 448, 29871, 29896, 29936, 13, 18884, 938, 610, 537, 353, 313, 432, 718, 474, 718, 405, 29897, 1273, 29871, 29906, 29936, 849, 432, 448, 474, 448, 405, 29936, 541, 718, 29916, 353, 448, 29916, 313, 1545, 29871, 29906, 29897, 13, 18884, 565, 313, 862, 537, 1275, 29871, 29896, 29897, 426, 13, 462, 1678, 270, 29886, 29961, 29875, 718, 29871, 29896, 3816, 29926, 718, 29871, 29896, 29962, 353, 5792, 29889, 3317, 29898, 29886, 5475, 29961, 29875, 29962, 718, 270, 29886, 29961, 29875, 718, 29906, 3816, 29926, 718, 29871, 29896, 1402, 282, 5475, 29961, 29926, 29962, 718, 270, 29886, 29961, 29875, 718, 29871, 29896, 3816, 29926, 5691, 13, 18884, 500, 1683, 426, 13, 462, 1678, 270, 29886, 29961, 29875, 718, 29871, 29896, 3816, 29926, 718, 29871, 29896, 29962, 353, 5792, 29889, 1195, 6278, 29886, 5475, 29961, 29875, 29962, 718, 270, 29886, 29961, 29875, 718, 29906, 3816, 29926, 718, 29871, 29896, 1402, 448, 29886, 5475, 29961, 29926, 29962, 718, 270, 29886, 29961, 29875, 718, 29871, 29896, 3816, 29926, 5691, 13, 18884, 500, 13, 9651, 500, 13, 4706, 500, 13, 4706, 736, 270, 29886, 29961, 29896, 3816, 29940, 29962, 1405, 29871, 29900, 29936, 13, 1678, 500, 13, 29913, 13, 2052, 307, 496, 29871, 29906, 29901, 13486, 936, 13, 8909, 29916, 537, 24352, 13, 2481, 322, 14121, 26596, 537, 29901, 438, 29898, 29896, 29897, 13, 13, 13, 29937, 29871, 29941, 1516, 29871, 29945, 29941, 29889, 29953, 29929, 29995, 13, 1990, 24380, 426, 13, 1678, 970, 7223, 12565, 14199, 29898, 524, 2636, 282, 5475, 29897, 426, 13, 4706, 736, 1565, 29936, 13, 1678, 500, 13, 29913, 13, 13, 29937, 29871, 29906, 1516, 29871, 29929, 29929, 29889, 29953, 29946, 29995, 13, 1990, 24380, 426, 13, 1678, 970, 7223, 12565, 14199, 29898, 524, 2636, 282, 5475, 29897, 426, 13, 4706, 938, 2175, 353, 29871, 29900, 29936, 13, 4706, 938, 1492, 353, 282, 5475, 29889, 2848, 29899, 29896, 29936, 13, 4706, 938, 263, 2506, 353, 29871, 29900, 29936, 13, 4706, 938, 454, 29872, 353, 29871, 29900, 29936, 13, 4706, 7223, 263, 2506, 27407, 353, 1565, 29936, 13, 13, 4706, 1550, 313, 1563, 529, 1492, 29897, 426, 13, 9651, 565, 313, 744, 29916, 27407, 29897, 426, 13, 18884, 565, 313, 29886, 5475, 29961, 1563, 29962, 1405, 282, 5475, 29961, 1266, 2314, 426, 13, 462, 1678, 263, 2506, 4619, 282, 5475, 29961, 1563, 1385, 13, 462, 1678, 2175, 9107, 13, 18884, 500, 1683, 426, 13, 462, 1678, 263, 2506, 4619, 282, 5475, 29961, 1266, 1385, 13, 462, 1678, 1492, 489, 29936, 13, 18884, 500, 13, 9651, 500, 1683, 426, 13, 18884, 565, 313, 29886, 5475, 29961, 1563, 29962, 1405, 282, 5475, 29961, 1266, 2314, 426, 13, 462, 1678, 454, 29872, 4619, 282, 5475, 29961, 1563, 1385, 13, 462, 1678, 2175, 9107, 13, 18884, 500, 1683, 426, 13, 462, 1678, 454, 29872, 4619, 282, 5475, 29961, 1266, 1385, 13, 462, 1678, 1492, 489, 29936, 13, 18884, 500, 13, 9651, 500, 13, 4706, 500, 13, 4706, 736, 263, 2506, 1405, 454, 29872, 29936, 13, 1678, 500, 13, 29913, 13, 12008, 13, 2 ]
Python/_old/Euler048.py
sosheskaz/Project-Euler
0
169137
#!/usr/bin/env python3 def main(): s = 0 for j in range(1, 1001): s += j ** j print(str(s)[-10:]) if __name__ == '__main__': main()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 1753, 1667, 7295, 13, 1678, 269, 353, 29871, 29900, 13, 1678, 363, 432, 297, 3464, 29898, 29896, 29892, 29871, 29896, 29900, 29900, 29896, 1125, 13, 4706, 269, 4619, 432, 3579, 432, 13, 1678, 1596, 29898, 710, 29898, 29879, 9601, 29899, 29896, 29900, 29901, 2314, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
eutl_database/DataAccessLayer.py
jabrell/eutl_scraper
0
167247
<gh_stars>0 from getpass import getpass from sqlalchemy.exc import ProgrammingError from sqlalchemy.inspection import inspect from .model import Base from sqlalchemy import create_engine, MetaData from sqlalchemy.orm import sessionmaker from io import StringIO import csv class DataAccessLayer: """Class managing database access""" def __init__(self, user, host, db, passw, echo=False, encoding="utf-8", connect=True, base=None): """Constructor for data access class. Default access is to local database :param user: <string> user name :param host: <string> host address :param db: <string> database name :param echo: <string, boolean> whther to echo sql statements, "debug" for verbose output :param encoding: <string> database encoding :param connect: <boolean> True to establish immideiate connection to database default: True "param base: <qlalchemy.ext.declarative.declarative_base> """ self.engine = None self.user = user self.host = host self.db = db if base is None: # no custum declarative base, so use the one provided by eutl orm self.Base = Base else: self.Base = base self.conn_string = "postgresql+psycopg2://%s:%s@%s/%s" % (user, passw, host, db) self.encoding = encoding self.echo = echo if connect: self.connect() def connect(self): """ Connects to database """ if self.engine is None: self.engine = create_engine(self.conn_string, echo=self.echo, encoding=self.encoding) self.Base.metadata.create_all(self.engine) self.metadata = self.metadata = MetaData(bind=self.engine) self.metadata.reflect() self.Session = sessionmaker(bind=self.engine) self.session = self.Session() def empty_database(self, askConfirmation=True): """ Deletes all tables from database connectd by engine askConfirmation: <boolean> true to ask for typed confirmation""" self.metadata = MetaData(bind=self.engine) self.metadata.reflect() if len(self.engine.table_names()) > 0: if askConfirmation: confirm = getpass("Do really want to drop all tables? Enter Yes for confirmation: ") else: confirm = "yes" if confirm.lower() == "yes": for i, tbl in enumerate(reversed(self.metadata.sorted_tables)): if tbl.name in ["spatial_ref_sys"]: continue print(i, tbl) tbl.drop() print("Tables deleted") else: print("#### Tables still in database ####") self.metadata.reflect() self.Base.metadata.create_all(self.engine) def insert_df(self, df, obj, update=False, bulk_insert=False, verbose=False): """Inserts dataframe to database using session and ORM object. Dataframe has to have columns matching fields of the OMR objects :param df: <pd.DataFrame> with data :param obj: <ORM object> :param update: <boolean> True to update existing rows :param bulk_insert: <boolean> True for buli insert of intems :parma verbose: <boolean> to print all keys not inserted """ printed = False # get primary key names pk_names = [i.name for i in inspect(obj).primary_key] # replace Null values by None df_ = self._replace_null(df) to_add = [] for item in df_.to_dict(orient="records"): # get primary key pk = {k: v for k, v in item.items() if k in pk_names} exists = False try: qry = self.session.query(obj).filter_by(**pk) exists = qry.count() > 0 except ProgrammingError: pass if exists: # with same key already in database if update: qry.delete() else: if verbose: print("Did not insert", pk) else: if not printed: print("Some entries not inserted due to key duplication.") printed = True continue obj_to_insert = obj(**item) if bulk_insert: to_add.append(obj_to_insert) else: self.session.add(obj_to_insert) if bulk_insert: self.session.add_all(to_add) self.session.commit() def insert_df_large(self, df, name, integerColumns=None, schema=None, if_exists="fail", index=False, index_label=None, chunksize=1000000, dtype=None): """ Wrapper for pandas to_sql function using a more efficient insertion function. Likely only works under psycopg2 and postrgres :parm df: <pd.DataFrame> to be inserted :param name: <string> name if table :param integerColumns: <list: string> name of columns to be inserted as int :param schema: <string> pecify the schema (if database flavor supports this). If None, use default schema. :param chunksize: <int> number of rows to be inserted at once. In contrast to pandas implementeation here we use explicit slicing of the dataframe. :param if_exists: {"fail", "replace", "append"}, default "fail", How to behave if the table already exists. :param index: <boolean> whetehr to also insert index :param index_label: <string> Column label for index column(s) :param dtype: <dict> or <scalar> Specifying the datatype for columns. If a dictionary is used, the keys should be the column names and the values should be the SQLAlchemy types or strings for the sqlite3 legacy mode. If a scalar is provided, it will be applied to all columns. """ def psql_insert_copy(table, con, keys, data_iter): """ Execute SQL statement inserting data :param table : pandas.io.sql.SQLTable :parm con : sqlalchemy.engine.Engine or sqlalchemy.engine.Connection :param keys : list of str Column names :param data_iter : Iterable that iterates the values to be inserted""" # gets a DBAPI connection that can provide a cursor dbapi_con = con.connection with dbapi_con.cursor() as cur: s_buf = StringIO() writer = csv.writer(s_buf) writer.writerows(data_iter) s_buf.seek(0) columns = ', '.join('"{}"'.format(k) for k in keys) if table.schema: table_name = '{}.{}'.format(table.schema, table.name) else: table_name = table.name sql = 'COPY {} ({}) FROM STDIN WITH CSV'.format( table_name, columns) cur.copy_expert(sql=sql, file=s_buf) def df_to_list_of_chuncks(df, chunksize=100000): lst_df = [df[i: i + chunksize] for i in range(0, df.shape[0], chunksize)] return lst_df def prepare_int_cols_for_sql_insert(df, int_cols): """ For fast insertion into the database using the csv IO stream we need interegers to be properly formated. However, as long as we have Null values in the column, the column is of type float and integers are foramtted with .0 at the end. Thus we cast these integers to string with correct format. :param df: <pd.DataFrame> :param int_cols: <list:string> names of columns to be converted """ def int_to_string(x): try: return "%d" % x except (TypeError, ValueError): return x for c in int_cols: df[c] = df[c].map(int_to_string) return df # convert int columns if integerColumns is not None: df_ = prepare_int_cols_for_sql_insert(df, int_cols=integerColumns) else: df_ = df.copy() # create chunks of dataframe and slice over it lst_df = df_to_list_of_chuncks(df_, chunksize=chunksize) for i, df_out in enumerate(lst_df): if (i % 10 == 0) and (i > 0): print("#### Commit chunck %d of %d" % ((i + 1), len(lst_df))) # insert data df_out.to_sql(name=name, con=self.session.get_bind(), if_exists=if_exists, schema=schema, index=index, index_label=index_label, dtype=dtype, method=psql_insert_copy) @staticmethod def _replace_null(df): """replaces nan and nat in dataframe by None values for database insertion""" df_ = df.copy() dt_cols = df_.select_dtypes(include=['datetime64']).columns for c in dt_cols: # convert datetimes to objects to replace nat df_[c] = df_[c].astype("object") df_ = df_.where(df.notnull(), None) return df_ @staticmethod def prepare_int_cols_for_sql_insert(df, int_cols): """ For fast insertion into the database using the csv IO stream we need interegers to be properly formated. However, as long as we have Null values in the column, the column is of type float and integers are foramtted with .0 at the end. Thus we cast these integers to string with correct format. :param df: <pd.DataFrame> :param int_cols: <list:string> names of columns to be converted """ def int_to_string(x): try: return "%d" % x except (TypeError, ValueError): return x for c in int_cols: df[c] = df[c].map(int_to_string) return df
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 679, 3364, 1053, 679, 3364, 13, 3166, 4576, 284, 305, 6764, 29889, 735, 29883, 1053, 7835, 4056, 2392, 13, 3166, 4576, 284, 305, 6764, 29889, 1144, 27988, 1053, 16096, 13, 3166, 869, 4299, 1053, 7399, 13, 3166, 4576, 284, 305, 6764, 1053, 1653, 29918, 10599, 29892, 20553, 1469, 13, 3166, 4576, 284, 305, 6764, 29889, 555, 1053, 4867, 28107, 13, 3166, 12013, 1053, 1714, 5971, 13, 5215, 11799, 13, 13, 13, 1990, 3630, 6638, 14420, 29901, 13, 1678, 9995, 2385, 767, 6751, 2566, 2130, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1404, 29892, 3495, 29892, 4833, 29892, 1209, 29893, 29892, 13, 462, 2916, 29922, 8824, 29892, 8025, 543, 9420, 29899, 29947, 613, 4511, 29922, 5574, 29892, 13, 462, 2967, 29922, 8516, 1125, 13, 4706, 9995, 23770, 363, 848, 2130, 770, 29889, 13, 4706, 13109, 2130, 338, 304, 1887, 2566, 13, 4706, 584, 3207, 1404, 29901, 529, 1807, 29958, 1404, 1024, 13, 4706, 584, 3207, 3495, 29901, 529, 1807, 29958, 3495, 3211, 13, 4706, 584, 3207, 4833, 29901, 529, 1807, 29958, 2566, 1024, 13, 4706, 584, 3207, 2916, 29901, 529, 1807, 29892, 7223, 29958, 377, 721, 304, 2916, 4576, 9506, 29892, 376, 8382, 29908, 363, 26952, 1962, 13, 4706, 584, 3207, 8025, 29901, 529, 1807, 29958, 2566, 8025, 13, 4706, 584, 3207, 4511, 29901, 529, 20054, 29958, 5852, 304, 10127, 5198, 680, 29347, 3957, 304, 2566, 13, 462, 4706, 2322, 29901, 5852, 13, 4706, 376, 3207, 2967, 29901, 529, 1519, 284, 305, 6764, 29889, 1062, 29889, 311, 16544, 1230, 29889, 311, 16544, 1230, 29918, 3188, 29958, 13, 4706, 9995, 13, 4706, 1583, 29889, 10599, 353, 6213, 13, 4706, 1583, 29889, 1792, 353, 1404, 13, 4706, 1583, 29889, 3069, 353, 3495, 13, 4706, 1583, 29889, 2585, 353, 4833, 13, 4706, 565, 2967, 338, 6213, 29901, 396, 694, 25387, 398, 7669, 1230, 2967, 29892, 577, 671, 278, 697, 4944, 491, 321, 329, 29880, 470, 29885, 13, 9651, 1583, 29889, 5160, 353, 7399, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 5160, 353, 2967, 13, 13, 4706, 1583, 29889, 13082, 29918, 1807, 353, 376, 29272, 29974, 567, 29891, 9708, 29887, 29906, 597, 29995, 29879, 16664, 29879, 29992, 29995, 29879, 22584, 29879, 29908, 1273, 313, 1792, 29892, 1209, 29893, 29892, 3495, 29892, 4833, 29897, 13, 4706, 1583, 29889, 22331, 353, 8025, 13, 4706, 1583, 29889, 8057, 353, 2916, 13, 4706, 565, 4511, 29901, 13, 9651, 1583, 29889, 6915, 580, 632, 13, 308, 13, 13, 1678, 822, 4511, 29898, 1311, 1125, 13, 4706, 9995, 14971, 29879, 304, 2566, 9995, 13, 4706, 565, 1583, 29889, 10599, 338, 6213, 29901, 13, 9651, 1583, 29889, 10599, 353, 1653, 29918, 10599, 29898, 1311, 29889, 13082, 29918, 1807, 29892, 2916, 29922, 1311, 29889, 8057, 29892, 8025, 29922, 1311, 29889, 22331, 29897, 13, 9651, 1583, 29889, 5160, 29889, 19635, 29889, 3258, 29918, 497, 29898, 1311, 29889, 10599, 29897, 13, 9651, 1583, 29889, 19635, 353, 1583, 29889, 19635, 353, 20553, 1469, 29898, 5355, 29922, 1311, 29889, 10599, 29897, 13, 9651, 1583, 29889, 19635, 29889, 13191, 580, 13, 9651, 1583, 29889, 7317, 353, 4867, 28107, 29898, 5355, 29922, 1311, 29889, 10599, 29897, 13, 9651, 1583, 29889, 7924, 353, 1583, 29889, 7317, 580, 13, 13, 1678, 822, 4069, 29918, 9803, 29898, 1311, 29892, 2244, 16376, 3568, 362, 29922, 5574, 1125, 13, 4706, 9995, 897, 1026, 267, 599, 6131, 515, 2566, 4511, 29881, 491, 6012, 29871, 13, 4706, 2244, 16376, 3568, 362, 29901, 529, 20054, 29958, 1565, 304, 2244, 363, 13033, 9659, 362, 15945, 29908, 13, 4706, 1583, 29889, 19635, 353, 20553, 1469, 29898, 5355, 29922, 1311, 29889, 10599, 29897, 13, 4706, 1583, 29889, 19635, 29889, 13191, 580, 13, 4706, 565, 7431, 29898, 1311, 29889, 10599, 29889, 2371, 29918, 7039, 3101, 1405, 29871, 29900, 29901, 13, 9651, 565, 2244, 16376, 3568, 362, 29901, 13, 18884, 9659, 353, 679, 3364, 703, 6132, 2289, 864, 304, 5768, 599, 6131, 29973, 9041, 3869, 363, 9659, 362, 29901, 16521, 13, 9651, 1683, 29901, 13, 18884, 9659, 353, 376, 3582, 29908, 13, 9651, 565, 9659, 29889, 13609, 580, 1275, 376, 3582, 1115, 13, 18884, 363, 474, 29892, 19018, 297, 26985, 29898, 276, 874, 287, 29898, 1311, 29889, 19635, 29889, 24582, 29918, 24051, 22164, 13, 462, 1678, 565, 19018, 29889, 978, 297, 6796, 1028, 15238, 29918, 999, 29918, 9675, 3108, 29901, 13, 462, 4706, 6773, 13, 462, 1678, 1596, 29898, 29875, 29892, 19018, 29897, 13, 462, 1678, 19018, 29889, 8865, 580, 13, 18884, 1596, 703, 24924, 11132, 1159, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 4136, 323, 1849, 1603, 297, 2566, 3191, 1159, 13, 4706, 1583, 29889, 19635, 29889, 13191, 580, 13, 4706, 1583, 29889, 5160, 29889, 19635, 29889, 3258, 29918, 497, 29898, 1311, 29889, 10599, 29897, 13, 308, 13, 1678, 822, 4635, 29918, 2176, 29898, 1311, 29892, 4489, 29892, 5446, 29892, 2767, 29922, 8824, 29892, 13, 462, 418, 21610, 29918, 7851, 29922, 8824, 29892, 26952, 29922, 8824, 1125, 13, 4706, 9995, 797, 643, 1372, 12205, 304, 2566, 773, 4867, 322, 6323, 29924, 1203, 29889, 13, 4706, 3630, 2557, 756, 304, 505, 4341, 9686, 4235, 310, 278, 438, 21055, 3618, 13, 4706, 584, 3207, 4489, 29901, 529, 15926, 29889, 17271, 29958, 411, 848, 13, 4706, 584, 3207, 5446, 29901, 529, 12054, 1203, 29958, 13, 4706, 584, 3207, 2767, 29901, 529, 20054, 29958, 5852, 304, 2767, 5923, 4206, 13, 4706, 584, 3207, 21610, 29918, 7851, 29901, 529, 20054, 29958, 5852, 363, 8227, 29875, 4635, 310, 938, 1567, 13, 4706, 584, 862, 655, 26952, 29901, 529, 20054, 29958, 304, 1596, 599, 6611, 451, 15478, 13, 4706, 9995, 13, 4706, 13350, 353, 7700, 13, 4706, 396, 679, 7601, 1820, 2983, 13, 4706, 282, 29895, 29918, 7039, 353, 518, 29875, 29889, 978, 363, 474, 297, 16096, 29898, 5415, 467, 16072, 29918, 1989, 29962, 13, 13, 4706, 396, 5191, 19014, 1819, 491, 6213, 13, 4706, 4489, 29918, 353, 1583, 3032, 6506, 29918, 4304, 29898, 2176, 29897, 13, 4706, 304, 29918, 1202, 353, 5159, 13, 4706, 363, 2944, 297, 4489, 5396, 517, 29918, 8977, 29898, 12236, 543, 3757, 4339, 29908, 1125, 13, 9651, 396, 679, 7601, 1820, 13, 9651, 282, 29895, 353, 426, 29895, 29901, 325, 363, 413, 29892, 325, 297, 2944, 29889, 7076, 580, 565, 413, 297, 282, 29895, 29918, 7039, 29913, 13, 9651, 4864, 353, 7700, 13, 9651, 1018, 29901, 13, 18884, 3855, 719, 353, 1583, 29889, 7924, 29889, 1972, 29898, 5415, 467, 4572, 29918, 1609, 29898, 1068, 20571, 29897, 13, 18884, 4864, 353, 3855, 719, 29889, 2798, 580, 1405, 29871, 29900, 13, 9651, 5174, 7835, 4056, 2392, 29901, 13, 18884, 1209, 13, 9651, 565, 4864, 29901, 29871, 396, 411, 1021, 1820, 2307, 297, 2566, 13, 18884, 565, 2767, 29901, 13, 462, 1678, 3855, 719, 29889, 8143, 580, 13, 18884, 1683, 29901, 13, 462, 1678, 565, 26952, 29901, 13, 462, 4706, 1596, 703, 9260, 451, 4635, 613, 282, 29895, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 565, 451, 13350, 29901, 13, 462, 9651, 1596, 703, 9526, 9976, 451, 15478, 2861, 304, 1820, 5141, 1414, 23157, 13, 462, 9651, 13350, 353, 5852, 13, 462, 1678, 6773, 13, 9651, 5446, 29918, 517, 29918, 7851, 353, 5446, 29898, 1068, 667, 29897, 13, 9651, 565, 21610, 29918, 7851, 29901, 13, 18884, 304, 29918, 1202, 29889, 4397, 29898, 5415, 29918, 517, 29918, 7851, 29897, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 7924, 29889, 1202, 29898, 5415, 29918, 517, 29918, 7851, 29897, 13, 4706, 565, 21610, 29918, 7851, 29901, 13, 9651, 1583, 29889, 7924, 29889, 1202, 29918, 497, 29898, 517, 29918, 1202, 29897, 13, 4706, 1583, 29889, 7924, 29889, 15060, 580, 13, 13, 13, 1678, 822, 4635, 29918, 2176, 29918, 16961, 29898, 1311, 29892, 4489, 29892, 1024, 29892, 6043, 14289, 29922, 8516, 29892, 13, 462, 4706, 10938, 29922, 8516, 29892, 565, 29918, 9933, 543, 14057, 613, 29871, 13, 462, 4706, 2380, 29922, 8824, 29892, 2380, 29918, 1643, 29922, 8516, 29892, 29871, 13, 462, 4706, 521, 18801, 675, 29922, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29892, 26688, 29922, 8516, 1125, 13, 4706, 9995, 399, 6794, 363, 11701, 304, 29918, 2850, 740, 773, 263, 901, 8543, 4635, 291, 740, 29889, 13, 4706, 365, 638, 873, 871, 1736, 1090, 6529, 29891, 9708, 29887, 29906, 322, 1400, 29878, 7201, 13, 4706, 584, 862, 29885, 4489, 29901, 529, 15926, 29889, 17271, 29958, 304, 367, 15478, 13, 4706, 584, 3207, 1024, 29901, 529, 1807, 29958, 1024, 565, 1591, 13, 4706, 584, 3207, 6043, 14289, 29901, 529, 1761, 29901, 1347, 29958, 1024, 310, 4341, 304, 367, 15478, 408, 938, 13, 4706, 584, 3207, 10938, 29901, 529, 1807, 29958, 13209, 1598, 278, 10938, 313, 361, 2566, 21054, 272, 11286, 445, 467, 960, 6213, 29892, 671, 2322, 10938, 29889, 13, 4706, 584, 3207, 521, 18801, 675, 29901, 529, 524, 29958, 1353, 310, 4206, 304, 367, 15478, 472, 2748, 29889, 512, 12814, 304, 11701, 2334, 29872, 362, 13, 462, 1678, 1244, 591, 671, 6261, 269, 506, 292, 310, 278, 12205, 29889, 13, 4706, 584, 3207, 565, 29918, 9933, 29901, 8853, 14057, 613, 376, 6506, 613, 376, 4397, 10758, 2322, 376, 14057, 613, 1128, 304, 23389, 565, 278, 1591, 2307, 4864, 29889, 13, 4706, 584, 3207, 2380, 29901, 529, 20054, 29958, 377, 2650, 1092, 304, 884, 4635, 2380, 13, 4706, 584, 3207, 2380, 29918, 1643, 29901, 529, 1807, 29958, 12481, 3858, 363, 2380, 1897, 29898, 29879, 29897, 13, 4706, 584, 3207, 26688, 29901, 529, 8977, 29958, 470, 529, 19529, 279, 29958, 12048, 9215, 278, 1418, 23179, 363, 4341, 29889, 13, 462, 1678, 960, 263, 8600, 338, 1304, 29892, 278, 6611, 881, 367, 278, 1897, 2983, 322, 278, 1819, 881, 367, 278, 3758, 2499, 305, 6764, 4072, 470, 6031, 363, 278, 21120, 29941, 25000, 4464, 29889, 13, 462, 1678, 960, 263, 17336, 338, 4944, 29892, 372, 674, 367, 7436, 304, 599, 4341, 29889, 13, 4706, 9995, 13, 4706, 822, 282, 2850, 29918, 7851, 29918, 8552, 29898, 2371, 29892, 378, 29892, 6611, 29892, 848, 29918, 1524, 1125, 13, 9651, 9995, 11080, 1082, 3758, 3229, 23800, 848, 13, 9651, 584, 3207, 1591, 584, 11701, 29889, 601, 29889, 2850, 29889, 4176, 3562, 13, 9651, 584, 862, 29885, 378, 584, 4576, 284, 305, 6764, 29889, 10599, 29889, 12412, 470, 4576, 284, 305, 6764, 29889, 10599, 29889, 5350, 13, 9651, 584, 3207, 6611, 584, 1051, 310, 851, 12481, 2983, 13, 9651, 584, 3207, 848, 29918, 1524, 584, 20504, 519, 393, 4256, 1078, 278, 1819, 304, 367, 15478, 15945, 29908, 13, 9651, 396, 4947, 263, 360, 5688, 2227, 3957, 393, 508, 3867, 263, 10677, 13, 9651, 4833, 2754, 29918, 535, 353, 378, 29889, 9965, 13, 9651, 411, 4833, 2754, 29918, 535, 29889, 18127, 580, 408, 3151, 29901, 13, 18884, 269, 29918, 9721, 353, 1714, 5971, 580, 13, 18884, 9227, 353, 11799, 29889, 13236, 29898, 29879, 29918, 9721, 29897, 13, 18884, 9227, 29889, 13236, 1242, 29898, 1272, 29918, 1524, 29897, 13, 18884, 269, 29918, 9721, 29889, 344, 1416, 29898, 29900, 29897, 13, 13, 18884, 4341, 353, 13420, 15300, 7122, 877, 29908, 29912, 5038, 4286, 4830, 29898, 29895, 29897, 363, 413, 297, 6611, 29897, 13, 18884, 565, 1591, 29889, 11010, 29901, 13, 462, 1678, 1591, 29918, 978, 353, 22372, 1836, 8875, 4286, 4830, 29898, 2371, 29889, 11010, 29892, 1591, 29889, 978, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 1591, 29918, 978, 353, 1591, 29889, 978, 13, 13, 18884, 4576, 353, 525, 3217, 20055, 6571, 21313, 1800, 3895, 6850, 29928, 1177, 22659, 16874, 4286, 4830, 29898, 13, 462, 1678, 1591, 29918, 978, 29892, 4341, 29897, 13, 18884, 3151, 29889, 8552, 29918, 735, 10700, 29898, 2850, 29922, 2850, 29892, 934, 29922, 29879, 29918, 9721, 29897, 13, 13, 4706, 822, 4489, 29918, 517, 29918, 1761, 29918, 974, 29918, 305, 348, 4684, 29898, 2176, 29892, 521, 18801, 675, 29922, 29896, 29900, 29900, 29900, 29900, 29900, 1125, 13, 9651, 24471, 29918, 2176, 353, 518, 2176, 29961, 29875, 29901, 474, 718, 521, 18801, 675, 29962, 363, 474, 297, 3464, 29898, 29900, 29892, 4489, 29889, 12181, 29961, 29900, 1402, 521, 18801, 675, 4638, 13, 9651, 736, 24471, 29918, 2176, 13, 13, 4706, 822, 19012, 29918, 524, 29918, 22724, 29918, 1454, 29918, 2850, 29918, 7851, 29898, 2176, 29892, 938, 29918, 22724, 1125, 13, 9651, 9995, 1152, 5172, 4635, 291, 964, 278, 2566, 773, 278, 11799, 10663, 4840, 591, 817, 1006, 387, 414, 304, 367, 6284, 883, 630, 29889, 13, 9651, 2398, 29892, 408, 1472, 408, 591, 505, 19014, 1819, 297, 278, 1897, 29892, 278, 1897, 338, 310, 1134, 5785, 322, 11920, 526, 15305, 698, 287, 411, 13, 9651, 869, 29900, 472, 278, 1095, 29889, 6549, 591, 4320, 1438, 11920, 304, 1347, 411, 1959, 3402, 29889, 13, 9651, 584, 3207, 4489, 29901, 529, 15926, 29889, 17271, 29958, 13, 9651, 584, 3207, 938, 29918, 22724, 29901, 529, 1761, 29901, 1807, 29958, 2983, 310, 4341, 304, 367, 11543, 13, 9651, 9995, 13, 9651, 822, 938, 29918, 517, 29918, 1807, 29898, 29916, 1125, 13, 18884, 1018, 29901, 13, 462, 1678, 736, 11860, 29881, 29908, 1273, 921, 13, 18884, 5174, 313, 1542, 2392, 29892, 7865, 2392, 1125, 13, 462, 1678, 736, 921, 13, 9651, 363, 274, 297, 938, 29918, 22724, 29901, 13, 18884, 4489, 29961, 29883, 29962, 353, 4489, 29961, 29883, 1822, 1958, 29898, 524, 29918, 517, 29918, 1807, 29897, 13, 9651, 736, 4489, 3986, 13, 13, 4706, 396, 3588, 938, 4341, 13, 4706, 565, 6043, 14289, 338, 451, 6213, 29901, 13, 9651, 4489, 29918, 353, 19012, 29918, 524, 29918, 22724, 29918, 1454, 29918, 2850, 29918, 7851, 29898, 2176, 29892, 938, 29918, 22724, 29922, 16031, 14289, 29897, 13, 4706, 1683, 29901, 13, 9651, 4489, 29918, 353, 4489, 29889, 8552, 580, 13, 632, 13, 4706, 396, 1653, 521, 18801, 310, 12205, 322, 22780, 975, 372, 13, 4706, 24471, 29918, 2176, 353, 4489, 29918, 517, 29918, 1761, 29918, 974, 29918, 305, 348, 4684, 29898, 2176, 3383, 521, 18801, 675, 29922, 305, 18801, 675, 29897, 13, 4706, 363, 474, 29892, 4489, 29918, 449, 297, 26985, 29898, 20155, 29918, 2176, 1125, 13, 9651, 565, 313, 29875, 1273, 29871, 29896, 29900, 1275, 29871, 29900, 29897, 322, 313, 29875, 1405, 29871, 29900, 1125, 13, 18884, 1596, 703, 4136, 1876, 277, 521, 348, 384, 1273, 29881, 310, 1273, 29881, 29908, 1273, 5135, 29875, 718, 29871, 29896, 511, 7431, 29898, 20155, 29918, 2176, 4961, 13, 9651, 396, 4635, 848, 13, 9651, 4489, 29918, 449, 29889, 517, 29918, 2850, 29898, 978, 29922, 978, 29892, 378, 29922, 1311, 29889, 7924, 29889, 657, 29918, 5355, 3285, 29871, 13, 462, 3986, 565, 29918, 9933, 29922, 361, 29918, 9933, 29892, 10938, 29922, 11010, 29892, 13, 462, 3986, 2380, 29922, 2248, 29892, 2380, 29918, 1643, 29922, 2248, 29918, 1643, 29892, 13, 462, 3986, 26688, 29922, 29881, 1853, 29892, 13, 462, 3986, 1158, 29922, 567, 1519, 29918, 7851, 29918, 8552, 29897, 13, 308, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 6506, 29918, 4304, 29898, 2176, 1125, 13, 4706, 9995, 3445, 6048, 23432, 322, 14033, 297, 12205, 491, 6213, 1819, 363, 2566, 4635, 291, 15945, 29908, 13, 4706, 4489, 29918, 353, 4489, 29889, 8552, 580, 13, 4706, 11636, 29918, 22724, 353, 4489, 5396, 2622, 29918, 29881, 8768, 29898, 2856, 29922, 1839, 12673, 29953, 29946, 2033, 467, 13099, 13, 4706, 363, 274, 297, 11636, 29918, 22724, 29901, 259, 396, 3588, 1418, 300, 1355, 304, 3618, 304, 5191, 14033, 13, 9651, 4489, 29918, 29961, 29883, 29962, 353, 4489, 29918, 29961, 29883, 1822, 579, 668, 703, 3318, 1159, 13, 4706, 4489, 29918, 353, 4489, 5396, 3062, 29898, 2176, 29889, 1333, 4304, 3285, 6213, 29897, 13, 4706, 736, 4489, 29918, 13, 268, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 19012, 29918, 524, 29918, 22724, 29918, 1454, 29918, 2850, 29918, 7851, 29898, 2176, 29892, 938, 29918, 22724, 1125, 13, 4706, 9995, 1152, 5172, 4635, 291, 964, 278, 2566, 773, 278, 11799, 10663, 4840, 591, 817, 1006, 387, 414, 304, 367, 6284, 883, 630, 29889, 13, 4706, 2398, 29892, 408, 1472, 408, 591, 505, 19014, 1819, 297, 278, 1897, 29892, 278, 1897, 338, 310, 1134, 5785, 322, 11920, 526, 15305, 698, 287, 411, 13, 4706, 869, 29900, 472, 278, 1095, 29889, 6549, 591, 4320, 1438, 11920, 304, 1347, 411, 1959, 3402, 29889, 13, 4706, 584, 3207, 4489, 29901, 529, 15926, 29889, 17271, 29958, 13, 4706, 584, 3207, 938, 29918, 22724, 29901, 529, 1761, 29901, 1807, 29958, 2983, 310, 4341, 304, 367, 11543, 13, 4706, 9995, 13, 4706, 822, 938, 29918, 517, 29918, 1807, 29898, 29916, 1125, 13, 9651, 1018, 29901, 13, 18884, 736, 11860, 29881, 29908, 1273, 921, 13, 9651, 5174, 313, 1542, 2392, 29892, 7865, 2392, 1125, 13, 18884, 736, 921, 13, 4706, 363, 274, 297, 938, 29918, 22724, 29901, 13, 9651, 4489, 29961, 29883, 29962, 353, 4489, 29961, 29883, 1822, 1958, 29898, 524, 29918, 517, 29918, 1807, 29897, 13, 4706, 736, 4489, 268, 13, 2 ]
configs/m4c/m4c_textvqa.py
inspur-hsslab/iMIX
23
174565
_base_ = [ '../_base_/datasets/textvqa_dataset.py', '../_base_/models/m4c_config.py', '../_base_/schedules/schedule_textvqa.py', '../_base_/textvqa_default_runtime.py' ] # yapf:disable
[ 1, 903, 3188, 29918, 353, 518, 13, 1678, 525, 6995, 29918, 3188, 29918, 29914, 14538, 1691, 29914, 726, 29894, 25621, 29918, 24713, 29889, 2272, 742, 13, 1678, 525, 6995, 29918, 3188, 29918, 29914, 9794, 29914, 29885, 29946, 29883, 29918, 2917, 29889, 2272, 742, 13, 1678, 525, 6995, 29918, 3188, 29918, 29914, 816, 287, 2540, 29914, 816, 11272, 29918, 726, 29894, 25621, 29889, 2272, 742, 13, 1678, 525, 6995, 29918, 3188, 29918, 29914, 726, 29894, 25621, 29918, 4381, 29918, 15634, 29889, 2272, 29915, 13, 29962, 29871, 396, 343, 481, 29888, 29901, 20472, 13, 2 ]
leetcode/python/841_keys_and_rooms.py
VVKot/leetcode-solutions
4
198838
<filename>leetcode/python/841_keys_and_rooms.py class Solution: def canVisitAllRooms(self, rooms): stack = [0] visited = set(stack) while stack: curr = stack.pop() for room in rooms[curr]: if room not in visited: stack.append(room) visited.add(room) if len(visited) == len(rooms): return True return len(visited) == len(rooms)
[ 1, 529, 9507, 29958, 280, 300, 401, 29914, 4691, 29914, 29947, 29946, 29896, 29918, 8149, 29918, 392, 29918, 18901, 29889, 2272, 13, 1990, 24380, 29901, 13, 1678, 822, 508, 6116, 277, 3596, 9588, 4835, 29898, 1311, 29892, 19600, 1125, 13, 4706, 5096, 353, 518, 29900, 29962, 13, 4706, 16669, 353, 731, 29898, 1429, 29897, 13, 4706, 1550, 5096, 29901, 13, 9651, 16256, 353, 5096, 29889, 7323, 580, 13, 9651, 363, 5716, 297, 19600, 29961, 21962, 5387, 13, 18884, 565, 5716, 451, 297, 16669, 29901, 13, 462, 1678, 5096, 29889, 4397, 29898, 8345, 29897, 13, 462, 1678, 16669, 29889, 1202, 29898, 8345, 29897, 13, 462, 1678, 565, 7431, 29898, 1730, 1573, 29897, 1275, 7431, 29898, 18901, 1125, 736, 5852, 13, 4706, 736, 7431, 29898, 1730, 1573, 29897, 1275, 7431, 29898, 18901, 29897, 2 ]
ChatBot/chatbot_search/chatbot_tfserving/indexAnnoy.py
yongzhuo/nlp_xiaojiang
1,379
144409
<reponame>yongzhuo/nlp_xiaojiang<filename>ChatBot/chatbot_search/chatbot_tfserving/indexAnnoy.py # !/usr/bin/python # -*- coding: utf-8 -*- # @time : 2021/4/18 21:04 # @author : Mo # @function: annoy search from annoy import AnnoyIndex import numpy as np import os class AnnoySearch: def __init__(self, dim=768, n_cluster=100): # metric可选“angular”(余弦距离)、“euclidean”(欧几里得距离)、 “ manhattan”(曼哈顿距离)或“hamming”(海明距离) self.annoy_index = AnnoyIndex(dim, metric="angular") self.n_cluster = n_cluster self.dim = dim def k_neighbors(self, vectors, k=18): """ 搜索 """ annoy_tops = [] for v in vectors: idx, dist = self.annoy_index.get_nns_by_vector(v, k, search_k=32*k, include_distances=True) annoy_tops.append([dist, idx]) return annoy_tops def fit(self, vectors): """ annoy构建 """ for i, v in enumerate(vectors): self.annoy_index.add_item(i, v) self.annoy_index.build(self.n_cluster) def save(self, path): """ 存储 """ self.annoy_index.save(path) def load(self, path): """ 加载 """ self.annoy_index.load(path) if __name__ == '__main__': ### 索引 import random path = "model.ann" dim = 768 vectors = [[random.gauss(0, 1) for z in range(768)] for i in range(10)] an_model = AnnoySearch(dim, n_cluster=32) # Length of item vector that will be indexed an_model.fit(vectors) an_model.save(path) tops = an_model.k_neighbors([vectors[0]], 18) print(tops) del an_model ### 下载, 搜索 an_model = AnnoySearch(dim, n_cluster=32) an_model.load(path) tops = an_model.k_neighbors([vectors[0]], 6) print(tops) """ # example from annoy import AnnoyIndex import random dim = 768 vectors = [[random.gauss(0, 1) for z in range(768)] for i in range(10)] ann_model = AnnoyIndex(dim, 'angular') # Length of item vector that will be indexed for i,v in enumerate(vectors): ann_model.add_item(i, v) ann_model.build(10) # 10 trees ann_model.save("tet.ann") del ann_model u = AnnoyIndex(dim, "angular") u.load('tet.ann') # super fast, will just mmap the file v = vectors[1] idx, dist = u.get_nns_by_vector(v, 10, search_k=50 * 10, include_distances=True) print([idx, dist]) """ ### 备注说明: annoy索引 无法 增删会改查
[ 1, 529, 276, 1112, 420, 29958, 29891, 549, 29920, 6905, 29877, 29914, 12938, 29886, 29918, 29916, 29653, 2397, 574, 29966, 9507, 29958, 1451, 271, 29933, 327, 29914, 13496, 7451, 29918, 4478, 29914, 13496, 7451, 29918, 13264, 643, 1747, 29914, 2248, 2744, 1217, 29891, 29889, 2272, 13, 29937, 1738, 29914, 4855, 29914, 2109, 29914, 4691, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 732, 2230, 1678, 584, 29871, 29906, 29900, 29906, 29896, 29914, 29946, 29914, 29896, 29947, 29871, 29906, 29896, 29901, 29900, 29946, 13, 29937, 732, 8921, 29871, 584, 4546, 13, 29937, 732, 2220, 29901, 12327, 29891, 2740, 13, 13, 13, 3166, 12327, 29891, 1053, 530, 1217, 29891, 3220, 13, 5215, 12655, 408, 7442, 13, 5215, 2897, 13, 13, 13, 1990, 530, 1217, 29891, 7974, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3964, 29922, 29955, 29953, 29947, 29892, 302, 29918, 19594, 29922, 29896, 29900, 29900, 1125, 13, 4706, 396, 12714, 30682, 31333, 30015, 6825, 30024, 30419, 231, 192, 156, 232, 191, 169, 235, 186, 160, 234, 169, 190, 30409, 30330, 30015, 29872, 27511, 30024, 30419, 233, 175, 170, 232, 138, 163, 30755, 31050, 235, 186, 160, 234, 169, 190, 30409, 30330, 1346, 767, 29882, 23586, 30024, 30419, 233, 158, 191, 232, 150, 139, 236, 164, 194, 235, 186, 160, 234, 169, 190, 30409, 31391, 30015, 3391, 4056, 30024, 30419, 30581, 30592, 235, 186, 160, 234, 169, 190, 30409, 13, 4706, 1583, 29889, 7665, 29891, 29918, 2248, 353, 530, 1217, 29891, 3220, 29898, 6229, 29892, 12714, 543, 6825, 1159, 13, 4706, 1583, 29889, 29876, 29918, 19594, 353, 302, 29918, 19594, 13, 4706, 1583, 29889, 6229, 353, 3964, 13, 13, 1678, 822, 413, 29918, 484, 1141, 29890, 943, 29898, 1311, 29892, 12047, 29892, 413, 29922, 29896, 29947, 1125, 13, 4706, 9995, 29871, 233, 147, 159, 31836, 9995, 13, 4706, 12327, 29891, 29918, 3332, 29879, 353, 5159, 13, 4706, 363, 325, 297, 12047, 29901, 13, 9651, 22645, 29892, 1320, 353, 1583, 29889, 7665, 29891, 29918, 2248, 29889, 657, 29918, 29876, 1983, 29918, 1609, 29918, 8111, 29898, 29894, 29892, 413, 29892, 2740, 29918, 29895, 29922, 29941, 29906, 29930, 29895, 29892, 3160, 29918, 5721, 2925, 29922, 5574, 29897, 13, 9651, 12327, 29891, 29918, 3332, 29879, 29889, 4397, 4197, 5721, 29892, 22645, 2314, 13, 4706, 736, 12327, 29891, 29918, 3332, 29879, 13, 13, 1678, 822, 6216, 29898, 1311, 29892, 12047, 1125, 13, 4706, 9995, 12327, 29891, 31901, 30886, 9995, 13, 4706, 363, 474, 29892, 325, 297, 26985, 29898, 345, 14359, 1125, 13, 9651, 1583, 29889, 7665, 29891, 29918, 2248, 29889, 1202, 29918, 667, 29898, 29875, 29892, 325, 29897, 13, 4706, 1583, 29889, 7665, 29891, 29918, 2248, 29889, 4282, 29898, 1311, 29889, 29876, 29918, 19594, 29897, 13, 13, 1678, 822, 4078, 29898, 1311, 29892, 2224, 1125, 13, 4706, 9995, 29871, 30946, 232, 133, 171, 9995, 13, 4706, 1583, 29889, 7665, 29891, 29918, 2248, 29889, 7620, 29898, 2084, 29897, 13, 13, 1678, 822, 2254, 29898, 1311, 29892, 2224, 1125, 13, 4706, 9995, 29871, 30666, 31526, 9995, 13, 4706, 1583, 29889, 7665, 29891, 29918, 2248, 29889, 1359, 29898, 2084, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 835, 29871, 31836, 31674, 13, 1678, 1053, 4036, 13, 1678, 2224, 353, 376, 4299, 29889, 812, 29908, 13, 1678, 3964, 353, 29871, 29955, 29953, 29947, 13, 1678, 12047, 353, 5519, 8172, 29889, 29887, 11214, 29898, 29900, 29892, 29871, 29896, 29897, 363, 503, 297, 3464, 29898, 29955, 29953, 29947, 4638, 363, 474, 297, 3464, 29898, 29896, 29900, 4638, 13, 1678, 385, 29918, 4299, 353, 530, 1217, 29891, 7974, 29898, 6229, 29892, 302, 29918, 19594, 29922, 29941, 29906, 29897, 29871, 396, 365, 1477, 310, 2944, 4608, 393, 674, 367, 27541, 13, 1678, 385, 29918, 4299, 29889, 9202, 29898, 345, 14359, 29897, 13, 1678, 385, 29918, 4299, 29889, 7620, 29898, 2084, 29897, 13, 1678, 304, 567, 353, 385, 29918, 4299, 29889, 29895, 29918, 484, 1141, 29890, 943, 4197, 345, 14359, 29961, 29900, 20526, 29871, 29896, 29947, 29897, 13, 1678, 1596, 29898, 3332, 29879, 29897, 13, 13, 1678, 628, 385, 29918, 4299, 13, 13, 1678, 835, 29871, 30557, 31526, 29892, 29871, 233, 147, 159, 31836, 13, 1678, 385, 29918, 4299, 353, 530, 1217, 29891, 7974, 29898, 6229, 29892, 302, 29918, 19594, 29922, 29941, 29906, 29897, 13, 1678, 385, 29918, 4299, 29889, 1359, 29898, 2084, 29897, 13, 1678, 304, 567, 353, 385, 29918, 4299, 29889, 29895, 29918, 484, 1141, 29890, 943, 4197, 345, 14359, 29961, 29900, 20526, 29871, 29953, 29897, 13, 1678, 1596, 29898, 3332, 29879, 29897, 13, 13, 13, 13, 1678, 9995, 29871, 13, 1678, 396, 1342, 13, 1678, 515, 12327, 29891, 1053, 530, 1217, 29891, 3220, 13, 1678, 1053, 4036, 13, 13, 1678, 3964, 353, 29871, 29955, 29953, 29947, 13, 1678, 12047, 353, 5519, 8172, 29889, 29887, 11214, 29898, 29900, 29892, 29871, 29896, 29897, 363, 503, 297, 3464, 29898, 29955, 29953, 29947, 4638, 363, 474, 297, 3464, 29898, 29896, 29900, 4638, 13, 1678, 2889, 29918, 4299, 353, 530, 1217, 29891, 3220, 29898, 6229, 29892, 525, 6825, 1495, 29871, 396, 365, 1477, 310, 2944, 4608, 393, 674, 367, 27541, 13, 1678, 363, 474, 29892, 29894, 297, 26985, 29898, 345, 14359, 1125, 13, 4706, 2889, 29918, 4299, 29889, 1202, 29918, 667, 29898, 29875, 29892, 325, 29897, 13, 1678, 2889, 29918, 4299, 29889, 4282, 29898, 29896, 29900, 29897, 29871, 396, 29871, 29896, 29900, 10697, 13, 1678, 2889, 29918, 4299, 29889, 7620, 703, 29873, 300, 29889, 812, 1159, 13, 1678, 628, 2889, 29918, 4299, 13, 13, 1678, 318, 353, 530, 1217, 29891, 3220, 29898, 6229, 29892, 376, 6825, 1159, 13, 1678, 318, 29889, 1359, 877, 29873, 300, 29889, 812, 1495, 29871, 396, 2428, 5172, 29892, 674, 925, 286, 1958, 278, 934, 13, 1678, 325, 353, 12047, 29961, 29896, 29962, 13, 1678, 22645, 29892, 1320, 353, 318, 29889, 657, 29918, 29876, 1983, 29918, 1609, 29918, 8111, 29898, 29894, 29892, 29871, 29896, 29900, 29892, 2740, 29918, 29895, 29922, 29945, 29900, 334, 29871, 29896, 29900, 29892, 3160, 29918, 5721, 2925, 29922, 5574, 29897, 13, 1678, 1596, 4197, 13140, 29892, 1320, 2314, 13, 1678, 9995, 13, 13, 13, 13, 2277, 29937, 259, 232, 167, 138, 31368, 31639, 30592, 29901, 12327, 29891, 31836, 31674, 29871, 31352, 30545, 29871, 232, 165, 161, 31916, 30437, 31264, 31213, 13, 13, 13, 13, 2 ]
utils/regression/classes/module_run.py
noahsherrill/force-riscv
111
1613424
<gh_stars>100-1000 # # Copyright (C) [2020] Futurewei Technologies, Inc. # # FORCE-RISCV is 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 # # THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES # OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO # NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. # See the License for the specific language governing permissions and # limitations under the License. # # @package module_run.py # module_run.py # # Provides command line argument parsing and access as base class of # master_run.py and forrest_run.py # import sys import os from abc import ABC, abstractmethod from common.path_utils import PathUtils from common.msg_utils import Msg # # Parses and accesses parsed command line options. Also can be used to set # message level... and directly query for the force directory. class ModuleRun(ABC): def __init__(self, arg_msg_lev, arg_def_lev): self.m_app_setup = None self.m_app_info = None self.module_dir, self.module_name = PathUtils.split_path( PathUtils.real_path(sys.argv[0]) ) self.init_app_setup() self.load_message_levels(arg_msg_lev, arg_def_lev) @abstractmethod def init_app_setup(self): pass ## # resolves the desired message types def load_message_levels(self, arg_msg_lev, arg_def_lev): # load from the command line if specified or use the default my_lev_str = self.option_def(arg_msg_lev, arg_def_lev) # if a (+) or a (-) is found then the command line will be appended # to or demoted by if (my_lev_str[0] == "+") or (my_lev_str[0] == "-"): # use the default string to build a format string, then append # the passed in value my_fmt_str = "%s%%s" % arg_def_lev my_lev_str = my_fmt_str % (my_lev_str) my_level = Msg.translate_levelstr(my_lev_str) Msg.set_level(my_level) # return the force path def get_force_dir(self): return self.force_path # Reflects the supplied default value in arg_def_val if none matching the # arg_switch can be found in the parsed options. def option_def(self, aSwitch, aDefVal=None, aConversionFunc=None): return_value = self.m_app_info.mCmdLineOpts.option_def( aSwitch, aDefVal ) if aConversionFunc and return_value is not None: try: return_value = aConversionFunc(return_value) except (TypeError, ValueError) as ex: Msg.warn( 'Invalid value "{}" provided for "{}". ' "Using default.".format(repr(return_value), aSwitch) ) return aDefVal return return_value def get_arguments(self): return self.m_app_info.mCmdLineOpts.get_arguments() def get_unknown_arguments(self): return self.m_app_info.mCmdLineOpts.get_unknown_arguments() def print_help(self): self.m_app_info.mCmdLineOpts.print_help()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 29937, 13, 29937, 14187, 1266, 313, 29907, 29897, 518, 29906, 29900, 29906, 29900, 29962, 16367, 26599, 8364, 11763, 29892, 9266, 29889, 13, 29937, 13, 29937, 15842, 4741, 29899, 29934, 3235, 15633, 338, 7794, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 13, 29937, 29871, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 13, 29937, 29871, 411, 278, 19245, 29889, 29871, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 29871, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6732, 13764, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 13, 29937, 8079, 13764, 29979, 476, 22255, 29892, 382, 1806, 4448, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 13, 29937, 405, 1164, 29899, 1177, 15860, 1177, 1692, 13780, 29892, 341, 1001, 3210, 13566, 2882, 6227, 11937, 6323, 383, 1806, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 29937, 29871, 732, 5113, 3883, 29918, 3389, 29889, 2272, 13, 29937, 259, 3883, 29918, 3389, 29889, 2272, 13, 29937, 13, 29937, 259, 9133, 2247, 1899, 1196, 2980, 13755, 322, 2130, 408, 2967, 770, 310, 13, 29937, 259, 5835, 29918, 3389, 29889, 2272, 322, 363, 5060, 29918, 3389, 29889, 2272, 13, 29937, 13, 5215, 10876, 13, 5215, 2897, 13, 3166, 25638, 1053, 16417, 29892, 9846, 5696, 13, 3166, 3619, 29889, 2084, 29918, 13239, 1053, 10802, 12177, 13, 3166, 3619, 29889, 7645, 29918, 13239, 1053, 28264, 13, 13, 29937, 13, 29937, 1459, 29879, 267, 322, 2130, 267, 21213, 1899, 1196, 3987, 29889, 3115, 508, 367, 1304, 304, 731, 13, 29937, 2643, 3233, 856, 322, 4153, 2346, 363, 278, 4889, 3884, 29889, 13, 13, 13, 1990, 15591, 6558, 29898, 19658, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1852, 29918, 7645, 29918, 2608, 29892, 1852, 29918, 1753, 29918, 2608, 1125, 13, 4706, 1583, 29889, 29885, 29918, 932, 29918, 14669, 353, 6213, 13, 4706, 1583, 29889, 29885, 29918, 932, 29918, 3888, 353, 6213, 13, 4706, 1583, 29889, 5453, 29918, 3972, 29892, 1583, 29889, 5453, 29918, 978, 353, 10802, 12177, 29889, 5451, 29918, 2084, 29898, 13, 9651, 10802, 12177, 29889, 6370, 29918, 2084, 29898, 9675, 29889, 19218, 29961, 29900, 2314, 13, 4706, 1723, 13, 4706, 1583, 29889, 2344, 29918, 932, 29918, 14669, 580, 13, 4706, 1583, 29889, 1359, 29918, 4906, 29918, 5563, 29879, 29898, 1191, 29918, 7645, 29918, 2608, 29892, 1852, 29918, 1753, 29918, 2608, 29897, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 2069, 29918, 932, 29918, 14669, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 444, 13, 1678, 396, 3770, 1960, 278, 7429, 2643, 4072, 13, 1678, 822, 2254, 29918, 4906, 29918, 5563, 29879, 29898, 1311, 29892, 1852, 29918, 7645, 29918, 2608, 29892, 1852, 29918, 1753, 29918, 2608, 1125, 13, 13, 4706, 396, 2254, 515, 278, 1899, 1196, 565, 6790, 470, 671, 278, 2322, 13, 4706, 590, 29918, 2608, 29918, 710, 353, 1583, 29889, 3385, 29918, 1753, 29898, 1191, 29918, 7645, 29918, 2608, 29892, 1852, 29918, 1753, 29918, 2608, 29897, 13, 13, 4706, 396, 565, 263, 20532, 29897, 470, 263, 8521, 29897, 338, 1476, 769, 278, 1899, 1196, 674, 367, 623, 2760, 13, 4706, 396, 304, 470, 1261, 5715, 491, 13, 4706, 565, 313, 1357, 29918, 2608, 29918, 710, 29961, 29900, 29962, 1275, 15691, 1159, 470, 313, 1357, 29918, 2608, 29918, 710, 29961, 29900, 29962, 1275, 11663, 29908, 1125, 13, 9651, 396, 671, 278, 2322, 1347, 304, 2048, 263, 3402, 1347, 29892, 769, 9773, 13, 9651, 396, 278, 4502, 297, 995, 13, 9651, 590, 29918, 23479, 29918, 710, 353, 11860, 29879, 7686, 29879, 29908, 1273, 1852, 29918, 1753, 29918, 2608, 13, 9651, 590, 29918, 2608, 29918, 710, 353, 590, 29918, 23479, 29918, 710, 1273, 313, 1357, 29918, 2608, 29918, 710, 29897, 13, 13, 4706, 590, 29918, 5563, 353, 28264, 29889, 21652, 29918, 5563, 710, 29898, 1357, 29918, 2608, 29918, 710, 29897, 13, 13, 4706, 28264, 29889, 842, 29918, 5563, 29898, 1357, 29918, 5563, 29897, 13, 13, 1678, 396, 736, 278, 4889, 2224, 13, 1678, 822, 679, 29918, 10118, 29918, 3972, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 10118, 29918, 2084, 13, 13, 1678, 396, 9897, 781, 29879, 278, 19056, 2322, 995, 297, 1852, 29918, 1753, 29918, 791, 565, 5642, 9686, 278, 13, 1678, 396, 1852, 29918, 15123, 508, 367, 1476, 297, 278, 21213, 3987, 29889, 13, 1678, 822, 2984, 29918, 1753, 29898, 1311, 29892, 263, 24995, 29892, 263, 3206, 1440, 29922, 8516, 29892, 263, 1168, 3259, 14400, 29922, 8516, 1125, 13, 4706, 736, 29918, 1767, 353, 1583, 29889, 29885, 29918, 932, 29918, 3888, 29889, 29885, 23651, 3542, 29949, 16485, 29889, 3385, 29918, 1753, 29898, 13, 9651, 263, 24995, 29892, 263, 3206, 1440, 13, 4706, 1723, 13, 4706, 565, 263, 1168, 3259, 14400, 322, 736, 29918, 1767, 338, 451, 6213, 29901, 13, 9651, 1018, 29901, 13, 18884, 736, 29918, 1767, 353, 263, 1168, 3259, 14400, 29898, 2457, 29918, 1767, 29897, 13, 9651, 5174, 313, 1542, 2392, 29892, 7865, 2392, 29897, 408, 429, 29901, 13, 18884, 28264, 29889, 25442, 29898, 13, 462, 1678, 525, 13919, 995, 29850, 5038, 4944, 363, 376, 8875, 1642, 29871, 525, 13, 462, 1678, 376, 15156, 2322, 1213, 29889, 4830, 29898, 276, 558, 29898, 2457, 29918, 1767, 511, 263, 24995, 29897, 13, 18884, 1723, 13, 18884, 736, 263, 3206, 1440, 13, 13, 4706, 736, 736, 29918, 1767, 13, 13, 1678, 822, 679, 29918, 25699, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 29885, 29918, 932, 29918, 3888, 29889, 29885, 23651, 3542, 29949, 16485, 29889, 657, 29918, 25699, 580, 13, 13, 1678, 822, 679, 29918, 26690, 29918, 25699, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 29885, 29918, 932, 29918, 3888, 29889, 29885, 23651, 3542, 29949, 16485, 29889, 657, 29918, 26690, 29918, 25699, 580, 13, 13, 1678, 822, 1596, 29918, 8477, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29885, 29918, 932, 29918, 3888, 29889, 29885, 23651, 3542, 29949, 16485, 29889, 2158, 29918, 8477, 580, 13, 2 ]
endpoints/bookstore-grpc/bookstore.py
bxue16/bx_byte1
4
177638
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import threading class ShelfInfo(object): """The contents of a single shelf.""" def __init__(self, shelf): self._shelf = shelf self._last_book_id = 0 self._books = dict() class Bookstore(object): """An in-memory backend for storing Bookstore data.""" def __init__(self): self._last_shelf_id = 0 self._shelves = dict() self._lock = threading.Lock() def list_shelf(self): with self._lock: return [s._shelf for (_, s) in self._shelves.iteritems()] def create_shelf(self, shelf): with self._lock: self._last_shelf_id += 1 shelf_id = self._last_shelf_id shelf.id = shelf_id self._shelves[shelf_id] = ShelfInfo(shelf) return (shelf, shelf_id) def get_shelf(self, shelf_id): with self._lock: return self._shelves[shelf_id]._shelf def delete_shelf(self, shelf_id): with self._lock: del self._shelves[shelf_id] def list_books(self, shelf_id): with self._lock: return [book for ( _, book) in self._shelves[shelf_id]._books.iteritems()] def create_book(self, shelf_id, book): with self._lock: shelf_info = self._shelves[shelf_id] shelf_info._last_book_id += 1 book_id = shelf_info._last_book_id book.id = book_id shelf_info._books[book_id] = book return book def get_book(self, shelf_id, book_id): with self._lock: return self._shelves[shelf_id]._books[book_id] def delete_book(self, shelf_id, book_id): with self._lock: del self._shelves[shelf_id]._books[book_id]
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29896, 29953, 5087, 9266, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 5215, 3244, 292, 13, 13, 13, 1990, 1383, 761, 3401, 29898, 3318, 1125, 13, 1678, 9995, 1576, 8118, 310, 263, 2323, 528, 761, 1213, 15945, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 528, 761, 1125, 13, 4706, 1583, 3032, 845, 761, 353, 528, 761, 13, 4706, 1583, 3032, 4230, 29918, 2909, 29918, 333, 353, 29871, 29900, 13, 4706, 1583, 3032, 12733, 353, 9657, 580, 13, 13, 13, 1990, 6726, 8899, 29898, 3318, 1125, 13, 1678, 9995, 2744, 297, 29899, 14834, 14998, 363, 15446, 6726, 8899, 848, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 3032, 4230, 29918, 845, 761, 29918, 333, 353, 29871, 29900, 13, 4706, 1583, 3032, 845, 295, 1960, 353, 9657, 580, 13, 4706, 1583, 3032, 908, 353, 3244, 292, 29889, 16542, 580, 13, 13, 1678, 822, 1051, 29918, 845, 761, 29898, 1311, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 736, 518, 29879, 3032, 845, 761, 363, 313, 3383, 269, 29897, 297, 1583, 3032, 845, 295, 1960, 29889, 1524, 7076, 580, 29962, 13, 13, 1678, 822, 1653, 29918, 845, 761, 29898, 1311, 29892, 528, 761, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 1583, 3032, 4230, 29918, 845, 761, 29918, 333, 4619, 29871, 29896, 13, 9651, 528, 761, 29918, 333, 353, 1583, 3032, 4230, 29918, 845, 761, 29918, 333, 13, 4706, 528, 761, 29889, 333, 353, 528, 761, 29918, 333, 13, 4706, 1583, 3032, 845, 295, 1960, 29961, 845, 761, 29918, 333, 29962, 353, 1383, 761, 3401, 29898, 845, 761, 29897, 13, 4706, 736, 313, 845, 761, 29892, 528, 761, 29918, 333, 29897, 13, 13, 1678, 822, 679, 29918, 845, 761, 29898, 1311, 29892, 528, 761, 29918, 333, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 736, 1583, 3032, 845, 295, 1960, 29961, 845, 761, 29918, 333, 1822, 29918, 845, 761, 13, 13, 1678, 822, 5217, 29918, 845, 761, 29898, 1311, 29892, 528, 761, 29918, 333, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 628, 1583, 3032, 845, 295, 1960, 29961, 845, 761, 29918, 333, 29962, 13, 13, 1678, 822, 1051, 29918, 12733, 29898, 1311, 29892, 528, 761, 29918, 333, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 736, 518, 2909, 363, 313, 13, 18884, 17117, 3143, 29897, 297, 1583, 3032, 845, 295, 1960, 29961, 845, 761, 29918, 333, 1822, 29918, 12733, 29889, 1524, 7076, 580, 29962, 13, 13, 1678, 822, 1653, 29918, 2909, 29898, 1311, 29892, 528, 761, 29918, 333, 29892, 3143, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 528, 761, 29918, 3888, 353, 1583, 3032, 845, 295, 1960, 29961, 845, 761, 29918, 333, 29962, 13, 9651, 528, 761, 29918, 3888, 3032, 4230, 29918, 2909, 29918, 333, 4619, 29871, 29896, 13, 9651, 3143, 29918, 333, 353, 528, 761, 29918, 3888, 3032, 4230, 29918, 2909, 29918, 333, 13, 9651, 3143, 29889, 333, 353, 3143, 29918, 333, 13, 9651, 528, 761, 29918, 3888, 3032, 12733, 29961, 2909, 29918, 333, 29962, 353, 3143, 13, 9651, 736, 3143, 13, 13, 1678, 822, 679, 29918, 2909, 29898, 1311, 29892, 528, 761, 29918, 333, 29892, 3143, 29918, 333, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 736, 1583, 3032, 845, 295, 1960, 29961, 845, 761, 29918, 333, 1822, 29918, 12733, 29961, 2909, 29918, 333, 29962, 13, 13, 1678, 822, 5217, 29918, 2909, 29898, 1311, 29892, 528, 761, 29918, 333, 29892, 3143, 29918, 333, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 628, 1583, 3032, 845, 295, 1960, 29961, 845, 761, 29918, 333, 1822, 29918, 12733, 29961, 2909, 29918, 333, 29962, 13, 2 ]
linekey.py
alex-west-met-office/IMBS_MO
1
19926
''' A module for defining and producing the linekey object, which is used to determine and store information about data format in a CRREL ice mass balance buoy.''' class linekey: def __init__(self,date_index = 0): self.date_index = date_index self.value_index = [] self.phenomena_names = [] self.lon_flip_ew = (False,-1,-1) self.lat_flip_ns = (False,-1,-1) self.vertical_scale = 1. self.fliplon = False def add_value_index(self,phenomenon,index): self.value_index.append(index) self.phenomena_names.append(phenomenon) def ns(self,index_flippee,index_flipper): self.lat_flip_ns = (True,index_flippee,index_flipper) def ew(self,index_flippee,index_flipper): self.lon_flip_ew = (True,index_flippee,index_flipper) def get_temp_linekey(data_file): import csv fileh = open(data_file) rows = csv.reader(fileh) found_key = False found_date = False for row in rows: print(row) for (i,strtest) in enumerate(row): if ('Date' in strtest) or ('DATE' in strtest): key = linekey(date_index = i) found_date = True break if found_date: temp_codes = {} temp_type = '' for (i,strtest) in enumerate(row): result = classify_temp_header(strtest) if result[0]==1: if temp_type == 'subjective': print('Unable to determine temperature type') return None temp_type = 'objective' prefix = 'TO' if result[0]==2: if temp_type == 'objective': print('Unable to determine temperature type') return None temp_type = 'subjective' prefix = 'TS' temp_codes[i] = classify_temp_header(strtest) if result[0]!=0: key.add_value_index(prefix+str(result[1]),i) break return key def get_linekey(data_file,variable_list,buoy_name): import dictionaries import csv fileh = open(data_file) rows = csv.reader(fileh) found_key = False found_date = False td = dictionaries.title_dic() variable_keys_list = [td[variable_name] for variable_name in variable_list] vertical_scale = 1. fliplon = False for row in rows: if not found_key: for (i,strtest) in enumerate(row): if ('Date' in strtest) or ('DATE' in strtest): key = linekey(date_index = i) found_date = True break if found_date: for (varno,variable_keys) in enumerate(variable_keys_list): found_key = False for string in variable_keys: for (i,strtest) in enumerate(row): if (string == strtest.strip()): key.add_value_index(variable_list[varno],i) found_key = True i_key = i if '(cm)' in string: vertical_scale = 0.01 if '(m)' in string: vertical_scale = 1. if string=='Longitude (W)': fliplon = True if not found_key: key.add_value_index(variable_list[varno],-1) if variable_list[varno]=='latitude': for (i,strtest) in enumerate(row): if (strtest == 'N/S'): key.ns(i_key,i) if variable_list[varno]=='longitude': for (i,strtest) in enumerate(row): if (strtest == 'E/W'): key.ew(i_key,i) if True in [('units are cm') in item for item in row]: vertical_scale = 0.01 if 'E/W' in row and 'longitude' in key.phenomena_names: i_flipper = row.index('E/W') i_flippee = key.value_index[key.phenomena_names.index('longitude')] key.ew(i_flippee,i_flipper) if 'N/S' in row and 'latitude' in key.phenomena_names: i_flipper = row.index('N/S') i_flippee = key.value_index[key.phenomena_names.index('latitude')] key.ew(i_flippee,i_flipper) if not found_date: print('Could not find date') fileh.close() return None key.vertical_scale = vertical_scale key.fliplon = fliplon fileh.close() return key def classify_temp_header(string): import functions if functions.is_number(string): number = float(string) return (1,number) elif string[0:1]=='T' and string[-3:]=='(C)' and functions.is_number(string[1:-3]): number = int(string[1:-3]) return (2,number) elif string[0:1]=='T' and functions.is_number(string[1:]): number = int(string[1:]) return (2,number) elif len(string) >= 4: if string[0:4]=='TEMP' and functions.is_number(string[4:]): number = int(string[4:]) return (2,number) elif string[0:5]=='Temp ' and functions.is_number(string[5:]): number = int(string[5:]) return (2,number) else: return (0,0) else: return (0,0)
[ 1, 14550, 319, 3883, 363, 16184, 322, 20811, 278, 1196, 1989, 1203, 29892, 607, 338, 1304, 29871, 13, 517, 8161, 322, 3787, 2472, 1048, 848, 3402, 297, 263, 15600, 1525, 29931, 29871, 13, 625, 4158, 17346, 1321, 12602, 29889, 12008, 13, 13, 1990, 1196, 1989, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1256, 29918, 2248, 353, 29871, 29900, 1125, 13, 4706, 1583, 29889, 1256, 29918, 2248, 353, 2635, 29918, 2248, 13, 4706, 1583, 29889, 1767, 29918, 2248, 353, 5159, 13, 4706, 1583, 29889, 9789, 28342, 29918, 7039, 353, 5159, 13, 4706, 1583, 29889, 12957, 29918, 29888, 3466, 29918, 809, 353, 313, 8824, 6653, 29896, 6653, 29896, 29897, 13, 4706, 1583, 29889, 5066, 29918, 29888, 3466, 29918, 1983, 353, 313, 8824, 6653, 29896, 6653, 29896, 29897, 13, 4706, 1583, 29889, 18575, 29918, 7052, 353, 29871, 29896, 29889, 13, 4706, 1583, 29889, 20157, 572, 265, 353, 7700, 13, 13, 1678, 822, 788, 29918, 1767, 29918, 2248, 29898, 1311, 29892, 9789, 2770, 265, 29892, 2248, 1125, 13, 4706, 1583, 29889, 1767, 29918, 2248, 29889, 4397, 29898, 2248, 29897, 13, 4706, 1583, 29889, 9789, 28342, 29918, 7039, 29889, 4397, 29898, 9789, 2770, 265, 29897, 13, 13, 1678, 822, 17534, 29898, 1311, 29892, 2248, 29918, 20157, 407, 3905, 29892, 2248, 29918, 20157, 2496, 1125, 13, 4706, 1583, 29889, 5066, 29918, 29888, 3466, 29918, 1983, 353, 313, 5574, 29892, 2248, 29918, 20157, 407, 3905, 29892, 2248, 29918, 20157, 2496, 29897, 13, 13, 1678, 822, 321, 29893, 29898, 1311, 29892, 2248, 29918, 20157, 407, 3905, 29892, 2248, 29918, 20157, 2496, 1125, 13, 4706, 1583, 29889, 12957, 29918, 29888, 3466, 29918, 809, 353, 313, 5574, 29892, 2248, 29918, 20157, 407, 3905, 29892, 2248, 29918, 20157, 2496, 29897, 13, 308, 13, 308, 13, 1753, 679, 29918, 7382, 29918, 1220, 1989, 29898, 1272, 29918, 1445, 1125, 13, 1678, 1053, 11799, 13, 1678, 934, 29882, 353, 1722, 29898, 1272, 29918, 1445, 29897, 13, 268, 13, 1678, 4206, 353, 11799, 29889, 16950, 29898, 1445, 29882, 29897, 13, 1678, 1476, 29918, 1989, 353, 7700, 13, 1678, 1476, 29918, 1256, 353, 7700, 13, 268, 13, 1678, 363, 1948, 297, 4206, 29901, 13, 4706, 1596, 29898, 798, 29897, 13, 13, 4706, 363, 313, 29875, 29892, 710, 1688, 29897, 297, 26985, 29898, 798, 1125, 13, 9651, 565, 6702, 2539, 29915, 297, 851, 1688, 29897, 470, 6702, 6248, 29915, 297, 851, 1688, 1125, 13, 18884, 1820, 353, 1196, 1989, 29898, 1256, 29918, 2248, 353, 474, 29897, 13, 18884, 1476, 29918, 1256, 353, 5852, 462, 4706, 13, 18884, 2867, 13, 13, 4706, 565, 1476, 29918, 1256, 29901, 13, 632, 13, 9651, 5694, 29918, 18137, 353, 6571, 13, 632, 13, 9651, 5694, 29918, 1853, 353, 6629, 13, 9651, 363, 313, 29875, 29892, 710, 1688, 29897, 297, 26985, 29898, 798, 1125, 13, 18884, 1121, 353, 770, 1598, 29918, 7382, 29918, 6672, 29898, 710, 1688, 29897, 13, 462, 13, 18884, 565, 1121, 29961, 29900, 29962, 1360, 29896, 29901, 13, 462, 1678, 565, 5694, 29918, 1853, 1275, 525, 16009, 573, 2396, 13, 462, 4706, 1596, 877, 2525, 519, 304, 8161, 10430, 1134, 1495, 13, 462, 4706, 736, 6213, 13, 462, 1678, 5694, 29918, 1853, 353, 525, 3318, 573, 29915, 13, 462, 1678, 10944, 353, 525, 4986, 29915, 13, 462, 268, 13, 18884, 565, 1121, 29961, 29900, 29962, 1360, 29906, 29901, 13, 462, 1678, 565, 5694, 29918, 1853, 1275, 525, 3318, 573, 2396, 13, 462, 4706, 1596, 877, 2525, 519, 304, 8161, 10430, 1134, 1495, 13, 462, 4706, 736, 6213, 13, 462, 1678, 5694, 29918, 1853, 353, 525, 16009, 573, 29915, 13, 462, 1678, 10944, 353, 525, 9375, 29915, 13, 462, 268, 13, 18884, 5694, 29918, 18137, 29961, 29875, 29962, 353, 770, 1598, 29918, 7382, 29918, 6672, 29898, 710, 1688, 29897, 13, 13, 18884, 565, 1121, 29961, 29900, 29962, 19216, 29900, 29901, 13, 462, 1678, 1820, 29889, 1202, 29918, 1767, 29918, 2248, 29898, 13506, 29974, 710, 29898, 2914, 29961, 29896, 11724, 29875, 29897, 13, 462, 259, 13, 9651, 2867, 13, 632, 13, 1669, 13, 1678, 736, 1820, 13, 268, 13, 13, 1753, 679, 29918, 1220, 1989, 29898, 1272, 29918, 1445, 29892, 11918, 29918, 1761, 29892, 2423, 12602, 29918, 978, 1125, 13, 1678, 1053, 21503, 4314, 13, 1678, 1053, 11799, 13, 13, 1678, 934, 29882, 353, 1722, 29898, 1272, 29918, 1445, 29897, 13, 1678, 4206, 353, 11799, 29889, 16950, 29898, 1445, 29882, 29897, 13, 1678, 1476, 29918, 1989, 353, 7700, 13, 1678, 1476, 29918, 1256, 353, 7700, 13, 268, 13, 1678, 22599, 353, 21503, 4314, 29889, 3257, 29918, 27774, 580, 13, 1678, 2286, 29918, 8149, 29918, 1761, 353, 518, 1594, 29961, 11918, 29918, 978, 29962, 363, 2286, 29918, 978, 297, 2286, 29918, 1761, 29962, 13, 1678, 11408, 29918, 7052, 353, 29871, 29896, 29889, 29871, 13, 1678, 285, 492, 572, 265, 353, 7700, 1678, 13, 13, 1678, 363, 1948, 297, 4206, 29901, 13, 4706, 565, 451, 1476, 29918, 1989, 29901, 13, 13, 9651, 363, 313, 29875, 29892, 710, 1688, 29897, 297, 26985, 29898, 798, 1125, 13, 18884, 565, 6702, 2539, 29915, 297, 851, 1688, 29897, 470, 6702, 6248, 29915, 297, 851, 1688, 1125, 13, 462, 1678, 1820, 353, 1196, 1989, 29898, 1256, 29918, 2248, 353, 474, 29897, 13, 462, 1678, 1476, 29918, 1256, 353, 5852, 462, 1678, 13, 462, 1678, 2867, 13, 13, 9651, 565, 1476, 29918, 1256, 29901, 13, 13, 18884, 363, 313, 1707, 1217, 29892, 11918, 29918, 8149, 29897, 297, 26985, 29898, 11918, 29918, 8149, 29918, 1761, 1125, 13, 462, 1678, 1476, 29918, 1989, 353, 7700, 13, 462, 1678, 363, 1347, 297, 2286, 29918, 8149, 29901, 13, 462, 4706, 363, 313, 29875, 29892, 710, 1688, 29897, 297, 26985, 29898, 798, 1125, 13, 462, 9651, 565, 313, 1807, 1275, 851, 1688, 29889, 17010, 580, 1125, 13, 462, 18884, 1820, 29889, 1202, 29918, 1767, 29918, 2248, 29898, 11918, 29918, 1761, 29961, 1707, 1217, 1402, 29875, 29897, 13, 462, 18884, 1476, 29918, 1989, 353, 5852, 13, 462, 18884, 474, 29918, 1989, 353, 474, 13, 13, 462, 18884, 565, 525, 29898, 4912, 16029, 297, 1347, 29901, 13, 462, 462, 1678, 11408, 29918, 7052, 353, 29871, 29900, 29889, 29900, 29896, 13, 462, 18884, 565, 525, 29898, 29885, 16029, 297, 1347, 29901, 13, 462, 462, 1678, 11408, 29918, 7052, 353, 29871, 29896, 29889, 13, 462, 462, 13, 462, 18884, 565, 1347, 1360, 29915, 8208, 4279, 313, 29956, 29897, 2396, 13, 462, 462, 1678, 285, 492, 572, 265, 353, 5852, 13, 13, 462, 1678, 565, 451, 1476, 29918, 1989, 29901, 13, 462, 4706, 1820, 29889, 1202, 29918, 1767, 29918, 2248, 29898, 11918, 29918, 1761, 29961, 1707, 1217, 1402, 29899, 29896, 29897, 13, 13, 462, 1678, 565, 2286, 29918, 1761, 29961, 1707, 1217, 29962, 1360, 29915, 5066, 4279, 2396, 13, 462, 4706, 363, 313, 29875, 29892, 710, 1688, 29897, 297, 26985, 29898, 798, 1125, 13, 462, 9651, 565, 313, 710, 1688, 1275, 525, 29940, 29914, 29903, 29374, 13, 462, 18884, 1820, 29889, 1983, 29898, 29875, 29918, 1989, 29892, 29875, 29897, 13, 13, 462, 1678, 565, 2286, 29918, 1761, 29961, 1707, 1217, 29962, 1360, 29915, 5426, 4279, 2396, 13, 462, 4706, 363, 313, 29875, 29892, 710, 1688, 29897, 297, 26985, 29898, 798, 1125, 13, 462, 9651, 565, 313, 710, 1688, 1275, 525, 29923, 29914, 29956, 29374, 13, 462, 18884, 1820, 29889, 809, 29898, 29875, 29918, 1989, 29892, 29875, 29897, 13, 13, 4706, 565, 5852, 297, 518, 877, 348, 1169, 526, 7477, 1495, 297, 2944, 363, 2944, 297, 1948, 5387, 13, 9651, 11408, 29918, 7052, 353, 29871, 29900, 29889, 29900, 29896, 13, 13, 4706, 565, 525, 29923, 29914, 29956, 29915, 297, 1948, 322, 525, 5426, 4279, 29915, 297, 1820, 29889, 9789, 28342, 29918, 7039, 29901, 13, 9651, 474, 29918, 20157, 2496, 353, 1948, 29889, 2248, 877, 29923, 29914, 29956, 1495, 13, 9651, 474, 29918, 20157, 407, 3905, 353, 1820, 29889, 1767, 29918, 2248, 29961, 1989, 29889, 9789, 28342, 29918, 7039, 29889, 2248, 877, 5426, 4279, 1495, 29962, 13, 9651, 1820, 29889, 809, 29898, 29875, 29918, 20157, 407, 3905, 29892, 29875, 29918, 20157, 2496, 29897, 13, 13, 4706, 565, 525, 29940, 29914, 29903, 29915, 297, 1948, 322, 525, 5066, 4279, 29915, 297, 1820, 29889, 9789, 28342, 29918, 7039, 29901, 13, 9651, 474, 29918, 20157, 2496, 353, 1948, 29889, 2248, 877, 29940, 29914, 29903, 1495, 13, 9651, 474, 29918, 20157, 407, 3905, 353, 1820, 29889, 1767, 29918, 2248, 29961, 1989, 29889, 9789, 28342, 29918, 7039, 29889, 2248, 877, 5066, 4279, 1495, 29962, 13, 9651, 1820, 29889, 809, 29898, 29875, 29918, 20157, 407, 3905, 29892, 29875, 29918, 20157, 2496, 29897, 13, 632, 13, 13, 1678, 565, 451, 1476, 29918, 1256, 29901, 13, 4706, 1596, 877, 23323, 451, 1284, 2635, 1495, 13, 4706, 934, 29882, 29889, 5358, 580, 13, 4706, 736, 6213, 259, 13, 462, 13, 1678, 1820, 29889, 18575, 29918, 7052, 353, 11408, 29918, 7052, 13, 1678, 1820, 29889, 20157, 572, 265, 353, 285, 492, 572, 265, 13, 1678, 934, 29882, 29889, 5358, 580, 13, 1678, 736, 1820, 13, 13, 1753, 770, 1598, 29918, 7382, 29918, 6672, 29898, 1807, 1125, 13, 1678, 1053, 3168, 13, 1678, 565, 3168, 29889, 275, 29918, 4537, 29898, 1807, 1125, 13, 4706, 1353, 353, 5785, 29898, 1807, 29897, 13, 4706, 736, 313, 29896, 29892, 4537, 29897, 13, 268, 13, 1678, 25342, 1347, 29961, 29900, 29901, 29896, 29962, 1360, 29915, 29911, 29915, 322, 1347, 14352, 29941, 17531, 1360, 12215, 29907, 16029, 322, 3168, 29889, 275, 29918, 4537, 29898, 1807, 29961, 29896, 13018, 29941, 29962, 1125, 13, 4706, 1353, 353, 938, 29898, 1807, 29961, 29896, 13018, 29941, 2314, 13, 4706, 736, 313, 29906, 29892, 4537, 29897, 13, 13, 1678, 25342, 1347, 29961, 29900, 29901, 29896, 29962, 1360, 29915, 29911, 29915, 322, 3168, 29889, 275, 29918, 4537, 29898, 1807, 29961, 29896, 17531, 1125, 13, 4706, 1353, 353, 938, 29898, 1807, 29961, 29896, 29901, 2314, 13, 4706, 736, 313, 29906, 29892, 4537, 29897, 13, 13, 1678, 25342, 7431, 29898, 1807, 29897, 6736, 29871, 29946, 29901, 13, 4706, 565, 1347, 29961, 29900, 29901, 29946, 29962, 1360, 29915, 4330, 3580, 29915, 322, 3168, 29889, 275, 29918, 4537, 29898, 1807, 29961, 29946, 17531, 1125, 13, 9651, 1353, 353, 938, 29898, 1807, 29961, 29946, 29901, 2314, 13, 9651, 736, 313, 29906, 29892, 4537, 29897, 13, 4706, 25342, 1347, 29961, 29900, 29901, 29945, 29962, 1360, 29915, 15637, 525, 322, 3168, 29889, 275, 29918, 4537, 29898, 1807, 29961, 29945, 17531, 1125, 13, 9651, 1353, 353, 938, 29898, 1807, 29961, 29945, 29901, 2314, 13, 9651, 736, 313, 29906, 29892, 4537, 29897, 29871, 13, 4706, 1683, 29901, 13, 9651, 736, 313, 29900, 29892, 29900, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 313, 29900, 29892, 29900, 29897, 13, 2 ]
test_motor.py
ankworld/Rpi_Therapy
0
98410
<reponame>ankworld/Rpi_Therapy<filename>test_motor.py from myLib import controlcore from time import sleep motor = controlcore.Motor(11, 13, 1000) dc = 100 for i in range(10): motor.l_drive(dc) sleep(5) motor.r_drive(dc) sleep(5)
[ 1, 529, 276, 1112, 420, 29958, 804, 11526, 29914, 29934, 1631, 29918, 1349, 261, 27580, 29966, 9507, 29958, 1688, 29918, 14817, 272, 29889, 2272, 13, 3166, 590, 14868, 1053, 2761, 3221, 13, 3166, 931, 1053, 8709, 13, 13, 14817, 272, 353, 2761, 3221, 29889, 29924, 327, 272, 29898, 29896, 29896, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29900, 29900, 29900, 29897, 13, 13, 13891, 353, 29871, 29896, 29900, 29900, 13, 13, 13, 1454, 474, 297, 3464, 29898, 29896, 29900, 1125, 13, 1678, 10992, 29889, 29880, 29918, 21594, 29898, 13891, 29897, 13, 13, 1678, 8709, 29898, 29945, 29897, 13, 13, 1678, 10992, 29889, 29878, 29918, 21594, 29898, 13891, 29897, 13, 13, 1678, 8709, 29898, 29945, 29897, 13, 2 ]
train.py
Mario-Medvedovic/deepPhosAPI
0
71287
<gh_stars>0 import functools import itertools import os import random import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np from sklearn import metrics from sklearn import preprocessing from sklearn.model_selection import train_test_split, KFold, cross_val_score from keras.layers import Dense, Activation, Flatten, Dropout, Reshape from keras.layers import Conv1D,Conv2D, MaxPooling2D from keras.models import Sequential,Model from keras.utils.np_utils import to_categorical from keras import optimizers from keras.optimizers import Adam,SGD from keras.layers.normalization import BatchNormalization from keras.regularizers import l2 import copy def train_for_deepphos(train_file_name,site,predictFrame = 'general',background_weight = None): ''' :param train_file_name: input of your train file it must be a .csv file and theinput format is label,proteinName, postion,sites, shortsequence, :param site: the sites predict: site = 'S','T' OR 'Y' :param predictFrame: 'general' or 'kinase' :param background_weight: the model you want load to pretrain new model usually used in kinase training :return: ''' win1 = 51 win2 = 33 win3 = 15 from methods.dataprocess_train import getMatrixLabel X_train1 , y_train = getMatrixLabel(train_file_name, sites, win1) X_train2, _ = getMatrixLabel(train_file_name, sites, win2) X_train3, _ = getMatrixLabel(train_file_name, sites, win3) modelname = "general_{:s}".format(site) if predictFrame == 'general': modelname ="general_model_{:s}".format(site) if predictFrame == 'kinase': modelname = "kinase_model_{:s}".format(site) from methods.model_n import model_net model = model_net(X_train1, X_train2, X_train3, y_train, weights=background_weight) model.save_weights(modelname+'.h5',overwrite=True)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2090, 312, 8789, 13, 5215, 4256, 8504, 13, 5215, 2897, 13, 5215, 4036, 13, 13, 5215, 22889, 13, 2922, 17357, 29889, 1509, 877, 29909, 1505, 1495, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 1053, 21556, 13, 3166, 2071, 19668, 1053, 758, 19170, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 29892, 476, 29943, 1025, 29892, 4891, 29918, 791, 29918, 13628, 13, 13, 3166, 13023, 294, 29889, 29277, 1053, 360, 1947, 29892, 21775, 362, 29892, 2379, 8606, 29892, 20724, 449, 29892, 2538, 14443, 13, 3166, 13023, 294, 29889, 29277, 1053, 1281, 29894, 29896, 29928, 29892, 1168, 29894, 29906, 29928, 29892, 5918, 11426, 292, 29906, 29928, 13, 3166, 13023, 294, 29889, 9794, 1053, 922, 339, 2556, 29892, 3195, 13, 3166, 13023, 294, 29889, 13239, 29889, 9302, 29918, 13239, 1053, 304, 29918, 29883, 20440, 936, 13, 3166, 13023, 294, 1053, 5994, 19427, 13, 3166, 13023, 294, 29889, 20640, 19427, 1053, 11783, 29892, 26016, 29928, 13, 3166, 13023, 294, 29889, 29277, 29889, 8945, 2133, 1053, 350, 905, 19077, 2133, 13, 3166, 13023, 294, 29889, 15227, 19427, 1053, 301, 29906, 13, 5215, 3509, 13, 13, 1753, 7945, 29918, 1454, 29918, 311, 29872, 407, 15656, 29898, 14968, 29918, 1445, 29918, 978, 29892, 2746, 29892, 27711, 4308, 353, 525, 17492, 742, 7042, 29918, 7915, 353, 6213, 1125, 13, 1678, 14550, 13, 13, 1678, 584, 3207, 7945, 29918, 1445, 29918, 978, 29901, 29871, 1881, 310, 596, 7945, 934, 13, 462, 18884, 372, 1818, 367, 263, 869, 7638, 934, 322, 278, 2080, 3402, 29871, 338, 3858, 29892, 14676, 262, 1170, 29892, 1400, 291, 29892, 16315, 29892, 3273, 16506, 29892, 13, 1678, 584, 3207, 3268, 29901, 278, 11840, 8500, 29901, 3268, 353, 525, 29903, 3788, 29911, 29915, 6323, 525, 29979, 29915, 13, 1678, 584, 3207, 8500, 4308, 29901, 525, 17492, 29915, 470, 525, 9089, 559, 29915, 13, 1678, 584, 3207, 3239, 29918, 7915, 29901, 278, 1904, 366, 864, 2254, 304, 758, 14968, 716, 1904, 13, 462, 18884, 5491, 1304, 297, 19015, 559, 6694, 13, 1678, 584, 2457, 29901, 13, 1678, 14550, 13, 13, 13, 1678, 5401, 29896, 353, 29871, 29945, 29896, 13, 1678, 5401, 29906, 353, 29871, 29941, 29941, 13, 1678, 5401, 29941, 353, 29871, 29896, 29945, 13, 1678, 515, 3519, 29889, 4130, 481, 307, 985, 29918, 14968, 1053, 679, 14609, 4775, 13, 1678, 1060, 29918, 14968, 29896, 1919, 343, 29918, 14968, 353, 679, 14609, 4775, 29898, 14968, 29918, 1445, 29918, 978, 29892, 11840, 29892, 5401, 29896, 29897, 13, 1678, 1060, 29918, 14968, 29906, 29892, 903, 353, 679, 14609, 4775, 29898, 14968, 29918, 1445, 29918, 978, 29892, 11840, 29892, 5401, 29906, 29897, 13, 1678, 1060, 29918, 14968, 29941, 29892, 903, 353, 679, 14609, 4775, 29898, 14968, 29918, 1445, 29918, 978, 29892, 11840, 29892, 5401, 29941, 29897, 13, 13, 13, 1678, 1904, 978, 353, 376, 17492, 648, 29901, 29879, 29913, 1642, 4830, 29898, 2746, 29897, 13, 1678, 565, 8500, 4308, 1275, 525, 17492, 2396, 13, 4706, 1904, 978, 29465, 17492, 29918, 4299, 648, 29901, 29879, 29913, 1642, 4830, 29898, 2746, 29897, 13, 13, 13, 1678, 565, 8500, 4308, 1275, 525, 9089, 559, 2396, 13, 4706, 1904, 978, 353, 376, 9089, 559, 29918, 4299, 648, 29901, 29879, 29913, 1642, 4830, 29898, 2746, 29897, 13, 13, 13, 1678, 515, 3519, 29889, 4299, 29918, 29876, 1053, 1904, 29918, 1212, 13, 13, 1678, 1904, 353, 1904, 29918, 1212, 29898, 29990, 29918, 14968, 29896, 29892, 1060, 29918, 14968, 29906, 29892, 1060, 29918, 14968, 29941, 29892, 343, 29918, 14968, 29892, 13, 1669, 18177, 29922, 7042, 29918, 7915, 29897, 13, 1678, 1904, 29889, 7620, 29918, 705, 5861, 29898, 4299, 978, 29974, 4286, 29882, 29945, 742, 957, 3539, 29922, 5574, 29897, 13, 13, 13, 13, 2 ]
data_scripts/data_loader.py
luis-armando-perez-rey/renderSHREC2021
0
167885
<filename>data_scripts/data_loader.py import os import h5py import numpy as np from data_scripts.factor_dataset import FactorImageDataset AVAILABLE_COLLECTIONS = ["Shape", "Culture"] AVAILABLE_DATA_TYPES = ["train", "test"] def load_factor_data(data, root_path=None, **kwargs): options_dict = { "shrec2021": get_h5_saved_data, } return options_dict[data](root_path, **kwargs) def get_h5_saved_data(root_path, collection_list, data_type, dataset_directory, normalize=True): """ Returns a TransformImage object created from ModelNet40 dataset of objects with periodic colors and rotated Args: root_path: path to the root of the project dataset_filename: filename of the .h5 data to be loaded object_type: type of object saved in the data file normalize: whether data should be in the range [0,1] (True) or [0, 255] (False). Returns: FactorImageDataset object :param normalize: :param dataset_directory: :param data_type: :param collection_list: """ image_list = [] views_list = [] labels_list = [] ids_list = [] for collection in collection_list: assert collection in AVAILABLE_COLLECTIONS, "collection_list = {} is not available. Possible values are {}".format( collection, AVAILABLE_COLLECTIONS) assert data_type in AVAILABLE_DATA_TYPES, "data_type = {} is not available. Possible values are {}".format( data_type, AVAILABLE_DATA_TYPES) dataset_filename = collection + "_" + data_type + ".h5" print(dataset_filename) dataset_filepath = os.path.join(root_path, dataset_directory, dataset_filename) # Read the images images = read_data_h5(dataset_filepath, "images") if normalize: images = images.astype('float32') / np.amax(images) image_list.append(images) # Read the rotations views = read_data_h5(dataset_filepath, "views") views_list.append(views) # Read category integer class_labels try: labels = read_data_h5(dataset_filepath, "class_int") except: print("No labels detected in the dataset") labels = None labels_list.append(labels) ids = read_data_h5(dataset_filepath, "ids") ids_list.append(ids) images = np.concatenate(image_list, axis=0) ids = np.concatenate(ids_list, axis=0) labels = np.concatenate(labels_list, axis=0) views = np.concatenate(views_list, axis=0) # Convert integer range to angular range unique_views = np.unique(views) unique_ids = np.unique(ids) # Create FactorImageDataset lists factor_values = [unique_ids, unique_views] max_factor_values = [np.amax(factor) for factor in factor_values] return FactorImageDataset(images=images, factor_values_list=factor_values, max_factor_values=max_factor_values, factor_names=["object_ids", "rotation_angle"], labels=labels) def read_data_h5(data_filepath, data_type): """ Read data from h5 file with 1 level of hierarchy Args: data_filepath: path to the .h5 file data_type: key value from which data is read Returns: """ with h5py.File(data_filepath, "r") as file: data = np.array(file.get(data_type)) return data
[ 1, 529, 9507, 29958, 1272, 29918, 16713, 29914, 1272, 29918, 12657, 29889, 2272, 13, 5215, 2897, 13, 5215, 298, 29945, 2272, 13, 5215, 12655, 408, 7442, 13, 3166, 848, 29918, 16713, 29889, 19790, 29918, 24713, 1053, 383, 7168, 2940, 16390, 24541, 13, 13, 26612, 6227, 6181, 29918, 15032, 3281, 27946, 353, 6796, 24111, 613, 376, 27926, 3108, 13, 26612, 6227, 6181, 29918, 14573, 29918, 15631, 29925, 2890, 353, 6796, 14968, 613, 376, 1688, 3108, 13, 13, 13, 1753, 2254, 29918, 19790, 29918, 1272, 29898, 1272, 29892, 3876, 29918, 2084, 29922, 8516, 29892, 3579, 19290, 1125, 13, 1678, 3987, 29918, 8977, 353, 426, 13, 4706, 376, 845, 3757, 29906, 29900, 29906, 29896, 1115, 679, 29918, 29882, 29945, 29918, 17314, 29918, 1272, 29892, 13, 1678, 500, 13, 1678, 736, 3987, 29918, 8977, 29961, 1272, 850, 4632, 29918, 2084, 29892, 3579, 19290, 29897, 13, 13, 13, 1753, 679, 29918, 29882, 29945, 29918, 17314, 29918, 1272, 29898, 4632, 29918, 2084, 29892, 4333, 29918, 1761, 29892, 848, 29918, 1853, 29892, 8783, 29918, 12322, 29892, 4226, 675, 29922, 5574, 1125, 13, 1678, 9995, 13, 1678, 16969, 263, 4103, 689, 2940, 1203, 2825, 515, 8125, 6779, 29946, 29900, 8783, 310, 3618, 411, 29591, 11955, 322, 5731, 630, 13, 1678, 826, 3174, 29901, 13, 4706, 3876, 29918, 2084, 29901, 2224, 304, 278, 3876, 310, 278, 2060, 13, 4706, 8783, 29918, 9507, 29901, 10422, 310, 278, 869, 29882, 29945, 848, 304, 367, 7500, 13, 4706, 1203, 29918, 1853, 29901, 1134, 310, 1203, 7160, 297, 278, 848, 934, 13, 4706, 4226, 675, 29901, 3692, 848, 881, 367, 297, 278, 3464, 518, 29900, 29892, 29896, 29962, 313, 5574, 29897, 470, 518, 29900, 29892, 29871, 29906, 29945, 29945, 29962, 313, 8824, 467, 13, 13, 1678, 16969, 29901, 13, 4706, 383, 7168, 2940, 16390, 24541, 1203, 13, 4706, 584, 3207, 4226, 675, 29901, 13, 4706, 584, 3207, 8783, 29918, 12322, 29901, 13, 4706, 584, 3207, 848, 29918, 1853, 29901, 13, 4706, 584, 3207, 4333, 29918, 1761, 29901, 13, 1678, 9995, 13, 1678, 1967, 29918, 1761, 353, 5159, 13, 1678, 8386, 29918, 1761, 353, 5159, 13, 1678, 11073, 29918, 1761, 353, 5159, 13, 1678, 18999, 29918, 1761, 353, 5159, 13, 1678, 363, 4333, 297, 4333, 29918, 1761, 29901, 13, 4706, 4974, 4333, 297, 16884, 29909, 6227, 6181, 29918, 15032, 3281, 27946, 29892, 376, 10855, 29918, 1761, 353, 6571, 338, 451, 3625, 29889, 20049, 1819, 526, 6571, 1642, 4830, 29898, 13, 9651, 4333, 29892, 16884, 29909, 6227, 6181, 29918, 15032, 3281, 27946, 29897, 13, 4706, 4974, 848, 29918, 1853, 297, 16884, 29909, 6227, 6181, 29918, 14573, 29918, 15631, 29925, 2890, 29892, 376, 1272, 29918, 1853, 353, 6571, 338, 451, 3625, 29889, 20049, 1819, 526, 6571, 1642, 4830, 29898, 13, 9651, 848, 29918, 1853, 29892, 16884, 29909, 6227, 6181, 29918, 14573, 29918, 15631, 29925, 2890, 29897, 13, 13, 4706, 8783, 29918, 9507, 353, 4333, 718, 11119, 29908, 718, 848, 29918, 1853, 718, 11393, 29882, 29945, 29908, 13, 4706, 1596, 29898, 24713, 29918, 9507, 29897, 13, 4706, 8783, 29918, 1445, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4632, 29918, 2084, 29892, 8783, 29918, 12322, 29892, 8783, 29918, 9507, 29897, 13, 4706, 396, 7523, 278, 4558, 13, 4706, 4558, 353, 1303, 29918, 1272, 29918, 29882, 29945, 29898, 24713, 29918, 1445, 2084, 29892, 376, 8346, 1159, 13, 4706, 565, 4226, 675, 29901, 13, 9651, 4558, 353, 4558, 29889, 579, 668, 877, 7411, 29941, 29906, 1495, 847, 7442, 29889, 314, 1165, 29898, 8346, 29897, 13, 4706, 1967, 29918, 1761, 29889, 4397, 29898, 8346, 29897, 13, 4706, 396, 7523, 278, 5731, 800, 13, 4706, 8386, 353, 1303, 29918, 1272, 29918, 29882, 29945, 29898, 24713, 29918, 1445, 2084, 29892, 376, 7406, 1159, 13, 4706, 8386, 29918, 1761, 29889, 4397, 29898, 7406, 29897, 13, 4706, 396, 7523, 7663, 6043, 770, 29918, 21134, 13, 4706, 1018, 29901, 13, 9651, 11073, 353, 1303, 29918, 1272, 29918, 29882, 29945, 29898, 24713, 29918, 1445, 2084, 29892, 376, 1990, 29918, 524, 1159, 13, 4706, 5174, 29901, 13, 9651, 1596, 703, 3782, 11073, 17809, 297, 278, 8783, 1159, 13, 9651, 11073, 353, 6213, 13, 4706, 11073, 29918, 1761, 29889, 4397, 29898, 21134, 29897, 13, 4706, 18999, 353, 1303, 29918, 1272, 29918, 29882, 29945, 29898, 24713, 29918, 1445, 2084, 29892, 376, 4841, 1159, 13, 4706, 18999, 29918, 1761, 29889, 4397, 29898, 4841, 29897, 13, 13, 1678, 4558, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 3027, 29918, 1761, 29892, 9685, 29922, 29900, 29897, 13, 1678, 18999, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 4841, 29918, 1761, 29892, 9685, 29922, 29900, 29897, 13, 1678, 11073, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 21134, 29918, 1761, 29892, 9685, 29922, 29900, 29897, 13, 1678, 8386, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 7406, 29918, 1761, 29892, 9685, 29922, 29900, 29897, 13, 1678, 396, 14806, 6043, 3464, 304, 6401, 3464, 13, 1678, 5412, 29918, 7406, 353, 7442, 29889, 13092, 29898, 7406, 29897, 13, 1678, 5412, 29918, 4841, 353, 7442, 29889, 13092, 29898, 4841, 29897, 13, 1678, 396, 6204, 383, 7168, 2940, 16390, 24541, 8857, 13, 1678, 7329, 29918, 5975, 353, 518, 13092, 29918, 4841, 29892, 5412, 29918, 7406, 29962, 13, 13, 1678, 4236, 29918, 19790, 29918, 5975, 353, 518, 9302, 29889, 314, 1165, 29898, 19790, 29897, 363, 7329, 297, 7329, 29918, 5975, 29962, 13, 1678, 736, 383, 7168, 2940, 16390, 24541, 29898, 8346, 29922, 8346, 29892, 13, 462, 795, 7329, 29918, 5975, 29918, 1761, 29922, 19790, 29918, 5975, 29892, 13, 462, 795, 4236, 29918, 19790, 29918, 5975, 29922, 3317, 29918, 19790, 29918, 5975, 29892, 13, 462, 795, 7329, 29918, 7039, 29922, 3366, 3318, 29918, 4841, 613, 376, 5450, 362, 29918, 2521, 12436, 13, 462, 795, 11073, 29922, 21134, 29897, 13, 13, 13, 1753, 1303, 29918, 1272, 29918, 29882, 29945, 29898, 1272, 29918, 1445, 2084, 29892, 848, 29918, 1853, 1125, 13, 1678, 9995, 13, 1678, 7523, 848, 515, 298, 29945, 934, 411, 29871, 29896, 3233, 310, 21277, 13, 1678, 826, 3174, 29901, 13, 4706, 848, 29918, 1445, 2084, 29901, 2224, 304, 278, 869, 29882, 29945, 934, 13, 4706, 848, 29918, 1853, 29901, 1820, 995, 515, 607, 848, 338, 1303, 13, 13, 1678, 16969, 29901, 13, 13, 1678, 9995, 13, 1678, 411, 298, 29945, 2272, 29889, 2283, 29898, 1272, 29918, 1445, 2084, 29892, 376, 29878, 1159, 408, 934, 29901, 13, 4706, 848, 353, 7442, 29889, 2378, 29898, 1445, 29889, 657, 29898, 1272, 29918, 1853, 876, 13, 1678, 736, 848, 13, 2 ]
causal_discovery/graph_fitting.py
codeaudit/ENCO
0
176412
import torch import torch.nn.functional as F import numpy as np import math import random import sys sys.path.append("../") from causal_graphs.variable_distributions import _random_categ from causal_discovery.datasets import InterventionalDataset class GraphFitting(object): def __init__(self, model, graph, num_batches, num_graphs, theta_only_num_graphs, batch_size, lambda_sparse, max_graph_stacking=200): """ Creates a DistributionFitting object that summarizes all functionalities for performing the graph fitting stage of ENCO. Parameters ---------- model : MultivarMLP PyTorch module of the neural networks that model the conditional distributions. graph : CausalDAG Causal graph on which we want to perform causal structure learning. num_batches : int Number of batches to use per MC sample in the graph fitting stage. Usually 1, only higher needed if GPU is running out of memory for common batch sizes. num_graphs : int Number of graph samples to use for estimating the gradients in the graph fitting stage. Usually in the range 20-100. theta_only_num_graphs : int Number of graph samples to use in the graph fitting stage if gamma is frozen. Needs to be an even number, and usually 2 or 4. batch_size : int Size of the batches to use in the gradient estimators. lambda_sparse : float Sparsity regularizer value to use in the graph fitting stage. max_graph_stacking : int Number of graphs that can maximally evaluated in parallel on the device. If you run out of GPU memory, try to lower this number. It will then evaluate the graph sequentially, which can be slightly slower but uses less memory. """ self.model = model self.graph = graph self.num_batches = num_batches self.num_graphs = num_graphs self.batch_size = batch_size self.lambda_sparse = lambda_sparse self.max_graph_stacking = max_graph_stacking self.theta_only_num_graphs = theta_only_num_graphs self.inter_vars = [] if self.graph.num_vars >= 100 or hasattr(self.graph, "data_int"): self.dataset = InterventionalDataset(self.graph, dataset_size=4096, batch_size=self.batch_size) def perform_update_step(self, gamma, theta, var_idx=-1, only_theta=False): """ Performs a full update step of the graph fitting stage. We first sample a batch of graphs, evaluate them on a interventional data batch, and estimate the gradients for gamma and theta based on the log-likelihoods. Parameters ---------- gamma : nn.Parameter Parameter tensor representing the gamma parameters in ENCO. theta : nn.Parameter Parameter tensor representing the theta parameters in ENCO. var_idx : int Variable on which should be intervened to obtain the update. If none is given, i.e., a negative value, the variable will be randomly selected. only_theta : bool If True, gamma is frozen and the gradients are only estimated for theta. See Appendix D.2 in the paper for details on the gamma freezing stage. """ # Obtain log-likelihood estimates for randomly sampled graph structures if not only_theta: MC_samp = self.get_MC_samples(gamma, theta, num_batches=self.num_batches, num_graphs=self.num_graphs, batch_size=self.batch_size, var_idx=var_idx, mirror_graphs=False) else: MC_samp = self.get_MC_samples(gamma, theta, num_batches=self.num_batches, num_graphs=self.theta_only_num_graphs, batch_size=self.batch_size, var_idx=var_idx, mirror_graphs=True) adj_matrices, log_likelihoods, var_idx = MC_samp # Determine gradients for gamma and theta gamma_grads, theta_grads, theta_mask = self.gradient_estimator( adj_matrices, log_likelihoods, gamma, theta, var_idx) gamma.grad = gamma_grads theta.grad = theta_grads return theta_mask, var_idx @torch.no_grad() def get_MC_samples(self, gamma, theta, num_batches, num_graphs, batch_size, var_idx=-1, mirror_graphs=False): """ Samples and evaluates a batch of graph structures on a batch of interventional data. Parameters ---------- gamma : nn.Parameter Parameter tensor representing the gamma parameters in ENCO. theta : nn.Parameter Parameter tensor representing the theta parameters in ENCO. num_batches : int Number of batches to use per MC sample. num_graphs : int Number of graph structures to sample. batch_size : int Size of interventional data batches. var_idx : int Variable on which should be intervened to obtain the update. If none is given, i.e., a negative value, the variable will be randomly selected. mirror_graphs : bool This variable should be true if only theta is optimized. In this case, the first half of the graph structure samples is identical to the second half, except that the values of the outgoing edges of the intervened variable are flipped. This allows for more efficient, low-variance gradient estimators. See details in the paper. """ if mirror_graphs: assert num_graphs % 2 == 0, "Number of graphs must be divisible by two for mirroring" device = self.get_device() # Sample data batch if hasattr(self, "dataset"): # Pre-sampled data var_idx = self.sample_next_var_idx() int_sample = torch.cat([self.dataset.get_batch(var_idx) for _ in range(num_batches)], dim=0).to(device) else: # If no dataset exists, data is newly sampled from the graph intervention_dict, var_idx = self.sample_intervention(self.graph, dataset_size=num_batches*batch_size, var_idx=var_idx) int_sample = self.graph.sample(interventions=intervention_dict, batch_size=num_batches*batch_size, as_array=True) int_sample = torch.from_numpy(int_sample).long().to(device) # Split number of graph samples acorss multiple iterations if not all can fit into memory num_graphs_list = [min(self.max_graph_stacking, num_graphs-i*self.max_graph_stacking) for i in range(math.ceil(num_graphs * 1.0 / self.max_graph_stacking))] num_graphs_list = [(num_graphs_list[i], sum(num_graphs_list[:i])) for i in range(len(num_graphs_list))] # Tensors needed for sampling edge_prob = (torch.sigmoid(gamma) * torch.sigmoid(theta)).detach() edge_prob_batch = edge_prob[None].expand(num_graphs, -1, -1) # Inner function for sampling a batch of random adjacency matrices from current belief probabilities def sample_adj_matrix(): sample_matrix = torch.bernoulli(edge_prob_batch) sample_matrix = sample_matrix * (1 - torch.eye(sample_matrix.shape[-1], device=sample_matrix.device)[None]) if mirror_graphs: # First and second half of tensors are identical, except the intervened variable sample_matrix[num_graphs//2:] = sample_matrix[:num_graphs//2] sample_matrix[num_graphs//2:, var_idx] = 1 - sample_matrix[num_graphs//2:, var_idx] sample_matrix[:, var_idx, var_idx] = 0. return sample_matrix # Evaluate log-likelihoods under sampled adjacency matrix and data adj_matrices = [] log_likelihoods = [] for n_idx in range(num_batches): batch = int_sample[n_idx*batch_size:(n_idx+1)*batch_size] if n_idx == 0: adj_matrix = sample_adj_matrix() adj_matrices.append(adj_matrix) for c_idx, (graph_count, start_idx) in enumerate(num_graphs_list): adj_matrix_expanded = adj_matrix[start_idx:start_idx+graph_count, None].expand(-1, batch_size, -1, -1).flatten(0, 1) batch_exp = batch[None, :].expand(graph_count, -1, -1).flatten(0, 1) nll = self.evaluate_likelihoods(batch_exp, adj_matrix_expanded, var_idx) nll = nll.reshape(graph_count, batch_size, -1) if n_idx == 0: log_likelihoods.append(nll.mean(dim=1)) else: log_likelihoods[c_idx] += nll.mean(dim=1) # Combine all data adj_matrices = torch.cat(adj_matrices, dim=0) log_likelihoods = torch.cat(log_likelihoods, dim=0) / num_batches return adj_matrices, log_likelihoods, var_idx @torch.no_grad() def gradient_estimator(self, adj_matrices, log_likelihoods, gamma, theta, var_idx): """ Returns the estimated gradients for gamma and theta. It uses the low-variance gradient estimators proposed in Section 3.3 of the paper. Parameters ---------- adj_matrices : torch.FloatTensor, shape [batch_size, num_vars, num_vars] The adjacency matrices on which the interventional data has been evaluated on. log_likelihoods : torch.FloatTensor, shape [batch_size, num_vars] The average log-likelihood under the adjacency matrices for all variables in the graph. gamma : nn.Parameter Parameter tensor representing the gamma parameters in ENCO. theta : nn.Parameter Parameter tensor representing the theta parameters in ENCO. var_idx : int Variable on which the intervention was performed. """ batch_size = adj_matrices.shape[0] log_likelihoods = log_likelihoods.unsqueeze(dim=1) orient_probs = torch.sigmoid(theta) edge_probs = torch.sigmoid(gamma) # Gradient calculation num_pos = adj_matrices.sum(dim=0) num_neg = batch_size - num_pos mask = ((num_pos > 0) * (num_neg > 0)).float() pos_grads = (log_likelihoods * adj_matrices).sum(dim=0) / num_pos.clamp_(min=1e-5) neg_grads = (log_likelihoods * (1 - adj_matrices)).sum(dim=0) / num_neg.clamp_(min=1e-5) gamma_grads = mask * edge_probs * (1 - edge_probs) * orient_probs * (pos_grads - neg_grads + self.lambda_sparse) theta_grads = mask * orient_probs * (1 - orient_probs) * edge_probs * (pos_grads - neg_grads) # Masking gamma for incoming edges to intervened variable gamma_grads[:, var_idx] = 0. gamma_grads[torch.arange(gamma_grads.shape[0]), torch.arange(gamma_grads.shape[1])] = 0. # Masking all theta's except the ones with a intervened variable theta_grads[:var_idx] = 0. theta_grads[var_idx+1:] = 0. theta_grads -= theta_grads.transpose(0, 1) # theta_ij = -theta_ji # Creating a mask which theta's are actually updated for the optimizer theta_mask = torch.zeros_like(theta_grads) theta_mask[var_idx] = 1. theta_mask[:, var_idx] = 1. theta_mask[var_idx, var_idx] = 0. return gamma_grads, theta_grads, theta_mask def sample_next_var_idx(self): """ Returns next variable to intervene on. We iterate through the variables in a shuffled order, like a standard dataset. """ if len(self.inter_vars) == 0: # If an epoch finished, reshuffle variables self.inter_vars = [i for i in range(len(self.graph.variables))] random.shuffle(self.inter_vars) var_idx = self.inter_vars.pop() return var_idx def sample_intervention(self, graph, dataset_size, var_idx=-1): """ Returns a new data batch for an intervened variable. """ # Select variable to intervene on if var_idx < 0: var_idx = self.sample_next_var_idx() var = graph.variables[var_idx] # Soft, perfect intervention => replace p(X_n) by random categorical # Scale is set to 0.0, which represents a uniform distribution. int_dist = _random_categ(size=(var.prob_dist.num_categs,), scale=0.0, axis=-1) # Sample from interventional distribution value = np.random.multinomial(n=1, pvals=int_dist, size=(dataset_size,)) value = np.argmax(value, axis=-1) # One-hot to index intervention_dict = {var.name: value} return intervention_dict, var_idx @torch.no_grad() def evaluate_likelihoods(self, int_sample, adj_matrix, var_idx): """ Evaluates the negative log-likelihood of the interventional data batch (int_sample) on the given graph structures (adj_matrix) and the intervened variable (var_idx). """ self.model.eval() device = self.get_device() int_sample = int_sample.to(device) adj_matrix = adj_matrix.to(device) # Transpose for mask because adj[i,j] means that i->j mask_adj_matrix = adj_matrix.transpose(1, 2) preds = self.model(int_sample, mask=mask_adj_matrix) # Evaluate negative log-likelihood of predictions preds = preds.flatten(0, 1) labels = int_sample.clone() labels[:, var_idx] = -1 # Perfect interventions => no predictions of the intervened variable labels = labels.reshape(-1) nll = F.cross_entropy(preds, labels, reduction='none', ignore_index=-1) nll = nll.reshape(*int_sample.shape) self.model.train() return nll def get_device(self): return self.model.device
[ 1, 1053, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 5215, 12655, 408, 7442, 13, 5215, 5844, 13, 5215, 4036, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 4397, 703, 6995, 1159, 13, 13, 3166, 3269, 284, 29918, 4262, 29879, 29889, 11918, 29918, 27691, 29879, 1053, 903, 8172, 29918, 29883, 1845, 13, 3166, 3269, 284, 29918, 2218, 11911, 29891, 29889, 14538, 1691, 1053, 4124, 794, 1848, 16390, 24541, 13, 13, 13, 1990, 12367, 29943, 5367, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1904, 29892, 3983, 29892, 954, 29918, 16175, 267, 29892, 954, 29918, 4262, 29879, 29892, 278, 941, 29918, 6194, 29918, 1949, 29918, 4262, 29879, 29892, 9853, 29918, 2311, 29892, 14013, 29918, 29879, 5510, 29892, 4236, 29918, 4262, 29918, 1429, 292, 29922, 29906, 29900, 29900, 1125, 13, 4706, 9995, 13, 4706, 6760, 1078, 263, 17740, 29943, 5367, 1203, 393, 19138, 7093, 599, 13303, 1907, 13, 4706, 363, 15859, 278, 3983, 28221, 7408, 310, 12524, 3217, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 1904, 584, 9683, 440, 279, 1988, 29925, 13, 18884, 10772, 29911, 25350, 3883, 310, 278, 19677, 14379, 393, 1904, 278, 15047, 13, 18884, 18822, 29889, 13, 4706, 3983, 584, 315, 1485, 284, 7698, 29954, 13, 18884, 315, 1485, 284, 3983, 373, 607, 591, 864, 304, 2189, 3269, 284, 3829, 6509, 29889, 13, 4706, 954, 29918, 16175, 267, 584, 938, 13, 462, 418, 9681, 310, 9853, 267, 304, 671, 639, 21271, 4559, 297, 278, 3983, 28221, 7408, 29889, 29871, 13, 462, 418, 26991, 29871, 29896, 29892, 871, 6133, 4312, 565, 22796, 338, 2734, 714, 310, 3370, 363, 29871, 13, 462, 418, 3619, 9853, 15786, 29889, 13, 4706, 954, 29918, 4262, 29879, 584, 938, 29871, 13, 462, 268, 9681, 310, 3983, 11916, 304, 671, 363, 4844, 1218, 278, 4656, 10070, 297, 278, 13, 462, 268, 3983, 28221, 7408, 29889, 26991, 297, 278, 3464, 29871, 29906, 29900, 29899, 29896, 29900, 29900, 29889, 13, 4706, 278, 941, 29918, 6194, 29918, 1949, 29918, 4262, 29879, 584, 938, 13, 462, 18884, 9681, 310, 3983, 11916, 304, 671, 297, 278, 3983, 28221, 7408, 565, 13, 462, 18884, 330, 2735, 338, 14671, 2256, 29889, 2448, 5779, 304, 367, 385, 1584, 1353, 29892, 322, 5491, 29871, 29906, 470, 29871, 29946, 29889, 13, 4706, 9853, 29918, 2311, 584, 938, 13, 462, 268, 21179, 310, 278, 9853, 267, 304, 671, 297, 278, 16030, 4844, 4097, 29889, 13, 4706, 14013, 29918, 29879, 5510, 584, 5785, 13, 462, 4706, 317, 862, 29879, 537, 4943, 3950, 995, 304, 671, 297, 278, 3983, 28221, 7408, 29889, 13, 4706, 4236, 29918, 4262, 29918, 1429, 292, 584, 938, 13, 462, 632, 9681, 310, 18445, 393, 508, 5256, 635, 19030, 297, 8943, 373, 278, 4742, 29889, 13, 462, 632, 960, 366, 1065, 714, 310, 22796, 3370, 29892, 1018, 304, 5224, 445, 1353, 29889, 739, 674, 769, 13, 462, 632, 14707, 278, 3983, 8617, 9247, 29892, 607, 508, 367, 10029, 20312, 541, 3913, 13, 462, 632, 3109, 3370, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 4299, 353, 1904, 13, 4706, 1583, 29889, 4262, 353, 3983, 13, 4706, 1583, 29889, 1949, 29918, 16175, 267, 353, 954, 29918, 16175, 267, 13, 4706, 1583, 29889, 1949, 29918, 4262, 29879, 353, 954, 29918, 4262, 29879, 13, 4706, 1583, 29889, 16175, 29918, 2311, 353, 9853, 29918, 2311, 13, 4706, 1583, 29889, 2892, 29918, 29879, 5510, 353, 14013, 29918, 29879, 5510, 13, 4706, 1583, 29889, 3317, 29918, 4262, 29918, 1429, 292, 353, 4236, 29918, 4262, 29918, 1429, 292, 13, 4706, 1583, 29889, 3416, 29918, 6194, 29918, 1949, 29918, 4262, 29879, 353, 278, 941, 29918, 6194, 29918, 1949, 29918, 4262, 29879, 13, 4706, 1583, 29889, 1639, 29918, 16908, 353, 5159, 13, 4706, 565, 1583, 29889, 4262, 29889, 1949, 29918, 16908, 6736, 29871, 29896, 29900, 29900, 470, 756, 5552, 29898, 1311, 29889, 4262, 29892, 376, 1272, 29918, 524, 29908, 1125, 13, 9651, 1583, 29889, 24713, 353, 4124, 794, 1848, 16390, 24541, 29898, 1311, 29889, 4262, 29892, 13, 462, 462, 462, 8783, 29918, 2311, 29922, 29946, 29900, 29929, 29953, 29892, 13, 462, 462, 462, 9853, 29918, 2311, 29922, 1311, 29889, 16175, 29918, 2311, 29897, 13, 13, 1678, 822, 2189, 29918, 5504, 29918, 10568, 29898, 1311, 29892, 330, 2735, 29892, 278, 941, 29892, 722, 29918, 13140, 10457, 29896, 29892, 871, 29918, 3416, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 2431, 9514, 263, 2989, 2767, 4331, 310, 278, 3983, 28221, 7408, 29889, 1334, 937, 4559, 263, 9853, 310, 18445, 29892, 13, 4706, 14707, 963, 373, 263, 1006, 794, 1848, 848, 9853, 29892, 322, 12678, 278, 4656, 10070, 363, 330, 2735, 322, 278, 941, 13, 4706, 2729, 373, 278, 1480, 29899, 5081, 22342, 29879, 29889, 29871, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 330, 2735, 584, 302, 29876, 29889, 9329, 13, 18884, 24953, 12489, 15783, 278, 330, 2735, 4128, 297, 12524, 3217, 29889, 13, 4706, 278, 941, 584, 302, 29876, 29889, 9329, 13, 18884, 24953, 12489, 15783, 278, 278, 941, 4128, 297, 12524, 3217, 29889, 13, 4706, 722, 29918, 13140, 584, 938, 13, 462, 29871, 28736, 373, 607, 881, 367, 26314, 287, 304, 4017, 278, 2767, 29889, 960, 5642, 338, 2183, 29892, 474, 29889, 29872, 1696, 29871, 13, 462, 29871, 263, 8178, 995, 29892, 278, 2286, 674, 367, 20459, 4629, 29889, 13, 4706, 871, 29918, 3416, 584, 6120, 13, 462, 268, 960, 5852, 29892, 330, 2735, 338, 14671, 2256, 322, 278, 4656, 10070, 526, 871, 15899, 363, 278, 941, 29889, 2823, 29871, 13, 462, 268, 22871, 861, 360, 29889, 29906, 297, 278, 5650, 363, 4902, 373, 278, 330, 2735, 3889, 19583, 7408, 29889, 13, 4706, 9995, 13, 4706, 396, 4250, 2408, 1480, 29899, 5081, 22342, 21875, 363, 20459, 4559, 29881, 3983, 12286, 13, 4706, 565, 451, 871, 29918, 3416, 29901, 13, 9651, 21271, 29918, 29879, 1160, 353, 1583, 29889, 657, 29918, 12513, 29918, 27736, 29898, 4283, 29892, 278, 941, 29892, 954, 29918, 16175, 267, 29922, 1311, 29889, 1949, 29918, 16175, 267, 29892, 954, 29918, 4262, 29879, 29922, 1311, 29889, 1949, 29918, 4262, 29879, 29892, 13, 462, 462, 3986, 9853, 29918, 2311, 29922, 1311, 29889, 16175, 29918, 2311, 29892, 722, 29918, 13140, 29922, 1707, 29918, 13140, 29892, 19571, 29918, 4262, 29879, 29922, 8824, 29897, 13, 4706, 1683, 29901, 13, 9651, 21271, 29918, 29879, 1160, 353, 1583, 29889, 657, 29918, 12513, 29918, 27736, 29898, 4283, 29892, 278, 941, 29892, 954, 29918, 16175, 267, 29922, 1311, 29889, 1949, 29918, 16175, 267, 29892, 954, 29918, 4262, 29879, 29922, 1311, 29889, 3416, 29918, 6194, 29918, 1949, 29918, 4262, 29879, 29892, 13, 462, 462, 3986, 9853, 29918, 2311, 29922, 1311, 29889, 16175, 29918, 2311, 29892, 722, 29918, 13140, 29922, 1707, 29918, 13140, 29892, 19571, 29918, 4262, 29879, 29922, 5574, 29897, 13, 4706, 12109, 29918, 2922, 11669, 29892, 1480, 29918, 5081, 22342, 29879, 29892, 722, 29918, 13140, 353, 21271, 29918, 29879, 1160, 13, 13, 4706, 396, 5953, 837, 457, 4656, 10070, 363, 330, 2735, 322, 278, 941, 13, 4706, 330, 2735, 29918, 5105, 29879, 29892, 278, 941, 29918, 5105, 29879, 29892, 278, 941, 29918, 13168, 353, 1583, 29889, 24970, 29918, 342, 326, 1061, 29898, 13, 9651, 12109, 29918, 2922, 11669, 29892, 1480, 29918, 5081, 22342, 29879, 29892, 330, 2735, 29892, 278, 941, 29892, 722, 29918, 13140, 29897, 13, 4706, 330, 2735, 29889, 5105, 353, 330, 2735, 29918, 5105, 29879, 13, 4706, 278, 941, 29889, 5105, 353, 278, 941, 29918, 5105, 29879, 13, 13, 4706, 736, 278, 941, 29918, 13168, 29892, 722, 29918, 13140, 13, 13, 1678, 732, 7345, 305, 29889, 1217, 29918, 5105, 580, 13, 1678, 822, 679, 29918, 12513, 29918, 27736, 29898, 1311, 29892, 330, 2735, 29892, 278, 941, 29892, 954, 29918, 16175, 267, 29892, 954, 29918, 4262, 29879, 29892, 9853, 29918, 2311, 29892, 13, 462, 539, 722, 29918, 13140, 10457, 29896, 29892, 19571, 29918, 4262, 29879, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 3685, 2701, 322, 6161, 1078, 263, 9853, 310, 3983, 12286, 373, 263, 9853, 310, 1006, 794, 1848, 848, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 330, 2735, 584, 302, 29876, 29889, 9329, 13, 18884, 24953, 12489, 15783, 278, 330, 2735, 4128, 297, 12524, 3217, 29889, 13, 4706, 278, 941, 584, 302, 29876, 29889, 9329, 13, 18884, 24953, 12489, 15783, 278, 278, 941, 4128, 297, 12524, 3217, 29889, 13, 4706, 954, 29918, 16175, 267, 584, 938, 13, 462, 418, 9681, 310, 9853, 267, 304, 671, 639, 21271, 4559, 29889, 13, 4706, 954, 29918, 4262, 29879, 584, 938, 29871, 13, 462, 268, 9681, 310, 3983, 12286, 304, 4559, 29889, 13, 4706, 9853, 29918, 2311, 584, 938, 13, 462, 268, 21179, 310, 1006, 794, 1848, 848, 9853, 267, 29889, 418, 13, 4706, 722, 29918, 13140, 584, 938, 13, 462, 29871, 28736, 373, 607, 881, 367, 26314, 287, 304, 4017, 278, 2767, 29889, 960, 5642, 338, 2183, 29892, 474, 29889, 29872, 1696, 29871, 13, 462, 29871, 263, 8178, 995, 29892, 278, 2286, 674, 367, 20459, 4629, 29889, 13, 4706, 19571, 29918, 4262, 29879, 584, 6120, 13, 462, 4706, 910, 2286, 881, 367, 1565, 565, 871, 278, 941, 338, 27545, 29889, 512, 445, 1206, 29892, 278, 937, 13, 462, 4706, 4203, 310, 278, 3983, 3829, 11916, 338, 13557, 304, 278, 1473, 4203, 29892, 5174, 393, 13, 462, 4706, 278, 1819, 310, 278, 714, 17696, 12770, 310, 278, 26314, 287, 2286, 526, 285, 492, 2986, 29889, 910, 13, 462, 4706, 6511, 363, 901, 8543, 29892, 4482, 29899, 1707, 8837, 16030, 4844, 4097, 29889, 2823, 4902, 297, 29871, 13, 462, 4706, 278, 5650, 29889, 13, 4706, 9995, 13, 4706, 565, 19571, 29918, 4262, 29879, 29901, 13, 9651, 4974, 954, 29918, 4262, 29879, 1273, 29871, 29906, 1275, 29871, 29900, 29892, 376, 4557, 310, 18445, 1818, 367, 8572, 1821, 491, 1023, 363, 19571, 292, 29908, 13, 4706, 4742, 353, 1583, 29889, 657, 29918, 10141, 580, 13, 13, 4706, 396, 21029, 848, 9853, 13, 4706, 565, 756, 5552, 29898, 1311, 29892, 376, 24713, 29908, 1125, 13, 9651, 396, 4721, 29899, 11249, 29881, 848, 13, 9651, 722, 29918, 13140, 353, 1583, 29889, 11249, 29918, 4622, 29918, 1707, 29918, 13140, 580, 13, 9651, 938, 29918, 11249, 353, 4842, 305, 29889, 4117, 4197, 1311, 29889, 24713, 29889, 657, 29918, 16175, 29898, 1707, 29918, 13140, 29897, 363, 903, 297, 3464, 29898, 1949, 29918, 16175, 267, 29897, 1402, 3964, 29922, 29900, 467, 517, 29898, 10141, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 960, 694, 8783, 4864, 29892, 848, 338, 15141, 4559, 29881, 515, 278, 3983, 13, 9651, 1006, 7316, 29918, 8977, 29892, 722, 29918, 13140, 353, 1583, 29889, 11249, 29918, 1639, 7316, 29898, 1311, 29889, 4262, 29892, 13, 462, 462, 462, 462, 29871, 8783, 29918, 2311, 29922, 1949, 29918, 16175, 267, 29930, 16175, 29918, 2311, 29892, 13, 462, 462, 462, 462, 29871, 722, 29918, 13140, 29922, 1707, 29918, 13140, 29897, 13, 9651, 938, 29918, 11249, 353, 1583, 29889, 4262, 29889, 11249, 29898, 1639, 794, 1080, 29922, 1639, 7316, 29918, 8977, 29892, 13, 462, 462, 965, 9853, 29918, 2311, 29922, 1949, 29918, 16175, 267, 29930, 16175, 29918, 2311, 29892, 13, 462, 462, 965, 408, 29918, 2378, 29922, 5574, 29897, 13, 9651, 938, 29918, 11249, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 524, 29918, 11249, 467, 5426, 2141, 517, 29898, 10141, 29897, 13, 13, 4706, 396, 26178, 1353, 310, 3983, 11916, 1274, 272, 893, 2999, 24372, 565, 451, 599, 508, 6216, 964, 3370, 13, 4706, 954, 29918, 4262, 29879, 29918, 1761, 353, 518, 1195, 29898, 1311, 29889, 3317, 29918, 4262, 29918, 1429, 292, 29892, 954, 29918, 4262, 29879, 29899, 29875, 29930, 1311, 29889, 3317, 29918, 4262, 29918, 1429, 292, 29897, 13, 462, 965, 363, 474, 297, 3464, 29898, 755, 29889, 27696, 29898, 1949, 29918, 4262, 29879, 334, 29871, 29896, 29889, 29900, 847, 1583, 29889, 3317, 29918, 4262, 29918, 1429, 292, 28166, 13, 4706, 954, 29918, 4262, 29879, 29918, 1761, 353, 17288, 1949, 29918, 4262, 29879, 29918, 1761, 29961, 29875, 1402, 2533, 29898, 1949, 29918, 4262, 29879, 29918, 1761, 7503, 29875, 12622, 363, 474, 297, 3464, 29898, 2435, 29898, 1949, 29918, 4262, 29879, 29918, 1761, 28166, 13, 4706, 396, 323, 575, 943, 4312, 363, 23460, 13, 4706, 7636, 29918, 22795, 353, 313, 7345, 305, 29889, 18816, 29885, 3398, 29898, 4283, 29897, 334, 4842, 305, 29889, 18816, 29885, 3398, 29898, 3416, 8106, 4801, 496, 580, 13, 4706, 7636, 29918, 22795, 29918, 16175, 353, 7636, 29918, 22795, 29961, 8516, 1822, 18837, 29898, 1949, 29918, 4262, 29879, 29892, 448, 29896, 29892, 448, 29896, 29897, 13, 13, 4706, 396, 25665, 740, 363, 23460, 263, 9853, 310, 4036, 12109, 562, 3819, 13516, 515, 1857, 17750, 2070, 11614, 13, 4706, 822, 4559, 29918, 26859, 29918, 5344, 7295, 13, 9651, 4559, 29918, 5344, 353, 4842, 305, 29889, 5892, 5059, 492, 29898, 12864, 29918, 22795, 29918, 16175, 29897, 13, 9651, 4559, 29918, 5344, 353, 4559, 29918, 5344, 334, 313, 29896, 448, 4842, 305, 29889, 1032, 29872, 29898, 11249, 29918, 5344, 29889, 12181, 14352, 29896, 1402, 4742, 29922, 11249, 29918, 5344, 29889, 10141, 9601, 8516, 2314, 13, 9651, 565, 19571, 29918, 4262, 29879, 29901, 29871, 396, 3824, 322, 1473, 4203, 310, 25187, 943, 526, 13557, 29892, 5174, 278, 26314, 287, 2286, 13, 18884, 4559, 29918, 5344, 29961, 1949, 29918, 4262, 29879, 458, 29906, 17531, 353, 4559, 29918, 5344, 7503, 1949, 29918, 4262, 29879, 458, 29906, 29962, 13, 18884, 4559, 29918, 5344, 29961, 1949, 29918, 4262, 29879, 458, 29906, 29901, 29892, 722, 29918, 13140, 29962, 353, 29871, 29896, 448, 4559, 29918, 5344, 29961, 1949, 29918, 4262, 29879, 458, 29906, 29901, 29892, 722, 29918, 13140, 29962, 13, 18884, 4559, 29918, 5344, 7503, 29892, 722, 29918, 13140, 29892, 722, 29918, 13140, 29962, 353, 29871, 29900, 29889, 13, 9651, 736, 4559, 29918, 5344, 13, 13, 4706, 396, 382, 4387, 403, 1480, 29899, 5081, 22342, 29879, 1090, 4559, 29881, 12109, 562, 3819, 4636, 322, 848, 13, 4706, 12109, 29918, 2922, 11669, 353, 5159, 13, 4706, 1480, 29918, 5081, 22342, 29879, 353, 5159, 13, 4706, 363, 302, 29918, 13140, 297, 3464, 29898, 1949, 29918, 16175, 267, 1125, 13, 9651, 9853, 353, 938, 29918, 11249, 29961, 29876, 29918, 13140, 29930, 16175, 29918, 2311, 5919, 29876, 29918, 13140, 29974, 29896, 11877, 16175, 29918, 2311, 29962, 13, 9651, 565, 302, 29918, 13140, 1275, 29871, 29900, 29901, 13, 18884, 12109, 29918, 5344, 353, 4559, 29918, 26859, 29918, 5344, 580, 13, 18884, 12109, 29918, 2922, 11669, 29889, 4397, 29898, 26859, 29918, 5344, 29897, 13, 13, 9651, 363, 274, 29918, 13140, 29892, 313, 4262, 29918, 2798, 29892, 1369, 29918, 13140, 29897, 297, 26985, 29898, 1949, 29918, 4262, 29879, 29918, 1761, 1125, 13, 18884, 12109, 29918, 5344, 29918, 18837, 287, 353, 12109, 29918, 5344, 29961, 2962, 29918, 13140, 29901, 2962, 29918, 13140, 29974, 4262, 29918, 2798, 29892, 13, 462, 462, 462, 6213, 1822, 18837, 6278, 29896, 29892, 9853, 29918, 2311, 29892, 448, 29896, 29892, 448, 29896, 467, 1579, 8606, 29898, 29900, 29892, 29871, 29896, 29897, 13, 18884, 9853, 29918, 4548, 353, 9853, 29961, 8516, 29892, 584, 1822, 18837, 29898, 4262, 29918, 2798, 29892, 448, 29896, 29892, 448, 29896, 467, 1579, 8606, 29898, 29900, 29892, 29871, 29896, 29897, 13, 18884, 302, 645, 353, 1583, 29889, 24219, 403, 29918, 5081, 22342, 29879, 29898, 16175, 29918, 4548, 29892, 12109, 29918, 5344, 29918, 18837, 287, 29892, 722, 29918, 13140, 29897, 13, 18884, 302, 645, 353, 302, 645, 29889, 690, 14443, 29898, 4262, 29918, 2798, 29892, 9853, 29918, 2311, 29892, 448, 29896, 29897, 13, 13, 18884, 565, 302, 29918, 13140, 1275, 29871, 29900, 29901, 13, 462, 1678, 1480, 29918, 5081, 22342, 29879, 29889, 4397, 29898, 29876, 645, 29889, 12676, 29898, 6229, 29922, 29896, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 1480, 29918, 5081, 22342, 29879, 29961, 29883, 29918, 13140, 29962, 4619, 302, 645, 29889, 12676, 29898, 6229, 29922, 29896, 29897, 13, 13, 4706, 396, 422, 26062, 599, 848, 13, 4706, 12109, 29918, 2922, 11669, 353, 4842, 305, 29889, 4117, 29898, 26859, 29918, 2922, 11669, 29892, 3964, 29922, 29900, 29897, 13, 4706, 1480, 29918, 5081, 22342, 29879, 353, 4842, 305, 29889, 4117, 29898, 1188, 29918, 5081, 22342, 29879, 29892, 3964, 29922, 29900, 29897, 847, 954, 29918, 16175, 267, 13, 13, 4706, 736, 12109, 29918, 2922, 11669, 29892, 1480, 29918, 5081, 22342, 29879, 29892, 722, 29918, 13140, 13, 13, 1678, 732, 7345, 305, 29889, 1217, 29918, 5105, 580, 13, 1678, 822, 16030, 29918, 342, 326, 1061, 29898, 1311, 29892, 12109, 29918, 2922, 11669, 29892, 1480, 29918, 5081, 22342, 29879, 29892, 330, 2735, 29892, 278, 941, 29892, 722, 29918, 13140, 1125, 13, 4706, 9995, 13, 4706, 16969, 278, 15899, 4656, 10070, 363, 330, 2735, 322, 278, 941, 29889, 739, 3913, 278, 4482, 29899, 1707, 8837, 16030, 4844, 4097, 13, 4706, 7972, 297, 9779, 29871, 29941, 29889, 29941, 310, 278, 5650, 29889, 29871, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 12109, 29918, 2922, 11669, 584, 4842, 305, 29889, 11031, 29911, 6073, 29892, 8267, 518, 16175, 29918, 2311, 29892, 954, 29918, 16908, 29892, 954, 29918, 16908, 29962, 13, 462, 539, 450, 12109, 562, 3819, 13516, 373, 607, 278, 1006, 794, 1848, 848, 756, 1063, 19030, 373, 29889, 13, 4706, 1480, 29918, 5081, 22342, 29879, 584, 4842, 305, 29889, 11031, 29911, 6073, 29892, 8267, 518, 16175, 29918, 2311, 29892, 954, 29918, 16908, 29962, 13, 462, 3986, 450, 6588, 1480, 29899, 5081, 22342, 1090, 278, 12109, 562, 3819, 13516, 363, 599, 3651, 13, 462, 3986, 297, 278, 3983, 29889, 13, 4706, 330, 2735, 584, 302, 29876, 29889, 9329, 13, 18884, 24953, 12489, 15783, 278, 330, 2735, 4128, 297, 12524, 3217, 29889, 13, 4706, 278, 941, 584, 302, 29876, 29889, 9329, 13, 18884, 24953, 12489, 15783, 278, 278, 941, 4128, 297, 12524, 3217, 29889, 13, 4706, 722, 29918, 13140, 584, 938, 13, 462, 29871, 28736, 373, 607, 278, 1006, 7316, 471, 8560, 29889, 29871, 13, 4706, 9995, 13, 4706, 9853, 29918, 2311, 353, 12109, 29918, 2922, 11669, 29889, 12181, 29961, 29900, 29962, 13, 4706, 1480, 29918, 5081, 22342, 29879, 353, 1480, 29918, 5081, 22342, 29879, 29889, 6948, 802, 29872, 911, 29898, 6229, 29922, 29896, 29897, 13, 13, 4706, 7769, 29918, 771, 5824, 353, 4842, 305, 29889, 18816, 29885, 3398, 29898, 3416, 29897, 13, 4706, 7636, 29918, 771, 5824, 353, 4842, 305, 29889, 18816, 29885, 3398, 29898, 4283, 29897, 13, 13, 4706, 396, 19295, 993, 13944, 13, 4706, 954, 29918, 1066, 353, 12109, 29918, 2922, 11669, 29889, 2083, 29898, 6229, 29922, 29900, 29897, 13, 4706, 954, 29918, 10052, 353, 9853, 29918, 2311, 448, 954, 29918, 1066, 13, 4706, 11105, 353, 5135, 1949, 29918, 1066, 1405, 29871, 29900, 29897, 334, 313, 1949, 29918, 10052, 1405, 29871, 29900, 8106, 7411, 580, 13, 4706, 926, 29918, 5105, 29879, 353, 313, 1188, 29918, 5081, 22342, 29879, 334, 12109, 29918, 2922, 11669, 467, 2083, 29898, 6229, 29922, 29900, 29897, 847, 954, 29918, 1066, 29889, 695, 1160, 23538, 1195, 29922, 29896, 29872, 29899, 29945, 29897, 13, 4706, 3480, 29918, 5105, 29879, 353, 313, 1188, 29918, 5081, 22342, 29879, 334, 313, 29896, 448, 12109, 29918, 2922, 11669, 8106, 2083, 29898, 6229, 29922, 29900, 29897, 847, 954, 29918, 10052, 29889, 695, 1160, 23538, 1195, 29922, 29896, 29872, 29899, 29945, 29897, 13, 4706, 330, 2735, 29918, 5105, 29879, 353, 11105, 334, 7636, 29918, 771, 5824, 334, 313, 29896, 448, 7636, 29918, 771, 5824, 29897, 334, 7769, 29918, 771, 5824, 334, 313, 1066, 29918, 5105, 29879, 448, 3480, 29918, 5105, 29879, 718, 1583, 29889, 2892, 29918, 29879, 5510, 29897, 13, 4706, 278, 941, 29918, 5105, 29879, 353, 11105, 334, 7769, 29918, 771, 5824, 334, 313, 29896, 448, 7769, 29918, 771, 5824, 29897, 334, 7636, 29918, 771, 5824, 334, 313, 1066, 29918, 5105, 29879, 448, 3480, 29918, 5105, 29879, 29897, 13, 13, 4706, 396, 341, 1278, 292, 330, 2735, 363, 23235, 12770, 304, 26314, 287, 2286, 13, 4706, 330, 2735, 29918, 5105, 29879, 7503, 29892, 722, 29918, 13140, 29962, 353, 29871, 29900, 29889, 13, 4706, 330, 2735, 29918, 5105, 29879, 29961, 7345, 305, 29889, 279, 927, 29898, 4283, 29918, 5105, 29879, 29889, 12181, 29961, 29900, 11724, 4842, 305, 29889, 279, 927, 29898, 4283, 29918, 5105, 29879, 29889, 12181, 29961, 29896, 2314, 29962, 353, 29871, 29900, 29889, 13, 13, 4706, 396, 341, 1278, 292, 599, 278, 941, 29915, 29879, 5174, 278, 6743, 411, 263, 26314, 287, 2286, 13, 4706, 278, 941, 29918, 5105, 29879, 7503, 1707, 29918, 13140, 29962, 353, 29871, 29900, 29889, 13, 4706, 278, 941, 29918, 5105, 29879, 29961, 1707, 29918, 13140, 29974, 29896, 17531, 353, 29871, 29900, 29889, 13, 4706, 278, 941, 29918, 5105, 29879, 22361, 278, 941, 29918, 5105, 29879, 29889, 3286, 4220, 29898, 29900, 29892, 29871, 29896, 29897, 29871, 396, 278, 941, 29918, 823, 353, 448, 3416, 29918, 2397, 13, 13, 4706, 396, 26221, 263, 11105, 607, 278, 941, 29915, 29879, 526, 2869, 4784, 363, 278, 5994, 3950, 13, 4706, 278, 941, 29918, 13168, 353, 4842, 305, 29889, 3298, 359, 29918, 4561, 29898, 3416, 29918, 5105, 29879, 29897, 13, 4706, 278, 941, 29918, 13168, 29961, 1707, 29918, 13140, 29962, 353, 29871, 29896, 29889, 13, 4706, 278, 941, 29918, 13168, 7503, 29892, 722, 29918, 13140, 29962, 353, 29871, 29896, 29889, 13, 4706, 278, 941, 29918, 13168, 29961, 1707, 29918, 13140, 29892, 722, 29918, 13140, 29962, 353, 29871, 29900, 29889, 13, 13, 4706, 736, 330, 2735, 29918, 5105, 29879, 29892, 278, 941, 29918, 5105, 29879, 29892, 278, 941, 29918, 13168, 13, 13, 1678, 822, 4559, 29918, 4622, 29918, 1707, 29918, 13140, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 16969, 2446, 2286, 304, 26314, 29872, 373, 29889, 1334, 13649, 1549, 278, 3651, 13, 4706, 297, 263, 528, 3096, 839, 1797, 29892, 763, 263, 3918, 8783, 29889, 13, 4706, 9995, 13, 4706, 565, 7431, 29898, 1311, 29889, 1639, 29918, 16908, 29897, 1275, 29871, 29900, 29901, 29871, 396, 960, 385, 21502, 305, 7743, 29892, 620, 29882, 21897, 3651, 13, 9651, 1583, 29889, 1639, 29918, 16908, 353, 518, 29875, 363, 474, 297, 3464, 29898, 2435, 29898, 1311, 29889, 4262, 29889, 20897, 28166, 13, 9651, 4036, 29889, 845, 21897, 29898, 1311, 29889, 1639, 29918, 16908, 29897, 13, 4706, 722, 29918, 13140, 353, 1583, 29889, 1639, 29918, 16908, 29889, 7323, 580, 13, 4706, 736, 722, 29918, 13140, 13, 13, 1678, 822, 4559, 29918, 1639, 7316, 29898, 1311, 29892, 3983, 29892, 8783, 29918, 2311, 29892, 722, 29918, 13140, 10457, 29896, 1125, 13, 4706, 9995, 13, 4706, 16969, 263, 716, 848, 9853, 363, 385, 26314, 287, 2286, 29889, 13, 4706, 9995, 13, 4706, 396, 7605, 2286, 304, 26314, 29872, 373, 13, 4706, 565, 722, 29918, 13140, 529, 29871, 29900, 29901, 13, 9651, 722, 29918, 13140, 353, 1583, 29889, 11249, 29918, 4622, 29918, 1707, 29918, 13140, 580, 13, 4706, 722, 353, 3983, 29889, 20897, 29961, 1707, 29918, 13140, 29962, 13, 4706, 396, 1105, 615, 29892, 4922, 1006, 7316, 1149, 5191, 282, 29898, 29990, 29918, 29876, 29897, 491, 4036, 11608, 936, 13, 4706, 396, 2522, 744, 338, 731, 304, 29871, 29900, 29889, 29900, 29892, 607, 11524, 263, 9090, 4978, 29889, 13, 4706, 938, 29918, 5721, 353, 903, 8172, 29918, 29883, 1845, 29898, 2311, 7607, 1707, 29889, 22795, 29918, 5721, 29889, 1949, 29918, 29883, 1845, 29879, 29892, 511, 6287, 29922, 29900, 29889, 29900, 29892, 9685, 10457, 29896, 29897, 13, 4706, 396, 21029, 515, 1006, 794, 1848, 4978, 13, 4706, 995, 353, 7442, 29889, 8172, 29889, 4713, 262, 7615, 29898, 29876, 29922, 29896, 29892, 282, 791, 29879, 29922, 524, 29918, 5721, 29892, 2159, 7607, 24713, 29918, 2311, 29892, 876, 13, 4706, 995, 353, 7442, 29889, 1191, 3317, 29898, 1767, 29892, 9685, 10457, 29896, 29897, 29871, 396, 3118, 29899, 8711, 304, 2380, 13, 4706, 1006, 7316, 29918, 8977, 353, 426, 1707, 29889, 978, 29901, 995, 29913, 13, 13, 4706, 736, 1006, 7316, 29918, 8977, 29892, 722, 29918, 13140, 13, 13, 1678, 732, 7345, 305, 29889, 1217, 29918, 5105, 580, 13, 1678, 822, 14707, 29918, 5081, 22342, 29879, 29898, 1311, 29892, 938, 29918, 11249, 29892, 12109, 29918, 5344, 29892, 722, 29918, 13140, 1125, 13, 4706, 9995, 13, 4706, 382, 4387, 1078, 278, 8178, 1480, 29899, 5081, 22342, 310, 278, 1006, 794, 1848, 848, 9853, 313, 524, 29918, 11249, 29897, 13, 4706, 373, 278, 2183, 3983, 12286, 313, 26859, 29918, 5344, 29897, 322, 278, 26314, 287, 2286, 313, 1707, 29918, 13140, 467, 13, 4706, 9995, 13, 4706, 1583, 29889, 4299, 29889, 14513, 580, 13, 4706, 4742, 353, 1583, 29889, 657, 29918, 10141, 580, 13, 4706, 938, 29918, 11249, 353, 938, 29918, 11249, 29889, 517, 29898, 10141, 29897, 13, 4706, 12109, 29918, 5344, 353, 12109, 29918, 5344, 29889, 517, 29898, 10141, 29897, 13, 4706, 396, 4103, 4220, 363, 11105, 1363, 12109, 29961, 29875, 29892, 29926, 29962, 2794, 393, 474, 976, 29926, 13, 4706, 11105, 29918, 26859, 29918, 5344, 353, 12109, 29918, 5344, 29889, 3286, 4220, 29898, 29896, 29892, 29871, 29906, 29897, 13, 4706, 4450, 29879, 353, 1583, 29889, 4299, 29898, 524, 29918, 11249, 29892, 11105, 29922, 13168, 29918, 26859, 29918, 5344, 29897, 13, 13, 4706, 396, 382, 4387, 403, 8178, 1480, 29899, 5081, 22342, 310, 27303, 13, 4706, 4450, 29879, 353, 4450, 29879, 29889, 1579, 8606, 29898, 29900, 29892, 29871, 29896, 29897, 13, 4706, 11073, 353, 938, 29918, 11249, 29889, 16513, 580, 13, 4706, 11073, 7503, 29892, 722, 29918, 13140, 29962, 353, 448, 29896, 29871, 396, 2431, 3647, 1006, 794, 1080, 1149, 694, 27303, 310, 278, 26314, 287, 2286, 13, 4706, 11073, 353, 11073, 29889, 690, 14443, 6278, 29896, 29897, 13, 4706, 302, 645, 353, 383, 29889, 19128, 29918, 296, 14441, 29898, 11965, 29879, 29892, 11073, 29892, 20376, 2433, 9290, 742, 11455, 29918, 2248, 10457, 29896, 29897, 13, 4706, 302, 645, 353, 302, 645, 29889, 690, 14443, 10456, 524, 29918, 11249, 29889, 12181, 29897, 13, 4706, 1583, 29889, 4299, 29889, 14968, 580, 13, 13, 4706, 736, 302, 645, 13, 13, 1678, 822, 679, 29918, 10141, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4299, 29889, 10141, 13, 2 ]
modeling/player/load.py
cpratim/Fantasy-Predictions
0
62804
<gh_stars>0 import numpy as np from helpers import * from config import * def load_xy(player): player = '_'.join([l.lower() for l in player.split(' ')]) X, y = [], [] stats_record = load_json(f'{player_dir}/{player}.json') for season, stats in stats_record.items(): X.append(int(season[-2:])) y.append(list(stats.values())) return np.array(X), np.array(y).T
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12655, 408, 7442, 13, 3166, 1371, 414, 1053, 334, 13, 3166, 2295, 1053, 334, 13, 13, 13, 1753, 2254, 29918, 3594, 29898, 9106, 1125, 13, 13, 1678, 4847, 353, 22868, 4286, 7122, 4197, 29880, 29889, 13609, 580, 363, 301, 297, 4847, 29889, 5451, 877, 25710, 2314, 13, 13, 1678, 1060, 29892, 343, 353, 19997, 5159, 13, 1678, 13, 1678, 22663, 29918, 11651, 353, 2254, 29918, 3126, 29898, 29888, 29915, 29912, 9106, 29918, 3972, 6822, 29912, 9106, 1836, 3126, 1495, 13, 1678, 363, 4259, 29892, 22663, 297, 22663, 29918, 11651, 29889, 7076, 7295, 13, 13, 4706, 1060, 29889, 4397, 29898, 524, 29898, 25682, 14352, 29906, 29901, 12622, 13, 4706, 343, 29889, 4397, 29898, 1761, 29898, 16202, 29889, 5975, 22130, 13, 13, 1678, 736, 7442, 29889, 2378, 29898, 29990, 511, 7442, 29889, 2378, 29898, 29891, 467, 29911, 13, 2 ]
Docker image/pdx-analysis-workflows/JAX_RNA/picard_alignment/picard_alignment_metrics.py
BorisYourich/EurOPDX-Galaxy
0
86632
#! /usr/bin/env python """ Picard Alignment Metrics. Version: 0.1.1 """ from __future__ import print_function import argparse import os import shutil import sys def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('files', nargs='+', help="The file[s] to use.") return parser.parse_args() def main(): args = parse_args() sample_name = sys.argv[4] RGID = "4" RGPL = "illumina" RGPU = "unit1" RGSM = "20" picard_stat_file = sample_name + "_picard_stat" interim_results_dir = '/mnt/volume/shared/reference-data/' # Check whether interim results directory exists or not. If not create it. if not os.path.exists(interim_results_dir): os.mkdir(interim_results_dir) # Remove existing files to avoid files exist exception. if os.path.exists(interim_results_dir + picard_stat_file): os.remove(interim_results_dir + picard_stat_file) # Adding readgroup information input_bam = args.files[0] try: os.system("picard AddOrReplaceReadGroups \ INPUT=" + input_bam + " \ OUTPUT=genome_bam_read_group.bam \ SORT_ORDER=coordinate \ RGID=" + RGID + " \ RGLB=" + sample_name + " \ RGPL=" + RGPL + " \ RGPU=" + RGPU + " \ RGSM=" + RGSM + " \ CREATE_INDEX=true" ) except Exception as e: print('Error executing picard AddOrReplaceReadGroups -> %s' % e) sys.exit(1) # Create dictionary for the reference file # SEQUENCE_DICTIONARY = os.path.splitext(args.files[3])[0] + ".dict" try: SEQUENCE_DICTIONARY = args.files[2] + ".dict" if not os.path.exists(SEQUENCE_DICTIONARY): symlink_to_fa = args.files[2] + ".fa" command = "ln -fs " + args.files[2] + " " + symlink_to_fa os.system(command) print("Command: " + command) os.system("picard CreateSequenceDictionary REFERENCE=" + symlink_to_fa) except Exception as e: print('Error executing picard CreateSequenceDictionary -> %s' % e) sys.exit(1) # Picard Reorder Bam file try: os.system("picard ReorderSam \ INPUT=genome_bam_read_group.bam \ OUTPUT=genome_bam_read_group_reorder.bam \ SEQUENCE_DICTIONARY=" + SEQUENCE_DICTIONARY + " \ ALLOW_INCOMPLETE_DICT_CONCORDANCE=true \ CREATE_INDEX=true" ) except Exception as e: print('Error executing picard ReorderSam -> %s' % e) sys.exit(1) # Picard SortSam (generating sorted alignment bam file) try: os.system("picard SortSam \ SORT_ORDER=coordinate \ INPUT=genome_bam_read_group_reorder.bam \ OUTPUT=genome_bam_read_group_reorder_sorted.bam \ VALIDATION_STRINGENCY=SILENT \ CREATE_INDEX=true" ) except Exception as e: print('Error executing picard SortSam -> %s' % e) sys.exit(1) # CollectRnaSeqMetrics try: os.system("picard CollectRnaSeqMetrics \ INPUT=genome_bam_read_group_reorder_sorted.bam \ OUTPUT=" + picard_stat_file + " \ REF_FLAT=" + args.files[1] + " \ STRAND=NONE \ VALIDATION_STRINGENCY=SILENT \ CHART_OUTPUT=File" ) except Exception as e: print('Error executing picard CollectRnaSeqMetrics -> %s' % e) sys.exit(1) #shutil.move(picard_stat_file, interim_results_dir) # Summary metrics compilation # try: # os.system( # "perl ../../../../../tools/pdx-analysis-workflows/RNA_PDX/summary_QC_metrics.pl " + interim_results_dir + quality_stat_file + " " + interim_results_dir + xenome_stat_file + " " + interim_results_dir + rsem_stat_file + " " + interim_results_dir + picard_stat_file + " > " + interim_results_dir + summary_stat_file) # shutil.copy(interim_results_dir + summary_stat_file, os.getcwd()) # except Exception as e: # print('Error executing summary_QC_metrics.pl -> %s' % e) # sys.exit(1) if __name__ == '__main__': main()
[ 1, 396, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 29925, 293, 538, 838, 10194, 4737, 10817, 29889, 13, 6594, 29901, 29871, 29900, 29889, 29896, 29889, 29896, 13, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 5215, 528, 4422, 13, 5215, 10876, 13, 13, 13, 1753, 6088, 29918, 5085, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 5325, 742, 302, 5085, 2433, 29974, 742, 13, 462, 4706, 1371, 543, 1576, 934, 29961, 29879, 29962, 304, 671, 23157, 13, 13, 1678, 736, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 6389, 353, 6088, 29918, 5085, 580, 13, 13, 1678, 4559, 29918, 978, 353, 10876, 29889, 19218, 29961, 29946, 29962, 13, 1678, 390, 29954, 1367, 353, 376, 29946, 29908, 13, 1678, 390, 29954, 7390, 353, 376, 453, 398, 1099, 29908, 13, 1678, 390, 29954, 7056, 353, 376, 5441, 29896, 29908, 13, 1678, 390, 10749, 29924, 353, 376, 29906, 29900, 29908, 13, 1678, 11942, 538, 29918, 6112, 29918, 1445, 353, 4559, 29918, 978, 718, 11119, 16447, 538, 29918, 6112, 29908, 13, 1678, 1006, 326, 29918, 9902, 29918, 3972, 353, 8207, 29885, 593, 29914, 24623, 29914, 12366, 29914, 5679, 29899, 1272, 22208, 13, 13, 1678, 396, 5399, 3692, 1006, 326, 2582, 3884, 4864, 470, 451, 29889, 960, 451, 1653, 372, 29889, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1639, 326, 29918, 9902, 29918, 3972, 1125, 13, 4706, 2897, 29889, 11256, 3972, 29898, 1639, 326, 29918, 9902, 29918, 3972, 29897, 13, 13, 1678, 396, 15154, 5923, 2066, 304, 4772, 2066, 1863, 3682, 29889, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 29898, 1639, 326, 29918, 9902, 29918, 3972, 718, 11942, 538, 29918, 6112, 29918, 1445, 1125, 13, 4706, 2897, 29889, 5992, 29898, 1639, 326, 29918, 9902, 29918, 3972, 718, 11942, 538, 29918, 6112, 29918, 1445, 29897, 13, 13, 1678, 396, 18804, 1303, 2972, 2472, 13, 1678, 1881, 29918, 29890, 314, 353, 6389, 29889, 5325, 29961, 29900, 29962, 13, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 5205, 703, 16447, 538, 3462, 2816, 20083, 6359, 24020, 320, 13, 9651, 2672, 12336, 543, 718, 1881, 29918, 29890, 314, 718, 376, 320, 13, 9651, 19474, 12336, 29922, 1885, 608, 29918, 29890, 314, 29918, 949, 29918, 2972, 29889, 29890, 314, 320, 13, 9651, 317, 8476, 29918, 22364, 29922, 29302, 320, 13, 9651, 390, 29954, 1367, 543, 718, 390, 29954, 1367, 718, 376, 320, 13, 9651, 390, 7239, 29933, 543, 718, 4559, 29918, 978, 718, 376, 320, 13, 9651, 390, 29954, 7390, 543, 718, 390, 29954, 7390, 718, 376, 320, 13, 9651, 390, 29954, 7056, 543, 718, 390, 29954, 7056, 718, 376, 320, 13, 9651, 390, 10749, 29924, 543, 718, 390, 10749, 29924, 718, 376, 320, 13, 9651, 14602, 29918, 27992, 29922, 3009, 29908, 13, 462, 29871, 1723, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 877, 2392, 14012, 29871, 11942, 538, 3462, 2816, 20083, 6359, 24020, 1599, 1273, 29879, 29915, 1273, 321, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 396, 6204, 8600, 363, 278, 3407, 934, 13, 1678, 396, 3725, 13356, 1430, 4741, 29918, 4571, 9838, 19926, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 5085, 29889, 5325, 29961, 29941, 2314, 29961, 29900, 29962, 718, 11393, 8977, 29908, 13, 1678, 1018, 29901, 13, 4706, 3725, 13356, 1430, 4741, 29918, 4571, 9838, 19926, 353, 6389, 29889, 5325, 29961, 29906, 29962, 718, 11393, 8977, 29908, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1660, 13356, 1430, 4741, 29918, 4571, 9838, 19926, 1125, 13, 9651, 9878, 828, 682, 29918, 517, 29918, 5444, 353, 6389, 29889, 5325, 29961, 29906, 29962, 718, 11393, 5444, 29908, 13, 9651, 1899, 353, 376, 3083, 448, 5847, 376, 718, 6389, 29889, 5325, 29961, 29906, 29962, 718, 376, 376, 718, 9878, 828, 682, 29918, 517, 29918, 5444, 13, 9651, 2897, 29889, 5205, 29898, 6519, 29897, 13, 9651, 1596, 703, 6255, 29901, 376, 718, 1899, 29897, 13, 9651, 2897, 29889, 5205, 703, 16447, 538, 6204, 20529, 11513, 5195, 29943, 1001, 1430, 4741, 543, 718, 9878, 828, 682, 29918, 517, 29918, 5444, 29897, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 877, 2392, 14012, 29871, 11942, 538, 6204, 20529, 11513, 1599, 1273, 29879, 29915, 1273, 321, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 396, 14612, 538, 830, 2098, 350, 314, 934, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 5205, 703, 16447, 538, 830, 2098, 22966, 320, 13, 9651, 2672, 12336, 29922, 1885, 608, 29918, 29890, 314, 29918, 949, 29918, 2972, 29889, 29890, 314, 320, 13, 9651, 19474, 12336, 29922, 1885, 608, 29918, 29890, 314, 29918, 949, 29918, 2972, 29918, 276, 2098, 29889, 29890, 314, 320, 13, 9651, 3725, 13356, 1430, 4741, 29918, 4571, 9838, 19926, 543, 718, 3725, 13356, 1430, 4741, 29918, 4571, 9838, 19926, 718, 376, 320, 13, 9651, 15149, 9806, 29918, 1177, 21514, 18476, 29918, 4571, 1783, 29918, 6007, 29907, 25593, 23219, 29922, 3009, 320, 13, 9651, 14602, 29918, 27992, 29922, 3009, 29908, 13, 462, 29871, 1723, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 877, 2392, 14012, 29871, 11942, 538, 830, 2098, 22966, 1599, 1273, 29879, 29915, 1273, 321, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 396, 14612, 538, 20025, 22966, 313, 4738, 1218, 12705, 22239, 289, 314, 934, 29897, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 5205, 703, 16447, 538, 20025, 22966, 320, 13, 9651, 317, 8476, 29918, 22364, 29922, 29302, 320, 13, 9651, 2672, 12336, 29922, 1885, 608, 29918, 29890, 314, 29918, 949, 29918, 2972, 29918, 276, 2098, 29889, 29890, 314, 320, 13, 9651, 19474, 12336, 29922, 1885, 608, 29918, 29890, 314, 29918, 949, 29918, 2972, 29918, 276, 2098, 29918, 24582, 29889, 29890, 314, 320, 13, 9651, 12599, 1367, 8098, 29918, 20785, 1430, 29907, 29979, 29922, 5425, 1307, 20321, 320, 13, 9651, 14602, 29918, 27992, 29922, 3009, 29908, 13, 462, 29871, 1723, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 877, 2392, 14012, 29871, 11942, 538, 20025, 22966, 1599, 1273, 29879, 29915, 1273, 321, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 396, 24930, 29934, 1056, 23718, 10095, 10817, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 5205, 703, 16447, 538, 24930, 29934, 1056, 23718, 10095, 10817, 320, 13, 9651, 2672, 12336, 29922, 1885, 608, 29918, 29890, 314, 29918, 949, 29918, 2972, 29918, 276, 2098, 29918, 24582, 29889, 29890, 314, 320, 13, 9651, 19474, 12336, 543, 718, 11942, 538, 29918, 6112, 29918, 1445, 718, 376, 320, 13, 9651, 5195, 29943, 29918, 10536, 1299, 543, 718, 6389, 29889, 5325, 29961, 29896, 29962, 718, 376, 320, 13, 9651, 29486, 9468, 29922, 29940, 12413, 320, 13, 9651, 12599, 1367, 8098, 29918, 20785, 1430, 29907, 29979, 29922, 5425, 1307, 20321, 320, 13, 9651, 5868, 8322, 29918, 12015, 12336, 29922, 2283, 29908, 13, 462, 29871, 1723, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 877, 2392, 14012, 29871, 11942, 538, 24930, 29934, 1056, 23718, 10095, 10817, 1599, 1273, 29879, 29915, 1273, 321, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 396, 845, 4422, 29889, 11631, 29898, 16447, 538, 29918, 6112, 29918, 1445, 29892, 1006, 326, 29918, 9902, 29918, 3972, 29897, 13, 13, 1678, 396, 6991, 5219, 21556, 14835, 13, 1678, 396, 1018, 29901, 13, 1678, 396, 268, 2897, 29889, 5205, 29898, 13, 1678, 396, 308, 376, 22032, 29772, 21546, 21546, 8504, 29914, 29886, 8235, 29899, 15916, 29899, 1287, 1731, 29879, 29914, 29934, 3521, 29918, 25014, 29990, 29914, 7727, 29918, 29984, 29907, 29918, 2527, 10817, 29889, 572, 376, 718, 1006, 326, 29918, 9902, 29918, 3972, 718, 11029, 29918, 6112, 29918, 1445, 718, 376, 376, 718, 1006, 326, 29918, 9902, 29918, 3972, 718, 921, 264, 608, 29918, 6112, 29918, 1445, 718, 376, 376, 718, 1006, 326, 29918, 9902, 29918, 3972, 718, 364, 12846, 29918, 6112, 29918, 1445, 718, 376, 376, 718, 1006, 326, 29918, 9902, 29918, 3972, 718, 11942, 538, 29918, 6112, 29918, 1445, 718, 376, 1405, 376, 718, 1006, 326, 29918, 9902, 29918, 3972, 718, 15837, 29918, 6112, 29918, 1445, 29897, 13, 1678, 396, 268, 528, 4422, 29889, 8552, 29898, 1639, 326, 29918, 9902, 29918, 3972, 718, 15837, 29918, 6112, 29918, 1445, 29892, 2897, 29889, 657, 29883, 9970, 3101, 13, 1678, 396, 5174, 8960, 408, 321, 29901, 13, 1678, 396, 268, 1596, 877, 2392, 14012, 15837, 29918, 29984, 29907, 29918, 2527, 10817, 29889, 572, 1599, 1273, 29879, 29915, 1273, 321, 29897, 13, 1678, 396, 268, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
tests/color_threshold.py
hunterjsb/CalculateArea
0
154545
import numpy as np from calculatearea import AreaEstimator from math import sqrt area_estimator = AreaEstimator(filename='rancho_rd.jpg', # name of the image in the directory color_range=((0, 0, 118), (100, 100, 255)), default_area_color=(255, 20, 160)) # BGR purple A_px = area_estimator.get_area(return_pixels=True) ft_per_pixel = sqrt(131193.8 / A_px) # plot size - 30.56 acres, img size - 447x588 px print(ft_per_pixel) # area_estimator.show_images() # with tighter restraints area_estimator.color_lower_limit = np.array([0, 0, 130], np.uint8) area_estimator.color_upper_limit = np.array([50, 50, 255], np.uint8) area_estimator.area_color = (100, 200, 200) A_px = area_estimator.get_area() area_estimator.show_images() # guess feet per pixel ft_per_pixel = sqrt(131193.8 / A_px) print(ft_per_pixel)
[ 1, 1053, 12655, 408, 7442, 13, 13, 3166, 8147, 6203, 1053, 18320, 12787, 326, 1061, 13, 3166, 5844, 1053, 18074, 2273, 13, 13, 6203, 29918, 342, 326, 1061, 353, 18320, 12787, 326, 1061, 29898, 9507, 2433, 661, 1859, 29918, 5499, 29889, 6173, 742, 29871, 396, 1024, 310, 278, 1967, 297, 278, 3884, 13, 462, 1669, 2927, 29918, 3881, 29922, 3552, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29896, 29947, 511, 313, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29906, 29945, 29945, 8243, 13, 462, 1669, 2322, 29918, 6203, 29918, 2780, 7607, 29906, 29945, 29945, 29892, 29871, 29906, 29900, 29892, 29871, 29896, 29953, 29900, 876, 29871, 396, 350, 14345, 3708, 552, 13, 13, 29909, 29918, 1756, 353, 4038, 29918, 342, 326, 1061, 29889, 657, 29918, 6203, 29898, 2457, 29918, 29886, 861, 1379, 29922, 5574, 29897, 13, 615, 29918, 546, 29918, 29886, 15711, 353, 18074, 2273, 29898, 29896, 29941, 29896, 29896, 29929, 29941, 29889, 29947, 847, 319, 29918, 1756, 29897, 29871, 396, 6492, 2159, 448, 29871, 29941, 29900, 29889, 29945, 29953, 23931, 29892, 10153, 2159, 448, 29871, 29946, 29946, 29955, 29916, 29945, 29947, 29947, 282, 29916, 13, 2158, 29898, 615, 29918, 546, 29918, 29886, 15711, 29897, 13, 13, 29937, 4038, 29918, 342, 326, 1061, 29889, 4294, 29918, 8346, 580, 13, 13, 29937, 411, 260, 14643, 1791, 5270, 29879, 13, 6203, 29918, 342, 326, 1061, 29889, 2780, 29918, 13609, 29918, 13400, 353, 7442, 29889, 2378, 4197, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29941, 29900, 1402, 7442, 29889, 13470, 29947, 29897, 13, 6203, 29918, 342, 326, 1061, 29889, 2780, 29918, 21064, 29918, 13400, 353, 7442, 29889, 2378, 4197, 29945, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29906, 29945, 29945, 1402, 7442, 29889, 13470, 29947, 29897, 13, 6203, 29918, 342, 326, 1061, 29889, 6203, 29918, 2780, 353, 313, 29896, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 29909, 29918, 1756, 353, 4038, 29918, 342, 326, 1061, 29889, 657, 29918, 6203, 580, 13, 6203, 29918, 342, 326, 1061, 29889, 4294, 29918, 8346, 580, 13, 13, 29937, 4140, 6900, 639, 15526, 13, 615, 29918, 546, 29918, 29886, 15711, 353, 18074, 2273, 29898, 29896, 29941, 29896, 29896, 29929, 29941, 29889, 29947, 847, 319, 29918, 1756, 29897, 13, 2158, 29898, 615, 29918, 546, 29918, 29886, 15711, 29897, 13, 2 ]
corehq/apps/users/bulkupload.py
dborowiecki/commcare-hq
0
90465
import logging import uuid from django import forms from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import validate_email from django.utils.translation import ugettext as _ from couchdbkit.exceptions import ( BulkSaveError, MultipleResultsFound, ResourceNotFound, ) from couchexport.writers import Excel2007ExportWriter from dimagi.utils.chunked import chunked from dimagi.utils.parsing import string_to_boolean from soil import DownloadBase from soil.util import expose_download, get_download_file_path from corehq import privileges from corehq.apps.accounting.utils import domain_has_privilege from corehq.apps.commtrack.util import get_supply_point_and_location from corehq.apps.custom_data_fields.models import CustomDataFieldsDefinition from corehq.apps.domain.forms import clean_password from corehq.apps.domain.models import Domain from corehq.apps.groups.models import Group from corehq.apps.locations.models import SQLLocation from corehq.apps.users.dbaccessors.all_commcare_users import ( get_commcare_users_by_filters, get_existing_usernames, ) from corehq.apps.users.models import UserRole from corehq.util.workbook_json.excel import ( alphanumeric_sort_key, flatten_json, json_to_headers, ) from .forms import get_mobile_worker_max_username_length from .models import CommCareUser, CouchUser from .util import normalize_username, raw_username class UserUploadError(Exception): pass required_headers = set(['username']) allowed_headers = set([ 'data', 'email', 'group', 'language', 'name', 'password', 'phone-number', 'uncategorized_data', 'user_id', 'is_active', 'location_code', 'role', 'User IMEIs (read only)', 'registered_on (read only)', ]) | required_headers old_headers = { # 'old_header_name': 'new_header_name' 'location-sms-code': 'location_code' } def check_headers(user_specs): messages = [] headers = set(user_specs.fieldnames) # Backwards warnings for (old_name, new_name) in old_headers.items(): if old_name in headers: messages.append( _("'The column header '{old_name}' is deprecated, please use '{new_name}' instead.").format( old_name=old_name, new_name=new_name )) headers.discard(old_name) illegal_headers = headers - allowed_headers missing_headers = required_headers - headers for header_set, label in (missing_headers, 'required'), (illegal_headers, 'illegal'): if header_set: messages.append(_('The following are {label} column headers: {headers}.').format( label=label, headers=', '.join(header_set))) if messages: raise UserUploadError('\n'.join(messages)) def check_duplicate_usernames(user_specs): usernames = set() duplicated_usernames = set() for row in user_specs: username = row.get('username') if username and username in usernames: duplicated_usernames.add(username) usernames.add(username) if duplicated_usernames: raise UserUploadError(_("The following usernames have duplicate entries in " "your file: " + ', '.join(duplicated_usernames))) def check_existing_usernames(user_specs, domain): usernames_without_ids = set() invalid_usernames = set() for row in user_specs: username = row.get('username') user_id = row.get('user_id') if username and user_id: continue try: usernames_without_ids.add(normalize_username(username, domain)) except ValidationError: invalid_usernames.add(username) if invalid_usernames: raise UserUploadError(_('The following usernames are invalid: ' + ', '.join(invalid_usernames))) existing_usernames = set() for usernames in chunked(usernames_without_ids, 500): existing_usernames.update(get_existing_usernames(usernames)) if existing_usernames: raise UserUploadError(_("The following usernames already exist and must " "have an id specified to be updated: " + ', '.join(existing_usernames))) class GroupMemoizer(object): """ If you use this to get a group, do not set group.name directly; use group_memoizer.rename_group(group, name) instead. """ def __init__(self, domain): self.groups_by_name = {} self.groups_by_id = {} self.groups = set() self.domain = domain def load_all(self): for group in Group.by_domain(self.domain): self.add_group(group) def add_group(self, new_group): # todo # this has the possibility of missing two rows one with id one with name # that actually refer to the same group # and overwriting one with the other assert new_group.name if new_group.get_id: self.groups_by_id[new_group.get_id] = new_group self.groups_by_name[new_group.name] = new_group self.groups.add(new_group) def by_name(self, group_name): if group_name not in self.groups_by_name: group = Group.by_name(self.domain, group_name) if not group: self.groups_by_name[group_name] = None return None self.add_group(group) return self.groups_by_name[group_name] def get(self, group_id): if group_id not in self.groups_by_id: group = Group.get(group_id) if group.domain != self.domain: raise ResourceNotFound() self.add_group(group) return self.groups_by_id[group_id] def create(self, domain, name): group = Group(domain=domain, name=name) self.add_group(group) return group def rename_group(self, group, name): # This isn't always true, you can rename A => B and then B => C, # and what was A will now be called B when you try to change # what was B to be called C. That's fine, but you don't want to # delete someone else's entry if self.groups_by_name.get(group.name) is group: del self.groups_by_name[group.name] group.name = name self.add_group(group) def save_all(self): Group.bulk_save(self.groups) def _fmt_phone(phone_number): if phone_number and not isinstance(phone_number, str): phone_number = str(int(phone_number)) return phone_number.lstrip("+") class BulkCacheBase(object): def __init__(self, domain): self.domain = domain self.cache = {} def get(self, key): if not key: return None if key not in self.cache: self.cache[key] = self.lookup(key) return self.cache[key] def lookup(self, key): # base classes must implement this themselves raise NotImplementedError class SiteCodeToSupplyPointCache(BulkCacheBase): """ Cache the lookup of a supply point object from the site code used in upload. """ def lookup(self, site_code): case_location = get_supply_point_and_location( self.domain, site_code ) return case_location.case class SiteCodeToLocationCache(BulkCacheBase): def __init__(self, domain): self.non_admin_types = [ loc_type.name for loc_type in Domain.get_by_name(domain).location_types if not loc_type.administrative ] super(SiteCodeToLocationCache, self).__init__(domain) def lookup(self, site_code): """ Note that this can raise SQLLocation.DoesNotExist if the location with the given site code is not found. """ return SQLLocation.objects.using('default').get( domain=self.domain, site_code__iexact=site_code ) class LocationIdToSiteCodeCache(BulkCacheBase): def lookup(self, location_id): return SQLLocation.objects.get( domain=self.domain, # this is only for safety location_id=location_id ).site_code def create_or_update_groups(domain, group_specs, log): group_memoizer = GroupMemoizer(domain) group_memoizer.load_all() group_names = set() for row in group_specs: group_id = row.get('id') group_name = str(row.get('name') or '') case_sharing = row.get('case-sharing') reporting = row.get('reporting') data = row.get('data') # check that group_names are unique if group_name in group_names: log['errors'].append('Your spreadsheet has multiple groups called "%s" and only the first was processed' % group_name) continue else: group_names.add(group_name) # check that there's a group_id or a group_name if not group_id and not group_name: log['errors'].append('Your spreadsheet has a group with no name or id and it has been ignored') continue try: if group_id: group = group_memoizer.get(group_id) else: group = group_memoizer.by_name(group_name) if not group: group = group_memoizer.create(domain=domain, name=group_name) except ResourceNotFound: log["errors"].append('There are no groups on CommCare HQ with id "%s"' % group_id) except MultipleResultsFound: log["errors"].append("There are multiple groups on CommCare HQ named: %s" % group_name) else: if group_name: group_memoizer.rename_group(group, group_name) group.case_sharing = case_sharing group.reporting = reporting group.metadata = data return group_memoizer def get_location_from_site_code(site_code, location_cache): if isinstance(site_code, str): site_code = site_code.lower() elif isinstance(site_code, int): site_code = str(site_code) else: raise UserUploadError( _("Unexpected format received for site code '%(site_code)s'") % {'site_code': site_code} ) try: return location_cache.get(site_code) except SQLLocation.DoesNotExist: raise UserUploadError( _("Could not find organization with site code '%(site_code)s'") % {'site_code': site_code} ) def is_password(password): if not password: return False for c in password: if c != "*": return True return False def users_with_duplicate_passwords(rows): password_dict = dict() for row in rows: username = row.get('username') password = str(row.get('password')) if not is_password(password): continue if password_dict.get(password): password_dict[password].add(username) else: password_dict[password] = {username} ret = set() for usernames in password_dict.values(): if len(usernames) > 1: ret = ret.union(usernames) return ret def create_or_update_users_and_groups(domain, user_specs, group_specs, task=None): from corehq.apps.users.views.mobile.custom_data_fields import UserFieldsView custom_data_validator = UserFieldsView.get_validator(domain) ret = {"errors": [], "rows": []} total = len(user_specs) + len(group_specs) def _set_progress(progress): if task is not None: DownloadBase.set_progress(task, progress, total) group_memoizer = create_or_update_groups(domain, group_specs, log=ret) current = len(group_specs) usernames = set() user_ids = set() allowed_groups = set(group_memoizer.groups) allowed_group_names = [group.name for group in allowed_groups] allowed_roles = UserRole.by_domain(domain) roles_by_name = {role.name: role for role in allowed_roles} can_assign_locations = domain_has_privilege(domain, privileges.LOCATIONS) if can_assign_locations: location_cache = SiteCodeToLocationCache(domain) domain_obj = Domain.get_by_name(domain) usernames_with_dupe_passwords = users_with_duplicate_passwords(user_specs) try: for row in user_specs: _set_progress(current) current += 1 data = row.get('data') email = row.get('email') group_names = list(map(str, row.get('group') or [])) language = row.get('language') name = row.get('name') password = <PASSWORD>.<PASSWORD>('password') phone_number = row.get('phone-number') uncategorized_data = row.get('uncategorized_data') user_id = row.get('user_id') username = row.get('username') location_codes = row.get('location_code') or [] if location_codes and not isinstance(location_codes, list): location_codes = [location_codes] # ignore empty location_codes = [code for code in location_codes if code] role = row.get('role', '') if password: password = <PASSWORD>) try: username = normalize_username(str(username), domain) except TypeError: username = None except ValidationError: ret['rows'].append({ 'username': username, 'row': row, 'flag': _('username cannot contain spaces or symbols'), }) continue status_row = { 'username': raw_username(username) if username else None, 'row': row, } is_active = row.get('is_active') if isinstance(is_active, str): try: is_active = string_to_boolean(is_active) if is_active else None except ValueError: ret['rows'].append({ 'username': username, 'row': row, 'flag': _("'is_active' column can only contain 'true' or 'false'"), }) continue if username in usernames or user_id in user_ids: status_row['flag'] = 'repeat' elif not username and not user_id: status_row['flag'] = 'missing-data' else: try: if username: usernames.add(username) if user_id: user_ids.add(user_id) if user_id: user = CommCareUser.get_by_user_id(user_id, domain) else: user = CommCareUser.get_by_username(username) if domain_obj.strong_mobile_passwords and is_password(password): if raw_username(username) in usernames_with_dupe_passwords: raise UserUploadError(_("Provide a unique password for each mobile worker")) try: clean_password(password) except forms.ValidationError: if settings.ENABLE_DRACONIAN_SECURITY_FEATURES: msg = _("Mobile Worker passwords must be 8 " "characters long with at least 1 capital " "letter, 1 special character and 1 number") else: msg = _("Please provide a stronger password") raise UserUploadError(msg) if user: if user.domain != domain: raise UserUploadError(_( 'User with username %(username)r is ' 'somehow in domain %(domain)r' ) % {'username': user.username, 'domain': user.domain}) if username and user.username != username: raise UserUploadError(_( 'Changing usernames is not supported: %(username)r to %(new_username)r' ) % {'username': user.username, 'new_username': username}) if is_password(password): user.set_password(password) status_row['flag'] = 'updated' else: max_username_length = get_mobile_worker_max_username_length(domain) if len(raw_username(username)) > max_username_length: ret['rows'].append({ 'username': username, 'row': row, 'flag': _("username cannot contain greater than %d characters" % max_username_length) }) continue if not is_password(password): raise UserUploadError(_("Cannot create a new user with a blank password")) user = CommCareUser.create(domain, username, password, commit=False) status_row['flag'] = 'created' if phone_number: user.add_phone_number(_fmt_phone(phone_number), default=True) if name: user.set_full_name(str(name)) if data: error = custom_data_validator(data) if error: raise UserUploadError(error) user.user_data.update(data) if uncategorized_data: user.user_data.update(uncategorized_data) if language: user.language = language if email: try: validate_email(email) except ValidationError: raise UserUploadError(_("User has an invalid email address")) user.email = email.lower() if is_active is not None: user.is_active = is_active if can_assign_locations: # Do this here so that we validate the location code before we # save any other information to the user, this way either all of # the user's information is updated, or none of it location_ids = [] for code in location_codes: loc = get_location_from_site_code(code, location_cache) location_ids.append(loc.location_id) if role: if role in roles_by_name: user.set_role(domain, roles_by_name[role].get_qualified_id()) else: raise UserUploadError(_( "Role '%s' does not exist" ) % role) if can_assign_locations: locations_updated = set(user.assigned_location_ids) != set(location_ids) primary_location_removed = (user.location_id and not location_ids or user.location_id not in location_ids) if primary_location_removed: user.unset_location(commit=False) if locations_updated: user.reset_locations(location_ids, commit=False) user.save() if is_password(password): # Without this line, digest auth doesn't work. # With this line, digest auth works. # Other than that, I'm not sure what's going on # Passing use_primary_db=True because of https://dimagi-dev.atlassian.net/browse/ICDS-465 user.get_django_user(use_primary_db=True).check_password(password) for group_id in Group.by_user_id(user.user_id, wrap=False): group = group_memoizer.get(group_id) if group.name not in group_names: group.remove_user(user) for group_name in group_names: if group_name not in allowed_group_names: raise UserUploadError(_( "Can't add to group '%s' " "(try adding it to your spreadsheet)" ) % group_name) group_memoizer.by_name(group_name).add_user(user, save=False) except (UserUploadError, CouchUser.Inconsistent) as e: status_row['flag'] = str(e) ret["rows"].append(status_row) finally: try: group_memoizer.save_all() except BulkSaveError as e: _error_message = ( "Oops! We were not able to save some of your group changes. " "Please make sure no one else is editing your groups " "and try again." ) logging.exception(( 'BulkSaveError saving groups. ' 'User saw error message "%s". Errors: %s' ) % (_error_message, e.errors)) ret['errors'].append(_error_message) _set_progress(total) return ret class GroupNameError(Exception): def __init__(self, blank_groups): self.blank_groups = blank_groups @property def message(self): return "The following group ids have a blank name: %s." % ( ', '.join([group.get_id for group in self.blank_groups]) ) def build_data_headers(keys, header_prefix='data'): return json_to_headers( {header_prefix: {key: None for key in keys}} ) def parse_users(group_memoizer, domain, user_data_model, location_cache, user_filters, task, total_count): def _get_group_names(user): return sorted([ group_memoizer.get(id).name for id in Group.by_user_id(user.user_id, wrap=False) ], key=alphanumeric_sort_key) def _get_devices(user): """ Returns a comma-separated list of IMEI numbers of the user's devices, sorted with most-recently-used first """ return ', '.join([device.device_id for device in sorted( user.devices, key=lambda d: d.last_used, reverse=True )]) def _make_user_dict(user, group_names, location_cache): model_data, uncategorized_data = ( user_data_model.get_model_and_uncategorized(user.user_data) ) role = user.get_role(domain) location_codes = [] try: location_codes.append(location_cache.get(user.location_id)) except SQLLocation.DoesNotExist: pass for location_id in user.assigned_location_ids: # skip if primary location_id, as it is already added to the start of list above if location_id != user.location_id: try: location_codes.append(location_cache.get(location_id)) except SQLLocation.DoesNotExist: pass return { 'data': model_data, 'uncategorized_data': uncategorized_data, 'group': group_names, 'name': user.full_name, 'password': "********", # dummy display string for passwords 'phone-number': user.phone_number, 'email': user.email, 'username': user.raw_username, 'language': user.language, 'user_id': user._id, 'is_active': str(user.is_active), 'User IMEIs (read only)': _get_devices(user), 'location_code': location_codes, 'role': role.name if role else '', 'registered_on (read only)': user.created_on.strftime('%Y-%m-%d %H:%M:%S') if user.created_on else '' } unrecognized_user_data_keys = set() user_groups_length = 0 max_location_length = 0 user_dicts = [] for n, user in enumerate(get_commcare_users_by_filters(domain, user_filters)): group_names = _get_group_names(user) user_dict = _make_user_dict(user, group_names, location_cache) user_dicts.append(user_dict) unrecognized_user_data_keys.update(user_dict['uncategorized_data']) user_groups_length = max(user_groups_length, len(group_names)) max_location_length = max(max_location_length, len(user_dict["location_code"])) DownloadBase.set_progress(task, n, total_count) user_headers = [ 'username', 'password', 'name', 'phone-number', 'email', 'language', 'role', 'user_id', 'is_active', 'User IMEIs (read only)', 'registered_on (read only)'] user_data_fields = [f.slug for f in user_data_model.get_fields(include_system=False)] user_headers.extend(build_data_headers(user_data_fields)) user_headers.extend(build_data_headers( unrecognized_user_data_keys, header_prefix='uncategorized_data' )) user_headers.extend(json_to_headers( {'group': list(range(1, user_groups_length + 1))} )) if domain_has_privilege(domain, privileges.LOCATIONS): user_headers.extend(json_to_headers( {'location_code': list(range(1, max_location_length + 1))} )) def _user_rows(): for user_dict in user_dicts: row = dict(flatten_json(user_dict)) yield [row.get(header) or '' for header in user_headers] return user_headers, _user_rows() def parse_groups(groups): def _make_group_dict(group): return { 'id': group.get_id, 'name': group.name, 'case-sharing': group.case_sharing, 'reporting': group.reporting, 'data': group.metadata, } group_data_keys = set() group_dicts = [] sorted_groups = sorted( groups, key=lambda group: alphanumeric_sort_key(group.name) ) for group in sorted_groups: group_dicts.append(_make_group_dict(group)) group_data_keys.update(group.metadata if group.metadata else []) group_headers = ['id', 'name', 'case-sharing?', 'reporting?'] group_headers.extend(build_data_headers(group_data_keys)) def _get_group_rows(): for group_dict in group_dicts: row = dict(flatten_json(group_dict)) yield [row.get(header) or '' for header in group_headers] return group_headers, _get_group_rows() def count_users_and_groups(domain, user_filters, group_memoizer): users_count = get_commcare_users_by_filters(domain, user_filters, count_only=True) groups_count = len(group_memoizer.groups) return users_count + groups_count def dump_users_and_groups(domain, download_id, user_filters, task): from corehq.apps.users.views.mobile.custom_data_fields import UserFieldsView def _load_memoizer(domain): group_memoizer = GroupMemoizer(domain=domain) # load groups manually instead of calling group_memoizer.load_all() # so that we can detect blank groups blank_groups = set() for group in Group.by_domain(domain): if group.name: group_memoizer.add_group(group) else: blank_groups.add(group) if blank_groups: raise GroupNameError(blank_groups=blank_groups) return group_memoizer writer = Excel2007ExportWriter(format_as_text=True) group_memoizer = _load_memoizer(domain) location_cache = LocationIdToSiteCodeCache(domain) users_groups_count = count_users_and_groups(domain, user_filters, group_memoizer) DownloadBase.set_progress(task, 0, users_groups_count) user_data_model = CustomDataFieldsDefinition.get_or_create( domain, UserFieldsView.field_type ) user_headers, user_rows = parse_users( group_memoizer, domain, user_data_model, location_cache, user_filters, task, users_groups_count, ) group_headers, group_rows = parse_groups(group_memoizer.groups) headers = [ ('users', [user_headers]), ('groups', [group_headers]), ] rows = [ ('users', user_rows), ('groups', group_rows), ] use_transfer = settings.SHARED_DRIVE_CONF.transfer_enabled filename = "{}_users_{}.xlsx".format(domain, uuid.uuid4().hex) file_path = get_download_file_path(use_transfer, filename) writer.open( header_table=headers, file=file_path, ) writer.write(rows) writer.close() expose_download(use_transfer, file_path, filename, download_id, 'xlsx') DownloadBase.set_progress(task, users_groups_count, users_groups_count)
[ 1, 1053, 12183, 13, 5215, 318, 5416, 13, 13, 3166, 9557, 1053, 7190, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 3221, 29889, 11739, 29879, 1053, 15758, 362, 2392, 13, 3166, 9557, 29889, 3221, 29889, 3084, 4097, 1053, 12725, 29918, 5269, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 318, 657, 726, 408, 903, 13, 13, 3166, 274, 3222, 2585, 7354, 29889, 11739, 29879, 1053, 313, 13, 1678, 8313, 29895, 11371, 2392, 29892, 13, 1678, 26905, 12191, 9692, 29892, 13, 1678, 18981, 17413, 29892, 13, 29897, 13, 13, 3166, 274, 3222, 15843, 29889, 8231, 414, 1053, 11388, 29906, 29900, 29900, 29955, 26382, 10507, 13, 3166, 3964, 17698, 29889, 13239, 29889, 29812, 287, 1053, 19875, 287, 13, 3166, 3964, 17698, 29889, 13239, 29889, 862, 2976, 1053, 1347, 29918, 517, 29918, 20054, 13, 3166, 22473, 1053, 25553, 5160, 13, 3166, 22473, 29889, 4422, 1053, 24396, 29918, 10382, 29892, 679, 29918, 10382, 29918, 1445, 29918, 2084, 13, 13, 3166, 7136, 29882, 29939, 1053, 28091, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 10149, 292, 29889, 13239, 1053, 5354, 29918, 5349, 29918, 22534, 488, 479, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 2055, 11294, 29889, 4422, 1053, 679, 29918, 19303, 368, 29918, 3149, 29918, 392, 29918, 5479, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 6341, 29918, 1272, 29918, 9621, 29889, 9794, 1053, 8701, 1469, 14256, 14683, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 7247, 29889, 9514, 1053, 5941, 29918, 5630, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 7247, 29889, 9794, 1053, 28460, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 13155, 29889, 9794, 1053, 6431, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 2029, 800, 29889, 9794, 1053, 317, 29984, 2208, 10610, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 7193, 29889, 2585, 5943, 943, 29889, 497, 29918, 2055, 18020, 29918, 7193, 1053, 313, 13, 1678, 679, 29918, 2055, 18020, 29918, 7193, 29918, 1609, 29918, 26705, 29892, 13, 1678, 679, 29918, 735, 15423, 29918, 375, 824, 1280, 29892, 13, 29897, 13, 3166, 7136, 29882, 29939, 29889, 13371, 29889, 7193, 29889, 9794, 1053, 4911, 16727, 13, 3166, 7136, 29882, 29939, 29889, 4422, 29889, 1287, 2909, 29918, 3126, 29889, 24633, 1053, 313, 13, 1678, 394, 16711, 25099, 29918, 6605, 29918, 1989, 29892, 13, 1678, 1652, 8606, 29918, 3126, 29892, 13, 1678, 4390, 29918, 517, 29918, 13662, 29892, 13, 29897, 13, 13, 3166, 869, 9514, 1053, 679, 29918, 16769, 29918, 24602, 29918, 3317, 29918, 6786, 29918, 2848, 13, 3166, 869, 9794, 1053, 1876, 29907, 598, 2659, 29892, 315, 3222, 2659, 13, 3166, 869, 4422, 1053, 4226, 675, 29918, 6786, 29892, 10650, 29918, 6786, 13, 13, 13, 1990, 4911, 17553, 2392, 29898, 2451, 1125, 13, 1678, 1209, 13, 13, 13, 12403, 29918, 13662, 353, 731, 18959, 6786, 11287, 13, 24622, 29918, 13662, 353, 731, 4197, 13, 1678, 525, 1272, 742, 525, 5269, 742, 525, 2972, 742, 525, 11675, 742, 525, 978, 742, 525, 5630, 742, 525, 6710, 29899, 4537, 742, 13, 1678, 525, 4661, 20440, 1891, 29918, 1272, 742, 525, 1792, 29918, 333, 742, 525, 275, 29918, 4925, 742, 525, 5479, 29918, 401, 742, 525, 12154, 742, 13, 1678, 525, 2659, 306, 2303, 3624, 313, 949, 871, 29897, 742, 525, 9573, 287, 29918, 265, 313, 949, 871, 29897, 742, 13, 2314, 891, 3734, 29918, 13662, 13, 1025, 29918, 13662, 353, 426, 13, 1678, 396, 525, 1025, 29918, 6672, 29918, 978, 2396, 525, 1482, 29918, 6672, 29918, 978, 29915, 13, 1678, 525, 5479, 29899, 29879, 1516, 29899, 401, 2396, 525, 5479, 29918, 401, 29915, 13, 29913, 13, 13, 13, 1753, 1423, 29918, 13662, 29898, 1792, 29918, 5965, 2395, 1125, 13, 1678, 7191, 353, 5159, 13, 1678, 9066, 353, 731, 29898, 1792, 29918, 5965, 2395, 29889, 2671, 7039, 29897, 13, 13, 1678, 396, 7437, 2935, 18116, 13, 1678, 363, 313, 1025, 29918, 978, 29892, 716, 29918, 978, 29897, 297, 2030, 29918, 13662, 29889, 7076, 7295, 13, 4706, 565, 2030, 29918, 978, 297, 9066, 29901, 13, 9651, 7191, 29889, 4397, 29898, 13, 18884, 903, 703, 29915, 1576, 1897, 4839, 22372, 1025, 29918, 978, 10162, 338, 18164, 29892, 3113, 671, 22372, 1482, 29918, 978, 10162, 2012, 1213, 467, 4830, 29898, 13, 462, 1678, 2030, 29918, 978, 29922, 1025, 29918, 978, 29892, 716, 29918, 978, 29922, 1482, 29918, 978, 13, 462, 876, 13, 9651, 9066, 29889, 2218, 7543, 29898, 1025, 29918, 978, 29897, 13, 13, 1678, 27302, 29918, 13662, 353, 9066, 448, 6068, 29918, 13662, 13, 1678, 4567, 29918, 13662, 353, 3734, 29918, 13662, 448, 9066, 13, 13, 1678, 363, 4839, 29918, 842, 29892, 3858, 297, 313, 27259, 29918, 13662, 29892, 525, 12403, 5477, 313, 309, 12018, 29918, 13662, 29892, 525, 309, 12018, 29374, 13, 4706, 565, 4839, 29918, 842, 29901, 13, 9651, 7191, 29889, 4397, 7373, 877, 1576, 1494, 526, 426, 1643, 29913, 1897, 9066, 29901, 426, 13662, 1836, 2824, 4830, 29898, 13, 18884, 3858, 29922, 1643, 29892, 9066, 29922, 742, 15300, 7122, 29898, 6672, 29918, 842, 4961, 13, 1678, 565, 7191, 29901, 13, 4706, 12020, 4911, 17553, 2392, 28909, 29876, 4286, 7122, 29898, 19158, 876, 13, 13, 13, 1753, 1423, 29918, 20908, 5926, 29918, 375, 824, 1280, 29898, 1792, 29918, 5965, 2395, 1125, 13, 1678, 502, 824, 1280, 353, 731, 580, 13, 1678, 5141, 9169, 29918, 375, 824, 1280, 353, 731, 580, 13, 13, 1678, 363, 1948, 297, 1404, 29918, 5965, 2395, 29901, 13, 4706, 8952, 353, 1948, 29889, 657, 877, 6786, 1495, 13, 4706, 565, 8952, 322, 8952, 297, 502, 824, 1280, 29901, 13, 9651, 5141, 9169, 29918, 375, 824, 1280, 29889, 1202, 29898, 6786, 29897, 13, 4706, 502, 824, 1280, 29889, 1202, 29898, 6786, 29897, 13, 13, 1678, 565, 5141, 9169, 29918, 375, 824, 1280, 29901, 13, 4706, 12020, 4911, 17553, 2392, 7373, 703, 1576, 1494, 502, 824, 1280, 505, 7929, 9976, 297, 376, 13, 9651, 376, 8066, 934, 29901, 376, 718, 13420, 15300, 7122, 29898, 20908, 9169, 29918, 375, 824, 1280, 4961, 13, 13, 13, 1753, 1423, 29918, 735, 15423, 29918, 375, 824, 1280, 29898, 1792, 29918, 5965, 2395, 29892, 5354, 1125, 13, 1678, 502, 824, 1280, 29918, 14037, 29918, 4841, 353, 731, 580, 13, 1678, 8340, 29918, 375, 824, 1280, 353, 731, 580, 13, 13, 1678, 363, 1948, 297, 1404, 29918, 5965, 2395, 29901, 13, 4706, 8952, 353, 1948, 29889, 657, 877, 6786, 1495, 13, 4706, 1404, 29918, 333, 353, 1948, 29889, 657, 877, 1792, 29918, 333, 1495, 13, 4706, 565, 8952, 322, 1404, 29918, 333, 29901, 13, 9651, 6773, 13, 4706, 1018, 29901, 13, 9651, 502, 824, 1280, 29918, 14037, 29918, 4841, 29889, 1202, 29898, 8945, 675, 29918, 6786, 29898, 6786, 29892, 5354, 876, 13, 4706, 5174, 15758, 362, 2392, 29901, 13, 9651, 8340, 29918, 375, 824, 1280, 29889, 1202, 29898, 6786, 29897, 13, 13, 1678, 565, 8340, 29918, 375, 824, 1280, 29901, 13, 4706, 12020, 4911, 17553, 2392, 7373, 877, 1576, 1494, 502, 824, 1280, 526, 8340, 29901, 525, 718, 13420, 15300, 7122, 29898, 20965, 29918, 375, 824, 1280, 4961, 13, 13, 1678, 5923, 29918, 375, 824, 1280, 353, 731, 580, 13, 1678, 363, 502, 824, 1280, 297, 19875, 287, 29898, 375, 824, 1280, 29918, 14037, 29918, 4841, 29892, 29871, 29945, 29900, 29900, 1125, 13, 4706, 5923, 29918, 375, 824, 1280, 29889, 5504, 29898, 657, 29918, 735, 15423, 29918, 375, 824, 1280, 29898, 375, 824, 1280, 876, 13, 13, 1678, 565, 5923, 29918, 375, 824, 1280, 29901, 13, 4706, 12020, 4911, 17553, 2392, 7373, 703, 1576, 1494, 502, 824, 1280, 2307, 1863, 322, 1818, 376, 13, 9651, 376, 17532, 385, 1178, 6790, 304, 367, 4784, 29901, 376, 718, 13420, 15300, 7122, 29898, 735, 15423, 29918, 375, 824, 1280, 4961, 13, 13, 13, 1990, 6431, 11442, 29877, 3950, 29898, 3318, 1125, 13, 1678, 9995, 13, 13, 1678, 960, 366, 671, 445, 304, 679, 263, 2318, 29892, 437, 451, 731, 2318, 29889, 978, 4153, 29936, 13, 1678, 671, 2318, 29918, 6954, 29877, 3950, 29889, 1267, 420, 29918, 2972, 29898, 2972, 29892, 1024, 29897, 2012, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 5354, 1125, 13, 4706, 1583, 29889, 13155, 29918, 1609, 29918, 978, 353, 6571, 13, 4706, 1583, 29889, 13155, 29918, 1609, 29918, 333, 353, 6571, 13, 4706, 1583, 29889, 13155, 353, 731, 580, 13, 4706, 1583, 29889, 7247, 353, 5354, 13, 13, 1678, 822, 2254, 29918, 497, 29898, 1311, 1125, 13, 4706, 363, 2318, 297, 6431, 29889, 1609, 29918, 7247, 29898, 1311, 29889, 7247, 1125, 13, 9651, 1583, 29889, 1202, 29918, 2972, 29898, 2972, 29897, 13, 13, 1678, 822, 788, 29918, 2972, 29898, 1311, 29892, 716, 29918, 2972, 1125, 13, 4706, 396, 10481, 13, 4706, 396, 445, 756, 278, 13331, 310, 4567, 1023, 4206, 697, 411, 1178, 697, 411, 1024, 13, 4706, 396, 393, 2869, 2737, 304, 278, 1021, 2318, 13, 4706, 396, 322, 975, 16554, 697, 411, 278, 916, 13, 4706, 4974, 716, 29918, 2972, 29889, 978, 13, 4706, 565, 716, 29918, 2972, 29889, 657, 29918, 333, 29901, 13, 9651, 1583, 29889, 13155, 29918, 1609, 29918, 333, 29961, 1482, 29918, 2972, 29889, 657, 29918, 333, 29962, 353, 716, 29918, 2972, 13, 4706, 1583, 29889, 13155, 29918, 1609, 29918, 978, 29961, 1482, 29918, 2972, 29889, 978, 29962, 353, 716, 29918, 2972, 13, 4706, 1583, 29889, 13155, 29889, 1202, 29898, 1482, 29918, 2972, 29897, 13, 13, 1678, 822, 491, 29918, 978, 29898, 1311, 29892, 2318, 29918, 978, 1125, 13, 4706, 565, 2318, 29918, 978, 451, 297, 1583, 29889, 13155, 29918, 1609, 29918, 978, 29901, 13, 9651, 2318, 353, 6431, 29889, 1609, 29918, 978, 29898, 1311, 29889, 7247, 29892, 2318, 29918, 978, 29897, 13, 9651, 565, 451, 2318, 29901, 13, 18884, 1583, 29889, 13155, 29918, 1609, 29918, 978, 29961, 2972, 29918, 978, 29962, 353, 6213, 13, 18884, 736, 6213, 13, 9651, 1583, 29889, 1202, 29918, 2972, 29898, 2972, 29897, 13, 4706, 736, 1583, 29889, 13155, 29918, 1609, 29918, 978, 29961, 2972, 29918, 978, 29962, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 2318, 29918, 333, 1125, 13, 4706, 565, 2318, 29918, 333, 451, 297, 1583, 29889, 13155, 29918, 1609, 29918, 333, 29901, 13, 9651, 2318, 353, 6431, 29889, 657, 29898, 2972, 29918, 333, 29897, 13, 9651, 565, 2318, 29889, 7247, 2804, 1583, 29889, 7247, 29901, 13, 18884, 12020, 18981, 17413, 580, 13, 9651, 1583, 29889, 1202, 29918, 2972, 29898, 2972, 29897, 13, 4706, 736, 1583, 29889, 13155, 29918, 1609, 29918, 333, 29961, 2972, 29918, 333, 29962, 13, 13, 1678, 822, 1653, 29898, 1311, 29892, 5354, 29892, 1024, 1125, 13, 4706, 2318, 353, 6431, 29898, 7247, 29922, 7247, 29892, 1024, 29922, 978, 29897, 13, 4706, 1583, 29889, 1202, 29918, 2972, 29898, 2972, 29897, 13, 4706, 736, 2318, 13, 13, 1678, 822, 19508, 29918, 2972, 29898, 1311, 29892, 2318, 29892, 1024, 1125, 13, 4706, 396, 910, 3508, 29915, 29873, 2337, 1565, 29892, 366, 508, 19508, 319, 1149, 350, 322, 769, 350, 1149, 315, 29892, 13, 4706, 396, 322, 825, 471, 319, 674, 1286, 367, 2000, 350, 746, 366, 1018, 304, 1735, 13, 4706, 396, 825, 471, 350, 304, 367, 2000, 315, 29889, 2193, 29915, 29879, 2691, 29892, 541, 366, 1016, 29915, 29873, 864, 304, 13, 4706, 396, 5217, 4856, 1683, 29915, 29879, 6251, 13, 4706, 565, 1583, 29889, 13155, 29918, 1609, 29918, 978, 29889, 657, 29898, 2972, 29889, 978, 29897, 338, 2318, 29901, 13, 9651, 628, 1583, 29889, 13155, 29918, 1609, 29918, 978, 29961, 2972, 29889, 978, 29962, 13, 4706, 2318, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 1202, 29918, 2972, 29898, 2972, 29897, 13, 13, 1678, 822, 4078, 29918, 497, 29898, 1311, 1125, 13, 4706, 6431, 29889, 8645, 29895, 29918, 7620, 29898, 1311, 29889, 13155, 29897, 13, 13, 13, 1753, 903, 23479, 29918, 6710, 29898, 6710, 29918, 4537, 1125, 13, 1678, 565, 9008, 29918, 4537, 322, 451, 338, 8758, 29898, 6710, 29918, 4537, 29892, 851, 1125, 13, 4706, 9008, 29918, 4537, 353, 851, 29898, 524, 29898, 6710, 29918, 4537, 876, 13, 1678, 736, 9008, 29918, 4537, 29889, 29880, 17010, 703, 29974, 1159, 13, 13, 13, 1990, 8313, 29895, 10408, 5160, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 5354, 1125, 13, 4706, 1583, 29889, 7247, 353, 5354, 13, 4706, 1583, 29889, 8173, 353, 6571, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 1820, 1125, 13, 4706, 565, 451, 1820, 29901, 13, 9651, 736, 6213, 13, 4706, 565, 1820, 451, 297, 1583, 29889, 8173, 29901, 13, 9651, 1583, 29889, 8173, 29961, 1989, 29962, 353, 1583, 29889, 20401, 29898, 1989, 29897, 13, 4706, 736, 1583, 29889, 8173, 29961, 1989, 29962, 13, 13, 1678, 822, 16280, 29898, 1311, 29892, 1820, 1125, 13, 4706, 396, 2967, 4413, 1818, 2334, 445, 6053, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 13, 1990, 10781, 3399, 1762, 20182, 368, 5228, 10408, 29898, 29933, 24456, 10408, 5160, 1125, 13, 1678, 9995, 13, 1678, 28540, 278, 16280, 310, 263, 11421, 1298, 1203, 515, 13, 1678, 278, 3268, 775, 1304, 297, 6441, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 16280, 29898, 1311, 29892, 3268, 29918, 401, 1125, 13, 4706, 1206, 29918, 5479, 353, 679, 29918, 19303, 368, 29918, 3149, 29918, 392, 29918, 5479, 29898, 13, 9651, 1583, 29889, 7247, 29892, 13, 9651, 3268, 29918, 401, 13, 4706, 1723, 13, 4706, 736, 1206, 29918, 5479, 29889, 4878, 13, 13, 13, 1990, 10781, 3399, 1762, 6508, 10408, 29898, 29933, 24456, 10408, 5160, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 5354, 1125, 13, 4706, 1583, 29889, 5464, 29918, 6406, 29918, 8768, 353, 518, 13, 9651, 1180, 29918, 1853, 29889, 978, 363, 1180, 29918, 1853, 297, 28460, 29889, 657, 29918, 1609, 29918, 978, 29898, 7247, 467, 5479, 29918, 8768, 13, 9651, 565, 451, 1180, 29918, 1853, 29889, 6406, 2132, 1230, 13, 4706, 4514, 13, 4706, 2428, 29898, 17033, 3399, 1762, 6508, 10408, 29892, 1583, 467, 1649, 2344, 12035, 7247, 29897, 13, 13, 1678, 822, 16280, 29898, 1311, 29892, 3268, 29918, 401, 1125, 13, 4706, 9995, 13, 4706, 3940, 393, 445, 508, 12020, 317, 29984, 2208, 10610, 29889, 25125, 3664, 1252, 391, 565, 278, 4423, 411, 278, 13, 4706, 2183, 3268, 775, 338, 451, 1476, 29889, 13, 4706, 9995, 13, 4706, 736, 317, 29984, 2208, 10610, 29889, 12650, 29889, 4746, 877, 4381, 2824, 657, 29898, 13, 9651, 5354, 29922, 1311, 29889, 7247, 29892, 13, 9651, 3268, 29918, 401, 1649, 347, 29916, 627, 29922, 2746, 29918, 401, 13, 4706, 1723, 13, 13, 13, 1990, 17015, 1204, 1762, 17033, 3399, 10408, 29898, 29933, 24456, 10408, 5160, 1125, 13, 13, 1678, 822, 16280, 29898, 1311, 29892, 4423, 29918, 333, 1125, 13, 4706, 736, 317, 29984, 2208, 10610, 29889, 12650, 29889, 657, 29898, 13, 9651, 5354, 29922, 1311, 29889, 7247, 29892, 29871, 396, 445, 338, 871, 363, 15332, 13, 9651, 4423, 29918, 333, 29922, 5479, 29918, 333, 13, 4706, 13742, 2746, 29918, 401, 13, 13, 13, 1753, 1653, 29918, 272, 29918, 5504, 29918, 13155, 29898, 7247, 29892, 2318, 29918, 5965, 2395, 29892, 1480, 1125, 13, 1678, 2318, 29918, 6954, 29877, 3950, 353, 6431, 11442, 29877, 3950, 29898, 7247, 29897, 13, 1678, 2318, 29918, 6954, 29877, 3950, 29889, 1359, 29918, 497, 580, 13, 1678, 2318, 29918, 7039, 353, 731, 580, 13, 1678, 363, 1948, 297, 2318, 29918, 5965, 2395, 29901, 13, 4706, 2318, 29918, 333, 353, 1948, 29889, 657, 877, 333, 1495, 13, 4706, 2318, 29918, 978, 353, 851, 29898, 798, 29889, 657, 877, 978, 1495, 470, 27255, 13, 4706, 1206, 29918, 845, 4362, 353, 1948, 29889, 657, 877, 4878, 29899, 845, 4362, 1495, 13, 4706, 23415, 353, 1948, 29889, 657, 877, 12276, 292, 1495, 13, 4706, 848, 353, 1948, 29889, 657, 877, 1272, 1495, 13, 13, 4706, 396, 1423, 393, 2318, 29918, 7039, 526, 5412, 13, 4706, 565, 2318, 29918, 978, 297, 2318, 29918, 7039, 29901, 13, 9651, 1480, 1839, 12523, 13359, 4397, 877, 10858, 9677, 9855, 756, 2999, 6471, 2000, 11860, 29879, 29908, 322, 871, 278, 937, 471, 19356, 29915, 1273, 2318, 29918, 978, 29897, 13, 9651, 6773, 13, 4706, 1683, 29901, 13, 9651, 2318, 29918, 7039, 29889, 1202, 29898, 2972, 29918, 978, 29897, 13, 13, 4706, 396, 1423, 393, 727, 29915, 29879, 263, 2318, 29918, 333, 470, 263, 2318, 29918, 978, 13, 4706, 565, 451, 2318, 29918, 333, 322, 451, 2318, 29918, 978, 29901, 13, 9651, 1480, 1839, 12523, 13359, 4397, 877, 10858, 9677, 9855, 756, 263, 2318, 411, 694, 1024, 470, 1178, 322, 372, 756, 1063, 17262, 1495, 13, 9651, 6773, 13, 13, 4706, 1018, 29901, 13, 9651, 565, 2318, 29918, 333, 29901, 13, 18884, 2318, 353, 2318, 29918, 6954, 29877, 3950, 29889, 657, 29898, 2972, 29918, 333, 29897, 13, 9651, 1683, 29901, 13, 18884, 2318, 353, 2318, 29918, 6954, 29877, 3950, 29889, 1609, 29918, 978, 29898, 2972, 29918, 978, 29897, 13, 18884, 565, 451, 2318, 29901, 13, 462, 1678, 2318, 353, 2318, 29918, 6954, 29877, 3950, 29889, 3258, 29898, 7247, 29922, 7247, 29892, 1024, 29922, 2972, 29918, 978, 29897, 13, 4706, 5174, 18981, 17413, 29901, 13, 9651, 1480, 3366, 12523, 16862, 4397, 877, 8439, 526, 694, 6471, 373, 1876, 29907, 598, 379, 29984, 411, 1178, 11860, 29879, 29908, 29915, 1273, 2318, 29918, 333, 29897, 13, 4706, 5174, 26905, 12191, 9692, 29901, 13, 9651, 1480, 3366, 12523, 16862, 4397, 703, 8439, 526, 2999, 6471, 373, 1876, 29907, 598, 379, 29984, 4257, 29901, 1273, 29879, 29908, 1273, 2318, 29918, 978, 29897, 13, 4706, 1683, 29901, 13, 9651, 565, 2318, 29918, 978, 29901, 13, 18884, 2318, 29918, 6954, 29877, 3950, 29889, 1267, 420, 29918, 2972, 29898, 2972, 29892, 2318, 29918, 978, 29897, 13, 9651, 2318, 29889, 4878, 29918, 845, 4362, 353, 1206, 29918, 845, 4362, 13, 9651, 2318, 29889, 12276, 292, 353, 23415, 13, 9651, 2318, 29889, 19635, 353, 848, 13, 1678, 736, 2318, 29918, 6954, 29877, 3950, 13, 13, 13, 1753, 679, 29918, 5479, 29918, 3166, 29918, 2746, 29918, 401, 29898, 2746, 29918, 401, 29892, 4423, 29918, 8173, 1125, 13, 1678, 565, 338, 8758, 29898, 2746, 29918, 401, 29892, 851, 1125, 13, 4706, 3268, 29918, 401, 353, 3268, 29918, 401, 29889, 13609, 580, 13, 1678, 25342, 338, 8758, 29898, 2746, 29918, 401, 29892, 938, 1125, 13, 4706, 3268, 29918, 401, 353, 851, 29898, 2746, 29918, 401, 29897, 13, 1678, 1683, 29901, 13, 4706, 12020, 4911, 17553, 2392, 29898, 13, 9651, 903, 703, 29965, 13996, 6021, 3402, 4520, 363, 3268, 775, 14210, 29898, 2746, 29918, 401, 29897, 29879, 29915, 1159, 1273, 13, 9651, 11117, 2746, 29918, 401, 2396, 3268, 29918, 401, 29913, 13, 4706, 1723, 13, 13, 1678, 1018, 29901, 13, 4706, 736, 4423, 29918, 8173, 29889, 657, 29898, 2746, 29918, 401, 29897, 13, 1678, 5174, 317, 29984, 2208, 10610, 29889, 25125, 3664, 1252, 391, 29901, 13, 4706, 12020, 4911, 17553, 2392, 29898, 13, 9651, 903, 703, 23323, 451, 1284, 13013, 411, 3268, 775, 14210, 29898, 2746, 29918, 401, 29897, 29879, 29915, 1159, 1273, 13, 9651, 11117, 2746, 29918, 401, 2396, 3268, 29918, 401, 29913, 13, 4706, 1723, 13, 13, 13, 1753, 338, 29918, 5630, 29898, 5630, 1125, 13, 1678, 565, 451, 4800, 29901, 13, 4706, 736, 7700, 13, 1678, 363, 274, 297, 4800, 29901, 13, 4706, 565, 274, 2804, 26345, 1115, 13, 9651, 736, 5852, 13, 1678, 736, 7700, 13, 13, 13, 1753, 4160, 29918, 2541, 29918, 20908, 5926, 29918, 5630, 29879, 29898, 5727, 1125, 13, 1678, 4800, 29918, 8977, 353, 9657, 580, 13, 13, 1678, 363, 1948, 297, 4206, 29901, 13, 4706, 8952, 353, 1948, 29889, 657, 877, 6786, 1495, 13, 4706, 4800, 353, 851, 29898, 798, 29889, 657, 877, 5630, 8785, 13, 4706, 565, 451, 338, 29918, 5630, 29898, 5630, 1125, 13, 9651, 6773, 13, 13, 4706, 565, 4800, 29918, 8977, 29889, 657, 29898, 5630, 1125, 13, 9651, 4800, 29918, 8977, 29961, 5630, 1822, 1202, 29898, 6786, 29897, 13, 4706, 1683, 29901, 13, 9651, 4800, 29918, 8977, 29961, 5630, 29962, 353, 426, 6786, 29913, 13, 13, 1678, 3240, 353, 731, 580, 13, 13, 1678, 363, 502, 824, 1280, 297, 4800, 29918, 8977, 29889, 5975, 7295, 13, 4706, 565, 7431, 29898, 375, 824, 1280, 29897, 1405, 29871, 29896, 29901, 13, 9651, 3240, 353, 3240, 29889, 13094, 29898, 375, 824, 1280, 29897, 13, 13, 1678, 736, 3240, 13, 13, 13, 1753, 1653, 29918, 272, 29918, 5504, 29918, 7193, 29918, 392, 29918, 13155, 29898, 7247, 29892, 1404, 29918, 5965, 2395, 29892, 2318, 29918, 5965, 2395, 29892, 3414, 29922, 8516, 1125, 13, 1678, 515, 7136, 29882, 29939, 29889, 13371, 29889, 7193, 29889, 7406, 29889, 16769, 29889, 6341, 29918, 1272, 29918, 9621, 1053, 4911, 14256, 1043, 13, 1678, 2888, 29918, 1272, 29918, 3084, 1061, 353, 4911, 14256, 1043, 29889, 657, 29918, 3084, 1061, 29898, 7247, 29897, 13, 1678, 3240, 353, 8853, 12523, 1115, 19997, 376, 5727, 1115, 5159, 29913, 13, 1678, 3001, 353, 7431, 29898, 1792, 29918, 5965, 2395, 29897, 718, 7431, 29898, 2972, 29918, 5965, 2395, 29897, 13, 13, 1678, 822, 903, 842, 29918, 18035, 29898, 18035, 1125, 13, 4706, 565, 3414, 338, 451, 6213, 29901, 13, 9651, 25553, 5160, 29889, 842, 29918, 18035, 29898, 7662, 29892, 6728, 29892, 3001, 29897, 13, 13, 1678, 2318, 29918, 6954, 29877, 3950, 353, 1653, 29918, 272, 29918, 5504, 29918, 13155, 29898, 7247, 29892, 2318, 29918, 5965, 2395, 29892, 1480, 29922, 2267, 29897, 13, 1678, 1857, 353, 7431, 29898, 2972, 29918, 5965, 2395, 29897, 13, 13, 1678, 502, 824, 1280, 353, 731, 580, 13, 1678, 1404, 29918, 4841, 353, 731, 580, 13, 1678, 6068, 29918, 13155, 353, 731, 29898, 2972, 29918, 6954, 29877, 3950, 29889, 13155, 29897, 13, 1678, 6068, 29918, 2972, 29918, 7039, 353, 518, 2972, 29889, 978, 363, 2318, 297, 6068, 29918, 13155, 29962, 13, 1678, 6068, 29918, 307, 793, 353, 4911, 16727, 29889, 1609, 29918, 7247, 29898, 7247, 29897, 13, 1678, 16178, 29918, 1609, 29918, 978, 353, 426, 12154, 29889, 978, 29901, 6297, 363, 6297, 297, 6068, 29918, 307, 793, 29913, 13, 1678, 508, 29918, 16645, 29918, 2029, 800, 353, 5354, 29918, 5349, 29918, 22534, 488, 479, 29898, 7247, 29892, 28091, 29889, 16652, 8098, 29903, 29897, 13, 1678, 565, 508, 29918, 16645, 29918, 2029, 800, 29901, 13, 4706, 4423, 29918, 8173, 353, 10781, 3399, 1762, 6508, 10408, 29898, 7247, 29897, 13, 1678, 5354, 29918, 5415, 353, 28460, 29889, 657, 29918, 1609, 29918, 978, 29898, 7247, 29897, 13, 1678, 502, 824, 1280, 29918, 2541, 29918, 700, 412, 29918, 5630, 29879, 353, 4160, 29918, 2541, 29918, 20908, 5926, 29918, 5630, 29879, 29898, 1792, 29918, 5965, 2395, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 363, 1948, 297, 1404, 29918, 5965, 2395, 29901, 13, 9651, 903, 842, 29918, 18035, 29898, 3784, 29897, 13, 9651, 1857, 4619, 29871, 29896, 13, 13, 9651, 848, 353, 1948, 29889, 657, 877, 1272, 1495, 13, 9651, 4876, 353, 1948, 29889, 657, 877, 5269, 1495, 13, 9651, 2318, 29918, 7039, 353, 1051, 29898, 1958, 29898, 710, 29892, 1948, 29889, 657, 877, 2972, 1495, 470, 5159, 876, 13, 9651, 4086, 353, 1948, 29889, 657, 877, 11675, 1495, 13, 9651, 1024, 353, 1948, 29889, 657, 877, 978, 1495, 13, 9651, 4800, 353, 529, 25711, 17013, 15513, 29966, 25711, 17013, 29958, 877, 5630, 1495, 13, 9651, 9008, 29918, 4537, 353, 1948, 29889, 657, 877, 6710, 29899, 4537, 1495, 13, 9651, 443, 29883, 20440, 1891, 29918, 1272, 353, 1948, 29889, 657, 877, 4661, 20440, 1891, 29918, 1272, 1495, 13, 9651, 1404, 29918, 333, 353, 1948, 29889, 657, 877, 1792, 29918, 333, 1495, 13, 9651, 8952, 353, 1948, 29889, 657, 877, 6786, 1495, 13, 9651, 4423, 29918, 18137, 353, 1948, 29889, 657, 877, 5479, 29918, 401, 1495, 470, 5159, 13, 9651, 565, 4423, 29918, 18137, 322, 451, 338, 8758, 29898, 5479, 29918, 18137, 29892, 1051, 1125, 13, 18884, 4423, 29918, 18137, 353, 518, 5479, 29918, 18137, 29962, 13, 9651, 396, 11455, 4069, 13, 9651, 4423, 29918, 18137, 353, 518, 401, 363, 775, 297, 4423, 29918, 18137, 565, 775, 29962, 13, 9651, 6297, 353, 1948, 29889, 657, 877, 12154, 742, 27255, 13, 13, 9651, 565, 4800, 29901, 13, 18884, 4800, 353, 529, 25711, 17013, 12948, 13, 9651, 1018, 29901, 13, 18884, 8952, 353, 4226, 675, 29918, 6786, 29898, 710, 29898, 6786, 511, 5354, 29897, 13, 9651, 5174, 20948, 29901, 13, 18884, 8952, 353, 6213, 13, 9651, 5174, 15758, 362, 2392, 29901, 13, 18884, 3240, 1839, 5727, 13359, 4397, 3319, 13, 462, 1678, 525, 6786, 2396, 8952, 29892, 13, 462, 1678, 525, 798, 2396, 1948, 29892, 13, 462, 1678, 525, 15581, 2396, 903, 877, 6786, 2609, 1712, 8162, 470, 15072, 5477, 13, 18884, 5615, 13, 18884, 6773, 13, 9651, 4660, 29918, 798, 353, 426, 13, 18884, 525, 6786, 2396, 10650, 29918, 6786, 29898, 6786, 29897, 565, 8952, 1683, 6213, 29892, 13, 18884, 525, 798, 2396, 1948, 29892, 13, 9651, 500, 13, 13, 9651, 338, 29918, 4925, 353, 1948, 29889, 657, 877, 275, 29918, 4925, 1495, 13, 9651, 565, 338, 8758, 29898, 275, 29918, 4925, 29892, 851, 1125, 13, 18884, 1018, 29901, 13, 462, 1678, 338, 29918, 4925, 353, 1347, 29918, 517, 29918, 20054, 29898, 275, 29918, 4925, 29897, 565, 338, 29918, 4925, 1683, 6213, 13, 18884, 5174, 7865, 2392, 29901, 13, 462, 1678, 3240, 1839, 5727, 13359, 4397, 3319, 13, 462, 4706, 525, 6786, 2396, 8952, 29892, 13, 462, 4706, 525, 798, 2396, 1948, 29892, 13, 462, 4706, 525, 15581, 2396, 903, 703, 29915, 275, 29918, 4925, 29915, 1897, 508, 871, 1712, 525, 3009, 29915, 470, 525, 4541, 29915, 4968, 13, 462, 1678, 5615, 13, 462, 1678, 6773, 13, 13, 9651, 565, 8952, 297, 502, 824, 1280, 470, 1404, 29918, 333, 297, 1404, 29918, 4841, 29901, 13, 18884, 4660, 29918, 798, 1839, 15581, 2033, 353, 525, 14358, 29915, 13, 9651, 25342, 451, 8952, 322, 451, 1404, 29918, 333, 29901, 13, 18884, 4660, 29918, 798, 1839, 15581, 2033, 353, 525, 27259, 29899, 1272, 29915, 13, 9651, 1683, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 565, 8952, 29901, 13, 462, 4706, 502, 824, 1280, 29889, 1202, 29898, 6786, 29897, 13, 462, 1678, 565, 1404, 29918, 333, 29901, 13, 462, 4706, 1404, 29918, 4841, 29889, 1202, 29898, 1792, 29918, 333, 29897, 13, 462, 1678, 565, 1404, 29918, 333, 29901, 13, 462, 4706, 1404, 353, 1876, 29907, 598, 2659, 29889, 657, 29918, 1609, 29918, 1792, 29918, 333, 29898, 1792, 29918, 333, 29892, 5354, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1404, 353, 1876, 29907, 598, 2659, 29889, 657, 29918, 1609, 29918, 6786, 29898, 6786, 29897, 13, 13, 462, 1678, 565, 5354, 29918, 5415, 29889, 1110, 29918, 16769, 29918, 5630, 29879, 322, 338, 29918, 5630, 29898, 5630, 1125, 13, 462, 4706, 565, 10650, 29918, 6786, 29898, 6786, 29897, 297, 502, 824, 1280, 29918, 2541, 29918, 700, 412, 29918, 5630, 29879, 29901, 13, 462, 9651, 12020, 4911, 17553, 2392, 7373, 703, 1184, 29894, 680, 263, 5412, 4800, 363, 1269, 10426, 15645, 5783, 13, 13, 462, 4706, 1018, 29901, 13, 462, 9651, 5941, 29918, 5630, 29898, 5630, 29897, 13, 462, 4706, 5174, 7190, 29889, 19448, 2392, 29901, 13, 462, 9651, 565, 6055, 29889, 1430, 6181, 29918, 8353, 2477, 1164, 29902, 2190, 29918, 1660, 22484, 11937, 29918, 16359, 1299, 11499, 29903, 29901, 13, 462, 18884, 10191, 353, 903, 703, 29295, 5244, 261, 27630, 1818, 367, 29871, 29947, 376, 13, 462, 462, 1678, 376, 3090, 21706, 1472, 411, 472, 3203, 29871, 29896, 7483, 376, 13, 462, 462, 1678, 376, 15670, 29892, 29871, 29896, 4266, 2931, 322, 29871, 29896, 1353, 1159, 13, 462, 9651, 1683, 29901, 13, 462, 18884, 10191, 353, 903, 703, 12148, 3867, 263, 23505, 4800, 1159, 13, 462, 9651, 12020, 4911, 17553, 2392, 29898, 7645, 29897, 13, 13, 462, 1678, 565, 1404, 29901, 13, 462, 4706, 565, 1404, 29889, 7247, 2804, 5354, 29901, 13, 462, 9651, 12020, 4911, 17553, 2392, 7373, 29898, 13, 462, 18884, 525, 2659, 411, 8952, 1273, 29898, 6786, 29897, 29878, 338, 525, 13, 462, 18884, 525, 5372, 3525, 297, 5354, 1273, 29898, 7247, 29897, 29878, 29915, 13, 462, 9651, 1723, 1273, 11117, 6786, 2396, 1404, 29889, 6786, 29892, 525, 7247, 2396, 1404, 29889, 7247, 1800, 13, 462, 4706, 565, 8952, 322, 1404, 29889, 6786, 2804, 8952, 29901, 13, 462, 9651, 12020, 4911, 17553, 2392, 7373, 29898, 13, 462, 18884, 525, 1451, 9776, 502, 824, 1280, 338, 451, 6969, 29901, 1273, 29898, 6786, 29897, 29878, 304, 1273, 29898, 1482, 29918, 6786, 29897, 29878, 29915, 13, 462, 9651, 1723, 1273, 11117, 6786, 2396, 1404, 29889, 6786, 29892, 525, 1482, 29918, 6786, 2396, 8952, 1800, 13, 462, 4706, 565, 338, 29918, 5630, 29898, 5630, 1125, 13, 462, 9651, 1404, 29889, 842, 29918, 5630, 29898, 5630, 29897, 13, 462, 4706, 4660, 29918, 798, 1839, 15581, 2033, 353, 525, 21402, 29915, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 4236, 29918, 6786, 29918, 2848, 353, 679, 29918, 16769, 29918, 24602, 29918, 3317, 29918, 6786, 29918, 2848, 29898, 7247, 29897, 13, 462, 4706, 565, 7431, 29898, 1610, 29918, 6786, 29898, 6786, 876, 1405, 4236, 29918, 6786, 29918, 2848, 29901, 13, 462, 9651, 3240, 1839, 5727, 13359, 4397, 3319, 13, 462, 18884, 525, 6786, 2396, 8952, 29892, 13, 462, 18884, 525, 798, 2396, 1948, 29892, 13, 462, 18884, 525, 15581, 2396, 903, 703, 6786, 2609, 1712, 7621, 1135, 1273, 29881, 4890, 29908, 1273, 13, 462, 462, 3986, 4236, 29918, 6786, 29918, 2848, 29897, 13, 462, 9651, 5615, 13, 462, 9651, 6773, 13, 462, 4706, 565, 451, 338, 29918, 5630, 29898, 5630, 1125, 13, 462, 9651, 12020, 4911, 17553, 2392, 7373, 703, 29089, 1653, 263, 716, 1404, 411, 263, 9654, 4800, 5783, 13, 462, 4706, 1404, 353, 1876, 29907, 598, 2659, 29889, 3258, 29898, 7247, 29892, 8952, 29892, 4800, 29892, 9063, 29922, 8824, 29897, 13, 462, 4706, 4660, 29918, 798, 1839, 15581, 2033, 353, 525, 11600, 29915, 13, 462, 1678, 565, 9008, 29918, 4537, 29901, 13, 462, 4706, 1404, 29889, 1202, 29918, 6710, 29918, 4537, 7373, 23479, 29918, 6710, 29898, 6710, 29918, 4537, 511, 2322, 29922, 5574, 29897, 13, 462, 1678, 565, 1024, 29901, 13, 462, 4706, 1404, 29889, 842, 29918, 8159, 29918, 978, 29898, 710, 29898, 978, 876, 13, 462, 1678, 565, 848, 29901, 13, 462, 4706, 1059, 353, 2888, 29918, 1272, 29918, 3084, 1061, 29898, 1272, 29897, 13, 462, 4706, 565, 1059, 29901, 13, 462, 9651, 12020, 4911, 17553, 2392, 29898, 2704, 29897, 13, 462, 4706, 1404, 29889, 1792, 29918, 1272, 29889, 5504, 29898, 1272, 29897, 13, 462, 1678, 565, 443, 29883, 20440, 1891, 29918, 1272, 29901, 13, 462, 4706, 1404, 29889, 1792, 29918, 1272, 29889, 5504, 29898, 4661, 20440, 1891, 29918, 1272, 29897, 13, 462, 1678, 565, 4086, 29901, 13, 462, 4706, 1404, 29889, 11675, 353, 4086, 13, 462, 1678, 565, 4876, 29901, 13, 462, 4706, 1018, 29901, 13, 462, 9651, 12725, 29918, 5269, 29898, 5269, 29897, 13, 462, 4706, 5174, 15758, 362, 2392, 29901, 13, 462, 9651, 12020, 4911, 17553, 2392, 7373, 703, 2659, 756, 385, 8340, 4876, 3211, 5783, 13, 13, 462, 4706, 1404, 29889, 5269, 353, 4876, 29889, 13609, 580, 13, 462, 1678, 565, 338, 29918, 4925, 338, 451, 6213, 29901, 13, 462, 4706, 1404, 29889, 275, 29918, 4925, 353, 338, 29918, 4925, 13, 13, 462, 1678, 565, 508, 29918, 16645, 29918, 2029, 800, 29901, 13, 462, 4706, 396, 1938, 445, 1244, 577, 393, 591, 12725, 278, 4423, 775, 1434, 591, 13, 462, 4706, 396, 4078, 738, 916, 2472, 304, 278, 1404, 29892, 445, 982, 2845, 599, 310, 13, 462, 4706, 396, 278, 1404, 29915, 29879, 2472, 338, 4784, 29892, 470, 5642, 310, 372, 13, 462, 4706, 4423, 29918, 4841, 353, 5159, 13, 462, 4706, 363, 775, 297, 4423, 29918, 18137, 29901, 13, 462, 9651, 1180, 353, 679, 29918, 5479, 29918, 3166, 29918, 2746, 29918, 401, 29898, 401, 29892, 4423, 29918, 8173, 29897, 13, 462, 9651, 4423, 29918, 4841, 29889, 4397, 29898, 2029, 29889, 5479, 29918, 333, 29897, 13, 13, 462, 1678, 565, 6297, 29901, 13, 462, 4706, 565, 6297, 297, 16178, 29918, 1609, 29918, 978, 29901, 13, 462, 9651, 1404, 29889, 842, 29918, 12154, 29898, 7247, 29892, 16178, 29918, 1609, 29918, 978, 29961, 12154, 1822, 657, 29918, 15380, 2164, 29918, 333, 3101, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 12020, 4911, 17553, 2392, 7373, 29898, 13, 462, 18884, 376, 16727, 14210, 29879, 29915, 947, 451, 1863, 29908, 13, 462, 9651, 1723, 1273, 6297, 29897, 13, 13, 462, 1678, 565, 508, 29918, 16645, 29918, 2029, 800, 29901, 13, 462, 4706, 14354, 29918, 21402, 353, 731, 29898, 1792, 29889, 465, 12961, 29918, 5479, 29918, 4841, 29897, 2804, 731, 29898, 5479, 29918, 4841, 29897, 13, 462, 4706, 7601, 29918, 5479, 29918, 1745, 8238, 353, 313, 1792, 29889, 5479, 29918, 333, 322, 451, 4423, 29918, 4841, 470, 13, 462, 462, 462, 1678, 1404, 29889, 5479, 29918, 333, 451, 297, 4423, 29918, 4841, 29897, 13, 13, 462, 4706, 565, 7601, 29918, 5479, 29918, 1745, 8238, 29901, 13, 462, 9651, 1404, 29889, 348, 842, 29918, 5479, 29898, 15060, 29922, 8824, 29897, 13, 462, 4706, 565, 14354, 29918, 21402, 29901, 13, 462, 9651, 1404, 29889, 12071, 29918, 2029, 800, 29898, 5479, 29918, 4841, 29892, 9063, 29922, 8824, 29897, 13, 13, 462, 1678, 1404, 29889, 7620, 580, 13, 13, 462, 1678, 565, 338, 29918, 5630, 29898, 5630, 1125, 13, 462, 4706, 396, 13932, 445, 1196, 29892, 4697, 342, 4817, 1838, 29915, 29873, 664, 29889, 13, 462, 4706, 396, 2973, 445, 1196, 29892, 4697, 342, 4817, 1736, 29889, 13, 462, 4706, 396, 5901, 1135, 393, 29892, 306, 29915, 29885, 451, 1854, 825, 29915, 29879, 2675, 373, 13, 462, 4706, 396, 6978, 292, 671, 29918, 16072, 29918, 2585, 29922, 5574, 1363, 310, 2045, 597, 6229, 17698, 29899, 3359, 29889, 271, 605, 713, 29889, 1212, 29914, 23721, 344, 29914, 2965, 8452, 29899, 29946, 29953, 29945, 13, 462, 4706, 1404, 29889, 657, 29918, 14095, 29918, 1792, 29898, 1509, 29918, 16072, 29918, 2585, 29922, 5574, 467, 3198, 29918, 5630, 29898, 5630, 29897, 13, 13, 462, 1678, 363, 2318, 29918, 333, 297, 6431, 29889, 1609, 29918, 1792, 29918, 333, 29898, 1792, 29889, 1792, 29918, 333, 29892, 12244, 29922, 8824, 1125, 13, 462, 4706, 2318, 353, 2318, 29918, 6954, 29877, 3950, 29889, 657, 29898, 2972, 29918, 333, 29897, 13, 462, 4706, 565, 2318, 29889, 978, 451, 297, 2318, 29918, 7039, 29901, 13, 462, 9651, 2318, 29889, 5992, 29918, 1792, 29898, 1792, 29897, 13, 13, 462, 1678, 363, 2318, 29918, 978, 297, 2318, 29918, 7039, 29901, 13, 462, 4706, 565, 2318, 29918, 978, 451, 297, 6068, 29918, 2972, 29918, 7039, 29901, 13, 462, 9651, 12020, 4911, 17553, 2392, 7373, 29898, 13, 462, 18884, 376, 6028, 29915, 29873, 788, 304, 2318, 14210, 29879, 29915, 376, 13, 462, 18884, 18227, 2202, 4417, 372, 304, 596, 9677, 9855, 5513, 13, 462, 9651, 1723, 1273, 2318, 29918, 978, 29897, 13, 462, 4706, 2318, 29918, 6954, 29877, 3950, 29889, 1609, 29918, 978, 29898, 2972, 29918, 978, 467, 1202, 29918, 1792, 29898, 1792, 29892, 4078, 29922, 8824, 29897, 13, 13, 18884, 5174, 313, 2659, 17553, 2392, 29892, 315, 3222, 2659, 29889, 797, 3200, 9696, 29897, 408, 321, 29901, 13, 462, 1678, 4660, 29918, 798, 1839, 15581, 2033, 353, 851, 29898, 29872, 29897, 13, 13, 9651, 3240, 3366, 5727, 16862, 4397, 29898, 4882, 29918, 798, 29897, 13, 1678, 7146, 29901, 13, 4706, 1018, 29901, 13, 9651, 2318, 29918, 6954, 29877, 3950, 29889, 7620, 29918, 497, 580, 13, 4706, 5174, 8313, 29895, 11371, 2392, 408, 321, 29901, 13, 9651, 903, 2704, 29918, 4906, 353, 313, 13, 18884, 376, 29949, 3554, 29991, 1334, 892, 451, 2221, 304, 4078, 777, 310, 596, 2318, 3620, 29889, 376, 13, 18884, 376, 12148, 1207, 1854, 694, 697, 1683, 338, 16278, 596, 6471, 376, 13, 18884, 376, 392, 1018, 1449, 1213, 13, 9651, 1723, 13, 9651, 12183, 29889, 11739, 3552, 13, 18884, 525, 29933, 24456, 11371, 2392, 14238, 6471, 29889, 525, 13, 18884, 525, 2659, 4446, 1059, 2643, 11860, 29879, 1642, 4829, 29879, 29901, 1273, 29879, 29915, 13, 9651, 1723, 1273, 9423, 2704, 29918, 4906, 29892, 321, 29889, 12523, 876, 13, 9651, 3240, 1839, 12523, 13359, 4397, 7373, 2704, 29918, 4906, 29897, 13, 13, 1678, 903, 842, 29918, 18035, 29898, 7827, 29897, 13, 1678, 736, 3240, 13, 13, 13, 1990, 6431, 1170, 2392, 29898, 2451, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9654, 29918, 13155, 1125, 13, 4706, 1583, 29889, 19465, 29918, 13155, 353, 9654, 29918, 13155, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2643, 29898, 1311, 1125, 13, 4706, 736, 376, 1576, 1494, 2318, 18999, 505, 263, 9654, 1024, 29901, 1273, 29879, 1213, 1273, 313, 13, 9651, 13420, 15300, 7122, 4197, 2972, 29889, 657, 29918, 333, 363, 2318, 297, 1583, 29889, 19465, 29918, 13155, 2314, 13, 4706, 1723, 13, 13, 13, 1753, 2048, 29918, 1272, 29918, 13662, 29898, 8149, 29892, 4839, 29918, 13506, 2433, 1272, 29374, 13, 1678, 736, 4390, 29918, 517, 29918, 13662, 29898, 13, 4706, 426, 6672, 29918, 13506, 29901, 426, 1989, 29901, 6213, 363, 1820, 297, 6611, 930, 13, 1678, 1723, 13, 13, 13, 1753, 6088, 29918, 7193, 29898, 2972, 29918, 6954, 29877, 3950, 29892, 5354, 29892, 1404, 29918, 1272, 29918, 4299, 29892, 4423, 29918, 8173, 29892, 1404, 29918, 26705, 29892, 3414, 29892, 3001, 29918, 2798, 1125, 13, 13, 1678, 822, 903, 657, 29918, 2972, 29918, 7039, 29898, 1792, 1125, 13, 4706, 736, 12705, 4197, 13, 9651, 2318, 29918, 6954, 29877, 3950, 29889, 657, 29898, 333, 467, 978, 363, 1178, 297, 6431, 29889, 1609, 29918, 1792, 29918, 333, 29898, 1792, 29889, 1792, 29918, 333, 29892, 12244, 29922, 8824, 29897, 13, 4706, 21251, 1820, 29922, 284, 16711, 25099, 29918, 6605, 29918, 1989, 29897, 13, 13, 1678, 822, 903, 657, 29918, 3359, 1575, 29898, 1792, 1125, 13, 4706, 9995, 13, 4706, 16969, 263, 16694, 29899, 25048, 630, 1051, 310, 306, 2303, 29902, 3694, 310, 278, 1404, 29915, 29879, 9224, 29892, 12705, 411, 1556, 29899, 276, 1760, 368, 29899, 3880, 937, 13, 4706, 9995, 13, 4706, 736, 13420, 15300, 7122, 4197, 10141, 29889, 10141, 29918, 333, 363, 4742, 297, 12705, 29898, 13, 9651, 1404, 29889, 3359, 1575, 29892, 1820, 29922, 2892, 270, 29901, 270, 29889, 4230, 29918, 3880, 29892, 11837, 29922, 5574, 13, 4706, 1723, 2314, 13, 13, 1678, 822, 903, 5675, 29918, 1792, 29918, 8977, 29898, 1792, 29892, 2318, 29918, 7039, 29892, 4423, 29918, 8173, 1125, 13, 4706, 1904, 29918, 1272, 29892, 443, 29883, 20440, 1891, 29918, 1272, 353, 313, 13, 9651, 1404, 29918, 1272, 29918, 4299, 29889, 657, 29918, 4299, 29918, 392, 29918, 4661, 20440, 1891, 29898, 1792, 29889, 1792, 29918, 1272, 29897, 13, 4706, 1723, 13, 4706, 6297, 353, 1404, 29889, 657, 29918, 12154, 29898, 7247, 29897, 13, 4706, 4423, 29918, 18137, 353, 5159, 13, 4706, 1018, 29901, 13, 9651, 4423, 29918, 18137, 29889, 4397, 29898, 5479, 29918, 8173, 29889, 657, 29898, 1792, 29889, 5479, 29918, 333, 876, 13, 4706, 5174, 317, 29984, 2208, 10610, 29889, 25125, 3664, 1252, 391, 29901, 13, 9651, 1209, 13, 4706, 363, 4423, 29918, 333, 297, 1404, 29889, 465, 12961, 29918, 5479, 29918, 4841, 29901, 13, 9651, 396, 14383, 565, 7601, 4423, 29918, 333, 29892, 408, 372, 338, 2307, 2715, 304, 278, 1369, 310, 1051, 2038, 13, 9651, 565, 4423, 29918, 333, 2804, 1404, 29889, 5479, 29918, 333, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 4423, 29918, 18137, 29889, 4397, 29898, 5479, 29918, 8173, 29889, 657, 29898, 5479, 29918, 333, 876, 13, 18884, 5174, 317, 29984, 2208, 10610, 29889, 25125, 3664, 1252, 391, 29901, 13, 462, 1678, 1209, 13, 4706, 736, 426, 13, 9651, 525, 1272, 2396, 1904, 29918, 1272, 29892, 13, 9651, 525, 4661, 20440, 1891, 29918, 1272, 2396, 443, 29883, 20440, 1891, 29918, 1272, 29892, 13, 9651, 525, 2972, 2396, 2318, 29918, 7039, 29892, 13, 9651, 525, 978, 2396, 1404, 29889, 8159, 29918, 978, 29892, 13, 9651, 525, 5630, 2396, 376, 4189, 613, 29871, 396, 20254, 2479, 1347, 363, 27630, 13, 9651, 525, 6710, 29899, 4537, 2396, 1404, 29889, 6710, 29918, 4537, 29892, 13, 9651, 525, 5269, 2396, 1404, 29889, 5269, 29892, 13, 9651, 525, 6786, 2396, 1404, 29889, 1610, 29918, 6786, 29892, 13, 9651, 525, 11675, 2396, 1404, 29889, 11675, 29892, 13, 9651, 525, 1792, 29918, 333, 2396, 1404, 3032, 333, 29892, 13, 9651, 525, 275, 29918, 4925, 2396, 851, 29898, 1792, 29889, 275, 29918, 4925, 511, 13, 9651, 525, 2659, 306, 2303, 3624, 313, 949, 871, 29897, 2396, 903, 657, 29918, 3359, 1575, 29898, 1792, 511, 13, 9651, 525, 5479, 29918, 401, 2396, 4423, 29918, 18137, 29892, 13, 9651, 525, 12154, 2396, 6297, 29889, 978, 565, 6297, 1683, 15516, 13, 9651, 525, 9573, 287, 29918, 265, 313, 949, 871, 29897, 2396, 1404, 29889, 11600, 29918, 265, 29889, 710, 615, 603, 877, 29995, 29979, 19222, 29885, 19222, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 1495, 565, 1404, 29889, 11600, 29918, 265, 1683, 6629, 13, 4706, 500, 13, 13, 1678, 443, 29423, 1891, 29918, 1792, 29918, 1272, 29918, 8149, 353, 731, 580, 13, 1678, 1404, 29918, 13155, 29918, 2848, 353, 29871, 29900, 13, 1678, 4236, 29918, 5479, 29918, 2848, 353, 29871, 29900, 13, 1678, 1404, 29918, 8977, 29879, 353, 5159, 13, 1678, 363, 302, 29892, 1404, 297, 26985, 29898, 657, 29918, 2055, 18020, 29918, 7193, 29918, 1609, 29918, 26705, 29898, 7247, 29892, 1404, 29918, 26705, 22164, 13, 4706, 2318, 29918, 7039, 353, 903, 657, 29918, 2972, 29918, 7039, 29898, 1792, 29897, 13, 4706, 1404, 29918, 8977, 353, 903, 5675, 29918, 1792, 29918, 8977, 29898, 1792, 29892, 2318, 29918, 7039, 29892, 4423, 29918, 8173, 29897, 13, 4706, 1404, 29918, 8977, 29879, 29889, 4397, 29898, 1792, 29918, 8977, 29897, 13, 4706, 443, 29423, 1891, 29918, 1792, 29918, 1272, 29918, 8149, 29889, 5504, 29898, 1792, 29918, 8977, 1839, 4661, 20440, 1891, 29918, 1272, 11287, 13, 4706, 1404, 29918, 13155, 29918, 2848, 353, 4236, 29898, 1792, 29918, 13155, 29918, 2848, 29892, 7431, 29898, 2972, 29918, 7039, 876, 13, 4706, 4236, 29918, 5479, 29918, 2848, 353, 4236, 29898, 3317, 29918, 5479, 29918, 2848, 29892, 7431, 29898, 1792, 29918, 8977, 3366, 5479, 29918, 401, 3108, 876, 13, 4706, 25553, 5160, 29889, 842, 29918, 18035, 29898, 7662, 29892, 302, 29892, 3001, 29918, 2798, 29897, 13, 13, 1678, 1404, 29918, 13662, 353, 518, 13, 4706, 525, 6786, 742, 525, 5630, 742, 525, 978, 742, 525, 6710, 29899, 4537, 742, 525, 5269, 742, 13, 4706, 525, 11675, 742, 525, 12154, 742, 525, 1792, 29918, 333, 742, 525, 275, 29918, 4925, 742, 525, 2659, 306, 2303, 3624, 313, 949, 871, 29897, 742, 13, 4706, 525, 9573, 287, 29918, 265, 313, 949, 871, 29897, 2033, 13, 13, 1678, 1404, 29918, 1272, 29918, 9621, 353, 518, 29888, 29889, 29517, 363, 285, 297, 1404, 29918, 1272, 29918, 4299, 29889, 657, 29918, 9621, 29898, 2856, 29918, 5205, 29922, 8824, 4638, 13, 1678, 1404, 29918, 13662, 29889, 21843, 29898, 4282, 29918, 1272, 29918, 13662, 29898, 1792, 29918, 1272, 29918, 9621, 876, 13, 1678, 1404, 29918, 13662, 29889, 21843, 29898, 4282, 29918, 1272, 29918, 13662, 29898, 13, 4706, 443, 29423, 1891, 29918, 1792, 29918, 1272, 29918, 8149, 29892, 13, 4706, 4839, 29918, 13506, 2433, 4661, 20440, 1891, 29918, 1272, 29915, 13, 268, 876, 13, 1678, 1404, 29918, 13662, 29889, 21843, 29898, 3126, 29918, 517, 29918, 13662, 29898, 13, 4706, 11117, 2972, 2396, 1051, 29898, 3881, 29898, 29896, 29892, 1404, 29918, 13155, 29918, 2848, 718, 29871, 29896, 876, 29913, 13, 268, 876, 13, 1678, 565, 5354, 29918, 5349, 29918, 22534, 488, 479, 29898, 7247, 29892, 28091, 29889, 16652, 8098, 29903, 1125, 13, 4706, 1404, 29918, 13662, 29889, 21843, 29898, 3126, 29918, 517, 29918, 13662, 29898, 13, 9651, 11117, 5479, 29918, 401, 2396, 1051, 29898, 3881, 29898, 29896, 29892, 4236, 29918, 5479, 29918, 2848, 718, 29871, 29896, 876, 29913, 13, 308, 876, 13, 13, 1678, 822, 903, 1792, 29918, 5727, 7295, 13, 4706, 363, 1404, 29918, 8977, 297, 1404, 29918, 8977, 29879, 29901, 13, 9651, 1948, 353, 9657, 29898, 1579, 8606, 29918, 3126, 29898, 1792, 29918, 8977, 876, 13, 9651, 7709, 518, 798, 29889, 657, 29898, 6672, 29897, 470, 6629, 363, 4839, 297, 1404, 29918, 13662, 29962, 13, 1678, 736, 1404, 29918, 13662, 29892, 903, 1792, 29918, 5727, 580, 13, 13, 13, 1753, 6088, 29918, 13155, 29898, 13155, 1125, 13, 1678, 822, 903, 5675, 29918, 2972, 29918, 8977, 29898, 2972, 1125, 13, 4706, 736, 426, 13, 9651, 525, 333, 2396, 2318, 29889, 657, 29918, 333, 29892, 13, 9651, 525, 978, 2396, 2318, 29889, 978, 29892, 13, 9651, 525, 4878, 29899, 845, 4362, 2396, 2318, 29889, 4878, 29918, 845, 4362, 29892, 13, 9651, 525, 12276, 292, 2396, 2318, 29889, 12276, 292, 29892, 13, 9651, 525, 1272, 2396, 2318, 29889, 19635, 29892, 13, 4706, 500, 13, 13, 1678, 2318, 29918, 1272, 29918, 8149, 353, 731, 580, 13, 1678, 2318, 29918, 8977, 29879, 353, 5159, 13, 1678, 12705, 29918, 13155, 353, 12705, 29898, 13, 4706, 6471, 29892, 13, 4706, 1820, 29922, 2892, 2318, 29901, 394, 16711, 25099, 29918, 6605, 29918, 1989, 29898, 2972, 29889, 978, 29897, 13, 1678, 1723, 13, 1678, 363, 2318, 297, 12705, 29918, 13155, 29901, 13, 4706, 2318, 29918, 8977, 29879, 29889, 4397, 7373, 5675, 29918, 2972, 29918, 8977, 29898, 2972, 876, 13, 4706, 2318, 29918, 1272, 29918, 8149, 29889, 5504, 29898, 2972, 29889, 19635, 565, 2318, 29889, 19635, 1683, 518, 2314, 13, 13, 1678, 2318, 29918, 13662, 353, 6024, 333, 742, 525, 978, 742, 525, 4878, 29899, 845, 4362, 29973, 742, 525, 12276, 292, 29973, 2033, 13, 1678, 2318, 29918, 13662, 29889, 21843, 29898, 4282, 29918, 1272, 29918, 13662, 29898, 2972, 29918, 1272, 29918, 8149, 876, 13, 13, 1678, 822, 903, 657, 29918, 2972, 29918, 5727, 7295, 13, 4706, 363, 2318, 29918, 8977, 297, 2318, 29918, 8977, 29879, 29901, 13, 9651, 1948, 353, 9657, 29898, 1579, 8606, 29918, 3126, 29898, 2972, 29918, 8977, 876, 13, 9651, 7709, 518, 798, 29889, 657, 29898, 6672, 29897, 470, 6629, 363, 4839, 297, 2318, 29918, 13662, 29962, 13, 1678, 736, 2318, 29918, 13662, 29892, 903, 657, 29918, 2972, 29918, 5727, 580, 13, 13, 13, 1753, 2302, 29918, 7193, 29918, 392, 29918, 13155, 29898, 7247, 29892, 1404, 29918, 26705, 29892, 2318, 29918, 6954, 29877, 3950, 1125, 13, 1678, 4160, 29918, 2798, 353, 679, 29918, 2055, 18020, 29918, 7193, 29918, 1609, 29918, 26705, 29898, 7247, 29892, 1404, 29918, 26705, 29892, 2302, 29918, 6194, 29922, 5574, 29897, 13, 1678, 6471, 29918, 2798, 353, 7431, 29898, 2972, 29918, 6954, 29877, 3950, 29889, 13155, 29897, 13, 13, 1678, 736, 4160, 29918, 2798, 718, 6471, 29918, 2798, 13, 13, 13, 1753, 16766, 29918, 7193, 29918, 392, 29918, 13155, 29898, 7247, 29892, 5142, 29918, 333, 29892, 1404, 29918, 26705, 29892, 3414, 1125, 13, 1678, 515, 7136, 29882, 29939, 29889, 13371, 29889, 7193, 29889, 7406, 29889, 16769, 29889, 6341, 29918, 1272, 29918, 9621, 1053, 4911, 14256, 1043, 13, 13, 1678, 822, 903, 1359, 29918, 6954, 29877, 3950, 29898, 7247, 1125, 13, 4706, 2318, 29918, 6954, 29877, 3950, 353, 6431, 11442, 29877, 3950, 29898, 7247, 29922, 7247, 29897, 13, 4706, 396, 2254, 6471, 7522, 2012, 310, 5432, 2318, 29918, 6954, 29877, 3950, 29889, 1359, 29918, 497, 580, 13, 4706, 396, 577, 393, 591, 508, 6459, 9654, 6471, 13, 4706, 9654, 29918, 13155, 353, 731, 580, 13, 4706, 363, 2318, 297, 6431, 29889, 1609, 29918, 7247, 29898, 7247, 1125, 13, 9651, 565, 2318, 29889, 978, 29901, 13, 18884, 2318, 29918, 6954, 29877, 3950, 29889, 1202, 29918, 2972, 29898, 2972, 29897, 13, 9651, 1683, 29901, 13, 18884, 9654, 29918, 13155, 29889, 1202, 29898, 2972, 29897, 13, 4706, 565, 9654, 29918, 13155, 29901, 13, 9651, 12020, 6431, 1170, 2392, 29898, 19465, 29918, 13155, 29922, 19465, 29918, 13155, 29897, 13, 13, 4706, 736, 2318, 29918, 6954, 29877, 3950, 13, 13, 1678, 9227, 353, 11388, 29906, 29900, 29900, 29955, 26382, 10507, 29898, 4830, 29918, 294, 29918, 726, 29922, 5574, 29897, 13, 1678, 2318, 29918, 6954, 29877, 3950, 353, 903, 1359, 29918, 6954, 29877, 3950, 29898, 7247, 29897, 13, 1678, 4423, 29918, 8173, 353, 17015, 1204, 1762, 17033, 3399, 10408, 29898, 7247, 29897, 13, 13, 1678, 4160, 29918, 13155, 29918, 2798, 353, 2302, 29918, 7193, 29918, 392, 29918, 13155, 29898, 7247, 29892, 1404, 29918, 26705, 29892, 2318, 29918, 6954, 29877, 3950, 29897, 13, 1678, 25553, 5160, 29889, 842, 29918, 18035, 29898, 7662, 29892, 29871, 29900, 29892, 4160, 29918, 13155, 29918, 2798, 29897, 13, 13, 1678, 1404, 29918, 1272, 29918, 4299, 353, 8701, 1469, 14256, 14683, 29889, 657, 29918, 272, 29918, 3258, 29898, 13, 4706, 5354, 29892, 13, 4706, 4911, 14256, 1043, 29889, 2671, 29918, 1853, 13, 1678, 1723, 13, 13, 1678, 1404, 29918, 13662, 29892, 1404, 29918, 5727, 353, 6088, 29918, 7193, 29898, 13, 4706, 2318, 29918, 6954, 29877, 3950, 29892, 13, 4706, 5354, 29892, 13, 4706, 1404, 29918, 1272, 29918, 4299, 29892, 13, 4706, 4423, 29918, 8173, 29892, 13, 4706, 1404, 29918, 26705, 29892, 13, 4706, 3414, 29892, 13, 4706, 4160, 29918, 13155, 29918, 2798, 29892, 13, 1678, 1723, 13, 13, 1678, 2318, 29918, 13662, 29892, 2318, 29918, 5727, 353, 6088, 29918, 13155, 29898, 2972, 29918, 6954, 29877, 3950, 29889, 13155, 29897, 13, 1678, 9066, 353, 518, 13, 4706, 6702, 7193, 742, 518, 1792, 29918, 13662, 11724, 13, 4706, 6702, 13155, 742, 518, 2972, 29918, 13662, 11724, 13, 1678, 4514, 13, 1678, 4206, 353, 518, 13, 4706, 6702, 7193, 742, 1404, 29918, 5727, 511, 13, 4706, 6702, 13155, 742, 2318, 29918, 5727, 511, 13, 1678, 4514, 13, 13, 1678, 671, 29918, 3286, 571, 353, 6055, 29889, 23498, 19386, 29918, 29928, 3960, 12064, 29918, 6007, 29943, 29889, 3286, 571, 29918, 17590, 13, 1678, 10422, 353, 29850, 2403, 7193, 648, 1836, 20267, 29916, 1642, 4830, 29898, 7247, 29892, 318, 5416, 29889, 25118, 29946, 2141, 20970, 29897, 13, 1678, 934, 29918, 2084, 353, 679, 29918, 10382, 29918, 1445, 29918, 2084, 29898, 1509, 29918, 3286, 571, 29892, 10422, 29897, 13, 1678, 9227, 29889, 3150, 29898, 13, 4706, 4839, 29918, 2371, 29922, 13662, 29892, 13, 4706, 934, 29922, 1445, 29918, 2084, 29892, 13, 1678, 1723, 13, 1678, 9227, 29889, 3539, 29898, 5727, 29897, 13, 1678, 9227, 29889, 5358, 580, 13, 13, 1678, 24396, 29918, 10382, 29898, 1509, 29918, 3286, 571, 29892, 934, 29918, 2084, 29892, 10422, 29892, 5142, 29918, 333, 29892, 525, 20267, 29916, 1495, 13, 1678, 25553, 5160, 29889, 842, 29918, 18035, 29898, 7662, 29892, 4160, 29918, 13155, 29918, 2798, 29892, 4160, 29918, 13155, 29918, 2798, 29897, 13, 2 ]
train_xgboost.py
mmcenta/missing-link
0
141824
<filename>train_xgboost.py import pickle import argparse import numpy as np import xgboost as xgb from xgboost.sklearn import XGBClassifier from sklearn.metrics import accuracy_score from util.dataset_io import load_dataset parser = argparse.ArgumentParser(description='Train a xgboost model.') parser.add_argument('--train_name', required=True, help='name of the training dataset') parser.add_argument('--val_name', help='name of the validation dataset') parser.add_argument('--model_name', default='base', help='name of the model for saving') parser.add_argument('--n_estimators', type=int, default=100, help='number of trees to fit') parser.add_argument('--gpu', action='store_true', help='whether to use a gpu when training') parser.add_argument('--max_depth', type=int, default=3, help='maximum tree depth for base learners') parser.add_argument('--learning_rate', type=float, default=0.01, help='boosting learning rate') parser.add_argument('--subsample', type=float, default=0.8, help='subsample ratio of the training instance') parser.add_argument('--colsample_bytree', type=float, default=0.8, help='subsample ratio of columns when constructing each tree') parser.add_argument('--gamma', type=float, default=0, help='minimum loss reduction required to make a further partition on a leaf node of the tree') parser.add_argument('--scale_pos_weight', type=float, default=1.0) parser.add_argument('--min_child_weight', type=int, default=1) parser.add_argument('--reg_alpha', type=float, default=0.0) if __name__ == "__main__": args = parser.parse_args() print("Loading training datataset...") X_train, y_train = load_dataset(args.train_name) print("Done.\nTraining...") if not args.gpu: model = XGBClassifier(silent=False, scale_pos_weight=args.scale_pos_weight, min_child_weight=args.min_child_weight, learning_rate=args.learning_rate, colsample_bytree=args.colsample_bytree, subsample=args.subsample, objective='binary:logistic', n_estimators=args.n_estimators, reg_alpha=args.reg_alpha, max_depth=args.max_depth, gamma=args.gamma) else: model = XGBClassifier(tree_method="gpu_hist", gpu_id=0, silent=False, scale_pos_weight=args.scale_pos_weight, min_child_weight=args.min_child_weight, learning_rate=args.learning_rate, colsample_bytree=args.colsample_bytree, subsample=args.subsample, objective='binary:logistic', n_estimators=args.n_estimators, reg_alpha=args.reg_alpha, max_depth=args.max_depth, gamma=args.gamma) model.fit(X_train, y_train) print("Done.\nSaving...") with open("./models/" + args.model_name + ".pickle", "wb") as f: pickle.dump(model, f) print("Done.") if args.val_name is not None: print("Validating...") preds = model.predict(X_train) pred_labels = np.rint(preds) print("\ttrain accuracy:", accuracy_score(y_train, pred_labels)) X_val, y_val = load_dataset(args.val_name) preds = model.predict(X_val) pred_labels = np.rint(preds) print("\tval accuracy:", accuracy_score(y_val, pred_labels)) print("Done.")
[ 1, 529, 9507, 29958, 14968, 29918, 29916, 29887, 17079, 29889, 2272, 13, 5215, 5839, 280, 13, 5215, 1852, 5510, 13, 5215, 12655, 408, 7442, 13, 5215, 921, 29887, 17079, 408, 921, 26300, 13, 3166, 921, 29887, 17079, 29889, 808, 19668, 1053, 1060, 7210, 2385, 3709, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 13600, 29918, 13628, 13, 13, 3166, 3667, 29889, 24713, 29918, 601, 1053, 2254, 29918, 24713, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 5323, 262, 263, 921, 29887, 17079, 1904, 29889, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 14968, 29918, 978, 742, 3734, 29922, 5574, 29892, 13, 462, 1678, 1371, 2433, 978, 310, 278, 6694, 8783, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 791, 29918, 978, 742, 13, 462, 1678, 1371, 2433, 978, 310, 278, 8845, 8783, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 4299, 29918, 978, 742, 2322, 2433, 3188, 742, 13, 462, 1678, 1371, 2433, 978, 310, 278, 1904, 363, 14238, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 29876, 29918, 342, 326, 4097, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29900, 29900, 29892, 13, 462, 1678, 1371, 2433, 4537, 310, 10697, 304, 6216, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 29887, 3746, 742, 3158, 2433, 8899, 29918, 3009, 742, 13, 462, 1678, 1371, 2433, 1332, 1979, 304, 671, 263, 330, 3746, 746, 6694, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 3317, 29918, 19488, 742, 1134, 29922, 524, 29892, 2322, 29922, 29941, 29892, 13, 462, 1678, 1371, 2433, 27525, 398, 5447, 10809, 363, 2967, 5110, 414, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 21891, 29918, 10492, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29900, 29896, 29892, 13, 462, 1678, 1371, 2433, 17079, 292, 6509, 6554, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1491, 11249, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29947, 29892, 13, 462, 1678, 1371, 2433, 1491, 11249, 11959, 310, 278, 6694, 2777, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1054, 11249, 29918, 1609, 8336, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29947, 29892, 13, 462, 1678, 1371, 2433, 1491, 11249, 11959, 310, 4341, 746, 3386, 292, 1269, 5447, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 4283, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29892, 13, 462, 1678, 1371, 2433, 1195, 12539, 6410, 20376, 3734, 304, 1207, 263, 4340, 8877, 373, 263, 20447, 2943, 310, 278, 5447, 1495, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 7052, 29918, 1066, 29918, 7915, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29896, 29889, 29900, 29897, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1195, 29918, 5145, 29918, 7915, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29897, 13, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1727, 29918, 2312, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29900, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 1596, 703, 23456, 6694, 1418, 271, 24541, 856, 1159, 13, 13, 1678, 1060, 29918, 14968, 29892, 343, 29918, 14968, 353, 2254, 29918, 24713, 29898, 5085, 29889, 14968, 29918, 978, 29897, 13, 13, 1678, 1596, 703, 25632, 7790, 29876, 5323, 2827, 856, 1159, 13, 13, 1678, 565, 451, 6389, 29889, 29887, 3746, 29901, 13, 4706, 1904, 353, 1060, 7210, 2385, 3709, 29898, 25590, 296, 29922, 8824, 29892, 13, 462, 795, 6287, 29918, 1066, 29918, 7915, 29922, 5085, 29889, 7052, 29918, 1066, 29918, 7915, 29892, 13, 462, 795, 1375, 29918, 5145, 29918, 7915, 29922, 5085, 29889, 1195, 29918, 5145, 29918, 7915, 29892, 13, 462, 795, 6509, 29918, 10492, 29922, 5085, 29889, 21891, 29918, 10492, 29892, 13, 462, 795, 784, 11249, 29918, 1609, 8336, 29922, 5085, 29889, 1054, 11249, 29918, 1609, 8336, 29892, 13, 462, 795, 1014, 11249, 29922, 5085, 29889, 1491, 11249, 29892, 13, 462, 795, 12091, 2433, 19541, 29901, 1188, 4695, 742, 13, 462, 795, 302, 29918, 342, 326, 4097, 29922, 5085, 29889, 29876, 29918, 342, 326, 4097, 29892, 13, 462, 795, 1072, 29918, 2312, 29922, 5085, 29889, 1727, 29918, 2312, 29892, 13, 462, 795, 4236, 29918, 19488, 29922, 5085, 29889, 3317, 29918, 19488, 29892, 13, 462, 795, 330, 2735, 29922, 5085, 29889, 4283, 29897, 13, 1678, 1683, 29901, 13, 4706, 1904, 353, 1060, 7210, 2385, 3709, 29898, 8336, 29918, 5696, 543, 29887, 3746, 29918, 29882, 391, 613, 13, 462, 795, 330, 3746, 29918, 333, 29922, 29900, 29892, 13, 462, 795, 17436, 29922, 8824, 29892, 13, 462, 795, 6287, 29918, 1066, 29918, 7915, 29922, 5085, 29889, 7052, 29918, 1066, 29918, 7915, 29892, 13, 462, 795, 1375, 29918, 5145, 29918, 7915, 29922, 5085, 29889, 1195, 29918, 5145, 29918, 7915, 29892, 13, 462, 795, 6509, 29918, 10492, 29922, 5085, 29889, 21891, 29918, 10492, 29892, 13, 462, 795, 784, 11249, 29918, 1609, 8336, 29922, 5085, 29889, 1054, 11249, 29918, 1609, 8336, 29892, 13, 462, 795, 1014, 11249, 29922, 5085, 29889, 1491, 11249, 29892, 13, 462, 795, 12091, 2433, 19541, 29901, 1188, 4695, 742, 13, 462, 795, 302, 29918, 342, 326, 4097, 29922, 5085, 29889, 29876, 29918, 342, 326, 4097, 29892, 13, 462, 795, 1072, 29918, 2312, 29922, 5085, 29889, 1727, 29918, 2312, 29892, 13, 462, 795, 4236, 29918, 19488, 29922, 5085, 29889, 3317, 29918, 19488, 29892, 13, 462, 795, 330, 2735, 29922, 5085, 29889, 4283, 29897, 13, 1678, 1904, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29897, 13, 13, 1678, 1596, 703, 25632, 7790, 29876, 29903, 5555, 856, 1159, 13, 13, 1678, 411, 1722, 703, 6904, 9794, 12975, 718, 6389, 29889, 4299, 29918, 978, 718, 11393, 23945, 280, 613, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 4706, 5839, 280, 29889, 15070, 29898, 4299, 29892, 285, 29897, 13, 13, 1678, 1596, 703, 25632, 23157, 13, 13, 1678, 565, 6389, 29889, 791, 29918, 978, 338, 451, 6213, 29901, 13, 4706, 1596, 703, 7211, 1218, 856, 1159, 13, 13, 4706, 4450, 29879, 353, 1904, 29889, 27711, 29898, 29990, 29918, 14968, 29897, 13, 4706, 4450, 29918, 21134, 353, 7442, 29889, 29878, 524, 29898, 11965, 29879, 29897, 13, 4706, 1596, 14182, 698, 6038, 13600, 29901, 613, 13600, 29918, 13628, 29898, 29891, 29918, 14968, 29892, 4450, 29918, 21134, 876, 13, 13, 4706, 1060, 29918, 791, 29892, 343, 29918, 791, 353, 2254, 29918, 24713, 29898, 5085, 29889, 791, 29918, 978, 29897, 13, 4706, 4450, 29879, 353, 1904, 29889, 27711, 29898, 29990, 29918, 791, 29897, 13, 4706, 4450, 29918, 21134, 353, 7442, 29889, 29878, 524, 29898, 11965, 29879, 29897, 13, 4706, 1596, 14182, 29873, 791, 13600, 29901, 613, 13600, 29918, 13628, 29898, 29891, 29918, 791, 29892, 4450, 29918, 21134, 876, 13, 13, 4706, 1596, 703, 25632, 23157, 13, 2 ]
merger.py
lorabit/workspace_merger
0
178069
from shutil import copy2 from os import path, remove from random import randint import argparse class WorkspaceReader: def __init__(self, fname): self.maven_jars = [] self.java_libraries = [] module_name = 'tmp'+str(randint(1000,9999)) new_name = path.join(path.dirname(__file__), module_name +'.py') copy2(fname, new_name) workspace = __import__(module_name) workspace.native = self workspace.generated_java_libraries() workspace.generated_maven_jars() remove(new_name) def maven_jar(self, name = None, artifact = None, sha1 = None): self.maven_jars.append( { "name": name, "artifact": artifact, "sha1" : sha1 } ) def java_library(self, name = None, visibility = [], exports = [], runtime_deps = []): self.java_libraries.append( { "name": name, "visibility": visibility, "exports": exports, "runtime_deps": runtime_deps } ) class WorkspaceMerger: def __init__(self): self.maven_jars = {} self.java_libraries = {} def merge(self, reader): for maven_jar in reader.maven_jars: self.maven_jars[maven_jar["name"]] = maven_jar for java_library in reader.java_libraries: self.java_libraries[java_library["name"]] = java_library def export(self, fname): def format_array(array, indent = 6): if len(array) == 0: return "[]" if len(array) == 1: return "[\"%s\"]" % (array[0]) ret = [((" "*(indent+4)+"\"%s\",\n") %(i,)) for i in array] return "[\n"+"".join(ret)+" "*indent+"]" with open(fname, 'w') as f: f.write("# The following dependencies were calculated by workspace_merger. \n# https://github.com/lorabit/workspace_merger\n\n\n") f.write("def generated_maven_jars():\n") for maven_jar_name in self.maven_jars: maven_jar = self.maven_jars[maven_jar_name] f.write(" native.maven_jar(\n") f.write(" name = \"%s\",\n" % (maven_jar["name"],)) if maven_jar.get("artifact")!=None: f.write(" artifact = \"%s\",\n" % (maven_jar["artifact"])) if maven_jar.get("sha1")!=None: f.write(" sha1 = \"%s\",\n" % (maven_jar["sha1"])) f.write(" )\n\n") f.write("def generated_java_libraries():\n") for java_library_name in self.java_libraries: java_library = self.java_libraries[java_library_name] f.write(" native.java_library(\n") f.write(" name = \"%s\",\n" % (java_library["name"],)) if java_library.get("visibility")!=None: f.write(" visibility = %s,\n" % (format_array(java_library["visibility"]))) if java_library.get("exports")!=None: f.write(" exports = %s,\n" % (format_array(java_library["exports"]))) if java_library.get("runtime_deps")!=None: f.write(" runtime_deps = %s,\n" % (format_array(java_library["runtime_deps"]))) f.write(" )\n\n") if __name__ == '__main__': parser = argparse.ArgumentParser( description='Merge generated bazel workspaces for maven dependencies.') _arg = parser.add_argument _arg( '-s', '--source', type=str, action='store', metavar='PATH', help='The source bzl file path.', required = True ) _arg( '-d', '--destination', type=str, action='store', metavar='PATH', help='The destination bzl file path. If the file does not exist, a new file will be created.', required = True ) args = parser.parse_args() if not path.isfile(args.source): print("%s does not exist.\n" % (args.source)) exit(0) merger = WorkspaceMerger() if path.isfile(args.destination): dest = WorkspaceReader(args.destination) merger.merge(dest) source = WorkspaceReader(args.source) merger.merge(source) merger.export(args.destination) print('Done!')
[ 1, 515, 528, 4422, 1053, 3509, 29906, 13, 3166, 2897, 1053, 2224, 29892, 3349, 13, 3166, 4036, 1053, 20088, 524, 13, 5215, 1852, 5510, 13, 13, 13, 1990, 5244, 3493, 6982, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 285, 978, 1125, 13, 4706, 1583, 29889, 12419, 29918, 29926, 1503, 353, 5159, 13, 4706, 1583, 29889, 1645, 29918, 492, 8464, 353, 5159, 13, 4706, 3883, 29918, 978, 353, 525, 7050, 18717, 710, 29898, 9502, 524, 29898, 29896, 29900, 29900, 29900, 29892, 29929, 29929, 29929, 29929, 876, 13, 4706, 716, 29918, 978, 353, 2224, 29889, 7122, 29898, 2084, 29889, 25721, 22168, 1445, 1649, 511, 3883, 29918, 978, 718, 4286, 2272, 1495, 13, 4706, 3509, 29906, 29898, 29888, 978, 29892, 716, 29918, 978, 29897, 13, 4706, 664, 3493, 353, 4770, 5215, 12035, 5453, 29918, 978, 29897, 13, 4706, 664, 3493, 29889, 11487, 353, 1583, 13, 4706, 664, 3493, 29889, 13525, 29918, 1645, 29918, 492, 8464, 580, 13, 4706, 664, 3493, 29889, 13525, 29918, 12419, 29918, 29926, 1503, 580, 13, 4706, 3349, 29898, 1482, 29918, 978, 29897, 13, 13, 1678, 822, 18304, 29918, 4758, 29898, 1311, 29892, 1024, 353, 6213, 29892, 24238, 353, 6213, 29892, 528, 29874, 29896, 353, 6213, 1125, 13, 4706, 1583, 29889, 12419, 29918, 29926, 1503, 29889, 4397, 29898, 13, 9651, 426, 13, 18884, 376, 978, 1115, 1024, 29892, 13, 18884, 376, 8813, 1115, 24238, 29892, 13, 18884, 376, 17051, 29896, 29908, 584, 528, 29874, 29896, 13, 9651, 500, 13, 4706, 1723, 13, 13, 1678, 822, 2115, 29918, 5258, 29898, 1311, 29892, 1024, 353, 6213, 29892, 26401, 353, 19997, 29586, 353, 19997, 10073, 29918, 311, 567, 353, 5159, 1125, 13, 4706, 1583, 29889, 1645, 29918, 492, 8464, 29889, 4397, 29898, 13, 9651, 426, 13, 18884, 376, 978, 1115, 1024, 29892, 13, 18884, 376, 28814, 1115, 26401, 29892, 13, 18884, 376, 26500, 1115, 29586, 29892, 13, 18884, 376, 15634, 29918, 311, 567, 1115, 10073, 29918, 311, 567, 13, 9651, 500, 13, 4706, 1723, 13, 13, 1990, 5244, 3493, 15836, 914, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 12419, 29918, 29926, 1503, 353, 6571, 13, 4706, 1583, 29889, 1645, 29918, 492, 8464, 353, 6571, 13, 13, 1678, 822, 10366, 29898, 1311, 29892, 9591, 1125, 13, 4706, 363, 18304, 29918, 4758, 297, 9591, 29889, 12419, 29918, 29926, 1503, 29901, 13, 9651, 1583, 29889, 12419, 29918, 29926, 1503, 29961, 12419, 29918, 4758, 3366, 978, 3108, 29962, 353, 18304, 29918, 4758, 13, 13, 4706, 363, 2115, 29918, 5258, 297, 9591, 29889, 1645, 29918, 492, 8464, 29901, 13, 9651, 1583, 29889, 1645, 29918, 492, 8464, 29961, 1645, 29918, 5258, 3366, 978, 3108, 29962, 353, 2115, 29918, 5258, 13, 13, 1678, 822, 5609, 29898, 1311, 29892, 285, 978, 1125, 13, 4706, 822, 3402, 29918, 2378, 29898, 2378, 29892, 29536, 353, 29871, 29953, 1125, 13, 9651, 565, 7431, 29898, 2378, 29897, 1275, 29871, 29900, 29901, 13, 18884, 736, 376, 2636, 29908, 13, 9651, 565, 7431, 29898, 2378, 29897, 1275, 29871, 29896, 29901, 13, 18884, 736, 14704, 5931, 29995, 29879, 29905, 3108, 29908, 1273, 313, 2378, 29961, 29900, 2314, 13, 9651, 3240, 353, 17288, 703, 376, 16395, 12860, 29974, 29946, 7240, 29908, 5931, 29995, 29879, 23370, 29905, 29876, 1159, 1273, 29898, 29875, 29892, 876, 363, 474, 297, 1409, 29962, 13, 9651, 736, 376, 7110, 29876, 29908, 13578, 1642, 7122, 29898, 2267, 7240, 29908, 26345, 12860, 29974, 3108, 29908, 13, 4706, 411, 1722, 29898, 29888, 978, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 14822, 450, 1494, 9962, 892, 12833, 491, 664, 3493, 29918, 1050, 914, 29889, 320, 29876, 29937, 2045, 597, 3292, 29889, 510, 29914, 5095, 370, 277, 29914, 1287, 3493, 29918, 1050, 914, 29905, 29876, 29905, 29876, 29905, 29876, 1159, 13, 9651, 285, 29889, 3539, 703, 1753, 5759, 29918, 12419, 29918, 29926, 1503, 580, 3583, 29876, 1159, 13, 9651, 363, 18304, 29918, 4758, 29918, 978, 297, 1583, 29889, 12419, 29918, 29926, 1503, 29901, 13, 18884, 18304, 29918, 4758, 353, 1583, 29889, 12419, 29918, 29926, 1503, 29961, 12419, 29918, 4758, 29918, 978, 29962, 13, 18884, 285, 29889, 3539, 703, 29871, 7531, 29889, 12419, 29918, 4758, 1194, 29876, 1159, 13, 18884, 285, 29889, 3539, 703, 418, 1024, 353, 13218, 29995, 29879, 23370, 29905, 29876, 29908, 1273, 313, 12419, 29918, 4758, 3366, 978, 12436, 876, 13, 18884, 565, 18304, 29918, 4758, 29889, 657, 703, 8813, 1159, 19216, 8516, 29901, 13, 462, 1678, 285, 29889, 3539, 703, 418, 24238, 353, 13218, 29995, 29879, 23370, 29905, 29876, 29908, 1273, 313, 12419, 29918, 4758, 3366, 8813, 3108, 876, 13, 18884, 565, 18304, 29918, 4758, 29889, 657, 703, 17051, 29896, 1159, 19216, 8516, 29901, 13, 462, 1678, 285, 29889, 3539, 703, 418, 528, 29874, 29896, 353, 13218, 29995, 29879, 23370, 29905, 29876, 29908, 1273, 313, 12419, 29918, 4758, 3366, 17051, 29896, 3108, 876, 13, 18884, 285, 29889, 3539, 703, 29871, 1723, 29905, 29876, 29905, 29876, 1159, 13, 13, 9651, 285, 29889, 3539, 703, 1753, 5759, 29918, 1645, 29918, 492, 8464, 580, 3583, 29876, 1159, 13, 9651, 363, 2115, 29918, 5258, 29918, 978, 297, 1583, 29889, 1645, 29918, 492, 8464, 29901, 13, 18884, 2115, 29918, 5258, 353, 1583, 29889, 1645, 29918, 492, 8464, 29961, 1645, 29918, 5258, 29918, 978, 29962, 13, 18884, 285, 29889, 3539, 703, 29871, 7531, 29889, 1645, 29918, 5258, 1194, 29876, 1159, 13, 18884, 285, 29889, 3539, 703, 418, 1024, 353, 13218, 29995, 29879, 23370, 29905, 29876, 29908, 1273, 313, 1645, 29918, 5258, 3366, 978, 12436, 876, 13, 18884, 565, 2115, 29918, 5258, 29889, 657, 703, 28814, 1159, 19216, 8516, 29901, 13, 462, 1678, 285, 29889, 3539, 703, 418, 26401, 353, 1273, 29879, 2053, 29876, 29908, 1273, 313, 4830, 29918, 2378, 29898, 1645, 29918, 5258, 3366, 28814, 3108, 4961, 13, 18884, 565, 2115, 29918, 5258, 29889, 657, 703, 26500, 1159, 19216, 8516, 29901, 13, 462, 1678, 285, 29889, 3539, 703, 418, 29586, 353, 1273, 29879, 2053, 29876, 29908, 1273, 313, 4830, 29918, 2378, 29898, 1645, 29918, 5258, 3366, 26500, 3108, 4961, 13, 18884, 565, 2115, 29918, 5258, 29889, 657, 703, 15634, 29918, 311, 567, 1159, 19216, 8516, 29901, 13, 462, 1678, 285, 29889, 3539, 703, 418, 10073, 29918, 311, 567, 353, 1273, 29879, 2053, 29876, 29908, 1273, 313, 4830, 29918, 2378, 29898, 1645, 29918, 5258, 3366, 15634, 29918, 311, 567, 3108, 4961, 13, 18884, 285, 29889, 3539, 703, 29871, 1723, 29905, 29876, 29905, 29876, 1159, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 4706, 6139, 2433, 15836, 479, 5759, 12741, 295, 664, 22854, 363, 18304, 9962, 29889, 1495, 13, 1678, 903, 1191, 353, 13812, 29889, 1202, 29918, 23516, 13, 1678, 903, 1191, 29898, 13, 4706, 17411, 29879, 742, 525, 489, 4993, 742, 29871, 13, 4706, 1134, 29922, 710, 29892, 29871, 13, 4706, 3158, 2433, 8899, 742, 13, 4706, 1539, 485, 279, 2433, 10145, 742, 29871, 13, 4706, 1371, 2433, 1576, 2752, 289, 29920, 29880, 934, 2224, 29889, 742, 29871, 13, 4706, 3734, 353, 5852, 13, 1678, 1723, 13, 1678, 903, 1191, 29898, 13, 4706, 17411, 29881, 742, 525, 489, 23848, 742, 29871, 13, 4706, 1134, 29922, 710, 29892, 29871, 13, 4706, 3158, 2433, 8899, 742, 13, 4706, 1539, 485, 279, 2433, 10145, 742, 29871, 13, 4706, 1371, 2433, 1576, 12551, 289, 29920, 29880, 934, 2224, 29889, 960, 278, 934, 947, 451, 1863, 29892, 263, 716, 934, 674, 367, 2825, 29889, 742, 29871, 13, 4706, 3734, 353, 5852, 13, 1678, 1723, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 565, 451, 2224, 29889, 275, 1445, 29898, 5085, 29889, 4993, 1125, 13, 4706, 1596, 11702, 29879, 947, 451, 1863, 7790, 29876, 29908, 1273, 313, 5085, 29889, 4993, 876, 13, 4706, 6876, 29898, 29900, 29897, 13, 1678, 2778, 914, 353, 5244, 3493, 15836, 914, 580, 13, 1678, 565, 2224, 29889, 275, 1445, 29898, 5085, 29889, 23848, 1125, 13, 4706, 2731, 353, 5244, 3493, 6982, 29898, 5085, 29889, 23848, 29897, 13, 4706, 2778, 914, 29889, 14634, 29898, 7854, 29897, 13, 1678, 2752, 353, 5244, 3493, 6982, 29898, 5085, 29889, 4993, 29897, 13, 1678, 2778, 914, 29889, 14634, 29898, 4993, 29897, 13, 1678, 2778, 914, 29889, 15843, 29898, 5085, 29889, 23848, 29897, 13, 1678, 1596, 877, 25632, 29991, 1495, 13, 2 ]
suites/DatabaseApi/SideChainEthereum.py
dbulka/pytests
0
137996
<gh_stars>0 # -*- coding: utf-8 -*- import lemoncheesecake.api as lcc @lcc.suite("SideChainEthereum") class SideChainEthereum: pass
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 454, 3712, 1173, 267, 687, 1296, 29889, 2754, 408, 301, 617, 13, 13, 13, 29992, 29880, 617, 29889, 13495, 703, 23908, 14688, 29923, 12711, 398, 1159, 13, 1990, 19160, 14688, 29923, 12711, 398, 29901, 13, 1678, 1209, 13, 2 ]
authentik/policies/password/models.py
BeryJu/passbook
15
175958
"""user field matcher models""" import re from django.db import models from django.utils.translation import gettext as _ from rest_framework.serializers import BaseSerializer from structlog.stdlib import get_logger from authentik.policies.models import Policy from authentik.policies.types import PolicyRequest, PolicyResult from authentik.stages.prompt.stage import PLAN_CONTEXT_PROMPT LOGGER = get_logger() RE_LOWER = re.compile("[a-z]") RE_UPPER = re.compile("[A-Z]") RE_DIGITS = re.compile("[0-9]") class PasswordPolicy(Policy): """Policy to make sure passwords have certain properties""" password_field = models.TextField( default="password", help_text=_("Field key to check, field keys defined in Prompt stages are available."), ) amount_digits = models.PositiveIntegerField(default=0) amount_uppercase = models.PositiveIntegerField(default=0) amount_lowercase = models.PositiveIntegerField(default=0) amount_symbols = models.PositiveIntegerField(default=0) length_min = models.PositiveIntegerField(default=0) symbol_charset = models.TextField(default=r"!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ ") error_message = models.TextField() @property def serializer(self) -> BaseSerializer: from authentik.policies.password.api import PasswordPolicySerializer return PasswordPolicySerializer @property def component(self) -> str: return "ak-policy-password-form" # pylint: disable=too-many-return-statements def passes(self, request: PolicyRequest) -> PolicyResult: if ( self.password_field not in request.context and self.password_field not in request.context.get(PLAN_CONTEXT_PROMPT, {}) ): LOGGER.warning( "Password field not set in Policy Request", field=self.password_field, fields=request.context.keys(), prompt_fields=request.context.get(PLAN_CONTEXT_PROMPT, {}).keys(), ) return PolicyResult(False, _("Password not set in context")) if self.password_field in request.context: password = request.context[self.password_field] else: password = request.context[PLAN_CONTEXT_PROMPT][self.password_field] if len(password) < self.length_min: LOGGER.debug("password failed", reason="length") return PolicyResult(False, self.error_message) if self.amount_digits > 0 and len(RE_DIGITS.findall(password)) < self.amount_digits: LOGGER.debug("password failed", reason="amount_digits") return PolicyResult(False, self.error_message) if self.amount_lowercase > 0 and len(RE_LOWER.findall(password)) < self.amount_lowercase: LOGGER.debug("password failed", reason="amount_lowercase") return PolicyResult(False, self.error_message) if self.amount_uppercase > 0 and len(RE_UPPER.findall(password)) < self.amount_lowercase: LOGGER.debug("password failed", reason="amount_uppercase") return PolicyResult(False, self.error_message) if self.amount_symbols > 0: count = 0 for symbol in self.symbol_charset: count += password.count(symbol) if count < self.amount_symbols: LOGGER.debug("password failed", reason="amount_symbols") return PolicyResult(False, self.error_message) return PolicyResult(True) class Meta: verbose_name = _("Password Policy") verbose_name_plural = _("Password Policies")
[ 1, 9995, 1792, 1746, 1993, 261, 4733, 15945, 29908, 13, 5215, 337, 13, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 679, 726, 408, 903, 13, 3166, 1791, 29918, 4468, 29889, 15550, 19427, 1053, 7399, 17679, 13, 3166, 2281, 1188, 29889, 4172, 1982, 1053, 679, 29918, 21707, 13, 13, 3166, 4817, 296, 638, 29889, 3733, 293, 583, 29889, 9794, 1053, 25219, 13, 3166, 4817, 296, 638, 29889, 3733, 293, 583, 29889, 8768, 1053, 25219, 3089, 29892, 25219, 3591, 13, 3166, 4817, 296, 638, 29889, 303, 1179, 29889, 14032, 415, 29889, 19190, 1053, 16507, 2190, 29918, 6007, 16975, 29918, 29925, 3491, 7982, 13, 13, 14480, 17070, 353, 679, 29918, 21707, 580, 13, 1525, 29918, 27998, 1001, 353, 337, 29889, 12198, 703, 29961, 29874, 29899, 29920, 29962, 1159, 13, 1525, 29918, 4897, 13171, 353, 337, 29889, 12198, 703, 29961, 29909, 29899, 29999, 29962, 1159, 13, 1525, 29918, 4571, 29954, 1806, 29903, 353, 337, 29889, 12198, 703, 29961, 29900, 29899, 29929, 29962, 1159, 13, 13, 13, 1990, 25280, 15644, 29898, 15644, 1125, 13, 1678, 9995, 15644, 304, 1207, 1854, 27630, 505, 3058, 4426, 15945, 29908, 13, 13, 1678, 4800, 29918, 2671, 353, 4733, 29889, 15778, 29898, 13, 4706, 2322, 543, 5630, 613, 13, 4706, 1371, 29918, 726, 29922, 29918, 703, 3073, 1820, 304, 1423, 29892, 1746, 6611, 3342, 297, 9705, 415, 22950, 526, 3625, 1213, 511, 13, 1678, 1723, 13, 13, 1678, 5253, 29918, 7501, 1169, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29897, 13, 1678, 5253, 29918, 21064, 4878, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29897, 13, 1678, 5253, 29918, 13609, 4878, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29897, 13, 1678, 5253, 29918, 18098, 29879, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29897, 13, 1678, 3309, 29918, 1195, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4381, 29922, 29900, 29897, 13, 1678, 5829, 29918, 3090, 842, 353, 4733, 29889, 15778, 29898, 4381, 29922, 29878, 29908, 29991, 5931, 29937, 29938, 29995, 29987, 29915, 580, 29930, 29974, 6653, 6904, 29901, 29936, 29966, 4261, 29973, 29992, 7110, 29962, 29985, 29918, 29952, 28437, 29913, 30022, 16521, 13, 1678, 1059, 29918, 4906, 353, 4733, 29889, 15778, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 7797, 3950, 29898, 1311, 29897, 1599, 7399, 17679, 29901, 13, 4706, 515, 4817, 296, 638, 29889, 3733, 293, 583, 29889, 5630, 29889, 2754, 1053, 25280, 15644, 17679, 13, 13, 4706, 736, 25280, 15644, 17679, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4163, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 557, 29899, 22197, 29899, 5630, 29899, 689, 29908, 13, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 2457, 29899, 6112, 4110, 13, 1678, 822, 14517, 29898, 1311, 29892, 2009, 29901, 25219, 3089, 29897, 1599, 25219, 3591, 29901, 13, 4706, 565, 313, 13, 9651, 1583, 29889, 5630, 29918, 2671, 451, 297, 2009, 29889, 4703, 13, 9651, 322, 1583, 29889, 5630, 29918, 2671, 451, 297, 2009, 29889, 4703, 29889, 657, 29898, 7390, 2190, 29918, 6007, 16975, 29918, 29925, 3491, 7982, 29892, 426, 1800, 13, 308, 1125, 13, 9651, 25401, 17070, 29889, 27392, 29898, 13, 18884, 376, 10048, 1746, 451, 731, 297, 25219, 10729, 613, 13, 18884, 1746, 29922, 1311, 29889, 5630, 29918, 2671, 29892, 13, 18884, 4235, 29922, 3827, 29889, 4703, 29889, 8149, 3285, 13, 18884, 9508, 29918, 9621, 29922, 3827, 29889, 4703, 29889, 657, 29898, 7390, 2190, 29918, 6007, 16975, 29918, 29925, 3491, 7982, 29892, 6571, 467, 8149, 3285, 13, 9651, 1723, 13, 9651, 736, 25219, 3591, 29898, 8824, 29892, 903, 703, 10048, 451, 731, 297, 3030, 5783, 13, 13, 4706, 565, 1583, 29889, 5630, 29918, 2671, 297, 2009, 29889, 4703, 29901, 13, 9651, 4800, 353, 2009, 29889, 4703, 29961, 1311, 29889, 5630, 29918, 2671, 29962, 13, 4706, 1683, 29901, 13, 9651, 4800, 353, 2009, 29889, 4703, 29961, 7390, 2190, 29918, 6007, 16975, 29918, 29925, 3491, 7982, 3816, 1311, 29889, 5630, 29918, 2671, 29962, 13, 13, 4706, 565, 7431, 29898, 5630, 29897, 529, 1583, 29889, 2848, 29918, 1195, 29901, 13, 9651, 25401, 17070, 29889, 8382, 703, 5630, 5229, 613, 2769, 543, 2848, 1159, 13, 9651, 736, 25219, 3591, 29898, 8824, 29892, 1583, 29889, 2704, 29918, 4906, 29897, 13, 13, 4706, 565, 1583, 29889, 14506, 29918, 7501, 1169, 1405, 29871, 29900, 322, 7431, 29898, 1525, 29918, 4571, 29954, 1806, 29903, 29889, 2886, 497, 29898, 5630, 876, 529, 1583, 29889, 14506, 29918, 7501, 1169, 29901, 13, 9651, 25401, 17070, 29889, 8382, 703, 5630, 5229, 613, 2769, 543, 14506, 29918, 7501, 1169, 1159, 13, 9651, 736, 25219, 3591, 29898, 8824, 29892, 1583, 29889, 2704, 29918, 4906, 29897, 13, 4706, 565, 1583, 29889, 14506, 29918, 13609, 4878, 1405, 29871, 29900, 322, 7431, 29898, 1525, 29918, 27998, 1001, 29889, 2886, 497, 29898, 5630, 876, 529, 1583, 29889, 14506, 29918, 13609, 4878, 29901, 13, 9651, 25401, 17070, 29889, 8382, 703, 5630, 5229, 613, 2769, 543, 14506, 29918, 13609, 4878, 1159, 13, 9651, 736, 25219, 3591, 29898, 8824, 29892, 1583, 29889, 2704, 29918, 4906, 29897, 13, 4706, 565, 1583, 29889, 14506, 29918, 21064, 4878, 1405, 29871, 29900, 322, 7431, 29898, 1525, 29918, 4897, 13171, 29889, 2886, 497, 29898, 5630, 876, 529, 1583, 29889, 14506, 29918, 13609, 4878, 29901, 13, 9651, 25401, 17070, 29889, 8382, 703, 5630, 5229, 613, 2769, 543, 14506, 29918, 21064, 4878, 1159, 13, 9651, 736, 25219, 3591, 29898, 8824, 29892, 1583, 29889, 2704, 29918, 4906, 29897, 13, 4706, 565, 1583, 29889, 14506, 29918, 18098, 29879, 1405, 29871, 29900, 29901, 13, 9651, 2302, 353, 29871, 29900, 13, 9651, 363, 5829, 297, 1583, 29889, 18098, 29918, 3090, 842, 29901, 13, 18884, 2302, 4619, 4800, 29889, 2798, 29898, 18098, 29897, 13, 9651, 565, 2302, 529, 1583, 29889, 14506, 29918, 18098, 29879, 29901, 13, 18884, 25401, 17070, 29889, 8382, 703, 5630, 5229, 613, 2769, 543, 14506, 29918, 18098, 29879, 1159, 13, 18884, 736, 25219, 3591, 29898, 8824, 29892, 1583, 29889, 2704, 29918, 4906, 29897, 13, 13, 4706, 736, 25219, 3591, 29898, 5574, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 13, 4706, 26952, 29918, 978, 353, 903, 703, 10048, 25219, 1159, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 903, 703, 10048, 2043, 293, 583, 1159, 13, 2 ]
Database/splParser/databaseconnection.py
snapmeds/snapmeds
1
134492
# -*- coding: utf-8 -*- import urllib2, urllib import drug def write_to_database(drug): mydata = get_array_of_tuples_from_drug(drug) mydata = mydata + [("username","YOURUSERNAMEHERE"),("password","<PASSWORD>")] mydata=urllib.urlencode(mydata) print mydata path='YOURDATABASEURL' req=urllib2.Request(path, mydata) req.add_header("Content-type", "application/x-www-form-urlencoded") page=urllib2.urlopen(req).read() return convert(page) def convert(input): if isinstance(input, dict): return {convert(key): convert(value) for key, value in input.iteritems()} elif isinstance(input, list): return [convert(element) for element in input] elif isinstance(input, unicode): return input.encode('utf-8') else: return input def get_array_of_tuples_from_drug(drug): ret = [] ret.append( ('setid',drug.setid)) ret.append( ('ndc',drug.ndc)) ret.append( ('warnings',drug.warnings)) ret.append( ('genericnames',drug.genericnames)) ret.append( ('uses',drug.uses)) ret.append( ('adversereactions',drug.adversereactions)) ret.append( ('boxwarnings',drug.boxwarnings)) ret.append( ('precautions',drug.precautions)) ret.append( ('conflictingconditions',drug.conflictingconditions)) ret.append( ('name', drug.name)) ret.append( ('medicationguide', drug.medicationguide)) return ret
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 30004, 13, 5215, 3142, 1982, 29906, 29892, 3142, 1982, 30004, 13, 5215, 15721, 30004, 13, 1753, 2436, 29918, 517, 29918, 9803, 29898, 29881, 11124, 1125, 30004, 13, 1678, 590, 1272, 353, 679, 29918, 2378, 29918, 974, 29918, 9161, 2701, 29918, 3166, 29918, 29881, 11124, 29898, 29881, 11124, 8443, 13, 1678, 590, 1272, 353, 590, 1272, 718, 518, 703, 6786, 3284, 29979, 22970, 11889, 5813, 5006, 4968, 703, 5630, 3284, 29966, 25711, 17013, 29958, 13531, 30004, 13, 1678, 590, 1272, 29922, 2271, 1982, 29889, 2271, 12508, 29898, 1357, 1272, 8443, 13, 1678, 1596, 590, 1272, 30004, 13, 1678, 2224, 2433, 29979, 22970, 25832, 27982, 4219, 29915, 30004, 13, 1678, 12428, 29922, 2271, 1982, 29906, 29889, 3089, 29898, 2084, 29892, 590, 1272, 8443, 13, 1678, 12428, 29889, 1202, 29918, 6672, 703, 3916, 29899, 1853, 613, 376, 6214, 29914, 29916, 29899, 1636, 29899, 689, 29899, 2271, 26716, 1159, 30004, 13, 1678, 1813, 29922, 2271, 1982, 29906, 29889, 332, 417, 2238, 29898, 7971, 467, 949, 26471, 13, 1678, 736, 3588, 29898, 3488, 8443, 13, 30004, 13, 1753, 3588, 29898, 2080, 1125, 30004, 13, 1678, 565, 338, 8758, 29898, 2080, 29892, 9657, 1125, 30004, 13, 4706, 736, 426, 13441, 29898, 1989, 1125, 3588, 29898, 1767, 29897, 363, 1820, 29892, 995, 297, 1881, 29889, 1524, 7076, 580, 8117, 13, 1678, 25342, 338, 8758, 29898, 2080, 29892, 1051, 1125, 30004, 13, 4706, 736, 518, 13441, 29898, 5029, 29897, 363, 1543, 297, 1881, 29962, 30004, 13, 1678, 25342, 338, 8758, 29898, 2080, 29892, 29104, 1125, 30004, 13, 4706, 736, 1881, 29889, 12508, 877, 9420, 29899, 29947, 1495, 30004, 13, 1678, 1683, 29901, 30004, 13, 4706, 736, 1881, 30004, 13, 4706, 6756, 13, 1753, 679, 29918, 2378, 29918, 974, 29918, 9161, 2701, 29918, 3166, 29918, 29881, 11124, 29898, 29881, 11124, 1125, 30004, 13, 1678, 3240, 353, 5159, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 842, 333, 742, 29881, 11124, 29889, 842, 333, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 299, 29883, 742, 29881, 11124, 29889, 299, 29883, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 25442, 886, 742, 29881, 11124, 29889, 25442, 886, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 19206, 7039, 742, 29881, 11124, 29889, 19206, 7039, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 6394, 742, 29881, 11124, 29889, 6394, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 328, 874, 406, 7387, 742, 29881, 11124, 29889, 328, 874, 406, 7387, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 1884, 25442, 886, 742, 29881, 11124, 29889, 1884, 25442, 886, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 1457, 1113, 17925, 742, 29881, 11124, 29889, 1457, 1113, 17925, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 5527, 506, 1259, 1116, 2187, 742, 29881, 11124, 29889, 5527, 506, 1259, 1116, 2187, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 978, 742, 15721, 29889, 978, 876, 30004, 13, 1678, 3240, 29889, 4397, 29898, 6702, 2168, 293, 362, 13075, 742, 15721, 29889, 2168, 293, 362, 13075, 876, 30004, 13, 1678, 736, 3240, 30004, 13, 30004, 13, 268, 2 ]
dpkt/vrrp.py
lkash/test
0
164732
<gh_stars>0 # $Id: vrrp.py 88 2013-03-05 19:43:17Z <EMAIL> $ # -*- coding: utf-8 -*- """Virtual Router Redundancy Protocol.""" import dpkt from decorators import deprecated class VRRP(dpkt.Packet): __hdr__ = ( ('_v_type', 'B', 0x21), ('vrid', 'B', 0), ('priority', 'B', 0), ('count', 'B', 0), ('atype', 'B', 0), ('advtime', 'B', 0), ('sum', 'H', 0), ) addrs = () auth = '' @property def v(self): # high 4 bits of _v_type return self._v_type >> 4 @v.setter def v(self, v): self._v_type = (self._v_type & 0x0f) | (v << 4) @property def type(self): # low 4 bits of _v_type return self._v_type & 0x0f @type.setter def type(self, v): self._v_type = (self._v_type & 0xf0) | (v & 0x0f) # Deprecated methods, will be removed in the future # ================================================= @deprecated('v') def _get_v(self): return self.v @deprecated('v') def _set_v(self, v): self.v = v @deprecated('type') def _get_type(self): return self.type @deprecated('type') def _set_type(self, v): self.type = v # ================================================= def unpack(self, buf): dpkt.Packet.unpack(self, buf) l = [] off = 0 for off in range(0, 4 * self.count, 4): l.append(self.data[off:off + 4]) self.addrs = l self.auth = self.data[off + 4:] self.data = '' def __len__(self): return self.__hdr_len__ + (4 * self.count) + len(self.auth) def __str__(self): data = ''.join(self.addrs) + self.auth if not self.sum: self.sum = dpkt.in_cksum(self.pack_hdr() + data) return self.pack_hdr() + data def test_vrrp(): # no addresses s = '\x00\x00\x00\x00\x00\x00\xff\xff' v = VRRP(s) assert v.sum == 0xffff assert str(v) == s # have address s = '\x21\x01\x64\x01\x00\x01\xba\x52\xc0\xa8\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00' v = VRRP(s) assert v.count == 1 assert v.addrs == ['\xc0\xa8\x00\x01'] # 192.168.0.1 assert str(v) == s # test checksum generation v.sum = 0 assert str(v) == s # test length assert len(v) == len(s) # test getters assert v.v == 2 assert v.type == 1 # test setters v.v = 3 v.type = 2 assert str(v)[0] == '\x32' if __name__ == '__main__': test_vrrp() print 'Tests Successful...'
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 395, 1204, 29901, 11723, 19080, 29889, 2272, 29871, 29947, 29947, 29871, 29906, 29900, 29896, 29941, 29899, 29900, 29941, 29899, 29900, 29945, 29871, 29896, 29929, 29901, 29946, 29941, 29901, 29896, 29955, 29999, 529, 26862, 6227, 29958, 395, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 21287, 390, 5561, 4367, 870, 6906, 1019, 5770, 1213, 15945, 13, 13, 5215, 270, 29886, 1193, 13, 3166, 10200, 4097, 1053, 18164, 13, 13, 13, 1990, 478, 29934, 29934, 29925, 29898, 6099, 1193, 29889, 16638, 300, 1125, 13, 1678, 4770, 29882, 7707, 1649, 353, 313, 13, 4706, 6702, 29918, 29894, 29918, 1853, 742, 525, 29933, 742, 29871, 29900, 29916, 29906, 29896, 511, 13, 4706, 6702, 29894, 2429, 742, 525, 29933, 742, 29871, 29900, 511, 13, 4706, 6702, 29886, 21766, 742, 525, 29933, 742, 29871, 29900, 511, 13, 4706, 6702, 2798, 742, 525, 29933, 742, 29871, 29900, 511, 13, 4706, 6702, 23179, 742, 525, 29933, 742, 29871, 29900, 511, 13, 4706, 6702, 17263, 2230, 742, 525, 29933, 742, 29871, 29900, 511, 13, 4706, 6702, 2083, 742, 525, 29950, 742, 29871, 29900, 511, 13, 1678, 1723, 13, 1678, 788, 2288, 353, 3861, 13, 1678, 4817, 353, 6629, 13, 13, 1678, 732, 6799, 13, 1678, 822, 325, 29898, 1311, 1125, 29871, 396, 1880, 29871, 29946, 9978, 310, 903, 29894, 29918, 1853, 13, 4706, 736, 1583, 3032, 29894, 29918, 1853, 5099, 29871, 29946, 13, 13, 1678, 732, 29894, 29889, 842, 357, 13, 1678, 822, 325, 29898, 1311, 29892, 325, 1125, 13, 4706, 1583, 3032, 29894, 29918, 1853, 353, 313, 1311, 3032, 29894, 29918, 1853, 669, 29871, 29900, 29916, 29900, 29888, 29897, 891, 313, 29894, 3532, 29871, 29946, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1134, 29898, 1311, 1125, 29871, 396, 4482, 29871, 29946, 9978, 310, 903, 29894, 29918, 1853, 13, 4706, 736, 1583, 3032, 29894, 29918, 1853, 669, 29871, 29900, 29916, 29900, 29888, 13, 13, 1678, 732, 1853, 29889, 842, 357, 13, 1678, 822, 1134, 29898, 1311, 29892, 325, 1125, 13, 4706, 1583, 3032, 29894, 29918, 1853, 353, 313, 1311, 3032, 29894, 29918, 1853, 669, 29871, 29900, 24660, 29900, 29897, 891, 313, 29894, 669, 29871, 29900, 29916, 29900, 29888, 29897, 13, 13, 1678, 396, 897, 17990, 630, 3519, 29892, 674, 367, 6206, 297, 278, 5434, 13, 1678, 396, 1275, 9166, 9166, 4936, 2751, 25512, 13, 1678, 732, 311, 17990, 630, 877, 29894, 1495, 13, 1678, 822, 903, 657, 29918, 29894, 29898, 1311, 1125, 736, 1583, 29889, 29894, 13, 13, 1678, 732, 311, 17990, 630, 877, 29894, 1495, 13, 1678, 822, 903, 842, 29918, 29894, 29898, 1311, 29892, 325, 1125, 1583, 29889, 29894, 353, 325, 13, 13, 1678, 732, 311, 17990, 630, 877, 1853, 1495, 13, 1678, 822, 903, 657, 29918, 1853, 29898, 1311, 1125, 736, 1583, 29889, 1853, 13, 13, 1678, 732, 311, 17990, 630, 877, 1853, 1495, 13, 1678, 822, 903, 842, 29918, 1853, 29898, 1311, 29892, 325, 1125, 1583, 29889, 1853, 353, 325, 13, 1678, 396, 1275, 9166, 9166, 4936, 2751, 25512, 13, 13, 1678, 822, 443, 4058, 29898, 1311, 29892, 18392, 1125, 13, 4706, 270, 29886, 1193, 29889, 16638, 300, 29889, 348, 4058, 29898, 1311, 29892, 18392, 29897, 13, 4706, 301, 353, 5159, 13, 4706, 1283, 353, 29871, 29900, 13, 4706, 363, 1283, 297, 3464, 29898, 29900, 29892, 29871, 29946, 334, 1583, 29889, 2798, 29892, 29871, 29946, 1125, 13, 9651, 301, 29889, 4397, 29898, 1311, 29889, 1272, 29961, 2696, 29901, 2696, 718, 29871, 29946, 2314, 13, 4706, 1583, 29889, 1202, 2288, 353, 301, 13, 4706, 1583, 29889, 5150, 353, 1583, 29889, 1272, 29961, 2696, 718, 29871, 29946, 17531, 13, 4706, 1583, 29889, 1272, 353, 6629, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 1583, 17255, 29882, 7707, 29918, 2435, 1649, 718, 313, 29946, 334, 1583, 29889, 2798, 29897, 718, 7431, 29898, 1311, 29889, 5150, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 848, 353, 525, 4286, 7122, 29898, 1311, 29889, 1202, 2288, 29897, 718, 1583, 29889, 5150, 13, 4706, 565, 451, 1583, 29889, 2083, 29901, 13, 9651, 1583, 29889, 2083, 353, 270, 29886, 1193, 29889, 262, 29918, 384, 2083, 29898, 1311, 29889, 4058, 29918, 29882, 7707, 580, 718, 848, 29897, 13, 4706, 736, 1583, 29889, 4058, 29918, 29882, 7707, 580, 718, 848, 13, 13, 13, 1753, 1243, 29918, 13416, 19080, 7295, 13, 1678, 396, 694, 14157, 13, 1678, 269, 353, 11297, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 600, 29905, 29916, 600, 29915, 13, 1678, 325, 353, 478, 29934, 29934, 29925, 29898, 29879, 29897, 13, 1678, 4974, 325, 29889, 2083, 1275, 29871, 29900, 29916, 17156, 13, 1678, 4974, 851, 29898, 29894, 29897, 1275, 269, 13, 13, 1678, 396, 505, 3211, 13, 1678, 269, 353, 11297, 29916, 29906, 29896, 29905, 29916, 29900, 29896, 29905, 29916, 29953, 29946, 29905, 29916, 29900, 29896, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29896, 29905, 29916, 2291, 29905, 29916, 29945, 29906, 29905, 21791, 29900, 29905, 17367, 29947, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29896, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29915, 13, 1678, 325, 353, 478, 29934, 29934, 29925, 29898, 29879, 29897, 13, 1678, 4974, 325, 29889, 2798, 1275, 29871, 29896, 13, 1678, 4974, 325, 29889, 1202, 2288, 1275, 6024, 29905, 21791, 29900, 29905, 17367, 29947, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29896, 2033, 29871, 396, 29871, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29900, 29889, 29896, 13, 1678, 4974, 851, 29898, 29894, 29897, 1275, 269, 13, 13, 1678, 396, 1243, 1423, 2083, 12623, 13, 1678, 325, 29889, 2083, 353, 29871, 29900, 13, 1678, 4974, 851, 29898, 29894, 29897, 1275, 269, 13, 13, 1678, 396, 1243, 3309, 13, 1678, 4974, 7431, 29898, 29894, 29897, 1275, 7431, 29898, 29879, 29897, 13, 13, 1678, 396, 1243, 679, 2153, 13, 1678, 4974, 325, 29889, 29894, 1275, 29871, 29906, 13, 1678, 4974, 325, 29889, 1853, 1275, 29871, 29896, 13, 13, 1678, 396, 1243, 731, 2153, 13, 1678, 325, 29889, 29894, 353, 29871, 29941, 13, 1678, 325, 29889, 1853, 353, 29871, 29906, 13, 1678, 4974, 851, 29898, 29894, 9601, 29900, 29962, 1275, 11297, 29916, 29941, 29906, 29915, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1243, 29918, 13416, 19080, 580, 13, 13, 1678, 1596, 525, 24376, 21397, 1319, 856, 29915, 13, 2 ]
projeto_sensorino.py
rafaelbeloduarte/leitor_arduino
0
81251
# -*- coding: utf-8 -*- import tkinter import serial import serial.tools.list_ports import threading from tkinter import filedialog from tkinter import * import sys import os from tkinter import messagebox from tkinter.scrolledtext import ScrolledText import matplotlib.pyplot as plt import matplotlib.animation as animation # funções------------------------------------------------------------------------------------- def sel(): # LISTA AS PORTAS DISPONÍVEIS comlist = serial.tools.list_ports.comports() connected = [] for element in comlist: connected.append(element.device) def graficoinst(): plt.close() fig = plt.figure() grafico = open('grafico.dat', 'r').read() vetores = grafico.split('\n') vetores = filter(None, vetores) vetores = list(vetores) for i in range(len(vetores)): aux = vetores[i].split(",") for j in range(len(aux)): aux[j] = float(aux[j]) vetores[i] = aux matriz_graf = vetores plt.clf() eixo = fig.add_subplot(1, 1, 1) eixo.plot(matriz_graf) # eixo.legend() plt.show() def grafico(): plt.close() fig = plt.figure() def animar(i): grafico = open('grafico.dat', 'r').read() vetores = grafico.split('\n') vetores = filter(None, vetores) vetores = list(vetores) for i in range(len(vetores)): aux = vetores[i].split(",") for j in range(len(aux)): aux[j] = float(aux[j]) vetores[i] = aux matriz_graf = vetores plt.clf() eixo = fig.add_subplot(1, 1, 1) eixo.plot(matriz_graf) # eixo.legend() ani = animation.FuncAnimation(fig, animar, interval=1000) plt.show() def selbaud(): text.insert(END, "\nBaudrate: " + str(varbaud.get()) + "\n") text.see(END) def handle_leitura(): try: ser = serial.Serial(var.get(), baudrate=varbaud.get(), timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS) ser.close() except Exception as e: messagebox.showinfo("Eita!", "Erro: " + str(e) + "\nProvável causa: a porta já está sendo utilizada.", icon='error') return None if not var.get() or not varbaud.get(): messagebox.showinfo("Aviso!", "Selecione uma porta/baudrate.") return None if not n_texto.get(): messagebox.showinfo("Aviso!", "Por favor, informe o número de entradas.") return None try: salvararquivo = filedialog.asksaveasfilename(defaultextension=".txt", initialfile="dados") arquivousuario = open(salvararquivo, 'w') arquivousuario.close() arquivo_sinal = open(salvararquivo.replace(".txt", "") + "_sinal.txt", "w") arquivo_sinal.close() except Exception as e: messagebox.showinfo(e) return None ser = serial.Serial(var.get(), baudrate=varbaud.get(), timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS) instr_arquivo = Label(top, text="Para finalizar a leitura apenas feche o programa, seus dados são salvos automaticamente.") instr_arquivo.grid(row = 1, column=1, columnspan=5) instr_arquivo.configure(background='blue', foreground='white', borderwidth=3, relief='groove') def iniciar(): # Esta função lê o inpu # t da porta selecionada i_limpa_texto = 0 arquivousuario = open(salvararquivo, 'a') arquivo_sinal = open(salvararquivo.replace(".txt", "") + "_sinal.txt", 'a') rol = IntVar() rol_parar = Radiobutton(top, text="Parar rolagem", variable=rol, value=0) rol_parar.grid(row=20, column=2, columnspan = 1) rol_parar.configure(background='#F2F2F2', indicatoron=0, width=15) rol_iniciar = Radiobutton(top, text="Auto rolagem", variable=rol, value=1) rol_iniciar.grid(row=20, column=3, columnspan=1) rol_iniciar.configure(background='#F2F2F2', indicatoron=0, width=15) rol_iniciar.select() graf = open("grafico.dat", 'w') graf.close() if os.path.isfile(abre_poli.get()) == False and os.path.isfile("polinomios.txt") == False: messagebox.showinfo("Atenção!", "Arquivo não encontrado, o sinal será apresentado nu.") poli = open("polinomios.txt", 'w') n_entradas = int(n_texto.get()) for i in range(n_entradas): poli.write("1 0\n") if abre_poli.get(): if os.stat(abre_poli.get()).st_size == 0: messagebox.showinfo("Atenção!", "Arquivo vazio, será preenchido com y=x.") poli = open(abre_poli.get(), 'w') n_entradas = int(n_texto.get()) for i in range(n_entradas): poli.write("1 0\n") poli.close() poli = open(abre_poli.get()).readlines() i = 0 linhas = i + 1 if linhas < int(n_texto.get()): messagebox.showinfo("Atenção!", "Número de equações menor que o número de entradas. Os sinais das entradas restantes serão exibidos inalterados.") escrever_polinomios = open(abre_poli.get(), 'a') restantes = int(n_texto.get()) - len(poli) for i in range(restantes): escrever_polinomios.write("1 0\n") escrever_polinomios.close() else: poli = open("polinomios.txt").readlines() i = 0 with open("polinomios.txt") as arquivo: for i, arquivo in enumerate(arquivo): pass linhas = i + 1 if linhas < int(n_texto.get()): messagebox.showinfo("Atenção!", "Número de equações menor que o número de entradas. Os sinais das entradas restantes serão exibidos inalterados.") escrever_polinomios = open("polinomios.txt", 'a') restantes = int(n_texto.get()) - len(poli) for i in range(restantes): escrever_polinomios.write("1 0\n") escrever_polinomios.close() for i in range(len(poli)): poli[i] = poli[i].replace("\n", "").split(" ") for i in range(len(poli)): for j in range(len(poli[i])): poli[i][j] = float(poli[i][j]) text.insert(END, "\n" + str(poli) + "\n\n") text.see(END) try: # LOOP DE LEITURA while True: serial_bytes = ser.readline() serial_texto = serial_bytes.decode('utf-8') a = serial_texto.split(' ') graf = open("grafico.dat", 'a') dados = [] lista_dados = [] if a: dados = '[%s]' % ', '.join(map(str, a)) # map serve para aplicarmos uma função a cada elemento de uma lista, # retornando uma nova lista contendo os elementos resultantes da aplicação da função. # The %s token allows to insert (and potentially format) a string. # Notice that the %s token is replaced by whatever I pass to the string after the % symbol. dados = dados.replace('\n', '').replace('\r', '').replace('[', '').replace(']', '').replace(" ", "").replace("'", "") lista_dados = dados.split(",") lista_dados = filter(None, lista_dados) lista_dados = list(lista_dados) for i in range(len(lista_dados)): lista_dados[i] = float(lista_dados[i]) if lista_dados: for i in range(len(poli)): lista_dados[i] = poli[i][0]*lista_dados[i] + poli[i][1] arquivousuario.write(str(lista_dados).replace('[', '').replace(']', '') + '\n') arquivousuario.flush() arquivo_sinal.write(dados + '\n') arquivo_sinal.flush() graf.write(str(lista_dados).replace('[', '').replace(']', '') + '\n') graf.flush() text.insert(END, str(lista_dados).replace('[', '').replace(']', '') + '\n') if rol.get() == 1: text.see(END) i_limpa_texto += 1 if i_limpa_texto > 1000: text.delete(1.0, END) graf = open('grafico.dat', 'r+') graf.truncate(0) i_limpa_texto = 0 if limpar_graf.get() == 1: graf = open('grafico.dat', 'w') graf.truncate(0) limpar_graf.set(0) # time.sleep(1) except Exception as e: messagebox.showinfo("Erro!", "Erro: " + str(e), icon='error') pass ser.close() graf.close() arquivousuario.close() arquivo_sinal.close() # poli.close() t = threading.Thread(target=iniciar) t.daemon = True t.start() def atualizarporta(): portas_sub_menu.delete(0, 'end') var.set("") ports = list(serial.tools.list_ports.comports()) comlist = serial.tools.list_ports.comports() connected = [] for element in comlist: connected.append(element.device) for i in range(len(ports)): ports[i] = str(ports[i]) for k in range(len(connected)): portas_sub_menu.add_radiobutton(label = connected[k], variable=var, value=str(connected[k]), command=sel) if "Arduino" or "Serial USB" in ports[k]: var.set(str(connected[k])) portas_sub_menu.activate(k) text.insert(END, "\nPorta selecionada: " + str(var.get()) + "\n") text.see(END) def reiniciar(): if messagebox.askokcancel("Reiniciando...", "Tem certeza?"): python = sys.executable os.execl(python, python, *sys.argv) else: return None def fechando(): if messagebox.askokcancel("Fechando...", "Tem certeza?"): plt.close('all') top.destroy() # fim das funções----------------------------------------------------------------------------- # Código para os widgets vai aqui.------------------------------------------------------------ # define a janela principal---------------------------------- top = tkinter.Tk() top.wm_title("Sensorino Salva!") top.minsize(500, 500) top.geometry("950x600") top.configure(background='#000000') # ----------------------------------------------------------- comlist = serial.tools.list_ports.comports() connected = [] for element in comlist: connected.append(element.device) if not connected: messagebox.showinfo("Aviso!", "Nenhuma porta disponível, verifique se seu dispositivo está conectado.") label_n = Label(top, text = "Número de entradas:") label_n.grid(row = 2, column = 1, columnspan = 2, padx = 10, pady = 10) label_n.configure(background='#000000', foreground='white', width = 20) n_texto = StringVar() n = Entry(top, textvariable = n_texto) n.grid(row = 2, column=3, padx = 10, pady = 10) n.configure(width = 10) label_eqs = Label(top, text = "Equação da reta: y = a*x+b, padrão: y=x") label_eqs.grid(row = 2, column = 6, columnspan = 3) label_eqs.configure(background='#000000', foreground='white') label_a = Label(top, text = "a:") label_a.grid(row = 3, column = 6) label_a.configure(background='#000000', foreground='white') arquivo_coef = open("polinomios.txt", 'w') arquivo_coef.close() abre_poli = StringVar() def abre_polinomio(): try: abre_poli.set(filedialog.askopenfilename(initialdir = "",title = "Selecione seu arquivo",filetypes = (("Arquivo de texto","*.txt"),("Todos os arquivos","*.*")))) if abre_poli.get(): text.insert(END, "\nCarregado com sucesso.\n") text.see(END) except Exception as e: messagebox.showinfo(e) return None button_abre_poli = Button(top, text = "Carregar equações", command = abre_polinomio) button_abre_poli.grid(row=6, column=7) button_abre_poli.configure(activebackground='#000000', activeforeground='#FFFFFF') def pega_coef(): if not n_texto.get(): messagebox.showinfo("Aviso!", "Por favor, informe o número de entradas.") return None coef_a = a.get() coef_b = b.get() text.insert(END, "y = " + coef_a + "*x" + " + " + coef_b + '\n') text.see(END) arquivo_coef = open("polinomios.txt", 'a') arquivo_coef.write(coef_a + " ") arquivo_coef.write(coef_b + "\n") arquivo_coef.close() a.delete(0, END) b.delete(0, END) arquivo_coef.close() def salva_polinomio(): try: salvar_poli = filedialog.asksaveasfilename(defaultextension=".txt", initialfile="meus_polinomios") arquivo_poli = open(salvar_poli, 'w') texto = open("polinomios.txt").read() texto = texto.replace('\r', '').replace('[', '').replace(']', '').replace(",", "").replace("'", "") arquivo_poli.write(texto) arquivo_poli.close() except Exception as e: messagebox.showinfo(e) return None limpar_graf = IntVar() def limpar_graf_estado(): limpar_graf.set(1) button_salva_poli = Button(top, text = "Salvar equações", command = salva_polinomio) button_salva_poli.grid(row=5, column=7) button_salva_poli.configure(activebackground='#000000', activeforeground='#FFFFFF') a_texto = StringVar() a = Entry(top, textvariable = a_texto) a.grid(row=3, column=7) label_b = Label(top, text = "b:") label_b.grid(row = 4, column = 6) label_b.configure(background='#000000', foreground='white') b_texto = StringVar() b = Entry(top, textvariable = b_texto) b.grid(row=4, column=7) button_entrar = Button(top, text = "Inserir", command = pega_coef) button_entrar.grid(row=3, column=8, rowspan = 2, padx = 15) button_entrar.configure(activebackground='#000000', activeforeground='#FFFFFF') text = ScrolledText(top, width=50, height=20) text.grid(row=3, column=1, columnspan=5, rowspan=10, padx = 10, pady = 10) text.insert(END, " INSTRUÇÕES\n") text.insert(END, "\n") text.insert(END, ">O loop de seu controlador deve\nretornar os dados da seguinte forma:\n") text.insert(END, "a b c ...\n") text.insert(END, "Ex: 1 2 3 4 5\n") text.insert(END, "\n>Declare o número de entradas\nantes de iniciar a leitura.\n") text.insert(END, "\n") text.see(END) # criar menu menubar = Menu(top) menubar.add_command(label="Iniciar leitura", command=handle_leitura) graf_menu = Menu(menubar, tearoff=0) menubar.add_cascade(label="Gráficos", menu=graf_menu) graf_menu.add_command(label="Exibir gráfico em tempo real", command=grafico) graf_menu.add_command(label="Exibir gráfico", command=graficoinst) graf_menu.add_separator() graf_menu.add_command(label="Limpar gráfico", command=limpar_graf_estado) controlador_menu = Menu(menubar, tearoff=0) menubar.add_cascade(label="Controlador", menu=controlador_menu) portas_sub_menu = Menu(controlador_menu, tearoff = 0) controlador_menu.add_cascade(label="Portas", menu=portas_sub_menu) var = StringVar() atualizarporta() baud_sub_menu = Menu(controlador_menu, tearoff = 0) controlador_menu.add_cascade(label = "Baudrate", menu = baud_sub_menu) # pega o baud rate, varbaud é o baudrate=============================================== #4800, 9600, 38400, 57600, 115200, 230400 varbaud = IntVar() baud_sub_menu.add_radiobutton(label = "4800", variable = varbaud, value = 4800, command = selbaud) baud_sub_menu.add_radiobutton(label = "9600", variable = varbaud, value = 9600, command = selbaud) baud_sub_menu.add_radiobutton(label = "38400", variable = varbaud, value = 38400, command = selbaud) baud_sub_menu.add_radiobutton(label = "57600", variable = varbaud, value = 57600, command = selbaud) baud_sub_menu.add_radiobutton(label = "115200", variable = varbaud, value = 115200, command = selbaud) baud_sub_menu.add_radiobutton(label = "230400", variable = varbaud, value = 230400, command = selbaud) baud_sub_menu.invoke(1) # ===================================================================================== controlador_menu.add_separator() controlador_menu.add_command(label = "Atualizar portas", command = atualizarporta) sair_menu = Menu(menubar, tearoff=0) menubar.add_cascade(label="Sair/Reiniciar", menu=sair_menu) sair_menu.add_command(label = "Reiniciar", command = reiniciar) sair_menu.add_command(label="Sair", command=fechando) # mostrar o menu top.config(menu=menubar) # chama o mainloop -> abre a janela com os itens anteriores top.protocol("WM_DELETE_WINDOW", fechando) top.mainloop()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 5215, 18883, 1639, 30004, 13, 5215, 7797, 30004, 13, 5215, 7797, 29889, 8504, 29889, 1761, 29918, 4011, 30004, 13, 5215, 3244, 292, 30004, 13, 3166, 18883, 1639, 1053, 934, 15901, 30004, 13, 3166, 18883, 1639, 1053, 334, 30004, 13, 5215, 10876, 30004, 13, 5215, 2897, 30004, 13, 3166, 18883, 1639, 1053, 2643, 1884, 30004, 13, 3166, 18883, 1639, 29889, 1557, 24476, 726, 1053, 2522, 24476, 1626, 30004, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 30004, 13, 5215, 22889, 29889, 18962, 408, 9612, 30004, 13, 30004, 13, 29937, 2090, 5616, 2683, 2683, 2683, 2683, 2683, 23648, 30004, 13, 30004, 13, 1753, 5535, 7295, 30004, 13, 1678, 396, 365, 9047, 29909, 3339, 349, 8476, 3289, 28657, 29925, 1164, 30175, 12064, 3235, 30004, 13, 1678, 419, 1761, 353, 7797, 29889, 8504, 29889, 1761, 29918, 4011, 29889, 510, 4011, 26471, 13, 1678, 6631, 353, 5159, 30004, 13, 1678, 363, 1543, 297, 419, 1761, 29901, 30004, 13, 4706, 6631, 29889, 4397, 29898, 5029, 29889, 10141, 8443, 13, 30004, 13, 1753, 22956, 1417, 2611, 7295, 30004, 13, 1678, 14770, 29889, 5358, 26471, 13, 1678, 2537, 353, 14770, 29889, 4532, 26471, 13, 1678, 22956, 1417, 353, 1722, 877, 29887, 1929, 1417, 29889, 4130, 742, 525, 29878, 2824, 949, 26471, 13, 1678, 325, 300, 2361, 353, 22956, 1417, 29889, 5451, 28909, 29876, 1495, 30004, 13, 1678, 325, 300, 2361, 353, 4175, 29898, 8516, 29892, 325, 300, 2361, 8443, 13, 1678, 325, 300, 2361, 353, 1051, 29898, 5990, 2361, 8443, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 5990, 2361, 22164, 30004, 13, 4706, 3479, 353, 325, 300, 2361, 29961, 29875, 1822, 5451, 28165, 1159, 30004, 13, 4706, 363, 432, 297, 3464, 29898, 2435, 29898, 2993, 22164, 30004, 13, 9651, 3479, 29961, 29926, 29962, 353, 5785, 29898, 2993, 29961, 29926, 2314, 30004, 13, 4706, 325, 300, 2361, 29961, 29875, 29962, 353, 3479, 30004, 13, 1678, 1775, 7485, 29918, 29887, 1929, 353, 325, 300, 2361, 30004, 13, 1678, 14770, 29889, 695, 29888, 26471, 13, 1678, 321, 861, 29877, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 8443, 13, 1678, 321, 861, 29877, 29889, 5317, 29898, 2922, 7485, 29918, 29887, 1929, 8443, 13, 259, 396, 321, 861, 29877, 29889, 26172, 26471, 13, 1678, 14770, 29889, 4294, 26471, 13, 30004, 13, 1753, 22956, 1417, 7295, 30004, 13, 1678, 14770, 29889, 5358, 26471, 13, 1678, 2537, 353, 14770, 29889, 4532, 26471, 13, 1678, 822, 3778, 279, 29898, 29875, 1125, 30004, 13, 4706, 22956, 1417, 353, 1722, 877, 29887, 1929, 1417, 29889, 4130, 742, 525, 29878, 2824, 949, 26471, 13, 4706, 325, 300, 2361, 353, 22956, 1417, 29889, 5451, 28909, 29876, 1495, 30004, 13, 4706, 325, 300, 2361, 353, 4175, 29898, 8516, 29892, 325, 300, 2361, 8443, 13, 4706, 325, 300, 2361, 353, 1051, 29898, 5990, 2361, 8443, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 5990, 2361, 22164, 30004, 13, 9651, 3479, 353, 325, 300, 2361, 29961, 29875, 1822, 5451, 28165, 1159, 30004, 13, 9651, 363, 432, 297, 3464, 29898, 2435, 29898, 2993, 22164, 30004, 13, 18884, 3479, 29961, 29926, 29962, 353, 5785, 29898, 2993, 29961, 29926, 2314, 30004, 13, 9651, 325, 300, 2361, 29961, 29875, 29962, 353, 3479, 30004, 13, 4706, 1775, 7485, 29918, 29887, 1929, 353, 325, 300, 2361, 30004, 13, 4706, 14770, 29889, 695, 29888, 26471, 13, 4706, 321, 861, 29877, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 8443, 13, 4706, 321, 861, 29877, 29889, 5317, 29898, 2922, 7485, 29918, 29887, 1929, 8443, 13, 4706, 396, 321, 861, 29877, 29889, 26172, 26471, 13, 1678, 26448, 353, 9612, 29889, 14400, 13579, 29898, 1003, 29892, 3778, 279, 29892, 7292, 29922, 29896, 29900, 29900, 29900, 8443, 13, 1678, 14770, 29889, 4294, 26471, 13, 30004, 13, 1753, 5535, 2291, 566, 7295, 30004, 13, 1678, 1426, 29889, 7851, 29898, 11794, 29892, 6634, 29876, 29933, 15052, 10492, 29901, 376, 718, 851, 29898, 1707, 2291, 566, 29889, 657, 3101, 718, 6634, 29876, 1159, 30004, 13, 1678, 1426, 29889, 4149, 29898, 11794, 8443, 13, 30004, 13, 1753, 4386, 29918, 280, 277, 2002, 7295, 30004, 13, 1678, 1018, 29901, 30004, 13, 4706, 724, 353, 7797, 29889, 9125, 29898, 1707, 29889, 657, 3285, 9922, 566, 10492, 29922, 1707, 2291, 566, 29889, 657, 3285, 11815, 29922, 29896, 29892, 610, 537, 29922, 15550, 29889, 16320, 11937, 29918, 29940, 12413, 11167, 13, 462, 9651, 5040, 14836, 29922, 15550, 29889, 1254, 4590, 22698, 29903, 29918, 12413, 11167, 13, 462, 9651, 6262, 675, 29922, 15550, 29889, 29923, 22530, 22698, 29903, 8443, 13, 4706, 724, 29889, 5358, 26471, 13, 1678, 5174, 8960, 408, 321, 29901, 30004, 13, 4706, 2643, 1884, 29889, 4294, 3888, 703, 29923, 2028, 29991, 613, 376, 2110, 307, 29901, 376, 718, 851, 29898, 29872, 29897, 718, 6634, 29876, 1184, 8274, 955, 13485, 29901, 263, 23344, 17333, 7919, 21324, 11824, 1114, 29889, 15231, 13, 462, 9651, 9849, 2433, 2704, 1495, 30004, 13, 4706, 736, 6213, 30004, 13, 30004, 13, 1678, 565, 451, 722, 29889, 657, 580, 470, 451, 722, 2291, 566, 29889, 657, 7295, 30004, 13, 4706, 2643, 1884, 29889, 4294, 3888, 703, 29909, 1730, 29877, 29991, 613, 376, 2008, 280, 29883, 1421, 3672, 23344, 29914, 2291, 566, 10492, 23157, 30004, 13, 4706, 736, 6213, 30004, 13, 30004, 13, 1678, 565, 451, 302, 29918, 726, 29877, 29889, 657, 7295, 30004, 13, 4706, 2643, 1884, 29889, 4294, 3888, 703, 29909, 1730, 29877, 29991, 613, 376, 29925, 272, 7853, 29892, 1871, 29872, 288, 13831, 316, 875, 3665, 294, 23157, 30004, 13, 4706, 736, 6213, 30004, 13, 30004, 13, 1678, 1018, 29901, 30004, 13, 4706, 4497, 1707, 19862, 4243, 353, 934, 15901, 29889, 1278, 7620, 294, 9507, 29898, 1753, 29874, 352, 726, 2673, 29569, 3945, 613, 2847, 1445, 543, 29881, 2255, 1159, 30004, 13, 4706, 19325, 440, 681, 22223, 353, 1722, 29898, 19585, 1707, 19862, 4243, 29892, 525, 29893, 1495, 30004, 13, 4706, 19325, 440, 681, 22223, 29889, 5358, 26471, 13, 4706, 19325, 4243, 29918, 29879, 979, 353, 1722, 29898, 19585, 1707, 19862, 4243, 29889, 6506, 17350, 3945, 613, 20569, 718, 11119, 29879, 979, 29889, 3945, 613, 376, 29893, 1159, 30004, 13, 4706, 19325, 4243, 29918, 29879, 979, 29889, 5358, 26471, 13, 1678, 5174, 8960, 408, 321, 29901, 30004, 13, 4706, 2643, 1884, 29889, 4294, 3888, 29898, 29872, 8443, 13, 4706, 736, 6213, 30004, 13, 1678, 724, 353, 7797, 29889, 9125, 29898, 1707, 29889, 657, 3285, 9922, 566, 10492, 29922, 1707, 2291, 566, 29889, 657, 3285, 11815, 29922, 29896, 29892, 610, 537, 29922, 15550, 29889, 16320, 11937, 29918, 29940, 12413, 11167, 13, 462, 4706, 5040, 14836, 29922, 15550, 29889, 1254, 4590, 22698, 29903, 29918, 12413, 29892, 6262, 675, 29922, 15550, 29889, 29923, 22530, 22698, 29903, 8443, 13, 30004, 13, 1678, 297, 710, 29918, 19862, 4243, 353, 15796, 29898, 3332, 29892, 1426, 543, 2177, 29874, 2186, 15356, 263, 454, 277, 2002, 22321, 1238, 1173, 288, 16914, 29892, 11018, 270, 2255, 12777, 4497, 23517, 18428, 2503, 23157, 30004, 13, 1678, 297, 710, 29918, 19862, 4243, 29889, 7720, 29898, 798, 353, 29871, 29896, 29892, 1897, 29922, 29896, 29892, 1897, 9653, 29922, 29945, 8443, 13, 1678, 297, 710, 29918, 19862, 4243, 29889, 17591, 29898, 7042, 2433, 9539, 742, 363, 18128, 2433, 10921, 742, 5139, 2103, 29922, 29941, 29892, 18892, 2433, 17170, 994, 1495, 30004, 13, 30004, 13, 1678, 822, 21855, 279, 7295, 29871, 396, 14192, 2090, 2340, 301, 30037, 288, 297, 3746, 30004, 13, 4706, 396, 260, 1146, 23344, 16954, 12401, 1114, 30004, 13, 4706, 474, 29918, 2576, 3274, 29918, 726, 29877, 353, 29871, 29900, 30004, 13, 30004, 13, 4706, 19325, 440, 681, 22223, 353, 1722, 29898, 19585, 1707, 19862, 4243, 29892, 525, 29874, 1495, 30004, 13, 4706, 19325, 4243, 29918, 29879, 979, 353, 1722, 29898, 19585, 1707, 19862, 4243, 29889, 6506, 17350, 3945, 613, 20569, 718, 11119, 29879, 979, 29889, 3945, 613, 525, 29874, 1495, 30004, 13, 4706, 14467, 353, 3159, 9037, 26471, 13, 30004, 13, 4706, 14467, 29918, 862, 279, 353, 9204, 3092, 29898, 3332, 29892, 1426, 543, 2177, 279, 696, 3110, 331, 613, 2286, 29922, 1467, 29892, 995, 29922, 29900, 8443, 13, 4706, 14467, 29918, 862, 279, 29889, 7720, 29898, 798, 29922, 29906, 29900, 29892, 1897, 29922, 29906, 29892, 1897, 9653, 353, 29871, 29896, 8443, 13, 4706, 14467, 29918, 862, 279, 29889, 17591, 29898, 7042, 2433, 29937, 29943, 29906, 29943, 29906, 29943, 29906, 742, 27717, 265, 29922, 29900, 29892, 2920, 29922, 29896, 29945, 8443, 13, 30004, 13, 4706, 14467, 29918, 262, 1654, 279, 353, 9204, 3092, 29898, 3332, 29892, 1426, 543, 12300, 696, 3110, 331, 613, 2286, 29922, 1467, 29892, 995, 29922, 29896, 8443, 13, 4706, 14467, 29918, 262, 1654, 279, 29889, 7720, 29898, 798, 29922, 29906, 29900, 29892, 1897, 29922, 29941, 29892, 1897, 9653, 29922, 29896, 8443, 13, 4706, 14467, 29918, 262, 1654, 279, 29889, 17591, 29898, 7042, 2433, 29937, 29943, 29906, 29943, 29906, 29943, 29906, 742, 27717, 265, 29922, 29900, 29892, 2920, 29922, 29896, 29945, 8443, 13, 4706, 14467, 29918, 262, 1654, 279, 29889, 2622, 26471, 13, 30004, 13, 4706, 22956, 353, 1722, 703, 29887, 1929, 1417, 29889, 4130, 613, 525, 29893, 1495, 30004, 13, 4706, 22956, 29889, 5358, 26471, 13, 30004, 13, 4706, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 370, 276, 29918, 3733, 29875, 29889, 657, 3101, 1275, 7700, 322, 2897, 29889, 2084, 29889, 275, 1445, 703, 3733, 262, 290, 2363, 29889, 3945, 1159, 1275, 7700, 29901, 30004, 13, 9651, 2643, 1884, 29889, 4294, 3888, 703, 29909, 841, 2340, 29991, 613, 376, 1433, 339, 4243, 8145, 14567, 912, 29892, 288, 269, 979, 724, 29976, 24677, 912, 4948, 23157, 30004, 13, 9651, 1248, 29875, 353, 1722, 703, 3733, 262, 290, 2363, 29889, 3945, 613, 525, 29893, 1495, 30004, 13, 9651, 302, 29918, 296, 3665, 294, 353, 938, 29898, 29876, 29918, 726, 29877, 29889, 657, 3101, 30004, 13, 9651, 363, 474, 297, 3464, 29898, 29876, 29918, 296, 3665, 294, 1125, 30004, 13, 18884, 1248, 29875, 29889, 3539, 703, 29896, 29871, 29900, 29905, 29876, 1159, 30004, 13, 4706, 565, 633, 276, 29918, 3733, 29875, 29889, 657, 7295, 30004, 13, 9651, 565, 2897, 29889, 6112, 29898, 370, 276, 29918, 3733, 29875, 29889, 657, 16655, 303, 29918, 2311, 1275, 29871, 29900, 29901, 30004, 13, 18884, 2643, 1884, 29889, 4294, 3888, 703, 29909, 841, 2340, 29991, 613, 376, 1433, 339, 4243, 325, 834, 601, 29892, 724, 29976, 758, 264, 305, 1941, 419, 343, 29922, 29916, 23157, 30004, 13, 18884, 1248, 29875, 353, 1722, 29898, 370, 276, 29918, 3733, 29875, 29889, 657, 3285, 525, 29893, 1495, 30004, 13, 18884, 302, 29918, 296, 3665, 294, 353, 938, 29898, 29876, 29918, 726, 29877, 29889, 657, 3101, 30004, 13, 18884, 363, 474, 297, 3464, 29898, 29876, 29918, 296, 3665, 294, 1125, 30004, 13, 462, 1678, 1248, 29875, 29889, 3539, 703, 29896, 29871, 29900, 29905, 29876, 1159, 30004, 13, 18884, 1248, 29875, 29889, 5358, 26471, 13, 9651, 1248, 29875, 353, 1722, 29898, 370, 276, 29918, 3733, 29875, 29889, 657, 16655, 949, 9012, 26471, 13, 9651, 474, 353, 29871, 29900, 30004, 13, 9651, 6276, 5349, 353, 474, 718, 29871, 29896, 30004, 13, 9651, 565, 6276, 5349, 529, 938, 29898, 29876, 29918, 726, 29877, 29889, 657, 580, 1125, 30004, 13, 18884, 2643, 1884, 29889, 4294, 3888, 703, 29909, 841, 2340, 29991, 613, 376, 29940, 30030, 1050, 29877, 316, 1592, 25463, 26764, 712, 288, 13831, 316, 875, 3665, 294, 29889, 6657, 269, 1099, 275, 1697, 875, 3665, 294, 1791, 3794, 724, 1368, 429, 747, 4396, 297, 13794, 2255, 23157, 30004, 13, 18884, 831, 1037, 369, 29918, 3733, 262, 290, 2363, 353, 1722, 29898, 370, 276, 29918, 3733, 29875, 29889, 657, 3285, 525, 29874, 1495, 30004, 13, 18884, 1791, 3794, 353, 938, 29898, 29876, 29918, 726, 29877, 29889, 657, 3101, 448, 7431, 29898, 3733, 29875, 8443, 13, 18884, 363, 474, 297, 3464, 29898, 5060, 3794, 1125, 30004, 13, 462, 1678, 831, 1037, 369, 29918, 3733, 262, 290, 2363, 29889, 3539, 703, 29896, 29871, 29900, 29905, 29876, 1159, 30004, 13, 18884, 831, 1037, 369, 29918, 3733, 262, 290, 2363, 29889, 5358, 26471, 13, 4706, 1683, 29901, 30004, 13, 9651, 1248, 29875, 353, 1722, 703, 3733, 262, 290, 2363, 29889, 3945, 2564, 949, 9012, 26471, 13, 9651, 474, 353, 29871, 29900, 30004, 13, 9651, 411, 1722, 703, 3733, 262, 290, 2363, 29889, 3945, 1159, 408, 19325, 4243, 29901, 30004, 13, 18884, 363, 474, 29892, 19325, 4243, 297, 26985, 29898, 19862, 4243, 1125, 30004, 13, 462, 1678, 1209, 30004, 13, 9651, 6276, 5349, 353, 474, 718, 29871, 29896, 30004, 13, 9651, 565, 6276, 5349, 529, 938, 29898, 29876, 29918, 726, 29877, 29889, 657, 580, 1125, 30004, 13, 18884, 2643, 1884, 29889, 4294, 3888, 703, 29909, 841, 2340, 29991, 613, 376, 29940, 30030, 1050, 29877, 316, 1592, 25463, 26764, 712, 288, 13831, 316, 875, 3665, 294, 29889, 6657, 269, 1099, 275, 1697, 875, 3665, 294, 1791, 3794, 724, 1368, 429, 747, 4396, 297, 13794, 2255, 23157, 30004, 13, 18884, 831, 1037, 369, 29918, 3733, 262, 290, 2363, 353, 1722, 703, 3733, 262, 290, 2363, 29889, 3945, 613, 525, 29874, 1495, 30004, 13, 18884, 1791, 3794, 353, 938, 29898, 29876, 29918, 726, 29877, 29889, 657, 3101, 448, 7431, 29898, 3733, 29875, 8443, 13, 18884, 363, 474, 297, 3464, 29898, 5060, 3794, 1125, 30004, 13, 462, 1678, 831, 1037, 369, 29918, 3733, 262, 290, 2363, 29889, 3539, 703, 29896, 29871, 29900, 29905, 29876, 1159, 30004, 13, 18884, 831, 1037, 369, 29918, 3733, 262, 290, 2363, 29889, 5358, 26471, 13, 30004, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 3733, 29875, 22164, 30004, 13, 9651, 1248, 29875, 29961, 29875, 29962, 353, 1248, 29875, 29961, 29875, 1822, 6506, 14182, 29876, 613, 376, 2564, 5451, 703, 376, 8443, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 3733, 29875, 22164, 30004, 13, 9651, 363, 432, 297, 3464, 29898, 2435, 29898, 3733, 29875, 29961, 29875, 12622, 29901, 30004, 13, 18884, 1248, 29875, 29961, 29875, 3816, 29926, 29962, 353, 5785, 29898, 3733, 29875, 29961, 29875, 3816, 29926, 2314, 30004, 13, 4706, 1426, 29889, 7851, 29898, 11794, 29892, 6634, 29876, 29908, 718, 851, 29898, 3733, 29875, 29897, 718, 6634, 29876, 29905, 29876, 1159, 30004, 13, 4706, 1426, 29889, 4149, 29898, 11794, 8443, 13, 30004, 13, 4706, 1018, 29901, 30004, 13, 9651, 396, 11247, 4590, 5012, 11060, 1806, 4574, 29909, 30004, 13, 9651, 1550, 5852, 29901, 30004, 13, 18884, 7797, 29918, 13193, 353, 724, 29889, 949, 1220, 26471, 13, 18884, 7797, 29918, 726, 29877, 353, 7797, 29918, 13193, 29889, 13808, 877, 9420, 29899, 29947, 1495, 30004, 13, 18884, 263, 353, 7797, 29918, 726, 29877, 29889, 5451, 877, 525, 8443, 13, 18884, 22956, 353, 1722, 703, 29887, 1929, 1417, 29889, 4130, 613, 525, 29874, 1495, 30004, 13, 18884, 270, 2255, 353, 5159, 30004, 13, 18884, 15023, 29918, 29881, 2255, 353, 5159, 30004, 13, 18884, 565, 263, 29901, 30004, 13, 462, 1678, 270, 2255, 353, 525, 29961, 29995, 29879, 29962, 29915, 1273, 13420, 15300, 7122, 29898, 1958, 29898, 710, 29892, 263, 876, 30004, 13, 462, 1678, 396, 2910, 9080, 1702, 20760, 2817, 359, 3672, 2090, 2340, 263, 9747, 1543, 29877, 316, 3672, 15023, 11167, 13, 462, 1678, 396, 3240, 1398, 1743, 3672, 26121, 15023, 640, 2765, 2897, 29290, 1121, 3794, 1146, 20760, 8298, 1146, 2090, 2340, 22993, 13, 462, 1678, 396, 450, 1273, 29879, 5993, 6511, 304, 4635, 313, 392, 19998, 3402, 29897, 263, 1347, 22993, 13, 462, 1678, 396, 16393, 393, 278, 1273, 29879, 5993, 338, 8611, 491, 6514, 306, 1209, 304, 278, 1347, 1156, 278, 1273, 5829, 22993, 13, 462, 1678, 270, 2255, 353, 270, 2255, 29889, 6506, 28909, 29876, 742, 525, 2824, 6506, 28909, 29878, 742, 525, 2824, 6506, 877, 29961, 742, 525, 2824, 6506, 877, 29962, 742, 525, 2824, 6506, 703, 9162, 376, 2564, 6506, 703, 29915, 613, 20569, 30004, 13, 462, 1678, 15023, 29918, 29881, 2255, 353, 270, 2255, 29889, 5451, 28165, 1159, 30004, 13, 462, 1678, 15023, 29918, 29881, 2255, 353, 4175, 29898, 8516, 29892, 15023, 29918, 29881, 2255, 8443, 13, 462, 1678, 15023, 29918, 29881, 2255, 353, 1051, 29898, 19641, 29918, 29881, 2255, 8443, 13, 462, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 19641, 29918, 29881, 2255, 22164, 30004, 13, 462, 4706, 15023, 29918, 29881, 2255, 29961, 29875, 29962, 353, 5785, 29898, 19641, 29918, 29881, 2255, 29961, 29875, 2314, 30004, 13, 18884, 565, 15023, 29918, 29881, 2255, 29901, 30004, 13, 462, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 3733, 29875, 22164, 30004, 13, 462, 4706, 15023, 29918, 29881, 2255, 29961, 29875, 29962, 353, 1248, 29875, 29961, 29875, 3816, 29900, 14178, 19641, 29918, 29881, 2255, 29961, 29875, 29962, 718, 1248, 29875, 29961, 29875, 3816, 29896, 29962, 30004, 13, 462, 1678, 19325, 440, 681, 22223, 29889, 3539, 29898, 710, 29898, 19641, 29918, 29881, 2255, 467, 6506, 877, 29961, 742, 525, 2824, 6506, 877, 29962, 742, 27255, 718, 11297, 29876, 1495, 30004, 13, 462, 1678, 19325, 440, 681, 22223, 29889, 23126, 26471, 13, 462, 1678, 19325, 4243, 29918, 29879, 979, 29889, 3539, 29898, 29881, 2255, 718, 11297, 29876, 1495, 30004, 13, 462, 1678, 19325, 4243, 29918, 29879, 979, 29889, 23126, 26471, 13, 462, 1678, 22956, 29889, 3539, 29898, 710, 29898, 19641, 29918, 29881, 2255, 467, 6506, 877, 29961, 742, 525, 2824, 6506, 877, 29962, 742, 27255, 718, 11297, 29876, 1495, 30004, 13, 462, 1678, 22956, 29889, 23126, 26471, 13, 462, 1678, 1426, 29889, 7851, 29898, 11794, 29892, 851, 29898, 19641, 29918, 29881, 2255, 467, 6506, 877, 29961, 742, 525, 2824, 6506, 877, 29962, 742, 27255, 718, 11297, 29876, 1495, 30004, 13, 462, 1678, 565, 14467, 29889, 657, 580, 1275, 29871, 29896, 29901, 30004, 13, 462, 4706, 1426, 29889, 4149, 29898, 11794, 8443, 13, 462, 1678, 474, 29918, 2576, 3274, 29918, 726, 29877, 4619, 29871, 29896, 30004, 13, 18884, 565, 474, 29918, 2576, 3274, 29918, 726, 29877, 1405, 29871, 29896, 29900, 29900, 29900, 29901, 30004, 13, 462, 1678, 1426, 29889, 8143, 29898, 29896, 29889, 29900, 29892, 11056, 8443, 13, 30004, 13, 462, 1678, 22956, 353, 1722, 877, 29887, 1929, 1417, 29889, 4130, 742, 525, 29878, 29974, 1495, 30004, 13, 462, 1678, 22956, 29889, 509, 4661, 403, 29898, 29900, 8443, 13, 30004, 13, 462, 1678, 474, 29918, 2576, 3274, 29918, 726, 29877, 353, 29871, 29900, 30004, 13, 18884, 565, 2485, 862, 29918, 29887, 1929, 29889, 657, 580, 1275, 29871, 29896, 29901, 30004, 13, 462, 1678, 22956, 353, 1722, 877, 29887, 1929, 1417, 29889, 4130, 742, 525, 29893, 1495, 30004, 13, 462, 1678, 22956, 29889, 509, 4661, 403, 29898, 29900, 8443, 13, 30004, 13, 462, 1678, 2485, 862, 29918, 29887, 1929, 29889, 842, 29898, 29900, 8443, 13, 30004, 13, 18884, 396, 931, 29889, 17059, 29898, 29896, 8443, 13, 4706, 5174, 8960, 408, 321, 29901, 30004, 13, 9651, 2643, 1884, 29889, 4294, 3888, 703, 2110, 307, 29991, 613, 376, 2110, 307, 29901, 376, 718, 851, 29898, 29872, 511, 9849, 2433, 2704, 1495, 30004, 13, 9651, 1209, 30004, 13, 4706, 724, 29889, 5358, 26471, 13, 4706, 22956, 29889, 5358, 26471, 13, 4706, 19325, 440, 681, 22223, 29889, 5358, 26471, 13, 4706, 19325, 4243, 29918, 29879, 979, 29889, 5358, 26471, 13, 29937, 4706, 1248, 29875, 29889, 5358, 26471, 13, 30004, 13, 1678, 260, 353, 3244, 292, 29889, 4899, 29898, 5182, 29922, 262, 1654, 279, 8443, 13, 1678, 260, 29889, 1388, 9857, 353, 5852, 30004, 13, 1678, 260, 29889, 2962, 26471, 13, 30004, 13, 1753, 472, 950, 15356, 637, 29874, 7295, 30004, 13, 1678, 2011, 294, 29918, 1491, 29918, 6510, 29889, 8143, 29898, 29900, 29892, 525, 355, 1495, 30004, 13, 1678, 722, 29889, 842, 703, 1159, 30004, 13, 1678, 16169, 353, 1051, 29898, 15550, 29889, 8504, 29889, 1761, 29918, 4011, 29889, 510, 4011, 3101, 30004, 13, 1678, 419, 1761, 353, 7797, 29889, 8504, 29889, 1761, 29918, 4011, 29889, 510, 4011, 26471, 13, 1678, 6631, 353, 5159, 30004, 13, 1678, 363, 1543, 297, 419, 1761, 29901, 30004, 13, 4706, 6631, 29889, 4397, 29898, 5029, 29889, 10141, 8443, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 4011, 22164, 30004, 13, 4706, 16169, 29961, 29875, 29962, 353, 851, 29898, 4011, 29961, 29875, 2314, 30004, 13, 1678, 363, 413, 297, 3464, 29898, 2435, 29898, 18045, 22164, 30004, 13, 4706, 2011, 294, 29918, 1491, 29918, 6510, 29889, 1202, 29918, 13399, 3092, 29898, 1643, 353, 6631, 29961, 29895, 1402, 2286, 29922, 1707, 29892, 995, 29922, 710, 29898, 18045, 29961, 29895, 11724, 1899, 29922, 2838, 8443, 13, 4706, 565, 376, 1433, 28955, 29908, 470, 376, 9125, 12951, 29908, 297, 16169, 29961, 29895, 5387, 30004, 13, 9651, 722, 29889, 842, 29898, 710, 29898, 18045, 29961, 29895, 12622, 30004, 13, 9651, 2011, 294, 29918, 1491, 29918, 6510, 29889, 11236, 403, 29898, 29895, 8443, 13, 1678, 1426, 29889, 7851, 29898, 11794, 29892, 6634, 29876, 2290, 29874, 16954, 12401, 1114, 29901, 376, 718, 851, 29898, 1707, 29889, 657, 3101, 718, 6634, 29876, 1159, 30004, 13, 1678, 1426, 29889, 4149, 29898, 11794, 8443, 13, 30004, 13, 1753, 15561, 1654, 279, 7295, 30004, 13, 1678, 565, 2643, 1884, 29889, 1278, 554, 20713, 703, 1123, 262, 1654, 1743, 856, 613, 376, 5776, 5147, 371, 1362, 3026, 1125, 30004, 13, 4706, 3017, 353, 10876, 29889, 4258, 9246, 30004, 13, 4706, 2897, 29889, 4258, 29880, 29898, 4691, 29892, 3017, 29892, 334, 9675, 29889, 19218, 8443, 13, 1678, 1683, 29901, 30004, 13, 4706, 736, 6213, 30004, 13, 30004, 13, 1753, 1238, 305, 1743, 7295, 30004, 13, 1678, 565, 2643, 1884, 29889, 1278, 554, 20713, 703, 29943, 5309, 1743, 856, 613, 376, 5776, 5147, 371, 1362, 3026, 1125, 30004, 13, 4706, 14770, 29889, 5358, 877, 497, 1495, 30004, 13, 4706, 2246, 29889, 20524, 26471, 13, 30004, 13, 29937, 285, 326, 1697, 2090, 5616, 2683, 2683, 2683, 2683, 9072, 29899, 30004, 13, 30004, 13, 29937, 315, 17613, 1702, 2897, 11109, 29879, 325, 1794, 263, 6578, 29889, 2683, 2683, 2683, 9072, 30004, 13, 30004, 13, 29937, 4529, 263, 5496, 3100, 5882, 2683, 2683, 489, 30004, 13, 3332, 353, 18883, 1639, 29889, 29911, 29895, 26471, 13, 3332, 29889, 29893, 29885, 29918, 3257, 703, 29903, 6073, 1789, 3956, 1564, 29991, 1159, 30004, 13, 3332, 29889, 29885, 1144, 675, 29898, 29945, 29900, 29900, 29892, 29871, 29945, 29900, 29900, 8443, 13, 3332, 29889, 19156, 703, 29929, 29945, 29900, 29916, 29953, 29900, 29900, 1159, 30004, 13, 3332, 29889, 17591, 29898, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 1495, 30004, 13, 29937, 448, 2683, 2683, 2683, 28400, 30004, 13, 30004, 13, 510, 1761, 353, 7797, 29889, 8504, 29889, 1761, 29918, 4011, 29889, 510, 4011, 26471, 13, 18045, 353, 5159, 30004, 13, 1454, 1543, 297, 419, 1761, 29901, 30004, 13, 1678, 6631, 29889, 4397, 29898, 5029, 29889, 10141, 8443, 13, 361, 451, 6631, 29901, 30004, 13, 1678, 2643, 1884, 29889, 4294, 3888, 703, 29909, 1730, 29877, 29991, 613, 376, 29940, 264, 29882, 10859, 23344, 14458, 24747, 29892, 1147, 22781, 409, 5078, 11549, 277, 4243, 7919, 378, 522, 912, 23157, 30004, 13, 30004, 13, 1643, 29918, 29876, 353, 15796, 29898, 3332, 29892, 1426, 353, 376, 29940, 30030, 1050, 29877, 316, 875, 3665, 294, 29901, 1159, 30004, 13, 1643, 29918, 29876, 29889, 7720, 29898, 798, 353, 29871, 29906, 29892, 1897, 353, 29871, 29896, 29892, 1897, 9653, 353, 29871, 29906, 29892, 17132, 29916, 353, 29871, 29896, 29900, 29892, 282, 3714, 353, 29871, 29896, 29900, 8443, 13, 1643, 29918, 29876, 29889, 17591, 29898, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 363, 18128, 2433, 10921, 742, 2920, 353, 29871, 29906, 29900, 8443, 13, 30004, 13, 29876, 29918, 726, 29877, 353, 1714, 9037, 26471, 13, 29876, 353, 28236, 29898, 3332, 29892, 1426, 11918, 353, 302, 29918, 726, 29877, 8443, 13, 29876, 29889, 7720, 29898, 798, 353, 29871, 29906, 29892, 1897, 29922, 29941, 29892, 17132, 29916, 353, 29871, 29896, 29900, 29892, 282, 3714, 353, 29871, 29896, 29900, 8443, 13, 29876, 29889, 17591, 29898, 2103, 353, 29871, 29896, 29900, 8443, 13, 30004, 13, 1643, 29918, 1837, 29879, 353, 15796, 29898, 3332, 29892, 1426, 353, 376, 6108, 8298, 1146, 337, 941, 29901, 343, 353, 263, 29930, 29916, 29974, 29890, 29892, 282, 7887, 1368, 29901, 343, 29922, 29916, 1159, 30004, 13, 1643, 29918, 1837, 29879, 29889, 7720, 29898, 798, 353, 29871, 29906, 29892, 1897, 353, 29871, 29953, 29892, 1897, 9653, 353, 29871, 29941, 8443, 13, 1643, 29918, 1837, 29879, 29889, 17591, 29898, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 363, 18128, 2433, 10921, 1495, 30004, 13, 30004, 13, 1643, 29918, 29874, 353, 15796, 29898, 3332, 29892, 1426, 353, 376, 29874, 29901, 1159, 30004, 13, 1643, 29918, 29874, 29889, 7720, 29898, 798, 353, 29871, 29941, 29892, 1897, 353, 29871, 29953, 8443, 13, 1643, 29918, 29874, 29889, 17591, 29898, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 363, 18128, 2433, 10921, 1495, 30004, 13, 30004, 13, 19862, 4243, 29918, 1111, 1389, 353, 1722, 703, 3733, 262, 290, 2363, 29889, 3945, 613, 525, 29893, 1495, 30004, 13, 19862, 4243, 29918, 1111, 1389, 29889, 5358, 26471, 13, 30004, 13, 370, 276, 29918, 3733, 29875, 353, 1714, 9037, 26471, 13, 30004, 13, 1753, 633, 276, 29918, 3733, 262, 290, 601, 7295, 30004, 13, 1678, 1018, 29901, 30004, 13, 4706, 633, 276, 29918, 3733, 29875, 29889, 842, 29898, 1445, 15901, 29889, 1278, 3150, 9507, 29898, 11228, 3972, 353, 12633, 3257, 353, 376, 2008, 280, 29883, 1421, 5078, 19325, 4243, 613, 1445, 8768, 353, 313, 703, 1433, 339, 4243, 316, 1426, 29877, 3284, 10521, 3945, 4968, 703, 29911, 24463, 2897, 19325, 12927, 3284, 29930, 5575, 5783, 876, 30004, 13, 4706, 565, 633, 276, 29918, 3733, 29875, 29889, 657, 7295, 30004, 13, 9651, 1426, 29889, 7851, 29898, 11794, 29892, 6634, 29876, 8179, 1727, 912, 419, 480, 985, 29877, 7790, 29876, 1159, 30004, 13, 9651, 1426, 29889, 4149, 29898, 11794, 8443, 13, 1678, 5174, 8960, 408, 321, 29901, 30004, 13, 4706, 2643, 1884, 29889, 4294, 3888, 29898, 29872, 8443, 13, 4706, 736, 6213, 30004, 13, 30004, 13, 3092, 29918, 370, 276, 29918, 3733, 29875, 353, 11025, 29898, 3332, 29892, 1426, 353, 376, 8179, 1727, 279, 1592, 25463, 613, 1899, 353, 633, 276, 29918, 3733, 262, 290, 601, 8443, 13, 3092, 29918, 370, 276, 29918, 3733, 29875, 29889, 7720, 29898, 798, 29922, 29953, 29892, 1897, 29922, 29955, 8443, 13, 3092, 29918, 370, 276, 29918, 3733, 29875, 29889, 17591, 29898, 4925, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 6136, 1454, 18128, 2433, 29937, 22098, 4198, 1495, 30004, 13, 30004, 13, 1753, 282, 2442, 29918, 1111, 1389, 7295, 30004, 13, 1678, 565, 451, 302, 29918, 726, 29877, 29889, 657, 7295, 30004, 13, 4706, 2643, 1884, 29889, 4294, 3888, 703, 29909, 1730, 29877, 29991, 613, 376, 29925, 272, 7853, 29892, 1871, 29872, 288, 13831, 316, 875, 3665, 294, 23157, 30004, 13, 4706, 736, 6213, 30004, 13, 1678, 1302, 1389, 29918, 29874, 353, 263, 29889, 657, 26471, 13, 1678, 1302, 1389, 29918, 29890, 353, 289, 29889, 657, 26471, 13, 1678, 1426, 29889, 7851, 29898, 11794, 29892, 376, 29891, 353, 376, 718, 1302, 1389, 29918, 29874, 718, 26345, 29916, 29908, 718, 376, 718, 376, 718, 1302, 1389, 29918, 29890, 718, 11297, 29876, 1495, 30004, 13, 1678, 1426, 29889, 4149, 29898, 11794, 8443, 13, 1678, 19325, 4243, 29918, 1111, 1389, 353, 1722, 703, 3733, 262, 290, 2363, 29889, 3945, 613, 525, 29874, 1495, 30004, 13, 1678, 19325, 4243, 29918, 1111, 1389, 29889, 3539, 29898, 1111, 1389, 29918, 29874, 718, 376, 376, 8443, 13, 1678, 19325, 4243, 29918, 1111, 1389, 29889, 3539, 29898, 1111, 1389, 29918, 29890, 718, 6634, 29876, 1159, 30004, 13, 1678, 19325, 4243, 29918, 1111, 1389, 29889, 5358, 26471, 13, 1678, 263, 29889, 8143, 29898, 29900, 29892, 11056, 8443, 13, 1678, 289, 29889, 8143, 29898, 29900, 29892, 11056, 8443, 13, 1678, 19325, 4243, 29918, 1111, 1389, 29889, 5358, 26471, 13, 30004, 13, 1753, 4497, 1564, 29918, 3733, 262, 290, 601, 7295, 30004, 13, 1678, 1018, 29901, 30004, 13, 4706, 4497, 1707, 29918, 3733, 29875, 353, 934, 15901, 29889, 1278, 7620, 294, 9507, 29898, 1753, 29874, 352, 726, 2673, 29569, 3945, 613, 2847, 1445, 543, 1004, 375, 29918, 3733, 262, 290, 2363, 1159, 30004, 13, 4706, 19325, 4243, 29918, 3733, 29875, 353, 1722, 29898, 19585, 1707, 29918, 3733, 29875, 29892, 525, 29893, 1495, 30004, 13, 4706, 1426, 29877, 353, 1722, 703, 3733, 262, 290, 2363, 29889, 3945, 2564, 949, 26471, 13, 4706, 1426, 29877, 353, 1426, 29877, 29889, 6506, 28909, 29878, 742, 525, 2824, 6506, 877, 29961, 742, 525, 2824, 6506, 877, 29962, 742, 525, 2824, 6506, 28165, 613, 376, 2564, 6506, 703, 29915, 613, 20569, 30004, 13, 4706, 19325, 4243, 29918, 3733, 29875, 29889, 3539, 29898, 726, 29877, 8443, 13, 4706, 19325, 4243, 29918, 3733, 29875, 29889, 5358, 26471, 13, 1678, 5174, 8960, 408, 321, 29901, 30004, 13, 4706, 2643, 1884, 29889, 4294, 3888, 29898, 29872, 8443, 13, 4706, 736, 6213, 30004, 13, 30004, 13, 2576, 862, 29918, 29887, 1929, 353, 3159, 9037, 26471, 13, 30004, 13, 1753, 2485, 862, 29918, 29887, 1929, 29918, 342, 912, 7295, 30004, 13, 1678, 2485, 862, 29918, 29887, 1929, 29889, 842, 29898, 29896, 8443, 13, 30004, 13, 3092, 29918, 19585, 1564, 29918, 3733, 29875, 353, 11025, 29898, 3332, 29892, 1426, 353, 376, 20392, 1707, 1592, 25463, 613, 1899, 353, 4497, 1564, 29918, 3733, 262, 290, 601, 8443, 13, 3092, 29918, 19585, 1564, 29918, 3733, 29875, 29889, 7720, 29898, 798, 29922, 29945, 29892, 1897, 29922, 29955, 8443, 13, 3092, 29918, 19585, 1564, 29918, 3733, 29875, 29889, 17591, 29898, 4925, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 6136, 1454, 18128, 2433, 29937, 22098, 4198, 1495, 30004, 13, 30004, 13, 29874, 29918, 726, 29877, 353, 1714, 9037, 26471, 13, 29874, 353, 28236, 29898, 3332, 29892, 1426, 11918, 353, 263, 29918, 726, 29877, 8443, 13, 29874, 29889, 7720, 29898, 798, 29922, 29941, 29892, 1897, 29922, 29955, 8443, 13, 30004, 13, 1643, 29918, 29890, 353, 15796, 29898, 3332, 29892, 1426, 353, 376, 29890, 29901, 1159, 30004, 13, 1643, 29918, 29890, 29889, 7720, 29898, 798, 353, 29871, 29946, 29892, 1897, 353, 29871, 29953, 8443, 13, 1643, 29918, 29890, 29889, 17591, 29898, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 363, 18128, 2433, 10921, 1495, 30004, 13, 30004, 13, 29890, 29918, 726, 29877, 353, 1714, 9037, 26471, 13, 29890, 353, 28236, 29898, 3332, 29892, 1426, 11918, 353, 289, 29918, 726, 29877, 8443, 13, 29890, 29889, 7720, 29898, 798, 29922, 29946, 29892, 1897, 29922, 29955, 8443, 13, 30004, 13, 3092, 29918, 296, 13678, 353, 11025, 29898, 3332, 29892, 1426, 353, 376, 797, 643, 381, 613, 1899, 353, 282, 2442, 29918, 1111, 1389, 8443, 13, 3092, 29918, 296, 13678, 29889, 7720, 29898, 798, 29922, 29941, 29892, 1897, 29922, 29947, 29892, 1948, 9653, 353, 29871, 29906, 29892, 17132, 29916, 353, 29871, 29896, 29945, 8443, 13, 3092, 29918, 296, 13678, 29889, 17591, 29898, 4925, 7042, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 6136, 1454, 18128, 2433, 29937, 22098, 4198, 1495, 30004, 13, 30004, 13, 726, 353, 2522, 24476, 1626, 29898, 3332, 29892, 2920, 29922, 29945, 29900, 29892, 3171, 29922, 29906, 29900, 8443, 13, 726, 29889, 7720, 29898, 798, 29922, 29941, 29892, 1897, 29922, 29896, 29892, 1897, 9653, 29922, 29945, 29892, 1948, 9653, 29922, 29896, 29900, 29892, 17132, 29916, 353, 29871, 29896, 29900, 29892, 282, 3714, 353, 29871, 29896, 29900, 8443, 13, 30004, 13, 726, 29889, 7851, 29898, 11794, 29892, 376, 3986, 2672, 10810, 29965, 30219, 30983, 2890, 29905, 29876, 1159, 30004, 13, 726, 29889, 7851, 29898, 11794, 29892, 6634, 29876, 1159, 30004, 13, 726, 29889, 7851, 29898, 11794, 29892, 376, 29958, 29949, 2425, 316, 5078, 2761, 3136, 28542, 29905, 29876, 2267, 1398, 279, 2897, 270, 2255, 1146, 7025, 6693, 5954, 3583, 29876, 1159, 30004, 13, 726, 29889, 7851, 29898, 11794, 29892, 376, 29874, 289, 274, 2023, 29905, 29876, 1159, 30004, 13, 726, 29889, 7851, 29898, 11794, 29892, 376, 1252, 29901, 29871, 29896, 29871, 29906, 29871, 29941, 29871, 29946, 29871, 29945, 29905, 29876, 1159, 30004, 13, 726, 29889, 7851, 29898, 11794, 29892, 6634, 29876, 29958, 6185, 8663, 288, 13831, 316, 875, 3665, 294, 29905, 29876, 3794, 316, 21855, 279, 263, 454, 277, 2002, 7790, 29876, 1159, 30004, 13, 726, 29889, 7851, 29898, 11794, 29892, 6634, 29876, 1159, 30004, 13, 726, 29889, 4149, 29898, 11794, 8443, 13, 30004, 13, 29937, 14783, 279, 6143, 30004, 13, 1527, 431, 279, 353, 20019, 29898, 3332, 8443, 13, 30004, 13, 1527, 431, 279, 29889, 1202, 29918, 6519, 29898, 1643, 543, 797, 1654, 279, 454, 277, 2002, 613, 1899, 29922, 8411, 29918, 280, 277, 2002, 8443, 13, 30004, 13, 29887, 1929, 29918, 6510, 353, 20019, 29898, 1527, 431, 279, 29892, 734, 279, 2696, 29922, 29900, 8443, 13, 1527, 431, 279, 29889, 1202, 29918, 9398, 6332, 29898, 1643, 543, 3338, 29976, 26395, 613, 6143, 29922, 29887, 1929, 29918, 6510, 8443, 13, 29887, 1929, 29918, 6510, 29889, 1202, 29918, 6519, 29898, 1643, 543, 1252, 747, 381, 867, 29976, 14894, 953, 11413, 1855, 613, 1899, 29922, 29887, 1929, 1417, 8443, 13, 29887, 1929, 29918, 6510, 29889, 1202, 29918, 6519, 29898, 1643, 543, 1252, 747, 381, 867, 29976, 14894, 613, 1899, 29922, 29887, 1929, 1417, 2611, 8443, 13, 29887, 1929, 29918, 6510, 29889, 1202, 29918, 344, 17954, 26471, 13, 29887, 1929, 29918, 6510, 29889, 1202, 29918, 6519, 29898, 1643, 543, 29931, 326, 862, 867, 29976, 14894, 613, 1899, 29922, 2576, 862, 29918, 29887, 1929, 29918, 342, 912, 8443, 13, 30004, 13, 6451, 3136, 29918, 6510, 353, 20019, 29898, 1527, 431, 279, 29892, 734, 279, 2696, 29922, 29900, 8443, 13, 1527, 431, 279, 29889, 1202, 29918, 9398, 6332, 29898, 1643, 543, 4809, 3136, 613, 6143, 29922, 6451, 3136, 29918, 6510, 8443, 13, 637, 294, 29918, 1491, 29918, 6510, 353, 20019, 29898, 6451, 3136, 29918, 6510, 29892, 734, 279, 2696, 353, 29871, 29900, 8443, 13, 6451, 3136, 29918, 6510, 29889, 1202, 29918, 9398, 6332, 29898, 1643, 543, 2290, 294, 613, 6143, 29922, 637, 294, 29918, 1491, 29918, 6510, 8443, 13, 30004, 13, 1707, 353, 1714, 9037, 26471, 13, 271, 950, 15356, 637, 29874, 26471, 13, 30004, 13, 2291, 566, 29918, 1491, 29918, 6510, 353, 20019, 29898, 6451, 3136, 29918, 6510, 29892, 734, 279, 2696, 353, 29871, 29900, 8443, 13, 6451, 3136, 29918, 6510, 29889, 1202, 29918, 9398, 6332, 29898, 1643, 353, 376, 29933, 15052, 10492, 613, 6143, 353, 9922, 566, 29918, 1491, 29918, 6510, 8443, 13, 30004, 13, 29937, 282, 2442, 288, 9922, 566, 6554, 29892, 722, 2291, 566, 904, 288, 9922, 566, 10492, 9166, 9166, 4936, 2751, 25512, 30004, 13, 29937, 29946, 29947, 29900, 29900, 29892, 29871, 29929, 29953, 29900, 29900, 29892, 29871, 29941, 29947, 29946, 29900, 29900, 29892, 29871, 29945, 29955, 29953, 29900, 29900, 29892, 29871, 29896, 29896, 29945, 29906, 29900, 29900, 29892, 29871, 29906, 29941, 29900, 29946, 29900, 29900, 30004, 13, 1707, 2291, 566, 353, 3159, 9037, 26471, 13, 2291, 566, 29918, 1491, 29918, 6510, 29889, 1202, 29918, 13399, 3092, 29898, 1643, 353, 376, 29946, 29947, 29900, 29900, 613, 2286, 353, 722, 2291, 566, 29892, 995, 353, 29871, 29946, 29947, 29900, 29900, 29892, 1899, 353, 5535, 2291, 566, 8443, 13, 2291, 566, 29918, 1491, 29918, 6510, 29889, 1202, 29918, 13399, 3092, 29898, 1643, 353, 376, 29929, 29953, 29900, 29900, 613, 2286, 353, 722, 2291, 566, 29892, 995, 353, 29871, 29929, 29953, 29900, 29900, 29892, 1899, 353, 5535, 2291, 566, 8443, 13, 2291, 566, 29918, 1491, 29918, 6510, 29889, 1202, 29918, 13399, 3092, 29898, 1643, 353, 376, 29941, 29947, 29946, 29900, 29900, 613, 2286, 353, 722, 2291, 566, 29892, 995, 353, 29871, 29941, 29947, 29946, 29900, 29900, 29892, 1899, 353, 5535, 2291, 566, 8443, 13, 2291, 566, 29918, 1491, 29918, 6510, 29889, 1202, 29918, 13399, 3092, 29898, 1643, 353, 376, 29945, 29955, 29953, 29900, 29900, 613, 2286, 353, 722, 2291, 566, 29892, 995, 353, 29871, 29945, 29955, 29953, 29900, 29900, 29892, 1899, 353, 5535, 2291, 566, 8443, 13, 2291, 566, 29918, 1491, 29918, 6510, 29889, 1202, 29918, 13399, 3092, 29898, 1643, 353, 376, 29896, 29896, 29945, 29906, 29900, 29900, 613, 2286, 353, 722, 2291, 566, 29892, 995, 353, 29871, 29896, 29896, 29945, 29906, 29900, 29900, 29892, 1899, 353, 5535, 2291, 566, 8443, 13, 2291, 566, 29918, 1491, 29918, 6510, 29889, 1202, 29918, 13399, 3092, 29898, 1643, 353, 376, 29906, 29941, 29900, 29946, 29900, 29900, 613, 2286, 353, 722, 2291, 566, 29892, 995, 353, 29871, 29906, 29941, 29900, 29946, 29900, 29900, 29892, 1899, 353, 5535, 2291, 566, 8443, 13, 2291, 566, 29918, 1491, 29918, 6510, 29889, 9772, 29898, 29896, 8443, 13, 29937, 1275, 9166, 9166, 9166, 9166, 9166, 25512, 30004, 13, 30004, 13, 6451, 3136, 29918, 6510, 29889, 1202, 29918, 344, 17954, 26471, 13, 6451, 3136, 29918, 6510, 29889, 1202, 29918, 6519, 29898, 1643, 353, 376, 4178, 950, 15356, 2011, 294, 613, 1899, 353, 472, 950, 15356, 637, 29874, 8443, 13, 30004, 13, 29879, 1466, 29918, 6510, 353, 20019, 29898, 1527, 431, 279, 29892, 734, 279, 2696, 29922, 29900, 8443, 13, 1527, 431, 279, 29889, 1202, 29918, 9398, 6332, 29898, 1643, 543, 29903, 1466, 29914, 1123, 262, 1654, 279, 613, 6143, 29922, 29879, 1466, 29918, 6510, 8443, 13, 29879, 1466, 29918, 6510, 29889, 1202, 29918, 6519, 29898, 1643, 353, 376, 1123, 262, 1654, 279, 613, 1899, 353, 15561, 1654, 279, 8443, 13, 29879, 1466, 29918, 6510, 29889, 1202, 29918, 6519, 29898, 1643, 543, 29903, 1466, 613, 1899, 29922, 1725, 305, 1743, 8443, 13, 30004, 13, 29937, 1556, 13678, 288, 6143, 30004, 13, 3332, 29889, 2917, 29898, 6510, 29922, 1527, 431, 279, 8443, 13, 30004, 13, 29937, 521, 3304, 288, 1667, 7888, 1599, 633, 276, 263, 5496, 3100, 419, 2897, 372, 575, 14123, 267, 30004, 13, 3332, 29889, 20464, 703, 26735, 29918, 2287, 18476, 29918, 25152, 3970, 29956, 613, 1238, 305, 1743, 8443, 13, 3332, 29889, 3396, 7888, 26471, 13, 2 ]
Chapter 8 - Functions & Recursion/04_factorial.py
alex-dsouza777/Python-Basics
0
86100
<reponame>alex-dsouza777/Python-Basics #n! = 1 * 2 * 3 * 4 ..... * n #n! = [1 * 2 * 3 * 4 ..... n-1]* n #n! = n * (n-1)! # n = 7 # product = 1 # for i in range(n): # product = product * (i+1) # print(product) def factorial_iter(n): product = 1 for i in range(n): product = product * (i+1) return product def factorial_recursive(n): if n == 1 or n ==0: return 1 return n * factorial_recursive(n-1) # f = factorial_iter(5) f = factorial_recursive(3) print(f)
[ 1, 529, 276, 1112, 420, 29958, 744, 29916, 29899, 6289, 283, 1362, 29955, 29955, 29955, 29914, 11980, 29899, 9496, 1199, 13, 29937, 29876, 29991, 353, 29871, 29896, 334, 29871, 29906, 334, 29871, 29941, 334, 29871, 29946, 6317, 856, 334, 302, 13, 29937, 29876, 29991, 353, 29871, 518, 29896, 334, 29871, 29906, 334, 29871, 29941, 334, 29871, 29946, 6317, 856, 302, 29899, 29896, 14178, 302, 13, 29937, 29876, 29991, 353, 302, 334, 313, 29876, 29899, 29896, 20198, 13, 13, 29937, 302, 353, 29871, 29955, 13, 29937, 3234, 353, 29871, 29896, 13, 29937, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 29937, 268, 3234, 353, 3234, 334, 313, 29875, 29974, 29896, 29897, 13, 29937, 1596, 29898, 4704, 29897, 13, 13, 1753, 7329, 616, 29918, 1524, 29898, 29876, 1125, 13, 1678, 3234, 353, 29871, 29896, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 4706, 3234, 353, 3234, 334, 313, 29875, 29974, 29896, 29897, 13, 1678, 736, 3234, 13, 13, 1753, 7329, 616, 29918, 3757, 25397, 29898, 29876, 1125, 13, 1678, 565, 302, 1275, 29871, 29896, 470, 302, 1275, 29900, 29901, 13, 4706, 736, 29871, 29896, 13, 1678, 736, 302, 334, 7329, 616, 29918, 3757, 25397, 29898, 29876, 29899, 29896, 29897, 13, 29937, 285, 353, 7329, 616, 29918, 1524, 29898, 29945, 29897, 13, 29888, 353, 7329, 616, 29918, 3757, 25397, 29898, 29941, 29897, 13, 2158, 29898, 29888, 29897, 13, 2 ]
pythonfiles/testing.py
amrut-prabhu/loan-default-prediction
2
23179
import numpy as np import pandas as pd from sklearn.externals import joblib #from sklearn.ensemble import RandomForestRegressor #from sklearn.multioutput import MultiOutputRegressor #from sklearn.multioutput import MultiOutputRegressor from sklearn.model_selection import train_test_split df = pd.read_csv('https://drive.google.com/uc?export=download&id=1XoV8SfvHmzaxRuDRe81OWSQu10dYTbO5',sep=',') df_X = df.iloc[:, 2:13].copy() df_X = pd.get_dummies(df_X) df_y1 = df.iloc[:, 13:16].copy() df_y1 = pd.get_dummies(df_y1) df_y2 = df.iloc[:, 16:20].copy() df_y2 = pd.get_dummies(df_y2) #X_train, df_X, y_train, df_y1 = train_test_split(df_X, df_y1, test_size=0.2, random_state=0) def accuracy(model, X_test, y_test): predictions = model.predict(X_test) print(model.score(X_test, y_test)) errors = np.abs(predictions - y_test) mape = 100 * (errors / y_test) for col in mape: accuracy = 100 - np.mean(mape[col]) print('Accuracy:', round(accuracy, 2), '%.') def test(model, df_X, df_y1, num): accuracy(model, df_X, df_y1) predictions = pd.DataFrame(model.predict(df_X)) errors = np.abs(predictions - df_y1) print(type(predictions)) print(type(errors)) for i in range(num): #results = df_X.iloc[:, 0:10].values #results = np.append(results, df_y1.ix[:, i]) #results = np.append(results, predictions[:, i]) #results = np.append(results, errors.ix[:, i]) #result_df = pd.DataFrame(results) df_X.join(df_y1.ix[:, i]).join(predictions.ix[:, i]).to_csv("ModelPredictions" + str(num) + str(i) + ".csv") #model = RandomForestRegressor(n_estimators = 1900, max_depth = 70, random_state = 50, learning_rate = 0.1, min_samples_split = 0.1, max_features = 'sqrt', loss = 'lad', warm_start = True, min_samples_leaf = 0.0005) #model1 = MultipleOutputRegressor(model) #model2 = MultipleOutputRegressor(model, n_jobs = -1) #model1.fit(X_train, y_train) model = joblib.load("RegressorChainGradientBoostingRegressorEarningsNew.pkl") test(model, df_X, df_y1, 3) model = joblib.load("RegressorChainGradientBoostingRegressorRepaymentNew.pkl") test(model, df_X, df_y2, 4) #model2.fit(X_train, y_train) #joblib.dump(model2, "MultiplepleOutputRandomForestRegressorEarnings.pkl") #print("Model 2: "); #accuracy(model2, df_X, df_y1) #X_train, df_X, y_train, df_y1 = train_test_split(df_X, df_y2, test_size=0.2, random_state=0) #model1.fit(X_train, y_train) #joblib.dump(model1, "MultipleOutputRegressorRandomForestRegressorRepayment.pkl") #print("Model 3: "); #accuracy(model1, df_X, df_y1) #model2.fit(X_train, y_train) #joblib.dump(model2, "MultiplepleOutputRandomForestRegressorRepayment.pkl") #print("Model 4: "); #accuracy(model2, df_X, df_y1)
[ 1, 1053, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 3166, 2071, 19668, 29889, 735, 725, 1338, 1053, 4982, 1982, 13, 29937, 3166, 2071, 19668, 29889, 24031, 1053, 16968, 2831, 342, 4597, 1253, 272, 13, 29937, 3166, 2071, 19668, 29889, 9910, 4905, 1053, 14974, 6466, 4597, 1253, 272, 29871, 13, 29937, 3166, 2071, 19668, 29889, 9910, 4905, 1053, 14974, 6466, 4597, 1253, 272, 29871, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 13, 2176, 353, 10518, 29889, 949, 29918, 7638, 877, 991, 597, 21594, 29889, 3608, 29889, 510, 29914, 1682, 29973, 15843, 29922, 10382, 29987, 333, 29922, 29896, 29990, 29877, 29963, 29947, 29903, 29888, 29894, 29950, 29885, 29920, 1165, 29934, 29884, 29928, 1123, 29947, 29896, 29949, 7811, 2182, 29896, 29900, 29881, 29979, 29911, 29890, 29949, 29945, 742, 19570, 29922, 742, 1495, 13, 13, 2176, 29918, 29990, 353, 4489, 29889, 309, 542, 7503, 29892, 29871, 29906, 29901, 29896, 29941, 1822, 8552, 580, 13, 2176, 29918, 29990, 353, 10518, 29889, 657, 29918, 29881, 23824, 583, 29898, 2176, 29918, 29990, 29897, 13, 13, 2176, 29918, 29891, 29896, 353, 4489, 29889, 309, 542, 7503, 29892, 29871, 29896, 29941, 29901, 29896, 29953, 1822, 8552, 580, 13, 2176, 29918, 29891, 29896, 353, 10518, 29889, 657, 29918, 29881, 23824, 583, 29898, 2176, 29918, 29891, 29896, 29897, 13, 13, 2176, 29918, 29891, 29906, 353, 4489, 29889, 309, 542, 7503, 29892, 29871, 29896, 29953, 29901, 29906, 29900, 1822, 8552, 580, 13, 2176, 29918, 29891, 29906, 353, 10518, 29889, 657, 29918, 29881, 23824, 583, 29898, 2176, 29918, 29891, 29906, 29897, 13, 13, 29937, 29990, 29918, 14968, 29892, 4489, 29918, 29990, 29892, 343, 29918, 14968, 29892, 4489, 29918, 29891, 29896, 353, 7945, 29918, 1688, 29918, 5451, 29898, 2176, 29918, 29990, 29892, 4489, 29918, 29891, 29896, 29892, 1243, 29918, 2311, 29922, 29900, 29889, 29906, 29892, 4036, 29918, 3859, 29922, 29900, 29897, 13, 1753, 13600, 29898, 4299, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 1125, 13, 12, 27711, 1080, 353, 1904, 29889, 27711, 29898, 29990, 29918, 1688, 29897, 13, 12, 2158, 29898, 4299, 29889, 13628, 29898, 29990, 29918, 1688, 29892, 343, 29918, 1688, 876, 13, 12, 12523, 353, 7442, 29889, 6897, 29898, 27711, 1080, 448, 343, 29918, 1688, 29897, 13, 12, 655, 412, 353, 29871, 29896, 29900, 29900, 334, 313, 12523, 847, 343, 29918, 1688, 29897, 13, 12, 1454, 784, 297, 611, 412, 29901, 13, 12, 1678, 13600, 353, 29871, 29896, 29900, 29900, 448, 7442, 29889, 12676, 29898, 655, 412, 29961, 1054, 2314, 13, 12, 1678, 1596, 877, 7504, 332, 4135, 29901, 742, 4513, 29898, 562, 2764, 4135, 29892, 29871, 29906, 511, 14210, 29889, 1495, 13, 13, 1753, 1243, 29898, 4299, 29892, 4489, 29918, 29990, 29892, 4489, 29918, 29891, 29896, 29892, 954, 1125, 13, 12, 562, 2764, 4135, 29898, 4299, 29892, 4489, 29918, 29990, 29892, 4489, 29918, 29891, 29896, 29897, 13, 12, 27711, 1080, 353, 10518, 29889, 17271, 29898, 4299, 29889, 27711, 29898, 2176, 29918, 29990, 876, 13, 12, 12523, 353, 7442, 29889, 6897, 29898, 27711, 1080, 448, 4489, 29918, 29891, 29896, 29897, 13, 12, 2158, 29898, 1853, 29898, 27711, 1080, 876, 13, 12, 2158, 29898, 1853, 29898, 12523, 876, 13, 12, 1454, 474, 297, 3464, 29898, 1949, 1125, 13, 12, 12, 29937, 9902, 353, 4489, 29918, 29990, 29889, 309, 542, 7503, 29892, 29871, 29900, 29901, 29896, 29900, 1822, 5975, 13, 12, 12, 29937, 9902, 353, 7442, 29889, 4397, 29898, 9902, 29892, 4489, 29918, 29891, 29896, 29889, 861, 7503, 29892, 474, 2314, 13, 12, 12, 29937, 9902, 353, 7442, 29889, 4397, 29898, 9902, 29892, 27303, 7503, 29892, 474, 2314, 13, 12, 12, 29937, 9902, 353, 7442, 29889, 4397, 29898, 9902, 29892, 4436, 29889, 861, 7503, 29892, 474, 2314, 13, 12, 12, 29937, 2914, 29918, 2176, 353, 10518, 29889, 17271, 29898, 9902, 29897, 13, 12, 12, 2176, 29918, 29990, 29889, 7122, 29898, 2176, 29918, 29891, 29896, 29889, 861, 7503, 29892, 474, 14664, 7122, 29898, 27711, 1080, 29889, 861, 7503, 29892, 474, 14664, 517, 29918, 7638, 703, 3195, 23084, 919, 1080, 29908, 718, 851, 29898, 1949, 29897, 718, 851, 29898, 29875, 29897, 718, 29871, 11393, 7638, 1159, 13, 13, 29937, 4299, 353, 16968, 2831, 342, 4597, 1253, 272, 29898, 29876, 29918, 342, 326, 4097, 353, 29871, 29896, 29929, 29900, 29900, 29892, 4236, 29918, 19488, 353, 29871, 29955, 29900, 29892, 4036, 29918, 3859, 353, 29871, 29945, 29900, 29892, 6509, 29918, 10492, 353, 29871, 29900, 29889, 29896, 29892, 1375, 29918, 27736, 29918, 5451, 353, 29871, 29900, 29889, 29896, 29892, 4236, 29918, 22100, 353, 525, 3676, 742, 6410, 353, 525, 4528, 742, 14294, 29918, 2962, 353, 5852, 29892, 1375, 29918, 27736, 29918, 29500, 353, 29871, 29900, 29889, 29900, 29900, 29900, 29945, 29897, 13, 29937, 4299, 29896, 353, 26905, 6466, 4597, 1253, 272, 29898, 4299, 29897, 13, 29937, 4299, 29906, 353, 26905, 6466, 4597, 1253, 272, 29898, 4299, 29892, 302, 29918, 9057, 29879, 353, 448, 29896, 29897, 13, 29937, 4299, 29896, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29897, 13, 4299, 353, 4982, 1982, 29889, 1359, 703, 4597, 1253, 272, 14688, 25584, 993, 8431, 520, 292, 4597, 1253, 272, 29923, 2753, 886, 4373, 29889, 29886, 6321, 1159, 13, 1688, 29898, 4299, 29892, 4489, 29918, 29990, 29892, 4489, 29918, 29891, 29896, 29892, 29871, 29941, 29897, 13, 4299, 353, 4982, 1982, 29889, 1359, 703, 4597, 1253, 272, 14688, 25584, 993, 8431, 520, 292, 4597, 1253, 272, 5612, 388, 358, 4373, 29889, 29886, 6321, 1159, 13, 1688, 29898, 4299, 29892, 4489, 29918, 29990, 29892, 4489, 29918, 29891, 29906, 29892, 29871, 29946, 29897, 13, 29937, 4299, 29906, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29897, 13, 29937, 9057, 1982, 29889, 15070, 29898, 4299, 29906, 29892, 376, 15329, 552, 552, 6466, 17875, 2831, 342, 4597, 1253, 272, 29923, 2753, 886, 29889, 29886, 6321, 1159, 13, 29937, 2158, 703, 3195, 29871, 29906, 29901, 14796, 13, 29937, 562, 2764, 4135, 29898, 4299, 29906, 29892, 4489, 29918, 29990, 29892, 4489, 29918, 29891, 29896, 29897, 13, 13, 29937, 29990, 29918, 14968, 29892, 4489, 29918, 29990, 29892, 343, 29918, 14968, 29892, 4489, 29918, 29891, 29896, 353, 7945, 29918, 1688, 29918, 5451, 29898, 2176, 29918, 29990, 29892, 4489, 29918, 29891, 29906, 29892, 1243, 29918, 2311, 29922, 29900, 29889, 29906, 29892, 4036, 29918, 3859, 29922, 29900, 29897, 13, 13, 29937, 4299, 29896, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29897, 13, 29937, 9057, 1982, 29889, 15070, 29898, 4299, 29896, 29892, 376, 15329, 552, 6466, 4597, 1253, 272, 17875, 2831, 342, 4597, 1253, 272, 5612, 388, 358, 29889, 29886, 6321, 1159, 13, 29937, 2158, 703, 3195, 29871, 29941, 29901, 14796, 13, 29937, 562, 2764, 4135, 29898, 4299, 29896, 29892, 4489, 29918, 29990, 29892, 4489, 29918, 29891, 29896, 29897, 13, 29937, 4299, 29906, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29897, 13, 29937, 9057, 1982, 29889, 15070, 29898, 4299, 29906, 29892, 376, 15329, 552, 552, 6466, 17875, 2831, 342, 4597, 1253, 272, 5612, 388, 358, 29889, 29886, 6321, 1159, 13, 29937, 2158, 703, 3195, 29871, 29946, 29901, 14796, 13, 29937, 562, 2764, 4135, 29898, 4299, 29906, 29892, 4489, 29918, 29990, 29892, 4489, 29918, 29891, 29896, 29897, 13, 2 ]
client/cryptog.py
yoelbassin/chat
8
77531
<gh_stars>1-10 import const import config import rsa from cryptography.fernet import Fernet def key_ex(): config.client.send((const.public_key + str(config.public_key.n) + ' ' + str(config.public_key.e)).encode()) def send_symmetric_key(): self_id = int(''.join([str(ord(c)) for c in config.uname])) dst_id = int(''.join([str(ord(c)) for c in config.active_chat])) if dst_id > self_id: generate_key() encrypted_message = rsa.encrypt(config.chat_key, config.dst_pub) config.client.send(const.symmetric_key.encode() + encrypted_message) config.chat_key = Fernet(config.chat_key) def get_key(key): key = key[5:].split(' ') config.dst_pub = rsa.PublicKey(int(key[0]), int(key[1])) def get_symmetric_key(key): key = key.encode() self_id = int(''.join([str(ord(c)) for c in config.uname])) dst_id = int(''.join([str(ord(c)) for c in config.active_chat])) if dst_id < self_id: config.chat_key = Fernet(key) def get_message_rsa(message): code = message[:const.CODE_LEN].decode() message = rsa.decrypt(message[const.CODE_LEN:], config.private_key) message = code + message.decode() return message def get_enc_message(message): code = message[:const.CODE_LEN].decode() if code == const.msg_code: message = decrypt_message(message[const.CODE_LEN:]) else: message = rsa.decrypt(message[const.CODE_LEN:], config.private_key) return code + message.decode() def generate_key(): """ Generates a key and save it into a file """ config.chat_key = Fernet.generate_key() def encrypt_message(message): """ Encrypts a message """ encoded_message = message.encode() return config.chat_key.encrypt(encoded_message) def decrypt_message(encrypted_message): """ Decrypts an encrypted message """ return config.chat_key.decrypt(encrypted_message)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 1040, 13, 5215, 2295, 13, 5215, 364, 4977, 13, 3166, 24941, 5275, 29889, 571, 1212, 1053, 7139, 300, 13, 13, 13, 1753, 1820, 29918, 735, 7295, 13, 1678, 2295, 29889, 4645, 29889, 6717, 3552, 3075, 29889, 3597, 29918, 1989, 718, 851, 29898, 2917, 29889, 3597, 29918, 1989, 29889, 29876, 29897, 718, 525, 525, 718, 851, 29898, 2917, 29889, 3597, 29918, 1989, 29889, 29872, 8106, 12508, 3101, 13, 13, 13, 1753, 3638, 29918, 11967, 16414, 29918, 1989, 7295, 13, 1678, 1583, 29918, 333, 353, 938, 877, 4286, 7122, 4197, 710, 29898, 536, 29898, 29883, 876, 363, 274, 297, 2295, 29889, 348, 420, 12622, 13, 1678, 29743, 29918, 333, 353, 938, 877, 4286, 7122, 4197, 710, 29898, 536, 29898, 29883, 876, 363, 274, 297, 2295, 29889, 4925, 29918, 13496, 12622, 13, 1678, 565, 29743, 29918, 333, 1405, 1583, 29918, 333, 29901, 13, 4706, 5706, 29918, 1989, 580, 13, 4706, 23220, 29918, 4906, 353, 364, 4977, 29889, 3977, 4641, 29898, 2917, 29889, 13496, 29918, 1989, 29892, 2295, 29889, 22992, 29918, 5467, 29897, 13, 4706, 2295, 29889, 4645, 29889, 6717, 29898, 3075, 29889, 11967, 16414, 29918, 1989, 29889, 12508, 580, 718, 23220, 29918, 4906, 29897, 13, 4706, 2295, 29889, 13496, 29918, 1989, 353, 7139, 300, 29898, 2917, 29889, 13496, 29918, 1989, 29897, 13, 13, 13, 1753, 679, 29918, 1989, 29898, 1989, 1125, 13, 1678, 1820, 353, 1820, 29961, 29945, 29901, 1822, 5451, 877, 25710, 13, 1678, 2295, 29889, 22992, 29918, 5467, 353, 364, 4977, 29889, 19858, 2558, 29898, 524, 29898, 1989, 29961, 29900, 11724, 938, 29898, 1989, 29961, 29896, 12622, 13, 13, 13, 1753, 679, 29918, 11967, 16414, 29918, 1989, 29898, 1989, 1125, 13, 1678, 1820, 353, 1820, 29889, 12508, 580, 13, 1678, 1583, 29918, 333, 353, 938, 877, 4286, 7122, 4197, 710, 29898, 536, 29898, 29883, 876, 363, 274, 297, 2295, 29889, 348, 420, 12622, 13, 1678, 29743, 29918, 333, 353, 938, 877, 4286, 7122, 4197, 710, 29898, 536, 29898, 29883, 876, 363, 274, 297, 2295, 29889, 4925, 29918, 13496, 12622, 13, 1678, 565, 29743, 29918, 333, 529, 1583, 29918, 333, 29901, 13, 4706, 2295, 29889, 13496, 29918, 1989, 353, 7139, 300, 29898, 1989, 29897, 13, 13, 13, 1753, 679, 29918, 4906, 29918, 2288, 29874, 29898, 4906, 1125, 13, 1678, 775, 353, 2643, 7503, 3075, 29889, 16524, 29918, 1307, 29940, 1822, 13808, 580, 13, 1678, 2643, 353, 364, 4977, 29889, 7099, 4641, 29898, 4906, 29961, 3075, 29889, 16524, 29918, 1307, 29940, 29901, 1402, 2295, 29889, 9053, 29918, 1989, 29897, 13, 1678, 2643, 353, 775, 718, 2643, 29889, 13808, 580, 13, 1678, 736, 2643, 13, 13, 13, 1753, 679, 29918, 3977, 29918, 4906, 29898, 4906, 1125, 13, 1678, 775, 353, 2643, 7503, 3075, 29889, 16524, 29918, 1307, 29940, 1822, 13808, 580, 13, 1678, 565, 775, 1275, 1040, 29889, 7645, 29918, 401, 29901, 13, 4706, 2643, 353, 1602, 4641, 29918, 4906, 29898, 4906, 29961, 3075, 29889, 16524, 29918, 1307, 29940, 29901, 2314, 13, 1678, 1683, 29901, 13, 4706, 2643, 353, 364, 4977, 29889, 7099, 4641, 29898, 4906, 29961, 3075, 29889, 16524, 29918, 1307, 29940, 29901, 1402, 2295, 29889, 9053, 29918, 1989, 29897, 13, 1678, 736, 775, 718, 2643, 29889, 13808, 580, 13, 13, 13, 1753, 5706, 29918, 1989, 7295, 13, 1678, 9995, 13, 1678, 3251, 1078, 263, 1820, 322, 4078, 372, 964, 263, 934, 13, 1678, 9995, 13, 1678, 2295, 29889, 13496, 29918, 1989, 353, 7139, 300, 29889, 17158, 29918, 1989, 580, 13, 13, 13, 13, 1753, 27924, 29918, 4906, 29898, 4906, 1125, 13, 1678, 9995, 13, 1678, 11346, 4641, 29879, 263, 2643, 13, 1678, 9995, 13, 1678, 18511, 29918, 4906, 353, 2643, 29889, 12508, 580, 13, 1678, 736, 2295, 29889, 13496, 29918, 1989, 29889, 3977, 4641, 29898, 26716, 29918, 4906, 29897, 13, 13, 13, 1753, 1602, 4641, 29918, 4906, 29898, 3977, 14740, 29918, 4906, 1125, 13, 1678, 9995, 13, 1678, 3826, 4641, 29879, 385, 23220, 2643, 13, 1678, 9995, 13, 1678, 736, 2295, 29889, 13496, 29918, 1989, 29889, 7099, 4641, 29898, 3977, 14740, 29918, 4906, 29897, 13, 2 ]
qgenda/pipeline/pre.py
jjorissen52/python-qgenda
2
1601888
import time from qgenda import helpers def gzip_headers(method_self, caller=None, params=None): if caller not in method_self.gzip_safe: use_gzip = params.pop('gzip', False) params['headers'] = method_self.headers if use_gzip else { key: value for key, value in method_self.headers.items() if value != 'gzip' } return method_self, caller, params def keep_authenticated(method_self, caller=None, params=None): """ """ request_start = time.time() auth_details = method_self.auth_details expiration_time = auth_details.get("expiration_time", 0) if auth_details else 0 if method_self.leader and not auth_details: method_self.authenticate() auth_details = method_self.auth_details else: retries = 10 while retries: if expiration_time - request_start <= 0: time.sleep(1) auth_details = method_self.auth_details if auth_details: break retries -= 1 if "access_token" in auth_details: method_self.headers.update({"Authorization": f'bearer {auth_details["access_token"]}'}) params['headers'].update({"Authorization": f'bearer {auth_details["access_token"]}'}) return method_self, caller, params def prepare_odata(logger): odata_filters = ['$filter', '$select', '$orderby'] def real_decorator(method_self, caller, params): odata_kwargs = params.get('odata_kwargs', {}) extra = [] if odata_kwargs: extra = [key for key in odata_kwargs.keys() if key not in odata_filters] if extra: for e in extra: odata_kwargs.pop(e) logger.warning(f'Extra OData filter(s) removed from kwargs. Invalid filter {extra}') params['odata_kwargs'] = odata_kwargs return method_self, caller, params return real_decorator
[ 1, 1053, 931, 13, 13, 3166, 3855, 29887, 8395, 1053, 1371, 414, 13, 13, 13, 1753, 330, 7554, 29918, 13662, 29898, 5696, 29918, 1311, 29892, 24959, 29922, 8516, 29892, 8636, 29922, 8516, 1125, 13, 1678, 565, 24959, 451, 297, 1158, 29918, 1311, 29889, 29887, 7554, 29918, 11177, 29901, 13, 4706, 671, 29918, 29887, 7554, 353, 8636, 29889, 7323, 877, 29887, 7554, 742, 7700, 29897, 13, 4706, 8636, 1839, 13662, 2033, 353, 1158, 29918, 1311, 29889, 13662, 565, 671, 29918, 29887, 7554, 1683, 426, 13, 9651, 1820, 29901, 995, 363, 1820, 29892, 995, 297, 1158, 29918, 1311, 29889, 13662, 29889, 7076, 580, 565, 995, 2804, 525, 29887, 7554, 29915, 13, 4706, 500, 13, 1678, 736, 1158, 29918, 1311, 29892, 24959, 29892, 8636, 13, 13, 13, 1753, 3013, 29918, 27218, 630, 29898, 5696, 29918, 1311, 29892, 24959, 29922, 8516, 29892, 8636, 29922, 8516, 1125, 13, 1678, 9995, 13, 13, 1678, 9995, 13, 1678, 2009, 29918, 2962, 353, 931, 29889, 2230, 580, 13, 1678, 4817, 29918, 14144, 353, 1158, 29918, 1311, 29889, 5150, 29918, 14144, 13, 1678, 1518, 12232, 29918, 2230, 353, 4817, 29918, 14144, 29889, 657, 703, 4548, 12232, 29918, 2230, 613, 29871, 29900, 29897, 565, 4817, 29918, 14144, 1683, 29871, 29900, 13, 1678, 565, 1158, 29918, 1311, 29889, 280, 1664, 322, 451, 4817, 29918, 14144, 29901, 13, 4706, 1158, 29918, 1311, 29889, 27218, 403, 580, 13, 4706, 4817, 29918, 14144, 353, 1158, 29918, 1311, 29889, 5150, 29918, 14144, 13, 1678, 1683, 29901, 13, 4706, 3240, 2722, 353, 29871, 29896, 29900, 13, 4706, 1550, 3240, 2722, 29901, 13, 9651, 565, 1518, 12232, 29918, 2230, 448, 2009, 29918, 2962, 5277, 29871, 29900, 29901, 13, 18884, 931, 29889, 17059, 29898, 29896, 29897, 13, 18884, 4817, 29918, 14144, 353, 1158, 29918, 1311, 29889, 5150, 29918, 14144, 13, 9651, 565, 4817, 29918, 14144, 29901, 13, 18884, 2867, 13, 9651, 3240, 2722, 22361, 29871, 29896, 13, 1678, 565, 376, 5943, 29918, 6979, 29908, 297, 4817, 29918, 14144, 29901, 13, 4706, 1158, 29918, 1311, 29889, 13662, 29889, 5504, 3319, 29908, 25471, 1115, 285, 29915, 29890, 799, 261, 426, 5150, 29918, 14144, 3366, 5943, 29918, 6979, 3108, 10162, 1800, 13, 4706, 8636, 1839, 13662, 13359, 5504, 3319, 29908, 25471, 1115, 285, 29915, 29890, 799, 261, 426, 5150, 29918, 14144, 3366, 5943, 29918, 6979, 3108, 10162, 1800, 13, 1678, 736, 1158, 29918, 1311, 29892, 24959, 29892, 8636, 13, 13, 13, 1753, 19012, 29918, 397, 532, 29898, 21707, 1125, 13, 1678, 288, 1272, 29918, 26705, 353, 6024, 29938, 4572, 742, 14180, 2622, 742, 14180, 2098, 1609, 2033, 13, 13, 1678, 822, 1855, 29918, 19557, 1061, 29898, 5696, 29918, 1311, 29892, 24959, 29892, 8636, 1125, 13, 4706, 288, 1272, 29918, 19290, 353, 8636, 29889, 657, 877, 397, 532, 29918, 19290, 742, 426, 1800, 13, 4706, 4805, 353, 5159, 13, 4706, 565, 288, 1272, 29918, 19290, 29901, 13, 9651, 4805, 353, 518, 1989, 363, 1820, 297, 288, 1272, 29918, 19290, 29889, 8149, 580, 565, 1820, 451, 297, 288, 1272, 29918, 26705, 29962, 13, 4706, 565, 4805, 29901, 13, 9651, 363, 321, 297, 4805, 29901, 13, 18884, 288, 1272, 29918, 19290, 29889, 7323, 29898, 29872, 29897, 13, 9651, 17927, 29889, 27392, 29898, 29888, 29915, 18126, 438, 1469, 4175, 29898, 29879, 29897, 6206, 515, 9049, 5085, 29889, 21403, 4175, 426, 17833, 29913, 1495, 13, 4706, 8636, 1839, 397, 532, 29918, 19290, 2033, 353, 288, 1272, 29918, 19290, 13, 4706, 736, 1158, 29918, 1311, 29892, 24959, 29892, 8636, 13, 1678, 736, 1855, 29918, 19557, 1061, 13, 2 ]
ngallery/core/services/solana.py
manti-by/ngallery
0
127454
from django.conf import settings from solana.rpc.api import Client solana_client = Client(settings.SOLANA_NETWORK_URL)
[ 1, 515, 9557, 29889, 5527, 1053, 6055, 13, 3166, 899, 1648, 29889, 29878, 6739, 29889, 2754, 1053, 12477, 13, 13, 2929, 1648, 29918, 4645, 353, 12477, 29898, 11027, 29889, 29903, 5607, 2190, 29909, 29918, 6006, 11686, 29968, 29918, 4219, 29897, 13, 2 ]
model.py
FutureCoderme/week5_heroku
0
125841
<filename>model.py import pandas as pan import pickle from sklearn.linear_model import LinearRegression data = pan.read_excel('BP_simple_data.xlsx') x1 = data.iloc[:,1:] x2 = data.iloc[:,0:1] reg = LinearRegression() reg.fit(x1,x2) prediction = reg.predict(x1) pickle.dump(reg, open('model.pkl','wb'))
[ 1, 529, 9507, 29958, 4299, 29889, 2272, 13, 5215, 11701, 408, 7243, 13, 5215, 5839, 280, 13, 3166, 2071, 19668, 29889, 10660, 29918, 4299, 1053, 22985, 4597, 23881, 13, 13, 1272, 353, 7243, 29889, 949, 29918, 24633, 877, 29933, 29925, 29918, 12857, 29918, 1272, 29889, 20267, 29916, 1495, 13, 13, 29916, 29896, 353, 848, 29889, 309, 542, 7503, 29892, 29896, 17531, 13, 29916, 29906, 353, 848, 29889, 309, 542, 7503, 29892, 29900, 29901, 29896, 29962, 13, 13, 1727, 353, 22985, 4597, 23881, 580, 13, 1727, 29889, 9202, 29898, 29916, 29896, 29892, 29916, 29906, 29897, 13, 13, 11965, 2463, 353, 1072, 29889, 27711, 29898, 29916, 29896, 29897, 13, 23945, 280, 29889, 15070, 29898, 1727, 29892, 1722, 877, 4299, 29889, 29886, 6321, 3788, 29893, 29890, 8785, 13, 2 ]
fetch_data.py
bitfag/bt-macd-binance
0
3815
<gh_stars>0 #!/usr/bin/env python from btmacd.binance_fetcher import BinanceFetcher def main(): fetcher = BinanceFetcher("BTCUSDT", filename="binance_ohlc.csv", start_date="01.01.2018") fetcher.fetch() if __name__ == "__main__": main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 3166, 289, 29873, 8628, 29881, 29889, 2109, 749, 29918, 9155, 261, 1053, 27662, 749, 20927, 261, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 6699, 261, 353, 27662, 749, 20927, 261, 703, 29933, 9472, 3308, 12972, 613, 10422, 543, 2109, 749, 29918, 10330, 29883, 29889, 7638, 613, 1369, 29918, 1256, 543, 29900, 29896, 29889, 29900, 29896, 29889, 29906, 29900, 29896, 29947, 1159, 13, 1678, 6699, 261, 29889, 9155, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
background_task/models_completed.py
AMRivkin/django-background-tasks
0
1617853
<gh_stars>0 # -*- coding: utf-8 -*- import os from compat.models import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import models from django.utils import timezone from django.utils.six import python_2_unicode_compatible from background_task.models import Task class CompletedTaskQuerySet(models.QuerySet): def created_by(self, creator): """ :return: A CompletedTask queryset filtered by creator """ content_type = ContentType.objects.get_for_model(creator) return self.filter( creator_content_type=content_type, creator_object_id=creator.id, ) def failed(self, within=None): """ :param within: A timedelta object :return: A queryset of CompletedTasks that failed within the given timeframe (e.g. less than 1h ago) """ qs = self.filter( failed_at__isnull=False, ) if within: time_limit = timezone.now() - within qs = qs.filter(failed_at__gt=time_limit) return qs def succeeded(self, within=None): """ :param within: A timedelta object :return: A queryset of CompletedTasks that completed successfully within the given timeframe (e.g. less than 1h ago) """ qs = self.filter( failed_at__isnull=True, ) if within: time_limit = timezone.now() - within qs = qs.filter(run_at__gt=time_limit) return qs @python_2_unicode_compatible class CompletedTask(models.Model): # the "name" of the task/function to be run task_name = models.CharField(max_length=190, db_index=True) # the json encoded parameters to pass to the task task_params = models.TextField() # a sha1 hash of the name and params, to lookup already scheduled tasks task_hash = models.CharField(max_length=40, db_index=True) verbose_name = models.CharField(max_length=255, null=True, blank=True) # what priority the task has priority = models.IntegerField(default=0, db_index=True) # when the task should be run run_at = models.DateTimeField(db_index=True) repeat = models.BigIntegerField(choices=Task.REPEAT_CHOICES, default=Task.NEVER) repeat_until = models.DateTimeField(null=True, blank=True) # the "name" of the queue this is to be run on queue = models.CharField(max_length=190, db_index=True, null=True, blank=True) # how many times the task has been tried attempts = models.IntegerField(default=0, db_index=True) # when the task last failed failed_at = models.DateTimeField(db_index=True, null=True, blank=True) # details of the error that occurred last_error = models.TextField(blank=True) # details of who's trying to run the task at the moment locked_by = models.CharField(max_length=64, db_index=True, null=True, blank=True) locked_at = models.DateTimeField(db_index=True, null=True, blank=True) creator_content_type = models.ForeignKey( ContentType, null=True, blank=True, related_name='completed_background_task', on_delete=models.CASCADE ) creator_object_id = models.PositiveIntegerField(null=True, blank=True) creator = GenericForeignKey('creator_content_type', 'creator_object_id') objects = CompletedTaskQuerySet.as_manager() def locked_by_pid_running(self): """ Check if the locked_by process is still running. """ if self.locked_by: try: # won't kill the process. kill is a bad named system call os.kill(int(self.locked_by), 0) return True except: return False else: return None locked_by_pid_running.boolean = True def has_error(self): """ Check if the last_error field is empty. """ return bool(self.last_error) has_error.boolean = True def __str__(self): return u'{} - {}'.format( self.verbose_name or self.task_name, self.run_at, )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 2897, 13, 13, 3166, 10007, 29889, 9794, 1053, 3251, 293, 27755, 2558, 13, 3166, 9557, 29889, 21570, 29889, 3051, 8768, 29889, 9794, 1053, 10576, 1542, 13, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 13239, 1053, 29431, 13, 3166, 9557, 29889, 13239, 29889, 28319, 1053, 3017, 29918, 29906, 29918, 2523, 356, 29918, 23712, 13, 13, 3166, 3239, 29918, 7662, 29889, 9794, 1053, 9330, 13, 13, 13, 1990, 15642, 9446, 5398, 3010, 2697, 29898, 9794, 29889, 3010, 2697, 1125, 13, 13, 1678, 822, 2825, 29918, 1609, 29898, 1311, 29892, 907, 1061, 1125, 13, 4706, 9995, 13, 4706, 584, 2457, 29901, 319, 15642, 9446, 5398, 2346, 842, 22289, 491, 907, 1061, 13, 4706, 9995, 13, 4706, 2793, 29918, 1853, 353, 10576, 1542, 29889, 12650, 29889, 657, 29918, 1454, 29918, 4299, 29898, 1037, 1061, 29897, 13, 4706, 736, 1583, 29889, 4572, 29898, 13, 9651, 907, 1061, 29918, 3051, 29918, 1853, 29922, 3051, 29918, 1853, 29892, 13, 9651, 907, 1061, 29918, 3318, 29918, 333, 29922, 1037, 1061, 29889, 333, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 5229, 29898, 1311, 29892, 2629, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 584, 3207, 2629, 29901, 319, 5335, 287, 2554, 1203, 13, 4706, 584, 2457, 29901, 319, 2346, 842, 310, 15642, 9446, 26249, 393, 5229, 2629, 278, 2183, 931, 2557, 313, 29872, 29889, 29887, 29889, 3109, 1135, 29871, 29896, 29882, 8020, 29897, 13, 4706, 9995, 13, 4706, 3855, 29879, 353, 1583, 29889, 4572, 29898, 13, 9651, 5229, 29918, 271, 1649, 275, 4304, 29922, 8824, 29892, 13, 4706, 1723, 13, 4706, 565, 2629, 29901, 13, 9651, 931, 29918, 13400, 353, 29431, 29889, 3707, 580, 448, 2629, 13, 9651, 3855, 29879, 353, 3855, 29879, 29889, 4572, 29898, 26061, 29918, 271, 1649, 4141, 29922, 2230, 29918, 13400, 29897, 13, 4706, 736, 3855, 29879, 13, 13, 1678, 822, 14792, 29898, 1311, 29892, 2629, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 584, 3207, 2629, 29901, 319, 5335, 287, 2554, 1203, 13, 4706, 584, 2457, 29901, 319, 2346, 842, 310, 15642, 9446, 26249, 393, 8676, 8472, 2629, 278, 2183, 931, 2557, 13, 4706, 313, 29872, 29889, 29887, 29889, 3109, 1135, 29871, 29896, 29882, 8020, 29897, 13, 4706, 9995, 13, 4706, 3855, 29879, 353, 1583, 29889, 4572, 29898, 13, 9651, 5229, 29918, 271, 1649, 275, 4304, 29922, 5574, 29892, 13, 4706, 1723, 13, 4706, 565, 2629, 29901, 13, 9651, 931, 29918, 13400, 353, 29431, 29889, 3707, 580, 448, 2629, 13, 9651, 3855, 29879, 353, 3855, 29879, 29889, 4572, 29898, 3389, 29918, 271, 1649, 4141, 29922, 2230, 29918, 13400, 29897, 13, 4706, 736, 3855, 29879, 13, 13, 13, 29992, 4691, 29918, 29906, 29918, 2523, 356, 29918, 23712, 13, 1990, 15642, 9446, 5398, 29898, 9794, 29889, 3195, 1125, 13, 1678, 396, 278, 376, 978, 29908, 310, 278, 3414, 29914, 2220, 304, 367, 1065, 13, 1678, 3414, 29918, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29929, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 1678, 396, 278, 4390, 18511, 4128, 304, 1209, 304, 278, 3414, 13, 1678, 3414, 29918, 7529, 353, 4733, 29889, 15778, 580, 13, 1678, 396, 263, 528, 29874, 29896, 6608, 310, 278, 1024, 322, 8636, 29892, 304, 16280, 2307, 21467, 9595, 13, 1678, 3414, 29918, 8568, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29946, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 13, 1678, 26952, 29918, 978, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29892, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 13, 1678, 396, 825, 20136, 278, 3414, 756, 13, 1678, 20136, 353, 4733, 29889, 7798, 3073, 29898, 4381, 29922, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 1678, 396, 746, 278, 3414, 881, 367, 1065, 13, 1678, 1065, 29918, 271, 353, 4733, 29889, 11384, 3073, 29898, 2585, 29918, 2248, 29922, 5574, 29897, 13, 13, 1678, 12312, 353, 4733, 29889, 6970, 7798, 3073, 29898, 1859, 1575, 29922, 5398, 29889, 1525, 4162, 1299, 29918, 3210, 29949, 2965, 2890, 29892, 2322, 29922, 5398, 29889, 8186, 5348, 29897, 13, 1678, 12312, 29918, 29305, 353, 4733, 29889, 11384, 3073, 29898, 4304, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 13, 1678, 396, 278, 376, 978, 29908, 310, 278, 9521, 445, 338, 304, 367, 1065, 373, 13, 1678, 9521, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29929, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 29892, 13, 462, 632, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 13, 1678, 396, 920, 1784, 3064, 278, 3414, 756, 1063, 1898, 13, 1678, 14734, 353, 4733, 29889, 7798, 3073, 29898, 4381, 29922, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 1678, 396, 746, 278, 3414, 1833, 5229, 13, 1678, 5229, 29918, 271, 353, 4733, 29889, 11384, 3073, 29898, 2585, 29918, 2248, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 1678, 396, 4902, 310, 278, 1059, 393, 10761, 13, 1678, 1833, 29918, 2704, 353, 4733, 29889, 15778, 29898, 19465, 29922, 5574, 29897, 13, 13, 1678, 396, 4902, 310, 1058, 29915, 29879, 1811, 304, 1065, 278, 3414, 472, 278, 3256, 13, 1678, 22822, 29918, 1609, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29953, 29946, 29892, 4833, 29918, 2248, 29922, 5574, 29892, 13, 462, 462, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 1678, 22822, 29918, 271, 353, 4733, 29889, 11384, 3073, 29898, 2585, 29918, 2248, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 13, 1678, 907, 1061, 29918, 3051, 29918, 1853, 353, 4733, 29889, 27755, 2558, 29898, 13, 4706, 10576, 1542, 29892, 1870, 29922, 5574, 29892, 9654, 29922, 5574, 29892, 13, 4706, 4475, 29918, 978, 2433, 5729, 9446, 29918, 7042, 29918, 7662, 742, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 13, 1678, 1723, 13, 1678, 907, 1061, 29918, 3318, 29918, 333, 353, 4733, 29889, 9135, 3321, 7798, 3073, 29898, 4304, 29922, 5574, 29892, 9654, 29922, 5574, 29897, 13, 1678, 907, 1061, 353, 3251, 293, 27755, 2558, 877, 1037, 1061, 29918, 3051, 29918, 1853, 742, 525, 1037, 1061, 29918, 3318, 29918, 333, 1495, 13, 13, 1678, 3618, 353, 15642, 9446, 5398, 3010, 2697, 29889, 294, 29918, 12847, 580, 13, 13, 1678, 822, 22822, 29918, 1609, 29918, 5935, 29918, 21094, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 278, 22822, 29918, 1609, 1889, 338, 1603, 2734, 29889, 13, 4706, 9995, 13, 4706, 565, 1583, 29889, 29113, 29918, 1609, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 2113, 29915, 29873, 12088, 278, 1889, 29889, 12088, 338, 263, 4319, 4257, 1788, 1246, 13, 18884, 2897, 29889, 21174, 29898, 524, 29898, 1311, 29889, 29113, 29918, 1609, 511, 29871, 29900, 29897, 13, 18884, 736, 5852, 13, 9651, 5174, 29901, 13, 18884, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 6213, 13, 1678, 22822, 29918, 1609, 29918, 5935, 29918, 21094, 29889, 20054, 353, 5852, 13, 13, 1678, 822, 756, 29918, 2704, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 5399, 565, 278, 1833, 29918, 2704, 1746, 338, 4069, 29889, 13, 4706, 9995, 13, 4706, 736, 6120, 29898, 1311, 29889, 4230, 29918, 2704, 29897, 13, 1678, 756, 29918, 2704, 29889, 20054, 353, 5852, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 318, 29915, 8875, 448, 6571, 4286, 4830, 29898, 13, 9651, 1583, 29889, 369, 15828, 29918, 978, 470, 1583, 29889, 7662, 29918, 978, 29892, 13, 9651, 1583, 29889, 3389, 29918, 271, 29892, 13, 4706, 1723, 13, 2 ]
app.py
CosteaPaul/strokeCoach_falsk
0
120146
from flask import Flask, render_template, request app = Flask(__name__) @app.route('/') def upload(): return render_template('upload.html') @app.route('/uploader', methods = ['GET', 'POST']) def upload_file(): if request.method == 'POST': f = request.files['file'] #f.save(secure_filename(f.filename)) return f.read() if __name__ == '__main__': # Threaded option to enable multiple instances for multiple user access support app.run(threaded=True, port=5000)
[ 1, 515, 29784, 1053, 2379, 1278, 29892, 4050, 29918, 6886, 29892, 2009, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 13, 29992, 932, 29889, 13134, 11219, 1495, 13, 1753, 6441, 7295, 13, 259, 736, 4050, 29918, 6886, 877, 9009, 29889, 1420, 1495, 13, 13, 29992, 932, 29889, 13134, 11219, 9009, 261, 742, 3519, 353, 6024, 7194, 742, 525, 5438, 11287, 13, 1753, 6441, 29918, 1445, 7295, 13, 259, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 418, 285, 353, 2009, 29889, 5325, 1839, 1445, 2033, 13, 418, 396, 29888, 29889, 7620, 29898, 24216, 29918, 9507, 29898, 29888, 29889, 9507, 876, 13, 418, 736, 285, 29889, 949, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 10480, 287, 2984, 304, 9025, 2999, 8871, 363, 2999, 1404, 2130, 2304, 13, 1678, 623, 29889, 3389, 29898, 7097, 287, 29922, 5574, 29892, 2011, 29922, 29945, 29900, 29900, 29900, 29897, 13, 2 ]
utils/state.py
DeWa/PiBooth
1
90550
<filename>utils/state.py class State: state = {} @staticmethod def init(): State.state = { "lowres_frames": None, "highres_frames": None, "photopath": "", "frame": 0, "current_photo": None, "share_code": "", "preview_image_width": 0, "photo_countdown": 0, "reset_time": 0, "upload_url": "", "photo_url": "", "api_key": "" } return State.state @staticmethod def set(value): State.state[value[0]] = value[1] return State.state @staticmethod def set_dict(value): State.state = {**State.state, **value} return State.state @staticmethod def get(key): try: return State.state.get(key) except KeyError: print("No key found") return None @staticmethod def print(): print(State.state)
[ 1, 529, 9507, 29958, 13239, 29914, 3859, 29889, 2272, 13, 1990, 4306, 29901, 13, 1678, 2106, 353, 6571, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2069, 7295, 13, 4706, 4306, 29889, 3859, 353, 426, 13, 9651, 376, 677, 690, 29918, 19935, 1115, 6213, 29892, 13, 9651, 376, 9812, 690, 29918, 19935, 1115, 6213, 29892, 13, 9651, 376, 561, 327, 459, 493, 1115, 12633, 13, 9651, 376, 2557, 1115, 29871, 29900, 29892, 13, 9651, 376, 3784, 29918, 21596, 1115, 6213, 29892, 13, 9651, 376, 13653, 29918, 401, 1115, 12633, 13, 9651, 376, 25347, 29918, 3027, 29918, 2103, 1115, 29871, 29900, 29892, 13, 9651, 376, 21596, 29918, 2798, 3204, 1115, 29871, 29900, 29892, 13, 9651, 376, 12071, 29918, 2230, 1115, 29871, 29900, 29892, 13, 9651, 376, 9009, 29918, 2271, 1115, 12633, 13, 9651, 376, 21596, 29918, 2271, 1115, 12633, 13, 9651, 376, 2754, 29918, 1989, 1115, 5124, 13, 4706, 500, 13, 4706, 736, 4306, 29889, 3859, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 731, 29898, 1767, 1125, 13, 4706, 4306, 29889, 3859, 29961, 1767, 29961, 29900, 5262, 353, 995, 29961, 29896, 29962, 13, 4706, 736, 4306, 29889, 3859, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 731, 29918, 8977, 29898, 1767, 1125, 13, 4706, 4306, 29889, 3859, 353, 426, 1068, 2792, 29889, 3859, 29892, 3579, 1767, 29913, 13, 4706, 736, 4306, 29889, 3859, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29898, 1989, 1125, 13, 4706, 1018, 29901, 13, 9651, 736, 4306, 29889, 3859, 29889, 657, 29898, 1989, 29897, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 1596, 703, 3782, 1820, 1476, 1159, 13, 9651, 736, 6213, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1596, 7295, 13, 4706, 1596, 29898, 2792, 29889, 3859, 29897, 13, 2 ]
andes/models/dc/__init__.py
cuihantao/Andes
16
86876
""" DC models. """ from andes.models.dc.ground import Ground # NOQA from andes.models.dc.node import Node # noqa from andes.models.dc.rlc import R, L, C, RCp, RLCp, RLCs, RCs, RLs # noqa
[ 1, 9995, 13, 12696, 4733, 29889, 13, 15945, 29908, 13, 13, 3166, 322, 267, 29889, 9794, 29889, 13891, 29889, 2057, 1053, 1632, 618, 29871, 396, 11698, 29984, 29909, 13, 3166, 322, 267, 29889, 9794, 29889, 13891, 29889, 3177, 1053, 9071, 29871, 396, 694, 25621, 13, 3166, 322, 267, 29889, 9794, 29889, 13891, 29889, 2096, 29883, 1053, 390, 29892, 365, 29892, 315, 29892, 29138, 29886, 29892, 390, 12182, 29886, 29892, 390, 12182, 29879, 29892, 29138, 29879, 29892, 390, 29931, 29879, 29871, 396, 694, 25621, 13, 2 ]