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
pymunk-pymunk-4.0.0/examples/pyglet_util_demo.py
sneharavi12/DeepLearningFinals
9
172493
"""Showcase what the output of pymunk.pyglet_util draw methods will look like. See pygame_util_demo.py for a comparison to pygame. """ __version__ = "$Id:$" __docformat__ = "reStructuredText" import sys import pyglet import pymunk from pymunk.vec2d import Vec2d import pymunk.pyglet_util from shapes_for_draw_demos import add_objects window = pyglet.window.Window(600, 600) space = pymunk.Space() add_objects(space) textbatch = pyglet.graphics.Batch() pyglet.text.Label('Demo example of shapes drawn by pyglet_util.draw()', x=5, y=5, batch=textbatch, color=(200,200,200,200)) pyglet.text.Label('Static shapes', x=50, y=570, batch=textbatch) pyglet.text.Label('Dynamic shapes', x=250, y=570, batch=textbatch) pyglet.text.Label('Constraints', x=450, y=570, batch=textbatch) pyglet.text.Label('Other', x=450, y=290, batch=textbatch) batch = pyglet.graphics.Batch() @window.event def on_draw(): pyglet.gl.glClearColor(0,0,0,1) window.clear() pymunk.pyglet_util.draw(space) textbatch.draw() @window.event def on_key_press(symbol, modifiers): if symbol == pyglet.window.key.P: pyglet.image.get_buffer_manager().get_color_buffer().save("pyglet_util_demo.png") pyglet.app.run()
[ 1, 9995, 8964, 4878, 825, 278, 1962, 310, 282, 962, 2960, 29889, 2272, 29887, 1026, 29918, 4422, 4216, 3519, 674, 1106, 763, 29889, 13, 13, 13393, 22028, 29918, 4422, 29918, 17482, 29889, 2272, 363, 263, 10230, 304, 22028, 29889, 13, 15945, 29908, 13, 13, 1649, 3259, 1649, 353, 3908, 1204, 17178, 29908, 13, 1649, 1514, 4830, 1649, 353, 376, 276, 19560, 2955, 1626, 29908, 13, 13, 5215, 10876, 13, 13, 5215, 19484, 1026, 13, 268, 13, 5215, 282, 962, 2960, 13, 3166, 282, 962, 2960, 29889, 2003, 29906, 29881, 1053, 26393, 29906, 29881, 13, 5215, 282, 962, 2960, 29889, 2272, 29887, 1026, 29918, 4422, 13, 13, 3166, 25834, 29918, 1454, 29918, 4012, 29918, 2310, 359, 1053, 788, 29918, 12650, 13, 13, 7165, 353, 19484, 1026, 29889, 7165, 29889, 5907, 29898, 29953, 29900, 29900, 29892, 29871, 29953, 29900, 29900, 29897, 13, 3493, 353, 282, 962, 2960, 29889, 14936, 580, 13, 13, 1202, 29918, 12650, 29898, 3493, 29897, 13, 13, 13, 726, 16175, 353, 19484, 1026, 29889, 6420, 29889, 23145, 580, 13, 2272, 29887, 1026, 29889, 726, 29889, 4775, 877, 23444, 1342, 310, 25834, 12061, 491, 19484, 1026, 29918, 4422, 29889, 4012, 580, 742, 13, 462, 418, 921, 29922, 29945, 29892, 343, 29922, 29945, 29892, 9853, 29922, 726, 16175, 29892, 2927, 7607, 29906, 29900, 29900, 29892, 29906, 29900, 29900, 29892, 29906, 29900, 29900, 29892, 29906, 29900, 29900, 876, 13, 2272, 29887, 1026, 29889, 726, 29889, 4775, 877, 17046, 25834, 742, 921, 29922, 29945, 29900, 29892, 343, 29922, 29945, 29955, 29900, 29892, 9853, 29922, 726, 16175, 29897, 13, 2272, 29887, 1026, 29889, 726, 29889, 4775, 877, 24001, 25834, 742, 921, 29922, 29906, 29945, 29900, 29892, 343, 29922, 29945, 29955, 29900, 29892, 9853, 29922, 726, 16175, 29897, 13, 2272, 29887, 1026, 29889, 726, 29889, 4775, 877, 27427, 742, 921, 29922, 29946, 29945, 29900, 29892, 343, 29922, 29945, 29955, 29900, 29892, 9853, 29922, 726, 16175, 29897, 13, 2272, 29887, 1026, 29889, 726, 29889, 4775, 877, 16107, 742, 921, 29922, 29946, 29945, 29900, 29892, 343, 29922, 29906, 29929, 29900, 29892, 9853, 29922, 726, 16175, 29897, 13, 13, 13, 16175, 353, 19484, 1026, 29889, 6420, 29889, 23145, 580, 13, 13, 29992, 7165, 29889, 3696, 13, 1753, 373, 29918, 4012, 7295, 13, 1678, 19484, 1026, 29889, 3820, 29889, 3820, 18759, 3306, 29898, 29900, 29892, 29900, 29892, 29900, 29892, 29896, 29897, 13, 1678, 3474, 29889, 8551, 580, 13, 268, 13, 1678, 282, 962, 2960, 29889, 2272, 29887, 1026, 29918, 4422, 29889, 4012, 29898, 3493, 29897, 13, 1678, 1426, 16175, 29889, 4012, 580, 13, 268, 13, 29992, 7165, 29889, 3696, 13, 1753, 373, 29918, 1989, 29918, 2139, 29898, 18098, 29892, 878, 14903, 1125, 13, 1678, 565, 5829, 1275, 19484, 1026, 29889, 7165, 29889, 1989, 29889, 29925, 29901, 13, 4706, 19484, 1026, 29889, 3027, 29889, 657, 29918, 9040, 29918, 12847, 2141, 657, 29918, 2780, 29918, 9040, 2141, 7620, 703, 2272, 29887, 1026, 29918, 4422, 29918, 17482, 29889, 2732, 1159, 13, 462, 539, 13, 13, 2272, 29887, 1026, 29889, 932, 29889, 3389, 580, 2 ]
researchutils/chainer/training/__init__.py
keio-ytlab/researchutils
1
101885
from researchutils.chainer.training import extensions
[ 1, 515, 5925, 13239, 29889, 305, 4008, 29889, 26495, 1053, 17752, 2 ]
pydocteur/__init__.py
awecx/PyDocTeur
4
185003
<filename>pydocteur/__init__.py from pydocteur.app import application __all__ = ["application"]
[ 1, 529, 9507, 29958, 2272, 1867, 312, 5411, 29914, 1649, 2344, 26914, 2272, 13, 3166, 11451, 1867, 312, 5411, 29889, 932, 1053, 2280, 13, 13, 1649, 497, 1649, 353, 6796, 6214, 3108, 13, 2 ]
examples/bintree.py
jdrprod/Pym-s
3
32847
class binary_tree: def __init__(self): pass class Node(binary_tree): __field_0 : int __field_1 : binary_tree __field_2 : binary_tree def __init__(self, arg_0 : int , arg_1 : binary_tree , arg_2 : binary_tree ): self.__field_0 = arg_0 self.__field_1 = arg_1 self.__field_2 = arg_2 def __iter__(self): yield self.__field_0 yield self.__field_1 yield self.__field_2 class Leaf(binary_tree): __field_0 : int def __init__(self, arg_0 : int ): self.__field_0 = arg_0 def __iter__(self): yield self.__field_0
[ 1, 770, 7581, 29918, 8336, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 308, 1209, 13, 13, 1990, 9071, 29898, 19541, 29918, 8336, 1125, 13, 1678, 4770, 2671, 29918, 29900, 584, 938, 13, 1678, 4770, 2671, 29918, 29896, 584, 7581, 29918, 8336, 13, 1678, 4770, 2671, 29918, 29906, 584, 7581, 29918, 8336, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1852, 29918, 29900, 584, 938, 1919, 1852, 29918, 29896, 584, 7581, 29918, 8336, 1919, 1852, 29918, 29906, 584, 7581, 29918, 8336, 29871, 1125, 13, 4706, 1583, 17255, 2671, 29918, 29900, 353, 1852, 29918, 29900, 13, 4706, 1583, 17255, 2671, 29918, 29896, 353, 1852, 29918, 29896, 13, 4706, 1583, 17255, 2671, 29918, 29906, 353, 1852, 29918, 29906, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 7709, 1583, 17255, 2671, 29918, 29900, 13, 4706, 7709, 1583, 17255, 2671, 29918, 29896, 13, 4706, 7709, 1583, 17255, 2671, 29918, 29906, 13, 13, 1990, 951, 2142, 29898, 19541, 29918, 8336, 1125, 13, 1678, 4770, 2671, 29918, 29900, 584, 938, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1852, 29918, 29900, 584, 938, 29871, 1125, 13, 4706, 1583, 17255, 2671, 29918, 29900, 353, 1852, 29918, 29900, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 7709, 1583, 17255, 2671, 29918, 29900, 13, 13, 2 ]
updatesproducer/tests/mock_updates_provider.py
AppleteeYT/Iris
0
159303
from datetime import datetime from updatesproducer.iupdates_provider import IUpdatesProvider from updatesproducer.updateapi.update import Update class MockUpdatesProvider(IUpdatesProvider): def get_updates(self, user_id: str): return [ Update( content='Mock updateapi', author_id='Mock author', creation_date=datetime.now(), url='mockurl://updateapi.com', media=[], repost=False, should_redownload_video=False) ]
[ 1, 515, 12865, 1053, 12865, 13, 13, 3166, 11217, 5498, 2265, 29889, 29875, 786, 15190, 29918, 18121, 1053, 306, 3373, 15190, 6980, 13, 3166, 11217, 5498, 2265, 29889, 5504, 2754, 29889, 5504, 1053, 10318, 13, 13, 13, 1990, 26297, 3373, 15190, 6980, 29898, 29902, 3373, 15190, 6980, 1125, 13, 1678, 822, 679, 29918, 786, 15190, 29898, 1311, 29892, 1404, 29918, 333, 29901, 851, 1125, 13, 4706, 736, 518, 13, 9651, 10318, 29898, 13, 18884, 2793, 2433, 18680, 2767, 2754, 742, 13, 18884, 4148, 29918, 333, 2433, 18680, 4148, 742, 13, 18884, 11265, 29918, 1256, 29922, 12673, 29889, 3707, 3285, 13, 18884, 3142, 2433, 17640, 2271, 597, 5504, 2754, 29889, 510, 742, 13, 18884, 5745, 11759, 1402, 13, 18884, 1634, 520, 29922, 8824, 29892, 13, 18884, 881, 29918, 1127, 776, 1359, 29918, 9641, 29922, 8824, 29897, 13, 4706, 4514, 2 ]
PyOffice/OpenFile.py
AMoazeni/PyOffice
0
152205
<filename>PyOffice/OpenFile.py from time import time as t from urllib.request import urlopen as get def OpenFile(*args, **kwargs): ''' OpenFile(str 'file_path') requires an 'str' PATH or URL input, returns a Python Dictionary with the file data. ''' # Initialize func_name = 'OpenFile' print(func_name, '[START]') if args: print(func_name, 'Path:', args[0]) time_start = t() error = 0 error_msg = '' path = '' data = {} data_len = 0 # OpenFile Function Block try: path = str(args[0]) data['Data'] = [] # PATH is a URL. if 'http' in path.lower(): page = get(path) page_code = page.getcode() data['ResponseCode'] = page_code page_headers = page.getheaders() data['Headers'] = page_headers for line in page.readlines(): data['Data'].append(line.decode('utf-8')) data_len = data_len + len(str(line)) # PATH is a local file. else: with open(path, 'r', encoding="utf-8") as file: for line in file: data['Data'].append(line) data_len = data_len + len(line) data['TimeStart'] = float(round(time_start, 4)) data['TimeEx'] = float(round(t() - time_start, 4)) data['Path'] = path data['Name'] = path.split('/')[-1] data['Extension'] = path.split('.')[-1] data['Lines'] = len(data['Data']) data['DataLength'] = data_len return data # Error Handler except BaseException as e: error = 1 error_msg = str(e) # Clean up block finally: if error: print(func_name, '[ERROR]:', error_msg) else: print(func_name, '[OK] {0:.3f}s\n'.format(float(t() - time_start))) pass
[ 1, 529, 9507, 29958, 19737, 27247, 29914, 6585, 2283, 29889, 2272, 13, 3166, 931, 1053, 931, 408, 260, 13, 3166, 3142, 1982, 29889, 3827, 1053, 5065, 417, 2238, 408, 679, 13, 13, 1753, 4673, 2283, 10456, 5085, 29892, 3579, 19290, 1125, 13, 268, 13, 1678, 14550, 4673, 2283, 29898, 710, 525, 1445, 29918, 2084, 1495, 6858, 385, 525, 710, 29915, 23611, 470, 3988, 1881, 29892, 13, 4706, 3639, 263, 5132, 13343, 411, 278, 934, 848, 29889, 29871, 13, 1678, 14550, 13, 268, 13, 1678, 396, 25455, 13, 1678, 3653, 29918, 978, 353, 525, 6585, 2283, 29915, 13, 1678, 1596, 29898, 9891, 29918, 978, 29892, 525, 29961, 25826, 29962, 1495, 13, 1678, 565, 6389, 29901, 1596, 29898, 9891, 29918, 978, 29892, 525, 2605, 29901, 742, 6389, 29961, 29900, 2314, 13, 1678, 931, 29918, 2962, 353, 260, 580, 13, 1678, 1059, 353, 29871, 29900, 13, 1678, 1059, 29918, 7645, 353, 6629, 13, 268, 13, 1678, 2224, 353, 6629, 13, 1678, 848, 353, 6571, 13, 1678, 848, 29918, 2435, 353, 29871, 29900, 13, 268, 13, 1678, 396, 4673, 2283, 6680, 15658, 13, 1678, 1018, 29901, 13, 4706, 2224, 353, 851, 29898, 5085, 29961, 29900, 2314, 13, 4706, 848, 1839, 1469, 2033, 353, 5159, 13, 308, 13, 4706, 396, 23611, 338, 263, 3988, 29889, 13, 4706, 565, 525, 1124, 29915, 297, 2224, 29889, 13609, 7295, 13, 9651, 1813, 353, 679, 29898, 2084, 29897, 13, 9651, 1813, 29918, 401, 353, 1813, 29889, 657, 401, 580, 13, 9651, 848, 1839, 5103, 3399, 2033, 353, 1813, 29918, 401, 13, 9651, 1813, 29918, 13662, 353, 1813, 29889, 657, 13662, 580, 13, 9651, 848, 1839, 18163, 2033, 353, 1813, 29918, 13662, 13, 9651, 363, 1196, 297, 1813, 29889, 949, 9012, 7295, 13, 18884, 848, 1839, 1469, 13359, 4397, 29898, 1220, 29889, 13808, 877, 9420, 29899, 29947, 8785, 13, 18884, 848, 29918, 2435, 353, 848, 29918, 2435, 718, 7431, 29898, 710, 29898, 1220, 876, 13, 462, 13, 4706, 396, 23611, 338, 263, 1887, 934, 29889, 308, 13, 4706, 1683, 29901, 13, 9651, 411, 1722, 29898, 2084, 29892, 525, 29878, 742, 8025, 543, 9420, 29899, 29947, 1159, 408, 934, 29901, 13, 18884, 363, 1196, 297, 934, 29901, 13, 462, 1678, 848, 1839, 1469, 13359, 4397, 29898, 1220, 29897, 13, 462, 1678, 848, 29918, 2435, 353, 848, 29918, 2435, 718, 7431, 29898, 1220, 29897, 13, 308, 13, 308, 13, 4706, 848, 1839, 2481, 4763, 2033, 353, 5785, 29898, 14486, 29898, 2230, 29918, 2962, 29892, 29871, 29946, 876, 13, 4706, 848, 1839, 2481, 1252, 2033, 353, 5785, 29898, 14486, 29898, 29873, 580, 448, 931, 29918, 2962, 29892, 29871, 29946, 876, 13, 4706, 848, 1839, 2605, 2033, 353, 2224, 13, 4706, 848, 1839, 1170, 2033, 353, 2224, 29889, 5451, 11219, 1495, 14352, 29896, 29962, 13, 4706, 848, 1839, 17657, 2033, 353, 2224, 29889, 5451, 12839, 1495, 14352, 29896, 29962, 13, 4706, 848, 1839, 20261, 2033, 353, 7431, 29898, 1272, 1839, 1469, 11287, 13, 4706, 848, 1839, 1469, 6513, 2033, 353, 848, 29918, 2435, 13, 308, 13, 4706, 736, 848, 13, 13, 1678, 396, 4829, 5166, 1358, 13, 1678, 5174, 7399, 2451, 408, 321, 29901, 13, 4706, 1059, 353, 29871, 29896, 13, 4706, 1059, 29918, 7645, 353, 851, 29898, 29872, 29897, 13, 13, 268, 13, 1678, 396, 315, 14044, 701, 2908, 13, 1678, 7146, 29901, 13, 4706, 565, 1059, 29901, 13, 9651, 1596, 29898, 9891, 29918, 978, 29892, 525, 29961, 11432, 5387, 742, 1059, 29918, 7645, 29897, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 9891, 29918, 978, 29892, 525, 29961, 8949, 29962, 426, 29900, 29901, 29889, 29941, 29888, 29913, 29879, 29905, 29876, 4286, 4830, 29898, 7411, 29898, 29873, 580, 448, 931, 29918, 2962, 4961, 13, 4706, 1209, 13, 13, 13, 13, 2 ]
python-checker/Examples/FULL/cob_command_gui/src/command_gui_buttons/__init__.py
andersfischernielsen/ROS-dependency-checker
0
171309
from command_gui_buttons import *
[ 1, 515, 1899, 29918, 23569, 29918, 4187, 7453, 1053, 334, 13, 2 ]
convertJSON.py
Grupo-3-PEI/website
0
191660
<filename>convertJSON.py import json def convert(jsonfile): return json.dumps({ "type": "FeatureCollection", "features": [ {"type": "Feature", "geometry": { "type": "Point", "coordinates": [ feature['lon'], feature['lat']]}, "properties": { key: value for key, value in feature.jsonfile() if key not in ('lat', 'lon') } } for feature in json.loads(jsonfile) ] })
[ 1, 529, 9507, 29958, 13441, 7249, 29889, 2272, 13, 5215, 4390, 30004, 13, 30004, 13, 1753, 3588, 29898, 3126, 1445, 1125, 30004, 13, 1678, 736, 4390, 29889, 29881, 17204, 3319, 376, 1853, 1115, 376, 19132, 7196, 15231, 13, 462, 4706, 376, 22100, 1115, 518, 30004, 13, 462, 462, 4706, 8853, 1853, 1115, 376, 19132, 15231, 13, 462, 462, 308, 376, 19156, 1115, 426, 376, 1853, 1115, 376, 5228, 15231, 13, 462, 462, 462, 539, 376, 1111, 24266, 1115, 518, 4682, 1839, 12957, 7464, 30004, 13, 462, 462, 462, 462, 4706, 4682, 1839, 5066, 2033, 29962, 1118, 30004, 13, 462, 462, 308, 376, 11330, 1115, 426, 1820, 29901, 995, 30004, 13, 462, 462, 462, 308, 363, 1820, 29892, 995, 297, 4682, 29889, 3126, 1445, 26471, 13, 462, 462, 462, 308, 565, 1820, 451, 297, 6702, 5066, 742, 525, 12957, 1495, 4970, 13, 462, 462, 4706, 4970, 13, 462, 462, 1678, 363, 4682, 297, 4390, 29889, 18132, 29898, 3126, 1445, 8443, 13, 462, 462, 1678, 4514, 30004, 13, 462, 1678, 5615, 2 ]
FreeBSD/bsd_netstats_poller.py
failedrequest/telegraf-plugins
0
19639
<filename>FreeBSD/bsd_netstats_poller.py #!/usr/bin/env python3 # 3/21/2021 # Updated for python3 # A Simple sysctl to telegraf plugin for freebsd's netstats ip info from freebsd_sysctl import Sysctl as sysctl import subprocess as sp import re import json import sys import pprint as pp hostname = sysctl("kern.hostname").value netstat_data = {} points_netstat = {} netstat_output = sp.check_output(["netstat", "-s", "-p", "ip", "--libxo", "json", "/dev/null"],universal_newlines=True) netstat_data = json.loads(netstat_output) for x in netstat_data["statistics"]: for k,v in netstat_data["statistics"][x].items(): points_netstat[k] = v def points_to_influx(points): field_tags= ",".join(["{k}={v}".format(k=str(x[0]), v=x[1]) for x in list(points_netstat.items())]) print(("bsd_netstat,type=netstat {}").format(field_tags)) points_to_influx(points_netstat)
[ 1, 529, 9507, 29958, 20475, 29933, 7230, 29914, 29890, 4928, 29918, 1212, 16202, 29918, 3733, 1358, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 29937, 29871, 29941, 29914, 29906, 29896, 29914, 29906, 29900, 29906, 29896, 13, 29937, 25723, 363, 3017, 29941, 13, 29937, 319, 12545, 10876, 16948, 304, 734, 1397, 1929, 7079, 363, 3005, 774, 4928, 29915, 29879, 7787, 16202, 10377, 5235, 13, 13, 3166, 3005, 774, 4928, 29918, 9675, 16948, 1053, 317, 952, 16948, 408, 10876, 16948, 13, 5215, 1014, 5014, 408, 805, 13, 5215, 337, 13, 5215, 4390, 13, 5215, 10876, 13, 5215, 282, 2158, 408, 6499, 13, 13, 28988, 353, 10876, 16948, 703, 22178, 29889, 28988, 2564, 1767, 13, 1212, 6112, 29918, 1272, 353, 6571, 13, 9748, 29918, 1212, 6112, 353, 6571, 13, 13, 1212, 6112, 29918, 4905, 353, 805, 29889, 3198, 29918, 4905, 29898, 3366, 1212, 6112, 613, 11663, 29879, 613, 11663, 29886, 613, 376, 666, 613, 376, 489, 1982, 29916, 29877, 613, 376, 3126, 613, 5591, 3359, 29914, 4304, 12436, 14540, 284, 29918, 1482, 9012, 29922, 5574, 29897, 13, 13, 1212, 6112, 29918, 1272, 353, 4390, 29889, 18132, 29898, 1212, 6112, 29918, 4905, 29897, 13, 13, 1454, 921, 297, 7787, 6112, 29918, 1272, 3366, 6112, 6765, 3108, 29901, 13, 29871, 363, 413, 29892, 29894, 297, 7787, 6112, 29918, 1272, 3366, 6112, 6765, 3108, 29961, 29916, 1822, 7076, 7295, 13, 268, 3291, 29918, 1212, 6112, 29961, 29895, 29962, 353, 325, 13, 13, 1753, 3291, 29918, 517, 29918, 13453, 1314, 29898, 9748, 1125, 13, 1678, 1746, 29918, 11338, 29922, 9162, 1642, 7122, 29898, 3366, 29912, 29895, 29913, 3790, 29894, 29913, 1642, 4830, 29898, 29895, 29922, 710, 29898, 29916, 29961, 29900, 11724, 325, 29922, 29916, 29961, 29896, 2314, 363, 921, 297, 1051, 29898, 9748, 29918, 1212, 6112, 29889, 7076, 3101, 2314, 13, 1678, 1596, 29898, 703, 29890, 4928, 29918, 1212, 6112, 29892, 1853, 29922, 1212, 6112, 6571, 2564, 4830, 29898, 2671, 29918, 11338, 876, 13, 13, 13, 9748, 29918, 517, 29918, 13453, 1314, 29898, 9748, 29918, 1212, 6112, 29897, 13, 13, 13, 13, 13, 13, 13, 2 ]
utils/convert.py
apozanco/icaps2022.github.io
0
126263
<filename>utils/convert.py import sys def convert(in_file, out_file): with open(in_file, 'r') as f: lines = [l.strip() for l in f.readlines()] new_lines = [] # First, combine all lines that are not empty for line in lines: if (line == '') or (line[0] in ['-', '*']): new_lines.append(line) else: new_lines[-1] += ' ' + line # Convert the rest for i in range(len(new_lines)): line = new_lines[i].replace('\t', ' ').replace('\r', '').replace('\n', '').strip() if line == '': new_lines[i] = '' elif line[:2] == '# ': new_lines[i] = '<h3>' + line[2:] + '</h3>' elif line[0] in ['-', '*']: new_lines[i] = '<li>' + line[1:] + '</li>' elif line[:3] in [f'{i}. ' for i in range(1,10)]: new_lines[i] = '<li>' + line[3:] + '</li>' else: new_lines[i] = '<p>' + line + '</p>' with open(out_file, 'w') as f: for line in new_lines: f.write(line + '\n') if __name__ == '__main__': if len(sys.argv) != 3: print('Usage: convert.py <input_file> <output_file>') sys.exit(1) input_file = sys.argv[1] output_file = sys.argv[2] convert(input_file, output_file)
[ 1, 529, 9507, 29958, 13239, 29914, 13441, 29889, 2272, 13, 13, 5215, 10876, 13, 13, 1753, 3588, 29898, 262, 29918, 1445, 29892, 714, 29918, 1445, 1125, 13, 1678, 411, 1722, 29898, 262, 29918, 1445, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 4706, 3454, 353, 518, 29880, 29889, 17010, 580, 363, 301, 297, 285, 29889, 949, 9012, 580, 29962, 13, 13, 1678, 716, 29918, 9012, 353, 5159, 13, 13, 1678, 396, 3824, 29892, 14405, 599, 3454, 393, 526, 451, 4069, 13, 1678, 363, 1196, 297, 3454, 29901, 13, 4706, 565, 313, 1220, 1275, 27255, 470, 313, 1220, 29961, 29900, 29962, 297, 6024, 29899, 742, 525, 29930, 2033, 1125, 13, 9651, 716, 29918, 9012, 29889, 4397, 29898, 1220, 29897, 13, 4706, 1683, 29901, 13, 9651, 716, 29918, 9012, 14352, 29896, 29962, 4619, 525, 525, 718, 1196, 13, 13, 1678, 396, 14806, 278, 1791, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 1482, 29918, 9012, 22164, 13, 4706, 1196, 353, 716, 29918, 9012, 29961, 29875, 1822, 6506, 28909, 29873, 742, 525, 525, 467, 6506, 28909, 29878, 742, 525, 2824, 6506, 28909, 29876, 742, 525, 2824, 17010, 580, 13, 4706, 565, 1196, 1275, 525, 2396, 13, 9651, 716, 29918, 9012, 29961, 29875, 29962, 353, 6629, 13, 4706, 25342, 1196, 7503, 29906, 29962, 1275, 16321, 525, 29901, 13, 9651, 716, 29918, 9012, 29961, 29875, 29962, 353, 12801, 29882, 29941, 16299, 718, 1196, 29961, 29906, 17531, 718, 525, 829, 29882, 29941, 16299, 13, 4706, 25342, 1196, 29961, 29900, 29962, 297, 6024, 29899, 742, 525, 29930, 2033, 29901, 13, 9651, 716, 29918, 9012, 29961, 29875, 29962, 353, 12801, 492, 16299, 718, 1196, 29961, 29896, 17531, 718, 525, 829, 492, 16299, 13, 4706, 25342, 1196, 7503, 29941, 29962, 297, 518, 29888, 29915, 29912, 29875, 1836, 525, 363, 474, 297, 3464, 29898, 29896, 29892, 29896, 29900, 4638, 29901, 13, 9651, 716, 29918, 9012, 29961, 29875, 29962, 353, 12801, 492, 16299, 718, 1196, 29961, 29941, 17531, 718, 525, 829, 492, 16299, 13, 4706, 1683, 29901, 13, 9651, 716, 29918, 9012, 29961, 29875, 29962, 353, 12801, 29886, 16299, 718, 1196, 718, 525, 829, 29886, 16299, 13, 13, 1678, 411, 1722, 29898, 449, 29918, 1445, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 4706, 363, 1196, 297, 716, 29918, 9012, 29901, 13, 9651, 285, 29889, 3539, 29898, 1220, 718, 11297, 29876, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 565, 7431, 29898, 9675, 29889, 19218, 29897, 2804, 29871, 29941, 29901, 13, 4706, 1596, 877, 27573, 29901, 3588, 29889, 2272, 529, 2080, 29918, 1445, 29958, 529, 4905, 29918, 1445, 29958, 1495, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 1881, 29918, 1445, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 1678, 1962, 29918, 1445, 353, 10876, 29889, 19218, 29961, 29906, 29962, 13, 13, 1678, 3588, 29898, 2080, 29918, 1445, 29892, 1962, 29918, 1445, 29897, 13, 13, 2 ]
ggcontable/production.py
jmjacquet/IronWeb
0
53515
<reponame>jmjacquet/IronWeb # Django settings for sistema_bomberos project. from .settings import * from decouple import config DEBUG = False STATIC_URL = '/staticfiles/' DB_USER = config('DB_USER') DB_PASS = config('DB_PASS') DB_HOST = config('DB_HOST') DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': ENTIDAD_DB, # Or path to database file if using sqlite3. 'USER': DB_USER, 'PASSWORD': <PASSWORD>, # Not used with sqlite3. 'HOST': DB_HOST, # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', }, } TEMPLATE_DEBUG = DEBUG STATIC_ROOT = os.path.join(SITE_ROOT, 'static') STATICFILES_DIRS = ( os.path.join(SITE_ROOT, "staticfiles"), # os.path.join(SITE_ROOT, "dist"), )
[ 1, 529, 276, 1112, 420, 29958, 21231, 29926, 562, 12621, 29914, 29902, 1617, 3609, 13, 29937, 15337, 6055, 363, 10502, 29918, 29890, 290, 495, 359, 2060, 29889, 13, 3166, 869, 11027, 1053, 334, 13, 3166, 1602, 283, 552, 1053, 2295, 13, 13, 18525, 353, 7700, 13, 13, 17816, 2965, 29918, 4219, 353, 8207, 7959, 5325, 22208, 13, 13, 4051, 29918, 11889, 353, 2295, 877, 4051, 29918, 11889, 1495, 13, 4051, 29918, 25711, 353, 2295, 877, 4051, 29918, 25711, 1495, 13, 4051, 29918, 20832, 353, 2295, 877, 4051, 29918, 20832, 1495, 13, 13, 25832, 27982, 29903, 353, 426, 13, 4706, 525, 4381, 2396, 426, 13, 9651, 525, 1430, 29954, 8895, 2396, 525, 14095, 29889, 2585, 29889, 1627, 1975, 29889, 7938, 742, 396, 3462, 525, 29272, 29918, 567, 29891, 9708, 29887, 29906, 742, 525, 29272, 742, 525, 7938, 742, 525, 22793, 29941, 29915, 470, 525, 11347, 4286, 13, 9651, 525, 5813, 2396, 12524, 29911, 1367, 3035, 29918, 4051, 29892, 965, 396, 1394, 2224, 304, 2566, 934, 565, 773, 21120, 29941, 29889, 13, 9651, 525, 11889, 2396, 29871, 6535, 29918, 11889, 29892, 268, 13, 9651, 525, 25711, 17013, 2396, 29871, 529, 25711, 17013, 10202, 9651, 396, 2216, 1304, 411, 21120, 29941, 29889, 13, 9651, 525, 20832, 2396, 29871, 6535, 29918, 20832, 29892, 462, 418, 396, 3789, 304, 4069, 1347, 363, 15683, 29889, 2216, 1304, 411, 21120, 29941, 29889, 13, 9651, 525, 15082, 2396, 15516, 539, 13, 4706, 2981, 13, 1678, 500, 13, 13, 4330, 3580, 29931, 3040, 29918, 18525, 353, 21681, 13, 13, 17816, 2965, 29918, 21289, 353, 2897, 29889, 2084, 29889, 7122, 29898, 29903, 9094, 29918, 21289, 29892, 525, 7959, 1495, 13, 13, 17816, 2965, 24483, 29918, 9464, 29903, 353, 313, 13, 1678, 2897, 29889, 2084, 29889, 7122, 29898, 29903, 9094, 29918, 21289, 29892, 376, 7959, 5325, 4968, 1678, 13, 1678, 396, 2897, 29889, 2084, 29889, 7122, 29898, 29903, 9094, 29918, 21289, 29892, 376, 5721, 4968, 259, 13, 29897, 2 ]
gpenkf/experiments/data_provider.py
danilkuzin/GP-EnKF
12
156235
<reponame>danilkuzin/GP-EnKF class DataProvider(object): pass
[ 1, 529, 276, 1112, 420, 29958, 18386, 309, 2120, 23374, 29914, 19903, 29899, 2369, 29968, 29943, 13, 1990, 3630, 6980, 29898, 3318, 1125, 13, 1678, 1209, 2 ]
Codility/PassingCars.py
batumoglu/Python_Algorithms
0
121578
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def prefix(A): pref = [0] * (len(A)+1) for i in range(1, len(A)+1): pref[i] = pref[i-1] + A[i-1] return pref def countTotal(P, left, right): return P[right] - P[left] def solution(A): pref = prefix(A) n = len(A) pairs = 0 for i in range(len(A)): if A[i] == 0: pairs += countTotal(pref, i, n) if pairs > 1000000000: return -1 return pairs if __name__ == '__main__': #print(solution([0,0,0,0,1,1,1,0,1,0,1,0,1,0])) print(solution([0,1,0,1,1]))
[ 1, 396, 366, 508, 2436, 304, 27591, 363, 13490, 11976, 29892, 321, 29889, 29887, 29889, 13, 29937, 1596, 703, 1366, 338, 263, 4744, 2643, 1159, 13, 1753, 10944, 29898, 29909, 1125, 13, 1678, 758, 29888, 353, 518, 29900, 29962, 334, 313, 2435, 29898, 29909, 7240, 29896, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 7431, 29898, 29909, 7240, 29896, 1125, 13, 4706, 758, 29888, 29961, 29875, 29962, 353, 758, 29888, 29961, 29875, 29899, 29896, 29962, 718, 319, 29961, 29875, 29899, 29896, 29962, 13, 1678, 736, 758, 29888, 13, 13, 1753, 2302, 11536, 29898, 29925, 29892, 2175, 29892, 1492, 1125, 13, 1678, 736, 349, 29961, 1266, 29962, 448, 349, 29961, 1563, 29962, 13, 13, 1753, 1650, 29898, 29909, 1125, 13, 1678, 758, 29888, 353, 10944, 29898, 29909, 29897, 13, 1678, 302, 353, 7431, 29898, 29909, 29897, 13, 1678, 11000, 353, 29871, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29909, 22164, 13, 4706, 565, 319, 29961, 29875, 29962, 1275, 29871, 29900, 29901, 13, 9651, 11000, 4619, 2302, 11536, 29898, 29886, 999, 29892, 474, 29892, 302, 29897, 13, 4706, 565, 11000, 1405, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29901, 13, 9651, 736, 448, 29896, 13, 1678, 736, 11000, 13, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 2158, 29898, 2929, 918, 4197, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29900, 29892, 29896, 29892, 29900, 29892, 29896, 29892, 29900, 29892, 29896, 29892, 29900, 12622, 13, 1678, 1596, 29898, 2929, 918, 4197, 29900, 29892, 29896, 29892, 29900, 29892, 29896, 29892, 29896, 12622, 2 ]
parakeet/models/fastspeech/length_regulator.py
xbsdsongnan/Parakeet
1
133923
<gh_stars>1-10 # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import numpy as np import math import parakeet.models.fastspeech.utils import paddle.fluid.dygraph as dg import paddle.fluid.layers as layers import paddle.fluid as fluid from parakeet.modules.customized import Conv1D class LengthRegulator(dg.Layer): def __init__(self, input_size, out_channels, filter_size, dropout=0.1): """Length Regulator block in FastSpeech. Args: input_size (int): the channel number of input. out_channels (int): the output channel number. filter_size (int): the filter size of duration predictor. dropout (float, optional): dropout probability. Defaults to 0.1. """ super(LengthRegulator, self).__init__() self.duration_predictor = DurationPredictor( input_size=input_size, out_channels=out_channels, filter_size=filter_size, dropout=dropout) def LR(self, x, duration_predictor_output): output = [] batch_size = x.shape[0] for i in range(batch_size): output.append( self.expand(x[i:i + 1], duration_predictor_output[i:i + 1])) output = self.pad(output) return output def pad(self, input_ele): max_len = max([input_ele[i].shape[0] for i in range(len(input_ele))]) out_list = [] for i in range(len(input_ele)): pad_len = max_len - input_ele[i].shape[0] one_batch_padded = layers.pad(input_ele[i], [0, pad_len, 0, 0], pad_value=0.0) out_list.append(one_batch_padded) out_padded = layers.stack(out_list) return out_padded def expand(self, batch, predicted): out = [] time_steps = batch.shape[1] fertilities = predicted.numpy() batch = layers.squeeze(batch, [0]) for i in range(time_steps): if fertilities[0, i] == 0: continue out.append( layers.expand(batch[i:i + 1, :], [int(fertilities[0, i]), 1])) out = layers.concat(out, axis=0) return out def forward(self, x, alpha=1.0, target=None): """ Compute length of mel from encoder output use TransformerTTS attention Args: x (Variable): shape(B, T, C), dtype float32, the encoder output. alpha (float32, optional): the hyperparameter to determine the length of the expanded sequence mel, thereby controlling the voice speed. Defaults to 1.0. target (Variable, optional): shape(B, T_text), dtype int64, the duration of phoneme compute from pretrained transformerTTS. Defaults to None. Returns: output (Variable): shape(B, T, C), the output after exppand. duration_predictor_output (Variable): shape(B, T, C), the output of duration predictor. """ duration_predictor_output = self.duration_predictor(x) if fluid.framework._dygraph_tracer()._train_mode: output = self.LR(x, target) return output, duration_predictor_output else: duration_predictor_output = duration_predictor_output * alpha duration_predictor_output = layers.ceil(duration_predictor_output) output = self.LR(x, duration_predictor_output) mel_pos = dg.to_variable(np.arange(1, output.shape[1] + 1)).astype( np.int64) mel_pos = layers.unsqueeze(mel_pos, [0]) return output, mel_pos class DurationPredictor(dg.Layer): def __init__(self, input_size, out_channels, filter_size, dropout=0.1): """Duration Predictor block in FastSpeech. Args: input_size (int): the channel number of input. out_channels (int): the output channel number. filter_size (int): the filter size. dropout (float, optional): dropout probability. Defaults to 0.1. """ super(DurationPredictor, self).__init__() self.input_size = input_size self.out_channels = out_channels self.filter_size = filter_size self.dropout = dropout k = math.sqrt(1.0 / self.input_size) self.conv1 = Conv1D( num_channels=self.input_size, num_filters=self.out_channels, filter_size=self.filter_size, padding=1, param_attr=fluid.ParamAttr( initializer=fluid.initializer.XavierInitializer()), bias_attr=fluid.ParamAttr(initializer=fluid.initializer.Uniform( low=-k, high=k))) #data_format='NTC') k = math.sqrt(1.0 / self.out_channels) self.conv2 = Conv1D( num_channels=self.out_channels, num_filters=self.out_channels, filter_size=self.filter_size, padding=1, param_attr=fluid.ParamAttr( initializer=fluid.initializer.XavierInitializer()), bias_attr=fluid.ParamAttr(initializer=fluid.initializer.Uniform( low=-k, high=k))) #data_format='NTC') self.layer_norm1 = dg.LayerNorm(self.out_channels) self.layer_norm2 = dg.LayerNorm(self.out_channels) self.weight = fluid.ParamAttr( initializer=fluid.initializer.XavierInitializer()) k = math.sqrt(1.0 / self.out_channels) self.bias = fluid.ParamAttr(initializer=fluid.initializer.Uniform( low=-k, high=k)) self.linear = dg.Linear( self.out_channels, 1, param_attr=self.weight, bias_attr=self.bias) def forward(self, encoder_output): """ Predict the duration of each character. Args: encoder_output (Variable): shape(B, T, C), dtype float32, the encoder output. Returns: out (Variable): shape(B, T, C), the output of duration predictor. """ # encoder_output.shape(N, T, C) out = layers.transpose(encoder_output, [0, 2, 1]) out = self.conv1(out) out = layers.transpose(out, [0, 2, 1]) out = layers.dropout( layers.relu(self.layer_norm1(out)), self.dropout, dropout_implementation='upscale_in_train') out = layers.transpose(out, [0, 2, 1]) out = self.conv2(out) out = layers.transpose(out, [0, 2, 1]) out = layers.dropout( layers.relu(self.layer_norm2(out)), self.dropout, dropout_implementation='upscale_in_train') out = layers.relu(self.linear(out)) out = layers.squeeze(out, axes=[-1]) return out
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29900, 349, 22352, 29925, 22352, 13189, 943, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 5215, 12655, 408, 7442, 13, 5215, 5844, 13, 5215, 610, 1296, 300, 29889, 9794, 29889, 11255, 5965, 5309, 29889, 13239, 13, 5215, 282, 22352, 29889, 1579, 5416, 29889, 4518, 4262, 408, 270, 29887, 13, 5215, 282, 22352, 29889, 1579, 5416, 29889, 29277, 408, 15359, 13, 5215, 282, 22352, 29889, 1579, 5416, 408, 22576, 13, 3166, 610, 1296, 300, 29889, 7576, 29889, 6341, 1891, 1053, 1281, 29894, 29896, 29928, 13, 13, 13, 1990, 365, 1477, 4597, 9183, 29898, 20726, 29889, 14420, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29892, 714, 29918, 305, 12629, 29892, 4175, 29918, 2311, 29892, 5768, 449, 29922, 29900, 29889, 29896, 1125, 13, 4706, 9995, 6513, 2169, 9183, 2908, 297, 23786, 10649, 5309, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 1881, 29918, 2311, 313, 524, 1125, 278, 8242, 1353, 310, 1881, 29889, 13, 9651, 714, 29918, 305, 12629, 313, 524, 1125, 278, 1962, 8242, 1353, 29889, 13, 9651, 4175, 29918, 2311, 313, 524, 1125, 278, 4175, 2159, 310, 14385, 8500, 272, 29889, 13, 9651, 5768, 449, 313, 7411, 29892, 13136, 1125, 5768, 449, 6976, 29889, 13109, 29879, 304, 29871, 29900, 29889, 29896, 29889, 13, 4706, 9995, 13, 4706, 2428, 29898, 6513, 4597, 9183, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 19708, 29918, 27711, 272, 353, 360, 2633, 23084, 919, 272, 29898, 13, 9651, 1881, 29918, 2311, 29922, 2080, 29918, 2311, 29892, 13, 9651, 714, 29918, 305, 12629, 29922, 449, 29918, 305, 12629, 29892, 13, 9651, 4175, 29918, 2311, 29922, 4572, 29918, 2311, 29892, 13, 9651, 5768, 449, 29922, 8865, 449, 29897, 13, 13, 1678, 822, 365, 29934, 29898, 1311, 29892, 921, 29892, 14385, 29918, 27711, 272, 29918, 4905, 1125, 13, 4706, 1962, 353, 5159, 13, 4706, 9853, 29918, 2311, 353, 921, 29889, 12181, 29961, 29900, 29962, 13, 4706, 363, 474, 297, 3464, 29898, 16175, 29918, 2311, 1125, 13, 9651, 1962, 29889, 4397, 29898, 13, 18884, 1583, 29889, 18837, 29898, 29916, 29961, 29875, 29901, 29875, 718, 29871, 29896, 1402, 14385, 29918, 27711, 272, 29918, 4905, 29961, 29875, 29901, 29875, 718, 29871, 29896, 12622, 13, 4706, 1962, 353, 1583, 29889, 8305, 29898, 4905, 29897, 13, 4706, 736, 1962, 13, 13, 1678, 822, 17132, 29898, 1311, 29892, 1881, 29918, 6146, 1125, 13, 4706, 4236, 29918, 2435, 353, 4236, 4197, 2080, 29918, 6146, 29961, 29875, 1822, 12181, 29961, 29900, 29962, 363, 474, 297, 3464, 29898, 2435, 29898, 2080, 29918, 6146, 876, 2314, 13, 4706, 714, 29918, 1761, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 2080, 29918, 6146, 22164, 13, 9651, 17132, 29918, 2435, 353, 4236, 29918, 2435, 448, 1881, 29918, 6146, 29961, 29875, 1822, 12181, 29961, 29900, 29962, 13, 9651, 697, 29918, 16175, 29918, 29886, 23959, 353, 15359, 29889, 8305, 29898, 2080, 29918, 6146, 29961, 29875, 1402, 518, 29900, 29892, 17132, 29918, 2435, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 13, 462, 462, 3986, 17132, 29918, 1767, 29922, 29900, 29889, 29900, 29897, 13, 9651, 714, 29918, 1761, 29889, 4397, 29898, 650, 29918, 16175, 29918, 29886, 23959, 29897, 13, 4706, 714, 29918, 29886, 23959, 353, 15359, 29889, 1429, 29898, 449, 29918, 1761, 29897, 13, 4706, 736, 714, 29918, 29886, 23959, 13, 13, 1678, 822, 7985, 29898, 1311, 29892, 9853, 29892, 25383, 1125, 13, 4706, 714, 353, 5159, 13, 4706, 931, 29918, 24530, 353, 9853, 29889, 12181, 29961, 29896, 29962, 13, 4706, 19965, 9770, 353, 25383, 29889, 23749, 580, 13, 4706, 9853, 353, 15359, 29889, 29879, 802, 29872, 911, 29898, 16175, 29892, 518, 29900, 2314, 13, 13, 4706, 363, 474, 297, 3464, 29898, 2230, 29918, 24530, 1125, 13, 9651, 565, 19965, 9770, 29961, 29900, 29892, 474, 29962, 1275, 29871, 29900, 29901, 13, 18884, 6773, 13, 9651, 714, 29889, 4397, 29898, 13, 18884, 15359, 29889, 18837, 29898, 16175, 29961, 29875, 29901, 29875, 718, 29871, 29896, 29892, 584, 1402, 518, 524, 29898, 571, 1376, 1907, 29961, 29900, 29892, 474, 11724, 29871, 29896, 12622, 13, 4706, 714, 353, 15359, 29889, 17685, 29898, 449, 29892, 9685, 29922, 29900, 29897, 13, 4706, 736, 714, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 29892, 15595, 29922, 29896, 29889, 29900, 29892, 3646, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 11796, 29872, 3309, 310, 9232, 515, 2094, 6119, 1962, 671, 4103, 24784, 29911, 9375, 8570, 13, 308, 13, 4706, 826, 3174, 29901, 13, 9651, 921, 313, 16174, 1125, 8267, 29898, 29933, 29892, 323, 29892, 315, 511, 26688, 5785, 29941, 29906, 29892, 278, 2094, 6119, 1962, 29889, 13, 9651, 15595, 313, 7411, 29941, 29906, 29892, 13136, 1125, 278, 11266, 15501, 304, 8161, 278, 3309, 310, 29871, 13, 18884, 278, 17832, 5665, 9232, 29892, 27999, 640, 22155, 278, 7314, 6210, 29889, 13109, 29879, 304, 29871, 29896, 29889, 29900, 29889, 13, 9651, 3646, 313, 16174, 29892, 13136, 1125, 8267, 29898, 29933, 29892, 323, 29918, 726, 511, 26688, 938, 29953, 29946, 29892, 278, 14385, 310, 1374, 265, 2004, 10272, 515, 758, 3018, 1312, 4327, 261, 29911, 9375, 29889, 29871, 13, 18884, 13109, 29879, 304, 6213, 29889, 29871, 13, 13, 4706, 16969, 29901, 13, 9651, 1962, 313, 16174, 1125, 8267, 29898, 29933, 29892, 323, 29892, 315, 511, 278, 1962, 1156, 429, 407, 392, 29889, 13, 9651, 14385, 29918, 27711, 272, 29918, 4905, 313, 16174, 1125, 8267, 29898, 29933, 29892, 323, 29892, 315, 511, 278, 1962, 310, 14385, 8500, 272, 29889, 13, 4706, 9995, 13, 4706, 14385, 29918, 27711, 272, 29918, 4905, 353, 1583, 29889, 19708, 29918, 27711, 272, 29898, 29916, 29897, 13, 4706, 565, 22576, 29889, 4468, 3032, 4518, 4262, 29918, 29873, 945, 261, 2141, 29918, 14968, 29918, 8513, 29901, 13, 9651, 1962, 353, 1583, 29889, 29519, 29898, 29916, 29892, 3646, 29897, 13, 9651, 736, 1962, 29892, 14385, 29918, 27711, 272, 29918, 4905, 13, 4706, 1683, 29901, 13, 9651, 14385, 29918, 27711, 272, 29918, 4905, 353, 14385, 29918, 27711, 272, 29918, 4905, 334, 15595, 13, 9651, 14385, 29918, 27711, 272, 29918, 4905, 353, 15359, 29889, 27696, 29898, 19708, 29918, 27711, 272, 29918, 4905, 29897, 13, 9651, 1962, 353, 1583, 29889, 29519, 29898, 29916, 29892, 14385, 29918, 27711, 272, 29918, 4905, 29897, 13, 9651, 9232, 29918, 1066, 353, 270, 29887, 29889, 517, 29918, 11918, 29898, 9302, 29889, 279, 927, 29898, 29896, 29892, 1962, 29889, 12181, 29961, 29896, 29962, 718, 29871, 29896, 8106, 579, 668, 29898, 13, 18884, 7442, 29889, 524, 29953, 29946, 29897, 13, 9651, 9232, 29918, 1066, 353, 15359, 29889, 6948, 802, 29872, 911, 29898, 12873, 29918, 1066, 29892, 518, 29900, 2314, 13, 9651, 736, 1962, 29892, 9232, 29918, 1066, 13, 13, 13, 1990, 360, 2633, 23084, 919, 272, 29898, 20726, 29889, 14420, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 2311, 29892, 714, 29918, 305, 12629, 29892, 4175, 29918, 2311, 29892, 5768, 449, 29922, 29900, 29889, 29896, 1125, 13, 4706, 9995, 18984, 21099, 919, 272, 2908, 297, 23786, 10649, 5309, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 1881, 29918, 2311, 313, 524, 1125, 278, 8242, 1353, 310, 1881, 29889, 13, 9651, 714, 29918, 305, 12629, 313, 524, 1125, 278, 1962, 8242, 1353, 29889, 13, 9651, 4175, 29918, 2311, 313, 524, 1125, 278, 4175, 2159, 29889, 13, 9651, 5768, 449, 313, 7411, 29892, 13136, 1125, 5768, 449, 6976, 29889, 13109, 29879, 304, 29871, 29900, 29889, 29896, 29889, 13, 4706, 9995, 13, 4706, 2428, 29898, 18984, 23084, 919, 272, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 449, 29918, 305, 12629, 353, 714, 29918, 305, 12629, 13, 4706, 1583, 29889, 4572, 29918, 2311, 353, 4175, 29918, 2311, 13, 4706, 1583, 29889, 8865, 449, 353, 5768, 449, 13, 13, 4706, 413, 353, 5844, 29889, 3676, 29898, 29896, 29889, 29900, 847, 1583, 29889, 2080, 29918, 2311, 29897, 13, 4706, 1583, 29889, 20580, 29896, 353, 1281, 29894, 29896, 29928, 29898, 13, 9651, 954, 29918, 305, 12629, 29922, 1311, 29889, 2080, 29918, 2311, 29892, 13, 9651, 954, 29918, 26705, 29922, 1311, 29889, 449, 29918, 305, 12629, 29892, 13, 9651, 4175, 29918, 2311, 29922, 1311, 29889, 4572, 29918, 2311, 29892, 13, 9651, 7164, 29922, 29896, 29892, 13, 9651, 1828, 29918, 5552, 29922, 1579, 5416, 29889, 4736, 25098, 29898, 13, 18884, 2847, 3950, 29922, 1579, 5416, 29889, 11228, 3950, 29889, 29990, 18852, 15514, 3950, 25739, 13, 9651, 24003, 29918, 5552, 29922, 1579, 5416, 29889, 4736, 25098, 29898, 11228, 3950, 29922, 1579, 5416, 29889, 11228, 3950, 29889, 2525, 5560, 29898, 13, 18884, 4482, 10457, 29895, 29892, 1880, 29922, 29895, 4961, 13, 4706, 396, 1272, 29918, 4830, 2433, 29940, 9472, 1495, 13, 4706, 413, 353, 5844, 29889, 3676, 29898, 29896, 29889, 29900, 847, 1583, 29889, 449, 29918, 305, 12629, 29897, 13, 4706, 1583, 29889, 20580, 29906, 353, 1281, 29894, 29896, 29928, 29898, 13, 9651, 954, 29918, 305, 12629, 29922, 1311, 29889, 449, 29918, 305, 12629, 29892, 13, 9651, 954, 29918, 26705, 29922, 1311, 29889, 449, 29918, 305, 12629, 29892, 13, 9651, 4175, 29918, 2311, 29922, 1311, 29889, 4572, 29918, 2311, 29892, 13, 9651, 7164, 29922, 29896, 29892, 13, 9651, 1828, 29918, 5552, 29922, 1579, 5416, 29889, 4736, 25098, 29898, 13, 18884, 2847, 3950, 29922, 1579, 5416, 29889, 11228, 3950, 29889, 29990, 18852, 15514, 3950, 25739, 13, 9651, 24003, 29918, 5552, 29922, 1579, 5416, 29889, 4736, 25098, 29898, 11228, 3950, 29922, 1579, 5416, 29889, 11228, 3950, 29889, 2525, 5560, 29898, 13, 18884, 4482, 10457, 29895, 29892, 1880, 29922, 29895, 4961, 13, 4706, 396, 1272, 29918, 4830, 2433, 29940, 9472, 1495, 13, 4706, 1583, 29889, 13148, 29918, 12324, 29896, 353, 270, 29887, 29889, 14420, 29940, 555, 29898, 1311, 29889, 449, 29918, 305, 12629, 29897, 13, 4706, 1583, 29889, 13148, 29918, 12324, 29906, 353, 270, 29887, 29889, 14420, 29940, 555, 29898, 1311, 29889, 449, 29918, 305, 12629, 29897, 13, 13, 4706, 1583, 29889, 7915, 353, 22576, 29889, 4736, 25098, 29898, 13, 9651, 2847, 3950, 29922, 1579, 5416, 29889, 11228, 3950, 29889, 29990, 18852, 15514, 3950, 3101, 13, 4706, 413, 353, 5844, 29889, 3676, 29898, 29896, 29889, 29900, 847, 1583, 29889, 449, 29918, 305, 12629, 29897, 13, 4706, 1583, 29889, 29890, 3173, 353, 22576, 29889, 4736, 25098, 29898, 11228, 3950, 29922, 1579, 5416, 29889, 11228, 3950, 29889, 2525, 5560, 29898, 13, 9651, 4482, 10457, 29895, 29892, 1880, 29922, 29895, 876, 13, 13, 4706, 1583, 29889, 10660, 353, 270, 29887, 29889, 12697, 29898, 13, 9651, 1583, 29889, 449, 29918, 305, 12629, 29892, 29871, 29896, 29892, 1828, 29918, 5552, 29922, 1311, 29889, 7915, 29892, 24003, 29918, 5552, 29922, 1311, 29889, 29890, 3173, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 2094, 6119, 29918, 4905, 1125, 13, 4706, 9995, 13, 4706, 21099, 919, 278, 14385, 310, 1269, 2931, 29889, 13, 308, 13, 4706, 826, 3174, 29901, 13, 9651, 2094, 6119, 29918, 4905, 313, 16174, 1125, 8267, 29898, 29933, 29892, 323, 29892, 315, 511, 26688, 5785, 29941, 29906, 29892, 278, 2094, 6119, 1962, 29889, 13, 308, 13, 4706, 16969, 29901, 13, 9651, 714, 313, 16174, 1125, 8267, 29898, 29933, 29892, 323, 29892, 315, 511, 278, 1962, 310, 14385, 8500, 272, 29889, 13, 4706, 9995, 13, 4706, 396, 2094, 6119, 29918, 4905, 29889, 12181, 29898, 29940, 29892, 323, 29892, 315, 29897, 13, 4706, 714, 353, 15359, 29889, 3286, 4220, 29898, 3977, 6119, 29918, 4905, 29892, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 2314, 13, 4706, 714, 353, 1583, 29889, 20580, 29896, 29898, 449, 29897, 13, 4706, 714, 353, 15359, 29889, 3286, 4220, 29898, 449, 29892, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 2314, 13, 4706, 714, 353, 15359, 29889, 8865, 449, 29898, 13, 9651, 15359, 29889, 2674, 29884, 29898, 1311, 29889, 13148, 29918, 12324, 29896, 29898, 449, 8243, 13, 9651, 1583, 29889, 8865, 449, 29892, 13, 9651, 5768, 449, 29918, 21382, 2433, 14340, 29883, 744, 29918, 262, 29918, 14968, 1495, 13, 4706, 714, 353, 15359, 29889, 3286, 4220, 29898, 449, 29892, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 2314, 13, 4706, 714, 353, 1583, 29889, 20580, 29906, 29898, 449, 29897, 13, 4706, 714, 353, 15359, 29889, 3286, 4220, 29898, 449, 29892, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 2314, 13, 4706, 714, 353, 15359, 29889, 8865, 449, 29898, 13, 9651, 15359, 29889, 2674, 29884, 29898, 1311, 29889, 13148, 29918, 12324, 29906, 29898, 449, 8243, 13, 9651, 1583, 29889, 8865, 449, 29892, 13, 9651, 5768, 449, 29918, 21382, 2433, 14340, 29883, 744, 29918, 262, 29918, 14968, 1495, 13, 4706, 714, 353, 15359, 29889, 2674, 29884, 29898, 1311, 29889, 10660, 29898, 449, 876, 13, 4706, 714, 353, 15359, 29889, 29879, 802, 29872, 911, 29898, 449, 29892, 27815, 11759, 29899, 29896, 2314, 13, 13, 4706, 736, 714, 13, 2 ]
keras_textclassification/keras_layers/attention_dot.py
wyq0706/Keras-TextClassification
1
139680
<filename>keras_textclassification/keras_layers/attention_dot.py # !/usr/bin/python # -*- coding: utf-8 -*- # @time : 2020/3/31 19:10 # @author : Mo # @function: from keras.regularizers import L1L2, Regularizer # from keras.engine.topology import Layer from keras.layers import Layer from keras import backend as K import tensorflow as tf class AttentionDot(Layer): def __init__(self, **kwargs): super().__init__(** kwargs) def build(self, input_shape): self.W = self.add_weight(name='Attention_Dot_Weight', shape=(input_shape[1], input_shape[1]), regularizer=L1L2(0.0000032), initializer='uniform', trainable=True) self.b = self.add_weight(name='Attention_Dot_Bias', regularizer=L1L2(0.00032), shape=(input_shape[1],), initializer='uniform', trainable=True) super().build(input_shape) def call(self, input): x_transpose = K.permute_dimensions(input, (0, 2, 1)) x_tanh_softmax = K.softmax(K.tanh(K.dot(x_transpose, self.W) + self.b)) outputs = K.permute_dimensions(x_tanh_softmax * x_transpose, (0, 2, 1)) # outputs = K.sum(outputs, axis=1) return outputs def compute_output_shape(self, input_shape): return input_shape[0], input_shape[1], input_shape[2] class CVG_Layer(Layer): def __init__(self, embed_size, filter, label, **kwargs): self.embed_size = embed_size self.filter = filter self.label = label super().__init__(** kwargs) def build(self, input_shape): self._filter = self.add_weight(name=f'filter_{self.filter}', shape=(self.filter, self.label, 1, 1), regularizer=L1L2(0.00032), initializer='uniform', trainable=True) self.class_w = self.add_weight(name='class_w', shape=(self.label, self.embed_size), regularizer=L1L2(0.0000032), initializer='uniform', trainable=True) self.b = self.add_weight(name='bias', shape=(1,), regularizer=L1L2(0.00032), initializer='uniform', trainable=True) super().build(input_shape) def call(self, input): # C * V / G # l2_normalize of x, y input_norm = tf.nn.l2_normalize(input) # b * s * e class_w_relu = tf.nn.relu(self.class_w) # c * e label_embedding_reshape = tf.transpose(class_w_relu, [1, 0]) # e * c label_embedding_reshape_norm = tf.nn.l2_normalize(label_embedding_reshape) # e * c # C * V G = tf.contrib.keras.backend.dot(input_norm, label_embedding_reshape_norm) # b * s * c G_transpose = tf.transpose(G, [0, 2, 1]) # b * c * s G_expand = tf.expand_dims(G_transpose, axis=-1) # b * c * s * 1 # text_cnn conv = tf.nn.conv2d(name='conv', input=G_expand, filter=self._filter, strides=[1, 1, 1, 1], padding='SAME') pool = tf.nn.relu(name='relu', features=tf.nn.bias_add(conv, self.b)) # b * c * s * 1 # pool = tf.nn.max_pool(name='pool', value=h, ksize=[1, int((self.filters[0]-1)/2), 1, 1], # strides=[1, 1, 1, 1], padding='SAME') # max_pool pool_squeeze = tf.squeeze(pool, axis=-1) # b * c * s pool_squeeze_transpose = tf.transpose(pool_squeeze, [0, 2, 1]) # b * s * c G_max_squeeze = tf.reduce_max(input_tensor=pool_squeeze_transpose, axis=-1, keepdims=True) # b * s * 1 # divide of softmax exp_logits = tf.exp(G_max_squeeze) exp_logits_sum = tf.reduce_sum(exp_logits, axis=1, keepdims=True) att_v_max = tf.div(exp_logits, exp_logits_sum) # β * V x_att = tf.multiply(input, att_v_max) x_att_sum = tf.reduce_sum(x_att, axis=1) return x_att_sum def compute_output_shape(self, input_shape): return None, K.int_shape(self.class_w)[1] if __name__=="__main__": att = AttentionDot()
[ 1, 529, 9507, 29958, 3946, 294, 29918, 726, 1990, 2450, 29914, 3946, 294, 29918, 29277, 29914, 1131, 2509, 29918, 6333, 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, 29900, 29914, 29941, 29914, 29941, 29896, 29871, 29896, 29929, 29901, 29896, 29900, 13, 29937, 732, 8921, 29871, 584, 4546, 13, 29937, 732, 2220, 29901, 13, 13, 13, 3166, 13023, 294, 29889, 15227, 19427, 1053, 365, 29896, 29931, 29906, 29892, 2169, 1070, 3950, 13, 29937, 515, 13023, 294, 29889, 10599, 29889, 3332, 3002, 1053, 365, 2747, 13, 3166, 13023, 294, 29889, 29277, 1053, 365, 2747, 13, 3166, 13023, 294, 1053, 14998, 408, 476, 13, 5215, 26110, 408, 15886, 13, 13, 13, 1990, 6212, 2509, 29928, 327, 29898, 14420, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 9049, 5085, 29897, 13, 13, 1678, 822, 2048, 29898, 1311, 29892, 1881, 29918, 12181, 1125, 13, 4706, 1583, 29889, 29956, 353, 1583, 29889, 1202, 29918, 7915, 29898, 978, 2433, 4165, 2509, 29918, 29928, 327, 29918, 22676, 742, 13, 462, 462, 8267, 7607, 2080, 29918, 12181, 29961, 29896, 1402, 1881, 29918, 12181, 29961, 29896, 11724, 13, 462, 462, 4943, 3950, 29922, 29931, 29896, 29931, 29906, 29898, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29941, 29906, 511, 13, 462, 462, 2847, 3950, 2433, 29590, 742, 13, 462, 462, 7945, 519, 29922, 5574, 29897, 13, 4706, 1583, 29889, 29890, 353, 1583, 29889, 1202, 29918, 7915, 29898, 978, 2433, 4165, 2509, 29918, 29928, 327, 29918, 29933, 3173, 742, 13, 462, 462, 4943, 3950, 29922, 29931, 29896, 29931, 29906, 29898, 29900, 29889, 29900, 29900, 29900, 29941, 29906, 511, 13, 462, 462, 8267, 7607, 2080, 29918, 12181, 29961, 29896, 1402, 511, 13, 462, 462, 2847, 3950, 2433, 29590, 742, 13, 462, 462, 7945, 519, 29922, 5574, 29897, 13, 4706, 2428, 2141, 4282, 29898, 2080, 29918, 12181, 29897, 13, 13, 1678, 822, 1246, 29898, 1311, 29892, 1881, 1125, 13, 4706, 921, 29918, 3286, 4220, 353, 476, 29889, 17858, 1082, 29918, 6229, 5580, 29898, 2080, 29892, 313, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 876, 13, 4706, 921, 29918, 13161, 29882, 29918, 2695, 3317, 353, 476, 29889, 2695, 3317, 29898, 29968, 29889, 13161, 29882, 29898, 29968, 29889, 6333, 29898, 29916, 29918, 3286, 4220, 29892, 1583, 29889, 29956, 29897, 718, 1583, 29889, 29890, 876, 13, 4706, 14391, 353, 476, 29889, 17858, 1082, 29918, 6229, 5580, 29898, 29916, 29918, 13161, 29882, 29918, 2695, 3317, 334, 921, 29918, 3286, 4220, 29892, 313, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 876, 13, 4706, 396, 14391, 353, 476, 29889, 2083, 29898, 4905, 29879, 29892, 9685, 29922, 29896, 29897, 13, 4706, 736, 14391, 13, 13, 1678, 822, 10272, 29918, 4905, 29918, 12181, 29898, 1311, 29892, 1881, 29918, 12181, 1125, 13, 4706, 736, 1881, 29918, 12181, 29961, 29900, 1402, 1881, 29918, 12181, 29961, 29896, 1402, 1881, 29918, 12181, 29961, 29906, 29962, 13, 13, 13, 1990, 25778, 29954, 29918, 14420, 29898, 14420, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8297, 29918, 2311, 29892, 4175, 29892, 3858, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 17987, 29918, 2311, 353, 8297, 29918, 2311, 13, 4706, 1583, 29889, 4572, 353, 4175, 13, 4706, 1583, 29889, 1643, 353, 3858, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 9049, 5085, 29897, 13, 13, 1678, 822, 2048, 29898, 1311, 29892, 1881, 29918, 12181, 1125, 13, 4706, 1583, 3032, 4572, 353, 1583, 29889, 1202, 29918, 7915, 29898, 978, 29922, 29888, 29915, 4572, 648, 1311, 29889, 4572, 29913, 742, 13, 462, 462, 539, 8267, 7607, 1311, 29889, 4572, 29892, 1583, 29889, 1643, 29892, 29871, 29896, 29892, 29871, 29896, 511, 13, 462, 462, 539, 4943, 3950, 29922, 29931, 29896, 29931, 29906, 29898, 29900, 29889, 29900, 29900, 29900, 29941, 29906, 511, 13, 462, 462, 539, 2847, 3950, 2433, 29590, 742, 13, 462, 462, 539, 7945, 519, 29922, 5574, 29897, 13, 4706, 1583, 29889, 1990, 29918, 29893, 353, 1583, 29889, 1202, 29918, 7915, 29898, 978, 2433, 1990, 29918, 29893, 742, 13, 462, 462, 539, 8267, 7607, 1311, 29889, 1643, 29892, 1583, 29889, 17987, 29918, 2311, 511, 13, 462, 462, 539, 4943, 3950, 29922, 29931, 29896, 29931, 29906, 29898, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29941, 29906, 511, 13, 462, 462, 539, 2847, 3950, 2433, 29590, 742, 13, 462, 462, 539, 7945, 519, 29922, 5574, 29897, 13, 4706, 1583, 29889, 29890, 353, 1583, 29889, 1202, 29918, 7915, 29898, 978, 2433, 29890, 3173, 742, 13, 462, 462, 8267, 7607, 29896, 29892, 511, 13, 462, 462, 4943, 3950, 29922, 29931, 29896, 29931, 29906, 29898, 29900, 29889, 29900, 29900, 29900, 29941, 29906, 511, 13, 462, 462, 2847, 3950, 2433, 29590, 742, 13, 462, 462, 7945, 519, 29922, 5574, 29897, 13, 4706, 2428, 2141, 4282, 29898, 2080, 29918, 12181, 29897, 13, 13, 1678, 822, 1246, 29898, 1311, 29892, 1881, 1125, 13, 4706, 396, 315, 334, 478, 847, 402, 13, 4706, 396, 301, 29906, 29918, 8945, 675, 310, 921, 29892, 343, 13, 4706, 1881, 29918, 12324, 353, 15886, 29889, 15755, 29889, 29880, 29906, 29918, 8945, 675, 29898, 2080, 29897, 29871, 396, 289, 334, 269, 334, 321, 13, 4706, 770, 29918, 29893, 29918, 2674, 29884, 353, 15886, 29889, 15755, 29889, 2674, 29884, 29898, 1311, 29889, 1990, 29918, 29893, 29897, 396, 274, 334, 321, 13, 4706, 3858, 29918, 17987, 8497, 29918, 690, 14443, 353, 15886, 29889, 3286, 4220, 29898, 1990, 29918, 29893, 29918, 2674, 29884, 29892, 518, 29896, 29892, 29871, 29900, 2314, 29871, 396, 321, 334, 274, 13, 4706, 3858, 29918, 17987, 8497, 29918, 690, 14443, 29918, 12324, 353, 15886, 29889, 15755, 29889, 29880, 29906, 29918, 8945, 675, 29898, 1643, 29918, 17987, 8497, 29918, 690, 14443, 29897, 29871, 396, 321, 334, 274, 13, 4706, 396, 315, 334, 478, 13, 4706, 402, 353, 15886, 29889, 21570, 29889, 3946, 294, 29889, 27852, 29889, 6333, 29898, 2080, 29918, 12324, 29892, 3858, 29918, 17987, 8497, 29918, 690, 14443, 29918, 12324, 29897, 29871, 396, 289, 334, 269, 334, 274, 13, 4706, 402, 29918, 3286, 4220, 353, 15886, 29889, 3286, 4220, 29898, 29954, 29892, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 2314, 29871, 396, 289, 334, 274, 334, 269, 13, 4706, 402, 29918, 18837, 353, 15886, 29889, 18837, 29918, 6229, 29879, 29898, 29954, 29918, 3286, 4220, 29892, 9685, 10457, 29896, 29897, 29871, 396, 289, 334, 274, 334, 269, 334, 29871, 29896, 13, 4706, 396, 1426, 29918, 29883, 15755, 13, 4706, 7602, 353, 15886, 29889, 15755, 29889, 20580, 29906, 29881, 29898, 978, 2433, 20580, 742, 1881, 29922, 29954, 29918, 18837, 29892, 4175, 29922, 1311, 3032, 4572, 29892, 13, 462, 9651, 851, 2247, 11759, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 1402, 7164, 2433, 8132, 2303, 1495, 13, 4706, 11565, 353, 15886, 29889, 15755, 29889, 2674, 29884, 29898, 978, 2433, 2674, 29884, 742, 5680, 29922, 13264, 29889, 15755, 29889, 29890, 3173, 29918, 1202, 29898, 20580, 29892, 1583, 29889, 29890, 876, 29871, 396, 289, 334, 274, 334, 269, 334, 29871, 29896, 13, 4706, 396, 11565, 353, 15886, 29889, 15755, 29889, 3317, 29918, 10109, 29898, 978, 2433, 10109, 742, 995, 29922, 29882, 29892, 413, 2311, 11759, 29896, 29892, 938, 3552, 1311, 29889, 26705, 29961, 29900, 29962, 29899, 29896, 6802, 29906, 511, 29871, 29896, 29892, 29871, 29896, 1402, 13, 4706, 396, 462, 539, 851, 2247, 11759, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 1402, 7164, 2433, 8132, 2303, 1495, 13, 4706, 396, 4236, 29918, 10109, 13, 4706, 11565, 29918, 29879, 802, 29872, 911, 353, 15886, 29889, 29879, 802, 29872, 911, 29898, 10109, 29892, 9685, 10457, 29896, 29897, 29871, 396, 289, 334, 274, 334, 269, 13, 4706, 11565, 29918, 29879, 802, 29872, 911, 29918, 3286, 4220, 353, 15886, 29889, 3286, 4220, 29898, 10109, 29918, 29879, 802, 29872, 911, 29892, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 2314, 29871, 396, 289, 334, 269, 334, 274, 13, 4706, 402, 29918, 3317, 29918, 29879, 802, 29872, 911, 353, 15886, 29889, 17469, 29918, 3317, 29898, 2080, 29918, 20158, 29922, 10109, 29918, 29879, 802, 29872, 911, 29918, 3286, 4220, 29892, 9685, 10457, 29896, 29892, 3013, 6229, 29879, 29922, 5574, 29897, 29871, 396, 289, 334, 269, 334, 29871, 29896, 13, 4706, 396, 16429, 310, 4964, 3317, 13, 4706, 1518, 29918, 1188, 1169, 353, 15886, 29889, 4548, 29898, 29954, 29918, 3317, 29918, 29879, 802, 29872, 911, 29897, 13, 4706, 1518, 29918, 1188, 1169, 29918, 2083, 353, 15886, 29889, 17469, 29918, 2083, 29898, 4548, 29918, 1188, 1169, 29892, 9685, 29922, 29896, 29892, 3013, 6229, 29879, 29922, 5574, 29897, 13, 4706, 1098, 29918, 29894, 29918, 3317, 353, 15886, 29889, 4563, 29898, 4548, 29918, 1188, 1169, 29892, 1518, 29918, 1188, 1169, 29918, 2083, 29897, 13, 4706, 396, 29871, 30187, 334, 478, 13, 4706, 921, 29918, 1131, 353, 15886, 29889, 18056, 368, 29898, 2080, 29892, 1098, 29918, 29894, 29918, 3317, 29897, 13, 4706, 921, 29918, 1131, 29918, 2083, 353, 15886, 29889, 17469, 29918, 2083, 29898, 29916, 29918, 1131, 29892, 9685, 29922, 29896, 29897, 13, 4706, 736, 921, 29918, 1131, 29918, 2083, 13, 13, 1678, 822, 10272, 29918, 4905, 29918, 12181, 29898, 1311, 29892, 1881, 29918, 12181, 1125, 13, 4706, 736, 6213, 29892, 476, 29889, 524, 29918, 12181, 29898, 1311, 29889, 1990, 29918, 29893, 9601, 29896, 29962, 13, 13, 13, 361, 4770, 978, 1649, 26359, 1649, 3396, 1649, 1115, 13, 1678, 1098, 353, 6212, 2509, 29928, 327, 580, 13, 13, 2 ]
templates/setup/setup.py
0-complexity/kubernetes
0
190190
from js9 import j from zerorobot.template.base import TemplateBase from zerorobot.template.state import StateCheckError class Setup(TemplateBase): version = '0.0.1' template_name = "setup" SSHKEY_TEMPLATE = 'github.com/openvcloud/0-templates/sshkey/0.0.1' OVC_TEMPLATE = 'github.com/openvcloud/0-templates/openvcloud/0.0.1' ACCOUNT_TEMPLATE = 'github.com/openvcloud/0-templates/account/0.0.1' VDC_TEMPLATE = 'github.com/openvcloud/0-templates/vdc/0.0.1' NODE_TEMPLATE = 'github.com/openvcloud/0-templates/node/0.0.1' ZROBOT_TEMPLATE = 'github.com/openvcloud/0-templates/zrobot/0.0.1' K8S_TEMPLATE = 'github.com/openvcloud/kubernetes/kubernetes/0.0.1' def __init__(self, name, guid=None, data=None): super().__init__(name=name, guid=guid, data=data) self._config = None def validate(self): for key in ['vdc', 'workers', 'sshKey']: value = self.data[key] if not value: raise ValueError('"%s" is required' % key) @property def config(self): ''' returns an object with names of vdc, account, and ovc ''' if self._config is not None: return self._config config = { 'vdc': self.data['vdc'], } # traverse the tree up words so we have all info we need to return, connection and # account matches = self.api.services.find(template_uid=self.VDC_TEMPLATE, name=config['vdc']) if len(matches) != 1: raise RuntimeError('found %d vdcs with name "%s"' % (len(matches), config['vdc'])) vdc = matches[0] self._vdc = vdc task = vdc.schedule_action('get_account') task.wait() config['account'] = task.result matches = self.api.services.find(template_uid=self.ACCOUNT_TEMPLATE, name=config['account']) if len(matches) != 1: raise ValueError('found %s accounts with name "%s"' % (len(matches), config['account'])) account = matches[0] # get connection task = account.schedule_action('get_openvcloud') task.wait() config['ovc'] = task.result self._config = config return self._config def _find_or_create(self, zrobot, template_uid, service_name, data): found = zrobot.services.find( template_uid=template_uid, name=service_name ) if len(found) != 0: return found[0] return zrobot.services.create( template_uid=template_uid, service_name=service_name, data=data ) def _ensure_helper(self): name = '%s-little-helper' % self.name node = self._find_or_create( self.api, template_uid=self.NODE_TEMPLATE, service_name=name, data={ 'vdc': self.data['vdc'], 'sshKey': self.data['sshKey'], 'sizeId': 2, } ) task = node.schedule_action('install') task.wait() if task.state == 'error': raise task.eco return node def _ensure_zrobot(self, helper): name = '%s-little-bot' % self.name bot = self._find_or_create( self.api, template_uid=self.ZROBOT_TEMPLATE, service_name=name, data={ 'node': helper.name, 'port': 6600, 'templates': [ 'https://github.com/openvcloud/0-templates.git', 'https://github.com/openvcloud/kubernetes.git', ], }, ) # update data in the disk service task = bot.schedule_action('install') task.wait() if task.state == 'error': raise task.eco return bot def _mirror_services(self, zrobot): config = self.config ovc = j.clients.openvcloud.get(config['ovc']) self._find_or_create( zrobot, template_uid=self.SSHKEY_TEMPLATE, service_name='%s-ssh' % self.name, data={ 'passphrase': <PASSWORD>wd(20, 'ABCDEF<PASSWORD>'), } ) self._find_or_create( zrobot, template_uid=self.OVC_TEMPLATE, service_name=config['ovc'], data={ 'address': ovc.config.data['address'], 'port': ovc.config.data['port'], 'location': ovc.config.data['location'], 'token': ovc.config.data['jwt_'], } ) account = self._find_or_create( zrobot, template_uid=self.ACCOUNT_TEMPLATE, service_name=config['account'], data={ 'openvcloud': config['ovc'], 'create': False, } ) vdc = self._find_or_create( zrobot, template_uid=self.VDC_TEMPLATE, service_name=config['vdc'], data={ 'account': config['account'], 'create': False, } ) # make sure they are installed for instance in [account, vdc]: task = instance.schedule_action('install') task.wait() if task.state == 'error': raise task.eco def _deply_k8s(self, zrobot): k8s = self._find_or_create( zrobot, template_uid=self.K8S_TEMPLATE, service_name=self.name, data={ 'workersCount': self.data['workers'], 'sizeId': self.data['sizeId'], 'dataDiskSize': self.data['dataDiskSize'], 'sshKey': '%s-ssh' % self.name, 'vdc': self.data['vdc'] } ) task = k8s.schedule_action('install') task.wait() if task.state == 'error': raise task.eco return task.result def install(self): try: self.state.check('actions', 'install', 'ok') return except StateCheckError: pass helper = self._ensure_helper() bot = self._ensure_zrobot(helper) zrobot = self.api.robots[bot.name] self._mirror_services(zrobot) self.data['credentials'] = self._deply_k8s(zrobot) # next step, make a deployment self.state.set('actions', 'install', 'ok')
[ 1, 29871, 13, 3166, 6965, 29929, 1053, 432, 13, 3166, 503, 261, 272, 711, 327, 29889, 6886, 29889, 3188, 1053, 25663, 5160, 13, 3166, 503, 261, 272, 711, 327, 29889, 6886, 29889, 3859, 1053, 4306, 5596, 2392, 13, 13, 13, 1990, 3789, 786, 29898, 6733, 5160, 1125, 13, 13, 1678, 1873, 353, 525, 29900, 29889, 29900, 29889, 29896, 29915, 13, 1678, 4472, 29918, 978, 353, 376, 14669, 29908, 13, 13, 1678, 22343, 10818, 29918, 4330, 3580, 29931, 3040, 353, 525, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29900, 29899, 20943, 29914, 15269, 1989, 29914, 29900, 29889, 29900, 29889, 29896, 29915, 13, 1678, 438, 8257, 29918, 4330, 3580, 29931, 3040, 353, 525, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29900, 29899, 20943, 29914, 3150, 29894, 9274, 29914, 29900, 29889, 29900, 29889, 29896, 29915, 13, 1678, 14614, 18736, 29918, 4330, 3580, 29931, 3040, 353, 525, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29900, 29899, 20943, 29914, 10149, 29914, 29900, 29889, 29900, 29889, 29896, 29915, 13, 1678, 478, 12696, 29918, 4330, 3580, 29931, 3040, 353, 525, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29900, 29899, 20943, 29914, 29894, 13891, 29914, 29900, 29889, 29900, 29889, 29896, 29915, 13, 1678, 11698, 2287, 29918, 4330, 3580, 29931, 3040, 353, 525, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29900, 29899, 20943, 29914, 3177, 29914, 29900, 29889, 29900, 29889, 29896, 29915, 13, 1678, 796, 1672, 29933, 2891, 29918, 4330, 3580, 29931, 3040, 353, 525, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29900, 29899, 20943, 29914, 29920, 307, 7451, 29914, 29900, 29889, 29900, 29889, 29896, 29915, 13, 13, 1678, 476, 29947, 29903, 29918, 4330, 3580, 29931, 3040, 353, 525, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29895, 17547, 29914, 29895, 17547, 29914, 29900, 29889, 29900, 29889, 29896, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 16605, 29922, 8516, 29892, 848, 29922, 8516, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29922, 978, 29892, 16605, 29922, 2543, 333, 29892, 848, 29922, 1272, 29897, 13, 13, 4706, 1583, 3032, 2917, 353, 6213, 13, 13, 1678, 822, 12725, 29898, 1311, 1125, 13, 4706, 363, 1820, 297, 6024, 29894, 13891, 742, 525, 1287, 414, 742, 525, 15269, 2558, 2033, 29901, 13, 9651, 995, 353, 1583, 29889, 1272, 29961, 1989, 29962, 13, 9651, 565, 451, 995, 29901, 13, 18884, 12020, 7865, 2392, 877, 29908, 29995, 29879, 29908, 338, 3734, 29915, 1273, 1820, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2295, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 3639, 385, 1203, 411, 2983, 310, 325, 13891, 29892, 3633, 29892, 322, 288, 7071, 13, 4706, 14550, 13, 4706, 565, 1583, 3032, 2917, 338, 451, 6213, 29901, 13, 9651, 736, 1583, 3032, 2917, 13, 13, 4706, 2295, 353, 426, 13, 9651, 525, 29894, 13891, 2396, 1583, 29889, 1272, 1839, 29894, 13891, 7464, 13, 4706, 500, 13, 4706, 396, 29370, 278, 5447, 701, 3838, 577, 591, 505, 599, 5235, 591, 817, 304, 736, 29892, 3957, 322, 13, 4706, 396, 3633, 13, 4706, 7087, 353, 1583, 29889, 2754, 29889, 9916, 29889, 2886, 29898, 6886, 29918, 5416, 29922, 1311, 29889, 10699, 29907, 29918, 4330, 3580, 29931, 3040, 29892, 1024, 29922, 2917, 1839, 29894, 13891, 11287, 13, 4706, 565, 7431, 29898, 20317, 29897, 2804, 29871, 29896, 29901, 13, 9651, 12020, 24875, 2392, 877, 11940, 1273, 29881, 325, 29881, 2395, 411, 1024, 11860, 29879, 29908, 29915, 1273, 313, 2435, 29898, 20317, 511, 2295, 1839, 29894, 13891, 25901, 13, 13, 4706, 325, 13891, 353, 7087, 29961, 29900, 29962, 13, 4706, 1583, 3032, 29894, 13891, 353, 325, 13891, 13, 4706, 3414, 353, 325, 13891, 29889, 816, 11272, 29918, 2467, 877, 657, 29918, 10149, 1495, 13, 4706, 3414, 29889, 10685, 580, 13, 13, 4706, 2295, 1839, 10149, 2033, 353, 3414, 29889, 2914, 13, 13, 4706, 7087, 353, 1583, 29889, 2754, 29889, 9916, 29889, 2886, 29898, 6886, 29918, 5416, 29922, 1311, 29889, 2477, 18736, 29918, 4330, 3580, 29931, 3040, 29892, 1024, 29922, 2917, 1839, 10149, 11287, 13, 4706, 565, 7431, 29898, 20317, 29897, 2804, 29871, 29896, 29901, 13, 9651, 12020, 7865, 2392, 877, 11940, 1273, 29879, 15303, 411, 1024, 11860, 29879, 29908, 29915, 1273, 313, 2435, 29898, 20317, 511, 2295, 1839, 10149, 25901, 13, 13, 4706, 3633, 353, 7087, 29961, 29900, 29962, 13, 4706, 396, 679, 3957, 13, 4706, 3414, 353, 3633, 29889, 816, 11272, 29918, 2467, 877, 657, 29918, 3150, 29894, 9274, 1495, 13, 4706, 3414, 29889, 10685, 580, 13, 13, 4706, 2295, 1839, 586, 29883, 2033, 353, 3414, 29889, 2914, 13, 13, 4706, 1583, 3032, 2917, 353, 2295, 13, 4706, 736, 1583, 3032, 2917, 13, 13, 1678, 822, 903, 2886, 29918, 272, 29918, 3258, 29898, 1311, 29892, 503, 307, 7451, 29892, 4472, 29918, 5416, 29892, 2669, 29918, 978, 29892, 848, 1125, 13, 4706, 1476, 353, 503, 307, 7451, 29889, 9916, 29889, 2886, 29898, 13, 9651, 4472, 29918, 5416, 29922, 6886, 29918, 5416, 29892, 13, 9651, 1024, 29922, 5509, 29918, 978, 13, 4706, 1723, 13, 13, 4706, 565, 7431, 29898, 11940, 29897, 2804, 29871, 29900, 29901, 13, 9651, 736, 1476, 29961, 29900, 29962, 13, 13, 4706, 736, 503, 307, 7451, 29889, 9916, 29889, 3258, 29898, 13, 9651, 4472, 29918, 5416, 29922, 6886, 29918, 5416, 29892, 13, 9651, 2669, 29918, 978, 29922, 5509, 29918, 978, 29892, 13, 9651, 848, 29922, 1272, 13, 4706, 1723, 13, 13, 1678, 822, 903, 7469, 29918, 20907, 29898, 1311, 1125, 13, 4706, 1024, 353, 14210, 29879, 29899, 29880, 1992, 29899, 20907, 29915, 1273, 1583, 29889, 978, 13, 4706, 2943, 353, 1583, 3032, 2886, 29918, 272, 29918, 3258, 29898, 13, 9651, 1583, 29889, 2754, 29892, 13, 9651, 4472, 29918, 5416, 29922, 1311, 29889, 6632, 2287, 29918, 4330, 3580, 29931, 3040, 29892, 13, 9651, 2669, 29918, 978, 29922, 978, 29892, 13, 9651, 848, 3790, 13, 18884, 525, 29894, 13891, 2396, 1583, 29889, 1272, 1839, 29894, 13891, 7464, 13, 18884, 525, 15269, 2558, 2396, 1583, 29889, 1272, 1839, 15269, 2558, 7464, 13, 18884, 525, 2311, 1204, 2396, 29871, 29906, 29892, 13, 9651, 500, 13, 4706, 1723, 13, 13, 4706, 3414, 353, 2943, 29889, 816, 11272, 29918, 2467, 877, 6252, 1495, 13, 4706, 3414, 29889, 10685, 580, 13, 4706, 565, 3414, 29889, 3859, 1275, 525, 2704, 2396, 13, 9651, 12020, 3414, 29889, 687, 29877, 13, 13, 4706, 736, 2943, 13, 13, 1678, 822, 903, 7469, 29918, 29920, 307, 7451, 29898, 1311, 29892, 16876, 1125, 13, 4706, 1024, 353, 14210, 29879, 29899, 29880, 1992, 29899, 7451, 29915, 1273, 1583, 29889, 978, 13, 13, 4706, 9225, 353, 1583, 3032, 2886, 29918, 272, 29918, 3258, 29898, 13, 9651, 1583, 29889, 2754, 29892, 13, 9651, 4472, 29918, 5416, 29922, 1311, 29889, 29999, 1672, 29933, 2891, 29918, 4330, 3580, 29931, 3040, 29892, 13, 9651, 2669, 29918, 978, 29922, 978, 29892, 13, 9651, 848, 3790, 13, 18884, 525, 3177, 2396, 16876, 29889, 978, 29892, 13, 18884, 525, 637, 2396, 29871, 29953, 29953, 29900, 29900, 29892, 13, 18884, 525, 20943, 2396, 518, 13, 462, 1678, 525, 991, 597, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29900, 29899, 20943, 29889, 5559, 742, 13, 462, 1678, 525, 991, 597, 3292, 29889, 510, 29914, 3150, 29894, 9274, 29914, 29895, 17547, 29889, 5559, 742, 13, 18884, 21251, 13, 9651, 2981, 13, 4706, 1723, 13, 13, 4706, 396, 2767, 848, 297, 278, 8086, 2669, 13, 4706, 3414, 353, 9225, 29889, 816, 11272, 29918, 2467, 877, 6252, 1495, 13, 4706, 3414, 29889, 10685, 580, 13, 4706, 565, 3414, 29889, 3859, 1275, 525, 2704, 2396, 13, 9651, 12020, 3414, 29889, 687, 29877, 13, 13, 4706, 736, 9225, 13, 13, 1678, 822, 903, 11038, 729, 29918, 9916, 29898, 1311, 29892, 503, 307, 7451, 1125, 13, 4706, 2295, 353, 1583, 29889, 2917, 13, 4706, 288, 7071, 353, 432, 29889, 11303, 1237, 29889, 3150, 29894, 9274, 29889, 657, 29898, 2917, 1839, 586, 29883, 11287, 13, 13, 4706, 1583, 3032, 2886, 29918, 272, 29918, 3258, 29898, 13, 9651, 503, 307, 7451, 29892, 13, 9651, 4472, 29918, 5416, 29922, 1311, 29889, 1799, 29950, 10818, 29918, 4330, 3580, 29931, 3040, 29892, 13, 9651, 2669, 29918, 978, 2433, 29995, 29879, 29899, 15269, 29915, 1273, 1583, 29889, 978, 29892, 13, 9651, 848, 3790, 13, 18884, 525, 3364, 24588, 559, 2396, 529, 25711, 17013, 29958, 9970, 29898, 29906, 29900, 29892, 525, 19658, 24405, 29966, 25711, 17013, 29958, 5477, 13, 9651, 500, 13, 4706, 1723, 13, 13, 4706, 1583, 3032, 2886, 29918, 272, 29918, 3258, 29898, 13, 9651, 503, 307, 7451, 29892, 13, 9651, 4472, 29918, 5416, 29922, 1311, 29889, 29949, 8257, 29918, 4330, 3580, 29931, 3040, 29892, 13, 9651, 2669, 29918, 978, 29922, 2917, 1839, 586, 29883, 7464, 13, 9651, 848, 3790, 13, 18884, 525, 7328, 2396, 288, 7071, 29889, 2917, 29889, 1272, 1839, 7328, 7464, 13, 18884, 525, 637, 2396, 288, 7071, 29889, 2917, 29889, 1272, 1839, 637, 7464, 13, 18884, 525, 5479, 2396, 288, 7071, 29889, 2917, 29889, 1272, 1839, 5479, 7464, 13, 18884, 525, 6979, 2396, 288, 7071, 29889, 2917, 29889, 1272, 1839, 29926, 14554, 29918, 7464, 13, 9651, 500, 13, 4706, 1723, 13, 13, 4706, 3633, 353, 1583, 3032, 2886, 29918, 272, 29918, 3258, 29898, 13, 9651, 503, 307, 7451, 29892, 13, 9651, 4472, 29918, 5416, 29922, 1311, 29889, 2477, 18736, 29918, 4330, 3580, 29931, 3040, 29892, 13, 9651, 2669, 29918, 978, 29922, 2917, 1839, 10149, 7464, 13, 9651, 848, 3790, 13, 18884, 525, 3150, 29894, 9274, 2396, 2295, 1839, 586, 29883, 7464, 13, 18884, 525, 3258, 2396, 7700, 29892, 13, 9651, 500, 13, 4706, 1723, 13, 13, 4706, 325, 13891, 353, 1583, 3032, 2886, 29918, 272, 29918, 3258, 29898, 13, 9651, 503, 307, 7451, 29892, 13, 9651, 4472, 29918, 5416, 29922, 1311, 29889, 10699, 29907, 29918, 4330, 3580, 29931, 3040, 29892, 13, 9651, 2669, 29918, 978, 29922, 2917, 1839, 29894, 13891, 7464, 13, 9651, 848, 3790, 13, 18884, 525, 10149, 2396, 2295, 1839, 10149, 7464, 13, 18884, 525, 3258, 2396, 7700, 29892, 13, 9651, 500, 13, 4706, 1723, 13, 13, 4706, 396, 1207, 1854, 896, 526, 5130, 13, 4706, 363, 2777, 297, 518, 10149, 29892, 325, 13891, 5387, 13, 9651, 3414, 353, 2777, 29889, 816, 11272, 29918, 2467, 877, 6252, 1495, 13, 9651, 3414, 29889, 10685, 580, 13, 9651, 565, 3414, 29889, 3859, 1275, 525, 2704, 2396, 13, 18884, 12020, 3414, 29889, 687, 29877, 13, 13, 1678, 822, 903, 2716, 368, 29918, 29895, 29947, 29879, 29898, 1311, 29892, 503, 307, 7451, 1125, 13, 4706, 413, 29947, 29879, 353, 1583, 3032, 2886, 29918, 272, 29918, 3258, 29898, 13, 9651, 503, 307, 7451, 29892, 13, 9651, 4472, 29918, 5416, 29922, 1311, 29889, 29968, 29947, 29903, 29918, 4330, 3580, 29931, 3040, 29892, 13, 9651, 2669, 29918, 978, 29922, 1311, 29889, 978, 29892, 13, 9651, 848, 3790, 13, 18884, 525, 1287, 414, 3981, 2396, 1583, 29889, 1272, 1839, 1287, 414, 7464, 13, 18884, 525, 2311, 1204, 2396, 1583, 29889, 1272, 1839, 2311, 1204, 7464, 13, 18884, 525, 1272, 29928, 3873, 3505, 2396, 1583, 29889, 1272, 1839, 1272, 29928, 3873, 3505, 7464, 13, 18884, 525, 15269, 2558, 2396, 14210, 29879, 29899, 15269, 29915, 1273, 1583, 29889, 978, 29892, 13, 18884, 525, 29894, 13891, 2396, 1583, 29889, 1272, 1839, 29894, 13891, 2033, 13, 9651, 500, 13, 4706, 1723, 13, 13, 4706, 3414, 353, 413, 29947, 29879, 29889, 816, 11272, 29918, 2467, 877, 6252, 1495, 13, 4706, 3414, 29889, 10685, 580, 13, 13, 4706, 565, 3414, 29889, 3859, 1275, 525, 2704, 2396, 13, 9651, 12020, 3414, 29889, 687, 29877, 13, 13, 4706, 736, 3414, 29889, 2914, 13, 13, 1678, 822, 2601, 29898, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 3859, 29889, 3198, 877, 7387, 742, 525, 6252, 742, 525, 554, 1495, 13, 9651, 736, 13, 4706, 5174, 4306, 5596, 2392, 29901, 13, 9651, 1209, 13, 13, 4706, 16876, 353, 1583, 3032, 7469, 29918, 20907, 580, 13, 4706, 9225, 353, 1583, 3032, 7469, 29918, 29920, 307, 7451, 29898, 20907, 29897, 13, 13, 4706, 503, 307, 7451, 353, 1583, 29889, 2754, 29889, 13716, 1862, 29961, 7451, 29889, 978, 29962, 13, 13, 4706, 1583, 3032, 11038, 729, 29918, 9916, 29898, 29920, 307, 7451, 29897, 13, 4706, 1583, 29889, 1272, 1839, 11944, 9409, 2033, 353, 1583, 3032, 2716, 368, 29918, 29895, 29947, 29879, 29898, 29920, 307, 7451, 29897, 13, 13, 4706, 396, 2446, 4331, 29892, 1207, 263, 18209, 13, 4706, 1583, 29889, 3859, 29889, 842, 877, 7387, 742, 525, 6252, 742, 525, 554, 1495, 13, 2 ]
tests/test_dialect.py
zzzeek/calchipan
1
137716
<reponame>zzzeek/calchipan from sqlalchemy.testing.fixtures import TestBase import pandas as pd from sqlalchemy import create_engine, MetaData, Table, Column, \ String, Integer, ForeignKey, select, exc, func from . import eq_, assert_raises_message class DialectTest(TestBase): def _emp_d_fixture(self, id_cols=True): if id_cols: emp_df = pd.DataFrame([ {"emp_id": 1, "name": "ed", "fullname": "<NAME>", "dep_id": 1}, {"emp_id": 2, "name": "wendy", "fullname": "<NAME>", "dep_id": 1}, {"emp_id": 3, "name": "jack", "fullname": "<NAME>", "dep_id": 2}, ]) dept_df = pd.DataFrame([ {"dep_id": 1, "name": "Engineering"}, {"dep_id": 2, "name": "Accounting"}, {"dep_id": 3, "name": "Sales"}, ]) else: emp_df = pd.DataFrame([ {"name": "ed", "fullname": "<NAME>", "dep_id": 0}, {"name": "wendy", "fullname": "<NAME>", "dep_id": 0}, {"name": "jack", "fullname": "<NAME>", "dep_id": 1}, ]) dept_df = pd.DataFrame([ {"name": "Engineering"}, {"name": "Accounting"}, {"name": "Sales"}, ]) return {"employee": emp_df, "department": dept_df} def _md_fixture(self, pandas_index_pk=False): m = MetaData() emp = Table('employee', m, Column('emp_id', Integer, primary_key=True), Column('name', String), Column('fullname', String), Column('dep_id', Integer, ForeignKey('department.dep_id')), pandas_index_pk=pandas_index_pk ) dep = Table('department', m, Column('dep_id', Integer, primary_key=True), Column('name', String), pandas_index_pk=pandas_index_pk ) return emp, dep def test_has_table(self): eng = create_engine("pandas+calchipan://", namespace=self._emp_d_fixture()) assert eng.has_table('employee') assert not eng.has_table('fake') def test_execute_compiled(self): eng = create_engine("pandas+calchipan://", namespace=self._emp_d_fixture()) emp, dep = self._md_fixture() result = eng.execute(select([emp])) eq_( list(result), [(1, 'ed', '<NAME>', 1), (2, 'wendy', '<NAME>', 1), (3, 'jack', '<NAME>', 2)] ) def test_execute_standalone_fn(self): eng = create_engine("pandas+calchipan://", namespace=self._emp_d_fixture()) emp, dep = self._md_fixture() from calchipan import non_aggregate_fn @non_aggregate_fn() def myfunc(): return "hi" result = eng.execute(myfunc()) eq_( list(result), [('hi',)] ) def test_inserted_primary_key_autoinc(self): eng = create_engine("pandas+calchipan://", namespace={"employee": pd.DataFrame(columns=["name", "dep_id"])}) emp, dep = self._md_fixture(pandas_index_pk=True) r = eng.execute(emp.insert().values(name="ed", dep_id=5)) eq_(r.inserted_primary_key, [0]) r = eng.execute(emp.insert().values(name="jack", dep_id=12)) eq_(r.inserted_primary_key, [1]) def test_inserted_primary_key_no_autoinc(self): eng = create_engine("pandas+calchipan://", namespace={"employee": pd.DataFrame(columns=["name", "dep_id"])}) emp, dep = self._md_fixture(pandas_index_pk=False) r = eng.execute(emp.insert().values(name="ed", dep_id=5)) eq_(r.inserted_primary_key, [None]) r = eng.execute(emp.insert().values(name="jack", dep_id=12)) eq_(r.inserted_primary_key, [None]) def test_inserted_primary_key_manualinc(self): eng = create_engine("pandas+calchipan://", namespace={"employee": pd.DataFrame(columns=["emp_id", "name", "dep_id"])}) emp, dep = self._md_fixture() r = eng.execute(emp.insert().values(emp_id=3, name="ed", dep_id=5)) eq_(r.inserted_primary_key, [3])
[ 1, 529, 276, 1112, 420, 29958, 5617, 911, 1416, 29914, 1052, 305, 666, 273, 13, 3166, 4576, 284, 305, 6764, 29889, 13424, 29889, 7241, 486, 1973, 1053, 4321, 5160, 13, 13, 5215, 11701, 408, 10518, 13, 3166, 4576, 284, 305, 6764, 1053, 1653, 29918, 10599, 29892, 20553, 1469, 29892, 6137, 29892, 12481, 29892, 320, 13, 1678, 1714, 29892, 8102, 29892, 19358, 2558, 29892, 1831, 29892, 5566, 29892, 3653, 13, 3166, 869, 1053, 11594, 3383, 4974, 29918, 336, 4637, 29918, 4906, 13, 13, 1990, 22866, 781, 3057, 29898, 3057, 5160, 1125, 13, 13, 1678, 822, 903, 3451, 29918, 29881, 29918, 7241, 15546, 29898, 1311, 29892, 1178, 29918, 22724, 29922, 5574, 1125, 13, 4706, 565, 1178, 29918, 22724, 29901, 13, 9651, 3710, 29918, 2176, 353, 10518, 29889, 17271, 4197, 13, 462, 1678, 8853, 3451, 29918, 333, 1115, 29871, 29896, 29892, 376, 978, 1115, 376, 287, 613, 376, 8159, 978, 1115, 9872, 5813, 28341, 13, 462, 9651, 376, 2716, 29918, 333, 1115, 29871, 29896, 1118, 13, 462, 1678, 8853, 3451, 29918, 333, 1115, 29871, 29906, 29892, 376, 978, 1115, 376, 14555, 29891, 613, 376, 8159, 978, 1115, 9872, 5813, 28341, 13, 462, 9651, 376, 2716, 29918, 333, 1115, 29871, 29896, 1118, 13, 462, 1678, 8853, 3451, 29918, 333, 1115, 29871, 29941, 29892, 376, 978, 1115, 376, 21452, 613, 376, 8159, 978, 1115, 9872, 5813, 28341, 13, 462, 9651, 376, 2716, 29918, 333, 1115, 29871, 29906, 1118, 13, 13, 462, 2314, 13, 9651, 316, 415, 29918, 2176, 353, 10518, 29889, 17271, 4197, 13, 462, 4706, 8853, 2716, 29918, 333, 1115, 29871, 29896, 29892, 376, 978, 1115, 376, 12412, 3241, 10758, 13, 462, 4706, 8853, 2716, 29918, 333, 1115, 29871, 29906, 29892, 376, 978, 1115, 376, 10601, 292, 10758, 13, 462, 4706, 8853, 2716, 29918, 333, 1115, 29871, 29941, 29892, 376, 978, 1115, 376, 29903, 2122, 10758, 13, 462, 308, 2314, 13, 4706, 1683, 29901, 13, 9651, 3710, 29918, 2176, 353, 10518, 29889, 17271, 4197, 13, 462, 1678, 8853, 978, 1115, 376, 287, 613, 376, 8159, 978, 1115, 9872, 5813, 28341, 13, 462, 9651, 376, 2716, 29918, 333, 1115, 29871, 29900, 1118, 13, 462, 1678, 8853, 978, 1115, 376, 14555, 29891, 613, 376, 8159, 978, 1115, 9872, 5813, 28341, 13, 462, 9651, 376, 2716, 29918, 333, 1115, 29871, 29900, 1118, 13, 462, 1678, 8853, 978, 1115, 376, 21452, 613, 376, 8159, 978, 1115, 9872, 5813, 28341, 13, 462, 9651, 376, 2716, 29918, 333, 1115, 29871, 29896, 1118, 13, 13, 462, 2314, 13, 9651, 316, 415, 29918, 2176, 353, 10518, 29889, 17271, 4197, 13, 462, 4706, 8853, 978, 1115, 376, 12412, 3241, 10758, 13, 462, 4706, 8853, 978, 1115, 376, 10601, 292, 10758, 13, 462, 4706, 8853, 978, 1115, 376, 29903, 2122, 10758, 13, 462, 308, 2314, 13, 13, 4706, 736, 8853, 26143, 1115, 3710, 29918, 2176, 29892, 376, 311, 8076, 1115, 316, 415, 29918, 2176, 29913, 13, 13, 1678, 822, 903, 3487, 29918, 7241, 15546, 29898, 1311, 29892, 11701, 29918, 2248, 29918, 20571, 29922, 8824, 1125, 13, 4706, 286, 353, 20553, 1469, 580, 13, 4706, 3710, 353, 6137, 877, 26143, 742, 286, 29892, 13, 462, 1678, 12481, 877, 3451, 29918, 333, 742, 8102, 29892, 7601, 29918, 1989, 29922, 5574, 511, 13, 462, 1678, 12481, 877, 978, 742, 1714, 511, 13, 462, 1678, 12481, 877, 8159, 978, 742, 1714, 511, 13, 462, 1678, 12481, 877, 2716, 29918, 333, 742, 8102, 29892, 19358, 2558, 877, 311, 8076, 29889, 2716, 29918, 333, 1495, 511, 13, 462, 1678, 11701, 29918, 2248, 29918, 20571, 29922, 15112, 29918, 2248, 29918, 20571, 13, 9651, 1723, 13, 4706, 1401, 353, 6137, 877, 311, 8076, 742, 286, 29892, 13, 462, 1678, 12481, 877, 2716, 29918, 333, 742, 8102, 29892, 7601, 29918, 1989, 29922, 5574, 511, 13, 462, 1678, 12481, 877, 978, 742, 1714, 511, 13, 462, 1678, 11701, 29918, 2248, 29918, 20571, 29922, 15112, 29918, 2248, 29918, 20571, 13, 462, 1678, 1723, 13, 4706, 736, 3710, 29892, 1401, 13, 13, 1678, 822, 1243, 29918, 5349, 29918, 2371, 29898, 1311, 1125, 13, 4706, 3033, 353, 1653, 29918, 10599, 703, 15112, 29974, 1052, 305, 666, 273, 597, 613, 13, 462, 1678, 7397, 29922, 1311, 3032, 3451, 29918, 29881, 29918, 7241, 15546, 3101, 13, 4706, 4974, 3033, 29889, 5349, 29918, 2371, 877, 26143, 1495, 13, 4706, 4974, 451, 3033, 29889, 5349, 29918, 2371, 877, 29888, 1296, 1495, 13, 13, 1678, 822, 1243, 29918, 7978, 29918, 2388, 2356, 29898, 1311, 1125, 13, 4706, 3033, 353, 1653, 29918, 10599, 703, 15112, 29974, 1052, 305, 666, 273, 597, 613, 13, 462, 1678, 7397, 29922, 1311, 3032, 3451, 29918, 29881, 29918, 7241, 15546, 3101, 13, 4706, 3710, 29892, 1401, 353, 1583, 3032, 3487, 29918, 7241, 15546, 580, 13, 4706, 1121, 353, 3033, 29889, 7978, 29898, 2622, 4197, 3451, 12622, 13, 4706, 11594, 23538, 13, 9651, 1051, 29898, 2914, 511, 13, 9651, 17288, 29896, 29892, 525, 287, 742, 12801, 5813, 29958, 742, 29871, 29896, 511, 13, 18884, 313, 29906, 29892, 525, 14555, 29891, 742, 12801, 5813, 29958, 742, 29871, 29896, 511, 13, 18884, 313, 29941, 29892, 525, 21452, 742, 12801, 5813, 29958, 742, 29871, 29906, 4638, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 7978, 29918, 1689, 18785, 29918, 9144, 29898, 1311, 1125, 13, 4706, 3033, 353, 1653, 29918, 10599, 703, 15112, 29974, 1052, 305, 666, 273, 597, 613, 13, 462, 1678, 7397, 29922, 1311, 3032, 3451, 29918, 29881, 29918, 7241, 15546, 3101, 13, 4706, 3710, 29892, 1401, 353, 1583, 3032, 3487, 29918, 7241, 15546, 580, 13, 13, 4706, 515, 1208, 305, 666, 273, 1053, 1661, 29918, 26193, 403, 29918, 9144, 13, 13, 4706, 732, 5464, 29918, 26193, 403, 29918, 9144, 580, 13, 4706, 822, 590, 9891, 7295, 13, 9651, 736, 376, 2918, 29908, 13, 4706, 1121, 353, 3033, 29889, 7978, 29898, 1357, 9891, 3101, 13, 4706, 11594, 23538, 13, 9651, 1051, 29898, 2914, 511, 13, 9651, 518, 877, 2918, 742, 4638, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 7851, 287, 29918, 16072, 29918, 1989, 29918, 6921, 3742, 29898, 1311, 1125, 13, 4706, 3033, 353, 1653, 29918, 10599, 703, 15112, 29974, 1052, 305, 666, 273, 597, 613, 13, 462, 1678, 7397, 3790, 29908, 26143, 1115, 13, 462, 9651, 10518, 29889, 17271, 29898, 13099, 29922, 3366, 978, 613, 376, 2716, 29918, 333, 20068, 1800, 13, 4706, 3710, 29892, 1401, 353, 1583, 3032, 3487, 29918, 7241, 15546, 29898, 15112, 29918, 2248, 29918, 20571, 29922, 5574, 29897, 13, 4706, 364, 353, 3033, 29889, 7978, 29898, 3451, 29889, 7851, 2141, 5975, 29898, 978, 543, 287, 613, 1401, 29918, 333, 29922, 29945, 876, 13, 4706, 11594, 23538, 29878, 29889, 7851, 287, 29918, 16072, 29918, 1989, 29892, 518, 29900, 2314, 13, 13, 4706, 364, 353, 3033, 29889, 7978, 29898, 3451, 29889, 7851, 2141, 5975, 29898, 978, 543, 21452, 613, 1401, 29918, 333, 29922, 29896, 29906, 876, 13, 4706, 11594, 23538, 29878, 29889, 7851, 287, 29918, 16072, 29918, 1989, 29892, 518, 29896, 2314, 13, 13, 1678, 822, 1243, 29918, 7851, 287, 29918, 16072, 29918, 1989, 29918, 1217, 29918, 6921, 3742, 29898, 1311, 1125, 13, 4706, 3033, 353, 1653, 29918, 10599, 703, 15112, 29974, 1052, 305, 666, 273, 597, 613, 13, 462, 1678, 7397, 3790, 29908, 26143, 1115, 13, 462, 9651, 10518, 29889, 17271, 29898, 13099, 29922, 3366, 978, 613, 376, 2716, 29918, 333, 20068, 1800, 13, 4706, 3710, 29892, 1401, 353, 1583, 3032, 3487, 29918, 7241, 15546, 29898, 15112, 29918, 2248, 29918, 20571, 29922, 8824, 29897, 13, 4706, 364, 353, 3033, 29889, 7978, 29898, 3451, 29889, 7851, 2141, 5975, 29898, 978, 543, 287, 613, 1401, 29918, 333, 29922, 29945, 876, 13, 4706, 11594, 23538, 29878, 29889, 7851, 287, 29918, 16072, 29918, 1989, 29892, 518, 8516, 2314, 13, 13, 4706, 364, 353, 3033, 29889, 7978, 29898, 3451, 29889, 7851, 2141, 5975, 29898, 978, 543, 21452, 613, 1401, 29918, 333, 29922, 29896, 29906, 876, 13, 4706, 11594, 23538, 29878, 29889, 7851, 287, 29918, 16072, 29918, 1989, 29892, 518, 8516, 2314, 13, 13, 1678, 822, 1243, 29918, 7851, 287, 29918, 16072, 29918, 1989, 29918, 11288, 3742, 29898, 1311, 1125, 13, 4706, 3033, 353, 1653, 29918, 10599, 703, 15112, 29974, 1052, 305, 666, 273, 597, 613, 13, 462, 1678, 7397, 3790, 29908, 26143, 1115, 13, 462, 9651, 10518, 29889, 17271, 29898, 13099, 29922, 3366, 3451, 29918, 333, 613, 376, 978, 613, 376, 2716, 29918, 333, 20068, 1800, 13, 4706, 3710, 29892, 1401, 353, 1583, 3032, 3487, 29918, 7241, 15546, 580, 13, 4706, 364, 353, 3033, 29889, 7978, 29898, 3451, 29889, 7851, 2141, 5975, 29898, 3451, 29918, 333, 29922, 29941, 29892, 1024, 543, 287, 613, 1401, 29918, 333, 29922, 29945, 876, 13, 4706, 11594, 23538, 29878, 29889, 7851, 287, 29918, 16072, 29918, 1989, 29892, 518, 29941, 2314, 13, 13, 13, 13, 2 ]
www/purple_admin/urls.py
SubminO/vas
0
23537
from django.urls import path from purple_admin import views urlpatterns = [ path('', views.cabinet, name='admin_panel_cabinet'), # Адмника Наименований маршрутов path('route_list', views.cabinet_list, {'type': 'route'}, name='admin_panel_route_list'), path('route_add', views.cabinet_add, {'type': 'route'}, name='admin_panel_route_add'), path('route_edit/<int:pk>/', views.cabinet_edit, {'type': 'route'}, name='admin_panel_route_edit'), path('route_delete/<int:pk>/', views.cabinet_delete, {'type': 'route'}, name='admin_panel_route_delete'), # Адмника наименований остановок path('route_platform_list', views.cabinet_list, {'type': 'route_platform'}, name='admin_panel_route_platform_list'), path('route_platform_add', views.cabinet_add, {'type': 'route_platform'}, name='admin_panel_route_platform_add'), path('route_platform_edit/<int:pk>/', views.cabinet_edit, {'type': 'route_platform'}, name='admin_panel_route_platform_edit'), path('route_platform_delete/<int:pk>/', views.cabinet_delete, {'type': 'route_platform'}, name='admin_panel_route_platform_delete'), path('route_relation_add_ajax', views.cabinet_add, {'type': 'route_platform_type'}, name='admin_panel_route_platform_type_relation_ajax_add'), # Админка ТС path('ts_list', views.cabinet_list, {'type': 'ts'}, name='admin_panel_ts_list'), path('ts_add', views.cabinet_add, {'type': 'ts'}, name='admin_panel_ts_add'), path('ts_edit/<int:pk>/', views.cabinet_edit, {'type': 'ts'}, name='admin_panel_ts_edit'), path('ts_delete/<int:pk>/', views.cabinet_delete, {'type': 'ts'}, name='admin_panel_ts_delete'), # Адмника Создания маршрута на карте path('map_route_editor_add', views.mapped_route_add, name='admin_panel_mapped_route_add'), ]
[ 1, 515, 9557, 29889, 26045, 1053, 2224, 13, 13, 3166, 3708, 552, 29918, 6406, 1053, 8386, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 2224, 877, 742, 8386, 29889, 29883, 370, 10157, 29892, 1024, 2433, 6406, 29918, 15119, 29918, 29883, 370, 10157, 5477, 13, 1678, 396, 22601, 29959, 4222, 2372, 29917, 2387, 24404, 8487, 30002, 1086, 4820, 13, 1678, 2224, 877, 13134, 29918, 1761, 742, 8386, 29889, 29883, 370, 10157, 29918, 1761, 29892, 11117, 1853, 2396, 525, 13134, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 1761, 5477, 13, 1678, 2224, 877, 13134, 29918, 1202, 742, 8386, 29889, 29883, 370, 10157, 29918, 1202, 29892, 11117, 1853, 2396, 525, 13134, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 1202, 5477, 13, 1678, 2224, 877, 13134, 29918, 5628, 29914, 29966, 524, 29901, 20571, 20690, 742, 8386, 29889, 29883, 370, 10157, 29918, 5628, 29892, 11117, 1853, 2396, 525, 13134, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 5628, 5477, 13, 1678, 2224, 877, 13134, 29918, 8143, 29914, 29966, 524, 29901, 20571, 20690, 742, 8386, 29889, 29883, 370, 10157, 29918, 8143, 29892, 11117, 1853, 2396, 525, 13134, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 8143, 5477, 13, 1678, 396, 22601, 29959, 4222, 25015, 2387, 24404, 28180, 1930, 29951, 13, 1678, 2224, 877, 13134, 29918, 12120, 29918, 1761, 742, 8386, 29889, 29883, 370, 10157, 29918, 1761, 29892, 11117, 1853, 2396, 525, 13134, 29918, 12120, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 12120, 29918, 1761, 5477, 13, 1678, 2224, 877, 13134, 29918, 12120, 29918, 1202, 742, 8386, 29889, 29883, 370, 10157, 29918, 1202, 29892, 11117, 1853, 2396, 525, 13134, 29918, 12120, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 12120, 29918, 1202, 5477, 13, 1678, 2224, 877, 13134, 29918, 12120, 29918, 5628, 29914, 29966, 524, 29901, 20571, 20690, 742, 8386, 29889, 29883, 370, 10157, 29918, 5628, 29892, 11117, 1853, 2396, 525, 13134, 29918, 12120, 16675, 13, 308, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 12120, 29918, 5628, 5477, 13, 1678, 2224, 877, 13134, 29918, 12120, 29918, 8143, 29914, 29966, 524, 29901, 20571, 20690, 742, 8386, 29889, 29883, 370, 10157, 29918, 8143, 29892, 11117, 1853, 2396, 525, 13134, 29918, 12120, 16675, 13, 308, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 12120, 29918, 8143, 5477, 13, 1678, 2224, 877, 13134, 29918, 23445, 29918, 1202, 29918, 6538, 742, 8386, 29889, 29883, 370, 10157, 29918, 1202, 29892, 11117, 1853, 2396, 525, 13134, 29918, 12120, 29918, 1853, 16675, 13, 308, 1024, 2433, 6406, 29918, 15119, 29918, 13134, 29918, 12120, 29918, 1853, 29918, 23445, 29918, 6538, 29918, 1202, 5477, 13, 1678, 396, 22601, 23664, 642, 1703, 30008, 13, 1678, 2224, 877, 1372, 29918, 1761, 742, 8386, 29889, 29883, 370, 10157, 29918, 1761, 29892, 11117, 1853, 2396, 525, 1372, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 1372, 29918, 1761, 5477, 13, 1678, 2224, 877, 1372, 29918, 1202, 742, 8386, 29889, 29883, 370, 10157, 29918, 1202, 29892, 11117, 1853, 2396, 525, 1372, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 1372, 29918, 1202, 5477, 13, 1678, 2224, 877, 1372, 29918, 5628, 29914, 29966, 524, 29901, 20571, 20690, 742, 8386, 29889, 29883, 370, 10157, 29918, 5628, 29892, 11117, 1853, 2396, 525, 1372, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 1372, 29918, 5628, 5477, 13, 1678, 2224, 877, 1372, 29918, 8143, 29914, 29966, 524, 29901, 20571, 20690, 742, 8386, 29889, 29883, 370, 10157, 29918, 8143, 29892, 11117, 1853, 2396, 525, 1372, 16675, 1024, 2433, 6406, 29918, 15119, 29918, 1372, 29918, 8143, 5477, 13, 1678, 396, 22601, 29959, 4222, 5579, 8728, 1587, 8487, 30002, 1086, 676, 665, 10766, 730, 13, 1678, 2224, 877, 1958, 29918, 13134, 29918, 15204, 29918, 1202, 742, 8386, 29889, 655, 2986, 29918, 13134, 29918, 1202, 29892, 1024, 2433, 6406, 29918, 15119, 29918, 655, 2986, 29918, 13134, 29918, 1202, 5477, 13, 29962, 13, 2 ]
gtm/GTM.py
TimurGimadiev/GTM
0
176024
<filename>gtm/GTM.py import os import sys import math import torch import torch.nn as nn class GTMEstimator(nn.Module): """ Generative Topographic Mapping implementation with Gaussian Noise manifold model. Source: https://www.microsoft.com/en-us/research/wp-content/uploads/1998/01/bishop-gtm-ncomp-98.pdf """ def __init__(self, in_features=None, out_features=None, n_x_points=100, verbose=False, y=None, method="mean", lmbd=0, cuda=False): """ Initialisation: Creates Class instance. :param in_features: Size of latent space :param out_features: Size of variable space :param n_x_points: Size of basis grid :param verbose: If true, the training process will output intermediate information :param y: Mapping function, has to be differentiable by pytorch. """ super(GTMEstimator, self).__init__() assert not (isinstance(in_features, type(None)) or isinstance(out_features, type(None))), \ 'You must provide sizes for hidden and variable dimension' if cuda: self.device = torch.device('cuda') else: self.device = torch.device('cpu') self.in_features = in_features self.out_features = out_features self.lmbd = lmbd if isinstance(y, type(None)): self.y = nn.Linear(in_features, out_features) self.y = y self.betta = torch.rand(1, requires_grad=True, device=self.device) self.norm = nn.BatchNorm1d(out_features, momentum=0.5) self.grid = self.get_grid(n_x_points) self.verbose = verbose self.betta_opt = torch.optim.Adam([self.betta]) self.y_opt = torch.optim.Adam(self.y.parameters()) self.norm_opt = torch.optim.Adam(self.norm.parameters()) self.method = method self.mean = 0 self.std = 1 def get_grid(self, n_points): """ Initializing basis grid for likelihood estimation :param n_points: size of the grid in the latent space :return: grid in the form of flattened torch tensor """ grid = torch.meshgrid(*[torch.linspace(0, 1, n_points) for _ in range(self.in_features)]) grid = torch.stack([t.flatten() for t in grid]).T.to(self.device) return grid def train_epoch(self, X, batch_size=256): """ Training function, to estimate the distributions sigma and mapping weights. :param X: Data from variable space :param batch_size: size of training batches :return: history of losses """ l_h = [] # Loss history n_x_variable, D = X.size() for i in range(math.ceil(n_x_variable / batch_size)): self.y.zero_grad() self.norm.zero_grad() self.betta_opt.zero_grad() self.y_opt.zero_grad() self.norm_opt.zero_grad() batch = self.norm(X[i * batch_size:(i + 1) * batch_size]) size, _ = batch.size() dist = (-self.betta / 2) * torch.pow(torch.cdist(self.y(self.grid), batch), 2) exp = torch.exp(dist) p = torch.pow(self.betta / (2 * math.pi), D / 2) * exp p_x = torch.clip(torch.mean(p, dim=0), min=1e-20) loss = -1 * torch.log(p_x).sum(dim=0) if self.lmbd: for params in self.y.parameters(): if len(params.size()) == 2: D1, D2 = params.size() M = D1 * D2 else: D1, = params.size() M = D1 reg = torch.sum(torch.pow(params, 2)) exp_reg = torch.exp((-self.lmbd / 2) * reg) p_w = exp_reg * (self.lmbd / (2 * math.pi)) ** (M / 2) loss += -1 * p_w loss.backward() self.betta_opt.step() self.y_opt.step() self.norm_opt.step() l_h.append(loss.item() / size) return l_h def train_epochs(self, X, n_epochs=1, batch_size=256): """ Training function, to estimate the distributions sigma and mapping weights. Runs one epoch procedure `n_epochs` times. :param X: Data from variable space :param n_epochs: number of epochs to run :param batch_size: size of training batches :return: history of losses """ l_h = [] self.train() self.mean = X.mean(dim=0) self.std = X.std(dim=0) for i in range(n_epochs): l_h.extend(self.train_epoch(X, batch_size)) if self.verbose: print('epoch #{}: likelihood: {:.3f} betta: {:.3f}'.format(i + 1, l_h[-1], self.betta.item())) return l_h def transform(self, X, batch_size=256): """ Performs mapping from variable space to latent space. :param X: Data from variable space :param batch_size: Size of the batch to use :return: Data in latent space """ assert self.method in ('mean', 'mode'), "Mode can be either mean or mode." self.eval() with torch.no_grad(): tensor_list = [] n_x_variable, D = X.size() for i in range(math.ceil(n_x_variable / batch_size)): dist = (-self.betta / 2) * torch.pow(torch.cdist(self.y(self.grid), self.norm(X[i*batch_size:(i+1)*batch_size]), 2)) exp = torch.exp(dist) p = torch.pow(self.betta / (2 * math.pi), D / 2) * exp p_x = p / p.sum(dim=0) if self.method == 'mean': tensor_list.append((self.grid.T @ p_x).T) elif self.method == 'mode': tensor_list.append(self.grid[p_x.argmax(dim=0), :] ) return torch.cat(tensor_list, dim=0) def inverse_transform(self, H, batch_size=256): """ Performs mapping from latent space to variable space. :param H: Data from latent space :param batch_size: Size of the batch to use :return: Data in variable space """ assert self.method in ('mean', 'mode'), "Mode can be either mean or mode." self.eval() with torch.no_grad(): tensor_list = [] n_x_variable, D = H.size() for i in range(math.ceil(n_x_variable / batch_size)): tensor_list.append(self.y(self.norm(H[batch_size*i: batch_size*(i+1)]))) return torch.cat(tensor_list, dim=0) if __name__ == "__main__": in_features = 2 hidden_features = 12 out_features = 4 y = nn.Sequential( nn.Linear(in_features, hidden_features), nn.ReLU(), nn.Linear(hidden_features, hidden_features), nn.ReLU(), nn.Linear(hidden_features, out_features)) est = GTMEstimator(in_features=in_features, out_features=out_features, n_x_points=3, verbose=True, y=y) Df = torch.rand(1024, 4) est.train_epochs(Df, 1000) output = (est.transform(Df)).numpy()
[ 1, 529, 9507, 29958, 4141, 29885, 29914, 29954, 23081, 29889, 2272, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 5844, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 13, 13, 1990, 21342, 2303, 303, 326, 1061, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 13, 1678, 3251, 1230, 7488, 12122, 341, 20304, 5314, 411, 22477, 1939, 895, 25941, 1904, 29889, 13, 1678, 7562, 29901, 2045, 597, 1636, 29889, 4994, 29889, 510, 29914, 264, 29899, 375, 29914, 690, 2842, 29914, 11912, 29899, 3051, 29914, 9009, 29879, 29914, 29896, 29929, 29929, 29947, 29914, 29900, 29896, 29914, 28693, 29899, 4141, 29885, 29899, 29876, 2388, 29899, 29929, 29947, 29889, 5140, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 297, 29918, 22100, 29922, 8516, 29892, 714, 29918, 22100, 29922, 8516, 29892, 302, 29918, 29916, 29918, 9748, 29922, 29896, 29900, 29900, 29892, 26952, 29922, 8824, 29892, 343, 29922, 8516, 29892, 1158, 543, 12676, 613, 13, 462, 301, 29885, 6448, 29922, 29900, 29892, 274, 6191, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 17250, 4371, 29901, 13, 4706, 6760, 1078, 4134, 2777, 29889, 13, 13, 4706, 584, 3207, 297, 29918, 22100, 29901, 21179, 310, 3405, 296, 2913, 13, 4706, 584, 3207, 714, 29918, 22100, 29901, 21179, 310, 2286, 2913, 13, 4706, 584, 3207, 302, 29918, 29916, 29918, 9748, 29901, 21179, 310, 8405, 6856, 13, 4706, 584, 3207, 26952, 29901, 960, 1565, 29892, 278, 6694, 1889, 674, 1962, 19697, 2472, 13, 4706, 584, 3207, 343, 29901, 341, 20304, 740, 29892, 756, 304, 367, 17473, 519, 491, 282, 3637, 25350, 29889, 13, 4706, 9995, 13, 4706, 2428, 29898, 23799, 2303, 303, 326, 1061, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 4974, 451, 313, 275, 8758, 29898, 262, 29918, 22100, 29892, 1134, 29898, 8516, 876, 470, 338, 8758, 29898, 449, 29918, 22100, 29892, 1134, 29898, 8516, 876, 511, 320, 13, 9651, 525, 3492, 1818, 3867, 15786, 363, 7934, 322, 2286, 9927, 29915, 13, 13, 4706, 565, 274, 6191, 29901, 13, 9651, 1583, 29889, 10141, 353, 4842, 305, 29889, 10141, 877, 29883, 6191, 1495, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 10141, 353, 4842, 305, 29889, 10141, 877, 21970, 1495, 13, 13, 4706, 1583, 29889, 262, 29918, 22100, 353, 297, 29918, 22100, 13, 4706, 1583, 29889, 449, 29918, 22100, 353, 714, 29918, 22100, 13, 4706, 1583, 29889, 21457, 6448, 353, 301, 29885, 6448, 13, 13, 4706, 565, 338, 8758, 29898, 29891, 29892, 1134, 29898, 8516, 22164, 13, 9651, 1583, 29889, 29891, 353, 302, 29876, 29889, 12697, 29898, 262, 29918, 22100, 29892, 714, 29918, 22100, 29897, 13, 13, 4706, 1583, 29889, 29891, 353, 343, 13, 13, 4706, 1583, 29889, 6878, 941, 353, 4842, 305, 29889, 9502, 29898, 29896, 29892, 6858, 29918, 5105, 29922, 5574, 29892, 4742, 29922, 1311, 29889, 10141, 29897, 13, 4706, 1583, 29889, 12324, 353, 302, 29876, 29889, 23145, 29940, 555, 29896, 29881, 29898, 449, 29918, 22100, 29892, 19399, 29922, 29900, 29889, 29945, 29897, 13, 13, 4706, 1583, 29889, 7720, 353, 1583, 29889, 657, 29918, 7720, 29898, 29876, 29918, 29916, 29918, 9748, 29897, 13, 4706, 1583, 29889, 369, 15828, 353, 26952, 13, 13, 4706, 1583, 29889, 6878, 941, 29918, 3670, 353, 4842, 305, 29889, 20640, 29889, 3253, 314, 4197, 1311, 29889, 6878, 941, 2314, 13, 4706, 1583, 29889, 29891, 29918, 3670, 353, 4842, 305, 29889, 20640, 29889, 3253, 314, 29898, 1311, 29889, 29891, 29889, 16744, 3101, 13, 4706, 1583, 29889, 12324, 29918, 3670, 353, 4842, 305, 29889, 20640, 29889, 3253, 314, 29898, 1311, 29889, 12324, 29889, 16744, 3101, 13, 13, 4706, 1583, 29889, 5696, 353, 1158, 13, 4706, 1583, 29889, 12676, 353, 29871, 29900, 13, 4706, 1583, 29889, 4172, 353, 29871, 29896, 13, 13, 1678, 822, 679, 29918, 7720, 29898, 1311, 29892, 302, 29918, 9748, 1125, 13, 4706, 9995, 13, 4706, 17250, 5281, 8405, 6856, 363, 4188, 22342, 23248, 13, 13, 4706, 584, 3207, 302, 29918, 9748, 29901, 2159, 310, 278, 6856, 297, 278, 3405, 296, 2913, 13, 4706, 584, 2457, 29901, 6856, 297, 278, 883, 310, 1652, 8606, 287, 4842, 305, 12489, 13, 4706, 9995, 13, 4706, 6856, 353, 4842, 305, 29889, 4467, 29882, 7720, 10456, 29961, 7345, 305, 29889, 1915, 3493, 29898, 29900, 29892, 29871, 29896, 29892, 302, 29918, 9748, 29897, 363, 903, 297, 3464, 29898, 1311, 29889, 262, 29918, 22100, 29897, 2314, 13, 4706, 6856, 353, 4842, 305, 29889, 1429, 4197, 29873, 29889, 1579, 8606, 580, 363, 260, 297, 6856, 14664, 29911, 29889, 517, 29898, 1311, 29889, 10141, 29897, 13, 13, 4706, 736, 6856, 13, 13, 1678, 822, 7945, 29918, 1022, 2878, 29898, 1311, 29892, 1060, 29892, 9853, 29918, 2311, 29922, 29906, 29945, 29953, 1125, 13, 4706, 9995, 13, 4706, 26101, 740, 29892, 304, 12678, 278, 18822, 269, 2934, 322, 10417, 18177, 29889, 13, 13, 4706, 584, 3207, 1060, 29901, 3630, 515, 2286, 2913, 13, 4706, 584, 3207, 9853, 29918, 2311, 29901, 2159, 310, 6694, 9853, 267, 13, 4706, 584, 2457, 29901, 4955, 310, 28495, 13, 4706, 9995, 13, 13, 4706, 301, 29918, 29882, 353, 5159, 29871, 396, 365, 2209, 4955, 13, 4706, 302, 29918, 29916, 29918, 11918, 29892, 360, 353, 1060, 29889, 2311, 580, 13, 13, 4706, 363, 474, 297, 3464, 29898, 755, 29889, 27696, 29898, 29876, 29918, 29916, 29918, 11918, 847, 9853, 29918, 2311, 22164, 13, 9651, 1583, 29889, 29891, 29889, 9171, 29918, 5105, 580, 13, 9651, 1583, 29889, 12324, 29889, 9171, 29918, 5105, 580, 13, 9651, 1583, 29889, 6878, 941, 29918, 3670, 29889, 9171, 29918, 5105, 580, 13, 9651, 1583, 29889, 29891, 29918, 3670, 29889, 9171, 29918, 5105, 580, 13, 9651, 1583, 29889, 12324, 29918, 3670, 29889, 9171, 29918, 5105, 580, 13, 13, 9651, 9853, 353, 1583, 29889, 12324, 29898, 29990, 29961, 29875, 334, 9853, 29918, 2311, 5919, 29875, 718, 29871, 29896, 29897, 334, 9853, 29918, 2311, 2314, 13, 9651, 2159, 29892, 903, 353, 9853, 29889, 2311, 580, 13, 13, 9651, 1320, 353, 8521, 1311, 29889, 6878, 941, 847, 29871, 29906, 29897, 334, 4842, 305, 29889, 12248, 29898, 7345, 305, 29889, 2252, 391, 29898, 1311, 29889, 29891, 29898, 1311, 29889, 7720, 511, 9853, 511, 29871, 29906, 29897, 13, 9651, 1518, 353, 4842, 305, 29889, 4548, 29898, 5721, 29897, 13, 9651, 282, 353, 4842, 305, 29889, 12248, 29898, 1311, 29889, 6878, 941, 847, 313, 29906, 334, 5844, 29889, 1631, 511, 360, 847, 29871, 29906, 29897, 334, 1518, 13, 9651, 282, 29918, 29916, 353, 4842, 305, 29889, 24049, 29898, 7345, 305, 29889, 12676, 29898, 29886, 29892, 3964, 29922, 29900, 511, 1375, 29922, 29896, 29872, 29899, 29906, 29900, 29897, 13, 632, 13, 9651, 6410, 353, 448, 29896, 334, 4842, 305, 29889, 1188, 29898, 29886, 29918, 29916, 467, 2083, 29898, 6229, 29922, 29900, 29897, 13, 13, 9651, 565, 1583, 29889, 21457, 6448, 29901, 13, 18884, 363, 8636, 297, 1583, 29889, 29891, 29889, 16744, 7295, 13, 462, 1678, 565, 7431, 29898, 7529, 29889, 2311, 3101, 1275, 29871, 29906, 29901, 13, 462, 4706, 360, 29896, 29892, 360, 29906, 353, 8636, 29889, 2311, 580, 13, 462, 4706, 341, 353, 360, 29896, 334, 360, 29906, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 360, 29896, 29892, 353, 8636, 29889, 2311, 580, 13, 462, 4706, 341, 353, 360, 29896, 13, 13, 462, 1678, 1072, 353, 4842, 305, 29889, 2083, 29898, 7345, 305, 29889, 12248, 29898, 7529, 29892, 29871, 29906, 876, 13, 462, 1678, 1518, 29918, 1727, 353, 4842, 305, 29889, 4548, 3552, 29899, 1311, 29889, 21457, 6448, 847, 29871, 29906, 29897, 334, 1072, 29897, 13, 462, 1678, 282, 29918, 29893, 353, 1518, 29918, 1727, 334, 313, 1311, 29889, 21457, 6448, 847, 313, 29906, 334, 5844, 29889, 1631, 876, 3579, 313, 29924, 847, 29871, 29906, 29897, 13, 462, 1678, 6410, 4619, 448, 29896, 334, 282, 29918, 29893, 13, 13, 9651, 6410, 29889, 1627, 1328, 580, 13, 9651, 1583, 29889, 6878, 941, 29918, 3670, 29889, 10568, 580, 13, 9651, 1583, 29889, 29891, 29918, 3670, 29889, 10568, 580, 13, 9651, 1583, 29889, 12324, 29918, 3670, 29889, 10568, 580, 13, 13, 9651, 301, 29918, 29882, 29889, 4397, 29898, 6758, 29889, 667, 580, 847, 2159, 29897, 13, 13, 4706, 736, 301, 29918, 29882, 13, 13, 1678, 822, 7945, 29918, 1022, 2878, 29879, 29898, 1311, 29892, 1060, 29892, 302, 29918, 1022, 2878, 29879, 29922, 29896, 29892, 9853, 29918, 2311, 29922, 29906, 29945, 29953, 1125, 13, 4706, 9995, 13, 4706, 26101, 740, 29892, 304, 12678, 278, 18822, 269, 2934, 322, 10417, 18177, 29889, 13, 4706, 390, 6948, 697, 21502, 305, 8792, 421, 29876, 29918, 1022, 2878, 29879, 29952, 3064, 29889, 13, 13, 4706, 584, 3207, 1060, 29901, 3630, 515, 2286, 2913, 13, 4706, 584, 3207, 302, 29918, 1022, 2878, 29879, 29901, 1353, 310, 21502, 12168, 304, 1065, 13, 4706, 584, 3207, 9853, 29918, 2311, 29901, 2159, 310, 6694, 9853, 267, 13, 4706, 584, 2457, 29901, 4955, 310, 28495, 13, 4706, 9995, 13, 13, 4706, 301, 29918, 29882, 353, 5159, 13, 13, 4706, 1583, 29889, 14968, 580, 13, 4706, 1583, 29889, 12676, 353, 1060, 29889, 12676, 29898, 6229, 29922, 29900, 29897, 13, 4706, 1583, 29889, 4172, 353, 1060, 29889, 4172, 29898, 6229, 29922, 29900, 29897, 13, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 29918, 1022, 2878, 29879, 1125, 13, 9651, 301, 29918, 29882, 29889, 21843, 29898, 1311, 29889, 14968, 29918, 1022, 2878, 29898, 29990, 29892, 9853, 29918, 2311, 876, 13, 13, 9651, 565, 1583, 29889, 369, 15828, 29901, 13, 18884, 1596, 877, 1022, 2878, 24037, 6177, 4188, 22342, 29901, 12365, 29889, 29941, 29888, 29913, 1010, 941, 29901, 12365, 29889, 29941, 29888, 29913, 4286, 4830, 29898, 29875, 718, 29871, 29896, 29892, 301, 29918, 29882, 14352, 29896, 1402, 1583, 29889, 6878, 941, 29889, 667, 22130, 13, 13, 4706, 736, 301, 29918, 29882, 13, 13, 1678, 822, 4327, 29898, 1311, 29892, 1060, 29892, 9853, 29918, 2311, 29922, 29906, 29945, 29953, 1125, 13, 4706, 9995, 13, 4706, 2431, 9514, 10417, 515, 2286, 2913, 304, 3405, 296, 2913, 29889, 13, 13, 4706, 584, 3207, 1060, 29901, 3630, 515, 2286, 2913, 13, 4706, 584, 3207, 9853, 29918, 2311, 29901, 21179, 310, 278, 9853, 304, 671, 13, 4706, 584, 2457, 29901, 3630, 297, 3405, 296, 2913, 13, 4706, 9995, 13, 13, 4706, 4974, 1583, 29889, 5696, 297, 6702, 12676, 742, 525, 8513, 5477, 376, 6818, 508, 367, 2845, 2099, 470, 4464, 1213, 13, 4706, 1583, 29889, 14513, 580, 13, 4706, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 9651, 12489, 29918, 1761, 353, 5159, 13, 9651, 302, 29918, 29916, 29918, 11918, 29892, 360, 353, 1060, 29889, 2311, 580, 13, 13, 9651, 363, 474, 297, 3464, 29898, 755, 29889, 27696, 29898, 29876, 29918, 29916, 29918, 11918, 847, 9853, 29918, 2311, 22164, 13, 18884, 1320, 353, 8521, 1311, 29889, 6878, 941, 847, 29871, 29906, 29897, 334, 4842, 305, 29889, 12248, 29898, 7345, 305, 29889, 2252, 391, 29898, 1311, 29889, 29891, 29898, 1311, 29889, 7720, 511, 13, 462, 462, 462, 462, 1583, 29889, 12324, 29898, 29990, 29961, 29875, 29930, 16175, 29918, 2311, 5919, 29875, 29974, 29896, 11877, 16175, 29918, 2311, 11724, 29871, 29906, 876, 13, 18884, 1518, 353, 4842, 305, 29889, 4548, 29898, 5721, 29897, 13, 18884, 282, 353, 4842, 305, 29889, 12248, 29898, 1311, 29889, 6878, 941, 847, 313, 29906, 334, 5844, 29889, 1631, 511, 360, 847, 29871, 29906, 29897, 334, 1518, 13, 18884, 282, 29918, 29916, 353, 282, 847, 282, 29889, 2083, 29898, 6229, 29922, 29900, 29897, 13, 13, 18884, 565, 1583, 29889, 5696, 1275, 525, 12676, 2396, 13, 462, 1678, 12489, 29918, 1761, 29889, 4397, 3552, 1311, 29889, 7720, 29889, 29911, 732, 282, 29918, 29916, 467, 29911, 29897, 13, 13, 18884, 25342, 1583, 29889, 5696, 1275, 525, 8513, 2396, 13, 462, 1678, 12489, 29918, 1761, 29889, 4397, 29898, 1311, 29889, 7720, 29961, 29886, 29918, 29916, 29889, 1191, 3317, 29898, 6229, 29922, 29900, 511, 584, 29962, 1723, 13, 462, 268, 13, 9651, 736, 4842, 305, 29889, 4117, 29898, 20158, 29918, 1761, 29892, 3964, 29922, 29900, 29897, 13, 13, 1678, 822, 16402, 29918, 9067, 29898, 1311, 29892, 379, 29892, 9853, 29918, 2311, 29922, 29906, 29945, 29953, 1125, 13, 4706, 9995, 13, 4706, 2431, 9514, 10417, 515, 3405, 296, 2913, 304, 2286, 2913, 29889, 13, 13, 4706, 584, 3207, 379, 29901, 3630, 515, 3405, 296, 2913, 13, 4706, 584, 3207, 9853, 29918, 2311, 29901, 21179, 310, 278, 9853, 304, 671, 13, 4706, 584, 2457, 29901, 3630, 297, 2286, 2913, 13, 4706, 9995, 13, 308, 13, 4706, 4974, 1583, 29889, 5696, 297, 6702, 12676, 742, 525, 8513, 5477, 376, 6818, 508, 367, 2845, 2099, 470, 4464, 1213, 13, 4706, 1583, 29889, 14513, 580, 13, 4706, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 9651, 12489, 29918, 1761, 353, 5159, 13, 9651, 302, 29918, 29916, 29918, 11918, 29892, 360, 353, 379, 29889, 2311, 580, 13, 632, 13, 9651, 363, 474, 297, 3464, 29898, 755, 29889, 27696, 29898, 29876, 29918, 29916, 29918, 11918, 847, 9853, 29918, 2311, 22164, 13, 18884, 12489, 29918, 1761, 29889, 4397, 29898, 1311, 29889, 29891, 29898, 1311, 29889, 12324, 29898, 29950, 29961, 16175, 29918, 2311, 29930, 29875, 29901, 9853, 29918, 2311, 16395, 29875, 29974, 29896, 4638, 4961, 13, 13, 4706, 736, 4842, 305, 29889, 4117, 29898, 20158, 29918, 1761, 29892, 3964, 29922, 29900, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 297, 29918, 22100, 353, 29871, 29906, 13, 1678, 7934, 29918, 22100, 353, 29871, 29896, 29906, 13, 1678, 714, 29918, 22100, 353, 29871, 29946, 13, 13, 1678, 343, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 262, 29918, 22100, 29892, 7934, 29918, 22100, 511, 13, 4706, 302, 29876, 29889, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29918, 22100, 29892, 7934, 29918, 22100, 511, 13, 4706, 302, 29876, 29889, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29918, 22100, 29892, 714, 29918, 22100, 876, 13, 13, 1678, 707, 353, 21342, 2303, 303, 326, 1061, 29898, 262, 29918, 22100, 29922, 262, 29918, 22100, 29892, 714, 29918, 22100, 29922, 449, 29918, 22100, 29892, 302, 29918, 29916, 29918, 9748, 29922, 29941, 29892, 26952, 29922, 5574, 29892, 343, 29922, 29891, 29897, 13, 13, 1678, 360, 29888, 353, 4842, 305, 29889, 9502, 29898, 29896, 29900, 29906, 29946, 29892, 29871, 29946, 29897, 13, 1678, 707, 29889, 14968, 29918, 1022, 2878, 29879, 29898, 29928, 29888, 29892, 29871, 29896, 29900, 29900, 29900, 29897, 13, 1678, 1962, 353, 313, 342, 29889, 9067, 29898, 29928, 29888, 8106, 23749, 580, 13, 2 ]
module2-sql-for-analysis/assignment_2_postgresql.py
ash827/DS-Unit-3-Sprint-2-SQL-and-Databases
0
142367
<filename>module2-sql-for-analysis/assignment_2_postgresql.py<gh_stars>0 # -*- coding: utf-8 -*- """Assignment 2 PostgreSQL.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1RaFLSTAwoZ8IeLg27YQqhnMe-g3Vtt4m POSTGRES DEMO """ !pip install psycopg2-binary import psycopg2 import os from dotenv import load_dotenv load_dotenv() """1. Establish connection 2. Cursor 3. Execute query 4. Get RESULTS! """ DB_HOST = os.getenv("DB_HOST", default="OOPS") DB_NAME = os.getenv("DB_NAME", default="OOPS") DB_USER = os.getenv("DB_USER", default="OOPS") DB_PASSWORD = os.getenv("DB_PASSWORD", default="<PASSWORD>") connection = psycopg2.connect( dbname=DB_NAME, user=DB_USER, password=<PASSWORD>, host=DB_HOST ) cursor = connection.cursor() cursor.execute('SELECT * from playground;') results = cursor.fetchall() print(results) """##Working with the rpg database""" import sqlite3 import pandas as pd conn = sqlite3.connect('rpg_db (1).sqlite3') sl_cursor = conn.cursor() count = sl_cursor.execute('SELECT COUNT(*) FROM charactercreator_character;').fetchall() count characters = sl_cursor.execute('SELECT * FROM charactercreator_character').fetchall() characters #This shows us the schema sl_cursor.execute('PRAGMA table_info(charactercreator_character);').fetchall() create_character_table = ''' CREATE TABLE character_table ( character_id SERIAL PRIMARY KEY, name VARCHAR(100), level INT, exp INT, hp INT, strength INT, intelligence INT, dexterity INT, wisdom INT ); ''' pg_cursor.execute(create_character_table) pg_cursor.execute("INSERT INTO character_table VALUES (1, 'Aliquid iste optio reiciendi, 0, 0, 10, 1, 1, 1, 1');") for character in characters: print("INSERT INTO character_table VALUES " + str(character) + '.') """#Titanic Data for Assignment""" !wget 'https://raw.githubusercontent.com/ash827/DS-Unit-3-Sprint-2-SQL-and-Databases/master/module2-sql-for-analysis/titanic.csv' import pandas as pd df_titanic = pd.read_csv('https://raw.githubusercontent.com/ash827/DS-Unit-3-Sprint-2-SQL-and-Databases/master/module2-sql-for-analysis/titanic.csv') df_titanic.shape df_titanic.columns.tolist() df_titanic = df_titanic.reindex(columns = ['Name', 'Age', 'Sex', 'Pclass', 'Fare', 'Siblings/Spouses Aboard', 'Parents/Children Aboard', 'Survived']) #The columns are now in a nice order :) """##Using sqlite3 with the Titanic data #Having trouble getting the titanic information to load as a db? """ conn = sqlite3.connect('titanic.csv') ti_cursor = conn.cursor() count = ti_cursor.execute('SELECT COUNT(*) FROM Name;').fetchall() count
[ 1, 529, 9507, 29958, 5453, 29906, 29899, 2850, 29899, 1454, 29899, 15916, 29914, 465, 10194, 29918, 29906, 29918, 29272, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 7900, 10194, 29871, 29906, 4918, 7979, 4176, 29889, 666, 948, 29890, 13, 13, 28451, 19574, 5759, 491, 1530, 3717, 7606, 29889, 13, 13, 26036, 934, 338, 5982, 472, 13, 1678, 2045, 597, 1054, 370, 29889, 690, 2842, 29889, 3608, 29889, 510, 29914, 21594, 29914, 29896, 29934, 29874, 10536, 1254, 29909, 827, 29999, 29947, 29902, 29872, 29931, 29887, 29906, 29955, 29979, 29984, 29939, 3123, 6816, 29899, 29887, 29941, 29963, 698, 29946, 29885, 13, 13, 5438, 29954, 15989, 5012, 6720, 13, 15945, 29908, 13, 13, 29991, 13096, 2601, 6529, 29891, 9708, 29887, 29906, 29899, 19541, 13, 13, 5215, 6529, 29891, 9708, 29887, 29906, 13, 5215, 2897, 13, 3166, 8329, 6272, 1053, 2254, 29918, 6333, 6272, 13, 13, 1359, 29918, 6333, 6272, 580, 13, 13, 15945, 29908, 29896, 29889, 2661, 370, 1674, 3957, 13, 29906, 29889, 315, 5966, 13, 29941, 29889, 11080, 1082, 2346, 13, 29946, 29889, 3617, 390, 2890, 8647, 29903, 29991, 13, 15945, 29908, 13, 13, 4051, 29918, 20832, 353, 2897, 29889, 657, 6272, 703, 4051, 29918, 20832, 613, 2322, 543, 29949, 4590, 29903, 1159, 13, 4051, 29918, 5813, 353, 2897, 29889, 657, 6272, 703, 4051, 29918, 5813, 613, 2322, 543, 29949, 4590, 29903, 1159, 13, 4051, 29918, 11889, 353, 2897, 29889, 657, 6272, 703, 4051, 29918, 11889, 613, 2322, 543, 29949, 4590, 29903, 1159, 13, 4051, 29918, 25711, 17013, 353, 2897, 29889, 657, 6272, 703, 4051, 29918, 25711, 17013, 613, 2322, 543, 29966, 25711, 17013, 29958, 1159, 13, 13, 9965, 353, 6529, 29891, 9708, 29887, 29906, 29889, 6915, 29898, 13, 259, 4833, 978, 29922, 4051, 29918, 5813, 29892, 29871, 13, 259, 1404, 29922, 4051, 29918, 11889, 29892, 29871, 13, 259, 4800, 29922, 29966, 25711, 17013, 10202, 29871, 13, 259, 3495, 29922, 4051, 29918, 20832, 13, 29897, 13, 13, 18127, 353, 3957, 29889, 18127, 580, 13, 13, 18127, 29889, 7978, 877, 6404, 334, 515, 1708, 2057, 29936, 1495, 13, 13, 9902, 353, 10677, 29889, 9155, 497, 580, 13, 2158, 29898, 9902, 29897, 13, 13, 15945, 29908, 2277, 5531, 292, 411, 278, 364, 4061, 2566, 15945, 29908, 13, 13, 5215, 21120, 29941, 13, 5215, 11701, 408, 10518, 13, 13, 13, 13082, 353, 21120, 29941, 29889, 6915, 877, 29878, 4061, 29918, 2585, 313, 29896, 467, 22793, 29941, 1495, 13, 13, 2536, 29918, 18127, 353, 11009, 29889, 18127, 580, 13, 13, 2798, 353, 2243, 29918, 18127, 29889, 7978, 877, 6404, 21122, 22798, 3895, 2931, 1037, 1061, 29918, 18609, 29936, 2824, 9155, 497, 580, 13, 2798, 13, 13, 3090, 21706, 353, 2243, 29918, 18127, 29889, 7978, 877, 6404, 334, 3895, 2931, 1037, 1061, 29918, 18609, 2824, 9155, 497, 580, 13, 3090, 21706, 13, 13, 29937, 4013, 3697, 502, 278, 10938, 13, 13, 2536, 29918, 18127, 29889, 7978, 877, 29925, 4717, 29954, 1529, 1591, 29918, 3888, 29898, 18609, 1037, 1061, 29918, 18609, 416, 2824, 9155, 497, 580, 13, 13, 3258, 29918, 18609, 29918, 2371, 353, 14550, 13, 27045, 10911, 2931, 29918, 2371, 313, 13, 29871, 2931, 29918, 333, 26996, 25758, 29778, 14636, 29892, 13, 29871, 1024, 21748, 29898, 29896, 29900, 29900, 511, 13, 29871, 3233, 19578, 29892, 13, 29871, 1518, 19578, 29892, 13, 29871, 298, 29886, 19578, 29892, 13, 29871, 9324, 19578, 29892, 13, 29871, 21082, 19578, 29892, 13, 29871, 316, 23612, 537, 19578, 29892, 13, 29871, 29714, 19578, 13, 416, 13, 12008, 13, 13, 4061, 29918, 18127, 29889, 7978, 29898, 3258, 29918, 18609, 29918, 2371, 29897, 13, 13, 4061, 29918, 18127, 29889, 7978, 703, 19460, 11646, 2931, 29918, 2371, 15673, 313, 29896, 29892, 525, 29909, 28378, 333, 338, 371, 3523, 601, 337, 1654, 26464, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 2157, 1159, 13, 13, 1454, 2931, 297, 4890, 29901, 13, 29871, 1596, 703, 19460, 11646, 2931, 29918, 2371, 15673, 376, 718, 851, 29898, 18609, 29897, 718, 15300, 1495, 13, 13, 15945, 29908, 29937, 29911, 8929, 293, 3630, 363, 4007, 10194, 15945, 29908, 13, 13, 29991, 29893, 657, 525, 991, 597, 1610, 29889, 3292, 1792, 3051, 29889, 510, 29914, 1161, 29947, 29906, 29955, 29914, 8452, 29899, 8325, 29899, 29941, 29899, 29903, 2158, 29899, 29906, 29899, 4176, 29899, 392, 29899, 16390, 370, 2129, 29914, 6207, 29914, 5453, 29906, 29899, 2850, 29899, 1454, 29899, 15916, 29914, 29873, 8929, 293, 29889, 7638, 29915, 13, 13, 5215, 11701, 408, 10518, 13, 13, 2176, 29918, 29873, 8929, 293, 353, 10518, 29889, 949, 29918, 7638, 877, 991, 597, 1610, 29889, 3292, 1792, 3051, 29889, 510, 29914, 1161, 29947, 29906, 29955, 29914, 8452, 29899, 8325, 29899, 29941, 29899, 29903, 2158, 29899, 29906, 29899, 4176, 29899, 392, 29899, 16390, 370, 2129, 29914, 6207, 29914, 5453, 29906, 29899, 2850, 29899, 1454, 29899, 15916, 29914, 29873, 8929, 293, 29889, 7638, 1495, 13, 2176, 29918, 29873, 8929, 293, 29889, 12181, 13, 13, 13, 2176, 29918, 29873, 8929, 293, 29889, 13099, 29889, 25027, 391, 580, 13, 13, 2176, 29918, 29873, 8929, 293, 353, 4489, 29918, 29873, 8929, 293, 29889, 276, 2248, 29898, 13099, 353, 6024, 1170, 742, 525, 22406, 742, 525, 29903, 735, 742, 525, 29925, 1990, 742, 525, 29943, 598, 742, 525, 29903, 747, 18964, 29914, 5592, 23676, 319, 3377, 742, 525, 2177, 1237, 29914, 19334, 319, 3377, 742, 525, 18498, 29894, 2347, 11287, 13, 13, 13, 29937, 1576, 4341, 526, 1286, 297, 263, 7575, 1797, 4248, 13, 13, 15945, 29908, 2277, 15156, 21120, 29941, 411, 278, 323, 8929, 293, 848, 13, 13, 29937, 29950, 5555, 7458, 2805, 278, 4329, 273, 293, 2472, 304, 2254, 408, 263, 4833, 29973, 13, 15945, 29908, 13, 13, 13082, 353, 21120, 29941, 29889, 6915, 877, 29873, 8929, 293, 29889, 7638, 1495, 13, 13, 2034, 29918, 18127, 353, 11009, 29889, 18127, 580, 13, 13, 2798, 353, 19538, 29918, 18127, 29889, 7978, 877, 6404, 21122, 22798, 3895, 4408, 29936, 2824, 9155, 497, 580, 13, 2798, 13, 13, 2 ]
YouTube-PyQt5/09_radio_button.py
dloperab/Python-GUI
2
39693
import sys from PyQt5 import QtGui, QtCore from PyQt5.QtWidgets import QApplication, QDialog, QGroupBox, QVBoxLayout, QHBoxLayout, QRadioButton, QLabel class MainWindow(QDialog): def __init__(self): super().__init__() self.title = "PyQt5 Radio Button" self.top = 400 self.left = 200 self.width = 400 self.height = 150 self.icon_name = "images/home.png" self._init_window() def _init_window(self): self.setWindowIcon(QtGui.QIcon(self.icon_name)) self.setWindowTitle(self.title) self.setGeometry(self.left, self.top, self.width, self.height) self._create_ui_components() vbox = QVBoxLayout() vbox.addWidget(self.group_box) self.lbl_Info = QLabel(self) self.lbl_Info.setFont(QtGui.QFont("Sanserif", 15)) vbox.addWidget(self.lbl_Info) self.setLayout(vbox) self.show() def _create_ui_components(self): self.group_box = QGroupBox("What is your favorite sport?") self.group_box.setFont(QtGui.QFont("Sanserif", 13)) hbox_layout = QHBoxLayout() self.rdbtn_soccer = QRadioButton("Soccer") self.rdbtn_soccer.setIcon(QtGui.QIcon("images/soccer.png")) self.rdbtn_soccer.setIconSize(QtCore.QSize(30, 30)) self.rdbtn_soccer.setFont(QtGui.QFont("Sanserif", 13)) self.rdbtn_soccer.toggled.connect(self._on_radiobutton_checked) hbox_layout.addWidget(self.rdbtn_soccer) self.rdbtn_basketball = QRadioButton("Basketball") self.rdbtn_basketball.setIcon(QtGui.QIcon("images/basketball.png")) self.rdbtn_basketball.setIconSize(QtCore.QSize(30, 30)) self.rdbtn_basketball.setFont(QtGui.QFont("Sanserif", 13)) self.rdbtn_basketball.toggled.connect(self._on_radiobutton_checked) hbox_layout.addWidget(self.rdbtn_basketball) self.rdbtn_tennis = QRadioButton("Tennis") self.rdbtn_tennis.setIcon(QtGui.QIcon("images/tennis.png")) self.rdbtn_tennis.setIconSize(QtCore.QSize(30, 30)) self.rdbtn_tennis.setFont(QtGui.QFont("Sanserif", 13)) self.rdbtn_tennis.toggled.connect(self._on_radiobutton_checked) hbox_layout.addWidget(self.rdbtn_tennis) self.group_box.setLayout(hbox_layout) def _on_radiobutton_checked(self): rdbtn = self.sender() if rdbtn.isChecked(): self.lbl_Info.setText(f"Sport selected: {rdbtn.text()}") if __name__ == "__main__": app = QApplication(sys.argv) window = MainWindow() sys.exit(app.exec())
[ 1, 1053, 10876, 13, 13, 3166, 10772, 17303, 29945, 1053, 14705, 28707, 29892, 14705, 9203, 13, 3166, 10772, 17303, 29945, 29889, 17303, 8801, 29879, 1053, 660, 4873, 29892, 660, 7647, 29892, 660, 4782, 3313, 29892, 660, 29963, 3313, 3453, 29892, 660, 29950, 3313, 3453, 29892, 660, 21818, 3125, 29892, 660, 4775, 13, 13, 1990, 4241, 5907, 29898, 29984, 7647, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 3257, 353, 376, 19737, 17303, 29945, 9204, 11025, 29908, 13, 4706, 1583, 29889, 3332, 353, 29871, 29946, 29900, 29900, 13, 4706, 1583, 29889, 1563, 353, 29871, 29906, 29900, 29900, 13, 4706, 1583, 29889, 2103, 353, 29871, 29946, 29900, 29900, 13, 4706, 1583, 29889, 3545, 353, 29871, 29896, 29945, 29900, 13, 4706, 1583, 29889, 4144, 29918, 978, 353, 376, 8346, 29914, 5184, 29889, 2732, 29908, 13, 13, 4706, 1583, 3032, 2344, 29918, 7165, 580, 13, 13, 1678, 822, 903, 2344, 29918, 7165, 29898, 1311, 1125, 13, 4706, 1583, 29889, 842, 5907, 12492, 29898, 17303, 28707, 29889, 29984, 12492, 29898, 1311, 29889, 4144, 29918, 978, 876, 13, 4706, 1583, 29889, 842, 5907, 7030, 29898, 1311, 29889, 3257, 29897, 13, 4706, 1583, 29889, 842, 7999, 7843, 29898, 1311, 29889, 1563, 29892, 1583, 29889, 3332, 29892, 1583, 29889, 2103, 29892, 1583, 29889, 3545, 29897, 13, 13, 4706, 1583, 3032, 3258, 29918, 1481, 29918, 14036, 580, 13, 308, 13, 4706, 325, 1884, 353, 660, 29963, 3313, 3453, 580, 13, 4706, 325, 1884, 29889, 1202, 8801, 29898, 1311, 29889, 2972, 29918, 1884, 29897, 13, 13, 4706, 1583, 29889, 26648, 29918, 3401, 353, 660, 4775, 29898, 1311, 29897, 13, 4706, 1583, 29889, 26648, 29918, 3401, 29889, 842, 9824, 29898, 17303, 28707, 29889, 29984, 9824, 703, 29903, 550, 261, 361, 613, 29871, 29896, 29945, 876, 13, 4706, 325, 1884, 29889, 1202, 8801, 29898, 1311, 29889, 26648, 29918, 3401, 29897, 13, 308, 13, 4706, 1583, 29889, 842, 3453, 29898, 29894, 1884, 29897, 13, 308, 13, 4706, 1583, 29889, 4294, 580, 13, 13, 1678, 822, 903, 3258, 29918, 1481, 29918, 14036, 29898, 1311, 1125, 13, 4706, 1583, 29889, 2972, 29918, 1884, 353, 660, 4782, 3313, 703, 5618, 338, 596, 25448, 7980, 29973, 1159, 13, 4706, 1583, 29889, 2972, 29918, 1884, 29889, 842, 9824, 29898, 17303, 28707, 29889, 29984, 9824, 703, 29903, 550, 261, 361, 613, 29871, 29896, 29941, 876, 13, 308, 13, 4706, 298, 1884, 29918, 2680, 353, 660, 29950, 3313, 3453, 580, 13, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29879, 11953, 353, 660, 21818, 3125, 703, 29903, 11953, 1159, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29879, 11953, 29889, 842, 12492, 29898, 17303, 28707, 29889, 29984, 12492, 703, 8346, 29914, 29879, 11953, 29889, 2732, 5783, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29879, 11953, 29889, 842, 12492, 3505, 29898, 17303, 9203, 29889, 29984, 3505, 29898, 29941, 29900, 29892, 29871, 29941, 29900, 876, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29879, 11953, 29889, 842, 9824, 29898, 17303, 28707, 29889, 29984, 9824, 703, 29903, 550, 261, 361, 613, 29871, 29896, 29941, 876, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29879, 11953, 29889, 29873, 468, 29887, 839, 29889, 6915, 29898, 1311, 3032, 265, 29918, 13399, 3092, 29918, 11238, 29897, 13, 4706, 298, 1884, 29918, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29878, 2585, 6277, 29918, 29879, 11953, 29897, 13, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29890, 11852, 353, 660, 21818, 3125, 703, 29933, 11852, 1159, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29890, 11852, 29889, 842, 12492, 29898, 17303, 28707, 29889, 29984, 12492, 703, 8346, 29914, 29890, 11852, 29889, 2732, 5783, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29890, 11852, 29889, 842, 12492, 3505, 29898, 17303, 9203, 29889, 29984, 3505, 29898, 29941, 29900, 29892, 29871, 29941, 29900, 876, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29890, 11852, 29889, 842, 9824, 29898, 17303, 28707, 29889, 29984, 9824, 703, 29903, 550, 261, 361, 613, 29871, 29896, 29941, 876, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 29890, 11852, 29889, 29873, 468, 29887, 839, 29889, 6915, 29898, 1311, 3032, 265, 29918, 13399, 3092, 29918, 11238, 29897, 13, 4706, 298, 1884, 29918, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29878, 2585, 6277, 29918, 29890, 11852, 29897, 13, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 841, 6994, 353, 660, 21818, 3125, 703, 29911, 9517, 1159, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 841, 6994, 29889, 842, 12492, 29898, 17303, 28707, 29889, 29984, 12492, 703, 8346, 29914, 841, 6994, 29889, 2732, 5783, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 841, 6994, 29889, 842, 12492, 3505, 29898, 17303, 9203, 29889, 29984, 3505, 29898, 29941, 29900, 29892, 29871, 29941, 29900, 876, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 841, 6994, 29889, 842, 9824, 29898, 17303, 28707, 29889, 29984, 9824, 703, 29903, 550, 261, 361, 613, 29871, 29896, 29941, 876, 13, 4706, 1583, 29889, 29878, 2585, 6277, 29918, 841, 6994, 29889, 29873, 468, 29887, 839, 29889, 6915, 29898, 1311, 3032, 265, 29918, 13399, 3092, 29918, 11238, 29897, 13, 4706, 298, 1884, 29918, 2680, 29889, 1202, 8801, 29898, 1311, 29889, 29878, 2585, 6277, 29918, 841, 6994, 29897, 13, 308, 13, 4706, 1583, 29889, 2972, 29918, 1884, 29889, 842, 3453, 29898, 21368, 29918, 2680, 29897, 13, 13, 1678, 822, 903, 265, 29918, 13399, 3092, 29918, 11238, 29898, 1311, 1125, 13, 4706, 364, 2585, 6277, 353, 1583, 29889, 15452, 580, 13, 4706, 565, 364, 2585, 6277, 29889, 275, 17817, 7295, 13, 9651, 1583, 29889, 26648, 29918, 3401, 29889, 12038, 29898, 29888, 29908, 29903, 637, 4629, 29901, 426, 29878, 2585, 6277, 29889, 726, 580, 27195, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 623, 353, 660, 4873, 29898, 9675, 29889, 19218, 29897, 13, 1678, 3474, 353, 4241, 5907, 580, 13, 1678, 10876, 29889, 13322, 29898, 932, 29889, 4258, 3101, 2 ]
Backend_folder/models/socials.py
Miguel22247/MatchGame
0
123893
<reponame>Miguel22247/MatchGame<gh_stars>0 #!/usr/bin/python3.6 """Script to create an instance of the class Social""" from sqlalchemy import Column, String from models.base_model import Base, BaseModel class Social(BaseModel, Base): """Class to store the social data""" __tablename__ = "social" name = Column(String(20), nullable=False)
[ 1, 529, 276, 1112, 420, 29958, 29924, 335, 2491, 29906, 29906, 29906, 29946, 29955, 29914, 9652, 14199, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 29941, 29889, 29953, 13, 15945, 29908, 4081, 304, 1653, 385, 2777, 310, 278, 770, 10307, 15945, 29908, 13, 3166, 4576, 284, 305, 6764, 1053, 12481, 29892, 1714, 13, 3166, 4733, 29889, 3188, 29918, 4299, 1053, 7399, 29892, 7399, 3195, 13, 13, 13, 1990, 10307, 29898, 5160, 3195, 29892, 7399, 1125, 13, 1678, 9995, 2385, 304, 3787, 278, 5264, 848, 15945, 29908, 13, 1678, 4770, 3891, 2435, 420, 1649, 353, 376, 24911, 29908, 13, 1678, 1024, 353, 12481, 29898, 1231, 29898, 29906, 29900, 511, 1870, 519, 29922, 8824, 29897, 13, 2 ]
storage.py
eybisi/theFS
0
139105
import rpyc import uuid import os from rpyc.utils.server import ThreadedServer DATA_DIR = "/tmp/storage/" class StorageService(rpyc.Service): # exposed classes & methods ALIAES = ["storage"] def on_connect(self,conn): print("[+] Client Connected {}".format(conn._channel.stream.sock.getpeername())) def on_disconnect(self,conn): print("[+] Client Disconnected {}".format(conn._channel.stream.sock.getpeername())) class exposed_Storage(): blocks= {} def exposed_pull(self,uuid): data_addr = DATA_DIR+str(uuid) if not os.path.isfile(data_addr): print("[-] Block not found {}".format(uuid)) return None with open(data_addr) as f: return f.read() def exposed_push(self,data,storages,uuid): with open(DATA_DIR+str(uuid),'w') as f: print("[+] Writing data to {}".format(DATA_DIR+str(uuid))) f.write(data) if len(storages)>0: print("[~] Forwarding to other storages") self.forward(data,storages,uuid) def exposed_delete(self, uuid): if os.path.isfile(DATA_DIR+str(uuid)): print("[+] Removing {}".format(DATA_DIR+str(uuid))) os.remove(DATA_DIR+str(uuid)) def forward(self,data,storages,uuid): print "8888: forwarding to:" print uuid, storages storage = storages[0] storages = storages[1:] host,port = storage conn = rpyc.connect(host,port=port) storage = conn.root.Storage() storage.push(data,storages,uuid) if __name__ == "__main__": if not os.path.isdir(DATA_DIR): os.mkdir(DATA_DIR) t = ThreadedServer(StorageService, port = 8888) t.start()
[ 1, 1053, 364, 2272, 29883, 13, 5215, 318, 5416, 13, 5215, 2897, 13, 13, 3166, 364, 2272, 29883, 29889, 13239, 29889, 2974, 1053, 10480, 287, 6004, 13, 13, 14573, 29918, 9464, 353, 5591, 7050, 29914, 12925, 12975, 13, 13, 1990, 26162, 3170, 29898, 29878, 2272, 29883, 29889, 3170, 1125, 13, 1678, 396, 19884, 4413, 669, 3519, 13, 1678, 319, 5265, 29909, 2890, 353, 6796, 12925, 3108, 13, 1678, 822, 373, 29918, 6915, 29898, 1311, 29892, 13082, 1125, 13, 4706, 1596, 703, 29961, 29974, 29962, 12477, 1281, 484, 2954, 6571, 1642, 4830, 29898, 13082, 3032, 12719, 29889, 5461, 29889, 21852, 29889, 657, 412, 4510, 22130, 13, 1678, 822, 373, 29918, 2218, 6915, 29898, 1311, 29892, 13082, 1125, 13, 4706, 1596, 703, 29961, 29974, 29962, 12477, 3295, 18045, 6571, 1642, 4830, 29898, 13082, 3032, 12719, 29889, 5461, 29889, 21852, 29889, 657, 412, 4510, 22130, 13, 1678, 770, 19884, 29918, 10486, 7295, 13, 4706, 10930, 29922, 6571, 13, 4706, 822, 19884, 29918, 26746, 29898, 1311, 29892, 25118, 1125, 13, 9651, 848, 29918, 10030, 353, 360, 8254, 29918, 9464, 29974, 710, 29898, 25118, 29897, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 275, 1445, 29898, 1272, 29918, 10030, 1125, 13, 18884, 1596, 703, 14352, 29962, 15658, 451, 1476, 6571, 1642, 4830, 29898, 25118, 876, 13, 18884, 736, 6213, 13, 9651, 411, 1722, 29898, 1272, 29918, 10030, 29897, 408, 285, 29901, 13, 18884, 736, 285, 29889, 949, 580, 13, 4706, 822, 19884, 29918, 5910, 29898, 1311, 29892, 1272, 29892, 28957, 1179, 29892, 25118, 1125, 13, 9651, 411, 1722, 29898, 14573, 29918, 9464, 29974, 710, 29898, 25118, 511, 29915, 29893, 1495, 408, 285, 29901, 13, 18884, 1596, 703, 29961, 29974, 29962, 28676, 848, 304, 6571, 1642, 4830, 29898, 14573, 29918, 9464, 29974, 710, 29898, 25118, 4961, 13, 18884, 285, 29889, 3539, 29898, 1272, 29897, 13, 9651, 565, 7431, 29898, 28957, 1179, 15410, 29900, 29901, 13, 18884, 1596, 703, 29961, 30022, 29962, 1152, 1328, 292, 304, 916, 2840, 1179, 1159, 13, 18884, 1583, 29889, 11333, 29898, 1272, 29892, 28957, 1179, 29892, 25118, 29897, 13, 4706, 822, 19884, 29918, 8143, 29898, 1311, 29892, 318, 5416, 1125, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 14573, 29918, 9464, 29974, 710, 29898, 25118, 22164, 13, 18884, 1596, 703, 29961, 29974, 29962, 5240, 21081, 6571, 1642, 4830, 29898, 14573, 29918, 9464, 29974, 710, 29898, 25118, 4961, 13, 18884, 2897, 29889, 5992, 29898, 14573, 29918, 9464, 29974, 710, 29898, 25118, 876, 13, 4706, 822, 6375, 29898, 1311, 29892, 1272, 29892, 28957, 1179, 29892, 25118, 1125, 13, 9651, 1596, 376, 29947, 29947, 29947, 29947, 29901, 6375, 292, 304, 6160, 13, 9651, 1596, 318, 5416, 29892, 2840, 1179, 13, 9651, 8635, 353, 2840, 1179, 29961, 29900, 29962, 13, 9651, 2840, 1179, 353, 2840, 1179, 29961, 29896, 17531, 13, 632, 13, 9651, 3495, 29892, 637, 353, 8635, 13, 9651, 11009, 353, 364, 2272, 29883, 29889, 6915, 29898, 3069, 29892, 637, 29922, 637, 29897, 13, 9651, 8635, 353, 11009, 29889, 4632, 29889, 10486, 580, 13, 9651, 8635, 29889, 5910, 29898, 1272, 29892, 28957, 1179, 29892, 25118, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 14573, 29918, 9464, 1125, 2897, 29889, 11256, 3972, 29898, 14573, 29918, 9464, 29897, 13, 1678, 260, 353, 10480, 287, 6004, 29898, 10486, 3170, 29892, 2011, 353, 29871, 29947, 29947, 29947, 29947, 29897, 13, 1678, 260, 29889, 2962, 580, 13, 2 ]
app/controllers/web/admin/component.py
arxcdr/silverback
0
145068
""" Component Web Controller """ # Standard Library import os # Third Party Library from django.views import View from django.http import Http404 from django.shortcuts import render from django.utils.translation import gettext as _ # Local Library from app.modules.core.context import Context from app.modules.core.decorators import login_if_not_authenticated from app.modules.core.component import Component as ComponentModule class ComponentList(View): template_name = 'templates/admin/component/list.html' __context = Context() __component = ComponentModule() __correlation_id = None @login_if_not_authenticated def get(self, request): self.__correlation_id = request.META["X-Correlation-ID"] if "X-Correlation-ID" in request.META else "" self.__context.autoload_options() self.__context.autoload_user(request.user.id if request.user.is_authenticated else None) self.__context.push({ "page_title": _("Components · %s") % self.__context.get("app_name", os.getenv("APP_NAME", "Silverback")) }) return render(request, self.template_name, self.__context.get()) class ComponentAdd(View): template_name = 'templates/admin/component/add.html' __context = Context() __component = ComponentModule() __correlation_id = None @login_if_not_authenticated def get(self, request): self.__correlation_id = request.META["X-Correlation-ID"] if "X-Correlation-ID" in request.META else "" self.__context.autoload_options() self.__context.autoload_user(request.user.id if request.user.is_authenticated else None) self.__context.push({ "page_title": _("Add a Component · %s") % self.__context.get("app_name", os.getenv("APP_NAME", "Silverback")), "groups": self.__component.get_all_groups() }) return render(request, self.template_name, self.__context.get()) class ComponentEdit(View): template_name = 'templates/admin/component/edit.html' __context = Context() __component = ComponentModule() __correlation_id = None @login_if_not_authenticated def get(self, request, component_id): self.__correlation_id = request.META["X-Correlation-ID"] if "X-Correlation-ID" in request.META else "" component = self.__component.get_one_by_id(component_id) if not component: raise Http404("Component not found.") self.__context.autoload_options() self.__context.autoload_user(request.user.id if request.user.is_authenticated else None) self.__context.push({ "page_title": _("Edit Component · %s") % self.__context.get("app_name", os.getenv("APP_NAME", "Silverback")), "component": component, "groups": self.__component.get_all_groups() }) return render(request, self.template_name, self.__context.get())
[ 1, 9995, 13, 5308, 2563, 15830, 13, 15945, 29908, 13, 13, 29937, 10117, 9538, 13, 5215, 2897, 13, 13, 29937, 18008, 9173, 9538, 13, 3166, 9557, 29889, 7406, 1053, 4533, 13, 3166, 9557, 29889, 1124, 1053, 9056, 29946, 29900, 29946, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 679, 726, 408, 903, 13, 13, 29937, 9959, 9538, 13, 3166, 623, 29889, 7576, 29889, 3221, 29889, 4703, 1053, 15228, 13, 3166, 623, 29889, 7576, 29889, 3221, 29889, 19557, 4097, 1053, 6464, 29918, 361, 29918, 1333, 29918, 27218, 630, 13, 3166, 623, 29889, 7576, 29889, 3221, 29889, 9700, 1053, 15924, 408, 15924, 7355, 13, 13, 13, 1990, 15924, 1293, 29898, 1043, 1125, 13, 13, 1678, 4472, 29918, 978, 353, 525, 20943, 29914, 6406, 29914, 9700, 29914, 1761, 29889, 1420, 29915, 13, 1678, 4770, 4703, 353, 15228, 580, 13, 1678, 4770, 9700, 353, 15924, 7355, 580, 13, 1678, 4770, 2616, 23445, 29918, 333, 353, 6213, 13, 13, 1678, 732, 7507, 29918, 361, 29918, 1333, 29918, 27218, 630, 13, 1678, 822, 679, 29898, 1311, 29892, 2009, 1125, 13, 13, 4706, 1583, 17255, 2616, 23445, 29918, 333, 353, 2009, 29889, 2303, 6040, 3366, 29990, 29899, 12521, 23445, 29899, 1367, 3108, 565, 376, 29990, 29899, 12521, 23445, 29899, 1367, 29908, 297, 2009, 29889, 2303, 6040, 1683, 5124, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 6768, 580, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 1792, 29898, 3827, 29889, 1792, 29889, 333, 565, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 1683, 6213, 29897, 13, 4706, 1583, 17255, 4703, 29889, 5910, 3319, 13, 9651, 376, 3488, 29918, 3257, 1115, 903, 703, 25503, 2880, 1273, 29879, 1159, 1273, 1583, 17255, 4703, 29889, 657, 703, 932, 29918, 978, 613, 2897, 29889, 657, 6272, 703, 20576, 29918, 5813, 613, 376, 26729, 369, 1627, 5783, 13, 4706, 5615, 13, 13, 4706, 736, 4050, 29898, 3827, 29892, 1583, 29889, 6886, 29918, 978, 29892, 1583, 17255, 4703, 29889, 657, 3101, 13, 13, 13, 1990, 15924, 2528, 29898, 1043, 1125, 13, 13, 1678, 4472, 29918, 978, 353, 525, 20943, 29914, 6406, 29914, 9700, 29914, 1202, 29889, 1420, 29915, 13, 1678, 4770, 4703, 353, 15228, 580, 13, 1678, 4770, 9700, 353, 15924, 7355, 580, 13, 1678, 4770, 2616, 23445, 29918, 333, 353, 6213, 13, 13, 1678, 732, 7507, 29918, 361, 29918, 1333, 29918, 27218, 630, 13, 1678, 822, 679, 29898, 1311, 29892, 2009, 1125, 13, 13, 4706, 1583, 17255, 2616, 23445, 29918, 333, 353, 2009, 29889, 2303, 6040, 3366, 29990, 29899, 12521, 23445, 29899, 1367, 3108, 565, 376, 29990, 29899, 12521, 23445, 29899, 1367, 29908, 297, 2009, 29889, 2303, 6040, 1683, 5124, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 6768, 580, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 1792, 29898, 3827, 29889, 1792, 29889, 333, 565, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 1683, 6213, 29897, 13, 4706, 1583, 17255, 4703, 29889, 5910, 3319, 13, 9651, 376, 3488, 29918, 3257, 1115, 903, 703, 2528, 263, 15924, 2880, 1273, 29879, 1159, 1273, 1583, 17255, 4703, 29889, 657, 703, 932, 29918, 978, 613, 2897, 29889, 657, 6272, 703, 20576, 29918, 5813, 613, 376, 26729, 369, 1627, 1159, 511, 13, 9651, 376, 13155, 1115, 1583, 17255, 9700, 29889, 657, 29918, 497, 29918, 13155, 580, 13, 4706, 5615, 13, 13, 4706, 736, 4050, 29898, 3827, 29892, 1583, 29889, 6886, 29918, 978, 29892, 1583, 17255, 4703, 29889, 657, 3101, 13, 13, 13, 1990, 15924, 6103, 29898, 1043, 1125, 13, 13, 1678, 4472, 29918, 978, 353, 525, 20943, 29914, 6406, 29914, 9700, 29914, 5628, 29889, 1420, 29915, 13, 1678, 4770, 4703, 353, 15228, 580, 13, 1678, 4770, 9700, 353, 15924, 7355, 580, 13, 1678, 4770, 2616, 23445, 29918, 333, 353, 6213, 13, 13, 1678, 732, 7507, 29918, 361, 29918, 1333, 29918, 27218, 630, 13, 1678, 822, 679, 29898, 1311, 29892, 2009, 29892, 4163, 29918, 333, 1125, 13, 13, 4706, 1583, 17255, 2616, 23445, 29918, 333, 353, 2009, 29889, 2303, 6040, 3366, 29990, 29899, 12521, 23445, 29899, 1367, 3108, 565, 376, 29990, 29899, 12521, 23445, 29899, 1367, 29908, 297, 2009, 29889, 2303, 6040, 1683, 5124, 13, 4706, 4163, 353, 1583, 17255, 9700, 29889, 657, 29918, 650, 29918, 1609, 29918, 333, 29898, 9700, 29918, 333, 29897, 13, 13, 4706, 565, 451, 4163, 29901, 13, 9651, 12020, 9056, 29946, 29900, 29946, 703, 5308, 451, 1476, 23157, 13, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 6768, 580, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 1792, 29898, 3827, 29889, 1792, 29889, 333, 565, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 1683, 6213, 29897, 13, 4706, 1583, 17255, 4703, 29889, 5910, 3319, 13, 9651, 376, 3488, 29918, 3257, 1115, 903, 703, 6103, 15924, 2880, 1273, 29879, 1159, 1273, 1583, 17255, 4703, 29889, 657, 703, 932, 29918, 978, 613, 2897, 29889, 657, 6272, 703, 20576, 29918, 5813, 613, 376, 26729, 369, 1627, 1159, 511, 13, 9651, 376, 9700, 1115, 4163, 29892, 13, 9651, 376, 13155, 1115, 1583, 17255, 9700, 29889, 657, 29918, 497, 29918, 13155, 580, 13, 4706, 5615, 13, 13, 4706, 736, 4050, 29898, 3827, 29892, 1583, 29889, 6886, 29918, 978, 29892, 1583, 17255, 4703, 29889, 657, 3101, 13, 2 ]
pyPowerCLI/__init__.py
arielsafari/pyPowerCLI
0
120604
from .install import is_installed from .install import install_powercli from .install import uninstall_powercli from .powershell import Powershell from .powershell import PowershellException __version__ = "0.0.1"
[ 1, 29871, 13, 3166, 869, 6252, 1053, 338, 29918, 25537, 13, 3166, 869, 6252, 1053, 2601, 29918, 13519, 11303, 13, 3166, 869, 6252, 1053, 27608, 29918, 13519, 11303, 13, 3166, 869, 12248, 27456, 1053, 12265, 27456, 13, 3166, 869, 12248, 27456, 1053, 12265, 27456, 2451, 13, 13, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29900, 29889, 29896, 29908, 2 ]
src/lib/utils/matching.py
jfparentledartech/DEFT
0
172598
<filename>src/lib/utils/matching.py<gh_stars>0 import lap import numpy as np import scipy from cython_bbox import bbox_overlaps as bbox_ious from scipy.spatial.distance import cdist from lib.utils.tracking_utils import kalman_filter import os.path, copy from scipy.spatial import ConvexHull # This function is taken from : https://github.com/Zhongdao/Towards-Realtime-MOT/blob/master/tracker/matching.py def merge_matches(m1, m2, shape): O, P, Q = shape m1 = np.asarray(m1) m2 = np.asarray(m2) M1 = scipy.sparse.coo_matrix((np.ones(len(m1)), (m1[:, 0], m1[:, 1])), shape=(O, P)) M2 = scipy.sparse.coo_matrix((np.ones(len(m2)), (m2[:, 0], m2[:, 1])), shape=(P, Q)) mask = M1 * M2 match = mask.nonzero() match = list(zip(match[0], match[1])) unmatched_O = tuple(set(range(O)) - set([i for i, j in match])) unmatched_Q = tuple(set(range(Q)) - set([j for i, j in match])) return match, unmatched_O, unmatched_Q def _indices_to_matches(cost_matrix, indices, thresh): matched_cost = cost_matrix[tuple(zip(*indices))] matched_mask = matched_cost <= thresh matches = indices[matched_mask] unmatched_a = tuple(set(range(cost_matrix.shape[0])) - set(matches[:, 0])) unmatched_b = tuple(set(range(cost_matrix.shape[1])) - set(matches[:, 1])) return matches, unmatched_a, unmatched_b # This function is taken from : https://github.com/Zhongdao/Towards-Realtime-MOT/blob/master/tracker/matching.py def linear_assignment(cost_matrix, thresh): if cost_matrix.size == 0: return ( np.empty((0, 2), dtype=int), tuple(range(cost_matrix.shape[0])), tuple(range(cost_matrix.shape[1])), ) matches, unmatched_a, unmatched_b = [], [], [] cost, x, y = lap.lapjv(cost_matrix, extend_cost=True, cost_limit=thresh) for ix, mx in enumerate(x): if mx >= 0: matches.append([ix, mx]) unmatched_a = np.where(x < 0)[0] unmatched_b = np.where(y < 0)[0] matches = np.asarray(matches) return matches, unmatched_a, unmatched_b # This function is taken from : https://github.com/Zhongdao/Towards-Realtime-MOT/blob/master/tracker/matching.py def ious(atlbrs, btlbrs): """ Compute cost based on IoU :type atlbrs: list[tlbr] | np.ndarray :type atlbrs: list[tlbr] | np.ndarray :rtype ious np.ndarray """ ious = np.zeros((len(atlbrs), len(btlbrs)), dtype=np.float) if ious.size == 0: return ious ious = bbox_ious( np.ascontiguousarray(atlbrs, dtype=np.float), np.ascontiguousarray(btlbrs, dtype=np.float), ) return ious # Part of this function is taken from : https://github.com/Zhongdao/Towards-Realtime-MOT/blob/master/tracker/matching.py def iou_distance(atracks, btracks, frame_id=0, use_prediction=True): """ Compute cost based on IoU :type atracks: list[STrack] :type btracks: list[STrack] :rtype cost_matrix np.ndarray """ if (len(atracks) > 0 and isinstance(atracks[0], np.ndarray)) or ( len(btracks) > 0 and isinstance(btracks[0], np.ndarray) ): atlbrs = atracks btlbrs = btracks else: if use_prediction: atlbrs = [track.prediction_at_frame_tlbr(frame_id) for track in atracks] else: atlbrs = [track.tlbr for track in atracks] btlbrs = [track.tlbr for track in btracks] _ious = ious(atlbrs, btlbrs) cost_matrix = 1 - _ious return cost_matrix def iou_ddd_distance(atracks, btracks, frame_id=0, use_prediction=True): """ Compute cost based on IoU :type atracks: list[STrack] :type btracks: list[STrack] :rtype cost_matrix np.ndarray """ if (len(atracks) > 0 and isinstance(atracks[0], np.ndarray)) or ( len(btracks) > 0 and isinstance(btracks[0], np.ndarray) ): atlbrs = atracks btlbrs = btracks else: atlbrs = [convert_3dbox_to_8corner(track.ddd_bbox) for track in atracks] btlbrs = [convert_3dbox_to_8corner(track.ddd_bbox) for track in btracks] iou_matrix = np.zeros((len(atlbrs), len(btlbrs)), dtype=np.float32) if iou_matrix.size == 0: return iou_matrix for d, det in enumerate(btlbrs): for t, trk in enumerate(atlbrs): iou_matrix[t, d] = iou3d(det, trk)[0] # det: 8 x 3, trk: 8 x 3 iou_matrix = 1 - iou_matrix return iou_matrix def poly_area(x, y): return 0.5 * np.abs(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1))) def box3d_vol(corners): """ corners: (8,3) no assumption on axis direction """ a = np.sqrt(np.sum((corners[0, :] - corners[1, :]) ** 2)) b = np.sqrt(np.sum((corners[1, :] - corners[2, :]) ** 2)) c = np.sqrt(np.sum((corners[0, :] - corners[4, :]) ** 2)) return a * b * c def convex_hull_intersection(p1, p2): """ Compute area of two convex hull's intersection area. p1,p2 are a list of (x,y) tuples of hull vertices. return a list of (x,y) for the intersection and its volume """ inter_p = polygon_clip(p1, p2) if inter_p is not None: hull_inter = ConvexHull(inter_p) return inter_p, hull_inter.volume else: return None, 0.0 def polygon_clip(subjectPolygon, clipPolygon): """ Clip a polygon with another polygon. Args: subjectPolygon: a list of (x,y) 2d points, any polygon. clipPolygon: a list of (x,y) 2d points, has to be *convex* Note: **points have to be counter-clockwise ordered** Return: a list of (x,y) vertex point for the intersection polygon. """ def inside(p): return (cp2[0] - cp1[0]) * (p[1] - cp1[1]) > (cp2[1] - cp1[1]) * (p[0] - cp1[0]) def computeIntersection(): dc = [cp1[0] - cp2[0], cp1[1] - cp2[1]] dp = [s[0] - e[0], s[1] - e[1]] n1 = cp1[0] * cp2[1] - cp1[1] * cp2[0] n2 = s[0] * e[1] - s[1] * e[0] n3 = 1.0 / (dc[0] * dp[1] - dc[1] * dp[0]) return [(n1 * dp[0] - n2 * dc[0]) * n3, (n1 * dp[1] - n2 * dc[1]) * n3] outputList = subjectPolygon cp1 = clipPolygon[-1] for clipVertex in clipPolygon: cp2 = clipVertex inputList = outputList outputList = [] s = inputList[-1] for subjectVertex in inputList: e = subjectVertex if inside(e): if not inside(s): outputList.append(computeIntersection()) outputList.append(e) elif inside(s): outputList.append(computeIntersection()) s = e cp1 = cp2 if len(outputList) == 0: return None return outputList def convert_3dbox_to_8corner(bbox3d_input): # compute rotational matrix around yaw axis bbox3d = copy.copy(bbox3d_input) # transform to kitti format first bbox3d_nuscenes = copy.copy(bbox3d) # kitti: [x, y, z, a, l, w, h] bbox3d[0] = bbox3d_nuscenes[3] bbox3d[1] = bbox3d_nuscenes[4] bbox3d[2] = bbox3d_nuscenes[5] bbox3d[3] = bbox3d_nuscenes[-1] bbox3d[4] = bbox3d_nuscenes[2] bbox3d[5] = bbox3d_nuscenes[1] bbox3d[6] = bbox3d_nuscenes[0] R = roty(bbox3d[3]) # 3d bounding box dimensions l = bbox3d[4] w = bbox3d[5] h = bbox3d[6] # 3d bounding box corners x_corners = [l / 2, l / 2, -l / 2, -l / 2, l / 2, l / 2, -l / 2, -l / 2] y_corners = [0, 0, 0, 0, -h, -h, -h, -h] z_corners = [w / 2, -w / 2, -w / 2, w / 2, w / 2, -w / 2, -w / 2, w / 2] # rotate and translate 3d bounding box corners_3d = np.dot(R, np.vstack([x_corners, y_corners, z_corners])) corners_3d[0, :] = corners_3d[0, :] + bbox3d[0] corners_3d[1, :] = corners_3d[1, :] + bbox3d[1] corners_3d[2, :] = corners_3d[2, :] + bbox3d[2] return np.transpose(corners_3d) def roty(t): """ Rotation about the y-axis. """ c = np.cos(t) s = np.sin(t) return np.array([[c, 0, s], [0, 1, 0], [-s, 0, c]]) def iou3d(corners1, corners2): """ Compute 3D bounding box IoU. Input: corners1: numpy array (8,3), assume up direction is negative Y corners2: numpy array (8,3), assume up direction is negative Y Output: iou: 3D bounding box IoU iou_2d: bird's eye view 2D bounding box IoU """ # corner points are in counter clockwise order rect1 = [(corners1[i, 0], corners1[i, 2]) for i in range(3, -1, -1)] rect2 = [(corners2[i, 0], corners2[i, 2]) for i in range(3, -1, -1)] area1 = poly_area(np.array(rect1)[:, 0], np.array(rect1)[:, 1]) area2 = poly_area(np.array(rect2)[:, 0], np.array(rect2)[:, 1]) inter, inter_area = convex_hull_intersection(rect1, rect2) iou_2d = inter_area / (area1 + area2 - inter_area) ymax = min(corners1[0, 1], corners2[0, 1]) ymin = max(corners1[4, 1], corners2[4, 1]) inter_vol = inter_area * max(0.0, ymax - ymin) vol1 = box3d_vol(corners1) vol2 = box3d_vol(corners2) iou = inter_vol / (vol1 + vol2 - inter_vol) return iou, iou_2d def embedding_distance(tracks, detections, metric="cosine"): """ :param tracks: list[STrack] :param detections: list[BaseTrack] :param metric: :return: cost_matrix np.ndarray """ cost_matrix = np.zeros((len(tracks), len(detections)), dtype=np.float) if cost_matrix.size == 0: return cost_matrix det_features = np.asarray([track.curr_feat for track in detections], dtype=np.float) track_features = np.asarray([track.smooth_feat for track in tracks], dtype=np.float) cost_matrix = np.maximum( 0.0, cdist(track_features, det_features, metric) ) # Nomalized features return cost_matrix def gate_cost_matrix(kf, cost_matrix, tracks, detections, only_position=True): if cost_matrix.size == 0: return cost_matrix gating_dim = 2 if only_position else 4 gating_threshold = kalman_filter.chi2inv95[gating_dim] measurements = np.asarray([det.to_xyah() for det in detections]) for row, track in enumerate(tracks): gating_distance = kf.gating_distance( track.mean, track.covariance, measurements, only_position ) cost_matrix[row, gating_distance > (gating_threshold + 10)] = np.inf return cost_matrix # Part of this function is taken from : https://github.com/Zhongdao/Towards-Realtime-MOT/blob/master/tracker/matching.py def fuse_motion( kf, cost_matrix, tracks, detections, frame_id, use_lstm=True, only_position=True, lambda_=0.9, ): if cost_matrix.size == 0: return cost_matrix gating_dim = 2 if only_position else 4 gating_threshold = kalman_filter.chi2inv95[gating_dim] if not use_lstm: measurements = np.asarray([det.to_xyah() for det in detections]) for row, track in enumerate(tracks): gating_distance = kf.gating_distance( track.mean, track.covariance, measurements, only_position, metric="maha" ) cost_matrix[row, gating_distance > 5.0 * gating_threshold] = np.inf cost_matrix[row] = ( lambda_ * cost_matrix[row] + 0.05 * (1 - lambda_) * gating_distance ) else: measurements = np.asarray([det.to_xyah() for det in detections]) for row, track in enumerate(tracks): if len(track.observations) >= 300: gating_distance = kf.gating_distance( track.prediction_at_frame(frame_id), track.covariance, measurements, only_position, metric="maha", ) cost_matrix[row, gating_distance > 5.0 * gating_threshold] = np.inf cost_matrix[row] = ( lambda_ * cost_matrix[row] + 0.05 * (1 - lambda_) * gating_distance ) else: gating_distance = kf.gating_distance( track.prediction_at_frame(frame_id), track.covariance, measurements, only_position, metric="gaussian", ) cost_matrix[row, gating_distance > 50] = np.inf cost_matrix[row] = ( lambda_ * cost_matrix[row] + 0.0005 * (1 - lambda_) * gating_distance ) return cost_matrix def fuse_motion_ddd( kf, cost_matrix, tracks, detections, frame_id, use_lstm=True, only_position=False, lambda_=0.9, use_prediction=False, classe_name=None, ): if cost_matrix.size == 0: return cost_matrix gating_dim = 7 gating_threshold = kalman_filter.chi2inv95[gating_dim] measurements = np.asarray([det.ddd_bbox for det in detections]) for row, track in enumerate(tracks): if use_prediction: gating_distance = kf.gating_distance( track.ddd_prediction_at_frame(frame_id), track.covariance, measurements, only_position, metric="gaussian", ) else: gating_distance = kf.gating_distance( track.ddd_bbox, track.covariance, measurements, only_position, metric="gaussian", ) thr = 0.2 * track.depth if classe_name == "pedestrian": if thr < 5: thr = 5 else: if thr < 10: thr = 10 cost_matrix[row, gating_distance > thr] = np.inf cost_matrix[row] = lambda_ * cost_matrix[row] + 0.001 * gating_distance return cost_matrix
[ 1, 529, 9507, 29958, 4351, 29914, 1982, 29914, 13239, 29914, 4352, 292, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 23012, 13, 5215, 12655, 408, 7442, 13, 5215, 4560, 2272, 13, 3166, 274, 1656, 29918, 29890, 1884, 1053, 289, 1884, 29918, 957, 14128, 408, 289, 1884, 29918, 2738, 13, 3166, 4560, 2272, 29889, 1028, 15238, 29889, 19244, 1053, 274, 5721, 13, 3166, 4303, 29889, 13239, 29889, 11294, 292, 29918, 13239, 1053, 25364, 1171, 29918, 4572, 13, 5215, 2897, 29889, 2084, 29892, 3509, 13, 3166, 4560, 2272, 29889, 1028, 15238, 1053, 1281, 13809, 29950, 913, 13, 13, 29937, 910, 740, 338, 4586, 515, 584, 2045, 597, 3292, 29889, 510, 29914, 29999, 29882, 549, 1388, 29877, 29914, 29911, 340, 3163, 29899, 1123, 1997, 603, 29899, 29924, 2891, 29914, 10054, 29914, 6207, 29914, 3018, 4937, 29914, 4352, 292, 29889, 2272, 13, 1753, 10366, 29918, 20317, 29898, 29885, 29896, 29892, 286, 29906, 29892, 8267, 1125, 13, 1678, 438, 29892, 349, 29892, 660, 353, 8267, 13, 1678, 286, 29896, 353, 7442, 29889, 294, 2378, 29898, 29885, 29896, 29897, 13, 1678, 286, 29906, 353, 7442, 29889, 294, 2378, 29898, 29885, 29906, 29897, 13, 13, 1678, 341, 29896, 353, 4560, 2272, 29889, 29879, 5510, 29889, 1111, 29877, 29918, 5344, 3552, 9302, 29889, 2873, 29898, 2435, 29898, 29885, 29896, 8243, 313, 29885, 29896, 7503, 29892, 29871, 29900, 1402, 286, 29896, 7503, 29892, 29871, 29896, 2314, 511, 8267, 7607, 29949, 29892, 349, 876, 13, 1678, 341, 29906, 353, 4560, 2272, 29889, 29879, 5510, 29889, 1111, 29877, 29918, 5344, 3552, 9302, 29889, 2873, 29898, 2435, 29898, 29885, 29906, 8243, 313, 29885, 29906, 7503, 29892, 29871, 29900, 1402, 286, 29906, 7503, 29892, 29871, 29896, 2314, 511, 8267, 7607, 29925, 29892, 660, 876, 13, 13, 1678, 11105, 353, 341, 29896, 334, 341, 29906, 13, 1678, 1993, 353, 11105, 29889, 5464, 9171, 580, 13, 1678, 1993, 353, 1051, 29898, 7554, 29898, 4352, 29961, 29900, 1402, 1993, 29961, 29896, 12622, 13, 1678, 443, 4352, 287, 29918, 29949, 353, 18761, 29898, 842, 29898, 3881, 29898, 29949, 876, 448, 731, 4197, 29875, 363, 474, 29892, 432, 297, 1993, 12622, 13, 1678, 443, 4352, 287, 29918, 29984, 353, 18761, 29898, 842, 29898, 3881, 29898, 29984, 876, 448, 731, 4197, 29926, 363, 474, 29892, 432, 297, 1993, 12622, 13, 13, 1678, 736, 1993, 29892, 443, 4352, 287, 29918, 29949, 29892, 443, 4352, 287, 29918, 29984, 13, 13, 13, 1753, 903, 513, 1575, 29918, 517, 29918, 20317, 29898, 18253, 29918, 5344, 29892, 16285, 29892, 266, 3781, 1125, 13, 1678, 19228, 29918, 18253, 353, 3438, 29918, 5344, 29961, 23583, 29898, 7554, 10456, 513, 1575, 28166, 13, 1678, 19228, 29918, 13168, 353, 19228, 29918, 18253, 5277, 266, 3781, 13, 13, 1678, 7087, 353, 16285, 29961, 4352, 287, 29918, 13168, 29962, 13, 1678, 443, 4352, 287, 29918, 29874, 353, 18761, 29898, 842, 29898, 3881, 29898, 18253, 29918, 5344, 29889, 12181, 29961, 29900, 12622, 448, 731, 29898, 20317, 7503, 29892, 29871, 29900, 12622, 13, 1678, 443, 4352, 287, 29918, 29890, 353, 18761, 29898, 842, 29898, 3881, 29898, 18253, 29918, 5344, 29889, 12181, 29961, 29896, 12622, 448, 731, 29898, 20317, 7503, 29892, 29871, 29896, 12622, 13, 13, 1678, 736, 7087, 29892, 443, 4352, 287, 29918, 29874, 29892, 443, 4352, 287, 29918, 29890, 13, 13, 13, 29937, 910, 740, 338, 4586, 515, 584, 2045, 597, 3292, 29889, 510, 29914, 29999, 29882, 549, 1388, 29877, 29914, 29911, 340, 3163, 29899, 1123, 1997, 603, 29899, 29924, 2891, 29914, 10054, 29914, 6207, 29914, 3018, 4937, 29914, 4352, 292, 29889, 2272, 13, 1753, 5608, 29918, 465, 10194, 29898, 18253, 29918, 5344, 29892, 266, 3781, 1125, 13, 1678, 565, 3438, 29918, 5344, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 313, 13, 9651, 7442, 29889, 6310, 3552, 29900, 29892, 29871, 29906, 511, 26688, 29922, 524, 511, 13, 9651, 18761, 29898, 3881, 29898, 18253, 29918, 5344, 29889, 12181, 29961, 29900, 2314, 511, 13, 9651, 18761, 29898, 3881, 29898, 18253, 29918, 5344, 29889, 12181, 29961, 29896, 2314, 511, 13, 4706, 1723, 13, 1678, 7087, 29892, 443, 4352, 287, 29918, 29874, 29892, 443, 4352, 287, 29918, 29890, 353, 19997, 19997, 5159, 13, 1678, 3438, 29892, 921, 29892, 343, 353, 23012, 29889, 6984, 29926, 29894, 29898, 18253, 29918, 5344, 29892, 10985, 29918, 18253, 29922, 5574, 29892, 3438, 29918, 13400, 29922, 386, 3781, 29897, 13, 1678, 363, 474, 29916, 29892, 286, 29916, 297, 26985, 29898, 29916, 1125, 13, 4706, 565, 286, 29916, 6736, 29871, 29900, 29901, 13, 9651, 7087, 29889, 4397, 4197, 861, 29892, 286, 29916, 2314, 13, 1678, 443, 4352, 287, 29918, 29874, 353, 7442, 29889, 3062, 29898, 29916, 529, 29871, 29900, 9601, 29900, 29962, 13, 1678, 443, 4352, 287, 29918, 29890, 353, 7442, 29889, 3062, 29898, 29891, 529, 29871, 29900, 9601, 29900, 29962, 13, 1678, 7087, 353, 7442, 29889, 294, 2378, 29898, 20317, 29897, 13, 1678, 736, 7087, 29892, 443, 4352, 287, 29918, 29874, 29892, 443, 4352, 287, 29918, 29890, 13, 13, 13, 29937, 910, 740, 338, 4586, 515, 584, 2045, 597, 3292, 29889, 510, 29914, 29999, 29882, 549, 1388, 29877, 29914, 29911, 340, 3163, 29899, 1123, 1997, 603, 29899, 29924, 2891, 29914, 10054, 29914, 6207, 29914, 3018, 4937, 29914, 4352, 292, 29889, 2272, 13, 1753, 474, 681, 29898, 271, 29880, 1182, 29879, 29892, 289, 15206, 1182, 29879, 1125, 13, 1678, 9995, 13, 1678, 11796, 29872, 3438, 2729, 373, 22244, 29965, 13, 1678, 584, 1853, 472, 29880, 1182, 29879, 29901, 1051, 29961, 15206, 1182, 29962, 891, 7442, 29889, 299, 2378, 13, 1678, 584, 1853, 472, 29880, 1182, 29879, 29901, 1051, 29961, 15206, 1182, 29962, 891, 7442, 29889, 299, 2378, 13, 13, 1678, 584, 29878, 1853, 474, 681, 7442, 29889, 299, 2378, 13, 1678, 9995, 13, 1678, 474, 681, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 271, 29880, 1182, 29879, 511, 7431, 29898, 3116, 29880, 1182, 29879, 8243, 26688, 29922, 9302, 29889, 7411, 29897, 13, 1678, 565, 474, 681, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 474, 681, 13, 13, 1678, 474, 681, 353, 289, 1884, 29918, 2738, 29898, 13, 4706, 7442, 29889, 294, 1285, 5526, 681, 2378, 29898, 271, 29880, 1182, 29879, 29892, 26688, 29922, 9302, 29889, 7411, 511, 13, 4706, 7442, 29889, 294, 1285, 5526, 681, 2378, 29898, 3116, 29880, 1182, 29879, 29892, 26688, 29922, 9302, 29889, 7411, 511, 13, 1678, 1723, 13, 13, 1678, 736, 474, 681, 13, 13, 13, 29937, 3455, 310, 445, 740, 338, 4586, 515, 584, 2045, 597, 3292, 29889, 510, 29914, 29999, 29882, 549, 1388, 29877, 29914, 29911, 340, 3163, 29899, 1123, 1997, 603, 29899, 29924, 2891, 29914, 10054, 29914, 6207, 29914, 3018, 4937, 29914, 4352, 292, 29889, 2272, 13, 1753, 474, 283, 29918, 19244, 29898, 16546, 4684, 29892, 289, 3018, 4684, 29892, 3515, 29918, 333, 29922, 29900, 29892, 671, 29918, 11965, 2463, 29922, 5574, 1125, 13, 1678, 9995, 13, 1678, 11796, 29872, 3438, 2729, 373, 22244, 29965, 13, 1678, 584, 1853, 472, 336, 4684, 29901, 1051, 29961, 1254, 22282, 29962, 13, 1678, 584, 1853, 289, 3018, 4684, 29901, 1051, 29961, 1254, 22282, 29962, 13, 13, 1678, 584, 29878, 1853, 3438, 29918, 5344, 7442, 29889, 299, 2378, 13, 1678, 9995, 13, 13, 1678, 565, 313, 2435, 29898, 16546, 4684, 29897, 1405, 29871, 29900, 322, 338, 8758, 29898, 16546, 4684, 29961, 29900, 1402, 7442, 29889, 299, 2378, 876, 470, 313, 13, 4706, 7431, 29898, 29890, 3018, 4684, 29897, 1405, 29871, 29900, 322, 338, 8758, 29898, 29890, 3018, 4684, 29961, 29900, 1402, 7442, 29889, 299, 2378, 29897, 13, 268, 1125, 13, 4706, 472, 29880, 1182, 29879, 353, 472, 336, 4684, 13, 4706, 289, 15206, 1182, 29879, 353, 289, 3018, 4684, 13, 1678, 1683, 29901, 13, 4706, 565, 671, 29918, 11965, 2463, 29901, 13, 13, 9651, 472, 29880, 1182, 29879, 353, 518, 11294, 29889, 11965, 2463, 29918, 271, 29918, 2557, 29918, 15206, 1182, 29898, 2557, 29918, 333, 29897, 363, 5702, 297, 472, 336, 4684, 29962, 13, 4706, 1683, 29901, 13, 9651, 472, 29880, 1182, 29879, 353, 518, 11294, 29889, 15206, 1182, 363, 5702, 297, 472, 336, 4684, 29962, 13, 4706, 289, 15206, 1182, 29879, 353, 518, 11294, 29889, 15206, 1182, 363, 5702, 297, 289, 3018, 4684, 29962, 13, 1678, 903, 2738, 353, 474, 681, 29898, 271, 29880, 1182, 29879, 29892, 289, 15206, 1182, 29879, 29897, 13, 1678, 3438, 29918, 5344, 353, 29871, 29896, 448, 903, 2738, 13, 13, 1678, 736, 3438, 29918, 5344, 13, 13, 13, 1753, 474, 283, 29918, 1289, 29881, 29918, 19244, 29898, 16546, 4684, 29892, 289, 3018, 4684, 29892, 3515, 29918, 333, 29922, 29900, 29892, 671, 29918, 11965, 2463, 29922, 5574, 1125, 13, 1678, 9995, 13, 1678, 11796, 29872, 3438, 2729, 373, 22244, 29965, 13, 1678, 584, 1853, 472, 336, 4684, 29901, 1051, 29961, 1254, 22282, 29962, 13, 1678, 584, 1853, 289, 3018, 4684, 29901, 1051, 29961, 1254, 22282, 29962, 13, 13, 1678, 584, 29878, 1853, 3438, 29918, 5344, 7442, 29889, 299, 2378, 13, 1678, 9995, 13, 1678, 565, 313, 2435, 29898, 16546, 4684, 29897, 1405, 29871, 29900, 322, 338, 8758, 29898, 16546, 4684, 29961, 29900, 1402, 7442, 29889, 299, 2378, 876, 470, 313, 13, 4706, 7431, 29898, 29890, 3018, 4684, 29897, 1405, 29871, 29900, 322, 338, 8758, 29898, 29890, 3018, 4684, 29961, 29900, 1402, 7442, 29889, 299, 2378, 29897, 13, 268, 1125, 13, 4706, 472, 29880, 1182, 29879, 353, 472, 336, 4684, 13, 4706, 289, 15206, 1182, 29879, 353, 289, 3018, 4684, 13, 1678, 1683, 29901, 13, 13, 4706, 472, 29880, 1182, 29879, 353, 518, 13441, 29918, 29941, 29881, 1884, 29918, 517, 29918, 29947, 2616, 1089, 29898, 11294, 29889, 1289, 29881, 29918, 29890, 1884, 29897, 363, 5702, 297, 472, 336, 4684, 29962, 13, 4706, 289, 15206, 1182, 29879, 353, 518, 13441, 29918, 29941, 29881, 1884, 29918, 517, 29918, 29947, 2616, 1089, 29898, 11294, 29889, 1289, 29881, 29918, 29890, 1884, 29897, 363, 5702, 297, 289, 3018, 4684, 29962, 13, 13, 1678, 474, 283, 29918, 5344, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 271, 29880, 1182, 29879, 511, 7431, 29898, 3116, 29880, 1182, 29879, 8243, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 1678, 565, 474, 283, 29918, 5344, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 474, 283, 29918, 5344, 13, 1678, 363, 270, 29892, 1439, 297, 26985, 29898, 3116, 29880, 1182, 29879, 1125, 13, 4706, 363, 260, 29892, 534, 29895, 297, 26985, 29898, 271, 29880, 1182, 29879, 1125, 13, 9651, 474, 283, 29918, 5344, 29961, 29873, 29892, 270, 29962, 353, 474, 283, 29941, 29881, 29898, 4801, 29892, 534, 29895, 9601, 29900, 29962, 29871, 396, 1439, 29901, 29871, 29947, 921, 29871, 29941, 29892, 534, 29895, 29901, 29871, 29947, 921, 29871, 29941, 13, 1678, 474, 283, 29918, 5344, 353, 29871, 29896, 448, 474, 283, 29918, 5344, 13, 13, 1678, 736, 474, 283, 29918, 5344, 13, 13, 13, 1753, 15680, 29918, 6203, 29898, 29916, 29892, 343, 1125, 13, 1678, 736, 29871, 29900, 29889, 29945, 334, 7442, 29889, 6897, 29898, 9302, 29889, 6333, 29898, 29916, 29892, 7442, 29889, 1245, 29898, 29891, 29892, 29871, 29896, 876, 448, 7442, 29889, 6333, 29898, 29891, 29892, 7442, 29889, 1245, 29898, 29916, 29892, 29871, 29896, 4961, 13, 13, 13, 1753, 3800, 29941, 29881, 29918, 1555, 29898, 29883, 1398, 414, 1125, 13, 1678, 9995, 26995, 29901, 313, 29947, 29892, 29941, 29897, 694, 11833, 373, 9685, 5305, 9995, 13, 1678, 263, 353, 7442, 29889, 3676, 29898, 9302, 29889, 2083, 3552, 29883, 1398, 414, 29961, 29900, 29892, 584, 29962, 448, 26995, 29961, 29896, 29892, 584, 2314, 3579, 29871, 29906, 876, 13, 1678, 289, 353, 7442, 29889, 3676, 29898, 9302, 29889, 2083, 3552, 29883, 1398, 414, 29961, 29896, 29892, 584, 29962, 448, 26995, 29961, 29906, 29892, 584, 2314, 3579, 29871, 29906, 876, 13, 1678, 274, 353, 7442, 29889, 3676, 29898, 9302, 29889, 2083, 3552, 29883, 1398, 414, 29961, 29900, 29892, 584, 29962, 448, 26995, 29961, 29946, 29892, 584, 2314, 3579, 29871, 29906, 876, 13, 1678, 736, 263, 334, 289, 334, 274, 13, 13, 13, 1753, 18635, 29918, 29882, 913, 29918, 1639, 2042, 29898, 29886, 29896, 29892, 282, 29906, 1125, 13, 1678, 9995, 11796, 29872, 4038, 310, 1023, 18635, 298, 913, 29915, 29879, 17686, 4038, 29889, 13, 4706, 282, 29896, 29892, 29886, 29906, 526, 263, 1051, 310, 313, 29916, 29892, 29891, 29897, 5291, 2701, 310, 298, 913, 13791, 29889, 13, 4706, 736, 263, 1051, 310, 313, 29916, 29892, 29891, 29897, 363, 278, 17686, 322, 967, 7977, 13, 1678, 9995, 13, 1678, 1006, 29918, 29886, 353, 29807, 29918, 24049, 29898, 29886, 29896, 29892, 282, 29906, 29897, 13, 1678, 565, 1006, 29918, 29886, 338, 451, 6213, 29901, 13, 4706, 298, 913, 29918, 1639, 353, 1281, 13809, 29950, 913, 29898, 1639, 29918, 29886, 29897, 13, 4706, 736, 1006, 29918, 29886, 29892, 298, 913, 29918, 1639, 29889, 24623, 13, 1678, 1683, 29901, 13, 4706, 736, 6213, 29892, 29871, 29900, 29889, 29900, 13, 13, 13, 1753, 29807, 29918, 24049, 29898, 16009, 7713, 17125, 29892, 20102, 7713, 17125, 1125, 13, 1678, 9995, 315, 3466, 263, 29807, 411, 1790, 29807, 29889, 13, 259, 826, 3174, 29901, 13, 268, 4967, 7713, 17125, 29901, 263, 1051, 310, 313, 29916, 29892, 29891, 29897, 29871, 29906, 29881, 3291, 29892, 738, 29807, 29889, 13, 268, 20102, 7713, 17125, 29901, 263, 1051, 310, 313, 29916, 29892, 29891, 29897, 29871, 29906, 29881, 3291, 29892, 756, 304, 367, 334, 535, 13809, 29930, 13, 259, 3940, 29901, 13, 268, 3579, 9748, 505, 304, 367, 6795, 29899, 13058, 3538, 10372, 1068, 13, 259, 7106, 29901, 13, 268, 263, 1051, 310, 313, 29916, 29892, 29891, 29897, 12688, 1298, 363, 278, 17686, 29807, 29889, 13, 259, 9995, 13, 13, 1678, 822, 2768, 29898, 29886, 1125, 13, 4706, 736, 313, 6814, 29906, 29961, 29900, 29962, 448, 21447, 29896, 29961, 29900, 2314, 334, 313, 29886, 29961, 29896, 29962, 448, 21447, 29896, 29961, 29896, 2314, 1405, 313, 6814, 29906, 29961, 29896, 29962, 448, 21447, 29896, 29961, 29896, 2314, 334, 313, 29886, 29961, 29900, 29962, 448, 21447, 29896, 29961, 29900, 2314, 13, 13, 1678, 822, 10272, 4074, 2042, 7295, 13, 4706, 270, 29883, 353, 518, 6814, 29896, 29961, 29900, 29962, 448, 21447, 29906, 29961, 29900, 1402, 21447, 29896, 29961, 29896, 29962, 448, 21447, 29906, 29961, 29896, 5262, 13, 4706, 270, 29886, 353, 518, 29879, 29961, 29900, 29962, 448, 321, 29961, 29900, 1402, 269, 29961, 29896, 29962, 448, 321, 29961, 29896, 5262, 13, 4706, 302, 29896, 353, 21447, 29896, 29961, 29900, 29962, 334, 21447, 29906, 29961, 29896, 29962, 448, 21447, 29896, 29961, 29896, 29962, 334, 21447, 29906, 29961, 29900, 29962, 13, 4706, 302, 29906, 353, 269, 29961, 29900, 29962, 334, 321, 29961, 29896, 29962, 448, 269, 29961, 29896, 29962, 334, 321, 29961, 29900, 29962, 13, 4706, 302, 29941, 353, 29871, 29896, 29889, 29900, 847, 313, 13891, 29961, 29900, 29962, 334, 270, 29886, 29961, 29896, 29962, 448, 270, 29883, 29961, 29896, 29962, 334, 270, 29886, 29961, 29900, 2314, 13, 4706, 736, 17288, 29876, 29896, 334, 270, 29886, 29961, 29900, 29962, 448, 302, 29906, 334, 270, 29883, 29961, 29900, 2314, 334, 302, 29941, 29892, 313, 29876, 29896, 334, 270, 29886, 29961, 29896, 29962, 448, 302, 29906, 334, 270, 29883, 29961, 29896, 2314, 334, 302, 29941, 29962, 13, 13, 1678, 1962, 1293, 353, 4967, 7713, 17125, 13, 1678, 21447, 29896, 353, 20102, 7713, 17125, 14352, 29896, 29962, 13, 13, 1678, 363, 20102, 22479, 297, 20102, 7713, 17125, 29901, 13, 4706, 21447, 29906, 353, 20102, 22479, 13, 4706, 1881, 1293, 353, 1962, 1293, 13, 4706, 1962, 1293, 353, 5159, 13, 4706, 269, 353, 1881, 1293, 14352, 29896, 29962, 13, 13, 4706, 363, 4967, 22479, 297, 1881, 1293, 29901, 13, 9651, 321, 353, 4967, 22479, 13, 9651, 565, 2768, 29898, 29872, 1125, 13, 18884, 565, 451, 2768, 29898, 29879, 1125, 13, 462, 1678, 1962, 1293, 29889, 4397, 29898, 26017, 4074, 2042, 3101, 13, 18884, 1962, 1293, 29889, 4397, 29898, 29872, 29897, 13, 9651, 25342, 2768, 29898, 29879, 1125, 13, 18884, 1962, 1293, 29889, 4397, 29898, 26017, 4074, 2042, 3101, 13, 9651, 269, 353, 321, 13, 4706, 21447, 29896, 353, 21447, 29906, 13, 4706, 565, 7431, 29898, 4905, 1293, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 6213, 13, 1678, 736, 1962, 1293, 13, 13, 13, 1753, 3588, 29918, 29941, 29881, 1884, 29918, 517, 29918, 29947, 2616, 1089, 29898, 29890, 1884, 29941, 29881, 29918, 2080, 1125, 13, 13, 1678, 396, 10272, 5731, 1288, 4636, 2820, 343, 1450, 9685, 13, 1678, 289, 1884, 29941, 29881, 353, 3509, 29889, 8552, 29898, 29890, 1884, 29941, 29881, 29918, 2080, 29897, 13, 1678, 396, 4327, 304, 413, 986, 29875, 3402, 937, 13, 1678, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 353, 3509, 29889, 8552, 29898, 29890, 1884, 29941, 29881, 29897, 13, 1678, 396, 413, 986, 29875, 29901, 1678, 518, 29916, 29892, 29871, 343, 29892, 29871, 503, 29892, 29871, 263, 29892, 301, 29892, 281, 29892, 298, 29962, 13, 1678, 289, 1884, 29941, 29881, 29961, 29900, 29962, 353, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 29961, 29941, 29962, 13, 1678, 289, 1884, 29941, 29881, 29961, 29896, 29962, 353, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 29961, 29946, 29962, 13, 1678, 289, 1884, 29941, 29881, 29961, 29906, 29962, 353, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 29961, 29945, 29962, 13, 1678, 289, 1884, 29941, 29881, 29961, 29941, 29962, 353, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 14352, 29896, 29962, 13, 1678, 289, 1884, 29941, 29881, 29961, 29946, 29962, 353, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 29961, 29906, 29962, 13, 1678, 289, 1884, 29941, 29881, 29961, 29945, 29962, 353, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 29961, 29896, 29962, 13, 1678, 289, 1884, 29941, 29881, 29961, 29953, 29962, 353, 289, 1884, 29941, 29881, 29918, 29876, 375, 10278, 267, 29961, 29900, 29962, 13, 13, 1678, 390, 353, 696, 1017, 29898, 29890, 1884, 29941, 29881, 29961, 29941, 2314, 13, 13, 1678, 396, 29871, 29941, 29881, 3216, 292, 3800, 13391, 13, 1678, 301, 353, 289, 1884, 29941, 29881, 29961, 29946, 29962, 13, 1678, 281, 353, 289, 1884, 29941, 29881, 29961, 29945, 29962, 13, 1678, 298, 353, 289, 1884, 29941, 29881, 29961, 29953, 29962, 13, 13, 1678, 396, 29871, 29941, 29881, 3216, 292, 3800, 26995, 13, 1678, 921, 29918, 29883, 1398, 414, 353, 518, 29880, 847, 29871, 29906, 29892, 301, 847, 29871, 29906, 29892, 448, 29880, 847, 29871, 29906, 29892, 448, 29880, 847, 29871, 29906, 29892, 301, 847, 29871, 29906, 29892, 301, 847, 29871, 29906, 29892, 448, 29880, 847, 29871, 29906, 29892, 448, 29880, 847, 29871, 29906, 29962, 13, 1678, 343, 29918, 29883, 1398, 414, 353, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 448, 29882, 29892, 448, 29882, 29892, 448, 29882, 29892, 448, 29882, 29962, 13, 1678, 503, 29918, 29883, 1398, 414, 353, 518, 29893, 847, 29871, 29906, 29892, 448, 29893, 847, 29871, 29906, 29892, 448, 29893, 847, 29871, 29906, 29892, 281, 847, 29871, 29906, 29892, 281, 847, 29871, 29906, 29892, 448, 29893, 847, 29871, 29906, 29892, 448, 29893, 847, 29871, 29906, 29892, 281, 847, 29871, 29906, 29962, 13, 13, 1678, 396, 16734, 322, 14240, 29871, 29941, 29881, 3216, 292, 3800, 13, 1678, 26995, 29918, 29941, 29881, 353, 7442, 29889, 6333, 29898, 29934, 29892, 7442, 29889, 29894, 1429, 4197, 29916, 29918, 29883, 1398, 414, 29892, 343, 29918, 29883, 1398, 414, 29892, 503, 29918, 29883, 1398, 414, 12622, 13, 1678, 26995, 29918, 29941, 29881, 29961, 29900, 29892, 584, 29962, 353, 26995, 29918, 29941, 29881, 29961, 29900, 29892, 584, 29962, 718, 289, 1884, 29941, 29881, 29961, 29900, 29962, 13, 1678, 26995, 29918, 29941, 29881, 29961, 29896, 29892, 584, 29962, 353, 26995, 29918, 29941, 29881, 29961, 29896, 29892, 584, 29962, 718, 289, 1884, 29941, 29881, 29961, 29896, 29962, 13, 1678, 26995, 29918, 29941, 29881, 29961, 29906, 29892, 584, 29962, 353, 26995, 29918, 29941, 29881, 29961, 29906, 29892, 584, 29962, 718, 289, 1884, 29941, 29881, 29961, 29906, 29962, 13, 13, 1678, 736, 7442, 29889, 3286, 4220, 29898, 29883, 1398, 414, 29918, 29941, 29881, 29897, 13, 13, 13, 1753, 696, 1017, 29898, 29873, 1125, 13, 1678, 9995, 9664, 362, 1048, 278, 343, 29899, 8990, 29889, 9995, 13, 1678, 274, 353, 7442, 29889, 3944, 29898, 29873, 29897, 13, 1678, 269, 353, 7442, 29889, 5223, 29898, 29873, 29897, 13, 1678, 736, 7442, 29889, 2378, 4197, 29961, 29883, 29892, 29871, 29900, 29892, 269, 1402, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29900, 1402, 21069, 29879, 29892, 29871, 29900, 29892, 274, 24960, 13, 13, 13, 1753, 474, 283, 29941, 29881, 29898, 29883, 1398, 414, 29896, 29892, 26995, 29906, 1125, 13, 1678, 9995, 11796, 29872, 29871, 29941, 29928, 3216, 292, 3800, 22244, 29965, 29889, 13, 1678, 10567, 29901, 13, 4706, 26995, 29896, 29901, 12655, 1409, 313, 29947, 29892, 29941, 511, 5251, 701, 5305, 338, 8178, 612, 13, 4706, 26995, 29906, 29901, 12655, 1409, 313, 29947, 29892, 29941, 511, 5251, 701, 5305, 338, 8178, 612, 13, 1678, 10604, 29901, 13, 4706, 474, 283, 29901, 29871, 29941, 29928, 3216, 292, 3800, 22244, 29965, 13, 4706, 474, 283, 29918, 29906, 29881, 29901, 11199, 29915, 29879, 10977, 1776, 29871, 29906, 29928, 3216, 292, 3800, 22244, 29965, 13, 1678, 9995, 13, 1678, 396, 11155, 3291, 526, 297, 6795, 12006, 3538, 1797, 13, 1678, 7705, 29896, 353, 17288, 29883, 1398, 414, 29896, 29961, 29875, 29892, 29871, 29900, 1402, 26995, 29896, 29961, 29875, 29892, 29871, 29906, 2314, 363, 474, 297, 3464, 29898, 29941, 29892, 448, 29896, 29892, 448, 29896, 4638, 13, 1678, 7705, 29906, 353, 17288, 29883, 1398, 414, 29906, 29961, 29875, 29892, 29871, 29900, 1402, 26995, 29906, 29961, 29875, 29892, 29871, 29906, 2314, 363, 474, 297, 3464, 29898, 29941, 29892, 448, 29896, 29892, 448, 29896, 4638, 13, 1678, 4038, 29896, 353, 15680, 29918, 6203, 29898, 9302, 29889, 2378, 29898, 1621, 29896, 29897, 7503, 29892, 29871, 29900, 1402, 7442, 29889, 2378, 29898, 1621, 29896, 29897, 7503, 29892, 29871, 29896, 2314, 13, 1678, 4038, 29906, 353, 15680, 29918, 6203, 29898, 9302, 29889, 2378, 29898, 1621, 29906, 29897, 7503, 29892, 29871, 29900, 1402, 7442, 29889, 2378, 29898, 1621, 29906, 29897, 7503, 29892, 29871, 29896, 2314, 13, 1678, 1006, 29892, 1006, 29918, 6203, 353, 18635, 29918, 29882, 913, 29918, 1639, 2042, 29898, 1621, 29896, 29892, 7705, 29906, 29897, 13, 1678, 474, 283, 29918, 29906, 29881, 353, 1006, 29918, 6203, 847, 313, 6203, 29896, 718, 4038, 29906, 448, 1006, 29918, 6203, 29897, 13, 1678, 343, 3317, 353, 1375, 29898, 29883, 1398, 414, 29896, 29961, 29900, 29892, 29871, 29896, 1402, 26995, 29906, 29961, 29900, 29892, 29871, 29896, 2314, 13, 1678, 343, 1195, 353, 4236, 29898, 29883, 1398, 414, 29896, 29961, 29946, 29892, 29871, 29896, 1402, 26995, 29906, 29961, 29946, 29892, 29871, 29896, 2314, 13, 1678, 1006, 29918, 1555, 353, 1006, 29918, 6203, 334, 4236, 29898, 29900, 29889, 29900, 29892, 343, 3317, 448, 343, 1195, 29897, 13, 13, 1678, 1700, 29896, 353, 3800, 29941, 29881, 29918, 1555, 29898, 29883, 1398, 414, 29896, 29897, 13, 1678, 1700, 29906, 353, 3800, 29941, 29881, 29918, 1555, 29898, 29883, 1398, 414, 29906, 29897, 13, 1678, 474, 283, 353, 1006, 29918, 1555, 847, 313, 1555, 29896, 718, 1700, 29906, 448, 1006, 29918, 1555, 29897, 13, 1678, 736, 474, 283, 29892, 474, 283, 29918, 29906, 29881, 13, 13, 13, 1753, 23655, 29918, 19244, 29898, 3018, 4684, 29892, 1439, 29872, 1953, 29892, 12714, 543, 3944, 457, 29908, 1125, 13, 1678, 9995, 13, 1678, 584, 3207, 16257, 29901, 1051, 29961, 1254, 22282, 29962, 13, 1678, 584, 3207, 1439, 29872, 1953, 29901, 1051, 29961, 5160, 17936, 29962, 13, 1678, 584, 3207, 12714, 29901, 13, 1678, 584, 2457, 29901, 3438, 29918, 5344, 7442, 29889, 299, 2378, 13, 1678, 9995, 13, 13, 1678, 3438, 29918, 5344, 353, 7442, 29889, 3298, 359, 3552, 2435, 29898, 3018, 4684, 511, 7431, 29898, 29881, 2650, 1953, 8243, 26688, 29922, 9302, 29889, 7411, 29897, 13, 1678, 565, 3438, 29918, 5344, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 3438, 29918, 5344, 13, 1678, 1439, 29918, 22100, 353, 7442, 29889, 294, 2378, 4197, 11294, 29889, 21962, 29918, 1725, 271, 363, 5702, 297, 1439, 29872, 1953, 1402, 26688, 29922, 9302, 29889, 7411, 29897, 13, 13, 1678, 5702, 29918, 22100, 353, 7442, 29889, 294, 2378, 4197, 11294, 29889, 3844, 6983, 29918, 1725, 271, 363, 5702, 297, 16257, 1402, 26688, 29922, 9302, 29889, 7411, 29897, 13, 1678, 3438, 29918, 5344, 353, 7442, 29889, 27525, 398, 29898, 13, 308, 29900, 29889, 29900, 29892, 274, 5721, 29898, 11294, 29918, 22100, 29892, 1439, 29918, 22100, 29892, 12714, 29897, 13, 1678, 1723, 29871, 396, 20583, 284, 1891, 5680, 13, 1678, 736, 3438, 29918, 5344, 13, 13, 13, 1753, 12417, 29918, 18253, 29918, 5344, 29898, 29895, 29888, 29892, 3438, 29918, 5344, 29892, 16257, 29892, 1439, 29872, 1953, 29892, 871, 29918, 3283, 29922, 5574, 1125, 13, 1678, 565, 3438, 29918, 5344, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 3438, 29918, 5344, 13, 1678, 330, 1218, 29918, 6229, 353, 29871, 29906, 565, 871, 29918, 3283, 1683, 29871, 29946, 13, 1678, 330, 1218, 29918, 386, 12268, 353, 25364, 1171, 29918, 4572, 29889, 4161, 29906, 11569, 29929, 29945, 29961, 29887, 1218, 29918, 6229, 29962, 13, 1678, 20398, 353, 7442, 29889, 294, 2378, 4197, 4801, 29889, 517, 29918, 3594, 801, 580, 363, 1439, 297, 1439, 29872, 1953, 2314, 13, 1678, 363, 1948, 29892, 5702, 297, 26985, 29898, 3018, 4684, 1125, 13, 4706, 330, 1218, 29918, 19244, 353, 413, 29888, 29889, 29887, 1218, 29918, 19244, 29898, 13, 9651, 5702, 29889, 12676, 29892, 5702, 29889, 24542, 279, 8837, 29892, 20398, 29892, 871, 29918, 3283, 13, 4706, 1723, 13, 4706, 3438, 29918, 5344, 29961, 798, 29892, 330, 1218, 29918, 19244, 1405, 313, 29887, 1218, 29918, 386, 12268, 718, 29871, 29896, 29900, 4638, 353, 7442, 29889, 7192, 13, 1678, 736, 3438, 29918, 5344, 13, 13, 13, 29937, 3455, 310, 445, 740, 338, 4586, 515, 584, 2045, 597, 3292, 29889, 510, 29914, 29999, 29882, 549, 1388, 29877, 29914, 29911, 340, 3163, 29899, 1123, 1997, 603, 29899, 29924, 2891, 29914, 10054, 29914, 6207, 29914, 3018, 4937, 29914, 4352, 292, 29889, 2272, 13, 1753, 285, 1509, 29918, 29885, 8194, 29898, 13, 1678, 413, 29888, 29892, 13, 1678, 3438, 29918, 5344, 29892, 13, 1678, 16257, 29892, 13, 1678, 1439, 29872, 1953, 29892, 13, 1678, 3515, 29918, 333, 29892, 13, 1678, 671, 29918, 20155, 29885, 29922, 5574, 29892, 13, 1678, 871, 29918, 3283, 29922, 5574, 29892, 13, 1678, 14013, 29918, 29922, 29900, 29889, 29929, 29892, 13, 1125, 13, 1678, 565, 3438, 29918, 5344, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 3438, 29918, 5344, 13, 1678, 330, 1218, 29918, 6229, 353, 29871, 29906, 565, 871, 29918, 3283, 1683, 29871, 29946, 13, 1678, 330, 1218, 29918, 386, 12268, 353, 25364, 1171, 29918, 4572, 29889, 4161, 29906, 11569, 29929, 29945, 29961, 29887, 1218, 29918, 6229, 29962, 13, 1678, 565, 451, 671, 29918, 20155, 29885, 29901, 13, 4706, 20398, 353, 7442, 29889, 294, 2378, 4197, 4801, 29889, 517, 29918, 3594, 801, 580, 363, 1439, 297, 1439, 29872, 1953, 2314, 13, 4706, 363, 1948, 29892, 5702, 297, 26985, 29898, 3018, 4684, 1125, 13, 9651, 330, 1218, 29918, 19244, 353, 413, 29888, 29889, 29887, 1218, 29918, 19244, 29898, 13, 18884, 5702, 29889, 12676, 29892, 5702, 29889, 24542, 279, 8837, 29892, 20398, 29892, 871, 29918, 3283, 29892, 12714, 543, 655, 2350, 29908, 13, 9651, 1723, 13, 9651, 3438, 29918, 5344, 29961, 798, 29892, 330, 1218, 29918, 19244, 1405, 29871, 29945, 29889, 29900, 334, 330, 1218, 29918, 386, 12268, 29962, 353, 7442, 29889, 7192, 13, 9651, 3438, 29918, 5344, 29961, 798, 29962, 353, 313, 13, 18884, 14013, 29918, 334, 3438, 29918, 5344, 29961, 798, 29962, 718, 29871, 29900, 29889, 29900, 29945, 334, 313, 29896, 448, 14013, 19925, 334, 330, 1218, 29918, 19244, 13, 9651, 1723, 13, 1678, 1683, 29901, 13, 4706, 20398, 353, 7442, 29889, 294, 2378, 4197, 4801, 29889, 517, 29918, 3594, 801, 580, 363, 1439, 297, 1439, 29872, 1953, 2314, 13, 4706, 363, 1948, 29892, 5702, 297, 26985, 29898, 3018, 4684, 1125, 13, 9651, 565, 7431, 29898, 11294, 29889, 26739, 800, 29897, 6736, 29871, 29941, 29900, 29900, 29901, 13, 18884, 330, 1218, 29918, 19244, 353, 413, 29888, 29889, 29887, 1218, 29918, 19244, 29898, 13, 462, 1678, 5702, 29889, 11965, 2463, 29918, 271, 29918, 2557, 29898, 2557, 29918, 333, 511, 13, 462, 1678, 5702, 29889, 24542, 279, 8837, 29892, 13, 462, 1678, 20398, 29892, 13, 462, 1678, 871, 29918, 3283, 29892, 13, 462, 1678, 12714, 543, 655, 2350, 613, 13, 18884, 1723, 13, 18884, 3438, 29918, 5344, 29961, 798, 29892, 330, 1218, 29918, 19244, 1405, 29871, 29945, 29889, 29900, 334, 330, 1218, 29918, 386, 12268, 29962, 353, 7442, 29889, 7192, 13, 18884, 3438, 29918, 5344, 29961, 798, 29962, 353, 313, 13, 462, 1678, 14013, 29918, 334, 3438, 29918, 5344, 29961, 798, 29962, 718, 29871, 29900, 29889, 29900, 29945, 334, 313, 29896, 448, 14013, 19925, 334, 330, 1218, 29918, 19244, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 330, 1218, 29918, 19244, 353, 413, 29888, 29889, 29887, 1218, 29918, 19244, 29898, 13, 462, 1678, 5702, 29889, 11965, 2463, 29918, 271, 29918, 2557, 29898, 2557, 29918, 333, 511, 13, 462, 1678, 5702, 29889, 24542, 279, 8837, 29892, 13, 462, 1678, 20398, 29892, 13, 462, 1678, 871, 29918, 3283, 29892, 13, 462, 1678, 12714, 543, 29887, 17019, 613, 13, 18884, 1723, 13, 18884, 3438, 29918, 5344, 29961, 798, 29892, 330, 1218, 29918, 19244, 1405, 29871, 29945, 29900, 29962, 353, 7442, 29889, 7192, 13, 18884, 3438, 29918, 5344, 29961, 798, 29962, 353, 313, 13, 462, 1678, 14013, 29918, 334, 3438, 29918, 5344, 29961, 798, 29962, 13, 462, 1678, 718, 29871, 29900, 29889, 29900, 29900, 29900, 29945, 334, 313, 29896, 448, 14013, 19925, 334, 330, 1218, 29918, 19244, 13, 18884, 1723, 13, 13, 1678, 736, 3438, 29918, 5344, 13, 13, 13, 1753, 285, 1509, 29918, 29885, 8194, 29918, 1289, 29881, 29898, 13, 1678, 413, 29888, 29892, 13, 1678, 3438, 29918, 5344, 29892, 13, 1678, 16257, 29892, 13, 1678, 1439, 29872, 1953, 29892, 13, 1678, 3515, 29918, 333, 29892, 13, 1678, 671, 29918, 20155, 29885, 29922, 5574, 29892, 13, 1678, 871, 29918, 3283, 29922, 8824, 29892, 13, 1678, 14013, 29918, 29922, 29900, 29889, 29929, 29892, 13, 1678, 671, 29918, 11965, 2463, 29922, 8824, 29892, 13, 1678, 17792, 29918, 978, 29922, 8516, 29892, 13, 1125, 13, 1678, 565, 3438, 29918, 5344, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 3438, 29918, 5344, 13, 13, 1678, 330, 1218, 29918, 6229, 353, 29871, 29955, 13, 1678, 330, 1218, 29918, 386, 12268, 353, 25364, 1171, 29918, 4572, 29889, 4161, 29906, 11569, 29929, 29945, 29961, 29887, 1218, 29918, 6229, 29962, 13, 1678, 20398, 353, 7442, 29889, 294, 2378, 4197, 4801, 29889, 1289, 29881, 29918, 29890, 1884, 363, 1439, 297, 1439, 29872, 1953, 2314, 13, 1678, 363, 1948, 29892, 5702, 297, 26985, 29898, 3018, 4684, 1125, 13, 13, 4706, 565, 671, 29918, 11965, 2463, 29901, 13, 9651, 330, 1218, 29918, 19244, 353, 413, 29888, 29889, 29887, 1218, 29918, 19244, 29898, 13, 18884, 5702, 29889, 1289, 29881, 29918, 11965, 2463, 29918, 271, 29918, 2557, 29898, 2557, 29918, 333, 511, 13, 18884, 5702, 29889, 24542, 279, 8837, 29892, 13, 18884, 20398, 29892, 13, 18884, 871, 29918, 3283, 29892, 13, 18884, 12714, 543, 29887, 17019, 613, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 330, 1218, 29918, 19244, 353, 413, 29888, 29889, 29887, 1218, 29918, 19244, 29898, 13, 18884, 5702, 29889, 1289, 29881, 29918, 29890, 1884, 29892, 13, 18884, 5702, 29889, 24542, 279, 8837, 29892, 13, 18884, 20398, 29892, 13, 18884, 871, 29918, 3283, 29892, 13, 18884, 12714, 543, 29887, 17019, 613, 13, 9651, 1723, 13, 13, 4706, 1468, 353, 29871, 29900, 29889, 29906, 334, 5702, 29889, 19488, 13, 4706, 565, 17792, 29918, 978, 1275, 376, 9795, 342, 6392, 1115, 13, 9651, 565, 1468, 529, 29871, 29945, 29901, 13, 18884, 1468, 353, 29871, 29945, 13, 4706, 1683, 29901, 13, 13, 9651, 565, 1468, 529, 29871, 29896, 29900, 29901, 13, 18884, 1468, 353, 29871, 29896, 29900, 13, 4706, 3438, 29918, 5344, 29961, 798, 29892, 330, 1218, 29918, 19244, 1405, 1468, 29962, 353, 7442, 29889, 7192, 13, 4706, 3438, 29918, 5344, 29961, 798, 29962, 353, 14013, 29918, 334, 3438, 29918, 5344, 29961, 798, 29962, 718, 29871, 29900, 29889, 29900, 29900, 29896, 334, 330, 1218, 29918, 19244, 13, 13, 1678, 736, 3438, 29918, 5344, 13, 2 ]
test1.py
redeye999/pyneta
0
198265
x = { 1, 2, 3, 4, 5 } for i in x: print i
[ 1, 921, 353, 426, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 500, 13, 1454, 474, 297, 921, 29901, 13, 1678, 1596, 474, 13, 13, 2 ]
reminder.py
starhound/Parts_Bot
2
118677
<filename>reminder.py<gh_stars>1-10 import main import parts_history import json import datetime import threading import logger PARTS_CHAT = 1 def report_action_card(message): message = message["msg"] content = message.split(':') reminder = "Parts order for " + content + " has been unclaimed for three or more days!" main.bot.api.chat_post_message(text=reminder, channel=PARTS_CHAT) logger.log_info_event(reminder) def check_messages(): message_history = parts_history.history() messages = json.loads(message_history) dt = datetime.datetime.today() date = dt.day for message in messages['messages']: time = message["ts"] message_date = time.split('-')[2] if message_date < int(date) - 3: report_action_card(message) def start_reminders(): threading.Timer(86400.0, check_messages).start()
[ 1, 529, 9507, 29958, 1745, 4995, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 1667, 13, 5215, 5633, 29918, 18434, 13, 5215, 4390, 13, 5215, 12865, 13, 5215, 3244, 292, 13, 5215, 17927, 13, 13, 26092, 29903, 29918, 3210, 1299, 353, 29871, 29896, 13, 13, 13, 1753, 3461, 29918, 2467, 29918, 7543, 29898, 4906, 1125, 13, 1678, 2643, 353, 2643, 3366, 7645, 3108, 13, 1678, 2793, 353, 2643, 29889, 5451, 877, 29901, 1495, 13, 1678, 1083, 4995, 353, 376, 29925, 5708, 1797, 363, 376, 718, 2793, 718, 376, 756, 1063, 443, 29883, 13190, 363, 2211, 470, 901, 3841, 3850, 13, 1678, 1667, 29889, 7451, 29889, 2754, 29889, 13496, 29918, 2490, 29918, 4906, 29898, 726, 29922, 1745, 4995, 29892, 8242, 29922, 26092, 29903, 29918, 3210, 1299, 29897, 13, 1678, 17927, 29889, 1188, 29918, 3888, 29918, 3696, 29898, 1745, 4995, 29897, 13, 13, 13, 1753, 1423, 29918, 19158, 7295, 13, 1678, 2643, 29918, 18434, 353, 5633, 29918, 18434, 29889, 18434, 580, 13, 1678, 7191, 353, 4390, 29889, 18132, 29898, 4906, 29918, 18434, 29897, 13, 1678, 11636, 353, 12865, 29889, 12673, 29889, 27765, 580, 13, 1678, 2635, 353, 11636, 29889, 3250, 13, 1678, 363, 2643, 297, 7191, 1839, 19158, 2033, 29901, 13, 4706, 931, 353, 2643, 3366, 1372, 3108, 13, 4706, 2643, 29918, 1256, 353, 931, 29889, 5451, 877, 29899, 29861, 29906, 29962, 13, 4706, 565, 2643, 29918, 1256, 529, 938, 29898, 1256, 29897, 448, 29871, 29941, 29901, 13, 9651, 3461, 29918, 2467, 29918, 7543, 29898, 4906, 29897, 13, 13, 13, 1753, 1369, 29918, 1745, 513, 414, 7295, 13, 1678, 3244, 292, 29889, 14745, 29898, 29947, 29953, 29946, 29900, 29900, 29889, 29900, 29892, 1423, 29918, 19158, 467, 2962, 580, 13, 2 ]
bin/generateLogTenX.py
ErikMeinders/cirrus
0
98480
<filename>bin/generateLogTenX.py<gh_stars>0 # # Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # This file is licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR # CONDITIONS OF ANY KIND, either express or implied. See the License for the # specific language governing permissions and limitations under the License. # from __future__ import print_function # Python 2/3 compatibility import boto3 import json import decimal from boto3.dynamodb.conditions import Key, Attr def atoi(s): n, notnegative = 0, 1 if s[0]=="-": notnegative = -1 s = s[1:] for i in s: n = n*10 + ord(i)-ord("0") return notnegative*n import sys def printf(format, *args): sys.stdout.write(format % args) # Helper class to convert a DynamoDB item to JSON. class DecimalEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): return str(o) return super(DecimalEncoder, self).default(o) dynamodb = boto3.resource('dynamodb', region_name='eu-central-1') table = dynamodb.Table('avidyneFlightLogs') empty_package={ "metadata": { "application" : "ErixLogTenUpdater", "version" : "1.0", "dateFormat" : "MM/dd/yy", "dateAndTimeFormat" : "MM/dd/yy%20HH:mm:ss", "timesAreZulu" : "true", "shouldApplyAutoFillTimes" : "true" }, "entities": [] } logtenline='logtenprox://v2/addEntities?package=' response = table.scan( ) entries=[] def writeFlight(flight): try: datum = flight['flightID'].split(' ')[0] [ mo, da, yr ] = datum.split('/') # Only consider flights after june 1 2018 if ( 10000 * atoi(yr) + 100 * atoi(mo) + atoi(da) ) <= 190216: return if not 'icaoFrom' in flight: flight['icaoFrom']='ABCD' if not 'icaoTo' in flight: flight['icaoTo']='DCBA' printf ("%s/%02d/%02d: ", yr, int(mo), int(da)) entry={ "entity_name" : "Flight", "flight_flightDate" : datum, "flight_key" : flight['flightID'], "flight_from" : flight['icaoFrom'], "flight_to" : flight['icaoTo'], "flight_distance" : str(flight['Traveled']), "flight_actualDepartureTime" : datum+' '+flight['OffBlock'], "flight_actualArrivalTime" : datum+' '+flight['OnBlocks'], "flight_takeoffTime" : datum+' '+flight['TakeOff'], "flight_landingTime" : datum+' '+flight['Landing'], "flight_totalTime" : flight['PICTime'], # "flight_dayLandings" : "1", # "flight_dayTakeoffs" : "1", "flight_selectedAircraftType": "SR-20", "flight_selectedAircraftID" : "N808KB", "flight_selectedCrewPIC" : "<NAME>" } entries.append(entry) package=empty_package package['entities'] = [ entry ] line=logtenline+json.dumps(package) printf ("<a href='%s'>Form %4s to %4s</a> Key: %s<br>\n", line, entry['flight_from'], entry['flight_to'], entry['flight_actualDepartureTime']) except Exception as e: printf ("Exception discovered %s\n", e) # main for i in response[u'Items']: writeFlight(i) # write sum package=empty_package package['entities']=entries line=logtenline+json.dumps(package) printf ("<br>Alle vluchten <a href='%s'>na 1 juni 2018</a>\n", line) #### sample = { "lonEnd": "6.8838", "flightID": "4/9/17 09:26:47", "lonStart": "5.5261", "AvgSpeed": "100.416255672", "Flying": "0:38:36", "latStart": "52.4580", "Landing": "10:10:42", "Traveled": "64.6011244822", "icaoTo": "EHTW", "gcDist": "50.9485443277", "OnBlocks": "10:11:36", "TakeOff": "09:32:06", "icaoFrom": "EHLE", "Ground": "0:05:06", "PICTime": "0:43:42", "OffBlock": "09:27:54", "latEnd": "52.2767" }
[ 1, 529, 9507, 29958, 2109, 29914, 17158, 3403, 29911, 264, 29990, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 29937, 13, 29937, 29871, 14187, 1266, 29871, 29906, 29900, 29896, 29900, 29899, 29906, 29900, 29896, 29929, 16631, 29889, 510, 29892, 9266, 29889, 470, 967, 23736, 1078, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 29871, 910, 934, 338, 7794, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 2564, 13, 29937, 29871, 887, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 319, 3509, 310, 13, 29937, 29871, 278, 19245, 338, 5982, 472, 13, 29937, 29871, 13, 29937, 29871, 1732, 597, 10467, 29889, 17260, 29889, 510, 29914, 4288, 29906, 29889, 29900, 29914, 13, 29937, 29871, 13, 29937, 29871, 910, 934, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 13, 29937, 29871, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 19245, 363, 278, 13, 29937, 29871, 2702, 4086, 14765, 1076, 11239, 322, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 396, 5132, 29871, 29906, 29914, 29941, 24521, 13, 5215, 289, 3747, 29941, 13, 5215, 4390, 13, 5215, 13677, 13, 3166, 289, 3747, 29941, 29889, 29881, 2926, 10396, 29889, 1116, 2187, 1053, 7670, 29892, 2180, 509, 13, 13, 1753, 472, 7768, 29898, 29879, 1125, 13, 12, 29876, 29892, 451, 22198, 353, 29871, 29900, 29892, 29871, 29896, 13, 12, 361, 269, 29961, 29900, 13192, 543, 29899, 1115, 13, 12, 12, 1333, 22198, 353, 448, 29896, 13, 12, 12, 29879, 353, 269, 29961, 29896, 17531, 13, 12, 1454, 474, 297, 269, 29901, 13, 12, 12, 29876, 353, 302, 29930, 29896, 29900, 718, 4356, 29898, 29875, 6817, 536, 703, 29900, 1159, 13, 12, 2457, 451, 22198, 29930, 29876, 13, 13, 5215, 10876, 13, 1753, 7571, 29898, 4830, 29892, 334, 5085, 1125, 13, 1678, 10876, 29889, 25393, 29889, 3539, 29898, 4830, 1273, 6389, 29897, 13, 13, 29937, 6162, 546, 770, 304, 3588, 263, 22554, 29877, 4051, 2944, 304, 4663, 29889, 13, 13, 1990, 3826, 3039, 8566, 6119, 29898, 3126, 29889, 7249, 8566, 6119, 1125, 13, 1678, 822, 2322, 29898, 1311, 29892, 288, 1125, 13, 4706, 565, 338, 8758, 29898, 29877, 29892, 13677, 29889, 23307, 1125, 13, 9651, 736, 851, 29898, 29877, 29897, 13, 4706, 736, 2428, 29898, 23307, 8566, 6119, 29892, 1583, 467, 4381, 29898, 29877, 29897, 13, 13, 29881, 2926, 10396, 353, 289, 3747, 29941, 29889, 10314, 877, 29881, 2926, 10396, 742, 5120, 29918, 978, 2433, 12932, 29899, 25171, 29899, 29896, 1495, 13, 2371, 353, 4292, 10396, 29889, 3562, 877, 16093, 29891, 484, 29943, 4366, 3403, 29879, 1495, 13, 13, 6310, 29918, 5113, 3790, 13, 29871, 376, 19635, 1115, 426, 13, 1678, 376, 6214, 29908, 795, 584, 376, 29923, 2126, 3403, 29911, 264, 3373, 29881, 1008, 613, 13, 1678, 376, 3259, 29908, 462, 29871, 584, 376, 29896, 29889, 29900, 613, 13, 1678, 376, 1256, 5809, 29908, 1669, 584, 376, 7428, 29914, 1289, 29914, 8071, 613, 13, 1678, 376, 1256, 2855, 2481, 5809, 29908, 4706, 584, 376, 7428, 29914, 1289, 29914, 8071, 29995, 29906, 29900, 27590, 29901, 4317, 29901, 893, 613, 13, 1678, 376, 3706, 17506, 29999, 21528, 29908, 632, 584, 376, 3009, 613, 13, 1678, 376, 9344, 2052, 368, 12300, 20876, 29164, 29908, 584, 376, 3009, 29908, 13, 29871, 2981, 13, 29871, 376, 296, 1907, 1115, 5159, 13, 29913, 13, 1188, 841, 1220, 2433, 1188, 841, 771, 29916, 597, 29894, 29906, 29914, 1202, 5292, 1907, 29973, 5113, 2433, 13, 13, 5327, 353, 1591, 29889, 16192, 29898, 1723, 13, 13, 26586, 29922, 2636, 13, 13, 1753, 2436, 29943, 4366, 29898, 1579, 523, 1125, 13, 259, 13, 29871, 1018, 29901, 29871, 13, 1678, 1418, 398, 353, 16286, 1839, 1579, 523, 1367, 13359, 5451, 877, 525, 9601, 29900, 29962, 13, 1678, 518, 2730, 29892, 1146, 29892, 343, 29878, 4514, 353, 1418, 398, 29889, 5451, 11219, 1495, 13, 13, 1678, 396, 9333, 2050, 1652, 5861, 1156, 432, 1540, 29871, 29896, 29871, 29906, 29900, 29896, 29947, 13, 13, 1678, 565, 313, 29871, 29896, 29900, 29900, 29900, 29900, 334, 472, 7768, 29898, 4316, 29897, 718, 29871, 29896, 29900, 29900, 334, 472, 7768, 29898, 4346, 29897, 718, 472, 7768, 29898, 1388, 29897, 1723, 5277, 29871, 29896, 29929, 29900, 29906, 29896, 29953, 29901, 13, 539, 736, 13, 13, 1678, 565, 451, 525, 983, 29877, 4591, 29915, 297, 16286, 29901, 13, 418, 16286, 1839, 983, 29877, 4591, 2033, 2433, 2882, 6530, 29915, 13, 1678, 565, 451, 525, 983, 29877, 1762, 29915, 297, 16286, 29901, 13, 418, 16286, 1839, 983, 29877, 1762, 2033, 2433, 12696, 5688, 29915, 13, 418, 13, 1678, 7571, 4852, 29995, 29879, 22584, 29900, 29906, 29881, 22584, 29900, 29906, 29881, 29901, 9162, 343, 29878, 29892, 938, 29898, 4346, 511, 938, 29898, 1388, 876, 13, 13, 1678, 6251, 3790, 13, 13, 418, 376, 10041, 29918, 978, 29908, 18884, 584, 376, 29943, 4366, 613, 13, 13, 13, 418, 376, 1579, 523, 29918, 1579, 523, 2539, 29908, 3986, 584, 1418, 398, 29892, 13, 418, 376, 1579, 523, 29918, 1989, 29908, 462, 584, 16286, 1839, 1579, 523, 1367, 7464, 13, 418, 376, 1579, 523, 29918, 3166, 29908, 18884, 584, 16286, 1839, 983, 29877, 4591, 7464, 13, 418, 376, 1579, 523, 29918, 517, 29908, 462, 29871, 584, 16286, 1839, 983, 29877, 1762, 7464, 13, 418, 376, 1579, 523, 29918, 19244, 29908, 9651, 584, 851, 29898, 1579, 523, 1839, 5323, 345, 839, 2033, 511, 13, 418, 376, 1579, 523, 29918, 19304, 8498, 442, 545, 2481, 29908, 584, 1418, 398, 23097, 525, 29974, 1579, 523, 1839, 6880, 7445, 7464, 13, 418, 376, 1579, 523, 29918, 19304, 1433, 15081, 2481, 29908, 259, 584, 1418, 398, 23097, 525, 29974, 1579, 523, 1839, 2951, 7445, 29879, 7464, 13, 418, 376, 1579, 523, 29918, 19730, 2696, 2481, 29908, 308, 584, 1418, 398, 23097, 525, 29974, 1579, 523, 1839, 26772, 6880, 7464, 13, 418, 376, 1579, 523, 29918, 1049, 292, 2481, 29908, 308, 584, 1418, 398, 23097, 525, 29974, 1579, 523, 1839, 22677, 292, 7464, 13, 13, 418, 376, 1579, 523, 29918, 7827, 2481, 29908, 965, 584, 16286, 1839, 2227, 1783, 603, 7464, 13, 13, 418, 396, 376, 1579, 523, 29918, 3250, 22677, 886, 29908, 308, 584, 376, 29896, 613, 13, 418, 396, 376, 1579, 523, 29918, 3250, 26772, 22450, 29908, 308, 584, 376, 29896, 613, 13, 418, 376, 1579, 523, 29918, 8391, 29909, 12664, 1542, 1115, 376, 14098, 29899, 29906, 29900, 613, 13, 418, 376, 1579, 523, 29918, 8391, 29909, 12664, 1367, 29908, 29871, 584, 376, 29940, 29947, 29900, 29947, 26067, 613, 13, 418, 376, 1579, 523, 29918, 8391, 29907, 3973, 2227, 29907, 29908, 268, 584, 9872, 5813, 11903, 13, 1678, 500, 13, 13, 1678, 9976, 29889, 4397, 29898, 8269, 29897, 13, 13, 1678, 3577, 29922, 6310, 29918, 5113, 13, 1678, 3577, 1839, 296, 1907, 2033, 353, 518, 6251, 4514, 29871, 13, 13, 1678, 1196, 29922, 1188, 841, 1220, 29974, 3126, 29889, 29881, 17204, 29898, 5113, 29897, 13, 13, 1678, 7571, 4852, 29966, 29874, 2822, 2433, 29995, 29879, 11041, 2500, 1273, 29946, 29879, 304, 1273, 29946, 29879, 829, 29874, 29958, 7670, 29901, 1273, 29879, 29966, 1182, 14247, 29876, 613, 13, 268, 1196, 29892, 13, 268, 6251, 1839, 1579, 523, 29918, 3166, 7464, 13, 268, 6251, 1839, 1579, 523, 29918, 517, 7464, 13, 268, 6251, 1839, 1579, 523, 29918, 19304, 8498, 442, 545, 2481, 11287, 13, 13, 29871, 5174, 8960, 408, 321, 29901, 13, 1678, 7571, 4852, 2451, 10943, 1273, 29879, 29905, 29876, 613, 321, 29897, 13, 13, 29937, 1667, 29871, 13, 13, 1454, 474, 297, 2933, 29961, 29884, 29915, 6913, 2033, 29901, 13, 1678, 2436, 29943, 4366, 29898, 29875, 29897, 13, 13, 29937, 2436, 2533, 13, 13, 5113, 29922, 6310, 29918, 5113, 13, 5113, 1839, 296, 1907, 2033, 29922, 26586, 13, 13, 1220, 29922, 1188, 841, 1220, 29974, 3126, 29889, 29881, 17204, 29898, 5113, 29897, 13, 13, 8124, 4852, 29966, 1182, 29958, 2499, 280, 14204, 987, 841, 529, 29874, 2822, 2433, 29995, 29879, 11041, 1056, 29871, 29896, 17340, 29871, 29906, 29900, 29896, 29947, 829, 29874, 14247, 29876, 613, 1196, 29897, 13, 13, 4136, 29871, 13, 13, 11249, 353, 426, 13, 29871, 376, 12957, 5044, 1115, 376, 29953, 29889, 29947, 29947, 29941, 29947, 613, 13, 29871, 376, 1579, 523, 1367, 1115, 376, 29946, 29914, 29929, 29914, 29896, 29955, 29871, 29900, 29929, 29901, 29906, 29953, 29901, 29946, 29955, 613, 13, 29871, 376, 12957, 4763, 1115, 376, 29945, 29889, 29945, 29906, 29953, 29896, 613, 13, 29871, 376, 12810, 29887, 26539, 1115, 376, 29896, 29900, 29900, 29889, 29946, 29896, 29953, 29906, 29945, 29945, 29953, 29955, 29906, 613, 13, 29871, 376, 29943, 5890, 1115, 376, 29900, 29901, 29941, 29947, 29901, 29941, 29953, 613, 13, 29871, 376, 5066, 4763, 1115, 376, 29945, 29906, 29889, 29946, 29945, 29947, 29900, 613, 13, 29871, 376, 22677, 292, 1115, 376, 29896, 29900, 29901, 29896, 29900, 29901, 29946, 29906, 613, 13, 29871, 376, 5323, 345, 839, 1115, 376, 29953, 29946, 29889, 29953, 29900, 29896, 29896, 29906, 29946, 29946, 29947, 29906, 29906, 613, 13, 29871, 376, 983, 29877, 1762, 1115, 376, 29923, 3912, 29956, 613, 13, 29871, 376, 27354, 13398, 1115, 376, 29945, 29900, 29889, 29929, 29946, 29947, 29945, 29946, 29946, 29941, 29906, 29955, 29955, 613, 13, 29871, 376, 2951, 7445, 29879, 1115, 376, 29896, 29900, 29901, 29896, 29896, 29901, 29941, 29953, 613, 13, 29871, 376, 26772, 6880, 1115, 376, 29900, 29929, 29901, 29941, 29906, 29901, 29900, 29953, 613, 13, 29871, 376, 983, 29877, 4591, 1115, 376, 29923, 29950, 1307, 613, 13, 29871, 376, 3338, 618, 1115, 376, 29900, 29901, 29900, 29945, 29901, 29900, 29953, 613, 13, 29871, 376, 2227, 1783, 603, 1115, 376, 29900, 29901, 29946, 29941, 29901, 29946, 29906, 613, 13, 29871, 376, 6880, 7445, 1115, 376, 29900, 29929, 29901, 29906, 29955, 29901, 29945, 29946, 613, 13, 29871, 376, 5066, 5044, 1115, 376, 29945, 29906, 29889, 29906, 29955, 29953, 29955, 29908, 13, 29913, 13, 2 ]
realtime_kiawase/realtime_kiawase.py
actionpterygii/arishihiNoDetectMultiScale
0
87038
# -*- coding: utf-8 -*- """ Created on Fri Dec 09 13:52:37 2016 @author: _ """ import cv, cv2, numpy as np if __name__ == '__main__': ESC_KEY = 27 INTERVAL= 33 FRAME_RATE = 30 DEVICE_ID = 0 cap = cv2.VideoCapture(DEVICE_ID) end_flag, c_frame = cap.read() cascade = cv2.CascadeClassifier('scascade_shog.xml') rt,org_im = cap.read() while end_flag == True: rt,org_im = cap.read() height,width,chanels = org_im.shape ork_im = org_im[50:height,150:470] hsv_im = cv2.cvtColor(ork_im, cv2.COLOR_BGR2HSV) hsvbun = cv2.split(hsv_im) cv2.equalizeHist(hsvbun[2],hsvbun[2]) skk_im = cv2.merge((hsvbun[0],hsvbun[1],hsvbun[2])) si_im = cv2.cvtColor(skk_im, cv2.COLOR_HSV2BGR) fushiii = cascade.detectMultiScale(ork_im, 1.1, 3) i = 1 for (x, y, w, h) in fushiii: print("%d,%d,%d,%d,%d" %(i, x, y, w, h)) center = (int(x+w/2), int(y+h/2)) radius = int(w/2+5) cv2.circle(ork_im, center, radius, cv.RGB(255, 255, 255), thickness=3) i += 1 cv2.imshow('SKK', ork_im) key = cv2.waitKey(INTERVAL) if key == ESC_KEY: break c_frame = cap.read() cv2.destroyAllWindows() cap.release()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 15945, 19451, 13, 20399, 373, 11169, 3826, 29871, 29900, 29929, 29871, 29896, 29941, 29901, 29945, 29906, 29901, 29941, 29955, 29871, 29906, 29900, 29896, 29953, 30004, 13, 30004, 13, 29992, 8921, 29901, 903, 30004, 13, 15945, 19451, 13, 30004, 13, 30004, 13, 5215, 13850, 29892, 13850, 29906, 29892, 12655, 408, 7442, 30004, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 1678, 6756, 13, 1678, 382, 7187, 29918, 10818, 353, 29871, 29906, 29955, 268, 6756, 13, 1678, 2672, 4945, 8932, 29922, 29871, 29941, 29941, 268, 6756, 13, 1678, 383, 4717, 2303, 29918, 29934, 3040, 353, 29871, 29941, 29900, 29871, 6756, 13, 30004, 13, 1678, 5012, 19059, 29918, 1367, 353, 29871, 29900, 30004, 13, 30004, 13, 1678, 6756, 13, 1678, 2117, 353, 13850, 29906, 29889, 15167, 21133, 545, 29898, 2287, 19059, 29918, 1367, 8443, 13, 30004, 13, 1678, 6756, 13, 1678, 1095, 29918, 15581, 29892, 274, 29918, 2557, 353, 2117, 29889, 949, 26471, 13, 30004, 13, 1678, 6756, 13, 1678, 3209, 6332, 353, 13850, 29906, 29889, 29907, 294, 6332, 2385, 3709, 877, 1557, 294, 6332, 29918, 845, 468, 29889, 3134, 1495, 30004, 13, 1678, 6756, 13, 1678, 364, 29873, 29892, 990, 29918, 326, 353, 2117, 29889, 949, 26471, 13, 30004, 13, 1678, 6756, 13, 1678, 1550, 1095, 29918, 15581, 1275, 5852, 29901, 30004, 13, 6756, 13, 4706, 364, 29873, 29892, 990, 29918, 326, 353, 2117, 29889, 949, 26471, 13, 4706, 6756, 13, 4706, 3171, 29892, 2103, 29892, 5083, 1379, 353, 1638, 29918, 326, 29889, 12181, 30004, 13, 4706, 470, 29895, 29918, 326, 353, 1638, 29918, 326, 29961, 29945, 29900, 29901, 3545, 29892, 29896, 29945, 29900, 29901, 29946, 29955, 29900, 29962, 30004, 13, 4706, 6756, 13, 4706, 298, 4501, 29918, 326, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 548, 29918, 326, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29950, 7597, 8443, 13, 4706, 298, 4501, 29890, 348, 353, 13850, 29906, 29889, 5451, 29898, 29882, 4501, 29918, 326, 8443, 13, 4706, 13850, 29906, 29889, 11745, 675, 29950, 391, 29898, 29882, 4501, 29890, 348, 29961, 29906, 1402, 29882, 4501, 29890, 348, 29961, 29906, 2314, 30004, 13, 4706, 2071, 29895, 29918, 326, 353, 13850, 29906, 29889, 14634, 3552, 29882, 4501, 29890, 348, 29961, 29900, 1402, 29882, 4501, 29890, 348, 29961, 29896, 1402, 29882, 4501, 29890, 348, 29961, 29906, 12622, 30004, 13, 4706, 1354, 29918, 326, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 808, 29895, 29918, 326, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29950, 7597, 29906, 29933, 14345, 8443, 13, 539, 6756, 13, 4706, 285, 1878, 25609, 353, 3209, 6332, 29889, 4801, 522, 15329, 17185, 29898, 548, 29918, 326, 29892, 29871, 29896, 29889, 29896, 29892, 29871, 29941, 29897, 6756, 13, 6756, 13, 4706, 474, 353, 29871, 29896, 30004, 13, 4706, 363, 313, 29916, 29892, 343, 29892, 281, 29892, 298, 29897, 297, 285, 1878, 25609, 29901, 30004, 13, 9651, 1596, 11702, 29881, 24163, 29881, 24163, 29881, 24163, 29881, 24163, 29881, 29908, 1273, 29898, 29875, 29892, 921, 29892, 343, 29892, 281, 29892, 298, 876, 30004, 13, 9651, 4818, 353, 313, 524, 29898, 29916, 29974, 29893, 29914, 29906, 511, 938, 29898, 29891, 29974, 29882, 29914, 29906, 876, 30004, 13, 9651, 11855, 353, 938, 29898, 29893, 29914, 29906, 29974, 29945, 8443, 13, 9651, 13850, 29906, 29889, 16622, 29898, 548, 29918, 326, 29892, 4818, 29892, 11855, 29892, 13850, 29889, 28212, 29898, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 511, 12003, 2264, 29922, 29941, 8443, 13, 9651, 474, 4619, 29871, 29896, 30004, 13, 308, 6756, 13, 4706, 13850, 29906, 29889, 326, 4294, 877, 16033, 29968, 742, 470, 29895, 29918, 326, 8443, 13, 4706, 6756, 13, 4706, 1820, 353, 13850, 29906, 29889, 10685, 2558, 29898, 23845, 8932, 8443, 13, 4706, 565, 1820, 1275, 382, 7187, 29918, 10818, 29901, 30004, 13, 9651, 2867, 30004, 13, 30004, 13, 4706, 274, 29918, 2557, 353, 2117, 29889, 949, 26471, 13, 4706, 6756, 13, 1678, 13850, 29906, 29889, 20524, 3596, 7685, 26471, 13, 1678, 2117, 29889, 14096, 26471, 13, 2 ]
esphomeyaml/helpers.py
TheJulianJES/esphomeyaml
0
80825
<filename>esphomeyaml/helpers.py from __future__ import print_function import errno import logging import os import socket import subprocess from esphomeyaml.py_compat import text_type, IS_PY2 _LOGGER = logging.getLogger(__name__) def ensure_unique_string(preferred_string, current_strings): test_string = preferred_string current_strings_set = set(current_strings) tries = 1 while test_string in current_strings_set: tries += 1 test_string = u"{}_{}".format(preferred_string, tries) return test_string def indent_all_but_first_and_last(text, padding=u' '): lines = text.splitlines(True) if len(lines) <= 2: return text return lines[0] + u''.join(padding + line for line in lines[1:-1]) + lines[-1] def indent_list(text, padding=u' '): return [padding + line for line in text.splitlines()] def indent(text, padding=u' '): return u'\n'.join(indent_list(text, padding)) # From https://stackoverflow.com/a/14945195/8924614 def cpp_string_escape(string, encoding='utf-8'): if isinstance(string, text_type): string = string.encode(encoding) result = '' for character in string: if IS_PY2: character = ord(character) if not (32 <= character < 127) or character in ('\\', '"'): result += '\\%03o' % character else: result += chr(character) return '"' + result + '"' def color(the_color, message=''): from colorlog.escape_codes import escape_codes, parse_colors if not message: res = parse_colors(the_color) else: res = parse_colors(the_color) + message + escape_codes['reset'] return res def run_system_command(*args): p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() rc = p.returncode return rc, stdout, stderr def mkdir_p(path): try: os.makedirs(path) except OSError as exc: if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise def is_ip_address(host): parts = host.split('.') if len(parts) != 4: return False try: for p in parts: int(p) return True except ValueError: return False def resolve_ip_address(host): try: ip = socket.gethostbyname(host) except socket.error as err: from esphomeyaml.core import EsphomeyamlError raise EsphomeyamlError("Error resolving IP address: {}".format(err)) return ip
[ 1, 529, 9507, 29958, 267, 561, 608, 25162, 29914, 3952, 6774, 29889, 2272, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 4589, 1217, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 9909, 13, 5215, 1014, 5014, 13, 13, 3166, 831, 561, 608, 25162, 29889, 2272, 29918, 12667, 1053, 1426, 29918, 1853, 29892, 8519, 29918, 20055, 29906, 13, 13, 29918, 14480, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 9801, 29918, 13092, 29918, 1807, 29898, 1457, 14373, 29918, 1807, 29892, 1857, 29918, 19651, 1125, 13, 1678, 1243, 29918, 1807, 353, 16389, 29918, 1807, 13, 1678, 1857, 29918, 19651, 29918, 842, 353, 731, 29898, 3784, 29918, 19651, 29897, 13, 13, 1678, 14335, 353, 29871, 29896, 13, 13, 1678, 1550, 1243, 29918, 1807, 297, 1857, 29918, 19651, 29918, 842, 29901, 13, 4706, 14335, 4619, 29871, 29896, 13, 4706, 1243, 29918, 1807, 353, 318, 29908, 29912, 3227, 29913, 1642, 4830, 29898, 1457, 14373, 29918, 1807, 29892, 14335, 29897, 13, 13, 1678, 736, 1243, 29918, 1807, 13, 13, 13, 1753, 29536, 29918, 497, 29918, 4187, 29918, 4102, 29918, 392, 29918, 4230, 29898, 726, 29892, 7164, 29922, 29884, 29915, 29871, 525, 1125, 13, 1678, 3454, 353, 1426, 29889, 5451, 9012, 29898, 5574, 29897, 13, 1678, 565, 7431, 29898, 9012, 29897, 5277, 29871, 29906, 29901, 13, 4706, 736, 1426, 13, 1678, 736, 3454, 29961, 29900, 29962, 718, 318, 29915, 4286, 7122, 29898, 12791, 718, 1196, 363, 1196, 297, 3454, 29961, 29896, 13018, 29896, 2314, 718, 3454, 14352, 29896, 29962, 13, 13, 13, 1753, 29536, 29918, 1761, 29898, 726, 29892, 7164, 29922, 29884, 29915, 29871, 525, 1125, 13, 1678, 736, 518, 12791, 718, 1196, 363, 1196, 297, 1426, 29889, 5451, 9012, 580, 29962, 13, 13, 13, 1753, 29536, 29898, 726, 29892, 7164, 29922, 29884, 29915, 29871, 525, 1125, 13, 1678, 736, 318, 12764, 29876, 4286, 7122, 29898, 12860, 29918, 1761, 29898, 726, 29892, 7164, 876, 13, 13, 13, 29937, 3645, 2045, 597, 2417, 29889, 510, 29914, 29874, 29914, 29896, 29946, 29929, 29946, 29945, 29896, 29929, 29945, 29914, 29947, 29929, 29906, 29946, 29953, 29896, 29946, 13, 1753, 274, 407, 29918, 1807, 29918, 21587, 29898, 1807, 29892, 8025, 2433, 9420, 29899, 29947, 29374, 13, 1678, 565, 338, 8758, 29898, 1807, 29892, 1426, 29918, 1853, 1125, 13, 4706, 1347, 353, 1347, 29889, 12508, 29898, 22331, 29897, 13, 1678, 1121, 353, 6629, 13, 1678, 363, 2931, 297, 1347, 29901, 13, 4706, 565, 8519, 29918, 20055, 29906, 29901, 13, 9651, 2931, 353, 4356, 29898, 18609, 29897, 13, 4706, 565, 451, 313, 29941, 29906, 5277, 2931, 529, 29871, 29896, 29906, 29955, 29897, 470, 2931, 297, 6702, 1966, 742, 18793, 29374, 13, 9651, 1121, 4619, 525, 1966, 29995, 29900, 29941, 29877, 29915, 1273, 2931, 13, 4706, 1683, 29901, 13, 9651, 1121, 4619, 18460, 29898, 18609, 29897, 13, 1678, 736, 18793, 29915, 718, 1121, 718, 18793, 29915, 13, 13, 13, 1753, 2927, 29898, 1552, 29918, 2780, 29892, 2643, 2433, 29374, 13, 1678, 515, 2927, 1188, 29889, 21587, 29918, 18137, 1053, 10169, 29918, 18137, 29892, 6088, 29918, 27703, 13, 13, 1678, 565, 451, 2643, 29901, 13, 4706, 620, 353, 6088, 29918, 27703, 29898, 1552, 29918, 2780, 29897, 13, 1678, 1683, 29901, 13, 4706, 620, 353, 6088, 29918, 27703, 29898, 1552, 29918, 2780, 29897, 718, 2643, 718, 10169, 29918, 18137, 1839, 12071, 2033, 13, 13, 1678, 736, 620, 13, 13, 13, 1753, 1065, 29918, 5205, 29918, 6519, 10456, 5085, 1125, 13, 1678, 282, 353, 1014, 5014, 29889, 29925, 3150, 29898, 5085, 29892, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29892, 380, 20405, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 1678, 27591, 29892, 380, 20405, 353, 282, 29889, 27820, 403, 580, 13, 1678, 364, 29883, 353, 282, 29889, 2457, 401, 13, 1678, 736, 364, 29883, 29892, 27591, 29892, 380, 20405, 13, 13, 13, 1753, 29356, 29918, 29886, 29898, 2084, 1125, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 2084, 29897, 13, 1678, 5174, 438, 29173, 408, 5566, 29901, 13, 4706, 565, 5566, 29889, 3127, 1217, 1275, 4589, 1217, 29889, 29923, 5746, 9047, 322, 2897, 29889, 2084, 29889, 275, 3972, 29898, 2084, 1125, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 12020, 13, 13, 13, 1753, 338, 29918, 666, 29918, 7328, 29898, 3069, 1125, 13, 1678, 5633, 353, 3495, 29889, 5451, 12839, 1495, 13, 1678, 565, 7431, 29898, 20895, 29897, 2804, 29871, 29946, 29901, 13, 4706, 736, 7700, 13, 1678, 1018, 29901, 13, 4706, 363, 282, 297, 5633, 29901, 13, 9651, 938, 29898, 29886, 29897, 13, 4706, 736, 5852, 13, 1678, 5174, 7865, 2392, 29901, 13, 4706, 736, 7700, 13, 13, 13, 1753, 8814, 29918, 666, 29918, 7328, 29898, 3069, 1125, 13, 1678, 1018, 29901, 13, 4706, 10377, 353, 9909, 29889, 29887, 621, 520, 29890, 948, 420, 29898, 3069, 29897, 13, 1678, 5174, 9909, 29889, 2704, 408, 4589, 29901, 13, 4706, 515, 831, 561, 608, 25162, 29889, 3221, 1053, 3423, 561, 608, 25162, 2392, 13, 13, 4706, 12020, 3423, 561, 608, 25162, 2392, 703, 2392, 3770, 1747, 5641, 3211, 29901, 6571, 1642, 4830, 29898, 3127, 876, 13, 13, 1678, 736, 10377, 13, 2 ]
run_vn_baselines.py
netlab-lcy/CMIX
1
58237
<gh_stars>1-10 ''' argv[1]: log_dir path argv[2]: the VNEnv pickle instance path ''' from baselines.algorithm import * from envs.vn_env import VNEnv from utils.utils import cleanup_dir import sys import pickle import time scheme_list = ["no_relay", "max_SINR", "DCRA", "min_latency", "greedy"] log_dir = sys.argv[1] cleanup_dir(log_dir) load_env_file = open(sys.argv[2], "rb") env = pickle.load(load_env_file) load_env_file.close() env.reset() env.set_scheme("basic") store_env_file = open("%s/env.pickle" % (log_dir), "wb") pickle.dump(env, store_env_file) store_env_file.close() file_out = open("%s/result.log" % (log_dir), "w") # Average q value not applied in this work print("Average data rate, Global utility, Jains index, Average latency, Peak violation, Average constraint q value, Geo mean, Number of vehicles, Running time", file = file_out) for scheme in scheme_list: if scheme == "no_relay": t0 = time.time() ave_rate, utility_sum, Jains_index, ave_latency_whole, peak_violation_sum, q_ave_val, geo_mean, n_vehicle_net = no_relay(env) t1 = time.time() print("no_relay:", round(ave_rate, 2), round(utility_sum, 2), round(Jains_index, 4), round(ave_latency_whole, 2), peak_violation_sum, round(q_ave_val, 2), round(geo_mean, 3), n_vehicle_net, t1-t0, file = file_out) elif scheme == "max_SINR": t0 = time.time() ave_rate, utility_sum, Jains_index, ave_latency_whole, peak_violation_sum, q_ave_val, geo_mean, n_vehicle_net = max_SINR(env) t1 = time.time() print("max_SINR:", round(ave_rate, 2), round(utility_sum, 2), round(Jains_index, 4), round(ave_latency_whole, 2), peak_violation_sum, round(q_ave_val, 2), round(geo_mean, 3), n_vehicle_net, t1-t0, file = file_out) elif scheme == "DCRA": t0 = time.time() ave_rate, utility_sum, Jains_index, ave_latency_whole, peak_violation_sum, q_ave_val, geo_mean, n_vehicle_net = DCRA(env) t1 = time.time() print("DCRA:", round(ave_rate, 2), round(utility_sum, 2), round(Jains_index, 4), round(ave_latency_whole, 2), peak_violation_sum, round(q_ave_val, 2), round(geo_mean, 3), n_vehicle_net, t1-t0, file = file_out) elif scheme == "greedy": t0 = time.time() ave_rate, utility_sum, Jains_index, ave_latency_whole, peak_violation_sum, q_ave_val, geo_mean, n_vehicle_net = greedy(env) t1 = time.time() print("greedy:", round(ave_rate, 2), round(utility_sum, 2), round(Jains_index, 4), round(ave_latency_whole, 2), peak_violation_sum, round(q_ave_val, 2), round(geo_mean, 3), n_vehicle_net, t1-t0, file = file_out) elif scheme == "min_latency": t0 = time.time() ave_rate, utility_sum, Jains_index, ave_latency_whole, peak_violation_sum, q_ave_val, geo_mean, n_vehicle_net = min_latency(env) t1 = time.time() print("min_latency:", round(ave_rate, 2), round(utility_sum, 2), round(Jains_index, 4), round(ave_latency_whole, 2), peak_violation_sum, round(q_ave_val, 2), round(geo_mean, 3), n_vehicle_net, t1-t0, file = file_out)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 12008, 13, 19218, 29961, 29896, 5387, 1480, 29918, 3972, 2224, 13, 19218, 29961, 29906, 5387, 278, 478, 29940, 21745, 5839, 280, 2777, 2224, 13, 12008, 13, 3166, 2362, 24210, 29889, 20567, 1053, 334, 13, 3166, 427, 4270, 29889, 18564, 29918, 6272, 1053, 478, 29940, 21745, 13, 3166, 3667, 29879, 29889, 13239, 1053, 5941, 786, 29918, 3972, 13, 13, 5215, 10876, 13, 5215, 5839, 280, 13, 5215, 931, 13, 13, 816, 2004, 29918, 1761, 353, 6796, 1217, 29918, 2674, 388, 613, 376, 3317, 29918, 29903, 1177, 29934, 613, 376, 12696, 4717, 613, 376, 1195, 29918, 29880, 2579, 1270, 613, 376, 7979, 7584, 3108, 13, 13, 1188, 29918, 3972, 353, 10876, 29889, 19218, 29961, 29896, 29962, 268, 13, 14941, 786, 29918, 3972, 29898, 1188, 29918, 3972, 29897, 13, 13, 1359, 29918, 6272, 29918, 1445, 353, 1722, 29898, 9675, 29889, 19218, 29961, 29906, 1402, 376, 6050, 1159, 13, 6272, 353, 5839, 280, 29889, 1359, 29898, 1359, 29918, 6272, 29918, 1445, 29897, 13, 1359, 29918, 6272, 29918, 1445, 29889, 5358, 580, 13, 6272, 29889, 12071, 580, 13, 6272, 29889, 842, 29918, 816, 2004, 703, 16121, 1159, 13, 13, 8899, 29918, 6272, 29918, 1445, 353, 1722, 11702, 29879, 29914, 6272, 29889, 23945, 280, 29908, 1273, 313, 1188, 29918, 3972, 511, 376, 29893, 29890, 1159, 13, 23945, 280, 29889, 15070, 29898, 6272, 29892, 3787, 29918, 6272, 29918, 1445, 29897, 13, 8899, 29918, 6272, 29918, 1445, 29889, 5358, 580, 13, 13, 1445, 29918, 449, 353, 1722, 11702, 29879, 29914, 2914, 29889, 1188, 29908, 1273, 313, 1188, 29918, 3972, 511, 376, 29893, 1159, 13, 13, 29937, 319, 19698, 3855, 995, 451, 7436, 297, 445, 664, 13, 2158, 703, 29909, 19698, 848, 6554, 29892, 12002, 19725, 29892, 435, 2708, 2380, 29892, 319, 19698, 23316, 1270, 29892, 3938, 557, 5537, 362, 29892, 319, 19698, 7276, 3855, 995, 29892, 1879, 29877, 2099, 29892, 9681, 310, 24413, 29892, 19509, 931, 613, 934, 353, 934, 29918, 449, 29897, 13, 1454, 11380, 297, 11380, 29918, 1761, 29901, 13, 1678, 565, 11380, 1275, 376, 1217, 29918, 2674, 388, 1115, 13, 4706, 260, 29900, 353, 931, 29889, 2230, 580, 13, 4706, 8992, 29918, 10492, 29892, 19725, 29918, 2083, 29892, 435, 2708, 29918, 2248, 29892, 8992, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 3855, 29918, 1351, 29918, 791, 29892, 1737, 29877, 29918, 12676, 29892, 302, 29918, 345, 29882, 2512, 29918, 1212, 353, 694, 29918, 2674, 388, 29898, 6272, 29897, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 1596, 703, 1217, 29918, 2674, 388, 29901, 613, 4513, 29898, 1351, 29918, 10492, 29892, 29871, 29906, 511, 4513, 29898, 329, 1793, 29918, 2083, 29892, 29871, 29906, 511, 4513, 29898, 29967, 2708, 29918, 2248, 29892, 29871, 29946, 511, 4513, 29898, 1351, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 29871, 29906, 511, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 4513, 29898, 29939, 29918, 1351, 29918, 791, 29892, 29871, 29906, 511, 4513, 29898, 24756, 29918, 12676, 29892, 29871, 29941, 511, 302, 29918, 345, 29882, 2512, 29918, 1212, 29892, 260, 29896, 29899, 29873, 29900, 29892, 934, 353, 934, 29918, 449, 29897, 13, 1678, 25342, 11380, 1275, 376, 3317, 29918, 29903, 1177, 29934, 1115, 13, 4706, 260, 29900, 353, 931, 29889, 2230, 580, 13, 4706, 8992, 29918, 10492, 29892, 19725, 29918, 2083, 29892, 435, 2708, 29918, 2248, 29892, 8992, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 3855, 29918, 1351, 29918, 791, 29892, 1737, 29877, 29918, 12676, 29892, 302, 29918, 345, 29882, 2512, 29918, 1212, 353, 4236, 29918, 29903, 1177, 29934, 29898, 6272, 29897, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 1596, 703, 3317, 29918, 29903, 1177, 29934, 29901, 613, 4513, 29898, 1351, 29918, 10492, 29892, 29871, 29906, 511, 4513, 29898, 329, 1793, 29918, 2083, 29892, 29871, 29906, 511, 4513, 29898, 29967, 2708, 29918, 2248, 29892, 29871, 29946, 511, 4513, 29898, 1351, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 29871, 29906, 511, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 4513, 29898, 29939, 29918, 1351, 29918, 791, 29892, 29871, 29906, 511, 4513, 29898, 24756, 29918, 12676, 29892, 29871, 29941, 511, 302, 29918, 345, 29882, 2512, 29918, 1212, 29892, 260, 29896, 29899, 29873, 29900, 29892, 934, 353, 934, 29918, 449, 29897, 13, 1678, 25342, 11380, 1275, 376, 12696, 4717, 1115, 13, 4706, 260, 29900, 353, 931, 29889, 2230, 580, 13, 4706, 8992, 29918, 10492, 29892, 19725, 29918, 2083, 29892, 435, 2708, 29918, 2248, 29892, 8992, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 3855, 29918, 1351, 29918, 791, 29892, 1737, 29877, 29918, 12676, 29892, 302, 29918, 345, 29882, 2512, 29918, 1212, 353, 13681, 4717, 29898, 6272, 29897, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 1596, 703, 12696, 4717, 29901, 613, 4513, 29898, 1351, 29918, 10492, 29892, 29871, 29906, 511, 4513, 29898, 329, 1793, 29918, 2083, 29892, 29871, 29906, 511, 4513, 29898, 29967, 2708, 29918, 2248, 29892, 29871, 29946, 511, 4513, 29898, 1351, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 29871, 29906, 511, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 4513, 29898, 29939, 29918, 1351, 29918, 791, 29892, 29871, 29906, 511, 4513, 29898, 24756, 29918, 12676, 29892, 29871, 29941, 511, 302, 29918, 345, 29882, 2512, 29918, 1212, 29892, 260, 29896, 29899, 29873, 29900, 29892, 934, 353, 934, 29918, 449, 29897, 13, 1678, 25342, 11380, 1275, 376, 7979, 7584, 1115, 13, 4706, 260, 29900, 353, 931, 29889, 2230, 580, 13, 4706, 8992, 29918, 10492, 29892, 19725, 29918, 2083, 29892, 435, 2708, 29918, 2248, 29892, 8992, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 3855, 29918, 1351, 29918, 791, 29892, 1737, 29877, 29918, 12676, 29892, 302, 29918, 345, 29882, 2512, 29918, 1212, 353, 1395, 7584, 29898, 6272, 29897, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 1596, 703, 7979, 7584, 29901, 613, 4513, 29898, 1351, 29918, 10492, 29892, 29871, 29906, 511, 4513, 29898, 329, 1793, 29918, 2083, 29892, 29871, 29906, 511, 4513, 29898, 29967, 2708, 29918, 2248, 29892, 29871, 29946, 511, 4513, 29898, 1351, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 29871, 29906, 511, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 4513, 29898, 29939, 29918, 1351, 29918, 791, 29892, 29871, 29906, 511, 4513, 29898, 24756, 29918, 12676, 29892, 29871, 29941, 511, 302, 29918, 345, 29882, 2512, 29918, 1212, 29892, 260, 29896, 29899, 29873, 29900, 29892, 934, 353, 934, 29918, 449, 29897, 13, 1678, 25342, 11380, 1275, 376, 1195, 29918, 29880, 2579, 1270, 1115, 13, 4706, 260, 29900, 353, 931, 29889, 2230, 580, 13, 4706, 8992, 29918, 10492, 29892, 19725, 29918, 2083, 29892, 435, 2708, 29918, 2248, 29892, 8992, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 3855, 29918, 1351, 29918, 791, 29892, 1737, 29877, 29918, 12676, 29892, 302, 29918, 345, 29882, 2512, 29918, 1212, 353, 1375, 29918, 29880, 2579, 1270, 29898, 6272, 29897, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 1596, 703, 1195, 29918, 29880, 2579, 1270, 29901, 613, 4513, 29898, 1351, 29918, 10492, 29892, 29871, 29906, 511, 4513, 29898, 329, 1793, 29918, 2083, 29892, 29871, 29906, 511, 4513, 29898, 29967, 2708, 29918, 2248, 29892, 29871, 29946, 511, 4513, 29898, 1351, 29918, 29880, 2579, 1270, 29918, 15970, 280, 29892, 29871, 29906, 511, 19224, 29918, 1403, 22671, 29918, 2083, 29892, 4513, 29898, 29939, 29918, 1351, 29918, 791, 29892, 29871, 29906, 511, 4513, 29898, 24756, 29918, 12676, 29892, 29871, 29941, 511, 302, 29918, 345, 29882, 2512, 29918, 1212, 29892, 260, 29896, 29899, 29873, 29900, 29892, 934, 353, 934, 29918, 449, 29897, 13, 268, 13, 13, 13, 2 ]
wandb/sklearn/calculate/outlier_candidates.py
soumik12345/client
0
135718
<reponame>soumik12345/client from warnings import simplefilter import numpy as np import wandb from wandb.sklearn import utils # ignore all future warnings simplefilter(action="ignore", category=FutureWarning) def outlier_candidates(regressor, X, y): # Fit a linear model to X and y to compute MSE regressor.fit(X, y) # Leverage is computed as the diagonal of the projection matrix of X leverage = (X * np.linalg.pinv(X).T).sum(1) # Compute the rank and the degrees of freedom of the OLS model rank = np.linalg.matrix_rank(X) df = X.shape[0] - rank # Compute the MSE from the residuals residuals = y - regressor.predict(X) mse = np.dot(residuals, residuals) / df # Compute Cook's distance residuals_studentized = residuals / np.sqrt(mse) / np.sqrt(1 - leverage) distance_ = residuals_studentized**2 / X.shape[1] distance_ *= leverage / (1 - leverage) # Compute the influence threshold rule of thumb influence_threshold_ = 4 / X.shape[0] outlier_percentage_ = sum(distance_ >= influence_threshold_) / X.shape[0] outlier_percentage_ *= 100.0 distance_dict, count = [], 0 for d in distance_: distance_dict.append(d) count += 1 if utils.check_against_limit( count, "outlier_candidates", utils.chart_limit, ): break table = make_table(distance_dict, outlier_percentage_, influence_threshold_) chart = wandb.visualize("wandb/outliers/v1", table) return chart def make_table(distance, outlier_percentage, influence_threshold): columns = [ "distance", "instance_indicies", "outlier_percentage", "influence_threshold", ] data = [ [distance[i], i, utils.round_3(outlier_percentage), influence_threshold] for i in range(len(distance)) ] table = wandb.Table(columns=columns, data=data) return table
[ 1, 529, 276, 1112, 420, 29958, 29879, 283, 29885, 638, 29896, 29906, 29941, 29946, 29945, 29914, 4645, 13, 3166, 18116, 1053, 2560, 4572, 13, 13, 5215, 12655, 408, 7442, 13, 13, 5215, 24706, 29890, 13, 3166, 24706, 29890, 29889, 808, 19668, 1053, 3667, 29879, 13, 13, 29937, 11455, 599, 5434, 18116, 13, 12857, 4572, 29898, 2467, 543, 17281, 613, 7663, 29922, 20154, 22709, 29897, 13, 13, 13, 1753, 714, 4926, 29918, 29883, 5380, 1078, 29898, 276, 3663, 272, 29892, 1060, 29892, 343, 1125, 13, 1678, 396, 383, 277, 263, 5608, 1904, 304, 1060, 322, 343, 304, 10272, 341, 1660, 13, 1678, 337, 3663, 272, 29889, 9202, 29898, 29990, 29892, 343, 29897, 13, 13, 1678, 396, 951, 19698, 338, 15712, 408, 278, 19640, 310, 278, 18246, 4636, 310, 1060, 13, 1678, 454, 19698, 353, 313, 29990, 334, 7442, 29889, 29880, 979, 29887, 29889, 29886, 11569, 29898, 29990, 467, 29911, 467, 2083, 29898, 29896, 29897, 13, 13, 1678, 396, 11796, 29872, 278, 7115, 322, 278, 14496, 310, 16082, 310, 278, 438, 8547, 1904, 13, 1678, 7115, 353, 7442, 29889, 29880, 979, 29887, 29889, 5344, 29918, 10003, 29898, 29990, 29897, 13, 1678, 4489, 353, 1060, 29889, 12181, 29961, 29900, 29962, 448, 7115, 13, 13, 1678, 396, 11796, 29872, 278, 341, 1660, 515, 278, 10995, 27101, 13, 1678, 10995, 27101, 353, 343, 448, 337, 3663, 272, 29889, 27711, 29898, 29990, 29897, 13, 1678, 286, 344, 353, 7442, 29889, 6333, 29898, 690, 333, 27101, 29892, 10995, 27101, 29897, 847, 4489, 13, 13, 1678, 396, 11796, 29872, 17278, 29915, 29879, 5418, 13, 1678, 10995, 27101, 29918, 18945, 1891, 353, 10995, 27101, 847, 7442, 29889, 3676, 29898, 29885, 344, 29897, 847, 7442, 29889, 3676, 29898, 29896, 448, 454, 19698, 29897, 13, 1678, 5418, 29918, 353, 10995, 27101, 29918, 18945, 1891, 1068, 29906, 847, 1060, 29889, 12181, 29961, 29896, 29962, 13, 1678, 5418, 29918, 334, 29922, 454, 19698, 847, 313, 29896, 448, 454, 19698, 29897, 13, 13, 1678, 396, 11796, 29872, 278, 9949, 16897, 5751, 310, 28968, 13, 1678, 9949, 29918, 386, 12268, 29918, 353, 29871, 29946, 847, 1060, 29889, 12181, 29961, 29900, 29962, 13, 1678, 714, 4926, 29918, 25376, 482, 29918, 353, 2533, 29898, 19244, 29918, 6736, 9949, 29918, 386, 12268, 19925, 847, 1060, 29889, 12181, 29961, 29900, 29962, 13, 1678, 714, 4926, 29918, 25376, 482, 29918, 334, 29922, 29871, 29896, 29900, 29900, 29889, 29900, 13, 13, 1678, 5418, 29918, 8977, 29892, 2302, 353, 19997, 29871, 29900, 13, 1678, 363, 270, 297, 5418, 29918, 29901, 13, 4706, 5418, 29918, 8977, 29889, 4397, 29898, 29881, 29897, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 565, 3667, 29879, 29889, 3198, 29918, 351, 475, 303, 29918, 13400, 29898, 13, 9651, 2302, 29892, 13, 9651, 376, 449, 4926, 29918, 29883, 5380, 1078, 613, 13, 9651, 3667, 29879, 29889, 15425, 29918, 13400, 29892, 13, 308, 1125, 13, 9651, 2867, 13, 13, 1678, 1591, 353, 1207, 29918, 2371, 29898, 19244, 29918, 8977, 29892, 714, 4926, 29918, 25376, 482, 3383, 9949, 29918, 386, 12268, 19925, 13, 1678, 8727, 353, 24706, 29890, 29889, 20119, 675, 703, 18622, 29890, 29914, 449, 27801, 29914, 29894, 29896, 613, 1591, 29897, 13, 13, 1678, 736, 8727, 13, 13, 13, 1753, 1207, 29918, 2371, 29898, 19244, 29892, 714, 4926, 29918, 25376, 482, 29892, 9949, 29918, 386, 12268, 1125, 13, 1678, 4341, 353, 518, 13, 4706, 376, 19244, 613, 13, 4706, 376, 8758, 29918, 513, 293, 583, 613, 13, 4706, 376, 449, 4926, 29918, 25376, 482, 613, 13, 4706, 376, 13453, 29884, 663, 29918, 386, 12268, 613, 13, 1678, 4514, 13, 13, 1678, 848, 353, 518, 13, 4706, 518, 19244, 29961, 29875, 1402, 474, 29892, 3667, 29879, 29889, 14486, 29918, 29941, 29898, 449, 4926, 29918, 25376, 482, 511, 9949, 29918, 386, 12268, 29962, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 19244, 876, 13, 1678, 4514, 13, 13, 1678, 1591, 353, 24706, 29890, 29889, 3562, 29898, 13099, 29922, 13099, 29892, 848, 29922, 1272, 29897, 13, 13, 1678, 736, 1591, 13, 2 ]
setup.py
marchete/django-adldap-sync
5
194545
#!/usr/bin/env python from setuptools import find_packages from setuptools import setup from adldap_sync import __version__ as version with open('README.md') as f: readme = f.read() setup( name='django-adldap-sync', version=version, description='A Django application for synchronizing LDAP users, groups and group memberships', long_description=readme, license='BSD', author='Marchete', author_email='<EMAIL>', url='https://github.com/marchete/django-adldap-sync', download_url='https://github.com/marchete/django-adldap-sync', packages=find_packages(), include_package_data=True, install_requires=['pyldap>=2.4.25.1'], classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Web Environment', 'Programming Language :: Python', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: System :: Systems Administration :: Authentication/Directory', ], keywords=['django', 'ldap', 'active directory', 'synchronize', 'sync'], )
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 3166, 731, 21245, 8789, 1053, 1284, 29918, 8318, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 3166, 594, 430, 481, 29918, 16593, 1053, 4770, 3259, 1649, 408, 1873, 13, 13, 13, 2541, 1722, 877, 16310, 2303, 29889, 3487, 1495, 408, 285, 29901, 13, 1678, 1303, 1004, 353, 285, 29889, 949, 580, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 14095, 29899, 328, 430, 481, 29899, 16593, 742, 13, 1678, 1873, 29922, 3259, 29892, 13, 1678, 6139, 2433, 29909, 15337, 2280, 363, 12231, 5281, 365, 29928, 3301, 4160, 29892, 6471, 322, 2318, 5144, 14587, 742, 13, 1678, 1472, 29918, 8216, 29922, 949, 1004, 29892, 13, 1678, 19405, 2433, 29933, 7230, 742, 13, 1678, 4148, 2433, 29924, 1279, 2650, 742, 13, 1678, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 29885, 1279, 2650, 29914, 14095, 29899, 328, 430, 481, 29899, 16593, 742, 13, 1678, 5142, 29918, 2271, 2433, 991, 597, 3292, 29889, 510, 29914, 29885, 1279, 2650, 29914, 14095, 29899, 328, 430, 481, 29899, 16593, 742, 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, 29922, 1839, 2272, 430, 481, 18572, 29906, 29889, 29946, 29889, 29906, 29945, 29889, 29896, 7464, 13, 1678, 770, 14903, 11759, 13, 4706, 525, 21956, 358, 16034, 4761, 29871, 29941, 448, 838, 2026, 742, 13, 4706, 525, 18649, 4761, 2563, 16738, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 742, 13, 4706, 525, 16660, 4761, 15337, 742, 13, 4706, 525, 2928, 2760, 319, 4749, 663, 4761, 10682, 414, 742, 13, 4706, 525, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 350, 7230, 19245, 742, 13, 4706, 525, 7094, 1218, 2184, 4761, 6570, 25266, 742, 13, 4706, 525, 7031, 293, 4761, 18540, 14650, 4761, 365, 4626, 4314, 4761, 5132, 3382, 2540, 742, 13, 4706, 525, 7031, 293, 4761, 2184, 4761, 23985, 23303, 4761, 27241, 29914, 9882, 742, 13, 1678, 21251, 13, 1678, 29361, 29922, 1839, 14095, 742, 525, 430, 481, 742, 525, 4925, 3884, 742, 525, 29879, 9524, 675, 742, 525, 16593, 7464, 13, 29897, 13, 2 ]
pysal/spatial_dynamics/tests/test_directional.py
cubensys/pysal
0
78939
<reponame>cubensys/pysal import unittest import pysal from pysal.spatial_dynamics import directional import numpy as np class Rose_Tester(unittest.TestCase): def setUp(self): f = open(pysal.examples.get_path("spi_download.csv"), 'r') lines = f.readlines() f.close() lines = [line.strip().split(",") for line in lines] names = [line[2] for line in lines[1:-5]] data = np.array([map(int, line[3:]) for line in lines[1:-5]]) sids = range(60) out = ['"United States 3/"', '"Alaska 3/"', '"District of Columbia"', '"Hawaii 3/"', '"New England"', '"Mideast"', '"Great Lakes"', '"Plains"', '"Southeast"', '"Southwest"', '"Rocky Mountain"', '"Far West 3/"'] snames = [name for name in names if name not in out] sids = [names.index(name) for name in snames] states = data[sids, :] us = data[0] years = np.arange(1969, 2009) rel = states / (us * 1.) gal = pysal.open(pysal.examples.get_path('states48.gal')) self.w = gal.read() self.w.transform = 'r' self.Y = rel[:, [0, -1]] def test_rose(self): k = 4 np.random.seed(100) r4 = directional.rose(self.Y, self.w, k, permutations=999) exp = [0., 1.57079633, 3.14159265, 4.71238898, 6.28318531] obs = list(r4['cuts']) for i in range(k + 1): self.assertAlmostEqual(exp[i], obs[i]) self.assertEquals(list(r4['counts']), [32, 5, 9, 2]) exp = [0.02, 0.001, 0.001, 0.001] obs = list(r4['pvalues']) for i in range(k): self.assertAlmostEqual(exp[i], obs[i]) suite = unittest.TestSuite() test_classes = [Rose_Tester] for i in test_classes: a = unittest.TestLoader().loadTestsFromTestCase(i) suite.addTest(a) if __name__ == '__main__': runner = unittest.TextTestRunner() runner.run(suite)
[ 1, 529, 276, 1112, 420, 29958, 29883, 431, 575, 952, 29914, 29886, 952, 284, 13, 5215, 443, 27958, 13, 5215, 282, 952, 284, 13, 3166, 282, 952, 284, 29889, 1028, 15238, 29918, 29881, 2926, 1199, 1053, 5305, 284, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1990, 14008, 29918, 3057, 261, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 285, 353, 1722, 29898, 29886, 952, 284, 29889, 19057, 29889, 657, 29918, 2084, 703, 1028, 29875, 29918, 10382, 29889, 7638, 4968, 525, 29878, 1495, 13, 4706, 3454, 353, 285, 29889, 949, 9012, 580, 13, 4706, 285, 29889, 5358, 580, 13, 4706, 3454, 353, 518, 1220, 29889, 17010, 2141, 5451, 28165, 1159, 363, 1196, 297, 3454, 29962, 13, 4706, 2983, 353, 518, 1220, 29961, 29906, 29962, 363, 1196, 297, 3454, 29961, 29896, 13018, 29945, 5262, 13, 4706, 848, 353, 7442, 29889, 2378, 4197, 1958, 29898, 524, 29892, 1196, 29961, 29941, 29901, 2314, 363, 1196, 297, 3454, 29961, 29896, 13018, 29945, 24960, 13, 4706, 269, 4841, 353, 3464, 29898, 29953, 29900, 29897, 13, 4706, 714, 353, 6024, 29908, 2525, 1573, 3900, 29871, 29941, 12975, 742, 13, 1669, 18793, 2499, 16191, 29871, 29941, 12975, 742, 13, 1669, 18793, 29928, 6801, 310, 15411, 29908, 742, 13, 1669, 18793, 29950, 1450, 1794, 29875, 29871, 29941, 12975, 742, 13, 1669, 18793, 4373, 5408, 29908, 742, 13, 1669, 18793, 29924, 680, 579, 29908, 742, 13, 1669, 18793, 25120, 271, 365, 6926, 29908, 742, 13, 1669, 18793, 29925, 433, 1144, 29908, 742, 13, 1669, 18793, 29903, 449, 15879, 29908, 742, 13, 1669, 18793, 29903, 2438, 5933, 29908, 742, 13, 1669, 18793, 29934, 1698, 29891, 18204, 29908, 742, 13, 1669, 18793, 29943, 279, 3122, 29871, 29941, 12975, 2033, 13, 4706, 5807, 1280, 353, 518, 978, 363, 1024, 297, 2983, 565, 1024, 451, 297, 714, 29962, 13, 4706, 269, 4841, 353, 518, 7039, 29889, 2248, 29898, 978, 29897, 363, 1024, 297, 5807, 1280, 29962, 13, 4706, 5922, 353, 848, 29961, 29879, 4841, 29892, 584, 29962, 13, 4706, 502, 353, 848, 29961, 29900, 29962, 13, 4706, 2440, 353, 7442, 29889, 279, 927, 29898, 29896, 29929, 29953, 29929, 29892, 29871, 29906, 29900, 29900, 29929, 29897, 13, 4706, 1104, 353, 5922, 847, 313, 375, 334, 29871, 29896, 1846, 13, 4706, 6898, 353, 282, 952, 284, 29889, 3150, 29898, 29886, 952, 284, 29889, 19057, 29889, 657, 29918, 2084, 877, 28631, 29946, 29947, 29889, 23014, 8785, 13, 4706, 1583, 29889, 29893, 353, 6898, 29889, 949, 580, 13, 4706, 1583, 29889, 29893, 29889, 9067, 353, 525, 29878, 29915, 13, 4706, 1583, 29889, 29979, 353, 1104, 7503, 29892, 518, 29900, 29892, 448, 29896, 5262, 13, 13, 1678, 822, 1243, 29918, 17811, 29898, 1311, 1125, 13, 4706, 413, 353, 29871, 29946, 13, 4706, 7442, 29889, 8172, 29889, 26776, 29898, 29896, 29900, 29900, 29897, 13, 4706, 364, 29946, 353, 5305, 284, 29889, 17811, 29898, 1311, 29889, 29979, 29892, 1583, 29889, 29893, 29892, 413, 29892, 20005, 800, 29922, 29929, 29929, 29929, 29897, 13, 4706, 1518, 353, 518, 29900, 1696, 29871, 29896, 29889, 29945, 29955, 29900, 29955, 29929, 29953, 29941, 29941, 29892, 29871, 29941, 29889, 29896, 29946, 29896, 29945, 29929, 29906, 29953, 29945, 29892, 29871, 29946, 29889, 29955, 29896, 29906, 29941, 29947, 29947, 29929, 29947, 29892, 29871, 29953, 29889, 29906, 29947, 29941, 29896, 29947, 29945, 29941, 29896, 29962, 13, 4706, 20881, 353, 1051, 29898, 29878, 29946, 1839, 7582, 29879, 11287, 13, 4706, 363, 474, 297, 3464, 29898, 29895, 718, 29871, 29896, 1125, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 4548, 29961, 29875, 1402, 20881, 29961, 29875, 2314, 13, 4706, 1583, 29889, 9294, 14776, 29898, 1761, 29898, 29878, 29946, 1839, 2798, 29879, 2033, 511, 518, 29941, 29906, 29892, 29871, 29945, 29892, 29871, 29929, 29892, 29871, 29906, 2314, 13, 4706, 1518, 353, 518, 29900, 29889, 29900, 29906, 29892, 29871, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 29900, 29889, 29900, 29900, 29896, 29962, 13, 4706, 20881, 353, 1051, 29898, 29878, 29946, 1839, 29886, 5975, 11287, 13, 4706, 363, 474, 297, 3464, 29898, 29895, 1125, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 4548, 29961, 29875, 1402, 20881, 29961, 29875, 2314, 13, 13, 13, 13495, 353, 443, 27958, 29889, 3057, 5091, 568, 580, 13, 1688, 29918, 13203, 353, 518, 29934, 852, 29918, 3057, 261, 29962, 13, 1454, 474, 297, 1243, 29918, 13203, 29901, 13, 1678, 263, 353, 443, 27958, 29889, 3057, 10036, 2141, 1359, 24376, 4591, 3057, 8259, 29898, 29875, 29897, 13, 1678, 9460, 29889, 1202, 3057, 29898, 29874, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 28877, 353, 443, 27958, 29889, 1626, 3057, 16802, 580, 13, 1678, 28877, 29889, 3389, 29898, 13495, 29897, 13, 2 ]
nicos_mlz/delab/setups/qmesydaq.py
mlz-ictrl/nicos
12
163508
description = 'testing qmesydaq' group = 'optional' excludes = [] sysconfig = dict( datasinks = ['LiveViewSink'], ) tango_base = 'tango://localhost:10000/test/qmesydaq/' devices = dict( # RAWFileSaver = device('nicos.devices.datasinks.RawImageSink', # description = 'Saves image data in RAW format', # filenametemplate = [ # '%(proposal)s_%(pointcounter)06d.raw', # '%(proposal)s_%(scancounter)s_' # '%(pointcounter)s_%(pointnumber)s.raw'], # subdir = 'QMesyDAQ2', # lowlevel = True, # ), LiveViewSink = device('nicos.devices.datasinks.LiveViewSink', description = 'Sends image data to LiveViewWidget', ), qm_ctr0 = device('nicos.devices.entangle.CounterChannel', description = 'QMesyDAQ Counter0', tangodevice = tango_base + 'counter0', type = 'counter', lowlevel = True, ), qm_ctr1 = device('nicos.devices.entangle.CounterChannel', description = 'QMesyDAQ Counter1', tangodevice = tango_base + 'counter1', type = 'counter', lowlevel = True, ), qm_ctr2 = device('nicos.devices.entangle.CounterChannel', description = 'QMesyDAQ Counter2', tangodevice = tango_base + 'counter2', type = 'monitor', lowlevel = True, ), qm_ctr3 = device('nicos.devices.entangle.CounterChannel', description = 'QMesyDAQ Counter3', tangodevice = tango_base + 'counter3', type = 'monitor', lowlevel = True, ), qm_ev = device('nicos.devices.entangle.CounterChannel', description = 'QMesyDAQ Events channel', tangodevice = tango_base + 'events', type = 'counter', lowlevel = True, ), qm_timer = device('nicos.devices.entangle.TimerChannel', description = 'QMesyDAQ Timer', tangodevice = tango_base + 'timer', ), mesytec = device('nicos.devices.generic.Detector', description = 'QMesyDAQ Image type Detector', timers = ['qm_timer'], counters = [ 'qm_ev', # 'qm_ctr0', 'qm_ctr2' ], monitors = [ #'qm_ctr1', 'qm_ctr3' ], others = [], ), ) startupcode = ''' SetDetectors(mesytec) '''
[ 1, 6139, 353, 525, 13424, 3855, 4467, 29891, 1388, 29939, 29915, 13, 13, 2972, 353, 525, 25253, 29915, 13, 13, 735, 27722, 353, 5159, 13, 13, 9675, 2917, 353, 9657, 29898, 13, 1678, 6155, 19363, 353, 6024, 23859, 1043, 29903, 682, 7464, 13, 29897, 13, 13, 29873, 4524, 29918, 3188, 353, 525, 29873, 4524, 597, 7640, 29901, 29896, 29900, 29900, 29900, 29900, 29914, 1688, 29914, 29939, 4467, 29891, 1388, 29939, 22208, 13, 13, 3359, 1575, 353, 9657, 29898, 13, 1678, 396, 18865, 29956, 2283, 29903, 12483, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 14538, 19363, 29889, 22131, 2940, 29903, 682, 742, 13, 1678, 396, 268, 6139, 353, 525, 29903, 5989, 1967, 848, 297, 18865, 29956, 3402, 742, 13, 1678, 396, 268, 977, 264, 314, 300, 331, 2341, 353, 518, 13, 1678, 396, 308, 14210, 29898, 771, 1066, 284, 29897, 29879, 29918, 29995, 29898, 3149, 11808, 29897, 29900, 29953, 29881, 29889, 1610, 742, 13, 1678, 396, 308, 14210, 29898, 771, 1066, 284, 29897, 29879, 29918, 29995, 29898, 1557, 4564, 5336, 29897, 29879, 29918, 29915, 13, 1678, 396, 308, 14210, 29898, 3149, 11808, 29897, 29879, 29918, 29995, 29898, 3149, 4537, 29897, 29879, 29889, 1610, 7464, 13, 1678, 396, 268, 1014, 3972, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 29906, 742, 13, 1678, 396, 268, 4482, 5563, 353, 5852, 29892, 13, 1678, 396, 10353, 13, 1678, 10782, 1043, 29903, 682, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 14538, 19363, 29889, 23859, 1043, 29903, 682, 742, 13, 4706, 6139, 353, 525, 29903, 1975, 1967, 848, 304, 10782, 1043, 8801, 742, 13, 1678, 10353, 13, 1678, 3855, 29885, 29918, 9988, 29900, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 296, 2521, 29889, 17779, 13599, 742, 13, 4706, 6139, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 315, 5336, 29900, 742, 13, 4706, 18806, 356, 1087, 353, 260, 4524, 29918, 3188, 718, 525, 11808, 29900, 742, 13, 4706, 1134, 353, 525, 11808, 742, 13, 4706, 4482, 5563, 353, 5852, 29892, 13, 1678, 10353, 13, 1678, 3855, 29885, 29918, 9988, 29896, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 296, 2521, 29889, 17779, 13599, 742, 13, 4706, 6139, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 315, 5336, 29896, 742, 13, 4706, 18806, 356, 1087, 353, 260, 4524, 29918, 3188, 718, 525, 11808, 29896, 742, 13, 4706, 1134, 353, 525, 11808, 742, 13, 4706, 4482, 5563, 353, 5852, 29892, 13, 1678, 10353, 13, 1678, 3855, 29885, 29918, 9988, 29906, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 296, 2521, 29889, 17779, 13599, 742, 13, 4706, 6139, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 315, 5336, 29906, 742, 13, 4706, 18806, 356, 1087, 353, 260, 4524, 29918, 3188, 718, 525, 11808, 29906, 742, 13, 4706, 1134, 353, 525, 3712, 2105, 742, 13, 4706, 4482, 5563, 353, 5852, 29892, 13, 1678, 10353, 13, 1678, 3855, 29885, 29918, 9988, 29941, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 296, 2521, 29889, 17779, 13599, 742, 13, 4706, 6139, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 315, 5336, 29941, 742, 13, 4706, 18806, 356, 1087, 353, 260, 4524, 29918, 3188, 718, 525, 11808, 29941, 742, 13, 4706, 1134, 353, 525, 3712, 2105, 742, 13, 4706, 4482, 5563, 353, 5852, 29892, 13, 1678, 10353, 13, 1678, 3855, 29885, 29918, 5750, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 296, 2521, 29889, 17779, 13599, 742, 13, 4706, 6139, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 28488, 8242, 742, 13, 4706, 18806, 356, 1087, 353, 260, 4524, 29918, 3188, 718, 525, 13604, 742, 13, 4706, 1134, 353, 525, 11808, 742, 13, 4706, 4482, 5563, 353, 5852, 29892, 13, 1678, 10353, 13, 1678, 3855, 29885, 29918, 20404, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 296, 2521, 29889, 14745, 13599, 742, 13, 4706, 6139, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 29168, 742, 13, 4706, 18806, 356, 1087, 353, 260, 4524, 29918, 3188, 718, 525, 20404, 742, 13, 1678, 10353, 13, 1678, 4883, 29891, 371, 29883, 353, 4742, 877, 29876, 4869, 29889, 3359, 1575, 29889, 19206, 29889, 6362, 3019, 742, 13, 4706, 6139, 353, 525, 29984, 29924, 267, 29891, 7698, 29984, 7084, 1134, 5953, 3019, 742, 13, 4706, 5335, 414, 353, 6024, 29939, 29885, 29918, 20404, 7464, 13, 4706, 2613, 2153, 353, 518, 13, 9651, 525, 29939, 29885, 29918, 5750, 742, 13, 9651, 396, 525, 29939, 29885, 29918, 9988, 29900, 742, 29871, 525, 29939, 29885, 29918, 9988, 29906, 29915, 13, 4706, 21251, 13, 4706, 1601, 17259, 353, 518, 13, 9651, 396, 29915, 29939, 29885, 29918, 9988, 29896, 742, 29871, 525, 29939, 29885, 29918, 9988, 29941, 29915, 13, 4706, 21251, 13, 4706, 4045, 353, 19997, 13, 1678, 10353, 13, 29897, 13, 13, 2962, 786, 401, 353, 14550, 13, 2697, 6362, 11142, 29898, 4467, 29891, 371, 29883, 29897, 13, 12008, 13, 2 ]
XGBoosting/code.py
Aditya1231/ga-learner-dsmp-repo
0
136324
<reponame>Aditya1231/ga-learner-dsmp-repo # -------------- import pandas as pd from sklearn.model_selection import train_test_split #path - Path of file df = pd.read_csv(path) X = df.drop(['customerID','Churn'],axis=1) y = df['Churn'].copy() X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.3,random_state=0) # Code starts here # -------------- import numpy as np from sklearn.preprocessing import LabelEncoder X_train['TotalCharges'].replace(' ',np.NaN, inplace=True) X_test['TotalCharges'].replace(' ',np.NaN, inplace=True) X_train['TotalCharges'] = X_train['TotalCharges'].astype(float) X_train['TotalCharges'] = X_train['TotalCharges'].astype(float) X_test['TotalCharges'] = X_test['TotalCharges'].astype(float) X_train['TotalCharges'].fillna(X_train['TotalCharges'].mean(),inplace=True) X_test['TotalCharges'].fillna(X_test['TotalCharges'].mean(),inplace=True) print(X_train.isnull().sum()) cat_cols = X_train.select_dtypes(include='O').columns.tolist() for x in cat_cols: le=LabelEncoder() X_train[x] = le.fit_transform(X_train[x]) for x in cat_cols: le = LabelEncoder() X_test[x] = le.fit_transform(X_test[x]) dict1 = {'No':0, 'Yes':1} y_train = y_train.replace(dict1) y_test = y_test.replace(dict1) # Code starts here # -------------- from sklearn.ensemble import AdaBoostClassifier from sklearn.metrics import accuracy_score,classification_report,confusion_matrix # Code starts here print(X_train,X_test,y_train,y_test) ada_model = AdaBoostClassifier(random_state=0) ada_model.fit(X_train,y_train) y_pred = ada_model.predict(X_test) ada_score = accuracy_score(y_test,y_pred) ada_cm = confusion_matrix(y_test,y_pred) ada_cr = classification_report(y_test,y_pred) # -------------- from xgboost import XGBClassifier from sklearn.model_selection import GridSearchCV #Parameter list parameters={'learning_rate':[0.1,0.15,0.2,0.25,0.3], 'max_depth':range(1,3)} xgb_model = XGBClassifier(random_state=0) xgb_model.fit(X_train,y_train) y_pred = xgb_model.predict(X_test) xgb_score = accuracy_score(y_test,y_pred) print(xgb_score) xgb_cm = confusion_matrix(y_test,y_pred) print(xgb_cm) xgb_cr = classification_report(y_test,y_pred) print(xgb_cr) clf_model = GridSearchCV(estimator=xgb_model,param_grid=parameters) clf_model.fit(X_train,y_train) y_pred = clf_model.predict(X_test) clf_score = accuracy_score(y_test,y_pred) print(clf_score) clf_cm = confusion_matrix(y_test,y_pred) print(clf_cm) clf_cr = classification_report(y_test,y_pred) print(clf_cr) # Code starts here
[ 1, 529, 276, 1112, 420, 29958, 3253, 537, 29874, 29896, 29906, 29941, 29896, 29914, 3249, 29899, 1945, 1089, 29899, 6289, 1526, 29899, 20095, 13, 29937, 448, 9072, 29899, 13, 5215, 11701, 408, 10518, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 29937, 2084, 448, 10802, 310, 934, 29871, 13, 2176, 353, 10518, 29889, 949, 29918, 7638, 29898, 2084, 29897, 13, 13, 29990, 353, 4489, 29889, 8865, 18959, 15539, 1367, 3788, 1451, 595, 7464, 8990, 29922, 29896, 29897, 13, 13, 29891, 353, 4489, 1839, 1451, 595, 13359, 8552, 580, 13, 13, 29990, 29918, 14968, 29892, 29990, 29918, 1688, 29892, 29891, 29918, 14968, 29892, 29891, 29918, 1688, 353, 7945, 29918, 1688, 29918, 5451, 29898, 29990, 29892, 29891, 29892, 1688, 29918, 2311, 29922, 29900, 29889, 29941, 29892, 8172, 29918, 3859, 29922, 29900, 29897, 13, 13, 13, 29937, 5920, 8665, 1244, 13, 13, 13, 13, 13, 13, 29937, 448, 9072, 29899, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 15796, 8566, 6119, 13, 13, 29990, 29918, 14968, 1839, 11536, 1451, 1191, 267, 13359, 6506, 877, 13420, 9302, 29889, 19377, 29892, 297, 6689, 29922, 5574, 29897, 13, 13, 29990, 29918, 1688, 1839, 11536, 1451, 1191, 267, 13359, 6506, 877, 13420, 9302, 29889, 19377, 29892, 297, 6689, 29922, 5574, 29897, 13, 13, 29990, 29918, 14968, 1839, 11536, 1451, 1191, 267, 2033, 353, 1060, 29918, 14968, 1839, 11536, 1451, 1191, 267, 13359, 579, 668, 29898, 7411, 29897, 13, 13, 29990, 29918, 14968, 1839, 11536, 1451, 1191, 267, 2033, 353, 1060, 29918, 14968, 1839, 11536, 1451, 1191, 267, 13359, 579, 668, 29898, 7411, 29897, 13, 29990, 29918, 1688, 1839, 11536, 1451, 1191, 267, 2033, 353, 1060, 29918, 1688, 1839, 11536, 1451, 1191, 267, 13359, 579, 668, 29898, 7411, 29897, 13, 13, 29990, 29918, 14968, 1839, 11536, 1451, 1191, 267, 13359, 5589, 1056, 29898, 29990, 29918, 14968, 1839, 11536, 1451, 1191, 267, 13359, 12676, 3285, 262, 6689, 29922, 5574, 29897, 13, 29990, 29918, 1688, 1839, 11536, 1451, 1191, 267, 13359, 5589, 1056, 29898, 29990, 29918, 1688, 1839, 11536, 1451, 1191, 267, 13359, 12676, 3285, 262, 6689, 29922, 5574, 29897, 13, 13, 2158, 29898, 29990, 29918, 14968, 29889, 275, 4304, 2141, 2083, 3101, 13, 13, 4117, 29918, 22724, 353, 1060, 29918, 14968, 29889, 2622, 29918, 29881, 8768, 29898, 2856, 2433, 29949, 2824, 13099, 29889, 25027, 391, 580, 13, 13, 1454, 921, 297, 6635, 29918, 22724, 29901, 13, 1678, 454, 29922, 4775, 8566, 6119, 580, 13, 1678, 1060, 29918, 14968, 29961, 29916, 29962, 353, 454, 29889, 9202, 29918, 9067, 29898, 29990, 29918, 14968, 29961, 29916, 2314, 13, 1454, 921, 297, 6635, 29918, 22724, 29901, 13, 1678, 454, 353, 15796, 8566, 6119, 580, 268, 13, 1678, 1060, 29918, 1688, 29961, 29916, 29962, 353, 454, 29889, 9202, 29918, 9067, 29898, 29990, 29918, 1688, 29961, 29916, 2314, 13, 8977, 29896, 353, 11117, 3782, 2396, 29900, 29892, 525, 8241, 2396, 29896, 29913, 13, 13, 29891, 29918, 14968, 353, 343, 29918, 14968, 29889, 6506, 29898, 8977, 29896, 29897, 13, 29891, 29918, 1688, 353, 343, 29918, 1688, 29889, 6506, 29898, 8977, 29896, 29897, 13, 13, 13, 13, 13, 29937, 5920, 8665, 1244, 13, 13, 13, 13, 13, 29937, 448, 9072, 29899, 13, 3166, 2071, 19668, 29889, 24031, 1053, 23255, 8431, 520, 2385, 3709, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 13600, 29918, 13628, 29892, 1990, 2450, 29918, 12276, 29892, 5527, 3958, 29918, 5344, 13, 13, 29937, 5920, 8665, 1244, 13, 13, 2158, 29898, 29990, 29918, 14968, 29892, 29990, 29918, 1688, 29892, 29891, 29918, 14968, 29892, 29891, 29918, 1688, 29897, 13, 13, 1114, 29918, 4299, 353, 23255, 8431, 520, 2385, 3709, 29898, 8172, 29918, 3859, 29922, 29900, 29897, 13, 13, 1114, 29918, 4299, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 29891, 29918, 14968, 29897, 13, 13, 29891, 29918, 11965, 353, 594, 29874, 29918, 4299, 29889, 27711, 29898, 29990, 29918, 1688, 29897, 13, 13, 1114, 29918, 13628, 353, 13600, 29918, 13628, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 13, 1114, 29918, 4912, 353, 14679, 29918, 5344, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 13, 1114, 29918, 7283, 353, 12965, 29918, 12276, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 13, 13, 13, 29937, 448, 9072, 29899, 13, 3166, 921, 29887, 17079, 1053, 1060, 7210, 2385, 3709, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 11657, 7974, 15633, 13, 13, 29937, 9329, 1051, 13, 16744, 3790, 29915, 21891, 29918, 10492, 2396, 29961, 29900, 29889, 29896, 29892, 29900, 29889, 29896, 29945, 29892, 29900, 29889, 29906, 29892, 29900, 29889, 29906, 29945, 29892, 29900, 29889, 29941, 1402, 13, 9651, 525, 3317, 29918, 19488, 2396, 3881, 29898, 29896, 29892, 29941, 2915, 13, 13, 13, 29916, 26300, 29918, 4299, 353, 1060, 7210, 2385, 3709, 29898, 8172, 29918, 3859, 29922, 29900, 29897, 13, 13, 29916, 26300, 29918, 4299, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 29891, 29918, 14968, 29897, 13, 13, 29891, 29918, 11965, 353, 921, 26300, 29918, 4299, 29889, 27711, 29898, 29990, 29918, 1688, 29897, 13, 13, 29916, 26300, 29918, 13628, 353, 13600, 29918, 13628, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 13, 2158, 29898, 29916, 26300, 29918, 13628, 29897, 13, 13, 29916, 26300, 29918, 4912, 353, 14679, 29918, 5344, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 2158, 29898, 29916, 26300, 29918, 4912, 29897, 13, 13, 29916, 26300, 29918, 7283, 353, 12965, 29918, 12276, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 2158, 29898, 29916, 26300, 29918, 7283, 29897, 13, 13, 695, 29888, 29918, 4299, 353, 11657, 7974, 15633, 29898, 342, 326, 1061, 29922, 29916, 26300, 29918, 4299, 29892, 3207, 29918, 7720, 29922, 16744, 29897, 13, 13, 695, 29888, 29918, 4299, 29889, 9202, 29898, 29990, 29918, 14968, 29892, 29891, 29918, 14968, 29897, 13, 13, 29891, 29918, 11965, 353, 1067, 29888, 29918, 4299, 29889, 27711, 29898, 29990, 29918, 1688, 29897, 13, 13, 695, 29888, 29918, 13628, 353, 13600, 29918, 13628, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 2158, 29898, 695, 29888, 29918, 13628, 29897, 13, 13, 695, 29888, 29918, 4912, 353, 14679, 29918, 5344, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 2158, 29898, 695, 29888, 29918, 4912, 29897, 13, 13, 695, 29888, 29918, 7283, 353, 12965, 29918, 12276, 29898, 29891, 29918, 1688, 29892, 29891, 29918, 11965, 29897, 13, 2158, 29898, 695, 29888, 29918, 7283, 29897, 13, 13, 13, 29937, 5920, 8665, 1244, 13, 13, 13, 13, 2 ]
retro/models.py
WSMathias/Retro360-API
0
182680
<reponame>WSMathias/Retro360-API<filename>retro/models.py from django.db import models from django.contrib.auth.models import User from django.urls import reverse from django.http import HttpResponseRedirect # class RetroUser(models.Model): # user = models.OneToOneField(User,on_delete=models.CASCADE,default='0') # user_type = models.CharField(max_length= 5,default='user') # def __str__(self): # return "{} {}".format(self.user.username) # def get_absolute_url(self): # return HttpResponseRedirect(reverse('retro:list'))
[ 1, 529, 276, 1112, 420, 29958, 7811, 11309, 3173, 29914, 8015, 307, 29941, 29953, 29900, 29899, 8787, 29966, 9507, 29958, 2267, 307, 29914, 9794, 29889, 2272, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 24735, 13, 13, 29937, 770, 4649, 307, 2659, 29898, 9794, 29889, 3195, 1125, 13, 29937, 268, 1404, 353, 4733, 29889, 6716, 1762, 6716, 3073, 29898, 2659, 29892, 265, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 4381, 2433, 29900, 1495, 13, 29937, 268, 1404, 29918, 1853, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29871, 29945, 29892, 4381, 2433, 1792, 1495, 13, 13, 29937, 268, 822, 4770, 710, 12035, 1311, 1125, 13, 29937, 308, 736, 376, 8875, 6571, 1642, 4830, 29898, 1311, 29889, 1792, 29889, 6786, 29897, 13, 268, 13, 29937, 268, 822, 679, 29918, 23552, 29918, 2271, 29898, 1311, 1125, 13, 29937, 308, 736, 9056, 5103, 24735, 29898, 24244, 877, 2267, 307, 29901, 1761, 8785, 13, 2 ]
Sergeant-RANK/PRACTICE/1420A.py
rohansaini886/Peer-Programming-Hub-CP-Winter_Camp
2
155677
<reponame>rohansaini886/Peer-Programming-Hub-CP-Winter_Camp<filename>Sergeant-RANK/PRACTICE/1420A.py for _ in range(int(input())): n = int(input()) l = list(map(int, input().split(" "))) is_true = False for i in range(1, n): if l[i] >= l[i-1]: is_true = True break if is_true: print("YES") else: print("NO")
[ 1, 529, 276, 1112, 420, 29958, 307, 29882, 550, 475, 29875, 29947, 29947, 29953, 29914, 15666, 261, 29899, 9283, 4056, 29899, 16046, 29899, 6271, 29899, 29956, 1639, 29918, 29907, 1160, 29966, 9507, 29958, 1748, 479, 424, 29899, 29934, 2190, 29968, 29914, 29925, 4717, 1783, 12107, 29914, 29896, 29946, 29906, 29900, 29909, 29889, 2272, 13, 1454, 903, 297, 3464, 29898, 524, 29898, 2080, 22130, 29901, 13, 1678, 302, 353, 938, 29898, 2080, 3101, 13, 1678, 301, 353, 1051, 29898, 1958, 29898, 524, 29892, 1881, 2141, 5451, 703, 376, 4961, 13, 1678, 338, 29918, 3009, 353, 7700, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 302, 1125, 13, 4706, 565, 301, 29961, 29875, 29962, 6736, 301, 29961, 29875, 29899, 29896, 5387, 13, 9651, 338, 29918, 3009, 353, 5852, 13, 9651, 2867, 13, 1678, 565, 338, 29918, 3009, 29901, 13, 4706, 1596, 703, 21143, 1159, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 6632, 1159, 13, 2 ]
source/setups/euler/3d/bonnor-ebert/generate.py
jmark/nemo
0
63384
#!/usr/bin/env python import sys,os root = os.environ['NEMO_ROOT'] site = os.environ['NEMO_SITE'] sys.path.append(os.path.join(root,'scripts')) from nemo import Makefile mk = Makefile( root = root, sites = site, flags = dict(PP_N_NODES = 4, PP_KERNEL_DGFV_QMAX = 2, PP_SPLIT_FORM = 0, PP_MESH_PERIODIC = 0), ) sourcedir = root + '/source' SETUPDIR = sourcedir + '/setups/euler/3d/self-gravity' hydro = root + '/source/flux/euler/dgfv/3d' #hydro = root + '/source/flux/euler/dgfv/3d/multilevel-lobatto' #hydro = root + '/source/flux/euler/dgfv/3d/multilevel' #hydro = root + '/source/flux/euler/dgfv/3d/singlelevel' #hydro = root + '/source/flux/euler/dgfv/3d/singlelevel-multiflux' kernel = root + '/source/kernel/dgfv/3d' #timedisc = root + '/source/timedisc/rungekutta/5-4' timedisc = root + '/source/timedisc/rungekutta/ssp/5-4' equations = root + '/source/equations/euler/polytropic/3d' riemann = equations + '/riemann/rusanov' #riemann = equations + '/riemann/hllc' #riemann = hydro + '/riemann/standard/roe' #riemann = hydro + '/riemann/standard/roe-entropy-fix' #riemann = hydro + '/riemann/standard/hlle+roe-entropy-fix' #riemann = hydro + '/riemann/standard/hll' #riemann = hydro + '/riemann/standard/hllc' #riemann = hydro + '/riemann/standard/hllm' #riemann = hydro + '/riemann/standard/entropy-stable' #riemann = hydro + '/riemann/multidim/rusanov' #riemann = hydro + '/riemann/multidim/chandrashekar' #twopoint = hydro + '/equations/polytropic/two_point_flux/standard' #twopoint = hydro + '/equations/polytropic/two_point_flux/kennedy-gruber' #twopoint = hydro + '/equations/polytropic/two_point_flux/chandrashekar' #twopoint = hydro + '/equations/polytropic/two_point_flux/schnuecke' #mk.add(twopoint + '/two_point_flux_mod.f90') mk.add(root + '/source/share_mod.f90') mk.add(root + '/source/driver_mod.f90') mk.add(root + '/source/runtime_mod.f90') mk.add(root + '/source/common/*.f90') mk.add(root + '/source/mesh/*.f90') mk.add(root + '/source/mesh/bindings/*.f90') mk.add(root + '/source/checkpoint/base/*.f90') mk.add(root + '/source/checkpoint/hdf5/p4est/*.f90') mk.add(riemann + '/*.f90') mk.add(equations + '/*.f90') mk.add(kernel,'*.f90') mk.add(timedisc,'*.f90') mk.add(SETUPDIR + '/modules/*_mod.f90') # mk.add(SETUPDIR + '/modules/setup_amr_mod.f90') # mk.add(SETUPDIR + '/modules/setup_amr_sensor_mod.f90') # mk.add(SETUPDIR + '/modules/setup_amr_types_mod.f90') mk.generate()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 5215, 10876, 29892, 359, 13, 13, 4632, 353, 2897, 29889, 21813, 1839, 8186, 6720, 29918, 21289, 2033, 13, 2746, 353, 2897, 29889, 21813, 1839, 8186, 6720, 29918, 29903, 9094, 2033, 13, 13, 9675, 29889, 2084, 29889, 4397, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4632, 5501, 16713, 8785, 13, 13, 3166, 6583, 29877, 1053, 8561, 1445, 13, 13, 11256, 353, 8561, 1445, 29898, 13, 1678, 3876, 353, 3876, 29892, 13, 1678, 11840, 353, 3268, 29892, 13, 1678, 13449, 353, 9657, 29898, 18009, 29918, 29940, 29918, 6632, 2287, 29903, 353, 29871, 29946, 29892, 349, 29925, 29918, 29968, 1001, 29940, 6670, 29918, 29928, 29954, 29943, 29963, 29918, 29984, 12648, 353, 29871, 29906, 29892, 349, 29925, 29918, 5550, 29931, 1806, 29918, 19094, 353, 29871, 29900, 29892, 349, 29925, 29918, 2303, 7068, 29918, 13171, 5971, 29928, 2965, 353, 29871, 29900, 511, 13, 29897, 13, 13, 29879, 473, 1133, 381, 259, 353, 3876, 718, 8207, 4993, 29915, 13, 10490, 4897, 9464, 1678, 353, 269, 473, 1133, 381, 718, 8207, 842, 14340, 29914, 29872, 8584, 29914, 29941, 29881, 29914, 1311, 29899, 23439, 29915, 13, 13, 29882, 11279, 539, 353, 3876, 718, 8207, 4993, 29914, 1579, 1314, 29914, 29872, 8584, 29914, 20726, 29888, 29894, 29914, 29941, 29881, 29915, 13, 29937, 29882, 11279, 539, 353, 3876, 718, 8207, 4993, 29914, 1579, 1314, 29914, 29872, 8584, 29914, 20726, 29888, 29894, 29914, 29941, 29881, 29914, 4713, 488, 955, 29899, 2127, 16234, 29915, 13, 29937, 29882, 11279, 539, 353, 3876, 718, 8207, 4993, 29914, 1579, 1314, 29914, 29872, 8584, 29914, 20726, 29888, 29894, 29914, 29941, 29881, 29914, 4713, 488, 955, 29915, 13, 29937, 29882, 11279, 539, 353, 3876, 718, 8207, 4993, 29914, 1579, 1314, 29914, 29872, 8584, 29914, 20726, 29888, 29894, 29914, 29941, 29881, 29914, 14369, 5563, 29915, 13, 29937, 29882, 11279, 539, 353, 3876, 718, 8207, 4993, 29914, 1579, 1314, 29914, 29872, 8584, 29914, 20726, 29888, 29894, 29914, 29941, 29881, 29914, 14369, 5563, 29899, 4713, 361, 29880, 1314, 29915, 13, 17460, 539, 353, 3876, 718, 8207, 4993, 29914, 17460, 29914, 20726, 29888, 29894, 29914, 29941, 29881, 29915, 13, 13, 29937, 9346, 287, 10669, 1678, 353, 3876, 718, 8207, 4993, 29914, 9346, 287, 10669, 29914, 3389, 479, 29895, 329, 941, 29914, 29945, 29899, 29946, 29915, 13, 9346, 287, 10669, 1678, 353, 3876, 718, 8207, 4993, 29914, 9346, 287, 10669, 29914, 3389, 479, 29895, 329, 941, 29914, 893, 29886, 29914, 29945, 29899, 29946, 29915, 13, 13, 1686, 800, 353, 3876, 718, 8207, 4993, 29914, 1686, 800, 29914, 29872, 8584, 29914, 3733, 3637, 1336, 293, 29914, 29941, 29881, 29915, 13, 374, 24767, 353, 10693, 718, 8207, 374, 24767, 29914, 15816, 273, 586, 29915, 13, 29937, 374, 24767, 353, 10693, 718, 8207, 374, 24767, 29914, 29882, 645, 29883, 29915, 13, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 15770, 29914, 26968, 29915, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 15770, 29914, 26968, 29899, 296, 14441, 29899, 5878, 29915, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 15770, 29914, 4415, 280, 29974, 26968, 29899, 296, 14441, 29899, 5878, 29915, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 15770, 29914, 29882, 645, 29915, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 15770, 29914, 29882, 645, 29883, 29915, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 15770, 29914, 29882, 645, 29885, 29915, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 15770, 29914, 296, 14441, 29899, 13844, 29915, 13, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 4713, 333, 326, 29914, 15816, 273, 586, 29915, 13, 29937, 374, 24767, 268, 353, 17546, 718, 8207, 374, 24767, 29914, 4713, 333, 326, 29914, 305, 392, 3417, 354, 5689, 29915, 13, 13, 29937, 7516, 459, 2461, 1678, 353, 17546, 718, 8207, 1686, 800, 29914, 3733, 3637, 1336, 293, 29914, 10184, 29918, 3149, 29918, 1579, 1314, 29914, 15770, 29915, 13, 29937, 7516, 459, 2461, 1678, 353, 17546, 718, 8207, 1686, 800, 29914, 3733, 3637, 1336, 293, 29914, 10184, 29918, 3149, 29918, 1579, 1314, 29914, 1717, 29876, 7584, 29899, 629, 11234, 29915, 13, 29937, 7516, 459, 2461, 1678, 353, 17546, 718, 8207, 1686, 800, 29914, 3733, 3637, 1336, 293, 29914, 10184, 29918, 3149, 29918, 1579, 1314, 29914, 305, 392, 3417, 354, 5689, 29915, 13, 29937, 7516, 459, 2461, 1678, 353, 17546, 718, 8207, 1686, 800, 29914, 3733, 3637, 1336, 293, 29914, 10184, 29918, 3149, 29918, 1579, 1314, 29914, 816, 29876, 434, 10055, 29915, 13, 29937, 11256, 29889, 1202, 29898, 7516, 459, 2461, 718, 8207, 10184, 29918, 3149, 29918, 1579, 1314, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 13653, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 9465, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 15634, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 9435, 5515, 29889, 29888, 29929, 29900, 1495, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 4467, 29882, 5515, 29889, 29888, 29929, 29900, 1495, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 4467, 29882, 29914, 5355, 886, 5515, 29889, 29888, 29929, 29900, 1495, 13, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 3198, 3149, 29914, 3188, 5515, 29889, 29888, 29929, 29900, 1495, 13, 11256, 29889, 1202, 29898, 4632, 718, 8207, 4993, 29914, 3198, 3149, 29914, 29882, 2176, 29945, 29914, 29886, 29946, 342, 5515, 29889, 29888, 29929, 29900, 1495, 13, 13, 11256, 29889, 1202, 29898, 374, 24767, 718, 525, 5515, 29889, 29888, 29929, 29900, 1495, 13, 11256, 29889, 1202, 29898, 1686, 800, 718, 525, 5515, 29889, 29888, 29929, 29900, 1495, 13, 11256, 29889, 1202, 29898, 17460, 5501, 10521, 29888, 29929, 29900, 1495, 13, 13, 11256, 29889, 1202, 29898, 9346, 287, 10669, 5501, 10521, 29888, 29929, 29900, 1495, 13, 13, 11256, 29889, 1202, 29898, 10490, 4897, 9464, 718, 8207, 7576, 5515, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 13, 29937, 14690, 29889, 1202, 29898, 10490, 4897, 9464, 718, 8207, 7576, 29914, 14669, 29918, 314, 29878, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 29937, 14690, 29889, 1202, 29898, 10490, 4897, 9464, 718, 8207, 7576, 29914, 14669, 29918, 314, 29878, 29918, 29879, 6073, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 29937, 14690, 29889, 1202, 29898, 10490, 4897, 9464, 718, 8207, 7576, 29914, 14669, 29918, 314, 29878, 29918, 8768, 29918, 1545, 29889, 29888, 29929, 29900, 1495, 13, 13, 11256, 29889, 17158, 580, 13, 2 ]
tkinter/GroupBox/GroupBox.py
Python-clique/Examples_Python
1
177459
<reponame>Python-clique/Examples_Python<filename>tkinter/GroupBox/GroupBox.py<gh_stars>1-10 #!/usr/bin/env python3 # -*-coding:utf-8 -* import tkinter import tkinter.messagebox import tkinter.ttk class Form1(tkinter.Tk): def __init__(self): super().__init__() self.frame = tkinter.ttk.Frame(self) self.frame.pack(fill = tkinter.BOTH, expand=1) self.groupBox1 = tkinter.ttk.LabelFrame(self.frame, text="GroupBox 1", height=460, width=305) self.groupBox1.place(x=10, y=10) self.groupBox2 = tkinter.ttk.LabelFrame(self.frame, height=460, width=305) self.groupBox2.place(x=325, y=10) self.geometry("640x480+200+100") self.title("GroupBox example") def main(self=None): form = Form1() form.mainloop() if __name__ == '__main__': Form1.main()
[ 1, 529, 276, 1112, 420, 29958, 11980, 29899, 29883, 9854, 29914, 1252, 9422, 29918, 11980, 29966, 9507, 29958, 11178, 1639, 29914, 4782, 3313, 29914, 4782, 3313, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 29883, 3689, 29901, 9420, 29899, 29947, 448, 29930, 13, 13, 5215, 18883, 1639, 13, 5215, 18883, 1639, 29889, 4906, 1884, 13, 5215, 18883, 1639, 29889, 698, 29895, 13, 13, 1990, 3812, 29896, 29898, 11178, 1639, 29889, 29911, 29895, 1125, 13, 29871, 822, 4770, 2344, 12035, 1311, 1125, 13, 1678, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 1678, 1583, 29889, 2557, 353, 18883, 1639, 29889, 698, 29895, 29889, 4308, 29898, 1311, 29897, 13, 1678, 1583, 29889, 2557, 29889, 4058, 29898, 5589, 353, 18883, 1639, 29889, 29933, 2891, 29950, 29892, 7985, 29922, 29896, 29897, 13, 13, 1678, 1583, 29889, 2972, 3313, 29896, 353, 18883, 1639, 29889, 698, 29895, 29889, 4775, 4308, 29898, 1311, 29889, 2557, 29892, 1426, 543, 4782, 3313, 29871, 29896, 613, 3171, 29922, 29946, 29953, 29900, 29892, 2920, 29922, 29941, 29900, 29945, 29897, 13, 1678, 1583, 29889, 2972, 3313, 29896, 29889, 6689, 29898, 29916, 29922, 29896, 29900, 29892, 343, 29922, 29896, 29900, 29897, 13, 13, 1678, 1583, 29889, 2972, 3313, 29906, 353, 18883, 1639, 29889, 698, 29895, 29889, 4775, 4308, 29898, 1311, 29889, 2557, 29892, 3171, 29922, 29946, 29953, 29900, 29892, 2920, 29922, 29941, 29900, 29945, 29897, 13, 1678, 1583, 29889, 2972, 3313, 29906, 29889, 6689, 29898, 29916, 29922, 29941, 29906, 29945, 29892, 343, 29922, 29896, 29900, 29897, 13, 13, 1678, 1583, 29889, 19156, 703, 29953, 29946, 29900, 29916, 29946, 29947, 29900, 29974, 29906, 29900, 29900, 29974, 29896, 29900, 29900, 1159, 13, 1678, 1583, 29889, 3257, 703, 4782, 3313, 1342, 1159, 13, 13, 29871, 822, 1667, 29898, 1311, 29922, 8516, 1125, 13, 1678, 883, 353, 3812, 29896, 580, 13, 1678, 883, 29889, 3396, 7888, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 29871, 3812, 29896, 29889, 3396, 580, 13, 2 ]
basic/007_Reverse_Int.py
Dynamic-Ruo/Leetcode-Practice-with-Python
1
83789
class Solution: def reverse(self, x: int) -> int: # get the sign of x if x == 0: return x sign = abs(x) / x x = abs(x) # reverse number num = 0 # reverse process while x != 0: temp = x % 10 num = num * 10 + temp x = x // 10 num = int(sign * num) return num if -2**31 < num < 2**31 - 1 else 0
[ 1, 770, 24380, 29901, 13, 1678, 822, 11837, 29898, 1311, 29892, 921, 29901, 938, 29897, 1599, 938, 29901, 13, 4706, 396, 679, 278, 1804, 310, 921, 13, 4706, 565, 921, 1275, 29871, 29900, 29901, 13, 9651, 736, 921, 13, 4706, 1804, 353, 6425, 29898, 29916, 29897, 847, 921, 13, 4706, 921, 353, 6425, 29898, 29916, 29897, 13, 4706, 396, 11837, 1353, 13, 4706, 954, 353, 29871, 29900, 13, 4706, 396, 11837, 1889, 13, 4706, 1550, 921, 2804, 29871, 29900, 29901, 13, 9651, 5694, 353, 921, 1273, 29871, 29896, 29900, 13, 9651, 954, 353, 954, 334, 29871, 29896, 29900, 718, 5694, 13, 9651, 921, 353, 921, 849, 29871, 29896, 29900, 13, 4706, 954, 353, 938, 29898, 4530, 334, 954, 29897, 13, 4706, 736, 954, 565, 448, 29906, 1068, 29941, 29896, 529, 954, 529, 29871, 29906, 1068, 29941, 29896, 448, 29871, 29896, 1683, 29871, 29900, 2 ]
indico/modules/events/util.py
javfg/indico
1
72875
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import json import os import random import re import warnings from collections import defaultdict from contextlib import contextmanager from copy import deepcopy from mimetypes import guess_extension from tempfile import NamedTemporaryFile from zipfile import ZipFile from flask import current_app, flash, g, redirect, request, session from sqlalchemy import inspect from sqlalchemy.orm import load_only, noload from werkzeug.exceptions import BadRequest, Forbidden from werkzeug.urls import url_parse from indico.core import signals from indico.core.config import config from indico.core.errors import NoReportError, UserValueError from indico.core.permissions import FULL_ACCESS_PERMISSION, READ_ACCESS_PERMISSION from indico.modules.categories.models.roles import CategoryRole from indico.modules.events import Event from indico.modules.events.contributions import contribution_settings from indico.modules.events.contributions.models.contributions import Contribution from indico.modules.events.contributions.models.subcontributions import SubContribution from indico.modules.events.layout import theme_settings from indico.modules.events.models.events import EventType from indico.modules.events.models.persons import EventPerson from indico.modules.events.models.principals import EventPrincipal from indico.modules.events.models.roles import EventRole from indico.modules.events.models.static_list_links import StaticListLink from indico.modules.events.registration.models.forms import RegistrationForm from indico.modules.events.sessions.models.sessions import Session from indico.modules.events.timetable.models.breaks import Break from indico.modules.events.timetable.models.entries import TimetableEntry from indico.modules.networks import IPNetworkGroup from indico.modules.users import User from indico.util.caching import memoize_request from indico.util.fs import chmod_umask, secure_filename from indico.util.i18n import _ from indico.util.string import strip_tags from indico.util.user import principal_from_identifier from indico.web.flask.util import send_file, url_for from indico.web.forms.colors import get_colors def check_event_locked(rh, event, force=False): if (not getattr(rh, 'ALLOW_LOCKED', False) or force) and event.is_locked and request.method not in ('GET', 'HEAD'): raise NoReportError.wrap_exc(Forbidden(_('This event has been locked so no modifications are possible.'))) def get_object_from_args(args=None): """Retrieve an event object from request arguments. This utility is meant to be used in cases where the same controller can deal with objects attached to various parts of an event which use different URLs to indicate which object to use. :param args: The request arguments. If unspecified, ``request.view_args`` is used. :return: An ``(object_type, event, object)`` tuple. The event is always the :class:`Event` associated with the object. The object may be an `Event`, `Session`, `Contribution` or `SubContribution`. If the object does not exist, ``(object_type, None, None)`` is returned. """ if args is None: args = request.view_args object_type = args['object_type'] event = Event.get(args['event_id'], is_deleted=False) if event is None: obj = None elif object_type == 'event': obj = event elif object_type == 'session': obj = Session.query.with_parent(event).filter_by(id=args['session_id']).first() elif object_type == 'contribution': obj = Contribution.query.with_parent(event).filter_by(id=args['contrib_id']).first() elif object_type == 'subcontribution': obj = (SubContribution.query .filter(SubContribution.id == args['subcontrib_id'], ~SubContribution.is_deleted, SubContribution.contribution.has(event=event, id=args['contrib_id'], is_deleted=False)) .first()) else: raise ValueError(f'Unexpected object type: {object_type}') if obj is not None: return object_type, event, obj else: return object_type, None, None def get_theme(event, override_theme_id=None): """Get the theme ID and whether it's an override. This is useful for places where a user may specify a different timetable theme. If the override theme is not valid for the event, a message is flashed and an exception redirecting the user to the main event page is raised. :raise BadRequest: if the override theme id is not valid :return: a ``(theme_id, is_override)`` tuple """ if not override_theme_id: return event.theme, False elif override_theme_id == 'default': theme = theme_settings.defaults[event.type] return theme, theme != event.theme elif override_theme_id in theme_settings.get_themes_for(event.type_.name): return override_theme_id, override_theme_id != event.theme else: if override_theme_id in theme_settings.themes: flash(_("The theme '{}' is not valid for this event.").format(override_theme_id)) else: flash(_("The theme '{}' does not exist.").format(override_theme_id)) raise BadRequest(response=redirect(event.url)) def get_events_managed_by(user, dt=None): """Get the IDs of events where the user has management privs. :param user: A `User` :param dt: Only include events taking place on/after that date :return: A set of event ids """ query = (user.in_event_acls .join(Event) .options(noload('user'), noload('local_group'), load_only('event_id')) .filter(~Event.is_deleted, Event.ends_after(dt)) .filter(EventPrincipal.has_management_permission('ANY'))) return {principal.event_id for principal in query} def get_events_created_by(user, dt=None): """Get the IDs of events created by the user. :param user: A `User` :param dt: Only include events taking place on/after that date :return: A set of event ids """ query = (user.created_events .filter(~Event.is_deleted, Event.ends_after(dt)) .options(load_only('id'))) return {event.id for event in query} def get_events_with_linked_event_persons(user, dt=None): """ Return a dict containing the event ids and role for all events where the user is a chairperson or (in case of a lecture) speaker. :param user: A `User` :param dt: Only include events taking place on/after that date """ query = (user.event_persons .with_entities(EventPerson.event_id, Event._type) .join(Event, Event.id == EventPerson.event_id) .filter(EventPerson.event_links.any()) .filter(~Event.is_deleted, Event.ends_after(dt))) return {event_id: ('lecture_speaker' if event_type == EventType.lecture else 'conference_chair') for event_id, event_type in query} def get_random_color(event): breaks = Break.query.filter(Break.timetable_entry.has(event=event)) used_colors = {s.colors for s in event.sessions} | {b.colors for b in breaks} unused_colors = set(get_colors()) - used_colors return random.choice(tuple(unused_colors) or get_colors()) def serialize_event_person(person): """Serialize EventPerson to JSON-like object.""" return {'_type': 'EventPerson', 'id': person.id, 'email': person.email, 'name': person.display_full_name, 'firstName': person.first_name, 'familyName': person.last_name, 'title': person.title, 'affiliation': person.affiliation, 'phone': person.phone, 'address': person.address, 'user_id': person.user_id} def serialize_person_link(person_link): """Serialize PersonLink to JSON-like object.""" data = {'email': person_link.person.email, 'name': person_link.display_full_name, 'fullName': person_link.display_full_name, 'firstName': person_link.first_name, 'familyName': person_link.last_name, 'title': person_link.title, 'affiliation': person_link.affiliation, 'phone': person_link.phone, 'address': person_link.address, 'displayOrder': person_link.display_order, 'userId': person_link.person.user_id} if person_link.person.id is not None: # In case of a newly added person we only serialize the data again # if the form's validation failed and the field needs to be displayed # with the same data. However, now we don't have a person ID since # the person was never created, so if we send an ID/type in the # serialized data it'll be sent back and cause an error as it'll appear # as an existing person instead of a new one when submitting the form # again. data.update({'_type': 'PersonLink', 'id': person_link.person.id, 'personId': person_link.person.id}) return data def update_object_principals(obj, new_principals, read_access=False, full_access=False, permission=None): """Update an object's ACL with a new list of principals. Exactly one argument out of `read_access`, `full_access` and `role` must be specified. :param obj: The object to update. Must have ``acl_entries`` :param new_principals: The set containing the new principals :param read_access: Whether the read access ACL should be updated :param full_access: Whether the full access ACL should be updated :param permission: The role ACL that should be updated """ if read_access + full_access + bool(permission) != 1: raise ValueError('Only one ACL property can be specified') if full_access: existing = {acl.principal for acl in obj.acl_entries if acl.full_access} grant = {'full_access': True} revoke = {'full_access': False} elif read_access: existing = {acl.principal for acl in obj.acl_entries if acl.read_access} grant = {'read_access': True} revoke = {'read_access': False} elif permission: existing = {acl.principal for acl in obj.acl_entries if acl.has_management_permission(permission, explicit=True)} grant = {'add_permissions': {permission}} revoke = {'del_permissions': {permission}} new_principals = set(new_principals) added = new_principals - existing removed = existing - new_principals for principal in added: obj.update_principal(principal, **grant) for principal in removed: obj.update_principal(principal, **revoke) return {'added': added, 'removed': removed} class ListGeneratorBase: """Base class for classes performing actions on Indico object lists. :param event: The associated `Event` :param entry_parent: The parent of the entries of the list. If it's None, the parent is assumed to be the event itself. """ #: The endpoint of the list management page endpoint = None #: Unique list identifier list_link_type = None #: The default list configuration dictionary default_list_config = None def __init__(self, event, entry_parent=None): #: The event the list is associated with self.event = event #: The parent object of the list items self.entry_parent = entry_parent or event #: Columns that originate from the list item's properties, #: relationships etc, but not from user defined fields (e.g. #: registration/contribution fields) self.static_items = {} self.extra_filters = {} self.static_link_used = 'config' in request.args def _get_config_session_key(self): """Compose the unique configuration ID. This ID will be used as a key to set the list's configuration to the session. """ return f'{self.list_link_type}_config_{self.entry_parent.id}' def _get_config(self): """Load the list's configuration from the DB and return it.""" session_key = self._get_config_session_key() if self.static_link_used: uuid = request.args['config'] configuration = StaticListLink.load(self.event, self.list_link_type, uuid) if configuration and configuration['entry_parent_id'] == self.entry_parent.id: session[session_key] = configuration['data'] return session.get(session_key, self.default_list_config) def _split_item_ids(self, item_ids, separator_type=None): """Separate the dynamic item ids from the static. :param item_ids: The list of ids to be splitted. :param separator_type: The type of the item to base the partitioning on. If the value is 'dynamic', the function will return a tuple where the first element is a list of the dynamic item IDs and the second element a list of the rest item IDs. If the value is 'static', the first element of the returned tuple will be a list of the static item IDs. :return: A tuple of 2 lists as a result of the item_ids list partitioning. """ if separator_type == 'dynamic': dynamic_item_ids = [item_id for item_id in item_ids if not isinstance(item_id, str)] return dynamic_item_ids, [item_id for item_id in item_ids if item_id not in dynamic_item_ids] elif separator_type == 'static': static_item_ids = [item_id for item_id in item_ids if item_id in self.static_items] return static_item_ids, [item_id for item_id in item_ids if item_id not in static_item_ids] return item_ids, def _build_query(self): """Return the query of the list's entries. The query should not take into account the user's filtering configuration, for example:: return Contribution.query.with_parent(self.event) """ raise NotImplementedError def _filter_list_entries(self, query, filters): """Apply user's filters to query and return it.""" raise NotImplementedError def _get_filters_from_request(self): """Get the new filters after the filter form is submitted.""" def get_selected_options(item_id, item): if item.get('filter_choices') or item.get('type') == 'bool': return [x if x != 'None' else None for x in request.form.getlist(f'field_{item_id}')] filters = deepcopy(self.default_list_config['filters']) for item_id, item in self.static_items.items(): options = get_selected_options(item_id, item) if options: filters['items'][item_id] = options for item_id, item in self.extra_filters.items(): options = get_selected_options(item_id, item) if options: filters['extra'][item_id] = options return filters def get_list_url(self, uuid=None, external=False): """Return the URL of the list management page.""" return url_for(self.endpoint, self.entry_parent, config=uuid, _external=external) def generate_static_url(self): """Return a URL with a uuid referring to the list's configuration.""" session_key = self._get_config_session_key() configuration = { 'entry_parent_id': self.entry_parent.id, 'data': session.get(session_key) } if configuration['data']: link = StaticListLink.create(self.event, self.list_link_type, configuration) return self.get_list_url(uuid=link.uuid, external=True) else: return self.get_list_url(external=True) def store_configuration(self): """Load the filters from the request and store them in the session.""" filters = self._get_filters_from_request() session_key = self._get_config_session_key() self.list_config = session.setdefault(session_key, {}) self.list_config['filters'] = filters if request.values.get('visible_items'): visible_items = json.loads(request.values['visible_items']) self.list_config['items'] = sorted(visible_items, key=str) session.modified = True def flash_info_message(self, obj): raise NotImplementedError def create_event_logo_tmp_file(event, tmpdir=None): """Create a temporary file with the event's logo. If `tmpdir` is specified, the logo file is created in there and a path relative to that directory is returned. """ logo_meta = event.logo_metadata logo_extension = guess_extension(logo_meta['content_type']) or os.path.splitext(logo_meta['filename'])[1] temp_file = NamedTemporaryFile(delete=False, dir=(tmpdir or config.TEMP_DIR), suffix=logo_extension) temp_file.write(event.logo) temp_file.flush() return os.path.relpath(temp_file.name, tmpdir) if tmpdir else temp_file.name @contextmanager def track_time_changes(auto_extend=False, user=None): """Track time changes of event objects. This provides a list of changes while the context manager was active and also triggers `times_changed` signals. If the code running inside the ``with`` block of this context manager raises an exception, no signals will be triggered. :param auto_extend: Whether entry parents will get their boundaries automatically extended or not. Passing ``'start'`` will extend only start datetime, ``'end'`` to extend only end datetime. :param user: The `User` that will trigger time changes. """ if auto_extend: assert user is not None if 'old_times' in g: raise RuntimeError('time change tracking may not be nested') g.old_times = defaultdict(dict) changes = defaultdict(dict) try: yield changes except Exception: del g.old_times raise else: if auto_extend: by_start = auto_extend in (True, 'start') by_end = auto_extend in (True, 'end') initial_changes = set(g.old_times) # g.old_times changes during iteration for obj in list(g.old_times): if not isinstance(obj, Event): obj.extend_parent(by_start=by_start, by_end=by_end) cascade_changes = set(g.old_times) - initial_changes for obj in cascade_changes: if isinstance(obj, Event): if not obj.can_manage(user): # TODO: raise Forbidden exceptions after adding protection check in the UI raise UserValueError(_('Your action requires modification of event boundaries, but you are ' 'not authorized to manage the event.')) elif not obj.object.can_manage(user): # TODO: raise Forbidden exceptions after adding protection check in the UI raise UserValueError(_('Your action requires modification of session block boundaries, but you are ' 'not authorized to manage the session block.')) old_times = g.pop('old_times') for obj, info in old_times.items(): if isinstance(obj, TimetableEntry): obj = obj.object if obj.start_dt != info['start_dt']: changes[obj]['start_dt'] = (info['start_dt'], obj.start_dt) if obj.duration != info['duration']: changes[obj]['duration'] = (info['duration'], obj.duration) if obj.end_dt != info['end_dt']: changes[obj]['end_dt'] = (info['end_dt'], obj.end_dt) for obj, obj_changes in changes.items(): entry = None if isinstance(obj, Event) else obj.timetable_entry signals.event.times_changed.send(type(obj), entry=entry, obj=obj, changes=obj_changes) def register_time_change(entry): """Register a time-related change for a timetable entry. This is an internal helper function used in the models to record changes of the start time or duration. The changes are exposed through the `track_time_changes` contextmanager function. """ # if it's a new object it's not a change so we just ignore it if not inspect(entry).persistent: return try: old_times = g.old_times except AttributeError: msg = f'Time change of {entry} was not tracked' if current_app.config.get('REPL'): warnings.warn(msg + ' (exception converted to a warning since you are using the REPL)', stacklevel=2) return elif current_app.config['TESTING']: warnings.warn(msg + ' (exception converted to a warning during tests)', stacklevel=2) return else: raise RuntimeError(msg) for field in ('start_dt', 'duration', 'end_dt'): if old_times[entry].get(field) is None: old_times[entry][field] = getattr(entry, field) def register_event_time_change(event): """Register a time-related change for an event. This is an internal helper function used in the model to record changes of the start time or end time. The changes are exposed through the `track_time_changes` contextmanager function. """ # if it's a new object it's not a change so we just ignore it if not inspect(event).persistent: return try: old_times = g.old_times except AttributeError: msg = f'Time change of {event} was not tracked' if current_app.config.get('REPL'): warnings.warn(msg + ' (exception converted to a warning since you are using the REPL)', stacklevel=2) return elif current_app.config['TESTING']: warnings.warn(msg + ' (exception converted to a warning during tests)', stacklevel=2) return else: raise RuntimeError(msg) for field in ('start_dt', 'duration', 'end_dt'): if old_times[event].get(field) is None: old_times[event][field] = getattr(event, field) @contextmanager def track_location_changes(): """Track location changes of event objects. This provides a list of changes while the context manager was active and also triggers `location_changed` signals. If the code running inside the ``with`` block of this context manager raises an exception, no signals will be triggered. """ if 'old_locations' in g: raise RuntimeError('location change tracking may not be nested') g.old_locations = defaultdict(dict) changes = defaultdict(dict) try: yield changes except Exception: del g.old_locations raise else: old_locations = g.pop('old_locations') cols = ('own_room_id', 'own_room_name', 'own_venue_id', 'own_venue_name', 'own_address', 'inherit_location') for obj, info in old_locations.items(): for col in cols: new_value = getattr(obj, col) if new_value != info[col]: changes[obj][col] = (info[col], new_value) for obj, obj_changes in changes.items(): signals.event.location_changed.send(type(obj), obj=obj, changes=obj_changes) def register_location_change(entry): """Register a location-related change for an event object. This is an internal helper function used in the models to record changes of the location information. The changes are exposed through the `track_location_changes` contextmanager function. """ # if it's a new object it's not a change so we just ignore it if not inspect(entry).persistent: return try: old_locations = g.old_locations except AttributeError: msg = f'Location change of {entry} was not tracked' if current_app.config.get('REPL'): warnings.warn(msg + ' (exception converted to a warning since you are using the REPL)', stacklevel=2) return elif current_app.config['TESTING']: warnings.warn(msg + ' (exception converted to a warning during tests)', stacklevel=2) return else: raise RuntimeError(msg) for field in ('own_room_id', 'own_room_name', 'own_venue_id', 'own_venue_name', 'own_address', 'inherit_location'): if old_locations[entry].get(field) is None: old_locations[entry][field] = getattr(entry, field) def serialize_event_for_ical(event): return { '_fossil': 'conferenceMetadata', 'id': event.id, 'title': event.title, 'description': event.description, 'startDate': event.start_dt, 'endDate': event.end_dt, 'url': event.external_url, 'location': event.venue_name, 'roomFullname': event.room_name, 'speakers': [], 'contributions': [] } def serialize_event_for_json_ld(event, full=False): data = { '@context': 'http://schema.org', '@type': 'Event', 'url': event.external_url, 'name': event.title, 'startDate': event.start_dt_local.isoformat(), 'endDate': event.end_dt_local.isoformat(), 'location': { '@type': 'Place', 'name': event.venue_name or 'No location set', 'address': event.address or 'No address set' } } if full and event.description: data['description'] = strip_tags(event.description) if full and event.person_links: data['performer'] = list(map(serialize_person_for_json_ld, event.person_links)) if full and event.has_logo: data['image'] = event.external_logo_url return data def serialize_person_for_json_ld(person): return { '@type': 'Person', 'name': person.full_name, 'affiliation': { '@type': 'Organization', 'name': person.affiliation } } def get_field_values(form_data): """Split the form fields between custom and static.""" fields = {x: form_data[x] for x in form_data.keys() if not x.startswith('custom_')} custom_fields = {x: form_data[x] for x in form_data.keys() if x.startswith('custom_')} return fields, custom_fields def set_custom_fields(obj, custom_fields_data): changes = {} for custom_field_name, custom_field_value in custom_fields_data.items(): custom_field_id = int(custom_field_name[7:]) # Remove the 'custom_' part old_value = obj.set_custom_field(custom_field_id, custom_field_value) if old_value != custom_field_value: changes[custom_field_name] = (old_value, custom_field_value) return changes def check_permissions(event, field, allow_networks=False): for principal_fossil, permissions in field.data: principal = principal_from_identifier(principal_fossil['identifier'], allow_external_users=True, allow_groups=True, allow_category_roles=True, allow_event_roles=True, allow_emails=True, allow_registration_forms=True, allow_networks=allow_networks, event_id=event.id) if isinstance(principal, IPNetworkGroup) and set(permissions) - {READ_ACCESS_PERMISSION}: msg = _('IP networks cannot have management permissions: {}').format(principal.name) return msg if isinstance(principal, RegistrationForm) and set(permissions) - {READ_ACCESS_PERMISSION}: msg = _('Registrants cannot have management permissions: {}').format(principal.name) return msg if FULL_ACCESS_PERMISSION in permissions and len(permissions) != 1: # when full access permission is set, discard rest of permissions permissions[:] = [FULL_ACCESS_PERMISSION] def get_event_from_url(url): data = url_parse(url) if not all([data.scheme, data.netloc, data.path]): raise ValueError(_('Invalid event URL')) event_path = re.match(r'/event/(\d+)(/|$)', data.path) if not event_path: raise ValueError(_('Invalid event URL')) event_id = event_path.group(1) event = Event.get(event_id, is_deleted=False) if not event: raise ValueError(_('This event does not exist')) return event class ZipGeneratorMixin: """Mixin for RHs that generate zip with files.""" def _adjust_path_length(self, segments): """Shorten the path length to < 260 chars. Windows' built-in ZIP tool doesn't like files whose total path exceeds ~260 chars. Here we progressively shorten the total until it matches that constraint. """ result = [] total_len = sum(len(seg) for seg in segments) + len(segments) - 1 excess = (total_len - 255) if total_len > 255 else 0 for seg in reversed(segments): fname, ext = os.path.splitext(seg) cut = min(excess, (len(fname) - 10) if len(fname) > 14 else 0) if cut: excess -= cut fname = fname[:-cut] result.append(fname + ext) return reversed(result) def _iter_items(self, files_holder): yield from files_holder def _generate_zip_file(self, files_holder, name_prefix='material', name_suffix=None, return_file=False): """Generate a zip file containing the files passed. :param files_holder: An iterable (or an iterable containing) object that contains the files to be added in the zip file. :param name_prefix: The prefix to the zip file name :param name_suffix: The suffix to the zip file name :param return_file: Return the temp file instead of a response """ temp_file = NamedTemporaryFile(suffix='.zip', dir=config.TEMP_DIR, delete=False) with ZipFile(temp_file.name, 'w', allowZip64=True) as zip_handler: self.used_filenames = set() for item in self._iter_items(files_holder): name = self._prepare_folder_structure(item) self.used_filenames.add(name) with item.get_local_path() as filepath: zip_handler.write(filepath, name) zip_file_name = f'{name_prefix}-{name_suffix}.zip' if name_suffix else f'{name_prefix}.zip' chmod_umask(temp_file.name) if return_file: return temp_file return send_file(zip_file_name, temp_file.name, 'application/zip', inline=False) def _prepare_folder_structure(self, item): file_name = secure_filename(f'{item.id}_{item.filename}', str(item.id)) return os.path.join(*self._adjust_path_length([file_name])) @memoize_request def get_all_user_roles(event, user): event_roles = set( EventRole.query.with_parent(event) .filter(EventRole.members.any(User.id == user.id)) ) category_roles = set( CategoryRole.query .join(event.category.chain_query.subquery()) .filter(CategoryRole.members.any(User.id == user.id)) ) return event_roles, category_roles def should_show_draft_warning(event): return (event.type_ == EventType.conference and not contribution_settings.get(event, 'published') and (TimetableEntry.query.with_parent(event).has_rows() or Contribution.query.with_parent(event).has_rows()))
[ 1, 396, 910, 934, 338, 760, 310, 1894, 1417, 29889, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29900, 29906, 448, 29871, 29906, 29900, 29906, 29896, 315, 1001, 29940, 13, 29937, 13, 29937, 1894, 1417, 338, 3889, 7047, 29936, 366, 508, 2654, 391, 2666, 372, 322, 29914, 272, 13, 29937, 6623, 372, 1090, 278, 4958, 310, 278, 341, 1806, 19245, 29936, 1074, 278, 13, 29937, 365, 2965, 1430, 1660, 934, 363, 901, 4902, 29889, 13, 13, 5215, 4390, 13, 5215, 2897, 13, 5215, 4036, 13, 5215, 337, 13, 5215, 18116, 13, 3166, 16250, 1053, 2322, 8977, 13, 3166, 3030, 1982, 1053, 3030, 12847, 13, 3166, 3509, 1053, 6483, 8552, 13, 3166, 286, 17528, 7384, 1053, 4140, 29918, 17588, 13, 3166, 5694, 1445, 1053, 405, 2795, 5776, 1971, 653, 2283, 13, 3166, 14319, 1445, 1053, 796, 666, 2283, 13, 13, 3166, 29784, 1053, 1857, 29918, 932, 29892, 11013, 29892, 330, 29892, 6684, 29892, 2009, 29892, 4867, 13, 3166, 4576, 284, 305, 6764, 1053, 16096, 13, 3166, 4576, 284, 305, 6764, 29889, 555, 1053, 2254, 29918, 6194, 29892, 302, 3543, 328, 13, 3166, 23085, 13289, 29889, 11739, 29879, 1053, 9178, 3089, 29892, 1152, 29890, 4215, 13, 3166, 23085, 13289, 29889, 26045, 1053, 3142, 29918, 5510, 13, 13, 3166, 1399, 1417, 29889, 3221, 1053, 18470, 13, 3166, 1399, 1417, 29889, 3221, 29889, 2917, 1053, 2295, 13, 3166, 1399, 1417, 29889, 3221, 29889, 12523, 1053, 1939, 13020, 2392, 29892, 4911, 1917, 2392, 13, 3166, 1399, 1417, 29889, 3221, 29889, 17858, 6847, 1053, 383, 3299, 29918, 2477, 23524, 29918, 13171, 10403, 13507, 29892, 5195, 3035, 29918, 2477, 23524, 29918, 13171, 10403, 13507, 13, 3166, 1399, 1417, 29889, 7576, 29889, 20683, 29889, 9794, 29889, 307, 793, 1053, 17943, 16727, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 1053, 6864, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 1285, 3224, 29879, 1053, 11896, 29918, 11027, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 1285, 3224, 29879, 29889, 9794, 29889, 1285, 3224, 29879, 1053, 2866, 3224, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 1285, 3224, 29879, 29889, 9794, 29889, 1491, 1285, 3224, 29879, 1053, 3323, 1323, 3224, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 2680, 1053, 10929, 29918, 11027, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 9794, 29889, 13604, 1053, 6864, 1542, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 9794, 29889, 6774, 787, 1053, 6864, 7435, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 9794, 29889, 558, 2173, 29886, 1338, 1053, 6864, 4040, 26706, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 9794, 29889, 307, 793, 1053, 6864, 16727, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 9794, 29889, 7959, 29918, 1761, 29918, 4965, 1053, 624, 2454, 1293, 6595, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 1727, 8306, 29889, 9794, 29889, 9514, 1053, 2169, 8306, 2500, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 29879, 10964, 29889, 9794, 29889, 29879, 10964, 1053, 16441, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 9346, 300, 519, 29889, 9794, 29889, 8690, 29879, 1053, 28301, 13, 3166, 1399, 1417, 29889, 7576, 29889, 13604, 29889, 9346, 300, 519, 29889, 9794, 29889, 26586, 1053, 7870, 300, 519, 9634, 13, 3166, 1399, 1417, 29889, 7576, 29889, 11618, 29879, 1053, 5641, 13724, 4782, 13, 3166, 1399, 1417, 29889, 7576, 29889, 7193, 1053, 4911, 13, 3166, 1399, 1417, 29889, 4422, 29889, 29883, 9733, 1053, 2626, 29877, 675, 29918, 3827, 13, 3166, 1399, 1417, 29889, 4422, 29889, 5847, 1053, 521, 1545, 29918, 398, 1278, 29892, 11592, 29918, 9507, 13, 3166, 1399, 1417, 29889, 4422, 29889, 29875, 29896, 29947, 29876, 1053, 903, 13, 3166, 1399, 1417, 29889, 4422, 29889, 1807, 1053, 17820, 29918, 11338, 13, 3166, 1399, 1417, 29889, 4422, 29889, 1792, 1053, 5882, 29918, 3166, 29918, 25378, 13, 3166, 1399, 1417, 29889, 2676, 29889, 1579, 1278, 29889, 4422, 1053, 3638, 29918, 1445, 29892, 3142, 29918, 1454, 13, 3166, 1399, 1417, 29889, 2676, 29889, 9514, 29889, 27703, 1053, 679, 29918, 27703, 13, 13, 13, 1753, 1423, 29918, 3696, 29918, 29113, 29898, 19046, 29892, 1741, 29892, 4889, 29922, 8824, 1125, 13, 1678, 565, 313, 1333, 679, 5552, 29898, 19046, 29892, 525, 1964, 27998, 29918, 21339, 3352, 742, 7700, 29897, 470, 4889, 29897, 322, 1741, 29889, 275, 29918, 29113, 322, 2009, 29889, 5696, 451, 297, 6702, 7194, 742, 525, 23252, 29374, 13, 4706, 12020, 1939, 13020, 2392, 29889, 6312, 29918, 735, 29883, 29898, 2831, 29890, 4215, 7373, 877, 4013, 1741, 756, 1063, 22822, 577, 694, 26278, 526, 1950, 6169, 4961, 13, 13, 13, 1753, 679, 29918, 3318, 29918, 3166, 29918, 5085, 29898, 5085, 29922, 8516, 1125, 13, 1678, 9995, 8015, 29878, 2418, 385, 1741, 1203, 515, 2009, 6273, 29889, 13, 13, 1678, 910, 19725, 338, 6839, 304, 367, 1304, 297, 4251, 988, 278, 1021, 4701, 13, 1678, 508, 5376, 411, 3618, 10959, 304, 5164, 5633, 310, 385, 1741, 607, 13, 1678, 671, 1422, 24295, 304, 12266, 607, 1203, 304, 671, 29889, 13, 13, 1678, 584, 3207, 6389, 29901, 450, 2009, 6273, 29889, 960, 443, 6550, 2164, 29892, 13, 462, 4954, 3827, 29889, 1493, 29918, 5085, 16159, 338, 1304, 29889, 13, 1678, 584, 2457, 29901, 530, 4954, 29898, 3318, 29918, 1853, 29892, 1741, 29892, 1203, 3569, 29952, 18761, 29889, 29871, 450, 1741, 338, 13, 632, 2337, 278, 584, 1990, 18078, 2624, 29952, 6942, 411, 278, 1203, 29889, 13, 632, 450, 1203, 1122, 367, 385, 421, 2624, 1673, 421, 7317, 1673, 421, 1323, 3224, 29952, 13, 632, 470, 421, 4035, 1323, 3224, 1412, 29871, 960, 278, 1203, 947, 451, 1863, 29892, 13, 632, 4954, 29898, 3318, 29918, 1853, 29892, 6213, 29892, 6213, 3569, 29952, 338, 4133, 29889, 13, 1678, 9995, 13, 1678, 565, 6389, 338, 6213, 29901, 13, 4706, 6389, 353, 2009, 29889, 1493, 29918, 5085, 13, 1678, 1203, 29918, 1853, 353, 6389, 1839, 3318, 29918, 1853, 2033, 13, 1678, 1741, 353, 6864, 29889, 657, 29898, 5085, 1839, 3696, 29918, 333, 7464, 338, 29918, 311, 22742, 29922, 8824, 29897, 13, 1678, 565, 1741, 338, 6213, 29901, 13, 4706, 5446, 353, 6213, 13, 1678, 25342, 1203, 29918, 1853, 1275, 525, 3696, 2396, 13, 4706, 5446, 353, 1741, 13, 1678, 25342, 1203, 29918, 1853, 1275, 525, 7924, 2396, 13, 4706, 5446, 353, 16441, 29889, 1972, 29889, 2541, 29918, 3560, 29898, 3696, 467, 4572, 29918, 1609, 29898, 333, 29922, 5085, 1839, 7924, 29918, 333, 2033, 467, 4102, 580, 13, 1678, 25342, 1203, 29918, 1853, 1275, 525, 1285, 3224, 2396, 13, 4706, 5446, 353, 2866, 3224, 29889, 1972, 29889, 2541, 29918, 3560, 29898, 3696, 467, 4572, 29918, 1609, 29898, 333, 29922, 5085, 1839, 21570, 29918, 333, 2033, 467, 4102, 580, 13, 1678, 25342, 1203, 29918, 1853, 1275, 525, 1491, 1285, 3224, 2396, 13, 4706, 5446, 353, 313, 4035, 1323, 3224, 29889, 1972, 13, 1669, 869, 4572, 29898, 4035, 1323, 3224, 29889, 333, 1275, 6389, 1839, 1491, 21570, 29918, 333, 7464, 13, 462, 539, 3695, 4035, 1323, 3224, 29889, 275, 29918, 311, 22742, 29892, 13, 462, 539, 3323, 1323, 3224, 29889, 1285, 3224, 29889, 5349, 29898, 3696, 29922, 3696, 29892, 1178, 29922, 5085, 1839, 21570, 29918, 333, 7464, 338, 29918, 311, 22742, 29922, 8824, 876, 13, 1669, 869, 4102, 3101, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 29898, 29888, 29915, 29965, 13996, 6021, 1203, 1134, 29901, 426, 3318, 29918, 1853, 29913, 1495, 13, 1678, 565, 5446, 338, 451, 6213, 29901, 13, 4706, 736, 1203, 29918, 1853, 29892, 1741, 29892, 5446, 13, 1678, 1683, 29901, 13, 4706, 736, 1203, 29918, 1853, 29892, 6213, 29892, 6213, 13, 13, 13, 1753, 679, 29918, 18193, 29898, 3696, 29892, 5712, 29918, 18193, 29918, 333, 29922, 8516, 1125, 13, 1678, 9995, 2577, 278, 10929, 3553, 322, 3692, 372, 29915, 29879, 385, 5712, 29889, 13, 13, 1678, 910, 338, 5407, 363, 7600, 988, 263, 1404, 1122, 6084, 263, 1422, 13, 1678, 5335, 300, 519, 10929, 29889, 29871, 960, 278, 5712, 10929, 338, 451, 2854, 363, 278, 13, 1678, 1741, 29892, 263, 2643, 338, 11013, 287, 322, 385, 3682, 6684, 292, 278, 1404, 13, 1678, 304, 278, 1667, 1741, 1813, 338, 10425, 29889, 13, 13, 1678, 584, 22692, 9178, 3089, 29901, 565, 278, 5712, 10929, 1178, 338, 451, 2854, 13, 1678, 584, 2457, 29901, 263, 4954, 29898, 18193, 29918, 333, 29892, 338, 29918, 15752, 3569, 29952, 18761, 13, 1678, 9995, 13, 1678, 565, 451, 5712, 29918, 18193, 29918, 333, 29901, 13, 4706, 736, 1741, 29889, 18193, 29892, 7700, 13, 1678, 25342, 5712, 29918, 18193, 29918, 333, 1275, 525, 4381, 2396, 13, 4706, 10929, 353, 10929, 29918, 11027, 29889, 4381, 29879, 29961, 3696, 29889, 1853, 29962, 13, 4706, 736, 10929, 29892, 10929, 2804, 1741, 29889, 18193, 13, 1678, 25342, 5712, 29918, 18193, 29918, 333, 297, 10929, 29918, 11027, 29889, 657, 29918, 386, 13826, 29918, 1454, 29898, 3696, 29889, 1853, 5396, 978, 1125, 13, 4706, 736, 5712, 29918, 18193, 29918, 333, 29892, 5712, 29918, 18193, 29918, 333, 2804, 1741, 29889, 18193, 13, 1678, 1683, 29901, 13, 4706, 565, 5712, 29918, 18193, 29918, 333, 297, 10929, 29918, 11027, 29889, 386, 13826, 29901, 13, 9651, 11013, 7373, 703, 1576, 10929, 525, 8875, 29915, 338, 451, 2854, 363, 445, 1741, 1213, 467, 4830, 29898, 15752, 29918, 18193, 29918, 333, 876, 13, 4706, 1683, 29901, 13, 9651, 11013, 7373, 703, 1576, 10929, 525, 8875, 29915, 947, 451, 1863, 1213, 467, 4830, 29898, 15752, 29918, 18193, 29918, 333, 876, 13, 4706, 12020, 9178, 3089, 29898, 5327, 29922, 17886, 29898, 3696, 29889, 2271, 876, 13, 13, 13, 1753, 679, 29918, 13604, 29918, 25240, 29918, 1609, 29898, 1792, 29892, 11636, 29922, 8516, 1125, 13, 1678, 9995, 2577, 278, 23481, 310, 4959, 988, 278, 1404, 756, 10643, 5999, 29879, 29889, 13, 13, 1678, 584, 3207, 1404, 29901, 319, 421, 2659, 29952, 13, 1678, 584, 3207, 11636, 29901, 9333, 3160, 4959, 5622, 2058, 373, 29914, 7045, 393, 2635, 13, 1678, 584, 2457, 29901, 319, 731, 310, 1741, 18999, 13, 1678, 9995, 13, 1678, 2346, 353, 313, 1792, 29889, 262, 29918, 3696, 29918, 562, 3137, 13, 632, 869, 7122, 29898, 2624, 29897, 13, 632, 869, 6768, 29898, 29876, 3543, 328, 877, 1792, 5477, 302, 3543, 328, 877, 2997, 29918, 2972, 5477, 2254, 29918, 6194, 877, 3696, 29918, 333, 8785, 13, 632, 869, 4572, 29898, 30022, 2624, 29889, 275, 29918, 311, 22742, 29892, 6864, 29889, 1975, 29918, 7045, 29898, 6008, 876, 13, 632, 869, 4572, 29898, 2624, 4040, 26706, 29889, 5349, 29918, 21895, 29918, 16074, 877, 2190, 29979, 29915, 4961, 13, 1678, 736, 426, 558, 26706, 29889, 3696, 29918, 333, 363, 5882, 297, 2346, 29913, 13, 13, 13, 1753, 679, 29918, 13604, 29918, 11600, 29918, 1609, 29898, 1792, 29892, 11636, 29922, 8516, 1125, 13, 1678, 9995, 2577, 278, 23481, 310, 4959, 2825, 491, 278, 1404, 29889, 13, 13, 1678, 584, 3207, 1404, 29901, 319, 421, 2659, 29952, 13, 1678, 584, 3207, 11636, 29901, 9333, 3160, 4959, 5622, 2058, 373, 29914, 7045, 393, 2635, 13, 1678, 584, 2457, 29901, 319, 731, 310, 1741, 18999, 13, 1678, 9995, 13, 1678, 2346, 353, 313, 1792, 29889, 11600, 29918, 13604, 13, 632, 869, 4572, 29898, 30022, 2624, 29889, 275, 29918, 311, 22742, 29892, 6864, 29889, 1975, 29918, 7045, 29898, 6008, 876, 13, 632, 869, 6768, 29898, 1359, 29918, 6194, 877, 333, 29915, 4961, 13, 1678, 736, 426, 3696, 29889, 333, 363, 1741, 297, 2346, 29913, 13, 13, 13, 1753, 679, 29918, 13604, 29918, 2541, 29918, 2324, 287, 29918, 3696, 29918, 6774, 787, 29898, 1792, 29892, 11636, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 7106, 263, 9657, 6943, 278, 1741, 18999, 322, 6297, 363, 599, 4959, 13, 1678, 988, 278, 1404, 338, 263, 11774, 10532, 470, 313, 262, 1206, 310, 263, 29197, 29897, 25657, 29889, 13, 13, 1678, 584, 3207, 1404, 29901, 319, 421, 2659, 29952, 13, 1678, 584, 3207, 11636, 29901, 9333, 3160, 4959, 5622, 2058, 373, 29914, 7045, 393, 2635, 13, 1678, 9995, 13, 1678, 2346, 353, 313, 1792, 29889, 3696, 29918, 6774, 787, 13, 632, 869, 2541, 29918, 296, 1907, 29898, 2624, 7435, 29889, 3696, 29918, 333, 29892, 6864, 3032, 1853, 29897, 13, 632, 869, 7122, 29898, 2624, 29892, 6864, 29889, 333, 1275, 6864, 7435, 29889, 3696, 29918, 333, 29897, 13, 632, 869, 4572, 29898, 2624, 7435, 29889, 3696, 29918, 4965, 29889, 1384, 3101, 13, 632, 869, 4572, 29898, 30022, 2624, 29889, 275, 29918, 311, 22742, 29892, 6864, 29889, 1975, 29918, 7045, 29898, 6008, 4961, 13, 1678, 736, 426, 3696, 29918, 333, 29901, 6702, 781, 545, 29918, 5965, 5790, 29915, 565, 1741, 29918, 1853, 1275, 6864, 1542, 29889, 781, 545, 1683, 525, 535, 1659, 29918, 305, 1466, 1495, 13, 9651, 363, 1741, 29918, 333, 29892, 1741, 29918, 1853, 297, 2346, 29913, 13, 13, 13, 1753, 679, 29918, 8172, 29918, 2780, 29898, 3696, 1125, 13, 1678, 16706, 353, 28301, 29889, 1972, 29889, 4572, 29898, 20130, 557, 29889, 9346, 300, 519, 29918, 8269, 29889, 5349, 29898, 3696, 29922, 3696, 876, 13, 1678, 1304, 29918, 27703, 353, 426, 29879, 29889, 27703, 363, 269, 297, 1741, 29889, 29879, 10964, 29913, 891, 426, 29890, 29889, 27703, 363, 289, 297, 16706, 29913, 13, 1678, 443, 3880, 29918, 27703, 353, 731, 29898, 657, 29918, 27703, 3101, 448, 1304, 29918, 27703, 13, 1678, 736, 4036, 29889, 16957, 29898, 23583, 29898, 348, 3880, 29918, 27703, 29897, 470, 679, 29918, 27703, 3101, 13, 13, 13, 1753, 28755, 29918, 3696, 29918, 10532, 29898, 10532, 1125, 13, 1678, 9995, 1748, 6646, 6864, 7435, 304, 4663, 29899, 4561, 1203, 1213, 15945, 13, 1678, 736, 11117, 29918, 1853, 2396, 525, 2624, 7435, 742, 13, 9651, 525, 333, 2396, 2022, 29889, 333, 29892, 13, 9651, 525, 5269, 2396, 2022, 29889, 5269, 29892, 13, 9651, 525, 978, 2396, 2022, 29889, 4990, 29918, 8159, 29918, 978, 29892, 13, 9651, 525, 4102, 1170, 2396, 2022, 29889, 4102, 29918, 978, 29892, 13, 9651, 525, 11922, 1170, 2396, 2022, 29889, 4230, 29918, 978, 29892, 13, 9651, 525, 3257, 2396, 2022, 29889, 3257, 29892, 13, 9651, 525, 3470, 2638, 362, 2396, 2022, 29889, 3470, 2638, 362, 29892, 13, 9651, 525, 6710, 2396, 2022, 29889, 6710, 29892, 13, 9651, 525, 7328, 2396, 2022, 29889, 7328, 29892, 13, 9651, 525, 1792, 29918, 333, 2396, 2022, 29889, 1792, 29918, 333, 29913, 13, 13, 13, 1753, 28755, 29918, 10532, 29918, 2324, 29898, 10532, 29918, 2324, 1125, 13, 1678, 9995, 1748, 6646, 5196, 6595, 304, 4663, 29899, 4561, 1203, 1213, 15945, 13, 1678, 848, 353, 11117, 5269, 2396, 2022, 29918, 2324, 29889, 10532, 29889, 5269, 29892, 13, 9651, 525, 978, 2396, 2022, 29918, 2324, 29889, 4990, 29918, 8159, 29918, 978, 29892, 13, 9651, 525, 8159, 1170, 2396, 2022, 29918, 2324, 29889, 4990, 29918, 8159, 29918, 978, 29892, 13, 9651, 525, 4102, 1170, 2396, 2022, 29918, 2324, 29889, 4102, 29918, 978, 29892, 13, 9651, 525, 11922, 1170, 2396, 2022, 29918, 2324, 29889, 4230, 29918, 978, 29892, 13, 9651, 525, 3257, 2396, 2022, 29918, 2324, 29889, 3257, 29892, 13, 9651, 525, 3470, 2638, 362, 2396, 2022, 29918, 2324, 29889, 3470, 2638, 362, 29892, 13, 9651, 525, 6710, 2396, 2022, 29918, 2324, 29889, 6710, 29892, 13, 9651, 525, 7328, 2396, 2022, 29918, 2324, 29889, 7328, 29892, 13, 9651, 525, 4990, 7514, 2396, 2022, 29918, 2324, 29889, 4990, 29918, 2098, 29892, 13, 9651, 525, 29721, 2396, 2022, 29918, 2324, 29889, 10532, 29889, 1792, 29918, 333, 29913, 13, 1678, 565, 2022, 29918, 2324, 29889, 10532, 29889, 333, 338, 451, 6213, 29901, 13, 4706, 396, 512, 1206, 310, 263, 15141, 2715, 2022, 591, 871, 28755, 278, 848, 1449, 13, 4706, 396, 565, 278, 883, 29915, 29879, 8845, 5229, 322, 278, 1746, 4225, 304, 367, 8833, 13, 4706, 396, 411, 278, 1021, 848, 29889, 29871, 2398, 29892, 1286, 591, 1016, 29915, 29873, 505, 263, 2022, 3553, 1951, 13, 4706, 396, 278, 2022, 471, 2360, 2825, 29892, 577, 565, 591, 3638, 385, 3553, 29914, 1853, 297, 278, 13, 4706, 396, 7797, 1891, 848, 372, 29915, 645, 367, 2665, 1250, 322, 4556, 385, 1059, 408, 372, 29915, 645, 2615, 13, 4706, 396, 408, 385, 5923, 2022, 2012, 310, 263, 716, 697, 746, 11834, 5367, 278, 883, 13, 4706, 396, 1449, 29889, 13, 4706, 848, 29889, 5504, 3319, 15972, 1853, 2396, 525, 7435, 6595, 742, 13, 462, 268, 525, 333, 2396, 2022, 29918, 2324, 29889, 10532, 29889, 333, 29892, 13, 462, 268, 525, 10532, 1204, 2396, 2022, 29918, 2324, 29889, 10532, 29889, 333, 1800, 13, 1678, 736, 848, 13, 13, 13, 1753, 2767, 29918, 3318, 29918, 558, 2173, 29886, 1338, 29898, 5415, 29892, 716, 29918, 558, 2173, 29886, 1338, 29892, 1303, 29918, 5943, 29922, 8824, 29892, 2989, 29918, 5943, 29922, 8824, 29892, 10751, 29922, 8516, 1125, 13, 1678, 9995, 6422, 385, 1203, 29915, 29879, 319, 6154, 411, 263, 716, 1051, 310, 3420, 1338, 29889, 13, 13, 1678, 1222, 23617, 697, 2980, 714, 310, 421, 949, 29918, 5943, 1673, 421, 8159, 29918, 5943, 29952, 322, 421, 12154, 29952, 1818, 367, 6790, 29889, 13, 13, 1678, 584, 3207, 5446, 29901, 450, 1203, 304, 2767, 29889, 19928, 505, 4954, 562, 29880, 29918, 26586, 16159, 13, 1678, 584, 3207, 716, 29918, 558, 2173, 29886, 1338, 29901, 450, 731, 6943, 278, 716, 3420, 1338, 13, 1678, 584, 3207, 1303, 29918, 5943, 29901, 26460, 278, 1303, 2130, 319, 6154, 881, 367, 4784, 13, 1678, 584, 3207, 2989, 29918, 5943, 29901, 26460, 278, 2989, 2130, 319, 6154, 881, 367, 4784, 13, 1678, 584, 3207, 10751, 29901, 450, 6297, 319, 6154, 393, 881, 367, 4784, 13, 1678, 9995, 13, 1678, 565, 1303, 29918, 5943, 718, 2989, 29918, 5943, 718, 6120, 29898, 16074, 29897, 2804, 29871, 29896, 29901, 13, 4706, 12020, 7865, 2392, 877, 11730, 697, 319, 6154, 2875, 508, 367, 6790, 1495, 13, 1678, 565, 2989, 29918, 5943, 29901, 13, 4706, 5923, 353, 426, 562, 29880, 29889, 558, 26706, 363, 263, 695, 297, 5446, 29889, 562, 29880, 29918, 26586, 565, 263, 695, 29889, 8159, 29918, 5943, 29913, 13, 4706, 16690, 353, 11117, 8159, 29918, 5943, 2396, 5852, 29913, 13, 4706, 337, 5744, 353, 11117, 8159, 29918, 5943, 2396, 7700, 29913, 13, 1678, 25342, 1303, 29918, 5943, 29901, 13, 4706, 5923, 353, 426, 562, 29880, 29889, 558, 26706, 363, 263, 695, 297, 5446, 29889, 562, 29880, 29918, 26586, 565, 263, 695, 29889, 949, 29918, 5943, 29913, 13, 4706, 16690, 353, 11117, 949, 29918, 5943, 2396, 5852, 29913, 13, 4706, 337, 5744, 353, 11117, 949, 29918, 5943, 2396, 7700, 29913, 13, 1678, 25342, 10751, 29901, 13, 4706, 5923, 353, 426, 562, 29880, 29889, 558, 26706, 13, 462, 1678, 363, 263, 695, 297, 5446, 29889, 562, 29880, 29918, 26586, 13, 462, 1678, 565, 263, 695, 29889, 5349, 29918, 21895, 29918, 16074, 29898, 16074, 29892, 6261, 29922, 5574, 2915, 13, 4706, 16690, 353, 11117, 1202, 29918, 17858, 6847, 2396, 426, 16074, 930, 13, 4706, 337, 5744, 353, 11117, 6144, 29918, 17858, 6847, 2396, 426, 16074, 930, 13, 13, 1678, 716, 29918, 558, 2173, 29886, 1338, 353, 731, 29898, 1482, 29918, 558, 2173, 29886, 1338, 29897, 13, 1678, 2715, 353, 716, 29918, 558, 2173, 29886, 1338, 448, 5923, 13, 1678, 6206, 353, 5923, 448, 716, 29918, 558, 2173, 29886, 1338, 13, 1678, 363, 5882, 297, 2715, 29901, 13, 4706, 5446, 29889, 5504, 29918, 558, 26706, 29898, 558, 26706, 29892, 3579, 629, 424, 29897, 13, 1678, 363, 5882, 297, 6206, 29901, 13, 4706, 5446, 29889, 5504, 29918, 558, 26706, 29898, 558, 26706, 29892, 3579, 276, 5744, 29897, 13, 1678, 736, 11117, 23959, 2396, 2715, 29892, 525, 1745, 8238, 2396, 6206, 29913, 13, 13, 13, 1990, 2391, 21575, 5160, 29901, 13, 1678, 9995, 5160, 770, 363, 4413, 15859, 8820, 373, 1894, 1417, 1203, 8857, 29889, 13, 13, 1678, 584, 3207, 1741, 29901, 450, 6942, 421, 2624, 29952, 13, 1678, 584, 3207, 6251, 29918, 3560, 29901, 450, 3847, 310, 278, 9976, 310, 278, 1051, 29889, 960, 372, 29915, 29879, 6213, 29892, 13, 462, 308, 278, 3847, 338, 12023, 304, 367, 278, 1741, 3528, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 29901, 450, 16248, 310, 278, 1051, 10643, 1813, 13, 1678, 16248, 353, 6213, 13, 1678, 396, 29901, 853, 1387, 1051, 15882, 13, 1678, 1051, 29918, 2324, 29918, 1853, 353, 6213, 13, 1678, 396, 29901, 450, 2322, 1051, 5285, 8600, 13, 1678, 2322, 29918, 1761, 29918, 2917, 353, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1741, 29892, 6251, 29918, 3560, 29922, 8516, 1125, 13, 4706, 396, 29901, 450, 1741, 278, 1051, 338, 6942, 411, 13, 4706, 1583, 29889, 3696, 353, 1741, 13, 4706, 396, 29901, 450, 3847, 1203, 310, 278, 1051, 4452, 13, 4706, 1583, 29889, 8269, 29918, 3560, 353, 6251, 29918, 3560, 470, 1741, 13, 4706, 396, 29901, 12481, 29879, 393, 3978, 403, 515, 278, 1051, 2944, 29915, 29879, 4426, 29892, 13, 4706, 396, 29901, 21702, 2992, 29892, 541, 451, 515, 1404, 3342, 4235, 313, 29872, 29889, 29887, 29889, 13, 4706, 396, 29901, 22583, 29914, 1285, 3224, 4235, 29897, 13, 4706, 1583, 29889, 7959, 29918, 7076, 353, 6571, 13, 4706, 1583, 29889, 17833, 29918, 26705, 353, 6571, 13, 4706, 1583, 29889, 7959, 29918, 2324, 29918, 3880, 353, 525, 2917, 29915, 297, 2009, 29889, 5085, 13, 13, 1678, 822, 903, 657, 29918, 2917, 29918, 7924, 29918, 1989, 29898, 1311, 1125, 13, 4706, 9995, 1523, 4220, 278, 5412, 5285, 3553, 29889, 13, 13, 4706, 910, 3553, 674, 367, 1304, 408, 263, 1820, 304, 731, 278, 1051, 29915, 29879, 5285, 304, 278, 13, 4706, 4867, 29889, 13, 4706, 9995, 13, 4706, 736, 285, 29915, 29912, 1311, 29889, 1761, 29918, 2324, 29918, 1853, 2403, 2917, 648, 1311, 29889, 8269, 29918, 3560, 29889, 333, 10162, 13, 13, 1678, 822, 903, 657, 29918, 2917, 29898, 1311, 1125, 13, 4706, 9995, 5896, 278, 1051, 29915, 29879, 5285, 515, 278, 6535, 322, 736, 372, 1213, 15945, 13, 4706, 4867, 29918, 1989, 353, 1583, 3032, 657, 29918, 2917, 29918, 7924, 29918, 1989, 580, 13, 4706, 565, 1583, 29889, 7959, 29918, 2324, 29918, 3880, 29901, 13, 9651, 318, 5416, 353, 2009, 29889, 5085, 1839, 2917, 2033, 13, 9651, 5285, 353, 624, 2454, 1293, 6595, 29889, 1359, 29898, 1311, 29889, 3696, 29892, 1583, 29889, 1761, 29918, 2324, 29918, 1853, 29892, 318, 5416, 29897, 13, 9651, 565, 5285, 322, 5285, 1839, 8269, 29918, 3560, 29918, 333, 2033, 1275, 1583, 29889, 8269, 29918, 3560, 29889, 333, 29901, 13, 18884, 4867, 29961, 7924, 29918, 1989, 29962, 353, 5285, 1839, 1272, 2033, 13, 4706, 736, 4867, 29889, 657, 29898, 7924, 29918, 1989, 29892, 1583, 29889, 4381, 29918, 1761, 29918, 2917, 29897, 13, 13, 1678, 822, 903, 5451, 29918, 667, 29918, 4841, 29898, 1311, 29892, 2944, 29918, 4841, 29892, 28128, 29918, 1853, 29922, 8516, 1125, 13, 4706, 9995, 2008, 862, 403, 278, 7343, 2944, 18999, 515, 278, 2294, 29889, 13, 13, 4706, 584, 3207, 2944, 29918, 4841, 29901, 450, 1051, 310, 18999, 304, 367, 8536, 4430, 29889, 13, 4706, 584, 3207, 28128, 29918, 1853, 29901, 450, 1134, 310, 278, 2944, 304, 2967, 278, 8877, 292, 373, 29889, 13, 462, 1669, 960, 278, 995, 338, 525, 16626, 742, 278, 740, 674, 13, 462, 1669, 736, 263, 18761, 988, 278, 937, 1543, 338, 263, 1051, 13, 462, 1669, 310, 278, 7343, 2944, 23481, 322, 278, 1473, 1543, 263, 13, 462, 1669, 1051, 310, 278, 1791, 2944, 23481, 29889, 960, 278, 995, 338, 13, 462, 1669, 525, 7959, 742, 278, 937, 1543, 310, 278, 4133, 13, 462, 1669, 18761, 674, 367, 263, 1051, 310, 278, 2294, 2944, 23481, 29889, 13, 4706, 584, 2457, 29901, 319, 18761, 310, 29871, 29906, 8857, 408, 263, 1121, 310, 278, 2944, 29918, 4841, 1051, 13, 462, 8877, 292, 29889, 13, 4706, 9995, 13, 4706, 565, 28128, 29918, 1853, 1275, 525, 16626, 2396, 13, 9651, 7343, 29918, 667, 29918, 4841, 353, 518, 667, 29918, 333, 363, 2944, 29918, 333, 297, 2944, 29918, 4841, 565, 451, 338, 8758, 29898, 667, 29918, 333, 29892, 851, 4638, 13, 9651, 736, 7343, 29918, 667, 29918, 4841, 29892, 518, 667, 29918, 333, 363, 2944, 29918, 333, 297, 2944, 29918, 4841, 565, 2944, 29918, 333, 451, 297, 7343, 29918, 667, 29918, 4841, 29962, 13, 4706, 25342, 28128, 29918, 1853, 1275, 525, 7959, 2396, 13, 9651, 2294, 29918, 667, 29918, 4841, 353, 518, 667, 29918, 333, 363, 2944, 29918, 333, 297, 2944, 29918, 4841, 565, 2944, 29918, 333, 297, 1583, 29889, 7959, 29918, 7076, 29962, 13, 9651, 736, 2294, 29918, 667, 29918, 4841, 29892, 518, 667, 29918, 333, 363, 2944, 29918, 333, 297, 2944, 29918, 4841, 565, 2944, 29918, 333, 451, 297, 2294, 29918, 667, 29918, 4841, 29962, 13, 4706, 736, 2944, 29918, 4841, 29892, 13, 13, 1678, 822, 903, 4282, 29918, 1972, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 2346, 310, 278, 1051, 29915, 29879, 9976, 29889, 13, 13, 4706, 450, 2346, 881, 451, 2125, 964, 3633, 278, 1404, 29915, 29879, 21166, 13, 4706, 5285, 29892, 363, 1342, 1057, 13, 13, 9651, 736, 2866, 3224, 29889, 1972, 29889, 2541, 29918, 3560, 29898, 1311, 29889, 3696, 29897, 13, 4706, 9995, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 903, 4572, 29918, 1761, 29918, 26586, 29898, 1311, 29892, 2346, 29892, 18094, 1125, 13, 4706, 9995, 2052, 368, 1404, 29915, 29879, 18094, 304, 2346, 322, 736, 372, 1213, 15945, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 903, 657, 29918, 26705, 29918, 3166, 29918, 3827, 29898, 1311, 1125, 13, 4706, 9995, 2577, 278, 716, 18094, 1156, 278, 4175, 883, 338, 18397, 1213, 15945, 13, 4706, 822, 679, 29918, 8391, 29918, 6768, 29898, 667, 29918, 333, 29892, 2944, 1125, 13, 9651, 565, 2944, 29889, 657, 877, 4572, 29918, 1859, 1575, 1495, 470, 2944, 29889, 657, 877, 1853, 1495, 1275, 525, 11227, 2396, 13, 18884, 736, 518, 29916, 565, 921, 2804, 525, 8516, 29915, 1683, 6213, 363, 921, 297, 2009, 29889, 689, 29889, 657, 1761, 29898, 29888, 29915, 2671, 648, 667, 29918, 333, 29913, 1495, 29962, 13, 13, 4706, 18094, 353, 6483, 8552, 29898, 1311, 29889, 4381, 29918, 1761, 29918, 2917, 1839, 26705, 11287, 13, 4706, 363, 2944, 29918, 333, 29892, 2944, 297, 1583, 29889, 7959, 29918, 7076, 29889, 7076, 7295, 13, 9651, 3987, 353, 679, 29918, 8391, 29918, 6768, 29898, 667, 29918, 333, 29892, 2944, 29897, 13, 9651, 565, 3987, 29901, 13, 18884, 18094, 1839, 7076, 2033, 29961, 667, 29918, 333, 29962, 353, 3987, 13, 4706, 363, 2944, 29918, 333, 29892, 2944, 297, 1583, 29889, 17833, 29918, 26705, 29889, 7076, 7295, 13, 9651, 3987, 353, 679, 29918, 8391, 29918, 6768, 29898, 667, 29918, 333, 29892, 2944, 29897, 13, 9651, 565, 3987, 29901, 13, 18884, 18094, 1839, 17833, 2033, 29961, 667, 29918, 333, 29962, 353, 3987, 13, 4706, 736, 18094, 13, 13, 1678, 822, 679, 29918, 1761, 29918, 2271, 29898, 1311, 29892, 318, 5416, 29922, 8516, 29892, 7029, 29922, 8824, 1125, 13, 4706, 9995, 11609, 278, 3988, 310, 278, 1051, 10643, 1813, 1213, 15945, 13, 4706, 736, 3142, 29918, 1454, 29898, 1311, 29889, 29734, 29892, 1583, 29889, 8269, 29918, 3560, 29892, 2295, 29922, 25118, 29892, 903, 23176, 29922, 23176, 29897, 13, 13, 1678, 822, 5706, 29918, 7959, 29918, 2271, 29898, 1311, 1125, 13, 4706, 9995, 11609, 263, 3988, 411, 263, 318, 5416, 16811, 304, 278, 1051, 29915, 29879, 5285, 1213, 15945, 13, 4706, 4867, 29918, 1989, 353, 1583, 3032, 657, 29918, 2917, 29918, 7924, 29918, 1989, 580, 13, 4706, 5285, 353, 426, 13, 9651, 525, 8269, 29918, 3560, 29918, 333, 2396, 1583, 29889, 8269, 29918, 3560, 29889, 333, 29892, 13, 9651, 525, 1272, 2396, 4867, 29889, 657, 29898, 7924, 29918, 1989, 29897, 13, 4706, 500, 13, 4706, 565, 5285, 1839, 1272, 2033, 29901, 13, 9651, 1544, 353, 624, 2454, 1293, 6595, 29889, 3258, 29898, 1311, 29889, 3696, 29892, 1583, 29889, 1761, 29918, 2324, 29918, 1853, 29892, 5285, 29897, 13, 9651, 736, 1583, 29889, 657, 29918, 1761, 29918, 2271, 29898, 25118, 29922, 2324, 29889, 25118, 29892, 7029, 29922, 5574, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 657, 29918, 1761, 29918, 2271, 29898, 23176, 29922, 5574, 29897, 13, 13, 1678, 822, 3787, 29918, 13305, 29898, 1311, 1125, 13, 4706, 9995, 5896, 278, 18094, 515, 278, 2009, 322, 3787, 963, 297, 278, 4867, 1213, 15945, 13, 4706, 18094, 353, 1583, 3032, 657, 29918, 26705, 29918, 3166, 29918, 3827, 580, 13, 4706, 4867, 29918, 1989, 353, 1583, 3032, 657, 29918, 2917, 29918, 7924, 29918, 1989, 580, 13, 4706, 1583, 29889, 1761, 29918, 2917, 353, 4867, 29889, 842, 4381, 29898, 7924, 29918, 1989, 29892, 426, 1800, 13, 4706, 1583, 29889, 1761, 29918, 2917, 1839, 26705, 2033, 353, 18094, 13, 4706, 565, 2009, 29889, 5975, 29889, 657, 877, 12872, 29918, 7076, 29374, 13, 9651, 7962, 29918, 7076, 353, 4390, 29889, 18132, 29898, 3827, 29889, 5975, 1839, 12872, 29918, 7076, 11287, 13, 9651, 1583, 29889, 1761, 29918, 2917, 1839, 7076, 2033, 353, 12705, 29898, 12872, 29918, 7076, 29892, 1820, 29922, 710, 29897, 13, 4706, 4867, 29889, 1545, 2164, 353, 5852, 13, 13, 1678, 822, 11013, 29918, 3888, 29918, 4906, 29898, 1311, 29892, 5446, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 13, 1753, 1653, 29918, 3696, 29918, 14569, 29918, 7050, 29918, 1445, 29898, 3696, 29892, 13128, 3972, 29922, 8516, 1125, 13, 1678, 9995, 4391, 263, 13201, 934, 411, 278, 1741, 29915, 29879, 20194, 29889, 13, 13, 1678, 960, 421, 7050, 3972, 29952, 338, 6790, 29892, 278, 20194, 934, 338, 2825, 297, 727, 322, 13, 1678, 263, 2224, 6198, 304, 393, 3884, 338, 4133, 29889, 13, 1678, 9995, 13, 1678, 20194, 29918, 7299, 353, 1741, 29889, 14569, 29918, 19635, 13, 1678, 20194, 29918, 17588, 353, 4140, 29918, 17588, 29898, 14569, 29918, 7299, 1839, 3051, 29918, 1853, 11287, 470, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 14569, 29918, 7299, 1839, 9507, 2033, 9601, 29896, 29962, 13, 1678, 5694, 29918, 1445, 353, 405, 2795, 5776, 1971, 653, 2283, 29898, 8143, 29922, 8824, 29892, 4516, 7607, 7050, 3972, 470, 2295, 29889, 4330, 3580, 29918, 9464, 511, 25557, 29922, 14569, 29918, 17588, 29897, 13, 1678, 5694, 29918, 1445, 29889, 3539, 29898, 3696, 29889, 14569, 29897, 13, 1678, 5694, 29918, 1445, 29889, 23126, 580, 13, 1678, 736, 2897, 29889, 2084, 29889, 2674, 2084, 29898, 7382, 29918, 1445, 29889, 978, 29892, 13128, 3972, 29897, 565, 13128, 3972, 1683, 5694, 29918, 1445, 29889, 978, 13, 13, 13, 29992, 4703, 12847, 13, 1753, 5702, 29918, 2230, 29918, 25990, 29898, 6921, 29918, 21843, 29922, 8824, 29892, 1404, 29922, 8516, 1125, 13, 1678, 9995, 17936, 931, 3620, 310, 1741, 3618, 29889, 13, 13, 1678, 910, 8128, 263, 1051, 310, 3620, 1550, 278, 3030, 8455, 471, 13, 1678, 6136, 322, 884, 23660, 421, 3706, 29918, 15033, 29952, 18470, 29889, 13, 13, 1678, 960, 278, 775, 2734, 2768, 278, 4954, 2541, 16159, 2908, 310, 445, 3030, 13, 1678, 8455, 1153, 4637, 385, 3682, 29892, 694, 18470, 674, 367, 19799, 29889, 13, 13, 1678, 584, 3207, 4469, 29918, 21843, 29901, 26460, 6251, 11825, 674, 679, 1009, 24371, 13, 462, 4706, 6336, 10410, 470, 451, 29889, 6978, 292, 4954, 29915, 2962, 11120, 29952, 674, 13, 462, 4706, 10985, 871, 1369, 12865, 29892, 4954, 29915, 355, 11120, 29952, 304, 10985, 871, 13, 462, 4706, 1095, 12865, 29889, 13, 1678, 584, 3207, 1404, 29901, 450, 421, 2659, 29952, 393, 674, 7135, 931, 3620, 29889, 13, 1678, 9995, 13, 1678, 565, 4469, 29918, 21843, 29901, 13, 4706, 4974, 1404, 338, 451, 6213, 13, 1678, 565, 525, 1025, 29918, 3706, 29915, 297, 330, 29901, 13, 4706, 12020, 24875, 2392, 877, 2230, 1735, 23110, 1122, 451, 367, 9322, 1495, 13, 1678, 330, 29889, 1025, 29918, 3706, 353, 2322, 8977, 29898, 8977, 29897, 13, 1678, 3620, 353, 2322, 8977, 29898, 8977, 29897, 13, 1678, 1018, 29901, 13, 4706, 7709, 3620, 13, 1678, 5174, 8960, 29901, 13, 4706, 628, 330, 29889, 1025, 29918, 3706, 13, 4706, 12020, 13, 1678, 1683, 29901, 13, 4706, 565, 4469, 29918, 21843, 29901, 13, 9651, 491, 29918, 2962, 353, 4469, 29918, 21843, 297, 313, 5574, 29892, 525, 2962, 1495, 13, 9651, 491, 29918, 355, 353, 4469, 29918, 21843, 297, 313, 5574, 29892, 525, 355, 1495, 13, 9651, 2847, 29918, 25990, 353, 731, 29898, 29887, 29889, 1025, 29918, 3706, 29897, 13, 9651, 396, 330, 29889, 1025, 29918, 3706, 3620, 2645, 12541, 13, 9651, 363, 5446, 297, 1051, 29898, 29887, 29889, 1025, 29918, 3706, 1125, 13, 18884, 565, 451, 338, 8758, 29898, 5415, 29892, 6864, 1125, 13, 462, 1678, 5446, 29889, 21843, 29918, 3560, 29898, 1609, 29918, 2962, 29922, 1609, 29918, 2962, 29892, 491, 29918, 355, 29922, 1609, 29918, 355, 29897, 13, 9651, 3209, 6332, 29918, 25990, 353, 731, 29898, 29887, 29889, 1025, 29918, 3706, 29897, 448, 2847, 29918, 25990, 13, 9651, 363, 5446, 297, 3209, 6332, 29918, 25990, 29901, 13, 18884, 565, 338, 8758, 29898, 5415, 29892, 6864, 1125, 13, 462, 1678, 565, 451, 5446, 29889, 3068, 29918, 1171, 482, 29898, 1792, 1125, 13, 462, 4706, 396, 14402, 29901, 12020, 1152, 29890, 4215, 15283, 1156, 4417, 13047, 1423, 297, 278, 3740, 13, 462, 4706, 12020, 4911, 1917, 2392, 7373, 877, 10858, 3158, 6858, 21733, 310, 1741, 24371, 29892, 541, 366, 526, 525, 13, 462, 462, 1669, 525, 1333, 4148, 1891, 304, 10933, 278, 1741, 6169, 876, 13, 18884, 25342, 451, 5446, 29889, 3318, 29889, 3068, 29918, 1171, 482, 29898, 1792, 1125, 13, 462, 1678, 396, 14402, 29901, 12020, 1152, 29890, 4215, 15283, 1156, 4417, 13047, 1423, 297, 278, 3740, 13, 462, 1678, 12020, 4911, 1917, 2392, 7373, 877, 10858, 3158, 6858, 21733, 310, 4867, 2908, 24371, 29892, 541, 366, 526, 525, 13, 462, 462, 965, 525, 1333, 4148, 1891, 304, 10933, 278, 4867, 2908, 6169, 876, 13, 4706, 2030, 29918, 3706, 353, 330, 29889, 7323, 877, 1025, 29918, 3706, 1495, 13, 4706, 363, 5446, 29892, 5235, 297, 2030, 29918, 3706, 29889, 7076, 7295, 13, 9651, 565, 338, 8758, 29898, 5415, 29892, 7870, 300, 519, 9634, 1125, 13, 18884, 5446, 353, 5446, 29889, 3318, 13, 9651, 565, 5446, 29889, 2962, 29918, 6008, 2804, 5235, 1839, 2962, 29918, 6008, 2033, 29901, 13, 18884, 3620, 29961, 5415, 22322, 2962, 29918, 6008, 2033, 353, 313, 3888, 1839, 2962, 29918, 6008, 7464, 5446, 29889, 2962, 29918, 6008, 29897, 13, 9651, 565, 5446, 29889, 19708, 2804, 5235, 1839, 19708, 2033, 29901, 13, 18884, 3620, 29961, 5415, 22322, 19708, 2033, 353, 313, 3888, 1839, 19708, 7464, 5446, 29889, 19708, 29897, 13, 9651, 565, 5446, 29889, 355, 29918, 6008, 2804, 5235, 1839, 355, 29918, 6008, 2033, 29901, 13, 18884, 3620, 29961, 5415, 22322, 355, 29918, 6008, 2033, 353, 313, 3888, 1839, 355, 29918, 6008, 7464, 5446, 29889, 355, 29918, 6008, 29897, 13, 4706, 363, 5446, 29892, 5446, 29918, 25990, 297, 3620, 29889, 7076, 7295, 13, 9651, 6251, 353, 6213, 565, 338, 8758, 29898, 5415, 29892, 6864, 29897, 1683, 5446, 29889, 9346, 300, 519, 29918, 8269, 13, 9651, 18470, 29889, 3696, 29889, 3706, 29918, 15033, 29889, 6717, 29898, 1853, 29898, 5415, 511, 6251, 29922, 8269, 29892, 5446, 29922, 5415, 29892, 3620, 29922, 5415, 29918, 25990, 29897, 13, 13, 13, 1753, 6036, 29918, 2230, 29918, 3167, 29898, 8269, 1125, 13, 1678, 9995, 15213, 263, 931, 29899, 12817, 1735, 363, 263, 5335, 300, 519, 6251, 29889, 13, 13, 1678, 910, 338, 385, 7463, 16876, 740, 1304, 297, 278, 4733, 304, 2407, 13, 1678, 3620, 310, 278, 1369, 931, 470, 14385, 29889, 29871, 450, 3620, 526, 19884, 13, 1678, 1549, 278, 421, 11294, 29918, 2230, 29918, 25990, 29952, 3030, 12847, 740, 29889, 13, 1678, 9995, 13, 1678, 396, 565, 372, 29915, 29879, 263, 716, 1203, 372, 29915, 29879, 451, 263, 1735, 577, 591, 925, 11455, 372, 13, 1678, 565, 451, 16096, 29898, 8269, 467, 6774, 9696, 29901, 13, 4706, 736, 13, 1678, 1018, 29901, 13, 4706, 2030, 29918, 3706, 353, 330, 29889, 1025, 29918, 3706, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 10191, 353, 285, 29915, 2481, 1735, 310, 426, 8269, 29913, 471, 451, 5702, 287, 29915, 13, 4706, 565, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 1525, 7390, 29374, 13, 9651, 18116, 29889, 25442, 29898, 7645, 718, 525, 313, 11739, 11543, 304, 263, 9177, 1951, 366, 526, 773, 278, 5195, 7390, 29897, 742, 5096, 5563, 29922, 29906, 29897, 13, 9651, 736, 13, 4706, 25342, 1857, 29918, 932, 29889, 2917, 1839, 18267, 4214, 2033, 29901, 13, 9651, 18116, 29889, 25442, 29898, 7645, 718, 525, 313, 11739, 11543, 304, 263, 9177, 2645, 6987, 29897, 742, 5096, 5563, 29922, 29906, 29897, 13, 9651, 736, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 29898, 7645, 29897, 13, 1678, 363, 1746, 297, 6702, 2962, 29918, 6008, 742, 525, 19708, 742, 525, 355, 29918, 6008, 29374, 13, 4706, 565, 2030, 29918, 3706, 29961, 8269, 1822, 657, 29898, 2671, 29897, 338, 6213, 29901, 13, 9651, 2030, 29918, 3706, 29961, 8269, 3816, 2671, 29962, 353, 679, 5552, 29898, 8269, 29892, 1746, 29897, 13, 13, 13, 1753, 6036, 29918, 3696, 29918, 2230, 29918, 3167, 29898, 3696, 1125, 13, 1678, 9995, 15213, 263, 931, 29899, 12817, 1735, 363, 385, 1741, 29889, 13, 13, 1678, 910, 338, 385, 7463, 16876, 740, 1304, 297, 278, 1904, 304, 2407, 13, 1678, 3620, 310, 278, 1369, 931, 470, 1095, 931, 29889, 29871, 450, 3620, 526, 19884, 13, 1678, 1549, 278, 421, 11294, 29918, 2230, 29918, 25990, 29952, 3030, 12847, 740, 29889, 13, 1678, 9995, 13, 1678, 396, 565, 372, 29915, 29879, 263, 716, 1203, 372, 29915, 29879, 451, 263, 1735, 577, 591, 925, 11455, 372, 13, 1678, 565, 451, 16096, 29898, 3696, 467, 6774, 9696, 29901, 13, 4706, 736, 13, 1678, 1018, 29901, 13, 4706, 2030, 29918, 3706, 353, 330, 29889, 1025, 29918, 3706, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 10191, 353, 285, 29915, 2481, 1735, 310, 426, 3696, 29913, 471, 451, 5702, 287, 29915, 13, 4706, 565, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 1525, 7390, 29374, 13, 9651, 18116, 29889, 25442, 29898, 7645, 718, 525, 313, 11739, 11543, 304, 263, 9177, 1951, 366, 526, 773, 278, 5195, 7390, 29897, 742, 5096, 5563, 29922, 29906, 29897, 13, 9651, 736, 13, 4706, 25342, 1857, 29918, 932, 29889, 2917, 1839, 18267, 4214, 2033, 29901, 13, 9651, 18116, 29889, 25442, 29898, 7645, 718, 525, 313, 11739, 11543, 304, 263, 9177, 2645, 6987, 29897, 742, 5096, 5563, 29922, 29906, 29897, 13, 9651, 736, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 29898, 7645, 29897, 13, 1678, 363, 1746, 297, 6702, 2962, 29918, 6008, 742, 525, 19708, 742, 525, 355, 29918, 6008, 29374, 13, 4706, 565, 2030, 29918, 3706, 29961, 3696, 1822, 657, 29898, 2671, 29897, 338, 6213, 29901, 13, 9651, 2030, 29918, 3706, 29961, 3696, 3816, 2671, 29962, 353, 679, 5552, 29898, 3696, 29892, 1746, 29897, 13, 13, 13, 29992, 4703, 12847, 13, 1753, 5702, 29918, 5479, 29918, 25990, 7295, 13, 1678, 9995, 17936, 4423, 3620, 310, 1741, 3618, 29889, 13, 13, 1678, 910, 8128, 263, 1051, 310, 3620, 1550, 278, 3030, 8455, 471, 13, 1678, 6136, 322, 884, 23660, 421, 5479, 29918, 15033, 29952, 18470, 29889, 13, 13, 1678, 960, 278, 775, 2734, 2768, 278, 4954, 2541, 16159, 2908, 310, 445, 3030, 13, 1678, 8455, 1153, 4637, 385, 3682, 29892, 694, 18470, 674, 367, 19799, 29889, 13, 1678, 9995, 13, 1678, 565, 525, 1025, 29918, 2029, 800, 29915, 297, 330, 29901, 13, 4706, 12020, 24875, 2392, 877, 5479, 1735, 23110, 1122, 451, 367, 9322, 1495, 13, 1678, 330, 29889, 1025, 29918, 2029, 800, 353, 2322, 8977, 29898, 8977, 29897, 13, 1678, 3620, 353, 2322, 8977, 29898, 8977, 29897, 13, 1678, 1018, 29901, 13, 4706, 7709, 3620, 13, 1678, 5174, 8960, 29901, 13, 4706, 628, 330, 29889, 1025, 29918, 2029, 800, 13, 4706, 12020, 13, 1678, 1683, 29901, 13, 4706, 2030, 29918, 2029, 800, 353, 330, 29889, 7323, 877, 1025, 29918, 2029, 800, 1495, 13, 4706, 28730, 353, 6702, 776, 29918, 8345, 29918, 333, 742, 525, 776, 29918, 8345, 29918, 978, 742, 525, 776, 29918, 9947, 29918, 333, 742, 525, 776, 29918, 9947, 29918, 978, 742, 525, 776, 29918, 7328, 742, 525, 262, 27069, 29918, 5479, 1495, 13, 4706, 363, 5446, 29892, 5235, 297, 2030, 29918, 2029, 800, 29889, 7076, 7295, 13, 9651, 363, 784, 297, 28730, 29901, 13, 18884, 716, 29918, 1767, 353, 679, 5552, 29898, 5415, 29892, 784, 29897, 13, 18884, 565, 716, 29918, 1767, 2804, 5235, 29961, 1054, 5387, 13, 462, 1678, 3620, 29961, 5415, 3816, 1054, 29962, 353, 313, 3888, 29961, 1054, 1402, 716, 29918, 1767, 29897, 13, 4706, 363, 5446, 29892, 5446, 29918, 25990, 297, 3620, 29889, 7076, 7295, 13, 9651, 18470, 29889, 3696, 29889, 5479, 29918, 15033, 29889, 6717, 29898, 1853, 29898, 5415, 511, 5446, 29922, 5415, 29892, 3620, 29922, 5415, 29918, 25990, 29897, 13, 13, 13, 1753, 6036, 29918, 5479, 29918, 3167, 29898, 8269, 1125, 13, 1678, 9995, 15213, 263, 4423, 29899, 12817, 1735, 363, 385, 1741, 1203, 29889, 13, 13, 1678, 910, 338, 385, 7463, 16876, 740, 1304, 297, 278, 4733, 304, 2407, 13, 1678, 3620, 310, 278, 4423, 2472, 29889, 29871, 450, 3620, 526, 19884, 13, 1678, 1549, 278, 421, 11294, 29918, 5479, 29918, 25990, 29952, 3030, 12847, 740, 29889, 13, 1678, 9995, 13, 1678, 396, 565, 372, 29915, 29879, 263, 716, 1203, 372, 29915, 29879, 451, 263, 1735, 577, 591, 925, 11455, 372, 13, 1678, 565, 451, 16096, 29898, 8269, 467, 6774, 9696, 29901, 13, 4706, 736, 13, 1678, 1018, 29901, 13, 4706, 2030, 29918, 2029, 800, 353, 330, 29889, 1025, 29918, 2029, 800, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 10191, 353, 285, 29915, 6508, 1735, 310, 426, 8269, 29913, 471, 451, 5702, 287, 29915, 13, 4706, 565, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 1525, 7390, 29374, 13, 9651, 18116, 29889, 25442, 29898, 7645, 718, 525, 313, 11739, 11543, 304, 263, 9177, 1951, 366, 526, 773, 278, 5195, 7390, 29897, 742, 5096, 5563, 29922, 29906, 29897, 13, 9651, 736, 13, 4706, 25342, 1857, 29918, 932, 29889, 2917, 1839, 18267, 4214, 2033, 29901, 13, 9651, 18116, 29889, 25442, 29898, 7645, 718, 525, 313, 11739, 11543, 304, 263, 9177, 2645, 6987, 29897, 742, 5096, 5563, 29922, 29906, 29897, 13, 9651, 736, 13, 4706, 1683, 29901, 13, 9651, 12020, 24875, 2392, 29898, 7645, 29897, 13, 1678, 363, 1746, 297, 6702, 776, 29918, 8345, 29918, 333, 742, 525, 776, 29918, 8345, 29918, 978, 742, 525, 776, 29918, 9947, 29918, 333, 742, 525, 776, 29918, 9947, 29918, 978, 742, 525, 776, 29918, 7328, 742, 525, 262, 27069, 29918, 5479, 29374, 13, 4706, 565, 2030, 29918, 2029, 800, 29961, 8269, 1822, 657, 29898, 2671, 29897, 338, 6213, 29901, 13, 9651, 2030, 29918, 2029, 800, 29961, 8269, 3816, 2671, 29962, 353, 679, 5552, 29898, 8269, 29892, 1746, 29897, 13, 13, 13, 1753, 28755, 29918, 3696, 29918, 1454, 29918, 936, 29898, 3696, 1125, 13, 1678, 736, 426, 13, 4706, 22868, 29888, 2209, 309, 2396, 525, 535, 1659, 18417, 742, 13, 4706, 525, 333, 2396, 1741, 29889, 333, 29892, 13, 4706, 525, 3257, 2396, 1741, 29889, 3257, 29892, 13, 4706, 525, 8216, 2396, 1741, 29889, 8216, 29892, 13, 4706, 525, 2962, 2539, 2396, 1741, 29889, 2962, 29918, 6008, 29892, 13, 4706, 525, 355, 2539, 2396, 1741, 29889, 355, 29918, 6008, 29892, 13, 4706, 525, 2271, 2396, 1741, 29889, 23176, 29918, 2271, 29892, 13, 4706, 525, 5479, 2396, 1741, 29889, 9947, 29918, 978, 29892, 13, 4706, 525, 8345, 13658, 978, 2396, 1741, 29889, 8345, 29918, 978, 29892, 13, 4706, 525, 5965, 21079, 2396, 19997, 13, 4706, 525, 1285, 3224, 29879, 2396, 5159, 13, 1678, 500, 13, 13, 13, 1753, 28755, 29918, 3696, 29918, 1454, 29918, 3126, 29918, 430, 29898, 3696, 29892, 2989, 29922, 8824, 1125, 13, 1678, 848, 353, 426, 13, 4706, 18803, 4703, 2396, 525, 1124, 597, 11010, 29889, 990, 742, 13, 4706, 18803, 1853, 2396, 525, 2624, 742, 13, 4706, 525, 2271, 2396, 1741, 29889, 23176, 29918, 2271, 29892, 13, 4706, 525, 978, 2396, 1741, 29889, 3257, 29892, 13, 4706, 525, 2962, 2539, 2396, 1741, 29889, 2962, 29918, 6008, 29918, 2997, 29889, 10718, 4830, 3285, 13, 4706, 525, 355, 2539, 2396, 1741, 29889, 355, 29918, 6008, 29918, 2997, 29889, 10718, 4830, 3285, 13, 4706, 525, 5479, 2396, 426, 13, 9651, 18803, 1853, 2396, 525, 22150, 742, 13, 9651, 525, 978, 2396, 1741, 29889, 9947, 29918, 978, 470, 525, 3782, 4423, 731, 742, 13, 9651, 525, 7328, 2396, 1741, 29889, 7328, 470, 525, 3782, 3211, 731, 29915, 13, 4706, 500, 13, 1678, 500, 13, 1678, 565, 2989, 322, 1741, 29889, 8216, 29901, 13, 4706, 848, 1839, 8216, 2033, 353, 17820, 29918, 11338, 29898, 3696, 29889, 8216, 29897, 13, 1678, 565, 2989, 322, 1741, 29889, 10532, 29918, 4965, 29901, 13, 4706, 848, 1839, 19826, 261, 2033, 353, 1051, 29898, 1958, 29898, 643, 6646, 29918, 10532, 29918, 1454, 29918, 3126, 29918, 430, 29892, 1741, 29889, 10532, 29918, 4965, 876, 13, 1678, 565, 2989, 322, 1741, 29889, 5349, 29918, 14569, 29901, 13, 4706, 848, 1839, 3027, 2033, 353, 1741, 29889, 23176, 29918, 14569, 29918, 2271, 13, 1678, 736, 848, 13, 13, 13, 1753, 28755, 29918, 10532, 29918, 1454, 29918, 3126, 29918, 430, 29898, 10532, 1125, 13, 1678, 736, 426, 13, 4706, 18803, 1853, 2396, 525, 7435, 742, 13, 4706, 525, 978, 2396, 2022, 29889, 8159, 29918, 978, 29892, 13, 4706, 525, 3470, 2638, 362, 2396, 426, 13, 9651, 18803, 1853, 2396, 525, 27356, 2133, 742, 13, 9651, 525, 978, 2396, 2022, 29889, 3470, 2638, 362, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 1753, 679, 29918, 2671, 29918, 5975, 29898, 689, 29918, 1272, 1125, 13, 1678, 9995, 18772, 278, 883, 4235, 1546, 2888, 322, 2294, 1213, 15945, 13, 1678, 4235, 353, 426, 29916, 29901, 883, 29918, 1272, 29961, 29916, 29962, 363, 921, 297, 883, 29918, 1272, 29889, 8149, 580, 565, 451, 921, 29889, 27382, 2541, 877, 6341, 29918, 1495, 29913, 13, 1678, 2888, 29918, 9621, 353, 426, 29916, 29901, 883, 29918, 1272, 29961, 29916, 29962, 363, 921, 297, 883, 29918, 1272, 29889, 8149, 580, 565, 921, 29889, 27382, 2541, 877, 6341, 29918, 1495, 29913, 13, 1678, 736, 4235, 29892, 2888, 29918, 9621, 13, 13, 13, 1753, 731, 29918, 6341, 29918, 9621, 29898, 5415, 29892, 2888, 29918, 9621, 29918, 1272, 1125, 13, 1678, 3620, 353, 6571, 13, 1678, 363, 2888, 29918, 2671, 29918, 978, 29892, 2888, 29918, 2671, 29918, 1767, 297, 2888, 29918, 9621, 29918, 1272, 29889, 7076, 7295, 13, 4706, 2888, 29918, 2671, 29918, 333, 353, 938, 29898, 6341, 29918, 2671, 29918, 978, 29961, 29955, 29901, 2314, 29871, 396, 15154, 278, 525, 6341, 29918, 29915, 760, 13, 4706, 2030, 29918, 1767, 353, 5446, 29889, 842, 29918, 6341, 29918, 2671, 29898, 6341, 29918, 2671, 29918, 333, 29892, 2888, 29918, 2671, 29918, 1767, 29897, 13, 4706, 565, 2030, 29918, 1767, 2804, 2888, 29918, 2671, 29918, 1767, 29901, 13, 9651, 3620, 29961, 6341, 29918, 2671, 29918, 978, 29962, 353, 313, 1025, 29918, 1767, 29892, 2888, 29918, 2671, 29918, 1767, 29897, 13, 1678, 736, 3620, 13, 13, 13, 1753, 1423, 29918, 17858, 6847, 29898, 3696, 29892, 1746, 29892, 2758, 29918, 11618, 29879, 29922, 8824, 1125, 13, 1678, 363, 5882, 29918, 29888, 2209, 309, 29892, 11239, 297, 1746, 29889, 1272, 29901, 13, 4706, 5882, 353, 5882, 29918, 3166, 29918, 25378, 29898, 558, 26706, 29918, 29888, 2209, 309, 1839, 25378, 7464, 13, 462, 462, 795, 2758, 29918, 23176, 29918, 7193, 29922, 5574, 29892, 13, 462, 462, 795, 2758, 29918, 13155, 29922, 5574, 29892, 13, 462, 462, 795, 2758, 29918, 7320, 29918, 307, 793, 29922, 5574, 29892, 13, 462, 462, 795, 2758, 29918, 3696, 29918, 307, 793, 29922, 5574, 29892, 13, 462, 462, 795, 2758, 29918, 331, 2234, 29922, 5574, 29892, 13, 462, 462, 795, 2758, 29918, 1727, 8306, 29918, 9514, 29922, 5574, 29892, 13, 462, 462, 795, 2758, 29918, 11618, 29879, 29922, 9536, 29918, 11618, 29879, 29892, 13, 462, 462, 795, 1741, 29918, 333, 29922, 3696, 29889, 333, 29897, 13, 4706, 565, 338, 8758, 29898, 558, 26706, 29892, 5641, 13724, 4782, 29897, 322, 731, 29898, 17858, 6847, 29897, 448, 426, 16310, 29918, 2477, 23524, 29918, 13171, 10403, 13507, 6177, 13, 9651, 10191, 353, 903, 877, 5690, 14379, 2609, 505, 10643, 11239, 29901, 6571, 2824, 4830, 29898, 558, 26706, 29889, 978, 29897, 13, 9651, 736, 10191, 13, 4706, 565, 338, 8758, 29898, 558, 26706, 29892, 2169, 8306, 2500, 29897, 322, 731, 29898, 17858, 6847, 29897, 448, 426, 16310, 29918, 2477, 23524, 29918, 13171, 10403, 13507, 6177, 13, 9651, 10191, 353, 903, 877, 4597, 2132, 1934, 2609, 505, 10643, 11239, 29901, 6571, 2824, 4830, 29898, 558, 26706, 29889, 978, 29897, 13, 9651, 736, 10191, 13, 4706, 565, 383, 3299, 29918, 2477, 23524, 29918, 13171, 10403, 13507, 297, 11239, 322, 7431, 29898, 17858, 6847, 29897, 2804, 29871, 29896, 29901, 13, 9651, 396, 746, 2989, 2130, 10751, 338, 731, 29892, 2313, 538, 1791, 310, 11239, 13, 9651, 11239, 7503, 29962, 353, 518, 29943, 3299, 29918, 2477, 23524, 29918, 13171, 10403, 13507, 29962, 13, 13, 13, 1753, 679, 29918, 3696, 29918, 3166, 29918, 2271, 29898, 2271, 1125, 13, 1678, 848, 353, 3142, 29918, 5510, 29898, 2271, 29897, 13, 1678, 565, 451, 599, 4197, 1272, 29889, 816, 2004, 29892, 848, 29889, 1212, 2029, 29892, 848, 29889, 2084, 29962, 1125, 13, 4706, 12020, 7865, 2392, 7373, 877, 13919, 1741, 3988, 8785, 13, 1678, 1741, 29918, 2084, 353, 337, 29889, 4352, 29898, 29878, 29915, 29914, 3696, 29914, 1194, 29881, 29974, 5033, 29914, 29989, 10931, 742, 848, 29889, 2084, 29897, 13, 1678, 565, 451, 1741, 29918, 2084, 29901, 13, 4706, 12020, 7865, 2392, 7373, 877, 13919, 1741, 3988, 8785, 13, 1678, 1741, 29918, 333, 353, 1741, 29918, 2084, 29889, 2972, 29898, 29896, 29897, 13, 1678, 1741, 353, 6864, 29889, 657, 29898, 3696, 29918, 333, 29892, 338, 29918, 311, 22742, 29922, 8824, 29897, 13, 1678, 565, 451, 1741, 29901, 13, 4706, 12020, 7865, 2392, 7373, 877, 4013, 1741, 947, 451, 1863, 8785, 13, 1678, 736, 1741, 13, 13, 13, 1990, 796, 666, 21575, 29924, 861, 262, 29901, 13, 1678, 9995, 29924, 861, 262, 363, 390, 29950, 29879, 393, 5706, 14319, 411, 2066, 1213, 15945, 13, 13, 1678, 822, 903, 328, 5143, 29918, 2084, 29918, 2848, 29898, 1311, 29892, 24611, 1125, 13, 4706, 9995, 21322, 264, 278, 2224, 3309, 304, 529, 29871, 29906, 29953, 29900, 22524, 29889, 13, 13, 4706, 3852, 29915, 4240, 29899, 262, 796, 5690, 5780, 1838, 29915, 29873, 763, 2066, 5069, 13, 4706, 3001, 2224, 13461, 29879, 3695, 29906, 29953, 29900, 22524, 29889, 2266, 591, 6728, 3598, 13, 4706, 3273, 264, 278, 3001, 2745, 372, 7087, 393, 7276, 29889, 13, 4706, 9995, 13, 4706, 1121, 353, 5159, 13, 4706, 3001, 29918, 2435, 353, 2533, 29898, 2435, 29898, 10199, 29897, 363, 2377, 297, 24611, 29897, 718, 7431, 29898, 10199, 1860, 29897, 448, 29871, 29896, 13, 4706, 19163, 353, 313, 7827, 29918, 2435, 448, 29871, 29906, 29945, 29945, 29897, 565, 3001, 29918, 2435, 1405, 29871, 29906, 29945, 29945, 1683, 29871, 29900, 13, 13, 4706, 363, 2377, 297, 18764, 287, 29898, 10199, 1860, 1125, 13, 9651, 285, 978, 29892, 1294, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 10199, 29897, 13, 9651, 5700, 353, 1375, 29898, 735, 985, 29892, 313, 2435, 29898, 29888, 978, 29897, 448, 29871, 29896, 29900, 29897, 565, 7431, 29898, 29888, 978, 29897, 1405, 29871, 29896, 29946, 1683, 29871, 29900, 29897, 13, 9651, 565, 5700, 29901, 13, 18884, 19163, 22361, 5700, 13, 18884, 285, 978, 353, 285, 978, 7503, 29899, 7582, 29962, 13, 9651, 1121, 29889, 4397, 29898, 29888, 978, 718, 1294, 29897, 13, 13, 4706, 736, 18764, 287, 29898, 2914, 29897, 13, 13, 1678, 822, 903, 1524, 29918, 7076, 29898, 1311, 29892, 2066, 29918, 7694, 1125, 13, 4706, 7709, 515, 2066, 29918, 7694, 13, 13, 1678, 822, 903, 17158, 29918, 7554, 29918, 1445, 29898, 1311, 29892, 2066, 29918, 7694, 29892, 1024, 29918, 13506, 2433, 15388, 742, 1024, 29918, 2146, 600, 861, 29922, 8516, 29892, 736, 29918, 1445, 29922, 8824, 1125, 13, 4706, 9995, 5631, 403, 263, 14319, 934, 6943, 278, 2066, 4502, 29889, 13, 13, 4706, 584, 3207, 2066, 29918, 7694, 29901, 530, 4256, 519, 313, 272, 385, 4256, 519, 6943, 29897, 1203, 393, 13, 462, 632, 3743, 278, 2066, 304, 367, 2715, 297, 278, 14319, 934, 29889, 13, 4706, 584, 3207, 1024, 29918, 13506, 29901, 450, 10944, 304, 278, 14319, 934, 1024, 13, 4706, 584, 3207, 1024, 29918, 2146, 600, 861, 29901, 450, 25557, 304, 278, 14319, 934, 1024, 13, 4706, 584, 3207, 736, 29918, 1445, 29901, 7106, 278, 5694, 934, 2012, 310, 263, 2933, 13, 4706, 9995, 13, 13, 4706, 5694, 29918, 1445, 353, 405, 2795, 5776, 1971, 653, 2283, 29898, 2146, 600, 861, 2433, 29889, 7554, 742, 4516, 29922, 2917, 29889, 4330, 3580, 29918, 9464, 29892, 5217, 29922, 8824, 29897, 13, 4706, 411, 796, 666, 2283, 29898, 7382, 29918, 1445, 29889, 978, 29892, 525, 29893, 742, 2758, 26264, 29953, 29946, 29922, 5574, 29897, 408, 14319, 29918, 13789, 29901, 13, 9651, 1583, 29889, 3880, 29918, 1777, 264, 1280, 353, 731, 580, 13, 9651, 363, 2944, 297, 1583, 3032, 1524, 29918, 7076, 29898, 5325, 29918, 7694, 1125, 13, 18884, 1024, 353, 1583, 3032, 19125, 29918, 12083, 29918, 23905, 29898, 667, 29897, 13, 18884, 1583, 29889, 3880, 29918, 1777, 264, 1280, 29889, 1202, 29898, 978, 29897, 13, 18884, 411, 2944, 29889, 657, 29918, 2997, 29918, 2084, 580, 408, 934, 2084, 29901, 13, 462, 1678, 14319, 29918, 13789, 29889, 3539, 29898, 1445, 2084, 29892, 1024, 29897, 13, 13, 4706, 14319, 29918, 1445, 29918, 978, 353, 285, 29915, 29912, 978, 29918, 13506, 7402, 29912, 978, 29918, 2146, 600, 861, 1836, 7554, 29915, 565, 1024, 29918, 2146, 600, 861, 1683, 285, 29915, 29912, 978, 29918, 13506, 1836, 7554, 29915, 13, 4706, 521, 1545, 29918, 398, 1278, 29898, 7382, 29918, 1445, 29889, 978, 29897, 13, 4706, 565, 736, 29918, 1445, 29901, 13, 9651, 736, 5694, 29918, 1445, 13, 4706, 736, 3638, 29918, 1445, 29898, 7554, 29918, 1445, 29918, 978, 29892, 5694, 29918, 1445, 29889, 978, 29892, 525, 6214, 29914, 7554, 742, 10583, 29922, 8824, 29897, 13, 13, 1678, 822, 903, 19125, 29918, 12083, 29918, 23905, 29898, 1311, 29892, 2944, 1125, 13, 4706, 934, 29918, 978, 353, 11592, 29918, 9507, 29898, 29888, 29915, 29912, 667, 29889, 333, 3227, 667, 29889, 9507, 29913, 742, 851, 29898, 667, 29889, 333, 876, 13, 4706, 736, 2897, 29889, 2084, 29889, 7122, 10456, 1311, 3032, 328, 5143, 29918, 2084, 29918, 2848, 4197, 1445, 29918, 978, 12622, 13, 13, 13, 29992, 6954, 29877, 675, 29918, 3827, 13, 1753, 679, 29918, 497, 29918, 1792, 29918, 307, 793, 29898, 3696, 29892, 1404, 1125, 13, 1678, 1741, 29918, 307, 793, 353, 731, 29898, 13, 4706, 6864, 16727, 29889, 1972, 29889, 2541, 29918, 3560, 29898, 3696, 29897, 13, 4706, 869, 4572, 29898, 2624, 16727, 29889, 28109, 29889, 1384, 29898, 2659, 29889, 333, 1275, 1404, 29889, 333, 876, 13, 1678, 1723, 13, 1678, 7663, 29918, 307, 793, 353, 731, 29898, 13, 4706, 17943, 16727, 29889, 1972, 13, 4706, 869, 7122, 29898, 3696, 29889, 7320, 29889, 14153, 29918, 1972, 29889, 1491, 1972, 3101, 13, 4706, 869, 4572, 29898, 10900, 16727, 29889, 28109, 29889, 1384, 29898, 2659, 29889, 333, 1275, 1404, 29889, 333, 876, 13, 1678, 1723, 13, 1678, 736, 1741, 29918, 307, 793, 29892, 7663, 29918, 307, 793, 13, 13, 13, 1753, 881, 29918, 4294, 29918, 29881, 4154, 29918, 27392, 29898, 3696, 1125, 13, 1678, 736, 313, 3696, 29889, 1853, 29918, 1275, 6864, 1542, 29889, 535, 1659, 322, 13, 9651, 451, 11896, 29918, 11027, 29889, 657, 29898, 3696, 29892, 525, 5467, 3726, 1495, 322, 13, 9651, 313, 13711, 300, 519, 9634, 29889, 1972, 29889, 2541, 29918, 3560, 29898, 3696, 467, 5349, 29918, 5727, 580, 470, 13, 632, 2866, 3224, 29889, 1972, 29889, 2541, 29918, 3560, 29898, 3696, 467, 5349, 29918, 5727, 22130, 13, 2 ]
newsXtract.py
selection-bias-www2018/NewsXtract
1
30133
<reponame>selection-bias-www2018/NewsXtract import os,json import requests BASE_URL = 'http://epfl.elasticsearch.spinn3r.com/content*/_search' BULK_SIZE = 100 SPINN3R_SECRET = os.environ['SPINN3R_SECRET'] HEADERS = { 'X-vendor': 'epfl', 'X-vendor-auth': SPINN3R_SECRET } query = { "size": BULK_SIZE, "query":{ "bool":{ "must":{ "match":{ "domain":"afp.com" } }, "filter":{ "range":{ "published":{ "gte":"18/02/2017", "lte":"20/02/2017", "format":"dd/MM/yyyy" } } } } } } resp = requests.post(BASE_URL, headers=HEADERS, json=query) resp_json = json.loads(resp.text) titles = set() for r in resp_json['hits']['hits']: t = r['_source']['title'] if t not in titles: print t titles.add(t)
[ 1, 529, 276, 1112, 420, 29958, 21731, 29899, 29890, 3173, 29899, 1636, 29906, 29900, 29896, 29947, 29914, 29328, 29990, 29873, 1461, 13, 5215, 2897, 29892, 3126, 13, 5215, 7274, 13, 13, 25416, 29918, 4219, 29871, 353, 525, 1124, 597, 1022, 1579, 29889, 295, 20291, 29889, 1028, 2559, 29941, 29878, 29889, 510, 29914, 3051, 3877, 29918, 4478, 29915, 13, 7838, 29931, 29968, 29918, 14226, 353, 29871, 29896, 29900, 29900, 13, 13, 5550, 1177, 29940, 29941, 29934, 29918, 1660, 22245, 29911, 353, 2897, 29889, 21813, 1839, 5550, 1177, 29940, 29941, 29934, 29918, 1660, 22245, 29911, 2033, 13, 13, 23252, 23598, 353, 426, 13, 29871, 525, 29990, 29899, 19167, 2396, 418, 525, 1022, 1579, 742, 13, 29871, 525, 29990, 29899, 19167, 29899, 5150, 2396, 10937, 1177, 29940, 29941, 29934, 29918, 1660, 22245, 29911, 13, 29913, 13, 13, 1972, 353, 426, 13, 259, 376, 2311, 1115, 350, 13309, 29968, 29918, 14226, 29892, 13, 259, 376, 1972, 1115, 29912, 13, 418, 376, 11227, 1115, 29912, 13, 308, 376, 21969, 1115, 29912, 13, 9651, 376, 4352, 1115, 29912, 13, 1669, 376, 7247, 4710, 2142, 29886, 29889, 510, 29908, 13, 9651, 500, 13, 308, 2981, 13, 308, 376, 4572, 1115, 29912, 13, 9651, 376, 3881, 1115, 29912, 13, 1669, 376, 5467, 3726, 1115, 29912, 13, 462, 29871, 376, 29887, 371, 4710, 29896, 29947, 29914, 29900, 29906, 29914, 29906, 29900, 29896, 29955, 613, 13, 462, 29871, 376, 29880, 371, 4710, 29906, 29900, 29914, 29900, 29906, 29914, 29906, 29900, 29896, 29955, 613, 13, 462, 29871, 376, 4830, 4710, 1289, 29914, 7428, 29914, 18855, 29908, 13, 1669, 500, 13, 9651, 500, 13, 308, 500, 13, 418, 500, 13, 259, 500, 13, 29913, 13, 13, 13, 13713, 418, 353, 7274, 29889, 2490, 29898, 25416, 29918, 4219, 29892, 9066, 29922, 23252, 23598, 29892, 4390, 29922, 1972, 29897, 13, 13713, 29918, 3126, 353, 4390, 29889, 18132, 29898, 13713, 29889, 726, 29897, 13, 13, 23545, 793, 353, 731, 580, 13, 13, 1454, 364, 297, 4613, 29918, 3126, 1839, 29882, 1169, 16215, 29882, 1169, 2033, 29901, 13, 29871, 260, 353, 364, 1839, 29918, 4993, 16215, 3257, 2033, 13, 29871, 565, 260, 451, 297, 17735, 29901, 13, 418, 1596, 260, 13, 29871, 17735, 29889, 1202, 29898, 29873, 29897, 13, 2 ]
ally/utils/option.py
rjfranssen/PyAlly
53
18650
<gh_stars>10-100 # MIT License # # Copyright (c) 2020 <NAME> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. import datetime import math from .utils import * ############################################################################ def option_format(symbol="", exp_date="1970-01-01", strike=0, direction=""): """Returns the OCC standardized option name. Args: symbol: the underlying symbol, case insensitive exp_date: date of expiration, in string-form. strike: strike price of the option direction: 'C' or 'call' or the like, for call, otherwise 'p' or 'Put' for put Returns: OCC string, like 'IBM201231C00301000' .. code-block:: python # Construct the option's OCC symbol >>> ibm_call = ally.utils.option_format( exp_date = '2020-12-31', symbol = 'IBM', # case insensitive direction = 'call', strike = 301 ) >>> ibm_call 'IBM201231C00301000' """ if not ( check(symbol) and check(exp_date) and check(str(strike)) and check(direction) ): return "" # direction into C or P direction = "C" if "C" in direction.upper() else "P" # Pad strike with zeros def format_strike(strike): x = str(math.floor(float(strike) * 1000)) return "0" * (8 - len(x)) + x # Assemble return ( str(symbol).upper() + datetime.datetime.strptime(exp_date, "%Y-%m-%d").strftime("%y%m%d") + direction + format_strike(strike) ) def option_strike(name): """Pull apart an OCC standardized option name and retreive the strike price, in integer form""" return int(name[-8:]) / 1000.0 def option_maturity(name): """Given OCC standardized option name, return the date of maturity""" return datetime.datetime.strptime(name[-15:-9], "%y%m%d").strftime("%Y-%m-%d") def option_callput(name): """Given OCC standardized option name, return whether its a call or a put""" return "call" if name.upper()[-9] == "C" else "put" def option_symbol(name): """Given OCC standardized option name, return option ticker""" return name[:-15]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 341, 1806, 19245, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29900, 529, 5813, 29958, 13, 29937, 13, 29937, 20894, 2333, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 29937, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 29937, 297, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 29937, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 29937, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 29937, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 29937, 13, 29937, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 599, 13, 29937, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 29937, 13, 29937, 6093, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 29937, 306, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 13, 29937, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 13, 29937, 26524, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 13, 29937, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 13, 29937, 19474, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 13, 29937, 7791, 7818, 12982, 1525, 29889, 13, 13, 5215, 12865, 13, 5215, 5844, 13, 13, 3166, 869, 13239, 1053, 334, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1753, 2984, 29918, 4830, 29898, 18098, 543, 613, 1518, 29918, 1256, 543, 29896, 29929, 29955, 29900, 29899, 29900, 29896, 29899, 29900, 29896, 613, 21283, 29922, 29900, 29892, 5305, 13776, 1125, 13, 1678, 9995, 11609, 29879, 278, 438, 4174, 3918, 1891, 2984, 1024, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 13, 9651, 5829, 29901, 278, 14407, 5829, 29892, 1206, 1663, 575, 3321, 13, 9651, 1518, 29918, 1256, 29901, 2635, 310, 1518, 12232, 29892, 297, 1347, 29899, 689, 29889, 13, 9651, 21283, 29901, 21283, 8666, 310, 278, 2984, 13, 9651, 5305, 29901, 525, 29907, 29915, 470, 525, 4804, 29915, 470, 278, 763, 29892, 363, 1246, 29892, 6467, 525, 29886, 29915, 470, 525, 22908, 29915, 363, 1925, 13, 13, 1678, 16969, 29901, 13, 13, 9651, 438, 4174, 1347, 29892, 763, 525, 8979, 29924, 29906, 29900, 29896, 29906, 29941, 29896, 29907, 29900, 29900, 29941, 29900, 29896, 29900, 29900, 29900, 29915, 13, 13, 13, 1678, 6317, 775, 29899, 1271, 1057, 3017, 13, 13, 9651, 396, 1281, 4984, 278, 2984, 29915, 29879, 438, 4174, 5829, 13, 9651, 8653, 474, 5838, 29918, 4804, 353, 394, 368, 29889, 13239, 29889, 3385, 29918, 4830, 29898, 13, 462, 1678, 1518, 29918, 1256, 353, 525, 29906, 29900, 29906, 29900, 29899, 29896, 29906, 29899, 29941, 29896, 742, 13, 462, 1678, 5829, 353, 525, 8979, 29924, 742, 396, 1206, 1663, 575, 3321, 13, 462, 1678, 5305, 353, 525, 4804, 742, 13, 462, 1678, 21283, 353, 29871, 29941, 29900, 29896, 13, 9651, 1723, 13, 13, 9651, 8653, 474, 5838, 29918, 4804, 13, 9651, 525, 8979, 29924, 29906, 29900, 29896, 29906, 29941, 29896, 29907, 29900, 29900, 29941, 29900, 29896, 29900, 29900, 29900, 29915, 13, 13, 13, 1678, 9995, 13, 1678, 565, 451, 313, 13, 4706, 1423, 29898, 18098, 29897, 322, 1423, 29898, 4548, 29918, 1256, 29897, 322, 1423, 29898, 710, 29898, 303, 20995, 876, 322, 1423, 29898, 20845, 29897, 13, 268, 1125, 13, 4706, 736, 5124, 13, 13, 1678, 396, 5305, 964, 315, 470, 349, 13, 1678, 5305, 353, 376, 29907, 29908, 565, 376, 29907, 29908, 297, 5305, 29889, 21064, 580, 1683, 376, 29925, 29908, 13, 13, 1678, 396, 18011, 21283, 411, 24786, 13, 1678, 822, 3402, 29918, 303, 20995, 29898, 303, 20995, 1125, 13, 4706, 921, 353, 851, 29898, 755, 29889, 14939, 29898, 7411, 29898, 303, 20995, 29897, 334, 29871, 29896, 29900, 29900, 29900, 876, 13, 4706, 736, 376, 29900, 29908, 334, 313, 29947, 448, 7431, 29898, 29916, 876, 718, 921, 13, 13, 1678, 396, 4007, 6967, 13, 1678, 736, 313, 13, 4706, 851, 29898, 18098, 467, 21064, 580, 13, 4706, 718, 12865, 29889, 12673, 29889, 710, 415, 603, 29898, 4548, 29918, 1256, 29892, 11860, 29979, 19222, 29885, 19222, 29881, 2564, 710, 615, 603, 11702, 29891, 29995, 29885, 29995, 29881, 1159, 13, 4706, 718, 5305, 13, 4706, 718, 3402, 29918, 303, 20995, 29898, 303, 20995, 29897, 13, 1678, 1723, 13, 13, 13, 1753, 2984, 29918, 303, 20995, 29898, 978, 1125, 13, 1678, 9995, 29925, 913, 12435, 385, 438, 4174, 3918, 1891, 2984, 1024, 322, 13, 1678, 22162, 573, 278, 21283, 8666, 29892, 297, 6043, 883, 15945, 29908, 13, 1678, 736, 938, 29898, 978, 14352, 29947, 29901, 2314, 847, 29871, 29896, 29900, 29900, 29900, 29889, 29900, 13, 13, 13, 1753, 2984, 29918, 29885, 1337, 537, 29898, 978, 1125, 13, 1678, 9995, 29954, 5428, 438, 4174, 3918, 1891, 2984, 1024, 29892, 13, 1678, 736, 278, 2635, 310, 286, 1337, 537, 15945, 29908, 13, 1678, 736, 12865, 29889, 12673, 29889, 710, 415, 603, 29898, 978, 14352, 29896, 29945, 13018, 29929, 1402, 11860, 29891, 29995, 29885, 29995, 29881, 2564, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 1159, 13, 13, 13, 1753, 2984, 29918, 4804, 649, 29898, 978, 1125, 13, 1678, 9995, 29954, 5428, 438, 4174, 3918, 1891, 2984, 1024, 29892, 13, 1678, 736, 3692, 967, 263, 1246, 470, 263, 1925, 15945, 29908, 13, 1678, 736, 376, 4804, 29908, 565, 1024, 29889, 21064, 580, 14352, 29929, 29962, 1275, 376, 29907, 29908, 1683, 376, 649, 29908, 13, 13, 13, 1753, 2984, 29918, 18098, 29898, 978, 1125, 13, 1678, 9995, 29954, 5428, 438, 4174, 3918, 1891, 2984, 1024, 29892, 736, 2984, 260, 6541, 15945, 29908, 13, 1678, 736, 1024, 7503, 29899, 29896, 29945, 29962, 13, 2 ]
falconapi_view.py
splunk-soar-connectors/falconapi
1
66587
# File: falconapi_view.py # # Copyright (c) 2016-2018 Splunk Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software distributed under # the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, # either express or implied. See the License for the specific language governing permissions # and limitations under the License. # # # of Phantom Cyber Corporation. # import json import phantom.app as phantom import phantom.utils as util def _get_hash_type(hash_value): if util.is_md5(hash_value): return (phantom.APP_SUCCESS, "md5") if util.is_sha1(hash_value): return (phantom.APP_SUCCESS, "sha1") if util.is_sha256(hash_value): return (phantom.APP_SUCCESS, "sha256") return (phantom.APP_ERROR, None) def _get_ioc_type(ioc): if util.is_ip(ioc): return (phantom.APP_SUCCESS, "ip") if util.is_hash(ioc): return _get_hash_type(ioc) if util.is_domain(ioc): return (phantom.APP_SUCCESS, "domain") return (phantom.APP_ERROR, "Failed to detect the IOC type") def _trim_results(data, key): if (key not in data): return if (len(data[key]) <= 100): return data[key] = data[key][:101] data[key][-1] = '...' def get_ctx_result_hunt(result): ctx_result = {} param = result.get_param() hunt_object = param.get('hash') if (not hunt_object): hunt_object = param.get('domain') param['ioc'] = hunt_object ret_val, param['ioc_type'] = _get_ioc_type(hunt_object) ctx_result['param'] = param message = result.get_message() ctx_result['message'] = message summary = result.get_summary() ctx_result['summary'] = summary data = result.get_data() if (not data): return ctx_result ctx_result['data'] = data return ctx_result def get_ctx_result_ps(result): ctx_result = {} param = result.get_param() if ('ioc' in param): ioc = param.get('ioc') ret_val, param['ioc_type'] = _get_ioc_type(ioc) ctx_result['param'] = param message = result.get_message() ctx_result['message'] = message summary = result.get_summary() ctx_result['summary'] = summary data = result.get_data() if (not data): return ctx_result ctx_result['data'] = data return ctx_result def get_ctx_result(result): ctx_result = {} param = result.get_param() if ('ioc' in param): ioc = param.get('ioc') ret_val, param['ioc_type'] = _get_ioc_type(ioc) ctx_result['param'] = param message = result.get_message() ctx_result['message'] = message summary = result.get_summary() ctx_result['summary'] = summary data = result.get_data() if (not data): return ctx_result data = data[0] if (not data): return ctx_result _trim_results(data, 'ip') _trim_results(data, 'domain') _trim_results(data, 'sha256') _trim_results(data, 'sha1') _trim_results(data, 'md5') ctx_result['data'] = data return ctx_result def create_alert_view(provides, all_app_runs, context): context['results'] = results = [] for summary, action_results in all_app_runs: for result in action_results: ctx_result = get_ctx_result(result) if (not ctx_result): continue results.append(ctx_result) # print context return 'create_alert_view.html' def get_alert_view(provides, all_app_runs, context): context['results'] = results = [] for summary, action_results in all_app_runs: for result in action_results: ctx_result = get_ctx_result(result) if (not ctx_result): continue results.append(ctx_result) # print context return 'get_alert_view.html' def update_alert_view(provides, all_app_runs, context): context['results'] = results = [] for summary, action_results in all_app_runs: for result in action_results: ctx_result = get_ctx_result(result) if (not ctx_result): continue results.append(ctx_result) # print context return 'update_alert_view.html' def set_status_view(provides, all_app_runs, context): context['results'] = results = [] for summary, action_results in all_app_runs: for result in action_results: ctx_result = get_ctx_result(result) if (not ctx_result): continue results.append(ctx_result) # print context return 'set_status_view.html' def list_alerts_view(provides, all_app_runs, context): context['results'] = results = [] for summary, action_results in all_app_runs: for result in action_results: ctx_result = get_ctx_result(result) if (not ctx_result): continue results.append(ctx_result) # print context return 'list_alerts_view.html' def process_list_view(provides, all_app_runs, context): context['results'] = results = [] for summary, action_results in all_app_runs: for result in action_results: ctx_result = get_ctx_result_ps(result) if (not ctx_result): continue results.append(ctx_result) # print context return 'process_list_view.html' def hunt_view(provides, all_app_runs, context): context['results'] = results = [] for summary, action_results in all_app_runs: for result in action_results: ctx_result = get_ctx_result_hunt(result) if (not ctx_result): continue results.append(ctx_result) # print context return 'hunt_view.html'
[ 1, 396, 3497, 29901, 11092, 535, 2754, 29918, 1493, 29889, 2272, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29953, 29899, 29906, 29900, 29896, 29947, 317, 572, 2960, 9266, 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, 13235, 1090, 13, 29937, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 13, 29937, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 13, 29937, 322, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 29937, 13, 29937, 310, 1963, 15762, 8045, 495, 15025, 29889, 13, 29937, 1053, 4390, 13, 5215, 1374, 15762, 29889, 932, 408, 1374, 15762, 13, 5215, 1374, 15762, 29889, 13239, 408, 3667, 13, 13, 13, 1753, 903, 657, 29918, 8568, 29918, 1853, 29898, 8568, 29918, 1767, 1125, 13, 13, 1678, 565, 3667, 29889, 275, 29918, 3487, 29945, 29898, 8568, 29918, 1767, 1125, 13, 4706, 736, 313, 27473, 29889, 20576, 29918, 14605, 26925, 29892, 376, 3487, 29945, 1159, 13, 13, 1678, 565, 3667, 29889, 275, 29918, 17051, 29896, 29898, 8568, 29918, 1767, 1125, 13, 4706, 736, 313, 27473, 29889, 20576, 29918, 14605, 26925, 29892, 376, 17051, 29896, 1159, 13, 13, 1678, 565, 3667, 29889, 275, 29918, 17051, 29906, 29945, 29953, 29898, 8568, 29918, 1767, 1125, 13, 4706, 736, 313, 27473, 29889, 20576, 29918, 14605, 26925, 29892, 376, 17051, 29906, 29945, 29953, 1159, 13, 13, 1678, 736, 313, 27473, 29889, 20576, 29918, 11432, 29892, 6213, 29897, 13, 13, 13, 1753, 903, 657, 29918, 29875, 542, 29918, 1853, 29898, 29875, 542, 1125, 13, 13, 1678, 565, 3667, 29889, 275, 29918, 666, 29898, 29875, 542, 1125, 13, 4706, 736, 313, 27473, 29889, 20576, 29918, 14605, 26925, 29892, 376, 666, 1159, 13, 13, 1678, 565, 3667, 29889, 275, 29918, 8568, 29898, 29875, 542, 1125, 13, 4706, 736, 903, 657, 29918, 8568, 29918, 1853, 29898, 29875, 542, 29897, 13, 13, 1678, 565, 3667, 29889, 275, 29918, 7247, 29898, 29875, 542, 1125, 13, 4706, 736, 313, 27473, 29889, 20576, 29918, 14605, 26925, 29892, 376, 7247, 1159, 13, 13, 1678, 736, 313, 27473, 29889, 20576, 29918, 11432, 29892, 376, 17776, 304, 6459, 278, 10663, 29907, 1134, 1159, 13, 13, 13, 1753, 903, 15450, 29918, 9902, 29898, 1272, 29892, 1820, 1125, 13, 13, 1678, 565, 313, 1989, 451, 297, 848, 1125, 13, 4706, 736, 13, 13, 1678, 565, 313, 2435, 29898, 1272, 29961, 1989, 2314, 5277, 29871, 29896, 29900, 29900, 1125, 13, 4706, 736, 13, 13, 1678, 848, 29961, 1989, 29962, 353, 848, 29961, 1989, 3816, 29901, 29896, 29900, 29896, 29962, 13, 13, 1678, 848, 29961, 1989, 3816, 29899, 29896, 29962, 353, 525, 856, 29915, 13, 13, 13, 1753, 679, 29918, 13073, 29918, 2914, 29918, 29882, 1657, 29898, 2914, 1125, 13, 13, 1678, 12893, 29918, 2914, 353, 6571, 13, 13, 1678, 1828, 353, 1121, 29889, 657, 29918, 3207, 580, 13, 13, 1678, 298, 1657, 29918, 3318, 353, 1828, 29889, 657, 877, 8568, 1495, 13, 1678, 565, 313, 1333, 298, 1657, 29918, 3318, 1125, 13, 4706, 298, 1657, 29918, 3318, 353, 1828, 29889, 657, 877, 7247, 1495, 13, 13, 1678, 1828, 1839, 29875, 542, 2033, 353, 298, 1657, 29918, 3318, 13, 1678, 3240, 29918, 791, 29892, 1828, 1839, 29875, 542, 29918, 1853, 2033, 353, 903, 657, 29918, 29875, 542, 29918, 1853, 29898, 29882, 1657, 29918, 3318, 29897, 13, 13, 1678, 12893, 29918, 2914, 1839, 3207, 2033, 353, 1828, 13, 13, 1678, 2643, 353, 1121, 29889, 657, 29918, 4906, 580, 13, 1678, 12893, 29918, 2914, 1839, 4906, 2033, 353, 2643, 13, 13, 1678, 15837, 353, 1121, 29889, 657, 29918, 7727, 580, 13, 1678, 12893, 29918, 2914, 1839, 7727, 2033, 353, 15837, 13, 13, 1678, 848, 353, 1121, 29889, 657, 29918, 1272, 580, 13, 13, 1678, 565, 313, 1333, 848, 1125, 13, 4706, 736, 12893, 29918, 2914, 13, 13, 1678, 12893, 29918, 2914, 1839, 1272, 2033, 353, 848, 13, 13, 1678, 736, 12893, 29918, 2914, 13, 13, 13, 1753, 679, 29918, 13073, 29918, 2914, 29918, 567, 29898, 2914, 1125, 13, 13, 1678, 12893, 29918, 2914, 353, 6571, 13, 13, 1678, 1828, 353, 1121, 29889, 657, 29918, 3207, 580, 13, 13, 1678, 565, 6702, 29875, 542, 29915, 297, 1828, 1125, 13, 4706, 474, 542, 353, 1828, 29889, 657, 877, 29875, 542, 1495, 13, 4706, 3240, 29918, 791, 29892, 1828, 1839, 29875, 542, 29918, 1853, 2033, 353, 903, 657, 29918, 29875, 542, 29918, 1853, 29898, 29875, 542, 29897, 13, 13, 1678, 12893, 29918, 2914, 1839, 3207, 2033, 353, 1828, 13, 13, 1678, 2643, 353, 1121, 29889, 657, 29918, 4906, 580, 13, 1678, 12893, 29918, 2914, 1839, 4906, 2033, 353, 2643, 13, 13, 1678, 15837, 353, 1121, 29889, 657, 29918, 7727, 580, 13, 1678, 12893, 29918, 2914, 1839, 7727, 2033, 353, 15837, 13, 13, 1678, 848, 353, 1121, 29889, 657, 29918, 1272, 580, 13, 13, 1678, 565, 313, 1333, 848, 1125, 13, 4706, 736, 12893, 29918, 2914, 13, 13, 1678, 12893, 29918, 2914, 1839, 1272, 2033, 353, 848, 13, 13, 1678, 736, 12893, 29918, 2914, 13, 13, 13, 1753, 679, 29918, 13073, 29918, 2914, 29898, 2914, 1125, 13, 13, 1678, 12893, 29918, 2914, 353, 6571, 13, 13, 1678, 1828, 353, 1121, 29889, 657, 29918, 3207, 580, 13, 13, 1678, 565, 6702, 29875, 542, 29915, 297, 1828, 1125, 13, 4706, 474, 542, 353, 1828, 29889, 657, 877, 29875, 542, 1495, 13, 4706, 3240, 29918, 791, 29892, 1828, 1839, 29875, 542, 29918, 1853, 2033, 353, 903, 657, 29918, 29875, 542, 29918, 1853, 29898, 29875, 542, 29897, 13, 13, 1678, 12893, 29918, 2914, 1839, 3207, 2033, 353, 1828, 13, 13, 1678, 2643, 353, 1121, 29889, 657, 29918, 4906, 580, 13, 1678, 12893, 29918, 2914, 1839, 4906, 2033, 353, 2643, 13, 13, 1678, 15837, 353, 1121, 29889, 657, 29918, 7727, 580, 13, 1678, 12893, 29918, 2914, 1839, 7727, 2033, 353, 15837, 13, 13, 1678, 848, 353, 1121, 29889, 657, 29918, 1272, 580, 13, 13, 1678, 565, 313, 1333, 848, 1125, 13, 4706, 736, 12893, 29918, 2914, 13, 13, 1678, 848, 353, 848, 29961, 29900, 29962, 13, 13, 1678, 565, 313, 1333, 848, 1125, 13, 4706, 736, 12893, 29918, 2914, 13, 13, 1678, 903, 15450, 29918, 9902, 29898, 1272, 29892, 525, 666, 1495, 13, 1678, 903, 15450, 29918, 9902, 29898, 1272, 29892, 525, 7247, 1495, 13, 1678, 903, 15450, 29918, 9902, 29898, 1272, 29892, 525, 17051, 29906, 29945, 29953, 1495, 13, 1678, 903, 15450, 29918, 9902, 29898, 1272, 29892, 525, 17051, 29896, 1495, 13, 1678, 903, 15450, 29918, 9902, 29898, 1272, 29892, 525, 3487, 29945, 1495, 13, 13, 1678, 12893, 29918, 2914, 1839, 1272, 2033, 353, 848, 13, 13, 1678, 736, 12893, 29918, 2914, 13, 13, 13, 1753, 1653, 29918, 12888, 29918, 1493, 29898, 16123, 2247, 29892, 599, 29918, 932, 29918, 3389, 29879, 29892, 3030, 1125, 13, 13, 1678, 3030, 1839, 9902, 2033, 353, 2582, 353, 5159, 13, 1678, 363, 15837, 29892, 3158, 29918, 9902, 297, 599, 29918, 932, 29918, 3389, 29879, 29901, 13, 4706, 363, 1121, 297, 3158, 29918, 9902, 29901, 13, 13, 9651, 12893, 29918, 2914, 353, 679, 29918, 13073, 29918, 2914, 29898, 2914, 29897, 13, 9651, 565, 313, 1333, 12893, 29918, 2914, 1125, 13, 18884, 6773, 13, 9651, 2582, 29889, 4397, 29898, 13073, 29918, 2914, 29897, 13, 1678, 396, 1596, 3030, 13, 1678, 736, 525, 3258, 29918, 12888, 29918, 1493, 29889, 1420, 29915, 13, 13, 13, 1753, 679, 29918, 12888, 29918, 1493, 29898, 16123, 2247, 29892, 599, 29918, 932, 29918, 3389, 29879, 29892, 3030, 1125, 13, 13, 1678, 3030, 1839, 9902, 2033, 353, 2582, 353, 5159, 13, 1678, 363, 15837, 29892, 3158, 29918, 9902, 297, 599, 29918, 932, 29918, 3389, 29879, 29901, 13, 4706, 363, 1121, 297, 3158, 29918, 9902, 29901, 13, 13, 9651, 12893, 29918, 2914, 353, 679, 29918, 13073, 29918, 2914, 29898, 2914, 29897, 13, 9651, 565, 313, 1333, 12893, 29918, 2914, 1125, 13, 18884, 6773, 13, 9651, 2582, 29889, 4397, 29898, 13073, 29918, 2914, 29897, 13, 13, 1678, 396, 1596, 3030, 13, 1678, 736, 525, 657, 29918, 12888, 29918, 1493, 29889, 1420, 29915, 13, 13, 13, 1753, 2767, 29918, 12888, 29918, 1493, 29898, 16123, 2247, 29892, 599, 29918, 932, 29918, 3389, 29879, 29892, 3030, 1125, 13, 13, 1678, 3030, 1839, 9902, 2033, 353, 2582, 353, 5159, 13, 1678, 363, 15837, 29892, 3158, 29918, 9902, 297, 599, 29918, 932, 29918, 3389, 29879, 29901, 13, 4706, 363, 1121, 297, 3158, 29918, 9902, 29901, 13, 13, 9651, 12893, 29918, 2914, 353, 679, 29918, 13073, 29918, 2914, 29898, 2914, 29897, 13, 9651, 565, 313, 1333, 12893, 29918, 2914, 1125, 13, 18884, 6773, 13, 9651, 2582, 29889, 4397, 29898, 13073, 29918, 2914, 29897, 13, 13, 1678, 396, 1596, 3030, 13, 1678, 736, 525, 5504, 29918, 12888, 29918, 1493, 29889, 1420, 29915, 13, 13, 13, 1753, 731, 29918, 4882, 29918, 1493, 29898, 16123, 2247, 29892, 599, 29918, 932, 29918, 3389, 29879, 29892, 3030, 1125, 13, 13, 1678, 3030, 1839, 9902, 2033, 353, 2582, 353, 5159, 13, 1678, 363, 15837, 29892, 3158, 29918, 9902, 297, 599, 29918, 932, 29918, 3389, 29879, 29901, 13, 4706, 363, 1121, 297, 3158, 29918, 9902, 29901, 13, 13, 9651, 12893, 29918, 2914, 353, 679, 29918, 13073, 29918, 2914, 29898, 2914, 29897, 13, 9651, 565, 313, 1333, 12893, 29918, 2914, 1125, 13, 18884, 6773, 13, 9651, 2582, 29889, 4397, 29898, 13073, 29918, 2914, 29897, 13, 13, 1678, 396, 1596, 3030, 13, 1678, 736, 525, 842, 29918, 4882, 29918, 1493, 29889, 1420, 29915, 13, 13, 13, 1753, 1051, 29918, 12888, 29879, 29918, 1493, 29898, 16123, 2247, 29892, 599, 29918, 932, 29918, 3389, 29879, 29892, 3030, 1125, 13, 13, 1678, 3030, 1839, 9902, 2033, 353, 2582, 353, 5159, 13, 1678, 363, 15837, 29892, 3158, 29918, 9902, 297, 599, 29918, 932, 29918, 3389, 29879, 29901, 13, 4706, 363, 1121, 297, 3158, 29918, 9902, 29901, 13, 13, 9651, 12893, 29918, 2914, 353, 679, 29918, 13073, 29918, 2914, 29898, 2914, 29897, 13, 9651, 565, 313, 1333, 12893, 29918, 2914, 1125, 13, 18884, 6773, 13, 9651, 2582, 29889, 4397, 29898, 13073, 29918, 2914, 29897, 13, 13, 1678, 396, 1596, 3030, 13, 1678, 736, 525, 1761, 29918, 12888, 29879, 29918, 1493, 29889, 1420, 29915, 13, 13, 13, 1753, 1889, 29918, 1761, 29918, 1493, 29898, 16123, 2247, 29892, 599, 29918, 932, 29918, 3389, 29879, 29892, 3030, 1125, 13, 13, 1678, 3030, 1839, 9902, 2033, 353, 2582, 353, 5159, 13, 1678, 363, 15837, 29892, 3158, 29918, 9902, 297, 599, 29918, 932, 29918, 3389, 29879, 29901, 13, 4706, 363, 1121, 297, 3158, 29918, 9902, 29901, 13, 13, 9651, 12893, 29918, 2914, 353, 679, 29918, 13073, 29918, 2914, 29918, 567, 29898, 2914, 29897, 13, 9651, 565, 313, 1333, 12893, 29918, 2914, 1125, 13, 18884, 6773, 13, 9651, 2582, 29889, 4397, 29898, 13073, 29918, 2914, 29897, 13, 13, 1678, 396, 1596, 3030, 13, 1678, 736, 525, 5014, 29918, 1761, 29918, 1493, 29889, 1420, 29915, 13, 13, 13, 1753, 298, 1657, 29918, 1493, 29898, 16123, 2247, 29892, 599, 29918, 932, 29918, 3389, 29879, 29892, 3030, 1125, 13, 13, 1678, 3030, 1839, 9902, 2033, 353, 2582, 353, 5159, 13, 1678, 363, 15837, 29892, 3158, 29918, 9902, 297, 599, 29918, 932, 29918, 3389, 29879, 29901, 13, 4706, 363, 1121, 297, 3158, 29918, 9902, 29901, 13, 13, 9651, 12893, 29918, 2914, 353, 679, 29918, 13073, 29918, 2914, 29918, 29882, 1657, 29898, 2914, 29897, 13, 9651, 565, 313, 1333, 12893, 29918, 2914, 1125, 13, 18884, 6773, 13, 9651, 2582, 29889, 4397, 29898, 13073, 29918, 2914, 29897, 13, 13, 1678, 396, 1596, 3030, 13, 1678, 736, 525, 29882, 1657, 29918, 1493, 29889, 1420, 29915, 13, 2 ]
ginga/util/mosaic.py
astrofrog/ginga
0
193211
#! /usr/bin/env python # # mosaic.py -- Example of quick and dirty mosaicing of FITS images # # <NAME> (<EMAIL>) # # Copyright (c) <NAME>. All rights reserved. # This is open-source software licensed under a BSD license. # Please see the file LICENSE.txt for details. # import sys, os import logging from ginga import AstroImage STD_FORMAT = '%(asctime)s | %(levelname)1.1s | %(filename)s:%(lineno)d (%(funcName)s) | %(message)s' def mosaic(paths, logger, outfile=None): logger.info("Mosaicing images...") image = AstroImage.AstroImage(logger=logger) mosaic = image.mosaic(paths) if outfile: try: os.remove(outfile) except: pass logger.info("Writing mosaic file to %s ..." % (outfile)) mosaic.write_fits(outfile) def main(options, args): logger = logging.getLogger("mosaic") logger.setLevel(options.loglevel) fmt = logging.Formatter(STD_FORMAT) if options.logfile: fileHdlr = logging.handlers.RotatingFileHandler(options.logfile) fileHdlr.setLevel(options.loglevel) fileHdlr.setFormatter(fmt) logger.addHandler(fileHdlr) if options.logstderr: stderrHdlr = logging.StreamHandler() stderrHdlr.setLevel(options.loglevel) stderrHdlr.setFormatter(fmt) logger.addHandler(stderrHdlr) if len(args) > 0: mosaic(args, logger, outfile=options.outfile) if __name__ == "__main__": # Parse command line options with nifty optparse module from optparse import OptionParser usage = "usage: %prog [options] cmd [args]" optprs = OptionParser(usage=usage, version=('%%prog')) optprs.add_option("--debug", dest="debug", default=False, action="store_true", help="Enter the pdb debugger on main()") optprs.add_option("--log", dest="logfile", metavar="FILE", help="Write logging output to FILE") optprs.add_option("--loglevel", dest="loglevel", metavar="LEVEL", type='int', default=logging.INFO, help="Set logging level to LEVEL") optprs.add_option("-o", "--outfile", dest="outfile", metavar="FILE", help="Write mosaic output to FILE") optprs.add_option("--stderr", dest="logstderr", default=False, action="store_true", help="Copy logging also to stderr") optprs.add_option("--profile", dest="profile", action="store_true", default=False, help="Run the profiler on main()") (options, args) = optprs.parse_args(sys.argv[1:]) # Are we debugging this? if options.debug: import pdb pdb.run('main(options, args)') # Are we profiling this? elif options.profile: import profile print "%s profile:" % sys.argv[0] profile.run('main(options, args)') else: main(options, args) # END
[ 1, 396, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 13, 29937, 286, 3628, 293, 29889, 2272, 1192, 8741, 310, 4996, 322, 26616, 286, 3628, 18499, 310, 383, 1806, 29903, 4558, 13, 29937, 13, 29937, 529, 5813, 29958, 313, 29966, 26862, 6227, 12948, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 529, 5813, 15513, 29871, 2178, 10462, 21676, 29889, 13, 29937, 910, 338, 1722, 29899, 4993, 7047, 7794, 21144, 1090, 263, 350, 7230, 19405, 29889, 13, 29937, 3529, 1074, 278, 934, 365, 2965, 1430, 1660, 29889, 3945, 363, 4902, 29889, 13, 29937, 13, 5215, 10876, 29892, 2897, 13, 5215, 12183, 13, 3166, 12773, 29874, 1053, 10186, 307, 2940, 13, 13, 1254, 29928, 29918, 19094, 1299, 353, 14210, 29898, 294, 312, 603, 29897, 29879, 891, 1273, 29898, 5563, 978, 29897, 29896, 29889, 29896, 29879, 891, 1273, 29898, 9507, 29897, 29879, 16664, 29898, 1915, 8154, 29897, 29881, 313, 29995, 29898, 9891, 1170, 29897, 29879, 29897, 891, 1273, 29898, 4906, 29897, 29879, 29915, 13, 13, 13, 1753, 286, 3628, 293, 29898, 24772, 29892, 17927, 29892, 714, 1445, 29922, 8516, 1125, 13, 1678, 17927, 29889, 3888, 703, 29924, 3628, 18499, 4558, 856, 1159, 13, 1678, 1967, 353, 10186, 307, 2940, 29889, 29909, 303, 307, 2940, 29898, 21707, 29922, 21707, 29897, 13, 1678, 286, 3628, 293, 353, 1967, 29889, 29885, 3628, 293, 29898, 24772, 29897, 13, 13, 1678, 565, 714, 1445, 29901, 13, 4706, 1018, 29901, 13, 9651, 2897, 29889, 5992, 29898, 449, 1445, 29897, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 4706, 17927, 29889, 3888, 703, 29956, 768, 292, 286, 3628, 293, 934, 304, 1273, 29879, 2023, 29908, 1273, 313, 449, 1445, 876, 13, 4706, 286, 3628, 293, 29889, 3539, 29918, 29888, 1169, 29898, 449, 1445, 29897, 13, 308, 13, 308, 13, 1753, 1667, 29898, 6768, 29892, 6389, 1125, 13, 13, 1678, 17927, 353, 12183, 29889, 657, 16363, 703, 29885, 3628, 293, 1159, 13, 1678, 17927, 29889, 842, 10108, 29898, 6768, 29889, 1188, 5563, 29897, 13, 1678, 19200, 353, 12183, 29889, 18522, 29898, 1254, 29928, 29918, 19094, 1299, 29897, 13, 1678, 565, 3987, 29889, 1188, 1445, 29901, 13, 4706, 934, 29950, 11671, 29878, 29871, 353, 12183, 29889, 3179, 9306, 29889, 21281, 1218, 2283, 4598, 29898, 6768, 29889, 1188, 1445, 29897, 13, 4706, 934, 29950, 11671, 29878, 29889, 842, 10108, 29898, 6768, 29889, 1188, 5563, 29897, 13, 4706, 934, 29950, 11671, 29878, 29889, 842, 18522, 29898, 23479, 29897, 13, 4706, 17927, 29889, 1202, 4598, 29898, 1445, 29950, 11671, 29878, 29897, 13, 13, 1678, 565, 3987, 29889, 1188, 303, 20405, 29901, 13, 4706, 380, 20405, 29950, 11671, 29878, 353, 12183, 29889, 3835, 4598, 580, 13, 4706, 380, 20405, 29950, 11671, 29878, 29889, 842, 10108, 29898, 6768, 29889, 1188, 5563, 29897, 13, 4706, 380, 20405, 29950, 11671, 29878, 29889, 842, 18522, 29898, 23479, 29897, 13, 4706, 17927, 29889, 1202, 4598, 29898, 303, 20405, 29950, 11671, 29878, 29897, 13, 13, 1678, 565, 7431, 29898, 5085, 29897, 1405, 29871, 29900, 29901, 13, 4706, 286, 3628, 293, 29898, 5085, 29892, 17927, 29892, 714, 1445, 29922, 6768, 29889, 449, 1445, 29897, 13, 308, 13, 268, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 13, 1678, 396, 20969, 1899, 1196, 3987, 411, 302, 361, 1017, 3523, 5510, 3883, 13, 1678, 515, 3523, 5510, 1053, 10831, 11726, 13, 13, 1678, 8744, 353, 376, 21125, 29901, 1273, 29097, 518, 6768, 29962, 9920, 518, 5085, 18017, 13, 1678, 3523, 558, 29879, 353, 10831, 11726, 29898, 21125, 29922, 21125, 29892, 1873, 29922, 877, 7686, 29097, 8785, 13, 268, 13, 1678, 3523, 558, 29879, 29889, 1202, 29918, 3385, 703, 489, 8382, 613, 2731, 543, 8382, 613, 2322, 29922, 8824, 29892, 3158, 543, 8899, 29918, 3009, 613, 13, 462, 418, 1371, 543, 10399, 278, 282, 2585, 18297, 373, 1667, 580, 1159, 13, 1678, 3523, 558, 29879, 29889, 1202, 29918, 3385, 703, 489, 1188, 613, 2731, 543, 1188, 1445, 613, 1539, 485, 279, 543, 7724, 613, 13, 462, 418, 1371, 543, 6113, 12183, 1962, 304, 24080, 1159, 13, 1678, 3523, 558, 29879, 29889, 1202, 29918, 3385, 703, 489, 1188, 5563, 613, 2731, 543, 1188, 5563, 613, 1539, 485, 279, 543, 1307, 29963, 6670, 613, 13, 462, 418, 1134, 2433, 524, 742, 2322, 29922, 21027, 29889, 11690, 29892, 13, 462, 418, 1371, 543, 2697, 12183, 3233, 304, 11060, 29963, 6670, 1159, 13, 1678, 3523, 558, 29879, 29889, 1202, 29918, 3385, 703, 29899, 29877, 613, 376, 489, 449, 1445, 613, 2731, 543, 449, 1445, 613, 1539, 485, 279, 543, 7724, 613, 13, 462, 418, 1371, 543, 6113, 286, 3628, 293, 1962, 304, 24080, 1159, 13, 1678, 3523, 558, 29879, 29889, 1202, 29918, 3385, 703, 489, 303, 20405, 613, 2731, 543, 1188, 303, 20405, 613, 2322, 29922, 8824, 29892, 13, 462, 418, 3158, 543, 8899, 29918, 3009, 613, 13, 462, 418, 1371, 543, 11882, 12183, 884, 304, 380, 20405, 1159, 13, 1678, 3523, 558, 29879, 29889, 1202, 29918, 3385, 703, 489, 10185, 613, 2731, 543, 10185, 613, 3158, 543, 8899, 29918, 3009, 613, 13, 462, 418, 2322, 29922, 8824, 29892, 13, 462, 418, 1371, 543, 6558, 278, 20077, 261, 373, 1667, 580, 1159, 13, 13, 1678, 313, 6768, 29892, 6389, 29897, 353, 3523, 558, 29879, 29889, 5510, 29918, 5085, 29898, 9675, 29889, 19218, 29961, 29896, 29901, 2314, 13, 13, 1678, 396, 4683, 591, 13490, 445, 29973, 13, 1678, 565, 3987, 29889, 8382, 29901, 13, 4706, 1053, 282, 2585, 13, 13, 4706, 282, 2585, 29889, 3389, 877, 3396, 29898, 6768, 29892, 6389, 29897, 1495, 13, 13, 1678, 396, 4683, 591, 20077, 292, 445, 29973, 13, 1678, 25342, 3987, 29889, 10185, 29901, 13, 4706, 1053, 8722, 13, 13, 4706, 1596, 11860, 29879, 8722, 6160, 1273, 10876, 29889, 19218, 29961, 29900, 29962, 13, 4706, 8722, 29889, 3389, 877, 3396, 29898, 6768, 29892, 6389, 29897, 1495, 13, 13, 13, 1678, 1683, 29901, 13, 4706, 1667, 29898, 6768, 29892, 6389, 29897, 13, 13, 29937, 11056, 13, 2 ]
atest/testdata/standard_libraries/builtin/FailUntilSucceeds.py
rdagum/robotframework
7,073
193706
import time class FailUntilSucceeds: ROBOT_LIBRARY_SCOPE = 'TESTCASE' def __init__(self, times_to_fail=0): self.times_to_fail = int(times_to_fail) def set_times_to_fail(self, times_to_fail): self.__init__(times_to_fail) def fail_until_retried_often_enough(self, message="Hello", sleep=0): self.times_to_fail -= 1 time.sleep(sleep) if self.times_to_fail >= 0: raise Exception('Still %d times to fail!' % self.times_to_fail) return message
[ 1, 1053, 931, 13, 13, 13, 1990, 29098, 29965, 20233, 29903, 1682, 3947, 29879, 29901, 13, 1678, 390, 14824, 2891, 29918, 5265, 15176, 19926, 29918, 29903, 3217, 4162, 353, 525, 18267, 23487, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3064, 29918, 517, 29918, 14057, 29922, 29900, 1125, 13, 4706, 1583, 29889, 3706, 29918, 517, 29918, 14057, 353, 938, 29898, 3706, 29918, 517, 29918, 14057, 29897, 13, 13, 1678, 822, 731, 29918, 3706, 29918, 517, 29918, 14057, 29898, 1311, 29892, 3064, 29918, 517, 29918, 14057, 1125, 13, 4706, 1583, 17255, 2344, 12035, 3706, 29918, 517, 29918, 14057, 29897, 13, 13, 1678, 822, 4418, 29918, 29305, 29918, 2267, 1255, 29918, 29877, 15535, 29918, 264, 820, 29898, 1311, 29892, 2643, 543, 10994, 613, 8709, 29922, 29900, 1125, 13, 4706, 1583, 29889, 3706, 29918, 517, 29918, 14057, 22361, 29871, 29896, 13, 4706, 931, 29889, 17059, 29898, 17059, 29897, 13, 4706, 565, 1583, 29889, 3706, 29918, 517, 29918, 14057, 6736, 29871, 29900, 29901, 13, 9651, 12020, 8960, 877, 855, 453, 1273, 29881, 3064, 304, 4418, 20714, 1273, 1583, 29889, 3706, 29918, 517, 29918, 14057, 29897, 13, 4706, 736, 2643, 13, 2 ]
alfred_client/tests/pushdata_test.py
coyote240/alfred-client
0
118914
<gh_stars>0 import unittest from alfred_client.message import PushData from alfred_client.packet.struct import alfred_packet expected_mac = '5e:5c:ce:ca:93:58' expected_message = 'raspberrypi\n' expected_length = len(expected_message) expected_bytes = b'\x00\x00\x00\x1a\x00\x00\x00\x00^\\\xce\xca\x93Xc\x00\x00\x0craspberrypi\n' # noqa class TestCreatePushData(unittest.TestCase): def setUp(self): self.message = PushData() self.message.source_mac_address = expected_mac def test_message_type(self): self.assertEqual(self.message.type, 0) def test_source_mac_address(self): self.assertEqual(self.message.source_mac_address, expected_mac) def test_add_data_block(self): self.message.add_data_block(99, 0, expected_message) self.assertIn('length', self.message._data[0]) def test_calculates_correct_data_value_length(self): self.message.add_data_block(99, 0, expected_message) self.assertEqual(self.message._data[0]['length'], expected_length) def test_calculates_correct_message_length(self): self.message.add_data_block(99, 0, expected_message) self.assertEqual(self.message.length, 26) def test_bytes(self): self.message.add_data_block(99, 0, expected_message) self.assertEqual(bytes(self.message), expected_bytes) class TestParsePushData(unittest.TestCase): def setUp(self): self.container = alfred_packet.parse(expected_bytes) self.message = PushData(self.container) def test_message_type(self): self.assertEqual(self.message.type, 0) def test_message_version(self): self.assertEqual(self.message.version, 0) def test_message_length(self): self.assertEqual(self.message.length, 26) def test_transaction_id(self): self.assertEqual(self.message.transaction_id, 0) def test_sequence_number(self): self.assertEqual(self.message.sequence_number, 0) @unittest.skip('TODO: move _data to packet_body.alfred_data') def test_alfred_data_length(self): self.assertEqual(len(self.message.alfred_data), 1)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 443, 27958, 13, 3166, 394, 18447, 29918, 4645, 29889, 4906, 1053, 349, 1878, 1469, 13, 3166, 394, 18447, 29918, 4645, 29889, 4058, 300, 29889, 4984, 1053, 394, 18447, 29918, 4058, 300, 13, 13, 13, 9684, 29918, 8628, 353, 525, 29945, 29872, 29901, 29945, 29883, 29901, 346, 29901, 1113, 29901, 29929, 29941, 29901, 29945, 29947, 29915, 13, 9684, 29918, 4906, 353, 525, 3417, 29886, 16344, 1631, 29905, 29876, 29915, 13, 9684, 29918, 2848, 353, 7431, 29898, 9684, 29918, 4906, 29897, 13, 9684, 29918, 13193, 353, 289, 12764, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29896, 29874, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29985, 1966, 29905, 29916, 346, 29905, 29916, 1113, 29905, 29916, 29929, 29941, 29990, 29883, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29905, 29916, 29900, 29883, 3417, 29886, 16344, 1631, 29905, 29876, 29915, 396, 694, 25621, 13, 13, 13, 1990, 4321, 4391, 27031, 1469, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4906, 353, 349, 1878, 1469, 580, 13, 4706, 1583, 29889, 4906, 29889, 4993, 29918, 8628, 29918, 7328, 353, 3806, 29918, 8628, 13, 13, 1678, 822, 1243, 29918, 4906, 29918, 1853, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 1853, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 4993, 29918, 8628, 29918, 7328, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 4993, 29918, 8628, 29918, 7328, 29892, 3806, 29918, 8628, 29897, 13, 13, 1678, 822, 1243, 29918, 1202, 29918, 1272, 29918, 1271, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4906, 29889, 1202, 29918, 1272, 29918, 1271, 29898, 29929, 29929, 29892, 29871, 29900, 29892, 3806, 29918, 4906, 29897, 13, 4706, 1583, 29889, 9294, 797, 877, 2848, 742, 1583, 29889, 4906, 3032, 1272, 29961, 29900, 2314, 13, 13, 1678, 822, 1243, 29918, 15807, 1078, 29918, 15728, 29918, 1272, 29918, 1767, 29918, 2848, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4906, 29889, 1202, 29918, 1272, 29918, 1271, 29898, 29929, 29929, 29892, 29871, 29900, 29892, 3806, 29918, 4906, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 3032, 1272, 29961, 29900, 22322, 2848, 7464, 3806, 29918, 2848, 29897, 13, 13, 1678, 822, 1243, 29918, 15807, 1078, 29918, 15728, 29918, 4906, 29918, 2848, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4906, 29889, 1202, 29918, 1272, 29918, 1271, 29898, 29929, 29929, 29892, 29871, 29900, 29892, 3806, 29918, 4906, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 2848, 29892, 29871, 29906, 29953, 29897, 13, 13, 1678, 822, 1243, 29918, 13193, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4906, 29889, 1202, 29918, 1272, 29918, 1271, 29898, 29929, 29929, 29892, 29871, 29900, 29892, 3806, 29918, 4906, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13193, 29898, 1311, 29889, 4906, 511, 3806, 29918, 13193, 29897, 13, 13, 13, 1990, 4321, 12914, 27031, 1469, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 7611, 353, 394, 18447, 29918, 4058, 300, 29889, 5510, 29898, 9684, 29918, 13193, 29897, 13, 4706, 1583, 29889, 4906, 353, 349, 1878, 1469, 29898, 1311, 29889, 7611, 29897, 13, 13, 1678, 822, 1243, 29918, 4906, 29918, 1853, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 1853, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 4906, 29918, 3259, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 3259, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 4906, 29918, 2848, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 2848, 29892, 29871, 29906, 29953, 29897, 13, 13, 1678, 822, 1243, 29918, 20736, 29918, 333, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 20736, 29918, 333, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 16506, 29918, 4537, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 4906, 29889, 16506, 29918, 4537, 29892, 29871, 29900, 29897, 13, 13, 1678, 732, 348, 27958, 29889, 11014, 877, 4986, 3970, 29901, 4337, 903, 1272, 304, 18203, 29918, 2587, 29889, 3131, 1127, 29918, 1272, 1495, 13, 1678, 822, 1243, 29918, 3131, 1127, 29918, 1272, 29918, 2848, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 1311, 29889, 4906, 29889, 3131, 1127, 29918, 1272, 511, 29871, 29896, 29897, 13, 2 ]
tools/mkblocks.py
Commodore-Bench/u5remastered
14
9918
<filename>tools/mkblocks.py #!/usr/bin/env python3 # ---------------------------------------------------------------------------- # Copyright 2019 Drunella # # 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 os import sys import glob import subprocess import argparse import hashlib import traceback import pprint def readblockmap_info(filename): directory = dict() with open(filename) as f: result = [line.split() for line in f] for l in result: directory[l[0]] = l[1:] return directory def readdisks_info(filename): disks = [] with open(filename) as f: result = [line.split() for line in f] #pprint.pprint(result) return result def readdisks_getdiskinfo(disks, diskname): for d in disks: if d[0] == diskname: return d return [] def map_initialize(): global bank_data, map_data map_data = bytearray([0xff] * 0x800) def crtmap_appendentry(filename, block, name, address): with open(filename, "at") as f: content = "{0} f {1} addr 0x{2:04x}\n".format(block, name, address) return f.write(content) def load_file(filename): with open(filename, "rb") as f: return f.read() def write_prg(dirname, lowhigh, data): if lowhigh == 0: # low a = bytearray(2) a[0] = 0 a[1] = 0x80 elif lowhigh == 1: # high a = bytearray(2) a[0] = 0 a[1] = 0xA0 else: raise Exception("lowhigh can only be 0 or 1") with open(dirname, "wb") as f: #f.write(a) f.write(data) def blockmap_appendentry(diskid, line, bank, highaddress): global map_data base = diskid * 256 + line * 2 map_data[base] = bank map_data[base+1] = highaddress #print("blockmap_appendentry: " + str(base) + ": " + str(bank) + " " + str(highaddress)) def calculate_address(lowhigh): if lowhigh == 0: # low a = 0x80 elif lowhigh == 1: # high a = 0xA0 else: raise Exception("lowhigh can only be 0 or 1") return a def main(argv): global bank_data, map_data p = argparse.ArgumentParser() p.add_argument("-v", dest="verbose", action="store_true", help="Verbose output.") p.add_argument("-o", dest="disks", action="store", required=True, help="disk configuration file.") p.add_argument("-f", dest="files", action="store", required=True, help="files directory.") p.add_argument("-m", dest="crtfile", action="store", required=True, help="crt.map file") p.add_argument("-d", dest="destination", action="store", required=True, help="destination directory.") p.add_argument("-b", dest="blockmap", action="store", required=True, help="blockmap file.") #p.add_argument("-f", dest="fileoutput", action="store", required=True, help="output data content file.") args = p.parse_args() #temp_path = os.path.join(args.build, "temp") #os.makedirs(temp_path, exist_ok=True) files_path = args.files #os.path.join(args.build, "files") os.makedirs(files_path, exist_ok=True) destination_path = args.destination #os.path.join(args.build, "obj") os.makedirs(destination_path, exist_ok=True) disks = readdisks_info(args.disks) blockmap = readblockmap_info(args.blockmap) map_initialize() if os.path.exists(args.crtfile): os.remove(args.crtfile) # add blocks file for d in ("britannia", "towne", "dwelling", "castle", "keep", "dungeon", "underworld"): diskinfo = readdisks_getdiskinfo(disks, d) starttrack = int(diskinfo[2], 0) height = int(diskinfo[4], 0) - int(diskinfo[2], 0) + 1 diskid = int(diskinfo[1], 0) - 0x41 startbank = int(blockmap[d][0], 0) lowhigh = int(blockmap[d][1], 0) block_data = load_file(os.path.join(files_path, d + ".data")) # build map and blocks map_data[diskid*256+255] = starttrack for b in range(0, height, 2): # double line or single line #factor = 2 #if b+1 >= height: # factor = 1 # make data bank_data = bytearray([0xff] * 0x2000) baseaddress = calculate_address(lowhigh) if b+1 >= height: # one line s = b * 256*16 l = 0x1000 bank_data[0:l] = block_data[s:s+l] blockmap_appendentry(diskid, b, startbank, baseaddress) else: # two lines s = b * 256*16 l = 0x2000 bank_data[0:l] = block_data[s:s+l] blockmap_appendentry(diskid, b, startbank, baseaddress) blockmap_appendentry(diskid, b+1, startbank, baseaddress+0x10) # write data and map filename = "{0}_{1:02d}.aprg".format(d, b) write_prg(os.path.join(destination_path, filename), lowhigh, bank_data) crtmap_appendentry(args.crtfile, startbank, filename, baseaddress * 0x100) # increase values startbank += 1 # write block map blockmap_bank = int(blockmap["blockmap"][0], 0) blockmap_lowhigh = int(blockmap["blockmap"][1], 0) blockmap_address = calculate_address(blockmap_lowhigh) * 256 #blockmap_appendentry(0, b, startbank, baseaddress) blockmapname = os.path.join(destination_path, "blockmap.aprg") write_prg(blockmapname, blockmap_lowhigh, map_data) crtmap_appendentry(args.crtfile, blockmap_bank, "blockmap.aprg", blockmap_address) return 0 if __name__ == '__main__': try: retval = main(sys.argv) sys.exit(retval) except Exception as e: print(e) traceback.print_exc() sys.exit(1)
[ 1, 529, 9507, 29958, 8504, 29914, 11256, 1271, 29879, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 360, 3389, 3547, 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, 29937, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 13149, 13, 5215, 1014, 5014, 13, 5215, 1852, 5510, 13, 5215, 6608, 1982, 13, 5215, 9637, 1627, 13, 5215, 282, 2158, 13, 13, 13, 1753, 1303, 1271, 1958, 29918, 3888, 29898, 9507, 1125, 13, 1678, 3884, 353, 9657, 580, 13, 1678, 411, 1722, 29898, 9507, 29897, 408, 285, 29901, 13, 4706, 1121, 353, 518, 1220, 29889, 5451, 580, 363, 1196, 297, 285, 29962, 13, 4706, 363, 301, 297, 1121, 29901, 13, 9651, 3884, 29961, 29880, 29961, 29900, 5262, 353, 301, 29961, 29896, 17531, 13, 1678, 736, 3884, 13, 13, 13, 1753, 337, 1202, 275, 2039, 29918, 3888, 29898, 9507, 1125, 13, 1678, 766, 2039, 353, 5159, 13, 1678, 411, 1722, 29898, 9507, 29897, 408, 285, 29901, 13, 4706, 1121, 353, 518, 1220, 29889, 5451, 580, 363, 1196, 297, 285, 29962, 13, 1678, 396, 407, 29878, 524, 29889, 407, 29878, 524, 29898, 2914, 29897, 13, 1678, 736, 1121, 13, 13, 13, 1753, 337, 1202, 275, 2039, 29918, 657, 20960, 3888, 29898, 2218, 2039, 29892, 8086, 978, 1125, 13, 1678, 363, 270, 297, 766, 2039, 29901, 13, 4706, 565, 270, 29961, 29900, 29962, 1275, 8086, 978, 29901, 13, 9651, 736, 270, 13, 1678, 736, 5159, 13, 13, 13, 1753, 2910, 29918, 24926, 7295, 13, 1678, 5534, 9124, 29918, 1272, 29892, 2910, 29918, 1272, 13, 1678, 2910, 29918, 1272, 353, 7023, 2378, 4197, 29900, 29916, 600, 29962, 334, 29871, 29900, 29916, 29947, 29900, 29900, 29897, 13, 13, 13, 1753, 2181, 29873, 1958, 29918, 932, 3906, 719, 29898, 9507, 29892, 2908, 29892, 1024, 29892, 3211, 1125, 13, 1678, 411, 1722, 29898, 9507, 29892, 376, 271, 1159, 408, 285, 29901, 13, 4706, 2793, 353, 29850, 29900, 29913, 285, 426, 29896, 29913, 28915, 29871, 29900, 29916, 29912, 29906, 29901, 29900, 29946, 29916, 1012, 29876, 1642, 4830, 29898, 1271, 29892, 1024, 29892, 3211, 29897, 13, 4706, 736, 285, 29889, 3539, 29898, 3051, 29897, 13, 13, 13, 1753, 2254, 29918, 1445, 29898, 9507, 1125, 13, 1678, 411, 1722, 29898, 9507, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 4706, 736, 285, 29889, 949, 580, 13, 13, 13, 1753, 2436, 29918, 558, 29887, 29898, 25721, 29892, 4482, 9812, 29892, 848, 1125, 13, 1678, 565, 4482, 9812, 1275, 29871, 29900, 29901, 13, 4706, 396, 4482, 13, 4706, 263, 353, 7023, 2378, 29898, 29906, 29897, 13, 4706, 263, 29961, 29900, 29962, 353, 29871, 29900, 13, 4706, 263, 29961, 29896, 29962, 353, 29871, 29900, 29916, 29947, 29900, 13, 1678, 25342, 4482, 9812, 1275, 29871, 29896, 29901, 13, 4706, 396, 1880, 13, 4706, 263, 353, 7023, 2378, 29898, 29906, 29897, 13, 4706, 263, 29961, 29900, 29962, 353, 29871, 29900, 13, 4706, 263, 29961, 29896, 29962, 353, 29871, 29900, 29916, 29909, 29900, 13, 1678, 1683, 29901, 13, 4706, 12020, 8960, 703, 677, 9812, 508, 871, 367, 29871, 29900, 470, 29871, 29896, 1159, 13, 268, 13, 1678, 411, 1722, 29898, 25721, 29892, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 4706, 396, 29888, 29889, 3539, 29898, 29874, 29897, 13, 4706, 285, 29889, 3539, 29898, 1272, 29897, 13, 13, 13, 1753, 2908, 1958, 29918, 932, 3906, 719, 29898, 20960, 333, 29892, 1196, 29892, 9124, 29892, 1880, 7328, 1125, 13, 1678, 5534, 2910, 29918, 1272, 13, 1678, 2967, 353, 8086, 333, 334, 29871, 29906, 29945, 29953, 718, 1196, 334, 29871, 29906, 13, 1678, 2910, 29918, 1272, 29961, 3188, 29962, 353, 9124, 13, 1678, 2910, 29918, 1272, 29961, 3188, 29974, 29896, 29962, 353, 1880, 7328, 13, 1678, 396, 2158, 703, 1271, 1958, 29918, 932, 3906, 719, 29901, 376, 718, 851, 29898, 3188, 29897, 718, 29242, 376, 718, 851, 29898, 9157, 29897, 718, 376, 376, 718, 851, 29898, 9812, 7328, 876, 13, 13, 13, 1753, 8147, 29918, 7328, 29898, 677, 9812, 1125, 13, 1678, 565, 4482, 9812, 1275, 29871, 29900, 29901, 13, 4706, 396, 4482, 13, 4706, 263, 353, 29871, 29900, 29916, 29947, 29900, 13, 1678, 25342, 4482, 9812, 1275, 29871, 29896, 29901, 13, 4706, 396, 1880, 13, 4706, 263, 353, 29871, 29900, 29916, 29909, 29900, 13, 1678, 1683, 29901, 13, 4706, 12020, 8960, 703, 677, 9812, 508, 871, 367, 29871, 29900, 470, 29871, 29896, 1159, 13, 1678, 736, 263, 13, 13, 13, 1753, 1667, 29898, 19218, 1125, 13, 1678, 5534, 9124, 29918, 1272, 29892, 2910, 29918, 1272, 13, 1678, 282, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 29899, 29894, 613, 2731, 543, 369, 15828, 613, 3158, 543, 8899, 29918, 3009, 613, 1371, 543, 6565, 15828, 1962, 23157, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 29899, 29877, 613, 2731, 543, 2218, 2039, 613, 3158, 543, 8899, 613, 3734, 29922, 5574, 29892, 1371, 543, 20960, 5285, 934, 23157, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 29899, 29888, 613, 2731, 543, 5325, 613, 3158, 543, 8899, 613, 3734, 29922, 5574, 29892, 1371, 543, 5325, 3884, 23157, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 29899, 29885, 613, 2731, 543, 29883, 2273, 1445, 613, 3158, 543, 8899, 613, 3734, 29922, 5574, 29892, 1371, 543, 29883, 2273, 29889, 1958, 934, 1159, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 29899, 29881, 613, 2731, 543, 23848, 613, 3158, 543, 8899, 613, 3734, 29922, 5574, 29892, 1371, 543, 23848, 3884, 23157, 13, 1678, 282, 29889, 1202, 29918, 23516, 703, 29899, 29890, 613, 2731, 543, 1271, 1958, 613, 3158, 543, 8899, 613, 3734, 29922, 5574, 29892, 1371, 543, 1271, 1958, 934, 23157, 13, 1678, 396, 29886, 29889, 1202, 29918, 23516, 703, 29899, 29888, 613, 2731, 543, 1445, 4905, 613, 3158, 543, 8899, 613, 3734, 29922, 5574, 29892, 1371, 543, 4905, 848, 2793, 934, 23157, 13, 1678, 6389, 353, 282, 29889, 5510, 29918, 5085, 580, 13, 1678, 396, 7382, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 4282, 29892, 376, 7382, 1159, 13, 1678, 396, 359, 29889, 29885, 12535, 12935, 29898, 7382, 29918, 2084, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 2066, 29918, 2084, 353, 6389, 29889, 5325, 396, 359, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 4282, 29892, 376, 5325, 1159, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 5325, 29918, 2084, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 12551, 29918, 2084, 353, 6389, 29889, 23848, 396, 359, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 4282, 29892, 376, 5415, 1159, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 23848, 29918, 2084, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 13, 1678, 766, 2039, 353, 337, 1202, 275, 2039, 29918, 3888, 29898, 5085, 29889, 2218, 2039, 29897, 13, 1678, 2908, 1958, 353, 1303, 1271, 1958, 29918, 3888, 29898, 5085, 29889, 1271, 1958, 29897, 13, 13, 1678, 2910, 29918, 24926, 580, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 29898, 5085, 29889, 29883, 2273, 1445, 1125, 13, 4706, 2897, 29889, 5992, 29898, 5085, 29889, 29883, 2273, 1445, 29897, 13, 268, 13, 1678, 396, 788, 10930, 934, 13, 1678, 363, 270, 297, 4852, 26549, 812, 423, 613, 376, 29873, 340, 484, 613, 376, 29881, 5872, 292, 613, 376, 27193, 613, 376, 17462, 613, 376, 29881, 19440, 265, 613, 376, 5062, 11526, 29908, 1125, 13, 4706, 8086, 3888, 353, 337, 1202, 275, 2039, 29918, 657, 20960, 3888, 29898, 2218, 2039, 29892, 270, 29897, 13, 4706, 1369, 11294, 353, 938, 29898, 20960, 3888, 29961, 29906, 1402, 29871, 29900, 29897, 13, 4706, 3171, 353, 938, 29898, 20960, 3888, 29961, 29946, 1402, 29871, 29900, 29897, 448, 938, 29898, 20960, 3888, 29961, 29906, 1402, 29871, 29900, 29897, 718, 29871, 29896, 13, 4706, 8086, 333, 353, 938, 29898, 20960, 3888, 29961, 29896, 1402, 29871, 29900, 29897, 448, 29871, 29900, 29916, 29946, 29896, 13, 4706, 1369, 9157, 353, 938, 29898, 1271, 1958, 29961, 29881, 3816, 29900, 1402, 29871, 29900, 29897, 13, 4706, 4482, 9812, 353, 938, 29898, 1271, 1958, 29961, 29881, 3816, 29896, 1402, 29871, 29900, 29897, 13, 4706, 2908, 29918, 1272, 353, 2254, 29918, 1445, 29898, 359, 29889, 2084, 29889, 7122, 29898, 5325, 29918, 2084, 29892, 270, 718, 11393, 1272, 5783, 13, 4706, 396, 2048, 2910, 322, 10930, 13, 4706, 2910, 29918, 1272, 29961, 20960, 333, 29930, 29906, 29945, 29953, 29974, 29906, 29945, 29945, 29962, 353, 1369, 11294, 13, 4706, 363, 289, 297, 3464, 29898, 29900, 29892, 3171, 29892, 29871, 29906, 1125, 13, 9651, 396, 3765, 1196, 470, 2323, 1196, 13, 9651, 396, 19790, 353, 29871, 29906, 13, 9651, 396, 361, 289, 29974, 29896, 6736, 3171, 29901, 13, 9651, 396, 1678, 7329, 353, 29871, 29896, 13, 13, 9651, 396, 1207, 848, 13, 9651, 9124, 29918, 1272, 353, 7023, 2378, 4197, 29900, 29916, 600, 29962, 334, 29871, 29900, 29916, 29906, 29900, 29900, 29900, 29897, 13, 9651, 2967, 7328, 353, 8147, 29918, 7328, 29898, 677, 9812, 29897, 13, 632, 13, 9651, 565, 289, 29974, 29896, 6736, 3171, 29901, 13, 18884, 396, 697, 1196, 13, 18884, 269, 353, 289, 334, 29871, 29906, 29945, 29953, 29930, 29896, 29953, 13, 18884, 301, 353, 29871, 29900, 29916, 29896, 29900, 29900, 29900, 13, 18884, 9124, 29918, 1272, 29961, 29900, 29901, 29880, 29962, 353, 2908, 29918, 1272, 29961, 29879, 29901, 29879, 29974, 29880, 29962, 13, 18884, 2908, 1958, 29918, 932, 3906, 719, 29898, 20960, 333, 29892, 289, 29892, 1369, 9157, 29892, 2967, 7328, 29897, 13, 9651, 1683, 29901, 13, 18884, 396, 1023, 3454, 13, 18884, 269, 353, 289, 334, 29871, 29906, 29945, 29953, 29930, 29896, 29953, 13, 18884, 301, 353, 29871, 29900, 29916, 29906, 29900, 29900, 29900, 13, 18884, 9124, 29918, 1272, 29961, 29900, 29901, 29880, 29962, 353, 2908, 29918, 1272, 29961, 29879, 29901, 29879, 29974, 29880, 29962, 13, 18884, 2908, 1958, 29918, 932, 3906, 719, 29898, 20960, 333, 29892, 289, 29892, 1369, 9157, 29892, 2967, 7328, 29897, 13, 18884, 2908, 1958, 29918, 932, 3906, 719, 29898, 20960, 333, 29892, 289, 29974, 29896, 29892, 1369, 9157, 29892, 2967, 7328, 29974, 29900, 29916, 29896, 29900, 29897, 13, 13, 9651, 396, 2436, 848, 322, 2910, 13, 9651, 10422, 353, 29850, 29900, 3227, 29896, 29901, 29900, 29906, 29881, 1836, 481, 11007, 1642, 4830, 29898, 29881, 29892, 289, 29897, 13, 9651, 2436, 29918, 558, 29887, 29898, 359, 29889, 2084, 29889, 7122, 29898, 23848, 29918, 2084, 29892, 10422, 511, 4482, 9812, 29892, 9124, 29918, 1272, 29897, 13, 9651, 2181, 29873, 1958, 29918, 932, 3906, 719, 29898, 5085, 29889, 29883, 2273, 1445, 29892, 1369, 9157, 29892, 10422, 29892, 2967, 7328, 334, 29871, 29900, 29916, 29896, 29900, 29900, 29897, 13, 632, 13, 9651, 396, 7910, 1819, 13, 9651, 1369, 9157, 4619, 29871, 29896, 13, 13, 1678, 396, 2436, 2908, 2910, 13, 1678, 2908, 1958, 29918, 9157, 353, 938, 29898, 1271, 1958, 3366, 1271, 1958, 3108, 29961, 29900, 1402, 29871, 29900, 29897, 13, 1678, 2908, 1958, 29918, 677, 9812, 353, 938, 29898, 1271, 1958, 3366, 1271, 1958, 3108, 29961, 29896, 1402, 29871, 29900, 29897, 13, 1678, 2908, 1958, 29918, 7328, 353, 8147, 29918, 7328, 29898, 1271, 1958, 29918, 677, 9812, 29897, 334, 29871, 29906, 29945, 29953, 13, 1678, 396, 1271, 1958, 29918, 932, 3906, 719, 29898, 29900, 29892, 289, 29892, 1369, 9157, 29892, 2967, 7328, 29897, 13, 1678, 2908, 1958, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 23848, 29918, 2084, 29892, 376, 1271, 1958, 29889, 481, 11007, 1159, 13, 1678, 2436, 29918, 558, 29887, 29898, 1271, 1958, 978, 29892, 2908, 1958, 29918, 677, 9812, 29892, 2910, 29918, 1272, 29897, 13, 1678, 2181, 29873, 1958, 29918, 932, 3906, 719, 29898, 5085, 29889, 29883, 2273, 1445, 29892, 2908, 1958, 29918, 9157, 29892, 376, 1271, 1958, 29889, 481, 11007, 613, 2908, 1958, 29918, 7328, 29897, 13, 268, 13, 1678, 736, 29871, 29900, 13, 13, 308, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1018, 29901, 13, 4706, 3240, 791, 353, 1667, 29898, 9675, 29889, 19218, 29897, 13, 4706, 10876, 29889, 13322, 29898, 2267, 791, 29897, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 29898, 29872, 29897, 13, 4706, 9637, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 2 ]
maxwell/publisher.py
maxwell-dev/maxwell-client-python
1
92236
import pycommons.logger import maxwell.protocol.maxwell_protocol_pb2 as protocol_types logger = pycommons.logger.get_instance(__name__) class Publisher(object): # =========================================== # apis # =========================================== def __init__(self, master, connection_mgr, options, loop): self.__master = master self.__connection_mgr = connection_mgr self.__options = options self.__loop = loop self.__connections = {} def close(self): for connection in self.__connections.values(): self.__disconnect_from_backend(connection) async def publish(self, topic, value): endpoint = await self.__master.resolve_backend(topic) connection = self.__connect_to_backend(endpoint) await self.__publish(connection, topic, value) # =========================================== # connector # =========================================== def __connect_to_backend(self, endpoint): connection = self.__connections.get(endpoint) if connection == None: connection = self.__connection_mgr.fetch(endpoint) self.__connections[endpoint] = connection return connection def __disconnect_from_backend(self, endpoint): connection = self.__connections.pop(endpoint, None) if connection != None: self.__connection_mgr.release(connection) # =========================================== # internal coros # =========================================== async def __publish(self, connection, topic, value): await connection.wait_until_open() await connection.request( self.__build_publish_req(topic, value) ) # =========================================== # req builders # =========================================== def __build_publish_req(self, topic, value): push_req = protocol_types.push_req_t() push_req.topic = topic push_req.value = value return push_req
[ 1, 1053, 11451, 22382, 29889, 21707, 13, 5215, 4236, 5872, 29889, 20464, 29889, 3317, 5872, 29918, 20464, 29918, 24381, 29906, 408, 9608, 29918, 8768, 13, 13, 21707, 353, 11451, 22382, 29889, 21707, 29889, 657, 29918, 8758, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 12904, 261, 29898, 3318, 1125, 13, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 396, 3095, 275, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 5835, 29892, 3957, 29918, 29885, 629, 29892, 3987, 29892, 2425, 1125, 13, 4706, 1583, 17255, 6207, 353, 5835, 13, 4706, 1583, 17255, 9965, 29918, 29885, 629, 353, 3957, 29918, 29885, 629, 13, 4706, 1583, 17255, 6768, 353, 3987, 13, 4706, 1583, 17255, 7888, 353, 2425, 13, 4706, 1583, 17255, 11958, 1953, 353, 6571, 13, 13, 1678, 822, 3802, 29898, 1311, 1125, 13, 4706, 363, 3957, 297, 1583, 17255, 11958, 1953, 29889, 5975, 7295, 13, 9651, 1583, 17255, 2218, 6915, 29918, 3166, 29918, 27852, 29898, 9965, 29897, 13, 13, 1678, 7465, 822, 9805, 29898, 1311, 29892, 11261, 29892, 995, 1125, 13, 4706, 16248, 353, 7272, 1583, 17255, 6207, 29889, 17863, 29918, 27852, 29898, 13010, 29897, 13, 4706, 3957, 353, 1583, 17255, 6915, 29918, 517, 29918, 27852, 29898, 29734, 29897, 13, 4706, 7272, 1583, 17255, 23679, 29898, 9965, 29892, 11261, 29892, 995, 29897, 13, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 396, 1826, 2801, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 822, 4770, 6915, 29918, 517, 29918, 27852, 29898, 1311, 29892, 16248, 1125, 13, 4706, 3957, 353, 1583, 17255, 11958, 1953, 29889, 657, 29898, 29734, 29897, 13, 4706, 565, 3957, 1275, 6213, 29901, 13, 9651, 3957, 353, 1583, 17255, 9965, 29918, 29885, 629, 29889, 9155, 29898, 29734, 29897, 13, 9651, 1583, 17255, 11958, 1953, 29961, 29734, 29962, 353, 3957, 13, 4706, 736, 3957, 13, 13, 1678, 822, 4770, 2218, 6915, 29918, 3166, 29918, 27852, 29898, 1311, 29892, 16248, 1125, 13, 4706, 3957, 353, 1583, 17255, 11958, 1953, 29889, 7323, 29898, 29734, 29892, 6213, 29897, 13, 4706, 565, 3957, 2804, 6213, 29901, 13, 9651, 1583, 17255, 9965, 29918, 29885, 629, 29889, 14096, 29898, 9965, 29897, 13, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 396, 7463, 1034, 359, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 7465, 822, 4770, 23679, 29898, 1311, 29892, 3957, 29892, 11261, 29892, 995, 1125, 13, 4706, 7272, 3957, 29889, 10685, 29918, 29305, 29918, 3150, 580, 13, 4706, 7272, 3957, 29889, 3827, 29898, 13, 9651, 1583, 17255, 4282, 29918, 23679, 29918, 7971, 29898, 13010, 29892, 995, 29897, 13, 4706, 1723, 13, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 396, 12428, 2048, 414, 13, 1678, 396, 1275, 9166, 9166, 4936, 29922, 13, 1678, 822, 4770, 4282, 29918, 23679, 29918, 7971, 29898, 1311, 29892, 11261, 29892, 995, 1125, 13, 4706, 5503, 29918, 7971, 353, 9608, 29918, 8768, 29889, 5910, 29918, 7971, 29918, 29873, 580, 13, 4706, 5503, 29918, 7971, 29889, 13010, 353, 11261, 13, 4706, 5503, 29918, 7971, 29889, 1767, 353, 995, 13, 4706, 736, 5503, 29918, 7971, 13, 2 ]
src/zocalo/wrapper.py
rjgildea/python-zocalo
2
180625
<reponame>rjgildea/python-zocalo import logging import threading import workflows.util import zocalo class BaseWrapper: def set_recipe_wrapper(self, recwrap): self.recwrap = recwrap def prepare(self, payload=""): if getattr(self, "recwrap", None): self.recwrap.send_to("starting", payload) def update(self, payload=""): if getattr(self, "recwrap", None): self.recwrap.send_to("updates", payload) def done(self, payload=""): if getattr(self, "recwrap", None): self.recwrap.send_to("completed", payload) def success(self, payload=""): if getattr(self, "recwrap", None): self.recwrap.send_to("success", payload) def failure(self, payload=""): if getattr(self, "recwrap", None): self.recwrap.send_to("failure", str(payload)) def run(self): raise NotImplementedError() def record_result_individual_file(self, payload=""): if getattr(self, "recwrap", None): self.recwrap.send_to("result-individual-file", payload) def record_result_all_files(self, payload=""): if getattr(self, "recwrap", None): self.recwrap.send_to("result-all-files", payload) class DummyWrapper(BaseWrapper): def run(self): logging.getLogger("zocalo.wrapper.DummyWrapper").info( "This is a dummy wrapper that simply waits for a minute." ) import time time.sleep(10) self.status_thread.taskname += " (still running)" time.sleep(50) return True class StatusNotifications(threading.Thread): def __init__(self, send_function, taskname): super().__init__(name="zocalo status notification") self.daemon = True self._send_status = send_function self._lock = threading.Condition(threading.Lock()) self._status_dict = { "host": workflows.util.generate_unique_host_id(), "task": taskname, "workflows": workflows.version(), "zocalo": zocalo.__version__, } self.set_status(workflows.services.common_service.Status.STARTING) self._keep_running = True self.start() def set_static_status_field(self, field, value): """ Add an additional static field to status notifications. """ with self._lock: self._status_dict[field] = value def set_status(self, status): with self._lock: self._status_dict["status"], self._status_dict["statustext"] = ( status.intval, status.description, ) self._lock.notify() @property def taskname(self): """Return the name displayed on service monitors for this task.""" return self._status_dict["task"] @taskname.setter def taskname(self, value): """Set/update the name displayed on service monitors for this task.""" with self._lock: self._status_dict["task"] = value self._lock.notify() def shutdown(self): """Stop the status notification thread.""" self._keep_running = False def send_status(self, dictionary): try: self._send_status(dictionary) except workflows.Disconnected: pass def run(self): """Status notification thread main loop.""" with self._lock: self.send_status(self._status_dict) while self._keep_running: self._lock.wait(3) self.send_status(self._status_dict)
[ 1, 529, 276, 1112, 420, 29958, 29878, 29926, 29887, 7154, 29874, 29914, 4691, 29899, 29920, 542, 7003, 13, 5215, 12183, 13, 5215, 3244, 292, 13, 13, 5215, 27321, 29879, 29889, 4422, 13, 13, 5215, 503, 542, 7003, 13, 13, 13, 1990, 7399, 15646, 29901, 13, 1678, 822, 731, 29918, 4361, 412, 29918, 17699, 29898, 1311, 29892, 1162, 6312, 1125, 13, 4706, 1583, 29889, 3757, 6312, 353, 1162, 6312, 13, 13, 1678, 822, 19012, 29898, 1311, 29892, 20092, 13776, 1125, 13, 4706, 565, 679, 5552, 29898, 1311, 29892, 376, 3757, 6312, 613, 6213, 1125, 13, 9651, 1583, 29889, 3757, 6312, 29889, 6717, 29918, 517, 703, 2962, 292, 613, 20092, 29897, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 20092, 13776, 1125, 13, 4706, 565, 679, 5552, 29898, 1311, 29892, 376, 3757, 6312, 613, 6213, 1125, 13, 9651, 1583, 29889, 3757, 6312, 29889, 6717, 29918, 517, 703, 786, 15190, 613, 20092, 29897, 13, 13, 1678, 822, 2309, 29898, 1311, 29892, 20092, 13776, 1125, 13, 4706, 565, 679, 5552, 29898, 1311, 29892, 376, 3757, 6312, 613, 6213, 1125, 13, 9651, 1583, 29889, 3757, 6312, 29889, 6717, 29918, 517, 703, 5729, 9446, 613, 20092, 29897, 13, 13, 1678, 822, 2551, 29898, 1311, 29892, 20092, 13776, 1125, 13, 4706, 565, 679, 5552, 29898, 1311, 29892, 376, 3757, 6312, 613, 6213, 1125, 13, 9651, 1583, 29889, 3757, 6312, 29889, 6717, 29918, 517, 703, 8698, 613, 20092, 29897, 13, 13, 1678, 822, 10672, 29898, 1311, 29892, 20092, 13776, 1125, 13, 4706, 565, 679, 5552, 29898, 1311, 29892, 376, 3757, 6312, 613, 6213, 1125, 13, 9651, 1583, 29889, 3757, 6312, 29889, 6717, 29918, 517, 703, 14057, 545, 613, 851, 29898, 23813, 876, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 1678, 822, 2407, 29918, 2914, 29918, 513, 23352, 29918, 1445, 29898, 1311, 29892, 20092, 13776, 1125, 13, 4706, 565, 679, 5552, 29898, 1311, 29892, 376, 3757, 6312, 613, 6213, 1125, 13, 9651, 1583, 29889, 3757, 6312, 29889, 6717, 29918, 517, 703, 2914, 29899, 513, 23352, 29899, 1445, 613, 20092, 29897, 13, 13, 1678, 822, 2407, 29918, 2914, 29918, 497, 29918, 5325, 29898, 1311, 29892, 20092, 13776, 1125, 13, 4706, 565, 679, 5552, 29898, 1311, 29892, 376, 3757, 6312, 613, 6213, 1125, 13, 9651, 1583, 29889, 3757, 6312, 29889, 6717, 29918, 517, 703, 2914, 29899, 497, 29899, 5325, 613, 20092, 29897, 13, 13, 13, 1990, 360, 11770, 15646, 29898, 5160, 15646, 1125, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 12183, 29889, 657, 16363, 703, 29920, 542, 7003, 29889, 17699, 29889, 29928, 11770, 15646, 2564, 3888, 29898, 13, 9651, 376, 4013, 338, 263, 20254, 14476, 393, 3763, 11324, 1169, 363, 263, 11015, 1213, 13, 4706, 1723, 13, 4706, 1053, 931, 13, 13, 4706, 931, 29889, 17059, 29898, 29896, 29900, 29897, 13, 4706, 1583, 29889, 4882, 29918, 7097, 29889, 7662, 978, 4619, 376, 313, 303, 453, 2734, 5513, 13, 4706, 931, 29889, 17059, 29898, 29945, 29900, 29897, 13, 4706, 736, 5852, 13, 13, 13, 1990, 16034, 3664, 8232, 29898, 7097, 292, 29889, 4899, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3638, 29918, 2220, 29892, 3414, 978, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 543, 29920, 542, 7003, 4660, 12519, 1159, 13, 4706, 1583, 29889, 1388, 9857, 353, 5852, 13, 4706, 1583, 3032, 6717, 29918, 4882, 353, 3638, 29918, 2220, 13, 4706, 1583, 3032, 908, 353, 3244, 292, 29889, 25255, 29898, 7097, 292, 29889, 16542, 3101, 13, 4706, 1583, 3032, 4882, 29918, 8977, 353, 426, 13, 9651, 376, 3069, 1115, 27321, 29879, 29889, 4422, 29889, 17158, 29918, 13092, 29918, 3069, 29918, 333, 3285, 13, 9651, 376, 7662, 1115, 3414, 978, 29892, 13, 9651, 376, 1287, 1731, 29879, 1115, 27321, 29879, 29889, 3259, 3285, 13, 9651, 376, 29920, 542, 7003, 1115, 503, 542, 7003, 17255, 3259, 1649, 29892, 13, 4706, 500, 13, 4706, 1583, 29889, 842, 29918, 4882, 29898, 1287, 1731, 29879, 29889, 9916, 29889, 9435, 29918, 5509, 29889, 5709, 29889, 25826, 4214, 29897, 13, 4706, 1583, 3032, 17462, 29918, 21094, 353, 5852, 13, 4706, 1583, 29889, 2962, 580, 13, 13, 1678, 822, 731, 29918, 7959, 29918, 4882, 29918, 2671, 29898, 1311, 29892, 1746, 29892, 995, 1125, 13, 4706, 9995, 13, 4706, 3462, 385, 5684, 2294, 1746, 304, 4660, 25913, 29889, 13, 4706, 9995, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 1583, 3032, 4882, 29918, 8977, 29961, 2671, 29962, 353, 995, 13, 13, 1678, 822, 731, 29918, 4882, 29898, 1311, 29892, 4660, 1125, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 1583, 3032, 4882, 29918, 8977, 3366, 4882, 12436, 1583, 3032, 4882, 29918, 8977, 3366, 6112, 504, 1062, 3108, 353, 313, 13, 18884, 4660, 29889, 524, 791, 29892, 13, 18884, 4660, 29889, 8216, 29892, 13, 9651, 1723, 13, 9651, 1583, 3032, 908, 29889, 25140, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3414, 978, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 1024, 8833, 373, 2669, 1601, 17259, 363, 445, 3414, 1213, 15945, 13, 4706, 736, 1583, 3032, 4882, 29918, 8977, 3366, 7662, 3108, 13, 13, 1678, 732, 7662, 978, 29889, 842, 357, 13, 1678, 822, 3414, 978, 29898, 1311, 29892, 995, 1125, 13, 4706, 9995, 2697, 29914, 5504, 278, 1024, 8833, 373, 2669, 1601, 17259, 363, 445, 3414, 1213, 15945, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 1583, 3032, 4882, 29918, 8977, 3366, 7662, 3108, 353, 995, 13, 9651, 1583, 3032, 908, 29889, 25140, 580, 13, 13, 1678, 822, 12522, 3204, 29898, 1311, 1125, 13, 4706, 9995, 16329, 278, 4660, 12519, 3244, 1213, 15945, 13, 4706, 1583, 3032, 17462, 29918, 21094, 353, 7700, 13, 13, 1678, 822, 3638, 29918, 4882, 29898, 1311, 29892, 8600, 1125, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 6717, 29918, 4882, 29898, 27126, 29897, 13, 4706, 5174, 27321, 29879, 29889, 4205, 18045, 29901, 13, 9651, 1209, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 9995, 5709, 12519, 3244, 1667, 2425, 1213, 15945, 13, 4706, 411, 1583, 3032, 908, 29901, 13, 9651, 1583, 29889, 6717, 29918, 4882, 29898, 1311, 3032, 4882, 29918, 8977, 29897, 13, 9651, 1550, 1583, 3032, 17462, 29918, 21094, 29901, 13, 18884, 1583, 3032, 908, 29889, 10685, 29898, 29941, 29897, 13, 18884, 1583, 29889, 6717, 29918, 4882, 29898, 1311, 3032, 4882, 29918, 8977, 29897, 13, 2 ]
pyreto/continuous/environment.py
rwl/pylon
11
184120
<reponame>rwl/pylon<filename>pyreto/continuous/environment.py #------------------------------------------------------------------------------ # Copyright (C) 2007-2010 <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. #------------------------------------------------------------------------------ """ Defines an environment for market participants. """ #------------------------------------------------------------------------------ # Imports: #------------------------------------------------------------------------------ import logging from numpy import array, mean, r_, zeros from pylon import PQ, PV from pyreto.discrete import MarketEnvironment as DiscreteMarketEnvironment #------------------------------------------------------------------------------ # Logging: #------------------------------------------------------------------------------ logger = logging.getLogger(__name__) #------------------------------------------------------------------------------ # "MarketEnvironment" class: #------------------------------------------------------------------------------ class MarketEnvironment(DiscreteMarketEnvironment): """ Defines a continuous representation of an electricity market participant's environment. """ def __init__(self, generators, market, numOffbids=1, maxMarkup=0.0, maxWithhold=None): """ A market environment has a portfolios of generation and a market. """ super(MarketEnvironment, self).__init__(generators, market, numStates=0, markups=None, withholds=None, numOffbids=numOffbids) #: Maximum price markup. self.maxMarkup = maxMarkup #: Maximum quantity withhold. self.maxWithhold = maxWithhold #-------------------------------------------------------------------------- # "Environment" interface: #-------------------------------------------------------------------------- def getSensors(self): """ Returns the currently visible state of the world as a numpy array of doubles. """ sensors = array([]) sensors = r_[sensors, self._getTotalDemandSensor()] # sensors = r_[sensors, self._getDemandSensor()] # sensors = r_[sensors, self._getPriceSensor()] # sensors = r_[sensors, self._getBusVoltageSensor()] # sensors = r_[sensors, self._getBusVoltageMagnitudeSensor()] # sensors = r_[sensors, self._getBusVoltageLambdaSensor()] # sensors = r_[sensors, self._getBranchFlowSensor()] # logger.info("State: %s" % sensors) return sensors def performAction(self, action): """ Performs an action on the world that changes it's internal state. @param action: an action that should be executed in the Environment @type action: array: [ g1_prc, g2_prc, g1_qty, g2_qty, ... ] """ self._lastAction = [] n = self.numOffbids * len(self.generators) if self.maxWithhold is not None: markups = action[:n] withholds = action[n:] else: markups = action withholds = [0.0] * n self._offbid(markups, withholds) @property def indim(self): """ The number of action values that the environment accepts. """ indim = self.numOffbids * len(self.generators) if self.maxWithhold is not None: return indim * 2 else: return indim @property def outdim(self): """ The number of sensor values that the environment produces. """ return len(self.getSensors()) # def reset(self): # """ Re-initialises the market environment. # """ # self._lastAction = [] # self.market.reset() #-------------------------------------------------------------------------- # "MarketEnvironment" interface: #-------------------------------------------------------------------------- def _getTotalDemandSensor(self): Pd = sum([b.p_demand for b in self.market.case.buses]) return array([Pd]) def _getDemandSensor(self): Pd = [b.p_demand for b in self.market.case.buses if b.type == PQ] return array(Pd) def _getPriceSensor(self): offers = [offer for offer in self._lastAction] if len(offers) > 0: avgPrice = mean([ob.clearedPrice for ob in offers]) else: avgPrice = 0.0 f = self.market._solution["f"] return array([avgPrice, f]) def _getBusVoltageSensor(self): sensor = zeros(len(self.market.case.connected_buses)) for i, bus in enumerate(self.market.case.connected_buses): if bus.type == PV: sensor[i] = -bus.mu_vmin + bus.mu_vmax else: sensor[i] = bus.v_magnitude return sensor def _getBusVoltageMagnitudeSensor(self): Vm = array([b.v_magnitude for b in self.market.case.connected_buses]) # Va = array([b.v_angle for b in self.market.case.connected_buses]) return Vm def _getBusVoltageAngleSensor(self): Va = array([b.v_angle for b in self.market.case.connected_buses]) return Va def _getBusVoltageLambdaSensor(self): """ Returns an array of length nb where each value is the sum of the Lagrangian multipliers on the upper and the negative of the Lagrangian multipliers on the lower voltage limits. """ muVmin = array([b.mu_vmin for b in self.market.case.connected_buses]) muVmax = array([b.mu_vmax for b in self.market.case.connected_buses]) muVmin = -1.0 * muVmin diff = muVmin + muVmax return diff def _getBranchFlowSensor(self): Pf = array([l.p_from for l in self.market.case.online_branches]) # Qf = array([l.q_from for l in self.market.case.online_branches]) return Pf # def _offbidMarkup(self, action): # for i, g in enumerate(self.generators): # ratedPMin = self._g0[g]["p_min"] # ratedPMax = self._g0[g]["p_max"] # margPCost = self._g0[g]["p_cost"] # margPCostModel = self._g0[g]["pcost_model"] # # # Index of the first markup in 'action' for the current gen. # k = i * (len(action) / len(self.generators)) # # # Determine the cost at zero output. # if margPCostModel == POLYNOMIAL: # costNoLoad = margPCost[-1] # else: # costNoLoad = 0.0 # # # Divide the rated capacity equally among the offers/bids. # if g.is_load: # qty = ratedPMin / self.numOffbids # else: # qty = ratedPMax / self.numOffbids # # # Get the marginal cost of generating at this output. ## c = g.total_cost(totQty, marginalPCost, marginalPCostModel) # # totQty = 0.0 # for j in range(self.numOffbids): # # Track the total quantity offered/bid for by the generator. # totQty += qty # # # The markups are cumulative to ensure cost function convexity. # mk = sum(action[k:k + j + 1]) # # # Marginal cost. # if margPCostModel == POLYNOMIAL: # cmarg = polyval(polyder(margPCost), totQty) # elif margPCostModel == PW_LINEAR: # n_segments = len(margPCost) - 1 # for i in range(n_segments): # x1, y1 = margPCost[i] # x2, y2 = margPCost[i + 1] # if x1 <= totQty <= x2: # cmarg = (y2 - y1) / (x2 - x1) # else: # raise ValueError, "Invalid bid quantity [%f]." % totQty # else: # raise ValueError # # # Markup the marginal cost of the generator. # if not g.is_load: # prc = cmarg * ((100.0 + mk) / 100.0) # else: # prc = cmarg * ((100.0 + mk) / 100.0) # # if not g.is_load: # offer = Offer(g, qty, prc, costNoLoad) # self.market.offers.append(offer) # # self._lastAction.append(offer) # # logger.info("%.2fMW offered at %.2f$/MWh for %s (%.1f%%)." # % (qty, prc, g.name, mk)) # else: # bid = Bid(g, -qty, prc, costNoLoad) # self.market.bids.append(bid) # # self._lastAction.append(bid) # # logger.info("%.2f$/MWh bid for %.2fMW for %s (%.1f%%)." # % (prc, -qty, g.name, mk)) # # return self._lastAction # EOF -------------------------------------------------------------------------
[ 1, 529, 276, 1112, 420, 29958, 13975, 29880, 29914, 2272, 12957, 29966, 9507, 29958, 2272, 276, 517, 29914, 20621, 681, 29914, 20944, 29889, 2272, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29900, 29955, 29899, 29906, 29900, 29896, 29900, 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, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 13, 15945, 29908, 5282, 1475, 385, 5177, 363, 9999, 27138, 29889, 13, 15945, 29908, 13, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 29937, 29871, 1954, 4011, 29901, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 13, 5215, 12183, 13, 13, 3166, 12655, 1053, 1409, 29892, 2099, 29892, 364, 3383, 24786, 13, 13, 3166, 282, 2904, 265, 1053, 349, 29984, 29892, 349, 29963, 13, 3166, 11451, 276, 517, 29889, 2218, 9084, 1053, 28794, 18649, 408, 3295, 9084, 9802, 300, 18649, 13, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 29937, 29871, 4522, 3460, 29901, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 29937, 29871, 376, 9802, 300, 18649, 29908, 770, 29901, 13, 29937, 2683, 2683, 2683, 2683, 9072, 489, 13, 13, 1990, 28794, 18649, 29898, 4205, 9084, 9802, 300, 18649, 1125, 13, 1678, 9995, 5282, 1475, 263, 9126, 8954, 310, 385, 12646, 537, 9999, 13, 4706, 5221, 424, 29915, 29879, 5177, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1176, 4097, 29892, 9999, 29892, 954, 6880, 29890, 4841, 29922, 29896, 29892, 4236, 9802, 786, 29922, 29900, 29889, 29900, 29892, 13, 9651, 4236, 3047, 8948, 29922, 8516, 1125, 13, 4706, 9995, 319, 9999, 5177, 756, 263, 2011, 4542, 2363, 310, 12623, 322, 263, 9999, 29889, 13, 4706, 9995, 13, 4706, 2428, 29898, 9802, 300, 18649, 29892, 1583, 467, 1649, 2344, 12035, 4738, 4097, 29892, 9999, 29892, 13, 9651, 954, 855, 1078, 29922, 29900, 29892, 2791, 14340, 29922, 8516, 29892, 411, 23177, 29922, 8516, 29892, 954, 6880, 29890, 4841, 29922, 1949, 6880, 29890, 4841, 29897, 13, 13, 4706, 396, 29901, 5918, 12539, 8666, 24986, 29889, 13, 4706, 1583, 29889, 3317, 9802, 786, 353, 4236, 9802, 786, 13, 13, 4706, 396, 29901, 5918, 12539, 14728, 411, 8948, 29889, 13, 4706, 1583, 29889, 3317, 3047, 8948, 353, 4236, 3047, 8948, 13, 13, 1678, 396, 2683, 2683, 2683, 2683, 28400, 13, 1678, 396, 29871, 376, 18649, 29908, 5067, 29901, 13, 1678, 396, 2683, 2683, 2683, 2683, 28400, 13, 13, 1678, 822, 679, 29903, 575, 943, 29898, 1311, 1125, 13, 4706, 9995, 16969, 278, 5279, 7962, 2106, 310, 278, 3186, 408, 263, 12655, 1409, 13, 9651, 310, 27641, 29889, 13, 4706, 9995, 13, 4706, 4771, 943, 353, 1409, 4197, 2314, 13, 4706, 4771, 943, 353, 364, 29918, 29961, 23149, 943, 29892, 1583, 3032, 657, 11536, 29928, 331, 392, 29903, 6073, 580, 29962, 13, 29937, 4706, 4771, 943, 353, 364, 29918, 29961, 23149, 943, 29892, 1583, 3032, 657, 29928, 331, 392, 29903, 6073, 580, 29962, 13, 29937, 4706, 4771, 943, 353, 364, 29918, 29961, 23149, 943, 29892, 1583, 3032, 657, 13026, 29903, 6073, 580, 29962, 13, 13, 29937, 4706, 4771, 943, 353, 364, 29918, 29961, 23149, 943, 29892, 1583, 3032, 657, 16890, 13072, 29873, 482, 29903, 6073, 580, 29962, 13, 13, 29937, 4706, 4771, 943, 353, 364, 29918, 29961, 23149, 943, 29892, 1583, 3032, 657, 16890, 13072, 29873, 482, 29924, 4211, 4279, 29903, 6073, 580, 29962, 13, 29937, 4706, 4771, 943, 353, 364, 29918, 29961, 23149, 943, 29892, 1583, 3032, 657, 16890, 13072, 29873, 482, 9099, 29903, 6073, 580, 29962, 13, 29937, 4706, 4771, 943, 353, 364, 29918, 29961, 23149, 943, 29892, 1583, 3032, 657, 29933, 4014, 17907, 29903, 6073, 580, 29962, 13, 13, 29937, 4706, 17927, 29889, 3888, 703, 2792, 29901, 1273, 29879, 29908, 1273, 4771, 943, 29897, 13, 13, 4706, 736, 4771, 943, 13, 13, 13, 1678, 822, 2189, 4276, 29898, 1311, 29892, 3158, 1125, 13, 4706, 9995, 2431, 9514, 385, 3158, 373, 278, 3186, 393, 3620, 372, 29915, 29879, 7463, 2106, 29889, 13, 9651, 732, 3207, 3158, 29901, 385, 3158, 393, 881, 367, 8283, 297, 278, 16738, 13, 9651, 732, 1853, 3158, 29901, 1409, 29901, 518, 330, 29896, 29918, 558, 29883, 29892, 330, 29906, 29918, 558, 29883, 29892, 330, 29896, 29918, 29939, 1017, 29892, 330, 29906, 29918, 29939, 1017, 29892, 2023, 4514, 13, 4706, 9995, 13, 4706, 1583, 3032, 4230, 4276, 353, 5159, 13, 13, 4706, 302, 353, 1583, 29889, 1949, 6880, 29890, 4841, 334, 7431, 29898, 1311, 29889, 4738, 4097, 29897, 13, 13, 4706, 565, 1583, 29889, 3317, 3047, 8948, 338, 451, 6213, 29901, 13, 9651, 2791, 14340, 353, 3158, 7503, 29876, 29962, 13, 9651, 411, 23177, 353, 3158, 29961, 29876, 17531, 13, 4706, 1683, 29901, 13, 9651, 2791, 14340, 353, 3158, 13, 9651, 411, 23177, 353, 518, 29900, 29889, 29900, 29962, 334, 302, 13, 13, 4706, 1583, 3032, 2696, 23883, 29898, 3502, 14340, 29892, 411, 23177, 29897, 13, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1399, 326, 29898, 1311, 1125, 13, 4706, 9995, 450, 1353, 310, 3158, 1819, 393, 278, 5177, 21486, 29889, 13, 4706, 9995, 13, 4706, 1399, 326, 353, 1583, 29889, 1949, 6880, 29890, 4841, 334, 7431, 29898, 1311, 29889, 4738, 4097, 29897, 13, 13, 4706, 565, 1583, 29889, 3317, 3047, 8948, 338, 451, 6213, 29901, 13, 9651, 736, 1399, 326, 334, 29871, 29906, 13, 4706, 1683, 29901, 13, 9651, 736, 1399, 326, 13, 13, 1678, 732, 6799, 13, 1678, 822, 714, 6229, 29898, 1311, 1125, 13, 4706, 9995, 450, 1353, 310, 23530, 1819, 393, 278, 5177, 13880, 29889, 13, 4706, 9995, 13, 4706, 736, 7431, 29898, 1311, 29889, 657, 29903, 575, 943, 3101, 13, 13, 13, 29937, 1678, 822, 10092, 29898, 1311, 1125, 13, 29937, 4706, 9995, 830, 29899, 11228, 4637, 278, 9999, 5177, 29889, 13, 29937, 4706, 9995, 13, 29937, 4706, 1583, 3032, 4230, 4276, 353, 5159, 13, 29937, 4706, 1583, 29889, 28549, 29889, 12071, 580, 13, 13, 1678, 396, 2683, 2683, 2683, 2683, 28400, 13, 1678, 396, 29871, 376, 9802, 300, 18649, 29908, 5067, 29901, 13, 1678, 396, 2683, 2683, 2683, 2683, 28400, 13, 13, 1678, 822, 903, 657, 11536, 29928, 331, 392, 29903, 6073, 29898, 1311, 1125, 13, 4706, 349, 29881, 353, 2533, 4197, 29890, 29889, 29886, 29918, 2310, 392, 363, 289, 297, 1583, 29889, 28549, 29889, 4878, 29889, 29890, 6394, 2314, 13, 13, 4706, 736, 1409, 4197, 29925, 29881, 2314, 13, 13, 13, 1678, 822, 903, 657, 29928, 331, 392, 29903, 6073, 29898, 1311, 1125, 13, 4706, 349, 29881, 353, 518, 29890, 29889, 29886, 29918, 2310, 392, 363, 289, 297, 1583, 29889, 28549, 29889, 4878, 29889, 29890, 6394, 565, 289, 29889, 1853, 1275, 349, 29984, 29962, 13, 13, 4706, 736, 1409, 29898, 29925, 29881, 29897, 13, 13, 13, 1678, 822, 903, 657, 13026, 29903, 6073, 29898, 1311, 1125, 13, 4706, 16688, 353, 518, 974, 571, 363, 5957, 297, 1583, 3032, 4230, 4276, 29962, 13, 13, 4706, 565, 7431, 29898, 2696, 414, 29897, 1405, 29871, 29900, 29901, 13, 9651, 1029, 29887, 13026, 353, 2099, 4197, 711, 29889, 2841, 1965, 13026, 363, 704, 297, 16688, 2314, 13, 4706, 1683, 29901, 13, 9651, 1029, 29887, 13026, 353, 29871, 29900, 29889, 29900, 13, 13, 4706, 285, 353, 1583, 29889, 28549, 3032, 2929, 918, 3366, 29888, 3108, 13, 13, 4706, 736, 1409, 4197, 485, 29887, 13026, 29892, 285, 2314, 13, 13, 13, 1678, 822, 903, 657, 16890, 13072, 29873, 482, 29903, 6073, 29898, 1311, 1125, 13, 4706, 23530, 353, 24786, 29898, 2435, 29898, 1311, 29889, 28549, 29889, 4878, 29889, 18045, 29918, 29890, 6394, 876, 13, 4706, 363, 474, 29892, 3593, 297, 26985, 29898, 1311, 29889, 28549, 29889, 4878, 29889, 18045, 29918, 29890, 6394, 1125, 13, 9651, 565, 3593, 29889, 1853, 1275, 349, 29963, 29901, 13, 18884, 23530, 29961, 29875, 29962, 353, 448, 8262, 29889, 2589, 29918, 29894, 1195, 718, 3593, 29889, 2589, 29918, 29894, 3317, 13, 9651, 1683, 29901, 13, 18884, 23530, 29961, 29875, 29962, 353, 3593, 29889, 29894, 29918, 29885, 4211, 4279, 13, 13, 4706, 736, 23530, 13, 13, 13, 1678, 822, 903, 657, 16890, 13072, 29873, 482, 29924, 4211, 4279, 29903, 6073, 29898, 1311, 1125, 13, 4706, 478, 29885, 353, 1409, 4197, 29890, 29889, 29894, 29918, 29885, 4211, 4279, 363, 289, 297, 1583, 29889, 28549, 29889, 4878, 29889, 18045, 29918, 29890, 6394, 2314, 13, 29937, 4706, 12549, 353, 1409, 4197, 29890, 29889, 29894, 29918, 2521, 363, 289, 297, 1583, 29889, 28549, 29889, 4878, 29889, 18045, 29918, 29890, 6394, 2314, 13, 4706, 736, 478, 29885, 13, 13, 13, 1678, 822, 903, 657, 16890, 13072, 29873, 482, 19582, 29903, 6073, 29898, 1311, 1125, 13, 4706, 12549, 353, 1409, 4197, 29890, 29889, 29894, 29918, 2521, 363, 289, 297, 1583, 29889, 28549, 29889, 4878, 29889, 18045, 29918, 29890, 6394, 2314, 13, 4706, 736, 12549, 13, 13, 13, 1678, 822, 903, 657, 16890, 13072, 29873, 482, 9099, 29903, 6073, 29898, 1311, 1125, 13, 4706, 9995, 16969, 385, 1409, 310, 3309, 302, 29890, 988, 1269, 995, 338, 278, 2533, 310, 278, 13, 4706, 365, 10312, 574, 713, 6674, 27801, 373, 278, 7568, 322, 278, 8178, 310, 278, 365, 10312, 574, 713, 13, 4706, 6674, 27801, 373, 278, 5224, 11749, 13071, 29889, 9995, 13, 4706, 3887, 29963, 1195, 353, 1409, 4197, 29890, 29889, 2589, 29918, 29894, 1195, 363, 289, 297, 1583, 29889, 28549, 29889, 4878, 29889, 18045, 29918, 29890, 6394, 2314, 13, 4706, 3887, 29963, 3317, 353, 1409, 4197, 29890, 29889, 2589, 29918, 29894, 3317, 363, 289, 297, 1583, 29889, 28549, 29889, 4878, 29889, 18045, 29918, 29890, 6394, 2314, 13, 4706, 3887, 29963, 1195, 353, 448, 29896, 29889, 29900, 334, 3887, 29963, 1195, 13, 4706, 2923, 353, 3887, 29963, 1195, 718, 3887, 29963, 3317, 13, 4706, 736, 2923, 13, 13, 13, 1678, 822, 903, 657, 29933, 4014, 17907, 29903, 6073, 29898, 1311, 1125, 13, 4706, 10022, 353, 1409, 4197, 29880, 29889, 29886, 29918, 3166, 363, 301, 297, 1583, 29889, 28549, 29889, 4878, 29889, 14627, 29918, 17519, 267, 2314, 13, 29937, 4706, 660, 29888, 353, 1409, 4197, 29880, 29889, 29939, 29918, 3166, 363, 301, 297, 1583, 29889, 28549, 29889, 4878, 29889, 14627, 29918, 17519, 267, 2314, 13, 4706, 736, 10022, 13, 13, 13, 29937, 1678, 822, 903, 2696, 23883, 9802, 786, 29898, 1311, 29892, 3158, 1125, 13, 29937, 4706, 363, 474, 29892, 330, 297, 26985, 29898, 1311, 29889, 4738, 4097, 1125, 13, 29937, 9651, 364, 630, 29925, 8140, 353, 1583, 3032, 29887, 29900, 29961, 29887, 29962, 3366, 29886, 29918, 1195, 3108, 13, 29937, 9651, 364, 630, 29925, 7976, 353, 1583, 3032, 29887, 29900, 29961, 29887, 29962, 3366, 29886, 29918, 3317, 3108, 13, 29937, 9651, 15276, 9026, 520, 353, 1583, 3032, 29887, 29900, 29961, 29887, 29962, 3366, 29886, 29918, 18253, 3108, 13, 29937, 9651, 15276, 9026, 520, 3195, 353, 1583, 3032, 29887, 29900, 29961, 29887, 29962, 3366, 6739, 520, 29918, 4299, 3108, 13, 29937, 13, 29937, 9651, 396, 11374, 310, 278, 937, 24986, 297, 525, 2467, 29915, 363, 278, 1857, 2531, 29889, 13, 29937, 9651, 413, 353, 474, 334, 313, 2435, 29898, 2467, 29897, 847, 7431, 29898, 1311, 29889, 4738, 4097, 876, 13, 29937, 13, 29937, 9651, 396, 5953, 837, 457, 278, 3438, 472, 5225, 1962, 29889, 13, 29937, 9651, 565, 15276, 9026, 520, 3195, 1275, 349, 5607, 29979, 29940, 6488, 25758, 29901, 13, 29937, 18884, 3438, 3782, 5896, 353, 15276, 9026, 520, 14352, 29896, 29962, 13, 29937, 9651, 1683, 29901, 13, 29937, 18884, 3438, 3782, 5896, 353, 29871, 29900, 29889, 29900, 13, 29937, 13, 29937, 9651, 396, 4910, 680, 278, 364, 630, 13284, 18018, 4249, 278, 16688, 29914, 29890, 4841, 29889, 13, 29937, 9651, 565, 330, 29889, 275, 29918, 1359, 29901, 13, 29937, 18884, 3855, 1017, 353, 364, 630, 29925, 8140, 847, 1583, 29889, 1949, 6880, 29890, 4841, 13, 29937, 9651, 1683, 29901, 13, 29937, 18884, 3855, 1017, 353, 364, 630, 29925, 7976, 847, 1583, 29889, 1949, 6880, 29890, 4841, 13, 29937, 13, 29937, 9651, 396, 3617, 278, 15276, 979, 3438, 310, 14655, 472, 445, 1962, 29889, 13, 2277, 9651, 274, 353, 330, 29889, 7827, 29918, 18253, 29898, 4260, 29984, 1017, 29892, 15276, 979, 9026, 520, 29892, 15276, 979, 9026, 520, 3195, 29897, 13, 29937, 13, 29937, 9651, 2025, 29984, 1017, 353, 29871, 29900, 29889, 29900, 13, 29937, 9651, 363, 432, 297, 3464, 29898, 1311, 29889, 1949, 6880, 29890, 4841, 1125, 13, 29937, 18884, 396, 17026, 278, 3001, 14728, 12520, 29914, 23883, 363, 491, 278, 15299, 29889, 13, 29937, 18884, 2025, 29984, 1017, 4619, 3855, 1017, 13, 29937, 13, 29937, 18884, 396, 450, 2791, 14340, 526, 13299, 28524, 304, 9801, 3438, 740, 18635, 537, 29889, 13, 29937, 18884, 14690, 353, 2533, 29898, 2467, 29961, 29895, 29901, 29895, 718, 432, 718, 29871, 29896, 2314, 13, 29937, 13, 29937, 18884, 396, 11649, 979, 3438, 29889, 13, 29937, 18884, 565, 15276, 9026, 520, 3195, 1275, 349, 5607, 29979, 29940, 6488, 25758, 29901, 13, 29937, 462, 1678, 7477, 1191, 353, 15680, 791, 29898, 22678, 672, 29898, 29885, 1191, 9026, 520, 511, 2025, 29984, 1017, 29897, 13, 29937, 18884, 25342, 15276, 9026, 520, 3195, 1275, 349, 29956, 29918, 18521, 1718, 29901, 13, 29937, 462, 1678, 302, 29918, 10199, 1860, 353, 7431, 29898, 29885, 1191, 9026, 520, 29897, 448, 29871, 29896, 13, 29937, 462, 1678, 363, 474, 297, 3464, 29898, 29876, 29918, 10199, 1860, 1125, 13, 29937, 462, 4706, 921, 29896, 29892, 343, 29896, 353, 15276, 9026, 520, 29961, 29875, 29962, 13, 29937, 462, 4706, 921, 29906, 29892, 343, 29906, 353, 15276, 9026, 520, 29961, 29875, 718, 29871, 29896, 29962, 13, 29937, 462, 4706, 565, 921, 29896, 5277, 2025, 29984, 1017, 5277, 921, 29906, 29901, 13, 29937, 462, 9651, 7477, 1191, 353, 313, 29891, 29906, 448, 343, 29896, 29897, 847, 313, 29916, 29906, 448, 921, 29896, 29897, 13, 29937, 462, 1678, 1683, 29901, 13, 29937, 462, 4706, 12020, 7865, 2392, 29892, 376, 13919, 21000, 14728, 518, 29995, 29888, 29962, 1213, 1273, 2025, 29984, 1017, 13, 29937, 18884, 1683, 29901, 13, 29937, 462, 1678, 12020, 7865, 2392, 13, 29937, 13, 29937, 18884, 396, 4485, 786, 278, 15276, 979, 3438, 310, 278, 15299, 29889, 13, 29937, 18884, 565, 451, 330, 29889, 275, 29918, 1359, 29901, 13, 29937, 462, 1678, 544, 29883, 353, 7477, 1191, 334, 5135, 29896, 29900, 29900, 29889, 29900, 718, 14690, 29897, 847, 29871, 29896, 29900, 29900, 29889, 29900, 29897, 13, 29937, 18884, 1683, 29901, 13, 29937, 462, 1678, 544, 29883, 353, 7477, 1191, 334, 5135, 29896, 29900, 29900, 29889, 29900, 718, 14690, 29897, 847, 29871, 29896, 29900, 29900, 29889, 29900, 29897, 13, 29937, 13, 29937, 18884, 565, 451, 330, 29889, 275, 29918, 1359, 29901, 13, 29937, 462, 1678, 5957, 353, 4587, 571, 29898, 29887, 29892, 3855, 1017, 29892, 544, 29883, 29892, 3438, 3782, 5896, 29897, 13, 29937, 462, 1678, 1583, 29889, 28549, 29889, 2696, 414, 29889, 4397, 29898, 974, 571, 29897, 13, 29937, 13, 29937, 462, 1678, 1583, 3032, 4230, 4276, 29889, 4397, 29898, 974, 571, 29897, 13, 29937, 13, 29937, 462, 1678, 17927, 29889, 3888, 11702, 29889, 29906, 29888, 25365, 12520, 472, 18695, 29906, 29888, 29938, 29914, 29924, 8809, 363, 1273, 29879, 313, 15543, 29896, 29888, 7686, 467, 29908, 13, 29937, 462, 4706, 1273, 313, 29939, 1017, 29892, 544, 29883, 29892, 330, 29889, 978, 29892, 14690, 876, 13, 29937, 18884, 1683, 29901, 13, 29937, 462, 1678, 21000, 353, 350, 333, 29898, 29887, 29892, 448, 29939, 1017, 29892, 544, 29883, 29892, 3438, 3782, 5896, 29897, 13, 29937, 462, 1678, 1583, 29889, 28549, 29889, 29890, 4841, 29889, 4397, 29898, 23883, 29897, 13, 29937, 13, 29937, 462, 1678, 1583, 3032, 4230, 4276, 29889, 4397, 29898, 23883, 29897, 13, 29937, 13, 29937, 462, 1678, 17927, 29889, 3888, 11702, 29889, 29906, 29888, 29938, 29914, 29924, 8809, 21000, 363, 18695, 29906, 29888, 25365, 363, 1273, 29879, 313, 15543, 29896, 29888, 7686, 467, 29908, 13, 29937, 462, 4706, 1273, 313, 558, 29883, 29892, 448, 29939, 1017, 29892, 330, 29889, 978, 29892, 14690, 876, 13, 29937, 13, 29937, 4706, 736, 1583, 3032, 4230, 4276, 13, 13, 29937, 382, 9800, 448, 2683, 2683, 2683, 2683, 1378, 13, 2 ]
sphinx-sources/Examples/ComputerPrac/FresnelPlane.py
jccmak/lightpipes
132
26893
#!/usr/bin/env python """ Computer practical 6.1. Fresnel diffraction, plane wavefront. ============================================================= This is part of the 'computer practical' set of assignments. Demonstrates Fresnel diffraction when a plane wavefront enters a round hole. Measure the values of z and d for which minima and/or maxima on-axis occur and apply the Fresnel-zone theory to find the wavelength of the light. """ import matplotlib matplotlib.use("TkAgg") from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import matplotlib.pyplot as plt import sys import webbrowser if sys.version_info[0] < 3: from Tkinter import * import Tkinter as Tk else: from tkinter import * import tkinter as Tk from LightPipes import * root = Tk.Tk() root.wm_title("Computer practical: 6.1 Fresnel plane wavefront. LP-version = " + LPversion) root.wm_protocol("WM_DELETE_WINDOW", root.quit) wavelength=530*nm; size=5*mm; N=200; N2=int(N/2) z=20*cm R=0.5*mm D=DoubleVar() Z=DoubleVar() D.set(2*R/mm) Z.set(z/cm) fig=plt.figure(figsize=(8,8)) ax1 = fig.add_subplot(111) canvas = FigureCanvasTkAgg(fig, master=root) canvas._tkcanvas.pack(side=Tk.LEFT, fill=Tk.BOTH, expand=1) v=StringVar() def TheExample(event): global I F=Begin(size,wavelength,N) z=Z.get()*cm R=D.get()/2*mm F=CircAperture(R,0,0,F) FN=R*R/z/wavelength if (FN >= 15.0): F=Forvard(z,F) else: F=Fresnel(z,F) I=Intensity(0,F) ax1.clear() ax1.contourf(I,50,cmap='hot'); ax1.axis('off'); ax1.axis('equal') str='Intensity distribution\ncenter-irradiance = %3.3f [a.u.]' %I[N2][N2] ax1.set_title(str) canvas.draw() def motion(event): x=event.xdata;y=event.ydata if (x and y is not None and x>0 and x<N and y>0 and y<N): v.set('x=%3.2f mm, y=%3.2f mm\n I=%3.3f [a.u.]' %((-size/2+x*size/N)/mm,(-size/2+y*size/N)/mm,I[int(x)][int(y)])) root.configure(cursor='crosshair') else: v.set('') root.configure(cursor='arrow') def openbrowser(event): webbrowser.open_new(r"https://opticspy.github.io/lightpipes/FresnelDiffraction.html") def _quit(): root.quit() Scale( root, takefocus = 1, orient='horizontal', label = 'diameter aperture [mm]', length = 200, from_=0.5, to=size/2/mm, resolution = 0.001, variable = D, cursor="hand2", command = TheExample).pack() Scale( root, takefocus = 1, orient='horizontal', label = 'z [cm]', length = 200, from_=0.01, to=200.0, resolution = 0.01, variable = Z, cursor="hand2", command = TheExample).pack() Button( root, width = 24, text='Quit', cursor="hand2", command=_quit).pack(pady=10) link = Label(root, text="help", fg="blue", cursor="hand2") link.pack() link.bind("<Button-1>", openbrowser) Label(root, textvariable=v).pack(pady=50) cid = fig.canvas.mpl_connect('motion_notify_event', motion) TheExample(0) root.mainloop() root.destroy()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 1678, 20972, 15031, 29871, 29953, 29889, 29896, 29889, 383, 690, 9139, 2923, 13857, 29892, 10694, 10742, 8862, 29889, 13, 1678, 1275, 9166, 9166, 9166, 4936, 25512, 13, 13, 1678, 910, 338, 760, 310, 278, 525, 12097, 261, 15031, 29915, 731, 310, 3566, 1860, 29889, 13, 1678, 4432, 265, 710, 1078, 383, 690, 9139, 2923, 13857, 746, 263, 10694, 10742, 8862, 24395, 29871, 13, 1678, 263, 4513, 16188, 29889, 13, 1678, 2191, 3745, 278, 1819, 310, 503, 322, 270, 363, 607, 1375, 2946, 322, 29914, 272, 5256, 29874, 373, 29899, 8990, 6403, 13, 1678, 322, 3394, 278, 383, 690, 9139, 29899, 8028, 6368, 304, 1284, 278, 281, 6447, 1477, 310, 278, 3578, 29889, 13, 15945, 29908, 13, 5215, 22889, 13, 2922, 17357, 29889, 1509, 703, 29911, 29895, 29909, 1505, 1159, 13, 3166, 22889, 29889, 1627, 1975, 29889, 27852, 29918, 11178, 16170, 1053, 11479, 21960, 29911, 29895, 29909, 1505, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 10876, 13, 5215, 591, 1327, 8777, 13, 13, 361, 10876, 29889, 3259, 29918, 3888, 29961, 29900, 29962, 529, 29871, 29941, 29901, 13, 1678, 515, 323, 29895, 1639, 1053, 334, 13, 1678, 1053, 323, 29895, 1639, 408, 323, 29895, 13, 2870, 29901, 13, 1678, 515, 18883, 1639, 1053, 334, 13, 1678, 1053, 18883, 1639, 408, 323, 29895, 13, 3166, 12790, 29925, 29488, 1053, 334, 13, 13, 4632, 353, 323, 29895, 29889, 29911, 29895, 580, 13, 13, 4632, 29889, 29893, 29885, 29918, 3257, 703, 20606, 261, 15031, 29901, 29871, 29953, 29889, 29896, 383, 690, 9139, 10694, 10742, 8862, 29889, 4706, 23671, 29899, 3259, 353, 376, 718, 23671, 3259, 29897, 13, 4632, 29889, 29893, 29885, 29918, 20464, 703, 26735, 29918, 2287, 18476, 29918, 25152, 3970, 29956, 613, 3876, 29889, 28358, 29897, 13, 13, 29893, 6447, 1477, 29922, 29945, 29941, 29900, 29930, 22882, 29936, 13, 2311, 29922, 29945, 29930, 4317, 29936, 13, 29940, 29922, 29906, 29900, 29900, 29936, 405, 29906, 29922, 524, 29898, 29940, 29914, 29906, 29897, 13, 13, 29920, 29922, 29906, 29900, 29930, 4912, 13, 29934, 29922, 29900, 29889, 29945, 29930, 4317, 13, 29928, 29922, 11843, 9037, 580, 13, 29999, 29922, 11843, 9037, 580, 13, 29928, 29889, 842, 29898, 29906, 29930, 29934, 29914, 4317, 29897, 13, 29999, 29889, 842, 29898, 29920, 29914, 4912, 29897, 13, 13, 1003, 29922, 572, 29873, 29889, 4532, 29898, 1003, 2311, 7607, 29947, 29892, 29947, 876, 13, 1165, 29896, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29896, 29896, 29897, 13, 13, 15257, 353, 11479, 21960, 29911, 29895, 29909, 1505, 29898, 1003, 29892, 5835, 29922, 4632, 29897, 13, 15257, 3032, 11178, 15257, 29889, 4058, 29898, 2975, 29922, 29911, 29895, 29889, 28024, 29892, 5445, 29922, 29911, 29895, 29889, 29933, 2891, 29950, 29892, 7985, 29922, 29896, 29897, 13, 29894, 29922, 1231, 9037, 580, 13, 13, 1753, 450, 14023, 29898, 3696, 1125, 13, 1678, 5534, 306, 13, 1678, 383, 29922, 17946, 29898, 2311, 29892, 29893, 6447, 1477, 29892, 29940, 29897, 13, 1678, 503, 29922, 29999, 29889, 657, 580, 29930, 4912, 13, 1678, 390, 29922, 29928, 29889, 657, 580, 29914, 29906, 29930, 4317, 13, 1678, 383, 29922, 23495, 29909, 10700, 545, 29898, 29934, 29892, 29900, 29892, 29900, 29892, 29943, 29897, 13, 1678, 383, 29940, 29922, 29934, 29930, 29934, 29914, 29920, 29914, 29893, 6447, 1477, 13, 1678, 565, 313, 29943, 29940, 6736, 29871, 29896, 29945, 29889, 29900, 1125, 13, 4706, 383, 29922, 2831, 16927, 29898, 29920, 29892, 29943, 29897, 13, 1678, 1683, 29901, 13, 4706, 383, 29922, 29943, 690, 9139, 29898, 29920, 29892, 29943, 29897, 13, 1678, 306, 29922, 2928, 575, 537, 29898, 29900, 29892, 29943, 29897, 13, 1678, 4853, 29896, 29889, 8551, 580, 13, 1678, 4853, 29896, 29889, 1285, 473, 29888, 29898, 29902, 29892, 29945, 29900, 29892, 29883, 1958, 2433, 8711, 2157, 4853, 29896, 29889, 8990, 877, 2696, 2157, 4853, 29896, 29889, 8990, 877, 11745, 1495, 13, 1678, 851, 2433, 2928, 575, 537, 4978, 29905, 29876, 5064, 29899, 381, 3665, 8837, 353, 1273, 29941, 29889, 29941, 29888, 518, 29874, 29889, 29884, 5586, 29915, 1273, 29902, 29961, 29940, 29906, 3816, 29940, 29906, 29962, 13, 1678, 4853, 29896, 29889, 842, 29918, 3257, 29898, 710, 29897, 29871, 13, 1678, 10508, 29889, 4012, 580, 13, 13, 1753, 10884, 29898, 3696, 1125, 13, 1678, 921, 29922, 3696, 29889, 29916, 1272, 29936, 29891, 29922, 3696, 29889, 29891, 1272, 13, 1678, 565, 313, 29916, 322, 343, 338, 451, 6213, 322, 921, 29958, 29900, 322, 921, 29966, 29940, 322, 343, 29958, 29900, 322, 343, 29966, 29940, 1125, 13, 4706, 325, 29889, 842, 877, 29916, 16328, 29941, 29889, 29906, 29888, 5654, 29892, 343, 16328, 29941, 29889, 29906, 29888, 5654, 29905, 29876, 306, 16328, 29941, 29889, 29941, 29888, 518, 29874, 29889, 29884, 5586, 29915, 1273, 3552, 29899, 2311, 29914, 29906, 29974, 29916, 29930, 2311, 29914, 29940, 6802, 4317, 29892, 6278, 2311, 29914, 29906, 29974, 29891, 29930, 2311, 29914, 29940, 6802, 4317, 29892, 29902, 29961, 524, 29898, 29916, 29897, 3816, 524, 29898, 29891, 4638, 876, 13, 4706, 3876, 29889, 17591, 29898, 18127, 2433, 29883, 1883, 845, 1466, 1495, 13, 1678, 1683, 29901, 13, 4706, 325, 29889, 842, 877, 1495, 13, 4706, 3876, 29889, 17591, 29898, 18127, 2433, 2936, 1495, 13, 13, 1753, 1722, 15965, 29898, 3696, 1125, 13, 1678, 591, 1327, 8777, 29889, 3150, 29918, 1482, 29898, 29878, 29908, 991, 597, 3670, 293, 1028, 29891, 29889, 3292, 29889, 601, 29914, 4366, 13096, 267, 29914, 29943, 690, 9139, 26023, 13857, 29889, 1420, 1159, 13, 13, 1753, 903, 28358, 7295, 13, 1678, 3876, 29889, 28358, 580, 13, 13, 17185, 29898, 29871, 3876, 29892, 13, 4706, 2125, 18037, 353, 29871, 29896, 29892, 13, 4706, 7769, 2433, 22672, 742, 13, 4706, 3858, 353, 525, 29881, 2829, 1308, 263, 10700, 545, 518, 4317, 29962, 742, 13, 4706, 3309, 353, 29871, 29906, 29900, 29900, 29892, 515, 29918, 29922, 29900, 29889, 29945, 29892, 304, 29922, 2311, 29914, 29906, 29914, 4317, 29892, 13, 4706, 10104, 353, 29871, 29900, 29889, 29900, 29900, 29896, 29892, 13, 4706, 2286, 353, 360, 29892, 13, 4706, 10677, 543, 3179, 29906, 613, 13, 4706, 1899, 353, 450, 14023, 467, 4058, 580, 13, 13, 17185, 29898, 29871, 3876, 29892, 13, 4706, 2125, 18037, 353, 29871, 29896, 29892, 13, 4706, 7769, 2433, 22672, 742, 13, 4706, 3858, 353, 525, 29920, 518, 4912, 29962, 742, 13, 4706, 3309, 353, 29871, 29906, 29900, 29900, 29892, 13, 4706, 515, 29918, 29922, 29900, 29889, 29900, 29896, 29892, 304, 29922, 29906, 29900, 29900, 29889, 29900, 29892, 13, 4706, 10104, 353, 29871, 29900, 29889, 29900, 29896, 29892, 13, 4706, 2286, 353, 796, 29892, 13, 4706, 10677, 543, 3179, 29906, 613, 13, 4706, 1899, 353, 450, 14023, 467, 4058, 580, 13, 13, 3125, 29898, 3876, 29892, 13, 4706, 2920, 353, 29871, 29906, 29946, 29892, 13, 4706, 1426, 2433, 2182, 277, 742, 13, 4706, 10677, 543, 3179, 29906, 613, 13, 4706, 1899, 29922, 29918, 28358, 467, 4058, 29898, 29886, 3714, 29922, 29896, 29900, 29897, 13, 13, 2324, 353, 15796, 29898, 4632, 29892, 1426, 543, 8477, 613, 285, 29887, 543, 9539, 613, 10677, 543, 3179, 29906, 1159, 13, 2324, 29889, 4058, 580, 13, 2324, 29889, 5355, 28945, 3125, 29899, 29896, 28341, 1722, 15965, 29897, 13, 13, 4775, 29898, 4632, 29892, 1426, 11918, 29922, 29894, 467, 4058, 29898, 29886, 3714, 29922, 29945, 29900, 29897, 13, 13, 25232, 353, 2537, 29889, 15257, 29889, 29885, 572, 29918, 6915, 877, 29885, 8194, 29918, 25140, 29918, 3696, 742, 10884, 29897, 13, 13, 1576, 14023, 29898, 29900, 29897, 13, 4632, 29889, 3396, 7888, 580, 13, 4632, 29889, 20524, 580, 13, 13, 2 ]
pyffs/automaton_management/__init__.py
rominf/pyffs
21
82724
<reponame>rominf/pyffs from .automaton_manager import manager from .utils import generate_automaton_to_file
[ 1, 529, 276, 1112, 420, 29958, 456, 7192, 29914, 2272, 600, 29879, 13, 3166, 869, 17405, 14114, 29918, 12847, 1053, 8455, 13, 3166, 869, 13239, 1053, 5706, 29918, 17405, 14114, 29918, 517, 29918, 1445, 13, 2 ]
py2cytoscape/cyrest/apps.py
g-simmons2/py2cytoscape
97
117889
from .base import * class apps(object): """ cytoscape session interface as shown in CyREST's swagger documentation. :param url: an url of the type 'http://' + host + ':' + str(port) + '/' + version + '/'. """ def __init__(self, url): self.__url = url + 'commands/apps' self.___url=url def getAppList(self, verbose=None): """ Returns installed Cytoscape Apps that have CyREST accessible Functions or Commands, as a list of App names. :param verbose: print more :returns: 200: successful operation """ response=api(url=self.___url+'apps', method="H", verbose=verbose, parse_params=False) return response
[ 1, 515, 869, 3188, 1053, 334, 13, 13, 1990, 11446, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 274, 3637, 359, 5738, 4867, 5067, 408, 4318, 297, 8045, 1525, 1254, 29915, 29879, 2381, 9921, 5106, 29889, 13, 13, 1678, 584, 3207, 3142, 29901, 385, 3142, 310, 278, 1134, 525, 1124, 597, 29915, 718, 3495, 718, 525, 11283, 718, 851, 29898, 637, 29897, 718, 8207, 29915, 718, 1873, 718, 8207, 4286, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3142, 1125, 13, 4706, 1583, 17255, 2271, 353, 3142, 718, 525, 26381, 29914, 13371, 29915, 13, 4706, 1583, 17255, 29918, 2271, 29922, 2271, 13, 13, 1678, 822, 679, 2052, 1293, 29898, 1311, 29892, 26952, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 16969, 5130, 315, 3637, 359, 5738, 2401, 29879, 393, 505, 8045, 1525, 1254, 15579, 6680, 29879, 470, 1876, 4167, 29892, 408, 263, 1051, 310, 2401, 2983, 29889, 13, 13, 4706, 584, 3207, 26952, 29901, 1596, 901, 13, 13, 4706, 584, 18280, 29901, 29871, 29906, 29900, 29900, 29901, 9150, 5858, 13, 4706, 9995, 13, 13, 4706, 2933, 29922, 2754, 29898, 2271, 29922, 1311, 17255, 29918, 2271, 23097, 13371, 742, 1158, 543, 29950, 613, 26952, 29922, 369, 15828, 29892, 6088, 29918, 7529, 29922, 8824, 29897, 13, 4706, 736, 2933, 2 ]
monk/tf_keras_1/finetune/level_11_optimizers_main.py
Sanskar329/monk_v1
7
31468
from tf_keras_1.finetune.imports import * from system.imports import * from tf_keras_1.finetune.level_10_schedulers_main import prototype_schedulers class prototype_optimizers(prototype_schedulers): ''' Main class for all optimizers in expert mode Args: verbose (int): Set verbosity levels 0 - Print Nothing 1 - Print desired details ''' @accepts("self", verbose=int, post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def __init__(self, verbose=1): super().__init__(verbose=verbose); ############################################################################################################################################### @warning_checks(None, ["lt", 1], momentum=["lt", 1.5], weight_decay=["lt", 0.01], momentum_dampening_rate=None, clipnorm=None, clipvalue=None, post_trace=False) @error_checks(None, ["gt", 0], momentum=["gte", 0], weight_decay=["gte", 0], momentum_dampening_rate=None, clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], momentum=[int, float], weight_decay=[int, float], momentum_dampening_rate=[int, float], clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_sgd(self, learning_rate, momentum=0, weight_decay=0, momentum_dampening_rate=0, clipnorm=0.0, clipvalue=0.0): ''' Select stochastic gradient descent optimizer Args: learning_rate (float): Initial base learning rate momentum (float): Momentum value for driving the weights towards minima weight_decay (float): Value for regularizing weights post every update momentum_dampening_rate (float): Reduction rate for momentum clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = sgd(self.system_dict, learning_rate, momentum=momentum, weight_decay=weight_decay, momentum_dampening_rate=momentum_dampening_rate, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("ArgumentWarning: clipnorm and clipvalue are active only for keras in current version of Monk"); self.custom_print(""); ConstraintWarning("ArgumentWarning: momentum_dampening_rate is active only for pytorch in current version of Monk"); self.custom_print(""); ############################################################################################################################################### ############################################################################################################################################### @warning_checks(None, ["lt", 1], momentum=["lt", 1.5], weight_decay=["lt", 0.01], momentum_dampening_rate=None, clipnorm=None, clipvalue=None, post_trace=False) @error_checks(None, ["gt", 0], momentum=["gte", 0], weight_decay=["gte", 0], momentum_dampening_rate=None, clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], momentum=[int, float], weight_decay=[int, float], momentum_dampening_rate=[int, float], clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_nesterov_sgd(self, learning_rate, momentum=0, weight_decay=0, momentum_dampening_rate=0, clipnorm=0.0, clipvalue=0.0): ''' Select stochastic gradient descent optimizer with nesterov acceleration Args: learning_rate (float): Initial base learning rate momentum (float): Momentum value for driving the weights towards minima weight_decay (float): Value for regularizing weights post every update momentum_dampening_rate (float): Reduction rate for momentum clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = nesterov_sgd(self.system_dict, learning_rate, momentum=momentum, weight_decay=weight_decay, momentum_dampening_rate=momentum_dampening_rate, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("ArgumentWarning: clipnorm and clipvalue are active only for keras in current version of Monk"); self.custom_print(""); ConstraintWarning("ArgumentWarning: momentum_dampening_rate is active only for pytorch in current version of Monk"); self.custom_print(""); ############################################################################################################################################### ############################################################################################################################################### @warning_checks(None, ["lt", 1], decay_rate=["lt", 1], epsilon=["lt", 0.001], weight_decay=["lt", 0.01], clipnorm=None, clipvalue=None, post_trace=None) @error_checks(None, ["gt", 0], decay_rate=["gt", 0], epsilon=["gte", 0], weight_decay=["gte", 0], clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], decay_rate=[int, float], epsilon=[int, float], weight_decay=[int, float], clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_rmsprop(self, learning_rate, decay_rate=0.99, epsilon=1e-08, weight_decay=0, clipnorm=0.0, clipvalue=0.0): ''' Select root mean score prop optimizer Args: learning_rate (float): Initial base learning rate decay_rate (float): A decay factor of moving average over past squared gradient. epsilon (float): A value to avoid division by zero weight_decay (float): Value for regularizing weights post every update clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = rmsprop(self.system_dict , learning_rate, decay_rate=decay_rate, epsilon=epsilon, weight_decay=weight_decay, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("ArgumentWarning: clipnorm and clipvalue are active only for keras in current version of Monk"); self.custom_print(""); ############################################################################################################################################### ############################################################################################################################################### @warning_checks(None, ["lt, 1"], beta1=["lt", 1], beta2=["lt", 1], epsilon=["lt", 0.001], weight_decay=["lt", 0.01], amsgrad=None, clipnorm=None, clipvalue=None, post_trace=False) @error_checks(None, ["gt", 0], beta1=["gte", 0], beta2=["gte", 0], epssilon=["gte", 0], weight_decay=["gte", 0], amsgrad=None, clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], beta1=[int, float], beta2=[int, float], epsilon=[int, float], weight_decay=[int, float], amsgrad=bool, clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_adam(self, learning_rate, beta1=0.9, beta2=0.999, epsilon=1e-08, weight_decay=0, amsgrad=False, clipnorm=0.0, clipvalue=0.0): ''' Select ADAM optimizer Args: learning_rate (float): Initial base learning rate beta1 (float): Exponential decay rate for first momentum estimates beta2 (float): Exponential decay rate for first second estimates weight_decay (float): Value for regularizing weights post every update amsgrad (bool): If True, AMSGrad variant of this algorithm is used epsilon (float): A value to avoid division by zero clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = adam(self.system_dict, learning_rate, beta1=beta1, beta2=beta2, epsilon=epsilon, weight_decay=weight_decay, amsgrad=amsgrad, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("ArgumentWarning: clipnorm and clipvalue are active only for keras in current version of Monk"); self.custom_print(""); ConstraintWarning("ArgumentWarning: amsgrad is active only for keras and pytorch in current version of Monk"); self.custom_print(""); ############################################################################################################################################### ############################################################################################################################################### @warning_checks(None, ["lt, 1"], beta1=["lt", 1], beta2=["lt", 1], epsilon=["lt", 0.001], weight_decay=["lt", 0.01], amsgrad=None, momentum_decay=None, clipnorm=None, clipvalue=None, post_trace=False) @error_checks(None, ["gt", 0], beta1=["gte", 0], beta2=["gte", 0], epssilon=["gte", 0], weight_decay=["gte", 0], amsgrad=None, momentum_decay=None, clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], beta1=[int, float], beta2=[int, float], epsilon=[int, float], weight_decay=[int, float], amsgrad=bool, momentum_decay=[int, float], clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_nesterov_adam(self, learning_rate, beta1=0.9, beta2=0.999, epsilon=1e-08, weight_decay=0, amsgrad=False, momentum_decay=0.004, clipnorm=0.0, clipvalue=0.0): ''' Select ADAM optimizer with nesterov momentum acceleration Args: learning_rate (float): Initial base learning rate beta1 (float): Exponential decay rate for first momentum estimates beta2 (float): Exponential decay rate for first second estimates weight_decay (float): Value for regularizing weights post every update amsgrad (bool): If True, AMSGrad variant of this algorithm is used epsilon (float): A value to avoid division by zero clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = nesterov_adam(self.system_dict, learning_rate, beta1=beta1, beta2=beta2, epsilon=epsilon, weight_decay=weight_decay, amsgrad=amsgrad, momentum_decay=momentum_decay, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("OptimizerWarning: nesterov adam is active only for keras and gluon in current version of Monk"); self.custom_print(""); ConstraintWarning("ArgumentWarning: amsgrad is inactive in current version of Monk"); self.custom_print(""); ############################################################################################################################################### ############################################################################################################################################### @warning_checks(None, ["lt", 1], beta1=["lt", 1], beta2=["lt", 1], epsilon=["lt", 0.001], weight_decay=["lt", 0.01], clipnorm=None, clipvalue=None, post_trace=False) @error_checks(None, ["gt", 0], beta1=["gte", 0], beta2=["gte", 0], epsilon=["gte", 0], weight_decay=["gte", 0], clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], beta1=[int, float], beta2=[int, float], epsilon=[int, float], weight_decay=[int, float], clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_adamax(self, learning_rate, beta1=0.9, beta2=0.999, epsilon=1e-08, weight_decay=0, clipnorm=0.0, clipvalue=0.0): ''' Select Adamax optimizer Args: learning_rate (float): Initial base learning rate beta1 (float): Exponential decay rate for first momentum estimates beta2 (float): Exponential decay rate for first second estimates weight_decay (float): Value for regularizing weights post every update epsilon (float): A value to avoid division by zero clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = adamax(self.system_dict, learning_rate, beta1=beta1, beta2=beta2, epsilon=epsilon, weight_decay=weight_decay, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("ArgumentWarning: clipnorm and clipvalue are active only for keras in current version of Monk"); self.custom_print(""); ############################################################################################################################################### ############################################################################################################################################### @warning_checks(None, ["lt", 1], rho=["lt", 1], epsilon=["lt", 0.001], weight_decay=["lt", 0.01], clipnorm=None, clipvalue=None, post_trace=False) @error_checks(None, ["gt", 0], rho=["gt", 0], epsilon=["gte", 0], weight_decay=["gte", 0], clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], rho=[int, float], epsilon=[int, float], weight_decay=[int, float], clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_adadelta(self, learning_rate, rho=0.9, epsilon=1e-06, weight_decay=0, clipnorm=0.0, clipvalue=0.0): ''' Select Adadelta optimizer Args: learning_rate (float): Initial base learning rate rho (float): Exponential decay rate for momentum estimates weight_decay (float): Value for regularizing weights post every update epsilon (float): A value to avoid division by zero clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = adadelta(self.system_dict, learning_rate, rho=rho, epsilon=epsilon, weight_decay=weight_decay, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("ArgumentWarning: clipnorm and clipvalue are active only for keras in current version of Monk"); self.custom_print(""); ############################################################################################################################################### ############################################################################################################################################### @warning_checks(None, ["lt", 1], learning_rate_decay=None, weight_decay=["lt", 0.01], epsilon=None, clipnorm=None, clipvalue=None, post_trace=False) @error_checks(None, ["gt", 0], learning_rate_decay=None, weight_decay=["gte", 0], epsilon=None, clipnorm=None, clipvalue=None, post_trace=False) @accepts("self", [int, float], learning_rate_decay=[int, float], weight_decay=[int, float], epsilon=[int, float], clipnorm=[int, float], clipvalue=[int, float], post_trace=False) #@TraceFunction(trace_args=True, trace_rv=True) def optimizer_adagrad(self, learning_rate, learning_rate_decay=0, weight_decay=0, epsilon=1e-08, clipnorm=0.0, clipvalue=0.0): ''' Select Adagrad optimizer Args: learning_rate (float): Initial base learning rate learning_rate_decay (float): Learning rate decay factor weight_decay (float): Value for regularizing weights post every update epsilon (float): A value to avoid division by zero clipnorm (float): Gradient clipping factor clipvalue (float): Value for clipping Returns: None ''' self.system_dict = adagrad(self.system_dict, learning_rate, learning_rate_decay=learning_rate_decay, weight_decay=weight_decay, epsilon=epsilon, clipnorm=clipnorm, clipvalue=clipvalue); self.custom_print("Optimizer"); self.custom_print(" Name: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["name"])); self.custom_print(" Learning rate: {}".format(self.system_dict["hyper-parameters"]["learning_rate"])); self.custom_print(" Params: {}".format(self.system_dict["hyper-parameters"]["optimizer"]["params"])); self.custom_print(""); ConstraintWarning("ArgumentWarning: clipnorm and clipvalue are active only for keras in current version of Monk"); self.custom_print(""); ConstraintWarning("ArgumentWarning: learning_rate_decay is active only for pytorch in current version of Monk"); self.custom_print(""); ###############################################################################################################################################
[ 1, 515, 15886, 29918, 3946, 294, 29918, 29896, 29889, 4951, 300, 1540, 29889, 326, 4011, 1053, 334, 13, 3166, 1788, 29889, 326, 4011, 1053, 334, 13, 13, 3166, 15886, 29918, 3946, 294, 29918, 29896, 29889, 4951, 300, 1540, 29889, 5563, 29918, 29896, 29900, 29918, 816, 287, 352, 414, 29918, 3396, 1053, 22267, 29918, 816, 287, 352, 414, 13, 13, 13, 1990, 22267, 29918, 20640, 19427, 29898, 16309, 29918, 816, 287, 352, 414, 1125, 13, 1678, 14550, 13, 1678, 4241, 770, 363, 599, 5994, 19427, 297, 17924, 4464, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 26952, 313, 524, 1125, 3789, 9750, 359, 537, 11174, 13, 462, 308, 29900, 448, 13905, 9531, 13, 462, 308, 29896, 448, 13905, 7429, 4902, 13, 1678, 14550, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 26952, 29922, 524, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 26952, 29922, 29896, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 369, 15828, 29922, 369, 15828, 416, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 613, 29871, 29896, 1402, 19399, 29922, 3366, 1896, 613, 29871, 29896, 29889, 29945, 1402, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 19399, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 19399, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 11759, 524, 29892, 5785, 1402, 29871, 13, 4706, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 5311, 29881, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 19399, 29922, 29900, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 29900, 29892, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 380, 28225, 16030, 26815, 5994, 3950, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 19399, 313, 7411, 1125, 341, 2932, 398, 995, 363, 19500, 278, 18177, 7113, 1375, 2946, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 313, 7411, 1125, 4367, 29884, 428, 6554, 363, 19399, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 269, 29887, 29881, 29898, 1311, 29889, 5205, 29918, 8977, 29892, 6509, 29918, 10492, 29892, 29871, 13, 18884, 19399, 29922, 29885, 2932, 398, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 29885, 2932, 398, 29918, 29881, 1160, 8333, 29918, 10492, 29892, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 20102, 12324, 322, 20102, 1767, 526, 6136, 871, 363, 13023, 294, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 338, 6136, 871, 363, 282, 3637, 25350, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 613, 29871, 29896, 1402, 19399, 29922, 3366, 1896, 613, 29871, 29896, 29889, 29945, 1402, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 19399, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 19399, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 11759, 524, 29892, 5785, 1402, 29871, 13, 4706, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 29876, 4156, 586, 29918, 5311, 29881, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 19399, 29922, 29900, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 29900, 29892, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 380, 28225, 16030, 26815, 5994, 3950, 411, 302, 4156, 586, 28178, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 19399, 313, 7411, 1125, 341, 2932, 398, 995, 363, 19500, 278, 18177, 7113, 1375, 2946, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 313, 7411, 1125, 4367, 29884, 428, 6554, 363, 19399, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 302, 4156, 586, 29918, 5311, 29881, 29898, 1311, 29889, 5205, 29918, 8977, 29892, 6509, 29918, 10492, 29892, 29871, 13, 18884, 19399, 29922, 29885, 2932, 398, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 29922, 29885, 2932, 398, 29918, 29881, 1160, 8333, 29918, 10492, 29892, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 20102, 12324, 322, 20102, 1767, 526, 6136, 871, 363, 13023, 294, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 19399, 29918, 29881, 1160, 8333, 29918, 10492, 338, 6136, 871, 363, 282, 3637, 25350, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 613, 29871, 29896, 1402, 20228, 29918, 10492, 29922, 3366, 1896, 613, 29871, 29896, 1402, 321, 3232, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29900, 29896, 1402, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8516, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 20228, 29918, 10492, 29922, 3366, 4141, 613, 29871, 29900, 1402, 321, 3232, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 20228, 29918, 10492, 11759, 524, 29892, 5785, 1402, 321, 3232, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 29871, 13, 4706, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 29878, 1516, 7728, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 20228, 29918, 10492, 29922, 29900, 29889, 29929, 29929, 29892, 321, 3232, 29922, 29896, 29872, 29899, 29900, 29947, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 3876, 2099, 8158, 3107, 5994, 3950, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 20228, 29918, 10492, 313, 7411, 1125, 319, 20228, 7329, 310, 8401, 6588, 975, 4940, 10674, 1965, 16030, 29889, 13, 9651, 321, 3232, 313, 7411, 1125, 319, 995, 304, 4772, 8542, 491, 5225, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 364, 1516, 7728, 29898, 1311, 29889, 5205, 29918, 8977, 1919, 6509, 29918, 10492, 29892, 29871, 13, 9651, 20228, 29918, 10492, 29922, 7099, 388, 29918, 10492, 29892, 321, 3232, 29922, 5463, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 20102, 12324, 322, 20102, 1767, 526, 6136, 871, 363, 13023, 294, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 29892, 29871, 29896, 12436, 21762, 29896, 29922, 3366, 1896, 613, 29871, 29896, 1402, 21762, 29906, 29922, 3366, 1896, 613, 29871, 29896, 1402, 321, 3232, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29900, 29896, 1402, 29871, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 626, 29879, 5105, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 21762, 29896, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 21762, 29906, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 321, 567, 29879, 3130, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 626, 29879, 5105, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 21762, 29896, 11759, 524, 29892, 5785, 1402, 21762, 29906, 11759, 524, 29892, 5785, 1402, 321, 3232, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 626, 29879, 5105, 29922, 11227, 29892, 29871, 13, 4706, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 328, 314, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 21762, 29896, 29922, 29900, 29889, 29929, 29892, 21762, 29906, 29922, 29900, 29889, 29929, 29929, 29929, 29892, 321, 3232, 29922, 29896, 29872, 29899, 29900, 29947, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 626, 29879, 5105, 29922, 8824, 29892, 29871, 13, 4706, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 11033, 5194, 5994, 3950, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 21762, 29896, 313, 7411, 1125, 1222, 1112, 2556, 20228, 6554, 363, 937, 19399, 21875, 13, 9651, 21762, 29906, 313, 7411, 1125, 1222, 1112, 2556, 20228, 6554, 363, 937, 1473, 21875, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 626, 29879, 5105, 313, 11227, 1125, 960, 5852, 29892, 319, 4345, 25584, 17305, 310, 445, 5687, 338, 1304, 13, 9651, 321, 3232, 313, 7411, 1125, 319, 995, 304, 4772, 8542, 491, 5225, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 594, 314, 29898, 1311, 29889, 5205, 29918, 8977, 29892, 6509, 29918, 10492, 29892, 13, 9651, 21762, 29896, 29922, 3571, 29896, 29892, 21762, 29906, 29922, 3571, 29906, 29892, 321, 3232, 29922, 5463, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 626, 29879, 5105, 29922, 2232, 5105, 29892, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 13, 308, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 20102, 12324, 322, 20102, 1767, 526, 6136, 871, 363, 13023, 294, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 626, 29879, 5105, 338, 6136, 871, 363, 13023, 294, 322, 282, 3637, 25350, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 29892, 29871, 29896, 12436, 21762, 29896, 29922, 3366, 1896, 613, 29871, 29896, 1402, 21762, 29906, 29922, 3366, 1896, 613, 29871, 29896, 1402, 321, 3232, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29900, 29896, 1402, 29871, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 626, 29879, 5105, 29922, 8516, 29892, 29871, 13, 4706, 19399, 29918, 7099, 388, 29922, 8516, 29892, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 21762, 29896, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 21762, 29906, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 321, 567, 29879, 3130, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 626, 29879, 5105, 29922, 8516, 29892, 29871, 13, 4706, 19399, 29918, 7099, 388, 29922, 8516, 29892, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 21762, 29896, 11759, 524, 29892, 5785, 1402, 21762, 29906, 11759, 524, 29892, 5785, 1402, 321, 3232, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 626, 29879, 5105, 29922, 11227, 29892, 29871, 13, 4706, 19399, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 29876, 4156, 586, 29918, 328, 314, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 21762, 29896, 29922, 29900, 29889, 29929, 29892, 21762, 29906, 29922, 29900, 29889, 29929, 29929, 29929, 29892, 321, 3232, 29922, 29896, 29872, 29899, 29900, 29947, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 626, 29879, 5105, 29922, 8824, 29892, 13, 4706, 19399, 29918, 7099, 388, 29922, 29900, 29889, 29900, 29900, 29946, 29892, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 11033, 5194, 5994, 3950, 411, 302, 4156, 586, 19399, 28178, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 21762, 29896, 313, 7411, 1125, 1222, 1112, 2556, 20228, 6554, 363, 937, 19399, 21875, 13, 9651, 21762, 29906, 313, 7411, 1125, 1222, 1112, 2556, 20228, 6554, 363, 937, 1473, 21875, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 626, 29879, 5105, 313, 11227, 1125, 960, 5852, 29892, 319, 4345, 25584, 17305, 310, 445, 5687, 338, 1304, 13, 9651, 321, 3232, 313, 7411, 1125, 319, 995, 304, 4772, 8542, 491, 5225, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 302, 4156, 586, 29918, 328, 314, 29898, 1311, 29889, 5205, 29918, 8977, 29892, 6509, 29918, 10492, 29892, 13, 9651, 21762, 29896, 29922, 3571, 29896, 29892, 21762, 29906, 29922, 3571, 29906, 29892, 321, 3232, 29922, 5463, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 626, 29879, 5105, 29922, 2232, 5105, 29892, 13, 9651, 19399, 29918, 7099, 388, 29922, 29885, 2932, 398, 29918, 7099, 388, 29892, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 13, 308, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 20624, 326, 3950, 22709, 29901, 302, 4156, 586, 594, 314, 338, 6136, 871, 363, 13023, 294, 322, 3144, 29884, 265, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 626, 29879, 5105, 338, 297, 4925, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 613, 29871, 29896, 1402, 21762, 29896, 29922, 3366, 1896, 613, 29871, 29896, 1402, 21762, 29906, 29922, 3366, 1896, 613, 29871, 29896, 1402, 321, 3232, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29900, 29896, 1402, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 21762, 29896, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 21762, 29906, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 321, 3232, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 21762, 29896, 11759, 524, 29892, 5785, 1402, 21762, 29906, 11759, 524, 29892, 5785, 1402, 321, 3232, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 29871, 13, 4706, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 328, 314, 1165, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 21762, 29896, 29922, 29900, 29889, 29929, 29892, 21762, 29906, 29922, 29900, 29889, 29929, 29929, 29929, 29892, 321, 3232, 29922, 29896, 29872, 29899, 29900, 29947, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 13, 4706, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 11783, 1165, 5994, 3950, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 21762, 29896, 313, 7411, 1125, 1222, 1112, 2556, 20228, 6554, 363, 937, 19399, 21875, 13, 9651, 21762, 29906, 313, 7411, 1125, 1222, 1112, 2556, 20228, 6554, 363, 937, 1473, 21875, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 321, 3232, 313, 7411, 1125, 319, 995, 304, 4772, 8542, 491, 5225, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 594, 314, 1165, 29898, 1311, 29889, 5205, 29918, 8977, 29892, 6509, 29918, 10492, 29892, 13, 9651, 21762, 29896, 29922, 3571, 29896, 29892, 21762, 29906, 29922, 3571, 29906, 29892, 321, 3232, 29922, 5463, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 259, 13, 308, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 20102, 12324, 322, 20102, 1767, 526, 6136, 871, 363, 13023, 294, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 613, 29871, 29896, 1402, 364, 1251, 29922, 3366, 1896, 613, 29871, 29896, 1402, 321, 3232, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29900, 29896, 1402, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 364, 1251, 29922, 3366, 4141, 613, 29871, 29900, 1402, 321, 3232, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 364, 1251, 11759, 524, 29892, 5785, 1402, 321, 3232, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 29871, 13, 4706, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 328, 328, 2554, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 364, 1251, 29922, 29900, 29889, 29929, 29892, 321, 3232, 29922, 29896, 29872, 29899, 29900, 29953, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 29871, 13, 4706, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 2087, 328, 2554, 5994, 3950, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 364, 1251, 313, 7411, 1125, 1222, 1112, 2556, 20228, 6554, 363, 19399, 21875, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 321, 3232, 313, 7411, 1125, 319, 995, 304, 4772, 8542, 491, 5225, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 594, 328, 2554, 29898, 1311, 29889, 5205, 29918, 8977, 29892, 6509, 29918, 10492, 29892, 13, 9651, 364, 1251, 29922, 4650, 29892, 321, 3232, 29922, 5463, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 13, 308, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 20102, 12324, 322, 20102, 1767, 526, 6136, 871, 363, 13023, 294, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 1678, 732, 27392, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 1896, 613, 29871, 29896, 1402, 6509, 29918, 10492, 29918, 7099, 388, 29922, 8516, 29892, 7688, 29918, 7099, 388, 29922, 3366, 1896, 613, 29871, 29900, 29889, 29900, 29896, 1402, 321, 3232, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 2704, 29918, 3198, 29879, 29898, 8516, 29892, 6796, 4141, 613, 29871, 29900, 1402, 6509, 29918, 10492, 29918, 7099, 388, 29922, 8516, 29892, 7688, 29918, 7099, 388, 29922, 3366, 29887, 371, 613, 29871, 29900, 1402, 321, 3232, 29922, 8516, 29892, 29871, 13, 4706, 20102, 12324, 29922, 8516, 29892, 20102, 1767, 29922, 8516, 29892, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 732, 16044, 29879, 703, 1311, 613, 518, 524, 29892, 5785, 1402, 6509, 29918, 10492, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 7688, 29918, 7099, 388, 11759, 524, 29892, 5785, 1402, 29871, 13, 4706, 321, 3232, 11759, 524, 29892, 5785, 1402, 20102, 12324, 11759, 524, 29892, 5785, 1402, 20102, 1767, 11759, 524, 29892, 5785, 1402, 1400, 29918, 15003, 29922, 8824, 29897, 13, 1678, 396, 29992, 11591, 6678, 29898, 15003, 29918, 5085, 29922, 5574, 29892, 9637, 29918, 15291, 29922, 5574, 29897, 13, 1678, 822, 5994, 3950, 29918, 328, 351, 3665, 29898, 1311, 29892, 6509, 29918, 10492, 29892, 6509, 29918, 10492, 29918, 7099, 388, 29922, 29900, 29892, 7688, 29918, 7099, 388, 29922, 29900, 29892, 321, 3232, 29922, 29896, 29872, 29899, 29900, 29947, 29892, 13, 4706, 20102, 12324, 29922, 29900, 29889, 29900, 29892, 20102, 1767, 29922, 29900, 29889, 29900, 1125, 13, 4706, 14550, 13, 4706, 7605, 2087, 351, 3665, 5994, 3950, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 6509, 29918, 10492, 313, 7411, 1125, 17250, 2967, 6509, 6554, 13, 9651, 6509, 29918, 10492, 29918, 7099, 388, 313, 7411, 1125, 29257, 6554, 20228, 7329, 13, 9651, 7688, 29918, 7099, 388, 313, 7411, 1125, 7865, 363, 4943, 5281, 18177, 1400, 1432, 2767, 13, 9651, 321, 3232, 313, 7411, 1125, 319, 995, 304, 4772, 8542, 491, 5225, 13, 9651, 20102, 12324, 313, 7411, 1125, 19295, 993, 9335, 3262, 7329, 13, 9651, 20102, 1767, 313, 7411, 1125, 7865, 363, 9335, 3262, 13, 13, 4706, 16969, 29901, 13, 9651, 6213, 13, 4706, 14550, 13, 4706, 1583, 29889, 5205, 29918, 8977, 353, 594, 351, 3665, 29898, 1311, 29889, 5205, 29918, 8977, 29892, 6509, 29918, 10492, 29892, 13, 9651, 6509, 29918, 10492, 29918, 7099, 388, 29922, 21891, 29918, 10492, 29918, 7099, 388, 29892, 7688, 29918, 7099, 388, 29922, 7915, 29918, 7099, 388, 29892, 321, 3232, 29922, 5463, 29892, 29871, 13, 9651, 20102, 12324, 29922, 24049, 12324, 29892, 20102, 1767, 29922, 24049, 1767, 416, 13, 308, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 20624, 326, 3950, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 4408, 29901, 3986, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 978, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 29257, 6554, 29901, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 21891, 29918, 10492, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1678, 1459, 2232, 29901, 4706, 6571, 1642, 4830, 29898, 1311, 29889, 5205, 29918, 8977, 3366, 24947, 29899, 16744, 3108, 3366, 20640, 3950, 3108, 3366, 7529, 20068, 416, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 20102, 12324, 322, 20102, 1767, 526, 6136, 871, 363, 13023, 294, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 4706, 1281, 4151, 524, 22709, 703, 15730, 22709, 29901, 6509, 29918, 10492, 29918, 7099, 388, 338, 6136, 871, 363, 282, 3637, 25350, 297, 1857, 1873, 310, 2598, 29895, 1496, 13, 4706, 1583, 29889, 6341, 29918, 2158, 703, 1496, 13, 1678, 835, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 2 ]
test/test_specs.py
USGS-EROS/lcmap-merlin
0
97071
from cytoolz import cons from cytoolz import merge from merlin import specs def test_only(): registry = [{'key': 1, 'ubid': 'a'}, {'key': 2, 'ubid': 'b'}, {'key': 3, 'ubid': 'c'}, {'key': 4, 'ubid': 'd'}] expected = tuple([{'key': 1, 'ubid': 'a'}, {'key': 4, 'ubid': 'd'}]) result = specs.only(ubids=['a', 'd'], specs=registry) assert expected == result expected = tuple([{'key': 1, 'ubid': 'a'}, {'key': 4, 'ubid': 'd'}]) result = specs.only(ubids=['d', 'a'], specs=registry) assert expected == result expected = tuple() result = specs.only(ubids=['z'], specs=registry) assert expected == result def test_mapped(): registry = [{'key': 1, 'ubid': 'a'}, {'key': 2, 'ubid': 'b'}, {'key': 3, 'ubid': 'c'}, {'key': 4, 'ubid': 'd'}] ubids = {'red': ['a', 'd'], 'blue': ['b', 'c']} expected = {'red': ({'key': 1, 'ubid': 'a'}, {'key': 4, 'ubid': 'd'}), 'blue': ({'key': 2, 'ubid': 'b'}, {'key': 3, 'ubid': 'c'})} result = specs.mapped(ubids=ubids, specs=registry) assert expected == result def test_exist(): registry = [{'key': 1, 'ubid': 'a'}, {'key': 2, 'ubid': 'b'}, {'key': 3, 'ubid': 'c'}, {'key': 4, 'ubid': 'd'}] ubids = ['a', 'd'] assert True==specs.exist(ubids=ubids, specs=registry) ubids = ['a', 'b', 'x'] assert False==specs.exist(ubids=ubids, specs=registry) def test_index(): registry = [{'key': 1, 'ubid': 'a'}, {'key': 2, 'ubid': 'b'}, {'key': 3, 'ubid': 'c'}, {'key': 4, 'ubid': 'd'}] results = specs.index(registry) # check that dicts were rekeyed into a new dict assert all(map(lambda r: r in results, ['a', 'b', 'c', 'd'])) # check structure of new dict values assert all(map(lambda r: 'ubid' in r and 'key' in r, results.values())) def test_ubids(): registry = [{'key': 1, 'ubid': 'a'}, {'key': 2, 'ubid': 'b'}, {'key': 3, 'ubid': 'c'}, {'key': 4, 'ubid': 'd'}] data = list(cons({'nope': 'z'}, registry)) good = filter(lambda f: 'ubid' in f, data) assert set(map(lambda u: u['ubid'], good)) == set(specs.ubids(data)) def test_ubids(): ubids = [{'ubid': 1}, {'ubid': 2}, {'ubid': 3}, {'ubid': 4}] assert len(specs.ubids(ubids)) == 4 def test_refspec(): specmap = {'red': [{'key': 1, 'ubid': 'a'}, {'key': 2, 'ubid': 'b'}], 'blue': [{'key': 3, 'ubid': 'c'}, {'key': 4, 'ubid': 'd'}]} assert type(specs.refspec(specmap)) is dict
[ 1, 515, 5094, 10154, 29920, 1053, 1136, 13, 3166, 5094, 10154, 29920, 1053, 10366, 13, 3166, 2778, 1915, 1053, 1580, 29879, 13, 13, 13, 1753, 1243, 29918, 6194, 7295, 13, 1678, 21235, 353, 518, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29906, 29892, 525, 431, 333, 2396, 525, 29890, 16675, 13, 18884, 11117, 1989, 2396, 29871, 29941, 29892, 525, 431, 333, 2396, 525, 29883, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 29915, 6525, 13, 13, 1678, 3806, 353, 18761, 4197, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 10827, 2314, 13, 1678, 1121, 259, 353, 1580, 29879, 29889, 6194, 29898, 431, 4841, 29922, 1839, 29874, 742, 525, 29881, 7464, 1580, 29879, 29922, 1727, 6020, 29897, 13, 1678, 4974, 3806, 1275, 1121, 13, 13, 1678, 3806, 353, 18761, 4197, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 10827, 2314, 13, 1678, 1121, 259, 353, 1580, 29879, 29889, 6194, 29898, 431, 4841, 29922, 1839, 29881, 742, 525, 29874, 7464, 1580, 29879, 29922, 1727, 6020, 29897, 13, 1678, 4974, 3806, 1275, 1121, 13, 268, 13, 1678, 3806, 353, 18761, 580, 13, 1678, 1121, 353, 1580, 29879, 29889, 6194, 29898, 431, 4841, 29922, 1839, 29920, 7464, 1580, 29879, 29922, 1727, 6020, 29897, 13, 1678, 4974, 3806, 1275, 1121, 13, 13, 13, 1753, 1243, 29918, 655, 2986, 7295, 13, 1678, 21235, 353, 518, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29906, 29892, 525, 431, 333, 2396, 525, 29890, 16675, 13, 18884, 11117, 1989, 2396, 29871, 29941, 29892, 525, 431, 333, 2396, 525, 29883, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 29915, 6525, 13, 13, 1678, 13069, 4841, 353, 11117, 1127, 2396, 6024, 29874, 742, 525, 29881, 7464, 525, 9539, 2396, 6024, 29890, 742, 525, 29883, 2033, 29913, 13, 13, 1678, 3806, 353, 11117, 1127, 2396, 29871, 313, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 29915, 9594, 13, 18884, 525, 9539, 2396, 313, 10998, 1989, 2396, 29871, 29906, 29892, 525, 431, 333, 2396, 525, 29890, 16675, 11117, 1989, 2396, 29871, 29941, 29892, 525, 431, 333, 2396, 525, 29883, 29915, 1800, 29913, 13, 462, 13, 1678, 1121, 353, 1580, 29879, 29889, 655, 2986, 29898, 431, 4841, 29922, 431, 4841, 29892, 1580, 29879, 29922, 1727, 6020, 29897, 13, 1678, 4974, 3806, 1275, 1121, 13, 13, 13, 1753, 1243, 29918, 28997, 7295, 13, 1678, 21235, 353, 518, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29906, 29892, 525, 431, 333, 2396, 525, 29890, 16675, 13, 18884, 11117, 1989, 2396, 29871, 29941, 29892, 525, 431, 333, 2396, 525, 29883, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 29915, 6525, 13, 13, 1678, 13069, 4841, 353, 6024, 29874, 742, 525, 29881, 2033, 13, 1678, 4974, 5852, 1360, 5965, 2395, 29889, 28997, 29898, 431, 4841, 29922, 431, 4841, 29892, 1580, 29879, 29922, 1727, 6020, 29897, 13, 13, 1678, 13069, 4841, 353, 6024, 29874, 742, 525, 29890, 742, 525, 29916, 2033, 13, 1678, 4974, 7700, 1360, 5965, 2395, 29889, 28997, 29898, 431, 4841, 29922, 431, 4841, 29892, 1580, 29879, 29922, 1727, 6020, 29897, 13, 13, 268, 13, 1753, 1243, 29918, 2248, 7295, 13, 1678, 21235, 353, 518, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29906, 29892, 525, 431, 333, 2396, 525, 29890, 16675, 13, 18884, 11117, 1989, 2396, 29871, 29941, 29892, 525, 431, 333, 2396, 525, 29883, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 29915, 6525, 13, 268, 13, 1678, 2582, 353, 1580, 29879, 29889, 2248, 29898, 1727, 6020, 29897, 13, 13, 1678, 396, 1423, 393, 9657, 29879, 892, 337, 1989, 287, 964, 263, 716, 9657, 13, 1678, 4974, 599, 29898, 1958, 29898, 2892, 364, 29901, 364, 297, 2582, 29892, 6024, 29874, 742, 525, 29890, 742, 525, 29883, 742, 525, 29881, 25901, 13, 13, 1678, 396, 1423, 3829, 310, 716, 9657, 1819, 13, 1678, 4974, 599, 29898, 1958, 29898, 2892, 364, 29901, 525, 431, 333, 29915, 297, 364, 322, 525, 1989, 29915, 297, 364, 29892, 2582, 29889, 5975, 22130, 13, 13, 13, 1753, 1243, 29918, 431, 4841, 7295, 13, 1678, 21235, 353, 518, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29906, 29892, 525, 431, 333, 2396, 525, 29890, 16675, 13, 18884, 11117, 1989, 2396, 29871, 29941, 29892, 525, 431, 333, 2396, 525, 29883, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 29915, 6525, 13, 13, 1678, 848, 353, 1051, 29898, 3200, 3319, 29915, 1217, 412, 2396, 525, 29920, 16675, 21235, 876, 13, 13, 1678, 1781, 353, 4175, 29898, 2892, 285, 29901, 525, 431, 333, 29915, 297, 285, 29892, 848, 29897, 13, 268, 13, 1678, 4974, 731, 29898, 1958, 29898, 2892, 318, 29901, 318, 1839, 431, 333, 7464, 1781, 876, 1275, 731, 29898, 5965, 2395, 29889, 431, 4841, 29898, 1272, 876, 13, 13, 13, 1753, 1243, 29918, 431, 4841, 7295, 13, 1678, 13069, 4841, 353, 518, 10998, 431, 333, 2396, 29871, 29896, 1118, 11117, 431, 333, 2396, 29871, 29906, 1118, 11117, 431, 333, 2396, 29871, 29941, 1118, 11117, 431, 333, 2396, 29871, 29946, 6525, 13, 1678, 4974, 7431, 29898, 5965, 2395, 29889, 431, 4841, 29898, 431, 4841, 876, 1275, 29871, 29946, 13, 13, 13, 1753, 1243, 29918, 999, 6550, 7295, 13, 1678, 1580, 1958, 353, 11117, 1127, 2396, 29871, 518, 10998, 1989, 2396, 29871, 29896, 29892, 525, 431, 333, 2396, 525, 29874, 16675, 11117, 1989, 2396, 29871, 29906, 29892, 525, 431, 333, 2396, 525, 29890, 10827, 1402, 13, 1669, 525, 9539, 2396, 518, 10998, 1989, 2396, 29871, 29941, 29892, 525, 431, 333, 2396, 525, 29883, 16675, 11117, 1989, 2396, 29871, 29946, 29892, 525, 431, 333, 2396, 525, 29881, 29915, 6525, 29913, 13, 13, 1678, 4974, 1134, 29898, 5965, 2395, 29889, 999, 6550, 29898, 6550, 1958, 876, 338, 9657, 13, 2 ]
deem/pytorch/torch_utils.py
kuisu-GDUT/UltraGCN
0
69548
# ============================================================================== # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== import sys import os import numpy as np import torch from torch import nn import random def seed_everything(seed=1029): random.seed(seed) os.environ["PYTHONHASHSEED"] = str(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.backends.cudnn.deterministic = True def set_device(gpu=-1): if gpu >= 0 and torch.cuda.is_available(): device = torch.device("cuda:" + str(gpu)) else: device = torch.device("cpu") return device def set_optimizer(optimizer): if isinstance(optimizer, str): if optimizer.lower() == "adam": optimizer = "Adam" elif optimizer.lower() == "rmsprop": optimizer = "RMSprop" elif optimizer.lower() == "sgd": optimizer = "SGD" return getattr(torch.optim, optimizer) def set_loss(loss): if isinstance(loss, str): if loss in ["bce", "binary_crossentropy", "binary_cross_entropy"]: loss = "binary_cross_entropy" else: raise NotImplementedError("loss={} is not supported.".format(loss)) return loss def set_regularizer(reg): reg_pair = [] # of tuples (p_norm, weight) if isinstance(reg, float): reg_pair.append((2, reg)) elif isinstance(reg, str): try: if reg.startswith("l1(") or reg.startswith("l2("): reg_pair.append((int(reg[1]), float(reg.rstrip(")").split("(")[-1]))) elif reg.startswith("l1_l2"): l1_reg, l2_reg = reg.rstrip(")").split("(")[-1].split(",") reg_pair.append((1, float(l1_reg))) reg_pair.append((2, float(l2_reg))) else: raise NotImplementedError except: raise NotImplementedError("regularizer={} is not supported.".format(reg)) return reg_pair def set_activation(activation): if isinstance(activation, str): if activation.lower() == "relu": return nn.ReLU() elif activation.lower() == "sigmoid": return nn.Sigmoid() elif activation.lower() == "tanh": return nn.Tanh() else: return getattr(nn, activation)() else: return activation def pad_sequences(sequences, maxlen=None, dtype='int32', padding='pre', truncating='pre', value=0.): """ Pads sequences (list of list) to the ndarray of same length This is an equivalent implementation of tf.keras.preprocessing.sequence.pad_sequences for Pytorch """ assert padding in ["pre", "post"], "Invalid padding={}.".format(padding) assert truncating in ["pre", "post"], "Invalid truncating={}.".format(truncating) if maxlen is None: maxlen = max(len(x) for x in sequences) arr = np.full((len(sequences), maxlen), value, dtype=dtype) for idx, x in enumerate(sequences): if len(x) == 0: continue # empty list if truncating == 'pre': trunc = x[-maxlen:] else: trunc = x[:maxlen] trunc = np.asarray(trunc, dtype=dtype) if padding == 'pre': arr[idx, -len(trunc):] = trunc else: arr[idx, :len(trunc)] = trunc return arr
[ 1, 396, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 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, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 1053, 302, 29876, 13, 5215, 4036, 13, 13, 1753, 16717, 29918, 17991, 1918, 29898, 26776, 29922, 29896, 29900, 29906, 29929, 1125, 13, 1678, 4036, 29889, 26776, 29898, 26776, 29897, 13, 1678, 2897, 29889, 21813, 3366, 20055, 4690, 1164, 29950, 24943, 1660, 3352, 3108, 353, 851, 29898, 26776, 29897, 13, 1678, 7442, 29889, 8172, 29889, 26776, 29898, 26776, 29897, 13, 1678, 4842, 305, 29889, 11288, 29918, 26776, 29898, 26776, 29897, 13, 1678, 4842, 305, 29889, 29883, 6191, 29889, 11288, 29918, 26776, 29898, 26776, 29897, 13, 1678, 4842, 305, 29889, 1627, 1975, 29889, 29883, 566, 15755, 29889, 4801, 837, 262, 4695, 353, 5852, 13, 13, 1753, 731, 29918, 10141, 29898, 29887, 3746, 10457, 29896, 1125, 13, 1678, 565, 330, 3746, 6736, 29871, 29900, 322, 4842, 305, 29889, 29883, 6191, 29889, 275, 29918, 16515, 7295, 13, 4706, 4742, 353, 4842, 305, 29889, 10141, 703, 29883, 6191, 6160, 718, 851, 29898, 29887, 3746, 876, 13, 1678, 1683, 29901, 13, 4706, 4742, 353, 4842, 305, 29889, 10141, 703, 21970, 1159, 1678, 13, 1678, 736, 4742, 13, 13, 1753, 731, 29918, 20640, 3950, 29898, 20640, 3950, 1125, 13, 1678, 565, 338, 8758, 29898, 20640, 3950, 29892, 851, 1125, 13, 4706, 565, 5994, 3950, 29889, 13609, 580, 1275, 376, 328, 314, 1115, 13, 9651, 5994, 3950, 353, 376, 3253, 314, 29908, 13, 4706, 25342, 5994, 3950, 29889, 13609, 580, 1275, 376, 29878, 1516, 7728, 1115, 13, 9651, 5994, 3950, 353, 376, 29934, 4345, 7728, 29908, 13, 4706, 25342, 5994, 3950, 29889, 13609, 580, 1275, 376, 5311, 29881, 1115, 13, 9651, 5994, 3950, 353, 376, 26016, 29928, 29908, 13, 4706, 736, 679, 5552, 29898, 7345, 305, 29889, 20640, 29892, 5994, 3950, 29897, 13, 13, 1753, 731, 29918, 6758, 29898, 6758, 1125, 13, 1678, 565, 338, 8758, 29898, 6758, 29892, 851, 1125, 13, 4706, 565, 6410, 297, 6796, 29890, 346, 613, 376, 19541, 29918, 19128, 296, 14441, 613, 376, 19541, 29918, 19128, 29918, 296, 14441, 3108, 29901, 13, 9651, 6410, 353, 376, 19541, 29918, 19128, 29918, 296, 14441, 29908, 13, 4706, 1683, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 703, 6758, 3790, 29913, 338, 451, 6969, 1213, 29889, 4830, 29898, 6758, 876, 13, 1678, 736, 6410, 13, 13, 1753, 731, 29918, 15227, 3950, 29898, 1727, 1125, 13, 1678, 1072, 29918, 18784, 353, 5159, 396, 310, 5291, 2701, 313, 29886, 29918, 12324, 29892, 7688, 29897, 13, 1678, 565, 338, 8758, 29898, 1727, 29892, 5785, 1125, 13, 4706, 1072, 29918, 18784, 29889, 4397, 3552, 29906, 29892, 1072, 876, 13, 1678, 25342, 338, 8758, 29898, 1727, 29892, 851, 1125, 13, 4706, 1018, 29901, 13, 9651, 565, 1072, 29889, 27382, 2541, 703, 29880, 29896, 703, 29897, 470, 1072, 29889, 27382, 2541, 703, 29880, 29906, 703, 1125, 13, 18884, 1072, 29918, 18784, 29889, 4397, 3552, 524, 29898, 1727, 29961, 29896, 11724, 5785, 29898, 1727, 29889, 29878, 17010, 703, 29897, 2564, 5451, 703, 703, 9601, 29899, 29896, 29962, 4961, 13, 9651, 25342, 1072, 29889, 27382, 2541, 703, 29880, 29896, 29918, 29880, 29906, 29908, 1125, 13, 18884, 301, 29896, 29918, 1727, 29892, 301, 29906, 29918, 1727, 353, 1072, 29889, 29878, 17010, 703, 29897, 2564, 5451, 703, 703, 9601, 29899, 29896, 1822, 5451, 28165, 1159, 13, 18884, 1072, 29918, 18784, 29889, 4397, 3552, 29896, 29892, 5785, 29898, 29880, 29896, 29918, 1727, 4961, 13, 18884, 1072, 29918, 18784, 29889, 4397, 3552, 29906, 29892, 5785, 29898, 29880, 29906, 29918, 1727, 4961, 13, 9651, 1683, 29901, 13, 18884, 12020, 2216, 1888, 2037, 287, 2392, 13, 4706, 5174, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 703, 15227, 3950, 3790, 29913, 338, 451, 6969, 1213, 29889, 4830, 29898, 1727, 876, 13, 1678, 736, 1072, 29918, 18784, 13, 13, 1753, 731, 29918, 11236, 362, 29898, 11236, 362, 1125, 13, 1678, 565, 338, 8758, 29898, 11236, 362, 29892, 851, 1125, 13, 4706, 565, 26229, 29889, 13609, 580, 1275, 376, 2674, 29884, 1115, 13, 9651, 736, 302, 29876, 29889, 1123, 29931, 29965, 580, 13, 4706, 25342, 26229, 29889, 13609, 580, 1275, 376, 18816, 29885, 3398, 1115, 13, 9651, 736, 302, 29876, 29889, 29903, 335, 29885, 3398, 580, 13, 4706, 25342, 26229, 29889, 13609, 580, 1275, 376, 13161, 29882, 1115, 13, 9651, 736, 302, 29876, 29889, 29911, 27731, 580, 13, 4706, 1683, 29901, 13, 9651, 736, 679, 5552, 29898, 15755, 29892, 26229, 29897, 580, 13, 1678, 1683, 29901, 13, 4706, 736, 26229, 13, 13, 1753, 17132, 29918, 6831, 2063, 29898, 6831, 2063, 29892, 4236, 2435, 29922, 8516, 29892, 26688, 2433, 524, 29941, 29906, 742, 13, 462, 29871, 7164, 2433, 1457, 742, 21022, 1218, 2433, 1457, 742, 995, 29922, 29900, 9575, 13, 1678, 9995, 349, 7925, 15602, 313, 1761, 310, 1051, 29897, 304, 278, 29871, 299, 2378, 310, 1021, 3309, 29871, 13, 4706, 910, 338, 385, 7126, 5314, 310, 15886, 29889, 3946, 294, 29889, 1457, 19170, 29889, 16506, 29889, 8305, 29918, 6831, 2063, 13, 4706, 363, 349, 3637, 25350, 13, 1678, 9995, 13, 13, 1678, 4974, 7164, 297, 6796, 1457, 613, 376, 2490, 12436, 376, 13919, 7164, 3790, 29913, 1213, 29889, 4830, 29898, 12791, 29897, 13, 1678, 4974, 21022, 1218, 297, 6796, 1457, 613, 376, 2490, 12436, 376, 13919, 21022, 1218, 3790, 29913, 1213, 29889, 4830, 29898, 509, 4661, 1218, 29897, 13, 268, 13, 1678, 565, 4236, 2435, 338, 6213, 29901, 13, 4706, 4236, 2435, 353, 4236, 29898, 2435, 29898, 29916, 29897, 363, 921, 297, 15602, 29897, 13, 1678, 3948, 353, 7442, 29889, 8159, 3552, 2435, 29898, 6831, 2063, 511, 4236, 2435, 511, 995, 29892, 26688, 29922, 29881, 1853, 29897, 13, 1678, 363, 22645, 29892, 921, 297, 26985, 29898, 6831, 2063, 1125, 13, 4706, 565, 7431, 29898, 29916, 29897, 1275, 29871, 29900, 29901, 13, 9651, 6773, 29871, 396, 4069, 1051, 13, 4706, 565, 21022, 1218, 1275, 525, 1457, 2396, 13, 9651, 21022, 353, 921, 14352, 3317, 2435, 17531, 13, 4706, 1683, 29901, 13, 9651, 21022, 353, 921, 7503, 3317, 2435, 29962, 13, 4706, 21022, 353, 7442, 29889, 294, 2378, 29898, 509, 4661, 29892, 26688, 29922, 29881, 1853, 29897, 13, 13, 4706, 565, 7164, 1275, 525, 1457, 2396, 13, 9651, 3948, 29961, 13140, 29892, 448, 2435, 29898, 509, 4661, 1125, 29962, 353, 21022, 13, 4706, 1683, 29901, 13, 9651, 3948, 29961, 13140, 29892, 584, 2435, 29898, 509, 4661, 4638, 353, 21022, 13, 1678, 736, 3948, 2 ]
demo/trace_model.py
furkankirac/maskrcnn-benchmark
0
12035
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from __future__ import division import os import numpy from io import BytesIO from matplotlib import pyplot import requests import torch from PIL import Image from maskrcnn_benchmark.config import cfg from predictor import COCODemo from maskrcnn_benchmark.structures.image_list import ImageList if __name__ == "__main__": # load config from file and command-line arguments project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) cfg.merge_from_file( os.path.join(project_dir, "configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml")) cfg.merge_from_list(["MODEL.DEVICE", "cpu"]) cfg.freeze() # prepare object that handles inference plus adds predictions on top of image coco_demo = COCODemo( cfg, confidence_threshold=0.7, show_mask_heatmaps=False, masks_per_dim=2, min_image_size=480, ) def single_image_to_top_predictions(image): image = image.float() / 255.0 image = image.permute(2, 0, 1) # we are loading images with OpenCV, so we don't need to convert them # to BGR, they are already! So all we need to do is to normalize # by 255 if we want to convert to BGR255 format, or flip the channels # if we want it to be in RGB in [0-1] range. if cfg.INPUT.TO_BGR255: image = image * 255 else: image = image[[2, 1, 0]] # we absolutely want fixed size (int) here (or we run into a tracing error (or bug?) # or we might later decide to make things work with variable size... image = image - torch.tensor(cfg.INPUT.PIXEL_MEAN)[:, None, None] # should also do variance... image_list = ImageList(image.unsqueeze(0), [(int(image.size(-2)), int(image.size(-1)))]) result, = coco_demo.model(image_list) scores = result.get_field("scores") keep = (scores >= coco_demo.confidence_threshold) result = (result.bbox[keep], result.get_field("labels")[keep], result.get_field("mask")[keep], scores[keep]) return result @torch.jit.script def my_paste_mask(mask, bbox, height, width, threshold=0.5, padding=1, contour=True, rectangle=False): # type: (Tensor, Tensor, int, int, float, int, bool, bool) -> Tensor padded_mask = torch.constant_pad_nd(mask, (padding, padding, padding, padding)) scale = 1.0 + 2.0 * float(padding) / float(mask.size(-1)) center_x = (bbox[2] + bbox[0]) * 0.5 center_y = (bbox[3] + bbox[1]) * 0.5 w_2 = (bbox[2] - bbox[0]) * 0.5 * scale h_2 = (bbox[3] - bbox[1]) * 0.5 * scale # should have two scales? bbox_scaled = torch.stack([center_x - w_2, center_y - h_2, center_x + w_2, center_y + h_2], 0) TO_REMOVE = 1 w = (bbox_scaled[2] - bbox_scaled[0] + TO_REMOVE).clamp(min=1).long() h = (bbox_scaled[3] - bbox_scaled[1] + TO_REMOVE).clamp(min=1).long() scaled_mask = torch.ops.maskrcnn_benchmark.upsample_bilinear(padded_mask.float(), h, w) x0 = bbox_scaled[0].long() y0 = bbox_scaled[1].long() x = x0.clamp(min=0) y = y0.clamp(min=0) leftcrop = x - x0 topcrop = y - y0 w = torch.min(w - leftcrop, width - x) h = torch.min(h - topcrop, height - y) # mask = torch.zeros((height, width), dtype=torch.uint8) # mask[y:y + h, x:x + w] = (scaled_mask[topcrop:topcrop + h, leftcrop:leftcrop + w] > threshold) mask = torch.constant_pad_nd((scaled_mask[topcrop:topcrop + h, leftcrop:leftcrop + w] > threshold), (int(x), int(width - x - w), int(y), int(height - y - h))) # int for the script compiler if contour: mask = mask.float() # poor person's contour finding by comparing to smoothed mask = (mask - torch.nn.functional.conv2d(mask.unsqueeze(0).unsqueeze(0), torch.full((1, 1, 3, 3), 1.0 / 9.0), padding=1)[0, 0]).abs() > 0.001 if rectangle: x = torch.arange(width, dtype=torch.long).unsqueeze(0) y = torch.arange(height, dtype=torch.long).unsqueeze(1) r = bbox.long() # work around script not liking bitwise ops rectangle_mask = ((((x == r[0]) + (x == r[2])) * (y >= r[1]) * (y <= r[3])) + (((y == r[1]) + (y == r[3])) * (x >= r[0]) * (x <= r[2]))) mask = (mask + rectangle_mask).clamp(max=1) return mask @torch.jit.script def add_annotations(image, labels, scores, bboxes, class_names=','.join(coco_demo.CATEGORIES), color=torch.tensor([255, 255, 255], dtype=torch.long)): # type: (Tensor, Tensor, Tensor, Tensor, str, Tensor) -> Tensor result_image = torch.ops.maskrcnn_benchmark.add_annotations(image, labels, scores, bboxes, class_names, color) return result_image @torch.jit.script def combine_masks(image, labels, masks, scores, bboxes, threshold=0.5, padding=1, contour=True, rectangle=False, palette=torch.tensor([33554431, 32767, 2097151])): # type: (Tensor, Tensor, Tensor, Tensor, Tensor, float, int, bool, bool, Tensor) -> Tensor height = image.size(0) width = image.size(1) image_with_mask = image.clone() for i in range(masks.size(0)): color = ((palette * labels[i]) % 255).to(torch.uint8) one_mask = my_paste_mask(masks[i, 0], bboxes[i], height, width, threshold, padding, contour, rectangle) image_with_mask = torch.where(one_mask.unsqueeze(-1), color.unsqueeze(0).unsqueeze(0), image_with_mask) image_with_mask = add_annotations(image_with_mask, labels, scores, bboxes) return image_with_mask def process_image_with_traced_model(image): original_image = image if coco_demo.cfg.DATALOADER.SIZE_DIVISIBILITY: assert (image.size(0) % coco_demo.cfg.DATALOADER.SIZE_DIVISIBILITY == 0 and image.size(1) % coco_demo.cfg.DATALOADER.SIZE_DIVISIBILITY == 0) boxes, labels, masks, scores = traced_model(image) # todo: make this in one large thing result_image = combine_masks(original_image, labels, masks, scores, boxes, 0.5, 1, rectangle=True) return result_image def fetch_image(url): response = requests.get(url) return Image.open(BytesIO(response.content)).convert("RGB") if __name__ == "__main__": pil_image = fetch_image( url="http://farm3.staticflickr.com/2469/3915380994_2e611b1779_z.jpg") # convert to BGR format image = torch.from_numpy(numpy.array(pil_image)[:, :, [2, 1, 0]]) original_image = image if coco_demo.cfg.DATALOADER.SIZE_DIVISIBILITY: assert (image.size(0) % coco_demo.cfg.DATALOADER.SIZE_DIVISIBILITY == 0 and image.size(1) % coco_demo.cfg.DATALOADER.SIZE_DIVISIBILITY == 0) for p in coco_demo.model.parameters(): p.requires_grad_(False) traced_model = torch.jit.trace(single_image_to_top_predictions, (image,)) @torch.jit.script def end_to_end_model(image): boxes, labels, masks, scores = traced_model(image) result_image = combine_masks(image, labels, masks, scores, boxes, 0.5, 1, rectangle=True) return result_image end_to_end_model.save('end_to_end_model.pt') result_image = process_image_with_traced_model(original_image) # self.show_mask_heatmaps not done pyplot.imshow(result_image[:, :, [2, 1, 0]]) pyplot.show() # second image image2 = fetch_image( url='http://farm4.staticflickr.com/3153/2970773875_164f0c0b83_z.jpg') image2 = image2.resize((640, 480), Image.BILINEAR) image2 = torch.from_numpy(numpy.array(image2)[:, :, [2, 1, 0]]) result_image2 = process_image_with_traced_model(image2) # self.show_mask_heatmaps not done pyplot.imshow(result_image2[:, :, [2, 1, 0]]) pyplot.show()
[ 1, 396, 14187, 1266, 313, 29883, 29897, 13327, 29892, 9266, 29889, 322, 967, 23736, 1078, 29889, 2178, 26863, 2538, 9841, 29889, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 5215, 2897, 13, 13, 5215, 12655, 13, 3166, 12013, 1053, 2648, 2167, 5971, 13, 3166, 22889, 1053, 11451, 5317, 13, 13, 5215, 7274, 13, 5215, 4842, 305, 13, 13, 3166, 349, 6227, 1053, 7084, 13, 3166, 11105, 2214, 15755, 29918, 1785, 16580, 29889, 2917, 1053, 274, 16434, 13, 3166, 8500, 272, 1053, 4810, 3217, 23444, 13, 3166, 11105, 2214, 15755, 29918, 1785, 16580, 29889, 4984, 1973, 29889, 3027, 29918, 1761, 1053, 7084, 1293, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 2254, 2295, 515, 934, 322, 1899, 29899, 1220, 6273, 13, 13, 1678, 2060, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 22168, 1445, 1649, 4961, 13, 1678, 274, 16434, 29889, 14634, 29918, 3166, 29918, 1445, 29898, 13, 4706, 2897, 29889, 2084, 29889, 7122, 29898, 4836, 29918, 3972, 29892, 13, 462, 268, 376, 2917, 29879, 29914, 1113, 17615, 29906, 29914, 29872, 29906, 29872, 29918, 13168, 29918, 2214, 15755, 29918, 29934, 29918, 29945, 29900, 29918, 29943, 15695, 29918, 29896, 29916, 29918, 1113, 17615, 29906, 29889, 25162, 5783, 13, 1678, 274, 16434, 29889, 14634, 29918, 3166, 29918, 1761, 29898, 3366, 20387, 29931, 29889, 2287, 19059, 613, 376, 21970, 20068, 13, 1678, 274, 16434, 29889, 9021, 911, 580, 13, 13, 1678, 396, 19012, 1203, 393, 17766, 27262, 2298, 12778, 27303, 373, 2246, 310, 1967, 13, 1678, 274, 6235, 29918, 17482, 353, 4810, 3217, 23444, 29898, 13, 4706, 274, 16434, 29892, 13, 4706, 16420, 29918, 386, 12268, 29922, 29900, 29889, 29955, 29892, 13, 4706, 1510, 29918, 13168, 29918, 354, 271, 10339, 29922, 8824, 29892, 13, 4706, 11105, 29879, 29918, 546, 29918, 6229, 29922, 29906, 29892, 13, 4706, 1375, 29918, 3027, 29918, 2311, 29922, 29946, 29947, 29900, 29892, 13, 1678, 1723, 13, 13, 13, 1753, 2323, 29918, 3027, 29918, 517, 29918, 3332, 29918, 27711, 1080, 29898, 3027, 1125, 13, 1678, 1967, 353, 1967, 29889, 7411, 580, 847, 29871, 29906, 29945, 29945, 29889, 29900, 13, 1678, 1967, 353, 1967, 29889, 17858, 1082, 29898, 29906, 29892, 29871, 29900, 29892, 29871, 29896, 29897, 13, 1678, 396, 591, 526, 8363, 4558, 411, 4673, 15633, 29892, 577, 591, 1016, 29915, 29873, 817, 304, 3588, 963, 13, 1678, 396, 304, 350, 14345, 29892, 896, 526, 2307, 29991, 1105, 599, 591, 817, 304, 437, 338, 304, 4226, 675, 13, 1678, 396, 491, 29871, 29906, 29945, 29945, 565, 591, 864, 304, 3588, 304, 350, 14345, 29906, 29945, 29945, 3402, 29892, 470, 285, 3466, 278, 18196, 13, 1678, 396, 565, 591, 864, 372, 304, 367, 297, 390, 7210, 297, 518, 29900, 29899, 29896, 29962, 3464, 29889, 13, 1678, 565, 274, 16434, 29889, 1177, 12336, 29889, 4986, 29918, 29933, 14345, 29906, 29945, 29945, 29901, 13, 4706, 1967, 353, 1967, 334, 29871, 29906, 29945, 29945, 13, 1678, 1683, 29901, 13, 4706, 1967, 353, 1967, 8999, 29906, 29892, 29871, 29896, 29892, 29871, 29900, 5262, 13, 13, 1678, 396, 591, 13312, 864, 4343, 2159, 313, 524, 29897, 1244, 313, 272, 591, 1065, 964, 263, 16703, 292, 1059, 313, 272, 6494, 7897, 13, 1678, 396, 470, 591, 1795, 2678, 11097, 304, 1207, 2712, 664, 411, 2286, 2159, 856, 13, 1678, 1967, 353, 1967, 448, 4842, 305, 29889, 20158, 29898, 16859, 29889, 1177, 12336, 29889, 2227, 29990, 6670, 29918, 2303, 2190, 29897, 7503, 29892, 6213, 29892, 6213, 29962, 13, 1678, 396, 881, 884, 437, 20162, 856, 13, 1678, 1967, 29918, 1761, 353, 7084, 1293, 29898, 3027, 29889, 6948, 802, 29872, 911, 29898, 29900, 511, 17288, 524, 29898, 3027, 29889, 2311, 6278, 29906, 8243, 938, 29898, 3027, 29889, 2311, 6278, 29896, 4961, 2314, 13, 1678, 1121, 29892, 353, 274, 6235, 29918, 17482, 29889, 4299, 29898, 3027, 29918, 1761, 29897, 13, 1678, 19435, 353, 1121, 29889, 657, 29918, 2671, 703, 1557, 2361, 1159, 13, 1678, 3013, 353, 313, 1557, 2361, 6736, 274, 6235, 29918, 17482, 29889, 5527, 5084, 29918, 386, 12268, 29897, 13, 1678, 1121, 353, 313, 2914, 29889, 29890, 1884, 29961, 17462, 1402, 13, 795, 1121, 29889, 657, 29918, 2671, 703, 21134, 1159, 29961, 17462, 1402, 13, 795, 1121, 29889, 657, 29918, 2671, 703, 13168, 1159, 29961, 17462, 1402, 13, 795, 19435, 29961, 17462, 2314, 13, 1678, 736, 1121, 13, 13, 13, 29992, 7345, 305, 29889, 29926, 277, 29889, 2154, 13, 1753, 590, 29918, 16179, 29918, 13168, 29898, 13168, 29892, 289, 1884, 29892, 3171, 29892, 2920, 29892, 16897, 29922, 29900, 29889, 29945, 29892, 7164, 29922, 29896, 29892, 640, 473, 29922, 5574, 29892, 16701, 29922, 8824, 1125, 13, 1678, 396, 1134, 29901, 313, 29911, 6073, 29892, 323, 6073, 29892, 938, 29892, 938, 29892, 5785, 29892, 938, 29892, 6120, 29892, 6120, 29897, 1599, 323, 6073, 13, 1678, 282, 23959, 29918, 13168, 353, 4842, 305, 29889, 23362, 29918, 8305, 29918, 299, 29898, 13168, 29892, 313, 12791, 29892, 7164, 29892, 7164, 29892, 7164, 876, 13, 1678, 6287, 353, 29871, 29896, 29889, 29900, 718, 29871, 29906, 29889, 29900, 334, 5785, 29898, 12791, 29897, 847, 5785, 29898, 13168, 29889, 2311, 6278, 29896, 876, 13, 1678, 4818, 29918, 29916, 353, 313, 29890, 1884, 29961, 29906, 29962, 718, 289, 1884, 29961, 29900, 2314, 334, 29871, 29900, 29889, 29945, 13, 1678, 4818, 29918, 29891, 353, 313, 29890, 1884, 29961, 29941, 29962, 718, 289, 1884, 29961, 29896, 2314, 334, 29871, 29900, 29889, 29945, 13, 1678, 281, 29918, 29906, 353, 313, 29890, 1884, 29961, 29906, 29962, 448, 289, 1884, 29961, 29900, 2314, 334, 29871, 29900, 29889, 29945, 334, 6287, 13, 1678, 298, 29918, 29906, 353, 313, 29890, 1884, 29961, 29941, 29962, 448, 289, 1884, 29961, 29896, 2314, 334, 29871, 29900, 29889, 29945, 334, 6287, 29871, 396, 881, 505, 1023, 23431, 29973, 13, 1678, 289, 1884, 29918, 7052, 29881, 353, 4842, 305, 29889, 1429, 4197, 5064, 29918, 29916, 448, 281, 29918, 29906, 29892, 4818, 29918, 29891, 448, 298, 29918, 29906, 29892, 13, 462, 1669, 4818, 29918, 29916, 718, 281, 29918, 29906, 29892, 4818, 29918, 29891, 718, 298, 29918, 29906, 1402, 29871, 29900, 29897, 13, 13, 1678, 7495, 29918, 1525, 6720, 12064, 353, 29871, 29896, 13, 1678, 281, 353, 313, 29890, 1884, 29918, 7052, 29881, 29961, 29906, 29962, 448, 289, 1884, 29918, 7052, 29881, 29961, 29900, 29962, 718, 7495, 29918, 1525, 6720, 12064, 467, 695, 1160, 29898, 1195, 29922, 29896, 467, 5426, 580, 13, 1678, 298, 353, 313, 29890, 1884, 29918, 7052, 29881, 29961, 29941, 29962, 448, 289, 1884, 29918, 7052, 29881, 29961, 29896, 29962, 718, 7495, 29918, 1525, 6720, 12064, 467, 695, 1160, 29898, 1195, 29922, 29896, 467, 5426, 580, 13, 13, 1678, 6287, 29881, 29918, 13168, 353, 4842, 305, 29889, 3554, 29889, 13168, 2214, 15755, 29918, 1785, 16580, 29889, 14340, 981, 29918, 18152, 457, 279, 29898, 29886, 23959, 29918, 13168, 29889, 7411, 3285, 298, 29892, 281, 29897, 13, 13, 1678, 921, 29900, 353, 289, 1884, 29918, 7052, 29881, 29961, 29900, 1822, 5426, 580, 13, 1678, 343, 29900, 353, 289, 1884, 29918, 7052, 29881, 29961, 29896, 1822, 5426, 580, 13, 1678, 921, 353, 921, 29900, 29889, 695, 1160, 29898, 1195, 29922, 29900, 29897, 13, 1678, 343, 353, 343, 29900, 29889, 695, 1160, 29898, 1195, 29922, 29900, 29897, 13, 1678, 2175, 29883, 1336, 353, 921, 448, 921, 29900, 13, 1678, 2246, 29883, 1336, 353, 343, 448, 343, 29900, 13, 1678, 281, 353, 4842, 305, 29889, 1195, 29898, 29893, 448, 2175, 29883, 1336, 29892, 2920, 448, 921, 29897, 13, 1678, 298, 353, 4842, 305, 29889, 1195, 29898, 29882, 448, 2246, 29883, 1336, 29892, 3171, 448, 343, 29897, 13, 13, 1678, 396, 11105, 353, 4842, 305, 29889, 3298, 359, 3552, 3545, 29892, 2920, 511, 26688, 29922, 7345, 305, 29889, 13470, 29947, 29897, 13, 1678, 396, 11105, 29961, 29891, 29901, 29891, 718, 298, 29892, 921, 29901, 29916, 718, 281, 29962, 353, 313, 7052, 29881, 29918, 13168, 29961, 3332, 29883, 1336, 29901, 3332, 29883, 1336, 718, 298, 29892, 29871, 2175, 29883, 1336, 29901, 1563, 29883, 1336, 718, 281, 29962, 1405, 16897, 29897, 13, 1678, 11105, 353, 4842, 305, 29889, 23362, 29918, 8305, 29918, 299, 3552, 7052, 29881, 29918, 13168, 29961, 3332, 29883, 1336, 29901, 3332, 29883, 1336, 718, 298, 29892, 2175, 29883, 1336, 29901, 1563, 29883, 1336, 718, 281, 29962, 1405, 16897, 511, 13, 462, 462, 313, 524, 29898, 29916, 511, 938, 29898, 2103, 448, 921, 448, 281, 511, 938, 29898, 29891, 511, 938, 29898, 3545, 448, 343, 448, 298, 4961, 259, 396, 938, 363, 278, 2471, 6516, 13, 13, 1678, 565, 640, 473, 29901, 13, 4706, 11105, 353, 11105, 29889, 7411, 580, 13, 4706, 396, 6460, 2022, 29915, 29879, 640, 473, 9138, 491, 17420, 304, 10597, 287, 13, 4706, 11105, 353, 313, 13168, 448, 4842, 305, 29889, 15755, 29889, 2220, 284, 29889, 20580, 29906, 29881, 29898, 13168, 29889, 6948, 802, 29872, 911, 29898, 29900, 467, 6948, 802, 29872, 911, 29898, 29900, 511, 13, 462, 462, 462, 29871, 4842, 305, 29889, 8159, 3552, 29896, 29892, 29871, 29896, 29892, 29871, 29941, 29892, 29871, 29941, 511, 29871, 29896, 29889, 29900, 847, 29871, 29929, 29889, 29900, 511, 7164, 29922, 29896, 9601, 29900, 29892, 29871, 29900, 14664, 6897, 580, 1405, 29871, 29900, 29889, 29900, 29900, 29896, 13, 1678, 565, 16701, 29901, 13, 4706, 921, 353, 4842, 305, 29889, 279, 927, 29898, 2103, 29892, 26688, 29922, 7345, 305, 29889, 5426, 467, 6948, 802, 29872, 911, 29898, 29900, 29897, 13, 4706, 343, 353, 4842, 305, 29889, 279, 927, 29898, 3545, 29892, 26688, 29922, 7345, 305, 29889, 5426, 467, 6948, 802, 29872, 911, 29898, 29896, 29897, 13, 4706, 364, 353, 289, 1884, 29889, 5426, 580, 13, 4706, 396, 664, 2820, 2471, 451, 4188, 292, 2586, 3538, 288, 567, 13, 4706, 16701, 29918, 13168, 353, 313, 3552, 29898, 29916, 1275, 364, 29961, 29900, 2314, 718, 313, 29916, 1275, 364, 29961, 29906, 12622, 334, 313, 29891, 6736, 364, 29961, 29896, 2314, 334, 313, 29891, 5277, 364, 29961, 29941, 12622, 13, 462, 3986, 718, 313, 3552, 29891, 1275, 364, 29961, 29896, 2314, 718, 313, 29891, 1275, 364, 29961, 29941, 12622, 334, 313, 29916, 6736, 364, 29961, 29900, 2314, 334, 313, 29916, 5277, 364, 29961, 29906, 29962, 4961, 13, 4706, 11105, 353, 313, 13168, 718, 16701, 29918, 13168, 467, 695, 1160, 29898, 3317, 29922, 29896, 29897, 13, 1678, 736, 11105, 13, 13, 13, 29992, 7345, 305, 29889, 29926, 277, 29889, 2154, 13, 1753, 788, 29918, 6735, 800, 29898, 3027, 29892, 11073, 29892, 19435, 29892, 289, 1884, 267, 29892, 770, 29918, 7039, 29922, 3788, 29889, 7122, 29898, 29883, 6235, 29918, 17482, 29889, 29907, 3040, 29954, 1955, 29059, 511, 2927, 29922, 7345, 305, 29889, 20158, 4197, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 1402, 26688, 29922, 7345, 305, 29889, 5426, 22164, 13, 1678, 396, 1134, 29901, 313, 29911, 6073, 29892, 323, 6073, 29892, 323, 6073, 29892, 323, 6073, 29892, 851, 29892, 323, 6073, 29897, 1599, 323, 6073, 13, 1678, 1121, 29918, 3027, 353, 4842, 305, 29889, 3554, 29889, 13168, 2214, 15755, 29918, 1785, 16580, 29889, 1202, 29918, 6735, 800, 29898, 3027, 29892, 11073, 29892, 19435, 29892, 289, 1884, 267, 29892, 770, 29918, 7039, 29892, 2927, 29897, 13, 1678, 736, 1121, 29918, 3027, 13, 13, 13, 29992, 7345, 305, 29889, 29926, 277, 29889, 2154, 13, 1753, 14405, 29918, 13168, 29879, 29898, 3027, 29892, 11073, 29892, 11105, 29879, 29892, 19435, 29892, 289, 1884, 267, 29892, 16897, 29922, 29900, 29889, 29945, 29892, 7164, 29922, 29896, 29892, 640, 473, 29922, 5574, 29892, 16701, 29922, 8824, 29892, 282, 26456, 29922, 7345, 305, 29889, 20158, 4197, 29941, 29941, 29945, 29945, 29946, 29946, 29941, 29896, 29892, 29871, 29941, 29906, 29955, 29953, 29955, 29892, 29871, 29906, 29900, 29929, 29955, 29896, 29945, 29896, 12622, 29901, 13, 1678, 396, 1134, 29901, 313, 29911, 6073, 29892, 323, 6073, 29892, 323, 6073, 29892, 323, 6073, 29892, 323, 6073, 29892, 5785, 29892, 938, 29892, 6120, 29892, 6120, 29892, 323, 6073, 29897, 1599, 323, 6073, 13, 1678, 3171, 353, 1967, 29889, 2311, 29898, 29900, 29897, 13, 1678, 2920, 353, 1967, 29889, 2311, 29898, 29896, 29897, 13, 1678, 1967, 29918, 2541, 29918, 13168, 353, 1967, 29889, 16513, 580, 13, 1678, 363, 474, 297, 3464, 29898, 13168, 29879, 29889, 2311, 29898, 29900, 22164, 13, 4706, 2927, 353, 5135, 29886, 26456, 334, 11073, 29961, 29875, 2314, 1273, 29871, 29906, 29945, 29945, 467, 517, 29898, 7345, 305, 29889, 13470, 29947, 29897, 13, 4706, 697, 29918, 13168, 353, 590, 29918, 16179, 29918, 13168, 29898, 13168, 29879, 29961, 29875, 29892, 29871, 29900, 1402, 289, 1884, 267, 29961, 29875, 1402, 3171, 29892, 2920, 29892, 16897, 29892, 7164, 29892, 640, 473, 29892, 16701, 29897, 13, 4706, 1967, 29918, 2541, 29918, 13168, 353, 4842, 305, 29889, 3062, 29898, 650, 29918, 13168, 29889, 6948, 802, 29872, 911, 6278, 29896, 511, 2927, 29889, 6948, 802, 29872, 911, 29898, 29900, 467, 6948, 802, 29872, 911, 29898, 29900, 511, 1967, 29918, 2541, 29918, 13168, 29897, 13, 1678, 1967, 29918, 2541, 29918, 13168, 353, 788, 29918, 6735, 800, 29898, 3027, 29918, 2541, 29918, 13168, 29892, 11073, 29892, 19435, 29892, 289, 1884, 267, 29897, 13, 1678, 736, 1967, 29918, 2541, 29918, 13168, 13, 13, 13, 1753, 1889, 29918, 3027, 29918, 2541, 29918, 29873, 945, 287, 29918, 4299, 29898, 3027, 1125, 13, 1678, 2441, 29918, 3027, 353, 1967, 13, 13, 1678, 565, 274, 6235, 29918, 17482, 29889, 16859, 29889, 25832, 1964, 29949, 3035, 1001, 29889, 14226, 29918, 4571, 28607, 8979, 6227, 11937, 29901, 13, 4706, 4974, 313, 3027, 29889, 2311, 29898, 29900, 29897, 1273, 274, 6235, 29918, 17482, 29889, 16859, 29889, 25832, 1964, 29949, 3035, 1001, 29889, 14226, 29918, 4571, 28607, 8979, 6227, 11937, 1275, 29871, 29900, 13, 18884, 322, 1967, 29889, 2311, 29898, 29896, 29897, 1273, 274, 6235, 29918, 17482, 29889, 16859, 29889, 25832, 1964, 29949, 3035, 1001, 29889, 14226, 29918, 4571, 28607, 8979, 6227, 11937, 1275, 29871, 29900, 29897, 13, 13, 1678, 16273, 29892, 11073, 29892, 11105, 29879, 29892, 19435, 353, 16703, 287, 29918, 4299, 29898, 3027, 29897, 13, 13, 1678, 396, 10481, 29901, 1207, 445, 297, 697, 2919, 2655, 13, 1678, 1121, 29918, 3027, 353, 14405, 29918, 13168, 29879, 29898, 13492, 29918, 3027, 29892, 11073, 29892, 11105, 29879, 29892, 19435, 29892, 16273, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29896, 29892, 16701, 29922, 5574, 29897, 13, 1678, 736, 1121, 29918, 3027, 13, 13, 1753, 6699, 29918, 3027, 29898, 2271, 1125, 13, 1678, 2933, 353, 7274, 29889, 657, 29898, 2271, 29897, 13, 1678, 736, 7084, 29889, 3150, 29898, 11207, 5971, 29898, 5327, 29889, 3051, 8106, 13441, 703, 28212, 1159, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 8230, 29918, 3027, 353, 6699, 29918, 3027, 29898, 13, 4706, 3142, 543, 1124, 597, 29888, 2817, 29941, 29889, 7959, 29888, 1406, 29878, 29889, 510, 29914, 29906, 29946, 29953, 29929, 29914, 29941, 29929, 29896, 29945, 29941, 29947, 29900, 29929, 29929, 29946, 29918, 29906, 29872, 29953, 29896, 29896, 29890, 29896, 29955, 29955, 29929, 29918, 29920, 29889, 6173, 1159, 13, 13, 1678, 396, 3588, 304, 350, 14345, 3402, 13, 1678, 1967, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 23749, 29889, 2378, 29898, 29886, 309, 29918, 3027, 29897, 7503, 29892, 584, 29892, 518, 29906, 29892, 29871, 29896, 29892, 29871, 29900, 24960, 13, 1678, 2441, 29918, 3027, 353, 1967, 13, 13, 1678, 565, 274, 6235, 29918, 17482, 29889, 16859, 29889, 25832, 1964, 29949, 3035, 1001, 29889, 14226, 29918, 4571, 28607, 8979, 6227, 11937, 29901, 13, 4706, 4974, 313, 3027, 29889, 2311, 29898, 29900, 29897, 1273, 274, 6235, 29918, 17482, 29889, 16859, 29889, 25832, 1964, 29949, 3035, 1001, 29889, 14226, 29918, 4571, 28607, 8979, 6227, 11937, 1275, 29871, 29900, 13, 18884, 322, 1967, 29889, 2311, 29898, 29896, 29897, 1273, 274, 6235, 29918, 17482, 29889, 16859, 29889, 25832, 1964, 29949, 3035, 1001, 29889, 14226, 29918, 4571, 28607, 8979, 6227, 11937, 1275, 29871, 29900, 29897, 13, 13, 1678, 363, 282, 297, 274, 6235, 29918, 17482, 29889, 4299, 29889, 16744, 7295, 13, 4706, 282, 29889, 276, 339, 2658, 29918, 5105, 23538, 8824, 29897, 13, 1678, 16703, 287, 29918, 4299, 353, 4842, 305, 29889, 29926, 277, 29889, 15003, 29898, 14369, 29918, 3027, 29918, 517, 29918, 3332, 29918, 27711, 1080, 29892, 313, 3027, 29892, 876, 13, 13, 1678, 732, 7345, 305, 29889, 29926, 277, 29889, 2154, 13, 1678, 822, 1095, 29918, 517, 29918, 355, 29918, 4299, 29898, 3027, 1125, 13, 4706, 16273, 29892, 11073, 29892, 11105, 29879, 29892, 19435, 353, 16703, 287, 29918, 4299, 29898, 3027, 29897, 13, 4706, 1121, 29918, 3027, 353, 14405, 29918, 13168, 29879, 29898, 3027, 29892, 11073, 29892, 11105, 29879, 29892, 19435, 29892, 16273, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29896, 29892, 16701, 29922, 5574, 29897, 13, 4706, 736, 1121, 29918, 3027, 13, 1678, 1095, 29918, 517, 29918, 355, 29918, 4299, 29889, 7620, 877, 355, 29918, 517, 29918, 355, 29918, 4299, 29889, 415, 1495, 13, 13, 1678, 1121, 29918, 3027, 353, 1889, 29918, 3027, 29918, 2541, 29918, 29873, 945, 287, 29918, 4299, 29898, 13492, 29918, 3027, 29897, 13, 13, 1678, 396, 1583, 29889, 4294, 29918, 13168, 29918, 354, 271, 10339, 451, 2309, 13, 1678, 11451, 5317, 29889, 326, 4294, 29898, 2914, 29918, 3027, 7503, 29892, 584, 29892, 518, 29906, 29892, 29871, 29896, 29892, 29871, 29900, 24960, 13, 1678, 11451, 5317, 29889, 4294, 580, 13, 13, 1678, 396, 1473, 1967, 13, 1678, 1967, 29906, 353, 6699, 29918, 3027, 29898, 13, 4706, 3142, 2433, 1124, 597, 29888, 2817, 29946, 29889, 7959, 29888, 1406, 29878, 29889, 510, 29914, 29941, 29896, 29945, 29941, 29914, 29906, 29929, 29955, 29900, 29955, 29955, 29941, 29947, 29955, 29945, 29918, 29896, 29953, 29946, 29888, 29900, 29883, 29900, 29890, 29947, 29941, 29918, 29920, 29889, 6173, 1495, 13, 1678, 1967, 29906, 353, 1967, 29906, 29889, 21476, 3552, 29953, 29946, 29900, 29892, 29871, 29946, 29947, 29900, 511, 7084, 29889, 29933, 6227, 8895, 1718, 29897, 13, 1678, 1967, 29906, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 23749, 29889, 2378, 29898, 3027, 29906, 29897, 7503, 29892, 584, 29892, 518, 29906, 29892, 29871, 29896, 29892, 29871, 29900, 24960, 13, 1678, 1121, 29918, 3027, 29906, 353, 1889, 29918, 3027, 29918, 2541, 29918, 29873, 945, 287, 29918, 4299, 29898, 3027, 29906, 29897, 13, 13, 1678, 396, 1583, 29889, 4294, 29918, 13168, 29918, 354, 271, 10339, 451, 2309, 13, 1678, 11451, 5317, 29889, 326, 4294, 29898, 2914, 29918, 3027, 29906, 7503, 29892, 584, 29892, 518, 29906, 29892, 29871, 29896, 29892, 29871, 29900, 24960, 13, 1678, 11451, 5317, 29889, 4294, 580, 13, 2 ]
pymeasure/virtual/power_test_setup.py
tinix84/pymeasure
2
31752
class EfficiencyMeasurement(): # input_voltage = None # input_current = None # output_voltage = None # output_current = None # input_power = None # output_power = None # loss_power = None # efficiency = None def __init__(self, input_voltage: float, input_current: float, output_voltage: float, output_current: float): self.input_voltage = input_voltage self.input_current = input_current self.output_voltage = output_voltage self.output_current = output_current self.input_power = calc_power(voltage = input_voltage, current = input_current) self.output_power = calc_power(voltage = output_voltage, current = output_current) self.loss_power = calc_loss_power(input_power=self.input_power, ouput_power=self.output_power) class TsetPoint(): setup = None measurement = None #EfficiencyMeasurement() class TestSet_Efficiency(): def __init__(self, s: dict): self.source_bias = s['source_bias'] self.dut = s['powertrain'] self.load = s['load']
[ 1, 770, 382, 2416, 13396, 6816, 3745, 358, 7295, 13, 1678, 396, 1881, 29918, 1555, 29873, 482, 353, 6213, 13, 1678, 396, 1881, 29918, 3784, 353, 6213, 13, 1678, 396, 1962, 29918, 1555, 29873, 482, 353, 6213, 13, 1678, 396, 1962, 29918, 3784, 353, 6213, 13, 1678, 396, 1881, 29918, 13519, 353, 6213, 13, 1678, 396, 1962, 29918, 13519, 353, 6213, 13, 1678, 396, 6410, 29918, 13519, 353, 6213, 13, 1678, 396, 19201, 353, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1881, 29918, 1555, 29873, 482, 29901, 5785, 29892, 1881, 29918, 3784, 29901, 5785, 29892, 13, 462, 4706, 1962, 29918, 1555, 29873, 482, 29901, 5785, 29892, 1962, 29918, 3784, 29901, 5785, 1125, 13, 4706, 1583, 29889, 2080, 29918, 1555, 29873, 482, 353, 1881, 29918, 1555, 29873, 482, 13, 4706, 1583, 29889, 2080, 29918, 3784, 353, 1881, 29918, 3784, 13, 4706, 1583, 29889, 4905, 29918, 1555, 29873, 482, 353, 1962, 29918, 1555, 29873, 482, 13, 4706, 1583, 29889, 4905, 29918, 3784, 353, 1962, 29918, 3784, 13, 4706, 1583, 29889, 2080, 29918, 13519, 353, 22235, 29918, 13519, 29898, 1555, 29873, 482, 353, 1881, 29918, 1555, 29873, 482, 29892, 1857, 353, 1881, 29918, 3784, 29897, 13, 4706, 1583, 29889, 4905, 29918, 13519, 353, 22235, 29918, 13519, 29898, 1555, 29873, 482, 353, 1962, 29918, 1555, 29873, 482, 29892, 1857, 353, 1962, 29918, 3784, 29897, 13, 4706, 1583, 29889, 6758, 29918, 13519, 353, 22235, 29918, 6758, 29918, 13519, 29898, 2080, 29918, 13519, 29922, 1311, 29889, 2080, 29918, 13519, 29892, 2123, 649, 29918, 13519, 29922, 1311, 29889, 4905, 29918, 13519, 29897, 13, 13, 1990, 323, 842, 5228, 7295, 13, 1678, 6230, 353, 6213, 13, 1678, 20039, 353, 6213, 396, 29923, 2416, 13396, 6816, 3745, 358, 580, 13, 13, 1990, 4321, 2697, 29918, 29923, 2416, 13396, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 269, 29901, 9657, 1125, 13, 4706, 1583, 29889, 4993, 29918, 29890, 3173, 353, 269, 1839, 4993, 29918, 29890, 3173, 2033, 13, 4706, 1583, 29889, 29881, 329, 353, 269, 1839, 12248, 814, 6038, 2033, 13, 4706, 1583, 29889, 1359, 353, 269, 1839, 1359, 2033, 2 ]
dlm/metrics/accuracy.py
romainloiseau/deep-linear-shapes
20
119546
<gh_stars>10-100 from collections import OrderedDict import numpy as np from sklearn.metrics.cluster import normalized_mutual_info_score as nmi_score from scipy.optimize import linear_sum_assignment import torch from ..viz import plot_matrix from .basemetric import DiscreetMetric class Accuracy(DiscreetMetric): """ Compute the following scores: - global accuracy - mean accuracy - accuracy by class """ def __init__(self, classes, *args, **kwargs): self.names = ['global_acc', 'avg_acc'] if type(classes) is int: self.perclass_names = [f'acc_cls{i}' for i in range(classes)] self.n_classes = classes elif type(classes) is list: self.perclass_names = [f'acc_{c}' for c in classes] self.n_classes = len(classes) super(Accuracy, self).__init__(*args, **kwargs) def compute(self, best_assign_idx = None): if self.can_compute(): self.compute_confusion_matrix() acc = np.diag(self.matrix).sum() / self.matrix.sum() with np.errstate(divide='ignore', invalid='ignore'): acc_by_class = np.diag(self.matrix) / self.matrix.sum(axis=1) avg_acc = np.mean(np.nan_to_num(acc_by_class)) self.results = OrderedDict(zip(self.names, [acc, avg_acc])) self.detailed_results = OrderedDict(zip(self.perclass_names, acc_by_class.tolist())) self.reset() def compute_confusion_matrix(self): matrix = np.bincount(self.n_classes * self.true + self.pred, minlength=self.n_classes**2) self.matrix = matrix.reshape(self.n_classes, self.n_classes) def plot(self): plot_matrix(self.matrix) if __name__=="__main__": acc = Accuracy(10, 10) acc.update(np.random.randint(0, 10, 200), np.random.randint(0, 10, 200)) acc.compute() acc.plot() print(acc)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 29889, 2527, 10817, 29889, 19594, 1053, 4226, 1891, 29918, 6149, 950, 29918, 3888, 29918, 13628, 408, 302, 2460, 29918, 13628, 13, 3166, 4560, 2272, 29889, 20640, 675, 1053, 5608, 29918, 2083, 29918, 465, 10194, 13, 13, 5215, 4842, 305, 13, 13, 3166, 6317, 29894, 466, 1053, 6492, 29918, 5344, 13, 3166, 869, 6500, 21056, 2200, 1053, 3295, 1037, 300, 10095, 2200, 13, 13, 1990, 4831, 332, 4135, 29898, 4205, 1037, 300, 10095, 2200, 1125, 13, 1678, 9995, 13, 1678, 11796, 29872, 278, 1494, 19435, 29901, 13, 4706, 448, 5534, 13600, 13, 4706, 448, 2099, 13600, 13, 4706, 448, 13600, 491, 770, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4413, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 7039, 353, 6024, 10945, 29918, 5753, 742, 525, 485, 29887, 29918, 5753, 2033, 13, 308, 13, 4706, 565, 1134, 29898, 13203, 29897, 338, 938, 29901, 13, 9651, 1583, 29889, 546, 1990, 29918, 7039, 353, 518, 29888, 29915, 5753, 29918, 25932, 29912, 29875, 10162, 363, 474, 297, 3464, 29898, 13203, 4638, 13, 9651, 1583, 29889, 29876, 29918, 13203, 353, 4413, 13, 4706, 25342, 1134, 29898, 13203, 29897, 338, 1051, 29901, 13, 9651, 1583, 29889, 546, 1990, 29918, 7039, 353, 518, 29888, 29915, 5753, 648, 29883, 10162, 363, 274, 297, 4413, 29962, 13, 9651, 1583, 29889, 29876, 29918, 13203, 353, 7431, 29898, 13203, 29897, 13, 632, 13, 4706, 2428, 29898, 7504, 332, 4135, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 10272, 29898, 1311, 29892, 1900, 29918, 16645, 29918, 13140, 353, 6213, 1125, 13, 4706, 565, 1583, 29889, 3068, 29918, 26017, 7295, 13, 9651, 1583, 29889, 26017, 29918, 5527, 3958, 29918, 5344, 580, 13, 9651, 1035, 353, 7442, 29889, 6051, 351, 29898, 1311, 29889, 5344, 467, 2083, 580, 847, 1583, 29889, 5344, 29889, 2083, 580, 13, 13, 9651, 411, 7442, 29889, 3127, 3859, 29898, 4563, 680, 2433, 17281, 742, 8340, 2433, 17281, 29374, 13, 18884, 1035, 29918, 1609, 29918, 1990, 353, 7442, 29889, 6051, 351, 29898, 1311, 29889, 5344, 29897, 847, 1583, 29889, 5344, 29889, 2083, 29898, 8990, 29922, 29896, 29897, 13, 9651, 1029, 29887, 29918, 5753, 353, 7442, 29889, 12676, 29898, 9302, 29889, 13707, 29918, 517, 29918, 1949, 29898, 5753, 29918, 1609, 29918, 1990, 876, 13, 9651, 1583, 29889, 9902, 353, 8170, 287, 21533, 29898, 7554, 29898, 1311, 29889, 7039, 29892, 518, 5753, 29892, 1029, 29887, 29918, 5753, 12622, 13, 9651, 1583, 29889, 29881, 11881, 29918, 9902, 353, 8170, 287, 21533, 29898, 7554, 29898, 1311, 29889, 546, 1990, 29918, 7039, 29892, 1035, 29918, 1609, 29918, 1990, 29889, 25027, 391, 22130, 13, 9651, 1583, 29889, 12071, 580, 13, 268, 13, 1678, 822, 10272, 29918, 5527, 3958, 29918, 5344, 29898, 1311, 1125, 13, 4706, 4636, 353, 7442, 29889, 2109, 2798, 29898, 1311, 29889, 29876, 29918, 13203, 334, 1583, 29889, 3009, 718, 1583, 29889, 11965, 29892, 13, 462, 632, 1375, 2848, 29922, 1311, 29889, 29876, 29918, 13203, 1068, 29906, 29897, 13, 4706, 1583, 29889, 5344, 353, 4636, 29889, 690, 14443, 29898, 1311, 29889, 29876, 29918, 13203, 29892, 1583, 29889, 29876, 29918, 13203, 29897, 13, 632, 13, 1678, 822, 6492, 29898, 1311, 1125, 13, 4706, 6492, 29918, 5344, 29898, 1311, 29889, 5344, 29897, 13, 308, 13, 361, 4770, 978, 1649, 26359, 1649, 3396, 1649, 1115, 13, 268, 13, 1678, 1035, 353, 4831, 332, 4135, 29898, 29896, 29900, 29892, 29871, 29896, 29900, 29897, 13, 1678, 1035, 29889, 5504, 29898, 9302, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29906, 29900, 29900, 511, 13, 1669, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29906, 29900, 29900, 876, 13, 1678, 1035, 29889, 26017, 580, 13, 1678, 1035, 29889, 5317, 580, 13, 13, 1678, 1596, 29898, 5753, 29897, 2 ]
elena/emulators/workpiece_emulator.py
FYQ0919/Your_First_Decentralized_Application_Python
2
60571
<gh_stars>1-10 class Workpiece: def __init__(self, id): self.id = id # self.status = "awaiting production" self.status = "awaiting next step" self.actual_quality = None self.source = None self.sink = None self.location = "wc_0" # Starting point. Location refers to workcell id. self.step_idx = None self.pos = None self.count_down = 0
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 1990, 5244, 12343, 346, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1178, 1125, 13, 4706, 1583, 29889, 333, 353, 1178, 13, 4706, 396, 1583, 29889, 4882, 353, 376, 20675, 292, 5802, 29908, 13, 4706, 1583, 29889, 4882, 353, 376, 20675, 292, 2446, 4331, 29908, 13, 4706, 1583, 29889, 19304, 29918, 29567, 353, 6213, 13, 4706, 1583, 29889, 4993, 353, 6213, 13, 4706, 1583, 29889, 29879, 682, 353, 6213, 13, 4706, 1583, 29889, 5479, 353, 376, 29893, 29883, 29918, 29900, 29908, 259, 396, 23748, 1298, 29889, 17015, 14637, 304, 664, 3729, 1178, 29889, 13, 4706, 1583, 29889, 10568, 29918, 13140, 353, 6213, 13, 4706, 1583, 29889, 1066, 353, 6213, 13, 4706, 1583, 29889, 2798, 29918, 3204, 353, 29871, 29900, 13, 13, 13, 2 ]
innn/META_IPT_BD_TLS.py
mengban/traffic-src-spyder
0
67365
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 31 11:26:25 2018 @author: cadu """ print("66") import pandas as pd import numpy as np from sklearn import datasets, svm, metrics from sklearn import cross_validation import matplotlib.pyplot as plt import sys sys.path.append("../src") from data_prov2 import get_tt ## load data data_train,label_train=get_tt() ############################################ label_train = np.resize(label_train,(len(label_train),)) X_train,X_test,y_train,y_test=cross_validation.train_test_split(data_train,label_train,test_size=0.2) X_val,X_test,y_val,y_test=cross_validation.train_test_split(X_test,y_test,test_size=0.5) print(X_train.shape,X_val.shape,X_test.shape,y_test.shape) ############################################ def extract_batch_size(_train, step, batch_size):# Function to fetch a "batch_size" amount of data from "(X|y)_train" data. shape = list(_train.shape) #_X 7352 128 9 shape[0] = batch_size # 1500 128 9 batch_s = np.empty(shape) for i in range(batch_size): # Loop index index = ((step-1)*batch_size + i) % len(_train) # step=1 batch_s[i] = _train[index] return batch_s ############################################ import tensorflow as tf import tensorflow as tf x = tf.placeholder(tf.float32, [None, 671]) W = tf.Variable(tf.zeros([671, 8])) b = tf.Variable(tf.zeros([8])) y = tf.matmul(x, W) + b # Define loss and optimizer y_ = tf.placeholder(tf.int64, [None]) # The raw formulation of cross-entropy, # # tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(tf.nn.softmax(y)), # reduction_indices=[1])) # # can be numerically unstable. # # So here we use tf.losses.sparse_softmax_cross_entropy on the raw # outputs of 'y', and then average across the batch. cross_entropy = tf.losses.sparse_softmax_cross_entropy(labels=y_, logits=y) train_step = tf.train.GradientDescentOptimizer(0.5).minimize(cross_entropy) sess = tf.InteractiveSession() tf.global_variables_initializer().run() # Train batch_size=256 print_fre=10 for _ in range(1000): #batch_xs, batch_ys = mnist.train.next_batch(100) batch_xs = extract_batch_size(X_train,_ ,batch_size) batch_xss = extract_batch_size(X_test,_ ,batch_size) batch_ys = extract_batch_size(y_train,_,batch_size) batch_yss = extract_batch_size(y_test,_,batch_size) sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys}) # Test trained model correct_prediction = tf.equal(tf.argmax(y, 1), y_) accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) if _%print_fre==0: print(sess.run( accuracy, feed_dict={ x: batch_xss, y_: batch_yss })) print(sess.run( tf.argmax(y, 1), feed_dict={ x: batch_xss, y_: batch_yss }))
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 373, 498, 29884, 2610, 29871, 29941, 29896, 29871, 29896, 29896, 29901, 29906, 29953, 29901, 29906, 29945, 29871, 29906, 29900, 29896, 29947, 13, 13, 29992, 8921, 29901, 274, 13467, 13, 15945, 29908, 13, 13, 2158, 703, 29953, 29953, 1159, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 1053, 20035, 29892, 3731, 29885, 29892, 21556, 13, 3166, 2071, 19668, 1053, 4891, 29918, 18157, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 4397, 703, 6995, 4351, 1159, 13, 3166, 848, 29918, 16123, 29906, 1053, 679, 29918, 698, 13, 2277, 2254, 848, 13, 1272, 29918, 14968, 29892, 1643, 29918, 14968, 29922, 657, 29918, 698, 580, 13, 13383, 13383, 7346, 4136, 13, 1643, 29918, 14968, 353, 7442, 29889, 21476, 29898, 1643, 29918, 14968, 22657, 2435, 29898, 1643, 29918, 14968, 511, 876, 13, 29990, 29918, 14968, 29892, 29990, 29918, 1688, 29892, 29891, 29918, 14968, 29892, 29891, 29918, 1688, 29922, 19128, 29918, 18157, 29889, 14968, 29918, 1688, 29918, 5451, 29898, 1272, 29918, 14968, 29892, 1643, 29918, 14968, 29892, 1688, 29918, 2311, 29922, 29900, 29889, 29906, 29897, 13, 29990, 29918, 791, 29892, 29990, 29918, 1688, 29892, 29891, 29918, 791, 29892, 29891, 29918, 1688, 29922, 19128, 29918, 18157, 29889, 14968, 29918, 1688, 29918, 5451, 29898, 29990, 29918, 1688, 29892, 29891, 29918, 1688, 29892, 1688, 29918, 2311, 29922, 29900, 29889, 29945, 29897, 13, 2158, 29898, 29990, 29918, 14968, 29889, 12181, 29892, 29990, 29918, 791, 29889, 12181, 29892, 29990, 29918, 1688, 29889, 12181, 29892, 29891, 29918, 1688, 29889, 12181, 29897, 13, 13383, 13383, 7346, 4136, 13, 1753, 6597, 29918, 16175, 29918, 2311, 7373, 14968, 29892, 4331, 29892, 9853, 29918, 2311, 1125, 29937, 6680, 304, 6699, 263, 376, 16175, 29918, 2311, 29908, 5253, 310, 848, 515, 18227, 29990, 29989, 29891, 20344, 14968, 29908, 848, 29889, 29871, 13, 1678, 13, 1678, 8267, 353, 1051, 7373, 14968, 29889, 12181, 29897, 396, 29918, 29990, 259, 29955, 29941, 29945, 29906, 29871, 29896, 29906, 29947, 29871, 29929, 13, 1678, 8267, 29961, 29900, 29962, 353, 9853, 29918, 2311, 418, 396, 29871, 29896, 29945, 29900, 29900, 29871, 29896, 29906, 29947, 29871, 29929, 13, 1678, 9853, 29918, 29879, 353, 7442, 29889, 6310, 29898, 12181, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 16175, 29918, 2311, 1125, 13, 1678, 396, 21493, 2380, 13, 4706, 2380, 353, 5135, 10568, 29899, 29896, 11877, 16175, 29918, 2311, 718, 474, 29897, 1273, 7431, 7373, 14968, 29897, 396, 4331, 29922, 29896, 29871, 13, 4706, 9853, 29918, 29879, 29961, 29875, 29962, 353, 903, 14968, 29961, 2248, 29962, 29871, 13, 13, 1678, 736, 9853, 29918, 29879, 13, 13383, 13383, 7346, 4136, 13, 5215, 26110, 408, 15886, 13, 5215, 26110, 408, 15886, 13, 29916, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 518, 8516, 29892, 29871, 29953, 29955, 29896, 2314, 13, 29956, 353, 15886, 29889, 16174, 29898, 13264, 29889, 3298, 359, 4197, 29953, 29955, 29896, 29892, 29871, 29947, 12622, 13, 29890, 353, 15886, 29889, 16174, 29898, 13264, 29889, 3298, 359, 4197, 29947, 12622, 13, 29891, 353, 15886, 29889, 2922, 16109, 29898, 29916, 29892, 399, 29897, 718, 289, 13, 13, 29937, 22402, 6410, 322, 5994, 3950, 13, 29891, 29918, 353, 15886, 29889, 27074, 29898, 13264, 29889, 524, 29953, 29946, 29892, 518, 8516, 2314, 13, 13, 29937, 450, 10650, 883, 2785, 310, 4891, 29899, 296, 14441, 29892, 13, 29937, 13, 29937, 259, 15886, 29889, 17469, 29918, 12676, 6278, 13264, 29889, 17469, 29918, 2083, 29898, 29891, 29918, 334, 15886, 29889, 1188, 29898, 13264, 29889, 15755, 29889, 2695, 3317, 29898, 29891, 8243, 13, 29937, 462, 462, 20376, 29918, 513, 1575, 11759, 29896, 12622, 13, 29937, 13, 29937, 508, 367, 4825, 1711, 443, 13844, 29889, 13, 29937, 13, 29937, 1105, 1244, 591, 671, 15886, 29889, 6758, 267, 29889, 29879, 5510, 29918, 2695, 3317, 29918, 19128, 29918, 296, 14441, 373, 278, 10650, 13, 29937, 14391, 310, 525, 29891, 742, 322, 769, 6588, 4822, 278, 9853, 29889, 13, 19128, 29918, 296, 14441, 353, 15886, 29889, 6758, 267, 29889, 29879, 5510, 29918, 2695, 3317, 29918, 19128, 29918, 296, 14441, 29898, 21134, 29922, 29891, 3383, 1480, 1169, 29922, 29891, 29897, 13, 14968, 29918, 10568, 353, 15886, 29889, 14968, 29889, 25584, 993, 4002, 1760, 20624, 326, 3950, 29898, 29900, 29889, 29945, 467, 1195, 326, 675, 29898, 19128, 29918, 296, 14441, 29897, 13, 13, 29879, 404, 353, 15886, 29889, 4074, 4925, 7317, 580, 13, 13264, 29889, 10945, 29918, 20897, 29918, 11228, 3950, 2141, 3389, 580, 13, 29937, 28186, 13, 16175, 29918, 2311, 29922, 29906, 29945, 29953, 13, 2158, 29918, 10745, 29922, 29896, 29900, 13, 1454, 903, 297, 3464, 29898, 29896, 29900, 29900, 29900, 1125, 13, 1678, 396, 16175, 29918, 10351, 29892, 9853, 29918, 952, 353, 28597, 391, 29889, 14968, 29889, 4622, 29918, 16175, 29898, 29896, 29900, 29900, 29897, 13, 1678, 9853, 29918, 10351, 353, 6597, 29918, 16175, 29918, 2311, 29898, 29990, 29918, 14968, 29892, 29918, 1919, 16175, 29918, 2311, 29897, 13, 1678, 9853, 29918, 29916, 893, 353, 6597, 29918, 16175, 29918, 2311, 29898, 29990, 29918, 1688, 29892, 29918, 1919, 16175, 29918, 2311, 29897, 13, 1678, 9853, 29918, 952, 353, 6597, 29918, 16175, 29918, 2311, 29898, 29891, 29918, 14968, 29892, 3383, 16175, 29918, 2311, 29897, 13, 1678, 9853, 29918, 29891, 893, 353, 6597, 29918, 16175, 29918, 2311, 29898, 29891, 29918, 1688, 29892, 3383, 16175, 29918, 2311, 29897, 13, 1678, 27937, 29889, 3389, 29898, 14968, 29918, 10568, 29892, 8343, 29918, 8977, 3790, 29916, 29901, 9853, 29918, 10351, 29892, 343, 29918, 29901, 9853, 29918, 952, 1800, 13, 13, 1678, 396, 4321, 16370, 1904, 13, 1678, 1959, 29918, 11965, 2463, 353, 15886, 29889, 11745, 29898, 13264, 29889, 1191, 3317, 29898, 29891, 29892, 29871, 29896, 511, 343, 19925, 13, 1678, 13600, 353, 15886, 29889, 17469, 29918, 12676, 29898, 13264, 29889, 4384, 29898, 15728, 29918, 11965, 2463, 29892, 15886, 29889, 7411, 29941, 29906, 876, 13, 1678, 565, 903, 29995, 2158, 29918, 10745, 1360, 29900, 29901, 13, 4706, 1596, 29898, 29879, 404, 29889, 3389, 29898, 13, 3986, 13600, 29892, 8343, 29918, 8977, 3790, 13, 795, 921, 29901, 9853, 29918, 29916, 893, 29892, 13, 795, 343, 29918, 29901, 9853, 29918, 29891, 893, 13, 4706, 500, 876, 13, 4706, 1596, 29898, 29879, 404, 29889, 3389, 29898, 13, 3986, 15886, 29889, 1191, 3317, 29898, 29891, 29892, 29871, 29896, 511, 8343, 29918, 8977, 3790, 13, 795, 921, 29901, 9853, 29918, 29916, 893, 29892, 13, 795, 343, 29918, 29901, 9853, 29918, 29891, 893, 13, 4706, 500, 876, 13, 268, 2 ]
src/gridemissions/scripts/ampd.py
elijahjpassmore/gridemissions
4
175876
<reponame>elijahjpassmore/gridemissions import os from os.path import join import pandas as pd import argparse import logging.config from gridemissions import config from gridemissions.ampd import AMPD_download, extract_state def main(): # Parse command-line arguments argparser = argparse.ArgumentParser() argparser.add_argument("--job", default="d", help="Which job to run") argparser.add_argument("--state", default="all", help="Which state to process") argparser.add_argument("--year", default="all", help="Which year to process") args = argparser.parse_args() logger = logging.getLogger("scraper") DATA_PATH = config["DATA_PATH"] # Download data if args.job == "d": if args.year == "all": raise NotImplemented("Not done yet") count_timed_out = 0 status = "timedout" y = int(args.year) while status == "timedout": ampd = AMPD_download(os.path.join(DATA_PATH, "raw", "AMPD")) ampd.login() ampd.getStatus(y) status = ampd.download(y) if status == "timed_out": count_timed_out += 1 if count_timed_out > 5: raise ValueError("Too many timeouts") ampd.close() if args.job == "e": if args.state == "all": raise NotImplemented("Not done yet") if args.year == "all": year_lst = ["2015", "2016", "2017", "2018", "2019"] else: year_lst = [args.year] for year in year_lst: path_in = join(config["DATA_PATH"], "raw", "AMPD", year) path_out = join(config["DATA_PATH"], "analysis", "AMPD") os.makedirs(path_out, exist_ok=True) extract_state((path_in, path_out, year, args.state))
[ 1, 529, 276, 1112, 420, 29958, 3875, 801, 29926, 3364, 5514, 29914, 29887, 374, 2310, 6847, 13, 5215, 2897, 13, 3166, 2897, 29889, 2084, 1053, 5988, 13, 5215, 11701, 408, 10518, 13, 5215, 1852, 5510, 13, 5215, 12183, 29889, 2917, 13, 3166, 330, 374, 2310, 6847, 1053, 2295, 13, 3166, 330, 374, 2310, 6847, 29889, 1160, 29881, 1053, 319, 3580, 29928, 29918, 10382, 29892, 6597, 29918, 3859, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 396, 20969, 1899, 29899, 1220, 6273, 13, 1678, 1852, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 1852, 16680, 29889, 1202, 29918, 23516, 703, 489, 9057, 613, 2322, 543, 29881, 613, 1371, 543, 8809, 436, 4982, 304, 1065, 1159, 13, 1678, 1852, 16680, 29889, 1202, 29918, 23516, 703, 489, 3859, 613, 2322, 543, 497, 613, 1371, 543, 8809, 436, 2106, 304, 1889, 1159, 13, 1678, 1852, 16680, 29889, 1202, 29918, 23516, 703, 489, 6360, 613, 2322, 543, 497, 613, 1371, 543, 8809, 436, 1629, 304, 1889, 1159, 13, 1678, 6389, 353, 1852, 16680, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 17927, 353, 12183, 29889, 657, 16363, 703, 1557, 336, 546, 1159, 13, 1678, 360, 8254, 29918, 10145, 353, 2295, 3366, 14573, 29918, 10145, 3108, 13, 13, 1678, 396, 25553, 848, 13, 1678, 565, 6389, 29889, 9057, 1275, 376, 29881, 1115, 13, 4706, 565, 6389, 29889, 6360, 1275, 376, 497, 1115, 13, 9651, 12020, 2216, 1888, 2037, 287, 703, 3664, 2309, 3447, 1159, 13, 4706, 2302, 29918, 9346, 287, 29918, 449, 353, 29871, 29900, 13, 4706, 4660, 353, 376, 9346, 287, 449, 29908, 13, 4706, 343, 353, 938, 29898, 5085, 29889, 6360, 29897, 13, 4706, 1550, 4660, 1275, 376, 9346, 287, 449, 1115, 13, 9651, 626, 15926, 353, 319, 3580, 29928, 29918, 10382, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 10145, 29892, 376, 1610, 613, 376, 19297, 29928, 5783, 13, 9651, 626, 15926, 29889, 7507, 580, 13, 9651, 626, 15926, 29889, 657, 5709, 29898, 29891, 29897, 13, 9651, 4660, 353, 626, 15926, 29889, 10382, 29898, 29891, 29897, 13, 9651, 565, 4660, 1275, 376, 9346, 287, 29918, 449, 1115, 13, 18884, 2302, 29918, 9346, 287, 29918, 449, 4619, 29871, 29896, 13, 9651, 565, 2302, 29918, 9346, 287, 29918, 449, 1405, 29871, 29945, 29901, 13, 18884, 12020, 7865, 2392, 703, 1762, 29877, 1784, 11815, 29879, 1159, 13, 9651, 626, 15926, 29889, 5358, 580, 13, 13, 1678, 565, 6389, 29889, 9057, 1275, 376, 29872, 1115, 13, 4706, 565, 6389, 29889, 3859, 1275, 376, 497, 1115, 13, 9651, 12020, 2216, 1888, 2037, 287, 703, 3664, 2309, 3447, 1159, 13, 4706, 565, 6389, 29889, 6360, 1275, 376, 497, 1115, 13, 9651, 1629, 29918, 20155, 353, 6796, 29906, 29900, 29896, 29945, 613, 376, 29906, 29900, 29896, 29953, 613, 376, 29906, 29900, 29896, 29955, 613, 376, 29906, 29900, 29896, 29947, 613, 376, 29906, 29900, 29896, 29929, 3108, 13, 4706, 1683, 29901, 13, 9651, 1629, 29918, 20155, 353, 518, 5085, 29889, 6360, 29962, 13, 13, 4706, 363, 1629, 297, 1629, 29918, 20155, 29901, 13, 9651, 2224, 29918, 262, 353, 5988, 29898, 2917, 3366, 14573, 29918, 10145, 12436, 376, 1610, 613, 376, 19297, 29928, 613, 1629, 29897, 13, 9651, 2224, 29918, 449, 353, 5988, 29898, 2917, 3366, 14573, 29918, 10145, 12436, 376, 15916, 613, 376, 19297, 29928, 1159, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 2084, 29918, 449, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 9651, 6597, 29918, 3859, 3552, 2084, 29918, 262, 29892, 2224, 29918, 449, 29892, 1629, 29892, 6389, 29889, 3859, 876, 13, 2 ]
Leetcode/1000-2000/1202. Smallest String With Swaps/1202.py
Next-Gen-UI/Code-Dynamics
0
174222
<filename>Leetcode/1000-2000/1202. Smallest String With Swaps/1202.py class UF: def __init__(self, n: int): self.id = list(range(n)) def union(self, u: int, v: int) -> None: self.id[self.find(u)] = self.find(v) def find(self, u: int) -> int: if self.id[u] != u: self.id[u] = self.find(self.id[u]) return self.id[u] class Solution: def smallestStringWithSwaps(self, s: str, pairs: List[List[int]]) -> str: ans = '' uf = UF(len(s)) map = defaultdict(list) for p, q in pairs: uf.union(p, q) for i in range(len(s)): map[uf.find(i)].append(s[i]) for key in map.keys(): map[key].sort(reverse=True) for i in range(len(s)): ans += map[uf.find(i)].pop() return ans
[ 1, 529, 9507, 29958, 3226, 300, 401, 29914, 29896, 29900, 29900, 29900, 29899, 29906, 29900, 29900, 29900, 29914, 29896, 29906, 29900, 29906, 29889, 18285, 342, 1714, 2973, 3925, 2547, 29914, 29896, 29906, 29900, 29906, 29889, 2272, 13, 1990, 501, 29943, 29901, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 302, 29901, 938, 1125, 13, 1678, 1583, 29889, 333, 353, 1051, 29898, 3881, 29898, 29876, 876, 13, 13, 29871, 822, 9833, 29898, 1311, 29892, 318, 29901, 938, 29892, 325, 29901, 938, 29897, 1599, 6213, 29901, 13, 1678, 1583, 29889, 333, 29961, 1311, 29889, 2886, 29898, 29884, 4638, 353, 1583, 29889, 2886, 29898, 29894, 29897, 13, 13, 29871, 822, 1284, 29898, 1311, 29892, 318, 29901, 938, 29897, 1599, 938, 29901, 13, 1678, 565, 1583, 29889, 333, 29961, 29884, 29962, 2804, 318, 29901, 13, 418, 1583, 29889, 333, 29961, 29884, 29962, 353, 1583, 29889, 2886, 29898, 1311, 29889, 333, 29961, 29884, 2314, 13, 1678, 736, 1583, 29889, 333, 29961, 29884, 29962, 13, 13, 13, 1990, 24380, 29901, 13, 29871, 822, 19087, 1231, 3047, 10840, 2547, 29898, 1311, 29892, 269, 29901, 851, 29892, 11000, 29901, 2391, 29961, 1293, 29961, 524, 24960, 1599, 851, 29901, 13, 1678, 6063, 353, 6629, 13, 1678, 318, 29888, 353, 501, 29943, 29898, 2435, 29898, 29879, 876, 13, 1678, 2910, 353, 2322, 8977, 29898, 1761, 29897, 13, 13, 1678, 363, 282, 29892, 3855, 297, 11000, 29901, 13, 418, 318, 29888, 29889, 13094, 29898, 29886, 29892, 3855, 29897, 13, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29879, 22164, 13, 418, 2910, 29961, 1137, 29889, 2886, 29898, 29875, 29897, 1822, 4397, 29898, 29879, 29961, 29875, 2314, 13, 13, 1678, 363, 1820, 297, 2910, 29889, 8149, 7295, 13, 418, 2910, 29961, 1989, 1822, 6605, 29898, 24244, 29922, 5574, 29897, 13, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29879, 22164, 13, 418, 6063, 4619, 2910, 29961, 1137, 29889, 2886, 29898, 29875, 29897, 1822, 7323, 580, 13, 13, 1678, 736, 6063, 13, 2 ]
src/waldur_core/core/migrations/0003_enlarge_username.py
geant-multicloud/MCMS-mastermind
26
166176
# Generated by Django 1.11.13 on 2018-09-11 14:40 import re import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('core', '0002_remove_organization'), ] operations = [ migrations.AlterField( model_name='user', name='username', field=models.CharField( help_text='Required. 128 characters or fewer. Letters, numbers and @/./+/-/_ characters', max_length=128, unique=True, validators=[ django.core.validators.RegexValidator( re.compile('^[\\w.@+-]+$'), 'Enter a valid username.', 'invalid' ) ], verbose_name='username', ), ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29896, 29889, 29896, 29896, 29889, 29896, 29941, 373, 29871, 29906, 29900, 29896, 29947, 29899, 29900, 29929, 29899, 29896, 29896, 29871, 29896, 29946, 29901, 29946, 29900, 13, 5215, 337, 13, 13, 5215, 9557, 29889, 3221, 29889, 3084, 4097, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 3221, 742, 525, 29900, 29900, 29900, 29906, 29918, 5992, 29918, 6388, 2133, 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, 1792, 742, 13, 9651, 1024, 2433, 6786, 742, 13, 9651, 1746, 29922, 9794, 29889, 27890, 29898, 13, 18884, 1371, 29918, 726, 2433, 19347, 29889, 29871, 29896, 29906, 29947, 4890, 470, 28145, 29889, 2803, 2153, 29892, 3694, 322, 732, 6294, 29914, 29974, 24028, 19891, 4890, 742, 13, 18884, 4236, 29918, 2848, 29922, 29896, 29906, 29947, 29892, 13, 18884, 5412, 29922, 5574, 29892, 13, 18884, 2854, 4097, 11759, 13, 462, 1678, 9557, 29889, 3221, 29889, 3084, 4097, 29889, 4597, 735, 24204, 29898, 13, 462, 4706, 337, 29889, 12198, 877, 29985, 29961, 1966, 29893, 21240, 29974, 29899, 10062, 29938, 5477, 525, 10399, 263, 2854, 8952, 29889, 742, 525, 20965, 29915, 13, 462, 1678, 1723, 13, 18884, 21251, 13, 18884, 26952, 29918, 978, 2433, 6786, 742, 13, 9651, 10353, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
documentation/tutorial/service_v5.py
F-Secure/resource-api
10
153954
import shelve import os import re from resource_api.interfaces import Resource as BaseResource, Link as BaseLink, AbstractUriPolicy from resource_api.schema import StringField, DateTimeField, IntegerField from resource_api.service import Service from resource_api.errors import ValidationError RE_SHA1 = re.compile("^[a-f0-9]{40}$") SHELVE_PATH = "/tmp/school.shelve.db" class User(object): def __init__(self, email=None): if email is None: self.is_anonymous = True else: self.is_anonymous = False if email == "<EMAIL>": self.is_admin = True else: self.is_admin = False self.email = email class ShelveService(Service): def __init__(self): super(ShelveService, self).__init__() self._storage = shelve.open(SHELVE_PATH, writeback=True) def _get_context(self): return {"storage": self._storage, "service": self} def _get_user(self, data): if data is None: return User(None) else: return User(data.get("email")) def __del__(self): self._storage.close() class Resource(BaseResource): def __init__(self, context): super(Resource, self).__init__(context) self._storage = context["storage"] def exists(self, user, pk): return pk in self._storage.get(self.get_name(), {}) def get_data(self, user, pk): return self._storage.get(self.get_name(), {}).get(pk) def delete(self, user, pk): self._storage.get(self.get_name(), {}).pop(pk) self._storage.sync() def create(self, user, pk, data): if self.get_name() not in self._storage: self._storage[self.get_name()] = {} self._storage[self.get_name()][pk] = data self._storage.sync() def update(self, user, pk, data): self._storage[self.get_name()][pk].update(data) self._storage.sync() def get_uris(self, user, params=None): return self._storage.get(self.get_name(), {}).keys() def get_count(self, user, params=None): return len(self.get_uris(params)) def can_get_data(self, user, pk, data): """ Only authenticated users can access data """ if user.is_anonymous: return False else: return True def can_get_uris(self, user): """ Only authenticated users can access data """ if user.is_anonymous: return False else: return True class Link(BaseLink): def __init__(self, context): super(Link, self).__init__(context) self._storage = context["storage"] def exists(self, user, pk, rel_pk): return rel_pk in self._storage.get((pk, self.get_name()), {}) def get_data(self, user, pk, rel_pk): return self._storage.get((pk, self.get_name()), {}).get(rel_pk) def create(self, user, pk, rel_pk, data=None): key = (pk, self.get_name()) if key not in self._storage: self._storage[key] = {} self._storage[key][rel_pk] = data self._storage.sync() def update(self, user, pk, rel_pk, data): self._storage[key][rel_pk].update(data) self._storage.sync() def delete(self, user, pk, rel_pk): self._storage.get((pk, self.get_name()), {}).pop(rel_pk) self._storage.sync() def get_uris(self, user, pk, params=None): return self._storage.get((pk, self.get_name()), {}).keys() def get_count(self, user, pk, params=None): return len(self.get_uris(pk, params)) def can_get_data(self, user, pk, rel_pk, data): """ Only authenticated users can access data """ if user.is_anonymous: return False else: return True def can_get_uris(self, user, pk): """ Only authenticated users can access data """ if user.is_anonymous: return False else: return True class Person(Resource): class Schema: email = StringField(regex="[^@]+@[^@]+\.[^@]+", pk=True, description="Addess to which the notifications shall be sent") first_name = StringField(description="Given name(s)") last_name = StringField(description="Family name(s)") def can_update(self, user, pk): """ Only a person himself can update his own information """ return user.email == pk or user.is_admin def can_delete(self, user, pk): """ Only admins can delete people """ return user.is_admin class Student(Person): """ A pupil """ class Schema(Person.Schema): birthday = DateTimeField() class Links: class courses(Link): """ Courses the student has ever attended """ target = "Course" related_name = "students" master = True class Schema: grade = IntegerField(min_val=1, max_val=5) def _is_course_teacher(self, user, pk, rel_pk): """ Only teachers can add/remove students to/from courses and grade them. And they can do it with their courses ONLY. """ if user.is_admin: return True teacher_data = self._storage.get(Teacher.get_name(), {}).get(user.email) if teacher_data is None: return False else: teacher_courses = self._storage.get((user.email, Teacher.Links.courses.get_name()), {}) return rel_pk in teacher_courses def can_create(self, user, pk, rel_pk, data=None): return self._is_course_teacher(user, pk, rel_pk) can_update = can_create can_delete = _is_course_teacher class comments(Link): """ Comments made by the student """ target = "Comment" related_name = "student" class ratings(Link): """ Ratings given by the student """ target = "TeacherRating" related_name = "student" class Teacher(Person): """ A lecturer """ class Schema(Person.Schema): category = StringField(description="TQS Category", choices=["four", "five", "five plus", "six"]) class Links: class ratings(Link): """ Ratings given to the teacher """ target = "TeacherRating" related_name = "teacher" class courses(Link): """ Courses the teacher is responsible for """ target = "Course" related_name = "teacher" class PersonalLink(Link): """ Users can link things to their accounts only """ def can_update(self, user, pk, rel_pk, data): return user.email == rel_pk or user.is_admin def can_create(self, user, pk, rel_pk, data): return user.email == rel_pk or user.is_admin def can_delete(self, user, pk, rel_pk): return user.email == rel_pk or user.is_admin class Course(Resource): """ An educational unit represinting the lessons for a specific set of topics """ class Schema: name = StringField(pk=True, description="Name of the course. E.g. physics, maths.") duration = IntegerField(description="Length of the course in weeks") class Links: class teacher(PersonalLink): """ The lecturer of the course """ target = "Teacher" related_name = "courses" cardinality = Link.cardinalities.ONE master = True required = True class comments(Link): """ All comments made about the course """ target = "Comment" related_name = "course" class ratings(Link): """ All ratings that were given to the teachers of the specific course """ target = "TeacherRating" related_name = "course" class students(Link): """ All pupils who attend the course """ target = "Student" related_name = "courses" class AutoGenSha1UriPolicy(AbstractUriPolicy): """ Uses a randomly generated sha1 as a primary key """ @property def type(self): return "autogen_policy" def generate_pk(self, data): return os.urandom(16).encode('hex') def serialize(self, pk): return pk def deserialize(self, pk): if not isinstance(pk, basestring): raise ValidationError("Has to be string") if not RE_SHA1.match(value): raise ValidationError("PK is not a valid SHA1") return pk class Comment(Resource): """ Student's comment about the course """ UriPolicy = AutoGenSha1UriPolicy class Schema: pk = StringField(pk=True, description="Identifier of the resource") value = StringField(description="Text of the comment") creation_time = DateTimeField(description="Time when the comment was added (for sorting purpose)") class Links: class student(PersonalLink): """ The pupil who made the comment """ target = "Student" related_name = "comments" cardinality = Link.cardinalities.ONE master = True required = True def can_delete(self, user, pk, rel_pk): """ It does not make any sense to let anyone touch the comment's student once it is created """ return False class course(Link): """ The subject the comment was made about """ target = "Course" related_name = "comments" cardinality = Link.cardinalities.ONE master = True required = True def can_delete(self, user, pk, rel_pk): """ It does not make any sense to let anyone touch the comment's course once it is created """ return False class TeacherRating(Resource): """ Student's rating about teacher's performance """ UriPolicy = AutoGenSha1UriPolicy class Schema: pk = StringField(pk=True, description="Identifier of the resource") value = IntegerField(min_val=0, max_val=100, description="Lecturer's performance identifier ") creation_time = DateTimeField(description="Time when the rating was added (for sorting purpose)") class Links: class student(PersonalLink): """ The pupil who gave the rating to the teacher """ target = "Student" related_name = "ratings" cardinality = Link.cardinalities.ONE master = True required = True def can_delete(self, user, pk, rel_pk): """ It does not make any sense to let anyone touch the rating's student once it is created """ return False class course(Link): """ The subject with respect to which the rating was given """ target = "Course" related_name = "ratings" cardinality = Link.cardinalities.ONE master = True required = True def can_delete(self, user, pk, rel_pk): """ It does not make any sense to let anyone touch the ratings's course once it is created """ return False class teacher(Link): """ The lecturer to whom the rating is related """ target = "Teacher" related_name = "ratings" cardinality = Link.cardinalities.ONE master = True required = True def can_delete(self, user, pk, rel_pk): """ It does not make any sense to let anyone touch the rating's teacher once it is created """ return False srv = ShelveService() srv.register(Student) srv.register(Teacher) srv.register(Course) srv.register(Comment) srv.register(TeacherRating) srv.setup()
[ 1, 1053, 528, 13841, 13, 5215, 2897, 13, 5215, 337, 13, 13, 3166, 6503, 29918, 2754, 29889, 1639, 8726, 1053, 18981, 408, 7399, 6848, 29892, 6645, 408, 7399, 6595, 29892, 25513, 14702, 15644, 13, 3166, 6503, 29918, 2754, 29889, 11010, 1053, 1714, 3073, 29892, 12315, 3073, 29892, 8102, 3073, 13, 3166, 6503, 29918, 2754, 29889, 5509, 1053, 6692, 13, 3166, 6503, 29918, 2754, 29889, 12523, 1053, 15758, 362, 2392, 13, 13, 13, 1525, 29918, 23498, 29896, 353, 337, 29889, 12198, 703, 29985, 29961, 29874, 29899, 29888, 29900, 29899, 29929, 3199, 29946, 29900, 1042, 1159, 13, 7068, 6670, 12064, 29918, 10145, 353, 5591, 7050, 29914, 27041, 29889, 845, 13841, 29889, 2585, 29908, 13, 13, 13, 1990, 4911, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4876, 29922, 8516, 1125, 13, 13, 4706, 565, 4876, 338, 6213, 29901, 13, 9651, 1583, 29889, 275, 29918, 25772, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 275, 29918, 25772, 353, 7700, 13, 13, 4706, 565, 4876, 1275, 9872, 26862, 6227, 29958, 1115, 13, 9651, 1583, 29889, 275, 29918, 6406, 353, 5852, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 275, 29918, 6406, 353, 7700, 13, 13, 4706, 1583, 29889, 5269, 353, 4876, 13, 13, 13, 1990, 1383, 13841, 3170, 29898, 3170, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 2713, 13841, 3170, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 3032, 12925, 353, 528, 13841, 29889, 3150, 29898, 7068, 6670, 12064, 29918, 10145, 29892, 2436, 1627, 29922, 5574, 29897, 13, 13, 1678, 822, 903, 657, 29918, 4703, 29898, 1311, 1125, 13, 4706, 736, 8853, 12925, 1115, 1583, 3032, 12925, 29892, 376, 5509, 1115, 1583, 29913, 13, 13, 1678, 822, 903, 657, 29918, 1792, 29898, 1311, 29892, 848, 1125, 13, 4706, 565, 848, 338, 6213, 29901, 13, 9651, 736, 4911, 29898, 8516, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 4911, 29898, 1272, 29889, 657, 703, 5269, 5783, 13, 13, 1678, 822, 4770, 6144, 12035, 1311, 1125, 13, 4706, 1583, 3032, 12925, 29889, 5358, 580, 13, 13, 13, 1990, 18981, 29898, 5160, 6848, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3030, 1125, 13, 4706, 2428, 29898, 6848, 29892, 1583, 467, 1649, 2344, 12035, 4703, 29897, 13, 4706, 1583, 3032, 12925, 353, 3030, 3366, 12925, 3108, 13, 13, 1678, 822, 4864, 29898, 1311, 29892, 1404, 29892, 282, 29895, 1125, 13, 4706, 736, 282, 29895, 297, 1583, 3032, 12925, 29889, 657, 29898, 1311, 29889, 657, 29918, 978, 3285, 426, 1800, 13, 13, 1678, 822, 679, 29918, 1272, 29898, 1311, 29892, 1404, 29892, 282, 29895, 1125, 13, 4706, 736, 1583, 3032, 12925, 29889, 657, 29898, 1311, 29889, 657, 29918, 978, 3285, 6571, 467, 657, 29898, 20571, 29897, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 1404, 29892, 282, 29895, 1125, 13, 4706, 1583, 3032, 12925, 29889, 657, 29898, 1311, 29889, 657, 29918, 978, 3285, 6571, 467, 7323, 29898, 20571, 29897, 13, 4706, 1583, 3032, 12925, 29889, 16593, 580, 13, 13, 1678, 822, 1653, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 848, 1125, 13, 4706, 565, 1583, 29889, 657, 29918, 978, 580, 451, 297, 1583, 3032, 12925, 29901, 13, 9651, 1583, 3032, 12925, 29961, 1311, 29889, 657, 29918, 978, 580, 29962, 353, 6571, 13, 4706, 1583, 3032, 12925, 29961, 1311, 29889, 657, 29918, 978, 580, 3816, 20571, 29962, 353, 848, 13, 4706, 1583, 3032, 12925, 29889, 16593, 580, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 848, 1125, 13, 4706, 1583, 3032, 12925, 29961, 1311, 29889, 657, 29918, 978, 580, 3816, 20571, 1822, 5504, 29898, 1272, 29897, 13, 4706, 1583, 3032, 12925, 29889, 16593, 580, 13, 13, 1678, 822, 679, 29918, 332, 275, 29898, 1311, 29892, 1404, 29892, 8636, 29922, 8516, 1125, 13, 4706, 736, 1583, 3032, 12925, 29889, 657, 29898, 1311, 29889, 657, 29918, 978, 3285, 6571, 467, 8149, 580, 13, 13, 1678, 822, 679, 29918, 2798, 29898, 1311, 29892, 1404, 29892, 8636, 29922, 8516, 1125, 13, 4706, 736, 7431, 29898, 1311, 29889, 657, 29918, 332, 275, 29898, 7529, 876, 13, 13, 1678, 822, 508, 29918, 657, 29918, 1272, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 848, 1125, 13, 4706, 9995, 9333, 15585, 630, 4160, 508, 2130, 848, 9995, 13, 4706, 565, 1404, 29889, 275, 29918, 25772, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 5852, 13, 13, 1678, 822, 508, 29918, 657, 29918, 332, 275, 29898, 1311, 29892, 1404, 1125, 13, 4706, 9995, 9333, 15585, 630, 4160, 508, 2130, 848, 9995, 13, 4706, 565, 1404, 29889, 275, 29918, 25772, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 5852, 13, 13, 13, 1990, 6645, 29898, 5160, 6595, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3030, 1125, 13, 4706, 2428, 29898, 6595, 29892, 1583, 467, 1649, 2344, 12035, 4703, 29897, 13, 4706, 1583, 3032, 12925, 353, 3030, 3366, 12925, 3108, 13, 13, 1678, 822, 4864, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 4706, 736, 1104, 29918, 20571, 297, 1583, 3032, 12925, 29889, 657, 3552, 20571, 29892, 1583, 29889, 657, 29918, 978, 25739, 426, 1800, 13, 13, 1678, 822, 679, 29918, 1272, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 4706, 736, 1583, 3032, 12925, 29889, 657, 3552, 20571, 29892, 1583, 29889, 657, 29918, 978, 25739, 6571, 467, 657, 29898, 2674, 29918, 20571, 29897, 13, 13, 1678, 822, 1653, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 29892, 848, 29922, 8516, 1125, 13, 4706, 1820, 353, 313, 20571, 29892, 1583, 29889, 657, 29918, 978, 3101, 13, 4706, 565, 1820, 451, 297, 1583, 3032, 12925, 29901, 13, 9651, 1583, 3032, 12925, 29961, 1989, 29962, 353, 6571, 13, 4706, 1583, 3032, 12925, 29961, 1989, 3816, 2674, 29918, 20571, 29962, 353, 848, 13, 4706, 1583, 3032, 12925, 29889, 16593, 580, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 29892, 848, 1125, 13, 4706, 1583, 3032, 12925, 29961, 1989, 3816, 2674, 29918, 20571, 1822, 5504, 29898, 1272, 29897, 13, 4706, 1583, 3032, 12925, 29889, 16593, 580, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 4706, 1583, 3032, 12925, 29889, 657, 3552, 20571, 29892, 1583, 29889, 657, 29918, 978, 25739, 6571, 467, 7323, 29898, 2674, 29918, 20571, 29897, 13, 4706, 1583, 3032, 12925, 29889, 16593, 580, 13, 13, 1678, 822, 679, 29918, 332, 275, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 8636, 29922, 8516, 1125, 13, 4706, 736, 1583, 3032, 12925, 29889, 657, 3552, 20571, 29892, 1583, 29889, 657, 29918, 978, 25739, 6571, 467, 8149, 580, 13, 13, 1678, 822, 679, 29918, 2798, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 8636, 29922, 8516, 1125, 13, 4706, 736, 7431, 29898, 1311, 29889, 657, 29918, 332, 275, 29898, 20571, 29892, 8636, 876, 13, 13, 1678, 822, 508, 29918, 657, 29918, 1272, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 29892, 848, 1125, 13, 4706, 9995, 9333, 15585, 630, 4160, 508, 2130, 848, 9995, 13, 4706, 565, 1404, 29889, 275, 29918, 25772, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 5852, 13, 13, 1678, 822, 508, 29918, 657, 29918, 332, 275, 29898, 1311, 29892, 1404, 29892, 282, 29895, 1125, 13, 4706, 9995, 9333, 15585, 630, 4160, 508, 2130, 848, 9995, 13, 4706, 565, 1404, 29889, 275, 29918, 25772, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 5852, 13, 13, 13, 1990, 5196, 29898, 6848, 1125, 13, 13, 1678, 770, 1102, 2603, 29901, 13, 4706, 4876, 353, 1714, 3073, 29898, 13087, 543, 22896, 29992, 10062, 29992, 22896, 29992, 29962, 3124, 7226, 29985, 29992, 10062, 613, 282, 29895, 29922, 5574, 29892, 13, 462, 9651, 6139, 543, 2528, 404, 304, 607, 278, 25913, 4091, 367, 2665, 1159, 13, 4706, 937, 29918, 978, 353, 1714, 3073, 29898, 8216, 543, 29954, 5428, 1024, 29898, 29879, 25760, 13, 4706, 1833, 29918, 978, 353, 1714, 3073, 29898, 8216, 543, 27104, 1024, 29898, 29879, 25760, 13, 13, 1678, 822, 508, 29918, 5504, 29898, 1311, 29892, 1404, 29892, 282, 29895, 1125, 13, 4706, 9995, 9333, 263, 2022, 3654, 508, 2767, 670, 1914, 2472, 9995, 13, 4706, 736, 1404, 29889, 5269, 1275, 282, 29895, 470, 1404, 29889, 275, 29918, 6406, 13, 13, 1678, 822, 508, 29918, 8143, 29898, 1311, 29892, 1404, 29892, 282, 29895, 1125, 13, 4706, 9995, 9333, 7336, 1144, 508, 5217, 2305, 9995, 13, 4706, 736, 1404, 29889, 275, 29918, 6406, 13, 13, 13, 1990, 15740, 29898, 7435, 1125, 13, 1678, 9995, 319, 23449, 309, 9995, 13, 13, 1678, 770, 1102, 2603, 29898, 7435, 29889, 12763, 1125, 13, 4706, 12060, 3250, 353, 12315, 3073, 580, 13, 13, 1678, 770, 6645, 29879, 29901, 13, 13, 4706, 770, 21888, 29898, 6595, 1125, 13, 9651, 9995, 315, 29781, 278, 8368, 756, 3926, 14283, 9995, 13, 13, 9651, 3646, 353, 376, 29907, 10242, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 18082, 1237, 29908, 13, 9651, 5835, 353, 5852, 13, 13, 9651, 770, 1102, 2603, 29901, 13, 18884, 19468, 353, 8102, 3073, 29898, 1195, 29918, 791, 29922, 29896, 29892, 4236, 29918, 791, 29922, 29945, 29897, 13, 13, 9651, 822, 903, 275, 29918, 15775, 29918, 371, 11665, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 18884, 9995, 9333, 27335, 508, 788, 29914, 5992, 8041, 304, 29914, 3166, 21888, 322, 19468, 963, 29889, 13, 13, 18884, 1126, 896, 508, 437, 372, 411, 1009, 21888, 6732, 16786, 29889, 13, 18884, 9995, 13, 18884, 565, 1404, 29889, 275, 29918, 6406, 29901, 13, 462, 1678, 736, 5852, 13, 18884, 15703, 29918, 1272, 353, 1583, 3032, 12925, 29889, 657, 29898, 29911, 4204, 261, 29889, 657, 29918, 978, 3285, 6571, 467, 657, 29898, 1792, 29889, 5269, 29897, 13, 18884, 565, 15703, 29918, 1272, 338, 6213, 29901, 13, 462, 1678, 736, 7700, 13, 18884, 1683, 29901, 13, 462, 1678, 15703, 29918, 29883, 29781, 353, 1583, 3032, 12925, 29889, 657, 3552, 1792, 29889, 5269, 29892, 1920, 11665, 29889, 6595, 29879, 29889, 29883, 29781, 29889, 657, 29918, 978, 25739, 426, 1800, 13, 462, 1678, 736, 1104, 29918, 20571, 297, 15703, 29918, 29883, 29781, 13, 13, 9651, 822, 508, 29918, 3258, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 29892, 848, 29922, 8516, 1125, 13, 18884, 736, 1583, 3032, 275, 29918, 15775, 29918, 371, 11665, 29898, 1792, 29892, 282, 29895, 29892, 1104, 29918, 20571, 29897, 13, 13, 9651, 508, 29918, 5504, 353, 508, 29918, 3258, 13, 9651, 508, 29918, 8143, 353, 903, 275, 29918, 15775, 29918, 371, 11665, 13, 13, 4706, 770, 6589, 29898, 6595, 1125, 13, 9651, 9995, 461, 29879, 1754, 491, 278, 8368, 9995, 13, 9651, 3646, 353, 376, 20001, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 18945, 29908, 13, 13, 4706, 770, 26838, 29898, 6595, 1125, 13, 9651, 9995, 17450, 886, 2183, 491, 278, 8368, 9995, 13, 9651, 3646, 353, 376, 29911, 4204, 261, 29934, 1218, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 18945, 29908, 13, 13, 13, 1990, 1920, 11665, 29898, 7435, 1125, 13, 1678, 9995, 319, 13081, 9945, 9995, 13, 13, 1678, 770, 1102, 2603, 29898, 7435, 29889, 12763, 1125, 13, 4706, 7663, 353, 1714, 3073, 29898, 8216, 543, 29911, 29984, 29903, 17943, 613, 13, 462, 1669, 19995, 29922, 3366, 17823, 613, 376, 20818, 613, 376, 20818, 2298, 613, 376, 28319, 20068, 13, 13, 1678, 770, 6645, 29879, 29901, 13, 13, 4706, 770, 26838, 29898, 6595, 1125, 13, 9651, 9995, 17450, 886, 2183, 304, 278, 15703, 9995, 13, 9651, 3646, 353, 376, 29911, 4204, 261, 29934, 1218, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 371, 11665, 29908, 13, 13, 4706, 770, 21888, 29898, 6595, 1125, 13, 9651, 9995, 315, 29781, 278, 15703, 338, 14040, 363, 9995, 13, 9651, 3646, 353, 376, 29907, 10242, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 371, 11665, 29908, 13, 13, 13, 13, 1990, 16224, 6595, 29898, 6595, 1125, 13, 1678, 9995, 23861, 508, 1544, 2712, 304, 1009, 15303, 871, 9995, 13, 13, 1678, 822, 508, 29918, 5504, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 29892, 848, 1125, 13, 4706, 736, 1404, 29889, 5269, 1275, 1104, 29918, 20571, 470, 1404, 29889, 275, 29918, 6406, 13, 13, 1678, 822, 508, 29918, 3258, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 29892, 848, 1125, 13, 4706, 736, 1404, 29889, 5269, 1275, 1104, 29918, 20571, 470, 1404, 29889, 275, 29918, 6406, 13, 13, 1678, 822, 508, 29918, 8143, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 4706, 736, 1404, 29889, 5269, 1275, 1104, 29918, 20571, 470, 1404, 29889, 275, 29918, 6406, 13, 13, 13, 13, 1990, 6325, 344, 29898, 6848, 1125, 13, 1678, 9995, 530, 28976, 5190, 10981, 524, 292, 278, 3109, 787, 363, 263, 2702, 731, 310, 23820, 9995, 13, 13, 1678, 770, 1102, 2603, 29901, 13, 4706, 1024, 353, 1714, 3073, 29898, 20571, 29922, 5574, 29892, 6139, 543, 1170, 310, 278, 3236, 29889, 382, 29889, 29887, 29889, 17558, 29892, 5844, 29879, 23157, 13, 4706, 14385, 353, 8102, 3073, 29898, 8216, 543, 6513, 310, 278, 3236, 297, 11405, 1159, 13, 13, 1678, 770, 6645, 29879, 29901, 13, 13, 4706, 770, 15703, 29898, 7435, 284, 6595, 1125, 13, 9651, 9995, 450, 13081, 9945, 310, 278, 3236, 9995, 13, 9651, 3646, 353, 376, 29911, 4204, 261, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 29883, 29781, 29908, 13, 9651, 21008, 537, 353, 6645, 29889, 7543, 979, 1907, 29889, 12413, 13, 9651, 5835, 353, 5852, 13, 9651, 3734, 353, 5852, 13, 13, 4706, 770, 6589, 29898, 6595, 1125, 13, 9651, 9995, 2178, 6589, 1754, 1048, 278, 3236, 9995, 13, 9651, 3646, 353, 376, 20001, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 15775, 29908, 13, 13, 4706, 770, 26838, 29898, 6595, 1125, 13, 9651, 9995, 2178, 26838, 393, 892, 2183, 304, 278, 27335, 310, 278, 2702, 3236, 9995, 13, 9651, 3646, 353, 376, 29911, 4204, 261, 29934, 1218, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 15775, 29908, 13, 13, 4706, 770, 8041, 29898, 6595, 1125, 13, 9651, 9995, 2178, 23449, 2719, 1058, 14333, 278, 3236, 9995, 13, 9651, 3646, 353, 376, 20791, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 29883, 29781, 29908, 13, 13, 13, 1990, 11133, 15462, 29903, 2350, 29896, 14702, 15644, 29898, 9118, 14702, 15644, 1125, 13, 1678, 9995, 10783, 267, 263, 20459, 5759, 528, 29874, 29896, 408, 263, 7601, 1820, 9995, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1134, 29898, 1311, 1125, 13, 4706, 736, 376, 1300, 6352, 29918, 22197, 29908, 13, 13, 1678, 822, 5706, 29918, 20571, 29898, 1311, 29892, 848, 1125, 13, 4706, 736, 2897, 29889, 332, 2685, 29898, 29896, 29953, 467, 12508, 877, 20970, 1495, 13, 13, 1678, 822, 28755, 29898, 1311, 29892, 282, 29895, 1125, 13, 4706, 736, 282, 29895, 13, 13, 1678, 822, 16964, 6646, 29898, 1311, 29892, 282, 29895, 1125, 13, 4706, 565, 451, 338, 8758, 29898, 20571, 29892, 2362, 342, 5393, 1125, 13, 9651, 12020, 15758, 362, 2392, 703, 14510, 304, 367, 1347, 1159, 13, 4706, 565, 451, 5195, 29918, 23498, 29896, 29889, 4352, 29898, 1767, 1125, 13, 9651, 12020, 15758, 362, 2392, 703, 21738, 338, 451, 263, 2854, 317, 15715, 29896, 1159, 13, 4706, 736, 282, 29895, 13, 13, 13, 1990, 461, 29898, 6848, 1125, 13, 1678, 9995, 15740, 29915, 29879, 3440, 1048, 278, 3236, 9995, 13, 13, 1678, 21670, 15644, 353, 11133, 15462, 29903, 2350, 29896, 14702, 15644, 13, 13, 1678, 770, 1102, 2603, 29901, 13, 4706, 282, 29895, 353, 1714, 3073, 29898, 20571, 29922, 5574, 29892, 6139, 543, 12889, 310, 278, 6503, 1159, 13, 4706, 995, 353, 1714, 3073, 29898, 8216, 543, 1626, 310, 278, 3440, 1159, 13, 4706, 11265, 29918, 2230, 353, 12315, 3073, 29898, 8216, 543, 2481, 746, 278, 3440, 471, 2715, 313, 1454, 16548, 6437, 25760, 13, 13, 1678, 770, 6645, 29879, 29901, 13, 13, 4706, 770, 8368, 29898, 7435, 284, 6595, 1125, 13, 9651, 9995, 450, 23449, 309, 1058, 1754, 278, 3440, 9995, 13, 9651, 3646, 353, 376, 20791, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 21032, 29908, 13, 9651, 21008, 537, 353, 6645, 29889, 7543, 979, 1907, 29889, 12413, 13, 9651, 5835, 353, 5852, 13, 9651, 3734, 353, 5852, 13, 13, 9651, 822, 508, 29918, 8143, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 18884, 9995, 739, 947, 451, 1207, 738, 4060, 304, 1235, 5019, 6023, 278, 3440, 29915, 29879, 8368, 2748, 372, 338, 2825, 9995, 13, 18884, 736, 7700, 13, 13, 4706, 770, 3236, 29898, 6595, 1125, 13, 9651, 9995, 450, 4967, 278, 3440, 471, 1754, 1048, 9995, 13, 9651, 3646, 353, 376, 29907, 10242, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 21032, 29908, 13, 9651, 21008, 537, 353, 6645, 29889, 7543, 979, 1907, 29889, 12413, 13, 9651, 5835, 353, 5852, 13, 9651, 3734, 353, 5852, 13, 13, 9651, 822, 508, 29918, 8143, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 18884, 9995, 739, 947, 451, 1207, 738, 4060, 304, 1235, 5019, 6023, 278, 3440, 29915, 29879, 3236, 2748, 372, 338, 2825, 9995, 13, 18884, 736, 7700, 13, 13, 13, 1990, 1920, 11665, 29934, 1218, 29898, 6848, 1125, 13, 1678, 9995, 15740, 29915, 29879, 21700, 1048, 15703, 29915, 29879, 4180, 9995, 13, 13, 1678, 21670, 15644, 353, 11133, 15462, 29903, 2350, 29896, 14702, 15644, 13, 13, 1678, 770, 1102, 2603, 29901, 13, 4706, 282, 29895, 353, 1714, 3073, 29898, 20571, 29922, 5574, 29892, 6139, 543, 12889, 310, 278, 6503, 1159, 13, 4706, 995, 353, 8102, 3073, 29898, 1195, 29918, 791, 29922, 29900, 29892, 4236, 29918, 791, 29922, 29896, 29900, 29900, 29892, 6139, 543, 29931, 522, 9945, 29915, 29879, 4180, 15882, 16521, 13, 4706, 11265, 29918, 2230, 353, 12315, 3073, 29898, 8216, 543, 2481, 746, 278, 21700, 471, 2715, 313, 1454, 16548, 6437, 25760, 13, 13, 1678, 770, 6645, 29879, 29901, 13, 13, 4706, 770, 8368, 29898, 7435, 284, 6595, 1125, 13, 9651, 9995, 450, 23449, 309, 1058, 4846, 278, 21700, 304, 278, 15703, 9995, 13, 9651, 3646, 353, 376, 20791, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 3605, 886, 29908, 13, 9651, 21008, 537, 353, 6645, 29889, 7543, 979, 1907, 29889, 12413, 13, 9651, 5835, 353, 5852, 13, 9651, 3734, 353, 5852, 13, 13, 9651, 822, 508, 29918, 8143, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 18884, 9995, 739, 947, 451, 1207, 738, 4060, 304, 1235, 5019, 6023, 278, 21700, 29915, 29879, 8368, 2748, 372, 338, 2825, 9995, 13, 18884, 736, 7700, 13, 13, 4706, 770, 3236, 29898, 6595, 1125, 13, 9651, 9995, 450, 4967, 411, 3390, 304, 607, 278, 21700, 471, 2183, 9995, 13, 9651, 3646, 353, 376, 29907, 10242, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 3605, 886, 29908, 13, 9651, 21008, 537, 353, 6645, 29889, 7543, 979, 1907, 29889, 12413, 13, 9651, 5835, 353, 5852, 13, 9651, 3734, 353, 5852, 13, 13, 9651, 822, 508, 29918, 8143, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 18884, 9995, 739, 947, 451, 1207, 738, 4060, 304, 1235, 5019, 6023, 278, 26838, 29915, 29879, 3236, 2748, 372, 338, 2825, 9995, 13, 18884, 736, 7700, 13, 13, 4706, 770, 15703, 29898, 6595, 1125, 13, 9651, 9995, 450, 13081, 9945, 304, 6029, 278, 21700, 338, 4475, 9995, 13, 9651, 3646, 353, 376, 29911, 4204, 261, 29908, 13, 9651, 4475, 29918, 978, 353, 376, 3605, 886, 29908, 13, 9651, 21008, 537, 353, 6645, 29889, 7543, 979, 1907, 29889, 12413, 13, 9651, 5835, 353, 5852, 13, 9651, 3734, 353, 5852, 13, 13, 9651, 822, 508, 29918, 8143, 29898, 1311, 29892, 1404, 29892, 282, 29895, 29892, 1104, 29918, 20571, 1125, 13, 18884, 9995, 739, 947, 451, 1207, 738, 4060, 304, 1235, 5019, 6023, 278, 21700, 29915, 29879, 15703, 2748, 372, 338, 2825, 9995, 13, 18884, 736, 7700, 13, 13, 13, 29879, 15291, 353, 1383, 13841, 3170, 580, 13, 29879, 15291, 29889, 9573, 29898, 20791, 29897, 13, 29879, 15291, 29889, 9573, 29898, 29911, 4204, 261, 29897, 13, 29879, 15291, 29889, 9573, 29898, 29907, 10242, 29897, 13, 29879, 15291, 29889, 9573, 29898, 20001, 29897, 13, 29879, 15291, 29889, 9573, 29898, 29911, 4204, 261, 29934, 1218, 29897, 13, 29879, 15291, 29889, 14669, 580, 13, 2 ]
wechat_config/customize_userManual.py
William-An/wechat_server
0
41757
import requests import os import sys # provide option import argparse # parse options import json PATH = os.path.abspath(os.path.dirname(sys.argv[0])) token_url = "https://api.weixin.qq.com/cgi-bin/token" # Change to control server create_interface = "https://api.weixin.qq.com/cgi-bin/menu/create" get_Allinterface = "https://api.weixin.qq.com/cgi-bin/menu/get" get_Currentinterface = "https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info" del_interface = "https://api.weixin.qq.com/cgi-bin/menu/delete" # del, getall, getcurrent could be merge into one method by changing params class userInterface: credential = dict() @staticmethod def init(): # Initialization: acquire access_token from control server with open(PATH+r"\..\Static\accesskey_token.json","r") as credential_file: credential = eval("".join([i.strip() for i in credential_file.readlines()])) #print(credential) credential_file.close() try: key = requests.get(url=token_url,params=credential).json() token = key["access_token"] userInterface.credential.update([("access_token",token)]) #print(token) except Exception as err: if "errcode" in key: print("ERROR: errcode:%\t%",(key["errcode"],key["errmsg"])) else: print("ERROR: "+str(err)) exit() @staticmethod def createManual(file_addr): with open(file_addr,"rb") as config_file: try: # print([ i.decode() for i in config_file.readlines()]) config = eval("".join([i.strip().decode() for i in config_file.readlines()])) # print(config) except Exception as err: print(str(err)) exit() response = requests.post(create_interface,params=userInterface.credential,data=json.dumps(config)).json() # Must use json print("Result\nerrcode:",response["errcode"],response["errmsg"]) @staticmethod def delInterface(): # Write into function? paras are url and credential? response = requests.get(del_interface,params=userInterface.credential).json() print("Result\nerrcode:",response["errcode"],response["errmsg"]) @staticmethod def viewAllInterface(): response = requests.get(get_Allinterface,params=userInterface.credential).json() if "errcode" in response: print("Result\nerrcode:",response["errcode"],response["errmsg"]) else: print(response) @staticmethod def viewCurrentInterface(): response = requests.get(get_Currentinterface,params=userInterface.credential).json() if "errcode" in response: print("Result\nerrcode:",response["errcode"],response["errmsg"]) else: print(response) if __name__ == "__main__": parser = argparse.ArgumentParser(description="Provide access to modify/view wechat customized usermanual") parser.add_argument('-d','--delete',action='store_true',help='Delete ALL interfaces') parser.add_argument('-l','--list',action="store_true",help="List all userinterfaces") parser.add_argument('-i','--inspect',action="store_true",help="List current userinterface") parser.add_argument('-c','--config',help="upload the userinterface configuration") option=parser.parse_args() userInterface.init() if option.delete: userInterface.delInterface() elif option.list: userInterface.viewAllInterface() elif option.inspect: userInterface.viewCurrentInterface() elif option.config: userInterface.createManual(option.config) exit()
[ 1, 1053, 7274, 13, 5215, 2897, 13, 5215, 10876, 396, 3867, 2984, 13, 5215, 1852, 5510, 396, 6088, 3987, 13, 5215, 4390, 13, 13, 10145, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 25721, 29898, 9675, 29889, 19218, 29961, 29900, 12622, 13, 6979, 29918, 2271, 353, 376, 991, 597, 2754, 29889, 705, 861, 262, 29889, 24349, 29889, 510, 29914, 20006, 29899, 2109, 29914, 6979, 29908, 396, 10726, 304, 2761, 1923, 13, 3258, 29918, 13248, 353, 376, 991, 597, 2754, 29889, 705, 861, 262, 29889, 24349, 29889, 510, 29914, 20006, 29899, 2109, 29914, 6510, 29914, 3258, 29908, 13, 657, 29918, 3596, 13248, 353, 376, 991, 597, 2754, 29889, 705, 861, 262, 29889, 24349, 29889, 510, 29914, 20006, 29899, 2109, 29914, 6510, 29914, 657, 29908, 13, 657, 29918, 7583, 13248, 353, 376, 991, 597, 2754, 29889, 705, 861, 262, 29889, 24349, 29889, 510, 29914, 20006, 29899, 2109, 29914, 657, 29918, 3784, 29918, 1311, 6510, 29918, 3888, 29908, 13, 6144, 29918, 13248, 353, 376, 991, 597, 2754, 29889, 705, 861, 262, 29889, 24349, 29889, 510, 29914, 20006, 29899, 2109, 29914, 6510, 29914, 8143, 29908, 13, 13, 29937, 628, 29892, 679, 497, 29892, 679, 3784, 1033, 367, 10366, 964, 697, 1158, 491, 6480, 8636, 13, 13, 1990, 1404, 10448, 29901, 13, 1678, 6625, 2556, 353, 9657, 580, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2069, 7295, 13, 4706, 396, 17250, 2133, 29901, 1274, 1548, 2130, 29918, 6979, 515, 2761, 1923, 13, 4706, 411, 1722, 29898, 10145, 29974, 29878, 26732, 636, 29905, 17046, 29905, 5943, 1989, 29918, 6979, 29889, 3126, 3284, 29878, 1159, 408, 6625, 2556, 29918, 1445, 29901, 13, 9651, 6625, 2556, 353, 19745, 703, 1642, 7122, 4197, 29875, 29889, 17010, 580, 363, 474, 297, 6625, 2556, 29918, 1445, 29889, 949, 9012, 580, 12622, 13, 9651, 396, 2158, 29898, 11944, 2556, 29897, 13, 9651, 6625, 2556, 29918, 1445, 29889, 5358, 580, 13, 4706, 1018, 29901, 13, 9651, 1820, 353, 7274, 29889, 657, 29898, 2271, 29922, 6979, 29918, 2271, 29892, 7529, 29922, 11944, 2556, 467, 3126, 580, 13, 9651, 5993, 353, 1820, 3366, 5943, 29918, 6979, 3108, 13, 9651, 1404, 10448, 29889, 11944, 2556, 29889, 5504, 4197, 703, 5943, 29918, 6979, 613, 6979, 29897, 2314, 13, 9651, 396, 2158, 29898, 6979, 29897, 13, 4706, 5174, 8960, 408, 4589, 29901, 13, 9651, 565, 376, 3127, 401, 29908, 297, 1820, 29901, 13, 18884, 1596, 703, 11432, 29901, 4589, 401, 16664, 29905, 29873, 29995, 613, 29898, 1989, 3366, 3127, 401, 12436, 1989, 3366, 3127, 7645, 3108, 876, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 11432, 29901, 15691, 710, 29898, 3127, 876, 13, 9651, 6876, 580, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1653, 2517, 950, 29898, 1445, 29918, 10030, 1125, 13, 4706, 411, 1722, 29898, 1445, 29918, 10030, 1699, 6050, 1159, 408, 2295, 29918, 1445, 29901, 13, 9651, 1018, 29901, 13, 18884, 396, 1596, 4197, 474, 29889, 13808, 580, 363, 474, 297, 2295, 29918, 1445, 29889, 949, 9012, 580, 2314, 13, 18884, 2295, 353, 19745, 703, 1642, 7122, 4197, 29875, 29889, 17010, 2141, 13808, 580, 363, 474, 297, 2295, 29918, 1445, 29889, 949, 9012, 580, 12622, 13, 18884, 396, 1596, 29898, 2917, 29897, 13, 9651, 5174, 8960, 408, 4589, 29901, 13, 18884, 1596, 29898, 710, 29898, 3127, 876, 13, 18884, 6876, 580, 13, 9651, 2933, 353, 7274, 29889, 2490, 29898, 3258, 29918, 13248, 29892, 7529, 29922, 1792, 10448, 29889, 11944, 2556, 29892, 1272, 29922, 3126, 29889, 29881, 17204, 29898, 2917, 8106, 3126, 580, 396, 19928, 671, 4390, 13, 9651, 1596, 703, 3591, 29905, 1089, 29878, 401, 29901, 613, 5327, 3366, 3127, 401, 12436, 5327, 3366, 3127, 7645, 20068, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 628, 10448, 7295, 13, 4706, 396, 14350, 964, 740, 29973, 610, 294, 526, 3142, 322, 6625, 2556, 29973, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 6144, 29918, 13248, 29892, 7529, 29922, 1792, 10448, 29889, 11944, 2556, 467, 3126, 580, 13, 4706, 1596, 703, 3591, 29905, 1089, 29878, 401, 29901, 613, 5327, 3366, 3127, 401, 12436, 5327, 3366, 3127, 7645, 20068, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1776, 3596, 10448, 7295, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 657, 29918, 3596, 13248, 29892, 7529, 29922, 1792, 10448, 29889, 11944, 2556, 467, 3126, 580, 13, 4706, 565, 376, 3127, 401, 29908, 297, 2933, 29901, 13, 9651, 1596, 703, 3591, 29905, 1089, 29878, 401, 29901, 613, 5327, 3366, 3127, 401, 12436, 5327, 3366, 3127, 7645, 20068, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 5327, 29897, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1776, 7583, 10448, 7295, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 657, 29918, 7583, 13248, 29892, 7529, 29922, 1792, 10448, 29889, 11944, 2556, 467, 3126, 580, 13, 4706, 565, 376, 3127, 401, 29908, 297, 2933, 29901, 13, 9651, 1596, 703, 3591, 29905, 1089, 29878, 401, 29901, 613, 5327, 3366, 3127, 401, 12436, 5327, 3366, 3127, 7645, 20068, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 5327, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 543, 1184, 29894, 680, 2130, 304, 6623, 29914, 1493, 591, 13496, 2888, 1891, 502, 3504, 950, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29881, 3788, 489, 8143, 742, 2467, 2433, 8899, 29918, 3009, 742, 8477, 2433, 12498, 15149, 19510, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29880, 3788, 489, 1761, 742, 2467, 543, 8899, 29918, 3009, 613, 8477, 543, 1293, 599, 1404, 1639, 8726, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29875, 3788, 489, 1144, 1103, 742, 2467, 543, 8899, 29918, 3009, 613, 8477, 543, 1293, 1857, 1404, 13248, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29883, 3788, 489, 2917, 742, 8477, 543, 9009, 278, 1404, 13248, 5285, 1159, 13, 1678, 2984, 29922, 16680, 29889, 5510, 29918, 5085, 580, 13, 1678, 1404, 10448, 29889, 2344, 580, 13, 1678, 565, 2984, 29889, 8143, 29901, 13, 4706, 1404, 10448, 29889, 6144, 10448, 580, 13, 1678, 25342, 2984, 29889, 1761, 29901, 13, 4706, 1404, 10448, 29889, 1493, 3596, 10448, 580, 13, 1678, 25342, 2984, 29889, 1144, 1103, 29901, 13, 4706, 1404, 10448, 29889, 1493, 7583, 10448, 580, 13, 1678, 25342, 2984, 29889, 2917, 29901, 13, 4706, 1404, 10448, 29889, 3258, 2517, 950, 29898, 3385, 29889, 2917, 29897, 13, 1678, 6876, 580, 2 ]
player_roll.py
jeff012345/clue-part-duo
0
113082
from __future__ import annotations from typing import List, Set, Dict, Tuple, Optional import pygame import pygame_gui from player import HumanPlayer from paths import Board, board_spaces, doors from game_board_util import scale_position from definitions import roll_dice from log_book_ui import LogBookPanel from definitions import RoomPosition class PlayerRoll: ### Static SPACE_COLOR = (0, 0, 0) def _is_adjacent(p1, p2): return (abs(p1[0] - p2[0]) == 1 and p1[1] == p2[1]) \ or (abs(p1[1] - p2[1]) == 1 and p1[0] == p2[0]) def _valid_position(pos): return pos[0] >= 0 and pos[0] < 25 and pos[1] >= 0 and pos[1] < 24 \ and board_spaces[pos[0]][pos[1]] != 0 player: HumanPlayer surface: pygame.Surface on_end_turn: Callable _rolling: bool _distance: int _positions: List[Position] _rect_to_position: Dict[Tuple, Position] _rects: List[pygame.Rect] _drawn_rects: List[pygame.Rect] def __init__(self, surface: pygame.Surface, player: HumanPlayer, on_end_turn: Callable): self.surface = surface self._rolling = False self.player = player self.on_end_turn = on_end_turn def roll(self): self._rolling = True self._distance = roll_dice() print("rolled a " + str(self._distance)) self._calculate_positions() def _calculate_positions(self): edge = set(self.player.board_position.connections) self._positions = list(self._find_all_positions_search(self._distance, edge, set())) self._rects = [] self._rect_to_position = dict() for p in self._positions: coords = list(map(scale_position, Board.coords_from_position(p))) new_rects = list(map(lambda p: pygame.Rect((p[0] - 5, p[1] - 5), (11, 11)), coords)) self._rects.extend(new_rects) for r in new_rects: self._rect_to_position[(r.x, r.y)] = p def _find_all_positions_search(self, distance: int, edge: Set[Position], all_positions: Set[Position]) -> Set[Position]: if distance == 1: return all_positions.union(edge) new_edge: Set[Position] = set() for p in edge: all_positions.add(p) if isinstance(p, RoomPosition): # the path stops at the door continue for conn in p.connections: if conn not in all_positions and conn not in edge \ and conn != self.player.board_position: # haven't seen this node before new_edge.add(conn) return self._find_all_positions_search(distance - 1, new_edge, all_positions) def draw(self): if not self._rolling: return self._drawn_rects = list(map(lambda rect: pygame.draw.rect(self.surface, PlayerRoll.SPACE_COLOR, rect), self._rects)) def process_events(self, event): if not self._rolling: return if event.type == pygame.MOUSEBUTTONUP: pos = pygame.mouse.get_pos() i = 0 for rect in self._drawn_rects: rect = rect.move(LogBookPanel.PANEL_WIDTH, 0) if rect.collidepoint(pos): org_rect = self._rects[i] self._click_move(self._rect_to_position[(org_rect.x, org_rect.y)]) break i += 1 def _click_move(self, pos: Position): self.player.move(pos) self._rolling = False self.on_end_turn()
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 25495, 13, 3166, 19229, 1053, 2391, 29892, 3789, 29892, 360, 919, 29892, 12603, 552, 29892, 28379, 13, 13, 5215, 22028, 13, 5215, 22028, 29918, 23569, 13, 13, 3166, 4847, 1053, 12968, 9075, 13, 3166, 10898, 1053, 12590, 29892, 7613, 29918, 22854, 29892, 24189, 13, 3166, 3748, 29918, 3377, 29918, 4422, 1053, 6287, 29918, 3283, 13, 3166, 15848, 1053, 9679, 29918, 29881, 625, 13, 3166, 1480, 29918, 2909, 29918, 1481, 1053, 4522, 10967, 7490, 13, 3166, 15848, 1053, 25114, 8003, 13, 13, 1990, 14574, 29934, 3028, 29901, 13, 268, 13, 1678, 835, 624, 2454, 13, 1678, 10937, 11538, 29918, 15032, 1955, 353, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 903, 275, 29918, 26859, 16648, 29898, 29886, 29896, 29892, 282, 29906, 1125, 13, 4706, 736, 313, 6897, 29898, 29886, 29896, 29961, 29900, 29962, 448, 282, 29906, 29961, 29900, 2314, 1275, 29871, 29896, 322, 282, 29896, 29961, 29896, 29962, 1275, 282, 29906, 29961, 29896, 2314, 320, 13, 9651, 470, 313, 6897, 29898, 29886, 29896, 29961, 29896, 29962, 448, 282, 29906, 29961, 29896, 2314, 1275, 29871, 29896, 322, 282, 29896, 29961, 29900, 29962, 1275, 282, 29906, 29961, 29900, 2314, 13, 13, 1678, 822, 903, 3084, 29918, 3283, 29898, 1066, 1125, 13, 4706, 736, 926, 29961, 29900, 29962, 6736, 29871, 29900, 322, 926, 29961, 29900, 29962, 529, 29871, 29906, 29945, 322, 926, 29961, 29896, 29962, 6736, 29871, 29900, 322, 926, 29961, 29896, 29962, 529, 29871, 29906, 29946, 320, 13, 9651, 322, 7613, 29918, 22854, 29961, 1066, 29961, 29900, 29962, 3816, 1066, 29961, 29896, 5262, 2804, 29871, 29900, 13, 13, 1678, 4847, 29901, 12968, 9075, 13, 1678, 7101, 29901, 22028, 29889, 18498, 2161, 13, 1678, 373, 29918, 355, 29918, 685, 29901, 8251, 519, 13, 1678, 903, 22155, 29901, 6120, 13, 1678, 903, 19244, 29901, 938, 13, 1678, 903, 1066, 2187, 29901, 2391, 29961, 8003, 29962, 13, 1678, 903, 1621, 29918, 517, 29918, 3283, 29901, 360, 919, 29961, 23215, 552, 29892, 20627, 29962, 13, 1678, 903, 1621, 29879, 29901, 2391, 29961, 2272, 11802, 29889, 7364, 29962, 13, 1678, 903, 19811, 1233, 29918, 1621, 29879, 29901, 2391, 29961, 2272, 11802, 29889, 7364, 29962, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7101, 29901, 22028, 29889, 18498, 2161, 29892, 4847, 29901, 12968, 9075, 29892, 373, 29918, 355, 29918, 685, 29901, 8251, 519, 1125, 13, 4706, 1583, 29889, 7610, 2161, 353, 7101, 13, 4706, 1583, 3032, 22155, 353, 7700, 13, 4706, 1583, 29889, 9106, 353, 4847, 13, 4706, 1583, 29889, 265, 29918, 355, 29918, 685, 353, 373, 29918, 355, 29918, 685, 13, 13, 1678, 822, 9679, 29898, 1311, 1125, 13, 4706, 1583, 3032, 22155, 353, 5852, 13, 4706, 1583, 3032, 19244, 353, 9679, 29918, 29881, 625, 580, 13, 4706, 1596, 703, 24476, 263, 376, 718, 851, 29898, 1311, 3032, 19244, 876, 13, 13, 4706, 1583, 3032, 15807, 403, 29918, 1066, 2187, 580, 13, 13, 1678, 822, 903, 15807, 403, 29918, 1066, 2187, 29898, 1311, 1125, 1678, 13, 4706, 7636, 353, 731, 29898, 1311, 29889, 9106, 29889, 3377, 29918, 3283, 29889, 11958, 1953, 29897, 13, 4706, 1583, 3032, 1066, 2187, 353, 1051, 29898, 1311, 3032, 2886, 29918, 497, 29918, 1066, 2187, 29918, 4478, 29898, 1311, 3032, 19244, 29892, 7636, 29892, 731, 22130, 418, 13, 308, 13, 4706, 1583, 3032, 1621, 29879, 353, 5159, 13, 4706, 1583, 3032, 1621, 29918, 517, 29918, 3283, 353, 9657, 580, 13, 13, 4706, 363, 282, 297, 1583, 3032, 1066, 2187, 29901, 13, 9651, 1302, 4339, 353, 1051, 29898, 1958, 29898, 7052, 29918, 3283, 29892, 12590, 29889, 1111, 4339, 29918, 3166, 29918, 3283, 29898, 29886, 4961, 13, 9651, 716, 29918, 1621, 29879, 353, 1051, 29898, 1958, 29898, 2892, 282, 29901, 22028, 29889, 7364, 3552, 29886, 29961, 29900, 29962, 448, 29871, 29945, 29892, 282, 29961, 29896, 29962, 448, 29871, 29945, 511, 313, 29896, 29896, 29892, 29871, 29896, 29896, 8243, 1302, 4339, 876, 13, 632, 13, 9651, 1583, 3032, 1621, 29879, 29889, 21843, 29898, 1482, 29918, 1621, 29879, 29897, 13, 13, 9651, 363, 364, 297, 716, 29918, 1621, 29879, 29901, 13, 18884, 1583, 3032, 1621, 29918, 517, 29918, 3283, 15625, 29878, 29889, 29916, 29892, 364, 29889, 29891, 4638, 353, 282, 13, 13, 1678, 822, 903, 2886, 29918, 497, 29918, 1066, 2187, 29918, 4478, 29898, 1311, 29892, 5418, 29901, 938, 29892, 7636, 29901, 3789, 29961, 8003, 1402, 29871, 13, 462, 462, 259, 599, 29918, 1066, 2187, 29901, 3789, 29961, 8003, 2314, 1599, 3789, 29961, 8003, 5387, 13, 4706, 565, 5418, 1275, 29871, 29896, 29901, 13, 9651, 736, 599, 29918, 1066, 2187, 29889, 13094, 29898, 12864, 29897, 13, 13, 4706, 716, 29918, 12864, 29901, 3789, 29961, 8003, 29962, 353, 731, 580, 13, 13, 4706, 363, 282, 297, 7636, 29901, 13, 9651, 599, 29918, 1066, 2187, 29889, 1202, 29898, 29886, 29897, 13, 13, 9651, 565, 338, 8758, 29898, 29886, 29892, 25114, 8003, 1125, 13, 18884, 396, 278, 2224, 17726, 472, 278, 3050, 13, 18884, 6773, 13, 13, 9651, 363, 11009, 297, 282, 29889, 11958, 1953, 29901, 13, 18884, 565, 11009, 451, 297, 599, 29918, 1066, 2187, 322, 11009, 451, 297, 7636, 320, 13, 462, 4706, 322, 11009, 2804, 1583, 29889, 9106, 29889, 3377, 29918, 3283, 29901, 13, 462, 1678, 396, 7359, 29915, 29873, 3595, 445, 2943, 1434, 13, 462, 1678, 716, 29918, 12864, 29889, 1202, 29898, 13082, 29897, 13, 13, 4706, 736, 1583, 3032, 2886, 29918, 497, 29918, 1066, 2187, 29918, 4478, 29898, 19244, 448, 29871, 29896, 29892, 716, 29918, 12864, 29892, 599, 29918, 1066, 2187, 29897, 13, 13, 1678, 822, 4216, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 22155, 29901, 13, 9651, 736, 13, 308, 13, 4706, 1583, 3032, 19811, 1233, 29918, 1621, 29879, 353, 1051, 29898, 1958, 29898, 2892, 7705, 29901, 22028, 29889, 4012, 29889, 1621, 29898, 1311, 29889, 7610, 2161, 29892, 14574, 29934, 3028, 29889, 5550, 11538, 29918, 15032, 1955, 29892, 7705, 511, 1583, 3032, 1621, 29879, 876, 29871, 13, 13, 1678, 822, 1889, 29918, 13604, 29898, 1311, 29892, 1741, 1125, 13, 4706, 565, 451, 1583, 3032, 22155, 29901, 13, 9651, 736, 13, 13, 4706, 565, 1741, 29889, 1853, 1275, 22028, 29889, 6720, 17171, 29933, 2692, 29911, 1164, 4897, 29901, 13, 9651, 926, 353, 22028, 29889, 15769, 29889, 657, 29918, 1066, 580, 13, 13, 9651, 474, 353, 29871, 29900, 13, 9651, 363, 7705, 297, 1583, 3032, 19811, 1233, 29918, 1621, 29879, 29901, 13, 18884, 7705, 353, 7705, 29889, 11631, 29898, 3403, 10967, 7490, 29889, 29925, 2190, 6670, 29918, 22574, 29892, 29871, 29900, 29897, 13, 13, 18884, 565, 7705, 29889, 1054, 7459, 3149, 29898, 1066, 1125, 13, 462, 1678, 1638, 29918, 1621, 353, 1583, 3032, 1621, 29879, 29961, 29875, 29962, 13, 462, 1678, 1583, 3032, 3808, 29918, 11631, 29898, 1311, 3032, 1621, 29918, 517, 29918, 3283, 15625, 990, 29918, 1621, 29889, 29916, 29892, 1638, 29918, 1621, 29889, 29891, 29897, 2314, 13, 462, 1678, 2867, 13, 18884, 474, 4619, 29871, 29896, 13, 13, 1678, 822, 903, 3808, 29918, 11631, 29898, 1311, 29892, 926, 29901, 20627, 1125, 13, 4706, 1583, 29889, 9106, 29889, 11631, 29898, 1066, 29897, 13, 4706, 1583, 3032, 22155, 353, 7700, 13, 4706, 1583, 29889, 265, 29918, 355, 29918, 685, 580, 13, 2 ]
save.py
regismeyssonnier/NeuralNetwork
0
22096
<gh_stars>0 def write_file(filess, T): f = open(filess, "w") for o in T: f.write("[\n") for l in o: f.write(str(l)+"\n") f.write("]\n") f.close() def save_hidden_weight(nb_hidden, hiddenw): for i in range(nb_hidden): write_file("save/base_nn_hid_" + str(i+1) + "w.nn", hiddenw[i]) def load_hiddenw(filess, hiddenw): f = open(filess, "r") s = f.read().splitlines() h = 0 for o in s: #print(o) if o == "[": h = [] elif o == "]": hiddenw.append(h) else: h.append(float(o)) def load_hidden_weight(hiddenw, nb_hidden): for i in range(nb_hidden): hiddenw.append([]) load_hiddenw("save/base_nn_hid_" + str(i+1) + "w.nn", hiddenw[i]) def load_hidden_weight_v(hiddenw, nb_hidden): for i in range(nb_hidden): hiddenw.append([]) load_hiddenw("valid/NN/base_nn_hid_" + str(i+1) + "w.nn", hiddenw[i]) def display_hidden_weight(hiddenw, nb_hidden): for i in range(nb_hidden): for j in hiddenw[i]: print("------------------------------------") I = 0 for k in j: print(k) I+=1 if I > 3: break def write_fileb(filess, T): f = open(filess, "w") for o in T: f.write(str(o)+"\n") f.close() def save_hidden_bias(nb_hidden, hiddenb): for i in range(nb_hidden): write_fileb("save/base_nn_hid_" + str(i+1) + "b.nn", hiddenb[i]) def load_hiddenb(filess, hiddenb): f = open(filess, "r") s = f.read().splitlines() for o in s: hiddenb.append(float(o)) def load_hidden_bias(hiddenb, nb_hidden): for i in range(nb_hidden): hiddenb.append([]) load_hiddenb("save/base_nn_hid_" + str(i+1) + "b.nn", hiddenb[i]) def load_hidden_bias_v(hiddenb, nb_hidden): for i in range(nb_hidden): hiddenb.append([]) load_hiddenb("valid/NN/base_nn_hid_" + str(i+1) + "b.nn", hiddenb[i]) def display_hidden_bias(hiddenb, nb_hidden): for i in range(nb_hidden): print("------------------------------------") for j in hiddenb[i]: print(j) def save_output_weight(outputw): write_file("save/base_nn_out_w.nn", outputw[0]) def load_output_weight(outputw): outputw.append([]) load_hiddenw("save/base_nn_out_w.nn", outputw[0]) def load_output_weight_v(outputw): outputw.append([]) load_hiddenw("valid/NN/base_nn_out_w.nn", outputw[0]) def save_output_bias(outputb): write_fileb("save/base_nn_out_b.nn", outputb[0]) def load_output_bias(outputb): outputb.append([]) load_hiddenb("save/base_nn_out_b.nn", outputb[0]) def load_output_bias_v(outputb): outputb.append([]) load_hiddenb("valid/NN/base_nn_out_b.nn", outputb[0])
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 13, 1753, 2436, 29918, 1445, 29898, 1777, 404, 29892, 323, 1125, 13, 12, 13, 12, 29888, 353, 1722, 29898, 1777, 404, 29892, 376, 29893, 1159, 13, 12, 1454, 288, 297, 323, 29901, 13, 12, 12, 29888, 29889, 3539, 703, 7110, 29876, 1159, 13, 12, 12, 1454, 301, 297, 288, 29901, 13, 12, 12, 12, 29888, 29889, 3539, 29898, 710, 29898, 29880, 7240, 26732, 29876, 1159, 13, 12, 12, 29888, 29889, 3539, 703, 10725, 29876, 1159, 13, 12, 29888, 29889, 5358, 580, 13, 13, 13, 1753, 4078, 29918, 10892, 29918, 7915, 29898, 9877, 29918, 10892, 29892, 7934, 29893, 1125, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 3539, 29918, 1445, 703, 7620, 29914, 3188, 29918, 15755, 29918, 29882, 333, 27508, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 376, 29893, 29889, 15755, 613, 7934, 29893, 29961, 29875, 2314, 13, 13, 13, 1753, 2254, 29918, 10892, 29893, 29898, 1777, 404, 29892, 7934, 29893, 1125, 13, 13, 12, 29888, 353, 1722, 29898, 1777, 404, 29892, 376, 29878, 1159, 13, 12, 29879, 353, 285, 29889, 949, 2141, 5451, 9012, 580, 13, 12, 29882, 353, 29871, 29900, 13, 12, 13, 12, 1454, 288, 297, 269, 29901, 13, 12, 12, 29937, 2158, 29898, 29877, 29897, 13, 12, 12, 361, 288, 1275, 14704, 1115, 13, 12, 12, 12, 29882, 353, 5159, 13, 12, 12, 23681, 288, 1275, 376, 29962, 1115, 13, 12, 12, 12, 10892, 29893, 29889, 4397, 29898, 29882, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 29882, 29889, 4397, 29898, 7411, 29898, 29877, 876, 13, 12, 12, 12, 13, 13, 1753, 2254, 29918, 10892, 29918, 7915, 29898, 10892, 29893, 29892, 302, 29890, 29918, 10892, 1125, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 10892, 29893, 29889, 4397, 4197, 2314, 13, 12, 12, 1359, 29918, 10892, 29893, 703, 7620, 29914, 3188, 29918, 15755, 29918, 29882, 333, 27508, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 376, 29893, 29889, 15755, 613, 7934, 29893, 29961, 29875, 2314, 13, 13, 1753, 2254, 29918, 10892, 29918, 7915, 29918, 29894, 29898, 10892, 29893, 29892, 302, 29890, 29918, 10892, 1125, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 10892, 29893, 29889, 4397, 4197, 2314, 13, 12, 12, 1359, 29918, 10892, 29893, 703, 3084, 29914, 10262, 29914, 3188, 29918, 15755, 29918, 29882, 333, 27508, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 376, 29893, 29889, 15755, 613, 7934, 29893, 29961, 29875, 2314, 13, 13, 13, 13, 1753, 2479, 29918, 10892, 29918, 7915, 29898, 10892, 29893, 29892, 302, 29890, 29918, 10892, 1125, 13, 13, 12, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 1454, 432, 297, 7934, 29893, 29961, 29875, 5387, 13, 12, 12, 12, 2158, 703, 2683, 2683, 807, 1159, 13, 12, 12, 12, 29902, 353, 29871, 29900, 13, 12, 12, 12, 1454, 413, 297, 432, 29901, 13, 12, 12, 12, 12, 2158, 29898, 29895, 29897, 13, 12, 12, 12, 12, 29902, 23661, 29896, 13, 12, 12, 12, 12, 361, 306, 1405, 29871, 29941, 29901, 13, 12, 12, 12, 12, 12, 8690, 13, 12, 12, 12, 12, 12, 13, 12, 12, 12, 12, 12, 13, 1753, 2436, 29918, 1445, 29890, 29898, 1777, 404, 29892, 323, 1125, 13, 12, 13, 12, 29888, 353, 1722, 29898, 1777, 404, 29892, 376, 29893, 1159, 13, 12, 1454, 288, 297, 323, 29901, 13, 12, 12, 29888, 29889, 3539, 29898, 710, 29898, 29877, 7240, 26732, 29876, 1159, 13, 12, 12, 13, 12, 29888, 29889, 5358, 580, 13, 13, 13, 1753, 4078, 29918, 10892, 29918, 29890, 3173, 29898, 9877, 29918, 10892, 29892, 7934, 29890, 1125, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 3539, 29918, 1445, 29890, 703, 7620, 29914, 3188, 29918, 15755, 29918, 29882, 333, 27508, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 376, 29890, 29889, 15755, 613, 7934, 29890, 29961, 29875, 2314, 13, 12, 13, 1753, 2254, 29918, 10892, 29890, 29898, 1777, 404, 29892, 7934, 29890, 1125, 13, 13, 12, 29888, 353, 1722, 29898, 1777, 404, 29892, 376, 29878, 1159, 13, 12, 29879, 353, 285, 29889, 949, 2141, 5451, 9012, 580, 13, 12, 12, 13, 12, 1454, 288, 297, 269, 29901, 13, 12, 12, 10892, 29890, 29889, 4397, 29898, 7411, 29898, 29877, 876, 13, 12, 12, 12, 12, 12, 12, 13, 1753, 2254, 29918, 10892, 29918, 29890, 3173, 29898, 10892, 29890, 29892, 302, 29890, 29918, 10892, 1125, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 10892, 29890, 29889, 4397, 4197, 2314, 13, 12, 12, 1359, 29918, 10892, 29890, 703, 7620, 29914, 3188, 29918, 15755, 29918, 29882, 333, 27508, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 376, 29890, 29889, 15755, 613, 7934, 29890, 29961, 29875, 2314, 13, 13, 1753, 2254, 29918, 10892, 29918, 29890, 3173, 29918, 29894, 29898, 10892, 29890, 29892, 302, 29890, 29918, 10892, 1125, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 10892, 29890, 29889, 4397, 4197, 2314, 13, 12, 12, 1359, 29918, 10892, 29890, 703, 3084, 29914, 10262, 29914, 3188, 29918, 15755, 29918, 29882, 333, 27508, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 376, 29890, 29889, 15755, 613, 7934, 29890, 29961, 29875, 2314, 13, 13, 13, 13, 1753, 2479, 29918, 10892, 29918, 29890, 3173, 29898, 10892, 29890, 29892, 302, 29890, 29918, 10892, 1125, 13, 12, 13, 12, 1454, 474, 297, 3464, 29898, 9877, 29918, 10892, 1125, 13, 12, 12, 2158, 703, 2683, 2683, 807, 1159, 13, 12, 12, 1454, 432, 297, 7934, 29890, 29961, 29875, 5387, 13, 12, 12, 12, 2158, 29898, 29926, 29897, 13, 13, 13, 1753, 4078, 29918, 4905, 29918, 7915, 29898, 4905, 29893, 1125, 13, 13, 12, 3539, 29918, 1445, 703, 7620, 29914, 3188, 29918, 15755, 29918, 449, 29918, 29893, 29889, 15755, 613, 1962, 29893, 29961, 29900, 2314, 13, 13, 13, 1753, 2254, 29918, 4905, 29918, 7915, 29898, 4905, 29893, 1125, 13, 13, 12, 4905, 29893, 29889, 4397, 4197, 2314, 13, 12, 1359, 29918, 10892, 29893, 703, 7620, 29914, 3188, 29918, 15755, 29918, 449, 29918, 29893, 29889, 15755, 613, 1962, 29893, 29961, 29900, 2314, 13, 13, 1753, 2254, 29918, 4905, 29918, 7915, 29918, 29894, 29898, 4905, 29893, 1125, 13, 13, 12, 4905, 29893, 29889, 4397, 4197, 2314, 13, 12, 1359, 29918, 10892, 29893, 703, 3084, 29914, 10262, 29914, 3188, 29918, 15755, 29918, 449, 29918, 29893, 29889, 15755, 613, 1962, 29893, 29961, 29900, 2314, 13, 13, 13, 1753, 4078, 29918, 4905, 29918, 29890, 3173, 29898, 4905, 29890, 1125, 13, 13, 12, 3539, 29918, 1445, 29890, 703, 7620, 29914, 3188, 29918, 15755, 29918, 449, 29918, 29890, 29889, 15755, 613, 1962, 29890, 29961, 29900, 2314, 13, 12, 12, 13, 13, 1753, 2254, 29918, 4905, 29918, 29890, 3173, 29898, 4905, 29890, 1125, 13, 13, 12, 4905, 29890, 29889, 4397, 4197, 2314, 13, 12, 1359, 29918, 10892, 29890, 703, 7620, 29914, 3188, 29918, 15755, 29918, 449, 29918, 29890, 29889, 15755, 613, 1962, 29890, 29961, 29900, 2314, 13, 13, 1753, 2254, 29918, 4905, 29918, 29890, 3173, 29918, 29894, 29898, 4905, 29890, 1125, 13, 13, 12, 4905, 29890, 29889, 4397, 4197, 2314, 13, 12, 1359, 29918, 10892, 29890, 703, 3084, 29914, 10262, 29914, 3188, 29918, 15755, 29918, 449, 29918, 29890, 29889, 15755, 613, 1962, 29890, 29961, 29900, 2314, 13, 13, 12, 13, 12, 12, 13, 13, 13, 2 ]
home/forms.py
Legaeldan/siobhan-mcgowan-photography
0
24667
from django import forms class ContactForm(forms.Form): user_name = forms.CharField(max_length=60, label='', required=True, widget=forms.TextInput(attrs={'placeholder': '<NAME>'})) user_email = forms.EmailField(label='', required=True) message = forms.CharField(label='', required=True, widget=forms.Textarea(attrs={'placeholder': 'Message', 'rows': '4'})) def __init__(self, *args, **kwargs): super(ContactForm, self).__init__(*args, **kwargs) for visible in self.visible_fields(): if visible.name == "user_email": visible.field.widget.attrs['class'] = 'validate-required validate-email field-error' visible.field.widget.attrs['placeholder'] = 'Email Address' else: visible.field.widget.attrs['class'] = 'validate-required field-error'
[ 1, 515, 9557, 1053, 7190, 13, 13, 13, 1990, 22387, 2500, 29898, 9514, 29889, 2500, 1125, 13, 13, 1678, 1404, 29918, 978, 353, 7190, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29953, 29900, 29892, 3858, 2433, 742, 3734, 29922, 5574, 29892, 11109, 29922, 9514, 29889, 1626, 4290, 29898, 5552, 29879, 3790, 29915, 27074, 2396, 12801, 5813, 29958, 10827, 876, 13, 1678, 1404, 29918, 5269, 353, 7190, 29889, 9823, 3073, 29898, 1643, 2433, 742, 3734, 29922, 5574, 29897, 13, 1678, 2643, 353, 7190, 29889, 27890, 29898, 1643, 2433, 742, 3734, 29922, 5574, 29892, 11109, 29922, 9514, 29889, 1626, 6203, 29898, 5552, 29879, 3790, 29915, 27074, 2396, 525, 3728, 742, 525, 5727, 2396, 525, 29946, 10827, 876, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 13443, 2500, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 363, 7962, 297, 1583, 29889, 12872, 29918, 9621, 7295, 13, 9651, 565, 7962, 29889, 978, 1275, 376, 1792, 29918, 5269, 1115, 13, 18884, 7962, 29889, 2671, 29889, 8030, 29889, 5552, 29879, 1839, 1990, 2033, 353, 525, 15480, 29899, 12403, 12725, 29899, 5269, 1746, 29899, 2704, 29915, 13, 18884, 7962, 29889, 2671, 29889, 8030, 29889, 5552, 29879, 1839, 27074, 2033, 353, 525, 9823, 16428, 29915, 13, 9651, 1683, 29901, 13, 18884, 7962, 29889, 2671, 29889, 8030, 29889, 5552, 29879, 1839, 1990, 2033, 353, 525, 15480, 29899, 12403, 1746, 29899, 2704, 29915, 13, 13, 13, 268, 2 ]
bagua/torch_api/contrib/sync_batchnorm.py
mmathys/bagua
635
10646
<gh_stars>100-1000 # Copyright (c) Uber Technologies, Inc. and its affiliates. # Copyright (c) 2021 Kuaishou AI Platform & DS3 Lab. # # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. from distutils.version import LooseVersion import torch from torch.autograd.function import Function import torch.nn.functional as F from torch.nn.modules.batchnorm import _BatchNorm import bagua.torch_api as bagua from bagua.torch_api.communication import allgather, allreduce # Backward compat for old PyTorch if not hasattr(torch.jit, "unused"): torch.jit.unused = lambda x: x _SYNC_BN_V2 = LooseVersion(torch.__version__) >= LooseVersion("1.5.0") and LooseVersion( torch.__version__ ) <= LooseVersion("1.6.0") _SYNC_BN_V3 = LooseVersion(torch.__version__) >= LooseVersion("1.6.0") _SYNC_BN_V4 = LooseVersion(torch.__version__) >= LooseVersion("1.9.0") class SyncBatchNorm(_BatchNorm): r"""Applies synchronous BatchNorm for distributed module with N-dimensional BatchNorm layer(s). See `BatchNorm <https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html?highlight=batchnorm#torch.nn.BatchNorm2d>`_ for more details. Arguments: num_features: Number of channels :math:`C` from the shape :math:`(N, C, ...)`. eps: A value added to the denominator for numerical stability. Default: 1e-5. momentum: The value used for the running_mean and running_var computation. Can be set to ``None`` for cumulative moving average (i.e. simple average). Default: 0.1. affine: A boolean value that when set to ``True``, this module has learnable affine parameters. Default: ``True``. track_running_stats: A boolean value that when set to ``True``, this module tracks the running mean and variance, and when set to ``False``, this module does not track such statistics and always uses batch statistics in both training and eval modes. Default: ``True``. .. note:: Only GPU input tensors are supported in the training mode. """ def __init__( self, num_features, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True, ): super().__init__(num_features, eps, momentum, affine, track_running_stats) def _check_input_dim(self, input): if input.dim() < 2: raise ValueError( "expected at least 2D input (got {}D input)".format(input.dim()) ) def _run_bn(self, input): return F.batch_norm( input, self.running_mean, self.running_var, self.weight, self.bias, self.training or not self.track_running_stats, self.momentum, self.eps, ) @torch.jit.unused def _maybe_run_sync_bn(self, input): if bagua.get_world_size() == 1: return self._run_bn(input) return _SyncBatchNorm.apply( input, self.weight, self.bias, self.running_mean, self.running_var, self.eps, self.momentum, ) def forward(self, input): # currently only GPU input is supported by underlying kernel from PyTorch if not input.is_cuda: raise ValueError("SyncBatchNorm expected input tensor to be on GPU") self._check_input_dim(input) if self.training and self.track_running_stats: assert self.num_batches_tracked is not None self.num_batches_tracked = self.num_batches_tracked + 1 if not self.training and self.track_running_stats: return self._run_bn(input) else: return self._maybe_run_sync_bn(input) @classmethod def convert_sync_batchnorm(cls, module): r"""Helper function to convert all :attr:`BatchNorm*D` layers in the model to `torch.nn.SyncBatchNorm <https://pytorch.org/docs/stable/generated/torch.nn.SyncBatchNorm.html?highlight=syncbatchnorm#torch.nn.SyncBatchNorm>`_ layers. Arguments: module (nn.Module): Module containing one or more :attr:`BatchNorm*D` layers Returns: The original :attr:`module` with the converted :class:`torch.nn.SyncBatchNorm` layers. If the original :attr:`module` is a :attr:`BatchNorm*D` layer, a new :class:`torch.nn.SyncBatchNorm` layer object will be returned instead. .. note:: This function must be called before :meth:`~bagua.torch_api.distributed.BaguaModule.with_bagua` method. Example:: >>> # Network with nn.BatchNorm layer >>> model = torch.nn.Sequential( ... torch.nn.Linear(D_in, H), ... torch.nn.ReLU(), ... torch.nn.Linear(H, D_out), ... ) >>> optimizer = torch.optim.SGD( ... model.parameters(), ... lr=0.01, ... momentum=0.9 ... ) >>> sync_bn_model = bagua.torch_api.contrib.sync_batchnorm.SyncBatchNorm.convert_sync_batchnorm(model) >>> bagua_model = sync_bn_model.with_bagua([optimizer], GradientAllReduce()) """ module_output = module if isinstance(module, torch.nn.modules.batchnorm._BatchNorm): module_output = SyncBatchNorm( module.num_features, module.eps, module.momentum, module.affine, module.track_running_stats, ) if module.affine: with torch.no_grad(): module_output.weight = module.weight module_output.bias = module.bias module_output.running_mean = module.running_mean module_output.running_var = module.running_var module_output.num_batches_tracked = module.num_batches_tracked if hasattr(module, "qconfig"): module_output.qconfig = module.qconfig for name, child in module.named_children(): module_output.add_module(name, cls.convert_sync_batchnorm(child)) del module return module_output class _SyncBatchNorm(Function): @staticmethod def forward(self, input, weight, bias, running_mean, running_var, eps, momentum): input = input.contiguous() size = input.numel() // input.size(1) count = torch.tensor([size]) # calculate mean/invstd for input. mean, invstd = torch.batch_norm_stats(input, eps) count, mean, invstd = count.cuda(), mean.cuda(), invstd.cuda() nums_ranks = bagua.get_world_size() count_all = torch.tensor( [torch.empty_like(count).cpu().detach().numpy() for _ in range(nums_ranks)] ).cuda() mean_all = torch.tensor( [torch.empty_like(mean).cpu().detach().numpy() for _ in range(nums_ranks)] ).cuda() invstd_all = torch.tensor( [torch.empty_like(invstd).cpu().detach().numpy() for _ in range(nums_ranks)] ).cuda() allgather(count.unsqueeze(0), count_all) allgather(mean.unsqueeze(0), mean_all) allgather(invstd.unsqueeze(0), invstd_all) if _SYNC_BN_V3: counts_for_bngswc = count_all.view(-1).float().to(input.device) else: # backwards compatibility counts_for_bngswc = count_all.view(-1).tolist() # calculate global mean & invstd mean, invstd = torch.batch_norm_gather_stats_with_counts( input, mean_all, invstd_all, running_mean, running_var, momentum, eps, counts_for_bngswc, ) self.save_for_backward(input, weight, mean, invstd, count_all) # apply element-wise normalization return torch.batch_norm_elemt(input, weight, bias, mean, invstd, eps) @staticmethod def backward(self, grad_output): grad_output = grad_output.contiguous() saved_input, weight, mean, invstd, count_all = self.saved_tensors need_input_grad, need_weight_grad, need_bias_grad = self.needs_input_grad[0:3] # calculate local stats as well as grad_weight / grad_bias sum_dy, sum_dy_xmu, grad_weight, grad_bias = torch.batch_norm_backward_reduce( grad_output, saved_input, mean, invstd, weight, need_input_grad, need_weight_grad, need_bias_grad, ) if need_input_grad: # synchronizing stats used to calculate input gradient. allreduce(sum_dy, sum_dy) allreduce(sum_dy_xmu, sum_dy_xmu) if _SYNC_BN_V4: # from 1.9.0 on we need a count tensor on all devices # count_all is calculated as total count across all ranks in forward function count_all = count_all.to(dtype=torch.int, device=grad_output.device) elif _SYNC_BN_V2 or _SYNC_BN_V3: # before 1.9.0 we need the count as an integer to compute means values count = count_all.sum() else: # before 1.5.0, sum_dy was sum of means from every worker, so we just # need to divide it by number of workers count = bagua.get_world_size() # backward pass for gradient calculation # we are calling into a non-public undocumented function which broke moving to 1.9.0 # https://github.com/pytorch/pytorch/issues/57900 if _SYNC_BN_V4: # from 1.9.0 on, sums and count parameters expected grad_input = torch.batch_norm_backward_elemt( grad_output, saved_input, mean, invstd, weight, sum_dy, sum_dy_xmu, count_all, ) else: # before 1.9.0, mean parameters expected, not sums and count grad_input = torch.batch_norm_backward_elemt( grad_output, saved_input, mean, invstd, weight, sum_dy / count, sum_dy_xmu / count, ) else: grad_input = None # synchronizing of grad_weight / grad_bias is not needed as distributed # training would handle all reduce. if weight is None or not need_weight_grad: grad_weight = None if weight is None or not need_bias_grad: grad_bias = None return grad_input, grad_weight, grad_bias, None, None, None, None, None, None
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 29937, 14187, 1266, 313, 29883, 29897, 501, 495, 8364, 11763, 29892, 9266, 29889, 322, 967, 23736, 1078, 29889, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29896, 476, 3357, 728, 283, 319, 29902, 28096, 669, 360, 29903, 29941, 12016, 29889, 13, 29937, 13, 29937, 2178, 10462, 21676, 29889, 13, 29937, 13, 29937, 910, 2752, 775, 338, 7794, 21144, 1090, 278, 350, 7230, 29899, 3293, 19405, 1476, 297, 278, 13, 29937, 365, 2965, 1430, 1660, 934, 297, 278, 3876, 3884, 310, 445, 2752, 5447, 29889, 13, 13, 3166, 1320, 13239, 29889, 3259, 1053, 4309, 852, 6594, 13, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 29889, 1300, 468, 3665, 29889, 2220, 1053, 6680, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 3166, 4842, 305, 29889, 15755, 29889, 7576, 29889, 16175, 12324, 1053, 903, 23145, 29940, 555, 13, 13, 5215, 19548, 3357, 29889, 7345, 305, 29918, 2754, 408, 19548, 3357, 13, 3166, 19548, 3357, 29889, 7345, 305, 29918, 2754, 29889, 27820, 362, 1053, 599, 29887, 1624, 29892, 599, 17469, 13, 13, 29937, 7437, 1328, 10007, 363, 2030, 10772, 29911, 25350, 13, 361, 451, 756, 5552, 29898, 7345, 305, 29889, 29926, 277, 29892, 376, 348, 3880, 29908, 1125, 13, 1678, 4842, 305, 29889, 29926, 277, 29889, 348, 3880, 353, 14013, 921, 29901, 921, 13, 13, 13, 29918, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29906, 353, 4309, 852, 6594, 29898, 7345, 305, 17255, 3259, 1649, 29897, 6736, 4309, 852, 6594, 703, 29896, 29889, 29945, 29889, 29900, 1159, 322, 4309, 852, 6594, 29898, 13, 1678, 4842, 305, 17255, 3259, 1649, 13, 29897, 5277, 4309, 852, 6594, 703, 29896, 29889, 29953, 29889, 29900, 1159, 13, 29918, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29941, 353, 4309, 852, 6594, 29898, 7345, 305, 17255, 3259, 1649, 29897, 6736, 4309, 852, 6594, 703, 29896, 29889, 29953, 29889, 29900, 1159, 13, 29918, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29946, 353, 4309, 852, 6594, 29898, 7345, 305, 17255, 3259, 1649, 29897, 6736, 4309, 852, 6594, 703, 29896, 29889, 29929, 29889, 29900, 1159, 13, 13, 13, 1990, 317, 2720, 23145, 29940, 555, 7373, 23145, 29940, 555, 1125, 13, 1678, 364, 15945, 29908, 2052, 3687, 12231, 681, 350, 905, 29940, 555, 363, 13235, 3883, 411, 405, 29899, 12531, 350, 905, 29940, 555, 7546, 29898, 29879, 467, 13, 1678, 2823, 421, 23145, 29940, 555, 529, 991, 597, 2272, 7345, 305, 29889, 990, 29914, 2640, 29914, 13844, 29914, 13525, 29914, 7345, 305, 29889, 15755, 29889, 23145, 29940, 555, 29906, 29881, 29889, 1420, 29973, 28970, 29922, 16175, 12324, 29937, 7345, 305, 29889, 15755, 29889, 23145, 29940, 555, 29906, 29881, 13885, 29918, 363, 901, 4902, 29889, 13, 13, 1678, 11842, 9331, 29901, 13, 4706, 954, 29918, 22100, 29901, 9681, 310, 18196, 584, 755, 18078, 29907, 29952, 515, 278, 8267, 584, 755, 18078, 29898, 29940, 29892, 315, 29892, 2023, 14466, 13, 4706, 321, 567, 29901, 319, 995, 2715, 304, 278, 14267, 1061, 363, 16259, 25806, 29889, 13109, 29901, 29871, 29896, 29872, 29899, 29945, 29889, 13, 4706, 19399, 29901, 450, 995, 1304, 363, 278, 2734, 29918, 12676, 322, 2734, 29918, 1707, 13, 9651, 16287, 29889, 1815, 367, 731, 304, 4954, 8516, 16159, 363, 13299, 28524, 8401, 6588, 13, 9651, 313, 29875, 29889, 29872, 29889, 2560, 6588, 467, 13109, 29901, 29871, 29900, 29889, 29896, 29889, 13, 4706, 2756, 457, 29901, 319, 7223, 995, 393, 746, 731, 304, 4954, 5574, 29952, 1673, 445, 3883, 756, 13, 9651, 5110, 519, 2756, 457, 4128, 29889, 13109, 29901, 4954, 5574, 29952, 1412, 13, 4706, 5702, 29918, 21094, 29918, 16202, 29901, 319, 7223, 995, 393, 746, 731, 304, 4954, 5574, 29952, 1673, 445, 13, 9651, 3883, 16257, 278, 2734, 2099, 322, 20162, 29892, 322, 746, 731, 304, 4954, 8824, 29952, 1673, 13, 9651, 445, 3883, 947, 451, 5702, 1316, 13964, 322, 2337, 3913, 9853, 13, 9651, 13964, 297, 1716, 6694, 322, 19745, 18893, 29889, 13109, 29901, 4954, 5574, 29952, 1412, 13, 13, 1678, 6317, 4443, 1057, 9333, 22796, 1881, 25187, 943, 526, 6969, 297, 278, 6694, 4464, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 954, 29918, 22100, 29892, 13, 4706, 321, 567, 29922, 29896, 29872, 29899, 29945, 29892, 13, 4706, 19399, 29922, 29900, 29889, 29896, 29892, 13, 4706, 2756, 457, 29922, 5574, 29892, 13, 4706, 5702, 29918, 21094, 29918, 16202, 29922, 5574, 29892, 13, 268, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1949, 29918, 22100, 29892, 321, 567, 29892, 19399, 29892, 2756, 457, 29892, 5702, 29918, 21094, 29918, 16202, 29897, 13, 13, 1678, 822, 903, 3198, 29918, 2080, 29918, 6229, 29898, 1311, 29892, 1881, 1125, 13, 4706, 565, 1881, 29889, 6229, 580, 529, 29871, 29906, 29901, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 376, 9684, 472, 3203, 29871, 29906, 29928, 1881, 313, 7085, 6571, 29928, 1881, 29897, 1642, 4830, 29898, 2080, 29889, 6229, 3101, 13, 9651, 1723, 13, 13, 1678, 822, 903, 3389, 29918, 11197, 29898, 1311, 29892, 1881, 1125, 13, 4706, 736, 383, 29889, 16175, 29918, 12324, 29898, 13, 9651, 1881, 29892, 13, 9651, 1583, 29889, 21094, 29918, 12676, 29892, 13, 9651, 1583, 29889, 21094, 29918, 1707, 29892, 13, 9651, 1583, 29889, 7915, 29892, 13, 9651, 1583, 29889, 29890, 3173, 29892, 13, 9651, 1583, 29889, 26495, 470, 451, 1583, 29889, 11294, 29918, 21094, 29918, 16202, 29892, 13, 9651, 1583, 29889, 29885, 2932, 398, 29892, 13, 9651, 1583, 29889, 8961, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 7345, 305, 29889, 29926, 277, 29889, 348, 3880, 13, 1678, 822, 903, 26026, 29918, 3389, 29918, 16593, 29918, 11197, 29898, 1311, 29892, 1881, 1125, 13, 4706, 565, 19548, 3357, 29889, 657, 29918, 11526, 29918, 2311, 580, 1275, 29871, 29896, 29901, 13, 9651, 736, 1583, 3032, 3389, 29918, 11197, 29898, 2080, 29897, 13, 4706, 736, 903, 21077, 23145, 29940, 555, 29889, 7302, 29898, 13, 9651, 1881, 29892, 13, 9651, 1583, 29889, 7915, 29892, 13, 9651, 1583, 29889, 29890, 3173, 29892, 13, 9651, 1583, 29889, 21094, 29918, 12676, 29892, 13, 9651, 1583, 29889, 21094, 29918, 1707, 29892, 13, 9651, 1583, 29889, 8961, 29892, 13, 9651, 1583, 29889, 29885, 2932, 398, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 1881, 1125, 13, 4706, 396, 5279, 871, 22796, 1881, 338, 6969, 491, 14407, 8466, 515, 10772, 29911, 25350, 13, 4706, 565, 451, 1881, 29889, 275, 29918, 29883, 6191, 29901, 13, 9651, 12020, 7865, 2392, 703, 21077, 23145, 29940, 555, 3806, 1881, 12489, 304, 367, 373, 22796, 1159, 13, 13, 4706, 1583, 3032, 3198, 29918, 2080, 29918, 6229, 29898, 2080, 29897, 13, 13, 4706, 565, 1583, 29889, 26495, 322, 1583, 29889, 11294, 29918, 21094, 29918, 16202, 29901, 13, 9651, 4974, 1583, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 338, 451, 6213, 13, 9651, 1583, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 353, 1583, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 718, 29871, 29896, 13, 13, 4706, 565, 451, 1583, 29889, 26495, 322, 1583, 29889, 11294, 29918, 21094, 29918, 16202, 29901, 13, 9651, 736, 1583, 3032, 3389, 29918, 11197, 29898, 2080, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 26026, 29918, 3389, 29918, 16593, 29918, 11197, 29898, 2080, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 3588, 29918, 16593, 29918, 16175, 12324, 29898, 25932, 29892, 3883, 1125, 13, 4706, 364, 15945, 29908, 10739, 740, 304, 3588, 599, 584, 5552, 18078, 23145, 29940, 555, 29930, 29928, 29952, 15359, 297, 278, 1904, 304, 13, 4706, 421, 7345, 305, 29889, 15755, 29889, 21077, 23145, 29940, 555, 529, 991, 597, 2272, 7345, 305, 29889, 990, 29914, 2640, 29914, 13844, 29914, 13525, 29914, 7345, 305, 29889, 15755, 29889, 21077, 23145, 29940, 555, 29889, 1420, 29973, 28970, 29922, 16593, 16175, 12324, 29937, 7345, 305, 29889, 15755, 29889, 21077, 23145, 29940, 555, 13885, 29918, 15359, 29889, 13, 13, 4706, 11842, 9331, 29901, 13, 9651, 3883, 313, 15755, 29889, 7355, 1125, 15591, 6943, 697, 470, 901, 584, 5552, 18078, 23145, 29940, 555, 29930, 29928, 29952, 15359, 13, 13, 4706, 16969, 29901, 13, 9651, 450, 2441, 584, 5552, 18078, 5453, 29952, 411, 278, 11543, 584, 1990, 18078, 7345, 305, 29889, 15755, 29889, 21077, 23145, 29940, 555, 29952, 13, 9651, 15359, 29889, 960, 278, 2441, 584, 5552, 18078, 5453, 29952, 338, 263, 584, 5552, 18078, 23145, 29940, 555, 29930, 29928, 29952, 7546, 29892, 13, 9651, 263, 716, 584, 1990, 18078, 7345, 305, 29889, 15755, 29889, 21077, 23145, 29940, 555, 29952, 7546, 1203, 674, 367, 4133, 13, 9651, 2012, 29889, 13, 13, 4706, 6317, 4443, 1057, 910, 740, 1818, 367, 2000, 1434, 584, 29885, 621, 18078, 30022, 23156, 3357, 29889, 7345, 305, 29918, 2754, 29889, 5721, 7541, 29889, 23544, 3357, 7355, 29889, 2541, 29918, 23156, 3357, 29952, 1158, 29889, 13, 13, 4706, 8741, 1057, 13, 9651, 8653, 396, 8527, 411, 302, 29876, 29889, 23145, 29940, 555, 7546, 13, 9651, 8653, 1904, 353, 4842, 305, 29889, 15755, 29889, 16941, 2556, 29898, 13, 9651, 2023, 418, 4842, 305, 29889, 15755, 29889, 12697, 29898, 29928, 29918, 262, 29892, 379, 511, 13, 9651, 2023, 418, 4842, 305, 29889, 15755, 29889, 1123, 29931, 29965, 3285, 13, 9651, 2023, 418, 4842, 305, 29889, 15755, 29889, 12697, 29898, 29950, 29892, 360, 29918, 449, 511, 13, 9651, 2023, 1678, 1723, 13, 9651, 8653, 5994, 3950, 353, 4842, 305, 29889, 20640, 29889, 26016, 29928, 29898, 13, 9651, 2023, 418, 1904, 29889, 16744, 3285, 13, 9651, 2023, 418, 301, 29878, 29922, 29900, 29889, 29900, 29896, 29892, 13, 9651, 2023, 418, 19399, 29922, 29900, 29889, 29929, 13, 9651, 2023, 1678, 1723, 13, 9651, 8653, 16523, 29918, 11197, 29918, 4299, 353, 19548, 3357, 29889, 7345, 305, 29918, 2754, 29889, 21570, 29889, 16593, 29918, 16175, 12324, 29889, 21077, 23145, 29940, 555, 29889, 13441, 29918, 16593, 29918, 16175, 12324, 29898, 4299, 29897, 13, 9651, 8653, 19548, 3357, 29918, 4299, 353, 16523, 29918, 11197, 29918, 4299, 29889, 2541, 29918, 23156, 3357, 4197, 20640, 3950, 1402, 19295, 993, 3596, 29934, 6085, 346, 3101, 13, 4706, 9995, 13, 4706, 3883, 29918, 4905, 353, 3883, 13, 13, 4706, 565, 338, 8758, 29898, 5453, 29892, 4842, 305, 29889, 15755, 29889, 7576, 29889, 16175, 12324, 3032, 23145, 29940, 555, 1125, 13, 9651, 3883, 29918, 4905, 353, 317, 2720, 23145, 29940, 555, 29898, 13, 18884, 3883, 29889, 1949, 29918, 22100, 29892, 13, 18884, 3883, 29889, 8961, 29892, 13, 18884, 3883, 29889, 29885, 2932, 398, 29892, 13, 18884, 3883, 29889, 3470, 457, 29892, 13, 18884, 3883, 29889, 11294, 29918, 21094, 29918, 16202, 29892, 13, 9651, 1723, 13, 9651, 565, 3883, 29889, 3470, 457, 29901, 13, 18884, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 462, 1678, 3883, 29918, 4905, 29889, 7915, 353, 3883, 29889, 7915, 13, 462, 1678, 3883, 29918, 4905, 29889, 29890, 3173, 353, 3883, 29889, 29890, 3173, 13, 9651, 3883, 29918, 4905, 29889, 21094, 29918, 12676, 353, 3883, 29889, 21094, 29918, 12676, 13, 9651, 3883, 29918, 4905, 29889, 21094, 29918, 1707, 353, 3883, 29889, 21094, 29918, 1707, 13, 9651, 3883, 29918, 4905, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 353, 3883, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 13, 9651, 565, 756, 5552, 29898, 5453, 29892, 376, 29939, 2917, 29908, 1125, 13, 18884, 3883, 29918, 4905, 29889, 29939, 2917, 353, 3883, 29889, 29939, 2917, 13, 4706, 363, 1024, 29892, 2278, 297, 3883, 29889, 17514, 29918, 11991, 7295, 13, 9651, 3883, 29918, 4905, 29889, 1202, 29918, 5453, 29898, 978, 29892, 1067, 29879, 29889, 13441, 29918, 16593, 29918, 16175, 12324, 29898, 5145, 876, 13, 4706, 628, 3883, 13, 4706, 736, 3883, 29918, 4905, 13, 13, 13, 1990, 903, 21077, 23145, 29940, 555, 29898, 6678, 1125, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 6375, 29898, 1311, 29892, 1881, 29892, 7688, 29892, 24003, 29892, 2734, 29918, 12676, 29892, 2734, 29918, 1707, 29892, 321, 567, 29892, 19399, 1125, 13, 4706, 1881, 353, 1881, 29889, 1285, 5526, 681, 580, 13, 13, 4706, 2159, 353, 1881, 29889, 1949, 295, 580, 849, 1881, 29889, 2311, 29898, 29896, 29897, 13, 4706, 2302, 353, 4842, 305, 29889, 20158, 4197, 2311, 2314, 13, 13, 4706, 396, 8147, 2099, 29914, 11569, 4172, 363, 1881, 29889, 13, 4706, 2099, 29892, 2437, 4172, 353, 4842, 305, 29889, 16175, 29918, 12324, 29918, 16202, 29898, 2080, 29892, 321, 567, 29897, 13, 4706, 2302, 29892, 2099, 29892, 2437, 4172, 353, 2302, 29889, 29883, 6191, 3285, 2099, 29889, 29883, 6191, 3285, 2437, 4172, 29889, 29883, 6191, 580, 13, 13, 4706, 954, 29879, 29918, 661, 2039, 353, 19548, 3357, 29889, 657, 29918, 11526, 29918, 2311, 580, 13, 4706, 2302, 29918, 497, 353, 4842, 305, 29889, 20158, 29898, 13, 9651, 518, 7345, 305, 29889, 6310, 29918, 4561, 29898, 2798, 467, 21970, 2141, 4801, 496, 2141, 23749, 580, 363, 903, 297, 3464, 29898, 1949, 29879, 29918, 661, 2039, 4638, 13, 4706, 13742, 29883, 6191, 580, 13, 4706, 2099, 29918, 497, 353, 4842, 305, 29889, 20158, 29898, 13, 9651, 518, 7345, 305, 29889, 6310, 29918, 4561, 29898, 12676, 467, 21970, 2141, 4801, 496, 2141, 23749, 580, 363, 903, 297, 3464, 29898, 1949, 29879, 29918, 661, 2039, 4638, 13, 4706, 13742, 29883, 6191, 580, 13, 4706, 2437, 4172, 29918, 497, 353, 4842, 305, 29889, 20158, 29898, 13, 9651, 518, 7345, 305, 29889, 6310, 29918, 4561, 29898, 11569, 4172, 467, 21970, 2141, 4801, 496, 2141, 23749, 580, 363, 903, 297, 3464, 29898, 1949, 29879, 29918, 661, 2039, 4638, 13, 4706, 13742, 29883, 6191, 580, 13, 13, 4706, 599, 29887, 1624, 29898, 2798, 29889, 6948, 802, 29872, 911, 29898, 29900, 511, 2302, 29918, 497, 29897, 13, 4706, 599, 29887, 1624, 29898, 12676, 29889, 6948, 802, 29872, 911, 29898, 29900, 511, 2099, 29918, 497, 29897, 13, 4706, 599, 29887, 1624, 29898, 11569, 4172, 29889, 6948, 802, 29872, 911, 29898, 29900, 511, 2437, 4172, 29918, 497, 29897, 13, 13, 4706, 565, 903, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29941, 29901, 13, 9651, 18139, 29918, 1454, 29918, 29890, 865, 2774, 29883, 353, 2302, 29918, 497, 29889, 1493, 6278, 29896, 467, 7411, 2141, 517, 29898, 2080, 29889, 10141, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 28953, 24521, 13, 9651, 18139, 29918, 1454, 29918, 29890, 865, 2774, 29883, 353, 2302, 29918, 497, 29889, 1493, 6278, 29896, 467, 25027, 391, 580, 13, 13, 4706, 396, 8147, 5534, 2099, 669, 2437, 4172, 13, 4706, 2099, 29892, 2437, 4172, 353, 4842, 305, 29889, 16175, 29918, 12324, 29918, 29887, 1624, 29918, 16202, 29918, 2541, 29918, 2798, 29879, 29898, 13, 9651, 1881, 29892, 13, 9651, 2099, 29918, 497, 29892, 13, 9651, 2437, 4172, 29918, 497, 29892, 13, 9651, 2734, 29918, 12676, 29892, 13, 9651, 2734, 29918, 1707, 29892, 13, 9651, 19399, 29892, 13, 9651, 321, 567, 29892, 13, 9651, 18139, 29918, 1454, 29918, 29890, 865, 2774, 29883, 29892, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 7620, 29918, 1454, 29918, 1627, 1328, 29898, 2080, 29892, 7688, 29892, 2099, 29892, 2437, 4172, 29892, 2302, 29918, 497, 29897, 13, 13, 4706, 396, 3394, 1543, 29899, 3538, 4226, 2133, 13, 4706, 736, 4842, 305, 29889, 16175, 29918, 12324, 29918, 20461, 29873, 29898, 2080, 29892, 7688, 29892, 24003, 29892, 2099, 29892, 2437, 4172, 29892, 321, 567, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1250, 1328, 29898, 1311, 29892, 4656, 29918, 4905, 1125, 13, 4706, 4656, 29918, 4905, 353, 4656, 29918, 4905, 29889, 1285, 5526, 681, 580, 13, 4706, 7160, 29918, 2080, 29892, 7688, 29892, 2099, 29892, 2437, 4172, 29892, 2302, 29918, 497, 353, 1583, 29889, 17314, 29918, 29873, 575, 943, 13, 4706, 817, 29918, 2080, 29918, 5105, 29892, 817, 29918, 7915, 29918, 5105, 29892, 817, 29918, 29890, 3173, 29918, 5105, 353, 1583, 29889, 484, 5779, 29918, 2080, 29918, 5105, 29961, 29900, 29901, 29941, 29962, 13, 13, 4706, 396, 8147, 1887, 22663, 408, 1532, 408, 4656, 29918, 7915, 847, 4656, 29918, 29890, 3173, 13, 4706, 2533, 29918, 4518, 29892, 2533, 29918, 4518, 29918, 29916, 2589, 29892, 4656, 29918, 7915, 29892, 4656, 29918, 29890, 3173, 353, 4842, 305, 29889, 16175, 29918, 12324, 29918, 1627, 1328, 29918, 17469, 29898, 13, 9651, 4656, 29918, 4905, 29892, 13, 9651, 7160, 29918, 2080, 29892, 13, 9651, 2099, 29892, 13, 9651, 2437, 4172, 29892, 13, 9651, 7688, 29892, 13, 9651, 817, 29918, 2080, 29918, 5105, 29892, 13, 9651, 817, 29918, 7915, 29918, 5105, 29892, 13, 9651, 817, 29918, 29890, 3173, 29918, 5105, 29892, 13, 4706, 1723, 13, 13, 4706, 565, 817, 29918, 2080, 29918, 5105, 29901, 13, 9651, 396, 12231, 5281, 22663, 1304, 304, 8147, 1881, 16030, 29889, 13, 9651, 599, 17469, 29898, 2083, 29918, 4518, 29892, 2533, 29918, 4518, 29897, 13, 9651, 599, 17469, 29898, 2083, 29918, 4518, 29918, 29916, 2589, 29892, 2533, 29918, 4518, 29918, 29916, 2589, 29897, 13, 13, 9651, 565, 903, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29946, 29901, 13, 18884, 396, 515, 29871, 29896, 29889, 29929, 29889, 29900, 373, 591, 817, 263, 2302, 12489, 373, 599, 9224, 13, 18884, 396, 2302, 29918, 497, 338, 12833, 408, 3001, 2302, 4822, 599, 27871, 297, 6375, 740, 13, 18884, 2302, 29918, 497, 353, 2302, 29918, 497, 29889, 517, 29898, 29881, 1853, 29922, 7345, 305, 29889, 524, 29892, 4742, 29922, 5105, 29918, 4905, 29889, 10141, 29897, 13, 9651, 25342, 903, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29906, 470, 903, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29941, 29901, 13, 18884, 396, 1434, 29871, 29896, 29889, 29929, 29889, 29900, 591, 817, 278, 2302, 408, 385, 6043, 304, 10272, 2794, 1819, 13, 18884, 2302, 353, 2302, 29918, 497, 29889, 2083, 580, 13, 9651, 1683, 29901, 13, 18884, 396, 1434, 29871, 29896, 29889, 29945, 29889, 29900, 29892, 2533, 29918, 4518, 471, 2533, 310, 2794, 515, 1432, 15645, 29892, 577, 591, 925, 13, 18884, 396, 817, 304, 16429, 372, 491, 1353, 310, 17162, 13, 18884, 2302, 353, 19548, 3357, 29889, 657, 29918, 11526, 29918, 2311, 580, 13, 13, 9651, 396, 1250, 1328, 1209, 363, 16030, 13944, 13, 9651, 396, 591, 526, 5432, 964, 263, 1661, 29899, 3597, 563, 4463, 287, 740, 607, 14455, 8401, 304, 29871, 29896, 29889, 29929, 29889, 29900, 13, 9651, 396, 2045, 597, 3292, 29889, 510, 29914, 2272, 7345, 305, 29914, 2272, 7345, 305, 29914, 12175, 29914, 29945, 29955, 29929, 29900, 29900, 13, 9651, 565, 903, 14816, 15868, 29918, 29933, 29940, 29918, 29963, 29946, 29901, 13, 18884, 396, 515, 29871, 29896, 29889, 29929, 29889, 29900, 373, 29892, 25470, 322, 2302, 4128, 3806, 13, 18884, 4656, 29918, 2080, 353, 4842, 305, 29889, 16175, 29918, 12324, 29918, 1627, 1328, 29918, 20461, 29873, 29898, 13, 462, 1678, 4656, 29918, 4905, 29892, 13, 462, 1678, 7160, 29918, 2080, 29892, 13, 462, 1678, 2099, 29892, 13, 462, 1678, 2437, 4172, 29892, 13, 462, 1678, 7688, 29892, 13, 462, 1678, 2533, 29918, 4518, 29892, 13, 462, 1678, 2533, 29918, 4518, 29918, 29916, 2589, 29892, 13, 462, 1678, 2302, 29918, 497, 29892, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 396, 1434, 29871, 29896, 29889, 29929, 29889, 29900, 29892, 2099, 4128, 3806, 29892, 451, 25470, 322, 2302, 13, 18884, 4656, 29918, 2080, 353, 4842, 305, 29889, 16175, 29918, 12324, 29918, 1627, 1328, 29918, 20461, 29873, 29898, 13, 462, 1678, 4656, 29918, 4905, 29892, 13, 462, 1678, 7160, 29918, 2080, 29892, 13, 462, 1678, 2099, 29892, 13, 462, 1678, 2437, 4172, 29892, 13, 462, 1678, 7688, 29892, 13, 462, 1678, 2533, 29918, 4518, 847, 2302, 29892, 13, 462, 1678, 2533, 29918, 4518, 29918, 29916, 2589, 847, 2302, 29892, 13, 18884, 1723, 13, 4706, 1683, 29901, 13, 9651, 4656, 29918, 2080, 353, 6213, 13, 13, 4706, 396, 12231, 5281, 310, 4656, 29918, 7915, 847, 4656, 29918, 29890, 3173, 338, 451, 4312, 408, 13235, 13, 4706, 396, 6694, 723, 4386, 599, 10032, 29889, 13, 4706, 565, 7688, 338, 6213, 470, 451, 817, 29918, 7915, 29918, 5105, 29901, 13, 9651, 4656, 29918, 7915, 353, 6213, 13, 13, 4706, 565, 7688, 338, 6213, 470, 451, 817, 29918, 29890, 3173, 29918, 5105, 29901, 13, 9651, 4656, 29918, 29890, 3173, 353, 6213, 13, 13, 4706, 736, 4656, 29918, 2080, 29892, 4656, 29918, 7915, 29892, 4656, 29918, 29890, 3173, 29892, 6213, 29892, 6213, 29892, 6213, 29892, 6213, 29892, 6213, 29892, 6213, 13, 2 ]
lang/rust/types.py
adsharma/flattools
17
81345
<filename>lang/rust/types.py from fbs.fbs import FBSType class FBSRustType(FBSType): _VALUES_TO_RUST_TYPES = { FBSType.BOOL: "bool", FBSType.BYTE: "i8", FBSType.UBYTE: "u8", FBSType.SHORT: "i16", FBSType.USHORT: "u16", FBSType.INT: "i32", FBSType.UINT: "u32", FBSType.FLOAT: "f32", FBSType.LONG: "i64", FBSType.ULONG: "u64", FBSType.DOUBLE: "f64", FBSType.STRING: "String", FBSType.STRUCT: "interface", FBSType.TABLE: "interface", FBSType.UNION: "interface", FBSType.VECTOR: "interface", FBSType.ENUM: "enum", } def optionalize(primitive): return f"Option<{primitive}>"
[ 1, 529, 9507, 29958, 3893, 29914, 23575, 29914, 8768, 29889, 2272, 13, 3166, 285, 5824, 29889, 29888, 5824, 1053, 28816, 1254, 668, 13, 13, 13, 1990, 383, 9851, 29934, 504, 1542, 29898, 18426, 1254, 668, 1125, 13, 1678, 903, 8932, 12996, 29918, 4986, 29918, 29934, 17321, 29918, 15631, 29925, 2890, 353, 426, 13, 4706, 28816, 1254, 668, 29889, 28443, 29901, 376, 11227, 613, 13, 4706, 28816, 1254, 668, 29889, 22716, 4330, 29901, 376, 29875, 29947, 613, 13, 4706, 28816, 1254, 668, 29889, 7466, 29979, 4330, 29901, 376, 29884, 29947, 613, 13, 4706, 28816, 1254, 668, 29889, 7068, 8476, 29901, 376, 29875, 29896, 29953, 613, 13, 4706, 28816, 1254, 668, 29889, 3308, 29950, 8476, 29901, 376, 29884, 29896, 29953, 613, 13, 4706, 28816, 1254, 668, 29889, 10192, 29901, 376, 29875, 29941, 29906, 613, 13, 4706, 28816, 1254, 668, 29889, 29965, 10192, 29901, 376, 29884, 29941, 29906, 613, 13, 4706, 28816, 1254, 668, 29889, 29943, 3927, 1299, 29901, 376, 29888, 29941, 29906, 613, 13, 4706, 28816, 1254, 668, 29889, 29931, 20614, 29901, 376, 29875, 29953, 29946, 613, 13, 4706, 28816, 1254, 668, 29889, 13309, 20614, 29901, 376, 29884, 29953, 29946, 613, 13, 4706, 28816, 1254, 668, 29889, 3970, 7466, 1307, 29901, 376, 29888, 29953, 29946, 613, 13, 4706, 28816, 1254, 668, 29889, 20785, 29901, 376, 1231, 613, 13, 4706, 28816, 1254, 668, 29889, 10810, 29965, 1783, 29901, 376, 13248, 613, 13, 4706, 28816, 1254, 668, 29889, 21009, 29901, 376, 13248, 613, 13, 4706, 28816, 1254, 668, 29889, 3904, 2725, 29901, 376, 13248, 613, 13, 4706, 28816, 1254, 668, 29889, 12064, 1783, 1955, 29901, 376, 13248, 613, 13, 4706, 28816, 1254, 668, 29889, 1430, 5005, 29901, 376, 18605, 613, 13, 1678, 500, 13, 13, 13, 1753, 13136, 675, 29898, 9469, 3321, 1125, 13, 1678, 736, 285, 29908, 8375, 29966, 29912, 9469, 3321, 29913, 11903, 13, 2 ]
ptah/ptahsettings.py
timgates42/ptah
13
1610830
<reponame>timgates42/ptah """ ptah settings """ import pytz import logging import sqlalchemy import translationstring import ptah.form from email.utils import formataddr from pyramid.events import ApplicationCreated from pyramid_mailer.interfaces import IMailer import ptah from ptah import settings _ = translationstring.TranslationStringFactory('ptah') log = logging.getLogger('ptah') ptah.register_settings( ptah.CFG_ID_PTAH, ptah.form.BoolField( 'auth', title = _('Authentication policy'), description = _('Enable authentication policy.'), default = False), ptah.form.TextField( 'secret', title = _('Authentication policy secret'), description = _('The secret (a string) used for auth_tkt ' 'cookie signing'), default = '', tint = True), ptah.form.TextField( 'hashalg', title = _('Authentication policy hash algorithm'), description = _('The hash algorithm used for auth_tkt ' 'cookie generation'), default = 'sha512'), ptah.form.TextField( 'manage', title = 'Ptah manage id', default = 'ptah-manage'), ptah.form.LinesField( 'managers', title = 'Manage login', description = 'List of user logins with access rights to '\ 'ptah management ui.', default = ()), ptah.form.TextField( 'manager_role', title = 'Manager role', description = 'Specific role with access rights to ptah management ui.', default = ''), ptah.form.LinesField( 'disable_modules', title = 'Hide Modules in Management UI', description = 'List of modules names to hide in manage ui', default = ()), ptah.form.LinesField( 'enable_modules', title = 'Enable Modules in Management UI', description = 'List of modules names to enable in manage ui', default = ()), ptah.form.LinesField( 'disable_models', title = 'Hide Models in Model Management UI', description = 'List of models to hide in model manage ui', default = ()), ptah.form.TextField( 'email_from_name', default = 'Site administrator'), ptah.form.TextField( 'email_from_address', validator = ptah.form.Email(), required = False, default = 'admin@localhost'), ptah.form.ChoiceField( 'pwd_manager', title = 'Password manager', description = 'Available password managers '\ '("plain", "ssha", "bcrypt")', vocabulary = ptah.form.Vocabulary( "plain", "ssha",), default = 'plain'), ptah.form.IntegerField( 'pwd_min_length', title = 'Length', description = 'Password minimium length.', default = 5), ptah.form.BoolField( 'pwd_letters_digits', title = 'Letters and digits', description = 'Use letters and digits in password.', default = False), ptah.form.BoolField( 'pwd_letters_mixed_case', title = 'Letters mixed case', description = 'Use letters in mixed case.', default = False), ptah.form.LinesField( 'db_skip_tables', title = 'Skip table creation', description = 'Do not create listed tables during data population.', default = ()), ptah.form.LinesField( 'default_roles', title = 'Default roles', description = 'List of default assigned roles for all principals.', default = ()), title = _('Ptah settings'), ) def set_mailer(cfg, mailer=None): def action(cfg, mailer): if not mailer: mailer = cfg.registry.queryUtility(IMailer).direct_delivery PTAH = ptah.get_settings(ptah.CFG_ID_PTAH, cfg.registry) PTAH['mailer'] = mailer cfg.action('ptah.ptah_mailer', action, (cfg, mailer)) class DummyMailer(object): def send(self, from_, to_, message): log.warning("Mailer is not configured.") log.warning(message) @ptah.subscriber(ptah.events.SettingsInitializing) def initialized(ev): PTAH = ptah.get_settings(ptah.CFG_ID_PTAH, ev.registry) # mail if PTAH.get('mailer') is None: PTAH['mailer'] = DummyMailer() PTAH['full_email_address'] = formataddr( (PTAH['email_from_name'], PTAH['email_from_address'])) def enable_manage(cfg, name='ptah-manage', access_manager=None, managers=None, manager_role=None, disable_modules=None, enable_modules=None): """Implementation for pyramid `ptah_init_manage` directive """ def action(cfg, name, access_manager, managers, manager_role, disable_modules): PTAH = cfg.ptah_get_settings(ptah.CFG_ID_PTAH) PTAH['manage'] = name if managers is not None: PTAH['managers'] = managers if manager_role is not None: PTAH['manager_role'] = manager_role if disable_modules is not None: PTAH['disable_modules'] = disable_modules if enable_modules is not None: PTAH['enable_modules'] = enable_modules if access_manager is None: access_manager = ptah.manage.PtahAccessManager(cfg.registry) ptah.manage.set_access_manager(access_manager, cfg.registry) cfg.add_route('ptah-manage', '/{0}/*traverse'.format(name), factory=ptah.manage.PtahManageRoute, use_global_views=True) cfg.action( 'ptah.ptah_manage', action, (cfg, name, access_manager, managers, manager_role, disable_modules), order=999999+1) def initialize_sql(cfg, prefix='sqlalchemy.'): def action(cfg): PTAH = cfg.ptah_get_settings(ptah.CFG_ID_PTAH) PTAH['sqlalchemy_initialized'] = True cfg.include('pyramid_sqlalchemy') cfg.action('ptah.initalize_sql', action, (cfg,)) # check_version from ptah import migrate cfg.add_subscriber(migrate.check_version, ApplicationCreated) @ptah.subscriber(ApplicationCreated) def starting(ev): settings.load_dbsettings()
[ 1, 529, 276, 1112, 420, 29958, 29873, 2492, 1078, 29946, 29906, 29914, 415, 801, 13, 15945, 29908, 19592, 801, 6055, 9995, 13, 5215, 282, 3637, 29920, 13, 5215, 12183, 13, 5215, 4576, 284, 305, 6764, 13, 5215, 13962, 1807, 13, 5215, 19592, 801, 29889, 689, 13, 3166, 4876, 29889, 13239, 1053, 3402, 10030, 13, 3166, 11451, 2572, 333, 29889, 13604, 1053, 8427, 20399, 13, 3166, 11451, 2572, 333, 29918, 2549, 261, 29889, 1639, 8726, 1053, 306, 14925, 261, 13, 13, 5215, 19592, 801, 13, 3166, 19592, 801, 1053, 6055, 13, 13, 29918, 353, 13962, 1807, 29889, 4300, 18411, 1231, 5126, 877, 415, 801, 1495, 13, 13, 1188, 353, 12183, 29889, 657, 16363, 877, 415, 801, 1495, 13, 13, 13, 415, 801, 29889, 9573, 29918, 11027, 29898, 13, 1678, 19592, 801, 29889, 9207, 29954, 29918, 1367, 29918, 29925, 6040, 29950, 29892, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 24693, 3073, 29898, 13, 4706, 525, 5150, 742, 13, 4706, 3611, 353, 903, 877, 16746, 8898, 5477, 13, 4706, 6139, 353, 903, 877, 20701, 10760, 8898, 29889, 5477, 13, 4706, 2322, 353, 7700, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 15778, 29898, 13, 4706, 525, 19024, 742, 13, 4706, 3611, 353, 903, 877, 16746, 8898, 7035, 5477, 13, 4706, 6139, 353, 903, 877, 1576, 7035, 313, 29874, 1347, 29897, 1304, 363, 4817, 29918, 29873, 1193, 525, 13, 462, 4706, 525, 21509, 26188, 5477, 13, 4706, 2322, 353, 15516, 13, 4706, 260, 524, 353, 5852, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 15778, 29898, 13, 4706, 525, 8568, 9564, 742, 13, 4706, 3611, 353, 903, 877, 16746, 8898, 6608, 5687, 5477, 13, 4706, 6139, 353, 903, 877, 1576, 6608, 5687, 1304, 363, 4817, 29918, 29873, 1193, 525, 13, 462, 4706, 525, 21509, 12623, 5477, 13, 4706, 2322, 353, 525, 17051, 29945, 29896, 29906, 5477, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 15778, 29898, 13, 4706, 525, 1171, 482, 742, 13, 4706, 3611, 353, 525, 29925, 29873, 801, 10933, 1178, 742, 13, 4706, 2322, 353, 525, 415, 801, 29899, 1171, 482, 5477, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 20261, 3073, 29898, 13, 4706, 525, 1171, 18150, 742, 13, 4706, 3611, 353, 525, 2517, 482, 6464, 742, 13, 4706, 6139, 353, 525, 1293, 310, 1404, 1480, 1144, 411, 2130, 10462, 304, 11297, 13, 462, 9651, 525, 415, 801, 10643, 14313, 29889, 742, 13, 4706, 2322, 353, 3861, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 15778, 29898, 13, 4706, 525, 12847, 29918, 12154, 742, 13, 4706, 3611, 353, 525, 3260, 6297, 742, 13, 4706, 6139, 353, 525, 10299, 928, 6297, 411, 2130, 10462, 304, 19592, 801, 10643, 14313, 29889, 742, 13, 4706, 2322, 353, 525, 5477, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 20261, 3073, 29898, 13, 4706, 525, 20472, 29918, 7576, 742, 13, 4706, 3611, 353, 525, 29950, 680, 3382, 2540, 297, 15057, 3740, 742, 13, 4706, 6139, 353, 525, 1293, 310, 10585, 2983, 304, 9563, 297, 10933, 14313, 742, 13, 4706, 2322, 353, 3861, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 20261, 3073, 29898, 13, 4706, 525, 12007, 29918, 7576, 742, 13, 4706, 3611, 353, 525, 20701, 3382, 2540, 297, 15057, 3740, 742, 13, 4706, 6139, 353, 525, 1293, 310, 10585, 2983, 304, 9025, 297, 10933, 14313, 742, 13, 4706, 2322, 353, 3861, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 20261, 3073, 29898, 13, 4706, 525, 20472, 29918, 9794, 742, 13, 4706, 3611, 353, 525, 29950, 680, 3382, 1379, 297, 8125, 15057, 3740, 742, 13, 4706, 6139, 353, 525, 1293, 310, 4733, 304, 9563, 297, 1904, 10933, 14313, 742, 13, 4706, 2322, 353, 3861, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 15778, 29898, 13, 4706, 525, 5269, 29918, 3166, 29918, 978, 742, 13, 4706, 2322, 353, 525, 17033, 27443, 5477, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 15778, 29898, 13, 4706, 525, 5269, 29918, 3166, 29918, 7328, 742, 13, 4706, 2854, 1061, 353, 19592, 801, 29889, 689, 29889, 9823, 3285, 13, 4706, 3734, 353, 7700, 29892, 13, 4706, 2322, 353, 525, 6406, 29992, 7640, 5477, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 29620, 3073, 29898, 13, 4706, 525, 29886, 9970, 29918, 12847, 742, 13, 4706, 3611, 353, 525, 10048, 8455, 742, 13, 4706, 6139, 353, 525, 27635, 4800, 767, 18150, 11297, 13, 9651, 525, 703, 24595, 613, 376, 15269, 29874, 613, 376, 12328, 4641, 1159, 742, 13, 4706, 7931, 370, 352, 653, 353, 19592, 801, 29889, 689, 29889, 29963, 542, 370, 352, 653, 29898, 13, 9651, 376, 24595, 613, 376, 15269, 29874, 613, 511, 13, 4706, 2322, 353, 525, 24595, 5477, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 7798, 3073, 29898, 13, 4706, 525, 29886, 9970, 29918, 1195, 29918, 2848, 742, 13, 4706, 3611, 353, 525, 6513, 742, 13, 4706, 6139, 353, 525, 10048, 6260, 1974, 3309, 29889, 742, 13, 4706, 2322, 353, 29871, 29945, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 24693, 3073, 29898, 13, 4706, 525, 29886, 9970, 29918, 1026, 2153, 29918, 7501, 1169, 742, 13, 4706, 3611, 353, 525, 12024, 2153, 322, 13340, 742, 13, 4706, 6139, 353, 525, 11403, 8721, 322, 13340, 297, 4800, 29889, 742, 13, 4706, 2322, 353, 7700, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 24693, 3073, 29898, 13, 4706, 525, 29886, 9970, 29918, 1026, 2153, 29918, 29885, 11925, 29918, 4878, 742, 13, 4706, 3611, 353, 525, 12024, 2153, 12849, 1206, 742, 13, 4706, 6139, 353, 525, 11403, 8721, 297, 12849, 1206, 29889, 742, 13, 4706, 2322, 353, 7700, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 20261, 3073, 29898, 13, 4706, 525, 2585, 29918, 11014, 29918, 24051, 742, 13, 4706, 3611, 353, 525, 15797, 666, 1591, 11265, 742, 13, 4706, 6139, 353, 525, 6132, 451, 1653, 9904, 6131, 2645, 848, 4665, 29889, 742, 13, 4706, 2322, 353, 3861, 511, 13, 13, 1678, 19592, 801, 29889, 689, 29889, 20261, 3073, 29898, 13, 4706, 525, 4381, 29918, 307, 793, 742, 13, 4706, 3611, 353, 525, 4592, 16178, 742, 13, 4706, 6139, 353, 525, 1293, 310, 2322, 9859, 16178, 363, 599, 3420, 1338, 29889, 742, 13, 4706, 2322, 353, 3861, 511, 13, 13, 1678, 3611, 353, 903, 877, 29925, 29873, 801, 6055, 5477, 13, 29897, 13, 13, 13, 1753, 731, 29918, 2549, 261, 29898, 16859, 29892, 611, 3955, 29922, 8516, 1125, 13, 1678, 822, 3158, 29898, 16859, 29892, 611, 3955, 1125, 13, 4706, 565, 451, 611, 3955, 29901, 13, 9651, 611, 3955, 353, 274, 16434, 29889, 1727, 6020, 29889, 1972, 7270, 537, 29898, 7833, 737, 261, 467, 11851, 29918, 29881, 27657, 13, 4706, 349, 6040, 29950, 353, 19592, 801, 29889, 657, 29918, 11027, 29898, 415, 801, 29889, 9207, 29954, 29918, 1367, 29918, 29925, 6040, 29950, 29892, 274, 16434, 29889, 1727, 6020, 29897, 13, 4706, 349, 6040, 29950, 1839, 2549, 261, 2033, 353, 611, 3955, 13, 13, 1678, 274, 16434, 29889, 2467, 877, 415, 801, 29889, 415, 801, 29918, 2549, 261, 742, 3158, 29892, 313, 16859, 29892, 611, 3955, 876, 13, 13, 13, 1990, 360, 11770, 14925, 261, 29898, 3318, 1125, 13, 13, 1678, 822, 3638, 29898, 1311, 29892, 515, 3383, 304, 3383, 2643, 1125, 13, 4706, 1480, 29889, 27392, 703, 14925, 261, 338, 451, 13252, 23157, 13, 4706, 1480, 29889, 27392, 29898, 4906, 29897, 13, 13, 13, 29992, 415, 801, 29889, 1491, 7588, 495, 29898, 415, 801, 29889, 13604, 29889, 9585, 15514, 5281, 29897, 13, 1753, 16601, 29898, 5750, 1125, 13, 1678, 349, 6040, 29950, 353, 19592, 801, 29889, 657, 29918, 11027, 29898, 415, 801, 29889, 9207, 29954, 29918, 1367, 29918, 29925, 6040, 29950, 29892, 3415, 29889, 1727, 6020, 29897, 13, 13, 1678, 396, 10524, 13, 1678, 565, 349, 6040, 29950, 29889, 657, 877, 2549, 261, 1495, 338, 6213, 29901, 13, 4706, 349, 6040, 29950, 1839, 2549, 261, 2033, 353, 360, 11770, 14925, 261, 580, 13, 4706, 349, 6040, 29950, 1839, 8159, 29918, 5269, 29918, 7328, 2033, 353, 3402, 10030, 29898, 13, 9651, 313, 29925, 6040, 29950, 1839, 5269, 29918, 3166, 29918, 978, 7464, 349, 6040, 29950, 1839, 5269, 29918, 3166, 29918, 7328, 25901, 13, 13, 13, 1753, 9025, 29918, 1171, 482, 29898, 16859, 29892, 1024, 2433, 415, 801, 29899, 1171, 482, 742, 2130, 29918, 12847, 29922, 8516, 29892, 13, 462, 29871, 767, 18150, 29922, 8516, 29892, 8455, 29918, 12154, 29922, 8516, 29892, 13, 462, 29871, 11262, 29918, 7576, 29922, 8516, 29892, 9025, 29918, 7576, 29922, 8516, 1125, 13, 1678, 9995, 1888, 14607, 363, 11451, 2572, 333, 421, 415, 801, 29918, 2344, 29918, 1171, 482, 29952, 17041, 9995, 13, 1678, 822, 3158, 29898, 16859, 29892, 1024, 29892, 2130, 29918, 12847, 29892, 13, 1669, 767, 18150, 29892, 8455, 29918, 12154, 29892, 11262, 29918, 7576, 1125, 13, 4706, 349, 6040, 29950, 353, 274, 16434, 29889, 415, 801, 29918, 657, 29918, 11027, 29898, 415, 801, 29889, 9207, 29954, 29918, 1367, 29918, 29925, 6040, 29950, 29897, 13, 13, 4706, 349, 6040, 29950, 1839, 1171, 482, 2033, 353, 1024, 13, 4706, 565, 767, 18150, 338, 451, 6213, 29901, 13, 9651, 349, 6040, 29950, 1839, 1171, 18150, 2033, 353, 767, 18150, 13, 4706, 565, 8455, 29918, 12154, 338, 451, 6213, 29901, 13, 9651, 349, 6040, 29950, 1839, 12847, 29918, 12154, 2033, 353, 8455, 29918, 12154, 13, 4706, 565, 11262, 29918, 7576, 338, 451, 6213, 29901, 13, 9651, 349, 6040, 29950, 1839, 20472, 29918, 7576, 2033, 353, 11262, 29918, 7576, 13, 4706, 565, 9025, 29918, 7576, 338, 451, 6213, 29901, 13, 9651, 349, 6040, 29950, 1839, 12007, 29918, 7576, 2033, 353, 9025, 29918, 7576, 13, 13, 4706, 565, 2130, 29918, 12847, 338, 6213, 29901, 13, 9651, 2130, 29918, 12847, 353, 19592, 801, 29889, 1171, 482, 29889, 29925, 29873, 801, 6638, 3260, 29898, 16859, 29889, 1727, 6020, 29897, 13, 13, 4706, 19592, 801, 29889, 1171, 482, 29889, 842, 29918, 5943, 29918, 12847, 29898, 5943, 29918, 12847, 29892, 274, 16434, 29889, 1727, 6020, 29897, 13, 13, 1678, 274, 16434, 29889, 1202, 29918, 13134, 877, 415, 801, 29899, 1171, 482, 742, 8207, 29912, 29900, 29913, 5515, 3018, 3901, 4286, 4830, 29898, 978, 511, 13, 462, 29871, 12529, 29922, 415, 801, 29889, 1171, 482, 29889, 29925, 29873, 801, 2517, 482, 12085, 29892, 671, 29918, 10945, 29918, 7406, 29922, 5574, 29897, 13, 1678, 274, 16434, 29889, 2467, 29898, 13, 4706, 525, 415, 801, 29889, 415, 801, 29918, 1171, 482, 742, 3158, 29892, 13, 4706, 313, 16859, 29892, 1024, 29892, 2130, 29918, 12847, 29892, 13, 308, 767, 18150, 29892, 8455, 29918, 12154, 29892, 11262, 29918, 7576, 511, 1797, 29922, 29929, 29929, 29929, 29929, 29929, 29929, 29974, 29896, 29897, 13, 13, 13, 1753, 11905, 29918, 2850, 29898, 16859, 29892, 10944, 2433, 2850, 284, 305, 6764, 6169, 1125, 13, 1678, 822, 3158, 29898, 16859, 1125, 13, 4706, 349, 6040, 29950, 353, 274, 16434, 29889, 415, 801, 29918, 657, 29918, 11027, 29898, 415, 801, 29889, 9207, 29954, 29918, 1367, 29918, 29925, 6040, 29950, 29897, 13, 4706, 349, 6040, 29950, 1839, 2850, 284, 305, 6764, 29918, 11228, 1891, 2033, 353, 5852, 13, 13, 1678, 274, 16434, 29889, 2856, 877, 2272, 2572, 333, 29918, 2850, 284, 305, 6764, 1495, 13, 1678, 274, 16434, 29889, 2467, 877, 415, 801, 29889, 2344, 284, 675, 29918, 2850, 742, 3158, 29892, 313, 16859, 29892, 876, 13, 13, 1678, 396, 1423, 29918, 3259, 13, 1678, 515, 19592, 801, 1053, 9725, 403, 13, 1678, 274, 16434, 29889, 1202, 29918, 1491, 7588, 495, 29898, 26983, 403, 29889, 3198, 29918, 3259, 29892, 8427, 20399, 29897, 13, 13, 13, 29992, 415, 801, 29889, 1491, 7588, 495, 29898, 4873, 20399, 29897, 13, 1753, 6257, 29898, 5750, 1125, 13, 1678, 6055, 29889, 1359, 29918, 2585, 11027, 580, 13, 2 ]
backend/models/events.py
nonamedb/kazan_backend
0
172762
# coding: utf-8 from datetime import datetime, timedelta from sqlalchemy import Column, Integer, String, Sequence, Boolean, ForeignKey, DateTime, Text, Date from sqlalchemy.dialects.postgresql import JSON from sqlalchemy.orm import relationship, backref from .organizers import organizer_event_table from .volunteers import volunteer_event_table from .base import BaseModel class Event(BaseModel): __tablename__ = 'event' id = Column(Integer, Sequence('event_id_seq'), primary_key=True) name = Column(String(250), nullable=False) description = Column(Text(), nullable=True) community_id = Column(Integer(), nullable=False) volunteer_count = Column(Integer(), nullable=False) reward = Column(Integer(), nullable=True) img = Column(String(250), nullable=True) event_date = Column(Date(), default=(datetime.today() + timedelta(days=5)), nullable=False) event_subject_id = Column(Integer(), ForeignKey('event_subject.id')) event_subject = relationship('EventSubject', lazy='joined') organizers = relationship( "Organizer", secondary=organizer_event_table, back_populates="organizer_events") volunteers = relationship( "Volunteer", secondary=volunteer_event_table, back_populates="volunteer_events") def marshall(self): return dict( id=self.id, name=self.name, description=self.description, community_id=self.community_id, volunteer_count=self.volunteer_count, reward=self.reward, img=self.img, event_date=self.event_date, organizers=[org.id for org in self.organizers], volunteers=[vol.id for vol in self.volunteers], ) class EventSubject(BaseModel): __tablename__ = 'event_subject' id = Column(Integer, Sequence('event_subject_id_seq'), primary_key=True) name = Column(String(250), nullable=False) abbr = Column(String(250), nullable=False) def marshall(self): return dict( id=self.id, name=self.name, abbr=self.abbr ) __all__ = [Event, EventSubject]
[ 1, 396, 14137, 29901, 23616, 29899, 29947, 13, 13, 13, 3166, 12865, 1053, 12865, 29892, 5335, 287, 2554, 13, 3166, 4576, 284, 305, 6764, 1053, 12481, 29892, 8102, 29892, 1714, 29892, 922, 3910, 29892, 11185, 29892, 19358, 2558, 29892, 12315, 29892, 3992, 29892, 4712, 13, 3166, 4576, 284, 305, 6764, 29889, 15321, 781, 29879, 29889, 29272, 1053, 4663, 13, 3166, 4576, 284, 305, 6764, 29889, 555, 1053, 9443, 29892, 1250, 999, 13, 3166, 869, 6388, 19427, 1053, 2894, 3950, 29918, 3696, 29918, 2371, 13, 3166, 869, 1555, 17316, 414, 1053, 27886, 261, 29918, 3696, 29918, 2371, 13, 3166, 869, 3188, 1053, 7399, 3195, 13, 13, 13, 1990, 6864, 29898, 5160, 3195, 1125, 13, 1678, 4770, 3891, 2435, 420, 1649, 353, 525, 3696, 29915, 13, 13, 1678, 1178, 353, 12481, 29898, 7798, 29892, 922, 3910, 877, 3696, 29918, 333, 29918, 11762, 5477, 7601, 29918, 1989, 29922, 5574, 29897, 13, 1678, 1024, 353, 12481, 29898, 1231, 29898, 29906, 29945, 29900, 511, 1870, 519, 29922, 8824, 29897, 13, 1678, 6139, 353, 12481, 29898, 1626, 3285, 1870, 519, 29922, 5574, 29897, 13, 1678, 7881, 29918, 333, 353, 12481, 29898, 7798, 3285, 1870, 519, 29922, 8824, 29897, 13, 1678, 27886, 261, 29918, 2798, 353, 12481, 29898, 7798, 3285, 1870, 519, 29922, 8824, 29897, 13, 1678, 20751, 353, 12481, 29898, 7798, 3285, 1870, 519, 29922, 5574, 29897, 13, 1678, 10153, 353, 12481, 29898, 1231, 29898, 29906, 29945, 29900, 511, 1870, 519, 29922, 5574, 29897, 13, 1678, 1741, 29918, 1256, 353, 12481, 29898, 2539, 3285, 2322, 7607, 12673, 29889, 27765, 580, 718, 5335, 287, 2554, 29898, 16700, 29922, 29945, 8243, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 1741, 29918, 16009, 29918, 333, 353, 12481, 29898, 7798, 3285, 19358, 2558, 877, 3696, 29918, 16009, 29889, 333, 8785, 13, 1678, 1741, 29918, 16009, 353, 9443, 877, 2624, 20622, 742, 17366, 2433, 2212, 1312, 1495, 13, 13, 1678, 8674, 414, 353, 9443, 29898, 13, 4706, 376, 27356, 3950, 613, 13, 4706, 16723, 29922, 6388, 3950, 29918, 3696, 29918, 2371, 29892, 13, 4706, 1250, 29918, 7323, 352, 1078, 543, 6388, 3950, 29918, 13604, 1159, 13, 13, 1678, 27886, 414, 353, 9443, 29898, 13, 4706, 376, 13072, 17316, 261, 613, 13, 4706, 16723, 29922, 1555, 17316, 261, 29918, 3696, 29918, 2371, 29892, 13, 4706, 1250, 29918, 7323, 352, 1078, 543, 1555, 17316, 261, 29918, 13604, 1159, 13, 13, 1678, 822, 1766, 845, 497, 29898, 1311, 1125, 13, 4706, 736, 9657, 29898, 13, 9651, 1178, 29922, 1311, 29889, 333, 29892, 13, 9651, 1024, 29922, 1311, 29889, 978, 29892, 13, 9651, 6139, 29922, 1311, 29889, 8216, 29892, 13, 9651, 7881, 29918, 333, 29922, 1311, 29889, 23834, 29918, 333, 29892, 13, 9651, 27886, 261, 29918, 2798, 29922, 1311, 29889, 1555, 17316, 261, 29918, 2798, 29892, 13, 9651, 20751, 29922, 1311, 29889, 276, 1328, 29892, 13, 9651, 10153, 29922, 1311, 29889, 2492, 29892, 13, 9651, 1741, 29918, 1256, 29922, 1311, 29889, 3696, 29918, 1256, 29892, 13, 9651, 8674, 414, 11759, 990, 29889, 333, 363, 1638, 297, 1583, 29889, 6388, 19427, 1402, 13, 9651, 27886, 414, 11759, 1555, 29889, 333, 363, 1700, 297, 1583, 29889, 1555, 17316, 414, 1402, 13, 4706, 1723, 13, 13, 13, 1990, 6864, 20622, 29898, 5160, 3195, 1125, 13, 1678, 4770, 3891, 2435, 420, 1649, 353, 525, 3696, 29918, 16009, 29915, 13, 13, 1678, 1178, 353, 12481, 29898, 7798, 29892, 922, 3910, 877, 3696, 29918, 16009, 29918, 333, 29918, 11762, 5477, 7601, 29918, 1989, 29922, 5574, 29897, 13, 1678, 1024, 353, 12481, 29898, 1231, 29898, 29906, 29945, 29900, 511, 1870, 519, 29922, 8824, 29897, 13, 1678, 633, 1182, 353, 12481, 29898, 1231, 29898, 29906, 29945, 29900, 511, 1870, 519, 29922, 8824, 29897, 13, 13, 1678, 822, 1766, 845, 497, 29898, 1311, 1125, 13, 4706, 736, 9657, 29898, 13, 9651, 1178, 29922, 1311, 29889, 333, 29892, 13, 9651, 1024, 29922, 1311, 29889, 978, 29892, 13, 9651, 633, 1182, 29922, 1311, 29889, 370, 1182, 13, 4706, 1723, 13, 13, 13, 1649, 497, 1649, 353, 518, 2624, 29892, 6864, 20622, 29962, 13, 2 ]
ecs/processors/playerattackprocessor.py
joehowells/7drl2020
0
173751
from random import randint from esper import Processor, World import script from action import ActionType from ecs.components.attacktarget import AttackTarget from ecs.components.map import Map from ecs.components.message import Message from ecs.components.monster import Monster from ecs.components.player import Player from ecs.components.position import Position class PlayerAttackProcessor(Processor): def process(self): self.world: World for _, game_map in self.world.get_component(Map): for _, (position, player) in self.world.get_components(Position, Player): if player.action.action_type is ActionType.ATTACK: for entity, (monster, _) in self.world.get_components(Monster, AttackTarget): self.world.remove_component(entity, AttackTarget) if randint(0, monster.defend) < player.attack: self.world.create_entity(Message( text=script.PLAYER_HIT.format(name=monster.name), priority=50, )) monster.health -= 1 if monster.health <= 0: player.kills[monster.name] += 1 self.world.delete_entity(entity, immediate=True) self.world.create_entity(Message( text=script.PLAYER_KILL.format(name=monster.name), priority=50, )) else: self.world.create_entity(Message( text=script.PLAYER_MISS.format(name=monster.name), priority=50, ))
[ 1, 515, 4036, 1053, 20088, 524, 13, 13, 3166, 17451, 1053, 10554, 272, 29892, 2787, 13, 13, 5215, 2471, 13, 3166, 3158, 1053, 9123, 1542, 13, 3166, 321, 2395, 29889, 14036, 29889, 1131, 547, 5182, 1053, 6212, 547, 8667, 13, 3166, 321, 2395, 29889, 14036, 29889, 1958, 1053, 7315, 13, 3166, 321, 2395, 29889, 14036, 29889, 4906, 1053, 7777, 13, 3166, 321, 2395, 29889, 14036, 29889, 3712, 2475, 1053, 2598, 2475, 13, 3166, 321, 2395, 29889, 14036, 29889, 9106, 1053, 14574, 13, 3166, 321, 2395, 29889, 14036, 29889, 3283, 1053, 20627, 13, 13, 13, 1990, 14574, 4165, 547, 18689, 29898, 18689, 1125, 13, 1678, 822, 1889, 29898, 1311, 1125, 13, 4706, 1583, 29889, 11526, 29901, 2787, 13, 13, 4706, 363, 17117, 3748, 29918, 1958, 297, 1583, 29889, 11526, 29889, 657, 29918, 9700, 29898, 3388, 1125, 13, 9651, 363, 17117, 313, 3283, 29892, 4847, 29897, 297, 1583, 29889, 11526, 29889, 657, 29918, 14036, 29898, 8003, 29892, 14574, 1125, 13, 18884, 565, 4847, 29889, 2467, 29889, 2467, 29918, 1853, 338, 9123, 1542, 29889, 1299, 8687, 29968, 29901, 13, 462, 1678, 363, 7855, 29892, 313, 3712, 2475, 29892, 24459, 297, 1583, 29889, 11526, 29889, 657, 29918, 14036, 29898, 7185, 2475, 29892, 6212, 547, 8667, 1125, 13, 462, 4706, 1583, 29889, 11526, 29889, 5992, 29918, 9700, 29898, 10041, 29892, 6212, 547, 8667, 29897, 13, 13, 462, 4706, 565, 20088, 524, 29898, 29900, 29892, 1601, 2475, 29889, 1753, 355, 29897, 529, 4847, 29889, 1131, 547, 29901, 13, 462, 9651, 1583, 29889, 11526, 29889, 3258, 29918, 10041, 29898, 3728, 29898, 13, 462, 18884, 1426, 29922, 2154, 29889, 29925, 18799, 1001, 29918, 29950, 1806, 29889, 4830, 29898, 978, 29922, 3712, 2475, 29889, 978, 511, 13, 462, 18884, 20136, 29922, 29945, 29900, 29892, 13, 462, 632, 876, 13, 13, 462, 9651, 1601, 2475, 29889, 354, 4298, 22361, 29871, 29896, 13, 13, 462, 9651, 565, 1601, 2475, 29889, 354, 4298, 5277, 29871, 29900, 29901, 13, 462, 18884, 4847, 29889, 29895, 6090, 29961, 3712, 2475, 29889, 978, 29962, 4619, 29871, 29896, 13, 462, 18884, 1583, 29889, 11526, 29889, 8143, 29918, 10041, 29898, 10041, 29892, 16800, 29922, 5574, 29897, 13, 462, 18884, 1583, 29889, 11526, 29889, 3258, 29918, 10041, 29898, 3728, 29898, 13, 462, 462, 1678, 1426, 29922, 2154, 29889, 29925, 18799, 1001, 29918, 29968, 24071, 29889, 4830, 29898, 978, 29922, 3712, 2475, 29889, 978, 511, 13, 462, 462, 1678, 20136, 29922, 29945, 29900, 29892, 13, 462, 462, 876, 13, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 1583, 29889, 11526, 29889, 3258, 29918, 10041, 29898, 3728, 29898, 13, 462, 18884, 1426, 29922, 2154, 29889, 29925, 18799, 1001, 29918, 10403, 1799, 29889, 4830, 29898, 978, 29922, 3712, 2475, 29889, 978, 511, 13, 462, 18884, 20136, 29922, 29945, 29900, 29892, 13, 462, 632, 876, 13, 2 ]
functions/tools.py
tmsmolnar/cth-uva
2
152436
import pandas as pd from bokeh.models import ColumnDataSource, HoverTool, LinearInterpolator, CategoricalColorMapper, Paragraph from bokeh.plotting import figure from bokeh.palettes import Category20b_20 from bokeh.layouts import column, row from bokeh.io import show, curdoc def load_data(path_to_file, index, sheet): """ Load the dataset, select which column should be the index, and which sheet of the dataset should be loaded. Parameters: path_to_file: string The path to the file the user wants to load The datasets can be found under the datasets folder index: integer The column the user wants to consider as index sheet: string or integer The name or number of the sheet the user wants to load 0 - Elementary school 1 - Special school 2 - Technical school 3 - Vocational school 4 - High school Returns: a DataFrame """ dataFrame = pd.read_excel(path_to_file, index_col=index, sheet_name=sheet) if 'Adatok' in dataFrame.columns: for value in dataFrame['Adatok']: if value == 'Összeg / Csongrád-Csanád megye': value_new = 'Összeg / Csongrád megye' dataFrame = dataFrame.replace({value: value_new}) else: pass #dataFrame = dataFrame.fillna(0).astype(int) return dataFrame def merge_dataFrames_index(dataFrame_1, dataFrame_2): """ Merge two DataFrames based on their indexes Parameters: dataFrame_1, dataFrame_2: string The name of the DataFrames the user wants to merge Returns: a DataFrame """ dataFrames = [dataFrame_1, dataFrame_2] merged_dataFrames = pd.concat(dataFrames) return merged_dataFrames def merge_dataFrames_column(dataFrame_1, dataFrame_2): """ Merge two DataFrames based on their columns Parameters: dataFrame_1, dataFrame_2: string The name of the DataFrames the user wants to merge Returns: a DataFrame """ dataFrames = [dataFrame_1, dataFrame_2] merged_dataFrames = pd.concat(dataFrames, axis=1) return merged_dataFrames def clean_index(dataFrame): """ Clean the index columns from unnecessary words, punctuations Parameters: dataFrame: string The name of the DataFrame in which the user wants to clean the index Returns: a DataFrame """ for index in dataFrame.index: splitted_index = index.split(".") new_index = splitted_index[0] dataFrame = dataFrame.rename(index={index:new_index}) return dataFrame def clean_index_year(dataFrame): """ Clean those indexes, where the index contains the years and removes the word 'year' Parameters: dataFrame: string The name of the dataFrame in which the user wants to clean the index Returns: a DataFrame """ for index in dataFrame.index: splitted_index = index.split(" ") new_index = splitted_index[2] dataFrame = dataFrame.rename(index={index:new_index}) return dataFrame def clean_regions(dataFrame): """ Clean those columns that contains the regions, to contain only the name of the region. Parameters: dataFrame: string The name of the DataFrame in which the users wants to clean the region columns Returns: a DataFrame """ for value in dataFrame['Region']: splitted_value = value.split(" ") new_value = splitted_value[2] dataFrame = dataFrame.replace({value: new_value}) return dataFrame def clean_column(dataFrame): """ Clean the columns from unnecessary words and punctuations. Parameters: dataFrame: string The name of the DataFrame in which the user wants to clean the columms Returns: a DataFrame """ for column in dataFrame: splitted_column = column.split(" ") new_column = splitted_column[0] dataFrame = dataFrame.rename(columns={column: new_column}) return dataFrame def clean_age(dataFrame): """ Clean those columns that contains the ages of the students, and change the word 'éves' to 'yrs'. Parameters: dataFrame: string The name of the DataFrame in which the user wants to clean the columns containing the ages Returns: a DataFrame """ for value in dataFrame['Age']: splitted_value = value.split(" ") new_value = splitted_value[0] + " yrs" dataFrame = dataFrame.replace({value: new_value}) return dataFrame def two_to_one_regions(data_1, data_2, sheet_index): """ This function is the main function to be used on the transformation of data that contains the regions! Loads the data, merges the DataFrames, cleans the columns, indexes, rename columns to make it readable and understandable. Parameters: data_1, data_2: strings The paths of the files the user wants to load and work with sheet_index: integer The number of the sheet the user wants to work with 0 - Elementary school 1 - Special school 2 - Technical school 3 - Vocational school 4 - High school Returns: a DataFrame """ df1 = load_data(data_1, index = 1, sheet = sheet_index) df2 = load_data(data_2, index = 1, sheet = sheet_index) result = merge_dataFrames_index(df1, df2) result = result.rename(columns={'Adatok': 'Region', 'Összeg': 'Number of students'}) result.index.name = None result = result.rename_axis("Year", axis='columns') result = clean_index(result) result = clean_regions(result) return result def two_to_one_years(data_1, data_2, sheet_index): """ This function is the main function to be used on the transformation of data that contains the ages of students! Loads the data, merges the DataFrames, cleans the columns, indexes, rename columns to make it readable and understandable. Parameters: data_1, data_2: strings The paths of the files the user wants to load and work with sheet_index: integer Has to be zero, as there is only one sheet for these datasets Returns: a DataFrame """ df1 = load_data(data_1, index=0, sheet = sheet_index) df2 = load_data(data_2, index=0, sheet = sheet_index) result = merge_dataFrames_index(df1, df2) result = result.rename(columns={'Életkor (köznevelés)': 'Age', 'Összeg': 'Number of students'}) result['Number of students'] = result['Number of students'].fillna(0).astype(int) result.index.name = None result = result.rename_axis("Year", axis='columns') result = clean_index_year(result) result = clean_index(result) result = clean_age(result) return result def two_to_one_regions_gradszakma(data_1, data_2): """ This function is for only one case, where the graduated datasets differ, because of the KSH! Loads the data, merges the DataFrames, cleans the columns, indexes, rename columns to make it readable and understandable. Parameters: data_1, data_2: strings The paths of the files the user wants to load and work with Returns: a DataFrame """ df1 = load_data(data_1, index=1, sheet=1) df2 = load_data(data_1, index=1, sheet=2) df3 = load_data(data_2, index=1, sheet=1) df2 = df1 + df2 result = merge_dataFrames_index(df2, df3) result = result.rename( columns={'Adatok': 'Region', 'Összeg': 'Number of students'}) result.index.name = None result = result.rename_axis("Year", axis='columns') result = clean_index(result) result = clean_regions(result) if 'Region' in result.columns: for value in result['Region']: if value == 'BudapestÖsszeg': value_new = 'Budapest' result = result.replace({value: value_new}) return result def cds_from_regions(df): """ Create the ColumnDataSource for the Bokeh visualization, from datasets containing the regions. Parameters: df: string The DataFrame from which the user wants to create the ColumnDataSource Returns: ColumnDataSource """ source = ColumnDataSource(data={ 'x': df.index, 'y': df['Number of students'], 'Region': df['Region'] }) return source def plot_by_regions(df): """ Create the ColumnDataSource, the figure, the tools, other visualistic elements for the visualizations and plot the data. This function is to be used on DataFrames that contains the regions! Parameters: df: string The name of the DataFrame that the user wants to visualize Returns: A Bokeh visualization """ regions = df['Region'].unique() regions = list(regions) source = cds_from_regions(df) dot_size = LinearInterpolator( x=[df['Number of students'].min(), df['Number of students'].max()], y=[5, 25] ) dot_color = CategoricalColorMapper(factors=regions, palette=Category20b_20) hover = HoverTool(tooltips=[ ("Region", "@Region"), ("Number of students", "@y"), ("Year", "@x"), ]) tools = "pan, tap, box_select, lasso_select, wheel_zoom, help" p = figure(plot_height=800, plot_width=800, tools=[hover, tools]) p.yaxis.formatter.use_scientific = False p.circle(x='x', y='y', source=source, #legend='Region', size={'field': 'y', 'transform': dot_size}, color=dict(field='Region', transform=dot_color)) return p def cds_from_age(df): """ Create the ColumnDataSource for the Bokeh visualization, from datasets containing the ages of students. Parameters: df: string The DataFrame from which the user wants to create the ColumnDataSource Returns: ColumnDataSource """ source = ColumnDataSource(data={ 'x': df.index, 'y': df['Number of students'], 'Age': df['Age'] }) return source def plot_by_age(df): """ Create the ColumnDataSource, the figure, the tools, other visualistic elements for the visualizations and plot the data. This function is to be used on DataFrames that contains the ages of students! Parameters: df: string The name of the DataFrame that the user wants to visualize Returns: A Bokeh visualization """ ages = df['Age'].unique() ages = list(ages) source = cds_from_age(df) dot_size = LinearInterpolator( x=[df['Number of students'].min(), df['Number of students'].max()], y=[5, 25] ) dot_color = CategoricalColorMapper(factors=ages, palette=Category20b_20) hover = HoverTool(tooltips=[ ('Age of students', '@Age'), ('Number of students', '@y'), ('Year', '@x') ]) tools = "pan, tap, box_select, lasso_select, wheel_zoom, help" p = figure(plot_height=800, plot_width=800, tools=[hover, tools], x_range=(2013,2020), y_range=(0,100000)) p.yaxis.formatter.use_scientific = False p.circle(x='x', y='y', source=source, size={'field': 'y', 'transform': dot_size}, color=dict(field='Age', transform=dot_color)) return p
[ 1, 1053, 11701, 408, 10518, 30004, 13, 3166, 1045, 446, 29882, 29889, 9794, 1053, 12481, 15559, 29892, 379, 957, 12229, 29892, 22985, 4074, 3733, 1061, 29892, 315, 20440, 936, 3306, 19968, 29892, 1459, 9895, 30004, 13, 3166, 1045, 446, 29882, 29889, 5317, 1259, 1053, 4377, 30004, 13, 3166, 1045, 446, 29882, 29889, 29886, 744, 698, 267, 1053, 17943, 29906, 29900, 29890, 29918, 29906, 29900, 30004, 13, 3166, 1045, 446, 29882, 29889, 2680, 29879, 1053, 1897, 29892, 1948, 30004, 13, 3166, 1045, 446, 29882, 29889, 601, 1053, 1510, 29892, 3151, 1514, 30004, 13, 30004, 13, 30004, 13, 1753, 2254, 29918, 1272, 29898, 2084, 29918, 517, 29918, 1445, 29892, 2380, 29892, 9869, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 16012, 278, 8783, 29892, 1831, 607, 1897, 881, 367, 278, 2380, 29892, 322, 607, 9869, 310, 278, 8783, 881, 367, 7500, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 1678, 6756, 13, 4706, 2224, 29918, 517, 29918, 1445, 29901, 1347, 30004, 13, 18884, 450, 2224, 304, 278, 934, 278, 1404, 10753, 304, 2254, 30004, 13, 18884, 450, 20035, 508, 367, 1476, 1090, 278, 20035, 4138, 30004, 13, 30004, 13, 4706, 2380, 29901, 6043, 30004, 13, 18884, 450, 1897, 278, 1404, 10753, 304, 2050, 408, 2380, 30004, 13, 30004, 13, 4706, 9869, 29901, 1347, 470, 6043, 30004, 13, 18884, 450, 1024, 470, 1353, 310, 278, 9869, 278, 1404, 10753, 304, 2254, 30004, 13, 462, 29900, 448, 10619, 653, 3762, 30004, 13, 462, 29896, 448, 12630, 3762, 30004, 13, 462, 29906, 448, 8364, 936, 3762, 30004, 13, 462, 29941, 448, 478, 542, 1288, 3762, 30004, 13, 462, 29946, 448, 5057, 3762, 30004, 13, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 848, 4308, 353, 10518, 29889, 949, 29918, 24633, 29898, 2084, 29918, 517, 29918, 1445, 29892, 2380, 29918, 1054, 29922, 2248, 29892, 9869, 29918, 978, 29922, 9855, 8443, 13, 1678, 6756, 13, 1678, 565, 525, 3253, 271, 554, 29915, 297, 848, 4308, 29889, 13099, 29901, 30004, 13, 4706, 363, 995, 297, 848, 4308, 1839, 3253, 271, 554, 2033, 29901, 30004, 13, 9651, 565, 995, 1275, 525, 30094, 893, 28530, 847, 315, 21453, 6135, 29881, 29899, 29907, 28455, 7461, 4508, 4099, 2396, 30004, 13, 18884, 995, 29918, 1482, 353, 525, 30094, 893, 28530, 847, 315, 21453, 6135, 29881, 4508, 4099, 29915, 30004, 13, 18884, 848, 4308, 353, 848, 4308, 29889, 6506, 3319, 1767, 29901, 995, 29918, 1482, 1800, 30004, 13, 1678, 1683, 29901, 30004, 13, 4706, 1209, 30004, 13, 30004, 13, 1678, 396, 1272, 4308, 353, 848, 4308, 29889, 5589, 1056, 29898, 29900, 467, 579, 668, 29898, 524, 8443, 13, 30004, 13, 1678, 736, 848, 4308, 30004, 13, 30004, 13, 1753, 10366, 29918, 1272, 14438, 1280, 29918, 2248, 29898, 1272, 4308, 29918, 29896, 29892, 848, 4308, 29918, 29906, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 4702, 479, 1023, 3630, 14438, 1280, 2729, 373, 1009, 18111, 30004, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 4308, 29918, 29896, 29892, 848, 4308, 29918, 29906, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 14438, 1280, 278, 1404, 10753, 304, 10366, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 848, 14438, 1280, 353, 518, 1272, 4308, 29918, 29896, 29892, 848, 4308, 29918, 29906, 29962, 30004, 13, 1678, 19412, 29918, 1272, 14438, 1280, 353, 10518, 29889, 17685, 29898, 1272, 14438, 1280, 8443, 13, 30004, 13, 1678, 736, 19412, 29918, 1272, 14438, 1280, 30004, 13, 30004, 13, 1753, 10366, 29918, 1272, 14438, 1280, 29918, 4914, 29898, 1272, 4308, 29918, 29896, 29892, 848, 4308, 29918, 29906, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 4702, 479, 1023, 3630, 14438, 1280, 2729, 373, 1009, 4341, 30004, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 4308, 29918, 29896, 29892, 848, 4308, 29918, 29906, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 14438, 1280, 278, 1404, 10753, 304, 10366, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 848, 14438, 1280, 353, 518, 1272, 4308, 29918, 29896, 29892, 848, 4308, 29918, 29906, 29962, 30004, 13, 1678, 19412, 29918, 1272, 14438, 1280, 353, 10518, 29889, 17685, 29898, 1272, 14438, 1280, 29892, 9685, 29922, 29896, 8443, 13, 30004, 13, 1678, 736, 19412, 29918, 1272, 14438, 1280, 30004, 13, 30004, 13, 1753, 5941, 29918, 2248, 29898, 1272, 4308, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 315, 14044, 278, 2380, 4341, 515, 19039, 3838, 29892, 6035, 22999, 800, 30004, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 4308, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 4308, 297, 607, 278, 1404, 10753, 304, 5941, 278, 2380, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 363, 2380, 297, 848, 4308, 29889, 2248, 29901, 30004, 13, 4706, 8536, 4430, 29918, 2248, 353, 2380, 29889, 5451, 17350, 1159, 30004, 13, 4706, 716, 29918, 2248, 353, 8536, 4430, 29918, 2248, 29961, 29900, 29962, 30004, 13, 4706, 848, 4308, 353, 848, 4308, 29889, 1267, 420, 29898, 2248, 3790, 2248, 29901, 1482, 29918, 2248, 1800, 30004, 13, 30004, 13, 1678, 736, 848, 4308, 30004, 13, 30004, 13, 1753, 5941, 29918, 2248, 29918, 6360, 29898, 1272, 4308, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 315, 14044, 1906, 18111, 29892, 988, 278, 2380, 3743, 278, 2440, 322, 25388, 278, 1734, 525, 6360, 29915, 30004, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 4308, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 848, 4308, 297, 607, 278, 1404, 10753, 304, 5941, 278, 2380, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 363, 2380, 297, 848, 4308, 29889, 2248, 29901, 30004, 13, 4706, 8536, 4430, 29918, 2248, 353, 2380, 29889, 5451, 703, 376, 8443, 13, 4706, 716, 29918, 2248, 353, 8536, 4430, 29918, 2248, 29961, 29906, 29962, 30004, 13, 4706, 848, 4308, 353, 848, 4308, 29889, 1267, 420, 29898, 2248, 3790, 2248, 29901, 1482, 29918, 2248, 1800, 30004, 13, 30004, 13, 1678, 736, 848, 4308, 30004, 13, 30004, 13, 1753, 5941, 29918, 1727, 1080, 29898, 1272, 4308, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 315, 14044, 1906, 4341, 393, 3743, 278, 12786, 29892, 304, 1712, 871, 278, 1024, 310, 278, 5120, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 4308, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 4308, 297, 607, 278, 4160, 10753, 304, 5941, 278, 5120, 4341, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 363, 995, 297, 848, 4308, 1839, 18457, 2033, 29901, 30004, 13, 4706, 8536, 4430, 29918, 1767, 353, 995, 29889, 5451, 703, 376, 8443, 13, 4706, 716, 29918, 1767, 353, 8536, 4430, 29918, 1767, 29961, 29906, 29962, 30004, 13, 4706, 848, 4308, 353, 848, 4308, 29889, 6506, 3319, 1767, 29901, 716, 29918, 1767, 1800, 30004, 13, 30004, 13, 1678, 736, 848, 4308, 30004, 13, 30004, 13, 1753, 5941, 29918, 4914, 29898, 1272, 4308, 1125, 30004, 13, 1678, 6756, 13, 1678, 9995, 30004, 13, 1678, 315, 14044, 278, 4341, 515, 19039, 3838, 322, 6035, 22999, 800, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 4308, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 4308, 297, 607, 278, 1404, 10753, 304, 5941, 278, 784, 398, 1516, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 363, 1897, 297, 848, 4308, 29901, 30004, 13, 4706, 8536, 4430, 29918, 4914, 353, 1897, 29889, 5451, 703, 376, 8443, 13, 4706, 716, 29918, 4914, 353, 8536, 4430, 29918, 4914, 29961, 29900, 29962, 30004, 13, 4706, 848, 4308, 353, 848, 4308, 29889, 1267, 420, 29898, 13099, 3790, 4914, 29901, 716, 29918, 4914, 1800, 30004, 13, 30004, 13, 1678, 736, 848, 4308, 30004, 13, 30004, 13, 1753, 5941, 29918, 482, 29898, 1272, 4308, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 315, 14044, 1906, 4341, 393, 3743, 278, 24646, 310, 278, 8041, 29892, 322, 1735, 278, 1734, 525, 29948, 1960, 29915, 304, 525, 29891, 2288, 4286, 30004, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 4308, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 4308, 297, 607, 278, 1404, 10753, 304, 5941, 278, 4341, 6943, 278, 24646, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 363, 995, 297, 848, 4308, 1839, 22406, 2033, 29901, 30004, 13, 4706, 8536, 4430, 29918, 1767, 353, 995, 29889, 5451, 703, 376, 8443, 13, 4706, 716, 29918, 1767, 353, 8536, 4430, 29918, 1767, 29961, 29900, 29962, 718, 376, 343, 2288, 19451, 13, 4706, 848, 4308, 353, 848, 4308, 29889, 6506, 3319, 1767, 29901, 716, 29918, 1767, 1800, 30004, 13, 30004, 13, 1678, 736, 848, 4308, 30004, 13, 30004, 13, 1753, 1023, 29918, 517, 29918, 650, 29918, 1727, 1080, 29898, 1272, 29918, 29896, 29892, 848, 29918, 29906, 29892, 9869, 29918, 2248, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 910, 740, 338, 278, 1667, 740, 304, 367, 1304, 373, 278, 13852, 310, 848, 393, 3743, 278, 12786, 29991, 4309, 7925, 278, 848, 29892, 2778, 2710, 278, 3630, 14438, 1280, 11167, 13, 1678, 4531, 550, 278, 4341, 29892, 18111, 29892, 19508, 4341, 304, 1207, 372, 19909, 322, 2274, 519, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 29918, 29896, 29892, 848, 29918, 29906, 29901, 6031, 30004, 13, 9651, 450, 10898, 310, 278, 2066, 278, 1404, 10753, 304, 2254, 322, 664, 411, 30004, 13, 4706, 6756, 13, 4706, 9869, 29918, 2248, 29901, 6043, 30004, 13, 9651, 450, 1353, 310, 278, 9869, 278, 1404, 10753, 304, 664, 411, 30004, 13, 632, 29900, 448, 10619, 653, 3762, 30004, 13, 632, 29896, 448, 12630, 3762, 30004, 13, 632, 29906, 448, 8364, 936, 3762, 30004, 13, 632, 29941, 448, 478, 542, 1288, 3762, 30004, 13, 632, 29946, 448, 5057, 3762, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 30004, 13, 1678, 4489, 29896, 353, 2254, 29918, 1272, 29898, 1272, 29918, 29896, 29892, 2380, 353, 29871, 29896, 29892, 9869, 353, 9869, 29918, 2248, 8443, 13, 1678, 4489, 29906, 353, 2254, 29918, 1272, 29898, 1272, 29918, 29906, 29892, 2380, 353, 29871, 29896, 29892, 9869, 353, 9869, 29918, 2248, 8443, 13, 30004, 13, 1678, 1121, 353, 10366, 29918, 1272, 14438, 1280, 29918, 2248, 29898, 2176, 29896, 29892, 4489, 29906, 8443, 13, 1678, 1121, 353, 1121, 29889, 1267, 420, 29898, 13099, 3790, 29915, 3253, 271, 554, 2396, 525, 18457, 742, 525, 30094, 893, 28530, 2396, 525, 4557, 310, 8041, 29915, 1800, 30004, 13, 1678, 1121, 29889, 2248, 29889, 978, 353, 6213, 30004, 13, 1678, 1121, 353, 1121, 29889, 1267, 420, 29918, 8990, 703, 12883, 613, 9685, 2433, 13099, 1495, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 1678, 1121, 353, 5941, 29918, 2248, 29898, 2914, 8443, 13, 1678, 1121, 353, 5941, 29918, 1727, 1080, 29898, 2914, 8443, 13, 30004, 13, 1678, 736, 1121, 30004, 13, 30004, 13, 1753, 1023, 29918, 517, 29918, 650, 29918, 6360, 29879, 29898, 1272, 29918, 29896, 29892, 848, 29918, 29906, 29892, 9869, 29918, 2248, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 910, 740, 338, 278, 1667, 740, 304, 367, 1304, 373, 278, 13852, 310, 848, 393, 3743, 278, 24646, 310, 8041, 29991, 4309, 7925, 278, 848, 29892, 2778, 2710, 278, 3630, 14438, 1280, 11167, 13, 1678, 4531, 550, 278, 4341, 29892, 18111, 29892, 19508, 4341, 304, 1207, 372, 19909, 322, 2274, 519, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 29918, 29896, 29892, 848, 29918, 29906, 29901, 6031, 30004, 13, 9651, 450, 10898, 310, 278, 2066, 278, 1404, 10753, 304, 2254, 322, 664, 411, 30004, 13, 4706, 6756, 13, 4706, 9869, 29918, 2248, 29901, 6043, 30004, 13, 9651, 11699, 304, 367, 5225, 29892, 408, 727, 338, 871, 697, 9869, 363, 1438, 20035, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 4489, 29896, 353, 2254, 29918, 1272, 29898, 1272, 29918, 29896, 29892, 2380, 29922, 29900, 29892, 9869, 353, 9869, 29918, 2248, 8443, 13, 1678, 4489, 29906, 353, 2254, 29918, 1272, 29898, 1272, 29918, 29906, 29892, 2380, 29922, 29900, 29892, 9869, 353, 9869, 29918, 2248, 8443, 13, 30004, 13, 1678, 1121, 353, 10366, 29918, 1272, 14438, 1280, 29918, 2248, 29898, 2176, 29896, 29892, 4489, 29906, 8443, 13, 1678, 1121, 353, 1121, 29889, 1267, 420, 29898, 13099, 3790, 29915, 30062, 1026, 13123, 313, 12910, 29920, 484, 955, 743, 29897, 2396, 525, 22406, 742, 525, 30094, 893, 28530, 2396, 525, 4557, 310, 8041, 29915, 1800, 30004, 13, 1678, 1121, 1839, 4557, 310, 8041, 2033, 353, 1121, 1839, 4557, 310, 8041, 13359, 5589, 1056, 29898, 29900, 467, 579, 668, 29898, 524, 29897, 1678, 6756, 13, 1678, 1121, 29889, 2248, 29889, 978, 353, 6213, 30004, 13, 1678, 1121, 353, 1121, 29889, 1267, 420, 29918, 8990, 703, 12883, 613, 9685, 2433, 13099, 1495, 30004, 13, 30004, 13, 1678, 6756, 13, 1678, 1121, 353, 5941, 29918, 2248, 29918, 6360, 29898, 2914, 8443, 13, 1678, 1121, 353, 5941, 29918, 2248, 29898, 2914, 8443, 13, 1678, 1121, 353, 5941, 29918, 482, 29898, 2914, 8443, 13, 30004, 13, 1678, 736, 1121, 30004, 13, 30004, 13, 1753, 1023, 29918, 517, 29918, 650, 29918, 1727, 1080, 29918, 5105, 3616, 557, 655, 29898, 1272, 29918, 29896, 29892, 848, 29918, 29906, 1125, 30004, 13, 1678, 9995, 30004, 13, 1678, 910, 740, 338, 363, 871, 697, 1206, 29892, 988, 278, 23588, 20035, 1163, 29892, 1363, 310, 278, 476, 7068, 29991, 4309, 7925, 278, 848, 29892, 2778, 2710, 278, 3630, 14438, 1280, 11167, 13, 1678, 4531, 550, 278, 4341, 29892, 18111, 29892, 19508, 4341, 304, 1207, 372, 19909, 322, 2274, 519, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 848, 29918, 29896, 29892, 848, 29918, 29906, 29901, 6031, 30004, 13, 9651, 450, 10898, 310, 278, 2066, 278, 1404, 10753, 304, 2254, 322, 664, 411, 30004, 13, 4706, 6756, 13, 1678, 16969, 29901, 30004, 13, 4706, 263, 3630, 4308, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 4489, 29896, 353, 2254, 29918, 1272, 29898, 1272, 29918, 29896, 29892, 2380, 29922, 29896, 29892, 9869, 29922, 29896, 8443, 13, 1678, 4489, 29906, 353, 2254, 29918, 1272, 29898, 1272, 29918, 29896, 29892, 2380, 29922, 29896, 29892, 9869, 29922, 29906, 8443, 13, 1678, 4489, 29941, 353, 2254, 29918, 1272, 29898, 1272, 29918, 29906, 29892, 2380, 29922, 29896, 29892, 9869, 29922, 29896, 8443, 13, 30004, 13, 1678, 4489, 29906, 29871, 353, 4489, 29896, 718, 4489, 29906, 30004, 13, 30004, 13, 1678, 1121, 353, 10366, 29918, 1272, 14438, 1280, 29918, 2248, 29898, 2176, 29906, 29892, 4489, 29941, 8443, 13, 1678, 1121, 353, 1121, 29889, 1267, 420, 29898, 30004, 13, 4706, 4341, 3790, 29915, 3253, 271, 554, 2396, 525, 18457, 742, 525, 30094, 893, 28530, 2396, 525, 4557, 310, 8041, 29915, 1800, 30004, 13, 1678, 1121, 29889, 2248, 29889, 978, 353, 6213, 30004, 13, 1678, 1121, 353, 1121, 29889, 1267, 420, 29918, 8990, 703, 12883, 613, 9685, 2433, 13099, 1495, 30004, 13, 30004, 13, 1678, 1121, 353, 5941, 29918, 2248, 29898, 2914, 8443, 13, 1678, 1121, 353, 5941, 29918, 1727, 1080, 29898, 2914, 8443, 13, 30004, 13, 1678, 565, 525, 18457, 29915, 297, 1121, 29889, 13099, 29901, 30004, 13, 4706, 363, 995, 297, 1121, 1839, 18457, 2033, 29901, 30004, 13, 9651, 565, 995, 1275, 525, 29933, 566, 13198, 30094, 893, 28530, 2396, 30004, 13, 18884, 995, 29918, 1482, 353, 525, 29933, 566, 13198, 29915, 30004, 13, 18884, 1121, 353, 1121, 29889, 6506, 3319, 1767, 29901, 995, 29918, 1482, 1800, 30004, 13, 30004, 13, 1678, 736, 1121, 30004, 13, 30004, 13, 1753, 274, 6289, 29918, 3166, 29918, 1727, 1080, 29898, 2176, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 6204, 278, 12481, 15559, 363, 278, 1952, 446, 29882, 7604, 2133, 29892, 515, 20035, 6943, 278, 12786, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 4489, 29901, 1347, 30004, 13, 9651, 450, 3630, 4308, 515, 607, 278, 1404, 10753, 304, 1653, 278, 12481, 15559, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 12481, 15559, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 2752, 353, 12481, 15559, 29898, 1272, 3790, 30004, 13, 4706, 525, 29916, 2396, 4489, 29889, 2248, 11167, 13, 4706, 525, 29891, 2396, 4489, 1839, 4557, 310, 8041, 7464, 30004, 13, 4706, 525, 18457, 2396, 4489, 1839, 18457, 2033, 30004, 13, 1678, 5615, 30004, 13, 30004, 13, 1678, 736, 2752, 30004, 13, 30004, 13, 1753, 6492, 29918, 1609, 29918, 1727, 1080, 29898, 2176, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 6204, 278, 12481, 15559, 29892, 278, 4377, 29892, 278, 8492, 29892, 916, 7604, 4695, 3161, 363, 278, 7604, 17063, 322, 6492, 278, 848, 22993, 13, 1678, 910, 740, 338, 304, 367, 1304, 373, 3630, 14438, 1280, 393, 3743, 278, 12786, 29991, 30004, 13, 30004, 13, 1678, 12662, 2699, 29901, 6756, 13, 4706, 4489, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 4308, 393, 278, 1404, 10753, 304, 7604, 675, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 319, 1952, 446, 29882, 7604, 2133, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 12786, 353, 4489, 1839, 18457, 13359, 13092, 26471, 13, 1678, 12786, 353, 1051, 29898, 1727, 1080, 8443, 13, 30004, 13, 1678, 2752, 353, 274, 6289, 29918, 3166, 29918, 1727, 1080, 29898, 2176, 8443, 13, 30004, 13, 1678, 8329, 29918, 2311, 353, 22985, 4074, 3733, 1061, 29898, 30004, 13, 4706, 921, 11759, 2176, 1839, 4557, 310, 8041, 13359, 1195, 3285, 4489, 1839, 4557, 310, 8041, 13359, 3317, 580, 1402, 30004, 13, 4706, 343, 11759, 29945, 29892, 29871, 29906, 29945, 29962, 30004, 13, 1678, 1723, 30004, 13, 30004, 13, 30004, 13, 1678, 8329, 29918, 2780, 353, 315, 20440, 936, 3306, 19968, 29898, 17028, 943, 29922, 1727, 1080, 29892, 282, 26456, 29922, 10900, 29906, 29900, 29890, 29918, 29906, 29900, 8443, 13, 30004, 13, 1678, 16758, 353, 379, 957, 12229, 29898, 10154, 2034, 567, 11759, 30004, 13, 4706, 4852, 18457, 613, 17962, 18457, 4968, 30004, 13, 4706, 4852, 4557, 310, 8041, 613, 17962, 29891, 4968, 30004, 13, 4706, 4852, 12883, 613, 17962, 29916, 4968, 30004, 13, 268, 2314, 30004, 13, 30004, 13, 1678, 8492, 353, 376, 8357, 29892, 18751, 29892, 3800, 29918, 2622, 29892, 301, 9979, 29918, 2622, 29892, 18875, 29918, 2502, 290, 29892, 1371, 19451, 13, 30004, 13, 30004, 13, 1678, 282, 353, 4377, 29898, 5317, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 6492, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 8492, 11759, 13194, 29892, 8492, 2314, 30004, 13, 1678, 282, 29889, 29891, 8990, 29889, 689, 2620, 29889, 1509, 29918, 29879, 15566, 928, 353, 7700, 30004, 13, 1678, 6756, 13, 1678, 282, 29889, 16622, 29898, 29916, 2433, 29916, 742, 343, 2433, 29891, 742, 2752, 29922, 4993, 29892, 396, 26172, 2433, 18457, 23592, 13, 9651, 2159, 3790, 29915, 2671, 2396, 525, 29891, 742, 525, 9067, 2396, 8329, 29918, 2311, 1118, 30004, 13, 9651, 2927, 29922, 8977, 29898, 2671, 2433, 18457, 742, 4327, 29922, 6333, 29918, 2780, 876, 30004, 13, 1678, 6756, 13, 30004, 13, 1678, 736, 282, 30004, 13, 1678, 6756, 13, 1753, 274, 6289, 29918, 3166, 29918, 482, 29898, 2176, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 6204, 278, 12481, 15559, 363, 278, 1952, 446, 29882, 7604, 2133, 29892, 515, 20035, 6943, 278, 24646, 310, 8041, 22993, 13, 30004, 13, 1678, 12662, 2699, 29901, 30004, 13, 4706, 4489, 29901, 1347, 30004, 13, 9651, 450, 3630, 4308, 515, 607, 278, 1404, 10753, 304, 1653, 278, 12481, 15559, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 12481, 15559, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 2752, 353, 12481, 15559, 29898, 1272, 3790, 30004, 13, 4706, 525, 29916, 2396, 4489, 29889, 2248, 11167, 13, 4706, 525, 29891, 2396, 4489, 1839, 4557, 310, 8041, 7464, 30004, 13, 4706, 525, 22406, 2396, 4489, 1839, 22406, 2033, 30004, 13, 1678, 5615, 30004, 13, 30004, 13, 1678, 736, 2752, 30004, 13, 30004, 13, 1753, 6492, 29918, 1609, 29918, 482, 29898, 2176, 1125, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 1678, 6204, 278, 12481, 15559, 29892, 278, 4377, 29892, 278, 8492, 29892, 916, 7604, 4695, 3161, 363, 278, 7604, 17063, 322, 6492, 278, 848, 22993, 13, 1678, 910, 740, 338, 304, 367, 1304, 373, 3630, 14438, 1280, 393, 3743, 278, 24646, 310, 8041, 29991, 30004, 13, 30004, 13, 1678, 12662, 2699, 29901, 6756, 13, 4706, 4489, 29901, 1347, 30004, 13, 9651, 450, 1024, 310, 278, 3630, 4308, 393, 278, 1404, 10753, 304, 7604, 675, 30004, 13, 30004, 13, 1678, 16969, 29901, 30004, 13, 4706, 319, 1952, 446, 29882, 7604, 2133, 30004, 13, 30004, 13, 1678, 9995, 30004, 13, 30004, 13, 1678, 24646, 353, 4489, 1839, 22406, 13359, 13092, 26471, 13, 1678, 24646, 353, 1051, 29898, 1179, 8443, 13, 30004, 13, 1678, 2752, 353, 274, 6289, 29918, 3166, 29918, 482, 29898, 2176, 8443, 13, 30004, 13, 1678, 8329, 29918, 2311, 353, 22985, 4074, 3733, 1061, 29898, 30004, 13, 4706, 921, 11759, 2176, 1839, 4557, 310, 8041, 13359, 1195, 3285, 4489, 1839, 4557, 310, 8041, 13359, 3317, 580, 1402, 30004, 13, 4706, 343, 11759, 29945, 29892, 29871, 29906, 29945, 29962, 30004, 13, 1678, 1723, 30004, 13, 30004, 13, 1678, 8329, 29918, 2780, 353, 315, 20440, 936, 3306, 19968, 29898, 17028, 943, 29922, 1179, 29892, 282, 26456, 29922, 10900, 29906, 29900, 29890, 29918, 29906, 29900, 8443, 13, 30004, 13, 1678, 16758, 353, 379, 957, 12229, 29898, 10154, 2034, 567, 11759, 30004, 13, 4706, 6702, 22406, 310, 8041, 742, 18803, 22406, 5477, 30004, 13, 4706, 6702, 4557, 310, 8041, 742, 18803, 29891, 5477, 30004, 13, 4706, 6702, 12883, 742, 18803, 29916, 1495, 30004, 13, 268, 2314, 30004, 13, 30004, 13, 1678, 8492, 353, 376, 8357, 29892, 18751, 29892, 3800, 29918, 2622, 29892, 301, 9979, 29918, 2622, 29892, 18875, 29918, 2502, 290, 29892, 1371, 19451, 13, 30004, 13, 1678, 282, 353, 4377, 29898, 5317, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 6492, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 8492, 11759, 13194, 29892, 8492, 1402, 921, 29918, 3881, 7607, 29906, 29900, 29896, 29941, 29892, 29906, 29900, 29906, 29900, 511, 343, 29918, 3881, 7607, 29900, 29892, 29896, 29900, 29900, 29900, 29900, 29900, 876, 30004, 13, 1678, 282, 29889, 29891, 8990, 29889, 689, 2620, 29889, 1509, 29918, 29879, 15566, 928, 353, 7700, 30004, 13, 1678, 282, 29889, 16622, 29898, 29916, 2433, 29916, 742, 343, 2433, 29891, 742, 2752, 29922, 4993, 11167, 13, 9651, 2159, 3790, 29915, 2671, 2396, 525, 29891, 742, 525, 9067, 2396, 8329, 29918, 2311, 1118, 30004, 13, 9651, 2927, 29922, 8977, 29898, 2671, 2433, 22406, 742, 4327, 29922, 6333, 29918, 2780, 876, 30004, 13, 30004, 13, 1678, 736, 282, 30004, 13, 30004, 13, 2 ]
website/views.py
nulldiego/cadavre-exquis
0
1603104
from django.shortcuts import render from website.models import Cadavre from django.views import generic from website.forms import SendCadavrePartForm from django.views.decorators.http import require_http_methods from django.shortcuts import get_object_or_404 from django.http import HttpResponseRedirect from django.urls import reverse # Create your views here. def index(request): """View function for home page of site.""" # Render the HTML template index.html with the data in the context variable return render(request, 'index.html') class PlayCadavreView(generic.DetailView): model = Cadavre slug_field = 'code' slug_url_kwarg = 'code' def get_context_data(self, **kwargs): context = super(PlayCadavreView, self).get_context_data(**kwargs) context['form'] = SendCadavrePartForm return context @require_http_methods(["POST"]) def send_cadavre(request, code): cadavre = get_object_or_404(Cadavre, code=code) form = SendCadavrePartForm(request.POST) if form.is_valid(): cadavre.cadavrepart_set.create(content=form.cleaned_data['content'], author=form.cleaned_data['author']) return render(request, 'success.html') else: return HttpResponseRedirect(reverse('cadavre_detail', code=cadavre.code))
[ 1, 515, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 4700, 29889, 9794, 1053, 21542, 485, 276, 13, 3166, 9557, 29889, 7406, 1053, 10035, 13, 3166, 4700, 29889, 9514, 1053, 15076, 29907, 328, 485, 276, 7439, 2500, 13, 3166, 9557, 29889, 7406, 29889, 19557, 4097, 29889, 1124, 1053, 1996, 29918, 1124, 29918, 23515, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 24735, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 13, 1753, 2380, 29898, 3827, 1125, 13, 1678, 9995, 1043, 740, 363, 3271, 1813, 310, 3268, 1213, 15945, 13, 1678, 396, 26000, 278, 4544, 4472, 2380, 29889, 1420, 411, 278, 848, 297, 278, 3030, 2286, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 2248, 29889, 1420, 1495, 13, 13, 1990, 7412, 29907, 328, 485, 276, 1043, 29898, 19206, 29889, 16570, 1043, 1125, 13, 1678, 1904, 353, 21542, 485, 276, 13, 1678, 2243, 688, 29918, 2671, 353, 525, 401, 29915, 13, 1678, 2243, 688, 29918, 2271, 29918, 11022, 1191, 353, 525, 401, 29915, 13, 13, 1678, 822, 679, 29918, 4703, 29918, 1272, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 3030, 353, 2428, 29898, 13454, 29907, 328, 485, 276, 1043, 29892, 1583, 467, 657, 29918, 4703, 29918, 1272, 29898, 1068, 19290, 29897, 13, 4706, 3030, 1839, 689, 2033, 353, 15076, 29907, 328, 485, 276, 7439, 2500, 13, 4706, 736, 3030, 13, 13, 29992, 12277, 29918, 1124, 29918, 23515, 29898, 3366, 5438, 20068, 13, 1753, 3638, 29918, 29883, 328, 485, 276, 29898, 3827, 29892, 775, 1125, 13, 1678, 13840, 485, 276, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 29907, 328, 485, 276, 29892, 775, 29922, 401, 29897, 13, 1678, 883, 353, 15076, 29907, 328, 485, 276, 7439, 2500, 29898, 3827, 29889, 5438, 29897, 13, 1678, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 4706, 13840, 485, 276, 29889, 29883, 328, 485, 276, 1595, 29918, 842, 29889, 3258, 29898, 3051, 29922, 689, 29889, 14941, 287, 29918, 1272, 1839, 3051, 7464, 4148, 29922, 689, 29889, 14941, 287, 29918, 1272, 1839, 8921, 11287, 13, 4706, 736, 4050, 29898, 3827, 29892, 525, 8698, 29889, 1420, 1495, 13, 1678, 1683, 29901, 13, 4706, 736, 9056, 5103, 24735, 29898, 24244, 877, 29883, 328, 485, 276, 29918, 16432, 742, 775, 29922, 29883, 328, 485, 276, 29889, 401, 876, 2 ]
utils/xmlrpc.py
NullReferenceError/rtorrent_orphan_cleanup
27
48588
import socket import xmlrpc.client """ referemce: https://stackoverflow.com/a/14397619 """ class ServerProxy: def __init__(self, url, timeout=10): self.__url = url self.__timeout = timeout self.__prevDefaultTimeout = None def __enter__(self): try: if self.__timeout: self.__prevDefaultTimeout = socket.getdefaulttimeout() socket.setdefaulttimeout(self.__timeout) proxy = xmlrpc.client.ServerProxy(self.__url, allow_none=True) except Exception as ex: raise Exception("Unable create XMLRPC-proxy for url '%s': %s" % (self.__url, ex)) return proxy def __exit__(self, type, value, traceback): if self.__prevDefaultTimeout is None: socket.setdefaulttimeout(self.__prevDefaultTimeout)
[ 1, 1053, 9909, 13, 5215, 4903, 29878, 6739, 29889, 4645, 13, 13, 15945, 29908, 2737, 331, 346, 29901, 2045, 597, 2417, 29889, 510, 29914, 29874, 29914, 29896, 29946, 29941, 29929, 29955, 29953, 29896, 29929, 9995, 13, 13, 13, 1990, 5656, 14048, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3142, 29892, 11815, 29922, 29896, 29900, 1125, 13, 4706, 1583, 17255, 2271, 353, 3142, 13, 4706, 1583, 17255, 15619, 353, 11815, 13, 4706, 1583, 17255, 16304, 4592, 10851, 353, 6213, 13, 13, 1678, 822, 4770, 5893, 12035, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 17255, 15619, 29901, 13, 18884, 1583, 17255, 16304, 4592, 10851, 353, 9909, 29889, 657, 4381, 15619, 580, 13, 18884, 9909, 29889, 842, 4381, 15619, 29898, 1311, 17255, 15619, 29897, 13, 9651, 10166, 353, 4903, 29878, 6739, 29889, 4645, 29889, 6004, 14048, 29898, 1311, 17255, 2271, 29892, 2758, 29918, 9290, 29922, 5574, 29897, 13, 4706, 5174, 8960, 408, 429, 29901, 13, 9651, 12020, 8960, 703, 2525, 519, 1653, 6560, 29934, 9026, 29899, 14701, 363, 3142, 14210, 29879, 2396, 1273, 29879, 29908, 1273, 313, 1311, 17255, 2271, 29892, 429, 876, 13, 4706, 736, 10166, 13, 13, 1678, 822, 4770, 13322, 12035, 1311, 29892, 1134, 29892, 995, 29892, 9637, 1627, 1125, 13, 4706, 565, 1583, 17255, 16304, 4592, 10851, 338, 6213, 29901, 13, 9651, 9909, 29889, 842, 4381, 15619, 29898, 1311, 17255, 16304, 4592, 10851, 29897, 13, 2 ]
Rover/install_isolated/lib/python2.7/dist-packages/cartographer_ros_msgs/msg/_TrajectoryOptions.py
Rose-Hulman-Rover-Team/Rover-2019-2020
1
158084
<reponame>Rose-Hulman-Rover-Team/Rover-2019-2020 # This Python file uses the following encoding: utf-8 """autogenerated by genpy from cartographer_ros_msgs/TrajectoryOptions.msg. Do not edit.""" import sys python3 = True if sys.hexversion > 0x03000000 else False import genpy import struct class TrajectoryOptions(genpy.Message): _md5sum = "7eda9b62c16c18fa1563587e73501e47" _type = "cartographer_ros_msgs/TrajectoryOptions" _has_header = False #flag to mark the presence of a Header object _full_text = """# Copyright 2016 The Cartographer Authors # # 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. string tracking_frame string published_frame string odom_frame bool provide_odom_frame bool use_odometry bool use_nav_sat bool use_landmarks bool publish_frame_projected_to_2d int32 num_laser_scans int32 num_multi_echo_laser_scans int32 num_subdivisions_per_laser_scan int32 num_point_clouds float64 rangefinder_sampling_ratio float64 odometry_sampling_ratio float64 fixed_frame_pose_sampling_ratio float64 imu_sampling_ratio float64 landmarks_sampling_ratio # This is a binary-encoded # 'cartographer.mapping.proto.TrajectoryBuilderOptions' proto. string trajectory_builder_options_proto """ __slots__ = ['tracking_frame','published_frame','odom_frame','provide_odom_frame','use_odometry','use_nav_sat','use_landmarks','publish_frame_projected_to_2d','num_laser_scans','num_multi_echo_laser_scans','num_subdivisions_per_laser_scan','num_point_clouds','rangefinder_sampling_ratio','odometry_sampling_ratio','fixed_frame_pose_sampling_ratio','imu_sampling_ratio','landmarks_sampling_ratio','trajectory_builder_options_proto'] _slot_types = ['string','string','string','bool','bool','bool','bool','bool','int32','int32','int32','int32','float64','float64','float64','float64','float64','string'] def __init__(self, *args, **kwds): """ Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix in-order arguments and keyword arguments. The available fields are: tracking_frame,published_frame,odom_frame,provide_odom_frame,use_odometry,use_nav_sat,use_landmarks,publish_frame_projected_to_2d,num_laser_scans,num_multi_echo_laser_scans,num_subdivisions_per_laser_scan,num_point_clouds,rangefinder_sampling_ratio,odometry_sampling_ratio,fixed_frame_pose_sampling_ratio,imu_sampling_ratio,landmarks_sampling_ratio,trajectory_builder_options_proto :param args: complete set of field values, in .msg order :param kwds: use keyword arguments corresponding to message field names to set specific fields. """ if args or kwds: super(TrajectoryOptions, self).__init__(*args, **kwds) #message fields cannot be None, assign default values for those that are if self.tracking_frame is None: self.tracking_frame = '' if self.published_frame is None: self.published_frame = '' if self.odom_frame is None: self.odom_frame = '' if self.provide_odom_frame is None: self.provide_odom_frame = False if self.use_odometry is None: self.use_odometry = False if self.use_nav_sat is None: self.use_nav_sat = False if self.use_landmarks is None: self.use_landmarks = False if self.publish_frame_projected_to_2d is None: self.publish_frame_projected_to_2d = False if self.num_laser_scans is None: self.num_laser_scans = 0 if self.num_multi_echo_laser_scans is None: self.num_multi_echo_laser_scans = 0 if self.num_subdivisions_per_laser_scan is None: self.num_subdivisions_per_laser_scan = 0 if self.num_point_clouds is None: self.num_point_clouds = 0 if self.rangefinder_sampling_ratio is None: self.rangefinder_sampling_ratio = 0. if self.odometry_sampling_ratio is None: self.odometry_sampling_ratio = 0. if self.fixed_frame_pose_sampling_ratio is None: self.fixed_frame_pose_sampling_ratio = 0. if self.imu_sampling_ratio is None: self.imu_sampling_ratio = 0. if self.landmarks_sampling_ratio is None: self.landmarks_sampling_ratio = 0. if self.trajectory_builder_options_proto is None: self.trajectory_builder_options_proto = '' else: self.tracking_frame = '' self.published_frame = '' self.odom_frame = '' self.provide_odom_frame = False self.use_odometry = False self.use_nav_sat = False self.use_landmarks = False self.publish_frame_projected_to_2d = False self.num_laser_scans = 0 self.num_multi_echo_laser_scans = 0 self.num_subdivisions_per_laser_scan = 0 self.num_point_clouds = 0 self.rangefinder_sampling_ratio = 0. self.odometry_sampling_ratio = 0. self.fixed_frame_pose_sampling_ratio = 0. self.imu_sampling_ratio = 0. self.landmarks_sampling_ratio = 0. self.trajectory_builder_options_proto = '' def _get_types(self): """ internal API method """ return self._slot_types def serialize(self, buff): """ serialize message into buffer :param buff: buffer, ``StringIO`` """ try: _x = self.tracking_frame length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self.published_frame length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self.odom_frame length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self buff.write(_get_struct_5B4i5d().pack(_x.provide_odom_frame, _x.use_odometry, _x.use_nav_sat, _x.use_landmarks, _x.publish_frame_projected_to_2d, _x.num_laser_scans, _x.num_multi_echo_laser_scans, _x.num_subdivisions_per_laser_scan, _x.num_point_clouds, _x.rangefinder_sampling_ratio, _x.odometry_sampling_ratio, _x.fixed_frame_pose_sampling_ratio, _x.imu_sampling_ratio, _x.landmarks_sampling_ratio)) _x = self.trajectory_builder_options_proto length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) def deserialize(self, str): """ unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str`` """ try: end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.tracking_frame = str[start:end].decode('utf-8') else: self.tracking_frame = str[start:end] start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.published_frame = str[start:end].decode('utf-8') else: self.published_frame = str[start:end] start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.odom_frame = str[start:end].decode('utf-8') else: self.odom_frame = str[start:end] _x = self start = end end += 61 (_x.provide_odom_frame, _x.use_odometry, _x.use_nav_sat, _x.use_landmarks, _x.publish_frame_projected_to_2d, _x.num_laser_scans, _x.num_multi_echo_laser_scans, _x.num_subdivisions_per_laser_scan, _x.num_point_clouds, _x.rangefinder_sampling_ratio, _x.odometry_sampling_ratio, _x.fixed_frame_pose_sampling_ratio, _x.imu_sampling_ratio, _x.landmarks_sampling_ratio,) = _get_struct_5B4i5d().unpack(str[start:end]) self.provide_odom_frame = bool(self.provide_odom_frame) self.use_odometry = bool(self.use_odometry) self.use_nav_sat = bool(self.use_nav_sat) self.use_landmarks = bool(self.use_landmarks) self.publish_frame_projected_to_2d = bool(self.publish_frame_projected_to_2d) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.trajectory_builder_options_proto = str[start:end].decode('utf-8') else: self.trajectory_builder_options_proto = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) #most likely buffer underfill def serialize_numpy(self, buff, numpy): """ serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module """ try: _x = self.tracking_frame length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self.published_frame length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self.odom_frame length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) _x = self buff.write(_get_struct_5B4i5d().pack(_x.provide_odom_frame, _x.use_odometry, _x.use_nav_sat, _x.use_landmarks, _x.publish_frame_projected_to_2d, _x.num_laser_scans, _x.num_multi_echo_laser_scans, _x.num_subdivisions_per_laser_scan, _x.num_point_clouds, _x.rangefinder_sampling_ratio, _x.odometry_sampling_ratio, _x.fixed_frame_pose_sampling_ratio, _x.imu_sampling_ratio, _x.landmarks_sampling_ratio)) _x = self.trajectory_builder_options_proto length = len(_x) if python3 or type(_x) == unicode: _x = _x.encode('utf-8') length = len(_x) buff.write(struct.pack('<I%ss'%length, length, _x)) except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(locals().get('_x', self))))) except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(locals().get('_x', self))))) def deserialize_numpy(self, str, numpy): """ unpack serialized message in str into this message instance using numpy for array types :param str: byte array of serialized message, ``str`` :param numpy: numpy python module """ try: end = 0 start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.tracking_frame = str[start:end].decode('utf-8') else: self.tracking_frame = str[start:end] start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.published_frame = str[start:end].decode('utf-8') else: self.published_frame = str[start:end] start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.odom_frame = str[start:end].decode('utf-8') else: self.odom_frame = str[start:end] _x = self start = end end += 61 (_x.provide_odom_frame, _x.use_odometry, _x.use_nav_sat, _x.use_landmarks, _x.publish_frame_projected_to_2d, _x.num_laser_scans, _x.num_multi_echo_laser_scans, _x.num_subdivisions_per_laser_scan, _x.num_point_clouds, _x.rangefinder_sampling_ratio, _x.odometry_sampling_ratio, _x.fixed_frame_pose_sampling_ratio, _x.imu_sampling_ratio, _x.landmarks_sampling_ratio,) = _get_struct_5B4i5d().unpack(str[start:end]) self.provide_odom_frame = bool(self.provide_odom_frame) self.use_odometry = bool(self.use_odometry) self.use_nav_sat = bool(self.use_nav_sat) self.use_landmarks = bool(self.use_landmarks) self.publish_frame_projected_to_2d = bool(self.publish_frame_projected_to_2d) start = end end += 4 (length,) = _struct_I.unpack(str[start:end]) start = end end += length if python3: self.trajectory_builder_options_proto = str[start:end].decode('utf-8') else: self.trajectory_builder_options_proto = str[start:end] return self except struct.error as e: raise genpy.DeserializationError(e) #most likely buffer underfill _struct_I = genpy.struct_I def _get_struct_I(): global _struct_I return _struct_I _struct_5B4i5d = None def _get_struct_5B4i5d(): global _struct_5B4i5d if _struct_5B4i5d is None: _struct_5B4i5d = struct.Struct("<5B4i5d") return _struct_5B4i5d
[ 1, 529, 276, 1112, 420, 29958, 29934, 852, 29899, 29950, 352, 1171, 29899, 29934, 957, 29899, 19409, 29914, 29934, 957, 29899, 29906, 29900, 29896, 29929, 29899, 29906, 29900, 29906, 29900, 13, 29937, 910, 5132, 934, 3913, 278, 1494, 8025, 29901, 23616, 29899, 29947, 13, 15945, 29908, 1300, 468, 759, 630, 491, 2531, 2272, 515, 7774, 1946, 261, 29918, 1883, 29918, 1516, 3174, 29914, 5323, 622, 706, 5856, 29889, 7645, 29889, 1938, 451, 3863, 1213, 15945, 13, 5215, 10876, 13, 4691, 29941, 353, 5852, 565, 10876, 29889, 20970, 3259, 1405, 29871, 29900, 29916, 29900, 29941, 29900, 29900, 29900, 29900, 29900, 29900, 1683, 7700, 13, 5215, 2531, 2272, 13, 5215, 2281, 13, 13, 13, 1990, 3201, 622, 706, 5856, 29898, 1885, 2272, 29889, 3728, 1125, 13, 29871, 903, 3487, 29945, 2083, 353, 376, 29955, 8710, 29929, 29890, 29953, 29906, 29883, 29896, 29953, 29883, 29896, 29947, 5444, 29896, 29945, 29953, 29941, 29945, 29947, 29955, 29872, 29955, 29941, 29945, 29900, 29896, 29872, 29946, 29955, 29908, 13, 29871, 903, 1853, 353, 376, 13823, 1946, 261, 29918, 1883, 29918, 1516, 3174, 29914, 5323, 622, 706, 5856, 29908, 13, 29871, 903, 5349, 29918, 6672, 353, 7700, 396, 15581, 304, 2791, 278, 10122, 310, 263, 19345, 1203, 13, 29871, 903, 8159, 29918, 726, 353, 9995, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29953, 450, 12370, 1946, 261, 13189, 943, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 418, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 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, 1807, 23110, 29918, 2557, 13, 1807, 6369, 29918, 2557, 13, 1807, 2413, 290, 29918, 2557, 13, 11227, 3867, 29918, 397, 290, 29918, 2557, 13, 11227, 671, 29918, 397, 7843, 13, 11227, 671, 29918, 6654, 29918, 29879, 271, 13, 11227, 671, 29918, 1049, 22848, 13, 11227, 9805, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 13, 524, 29941, 29906, 954, 29918, 3333, 261, 29918, 1557, 550, 13, 524, 29941, 29906, 954, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 13, 524, 29941, 29906, 954, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 13, 524, 29941, 29906, 954, 29918, 3149, 29918, 9274, 29879, 13, 7411, 29953, 29946, 3464, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 13, 7411, 29953, 29946, 2413, 7843, 29918, 13445, 10335, 29918, 3605, 601, 13, 7411, 29953, 29946, 4343, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 13, 7411, 29953, 29946, 527, 29884, 29918, 13445, 10335, 29918, 3605, 601, 13, 7411, 29953, 29946, 2982, 22848, 29918, 13445, 10335, 29918, 3605, 601, 13, 13, 29937, 910, 338, 263, 7581, 29899, 26716, 13, 29937, 525, 13823, 1946, 261, 29889, 20698, 29889, 17529, 29889, 5323, 622, 706, 5627, 5856, 29915, 17814, 29889, 13, 1807, 23324, 706, 29918, 16409, 29918, 6768, 29918, 17529, 13, 15945, 29908, 13, 29871, 4770, 2536, 1862, 1649, 353, 6024, 11294, 292, 29918, 2557, 3788, 5467, 3726, 29918, 2557, 3788, 397, 290, 29918, 2557, 3788, 16123, 680, 29918, 397, 290, 29918, 2557, 3788, 1509, 29918, 397, 7843, 3788, 1509, 29918, 6654, 29918, 29879, 271, 3788, 1509, 29918, 1049, 22848, 3788, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 3788, 1949, 29918, 3333, 261, 29918, 1557, 550, 3788, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 3788, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 3788, 1949, 29918, 3149, 29918, 9274, 29879, 3788, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 3788, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 3788, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 3788, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 3788, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 3788, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 2033, 13, 29871, 903, 2536, 327, 29918, 8768, 353, 6024, 1807, 3788, 1807, 3788, 1807, 3788, 11227, 3788, 11227, 3788, 11227, 3788, 11227, 3788, 11227, 3788, 524, 29941, 29906, 3788, 524, 29941, 29906, 3788, 524, 29941, 29906, 3788, 524, 29941, 29906, 3788, 7411, 29953, 29946, 3788, 7411, 29953, 29946, 3788, 7411, 29953, 29946, 3788, 7411, 29953, 29946, 3788, 7411, 29953, 29946, 3788, 1807, 2033, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 11022, 6289, 1125, 13, 1678, 9995, 13, 1678, 1281, 18769, 29889, 3139, 2643, 4235, 393, 526, 27063, 29914, 4548, 4019, 368, 13, 1678, 731, 304, 6213, 674, 367, 9859, 263, 2322, 995, 29889, 450, 6907, 13, 1678, 671, 338, 13553, 6273, 408, 445, 338, 901, 16424, 304, 5434, 2643, 13, 1678, 3620, 29889, 29871, 887, 2609, 6837, 297, 29899, 2098, 6273, 322, 13553, 6273, 29889, 13, 13, 1678, 450, 3625, 4235, 526, 29901, 13, 539, 23110, 29918, 2557, 29892, 5467, 3726, 29918, 2557, 29892, 397, 290, 29918, 2557, 29892, 16123, 680, 29918, 397, 290, 29918, 2557, 29892, 1509, 29918, 397, 7843, 29892, 1509, 29918, 6654, 29918, 29879, 271, 29892, 1509, 29918, 1049, 22848, 29892, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 29892, 1949, 29918, 3333, 261, 29918, 1557, 550, 29892, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 29892, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 29892, 1949, 29918, 3149, 29918, 9274, 29879, 29892, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 29892, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 29892, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 29892, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 29892, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 29892, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 13, 13, 1678, 584, 3207, 6389, 29901, 4866, 731, 310, 1746, 1819, 29892, 297, 869, 7645, 1797, 13, 1678, 584, 3207, 9049, 6289, 29901, 671, 13553, 6273, 6590, 304, 2643, 1746, 2983, 13, 1678, 304, 731, 2702, 4235, 29889, 13, 1678, 9995, 13, 1678, 565, 6389, 470, 9049, 6289, 29901, 13, 418, 2428, 29898, 5323, 622, 706, 5856, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 11022, 6289, 29897, 13, 418, 396, 4906, 4235, 2609, 367, 6213, 29892, 3566, 2322, 1819, 363, 1906, 393, 526, 13, 418, 565, 1583, 29889, 11294, 292, 29918, 2557, 338, 6213, 29901, 13, 4706, 1583, 29889, 11294, 292, 29918, 2557, 353, 6629, 13, 418, 565, 1583, 29889, 5467, 3726, 29918, 2557, 338, 6213, 29901, 13, 4706, 1583, 29889, 5467, 3726, 29918, 2557, 353, 6629, 13, 418, 565, 1583, 29889, 397, 290, 29918, 2557, 338, 6213, 29901, 13, 4706, 1583, 29889, 397, 290, 29918, 2557, 353, 6629, 13, 418, 565, 1583, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 338, 6213, 29901, 13, 4706, 1583, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 353, 7700, 13, 418, 565, 1583, 29889, 1509, 29918, 397, 7843, 338, 6213, 29901, 13, 4706, 1583, 29889, 1509, 29918, 397, 7843, 353, 7700, 13, 418, 565, 1583, 29889, 1509, 29918, 6654, 29918, 29879, 271, 338, 6213, 29901, 13, 4706, 1583, 29889, 1509, 29918, 6654, 29918, 29879, 271, 353, 7700, 13, 418, 565, 1583, 29889, 1509, 29918, 1049, 22848, 338, 6213, 29901, 13, 4706, 1583, 29889, 1509, 29918, 1049, 22848, 353, 7700, 13, 418, 565, 1583, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 338, 6213, 29901, 13, 4706, 1583, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 353, 7700, 13, 418, 565, 1583, 29889, 1949, 29918, 3333, 261, 29918, 1557, 550, 338, 6213, 29901, 13, 4706, 1583, 29889, 1949, 29918, 3333, 261, 29918, 1557, 550, 353, 29871, 29900, 13, 418, 565, 1583, 29889, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 338, 6213, 29901, 13, 4706, 1583, 29889, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 353, 29871, 29900, 13, 418, 565, 1583, 29889, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 338, 6213, 29901, 13, 4706, 1583, 29889, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 353, 29871, 29900, 13, 418, 565, 1583, 29889, 1949, 29918, 3149, 29918, 9274, 29879, 338, 6213, 29901, 13, 4706, 1583, 29889, 1949, 29918, 3149, 29918, 9274, 29879, 353, 29871, 29900, 13, 418, 565, 1583, 29889, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 338, 6213, 29901, 13, 4706, 1583, 29889, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 565, 1583, 29889, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 338, 6213, 29901, 13, 4706, 1583, 29889, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 565, 1583, 29889, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 338, 6213, 29901, 13, 4706, 1583, 29889, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 565, 1583, 29889, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 338, 6213, 29901, 13, 4706, 1583, 29889, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 565, 1583, 29889, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 338, 6213, 29901, 13, 4706, 1583, 29889, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 565, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 338, 6213, 29901, 13, 4706, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 353, 6629, 13, 1678, 1683, 29901, 13, 418, 1583, 29889, 11294, 292, 29918, 2557, 353, 6629, 13, 418, 1583, 29889, 5467, 3726, 29918, 2557, 353, 6629, 13, 418, 1583, 29889, 397, 290, 29918, 2557, 353, 6629, 13, 418, 1583, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 353, 7700, 13, 418, 1583, 29889, 1509, 29918, 397, 7843, 353, 7700, 13, 418, 1583, 29889, 1509, 29918, 6654, 29918, 29879, 271, 353, 7700, 13, 418, 1583, 29889, 1509, 29918, 1049, 22848, 353, 7700, 13, 418, 1583, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 353, 7700, 13, 418, 1583, 29889, 1949, 29918, 3333, 261, 29918, 1557, 550, 353, 29871, 29900, 13, 418, 1583, 29889, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 353, 29871, 29900, 13, 418, 1583, 29889, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 353, 29871, 29900, 13, 418, 1583, 29889, 1949, 29918, 3149, 29918, 9274, 29879, 353, 29871, 29900, 13, 418, 1583, 29889, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 1583, 29889, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 1583, 29889, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 1583, 29889, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 1583, 29889, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 353, 29871, 29900, 29889, 13, 418, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 353, 6629, 13, 13, 29871, 822, 903, 657, 29918, 8768, 29898, 1311, 1125, 13, 1678, 9995, 13, 1678, 7463, 3450, 1158, 13, 1678, 9995, 13, 1678, 736, 1583, 3032, 2536, 327, 29918, 8768, 13, 13, 29871, 822, 28755, 29898, 1311, 29892, 20487, 1125, 13, 1678, 9995, 13, 1678, 28755, 2643, 964, 6835, 13, 1678, 584, 3207, 20487, 29901, 6835, 29892, 4954, 1231, 5971, 16159, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 418, 903, 29916, 353, 1583, 29889, 11294, 292, 29918, 2557, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 418, 903, 29916, 353, 1583, 29889, 5467, 3726, 29918, 2557, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 418, 903, 29916, 353, 1583, 29889, 397, 290, 29918, 2557, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 418, 903, 29916, 353, 1583, 13, 418, 20487, 29889, 3539, 7373, 657, 29918, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 2141, 4058, 7373, 29916, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 29892, 903, 29916, 29889, 1509, 29918, 397, 7843, 29892, 903, 29916, 29889, 1509, 29918, 6654, 29918, 29879, 271, 29892, 903, 29916, 29889, 1509, 29918, 1049, 22848, 29892, 903, 29916, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 29892, 903, 29916, 29889, 1949, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 29892, 903, 29916, 29889, 1949, 29918, 3149, 29918, 9274, 29879, 29892, 903, 29916, 29889, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 876, 13, 418, 903, 29916, 353, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 1678, 5174, 2281, 29889, 2704, 408, 409, 29901, 1583, 3032, 3198, 29918, 8768, 29898, 4984, 29889, 2704, 11702, 29879, 29901, 14210, 29879, 29915, 746, 5007, 14210, 29879, 11838, 1273, 313, 1853, 29898, 344, 511, 851, 29898, 344, 511, 851, 29898, 2997, 29879, 2141, 657, 877, 29918, 29916, 742, 1583, 876, 4961, 13, 1678, 5174, 20948, 408, 734, 29901, 1583, 3032, 3198, 29918, 8768, 29898, 1917, 2392, 11702, 29879, 29901, 14210, 29879, 29915, 746, 5007, 14210, 29879, 11838, 1273, 313, 1853, 29898, 371, 511, 851, 29898, 371, 511, 851, 29898, 2997, 29879, 2141, 657, 877, 29918, 29916, 742, 1583, 876, 4961, 13, 13, 29871, 822, 16964, 6646, 29898, 1311, 29892, 851, 1125, 13, 1678, 9995, 13, 1678, 443, 4058, 7797, 1891, 2643, 297, 851, 964, 445, 2643, 2777, 13, 1678, 584, 3207, 851, 29901, 7023, 1409, 310, 7797, 1891, 2643, 29892, 4954, 710, 16159, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 418, 1095, 353, 29871, 29900, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 11294, 292, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 11294, 292, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 5467, 3726, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 5467, 3726, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 397, 290, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 397, 290, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 903, 29916, 353, 1583, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29953, 29896, 13, 418, 9423, 29916, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 29892, 903, 29916, 29889, 1509, 29918, 397, 7843, 29892, 903, 29916, 29889, 1509, 29918, 6654, 29918, 29879, 271, 29892, 903, 29916, 29889, 1509, 29918, 1049, 22848, 29892, 903, 29916, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 29892, 903, 29916, 29889, 1949, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 29892, 903, 29916, 29889, 1949, 29918, 3149, 29918, 9274, 29879, 29892, 903, 29916, 29889, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 29892, 29897, 353, 903, 657, 29918, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 2141, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1583, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 353, 6120, 29898, 1311, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 29897, 13, 418, 1583, 29889, 1509, 29918, 397, 7843, 353, 6120, 29898, 1311, 29889, 1509, 29918, 397, 7843, 29897, 13, 418, 1583, 29889, 1509, 29918, 6654, 29918, 29879, 271, 353, 6120, 29898, 1311, 29889, 1509, 29918, 6654, 29918, 29879, 271, 29897, 13, 418, 1583, 29889, 1509, 29918, 1049, 22848, 353, 6120, 29898, 1311, 29889, 1509, 29918, 1049, 22848, 29897, 13, 418, 1583, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 353, 6120, 29898, 1311, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 29897, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 736, 1583, 13, 1678, 5174, 2281, 29889, 2704, 408, 321, 29901, 13, 418, 12020, 2531, 2272, 29889, 4002, 261, 616, 2133, 2392, 29898, 29872, 29897, 396, 3242, 5517, 6835, 1090, 5589, 13, 13, 13, 29871, 822, 28755, 29918, 23749, 29898, 1311, 29892, 20487, 29892, 12655, 1125, 13, 1678, 9995, 13, 1678, 28755, 2643, 411, 12655, 1409, 4072, 964, 6835, 13, 1678, 584, 3207, 20487, 29901, 6835, 29892, 4954, 1231, 5971, 16159, 13, 1678, 584, 3207, 12655, 29901, 12655, 3017, 3883, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 418, 903, 29916, 353, 1583, 29889, 11294, 292, 29918, 2557, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 418, 903, 29916, 353, 1583, 29889, 5467, 3726, 29918, 2557, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 418, 903, 29916, 353, 1583, 29889, 397, 290, 29918, 2557, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 418, 903, 29916, 353, 1583, 13, 418, 20487, 29889, 3539, 7373, 657, 29918, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 2141, 4058, 7373, 29916, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 29892, 903, 29916, 29889, 1509, 29918, 397, 7843, 29892, 903, 29916, 29889, 1509, 29918, 6654, 29918, 29879, 271, 29892, 903, 29916, 29889, 1509, 29918, 1049, 22848, 29892, 903, 29916, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 29892, 903, 29916, 29889, 1949, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 29892, 903, 29916, 29889, 1949, 29918, 3149, 29918, 9274, 29879, 29892, 903, 29916, 29889, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 876, 13, 418, 903, 29916, 353, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 13, 418, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 565, 3017, 29941, 470, 1134, 7373, 29916, 29897, 1275, 29104, 29901, 13, 4706, 903, 29916, 353, 903, 29916, 29889, 12508, 877, 9420, 29899, 29947, 1495, 13, 4706, 3309, 353, 7431, 7373, 29916, 29897, 13, 418, 20487, 29889, 3539, 29898, 4984, 29889, 4058, 877, 29966, 29902, 29995, 893, 29915, 29995, 2848, 29892, 3309, 29892, 903, 29916, 876, 13, 1678, 5174, 2281, 29889, 2704, 408, 409, 29901, 1583, 3032, 3198, 29918, 8768, 29898, 4984, 29889, 2704, 11702, 29879, 29901, 14210, 29879, 29915, 746, 5007, 14210, 29879, 11838, 1273, 313, 1853, 29898, 344, 511, 851, 29898, 344, 511, 851, 29898, 2997, 29879, 2141, 657, 877, 29918, 29916, 742, 1583, 876, 4961, 13, 1678, 5174, 20948, 408, 734, 29901, 1583, 3032, 3198, 29918, 8768, 29898, 1917, 2392, 11702, 29879, 29901, 14210, 29879, 29915, 746, 5007, 14210, 29879, 11838, 1273, 313, 1853, 29898, 371, 511, 851, 29898, 371, 511, 851, 29898, 2997, 29879, 2141, 657, 877, 29918, 29916, 742, 1583, 876, 4961, 13, 13, 29871, 822, 16964, 6646, 29918, 23749, 29898, 1311, 29892, 851, 29892, 12655, 1125, 13, 1678, 9995, 13, 1678, 443, 4058, 7797, 1891, 2643, 297, 851, 964, 445, 2643, 2777, 773, 12655, 363, 1409, 4072, 13, 1678, 584, 3207, 851, 29901, 7023, 1409, 310, 7797, 1891, 2643, 29892, 4954, 710, 16159, 13, 1678, 584, 3207, 12655, 29901, 12655, 3017, 3883, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 418, 1095, 353, 29871, 29900, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 11294, 292, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 11294, 292, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 5467, 3726, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 5467, 3726, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 397, 290, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 397, 290, 29918, 2557, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 903, 29916, 353, 1583, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29953, 29896, 13, 418, 9423, 29916, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 29892, 903, 29916, 29889, 1509, 29918, 397, 7843, 29892, 903, 29916, 29889, 1509, 29918, 6654, 29918, 29879, 271, 29892, 903, 29916, 29889, 1509, 29918, 1049, 22848, 29892, 903, 29916, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 29892, 903, 29916, 29889, 1949, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 9910, 29918, 8057, 29918, 3333, 261, 29918, 1557, 550, 29892, 903, 29916, 29889, 1949, 29918, 1491, 4563, 12112, 29918, 546, 29918, 3333, 261, 29918, 16192, 29892, 903, 29916, 29889, 1949, 29918, 3149, 29918, 9274, 29879, 29892, 903, 29916, 29889, 3881, 2886, 261, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 397, 7843, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 20227, 29918, 2557, 29918, 4220, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 326, 29884, 29918, 13445, 10335, 29918, 3605, 601, 29892, 903, 29916, 29889, 1049, 22848, 29918, 13445, 10335, 29918, 3605, 601, 29892, 29897, 353, 903, 657, 29918, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 2141, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1583, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 353, 6120, 29898, 1311, 29889, 16123, 680, 29918, 397, 290, 29918, 2557, 29897, 13, 418, 1583, 29889, 1509, 29918, 397, 7843, 353, 6120, 29898, 1311, 29889, 1509, 29918, 397, 7843, 29897, 13, 418, 1583, 29889, 1509, 29918, 6654, 29918, 29879, 271, 353, 6120, 29898, 1311, 29889, 1509, 29918, 6654, 29918, 29879, 271, 29897, 13, 418, 1583, 29889, 1509, 29918, 1049, 22848, 353, 6120, 29898, 1311, 29889, 1509, 29918, 1049, 22848, 29897, 13, 418, 1583, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 353, 6120, 29898, 1311, 29889, 23679, 29918, 2557, 29918, 4836, 287, 29918, 517, 29918, 29906, 29881, 29897, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 29871, 29946, 13, 418, 313, 2848, 29892, 29897, 353, 903, 4984, 29918, 29902, 29889, 348, 4058, 29898, 710, 29961, 2962, 29901, 355, 2314, 13, 418, 1369, 353, 1095, 13, 418, 1095, 4619, 3309, 13, 418, 565, 3017, 29941, 29901, 13, 4706, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 353, 851, 29961, 2962, 29901, 355, 1822, 13808, 877, 9420, 29899, 29947, 1495, 13, 418, 1683, 29901, 13, 4706, 1583, 29889, 3018, 622, 706, 29918, 16409, 29918, 6768, 29918, 17529, 353, 851, 29961, 2962, 29901, 355, 29962, 13, 418, 736, 1583, 13, 1678, 5174, 2281, 29889, 2704, 408, 321, 29901, 13, 418, 12020, 2531, 2272, 29889, 4002, 261, 616, 2133, 2392, 29898, 29872, 29897, 396, 3242, 5517, 6835, 1090, 5589, 13, 13, 29918, 4984, 29918, 29902, 353, 2531, 2272, 29889, 4984, 29918, 29902, 13, 1753, 903, 657, 29918, 4984, 29918, 29902, 7295, 13, 1678, 5534, 903, 4984, 29918, 29902, 13, 1678, 736, 903, 4984, 29918, 29902, 13, 29918, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 353, 6213, 13, 1753, 903, 657, 29918, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 7295, 13, 1678, 5534, 903, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 13, 1678, 565, 903, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 338, 6213, 29901, 13, 4706, 903, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 353, 2281, 29889, 19560, 28945, 29945, 29933, 29946, 29875, 29945, 29881, 1159, 13, 1678, 736, 903, 4984, 29918, 29945, 29933, 29946, 29875, 29945, 29881, 13, 2 ]
cumulusci/tasks/robotframework/debugger/DebugListener.py
davisagli/CumulusCI
163
90682
""" Robot Debugger """ from cumulusci.tasks.robotframework.debugger import ( Breakpoint, DebuggerCli, Keyword, Suite, Testcase, ) class DebugListener(object): """A robot framework listener for debugging test cases This acts as the controller for the debugger. It is responsible for managing breakpoints, and pausing execution of a test when a breakpoint is hit. The listener is also responsible for instantiating the debugger UI (class DebuggerCli). """ ROBOT_LISTENER_API_VERSION = 2 def __init__(self, *breakpoints): self.show_initial_help = True self.current_file = None self.stack = [] self.rdb = DebuggerCli(listener=self) if breakpoints: self.breakpoints = list(breakpoints) else: self.breakpoints = [ Breakpoint(Keyword, "*::cumulusci.robotframework.Salesforce.Breakpoint") ] def start_suite(self, name, attrs): self.stack.append(Suite(name, attrs)) def start_test(self, name, attrs): self.stack.append(Testcase(name, attrs)) def start_keyword(self, name, attrs): context = Keyword(name, attrs) self.stack.append(context) self.break_if_breakpoint() def end_keyword(self, name, attrs): self.stack.pop() def end_test(self, name, attrs): self.stack.pop() def end_suite(self, name, attrs): self.stack.pop() def do_step(self): """Single-step through the code This will set a temporary breakpoint on the next keyword in the current context before continuing. Once the breakpoint is hit, it will be removed from the list of breakpoints. """ breakpoint = Breakpoint( Keyword, "{}::*".format(self.stack[-2].longname), temporary=True ) self.breakpoints.append(breakpoint) def break_if_breakpoint(self): """Pause test execution and issue a prompt if we are at a breakpoint""" # filter breakpoints to only those that match the current context # (eg: Suite, Testcase, Keyword), and iterate over them looking # for a match. for breakpoint in [ bp for bp in self.breakpoints if isinstance(self.stack[-1], bp.breakpoint_type) ]: statement = "{}::{}".format(self.stack[-2].longname, self.stack[-1].name) if breakpoint.match(statement): if breakpoint.temporary: self.breakpoints.remove(breakpoint) intro = "\n" if self.show_initial_help: self.show_initial_help = False intro += self.rdb.intro intro += "\n> {}\n-> {}".format( self.stack[-2].longname, str(self.stack[-1]) ) # Note: this call won't return until a debugger command # has been issued which returns True (eg: 'continue' or 'step') self.rdb.cmdloop(intro) return
[ 1, 9995, 13, 21860, 327, 16171, 914, 13, 13, 15945, 29908, 13, 13, 3166, 13299, 14999, 455, 29889, 20673, 29889, 307, 7451, 4468, 29889, 8382, 914, 1053, 313, 13, 1678, 28301, 3149, 29892, 13, 1678, 16171, 914, 29907, 492, 29892, 13, 1678, 7670, 1742, 29892, 13, 1678, 2166, 568, 29892, 13, 1678, 4321, 4878, 29892, 13, 29897, 13, 13, 13, 1990, 16171, 3962, 29898, 3318, 1125, 13, 1678, 9995, 29909, 19964, 6890, 13254, 363, 13490, 1243, 4251, 13, 13, 1678, 910, 14741, 408, 278, 4701, 363, 278, 18297, 29889, 739, 338, 14040, 13, 1678, 363, 767, 6751, 2867, 9748, 29892, 322, 282, 1485, 292, 8225, 310, 263, 1243, 746, 263, 13, 1678, 2867, 3149, 338, 7124, 29889, 13, 13, 1678, 450, 13254, 338, 884, 14040, 363, 13213, 1218, 278, 18297, 3740, 13, 1678, 313, 1990, 16171, 914, 29907, 492, 467, 13, 13, 1678, 9995, 13, 13, 1678, 390, 14824, 2891, 29918, 24360, 1430, 1001, 29918, 8787, 29918, 16358, 353, 29871, 29906, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 8690, 9748, 1125, 13, 4706, 1583, 29889, 4294, 29918, 11228, 29918, 8477, 353, 5852, 13, 4706, 1583, 29889, 3784, 29918, 1445, 353, 6213, 13, 4706, 1583, 29889, 1429, 353, 5159, 13, 4706, 1583, 29889, 29878, 2585, 353, 16171, 914, 29907, 492, 29898, 25894, 29922, 1311, 29897, 13, 4706, 565, 2867, 9748, 29901, 13, 9651, 1583, 29889, 8690, 9748, 353, 1051, 29898, 8690, 9748, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 8690, 9748, 353, 518, 13, 18884, 28301, 3149, 29898, 2558, 1742, 29892, 26345, 1057, 29883, 398, 14999, 455, 29889, 307, 7451, 4468, 29889, 29903, 2122, 10118, 29889, 20130, 557, 3149, 1159, 13, 9651, 4514, 13, 13, 1678, 822, 1369, 29918, 13495, 29898, 1311, 29892, 1024, 29892, 12421, 29879, 1125, 13, 4706, 1583, 29889, 1429, 29889, 4397, 29898, 5091, 568, 29898, 978, 29892, 12421, 29879, 876, 13, 13, 1678, 822, 1369, 29918, 1688, 29898, 1311, 29892, 1024, 29892, 12421, 29879, 1125, 13, 4706, 1583, 29889, 1429, 29889, 4397, 29898, 3057, 4878, 29898, 978, 29892, 12421, 29879, 876, 13, 13, 1678, 822, 1369, 29918, 26766, 29898, 1311, 29892, 1024, 29892, 12421, 29879, 1125, 13, 4706, 3030, 353, 7670, 1742, 29898, 978, 29892, 12421, 29879, 29897, 13, 4706, 1583, 29889, 1429, 29889, 4397, 29898, 4703, 29897, 13, 4706, 1583, 29889, 8690, 29918, 361, 29918, 8690, 3149, 580, 13, 13, 1678, 822, 1095, 29918, 26766, 29898, 1311, 29892, 1024, 29892, 12421, 29879, 1125, 13, 4706, 1583, 29889, 1429, 29889, 7323, 580, 13, 13, 1678, 822, 1095, 29918, 1688, 29898, 1311, 29892, 1024, 29892, 12421, 29879, 1125, 13, 4706, 1583, 29889, 1429, 29889, 7323, 580, 13, 13, 1678, 822, 1095, 29918, 13495, 29898, 1311, 29892, 1024, 29892, 12421, 29879, 1125, 13, 4706, 1583, 29889, 1429, 29889, 7323, 580, 13, 13, 1678, 822, 437, 29918, 10568, 29898, 1311, 1125, 13, 4706, 9995, 15771, 29899, 10568, 1549, 278, 775, 13, 13, 4706, 910, 674, 731, 263, 13201, 2867, 3149, 373, 278, 2446, 13553, 297, 13, 4706, 278, 1857, 3030, 1434, 3133, 292, 29889, 9038, 278, 2867, 3149, 13, 4706, 338, 7124, 29892, 372, 674, 367, 6206, 515, 278, 1051, 310, 2867, 9748, 29889, 13, 4706, 9995, 13, 4706, 2867, 3149, 353, 28301, 3149, 29898, 13, 9651, 7670, 1742, 29892, 376, 8875, 1057, 29930, 1642, 4830, 29898, 1311, 29889, 1429, 14352, 29906, 1822, 5426, 978, 511, 13201, 29922, 5574, 13, 4706, 1723, 13, 4706, 1583, 29889, 8690, 9748, 29889, 4397, 29898, 8690, 3149, 29897, 13, 13, 1678, 822, 2867, 29918, 361, 29918, 8690, 3149, 29898, 1311, 1125, 13, 4706, 9995, 29925, 1071, 1243, 8225, 322, 2228, 263, 9508, 565, 591, 526, 472, 263, 2867, 3149, 15945, 29908, 13, 13, 4706, 396, 4175, 2867, 9748, 304, 871, 1906, 393, 1993, 278, 1857, 3030, 13, 4706, 396, 313, 387, 29901, 2166, 568, 29892, 4321, 4878, 29892, 7670, 1742, 511, 322, 13649, 975, 963, 3063, 13, 4706, 396, 363, 263, 1993, 29889, 13, 4706, 363, 2867, 3149, 297, 518, 13, 9651, 289, 29886, 13, 9651, 363, 289, 29886, 297, 1583, 29889, 8690, 9748, 13, 9651, 565, 338, 8758, 29898, 1311, 29889, 1429, 14352, 29896, 1402, 289, 29886, 29889, 8690, 3149, 29918, 1853, 29897, 13, 4706, 4514, 29901, 13, 9651, 3229, 353, 376, 8875, 1057, 8875, 1642, 4830, 29898, 1311, 29889, 1429, 14352, 29906, 1822, 5426, 978, 29892, 1583, 29889, 1429, 14352, 29896, 1822, 978, 29897, 13, 9651, 565, 2867, 3149, 29889, 4352, 29898, 20788, 1125, 13, 18884, 565, 2867, 3149, 29889, 1356, 1971, 653, 29901, 13, 462, 1678, 1583, 29889, 8690, 9748, 29889, 5992, 29898, 8690, 3149, 29897, 13, 13, 18884, 22909, 353, 6634, 29876, 29908, 13, 18884, 565, 1583, 29889, 4294, 29918, 11228, 29918, 8477, 29901, 13, 462, 1678, 1583, 29889, 4294, 29918, 11228, 29918, 8477, 353, 7700, 13, 462, 1678, 22909, 4619, 1583, 29889, 29878, 2585, 29889, 23333, 13, 18884, 22909, 4619, 6634, 29876, 29958, 426, 1012, 29876, 976, 6571, 1642, 4830, 29898, 13, 462, 1678, 1583, 29889, 1429, 14352, 29906, 1822, 5426, 978, 29892, 851, 29898, 1311, 29889, 1429, 14352, 29896, 2314, 13, 18884, 1723, 13, 13, 18884, 396, 3940, 29901, 445, 1246, 2113, 29915, 29873, 736, 2745, 263, 18297, 1899, 13, 18884, 396, 756, 1063, 16610, 607, 3639, 5852, 313, 387, 29901, 525, 19878, 29915, 470, 525, 10568, 1495, 13, 18884, 1583, 29889, 29878, 2585, 29889, 9006, 7888, 29898, 23333, 29897, 13, 18884, 736, 13, 2 ]
h5Nastran/h5Nastran/h5/nastran/input/dynamic.py
ACea15/pyNastran
293
169099
<filename>h5Nastran/h5Nastran/h5/nastran/input/dynamic.py from __future__ import print_function, absolute_import from collections import defaultdict from six.moves import range from six import iteritems from h5Nastran.defaults import Defaults from h5Nastran.h5nastrannode import H5NastranNode from .input_table import InputTable, TableDef class Dynamic(H5NastranNode): def __init__(self, h5n, input): self._h5n = h5n self._input = input self.eigr = EIGR(self._h5n, self) self.eigrl = EIGRL(self._h5n, self) self.freq = FREQ(self._h5n, self) self.freq1 = FREQ1(self._h5n, self) self.randps = RANDPS(self._h5n, self) def path(self): return self._input.path() + ['DYNAMIC'] def to_bdf(self, bdf): for key, item in iteritems(self.__dict__): if key.startswith('_'): continue try: item.to_bdf(bdf) except NotImplementedError: pass ######################################################################################################################## class EIGR(InputTable): table_def = TableDef.create('/NASTRAN/INPUT/DYNAMIC/EIGR') def to_bdf(self, bdf): add_card = bdf.add_eigr identity = self.identity sid = identity['SID'] method = identity['METHOD'] f1 = identity['F1'] f2 = identity['F2'] ne = identity['NE'] nd = identity['ND'] norm = identity['NORM'] g = identity['G'] c = identity['C'] to_value_int = self._h5n.defaults.to_value_int for i in range(sid.size): _g = to_value_int(g[i]) _c = to_value_int(c[i]) add_card(sid[i], method[i].decode(), f1[i], f2[i], ne[i], nd[i], norm[i].decode(), _g, _c) def from_bdf(self, cards): card_ids = sorted(cards.keys()) result = {'IDENTITY': {'SID': [], 'METHOD': [], 'F1': [], 'F2': [], 'NE': [], 'ND': [], 'NORM': [], 'G': [], 'C': [], 'DOMAIN_ID': []}} identity = result['IDENTITY'] sid = identity['SID'] method = identity['METHOD'] f1 = identity['F1'] f2 = identity['F2'] ne = identity['NE'] nd = identity['ND'] norm = identity['NORM'] g = identity['G'] c = identity['C'] get_value_int = self._h5n.defaults.get_value_int for card_id in card_ids: card = cards[card_id] sid.append(card.sid) method.append(card.method) f1.append(card.f1) f2.append(card.f2) ne.append(get_value_int(card.ne)) nd.append(get_value_int(card.nd)) norm.append(card.norm) g.append(get_value_int(card.G)) c.append(get_value_int(card.C)) return result ######################################################################################################################## class EIGRL(InputTable): table_def = TableDef.create('/NASTRAN/INPUT/DYNAMIC/EIGRL/IDENTITY') def from_bdf(self, cards): card_ids = sorted(cards.keys()) freqs = {'IDENTITY': {'FI': []}} result = {'IDENTITY': {'SID': [], 'V1': [], 'V2': [], 'ND': [], 'MSGLVL': [], 'MAXSET': [], 'SHFSCL': [], 'FLAG1': [], 'FLAG2': [], 'NORM': [], 'ALPH': [], 'FREQS_POS': [], 'FREQS_LEN': [], 'DOMAIN_ID': []}, 'FREQS': freqs, '_subtables': ['FREQS']} fi = freqs['IDENTITY']['FI'] identity = result['IDENTITY'] sid = identity['SID'] v1 = identity['V1'] v2 = identity['V2'] nd = identity['ND'] msglvl = identity['MSGLVL'] maxset = identity['MAXSET'] shfscl = identity['SHFSCL'] flag1 = identity['FLAG1'] flag2 = identity['FLAG2'] norm = identity['NORM'] alph = identity['ALPH'] freqs_pos = identity['FREQS_POS'] freqs_len = identity['FREQS_LEN'] def _get_option(val, option, option_data, default): if val in ('', None): val = option_data.get(option, None) if val is None: val = default return val _pos = 0 for card_id in card_ids: card = cards[card_id] option_data = defaultdict(list) for i in range(len(card.options)): option_data[card.options[i]].append(card.values[i]) _v1 = _get_option(card.v1, 'V1', option_data, Defaults.default_double) _v2 = _get_option(card.v2, 'V2', option_data, Defaults.default_double) _nd = _get_option(card.nd, 'ND', option_data, Defaults.default_int) _msglvl = _get_option(card.msglvl, 'MSGLVL', option_data, Defaults.default_int) _maxset = _get_option(card.maxset, 'MAXSET', option_data, Defaults.default_int) _shfscl = _get_option(card.shfscl, 'SHFSCL', option_data, Defaults.default_double) _norm = _get_option(card.norm, 'NORM', option_data, Defaults.default_str) _alph = _get_option(None, 'ALPH', option_data, Defaults.default_double) # TODO: EIGRL how is nums used?, what is flag1 and flag2? # _nums = _get_option(None, 'NUMS', option_data, 1) _fi = _get_option(None, 'Fi', option_data, []) sid.append(card.sid) v1.append(_v1) v2.append(_v2) nd.append(_nd) msglvl.append(_msglvl) maxset.append(_maxset) shfscl.append(_shfscl) norm.append(_norm) alph.append(_alph) flag1.append(Defaults.unknown_int) flag2.append(Defaults.unknown_int) freqs_pos.append(_pos) _len = len(_fi) _pos += _len freqs_len.append(_len) fi += _fi return result ######################################################################################################################## class FREQ(InputTable): table_def = TableDef.create('/NASTRAN/INPUT/DYNAMIC/FREQ/IDENTITY') def from_bdf(self, cards): card_ids = sorted(cards.keys()) freqs = {'IDENTITY': {'F': []}} result = {'IDENTITY': {'SID': [], 'FREQS_POS': [], 'FREQS_LEN': [], 'DOMAIN_ID': []}, 'FREQS': freqs, '_subtables': ['FREQS']} f = freqs['IDENTITY']['F'] identity = result['IDENTITY'] sid = identity['SID'] freqs_pos = identity['FREQS_POS'] freqs_len = identity['FREQS_LEN'] pos = 0 for card_id in card_ids: card_list = cards[card_id] for card in card_list: sid.append(card.sid) freqs_pos.append(pos) _len = len(card.freqs) freqs_len.append(_len) pos += _len f.extend(card.freqs) return result ######################################################################################################################## class FREQ1(InputTable): table_def = TableDef.create('/NASTRAN/INPUT/DYNAMIC/FREQ1') def from_bdf(self, cards): card_ids = sorted(cards.keys()) result = {'IDENTITY': {'SID': [], 'F1': [], 'DF': [], 'NDF': [], 'DOMAIN_ID': []}} identity = result['IDENTITY'] sid = identity['SID'] f1 = identity['F1'] df = identity['DF'] ndf = identity['NDF'] for card_id in card_ids: card_list = cards[card_id] for card in card_list: sid.append(card.sid) f1.append(card.f1) df.append(card.df) ndf.append(card.ndf) return result ######################################################################################################################## class RANDPS(InputTable): table_def = TableDef.create('/NASTRAN/INPUT/DYNAMIC/RANDPS') def from_bdf(self, cards): card_ids = sorted(cards.keys()) result = { 'IDENTITY': {'SID': [], 'J': [], 'K': [], 'X': [], 'Y': [], 'TID': [], 'DOMAIN_ID': []} } i = result['IDENTITY'] sid = i['SID'] j = i['J'] k = i['K'] x = i['X'] y = i['Y'] tid = i['TID'] for card_id in card_ids: card_list = cards[card_id] for card in card_list: sid.append(card.sid) j.append(card.j) k.append(card.k) x.append(card.x) y.append(card.y) tid.append(card.tid) return result
[ 1, 529, 9507, 29958, 29882, 29945, 29940, 7614, 273, 29914, 29882, 29945, 29940, 7614, 273, 29914, 29882, 29945, 29914, 29876, 7614, 273, 29914, 2080, 29914, 16626, 29889, 2272, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 29892, 8380, 29918, 5215, 13, 13, 3166, 16250, 1053, 2322, 8977, 13, 13, 3166, 4832, 29889, 13529, 267, 1053, 3464, 13, 3166, 4832, 1053, 4256, 7076, 13, 13, 3166, 298, 29945, 29940, 7614, 273, 29889, 4381, 29879, 1053, 13109, 29879, 13, 3166, 298, 29945, 29940, 7614, 273, 29889, 29882, 29945, 29876, 7614, 812, 356, 1053, 379, 29945, 29940, 7614, 273, 4247, 13, 3166, 869, 2080, 29918, 2371, 1053, 10567, 3562, 29892, 6137, 3206, 13, 13, 13, 1990, 27747, 29898, 29950, 29945, 29940, 7614, 273, 4247, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 298, 29945, 29876, 29892, 1881, 1125, 13, 4706, 1583, 3032, 29882, 29945, 29876, 353, 298, 29945, 29876, 13, 4706, 1583, 3032, 2080, 353, 1881, 13, 13, 4706, 1583, 29889, 29872, 4481, 353, 382, 6259, 29934, 29898, 1311, 3032, 29882, 29945, 29876, 29892, 1583, 29897, 13, 4706, 1583, 29889, 29872, 335, 2096, 353, 382, 6259, 2241, 29898, 1311, 3032, 29882, 29945, 29876, 29892, 1583, 29897, 13, 4706, 1583, 29889, 29888, 7971, 353, 383, 1525, 29984, 29898, 1311, 3032, 29882, 29945, 29876, 29892, 1583, 29897, 13, 4706, 1583, 29889, 29888, 7971, 29896, 353, 383, 1525, 29984, 29896, 29898, 1311, 3032, 29882, 29945, 29876, 29892, 1583, 29897, 13, 4706, 1583, 29889, 9502, 567, 353, 390, 9468, 7024, 29898, 1311, 3032, 29882, 29945, 29876, 29892, 1583, 29897, 13, 13, 1678, 822, 2224, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 2080, 29889, 2084, 580, 718, 6024, 29928, 29979, 3521, 29924, 2965, 2033, 13, 268, 13, 1678, 822, 304, 29918, 29890, 2176, 29898, 1311, 29892, 289, 2176, 1125, 13, 4706, 363, 1820, 29892, 2944, 297, 4256, 7076, 29898, 1311, 17255, 8977, 1649, 1125, 13, 9651, 565, 1820, 29889, 27382, 2541, 877, 29918, 29374, 13, 18884, 6773, 13, 9651, 1018, 29901, 13, 18884, 2944, 29889, 517, 29918, 29890, 2176, 29898, 29890, 2176, 29897, 13, 9651, 5174, 2216, 1888, 2037, 287, 2392, 29901, 13, 18884, 1209, 13, 13, 13, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 13, 13, 13, 1990, 382, 6259, 29934, 29898, 4290, 3562, 1125, 13, 1678, 1591, 29918, 1753, 353, 6137, 3206, 29889, 3258, 11219, 3521, 10810, 2190, 29914, 1177, 12336, 29914, 29928, 29979, 3521, 29924, 2965, 29914, 29923, 6259, 29934, 1495, 13, 13, 1678, 822, 304, 29918, 29890, 2176, 29898, 1311, 29892, 289, 2176, 1125, 13, 4706, 788, 29918, 7543, 353, 289, 2176, 29889, 1202, 29918, 29872, 4481, 13, 13, 4706, 10110, 353, 1583, 29889, 22350, 13, 13, 4706, 25349, 353, 10110, 1839, 29903, 1367, 2033, 13, 4706, 1158, 353, 10110, 1839, 2303, 4690, 13668, 2033, 13, 4706, 285, 29896, 353, 10110, 1839, 29943, 29896, 2033, 13, 4706, 285, 29906, 353, 10110, 1839, 29943, 29906, 2033, 13, 4706, 452, 353, 10110, 1839, 8186, 2033, 13, 308, 299, 353, 10110, 1839, 2797, 2033, 13, 4706, 6056, 353, 10110, 1839, 29940, 12054, 2033, 13, 4706, 330, 353, 10110, 1839, 29954, 2033, 13, 4706, 274, 353, 10110, 1839, 29907, 2033, 13, 13, 4706, 304, 29918, 1767, 29918, 524, 353, 1583, 3032, 29882, 29945, 29876, 29889, 4381, 29879, 29889, 517, 29918, 1767, 29918, 524, 13, 13, 4706, 363, 474, 297, 3464, 29898, 29879, 333, 29889, 2311, 1125, 13, 9651, 903, 29887, 353, 304, 29918, 1767, 29918, 524, 29898, 29887, 29961, 29875, 2314, 13, 9651, 903, 29883, 353, 304, 29918, 1767, 29918, 524, 29898, 29883, 29961, 29875, 2314, 13, 9651, 788, 29918, 7543, 29898, 29879, 333, 29961, 29875, 1402, 1158, 29961, 29875, 1822, 13808, 3285, 285, 29896, 29961, 29875, 1402, 285, 29906, 29961, 29875, 1402, 452, 29961, 29875, 1402, 29871, 299, 29961, 29875, 1402, 6056, 29961, 29875, 1822, 13808, 3285, 903, 29887, 29892, 903, 29883, 29897, 13, 632, 13, 1678, 822, 515, 29918, 29890, 2176, 29898, 1311, 29892, 15889, 1125, 13, 4706, 5881, 29918, 4841, 353, 12705, 29898, 28160, 29889, 8149, 3101, 13, 13, 4706, 1121, 353, 11117, 1367, 3919, 11937, 2396, 11117, 29903, 1367, 2396, 19997, 525, 2303, 4690, 13668, 2396, 19997, 525, 29943, 29896, 2396, 19997, 525, 29943, 29906, 2396, 19997, 525, 8186, 2396, 19997, 525, 2797, 2396, 19997, 525, 29940, 12054, 2396, 19997, 13, 462, 1669, 525, 29954, 2396, 19997, 525, 29907, 2396, 19997, 525, 3970, 29032, 29918, 1367, 2396, 5159, 930, 13, 13, 4706, 10110, 353, 1121, 1839, 1367, 3919, 11937, 2033, 13, 4706, 25349, 353, 10110, 1839, 29903, 1367, 2033, 13, 4706, 1158, 353, 10110, 1839, 2303, 4690, 13668, 2033, 13, 4706, 285, 29896, 353, 10110, 1839, 29943, 29896, 2033, 13, 4706, 285, 29906, 353, 10110, 1839, 29943, 29906, 2033, 13, 4706, 452, 353, 10110, 1839, 8186, 2033, 13, 308, 299, 353, 10110, 1839, 2797, 2033, 13, 4706, 6056, 353, 10110, 1839, 29940, 12054, 2033, 13, 4706, 330, 353, 10110, 1839, 29954, 2033, 13, 4706, 274, 353, 10110, 1839, 29907, 2033, 13, 13, 4706, 679, 29918, 1767, 29918, 524, 353, 1583, 3032, 29882, 29945, 29876, 29889, 4381, 29879, 29889, 657, 29918, 1767, 29918, 524, 13, 13, 4706, 363, 5881, 29918, 333, 297, 5881, 29918, 4841, 29901, 13, 9651, 5881, 353, 15889, 29961, 7543, 29918, 333, 29962, 13, 13, 9651, 25349, 29889, 4397, 29898, 7543, 29889, 29879, 333, 29897, 13, 9651, 1158, 29889, 4397, 29898, 7543, 29889, 5696, 29897, 13, 9651, 285, 29896, 29889, 4397, 29898, 7543, 29889, 29888, 29896, 29897, 13, 9651, 285, 29906, 29889, 4397, 29898, 7543, 29889, 29888, 29906, 29897, 13, 9651, 452, 29889, 4397, 29898, 657, 29918, 1767, 29918, 524, 29898, 7543, 29889, 484, 876, 13, 632, 299, 29889, 4397, 29898, 657, 29918, 1767, 29918, 524, 29898, 7543, 29889, 299, 876, 13, 9651, 6056, 29889, 4397, 29898, 7543, 29889, 12324, 29897, 13, 9651, 330, 29889, 4397, 29898, 657, 29918, 1767, 29918, 524, 29898, 7543, 29889, 29954, 876, 13, 9651, 274, 29889, 4397, 29898, 657, 29918, 1767, 29918, 524, 29898, 7543, 29889, 29907, 876, 13, 13, 4706, 736, 1121, 13, 13, 13, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 13, 13, 13, 1990, 382, 6259, 2241, 29898, 4290, 3562, 1125, 13, 1678, 1591, 29918, 1753, 353, 6137, 3206, 29889, 3258, 11219, 3521, 10810, 2190, 29914, 1177, 12336, 29914, 29928, 29979, 3521, 29924, 2965, 29914, 29923, 6259, 2241, 29914, 1367, 3919, 11937, 1495, 13, 13, 1678, 822, 515, 29918, 29890, 2176, 29898, 1311, 29892, 15889, 1125, 13, 4706, 5881, 29918, 4841, 353, 12705, 29898, 28160, 29889, 8149, 3101, 13, 13, 4706, 3005, 29939, 29879, 353, 11117, 1367, 3919, 11937, 2396, 11117, 3738, 2396, 5159, 930, 13, 13, 4706, 1121, 353, 11117, 1367, 3919, 11937, 2396, 11117, 29903, 1367, 2396, 19997, 525, 29963, 29896, 2396, 19997, 525, 29963, 29906, 2396, 19997, 525, 2797, 2396, 19997, 525, 4345, 7239, 29963, 29931, 2396, 19997, 525, 12648, 10490, 2396, 19997, 13, 462, 1669, 525, 7068, 9998, 6154, 2396, 19997, 525, 26516, 29896, 2396, 19997, 525, 26516, 29906, 2396, 19997, 525, 29940, 12054, 2396, 19997, 525, 1964, 19689, 2396, 19997, 525, 29943, 1525, 29984, 29903, 29918, 24815, 2396, 19997, 13, 462, 1669, 525, 29943, 1525, 29984, 29903, 29918, 1307, 29940, 2396, 19997, 525, 3970, 29032, 29918, 1367, 2396, 5159, 1118, 13, 462, 29871, 525, 29943, 1525, 29984, 29903, 2396, 3005, 29939, 29879, 29892, 13, 462, 29871, 22868, 1491, 24051, 2396, 6024, 29943, 1525, 29984, 29903, 2033, 29913, 13, 13, 4706, 5713, 353, 3005, 29939, 29879, 1839, 1367, 3919, 11937, 16215, 3738, 2033, 13, 4706, 10110, 353, 1121, 1839, 1367, 3919, 11937, 2033, 13, 4706, 25349, 353, 10110, 1839, 29903, 1367, 2033, 13, 4706, 325, 29896, 353, 10110, 1839, 29963, 29896, 2033, 13, 4706, 325, 29906, 353, 10110, 1839, 29963, 29906, 2033, 13, 308, 299, 353, 10110, 1839, 2797, 2033, 13, 4706, 10887, 3820, 20901, 353, 10110, 1839, 4345, 7239, 29963, 29931, 2033, 13, 4706, 4236, 842, 353, 10110, 1839, 12648, 10490, 2033, 13, 4706, 528, 5847, 695, 353, 10110, 1839, 7068, 9998, 6154, 2033, 13, 4706, 7353, 29896, 353, 10110, 1839, 26516, 29896, 2033, 13, 4706, 7353, 29906, 353, 10110, 1839, 26516, 29906, 2033, 13, 4706, 6056, 353, 10110, 1839, 29940, 12054, 2033, 13, 4706, 394, 561, 353, 10110, 1839, 1964, 19689, 2033, 13, 4706, 3005, 29939, 29879, 29918, 1066, 353, 10110, 1839, 29943, 1525, 29984, 29903, 29918, 24815, 2033, 13, 4706, 3005, 29939, 29879, 29918, 2435, 353, 10110, 1839, 29943, 1525, 29984, 29903, 29918, 1307, 29940, 2033, 13, 13, 4706, 822, 903, 657, 29918, 3385, 29898, 791, 29892, 2984, 29892, 2984, 29918, 1272, 29892, 2322, 1125, 13, 9651, 565, 659, 297, 6702, 742, 6213, 1125, 13, 18884, 659, 353, 2984, 29918, 1272, 29889, 657, 29898, 3385, 29892, 6213, 29897, 13, 9651, 565, 659, 338, 6213, 29901, 13, 18884, 659, 353, 2322, 13, 9651, 736, 659, 13, 13, 4706, 903, 1066, 353, 29871, 29900, 13, 13, 4706, 363, 5881, 29918, 333, 297, 5881, 29918, 4841, 29901, 13, 9651, 5881, 353, 15889, 29961, 7543, 29918, 333, 29962, 13, 13, 9651, 2984, 29918, 1272, 353, 2322, 8977, 29898, 1761, 29897, 13, 13, 9651, 363, 474, 297, 3464, 29898, 2435, 29898, 7543, 29889, 6768, 22164, 13, 18884, 2984, 29918, 1272, 29961, 7543, 29889, 6768, 29961, 29875, 29962, 1822, 4397, 29898, 7543, 29889, 5975, 29961, 29875, 2314, 13, 13, 9651, 903, 29894, 29896, 353, 903, 657, 29918, 3385, 29898, 7543, 29889, 29894, 29896, 29892, 525, 29963, 29896, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 8896, 29897, 13, 9651, 903, 29894, 29906, 353, 903, 657, 29918, 3385, 29898, 7543, 29889, 29894, 29906, 29892, 525, 29963, 29906, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 8896, 29897, 13, 9651, 903, 299, 353, 903, 657, 29918, 3385, 29898, 7543, 29889, 299, 29892, 525, 2797, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 524, 29897, 13, 9651, 903, 1516, 3820, 20901, 353, 903, 657, 29918, 3385, 29898, 7543, 29889, 1516, 3820, 20901, 29892, 525, 4345, 7239, 29963, 29931, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 524, 29897, 13, 9651, 903, 3317, 842, 353, 903, 657, 29918, 3385, 29898, 7543, 29889, 3317, 842, 29892, 525, 12648, 10490, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 524, 29897, 13, 9651, 903, 845, 5847, 695, 353, 903, 657, 29918, 3385, 29898, 7543, 29889, 845, 5847, 695, 29892, 525, 7068, 9998, 6154, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 8896, 29897, 13, 9651, 903, 12324, 353, 903, 657, 29918, 3385, 29898, 7543, 29889, 12324, 29892, 525, 29940, 12054, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 710, 29897, 13, 9651, 903, 19712, 353, 903, 657, 29918, 3385, 29898, 8516, 29892, 525, 1964, 19689, 742, 2984, 29918, 1272, 29892, 13109, 29879, 29889, 4381, 29918, 8896, 29897, 13, 13, 9651, 396, 14402, 29901, 382, 6259, 2241, 920, 338, 954, 29879, 1304, 14579, 825, 338, 7353, 29896, 322, 7353, 29906, 29973, 13, 9651, 396, 903, 1949, 29879, 353, 903, 657, 29918, 3385, 29898, 8516, 29892, 525, 11601, 4345, 742, 2984, 29918, 1272, 29892, 29871, 29896, 29897, 13, 9651, 903, 7241, 353, 903, 657, 29918, 3385, 29898, 8516, 29892, 525, 18800, 742, 2984, 29918, 1272, 29892, 518, 2314, 13, 13, 9651, 25349, 29889, 4397, 29898, 7543, 29889, 29879, 333, 29897, 13, 9651, 325, 29896, 29889, 4397, 7373, 29894, 29896, 29897, 13, 9651, 325, 29906, 29889, 4397, 7373, 29894, 29906, 29897, 13, 632, 299, 29889, 4397, 7373, 299, 29897, 13, 9651, 10887, 3820, 20901, 29889, 4397, 7373, 1516, 3820, 20901, 29897, 13, 9651, 4236, 842, 29889, 4397, 7373, 3317, 842, 29897, 13, 9651, 528, 5847, 695, 29889, 4397, 7373, 845, 5847, 695, 29897, 13, 9651, 6056, 29889, 4397, 7373, 12324, 29897, 13, 9651, 394, 561, 29889, 4397, 7373, 19712, 29897, 13, 9651, 7353, 29896, 29889, 4397, 29898, 24863, 29889, 26690, 29918, 524, 29897, 13, 9651, 7353, 29906, 29889, 4397, 29898, 24863, 29889, 26690, 29918, 524, 29897, 13, 9651, 3005, 29939, 29879, 29918, 1066, 29889, 4397, 7373, 1066, 29897, 13, 9651, 903, 2435, 353, 7431, 7373, 7241, 29897, 13, 9651, 903, 1066, 4619, 903, 2435, 13, 9651, 3005, 29939, 29879, 29918, 2435, 29889, 4397, 7373, 2435, 29897, 13, 9651, 5713, 4619, 903, 7241, 13, 632, 13, 4706, 736, 1121, 13, 13, 13, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 13, 13, 13, 1990, 383, 1525, 29984, 29898, 4290, 3562, 1125, 13, 1678, 1591, 29918, 1753, 353, 6137, 3206, 29889, 3258, 11219, 3521, 10810, 2190, 29914, 1177, 12336, 29914, 29928, 29979, 3521, 29924, 2965, 29914, 29943, 1525, 29984, 29914, 1367, 3919, 11937, 1495, 13, 13, 1678, 822, 515, 29918, 29890, 2176, 29898, 1311, 29892, 15889, 1125, 13, 4706, 5881, 29918, 4841, 353, 12705, 29898, 28160, 29889, 8149, 3101, 13, 13, 4706, 3005, 29939, 29879, 353, 11117, 1367, 3919, 11937, 2396, 11117, 29943, 2396, 5159, 930, 13, 4706, 1121, 353, 11117, 1367, 3919, 11937, 2396, 11117, 29903, 1367, 2396, 19997, 525, 29943, 1525, 29984, 29903, 29918, 24815, 2396, 19997, 525, 29943, 1525, 29984, 29903, 29918, 1307, 29940, 2396, 19997, 525, 3970, 29032, 29918, 1367, 2396, 5159, 1118, 13, 462, 29871, 525, 29943, 1525, 29984, 29903, 2396, 3005, 29939, 29879, 29892, 13, 462, 29871, 22868, 1491, 24051, 2396, 6024, 29943, 1525, 29984, 29903, 2033, 29913, 13, 13, 4706, 285, 353, 3005, 29939, 29879, 1839, 1367, 3919, 11937, 16215, 29943, 2033, 13, 4706, 10110, 353, 1121, 1839, 1367, 3919, 11937, 2033, 13, 4706, 25349, 353, 10110, 1839, 29903, 1367, 2033, 13, 4706, 3005, 29939, 29879, 29918, 1066, 353, 10110, 1839, 29943, 1525, 29984, 29903, 29918, 24815, 2033, 13, 4706, 3005, 29939, 29879, 29918, 2435, 353, 10110, 1839, 29943, 1525, 29984, 29903, 29918, 1307, 29940, 2033, 13, 13, 4706, 926, 353, 29871, 29900, 13, 4706, 363, 5881, 29918, 333, 297, 5881, 29918, 4841, 29901, 13, 9651, 5881, 29918, 1761, 353, 15889, 29961, 7543, 29918, 333, 29962, 13, 13, 9651, 363, 5881, 297, 5881, 29918, 1761, 29901, 13, 18884, 25349, 29889, 4397, 29898, 7543, 29889, 29879, 333, 29897, 13, 18884, 3005, 29939, 29879, 29918, 1066, 29889, 4397, 29898, 1066, 29897, 13, 18884, 903, 2435, 353, 7431, 29898, 7543, 29889, 29888, 7971, 29879, 29897, 13, 18884, 3005, 29939, 29879, 29918, 2435, 29889, 4397, 7373, 2435, 29897, 13, 18884, 926, 4619, 903, 2435, 13, 18884, 285, 29889, 21843, 29898, 7543, 29889, 29888, 7971, 29879, 29897, 13, 13, 4706, 736, 1121, 13, 13, 13, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 13, 13, 13, 1990, 383, 1525, 29984, 29896, 29898, 4290, 3562, 1125, 13, 1678, 1591, 29918, 1753, 353, 6137, 3206, 29889, 3258, 11219, 3521, 10810, 2190, 29914, 1177, 12336, 29914, 29928, 29979, 3521, 29924, 2965, 29914, 29943, 1525, 29984, 29896, 1495, 13, 13, 1678, 822, 515, 29918, 29890, 2176, 29898, 1311, 29892, 15889, 1125, 13, 4706, 5881, 29918, 4841, 353, 12705, 29898, 28160, 29889, 8149, 3101, 13, 13, 4706, 1121, 353, 11117, 1367, 3919, 11937, 2396, 11117, 29903, 1367, 2396, 19997, 525, 29943, 29896, 2396, 19997, 525, 4037, 2396, 19997, 525, 2797, 29943, 2396, 19997, 525, 3970, 29032, 29918, 1367, 2396, 5159, 930, 13, 13, 4706, 10110, 353, 1121, 1839, 1367, 3919, 11937, 2033, 13, 4706, 25349, 353, 10110, 1839, 29903, 1367, 2033, 13, 4706, 285, 29896, 353, 10110, 1839, 29943, 29896, 2033, 13, 4706, 4489, 353, 10110, 1839, 4037, 2033, 13, 308, 299, 29888, 353, 10110, 1839, 2797, 29943, 2033, 13, 13, 4706, 363, 5881, 29918, 333, 297, 5881, 29918, 4841, 29901, 13, 9651, 5881, 29918, 1761, 353, 15889, 29961, 7543, 29918, 333, 29962, 13, 13, 9651, 363, 5881, 297, 5881, 29918, 1761, 29901, 13, 18884, 25349, 29889, 4397, 29898, 7543, 29889, 29879, 333, 29897, 13, 18884, 285, 29896, 29889, 4397, 29898, 7543, 29889, 29888, 29896, 29897, 13, 18884, 4489, 29889, 4397, 29898, 7543, 29889, 2176, 29897, 13, 462, 299, 29888, 29889, 4397, 29898, 7543, 29889, 299, 29888, 29897, 13, 13, 4706, 736, 1121, 13, 13, 13, 13383, 13383, 13383, 13383, 13383, 13383, 13383, 7346, 13, 13, 13, 1990, 390, 9468, 7024, 29898, 4290, 3562, 1125, 13, 1678, 1591, 29918, 1753, 353, 6137, 3206, 29889, 3258, 11219, 3521, 10810, 2190, 29914, 1177, 12336, 29914, 29928, 29979, 3521, 29924, 2965, 29914, 29934, 9468, 7024, 1495, 13, 13, 1678, 822, 515, 29918, 29890, 2176, 29898, 1311, 29892, 15889, 1125, 13, 4706, 5881, 29918, 4841, 353, 12705, 29898, 28160, 29889, 8149, 3101, 13, 13, 4706, 1121, 353, 426, 13, 9651, 525, 1367, 3919, 11937, 2396, 11117, 29903, 1367, 2396, 19997, 525, 29967, 2396, 19997, 525, 29968, 2396, 19997, 525, 29990, 2396, 19997, 525, 29979, 2396, 19997, 525, 29911, 1367, 2396, 19997, 525, 3970, 29032, 29918, 1367, 2396, 5159, 29913, 13, 4706, 500, 13, 13, 4706, 474, 353, 1121, 1839, 1367, 3919, 11937, 2033, 13, 4706, 25349, 353, 474, 1839, 29903, 1367, 2033, 13, 4706, 432, 353, 474, 1839, 29967, 2033, 13, 4706, 413, 353, 474, 1839, 29968, 2033, 13, 4706, 921, 353, 474, 1839, 29990, 2033, 13, 4706, 343, 353, 474, 1839, 29979, 2033, 13, 4706, 10668, 353, 474, 1839, 29911, 1367, 2033, 13, 13, 4706, 363, 5881, 29918, 333, 297, 5881, 29918, 4841, 29901, 13, 9651, 5881, 29918, 1761, 353, 15889, 29961, 7543, 29918, 333, 29962, 13, 13, 9651, 363, 5881, 297, 5881, 29918, 1761, 29901, 13, 18884, 25349, 29889, 4397, 29898, 7543, 29889, 29879, 333, 29897, 13, 18884, 432, 29889, 4397, 29898, 7543, 29889, 29926, 29897, 13, 18884, 413, 29889, 4397, 29898, 7543, 29889, 29895, 29897, 13, 18884, 921, 29889, 4397, 29898, 7543, 29889, 29916, 29897, 13, 18884, 343, 29889, 4397, 29898, 7543, 29889, 29891, 29897, 13, 18884, 10668, 29889, 4397, 29898, 7543, 29889, 17681, 29897, 13, 13, 4706, 736, 1121, 13, 2 ]
tccli/services/cam/__init__.py
hapsyou/tencentcloud-cli-intl-en
0
182253
# -*- coding: utf-8 -*- from tccli.services.cam.cam_client import register_arg from tccli.services.cam.cam_client import get_actions_info from tccli.services.cam.cam_client import AVAILABLE_VERSION_LIST
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 260, 617, 492, 29889, 9916, 29889, 11108, 29889, 11108, 29918, 4645, 1053, 6036, 29918, 1191, 13, 3166, 260, 617, 492, 29889, 9916, 29889, 11108, 29889, 11108, 29918, 4645, 1053, 679, 29918, 7387, 29918, 3888, 13, 3166, 260, 617, 492, 29889, 9916, 29889, 11108, 29889, 11108, 29918, 4645, 1053, 16884, 29909, 6227, 6181, 29918, 16358, 29918, 24360, 13, 2 ]
python lab 5 & 6/l5q3.py
gonewithharshwinds/itt-lab
1
34013
#!/usr/bin/python3 m1 = int(input("Enter no. of rows : \t")) n1 = int(input("Enter no. of columns : \t")) a = [] print("Enter Matrix 1:\n") for i in range(n1): row = list(map(int, input().split())) a.append(row) print(a) m2 = int(n1) print("\n Your Matrix 2 must have",n1,"rows and",m1,"columns \n") n2 = int(m1) b = [] for i in range(n2): row = list(map(int, input().split())) b.append(row) print(b) res = [] res = [ [ 0 for i in range(m2) ] for j in range(n1) ] for i in range(len(a)): for j in range(len(b[0])): for k in range(len(b)): res[i][j] += a[i][k] * b[k][j] print(res)
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 29941, 30004, 13, 29885, 29896, 353, 938, 29898, 2080, 703, 10399, 694, 29889, 310, 4206, 584, 320, 29873, 5783, 30004, 13, 29876, 29896, 353, 938, 29898, 2080, 703, 10399, 694, 29889, 310, 4341, 584, 320, 29873, 5783, 30004, 13, 29874, 353, 5159, 30004, 13, 2158, 703, 10399, 22513, 29871, 29896, 3583, 29876, 1159, 30004, 13, 1454, 474, 297, 3464, 29898, 29876, 29896, 1125, 30004, 13, 259, 1948, 353, 1051, 29898, 1958, 29898, 524, 29892, 1881, 2141, 5451, 22130, 30004, 13, 259, 263, 29889, 4397, 29898, 798, 8443, 13, 2158, 29898, 29874, 8443, 13, 29885, 29906, 353, 938, 29898, 29876, 29896, 8443, 13, 2158, 14182, 29876, 3575, 22513, 29871, 29906, 1818, 505, 613, 29876, 29896, 1699, 5727, 322, 613, 29885, 29896, 1699, 13099, 320, 29876, 1159, 30004, 13, 29876, 29906, 353, 938, 29898, 29885, 29896, 8443, 13, 29890, 353, 5159, 30004, 13, 1454, 474, 297, 3464, 29898, 29876, 29906, 1125, 30004, 13, 259, 1948, 353, 1051, 29898, 1958, 29898, 524, 29892, 1881, 2141, 5451, 22130, 30004, 13, 259, 289, 29889, 4397, 29898, 798, 8443, 13, 2158, 29898, 29890, 8443, 13, 690, 353, 5159, 30004, 13, 690, 353, 518, 518, 29871, 29900, 363, 474, 297, 3464, 29898, 29885, 29906, 29897, 4514, 363, 432, 297, 3464, 29898, 29876, 29896, 29897, 4514, 30004, 13, 1454, 474, 297, 3464, 29898, 2435, 29898, 29874, 22164, 30004, 13, 1678, 363, 432, 297, 3464, 29898, 2435, 29898, 29890, 29961, 29900, 12622, 29901, 30004, 13, 4706, 363, 413, 297, 3464, 29898, 2435, 29898, 29890, 22164, 30004, 13, 18884, 620, 29961, 29875, 3816, 29926, 29962, 4619, 263, 29961, 29875, 3816, 29895, 29962, 334, 289, 29961, 29895, 3816, 29926, 29962, 6756, 13, 2158, 29898, 690, 29897, 2 ]
main.py
OrionDark7/Alakajam12
0
1566
import pygame, math from game import map, ui window = pygame.display.set_mode([800, 600]) ui.window = window screen = "game" s = {"fullscreen": False} running = True gamedata = {"level": 0, "coal": 0, "iron": 1, "copper":0} tiles = pygame.sprite.Group() rails = pygame.sprite.Group() carts = pygame.sprite.Group() interactables = pygame.sprite.Group() listmap = [] clock = pygame.time.Clock() selected = pygame.image.load("./resources/images/selected.png") selected2 = pygame.image.load("./resources/images/selected2.png") box = pygame.image.load("./resources/images/box.png") uibox = pygame.image.load("./resources/images/ui box.png") class Mouse(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.__init__(self) self.image = pygame.surface.Surface([1, 1]) self.rect = self.image.get_rect() self.rect.topleft = [0, 0] self.clickedcart = None self.hoveritem = None self.tl = self.rect.topleft self.mode = "select" def pos(self, position): self.rect.topleft = position self.tl = self.rect.topleft m = Mouse() def snaptogrid(pos): return [int(math.floor(pos[0] / 40)), int(math.floor(pos[1] / 40))] def loadlevel(number): global tiles, rails, carts, gamedata, listmap, interactables tiles, rails, interactables, listmap = map.loadmap(int(number)) carts.empty() gamedata["level"] = number gamedata["coal"] = 0 gamedata["iron"] = 1 gamedata["copper"] = 0 loadlevel(0) while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.MOUSEBUTTONDOWN: m.pos(pygame.mouse.get_pos()) if screen == "game": if pygame.sprite.spritecollide(m, carts, False) and m.mode == "select": carts.update("select", m, listmap) if m.clickedcart != None: m.mode = "action" elif m.mode == "action" and m.clickedcart != None and listmap[snaptogrid(m.tl)[0]][snaptogrid(m.tl)[1]] > 0: m.clickedcart.pathfind(listmap, snaptogrid(m.tl)) m.clickedcart = None m.mode = "select" elif event.type == pygame.MOUSEMOTION: m.pos(pygame.mouse.get_pos()) if screen == "game": m.hoveritem = None if len(pygame.sprite.spritecollide(m, carts, False)) > 0: m.hoveritem = pygame.sprite.spritecollide(m, carts, False)[0] elif len(pygame.sprite.spritecollide(m, interactables, False)) > 0: m.hoveritem = pygame.sprite.spritecollide(m, interactables, False)[0] elif event.type == pygame.KEYDOWN: if event.key == pygame.K_SPACE: carts.add(map.Cart(snaptogrid(m.tl), "miner")) if screen == "game": window.fill([100, 100, 100]) tiles.draw(window) carts.draw(window) carts.update("update", m, listmap) if not m.hoveritem == None and not m.mode == "action": window.blit(box, [m.rect.left+10, m.rect.top+10]) ui.Resize(30) ui.Text(m.hoveritem.type.upper(), [m.rect.left+27, m.rect.top+25]) if m.hoveritem.type.startswith("mine") and m.hoveritem not in carts: ui.Resize(18) ui.Text("Carts Inside: " + str(m.hoveritem.data["carts"]), [m.rect.left+27, m.rect.top+47]) ui.Text("Max Carts: " + str(m.hoveritem.data["max"]), [m.rect.left+27, m.rect.top+60]) if not m.clickedcart == None: window.blit(selected2, [m.clickedcart.rect.left-2, m.clickedcart.rect.top-2]) if m.mode == "action": window.blit(box, [m.rect.left+10, m.rect.top+10]) ui.Resize(30) try: ui.Text(m.hoveritem.type.upper(), [m.rect.left+27, m.rect.top+25]) except: ui.Text(m.clickedcart.type.upper(), [m.rect.left+27, m.rect.top+25]) if listmap[snaptogrid(m.tl)[0]][snaptogrid(m.tl)[1]] > 0: ui.Resize(22) ui.Text("Click to move", [m.rect.left+27, m.rect.top+45]) ui.Text("Cart Here", [m.rect.left+27, m.rect.top+60]) window.blit(selected, [snaptogrid(m.tl)[0]*40-2, snaptogrid(m.tl)[1]*40-2]) window.blit(uibox, [555, 475]) pygame.display.flip() clock.tick(60) fps = clock.get_fps() pygame.quit()
[ 1, 1053, 22028, 29892, 5844, 13, 3166, 3748, 1053, 2910, 29892, 14313, 13, 13, 7165, 353, 22028, 29889, 4990, 29889, 842, 29918, 8513, 4197, 29947, 29900, 29900, 29892, 29871, 29953, 29900, 29900, 2314, 13, 1481, 29889, 7165, 353, 3474, 13, 10525, 353, 376, 11802, 29908, 13, 29879, 353, 8853, 8159, 10525, 1115, 7700, 29913, 13, 21094, 353, 5852, 13, 29887, 2795, 532, 353, 8853, 5563, 1115, 29871, 29900, 29892, 376, 1111, 284, 1115, 29871, 29900, 29892, 376, 381, 265, 1115, 29871, 29896, 29892, 376, 1111, 2496, 1115, 29900, 29913, 13, 1376, 267, 353, 22028, 29889, 15099, 568, 29889, 4782, 580, 13, 9912, 353, 22028, 29889, 15099, 568, 29889, 4782, 580, 13, 29883, 5708, 353, 22028, 29889, 15099, 568, 29889, 4782, 580, 13, 1639, 627, 1849, 353, 22028, 29889, 15099, 568, 29889, 4782, 580, 13, 1761, 1958, 353, 5159, 13, 13058, 353, 22028, 29889, 2230, 29889, 29907, 908, 580, 13, 8391, 353, 22028, 29889, 3027, 29889, 1359, 703, 6904, 13237, 29914, 8346, 29914, 8391, 29889, 2732, 1159, 13, 8391, 29906, 353, 22028, 29889, 3027, 29889, 1359, 703, 6904, 13237, 29914, 8346, 29914, 8391, 29906, 29889, 2732, 1159, 13, 1884, 353, 22028, 29889, 3027, 29889, 1359, 703, 6904, 13237, 29914, 8346, 29914, 1884, 29889, 2732, 1159, 13, 29884, 747, 2251, 353, 22028, 29889, 3027, 29889, 1359, 703, 6904, 13237, 29914, 8346, 29914, 1481, 3800, 29889, 2732, 1159, 13, 13, 1990, 25992, 29898, 2272, 11802, 29889, 15099, 568, 29889, 29903, 558, 568, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 22028, 29889, 15099, 568, 29889, 29903, 558, 568, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 3027, 353, 22028, 29889, 7610, 2161, 29889, 18498, 2161, 4197, 29896, 29892, 29871, 29896, 2314, 13, 4706, 1583, 29889, 1621, 353, 1583, 29889, 3027, 29889, 657, 29918, 1621, 580, 13, 4706, 1583, 29889, 1621, 29889, 3332, 1563, 353, 518, 29900, 29892, 29871, 29900, 29962, 13, 4706, 1583, 29889, 3808, 287, 13823, 353, 6213, 13, 4706, 1583, 29889, 13194, 667, 353, 6213, 13, 4706, 1583, 29889, 15206, 353, 1583, 29889, 1621, 29889, 3332, 1563, 13, 4706, 1583, 29889, 8513, 353, 376, 2622, 29908, 13, 13, 1678, 822, 926, 29898, 1311, 29892, 2602, 1125, 13, 4706, 1583, 29889, 1621, 29889, 3332, 1563, 353, 2602, 13, 4706, 1583, 29889, 15206, 353, 1583, 29889, 1621, 29889, 3332, 1563, 13, 13, 13, 29885, 353, 25992, 580, 13, 13, 13, 1753, 269, 1056, 415, 468, 2429, 29898, 1066, 1125, 13, 1678, 736, 518, 524, 29898, 755, 29889, 14939, 29898, 1066, 29961, 29900, 29962, 847, 29871, 29946, 29900, 8243, 938, 29898, 755, 29889, 14939, 29898, 1066, 29961, 29896, 29962, 847, 29871, 29946, 29900, 28166, 13, 13, 13, 1753, 2254, 5563, 29898, 4537, 1125, 13, 1678, 5534, 260, 5475, 29892, 18090, 29892, 274, 5708, 29892, 330, 2795, 532, 29892, 1051, 1958, 29892, 16254, 1849, 13, 1678, 260, 5475, 29892, 18090, 29892, 16254, 1849, 29892, 1051, 1958, 353, 2910, 29889, 1359, 1958, 29898, 524, 29898, 4537, 876, 13, 1678, 274, 5708, 29889, 6310, 580, 13, 1678, 330, 2795, 532, 3366, 5563, 3108, 353, 1353, 13, 1678, 330, 2795, 532, 3366, 1111, 284, 3108, 353, 29871, 29900, 13, 1678, 330, 2795, 532, 3366, 381, 265, 3108, 353, 29871, 29896, 13, 1678, 330, 2795, 532, 3366, 1111, 2496, 3108, 353, 29871, 29900, 13, 13, 1359, 5563, 29898, 29900, 29897, 13, 13, 8000, 2734, 29901, 13, 1678, 363, 1741, 297, 22028, 29889, 3696, 29889, 657, 7295, 13, 4706, 565, 1741, 29889, 1853, 1275, 22028, 29889, 13356, 1806, 29901, 13, 9651, 2734, 353, 7700, 13, 4706, 25342, 1741, 29889, 1853, 1275, 22028, 29889, 6720, 17171, 29933, 2692, 29911, 1164, 3970, 16048, 29901, 13, 9651, 286, 29889, 1066, 29898, 2272, 11802, 29889, 15769, 29889, 657, 29918, 1066, 3101, 13, 9651, 565, 4315, 1275, 376, 11802, 1115, 13, 18884, 565, 22028, 29889, 15099, 568, 29889, 15099, 568, 1054, 7459, 29898, 29885, 29892, 274, 5708, 29892, 7700, 29897, 322, 286, 29889, 8513, 1275, 376, 2622, 1115, 13, 462, 1678, 274, 5708, 29889, 5504, 703, 2622, 613, 286, 29892, 1051, 1958, 29897, 13, 462, 1678, 565, 286, 29889, 3808, 287, 13823, 2804, 6213, 29901, 13, 462, 4706, 286, 29889, 8513, 353, 376, 2467, 29908, 13, 18884, 25342, 286, 29889, 8513, 1275, 376, 2467, 29908, 322, 286, 29889, 3808, 287, 13823, 2804, 6213, 322, 1051, 1958, 29961, 29879, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 9601, 29900, 29962, 3816, 29879, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 9601, 29896, 5262, 1405, 29871, 29900, 29901, 13, 462, 1678, 286, 29889, 3808, 287, 13823, 29889, 2084, 2886, 29898, 1761, 1958, 29892, 269, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 876, 13, 462, 1678, 286, 29889, 3808, 287, 13823, 353, 6213, 13, 462, 1678, 286, 29889, 8513, 353, 376, 2622, 29908, 13, 4706, 25342, 1741, 29889, 1853, 1275, 22028, 29889, 6720, 17171, 29924, 2891, 2725, 29901, 13, 9651, 286, 29889, 1066, 29898, 2272, 11802, 29889, 15769, 29889, 657, 29918, 1066, 3101, 13, 9651, 565, 4315, 1275, 376, 11802, 1115, 13, 18884, 286, 29889, 13194, 667, 353, 6213, 13, 18884, 565, 7431, 29898, 2272, 11802, 29889, 15099, 568, 29889, 15099, 568, 1054, 7459, 29898, 29885, 29892, 274, 5708, 29892, 7700, 876, 1405, 29871, 29900, 29901, 13, 462, 1678, 286, 29889, 13194, 667, 353, 22028, 29889, 15099, 568, 29889, 15099, 568, 1054, 7459, 29898, 29885, 29892, 274, 5708, 29892, 7700, 9601, 29900, 29962, 13, 18884, 25342, 7431, 29898, 2272, 11802, 29889, 15099, 568, 29889, 15099, 568, 1054, 7459, 29898, 29885, 29892, 16254, 1849, 29892, 7700, 876, 1405, 29871, 29900, 29901, 13, 462, 1678, 286, 29889, 13194, 667, 353, 22028, 29889, 15099, 568, 29889, 15099, 568, 1054, 7459, 29898, 29885, 29892, 16254, 1849, 29892, 7700, 9601, 29900, 29962, 13, 4706, 25342, 1741, 29889, 1853, 1275, 22028, 29889, 10818, 3970, 16048, 29901, 13, 9651, 565, 1741, 29889, 1989, 1275, 22028, 29889, 29968, 29918, 5550, 11538, 29901, 13, 18884, 274, 5708, 29889, 1202, 29898, 1958, 29889, 25233, 29898, 29879, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 511, 376, 1195, 261, 5783, 13, 1678, 565, 4315, 1275, 376, 11802, 1115, 13, 4706, 3474, 29889, 5589, 4197, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 2314, 13, 4706, 260, 5475, 29889, 4012, 29898, 7165, 29897, 13, 4706, 274, 5708, 29889, 4012, 29898, 7165, 29897, 13, 4706, 274, 5708, 29889, 5504, 703, 5504, 613, 286, 29892, 1051, 1958, 29897, 13, 4706, 565, 451, 286, 29889, 13194, 667, 1275, 6213, 322, 451, 286, 29889, 8513, 1275, 376, 2467, 1115, 13, 9651, 3474, 29889, 2204, 277, 29898, 1884, 29892, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29896, 29900, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29896, 29900, 2314, 13, 9651, 14313, 29889, 1666, 675, 29898, 29941, 29900, 29897, 13, 9651, 14313, 29889, 1626, 29898, 29885, 29889, 13194, 667, 29889, 1853, 29889, 21064, 3285, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29906, 29955, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29906, 29945, 2314, 13, 9651, 565, 286, 29889, 13194, 667, 29889, 1853, 29889, 27382, 2541, 703, 24669, 1159, 322, 286, 29889, 13194, 667, 451, 297, 274, 5708, 29901, 13, 18884, 14313, 29889, 1666, 675, 29898, 29896, 29947, 29897, 13, 18884, 14313, 29889, 1626, 703, 29907, 5708, 22804, 29901, 376, 718, 851, 29898, 29885, 29889, 13194, 667, 29889, 1272, 3366, 29883, 5708, 3108, 511, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29906, 29955, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29946, 29955, 2314, 13, 18884, 14313, 29889, 1626, 703, 7976, 315, 5708, 29901, 376, 718, 851, 29898, 29885, 29889, 13194, 667, 29889, 1272, 3366, 3317, 3108, 511, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29906, 29955, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29953, 29900, 2314, 13, 4706, 565, 451, 286, 29889, 3808, 287, 13823, 1275, 6213, 29901, 13, 9651, 3474, 29889, 2204, 277, 29898, 8391, 29906, 29892, 518, 29885, 29889, 3808, 287, 13823, 29889, 1621, 29889, 1563, 29899, 29906, 29892, 286, 29889, 3808, 287, 13823, 29889, 1621, 29889, 3332, 29899, 29906, 2314, 13, 9651, 565, 286, 29889, 8513, 1275, 376, 2467, 1115, 13, 18884, 3474, 29889, 2204, 277, 29898, 1884, 29892, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29896, 29900, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29896, 29900, 2314, 13, 18884, 14313, 29889, 1666, 675, 29898, 29941, 29900, 29897, 13, 18884, 1018, 29901, 13, 462, 1678, 14313, 29889, 1626, 29898, 29885, 29889, 13194, 667, 29889, 1853, 29889, 21064, 3285, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29906, 29955, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29906, 29945, 2314, 13, 18884, 5174, 29901, 13, 462, 1678, 14313, 29889, 1626, 29898, 29885, 29889, 3808, 287, 13823, 29889, 1853, 29889, 21064, 3285, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29906, 29955, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29906, 29945, 2314, 13, 18884, 565, 1051, 1958, 29961, 29879, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 9601, 29900, 29962, 3816, 29879, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 9601, 29896, 5262, 1405, 29871, 29900, 29901, 13, 462, 1678, 14313, 29889, 1666, 675, 29898, 29906, 29906, 29897, 13, 462, 1678, 14313, 29889, 1626, 703, 4164, 304, 4337, 613, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29906, 29955, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29946, 29945, 2314, 13, 462, 1678, 14313, 29889, 1626, 703, 25233, 2266, 613, 518, 29885, 29889, 1621, 29889, 1563, 29974, 29906, 29955, 29892, 286, 29889, 1621, 29889, 3332, 29974, 29953, 29900, 2314, 13, 4706, 3474, 29889, 2204, 277, 29898, 8391, 29892, 518, 29879, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 9601, 29900, 14178, 29946, 29900, 29899, 29906, 29892, 269, 1056, 415, 468, 2429, 29898, 29885, 29889, 15206, 9601, 29896, 14178, 29946, 29900, 29899, 29906, 2314, 13, 4706, 3474, 29889, 2204, 277, 29898, 29884, 747, 2251, 29892, 518, 29945, 29945, 29945, 29892, 29871, 29946, 29955, 29945, 2314, 13, 1678, 22028, 29889, 4990, 29889, 29888, 3466, 580, 13, 1678, 12006, 29889, 24667, 29898, 29953, 29900, 29897, 13, 1678, 285, 567, 353, 12006, 29889, 657, 29918, 29888, 567, 580, 13, 2272, 11802, 29889, 28358, 580, 13, 2 ]
textrank.py
ptarau/PyDS
2
150654
<filename>textrank.py # ranking a document for most important sentences import nltk import networkx as nx import heapq # nouns,verbs,adjectives def good_word(wt) : w,t=wt return t[0] in "NJV" and w.lower() not in stopwords # words not worth using for retrivieng content stopwords= {'am', 'are', 'be', 'been', 'being', 'did', 'do', 'does', 'doing', 'don', 'few', 'had', 'has', 'have', 'having', 'hers', 'i', 'is', 'may', 'might', 'most', 'other', 'others', 'our', 'ourselves', 'own', 's', 'same', 'such', 'their', 'theirs', 'was', 'were', 'would', 'your', 'yours', 'yourselves'} # from a file to sentences, tokens and words def digest(doc) : text=[] with open(doc,'r') as f : for line in f.readlines() : line=line.replace('\n',' ') text.append(line) #? text="".join(text) sents=nltk.sent_tokenize(text) wss=map(nltk.word_tokenize,sents) goodWordsSets=[] for ws in wss : ts=set(w.lower() for (w,t) in nltk.pos_tag(ws) if good_word((w,t))) goodWordsSets.append(ts) return goodWordsSets,sents # heuristics for adding edges: bi-directional links def add_weighted_edge(g,i,j,wss) : ws,us = wss[i],wss[j] shared = ws.intersection(us) l = len(shared) r = len(ws) + len(us) - l if l > 0: g.add_edge(i, j, weight=l/r) g.add_edge(j, i, weight=l/r) # build graph connecting sentences with shared words def build_intersection_graph(wss) : g=nx.DiGraph() m=len(wss) for i in range(m) : for j in range(0,m) : #? add_weighted_edge(g, i, j, wss) return g # highest ranked k sentences def best_sents(g,k) : d=nx.pagerank(g) ranked=[] for (w,r) in d.items() : heapq.heappush(ranked,(1-r,w)) for _ in range(k) : (r,i) = heapq.heappop(ranked) yield i # build graph connecting words that occur in the same sentence def build_co_occurence_graph(wss) : g=nx.DiGraph() for ws in wss : for w1 in ws : for w2 in ws : if w1 != w2 : g.add_edge(w1,w2) return g # keywords, highest ranked first def extract_keywords(wss,k) : g=build_co_occurence_graph(wss) d=nx.pagerank(g) by_rank = [(r,w) for (w,r) in d.items()] by_rank.sort() sorted=by_rank.reverse() for _,w in by_rank: if k>0 : yield w k-=1 # summary and keyword extractor def summary_and_keywords(name='us_constitution.txt',s_count=6,w_count=6) : wss,sents=digest(name) g=build_intersection_graph(wss) summary=[(i,sents[i]) for i in sorted(best_sents(g,s_count))] keywords=[w for w in extract_keywords(wss,w_count)] return (summary,keywords) def go() : summary,keywords=summary_and_keywords() print('SUMMARY:') for s in summary: print(s) print('') print('KEYWORDS:',keywords) go()
[ 1, 529, 9507, 29958, 726, 10003, 29889, 2272, 13, 29937, 24034, 263, 1842, 363, 1556, 4100, 25260, 13, 5215, 302, 1896, 29895, 13, 5215, 3564, 29916, 408, 302, 29916, 13, 5215, 16947, 29939, 13, 13, 29937, 302, 1309, 29879, 29892, 369, 5824, 29892, 328, 622, 3145, 13, 1753, 1781, 29918, 1742, 29898, 14554, 29897, 584, 13, 29871, 281, 29892, 29873, 29922, 14554, 13, 29871, 736, 260, 29961, 29900, 29962, 297, 376, 29940, 29967, 29963, 29908, 29871, 322, 281, 29889, 13609, 580, 451, 297, 5040, 9303, 13, 13, 29937, 3838, 451, 7088, 773, 363, 3240, 1150, 819, 29887, 2793, 13, 9847, 9303, 29922, 11117, 314, 742, 525, 598, 742, 525, 915, 742, 525, 915, 264, 742, 525, 915, 292, 742, 525, 18361, 742, 525, 1867, 742, 525, 13221, 742, 525, 1867, 292, 742, 13, 632, 525, 9176, 742, 525, 29888, 809, 742, 525, 21312, 742, 525, 5349, 742, 525, 17532, 742, 525, 29882, 5555, 742, 525, 29882, 414, 742, 525, 29875, 742, 525, 275, 742, 13, 632, 525, 13029, 742, 525, 29885, 523, 742, 525, 3242, 742, 525, 1228, 742, 525, 720, 414, 742, 525, 473, 742, 525, 2470, 295, 1960, 742, 13, 9651, 525, 776, 742, 525, 29879, 742, 525, 17642, 742, 525, 14565, 742, 13, 632, 525, 1552, 381, 742, 525, 1552, 12935, 742, 525, 11102, 742, 525, 29893, 406, 742, 525, 29893, 483, 742, 525, 8066, 742, 13, 9651, 525, 29891, 2470, 742, 525, 29891, 2470, 295, 1960, 10827, 13, 13, 29937, 515, 263, 934, 304, 25260, 29892, 18897, 322, 3838, 13, 1753, 4697, 342, 29898, 1514, 29897, 584, 13, 29871, 1426, 29922, 2636, 13, 29871, 411, 1722, 29898, 1514, 5501, 29878, 1495, 408, 285, 584, 13, 1678, 363, 1196, 297, 285, 29889, 949, 9012, 580, 584, 13, 418, 1196, 29922, 1220, 29889, 6506, 28909, 29876, 3788, 25710, 13, 418, 1426, 29889, 4397, 29898, 1220, 29897, 396, 29973, 13, 29871, 1426, 543, 1642, 7122, 29898, 726, 29897, 13, 29871, 269, 1237, 29922, 29876, 1896, 29895, 29889, 18616, 29918, 6979, 675, 29898, 726, 29897, 13, 29871, 281, 893, 29922, 1958, 29898, 29876, 1896, 29895, 29889, 1742, 29918, 6979, 675, 29892, 29879, 1237, 29897, 13, 29871, 1781, 29956, 4339, 29903, 1691, 29922, 2636, 13, 29871, 363, 16904, 297, 281, 893, 584, 13, 1678, 18696, 29922, 842, 29898, 29893, 29889, 13609, 580, 363, 313, 29893, 29892, 29873, 29897, 297, 302, 1896, 29895, 29889, 1066, 29918, 4039, 29898, 5652, 29897, 565, 1781, 29918, 1742, 3552, 29893, 29892, 29873, 4961, 13, 1678, 1781, 29956, 4339, 29903, 1691, 29889, 4397, 29898, 1372, 29897, 13, 29871, 736, 1781, 29956, 4339, 29903, 1691, 29892, 29879, 1237, 13, 13, 29937, 540, 332, 6765, 363, 4417, 12770, 29901, 4768, 29899, 20845, 284, 2988, 13, 1753, 788, 29918, 7915, 287, 29918, 12864, 29898, 29887, 29892, 29875, 29892, 29926, 29892, 29893, 893, 29897, 584, 13, 29871, 16904, 29892, 375, 353, 281, 893, 29961, 29875, 1402, 29893, 893, 29961, 29926, 29962, 13, 29871, 7258, 353, 16904, 29889, 1639, 2042, 29898, 375, 29897, 13, 29871, 301, 353, 7431, 29898, 12366, 29897, 13, 29871, 364, 353, 7431, 29898, 5652, 29897, 718, 7431, 29898, 375, 29897, 448, 301, 13, 29871, 565, 301, 1405, 29871, 29900, 29901, 13, 1678, 330, 29889, 1202, 29918, 12864, 29898, 29875, 29892, 432, 29892, 7688, 29922, 29880, 29914, 29878, 29897, 13, 1678, 330, 29889, 1202, 29918, 12864, 29898, 29926, 29892, 474, 29892, 7688, 29922, 29880, 29914, 29878, 29897, 13, 268, 13, 29937, 2048, 3983, 16791, 25260, 411, 7258, 3838, 13, 1753, 2048, 29918, 1639, 2042, 29918, 4262, 29898, 29893, 893, 29897, 584, 13, 29871, 330, 29922, 23818, 29889, 12130, 9527, 580, 13, 29871, 286, 29922, 2435, 29898, 29893, 893, 29897, 13, 29871, 363, 474, 297, 3464, 29898, 29885, 29897, 584, 13, 1678, 363, 432, 297, 3464, 29898, 29900, 29892, 29885, 29897, 584, 396, 29973, 13, 418, 788, 29918, 7915, 287, 29918, 12864, 29898, 29887, 29892, 474, 29892, 432, 29892, 281, 893, 29897, 13, 29871, 736, 330, 13, 13, 29937, 9939, 26642, 413, 25260, 13, 1753, 1900, 29918, 29879, 1237, 29898, 29887, 29892, 29895, 29897, 584, 13, 29871, 270, 29922, 23818, 29889, 29886, 1875, 804, 29898, 29887, 29897, 13, 29871, 26642, 29922, 2636, 13, 29871, 363, 313, 29893, 29892, 29878, 29897, 297, 270, 29889, 7076, 580, 584, 13, 1678, 16947, 29939, 29889, 354, 932, 1878, 29898, 10003, 287, 22657, 29896, 29899, 29878, 29892, 29893, 876, 13, 29871, 363, 903, 297, 3464, 29898, 29895, 29897, 584, 13, 1678, 313, 29878, 29892, 29875, 29897, 353, 16947, 29939, 29889, 354, 932, 459, 29898, 10003, 287, 29897, 13, 1678, 7709, 474, 13, 13, 29937, 2048, 3983, 16791, 3838, 393, 6403, 297, 278, 1021, 10541, 13, 1753, 2048, 29918, 1111, 29918, 542, 2764, 663, 29918, 4262, 29898, 29893, 893, 29897, 584, 13, 29871, 330, 29922, 23818, 29889, 12130, 9527, 580, 13, 29871, 363, 16904, 297, 281, 893, 584, 13, 1678, 363, 281, 29896, 297, 16904, 584, 13, 418, 363, 281, 29906, 297, 16904, 584, 13, 4706, 565, 281, 29896, 2804, 281, 29906, 584, 13, 3986, 330, 29889, 1202, 29918, 12864, 29898, 29893, 29896, 29892, 29893, 29906, 29897, 13, 29871, 736, 330, 13, 13, 29937, 29361, 29892, 9939, 26642, 937, 13, 1753, 6597, 29918, 1989, 9303, 29898, 29893, 893, 29892, 29895, 29897, 584, 13, 29871, 330, 29922, 4282, 29918, 1111, 29918, 542, 2764, 663, 29918, 4262, 29898, 29893, 893, 29897, 13, 29871, 270, 29922, 23818, 29889, 29886, 1875, 804, 29898, 29887, 29897, 13, 29871, 491, 29918, 10003, 353, 17288, 29878, 29892, 29893, 29897, 363, 313, 29893, 29892, 29878, 29897, 297, 270, 29889, 7076, 580, 29962, 13, 29871, 491, 29918, 10003, 29889, 6605, 580, 13, 29871, 12705, 29922, 1609, 29918, 10003, 29889, 24244, 580, 13, 29871, 363, 17117, 29893, 297, 491, 29918, 10003, 29901, 13, 1678, 565, 413, 29958, 29900, 584, 7709, 281, 13, 1678, 413, 29899, 29922, 29896, 13, 13, 29937, 15837, 322, 13553, 6597, 272, 13, 1753, 15837, 29918, 392, 29918, 1989, 9303, 29898, 978, 2433, 375, 29918, 3075, 5008, 29889, 3945, 742, 29879, 29918, 2798, 29922, 29953, 29892, 29893, 29918, 2798, 29922, 29953, 29897, 584, 13, 29871, 281, 893, 29892, 29879, 1237, 29922, 7501, 342, 29898, 978, 29897, 13, 29871, 330, 29922, 4282, 29918, 1639, 2042, 29918, 4262, 29898, 29893, 893, 29897, 13, 29871, 15837, 11759, 29898, 29875, 29892, 29879, 1237, 29961, 29875, 2314, 363, 474, 297, 12705, 29898, 13318, 29918, 29879, 1237, 29898, 29887, 29892, 29879, 29918, 2798, 28166, 13, 29871, 29361, 11759, 29893, 363, 281, 297, 6597, 29918, 1989, 9303, 29898, 29893, 893, 29892, 29893, 29918, 2798, 4638, 13, 29871, 736, 313, 7727, 29892, 1989, 9303, 29897, 13, 13, 1753, 748, 580, 584, 13, 29871, 15837, 29892, 1989, 9303, 29922, 7727, 29918, 392, 29918, 1989, 9303, 580, 13, 29871, 1596, 877, 25021, 1529, 13207, 29901, 1495, 13, 29871, 363, 269, 297, 15837, 29901, 1596, 29898, 29879, 29897, 13, 29871, 1596, 877, 1495, 13, 29871, 1596, 877, 10818, 11686, 8452, 29901, 742, 1989, 9303, 29897, 13, 13, 1484, 580, 13, 2 ]
methods/POST.py
WebisD/http-api-without-lib
2
138259
import datetime from databaseUser.HandlerDatabase import HandlerDatabase from databaseUser.ObjectUser import UserObj from handler.HandlerErrors import HandlerErrors from message.Response import Response from message.StatusCode import StatusCode import json class POST: @staticmethod def response(request) -> str: """ Performs an insertion when there is a POST request, returning a response with the headers and the correct body. Adds the received object within the database. :param request: Request object, containing the body and headers of that request :returns: The answer to this request """ try: data = json.loads(request.body) if data["name"] != "" and data["phone"] != "" and data["pokemon"] != "" and data["image"] != "" and data["image"] != "http://localhost:8083/post": obj = UserObj.fromDict(data) obj.setId(datetime.datetime.now().strftime("%d%m%Y%H%M%S")) status = HandlerDatabase.insertPokemon(obj) header = { "Connection": "Closed" } if(int(status.value[0]) >= 400): return HandlerErrors.sendErrorCode(request, status) response = Response(status_code=status, body=status.value[1], header=header) print("POST::response called " + request.URI + " -> " + status.value[1]) return response.encodeResponse() else: raise TypeError("Invalid data") except Exception as e: print(e) print("POST::response called " + request.URI + " -> BAD_REQUEST") return HandlerErrors.sendErrorCode(request, StatusCode.BAD_REQUEST)
[ 1, 1053, 12865, 13, 3166, 2566, 2659, 29889, 4598, 9112, 1053, 5166, 1358, 9112, 13, 3166, 2566, 2659, 29889, 2061, 2659, 1053, 4911, 9930, 13, 3166, 7834, 29889, 4598, 22463, 1053, 5166, 1358, 22463, 13, 3166, 2643, 29889, 5103, 1053, 13291, 13, 3166, 2643, 29889, 5709, 3399, 1053, 16034, 3399, 13, 5215, 4390, 13, 13, 1990, 11971, 29901, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2933, 29898, 3827, 29897, 1599, 851, 29901, 13, 4706, 9995, 2431, 9514, 385, 4635, 291, 746, 727, 338, 263, 11971, 2009, 29892, 7863, 263, 2933, 411, 13, 4706, 278, 9066, 322, 278, 1959, 3573, 29889, 3462, 29879, 278, 4520, 1203, 2629, 278, 2566, 29889, 13, 13, 4706, 584, 3207, 2009, 29901, 10729, 1203, 29892, 6943, 278, 3573, 322, 9066, 310, 393, 2009, 13, 4706, 584, 18280, 29901, 450, 1234, 304, 445, 2009, 13, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 848, 353, 4390, 29889, 18132, 29898, 3827, 29889, 2587, 29897, 13, 9651, 565, 848, 3366, 978, 3108, 2804, 5124, 322, 848, 3366, 6710, 3108, 2804, 5124, 322, 848, 3366, 29886, 554, 9857, 3108, 2804, 5124, 322, 848, 3366, 3027, 3108, 2804, 5124, 322, 848, 3366, 3027, 3108, 2804, 376, 1124, 597, 7640, 29901, 29947, 29900, 29947, 29941, 29914, 2490, 1115, 13, 18884, 5446, 353, 4911, 9930, 29889, 3166, 21533, 29898, 1272, 29897, 13, 13, 18884, 5446, 29889, 842, 1204, 29898, 12673, 29889, 12673, 29889, 3707, 2141, 710, 615, 603, 11702, 29881, 29995, 29885, 29995, 29979, 29995, 29950, 29995, 29924, 29995, 29903, 5783, 13, 13, 18884, 4660, 353, 5166, 1358, 9112, 29889, 7851, 29925, 554, 9857, 29898, 5415, 29897, 13, 18884, 4839, 353, 426, 13, 462, 1678, 376, 5350, 1115, 376, 6821, 2662, 29908, 13, 18884, 500, 13, 18884, 565, 29898, 524, 29898, 4882, 29889, 1767, 29961, 29900, 2314, 6736, 29871, 29946, 29900, 29900, 1125, 13, 462, 1678, 736, 5166, 1358, 22463, 29889, 6717, 2392, 3399, 29898, 3827, 29892, 4660, 29897, 13, 13, 18884, 2933, 353, 13291, 29898, 4882, 29918, 401, 29922, 4882, 29892, 3573, 29922, 4882, 29889, 1767, 29961, 29896, 1402, 4839, 29922, 6672, 29897, 13, 18884, 1596, 703, 5438, 1057, 5327, 2000, 376, 718, 2009, 29889, 15551, 718, 376, 1599, 376, 718, 4660, 29889, 1767, 29961, 29896, 2314, 13, 13, 18884, 736, 2933, 29889, 12508, 5103, 580, 13, 9651, 1683, 29901, 13, 18884, 12020, 20948, 703, 13919, 848, 1159, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 29898, 29872, 29897, 13, 9651, 1596, 703, 5438, 1057, 5327, 2000, 376, 718, 2009, 29889, 15551, 718, 29871, 376, 1599, 350, 3035, 29918, 16244, 1159, 13, 9651, 736, 5166, 1358, 22463, 29889, 6717, 2392, 3399, 29898, 3827, 29892, 16034, 3399, 29889, 29933, 3035, 29918, 16244, 29897, 13, 2 ]
bot.py
mmonkey/covid-vaccine-slack-bot
9
174991
<reponame>mmonkey/covid-vaccine-slack-bot import json import os import pytz import requests from apscheduler.schedulers.blocking import BlockingScheduler from datetime import datetime from dotenv import load_dotenv from geopy import distance from slack_sdk import WebClient from slack_sdk.errors import SlackApiError from timezonefinder import TimezoneFinder # Globals configs = [] message = '' timezoneFinder = TimezoneFinder() hyvee_locations = [] hyvee_availability = {} newly_available_hyvee_appointments = [] spotter_cache = {} spotter_locations = [] spotter_availability = {} newly_available_spotter_appointments = [] # Load config files = [file for file in os.listdir('config/') if file.endswith('.json')] for file in files: with open(f'config/{file}') as f: configs.append(json.load(f)) print(f'config file loaded: {file}') # Hy-Vee Pharmacies def get_hyvee_vaccine_availability(latitude, longitude, radius): global hyvee_locations url = 'https://www.hy-vee.com/my-pharmacy/api/graphql' query = ''' query SearchPharmaciesNearPointWithCovidVaccineAvailability($latitude: Float!, $longitude: Float!, $radius: Int! = 10) { searchPharmaciesNearPoint(latitude: $latitude, longitude: $longitude, radius: $radius) { distance location { locationId name nickname phoneNumber businessCode isCovidVaccineAvailable covidVaccineEligibilityTerms address { line1 line2 city state zip latitude longitude __typename } __typename } __typename } } ''' response = requests.post(url, json={ 'query': query, 'variables': { 'latitude': latitude, 'longitude': longitude, 'radius': radius, } }) if response.status_code == 200: json_data = json.loads(response.text) hyvee_locations = list(map(lambda location: location['location'], json_data['data']['searchPharmaciesNearPoint'])) else: print(f'Error getting vaccine availability: {response.text}') hyvee_locations = [] def get_newly_available_hyvee_locations(is_test=False): global hyvee_locations, hyvee_availability, newly_available_hyvee_appointments newly_available_hyvee_appointments = [] for location in hyvee_locations: prev_avail = hyvee_availability[location['locationId']] if location['locationId'] in hyvee_availability else False if location['isCovidVaccineAvailable'] and not prev_avail: newly_available_hyvee_appointments.append(location) if not len(newly_available_hyvee_appointments) and is_test and not prev_avail: newly_available_hyvee_appointments.append(location) hyvee_availability[location['locationId']] = location['isCovidVaccineAvailable'] # Other Pharmacies - vaccinespotter.org API def get_spotter_api_vaccine_availability(latitude, longitude, radius, states): global spotter_cache, spotter_locations locations = [] for state in states: if state not in spotter_cache: response = requests.get(f'https://www.vaccinespotter.org/api/v0/states/{state}.json') if response.status_code == 200: json_data = json.loads(response.text) spotter_cache[state] = list( filter(lambda loc: loc['properties']['provider'] != 'hyvee', json_data['features']) ) else: spotter_cache[state] = [] locations.extend(spotter_cache[state]) spotter_locations = [] search_coordinates = (latitude, longitude) for location in locations: location_coordinates = (location['geometry']['coordinates'][1], location['geometry']['coordinates'][0]) if distance.distance(search_coordinates, location_coordinates).miles <= radius: spotter_locations.append(location) def get_newly_available_spotter_locations(is_test=False): global spotter_locations, spotter_availability, newly_available_spotter_appointments newly_available_spotter_appointments = [] for location in spotter_locations: prev_avail = spotter_availability[location['properties']['id']] if location['properties']['id'] in spotter_availability else False if location['properties']['appointments_available'] and not prev_avail: newly_available_spotter_appointments.append(location) if not len(newly_available_spotter_appointments) and is_test and not prev_avail: newly_available_spotter_appointments.append(location) spotter_availability[location['properties']['id']] = location['properties']['appointments_available'] # Message blocks def header_block(): global message message = ':alert: <!here> *Vaccines Available* :alert:' return { 'type': 'section', 'text': { 'type': 'mrkdwn', 'text': ':alert: <!here> *Vaccines Available* :alert:\n\nThe following locations have COVID-19 vaccination appointments :covid-19: :syringe: available now!' } } def location_hyvee_block(location): global message name = location['nickname'] if location['nickname'] else location['name'] address = location['address']['line1'] city = location['address']['city'] state = location['address']['state'] zipcode = location['address']['zip'] message += f'\n\n*{name}*\n{address}\n{city}, {state} {zipcode}' return { 'type': 'section', 'text': { 'type': 'mrkdwn', 'text': f'*{name}*\n{address}\n{city}, {state} {zipcode}' } } def location_spotter_block(location): global message if location['properties']['provider'] == 'cvs': city = location['properties']['city'] state = location['properties']['state'] text = f'*CVS*\n{city}, {state}' else: name = '{name} {provider}'.format( name=location['properties']['name'], provider=location['properties']['provider_brand_name'] ) address = location['properties']['address'] city = location['properties']['city'] state = location['properties']['state'] zipcode = location['properties']['postal_code'] text = f'*{name}*\n{address}\n{city}, {state} {zipcode}' message += f'\n\n{text}' return { 'type': 'section', 'text': { 'type': 'mrkdwn', 'text': text } } def url_block(url): global message message += f'\n{url}' return { 'type': 'actions', 'elements': [ { 'type': 'button', 'text': { 'type': 'plain_text', 'emoji': True, 'text': 'Register Now' }, 'style': 'primary', 'url': url } ] } def divider_block(): return { 'type': 'divider' } def footer_block(latitude, longitude): global message, timezoneFinder timezone = timezoneFinder.timezone_at(lng=longitude, lat=latitude) tz = pytz.timezone(timezone) dt = datetime.now(tz) timestamp = dt.strftime('%b %d, %Y at %I:%M:%S %p %Z') message += f'\n\n_Posted {timestamp}_' return { 'type': 'section', 'text': { 'type': 'mrkdwn', 'text': f'_Posted {timestamp}_' } } # Main def check_for_vaccine_availability(): global configs, message, spotter_cache, newly_available_hyvee_appointments, newly_available_spotter_appointments # clear the spotter cache spotter_cache = {} for config in configs: enabled = config['enabled'] if 'enabled' in config else True if enabled: if config['latitude'] and config['longitude'] and config['radius']: is_test = config['test'] if 'test' in config else False get_hyvee_vaccine_availability(config['latitude'], config['longitude'], config['radius']) get_newly_available_hyvee_locations(is_test) # clear the spotter cache states = config['states'] if 'states' in config else ['NE'] get_spotter_api_vaccine_availability( config['latitude'], config['longitude'], config['radius'], states) get_newly_available_spotter_locations(is_test) else: print('invalid config: missing geolocation data') if len(newly_available_hyvee_appointments) or len(newly_available_spotter_appointments): print(f'{len(newly_available_hyvee_appointments)} newly available hy-vee location(s) found') print(f'{len(newly_available_spotter_appointments)} newly available spotter location(s) found') blocks = [header_block()] for location in newly_available_hyvee_appointments: blocks.append(location_hyvee_block(location)) blocks.append(url_block('https://www.hy-vee.com/my-pharmacy/covid-vaccine-consent')) blocks.append(divider_block()) for location in newly_available_spotter_appointments: blocks.append(location_spotter_block(location)) blocks.append(url_block(location['properties']['url'])) blocks.append(divider_block()) blocks.append(footer_block(config['latitude'], config['longitude'])) # send the Slack message if config['channel']: try: client = WebClient(token=os.environ['SLACK_BOT_TOKEN']) client.chat_postMessage(channel=config['channel'], blocks=blocks, text=message) except SlackApiError as e: print('Error sending Slack message: {message}'.format(message=e.response['error'])) else: print('invalid config: missing Slack channel') # Run the schedule load_dotenv() scheduler = BlockingScheduler() scheduler.add_job(check_for_vaccine_availability, 'interval', seconds=30) scheduler.start()
[ 1, 529, 276, 1112, 420, 29958, 29885, 3712, 1989, 29914, 24542, 333, 29899, 29894, 5753, 457, 29899, 29879, 2364, 29899, 7451, 13, 5215, 4390, 13, 5215, 2897, 13, 5215, 282, 3637, 29920, 13, 5215, 7274, 13, 3166, 263, 567, 305, 14952, 29889, 816, 287, 352, 414, 29889, 1271, 292, 1053, 15658, 292, 4504, 14952, 13, 3166, 12865, 1053, 12865, 13, 3166, 8329, 6272, 1053, 2254, 29918, 6333, 6272, 13, 3166, 1737, 2270, 1053, 5418, 13, 3166, 269, 2364, 29918, 15348, 1053, 2563, 4032, 13, 3166, 269, 2364, 29918, 15348, 29889, 12523, 1053, 317, 2364, 11713, 2392, 13, 3166, 29431, 2886, 261, 1053, 5974, 8028, 29943, 4995, 13, 13, 29937, 402, 2127, 1338, 13, 2917, 29879, 353, 5159, 13, 4906, 353, 6629, 13, 2230, 8028, 29943, 4995, 353, 5974, 8028, 29943, 4995, 580, 13, 13, 5819, 27202, 29918, 2029, 800, 353, 5159, 13, 5819, 27202, 29918, 485, 737, 3097, 353, 6571, 13, 1482, 368, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 353, 5159, 13, 13, 17500, 357, 29918, 8173, 353, 6571, 13, 17500, 357, 29918, 2029, 800, 353, 5159, 13, 17500, 357, 29918, 485, 737, 3097, 353, 6571, 13, 1482, 368, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 353, 5159, 13, 13, 29937, 16012, 2295, 13, 5325, 353, 518, 1445, 363, 934, 297, 2897, 29889, 1761, 3972, 877, 2917, 29914, 1495, 565, 934, 29889, 1975, 2541, 12839, 3126, 1495, 29962, 13, 1454, 934, 297, 2066, 29901, 13, 1678, 411, 1722, 29898, 29888, 29915, 2917, 19248, 1445, 29913, 1495, 408, 285, 29901, 13, 4706, 2295, 29879, 29889, 4397, 29898, 3126, 29889, 1359, 29898, 29888, 876, 13, 4706, 1596, 29898, 29888, 29915, 2917, 934, 7500, 29901, 426, 1445, 29913, 1495, 13, 13, 13, 29937, 9665, 29899, 29963, 3905, 1963, 22824, 2478, 13, 1753, 679, 29918, 5819, 27202, 29918, 29894, 5753, 457, 29918, 485, 737, 3097, 29898, 5066, 4279, 29892, 28745, 29892, 11855, 1125, 13, 1678, 5534, 7498, 27202, 29918, 2029, 800, 13, 1678, 3142, 353, 525, 991, 597, 1636, 29889, 5819, 29899, 27202, 29889, 510, 29914, 1357, 29899, 561, 2817, 4135, 29914, 2754, 29914, 4262, 1519, 29915, 13, 1678, 2346, 353, 14550, 13, 4706, 2346, 11856, 4819, 22824, 2478, 29940, 799, 5228, 3047, 29907, 586, 333, 29963, 5753, 457, 12810, 737, 3097, 1566, 5066, 4279, 29901, 27842, 18565, 395, 5426, 4279, 29901, 27842, 18565, 395, 13471, 29901, 3159, 29991, 353, 29871, 29896, 29900, 29897, 426, 13, 9651, 2740, 4819, 22824, 2478, 29940, 799, 5228, 29898, 5066, 4279, 29901, 395, 5066, 4279, 29892, 28745, 29901, 395, 5426, 4279, 29892, 11855, 29901, 395, 13471, 29897, 426, 13, 18884, 5418, 13, 18884, 4423, 426, 13, 462, 1678, 4423, 1204, 13, 462, 1678, 1024, 13, 462, 1678, 25985, 978, 13, 462, 1678, 9008, 4557, 13, 462, 1678, 5381, 3399, 13, 462, 1678, 338, 29907, 586, 333, 29963, 5753, 457, 27635, 13, 462, 1678, 18838, 333, 29963, 5753, 457, 29923, 3473, 4127, 14343, 29879, 13, 462, 1678, 3211, 426, 13, 462, 4706, 1196, 29896, 13, 462, 4706, 1196, 29906, 13, 462, 4706, 4272, 13, 462, 4706, 2106, 13, 462, 4706, 14319, 13, 462, 4706, 26271, 13, 462, 4706, 28745, 13, 462, 4706, 4770, 22646, 13, 462, 1678, 500, 13, 462, 1678, 4770, 22646, 13, 18884, 500, 13, 18884, 4770, 22646, 13, 9651, 500, 13, 4706, 500, 13, 1678, 14550, 13, 1678, 2933, 353, 7274, 29889, 2490, 29898, 2271, 29892, 4390, 3790, 13, 4706, 525, 1972, 2396, 2346, 29892, 13, 4706, 525, 20897, 2396, 426, 13, 9651, 525, 5066, 4279, 2396, 26271, 29892, 13, 9651, 525, 5426, 4279, 2396, 28745, 29892, 13, 9651, 525, 13471, 2396, 11855, 29892, 13, 4706, 500, 13, 1678, 5615, 13, 13, 1678, 565, 2933, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29901, 13, 4706, 4390, 29918, 1272, 353, 4390, 29889, 18132, 29898, 5327, 29889, 726, 29897, 13, 4706, 7498, 27202, 29918, 2029, 800, 353, 1051, 29898, 1958, 29898, 2892, 4423, 29901, 4423, 1839, 5479, 7464, 4390, 29918, 1272, 1839, 1272, 16215, 4478, 4819, 22824, 2478, 29940, 799, 5228, 25901, 13, 13, 1678, 1683, 29901, 13, 4706, 1596, 29898, 29888, 29915, 2392, 2805, 325, 5753, 457, 20847, 3097, 29901, 426, 5327, 29889, 726, 29913, 1495, 13, 4706, 7498, 27202, 29918, 2029, 800, 353, 5159, 13, 13, 13, 1753, 679, 29918, 1482, 368, 29918, 16515, 29918, 5819, 27202, 29918, 2029, 800, 29898, 275, 29918, 1688, 29922, 8824, 1125, 13, 1678, 5534, 7498, 27202, 29918, 2029, 800, 29892, 7498, 27202, 29918, 485, 737, 3097, 29892, 15141, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 13, 1678, 15141, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 353, 5159, 13, 13, 1678, 363, 4423, 297, 7498, 27202, 29918, 2029, 800, 29901, 13, 4706, 12379, 29918, 485, 737, 353, 7498, 27202, 29918, 485, 737, 3097, 29961, 5479, 1839, 5479, 1204, 2033, 29962, 565, 4423, 1839, 5479, 1204, 2033, 297, 7498, 27202, 29918, 485, 737, 3097, 1683, 7700, 13, 13, 4706, 565, 4423, 1839, 275, 29907, 586, 333, 29963, 5753, 457, 27635, 2033, 322, 451, 12379, 29918, 485, 737, 29901, 13, 9651, 15141, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 29889, 4397, 29898, 5479, 29897, 13, 13, 4706, 565, 451, 7431, 29898, 1482, 368, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 29897, 322, 338, 29918, 1688, 322, 451, 12379, 29918, 485, 737, 29901, 13, 9651, 15141, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 29889, 4397, 29898, 5479, 29897, 13, 13, 4706, 7498, 27202, 29918, 485, 737, 3097, 29961, 5479, 1839, 5479, 1204, 2033, 29962, 353, 4423, 1839, 275, 29907, 586, 333, 29963, 5753, 457, 27635, 2033, 13, 13, 13, 29937, 5901, 1963, 22824, 2478, 448, 325, 5753, 1475, 17765, 357, 29889, 990, 3450, 13, 1753, 679, 29918, 17500, 357, 29918, 2754, 29918, 29894, 5753, 457, 29918, 485, 737, 3097, 29898, 5066, 4279, 29892, 28745, 29892, 11855, 29892, 5922, 1125, 13, 1678, 5534, 9758, 357, 29918, 8173, 29892, 9758, 357, 29918, 2029, 800, 13, 1678, 14354, 353, 5159, 13, 1678, 363, 2106, 297, 5922, 29901, 13, 4706, 565, 2106, 451, 297, 9758, 357, 29918, 8173, 29901, 13, 9651, 2933, 353, 7274, 29889, 657, 29898, 29888, 29915, 991, 597, 1636, 29889, 29894, 5753, 1475, 17765, 357, 29889, 990, 29914, 2754, 29914, 29894, 29900, 29914, 28631, 19248, 3859, 1836, 3126, 1495, 13, 13, 9651, 565, 2933, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29901, 13, 18884, 4390, 29918, 1272, 353, 4390, 29889, 18132, 29898, 5327, 29889, 726, 29897, 13, 18884, 9758, 357, 29918, 8173, 29961, 3859, 29962, 353, 1051, 29898, 13, 462, 1678, 4175, 29898, 2892, 1180, 29901, 1180, 1839, 11330, 16215, 18121, 2033, 2804, 525, 5819, 27202, 742, 4390, 29918, 1272, 1839, 22100, 11287, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 9758, 357, 29918, 8173, 29961, 3859, 29962, 353, 5159, 13, 13, 4706, 14354, 29889, 21843, 29898, 17500, 357, 29918, 8173, 29961, 3859, 2314, 13, 13, 1678, 9758, 357, 29918, 2029, 800, 353, 5159, 13, 1678, 2740, 29918, 1111, 24266, 353, 313, 5066, 4279, 29892, 28745, 29897, 13, 1678, 363, 4423, 297, 14354, 29901, 13, 4706, 4423, 29918, 1111, 24266, 353, 313, 5479, 1839, 19156, 16215, 1111, 24266, 2033, 29961, 29896, 1402, 4423, 1839, 19156, 16215, 1111, 24266, 2033, 29961, 29900, 2314, 13, 4706, 565, 5418, 29889, 19244, 29898, 4478, 29918, 1111, 24266, 29892, 4423, 29918, 1111, 24266, 467, 29885, 5475, 5277, 11855, 29901, 13, 9651, 9758, 357, 29918, 2029, 800, 29889, 4397, 29898, 5479, 29897, 13, 13, 13, 1753, 679, 29918, 1482, 368, 29918, 16515, 29918, 17500, 357, 29918, 2029, 800, 29898, 275, 29918, 1688, 29922, 8824, 1125, 13, 1678, 5534, 9758, 357, 29918, 2029, 800, 29892, 9758, 357, 29918, 485, 737, 3097, 29892, 15141, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 13, 1678, 15141, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 353, 5159, 13, 13, 1678, 363, 4423, 297, 9758, 357, 29918, 2029, 800, 29901, 13, 4706, 12379, 29918, 485, 737, 353, 9758, 357, 29918, 485, 737, 3097, 29961, 5479, 1839, 11330, 16215, 333, 2033, 29962, 565, 4423, 1839, 11330, 16215, 333, 2033, 297, 9758, 357, 29918, 485, 737, 3097, 1683, 7700, 13, 13, 4706, 565, 4423, 1839, 11330, 16215, 932, 2461, 1860, 29918, 16515, 2033, 322, 451, 12379, 29918, 485, 737, 29901, 13, 9651, 15141, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 29889, 4397, 29898, 5479, 29897, 13, 13, 4706, 565, 451, 7431, 29898, 1482, 368, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 29897, 322, 338, 29918, 1688, 322, 451, 12379, 29918, 485, 737, 29901, 13, 9651, 15141, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 29889, 4397, 29898, 5479, 29897, 13, 13, 4706, 9758, 357, 29918, 485, 737, 3097, 29961, 5479, 1839, 11330, 16215, 333, 2033, 29962, 353, 4423, 1839, 11330, 16215, 932, 2461, 1860, 29918, 16515, 2033, 13, 13, 13, 29937, 7777, 10930, 13, 1753, 4839, 29918, 1271, 7295, 13, 1678, 5534, 2643, 13, 1678, 2643, 353, 525, 29901, 12888, 29901, 18252, 4150, 29958, 334, 29963, 5753, 1475, 7740, 3106, 29930, 584, 12888, 11283, 13, 1678, 736, 426, 13, 4706, 525, 1853, 2396, 525, 2042, 742, 13, 4706, 525, 726, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 29885, 29878, 29895, 29881, 1233, 742, 13, 9651, 525, 726, 2396, 525, 29901, 12888, 29901, 18252, 4150, 29958, 334, 29963, 5753, 1475, 7740, 3106, 29930, 584, 12888, 3583, 29876, 29905, 29876, 1576, 1494, 14354, 505, 19937, 29899, 29896, 29929, 325, 5753, 3381, 8167, 1860, 584, 24542, 333, 29899, 29896, 29929, 29901, 584, 29879, 4316, 19144, 29901, 3625, 1286, 20714, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 1753, 4423, 29918, 5819, 27202, 29918, 1271, 29898, 5479, 1125, 13, 1678, 5534, 2643, 13, 1678, 1024, 353, 4423, 1839, 19254, 978, 2033, 565, 4423, 1839, 19254, 978, 2033, 1683, 4423, 1839, 978, 2033, 13, 1678, 3211, 353, 4423, 1839, 7328, 16215, 1220, 29896, 2033, 13, 1678, 4272, 353, 4423, 1839, 7328, 16215, 12690, 2033, 13, 1678, 2106, 353, 4423, 1839, 7328, 16215, 3859, 2033, 13, 1678, 14319, 401, 353, 4423, 1839, 7328, 16215, 7554, 2033, 13, 1678, 2643, 4619, 285, 12764, 29876, 29905, 29876, 19740, 978, 29913, 17710, 29876, 29912, 7328, 1012, 29876, 29912, 12690, 1118, 426, 3859, 29913, 426, 7554, 401, 10162, 13, 1678, 736, 426, 13, 4706, 525, 1853, 2396, 525, 2042, 742, 13, 4706, 525, 726, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 29885, 29878, 29895, 29881, 1233, 742, 13, 9651, 525, 726, 2396, 285, 29915, 19740, 978, 29913, 17710, 29876, 29912, 7328, 1012, 29876, 29912, 12690, 1118, 426, 3859, 29913, 426, 7554, 401, 10162, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 1753, 4423, 29918, 17500, 357, 29918, 1271, 29898, 5479, 1125, 13, 1678, 5534, 2643, 13, 13, 1678, 565, 4423, 1839, 11330, 16215, 18121, 2033, 1275, 525, 29883, 4270, 2396, 13, 4706, 4272, 353, 4423, 1839, 11330, 16215, 12690, 2033, 13, 4706, 2106, 353, 4423, 1839, 11330, 16215, 3859, 2033, 13, 4706, 1426, 353, 285, 29915, 29930, 15633, 29903, 17710, 29876, 29912, 12690, 1118, 426, 3859, 10162, 13, 13, 1678, 1683, 29901, 13, 4706, 1024, 353, 22372, 978, 29913, 426, 18121, 29913, 4286, 4830, 29898, 13, 9651, 1024, 29922, 5479, 1839, 11330, 16215, 978, 7464, 13, 9651, 13113, 29922, 5479, 1839, 11330, 16215, 18121, 29918, 16472, 29918, 978, 2033, 13, 4706, 1723, 13, 4706, 3211, 353, 4423, 1839, 11330, 16215, 7328, 2033, 13, 4706, 4272, 353, 4423, 1839, 11330, 16215, 12690, 2033, 13, 4706, 2106, 353, 4423, 1839, 11330, 16215, 3859, 2033, 13, 4706, 14319, 401, 353, 4423, 1839, 11330, 16215, 2490, 284, 29918, 401, 2033, 13, 4706, 1426, 353, 285, 29915, 19740, 978, 29913, 17710, 29876, 29912, 7328, 1012, 29876, 29912, 12690, 1118, 426, 3859, 29913, 426, 7554, 401, 10162, 13, 13, 1678, 2643, 4619, 285, 12764, 29876, 29905, 29876, 29912, 726, 10162, 13, 1678, 736, 426, 13, 4706, 525, 1853, 2396, 525, 2042, 742, 13, 4706, 525, 726, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 29885, 29878, 29895, 29881, 1233, 742, 13, 9651, 525, 726, 2396, 1426, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 1753, 3142, 29918, 1271, 29898, 2271, 1125, 13, 1678, 5534, 2643, 13, 1678, 2643, 4619, 285, 12764, 29876, 29912, 2271, 10162, 13, 1678, 736, 426, 13, 4706, 525, 1853, 2396, 525, 7387, 742, 13, 4706, 525, 17664, 2396, 518, 13, 9651, 426, 13, 18884, 525, 1853, 2396, 525, 3092, 742, 13, 18884, 525, 726, 2396, 426, 13, 462, 1678, 525, 1853, 2396, 525, 24595, 29918, 726, 742, 13, 462, 1678, 525, 15810, 2397, 2396, 5852, 29892, 13, 462, 1678, 525, 726, 2396, 525, 15213, 2567, 29915, 13, 18884, 2981, 13, 18884, 525, 3293, 2396, 525, 16072, 742, 13, 18884, 525, 2271, 2396, 3142, 13, 9651, 500, 13, 4706, 4514, 13, 1678, 500, 13, 13, 13, 1753, 1933, 1241, 29918, 1271, 7295, 13, 1678, 736, 426, 13, 4706, 525, 1853, 2396, 525, 4563, 1241, 29915, 13, 1678, 500, 13, 13, 13, 1753, 24166, 29918, 1271, 29898, 5066, 4279, 29892, 28745, 1125, 13, 1678, 5534, 2643, 29892, 29431, 29943, 4995, 13, 1678, 29431, 353, 29431, 29943, 4995, 29889, 2230, 8028, 29918, 271, 29898, 29880, 865, 29922, 5426, 4279, 29892, 3405, 29922, 5066, 4279, 29897, 13, 1678, 260, 29920, 353, 282, 3637, 29920, 29889, 2230, 8028, 29898, 2230, 8028, 29897, 13, 1678, 11636, 353, 12865, 29889, 3707, 29898, 17559, 29897, 13, 1678, 14334, 353, 11636, 29889, 710, 615, 603, 877, 29995, 29890, 1273, 29881, 29892, 1273, 29979, 472, 1273, 29902, 16664, 29924, 16664, 29903, 1273, 29886, 1273, 29999, 1495, 13, 1678, 2643, 4619, 285, 12764, 29876, 29905, 29876, 29918, 6747, 287, 426, 16394, 2403, 29915, 13, 1678, 736, 426, 13, 4706, 525, 1853, 2396, 525, 2042, 742, 13, 4706, 525, 726, 2396, 426, 13, 9651, 525, 1853, 2396, 525, 29885, 29878, 29895, 29881, 1233, 742, 13, 9651, 525, 726, 2396, 285, 15972, 6747, 287, 426, 16394, 2403, 29915, 13, 4706, 500, 13, 1678, 500, 13, 13, 13, 29937, 4241, 13, 1753, 1423, 29918, 1454, 29918, 29894, 5753, 457, 29918, 485, 737, 3097, 7295, 13, 1678, 5534, 2295, 29879, 29892, 2643, 29892, 9758, 357, 29918, 8173, 29892, 15141, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 29892, 15141, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 13, 13, 1678, 396, 2821, 278, 9758, 357, 7090, 13, 1678, 9758, 357, 29918, 8173, 353, 6571, 13, 13, 1678, 363, 2295, 297, 2295, 29879, 29901, 13, 4706, 9615, 353, 2295, 1839, 17590, 2033, 565, 525, 17590, 29915, 297, 2295, 1683, 5852, 13, 13, 4706, 565, 9615, 29901, 13, 9651, 565, 2295, 1839, 5066, 4279, 2033, 322, 2295, 1839, 5426, 4279, 2033, 322, 2295, 1839, 13471, 2033, 29901, 13, 18884, 338, 29918, 1688, 353, 2295, 1839, 1688, 2033, 565, 525, 1688, 29915, 297, 2295, 1683, 7700, 13, 18884, 679, 29918, 5819, 27202, 29918, 29894, 5753, 457, 29918, 485, 737, 3097, 29898, 2917, 1839, 5066, 4279, 7464, 2295, 1839, 5426, 4279, 7464, 2295, 1839, 13471, 11287, 13, 18884, 679, 29918, 1482, 368, 29918, 16515, 29918, 5819, 27202, 29918, 2029, 800, 29898, 275, 29918, 1688, 29897, 13, 13, 18884, 396, 2821, 278, 9758, 357, 7090, 13, 18884, 5922, 353, 2295, 1839, 28631, 2033, 565, 525, 28631, 29915, 297, 2295, 1683, 6024, 8186, 2033, 13, 18884, 679, 29918, 17500, 357, 29918, 2754, 29918, 29894, 5753, 457, 29918, 485, 737, 3097, 29898, 13, 462, 1678, 2295, 1839, 5066, 4279, 7464, 13, 462, 1678, 2295, 1839, 5426, 4279, 7464, 13, 462, 1678, 2295, 1839, 13471, 7464, 13, 462, 1678, 5922, 29897, 13, 18884, 679, 29918, 1482, 368, 29918, 16515, 29918, 17500, 357, 29918, 2029, 800, 29898, 275, 29918, 1688, 29897, 13, 9651, 1683, 29901, 13, 18884, 1596, 877, 20965, 2295, 29901, 4567, 1737, 324, 10610, 848, 1495, 13, 13, 9651, 565, 7431, 29898, 1482, 368, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 29897, 470, 7431, 29898, 1482, 368, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 1125, 13, 18884, 1596, 29898, 29888, 29915, 29912, 2435, 29898, 1482, 368, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 2915, 15141, 3625, 7498, 29899, 27202, 4423, 29898, 29879, 29897, 1476, 1495, 13, 18884, 1596, 29898, 29888, 29915, 29912, 2435, 29898, 1482, 368, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 2915, 15141, 3625, 9758, 357, 4423, 29898, 29879, 29897, 1476, 1495, 13, 13, 18884, 10930, 353, 518, 6672, 29918, 1271, 580, 29962, 13, 18884, 363, 4423, 297, 15141, 29918, 16515, 29918, 5819, 27202, 29918, 932, 2461, 1860, 29901, 13, 462, 1678, 10930, 29889, 4397, 29898, 5479, 29918, 5819, 27202, 29918, 1271, 29898, 5479, 876, 13, 462, 1678, 10930, 29889, 4397, 29898, 2271, 29918, 1271, 877, 991, 597, 1636, 29889, 5819, 29899, 27202, 29889, 510, 29914, 1357, 29899, 561, 2817, 4135, 29914, 24542, 333, 29899, 29894, 5753, 457, 29899, 3200, 296, 8785, 13, 462, 1678, 10930, 29889, 4397, 29898, 4563, 1241, 29918, 1271, 3101, 13, 13, 18884, 363, 4423, 297, 15141, 29918, 16515, 29918, 17500, 357, 29918, 932, 2461, 1860, 29901, 13, 462, 1678, 10930, 29889, 4397, 29898, 5479, 29918, 17500, 357, 29918, 1271, 29898, 5479, 876, 13, 462, 1678, 10930, 29889, 4397, 29898, 2271, 29918, 1271, 29898, 5479, 1839, 11330, 16215, 2271, 25901, 13, 462, 1678, 10930, 29889, 4397, 29898, 4563, 1241, 29918, 1271, 3101, 13, 13, 18884, 10930, 29889, 4397, 29898, 21720, 29918, 1271, 29898, 2917, 1839, 5066, 4279, 7464, 2295, 1839, 5426, 4279, 25901, 13, 13, 18884, 396, 3638, 278, 317, 2364, 2643, 13, 18884, 565, 2295, 1839, 12719, 2033, 29901, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 3132, 353, 2563, 4032, 29898, 6979, 29922, 359, 29889, 21813, 1839, 12750, 11375, 29918, 29933, 2891, 29918, 4986, 29968, 1430, 11287, 13, 462, 4706, 3132, 29889, 13496, 29918, 2490, 3728, 29898, 12719, 29922, 2917, 1839, 12719, 7464, 10930, 29922, 1271, 29879, 29892, 1426, 29922, 4906, 29897, 13, 462, 1678, 5174, 317, 2364, 11713, 2392, 408, 321, 29901, 13, 462, 4706, 1596, 877, 2392, 9348, 317, 2364, 2643, 29901, 426, 4906, 29913, 4286, 4830, 29898, 4906, 29922, 29872, 29889, 5327, 1839, 2704, 25901, 13, 13, 18884, 1683, 29901, 13, 462, 1678, 1596, 877, 20965, 2295, 29901, 4567, 317, 2364, 8242, 1495, 13, 13, 13, 29937, 7525, 278, 20410, 13, 1359, 29918, 6333, 6272, 580, 13, 816, 14952, 353, 15658, 292, 4504, 14952, 580, 13, 816, 14952, 29889, 1202, 29918, 9057, 29898, 3198, 29918, 1454, 29918, 29894, 5753, 457, 29918, 485, 737, 3097, 29892, 525, 19207, 742, 6923, 29922, 29941, 29900, 29897, 13, 816, 14952, 29889, 2962, 580, 13, 2 ]
mediawikiapi/config.py
srevinsaju/MediaWikiAPI
0
34544
<filename>mediawikiapi/config.py import requests from datetime import timedelta from .language import Language class Config(object): """ Contains global configuration """ DEFAULT_USER_AGENT = 'mediawikiapi (https://github.com/lehinevych/MediaWikiAPI/)' DONATE_URL = 'https://donate.wikimedia.org/w/index.php?title=Special:FundraiserLandingPage' API_URL = 'https://{}.wikipedia.org/w/api.php' def __init__(self, language=None, user_agent=None, rate_limit=None): if language is not None: self.__lang = Language(language) else: self.__lang = Language() self.__rate_limit_last_call = None self.__rate_limit = rate_limit self.timeout = None self.user_agent = user_agent or self.DEFAULT_USER_AGENT @classmethod def donate_url(cls): '''Return media wiki donate url''' return cls.DONATE_URL @property def language(self): '''Return current global language''' return self.__lang.language @language.setter def language(self, language): '''Set a new language Arguments: * language - (string or Language instance) specifying the language ''' if isinstance(language, Language): self.__lang=language else: self.__lang.language = language def get_api_url(self, language=None): '''Return api for specified language Arguments: * language - (string or Language instance) specifying the language ''' if language is not None: if isinstance(language, Language): return self.API_URL.format(language.language) else: # does the language verification lang = Language(language) return self.API_URL.format(lang.language) return self.API_URL.format(self.__lang.language) @property def rate_limit(self): return self.__rate_limit @property def rate_limit_last_call(self): return self.__rate_limit_last_call @rate_limit_last_call.setter def rate_limit_last_call(self, last_call): self.__rate_limit_last_call = last_call @rate_limit.setter def rate_limit(self, rate_limit): ''' Enable or disable rate limiting on requests to the Mediawiki servers. If rate limiting is not enabled, under some circumstances (depending on load on Wikipedia, the number of requests you and other `wikipedia` users are making, and other factors), Wikipedia may return an HTTP timeout error. Enabling rate limiting generally prevents that issue, but please note that HTTPTimeoutError still might be raised. Arguments: * min_wait - (integer or timedelta) describes the minimum time to wait in miliseconds before requests. Example timedelta(milliseconds=50). If None, rate_limit won't be used. ''' if rate_limit is None: self.__rate_limit = None elif isinstance(rate_limit, timedelta): self.__rate_limit = rate_limit else: self.__rate_limit = timedelta(milliseconds=rate_limit) self.__rate_limit_last_call = None
[ 1, 529, 9507, 29958, 9799, 2851, 423, 1631, 29914, 2917, 29889, 2272, 13, 5215, 7274, 13, 3166, 12865, 1053, 5335, 287, 2554, 13, 3166, 869, 11675, 1053, 17088, 13, 13, 13, 1990, 12782, 29898, 3318, 1125, 13, 29871, 9995, 13, 29871, 2866, 2708, 5534, 5285, 13, 29871, 9995, 13, 29871, 22236, 29918, 11889, 29918, 10051, 3919, 353, 525, 9799, 2851, 423, 1631, 313, 991, 597, 3292, 29889, 510, 29914, 280, 29882, 457, 29894, 3376, 29914, 10572, 5653, 29875, 8787, 4551, 29915, 13, 29871, 360, 1164, 3040, 29918, 4219, 353, 525, 991, 597, 9176, 403, 29889, 2851, 3393, 29889, 990, 29914, 29893, 29914, 2248, 29889, 1961, 29973, 3257, 29922, 24780, 29901, 29943, 870, 336, 7608, 22677, 292, 5074, 29915, 13, 29871, 3450, 29918, 4219, 353, 525, 991, 597, 29912, 1836, 6011, 29889, 990, 29914, 29893, 29914, 2754, 29889, 1961, 29915, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 4086, 29922, 8516, 29892, 1404, 29918, 14748, 29922, 8516, 29892, 6554, 29918, 13400, 29922, 8516, 1125, 13, 1678, 565, 4086, 338, 451, 6213, 29901, 13, 418, 1583, 17255, 3893, 353, 17088, 29898, 11675, 29897, 13, 1678, 1683, 29901, 13, 418, 1583, 17255, 3893, 353, 17088, 580, 13, 1678, 1583, 17255, 10492, 29918, 13400, 29918, 4230, 29918, 4804, 353, 6213, 13, 1678, 1583, 17255, 10492, 29918, 13400, 353, 6554, 29918, 13400, 13, 1678, 1583, 29889, 15619, 353, 6213, 13, 1678, 1583, 29889, 1792, 29918, 14748, 353, 1404, 29918, 14748, 470, 1583, 29889, 23397, 29918, 11889, 29918, 10051, 3919, 13, 13, 29871, 732, 1990, 5696, 13, 29871, 822, 1016, 403, 29918, 2271, 29898, 25932, 1125, 13, 1678, 14550, 11609, 5745, 281, 10058, 1016, 403, 3142, 12008, 13, 1678, 736, 1067, 29879, 29889, 29928, 1164, 3040, 29918, 4219, 13, 13, 29871, 732, 6799, 13, 29871, 822, 4086, 29898, 1311, 1125, 13, 1678, 14550, 11609, 1857, 5534, 4086, 12008, 13, 1678, 736, 1583, 17255, 3893, 29889, 11675, 13, 13, 29871, 732, 11675, 29889, 842, 357, 13, 29871, 822, 4086, 29898, 1311, 29892, 4086, 1125, 13, 1678, 14550, 2697, 263, 716, 4086, 13, 1678, 11842, 9331, 29901, 13, 1678, 334, 4086, 448, 313, 1807, 470, 17088, 2777, 29897, 22146, 278, 4086, 13, 1678, 14550, 13, 1678, 565, 338, 8758, 29898, 11675, 29892, 17088, 1125, 13, 418, 1583, 17255, 3893, 29922, 11675, 13, 1678, 1683, 29901, 13, 418, 1583, 17255, 3893, 29889, 11675, 353, 4086, 13, 13, 29871, 822, 679, 29918, 2754, 29918, 2271, 29898, 1311, 29892, 4086, 29922, 8516, 1125, 13, 1678, 14550, 11609, 7882, 363, 6790, 4086, 13, 1678, 11842, 9331, 29901, 13, 1678, 334, 4086, 448, 313, 1807, 470, 17088, 2777, 29897, 22146, 278, 4086, 13, 1678, 14550, 13, 1678, 565, 4086, 338, 451, 6213, 29901, 13, 418, 565, 338, 8758, 29898, 11675, 29892, 17088, 1125, 13, 4706, 736, 1583, 29889, 8787, 29918, 4219, 29889, 4830, 29898, 11675, 29889, 11675, 29897, 13, 418, 1683, 29901, 13, 4706, 396, 947, 278, 4086, 1147, 2450, 13, 4706, 6361, 353, 17088, 29898, 11675, 29897, 13, 4706, 736, 1583, 29889, 8787, 29918, 4219, 29889, 4830, 29898, 3893, 29889, 11675, 29897, 13, 1678, 736, 1583, 29889, 8787, 29918, 4219, 29889, 4830, 29898, 1311, 17255, 3893, 29889, 11675, 29897, 13, 13, 29871, 732, 6799, 13, 29871, 822, 6554, 29918, 13400, 29898, 1311, 1125, 13, 1678, 736, 1583, 17255, 10492, 29918, 13400, 13, 13, 29871, 732, 6799, 13, 29871, 822, 6554, 29918, 13400, 29918, 4230, 29918, 4804, 29898, 1311, 1125, 13, 1678, 736, 1583, 17255, 10492, 29918, 13400, 29918, 4230, 29918, 4804, 13, 13, 29871, 732, 10492, 29918, 13400, 29918, 4230, 29918, 4804, 29889, 842, 357, 13, 29871, 822, 6554, 29918, 13400, 29918, 4230, 29918, 4804, 29898, 1311, 29892, 1833, 29918, 4804, 1125, 13, 1678, 1583, 17255, 10492, 29918, 13400, 29918, 4230, 29918, 4804, 353, 1833, 29918, 4804, 13, 13, 29871, 732, 10492, 29918, 13400, 29889, 842, 357, 13, 29871, 822, 6554, 29918, 13400, 29898, 1311, 29892, 6554, 29918, 13400, 1125, 13, 1678, 14550, 13, 1678, 1174, 519, 470, 11262, 6554, 4046, 292, 373, 7274, 304, 278, 8213, 4594, 12424, 29889, 13, 1678, 960, 6554, 4046, 292, 338, 451, 9615, 29892, 1090, 777, 14209, 313, 2716, 2548, 373, 13, 1678, 2254, 373, 14109, 29892, 278, 1353, 310, 7274, 366, 322, 916, 421, 6011, 29952, 4160, 13, 1678, 526, 3907, 29892, 322, 916, 13879, 511, 14109, 1122, 736, 385, 7331, 11815, 1059, 29889, 13, 13, 1678, 1174, 17961, 6554, 4046, 292, 6892, 28057, 393, 2228, 29892, 541, 3113, 4443, 393, 13, 1678, 7331, 10851, 2392, 1603, 1795, 367, 10425, 29889, 13, 13, 1678, 11842, 9331, 29901, 13, 1678, 334, 1375, 29918, 10685, 448, 313, 16031, 470, 5335, 287, 2554, 29897, 16612, 278, 9212, 931, 304, 4480, 297, 2316, 21462, 1434, 7274, 29889, 13, 965, 8741, 5335, 287, 2554, 29898, 19958, 21462, 29922, 29945, 29900, 467, 960, 6213, 29892, 6554, 29918, 13400, 2113, 29915, 29873, 367, 1304, 29889, 13, 13, 1678, 14550, 13, 1678, 565, 6554, 29918, 13400, 338, 6213, 29901, 13, 418, 1583, 17255, 10492, 29918, 13400, 353, 6213, 13, 1678, 25342, 338, 8758, 29898, 10492, 29918, 13400, 29892, 5335, 287, 2554, 1125, 13, 418, 1583, 17255, 10492, 29918, 13400, 353, 6554, 29918, 13400, 13, 1678, 1683, 29901, 13, 418, 1583, 17255, 10492, 29918, 13400, 353, 5335, 287, 2554, 29898, 19958, 21462, 29922, 10492, 29918, 13400, 29897, 13, 13, 1678, 1583, 17255, 10492, 29918, 13400, 29918, 4230, 29918, 4804, 353, 6213, 13, 2 ]
util/update-status.py
SCNU-SoCoding/mirror
1
198272
<reponame>SCNU-SoCoding/mirror #!/bin/python3 import json import codecs import sys import getopt from collections import OrderedDict if (len(sys.argv) != 3): sys.exit(1) file_dir = "/mnt/socoding/files/fancyindex/data/supported_os.json" with codecs.open(file_dir, 'r', 'utf-8') as f: oslist = json.load(f, object_pairs_hook=OrderedDict) for osobj in oslist: for tag in osobj['tags']: if (tag['key'] == sys.argv[1]): tag['text'] = "stat: " + str(sys.argv[2]) tag['color'] = "mdl-chip mdl-color--green" if str(sys.argv[2]) == "0" else "mdl-chip mdl-color--red" with codecs.open(file_dir, 'w', 'utf-8') as f: json.dump(oslist, f, ensure_ascii=False, indent=4, separators=(',', ': '))
[ 1, 529, 276, 1112, 420, 29958, 7187, 11601, 29899, 6295, 29907, 3689, 29914, 11038, 729, 13, 29937, 14708, 2109, 29914, 4691, 29941, 13, 5215, 4390, 13, 5215, 775, 2395, 13, 5215, 10876, 13, 5215, 679, 3670, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 13, 361, 313, 2435, 29898, 9675, 29889, 19218, 29897, 2804, 29871, 29941, 1125, 13, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1445, 29918, 3972, 353, 5591, 29885, 593, 29914, 29879, 542, 3689, 29914, 5325, 29914, 29888, 6906, 2248, 29914, 1272, 29914, 23765, 29918, 359, 29889, 3126, 29908, 13, 13, 2541, 775, 2395, 29889, 3150, 29898, 1445, 29918, 3972, 29892, 525, 29878, 742, 525, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 1678, 2897, 1761, 353, 4390, 29889, 1359, 29898, 29888, 29892, 1203, 29918, 29886, 7121, 29918, 20849, 29922, 7514, 287, 21533, 29897, 13, 1678, 363, 27949, 29926, 297, 2897, 1761, 29901, 13, 4706, 363, 4055, 297, 27949, 29926, 1839, 11338, 2033, 29901, 13, 9651, 565, 313, 4039, 1839, 1989, 2033, 1275, 10876, 29889, 19218, 29961, 29896, 29962, 1125, 13, 18884, 4055, 1839, 726, 2033, 353, 376, 6112, 29901, 376, 718, 851, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 13, 18884, 4055, 1839, 2780, 2033, 353, 376, 3487, 29880, 29899, 305, 666, 286, 11671, 29899, 2780, 489, 12692, 29908, 565, 851, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 1275, 376, 29900, 29908, 1683, 376, 3487, 29880, 29899, 305, 666, 286, 11671, 29899, 2780, 489, 1127, 29908, 13, 13, 2541, 775, 2395, 29889, 3150, 29898, 1445, 29918, 3972, 29892, 525, 29893, 742, 525, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 1678, 4390, 29889, 15070, 29898, 359, 1761, 29892, 285, 29892, 9801, 29918, 294, 18869, 29922, 8824, 29892, 13, 795, 29536, 29922, 29946, 29892, 2903, 4097, 7607, 742, 742, 525, 29901, 525, 876, 13, 2 ]
djangobmf/migrations/0002_removed_notification_and_watch.py
dmatthes/django-bmf
1
52645
<gh_stars>1-10 # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ ('djangobmf', '0001_initial'), ] operations = [ migrations.DeleteModel( name='Notification', ), migrations.DeleteModel( name='Watch', ), ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 9557, 29889, 2585, 1053, 4733, 29892, 9725, 800, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 19776, 574, 711, 29885, 29888, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 12498, 3195, 29898, 13, 9651, 1024, 2433, 12958, 742, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 12498, 3195, 29898, 13, 9651, 1024, 2433, 24709, 742, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
pdeopt/pdeopt/TR.py
TiKeil/NCD-corrected-TR-RB-approach-for-pde-opt
0
186714
# ~~~ # This file is part of the paper: # # "A NON-CONFORMING DUAL APPROACH FOR ADAPTIVE TRUST-REGION REDUCED BASIS # APPROXIMATION OF PDE-CONSTRAINED OPTIMIZATION" # # https://github.com/TiKeil/NCD-corrected-TR-RB-approach-for-pde-opt # # Copyright 2019-2020 all developers. All rights reserved. # License: Licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause) # Authors: # <NAME> (2019 - 2020) # <NAME> (2019 - 2020) # ~~~ import numpy as np import time from copy import deepcopy from pdeopt.tools import truncated_conj_grad as TruncCG def projection_onto_range(parameter_space, mu): ranges = parameter_space.ranges for (key, item) in parameter_space.parameter_type.items(): range_ = ranges[key] if sum(item) < 2: # these are the cases () and (1,) if mu[key] < range_[0]: if item == (): mu[key] = range_[0] else: mu[key] = [range_[0]] if mu[key] > range_[1]: if item == (): mu[key] = range_[1] else: mu[key] = [range_[1]] else: for j in range(item[0]): if mu[key][j] < range_[0]: mu[key][j] = range_[0] if mu[key][j] > range_[1]: mu[key][j] = range_[1] return mu def active_and_inactive_sets(parameter_space, mu, epsilon): Act = [] ranges = parameter_space.ranges for (key,item) in parameter_space.parameter_type.items(): range_ = ranges[key] if sum(item) < 2: if mu[key] - range_[0] <= epsilon: Act.append(1.0) elif range_[1] - mu[key] <= epsilon: Act.append(1.0) else: Act.append(0.0) else: for j in range(item[0]): if mu[key][j] - range_[0] <= epsilon: Act.append(1.0) elif range_[1] - mu[key][j] <= epsilon: Act.append(1.0) else: Act.append(0.0) Act = np.array(Act) Inact = np.ones(Act.shape) - Act return Act, Inact def armijo_rule(opt_model, parameter_space, TR_parameters, mu_i, Ji, direction): j = 0 condition = True while condition and j < TR_parameters['max_iterations_armijo']: mu_ip1 = mu_i + (TR_parameters['initial_step_armijo'] ** j) * direction mu_ip1_dict = opt_model.primal_model.parse_parameter(opt_model.pre_parse_parameter(mu_ip1)) mu_ip1_dict = projection_onto_range(parameter_space,mu_ip1_dict) mu_ip1 = opt_model.parse_parameter_inverse(mu_ip1_dict) Jip1 = opt_model.output_functional_hat(mu_ip1_dict) if not TR_parameters['full_order_model']: u_cp = opt_model.solve(mu_ip1_dict) p_cp = opt_model.solve_dual(mu_ip1_dict) est = opt_model.estimate_output_functional_hat(u_cp, p_cp, mu_ip1_dict) else: est = 0.0 if Jip1 <= Ji - (TR_parameters['armijo_alpha'] / ((TR_parameters['initial_step_armijo'] ** j))) * (np.linalg.norm(mu_ip1-mu_i)**2) and abs(est / Jip1) <= TR_parameters['radius']: condition = False j = j + 1 if condition: # This means that we exit the loop because of maximum iteration reached print("Maximum iteration for Armijo rule reached") mu_ip1 = mu_i mu_ip1_dict = opt_model.primal_model.parse_parameter(opt_model.pre_parse_parameter(mu_ip1)) Jip1 = Ji est = TR_parameters['radius']*Ji # so that the Qian-Grepl method stops as well return mu_ip1, mu_ip1_dict, Jip1, abs(est / Jip1) #the last is needed for the boundary criterium def compute_new_hessian_approximation(new_mu,old_mu,new_gradient,old_gradient,old_B): gk = new_gradient-old_gradient pk = new_mu-old_mu den = gk.dot(pk) if den>0.0: Hkgk = old_B.dot(gk) coeff = gk.dot(Hkgk) Hkgkpkt = np.outer(Hkgk,pk) pkHkgkt = np.outer(pk,Hkgk) pkpkt = np.outer(pk,pk) new_B = old_B + (den+coeff)/(den*den) * pkpkt - (1.0/den) * Hkgkpkt - (1.0/den)*pkHkgkt else: print("Curvature condition: {}".format(den)) print("Reset direction to - gradient") new_B = np.eye(old_gradient.size) return new_B def compute_modified_hessian_action_matrix_version(H,Active,Inactive,eta): etaA = np.multiply(Active, eta) etaI = np.multiply(Inactive, eta) Hessian_prod = H.dot(etaI) Action_of_modified_H = etaA + np.multiply(Inactive, Hessian_prod) return Action_of_modified_H def solve_optimization_subproblem_BFGS(opt_model, parameter_space, mu_k_dict, TR_parameters, timing=False): if not TR_parameters['full_order_model']: print('___ starting subproblem') if 'beta' not in TR_parameters: print('Setting beta to the default 0.95') TR_parameters['beta'] = 0.95 else: print("Starting parameter {}".format(mu_k_dict)) tic_ = time.time() times = [] mus = [] Js = [] FOCs = [] mu_diff = 1e6 J_diff = 1e6 Ji = opt_model.output_functional_hat(mu_k_dict) gradient = opt_model.output_functional_hat_gradient(mu_k_dict) normgrad = np.linalg.norm(gradient) mu_i = opt_model.parse_parameter_inverse(mu_k_dict) mu_i_dict = opt_model.primal_model.parse_parameter(opt_model.pre_parse_parameter(mu_i)) mu_i_1 = mu_i - gradient mu_i_1_dict = projection_onto_range(opt_model.parameter_space, opt_model.parse_parameter(opt_model.pre_parse_parameter(mu_i_1))) mu_i_1 = opt_model.parse_parameter_inverse(mu_i_1_dict) epsilon_i = TR_parameters['epsilon_i'] if not isinstance(epsilon_i,float): epsilon_i = np.linalg.norm(mu_i_1 - mu_i)#/(np.linalg.norm(mu_i)+1e-8) B = np.eye(mu_i.size) Active_i, Inactive_i = active_and_inactive_sets(opt_model.parameter_space, mu_i_dict, epsilon_i) i = 0 while i < TR_parameters['max_iterations_subproblem']: if i>0: if not TR_parameters['full_order_model']: if boundary_TR_criterium >= TR_parameters['beta']*TR_parameters['radius']: print('boundary criterium of the TR satisfied, so stopping the sub-problem solver') return mu_ip1_dict, Jcp, i, Jip1, FOCs if normgrad < TR_parameters['sub_tolerance'] or J_diff < TR_parameters['safety_tolerance'] or mu_diff< TR_parameters['safety_tolerance']: print("Subproblem converged: FOC = {}, mu_diff = {}, J_diff = {} ".format(normgrad,mu_diff,J_diff)) break else: if normgrad < TR_parameters['sub_tolerance']: print("Converged: FOC = {}".format(normgrad)) break if i == 0 and not TR_parameters['full_order_model']: print("Computing the approximate Cauchy point and then start the BFGS method") direction = -gradient else: if Inactive_i.sum() == 0.0: if TR_parameters["full_order_model"]: print("All indexes are active, I am using -gradient as direction") direction = -gradient else: direction = compute_modified_hessian_action_matrix_version(B, Active_i, Inactive_i, -gradient) if np.dot(direction,gradient) > 0: print('Not a descendent direction ... taking -gradient as direction') direction = -gradient if TR_parameters["full_order_model"]: mu_ip1, mu_ip1_dict, Jip1, _ = armijo_rule(opt_model, parameter_space, TR_parameters, mu_i, Ji, direction) else: mu_ip1, mu_ip1_dict, Jip1, boundary_TR_criterium = armijo_rule(opt_model, parameter_space, TR_parameters, mu_i, Ji, direction) if i == 0: if not TR_parameters['full_order_model']: Jcp = Jip1 else: Jcp = None mu_diff = np.linalg.norm(mu_i - mu_ip1) / np.linalg.norm(mu_i) J_diff = abs(Ji - Jip1) / abs(Ji) old_mu = deepcopy(mu_i) mu_i_dict = mu_ip1_dict Ji = Jip1 old_gradient = deepcopy(gradient) gradient = opt_model.output_functional_hat_gradient(mu_i_dict) mu_box = opt_model.parse_parameter(opt_model.pre_parse_parameter(opt_model.parse_parameter_inverse(mu_i_dict)-gradient)) first_order_criticity = opt_model.parse_parameter_inverse(mu_i_dict)-opt_model.parse_parameter_inverse(projection_onto_range(parameter_space, mu_box)) normgrad = np.linalg.norm(first_order_criticity) mu_i = opt_model.parse_parameter_inverse(mu_i_dict) mu_i_dict = opt_model.primal_model.parse_parameter(opt_model.pre_parse_parameter(mu_i)) mu_i_1 = mu_i - gradient mu_i_1_dict = projection_onto_range(opt_model.parameter_space,opt_model.parse_parameter(opt_model.pre_parse_parameter(mu_i_1))) mu_i_1 = opt_model.parse_parameter_inverse(mu_i_1_dict) if not isinstance(epsilon_i,float): epsilon_i = np.linalg.norm(mu_i_1 - mu_i) Active_i, Inactive_i = active_and_inactive_sets(opt_model.parameter_space, mu_i_dict, epsilon_i) B = compute_new_hessian_approximation(mu_i, old_mu, gradient, old_gradient, B) if TR_parameters["full_order_model"]: print("Step {}, functional {} , FOC condition {}".format(mu_ip1, Ji, np.linalg.norm(first_order_criticity))) times.append(time.time() -tic_) mus.append(mu_ip1) Js.append(Ji) FOCs.append(normgrad) i = i + 1 print("relative differences mu {} and J {}".format(mu_diff, J_diff)) if timing: return mu_ip1_dict, Jcp, i, Jip1, times, mus, Js, FOCs else: return mu_ip1_dict, Jcp, i, Jip1, FOCs def modified_hessian_action(mu,Active,Inactive,opt_model,eta): # Used only by the projected Newton Method etaA = np.multiply(Active,eta) etaI = np.multiply(Inactive,eta) Action_on_I = opt_model.output_functional_hessian_operator(mu, etaI, False) Action_of_modified_operator = etaA + np.multiply(Inactive,Action_on_I) return Action_of_modified_operator def solve_optimization_NewtonMethod(opt_model, parameter_space, mu_k_dict, TR_parameters, timing=False): #This method is used to compute an accurate approximation of the optimal parameter mu_bar with the FOM. # (Eventually also in the global Greedy). It is not used in the TR algorithm in this paper. print("Starting parameter {}".format(mu_k_dict)) if 'global_RB' not in TR_parameters: TR_parameters['global_RB']=False tic_toc = time.time() times = [] mus = [] Js = [] FOCs = [] Jcp = None mu_diff = 1e6 J_diff = 1e6 Ji = opt_model.output_functional_hat(mu_k_dict) gradient = opt_model.output_functional_hat_gradient(mu_k_dict) normgrad = np.linalg.norm(gradient) mu_i = opt_model.parse_parameter_inverse(mu_k_dict) mu_i_dict = opt_model.primal_model.parse_parameter(opt_model.pre_parse_parameter(mu_i)) mu_i_1 = mu_i - gradient mu_i_1_dict = projection_onto_range(opt_model.parameter_space, opt_model.parse_parameter(opt_model.pre_parse_parameter(mu_i_1))) mu_i_1 = opt_model.parse_parameter_inverse(mu_i_1_dict) epsilon_i = TR_parameters['epsilon_i'] if not isinstance(epsilon_i,float): epsilon_i = np.linalg.norm(mu_i_1 - mu_i) i = 0 while i < TR_parameters['max_iterations']: if i>0: if TR_parameters['full_order_model'] or TR_parameters['global_RB']: if normgrad < TR_parameters['sub_tolerance']: print("Converged: FOC = {}".format(normgrad)) break Active_i, Inactive_i = active_and_inactive_sets(opt_model.parameter_space, mu_i_dict, epsilon_i) if Inactive_i.sum() == 0.0: deltamu = gradient if TR_parameters["full_order_model"] or TR_parameters['global_RB']: print("I am using projected gradient instead of Newton") else: print("Using truncated CG for the linear system") deltamu, itcg,rescg, infocg = TruncCG(A_func=lambda v: modified_hessian_action(mu=mu_i_dict, Active= Active_i, Inactive= Inactive_i, opt_model=opt_model, eta=v), b= gradient, tol = 1.e-10) if infocg > 0: print("Choosing the gradient as direction") deltamu = gradient if np.dot(-deltamu,gradient) >= -1.e-14: print('Not a descendent direction ... taking gradient as direction') deltamu = gradient mu_ip1, mu_ip1_dict, Jip1, _, = armijo_rule(opt_model, parameter_space, TR_parameters, mu_i, Ji, -deltamu) mu_diff = np.linalg.norm(mu_i - mu_ip1) / np.linalg.norm(mu_i) J_diff = abs(Ji - Jip1) / abs(Ji) mu_i_dict = mu_ip1_dict Ji = Jip1 gradient = opt_model.output_functional_hat_gradient(mu_i_dict) mu_box = opt_model.parse_parameter(opt_model.pre_parse_parameter(opt_model.parse_parameter_inverse(mu_i_dict)-gradient)) first_order_criticity = opt_model.parse_parameter_inverse(mu_i_dict)-opt_model.parse_parameter_inverse(projection_onto_range(parameter_space, mu_box)) normgrad = np.linalg.norm(first_order_criticity) mu_i = opt_model.parse_parameter_inverse(mu_i_dict) mu_i_dict = opt_model.primal_model.parse_parameter(opt_model.pre_parse_parameter(mu_i)) mu_i_1 = mu_i - gradient mu_i_1_dict = projection_onto_range(opt_model.parameter_space,opt_model.parse_parameter(opt_model.pre_parse_parameter(mu_i_1))) mu_i_1 = opt_model.parse_parameter_inverse(mu_i_1_dict) if not isinstance(epsilon_i,float): epsilon_i = np.linalg.norm(mu_i_1 - mu_i) print("Step {}, functional {} , FOC condition {}".format(mu_ip1, Ji, np.linalg.norm(first_order_criticity))) times.append(time.time() -tic_toc) mus.append(mu_ip1) Js.append(Ji) FOCs.append(normgrad) i = i + 1 print("relative differences mu {} and J {}".format(mu_diff, J_diff)) if timing: return mu_ip1_dict, Jcp, i, Jip1, times, mus, Js, FOCs else: return mu_ip1_dict, Jcp, i, Jip1, FOCs, 0 def enrichment_step(mu, reductor, opt_fom=None): new_reductor = deepcopy(reductor) u, p = new_reductor.extend_bases(mu) opt_rom = new_reductor.reduce() return opt_rom, new_reductor, u, p def TR_algorithm(opt_rom, reductor, TR_parameters=None, extension_params=None, opt_fom=None, return_opt_rom=False): if TR_parameters is None: mu_k = opt_rom.parameter_space.sample_randomly(1)[0] TR_parameters = {'radius': 0.1, 'sub_tolerance': 1e-8, 'max_iterations': 30, 'max_iterations_subproblem':400, 'starting_parameter': mu_k, 'max_iterations_armijo': 50, 'initial_step_armijo': 0.5, 'armijo_alpha': 1e-4, 'full_order_model': False, 'epsilon_i': 1e-8, 'Qian-Grepl': False, 'safety_tolerance': 1e-16, 'beta': 0.95} else: if 'radius' not in TR_parameters: TR_parameters['radius'] = 0.1 if 'sub_tolerance' not in TR_parameters: TR_parameters['sub_tolerance'] = 1e-8 if 'max_iterations' not in TR_parameters: TR_parameters['max_iterations'] = 30 if 'max_iterations_subproblem' not in TR_parameters: TR_parameters['max_iterations_subproblem'] = 400 if 'starting_parameter' not in TR_parameters: TR_parameters['starting_parameter'] = opt_rom.parameter_space.sample_randomly(1)[0] if 'max_iterations_armijo' not in TR_parameters: TR_parameters['max_iterations_armijo'] = 50 if 'initial_step_armijo' not in TR_parameters: TR_parameters['initial_step_armijo'] = 0.5 if 'armijo_alpha' not in TR_parameters: TR_parameters['armijo_alpha'] = 1.e-4 if 'full_order_model' not in TR_parameters: TR_parameters['full_order_model'] = False if 'printing' not in TR_parameters: TR_parameters['printing'] = False if 'epsilon_i' not in TR_parameters: TR_parameters['epsilon_i'] = 1e-8 if 'Qian-Grepl' not in TR_parameters: TR_parameters['Qian-Grepl'] = False if 'safety_tolerance' not in TR_parameters: TR_parameters['safety_tolerance'] = 1e-16 if 'beta' not in TR_parameters: TR_parameters['beta'] = 0.95 mu_k = TR_parameters['starting_parameter'] if extension_params is None: extension_params={'Check_suff_and_nec_conditions': True, 'Enlarge_radius': True, 'opt_fom': None } elif TR_parameters['Qian-Grepl']: extension_params['Check_suff_and_nec_conditions'] = True extension_params['Enlarge_radius'] = False if 'opt_fom' not in extension_params: extension_params['opt_fom'] = None else: if 'Check_suff_and_nec_conditions' not in extension_params: extension_params['Check_suff_and_nec_conditions'] = True if 'Enlarge_radius' not in extension_params: extension_params['Enlarge_radius'] = True if 'opt_fom' not in extension_params: extension_params['opt_fom'] = None if opt_fom is None: opt_fom = extension_params['opt_fom'] if 'FOC_tolerance' not in TR_parameters: TR_parameters['FOC_tolerance'] = TR_parameters['sub_tolerance'] if TR_parameters['Qian-Grepl']: print('QIAN et al. 2017 Method') print('starting parameter {}'.format(mu_k)) # timings tic = time.time() Js = [] FOCs = [] times = [] parameter_space = opt_rom.parameter_space mu_list = [] mu_list.append(mu_k) JFE_list = [] normgrad = 1e6 estimate_gradient = 1e6 # Used only for Qian et al. method model_has_been_enriched = False point_rejected = False J_k = opt_rom.output_functional_hat(mu_k) print("Starting value of the cost: {}".format(J_k)) print("******************************* \n") k = 0 while k < TR_parameters['max_iterations']: if point_rejected: point_rejected = False if TR_parameters['radius'] < 2.22*1e-16: print('\nTR-radius is below machine precision... stopping') break else: if not TR_parameters['Qian-Grepl']: if (normgrad < TR_parameters['FOC_tolerance']): print('\nStopping criteria fulfilled: FOM FOC condition {} '.format(normgrad)) break else: if (normgrad + estimate_gradient < TR_parameters['FOC_tolerance']): print('\nStopping criteria fulfilled: normgrad {} + estimate_gradient {}'.format(normgrad,estimate_gradient)) break mu_kp1, Jcp, j, J_kp1, _ = solve_optimization_subproblem_BFGS(opt_rom, parameter_space, mu_k, TR_parameters) u_rom = opt_rom.solve(mu_kp1) p_rom = opt_rom.solve_dual(mu_kp1, U=u_rom) estimate_J = opt_rom.estimate_output_functional_hat(u_rom, p_rom, mu_kp1) if TR_parameters['Qian-Grepl']: estimate_gradient = opt_rom.estimate_output_functional_hat_gradient_norm(mu_kp1, u_rom, p_rom) if J_kp1 + estimate_J < Jcp: print('checked sufficient condition, starting the enrichment') opt_rom, reductor, u, p = enrichment_step(mu_kp1, reductor, opt_fom=extension_params['opt_fom']) JFE_list.append(reductor.fom.output_functional_hat(mu_kp1,u)) model_has_been_enriched = True if extension_params['Enlarge_radius']: if len(JFE_list) > 2: if (k-1!= 0) and (JFE_list[-2]-JFE_list[-1])/(J_k-J_kp1) > 0.75: TR_parameters['radius'] *= 2 print('enlarging the TR radius to {}'.format(TR_parameters['radius'])) print("k: {} - j {} - Cost Functional: {} - mu: {}".format(k, j, J_kp1, mu_kp1)) mu_list.append(mu_kp1) times.append(time.time() -tic) Js.append(J_kp1) mu_k = mu_kp1 J_k = opt_rom.output_functional_hat(mu_k) elif J_kp1 - estimate_J > Jcp: print('necessary condition failed') TR_parameters['radius'] = TR_parameters['radius'] * 0.5 print("Shrinking the TR radius to: {} because Jcp {} and J_kp1 {}".format(TR_parameters['radius'], Jcp, J_kp1)) point_rejected = True else: print('enriching to check the sufficient decrease condition') new_rom, new_reductor, u, p = enrichment_step(mu_kp1, reductor, opt_fom=extension_params['opt_fom']) JFE_list.append(reductor.fom.output_functional_hat(mu_kp1, u)) model_has_been_enriched = True J_kp1 = new_rom.output_functional_hat(mu_kp1) print("k: {} - j {} - Cost Functional: {} - mu: {}".format(k, j, J_kp1, mu_kp1)) if J_kp1 > Jcp + 1e-8: # add a safety tolerance of 1e-8 for avoiding numerical stability effects TR_parameters['radius'] = TR_parameters['radius'] * 0.5 print("Shrinking the TR radius to: {} because Jcp {} and J_kp1 {}".format(TR_parameters['radius'] ,Jcp,J_kp1)) point_rejected = True JFE_list.pop(-1) #We need to remove the value from the list, because we reject the parameter else: opt_rom = new_rom reductor = new_reductor mu_list.append(mu_kp1) times.append(time.time() -tic) Js.append(J_kp1) mu_k = mu_kp1 if extension_params['Enlarge_radius']: if len(JFE_list) > 2: if (k-1!= 0) and (JFE_list[-2]-JFE_list[-1])/(J_k-J_kp1) > 0.75: TR_parameters['radius'] *= 2 print('enlarging the TR radius to {}'.format(TR_parameters['radius'])) J_k = J_kp1 if model_has_been_enriched and TR_parameters['Qian-Grepl']: # Qian et al. method does not use the fom gradient model_has_been_enriched = False if not point_rejected: if model_has_been_enriched: print('computing the fom gradient since the model was enriched') gradient = reductor.fom.output_functional_hat_gradient(mu_k, U=u, P=p) mu_box = opt_rom.parse_parameter(opt_rom.pre_parse_parameter(opt_rom.parse_parameter_inverse(mu_k)-gradient)) first_order_criticity = opt_rom.parse_parameter_inverse(mu_k)-opt_rom.parse_parameter_inverse(projection_onto_range(parameter_space, mu_box)) normgrad = np.linalg.norm(first_order_criticity) model_has_been_enriched = False else: estimate_gradient = opt_rom.estimate_output_functional_hat_gradient_norm(mu_k, non_assembled=True) gradient = opt_rom.output_functional_hat_gradient(mu_k) mu_box = opt_rom.parse_parameter(opt_rom.pre_parse_parameter(opt_rom.parse_parameter_inverse(mu_k)-gradient)) first_order_criticity = opt_rom.parse_parameter_inverse(mu_k)-opt_rom.parse_parameter_inverse(projection_onto_range(parameter_space, mu_box)) normgrad = np.linalg.norm(first_order_criticity) FOCs.append(normgrad) if TR_parameters['Qian-Grepl']: print('estimate_gradient {}'.format(estimate_gradient)) print("First order critical condition: {}".format(normgrad)) k= k + 1 print("******************************* \n") if extension_params['Enlarge_radius']: Js = JFE_list # This is for speeding-up the post-processing computation of the error for the TR method # This procedure does not give additional speed-up to our method, # but improves only the time of the post-processing step, # to have the plot of the error, which is not counted in the computational time of the method. if k >= TR_parameters['max_iterations']: print (" WARNING: Maximum number of iteration for the TR algorithm reached") if 'timings' in extension_params: if extension_params['timings']: if return_opt_rom: return mu_list, times, Js, FOCs, opt_rom else: return mu_list, times, Js, FOCs else: return mu_list, times, Js, FOCs return mu_list
[ 1, 396, 3695, 7377, 13, 29937, 910, 934, 338, 760, 310, 278, 5650, 29901, 13, 29937, 13, 29937, 29871, 376, 29909, 405, 1164, 29899, 6007, 19094, 4214, 360, 29965, 1964, 12279, 8618, 2477, 29950, 15842, 11033, 3301, 29911, 18474, 10014, 17321, 29899, 18166, 2725, 390, 3352, 23129, 3352, 350, 3289, 3235, 13, 29937, 965, 12279, 8618, 29990, 7833, 8098, 8079, 349, 2287, 29899, 6007, 1254, 4717, 1177, 3352, 6418, 29911, 7833, 26664, 8098, 29908, 13, 29937, 13, 29937, 259, 2045, 597, 3292, 29889, 510, 29914, 29911, 29875, 9598, 309, 29914, 29940, 6530, 29899, 15728, 287, 29899, 5659, 29899, 29934, 29933, 29899, 9961, 496, 29899, 1454, 29899, 29886, 311, 29899, 3670, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 29899, 29906, 29900, 29906, 29900, 599, 18777, 29889, 2178, 10462, 21676, 29889, 13, 29937, 19245, 29901, 10413, 21144, 408, 350, 7230, 29871, 29906, 29899, 20216, 1509, 19245, 313, 1124, 597, 22156, 1167, 29889, 990, 29914, 506, 11259, 29914, 29933, 7230, 29899, 29906, 29899, 20216, 1509, 29897, 13, 29937, 13189, 943, 29901, 13, 29937, 259, 529, 5813, 29958, 313, 29906, 29900, 29896, 29929, 448, 29871, 29906, 29900, 29906, 29900, 29897, 13, 29937, 259, 529, 5813, 29958, 418, 313, 29906, 29900, 29896, 29929, 448, 29871, 29906, 29900, 29906, 29900, 29897, 13, 29937, 3695, 7377, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 931, 13, 3166, 3509, 1053, 6483, 8552, 13, 13, 3166, 282, 311, 3670, 29889, 8504, 1053, 21022, 630, 29918, 535, 29926, 29918, 5105, 408, 1605, 4661, 11135, 13, 13, 13, 13, 1753, 18246, 29918, 10268, 29918, 3881, 29898, 15501, 29918, 3493, 29892, 3887, 1125, 13, 13, 1678, 20238, 353, 3443, 29918, 3493, 29889, 29878, 6916, 13, 1678, 363, 313, 1989, 29892, 2944, 29897, 297, 3443, 29918, 3493, 29889, 15501, 29918, 1853, 29889, 7076, 7295, 13, 4706, 3464, 29918, 353, 20238, 29961, 1989, 29962, 13, 4706, 565, 2533, 29898, 667, 29897, 529, 29871, 29906, 29901, 29871, 396, 1438, 526, 278, 4251, 3861, 322, 313, 29896, 29892, 29897, 13, 9651, 565, 3887, 29961, 1989, 29962, 529, 3464, 29918, 29961, 29900, 5387, 13, 18884, 565, 2944, 1275, 313, 1125, 13, 462, 1678, 3887, 29961, 1989, 29962, 353, 3464, 29918, 29961, 29900, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 3887, 29961, 1989, 29962, 353, 518, 3881, 29918, 29961, 29900, 5262, 13, 9651, 565, 3887, 29961, 1989, 29962, 1405, 3464, 29918, 29961, 29896, 5387, 13, 18884, 565, 2944, 1275, 313, 1125, 13, 462, 1678, 3887, 29961, 1989, 29962, 353, 3464, 29918, 29961, 29896, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 3887, 29961, 1989, 29962, 353, 518, 3881, 29918, 29961, 29896, 5262, 13, 4706, 1683, 29901, 13, 9651, 363, 432, 297, 3464, 29898, 667, 29961, 29900, 29962, 1125, 13, 18884, 565, 3887, 29961, 1989, 3816, 29926, 29962, 529, 3464, 29918, 29961, 29900, 5387, 13, 462, 1678, 3887, 29961, 1989, 3816, 29926, 29962, 353, 3464, 29918, 29961, 29900, 29962, 13, 18884, 565, 3887, 29961, 1989, 3816, 29926, 29962, 1405, 3464, 29918, 29961, 29896, 5387, 13, 462, 1678, 3887, 29961, 1989, 3816, 29926, 29962, 353, 3464, 29918, 29961, 29896, 29962, 13, 1678, 736, 3887, 13, 13, 1753, 6136, 29918, 392, 29918, 262, 4925, 29918, 7224, 29898, 15501, 29918, 3493, 29892, 3887, 29892, 321, 3232, 1125, 13, 13, 1678, 3185, 353, 5159, 13, 13, 1678, 20238, 353, 3443, 29918, 3493, 29889, 29878, 6916, 13, 1678, 363, 313, 1989, 29892, 667, 29897, 297, 3443, 29918, 3493, 29889, 15501, 29918, 1853, 29889, 7076, 7295, 13, 4706, 3464, 29918, 353, 20238, 29961, 1989, 29962, 13, 4706, 565, 2533, 29898, 667, 29897, 529, 29871, 29906, 29901, 13, 9651, 565, 3887, 29961, 1989, 29962, 448, 3464, 29918, 29961, 29900, 29962, 5277, 321, 3232, 29901, 13, 18884, 3185, 29889, 4397, 29898, 29896, 29889, 29900, 29897, 13, 9651, 25342, 3464, 29918, 29961, 29896, 29962, 448, 3887, 29961, 1989, 29962, 5277, 321, 3232, 29901, 13, 18884, 3185, 29889, 4397, 29898, 29896, 29889, 29900, 29897, 13, 9651, 1683, 29901, 13, 18884, 3185, 29889, 4397, 29898, 29900, 29889, 29900, 29897, 13, 4706, 1683, 29901, 13, 9651, 363, 432, 297, 3464, 29898, 667, 29961, 29900, 29962, 1125, 13, 18884, 565, 3887, 29961, 1989, 3816, 29926, 29962, 448, 3464, 29918, 29961, 29900, 29962, 5277, 321, 3232, 29901, 13, 462, 1678, 3185, 29889, 4397, 29898, 29896, 29889, 29900, 29897, 13, 18884, 25342, 3464, 29918, 29961, 29896, 29962, 448, 3887, 29961, 1989, 3816, 29926, 29962, 5277, 321, 3232, 29901, 13, 462, 1678, 3185, 29889, 4397, 29898, 29896, 29889, 29900, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 3185, 29889, 4397, 29898, 29900, 29889, 29900, 29897, 13, 13, 1678, 3185, 353, 7442, 29889, 2378, 29898, 2865, 29897, 13, 1678, 512, 627, 353, 7442, 29889, 2873, 29898, 2865, 29889, 12181, 29897, 448, 3185, 13, 13, 1678, 736, 3185, 29892, 512, 627, 13, 13, 13, 1753, 5075, 19550, 29918, 7491, 29898, 3670, 29918, 4299, 29892, 3443, 29918, 3493, 29892, 10014, 29918, 16744, 29892, 3887, 29918, 29875, 29892, 18122, 29892, 5305, 1125, 13, 1678, 432, 353, 29871, 29900, 13, 1678, 4195, 353, 5852, 13, 1678, 1550, 4195, 322, 432, 529, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 29918, 2817, 19550, 2033, 29901, 13, 4706, 3887, 29918, 666, 29896, 353, 3887, 29918, 29875, 718, 313, 5659, 29918, 16744, 1839, 11228, 29918, 10568, 29918, 2817, 19550, 2033, 3579, 432, 29897, 334, 5305, 13, 4706, 3887, 29918, 666, 29896, 29918, 8977, 353, 3523, 29918, 4299, 29889, 558, 3039, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 666, 29896, 876, 13, 4706, 3887, 29918, 666, 29896, 29918, 8977, 353, 18246, 29918, 10268, 29918, 3881, 29898, 15501, 29918, 3493, 29892, 2589, 29918, 666, 29896, 29918, 8977, 29897, 13, 4706, 3887, 29918, 666, 29896, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 666, 29896, 29918, 8977, 29897, 13, 4706, 435, 666, 29896, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 666, 29896, 29918, 8977, 29897, 13, 13, 4706, 565, 451, 10014, 29918, 16744, 1839, 8159, 29918, 2098, 29918, 4299, 2033, 29901, 13, 9651, 318, 29918, 6814, 353, 3523, 29918, 4299, 29889, 2929, 345, 29898, 2589, 29918, 666, 29896, 29918, 8977, 29897, 13, 9651, 282, 29918, 6814, 353, 3523, 29918, 4299, 29889, 2929, 345, 29918, 700, 284, 29898, 2589, 29918, 666, 29896, 29918, 8977, 29897, 13, 9651, 707, 353, 3523, 29918, 4299, 29889, 342, 6490, 29918, 4905, 29918, 2220, 284, 29918, 2455, 29898, 29884, 29918, 6814, 29892, 282, 29918, 6814, 29892, 3887, 29918, 666, 29896, 29918, 8977, 29897, 13, 4706, 1683, 29901, 13, 9651, 707, 353, 29871, 29900, 29889, 29900, 13, 13, 4706, 565, 29871, 435, 666, 29896, 5277, 18122, 448, 313, 5659, 29918, 16744, 1839, 2817, 19550, 29918, 2312, 2033, 847, 5135, 5659, 29918, 16744, 1839, 11228, 29918, 10568, 29918, 2817, 19550, 2033, 3579, 432, 4961, 334, 313, 9302, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 666, 29896, 29899, 2589, 29918, 29875, 29897, 1068, 29906, 29897, 322, 6425, 29898, 342, 847, 435, 666, 29896, 29897, 5277, 10014, 29918, 16744, 1839, 13471, 2033, 29901, 13, 9651, 4195, 353, 7700, 13, 13, 4706, 432, 353, 432, 718, 29871, 29896, 13, 13, 1678, 565, 4195, 29901, 29871, 396, 910, 2794, 393, 591, 6876, 278, 2425, 1363, 310, 7472, 12541, 7450, 13, 4706, 1596, 703, 7976, 12539, 12541, 363, 8481, 19550, 5751, 7450, 1159, 13, 4706, 3887, 29918, 666, 29896, 353, 3887, 29918, 29875, 13, 4706, 3887, 29918, 666, 29896, 29918, 8977, 353, 3523, 29918, 4299, 29889, 558, 3039, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 666, 29896, 876, 13, 4706, 435, 666, 29896, 353, 18122, 13, 4706, 707, 353, 10014, 29918, 16744, 1839, 13471, 2033, 29930, 29967, 29875, 396, 577, 393, 278, 660, 713, 29899, 25120, 572, 1158, 17726, 408, 1532, 13, 4706, 13, 13, 1678, 736, 3887, 29918, 666, 29896, 29892, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 666, 29896, 29892, 6425, 29898, 342, 847, 435, 666, 29896, 29897, 396, 1552, 1833, 338, 4312, 363, 278, 10452, 28770, 1974, 13, 13, 1753, 10272, 29918, 1482, 29918, 29882, 404, 713, 29918, 9961, 2657, 362, 29898, 1482, 29918, 2589, 29892, 1025, 29918, 2589, 29892, 1482, 29918, 24970, 29892, 1025, 29918, 24970, 29892, 1025, 29918, 29933, 1125, 13, 13, 1678, 330, 29895, 353, 716, 29918, 24970, 29899, 1025, 29918, 24970, 13, 1678, 282, 29895, 353, 716, 29918, 2589, 29899, 1025, 29918, 2589, 13, 13, 1678, 972, 353, 330, 29895, 29889, 6333, 29898, 20571, 29897, 13, 13, 1678, 565, 972, 29958, 29900, 29889, 29900, 29901, 13, 4706, 379, 9415, 29895, 353, 2030, 29918, 29933, 29889, 6333, 29898, 29887, 29895, 29897, 13, 4706, 1302, 12352, 353, 330, 29895, 29889, 6333, 29898, 29950, 9415, 29895, 29897, 13, 13, 4706, 379, 9415, 29895, 29886, 1193, 353, 7442, 29889, 5561, 29898, 29950, 9415, 29895, 29892, 20571, 29897, 13, 13, 4706, 282, 29895, 29950, 9415, 1193, 353, 7442, 29889, 5561, 29898, 20571, 29892, 29950, 9415, 29895, 29897, 13, 13, 4706, 282, 29895, 29886, 1193, 353, 7442, 29889, 5561, 29898, 20571, 29892, 20571, 29897, 13, 13, 4706, 716, 29918, 29933, 353, 2030, 29918, 29933, 718, 313, 1145, 29974, 1111, 12352, 6802, 29898, 1145, 29930, 1145, 29897, 334, 282, 29895, 29886, 1193, 448, 313, 29896, 29889, 29900, 29914, 1145, 29897, 334, 379, 9415, 29895, 29886, 1193, 448, 313, 29896, 29889, 29900, 29914, 1145, 11877, 20571, 29950, 9415, 1193, 13, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 23902, 29894, 1535, 4195, 29901, 6571, 1642, 4830, 29898, 1145, 876, 13, 4706, 1596, 703, 27175, 5305, 304, 448, 16030, 1159, 13, 4706, 716, 29918, 29933, 353, 7442, 29889, 1032, 29872, 29898, 1025, 29918, 24970, 29889, 2311, 29897, 13, 13, 13, 1678, 736, 716, 29918, 29933, 13, 13, 1753, 10272, 29918, 1545, 2164, 29918, 29882, 404, 713, 29918, 2467, 29918, 5344, 29918, 3259, 29898, 29950, 29892, 9966, 29892, 797, 4925, 29892, 1187, 1125, 13, 13, 1678, 634, 29874, 29909, 353, 7442, 29889, 18056, 368, 29898, 9966, 29892, 634, 29874, 29897, 13, 1678, 634, 29874, 29902, 353, 7442, 29889, 18056, 368, 29898, 797, 4925, 29892, 634, 29874, 29897, 13, 13, 1678, 379, 404, 713, 29918, 10633, 353, 379, 29889, 6333, 29898, 1187, 29902, 29897, 13, 1678, 9123, 29918, 974, 29918, 1545, 2164, 29918, 29950, 353, 634, 29874, 29909, 718, 7442, 29889, 18056, 368, 29898, 797, 4925, 29892, 379, 404, 713, 29918, 10633, 29897, 13, 13, 1678, 736, 9123, 29918, 974, 29918, 1545, 2164, 29918, 29950, 13, 13, 13, 1753, 4505, 29918, 20640, 2133, 29918, 1491, 17199, 29918, 28062, 10749, 29898, 3670, 29918, 4299, 29892, 3443, 29918, 3493, 29892, 3887, 29918, 29895, 29918, 8977, 29892, 10014, 29918, 16744, 29892, 28750, 29922, 8824, 1125, 13, 1678, 565, 451, 10014, 29918, 16744, 1839, 8159, 29918, 2098, 29918, 4299, 2033, 29901, 13, 4706, 1596, 877, 22359, 6257, 1014, 17199, 1495, 13, 4706, 565, 525, 3571, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 1596, 877, 29020, 21762, 304, 278, 2322, 29871, 29900, 29889, 29929, 29945, 1495, 13, 9651, 10014, 29918, 16744, 1839, 3571, 2033, 353, 29871, 29900, 29889, 29929, 29945, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 4763, 292, 3443, 6571, 1642, 4830, 29898, 2589, 29918, 29895, 29918, 8977, 876, 13, 268, 13, 1678, 260, 293, 29918, 353, 931, 29889, 2230, 580, 13, 1678, 3064, 353, 5159, 13, 1678, 2301, 353, 5159, 13, 1678, 435, 29879, 353, 5159, 13, 1678, 18322, 29907, 29879, 353, 5159, 13, 13, 1678, 3887, 29918, 12765, 353, 29871, 29896, 29872, 29953, 13, 1678, 435, 29918, 12765, 353, 29871, 29896, 29872, 29953, 13, 1678, 18122, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 29895, 29918, 8977, 29897, 13, 13, 1678, 16030, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29898, 2589, 29918, 29895, 29918, 8977, 29897, 13, 1678, 6056, 5105, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 24970, 29897, 13, 1678, 3887, 29918, 29875, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29895, 29918, 8977, 29897, 13, 1678, 3887, 29918, 29875, 29918, 8977, 353, 3523, 29918, 4299, 29889, 558, 3039, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 876, 13, 13, 1678, 3887, 29918, 29875, 29918, 29896, 353, 3887, 29918, 29875, 448, 16030, 13, 1678, 3887, 29918, 29875, 29918, 29896, 29918, 8977, 353, 18246, 29918, 10268, 29918, 3881, 29898, 3670, 29918, 4299, 29889, 15501, 29918, 3493, 29892, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 29918, 29896, 4961, 13, 1678, 3887, 29918, 29875, 29918, 29896, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 29896, 29918, 8977, 29897, 13, 1678, 321, 3232, 29918, 29875, 353, 10014, 29918, 16744, 1839, 5463, 29918, 29875, 2033, 13, 1678, 565, 451, 338, 8758, 29898, 5463, 29918, 29875, 29892, 7411, 1125, 13, 4706, 321, 3232, 29918, 29875, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 29918, 29896, 448, 3887, 29918, 29875, 29897, 29937, 14571, 9302, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 7240, 29896, 29872, 29899, 29947, 29897, 13, 1678, 350, 353, 7442, 29889, 1032, 29872, 29898, 2589, 29918, 29875, 29889, 2311, 29897, 13, 1678, 10731, 29918, 29875, 29892, 512, 4925, 29918, 29875, 353, 6136, 29918, 392, 29918, 262, 4925, 29918, 7224, 29898, 3670, 29918, 4299, 29889, 15501, 29918, 3493, 29892, 3887, 29918, 29875, 29918, 8977, 29892, 321, 3232, 29918, 29875, 29897, 13, 13, 13, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 474, 529, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 29918, 1491, 17199, 2033, 29901, 13, 4706, 565, 474, 29958, 29900, 29901, 13, 9651, 565, 451, 10014, 29918, 16744, 1839, 8159, 29918, 2098, 29918, 4299, 2033, 29901, 13, 18884, 565, 10452, 29918, 5659, 29918, 29883, 5385, 1974, 6736, 10014, 29918, 16744, 1839, 3571, 2033, 29930, 5659, 29918, 16744, 1839, 13471, 2033, 29901, 13, 462, 1678, 1596, 877, 9917, 653, 28770, 1974, 310, 278, 10014, 15787, 29892, 577, 25480, 278, 1014, 29899, 17199, 899, 369, 1495, 13, 462, 268, 13, 462, 1678, 736, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 6814, 29892, 474, 29892, 435, 666, 29896, 29892, 18322, 29907, 29879, 13, 18884, 565, 6056, 5105, 529, 10014, 29918, 16744, 1839, 1491, 29918, 25027, 261, 749, 2033, 470, 435, 29918, 12765, 529, 10014, 29918, 16744, 1839, 29879, 2142, 3305, 29918, 25027, 261, 749, 2033, 470, 3887, 29918, 12765, 29966, 10014, 29918, 16744, 1839, 29879, 2142, 3305, 29918, 25027, 261, 749, 2033, 29901, 13, 462, 1678, 1596, 703, 4035, 17199, 5486, 3192, 29901, 18322, 29907, 353, 24335, 3887, 29918, 12765, 353, 24335, 435, 29918, 12765, 353, 6571, 11393, 4830, 29898, 12324, 5105, 29892, 2589, 29918, 12765, 29892, 29967, 29918, 12765, 876, 13, 462, 1678, 2867, 13, 13, 9651, 1683, 29901, 13, 18884, 565, 6056, 5105, 529, 10014, 29918, 16744, 1839, 1491, 29918, 25027, 261, 749, 2033, 29901, 13, 462, 1678, 1596, 703, 1168, 369, 3192, 29901, 18322, 29907, 353, 6571, 1642, 4830, 29898, 12324, 5105, 876, 13, 462, 1678, 2867, 13, 13, 4706, 565, 474, 1275, 29871, 29900, 322, 451, 10014, 29918, 16744, 1839, 8159, 29918, 2098, 29918, 4299, 2033, 29901, 13, 9651, 1596, 703, 20606, 292, 278, 26368, 315, 13989, 29891, 1298, 322, 769, 1369, 278, 350, 29943, 10749, 1158, 1159, 13, 9651, 5305, 353, 448, 24970, 13, 4706, 1683, 29901, 13, 9651, 565, 512, 4925, 29918, 29875, 29889, 2083, 580, 1275, 29871, 29900, 29889, 29900, 29901, 13, 18884, 565, 10014, 29918, 16744, 3366, 8159, 29918, 2098, 29918, 4299, 3108, 29901, 13, 462, 1678, 1596, 703, 3596, 18111, 526, 6136, 29892, 306, 626, 773, 448, 24970, 408, 5305, 1159, 13, 18884, 5305, 353, 448, 24970, 13, 9651, 1683, 29901, 13, 18884, 5305, 353, 10272, 29918, 1545, 2164, 29918, 29882, 404, 713, 29918, 2467, 29918, 5344, 29918, 3259, 29898, 29933, 29892, 10731, 29918, 29875, 29892, 512, 4925, 29918, 29875, 29892, 448, 24970, 29897, 13, 9651, 565, 7442, 29889, 6333, 29898, 20845, 29892, 24970, 29897, 1405, 29871, 29900, 29901, 13, 18884, 1596, 877, 3664, 263, 5153, 3906, 5305, 2023, 5622, 448, 24970, 408, 5305, 1495, 13, 18884, 5305, 353, 448, 24970, 13, 259, 13, 4706, 565, 10014, 29918, 16744, 3366, 8159, 29918, 2098, 29918, 4299, 3108, 29901, 13, 9651, 3887, 29918, 666, 29896, 29892, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 666, 29896, 29892, 903, 353, 5075, 19550, 29918, 7491, 29898, 3670, 29918, 4299, 29892, 3443, 29918, 3493, 29892, 10014, 29918, 16744, 29892, 3887, 29918, 29875, 29892, 18122, 29892, 5305, 29897, 13, 4706, 1683, 29901, 13, 9651, 3887, 29918, 666, 29896, 29892, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 666, 29896, 29892, 10452, 29918, 5659, 29918, 29883, 5385, 1974, 353, 5075, 19550, 29918, 7491, 29898, 3670, 29918, 4299, 29892, 3443, 29918, 3493, 29892, 10014, 29918, 16744, 29892, 3887, 29918, 29875, 29892, 18122, 29892, 5305, 29897, 13, 632, 13, 4706, 565, 474, 1275, 29871, 29900, 29901, 13, 9651, 565, 451, 10014, 29918, 16744, 1839, 8159, 29918, 2098, 29918, 4299, 2033, 29901, 13, 18884, 435, 6814, 353, 435, 666, 29896, 13, 9651, 1683, 29901, 13, 18884, 435, 6814, 353, 6213, 13, 13, 4706, 3887, 29918, 12765, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 448, 3887, 29918, 666, 29896, 29897, 847, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 29897, 13, 4706, 435, 29918, 12765, 353, 6425, 29898, 29967, 29875, 448, 435, 666, 29896, 29897, 847, 6425, 29898, 29967, 29875, 29897, 13, 4706, 2030, 29918, 2589, 353, 6483, 8552, 29898, 2589, 29918, 29875, 29897, 13, 4706, 3887, 29918, 29875, 29918, 8977, 353, 3887, 29918, 666, 29896, 29918, 8977, 13, 4706, 18122, 353, 435, 666, 29896, 13, 13, 4706, 2030, 29918, 24970, 353, 6483, 8552, 29898, 24970, 29897, 13, 4706, 16030, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29898, 2589, 29918, 29875, 29918, 8977, 29897, 13, 4706, 3887, 29918, 1884, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 8977, 6817, 24970, 876, 13, 4706, 937, 29918, 2098, 29918, 9695, 24798, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 8977, 6817, 3670, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 771, 6929, 29918, 10268, 29918, 3881, 29898, 15501, 29918, 3493, 29892, 3887, 29918, 1884, 876, 13, 4706, 6056, 5105, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 4102, 29918, 2098, 29918, 9695, 24798, 29897, 13, 4706, 3887, 29918, 29875, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 8977, 29897, 13, 4706, 3887, 29918, 29875, 29918, 8977, 353, 3523, 29918, 4299, 29889, 558, 3039, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 876, 13, 13, 4706, 3887, 29918, 29875, 29918, 29896, 353, 3887, 29918, 29875, 448, 16030, 13, 4706, 3887, 29918, 29875, 29918, 29896, 29918, 8977, 353, 18246, 29918, 10268, 29918, 3881, 29898, 3670, 29918, 4299, 29889, 15501, 29918, 3493, 29892, 3670, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 29918, 29896, 4961, 13, 4706, 3887, 29918, 29875, 29918, 29896, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 29896, 29918, 8977, 29897, 13, 4706, 565, 451, 338, 8758, 29898, 5463, 29918, 29875, 29892, 7411, 1125, 13, 9651, 321, 3232, 29918, 29875, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 29918, 29896, 448, 3887, 29918, 29875, 29897, 13, 4706, 10731, 29918, 29875, 29892, 512, 4925, 29918, 29875, 353, 6136, 29918, 392, 29918, 262, 4925, 29918, 7224, 29898, 3670, 29918, 4299, 29889, 15501, 29918, 3493, 29892, 3887, 29918, 29875, 29918, 8977, 29892, 321, 3232, 29918, 29875, 29897, 13, 4706, 350, 353, 10272, 29918, 1482, 29918, 29882, 404, 713, 29918, 9961, 2657, 362, 29898, 2589, 29918, 29875, 29892, 2030, 29918, 2589, 29892, 16030, 29892, 2030, 29918, 24970, 29892, 350, 29897, 13, 13, 4706, 565, 10014, 29918, 16744, 3366, 8159, 29918, 2098, 29918, 4299, 3108, 29901, 13, 9651, 1596, 703, 14448, 24335, 13303, 6571, 1919, 18322, 29907, 4195, 6571, 1642, 4830, 29898, 2589, 29918, 666, 29896, 29892, 18122, 29892, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 4102, 29918, 2098, 29918, 9695, 24798, 4961, 13, 4706, 13, 4706, 3064, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 29873, 293, 19925, 13, 4706, 2301, 29889, 4397, 29898, 2589, 29918, 666, 29896, 29897, 13, 4706, 435, 29879, 29889, 4397, 29898, 29967, 29875, 29897, 13, 4706, 18322, 29907, 29879, 29889, 4397, 29898, 12324, 5105, 29897, 13, 4706, 474, 353, 474, 718, 29871, 29896, 13, 13, 1678, 1596, 703, 22925, 12651, 3887, 6571, 322, 435, 6571, 1642, 4830, 29898, 2589, 29918, 12765, 29892, 435, 29918, 12765, 876, 13, 13, 1678, 565, 28750, 29901, 13, 4706, 736, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 6814, 29892, 474, 29892, 435, 666, 29896, 29892, 3064, 29892, 2301, 29892, 435, 29879, 29892, 18322, 29907, 29879, 13, 1678, 1683, 29901, 13, 4706, 736, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 6814, 29892, 474, 29892, 435, 666, 29896, 29892, 18322, 29907, 29879, 13, 13, 13, 1753, 9120, 29918, 29882, 404, 713, 29918, 2467, 29898, 2589, 29892, 9966, 29892, 797, 4925, 29892, 3670, 29918, 4299, 29892, 1187, 1125, 13, 268, 13, 1678, 396, 501, 8485, 871, 491, 278, 2060, 287, 19017, 8108, 13, 13, 1678, 634, 29874, 29909, 353, 7442, 29889, 18056, 368, 29898, 9966, 29892, 1187, 29897, 13, 1678, 634, 29874, 29902, 353, 7442, 29889, 18056, 368, 29898, 797, 4925, 29892, 1187, 29897, 13, 13, 1678, 9123, 29918, 265, 29918, 29902, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 29882, 404, 713, 29918, 6891, 29898, 2589, 29892, 634, 29874, 29902, 29892, 7700, 29897, 13, 13, 1678, 9123, 29918, 974, 29918, 1545, 2164, 29918, 6891, 353, 634, 29874, 29909, 718, 7442, 29889, 18056, 368, 29898, 797, 4925, 29892, 4276, 29918, 265, 29918, 29902, 29897, 13, 13, 1678, 736, 9123, 29918, 974, 29918, 1545, 2164, 29918, 6891, 13, 13, 13, 1753, 4505, 29918, 20640, 2133, 29918, 4373, 880, 4062, 29898, 3670, 29918, 4299, 29892, 3443, 29918, 3493, 29892, 3887, 29918, 29895, 29918, 8977, 29892, 10014, 29918, 16744, 29892, 28750, 29922, 8824, 1125, 13, 1678, 396, 4013, 1158, 338, 1304, 304, 10272, 385, 16232, 16845, 310, 278, 14413, 3443, 3887, 29918, 1646, 411, 278, 383, 6488, 29889, 13, 1678, 396, 313, 2624, 1474, 884, 297, 278, 5534, 4122, 7584, 467, 739, 338, 451, 1304, 297, 278, 10014, 5687, 297, 445, 5650, 29889, 13, 1678, 13, 1678, 1596, 703, 4763, 292, 3443, 6571, 1642, 4830, 29898, 2589, 29918, 29895, 29918, 8977, 876, 268, 13, 13, 1678, 565, 525, 10945, 29918, 29934, 29933, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 4706, 10014, 29918, 16744, 1839, 10945, 29918, 29934, 29933, 2033, 29922, 8824, 13, 13, 1678, 260, 293, 29918, 517, 29883, 353, 931, 29889, 2230, 580, 13, 1678, 3064, 353, 5159, 13, 1678, 2301, 353, 5159, 13, 1678, 435, 29879, 353, 5159, 13, 1678, 18322, 29907, 29879, 353, 5159, 13, 1678, 435, 6814, 353, 6213, 13, 13, 1678, 3887, 29918, 12765, 353, 29871, 29896, 29872, 29953, 13, 1678, 435, 29918, 12765, 353, 29871, 29896, 29872, 29953, 13, 1678, 18122, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 29895, 29918, 8977, 29897, 13, 13, 1678, 16030, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29898, 2589, 29918, 29895, 29918, 8977, 29897, 13, 1678, 6056, 5105, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 24970, 29897, 13, 1678, 3887, 29918, 29875, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29895, 29918, 8977, 29897, 13, 1678, 3887, 29918, 29875, 29918, 8977, 353, 3523, 29918, 4299, 29889, 558, 3039, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 876, 13, 13, 1678, 3887, 29918, 29875, 29918, 29896, 353, 3887, 29918, 29875, 448, 16030, 13, 1678, 3887, 29918, 29875, 29918, 29896, 29918, 8977, 353, 18246, 29918, 10268, 29918, 3881, 29898, 3670, 29918, 4299, 29889, 15501, 29918, 3493, 29892, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 29918, 29896, 4961, 13, 1678, 3887, 29918, 29875, 29918, 29896, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 29896, 29918, 8977, 29897, 13, 1678, 321, 3232, 29918, 29875, 353, 10014, 29918, 16744, 1839, 5463, 29918, 29875, 2033, 13, 1678, 565, 451, 338, 8758, 29898, 5463, 29918, 29875, 29892, 7411, 1125, 13, 4706, 321, 3232, 29918, 29875, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 29918, 29896, 448, 3887, 29918, 29875, 29897, 13, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 474, 529, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 2033, 29901, 13, 4706, 565, 474, 29958, 29900, 29901, 13, 9651, 565, 10014, 29918, 16744, 1839, 8159, 29918, 2098, 29918, 4299, 2033, 470, 10014, 29918, 16744, 1839, 10945, 29918, 29934, 29933, 2033, 29901, 13, 18884, 565, 6056, 5105, 529, 10014, 29918, 16744, 1839, 1491, 29918, 25027, 261, 749, 2033, 29901, 13, 462, 1678, 1596, 703, 1168, 369, 3192, 29901, 18322, 29907, 353, 6571, 1642, 4830, 29898, 12324, 5105, 876, 13, 462, 1678, 2867, 13, 13, 308, 13, 4706, 10731, 29918, 29875, 29892, 512, 4925, 29918, 29875, 353, 6136, 29918, 392, 29918, 262, 4925, 29918, 7224, 29898, 3670, 29918, 4299, 29889, 15501, 29918, 3493, 29892, 3887, 29918, 29875, 29918, 8977, 29892, 321, 3232, 29918, 29875, 29897, 13, 13, 4706, 565, 512, 4925, 29918, 29875, 29889, 2083, 580, 1275, 29871, 29900, 29889, 29900, 29901, 13, 9651, 628, 29873, 314, 29884, 353, 16030, 13, 9651, 565, 10014, 29918, 16744, 3366, 8159, 29918, 2098, 29918, 4299, 3108, 470, 10014, 29918, 16744, 1839, 10945, 29918, 29934, 29933, 2033, 29901, 13, 18884, 1596, 703, 29902, 626, 773, 2060, 287, 16030, 2012, 310, 19017, 1159, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 15156, 21022, 630, 8446, 363, 278, 5608, 1788, 1159, 13, 9651, 628, 29873, 314, 29884, 29892, 372, 29883, 29887, 29892, 690, 29883, 29887, 29892, 3041, 542, 29887, 353, 1605, 4661, 11135, 29898, 29909, 29918, 9891, 29922, 2892, 325, 29901, 9120, 29918, 29882, 404, 713, 29918, 2467, 29898, 2589, 29922, 2589, 29918, 29875, 29918, 8977, 29892, 10731, 29922, 10731, 29918, 29875, 29892, 512, 4925, 29922, 512, 4925, 29918, 29875, 29892, 3523, 29918, 4299, 29922, 3670, 29918, 4299, 29892, 634, 29874, 29922, 29894, 511, 289, 29922, 16030, 29892, 304, 29880, 353, 29871, 29896, 29889, 29872, 29899, 29896, 29900, 29897, 13, 9651, 565, 3041, 542, 29887, 1405, 29871, 29900, 29901, 13, 18884, 1596, 703, 15954, 14556, 278, 16030, 408, 5305, 1159, 13, 18884, 628, 29873, 314, 29884, 353, 16030, 13, 9651, 565, 7442, 29889, 6333, 6278, 29881, 2152, 314, 29884, 29892, 24970, 29897, 6736, 448, 29896, 29889, 29872, 29899, 29896, 29946, 29901, 13, 18884, 1596, 877, 3664, 263, 5153, 3906, 5305, 2023, 5622, 16030, 408, 5305, 1495, 13, 18884, 628, 29873, 314, 29884, 353, 16030, 13, 308, 13, 4706, 3887, 29918, 666, 29896, 29892, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 666, 29896, 29892, 17117, 353, 5075, 19550, 29918, 7491, 29898, 3670, 29918, 4299, 29892, 3443, 29918, 3493, 29892, 10014, 29918, 16744, 29892, 3887, 29918, 29875, 29892, 18122, 29892, 448, 29881, 2152, 314, 29884, 29897, 13, 13, 4706, 3887, 29918, 12765, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 448, 3887, 29918, 666, 29896, 29897, 847, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 29897, 13, 4706, 435, 29918, 12765, 353, 6425, 29898, 29967, 29875, 448, 435, 666, 29896, 29897, 847, 6425, 29898, 29967, 29875, 29897, 13, 4706, 3887, 29918, 29875, 29918, 8977, 353, 3887, 29918, 666, 29896, 29918, 8977, 13, 4706, 18122, 353, 435, 666, 29896, 13, 13, 4706, 16030, 353, 3523, 29918, 4299, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29898, 2589, 29918, 29875, 29918, 8977, 29897, 13, 4706, 3887, 29918, 1884, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 8977, 6817, 24970, 876, 13, 4706, 937, 29918, 2098, 29918, 9695, 24798, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 8977, 6817, 3670, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 771, 6929, 29918, 10268, 29918, 3881, 29898, 15501, 29918, 3493, 29892, 3887, 29918, 1884, 876, 13, 4706, 6056, 5105, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 4102, 29918, 2098, 29918, 9695, 24798, 29897, 13, 308, 13, 4706, 3887, 29918, 29875, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 8977, 29897, 13, 4706, 3887, 29918, 29875, 29918, 8977, 353, 3523, 29918, 4299, 29889, 558, 3039, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 876, 13, 13, 4706, 3887, 29918, 29875, 29918, 29896, 353, 3887, 29918, 29875, 448, 16030, 13, 4706, 3887, 29918, 29875, 29918, 29896, 29918, 8977, 353, 18246, 29918, 10268, 29918, 3881, 29898, 3670, 29918, 4299, 29889, 15501, 29918, 3493, 29892, 3670, 29918, 4299, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 4299, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 2589, 29918, 29875, 29918, 29896, 4961, 13, 4706, 3887, 29918, 29875, 29918, 29896, 353, 3523, 29918, 4299, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29875, 29918, 29896, 29918, 8977, 29897, 13, 4706, 565, 451, 338, 8758, 29898, 5463, 29918, 29875, 29892, 7411, 1125, 13, 9651, 321, 3232, 29918, 29875, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 2589, 29918, 29875, 29918, 29896, 448, 3887, 29918, 29875, 29897, 13, 13, 308, 13, 4706, 1596, 703, 14448, 24335, 13303, 6571, 1919, 18322, 29907, 4195, 6571, 1642, 4830, 29898, 2589, 29918, 666, 29896, 29892, 18122, 29892, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 4102, 29918, 2098, 29918, 9695, 24798, 4961, 13, 308, 13, 4706, 3064, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 29873, 293, 29918, 517, 29883, 29897, 13, 4706, 2301, 29889, 4397, 29898, 2589, 29918, 666, 29896, 29897, 13, 4706, 435, 29879, 29889, 4397, 29898, 29967, 29875, 29897, 13, 4706, 18322, 29907, 29879, 29889, 4397, 29898, 12324, 5105, 29897, 13, 308, 13, 4706, 474, 353, 474, 718, 29871, 29896, 13, 13, 1678, 1596, 703, 22925, 12651, 3887, 6571, 322, 435, 6571, 1642, 4830, 29898, 2589, 29918, 12765, 29892, 435, 29918, 12765, 876, 13, 13, 1678, 565, 28750, 29901, 13, 4706, 736, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 6814, 29892, 474, 29892, 435, 666, 29896, 29892, 3064, 29892, 2301, 29892, 435, 29879, 29892, 18322, 29907, 29879, 13, 1678, 1683, 29901, 13, 4706, 736, 3887, 29918, 666, 29896, 29918, 8977, 29892, 435, 6814, 29892, 474, 29892, 435, 666, 29896, 29892, 18322, 29907, 29879, 29892, 29871, 29900, 13, 13, 13, 1753, 427, 4018, 358, 29918, 10568, 29898, 2589, 29892, 337, 2199, 272, 29892, 3523, 29918, 29888, 290, 29922, 8516, 1125, 13, 1678, 716, 29918, 276, 2199, 272, 353, 6483, 8552, 29898, 276, 2199, 272, 29897, 13, 1678, 318, 29892, 282, 353, 716, 29918, 276, 2199, 272, 29889, 21843, 29918, 29890, 2129, 29898, 2589, 29897, 13, 1678, 3523, 29918, 456, 353, 716, 29918, 276, 2199, 272, 29889, 17469, 580, 13, 1678, 736, 3523, 29918, 456, 29892, 716, 29918, 276, 2199, 272, 29892, 318, 29892, 282, 13, 13, 13, 1753, 10014, 29918, 20567, 29898, 3670, 29918, 456, 29892, 337, 2199, 272, 29892, 10014, 29918, 16744, 29922, 8516, 29892, 6081, 29918, 7529, 29922, 8516, 29892, 3523, 29918, 29888, 290, 29922, 8516, 29892, 736, 29918, 3670, 29918, 456, 29922, 8824, 1125, 13, 1678, 565, 10014, 29918, 16744, 338, 6213, 29901, 13, 4706, 3887, 29918, 29895, 353, 3523, 29918, 456, 29889, 15501, 29918, 3493, 29889, 11249, 29918, 8172, 368, 29898, 29896, 9601, 29900, 29962, 13, 4706, 10014, 29918, 16744, 353, 11117, 13471, 2396, 29871, 29900, 29889, 29896, 29892, 525, 1491, 29918, 25027, 261, 749, 2396, 29871, 29896, 29872, 29899, 29947, 29892, 525, 3317, 29918, 1524, 800, 2396, 29871, 29941, 29900, 29892, 525, 3317, 29918, 1524, 800, 29918, 1491, 17199, 2396, 29946, 29900, 29900, 29892, 13, 462, 308, 525, 2962, 292, 29918, 15501, 2396, 3887, 29918, 29895, 29892, 525, 3317, 29918, 1524, 800, 29918, 2817, 19550, 2396, 29871, 29945, 29900, 29892, 525, 11228, 29918, 10568, 29918, 2817, 19550, 2396, 29871, 29900, 29889, 29945, 29892, 29871, 13, 462, 308, 525, 2817, 19550, 29918, 2312, 2396, 29871, 29896, 29872, 29899, 29946, 29892, 525, 8159, 29918, 2098, 29918, 4299, 2396, 7700, 29892, 29871, 13, 462, 308, 525, 5463, 29918, 29875, 2396, 29871, 29896, 29872, 29899, 29947, 29892, 525, 29984, 713, 29899, 25120, 572, 2396, 7700, 29892, 525, 29879, 2142, 3305, 29918, 25027, 261, 749, 2396, 29871, 29896, 29872, 29899, 29896, 29953, 29892, 525, 3571, 2396, 29871, 29900, 29889, 29929, 29945, 29913, 13, 1678, 1683, 29901, 13, 4706, 565, 525, 13471, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 13471, 2033, 353, 29871, 29900, 29889, 29896, 13, 4706, 565, 525, 1491, 29918, 25027, 261, 749, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 1491, 29918, 25027, 261, 749, 2033, 353, 29871, 29896, 29872, 29899, 29947, 13, 4706, 565, 525, 3317, 29918, 1524, 800, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 2033, 353, 29871, 29941, 29900, 13, 4706, 565, 525, 3317, 29918, 1524, 800, 29918, 1491, 17199, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 29918, 1491, 17199, 2033, 353, 29871, 29946, 29900, 29900, 13, 4706, 565, 525, 2962, 292, 29918, 15501, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 2962, 292, 29918, 15501, 2033, 353, 3523, 29918, 456, 29889, 15501, 29918, 3493, 29889, 11249, 29918, 8172, 368, 29898, 29896, 9601, 29900, 29962, 13, 4706, 565, 525, 3317, 29918, 1524, 800, 29918, 2817, 19550, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 29918, 2817, 19550, 2033, 353, 29871, 29945, 29900, 13, 4706, 565, 525, 11228, 29918, 10568, 29918, 2817, 19550, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 11228, 29918, 10568, 29918, 2817, 19550, 2033, 353, 29871, 29900, 29889, 29945, 13, 4706, 565, 525, 2817, 19550, 29918, 2312, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 2817, 19550, 29918, 2312, 2033, 353, 29871, 29896, 29889, 29872, 29899, 29946, 13, 4706, 565, 525, 8159, 29918, 2098, 29918, 4299, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 8159, 29918, 2098, 29918, 4299, 2033, 353, 7700, 13, 4706, 565, 525, 2158, 292, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 2158, 292, 2033, 353, 7700, 13, 4706, 565, 525, 5463, 29918, 29875, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 5463, 29918, 29875, 2033, 353, 29871, 29896, 29872, 29899, 29947, 13, 4706, 565, 525, 29984, 713, 29899, 25120, 572, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 29984, 713, 29899, 25120, 572, 2033, 353, 7700, 13, 4706, 565, 525, 29879, 2142, 3305, 29918, 25027, 261, 749, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 29879, 2142, 3305, 29918, 25027, 261, 749, 2033, 353, 29871, 29896, 29872, 29899, 29896, 29953, 13, 4706, 565, 525, 3571, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 9651, 10014, 29918, 16744, 1839, 3571, 2033, 353, 29871, 29900, 29889, 29929, 29945, 13, 308, 13, 4706, 3887, 29918, 29895, 353, 10014, 29918, 16744, 1839, 2962, 292, 29918, 15501, 2033, 13, 308, 13, 632, 13, 13, 1678, 565, 6081, 29918, 7529, 338, 6213, 29901, 13, 4706, 6081, 29918, 7529, 3790, 29915, 5596, 29918, 2146, 600, 29918, 392, 29918, 484, 29883, 29918, 1116, 2187, 2396, 5852, 29892, 525, 2369, 16961, 29918, 13471, 2396, 5852, 29892, 525, 3670, 29918, 29888, 290, 2396, 6213, 500, 13, 1678, 25342, 10014, 29918, 16744, 1839, 29984, 713, 29899, 25120, 572, 2033, 29901, 13, 4706, 6081, 29918, 7529, 1839, 5596, 29918, 2146, 600, 29918, 392, 29918, 484, 29883, 29918, 1116, 2187, 2033, 353, 5852, 13, 4706, 6081, 29918, 7529, 1839, 2369, 16961, 29918, 13471, 2033, 353, 7700, 13, 4706, 565, 525, 3670, 29918, 29888, 290, 29915, 451, 297, 6081, 29918, 7529, 29901, 13, 9651, 6081, 29918, 7529, 1839, 3670, 29918, 29888, 290, 2033, 353, 6213, 13, 1678, 1683, 29901, 13, 4706, 565, 525, 5596, 29918, 2146, 600, 29918, 392, 29918, 484, 29883, 29918, 1116, 2187, 29915, 451, 297, 6081, 29918, 7529, 29901, 13, 9651, 6081, 29918, 7529, 1839, 5596, 29918, 2146, 600, 29918, 392, 29918, 484, 29883, 29918, 1116, 2187, 2033, 353, 5852, 13, 4706, 565, 525, 2369, 16961, 29918, 13471, 29915, 451, 297, 6081, 29918, 7529, 29901, 13, 9651, 6081, 29918, 7529, 1839, 2369, 16961, 29918, 13471, 2033, 353, 5852, 13, 4706, 565, 525, 3670, 29918, 29888, 290, 29915, 451, 297, 6081, 29918, 7529, 29901, 13, 9651, 6081, 29918, 7529, 1839, 3670, 29918, 29888, 290, 2033, 353, 6213, 13, 268, 13, 1678, 565, 3523, 29918, 29888, 290, 338, 6213, 29901, 13, 4706, 3523, 29918, 29888, 290, 353, 6081, 29918, 7529, 1839, 3670, 29918, 29888, 290, 2033, 13, 13, 1678, 565, 525, 5800, 29907, 29918, 25027, 261, 749, 29915, 451, 297, 10014, 29918, 16744, 29901, 13, 4706, 10014, 29918, 16744, 1839, 5800, 29907, 29918, 25027, 261, 749, 2033, 353, 10014, 29918, 16744, 1839, 1491, 29918, 25027, 261, 749, 2033, 13, 308, 13, 1678, 565, 10014, 29918, 16744, 1839, 29984, 713, 29899, 25120, 572, 2033, 29901, 13, 4706, 1596, 877, 29984, 29902, 2190, 634, 394, 29889, 29871, 29906, 29900, 29896, 29955, 8108, 1495, 13, 268, 13, 1678, 1596, 877, 2962, 292, 3443, 6571, 4286, 4830, 29898, 2589, 29918, 29895, 876, 13, 13, 1678, 396, 5335, 886, 13, 1678, 260, 293, 353, 931, 29889, 2230, 580, 13, 1678, 435, 29879, 353, 5159, 13, 1678, 18322, 29907, 29879, 353, 5159, 13, 1678, 3064, 353, 5159, 13, 13, 1678, 3443, 29918, 3493, 353, 3523, 29918, 456, 29889, 15501, 29918, 3493, 13, 1678, 3887, 29918, 1761, 353, 5159, 13, 1678, 3887, 29918, 1761, 29889, 4397, 29898, 2589, 29918, 29895, 29897, 13, 1678, 435, 16359, 29918, 1761, 353, 5159, 13, 1678, 6056, 5105, 353, 29871, 29896, 29872, 29953, 13, 1678, 12678, 29918, 24970, 353, 29871, 29896, 29872, 29953, 396, 501, 8485, 871, 363, 660, 713, 634, 394, 29889, 1158, 13, 1678, 1904, 29918, 5349, 29918, 915, 264, 29918, 264, 4018, 287, 353, 7700, 13, 1678, 1298, 29918, 276, 622, 287, 353, 7700, 13, 1678, 435, 29918, 29895, 353, 3523, 29918, 456, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 29895, 29897, 13, 1678, 1596, 703, 4763, 292, 995, 310, 278, 3438, 29901, 6571, 1642, 4830, 29898, 29967, 29918, 29895, 876, 13, 1678, 1596, 703, 7775, 4189, 2328, 17435, 320, 29876, 1159, 13, 1678, 413, 353, 29871, 29900, 13, 1678, 1550, 413, 529, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 2033, 29901, 13, 4706, 565, 1298, 29918, 276, 622, 287, 29901, 13, 9651, 1298, 29918, 276, 622, 287, 353, 7700, 13, 9651, 565, 10014, 29918, 16744, 1839, 13471, 2033, 529, 29871, 29906, 29889, 29906, 29906, 29930, 29896, 29872, 29899, 29896, 29953, 29901, 13, 18884, 1596, 28909, 29876, 5659, 29899, 13471, 338, 2400, 4933, 16716, 856, 25480, 1495, 13, 18884, 2867, 13, 4706, 1683, 29901, 13, 9651, 565, 451, 10014, 29918, 16744, 1839, 29984, 713, 29899, 25120, 572, 2033, 29901, 13, 18884, 565, 313, 12324, 5105, 529, 10014, 29918, 16744, 1839, 5800, 29907, 29918, 25027, 261, 749, 2033, 1125, 13, 462, 1678, 1596, 28909, 29876, 20754, 3262, 16614, 6095, 26940, 29901, 383, 6488, 18322, 29907, 4195, 6571, 15300, 4830, 29898, 12324, 5105, 876, 13, 462, 1678, 2867, 13, 9651, 1683, 29901, 13, 18884, 565, 313, 12324, 5105, 718, 12678, 29918, 24970, 529, 10014, 29918, 16744, 1839, 5800, 29907, 29918, 25027, 261, 749, 2033, 1125, 13, 462, 1678, 1596, 28909, 29876, 20754, 3262, 16614, 6095, 26940, 29901, 6056, 5105, 6571, 718, 12678, 29918, 24970, 6571, 4286, 4830, 29898, 12324, 5105, 29892, 342, 6490, 29918, 24970, 876, 13, 462, 1678, 2867, 13, 308, 13, 4706, 3887, 29918, 29895, 29886, 29896, 29892, 435, 6814, 29892, 432, 29892, 435, 29918, 29895, 29886, 29896, 29892, 903, 29871, 353, 4505, 29918, 20640, 2133, 29918, 1491, 17199, 29918, 28062, 10749, 29898, 3670, 29918, 456, 29892, 3443, 29918, 3493, 29892, 3887, 29918, 29895, 29892, 13, 462, 462, 462, 462, 462, 10014, 29918, 16744, 29897, 9651, 13, 4706, 318, 29918, 456, 353, 3523, 29918, 456, 29889, 2929, 345, 29898, 2589, 29918, 29895, 29886, 29896, 29897, 13, 4706, 282, 29918, 456, 353, 3523, 29918, 456, 29889, 2929, 345, 29918, 700, 284, 29898, 2589, 29918, 29895, 29886, 29896, 29892, 501, 29922, 29884, 29918, 456, 29897, 13, 308, 13, 4706, 12678, 29918, 29967, 353, 3523, 29918, 456, 29889, 342, 6490, 29918, 4905, 29918, 2220, 284, 29918, 2455, 29898, 29884, 29918, 456, 29892, 282, 29918, 456, 29892, 3887, 29918, 29895, 29886, 29896, 29897, 13, 13, 4706, 565, 10014, 29918, 16744, 1839, 29984, 713, 29899, 25120, 572, 2033, 29901, 13, 9651, 12678, 29918, 24970, 353, 3523, 29918, 456, 29889, 342, 6490, 29918, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29918, 12324, 29898, 2589, 29918, 29895, 29886, 29896, 29892, 318, 29918, 456, 29892, 282, 29918, 456, 29897, 13, 308, 13, 4706, 565, 435, 29918, 29895, 29886, 29896, 718, 12678, 29918, 29967, 529, 435, 6814, 29901, 13, 13, 9651, 1596, 877, 11238, 8002, 4195, 29892, 6257, 278, 427, 4018, 358, 1495, 13, 13, 9651, 3523, 29918, 456, 29892, 337, 2199, 272, 29892, 318, 29892, 282, 353, 427, 4018, 358, 29918, 10568, 29898, 2589, 29918, 29895, 29886, 29896, 29892, 337, 2199, 272, 29892, 3523, 29918, 29888, 290, 29922, 17588, 29918, 7529, 1839, 3670, 29918, 29888, 290, 11287, 13, 9651, 435, 16359, 29918, 1761, 29889, 4397, 29898, 276, 2199, 272, 29889, 29888, 290, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 29895, 29886, 29896, 29892, 29884, 876, 13, 9651, 1904, 29918, 5349, 29918, 915, 264, 29918, 264, 4018, 287, 353, 5852, 13, 13, 13, 9651, 565, 6081, 29918, 7529, 1839, 2369, 16961, 29918, 13471, 2033, 29901, 13, 18884, 565, 7431, 29898, 29967, 16359, 29918, 1761, 29897, 1405, 29871, 29906, 29901, 13, 462, 1678, 565, 313, 29895, 29899, 29896, 19216, 29871, 29900, 29897, 322, 313, 29967, 16359, 29918, 1761, 14352, 29906, 29962, 29899, 29967, 16359, 29918, 1761, 14352, 29896, 2314, 14571, 29967, 29918, 29895, 29899, 29967, 29918, 29895, 29886, 29896, 29897, 1405, 29871, 29900, 29889, 29955, 29945, 29901, 13, 462, 4706, 10014, 29918, 16744, 1839, 13471, 2033, 334, 29922, 29871, 29906, 13, 462, 4706, 1596, 877, 264, 27489, 292, 278, 10014, 11855, 304, 6571, 4286, 4830, 29898, 5659, 29918, 16744, 1839, 13471, 25901, 13, 13, 9651, 1596, 703, 29895, 29901, 6571, 448, 432, 6571, 448, 9839, 6680, 284, 29901, 6571, 448, 3887, 29901, 6571, 1642, 4830, 29898, 29895, 29892, 432, 29892, 435, 29918, 29895, 29886, 29896, 29892, 3887, 29918, 29895, 29886, 29896, 876, 13, 9651, 3887, 29918, 1761, 29889, 4397, 29898, 2589, 29918, 29895, 29886, 29896, 29897, 13, 9651, 3064, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 29873, 293, 29897, 13, 9651, 435, 29879, 29889, 4397, 29898, 29967, 29918, 29895, 29886, 29896, 29897, 13, 9651, 3887, 29918, 29895, 353, 3887, 29918, 29895, 29886, 29896, 13, 9651, 435, 29918, 29895, 353, 3523, 29918, 456, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 29895, 29897, 13, 13, 4706, 25342, 435, 29918, 29895, 29886, 29896, 448, 12678, 29918, 29967, 1405, 435, 6814, 29901, 13, 9651, 1596, 877, 15107, 653, 4195, 5229, 1495, 13, 9651, 10014, 29918, 16744, 1839, 13471, 2033, 353, 10014, 29918, 16744, 1839, 13471, 2033, 334, 29871, 29900, 29889, 29945, 13, 9651, 1596, 703, 29903, 1092, 18159, 278, 10014, 11855, 304, 29901, 6571, 1363, 435, 6814, 6571, 322, 435, 29918, 29895, 29886, 29896, 6571, 1642, 4830, 29898, 5659, 29918, 16744, 1839, 13471, 7464, 435, 6814, 29892, 13, 462, 462, 462, 462, 462, 418, 435, 29918, 29895, 29886, 29896, 876, 13, 9651, 1298, 29918, 276, 622, 287, 353, 5852, 13, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 264, 4018, 292, 304, 1423, 278, 8002, 23806, 4195, 1495, 13, 13, 9651, 716, 29918, 456, 29892, 716, 29918, 276, 2199, 272, 29892, 318, 29892, 282, 353, 427, 4018, 358, 29918, 10568, 29898, 2589, 29918, 29895, 29886, 29896, 29892, 337, 2199, 272, 29892, 3523, 29918, 29888, 290, 29922, 17588, 29918, 7529, 1839, 3670, 29918, 29888, 290, 11287, 13, 9651, 435, 16359, 29918, 1761, 29889, 4397, 29898, 276, 2199, 272, 29889, 29888, 290, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 29895, 29886, 29896, 29892, 318, 876, 13, 9651, 1904, 29918, 5349, 29918, 915, 264, 29918, 264, 4018, 287, 353, 5852, 13, 13, 13, 13, 9651, 435, 29918, 29895, 29886, 29896, 353, 716, 29918, 456, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29898, 2589, 29918, 29895, 29886, 29896, 29897, 13, 9651, 1596, 703, 29895, 29901, 6571, 448, 432, 6571, 448, 9839, 6680, 284, 29901, 6571, 448, 3887, 29901, 6571, 1642, 4830, 29898, 29895, 29892, 432, 29892, 435, 29918, 29895, 29886, 29896, 29892, 3887, 29918, 29895, 29886, 29896, 876, 13, 13, 9651, 565, 435, 29918, 29895, 29886, 29896, 1405, 435, 6814, 718, 29871, 29896, 29872, 29899, 29947, 29901, 1678, 396, 788, 263, 15332, 20341, 749, 310, 29871, 29896, 29872, 29899, 29947, 363, 4772, 292, 16259, 25806, 9545, 13, 18884, 10014, 29918, 16744, 1839, 13471, 2033, 353, 10014, 29918, 16744, 1839, 13471, 2033, 334, 29871, 29900, 29889, 29945, 13, 18884, 1596, 703, 29903, 1092, 18159, 278, 10014, 11855, 304, 29901, 6571, 1363, 435, 6814, 6571, 322, 435, 29918, 29895, 29886, 29896, 6571, 1642, 4830, 29898, 5659, 29918, 16744, 1839, 13471, 2033, 13, 462, 462, 462, 462, 462, 3986, 1919, 29967, 6814, 29892, 29967, 29918, 29895, 29886, 29896, 876, 13, 18884, 1298, 29918, 276, 622, 287, 353, 5852, 13, 18884, 435, 16359, 29918, 1761, 29889, 7323, 6278, 29896, 29897, 396, 4806, 817, 304, 3349, 278, 995, 515, 278, 1051, 29892, 1363, 591, 12560, 278, 3443, 13, 13, 9651, 1683, 29901, 13, 18884, 3523, 29918, 456, 353, 716, 29918, 456, 13, 18884, 337, 2199, 272, 353, 716, 29918, 276, 2199, 272, 13, 18884, 3887, 29918, 1761, 29889, 4397, 29898, 2589, 29918, 29895, 29886, 29896, 29897, 13, 18884, 3064, 29889, 4397, 29898, 2230, 29889, 2230, 580, 448, 29873, 293, 29897, 13, 18884, 435, 29879, 29889, 4397, 29898, 29967, 29918, 29895, 29886, 29896, 29897, 13, 18884, 3887, 29918, 29895, 353, 3887, 29918, 29895, 29886, 29896, 13, 18884, 565, 6081, 29918, 7529, 1839, 2369, 16961, 29918, 13471, 2033, 29901, 13, 462, 1678, 565, 7431, 29898, 29967, 16359, 29918, 1761, 29897, 1405, 29871, 29906, 29901, 13, 462, 4706, 565, 313, 29895, 29899, 29896, 19216, 29871, 29900, 29897, 322, 313, 29967, 16359, 29918, 1761, 14352, 29906, 29962, 29899, 29967, 16359, 29918, 1761, 14352, 29896, 2314, 14571, 29967, 29918, 29895, 29899, 29967, 29918, 29895, 29886, 29896, 29897, 1405, 29871, 29900, 29889, 29955, 29945, 29901, 13, 462, 9651, 10014, 29918, 16744, 1839, 13471, 2033, 334, 29922, 29871, 29906, 13, 462, 9651, 1596, 877, 264, 27489, 292, 278, 10014, 11855, 304, 6571, 4286, 4830, 29898, 5659, 29918, 16744, 1839, 13471, 25901, 13, 18884, 435, 29918, 29895, 353, 435, 29918, 29895, 29886, 29896, 13, 13, 13, 4706, 565, 1904, 29918, 5349, 29918, 915, 264, 29918, 264, 4018, 287, 322, 10014, 29918, 16744, 1839, 29984, 713, 29899, 25120, 572, 2033, 29901, 13, 9651, 396, 660, 713, 634, 394, 29889, 1158, 947, 451, 671, 278, 285, 290, 16030, 13, 9651, 1904, 29918, 5349, 29918, 915, 264, 29918, 264, 4018, 287, 353, 7700, 13, 13, 4706, 565, 451, 1298, 29918, 276, 622, 287, 29901, 13, 9651, 565, 1904, 29918, 5349, 29918, 915, 264, 29918, 264, 4018, 287, 29901, 13, 18884, 1596, 877, 12097, 292, 278, 285, 290, 16030, 1951, 278, 1904, 471, 427, 4018, 287, 1495, 13, 18884, 16030, 353, 337, 2199, 272, 29889, 29888, 290, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29898, 2589, 29918, 29895, 29892, 501, 29922, 29884, 29892, 349, 29922, 29886, 29897, 13, 18884, 3887, 29918, 1884, 353, 3523, 29918, 456, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 456, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 3670, 29918, 456, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29895, 6817, 24970, 876, 13, 18884, 937, 29918, 2098, 29918, 9695, 24798, 353, 3523, 29918, 456, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29895, 6817, 3670, 29918, 456, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 771, 6929, 29918, 10268, 29918, 3881, 29898, 15501, 29918, 3493, 29892, 3887, 29918, 1884, 876, 13, 18884, 6056, 5105, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 4102, 29918, 2098, 29918, 9695, 24798, 29897, 13, 18884, 1904, 29918, 5349, 29918, 915, 264, 29918, 264, 4018, 287, 353, 7700, 13, 9651, 1683, 29901, 13, 18884, 12678, 29918, 24970, 353, 3523, 29918, 456, 29889, 342, 6490, 29918, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29918, 12324, 29898, 2589, 29918, 29895, 29892, 1661, 29918, 465, 6967, 29881, 29922, 5574, 29897, 13, 18884, 16030, 353, 3523, 29918, 456, 29889, 4905, 29918, 2220, 284, 29918, 2455, 29918, 24970, 29898, 2589, 29918, 29895, 29897, 13, 18884, 3887, 29918, 1884, 353, 3523, 29918, 456, 29889, 5510, 29918, 15501, 29898, 3670, 29918, 456, 29889, 1457, 29918, 5510, 29918, 15501, 29898, 3670, 29918, 456, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29895, 6817, 24970, 876, 13, 18884, 937, 29918, 2098, 29918, 9695, 24798, 353, 3523, 29918, 456, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 2589, 29918, 29895, 6817, 3670, 29918, 456, 29889, 5510, 29918, 15501, 29918, 262, 3901, 29898, 771, 6929, 29918, 10268, 29918, 3881, 29898, 15501, 29918, 3493, 29892, 3887, 29918, 1884, 876, 13, 18884, 6056, 5105, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 4102, 29918, 2098, 29918, 9695, 24798, 29897, 13, 13, 13, 9651, 18322, 29907, 29879, 29889, 4397, 29898, 12324, 5105, 29897, 13, 13, 9651, 565, 10014, 29918, 16744, 1839, 29984, 713, 29899, 25120, 572, 2033, 29901, 13, 18884, 1596, 877, 342, 6490, 29918, 24970, 6571, 4286, 4830, 29898, 342, 6490, 29918, 24970, 876, 13, 9651, 1596, 703, 6730, 1797, 12187, 4195, 29901, 6571, 1642, 4830, 29898, 12324, 5105, 876, 13, 13, 9651, 413, 29922, 413, 718, 29871, 29896, 13, 4706, 1596, 703, 7775, 4189, 2328, 17435, 320, 29876, 1159, 13, 1678, 13, 13, 1678, 565, 6081, 29918, 7529, 1839, 2369, 16961, 29918, 13471, 2033, 29901, 13, 4706, 435, 29879, 353, 435, 16359, 29918, 1761, 29871, 396, 910, 338, 363, 6210, 292, 29899, 786, 278, 1400, 29899, 19170, 16287, 310, 278, 1059, 363, 278, 10014, 1158, 13, 462, 539, 396, 910, 8792, 947, 451, 2367, 5684, 6210, 29899, 786, 304, 1749, 1158, 29892, 29871, 13, 462, 539, 396, 541, 4857, 1960, 871, 278, 931, 310, 278, 1400, 29899, 19170, 4331, 29892, 13, 462, 539, 396, 304, 505, 278, 6492, 310, 278, 1059, 29892, 607, 338, 451, 29115, 297, 278, 26845, 931, 310, 278, 1158, 29889, 13, 13, 1678, 565, 413, 6736, 10014, 29918, 16744, 1839, 3317, 29918, 1524, 800, 2033, 29901, 13, 4706, 1596, 4852, 399, 25614, 29901, 5918, 12539, 1353, 310, 12541, 363, 278, 10014, 5687, 7450, 1159, 13, 1678, 13, 1678, 565, 525, 9346, 886, 29915, 297, 6081, 29918, 7529, 29901, 13, 4706, 565, 6081, 29918, 7529, 1839, 9346, 886, 2033, 29901, 13, 9651, 565, 736, 29918, 3670, 29918, 456, 29901, 268, 13, 18884, 736, 3887, 29918, 1761, 29892, 3064, 29892, 435, 29879, 29892, 18322, 29907, 29879, 29892, 3523, 29918, 456, 13, 9651, 1683, 29901, 13, 18884, 736, 3887, 29918, 1761, 29892, 3064, 29892, 435, 29879, 29892, 18322, 29907, 29879, 13, 4706, 1683, 29901, 13, 9651, 736, 3887, 29918, 1761, 29892, 3064, 29892, 435, 29879, 29892, 18322, 29907, 29879, 13, 13, 1678, 736, 3887, 29918, 1761, 13, 2 ]
src/processing/data_processor.py
niksaz/semantic-code-search
1
128741
import os from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, Any from dpu_utils.utils import RichPath from tqdm import tqdm class DataProcessor(ABC): def __init__(self): self.skipped = 0 self.failed = 0 def parse_subfolders(self, input_folder: Path, output_folder: Path) -> None: self.skipped = 0 self.failed = 0 subfolders = os.listdir(input_folder) input_subfolders = [input_folder / f for f in subfolders] output_subfolders = [output_folder / f for f in subfolders] for input_subfolder, output_subfolder in zip(input_subfolders, output_subfolders): self.parse_folder(input_subfolder, output_subfolder) print(f"Skipped {self.skipped} files\nFailed on {self.failed} files") def parse_folder(self, input_folder: Path, output_folder: Path) -> None: if not output_folder.exists(): os.makedirs(output_folder) files = [input_folder / file for file in os.listdir(input_folder)] for file in files: self.parse_jsonl_file(file, output_folder) def parse_jsonl_file(self, file: Path, output_folder: Path) -> None: print(f"Parsing data in {file}") input_file = RichPath.create(str(file)) output_file = RichPath.create(str(output_folder / input_file.basename())) parsed_code = [ self.process_data(self.extract_from_raw_data(raw_json_object)) for raw_json_object in tqdm(input_file.read_by_file_suffix()) ] print(f"Saving processed data in {output_file}") output_file.save_as_compressed_file(parsed_code) @abstractmethod def extract_from_raw_data(self, raw_json_object: Dict[str, Any]) -> Any: pass @abstractmethod def process_data(self, code: str) -> Dict[str, Any]: pass
[ 1, 1053, 2897, 13, 3166, 25638, 1053, 16417, 29892, 9846, 5696, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 19229, 1053, 360, 919, 29892, 3139, 13, 13, 3166, 270, 3746, 29918, 13239, 29889, 13239, 1053, 4385, 2605, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 13, 13, 1990, 3630, 18689, 29898, 19658, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 2574, 2986, 353, 29871, 29900, 13, 4706, 1583, 29889, 26061, 353, 29871, 29900, 13, 13, 1678, 822, 6088, 29918, 1491, 8771, 414, 29898, 1311, 29892, 1881, 29918, 12083, 29901, 10802, 29892, 1962, 29918, 12083, 29901, 10802, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 2574, 2986, 353, 29871, 29900, 13, 4706, 1583, 29889, 26061, 353, 29871, 29900, 13, 13, 4706, 1014, 8771, 414, 353, 2897, 29889, 1761, 3972, 29898, 2080, 29918, 12083, 29897, 13, 4706, 1881, 29918, 1491, 8771, 414, 353, 518, 2080, 29918, 12083, 847, 285, 363, 285, 297, 1014, 8771, 414, 29962, 13, 4706, 1962, 29918, 1491, 8771, 414, 353, 518, 4905, 29918, 12083, 847, 285, 363, 285, 297, 1014, 8771, 414, 29962, 13, 4706, 363, 1881, 29918, 1491, 12083, 29892, 1962, 29918, 1491, 12083, 297, 14319, 29898, 2080, 29918, 1491, 8771, 414, 29892, 1962, 29918, 1491, 8771, 414, 1125, 13, 9651, 1583, 29889, 5510, 29918, 12083, 29898, 2080, 29918, 1491, 12083, 29892, 1962, 29918, 1491, 12083, 29897, 13, 13, 4706, 1596, 29898, 29888, 29908, 29903, 1984, 2986, 426, 1311, 29889, 2574, 2986, 29913, 2066, 29905, 29876, 17776, 373, 426, 1311, 29889, 26061, 29913, 2066, 1159, 13, 13, 1678, 822, 6088, 29918, 12083, 29898, 1311, 29892, 1881, 29918, 12083, 29901, 10802, 29892, 1962, 29918, 12083, 29901, 10802, 29897, 1599, 6213, 29901, 13, 4706, 565, 451, 1962, 29918, 12083, 29889, 9933, 7295, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 4905, 29918, 12083, 29897, 13, 13, 4706, 2066, 353, 518, 2080, 29918, 12083, 847, 934, 363, 934, 297, 2897, 29889, 1761, 3972, 29898, 2080, 29918, 12083, 4638, 13, 4706, 363, 934, 297, 2066, 29901, 13, 9651, 1583, 29889, 5510, 29918, 3126, 29880, 29918, 1445, 29898, 1445, 29892, 1962, 29918, 12083, 29897, 13, 13, 1678, 822, 6088, 29918, 3126, 29880, 29918, 1445, 29898, 1311, 29892, 934, 29901, 10802, 29892, 1962, 29918, 12083, 29901, 10802, 29897, 1599, 6213, 29901, 13, 4706, 1596, 29898, 29888, 29908, 29925, 1503, 292, 848, 297, 426, 1445, 27195, 13, 4706, 1881, 29918, 1445, 353, 4385, 2605, 29889, 3258, 29898, 710, 29898, 1445, 876, 13, 4706, 1962, 29918, 1445, 353, 4385, 2605, 29889, 3258, 29898, 710, 29898, 4905, 29918, 12083, 847, 1881, 29918, 1445, 29889, 6500, 3871, 22130, 13, 4706, 21213, 29918, 401, 353, 518, 13, 9651, 1583, 29889, 5014, 29918, 1272, 29898, 1311, 29889, 21111, 29918, 3166, 29918, 1610, 29918, 1272, 29898, 1610, 29918, 3126, 29918, 3318, 876, 13, 9651, 363, 10650, 29918, 3126, 29918, 3318, 297, 260, 29939, 18933, 29898, 2080, 29918, 1445, 29889, 949, 29918, 1609, 29918, 1445, 29918, 2146, 600, 861, 3101, 13, 4706, 4514, 13, 4706, 1596, 29898, 29888, 29908, 29903, 5555, 19356, 848, 297, 426, 4905, 29918, 1445, 27195, 13, 4706, 1962, 29918, 1445, 29889, 7620, 29918, 294, 29918, 510, 13120, 29918, 1445, 29898, 862, 8485, 29918, 401, 29897, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 6597, 29918, 3166, 29918, 1610, 29918, 1272, 29898, 1311, 29892, 10650, 29918, 3126, 29918, 3318, 29901, 360, 919, 29961, 710, 29892, 3139, 2314, 1599, 3139, 29901, 13, 4706, 1209, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 1889, 29918, 1272, 29898, 1311, 29892, 775, 29901, 851, 29897, 1599, 360, 919, 29961, 710, 29892, 3139, 5387, 13, 4706, 1209, 13, 2 ]
queue-using-stacks/queue_using_stacks.py
blairg23/common-interview-problems
0
1616899
<filename>queue-using-stacks/queue_using_stacks.py # Task # - Implement a Queue using Stacks # Example: # >>> a = Stack() # >>> a.push(1) # >>> a.push(2) # >>> a.push(3) # >>> a.pop() # 3 # >>> a.pop() # 2 # >>> a.pop() # 1 # >>> a.pop() # IndexError: list index out of range import time # Solutions copied from https://www.geeksforgeeks.org/queue-using-stacks/ # # Method 1 classic solution (making enqueue method costly) # # enQueue = O(N), deQueue = O(1) # # enQueue(q, x): # While stack1 is not empty, push everything from stack1 to stack2. # Push x to stack1 (assuming size of stacks is unlimited). # Push everything back to stack1. # Here time complexity will be O(n) # # deQueue(q): # If stack1 is empty then error # Pop an item from stack1 and return it # Here time complexity will be O(1) class Method1Queue: def __init__(self): self.s1 = [] self.s2 = [] def enQueue(self, x): # Move all elements from s1 to s2 while len(self.s1) != 0: self.s2.append(self.s1[-1]) self.s1.pop() # Push item into self.s1 self.s1.append(x) # Push everything back to s1 while len(self.s2) != 0: self.s1.append(self.s2[-1]) self.s2.pop() # Dequeue an item from the queue def deQueue(self): # if first stack is empty if len(self.s1) == 0: print("Q is Empty") # Return top of self.s1 x = self.s1[-1] self.s1.pop() return x # Method 2, making dequeue method costly # # enQueue = O(1), deQueue = O(N) # enQueue(q, x) # 1) Push x to stack1 (assuming size of stacks is unlimited). # Here time complexity will be O(1) # # deQueue(q) # 1) If both stacks are empty then error. # 2) If stack2 is empty # While stack1 is not empty, push everything from stack1 to stack2. # 3) Pop the element from stack2 and return it. # Here time complexity will be O(n) class Method2Queue: def __init__(self): self.s1 = [] self.s2 = [] # EnQueue item to the queue def enQueue(self, x): self.s1.append(x) # DeQueue item from the queue def deQueue(self): # if both the stacks are empty if len(self.s1) == 0 and len(self.s2) == 0: print("Q is Empty") return # if s2 is empty and s1 has elements elif len(self.s2) == 0 and len(self.s1) > 0: while len(self.s1): temp = self.s1.pop() self.s2.append(temp) return self.s2.pop() else: return self.s2.pop() # Method 3, implementation of Method 2 using one user stack and one Function Call stack # # enQueue(x) # 1) Push x to stack1. # # deQueue: # 1) If stack1 is empty then error. # 2) If stack1 has only one element then return it. # 3) Recursively pop everything from the stack1, store the popped item # in a variable res, push the res back to stack1 and return res class Method3Queue: def __init__(self): self.s = [] # Enqueue an item to the queue def enQueue(self, data): self.s.append(data) # Dequeue an item from the queue def deQueue(self): # Return if queue is empty if len(self.s) <= 0: print('Queue is empty') return # pop an item from the stack x = self.s[len(self.s) - 1] self.s.pop() # if stack become empty # return the popped item if len(self.s) <= 0: return x # recursive call item = self.deQueue() # push popped item back to # the stack self.s.append(x) # return the result of # deQueue() call return item # Complexity of these operations? def meta(q, N): for i in range(N): q.enQueue(i) for i in range(N): q.deQueue() if __name__ == '__main__': N = 500 print("Using Method 1") start = time.time() q = Method1Queue() meta(q=q, N=N) end = time.time() print(f"Method 1 takes {end - start}") print("Using Method 2") start = time.time() q = Method2Queue() meta(q=q, N=N) end = time.time() print(f"Method 2 takes {end - start}") print("Using Method 3") start = time.time() q = Method3Queue() meta(q=q, N=N) end = time.time() print(f"Method 3 takes {end - start}")
[ 1, 529, 9507, 29958, 9990, 29899, 4746, 29899, 1429, 29879, 29914, 9990, 29918, 4746, 29918, 1429, 29879, 29889, 2272, 13, 29937, 9330, 13, 29937, 448, 1954, 2037, 263, 5462, 434, 773, 10292, 29879, 13, 13, 29937, 8741, 29901, 13, 29937, 8653, 263, 353, 10292, 580, 13, 29937, 8653, 263, 29889, 5910, 29898, 29896, 29897, 13, 29937, 8653, 263, 29889, 5910, 29898, 29906, 29897, 13, 29937, 8653, 263, 29889, 5910, 29898, 29941, 29897, 13, 29937, 8653, 263, 29889, 7323, 580, 13, 29937, 1678, 29941, 13, 29937, 8653, 263, 29889, 7323, 580, 13, 29937, 1678, 29906, 13, 29937, 8653, 263, 29889, 7323, 580, 13, 29937, 1678, 29896, 13, 29937, 8653, 263, 29889, 7323, 580, 13, 29937, 259, 11374, 2392, 29901, 1051, 2380, 714, 310, 3464, 13, 13, 5215, 931, 13, 13, 29937, 4956, 17925, 13746, 515, 2045, 597, 1636, 29889, 479, 14541, 20324, 14541, 29889, 990, 29914, 9990, 29899, 4746, 29899, 1429, 29879, 29914, 13, 13, 29937, 13, 29937, 8108, 29871, 29896, 22037, 1650, 313, 28990, 427, 9990, 1158, 3438, 368, 29897, 13, 29937, 13, 29937, 427, 10620, 353, 438, 29898, 29940, 511, 316, 10620, 353, 438, 29898, 29896, 29897, 13, 29937, 13, 29937, 427, 10620, 29898, 29939, 29892, 921, 1125, 13, 29937, 5806, 5096, 29896, 338, 451, 4069, 29892, 5503, 4129, 515, 5096, 29896, 304, 5096, 29906, 29889, 13, 29937, 349, 1878, 921, 304, 5096, 29896, 313, 465, 9929, 2159, 310, 5096, 29879, 338, 443, 29044, 467, 13, 29937, 349, 1878, 4129, 1250, 304, 5096, 29896, 29889, 13, 29937, 2266, 931, 13644, 674, 367, 438, 29898, 29876, 29897, 13, 29937, 13, 29937, 316, 10620, 29898, 29939, 1125, 13, 29937, 960, 5096, 29896, 338, 4069, 769, 1059, 13, 29937, 6977, 385, 2944, 515, 5096, 29896, 322, 736, 372, 13, 29937, 2266, 931, 13644, 674, 367, 438, 29898, 29896, 29897, 13, 1990, 8108, 29896, 10620, 29901, 259, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 29871, 13, 4706, 1583, 29889, 29879, 29896, 353, 5159, 29871, 13, 4706, 1583, 29889, 29879, 29906, 353, 5159, 29871, 13, 259, 13, 1678, 822, 427, 10620, 29898, 1311, 29892, 921, 1125, 29871, 13, 965, 13, 4706, 396, 25249, 599, 3161, 515, 269, 29896, 304, 269, 29906, 259, 13, 4706, 1550, 7431, 29898, 1311, 29889, 29879, 29896, 29897, 2804, 29871, 29900, 29901, 259, 13, 9651, 1583, 29889, 29879, 29906, 29889, 4397, 29898, 1311, 29889, 29879, 29896, 14352, 29896, 2314, 259, 13, 9651, 1583, 29889, 29879, 29896, 29889, 7323, 580, 29871, 13, 259, 13, 4706, 396, 349, 1878, 2944, 964, 1583, 29889, 29879, 29896, 259, 13, 4706, 1583, 29889, 29879, 29896, 29889, 4397, 29898, 29916, 29897, 259, 13, 259, 13, 4706, 396, 349, 1878, 4129, 1250, 304, 269, 29896, 259, 13, 4706, 1550, 7431, 29898, 1311, 29889, 29879, 29906, 29897, 2804, 29871, 29900, 29901, 259, 13, 9651, 1583, 29889, 29879, 29896, 29889, 4397, 29898, 1311, 29889, 29879, 29906, 14352, 29896, 2314, 259, 13, 9651, 1583, 29889, 29879, 29906, 29889, 7323, 580, 29871, 13, 259, 13, 1678, 396, 897, 9990, 385, 2944, 515, 278, 9521, 259, 13, 1678, 822, 316, 10620, 29898, 1311, 1125, 29871, 13, 965, 13, 9651, 396, 565, 937, 5096, 338, 4069, 259, 13, 4706, 565, 7431, 29898, 1311, 29889, 29879, 29896, 29897, 1275, 29871, 29900, 29901, 259, 13, 9651, 1596, 703, 29984, 338, 2812, 2349, 1159, 29871, 13, 539, 13, 4706, 396, 7106, 2246, 310, 1583, 29889, 29879, 29896, 259, 13, 4706, 921, 353, 1583, 29889, 29879, 29896, 14352, 29896, 29962, 259, 13, 4706, 1583, 29889, 29879, 29896, 29889, 7323, 580, 259, 13, 4706, 736, 921, 29871, 13, 13, 13, 29937, 8108, 29871, 29906, 29892, 3907, 316, 9990, 1158, 3438, 368, 13, 29937, 13, 29937, 427, 10620, 353, 438, 29898, 29896, 511, 316, 10620, 353, 438, 29898, 29940, 29897, 13, 29937, 427, 10620, 29898, 29939, 29892, 29871, 921, 29897, 13, 29937, 1678, 29896, 29897, 349, 1878, 921, 304, 5096, 29896, 313, 465, 9929, 2159, 310, 5096, 29879, 338, 443, 29044, 467, 13, 29937, 2266, 931, 13644, 674, 367, 438, 29898, 29896, 29897, 13, 29937, 13, 29937, 316, 10620, 29898, 29939, 29897, 13, 29937, 1678, 29896, 29897, 960, 1716, 5096, 29879, 526, 4069, 769, 1059, 29889, 13, 29937, 1678, 29906, 29897, 960, 5096, 29906, 338, 4069, 13, 29937, 4706, 5806, 5096, 29896, 338, 451, 4069, 29892, 5503, 4129, 515, 5096, 29896, 304, 5096, 29906, 29889, 13, 29937, 1678, 29941, 29897, 6977, 278, 1543, 515, 5096, 29906, 322, 736, 372, 29889, 13, 29937, 2266, 931, 13644, 674, 367, 438, 29898, 29876, 29897, 13, 1990, 8108, 29906, 10620, 29901, 29871, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 29871, 13, 4706, 1583, 29889, 29879, 29896, 353, 5159, 29871, 13, 4706, 1583, 29889, 29879, 29906, 353, 5159, 29871, 13, 259, 13, 1678, 396, 1174, 10620, 2944, 304, 278, 9521, 29871, 13, 1678, 822, 427, 10620, 29898, 1311, 29892, 921, 1125, 29871, 13, 4706, 1583, 29889, 29879, 29896, 29889, 4397, 29898, 29916, 29897, 29871, 13, 259, 13, 1678, 396, 897, 10620, 2944, 515, 278, 9521, 29871, 13, 1678, 822, 316, 10620, 29898, 1311, 1125, 29871, 13, 259, 13, 4706, 396, 565, 1716, 278, 5096, 29879, 526, 4069, 29871, 13, 4706, 565, 7431, 29898, 1311, 29889, 29879, 29896, 29897, 1275, 29871, 29900, 322, 7431, 29898, 1311, 29889, 29879, 29906, 29897, 1275, 29871, 29900, 29901, 29871, 13, 9651, 1596, 703, 29984, 338, 2812, 2349, 1159, 29871, 13, 9651, 736, 13, 259, 13, 4706, 396, 565, 269, 29906, 338, 4069, 322, 269, 29896, 756, 3161, 29871, 13, 4706, 25342, 7431, 29898, 1311, 29889, 29879, 29906, 29897, 1275, 29871, 29900, 322, 7431, 29898, 1311, 29889, 29879, 29896, 29897, 1405, 29871, 29900, 29901, 29871, 13, 9651, 1550, 7431, 29898, 1311, 29889, 29879, 29896, 1125, 29871, 13, 18884, 5694, 353, 1583, 29889, 29879, 29896, 29889, 7323, 580, 29871, 13, 18884, 1583, 29889, 29879, 29906, 29889, 4397, 29898, 7382, 29897, 29871, 13, 9651, 736, 1583, 29889, 29879, 29906, 29889, 7323, 580, 29871, 13, 259, 13, 4706, 1683, 29901, 29871, 13, 9651, 736, 1583, 29889, 29879, 29906, 29889, 7323, 580, 29871, 13, 13, 29937, 8108, 29871, 29941, 29892, 5314, 310, 8108, 29871, 29906, 773, 697, 1404, 5096, 322, 697, 6680, 8251, 5096, 13, 29937, 13, 29937, 427, 10620, 29898, 29916, 29897, 13, 29937, 1678, 29896, 29897, 349, 1878, 921, 304, 5096, 29896, 29889, 13, 29937, 13, 29937, 316, 10620, 29901, 13, 29937, 1678, 29896, 29897, 960, 5096, 29896, 338, 4069, 769, 1059, 29889, 13, 29937, 1678, 29906, 29897, 960, 5096, 29896, 756, 871, 697, 1543, 769, 736, 372, 29889, 13, 29937, 1678, 29941, 29897, 3599, 1295, 3598, 1835, 4129, 515, 278, 5096, 29896, 29892, 3787, 278, 772, 2986, 2944, 29871, 13, 29937, 268, 297, 263, 2286, 620, 29892, 29871, 5503, 278, 620, 1250, 304, 5096, 29896, 322, 736, 620, 13, 1990, 8108, 29941, 10620, 29901, 29871, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 29871, 13, 4706, 1583, 29889, 29879, 353, 5159, 29871, 13, 965, 13, 1678, 396, 1174, 9990, 385, 2944, 304, 278, 9521, 259, 13, 1678, 822, 427, 10620, 29898, 1311, 29892, 848, 1125, 29871, 13, 4706, 1583, 29889, 29879, 29889, 4397, 29898, 1272, 29897, 29871, 13, 965, 13, 1678, 396, 897, 9990, 385, 2944, 515, 278, 9521, 259, 13, 1678, 822, 316, 10620, 29898, 1311, 1125, 29871, 13, 4706, 396, 7106, 565, 9521, 338, 4069, 29871, 13, 4706, 565, 7431, 29898, 1311, 29889, 29879, 29897, 5277, 29871, 29900, 29901, 29871, 13, 9651, 1596, 877, 10620, 338, 4069, 1495, 29871, 13, 9651, 736, 13, 965, 13, 4706, 396, 1835, 385, 2944, 515, 278, 5096, 29871, 13, 4706, 921, 353, 1583, 29889, 29879, 29961, 2435, 29898, 1311, 29889, 29879, 29897, 448, 29871, 29896, 29962, 29871, 13, 4706, 1583, 29889, 29879, 29889, 7323, 580, 29871, 13, 965, 13, 4706, 396, 565, 5096, 4953, 4069, 29871, 13, 4706, 396, 736, 278, 772, 2986, 2944, 29871, 13, 4706, 565, 7431, 29898, 1311, 29889, 29879, 29897, 5277, 29871, 29900, 29901, 29871, 13, 9651, 736, 921, 29871, 13, 1669, 13, 4706, 396, 16732, 1246, 29871, 13, 4706, 2944, 353, 1583, 29889, 311, 10620, 580, 29871, 13, 965, 13, 4706, 396, 5503, 772, 2986, 2944, 1250, 304, 29871, 13, 4706, 396, 278, 5096, 29871, 13, 4706, 1583, 29889, 29879, 29889, 4397, 29898, 29916, 29897, 29871, 13, 965, 13, 4706, 396, 736, 278, 1121, 310, 259, 13, 4706, 396, 316, 10620, 580, 1246, 29871, 13, 4706, 736, 2944, 29871, 13, 13, 29937, 26596, 537, 310, 1438, 6931, 29973, 13, 1753, 12700, 29898, 29939, 29892, 405, 1125, 13, 1678, 363, 474, 297, 3464, 29898, 29940, 1125, 13, 4706, 3855, 29889, 264, 10620, 29898, 29875, 29897, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29940, 1125, 13, 4706, 3855, 29889, 311, 10620, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 29871, 13, 1678, 405, 353, 29871, 29945, 29900, 29900, 13, 13, 1678, 1596, 703, 15156, 8108, 29871, 29896, 1159, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 3855, 353, 8108, 29896, 10620, 580, 29871, 13, 1678, 12700, 29898, 29939, 29922, 29939, 29892, 405, 29922, 29940, 29897, 13, 1678, 1095, 353, 931, 29889, 2230, 580, 29871, 13, 1678, 1596, 29898, 29888, 29908, 4062, 29871, 29896, 4893, 426, 355, 448, 1369, 27195, 13, 13, 1678, 1596, 703, 15156, 8108, 29871, 29906, 1159, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 3855, 353, 8108, 29906, 10620, 580, 29871, 13, 1678, 12700, 29898, 29939, 29922, 29939, 29892, 405, 29922, 29940, 29897, 13, 1678, 1095, 353, 931, 29889, 2230, 580, 29871, 13, 1678, 1596, 29898, 29888, 29908, 4062, 29871, 29906, 4893, 426, 355, 448, 1369, 27195, 13, 13, 1678, 1596, 703, 15156, 8108, 29871, 29941, 1159, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 3855, 353, 8108, 29941, 10620, 580, 29871, 13, 1678, 12700, 29898, 29939, 29922, 29939, 29892, 405, 29922, 29940, 29897, 13, 1678, 1095, 353, 931, 29889, 2230, 580, 29871, 13, 1678, 1596, 29898, 29888, 29908, 4062, 29871, 29941, 4893, 426, 355, 448, 1369, 27195, 13, 2 ]
entangle/http.py
radiantone/entangle
102
110889
<filename>entangle/http.py """ http.py - Module that provides http oriented decorators """ from functools import partial import requests def request(function=None, timeout=None, url=None, method='GET', sleep=None): """ :param function: :param timeout: :param url: :param method: :param sleep: :return: """ def decorator(func): def wrapper(f_func): # Build http request function here, get result # call func with result def invoke_request(_func, **kwargs): def make_request(url, method, data): if method == 'GET': response = requests.get(url=url, params=data) return response.content return None response = make_request(url, method, kwargs) return _func(response) pfunc = partial(invoke_request, f_func) pfunc.__name__ = func.__name__ return pfunc return wrapper(func) if function is not None: return decorator(function) return decorator
[ 1, 529, 9507, 29958, 296, 2521, 29914, 1124, 29889, 2272, 13, 15945, 29908, 13, 1124, 29889, 2272, 448, 15591, 393, 8128, 1732, 7769, 287, 10200, 4097, 13, 15945, 29908, 13, 3166, 2090, 312, 8789, 1053, 7687, 13, 5215, 7274, 13, 13, 13, 1753, 2009, 29898, 2220, 29922, 8516, 29892, 13, 9651, 11815, 29922, 8516, 29892, 13, 9651, 3142, 29922, 8516, 29892, 13, 9651, 1158, 2433, 7194, 742, 13, 9651, 8709, 29922, 8516, 1125, 13, 1678, 9995, 13, 13, 1678, 584, 3207, 740, 29901, 13, 1678, 584, 3207, 11815, 29901, 13, 1678, 584, 3207, 3142, 29901, 13, 1678, 584, 3207, 1158, 29901, 13, 1678, 584, 3207, 8709, 29901, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 822, 10200, 1061, 29898, 9891, 1125, 13, 4706, 822, 14476, 29898, 29888, 29918, 9891, 1125, 13, 13, 9651, 396, 8878, 1732, 2009, 740, 1244, 29892, 679, 1121, 13, 9651, 396, 1246, 3653, 411, 1121, 13, 9651, 822, 15928, 29918, 3827, 7373, 9891, 29892, 3579, 19290, 1125, 13, 13, 18884, 822, 1207, 29918, 3827, 29898, 2271, 29892, 1158, 29892, 848, 1125, 13, 13, 462, 1678, 565, 1158, 1275, 525, 7194, 2396, 13, 462, 4706, 2933, 353, 7274, 29889, 657, 29898, 2271, 29922, 2271, 29892, 8636, 29922, 1272, 29897, 13, 462, 4706, 736, 2933, 29889, 3051, 13, 13, 462, 1678, 736, 6213, 13, 13, 18884, 2933, 353, 1207, 29918, 3827, 29898, 2271, 29892, 1158, 29892, 9049, 5085, 29897, 13, 18884, 736, 903, 9891, 29898, 5327, 29897, 13, 13, 9651, 282, 9891, 353, 7687, 29898, 9772, 29918, 3827, 29892, 285, 29918, 9891, 29897, 13, 9651, 282, 9891, 17255, 978, 1649, 353, 3653, 17255, 978, 1649, 13, 9651, 736, 282, 9891, 13, 13, 4706, 736, 14476, 29898, 9891, 29897, 13, 13, 1678, 565, 740, 338, 451, 6213, 29901, 13, 4706, 736, 10200, 1061, 29898, 2220, 29897, 13, 13, 1678, 736, 10200, 1061, 13, 2 ]
sandbox/order/migrations/0009_surcharge.py
thelabnyc/django-oscar-cch
14
77843
# Generated by Django 2.2.6 on 2020-02-19 09:16 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("order", "0008_auto_20190301_1035"), ] replaces = [ ("order", "0008_surcharge"), ] operations = [ migrations.CreateModel( name="Surcharge", fields=[ ( "id", models.AutoField( auto_created=True, primary_key=True, serialize=False, verbose_name="ID", ), ), ("name", models.CharField(max_length=128, verbose_name="Surcharge")), ( "code", models.CharField(max_length=128, verbose_name="Surcharge code"), ), ( "incl_tax", models.DecimalField( decimal_places=2, default=0, max_digits=12, verbose_name="Surcharge (inc. tax)", ), ), ( "excl_tax", models.DecimalField( decimal_places=2, default=0, max_digits=12, verbose_name="Surcharge (excl. tax)", ), ), ( "order", models.ForeignKey( on_delete=django.db.models.deletion.CASCADE, related_name="surcharges", to="order.Order", verbose_name="Surcharges", ), ), ], options={"abstract": False, "ordering": ["pk"]}, ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29953, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29900, 29906, 29899, 29896, 29929, 29871, 29900, 29929, 29901, 29896, 29953, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 5215, 9557, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 4852, 2098, 613, 376, 29900, 29900, 29900, 29947, 29918, 6921, 29918, 29906, 29900, 29896, 29929, 29900, 29941, 29900, 29896, 29918, 29896, 29900, 29941, 29945, 4968, 13, 1678, 4514, 13, 13, 1678, 1634, 6048, 353, 518, 13, 4706, 4852, 2098, 613, 376, 29900, 29900, 29900, 29947, 29918, 29879, 2458, 279, 479, 4968, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 543, 29903, 2458, 279, 479, 613, 13, 9651, 4235, 11759, 13, 18884, 313, 13, 462, 1678, 376, 333, 613, 13, 462, 1678, 4733, 29889, 12300, 3073, 29898, 13, 462, 4706, 4469, 29918, 11600, 29922, 5574, 29892, 13, 462, 4706, 7601, 29918, 1989, 29922, 5574, 29892, 13, 462, 4706, 28755, 29922, 8824, 29892, 13, 462, 4706, 26952, 29918, 978, 543, 1367, 613, 13, 462, 1678, 10353, 13, 18884, 10353, 13, 18884, 4852, 978, 613, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 29892, 26952, 29918, 978, 543, 29903, 2458, 279, 479, 1159, 511, 13, 18884, 313, 13, 462, 1678, 376, 401, 613, 13, 462, 1678, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 29892, 26952, 29918, 978, 543, 29903, 2458, 279, 479, 775, 4968, 13, 18884, 10353, 13, 18884, 313, 13, 462, 1678, 376, 262, 695, 29918, 20725, 613, 13, 462, 1678, 4733, 29889, 23307, 3073, 29898, 13, 462, 4706, 13677, 29918, 29886, 6048, 29922, 29906, 29892, 13, 462, 4706, 2322, 29922, 29900, 29892, 13, 462, 4706, 4236, 29918, 7501, 1169, 29922, 29896, 29906, 29892, 13, 462, 4706, 26952, 29918, 978, 543, 29903, 2458, 279, 479, 313, 3742, 29889, 8818, 19123, 13, 462, 1678, 10353, 13, 18884, 10353, 13, 18884, 313, 13, 462, 1678, 376, 735, 695, 29918, 20725, 613, 13, 462, 1678, 4733, 29889, 23307, 3073, 29898, 13, 462, 4706, 13677, 29918, 29886, 6048, 29922, 29906, 29892, 13, 462, 4706, 2322, 29922, 29900, 29892, 13, 462, 4706, 4236, 29918, 7501, 1169, 29922, 29896, 29906, 29892, 13, 462, 4706, 26952, 29918, 978, 543, 29903, 2458, 279, 479, 313, 735, 695, 29889, 8818, 19123, 13, 462, 1678, 10353, 13, 18884, 10353, 13, 18884, 313, 13, 462, 1678, 376, 2098, 613, 13, 462, 1678, 4733, 29889, 27755, 2558, 29898, 13, 462, 4706, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 13, 462, 4706, 4475, 29918, 978, 543, 29879, 2458, 1191, 267, 613, 13, 462, 4706, 304, 543, 2098, 29889, 7514, 613, 13, 462, 4706, 26952, 29918, 978, 543, 29903, 2458, 1191, 267, 613, 13, 462, 1678, 10353, 13, 18884, 10353, 13, 9651, 21251, 13, 9651, 3987, 3790, 29908, 16595, 1115, 7700, 29892, 376, 2098, 292, 1115, 6796, 20571, 3108, 1118, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
bcc-apps/python/hello_world.py
Huweicai/ebpf-apps
59
30997
#!/usr/bin/python3 # # This is a Hello World example of BPF. from bcc import BPF # define BPF program prog = """ int kprobe__sys_clone(void *ctx) { bpf_trace_printk("Hello, World!\\n"); return 0; } """ # load BPF program b = BPF(text=prog) b.trace_print()
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 29941, 13, 29937, 13, 29937, 910, 338, 263, 15043, 2787, 1342, 310, 350, 13691, 29889, 13, 3166, 289, 617, 1053, 350, 13691, 13, 13, 29937, 4529, 350, 13691, 1824, 13, 29097, 353, 9995, 13, 524, 413, 771, 915, 1649, 9675, 29918, 16513, 29898, 5405, 334, 13073, 29897, 13, 29912, 13, 1678, 289, 7810, 29918, 15003, 29918, 2158, 29895, 703, 10994, 29892, 2787, 29991, 1966, 29876, 1496, 13, 1678, 736, 29871, 29900, 29936, 13, 29913, 13, 15945, 29908, 13, 13, 29937, 2254, 350, 13691, 1824, 13, 29890, 353, 350, 13691, 29898, 726, 29922, 29097, 29897, 13, 29890, 29889, 15003, 29918, 2158, 580, 13, 2 ]
src/Pybind11Wraps/Neighbor/TreeNeighbor.py
markguozhiming/spheral
1
28496
#------------------------------------------------------------------------------- # TreeNeighbor #------------------------------------------------------------------------------- from PYB11Generator import * from Neighbor import * from NeighborAbstractMethods import * @PYB11template("Dimension") class TreeNeighbor(Neighbor): PYB11typedefs = """ typedef typename TreeNeighbor<%(Dimension)s>::LevelKey LevelKey; typedef typename TreeNeighbor<%(Dimension)s>::CellKey CellKey; typedef typename %(Dimension)s::Scalar Scalar; typedef typename %(Dimension)s::Vector Vector; typedef typename %(Dimension)s::Tensor Tensor; typedef typename %(Dimension)s::SymTensor SymTensor; typedef NodeList<%(Dimension)s> NodeListType; typedef GridCellIndex<%(Dimension)s> GridCellIndexType; typedef GeomPlane<%(Dimension)s> Plane; """ #........................................................................... # Constructors def pyinit(self, nodeList = "NodeListType&", searchType = ("const NeighborSearchType", "NeighborSearchType::GatherScatter"), kernelExtent = ("const double", "2.0"), xmin = "const Vector&", xmax = "const Vector&"): "Construct a TreeNeighbor" #........................................................................... # Methods @PYB11virtual def reinitialize(self, xmin = "const Vector&", xmax = "const Vector&", htarget = "const Scalar"): "Reinitialize to possibly more efficient based on the specified box (xmin,xmax) and htarget size" return "void" @PYB11const def gridLevel(self, h="const double&"): "Find the tree level appropriate for h (units of length)" return "unsigned" @PYB11const def gridLevel(self, H="const SymTensor&"): "Find the tree level appropriate for H (units of 1/length)" return "unsigned" @PYB11const def dumpTree(self, globalTree="const bool"): "Return a dump of the tree structure as a string" return "std::string" @PYB11const def dumpTreeStatistics(self, globalTree="const bool"): "Return a string describing the overall statistics of the tree" return "std::string" @PYB11const def serialize(self, buffer="std::vector<char>&"): "Serialize the current tree state to a buffer" return "void" @PYB11const def setTreeMasterList(self, levelID = "const LevelKey", cellID = "const CellKey", masterList = "std::vector<int>&", coarseNeighbors = "std::vector<int>&"): "For our parallel algorithm it is useful to be able to set the master/coarse information based on the given (level, cell)." return "void" @PYB11virtual @PYB11const def valid(self): "Test if the Neighbor is valid, i.e., ready to be queried for connectivity information." return "bool" #........................................................................... # Properties xmin = PYB11property("const Vector&", "xmin", doc="The minimum coordinate for the simulation bounding box") xmax = PYB11property("const Vector&", "xmax", doc="The maximum coordinate for the simulation bounding box") boxLength = PYB11property("double", "boxLength", doc="The maximum current cardinal coordinate distance across the bounding box") occupiedCells = PYB11property("std::vector<std::vector<CellKey>>", "occupiedCells", doc="The encoded cell key hashes for the cells currently occupied by nodes") #------------------------------------------------------------------------------- # Add the virtual interface #------------------------------------------------------------------------------- PYB11inject(NeighborAbstractMethods, TreeNeighbor, virtual=True)
[ 1, 396, 2683, 2683, 2683, 2683, 9072, 5634, 13, 29937, 15472, 8139, 1141, 4089, 13, 29937, 2683, 2683, 2683, 2683, 9072, 5634, 13, 3166, 349, 29979, 29933, 29896, 29896, 21575, 1053, 334, 13, 3166, 2448, 1141, 4089, 1053, 334, 13, 3166, 2448, 1141, 4089, 9118, 26112, 1053, 334, 13, 13, 29992, 20055, 29933, 29896, 29896, 6886, 703, 16142, 2673, 1159, 13, 1990, 15472, 8139, 1141, 4089, 29898, 8139, 1141, 4089, 1125, 13, 13, 1678, 349, 29979, 29933, 29896, 29896, 1017, 9795, 1389, 29879, 353, 9995, 13, 1678, 21787, 2393, 3871, 15472, 8139, 1141, 4089, 29966, 29995, 29898, 16142, 2673, 29897, 29879, 21347, 10108, 2558, 21597, 2558, 29936, 13, 1678, 21787, 2393, 3871, 15472, 8139, 1141, 4089, 29966, 29995, 29898, 16142, 2673, 29897, 29879, 21347, 4617, 2558, 19413, 2558, 29936, 13, 1678, 21787, 2393, 3871, 1273, 29898, 16142, 2673, 29897, 29879, 1057, 29636, 279, 317, 1052, 279, 29936, 13, 1678, 21787, 2393, 3871, 1273, 29898, 16142, 2673, 29897, 29879, 1057, 12877, 16510, 29936, 13, 1678, 21787, 2393, 3871, 1273, 29898, 16142, 2673, 29897, 29879, 1057, 29911, 6073, 323, 6073, 29936, 13, 1678, 21787, 2393, 3871, 1273, 29898, 16142, 2673, 29897, 29879, 1057, 25548, 29911, 6073, 10667, 29911, 6073, 29936, 13, 1678, 21787, 9071, 1293, 29966, 29995, 29898, 16142, 2673, 29897, 29879, 29958, 9071, 1293, 1542, 29936, 13, 1678, 21787, 11657, 4617, 3220, 29966, 29995, 29898, 16142, 2673, 29897, 29879, 29958, 11657, 4617, 3220, 1542, 29936, 13, 1678, 21787, 1879, 290, 3247, 1662, 29966, 29995, 29898, 16142, 2673, 29897, 29879, 29958, 1858, 1662, 29936, 13, 15945, 29908, 13, 13, 1678, 396, 25285, 25285, 25285, 25285, 11296, 856, 13, 1678, 396, 1281, 4984, 943, 13, 1678, 822, 11451, 2344, 29898, 1311, 29892, 13, 1669, 2943, 1293, 353, 376, 4247, 1293, 1542, 29987, 613, 13, 1669, 2740, 1542, 353, 4852, 3075, 2448, 1141, 4089, 7974, 1542, 613, 376, 8139, 1141, 4089, 7974, 1542, 1057, 29954, 1624, 4421, 2620, 4968, 13, 1669, 8466, 5647, 296, 353, 4852, 3075, 3765, 613, 376, 29906, 29889, 29900, 4968, 13, 1669, 921, 1195, 353, 376, 3075, 16510, 29987, 613, 13, 1669, 921, 3317, 353, 376, 3075, 16510, 29987, 29908, 1125, 13, 4706, 376, 1168, 4984, 263, 15472, 8139, 1141, 4089, 29908, 13, 13, 1678, 396, 25285, 25285, 25285, 25285, 11296, 856, 13, 1678, 396, 8108, 29879, 13, 1678, 732, 20055, 29933, 29896, 29896, 18714, 13, 1678, 822, 337, 24926, 29898, 1311, 29892, 13, 462, 268, 921, 1195, 353, 376, 3075, 16510, 29987, 613, 13, 462, 268, 921, 3317, 353, 376, 3075, 16510, 29987, 613, 13, 462, 268, 298, 5182, 353, 376, 3075, 317, 1052, 279, 29908, 1125, 13, 4706, 376, 1123, 24926, 304, 10075, 901, 8543, 2729, 373, 278, 6790, 3800, 313, 29916, 1195, 29892, 29916, 3317, 29897, 322, 298, 5182, 2159, 29908, 13, 4706, 736, 376, 5405, 29908, 13, 13, 1678, 732, 20055, 29933, 29896, 29896, 3075, 13, 1678, 822, 6856, 10108, 29898, 1311, 29892, 298, 543, 3075, 3765, 29987, 29908, 1125, 13, 4706, 376, 12542, 278, 5447, 3233, 8210, 363, 298, 313, 348, 1169, 310, 3309, 5513, 13, 4706, 736, 376, 15395, 29908, 13, 462, 259, 13, 1678, 732, 20055, 29933, 29896, 29896, 3075, 13, 1678, 822, 6856, 10108, 29898, 1311, 29892, 379, 543, 3075, 10667, 29911, 6073, 29987, 29908, 1125, 13, 4706, 376, 12542, 278, 5447, 3233, 8210, 363, 379, 313, 348, 1169, 310, 29871, 29896, 29914, 2848, 5513, 13, 4706, 736, 376, 15395, 29908, 13, 462, 259, 13, 1678, 732, 20055, 29933, 29896, 29896, 3075, 13, 1678, 822, 16766, 9643, 29898, 1311, 29892, 5534, 9643, 543, 3075, 6120, 29908, 1125, 13, 4706, 376, 11609, 263, 16766, 310, 278, 5447, 3829, 408, 263, 1347, 29908, 13, 4706, 736, 376, 4172, 1057, 1807, 29908, 13, 13, 1678, 732, 20055, 29933, 29896, 29896, 3075, 13, 1678, 822, 16766, 9643, 9513, 6765, 29898, 1311, 29892, 5534, 9643, 543, 3075, 6120, 29908, 1125, 13, 4706, 376, 11609, 263, 1347, 20766, 278, 12463, 13964, 310, 278, 5447, 29908, 13, 4706, 736, 376, 4172, 1057, 1807, 29908, 13, 268, 13, 1678, 732, 20055, 29933, 29896, 29896, 3075, 13, 1678, 822, 28755, 29898, 1311, 29892, 6835, 543, 4172, 1057, 8111, 29966, 3090, 19250, 29908, 1125, 13, 4706, 376, 1748, 6646, 278, 1857, 5447, 2106, 304, 263, 6835, 29908, 13, 4706, 736, 376, 5405, 29908, 13, 13, 1678, 732, 20055, 29933, 29896, 29896, 3075, 13, 1678, 822, 731, 9643, 19203, 1293, 29898, 1311, 29892, 13, 462, 3986, 3233, 1367, 353, 376, 3075, 21597, 2558, 613, 13, 462, 3986, 3038, 1367, 353, 376, 3075, 19413, 2558, 613, 13, 462, 3986, 5835, 1293, 353, 376, 4172, 1057, 8111, 29966, 524, 19250, 613, 13, 462, 3986, 1302, 7989, 8139, 1141, 29890, 943, 353, 376, 4172, 1057, 8111, 29966, 524, 19250, 29908, 1125, 13, 4706, 376, 2831, 1749, 8943, 5687, 372, 338, 5407, 304, 367, 2221, 304, 731, 278, 5835, 29914, 1111, 7989, 2472, 2729, 373, 278, 2183, 313, 5563, 29892, 3038, 467, 29908, 13, 4706, 736, 376, 5405, 29908, 13, 13, 1678, 732, 20055, 29933, 29896, 29896, 18714, 13, 1678, 732, 20055, 29933, 29896, 29896, 3075, 13, 1678, 822, 2854, 29898, 1311, 1125, 13, 4706, 376, 3057, 565, 278, 2448, 1141, 4089, 338, 2854, 29892, 474, 29889, 29872, 1696, 7960, 304, 367, 22320, 1000, 363, 4511, 2068, 2472, 1213, 13, 4706, 736, 376, 11227, 29908, 13, 13, 1678, 396, 25285, 25285, 25285, 25285, 11296, 856, 13, 1678, 396, 21582, 13, 1678, 921, 1195, 353, 349, 29979, 29933, 29896, 29896, 6799, 703, 3075, 16510, 29987, 613, 376, 29916, 1195, 613, 1574, 543, 1576, 9212, 14821, 363, 278, 17402, 3216, 292, 3800, 1159, 13, 1678, 921, 3317, 353, 349, 29979, 29933, 29896, 29896, 6799, 703, 3075, 16510, 29987, 613, 376, 29916, 3317, 613, 1574, 543, 1576, 7472, 14821, 363, 278, 17402, 3216, 292, 3800, 1159, 13, 1678, 3800, 6513, 353, 349, 29979, 29933, 29896, 29896, 6799, 703, 8896, 613, 376, 1884, 6513, 613, 1574, 543, 1576, 7472, 1857, 21008, 14821, 5418, 4822, 278, 3216, 292, 3800, 1159, 13, 1678, 16404, 13418, 353, 349, 29979, 29933, 29896, 29896, 6799, 703, 4172, 1057, 8111, 29966, 4172, 1057, 8111, 29966, 4617, 2558, 6778, 613, 376, 16770, 1000, 13418, 613, 1574, 543, 1576, 18511, 3038, 1820, 6608, 267, 363, 278, 9101, 5279, 16404, 491, 7573, 1159, 13, 13, 29937, 2683, 2683, 2683, 2683, 9072, 5634, 13, 29937, 3462, 278, 6901, 5067, 13, 29937, 2683, 2683, 2683, 2683, 9072, 5634, 13, 20055, 29933, 29896, 29896, 21920, 29898, 8139, 1141, 4089, 9118, 26112, 29892, 15472, 8139, 1141, 4089, 29892, 6901, 29922, 5574, 29897, 13, 2 ]
schema/predict/params/google/cloud/aiplatform/v1beta1/schema/predict/params_v1beta1/types/video_classification.py
SinaChavoshi/python-aiplatform
0
138456
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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 proto # type: ignore __protobuf__ = proto.module( package='google.cloud.aiplatform.v1beta1.schema.predict.params', manifest={ 'VideoClassificationPredictionParams', }, ) class VideoClassificationPredictionParams(proto.Message): r"""Prediction model parameters for Video Classification. Attributes: confidence_threshold (float): The Model only returns predictions with at least this confidence score. Default value is 0.0 max_predictions (int): The Model only returns up to that many top, by confidence score, predictions per instance. If this number is very high, the Model may return fewer predictions. Default value is 10,000. segment_classification (bool): Set to true to request segment-level classification. AI Platform returns labels and their confidence scores for the entire time segment of the video that user specified in the input instance. Default value is true shot_classification (bool): Set to true to request shot-level classification. AI Platform determines the boundaries for each camera shot in the entire time segment of the video that user specified in the input instance. AI Platform then returns labels and their confidence scores for each detected shot, along with the start and end time of the shot. WARNING: Model evaluation is not done for this classification type, the quality of it depends on the training data, but there are no metrics provided to describe that quality. Default value is false one_sec_interval_classification (bool): Set to true to request classification for a video at one-second intervals. AI Platform returns labels and their confidence scores for each second of the entire time segment of the video that user specified in the input WARNING: Model evaluation is not done for this classification type, the quality of it depends on the training data, but there are no metrics provided to describe that quality. Default value is false """ confidence_threshold = proto.Field( proto.FLOAT, number=1, ) max_predictions = proto.Field( proto.INT32, number=2, ) segment_classification = proto.Field( proto.BOOL, number=3, ) shot_classification = proto.Field( proto.BOOL, number=4, ) one_sec_interval_classification = proto.Field( proto.BOOL, number=5, ) __all__ = tuple(sorted(__protobuf__.manifest))
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 5087, 365, 12182, 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, 29937, 13, 5215, 17814, 29871, 396, 1134, 29901, 11455, 13, 13, 13, 1649, 17529, 9721, 1649, 353, 17814, 29889, 5453, 29898, 13, 1678, 3577, 2433, 3608, 29889, 9274, 29889, 1794, 12120, 29889, 29894, 29896, 3571, 29896, 29889, 11010, 29889, 27711, 29889, 7529, 742, 13, 1678, 10419, 3790, 13, 4706, 525, 15167, 2385, 2450, 23084, 2463, 9629, 742, 13, 1678, 2981, 13, 29897, 13, 13, 13, 1990, 13987, 2385, 2450, 23084, 2463, 9629, 29898, 17529, 29889, 3728, 1125, 13, 1678, 364, 15945, 29908, 23084, 2463, 1904, 4128, 363, 13987, 23236, 29889, 13, 1678, 6212, 5026, 29901, 13, 4706, 16420, 29918, 386, 12268, 313, 7411, 1125, 13, 9651, 450, 8125, 871, 3639, 27303, 411, 472, 13, 9651, 3203, 445, 16420, 8158, 29889, 13109, 995, 338, 13, 632, 29900, 29889, 29900, 13, 4706, 4236, 29918, 27711, 1080, 313, 524, 1125, 13, 9651, 450, 8125, 871, 3639, 701, 304, 393, 1784, 2246, 29892, 13, 9651, 491, 16420, 8158, 29892, 27303, 639, 2777, 29889, 13, 9651, 960, 445, 1353, 338, 1407, 1880, 29892, 278, 8125, 1122, 13, 9651, 736, 28145, 27303, 29889, 13109, 995, 338, 13, 632, 29896, 29900, 29892, 29900, 29900, 29900, 29889, 13, 4706, 10768, 29918, 1990, 2450, 313, 11227, 1125, 13, 9651, 3789, 304, 1565, 304, 2009, 10768, 29899, 5563, 13, 9651, 12965, 29889, 319, 29902, 28096, 3639, 11073, 322, 13, 9651, 1009, 16420, 19435, 363, 278, 4152, 931, 13, 9651, 10768, 310, 278, 4863, 393, 1404, 6790, 297, 278, 13, 9651, 1881, 2777, 29889, 13109, 995, 338, 1565, 13, 4706, 10322, 29918, 1990, 2450, 313, 11227, 1125, 13, 9651, 3789, 304, 1565, 304, 2009, 10322, 29899, 5563, 13, 9651, 12965, 29889, 319, 29902, 28096, 3683, 1475, 278, 13, 9651, 24371, 363, 1269, 10656, 10322, 297, 278, 4152, 13, 9651, 931, 10768, 310, 278, 4863, 393, 1404, 6790, 297, 13, 9651, 278, 1881, 2777, 29889, 319, 29902, 28096, 769, 3639, 13, 9651, 11073, 322, 1009, 16420, 19435, 363, 1269, 13, 9651, 17809, 10322, 29892, 3412, 411, 278, 1369, 322, 1095, 931, 13, 9651, 310, 278, 10322, 29889, 13, 9651, 399, 25614, 29901, 8125, 17983, 338, 451, 2309, 363, 445, 13, 9651, 12965, 1134, 29892, 278, 11029, 310, 372, 7111, 13, 9651, 373, 278, 6694, 848, 29892, 541, 727, 526, 694, 21556, 13, 9651, 4944, 304, 8453, 393, 11029, 29889, 13, 9651, 13109, 995, 338, 2089, 13, 4706, 697, 29918, 3471, 29918, 19207, 29918, 1990, 2450, 313, 11227, 1125, 13, 9651, 3789, 304, 1565, 304, 2009, 12965, 363, 263, 13, 9651, 4863, 472, 697, 29899, 7496, 18747, 29889, 319, 29902, 28096, 13, 9651, 3639, 11073, 322, 1009, 16420, 19435, 363, 13, 9651, 1269, 1473, 310, 278, 4152, 931, 10768, 310, 278, 13, 9651, 4863, 393, 1404, 6790, 297, 278, 1881, 399, 25614, 29901, 13, 9651, 8125, 17983, 338, 451, 2309, 363, 445, 13, 9651, 12965, 1134, 29892, 278, 11029, 310, 372, 7111, 13, 9651, 373, 278, 6694, 848, 29892, 541, 727, 526, 694, 21556, 13, 9651, 4944, 304, 8453, 393, 11029, 29889, 13109, 995, 13, 9651, 338, 2089, 13, 1678, 9995, 13, 13, 1678, 16420, 29918, 386, 12268, 353, 17814, 29889, 3073, 29898, 13, 4706, 17814, 29889, 29943, 3927, 1299, 29892, 13, 4706, 1353, 29922, 29896, 29892, 13, 1678, 1723, 13, 1678, 4236, 29918, 27711, 1080, 353, 17814, 29889, 3073, 29898, 13, 4706, 17814, 29889, 10192, 29941, 29906, 29892, 13, 4706, 1353, 29922, 29906, 29892, 13, 1678, 1723, 13, 1678, 10768, 29918, 1990, 2450, 353, 17814, 29889, 3073, 29898, 13, 4706, 17814, 29889, 28443, 29892, 13, 4706, 1353, 29922, 29941, 29892, 13, 1678, 1723, 13, 1678, 10322, 29918, 1990, 2450, 353, 17814, 29889, 3073, 29898, 13, 4706, 17814, 29889, 28443, 29892, 13, 4706, 1353, 29922, 29946, 29892, 13, 1678, 1723, 13, 1678, 697, 29918, 3471, 29918, 19207, 29918, 1990, 2450, 353, 17814, 29889, 3073, 29898, 13, 4706, 17814, 29889, 28443, 29892, 13, 4706, 1353, 29922, 29945, 29892, 13, 1678, 1723, 13, 13, 13, 1649, 497, 1649, 353, 18761, 29898, 24582, 22168, 17529, 9721, 26914, 29135, 876, 13, 2 ]